diff --git a/.librarian/generator-input/client-post-processing/add-dependency-google-cloud-common.yaml b/.librarian/generator-input/client-post-processing/add-dependency-google-cloud-common.yaml index 22f22df1e651..289ca7c7712d 100644 --- a/.librarian/generator-input/client-post-processing/add-dependency-google-cloud-common.yaml +++ b/.librarian/generator-input/client-post-processing/add-dependency-google-cloud-common.yaml @@ -23,7 +23,7 @@ replacements: # 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", after: | dependencies = [ "google-api-core[grpc] >= 2.17.1, <3.0.0", @@ -31,5 +31,5 @@ replacements: # See https://github.com/googleapis/google-cloud-python/issues/12364 "google-auth >= 2.14.1, <3.0.0,!=2.24.0,!=2.25.0", "google-cloud-common >= 1.0.0, <2.0.0", - "grpcio >= 1.44.0, < 2.0.0", + "grpcio >= 1.59.0, < 2.0.0", count: 1 diff --git a/.librarian/generator-input/client-post-processing/add-missing-dependencies-to-setup-py-constraints.yaml b/.librarian/generator-input/client-post-processing/add-missing-dependencies-to-setup-py-constraints.yaml index 4ac707826312..1f8c7353df3a 100644 --- a/.librarian/generator-input/client-post-processing/add-missing-dependencies-to-setup-py-constraints.yaml +++ b/.librarian/generator-input/client-post-processing/add-missing-dependencies-to-setup-py-constraints.yaml @@ -23,7 +23,7 @@ replacements: # 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", after: | dependencies = [ "google-api-core[grpc] >= 2.17.1, <3.0.0", @@ -31,7 +31,7 @@ replacements: # See https://github.com/googleapis/google-cloud-python/issues/12364 "google-auth >= 2.14.1, <3.0.0,!=2.24.0,!=2.25.0", "grpc-google-iam-v1 >=0.12.4, <1.0.0", - "grpcio >= 1.44.0, < 2.0.0", + "grpcio >= 1.59.0, < 2.0.0", count: 1 - paths: [ packages/google-cloud-build/setup.py @@ -42,7 +42,7 @@ replacements: # 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", after: | dependencies = [ "google-api-core[grpc] >= 2.17.1, <3.0.0", @@ -50,7 +50,7 @@ replacements: # See https://github.com/googleapis/google-cloud-python/issues/12364 "google-auth >= 2.14.1, <3.0.0,!=2.24.0,!=2.25.0", "grpc-google-iam-v1 >=0.12.4, <1.0.0", - "grpcio >= 1.44.0, < 2.0.0", + "grpcio >= 1.59.0, < 2.0.0", count: 1 - paths: [ packages/google-cloud-binary-authorization/setup.py @@ -61,7 +61,7 @@ replacements: # 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", after: | dependencies = [ "google-api-core[grpc] >= 2.17.1, <3.0.0", @@ -69,7 +69,7 @@ replacements: # See https://github.com/googleapis/google-cloud-python/issues/12364 "google-auth >= 2.14.1, <3.0.0,!=2.24.0,!=2.25.0", "grafeas >= 1.7.0, <2.0", - "grpcio >= 1.44.0, < 2.0.0", + "grpcio >= 1.59.0, < 2.0.0", count: 1 - paths: [ packages/google-cloud-iam/setup.py @@ -80,7 +80,7 @@ replacements: # 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", after: | dependencies = [ "google-api-core[grpc] >= 2.17.1, <3.0.0", @@ -88,7 +88,7 @@ replacements: # See https://github.com/googleapis/google-cloud-python/issues/12364 "google-auth >= 2.14.1, <3.0.0,!=2.24.0,!=2.25.0", "grpc-google-iam-v1 >=0.12.4, <1.0.0", - "grpcio >= 1.44.0, < 2.0.0", + "grpcio >= 1.59.0, < 2.0.0", count: 1 - paths: [ packages/google-cloud-policysimulator/setup.py @@ -99,7 +99,7 @@ replacements: # 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", after: | dependencies = [ "google-api-core[grpc] >= 2.17.1, <3.0.0", @@ -107,7 +107,7 @@ replacements: # See https://github.com/googleapis/google-cloud-python/issues/12364 "google-auth >= 2.14.1, <3.0.0,!=2.24.0,!=2.25.0", "google-cloud-org-policy >= 1.11.1, <2.0.0", - "grpcio >= 1.44.0, < 2.0.0", + "grpcio >= 1.59.0, < 2.0.0", count: 1 - paths: [ packages/google-shopping-merchant-notifications/setup.py @@ -118,7 +118,7 @@ replacements: # 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", after: | dependencies = [ "google-api-core[grpc] >= 2.17.1, <3.0.0", @@ -126,5 +126,5 @@ replacements: # See https://github.com/googleapis/google-cloud-python/issues/12364 "google-auth >= 2.14.1, <3.0.0,!=2.24.0,!=2.25.0", "google-shopping-type >= 1.0.0, <2.0.0", - "grpcio >= 1.44.0, < 2.0.0", + "grpcio >= 1.59.0, < 2.0.0", count: 1 diff --git a/.librarian/generator-input/client-post-processing/asset-integration.yaml b/.librarian/generator-input/client-post-processing/asset-integration.yaml index 59051fa2742e..8246cb16f7a8 100644 --- a/.librarian/generator-input/client-post-processing/asset-integration.yaml +++ b/.librarian/generator-input/client-post-processing/asset-integration.yaml @@ -23,7 +23,7 @@ replacements: # 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", after: | dependencies = [ "google-api-core[grpc] >= 2.17.1, <3.0.0", @@ -31,7 +31,7 @@ replacements: # See https://github.com/googleapis/google-cloud-python/issues/12364 "google-auth >= 2.14.1, <3.0.0,!=2.24.0,!=2.25.0", "google-cloud-org-policy >= 1.11.1, <2.0.0", - "grpcio >= 1.44.0, < 2.0.0", + "grpcio >= 1.59.0, < 2.0.0", count: 1 - paths: [ diff --git a/.librarian/generator-input/client-post-processing/containeranalysis-grafeas-integration.yaml b/.librarian/generator-input/client-post-processing/containeranalysis-grafeas-integration.yaml index 0c8a8e94be54..65602c6d2286 100644 --- a/.librarian/generator-input/client-post-processing/containeranalysis-grafeas-integration.yaml +++ b/.librarian/generator-input/client-post-processing/containeranalysis-grafeas-integration.yaml @@ -23,7 +23,7 @@ replacements: # 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", after: | dependencies = [ "google-api-core[grpc] >= 2.17.1, <3.0.0", @@ -31,7 +31,7 @@ replacements: # See https://github.com/googleapis/google-cloud-python/issues/12364 "google-auth >= 2.14.1, <3.0.0,!=2.24.0,!=2.25.0", "grafeas >=1.7.0, <2.0", - "grpcio >= 1.44.0, < 2.0.0", + "grpcio >= 1.59.0, < 2.0.0", count: 1 - paths: [ packages/google-cloud-containeranalysis/google/cloud/devtools/containeranalysis_v1/services/container_analysis/client.py, diff --git a/.librarian/generator-input/client-post-processing/datastore-integration.yaml b/.librarian/generator-input/client-post-processing/datastore-integration.yaml index 15c954f6de18..7d81275e77c0 100644 --- a/.librarian/generator-input/client-post-processing/datastore-integration.yaml +++ b/.librarian/generator-input/client-post-processing/datastore-integration.yaml @@ -33,11 +33,11 @@ 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-core >= 2.0.0, <3.0.0", - "grpcio >= 1.44.0, < 2.0.0", + "grpcio >= 1.59.0, < 2.0.0", count: 1 - paths: [ "packages/google-cloud-datastore/mypy.ini", diff --git a/.librarian/generator-input/client-post-processing/firestore-integration.yaml b/.librarian/generator-input/client-post-processing/firestore-integration.yaml index 7ce7ddb64a94..2114dbabca04 100644 --- a/.librarian/generator-input/client-post-processing/firestore-integration.yaml +++ b/.librarian/generator-input/client-post-processing/firestore-integration.yaml @@ -603,11 +603,11 @@ 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-core >= 2.0.0, <3.0.0", - "grpcio >= 1.44.0, < 2.0.0", + "grpcio >= 1.59.0, < 2.0.0", count: 1 - paths: [ "packages/google-cloud-firestore/docs/index.rst", @@ -649,11 +649,11 @@ replacements: ] before: | google-auth==2.14.1 - grpcio==1.44.0 + grpcio==1.59.0 after: | google-auth==2.14.1 google-cloud-core==2.0.0 - grpcio==1.44.0 + grpcio==1.59.0 count: 1 - paths: [ "packages/google-cloud-firestore/testing/constraints-3.13.txt", diff --git a/.librarian/generator-input/client-post-processing/integrate-isolated-handwritten-code.yaml b/.librarian/generator-input/client-post-processing/integrate-isolated-handwritten-code.yaml index 86fb3ae2e85a..d7a85d8e40a8 100644 --- a/.librarian/generator-input/client-post-processing/integrate-isolated-handwritten-code.yaml +++ b/.librarian/generator-input/client-post-processing/integrate-isolated-handwritten-code.yaml @@ -64,7 +64,7 @@ replacements: # 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", after: | dependencies = [ "google-api-core[grpc] >= 2.17.1, <3.0.0", @@ -72,7 +72,7 @@ replacements: # See https://github.com/googleapis/google-cloud-python/issues/12364 "google-auth >= 2.14.1, <3.0.0,!=2.24.0,!=2.25.0", "google-cloud-core >= 2.0.0, <3.0.0", - "grpcio >= 1.44.0, < 2.0.0", + "grpcio >= 1.59.0, < 2.0.0", count: 1 - paths: [ "packages/google-cloud-translate/docs/index.rst", @@ -328,11 +328,11 @@ 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-logging>=3.9.0, <4.0.0", - "grpcio >= 1.44.0, < 2.0.0", + "grpcio >= 1.59.0, < 2.0.0", count: 1 - paths: [ "packages/google-cloud-error-reporting/docs/index.rst", @@ -437,11 +437,11 @@ replacements: ] before: | google-auth==2.14.1 - grpcio==1.44.0 + grpcio==1.59.0 after: | google-auth==2.14.1 google-cloud-logging==3.9.0 - grpcio==1.44.0 + grpcio==1.59.0 count: 1 - paths: [ "packages/google-cloud-error-reporting/testing/constraints-3.13.txt", diff --git a/.librarian/generator-input/client-post-processing/pubsub-integration.yaml b/.librarian/generator-input/client-post-processing/pubsub-integration.yaml index eedf4827e447..97e87b026ae5 100644 --- a/.librarian/generator-input/client-post-processing/pubsub-integration.yaml +++ b/.librarian/generator-input/client-post-processing/pubsub-integration.yaml @@ -516,7 +516,7 @@ replacements: - paths: - "packages/google-cloud-pubsub/testing/constraints-3.10.txt" - before: 'grpcio==1.44.0' + before: 'grpcio==1.59.0' after: 'grpcio==1.51.3' count: 1 diff --git a/.librarian/generator-input/client-post-processing/spanner-integration.yaml b/.librarian/generator-input/client-post-processing/spanner-integration.yaml index 4a2461205c77..f00d166046ff 100644 --- a/.librarian/generator-input/client-post-processing/spanner-integration.yaml +++ b/.librarian/generator-input/client-post-processing/spanner-integration.yaml @@ -1402,7 +1402,7 @@ replacements: googleapis-common-protos==1.60.0 count: 1 - paths: [packages/google-cloud-spanner/testing/constraints-3.10.txt] - before: 'grpcio==1\.44\.0\n(?!grpcio-status)' + before: 'grpcio==1.59.0\n(?!grpcio-status)' after: | grpcio==1.49.1 grpcio-status==1.49.1 diff --git a/.librarian/generator-input/client-post-processing/storage-integration.yaml b/.librarian/generator-input/client-post-processing/storage-integration.yaml index 8d9d4244b466..55a062f43071 100644 --- a/.librarian/generator-input/client-post-processing/storage-integration.yaml +++ b/.librarian/generator-input/client-post-processing/storage-integration.yaml @@ -597,9 +597,9 @@ replacements: # experimental in this SDK. More info in b/465352227 "grpc": [ "google-api-core[grpc] >= 2.27.0, < 3.0.0", - "grpcio >= 1.44.0, < 2.0.0; python_version < '3.14'", + "grpcio >= 1.59.0, < 2.0.0; python_version < '3.14'", "grpcio >= 1.75.1, < 2.0.0; python_version >= '3.14'", - "grpcio-status >= 1.44.0, < 2.0.0; python_version < '3.14'", + "grpcio-status >= 1.59.0, < 2.0.0; python_version < '3.14'", "grpcio-status >= 1.75.1, < 2.0.0; python_version >= '3.14'", "proto-plus >= 1.22.3, <2.0.0; python_version < '3.13'", "proto-plus >= 1.25.0, <2.0.0; python_version >= '3.13'", @@ -642,7 +642,7 @@ replacements: before: | 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 @@ -653,8 +653,8 @@ replacements: google-api-core==2.27.0 google-cloud-core==2.4.2 google-resumable-media==2.7.2 - grpcio==1.44.0 - grpcio-status==1.44.0 + grpcio==1.59.0 + grpcio-status==1.59.0 proto-plus==1.22.3 protobuf==4.25.8 grpc-google-iam-v1==0.14.0 diff --git a/librarian.yaml b/librarian.yaml index 5a50707a5fdd..36006b5f731e 100644 --- a/librarian.yaml +++ b/librarian.yaml @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. language: python -version: v0.15.0 +version: v0.15.1-0.20260528141105-567c9bf1faa7 repo: googleapis/google-cloud-python sources: googleapis: diff --git a/packages/google-ads-admanager/noxfile.py b/packages/google-ads-admanager/noxfile.py index 761753b437c3..266ed37fd871 100644 --- a/packages/google-ads-admanager/noxfile.py +++ b/packages/google-ads-admanager/noxfile.py @@ -47,7 +47,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-ads-admanager" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-ads-admanager/setup.py b/packages/google-ads-admanager/setup.py index 2f542f65b206..58ac519a48ab 100644 --- a/packages/google-ads-admanager/setup.py +++ b/packages/google-ads-admanager/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/google-ads-admanager/testing/constraints-3.10.txt b/packages/google-ads-admanager/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-ads-admanager/testing/constraints-3.10.txt +++ b/packages/google-ads-admanager/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-ads-admanager/tests/unit/gapic/admanager_v1/test_ad_break_service.py b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_ad_break_service.py index 751d53618e27..56dfd1b96d2e 100644 --- a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_ad_break_service.py +++ b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_ad_break_service.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 @@ -114,6 +115,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" @@ -3250,7 +3266,6 @@ def test_get_ad_break_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ad_break_service.GetAdBreakRequest() - assert args[0] == request_msg @@ -3270,7 +3285,6 @@ def test_list_ad_breaks_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ad_break_service.ListAdBreaksRequest() - assert args[0] == request_msg @@ -3290,7 +3304,6 @@ def test_create_ad_break_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ad_break_service.CreateAdBreakRequest() - assert args[0] == request_msg @@ -3310,7 +3323,6 @@ def test_update_ad_break_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ad_break_service.UpdateAdBreakRequest() - assert args[0] == request_msg @@ -3330,7 +3342,6 @@ def test_delete_ad_break_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ad_break_service.DeleteAdBreakRequest() - assert args[0] == request_msg diff --git a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_ad_review_center_ad_service.py b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_ad_review_center_ad_service.py index de79d37232ed..4a139a6f8686 100644 --- a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_ad_review_center_ad_service.py +++ b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_ad_review_center_ad_service.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 @@ -117,6 +118,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" @@ -2511,7 +2527,6 @@ def test_search_ad_review_center_ads_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ad_review_center_ad_service.SearchAdReviewCenterAdsRequest() - assert args[0] == request_msg @@ -2533,7 +2548,6 @@ def test_batch_allow_ad_review_center_ads_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ad_review_center_ad_service.BatchAllowAdReviewCenterAdsRequest() - assert args[0] == request_msg @@ -2555,7 +2569,6 @@ def test_batch_block_ad_review_center_ads_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ad_review_center_ad_service.BatchBlockAdReviewCenterAdsRequest() - assert args[0] == request_msg diff --git a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_ad_unit_service.py b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_ad_unit_service.py index 076aeaa77864..b76d4a835c01 100644 --- a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_ad_unit_service.py +++ b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_ad_unit_service.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 @@ -120,6 +121,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" @@ -5122,7 +5138,6 @@ def test_get_ad_unit_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ad_unit_service.GetAdUnitRequest() - assert args[0] == request_msg @@ -5142,7 +5157,6 @@ def test_list_ad_units_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ad_unit_service.ListAdUnitsRequest() - assert args[0] == request_msg @@ -5164,7 +5178,6 @@ def test_list_ad_unit_sizes_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ad_unit_service.ListAdUnitSizesRequest() - assert args[0] == request_msg @@ -5184,7 +5197,6 @@ def test_create_ad_unit_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ad_unit_service.CreateAdUnitRequest() - assert args[0] == request_msg @@ -5204,7 +5216,6 @@ def test_update_ad_unit_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ad_unit_service.UpdateAdUnitRequest() - assert args[0] == request_msg @@ -5226,7 +5237,6 @@ def test_batch_create_ad_units_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ad_unit_service.BatchCreateAdUnitsRequest() - assert args[0] == request_msg @@ -5248,7 +5258,6 @@ def test_batch_update_ad_units_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ad_unit_service.BatchUpdateAdUnitsRequest() - assert args[0] == request_msg @@ -5270,7 +5279,6 @@ def test_batch_activate_ad_units_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ad_unit_service.BatchActivateAdUnitsRequest() - assert args[0] == request_msg @@ -5292,7 +5300,6 @@ def test_batch_deactivate_ad_units_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ad_unit_service.BatchDeactivateAdUnitsRequest() - assert args[0] == request_msg @@ -5314,7 +5321,6 @@ def test_batch_archive_ad_units_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ad_unit_service.BatchArchiveAdUnitsRequest() - assert args[0] == request_msg diff --git a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_application_service.py b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_application_service.py index 4e0304faeda1..47662c8b5fe6 100644 --- a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_application_service.py +++ b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_application_service.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" @@ -4396,7 +4412,6 @@ def test_get_application_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = application_service.GetApplicationRequest() - assert args[0] == request_msg @@ -4418,7 +4433,6 @@ def test_list_applications_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = application_service.ListApplicationsRequest() - assert args[0] == request_msg @@ -4440,7 +4454,6 @@ def test_create_application_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = application_service.CreateApplicationRequest() - assert args[0] == request_msg @@ -4462,7 +4475,6 @@ def test_batch_create_applications_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = application_service.BatchCreateApplicationsRequest() - assert args[0] == request_msg @@ -4484,7 +4496,6 @@ def test_update_application_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = application_service.UpdateApplicationRequest() - assert args[0] == request_msg @@ -4506,7 +4517,6 @@ def test_batch_update_applications_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = application_service.BatchUpdateApplicationsRequest() - assert args[0] == request_msg @@ -4528,7 +4538,6 @@ def test_batch_archive_applications_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = application_service.BatchArchiveApplicationsRequest() - assert args[0] == request_msg @@ -4550,7 +4559,6 @@ def test_batch_unarchive_applications_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = application_service.BatchUnarchiveApplicationsRequest() - assert args[0] == request_msg diff --git a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_audience_segment_service.py b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_audience_segment_service.py index 267e366a9679..31fe68318366 100644 --- a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_audience_segment_service.py +++ b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_audience_segment_service.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 @@ -110,6 +111,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" @@ -2162,7 +2178,6 @@ def test_get_audience_segment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = audience_segment_service.GetAudienceSegmentRequest() - assert args[0] == request_msg @@ -2184,7 +2199,6 @@ def test_list_audience_segments_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = audience_segment_service.ListAudienceSegmentsRequest() - assert args[0] == request_msg diff --git a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_bandwidth_group_service.py b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_bandwidth_group_service.py index 0bc1cd63e50f..32e9d64e8ec9 100644 --- a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_bandwidth_group_service.py +++ b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_bandwidth_group_service.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 @@ -110,6 +111,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" @@ -2156,7 +2172,6 @@ def test_get_bandwidth_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = bandwidth_group_service.GetBandwidthGroupRequest() - assert args[0] == request_msg @@ -2178,7 +2193,6 @@ def test_list_bandwidth_groups_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = bandwidth_group_service.ListBandwidthGroupsRequest() - assert args[0] == request_msg diff --git a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_browser_language_service.py b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_browser_language_service.py index 3bdd4485db09..c975d4b3e6a8 100644 --- a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_browser_language_service.py +++ b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_browser_language_service.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 @@ -110,6 +111,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" @@ -2162,7 +2178,6 @@ def test_get_browser_language_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = browser_language_service.GetBrowserLanguageRequest() - assert args[0] == request_msg @@ -2184,7 +2199,6 @@ def test_list_browser_languages_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = browser_language_service.ListBrowserLanguagesRequest() - assert args[0] == request_msg diff --git a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_browser_service.py b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_browser_service.py index f544bc8e19f5..f9e143c3a175 100644 --- a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_browser_service.py +++ b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_browser_service.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 @@ -107,6 +108,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" @@ -2081,7 +2097,6 @@ def test_get_browser_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = browser_service.GetBrowserRequest() - assert args[0] == request_msg @@ -2101,7 +2116,6 @@ def test_list_browsers_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = browser_service.ListBrowsersRequest() - assert args[0] == request_msg diff --git a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_cms_metadata_key_service.py b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_cms_metadata_key_service.py index b2ad7158a988..842402776af5 100644 --- a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_cms_metadata_key_service.py +++ b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_cms_metadata_key_service.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" @@ -2869,7 +2885,6 @@ def test_get_cms_metadata_key_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cms_metadata_key_service.GetCmsMetadataKeyRequest() - assert args[0] == request_msg @@ -2891,7 +2906,6 @@ def test_list_cms_metadata_keys_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cms_metadata_key_service.ListCmsMetadataKeysRequest() - assert args[0] == request_msg @@ -2913,7 +2927,6 @@ def test_batch_activate_cms_metadata_keys_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cms_metadata_key_service.BatchActivateCmsMetadataKeysRequest() - assert args[0] == request_msg @@ -2935,7 +2948,6 @@ def test_batch_deactivate_cms_metadata_keys_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cms_metadata_key_service.BatchDeactivateCmsMetadataKeysRequest() - assert args[0] == request_msg diff --git a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_cms_metadata_value_service.py b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_cms_metadata_value_service.py index be15de1766e3..4c8b5ddedaee 100644 --- a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_cms_metadata_value_service.py +++ b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_cms_metadata_value_service.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" @@ -2894,7 +2910,6 @@ def test_get_cms_metadata_value_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cms_metadata_value_service.GetCmsMetadataValueRequest() - assert args[0] == request_msg @@ -2916,7 +2931,6 @@ def test_list_cms_metadata_values_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cms_metadata_value_service.ListCmsMetadataValuesRequest() - assert args[0] == request_msg @@ -2938,7 +2952,6 @@ def test_batch_activate_cms_metadata_values_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cms_metadata_value_service.BatchActivateCmsMetadataValuesRequest() - assert args[0] == request_msg @@ -2962,7 +2975,6 @@ def test_batch_deactivate_cms_metadata_values_empty_call_rest(): request_msg = ( cms_metadata_value_service.BatchDeactivateCmsMetadataValuesRequest() ) - assert args[0] == request_msg diff --git a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_company_service.py b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_company_service.py index 480311aeff61..22241c1fd551 100644 --- a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_company_service.py +++ b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_company_service.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 @@ -113,6 +114,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" @@ -2111,7 +2127,6 @@ def test_get_company_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = company_service.GetCompanyRequest() - assert args[0] == request_msg @@ -2131,7 +2146,6 @@ def test_list_companies_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = company_service.ListCompaniesRequest() - assert args[0] == request_msg diff --git a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_contact_service.py b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_contact_service.py index b4216cfc458e..8d9985e4538d 100644 --- a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_contact_service.py +++ b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_contact_service.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" @@ -3592,7 +3608,6 @@ def test_get_contact_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_service.GetContactRequest() - assert args[0] == request_msg @@ -3612,7 +3627,6 @@ def test_list_contacts_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_service.ListContactsRequest() - assert args[0] == request_msg @@ -3632,7 +3646,6 @@ def test_create_contact_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_service.CreateContactRequest() - assert args[0] == request_msg @@ -3654,7 +3667,6 @@ def test_batch_create_contacts_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_service.BatchCreateContactsRequest() - assert args[0] == request_msg @@ -3674,7 +3686,6 @@ def test_update_contact_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_service.UpdateContactRequest() - assert args[0] == request_msg @@ -3696,7 +3707,6 @@ def test_batch_update_contacts_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_service.BatchUpdateContactsRequest() - assert args[0] == request_msg diff --git a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_content_bundle_service.py b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_content_bundle_service.py index 19ef9579ac8b..49ab4b75fdc0 100644 --- a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_content_bundle_service.py +++ b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_content_bundle_service.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 @@ -110,6 +111,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" @@ -2150,7 +2166,6 @@ def test_get_content_bundle_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = content_bundle_service.GetContentBundleRequest() - assert args[0] == request_msg @@ -2172,7 +2187,6 @@ def test_list_content_bundles_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = content_bundle_service.ListContentBundlesRequest() - assert args[0] == request_msg diff --git a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_content_label_service.py b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_content_label_service.py index 8dbe6e59f5bd..b203b730422e 100644 --- a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_content_label_service.py +++ b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_content_label_service.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 @@ -107,6 +108,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" @@ -2138,7 +2154,6 @@ def test_get_content_label_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = content_label_service.GetContentLabelRequest() - assert args[0] == request_msg @@ -2160,7 +2175,6 @@ def test_list_content_labels_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = content_label_service.ListContentLabelsRequest() - assert args[0] == request_msg diff --git a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_content_service.py b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_content_service.py index b95acfb11fcf..49fefc2b9f6d 100644 --- a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_content_service.py +++ b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_content_service.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 @@ -107,6 +108,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" @@ -2075,7 +2091,6 @@ def test_get_content_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = content_service.GetContentRequest() - assert args[0] == request_msg @@ -2095,7 +2110,6 @@ def test_list_content_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = content_service.ListContentRequest() - assert args[0] == request_msg diff --git a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_creative_template_service.py b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_creative_template_service.py index 581448bb52a5..b73a4e798d00 100644 --- a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_creative_template_service.py +++ b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_creative_template_service.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" @@ -2187,7 +2203,6 @@ def test_get_creative_template_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = creative_template_service.GetCreativeTemplateRequest() - assert args[0] == request_msg @@ -2209,7 +2224,6 @@ def test_list_creative_templates_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = creative_template_service.ListCreativeTemplatesRequest() - assert args[0] == request_msg diff --git a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_custom_field_service.py b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_custom_field_service.py index ee858b4451ce..d9e3b3fadbbd 100644 --- a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_custom_field_service.py +++ b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_custom_field_service.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" @@ -4373,7 +4389,6 @@ def test_get_custom_field_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = custom_field_service.GetCustomFieldRequest() - assert args[0] == request_msg @@ -4395,7 +4410,6 @@ def test_list_custom_fields_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = custom_field_service.ListCustomFieldsRequest() - assert args[0] == request_msg @@ -4417,7 +4431,6 @@ def test_create_custom_field_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = custom_field_service.CreateCustomFieldRequest() - assert args[0] == request_msg @@ -4439,7 +4452,6 @@ def test_batch_create_custom_fields_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = custom_field_service.BatchCreateCustomFieldsRequest() - assert args[0] == request_msg @@ -4461,7 +4473,6 @@ def test_update_custom_field_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = custom_field_service.UpdateCustomFieldRequest() - assert args[0] == request_msg @@ -4483,7 +4494,6 @@ def test_batch_update_custom_fields_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = custom_field_service.BatchUpdateCustomFieldsRequest() - assert args[0] == request_msg @@ -4505,7 +4515,6 @@ def test_batch_activate_custom_fields_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = custom_field_service.BatchActivateCustomFieldsRequest() - assert args[0] == request_msg @@ -4527,7 +4536,6 @@ def test_batch_deactivate_custom_fields_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = custom_field_service.BatchDeactivateCustomFieldsRequest() - assert args[0] == request_msg diff --git a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_custom_targeting_key_service.py b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_custom_targeting_key_service.py index f8ccd7100949..b4d9e59de311 100644 --- a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_custom_targeting_key_service.py +++ b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_custom_targeting_key_service.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" @@ -4542,7 +4558,6 @@ def test_get_custom_targeting_key_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = custom_targeting_key_service.GetCustomTargetingKeyRequest() - assert args[0] == request_msg @@ -4564,7 +4579,6 @@ def test_list_custom_targeting_keys_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = custom_targeting_key_service.ListCustomTargetingKeysRequest() - assert args[0] == request_msg @@ -4586,7 +4600,6 @@ def test_create_custom_targeting_key_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = custom_targeting_key_service.CreateCustomTargetingKeyRequest() - assert args[0] == request_msg @@ -4610,7 +4623,6 @@ def test_batch_create_custom_targeting_keys_empty_call_rest(): request_msg = ( custom_targeting_key_service.BatchCreateCustomTargetingKeysRequest() ) - assert args[0] == request_msg @@ -4632,7 +4644,6 @@ def test_update_custom_targeting_key_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = custom_targeting_key_service.UpdateCustomTargetingKeyRequest() - assert args[0] == request_msg @@ -4656,7 +4667,6 @@ def test_batch_update_custom_targeting_keys_empty_call_rest(): request_msg = ( custom_targeting_key_service.BatchUpdateCustomTargetingKeysRequest() ) - assert args[0] == request_msg @@ -4680,7 +4690,6 @@ def test_batch_activate_custom_targeting_keys_empty_call_rest(): request_msg = ( custom_targeting_key_service.BatchActivateCustomTargetingKeysRequest() ) - assert args[0] == request_msg @@ -4704,7 +4713,6 @@ def test_batch_deactivate_custom_targeting_keys_empty_call_rest(): request_msg = ( custom_targeting_key_service.BatchDeactivateCustomTargetingKeysRequest() ) - assert args[0] == request_msg diff --git a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_custom_targeting_value_service.py b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_custom_targeting_value_service.py index 2417ac73726f..c08a6ec8128b 100644 --- a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_custom_targeting_value_service.py +++ b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_custom_targeting_value_service.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" @@ -2233,7 +2249,6 @@ def test_get_custom_targeting_value_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = custom_targeting_value_service.GetCustomTargetingValueRequest() - assert args[0] == request_msg @@ -2255,7 +2270,6 @@ def test_list_custom_targeting_values_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = custom_targeting_value_service.ListCustomTargetingValuesRequest() - assert args[0] == request_msg diff --git a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_device_capability_service.py b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_device_capability_service.py index befe0da6bce4..64bbbe3bf353 100644 --- a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_device_capability_service.py +++ b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_device_capability_service.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 @@ -110,6 +111,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" @@ -2164,7 +2180,6 @@ def test_get_device_capability_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = device_capability_service.GetDeviceCapabilityRequest() - assert args[0] == request_msg @@ -2186,7 +2201,6 @@ def test_list_device_capabilities_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = device_capability_service.ListDeviceCapabilitiesRequest() - assert args[0] == request_msg diff --git a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_device_category_service.py b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_device_category_service.py index c45eab3c8140..20aeec26e673 100644 --- a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_device_category_service.py +++ b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_device_category_service.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 @@ -110,6 +111,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" @@ -2157,7 +2173,6 @@ def test_get_device_category_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = device_category_service.GetDeviceCategoryRequest() - assert args[0] == request_msg @@ -2179,7 +2194,6 @@ def test_list_device_categories_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = device_category_service.ListDeviceCategoriesRequest() - assert args[0] == request_msg diff --git a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_device_manufacturer_service.py b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_device_manufacturer_service.py index b0138494a285..2f55b17885d3 100644 --- a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_device_manufacturer_service.py +++ b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_device_manufacturer_service.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 @@ -110,6 +111,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" @@ -2184,7 +2200,6 @@ def test_get_device_manufacturer_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = device_manufacturer_service.GetDeviceManufacturerRequest() - assert args[0] == request_msg @@ -2206,7 +2221,6 @@ def test_list_device_manufacturers_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = device_manufacturer_service.ListDeviceManufacturersRequest() - assert args[0] == request_msg diff --git a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_entity_signals_mapping_service.py b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_entity_signals_mapping_service.py index fe2e3e7b9015..86e3835d1f06 100644 --- a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_entity_signals_mapping_service.py +++ b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_entity_signals_mapping_service.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" @@ -3822,7 +3838,6 @@ def test_get_entity_signals_mapping_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_signals_mapping_service.GetEntitySignalsMappingRequest() - assert args[0] == request_msg @@ -3844,7 +3859,6 @@ def test_list_entity_signals_mappings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_signals_mapping_service.ListEntitySignalsMappingsRequest() - assert args[0] == request_msg @@ -3866,7 +3880,6 @@ def test_create_entity_signals_mapping_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_signals_mapping_service.CreateEntitySignalsMappingRequest() - assert args[0] == request_msg @@ -3888,7 +3901,6 @@ def test_update_entity_signals_mapping_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_signals_mapping_service.UpdateEntitySignalsMappingRequest() - assert args[0] == request_msg @@ -3912,7 +3924,6 @@ def test_batch_create_entity_signals_mappings_empty_call_rest(): request_msg = ( entity_signals_mapping_service.BatchCreateEntitySignalsMappingsRequest() ) - assert args[0] == request_msg @@ -3936,7 +3947,6 @@ def test_batch_update_entity_signals_mappings_empty_call_rest(): request_msg = ( entity_signals_mapping_service.BatchUpdateEntitySignalsMappingsRequest() ) - assert args[0] == request_msg diff --git a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_geo_target_service.py b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_geo_target_service.py index 3d32b6c780f8..dd0811d28e47 100644 --- a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_geo_target_service.py +++ b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_geo_target_service.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 @@ -107,6 +108,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" @@ -2115,7 +2131,6 @@ def test_get_geo_target_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = geo_target_service.GetGeoTargetRequest() - assert args[0] == request_msg @@ -2135,7 +2150,6 @@ def test_list_geo_targets_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = geo_target_service.ListGeoTargetsRequest() - assert args[0] == request_msg diff --git a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_label_service.py b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_label_service.py index 35958683edf1..e06255c8a379 100644 --- a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_label_service.py +++ b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_label_service.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 @@ -108,6 +109,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" @@ -4155,7 +4171,6 @@ def test_get_label_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = label_service.GetLabelRequest() - assert args[0] == request_msg @@ -4175,7 +4190,6 @@ def test_list_labels_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = label_service.ListLabelsRequest() - assert args[0] == request_msg @@ -4195,7 +4209,6 @@ def test_create_label_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = label_service.CreateLabelRequest() - assert args[0] == request_msg @@ -4217,7 +4230,6 @@ def test_batch_create_labels_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = label_service.BatchCreateLabelsRequest() - assert args[0] == request_msg @@ -4237,7 +4249,6 @@ def test_update_label_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = label_service.UpdateLabelRequest() - assert args[0] == request_msg @@ -4259,7 +4270,6 @@ def test_batch_update_labels_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = label_service.BatchUpdateLabelsRequest() - assert args[0] == request_msg @@ -4281,7 +4291,6 @@ def test_batch_activate_labels_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = label_service.BatchActivateLabelsRequest() - assert args[0] == request_msg @@ -4303,7 +4312,6 @@ def test_batch_deactivate_labels_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = label_service.BatchDeactivateLabelsRequest() - assert args[0] == request_msg diff --git a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_line_item_service.py b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_line_item_service.py index d9a481b1e678..7dc94df1c689 100644 --- a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_line_item_service.py +++ b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_line_item_service.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 @@ -115,6 +116,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" @@ -2112,7 +2128,6 @@ def test_get_line_item_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = line_item_service.GetLineItemRequest() - assert args[0] == request_msg @@ -2132,7 +2147,6 @@ def test_list_line_items_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = line_item_service.ListLineItemsRequest() - assert args[0] == request_msg diff --git a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_linked_device_service.py b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_linked_device_service.py index 19c309b6c900..dfe3de2309f7 100644 --- a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_linked_device_service.py +++ b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_linked_device_service.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" @@ -2149,7 +2165,6 @@ def test_get_linked_device_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = linked_device_service.GetLinkedDeviceRequest() - assert args[0] == request_msg @@ -2171,7 +2186,6 @@ def test_list_linked_devices_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = linked_device_service.ListLinkedDevicesRequest() - assert args[0] == request_msg diff --git a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_mcm_earnings_service.py b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_mcm_earnings_service.py index f0c74613293d..c70b9f498d75 100644 --- a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_mcm_earnings_service.py +++ b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_mcm_earnings_service.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 @@ -108,6 +109,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" @@ -1821,7 +1837,6 @@ def test_fetch_mcm_earnings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mcm_earnings_service.FetchMcmEarningsRequest() - assert args[0] == request_msg diff --git a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_mobile_carrier_service.py b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_mobile_carrier_service.py index 1b0e58f3509b..f54546e86714 100644 --- a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_mobile_carrier_service.py +++ b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_mobile_carrier_service.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 @@ -110,6 +111,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" @@ -2152,7 +2168,6 @@ def test_get_mobile_carrier_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mobile_carrier_service.GetMobileCarrierRequest() - assert args[0] == request_msg @@ -2174,7 +2189,6 @@ def test_list_mobile_carriers_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mobile_carrier_service.ListMobileCarriersRequest() - assert args[0] == request_msg diff --git a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_mobile_device_service.py b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_mobile_device_service.py index f452965f5cb6..d0aad9550318 100644 --- a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_mobile_device_service.py +++ b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_mobile_device_service.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 @@ -107,6 +108,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" @@ -2140,7 +2156,6 @@ def test_get_mobile_device_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mobile_device_service.GetMobileDeviceRequest() - assert args[0] == request_msg @@ -2162,7 +2177,6 @@ def test_list_mobile_devices_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mobile_device_service.ListMobileDevicesRequest() - assert args[0] == request_msg diff --git a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_mobile_device_submodel_service.py b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_mobile_device_submodel_service.py index d27bd42382d5..2889bd5ccbef 100644 --- a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_mobile_device_submodel_service.py +++ b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_mobile_device_submodel_service.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 @@ -110,6 +111,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" @@ -2220,7 +2236,6 @@ def test_get_mobile_device_submodel_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mobile_device_submodel_service.GetMobileDeviceSubmodelRequest() - assert args[0] == request_msg @@ -2242,7 +2257,6 @@ def test_list_mobile_device_submodels_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mobile_device_submodel_service.ListMobileDeviceSubmodelsRequest() - assert args[0] == request_msg diff --git a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_network_service.py b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_network_service.py index bab52dbd50c4..4b0231281da4 100644 --- a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_network_service.py +++ b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_network_service.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 @@ -107,6 +108,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" @@ -1932,7 +1948,6 @@ def test_get_network_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = network_service.GetNetworkRequest() - assert args[0] == request_msg @@ -1952,7 +1967,6 @@ def test_list_networks_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = network_service.ListNetworksRequest() - assert args[0] == request_msg diff --git a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_operating_system_service.py b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_operating_system_service.py index b7a9e213538e..86a9bbaf04dc 100644 --- a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_operating_system_service.py +++ b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_operating_system_service.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 @@ -110,6 +111,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" @@ -2162,7 +2178,6 @@ def test_get_operating_system_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = operating_system_service.GetOperatingSystemRequest() - assert args[0] == request_msg @@ -2184,7 +2199,6 @@ def test_list_operating_systems_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = operating_system_service.ListOperatingSystemsRequest() - assert args[0] == request_msg diff --git a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_operating_system_version_service.py b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_operating_system_version_service.py index c3c3dbc13090..f8a7f6a3ecc4 100644 --- a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_operating_system_version_service.py +++ b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_operating_system_version_service.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 @@ -110,6 +111,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" @@ -2255,7 +2271,6 @@ def test_get_operating_system_version_empty_call_rest(): request_msg = ( operating_system_version_service.GetOperatingSystemVersionRequest() ) - assert args[0] == request_msg @@ -2279,7 +2294,6 @@ def test_list_operating_system_versions_empty_call_rest(): request_msg = ( operating_system_version_service.ListOperatingSystemVersionsRequest() ) - assert args[0] == request_msg diff --git a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_order_service.py b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_order_service.py index 8ed274a21f13..de7510fa0de8 100644 --- a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_order_service.py +++ b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_order_service.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 @@ -114,6 +115,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" @@ -2096,7 +2112,6 @@ def test_get_order_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = order_service.GetOrderRequest() - assert args[0] == request_msg @@ -2116,7 +2131,6 @@ def test_list_orders_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = order_service.ListOrdersRequest() - assert args[0] == request_msg diff --git a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_placement_service.py b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_placement_service.py index b51e787e0894..6c0c6660ea2f 100644 --- a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_placement_service.py +++ b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_placement_service.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 @@ -113,6 +114,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" @@ -4604,7 +4620,6 @@ def test_get_placement_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = placement_service.GetPlacementRequest() - assert args[0] == request_msg @@ -4624,7 +4639,6 @@ def test_list_placements_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = placement_service.ListPlacementsRequest() - assert args[0] == request_msg @@ -4644,7 +4658,6 @@ def test_create_placement_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = placement_service.CreatePlacementRequest() - assert args[0] == request_msg @@ -4664,7 +4677,6 @@ def test_update_placement_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = placement_service.UpdatePlacementRequest() - assert args[0] == request_msg @@ -4686,7 +4698,6 @@ def test_batch_create_placements_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = placement_service.BatchCreatePlacementsRequest() - assert args[0] == request_msg @@ -4708,7 +4719,6 @@ def test_batch_update_placements_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = placement_service.BatchUpdatePlacementsRequest() - assert args[0] == request_msg @@ -4730,7 +4740,6 @@ def test_batch_activate_placements_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = placement_service.BatchActivatePlacementsRequest() - assert args[0] == request_msg @@ -4752,7 +4761,6 @@ def test_batch_deactivate_placements_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = placement_service.BatchDeactivatePlacementsRequest() - assert args[0] == request_msg @@ -4774,7 +4782,6 @@ def test_batch_archive_placements_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = placement_service.BatchArchivePlacementsRequest() - assert args[0] == request_msg diff --git a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_private_auction_deal_service.py b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_private_auction_deal_service.py index 5e811da38c7c..efcb88540670 100644 --- a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_private_auction_deal_service.py +++ b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_private_auction_deal_service.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 @@ -121,6 +122,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" @@ -3545,7 +3561,6 @@ def test_get_private_auction_deal_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = private_auction_deal_service.GetPrivateAuctionDealRequest() - assert args[0] == request_msg @@ -3567,7 +3582,6 @@ def test_list_private_auction_deals_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = private_auction_deal_service.ListPrivateAuctionDealsRequest() - assert args[0] == request_msg @@ -3589,7 +3603,6 @@ def test_create_private_auction_deal_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = private_auction_deal_service.CreatePrivateAuctionDealRequest() - assert args[0] == request_msg @@ -3611,7 +3624,6 @@ def test_update_private_auction_deal_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = private_auction_deal_service.UpdatePrivateAuctionDealRequest() - assert args[0] == request_msg diff --git a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_private_auction_service.py b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_private_auction_service.py index 5224be7dfe0b..0f9f5486cc80 100644 --- a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_private_auction_service.py +++ b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_private_auction_service.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" @@ -3008,7 +3024,6 @@ def test_get_private_auction_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = private_auction_service.GetPrivateAuctionRequest() - assert args[0] == request_msg @@ -3030,7 +3045,6 @@ def test_list_private_auctions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = private_auction_service.ListPrivateAuctionsRequest() - assert args[0] == request_msg @@ -3052,7 +3066,6 @@ def test_create_private_auction_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = private_auction_service.CreatePrivateAuctionRequest() - assert args[0] == request_msg @@ -3074,7 +3087,6 @@ def test_update_private_auction_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = private_auction_service.UpdatePrivateAuctionRequest() - assert args[0] == request_msg diff --git a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_programmatic_buyer_service.py b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_programmatic_buyer_service.py index 4e827a86ccc8..1befafc29407 100644 --- a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_programmatic_buyer_service.py +++ b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_programmatic_buyer_service.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 @@ -110,6 +111,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" @@ -2185,7 +2201,6 @@ def test_get_programmatic_buyer_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = programmatic_buyer_service.GetProgrammaticBuyerRequest() - assert args[0] == request_msg @@ -2207,7 +2222,6 @@ def test_list_programmatic_buyers_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = programmatic_buyer_service.ListProgrammaticBuyersRequest() - assert args[0] == request_msg diff --git a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_report_service.py b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_report_service.py index 6ed029cd7590..8b54208cec8b 100644 --- a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_report_service.py +++ b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_report_service.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 @@ -121,6 +122,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" @@ -3632,7 +3648,6 @@ def test_get_report_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = report_service.GetReportRequest() - assert args[0] == request_msg @@ -3652,7 +3667,6 @@ def test_list_reports_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = report_service.ListReportsRequest() - assert args[0] == request_msg @@ -3672,7 +3686,6 @@ def test_create_report_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = report_service.CreateReportRequest() - assert args[0] == request_msg @@ -3692,7 +3705,6 @@ def test_update_report_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = report_service.UpdateReportRequest() - assert args[0] == request_msg @@ -3712,7 +3724,6 @@ def test_run_report_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = report_service.RunReportRequest() - assert args[0] == request_msg @@ -3734,7 +3745,6 @@ def test_fetch_report_result_rows_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = report_service.FetchReportResultRowsRequest() - assert args[0] == request_msg diff --git a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_rich_media_ads_company_service.py b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_rich_media_ads_company_service.py index 5e9d54796f7c..30347f3777f7 100644 --- a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_rich_media_ads_company_service.py +++ b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_rich_media_ads_company_service.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" @@ -2218,7 +2234,6 @@ def test_get_rich_media_ads_company_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rich_media_ads_company_service.GetRichMediaAdsCompanyRequest() - assert args[0] == request_msg @@ -2240,7 +2255,6 @@ def test_list_rich_media_ads_companies_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rich_media_ads_company_service.ListRichMediaAdsCompaniesRequest() - assert args[0] == request_msg diff --git a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_role_service.py b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_role_service.py index 8159d61395af..e0b2c1004217 100644 --- a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_role_service.py +++ b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_role_service.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 @@ -107,6 +108,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" @@ -2046,7 +2062,6 @@ def test_get_role_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = role_service.GetRoleRequest() - assert args[0] == request_msg @@ -2066,7 +2081,6 @@ def test_list_roles_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = role_service.ListRolesRequest() - assert args[0] == request_msg diff --git a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_site_service.py b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_site_service.py index 814d9be54db2..642252e37012 100644 --- a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_site_service.py +++ b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_site_service.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 @@ -109,6 +110,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" @@ -4150,7 +4166,6 @@ def test_get_site_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_service.GetSiteRequest() - assert args[0] == request_msg @@ -4170,7 +4185,6 @@ def test_list_sites_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_service.ListSitesRequest() - assert args[0] == request_msg @@ -4190,7 +4204,6 @@ def test_create_site_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_service.CreateSiteRequest() - assert args[0] == request_msg @@ -4212,7 +4225,6 @@ def test_batch_create_sites_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_service.BatchCreateSitesRequest() - assert args[0] == request_msg @@ -4232,7 +4244,6 @@ def test_update_site_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_service.UpdateSiteRequest() - assert args[0] == request_msg @@ -4254,7 +4265,6 @@ def test_batch_update_sites_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_service.BatchUpdateSitesRequest() - assert args[0] == request_msg @@ -4276,7 +4286,6 @@ def test_batch_deactivate_sites_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_service.BatchDeactivateSitesRequest() - assert args[0] == request_msg @@ -4298,7 +4307,6 @@ def test_batch_submit_sites_for_approval_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_service.BatchSubmitSitesForApprovalRequest() - assert args[0] == request_msg diff --git a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_taxonomy_category_service.py b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_taxonomy_category_service.py index 68390d7dd9b4..d27c10ef4126 100644 --- a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_taxonomy_category_service.py +++ b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_taxonomy_category_service.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" @@ -2180,7 +2196,6 @@ def test_get_taxonomy_category_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = taxonomy_category_service.GetTaxonomyCategoryRequest() - assert args[0] == request_msg @@ -2202,7 +2217,6 @@ def test_list_taxonomy_categories_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = taxonomy_category_service.ListTaxonomyCategoriesRequest() - assert args[0] == request_msg diff --git a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_team_service.py b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_team_service.py index 48304ca9a430..6d8024b332ee 100644 --- a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_team_service.py +++ b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_team_service.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 @@ -108,6 +109,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" @@ -4153,7 +4169,6 @@ def test_get_team_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = team_service.GetTeamRequest() - assert args[0] == request_msg @@ -4173,7 +4188,6 @@ def test_list_teams_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = team_service.ListTeamsRequest() - assert args[0] == request_msg @@ -4193,7 +4207,6 @@ def test_create_team_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = team_service.CreateTeamRequest() - assert args[0] == request_msg @@ -4215,7 +4228,6 @@ def test_batch_create_teams_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = team_service.BatchCreateTeamsRequest() - assert args[0] == request_msg @@ -4235,7 +4247,6 @@ def test_update_team_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = team_service.UpdateTeamRequest() - assert args[0] == request_msg @@ -4257,7 +4268,6 @@ def test_batch_update_teams_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = team_service.BatchUpdateTeamsRequest() - assert args[0] == request_msg @@ -4279,7 +4289,6 @@ def test_batch_activate_teams_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = team_service.BatchActivateTeamsRequest() - assert args[0] == request_msg @@ -4301,7 +4310,6 @@ def test_batch_deactivate_teams_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = team_service.BatchDeactivateTeamsRequest() - assert args[0] == request_msg diff --git a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_user_service.py b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_user_service.py index 7952a8a08153..a445870dee96 100644 --- a/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_user_service.py +++ b/packages/google-ads-admanager/tests/unit/gapic/admanager_v1/test_user_service.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 @@ -103,6 +104,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" @@ -1662,7 +1678,6 @@ def test_get_user_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_service.GetUserRequest() - assert args[0] == request_msg diff --git a/packages/google-ads-datamanager/noxfile.py b/packages/google-ads-datamanager/noxfile.py index 3bb3a2602a36..f2936e9406bd 100644 --- a/packages/google-ads-datamanager/noxfile.py +++ b/packages/google-ads-datamanager/noxfile.py @@ -47,7 +47,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-ads-datamanager" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-ads-datamanager/setup.py b/packages/google-ads-datamanager/setup.py index afab7f9ba21d..46fabd9b7fcf 100644 --- a/packages/google-ads-datamanager/setup.py +++ b/packages/google-ads-datamanager/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/google-ads-datamanager/testing/constraints-3.10.txt b/packages/google-ads-datamanager/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-ads-datamanager/testing/constraints-3.10.txt +++ b/packages/google-ads-datamanager/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-ads-datamanager/tests/unit/gapic/datamanager_v1/test_ingestion_service.py b/packages/google-ads-datamanager/tests/unit/gapic/datamanager_v1/test_ingestion_service.py index 4cf482240377..65de924c2591 100644 --- a/packages/google-ads-datamanager/tests/unit/gapic/datamanager_v1/test_ingestion_service.py +++ b/packages/google-ads-datamanager/tests/unit/gapic/datamanager_v1/test_ingestion_service.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 @@ -122,6 +123,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" @@ -1355,8 +1371,8 @@ def test_ingestion_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - ingestion_service.IngestAudienceMembersRequest, - dict, + ingestion_service.IngestAudienceMembersRequest(), + {}, ], ) def test_ingest_audience_members(request_type, transport: str = "grpc"): @@ -1367,7 +1383,7 @@ def test_ingest_audience_members(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,7 +1429,8 @@ def test_ingest_audience_members_non_empty_request_with_auto_populated_field(): client.ingest_audience_members(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == ingestion_service.IngestAudienceMembersRequest() + request_msg = ingestion_service.IngestAudienceMembersRequest() + assert args[0] == request_msg def test_ingest_audience_members_use_cached_wrapped_rpc(): @@ -1499,9 +1516,15 @@ async def test_ingest_audience_members_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + ingestion_service.IngestAudienceMembersRequest(), + {}, + ], +) async def test_ingest_audience_members_async( - transport: str = "grpc_asyncio", - request_type=ingestion_service.IngestAudienceMembersRequest, + request_type, transport: str = "grpc_asyncio" ): client = IngestionServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1510,7 +1533,7 @@ async def test_ingest_audience_members_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( @@ -1535,16 +1558,11 @@ async def test_ingest_audience_members_async( assert response.request_id == "request_id_value" -@pytest.mark.asyncio -async def test_ingest_audience_members_async_from_dict(): - await test_ingest_audience_members_async(request_type=dict) - - @pytest.mark.parametrize( "request_type", [ - ingestion_service.RemoveAudienceMembersRequest, - dict, + ingestion_service.RemoveAudienceMembersRequest(), + {}, ], ) def test_remove_audience_members(request_type, transport: str = "grpc"): @@ -1555,7 +1573,7 @@ def test_remove_audience_members(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1601,7 +1619,8 @@ def test_remove_audience_members_non_empty_request_with_auto_populated_field(): client.remove_audience_members(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == ingestion_service.RemoveAudienceMembersRequest() + request_msg = ingestion_service.RemoveAudienceMembersRequest() + assert args[0] == request_msg def test_remove_audience_members_use_cached_wrapped_rpc(): @@ -1687,9 +1706,15 @@ async def test_remove_audience_members_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + ingestion_service.RemoveAudienceMembersRequest(), + {}, + ], +) async def test_remove_audience_members_async( - transport: str = "grpc_asyncio", - request_type=ingestion_service.RemoveAudienceMembersRequest, + request_type, transport: str = "grpc_asyncio" ): client = IngestionServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1698,7 +1723,7 @@ async def test_remove_audience_members_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( @@ -1723,16 +1748,11 @@ async def test_remove_audience_members_async( assert response.request_id == "request_id_value" -@pytest.mark.asyncio -async def test_remove_audience_members_async_from_dict(): - await test_remove_audience_members_async(request_type=dict) - - @pytest.mark.parametrize( "request_type", [ - ingestion_service.IngestEventsRequest, - dict, + ingestion_service.IngestEventsRequest(), + {}, ], ) def test_ingest_events(request_type, transport: str = "grpc"): @@ -1743,7 +1763,7 @@ def test_ingest_events(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.ingest_events), "__call__") as call: @@ -1785,7 +1805,8 @@ def test_ingest_events_non_empty_request_with_auto_populated_field(): client.ingest_events(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == ingestion_service.IngestEventsRequest() + request_msg = ingestion_service.IngestEventsRequest() + assert args[0] == request_msg def test_ingest_events_use_cached_wrapped_rpc(): @@ -1866,9 +1887,14 @@ async def test_ingest_events_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_ingest_events_async( - transport: str = "grpc_asyncio", request_type=ingestion_service.IngestEventsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + ingestion_service.IngestEventsRequest(), + {}, + ], +) +async def test_ingest_events_async(request_type, transport: str = "grpc_asyncio"): client = IngestionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1876,7 +1902,7 @@ async def test_ingest_events_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.ingest_events), "__call__") as call: @@ -1899,16 +1925,11 @@ async def test_ingest_events_async( assert response.request_id == "request_id_value" -@pytest.mark.asyncio -async def test_ingest_events_async_from_dict(): - await test_ingest_events_async(request_type=dict) - - @pytest.mark.parametrize( "request_type", [ - ingestion_service.RetrieveRequestStatusRequest, - dict, + ingestion_service.RetrieveRequestStatusRequest(), + {}, ], ) def test_retrieve_request_status(request_type, transport: str = "grpc"): @@ -1919,7 +1940,7 @@ def test_retrieve_request_status(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1964,9 +1985,10 @@ def test_retrieve_request_status_non_empty_request_with_auto_populated_field(): client.retrieve_request_status(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == ingestion_service.RetrieveRequestStatusRequest( + request_msg = ingestion_service.RetrieveRequestStatusRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_retrieve_request_status_use_cached_wrapped_rpc(): @@ -2052,9 +2074,15 @@ async def test_retrieve_request_status_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + ingestion_service.RetrieveRequestStatusRequest(), + {}, + ], +) async def test_retrieve_request_status_async( - transport: str = "grpc_asyncio", - request_type=ingestion_service.RetrieveRequestStatusRequest, + request_type, transport: str = "grpc_asyncio" ): client = IngestionServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2063,7 +2091,7 @@ async def test_retrieve_request_status_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( @@ -2085,11 +2113,6 @@ async def test_retrieve_request_status_async( assert isinstance(response, ingestion_service.RetrieveRequestStatusResponse) -@pytest.mark.asyncio -async def test_retrieve_request_status_async_from_dict(): - await test_retrieve_request_status_async(request_type=dict) - - def test_ingest_audience_members_rest_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, # instead of constructing them on each call @@ -2739,7 +2762,6 @@ def test_ingest_audience_members_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ingestion_service.IngestAudienceMembersRequest() - assert args[0] == request_msg @@ -2762,7 +2784,6 @@ def test_remove_audience_members_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ingestion_service.RemoveAudienceMembersRequest() - assert args[0] == request_msg @@ -2783,7 +2804,6 @@ def test_ingest_events_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ingestion_service.IngestEventsRequest() - assert args[0] == request_msg @@ -2806,7 +2826,6 @@ def test_retrieve_request_status_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ingestion_service.RetrieveRequestStatusRequest() - assert args[0] == request_msg @@ -2849,7 +2868,6 @@ async def test_ingest_audience_members_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ingestion_service.IngestAudienceMembersRequest() - assert args[0] == request_msg @@ -2878,7 +2896,6 @@ async def test_remove_audience_members_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ingestion_service.RemoveAudienceMembersRequest() - assert args[0] == request_msg @@ -2905,7 +2922,6 @@ async def test_ingest_events_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ingestion_service.IngestEventsRequest() - assert args[0] == request_msg @@ -2932,7 +2948,6 @@ async def test_retrieve_request_status_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ingestion_service.RetrieveRequestStatusRequest() - assert args[0] == request_msg @@ -3509,7 +3524,6 @@ def test_ingest_audience_members_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ingestion_service.IngestAudienceMembersRequest() - assert args[0] == request_msg @@ -3531,7 +3545,6 @@ def test_remove_audience_members_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ingestion_service.RemoveAudienceMembersRequest() - assert args[0] == request_msg @@ -3551,7 +3564,6 @@ def test_ingest_events_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ingestion_service.IngestEventsRequest() - assert args[0] == request_msg @@ -3573,7 +3585,6 @@ def test_retrieve_request_status_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ingestion_service.RetrieveRequestStatusRequest() - assert args[0] == request_msg diff --git a/packages/google-ads-datamanager/tests/unit/gapic/datamanager_v1/test_marketing_data_insights_service.py b/packages/google-ads-datamanager/tests/unit/gapic/datamanager_v1/test_marketing_data_insights_service.py index ea1b3b61d195..9432cc790404 100644 --- a/packages/google-ads-datamanager/tests/unit/gapic/datamanager_v1/test_marketing_data_insights_service.py +++ b/packages/google-ads-datamanager/tests/unit/gapic/datamanager_v1/test_marketing_data_insights_service.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 @@ -106,6 +107,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" @@ -1416,8 +1432,8 @@ def test_marketing_data_insights_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - insights_service.RetrieveInsightsRequest, - dict, + insights_service.RetrieveInsightsRequest(), + {}, ], ) def test_retrieve_insights(request_type, transport: str = "grpc"): @@ -1428,7 +1444,7 @@ def test_retrieve_insights(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1474,10 +1490,11 @@ def test_retrieve_insights_non_empty_request_with_auto_populated_field(): client.retrieve_insights(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == insights_service.RetrieveInsightsRequest( + request_msg = insights_service.RetrieveInsightsRequest( parent="parent_value", user_list_id="user_list_id_value", ) + assert args[0] == request_msg def test_retrieve_insights_use_cached_wrapped_rpc(): @@ -1560,10 +1577,14 @@ async def test_retrieve_insights_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_retrieve_insights_async( - transport: str = "grpc_asyncio", - request_type=insights_service.RetrieveInsightsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + insights_service.RetrieveInsightsRequest(), + {}, + ], +) +async def test_retrieve_insights_async(request_type, transport: str = "grpc_asyncio"): client = MarketingDataInsightsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1571,7 +1592,7 @@ async def test_retrieve_insights_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( @@ -1593,11 +1614,6 @@ async def test_retrieve_insights_async( assert isinstance(response, insights_service.RetrieveInsightsResponse) -@pytest.mark.asyncio -async def test_retrieve_insights_async_from_dict(): - await test_retrieve_insights_async(request_type=dict) - - def test_retrieve_insights_field_headers(): client = MarketingDataInsightsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1924,7 +1940,6 @@ def test_retrieve_insights_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = insights_service.RetrieveInsightsRequest() - assert args[0] == request_msg @@ -1965,7 +1980,6 @@ async def test_retrieve_insights_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = insights_service.RetrieveInsightsRequest() - assert args[0] == request_msg @@ -2136,7 +2150,6 @@ def test_retrieve_insights_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = insights_service.RetrieveInsightsRequest() - assert args[0] == request_msg diff --git a/packages/google-ads-datamanager/tests/unit/gapic/datamanager_v1/test_partner_link_service.py b/packages/google-ads-datamanager/tests/unit/gapic/datamanager_v1/test_partner_link_service.py index 420a103e92f1..16822b897a91 100644 --- a/packages/google-ads-datamanager/tests/unit/gapic/datamanager_v1/test_partner_link_service.py +++ b/packages/google-ads-datamanager/tests/unit/gapic/datamanager_v1/test_partner_link_service.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 @@ -107,6 +108,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" @@ -1355,8 +1371,8 @@ def test_partner_link_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - partner_link_service.CreatePartnerLinkRequest, - dict, + partner_link_service.CreatePartnerLinkRequest(), + {}, ], ) def test_create_partner_link(request_type, transport: str = "grpc"): @@ -1367,7 +1383,7 @@ def test_create_partner_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( @@ -1417,9 +1433,10 @@ def test_create_partner_link_non_empty_request_with_auto_populated_field(): client.create_partner_link(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == partner_link_service.CreatePartnerLinkRequest( + request_msg = partner_link_service.CreatePartnerLinkRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_partner_link_use_cached_wrapped_rpc(): @@ -1504,10 +1521,14 @@ async def test_create_partner_link_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_partner_link_async( - transport: str = "grpc_asyncio", - request_type=partner_link_service.CreatePartnerLinkRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + partner_link_service.CreatePartnerLinkRequest(), + {}, + ], +) +async def test_create_partner_link_async(request_type, transport: str = "grpc_asyncio"): client = PartnerLinkServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1515,7 +1536,7 @@ async def test_create_partner_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( @@ -1542,11 +1563,6 @@ async def test_create_partner_link_async( assert response.partner_link_id == "partner_link_id_value" -@pytest.mark.asyncio -async def test_create_partner_link_async_from_dict(): - await test_create_partner_link_async(request_type=dict) - - def test_create_partner_link_field_headers(): client = PartnerLinkServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1711,8 +1727,8 @@ async def test_create_partner_link_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - partner_link_service.DeletePartnerLinkRequest, - dict, + partner_link_service.DeletePartnerLinkRequest(), + {}, ], ) def test_delete_partner_link(request_type, transport: str = "grpc"): @@ -1723,7 +1739,7 @@ def test_delete_partner_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( @@ -1768,9 +1784,10 @@ def test_delete_partner_link_non_empty_request_with_auto_populated_field(): client.delete_partner_link(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == partner_link_service.DeletePartnerLinkRequest( + request_msg = partner_link_service.DeletePartnerLinkRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_partner_link_use_cached_wrapped_rpc(): @@ -1855,10 +1872,14 @@ async def test_delete_partner_link_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_partner_link_async( - transport: str = "grpc_asyncio", - request_type=partner_link_service.DeletePartnerLinkRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + partner_link_service.DeletePartnerLinkRequest(), + {}, + ], +) +async def test_delete_partner_link_async(request_type, transport: str = "grpc_asyncio"): client = PartnerLinkServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1866,7 +1887,7 @@ async def test_delete_partner_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( @@ -1886,11 +1907,6 @@ async def test_delete_partner_link_async( assert response is None -@pytest.mark.asyncio -async def test_delete_partner_link_async_from_dict(): - await test_delete_partner_link_async(request_type=dict) - - def test_delete_partner_link_field_headers(): client = PartnerLinkServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2041,8 +2057,8 @@ async def test_delete_partner_link_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - partner_link_service.SearchPartnerLinksRequest, - dict, + partner_link_service.SearchPartnerLinksRequest(), + {}, ], ) def test_search_partner_links(request_type, transport: str = "grpc"): @@ -2053,7 +2069,7 @@ def test_search_partner_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( @@ -2103,11 +2119,12 @@ def test_search_partner_links_non_empty_request_with_auto_populated_field(): client.search_partner_links(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == partner_link_service.SearchPartnerLinksRequest( + request_msg = partner_link_service.SearchPartnerLinksRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_search_partner_links_use_cached_wrapped_rpc(): @@ -2192,9 +2209,15 @@ async def test_search_partner_links_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + partner_link_service.SearchPartnerLinksRequest(), + {}, + ], +) async def test_search_partner_links_async( - transport: str = "grpc_asyncio", - request_type=partner_link_service.SearchPartnerLinksRequest, + request_type, transport: str = "grpc_asyncio" ): client = PartnerLinkServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2203,7 +2226,7 @@ async def test_search_partner_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( @@ -2228,11 +2251,6 @@ async def test_search_partner_links_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_search_partner_links_async_from_dict(): - await test_search_partner_links_async(request_type=dict) - - def test_search_partner_links_field_headers(): client = PartnerLinkServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3343,7 +3361,6 @@ def test_create_partner_link_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = partner_link_service.CreatePartnerLinkRequest() - assert args[0] == request_msg @@ -3366,7 +3383,6 @@ def test_delete_partner_link_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = partner_link_service.DeletePartnerLinkRequest() - assert args[0] == request_msg @@ -3389,7 +3405,6 @@ def test_search_partner_links_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = partner_link_service.SearchPartnerLinksRequest() - assert args[0] == request_msg @@ -3433,7 +3448,6 @@ async def test_create_partner_link_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = partner_link_service.CreatePartnerLinkRequest() - assert args[0] == request_msg @@ -3458,7 +3472,6 @@ async def test_delete_partner_link_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = partner_link_service.DeletePartnerLinkRequest() - assert args[0] == request_msg @@ -3487,7 +3500,6 @@ async def test_search_partner_links_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = partner_link_service.SearchPartnerLinksRequest() - assert args[0] == request_msg @@ -3987,7 +3999,6 @@ def test_create_partner_link_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = partner_link_service.CreatePartnerLinkRequest() - assert args[0] == request_msg @@ -4009,7 +4020,6 @@ def test_delete_partner_link_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = partner_link_service.DeletePartnerLinkRequest() - assert args[0] == request_msg @@ -4031,7 +4041,6 @@ def test_search_partner_links_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = partner_link_service.SearchPartnerLinksRequest() - assert args[0] == request_msg diff --git a/packages/google-ads-datamanager/tests/unit/gapic/datamanager_v1/test_user_list_direct_license_service.py b/packages/google-ads-datamanager/tests/unit/gapic/datamanager_v1/test_user_list_direct_license_service.py index 4a837cc31761..4285b0b8dd7d 100644 --- a/packages/google-ads-datamanager/tests/unit/gapic/datamanager_v1/test_user_list_direct_license_service.py +++ b/packages/google-ads-datamanager/tests/unit/gapic/datamanager_v1/test_user_list_direct_license_service.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 @@ -119,6 +120,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" @@ -1429,8 +1445,8 @@ def test_user_list_direct_license_service_client_create_channel_credentials_file @pytest.mark.parametrize( "request_type", [ - user_list_direct_license_service.CreateUserListDirectLicenseRequest, - dict, + user_list_direct_license_service.CreateUserListDirectLicenseRequest(), + {}, ], ) def test_create_user_list_direct_license(request_type, transport: str = "grpc"): @@ -1441,7 +1457,7 @@ def test_create_user_list_direct_license(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1507,11 +1523,12 @@ def test_create_user_list_direct_license_non_empty_request_with_auto_populated_f client.create_user_list_direct_license(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == user_list_direct_license_service.CreateUserListDirectLicenseRequest( - parent="parent_value", + request_msg = ( + user_list_direct_license_service.CreateUserListDirectLicenseRequest( + parent="parent_value", + ) ) + assert args[0] == request_msg def test_create_user_list_direct_license_use_cached_wrapped_rpc(): @@ -1597,9 +1614,15 @@ async def test_create_user_list_direct_license_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + user_list_direct_license_service.CreateUserListDirectLicenseRequest(), + {}, + ], +) async def test_create_user_list_direct_license_async( - transport: str = "grpc_asyncio", - request_type=user_list_direct_license_service.CreateUserListDirectLicenseRequest, + request_type, transport: str = "grpc_asyncio" ): client = UserListDirectLicenseServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1608,7 +1631,7 @@ async def test_create_user_list_direct_license_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( @@ -1651,11 +1674,6 @@ async def test_create_user_list_direct_license_async( ) -@pytest.mark.asyncio -async def test_create_user_list_direct_license_async_from_dict(): - await test_create_user_list_direct_license_async(request_type=dict) - - def test_create_user_list_direct_license_field_headers(): client = UserListDirectLicenseServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1828,8 +1846,8 @@ async def test_create_user_list_direct_license_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - user_list_direct_license_service.GetUserListDirectLicenseRequest, - dict, + user_list_direct_license_service.GetUserListDirectLicenseRequest(), + {}, ], ) def test_get_user_list_direct_license(request_type, transport: str = "grpc"): @@ -1840,7 +1858,7 @@ def test_get_user_list_direct_license(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1906,11 +1924,10 @@ def test_get_user_list_direct_license_non_empty_request_with_auto_populated_fiel client.get_user_list_direct_license(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == user_list_direct_license_service.GetUserListDirectLicenseRequest( + request_msg = user_list_direct_license_service.GetUserListDirectLicenseRequest( name="name_value", ) + assert args[0] == request_msg def test_get_user_list_direct_license_use_cached_wrapped_rpc(): @@ -1996,9 +2013,15 @@ async def test_get_user_list_direct_license_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + user_list_direct_license_service.GetUserListDirectLicenseRequest(), + {}, + ], +) async def test_get_user_list_direct_license_async( - transport: str = "grpc_asyncio", - request_type=user_list_direct_license_service.GetUserListDirectLicenseRequest, + request_type, transport: str = "grpc_asyncio" ): client = UserListDirectLicenseServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2007,7 +2030,7 @@ async def test_get_user_list_direct_license_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( @@ -2050,11 +2073,6 @@ async def test_get_user_list_direct_license_async( ) -@pytest.mark.asyncio -async def test_get_user_list_direct_license_async_from_dict(): - await test_get_user_list_direct_license_async(request_type=dict) - - def test_get_user_list_direct_license_field_headers(): client = UserListDirectLicenseServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2209,8 +2227,8 @@ async def test_get_user_list_direct_license_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - user_list_direct_license_service.UpdateUserListDirectLicenseRequest, - dict, + user_list_direct_license_service.UpdateUserListDirectLicenseRequest(), + {}, ], ) def test_update_user_list_direct_license(request_type, transport: str = "grpc"): @@ -2221,7 +2239,7 @@ def test_update_user_list_direct_license(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2285,10 +2303,10 @@ def test_update_user_list_direct_license_non_empty_request_with_auto_populated_f client.update_user_list_direct_license(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert ( - args[0] - == user_list_direct_license_service.UpdateUserListDirectLicenseRequest() + request_msg = ( + user_list_direct_license_service.UpdateUserListDirectLicenseRequest() ) + assert args[0] == request_msg def test_update_user_list_direct_license_use_cached_wrapped_rpc(): @@ -2374,9 +2392,15 @@ async def test_update_user_list_direct_license_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + user_list_direct_license_service.UpdateUserListDirectLicenseRequest(), + {}, + ], +) async def test_update_user_list_direct_license_async( - transport: str = "grpc_asyncio", - request_type=user_list_direct_license_service.UpdateUserListDirectLicenseRequest, + request_type, transport: str = "grpc_asyncio" ): client = UserListDirectLicenseServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2385,7 +2409,7 @@ async def test_update_user_list_direct_license_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( @@ -2428,11 +2452,6 @@ async def test_update_user_list_direct_license_async( ) -@pytest.mark.asyncio -async def test_update_user_list_direct_license_async_from_dict(): - await test_update_user_list_direct_license_async(request_type=dict) - - def test_update_user_list_direct_license_field_headers(): client = UserListDirectLicenseServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2605,8 +2624,8 @@ async def test_update_user_list_direct_license_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - user_list_direct_license_service.ListUserListDirectLicensesRequest, - dict, + user_list_direct_license_service.ListUserListDirectLicensesRequest(), + {}, ], ) def test_list_user_list_direct_licenses(request_type, transport: str = "grpc"): @@ -2617,7 +2636,7 @@ def test_list_user_list_direct_licenses(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2669,13 +2688,14 @@ def test_list_user_list_direct_licenses_non_empty_request_with_auto_populated_fi client.list_user_list_direct_licenses(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == user_list_direct_license_service.ListUserListDirectLicensesRequest( - parent="parent_value", - filter="filter_value", - page_token="page_token_value", + request_msg = ( + user_list_direct_license_service.ListUserListDirectLicensesRequest( + parent="parent_value", + filter="filter_value", + page_token="page_token_value", + ) ) + assert args[0] == request_msg def test_list_user_list_direct_licenses_use_cached_wrapped_rpc(): @@ -2761,9 +2781,15 @@ async def test_list_user_list_direct_licenses_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + user_list_direct_license_service.ListUserListDirectLicensesRequest(), + {}, + ], +) async def test_list_user_list_direct_licenses_async( - transport: str = "grpc_asyncio", - request_type=user_list_direct_license_service.ListUserListDirectLicensesRequest, + request_type, transport: str = "grpc_asyncio" ): client = UserListDirectLicenseServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2772,7 +2798,7 @@ async def test_list_user_list_direct_licenses_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( @@ -2797,11 +2823,6 @@ async def test_list_user_list_direct_licenses_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_user_list_direct_licenses_async_from_dict(): - await test_list_user_list_direct_licenses_async(request_type=dict) - - def test_list_user_list_direct_licenses_field_headers(): client = UserListDirectLicenseServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4165,7 +4186,6 @@ def test_create_user_list_direct_license_empty_call_grpc(): request_msg = ( user_list_direct_license_service.CreateUserListDirectLicenseRequest() ) - assert args[0] == request_msg @@ -4188,7 +4208,6 @@ def test_get_user_list_direct_license_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_list_direct_license_service.GetUserListDirectLicenseRequest() - assert args[0] == request_msg @@ -4213,7 +4232,6 @@ def test_update_user_list_direct_license_empty_call_grpc(): request_msg = ( user_list_direct_license_service.UpdateUserListDirectLicenseRequest() ) - assert args[0] == request_msg @@ -4240,7 +4258,6 @@ def test_list_user_list_direct_licenses_empty_call_grpc(): request_msg = ( user_list_direct_license_service.ListUserListDirectLicensesRequest() ) - assert args[0] == request_msg @@ -4291,7 +4308,6 @@ async def test_create_user_list_direct_license_empty_call_grpc_asyncio(): request_msg = ( user_list_direct_license_service.CreateUserListDirectLicenseRequest() ) - assert args[0] == request_msg @@ -4326,7 +4342,6 @@ async def test_get_user_list_direct_license_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_list_direct_license_service.GetUserListDirectLicenseRequest() - assert args[0] == request_msg @@ -4363,7 +4378,6 @@ async def test_update_user_list_direct_license_empty_call_grpc_asyncio(): request_msg = ( user_list_direct_license_service.UpdateUserListDirectLicenseRequest() ) - assert args[0] == request_msg @@ -4394,7 +4408,6 @@ async def test_list_user_list_direct_licenses_empty_call_grpc_asyncio(): request_msg = ( user_list_direct_license_service.ListUserListDirectLicensesRequest() ) - assert args[0] == request_msg @@ -5274,7 +5287,6 @@ def test_create_user_list_direct_license_empty_call_rest(): request_msg = ( user_list_direct_license_service.CreateUserListDirectLicenseRequest() ) - assert args[0] == request_msg @@ -5296,7 +5308,6 @@ def test_get_user_list_direct_license_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_list_direct_license_service.GetUserListDirectLicenseRequest() - assert args[0] == request_msg @@ -5320,7 +5331,6 @@ def test_update_user_list_direct_license_empty_call_rest(): request_msg = ( user_list_direct_license_service.UpdateUserListDirectLicenseRequest() ) - assert args[0] == request_msg @@ -5344,7 +5354,6 @@ def test_list_user_list_direct_licenses_empty_call_rest(): request_msg = ( user_list_direct_license_service.ListUserListDirectLicensesRequest() ) - assert args[0] == request_msg diff --git a/packages/google-ads-datamanager/tests/unit/gapic/datamanager_v1/test_user_list_global_license_service.py b/packages/google-ads-datamanager/tests/unit/gapic/datamanager_v1/test_user_list_global_license_service.py index f81be992659a..23c015bde7f8 100644 --- a/packages/google-ads-datamanager/tests/unit/gapic/datamanager_v1/test_user_list_global_license_service.py +++ b/packages/google-ads-datamanager/tests/unit/gapic/datamanager_v1/test_user_list_global_license_service.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 @@ -119,6 +120,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" @@ -1429,8 +1445,8 @@ def test_user_list_global_license_service_client_create_channel_credentials_file @pytest.mark.parametrize( "request_type", [ - user_list_global_license_service.CreateUserListGlobalLicenseRequest, - dict, + user_list_global_license_service.CreateUserListGlobalLicenseRequest(), + {}, ], ) def test_create_user_list_global_license(request_type, transport: str = "grpc"): @@ -1441,7 +1457,7 @@ def test_create_user_list_global_license(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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 +1519,12 @@ def test_create_user_list_global_license_non_empty_request_with_auto_populated_f client.create_user_list_global_license(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == user_list_global_license_service.CreateUserListGlobalLicenseRequest( - parent="parent_value", + request_msg = ( + user_list_global_license_service.CreateUserListGlobalLicenseRequest( + parent="parent_value", + ) ) + assert args[0] == request_msg def test_create_user_list_global_license_use_cached_wrapped_rpc(): @@ -1593,9 +1610,15 @@ async def test_create_user_list_global_license_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + user_list_global_license_service.CreateUserListGlobalLicenseRequest(), + {}, + ], +) async def test_create_user_list_global_license_async( - transport: str = "grpc_asyncio", - request_type=user_list_global_license_service.CreateUserListGlobalLicenseRequest, + request_type, transport: str = "grpc_asyncio" ): client = UserListGlobalLicenseServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1604,7 +1627,7 @@ async def test_create_user_list_global_license_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( @@ -1643,11 +1666,6 @@ async def test_create_user_list_global_license_async( ) -@pytest.mark.asyncio -async def test_create_user_list_global_license_async_from_dict(): - await test_create_user_list_global_license_async(request_type=dict) - - def test_create_user_list_global_license_field_headers(): client = UserListGlobalLicenseServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1820,8 +1838,8 @@ async def test_create_user_list_global_license_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - user_list_global_license_service.UpdateUserListGlobalLicenseRequest, - dict, + user_list_global_license_service.UpdateUserListGlobalLicenseRequest(), + {}, ], ) def test_update_user_list_global_license(request_type, transport: str = "grpc"): @@ -1832,7 +1850,7 @@ def test_update_user_list_global_license(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1892,10 +1910,10 @@ def test_update_user_list_global_license_non_empty_request_with_auto_populated_f client.update_user_list_global_license(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert ( - args[0] - == user_list_global_license_service.UpdateUserListGlobalLicenseRequest() + request_msg = ( + user_list_global_license_service.UpdateUserListGlobalLicenseRequest() ) + assert args[0] == request_msg def test_update_user_list_global_license_use_cached_wrapped_rpc(): @@ -1981,9 +1999,15 @@ async def test_update_user_list_global_license_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + user_list_global_license_service.UpdateUserListGlobalLicenseRequest(), + {}, + ], +) async def test_update_user_list_global_license_async( - transport: str = "grpc_asyncio", - request_type=user_list_global_license_service.UpdateUserListGlobalLicenseRequest, + request_type, transport: str = "grpc_asyncio" ): client = UserListGlobalLicenseServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1992,7 +2016,7 @@ async def test_update_user_list_global_license_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( @@ -2031,11 +2055,6 @@ async def test_update_user_list_global_license_async( ) -@pytest.mark.asyncio -async def test_update_user_list_global_license_async_from_dict(): - await test_update_user_list_global_license_async(request_type=dict) - - def test_update_user_list_global_license_field_headers(): client = UserListGlobalLicenseServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2208,8 +2227,8 @@ async def test_update_user_list_global_license_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - user_list_global_license_service.GetUserListGlobalLicenseRequest, - dict, + user_list_global_license_service.GetUserListGlobalLicenseRequest(), + {}, ], ) def test_get_user_list_global_license(request_type, transport: str = "grpc"): @@ -2220,7 +2239,7 @@ def test_get_user_list_global_license(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2282,11 +2301,10 @@ def test_get_user_list_global_license_non_empty_request_with_auto_populated_fiel client.get_user_list_global_license(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == user_list_global_license_service.GetUserListGlobalLicenseRequest( + request_msg = user_list_global_license_service.GetUserListGlobalLicenseRequest( name="name_value", ) + assert args[0] == request_msg def test_get_user_list_global_license_use_cached_wrapped_rpc(): @@ -2372,9 +2390,15 @@ async def test_get_user_list_global_license_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + user_list_global_license_service.GetUserListGlobalLicenseRequest(), + {}, + ], +) async def test_get_user_list_global_license_async( - transport: str = "grpc_asyncio", - request_type=user_list_global_license_service.GetUserListGlobalLicenseRequest, + request_type, transport: str = "grpc_asyncio" ): client = UserListGlobalLicenseServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2383,7 +2407,7 @@ async def test_get_user_list_global_license_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( @@ -2422,11 +2446,6 @@ async def test_get_user_list_global_license_async( ) -@pytest.mark.asyncio -async def test_get_user_list_global_license_async_from_dict(): - await test_get_user_list_global_license_async(request_type=dict) - - def test_get_user_list_global_license_field_headers(): client = UserListGlobalLicenseServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2581,8 +2600,8 @@ async def test_get_user_list_global_license_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - user_list_global_license_service.ListUserListGlobalLicensesRequest, - dict, + user_list_global_license_service.ListUserListGlobalLicensesRequest(), + {}, ], ) def test_list_user_list_global_licenses(request_type, transport: str = "grpc"): @@ -2593,7 +2612,7 @@ def test_list_user_list_global_licenses(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,13 +2664,14 @@ def test_list_user_list_global_licenses_non_empty_request_with_auto_populated_fi client.list_user_list_global_licenses(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == user_list_global_license_service.ListUserListGlobalLicensesRequest( - parent="parent_value", - filter="filter_value", - page_token="page_token_value", + request_msg = ( + user_list_global_license_service.ListUserListGlobalLicensesRequest( + parent="parent_value", + filter="filter_value", + page_token="page_token_value", + ) ) + assert args[0] == request_msg def test_list_user_list_global_licenses_use_cached_wrapped_rpc(): @@ -2737,9 +2757,15 @@ async def test_list_user_list_global_licenses_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + user_list_global_license_service.ListUserListGlobalLicensesRequest(), + {}, + ], +) async def test_list_user_list_global_licenses_async( - transport: str = "grpc_asyncio", - request_type=user_list_global_license_service.ListUserListGlobalLicensesRequest, + request_type, transport: str = "grpc_asyncio" ): client = UserListGlobalLicenseServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2748,7 +2774,7 @@ async def test_list_user_list_global_licenses_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( @@ -2773,11 +2799,6 @@ async def test_list_user_list_global_licenses_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_user_list_global_licenses_async_from_dict(): - await test_list_user_list_global_licenses_async(request_type=dict) - - def test_list_user_list_global_licenses_field_headers(): client = UserListGlobalLicenseServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3146,8 +3167,8 @@ async def test_list_user_list_global_licenses_async_pages(): @pytest.mark.parametrize( "request_type", [ - user_list_global_license_service.ListUserListGlobalLicenseCustomerInfosRequest, - dict, + user_list_global_license_service.ListUserListGlobalLicenseCustomerInfosRequest(), + {}, ], ) def test_list_user_list_global_license_customer_infos( @@ -3160,7 +3181,7 @@ def test_list_user_list_global_license_customer_infos( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3212,14 +3233,12 @@ def test_list_user_list_global_license_customer_infos_non_empty_request_with_aut client.list_user_list_global_license_customer_infos(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert ( - args[0] - == user_list_global_license_service.ListUserListGlobalLicenseCustomerInfosRequest( - parent="parent_value", - filter="filter_value", - page_token="page_token_value", - ) + request_msg = user_list_global_license_service.ListUserListGlobalLicenseCustomerInfosRequest( + parent="parent_value", + filter="filter_value", + page_token="page_token_value", ) + assert args[0] == request_msg def test_list_user_list_global_license_customer_infos_use_cached_wrapped_rpc(): @@ -3305,9 +3324,15 @@ async def test_list_user_list_global_license_customer_infos_async_use_cached_wra @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + user_list_global_license_service.ListUserListGlobalLicenseCustomerInfosRequest(), + {}, + ], +) async def test_list_user_list_global_license_customer_infos_async( - transport: str = "grpc_asyncio", - request_type=user_list_global_license_service.ListUserListGlobalLicenseCustomerInfosRequest, + request_type, transport: str = "grpc_asyncio" ): client = UserListGlobalLicenseServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3316,7 +3341,7 @@ async def test_list_user_list_global_license_customer_infos_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( @@ -3341,11 +3366,6 @@ async def test_list_user_list_global_license_customer_infos_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_user_list_global_license_customer_infos_async_from_dict(): - await test_list_user_list_global_license_customer_infos_async(request_type=dict) - - def test_list_user_list_global_license_customer_infos_field_headers(): client = UserListGlobalLicenseServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5006,7 +5026,6 @@ def test_create_user_list_global_license_empty_call_grpc(): request_msg = ( user_list_global_license_service.CreateUserListGlobalLicenseRequest() ) - assert args[0] == request_msg @@ -5031,7 +5050,6 @@ def test_update_user_list_global_license_empty_call_grpc(): request_msg = ( user_list_global_license_service.UpdateUserListGlobalLicenseRequest() ) - assert args[0] == request_msg @@ -5054,7 +5072,6 @@ def test_get_user_list_global_license_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_list_global_license_service.GetUserListGlobalLicenseRequest() - assert args[0] == request_msg @@ -5081,7 +5098,6 @@ def test_list_user_list_global_licenses_empty_call_grpc(): request_msg = ( user_list_global_license_service.ListUserListGlobalLicensesRequest() ) - assert args[0] == request_msg @@ -5104,7 +5120,6 @@ def test_list_user_list_global_license_customer_infos_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_list_global_license_service.ListUserListGlobalLicenseCustomerInfosRequest() - assert args[0] == request_msg @@ -5153,7 +5168,6 @@ async def test_create_user_list_global_license_empty_call_grpc_asyncio(): request_msg = ( user_list_global_license_service.CreateUserListGlobalLicenseRequest() ) - assert args[0] == request_msg @@ -5188,7 +5202,6 @@ async def test_update_user_list_global_license_empty_call_grpc_asyncio(): request_msg = ( user_list_global_license_service.UpdateUserListGlobalLicenseRequest() ) - assert args[0] == request_msg @@ -5221,7 +5234,6 @@ async def test_get_user_list_global_license_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_list_global_license_service.GetUserListGlobalLicenseRequest() - assert args[0] == request_msg @@ -5252,7 +5264,6 @@ async def test_list_user_list_global_licenses_empty_call_grpc_asyncio(): request_msg = ( user_list_global_license_service.ListUserListGlobalLicensesRequest() ) - assert args[0] == request_msg @@ -5281,7 +5292,6 @@ async def test_list_user_list_global_license_customer_infos_empty_call_grpc_asyn call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_list_global_license_service.ListUserListGlobalLicenseCustomerInfosRequest() - assert args[0] == request_msg @@ -6291,7 +6301,6 @@ def test_create_user_list_global_license_empty_call_rest(): request_msg = ( user_list_global_license_service.CreateUserListGlobalLicenseRequest() ) - assert args[0] == request_msg @@ -6315,7 +6324,6 @@ def test_update_user_list_global_license_empty_call_rest(): request_msg = ( user_list_global_license_service.UpdateUserListGlobalLicenseRequest() ) - assert args[0] == request_msg @@ -6337,7 +6345,6 @@ def test_get_user_list_global_license_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_list_global_license_service.GetUserListGlobalLicenseRequest() - assert args[0] == request_msg @@ -6361,7 +6368,6 @@ def test_list_user_list_global_licenses_empty_call_rest(): request_msg = ( user_list_global_license_service.ListUserListGlobalLicensesRequest() ) - assert args[0] == request_msg @@ -6383,7 +6389,6 @@ def test_list_user_list_global_license_customer_infos_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_list_global_license_service.ListUserListGlobalLicenseCustomerInfosRequest() - assert args[0] == request_msg diff --git a/packages/google-ads-datamanager/tests/unit/gapic/datamanager_v1/test_user_list_service.py b/packages/google-ads-datamanager/tests/unit/gapic/datamanager_v1/test_user_list_service.py index 7466e3cd0ed3..8eab51847559 100644 --- a/packages/google-ads-datamanager/tests/unit/gapic/datamanager_v1/test_user_list_service.py +++ b/packages/google-ads-datamanager/tests/unit/gapic/datamanager_v1/test_user_list_service.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 @@ -110,6 +111,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" @@ -1337,8 +1353,8 @@ def test_user_list_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - user_list_service.GetUserListRequest, - dict, + user_list_service.GetUserListRequest(), + {}, ], ) def test_get_user_list(request_type, transport: str = "grpc"): @@ -1349,7 +1365,7 @@ def test_get_user_list(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_user_list), "__call__") as call: @@ -1411,9 +1427,10 @@ def test_get_user_list_non_empty_request_with_auto_populated_field(): client.get_user_list(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == user_list_service.GetUserListRequest( + request_msg = user_list_service.GetUserListRequest( name="name_value", ) + assert args[0] == request_msg def test_get_user_list_use_cached_wrapped_rpc(): @@ -1494,9 +1511,14 @@ async def test_get_user_list_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_user_list_async( - transport: str = "grpc_asyncio", request_type=user_list_service.GetUserListRequest -): +@pytest.mark.parametrize( + "request_type", + [ + user_list_service.GetUserListRequest(), + {}, + ], +) +async def test_get_user_list_async(request_type, transport: str = "grpc_asyncio"): client = UserListServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1504,7 +1526,7 @@ async def test_get_user_list_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_user_list), "__call__") as call: @@ -1545,11 +1567,6 @@ async def test_get_user_list_async( assert response.account_access_status == user_list.UserList.AccessStatus.ENABLED -@pytest.mark.asyncio -async def test_get_user_list_async_from_dict(): - await test_get_user_list_async(request_type=dict) - - def test_get_user_list_field_headers(): client = UserListServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1692,8 +1709,8 @@ async def test_get_user_list_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - user_list_service.ListUserListsRequest, - dict, + user_list_service.ListUserListsRequest(), + {}, ], ) def test_list_user_lists(request_type, transport: str = "grpc"): @@ -1704,7 +1721,7 @@ def test_list_user_lists(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_user_lists), "__call__") as call: @@ -1750,11 +1767,12 @@ def test_list_user_lists_non_empty_request_with_auto_populated_field(): client.list_user_lists(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == user_list_service.ListUserListsRequest( + request_msg = user_list_service.ListUserListsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_user_lists_use_cached_wrapped_rpc(): @@ -1835,9 +1853,14 @@ async def test_list_user_lists_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_user_lists_async( - transport: str = "grpc_asyncio", request_type=user_list_service.ListUserListsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + user_list_service.ListUserListsRequest(), + {}, + ], +) +async def test_list_user_lists_async(request_type, transport: str = "grpc_asyncio"): client = UserListServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1845,7 +1868,7 @@ async def test_list_user_lists_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_user_lists), "__call__") as call: @@ -1868,11 +1891,6 @@ async def test_list_user_lists_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_user_lists_async_from_dict(): - await test_list_user_lists_async(request_type=dict) - - def test_list_user_lists_field_headers(): client = UserListServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2209,8 +2227,8 @@ async def test_list_user_lists_async_pages(): @pytest.mark.parametrize( "request_type", [ - user_list_service.CreateUserListRequest, - dict, + user_list_service.CreateUserListRequest(), + {}, ], ) def test_create_user_list(request_type, transport: str = "grpc"): @@ -2221,7 +2239,7 @@ def test_create_user_list(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_user_list), "__call__") as call: @@ -2283,9 +2301,10 @@ def test_create_user_list_non_empty_request_with_auto_populated_field(): client.create_user_list(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == user_list_service.CreateUserListRequest( + request_msg = user_list_service.CreateUserListRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_user_list_use_cached_wrapped_rpc(): @@ -2368,10 +2387,14 @@ async def test_create_user_list_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_user_list_async( - transport: str = "grpc_asyncio", - request_type=user_list_service.CreateUserListRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + user_list_service.CreateUserListRequest(), + {}, + ], +) +async def test_create_user_list_async(request_type, transport: str = "grpc_asyncio"): client = UserListServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2379,7 +2402,7 @@ async def test_create_user_list_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_user_list), "__call__") as call: @@ -2420,11 +2443,6 @@ async def test_create_user_list_async( assert response.account_access_status == gad_user_list.UserList.AccessStatus.ENABLED -@pytest.mark.asyncio -async def test_create_user_list_async_from_dict(): - await test_create_user_list_async(request_type=dict) - - def test_create_user_list_field_headers(): client = UserListServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2581,8 +2599,8 @@ async def test_create_user_list_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - user_list_service.UpdateUserListRequest, - dict, + user_list_service.UpdateUserListRequest(), + {}, ], ) def test_update_user_list(request_type, transport: str = "grpc"): @@ -2593,7 +2611,7 @@ def test_update_user_list(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_user_list), "__call__") as call: @@ -2653,7 +2671,8 @@ def test_update_user_list_non_empty_request_with_auto_populated_field(): client.update_user_list(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == user_list_service.UpdateUserListRequest() + request_msg = user_list_service.UpdateUserListRequest() + assert args[0] == request_msg def test_update_user_list_use_cached_wrapped_rpc(): @@ -2736,10 +2755,14 @@ async def test_update_user_list_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_user_list_async( - transport: str = "grpc_asyncio", - request_type=user_list_service.UpdateUserListRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + user_list_service.UpdateUserListRequest(), + {}, + ], +) +async def test_update_user_list_async(request_type, transport: str = "grpc_asyncio"): client = UserListServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2747,7 +2770,7 @@ async def test_update_user_list_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_user_list), "__call__") as call: @@ -2788,11 +2811,6 @@ async def test_update_user_list_async( assert response.account_access_status == gad_user_list.UserList.AccessStatus.ENABLED -@pytest.mark.asyncio -async def test_update_user_list_async_from_dict(): - await test_update_user_list_async(request_type=dict) - - def test_update_user_list_field_headers(): client = UserListServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2949,8 +2967,8 @@ async def test_update_user_list_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - user_list_service.DeleteUserListRequest, - dict, + user_list_service.DeleteUserListRequest(), + {}, ], ) def test_delete_user_list(request_type, transport: str = "grpc"): @@ -2961,7 +2979,7 @@ def test_delete_user_list(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_user_list), "__call__") as call: @@ -3002,9 +3020,10 @@ def test_delete_user_list_non_empty_request_with_auto_populated_field(): client.delete_user_list(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == user_list_service.DeleteUserListRequest( + request_msg = user_list_service.DeleteUserListRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_user_list_use_cached_wrapped_rpc(): @@ -3087,10 +3106,14 @@ async def test_delete_user_list_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_user_list_async( - transport: str = "grpc_asyncio", - request_type=user_list_service.DeleteUserListRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + user_list_service.DeleteUserListRequest(), + {}, + ], +) +async def test_delete_user_list_async(request_type, transport: str = "grpc_asyncio"): client = UserListServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3098,7 +3121,7 @@ async def test_delete_user_list_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_user_list), "__call__") as call: @@ -3116,11 +3139,6 @@ async def test_delete_user_list_async( assert response is None -@pytest.mark.asyncio -async def test_delete_user_list_async_from_dict(): - await test_delete_user_list_async(request_type=dict) - - def test_delete_user_list_field_headers(): client = UserListServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4390,7 +4408,6 @@ def test_get_user_list_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_list_service.GetUserListRequest() - assert args[0] == request_msg @@ -4411,7 +4428,6 @@ def test_list_user_lists_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_list_service.ListUserListsRequest() - assert args[0] == request_msg @@ -4432,7 +4448,6 @@ def test_create_user_list_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_list_service.CreateUserListRequest() - assert args[0] == request_msg @@ -4453,7 +4468,6 @@ def test_update_user_list_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_list_service.UpdateUserListRequest() - assert args[0] == request_msg @@ -4474,7 +4488,6 @@ def test_delete_user_list_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_list_service.DeleteUserListRequest() - assert args[0] == request_msg @@ -4524,7 +4537,6 @@ async def test_get_user_list_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_list_service.GetUserListRequest() - assert args[0] == request_msg @@ -4551,7 +4563,6 @@ async def test_list_user_lists_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_list_service.ListUserListsRequest() - assert args[0] == request_msg @@ -4587,7 +4598,6 @@ async def test_create_user_list_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_list_service.CreateUserListRequest() - assert args[0] == request_msg @@ -4623,7 +4633,6 @@ async def test_update_user_list_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_list_service.UpdateUserListRequest() - assert args[0] == request_msg @@ -4646,7 +4655,6 @@ async def test_delete_user_list_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_list_service.DeleteUserListRequest() - assert args[0] == request_msg @@ -5601,7 +5609,6 @@ def test_get_user_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_list_service.GetUserListRequest() - assert args[0] == request_msg @@ -5621,7 +5628,6 @@ def test_list_user_lists_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_list_service.ListUserListsRequest() - assert args[0] == request_msg @@ -5641,7 +5647,6 @@ def test_create_user_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_list_service.CreateUserListRequest() - assert args[0] == request_msg @@ -5661,7 +5666,6 @@ def test_update_user_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_list_service.UpdateUserListRequest() - assert args[0] == request_msg @@ -5681,7 +5685,6 @@ def test_delete_user_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_list_service.DeleteUserListRequest() - assert args[0] == request_msg diff --git a/packages/google-ads-marketingplatform-admin/noxfile.py b/packages/google-ads-marketingplatform-admin/noxfile.py index 23ba36c6da13..6671718f045c 100644 --- a/packages/google-ads-marketingplatform-admin/noxfile.py +++ b/packages/google-ads-marketingplatform-admin/noxfile.py @@ -47,7 +47,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-ads-marketingplatform-admin" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-ads-marketingplatform-admin/setup.py b/packages/google-ads-marketingplatform-admin/setup.py index ca2352a01731..b4e9ddafeb60 100644 --- a/packages/google-ads-marketingplatform-admin/setup.py +++ b/packages/google-ads-marketingplatform-admin/setup.py @@ -45,7 +45,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/google-ads-marketingplatform-admin/testing/constraints-3.10.txt b/packages/google-ads-marketingplatform-admin/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-ads-marketingplatform-admin/testing/constraints-3.10.txt +++ b/packages/google-ads-marketingplatform-admin/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-ads-marketingplatform-admin/tests/unit/gapic/marketingplatform_admin_v1alpha/test_marketingplatform_admin_service.py b/packages/google-ads-marketingplatform-admin/tests/unit/gapic/marketingplatform_admin_v1alpha/test_marketingplatform_admin_service.py index 66fe98319447..1424f85162c9 100644 --- a/packages/google-ads-marketingplatform-admin/tests/unit/gapic/marketingplatform_admin_v1alpha/test_marketingplatform_admin_service.py +++ b/packages/google-ads-marketingplatform-admin/tests/unit/gapic/marketingplatform_admin_v1alpha/test_marketingplatform_admin_service.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 @@ -110,6 +111,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" @@ -1434,8 +1450,8 @@ def test_marketingplatform_admin_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - marketingplatform_admin.GetOrganizationRequest, - dict, + marketingplatform_admin.GetOrganizationRequest(), + {}, ], ) def test_get_organization(request_type, transport: str = "grpc"): @@ -1446,7 +1462,7 @@ def test_get_organization(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_organization), "__call__") as call: @@ -1492,9 +1508,10 @@ def test_get_organization_non_empty_request_with_auto_populated_field(): client.get_organization(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == marketingplatform_admin.GetOrganizationRequest( + request_msg = marketingplatform_admin.GetOrganizationRequest( name="name_value", ) + assert args[0] == request_msg def test_get_organization_use_cached_wrapped_rpc(): @@ -1577,10 +1594,14 @@ async def test_get_organization_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_organization_async( - transport: str = "grpc_asyncio", - request_type=marketingplatform_admin.GetOrganizationRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + marketingplatform_admin.GetOrganizationRequest(), + {}, + ], +) +async def test_get_organization_async(request_type, transport: str = "grpc_asyncio"): client = MarketingplatformAdminServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1588,7 +1609,7 @@ async def test_get_organization_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_organization), "__call__") as call: @@ -1613,11 +1634,6 @@ async def test_get_organization_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_get_organization_async_from_dict(): - await test_get_organization_async(request_type=dict) - - def test_get_organization_field_headers(): client = MarketingplatformAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1764,8 +1780,8 @@ async def test_get_organization_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - marketingplatform_admin.ListOrganizationsRequest, - dict, + marketingplatform_admin.ListOrganizationsRequest(), + {}, ], ) def test_list_organizations(request_type, transport: str = "grpc"): @@ -1776,7 +1792,7 @@ def test_list_organizations(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1824,9 +1840,10 @@ def test_list_organizations_non_empty_request_with_auto_populated_field(): client.list_organizations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == marketingplatform_admin.ListOrganizationsRequest( + request_msg = marketingplatform_admin.ListOrganizationsRequest( page_token="page_token_value", ) + assert args[0] == request_msg def test_list_organizations_use_cached_wrapped_rpc(): @@ -1911,10 +1928,14 @@ async def test_list_organizations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_organizations_async( - transport: str = "grpc_asyncio", - request_type=marketingplatform_admin.ListOrganizationsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + marketingplatform_admin.ListOrganizationsRequest(), + {}, + ], +) +async def test_list_organizations_async(request_type, transport: str = "grpc_asyncio"): client = MarketingplatformAdminServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1922,7 +1943,7 @@ async def test_list_organizations_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( @@ -1947,11 +1968,6 @@ async def test_list_organizations_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_organizations_async_from_dict(): - await test_list_organizations_async(request_type=dict) - - def test_list_organizations_pager(transport_name: str = "grpc"): client = MarketingplatformAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2150,8 +2166,8 @@ async def test_list_organizations_async_pages(): @pytest.mark.parametrize( "request_type", [ - marketingplatform_admin.FindSalesPartnerManagedClientsRequest, - dict, + marketingplatform_admin.FindSalesPartnerManagedClientsRequest(), + {}, ], ) def test_find_sales_partner_managed_clients(request_type, transport: str = "grpc"): @@ -2162,7 +2178,7 @@ def test_find_sales_partner_managed_clients(request_type, transport: str = "grpc # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2211,9 +2227,10 @@ def test_find_sales_partner_managed_clients_non_empty_request_with_auto_populate client.find_sales_partner_managed_clients(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == marketingplatform_admin.FindSalesPartnerManagedClientsRequest( + request_msg = marketingplatform_admin.FindSalesPartnerManagedClientsRequest( organization="organization_value", ) + assert args[0] == request_msg def test_find_sales_partner_managed_clients_use_cached_wrapped_rpc(): @@ -2299,9 +2316,15 @@ async def test_find_sales_partner_managed_clients_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + marketingplatform_admin.FindSalesPartnerManagedClientsRequest(), + {}, + ], +) async def test_find_sales_partner_managed_clients_async( - transport: str = "grpc_asyncio", - request_type=marketingplatform_admin.FindSalesPartnerManagedClientsRequest, + request_type, transport: str = "grpc_asyncio" ): client = MarketingplatformAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2310,7 +2333,7 @@ async def test_find_sales_partner_managed_clients_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( @@ -2334,11 +2357,6 @@ async def test_find_sales_partner_managed_clients_async( ) -@pytest.mark.asyncio -async def test_find_sales_partner_managed_clients_async_from_dict(): - await test_find_sales_partner_managed_clients_async(request_type=dict) - - def test_find_sales_partner_managed_clients_field_headers(): client = MarketingplatformAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2409,8 +2427,8 @@ async def test_find_sales_partner_managed_clients_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - marketingplatform_admin.ListAnalyticsAccountLinksRequest, - dict, + marketingplatform_admin.ListAnalyticsAccountLinksRequest(), + {}, ], ) def test_list_analytics_account_links(request_type, transport: str = "grpc"): @@ -2421,7 +2439,7 @@ def test_list_analytics_account_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( @@ -2470,10 +2488,11 @@ def test_list_analytics_account_links_non_empty_request_with_auto_populated_fiel client.list_analytics_account_links(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == marketingplatform_admin.ListAnalyticsAccountLinksRequest( + request_msg = marketingplatform_admin.ListAnalyticsAccountLinksRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_analytics_account_links_use_cached_wrapped_rpc(): @@ -2559,9 +2578,15 @@ async def test_list_analytics_account_links_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + marketingplatform_admin.ListAnalyticsAccountLinksRequest(), + {}, + ], +) async def test_list_analytics_account_links_async( - transport: str = "grpc_asyncio", - request_type=marketingplatform_admin.ListAnalyticsAccountLinksRequest, + request_type, transport: str = "grpc_asyncio" ): client = MarketingplatformAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2570,7 +2595,7 @@ async def test_list_analytics_account_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( @@ -2595,11 +2620,6 @@ async def test_list_analytics_account_links_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_analytics_account_links_async_from_dict(): - await test_list_analytics_account_links_async(request_type=dict) - - def test_list_analytics_account_links_field_headers(): client = MarketingplatformAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2956,8 +2976,8 @@ async def test_list_analytics_account_links_async_pages(): @pytest.mark.parametrize( "request_type", [ - marketingplatform_admin.CreateAnalyticsAccountLinkRequest, - dict, + marketingplatform_admin.CreateAnalyticsAccountLinkRequest(), + {}, ], ) def test_create_analytics_account_link(request_type, transport: str = "grpc"): @@ -2968,7 +2988,7 @@ def test_create_analytics_account_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( @@ -3025,9 +3045,10 @@ def test_create_analytics_account_link_non_empty_request_with_auto_populated_fie client.create_analytics_account_link(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == marketingplatform_admin.CreateAnalyticsAccountLinkRequest( + request_msg = marketingplatform_admin.CreateAnalyticsAccountLinkRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_analytics_account_link_use_cached_wrapped_rpc(): @@ -3113,9 +3134,15 @@ async def test_create_analytics_account_link_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + marketingplatform_admin.CreateAnalyticsAccountLinkRequest(), + {}, + ], +) async def test_create_analytics_account_link_async( - transport: str = "grpc_asyncio", - request_type=marketingplatform_admin.CreateAnalyticsAccountLinkRequest, + request_type, transport: str = "grpc_asyncio" ): client = MarketingplatformAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3124,7 +3151,7 @@ async def test_create_analytics_account_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( @@ -3158,11 +3185,6 @@ async def test_create_analytics_account_link_async( ) -@pytest.mark.asyncio -async def test_create_analytics_account_link_async_from_dict(): - await test_create_analytics_account_link_async(request_type=dict) - - def test_create_analytics_account_link_field_headers(): client = MarketingplatformAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3327,8 +3349,8 @@ async def test_create_analytics_account_link_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - marketingplatform_admin.DeleteAnalyticsAccountLinkRequest, - dict, + marketingplatform_admin.DeleteAnalyticsAccountLinkRequest(), + {}, ], ) def test_delete_analytics_account_link(request_type, transport: str = "grpc"): @@ -3339,7 +3361,7 @@ def test_delete_analytics_account_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( @@ -3384,9 +3406,10 @@ def test_delete_analytics_account_link_non_empty_request_with_auto_populated_fie client.delete_analytics_account_link(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == marketingplatform_admin.DeleteAnalyticsAccountLinkRequest( + request_msg = marketingplatform_admin.DeleteAnalyticsAccountLinkRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_analytics_account_link_use_cached_wrapped_rpc(): @@ -3472,9 +3495,15 @@ async def test_delete_analytics_account_link_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + marketingplatform_admin.DeleteAnalyticsAccountLinkRequest(), + {}, + ], +) async def test_delete_analytics_account_link_async( - transport: str = "grpc_asyncio", - request_type=marketingplatform_admin.DeleteAnalyticsAccountLinkRequest, + request_type, transport: str = "grpc_asyncio" ): client = MarketingplatformAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3483,7 +3512,7 @@ async def test_delete_analytics_account_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( @@ -3503,11 +3532,6 @@ async def test_delete_analytics_account_link_async( assert response is None -@pytest.mark.asyncio -async def test_delete_analytics_account_link_async_from_dict(): - await test_delete_analytics_account_link_async(request_type=dict) - - def test_delete_analytics_account_link_field_headers(): client = MarketingplatformAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3658,8 +3682,8 @@ async def test_delete_analytics_account_link_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - marketingplatform_admin.SetPropertyServiceLevelRequest, - dict, + marketingplatform_admin.SetPropertyServiceLevelRequest(), + {}, ], ) def test_set_property_service_level(request_type, transport: str = "grpc"): @@ -3670,7 +3694,7 @@ def test_set_property_service_level(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3716,10 +3740,11 @@ def test_set_property_service_level_non_empty_request_with_auto_populated_field( client.set_property_service_level(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == marketingplatform_admin.SetPropertyServiceLevelRequest( + request_msg = marketingplatform_admin.SetPropertyServiceLevelRequest( analytics_account_link="analytics_account_link_value", analytics_property="analytics_property_value", ) + assert args[0] == request_msg def test_set_property_service_level_use_cached_wrapped_rpc(): @@ -3805,9 +3830,15 @@ async def test_set_property_service_level_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + marketingplatform_admin.SetPropertyServiceLevelRequest(), + {}, + ], +) async def test_set_property_service_level_async( - transport: str = "grpc_asyncio", - request_type=marketingplatform_admin.SetPropertyServiceLevelRequest, + request_type, transport: str = "grpc_asyncio" ): client = MarketingplatformAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3816,7 +3847,7 @@ async def test_set_property_service_level_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( @@ -3838,11 +3869,6 @@ async def test_set_property_service_level_async( assert isinstance(response, marketingplatform_admin.SetPropertyServiceLevelResponse) -@pytest.mark.asyncio -async def test_set_property_service_level_async_from_dict(): - await test_set_property_service_level_async(request_type=dict) - - def test_set_property_service_level_field_headers(): client = MarketingplatformAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3997,8 +4023,8 @@ async def test_set_property_service_level_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - marketingplatform_admin.ReportPropertyUsageRequest, - dict, + marketingplatform_admin.ReportPropertyUsageRequest(), + {}, ], ) def test_report_property_usage(request_type, transport: str = "grpc"): @@ -4009,7 +4035,7 @@ def test_report_property_usage(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4055,10 +4081,11 @@ def test_report_property_usage_non_empty_request_with_auto_populated_field(): client.report_property_usage(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == marketingplatform_admin.ReportPropertyUsageRequest( + request_msg = marketingplatform_admin.ReportPropertyUsageRequest( organization="organization_value", month="month_value", ) + assert args[0] == request_msg def test_report_property_usage_use_cached_wrapped_rpc(): @@ -4144,9 +4171,15 @@ async def test_report_property_usage_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + marketingplatform_admin.ReportPropertyUsageRequest(), + {}, + ], +) async def test_report_property_usage_async( - transport: str = "grpc_asyncio", - request_type=marketingplatform_admin.ReportPropertyUsageRequest, + request_type, transport: str = "grpc_asyncio" ): client = MarketingplatformAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4155,7 +4188,7 @@ async def test_report_property_usage_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( @@ -4177,11 +4210,6 @@ async def test_report_property_usage_async( assert isinstance(response, marketingplatform_admin.ReportPropertyUsageResponse) -@pytest.mark.asyncio -async def test_report_property_usage_async_from_dict(): - await test_report_property_usage_async(request_type=dict) - - def test_report_property_usage_field_headers(): client = MarketingplatformAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5915,7 +5943,6 @@ def test_get_organization_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = marketingplatform_admin.GetOrganizationRequest() - assert args[0] == request_msg @@ -5938,7 +5965,6 @@ def test_list_organizations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = marketingplatform_admin.ListOrganizationsRequest() - assert args[0] == request_msg @@ -5963,7 +5989,6 @@ def test_find_sales_partner_managed_clients_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = marketingplatform_admin.FindSalesPartnerManagedClientsRequest() - assert args[0] == request_msg @@ -5986,7 +6011,6 @@ def test_list_analytics_account_links_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = marketingplatform_admin.ListAnalyticsAccountLinksRequest() - assert args[0] == request_msg @@ -6009,7 +6033,6 @@ def test_create_analytics_account_link_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = marketingplatform_admin.CreateAnalyticsAccountLinkRequest() - assert args[0] == request_msg @@ -6032,7 +6055,6 @@ def test_delete_analytics_account_link_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = marketingplatform_admin.DeleteAnalyticsAccountLinkRequest() - assert args[0] == request_msg @@ -6055,7 +6077,6 @@ def test_set_property_service_level_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = marketingplatform_admin.SetPropertyServiceLevelRequest() - assert args[0] == request_msg @@ -6078,7 +6099,6 @@ def test_report_property_usage_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = marketingplatform_admin.ReportPropertyUsageRequest() - assert args[0] == request_msg @@ -6120,7 +6140,6 @@ async def test_get_organization_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = marketingplatform_admin.GetOrganizationRequest() - assert args[0] == request_msg @@ -6149,7 +6168,6 @@ async def test_list_organizations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = marketingplatform_admin.ListOrganizationsRequest() - assert args[0] == request_msg @@ -6176,7 +6194,6 @@ async def test_find_sales_partner_managed_clients_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = marketingplatform_admin.FindSalesPartnerManagedClientsRequest() - assert args[0] == request_msg @@ -6205,7 +6222,6 @@ async def test_list_analytics_account_links_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = marketingplatform_admin.ListAnalyticsAccountLinksRequest() - assert args[0] == request_msg @@ -6237,7 +6253,6 @@ async def test_create_analytics_account_link_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = marketingplatform_admin.CreateAnalyticsAccountLinkRequest() - assert args[0] == request_msg @@ -6262,7 +6277,6 @@ async def test_delete_analytics_account_link_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = marketingplatform_admin.DeleteAnalyticsAccountLinkRequest() - assert args[0] == request_msg @@ -6289,7 +6303,6 @@ async def test_set_property_service_level_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = marketingplatform_admin.SetPropertyServiceLevelRequest() - assert args[0] == request_msg @@ -6316,7 +6329,6 @@ async def test_report_property_usage_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = marketingplatform_admin.ReportPropertyUsageRequest() - assert args[0] == request_msg @@ -7522,7 +7534,6 @@ def test_get_organization_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = marketingplatform_admin.GetOrganizationRequest() - assert args[0] == request_msg @@ -7544,7 +7555,6 @@ def test_list_organizations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = marketingplatform_admin.ListOrganizationsRequest() - assert args[0] == request_msg @@ -7566,7 +7576,6 @@ def test_find_sales_partner_managed_clients_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = marketingplatform_admin.FindSalesPartnerManagedClientsRequest() - assert args[0] == request_msg @@ -7588,7 +7597,6 @@ def test_list_analytics_account_links_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = marketingplatform_admin.ListAnalyticsAccountLinksRequest() - assert args[0] == request_msg @@ -7610,7 +7618,6 @@ def test_create_analytics_account_link_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = marketingplatform_admin.CreateAnalyticsAccountLinkRequest() - assert args[0] == request_msg @@ -7632,7 +7639,6 @@ def test_delete_analytics_account_link_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = marketingplatform_admin.DeleteAnalyticsAccountLinkRequest() - assert args[0] == request_msg @@ -7654,7 +7660,6 @@ def test_set_property_service_level_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = marketingplatform_admin.SetPropertyServiceLevelRequest() - assert args[0] == request_msg @@ -7676,7 +7681,6 @@ def test_report_property_usage_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = marketingplatform_admin.ReportPropertyUsageRequest() - assert args[0] == request_msg diff --git a/packages/google-ai-generativelanguage/noxfile.py b/packages/google-ai-generativelanguage/noxfile.py index ed521c2953b6..770a51d82198 100644 --- a/packages/google-ai-generativelanguage/noxfile.py +++ b/packages/google-ai-generativelanguage/noxfile.py @@ -47,7 +47,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-ai-generativelanguage" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-ai-generativelanguage/setup.py b/packages/google-ai-generativelanguage/setup.py index 7c328f556154..26599479f3c7 100644 --- a/packages/google-ai-generativelanguage/setup.py +++ b/packages/google-ai-generativelanguage/setup.py @@ -45,7 +45,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/google-ai-generativelanguage/testing/constraints-3.10.txt b/packages/google-ai-generativelanguage/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-ai-generativelanguage/testing/constraints-3.10.txt +++ b/packages/google-ai-generativelanguage/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-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1/test_generative_service.py b/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1/test_generative_service.py index 85009a94fd79..534ce03cf933 100644 --- a/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1/test_generative_service.py +++ b/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1/test_generative_service.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 @@ -110,6 +111,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" @@ -1351,8 +1367,8 @@ def test_generative_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - generative_service.GenerateContentRequest, - dict, + generative_service.GenerateContentRequest(), + {}, ], ) def test_generate_content(request_type, transport: str = "grpc"): @@ -1363,7 +1379,7 @@ def test_generate_content(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.generate_content), "__call__") as call: @@ -1409,9 +1425,10 @@ def test_generate_content_non_empty_request_with_auto_populated_field(): client.generate_content(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == generative_service.GenerateContentRequest( + request_msg = generative_service.GenerateContentRequest( model="model_value", ) + assert args[0] == request_msg def test_generate_content_use_cached_wrapped_rpc(): @@ -1494,10 +1511,14 @@ async def test_generate_content_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_generate_content_async( - transport: str = "grpc_asyncio", - request_type=generative_service.GenerateContentRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + generative_service.GenerateContentRequest(), + {}, + ], +) +async def test_generate_content_async(request_type, transport: str = "grpc_asyncio"): client = GenerativeServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1505,7 +1526,7 @@ async def test_generate_content_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.generate_content), "__call__") as call: @@ -1530,11 +1551,6 @@ async def test_generate_content_async( assert response.response_id == "response_id_value" -@pytest.mark.asyncio -async def test_generate_content_async_from_dict(): - await test_generate_content_async(request_type=dict) - - def test_generate_content_field_headers(): client = GenerativeServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1691,8 +1707,8 @@ async def test_generate_content_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - generative_service.GenerateContentRequest, - dict, + generative_service.GenerateContentRequest(), + {}, ], ) def test_stream_generate_content(request_type, transport: str = "grpc"): @@ -1703,7 +1719,7 @@ def test_stream_generate_content(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1749,9 +1765,10 @@ def test_stream_generate_content_non_empty_request_with_auto_populated_field(): client.stream_generate_content(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == generative_service.GenerateContentRequest( + request_msg = generative_service.GenerateContentRequest( model="model_value", ) + assert args[0] == request_msg def test_stream_generate_content_use_cached_wrapped_rpc(): @@ -1837,9 +1854,15 @@ async def test_stream_generate_content_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + generative_service.GenerateContentRequest(), + {}, + ], +) async def test_stream_generate_content_async( - transport: str = "grpc_asyncio", - request_type=generative_service.GenerateContentRequest, + request_type, transport: str = "grpc_asyncio" ): client = GenerativeServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1848,7 +1871,7 @@ async def test_stream_generate_content_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( @@ -1872,11 +1895,6 @@ async def test_stream_generate_content_async( assert isinstance(message, generative_service.GenerateContentResponse) -@pytest.mark.asyncio -async def test_stream_generate_content_async_from_dict(): - await test_stream_generate_content_async(request_type=dict) - - def test_stream_generate_content_field_headers(): client = GenerativeServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2040,8 +2058,8 @@ async def test_stream_generate_content_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - generative_service.EmbedContentRequest, - dict, + generative_service.EmbedContentRequest(), + {}, ], ) def test_embed_content(request_type, transport: str = "grpc"): @@ -2052,7 +2070,7 @@ def test_embed_content(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.embed_content), "__call__") as call: @@ -2094,10 +2112,11 @@ def test_embed_content_non_empty_request_with_auto_populated_field(): client.embed_content(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == generative_service.EmbedContentRequest( + request_msg = generative_service.EmbedContentRequest( model="model_value", title="title_value", ) + assert args[0] == request_msg def test_embed_content_use_cached_wrapped_rpc(): @@ -2178,9 +2197,14 @@ async def test_embed_content_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_embed_content_async( - transport: str = "grpc_asyncio", request_type=generative_service.EmbedContentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + generative_service.EmbedContentRequest(), + {}, + ], +) +async def test_embed_content_async(request_type, transport: str = "grpc_asyncio"): client = GenerativeServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2188,7 +2212,7 @@ async def test_embed_content_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.embed_content), "__call__") as call: @@ -2208,11 +2232,6 @@ async def test_embed_content_async( assert isinstance(response, generative_service.EmbedContentResponse) -@pytest.mark.asyncio -async def test_embed_content_async_from_dict(): - await test_embed_content_async(request_type=dict) - - def test_embed_content_field_headers(): client = GenerativeServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2369,8 +2388,8 @@ async def test_embed_content_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - generative_service.BatchEmbedContentsRequest, - dict, + generative_service.BatchEmbedContentsRequest(), + {}, ], ) def test_batch_embed_contents(request_type, transport: str = "grpc"): @@ -2381,7 +2400,7 @@ def test_batch_embed_contents(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2426,9 +2445,10 @@ def test_batch_embed_contents_non_empty_request_with_auto_populated_field(): client.batch_embed_contents(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == generative_service.BatchEmbedContentsRequest( + request_msg = generative_service.BatchEmbedContentsRequest( model="model_value", ) + assert args[0] == request_msg def test_batch_embed_contents_use_cached_wrapped_rpc(): @@ -2513,9 +2533,15 @@ async def test_batch_embed_contents_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + generative_service.BatchEmbedContentsRequest(), + {}, + ], +) async def test_batch_embed_contents_async( - transport: str = "grpc_asyncio", - request_type=generative_service.BatchEmbedContentsRequest, + request_type, transport: str = "grpc_asyncio" ): client = GenerativeServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2524,7 +2550,7 @@ async def test_batch_embed_contents_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( @@ -2546,11 +2572,6 @@ async def test_batch_embed_contents_async( assert isinstance(response, generative_service.BatchEmbedContentsResponse) -@pytest.mark.asyncio -async def test_batch_embed_contents_async_from_dict(): - await test_batch_embed_contents_async(request_type=dict) - - def test_batch_embed_contents_field_headers(): client = GenerativeServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2715,8 +2736,8 @@ async def test_batch_embed_contents_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - generative_service.CountTokensRequest, - dict, + generative_service.CountTokensRequest(), + {}, ], ) def test_count_tokens(request_type, transport: str = "grpc"): @@ -2727,7 +2748,7 @@ def test_count_tokens(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.count_tokens), "__call__") as call: @@ -2771,9 +2792,10 @@ def test_count_tokens_non_empty_request_with_auto_populated_field(): client.count_tokens(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == generative_service.CountTokensRequest( + request_msg = generative_service.CountTokensRequest( model="model_value", ) + assert args[0] == request_msg def test_count_tokens_use_cached_wrapped_rpc(): @@ -2854,9 +2876,14 @@ async def test_count_tokens_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_count_tokens_async( - transport: str = "grpc_asyncio", request_type=generative_service.CountTokensRequest -): +@pytest.mark.parametrize( + "request_type", + [ + generative_service.CountTokensRequest(), + {}, + ], +) +async def test_count_tokens_async(request_type, transport: str = "grpc_asyncio"): client = GenerativeServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2864,7 +2891,7 @@ async def test_count_tokens_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.count_tokens), "__call__") as call: @@ -2887,11 +2914,6 @@ async def test_count_tokens_async( assert response.total_tokens == 1303 -@pytest.mark.asyncio -async def test_count_tokens_async_from_dict(): - await test_count_tokens_async(request_type=dict) - - def test_count_tokens_field_headers(): client = GenerativeServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4116,7 +4138,6 @@ def test_generate_content_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generative_service.GenerateContentRequest() - assert args[0] == request_msg @@ -4139,7 +4160,6 @@ def test_stream_generate_content_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generative_service.GenerateContentRequest() - assert args[0] == request_msg @@ -4160,7 +4180,6 @@ def test_embed_content_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generative_service.EmbedContentRequest() - assert args[0] == request_msg @@ -4183,7 +4202,6 @@ def test_batch_embed_contents_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generative_service.BatchEmbedContentsRequest() - assert args[0] == request_msg @@ -4204,7 +4222,6 @@ def test_count_tokens_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generative_service.CountTokensRequest() - assert args[0] == request_msg @@ -4246,7 +4263,6 @@ async def test_generate_content_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generative_service.GenerateContentRequest() - assert args[0] == request_msg @@ -4274,7 +4290,6 @@ async def test_stream_generate_content_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generative_service.GenerateContentRequest() - assert args[0] == request_msg @@ -4299,7 +4314,6 @@ async def test_embed_content_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generative_service.EmbedContentRequest() - assert args[0] == request_msg @@ -4326,7 +4340,6 @@ async def test_batch_embed_contents_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generative_service.BatchEmbedContentsRequest() - assert args[0] == request_msg @@ -4353,7 +4366,6 @@ async def test_count_tokens_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generative_service.CountTokensRequest() - assert args[0] == request_msg @@ -5317,7 +5329,6 @@ def test_generate_content_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generative_service.GenerateContentRequest() - assert args[0] == request_msg @@ -5339,7 +5350,6 @@ def test_stream_generate_content_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generative_service.GenerateContentRequest() - assert args[0] == request_msg @@ -5359,7 +5369,6 @@ def test_embed_content_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generative_service.EmbedContentRequest() - assert args[0] == request_msg @@ -5381,7 +5390,6 @@ def test_batch_embed_contents_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generative_service.BatchEmbedContentsRequest() - assert args[0] == request_msg @@ -5401,7 +5409,6 @@ def test_count_tokens_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generative_service.CountTokensRequest() - assert args[0] == request_msg diff --git a/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1/test_model_service.py b/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1/test_model_service.py index e74a32c68254..2f19a9cd99e8 100644 --- a/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1/test_model_service.py +++ b/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1/test_model_service.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 @@ -108,6 +109,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" @@ -1288,8 +1304,8 @@ def test_model_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - model_service.GetModelRequest, - dict, + model_service.GetModelRequest(), + {}, ], ) def test_get_model(request_type, transport: str = "grpc"): @@ -1300,7 +1316,7 @@ def test_get_model(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_model), "__call__") as call: @@ -1370,9 +1386,10 @@ def test_get_model_non_empty_request_with_auto_populated_field(): client.get_model(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == model_service.GetModelRequest( + request_msg = model_service.GetModelRequest( name="name_value", ) + assert args[0] == request_msg def test_get_model_use_cached_wrapped_rpc(): @@ -1451,9 +1468,14 @@ async def test_get_model_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_model_async( - transport: str = "grpc_asyncio", request_type=model_service.GetModelRequest -): +@pytest.mark.parametrize( + "request_type", + [ + model_service.GetModelRequest(), + {}, + ], +) +async def test_get_model_async(request_type, transport: str = "grpc_asyncio"): client = ModelServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1461,7 +1483,7 @@ async def test_get_model_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_model), "__call__") as call: @@ -1510,11 +1532,6 @@ async def test_get_model_async( assert response.thinking is True -@pytest.mark.asyncio -async def test_get_model_async_from_dict(): - await test_get_model_async(request_type=dict) - - def test_get_model_field_headers(): client = ModelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1657,8 +1674,8 @@ async def test_get_model_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - model_service.ListModelsRequest, - dict, + model_service.ListModelsRequest(), + {}, ], ) def test_list_models(request_type, transport: str = "grpc"): @@ -1669,7 +1686,7 @@ def test_list_models(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_models), "__call__") as call: @@ -1713,9 +1730,10 @@ def test_list_models_non_empty_request_with_auto_populated_field(): client.list_models(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == model_service.ListModelsRequest( + request_msg = model_service.ListModelsRequest( page_token="page_token_value", ) + assert args[0] == request_msg def test_list_models_use_cached_wrapped_rpc(): @@ -1796,9 +1814,14 @@ async def test_list_models_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_models_async( - transport: str = "grpc_asyncio", request_type=model_service.ListModelsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + model_service.ListModelsRequest(), + {}, + ], +) +async def test_list_models_async(request_type, transport: str = "grpc_asyncio"): client = ModelServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1806,7 +1829,7 @@ async def test_list_models_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_models), "__call__") as call: @@ -1829,11 +1852,6 @@ async def test_list_models_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_models_async_from_dict(): - await test_list_models_async(request_type=dict) - - def test_list_models_flattened(): client = ModelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2563,7 +2581,6 @@ def test_get_model_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.GetModelRequest() - assert args[0] == request_msg @@ -2584,7 +2601,6 @@ def test_list_models_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.ListModelsRequest() - assert args[0] == request_msg @@ -2637,7 +2653,6 @@ async def test_get_model_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.GetModelRequest() - assert args[0] == request_msg @@ -2664,7 +2679,6 @@ async def test_list_models_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.ListModelsRequest() - assert args[0] == request_msg @@ -3228,7 +3242,6 @@ def test_get_model_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.GetModelRequest() - assert args[0] == request_msg @@ -3248,7 +3261,6 @@ def test_list_models_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.ListModelsRequest() - assert args[0] == request_msg diff --git a/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1alpha/test_cache_service.py b/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1alpha/test_cache_service.py index 1ca1a75a3a39..785260f6c6eb 100644 --- a/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1alpha/test_cache_service.py +++ b/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1alpha/test_cache_service.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 @@ -119,6 +120,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" @@ -1299,8 +1315,8 @@ def test_cache_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - cache_service.ListCachedContentsRequest, - dict, + cache_service.ListCachedContentsRequest(), + {}, ], ) def test_list_cached_contents(request_type, transport: str = "grpc"): @@ -1311,7 +1327,7 @@ def test_list_cached_contents(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1359,9 +1375,10 @@ def test_list_cached_contents_non_empty_request_with_auto_populated_field(): client.list_cached_contents(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cache_service.ListCachedContentsRequest( + request_msg = cache_service.ListCachedContentsRequest( page_token="page_token_value", ) + assert args[0] == request_msg def test_list_cached_contents_use_cached_wrapped_rpc(): @@ -1446,9 +1463,15 @@ async def test_list_cached_contents_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cache_service.ListCachedContentsRequest(), + {}, + ], +) async def test_list_cached_contents_async( - transport: str = "grpc_asyncio", - request_type=cache_service.ListCachedContentsRequest, + request_type, transport: str = "grpc_asyncio" ): client = CacheServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1457,7 +1480,7 @@ async def test_list_cached_contents_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( @@ -1482,11 +1505,6 @@ async def test_list_cached_contents_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_cached_contents_async_from_dict(): - await test_list_cached_contents_async(request_type=dict) - - def test_list_cached_contents_pager(transport_name: str = "grpc"): client = CacheServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1685,8 +1703,8 @@ async def test_list_cached_contents_async_pages(): @pytest.mark.parametrize( "request_type", [ - cache_service.CreateCachedContentRequest, - dict, + cache_service.CreateCachedContentRequest(), + {}, ], ) def test_create_cached_content(request_type, transport: str = "grpc"): @@ -1697,7 +1715,7 @@ def test_create_cached_content(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1747,7 +1765,8 @@ def test_create_cached_content_non_empty_request_with_auto_populated_field(): client.create_cached_content(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cache_service.CreateCachedContentRequest() + request_msg = cache_service.CreateCachedContentRequest() + assert args[0] == request_msg def test_create_cached_content_use_cached_wrapped_rpc(): @@ -1833,9 +1852,15 @@ async def test_create_cached_content_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cache_service.CreateCachedContentRequest(), + {}, + ], +) async def test_create_cached_content_async( - transport: str = "grpc_asyncio", - request_type=cache_service.CreateCachedContentRequest, + request_type, transport: str = "grpc_asyncio" ): client = CacheServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1844,7 +1869,7 @@ async def test_create_cached_content_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( @@ -1873,11 +1898,6 @@ async def test_create_cached_content_async( assert response.model == "model_value" -@pytest.mark.asyncio -async def test_create_cached_content_async_from_dict(): - await test_create_cached_content_async(request_type=dict) - - def test_create_cached_content_flattened(): client = CacheServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1979,8 +1999,8 @@ async def test_create_cached_content_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cache_service.GetCachedContentRequest, - dict, + cache_service.GetCachedContentRequest(), + {}, ], ) def test_get_cached_content(request_type, transport: str = "grpc"): @@ -1991,7 +2011,7 @@ def test_get_cached_content(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2043,9 +2063,10 @@ def test_get_cached_content_non_empty_request_with_auto_populated_field(): client.get_cached_content(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cache_service.GetCachedContentRequest( + request_msg = cache_service.GetCachedContentRequest( name="name_value", ) + assert args[0] == request_msg def test_get_cached_content_use_cached_wrapped_rpc(): @@ -2130,9 +2151,14 @@ async def test_get_cached_content_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_cached_content_async( - transport: str = "grpc_asyncio", request_type=cache_service.GetCachedContentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cache_service.GetCachedContentRequest(), + {}, + ], +) +async def test_get_cached_content_async(request_type, transport: str = "grpc_asyncio"): client = CacheServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2140,7 +2166,7 @@ async def test_get_cached_content_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( @@ -2169,11 +2195,6 @@ async def test_get_cached_content_async( assert response.model == "model_value" -@pytest.mark.asyncio -async def test_get_cached_content_async_from_dict(): - await test_get_cached_content_async(request_type=dict) - - def test_get_cached_content_field_headers(): client = CacheServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2328,8 +2349,8 @@ async def test_get_cached_content_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cache_service.UpdateCachedContentRequest, - dict, + cache_service.UpdateCachedContentRequest(), + {}, ], ) def test_update_cached_content(request_type, transport: str = "grpc"): @@ -2340,7 +2361,7 @@ def test_update_cached_content(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2390,7 +2411,8 @@ def test_update_cached_content_non_empty_request_with_auto_populated_field(): client.update_cached_content(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cache_service.UpdateCachedContentRequest() + request_msg = cache_service.UpdateCachedContentRequest() + assert args[0] == request_msg def test_update_cached_content_use_cached_wrapped_rpc(): @@ -2476,9 +2498,15 @@ async def test_update_cached_content_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cache_service.UpdateCachedContentRequest(), + {}, + ], +) async def test_update_cached_content_async( - transport: str = "grpc_asyncio", - request_type=cache_service.UpdateCachedContentRequest, + request_type, transport: str = "grpc_asyncio" ): client = CacheServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2487,7 +2515,7 @@ async def test_update_cached_content_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( @@ -2516,11 +2544,6 @@ async def test_update_cached_content_async( assert response.model == "model_value" -@pytest.mark.asyncio -async def test_update_cached_content_async_from_dict(): - await test_update_cached_content_async(request_type=dict) - - def test_update_cached_content_field_headers(): client = CacheServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2697,8 +2720,8 @@ async def test_update_cached_content_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cache_service.DeleteCachedContentRequest, - dict, + cache_service.DeleteCachedContentRequest(), + {}, ], ) def test_delete_cached_content(request_type, transport: str = "grpc"): @@ -2709,7 +2732,7 @@ def test_delete_cached_content(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2754,9 +2777,10 @@ def test_delete_cached_content_non_empty_request_with_auto_populated_field(): client.delete_cached_content(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cache_service.DeleteCachedContentRequest( + request_msg = cache_service.DeleteCachedContentRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_cached_content_use_cached_wrapped_rpc(): @@ -2842,9 +2866,15 @@ async def test_delete_cached_content_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cache_service.DeleteCachedContentRequest(), + {}, + ], +) async def test_delete_cached_content_async( - transport: str = "grpc_asyncio", - request_type=cache_service.DeleteCachedContentRequest, + request_type, transport: str = "grpc_asyncio" ): client = CacheServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2853,7 +2883,7 @@ async def test_delete_cached_content_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( @@ -2873,11 +2903,6 @@ async def test_delete_cached_content_async( assert response is None -@pytest.mark.asyncio -async def test_delete_cached_content_async_from_dict(): - await test_delete_cached_content_async(request_type=dict) - - def test_delete_cached_content_field_headers(): client = CacheServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3977,7 +4002,6 @@ def test_list_cached_contents_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cache_service.ListCachedContentsRequest() - assert args[0] == request_msg @@ -4000,7 +4024,6 @@ def test_create_cached_content_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cache_service.CreateCachedContentRequest() - assert args[0] == request_msg @@ -4023,7 +4046,6 @@ def test_get_cached_content_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cache_service.GetCachedContentRequest() - assert args[0] == request_msg @@ -4046,7 +4068,6 @@ def test_update_cached_content_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cache_service.UpdateCachedContentRequest() - assert args[0] == request_msg @@ -4069,7 +4090,6 @@ def test_delete_cached_content_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cache_service.DeleteCachedContentRequest() - assert args[0] == request_msg @@ -4112,7 +4132,6 @@ async def test_list_cached_contents_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cache_service.ListCachedContentsRequest() - assert args[0] == request_msg @@ -4143,7 +4162,6 @@ async def test_create_cached_content_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cache_service.CreateCachedContentRequest() - assert args[0] == request_msg @@ -4174,7 +4192,6 @@ async def test_get_cached_content_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cache_service.GetCachedContentRequest() - assert args[0] == request_msg @@ -4205,7 +4222,6 @@ async def test_update_cached_content_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cache_service.UpdateCachedContentRequest() - assert args[0] == request_msg @@ -4230,7 +4246,6 @@ async def test_delete_cached_content_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cache_service.DeleteCachedContentRequest() - assert args[0] == request_msg @@ -5333,7 +5348,6 @@ def test_list_cached_contents_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cache_service.ListCachedContentsRequest() - assert args[0] == request_msg @@ -5355,7 +5369,6 @@ def test_create_cached_content_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cache_service.CreateCachedContentRequest() - assert args[0] == request_msg @@ -5377,7 +5390,6 @@ def test_get_cached_content_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cache_service.GetCachedContentRequest() - assert args[0] == request_msg @@ -5399,7 +5411,6 @@ def test_update_cached_content_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cache_service.UpdateCachedContentRequest() - assert args[0] == request_msg @@ -5421,7 +5432,6 @@ def test_delete_cached_content_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cache_service.DeleteCachedContentRequest() - assert args[0] == request_msg diff --git a/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1alpha/test_discuss_service.py b/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1alpha/test_discuss_service.py index 38df73b03305..98367369c6b6 100644 --- a/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1alpha/test_discuss_service.py +++ b/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1alpha/test_discuss_service.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 @@ -107,6 +108,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" @@ -1310,8 +1326,8 @@ def test_discuss_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - discuss_service.GenerateMessageRequest, - dict, + discuss_service.GenerateMessageRequest(), + {}, ], ) def test_generate_message(request_type, transport: str = "grpc"): @@ -1322,7 +1338,7 @@ def test_generate_message(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.generate_message), "__call__") as call: @@ -1363,9 +1379,10 @@ def test_generate_message_non_empty_request_with_auto_populated_field(): client.generate_message(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == discuss_service.GenerateMessageRequest( + request_msg = discuss_service.GenerateMessageRequest( model="model_value", ) + assert args[0] == request_msg def test_generate_message_use_cached_wrapped_rpc(): @@ -1448,9 +1465,14 @@ async def test_generate_message_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_generate_message_async( - transport: str = "grpc_asyncio", request_type=discuss_service.GenerateMessageRequest -): +@pytest.mark.parametrize( + "request_type", + [ + discuss_service.GenerateMessageRequest(), + {}, + ], +) +async def test_generate_message_async(request_type, transport: str = "grpc_asyncio"): client = DiscussServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1458,7 +1480,7 @@ async def test_generate_message_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.generate_message), "__call__") as call: @@ -1478,11 +1500,6 @@ async def test_generate_message_async( assert isinstance(response, discuss_service.GenerateMessageResponse) -@pytest.mark.asyncio -async def test_generate_message_async_from_dict(): - await test_generate_message_async(request_type=dict) - - def test_generate_message_field_headers(): client = DiscussServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1671,8 +1688,8 @@ async def test_generate_message_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - discuss_service.CountMessageTokensRequest, - dict, + discuss_service.CountMessageTokensRequest(), + {}, ], ) def test_count_message_tokens(request_type, transport: str = "grpc"): @@ -1683,7 +1700,7 @@ def test_count_message_tokens(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1731,9 +1748,10 @@ def test_count_message_tokens_non_empty_request_with_auto_populated_field(): client.count_message_tokens(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == discuss_service.CountMessageTokensRequest( + request_msg = discuss_service.CountMessageTokensRequest( model="model_value", ) + assert args[0] == request_msg def test_count_message_tokens_use_cached_wrapped_rpc(): @@ -1818,9 +1836,15 @@ async def test_count_message_tokens_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + discuss_service.CountMessageTokensRequest(), + {}, + ], +) async def test_count_message_tokens_async( - transport: str = "grpc_asyncio", - request_type=discuss_service.CountMessageTokensRequest, + request_type, transport: str = "grpc_asyncio" ): client = DiscussServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1829,7 +1853,7 @@ async def test_count_message_tokens_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( @@ -1854,11 +1878,6 @@ async def test_count_message_tokens_async( assert response.token_count == 1193 -@pytest.mark.asyncio -async def test_count_message_tokens_async_from_dict(): - await test_count_message_tokens_async(request_type=dict) - - def test_count_message_tokens_field_headers(): client = DiscussServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2533,7 +2552,6 @@ def test_generate_message_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = discuss_service.GenerateMessageRequest() - assert args[0] == request_msg @@ -2556,7 +2574,6 @@ def test_count_message_tokens_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = discuss_service.CountMessageTokensRequest() - assert args[0] == request_msg @@ -2595,7 +2612,6 @@ async def test_generate_message_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = discuss_service.GenerateMessageRequest() - assert args[0] == request_msg @@ -2624,7 +2640,6 @@ async def test_count_message_tokens_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = discuss_service.CountMessageTokensRequest() - assert args[0] == request_msg @@ -3051,7 +3066,6 @@ def test_generate_message_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = discuss_service.GenerateMessageRequest() - assert args[0] == request_msg @@ -3073,7 +3087,6 @@ def test_count_message_tokens_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = discuss_service.CountMessageTokensRequest() - assert args[0] == request_msg diff --git a/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1alpha/test_file_service.py b/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1alpha/test_file_service.py index 3b68a87abe42..f6e03876a39d 100644 --- a/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1alpha/test_file_service.py +++ b/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1alpha/test_file_service.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" @@ -1277,8 +1293,8 @@ def test_file_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - file_service.CreateFileRequest, - dict, + file_service.CreateFileRequest(), + {}, ], ) def test_create_file(request_type, transport: str = "grpc"): @@ -1289,7 +1305,7 @@ def test_create_file(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_file), "__call__") as call: @@ -1328,7 +1344,8 @@ def test_create_file_non_empty_request_with_auto_populated_field(): client.create_file(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == file_service.CreateFileRequest() + request_msg = file_service.CreateFileRequest() + assert args[0] == request_msg def test_create_file_use_cached_wrapped_rpc(): @@ -1409,9 +1426,14 @@ async def test_create_file_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_file_async( - transport: str = "grpc_asyncio", request_type=file_service.CreateFileRequest -): +@pytest.mark.parametrize( + "request_type", + [ + file_service.CreateFileRequest(), + {}, + ], +) +async def test_create_file_async(request_type, transport: str = "grpc_asyncio"): client = FileServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1419,7 +1441,7 @@ async def test_create_file_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_file), "__call__") as call: @@ -1439,16 +1461,11 @@ async def test_create_file_async( assert isinstance(response, file_service.CreateFileResponse) -@pytest.mark.asyncio -async def test_create_file_async_from_dict(): - await test_create_file_async(request_type=dict) - - @pytest.mark.parametrize( "request_type", [ - file_service.ListFilesRequest, - dict, + file_service.ListFilesRequest(), + {}, ], ) def test_list_files(request_type, transport: str = "grpc"): @@ -1459,7 +1476,7 @@ def test_list_files(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_files), "__call__") as call: @@ -1503,9 +1520,10 @@ def test_list_files_non_empty_request_with_auto_populated_field(): client.list_files(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == file_service.ListFilesRequest( + request_msg = file_service.ListFilesRequest( page_token="page_token_value", ) + assert args[0] == request_msg def test_list_files_use_cached_wrapped_rpc(): @@ -1584,9 +1602,14 @@ async def test_list_files_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_list_files_async( - transport: str = "grpc_asyncio", request_type=file_service.ListFilesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + file_service.ListFilesRequest(), + {}, + ], +) +async def test_list_files_async(request_type, transport: str = "grpc_asyncio"): client = FileServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1594,7 +1617,7 @@ async def test_list_files_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_files), "__call__") as call: @@ -1617,11 +1640,6 @@ async def test_list_files_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_files_async_from_dict(): - await test_list_files_async(request_type=dict) - - def test_list_files_pager(transport_name: str = "grpc"): client = FileServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1812,8 +1830,8 @@ async def test_list_files_async_pages(): @pytest.mark.parametrize( "request_type", [ - file_service.GetFileRequest, - dict, + file_service.GetFileRequest(), + {}, ], ) def test_get_file(request_type, transport: str = "grpc"): @@ -1824,7 +1842,7 @@ def test_get_file(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_file), "__call__") as call: @@ -1880,9 +1898,10 @@ def test_get_file_non_empty_request_with_auto_populated_field(): client.get_file(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == file_service.GetFileRequest( + request_msg = file_service.GetFileRequest( name="name_value", ) + assert args[0] == request_msg def test_get_file_use_cached_wrapped_rpc(): @@ -1961,9 +1980,14 @@ async def test_get_file_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn @pytest.mark.asyncio -async def test_get_file_async( - transport: str = "grpc_asyncio", request_type=file_service.GetFileRequest -): +@pytest.mark.parametrize( + "request_type", + [ + file_service.GetFileRequest(), + {}, + ], +) +async def test_get_file_async(request_type, transport: str = "grpc_asyncio"): client = FileServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1971,7 +1995,7 @@ async def test_get_file_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_file), "__call__") as call: @@ -2006,11 +2030,6 @@ async def test_get_file_async( assert response.state == file.File.State.PROCESSING -@pytest.mark.asyncio -async def test_get_file_async_from_dict(): - await test_get_file_async(request_type=dict) - - def test_get_file_field_headers(): client = FileServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2153,8 +2172,8 @@ async def test_get_file_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - file_service.DeleteFileRequest, - dict, + file_service.DeleteFileRequest(), + {}, ], ) def test_delete_file(request_type, transport: str = "grpc"): @@ -2165,7 +2184,7 @@ def test_delete_file(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_file), "__call__") as call: @@ -2206,9 +2225,10 @@ def test_delete_file_non_empty_request_with_auto_populated_field(): client.delete_file(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == file_service.DeleteFileRequest( + request_msg = file_service.DeleteFileRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_file_use_cached_wrapped_rpc(): @@ -2289,9 +2309,14 @@ async def test_delete_file_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_file_async( - transport: str = "grpc_asyncio", request_type=file_service.DeleteFileRequest -): +@pytest.mark.parametrize( + "request_type", + [ + file_service.DeleteFileRequest(), + {}, + ], +) +async def test_delete_file_async(request_type, transport: str = "grpc_asyncio"): client = FileServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2299,7 +2324,7 @@ async def test_delete_file_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_file), "__call__") as call: @@ -2317,11 +2342,6 @@ async def test_delete_file_async( assert response is None -@pytest.mark.asyncio -async def test_delete_file_async_from_dict(): - await test_delete_file_async(request_type=dict) - - def test_delete_file_field_headers(): client = FileServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3060,7 +3080,6 @@ def test_create_file_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = file_service.CreateFileRequest() - assert args[0] == request_msg @@ -3081,7 +3100,6 @@ def test_list_files_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = file_service.ListFilesRequest() - assert args[0] == request_msg @@ -3102,7 +3120,6 @@ def test_get_file_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = file_service.GetFileRequest() - assert args[0] == request_msg @@ -3123,7 +3140,6 @@ def test_delete_file_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = file_service.DeleteFileRequest() - assert args[0] == request_msg @@ -3162,7 +3178,6 @@ async def test_create_file_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = file_service.CreateFileRequest() - assert args[0] == request_msg @@ -3189,7 +3204,6 @@ async def test_list_files_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = file_service.ListFilesRequest() - assert args[0] == request_msg @@ -3222,7 +3236,6 @@ async def test_get_file_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = file_service.GetFileRequest() - assert args[0] == request_msg @@ -3245,7 +3258,6 @@ async def test_delete_file_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = file_service.DeleteFileRequest() - assert args[0] == request_msg @@ -3898,7 +3910,6 @@ def test_create_file_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = file_service.CreateFileRequest() - assert args[0] == request_msg @@ -3918,7 +3929,6 @@ def test_list_files_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = file_service.ListFilesRequest() - assert args[0] == request_msg @@ -3938,7 +3948,6 @@ def test_get_file_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = file_service.GetFileRequest() - assert args[0] == request_msg @@ -3958,7 +3967,6 @@ def test_delete_file_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = file_service.DeleteFileRequest() - assert args[0] == request_msg diff --git a/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1alpha/test_generative_service.py b/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1alpha/test_generative_service.py index aa14188714f4..c0521963447e 100644 --- a/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1alpha/test_generative_service.py +++ b/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1alpha/test_generative_service.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 @@ -114,6 +115,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" @@ -1355,8 +1371,8 @@ def test_generative_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - generative_service.GenerateContentRequest, - dict, + generative_service.GenerateContentRequest(), + {}, ], ) def test_generate_content(request_type, transport: str = "grpc"): @@ -1367,7 +1383,7 @@ def test_generate_content(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.generate_content), "__call__") as call: @@ -1412,10 +1428,11 @@ def test_generate_content_non_empty_request_with_auto_populated_field(): client.generate_content(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == generative_service.GenerateContentRequest( + request_msg = generative_service.GenerateContentRequest( model="model_value", cached_content="cached_content_value", ) + assert args[0] == request_msg def test_generate_content_use_cached_wrapped_rpc(): @@ -1498,10 +1515,14 @@ async def test_generate_content_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_generate_content_async( - transport: str = "grpc_asyncio", - request_type=generative_service.GenerateContentRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + generative_service.GenerateContentRequest(), + {}, + ], +) +async def test_generate_content_async(request_type, transport: str = "grpc_asyncio"): client = GenerativeServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1509,7 +1530,7 @@ async def test_generate_content_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.generate_content), "__call__") as call: @@ -1532,11 +1553,6 @@ async def test_generate_content_async( assert response.model_version == "model_version_value" -@pytest.mark.asyncio -async def test_generate_content_async_from_dict(): - await test_generate_content_async(request_type=dict) - - def test_generate_content_field_headers(): client = GenerativeServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1693,8 +1709,8 @@ async def test_generate_content_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - generative_service.GenerateAnswerRequest, - dict, + generative_service.GenerateAnswerRequest(), + {}, ], ) def test_generate_answer(request_type, transport: str = "grpc"): @@ -1705,7 +1721,7 @@ def test_generate_answer(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.generate_answer), "__call__") as call: @@ -1749,9 +1765,10 @@ def test_generate_answer_non_empty_request_with_auto_populated_field(): client.generate_answer(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == generative_service.GenerateAnswerRequest( + request_msg = generative_service.GenerateAnswerRequest( model="model_value", ) + assert args[0] == request_msg def test_generate_answer_use_cached_wrapped_rpc(): @@ -1832,10 +1849,14 @@ async def test_generate_answer_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_generate_answer_async( - transport: str = "grpc_asyncio", - request_type=generative_service.GenerateAnswerRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + generative_service.GenerateAnswerRequest(), + {}, + ], +) +async def test_generate_answer_async(request_type, transport: str = "grpc_asyncio"): client = GenerativeServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1843,7 +1864,7 @@ async def test_generate_answer_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.generate_answer), "__call__") as call: @@ -1866,11 +1887,6 @@ async def test_generate_answer_async( assert math.isclose(response.answerable_probability, 0.234, rel_tol=1e-6) -@pytest.mark.asyncio -async def test_generate_answer_async_from_dict(): - await test_generate_answer_async(request_type=dict) - - def test_generate_answer_field_headers(): client = GenerativeServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2067,8 +2083,8 @@ async def test_generate_answer_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - generative_service.GenerateContentRequest, - dict, + generative_service.GenerateContentRequest(), + {}, ], ) def test_stream_generate_content(request_type, transport: str = "grpc"): @@ -2079,7 +2095,7 @@ def test_stream_generate_content(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2126,10 +2142,11 @@ def test_stream_generate_content_non_empty_request_with_auto_populated_field(): client.stream_generate_content(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == generative_service.GenerateContentRequest( + request_msg = generative_service.GenerateContentRequest( model="model_value", cached_content="cached_content_value", ) + assert args[0] == request_msg def test_stream_generate_content_use_cached_wrapped_rpc(): @@ -2215,9 +2232,15 @@ async def test_stream_generate_content_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + generative_service.GenerateContentRequest(), + {}, + ], +) async def test_stream_generate_content_async( - transport: str = "grpc_asyncio", - request_type=generative_service.GenerateContentRequest, + request_type, transport: str = "grpc_asyncio" ): client = GenerativeServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2226,7 +2249,7 @@ async def test_stream_generate_content_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( @@ -2250,11 +2273,6 @@ async def test_stream_generate_content_async( assert isinstance(message, generative_service.GenerateContentResponse) -@pytest.mark.asyncio -async def test_stream_generate_content_async_from_dict(): - await test_stream_generate_content_async(request_type=dict) - - def test_stream_generate_content_field_headers(): client = GenerativeServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2418,8 +2436,8 @@ async def test_stream_generate_content_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - generative_service.EmbedContentRequest, - dict, + generative_service.EmbedContentRequest(), + {}, ], ) def test_embed_content(request_type, transport: str = "grpc"): @@ -2430,7 +2448,7 @@ def test_embed_content(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.embed_content), "__call__") as call: @@ -2472,10 +2490,11 @@ def test_embed_content_non_empty_request_with_auto_populated_field(): client.embed_content(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == generative_service.EmbedContentRequest( + request_msg = generative_service.EmbedContentRequest( model="model_value", title="title_value", ) + assert args[0] == request_msg def test_embed_content_use_cached_wrapped_rpc(): @@ -2556,9 +2575,14 @@ async def test_embed_content_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_embed_content_async( - transport: str = "grpc_asyncio", request_type=generative_service.EmbedContentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + generative_service.EmbedContentRequest(), + {}, + ], +) +async def test_embed_content_async(request_type, transport: str = "grpc_asyncio"): client = GenerativeServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2566,7 +2590,7 @@ async def test_embed_content_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.embed_content), "__call__") as call: @@ -2586,11 +2610,6 @@ async def test_embed_content_async( assert isinstance(response, generative_service.EmbedContentResponse) -@pytest.mark.asyncio -async def test_embed_content_async_from_dict(): - await test_embed_content_async(request_type=dict) - - def test_embed_content_field_headers(): client = GenerativeServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2747,8 +2766,8 @@ async def test_embed_content_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - generative_service.BatchEmbedContentsRequest, - dict, + generative_service.BatchEmbedContentsRequest(), + {}, ], ) def test_batch_embed_contents(request_type, transport: str = "grpc"): @@ -2759,7 +2778,7 @@ def test_batch_embed_contents(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2804,9 +2823,10 @@ def test_batch_embed_contents_non_empty_request_with_auto_populated_field(): client.batch_embed_contents(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == generative_service.BatchEmbedContentsRequest( + request_msg = generative_service.BatchEmbedContentsRequest( model="model_value", ) + assert args[0] == request_msg def test_batch_embed_contents_use_cached_wrapped_rpc(): @@ -2891,9 +2911,15 @@ async def test_batch_embed_contents_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + generative_service.BatchEmbedContentsRequest(), + {}, + ], +) async def test_batch_embed_contents_async( - transport: str = "grpc_asyncio", - request_type=generative_service.BatchEmbedContentsRequest, + request_type, transport: str = "grpc_asyncio" ): client = GenerativeServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2902,7 +2928,7 @@ async def test_batch_embed_contents_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( @@ -2924,11 +2950,6 @@ async def test_batch_embed_contents_async( assert isinstance(response, generative_service.BatchEmbedContentsResponse) -@pytest.mark.asyncio -async def test_batch_embed_contents_async_from_dict(): - await test_batch_embed_contents_async(request_type=dict) - - def test_batch_embed_contents_field_headers(): client = GenerativeServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3093,8 +3114,8 @@ async def test_batch_embed_contents_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - generative_service.CountTokensRequest, - dict, + generative_service.CountTokensRequest(), + {}, ], ) def test_count_tokens(request_type, transport: str = "grpc"): @@ -3105,7 +3126,7 @@ def test_count_tokens(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.count_tokens), "__call__") as call: @@ -3151,9 +3172,10 @@ def test_count_tokens_non_empty_request_with_auto_populated_field(): client.count_tokens(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == generative_service.CountTokensRequest( + request_msg = generative_service.CountTokensRequest( model="model_value", ) + assert args[0] == request_msg def test_count_tokens_use_cached_wrapped_rpc(): @@ -3234,9 +3256,14 @@ async def test_count_tokens_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_count_tokens_async( - transport: str = "grpc_asyncio", request_type=generative_service.CountTokensRequest -): +@pytest.mark.parametrize( + "request_type", + [ + generative_service.CountTokensRequest(), + {}, + ], +) +async def test_count_tokens_async(request_type, transport: str = "grpc_asyncio"): client = GenerativeServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3244,7 +3271,7 @@ async def test_count_tokens_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.count_tokens), "__call__") as call: @@ -3269,11 +3296,6 @@ async def test_count_tokens_async( assert response.cached_content_token_count == 2746 -@pytest.mark.asyncio -async def test_count_tokens_async_from_dict(): - await test_count_tokens_async(request_type=dict) - - def test_count_tokens_field_headers(): client = GenerativeServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3430,8 +3452,8 @@ async def test_count_tokens_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - generative_service.BidiGenerateContentClientMessage, - dict, + generative_service.BidiGenerateContentClientMessage(), + {}, ], ) def test_bidi_generate_content(request_type, transport: str = "grpc"): @@ -3442,7 +3464,7 @@ def test_bidi_generate_content(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as 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. @@ -3548,9 +3570,15 @@ async def test_bidi_generate_content_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + generative_service.BidiGenerateContentClientMessage(), + {}, + ], +) async def test_bidi_generate_content_async( - transport: str = "grpc_asyncio", - request_type=generative_service.BidiGenerateContentClientMessage, + request_type, transport: str = "grpc_asyncio" ): client = GenerativeServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3559,7 +3587,7 @@ async def test_bidi_generate_content_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. @@ -3583,11 +3611,6 @@ async def test_bidi_generate_content_async( assert isinstance(message, generative_service.BidiGenerateContentServerMessage) -@pytest.mark.asyncio -async def test_bidi_generate_content_async_from_dict(): - await test_bidi_generate_content_async(request_type=dict) - - def test_generate_content_rest_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, # instead of constructing them on each call @@ -4886,7 +4909,6 @@ def test_generate_content_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generative_service.GenerateContentRequest() - assert args[0] == request_msg @@ -4907,7 +4929,6 @@ def test_generate_answer_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generative_service.GenerateAnswerRequest() - assert args[0] == request_msg @@ -4930,7 +4951,6 @@ def test_stream_generate_content_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generative_service.GenerateContentRequest() - assert args[0] == request_msg @@ -4951,7 +4971,6 @@ def test_embed_content_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generative_service.EmbedContentRequest() - assert args[0] == request_msg @@ -4974,7 +4993,6 @@ def test_batch_embed_contents_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generative_service.BatchEmbedContentsRequest() - assert args[0] == request_msg @@ -4995,7 +5013,6 @@ def test_count_tokens_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generative_service.CountTokensRequest() - assert args[0] == request_msg @@ -5036,7 +5053,6 @@ async def test_generate_content_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generative_service.GenerateContentRequest() - assert args[0] == request_msg @@ -5063,7 +5079,6 @@ async def test_generate_answer_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generative_service.GenerateAnswerRequest() - assert args[0] == request_msg @@ -5091,7 +5106,6 @@ async def test_stream_generate_content_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generative_service.GenerateContentRequest() - assert args[0] == request_msg @@ -5116,7 +5130,6 @@ async def test_embed_content_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generative_service.EmbedContentRequest() - assert args[0] == request_msg @@ -5143,7 +5156,6 @@ async def test_batch_embed_contents_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generative_service.BatchEmbedContentsRequest() - assert args[0] == request_msg @@ -5171,7 +5183,6 @@ async def test_count_tokens_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generative_service.CountTokensRequest() - assert args[0] == request_msg @@ -6157,7 +6168,6 @@ def test_generate_content_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generative_service.GenerateContentRequest() - assert args[0] == request_msg @@ -6177,7 +6187,6 @@ def test_generate_answer_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generative_service.GenerateAnswerRequest() - assert args[0] == request_msg @@ -6199,7 +6208,6 @@ def test_stream_generate_content_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generative_service.GenerateContentRequest() - assert args[0] == request_msg @@ -6219,7 +6227,6 @@ def test_embed_content_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generative_service.EmbedContentRequest() - assert args[0] == request_msg @@ -6241,7 +6248,6 @@ def test_batch_embed_contents_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generative_service.BatchEmbedContentsRequest() - assert args[0] == request_msg @@ -6261,7 +6267,6 @@ def test_count_tokens_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generative_service.CountTokensRequest() - assert args[0] == request_msg diff --git a/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1alpha/test_model_service.py b/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1alpha/test_model_service.py index 21bc9e4bbaea..b523c58dcb4a 100644 --- a/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1alpha/test_model_service.py +++ b/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1alpha/test_model_service.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 @@ -115,6 +116,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" @@ -1295,8 +1311,8 @@ def test_model_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - model_service.GetModelRequest, - dict, + model_service.GetModelRequest(), + {}, ], ) def test_get_model(request_type, transport: str = "grpc"): @@ -1307,7 +1323,7 @@ def test_get_model(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_model), "__call__") as call: @@ -1375,9 +1391,10 @@ def test_get_model_non_empty_request_with_auto_populated_field(): client.get_model(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == model_service.GetModelRequest( + request_msg = model_service.GetModelRequest( name="name_value", ) + assert args[0] == request_msg def test_get_model_use_cached_wrapped_rpc(): @@ -1456,9 +1473,14 @@ async def test_get_model_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_model_async( - transport: str = "grpc_asyncio", request_type=model_service.GetModelRequest -): +@pytest.mark.parametrize( + "request_type", + [ + model_service.GetModelRequest(), + {}, + ], +) +async def test_get_model_async(request_type, transport: str = "grpc_asyncio"): client = ModelServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1466,7 +1488,7 @@ async def test_get_model_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_model), "__call__") as call: @@ -1513,11 +1535,6 @@ async def test_get_model_async( assert response.top_k == 541 -@pytest.mark.asyncio -async def test_get_model_async_from_dict(): - await test_get_model_async(request_type=dict) - - def test_get_model_field_headers(): client = ModelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1660,8 +1677,8 @@ async def test_get_model_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - model_service.ListModelsRequest, - dict, + model_service.ListModelsRequest(), + {}, ], ) def test_list_models(request_type, transport: str = "grpc"): @@ -1672,7 +1689,7 @@ def test_list_models(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_models), "__call__") as call: @@ -1716,9 +1733,10 @@ def test_list_models_non_empty_request_with_auto_populated_field(): client.list_models(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == model_service.ListModelsRequest( + request_msg = model_service.ListModelsRequest( page_token="page_token_value", ) + assert args[0] == request_msg def test_list_models_use_cached_wrapped_rpc(): @@ -1799,9 +1817,14 @@ async def test_list_models_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_models_async( - transport: str = "grpc_asyncio", request_type=model_service.ListModelsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + model_service.ListModelsRequest(), + {}, + ], +) +async def test_list_models_async(request_type, transport: str = "grpc_asyncio"): client = ModelServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1809,7 +1832,7 @@ async def test_list_models_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_models), "__call__") as call: @@ -1832,11 +1855,6 @@ async def test_list_models_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_models_async_from_dict(): - await test_list_models_async(request_type=dict) - - def test_list_models_flattened(): client = ModelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2119,8 +2137,8 @@ async def test_list_models_async_pages(): @pytest.mark.parametrize( "request_type", [ - model_service.GetTunedModelRequest, - dict, + model_service.GetTunedModelRequest(), + {}, ], ) def test_get_tuned_model(request_type, transport: str = "grpc"): @@ -2131,7 +2149,7 @@ def test_get_tuned_model(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tuned_model), "__call__") as call: @@ -2190,9 +2208,10 @@ def test_get_tuned_model_non_empty_request_with_auto_populated_field(): client.get_tuned_model(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == model_service.GetTunedModelRequest( + request_msg = model_service.GetTunedModelRequest( name="name_value", ) + assert args[0] == request_msg def test_get_tuned_model_use_cached_wrapped_rpc(): @@ -2273,9 +2292,14 @@ async def test_get_tuned_model_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_tuned_model_async( - transport: str = "grpc_asyncio", request_type=model_service.GetTunedModelRequest -): +@pytest.mark.parametrize( + "request_type", + [ + model_service.GetTunedModelRequest(), + {}, + ], +) +async def test_get_tuned_model_async(request_type, transport: str = "grpc_asyncio"): client = ModelServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2283,7 +2307,7 @@ async def test_get_tuned_model_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_tuned_model), "__call__") as call: @@ -2320,11 +2344,6 @@ async def test_get_tuned_model_async( assert response.reader_project_numbers == [2340] -@pytest.mark.asyncio -async def test_get_tuned_model_async_from_dict(): - await test_get_tuned_model_async(request_type=dict) - - def test_get_tuned_model_field_headers(): client = ModelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2471,8 +2490,8 @@ async def test_get_tuned_model_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - model_service.ListTunedModelsRequest, - dict, + model_service.ListTunedModelsRequest(), + {}, ], ) def test_list_tuned_models(request_type, transport: str = "grpc"): @@ -2483,7 +2502,7 @@ def test_list_tuned_models(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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 +2551,11 @@ def test_list_tuned_models_non_empty_request_with_auto_populated_field(): client.list_tuned_models(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == model_service.ListTunedModelsRequest( + request_msg = model_service.ListTunedModelsRequest( page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_tuned_models_use_cached_wrapped_rpc(): @@ -2618,9 +2638,14 @@ async def test_list_tuned_models_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_tuned_models_async( - transport: str = "grpc_asyncio", request_type=model_service.ListTunedModelsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + model_service.ListTunedModelsRequest(), + {}, + ], +) +async def test_list_tuned_models_async(request_type, transport: str = "grpc_asyncio"): client = ModelServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2628,7 +2653,7 @@ async def test_list_tuned_models_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( @@ -2653,11 +2678,6 @@ async def test_list_tuned_models_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_tuned_models_async_from_dict(): - await test_list_tuned_models_async(request_type=dict) - - def test_list_tuned_models_flattened(): client = ModelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2952,8 +2972,8 @@ async def test_list_tuned_models_async_pages(): @pytest.mark.parametrize( "request_type", [ - model_service.CreateTunedModelRequest, - dict, + model_service.CreateTunedModelRequest(), + {}, ], ) def test_create_tuned_model(request_type, transport: str = "grpc"): @@ -2964,7 +2984,7 @@ def test_create_tuned_model(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3009,9 +3029,10 @@ def test_create_tuned_model_non_empty_request_with_auto_populated_field(): client.create_tuned_model(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == model_service.CreateTunedModelRequest( + request_msg = model_service.CreateTunedModelRequest( tuned_model_id="tuned_model_id_value", ) + assert args[0] == request_msg def test_create_tuned_model_use_cached_wrapped_rpc(): @@ -3106,9 +3127,14 @@ async def test_create_tuned_model_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_tuned_model_async( - transport: str = "grpc_asyncio", request_type=model_service.CreateTunedModelRequest -): +@pytest.mark.parametrize( + "request_type", + [ + model_service.CreateTunedModelRequest(), + {}, + ], +) +async def test_create_tuned_model_async(request_type, transport: str = "grpc_asyncio"): client = ModelServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3116,7 +3142,7 @@ async def test_create_tuned_model_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( @@ -3138,11 +3164,6 @@ async def test_create_tuned_model_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_tuned_model_async_from_dict(): - await test_create_tuned_model_async(request_type=dict) - - def test_create_tuned_model_flattened(): client = ModelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3266,8 +3287,8 @@ async def test_create_tuned_model_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - model_service.UpdateTunedModelRequest, - dict, + model_service.UpdateTunedModelRequest(), + {}, ], ) def test_update_tuned_model(request_type, transport: str = "grpc"): @@ -3278,7 +3299,7 @@ def test_update_tuned_model(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3339,7 +3360,8 @@ def test_update_tuned_model_non_empty_request_with_auto_populated_field(): client.update_tuned_model(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == model_service.UpdateTunedModelRequest() + request_msg = model_service.UpdateTunedModelRequest() + assert args[0] == request_msg def test_update_tuned_model_use_cached_wrapped_rpc(): @@ -3424,9 +3446,14 @@ async def test_update_tuned_model_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_tuned_model_async( - transport: str = "grpc_asyncio", request_type=model_service.UpdateTunedModelRequest -): +@pytest.mark.parametrize( + "request_type", + [ + model_service.UpdateTunedModelRequest(), + {}, + ], +) +async def test_update_tuned_model_async(request_type, transport: str = "grpc_asyncio"): client = ModelServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3434,7 +3461,7 @@ async def test_update_tuned_model_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( @@ -3473,11 +3500,6 @@ async def test_update_tuned_model_async( assert response.reader_project_numbers == [2340] -@pytest.mark.asyncio -async def test_update_tuned_model_async_from_dict(): - await test_update_tuned_model_async(request_type=dict) - - def test_update_tuned_model_field_headers(): client = ModelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3666,8 +3688,8 @@ async def test_update_tuned_model_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - model_service.DeleteTunedModelRequest, - dict, + model_service.DeleteTunedModelRequest(), + {}, ], ) def test_delete_tuned_model(request_type, transport: str = "grpc"): @@ -3678,7 +3700,7 @@ def test_delete_tuned_model(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3723,9 +3745,10 @@ def test_delete_tuned_model_non_empty_request_with_auto_populated_field(): client.delete_tuned_model(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == model_service.DeleteTunedModelRequest( + request_msg = model_service.DeleteTunedModelRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_tuned_model_use_cached_wrapped_rpc(): @@ -3810,9 +3833,14 @@ async def test_delete_tuned_model_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_tuned_model_async( - transport: str = "grpc_asyncio", request_type=model_service.DeleteTunedModelRequest -): +@pytest.mark.parametrize( + "request_type", + [ + model_service.DeleteTunedModelRequest(), + {}, + ], +) +async def test_delete_tuned_model_async(request_type, transport: str = "grpc_asyncio"): client = ModelServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3820,7 +3848,7 @@ async def test_delete_tuned_model_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( @@ -3840,11 +3868,6 @@ async def test_delete_tuned_model_async( assert response is None -@pytest.mark.asyncio -async def test_delete_tuned_model_async_from_dict(): - await test_delete_tuned_model_async(request_type=dict) - - def test_delete_tuned_model_field_headers(): client = ModelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5330,7 +5353,6 @@ def test_get_model_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.GetModelRequest() - assert args[0] == request_msg @@ -5351,7 +5373,6 @@ def test_list_models_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.ListModelsRequest() - assert args[0] == request_msg @@ -5372,7 +5393,6 @@ def test_get_tuned_model_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.GetTunedModelRequest() - assert args[0] == request_msg @@ -5395,7 +5415,6 @@ def test_list_tuned_models_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.ListTunedModelsRequest() - assert args[0] == request_msg @@ -5418,7 +5437,6 @@ def test_create_tuned_model_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.CreateTunedModelRequest() - assert args[0] == request_msg @@ -5441,7 +5459,6 @@ def test_update_tuned_model_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.UpdateTunedModelRequest() - assert args[0] == request_msg @@ -5464,7 +5481,6 @@ def test_delete_tuned_model_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.DeleteTunedModelRequest() - assert args[0] == request_msg @@ -5516,7 +5532,6 @@ async def test_get_model_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.GetModelRequest() - assert args[0] == request_msg @@ -5543,7 +5558,6 @@ async def test_list_models_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.ListModelsRequest() - assert args[0] == request_msg @@ -5577,7 +5591,6 @@ async def test_get_tuned_model_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.GetTunedModelRequest() - assert args[0] == request_msg @@ -5606,7 +5619,6 @@ async def test_list_tuned_models_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.ListTunedModelsRequest() - assert args[0] == request_msg @@ -5633,7 +5645,6 @@ async def test_create_tuned_model_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.CreateTunedModelRequest() - assert args[0] == request_msg @@ -5669,7 +5680,6 @@ async def test_update_tuned_model_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.UpdateTunedModelRequest() - assert args[0] == request_msg @@ -5694,7 +5704,6 @@ async def test_delete_tuned_model_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.DeleteTunedModelRequest() - assert args[0] == request_msg @@ -7021,7 +7030,6 @@ def test_get_model_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.GetModelRequest() - assert args[0] == request_msg @@ -7041,7 +7049,6 @@ def test_list_models_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.ListModelsRequest() - assert args[0] == request_msg @@ -7061,7 +7068,6 @@ def test_get_tuned_model_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.GetTunedModelRequest() - assert args[0] == request_msg @@ -7083,7 +7089,6 @@ def test_list_tuned_models_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.ListTunedModelsRequest() - assert args[0] == request_msg @@ -7105,7 +7110,6 @@ def test_create_tuned_model_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.CreateTunedModelRequest() - assert args[0] == request_msg @@ -7127,7 +7131,6 @@ def test_update_tuned_model_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.UpdateTunedModelRequest() - assert args[0] == request_msg @@ -7149,7 +7152,6 @@ def test_delete_tuned_model_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.DeleteTunedModelRequest() - assert args[0] == request_msg diff --git a/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1alpha/test_permission_service.py b/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1alpha/test_permission_service.py index 9a5e2686332a..678046ac12fd 100644 --- a/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1alpha/test_permission_service.py +++ b/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1alpha/test_permission_service.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 @@ -110,6 +111,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" @@ -1351,8 +1367,8 @@ def test_permission_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - permission_service.CreatePermissionRequest, - dict, + permission_service.CreatePermissionRequest(), + {}, ], ) def test_create_permission(request_type, transport: str = "grpc"): @@ -1363,7 +1379,7 @@ def test_create_permission(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1417,9 +1433,10 @@ def test_create_permission_non_empty_request_with_auto_populated_field(): client.create_permission(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == permission_service.CreatePermissionRequest( + request_msg = permission_service.CreatePermissionRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_permission_use_cached_wrapped_rpc(): @@ -1502,10 +1519,14 @@ async def test_create_permission_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_permission_async( - transport: str = "grpc_asyncio", - request_type=permission_service.CreatePermissionRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + permission_service.CreatePermissionRequest(), + {}, + ], +) +async def test_create_permission_async(request_type, transport: str = "grpc_asyncio"): client = PermissionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1513,7 +1534,7 @@ async def test_create_permission_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( @@ -1544,11 +1565,6 @@ async def test_create_permission_async( assert response.role == gag_permission.Permission.Role.OWNER -@pytest.mark.asyncio -async def test_create_permission_async_from_dict(): - await test_create_permission_async(request_type=dict) - - def test_create_permission_field_headers(): client = PermissionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1713,8 +1729,8 @@ async def test_create_permission_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - permission_service.GetPermissionRequest, - dict, + permission_service.GetPermissionRequest(), + {}, ], ) def test_get_permission(request_type, transport: str = "grpc"): @@ -1725,7 +1741,7 @@ def test_get_permission(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_permission), "__call__") as call: @@ -1775,9 +1791,10 @@ def test_get_permission_non_empty_request_with_auto_populated_field(): client.get_permission(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == permission_service.GetPermissionRequest( + request_msg = permission_service.GetPermissionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_permission_use_cached_wrapped_rpc(): @@ -1858,10 +1875,14 @@ async def test_get_permission_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_permission_async( - transport: str = "grpc_asyncio", - request_type=permission_service.GetPermissionRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + permission_service.GetPermissionRequest(), + {}, + ], +) +async def test_get_permission_async(request_type, transport: str = "grpc_asyncio"): client = PermissionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1869,7 +1890,7 @@ async def test_get_permission_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_permission), "__call__") as call: @@ -1898,11 +1919,6 @@ async def test_get_permission_async( assert response.role == permission.Permission.Role.OWNER -@pytest.mark.asyncio -async def test_get_permission_async_from_dict(): - await test_get_permission_async(request_type=dict) - - def test_get_permission_field_headers(): client = PermissionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2049,8 +2065,8 @@ async def test_get_permission_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - permission_service.ListPermissionsRequest, - dict, + permission_service.ListPermissionsRequest(), + {}, ], ) def test_list_permissions(request_type, transport: str = "grpc"): @@ -2061,7 +2077,7 @@ def test_list_permissions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_permissions), "__call__") as call: @@ -2106,10 +2122,11 @@ def test_list_permissions_non_empty_request_with_auto_populated_field(): client.list_permissions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == permission_service.ListPermissionsRequest( + request_msg = permission_service.ListPermissionsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_permissions_use_cached_wrapped_rpc(): @@ -2192,10 +2209,14 @@ async def test_list_permissions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_permissions_async( - transport: str = "grpc_asyncio", - request_type=permission_service.ListPermissionsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + permission_service.ListPermissionsRequest(), + {}, + ], +) +async def test_list_permissions_async(request_type, transport: str = "grpc_asyncio"): client = PermissionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2203,7 +2224,7 @@ async def test_list_permissions_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_permissions), "__call__") as call: @@ -2226,11 +2247,6 @@ async def test_list_permissions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_permissions_async_from_dict(): - await test_list_permissions_async(request_type=dict) - - def test_list_permissions_field_headers(): client = PermissionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2567,8 +2583,8 @@ async def test_list_permissions_async_pages(): @pytest.mark.parametrize( "request_type", [ - permission_service.UpdatePermissionRequest, - dict, + permission_service.UpdatePermissionRequest(), + {}, ], ) def test_update_permission(request_type, transport: str = "grpc"): @@ -2579,7 +2595,7 @@ def test_update_permission(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2631,7 +2647,8 @@ def test_update_permission_non_empty_request_with_auto_populated_field(): client.update_permission(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == permission_service.UpdatePermissionRequest() + request_msg = permission_service.UpdatePermissionRequest() + assert args[0] == request_msg def test_update_permission_use_cached_wrapped_rpc(): @@ -2714,10 +2731,14 @@ async def test_update_permission_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_permission_async( - transport: str = "grpc_asyncio", - request_type=permission_service.UpdatePermissionRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + permission_service.UpdatePermissionRequest(), + {}, + ], +) +async def test_update_permission_async(request_type, transport: str = "grpc_asyncio"): client = PermissionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2725,7 +2746,7 @@ async def test_update_permission_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( @@ -2756,11 +2777,6 @@ async def test_update_permission_async( assert response.role == gag_permission.Permission.Role.OWNER -@pytest.mark.asyncio -async def test_update_permission_async_from_dict(): - await test_update_permission_async(request_type=dict) - - def test_update_permission_field_headers(): client = PermissionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2925,8 +2941,8 @@ async def test_update_permission_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - permission_service.DeletePermissionRequest, - dict, + permission_service.DeletePermissionRequest(), + {}, ], ) def test_delete_permission(request_type, transport: str = "grpc"): @@ -2937,7 +2953,7 @@ def test_delete_permission(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2982,9 +2998,10 @@ def test_delete_permission_non_empty_request_with_auto_populated_field(): client.delete_permission(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == permission_service.DeletePermissionRequest( + request_msg = permission_service.DeletePermissionRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_permission_use_cached_wrapped_rpc(): @@ -3067,10 +3084,14 @@ async def test_delete_permission_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_permission_async( - transport: str = "grpc_asyncio", - request_type=permission_service.DeletePermissionRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + permission_service.DeletePermissionRequest(), + {}, + ], +) +async def test_delete_permission_async(request_type, transport: str = "grpc_asyncio"): client = PermissionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3078,7 +3099,7 @@ async def test_delete_permission_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( @@ -3098,11 +3119,6 @@ async def test_delete_permission_async( assert response is None -@pytest.mark.asyncio -async def test_delete_permission_async_from_dict(): - await test_delete_permission_async(request_type=dict) - - def test_delete_permission_field_headers(): client = PermissionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3253,8 +3269,8 @@ async def test_delete_permission_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - permission_service.TransferOwnershipRequest, - dict, + permission_service.TransferOwnershipRequest(), + {}, ], ) def test_transfer_ownership(request_type, transport: str = "grpc"): @@ -3265,7 +3281,7 @@ def test_transfer_ownership(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3311,10 +3327,11 @@ def test_transfer_ownership_non_empty_request_with_auto_populated_field(): client.transfer_ownership(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == permission_service.TransferOwnershipRequest( + request_msg = permission_service.TransferOwnershipRequest( name="name_value", email_address="email_address_value", ) + assert args[0] == request_msg def test_transfer_ownership_use_cached_wrapped_rpc(): @@ -3399,10 +3416,14 @@ async def test_transfer_ownership_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_transfer_ownership_async( - transport: str = "grpc_asyncio", - request_type=permission_service.TransferOwnershipRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + permission_service.TransferOwnershipRequest(), + {}, + ], +) +async def test_transfer_ownership_async(request_type, transport: str = "grpc_asyncio"): client = PermissionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3410,7 +3431,7 @@ async def test_transfer_ownership_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( @@ -3432,11 +3453,6 @@ async def test_transfer_ownership_async( assert isinstance(response, permission_service.TransferOwnershipResponse) -@pytest.mark.asyncio -async def test_transfer_ownership_async_from_dict(): - await test_transfer_ownership_async(request_type=dict) - - def test_transfer_ownership_field_headers(): client = PermissionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4752,7 +4768,6 @@ def test_create_permission_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = permission_service.CreatePermissionRequest() - assert args[0] == request_msg @@ -4773,7 +4788,6 @@ def test_get_permission_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = permission_service.GetPermissionRequest() - assert args[0] == request_msg @@ -4794,7 +4808,6 @@ def test_list_permissions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = permission_service.ListPermissionsRequest() - assert args[0] == request_msg @@ -4817,7 +4830,6 @@ def test_update_permission_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = permission_service.UpdatePermissionRequest() - assert args[0] == request_msg @@ -4840,7 +4852,6 @@ def test_delete_permission_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = permission_service.DeletePermissionRequest() - assert args[0] == request_msg @@ -4863,7 +4874,6 @@ def test_transfer_ownership_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = permission_service.TransferOwnershipRequest() - assert args[0] == request_msg @@ -4909,7 +4919,6 @@ async def test_create_permission_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = permission_service.CreatePermissionRequest() - assert args[0] == request_msg @@ -4939,7 +4948,6 @@ async def test_get_permission_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = permission_service.GetPermissionRequest() - assert args[0] == request_msg @@ -4966,7 +4974,6 @@ async def test_list_permissions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = permission_service.ListPermissionsRequest() - assert args[0] == request_msg @@ -4998,7 +5005,6 @@ async def test_update_permission_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = permission_service.UpdatePermissionRequest() - assert args[0] == request_msg @@ -5023,7 +5029,6 @@ async def test_delete_permission_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = permission_service.DeletePermissionRequest() - assert args[0] == request_msg @@ -5050,7 +5055,6 @@ async def test_transfer_ownership_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = permission_service.TransferOwnershipRequest() - assert args[0] == request_msg @@ -6146,7 +6150,6 @@ def test_create_permission_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = permission_service.CreatePermissionRequest() - assert args[0] == request_msg @@ -6166,7 +6169,6 @@ def test_get_permission_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = permission_service.GetPermissionRequest() - assert args[0] == request_msg @@ -6186,7 +6188,6 @@ def test_list_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = permission_service.ListPermissionsRequest() - assert args[0] == request_msg @@ -6208,7 +6209,6 @@ def test_update_permission_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = permission_service.UpdatePermissionRequest() - assert args[0] == request_msg @@ -6230,7 +6230,6 @@ def test_delete_permission_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = permission_service.DeletePermissionRequest() - assert args[0] == request_msg @@ -6252,7 +6251,6 @@ def test_transfer_ownership_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = permission_service.TransferOwnershipRequest() - assert args[0] == request_msg diff --git a/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1alpha/test_prediction_service.py b/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1alpha/test_prediction_service.py index d190e45189ed..c43420afda10 100644 --- a/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1alpha/test_prediction_service.py +++ b/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1alpha/test_prediction_service.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 @@ -108,6 +109,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" @@ -1349,8 +1365,8 @@ def test_prediction_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - prediction_service.PredictRequest, - dict, + prediction_service.PredictRequest(), + {}, ], ) def test_predict(request_type, transport: str = "grpc"): @@ -1361,7 +1377,7 @@ def test_predict(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.predict), "__call__") as call: @@ -1402,9 +1418,10 @@ def test_predict_non_empty_request_with_auto_populated_field(): client.predict(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == prediction_service.PredictRequest( + request_msg = prediction_service.PredictRequest( model="model_value", ) + assert args[0] == request_msg def test_predict_use_cached_wrapped_rpc(): @@ -1483,9 +1500,14 @@ async def test_predict_async_use_cached_wrapped_rpc(transport: str = "grpc_async @pytest.mark.asyncio -async def test_predict_async( - transport: str = "grpc_asyncio", request_type=prediction_service.PredictRequest -): +@pytest.mark.parametrize( + "request_type", + [ + prediction_service.PredictRequest(), + {}, + ], +) +async def test_predict_async(request_type, transport: str = "grpc_asyncio"): client = PredictionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1493,7 +1515,7 @@ async def test_predict_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.predict), "__call__") as call: @@ -1513,11 +1535,6 @@ async def test_predict_async( assert isinstance(response, prediction_service.PredictResponse) -@pytest.mark.asyncio -async def test_predict_async_from_dict(): - await test_predict_async(request_type=dict) - - def test_predict_field_headers(): client = PredictionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1979,7 +1996,6 @@ def test_predict_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = prediction_service.PredictRequest() - assert args[0] == request_msg @@ -2018,7 +2034,6 @@ async def test_predict_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = prediction_service.PredictRequest() - assert args[0] == request_msg @@ -2303,7 +2318,6 @@ def test_predict_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = prediction_service.PredictRequest() - assert args[0] == request_msg diff --git a/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1alpha/test_retriever_service.py b/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1alpha/test_retriever_service.py index cff87b406b21..7b9c3891acbe 100644 --- a/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1alpha/test_retriever_service.py +++ b/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1alpha/test_retriever_service.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 @@ -110,6 +111,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" @@ -1343,8 +1359,8 @@ def test_retriever_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - retriever_service.CreateCorpusRequest, - dict, + retriever_service.CreateCorpusRequest(), + {}, ], ) def test_create_corpus(request_type, transport: str = "grpc"): @@ -1355,7 +1371,7 @@ def test_create_corpus(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_corpus), "__call__") as call: @@ -1399,7 +1415,8 @@ def test_create_corpus_non_empty_request_with_auto_populated_field(): client.create_corpus(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == retriever_service.CreateCorpusRequest() + request_msg = retriever_service.CreateCorpusRequest() + assert args[0] == request_msg def test_create_corpus_use_cached_wrapped_rpc(): @@ -1480,9 +1497,14 @@ async def test_create_corpus_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_corpus_async( - transport: str = "grpc_asyncio", request_type=retriever_service.CreateCorpusRequest -): +@pytest.mark.parametrize( + "request_type", + [ + retriever_service.CreateCorpusRequest(), + {}, + ], +) +async def test_create_corpus_async(request_type, transport: str = "grpc_asyncio"): client = RetrieverServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1490,7 +1512,7 @@ async def test_create_corpus_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_corpus), "__call__") as call: @@ -1515,11 +1537,6 @@ async def test_create_corpus_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_create_corpus_async_from_dict(): - await test_create_corpus_async(request_type=dict) - - def test_create_corpus_flattened(): client = RetrieverServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1603,8 +1620,8 @@ async def test_create_corpus_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - retriever_service.GetCorpusRequest, - dict, + retriever_service.GetCorpusRequest(), + {}, ], ) def test_get_corpus(request_type, transport: str = "grpc"): @@ -1615,7 +1632,7 @@ def test_get_corpus(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_corpus), "__call__") as call: @@ -1661,9 +1678,10 @@ def test_get_corpus_non_empty_request_with_auto_populated_field(): client.get_corpus(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == retriever_service.GetCorpusRequest( + request_msg = retriever_service.GetCorpusRequest( name="name_value", ) + assert args[0] == request_msg def test_get_corpus_use_cached_wrapped_rpc(): @@ -1742,9 +1760,14 @@ async def test_get_corpus_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_corpus_async( - transport: str = "grpc_asyncio", request_type=retriever_service.GetCorpusRequest -): +@pytest.mark.parametrize( + "request_type", + [ + retriever_service.GetCorpusRequest(), + {}, + ], +) +async def test_get_corpus_async(request_type, transport: str = "grpc_asyncio"): client = RetrieverServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1752,7 +1775,7 @@ async def test_get_corpus_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_corpus), "__call__") as call: @@ -1777,11 +1800,6 @@ async def test_get_corpus_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_get_corpus_async_from_dict(): - await test_get_corpus_async(request_type=dict) - - def test_get_corpus_field_headers(): client = RetrieverServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1924,8 +1942,8 @@ async def test_get_corpus_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - retriever_service.UpdateCorpusRequest, - dict, + retriever_service.UpdateCorpusRequest(), + {}, ], ) def test_update_corpus(request_type, transport: str = "grpc"): @@ -1936,7 +1954,7 @@ def test_update_corpus(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_corpus), "__call__") as call: @@ -1980,7 +1998,8 @@ def test_update_corpus_non_empty_request_with_auto_populated_field(): client.update_corpus(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == retriever_service.UpdateCorpusRequest() + request_msg = retriever_service.UpdateCorpusRequest() + assert args[0] == request_msg def test_update_corpus_use_cached_wrapped_rpc(): @@ -2061,9 +2080,14 @@ async def test_update_corpus_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_corpus_async( - transport: str = "grpc_asyncio", request_type=retriever_service.UpdateCorpusRequest -): +@pytest.mark.parametrize( + "request_type", + [ + retriever_service.UpdateCorpusRequest(), + {}, + ], +) +async def test_update_corpus_async(request_type, transport: str = "grpc_asyncio"): client = RetrieverServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2071,7 +2095,7 @@ async def test_update_corpus_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_corpus), "__call__") as call: @@ -2096,11 +2120,6 @@ async def test_update_corpus_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_update_corpus_async_from_dict(): - await test_update_corpus_async(request_type=dict) - - def test_update_corpus_field_headers(): client = RetrieverServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2253,8 +2272,8 @@ async def test_update_corpus_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - retriever_service.DeleteCorpusRequest, - dict, + retriever_service.DeleteCorpusRequest(), + {}, ], ) def test_delete_corpus(request_type, transport: str = "grpc"): @@ -2265,7 +2284,7 @@ def test_delete_corpus(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_corpus), "__call__") as call: @@ -2306,9 +2325,10 @@ def test_delete_corpus_non_empty_request_with_auto_populated_field(): client.delete_corpus(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == retriever_service.DeleteCorpusRequest( + request_msg = retriever_service.DeleteCorpusRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_corpus_use_cached_wrapped_rpc(): @@ -2389,9 +2409,14 @@ async def test_delete_corpus_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_corpus_async( - transport: str = "grpc_asyncio", request_type=retriever_service.DeleteCorpusRequest -): +@pytest.mark.parametrize( + "request_type", + [ + retriever_service.DeleteCorpusRequest(), + {}, + ], +) +async def test_delete_corpus_async(request_type, transport: str = "grpc_asyncio"): client = RetrieverServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2399,7 +2424,7 @@ async def test_delete_corpus_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_corpus), "__call__") as call: @@ -2417,11 +2442,6 @@ async def test_delete_corpus_async( assert response is None -@pytest.mark.asyncio -async def test_delete_corpus_async_from_dict(): - await test_delete_corpus_async(request_type=dict) - - def test_delete_corpus_field_headers(): client = RetrieverServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2564,8 +2584,8 @@ async def test_delete_corpus_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - retriever_service.ListCorporaRequest, - dict, + retriever_service.ListCorporaRequest(), + {}, ], ) def test_list_corpora(request_type, transport: str = "grpc"): @@ -2576,7 +2596,7 @@ def test_list_corpora(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_corpora), "__call__") as call: @@ -2620,9 +2640,10 @@ def test_list_corpora_non_empty_request_with_auto_populated_field(): client.list_corpora(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == retriever_service.ListCorporaRequest( + request_msg = retriever_service.ListCorporaRequest( page_token="page_token_value", ) + assert args[0] == request_msg def test_list_corpora_use_cached_wrapped_rpc(): @@ -2703,9 +2724,14 @@ async def test_list_corpora_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_corpora_async( - transport: str = "grpc_asyncio", request_type=retriever_service.ListCorporaRequest -): +@pytest.mark.parametrize( + "request_type", + [ + retriever_service.ListCorporaRequest(), + {}, + ], +) +async def test_list_corpora_async(request_type, transport: str = "grpc_asyncio"): client = RetrieverServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2713,7 +2739,7 @@ async def test_list_corpora_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_corpora), "__call__") as call: @@ -2736,11 +2762,6 @@ async def test_list_corpora_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_corpora_async_from_dict(): - await test_list_corpora_async(request_type=dict) - - def test_list_corpora_pager(transport_name: str = "grpc"): client = RetrieverServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2931,8 +2952,8 @@ async def test_list_corpora_async_pages(): @pytest.mark.parametrize( "request_type", [ - retriever_service.QueryCorpusRequest, - dict, + retriever_service.QueryCorpusRequest(), + {}, ], ) def test_query_corpus(request_type, transport: str = "grpc"): @@ -2943,7 +2964,7 @@ def test_query_corpus(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.query_corpus), "__call__") as call: @@ -2985,10 +3006,11 @@ def test_query_corpus_non_empty_request_with_auto_populated_field(): client.query_corpus(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == retriever_service.QueryCorpusRequest( + request_msg = retriever_service.QueryCorpusRequest( name="name_value", query="query_value", ) + assert args[0] == request_msg def test_query_corpus_use_cached_wrapped_rpc(): @@ -3069,9 +3091,14 @@ async def test_query_corpus_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_query_corpus_async( - transport: str = "grpc_asyncio", request_type=retriever_service.QueryCorpusRequest -): +@pytest.mark.parametrize( + "request_type", + [ + retriever_service.QueryCorpusRequest(), + {}, + ], +) +async def test_query_corpus_async(request_type, transport: str = "grpc_asyncio"): client = RetrieverServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3079,7 +3106,7 @@ async def test_query_corpus_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.query_corpus), "__call__") as call: @@ -3099,11 +3126,6 @@ async def test_query_corpus_async( assert isinstance(response, retriever_service.QueryCorpusResponse) -@pytest.mark.asyncio -async def test_query_corpus_async_from_dict(): - await test_query_corpus_async(request_type=dict) - - def test_query_corpus_field_headers(): client = RetrieverServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3168,8 +3190,8 @@ async def test_query_corpus_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - retriever_service.CreateDocumentRequest, - dict, + retriever_service.CreateDocumentRequest(), + {}, ], ) def test_create_document(request_type, transport: str = "grpc"): @@ -3180,7 +3202,7 @@ def test_create_document(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_document), "__call__") as call: @@ -3226,9 +3248,10 @@ def test_create_document_non_empty_request_with_auto_populated_field(): client.create_document(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == retriever_service.CreateDocumentRequest( + request_msg = retriever_service.CreateDocumentRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_document_use_cached_wrapped_rpc(): @@ -3309,10 +3332,14 @@ async def test_create_document_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_document_async( - transport: str = "grpc_asyncio", - request_type=retriever_service.CreateDocumentRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + retriever_service.CreateDocumentRequest(), + {}, + ], +) +async def test_create_document_async(request_type, transport: str = "grpc_asyncio"): client = RetrieverServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3320,7 +3347,7 @@ async def test_create_document_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_document), "__call__") as call: @@ -3345,11 +3372,6 @@ async def test_create_document_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_create_document_async_from_dict(): - await test_create_document_async(request_type=dict) - - def test_create_document_field_headers(): client = RetrieverServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3502,8 +3524,8 @@ async def test_create_document_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - retriever_service.GetDocumentRequest, - dict, + retriever_service.GetDocumentRequest(), + {}, ], ) def test_get_document(request_type, transport: str = "grpc"): @@ -3514,7 +3536,7 @@ def test_get_document(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_document), "__call__") as call: @@ -3560,9 +3582,10 @@ def test_get_document_non_empty_request_with_auto_populated_field(): client.get_document(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == retriever_service.GetDocumentRequest( + request_msg = retriever_service.GetDocumentRequest( name="name_value", ) + assert args[0] == request_msg def test_get_document_use_cached_wrapped_rpc(): @@ -3643,9 +3666,14 @@ async def test_get_document_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_document_async( - transport: str = "grpc_asyncio", request_type=retriever_service.GetDocumentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + retriever_service.GetDocumentRequest(), + {}, + ], +) +async def test_get_document_async(request_type, transport: str = "grpc_asyncio"): client = RetrieverServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3653,7 +3681,7 @@ async def test_get_document_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_document), "__call__") as call: @@ -3678,11 +3706,6 @@ async def test_get_document_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_get_document_async_from_dict(): - await test_get_document_async(request_type=dict) - - def test_get_document_field_headers(): client = RetrieverServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3825,8 +3848,8 @@ async def test_get_document_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - retriever_service.UpdateDocumentRequest, - dict, + retriever_service.UpdateDocumentRequest(), + {}, ], ) def test_update_document(request_type, transport: str = "grpc"): @@ -3837,7 +3860,7 @@ def test_update_document(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_document), "__call__") as call: @@ -3881,7 +3904,8 @@ def test_update_document_non_empty_request_with_auto_populated_field(): client.update_document(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == retriever_service.UpdateDocumentRequest() + request_msg = retriever_service.UpdateDocumentRequest() + assert args[0] == request_msg def test_update_document_use_cached_wrapped_rpc(): @@ -3962,10 +3986,14 @@ async def test_update_document_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_document_async( - transport: str = "grpc_asyncio", - request_type=retriever_service.UpdateDocumentRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + retriever_service.UpdateDocumentRequest(), + {}, + ], +) +async def test_update_document_async(request_type, transport: str = "grpc_asyncio"): client = RetrieverServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3973,7 +4001,7 @@ async def test_update_document_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_document), "__call__") as call: @@ -3998,11 +4026,6 @@ async def test_update_document_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_update_document_async_from_dict(): - await test_update_document_async(request_type=dict) - - def test_update_document_field_headers(): client = RetrieverServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4155,8 +4178,8 @@ async def test_update_document_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - retriever_service.DeleteDocumentRequest, - dict, + retriever_service.DeleteDocumentRequest(), + {}, ], ) def test_delete_document(request_type, transport: str = "grpc"): @@ -4167,7 +4190,7 @@ def test_delete_document(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_document), "__call__") as call: @@ -4208,9 +4231,10 @@ def test_delete_document_non_empty_request_with_auto_populated_field(): client.delete_document(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == retriever_service.DeleteDocumentRequest( + request_msg = retriever_service.DeleteDocumentRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_document_use_cached_wrapped_rpc(): @@ -4291,10 +4315,14 @@ async def test_delete_document_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_document_async( - transport: str = "grpc_asyncio", - request_type=retriever_service.DeleteDocumentRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + retriever_service.DeleteDocumentRequest(), + {}, + ], +) +async def test_delete_document_async(request_type, transport: str = "grpc_asyncio"): client = RetrieverServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4302,7 +4330,7 @@ async def test_delete_document_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_document), "__call__") as call: @@ -4320,11 +4348,6 @@ async def test_delete_document_async( assert response is None -@pytest.mark.asyncio -async def test_delete_document_async_from_dict(): - await test_delete_document_async(request_type=dict) - - def test_delete_document_field_headers(): client = RetrieverServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4467,8 +4490,8 @@ async def test_delete_document_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - retriever_service.ListDocumentsRequest, - dict, + retriever_service.ListDocumentsRequest(), + {}, ], ) def test_list_documents(request_type, transport: str = "grpc"): @@ -4479,7 +4502,7 @@ def test_list_documents(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_documents), "__call__") as call: @@ -4524,10 +4547,11 @@ def test_list_documents_non_empty_request_with_auto_populated_field(): client.list_documents(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == retriever_service.ListDocumentsRequest( + request_msg = retriever_service.ListDocumentsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_documents_use_cached_wrapped_rpc(): @@ -4608,9 +4632,14 @@ async def test_list_documents_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_documents_async( - transport: str = "grpc_asyncio", request_type=retriever_service.ListDocumentsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + retriever_service.ListDocumentsRequest(), + {}, + ], +) +async def test_list_documents_async(request_type, transport: str = "grpc_asyncio"): client = RetrieverServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4618,7 +4647,7 @@ async def test_list_documents_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_documents), "__call__") as call: @@ -4641,11 +4670,6 @@ async def test_list_documents_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_documents_async_from_dict(): - await test_list_documents_async(request_type=dict) - - def test_list_documents_field_headers(): client = RetrieverServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4982,8 +5006,8 @@ async def test_list_documents_async_pages(): @pytest.mark.parametrize( "request_type", [ - retriever_service.QueryDocumentRequest, - dict, + retriever_service.QueryDocumentRequest(), + {}, ], ) def test_query_document(request_type, transport: str = "grpc"): @@ -4994,7 +5018,7 @@ def test_query_document(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.query_document), "__call__") as call: @@ -5036,10 +5060,11 @@ def test_query_document_non_empty_request_with_auto_populated_field(): client.query_document(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == retriever_service.QueryDocumentRequest( + request_msg = retriever_service.QueryDocumentRequest( name="name_value", query="query_value", ) + assert args[0] == request_msg def test_query_document_use_cached_wrapped_rpc(): @@ -5120,9 +5145,14 @@ async def test_query_document_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_query_document_async( - transport: str = "grpc_asyncio", request_type=retriever_service.QueryDocumentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + retriever_service.QueryDocumentRequest(), + {}, + ], +) +async def test_query_document_async(request_type, transport: str = "grpc_asyncio"): client = RetrieverServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5130,7 +5160,7 @@ async def test_query_document_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.query_document), "__call__") as call: @@ -5150,11 +5180,6 @@ async def test_query_document_async( assert isinstance(response, retriever_service.QueryDocumentResponse) -@pytest.mark.asyncio -async def test_query_document_async_from_dict(): - await test_query_document_async(request_type=dict) - - def test_query_document_field_headers(): client = RetrieverServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5219,8 +5244,8 @@ async def test_query_document_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - retriever_service.CreateChunkRequest, - dict, + retriever_service.CreateChunkRequest(), + {}, ], ) def test_create_chunk(request_type, transport: str = "grpc"): @@ -5231,7 +5256,7 @@ def test_create_chunk(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_chunk), "__call__") as call: @@ -5277,9 +5302,10 @@ def test_create_chunk_non_empty_request_with_auto_populated_field(): client.create_chunk(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == retriever_service.CreateChunkRequest( + request_msg = retriever_service.CreateChunkRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_chunk_use_cached_wrapped_rpc(): @@ -5360,9 +5386,14 @@ async def test_create_chunk_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_chunk_async( - transport: str = "grpc_asyncio", request_type=retriever_service.CreateChunkRequest -): +@pytest.mark.parametrize( + "request_type", + [ + retriever_service.CreateChunkRequest(), + {}, + ], +) +async def test_create_chunk_async(request_type, transport: str = "grpc_asyncio"): client = RetrieverServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5370,7 +5401,7 @@ async def test_create_chunk_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_chunk), "__call__") as call: @@ -5395,11 +5426,6 @@ async def test_create_chunk_async( assert response.state == retriever.Chunk.State.STATE_PENDING_PROCESSING -@pytest.mark.asyncio -async def test_create_chunk_async_from_dict(): - await test_create_chunk_async(request_type=dict) - - def test_create_chunk_field_headers(): client = RetrieverServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5552,8 +5578,8 @@ async def test_create_chunk_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - retriever_service.BatchCreateChunksRequest, - dict, + retriever_service.BatchCreateChunksRequest(), + {}, ], ) def test_batch_create_chunks(request_type, transport: str = "grpc"): @@ -5564,7 +5590,7 @@ def test_batch_create_chunks(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5609,9 +5635,10 @@ def test_batch_create_chunks_non_empty_request_with_auto_populated_field(): client.batch_create_chunks(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == retriever_service.BatchCreateChunksRequest( + request_msg = retriever_service.BatchCreateChunksRequest( parent="parent_value", ) + assert args[0] == request_msg def test_batch_create_chunks_use_cached_wrapped_rpc(): @@ -5696,10 +5723,14 @@ async def test_batch_create_chunks_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_batch_create_chunks_async( - transport: str = "grpc_asyncio", - request_type=retriever_service.BatchCreateChunksRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + retriever_service.BatchCreateChunksRequest(), + {}, + ], +) +async def test_batch_create_chunks_async(request_type, transport: str = "grpc_asyncio"): client = RetrieverServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5707,7 +5738,7 @@ async def test_batch_create_chunks_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( @@ -5729,11 +5760,6 @@ async def test_batch_create_chunks_async( assert isinstance(response, retriever_service.BatchCreateChunksResponse) -@pytest.mark.asyncio -async def test_batch_create_chunks_async_from_dict(): - await test_batch_create_chunks_async(request_type=dict) - - def test_batch_create_chunks_field_headers(): client = RetrieverServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5802,8 +5828,8 @@ async def test_batch_create_chunks_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - retriever_service.GetChunkRequest, - dict, + retriever_service.GetChunkRequest(), + {}, ], ) def test_get_chunk(request_type, transport: str = "grpc"): @@ -5814,7 +5840,7 @@ def test_get_chunk(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_chunk), "__call__") as call: @@ -5860,9 +5886,10 @@ def test_get_chunk_non_empty_request_with_auto_populated_field(): client.get_chunk(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == retriever_service.GetChunkRequest( + request_msg = retriever_service.GetChunkRequest( name="name_value", ) + assert args[0] == request_msg def test_get_chunk_use_cached_wrapped_rpc(): @@ -5941,9 +5968,14 @@ async def test_get_chunk_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_chunk_async( - transport: str = "grpc_asyncio", request_type=retriever_service.GetChunkRequest -): +@pytest.mark.parametrize( + "request_type", + [ + retriever_service.GetChunkRequest(), + {}, + ], +) +async def test_get_chunk_async(request_type, transport: str = "grpc_asyncio"): client = RetrieverServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5951,7 +5983,7 @@ async def test_get_chunk_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_chunk), "__call__") as call: @@ -5976,11 +6008,6 @@ async def test_get_chunk_async( assert response.state == retriever.Chunk.State.STATE_PENDING_PROCESSING -@pytest.mark.asyncio -async def test_get_chunk_async_from_dict(): - await test_get_chunk_async(request_type=dict) - - def test_get_chunk_field_headers(): client = RetrieverServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6123,8 +6150,8 @@ async def test_get_chunk_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - retriever_service.UpdateChunkRequest, - dict, + retriever_service.UpdateChunkRequest(), + {}, ], ) def test_update_chunk(request_type, transport: str = "grpc"): @@ -6135,7 +6162,7 @@ def test_update_chunk(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_chunk), "__call__") as call: @@ -6179,7 +6206,8 @@ def test_update_chunk_non_empty_request_with_auto_populated_field(): client.update_chunk(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == retriever_service.UpdateChunkRequest() + request_msg = retriever_service.UpdateChunkRequest() + assert args[0] == request_msg def test_update_chunk_use_cached_wrapped_rpc(): @@ -6260,9 +6288,14 @@ async def test_update_chunk_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_chunk_async( - transport: str = "grpc_asyncio", request_type=retriever_service.UpdateChunkRequest -): +@pytest.mark.parametrize( + "request_type", + [ + retriever_service.UpdateChunkRequest(), + {}, + ], +) +async def test_update_chunk_async(request_type, transport: str = "grpc_asyncio"): client = RetrieverServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6270,7 +6303,7 @@ async def test_update_chunk_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_chunk), "__call__") as call: @@ -6295,11 +6328,6 @@ async def test_update_chunk_async( assert response.state == retriever.Chunk.State.STATE_PENDING_PROCESSING -@pytest.mark.asyncio -async def test_update_chunk_async_from_dict(): - await test_update_chunk_async(request_type=dict) - - def test_update_chunk_field_headers(): client = RetrieverServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6452,8 +6480,8 @@ async def test_update_chunk_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - retriever_service.BatchUpdateChunksRequest, - dict, + retriever_service.BatchUpdateChunksRequest(), + {}, ], ) def test_batch_update_chunks(request_type, transport: str = "grpc"): @@ -6464,7 +6492,7 @@ def test_batch_update_chunks(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6509,9 +6537,10 @@ def test_batch_update_chunks_non_empty_request_with_auto_populated_field(): client.batch_update_chunks(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == retriever_service.BatchUpdateChunksRequest( + request_msg = retriever_service.BatchUpdateChunksRequest( parent="parent_value", ) + assert args[0] == request_msg def test_batch_update_chunks_use_cached_wrapped_rpc(): @@ -6596,10 +6625,14 @@ async def test_batch_update_chunks_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_batch_update_chunks_async( - transport: str = "grpc_asyncio", - request_type=retriever_service.BatchUpdateChunksRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + retriever_service.BatchUpdateChunksRequest(), + {}, + ], +) +async def test_batch_update_chunks_async(request_type, transport: str = "grpc_asyncio"): client = RetrieverServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6607,7 +6640,7 @@ async def test_batch_update_chunks_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( @@ -6629,11 +6662,6 @@ async def test_batch_update_chunks_async( assert isinstance(response, retriever_service.BatchUpdateChunksResponse) -@pytest.mark.asyncio -async def test_batch_update_chunks_async_from_dict(): - await test_batch_update_chunks_async(request_type=dict) - - def test_batch_update_chunks_field_headers(): client = RetrieverServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6702,8 +6730,8 @@ async def test_batch_update_chunks_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - retriever_service.DeleteChunkRequest, - dict, + retriever_service.DeleteChunkRequest(), + {}, ], ) def test_delete_chunk(request_type, transport: str = "grpc"): @@ -6714,7 +6742,7 @@ def test_delete_chunk(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_chunk), "__call__") as call: @@ -6755,9 +6783,10 @@ def test_delete_chunk_non_empty_request_with_auto_populated_field(): client.delete_chunk(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == retriever_service.DeleteChunkRequest( + request_msg = retriever_service.DeleteChunkRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_chunk_use_cached_wrapped_rpc(): @@ -6838,9 +6867,14 @@ async def test_delete_chunk_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_chunk_async( - transport: str = "grpc_asyncio", request_type=retriever_service.DeleteChunkRequest -): +@pytest.mark.parametrize( + "request_type", + [ + retriever_service.DeleteChunkRequest(), + {}, + ], +) +async def test_delete_chunk_async(request_type, transport: str = "grpc_asyncio"): client = RetrieverServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6848,7 +6882,7 @@ async def test_delete_chunk_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_chunk), "__call__") as call: @@ -6866,11 +6900,6 @@ async def test_delete_chunk_async( assert response is None -@pytest.mark.asyncio -async def test_delete_chunk_async_from_dict(): - await test_delete_chunk_async(request_type=dict) - - def test_delete_chunk_field_headers(): client = RetrieverServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7013,8 +7042,8 @@ async def test_delete_chunk_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - retriever_service.BatchDeleteChunksRequest, - dict, + retriever_service.BatchDeleteChunksRequest(), + {}, ], ) def test_batch_delete_chunks(request_type, transport: str = "grpc"): @@ -7025,7 +7054,7 @@ def test_batch_delete_chunks(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7070,9 +7099,10 @@ def test_batch_delete_chunks_non_empty_request_with_auto_populated_field(): client.batch_delete_chunks(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == retriever_service.BatchDeleteChunksRequest( + request_msg = retriever_service.BatchDeleteChunksRequest( parent="parent_value", ) + assert args[0] == request_msg def test_batch_delete_chunks_use_cached_wrapped_rpc(): @@ -7157,10 +7187,14 @@ async def test_batch_delete_chunks_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_batch_delete_chunks_async( - transport: str = "grpc_asyncio", - request_type=retriever_service.BatchDeleteChunksRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + retriever_service.BatchDeleteChunksRequest(), + {}, + ], +) +async def test_batch_delete_chunks_async(request_type, transport: str = "grpc_asyncio"): client = RetrieverServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7168,7 +7202,7 @@ async def test_batch_delete_chunks_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( @@ -7188,11 +7222,6 @@ async def test_batch_delete_chunks_async( assert response is None -@pytest.mark.asyncio -async def test_batch_delete_chunks_async_from_dict(): - await test_batch_delete_chunks_async(request_type=dict) - - def test_batch_delete_chunks_field_headers(): client = RetrieverServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7259,8 +7288,8 @@ async def test_batch_delete_chunks_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - retriever_service.ListChunksRequest, - dict, + retriever_service.ListChunksRequest(), + {}, ], ) def test_list_chunks(request_type, transport: str = "grpc"): @@ -7271,7 +7300,7 @@ def test_list_chunks(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_chunks), "__call__") as call: @@ -7316,10 +7345,11 @@ def test_list_chunks_non_empty_request_with_auto_populated_field(): client.list_chunks(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == retriever_service.ListChunksRequest( + request_msg = retriever_service.ListChunksRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_chunks_use_cached_wrapped_rpc(): @@ -7400,9 +7430,14 @@ async def test_list_chunks_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_chunks_async( - transport: str = "grpc_asyncio", request_type=retriever_service.ListChunksRequest -): +@pytest.mark.parametrize( + "request_type", + [ + retriever_service.ListChunksRequest(), + {}, + ], +) +async def test_list_chunks_async(request_type, transport: str = "grpc_asyncio"): client = RetrieverServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7410,7 +7445,7 @@ async def test_list_chunks_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_chunks), "__call__") as call: @@ -7433,11 +7468,6 @@ async def test_list_chunks_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_chunks_async_from_dict(): - await test_list_chunks_async(request_type=dict) - - def test_list_chunks_field_headers(): client = RetrieverServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11274,7 +11304,6 @@ def test_create_corpus_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.CreateCorpusRequest() - assert args[0] == request_msg @@ -11295,7 +11324,6 @@ def test_get_corpus_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.GetCorpusRequest() - assert args[0] == request_msg @@ -11316,7 +11344,6 @@ def test_update_corpus_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.UpdateCorpusRequest() - assert args[0] == request_msg @@ -11337,7 +11364,6 @@ def test_delete_corpus_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.DeleteCorpusRequest() - assert args[0] == request_msg @@ -11358,7 +11384,6 @@ def test_list_corpora_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.ListCorporaRequest() - assert args[0] == request_msg @@ -11379,7 +11404,6 @@ def test_query_corpus_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.QueryCorpusRequest() - assert args[0] == request_msg @@ -11400,7 +11424,6 @@ def test_create_document_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.CreateDocumentRequest() - assert args[0] == request_msg @@ -11421,7 +11444,6 @@ def test_get_document_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.GetDocumentRequest() - assert args[0] == request_msg @@ -11442,7 +11464,6 @@ def test_update_document_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.UpdateDocumentRequest() - assert args[0] == request_msg @@ -11463,7 +11484,6 @@ def test_delete_document_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.DeleteDocumentRequest() - assert args[0] == request_msg @@ -11484,7 +11504,6 @@ def test_list_documents_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.ListDocumentsRequest() - assert args[0] == request_msg @@ -11505,7 +11524,6 @@ def test_query_document_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.QueryDocumentRequest() - assert args[0] == request_msg @@ -11526,7 +11544,6 @@ def test_create_chunk_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.CreateChunkRequest() - assert args[0] == request_msg @@ -11549,7 +11566,6 @@ def test_batch_create_chunks_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.BatchCreateChunksRequest() - assert args[0] == request_msg @@ -11570,7 +11586,6 @@ def test_get_chunk_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.GetChunkRequest() - assert args[0] == request_msg @@ -11591,7 +11606,6 @@ def test_update_chunk_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.UpdateChunkRequest() - assert args[0] == request_msg @@ -11614,7 +11628,6 @@ def test_batch_update_chunks_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.BatchUpdateChunksRequest() - assert args[0] == request_msg @@ -11635,7 +11648,6 @@ def test_delete_chunk_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.DeleteChunkRequest() - assert args[0] == request_msg @@ -11658,7 +11670,6 @@ def test_batch_delete_chunks_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.BatchDeleteChunksRequest() - assert args[0] == request_msg @@ -11679,7 +11690,6 @@ def test_list_chunks_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.ListChunksRequest() - assert args[0] == request_msg @@ -11721,7 +11731,6 @@ async def test_create_corpus_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.CreateCorpusRequest() - assert args[0] == request_msg @@ -11749,7 +11758,6 @@ async def test_get_corpus_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.GetCorpusRequest() - assert args[0] == request_msg @@ -11777,7 +11785,6 @@ async def test_update_corpus_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.UpdateCorpusRequest() - assert args[0] == request_msg @@ -11800,7 +11807,6 @@ async def test_delete_corpus_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.DeleteCorpusRequest() - assert args[0] == request_msg @@ -11827,7 +11833,6 @@ async def test_list_corpora_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.ListCorporaRequest() - assert args[0] == request_msg @@ -11852,7 +11857,6 @@ async def test_query_corpus_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.QueryCorpusRequest() - assert args[0] == request_msg @@ -11880,7 +11884,6 @@ async def test_create_document_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.CreateDocumentRequest() - assert args[0] == request_msg @@ -11908,7 +11911,6 @@ async def test_get_document_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.GetDocumentRequest() - assert args[0] == request_msg @@ -11936,7 +11938,6 @@ async def test_update_document_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.UpdateDocumentRequest() - assert args[0] == request_msg @@ -11959,7 +11960,6 @@ async def test_delete_document_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.DeleteDocumentRequest() - assert args[0] == request_msg @@ -11986,7 +11986,6 @@ async def test_list_documents_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.ListDocumentsRequest() - assert args[0] == request_msg @@ -12011,7 +12010,6 @@ async def test_query_document_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.QueryDocumentRequest() - assert args[0] == request_msg @@ -12039,7 +12037,6 @@ async def test_create_chunk_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.CreateChunkRequest() - assert args[0] == request_msg @@ -12066,7 +12063,6 @@ async def test_batch_create_chunks_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.BatchCreateChunksRequest() - assert args[0] == request_msg @@ -12094,7 +12090,6 @@ async def test_get_chunk_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.GetChunkRequest() - assert args[0] == request_msg @@ -12122,7 +12117,6 @@ async def test_update_chunk_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.UpdateChunkRequest() - assert args[0] == request_msg @@ -12149,7 +12143,6 @@ async def test_batch_update_chunks_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.BatchUpdateChunksRequest() - assert args[0] == request_msg @@ -12172,7 +12165,6 @@ async def test_delete_chunk_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.DeleteChunkRequest() - assert args[0] == request_msg @@ -12197,7 +12189,6 @@ async def test_batch_delete_chunks_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.BatchDeleteChunksRequest() - assert args[0] == request_msg @@ -12224,7 +12215,6 @@ async def test_list_chunks_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.ListChunksRequest() - assert args[0] == request_msg @@ -15426,7 +15416,6 @@ def test_create_corpus_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.CreateCorpusRequest() - assert args[0] == request_msg @@ -15446,7 +15435,6 @@ def test_get_corpus_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.GetCorpusRequest() - assert args[0] == request_msg @@ -15466,7 +15454,6 @@ def test_update_corpus_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.UpdateCorpusRequest() - assert args[0] == request_msg @@ -15486,7 +15473,6 @@ def test_delete_corpus_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.DeleteCorpusRequest() - assert args[0] == request_msg @@ -15506,7 +15492,6 @@ def test_list_corpora_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.ListCorporaRequest() - assert args[0] == request_msg @@ -15526,7 +15511,6 @@ def test_query_corpus_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.QueryCorpusRequest() - assert args[0] == request_msg @@ -15546,7 +15530,6 @@ def test_create_document_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.CreateDocumentRequest() - assert args[0] == request_msg @@ -15566,7 +15549,6 @@ def test_get_document_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.GetDocumentRequest() - assert args[0] == request_msg @@ -15586,7 +15568,6 @@ def test_update_document_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.UpdateDocumentRequest() - assert args[0] == request_msg @@ -15606,7 +15587,6 @@ def test_delete_document_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.DeleteDocumentRequest() - assert args[0] == request_msg @@ -15626,7 +15606,6 @@ def test_list_documents_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.ListDocumentsRequest() - assert args[0] == request_msg @@ -15646,7 +15625,6 @@ def test_query_document_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.QueryDocumentRequest() - assert args[0] == request_msg @@ -15666,7 +15644,6 @@ def test_create_chunk_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.CreateChunkRequest() - assert args[0] == request_msg @@ -15688,7 +15665,6 @@ def test_batch_create_chunks_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.BatchCreateChunksRequest() - assert args[0] == request_msg @@ -15708,7 +15684,6 @@ def test_get_chunk_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.GetChunkRequest() - assert args[0] == request_msg @@ -15728,7 +15703,6 @@ def test_update_chunk_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.UpdateChunkRequest() - assert args[0] == request_msg @@ -15750,7 +15724,6 @@ def test_batch_update_chunks_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.BatchUpdateChunksRequest() - assert args[0] == request_msg @@ -15770,7 +15743,6 @@ def test_delete_chunk_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.DeleteChunkRequest() - assert args[0] == request_msg @@ -15792,7 +15764,6 @@ def test_batch_delete_chunks_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.BatchDeleteChunksRequest() - assert args[0] == request_msg @@ -15812,7 +15783,6 @@ def test_list_chunks_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.ListChunksRequest() - assert args[0] == request_msg diff --git a/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1alpha/test_text_service.py b/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1alpha/test_text_service.py index 16d32e5773f1..55f9f1cd76ec 100644 --- a/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1alpha/test_text_service.py +++ b/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1alpha/test_text_service.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 @@ -107,6 +108,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" @@ -1272,8 +1288,8 @@ def test_text_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - text_service.GenerateTextRequest, - dict, + text_service.GenerateTextRequest(), + {}, ], ) def test_generate_text(request_type, transport: str = "grpc"): @@ -1284,7 +1300,7 @@ def test_generate_text(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.generate_text), "__call__") as call: @@ -1325,9 +1341,10 @@ def test_generate_text_non_empty_request_with_auto_populated_field(): client.generate_text(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == text_service.GenerateTextRequest( + request_msg = text_service.GenerateTextRequest( model="model_value", ) + assert args[0] == request_msg def test_generate_text_use_cached_wrapped_rpc(): @@ -1408,9 +1425,14 @@ async def test_generate_text_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_generate_text_async( - transport: str = "grpc_asyncio", request_type=text_service.GenerateTextRequest -): +@pytest.mark.parametrize( + "request_type", + [ + text_service.GenerateTextRequest(), + {}, + ], +) +async def test_generate_text_async(request_type, transport: str = "grpc_asyncio"): client = TextServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1418,7 +1440,7 @@ async def test_generate_text_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.generate_text), "__call__") as call: @@ -1438,11 +1460,6 @@ async def test_generate_text_async( assert isinstance(response, text_service.GenerateTextResponse) -@pytest.mark.asyncio -async def test_generate_text_async_from_dict(): - await test_generate_text_async(request_type=dict) - - def test_generate_text_field_headers(): client = TextServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1641,8 +1658,8 @@ async def test_generate_text_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - text_service.EmbedTextRequest, - dict, + text_service.EmbedTextRequest(), + {}, ], ) def test_embed_text(request_type, transport: str = "grpc"): @@ -1653,7 +1670,7 @@ def test_embed_text(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.embed_text), "__call__") as call: @@ -1695,10 +1712,11 @@ def test_embed_text_non_empty_request_with_auto_populated_field(): client.embed_text(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == text_service.EmbedTextRequest( + request_msg = text_service.EmbedTextRequest( model="model_value", text="text_value", ) + assert args[0] == request_msg def test_embed_text_use_cached_wrapped_rpc(): @@ -1777,9 +1795,14 @@ async def test_embed_text_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_embed_text_async( - transport: str = "grpc_asyncio", request_type=text_service.EmbedTextRequest -): +@pytest.mark.parametrize( + "request_type", + [ + text_service.EmbedTextRequest(), + {}, + ], +) +async def test_embed_text_async(request_type, transport: str = "grpc_asyncio"): client = TextServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1787,7 +1810,7 @@ async def test_embed_text_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.embed_text), "__call__") as call: @@ -1807,11 +1830,6 @@ async def test_embed_text_async( assert isinstance(response, text_service.EmbedTextResponse) -@pytest.mark.asyncio -async def test_embed_text_async_from_dict(): - await test_embed_text_async(request_type=dict) - - def test_embed_text_field_headers(): client = TextServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1968,8 +1986,8 @@ async def test_embed_text_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - text_service.BatchEmbedTextRequest, - dict, + text_service.BatchEmbedTextRequest(), + {}, ], ) def test_batch_embed_text(request_type, transport: str = "grpc"): @@ -1980,7 +1998,7 @@ def test_batch_embed_text(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.batch_embed_text), "__call__") as call: @@ -2021,9 +2039,10 @@ def test_batch_embed_text_non_empty_request_with_auto_populated_field(): client.batch_embed_text(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == text_service.BatchEmbedTextRequest( + request_msg = text_service.BatchEmbedTextRequest( model="model_value", ) + assert args[0] == request_msg def test_batch_embed_text_use_cached_wrapped_rpc(): @@ -2106,9 +2125,14 @@ async def test_batch_embed_text_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_batch_embed_text_async( - transport: str = "grpc_asyncio", request_type=text_service.BatchEmbedTextRequest -): +@pytest.mark.parametrize( + "request_type", + [ + text_service.BatchEmbedTextRequest(), + {}, + ], +) +async def test_batch_embed_text_async(request_type, transport: str = "grpc_asyncio"): client = TextServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2116,7 +2140,7 @@ async def test_batch_embed_text_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.batch_embed_text), "__call__") as call: @@ -2136,11 +2160,6 @@ async def test_batch_embed_text_async( assert isinstance(response, text_service.BatchEmbedTextResponse) -@pytest.mark.asyncio -async def test_batch_embed_text_async_from_dict(): - await test_batch_embed_text_async(request_type=dict) - - def test_batch_embed_text_field_headers(): client = TextServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2297,8 +2316,8 @@ async def test_batch_embed_text_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - text_service.CountTextTokensRequest, - dict, + text_service.CountTextTokensRequest(), + {}, ], ) def test_count_text_tokens(request_type, transport: str = "grpc"): @@ -2309,7 +2328,7 @@ def test_count_text_tokens(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2357,9 +2376,10 @@ def test_count_text_tokens_non_empty_request_with_auto_populated_field(): client.count_text_tokens(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == text_service.CountTextTokensRequest( + request_msg = text_service.CountTextTokensRequest( model="model_value", ) + assert args[0] == request_msg def test_count_text_tokens_use_cached_wrapped_rpc(): @@ -2442,9 +2462,14 @@ async def test_count_text_tokens_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_count_text_tokens_async( - transport: str = "grpc_asyncio", request_type=text_service.CountTextTokensRequest -): +@pytest.mark.parametrize( + "request_type", + [ + text_service.CountTextTokensRequest(), + {}, + ], +) +async def test_count_text_tokens_async(request_type, transport: str = "grpc_asyncio"): client = TextServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2452,7 +2477,7 @@ async def test_count_text_tokens_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( @@ -2477,11 +2502,6 @@ async def test_count_text_tokens_async( assert response.token_count == 1193 -@pytest.mark.asyncio -async def test_count_text_tokens_async_from_dict(): - await test_count_text_tokens_async(request_type=dict) - - def test_count_text_tokens_field_headers(): client = TextServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3512,7 +3532,6 @@ def test_generate_text_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = text_service.GenerateTextRequest() - assert args[0] == request_msg @@ -3533,7 +3552,6 @@ def test_embed_text_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = text_service.EmbedTextRequest() - assert args[0] == request_msg @@ -3554,7 +3572,6 @@ def test_batch_embed_text_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = text_service.BatchEmbedTextRequest() - assert args[0] == request_msg @@ -3577,7 +3594,6 @@ def test_count_text_tokens_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = text_service.CountTextTokensRequest() - assert args[0] == request_msg @@ -3616,7 +3632,6 @@ async def test_generate_text_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = text_service.GenerateTextRequest() - assert args[0] == request_msg @@ -3641,7 +3656,6 @@ async def test_embed_text_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = text_service.EmbedTextRequest() - assert args[0] == request_msg @@ -3666,7 +3680,6 @@ async def test_batch_embed_text_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = text_service.BatchEmbedTextRequest() - assert args[0] == request_msg @@ -3695,7 +3708,6 @@ async def test_count_text_tokens_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = text_service.CountTextTokensRequest() - assert args[0] == request_msg @@ -4373,7 +4385,6 @@ def test_generate_text_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = text_service.GenerateTextRequest() - assert args[0] == request_msg @@ -4393,7 +4404,6 @@ def test_embed_text_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = text_service.EmbedTextRequest() - assert args[0] == request_msg @@ -4413,7 +4423,6 @@ def test_batch_embed_text_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = text_service.BatchEmbedTextRequest() - assert args[0] == request_msg @@ -4435,7 +4444,6 @@ def test_count_text_tokens_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = text_service.CountTextTokensRequest() - assert args[0] == request_msg diff --git a/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1beta/test_cache_service.py b/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1beta/test_cache_service.py index 98bf6d5473c5..55477c83dd19 100644 --- a/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1beta/test_cache_service.py +++ b/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1beta/test_cache_service.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 @@ -121,6 +122,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" @@ -1301,8 +1317,8 @@ def test_cache_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - cache_service.ListCachedContentsRequest, - dict, + cache_service.ListCachedContentsRequest(), + {}, ], ) def test_list_cached_contents(request_type, transport: str = "grpc"): @@ -1313,7 +1329,7 @@ def test_list_cached_contents(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1361,9 +1377,10 @@ def test_list_cached_contents_non_empty_request_with_auto_populated_field(): client.list_cached_contents(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cache_service.ListCachedContentsRequest( + request_msg = cache_service.ListCachedContentsRequest( page_token="page_token_value", ) + assert args[0] == request_msg def test_list_cached_contents_use_cached_wrapped_rpc(): @@ -1448,9 +1465,15 @@ async def test_list_cached_contents_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cache_service.ListCachedContentsRequest(), + {}, + ], +) async def test_list_cached_contents_async( - transport: str = "grpc_asyncio", - request_type=cache_service.ListCachedContentsRequest, + request_type, transport: str = "grpc_asyncio" ): client = CacheServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1459,7 +1482,7 @@ async def test_list_cached_contents_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( @@ -1484,11 +1507,6 @@ async def test_list_cached_contents_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_cached_contents_async_from_dict(): - await test_list_cached_contents_async(request_type=dict) - - def test_list_cached_contents_pager(transport_name: str = "grpc"): client = CacheServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1687,8 +1705,8 @@ async def test_list_cached_contents_async_pages(): @pytest.mark.parametrize( "request_type", [ - cache_service.CreateCachedContentRequest, - dict, + cache_service.CreateCachedContentRequest(), + {}, ], ) def test_create_cached_content(request_type, transport: str = "grpc"): @@ -1699,7 +1717,7 @@ def test_create_cached_content(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1749,7 +1767,8 @@ def test_create_cached_content_non_empty_request_with_auto_populated_field(): client.create_cached_content(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cache_service.CreateCachedContentRequest() + request_msg = cache_service.CreateCachedContentRequest() + assert args[0] == request_msg def test_create_cached_content_use_cached_wrapped_rpc(): @@ -1835,9 +1854,15 @@ async def test_create_cached_content_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cache_service.CreateCachedContentRequest(), + {}, + ], +) async def test_create_cached_content_async( - transport: str = "grpc_asyncio", - request_type=cache_service.CreateCachedContentRequest, + request_type, transport: str = "grpc_asyncio" ): client = CacheServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1846,7 +1871,7 @@ async def test_create_cached_content_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( @@ -1875,11 +1900,6 @@ async def test_create_cached_content_async( assert response.model == "model_value" -@pytest.mark.asyncio -async def test_create_cached_content_async_from_dict(): - await test_create_cached_content_async(request_type=dict) - - def test_create_cached_content_flattened(): client = CacheServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1981,8 +2001,8 @@ async def test_create_cached_content_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cache_service.GetCachedContentRequest, - dict, + cache_service.GetCachedContentRequest(), + {}, ], ) def test_get_cached_content(request_type, transport: str = "grpc"): @@ -1993,7 +2013,7 @@ def test_get_cached_content(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2045,9 +2065,10 @@ def test_get_cached_content_non_empty_request_with_auto_populated_field(): client.get_cached_content(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cache_service.GetCachedContentRequest( + request_msg = cache_service.GetCachedContentRequest( name="name_value", ) + assert args[0] == request_msg def test_get_cached_content_use_cached_wrapped_rpc(): @@ -2132,9 +2153,14 @@ async def test_get_cached_content_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_cached_content_async( - transport: str = "grpc_asyncio", request_type=cache_service.GetCachedContentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cache_service.GetCachedContentRequest(), + {}, + ], +) +async def test_get_cached_content_async(request_type, transport: str = "grpc_asyncio"): client = CacheServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2142,7 +2168,7 @@ async def test_get_cached_content_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( @@ -2171,11 +2197,6 @@ async def test_get_cached_content_async( assert response.model == "model_value" -@pytest.mark.asyncio -async def test_get_cached_content_async_from_dict(): - await test_get_cached_content_async(request_type=dict) - - def test_get_cached_content_field_headers(): client = CacheServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2330,8 +2351,8 @@ async def test_get_cached_content_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cache_service.UpdateCachedContentRequest, - dict, + cache_service.UpdateCachedContentRequest(), + {}, ], ) def test_update_cached_content(request_type, transport: str = "grpc"): @@ -2342,7 +2363,7 @@ def test_update_cached_content(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2392,7 +2413,8 @@ def test_update_cached_content_non_empty_request_with_auto_populated_field(): client.update_cached_content(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cache_service.UpdateCachedContentRequest() + request_msg = cache_service.UpdateCachedContentRequest() + assert args[0] == request_msg def test_update_cached_content_use_cached_wrapped_rpc(): @@ -2478,9 +2500,15 @@ async def test_update_cached_content_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cache_service.UpdateCachedContentRequest(), + {}, + ], +) async def test_update_cached_content_async( - transport: str = "grpc_asyncio", - request_type=cache_service.UpdateCachedContentRequest, + request_type, transport: str = "grpc_asyncio" ): client = CacheServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2489,7 +2517,7 @@ async def test_update_cached_content_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( @@ -2518,11 +2546,6 @@ async def test_update_cached_content_async( assert response.model == "model_value" -@pytest.mark.asyncio -async def test_update_cached_content_async_from_dict(): - await test_update_cached_content_async(request_type=dict) - - def test_update_cached_content_field_headers(): client = CacheServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2699,8 +2722,8 @@ async def test_update_cached_content_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cache_service.DeleteCachedContentRequest, - dict, + cache_service.DeleteCachedContentRequest(), + {}, ], ) def test_delete_cached_content(request_type, transport: str = "grpc"): @@ -2711,7 +2734,7 @@ def test_delete_cached_content(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2756,9 +2779,10 @@ def test_delete_cached_content_non_empty_request_with_auto_populated_field(): client.delete_cached_content(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cache_service.DeleteCachedContentRequest( + request_msg = cache_service.DeleteCachedContentRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_cached_content_use_cached_wrapped_rpc(): @@ -2844,9 +2868,15 @@ async def test_delete_cached_content_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cache_service.DeleteCachedContentRequest(), + {}, + ], +) async def test_delete_cached_content_async( - transport: str = "grpc_asyncio", - request_type=cache_service.DeleteCachedContentRequest, + request_type, transport: str = "grpc_asyncio" ): client = CacheServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2855,7 +2885,7 @@ async def test_delete_cached_content_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( @@ -2875,11 +2905,6 @@ async def test_delete_cached_content_async( assert response is None -@pytest.mark.asyncio -async def test_delete_cached_content_async_from_dict(): - await test_delete_cached_content_async(request_type=dict) - - def test_delete_cached_content_field_headers(): client = CacheServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3978,7 +4003,6 @@ def test_list_cached_contents_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cache_service.ListCachedContentsRequest() - assert args[0] == request_msg @@ -4001,7 +4025,6 @@ def test_create_cached_content_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cache_service.CreateCachedContentRequest() - assert args[0] == request_msg @@ -4024,7 +4047,6 @@ def test_get_cached_content_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cache_service.GetCachedContentRequest() - assert args[0] == request_msg @@ -4047,7 +4069,6 @@ def test_update_cached_content_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cache_service.UpdateCachedContentRequest() - assert args[0] == request_msg @@ -4070,7 +4091,6 @@ def test_delete_cached_content_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cache_service.DeleteCachedContentRequest() - assert args[0] == request_msg @@ -4113,7 +4133,6 @@ async def test_list_cached_contents_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cache_service.ListCachedContentsRequest() - assert args[0] == request_msg @@ -4144,7 +4163,6 @@ async def test_create_cached_content_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cache_service.CreateCachedContentRequest() - assert args[0] == request_msg @@ -4175,7 +4193,6 @@ async def test_get_cached_content_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cache_service.GetCachedContentRequest() - assert args[0] == request_msg @@ -4206,7 +4223,6 @@ async def test_update_cached_content_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cache_service.UpdateCachedContentRequest() - assert args[0] == request_msg @@ -4231,7 +4247,6 @@ async def test_delete_cached_content_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cache_service.DeleteCachedContentRequest() - assert args[0] == request_msg @@ -5586,7 +5601,6 @@ def test_list_cached_contents_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cache_service.ListCachedContentsRequest() - assert args[0] == request_msg @@ -5608,7 +5622,6 @@ def test_create_cached_content_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cache_service.CreateCachedContentRequest() - assert args[0] == request_msg @@ -5630,7 +5643,6 @@ def test_get_cached_content_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cache_service.GetCachedContentRequest() - assert args[0] == request_msg @@ -5652,7 +5664,6 @@ def test_update_cached_content_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cache_service.UpdateCachedContentRequest() - assert args[0] == request_msg @@ -5674,7 +5685,6 @@ def test_delete_cached_content_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cache_service.DeleteCachedContentRequest() - assert args[0] == request_msg diff --git a/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1beta/test_discuss_service.py b/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1beta/test_discuss_service.py index e1513af6086b..1f9c1f62850c 100644 --- a/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1beta/test_discuss_service.py +++ b/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1beta/test_discuss_service.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 @@ -107,6 +108,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" @@ -1310,8 +1326,8 @@ def test_discuss_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - discuss_service.GenerateMessageRequest, - dict, + discuss_service.GenerateMessageRequest(), + {}, ], ) def test_generate_message(request_type, transport: str = "grpc"): @@ -1322,7 +1338,7 @@ def test_generate_message(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.generate_message), "__call__") as call: @@ -1363,9 +1379,10 @@ def test_generate_message_non_empty_request_with_auto_populated_field(): client.generate_message(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == discuss_service.GenerateMessageRequest( + request_msg = discuss_service.GenerateMessageRequest( model="model_value", ) + assert args[0] == request_msg def test_generate_message_use_cached_wrapped_rpc(): @@ -1448,9 +1465,14 @@ async def test_generate_message_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_generate_message_async( - transport: str = "grpc_asyncio", request_type=discuss_service.GenerateMessageRequest -): +@pytest.mark.parametrize( + "request_type", + [ + discuss_service.GenerateMessageRequest(), + {}, + ], +) +async def test_generate_message_async(request_type, transport: str = "grpc_asyncio"): client = DiscussServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1458,7 +1480,7 @@ async def test_generate_message_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.generate_message), "__call__") as call: @@ -1478,11 +1500,6 @@ async def test_generate_message_async( assert isinstance(response, discuss_service.GenerateMessageResponse) -@pytest.mark.asyncio -async def test_generate_message_async_from_dict(): - await test_generate_message_async(request_type=dict) - - def test_generate_message_field_headers(): client = DiscussServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1671,8 +1688,8 @@ async def test_generate_message_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - discuss_service.CountMessageTokensRequest, - dict, + discuss_service.CountMessageTokensRequest(), + {}, ], ) def test_count_message_tokens(request_type, transport: str = "grpc"): @@ -1683,7 +1700,7 @@ def test_count_message_tokens(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1731,9 +1748,10 @@ def test_count_message_tokens_non_empty_request_with_auto_populated_field(): client.count_message_tokens(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == discuss_service.CountMessageTokensRequest( + request_msg = discuss_service.CountMessageTokensRequest( model="model_value", ) + assert args[0] == request_msg def test_count_message_tokens_use_cached_wrapped_rpc(): @@ -1818,9 +1836,15 @@ async def test_count_message_tokens_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + discuss_service.CountMessageTokensRequest(), + {}, + ], +) async def test_count_message_tokens_async( - transport: str = "grpc_asyncio", - request_type=discuss_service.CountMessageTokensRequest, + request_type, transport: str = "grpc_asyncio" ): client = DiscussServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1829,7 +1853,7 @@ async def test_count_message_tokens_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( @@ -1854,11 +1878,6 @@ async def test_count_message_tokens_async( assert response.token_count == 1193 -@pytest.mark.asyncio -async def test_count_message_tokens_async_from_dict(): - await test_count_message_tokens_async(request_type=dict) - - def test_count_message_tokens_field_headers(): client = DiscussServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2533,7 +2552,6 @@ def test_generate_message_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = discuss_service.GenerateMessageRequest() - assert args[0] == request_msg @@ -2556,7 +2574,6 @@ def test_count_message_tokens_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = discuss_service.CountMessageTokensRequest() - assert args[0] == request_msg @@ -2595,7 +2612,6 @@ async def test_generate_message_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = discuss_service.GenerateMessageRequest() - assert args[0] == request_msg @@ -2624,7 +2640,6 @@ async def test_count_message_tokens_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = discuss_service.CountMessageTokensRequest() - assert args[0] == request_msg @@ -3173,7 +3188,6 @@ def test_generate_message_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = discuss_service.GenerateMessageRequest() - assert args[0] == request_msg @@ -3195,7 +3209,6 @@ def test_count_message_tokens_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = discuss_service.CountMessageTokensRequest() - assert args[0] == request_msg diff --git a/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1beta/test_file_service.py b/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1beta/test_file_service.py index 6032f6473eb5..3347b5c36e53 100644 --- a/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1beta/test_file_service.py +++ b/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1beta/test_file_service.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" @@ -1277,8 +1293,8 @@ def test_file_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - file_service.CreateFileRequest, - dict, + file_service.CreateFileRequest(), + {}, ], ) def test_create_file(request_type, transport: str = "grpc"): @@ -1289,7 +1305,7 @@ def test_create_file(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_file), "__call__") as call: @@ -1328,7 +1344,8 @@ def test_create_file_non_empty_request_with_auto_populated_field(): client.create_file(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == file_service.CreateFileRequest() + request_msg = file_service.CreateFileRequest() + assert args[0] == request_msg def test_create_file_use_cached_wrapped_rpc(): @@ -1409,9 +1426,14 @@ async def test_create_file_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_file_async( - transport: str = "grpc_asyncio", request_type=file_service.CreateFileRequest -): +@pytest.mark.parametrize( + "request_type", + [ + file_service.CreateFileRequest(), + {}, + ], +) +async def test_create_file_async(request_type, transport: str = "grpc_asyncio"): client = FileServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1419,7 +1441,7 @@ async def test_create_file_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_file), "__call__") as call: @@ -1439,16 +1461,11 @@ async def test_create_file_async( assert isinstance(response, file_service.CreateFileResponse) -@pytest.mark.asyncio -async def test_create_file_async_from_dict(): - await test_create_file_async(request_type=dict) - - @pytest.mark.parametrize( "request_type", [ - file_service.ListFilesRequest, - dict, + file_service.ListFilesRequest(), + {}, ], ) def test_list_files(request_type, transport: str = "grpc"): @@ -1459,7 +1476,7 @@ def test_list_files(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_files), "__call__") as call: @@ -1503,9 +1520,10 @@ def test_list_files_non_empty_request_with_auto_populated_field(): client.list_files(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == file_service.ListFilesRequest( + request_msg = file_service.ListFilesRequest( page_token="page_token_value", ) + assert args[0] == request_msg def test_list_files_use_cached_wrapped_rpc(): @@ -1584,9 +1602,14 @@ async def test_list_files_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_list_files_async( - transport: str = "grpc_asyncio", request_type=file_service.ListFilesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + file_service.ListFilesRequest(), + {}, + ], +) +async def test_list_files_async(request_type, transport: str = "grpc_asyncio"): client = FileServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1594,7 +1617,7 @@ async def test_list_files_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_files), "__call__") as call: @@ -1617,11 +1640,6 @@ async def test_list_files_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_files_async_from_dict(): - await test_list_files_async(request_type=dict) - - def test_list_files_pager(transport_name: str = "grpc"): client = FileServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1812,8 +1830,8 @@ async def test_list_files_async_pages(): @pytest.mark.parametrize( "request_type", [ - file_service.GetFileRequest, - dict, + file_service.GetFileRequest(), + {}, ], ) def test_get_file(request_type, transport: str = "grpc"): @@ -1824,7 +1842,7 @@ def test_get_file(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_file), "__call__") as call: @@ -1884,9 +1902,10 @@ def test_get_file_non_empty_request_with_auto_populated_field(): client.get_file(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == file_service.GetFileRequest( + request_msg = file_service.GetFileRequest( name="name_value", ) + assert args[0] == request_msg def test_get_file_use_cached_wrapped_rpc(): @@ -1965,9 +1984,14 @@ async def test_get_file_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn @pytest.mark.asyncio -async def test_get_file_async( - transport: str = "grpc_asyncio", request_type=file_service.GetFileRequest -): +@pytest.mark.parametrize( + "request_type", + [ + file_service.GetFileRequest(), + {}, + ], +) +async def test_get_file_async(request_type, transport: str = "grpc_asyncio"): client = FileServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1975,7 +1999,7 @@ async def test_get_file_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_file), "__call__") as call: @@ -2014,11 +2038,6 @@ async def test_get_file_async( assert response.source == file.File.Source.UPLOADED -@pytest.mark.asyncio -async def test_get_file_async_from_dict(): - await test_get_file_async(request_type=dict) - - def test_get_file_field_headers(): client = FileServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2161,8 +2180,8 @@ async def test_get_file_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - file_service.DeleteFileRequest, - dict, + file_service.DeleteFileRequest(), + {}, ], ) def test_delete_file(request_type, transport: str = "grpc"): @@ -2173,7 +2192,7 @@ def test_delete_file(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_file), "__call__") as call: @@ -2214,9 +2233,10 @@ def test_delete_file_non_empty_request_with_auto_populated_field(): client.delete_file(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == file_service.DeleteFileRequest( + request_msg = file_service.DeleteFileRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_file_use_cached_wrapped_rpc(): @@ -2297,9 +2317,14 @@ async def test_delete_file_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_file_async( - transport: str = "grpc_asyncio", request_type=file_service.DeleteFileRequest -): +@pytest.mark.parametrize( + "request_type", + [ + file_service.DeleteFileRequest(), + {}, + ], +) +async def test_delete_file_async(request_type, transport: str = "grpc_asyncio"): client = FileServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2307,7 +2332,7 @@ async def test_delete_file_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_file), "__call__") as call: @@ -2325,11 +2350,6 @@ async def test_delete_file_async( assert response is None -@pytest.mark.asyncio -async def test_delete_file_async_from_dict(): - await test_delete_file_async(request_type=dict) - - def test_delete_file_field_headers(): client = FileServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2472,8 +2492,8 @@ async def test_delete_file_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - file_service.DownloadFileRequest, - dict, + file_service.DownloadFileRequest(), + {}, ], ) def test_download_file(request_type, transport: str = "grpc"): @@ -2484,7 +2504,7 @@ def test_download_file(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.download_file), "__call__") as call: @@ -2525,9 +2545,10 @@ def test_download_file_non_empty_request_with_auto_populated_field(): client.download_file(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == file_service.DownloadFileRequest( + request_msg = file_service.DownloadFileRequest( name="name_value", ) + assert args[0] == request_msg def test_download_file_use_cached_wrapped_rpc(): @@ -2608,9 +2629,14 @@ async def test_download_file_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_download_file_async( - transport: str = "grpc_asyncio", request_type=file_service.DownloadFileRequest -): +@pytest.mark.parametrize( + "request_type", + [ + file_service.DownloadFileRequest(), + {}, + ], +) +async def test_download_file_async(request_type, transport: str = "grpc_asyncio"): client = FileServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2618,7 +2644,7 @@ async def test_download_file_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.download_file), "__call__") as call: @@ -2638,11 +2664,6 @@ async def test_download_file_async( assert isinstance(response, file_service.DownloadFileResponse) -@pytest.mark.asyncio -async def test_download_file_async_from_dict(): - await test_download_file_async(request_type=dict) - - def test_download_file_field_headers(): client = FileServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3561,7 +3582,6 @@ def test_create_file_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = file_service.CreateFileRequest() - assert args[0] == request_msg @@ -3582,7 +3602,6 @@ def test_list_files_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = file_service.ListFilesRequest() - assert args[0] == request_msg @@ -3603,7 +3622,6 @@ def test_get_file_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = file_service.GetFileRequest() - assert args[0] == request_msg @@ -3624,7 +3642,6 @@ def test_delete_file_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = file_service.DeleteFileRequest() - assert args[0] == request_msg @@ -3645,7 +3662,6 @@ def test_download_file_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = file_service.DownloadFileRequest() - assert args[0] == request_msg @@ -3684,7 +3700,6 @@ async def test_create_file_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = file_service.CreateFileRequest() - assert args[0] == request_msg @@ -3711,7 +3726,6 @@ async def test_list_files_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = file_service.ListFilesRequest() - assert args[0] == request_msg @@ -3746,7 +3760,6 @@ async def test_get_file_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = file_service.GetFileRequest() - assert args[0] == request_msg @@ -3769,7 +3782,6 @@ async def test_delete_file_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = file_service.DeleteFileRequest() - assert args[0] == request_msg @@ -3794,7 +3806,6 @@ async def test_download_file_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = file_service.DownloadFileRequest() - assert args[0] == request_msg @@ -4700,7 +4711,6 @@ def test_create_file_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = file_service.CreateFileRequest() - assert args[0] == request_msg @@ -4720,7 +4730,6 @@ def test_list_files_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = file_service.ListFilesRequest() - assert args[0] == request_msg @@ -4740,7 +4749,6 @@ def test_get_file_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = file_service.GetFileRequest() - assert args[0] == request_msg @@ -4760,7 +4768,6 @@ def test_delete_file_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = file_service.DeleteFileRequest() - assert args[0] == request_msg @@ -4780,7 +4787,6 @@ def test_download_file_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = file_service.DownloadFileRequest() - assert args[0] == request_msg diff --git a/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1beta/test_generative_service.py b/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1beta/test_generative_service.py index 847260dc4409..3b1f6f96a77f 100644 --- a/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1beta/test_generative_service.py +++ b/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1beta/test_generative_service.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 @@ -118,6 +119,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" @@ -1359,8 +1375,8 @@ def test_generative_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - generative_service.GenerateContentRequest, - dict, + generative_service.GenerateContentRequest(), + {}, ], ) def test_generate_content(request_type, transport: str = "grpc"): @@ -1371,7 +1387,7 @@ def test_generate_content(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.generate_content), "__call__") as call: @@ -1418,10 +1434,11 @@ def test_generate_content_non_empty_request_with_auto_populated_field(): client.generate_content(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == generative_service.GenerateContentRequest( + request_msg = generative_service.GenerateContentRequest( model="model_value", cached_content="cached_content_value", ) + assert args[0] == request_msg def test_generate_content_use_cached_wrapped_rpc(): @@ -1504,10 +1521,14 @@ async def test_generate_content_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_generate_content_async( - transport: str = "grpc_asyncio", - request_type=generative_service.GenerateContentRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + generative_service.GenerateContentRequest(), + {}, + ], +) +async def test_generate_content_async(request_type, transport: str = "grpc_asyncio"): client = GenerativeServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1515,7 +1536,7 @@ async def test_generate_content_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.generate_content), "__call__") as call: @@ -1540,11 +1561,6 @@ async def test_generate_content_async( assert response.response_id == "response_id_value" -@pytest.mark.asyncio -async def test_generate_content_async_from_dict(): - await test_generate_content_async(request_type=dict) - - def test_generate_content_field_headers(): client = GenerativeServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1701,8 +1717,8 @@ async def test_generate_content_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - generative_service.GenerateAnswerRequest, - dict, + generative_service.GenerateAnswerRequest(), + {}, ], ) def test_generate_answer(request_type, transport: str = "grpc"): @@ -1713,7 +1729,7 @@ def test_generate_answer(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.generate_answer), "__call__") as call: @@ -1757,9 +1773,10 @@ def test_generate_answer_non_empty_request_with_auto_populated_field(): client.generate_answer(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == generative_service.GenerateAnswerRequest( + request_msg = generative_service.GenerateAnswerRequest( model="model_value", ) + assert args[0] == request_msg def test_generate_answer_use_cached_wrapped_rpc(): @@ -1840,10 +1857,14 @@ async def test_generate_answer_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_generate_answer_async( - transport: str = "grpc_asyncio", - request_type=generative_service.GenerateAnswerRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + generative_service.GenerateAnswerRequest(), + {}, + ], +) +async def test_generate_answer_async(request_type, transport: str = "grpc_asyncio"): client = GenerativeServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1851,7 +1872,7 @@ async def test_generate_answer_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.generate_answer), "__call__") as call: @@ -1874,11 +1895,6 @@ async def test_generate_answer_async( assert math.isclose(response.answerable_probability, 0.234, rel_tol=1e-6) -@pytest.mark.asyncio -async def test_generate_answer_async_from_dict(): - await test_generate_answer_async(request_type=dict) - - def test_generate_answer_field_headers(): client = GenerativeServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2075,8 +2091,8 @@ async def test_generate_answer_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - generative_service.GenerateContentRequest, - dict, + generative_service.GenerateContentRequest(), + {}, ], ) def test_stream_generate_content(request_type, transport: str = "grpc"): @@ -2087,7 +2103,7 @@ def test_stream_generate_content(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2134,10 +2150,11 @@ def test_stream_generate_content_non_empty_request_with_auto_populated_field(): client.stream_generate_content(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == generative_service.GenerateContentRequest( + request_msg = generative_service.GenerateContentRequest( model="model_value", cached_content="cached_content_value", ) + assert args[0] == request_msg def test_stream_generate_content_use_cached_wrapped_rpc(): @@ -2223,9 +2240,15 @@ async def test_stream_generate_content_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + generative_service.GenerateContentRequest(), + {}, + ], +) async def test_stream_generate_content_async( - transport: str = "grpc_asyncio", - request_type=generative_service.GenerateContentRequest, + request_type, transport: str = "grpc_asyncio" ): client = GenerativeServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2234,7 +2257,7 @@ async def test_stream_generate_content_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( @@ -2258,11 +2281,6 @@ async def test_stream_generate_content_async( assert isinstance(message, generative_service.GenerateContentResponse) -@pytest.mark.asyncio -async def test_stream_generate_content_async_from_dict(): - await test_stream_generate_content_async(request_type=dict) - - def test_stream_generate_content_field_headers(): client = GenerativeServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2426,8 +2444,8 @@ async def test_stream_generate_content_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - generative_service.EmbedContentRequest, - dict, + generative_service.EmbedContentRequest(), + {}, ], ) def test_embed_content(request_type, transport: str = "grpc"): @@ -2438,7 +2456,7 @@ def test_embed_content(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.embed_content), "__call__") as call: @@ -2480,10 +2498,11 @@ def test_embed_content_non_empty_request_with_auto_populated_field(): client.embed_content(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == generative_service.EmbedContentRequest( + request_msg = generative_service.EmbedContentRequest( model="model_value", title="title_value", ) + assert args[0] == request_msg def test_embed_content_use_cached_wrapped_rpc(): @@ -2564,9 +2583,14 @@ async def test_embed_content_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_embed_content_async( - transport: str = "grpc_asyncio", request_type=generative_service.EmbedContentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + generative_service.EmbedContentRequest(), + {}, + ], +) +async def test_embed_content_async(request_type, transport: str = "grpc_asyncio"): client = GenerativeServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2574,7 +2598,7 @@ async def test_embed_content_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.embed_content), "__call__") as call: @@ -2594,11 +2618,6 @@ async def test_embed_content_async( assert isinstance(response, generative_service.EmbedContentResponse) -@pytest.mark.asyncio -async def test_embed_content_async_from_dict(): - await test_embed_content_async(request_type=dict) - - def test_embed_content_field_headers(): client = GenerativeServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2755,8 +2774,8 @@ async def test_embed_content_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - generative_service.BatchEmbedContentsRequest, - dict, + generative_service.BatchEmbedContentsRequest(), + {}, ], ) def test_batch_embed_contents(request_type, transport: str = "grpc"): @@ -2767,7 +2786,7 @@ def test_batch_embed_contents(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2812,9 +2831,10 @@ def test_batch_embed_contents_non_empty_request_with_auto_populated_field(): client.batch_embed_contents(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == generative_service.BatchEmbedContentsRequest( + request_msg = generative_service.BatchEmbedContentsRequest( model="model_value", ) + assert args[0] == request_msg def test_batch_embed_contents_use_cached_wrapped_rpc(): @@ -2899,9 +2919,15 @@ async def test_batch_embed_contents_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + generative_service.BatchEmbedContentsRequest(), + {}, + ], +) async def test_batch_embed_contents_async( - transport: str = "grpc_asyncio", - request_type=generative_service.BatchEmbedContentsRequest, + request_type, transport: str = "grpc_asyncio" ): client = GenerativeServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2910,7 +2936,7 @@ async def test_batch_embed_contents_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( @@ -2932,11 +2958,6 @@ async def test_batch_embed_contents_async( assert isinstance(response, generative_service.BatchEmbedContentsResponse) -@pytest.mark.asyncio -async def test_batch_embed_contents_async_from_dict(): - await test_batch_embed_contents_async(request_type=dict) - - def test_batch_embed_contents_field_headers(): client = GenerativeServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3101,8 +3122,8 @@ async def test_batch_embed_contents_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - generative_service.CountTokensRequest, - dict, + generative_service.CountTokensRequest(), + {}, ], ) def test_count_tokens(request_type, transport: str = "grpc"): @@ -3113,7 +3134,7 @@ def test_count_tokens(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.count_tokens), "__call__") as call: @@ -3159,9 +3180,10 @@ def test_count_tokens_non_empty_request_with_auto_populated_field(): client.count_tokens(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == generative_service.CountTokensRequest( + request_msg = generative_service.CountTokensRequest( model="model_value", ) + assert args[0] == request_msg def test_count_tokens_use_cached_wrapped_rpc(): @@ -3242,9 +3264,14 @@ async def test_count_tokens_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_count_tokens_async( - transport: str = "grpc_asyncio", request_type=generative_service.CountTokensRequest -): +@pytest.mark.parametrize( + "request_type", + [ + generative_service.CountTokensRequest(), + {}, + ], +) +async def test_count_tokens_async(request_type, transport: str = "grpc_asyncio"): client = GenerativeServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3252,7 +3279,7 @@ async def test_count_tokens_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.count_tokens), "__call__") as call: @@ -3277,11 +3304,6 @@ async def test_count_tokens_async( assert response.cached_content_token_count == 2746 -@pytest.mark.asyncio -async def test_count_tokens_async_from_dict(): - await test_count_tokens_async(request_type=dict) - - def test_count_tokens_field_headers(): client = GenerativeServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3438,8 +3460,8 @@ async def test_count_tokens_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - generative_service.BidiGenerateContentClientMessage, - dict, + generative_service.BidiGenerateContentClientMessage(), + {}, ], ) def test_bidi_generate_content(request_type, transport: str = "grpc"): @@ -3450,7 +3472,7 @@ def test_bidi_generate_content(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as 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. @@ -3556,9 +3578,15 @@ async def test_bidi_generate_content_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + generative_service.BidiGenerateContentClientMessage(), + {}, + ], +) async def test_bidi_generate_content_async( - transport: str = "grpc_asyncio", - request_type=generative_service.BidiGenerateContentClientMessage, + request_type, transport: str = "grpc_asyncio" ): client = GenerativeServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3567,7 +3595,7 @@ async def test_bidi_generate_content_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. @@ -3591,11 +3619,6 @@ async def test_bidi_generate_content_async( assert isinstance(message, generative_service.BidiGenerateContentServerMessage) -@pytest.mark.asyncio -async def test_bidi_generate_content_async_from_dict(): - await test_bidi_generate_content_async(request_type=dict) - - def test_generate_content_rest_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, # instead of constructing them on each call @@ -4893,7 +4916,6 @@ def test_generate_content_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generative_service.GenerateContentRequest() - assert args[0] == request_msg @@ -4914,7 +4936,6 @@ def test_generate_answer_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generative_service.GenerateAnswerRequest() - assert args[0] == request_msg @@ -4937,7 +4958,6 @@ def test_stream_generate_content_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generative_service.GenerateContentRequest() - assert args[0] == request_msg @@ -4958,7 +4978,6 @@ def test_embed_content_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generative_service.EmbedContentRequest() - assert args[0] == request_msg @@ -4981,7 +5000,6 @@ def test_batch_embed_contents_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generative_service.BatchEmbedContentsRequest() - assert args[0] == request_msg @@ -5002,7 +5020,6 @@ def test_count_tokens_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generative_service.CountTokensRequest() - assert args[0] == request_msg @@ -5044,7 +5061,6 @@ async def test_generate_content_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generative_service.GenerateContentRequest() - assert args[0] == request_msg @@ -5071,7 +5087,6 @@ async def test_generate_answer_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generative_service.GenerateAnswerRequest() - assert args[0] == request_msg @@ -5099,7 +5114,6 @@ async def test_stream_generate_content_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generative_service.GenerateContentRequest() - assert args[0] == request_msg @@ -5124,7 +5138,6 @@ async def test_embed_content_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generative_service.EmbedContentRequest() - assert args[0] == request_msg @@ -5151,7 +5164,6 @@ async def test_batch_embed_contents_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generative_service.BatchEmbedContentsRequest() - assert args[0] == request_msg @@ -5179,7 +5191,6 @@ async def test_count_tokens_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generative_service.CountTokensRequest() - assert args[0] == request_msg @@ -6291,7 +6302,6 @@ def test_generate_content_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generative_service.GenerateContentRequest() - assert args[0] == request_msg @@ -6311,7 +6321,6 @@ def test_generate_answer_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generative_service.GenerateAnswerRequest() - assert args[0] == request_msg @@ -6333,7 +6342,6 @@ def test_stream_generate_content_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generative_service.GenerateContentRequest() - assert args[0] == request_msg @@ -6353,7 +6361,6 @@ def test_embed_content_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generative_service.EmbedContentRequest() - assert args[0] == request_msg @@ -6375,7 +6382,6 @@ def test_batch_embed_contents_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generative_service.BatchEmbedContentsRequest() - assert args[0] == request_msg @@ -6395,7 +6401,6 @@ def test_count_tokens_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generative_service.CountTokensRequest() - assert args[0] == request_msg diff --git a/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1beta/test_model_service.py b/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1beta/test_model_service.py index a6ba215e4fce..ba95b7aef787 100644 --- a/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1beta/test_model_service.py +++ b/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1beta/test_model_service.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 @@ -115,6 +116,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" @@ -1295,8 +1311,8 @@ def test_model_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - model_service.GetModelRequest, - dict, + model_service.GetModelRequest(), + {}, ], ) def test_get_model(request_type, transport: str = "grpc"): @@ -1307,7 +1323,7 @@ def test_get_model(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_model), "__call__") as call: @@ -1377,9 +1393,10 @@ def test_get_model_non_empty_request_with_auto_populated_field(): client.get_model(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == model_service.GetModelRequest( + request_msg = model_service.GetModelRequest( name="name_value", ) + assert args[0] == request_msg def test_get_model_use_cached_wrapped_rpc(): @@ -1458,9 +1475,14 @@ async def test_get_model_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_model_async( - transport: str = "grpc_asyncio", request_type=model_service.GetModelRequest -): +@pytest.mark.parametrize( + "request_type", + [ + model_service.GetModelRequest(), + {}, + ], +) +async def test_get_model_async(request_type, transport: str = "grpc_asyncio"): client = ModelServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1468,7 +1490,7 @@ async def test_get_model_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_model), "__call__") as call: @@ -1517,11 +1539,6 @@ async def test_get_model_async( assert response.thinking is True -@pytest.mark.asyncio -async def test_get_model_async_from_dict(): - await test_get_model_async(request_type=dict) - - def test_get_model_field_headers(): client = ModelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1664,8 +1681,8 @@ async def test_get_model_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - model_service.ListModelsRequest, - dict, + model_service.ListModelsRequest(), + {}, ], ) def test_list_models(request_type, transport: str = "grpc"): @@ -1676,7 +1693,7 @@ def test_list_models(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_models), "__call__") as call: @@ -1720,9 +1737,10 @@ def test_list_models_non_empty_request_with_auto_populated_field(): client.list_models(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == model_service.ListModelsRequest( + request_msg = model_service.ListModelsRequest( page_token="page_token_value", ) + assert args[0] == request_msg def test_list_models_use_cached_wrapped_rpc(): @@ -1803,9 +1821,14 @@ async def test_list_models_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_models_async( - transport: str = "grpc_asyncio", request_type=model_service.ListModelsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + model_service.ListModelsRequest(), + {}, + ], +) +async def test_list_models_async(request_type, transport: str = "grpc_asyncio"): client = ModelServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1813,7 +1836,7 @@ async def test_list_models_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_models), "__call__") as call: @@ -1836,11 +1859,6 @@ async def test_list_models_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_models_async_from_dict(): - await test_list_models_async(request_type=dict) - - def test_list_models_flattened(): client = ModelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2123,8 +2141,8 @@ async def test_list_models_async_pages(): @pytest.mark.parametrize( "request_type", [ - model_service.GetTunedModelRequest, - dict, + model_service.GetTunedModelRequest(), + {}, ], ) def test_get_tuned_model(request_type, transport: str = "grpc"): @@ -2135,7 +2153,7 @@ def test_get_tuned_model(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tuned_model), "__call__") as call: @@ -2194,9 +2212,10 @@ def test_get_tuned_model_non_empty_request_with_auto_populated_field(): client.get_tuned_model(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == model_service.GetTunedModelRequest( + request_msg = model_service.GetTunedModelRequest( name="name_value", ) + assert args[0] == request_msg def test_get_tuned_model_use_cached_wrapped_rpc(): @@ -2277,9 +2296,14 @@ async def test_get_tuned_model_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_tuned_model_async( - transport: str = "grpc_asyncio", request_type=model_service.GetTunedModelRequest -): +@pytest.mark.parametrize( + "request_type", + [ + model_service.GetTunedModelRequest(), + {}, + ], +) +async def test_get_tuned_model_async(request_type, transport: str = "grpc_asyncio"): client = ModelServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2287,7 +2311,7 @@ async def test_get_tuned_model_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_tuned_model), "__call__") as call: @@ -2324,11 +2348,6 @@ async def test_get_tuned_model_async( assert response.reader_project_numbers == [2340] -@pytest.mark.asyncio -async def test_get_tuned_model_async_from_dict(): - await test_get_tuned_model_async(request_type=dict) - - def test_get_tuned_model_field_headers(): client = ModelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2475,8 +2494,8 @@ async def test_get_tuned_model_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - model_service.ListTunedModelsRequest, - dict, + model_service.ListTunedModelsRequest(), + {}, ], ) def test_list_tuned_models(request_type, transport: str = "grpc"): @@ -2487,7 +2506,7 @@ def test_list_tuned_models(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2536,10 +2555,11 @@ def test_list_tuned_models_non_empty_request_with_auto_populated_field(): client.list_tuned_models(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == model_service.ListTunedModelsRequest( + request_msg = model_service.ListTunedModelsRequest( page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_tuned_models_use_cached_wrapped_rpc(): @@ -2622,9 +2642,14 @@ async def test_list_tuned_models_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_tuned_models_async( - transport: str = "grpc_asyncio", request_type=model_service.ListTunedModelsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + model_service.ListTunedModelsRequest(), + {}, + ], +) +async def test_list_tuned_models_async(request_type, transport: str = "grpc_asyncio"): client = ModelServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2632,7 +2657,7 @@ async def test_list_tuned_models_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( @@ -2657,11 +2682,6 @@ async def test_list_tuned_models_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_tuned_models_async_from_dict(): - await test_list_tuned_models_async(request_type=dict) - - def test_list_tuned_models_flattened(): client = ModelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2956,8 +2976,8 @@ async def test_list_tuned_models_async_pages(): @pytest.mark.parametrize( "request_type", [ - model_service.CreateTunedModelRequest, - dict, + model_service.CreateTunedModelRequest(), + {}, ], ) def test_create_tuned_model(request_type, transport: str = "grpc"): @@ -2968,7 +2988,7 @@ def test_create_tuned_model(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3013,9 +3033,10 @@ def test_create_tuned_model_non_empty_request_with_auto_populated_field(): client.create_tuned_model(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == model_service.CreateTunedModelRequest( + request_msg = model_service.CreateTunedModelRequest( tuned_model_id="tuned_model_id_value", ) + assert args[0] == request_msg def test_create_tuned_model_use_cached_wrapped_rpc(): @@ -3110,9 +3131,14 @@ async def test_create_tuned_model_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_tuned_model_async( - transport: str = "grpc_asyncio", request_type=model_service.CreateTunedModelRequest -): +@pytest.mark.parametrize( + "request_type", + [ + model_service.CreateTunedModelRequest(), + {}, + ], +) +async def test_create_tuned_model_async(request_type, transport: str = "grpc_asyncio"): client = ModelServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3120,7 +3146,7 @@ async def test_create_tuned_model_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( @@ -3142,11 +3168,6 @@ async def test_create_tuned_model_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_tuned_model_async_from_dict(): - await test_create_tuned_model_async(request_type=dict) - - def test_create_tuned_model_flattened(): client = ModelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3270,8 +3291,8 @@ async def test_create_tuned_model_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - model_service.UpdateTunedModelRequest, - dict, + model_service.UpdateTunedModelRequest(), + {}, ], ) def test_update_tuned_model(request_type, transport: str = "grpc"): @@ -3282,7 +3303,7 @@ def test_update_tuned_model(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3343,7 +3364,8 @@ def test_update_tuned_model_non_empty_request_with_auto_populated_field(): client.update_tuned_model(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == model_service.UpdateTunedModelRequest() + request_msg = model_service.UpdateTunedModelRequest() + assert args[0] == request_msg def test_update_tuned_model_use_cached_wrapped_rpc(): @@ -3428,9 +3450,14 @@ async def test_update_tuned_model_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_tuned_model_async( - transport: str = "grpc_asyncio", request_type=model_service.UpdateTunedModelRequest -): +@pytest.mark.parametrize( + "request_type", + [ + model_service.UpdateTunedModelRequest(), + {}, + ], +) +async def test_update_tuned_model_async(request_type, transport: str = "grpc_asyncio"): client = ModelServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3438,7 +3465,7 @@ async def test_update_tuned_model_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( @@ -3477,11 +3504,6 @@ async def test_update_tuned_model_async( assert response.reader_project_numbers == [2340] -@pytest.mark.asyncio -async def test_update_tuned_model_async_from_dict(): - await test_update_tuned_model_async(request_type=dict) - - def test_update_tuned_model_field_headers(): client = ModelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3670,8 +3692,8 @@ async def test_update_tuned_model_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - model_service.DeleteTunedModelRequest, - dict, + model_service.DeleteTunedModelRequest(), + {}, ], ) def test_delete_tuned_model(request_type, transport: str = "grpc"): @@ -3682,7 +3704,7 @@ def test_delete_tuned_model(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3727,9 +3749,10 @@ def test_delete_tuned_model_non_empty_request_with_auto_populated_field(): client.delete_tuned_model(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == model_service.DeleteTunedModelRequest( + request_msg = model_service.DeleteTunedModelRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_tuned_model_use_cached_wrapped_rpc(): @@ -3814,9 +3837,14 @@ async def test_delete_tuned_model_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_tuned_model_async( - transport: str = "grpc_asyncio", request_type=model_service.DeleteTunedModelRequest -): +@pytest.mark.parametrize( + "request_type", + [ + model_service.DeleteTunedModelRequest(), + {}, + ], +) +async def test_delete_tuned_model_async(request_type, transport: str = "grpc_asyncio"): client = ModelServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3824,7 +3852,7 @@ async def test_delete_tuned_model_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( @@ -3844,11 +3872,6 @@ async def test_delete_tuned_model_async( assert response is None -@pytest.mark.asyncio -async def test_delete_tuned_model_async_from_dict(): - await test_delete_tuned_model_async(request_type=dict) - - def test_delete_tuned_model_field_headers(): client = ModelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5334,7 +5357,6 @@ def test_get_model_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.GetModelRequest() - assert args[0] == request_msg @@ -5355,7 +5377,6 @@ def test_list_models_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.ListModelsRequest() - assert args[0] == request_msg @@ -5376,7 +5397,6 @@ def test_get_tuned_model_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.GetTunedModelRequest() - assert args[0] == request_msg @@ -5399,7 +5419,6 @@ def test_list_tuned_models_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.ListTunedModelsRequest() - assert args[0] == request_msg @@ -5422,7 +5441,6 @@ def test_create_tuned_model_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.CreateTunedModelRequest() - assert args[0] == request_msg @@ -5445,7 +5463,6 @@ def test_update_tuned_model_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.UpdateTunedModelRequest() - assert args[0] == request_msg @@ -5468,7 +5485,6 @@ def test_delete_tuned_model_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.DeleteTunedModelRequest() - assert args[0] == request_msg @@ -5521,7 +5537,6 @@ async def test_get_model_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.GetModelRequest() - assert args[0] == request_msg @@ -5548,7 +5563,6 @@ async def test_list_models_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.ListModelsRequest() - assert args[0] == request_msg @@ -5582,7 +5596,6 @@ async def test_get_tuned_model_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.GetTunedModelRequest() - assert args[0] == request_msg @@ -5611,7 +5624,6 @@ async def test_list_tuned_models_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.ListTunedModelsRequest() - assert args[0] == request_msg @@ -5638,7 +5650,6 @@ async def test_create_tuned_model_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.CreateTunedModelRequest() - assert args[0] == request_msg @@ -5674,7 +5685,6 @@ async def test_update_tuned_model_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.UpdateTunedModelRequest() - assert args[0] == request_msg @@ -5699,7 +5709,6 @@ async def test_delete_tuned_model_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.DeleteTunedModelRequest() - assert args[0] == request_msg @@ -7132,7 +7141,6 @@ def test_get_model_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.GetModelRequest() - assert args[0] == request_msg @@ -7152,7 +7160,6 @@ def test_list_models_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.ListModelsRequest() - assert args[0] == request_msg @@ -7172,7 +7179,6 @@ def test_get_tuned_model_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.GetTunedModelRequest() - assert args[0] == request_msg @@ -7194,7 +7200,6 @@ def test_list_tuned_models_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.ListTunedModelsRequest() - assert args[0] == request_msg @@ -7216,7 +7221,6 @@ def test_create_tuned_model_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.CreateTunedModelRequest() - assert args[0] == request_msg @@ -7238,7 +7242,6 @@ def test_update_tuned_model_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.UpdateTunedModelRequest() - assert args[0] == request_msg @@ -7260,7 +7263,6 @@ def test_delete_tuned_model_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.DeleteTunedModelRequest() - assert args[0] == request_msg diff --git a/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1beta/test_permission_service.py b/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1beta/test_permission_service.py index f3af12368fa3..9c08da18ed60 100644 --- a/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1beta/test_permission_service.py +++ b/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1beta/test_permission_service.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 @@ -110,6 +111,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" @@ -1351,8 +1367,8 @@ def test_permission_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - permission_service.CreatePermissionRequest, - dict, + permission_service.CreatePermissionRequest(), + {}, ], ) def test_create_permission(request_type, transport: str = "grpc"): @@ -1363,7 +1379,7 @@ def test_create_permission(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1417,9 +1433,10 @@ def test_create_permission_non_empty_request_with_auto_populated_field(): client.create_permission(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == permission_service.CreatePermissionRequest( + request_msg = permission_service.CreatePermissionRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_permission_use_cached_wrapped_rpc(): @@ -1502,10 +1519,14 @@ async def test_create_permission_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_permission_async( - transport: str = "grpc_asyncio", - request_type=permission_service.CreatePermissionRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + permission_service.CreatePermissionRequest(), + {}, + ], +) +async def test_create_permission_async(request_type, transport: str = "grpc_asyncio"): client = PermissionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1513,7 +1534,7 @@ async def test_create_permission_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( @@ -1544,11 +1565,6 @@ async def test_create_permission_async( assert response.role == gag_permission.Permission.Role.OWNER -@pytest.mark.asyncio -async def test_create_permission_async_from_dict(): - await test_create_permission_async(request_type=dict) - - def test_create_permission_field_headers(): client = PermissionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1713,8 +1729,8 @@ async def test_create_permission_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - permission_service.GetPermissionRequest, - dict, + permission_service.GetPermissionRequest(), + {}, ], ) def test_get_permission(request_type, transport: str = "grpc"): @@ -1725,7 +1741,7 @@ def test_get_permission(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_permission), "__call__") as call: @@ -1775,9 +1791,10 @@ def test_get_permission_non_empty_request_with_auto_populated_field(): client.get_permission(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == permission_service.GetPermissionRequest( + request_msg = permission_service.GetPermissionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_permission_use_cached_wrapped_rpc(): @@ -1858,10 +1875,14 @@ async def test_get_permission_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_permission_async( - transport: str = "grpc_asyncio", - request_type=permission_service.GetPermissionRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + permission_service.GetPermissionRequest(), + {}, + ], +) +async def test_get_permission_async(request_type, transport: str = "grpc_asyncio"): client = PermissionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1869,7 +1890,7 @@ async def test_get_permission_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_permission), "__call__") as call: @@ -1898,11 +1919,6 @@ async def test_get_permission_async( assert response.role == permission.Permission.Role.OWNER -@pytest.mark.asyncio -async def test_get_permission_async_from_dict(): - await test_get_permission_async(request_type=dict) - - def test_get_permission_field_headers(): client = PermissionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2049,8 +2065,8 @@ async def test_get_permission_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - permission_service.ListPermissionsRequest, - dict, + permission_service.ListPermissionsRequest(), + {}, ], ) def test_list_permissions(request_type, transport: str = "grpc"): @@ -2061,7 +2077,7 @@ def test_list_permissions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_permissions), "__call__") as call: @@ -2106,10 +2122,11 @@ def test_list_permissions_non_empty_request_with_auto_populated_field(): client.list_permissions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == permission_service.ListPermissionsRequest( + request_msg = permission_service.ListPermissionsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_permissions_use_cached_wrapped_rpc(): @@ -2192,10 +2209,14 @@ async def test_list_permissions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_permissions_async( - transport: str = "grpc_asyncio", - request_type=permission_service.ListPermissionsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + permission_service.ListPermissionsRequest(), + {}, + ], +) +async def test_list_permissions_async(request_type, transport: str = "grpc_asyncio"): client = PermissionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2203,7 +2224,7 @@ async def test_list_permissions_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_permissions), "__call__") as call: @@ -2226,11 +2247,6 @@ async def test_list_permissions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_permissions_async_from_dict(): - await test_list_permissions_async(request_type=dict) - - def test_list_permissions_field_headers(): client = PermissionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2567,8 +2583,8 @@ async def test_list_permissions_async_pages(): @pytest.mark.parametrize( "request_type", [ - permission_service.UpdatePermissionRequest, - dict, + permission_service.UpdatePermissionRequest(), + {}, ], ) def test_update_permission(request_type, transport: str = "grpc"): @@ -2579,7 +2595,7 @@ def test_update_permission(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2631,7 +2647,8 @@ def test_update_permission_non_empty_request_with_auto_populated_field(): client.update_permission(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == permission_service.UpdatePermissionRequest() + request_msg = permission_service.UpdatePermissionRequest() + assert args[0] == request_msg def test_update_permission_use_cached_wrapped_rpc(): @@ -2714,10 +2731,14 @@ async def test_update_permission_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_permission_async( - transport: str = "grpc_asyncio", - request_type=permission_service.UpdatePermissionRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + permission_service.UpdatePermissionRequest(), + {}, + ], +) +async def test_update_permission_async(request_type, transport: str = "grpc_asyncio"): client = PermissionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2725,7 +2746,7 @@ async def test_update_permission_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( @@ -2756,11 +2777,6 @@ async def test_update_permission_async( assert response.role == gag_permission.Permission.Role.OWNER -@pytest.mark.asyncio -async def test_update_permission_async_from_dict(): - await test_update_permission_async(request_type=dict) - - def test_update_permission_field_headers(): client = PermissionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2925,8 +2941,8 @@ async def test_update_permission_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - permission_service.DeletePermissionRequest, - dict, + permission_service.DeletePermissionRequest(), + {}, ], ) def test_delete_permission(request_type, transport: str = "grpc"): @@ -2937,7 +2953,7 @@ def test_delete_permission(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2982,9 +2998,10 @@ def test_delete_permission_non_empty_request_with_auto_populated_field(): client.delete_permission(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == permission_service.DeletePermissionRequest( + request_msg = permission_service.DeletePermissionRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_permission_use_cached_wrapped_rpc(): @@ -3067,10 +3084,14 @@ async def test_delete_permission_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_permission_async( - transport: str = "grpc_asyncio", - request_type=permission_service.DeletePermissionRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + permission_service.DeletePermissionRequest(), + {}, + ], +) +async def test_delete_permission_async(request_type, transport: str = "grpc_asyncio"): client = PermissionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3078,7 +3099,7 @@ async def test_delete_permission_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( @@ -3098,11 +3119,6 @@ async def test_delete_permission_async( assert response is None -@pytest.mark.asyncio -async def test_delete_permission_async_from_dict(): - await test_delete_permission_async(request_type=dict) - - def test_delete_permission_field_headers(): client = PermissionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3253,8 +3269,8 @@ async def test_delete_permission_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - permission_service.TransferOwnershipRequest, - dict, + permission_service.TransferOwnershipRequest(), + {}, ], ) def test_transfer_ownership(request_type, transport: str = "grpc"): @@ -3265,7 +3281,7 @@ def test_transfer_ownership(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3311,10 +3327,11 @@ def test_transfer_ownership_non_empty_request_with_auto_populated_field(): client.transfer_ownership(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == permission_service.TransferOwnershipRequest( + request_msg = permission_service.TransferOwnershipRequest( name="name_value", email_address="email_address_value", ) + assert args[0] == request_msg def test_transfer_ownership_use_cached_wrapped_rpc(): @@ -3399,10 +3416,14 @@ async def test_transfer_ownership_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_transfer_ownership_async( - transport: str = "grpc_asyncio", - request_type=permission_service.TransferOwnershipRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + permission_service.TransferOwnershipRequest(), + {}, + ], +) +async def test_transfer_ownership_async(request_type, transport: str = "grpc_asyncio"): client = PermissionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3410,7 +3431,7 @@ async def test_transfer_ownership_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( @@ -3432,11 +3453,6 @@ async def test_transfer_ownership_async( assert isinstance(response, permission_service.TransferOwnershipResponse) -@pytest.mark.asyncio -async def test_transfer_ownership_async_from_dict(): - await test_transfer_ownership_async(request_type=dict) - - def test_transfer_ownership_field_headers(): client = PermissionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4752,7 +4768,6 @@ def test_create_permission_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = permission_service.CreatePermissionRequest() - assert args[0] == request_msg @@ -4773,7 +4788,6 @@ def test_get_permission_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = permission_service.GetPermissionRequest() - assert args[0] == request_msg @@ -4794,7 +4808,6 @@ def test_list_permissions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = permission_service.ListPermissionsRequest() - assert args[0] == request_msg @@ -4817,7 +4830,6 @@ def test_update_permission_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = permission_service.UpdatePermissionRequest() - assert args[0] == request_msg @@ -4840,7 +4852,6 @@ def test_delete_permission_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = permission_service.DeletePermissionRequest() - assert args[0] == request_msg @@ -4863,7 +4874,6 @@ def test_transfer_ownership_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = permission_service.TransferOwnershipRequest() - assert args[0] == request_msg @@ -4909,7 +4919,6 @@ async def test_create_permission_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = permission_service.CreatePermissionRequest() - assert args[0] == request_msg @@ -4939,7 +4948,6 @@ async def test_get_permission_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = permission_service.GetPermissionRequest() - assert args[0] == request_msg @@ -4966,7 +4974,6 @@ async def test_list_permissions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = permission_service.ListPermissionsRequest() - assert args[0] == request_msg @@ -4998,7 +5005,6 @@ async def test_update_permission_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = permission_service.UpdatePermissionRequest() - assert args[0] == request_msg @@ -5023,7 +5029,6 @@ async def test_delete_permission_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = permission_service.DeletePermissionRequest() - assert args[0] == request_msg @@ -5050,7 +5055,6 @@ async def test_transfer_ownership_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = permission_service.TransferOwnershipRequest() - assert args[0] == request_msg @@ -6268,7 +6272,6 @@ def test_create_permission_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = permission_service.CreatePermissionRequest() - assert args[0] == request_msg @@ -6288,7 +6291,6 @@ def test_get_permission_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = permission_service.GetPermissionRequest() - assert args[0] == request_msg @@ -6308,7 +6310,6 @@ def test_list_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = permission_service.ListPermissionsRequest() - assert args[0] == request_msg @@ -6330,7 +6331,6 @@ def test_update_permission_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = permission_service.UpdatePermissionRequest() - assert args[0] == request_msg @@ -6352,7 +6352,6 @@ def test_delete_permission_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = permission_service.DeletePermissionRequest() - assert args[0] == request_msg @@ -6374,7 +6373,6 @@ def test_transfer_ownership_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = permission_service.TransferOwnershipRequest() - assert args[0] == request_msg diff --git a/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1beta/test_prediction_service.py b/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1beta/test_prediction_service.py index 18bef6ce1c7e..19985a8d0d25 100644 --- a/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1beta/test_prediction_service.py +++ b/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1beta/test_prediction_service.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" @@ -1353,8 +1369,8 @@ def test_prediction_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - prediction_service.PredictRequest, - dict, + prediction_service.PredictRequest(), + {}, ], ) def test_predict(request_type, transport: str = "grpc"): @@ -1365,7 +1381,7 @@ def test_predict(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.predict), "__call__") as call: @@ -1406,9 +1422,10 @@ def test_predict_non_empty_request_with_auto_populated_field(): client.predict(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == prediction_service.PredictRequest( + request_msg = prediction_service.PredictRequest( model="model_value", ) + assert args[0] == request_msg def test_predict_use_cached_wrapped_rpc(): @@ -1487,9 +1504,14 @@ async def test_predict_async_use_cached_wrapped_rpc(transport: str = "grpc_async @pytest.mark.asyncio -async def test_predict_async( - transport: str = "grpc_asyncio", request_type=prediction_service.PredictRequest -): +@pytest.mark.parametrize( + "request_type", + [ + prediction_service.PredictRequest(), + {}, + ], +) +async def test_predict_async(request_type, transport: str = "grpc_asyncio"): client = PredictionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1497,7 +1519,7 @@ async def test_predict_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.predict), "__call__") as call: @@ -1517,11 +1539,6 @@ async def test_predict_async( assert isinstance(response, prediction_service.PredictResponse) -@pytest.mark.asyncio -async def test_predict_async_from_dict(): - await test_predict_async(request_type=dict) - - def test_predict_field_headers(): client = PredictionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1678,8 +1695,8 @@ async def test_predict_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - prediction_service.PredictLongRunningRequest, - dict, + prediction_service.PredictLongRunningRequest(), + {}, ], ) def test_predict_long_running(request_type, transport: str = "grpc"): @@ -1690,7 +1707,7 @@ def test_predict_long_running(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1735,9 +1752,10 @@ def test_predict_long_running_non_empty_request_with_auto_populated_field(): client.predict_long_running(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == prediction_service.PredictLongRunningRequest( + request_msg = prediction_service.PredictLongRunningRequest( model="model_value", ) + assert args[0] == request_msg def test_predict_long_running_use_cached_wrapped_rpc(): @@ -1832,9 +1850,15 @@ async def test_predict_long_running_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + prediction_service.PredictLongRunningRequest(), + {}, + ], +) async def test_predict_long_running_async( - transport: str = "grpc_asyncio", - request_type=prediction_service.PredictLongRunningRequest, + request_type, transport: str = "grpc_asyncio" ): client = PredictionServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1843,7 +1867,7 @@ async def test_predict_long_running_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( @@ -1865,11 +1889,6 @@ async def test_predict_long_running_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_predict_long_running_async_from_dict(): - await test_predict_long_running_async(request_type=dict) - - def test_predict_long_running_field_headers(): client = PredictionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2530,7 +2549,6 @@ def test_predict_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = prediction_service.PredictRequest() - assert args[0] == request_msg @@ -2553,7 +2571,6 @@ def test_predict_long_running_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = prediction_service.PredictLongRunningRequest() - assert args[0] == request_msg @@ -2592,7 +2609,6 @@ async def test_predict_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = prediction_service.PredictRequest() - assert args[0] == request_msg @@ -2619,7 +2635,6 @@ async def test_predict_long_running_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = prediction_service.PredictLongRunningRequest() - assert args[0] == request_msg @@ -3152,7 +3167,6 @@ def test_predict_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = prediction_service.PredictRequest() - assert args[0] == request_msg @@ -3174,7 +3188,6 @@ def test_predict_long_running_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = prediction_service.PredictLongRunningRequest() - assert args[0] == request_msg diff --git a/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1beta/test_retriever_service.py b/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1beta/test_retriever_service.py index fc58dfb8c906..cdb40dee7b3e 100644 --- a/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1beta/test_retriever_service.py +++ b/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1beta/test_retriever_service.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 @@ -110,6 +111,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" @@ -1343,8 +1359,8 @@ def test_retriever_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - retriever_service.CreateCorpusRequest, - dict, + retriever_service.CreateCorpusRequest(), + {}, ], ) def test_create_corpus(request_type, transport: str = "grpc"): @@ -1355,7 +1371,7 @@ def test_create_corpus(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_corpus), "__call__") as call: @@ -1399,7 +1415,8 @@ def test_create_corpus_non_empty_request_with_auto_populated_field(): client.create_corpus(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == retriever_service.CreateCorpusRequest() + request_msg = retriever_service.CreateCorpusRequest() + assert args[0] == request_msg def test_create_corpus_use_cached_wrapped_rpc(): @@ -1480,9 +1497,14 @@ async def test_create_corpus_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_corpus_async( - transport: str = "grpc_asyncio", request_type=retriever_service.CreateCorpusRequest -): +@pytest.mark.parametrize( + "request_type", + [ + retriever_service.CreateCorpusRequest(), + {}, + ], +) +async def test_create_corpus_async(request_type, transport: str = "grpc_asyncio"): client = RetrieverServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1490,7 +1512,7 @@ async def test_create_corpus_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_corpus), "__call__") as call: @@ -1515,11 +1537,6 @@ async def test_create_corpus_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_create_corpus_async_from_dict(): - await test_create_corpus_async(request_type=dict) - - def test_create_corpus_flattened(): client = RetrieverServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1603,8 +1620,8 @@ async def test_create_corpus_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - retriever_service.GetCorpusRequest, - dict, + retriever_service.GetCorpusRequest(), + {}, ], ) def test_get_corpus(request_type, transport: str = "grpc"): @@ -1615,7 +1632,7 @@ def test_get_corpus(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_corpus), "__call__") as call: @@ -1661,9 +1678,10 @@ def test_get_corpus_non_empty_request_with_auto_populated_field(): client.get_corpus(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == retriever_service.GetCorpusRequest( + request_msg = retriever_service.GetCorpusRequest( name="name_value", ) + assert args[0] == request_msg def test_get_corpus_use_cached_wrapped_rpc(): @@ -1742,9 +1760,14 @@ async def test_get_corpus_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_corpus_async( - transport: str = "grpc_asyncio", request_type=retriever_service.GetCorpusRequest -): +@pytest.mark.parametrize( + "request_type", + [ + retriever_service.GetCorpusRequest(), + {}, + ], +) +async def test_get_corpus_async(request_type, transport: str = "grpc_asyncio"): client = RetrieverServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1752,7 +1775,7 @@ async def test_get_corpus_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_corpus), "__call__") as call: @@ -1777,11 +1800,6 @@ async def test_get_corpus_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_get_corpus_async_from_dict(): - await test_get_corpus_async(request_type=dict) - - def test_get_corpus_field_headers(): client = RetrieverServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1924,8 +1942,8 @@ async def test_get_corpus_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - retriever_service.UpdateCorpusRequest, - dict, + retriever_service.UpdateCorpusRequest(), + {}, ], ) def test_update_corpus(request_type, transport: str = "grpc"): @@ -1936,7 +1954,7 @@ def test_update_corpus(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_corpus), "__call__") as call: @@ -1980,7 +1998,8 @@ def test_update_corpus_non_empty_request_with_auto_populated_field(): client.update_corpus(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == retriever_service.UpdateCorpusRequest() + request_msg = retriever_service.UpdateCorpusRequest() + assert args[0] == request_msg def test_update_corpus_use_cached_wrapped_rpc(): @@ -2061,9 +2080,14 @@ async def test_update_corpus_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_corpus_async( - transport: str = "grpc_asyncio", request_type=retriever_service.UpdateCorpusRequest -): +@pytest.mark.parametrize( + "request_type", + [ + retriever_service.UpdateCorpusRequest(), + {}, + ], +) +async def test_update_corpus_async(request_type, transport: str = "grpc_asyncio"): client = RetrieverServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2071,7 +2095,7 @@ async def test_update_corpus_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_corpus), "__call__") as call: @@ -2096,11 +2120,6 @@ async def test_update_corpus_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_update_corpus_async_from_dict(): - await test_update_corpus_async(request_type=dict) - - def test_update_corpus_field_headers(): client = RetrieverServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2253,8 +2272,8 @@ async def test_update_corpus_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - retriever_service.DeleteCorpusRequest, - dict, + retriever_service.DeleteCorpusRequest(), + {}, ], ) def test_delete_corpus(request_type, transport: str = "grpc"): @@ -2265,7 +2284,7 @@ def test_delete_corpus(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_corpus), "__call__") as call: @@ -2306,9 +2325,10 @@ def test_delete_corpus_non_empty_request_with_auto_populated_field(): client.delete_corpus(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == retriever_service.DeleteCorpusRequest( + request_msg = retriever_service.DeleteCorpusRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_corpus_use_cached_wrapped_rpc(): @@ -2389,9 +2409,14 @@ async def test_delete_corpus_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_corpus_async( - transport: str = "grpc_asyncio", request_type=retriever_service.DeleteCorpusRequest -): +@pytest.mark.parametrize( + "request_type", + [ + retriever_service.DeleteCorpusRequest(), + {}, + ], +) +async def test_delete_corpus_async(request_type, transport: str = "grpc_asyncio"): client = RetrieverServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2399,7 +2424,7 @@ async def test_delete_corpus_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_corpus), "__call__") as call: @@ -2417,11 +2442,6 @@ async def test_delete_corpus_async( assert response is None -@pytest.mark.asyncio -async def test_delete_corpus_async_from_dict(): - await test_delete_corpus_async(request_type=dict) - - def test_delete_corpus_field_headers(): client = RetrieverServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2564,8 +2584,8 @@ async def test_delete_corpus_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - retriever_service.ListCorporaRequest, - dict, + retriever_service.ListCorporaRequest(), + {}, ], ) def test_list_corpora(request_type, transport: str = "grpc"): @@ -2576,7 +2596,7 @@ def test_list_corpora(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_corpora), "__call__") as call: @@ -2620,9 +2640,10 @@ def test_list_corpora_non_empty_request_with_auto_populated_field(): client.list_corpora(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == retriever_service.ListCorporaRequest( + request_msg = retriever_service.ListCorporaRequest( page_token="page_token_value", ) + assert args[0] == request_msg def test_list_corpora_use_cached_wrapped_rpc(): @@ -2703,9 +2724,14 @@ async def test_list_corpora_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_corpora_async( - transport: str = "grpc_asyncio", request_type=retriever_service.ListCorporaRequest -): +@pytest.mark.parametrize( + "request_type", + [ + retriever_service.ListCorporaRequest(), + {}, + ], +) +async def test_list_corpora_async(request_type, transport: str = "grpc_asyncio"): client = RetrieverServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2713,7 +2739,7 @@ async def test_list_corpora_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_corpora), "__call__") as call: @@ -2736,11 +2762,6 @@ async def test_list_corpora_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_corpora_async_from_dict(): - await test_list_corpora_async(request_type=dict) - - def test_list_corpora_pager(transport_name: str = "grpc"): client = RetrieverServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2931,8 +2952,8 @@ async def test_list_corpora_async_pages(): @pytest.mark.parametrize( "request_type", [ - retriever_service.QueryCorpusRequest, - dict, + retriever_service.QueryCorpusRequest(), + {}, ], ) def test_query_corpus(request_type, transport: str = "grpc"): @@ -2943,7 +2964,7 @@ def test_query_corpus(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.query_corpus), "__call__") as call: @@ -2985,10 +3006,11 @@ def test_query_corpus_non_empty_request_with_auto_populated_field(): client.query_corpus(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == retriever_service.QueryCorpusRequest( + request_msg = retriever_service.QueryCorpusRequest( name="name_value", query="query_value", ) + assert args[0] == request_msg def test_query_corpus_use_cached_wrapped_rpc(): @@ -3069,9 +3091,14 @@ async def test_query_corpus_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_query_corpus_async( - transport: str = "grpc_asyncio", request_type=retriever_service.QueryCorpusRequest -): +@pytest.mark.parametrize( + "request_type", + [ + retriever_service.QueryCorpusRequest(), + {}, + ], +) +async def test_query_corpus_async(request_type, transport: str = "grpc_asyncio"): client = RetrieverServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3079,7 +3106,7 @@ async def test_query_corpus_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.query_corpus), "__call__") as call: @@ -3099,11 +3126,6 @@ async def test_query_corpus_async( assert isinstance(response, retriever_service.QueryCorpusResponse) -@pytest.mark.asyncio -async def test_query_corpus_async_from_dict(): - await test_query_corpus_async(request_type=dict) - - def test_query_corpus_field_headers(): client = RetrieverServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3168,8 +3190,8 @@ async def test_query_corpus_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - retriever_service.CreateDocumentRequest, - dict, + retriever_service.CreateDocumentRequest(), + {}, ], ) def test_create_document(request_type, transport: str = "grpc"): @@ -3180,7 +3202,7 @@ def test_create_document(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_document), "__call__") as call: @@ -3226,9 +3248,10 @@ def test_create_document_non_empty_request_with_auto_populated_field(): client.create_document(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == retriever_service.CreateDocumentRequest( + request_msg = retriever_service.CreateDocumentRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_document_use_cached_wrapped_rpc(): @@ -3309,10 +3332,14 @@ async def test_create_document_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_document_async( - transport: str = "grpc_asyncio", - request_type=retriever_service.CreateDocumentRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + retriever_service.CreateDocumentRequest(), + {}, + ], +) +async def test_create_document_async(request_type, transport: str = "grpc_asyncio"): client = RetrieverServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3320,7 +3347,7 @@ async def test_create_document_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_document), "__call__") as call: @@ -3345,11 +3372,6 @@ async def test_create_document_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_create_document_async_from_dict(): - await test_create_document_async(request_type=dict) - - def test_create_document_field_headers(): client = RetrieverServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3502,8 +3524,8 @@ async def test_create_document_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - retriever_service.GetDocumentRequest, - dict, + retriever_service.GetDocumentRequest(), + {}, ], ) def test_get_document(request_type, transport: str = "grpc"): @@ -3514,7 +3536,7 @@ def test_get_document(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_document), "__call__") as call: @@ -3560,9 +3582,10 @@ def test_get_document_non_empty_request_with_auto_populated_field(): client.get_document(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == retriever_service.GetDocumentRequest( + request_msg = retriever_service.GetDocumentRequest( name="name_value", ) + assert args[0] == request_msg def test_get_document_use_cached_wrapped_rpc(): @@ -3643,9 +3666,14 @@ async def test_get_document_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_document_async( - transport: str = "grpc_asyncio", request_type=retriever_service.GetDocumentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + retriever_service.GetDocumentRequest(), + {}, + ], +) +async def test_get_document_async(request_type, transport: str = "grpc_asyncio"): client = RetrieverServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3653,7 +3681,7 @@ async def test_get_document_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_document), "__call__") as call: @@ -3678,11 +3706,6 @@ async def test_get_document_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_get_document_async_from_dict(): - await test_get_document_async(request_type=dict) - - def test_get_document_field_headers(): client = RetrieverServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3825,8 +3848,8 @@ async def test_get_document_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - retriever_service.UpdateDocumentRequest, - dict, + retriever_service.UpdateDocumentRequest(), + {}, ], ) def test_update_document(request_type, transport: str = "grpc"): @@ -3837,7 +3860,7 @@ def test_update_document(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_document), "__call__") as call: @@ -3881,7 +3904,8 @@ def test_update_document_non_empty_request_with_auto_populated_field(): client.update_document(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == retriever_service.UpdateDocumentRequest() + request_msg = retriever_service.UpdateDocumentRequest() + assert args[0] == request_msg def test_update_document_use_cached_wrapped_rpc(): @@ -3962,10 +3986,14 @@ async def test_update_document_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_document_async( - transport: str = "grpc_asyncio", - request_type=retriever_service.UpdateDocumentRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + retriever_service.UpdateDocumentRequest(), + {}, + ], +) +async def test_update_document_async(request_type, transport: str = "grpc_asyncio"): client = RetrieverServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3973,7 +4001,7 @@ async def test_update_document_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_document), "__call__") as call: @@ -3998,11 +4026,6 @@ async def test_update_document_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_update_document_async_from_dict(): - await test_update_document_async(request_type=dict) - - def test_update_document_field_headers(): client = RetrieverServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4155,8 +4178,8 @@ async def test_update_document_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - retriever_service.DeleteDocumentRequest, - dict, + retriever_service.DeleteDocumentRequest(), + {}, ], ) def test_delete_document(request_type, transport: str = "grpc"): @@ -4167,7 +4190,7 @@ def test_delete_document(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_document), "__call__") as call: @@ -4208,9 +4231,10 @@ def test_delete_document_non_empty_request_with_auto_populated_field(): client.delete_document(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == retriever_service.DeleteDocumentRequest( + request_msg = retriever_service.DeleteDocumentRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_document_use_cached_wrapped_rpc(): @@ -4291,10 +4315,14 @@ async def test_delete_document_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_document_async( - transport: str = "grpc_asyncio", - request_type=retriever_service.DeleteDocumentRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + retriever_service.DeleteDocumentRequest(), + {}, + ], +) +async def test_delete_document_async(request_type, transport: str = "grpc_asyncio"): client = RetrieverServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4302,7 +4330,7 @@ async def test_delete_document_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_document), "__call__") as call: @@ -4320,11 +4348,6 @@ async def test_delete_document_async( assert response is None -@pytest.mark.asyncio -async def test_delete_document_async_from_dict(): - await test_delete_document_async(request_type=dict) - - def test_delete_document_field_headers(): client = RetrieverServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4467,8 +4490,8 @@ async def test_delete_document_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - retriever_service.ListDocumentsRequest, - dict, + retriever_service.ListDocumentsRequest(), + {}, ], ) def test_list_documents(request_type, transport: str = "grpc"): @@ -4479,7 +4502,7 @@ def test_list_documents(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_documents), "__call__") as call: @@ -4524,10 +4547,11 @@ def test_list_documents_non_empty_request_with_auto_populated_field(): client.list_documents(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == retriever_service.ListDocumentsRequest( + request_msg = retriever_service.ListDocumentsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_documents_use_cached_wrapped_rpc(): @@ -4608,9 +4632,14 @@ async def test_list_documents_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_documents_async( - transport: str = "grpc_asyncio", request_type=retriever_service.ListDocumentsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + retriever_service.ListDocumentsRequest(), + {}, + ], +) +async def test_list_documents_async(request_type, transport: str = "grpc_asyncio"): client = RetrieverServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4618,7 +4647,7 @@ async def test_list_documents_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_documents), "__call__") as call: @@ -4641,11 +4670,6 @@ async def test_list_documents_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_documents_async_from_dict(): - await test_list_documents_async(request_type=dict) - - def test_list_documents_field_headers(): client = RetrieverServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4982,8 +5006,8 @@ async def test_list_documents_async_pages(): @pytest.mark.parametrize( "request_type", [ - retriever_service.QueryDocumentRequest, - dict, + retriever_service.QueryDocumentRequest(), + {}, ], ) def test_query_document(request_type, transport: str = "grpc"): @@ -4994,7 +5018,7 @@ def test_query_document(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.query_document), "__call__") as call: @@ -5036,10 +5060,11 @@ def test_query_document_non_empty_request_with_auto_populated_field(): client.query_document(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == retriever_service.QueryDocumentRequest( + request_msg = retriever_service.QueryDocumentRequest( name="name_value", query="query_value", ) + assert args[0] == request_msg def test_query_document_use_cached_wrapped_rpc(): @@ -5120,9 +5145,14 @@ async def test_query_document_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_query_document_async( - transport: str = "grpc_asyncio", request_type=retriever_service.QueryDocumentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + retriever_service.QueryDocumentRequest(), + {}, + ], +) +async def test_query_document_async(request_type, transport: str = "grpc_asyncio"): client = RetrieverServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5130,7 +5160,7 @@ async def test_query_document_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.query_document), "__call__") as call: @@ -5150,11 +5180,6 @@ async def test_query_document_async( assert isinstance(response, retriever_service.QueryDocumentResponse) -@pytest.mark.asyncio -async def test_query_document_async_from_dict(): - await test_query_document_async(request_type=dict) - - def test_query_document_field_headers(): client = RetrieverServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5219,8 +5244,8 @@ async def test_query_document_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - retriever_service.CreateChunkRequest, - dict, + retriever_service.CreateChunkRequest(), + {}, ], ) def test_create_chunk(request_type, transport: str = "grpc"): @@ -5231,7 +5256,7 @@ def test_create_chunk(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_chunk), "__call__") as call: @@ -5277,9 +5302,10 @@ def test_create_chunk_non_empty_request_with_auto_populated_field(): client.create_chunk(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == retriever_service.CreateChunkRequest( + request_msg = retriever_service.CreateChunkRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_chunk_use_cached_wrapped_rpc(): @@ -5360,9 +5386,14 @@ async def test_create_chunk_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_chunk_async( - transport: str = "grpc_asyncio", request_type=retriever_service.CreateChunkRequest -): +@pytest.mark.parametrize( + "request_type", + [ + retriever_service.CreateChunkRequest(), + {}, + ], +) +async def test_create_chunk_async(request_type, transport: str = "grpc_asyncio"): client = RetrieverServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5370,7 +5401,7 @@ async def test_create_chunk_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_chunk), "__call__") as call: @@ -5395,11 +5426,6 @@ async def test_create_chunk_async( assert response.state == retriever.Chunk.State.STATE_PENDING_PROCESSING -@pytest.mark.asyncio -async def test_create_chunk_async_from_dict(): - await test_create_chunk_async(request_type=dict) - - def test_create_chunk_field_headers(): client = RetrieverServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5552,8 +5578,8 @@ async def test_create_chunk_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - retriever_service.BatchCreateChunksRequest, - dict, + retriever_service.BatchCreateChunksRequest(), + {}, ], ) def test_batch_create_chunks(request_type, transport: str = "grpc"): @@ -5564,7 +5590,7 @@ def test_batch_create_chunks(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5609,9 +5635,10 @@ def test_batch_create_chunks_non_empty_request_with_auto_populated_field(): client.batch_create_chunks(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == retriever_service.BatchCreateChunksRequest( + request_msg = retriever_service.BatchCreateChunksRequest( parent="parent_value", ) + assert args[0] == request_msg def test_batch_create_chunks_use_cached_wrapped_rpc(): @@ -5696,10 +5723,14 @@ async def test_batch_create_chunks_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_batch_create_chunks_async( - transport: str = "grpc_asyncio", - request_type=retriever_service.BatchCreateChunksRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + retriever_service.BatchCreateChunksRequest(), + {}, + ], +) +async def test_batch_create_chunks_async(request_type, transport: str = "grpc_asyncio"): client = RetrieverServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5707,7 +5738,7 @@ async def test_batch_create_chunks_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( @@ -5729,11 +5760,6 @@ async def test_batch_create_chunks_async( assert isinstance(response, retriever_service.BatchCreateChunksResponse) -@pytest.mark.asyncio -async def test_batch_create_chunks_async_from_dict(): - await test_batch_create_chunks_async(request_type=dict) - - def test_batch_create_chunks_field_headers(): client = RetrieverServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5802,8 +5828,8 @@ async def test_batch_create_chunks_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - retriever_service.GetChunkRequest, - dict, + retriever_service.GetChunkRequest(), + {}, ], ) def test_get_chunk(request_type, transport: str = "grpc"): @@ -5814,7 +5840,7 @@ def test_get_chunk(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_chunk), "__call__") as call: @@ -5860,9 +5886,10 @@ def test_get_chunk_non_empty_request_with_auto_populated_field(): client.get_chunk(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == retriever_service.GetChunkRequest( + request_msg = retriever_service.GetChunkRequest( name="name_value", ) + assert args[0] == request_msg def test_get_chunk_use_cached_wrapped_rpc(): @@ -5941,9 +5968,14 @@ async def test_get_chunk_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_chunk_async( - transport: str = "grpc_asyncio", request_type=retriever_service.GetChunkRequest -): +@pytest.mark.parametrize( + "request_type", + [ + retriever_service.GetChunkRequest(), + {}, + ], +) +async def test_get_chunk_async(request_type, transport: str = "grpc_asyncio"): client = RetrieverServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5951,7 +5983,7 @@ async def test_get_chunk_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_chunk), "__call__") as call: @@ -5976,11 +6008,6 @@ async def test_get_chunk_async( assert response.state == retriever.Chunk.State.STATE_PENDING_PROCESSING -@pytest.mark.asyncio -async def test_get_chunk_async_from_dict(): - await test_get_chunk_async(request_type=dict) - - def test_get_chunk_field_headers(): client = RetrieverServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6123,8 +6150,8 @@ async def test_get_chunk_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - retriever_service.UpdateChunkRequest, - dict, + retriever_service.UpdateChunkRequest(), + {}, ], ) def test_update_chunk(request_type, transport: str = "grpc"): @@ -6135,7 +6162,7 @@ def test_update_chunk(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_chunk), "__call__") as call: @@ -6179,7 +6206,8 @@ def test_update_chunk_non_empty_request_with_auto_populated_field(): client.update_chunk(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == retriever_service.UpdateChunkRequest() + request_msg = retriever_service.UpdateChunkRequest() + assert args[0] == request_msg def test_update_chunk_use_cached_wrapped_rpc(): @@ -6260,9 +6288,14 @@ async def test_update_chunk_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_chunk_async( - transport: str = "grpc_asyncio", request_type=retriever_service.UpdateChunkRequest -): +@pytest.mark.parametrize( + "request_type", + [ + retriever_service.UpdateChunkRequest(), + {}, + ], +) +async def test_update_chunk_async(request_type, transport: str = "grpc_asyncio"): client = RetrieverServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6270,7 +6303,7 @@ async def test_update_chunk_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_chunk), "__call__") as call: @@ -6295,11 +6328,6 @@ async def test_update_chunk_async( assert response.state == retriever.Chunk.State.STATE_PENDING_PROCESSING -@pytest.mark.asyncio -async def test_update_chunk_async_from_dict(): - await test_update_chunk_async(request_type=dict) - - def test_update_chunk_field_headers(): client = RetrieverServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6452,8 +6480,8 @@ async def test_update_chunk_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - retriever_service.BatchUpdateChunksRequest, - dict, + retriever_service.BatchUpdateChunksRequest(), + {}, ], ) def test_batch_update_chunks(request_type, transport: str = "grpc"): @@ -6464,7 +6492,7 @@ def test_batch_update_chunks(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6509,9 +6537,10 @@ def test_batch_update_chunks_non_empty_request_with_auto_populated_field(): client.batch_update_chunks(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == retriever_service.BatchUpdateChunksRequest( + request_msg = retriever_service.BatchUpdateChunksRequest( parent="parent_value", ) + assert args[0] == request_msg def test_batch_update_chunks_use_cached_wrapped_rpc(): @@ -6596,10 +6625,14 @@ async def test_batch_update_chunks_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_batch_update_chunks_async( - transport: str = "grpc_asyncio", - request_type=retriever_service.BatchUpdateChunksRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + retriever_service.BatchUpdateChunksRequest(), + {}, + ], +) +async def test_batch_update_chunks_async(request_type, transport: str = "grpc_asyncio"): client = RetrieverServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6607,7 +6640,7 @@ async def test_batch_update_chunks_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( @@ -6629,11 +6662,6 @@ async def test_batch_update_chunks_async( assert isinstance(response, retriever_service.BatchUpdateChunksResponse) -@pytest.mark.asyncio -async def test_batch_update_chunks_async_from_dict(): - await test_batch_update_chunks_async(request_type=dict) - - def test_batch_update_chunks_field_headers(): client = RetrieverServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6702,8 +6730,8 @@ async def test_batch_update_chunks_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - retriever_service.DeleteChunkRequest, - dict, + retriever_service.DeleteChunkRequest(), + {}, ], ) def test_delete_chunk(request_type, transport: str = "grpc"): @@ -6714,7 +6742,7 @@ def test_delete_chunk(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_chunk), "__call__") as call: @@ -6755,9 +6783,10 @@ def test_delete_chunk_non_empty_request_with_auto_populated_field(): client.delete_chunk(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == retriever_service.DeleteChunkRequest( + request_msg = retriever_service.DeleteChunkRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_chunk_use_cached_wrapped_rpc(): @@ -6838,9 +6867,14 @@ async def test_delete_chunk_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_chunk_async( - transport: str = "grpc_asyncio", request_type=retriever_service.DeleteChunkRequest -): +@pytest.mark.parametrize( + "request_type", + [ + retriever_service.DeleteChunkRequest(), + {}, + ], +) +async def test_delete_chunk_async(request_type, transport: str = "grpc_asyncio"): client = RetrieverServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6848,7 +6882,7 @@ async def test_delete_chunk_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_chunk), "__call__") as call: @@ -6866,11 +6900,6 @@ async def test_delete_chunk_async( assert response is None -@pytest.mark.asyncio -async def test_delete_chunk_async_from_dict(): - await test_delete_chunk_async(request_type=dict) - - def test_delete_chunk_field_headers(): client = RetrieverServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7013,8 +7042,8 @@ async def test_delete_chunk_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - retriever_service.BatchDeleteChunksRequest, - dict, + retriever_service.BatchDeleteChunksRequest(), + {}, ], ) def test_batch_delete_chunks(request_type, transport: str = "grpc"): @@ -7025,7 +7054,7 @@ def test_batch_delete_chunks(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7070,9 +7099,10 @@ def test_batch_delete_chunks_non_empty_request_with_auto_populated_field(): client.batch_delete_chunks(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == retriever_service.BatchDeleteChunksRequest( + request_msg = retriever_service.BatchDeleteChunksRequest( parent="parent_value", ) + assert args[0] == request_msg def test_batch_delete_chunks_use_cached_wrapped_rpc(): @@ -7157,10 +7187,14 @@ async def test_batch_delete_chunks_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_batch_delete_chunks_async( - transport: str = "grpc_asyncio", - request_type=retriever_service.BatchDeleteChunksRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + retriever_service.BatchDeleteChunksRequest(), + {}, + ], +) +async def test_batch_delete_chunks_async(request_type, transport: str = "grpc_asyncio"): client = RetrieverServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7168,7 +7202,7 @@ async def test_batch_delete_chunks_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( @@ -7188,11 +7222,6 @@ async def test_batch_delete_chunks_async( assert response is None -@pytest.mark.asyncio -async def test_batch_delete_chunks_async_from_dict(): - await test_batch_delete_chunks_async(request_type=dict) - - def test_batch_delete_chunks_field_headers(): client = RetrieverServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7259,8 +7288,8 @@ async def test_batch_delete_chunks_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - retriever_service.ListChunksRequest, - dict, + retriever_service.ListChunksRequest(), + {}, ], ) def test_list_chunks(request_type, transport: str = "grpc"): @@ -7271,7 +7300,7 @@ def test_list_chunks(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_chunks), "__call__") as call: @@ -7316,10 +7345,11 @@ def test_list_chunks_non_empty_request_with_auto_populated_field(): client.list_chunks(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == retriever_service.ListChunksRequest( + request_msg = retriever_service.ListChunksRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_chunks_use_cached_wrapped_rpc(): @@ -7400,9 +7430,14 @@ async def test_list_chunks_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_chunks_async( - transport: str = "grpc_asyncio", request_type=retriever_service.ListChunksRequest -): +@pytest.mark.parametrize( + "request_type", + [ + retriever_service.ListChunksRequest(), + {}, + ], +) +async def test_list_chunks_async(request_type, transport: str = "grpc_asyncio"): client = RetrieverServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7410,7 +7445,7 @@ async def test_list_chunks_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_chunks), "__call__") as call: @@ -7433,11 +7468,6 @@ async def test_list_chunks_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_chunks_async_from_dict(): - await test_list_chunks_async(request_type=dict) - - def test_list_chunks_field_headers(): client = RetrieverServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11274,7 +11304,6 @@ def test_create_corpus_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.CreateCorpusRequest() - assert args[0] == request_msg @@ -11295,7 +11324,6 @@ def test_get_corpus_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.GetCorpusRequest() - assert args[0] == request_msg @@ -11316,7 +11344,6 @@ def test_update_corpus_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.UpdateCorpusRequest() - assert args[0] == request_msg @@ -11337,7 +11364,6 @@ def test_delete_corpus_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.DeleteCorpusRequest() - assert args[0] == request_msg @@ -11358,7 +11384,6 @@ def test_list_corpora_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.ListCorporaRequest() - assert args[0] == request_msg @@ -11379,7 +11404,6 @@ def test_query_corpus_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.QueryCorpusRequest() - assert args[0] == request_msg @@ -11400,7 +11424,6 @@ def test_create_document_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.CreateDocumentRequest() - assert args[0] == request_msg @@ -11421,7 +11444,6 @@ def test_get_document_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.GetDocumentRequest() - assert args[0] == request_msg @@ -11442,7 +11464,6 @@ def test_update_document_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.UpdateDocumentRequest() - assert args[0] == request_msg @@ -11463,7 +11484,6 @@ def test_delete_document_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.DeleteDocumentRequest() - assert args[0] == request_msg @@ -11484,7 +11504,6 @@ def test_list_documents_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.ListDocumentsRequest() - assert args[0] == request_msg @@ -11505,7 +11524,6 @@ def test_query_document_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.QueryDocumentRequest() - assert args[0] == request_msg @@ -11526,7 +11544,6 @@ def test_create_chunk_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.CreateChunkRequest() - assert args[0] == request_msg @@ -11549,7 +11566,6 @@ def test_batch_create_chunks_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.BatchCreateChunksRequest() - assert args[0] == request_msg @@ -11570,7 +11586,6 @@ def test_get_chunk_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.GetChunkRequest() - assert args[0] == request_msg @@ -11591,7 +11606,6 @@ def test_update_chunk_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.UpdateChunkRequest() - assert args[0] == request_msg @@ -11614,7 +11628,6 @@ def test_batch_update_chunks_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.BatchUpdateChunksRequest() - assert args[0] == request_msg @@ -11635,7 +11648,6 @@ def test_delete_chunk_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.DeleteChunkRequest() - assert args[0] == request_msg @@ -11658,7 +11670,6 @@ def test_batch_delete_chunks_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.BatchDeleteChunksRequest() - assert args[0] == request_msg @@ -11679,7 +11690,6 @@ def test_list_chunks_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.ListChunksRequest() - assert args[0] == request_msg @@ -11721,7 +11731,6 @@ async def test_create_corpus_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.CreateCorpusRequest() - assert args[0] == request_msg @@ -11749,7 +11758,6 @@ async def test_get_corpus_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.GetCorpusRequest() - assert args[0] == request_msg @@ -11777,7 +11785,6 @@ async def test_update_corpus_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.UpdateCorpusRequest() - assert args[0] == request_msg @@ -11800,7 +11807,6 @@ async def test_delete_corpus_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.DeleteCorpusRequest() - assert args[0] == request_msg @@ -11827,7 +11833,6 @@ async def test_list_corpora_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.ListCorporaRequest() - assert args[0] == request_msg @@ -11852,7 +11857,6 @@ async def test_query_corpus_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.QueryCorpusRequest() - assert args[0] == request_msg @@ -11880,7 +11884,6 @@ async def test_create_document_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.CreateDocumentRequest() - assert args[0] == request_msg @@ -11908,7 +11911,6 @@ async def test_get_document_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.GetDocumentRequest() - assert args[0] == request_msg @@ -11936,7 +11938,6 @@ async def test_update_document_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.UpdateDocumentRequest() - assert args[0] == request_msg @@ -11959,7 +11960,6 @@ async def test_delete_document_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.DeleteDocumentRequest() - assert args[0] == request_msg @@ -11986,7 +11986,6 @@ async def test_list_documents_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.ListDocumentsRequest() - assert args[0] == request_msg @@ -12011,7 +12010,6 @@ async def test_query_document_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.QueryDocumentRequest() - assert args[0] == request_msg @@ -12039,7 +12037,6 @@ async def test_create_chunk_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.CreateChunkRequest() - assert args[0] == request_msg @@ -12066,7 +12063,6 @@ async def test_batch_create_chunks_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.BatchCreateChunksRequest() - assert args[0] == request_msg @@ -12094,7 +12090,6 @@ async def test_get_chunk_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.GetChunkRequest() - assert args[0] == request_msg @@ -12122,7 +12117,6 @@ async def test_update_chunk_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.UpdateChunkRequest() - assert args[0] == request_msg @@ -12149,7 +12143,6 @@ async def test_batch_update_chunks_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.BatchUpdateChunksRequest() - assert args[0] == request_msg @@ -12172,7 +12165,6 @@ async def test_delete_chunk_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.DeleteChunkRequest() - assert args[0] == request_msg @@ -12197,7 +12189,6 @@ async def test_batch_delete_chunks_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.BatchDeleteChunksRequest() - assert args[0] == request_msg @@ -12224,7 +12215,6 @@ async def test_list_chunks_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.ListChunksRequest() - assert args[0] == request_msg @@ -15548,7 +15538,6 @@ def test_create_corpus_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.CreateCorpusRequest() - assert args[0] == request_msg @@ -15568,7 +15557,6 @@ def test_get_corpus_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.GetCorpusRequest() - assert args[0] == request_msg @@ -15588,7 +15576,6 @@ def test_update_corpus_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.UpdateCorpusRequest() - assert args[0] == request_msg @@ -15608,7 +15595,6 @@ def test_delete_corpus_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.DeleteCorpusRequest() - assert args[0] == request_msg @@ -15628,7 +15614,6 @@ def test_list_corpora_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.ListCorporaRequest() - assert args[0] == request_msg @@ -15648,7 +15633,6 @@ def test_query_corpus_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.QueryCorpusRequest() - assert args[0] == request_msg @@ -15668,7 +15652,6 @@ def test_create_document_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.CreateDocumentRequest() - assert args[0] == request_msg @@ -15688,7 +15671,6 @@ def test_get_document_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.GetDocumentRequest() - assert args[0] == request_msg @@ -15708,7 +15690,6 @@ def test_update_document_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.UpdateDocumentRequest() - assert args[0] == request_msg @@ -15728,7 +15709,6 @@ def test_delete_document_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.DeleteDocumentRequest() - assert args[0] == request_msg @@ -15748,7 +15728,6 @@ def test_list_documents_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.ListDocumentsRequest() - assert args[0] == request_msg @@ -15768,7 +15747,6 @@ def test_query_document_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.QueryDocumentRequest() - assert args[0] == request_msg @@ -15788,7 +15766,6 @@ def test_create_chunk_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.CreateChunkRequest() - assert args[0] == request_msg @@ -15810,7 +15787,6 @@ def test_batch_create_chunks_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.BatchCreateChunksRequest() - assert args[0] == request_msg @@ -15830,7 +15806,6 @@ def test_get_chunk_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.GetChunkRequest() - assert args[0] == request_msg @@ -15850,7 +15825,6 @@ def test_update_chunk_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.UpdateChunkRequest() - assert args[0] == request_msg @@ -15872,7 +15846,6 @@ def test_batch_update_chunks_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.BatchUpdateChunksRequest() - assert args[0] == request_msg @@ -15892,7 +15865,6 @@ def test_delete_chunk_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.DeleteChunkRequest() - assert args[0] == request_msg @@ -15914,7 +15886,6 @@ def test_batch_delete_chunks_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.BatchDeleteChunksRequest() - assert args[0] == request_msg @@ -15934,7 +15905,6 @@ def test_list_chunks_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = retriever_service.ListChunksRequest() - assert args[0] == request_msg diff --git a/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1beta/test_text_service.py b/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1beta/test_text_service.py index ae0f0bac5e9f..096b03af7c3e 100644 --- a/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1beta/test_text_service.py +++ b/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1beta/test_text_service.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 @@ -107,6 +108,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" @@ -1272,8 +1288,8 @@ def test_text_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - text_service.GenerateTextRequest, - dict, + text_service.GenerateTextRequest(), + {}, ], ) def test_generate_text(request_type, transport: str = "grpc"): @@ -1284,7 +1300,7 @@ def test_generate_text(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.generate_text), "__call__") as call: @@ -1325,9 +1341,10 @@ def test_generate_text_non_empty_request_with_auto_populated_field(): client.generate_text(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == text_service.GenerateTextRequest( + request_msg = text_service.GenerateTextRequest( model="model_value", ) + assert args[0] == request_msg def test_generate_text_use_cached_wrapped_rpc(): @@ -1408,9 +1425,14 @@ async def test_generate_text_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_generate_text_async( - transport: str = "grpc_asyncio", request_type=text_service.GenerateTextRequest -): +@pytest.mark.parametrize( + "request_type", + [ + text_service.GenerateTextRequest(), + {}, + ], +) +async def test_generate_text_async(request_type, transport: str = "grpc_asyncio"): client = TextServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1418,7 +1440,7 @@ async def test_generate_text_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.generate_text), "__call__") as call: @@ -1438,11 +1460,6 @@ async def test_generate_text_async( assert isinstance(response, text_service.GenerateTextResponse) -@pytest.mark.asyncio -async def test_generate_text_async_from_dict(): - await test_generate_text_async(request_type=dict) - - def test_generate_text_field_headers(): client = TextServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1641,8 +1658,8 @@ async def test_generate_text_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - text_service.EmbedTextRequest, - dict, + text_service.EmbedTextRequest(), + {}, ], ) def test_embed_text(request_type, transport: str = "grpc"): @@ -1653,7 +1670,7 @@ def test_embed_text(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.embed_text), "__call__") as call: @@ -1695,10 +1712,11 @@ def test_embed_text_non_empty_request_with_auto_populated_field(): client.embed_text(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == text_service.EmbedTextRequest( + request_msg = text_service.EmbedTextRequest( model="model_value", text="text_value", ) + assert args[0] == request_msg def test_embed_text_use_cached_wrapped_rpc(): @@ -1777,9 +1795,14 @@ async def test_embed_text_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_embed_text_async( - transport: str = "grpc_asyncio", request_type=text_service.EmbedTextRequest -): +@pytest.mark.parametrize( + "request_type", + [ + text_service.EmbedTextRequest(), + {}, + ], +) +async def test_embed_text_async(request_type, transport: str = "grpc_asyncio"): client = TextServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1787,7 +1810,7 @@ async def test_embed_text_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.embed_text), "__call__") as call: @@ -1807,11 +1830,6 @@ async def test_embed_text_async( assert isinstance(response, text_service.EmbedTextResponse) -@pytest.mark.asyncio -async def test_embed_text_async_from_dict(): - await test_embed_text_async(request_type=dict) - - def test_embed_text_field_headers(): client = TextServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1968,8 +1986,8 @@ async def test_embed_text_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - text_service.BatchEmbedTextRequest, - dict, + text_service.BatchEmbedTextRequest(), + {}, ], ) def test_batch_embed_text(request_type, transport: str = "grpc"): @@ -1980,7 +1998,7 @@ def test_batch_embed_text(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.batch_embed_text), "__call__") as call: @@ -2021,9 +2039,10 @@ def test_batch_embed_text_non_empty_request_with_auto_populated_field(): client.batch_embed_text(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == text_service.BatchEmbedTextRequest( + request_msg = text_service.BatchEmbedTextRequest( model="model_value", ) + assert args[0] == request_msg def test_batch_embed_text_use_cached_wrapped_rpc(): @@ -2106,9 +2125,14 @@ async def test_batch_embed_text_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_batch_embed_text_async( - transport: str = "grpc_asyncio", request_type=text_service.BatchEmbedTextRequest -): +@pytest.mark.parametrize( + "request_type", + [ + text_service.BatchEmbedTextRequest(), + {}, + ], +) +async def test_batch_embed_text_async(request_type, transport: str = "grpc_asyncio"): client = TextServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2116,7 +2140,7 @@ async def test_batch_embed_text_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.batch_embed_text), "__call__") as call: @@ -2136,11 +2160,6 @@ async def test_batch_embed_text_async( assert isinstance(response, text_service.BatchEmbedTextResponse) -@pytest.mark.asyncio -async def test_batch_embed_text_async_from_dict(): - await test_batch_embed_text_async(request_type=dict) - - def test_batch_embed_text_field_headers(): client = TextServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2297,8 +2316,8 @@ async def test_batch_embed_text_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - text_service.CountTextTokensRequest, - dict, + text_service.CountTextTokensRequest(), + {}, ], ) def test_count_text_tokens(request_type, transport: str = "grpc"): @@ -2309,7 +2328,7 @@ def test_count_text_tokens(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2357,9 +2376,10 @@ def test_count_text_tokens_non_empty_request_with_auto_populated_field(): client.count_text_tokens(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == text_service.CountTextTokensRequest( + request_msg = text_service.CountTextTokensRequest( model="model_value", ) + assert args[0] == request_msg def test_count_text_tokens_use_cached_wrapped_rpc(): @@ -2442,9 +2462,14 @@ async def test_count_text_tokens_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_count_text_tokens_async( - transport: str = "grpc_asyncio", request_type=text_service.CountTextTokensRequest -): +@pytest.mark.parametrize( + "request_type", + [ + text_service.CountTextTokensRequest(), + {}, + ], +) +async def test_count_text_tokens_async(request_type, transport: str = "grpc_asyncio"): client = TextServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2452,7 +2477,7 @@ async def test_count_text_tokens_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( @@ -2477,11 +2502,6 @@ async def test_count_text_tokens_async( assert response.token_count == 1193 -@pytest.mark.asyncio -async def test_count_text_tokens_async_from_dict(): - await test_count_text_tokens_async(request_type=dict) - - def test_count_text_tokens_field_headers(): client = TextServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3512,7 +3532,6 @@ def test_generate_text_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = text_service.GenerateTextRequest() - assert args[0] == request_msg @@ -3533,7 +3552,6 @@ def test_embed_text_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = text_service.EmbedTextRequest() - assert args[0] == request_msg @@ -3554,7 +3572,6 @@ def test_batch_embed_text_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = text_service.BatchEmbedTextRequest() - assert args[0] == request_msg @@ -3577,7 +3594,6 @@ def test_count_text_tokens_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = text_service.CountTextTokensRequest() - assert args[0] == request_msg @@ -3616,7 +3632,6 @@ async def test_generate_text_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = text_service.GenerateTextRequest() - assert args[0] == request_msg @@ -3641,7 +3656,6 @@ async def test_embed_text_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = text_service.EmbedTextRequest() - assert args[0] == request_msg @@ -3666,7 +3680,6 @@ async def test_batch_embed_text_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = text_service.BatchEmbedTextRequest() - assert args[0] == request_msg @@ -3695,7 +3708,6 @@ async def test_count_text_tokens_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = text_service.CountTextTokensRequest() - assert args[0] == request_msg @@ -4495,7 +4507,6 @@ def test_generate_text_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = text_service.GenerateTextRequest() - assert args[0] == request_msg @@ -4515,7 +4526,6 @@ def test_embed_text_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = text_service.EmbedTextRequest() - assert args[0] == request_msg @@ -4535,7 +4545,6 @@ def test_batch_embed_text_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = text_service.BatchEmbedTextRequest() - assert args[0] == request_msg @@ -4557,7 +4566,6 @@ def test_count_text_tokens_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = text_service.CountTextTokensRequest() - assert args[0] == request_msg diff --git a/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1beta2/test_discuss_service.py b/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1beta2/test_discuss_service.py index ba2949367a10..d922c90d6dba 100644 --- a/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1beta2/test_discuss_service.py +++ b/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1beta2/test_discuss_service.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 @@ -106,6 +107,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" @@ -1309,8 +1325,8 @@ def test_discuss_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - discuss_service.GenerateMessageRequest, - dict, + discuss_service.GenerateMessageRequest(), + {}, ], ) def test_generate_message(request_type, transport: str = "grpc"): @@ -1321,7 +1337,7 @@ def test_generate_message(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.generate_message), "__call__") as call: @@ -1362,9 +1378,10 @@ def test_generate_message_non_empty_request_with_auto_populated_field(): client.generate_message(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == discuss_service.GenerateMessageRequest( + request_msg = discuss_service.GenerateMessageRequest( model="model_value", ) + assert args[0] == request_msg def test_generate_message_use_cached_wrapped_rpc(): @@ -1447,9 +1464,14 @@ async def test_generate_message_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_generate_message_async( - transport: str = "grpc_asyncio", request_type=discuss_service.GenerateMessageRequest -): +@pytest.mark.parametrize( + "request_type", + [ + discuss_service.GenerateMessageRequest(), + {}, + ], +) +async def test_generate_message_async(request_type, transport: str = "grpc_asyncio"): client = DiscussServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1457,7 +1479,7 @@ async def test_generate_message_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.generate_message), "__call__") as call: @@ -1477,11 +1499,6 @@ async def test_generate_message_async( assert isinstance(response, discuss_service.GenerateMessageResponse) -@pytest.mark.asyncio -async def test_generate_message_async_from_dict(): - await test_generate_message_async(request_type=dict) - - def test_generate_message_field_headers(): client = DiscussServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1670,8 +1687,8 @@ async def test_generate_message_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - discuss_service.CountMessageTokensRequest, - dict, + discuss_service.CountMessageTokensRequest(), + {}, ], ) def test_count_message_tokens(request_type, transport: str = "grpc"): @@ -1682,7 +1699,7 @@ def test_count_message_tokens(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1730,9 +1747,10 @@ def test_count_message_tokens_non_empty_request_with_auto_populated_field(): client.count_message_tokens(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == discuss_service.CountMessageTokensRequest( + request_msg = discuss_service.CountMessageTokensRequest( model="model_value", ) + assert args[0] == request_msg def test_count_message_tokens_use_cached_wrapped_rpc(): @@ -1817,9 +1835,15 @@ async def test_count_message_tokens_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + discuss_service.CountMessageTokensRequest(), + {}, + ], +) async def test_count_message_tokens_async( - transport: str = "grpc_asyncio", - request_type=discuss_service.CountMessageTokensRequest, + request_type, transport: str = "grpc_asyncio" ): client = DiscussServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1828,7 +1852,7 @@ async def test_count_message_tokens_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( @@ -1853,11 +1877,6 @@ async def test_count_message_tokens_async( assert response.token_count == 1193 -@pytest.mark.asyncio -async def test_count_message_tokens_async_from_dict(): - await test_count_message_tokens_async(request_type=dict) - - def test_count_message_tokens_field_headers(): client = DiscussServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2532,7 +2551,6 @@ def test_generate_message_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = discuss_service.GenerateMessageRequest() - assert args[0] == request_msg @@ -2555,7 +2573,6 @@ def test_count_message_tokens_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = discuss_service.CountMessageTokensRequest() - assert args[0] == request_msg @@ -2594,7 +2611,6 @@ async def test_generate_message_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = discuss_service.GenerateMessageRequest() - assert args[0] == request_msg @@ -2623,7 +2639,6 @@ async def test_count_message_tokens_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = discuss_service.CountMessageTokensRequest() - assert args[0] == request_msg @@ -2926,7 +2941,6 @@ def test_generate_message_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = discuss_service.GenerateMessageRequest() - assert args[0] == request_msg @@ -2948,7 +2962,6 @@ def test_count_message_tokens_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = discuss_service.CountMessageTokensRequest() - assert args[0] == request_msg diff --git a/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1beta2/test_model_service.py b/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1beta2/test_model_service.py index 3176336be695..35de6565b140 100644 --- a/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1beta2/test_model_service.py +++ b/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1beta2/test_model_service.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 @@ -107,6 +108,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" @@ -1287,8 +1303,8 @@ def test_model_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - model_service.GetModelRequest, - dict, + model_service.GetModelRequest(), + {}, ], ) def test_get_model(request_type, transport: str = "grpc"): @@ -1299,7 +1315,7 @@ def test_get_model(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_model), "__call__") as call: @@ -1365,9 +1381,10 @@ def test_get_model_non_empty_request_with_auto_populated_field(): client.get_model(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == model_service.GetModelRequest( + request_msg = model_service.GetModelRequest( name="name_value", ) + assert args[0] == request_msg def test_get_model_use_cached_wrapped_rpc(): @@ -1446,9 +1463,14 @@ async def test_get_model_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_model_async( - transport: str = "grpc_asyncio", request_type=model_service.GetModelRequest -): +@pytest.mark.parametrize( + "request_type", + [ + model_service.GetModelRequest(), + {}, + ], +) +async def test_get_model_async(request_type, transport: str = "grpc_asyncio"): client = ModelServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1456,7 +1478,7 @@ async def test_get_model_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_model), "__call__") as call: @@ -1501,11 +1523,6 @@ async def test_get_model_async( assert response.top_k == 541 -@pytest.mark.asyncio -async def test_get_model_async_from_dict(): - await test_get_model_async(request_type=dict) - - def test_get_model_field_headers(): client = ModelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1648,8 +1665,8 @@ async def test_get_model_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - model_service.ListModelsRequest, - dict, + model_service.ListModelsRequest(), + {}, ], ) def test_list_models(request_type, transport: str = "grpc"): @@ -1660,7 +1677,7 @@ def test_list_models(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_models), "__call__") as call: @@ -1704,9 +1721,10 @@ def test_list_models_non_empty_request_with_auto_populated_field(): client.list_models(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == model_service.ListModelsRequest( + request_msg = model_service.ListModelsRequest( page_token="page_token_value", ) + assert args[0] == request_msg def test_list_models_use_cached_wrapped_rpc(): @@ -1787,9 +1805,14 @@ async def test_list_models_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_models_async( - transport: str = "grpc_asyncio", request_type=model_service.ListModelsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + model_service.ListModelsRequest(), + {}, + ], +) +async def test_list_models_async(request_type, transport: str = "grpc_asyncio"): client = ModelServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1797,7 +1820,7 @@ async def test_list_models_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_models), "__call__") as call: @@ -1820,11 +1843,6 @@ async def test_list_models_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_models_async_from_dict(): - await test_list_models_async(request_type=dict) - - def test_list_models_flattened(): client = ModelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2556,7 +2574,6 @@ def test_get_model_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.GetModelRequest() - assert args[0] == request_msg @@ -2577,7 +2594,6 @@ def test_list_models_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.ListModelsRequest() - assert args[0] == request_msg @@ -2628,7 +2644,6 @@ async def test_get_model_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.GetModelRequest() - assert args[0] == request_msg @@ -2655,7 +2670,6 @@ async def test_list_models_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.ListModelsRequest() - assert args[0] == request_msg @@ -2967,7 +2981,6 @@ def test_get_model_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.GetModelRequest() - assert args[0] == request_msg @@ -2987,7 +3000,6 @@ def test_list_models_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.ListModelsRequest() - assert args[0] == request_msg diff --git a/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1beta2/test_text_service.py b/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1beta2/test_text_service.py index c14d21ebbb32..c2d5811f07de 100644 --- a/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1beta2/test_text_service.py +++ b/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1beta2/test_text_service.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 @@ -106,6 +107,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" @@ -1271,8 +1287,8 @@ def test_text_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - text_service.GenerateTextRequest, - dict, + text_service.GenerateTextRequest(), + {}, ], ) def test_generate_text(request_type, transport: str = "grpc"): @@ -1283,7 +1299,7 @@ def test_generate_text(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.generate_text), "__call__") as call: @@ -1324,9 +1340,10 @@ def test_generate_text_non_empty_request_with_auto_populated_field(): client.generate_text(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == text_service.GenerateTextRequest( + request_msg = text_service.GenerateTextRequest( model="model_value", ) + assert args[0] == request_msg def test_generate_text_use_cached_wrapped_rpc(): @@ -1407,9 +1424,14 @@ async def test_generate_text_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_generate_text_async( - transport: str = "grpc_asyncio", request_type=text_service.GenerateTextRequest -): +@pytest.mark.parametrize( + "request_type", + [ + text_service.GenerateTextRequest(), + {}, + ], +) +async def test_generate_text_async(request_type, transport: str = "grpc_asyncio"): client = TextServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1417,7 +1439,7 @@ async def test_generate_text_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.generate_text), "__call__") as call: @@ -1437,11 +1459,6 @@ async def test_generate_text_async( assert isinstance(response, text_service.GenerateTextResponse) -@pytest.mark.asyncio -async def test_generate_text_async_from_dict(): - await test_generate_text_async(request_type=dict) - - def test_generate_text_field_headers(): client = TextServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1640,8 +1657,8 @@ async def test_generate_text_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - text_service.EmbedTextRequest, - dict, + text_service.EmbedTextRequest(), + {}, ], ) def test_embed_text(request_type, transport: str = "grpc"): @@ -1652,7 +1669,7 @@ def test_embed_text(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.embed_text), "__call__") as call: @@ -1694,10 +1711,11 @@ def test_embed_text_non_empty_request_with_auto_populated_field(): client.embed_text(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == text_service.EmbedTextRequest( + request_msg = text_service.EmbedTextRequest( model="model_value", text="text_value", ) + assert args[0] == request_msg def test_embed_text_use_cached_wrapped_rpc(): @@ -1776,9 +1794,14 @@ async def test_embed_text_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_embed_text_async( - transport: str = "grpc_asyncio", request_type=text_service.EmbedTextRequest -): +@pytest.mark.parametrize( + "request_type", + [ + text_service.EmbedTextRequest(), + {}, + ], +) +async def test_embed_text_async(request_type, transport: str = "grpc_asyncio"): client = TextServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1786,7 +1809,7 @@ async def test_embed_text_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.embed_text), "__call__") as call: @@ -1806,11 +1829,6 @@ async def test_embed_text_async( assert isinstance(response, text_service.EmbedTextResponse) -@pytest.mark.asyncio -async def test_embed_text_async_from_dict(): - await test_embed_text_async(request_type=dict) - - def test_embed_text_field_headers(): client = TextServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2473,7 +2491,6 @@ def test_generate_text_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = text_service.GenerateTextRequest() - assert args[0] == request_msg @@ -2494,7 +2511,6 @@ def test_embed_text_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = text_service.EmbedTextRequest() - assert args[0] == request_msg @@ -2533,7 +2549,6 @@ async def test_generate_text_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = text_service.GenerateTextRequest() - assert args[0] == request_msg @@ -2558,7 +2573,6 @@ async def test_embed_text_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = text_service.EmbedTextRequest() - assert args[0] == request_msg @@ -2844,7 +2858,6 @@ def test_generate_text_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = text_service.GenerateTextRequest() - assert args[0] == request_msg @@ -2864,7 +2877,6 @@ def test_embed_text_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = text_service.EmbedTextRequest() - assert args[0] == request_msg diff --git a/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1beta3/test_discuss_service.py b/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1beta3/test_discuss_service.py index 4eac75832910..f742c2b3b967 100644 --- a/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1beta3/test_discuss_service.py +++ b/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1beta3/test_discuss_service.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 @@ -107,6 +108,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" @@ -1310,8 +1326,8 @@ def test_discuss_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - discuss_service.GenerateMessageRequest, - dict, + discuss_service.GenerateMessageRequest(), + {}, ], ) def test_generate_message(request_type, transport: str = "grpc"): @@ -1322,7 +1338,7 @@ def test_generate_message(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.generate_message), "__call__") as call: @@ -1363,9 +1379,10 @@ def test_generate_message_non_empty_request_with_auto_populated_field(): client.generate_message(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == discuss_service.GenerateMessageRequest( + request_msg = discuss_service.GenerateMessageRequest( model="model_value", ) + assert args[0] == request_msg def test_generate_message_use_cached_wrapped_rpc(): @@ -1448,9 +1465,14 @@ async def test_generate_message_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_generate_message_async( - transport: str = "grpc_asyncio", request_type=discuss_service.GenerateMessageRequest -): +@pytest.mark.parametrize( + "request_type", + [ + discuss_service.GenerateMessageRequest(), + {}, + ], +) +async def test_generate_message_async(request_type, transport: str = "grpc_asyncio"): client = DiscussServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1458,7 +1480,7 @@ async def test_generate_message_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.generate_message), "__call__") as call: @@ -1478,11 +1500,6 @@ async def test_generate_message_async( assert isinstance(response, discuss_service.GenerateMessageResponse) -@pytest.mark.asyncio -async def test_generate_message_async_from_dict(): - await test_generate_message_async(request_type=dict) - - def test_generate_message_field_headers(): client = DiscussServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1671,8 +1688,8 @@ async def test_generate_message_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - discuss_service.CountMessageTokensRequest, - dict, + discuss_service.CountMessageTokensRequest(), + {}, ], ) def test_count_message_tokens(request_type, transport: str = "grpc"): @@ -1683,7 +1700,7 @@ def test_count_message_tokens(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1731,9 +1748,10 @@ def test_count_message_tokens_non_empty_request_with_auto_populated_field(): client.count_message_tokens(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == discuss_service.CountMessageTokensRequest( + request_msg = discuss_service.CountMessageTokensRequest( model="model_value", ) + assert args[0] == request_msg def test_count_message_tokens_use_cached_wrapped_rpc(): @@ -1818,9 +1836,15 @@ async def test_count_message_tokens_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + discuss_service.CountMessageTokensRequest(), + {}, + ], +) async def test_count_message_tokens_async( - transport: str = "grpc_asyncio", - request_type=discuss_service.CountMessageTokensRequest, + request_type, transport: str = "grpc_asyncio" ): client = DiscussServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1829,7 +1853,7 @@ async def test_count_message_tokens_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( @@ -1854,11 +1878,6 @@ async def test_count_message_tokens_async( assert response.token_count == 1193 -@pytest.mark.asyncio -async def test_count_message_tokens_async_from_dict(): - await test_count_message_tokens_async(request_type=dict) - - def test_count_message_tokens_field_headers(): client = DiscussServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2533,7 +2552,6 @@ def test_generate_message_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = discuss_service.GenerateMessageRequest() - assert args[0] == request_msg @@ -2556,7 +2574,6 @@ def test_count_message_tokens_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = discuss_service.CountMessageTokensRequest() - assert args[0] == request_msg @@ -2595,7 +2612,6 @@ async def test_generate_message_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = discuss_service.GenerateMessageRequest() - assert args[0] == request_msg @@ -2624,7 +2640,6 @@ async def test_count_message_tokens_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = discuss_service.CountMessageTokensRequest() - assert args[0] == request_msg @@ -2927,7 +2942,6 @@ def test_generate_message_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = discuss_service.GenerateMessageRequest() - assert args[0] == request_msg @@ -2949,7 +2963,6 @@ def test_count_message_tokens_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = discuss_service.CountMessageTokensRequest() - assert args[0] == request_msg diff --git a/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1beta3/test_model_service.py b/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1beta3/test_model_service.py index 152e947f335e..fd94e503493a 100644 --- a/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1beta3/test_model_service.py +++ b/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1beta3/test_model_service.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 @@ -115,6 +116,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" @@ -1295,8 +1311,8 @@ def test_model_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - model_service.GetModelRequest, - dict, + model_service.GetModelRequest(), + {}, ], ) def test_get_model(request_type, transport: str = "grpc"): @@ -1307,7 +1323,7 @@ def test_get_model(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_model), "__call__") as call: @@ -1373,9 +1389,10 @@ def test_get_model_non_empty_request_with_auto_populated_field(): client.get_model(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == model_service.GetModelRequest( + request_msg = model_service.GetModelRequest( name="name_value", ) + assert args[0] == request_msg def test_get_model_use_cached_wrapped_rpc(): @@ -1454,9 +1471,14 @@ async def test_get_model_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_model_async( - transport: str = "grpc_asyncio", request_type=model_service.GetModelRequest -): +@pytest.mark.parametrize( + "request_type", + [ + model_service.GetModelRequest(), + {}, + ], +) +async def test_get_model_async(request_type, transport: str = "grpc_asyncio"): client = ModelServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1464,7 +1486,7 @@ async def test_get_model_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_model), "__call__") as call: @@ -1509,11 +1531,6 @@ async def test_get_model_async( assert response.top_k == 541 -@pytest.mark.asyncio -async def test_get_model_async_from_dict(): - await test_get_model_async(request_type=dict) - - def test_get_model_field_headers(): client = ModelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1656,8 +1673,8 @@ async def test_get_model_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - model_service.ListModelsRequest, - dict, + model_service.ListModelsRequest(), + {}, ], ) def test_list_models(request_type, transport: str = "grpc"): @@ -1668,7 +1685,7 @@ def test_list_models(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_models), "__call__") as call: @@ -1712,9 +1729,10 @@ def test_list_models_non_empty_request_with_auto_populated_field(): client.list_models(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == model_service.ListModelsRequest( + request_msg = model_service.ListModelsRequest( page_token="page_token_value", ) + assert args[0] == request_msg def test_list_models_use_cached_wrapped_rpc(): @@ -1795,9 +1813,14 @@ async def test_list_models_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_models_async( - transport: str = "grpc_asyncio", request_type=model_service.ListModelsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + model_service.ListModelsRequest(), + {}, + ], +) +async def test_list_models_async(request_type, transport: str = "grpc_asyncio"): client = ModelServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1805,7 +1828,7 @@ async def test_list_models_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_models), "__call__") as call: @@ -1828,11 +1851,6 @@ async def test_list_models_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_models_async_from_dict(): - await test_list_models_async(request_type=dict) - - def test_list_models_flattened(): client = ModelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2115,8 +2133,8 @@ async def test_list_models_async_pages(): @pytest.mark.parametrize( "request_type", [ - model_service.GetTunedModelRequest, - dict, + model_service.GetTunedModelRequest(), + {}, ], ) def test_get_tuned_model(request_type, transport: str = "grpc"): @@ -2127,7 +2145,7 @@ def test_get_tuned_model(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tuned_model), "__call__") as call: @@ -2184,9 +2202,10 @@ def test_get_tuned_model_non_empty_request_with_auto_populated_field(): client.get_tuned_model(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == model_service.GetTunedModelRequest( + request_msg = model_service.GetTunedModelRequest( name="name_value", ) + assert args[0] == request_msg def test_get_tuned_model_use_cached_wrapped_rpc(): @@ -2267,9 +2286,14 @@ async def test_get_tuned_model_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_tuned_model_async( - transport: str = "grpc_asyncio", request_type=model_service.GetTunedModelRequest -): +@pytest.mark.parametrize( + "request_type", + [ + model_service.GetTunedModelRequest(), + {}, + ], +) +async def test_get_tuned_model_async(request_type, transport: str = "grpc_asyncio"): client = ModelServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2277,7 +2301,7 @@ async def test_get_tuned_model_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_tuned_model), "__call__") as call: @@ -2312,11 +2336,6 @@ async def test_get_tuned_model_async( assert response.state == tuned_model.TunedModel.State.CREATING -@pytest.mark.asyncio -async def test_get_tuned_model_async_from_dict(): - await test_get_tuned_model_async(request_type=dict) - - def test_get_tuned_model_field_headers(): client = ModelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2463,8 +2482,8 @@ async def test_get_tuned_model_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - model_service.ListTunedModelsRequest, - dict, + model_service.ListTunedModelsRequest(), + {}, ], ) def test_list_tuned_models(request_type, transport: str = "grpc"): @@ -2475,7 +2494,7 @@ def test_list_tuned_models(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2523,9 +2542,10 @@ def test_list_tuned_models_non_empty_request_with_auto_populated_field(): client.list_tuned_models(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == model_service.ListTunedModelsRequest( + request_msg = model_service.ListTunedModelsRequest( page_token="page_token_value", ) + assert args[0] == request_msg def test_list_tuned_models_use_cached_wrapped_rpc(): @@ -2608,9 +2628,14 @@ async def test_list_tuned_models_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_tuned_models_async( - transport: str = "grpc_asyncio", request_type=model_service.ListTunedModelsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + model_service.ListTunedModelsRequest(), + {}, + ], +) +async def test_list_tuned_models_async(request_type, transport: str = "grpc_asyncio"): client = ModelServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2618,7 +2643,7 @@ async def test_list_tuned_models_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( @@ -2643,11 +2668,6 @@ async def test_list_tuned_models_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_tuned_models_async_from_dict(): - await test_list_tuned_models_async(request_type=dict) - - def test_list_tuned_models_flattened(): client = ModelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2942,8 +2962,8 @@ async def test_list_tuned_models_async_pages(): @pytest.mark.parametrize( "request_type", [ - model_service.CreateTunedModelRequest, - dict, + model_service.CreateTunedModelRequest(), + {}, ], ) def test_create_tuned_model(request_type, transport: str = "grpc"): @@ -2954,7 +2974,7 @@ def test_create_tuned_model(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2999,9 +3019,10 @@ def test_create_tuned_model_non_empty_request_with_auto_populated_field(): client.create_tuned_model(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == model_service.CreateTunedModelRequest( + request_msg = model_service.CreateTunedModelRequest( tuned_model_id="tuned_model_id_value", ) + assert args[0] == request_msg def test_create_tuned_model_use_cached_wrapped_rpc(): @@ -3096,9 +3117,14 @@ async def test_create_tuned_model_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_tuned_model_async( - transport: str = "grpc_asyncio", request_type=model_service.CreateTunedModelRequest -): +@pytest.mark.parametrize( + "request_type", + [ + model_service.CreateTunedModelRequest(), + {}, + ], +) +async def test_create_tuned_model_async(request_type, transport: str = "grpc_asyncio"): client = ModelServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3106,7 +3132,7 @@ async def test_create_tuned_model_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( @@ -3128,11 +3154,6 @@ async def test_create_tuned_model_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_tuned_model_async_from_dict(): - await test_create_tuned_model_async(request_type=dict) - - def test_create_tuned_model_flattened(): client = ModelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3256,8 +3277,8 @@ async def test_create_tuned_model_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - model_service.UpdateTunedModelRequest, - dict, + model_service.UpdateTunedModelRequest(), + {}, ], ) def test_update_tuned_model(request_type, transport: str = "grpc"): @@ -3268,7 +3289,7 @@ def test_update_tuned_model(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3327,7 +3348,8 @@ def test_update_tuned_model_non_empty_request_with_auto_populated_field(): client.update_tuned_model(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == model_service.UpdateTunedModelRequest() + request_msg = model_service.UpdateTunedModelRequest() + assert args[0] == request_msg def test_update_tuned_model_use_cached_wrapped_rpc(): @@ -3412,9 +3434,14 @@ async def test_update_tuned_model_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_tuned_model_async( - transport: str = "grpc_asyncio", request_type=model_service.UpdateTunedModelRequest -): +@pytest.mark.parametrize( + "request_type", + [ + model_service.UpdateTunedModelRequest(), + {}, + ], +) +async def test_update_tuned_model_async(request_type, transport: str = "grpc_asyncio"): client = ModelServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3422,7 +3449,7 @@ async def test_update_tuned_model_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( @@ -3459,11 +3486,6 @@ async def test_update_tuned_model_async( assert response.state == gag_tuned_model.TunedModel.State.CREATING -@pytest.mark.asyncio -async def test_update_tuned_model_async_from_dict(): - await test_update_tuned_model_async(request_type=dict) - - def test_update_tuned_model_field_headers(): client = ModelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3652,8 +3674,8 @@ async def test_update_tuned_model_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - model_service.DeleteTunedModelRequest, - dict, + model_service.DeleteTunedModelRequest(), + {}, ], ) def test_delete_tuned_model(request_type, transport: str = "grpc"): @@ -3664,7 +3686,7 @@ def test_delete_tuned_model(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,9 +3731,10 @@ def test_delete_tuned_model_non_empty_request_with_auto_populated_field(): client.delete_tuned_model(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == model_service.DeleteTunedModelRequest( + request_msg = model_service.DeleteTunedModelRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_tuned_model_use_cached_wrapped_rpc(): @@ -3796,9 +3819,14 @@ async def test_delete_tuned_model_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_tuned_model_async( - transport: str = "grpc_asyncio", request_type=model_service.DeleteTunedModelRequest -): +@pytest.mark.parametrize( + "request_type", + [ + model_service.DeleteTunedModelRequest(), + {}, + ], +) +async def test_delete_tuned_model_async(request_type, transport: str = "grpc_asyncio"): client = ModelServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3806,7 +3834,7 @@ async def test_delete_tuned_model_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( @@ -3826,11 +3854,6 @@ async def test_delete_tuned_model_async( assert response is None -@pytest.mark.asyncio -async def test_delete_tuned_model_async_from_dict(): - await test_delete_tuned_model_async(request_type=dict) - - def test_delete_tuned_model_field_headers(): client = ModelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5324,7 +5347,6 @@ def test_get_model_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.GetModelRequest() - assert args[0] == request_msg @@ -5345,7 +5367,6 @@ def test_list_models_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.ListModelsRequest() - assert args[0] == request_msg @@ -5366,7 +5387,6 @@ def test_get_tuned_model_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.GetTunedModelRequest() - assert args[0] == request_msg @@ -5389,7 +5409,6 @@ def test_list_tuned_models_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.ListTunedModelsRequest() - assert args[0] == request_msg @@ -5412,7 +5431,6 @@ def test_create_tuned_model_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.CreateTunedModelRequest() - assert args[0] == request_msg @@ -5435,7 +5453,6 @@ def test_update_tuned_model_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.UpdateTunedModelRequest() - assert args[0] == request_msg @@ -5458,7 +5475,6 @@ def test_delete_tuned_model_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.DeleteTunedModelRequest() - assert args[0] == request_msg @@ -5509,7 +5525,6 @@ async def test_get_model_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.GetModelRequest() - assert args[0] == request_msg @@ -5536,7 +5551,6 @@ async def test_list_models_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.ListModelsRequest() - assert args[0] == request_msg @@ -5569,7 +5583,6 @@ async def test_get_tuned_model_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.GetTunedModelRequest() - assert args[0] == request_msg @@ -5598,7 +5611,6 @@ async def test_list_tuned_models_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.ListTunedModelsRequest() - assert args[0] == request_msg @@ -5625,7 +5637,6 @@ async def test_create_tuned_model_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.CreateTunedModelRequest() - assert args[0] == request_msg @@ -5660,7 +5671,6 @@ async def test_update_tuned_model_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.UpdateTunedModelRequest() - assert args[0] == request_msg @@ -5685,7 +5695,6 @@ async def test_delete_tuned_model_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.DeleteTunedModelRequest() - assert args[0] == request_msg @@ -6860,7 +6869,6 @@ def test_get_model_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.GetModelRequest() - assert args[0] == request_msg @@ -6880,7 +6888,6 @@ def test_list_models_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.ListModelsRequest() - assert args[0] == request_msg @@ -6900,7 +6907,6 @@ def test_get_tuned_model_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.GetTunedModelRequest() - assert args[0] == request_msg @@ -6922,7 +6928,6 @@ def test_list_tuned_models_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.ListTunedModelsRequest() - assert args[0] == request_msg @@ -6944,7 +6949,6 @@ def test_create_tuned_model_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.CreateTunedModelRequest() - assert args[0] == request_msg @@ -6966,7 +6970,6 @@ def test_update_tuned_model_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.UpdateTunedModelRequest() - assert args[0] == request_msg @@ -6988,7 +6991,6 @@ def test_delete_tuned_model_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.DeleteTunedModelRequest() - assert args[0] == request_msg diff --git a/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1beta3/test_permission_service.py b/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1beta3/test_permission_service.py index 5ce93945449d..295f3996a482 100644 --- a/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1beta3/test_permission_service.py +++ b/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1beta3/test_permission_service.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 @@ -110,6 +111,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" @@ -1351,8 +1367,8 @@ def test_permission_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - permission_service.CreatePermissionRequest, - dict, + permission_service.CreatePermissionRequest(), + {}, ], ) def test_create_permission(request_type, transport: str = "grpc"): @@ -1363,7 +1379,7 @@ def test_create_permission(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1417,9 +1433,10 @@ def test_create_permission_non_empty_request_with_auto_populated_field(): client.create_permission(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == permission_service.CreatePermissionRequest( + request_msg = permission_service.CreatePermissionRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_permission_use_cached_wrapped_rpc(): @@ -1502,10 +1519,14 @@ async def test_create_permission_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_permission_async( - transport: str = "grpc_asyncio", - request_type=permission_service.CreatePermissionRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + permission_service.CreatePermissionRequest(), + {}, + ], +) +async def test_create_permission_async(request_type, transport: str = "grpc_asyncio"): client = PermissionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1513,7 +1534,7 @@ async def test_create_permission_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( @@ -1544,11 +1565,6 @@ async def test_create_permission_async( assert response.role == gag_permission.Permission.Role.OWNER -@pytest.mark.asyncio -async def test_create_permission_async_from_dict(): - await test_create_permission_async(request_type=dict) - - def test_create_permission_field_headers(): client = PermissionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1713,8 +1729,8 @@ async def test_create_permission_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - permission_service.GetPermissionRequest, - dict, + permission_service.GetPermissionRequest(), + {}, ], ) def test_get_permission(request_type, transport: str = "grpc"): @@ -1725,7 +1741,7 @@ def test_get_permission(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_permission), "__call__") as call: @@ -1775,9 +1791,10 @@ def test_get_permission_non_empty_request_with_auto_populated_field(): client.get_permission(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == permission_service.GetPermissionRequest( + request_msg = permission_service.GetPermissionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_permission_use_cached_wrapped_rpc(): @@ -1858,10 +1875,14 @@ async def test_get_permission_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_permission_async( - transport: str = "grpc_asyncio", - request_type=permission_service.GetPermissionRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + permission_service.GetPermissionRequest(), + {}, + ], +) +async def test_get_permission_async(request_type, transport: str = "grpc_asyncio"): client = PermissionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1869,7 +1890,7 @@ async def test_get_permission_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_permission), "__call__") as call: @@ -1898,11 +1919,6 @@ async def test_get_permission_async( assert response.role == permission.Permission.Role.OWNER -@pytest.mark.asyncio -async def test_get_permission_async_from_dict(): - await test_get_permission_async(request_type=dict) - - def test_get_permission_field_headers(): client = PermissionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2049,8 +2065,8 @@ async def test_get_permission_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - permission_service.ListPermissionsRequest, - dict, + permission_service.ListPermissionsRequest(), + {}, ], ) def test_list_permissions(request_type, transport: str = "grpc"): @@ -2061,7 +2077,7 @@ def test_list_permissions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_permissions), "__call__") as call: @@ -2106,10 +2122,11 @@ def test_list_permissions_non_empty_request_with_auto_populated_field(): client.list_permissions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == permission_service.ListPermissionsRequest( + request_msg = permission_service.ListPermissionsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_permissions_use_cached_wrapped_rpc(): @@ -2192,10 +2209,14 @@ async def test_list_permissions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_permissions_async( - transport: str = "grpc_asyncio", - request_type=permission_service.ListPermissionsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + permission_service.ListPermissionsRequest(), + {}, + ], +) +async def test_list_permissions_async(request_type, transport: str = "grpc_asyncio"): client = PermissionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2203,7 +2224,7 @@ async def test_list_permissions_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_permissions), "__call__") as call: @@ -2226,11 +2247,6 @@ async def test_list_permissions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_permissions_async_from_dict(): - await test_list_permissions_async(request_type=dict) - - def test_list_permissions_field_headers(): client = PermissionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2567,8 +2583,8 @@ async def test_list_permissions_async_pages(): @pytest.mark.parametrize( "request_type", [ - permission_service.UpdatePermissionRequest, - dict, + permission_service.UpdatePermissionRequest(), + {}, ], ) def test_update_permission(request_type, transport: str = "grpc"): @@ -2579,7 +2595,7 @@ def test_update_permission(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2631,7 +2647,8 @@ def test_update_permission_non_empty_request_with_auto_populated_field(): client.update_permission(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == permission_service.UpdatePermissionRequest() + request_msg = permission_service.UpdatePermissionRequest() + assert args[0] == request_msg def test_update_permission_use_cached_wrapped_rpc(): @@ -2714,10 +2731,14 @@ async def test_update_permission_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_permission_async( - transport: str = "grpc_asyncio", - request_type=permission_service.UpdatePermissionRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + permission_service.UpdatePermissionRequest(), + {}, + ], +) +async def test_update_permission_async(request_type, transport: str = "grpc_asyncio"): client = PermissionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2725,7 +2746,7 @@ async def test_update_permission_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( @@ -2756,11 +2777,6 @@ async def test_update_permission_async( assert response.role == gag_permission.Permission.Role.OWNER -@pytest.mark.asyncio -async def test_update_permission_async_from_dict(): - await test_update_permission_async(request_type=dict) - - def test_update_permission_field_headers(): client = PermissionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2925,8 +2941,8 @@ async def test_update_permission_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - permission_service.DeletePermissionRequest, - dict, + permission_service.DeletePermissionRequest(), + {}, ], ) def test_delete_permission(request_type, transport: str = "grpc"): @@ -2937,7 +2953,7 @@ def test_delete_permission(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2982,9 +2998,10 @@ def test_delete_permission_non_empty_request_with_auto_populated_field(): client.delete_permission(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == permission_service.DeletePermissionRequest( + request_msg = permission_service.DeletePermissionRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_permission_use_cached_wrapped_rpc(): @@ -3067,10 +3084,14 @@ async def test_delete_permission_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_permission_async( - transport: str = "grpc_asyncio", - request_type=permission_service.DeletePermissionRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + permission_service.DeletePermissionRequest(), + {}, + ], +) +async def test_delete_permission_async(request_type, transport: str = "grpc_asyncio"): client = PermissionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3078,7 +3099,7 @@ async def test_delete_permission_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( @@ -3098,11 +3119,6 @@ async def test_delete_permission_async( assert response is None -@pytest.mark.asyncio -async def test_delete_permission_async_from_dict(): - await test_delete_permission_async(request_type=dict) - - def test_delete_permission_field_headers(): client = PermissionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3253,8 +3269,8 @@ async def test_delete_permission_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - permission_service.TransferOwnershipRequest, - dict, + permission_service.TransferOwnershipRequest(), + {}, ], ) def test_transfer_ownership(request_type, transport: str = "grpc"): @@ -3265,7 +3281,7 @@ def test_transfer_ownership(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3311,10 +3327,11 @@ def test_transfer_ownership_non_empty_request_with_auto_populated_field(): client.transfer_ownership(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == permission_service.TransferOwnershipRequest( + request_msg = permission_service.TransferOwnershipRequest( name="name_value", email_address="email_address_value", ) + assert args[0] == request_msg def test_transfer_ownership_use_cached_wrapped_rpc(): @@ -3399,10 +3416,14 @@ async def test_transfer_ownership_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_transfer_ownership_async( - transport: str = "grpc_asyncio", - request_type=permission_service.TransferOwnershipRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + permission_service.TransferOwnershipRequest(), + {}, + ], +) +async def test_transfer_ownership_async(request_type, transport: str = "grpc_asyncio"): client = PermissionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3410,7 +3431,7 @@ async def test_transfer_ownership_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( @@ -3432,11 +3453,6 @@ async def test_transfer_ownership_async( assert isinstance(response, permission_service.TransferOwnershipResponse) -@pytest.mark.asyncio -async def test_transfer_ownership_async_from_dict(): - await test_transfer_ownership_async(request_type=dict) - - def test_transfer_ownership_field_headers(): client = PermissionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4752,7 +4768,6 @@ def test_create_permission_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = permission_service.CreatePermissionRequest() - assert args[0] == request_msg @@ -4773,7 +4788,6 @@ def test_get_permission_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = permission_service.GetPermissionRequest() - assert args[0] == request_msg @@ -4794,7 +4808,6 @@ def test_list_permissions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = permission_service.ListPermissionsRequest() - assert args[0] == request_msg @@ -4817,7 +4830,6 @@ def test_update_permission_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = permission_service.UpdatePermissionRequest() - assert args[0] == request_msg @@ -4840,7 +4852,6 @@ def test_delete_permission_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = permission_service.DeletePermissionRequest() - assert args[0] == request_msg @@ -4863,7 +4874,6 @@ def test_transfer_ownership_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = permission_service.TransferOwnershipRequest() - assert args[0] == request_msg @@ -4909,7 +4919,6 @@ async def test_create_permission_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = permission_service.CreatePermissionRequest() - assert args[0] == request_msg @@ -4939,7 +4948,6 @@ async def test_get_permission_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = permission_service.GetPermissionRequest() - assert args[0] == request_msg @@ -4966,7 +4974,6 @@ async def test_list_permissions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = permission_service.ListPermissionsRequest() - assert args[0] == request_msg @@ -4998,7 +5005,6 @@ async def test_update_permission_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = permission_service.UpdatePermissionRequest() - assert args[0] == request_msg @@ -5023,7 +5029,6 @@ async def test_delete_permission_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = permission_service.DeletePermissionRequest() - assert args[0] == request_msg @@ -5050,7 +5055,6 @@ async def test_transfer_ownership_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = permission_service.TransferOwnershipRequest() - assert args[0] == request_msg @@ -6022,7 +6026,6 @@ def test_create_permission_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = permission_service.CreatePermissionRequest() - assert args[0] == request_msg @@ -6042,7 +6045,6 @@ def test_get_permission_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = permission_service.GetPermissionRequest() - assert args[0] == request_msg @@ -6062,7 +6064,6 @@ def test_list_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = permission_service.ListPermissionsRequest() - assert args[0] == request_msg @@ -6084,7 +6085,6 @@ def test_update_permission_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = permission_service.UpdatePermissionRequest() - assert args[0] == request_msg @@ -6106,7 +6106,6 @@ def test_delete_permission_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = permission_service.DeletePermissionRequest() - assert args[0] == request_msg @@ -6128,7 +6127,6 @@ def test_transfer_ownership_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = permission_service.TransferOwnershipRequest() - assert args[0] == request_msg diff --git a/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1beta3/test_text_service.py b/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1beta3/test_text_service.py index 8c155a7f7a83..2b8018235edc 100644 --- a/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1beta3/test_text_service.py +++ b/packages/google-ai-generativelanguage/tests/unit/gapic/generativelanguage_v1beta3/test_text_service.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 @@ -107,6 +108,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" @@ -1272,8 +1288,8 @@ def test_text_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - text_service.GenerateTextRequest, - dict, + text_service.GenerateTextRequest(), + {}, ], ) def test_generate_text(request_type, transport: str = "grpc"): @@ -1284,7 +1300,7 @@ def test_generate_text(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.generate_text), "__call__") as call: @@ -1325,9 +1341,10 @@ def test_generate_text_non_empty_request_with_auto_populated_field(): client.generate_text(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == text_service.GenerateTextRequest( + request_msg = text_service.GenerateTextRequest( model="model_value", ) + assert args[0] == request_msg def test_generate_text_use_cached_wrapped_rpc(): @@ -1408,9 +1425,14 @@ async def test_generate_text_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_generate_text_async( - transport: str = "grpc_asyncio", request_type=text_service.GenerateTextRequest -): +@pytest.mark.parametrize( + "request_type", + [ + text_service.GenerateTextRequest(), + {}, + ], +) +async def test_generate_text_async(request_type, transport: str = "grpc_asyncio"): client = TextServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1418,7 +1440,7 @@ async def test_generate_text_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.generate_text), "__call__") as call: @@ -1438,11 +1460,6 @@ async def test_generate_text_async( assert isinstance(response, text_service.GenerateTextResponse) -@pytest.mark.asyncio -async def test_generate_text_async_from_dict(): - await test_generate_text_async(request_type=dict) - - def test_generate_text_field_headers(): client = TextServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1641,8 +1658,8 @@ async def test_generate_text_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - text_service.EmbedTextRequest, - dict, + text_service.EmbedTextRequest(), + {}, ], ) def test_embed_text(request_type, transport: str = "grpc"): @@ -1653,7 +1670,7 @@ def test_embed_text(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.embed_text), "__call__") as call: @@ -1695,10 +1712,11 @@ def test_embed_text_non_empty_request_with_auto_populated_field(): client.embed_text(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == text_service.EmbedTextRequest( + request_msg = text_service.EmbedTextRequest( model="model_value", text="text_value", ) + assert args[0] == request_msg def test_embed_text_use_cached_wrapped_rpc(): @@ -1777,9 +1795,14 @@ async def test_embed_text_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_embed_text_async( - transport: str = "grpc_asyncio", request_type=text_service.EmbedTextRequest -): +@pytest.mark.parametrize( + "request_type", + [ + text_service.EmbedTextRequest(), + {}, + ], +) +async def test_embed_text_async(request_type, transport: str = "grpc_asyncio"): client = TextServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1787,7 +1810,7 @@ async def test_embed_text_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.embed_text), "__call__") as call: @@ -1807,11 +1830,6 @@ async def test_embed_text_async( assert isinstance(response, text_service.EmbedTextResponse) -@pytest.mark.asyncio -async def test_embed_text_async_from_dict(): - await test_embed_text_async(request_type=dict) - - def test_embed_text_field_headers(): client = TextServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1968,8 +1986,8 @@ async def test_embed_text_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - text_service.BatchEmbedTextRequest, - dict, + text_service.BatchEmbedTextRequest(), + {}, ], ) def test_batch_embed_text(request_type, transport: str = "grpc"): @@ -1980,7 +1998,7 @@ def test_batch_embed_text(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.batch_embed_text), "__call__") as call: @@ -2021,9 +2039,10 @@ def test_batch_embed_text_non_empty_request_with_auto_populated_field(): client.batch_embed_text(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == text_service.BatchEmbedTextRequest( + request_msg = text_service.BatchEmbedTextRequest( model="model_value", ) + assert args[0] == request_msg def test_batch_embed_text_use_cached_wrapped_rpc(): @@ -2106,9 +2125,14 @@ async def test_batch_embed_text_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_batch_embed_text_async( - transport: str = "grpc_asyncio", request_type=text_service.BatchEmbedTextRequest -): +@pytest.mark.parametrize( + "request_type", + [ + text_service.BatchEmbedTextRequest(), + {}, + ], +) +async def test_batch_embed_text_async(request_type, transport: str = "grpc_asyncio"): client = TextServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2116,7 +2140,7 @@ async def test_batch_embed_text_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.batch_embed_text), "__call__") as call: @@ -2136,11 +2160,6 @@ async def test_batch_embed_text_async( assert isinstance(response, text_service.BatchEmbedTextResponse) -@pytest.mark.asyncio -async def test_batch_embed_text_async_from_dict(): - await test_batch_embed_text_async(request_type=dict) - - def test_batch_embed_text_field_headers(): client = TextServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2297,8 +2316,8 @@ async def test_batch_embed_text_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - text_service.CountTextTokensRequest, - dict, + text_service.CountTextTokensRequest(), + {}, ], ) def test_count_text_tokens(request_type, transport: str = "grpc"): @@ -2309,7 +2328,7 @@ def test_count_text_tokens(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2357,9 +2376,10 @@ def test_count_text_tokens_non_empty_request_with_auto_populated_field(): client.count_text_tokens(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == text_service.CountTextTokensRequest( + request_msg = text_service.CountTextTokensRequest( model="model_value", ) + assert args[0] == request_msg def test_count_text_tokens_use_cached_wrapped_rpc(): @@ -2442,9 +2462,14 @@ async def test_count_text_tokens_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_count_text_tokens_async( - transport: str = "grpc_asyncio", request_type=text_service.CountTextTokensRequest -): +@pytest.mark.parametrize( + "request_type", + [ + text_service.CountTextTokensRequest(), + {}, + ], +) +async def test_count_text_tokens_async(request_type, transport: str = "grpc_asyncio"): client = TextServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2452,7 +2477,7 @@ async def test_count_text_tokens_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( @@ -2477,11 +2502,6 @@ async def test_count_text_tokens_async( assert response.token_count == 1193 -@pytest.mark.asyncio -async def test_count_text_tokens_async_from_dict(): - await test_count_text_tokens_async(request_type=dict) - - def test_count_text_tokens_field_headers(): client = TextServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3536,7 +3556,6 @@ def test_generate_text_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = text_service.GenerateTextRequest() - assert args[0] == request_msg @@ -3557,7 +3576,6 @@ def test_embed_text_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = text_service.EmbedTextRequest() - assert args[0] == request_msg @@ -3578,7 +3596,6 @@ def test_batch_embed_text_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = text_service.BatchEmbedTextRequest() - assert args[0] == request_msg @@ -3601,7 +3618,6 @@ def test_count_text_tokens_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = text_service.CountTextTokensRequest() - assert args[0] == request_msg @@ -3640,7 +3656,6 @@ async def test_generate_text_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = text_service.GenerateTextRequest() - assert args[0] == request_msg @@ -3665,7 +3680,6 @@ async def test_embed_text_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = text_service.EmbedTextRequest() - assert args[0] == request_msg @@ -3690,7 +3704,6 @@ async def test_batch_embed_text_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = text_service.BatchEmbedTextRequest() - assert args[0] == request_msg @@ -3719,7 +3732,6 @@ async def test_count_text_tokens_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = text_service.CountTextTokensRequest() - assert args[0] == request_msg @@ -4273,7 +4285,6 @@ def test_generate_text_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = text_service.GenerateTextRequest() - assert args[0] == request_msg @@ -4293,7 +4304,6 @@ def test_embed_text_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = text_service.EmbedTextRequest() - assert args[0] == request_msg @@ -4313,7 +4323,6 @@ def test_batch_embed_text_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = text_service.BatchEmbedTextRequest() - assert args[0] == request_msg @@ -4335,7 +4344,6 @@ def test_count_text_tokens_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = text_service.CountTextTokensRequest() - assert args[0] == request_msg diff --git a/packages/google-analytics-admin/noxfile.py b/packages/google-analytics-admin/noxfile.py index d7d3fe991d2f..c1cb27ce5fce 100644 --- a/packages/google-analytics-admin/noxfile.py +++ b/packages/google-analytics-admin/noxfile.py @@ -47,7 +47,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-analytics-admin" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-analytics-admin/setup.py b/packages/google-analytics-admin/setup.py index 8de070b043e3..5bf56c657b44 100644 --- a/packages/google-analytics-admin/setup.py +++ b/packages/google-analytics-admin/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/google-analytics-admin/testing/constraints-3.10.txt b/packages/google-analytics-admin/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-analytics-admin/testing/constraints-3.10.txt +++ b/packages/google-analytics-admin/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-analytics-admin/tests/unit/gapic/admin_v1alpha/test_analytics_admin_service.py b/packages/google-analytics-admin/tests/unit/gapic/admin_v1alpha/test_analytics_admin_service.py index 06e55e93bee7..45ff53758cf3 100644 --- a/packages/google-analytics-admin/tests/unit/gapic/admin_v1alpha/test_analytics_admin_service.py +++ b/packages/google-analytics-admin/tests/unit/gapic/admin_v1alpha/test_analytics_admin_service.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 @@ -129,6 +130,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" @@ -1399,8 +1415,8 @@ def test_analytics_admin_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetAccountRequest, - dict, + analytics_admin.GetAccountRequest(), + {}, ], ) def test_get_account(request_type, transport: str = "grpc"): @@ -1411,7 +1427,7 @@ def test_get_account(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_account), "__call__") as call: @@ -1463,9 +1479,10 @@ def test_get_account_non_empty_request_with_auto_populated_field(): client.get_account(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetAccountRequest( + request_msg = analytics_admin.GetAccountRequest( name="name_value", ) + assert args[0] == request_msg def test_get_account_use_cached_wrapped_rpc(): @@ -1546,9 +1563,14 @@ async def test_get_account_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_account_async( - transport: str = "grpc_asyncio", request_type=analytics_admin.GetAccountRequest -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.GetAccountRequest(), + {}, + ], +) +async def test_get_account_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1556,7 +1578,7 @@ async def test_get_account_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_account), "__call__") as call: @@ -1587,11 +1609,6 @@ async def test_get_account_async( assert response.gmp_organization == "gmp_organization_value" -@pytest.mark.asyncio -async def test_get_account_async_from_dict(): - await test_get_account_async(request_type=dict) - - def test_get_account_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1734,8 +1751,8 @@ async def test_get_account_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListAccountsRequest, - dict, + analytics_admin.ListAccountsRequest(), + {}, ], ) def test_list_accounts(request_type, transport: str = "grpc"): @@ -1746,7 +1763,7 @@ def test_list_accounts(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_accounts), "__call__") as call: @@ -1790,9 +1807,10 @@ def test_list_accounts_non_empty_request_with_auto_populated_field(): client.list_accounts(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListAccountsRequest( + request_msg = analytics_admin.ListAccountsRequest( page_token="page_token_value", ) + assert args[0] == request_msg def test_list_accounts_use_cached_wrapped_rpc(): @@ -1873,9 +1891,14 @@ async def test_list_accounts_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_accounts_async( - transport: str = "grpc_asyncio", request_type=analytics_admin.ListAccountsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.ListAccountsRequest(), + {}, + ], +) +async def test_list_accounts_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1883,7 +1906,7 @@ async def test_list_accounts_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_accounts), "__call__") as call: @@ -1906,11 +1929,6 @@ async def test_list_accounts_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_accounts_async_from_dict(): - await test_list_accounts_async(request_type=dict) - - def test_list_accounts_pager(transport_name: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2101,8 +2119,8 @@ async def test_list_accounts_async_pages(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.DeleteAccountRequest, - dict, + analytics_admin.DeleteAccountRequest(), + {}, ], ) def test_delete_account(request_type, transport: str = "grpc"): @@ -2113,7 +2131,7 @@ def test_delete_account(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_account), "__call__") as call: @@ -2154,9 +2172,10 @@ def test_delete_account_non_empty_request_with_auto_populated_field(): client.delete_account(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.DeleteAccountRequest( + request_msg = analytics_admin.DeleteAccountRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_account_use_cached_wrapped_rpc(): @@ -2237,9 +2256,14 @@ async def test_delete_account_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_account_async( - transport: str = "grpc_asyncio", request_type=analytics_admin.DeleteAccountRequest -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.DeleteAccountRequest(), + {}, + ], +) +async def test_delete_account_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2247,7 +2271,7 @@ async def test_delete_account_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_account), "__call__") as call: @@ -2265,11 +2289,6 @@ async def test_delete_account_async( assert response is None -@pytest.mark.asyncio -async def test_delete_account_async_from_dict(): - await test_delete_account_async(request_type=dict) - - def test_delete_account_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2412,8 +2431,8 @@ async def test_delete_account_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdateAccountRequest, - dict, + analytics_admin.UpdateAccountRequest(), + {}, ], ) def test_update_account(request_type, transport: str = "grpc"): @@ -2424,7 +2443,7 @@ def test_update_account(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_account), "__call__") as call: @@ -2474,7 +2493,8 @@ def test_update_account_non_empty_request_with_auto_populated_field(): client.update_account(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateAccountRequest() + request_msg = analytics_admin.UpdateAccountRequest() + assert args[0] == request_msg def test_update_account_use_cached_wrapped_rpc(): @@ -2555,9 +2575,14 @@ async def test_update_account_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_account_async( - transport: str = "grpc_asyncio", request_type=analytics_admin.UpdateAccountRequest -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.UpdateAccountRequest(), + {}, + ], +) +async def test_update_account_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2565,7 +2590,7 @@ async def test_update_account_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_account), "__call__") as call: @@ -2596,11 +2621,6 @@ async def test_update_account_async( assert response.gmp_organization == "gmp_organization_value" -@pytest.mark.asyncio -async def test_update_account_async_from_dict(): - await test_update_account_async(request_type=dict) - - def test_update_account_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2753,8 +2773,8 @@ async def test_update_account_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.ProvisionAccountTicketRequest, - dict, + analytics_admin.ProvisionAccountTicketRequest(), + {}, ], ) def test_provision_account_ticket(request_type, transport: str = "grpc"): @@ -2765,7 +2785,7 @@ def test_provision_account_ticket(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2813,9 +2833,10 @@ def test_provision_account_ticket_non_empty_request_with_auto_populated_field(): client.provision_account_ticket(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ProvisionAccountTicketRequest( + request_msg = analytics_admin.ProvisionAccountTicketRequest( redirect_uri="redirect_uri_value", ) + assert args[0] == request_msg def test_provision_account_ticket_use_cached_wrapped_rpc(): @@ -2901,9 +2922,15 @@ async def test_provision_account_ticket_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.ProvisionAccountTicketRequest(), + {}, + ], +) async def test_provision_account_ticket_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.ProvisionAccountTicketRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2912,7 +2939,7 @@ async def test_provision_account_ticket_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( @@ -2937,16 +2964,11 @@ async def test_provision_account_ticket_async( assert response.account_ticket_id == "account_ticket_id_value" -@pytest.mark.asyncio -async def test_provision_account_ticket_async_from_dict(): - await test_provision_account_ticket_async(request_type=dict) - - @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListAccountSummariesRequest, - dict, + analytics_admin.ListAccountSummariesRequest(), + {}, ], ) def test_list_account_summaries(request_type, transport: str = "grpc"): @@ -2957,7 +2979,7 @@ def test_list_account_summaries(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3005,9 +3027,10 @@ def test_list_account_summaries_non_empty_request_with_auto_populated_field(): client.list_account_summaries(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListAccountSummariesRequest( + request_msg = analytics_admin.ListAccountSummariesRequest( page_token="page_token_value", ) + assert args[0] == request_msg def test_list_account_summaries_use_cached_wrapped_rpc(): @@ -3093,9 +3116,15 @@ async def test_list_account_summaries_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.ListAccountSummariesRequest(), + {}, + ], +) async def test_list_account_summaries_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.ListAccountSummariesRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3104,7 +3133,7 @@ async def test_list_account_summaries_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( @@ -3129,11 +3158,6 @@ async def test_list_account_summaries_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_account_summaries_async_from_dict(): - await test_list_account_summaries_async(request_type=dict) - - def test_list_account_summaries_pager(transport_name: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3332,8 +3356,8 @@ async def test_list_account_summaries_async_pages(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetPropertyRequest, - dict, + analytics_admin.GetPropertyRequest(), + {}, ], ) def test_get_property(request_type, transport: str = "grpc"): @@ -3344,7 +3368,7 @@ def test_get_property(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_property), "__call__") as call: @@ -3404,9 +3428,10 @@ def test_get_property_non_empty_request_with_auto_populated_field(): client.get_property(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetPropertyRequest( + request_msg = analytics_admin.GetPropertyRequest( name="name_value", ) + assert args[0] == request_msg def test_get_property_use_cached_wrapped_rpc(): @@ -3487,9 +3512,14 @@ async def test_get_property_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_property_async( - transport: str = "grpc_asyncio", request_type=analytics_admin.GetPropertyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.GetPropertyRequest(), + {}, + ], +) +async def test_get_property_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3497,7 +3527,7 @@ async def test_get_property_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_property), "__call__") as call: @@ -3536,11 +3566,6 @@ async def test_get_property_async( assert response.account == "account_value" -@pytest.mark.asyncio -async def test_get_property_async_from_dict(): - await test_get_property_async(request_type=dict) - - def test_get_property_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3683,8 +3708,8 @@ async def test_get_property_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListPropertiesRequest, - dict, + analytics_admin.ListPropertiesRequest(), + {}, ], ) def test_list_properties(request_type, transport: str = "grpc"): @@ -3695,7 +3720,7 @@ def test_list_properties(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_properties), "__call__") as call: @@ -3740,10 +3765,11 @@ def test_list_properties_non_empty_request_with_auto_populated_field(): client.list_properties(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListPropertiesRequest( + request_msg = analytics_admin.ListPropertiesRequest( filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_properties_use_cached_wrapped_rpc(): @@ -3824,9 +3850,14 @@ async def test_list_properties_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_properties_async( - transport: str = "grpc_asyncio", request_type=analytics_admin.ListPropertiesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.ListPropertiesRequest(), + {}, + ], +) +async def test_list_properties_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3834,7 +3865,7 @@ async def test_list_properties_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_properties), "__call__") as call: @@ -3857,11 +3888,6 @@ async def test_list_properties_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_properties_async_from_dict(): - await test_list_properties_async(request_type=dict) - - def test_list_properties_pager(transport_name: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4052,8 +4078,8 @@ async def test_list_properties_async_pages(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.CreatePropertyRequest, - dict, + analytics_admin.CreatePropertyRequest(), + {}, ], ) def test_create_property(request_type, transport: str = "grpc"): @@ -4064,7 +4090,7 @@ def test_create_property(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_property), "__call__") as call: @@ -4122,7 +4148,8 @@ def test_create_property_non_empty_request_with_auto_populated_field(): client.create_property(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreatePropertyRequest() + request_msg = analytics_admin.CreatePropertyRequest() + assert args[0] == request_msg def test_create_property_use_cached_wrapped_rpc(): @@ -4203,9 +4230,14 @@ async def test_create_property_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_property_async( - transport: str = "grpc_asyncio", request_type=analytics_admin.CreatePropertyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.CreatePropertyRequest(), + {}, + ], +) +async def test_create_property_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4213,7 +4245,7 @@ async def test_create_property_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_property), "__call__") as call: @@ -4252,11 +4284,6 @@ async def test_create_property_async( assert response.account == "account_value" -@pytest.mark.asyncio -async def test_create_property_async_from_dict(): - await test_create_property_async(request_type=dict) - - def test_create_property_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4340,8 +4367,8 @@ async def test_create_property_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.DeletePropertyRequest, - dict, + analytics_admin.DeletePropertyRequest(), + {}, ], ) def test_delete_property(request_type, transport: str = "grpc"): @@ -4352,7 +4379,7 @@ def test_delete_property(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_property), "__call__") as call: @@ -4412,9 +4439,10 @@ def test_delete_property_non_empty_request_with_auto_populated_field(): client.delete_property(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.DeletePropertyRequest( + request_msg = analytics_admin.DeletePropertyRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_property_use_cached_wrapped_rpc(): @@ -4495,9 +4523,14 @@ async def test_delete_property_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_property_async( - transport: str = "grpc_asyncio", request_type=analytics_admin.DeletePropertyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.DeletePropertyRequest(), + {}, + ], +) +async def test_delete_property_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4505,7 +4538,7 @@ async def test_delete_property_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_property), "__call__") as call: @@ -4544,11 +4577,6 @@ async def test_delete_property_async( assert response.account == "account_value" -@pytest.mark.asyncio -async def test_delete_property_async_from_dict(): - await test_delete_property_async(request_type=dict) - - def test_delete_property_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4691,8 +4719,8 @@ async def test_delete_property_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdatePropertyRequest, - dict, + analytics_admin.UpdatePropertyRequest(), + {}, ], ) def test_update_property(request_type, transport: str = "grpc"): @@ -4703,7 +4731,7 @@ def test_update_property(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_property), "__call__") as call: @@ -4761,7 +4789,8 @@ def test_update_property_non_empty_request_with_auto_populated_field(): client.update_property(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdatePropertyRequest() + request_msg = analytics_admin.UpdatePropertyRequest() + assert args[0] == request_msg def test_update_property_use_cached_wrapped_rpc(): @@ -4842,9 +4871,14 @@ async def test_update_property_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_property_async( - transport: str = "grpc_asyncio", request_type=analytics_admin.UpdatePropertyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.UpdatePropertyRequest(), + {}, + ], +) +async def test_update_property_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4852,7 +4886,7 @@ async def test_update_property_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_property), "__call__") as call: @@ -4891,11 +4925,6 @@ async def test_update_property_async( assert response.account == "account_value" -@pytest.mark.asyncio -async def test_update_property_async_from_dict(): - await test_update_property_async(request_type=dict) - - def test_update_property_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5048,8 +5077,8 @@ async def test_update_property_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.CreateFirebaseLinkRequest, - dict, + analytics_admin.CreateFirebaseLinkRequest(), + {}, ], ) def test_create_firebase_link(request_type, transport: str = "grpc"): @@ -5060,7 +5089,7 @@ def test_create_firebase_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( @@ -5110,9 +5139,10 @@ def test_create_firebase_link_non_empty_request_with_auto_populated_field(): client.create_firebase_link(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateFirebaseLinkRequest( + request_msg = analytics_admin.CreateFirebaseLinkRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_firebase_link_use_cached_wrapped_rpc(): @@ -5197,9 +5227,15 @@ async def test_create_firebase_link_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.CreateFirebaseLinkRequest(), + {}, + ], +) async def test_create_firebase_link_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.CreateFirebaseLinkRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5208,7 +5244,7 @@ async def test_create_firebase_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( @@ -5235,11 +5271,6 @@ async def test_create_firebase_link_async( assert response.project == "project_value" -@pytest.mark.asyncio -async def test_create_firebase_link_async_from_dict(): - await test_create_firebase_link_async(request_type=dict) - - def test_create_firebase_link_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5404,8 +5435,8 @@ async def test_create_firebase_link_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.DeleteFirebaseLinkRequest, - dict, + analytics_admin.DeleteFirebaseLinkRequest(), + {}, ], ) def test_delete_firebase_link(request_type, transport: str = "grpc"): @@ -5416,7 +5447,7 @@ def test_delete_firebase_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( @@ -5461,9 +5492,10 @@ def test_delete_firebase_link_non_empty_request_with_auto_populated_field(): client.delete_firebase_link(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.DeleteFirebaseLinkRequest( + request_msg = analytics_admin.DeleteFirebaseLinkRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_firebase_link_use_cached_wrapped_rpc(): @@ -5548,9 +5580,15 @@ async def test_delete_firebase_link_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.DeleteFirebaseLinkRequest(), + {}, + ], +) async def test_delete_firebase_link_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.DeleteFirebaseLinkRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5559,7 +5597,7 @@ async def test_delete_firebase_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( @@ -5579,11 +5617,6 @@ async def test_delete_firebase_link_async( assert response is None -@pytest.mark.asyncio -async def test_delete_firebase_link_async_from_dict(): - await test_delete_firebase_link_async(request_type=dict) - - def test_delete_firebase_link_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5734,8 +5767,8 @@ async def test_delete_firebase_link_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListFirebaseLinksRequest, - dict, + analytics_admin.ListFirebaseLinksRequest(), + {}, ], ) def test_list_firebase_links(request_type, transport: str = "grpc"): @@ -5746,7 +5779,7 @@ def test_list_firebase_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( @@ -5795,10 +5828,11 @@ def test_list_firebase_links_non_empty_request_with_auto_populated_field(): client.list_firebase_links(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListFirebaseLinksRequest( + request_msg = analytics_admin.ListFirebaseLinksRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_firebase_links_use_cached_wrapped_rpc(): @@ -5883,10 +5917,14 @@ async def test_list_firebase_links_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_firebase_links_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.ListFirebaseLinksRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.ListFirebaseLinksRequest(), + {}, + ], +) +async def test_list_firebase_links_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5894,7 +5932,7 @@ async def test_list_firebase_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( @@ -5919,11 +5957,6 @@ async def test_list_firebase_links_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_firebase_links_async_from_dict(): - await test_list_firebase_links_async(request_type=dict) - - def test_list_firebase_links_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6276,8 +6309,8 @@ async def test_list_firebase_links_async_pages(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetGlobalSiteTagRequest, - dict, + analytics_admin.GetGlobalSiteTagRequest(), + {}, ], ) def test_get_global_site_tag(request_type, transport: str = "grpc"): @@ -6288,7 +6321,7 @@ def test_get_global_site_tag(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6338,9 +6371,10 @@ def test_get_global_site_tag_non_empty_request_with_auto_populated_field(): client.get_global_site_tag(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetGlobalSiteTagRequest( + request_msg = analytics_admin.GetGlobalSiteTagRequest( name="name_value", ) + assert args[0] == request_msg def test_get_global_site_tag_use_cached_wrapped_rpc(): @@ -6425,10 +6459,14 @@ async def test_get_global_site_tag_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_global_site_tag_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.GetGlobalSiteTagRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.GetGlobalSiteTagRequest(), + {}, + ], +) +async def test_get_global_site_tag_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6436,7 +6474,7 @@ async def test_get_global_site_tag_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( @@ -6463,11 +6501,6 @@ async def test_get_global_site_tag_async( assert response.snippet == "snippet_value" -@pytest.mark.asyncio -async def test_get_global_site_tag_async_from_dict(): - await test_get_global_site_tag_async(request_type=dict) - - def test_get_global_site_tag_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6622,8 +6655,8 @@ async def test_get_global_site_tag_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.CreateGoogleAdsLinkRequest, - dict, + analytics_admin.CreateGoogleAdsLinkRequest(), + {}, ], ) def test_create_google_ads_link(request_type, transport: str = "grpc"): @@ -6634,7 +6667,7 @@ def test_create_google_ads_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( @@ -6688,9 +6721,10 @@ def test_create_google_ads_link_non_empty_request_with_auto_populated_field(): client.create_google_ads_link(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateGoogleAdsLinkRequest( + request_msg = analytics_admin.CreateGoogleAdsLinkRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_google_ads_link_use_cached_wrapped_rpc(): @@ -6776,9 +6810,15 @@ async def test_create_google_ads_link_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.CreateGoogleAdsLinkRequest(), + {}, + ], +) async def test_create_google_ads_link_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.CreateGoogleAdsLinkRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -6787,7 +6827,7 @@ async def test_create_google_ads_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( @@ -6818,11 +6858,6 @@ async def test_create_google_ads_link_async( assert response.creator_email_address == "creator_email_address_value" -@pytest.mark.asyncio -async def test_create_google_ads_link_async_from_dict(): - await test_create_google_ads_link_async(request_type=dict) - - def test_create_google_ads_link_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6987,8 +7022,8 @@ async def test_create_google_ads_link_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdateGoogleAdsLinkRequest, - dict, + analytics_admin.UpdateGoogleAdsLinkRequest(), + {}, ], ) def test_update_google_ads_link(request_type, transport: str = "grpc"): @@ -6999,7 +7034,7 @@ def test_update_google_ads_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( @@ -7051,7 +7086,8 @@ def test_update_google_ads_link_non_empty_request_with_auto_populated_field(): client.update_google_ads_link(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateGoogleAdsLinkRequest() + request_msg = analytics_admin.UpdateGoogleAdsLinkRequest() + assert args[0] == request_msg def test_update_google_ads_link_use_cached_wrapped_rpc(): @@ -7137,9 +7173,15 @@ async def test_update_google_ads_link_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.UpdateGoogleAdsLinkRequest(), + {}, + ], +) async def test_update_google_ads_link_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.UpdateGoogleAdsLinkRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -7148,7 +7190,7 @@ async def test_update_google_ads_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( @@ -7179,11 +7221,6 @@ async def test_update_google_ads_link_async( assert response.creator_email_address == "creator_email_address_value" -@pytest.mark.asyncio -async def test_update_google_ads_link_async_from_dict(): - await test_update_google_ads_link_async(request_type=dict) - - def test_update_google_ads_link_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7348,8 +7385,8 @@ async def test_update_google_ads_link_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.DeleteGoogleAdsLinkRequest, - dict, + analytics_admin.DeleteGoogleAdsLinkRequest(), + {}, ], ) def test_delete_google_ads_link(request_type, transport: str = "grpc"): @@ -7360,7 +7397,7 @@ def test_delete_google_ads_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( @@ -7405,9 +7442,10 @@ def test_delete_google_ads_link_non_empty_request_with_auto_populated_field(): client.delete_google_ads_link(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.DeleteGoogleAdsLinkRequest( + request_msg = analytics_admin.DeleteGoogleAdsLinkRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_google_ads_link_use_cached_wrapped_rpc(): @@ -7493,9 +7531,15 @@ async def test_delete_google_ads_link_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.DeleteGoogleAdsLinkRequest(), + {}, + ], +) async def test_delete_google_ads_link_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.DeleteGoogleAdsLinkRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -7504,7 +7548,7 @@ async def test_delete_google_ads_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( @@ -7524,11 +7568,6 @@ async def test_delete_google_ads_link_async( assert response is None -@pytest.mark.asyncio -async def test_delete_google_ads_link_async_from_dict(): - await test_delete_google_ads_link_async(request_type=dict) - - def test_delete_google_ads_link_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7679,8 +7718,8 @@ async def test_delete_google_ads_link_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListGoogleAdsLinksRequest, - dict, + analytics_admin.ListGoogleAdsLinksRequest(), + {}, ], ) def test_list_google_ads_links(request_type, transport: str = "grpc"): @@ -7691,7 +7730,7 @@ def test_list_google_ads_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( @@ -7740,10 +7779,11 @@ def test_list_google_ads_links_non_empty_request_with_auto_populated_field(): client.list_google_ads_links(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListGoogleAdsLinksRequest( + request_msg = analytics_admin.ListGoogleAdsLinksRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_google_ads_links_use_cached_wrapped_rpc(): @@ -7829,9 +7869,15 @@ async def test_list_google_ads_links_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.ListGoogleAdsLinksRequest(), + {}, + ], +) async def test_list_google_ads_links_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.ListGoogleAdsLinksRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -7840,7 +7886,7 @@ async def test_list_google_ads_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( @@ -7865,11 +7911,6 @@ async def test_list_google_ads_links_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_google_ads_links_async_from_dict(): - await test_list_google_ads_links_async(request_type=dict) - - def test_list_google_ads_links_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8222,8 +8263,8 @@ async def test_list_google_ads_links_async_pages(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetDataSharingSettingsRequest, - dict, + analytics_admin.GetDataSharingSettingsRequest(), + {}, ], ) def test_get_data_sharing_settings(request_type, transport: str = "grpc"): @@ -8234,7 +8275,7 @@ def test_get_data_sharing_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( @@ -8292,9 +8333,10 @@ def test_get_data_sharing_settings_non_empty_request_with_auto_populated_field() client.get_data_sharing_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetDataSharingSettingsRequest( + request_msg = analytics_admin.GetDataSharingSettingsRequest( name="name_value", ) + assert args[0] == request_msg def test_get_data_sharing_settings_use_cached_wrapped_rpc(): @@ -8380,9 +8422,15 @@ async def test_get_data_sharing_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.GetDataSharingSettingsRequest(), + {}, + ], +) async def test_get_data_sharing_settings_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.GetDataSharingSettingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -8391,7 +8439,7 @@ async def test_get_data_sharing_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( @@ -8426,11 +8474,6 @@ async def test_get_data_sharing_settings_async( assert response.sharing_with_others_enabled is True -@pytest.mark.asyncio -async def test_get_data_sharing_settings_async_from_dict(): - await test_get_data_sharing_settings_async(request_type=dict) - - def test_get_data_sharing_settings_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8585,8 +8628,8 @@ async def test_get_data_sharing_settings_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetMeasurementProtocolSecretRequest, - dict, + analytics_admin.GetMeasurementProtocolSecretRequest(), + {}, ], ) def test_get_measurement_protocol_secret(request_type, transport: str = "grpc"): @@ -8597,7 +8640,7 @@ def test_get_measurement_protocol_secret(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8649,9 +8692,10 @@ def test_get_measurement_protocol_secret_non_empty_request_with_auto_populated_f client.get_measurement_protocol_secret(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetMeasurementProtocolSecretRequest( + request_msg = analytics_admin.GetMeasurementProtocolSecretRequest( name="name_value", ) + assert args[0] == request_msg def test_get_measurement_protocol_secret_use_cached_wrapped_rpc(): @@ -8737,9 +8781,15 @@ async def test_get_measurement_protocol_secret_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.GetMeasurementProtocolSecretRequest(), + {}, + ], +) async def test_get_measurement_protocol_secret_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.GetMeasurementProtocolSecretRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -8748,7 +8798,7 @@ async def test_get_measurement_protocol_secret_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( @@ -8777,11 +8827,6 @@ async def test_get_measurement_protocol_secret_async( assert response.secret_value == "secret_value_value" -@pytest.mark.asyncio -async def test_get_measurement_protocol_secret_async_from_dict(): - await test_get_measurement_protocol_secret_async(request_type=dict) - - def test_get_measurement_protocol_secret_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8936,8 +8981,8 @@ async def test_get_measurement_protocol_secret_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListMeasurementProtocolSecretsRequest, - dict, + analytics_admin.ListMeasurementProtocolSecretsRequest(), + {}, ], ) def test_list_measurement_protocol_secrets(request_type, transport: str = "grpc"): @@ -8948,7 +8993,7 @@ def test_list_measurement_protocol_secrets(request_type, transport: str = "grpc" # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8997,10 +9042,11 @@ def test_list_measurement_protocol_secrets_non_empty_request_with_auto_populated client.list_measurement_protocol_secrets(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListMeasurementProtocolSecretsRequest( + request_msg = analytics_admin.ListMeasurementProtocolSecretsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_measurement_protocol_secrets_use_cached_wrapped_rpc(): @@ -9086,9 +9132,15 @@ async def test_list_measurement_protocol_secrets_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.ListMeasurementProtocolSecretsRequest(), + {}, + ], +) async def test_list_measurement_protocol_secrets_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.ListMeasurementProtocolSecretsRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -9097,7 +9149,7 @@ async def test_list_measurement_protocol_secrets_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( @@ -9122,11 +9174,6 @@ async def test_list_measurement_protocol_secrets_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_measurement_protocol_secrets_async_from_dict(): - await test_list_measurement_protocol_secrets_async(request_type=dict) - - def test_list_measurement_protocol_secrets_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9485,8 +9532,8 @@ async def test_list_measurement_protocol_secrets_async_pages(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.CreateMeasurementProtocolSecretRequest, - dict, + analytics_admin.CreateMeasurementProtocolSecretRequest(), + {}, ], ) def test_create_measurement_protocol_secret(request_type, transport: str = "grpc"): @@ -9497,7 +9544,7 @@ def test_create_measurement_protocol_secret(request_type, transport: str = "grpc # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9549,9 +9596,10 @@ def test_create_measurement_protocol_secret_non_empty_request_with_auto_populate client.create_measurement_protocol_secret(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateMeasurementProtocolSecretRequest( + request_msg = analytics_admin.CreateMeasurementProtocolSecretRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_measurement_protocol_secret_use_cached_wrapped_rpc(): @@ -9637,9 +9685,15 @@ async def test_create_measurement_protocol_secret_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.CreateMeasurementProtocolSecretRequest(), + {}, + ], +) async def test_create_measurement_protocol_secret_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.CreateMeasurementProtocolSecretRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -9648,7 +9702,7 @@ async def test_create_measurement_protocol_secret_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( @@ -9677,11 +9731,6 @@ async def test_create_measurement_protocol_secret_async( assert response.secret_value == "secret_value_value" -@pytest.mark.asyncio -async def test_create_measurement_protocol_secret_async_from_dict(): - await test_create_measurement_protocol_secret_async(request_type=dict) - - def test_create_measurement_protocol_secret_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9854,8 +9903,8 @@ async def test_create_measurement_protocol_secret_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.DeleteMeasurementProtocolSecretRequest, - dict, + analytics_admin.DeleteMeasurementProtocolSecretRequest(), + {}, ], ) def test_delete_measurement_protocol_secret(request_type, transport: str = "grpc"): @@ -9866,7 +9915,7 @@ def test_delete_measurement_protocol_secret(request_type, transport: str = "grpc # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9911,9 +9960,10 @@ def test_delete_measurement_protocol_secret_non_empty_request_with_auto_populate client.delete_measurement_protocol_secret(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.DeleteMeasurementProtocolSecretRequest( + request_msg = analytics_admin.DeleteMeasurementProtocolSecretRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_measurement_protocol_secret_use_cached_wrapped_rpc(): @@ -9999,9 +10049,15 @@ async def test_delete_measurement_protocol_secret_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.DeleteMeasurementProtocolSecretRequest(), + {}, + ], +) async def test_delete_measurement_protocol_secret_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.DeleteMeasurementProtocolSecretRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -10010,7 +10066,7 @@ async def test_delete_measurement_protocol_secret_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( @@ -10030,11 +10086,6 @@ async def test_delete_measurement_protocol_secret_async( assert response is None -@pytest.mark.asyncio -async def test_delete_measurement_protocol_secret_async_from_dict(): - await test_delete_measurement_protocol_secret_async(request_type=dict) - - def test_delete_measurement_protocol_secret_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10185,8 +10236,8 @@ async def test_delete_measurement_protocol_secret_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdateMeasurementProtocolSecretRequest, - dict, + analytics_admin.UpdateMeasurementProtocolSecretRequest(), + {}, ], ) def test_update_measurement_protocol_secret(request_type, transport: str = "grpc"): @@ -10197,7 +10248,7 @@ def test_update_measurement_protocol_secret(request_type, transport: str = "grpc # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10247,7 +10298,8 @@ def test_update_measurement_protocol_secret_non_empty_request_with_auto_populate client.update_measurement_protocol_secret(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateMeasurementProtocolSecretRequest() + request_msg = analytics_admin.UpdateMeasurementProtocolSecretRequest() + assert args[0] == request_msg def test_update_measurement_protocol_secret_use_cached_wrapped_rpc(): @@ -10333,9 +10385,15 @@ async def test_update_measurement_protocol_secret_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.UpdateMeasurementProtocolSecretRequest(), + {}, + ], +) async def test_update_measurement_protocol_secret_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.UpdateMeasurementProtocolSecretRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -10344,7 +10402,7 @@ async def test_update_measurement_protocol_secret_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( @@ -10373,11 +10431,6 @@ async def test_update_measurement_protocol_secret_async( assert response.secret_value == "secret_value_value" -@pytest.mark.asyncio -async def test_update_measurement_protocol_secret_async_from_dict(): - await test_update_measurement_protocol_secret_async(request_type=dict) - - def test_update_measurement_protocol_secret_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10550,8 +10603,8 @@ async def test_update_measurement_protocol_secret_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.AcknowledgeUserDataCollectionRequest, - dict, + analytics_admin.AcknowledgeUserDataCollectionRequest(), + {}, ], ) def test_acknowledge_user_data_collection(request_type, transport: str = "grpc"): @@ -10562,7 +10615,7 @@ def test_acknowledge_user_data_collection(request_type, transport: str = "grpc") # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10608,10 +10661,11 @@ def test_acknowledge_user_data_collection_non_empty_request_with_auto_populated_ client.acknowledge_user_data_collection(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.AcknowledgeUserDataCollectionRequest( + request_msg = analytics_admin.AcknowledgeUserDataCollectionRequest( property="property_value", acknowledgement="acknowledgement_value", ) + assert args[0] == request_msg def test_acknowledge_user_data_collection_use_cached_wrapped_rpc(): @@ -10697,9 +10751,15 @@ async def test_acknowledge_user_data_collection_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.AcknowledgeUserDataCollectionRequest(), + {}, + ], +) async def test_acknowledge_user_data_collection_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.AcknowledgeUserDataCollectionRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -10708,7 +10768,7 @@ async def test_acknowledge_user_data_collection_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( @@ -10730,11 +10790,6 @@ async def test_acknowledge_user_data_collection_async( assert isinstance(response, analytics_admin.AcknowledgeUserDataCollectionResponse) -@pytest.mark.asyncio -async def test_acknowledge_user_data_collection_async_from_dict(): - await test_acknowledge_user_data_collection_async(request_type=dict) - - def test_acknowledge_user_data_collection_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10803,8 +10858,8 @@ async def test_acknowledge_user_data_collection_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetSKAdNetworkConversionValueSchemaRequest, - dict, + analytics_admin.GetSKAdNetworkConversionValueSchemaRequest(), + {}, ], ) def test_get_sk_ad_network_conversion_value_schema( @@ -10817,7 +10872,7 @@ def test_get_sk_ad_network_conversion_value_schema( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10867,9 +10922,10 @@ def test_get_sk_ad_network_conversion_value_schema_non_empty_request_with_auto_p client.get_sk_ad_network_conversion_value_schema(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetSKAdNetworkConversionValueSchemaRequest( + request_msg = analytics_admin.GetSKAdNetworkConversionValueSchemaRequest( name="name_value", ) + assert args[0] == request_msg def test_get_sk_ad_network_conversion_value_schema_use_cached_wrapped_rpc(): @@ -10955,9 +11011,15 @@ async def test_get_sk_ad_network_conversion_value_schema_async_use_cached_wrappe @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.GetSKAdNetworkConversionValueSchemaRequest(), + {}, + ], +) async def test_get_sk_ad_network_conversion_value_schema_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.GetSKAdNetworkConversionValueSchemaRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -10966,7 +11028,7 @@ async def test_get_sk_ad_network_conversion_value_schema_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( @@ -10993,11 +11055,6 @@ async def test_get_sk_ad_network_conversion_value_schema_async( assert response.apply_conversion_values is True -@pytest.mark.asyncio -async def test_get_sk_ad_network_conversion_value_schema_async_from_dict(): - await test_get_sk_ad_network_conversion_value_schema_async(request_type=dict) - - def test_get_sk_ad_network_conversion_value_schema_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11152,8 +11209,8 @@ async def test_get_sk_ad_network_conversion_value_schema_flattened_error_async() @pytest.mark.parametrize( "request_type", [ - analytics_admin.CreateSKAdNetworkConversionValueSchemaRequest, - dict, + analytics_admin.CreateSKAdNetworkConversionValueSchemaRequest(), + {}, ], ) def test_create_sk_ad_network_conversion_value_schema( @@ -11166,7 +11223,7 @@ def test_create_sk_ad_network_conversion_value_schema( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11216,9 +11273,10 @@ def test_create_sk_ad_network_conversion_value_schema_non_empty_request_with_aut client.create_sk_ad_network_conversion_value_schema(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateSKAdNetworkConversionValueSchemaRequest( + request_msg = analytics_admin.CreateSKAdNetworkConversionValueSchemaRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_sk_ad_network_conversion_value_schema_use_cached_wrapped_rpc(): @@ -11304,9 +11362,15 @@ async def test_create_sk_ad_network_conversion_value_schema_async_use_cached_wra @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.CreateSKAdNetworkConversionValueSchemaRequest(), + {}, + ], +) async def test_create_sk_ad_network_conversion_value_schema_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.CreateSKAdNetworkConversionValueSchemaRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -11315,7 +11379,7 @@ async def test_create_sk_ad_network_conversion_value_schema_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( @@ -11342,11 +11406,6 @@ async def test_create_sk_ad_network_conversion_value_schema_async( assert response.apply_conversion_values is True -@pytest.mark.asyncio -async def test_create_sk_ad_network_conversion_value_schema_async_from_dict(): - await test_create_sk_ad_network_conversion_value_schema_async(request_type=dict) - - def test_create_sk_ad_network_conversion_value_schema_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11519,8 +11578,8 @@ async def test_create_sk_ad_network_conversion_value_schema_flattened_error_asyn @pytest.mark.parametrize( "request_type", [ - analytics_admin.DeleteSKAdNetworkConversionValueSchemaRequest, - dict, + analytics_admin.DeleteSKAdNetworkConversionValueSchemaRequest(), + {}, ], ) def test_delete_sk_ad_network_conversion_value_schema( @@ -11533,7 +11592,7 @@ def test_delete_sk_ad_network_conversion_value_schema( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11578,9 +11637,10 @@ def test_delete_sk_ad_network_conversion_value_schema_non_empty_request_with_aut client.delete_sk_ad_network_conversion_value_schema(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.DeleteSKAdNetworkConversionValueSchemaRequest( + request_msg = analytics_admin.DeleteSKAdNetworkConversionValueSchemaRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_sk_ad_network_conversion_value_schema_use_cached_wrapped_rpc(): @@ -11666,9 +11726,15 @@ async def test_delete_sk_ad_network_conversion_value_schema_async_use_cached_wra @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.DeleteSKAdNetworkConversionValueSchemaRequest(), + {}, + ], +) async def test_delete_sk_ad_network_conversion_value_schema_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.DeleteSKAdNetworkConversionValueSchemaRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -11677,7 +11743,7 @@ async def test_delete_sk_ad_network_conversion_value_schema_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( @@ -11697,11 +11763,6 @@ async def test_delete_sk_ad_network_conversion_value_schema_async( assert response is None -@pytest.mark.asyncio -async def test_delete_sk_ad_network_conversion_value_schema_async_from_dict(): - await test_delete_sk_ad_network_conversion_value_schema_async(request_type=dict) - - def test_delete_sk_ad_network_conversion_value_schema_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11852,8 +11913,8 @@ async def test_delete_sk_ad_network_conversion_value_schema_flattened_error_asyn @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdateSKAdNetworkConversionValueSchemaRequest, - dict, + analytics_admin.UpdateSKAdNetworkConversionValueSchemaRequest(), + {}, ], ) def test_update_sk_ad_network_conversion_value_schema( @@ -11866,7 +11927,7 @@ def test_update_sk_ad_network_conversion_value_schema( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11914,9 +11975,8 @@ def test_update_sk_ad_network_conversion_value_schema_non_empty_request_with_aut client.update_sk_ad_network_conversion_value_schema(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert ( - args[0] == analytics_admin.UpdateSKAdNetworkConversionValueSchemaRequest() - ) + request_msg = analytics_admin.UpdateSKAdNetworkConversionValueSchemaRequest() + assert args[0] == request_msg def test_update_sk_ad_network_conversion_value_schema_use_cached_wrapped_rpc(): @@ -12002,9 +12062,15 @@ async def test_update_sk_ad_network_conversion_value_schema_async_use_cached_wra @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.UpdateSKAdNetworkConversionValueSchemaRequest(), + {}, + ], +) async def test_update_sk_ad_network_conversion_value_schema_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.UpdateSKAdNetworkConversionValueSchemaRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -12013,7 +12079,7 @@ async def test_update_sk_ad_network_conversion_value_schema_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( @@ -12040,11 +12106,6 @@ async def test_update_sk_ad_network_conversion_value_schema_async( assert response.apply_conversion_values is True -@pytest.mark.asyncio -async def test_update_sk_ad_network_conversion_value_schema_async_from_dict(): - await test_update_sk_ad_network_conversion_value_schema_async(request_type=dict) - - def test_update_sk_ad_network_conversion_value_schema_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12217,8 +12278,8 @@ async def test_update_sk_ad_network_conversion_value_schema_flattened_error_asyn @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListSKAdNetworkConversionValueSchemasRequest, - dict, + analytics_admin.ListSKAdNetworkConversionValueSchemasRequest(), + {}, ], ) def test_list_sk_ad_network_conversion_value_schemas( @@ -12231,7 +12292,7 @@ def test_list_sk_ad_network_conversion_value_schemas( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -12282,10 +12343,11 @@ def test_list_sk_ad_network_conversion_value_schemas_non_empty_request_with_auto client.list_sk_ad_network_conversion_value_schemas(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListSKAdNetworkConversionValueSchemasRequest( + request_msg = analytics_admin.ListSKAdNetworkConversionValueSchemasRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_sk_ad_network_conversion_value_schemas_use_cached_wrapped_rpc(): @@ -12371,9 +12433,15 @@ async def test_list_sk_ad_network_conversion_value_schemas_async_use_cached_wrap @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.ListSKAdNetworkConversionValueSchemasRequest(), + {}, + ], +) async def test_list_sk_ad_network_conversion_value_schemas_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.ListSKAdNetworkConversionValueSchemasRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -12382,7 +12450,7 @@ async def test_list_sk_ad_network_conversion_value_schemas_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( @@ -12407,11 +12475,6 @@ async def test_list_sk_ad_network_conversion_value_schemas_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_sk_ad_network_conversion_value_schemas_async_from_dict(): - await test_list_sk_ad_network_conversion_value_schemas_async(request_type=dict) - - def test_list_sk_ad_network_conversion_value_schemas_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12784,8 +12847,8 @@ async def test_list_sk_ad_network_conversion_value_schemas_async_pages(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.SearchChangeHistoryEventsRequest, - dict, + analytics_admin.SearchChangeHistoryEventsRequest(), + {}, ], ) def test_search_change_history_events(request_type, transport: str = "grpc"): @@ -12796,7 +12859,7 @@ def test_search_change_history_events(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -12846,11 +12909,12 @@ def test_search_change_history_events_non_empty_request_with_auto_populated_fiel client.search_change_history_events(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.SearchChangeHistoryEventsRequest( + request_msg = analytics_admin.SearchChangeHistoryEventsRequest( account="account_value", property="property_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_search_change_history_events_use_cached_wrapped_rpc(): @@ -12936,9 +13000,15 @@ async def test_search_change_history_events_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.SearchChangeHistoryEventsRequest(), + {}, + ], +) async def test_search_change_history_events_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.SearchChangeHistoryEventsRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -12947,7 +13017,7 @@ async def test_search_change_history_events_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( @@ -12972,11 +13042,6 @@ async def test_search_change_history_events_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_search_change_history_events_async_from_dict(): - await test_search_change_history_events_async(request_type=dict) - - def test_search_change_history_events_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13247,8 +13312,8 @@ async def test_search_change_history_events_async_pages(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetGoogleSignalsSettingsRequest, - dict, + analytics_admin.GetGoogleSignalsSettingsRequest(), + {}, ], ) def test_get_google_signals_settings(request_type, transport: str = "grpc"): @@ -13259,7 +13324,7 @@ def test_get_google_signals_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( @@ -13314,9 +13379,10 @@ def test_get_google_signals_settings_non_empty_request_with_auto_populated_field client.get_google_signals_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetGoogleSignalsSettingsRequest( + request_msg = analytics_admin.GetGoogleSignalsSettingsRequest( name="name_value", ) + assert args[0] == request_msg def test_get_google_signals_settings_use_cached_wrapped_rpc(): @@ -13402,9 +13468,15 @@ async def test_get_google_signals_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.GetGoogleSignalsSettingsRequest(), + {}, + ], +) async def test_get_google_signals_settings_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.GetGoogleSignalsSettingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -13413,7 +13485,7 @@ async def test_get_google_signals_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( @@ -13445,11 +13517,6 @@ async def test_get_google_signals_settings_async( ) -@pytest.mark.asyncio -async def test_get_google_signals_settings_async_from_dict(): - await test_get_google_signals_settings_async(request_type=dict) - - def test_get_google_signals_settings_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13604,8 +13671,8 @@ async def test_get_google_signals_settings_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdateGoogleSignalsSettingsRequest, - dict, + analytics_admin.UpdateGoogleSignalsSettingsRequest(), + {}, ], ) def test_update_google_signals_settings(request_type, transport: str = "grpc"): @@ -13616,7 +13683,7 @@ def test_update_google_signals_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( @@ -13669,7 +13736,8 @@ def test_update_google_signals_settings_non_empty_request_with_auto_populated_fi client.update_google_signals_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateGoogleSignalsSettingsRequest() + request_msg = analytics_admin.UpdateGoogleSignalsSettingsRequest() + assert args[0] == request_msg def test_update_google_signals_settings_use_cached_wrapped_rpc(): @@ -13755,9 +13823,15 @@ async def test_update_google_signals_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.UpdateGoogleSignalsSettingsRequest(), + {}, + ], +) async def test_update_google_signals_settings_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.UpdateGoogleSignalsSettingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -13766,7 +13840,7 @@ async def test_update_google_signals_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( @@ -13798,11 +13872,6 @@ async def test_update_google_signals_settings_async( ) -@pytest.mark.asyncio -async def test_update_google_signals_settings_async_from_dict(): - await test_update_google_signals_settings_async(request_type=dict) - - def test_update_google_signals_settings_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13967,8 +14036,8 @@ async def test_update_google_signals_settings_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.CreateConversionEventRequest, - dict, + analytics_admin.CreateConversionEventRequest(), + {}, ], ) def test_create_conversion_event(request_type, transport: str = "grpc"): @@ -13979,7 +14048,7 @@ def test_create_conversion_event(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -14038,9 +14107,10 @@ def test_create_conversion_event_non_empty_request_with_auto_populated_field(): client.create_conversion_event(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateConversionEventRequest( + request_msg = analytics_admin.CreateConversionEventRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_conversion_event_use_cached_wrapped_rpc(): @@ -14126,9 +14196,15 @@ async def test_create_conversion_event_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.CreateConversionEventRequest(), + {}, + ], +) async def test_create_conversion_event_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.CreateConversionEventRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -14137,7 +14213,7 @@ async def test_create_conversion_event_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( @@ -14173,11 +14249,6 @@ async def test_create_conversion_event_async( ) -@pytest.mark.asyncio -async def test_create_conversion_event_async_from_dict(): - await test_create_conversion_event_async(request_type=dict) - - def test_create_conversion_event_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14342,8 +14413,8 @@ async def test_create_conversion_event_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdateConversionEventRequest, - dict, + analytics_admin.UpdateConversionEventRequest(), + {}, ], ) def test_update_conversion_event(request_type, transport: str = "grpc"): @@ -14354,7 +14425,7 @@ def test_update_conversion_event(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -14411,7 +14482,8 @@ def test_update_conversion_event_non_empty_request_with_auto_populated_field(): client.update_conversion_event(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateConversionEventRequest() + request_msg = analytics_admin.UpdateConversionEventRequest() + assert args[0] == request_msg def test_update_conversion_event_use_cached_wrapped_rpc(): @@ -14497,9 +14569,15 @@ async def test_update_conversion_event_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.UpdateConversionEventRequest(), + {}, + ], +) async def test_update_conversion_event_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.UpdateConversionEventRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -14508,7 +14586,7 @@ async def test_update_conversion_event_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( @@ -14544,11 +14622,6 @@ async def test_update_conversion_event_async( ) -@pytest.mark.asyncio -async def test_update_conversion_event_async_from_dict(): - await test_update_conversion_event_async(request_type=dict) - - def test_update_conversion_event_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14713,8 +14786,8 @@ async def test_update_conversion_event_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetConversionEventRequest, - dict, + analytics_admin.GetConversionEventRequest(), + {}, ], ) def test_get_conversion_event(request_type, transport: str = "grpc"): @@ -14725,7 +14798,7 @@ def test_get_conversion_event(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -14784,9 +14857,10 @@ def test_get_conversion_event_non_empty_request_with_auto_populated_field(): client.get_conversion_event(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetConversionEventRequest( + request_msg = analytics_admin.GetConversionEventRequest( name="name_value", ) + assert args[0] == request_msg def test_get_conversion_event_use_cached_wrapped_rpc(): @@ -14871,9 +14945,15 @@ async def test_get_conversion_event_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.GetConversionEventRequest(), + {}, + ], +) async def test_get_conversion_event_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.GetConversionEventRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -14882,7 +14962,7 @@ async def test_get_conversion_event_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( @@ -14918,11 +14998,6 @@ async def test_get_conversion_event_async( ) -@pytest.mark.asyncio -async def test_get_conversion_event_async_from_dict(): - await test_get_conversion_event_async(request_type=dict) - - def test_get_conversion_event_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15077,8 +15152,8 @@ async def test_get_conversion_event_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.DeleteConversionEventRequest, - dict, + analytics_admin.DeleteConversionEventRequest(), + {}, ], ) def test_delete_conversion_event(request_type, transport: str = "grpc"): @@ -15089,7 +15164,7 @@ def test_delete_conversion_event(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -15134,9 +15209,10 @@ def test_delete_conversion_event_non_empty_request_with_auto_populated_field(): client.delete_conversion_event(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.DeleteConversionEventRequest( + request_msg = analytics_admin.DeleteConversionEventRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_conversion_event_use_cached_wrapped_rpc(): @@ -15222,9 +15298,15 @@ async def test_delete_conversion_event_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.DeleteConversionEventRequest(), + {}, + ], +) async def test_delete_conversion_event_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.DeleteConversionEventRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -15233,7 +15315,7 @@ async def test_delete_conversion_event_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( @@ -15253,11 +15335,6 @@ async def test_delete_conversion_event_async( assert response is None -@pytest.mark.asyncio -async def test_delete_conversion_event_async_from_dict(): - await test_delete_conversion_event_async(request_type=dict) - - def test_delete_conversion_event_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15408,8 +15485,8 @@ async def test_delete_conversion_event_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListConversionEventsRequest, - dict, + analytics_admin.ListConversionEventsRequest(), + {}, ], ) def test_list_conversion_events(request_type, transport: str = "grpc"): @@ -15420,7 +15497,7 @@ def test_list_conversion_events(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -15469,10 +15546,11 @@ def test_list_conversion_events_non_empty_request_with_auto_populated_field(): client.list_conversion_events(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListConversionEventsRequest( + request_msg = analytics_admin.ListConversionEventsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_conversion_events_use_cached_wrapped_rpc(): @@ -15558,9 +15636,15 @@ async def test_list_conversion_events_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.ListConversionEventsRequest(), + {}, + ], +) async def test_list_conversion_events_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.ListConversionEventsRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -15569,7 +15653,7 @@ async def test_list_conversion_events_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( @@ -15594,11 +15678,6 @@ async def test_list_conversion_events_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_conversion_events_async_from_dict(): - await test_list_conversion_events_async(request_type=dict) - - def test_list_conversion_events_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15951,8 +16030,8 @@ async def test_list_conversion_events_async_pages(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.CreateKeyEventRequest, - dict, + analytics_admin.CreateKeyEventRequest(), + {}, ], ) def test_create_key_event(request_type, transport: str = "grpc"): @@ -15963,7 +16042,7 @@ def test_create_key_event(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_key_event), "__call__") as call: @@ -16015,9 +16094,10 @@ def test_create_key_event_non_empty_request_with_auto_populated_field(): client.create_key_event(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateKeyEventRequest( + request_msg = analytics_admin.CreateKeyEventRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_key_event_use_cached_wrapped_rpc(): @@ -16100,9 +16180,14 @@ async def test_create_key_event_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_key_event_async( - transport: str = "grpc_asyncio", request_type=analytics_admin.CreateKeyEventRequest -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.CreateKeyEventRequest(), + {}, + ], +) +async def test_create_key_event_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -16110,7 +16195,7 @@ async def test_create_key_event_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_key_event), "__call__") as call: @@ -16141,11 +16226,6 @@ async def test_create_key_event_async( assert response.counting_method == resources.KeyEvent.CountingMethod.ONCE_PER_EVENT -@pytest.mark.asyncio -async def test_create_key_event_async_from_dict(): - await test_create_key_event_async(request_type=dict) - - def test_create_key_event_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16298,8 +16378,8 @@ async def test_create_key_event_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdateKeyEventRequest, - dict, + analytics_admin.UpdateKeyEventRequest(), + {}, ], ) def test_update_key_event(request_type, transport: str = "grpc"): @@ -16310,7 +16390,7 @@ def test_update_key_event(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_key_event), "__call__") as call: @@ -16360,7 +16440,8 @@ def test_update_key_event_non_empty_request_with_auto_populated_field(): client.update_key_event(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateKeyEventRequest() + request_msg = analytics_admin.UpdateKeyEventRequest() + assert args[0] == request_msg def test_update_key_event_use_cached_wrapped_rpc(): @@ -16443,9 +16524,14 @@ async def test_update_key_event_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_key_event_async( - transport: str = "grpc_asyncio", request_type=analytics_admin.UpdateKeyEventRequest -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.UpdateKeyEventRequest(), + {}, + ], +) +async def test_update_key_event_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -16453,7 +16539,7 @@ async def test_update_key_event_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_key_event), "__call__") as call: @@ -16484,11 +16570,6 @@ async def test_update_key_event_async( assert response.counting_method == resources.KeyEvent.CountingMethod.ONCE_PER_EVENT -@pytest.mark.asyncio -async def test_update_key_event_async_from_dict(): - await test_update_key_event_async(request_type=dict) - - def test_update_key_event_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16641,8 +16722,8 @@ async def test_update_key_event_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetKeyEventRequest, - dict, + analytics_admin.GetKeyEventRequest(), + {}, ], ) def test_get_key_event(request_type, transport: str = "grpc"): @@ -16653,7 +16734,7 @@ def test_get_key_event(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_key_event), "__call__") as call: @@ -16705,9 +16786,10 @@ def test_get_key_event_non_empty_request_with_auto_populated_field(): client.get_key_event(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetKeyEventRequest( + request_msg = analytics_admin.GetKeyEventRequest( name="name_value", ) + assert args[0] == request_msg def test_get_key_event_use_cached_wrapped_rpc(): @@ -16788,9 +16870,14 @@ async def test_get_key_event_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_key_event_async( - transport: str = "grpc_asyncio", request_type=analytics_admin.GetKeyEventRequest -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.GetKeyEventRequest(), + {}, + ], +) +async def test_get_key_event_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -16798,7 +16885,7 @@ async def test_get_key_event_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_key_event), "__call__") as call: @@ -16829,11 +16916,6 @@ async def test_get_key_event_async( assert response.counting_method == resources.KeyEvent.CountingMethod.ONCE_PER_EVENT -@pytest.mark.asyncio -async def test_get_key_event_async_from_dict(): - await test_get_key_event_async(request_type=dict) - - def test_get_key_event_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16976,8 +17058,8 @@ async def test_get_key_event_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.DeleteKeyEventRequest, - dict, + analytics_admin.DeleteKeyEventRequest(), + {}, ], ) def test_delete_key_event(request_type, transport: str = "grpc"): @@ -16988,7 +17070,7 @@ def test_delete_key_event(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_key_event), "__call__") as call: @@ -17029,9 +17111,10 @@ def test_delete_key_event_non_empty_request_with_auto_populated_field(): client.delete_key_event(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.DeleteKeyEventRequest( + request_msg = analytics_admin.DeleteKeyEventRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_key_event_use_cached_wrapped_rpc(): @@ -17114,9 +17197,14 @@ async def test_delete_key_event_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_key_event_async( - transport: str = "grpc_asyncio", request_type=analytics_admin.DeleteKeyEventRequest -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.DeleteKeyEventRequest(), + {}, + ], +) +async def test_delete_key_event_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -17124,7 +17212,7 @@ async def test_delete_key_event_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_key_event), "__call__") as call: @@ -17142,11 +17230,6 @@ async def test_delete_key_event_async( assert response is None -@pytest.mark.asyncio -async def test_delete_key_event_async_from_dict(): - await test_delete_key_event_async(request_type=dict) - - def test_delete_key_event_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17289,8 +17372,8 @@ async def test_delete_key_event_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListKeyEventsRequest, - dict, + analytics_admin.ListKeyEventsRequest(), + {}, ], ) def test_list_key_events(request_type, transport: str = "grpc"): @@ -17301,7 +17384,7 @@ def test_list_key_events(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_key_events), "__call__") as call: @@ -17346,10 +17429,11 @@ def test_list_key_events_non_empty_request_with_auto_populated_field(): client.list_key_events(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListKeyEventsRequest( + request_msg = analytics_admin.ListKeyEventsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_key_events_use_cached_wrapped_rpc(): @@ -17430,9 +17514,14 @@ async def test_list_key_events_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_key_events_async( - transport: str = "grpc_asyncio", request_type=analytics_admin.ListKeyEventsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.ListKeyEventsRequest(), + {}, + ], +) +async def test_list_key_events_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -17440,7 +17529,7 @@ async def test_list_key_events_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_key_events), "__call__") as call: @@ -17463,11 +17552,6 @@ async def test_list_key_events_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_key_events_async_from_dict(): - await test_list_key_events_async(request_type=dict) - - def test_list_key_events_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17804,8 +17888,8 @@ async def test_list_key_events_async_pages(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetDisplayVideo360AdvertiserLinkRequest, - dict, + analytics_admin.GetDisplayVideo360AdvertiserLinkRequest(), + {}, ], ) def test_get_display_video360_advertiser_link(request_type, transport: str = "grpc"): @@ -17816,7 +17900,7 @@ def test_get_display_video360_advertiser_link(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( @@ -17868,9 +17952,10 @@ def test_get_display_video360_advertiser_link_non_empty_request_with_auto_popula client.get_display_video360_advertiser_link(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetDisplayVideo360AdvertiserLinkRequest( + request_msg = analytics_admin.GetDisplayVideo360AdvertiserLinkRequest( name="name_value", ) + assert args[0] == request_msg def test_get_display_video360_advertiser_link_use_cached_wrapped_rpc(): @@ -17956,9 +18041,15 @@ async def test_get_display_video360_advertiser_link_async_use_cached_wrapped_rpc @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.GetDisplayVideo360AdvertiserLinkRequest(), + {}, + ], +) async def test_get_display_video360_advertiser_link_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.GetDisplayVideo360AdvertiserLinkRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -17967,7 +18058,7 @@ async def test_get_display_video360_advertiser_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( @@ -17996,11 +18087,6 @@ async def test_get_display_video360_advertiser_link_async( assert response.advertiser_display_name == "advertiser_display_name_value" -@pytest.mark.asyncio -async def test_get_display_video360_advertiser_link_async_from_dict(): - await test_get_display_video360_advertiser_link_async(request_type=dict) - - def test_get_display_video360_advertiser_link_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18155,8 +18241,8 @@ async def test_get_display_video360_advertiser_link_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListDisplayVideo360AdvertiserLinksRequest, - dict, + analytics_admin.ListDisplayVideo360AdvertiserLinksRequest(), + {}, ], ) def test_list_display_video360_advertiser_links(request_type, transport: str = "grpc"): @@ -18167,7 +18253,7 @@ def test_list_display_video360_advertiser_links(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( @@ -18216,10 +18302,11 @@ def test_list_display_video360_advertiser_links_non_empty_request_with_auto_popu client.list_display_video360_advertiser_links(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListDisplayVideo360AdvertiserLinksRequest( + request_msg = analytics_admin.ListDisplayVideo360AdvertiserLinksRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_display_video360_advertiser_links_use_cached_wrapped_rpc(): @@ -18305,9 +18392,15 @@ async def test_list_display_video360_advertiser_links_async_use_cached_wrapped_r @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.ListDisplayVideo360AdvertiserLinksRequest(), + {}, + ], +) async def test_list_display_video360_advertiser_links_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.ListDisplayVideo360AdvertiserLinksRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -18316,7 +18409,7 @@ async def test_list_display_video360_advertiser_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( @@ -18341,11 +18434,6 @@ async def test_list_display_video360_advertiser_links_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_display_video360_advertiser_links_async_from_dict(): - await test_list_display_video360_advertiser_links_async(request_type=dict) - - def test_list_display_video360_advertiser_links_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18706,8 +18794,8 @@ async def test_list_display_video360_advertiser_links_async_pages(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest, - dict, + analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest(), + {}, ], ) def test_create_display_video360_advertiser_link(request_type, transport: str = "grpc"): @@ -18718,7 +18806,7 @@ def test_create_display_video360_advertiser_link(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( @@ -18770,9 +18858,10 @@ def test_create_display_video360_advertiser_link_non_empty_request_with_auto_pop client.create_display_video360_advertiser_link(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest( + request_msg = analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_display_video360_advertiser_link_use_cached_wrapped_rpc(): @@ -18858,9 +18947,15 @@ async def test_create_display_video360_advertiser_link_async_use_cached_wrapped_ @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest(), + {}, + ], +) async def test_create_display_video360_advertiser_link_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -18869,7 +18964,7 @@ async def test_create_display_video360_advertiser_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( @@ -18898,11 +18993,6 @@ async def test_create_display_video360_advertiser_link_async( assert response.advertiser_display_name == "advertiser_display_name_value" -@pytest.mark.asyncio -async def test_create_display_video360_advertiser_link_async_from_dict(): - await test_create_display_video360_advertiser_link_async(request_type=dict) - - def test_create_display_video360_advertiser_link_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -19075,8 +19165,8 @@ async def test_create_display_video360_advertiser_link_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest, - dict, + analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest(), + {}, ], ) def test_delete_display_video360_advertiser_link(request_type, transport: str = "grpc"): @@ -19087,7 +19177,7 @@ def test_delete_display_video360_advertiser_link(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( @@ -19132,9 +19222,10 @@ def test_delete_display_video360_advertiser_link_non_empty_request_with_auto_pop client.delete_display_video360_advertiser_link(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest( + request_msg = analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_display_video360_advertiser_link_use_cached_wrapped_rpc(): @@ -19220,9 +19311,15 @@ async def test_delete_display_video360_advertiser_link_async_use_cached_wrapped_ @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest(), + {}, + ], +) async def test_delete_display_video360_advertiser_link_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -19231,7 +19328,7 @@ async def test_delete_display_video360_advertiser_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( @@ -19251,11 +19348,6 @@ async def test_delete_display_video360_advertiser_link_async( assert response is None -@pytest.mark.asyncio -async def test_delete_display_video360_advertiser_link_async_from_dict(): - await test_delete_display_video360_advertiser_link_async(request_type=dict) - - def test_delete_display_video360_advertiser_link_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -19406,8 +19498,8 @@ async def test_delete_display_video360_advertiser_link_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest, - dict, + analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest(), + {}, ], ) def test_update_display_video360_advertiser_link(request_type, transport: str = "grpc"): @@ -19418,7 +19510,7 @@ def test_update_display_video360_advertiser_link(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( @@ -19468,7 +19560,8 @@ def test_update_display_video360_advertiser_link_non_empty_request_with_auto_pop client.update_display_video360_advertiser_link(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest() + request_msg = analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest() + assert args[0] == request_msg def test_update_display_video360_advertiser_link_use_cached_wrapped_rpc(): @@ -19554,9 +19647,15 @@ async def test_update_display_video360_advertiser_link_async_use_cached_wrapped_ @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest(), + {}, + ], +) async def test_update_display_video360_advertiser_link_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -19565,7 +19664,7 @@ async def test_update_display_video360_advertiser_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( @@ -19594,11 +19693,6 @@ async def test_update_display_video360_advertiser_link_async( assert response.advertiser_display_name == "advertiser_display_name_value" -@pytest.mark.asyncio -async def test_update_display_video360_advertiser_link_async_from_dict(): - await test_update_display_video360_advertiser_link_async(request_type=dict) - - def test_update_display_video360_advertiser_link_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -19771,8 +19865,8 @@ async def test_update_display_video360_advertiser_link_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest, - dict, + analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest(), + {}, ], ) def test_get_display_video360_advertiser_link_proposal( @@ -19785,7 +19879,7 @@ def test_get_display_video360_advertiser_link_proposal( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -19839,11 +19933,10 @@ def test_get_display_video360_advertiser_link_proposal_non_empty_request_with_au client.get_display_video360_advertiser_link_proposal(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest( + request_msg = analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest( name="name_value", ) + assert args[0] == request_msg def test_get_display_video360_advertiser_link_proposal_use_cached_wrapped_rpc(): @@ -19929,9 +20022,15 @@ async def test_get_display_video360_advertiser_link_proposal_async_use_cached_wr @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest(), + {}, + ], +) async def test_get_display_video360_advertiser_link_proposal_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -19940,7 +20039,7 @@ async def test_get_display_video360_advertiser_link_proposal_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( @@ -19971,11 +20070,6 @@ async def test_get_display_video360_advertiser_link_proposal_async( assert response.validation_email == "validation_email_value" -@pytest.mark.asyncio -async def test_get_display_video360_advertiser_link_proposal_async_from_dict(): - await test_get_display_video360_advertiser_link_proposal_async(request_type=dict) - - def test_get_display_video360_advertiser_link_proposal_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -20130,8 +20224,8 @@ async def test_get_display_video360_advertiser_link_proposal_flattened_error_asy @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest, - dict, + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest(), + {}, ], ) def test_list_display_video360_advertiser_link_proposals( @@ -20144,7 +20238,7 @@ def test_list_display_video360_advertiser_link_proposals( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -20197,12 +20291,11 @@ def test_list_display_video360_advertiser_link_proposals_non_empty_request_with_ client.list_display_video360_advertiser_link_proposals(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest( + request_msg = analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_display_video360_advertiser_link_proposals_use_cached_wrapped_rpc(): @@ -20288,9 +20381,15 @@ async def test_list_display_video360_advertiser_link_proposals_async_use_cached_ @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest(), + {}, + ], +) async def test_list_display_video360_advertiser_link_proposals_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -20299,7 +20398,7 @@ async def test_list_display_video360_advertiser_link_proposals_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( @@ -20327,11 +20426,6 @@ async def test_list_display_video360_advertiser_link_proposals_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_display_video360_advertiser_link_proposals_async_from_dict(): - await test_list_display_video360_advertiser_link_proposals_async(request_type=dict) - - def test_list_display_video360_advertiser_link_proposals_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -20712,8 +20806,8 @@ async def test_list_display_video360_advertiser_link_proposals_async_pages(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest, - dict, + analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest(), + {}, ], ) def test_create_display_video360_advertiser_link_proposal( @@ -20726,7 +20820,7 @@ def test_create_display_video360_advertiser_link_proposal( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -20782,11 +20876,12 @@ def test_create_display_video360_advertiser_link_proposal_non_empty_request_with client.create_display_video360_advertiser_link_proposal(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest( - parent="parent_value", + request_msg = ( + analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest( + parent="parent_value", + ) ) + assert args[0] == request_msg def test_create_display_video360_advertiser_link_proposal_use_cached_wrapped_rpc(): @@ -20872,9 +20967,15 @@ async def test_create_display_video360_advertiser_link_proposal_async_use_cached @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest(), + {}, + ], +) async def test_create_display_video360_advertiser_link_proposal_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -20883,7 +20984,7 @@ async def test_create_display_video360_advertiser_link_proposal_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( @@ -20917,11 +21018,6 @@ async def test_create_display_video360_advertiser_link_proposal_async( assert response.validation_email == "validation_email_value" -@pytest.mark.asyncio -async def test_create_display_video360_advertiser_link_proposal_async_from_dict(): - await test_create_display_video360_advertiser_link_proposal_async(request_type=dict) - - def test_create_display_video360_advertiser_link_proposal_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -21098,8 +21194,8 @@ async def test_create_display_video360_advertiser_link_proposal_flattened_error_ @pytest.mark.parametrize( "request_type", [ - analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest, - dict, + analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest(), + {}, ], ) def test_delete_display_video360_advertiser_link_proposal( @@ -21112,7 +21208,7 @@ def test_delete_display_video360_advertiser_link_proposal( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -21159,11 +21255,12 @@ def test_delete_display_video360_advertiser_link_proposal_non_empty_request_with client.delete_display_video360_advertiser_link_proposal(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest( - name="name_value", + request_msg = ( + analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest( + name="name_value", + ) ) + assert args[0] == request_msg def test_delete_display_video360_advertiser_link_proposal_use_cached_wrapped_rpc(): @@ -21249,9 +21346,15 @@ async def test_delete_display_video360_advertiser_link_proposal_async_use_cached @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest(), + {}, + ], +) async def test_delete_display_video360_advertiser_link_proposal_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -21260,7 +21363,7 @@ async def test_delete_display_video360_advertiser_link_proposal_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( @@ -21283,11 +21386,6 @@ async def test_delete_display_video360_advertiser_link_proposal_async( assert response is None -@pytest.mark.asyncio -async def test_delete_display_video360_advertiser_link_proposal_async_from_dict(): - await test_delete_display_video360_advertiser_link_proposal_async(request_type=dict) - - def test_delete_display_video360_advertiser_link_proposal_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -21442,8 +21540,8 @@ async def test_delete_display_video360_advertiser_link_proposal_flattened_error_ @pytest.mark.parametrize( "request_type", [ - analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalRequest, - dict, + analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalRequest(), + {}, ], ) def test_approve_display_video360_advertiser_link_proposal( @@ -21456,7 +21554,7 @@ def test_approve_display_video360_advertiser_link_proposal( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -21507,11 +21605,12 @@ def test_approve_display_video360_advertiser_link_proposal_non_empty_request_wit client.approve_display_video360_advertiser_link_proposal(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalRequest( - name="name_value", + request_msg = ( + analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalRequest( + name="name_value", + ) ) + assert args[0] == request_msg def test_approve_display_video360_advertiser_link_proposal_use_cached_wrapped_rpc(): @@ -21597,9 +21696,15 @@ async def test_approve_display_video360_advertiser_link_proposal_async_use_cache @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalRequest(), + {}, + ], +) async def test_approve_display_video360_advertiser_link_proposal_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -21608,7 +21713,7 @@ async def test_approve_display_video360_advertiser_link_proposal_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( @@ -21635,13 +21740,6 @@ async def test_approve_display_video360_advertiser_link_proposal_async( ) -@pytest.mark.asyncio -async def test_approve_display_video360_advertiser_link_proposal_async_from_dict(): - await test_approve_display_video360_advertiser_link_proposal_async( - request_type=dict - ) - - def test_approve_display_video360_advertiser_link_proposal_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -21714,8 +21812,8 @@ async def test_approve_display_video360_advertiser_link_proposal_field_headers_a @pytest.mark.parametrize( "request_type", [ - analytics_admin.CancelDisplayVideo360AdvertiserLinkProposalRequest, - dict, + analytics_admin.CancelDisplayVideo360AdvertiserLinkProposalRequest(), + {}, ], ) def test_cancel_display_video360_advertiser_link_proposal( @@ -21728,7 +21826,7 @@ def test_cancel_display_video360_advertiser_link_proposal( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -21784,11 +21882,12 @@ def test_cancel_display_video360_advertiser_link_proposal_non_empty_request_with client.cancel_display_video360_advertiser_link_proposal(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == analytics_admin.CancelDisplayVideo360AdvertiserLinkProposalRequest( - name="name_value", + request_msg = ( + analytics_admin.CancelDisplayVideo360AdvertiserLinkProposalRequest( + name="name_value", + ) ) + assert args[0] == request_msg def test_cancel_display_video360_advertiser_link_proposal_use_cached_wrapped_rpc(): @@ -21874,9 +21973,15 @@ async def test_cancel_display_video360_advertiser_link_proposal_async_use_cached @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.CancelDisplayVideo360AdvertiserLinkProposalRequest(), + {}, + ], +) async def test_cancel_display_video360_advertiser_link_proposal_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.CancelDisplayVideo360AdvertiserLinkProposalRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -21885,7 +21990,7 @@ async def test_cancel_display_video360_advertiser_link_proposal_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( @@ -21919,11 +22024,6 @@ async def test_cancel_display_video360_advertiser_link_proposal_async( assert response.validation_email == "validation_email_value" -@pytest.mark.asyncio -async def test_cancel_display_video360_advertiser_link_proposal_async_from_dict(): - await test_cancel_display_video360_advertiser_link_proposal_async(request_type=dict) - - def test_cancel_display_video360_advertiser_link_proposal_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -21994,8 +22094,8 @@ async def test_cancel_display_video360_advertiser_link_proposal_field_headers_as @pytest.mark.parametrize( "request_type", [ - analytics_admin.CreateCustomDimensionRequest, - dict, + analytics_admin.CreateCustomDimensionRequest(), + {}, ], ) def test_create_custom_dimension(request_type, transport: str = "grpc"): @@ -22006,7 +22106,7 @@ def test_create_custom_dimension(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -22064,9 +22164,10 @@ def test_create_custom_dimension_non_empty_request_with_auto_populated_field(): client.create_custom_dimension(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateCustomDimensionRequest( + request_msg = analytics_admin.CreateCustomDimensionRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_custom_dimension_use_cached_wrapped_rpc(): @@ -22152,9 +22253,15 @@ async def test_create_custom_dimension_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.CreateCustomDimensionRequest(), + {}, + ], +) async def test_create_custom_dimension_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.CreateCustomDimensionRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -22163,7 +22270,7 @@ async def test_create_custom_dimension_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( @@ -22198,11 +22305,6 @@ async def test_create_custom_dimension_async( assert response.disallow_ads_personalization is True -@pytest.mark.asyncio -async def test_create_custom_dimension_async_from_dict(): - await test_create_custom_dimension_async(request_type=dict) - - def test_create_custom_dimension_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -22367,8 +22469,8 @@ async def test_create_custom_dimension_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdateCustomDimensionRequest, - dict, + analytics_admin.UpdateCustomDimensionRequest(), + {}, ], ) def test_update_custom_dimension(request_type, transport: str = "grpc"): @@ -22379,7 +22481,7 @@ def test_update_custom_dimension(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -22435,7 +22537,8 @@ def test_update_custom_dimension_non_empty_request_with_auto_populated_field(): client.update_custom_dimension(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateCustomDimensionRequest() + request_msg = analytics_admin.UpdateCustomDimensionRequest() + assert args[0] == request_msg def test_update_custom_dimension_use_cached_wrapped_rpc(): @@ -22521,9 +22624,15 @@ async def test_update_custom_dimension_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.UpdateCustomDimensionRequest(), + {}, + ], +) async def test_update_custom_dimension_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.UpdateCustomDimensionRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -22532,7 +22641,7 @@ async def test_update_custom_dimension_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( @@ -22567,11 +22676,6 @@ async def test_update_custom_dimension_async( assert response.disallow_ads_personalization is True -@pytest.mark.asyncio -async def test_update_custom_dimension_async_from_dict(): - await test_update_custom_dimension_async(request_type=dict) - - def test_update_custom_dimension_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -22736,8 +22840,8 @@ async def test_update_custom_dimension_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListCustomDimensionsRequest, - dict, + analytics_admin.ListCustomDimensionsRequest(), + {}, ], ) def test_list_custom_dimensions(request_type, transport: str = "grpc"): @@ -22748,7 +22852,7 @@ def test_list_custom_dimensions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -22797,10 +22901,11 @@ def test_list_custom_dimensions_non_empty_request_with_auto_populated_field(): client.list_custom_dimensions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListCustomDimensionsRequest( + request_msg = analytics_admin.ListCustomDimensionsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_custom_dimensions_use_cached_wrapped_rpc(): @@ -22886,9 +22991,15 @@ async def test_list_custom_dimensions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.ListCustomDimensionsRequest(), + {}, + ], +) async def test_list_custom_dimensions_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.ListCustomDimensionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -22897,7 +23008,7 @@ async def test_list_custom_dimensions_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( @@ -22922,11 +23033,6 @@ async def test_list_custom_dimensions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_custom_dimensions_async_from_dict(): - await test_list_custom_dimensions_async(request_type=dict) - - def test_list_custom_dimensions_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -23279,8 +23385,8 @@ async def test_list_custom_dimensions_async_pages(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.ArchiveCustomDimensionRequest, - dict, + analytics_admin.ArchiveCustomDimensionRequest(), + {}, ], ) def test_archive_custom_dimension(request_type, transport: str = "grpc"): @@ -23291,7 +23397,7 @@ def test_archive_custom_dimension(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -23336,9 +23442,10 @@ def test_archive_custom_dimension_non_empty_request_with_auto_populated_field(): client.archive_custom_dimension(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ArchiveCustomDimensionRequest( + request_msg = analytics_admin.ArchiveCustomDimensionRequest( name="name_value", ) + assert args[0] == request_msg def test_archive_custom_dimension_use_cached_wrapped_rpc(): @@ -23424,9 +23531,15 @@ async def test_archive_custom_dimension_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.ArchiveCustomDimensionRequest(), + {}, + ], +) async def test_archive_custom_dimension_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.ArchiveCustomDimensionRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -23435,7 +23548,7 @@ async def test_archive_custom_dimension_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( @@ -23455,11 +23568,6 @@ async def test_archive_custom_dimension_async( assert response is None -@pytest.mark.asyncio -async def test_archive_custom_dimension_async_from_dict(): - await test_archive_custom_dimension_async(request_type=dict) - - def test_archive_custom_dimension_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -23610,8 +23718,8 @@ async def test_archive_custom_dimension_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetCustomDimensionRequest, - dict, + analytics_admin.GetCustomDimensionRequest(), + {}, ], ) def test_get_custom_dimension(request_type, transport: str = "grpc"): @@ -23622,7 +23730,7 @@ def test_get_custom_dimension(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -23680,9 +23788,10 @@ def test_get_custom_dimension_non_empty_request_with_auto_populated_field(): client.get_custom_dimension(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetCustomDimensionRequest( + request_msg = analytics_admin.GetCustomDimensionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_custom_dimension_use_cached_wrapped_rpc(): @@ -23767,9 +23876,15 @@ async def test_get_custom_dimension_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.GetCustomDimensionRequest(), + {}, + ], +) async def test_get_custom_dimension_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.GetCustomDimensionRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -23778,7 +23893,7 @@ async def test_get_custom_dimension_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( @@ -23813,11 +23928,6 @@ async def test_get_custom_dimension_async( assert response.disallow_ads_personalization is True -@pytest.mark.asyncio -async def test_get_custom_dimension_async_from_dict(): - await test_get_custom_dimension_async(request_type=dict) - - def test_get_custom_dimension_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -23972,8 +24082,8 @@ async def test_get_custom_dimension_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.CreateCustomMetricRequest, - dict, + analytics_admin.CreateCustomMetricRequest(), + {}, ], ) def test_create_custom_metric(request_type, transport: str = "grpc"): @@ -23984,7 +24094,7 @@ def test_create_custom_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( @@ -24048,9 +24158,10 @@ def test_create_custom_metric_non_empty_request_with_auto_populated_field(): client.create_custom_metric(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateCustomMetricRequest( + request_msg = analytics_admin.CreateCustomMetricRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_custom_metric_use_cached_wrapped_rpc(): @@ -24135,9 +24246,15 @@ async def test_create_custom_metric_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.CreateCustomMetricRequest(), + {}, + ], +) async def test_create_custom_metric_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.CreateCustomMetricRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -24146,7 +24263,7 @@ async def test_create_custom_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( @@ -24187,11 +24304,6 @@ async def test_create_custom_metric_async( ] -@pytest.mark.asyncio -async def test_create_custom_metric_async_from_dict(): - await test_create_custom_metric_async(request_type=dict) - - def test_create_custom_metric_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -24356,8 +24468,8 @@ async def test_create_custom_metric_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdateCustomMetricRequest, - dict, + analytics_admin.UpdateCustomMetricRequest(), + {}, ], ) def test_update_custom_metric(request_type, transport: str = "grpc"): @@ -24368,7 +24480,7 @@ def test_update_custom_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( @@ -24430,7 +24542,8 @@ def test_update_custom_metric_non_empty_request_with_auto_populated_field(): client.update_custom_metric(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateCustomMetricRequest() + request_msg = analytics_admin.UpdateCustomMetricRequest() + assert args[0] == request_msg def test_update_custom_metric_use_cached_wrapped_rpc(): @@ -24515,9 +24628,15 @@ async def test_update_custom_metric_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.UpdateCustomMetricRequest(), + {}, + ], +) async def test_update_custom_metric_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.UpdateCustomMetricRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -24526,7 +24645,7 @@ async def test_update_custom_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( @@ -24567,11 +24686,6 @@ async def test_update_custom_metric_async( ] -@pytest.mark.asyncio -async def test_update_custom_metric_async_from_dict(): - await test_update_custom_metric_async(request_type=dict) - - def test_update_custom_metric_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -24736,8 +24850,8 @@ async def test_update_custom_metric_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListCustomMetricsRequest, - dict, + analytics_admin.ListCustomMetricsRequest(), + {}, ], ) def test_list_custom_metrics(request_type, transport: str = "grpc"): @@ -24748,7 +24862,7 @@ def test_list_custom_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( @@ -24797,10 +24911,11 @@ def test_list_custom_metrics_non_empty_request_with_auto_populated_field(): client.list_custom_metrics(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListCustomMetricsRequest( + request_msg = analytics_admin.ListCustomMetricsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_custom_metrics_use_cached_wrapped_rpc(): @@ -24885,10 +25000,14 @@ async def test_list_custom_metrics_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_custom_metrics_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.ListCustomMetricsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.ListCustomMetricsRequest(), + {}, + ], +) +async def test_list_custom_metrics_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -24896,7 +25015,7 @@ async def test_list_custom_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( @@ -24921,11 +25040,6 @@ async def test_list_custom_metrics_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_custom_metrics_async_from_dict(): - await test_list_custom_metrics_async(request_type=dict) - - def test_list_custom_metrics_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -25278,8 +25392,8 @@ async def test_list_custom_metrics_async_pages(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.ArchiveCustomMetricRequest, - dict, + analytics_admin.ArchiveCustomMetricRequest(), + {}, ], ) def test_archive_custom_metric(request_type, transport: str = "grpc"): @@ -25290,7 +25404,7 @@ def test_archive_custom_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( @@ -25335,9 +25449,10 @@ def test_archive_custom_metric_non_empty_request_with_auto_populated_field(): client.archive_custom_metric(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ArchiveCustomMetricRequest( + request_msg = analytics_admin.ArchiveCustomMetricRequest( name="name_value", ) + assert args[0] == request_msg def test_archive_custom_metric_use_cached_wrapped_rpc(): @@ -25423,9 +25538,15 @@ async def test_archive_custom_metric_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.ArchiveCustomMetricRequest(), + {}, + ], +) async def test_archive_custom_metric_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.ArchiveCustomMetricRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -25434,7 +25555,7 @@ async def test_archive_custom_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( @@ -25454,11 +25575,6 @@ async def test_archive_custom_metric_async( assert response is None -@pytest.mark.asyncio -async def test_archive_custom_metric_async_from_dict(): - await test_archive_custom_metric_async(request_type=dict) - - def test_archive_custom_metric_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -25609,8 +25725,8 @@ async def test_archive_custom_metric_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetCustomMetricRequest, - dict, + analytics_admin.GetCustomMetricRequest(), + {}, ], ) def test_get_custom_metric(request_type, transport: str = "grpc"): @@ -25621,7 +25737,7 @@ def test_get_custom_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( @@ -25685,9 +25801,10 @@ def test_get_custom_metric_non_empty_request_with_auto_populated_field(): client.get_custom_metric(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetCustomMetricRequest( + request_msg = analytics_admin.GetCustomMetricRequest( name="name_value", ) + assert args[0] == request_msg def test_get_custom_metric_use_cached_wrapped_rpc(): @@ -25770,9 +25887,14 @@ async def test_get_custom_metric_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_custom_metric_async( - transport: str = "grpc_asyncio", request_type=analytics_admin.GetCustomMetricRequest -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.GetCustomMetricRequest(), + {}, + ], +) +async def test_get_custom_metric_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -25780,7 +25902,7 @@ async def test_get_custom_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( @@ -25821,11 +25943,6 @@ async def test_get_custom_metric_async( ] -@pytest.mark.asyncio -async def test_get_custom_metric_async_from_dict(): - await test_get_custom_metric_async(request_type=dict) - - def test_get_custom_metric_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -25980,8 +26097,8 @@ async def test_get_custom_metric_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetDataRetentionSettingsRequest, - dict, + analytics_admin.GetDataRetentionSettingsRequest(), + {}, ], ) def test_get_data_retention_settings(request_type, transport: str = "grpc"): @@ -25992,7 +26109,7 @@ def test_get_data_retention_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( @@ -26052,9 +26169,10 @@ def test_get_data_retention_settings_non_empty_request_with_auto_populated_field client.get_data_retention_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetDataRetentionSettingsRequest( + request_msg = analytics_admin.GetDataRetentionSettingsRequest( name="name_value", ) + assert args[0] == request_msg def test_get_data_retention_settings_use_cached_wrapped_rpc(): @@ -26140,9 +26258,15 @@ async def test_get_data_retention_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.GetDataRetentionSettingsRequest(), + {}, + ], +) async def test_get_data_retention_settings_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.GetDataRetentionSettingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -26151,7 +26275,7 @@ async def test_get_data_retention_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( @@ -26188,11 +26312,6 @@ async def test_get_data_retention_settings_async( assert response.reset_user_data_on_new_activity is True -@pytest.mark.asyncio -async def test_get_data_retention_settings_async_from_dict(): - await test_get_data_retention_settings_async(request_type=dict) - - def test_get_data_retention_settings_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -26347,8 +26466,8 @@ async def test_get_data_retention_settings_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdateDataRetentionSettingsRequest, - dict, + analytics_admin.UpdateDataRetentionSettingsRequest(), + {}, ], ) def test_update_data_retention_settings(request_type, transport: str = "grpc"): @@ -26359,7 +26478,7 @@ def test_update_data_retention_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( @@ -26417,7 +26536,8 @@ def test_update_data_retention_settings_non_empty_request_with_auto_populated_fi client.update_data_retention_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateDataRetentionSettingsRequest() + request_msg = analytics_admin.UpdateDataRetentionSettingsRequest() + assert args[0] == request_msg def test_update_data_retention_settings_use_cached_wrapped_rpc(): @@ -26503,9 +26623,15 @@ async def test_update_data_retention_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.UpdateDataRetentionSettingsRequest(), + {}, + ], +) async def test_update_data_retention_settings_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.UpdateDataRetentionSettingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -26514,7 +26640,7 @@ async def test_update_data_retention_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( @@ -26551,11 +26677,6 @@ async def test_update_data_retention_settings_async( assert response.reset_user_data_on_new_activity is True -@pytest.mark.asyncio -async def test_update_data_retention_settings_async_from_dict(): - await test_update_data_retention_settings_async(request_type=dict) - - def test_update_data_retention_settings_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -26720,8 +26841,8 @@ async def test_update_data_retention_settings_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.CreateDataStreamRequest, - dict, + analytics_admin.CreateDataStreamRequest(), + {}, ], ) def test_create_data_stream(request_type, transport: str = "grpc"): @@ -26732,7 +26853,7 @@ def test_create_data_stream(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -26784,9 +26905,10 @@ def test_create_data_stream_non_empty_request_with_auto_populated_field(): client.create_data_stream(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateDataStreamRequest( + request_msg = analytics_admin.CreateDataStreamRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_data_stream_use_cached_wrapped_rpc(): @@ -26871,10 +26993,14 @@ async def test_create_data_stream_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_data_stream_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.CreateDataStreamRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.CreateDataStreamRequest(), + {}, + ], +) +async def test_create_data_stream_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -26882,7 +27008,7 @@ async def test_create_data_stream_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( @@ -26911,11 +27037,6 @@ async def test_create_data_stream_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_create_data_stream_async_from_dict(): - await test_create_data_stream_async(request_type=dict) - - def test_create_data_stream_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -27104,8 +27225,8 @@ async def test_create_data_stream_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.DeleteDataStreamRequest, - dict, + analytics_admin.DeleteDataStreamRequest(), + {}, ], ) def test_delete_data_stream(request_type, transport: str = "grpc"): @@ -27116,7 +27237,7 @@ def test_delete_data_stream(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -27161,9 +27282,10 @@ def test_delete_data_stream_non_empty_request_with_auto_populated_field(): client.delete_data_stream(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.DeleteDataStreamRequest( + request_msg = analytics_admin.DeleteDataStreamRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_data_stream_use_cached_wrapped_rpc(): @@ -27248,10 +27370,14 @@ async def test_delete_data_stream_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_data_stream_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.DeleteDataStreamRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.DeleteDataStreamRequest(), + {}, + ], +) +async def test_delete_data_stream_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -27259,7 +27385,7 @@ async def test_delete_data_stream_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( @@ -27279,11 +27405,6 @@ async def test_delete_data_stream_async( assert response is None -@pytest.mark.asyncio -async def test_delete_data_stream_async_from_dict(): - await test_delete_data_stream_async(request_type=dict) - - def test_delete_data_stream_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -27434,8 +27555,8 @@ async def test_delete_data_stream_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdateDataStreamRequest, - dict, + analytics_admin.UpdateDataStreamRequest(), + {}, ], ) def test_update_data_stream(request_type, transport: str = "grpc"): @@ -27446,7 +27567,7 @@ def test_update_data_stream(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -27496,7 +27617,8 @@ def test_update_data_stream_non_empty_request_with_auto_populated_field(): client.update_data_stream(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateDataStreamRequest() + request_msg = analytics_admin.UpdateDataStreamRequest() + assert args[0] == request_msg def test_update_data_stream_use_cached_wrapped_rpc(): @@ -27581,10 +27703,14 @@ async def test_update_data_stream_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_data_stream_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.UpdateDataStreamRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.UpdateDataStreamRequest(), + {}, + ], +) +async def test_update_data_stream_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -27592,7 +27718,7 @@ async def test_update_data_stream_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( @@ -27621,11 +27747,6 @@ async def test_update_data_stream_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_update_data_stream_async_from_dict(): - await test_update_data_stream_async(request_type=dict) - - def test_update_data_stream_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -27814,8 +27935,8 @@ async def test_update_data_stream_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListDataStreamsRequest, - dict, + analytics_admin.ListDataStreamsRequest(), + {}, ], ) def test_list_data_streams(request_type, transport: str = "grpc"): @@ -27826,7 +27947,7 @@ def test_list_data_streams(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -27875,10 +27996,11 @@ def test_list_data_streams_non_empty_request_with_auto_populated_field(): client.list_data_streams(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListDataStreamsRequest( + request_msg = analytics_admin.ListDataStreamsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_data_streams_use_cached_wrapped_rpc(): @@ -27961,9 +28083,14 @@ async def test_list_data_streams_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_data_streams_async( - transport: str = "grpc_asyncio", request_type=analytics_admin.ListDataStreamsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.ListDataStreamsRequest(), + {}, + ], +) +async def test_list_data_streams_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -27971,7 +28098,7 @@ async def test_list_data_streams_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( @@ -27996,11 +28123,6 @@ async def test_list_data_streams_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_data_streams_async_from_dict(): - await test_list_data_streams_async(request_type=dict) - - def test_list_data_streams_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -28353,8 +28475,8 @@ async def test_list_data_streams_async_pages(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetDataStreamRequest, - dict, + analytics_admin.GetDataStreamRequest(), + {}, ], ) def test_get_data_stream(request_type, transport: str = "grpc"): @@ -28365,7 +28487,7 @@ def test_get_data_stream(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_data_stream), "__call__") as call: @@ -28413,9 +28535,10 @@ def test_get_data_stream_non_empty_request_with_auto_populated_field(): client.get_data_stream(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetDataStreamRequest( + request_msg = analytics_admin.GetDataStreamRequest( name="name_value", ) + assert args[0] == request_msg def test_get_data_stream_use_cached_wrapped_rpc(): @@ -28496,9 +28619,14 @@ async def test_get_data_stream_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_data_stream_async( - transport: str = "grpc_asyncio", request_type=analytics_admin.GetDataStreamRequest -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.GetDataStreamRequest(), + {}, + ], +) +async def test_get_data_stream_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -28506,7 +28634,7 @@ async def test_get_data_stream_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_data_stream), "__call__") as call: @@ -28533,11 +28661,6 @@ async def test_get_data_stream_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_get_data_stream_async_from_dict(): - await test_get_data_stream_async(request_type=dict) - - def test_get_data_stream_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -28684,8 +28807,8 @@ async def test_get_data_stream_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetAudienceRequest, - dict, + analytics_admin.GetAudienceRequest(), + {}, ], ) def test_get_audience(request_type, transport: str = "grpc"): @@ -28696,7 +28819,7 @@ def test_get_audience(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_audience), "__call__") as call: @@ -28753,9 +28876,10 @@ def test_get_audience_non_empty_request_with_auto_populated_field(): client.get_audience(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetAudienceRequest( + request_msg = analytics_admin.GetAudienceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_audience_use_cached_wrapped_rpc(): @@ -28836,9 +28960,14 @@ async def test_get_audience_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_audience_async( - transport: str = "grpc_asyncio", request_type=analytics_admin.GetAudienceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.GetAudienceRequest(), + {}, + ], +) +async def test_get_audience_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -28846,7 +28975,7 @@ async def test_get_audience_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_audience), "__call__") as call: @@ -28882,11 +29011,6 @@ async def test_get_audience_async( ) -@pytest.mark.asyncio -async def test_get_audience_async_from_dict(): - await test_get_audience_async(request_type=dict) - - def test_get_audience_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -29029,8 +29153,8 @@ async def test_get_audience_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListAudiencesRequest, - dict, + analytics_admin.ListAudiencesRequest(), + {}, ], ) def test_list_audiences(request_type, transport: str = "grpc"): @@ -29041,7 +29165,7 @@ def test_list_audiences(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_audiences), "__call__") as call: @@ -29086,10 +29210,11 @@ def test_list_audiences_non_empty_request_with_auto_populated_field(): client.list_audiences(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListAudiencesRequest( + request_msg = analytics_admin.ListAudiencesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_audiences_use_cached_wrapped_rpc(): @@ -29170,9 +29295,14 @@ async def test_list_audiences_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_audiences_async( - transport: str = "grpc_asyncio", request_type=analytics_admin.ListAudiencesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.ListAudiencesRequest(), + {}, + ], +) +async def test_list_audiences_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -29180,7 +29310,7 @@ async def test_list_audiences_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_audiences), "__call__") as call: @@ -29203,11 +29333,6 @@ async def test_list_audiences_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_audiences_async_from_dict(): - await test_list_audiences_async(request_type=dict) - - def test_list_audiences_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -29544,8 +29669,8 @@ async def test_list_audiences_async_pages(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.CreateAudienceRequest, - dict, + analytics_admin.CreateAudienceRequest(), + {}, ], ) def test_create_audience(request_type, transport: str = "grpc"): @@ -29556,7 +29681,7 @@ def test_create_audience(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_audience), "__call__") as call: @@ -29613,9 +29738,10 @@ def test_create_audience_non_empty_request_with_auto_populated_field(): client.create_audience(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateAudienceRequest( + request_msg = analytics_admin.CreateAudienceRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_audience_use_cached_wrapped_rpc(): @@ -29696,9 +29822,14 @@ async def test_create_audience_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_audience_async( - transport: str = "grpc_asyncio", request_type=analytics_admin.CreateAudienceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.CreateAudienceRequest(), + {}, + ], +) +async def test_create_audience_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -29706,7 +29837,7 @@ async def test_create_audience_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_audience), "__call__") as call: @@ -29742,11 +29873,6 @@ async def test_create_audience_async( ) -@pytest.mark.asyncio -async def test_create_audience_async_from_dict(): - await test_create_audience_async(request_type=dict) - - def test_create_audience_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -29903,8 +30029,8 @@ async def test_create_audience_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdateAudienceRequest, - dict, + analytics_admin.UpdateAudienceRequest(), + {}, ], ) def test_update_audience(request_type, transport: str = "grpc"): @@ -29915,7 +30041,7 @@ def test_update_audience(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_audience), "__call__") as call: @@ -29970,7 +30096,8 @@ def test_update_audience_non_empty_request_with_auto_populated_field(): client.update_audience(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateAudienceRequest() + request_msg = analytics_admin.UpdateAudienceRequest() + assert args[0] == request_msg def test_update_audience_use_cached_wrapped_rpc(): @@ -30051,9 +30178,14 @@ async def test_update_audience_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_audience_async( - transport: str = "grpc_asyncio", request_type=analytics_admin.UpdateAudienceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.UpdateAudienceRequest(), + {}, + ], +) +async def test_update_audience_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -30061,7 +30193,7 @@ async def test_update_audience_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_audience), "__call__") as call: @@ -30097,11 +30229,6 @@ async def test_update_audience_async( ) -@pytest.mark.asyncio -async def test_update_audience_async_from_dict(): - await test_update_audience_async(request_type=dict) - - def test_update_audience_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -30258,8 +30385,8 @@ async def test_update_audience_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.ArchiveAudienceRequest, - dict, + analytics_admin.ArchiveAudienceRequest(), + {}, ], ) def test_archive_audience(request_type, transport: str = "grpc"): @@ -30270,7 +30397,7 @@ def test_archive_audience(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.archive_audience), "__call__") as call: @@ -30311,9 +30438,10 @@ def test_archive_audience_non_empty_request_with_auto_populated_field(): client.archive_audience(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ArchiveAudienceRequest( + request_msg = analytics_admin.ArchiveAudienceRequest( name="name_value", ) + assert args[0] == request_msg def test_archive_audience_use_cached_wrapped_rpc(): @@ -30396,9 +30524,14 @@ async def test_archive_audience_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_archive_audience_async( - transport: str = "grpc_asyncio", request_type=analytics_admin.ArchiveAudienceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.ArchiveAudienceRequest(), + {}, + ], +) +async def test_archive_audience_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -30406,7 +30539,7 @@ async def test_archive_audience_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.archive_audience), "__call__") as call: @@ -30424,11 +30557,6 @@ async def test_archive_audience_async( assert response is None -@pytest.mark.asyncio -async def test_archive_audience_async_from_dict(): - await test_archive_audience_async(request_type=dict) - - def test_archive_audience_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -30491,8 +30619,8 @@ async def test_archive_audience_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetSearchAds360LinkRequest, - dict, + analytics_admin.GetSearchAds360LinkRequest(), + {}, ], ) def test_get_search_ads360_link(request_type, transport: str = "grpc"): @@ -30503,7 +30631,7 @@ def test_get_search_ads360_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( @@ -30555,9 +30683,10 @@ def test_get_search_ads360_link_non_empty_request_with_auto_populated_field(): client.get_search_ads360_link(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetSearchAds360LinkRequest( + request_msg = analytics_admin.GetSearchAds360LinkRequest( name="name_value", ) + assert args[0] == request_msg def test_get_search_ads360_link_use_cached_wrapped_rpc(): @@ -30643,9 +30772,15 @@ async def test_get_search_ads360_link_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.GetSearchAds360LinkRequest(), + {}, + ], +) async def test_get_search_ads360_link_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.GetSearchAds360LinkRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -30654,7 +30789,7 @@ async def test_get_search_ads360_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( @@ -30683,11 +30818,6 @@ async def test_get_search_ads360_link_async( assert response.advertiser_display_name == "advertiser_display_name_value" -@pytest.mark.asyncio -async def test_get_search_ads360_link_async_from_dict(): - await test_get_search_ads360_link_async(request_type=dict) - - def test_get_search_ads360_link_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -30842,8 +30972,8 @@ async def test_get_search_ads360_link_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListSearchAds360LinksRequest, - dict, + analytics_admin.ListSearchAds360LinksRequest(), + {}, ], ) def test_list_search_ads360_links(request_type, transport: str = "grpc"): @@ -30854,7 +30984,7 @@ def test_list_search_ads360_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( @@ -30903,10 +31033,11 @@ def test_list_search_ads360_links_non_empty_request_with_auto_populated_field(): client.list_search_ads360_links(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListSearchAds360LinksRequest( + request_msg = analytics_admin.ListSearchAds360LinksRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_search_ads360_links_use_cached_wrapped_rpc(): @@ -30992,9 +31123,15 @@ async def test_list_search_ads360_links_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.ListSearchAds360LinksRequest(), + {}, + ], +) async def test_list_search_ads360_links_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.ListSearchAds360LinksRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -31003,7 +31140,7 @@ async def test_list_search_ads360_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( @@ -31028,11 +31165,6 @@ async def test_list_search_ads360_links_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_search_ads360_links_async_from_dict(): - await test_list_search_ads360_links_async(request_type=dict) - - def test_list_search_ads360_links_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -31387,8 +31519,8 @@ async def test_list_search_ads360_links_async_pages(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.CreateSearchAds360LinkRequest, - dict, + analytics_admin.CreateSearchAds360LinkRequest(), + {}, ], ) def test_create_search_ads360_link(request_type, transport: str = "grpc"): @@ -31399,7 +31531,7 @@ def test_create_search_ads360_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( @@ -31451,9 +31583,10 @@ def test_create_search_ads360_link_non_empty_request_with_auto_populated_field() client.create_search_ads360_link(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateSearchAds360LinkRequest( + request_msg = analytics_admin.CreateSearchAds360LinkRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_search_ads360_link_use_cached_wrapped_rpc(): @@ -31539,9 +31672,15 @@ async def test_create_search_ads360_link_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.CreateSearchAds360LinkRequest(), + {}, + ], +) async def test_create_search_ads360_link_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.CreateSearchAds360LinkRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -31550,7 +31689,7 @@ async def test_create_search_ads360_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( @@ -31579,11 +31718,6 @@ async def test_create_search_ads360_link_async( assert response.advertiser_display_name == "advertiser_display_name_value" -@pytest.mark.asyncio -async def test_create_search_ads360_link_async_from_dict(): - await test_create_search_ads360_link_async(request_type=dict) - - def test_create_search_ads360_link_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -31748,8 +31882,8 @@ async def test_create_search_ads360_link_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.DeleteSearchAds360LinkRequest, - dict, + analytics_admin.DeleteSearchAds360LinkRequest(), + {}, ], ) def test_delete_search_ads360_link(request_type, transport: str = "grpc"): @@ -31760,7 +31894,7 @@ def test_delete_search_ads360_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( @@ -31805,9 +31939,10 @@ def test_delete_search_ads360_link_non_empty_request_with_auto_populated_field() client.delete_search_ads360_link(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.DeleteSearchAds360LinkRequest( + request_msg = analytics_admin.DeleteSearchAds360LinkRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_search_ads360_link_use_cached_wrapped_rpc(): @@ -31893,9 +32028,15 @@ async def test_delete_search_ads360_link_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.DeleteSearchAds360LinkRequest(), + {}, + ], +) async def test_delete_search_ads360_link_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.DeleteSearchAds360LinkRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -31904,7 +32045,7 @@ async def test_delete_search_ads360_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( @@ -31924,11 +32065,6 @@ async def test_delete_search_ads360_link_async( assert response is None -@pytest.mark.asyncio -async def test_delete_search_ads360_link_async_from_dict(): - await test_delete_search_ads360_link_async(request_type=dict) - - def test_delete_search_ads360_link_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -32079,8 +32215,8 @@ async def test_delete_search_ads360_link_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdateSearchAds360LinkRequest, - dict, + analytics_admin.UpdateSearchAds360LinkRequest(), + {}, ], ) def test_update_search_ads360_link(request_type, transport: str = "grpc"): @@ -32091,7 +32227,7 @@ def test_update_search_ads360_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( @@ -32141,7 +32277,8 @@ def test_update_search_ads360_link_non_empty_request_with_auto_populated_field() client.update_search_ads360_link(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateSearchAds360LinkRequest() + request_msg = analytics_admin.UpdateSearchAds360LinkRequest() + assert args[0] == request_msg def test_update_search_ads360_link_use_cached_wrapped_rpc(): @@ -32227,9 +32364,15 @@ async def test_update_search_ads360_link_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.UpdateSearchAds360LinkRequest(), + {}, + ], +) async def test_update_search_ads360_link_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.UpdateSearchAds360LinkRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -32238,7 +32381,7 @@ async def test_update_search_ads360_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( @@ -32267,11 +32410,6 @@ async def test_update_search_ads360_link_async( assert response.advertiser_display_name == "advertiser_display_name_value" -@pytest.mark.asyncio -async def test_update_search_ads360_link_async_from_dict(): - await test_update_search_ads360_link_async(request_type=dict) - - def test_update_search_ads360_link_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -32436,8 +32574,8 @@ async def test_update_search_ads360_link_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetAttributionSettingsRequest, - dict, + analytics_admin.GetAttributionSettingsRequest(), + {}, ], ) def test_get_attribution_settings(request_type, transport: str = "grpc"): @@ -32448,7 +32586,7 @@ def test_get_attribution_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( @@ -32516,9 +32654,10 @@ def test_get_attribution_settings_non_empty_request_with_auto_populated_field(): client.get_attribution_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetAttributionSettingsRequest( + request_msg = analytics_admin.GetAttributionSettingsRequest( name="name_value", ) + assert args[0] == request_msg def test_get_attribution_settings_use_cached_wrapped_rpc(): @@ -32604,9 +32743,15 @@ async def test_get_attribution_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.GetAttributionSettingsRequest(), + {}, + ], +) async def test_get_attribution_settings_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.GetAttributionSettingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -32615,7 +32760,7 @@ async def test_get_attribution_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( @@ -32660,11 +32805,6 @@ async def test_get_attribution_settings_async( ) -@pytest.mark.asyncio -async def test_get_attribution_settings_async_from_dict(): - await test_get_attribution_settings_async(request_type=dict) - - def test_get_attribution_settings_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -32819,8 +32959,8 @@ async def test_get_attribution_settings_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdateAttributionSettingsRequest, - dict, + analytics_admin.UpdateAttributionSettingsRequest(), + {}, ], ) def test_update_attribution_settings(request_type, transport: str = "grpc"): @@ -32831,7 +32971,7 @@ def test_update_attribution_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( @@ -32897,7 +33037,8 @@ def test_update_attribution_settings_non_empty_request_with_auto_populated_field client.update_attribution_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateAttributionSettingsRequest() + request_msg = analytics_admin.UpdateAttributionSettingsRequest() + assert args[0] == request_msg def test_update_attribution_settings_use_cached_wrapped_rpc(): @@ -32983,9 +33124,15 @@ async def test_update_attribution_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.UpdateAttributionSettingsRequest(), + {}, + ], +) async def test_update_attribution_settings_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.UpdateAttributionSettingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -32994,7 +33141,7 @@ async def test_update_attribution_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( @@ -33039,11 +33186,6 @@ async def test_update_attribution_settings_async( ) -@pytest.mark.asyncio -async def test_update_attribution_settings_async_from_dict(): - await test_update_attribution_settings_async(request_type=dict) - - def test_update_attribution_settings_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -33208,8 +33350,8 @@ async def test_update_attribution_settings_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.RunAccessReportRequest, - dict, + analytics_admin.RunAccessReportRequest(), + {}, ], ) def test_run_access_report(request_type, transport: str = "grpc"): @@ -33220,7 +33362,7 @@ def test_run_access_report(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -33269,10 +33411,11 @@ def test_run_access_report_non_empty_request_with_auto_populated_field(): client.run_access_report(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.RunAccessReportRequest( + request_msg = analytics_admin.RunAccessReportRequest( entity="entity_value", time_zone="time_zone_value", ) + assert args[0] == request_msg def test_run_access_report_use_cached_wrapped_rpc(): @@ -33355,9 +33498,14 @@ async def test_run_access_report_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_run_access_report_async( - transport: str = "grpc_asyncio", request_type=analytics_admin.RunAccessReportRequest -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.RunAccessReportRequest(), + {}, + ], +) +async def test_run_access_report_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -33365,7 +33513,7 @@ async def test_run_access_report_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( @@ -33390,11 +33538,6 @@ async def test_run_access_report_async( assert response.row_count == 992 -@pytest.mark.asyncio -async def test_run_access_report_async_from_dict(): - await test_run_access_report_async(request_type=dict) - - def test_run_access_report_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -33463,8 +33606,8 @@ async def test_run_access_report_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.CreateAccessBindingRequest, - dict, + analytics_admin.CreateAccessBindingRequest(), + {}, ], ) def test_create_access_binding(request_type, transport: str = "grpc"): @@ -33475,7 +33618,7 @@ def test_create_access_binding(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -33526,9 +33669,10 @@ def test_create_access_binding_non_empty_request_with_auto_populated_field(): client.create_access_binding(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateAccessBindingRequest( + request_msg = analytics_admin.CreateAccessBindingRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_access_binding_use_cached_wrapped_rpc(): @@ -33614,9 +33758,15 @@ async def test_create_access_binding_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.CreateAccessBindingRequest(), + {}, + ], +) async def test_create_access_binding_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.CreateAccessBindingRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -33625,7 +33775,7 @@ async def test_create_access_binding_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( @@ -33652,11 +33802,6 @@ async def test_create_access_binding_async( assert response.roles == ["roles_value"] -@pytest.mark.asyncio -async def test_create_access_binding_async_from_dict(): - await test_create_access_binding_async(request_type=dict) - - def test_create_access_binding_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -33821,8 +33966,8 @@ async def test_create_access_binding_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetAccessBindingRequest, - dict, + analytics_admin.GetAccessBindingRequest(), + {}, ], ) def test_get_access_binding(request_type, transport: str = "grpc"): @@ -33833,7 +33978,7 @@ def test_get_access_binding(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -33884,9 +34029,10 @@ def test_get_access_binding_non_empty_request_with_auto_populated_field(): client.get_access_binding(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetAccessBindingRequest( + request_msg = analytics_admin.GetAccessBindingRequest( name="name_value", ) + assert args[0] == request_msg def test_get_access_binding_use_cached_wrapped_rpc(): @@ -33971,10 +34117,14 @@ async def test_get_access_binding_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_access_binding_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.GetAccessBindingRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.GetAccessBindingRequest(), + {}, + ], +) +async def test_get_access_binding_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -33982,7 +34132,7 @@ async def test_get_access_binding_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( @@ -34009,11 +34159,6 @@ async def test_get_access_binding_async( assert response.roles == ["roles_value"] -@pytest.mark.asyncio -async def test_get_access_binding_async_from_dict(): - await test_get_access_binding_async(request_type=dict) - - def test_get_access_binding_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -34168,8 +34313,8 @@ async def test_get_access_binding_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdateAccessBindingRequest, - dict, + analytics_admin.UpdateAccessBindingRequest(), + {}, ], ) def test_update_access_binding(request_type, transport: str = "grpc"): @@ -34180,7 +34325,7 @@ def test_update_access_binding(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -34229,7 +34374,8 @@ def test_update_access_binding_non_empty_request_with_auto_populated_field(): client.update_access_binding(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateAccessBindingRequest() + request_msg = analytics_admin.UpdateAccessBindingRequest() + assert args[0] == request_msg def test_update_access_binding_use_cached_wrapped_rpc(): @@ -34315,9 +34461,15 @@ async def test_update_access_binding_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.UpdateAccessBindingRequest(), + {}, + ], +) async def test_update_access_binding_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.UpdateAccessBindingRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -34326,7 +34478,7 @@ async def test_update_access_binding_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( @@ -34353,11 +34505,6 @@ async def test_update_access_binding_async( assert response.roles == ["roles_value"] -@pytest.mark.asyncio -async def test_update_access_binding_async_from_dict(): - await test_update_access_binding_async(request_type=dict) - - def test_update_access_binding_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -34512,8 +34659,8 @@ async def test_update_access_binding_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.DeleteAccessBindingRequest, - dict, + analytics_admin.DeleteAccessBindingRequest(), + {}, ], ) def test_delete_access_binding(request_type, transport: str = "grpc"): @@ -34524,7 +34671,7 @@ def test_delete_access_binding(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -34569,9 +34716,10 @@ def test_delete_access_binding_non_empty_request_with_auto_populated_field(): client.delete_access_binding(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.DeleteAccessBindingRequest( + request_msg = analytics_admin.DeleteAccessBindingRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_access_binding_use_cached_wrapped_rpc(): @@ -34657,9 +34805,15 @@ async def test_delete_access_binding_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.DeleteAccessBindingRequest(), + {}, + ], +) async def test_delete_access_binding_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.DeleteAccessBindingRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -34668,7 +34822,7 @@ async def test_delete_access_binding_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( @@ -34688,11 +34842,6 @@ async def test_delete_access_binding_async( assert response is None -@pytest.mark.asyncio -async def test_delete_access_binding_async_from_dict(): - await test_delete_access_binding_async(request_type=dict) - - def test_delete_access_binding_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -34843,8 +34992,8 @@ async def test_delete_access_binding_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListAccessBindingsRequest, - dict, + analytics_admin.ListAccessBindingsRequest(), + {}, ], ) def test_list_access_bindings(request_type, transport: str = "grpc"): @@ -34855,7 +35004,7 @@ def test_list_access_bindings(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -34904,10 +35053,11 @@ def test_list_access_bindings_non_empty_request_with_auto_populated_field(): client.list_access_bindings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListAccessBindingsRequest( + request_msg = analytics_admin.ListAccessBindingsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_access_bindings_use_cached_wrapped_rpc(): @@ -34992,9 +35142,15 @@ async def test_list_access_bindings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.ListAccessBindingsRequest(), + {}, + ], +) async def test_list_access_bindings_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.ListAccessBindingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -35003,7 +35159,7 @@ async def test_list_access_bindings_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( @@ -35028,11 +35184,6 @@ async def test_list_access_bindings_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_access_bindings_async_from_dict(): - await test_list_access_bindings_async(request_type=dict) - - def test_list_access_bindings_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -35385,8 +35536,8 @@ async def test_list_access_bindings_async_pages(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.BatchCreateAccessBindingsRequest, - dict, + analytics_admin.BatchCreateAccessBindingsRequest(), + {}, ], ) def test_batch_create_access_bindings(request_type, transport: str = "grpc"): @@ -35397,7 +35548,7 @@ def test_batch_create_access_bindings(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -35442,9 +35593,10 @@ def test_batch_create_access_bindings_non_empty_request_with_auto_populated_fiel client.batch_create_access_bindings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.BatchCreateAccessBindingsRequest( + request_msg = analytics_admin.BatchCreateAccessBindingsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_batch_create_access_bindings_use_cached_wrapped_rpc(): @@ -35530,9 +35682,15 @@ async def test_batch_create_access_bindings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.BatchCreateAccessBindingsRequest(), + {}, + ], +) async def test_batch_create_access_bindings_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.BatchCreateAccessBindingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -35541,7 +35699,7 @@ async def test_batch_create_access_bindings_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( @@ -35563,11 +35721,6 @@ async def test_batch_create_access_bindings_async( assert isinstance(response, analytics_admin.BatchCreateAccessBindingsResponse) -@pytest.mark.asyncio -async def test_batch_create_access_bindings_async_from_dict(): - await test_batch_create_access_bindings_async(request_type=dict) - - def test_batch_create_access_bindings_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -35636,8 +35789,8 @@ async def test_batch_create_access_bindings_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.BatchGetAccessBindingsRequest, - dict, + analytics_admin.BatchGetAccessBindingsRequest(), + {}, ], ) def test_batch_get_access_bindings(request_type, transport: str = "grpc"): @@ -35648,7 +35801,7 @@ def test_batch_get_access_bindings(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -35693,9 +35846,10 @@ def test_batch_get_access_bindings_non_empty_request_with_auto_populated_field() client.batch_get_access_bindings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.BatchGetAccessBindingsRequest( + request_msg = analytics_admin.BatchGetAccessBindingsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_batch_get_access_bindings_use_cached_wrapped_rpc(): @@ -35781,9 +35935,15 @@ async def test_batch_get_access_bindings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.BatchGetAccessBindingsRequest(), + {}, + ], +) async def test_batch_get_access_bindings_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.BatchGetAccessBindingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -35792,7 +35952,7 @@ async def test_batch_get_access_bindings_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( @@ -35814,11 +35974,6 @@ async def test_batch_get_access_bindings_async( assert isinstance(response, analytics_admin.BatchGetAccessBindingsResponse) -@pytest.mark.asyncio -async def test_batch_get_access_bindings_async_from_dict(): - await test_batch_get_access_bindings_async(request_type=dict) - - def test_batch_get_access_bindings_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -35887,8 +36042,8 @@ async def test_batch_get_access_bindings_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.BatchUpdateAccessBindingsRequest, - dict, + analytics_admin.BatchUpdateAccessBindingsRequest(), + {}, ], ) def test_batch_update_access_bindings(request_type, transport: str = "grpc"): @@ -35899,7 +36054,7 @@ def test_batch_update_access_bindings(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -35944,9 +36099,10 @@ def test_batch_update_access_bindings_non_empty_request_with_auto_populated_fiel client.batch_update_access_bindings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.BatchUpdateAccessBindingsRequest( + request_msg = analytics_admin.BatchUpdateAccessBindingsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_batch_update_access_bindings_use_cached_wrapped_rpc(): @@ -36032,9 +36188,15 @@ async def test_batch_update_access_bindings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.BatchUpdateAccessBindingsRequest(), + {}, + ], +) async def test_batch_update_access_bindings_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.BatchUpdateAccessBindingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -36043,7 +36205,7 @@ async def test_batch_update_access_bindings_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( @@ -36065,11 +36227,6 @@ async def test_batch_update_access_bindings_async( assert isinstance(response, analytics_admin.BatchUpdateAccessBindingsResponse) -@pytest.mark.asyncio -async def test_batch_update_access_bindings_async_from_dict(): - await test_batch_update_access_bindings_async(request_type=dict) - - def test_batch_update_access_bindings_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -36138,8 +36295,8 @@ async def test_batch_update_access_bindings_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.BatchDeleteAccessBindingsRequest, - dict, + analytics_admin.BatchDeleteAccessBindingsRequest(), + {}, ], ) def test_batch_delete_access_bindings(request_type, transport: str = "grpc"): @@ -36150,7 +36307,7 @@ def test_batch_delete_access_bindings(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -36195,9 +36352,10 @@ def test_batch_delete_access_bindings_non_empty_request_with_auto_populated_fiel client.batch_delete_access_bindings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.BatchDeleteAccessBindingsRequest( + request_msg = analytics_admin.BatchDeleteAccessBindingsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_batch_delete_access_bindings_use_cached_wrapped_rpc(): @@ -36283,9 +36441,15 @@ async def test_batch_delete_access_bindings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.BatchDeleteAccessBindingsRequest(), + {}, + ], +) async def test_batch_delete_access_bindings_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.BatchDeleteAccessBindingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -36294,7 +36458,7 @@ async def test_batch_delete_access_bindings_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( @@ -36314,11 +36478,6 @@ async def test_batch_delete_access_bindings_async( assert response is None -@pytest.mark.asyncio -async def test_batch_delete_access_bindings_async_from_dict(): - await test_batch_delete_access_bindings_async(request_type=dict) - - def test_batch_delete_access_bindings_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -36385,8 +36544,8 @@ async def test_batch_delete_access_bindings_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetExpandedDataSetRequest, - dict, + analytics_admin.GetExpandedDataSetRequest(), + {}, ], ) def test_get_expanded_data_set(request_type, transport: str = "grpc"): @@ -36397,7 +36556,7 @@ def test_get_expanded_data_set(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -36453,9 +36612,10 @@ def test_get_expanded_data_set_non_empty_request_with_auto_populated_field(): client.get_expanded_data_set(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetExpandedDataSetRequest( + request_msg = analytics_admin.GetExpandedDataSetRequest( name="name_value", ) + assert args[0] == request_msg def test_get_expanded_data_set_use_cached_wrapped_rpc(): @@ -36541,9 +36701,15 @@ async def test_get_expanded_data_set_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.GetExpandedDataSetRequest(), + {}, + ], +) async def test_get_expanded_data_set_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.GetExpandedDataSetRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -36552,7 +36718,7 @@ async def test_get_expanded_data_set_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( @@ -36585,11 +36751,6 @@ async def test_get_expanded_data_set_async( assert response.metric_names == ["metric_names_value"] -@pytest.mark.asyncio -async def test_get_expanded_data_set_async_from_dict(): - await test_get_expanded_data_set_async(request_type=dict) - - def test_get_expanded_data_set_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -36744,8 +36905,8 @@ async def test_get_expanded_data_set_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListExpandedDataSetsRequest, - dict, + analytics_admin.ListExpandedDataSetsRequest(), + {}, ], ) def test_list_expanded_data_sets(request_type, transport: str = "grpc"): @@ -36756,7 +36917,7 @@ def test_list_expanded_data_sets(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -36805,10 +36966,11 @@ def test_list_expanded_data_sets_non_empty_request_with_auto_populated_field(): client.list_expanded_data_sets(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListExpandedDataSetsRequest( + request_msg = analytics_admin.ListExpandedDataSetsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_expanded_data_sets_use_cached_wrapped_rpc(): @@ -36894,9 +37056,15 @@ async def test_list_expanded_data_sets_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.ListExpandedDataSetsRequest(), + {}, + ], +) async def test_list_expanded_data_sets_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.ListExpandedDataSetsRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -36905,7 +37073,7 @@ async def test_list_expanded_data_sets_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( @@ -36930,11 +37098,6 @@ async def test_list_expanded_data_sets_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_expanded_data_sets_async_from_dict(): - await test_list_expanded_data_sets_async(request_type=dict) - - def test_list_expanded_data_sets_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -37287,8 +37450,8 @@ async def test_list_expanded_data_sets_async_pages(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.CreateExpandedDataSetRequest, - dict, + analytics_admin.CreateExpandedDataSetRequest(), + {}, ], ) def test_create_expanded_data_set(request_type, transport: str = "grpc"): @@ -37299,7 +37462,7 @@ def test_create_expanded_data_set(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -37355,9 +37518,10 @@ def test_create_expanded_data_set_non_empty_request_with_auto_populated_field(): client.create_expanded_data_set(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateExpandedDataSetRequest( + request_msg = analytics_admin.CreateExpandedDataSetRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_expanded_data_set_use_cached_wrapped_rpc(): @@ -37443,9 +37607,15 @@ async def test_create_expanded_data_set_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.CreateExpandedDataSetRequest(), + {}, + ], +) async def test_create_expanded_data_set_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.CreateExpandedDataSetRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -37454,7 +37624,7 @@ async def test_create_expanded_data_set_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( @@ -37487,11 +37657,6 @@ async def test_create_expanded_data_set_async( assert response.metric_names == ["metric_names_value"] -@pytest.mark.asyncio -async def test_create_expanded_data_set_async_from_dict(): - await test_create_expanded_data_set_async(request_type=dict) - - def test_create_expanded_data_set_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -37656,8 +37821,8 @@ async def test_create_expanded_data_set_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdateExpandedDataSetRequest, - dict, + analytics_admin.UpdateExpandedDataSetRequest(), + {}, ], ) def test_update_expanded_data_set(request_type, transport: str = "grpc"): @@ -37668,7 +37833,7 @@ def test_update_expanded_data_set(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -37722,7 +37887,8 @@ def test_update_expanded_data_set_non_empty_request_with_auto_populated_field(): client.update_expanded_data_set(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateExpandedDataSetRequest() + request_msg = analytics_admin.UpdateExpandedDataSetRequest() + assert args[0] == request_msg def test_update_expanded_data_set_use_cached_wrapped_rpc(): @@ -37808,9 +37974,15 @@ async def test_update_expanded_data_set_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.UpdateExpandedDataSetRequest(), + {}, + ], +) async def test_update_expanded_data_set_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.UpdateExpandedDataSetRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -37819,7 +37991,7 @@ async def test_update_expanded_data_set_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( @@ -37852,11 +38024,6 @@ async def test_update_expanded_data_set_async( assert response.metric_names == ["metric_names_value"] -@pytest.mark.asyncio -async def test_update_expanded_data_set_async_from_dict(): - await test_update_expanded_data_set_async(request_type=dict) - - def test_update_expanded_data_set_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -38021,8 +38188,8 @@ async def test_update_expanded_data_set_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.DeleteExpandedDataSetRequest, - dict, + analytics_admin.DeleteExpandedDataSetRequest(), + {}, ], ) def test_delete_expanded_data_set(request_type, transport: str = "grpc"): @@ -38033,7 +38200,7 @@ def test_delete_expanded_data_set(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -38078,9 +38245,10 @@ def test_delete_expanded_data_set_non_empty_request_with_auto_populated_field(): client.delete_expanded_data_set(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.DeleteExpandedDataSetRequest( + request_msg = analytics_admin.DeleteExpandedDataSetRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_expanded_data_set_use_cached_wrapped_rpc(): @@ -38166,9 +38334,15 @@ async def test_delete_expanded_data_set_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.DeleteExpandedDataSetRequest(), + {}, + ], +) async def test_delete_expanded_data_set_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.DeleteExpandedDataSetRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -38177,7 +38351,7 @@ async def test_delete_expanded_data_set_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( @@ -38197,11 +38371,6 @@ async def test_delete_expanded_data_set_async( assert response is None -@pytest.mark.asyncio -async def test_delete_expanded_data_set_async_from_dict(): - await test_delete_expanded_data_set_async(request_type=dict) - - def test_delete_expanded_data_set_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -38352,8 +38521,8 @@ async def test_delete_expanded_data_set_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetChannelGroupRequest, - dict, + analytics_admin.GetChannelGroupRequest(), + {}, ], ) def test_get_channel_group(request_type, transport: str = "grpc"): @@ -38364,7 +38533,7 @@ def test_get_channel_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -38420,9 +38589,10 @@ def test_get_channel_group_non_empty_request_with_auto_populated_field(): client.get_channel_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetChannelGroupRequest( + request_msg = analytics_admin.GetChannelGroupRequest( name="name_value", ) + assert args[0] == request_msg def test_get_channel_group_use_cached_wrapped_rpc(): @@ -38505,9 +38675,14 @@ async def test_get_channel_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_channel_group_async( - transport: str = "grpc_asyncio", request_type=analytics_admin.GetChannelGroupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.GetChannelGroupRequest(), + {}, + ], +) +async def test_get_channel_group_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -38515,7 +38690,7 @@ async def test_get_channel_group_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( @@ -38548,11 +38723,6 @@ async def test_get_channel_group_async( assert response.primary is True -@pytest.mark.asyncio -async def test_get_channel_group_async_from_dict(): - await test_get_channel_group_async(request_type=dict) - - def test_get_channel_group_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -38707,8 +38877,8 @@ async def test_get_channel_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListChannelGroupsRequest, - dict, + analytics_admin.ListChannelGroupsRequest(), + {}, ], ) def test_list_channel_groups(request_type, transport: str = "grpc"): @@ -38719,7 +38889,7 @@ def test_list_channel_groups(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -38768,10 +38938,11 @@ def test_list_channel_groups_non_empty_request_with_auto_populated_field(): client.list_channel_groups(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListChannelGroupsRequest( + request_msg = analytics_admin.ListChannelGroupsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_channel_groups_use_cached_wrapped_rpc(): @@ -38856,10 +39027,14 @@ async def test_list_channel_groups_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_channel_groups_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.ListChannelGroupsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.ListChannelGroupsRequest(), + {}, + ], +) +async def test_list_channel_groups_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -38867,7 +39042,7 @@ async def test_list_channel_groups_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( @@ -38892,11 +39067,6 @@ async def test_list_channel_groups_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_channel_groups_async_from_dict(): - await test_list_channel_groups_async(request_type=dict) - - def test_list_channel_groups_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -39249,8 +39419,8 @@ async def test_list_channel_groups_async_pages(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.CreateChannelGroupRequest, - dict, + analytics_admin.CreateChannelGroupRequest(), + {}, ], ) def test_create_channel_group(request_type, transport: str = "grpc"): @@ -39261,7 +39431,7 @@ def test_create_channel_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -39317,9 +39487,10 @@ def test_create_channel_group_non_empty_request_with_auto_populated_field(): client.create_channel_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateChannelGroupRequest( + request_msg = analytics_admin.CreateChannelGroupRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_channel_group_use_cached_wrapped_rpc(): @@ -39404,9 +39575,15 @@ async def test_create_channel_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.CreateChannelGroupRequest(), + {}, + ], +) async def test_create_channel_group_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.CreateChannelGroupRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -39415,7 +39592,7 @@ async def test_create_channel_group_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( @@ -39448,11 +39625,6 @@ async def test_create_channel_group_async( assert response.primary is True -@pytest.mark.asyncio -async def test_create_channel_group_async_from_dict(): - await test_create_channel_group_async(request_type=dict) - - def test_create_channel_group_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -39617,8 +39789,8 @@ async def test_create_channel_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdateChannelGroupRequest, - dict, + analytics_admin.UpdateChannelGroupRequest(), + {}, ], ) def test_update_channel_group(request_type, transport: str = "grpc"): @@ -39629,7 +39801,7 @@ def test_update_channel_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -39683,7 +39855,8 @@ def test_update_channel_group_non_empty_request_with_auto_populated_field(): client.update_channel_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateChannelGroupRequest() + request_msg = analytics_admin.UpdateChannelGroupRequest() + assert args[0] == request_msg def test_update_channel_group_use_cached_wrapped_rpc(): @@ -39768,9 +39941,15 @@ async def test_update_channel_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.UpdateChannelGroupRequest(), + {}, + ], +) async def test_update_channel_group_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.UpdateChannelGroupRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -39779,7 +39958,7 @@ async def test_update_channel_group_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( @@ -39812,11 +39991,6 @@ async def test_update_channel_group_async( assert response.primary is True -@pytest.mark.asyncio -async def test_update_channel_group_async_from_dict(): - await test_update_channel_group_async(request_type=dict) - - def test_update_channel_group_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -39981,8 +40155,8 @@ async def test_update_channel_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.DeleteChannelGroupRequest, - dict, + analytics_admin.DeleteChannelGroupRequest(), + {}, ], ) def test_delete_channel_group(request_type, transport: str = "grpc"): @@ -39993,7 +40167,7 @@ def test_delete_channel_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -40038,9 +40212,10 @@ def test_delete_channel_group_non_empty_request_with_auto_populated_field(): client.delete_channel_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.DeleteChannelGroupRequest( + request_msg = analytics_admin.DeleteChannelGroupRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_channel_group_use_cached_wrapped_rpc(): @@ -40125,9 +40300,15 @@ async def test_delete_channel_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.DeleteChannelGroupRequest(), + {}, + ], +) async def test_delete_channel_group_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.DeleteChannelGroupRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -40136,7 +40317,7 @@ async def test_delete_channel_group_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( @@ -40156,11 +40337,6 @@ async def test_delete_channel_group_async( assert response is None -@pytest.mark.asyncio -async def test_delete_channel_group_async_from_dict(): - await test_delete_channel_group_async(request_type=dict) - - def test_delete_channel_group_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -40311,8 +40487,8 @@ async def test_delete_channel_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.CreateBigQueryLinkRequest, - dict, + analytics_admin.CreateBigQueryLinkRequest(), + {}, ], ) def test_create_big_query_link(request_type, transport: str = "grpc"): @@ -40323,7 +40499,7 @@ def test_create_big_query_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( @@ -40387,9 +40563,10 @@ def test_create_big_query_link_non_empty_request_with_auto_populated_field(): client.create_big_query_link(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateBigQueryLinkRequest( + request_msg = analytics_admin.CreateBigQueryLinkRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_big_query_link_use_cached_wrapped_rpc(): @@ -40475,9 +40652,15 @@ async def test_create_big_query_link_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.CreateBigQueryLinkRequest(), + {}, + ], +) async def test_create_big_query_link_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.CreateBigQueryLinkRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -40486,7 +40669,7 @@ async def test_create_big_query_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( @@ -40527,11 +40710,6 @@ async def test_create_big_query_link_async( assert response.dataset_location == "dataset_location_value" -@pytest.mark.asyncio -async def test_create_big_query_link_async_from_dict(): - await test_create_big_query_link_async(request_type=dict) - - def test_create_big_query_link_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -40696,8 +40874,8 @@ async def test_create_big_query_link_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetBigQueryLinkRequest, - dict, + analytics_admin.GetBigQueryLinkRequest(), + {}, ], ) def test_get_big_query_link(request_type, transport: str = "grpc"): @@ -40708,7 +40886,7 @@ def test_get_big_query_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( @@ -40772,9 +40950,10 @@ def test_get_big_query_link_non_empty_request_with_auto_populated_field(): client.get_big_query_link(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetBigQueryLinkRequest( + request_msg = analytics_admin.GetBigQueryLinkRequest( name="name_value", ) + assert args[0] == request_msg def test_get_big_query_link_use_cached_wrapped_rpc(): @@ -40859,9 +41038,14 @@ async def test_get_big_query_link_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_big_query_link_async( - transport: str = "grpc_asyncio", request_type=analytics_admin.GetBigQueryLinkRequest -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.GetBigQueryLinkRequest(), + {}, + ], +) +async def test_get_big_query_link_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -40869,7 +41053,7 @@ async def test_get_big_query_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( @@ -40910,11 +41094,6 @@ async def test_get_big_query_link_async( assert response.dataset_location == "dataset_location_value" -@pytest.mark.asyncio -async def test_get_big_query_link_async_from_dict(): - await test_get_big_query_link_async(request_type=dict) - - def test_get_big_query_link_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -41069,8 +41248,8 @@ async def test_get_big_query_link_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListBigQueryLinksRequest, - dict, + analytics_admin.ListBigQueryLinksRequest(), + {}, ], ) def test_list_big_query_links(request_type, transport: str = "grpc"): @@ -41081,7 +41260,7 @@ def test_list_big_query_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( @@ -41130,10 +41309,11 @@ def test_list_big_query_links_non_empty_request_with_auto_populated_field(): client.list_big_query_links(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListBigQueryLinksRequest( + request_msg = analytics_admin.ListBigQueryLinksRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_big_query_links_use_cached_wrapped_rpc(): @@ -41218,9 +41398,15 @@ async def test_list_big_query_links_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.ListBigQueryLinksRequest(), + {}, + ], +) async def test_list_big_query_links_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.ListBigQueryLinksRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -41229,7 +41415,7 @@ async def test_list_big_query_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( @@ -41254,11 +41440,6 @@ async def test_list_big_query_links_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_big_query_links_async_from_dict(): - await test_list_big_query_links_async(request_type=dict) - - def test_list_big_query_links_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -41611,8 +41792,8 @@ async def test_list_big_query_links_async_pages(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.DeleteBigQueryLinkRequest, - dict, + analytics_admin.DeleteBigQueryLinkRequest(), + {}, ], ) def test_delete_big_query_link(request_type, transport: str = "grpc"): @@ -41623,7 +41804,7 @@ def test_delete_big_query_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( @@ -41668,9 +41849,10 @@ def test_delete_big_query_link_non_empty_request_with_auto_populated_field(): client.delete_big_query_link(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.DeleteBigQueryLinkRequest( + request_msg = analytics_admin.DeleteBigQueryLinkRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_big_query_link_use_cached_wrapped_rpc(): @@ -41756,9 +41938,15 @@ async def test_delete_big_query_link_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.DeleteBigQueryLinkRequest(), + {}, + ], +) async def test_delete_big_query_link_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.DeleteBigQueryLinkRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -41767,7 +41955,7 @@ async def test_delete_big_query_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( @@ -41787,11 +41975,6 @@ async def test_delete_big_query_link_async( assert response is None -@pytest.mark.asyncio -async def test_delete_big_query_link_async_from_dict(): - await test_delete_big_query_link_async(request_type=dict) - - def test_delete_big_query_link_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -41942,8 +42125,8 @@ async def test_delete_big_query_link_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdateBigQueryLinkRequest, - dict, + analytics_admin.UpdateBigQueryLinkRequest(), + {}, ], ) def test_update_big_query_link(request_type, transport: str = "grpc"): @@ -41954,7 +42137,7 @@ def test_update_big_query_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( @@ -42016,7 +42199,8 @@ def test_update_big_query_link_non_empty_request_with_auto_populated_field(): client.update_big_query_link(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateBigQueryLinkRequest() + request_msg = analytics_admin.UpdateBigQueryLinkRequest() + assert args[0] == request_msg def test_update_big_query_link_use_cached_wrapped_rpc(): @@ -42102,9 +42286,15 @@ async def test_update_big_query_link_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.UpdateBigQueryLinkRequest(), + {}, + ], +) async def test_update_big_query_link_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.UpdateBigQueryLinkRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -42113,7 +42303,7 @@ async def test_update_big_query_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( @@ -42154,11 +42344,6 @@ async def test_update_big_query_link_async( assert response.dataset_location == "dataset_location_value" -@pytest.mark.asyncio -async def test_update_big_query_link_async_from_dict(): - await test_update_big_query_link_async(request_type=dict) - - def test_update_big_query_link_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -42323,8 +42508,8 @@ async def test_update_big_query_link_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetEnhancedMeasurementSettingsRequest, - dict, + analytics_admin.GetEnhancedMeasurementSettingsRequest(), + {}, ], ) def test_get_enhanced_measurement_settings(request_type, transport: str = "grpc"): @@ -42335,7 +42520,7 @@ def test_get_enhanced_measurement_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( @@ -42403,9 +42588,10 @@ def test_get_enhanced_measurement_settings_non_empty_request_with_auto_populated client.get_enhanced_measurement_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetEnhancedMeasurementSettingsRequest( + request_msg = analytics_admin.GetEnhancedMeasurementSettingsRequest( name="name_value", ) + assert args[0] == request_msg def test_get_enhanced_measurement_settings_use_cached_wrapped_rpc(): @@ -42491,9 +42677,15 @@ async def test_get_enhanced_measurement_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.GetEnhancedMeasurementSettingsRequest(), + {}, + ], +) async def test_get_enhanced_measurement_settings_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.GetEnhancedMeasurementSettingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -42502,7 +42694,7 @@ async def test_get_enhanced_measurement_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( @@ -42547,11 +42739,6 @@ async def test_get_enhanced_measurement_settings_async( assert response.uri_query_parameter == "uri_query_parameter_value" -@pytest.mark.asyncio -async def test_get_enhanced_measurement_settings_async_from_dict(): - await test_get_enhanced_measurement_settings_async(request_type=dict) - - def test_get_enhanced_measurement_settings_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -42706,8 +42893,8 @@ async def test_get_enhanced_measurement_settings_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdateEnhancedMeasurementSettingsRequest, - dict, + analytics_admin.UpdateEnhancedMeasurementSettingsRequest(), + {}, ], ) def test_update_enhanced_measurement_settings(request_type, transport: str = "grpc"): @@ -42718,7 +42905,7 @@ def test_update_enhanced_measurement_settings(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( @@ -42784,7 +42971,8 @@ def test_update_enhanced_measurement_settings_non_empty_request_with_auto_popula client.update_enhanced_measurement_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateEnhancedMeasurementSettingsRequest() + request_msg = analytics_admin.UpdateEnhancedMeasurementSettingsRequest() + assert args[0] == request_msg def test_update_enhanced_measurement_settings_use_cached_wrapped_rpc(): @@ -42870,9 +43058,15 @@ async def test_update_enhanced_measurement_settings_async_use_cached_wrapped_rpc @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.UpdateEnhancedMeasurementSettingsRequest(), + {}, + ], +) async def test_update_enhanced_measurement_settings_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.UpdateEnhancedMeasurementSettingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -42881,7 +43075,7 @@ async def test_update_enhanced_measurement_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( @@ -42926,11 +43120,6 @@ async def test_update_enhanced_measurement_settings_async( assert response.uri_query_parameter == "uri_query_parameter_value" -@pytest.mark.asyncio -async def test_update_enhanced_measurement_settings_async_from_dict(): - await test_update_enhanced_measurement_settings_async(request_type=dict) - - def test_update_enhanced_measurement_settings_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -43103,8 +43292,8 @@ async def test_update_enhanced_measurement_settings_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetAdSenseLinkRequest, - dict, + analytics_admin.GetAdSenseLinkRequest(), + {}, ], ) def test_get_ad_sense_link(request_type, transport: str = "grpc"): @@ -43115,7 +43304,7 @@ def test_get_ad_sense_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( @@ -43165,9 +43354,10 @@ def test_get_ad_sense_link_non_empty_request_with_auto_populated_field(): client.get_ad_sense_link(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetAdSenseLinkRequest( + request_msg = analytics_admin.GetAdSenseLinkRequest( name="name_value", ) + assert args[0] == request_msg def test_get_ad_sense_link_use_cached_wrapped_rpc(): @@ -43250,9 +43440,14 @@ async def test_get_ad_sense_link_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_ad_sense_link_async( - transport: str = "grpc_asyncio", request_type=analytics_admin.GetAdSenseLinkRequest -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.GetAdSenseLinkRequest(), + {}, + ], +) +async def test_get_ad_sense_link_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -43260,7 +43455,7 @@ async def test_get_ad_sense_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( @@ -43287,11 +43482,6 @@ async def test_get_ad_sense_link_async( assert response.ad_client_code == "ad_client_code_value" -@pytest.mark.asyncio -async def test_get_ad_sense_link_async_from_dict(): - await test_get_ad_sense_link_async(request_type=dict) - - def test_get_ad_sense_link_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -43446,8 +43636,8 @@ async def test_get_ad_sense_link_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.CreateAdSenseLinkRequest, - dict, + analytics_admin.CreateAdSenseLinkRequest(), + {}, ], ) def test_create_ad_sense_link(request_type, transport: str = "grpc"): @@ -43458,7 +43648,7 @@ def test_create_ad_sense_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( @@ -43508,9 +43698,10 @@ def test_create_ad_sense_link_non_empty_request_with_auto_populated_field(): client.create_ad_sense_link(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateAdSenseLinkRequest( + request_msg = analytics_admin.CreateAdSenseLinkRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_ad_sense_link_use_cached_wrapped_rpc(): @@ -43595,9 +43786,15 @@ async def test_create_ad_sense_link_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.CreateAdSenseLinkRequest(), + {}, + ], +) async def test_create_ad_sense_link_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.CreateAdSenseLinkRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -43606,7 +43803,7 @@ async def test_create_ad_sense_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( @@ -43633,11 +43830,6 @@ async def test_create_ad_sense_link_async( assert response.ad_client_code == "ad_client_code_value" -@pytest.mark.asyncio -async def test_create_ad_sense_link_async_from_dict(): - await test_create_ad_sense_link_async(request_type=dict) - - def test_create_ad_sense_link_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -43802,8 +43994,8 @@ async def test_create_ad_sense_link_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.DeleteAdSenseLinkRequest, - dict, + analytics_admin.DeleteAdSenseLinkRequest(), + {}, ], ) def test_delete_ad_sense_link(request_type, transport: str = "grpc"): @@ -43814,7 +44006,7 @@ def test_delete_ad_sense_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( @@ -43859,9 +44051,10 @@ def test_delete_ad_sense_link_non_empty_request_with_auto_populated_field(): client.delete_ad_sense_link(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.DeleteAdSenseLinkRequest( + request_msg = analytics_admin.DeleteAdSenseLinkRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_ad_sense_link_use_cached_wrapped_rpc(): @@ -43946,9 +44139,15 @@ async def test_delete_ad_sense_link_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.DeleteAdSenseLinkRequest(), + {}, + ], +) async def test_delete_ad_sense_link_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.DeleteAdSenseLinkRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -43957,7 +44156,7 @@ async def test_delete_ad_sense_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( @@ -43977,11 +44176,6 @@ async def test_delete_ad_sense_link_async( assert response is None -@pytest.mark.asyncio -async def test_delete_ad_sense_link_async_from_dict(): - await test_delete_ad_sense_link_async(request_type=dict) - - def test_delete_ad_sense_link_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -44132,8 +44326,8 @@ async def test_delete_ad_sense_link_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListAdSenseLinksRequest, - dict, + analytics_admin.ListAdSenseLinksRequest(), + {}, ], ) def test_list_ad_sense_links(request_type, transport: str = "grpc"): @@ -44144,7 +44338,7 @@ def test_list_ad_sense_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( @@ -44193,10 +44387,11 @@ def test_list_ad_sense_links_non_empty_request_with_auto_populated_field(): client.list_ad_sense_links(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListAdSenseLinksRequest( + request_msg = analytics_admin.ListAdSenseLinksRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_ad_sense_links_use_cached_wrapped_rpc(): @@ -44281,10 +44476,14 @@ async def test_list_ad_sense_links_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_ad_sense_links_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.ListAdSenseLinksRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.ListAdSenseLinksRequest(), + {}, + ], +) +async def test_list_ad_sense_links_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -44292,7 +44491,7 @@ async def test_list_ad_sense_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( @@ -44317,11 +44516,6 @@ async def test_list_ad_sense_links_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_ad_sense_links_async_from_dict(): - await test_list_ad_sense_links_async(request_type=dict) - - def test_list_ad_sense_links_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -44674,8 +44868,8 @@ async def test_list_ad_sense_links_async_pages(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetEventCreateRuleRequest, - dict, + analytics_admin.GetEventCreateRuleRequest(), + {}, ], ) def test_get_event_create_rule(request_type, transport: str = "grpc"): @@ -44686,7 +44880,7 @@ def test_get_event_create_rule(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -44738,9 +44932,10 @@ def test_get_event_create_rule_non_empty_request_with_auto_populated_field(): client.get_event_create_rule(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetEventCreateRuleRequest( + request_msg = analytics_admin.GetEventCreateRuleRequest( name="name_value", ) + assert args[0] == request_msg def test_get_event_create_rule_use_cached_wrapped_rpc(): @@ -44826,9 +45021,15 @@ async def test_get_event_create_rule_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.GetEventCreateRuleRequest(), + {}, + ], +) async def test_get_event_create_rule_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.GetEventCreateRuleRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -44837,7 +45038,7 @@ async def test_get_event_create_rule_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( @@ -44866,11 +45067,6 @@ async def test_get_event_create_rule_async( assert response.source_copy_parameters is True -@pytest.mark.asyncio -async def test_get_event_create_rule_async_from_dict(): - await test_get_event_create_rule_async(request_type=dict) - - def test_get_event_create_rule_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -45025,8 +45221,8 @@ async def test_get_event_create_rule_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListEventCreateRulesRequest, - dict, + analytics_admin.ListEventCreateRulesRequest(), + {}, ], ) def test_list_event_create_rules(request_type, transport: str = "grpc"): @@ -45037,7 +45233,7 @@ def test_list_event_create_rules(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -45086,10 +45282,11 @@ def test_list_event_create_rules_non_empty_request_with_auto_populated_field(): client.list_event_create_rules(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListEventCreateRulesRequest( + request_msg = analytics_admin.ListEventCreateRulesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_event_create_rules_use_cached_wrapped_rpc(): @@ -45175,9 +45372,15 @@ async def test_list_event_create_rules_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.ListEventCreateRulesRequest(), + {}, + ], +) async def test_list_event_create_rules_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.ListEventCreateRulesRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -45186,7 +45389,7 @@ async def test_list_event_create_rules_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( @@ -45211,11 +45414,6 @@ async def test_list_event_create_rules_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_event_create_rules_async_from_dict(): - await test_list_event_create_rules_async(request_type=dict) - - def test_list_event_create_rules_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -45572,8 +45770,8 @@ async def test_list_event_create_rules_async_pages(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.CreateEventCreateRuleRequest, - dict, + analytics_admin.CreateEventCreateRuleRequest(), + {}, ], ) def test_create_event_create_rule(request_type, transport: str = "grpc"): @@ -45584,7 +45782,7 @@ def test_create_event_create_rule(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -45636,9 +45834,10 @@ def test_create_event_create_rule_non_empty_request_with_auto_populated_field(): client.create_event_create_rule(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateEventCreateRuleRequest( + request_msg = analytics_admin.CreateEventCreateRuleRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_event_create_rule_use_cached_wrapped_rpc(): @@ -45724,9 +45923,15 @@ async def test_create_event_create_rule_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.CreateEventCreateRuleRequest(), + {}, + ], +) async def test_create_event_create_rule_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.CreateEventCreateRuleRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -45735,7 +45940,7 @@ async def test_create_event_create_rule_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( @@ -45764,11 +45969,6 @@ async def test_create_event_create_rule_async( assert response.source_copy_parameters is True -@pytest.mark.asyncio -async def test_create_event_create_rule_async_from_dict(): - await test_create_event_create_rule_async(request_type=dict) - - def test_create_event_create_rule_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -45933,8 +46133,8 @@ async def test_create_event_create_rule_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdateEventCreateRuleRequest, - dict, + analytics_admin.UpdateEventCreateRuleRequest(), + {}, ], ) def test_update_event_create_rule(request_type, transport: str = "grpc"): @@ -45945,7 +46145,7 @@ def test_update_event_create_rule(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -45995,7 +46195,8 @@ def test_update_event_create_rule_non_empty_request_with_auto_populated_field(): client.update_event_create_rule(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateEventCreateRuleRequest() + request_msg = analytics_admin.UpdateEventCreateRuleRequest() + assert args[0] == request_msg def test_update_event_create_rule_use_cached_wrapped_rpc(): @@ -46081,9 +46282,15 @@ async def test_update_event_create_rule_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.UpdateEventCreateRuleRequest(), + {}, + ], +) async def test_update_event_create_rule_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.UpdateEventCreateRuleRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -46092,7 +46299,7 @@ async def test_update_event_create_rule_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( @@ -46121,11 +46328,6 @@ async def test_update_event_create_rule_async( assert response.source_copy_parameters is True -@pytest.mark.asyncio -async def test_update_event_create_rule_async_from_dict(): - await test_update_event_create_rule_async(request_type=dict) - - def test_update_event_create_rule_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -46290,8 +46492,8 @@ async def test_update_event_create_rule_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.DeleteEventCreateRuleRequest, - dict, + analytics_admin.DeleteEventCreateRuleRequest(), + {}, ], ) def test_delete_event_create_rule(request_type, transport: str = "grpc"): @@ -46302,7 +46504,7 @@ def test_delete_event_create_rule(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -46347,9 +46549,10 @@ def test_delete_event_create_rule_non_empty_request_with_auto_populated_field(): client.delete_event_create_rule(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.DeleteEventCreateRuleRequest( + request_msg = analytics_admin.DeleteEventCreateRuleRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_event_create_rule_use_cached_wrapped_rpc(): @@ -46435,9 +46638,15 @@ async def test_delete_event_create_rule_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.DeleteEventCreateRuleRequest(), + {}, + ], +) async def test_delete_event_create_rule_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.DeleteEventCreateRuleRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -46446,7 +46655,7 @@ async def test_delete_event_create_rule_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( @@ -46466,11 +46675,6 @@ async def test_delete_event_create_rule_async( assert response is None -@pytest.mark.asyncio -async def test_delete_event_create_rule_async_from_dict(): - await test_delete_event_create_rule_async(request_type=dict) - - def test_delete_event_create_rule_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -46621,8 +46825,8 @@ async def test_delete_event_create_rule_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetEventEditRuleRequest, - dict, + analytics_admin.GetEventEditRuleRequest(), + {}, ], ) def test_get_event_edit_rule(request_type, transport: str = "grpc"): @@ -46633,7 +46837,7 @@ def test_get_event_edit_rule(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -46685,9 +46889,10 @@ def test_get_event_edit_rule_non_empty_request_with_auto_populated_field(): client.get_event_edit_rule(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetEventEditRuleRequest( + request_msg = analytics_admin.GetEventEditRuleRequest( name="name_value", ) + assert args[0] == request_msg def test_get_event_edit_rule_use_cached_wrapped_rpc(): @@ -46772,10 +46977,14 @@ async def test_get_event_edit_rule_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_event_edit_rule_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.GetEventEditRuleRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.GetEventEditRuleRequest(), + {}, + ], +) +async def test_get_event_edit_rule_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -46783,7 +46992,7 @@ async def test_get_event_edit_rule_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( @@ -46812,11 +47021,6 @@ async def test_get_event_edit_rule_async( assert response.processing_order == 1720 -@pytest.mark.asyncio -async def test_get_event_edit_rule_async_from_dict(): - await test_get_event_edit_rule_async(request_type=dict) - - def test_get_event_edit_rule_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -46971,8 +47175,8 @@ async def test_get_event_edit_rule_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListEventEditRulesRequest, - dict, + analytics_admin.ListEventEditRulesRequest(), + {}, ], ) def test_list_event_edit_rules(request_type, transport: str = "grpc"): @@ -46983,7 +47187,7 @@ def test_list_event_edit_rules(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -47032,10 +47236,11 @@ def test_list_event_edit_rules_non_empty_request_with_auto_populated_field(): client.list_event_edit_rules(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListEventEditRulesRequest( + request_msg = analytics_admin.ListEventEditRulesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_event_edit_rules_use_cached_wrapped_rpc(): @@ -47121,9 +47326,15 @@ async def test_list_event_edit_rules_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.ListEventEditRulesRequest(), + {}, + ], +) async def test_list_event_edit_rules_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.ListEventEditRulesRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -47132,7 +47343,7 @@ async def test_list_event_edit_rules_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( @@ -47157,11 +47368,6 @@ async def test_list_event_edit_rules_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_event_edit_rules_async_from_dict(): - await test_list_event_edit_rules_async(request_type=dict) - - def test_list_event_edit_rules_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -47516,8 +47722,8 @@ async def test_list_event_edit_rules_async_pages(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.CreateEventEditRuleRequest, - dict, + analytics_admin.CreateEventEditRuleRequest(), + {}, ], ) def test_create_event_edit_rule(request_type, transport: str = "grpc"): @@ -47528,7 +47734,7 @@ def test_create_event_edit_rule(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -47580,9 +47786,10 @@ def test_create_event_edit_rule_non_empty_request_with_auto_populated_field(): client.create_event_edit_rule(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateEventEditRuleRequest( + request_msg = analytics_admin.CreateEventEditRuleRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_event_edit_rule_use_cached_wrapped_rpc(): @@ -47668,9 +47875,15 @@ async def test_create_event_edit_rule_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.CreateEventEditRuleRequest(), + {}, + ], +) async def test_create_event_edit_rule_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.CreateEventEditRuleRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -47679,7 +47892,7 @@ async def test_create_event_edit_rule_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( @@ -47708,11 +47921,6 @@ async def test_create_event_edit_rule_async( assert response.processing_order == 1720 -@pytest.mark.asyncio -async def test_create_event_edit_rule_async_from_dict(): - await test_create_event_edit_rule_async(request_type=dict) - - def test_create_event_edit_rule_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -47877,8 +48085,8 @@ async def test_create_event_edit_rule_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdateEventEditRuleRequest, - dict, + analytics_admin.UpdateEventEditRuleRequest(), + {}, ], ) def test_update_event_edit_rule(request_type, transport: str = "grpc"): @@ -47889,7 +48097,7 @@ def test_update_event_edit_rule(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -47939,7 +48147,8 @@ def test_update_event_edit_rule_non_empty_request_with_auto_populated_field(): client.update_event_edit_rule(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateEventEditRuleRequest() + request_msg = analytics_admin.UpdateEventEditRuleRequest() + assert args[0] == request_msg def test_update_event_edit_rule_use_cached_wrapped_rpc(): @@ -48025,9 +48234,15 @@ async def test_update_event_edit_rule_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.UpdateEventEditRuleRequest(), + {}, + ], +) async def test_update_event_edit_rule_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.UpdateEventEditRuleRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -48036,7 +48251,7 @@ async def test_update_event_edit_rule_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( @@ -48065,11 +48280,6 @@ async def test_update_event_edit_rule_async( assert response.processing_order == 1720 -@pytest.mark.asyncio -async def test_update_event_edit_rule_async_from_dict(): - await test_update_event_edit_rule_async(request_type=dict) - - def test_update_event_edit_rule_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -48234,8 +48444,8 @@ async def test_update_event_edit_rule_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.DeleteEventEditRuleRequest, - dict, + analytics_admin.DeleteEventEditRuleRequest(), + {}, ], ) def test_delete_event_edit_rule(request_type, transport: str = "grpc"): @@ -48246,7 +48456,7 @@ def test_delete_event_edit_rule(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -48291,9 +48501,10 @@ def test_delete_event_edit_rule_non_empty_request_with_auto_populated_field(): client.delete_event_edit_rule(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.DeleteEventEditRuleRequest( + request_msg = analytics_admin.DeleteEventEditRuleRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_event_edit_rule_use_cached_wrapped_rpc(): @@ -48379,9 +48590,15 @@ async def test_delete_event_edit_rule_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.DeleteEventEditRuleRequest(), + {}, + ], +) async def test_delete_event_edit_rule_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.DeleteEventEditRuleRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -48390,7 +48607,7 @@ async def test_delete_event_edit_rule_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( @@ -48410,11 +48627,6 @@ async def test_delete_event_edit_rule_async( assert response is None -@pytest.mark.asyncio -async def test_delete_event_edit_rule_async_from_dict(): - await test_delete_event_edit_rule_async(request_type=dict) - - def test_delete_event_edit_rule_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -48565,8 +48777,8 @@ async def test_delete_event_edit_rule_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.ReorderEventEditRulesRequest, - dict, + analytics_admin.ReorderEventEditRulesRequest(), + {}, ], ) def test_reorder_event_edit_rules(request_type, transport: str = "grpc"): @@ -48577,7 +48789,7 @@ def test_reorder_event_edit_rules(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -48622,9 +48834,10 @@ def test_reorder_event_edit_rules_non_empty_request_with_auto_populated_field(): client.reorder_event_edit_rules(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ReorderEventEditRulesRequest( + request_msg = analytics_admin.ReorderEventEditRulesRequest( parent="parent_value", ) + assert args[0] == request_msg def test_reorder_event_edit_rules_use_cached_wrapped_rpc(): @@ -48710,9 +48923,15 @@ async def test_reorder_event_edit_rules_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.ReorderEventEditRulesRequest(), + {}, + ], +) async def test_reorder_event_edit_rules_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.ReorderEventEditRulesRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -48721,7 +48940,7 @@ async def test_reorder_event_edit_rules_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( @@ -48741,11 +48960,6 @@ async def test_reorder_event_edit_rules_async( assert response is None -@pytest.mark.asyncio -async def test_reorder_event_edit_rules_async_from_dict(): - await test_reorder_event_edit_rules_async(request_type=dict) - - def test_reorder_event_edit_rules_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -48812,8 +49026,8 @@ async def test_reorder_event_edit_rules_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdateDataRedactionSettingsRequest, - dict, + analytics_admin.UpdateDataRedactionSettingsRequest(), + {}, ], ) def test_update_data_redaction_settings(request_type, transport: str = "grpc"): @@ -48824,7 +49038,7 @@ def test_update_data_redaction_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( @@ -48876,7 +49090,8 @@ def test_update_data_redaction_settings_non_empty_request_with_auto_populated_fi client.update_data_redaction_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateDataRedactionSettingsRequest() + request_msg = analytics_admin.UpdateDataRedactionSettingsRequest() + assert args[0] == request_msg def test_update_data_redaction_settings_use_cached_wrapped_rpc(): @@ -48962,9 +49177,15 @@ async def test_update_data_redaction_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.UpdateDataRedactionSettingsRequest(), + {}, + ], +) async def test_update_data_redaction_settings_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.UpdateDataRedactionSettingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -48973,7 +49194,7 @@ async def test_update_data_redaction_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( @@ -49004,11 +49225,6 @@ async def test_update_data_redaction_settings_async( assert response.query_parameter_keys == ["query_parameter_keys_value"] -@pytest.mark.asyncio -async def test_update_data_redaction_settings_async_from_dict(): - await test_update_data_redaction_settings_async(request_type=dict) - - def test_update_data_redaction_settings_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -49173,8 +49389,8 @@ async def test_update_data_redaction_settings_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetDataRedactionSettingsRequest, - dict, + analytics_admin.GetDataRedactionSettingsRequest(), + {}, ], ) def test_get_data_redaction_settings(request_type, transport: str = "grpc"): @@ -49185,7 +49401,7 @@ def test_get_data_redaction_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( @@ -49239,9 +49455,10 @@ def test_get_data_redaction_settings_non_empty_request_with_auto_populated_field client.get_data_redaction_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetDataRedactionSettingsRequest( + request_msg = analytics_admin.GetDataRedactionSettingsRequest( name="name_value", ) + assert args[0] == request_msg def test_get_data_redaction_settings_use_cached_wrapped_rpc(): @@ -49327,9 +49544,15 @@ async def test_get_data_redaction_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.GetDataRedactionSettingsRequest(), + {}, + ], +) async def test_get_data_redaction_settings_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.GetDataRedactionSettingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -49338,7 +49561,7 @@ async def test_get_data_redaction_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( @@ -49369,11 +49592,6 @@ async def test_get_data_redaction_settings_async( assert response.query_parameter_keys == ["query_parameter_keys_value"] -@pytest.mark.asyncio -async def test_get_data_redaction_settings_async_from_dict(): - await test_get_data_redaction_settings_async(request_type=dict) - - def test_get_data_redaction_settings_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -49528,8 +49746,8 @@ async def test_get_data_redaction_settings_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetCalculatedMetricRequest, - dict, + analytics_admin.GetCalculatedMetricRequest(), + {}, ], ) def test_get_calculated_metric(request_type, transport: str = "grpc"): @@ -49540,7 +49758,7 @@ def test_get_calculated_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( @@ -49606,9 +49824,10 @@ def test_get_calculated_metric_non_empty_request_with_auto_populated_field(): client.get_calculated_metric(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetCalculatedMetricRequest( + request_msg = analytics_admin.GetCalculatedMetricRequest( name="name_value", ) + assert args[0] == request_msg def test_get_calculated_metric_use_cached_wrapped_rpc(): @@ -49694,9 +49913,15 @@ async def test_get_calculated_metric_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.GetCalculatedMetricRequest(), + {}, + ], +) async def test_get_calculated_metric_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.GetCalculatedMetricRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -49705,7 +49930,7 @@ async def test_get_calculated_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( @@ -49748,11 +49973,6 @@ async def test_get_calculated_metric_async( assert response.invalid_metric_reference is True -@pytest.mark.asyncio -async def test_get_calculated_metric_async_from_dict(): - await test_get_calculated_metric_async(request_type=dict) - - def test_get_calculated_metric_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -49907,8 +50127,8 @@ async def test_get_calculated_metric_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.CreateCalculatedMetricRequest, - dict, + analytics_admin.CreateCalculatedMetricRequest(), + {}, ], ) def test_create_calculated_metric(request_type, transport: str = "grpc"): @@ -49919,7 +50139,7 @@ def test_create_calculated_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( @@ -49986,10 +50206,11 @@ def test_create_calculated_metric_non_empty_request_with_auto_populated_field(): client.create_calculated_metric(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateCalculatedMetricRequest( + request_msg = analytics_admin.CreateCalculatedMetricRequest( parent="parent_value", calculated_metric_id="calculated_metric_id_value", ) + assert args[0] == request_msg def test_create_calculated_metric_use_cached_wrapped_rpc(): @@ -50075,9 +50296,15 @@ async def test_create_calculated_metric_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.CreateCalculatedMetricRequest(), + {}, + ], +) async def test_create_calculated_metric_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.CreateCalculatedMetricRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -50086,7 +50313,7 @@ async def test_create_calculated_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( @@ -50129,11 +50356,6 @@ async def test_create_calculated_metric_async( assert response.invalid_metric_reference is True -@pytest.mark.asyncio -async def test_create_calculated_metric_async_from_dict(): - await test_create_calculated_metric_async(request_type=dict) - - def test_create_calculated_metric_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -50308,8 +50530,8 @@ async def test_create_calculated_metric_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListCalculatedMetricsRequest, - dict, + analytics_admin.ListCalculatedMetricsRequest(), + {}, ], ) def test_list_calculated_metrics(request_type, transport: str = "grpc"): @@ -50320,7 +50542,7 @@ def test_list_calculated_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( @@ -50369,10 +50591,11 @@ def test_list_calculated_metrics_non_empty_request_with_auto_populated_field(): client.list_calculated_metrics(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListCalculatedMetricsRequest( + request_msg = analytics_admin.ListCalculatedMetricsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_calculated_metrics_use_cached_wrapped_rpc(): @@ -50458,9 +50681,15 @@ async def test_list_calculated_metrics_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.ListCalculatedMetricsRequest(), + {}, + ], +) async def test_list_calculated_metrics_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.ListCalculatedMetricsRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -50469,7 +50698,7 @@ async def test_list_calculated_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( @@ -50494,11 +50723,6 @@ async def test_list_calculated_metrics_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_calculated_metrics_async_from_dict(): - await test_list_calculated_metrics_async(request_type=dict) - - def test_list_calculated_metrics_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -50851,8 +51075,8 @@ async def test_list_calculated_metrics_async_pages(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdateCalculatedMetricRequest, - dict, + analytics_admin.UpdateCalculatedMetricRequest(), + {}, ], ) def test_update_calculated_metric(request_type, transport: str = "grpc"): @@ -50863,7 +51087,7 @@ def test_update_calculated_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( @@ -50927,7 +51151,8 @@ def test_update_calculated_metric_non_empty_request_with_auto_populated_field(): client.update_calculated_metric(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateCalculatedMetricRequest() + request_msg = analytics_admin.UpdateCalculatedMetricRequest() + assert args[0] == request_msg def test_update_calculated_metric_use_cached_wrapped_rpc(): @@ -51013,9 +51238,15 @@ async def test_update_calculated_metric_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.UpdateCalculatedMetricRequest(), + {}, + ], +) async def test_update_calculated_metric_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.UpdateCalculatedMetricRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -51024,7 +51255,7 @@ async def test_update_calculated_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( @@ -51067,11 +51298,6 @@ async def test_update_calculated_metric_async( assert response.invalid_metric_reference is True -@pytest.mark.asyncio -async def test_update_calculated_metric_async_from_dict(): - await test_update_calculated_metric_async(request_type=dict) - - def test_update_calculated_metric_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -51236,8 +51462,8 @@ async def test_update_calculated_metric_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.DeleteCalculatedMetricRequest, - dict, + analytics_admin.DeleteCalculatedMetricRequest(), + {}, ], ) def test_delete_calculated_metric(request_type, transport: str = "grpc"): @@ -51248,7 +51474,7 @@ def test_delete_calculated_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( @@ -51293,9 +51519,10 @@ def test_delete_calculated_metric_non_empty_request_with_auto_populated_field(): client.delete_calculated_metric(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.DeleteCalculatedMetricRequest( + request_msg = analytics_admin.DeleteCalculatedMetricRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_calculated_metric_use_cached_wrapped_rpc(): @@ -51381,9 +51608,15 @@ async def test_delete_calculated_metric_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.DeleteCalculatedMetricRequest(), + {}, + ], +) async def test_delete_calculated_metric_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.DeleteCalculatedMetricRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -51392,7 +51625,7 @@ async def test_delete_calculated_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( @@ -51412,11 +51645,6 @@ async def test_delete_calculated_metric_async( assert response is None -@pytest.mark.asyncio -async def test_delete_calculated_metric_async_from_dict(): - await test_delete_calculated_metric_async(request_type=dict) - - def test_delete_calculated_metric_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -51567,8 +51795,8 @@ async def test_delete_calculated_metric_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.CreateRollupPropertyRequest, - dict, + analytics_admin.CreateRollupPropertyRequest(), + {}, ], ) def test_create_rollup_property(request_type, transport: str = "grpc"): @@ -51579,7 +51807,7 @@ def test_create_rollup_property(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -51622,7 +51850,8 @@ def test_create_rollup_property_non_empty_request_with_auto_populated_field(): client.create_rollup_property(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateRollupPropertyRequest() + request_msg = analytics_admin.CreateRollupPropertyRequest() + assert args[0] == request_msg def test_create_rollup_property_use_cached_wrapped_rpc(): @@ -51708,9 +51937,15 @@ async def test_create_rollup_property_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.CreateRollupPropertyRequest(), + {}, + ], +) async def test_create_rollup_property_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.CreateRollupPropertyRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -51719,7 +51954,7 @@ async def test_create_rollup_property_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( @@ -51741,16 +51976,11 @@ async def test_create_rollup_property_async( assert isinstance(response, analytics_admin.CreateRollupPropertyResponse) -@pytest.mark.asyncio -async def test_create_rollup_property_async_from_dict(): - await test_create_rollup_property_async(request_type=dict) - - @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetRollupPropertySourceLinkRequest, - dict, + analytics_admin.GetRollupPropertySourceLinkRequest(), + {}, ], ) def test_get_rollup_property_source_link(request_type, transport: str = "grpc"): @@ -51761,7 +51991,7 @@ def test_get_rollup_property_source_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( @@ -51811,9 +52041,10 @@ def test_get_rollup_property_source_link_non_empty_request_with_auto_populated_f client.get_rollup_property_source_link(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetRollupPropertySourceLinkRequest( + request_msg = analytics_admin.GetRollupPropertySourceLinkRequest( name="name_value", ) + assert args[0] == request_msg def test_get_rollup_property_source_link_use_cached_wrapped_rpc(): @@ -51899,9 +52130,15 @@ async def test_get_rollup_property_source_link_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.GetRollupPropertySourceLinkRequest(), + {}, + ], +) async def test_get_rollup_property_source_link_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.GetRollupPropertySourceLinkRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -51910,7 +52147,7 @@ async def test_get_rollup_property_source_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( @@ -51937,11 +52174,6 @@ async def test_get_rollup_property_source_link_async( assert response.source_property == "source_property_value" -@pytest.mark.asyncio -async def test_get_rollup_property_source_link_async_from_dict(): - await test_get_rollup_property_source_link_async(request_type=dict) - - def test_get_rollup_property_source_link_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -52096,8 +52328,8 @@ async def test_get_rollup_property_source_link_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListRollupPropertySourceLinksRequest, - dict, + analytics_admin.ListRollupPropertySourceLinksRequest(), + {}, ], ) def test_list_rollup_property_source_links(request_type, transport: str = "grpc"): @@ -52108,7 +52340,7 @@ def test_list_rollup_property_source_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( @@ -52157,10 +52389,11 @@ def test_list_rollup_property_source_links_non_empty_request_with_auto_populated client.list_rollup_property_source_links(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListRollupPropertySourceLinksRequest( + request_msg = analytics_admin.ListRollupPropertySourceLinksRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_rollup_property_source_links_use_cached_wrapped_rpc(): @@ -52246,9 +52479,15 @@ async def test_list_rollup_property_source_links_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.ListRollupPropertySourceLinksRequest(), + {}, + ], +) async def test_list_rollup_property_source_links_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.ListRollupPropertySourceLinksRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -52257,7 +52496,7 @@ async def test_list_rollup_property_source_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( @@ -52282,11 +52521,6 @@ async def test_list_rollup_property_source_links_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_rollup_property_source_links_async_from_dict(): - await test_list_rollup_property_source_links_async(request_type=dict) - - def test_list_rollup_property_source_links_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -52643,8 +52877,8 @@ async def test_list_rollup_property_source_links_async_pages(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.CreateRollupPropertySourceLinkRequest, - dict, + analytics_admin.CreateRollupPropertySourceLinkRequest(), + {}, ], ) def test_create_rollup_property_source_link(request_type, transport: str = "grpc"): @@ -52655,7 +52889,7 @@ def test_create_rollup_property_source_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( @@ -52705,9 +52939,10 @@ def test_create_rollup_property_source_link_non_empty_request_with_auto_populate client.create_rollup_property_source_link(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateRollupPropertySourceLinkRequest( + request_msg = analytics_admin.CreateRollupPropertySourceLinkRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_rollup_property_source_link_use_cached_wrapped_rpc(): @@ -52793,9 +53028,15 @@ async def test_create_rollup_property_source_link_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.CreateRollupPropertySourceLinkRequest(), + {}, + ], +) async def test_create_rollup_property_source_link_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.CreateRollupPropertySourceLinkRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -52804,7 +53045,7 @@ async def test_create_rollup_property_source_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( @@ -52831,11 +53072,6 @@ async def test_create_rollup_property_source_link_async( assert response.source_property == "source_property_value" -@pytest.mark.asyncio -async def test_create_rollup_property_source_link_async_from_dict(): - await test_create_rollup_property_source_link_async(request_type=dict) - - def test_create_rollup_property_source_link_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -53008,8 +53244,8 @@ async def test_create_rollup_property_source_link_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.DeleteRollupPropertySourceLinkRequest, - dict, + analytics_admin.DeleteRollupPropertySourceLinkRequest(), + {}, ], ) def test_delete_rollup_property_source_link(request_type, transport: str = "grpc"): @@ -53020,7 +53256,7 @@ def test_delete_rollup_property_source_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( @@ -53065,9 +53301,10 @@ def test_delete_rollup_property_source_link_non_empty_request_with_auto_populate client.delete_rollup_property_source_link(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.DeleteRollupPropertySourceLinkRequest( + request_msg = analytics_admin.DeleteRollupPropertySourceLinkRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_rollup_property_source_link_use_cached_wrapped_rpc(): @@ -53153,9 +53390,15 @@ async def test_delete_rollup_property_source_link_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.DeleteRollupPropertySourceLinkRequest(), + {}, + ], +) async def test_delete_rollup_property_source_link_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.DeleteRollupPropertySourceLinkRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -53164,7 +53407,7 @@ async def test_delete_rollup_property_source_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( @@ -53184,11 +53427,6 @@ async def test_delete_rollup_property_source_link_async( assert response is None -@pytest.mark.asyncio -async def test_delete_rollup_property_source_link_async_from_dict(): - await test_delete_rollup_property_source_link_async(request_type=dict) - - def test_delete_rollup_property_source_link_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -53339,8 +53577,8 @@ async def test_delete_rollup_property_source_link_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.ProvisionSubpropertyRequest, - dict, + analytics_admin.ProvisionSubpropertyRequest(), + {}, ], ) def test_provision_subproperty(request_type, transport: str = "grpc"): @@ -53351,7 +53589,7 @@ def test_provision_subproperty(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -53394,7 +53632,8 @@ def test_provision_subproperty_non_empty_request_with_auto_populated_field(): client.provision_subproperty(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ProvisionSubpropertyRequest() + request_msg = analytics_admin.ProvisionSubpropertyRequest() + assert args[0] == request_msg def test_provision_subproperty_use_cached_wrapped_rpc(): @@ -53480,9 +53719,15 @@ async def test_provision_subproperty_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.ProvisionSubpropertyRequest(), + {}, + ], +) async def test_provision_subproperty_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.ProvisionSubpropertyRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -53491,7 +53736,7 @@ async def test_provision_subproperty_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( @@ -53513,16 +53758,11 @@ async def test_provision_subproperty_async( assert isinstance(response, analytics_admin.ProvisionSubpropertyResponse) -@pytest.mark.asyncio -async def test_provision_subproperty_async_from_dict(): - await test_provision_subproperty_async(request_type=dict) - - @pytest.mark.parametrize( "request_type", [ - analytics_admin.CreateSubpropertyEventFilterRequest, - dict, + analytics_admin.CreateSubpropertyEventFilterRequest(), + {}, ], ) def test_create_subproperty_event_filter(request_type, transport: str = "grpc"): @@ -53533,7 +53773,7 @@ def test_create_subproperty_event_filter(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -53583,9 +53823,10 @@ def test_create_subproperty_event_filter_non_empty_request_with_auto_populated_f client.create_subproperty_event_filter(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateSubpropertyEventFilterRequest( + request_msg = analytics_admin.CreateSubpropertyEventFilterRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_subproperty_event_filter_use_cached_wrapped_rpc(): @@ -53671,9 +53912,15 @@ async def test_create_subproperty_event_filter_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.CreateSubpropertyEventFilterRequest(), + {}, + ], +) async def test_create_subproperty_event_filter_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.CreateSubpropertyEventFilterRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -53682,7 +53929,7 @@ async def test_create_subproperty_event_filter_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( @@ -53709,11 +53956,6 @@ async def test_create_subproperty_event_filter_async( assert response.apply_to_property == "apply_to_property_value" -@pytest.mark.asyncio -async def test_create_subproperty_event_filter_async_from_dict(): - await test_create_subproperty_event_filter_async(request_type=dict) - - def test_create_subproperty_event_filter_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -53890,8 +54132,8 @@ async def test_create_subproperty_event_filter_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetSubpropertyEventFilterRequest, - dict, + analytics_admin.GetSubpropertyEventFilterRequest(), + {}, ], ) def test_get_subproperty_event_filter(request_type, transport: str = "grpc"): @@ -53902,7 +54144,7 @@ def test_get_subproperty_event_filter(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -53952,9 +54194,10 @@ def test_get_subproperty_event_filter_non_empty_request_with_auto_populated_fiel client.get_subproperty_event_filter(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetSubpropertyEventFilterRequest( + request_msg = analytics_admin.GetSubpropertyEventFilterRequest( name="name_value", ) + assert args[0] == request_msg def test_get_subproperty_event_filter_use_cached_wrapped_rpc(): @@ -54040,9 +54283,15 @@ async def test_get_subproperty_event_filter_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.GetSubpropertyEventFilterRequest(), + {}, + ], +) async def test_get_subproperty_event_filter_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.GetSubpropertyEventFilterRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -54051,7 +54300,7 @@ async def test_get_subproperty_event_filter_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( @@ -54078,11 +54327,6 @@ async def test_get_subproperty_event_filter_async( assert response.apply_to_property == "apply_to_property_value" -@pytest.mark.asyncio -async def test_get_subproperty_event_filter_async_from_dict(): - await test_get_subproperty_event_filter_async(request_type=dict) - - def test_get_subproperty_event_filter_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -54237,8 +54481,8 @@ async def test_get_subproperty_event_filter_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListSubpropertyEventFiltersRequest, - dict, + analytics_admin.ListSubpropertyEventFiltersRequest(), + {}, ], ) def test_list_subproperty_event_filters(request_type, transport: str = "grpc"): @@ -54249,7 +54493,7 @@ def test_list_subproperty_event_filters(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -54298,10 +54542,11 @@ def test_list_subproperty_event_filters_non_empty_request_with_auto_populated_fi client.list_subproperty_event_filters(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListSubpropertyEventFiltersRequest( + request_msg = analytics_admin.ListSubpropertyEventFiltersRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_subproperty_event_filters_use_cached_wrapped_rpc(): @@ -54387,9 +54632,15 @@ async def test_list_subproperty_event_filters_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.ListSubpropertyEventFiltersRequest(), + {}, + ], +) async def test_list_subproperty_event_filters_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.ListSubpropertyEventFiltersRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -54398,7 +54649,7 @@ async def test_list_subproperty_event_filters_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( @@ -54423,11 +54674,6 @@ async def test_list_subproperty_event_filters_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_subproperty_event_filters_async_from_dict(): - await test_list_subproperty_event_filters_async(request_type=dict) - - def test_list_subproperty_event_filters_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -54790,8 +55036,8 @@ async def test_list_subproperty_event_filters_async_pages(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdateSubpropertyEventFilterRequest, - dict, + analytics_admin.UpdateSubpropertyEventFilterRequest(), + {}, ], ) def test_update_subproperty_event_filter(request_type, transport: str = "grpc"): @@ -54802,7 +55048,7 @@ def test_update_subproperty_event_filter(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -54850,7 +55096,8 @@ def test_update_subproperty_event_filter_non_empty_request_with_auto_populated_f client.update_subproperty_event_filter(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateSubpropertyEventFilterRequest() + request_msg = analytics_admin.UpdateSubpropertyEventFilterRequest() + assert args[0] == request_msg def test_update_subproperty_event_filter_use_cached_wrapped_rpc(): @@ -54936,9 +55183,15 @@ async def test_update_subproperty_event_filter_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.UpdateSubpropertyEventFilterRequest(), + {}, + ], +) async def test_update_subproperty_event_filter_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.UpdateSubpropertyEventFilterRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -54947,7 +55200,7 @@ async def test_update_subproperty_event_filter_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( @@ -54974,11 +55227,6 @@ async def test_update_subproperty_event_filter_async( assert response.apply_to_property == "apply_to_property_value" -@pytest.mark.asyncio -async def test_update_subproperty_event_filter_async_from_dict(): - await test_update_subproperty_event_filter_async(request_type=dict) - - def test_update_subproperty_event_filter_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -55155,8 +55403,8 @@ async def test_update_subproperty_event_filter_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.DeleteSubpropertyEventFilterRequest, - dict, + analytics_admin.DeleteSubpropertyEventFilterRequest(), + {}, ], ) def test_delete_subproperty_event_filter(request_type, transport: str = "grpc"): @@ -55167,7 +55415,7 @@ def test_delete_subproperty_event_filter(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -55212,9 +55460,10 @@ def test_delete_subproperty_event_filter_non_empty_request_with_auto_populated_f client.delete_subproperty_event_filter(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.DeleteSubpropertyEventFilterRequest( + request_msg = analytics_admin.DeleteSubpropertyEventFilterRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_subproperty_event_filter_use_cached_wrapped_rpc(): @@ -55300,9 +55549,15 @@ async def test_delete_subproperty_event_filter_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.DeleteSubpropertyEventFilterRequest(), + {}, + ], +) async def test_delete_subproperty_event_filter_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.DeleteSubpropertyEventFilterRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -55311,7 +55566,7 @@ async def test_delete_subproperty_event_filter_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( @@ -55331,11 +55586,6 @@ async def test_delete_subproperty_event_filter_async( assert response is None -@pytest.mark.asyncio -async def test_delete_subproperty_event_filter_async_from_dict(): - await test_delete_subproperty_event_filter_async(request_type=dict) - - def test_delete_subproperty_event_filter_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -55486,8 +55736,8 @@ async def test_delete_subproperty_event_filter_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.CreateReportingDataAnnotationRequest, - dict, + analytics_admin.CreateReportingDataAnnotationRequest(), + {}, ], ) def test_create_reporting_data_annotation(request_type, transport: str = "grpc"): @@ -55498,7 +55748,7 @@ def test_create_reporting_data_annotation(request_type, transport: str = "grpc") # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -55554,9 +55804,10 @@ def test_create_reporting_data_annotation_non_empty_request_with_auto_populated_ client.create_reporting_data_annotation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateReportingDataAnnotationRequest( + request_msg = analytics_admin.CreateReportingDataAnnotationRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_reporting_data_annotation_use_cached_wrapped_rpc(): @@ -55642,9 +55893,15 @@ async def test_create_reporting_data_annotation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.CreateReportingDataAnnotationRequest(), + {}, + ], +) async def test_create_reporting_data_annotation_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.CreateReportingDataAnnotationRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -55653,7 +55910,7 @@ async def test_create_reporting_data_annotation_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( @@ -55686,11 +55943,6 @@ async def test_create_reporting_data_annotation_async( assert response.system_generated is True -@pytest.mark.asyncio -async def test_create_reporting_data_annotation_async_from_dict(): - await test_create_reporting_data_annotation_async(request_type=dict) - - def test_create_reporting_data_annotation_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -55867,8 +56119,8 @@ async def test_create_reporting_data_annotation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetReportingDataAnnotationRequest, - dict, + analytics_admin.GetReportingDataAnnotationRequest(), + {}, ], ) def test_get_reporting_data_annotation(request_type, transport: str = "grpc"): @@ -55879,7 +56131,7 @@ def test_get_reporting_data_annotation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -55935,9 +56187,10 @@ def test_get_reporting_data_annotation_non_empty_request_with_auto_populated_fie client.get_reporting_data_annotation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetReportingDataAnnotationRequest( + request_msg = analytics_admin.GetReportingDataAnnotationRequest( name="name_value", ) + assert args[0] == request_msg def test_get_reporting_data_annotation_use_cached_wrapped_rpc(): @@ -56023,9 +56276,15 @@ async def test_get_reporting_data_annotation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.GetReportingDataAnnotationRequest(), + {}, + ], +) async def test_get_reporting_data_annotation_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.GetReportingDataAnnotationRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -56034,7 +56293,7 @@ async def test_get_reporting_data_annotation_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( @@ -56067,11 +56326,6 @@ async def test_get_reporting_data_annotation_async( assert response.system_generated is True -@pytest.mark.asyncio -async def test_get_reporting_data_annotation_async_from_dict(): - await test_get_reporting_data_annotation_async(request_type=dict) - - def test_get_reporting_data_annotation_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -56226,8 +56480,8 @@ async def test_get_reporting_data_annotation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListReportingDataAnnotationsRequest, - dict, + analytics_admin.ListReportingDataAnnotationsRequest(), + {}, ], ) def test_list_reporting_data_annotations(request_type, transport: str = "grpc"): @@ -56238,7 +56492,7 @@ def test_list_reporting_data_annotations(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -56288,11 +56542,12 @@ def test_list_reporting_data_annotations_non_empty_request_with_auto_populated_f client.list_reporting_data_annotations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListReportingDataAnnotationsRequest( + request_msg = analytics_admin.ListReportingDataAnnotationsRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_reporting_data_annotations_use_cached_wrapped_rpc(): @@ -56378,9 +56633,15 @@ async def test_list_reporting_data_annotations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.ListReportingDataAnnotationsRequest(), + {}, + ], +) async def test_list_reporting_data_annotations_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.ListReportingDataAnnotationsRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -56389,7 +56650,7 @@ async def test_list_reporting_data_annotations_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( @@ -56414,11 +56675,6 @@ async def test_list_reporting_data_annotations_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_reporting_data_annotations_async_from_dict(): - await test_list_reporting_data_annotations_async(request_type=dict) - - def test_list_reporting_data_annotations_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -56775,8 +57031,8 @@ async def test_list_reporting_data_annotations_async_pages(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdateReportingDataAnnotationRequest, - dict, + analytics_admin.UpdateReportingDataAnnotationRequest(), + {}, ], ) def test_update_reporting_data_annotation(request_type, transport: str = "grpc"): @@ -56787,7 +57043,7 @@ def test_update_reporting_data_annotation(request_type, transport: str = "grpc") # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -56841,7 +57097,8 @@ def test_update_reporting_data_annotation_non_empty_request_with_auto_populated_ client.update_reporting_data_annotation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateReportingDataAnnotationRequest() + request_msg = analytics_admin.UpdateReportingDataAnnotationRequest() + assert args[0] == request_msg def test_update_reporting_data_annotation_use_cached_wrapped_rpc(): @@ -56927,9 +57184,15 @@ async def test_update_reporting_data_annotation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.UpdateReportingDataAnnotationRequest(), + {}, + ], +) async def test_update_reporting_data_annotation_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.UpdateReportingDataAnnotationRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -56938,7 +57201,7 @@ async def test_update_reporting_data_annotation_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( @@ -56971,11 +57234,6 @@ async def test_update_reporting_data_annotation_async( assert response.system_generated is True -@pytest.mark.asyncio -async def test_update_reporting_data_annotation_async_from_dict(): - await test_update_reporting_data_annotation_async(request_type=dict) - - def test_update_reporting_data_annotation_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -57152,8 +57410,8 @@ async def test_update_reporting_data_annotation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.DeleteReportingDataAnnotationRequest, - dict, + analytics_admin.DeleteReportingDataAnnotationRequest(), + {}, ], ) def test_delete_reporting_data_annotation(request_type, transport: str = "grpc"): @@ -57164,7 +57422,7 @@ def test_delete_reporting_data_annotation(request_type, transport: str = "grpc") # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -57209,9 +57467,10 @@ def test_delete_reporting_data_annotation_non_empty_request_with_auto_populated_ client.delete_reporting_data_annotation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.DeleteReportingDataAnnotationRequest( + request_msg = analytics_admin.DeleteReportingDataAnnotationRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_reporting_data_annotation_use_cached_wrapped_rpc(): @@ -57297,9 +57556,15 @@ async def test_delete_reporting_data_annotation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.DeleteReportingDataAnnotationRequest(), + {}, + ], +) async def test_delete_reporting_data_annotation_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.DeleteReportingDataAnnotationRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -57308,7 +57573,7 @@ async def test_delete_reporting_data_annotation_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( @@ -57328,11 +57593,6 @@ async def test_delete_reporting_data_annotation_async( assert response is None -@pytest.mark.asyncio -async def test_delete_reporting_data_annotation_async_from_dict(): - await test_delete_reporting_data_annotation_async(request_type=dict) - - def test_delete_reporting_data_annotation_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -57483,8 +57743,8 @@ async def test_delete_reporting_data_annotation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.SubmitUserDeletionRequest, - dict, + analytics_admin.SubmitUserDeletionRequest(), + {}, ], ) def test_submit_user_deletion(request_type, transport: str = "grpc"): @@ -57495,7 +57755,7 @@ def test_submit_user_deletion(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -57544,13 +57804,14 @@ def test_submit_user_deletion_non_empty_request_with_auto_populated_field(): client.submit_user_deletion(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.SubmitUserDeletionRequest( + request_msg = analytics_admin.SubmitUserDeletionRequest( user_id="user_id_value", client_id="client_id_value", app_instance_id="app_instance_id_value", user_provided_data="user_provided_data_value", name="name_value", ) + assert args[0] == request_msg def test_submit_user_deletion_use_cached_wrapped_rpc(): @@ -57635,9 +57896,15 @@ async def test_submit_user_deletion_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.SubmitUserDeletionRequest(), + {}, + ], +) async def test_submit_user_deletion_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.SubmitUserDeletionRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -57646,7 +57913,7 @@ async def test_submit_user_deletion_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( @@ -57668,11 +57935,6 @@ async def test_submit_user_deletion_async( assert isinstance(response, analytics_admin.SubmitUserDeletionResponse) -@pytest.mark.asyncio -async def test_submit_user_deletion_async_from_dict(): - await test_submit_user_deletion_async(request_type=dict) - - def test_submit_user_deletion_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -57827,8 +58089,8 @@ async def test_submit_user_deletion_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListSubpropertySyncConfigsRequest, - dict, + analytics_admin.ListSubpropertySyncConfigsRequest(), + {}, ], ) def test_list_subproperty_sync_configs(request_type, transport: str = "grpc"): @@ -57839,7 +58101,7 @@ def test_list_subproperty_sync_configs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -57888,10 +58150,11 @@ def test_list_subproperty_sync_configs_non_empty_request_with_auto_populated_fie client.list_subproperty_sync_configs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListSubpropertySyncConfigsRequest( + request_msg = analytics_admin.ListSubpropertySyncConfigsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_subproperty_sync_configs_use_cached_wrapped_rpc(): @@ -57977,9 +58240,15 @@ async def test_list_subproperty_sync_configs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.ListSubpropertySyncConfigsRequest(), + {}, + ], +) async def test_list_subproperty_sync_configs_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.ListSubpropertySyncConfigsRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -57988,7 +58257,7 @@ async def test_list_subproperty_sync_configs_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( @@ -58013,11 +58282,6 @@ async def test_list_subproperty_sync_configs_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_subproperty_sync_configs_async_from_dict(): - await test_list_subproperty_sync_configs_async(request_type=dict) - - def test_list_subproperty_sync_configs_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -58374,8 +58638,8 @@ async def test_list_subproperty_sync_configs_async_pages(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdateSubpropertySyncConfigRequest, - dict, + analytics_admin.UpdateSubpropertySyncConfigRequest(), + {}, ], ) def test_update_subproperty_sync_config(request_type, transport: str = "grpc"): @@ -58386,7 +58650,7 @@ def test_update_subproperty_sync_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( @@ -58439,7 +58703,8 @@ def test_update_subproperty_sync_config_non_empty_request_with_auto_populated_fi client.update_subproperty_sync_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateSubpropertySyncConfigRequest() + request_msg = analytics_admin.UpdateSubpropertySyncConfigRequest() + assert args[0] == request_msg def test_update_subproperty_sync_config_use_cached_wrapped_rpc(): @@ -58525,9 +58790,15 @@ async def test_update_subproperty_sync_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.UpdateSubpropertySyncConfigRequest(), + {}, + ], +) async def test_update_subproperty_sync_config_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.UpdateSubpropertySyncConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -58536,7 +58807,7 @@ async def test_update_subproperty_sync_config_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( @@ -58568,11 +58839,6 @@ async def test_update_subproperty_sync_config_async( ) -@pytest.mark.asyncio -async def test_update_subproperty_sync_config_async_from_dict(): - await test_update_subproperty_sync_config_async(request_type=dict) - - def test_update_subproperty_sync_config_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -58737,8 +59003,8 @@ async def test_update_subproperty_sync_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetSubpropertySyncConfigRequest, - dict, + analytics_admin.GetSubpropertySyncConfigRequest(), + {}, ], ) def test_get_subproperty_sync_config(request_type, transport: str = "grpc"): @@ -58749,7 +59015,7 @@ def test_get_subproperty_sync_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( @@ -58804,9 +59070,10 @@ def test_get_subproperty_sync_config_non_empty_request_with_auto_populated_field client.get_subproperty_sync_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetSubpropertySyncConfigRequest( + request_msg = analytics_admin.GetSubpropertySyncConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_subproperty_sync_config_use_cached_wrapped_rpc(): @@ -58892,9 +59159,15 @@ async def test_get_subproperty_sync_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.GetSubpropertySyncConfigRequest(), + {}, + ], +) async def test_get_subproperty_sync_config_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.GetSubpropertySyncConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -58903,7 +59176,7 @@ async def test_get_subproperty_sync_config_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( @@ -58935,11 +59208,6 @@ async def test_get_subproperty_sync_config_async( ) -@pytest.mark.asyncio -async def test_get_subproperty_sync_config_async_from_dict(): - await test_get_subproperty_sync_config_async(request_type=dict) - - def test_get_subproperty_sync_config_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -59094,8 +59362,8 @@ async def test_get_subproperty_sync_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetReportingIdentitySettingsRequest, - dict, + analytics_admin.GetReportingIdentitySettingsRequest(), + {}, ], ) def test_get_reporting_identity_settings(request_type, transport: str = "grpc"): @@ -59106,7 +59374,7 @@ def test_get_reporting_identity_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( @@ -59159,9 +59427,10 @@ def test_get_reporting_identity_settings_non_empty_request_with_auto_populated_f client.get_reporting_identity_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetReportingIdentitySettingsRequest( + request_msg = analytics_admin.GetReportingIdentitySettingsRequest( name="name_value", ) + assert args[0] == request_msg def test_get_reporting_identity_settings_use_cached_wrapped_rpc(): @@ -59247,9 +59516,15 @@ async def test_get_reporting_identity_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.GetReportingIdentitySettingsRequest(), + {}, + ], +) async def test_get_reporting_identity_settings_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.GetReportingIdentitySettingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -59258,7 +59533,7 @@ async def test_get_reporting_identity_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( @@ -59288,11 +59563,6 @@ async def test_get_reporting_identity_settings_async( ) -@pytest.mark.asyncio -async def test_get_reporting_identity_settings_async_from_dict(): - await test_get_reporting_identity_settings_async(request_type=dict) - - def test_get_reporting_identity_settings_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -59447,8 +59717,8 @@ async def test_get_reporting_identity_settings_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetUserProvidedDataSettingsRequest, - dict, + analytics_admin.GetUserProvidedDataSettingsRequest(), + {}, ], ) def test_get_user_provided_data_settings(request_type, transport: str = "grpc"): @@ -59459,7 +59729,7 @@ def test_get_user_provided_data_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( @@ -59511,9 +59781,10 @@ def test_get_user_provided_data_settings_non_empty_request_with_auto_populated_f client.get_user_provided_data_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetUserProvidedDataSettingsRequest( + request_msg = analytics_admin.GetUserProvidedDataSettingsRequest( name="name_value", ) + assert args[0] == request_msg def test_get_user_provided_data_settings_use_cached_wrapped_rpc(): @@ -59599,9 +59870,15 @@ async def test_get_user_provided_data_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.GetUserProvidedDataSettingsRequest(), + {}, + ], +) async def test_get_user_provided_data_settings_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.GetUserProvidedDataSettingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -59610,7 +59887,7 @@ async def test_get_user_provided_data_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( @@ -59639,11 +59916,6 @@ async def test_get_user_provided_data_settings_async( assert response.automatically_detected_data_collection_enabled is True -@pytest.mark.asyncio -async def test_get_user_provided_data_settings_async_from_dict(): - await test_get_user_provided_data_settings_async(request_type=dict) - - def test_get_user_provided_data_settings_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -89887,7 +90159,6 @@ def test_get_account_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetAccountRequest() - assert args[0] == request_msg @@ -89908,7 +90179,6 @@ def test_list_accounts_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListAccountsRequest() - assert args[0] == request_msg @@ -89929,7 +90199,6 @@ def test_delete_account_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteAccountRequest() - assert args[0] == request_msg @@ -89950,7 +90219,6 @@ def test_update_account_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateAccountRequest() - assert args[0] == request_msg @@ -89973,7 +90241,6 @@ def test_provision_account_ticket_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ProvisionAccountTicketRequest() - assert args[0] == request_msg @@ -89996,7 +90263,6 @@ def test_list_account_summaries_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListAccountSummariesRequest() - assert args[0] == request_msg @@ -90017,7 +90283,6 @@ def test_get_property_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetPropertyRequest() - assert args[0] == request_msg @@ -90038,7 +90303,6 @@ def test_list_properties_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListPropertiesRequest() - assert args[0] == request_msg @@ -90059,7 +90323,6 @@ def test_create_property_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreatePropertyRequest() - assert args[0] == request_msg @@ -90080,7 +90343,6 @@ def test_delete_property_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeletePropertyRequest() - assert args[0] == request_msg @@ -90101,7 +90363,6 @@ def test_update_property_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdatePropertyRequest() - assert args[0] == request_msg @@ -90124,7 +90385,6 @@ def test_create_firebase_link_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateFirebaseLinkRequest() - assert args[0] == request_msg @@ -90147,7 +90407,6 @@ def test_delete_firebase_link_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteFirebaseLinkRequest() - assert args[0] == request_msg @@ -90170,7 +90429,6 @@ def test_list_firebase_links_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListFirebaseLinksRequest() - assert args[0] == request_msg @@ -90193,7 +90451,6 @@ def test_get_global_site_tag_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetGlobalSiteTagRequest() - assert args[0] == request_msg @@ -90216,7 +90473,6 @@ def test_create_google_ads_link_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateGoogleAdsLinkRequest() - assert args[0] == request_msg @@ -90239,7 +90495,6 @@ def test_update_google_ads_link_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateGoogleAdsLinkRequest() - assert args[0] == request_msg @@ -90262,7 +90517,6 @@ def test_delete_google_ads_link_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteGoogleAdsLinkRequest() - assert args[0] == request_msg @@ -90285,7 +90539,6 @@ def test_list_google_ads_links_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListGoogleAdsLinksRequest() - assert args[0] == request_msg @@ -90308,7 +90561,6 @@ def test_get_data_sharing_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetDataSharingSettingsRequest() - assert args[0] == request_msg @@ -90331,7 +90583,6 @@ def test_get_measurement_protocol_secret_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetMeasurementProtocolSecretRequest() - assert args[0] == request_msg @@ -90354,7 +90605,6 @@ def test_list_measurement_protocol_secrets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListMeasurementProtocolSecretsRequest() - assert args[0] == request_msg @@ -90377,7 +90627,6 @@ def test_create_measurement_protocol_secret_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateMeasurementProtocolSecretRequest() - assert args[0] == request_msg @@ -90400,7 +90649,6 @@ def test_delete_measurement_protocol_secret_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteMeasurementProtocolSecretRequest() - assert args[0] == request_msg @@ -90423,7 +90671,6 @@ def test_update_measurement_protocol_secret_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateMeasurementProtocolSecretRequest() - assert args[0] == request_msg @@ -90446,7 +90693,6 @@ def test_acknowledge_user_data_collection_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.AcknowledgeUserDataCollectionRequest() - assert args[0] == request_msg @@ -90469,7 +90715,6 @@ def test_get_sk_ad_network_conversion_value_schema_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetSKAdNetworkConversionValueSchemaRequest() - assert args[0] == request_msg @@ -90492,7 +90737,6 @@ def test_create_sk_ad_network_conversion_value_schema_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateSKAdNetworkConversionValueSchemaRequest() - assert args[0] == request_msg @@ -90515,7 +90759,6 @@ def test_delete_sk_ad_network_conversion_value_schema_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteSKAdNetworkConversionValueSchemaRequest() - assert args[0] == request_msg @@ -90538,7 +90781,6 @@ def test_update_sk_ad_network_conversion_value_schema_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateSKAdNetworkConversionValueSchemaRequest() - assert args[0] == request_msg @@ -90563,7 +90805,6 @@ def test_list_sk_ad_network_conversion_value_schemas_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListSKAdNetworkConversionValueSchemasRequest() - assert args[0] == request_msg @@ -90586,7 +90827,6 @@ def test_search_change_history_events_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.SearchChangeHistoryEventsRequest() - assert args[0] == request_msg @@ -90609,7 +90849,6 @@ def test_get_google_signals_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetGoogleSignalsSettingsRequest() - assert args[0] == request_msg @@ -90632,7 +90871,6 @@ def test_update_google_signals_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateGoogleSignalsSettingsRequest() - assert args[0] == request_msg @@ -90655,7 +90893,6 @@ def test_create_conversion_event_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateConversionEventRequest() - assert args[0] == request_msg @@ -90678,7 +90915,6 @@ def test_update_conversion_event_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateConversionEventRequest() - assert args[0] == request_msg @@ -90701,7 +90937,6 @@ def test_get_conversion_event_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetConversionEventRequest() - assert args[0] == request_msg @@ -90724,7 +90959,6 @@ def test_delete_conversion_event_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteConversionEventRequest() - assert args[0] == request_msg @@ -90747,7 +90981,6 @@ def test_list_conversion_events_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListConversionEventsRequest() - assert args[0] == request_msg @@ -90768,7 +91001,6 @@ def test_create_key_event_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateKeyEventRequest() - assert args[0] == request_msg @@ -90789,7 +91021,6 @@ def test_update_key_event_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateKeyEventRequest() - assert args[0] == request_msg @@ -90810,7 +91041,6 @@ def test_get_key_event_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetKeyEventRequest() - assert args[0] == request_msg @@ -90831,7 +91061,6 @@ def test_delete_key_event_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteKeyEventRequest() - assert args[0] == request_msg @@ -90852,7 +91081,6 @@ def test_list_key_events_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListKeyEventsRequest() - assert args[0] == request_msg @@ -90875,7 +91103,6 @@ def test_get_display_video360_advertiser_link_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetDisplayVideo360AdvertiserLinkRequest() - assert args[0] == request_msg @@ -90898,7 +91125,6 @@ def test_list_display_video360_advertiser_links_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListDisplayVideo360AdvertiserLinksRequest() - assert args[0] == request_msg @@ -90921,7 +91147,6 @@ def test_create_display_video360_advertiser_link_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest() - assert args[0] == request_msg @@ -90944,7 +91169,6 @@ def test_delete_display_video360_advertiser_link_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest() - assert args[0] == request_msg @@ -90967,7 +91191,6 @@ def test_update_display_video360_advertiser_link_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest() - assert args[0] == request_msg @@ -90990,7 +91213,6 @@ def test_get_display_video360_advertiser_link_proposal_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest() - assert args[0] == request_msg @@ -91018,7 +91240,6 @@ def test_list_display_video360_advertiser_link_proposals_empty_call_grpc(): request_msg = ( analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest() ) - assert args[0] == request_msg @@ -91044,7 +91265,6 @@ def test_create_display_video360_advertiser_link_proposal_empty_call_grpc(): request_msg = ( analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest() ) - assert args[0] == request_msg @@ -91070,7 +91290,6 @@ def test_delete_display_video360_advertiser_link_proposal_empty_call_grpc(): request_msg = ( analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest() ) - assert args[0] == request_msg @@ -91098,7 +91317,6 @@ def test_approve_display_video360_advertiser_link_proposal_empty_call_grpc(): request_msg = ( analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalRequest() ) - assert args[0] == request_msg @@ -91124,7 +91342,6 @@ def test_cancel_display_video360_advertiser_link_proposal_empty_call_grpc(): request_msg = ( analytics_admin.CancelDisplayVideo360AdvertiserLinkProposalRequest() ) - assert args[0] == request_msg @@ -91147,7 +91364,6 @@ def test_create_custom_dimension_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateCustomDimensionRequest() - assert args[0] == request_msg @@ -91170,7 +91386,6 @@ def test_update_custom_dimension_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateCustomDimensionRequest() - assert args[0] == request_msg @@ -91193,7 +91408,6 @@ def test_list_custom_dimensions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListCustomDimensionsRequest() - assert args[0] == request_msg @@ -91216,7 +91430,6 @@ def test_archive_custom_dimension_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ArchiveCustomDimensionRequest() - assert args[0] == request_msg @@ -91239,7 +91452,6 @@ def test_get_custom_dimension_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetCustomDimensionRequest() - assert args[0] == request_msg @@ -91262,7 +91474,6 @@ def test_create_custom_metric_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateCustomMetricRequest() - assert args[0] == request_msg @@ -91285,7 +91496,6 @@ def test_update_custom_metric_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateCustomMetricRequest() - assert args[0] == request_msg @@ -91308,7 +91518,6 @@ def test_list_custom_metrics_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListCustomMetricsRequest() - assert args[0] == request_msg @@ -91331,7 +91540,6 @@ def test_archive_custom_metric_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ArchiveCustomMetricRequest() - assert args[0] == request_msg @@ -91354,7 +91562,6 @@ def test_get_custom_metric_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetCustomMetricRequest() - assert args[0] == request_msg @@ -91377,7 +91584,6 @@ def test_get_data_retention_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetDataRetentionSettingsRequest() - assert args[0] == request_msg @@ -91400,7 +91606,6 @@ def test_update_data_retention_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateDataRetentionSettingsRequest() - assert args[0] == request_msg @@ -91423,7 +91628,6 @@ def test_create_data_stream_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateDataStreamRequest() - assert args[0] == request_msg @@ -91446,7 +91650,6 @@ def test_delete_data_stream_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteDataStreamRequest() - assert args[0] == request_msg @@ -91469,7 +91672,6 @@ def test_update_data_stream_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateDataStreamRequest() - assert args[0] == request_msg @@ -91492,7 +91694,6 @@ def test_list_data_streams_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListDataStreamsRequest() - assert args[0] == request_msg @@ -91513,7 +91714,6 @@ def test_get_data_stream_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetDataStreamRequest() - assert args[0] == request_msg @@ -91534,7 +91734,6 @@ def test_get_audience_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetAudienceRequest() - assert args[0] == request_msg @@ -91555,7 +91754,6 @@ def test_list_audiences_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListAudiencesRequest() - assert args[0] == request_msg @@ -91576,7 +91774,6 @@ def test_create_audience_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateAudienceRequest() - assert args[0] == request_msg @@ -91597,7 +91794,6 @@ def test_update_audience_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateAudienceRequest() - assert args[0] == request_msg @@ -91618,7 +91814,6 @@ def test_archive_audience_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ArchiveAudienceRequest() - assert args[0] == request_msg @@ -91641,7 +91836,6 @@ def test_get_search_ads360_link_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetSearchAds360LinkRequest() - assert args[0] == request_msg @@ -91664,7 +91858,6 @@ def test_list_search_ads360_links_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListSearchAds360LinksRequest() - assert args[0] == request_msg @@ -91687,7 +91880,6 @@ def test_create_search_ads360_link_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateSearchAds360LinkRequest() - assert args[0] == request_msg @@ -91710,7 +91902,6 @@ def test_delete_search_ads360_link_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteSearchAds360LinkRequest() - assert args[0] == request_msg @@ -91733,7 +91924,6 @@ def test_update_search_ads360_link_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateSearchAds360LinkRequest() - assert args[0] == request_msg @@ -91756,7 +91946,6 @@ def test_get_attribution_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetAttributionSettingsRequest() - assert args[0] == request_msg @@ -91779,7 +91968,6 @@ def test_update_attribution_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateAttributionSettingsRequest() - assert args[0] == request_msg @@ -91802,7 +91990,6 @@ def test_run_access_report_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.RunAccessReportRequest() - assert args[0] == request_msg @@ -91825,7 +92012,6 @@ def test_create_access_binding_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateAccessBindingRequest() - assert args[0] == request_msg @@ -91848,7 +92034,6 @@ def test_get_access_binding_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetAccessBindingRequest() - assert args[0] == request_msg @@ -91871,7 +92056,6 @@ def test_update_access_binding_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateAccessBindingRequest() - assert args[0] == request_msg @@ -91894,7 +92078,6 @@ def test_delete_access_binding_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteAccessBindingRequest() - assert args[0] == request_msg @@ -91917,7 +92100,6 @@ def test_list_access_bindings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListAccessBindingsRequest() - assert args[0] == request_msg @@ -91940,7 +92122,6 @@ def test_batch_create_access_bindings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.BatchCreateAccessBindingsRequest() - assert args[0] == request_msg @@ -91963,7 +92144,6 @@ def test_batch_get_access_bindings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.BatchGetAccessBindingsRequest() - assert args[0] == request_msg @@ -91986,7 +92166,6 @@ def test_batch_update_access_bindings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.BatchUpdateAccessBindingsRequest() - assert args[0] == request_msg @@ -92009,7 +92188,6 @@ def test_batch_delete_access_bindings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.BatchDeleteAccessBindingsRequest() - assert args[0] == request_msg @@ -92032,7 +92210,6 @@ def test_get_expanded_data_set_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetExpandedDataSetRequest() - assert args[0] == request_msg @@ -92055,7 +92232,6 @@ def test_list_expanded_data_sets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListExpandedDataSetsRequest() - assert args[0] == request_msg @@ -92078,7 +92254,6 @@ def test_create_expanded_data_set_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateExpandedDataSetRequest() - assert args[0] == request_msg @@ -92101,7 +92276,6 @@ def test_update_expanded_data_set_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateExpandedDataSetRequest() - assert args[0] == request_msg @@ -92124,7 +92298,6 @@ def test_delete_expanded_data_set_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteExpandedDataSetRequest() - assert args[0] == request_msg @@ -92147,7 +92320,6 @@ def test_get_channel_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetChannelGroupRequest() - assert args[0] == request_msg @@ -92170,7 +92342,6 @@ def test_list_channel_groups_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListChannelGroupsRequest() - assert args[0] == request_msg @@ -92193,7 +92364,6 @@ def test_create_channel_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateChannelGroupRequest() - assert args[0] == request_msg @@ -92216,7 +92386,6 @@ def test_update_channel_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateChannelGroupRequest() - assert args[0] == request_msg @@ -92239,7 +92408,6 @@ def test_delete_channel_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteChannelGroupRequest() - assert args[0] == request_msg @@ -92262,7 +92430,6 @@ def test_create_big_query_link_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateBigQueryLinkRequest() - assert args[0] == request_msg @@ -92285,7 +92452,6 @@ def test_get_big_query_link_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetBigQueryLinkRequest() - assert args[0] == request_msg @@ -92308,7 +92474,6 @@ def test_list_big_query_links_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListBigQueryLinksRequest() - assert args[0] == request_msg @@ -92331,7 +92496,6 @@ def test_delete_big_query_link_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteBigQueryLinkRequest() - assert args[0] == request_msg @@ -92354,7 +92518,6 @@ def test_update_big_query_link_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateBigQueryLinkRequest() - assert args[0] == request_msg @@ -92377,7 +92540,6 @@ def test_get_enhanced_measurement_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetEnhancedMeasurementSettingsRequest() - assert args[0] == request_msg @@ -92400,7 +92562,6 @@ def test_update_enhanced_measurement_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateEnhancedMeasurementSettingsRequest() - assert args[0] == request_msg @@ -92423,7 +92584,6 @@ def test_get_ad_sense_link_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetAdSenseLinkRequest() - assert args[0] == request_msg @@ -92446,7 +92606,6 @@ def test_create_ad_sense_link_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateAdSenseLinkRequest() - assert args[0] == request_msg @@ -92469,7 +92628,6 @@ def test_delete_ad_sense_link_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteAdSenseLinkRequest() - assert args[0] == request_msg @@ -92492,7 +92650,6 @@ def test_list_ad_sense_links_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListAdSenseLinksRequest() - assert args[0] == request_msg @@ -92515,7 +92672,6 @@ def test_get_event_create_rule_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetEventCreateRuleRequest() - assert args[0] == request_msg @@ -92538,7 +92694,6 @@ def test_list_event_create_rules_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListEventCreateRulesRequest() - assert args[0] == request_msg @@ -92561,7 +92716,6 @@ def test_create_event_create_rule_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateEventCreateRuleRequest() - assert args[0] == request_msg @@ -92584,7 +92738,6 @@ def test_update_event_create_rule_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateEventCreateRuleRequest() - assert args[0] == request_msg @@ -92607,7 +92760,6 @@ def test_delete_event_create_rule_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteEventCreateRuleRequest() - assert args[0] == request_msg @@ -92630,7 +92782,6 @@ def test_get_event_edit_rule_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetEventEditRuleRequest() - assert args[0] == request_msg @@ -92653,7 +92804,6 @@ def test_list_event_edit_rules_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListEventEditRulesRequest() - assert args[0] == request_msg @@ -92676,7 +92826,6 @@ def test_create_event_edit_rule_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateEventEditRuleRequest() - assert args[0] == request_msg @@ -92699,7 +92848,6 @@ def test_update_event_edit_rule_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateEventEditRuleRequest() - assert args[0] == request_msg @@ -92722,7 +92870,6 @@ def test_delete_event_edit_rule_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteEventEditRuleRequest() - assert args[0] == request_msg @@ -92745,7 +92892,6 @@ def test_reorder_event_edit_rules_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ReorderEventEditRulesRequest() - assert args[0] == request_msg @@ -92768,7 +92914,6 @@ def test_update_data_redaction_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateDataRedactionSettingsRequest() - assert args[0] == request_msg @@ -92791,7 +92936,6 @@ def test_get_data_redaction_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetDataRedactionSettingsRequest() - assert args[0] == request_msg @@ -92814,7 +92958,6 @@ def test_get_calculated_metric_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetCalculatedMetricRequest() - assert args[0] == request_msg @@ -92837,7 +92980,6 @@ def test_create_calculated_metric_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateCalculatedMetricRequest() - assert args[0] == request_msg @@ -92860,7 +93002,6 @@ def test_list_calculated_metrics_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListCalculatedMetricsRequest() - assert args[0] == request_msg @@ -92883,7 +93024,6 @@ def test_update_calculated_metric_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateCalculatedMetricRequest() - assert args[0] == request_msg @@ -92906,7 +93046,6 @@ def test_delete_calculated_metric_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteCalculatedMetricRequest() - assert args[0] == request_msg @@ -92929,7 +93068,6 @@ def test_create_rollup_property_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateRollupPropertyRequest() - assert args[0] == request_msg @@ -92952,7 +93090,6 @@ def test_get_rollup_property_source_link_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetRollupPropertySourceLinkRequest() - assert args[0] == request_msg @@ -92975,7 +93112,6 @@ def test_list_rollup_property_source_links_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListRollupPropertySourceLinksRequest() - assert args[0] == request_msg @@ -92998,7 +93134,6 @@ def test_create_rollup_property_source_link_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateRollupPropertySourceLinkRequest() - assert args[0] == request_msg @@ -93021,7 +93156,6 @@ def test_delete_rollup_property_source_link_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteRollupPropertySourceLinkRequest() - assert args[0] == request_msg @@ -93044,7 +93178,6 @@ def test_provision_subproperty_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ProvisionSubpropertyRequest() - assert args[0] == request_msg @@ -93067,7 +93200,6 @@ def test_create_subproperty_event_filter_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateSubpropertyEventFilterRequest() - assert args[0] == request_msg @@ -93090,7 +93222,6 @@ def test_get_subproperty_event_filter_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetSubpropertyEventFilterRequest() - assert args[0] == request_msg @@ -93113,7 +93244,6 @@ def test_list_subproperty_event_filters_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListSubpropertyEventFiltersRequest() - assert args[0] == request_msg @@ -93136,7 +93266,6 @@ def test_update_subproperty_event_filter_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateSubpropertyEventFilterRequest() - assert args[0] == request_msg @@ -93159,7 +93288,6 @@ def test_delete_subproperty_event_filter_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteSubpropertyEventFilterRequest() - assert args[0] == request_msg @@ -93182,7 +93310,6 @@ def test_create_reporting_data_annotation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateReportingDataAnnotationRequest() - assert args[0] == request_msg @@ -93205,7 +93332,6 @@ def test_get_reporting_data_annotation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetReportingDataAnnotationRequest() - assert args[0] == request_msg @@ -93228,7 +93354,6 @@ def test_list_reporting_data_annotations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListReportingDataAnnotationsRequest() - assert args[0] == request_msg @@ -93251,7 +93376,6 @@ def test_update_reporting_data_annotation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateReportingDataAnnotationRequest() - assert args[0] == request_msg @@ -93274,7 +93398,6 @@ def test_delete_reporting_data_annotation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteReportingDataAnnotationRequest() - assert args[0] == request_msg @@ -93297,7 +93420,6 @@ def test_submit_user_deletion_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.SubmitUserDeletionRequest() - assert args[0] == request_msg @@ -93320,7 +93442,6 @@ def test_list_subproperty_sync_configs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListSubpropertySyncConfigsRequest() - assert args[0] == request_msg @@ -93343,7 +93464,6 @@ def test_update_subproperty_sync_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateSubpropertySyncConfigRequest() - assert args[0] == request_msg @@ -93366,7 +93486,6 @@ def test_get_subproperty_sync_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetSubpropertySyncConfigRequest() - assert args[0] == request_msg @@ -93389,7 +93508,6 @@ def test_get_reporting_identity_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetReportingIdentitySettingsRequest() - assert args[0] == request_msg @@ -93412,7 +93530,6 @@ def test_get_user_provided_data_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetUserProvidedDataSettingsRequest() - assert args[0] == request_msg @@ -93457,7 +93574,6 @@ async def test_get_account_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetAccountRequest() - assert args[0] == request_msg @@ -93484,7 +93600,6 @@ async def test_list_accounts_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListAccountsRequest() - assert args[0] == request_msg @@ -93507,7 +93622,6 @@ async def test_delete_account_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteAccountRequest() - assert args[0] == request_msg @@ -93538,7 +93652,6 @@ async def test_update_account_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateAccountRequest() - assert args[0] == request_msg @@ -93567,7 +93680,6 @@ async def test_provision_account_ticket_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ProvisionAccountTicketRequest() - assert args[0] == request_msg @@ -93596,7 +93708,6 @@ async def test_list_account_summaries_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListAccountSummariesRequest() - assert args[0] == request_msg @@ -93631,7 +93742,6 @@ async def test_get_property_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetPropertyRequest() - assert args[0] == request_msg @@ -93658,7 +93768,6 @@ async def test_list_properties_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListPropertiesRequest() - assert args[0] == request_msg @@ -93693,7 +93802,6 @@ async def test_create_property_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreatePropertyRequest() - assert args[0] == request_msg @@ -93728,7 +93836,6 @@ async def test_delete_property_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeletePropertyRequest() - assert args[0] == request_msg @@ -93763,7 +93870,6 @@ async def test_update_property_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdatePropertyRequest() - assert args[0] == request_msg @@ -93793,7 +93899,6 @@ async def test_create_firebase_link_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateFirebaseLinkRequest() - assert args[0] == request_msg @@ -93818,7 +93923,6 @@ async def test_delete_firebase_link_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteFirebaseLinkRequest() - assert args[0] == request_msg @@ -93847,7 +93951,6 @@ async def test_list_firebase_links_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListFirebaseLinksRequest() - assert args[0] == request_msg @@ -93877,7 +93980,6 @@ async def test_get_global_site_tag_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetGlobalSiteTagRequest() - assert args[0] == request_msg @@ -93909,7 +94011,6 @@ async def test_create_google_ads_link_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateGoogleAdsLinkRequest() - assert args[0] == request_msg @@ -93941,7 +94042,6 @@ async def test_update_google_ads_link_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateGoogleAdsLinkRequest() - assert args[0] == request_msg @@ -93966,7 +94066,6 @@ async def test_delete_google_ads_link_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteGoogleAdsLinkRequest() - assert args[0] == request_msg @@ -93995,7 +94094,6 @@ async def test_list_google_ads_links_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListGoogleAdsLinksRequest() - assert args[0] == request_msg @@ -94029,7 +94127,6 @@ async def test_get_data_sharing_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetDataSharingSettingsRequest() - assert args[0] == request_msg @@ -94060,7 +94157,6 @@ async def test_get_measurement_protocol_secret_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetMeasurementProtocolSecretRequest() - assert args[0] == request_msg @@ -94089,7 +94185,6 @@ async def test_list_measurement_protocol_secrets_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListMeasurementProtocolSecretsRequest() - assert args[0] == request_msg @@ -94120,7 +94215,6 @@ async def test_create_measurement_protocol_secret_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateMeasurementProtocolSecretRequest() - assert args[0] == request_msg @@ -94145,7 +94239,6 @@ async def test_delete_measurement_protocol_secret_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteMeasurementProtocolSecretRequest() - assert args[0] == request_msg @@ -94176,7 +94269,6 @@ async def test_update_measurement_protocol_secret_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateMeasurementProtocolSecretRequest() - assert args[0] == request_msg @@ -94203,7 +94295,6 @@ async def test_acknowledge_user_data_collection_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.AcknowledgeUserDataCollectionRequest() - assert args[0] == request_msg @@ -94233,7 +94324,6 @@ async def test_get_sk_ad_network_conversion_value_schema_empty_call_grpc_asyncio call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetSKAdNetworkConversionValueSchemaRequest() - assert args[0] == request_msg @@ -94263,7 +94353,6 @@ async def test_create_sk_ad_network_conversion_value_schema_empty_call_grpc_asyn call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateSKAdNetworkConversionValueSchemaRequest() - assert args[0] == request_msg @@ -94288,7 +94377,6 @@ async def test_delete_sk_ad_network_conversion_value_schema_empty_call_grpc_asyn call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteSKAdNetworkConversionValueSchemaRequest() - assert args[0] == request_msg @@ -94318,7 +94406,6 @@ async def test_update_sk_ad_network_conversion_value_schema_empty_call_grpc_asyn call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateSKAdNetworkConversionValueSchemaRequest() - assert args[0] == request_msg @@ -94347,7 +94434,6 @@ async def test_list_sk_ad_network_conversion_value_schemas_empty_call_grpc_async call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListSKAdNetworkConversionValueSchemasRequest() - assert args[0] == request_msg @@ -94376,7 +94462,6 @@ async def test_search_change_history_events_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.SearchChangeHistoryEventsRequest() - assert args[0] == request_msg @@ -94407,7 +94492,6 @@ async def test_get_google_signals_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetGoogleSignalsSettingsRequest() - assert args[0] == request_msg @@ -94438,7 +94522,6 @@ async def test_update_google_signals_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateGoogleSignalsSettingsRequest() - assert args[0] == request_msg @@ -94471,7 +94554,6 @@ async def test_create_conversion_event_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateConversionEventRequest() - assert args[0] == request_msg @@ -94504,7 +94586,6 @@ async def test_update_conversion_event_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateConversionEventRequest() - assert args[0] == request_msg @@ -94537,7 +94618,6 @@ async def test_get_conversion_event_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetConversionEventRequest() - assert args[0] == request_msg @@ -94562,7 +94642,6 @@ async def test_delete_conversion_event_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteConversionEventRequest() - assert args[0] == request_msg @@ -94591,7 +94670,6 @@ async def test_list_conversion_events_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListConversionEventsRequest() - assert args[0] == request_msg @@ -94622,7 +94700,6 @@ async def test_create_key_event_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateKeyEventRequest() - assert args[0] == request_msg @@ -94653,7 +94730,6 @@ async def test_update_key_event_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateKeyEventRequest() - assert args[0] == request_msg @@ -94684,7 +94760,6 @@ async def test_get_key_event_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetKeyEventRequest() - assert args[0] == request_msg @@ -94707,7 +94782,6 @@ async def test_delete_key_event_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteKeyEventRequest() - assert args[0] == request_msg @@ -94734,7 +94808,6 @@ async def test_list_key_events_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListKeyEventsRequest() - assert args[0] == request_msg @@ -94765,7 +94838,6 @@ async def test_get_display_video360_advertiser_link_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetDisplayVideo360AdvertiserLinkRequest() - assert args[0] == request_msg @@ -94794,7 +94866,6 @@ async def test_list_display_video360_advertiser_links_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListDisplayVideo360AdvertiserLinksRequest() - assert args[0] == request_msg @@ -94825,7 +94896,6 @@ async def test_create_display_video360_advertiser_link_empty_call_grpc_asyncio() call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest() - assert args[0] == request_msg @@ -94850,7 +94920,6 @@ async def test_delete_display_video360_advertiser_link_empty_call_grpc_asyncio() call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest() - assert args[0] == request_msg @@ -94881,7 +94950,6 @@ async def test_update_display_video360_advertiser_link_empty_call_grpc_asyncio() call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest() - assert args[0] == request_msg @@ -94913,7 +94981,6 @@ async def test_get_display_video360_advertiser_link_proposal_empty_call_grpc_asy call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest() - assert args[0] == request_msg @@ -94945,7 +95012,6 @@ async def test_list_display_video360_advertiser_link_proposals_empty_call_grpc_a request_msg = ( analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest() ) - assert args[0] == request_msg @@ -94980,7 +95046,6 @@ async def test_create_display_video360_advertiser_link_proposal_empty_call_grpc_ request_msg = ( analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest() ) - assert args[0] == request_msg @@ -95008,7 +95073,6 @@ async def test_delete_display_video360_advertiser_link_proposal_empty_call_grpc_ request_msg = ( analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest() ) - assert args[0] == request_msg @@ -95038,7 +95102,6 @@ async def test_approve_display_video360_advertiser_link_proposal_empty_call_grpc request_msg = ( analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalRequest() ) - assert args[0] == request_msg @@ -95073,7 +95136,6 @@ async def test_cancel_display_video360_advertiser_link_proposal_empty_call_grpc_ request_msg = ( analytics_admin.CancelDisplayVideo360AdvertiserLinkProposalRequest() ) - assert args[0] == request_msg @@ -95107,7 +95169,6 @@ async def test_create_custom_dimension_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateCustomDimensionRequest() - assert args[0] == request_msg @@ -95141,7 +95202,6 @@ async def test_update_custom_dimension_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateCustomDimensionRequest() - assert args[0] == request_msg @@ -95170,7 +95230,6 @@ async def test_list_custom_dimensions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListCustomDimensionsRequest() - assert args[0] == request_msg @@ -95195,7 +95254,6 @@ async def test_archive_custom_dimension_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ArchiveCustomDimensionRequest() - assert args[0] == request_msg @@ -95229,7 +95287,6 @@ async def test_get_custom_dimension_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetCustomDimensionRequest() - assert args[0] == request_msg @@ -95266,7 +95323,6 @@ async def test_create_custom_metric_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateCustomMetricRequest() - assert args[0] == request_msg @@ -95303,7 +95359,6 @@ async def test_update_custom_metric_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateCustomMetricRequest() - assert args[0] == request_msg @@ -95332,7 +95387,6 @@ async def test_list_custom_metrics_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListCustomMetricsRequest() - assert args[0] == request_msg @@ -95357,7 +95411,6 @@ async def test_archive_custom_metric_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ArchiveCustomMetricRequest() - assert args[0] == request_msg @@ -95394,7 +95447,6 @@ async def test_get_custom_metric_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetCustomMetricRequest() - assert args[0] == request_msg @@ -95426,7 +95478,6 @@ async def test_get_data_retention_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetDataRetentionSettingsRequest() - assert args[0] == request_msg @@ -95458,7 +95509,6 @@ async def test_update_data_retention_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateDataRetentionSettingsRequest() - assert args[0] == request_msg @@ -95489,7 +95539,6 @@ async def test_create_data_stream_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateDataStreamRequest() - assert args[0] == request_msg @@ -95514,7 +95563,6 @@ async def test_delete_data_stream_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteDataStreamRequest() - assert args[0] == request_msg @@ -95545,7 +95593,6 @@ async def test_update_data_stream_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateDataStreamRequest() - assert args[0] == request_msg @@ -95574,7 +95621,6 @@ async def test_list_data_streams_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListDataStreamsRequest() - assert args[0] == request_msg @@ -95603,7 +95649,6 @@ async def test_get_data_stream_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetDataStreamRequest() - assert args[0] == request_msg @@ -95635,7 +95680,6 @@ async def test_get_audience_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetAudienceRequest() - assert args[0] == request_msg @@ -95662,7 +95706,6 @@ async def test_list_audiences_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListAudiencesRequest() - assert args[0] == request_msg @@ -95694,7 +95737,6 @@ async def test_create_audience_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateAudienceRequest() - assert args[0] == request_msg @@ -95726,7 +95768,6 @@ async def test_update_audience_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateAudienceRequest() - assert args[0] == request_msg @@ -95749,7 +95790,6 @@ async def test_archive_audience_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ArchiveAudienceRequest() - assert args[0] == request_msg @@ -95780,7 +95820,6 @@ async def test_get_search_ads360_link_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetSearchAds360LinkRequest() - assert args[0] == request_msg @@ -95809,7 +95848,6 @@ async def test_list_search_ads360_links_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListSearchAds360LinksRequest() - assert args[0] == request_msg @@ -95840,7 +95878,6 @@ async def test_create_search_ads360_link_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateSearchAds360LinkRequest() - assert args[0] == request_msg @@ -95865,7 +95902,6 @@ async def test_delete_search_ads360_link_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteSearchAds360LinkRequest() - assert args[0] == request_msg @@ -95896,7 +95932,6 @@ async def test_update_search_ads360_link_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateSearchAds360LinkRequest() - assert args[0] == request_msg @@ -95929,7 +95964,6 @@ async def test_get_attribution_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetAttributionSettingsRequest() - assert args[0] == request_msg @@ -95962,7 +95996,6 @@ async def test_update_attribution_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateAttributionSettingsRequest() - assert args[0] == request_msg @@ -95991,7 +96024,6 @@ async def test_run_access_report_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.RunAccessReportRequest() - assert args[0] == request_msg @@ -96021,7 +96053,6 @@ async def test_create_access_binding_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateAccessBindingRequest() - assert args[0] == request_msg @@ -96051,7 +96082,6 @@ async def test_get_access_binding_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetAccessBindingRequest() - assert args[0] == request_msg @@ -96081,7 +96111,6 @@ async def test_update_access_binding_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateAccessBindingRequest() - assert args[0] == request_msg @@ -96106,7 +96135,6 @@ async def test_delete_access_binding_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteAccessBindingRequest() - assert args[0] == request_msg @@ -96135,7 +96163,6 @@ async def test_list_access_bindings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListAccessBindingsRequest() - assert args[0] == request_msg @@ -96162,7 +96189,6 @@ async def test_batch_create_access_bindings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.BatchCreateAccessBindingsRequest() - assert args[0] == request_msg @@ -96189,7 +96215,6 @@ async def test_batch_get_access_bindings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.BatchGetAccessBindingsRequest() - assert args[0] == request_msg @@ -96216,7 +96241,6 @@ async def test_batch_update_access_bindings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.BatchUpdateAccessBindingsRequest() - assert args[0] == request_msg @@ -96241,7 +96265,6 @@ async def test_batch_delete_access_bindings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.BatchDeleteAccessBindingsRequest() - assert args[0] == request_msg @@ -96274,7 +96297,6 @@ async def test_get_expanded_data_set_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetExpandedDataSetRequest() - assert args[0] == request_msg @@ -96303,7 +96325,6 @@ async def test_list_expanded_data_sets_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListExpandedDataSetsRequest() - assert args[0] == request_msg @@ -96336,7 +96357,6 @@ async def test_create_expanded_data_set_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateExpandedDataSetRequest() - assert args[0] == request_msg @@ -96369,7 +96389,6 @@ async def test_update_expanded_data_set_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateExpandedDataSetRequest() - assert args[0] == request_msg @@ -96394,7 +96413,6 @@ async def test_delete_expanded_data_set_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteExpandedDataSetRequest() - assert args[0] == request_msg @@ -96427,7 +96445,6 @@ async def test_get_channel_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetChannelGroupRequest() - assert args[0] == request_msg @@ -96456,7 +96473,6 @@ async def test_list_channel_groups_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListChannelGroupsRequest() - assert args[0] == request_msg @@ -96489,7 +96505,6 @@ async def test_create_channel_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateChannelGroupRequest() - assert args[0] == request_msg @@ -96522,7 +96537,6 @@ async def test_update_channel_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateChannelGroupRequest() - assert args[0] == request_msg @@ -96547,7 +96561,6 @@ async def test_delete_channel_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteChannelGroupRequest() - assert args[0] == request_msg @@ -96584,7 +96597,6 @@ async def test_create_big_query_link_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateBigQueryLinkRequest() - assert args[0] == request_msg @@ -96621,7 +96633,6 @@ async def test_get_big_query_link_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetBigQueryLinkRequest() - assert args[0] == request_msg @@ -96650,7 +96661,6 @@ async def test_list_big_query_links_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListBigQueryLinksRequest() - assert args[0] == request_msg @@ -96675,7 +96685,6 @@ async def test_delete_big_query_link_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteBigQueryLinkRequest() - assert args[0] == request_msg @@ -96712,7 +96721,6 @@ async def test_update_big_query_link_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateBigQueryLinkRequest() - assert args[0] == request_msg @@ -96751,7 +96759,6 @@ async def test_get_enhanced_measurement_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetEnhancedMeasurementSettingsRequest() - assert args[0] == request_msg @@ -96790,7 +96797,6 @@ async def test_update_enhanced_measurement_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateEnhancedMeasurementSettingsRequest() - assert args[0] == request_msg @@ -96820,7 +96826,6 @@ async def test_get_ad_sense_link_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetAdSenseLinkRequest() - assert args[0] == request_msg @@ -96850,7 +96855,6 @@ async def test_create_ad_sense_link_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateAdSenseLinkRequest() - assert args[0] == request_msg @@ -96875,7 +96879,6 @@ async def test_delete_ad_sense_link_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteAdSenseLinkRequest() - assert args[0] == request_msg @@ -96904,7 +96907,6 @@ async def test_list_ad_sense_links_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListAdSenseLinksRequest() - assert args[0] == request_msg @@ -96935,7 +96937,6 @@ async def test_get_event_create_rule_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetEventCreateRuleRequest() - assert args[0] == request_msg @@ -96964,7 +96965,6 @@ async def test_list_event_create_rules_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListEventCreateRulesRequest() - assert args[0] == request_msg @@ -96995,7 +96995,6 @@ async def test_create_event_create_rule_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateEventCreateRuleRequest() - assert args[0] == request_msg @@ -97026,7 +97025,6 @@ async def test_update_event_create_rule_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateEventCreateRuleRequest() - assert args[0] == request_msg @@ -97051,7 +97049,6 @@ async def test_delete_event_create_rule_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteEventCreateRuleRequest() - assert args[0] == request_msg @@ -97082,7 +97079,6 @@ async def test_get_event_edit_rule_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetEventEditRuleRequest() - assert args[0] == request_msg @@ -97111,7 +97107,6 @@ async def test_list_event_edit_rules_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListEventEditRulesRequest() - assert args[0] == request_msg @@ -97142,7 +97137,6 @@ async def test_create_event_edit_rule_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateEventEditRuleRequest() - assert args[0] == request_msg @@ -97173,7 +97167,6 @@ async def test_update_event_edit_rule_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateEventEditRuleRequest() - assert args[0] == request_msg @@ -97198,7 +97191,6 @@ async def test_delete_event_edit_rule_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteEventEditRuleRequest() - assert args[0] == request_msg @@ -97223,7 +97215,6 @@ async def test_reorder_event_edit_rules_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ReorderEventEditRulesRequest() - assert args[0] == request_msg @@ -97255,7 +97246,6 @@ async def test_update_data_redaction_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateDataRedactionSettingsRequest() - assert args[0] == request_msg @@ -97287,7 +97277,6 @@ async def test_get_data_redaction_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetDataRedactionSettingsRequest() - assert args[0] == request_msg @@ -97325,7 +97314,6 @@ async def test_get_calculated_metric_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetCalculatedMetricRequest() - assert args[0] == request_msg @@ -97363,7 +97351,6 @@ async def test_create_calculated_metric_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateCalculatedMetricRequest() - assert args[0] == request_msg @@ -97392,7 +97379,6 @@ async def test_list_calculated_metrics_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListCalculatedMetricsRequest() - assert args[0] == request_msg @@ -97430,7 +97416,6 @@ async def test_update_calculated_metric_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateCalculatedMetricRequest() - assert args[0] == request_msg @@ -97455,7 +97440,6 @@ async def test_delete_calculated_metric_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteCalculatedMetricRequest() - assert args[0] == request_msg @@ -97482,7 +97466,6 @@ async def test_create_rollup_property_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateRollupPropertyRequest() - assert args[0] == request_msg @@ -97512,7 +97495,6 @@ async def test_get_rollup_property_source_link_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetRollupPropertySourceLinkRequest() - assert args[0] == request_msg @@ -97541,7 +97523,6 @@ async def test_list_rollup_property_source_links_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListRollupPropertySourceLinksRequest() - assert args[0] == request_msg @@ -97571,7 +97552,6 @@ async def test_create_rollup_property_source_link_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateRollupPropertySourceLinkRequest() - assert args[0] == request_msg @@ -97596,7 +97576,6 @@ async def test_delete_rollup_property_source_link_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteRollupPropertySourceLinkRequest() - assert args[0] == request_msg @@ -97623,7 +97602,6 @@ async def test_provision_subproperty_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ProvisionSubpropertyRequest() - assert args[0] == request_msg @@ -97653,7 +97631,6 @@ async def test_create_subproperty_event_filter_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateSubpropertyEventFilterRequest() - assert args[0] == request_msg @@ -97683,7 +97660,6 @@ async def test_get_subproperty_event_filter_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetSubpropertyEventFilterRequest() - assert args[0] == request_msg @@ -97712,7 +97688,6 @@ async def test_list_subproperty_event_filters_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListSubpropertyEventFiltersRequest() - assert args[0] == request_msg @@ -97742,7 +97717,6 @@ async def test_update_subproperty_event_filter_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateSubpropertyEventFilterRequest() - assert args[0] == request_msg @@ -97767,7 +97741,6 @@ async def test_delete_subproperty_event_filter_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteSubpropertyEventFilterRequest() - assert args[0] == request_msg @@ -97800,7 +97773,6 @@ async def test_create_reporting_data_annotation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateReportingDataAnnotationRequest() - assert args[0] == request_msg @@ -97833,7 +97805,6 @@ async def test_get_reporting_data_annotation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetReportingDataAnnotationRequest() - assert args[0] == request_msg @@ -97862,7 +97833,6 @@ async def test_list_reporting_data_annotations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListReportingDataAnnotationsRequest() - assert args[0] == request_msg @@ -97895,7 +97865,6 @@ async def test_update_reporting_data_annotation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateReportingDataAnnotationRequest() - assert args[0] == request_msg @@ -97920,7 +97889,6 @@ async def test_delete_reporting_data_annotation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteReportingDataAnnotationRequest() - assert args[0] == request_msg @@ -97947,7 +97915,6 @@ async def test_submit_user_deletion_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.SubmitUserDeletionRequest() - assert args[0] == request_msg @@ -97976,7 +97943,6 @@ async def test_list_subproperty_sync_configs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListSubpropertySyncConfigsRequest() - assert args[0] == request_msg @@ -98007,7 +97973,6 @@ async def test_update_subproperty_sync_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateSubpropertySyncConfigRequest() - assert args[0] == request_msg @@ -98038,7 +98003,6 @@ async def test_get_subproperty_sync_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetSubpropertySyncConfigRequest() - assert args[0] == request_msg @@ -98068,7 +98032,6 @@ async def test_get_reporting_identity_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetReportingIdentitySettingsRequest() - assert args[0] == request_msg @@ -98099,7 +98062,6 @@ async def test_get_user_provided_data_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetUserProvidedDataSettingsRequest() - assert args[0] == request_msg @@ -123840,7 +123802,6 @@ def test_get_account_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetAccountRequest() - assert args[0] == request_msg @@ -123860,7 +123821,6 @@ def test_list_accounts_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListAccountsRequest() - assert args[0] == request_msg @@ -123880,7 +123840,6 @@ def test_delete_account_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteAccountRequest() - assert args[0] == request_msg @@ -123900,7 +123859,6 @@ def test_update_account_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateAccountRequest() - assert args[0] == request_msg @@ -123922,7 +123880,6 @@ def test_provision_account_ticket_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ProvisionAccountTicketRequest() - assert args[0] == request_msg @@ -123944,7 +123901,6 @@ def test_list_account_summaries_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListAccountSummariesRequest() - assert args[0] == request_msg @@ -123964,7 +123920,6 @@ def test_get_property_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetPropertyRequest() - assert args[0] == request_msg @@ -123984,7 +123939,6 @@ def test_list_properties_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListPropertiesRequest() - assert args[0] == request_msg @@ -124004,7 +123958,6 @@ def test_create_property_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreatePropertyRequest() - assert args[0] == request_msg @@ -124024,7 +123977,6 @@ def test_delete_property_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeletePropertyRequest() - assert args[0] == request_msg @@ -124044,7 +123996,6 @@ def test_update_property_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdatePropertyRequest() - assert args[0] == request_msg @@ -124066,7 +124017,6 @@ def test_create_firebase_link_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateFirebaseLinkRequest() - assert args[0] == request_msg @@ -124088,7 +124038,6 @@ def test_delete_firebase_link_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteFirebaseLinkRequest() - assert args[0] == request_msg @@ -124110,7 +124059,6 @@ def test_list_firebase_links_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListFirebaseLinksRequest() - assert args[0] == request_msg @@ -124132,7 +124080,6 @@ def test_get_global_site_tag_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetGlobalSiteTagRequest() - assert args[0] == request_msg @@ -124154,7 +124101,6 @@ def test_create_google_ads_link_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateGoogleAdsLinkRequest() - assert args[0] == request_msg @@ -124176,7 +124122,6 @@ def test_update_google_ads_link_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateGoogleAdsLinkRequest() - assert args[0] == request_msg @@ -124198,7 +124143,6 @@ def test_delete_google_ads_link_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteGoogleAdsLinkRequest() - assert args[0] == request_msg @@ -124220,7 +124164,6 @@ def test_list_google_ads_links_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListGoogleAdsLinksRequest() - assert args[0] == request_msg @@ -124242,7 +124185,6 @@ def test_get_data_sharing_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetDataSharingSettingsRequest() - assert args[0] == request_msg @@ -124264,7 +124206,6 @@ def test_get_measurement_protocol_secret_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetMeasurementProtocolSecretRequest() - assert args[0] == request_msg @@ -124286,7 +124227,6 @@ def test_list_measurement_protocol_secrets_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListMeasurementProtocolSecretsRequest() - assert args[0] == request_msg @@ -124308,7 +124248,6 @@ def test_create_measurement_protocol_secret_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateMeasurementProtocolSecretRequest() - assert args[0] == request_msg @@ -124330,7 +124269,6 @@ def test_delete_measurement_protocol_secret_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteMeasurementProtocolSecretRequest() - assert args[0] == request_msg @@ -124352,7 +124290,6 @@ def test_update_measurement_protocol_secret_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateMeasurementProtocolSecretRequest() - assert args[0] == request_msg @@ -124374,7 +124311,6 @@ def test_acknowledge_user_data_collection_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.AcknowledgeUserDataCollectionRequest() - assert args[0] == request_msg @@ -124396,7 +124332,6 @@ def test_get_sk_ad_network_conversion_value_schema_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetSKAdNetworkConversionValueSchemaRequest() - assert args[0] == request_msg @@ -124418,7 +124353,6 @@ def test_create_sk_ad_network_conversion_value_schema_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateSKAdNetworkConversionValueSchemaRequest() - assert args[0] == request_msg @@ -124440,7 +124374,6 @@ def test_delete_sk_ad_network_conversion_value_schema_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteSKAdNetworkConversionValueSchemaRequest() - assert args[0] == request_msg @@ -124462,7 +124395,6 @@ def test_update_sk_ad_network_conversion_value_schema_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateSKAdNetworkConversionValueSchemaRequest() - assert args[0] == request_msg @@ -124484,7 +124416,6 @@ def test_list_sk_ad_network_conversion_value_schemas_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListSKAdNetworkConversionValueSchemasRequest() - assert args[0] == request_msg @@ -124506,7 +124437,6 @@ def test_search_change_history_events_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.SearchChangeHistoryEventsRequest() - assert args[0] == request_msg @@ -124528,7 +124458,6 @@ def test_get_google_signals_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetGoogleSignalsSettingsRequest() - assert args[0] == request_msg @@ -124550,7 +124479,6 @@ def test_update_google_signals_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateGoogleSignalsSettingsRequest() - assert args[0] == request_msg @@ -124572,7 +124500,6 @@ def test_create_conversion_event_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateConversionEventRequest() - assert args[0] == request_msg @@ -124594,7 +124521,6 @@ def test_update_conversion_event_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateConversionEventRequest() - assert args[0] == request_msg @@ -124616,7 +124542,6 @@ def test_get_conversion_event_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetConversionEventRequest() - assert args[0] == request_msg @@ -124638,7 +124563,6 @@ def test_delete_conversion_event_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteConversionEventRequest() - assert args[0] == request_msg @@ -124660,7 +124584,6 @@ def test_list_conversion_events_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListConversionEventsRequest() - assert args[0] == request_msg @@ -124680,7 +124603,6 @@ def test_create_key_event_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateKeyEventRequest() - assert args[0] == request_msg @@ -124700,7 +124622,6 @@ def test_update_key_event_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateKeyEventRequest() - assert args[0] == request_msg @@ -124720,7 +124641,6 @@ def test_get_key_event_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetKeyEventRequest() - assert args[0] == request_msg @@ -124740,7 +124660,6 @@ def test_delete_key_event_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteKeyEventRequest() - assert args[0] == request_msg @@ -124760,7 +124679,6 @@ def test_list_key_events_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListKeyEventsRequest() - assert args[0] == request_msg @@ -124782,7 +124700,6 @@ def test_get_display_video360_advertiser_link_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetDisplayVideo360AdvertiserLinkRequest() - assert args[0] == request_msg @@ -124804,7 +124721,6 @@ def test_list_display_video360_advertiser_links_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListDisplayVideo360AdvertiserLinksRequest() - assert args[0] == request_msg @@ -124826,7 +124742,6 @@ def test_create_display_video360_advertiser_link_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest() - assert args[0] == request_msg @@ -124848,7 +124763,6 @@ def test_delete_display_video360_advertiser_link_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest() - assert args[0] == request_msg @@ -124870,7 +124784,6 @@ def test_update_display_video360_advertiser_link_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest() - assert args[0] == request_msg @@ -124892,7 +124805,6 @@ def test_get_display_video360_advertiser_link_proposal_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest() - assert args[0] == request_msg @@ -124917,7 +124829,6 @@ def test_list_display_video360_advertiser_link_proposals_empty_call_rest(): request_msg = ( analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest() ) - assert args[0] == request_msg @@ -124942,7 +124853,6 @@ def test_create_display_video360_advertiser_link_proposal_empty_call_rest(): request_msg = ( analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest() ) - assert args[0] == request_msg @@ -124967,7 +124877,6 @@ def test_delete_display_video360_advertiser_link_proposal_empty_call_rest(): request_msg = ( analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest() ) - assert args[0] == request_msg @@ -124992,7 +124901,6 @@ def test_approve_display_video360_advertiser_link_proposal_empty_call_rest(): request_msg = ( analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalRequest() ) - assert args[0] == request_msg @@ -125017,7 +124925,6 @@ def test_cancel_display_video360_advertiser_link_proposal_empty_call_rest(): request_msg = ( analytics_admin.CancelDisplayVideo360AdvertiserLinkProposalRequest() ) - assert args[0] == request_msg @@ -125039,7 +124946,6 @@ def test_create_custom_dimension_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateCustomDimensionRequest() - assert args[0] == request_msg @@ -125061,7 +124967,6 @@ def test_update_custom_dimension_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateCustomDimensionRequest() - assert args[0] == request_msg @@ -125083,7 +124988,6 @@ def test_list_custom_dimensions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListCustomDimensionsRequest() - assert args[0] == request_msg @@ -125105,7 +125009,6 @@ def test_archive_custom_dimension_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ArchiveCustomDimensionRequest() - assert args[0] == request_msg @@ -125127,7 +125030,6 @@ def test_get_custom_dimension_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetCustomDimensionRequest() - assert args[0] == request_msg @@ -125149,7 +125051,6 @@ def test_create_custom_metric_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateCustomMetricRequest() - assert args[0] == request_msg @@ -125171,7 +125072,6 @@ def test_update_custom_metric_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateCustomMetricRequest() - assert args[0] == request_msg @@ -125193,7 +125093,6 @@ def test_list_custom_metrics_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListCustomMetricsRequest() - assert args[0] == request_msg @@ -125215,7 +125114,6 @@ def test_archive_custom_metric_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ArchiveCustomMetricRequest() - assert args[0] == request_msg @@ -125237,7 +125135,6 @@ def test_get_custom_metric_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetCustomMetricRequest() - assert args[0] == request_msg @@ -125259,7 +125156,6 @@ def test_get_data_retention_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetDataRetentionSettingsRequest() - assert args[0] == request_msg @@ -125281,7 +125177,6 @@ def test_update_data_retention_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateDataRetentionSettingsRequest() - assert args[0] == request_msg @@ -125303,7 +125198,6 @@ def test_create_data_stream_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateDataStreamRequest() - assert args[0] == request_msg @@ -125325,7 +125219,6 @@ def test_delete_data_stream_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteDataStreamRequest() - assert args[0] == request_msg @@ -125347,7 +125240,6 @@ def test_update_data_stream_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateDataStreamRequest() - assert args[0] == request_msg @@ -125369,7 +125261,6 @@ def test_list_data_streams_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListDataStreamsRequest() - assert args[0] == request_msg @@ -125389,7 +125280,6 @@ def test_get_data_stream_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetDataStreamRequest() - assert args[0] == request_msg @@ -125409,7 +125299,6 @@ def test_get_audience_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetAudienceRequest() - assert args[0] == request_msg @@ -125429,7 +125318,6 @@ def test_list_audiences_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListAudiencesRequest() - assert args[0] == request_msg @@ -125449,7 +125337,6 @@ def test_create_audience_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateAudienceRequest() - assert args[0] == request_msg @@ -125469,7 +125356,6 @@ def test_update_audience_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateAudienceRequest() - assert args[0] == request_msg @@ -125489,7 +125375,6 @@ def test_archive_audience_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ArchiveAudienceRequest() - assert args[0] == request_msg @@ -125511,7 +125396,6 @@ def test_get_search_ads360_link_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetSearchAds360LinkRequest() - assert args[0] == request_msg @@ -125533,7 +125417,6 @@ def test_list_search_ads360_links_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListSearchAds360LinksRequest() - assert args[0] == request_msg @@ -125555,7 +125438,6 @@ def test_create_search_ads360_link_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateSearchAds360LinkRequest() - assert args[0] == request_msg @@ -125577,7 +125459,6 @@ def test_delete_search_ads360_link_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteSearchAds360LinkRequest() - assert args[0] == request_msg @@ -125599,7 +125480,6 @@ def test_update_search_ads360_link_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateSearchAds360LinkRequest() - assert args[0] == request_msg @@ -125621,7 +125501,6 @@ def test_get_attribution_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetAttributionSettingsRequest() - assert args[0] == request_msg @@ -125643,7 +125522,6 @@ def test_update_attribution_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateAttributionSettingsRequest() - assert args[0] == request_msg @@ -125665,7 +125543,6 @@ def test_run_access_report_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.RunAccessReportRequest() - assert args[0] == request_msg @@ -125687,7 +125564,6 @@ def test_create_access_binding_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateAccessBindingRequest() - assert args[0] == request_msg @@ -125709,7 +125585,6 @@ def test_get_access_binding_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetAccessBindingRequest() - assert args[0] == request_msg @@ -125731,7 +125606,6 @@ def test_update_access_binding_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateAccessBindingRequest() - assert args[0] == request_msg @@ -125753,7 +125627,6 @@ def test_delete_access_binding_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteAccessBindingRequest() - assert args[0] == request_msg @@ -125775,7 +125648,6 @@ def test_list_access_bindings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListAccessBindingsRequest() - assert args[0] == request_msg @@ -125797,7 +125669,6 @@ def test_batch_create_access_bindings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.BatchCreateAccessBindingsRequest() - assert args[0] == request_msg @@ -125819,7 +125690,6 @@ def test_batch_get_access_bindings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.BatchGetAccessBindingsRequest() - assert args[0] == request_msg @@ -125841,7 +125711,6 @@ def test_batch_update_access_bindings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.BatchUpdateAccessBindingsRequest() - assert args[0] == request_msg @@ -125863,7 +125732,6 @@ def test_batch_delete_access_bindings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.BatchDeleteAccessBindingsRequest() - assert args[0] == request_msg @@ -125885,7 +125753,6 @@ def test_get_expanded_data_set_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetExpandedDataSetRequest() - assert args[0] == request_msg @@ -125907,7 +125774,6 @@ def test_list_expanded_data_sets_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListExpandedDataSetsRequest() - assert args[0] == request_msg @@ -125929,7 +125795,6 @@ def test_create_expanded_data_set_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateExpandedDataSetRequest() - assert args[0] == request_msg @@ -125951,7 +125816,6 @@ def test_update_expanded_data_set_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateExpandedDataSetRequest() - assert args[0] == request_msg @@ -125973,7 +125837,6 @@ def test_delete_expanded_data_set_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteExpandedDataSetRequest() - assert args[0] == request_msg @@ -125995,7 +125858,6 @@ def test_get_channel_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetChannelGroupRequest() - assert args[0] == request_msg @@ -126017,7 +125879,6 @@ def test_list_channel_groups_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListChannelGroupsRequest() - assert args[0] == request_msg @@ -126039,7 +125900,6 @@ def test_create_channel_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateChannelGroupRequest() - assert args[0] == request_msg @@ -126061,7 +125921,6 @@ def test_update_channel_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateChannelGroupRequest() - assert args[0] == request_msg @@ -126083,7 +125942,6 @@ def test_delete_channel_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteChannelGroupRequest() - assert args[0] == request_msg @@ -126105,7 +125963,6 @@ def test_create_big_query_link_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateBigQueryLinkRequest() - assert args[0] == request_msg @@ -126127,7 +125984,6 @@ def test_get_big_query_link_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetBigQueryLinkRequest() - assert args[0] == request_msg @@ -126149,7 +126005,6 @@ def test_list_big_query_links_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListBigQueryLinksRequest() - assert args[0] == request_msg @@ -126171,7 +126026,6 @@ def test_delete_big_query_link_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteBigQueryLinkRequest() - assert args[0] == request_msg @@ -126193,7 +126047,6 @@ def test_update_big_query_link_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateBigQueryLinkRequest() - assert args[0] == request_msg @@ -126215,7 +126068,6 @@ def test_get_enhanced_measurement_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetEnhancedMeasurementSettingsRequest() - assert args[0] == request_msg @@ -126237,7 +126089,6 @@ def test_update_enhanced_measurement_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateEnhancedMeasurementSettingsRequest() - assert args[0] == request_msg @@ -126259,7 +126110,6 @@ def test_get_ad_sense_link_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetAdSenseLinkRequest() - assert args[0] == request_msg @@ -126281,7 +126131,6 @@ def test_create_ad_sense_link_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateAdSenseLinkRequest() - assert args[0] == request_msg @@ -126303,7 +126152,6 @@ def test_delete_ad_sense_link_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteAdSenseLinkRequest() - assert args[0] == request_msg @@ -126325,7 +126173,6 @@ def test_list_ad_sense_links_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListAdSenseLinksRequest() - assert args[0] == request_msg @@ -126347,7 +126194,6 @@ def test_get_event_create_rule_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetEventCreateRuleRequest() - assert args[0] == request_msg @@ -126369,7 +126215,6 @@ def test_list_event_create_rules_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListEventCreateRulesRequest() - assert args[0] == request_msg @@ -126391,7 +126236,6 @@ def test_create_event_create_rule_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateEventCreateRuleRequest() - assert args[0] == request_msg @@ -126413,7 +126257,6 @@ def test_update_event_create_rule_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateEventCreateRuleRequest() - assert args[0] == request_msg @@ -126435,7 +126278,6 @@ def test_delete_event_create_rule_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteEventCreateRuleRequest() - assert args[0] == request_msg @@ -126457,7 +126299,6 @@ def test_get_event_edit_rule_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetEventEditRuleRequest() - assert args[0] == request_msg @@ -126479,7 +126320,6 @@ def test_list_event_edit_rules_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListEventEditRulesRequest() - assert args[0] == request_msg @@ -126501,7 +126341,6 @@ def test_create_event_edit_rule_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateEventEditRuleRequest() - assert args[0] == request_msg @@ -126523,7 +126362,6 @@ def test_update_event_edit_rule_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateEventEditRuleRequest() - assert args[0] == request_msg @@ -126545,7 +126383,6 @@ def test_delete_event_edit_rule_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteEventEditRuleRequest() - assert args[0] == request_msg @@ -126567,7 +126404,6 @@ def test_reorder_event_edit_rules_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ReorderEventEditRulesRequest() - assert args[0] == request_msg @@ -126589,7 +126425,6 @@ def test_update_data_redaction_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateDataRedactionSettingsRequest() - assert args[0] == request_msg @@ -126611,7 +126446,6 @@ def test_get_data_redaction_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetDataRedactionSettingsRequest() - assert args[0] == request_msg @@ -126633,7 +126467,6 @@ def test_get_calculated_metric_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetCalculatedMetricRequest() - assert args[0] == request_msg @@ -126655,7 +126488,6 @@ def test_create_calculated_metric_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateCalculatedMetricRequest() - assert args[0] == request_msg @@ -126677,7 +126509,6 @@ def test_list_calculated_metrics_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListCalculatedMetricsRequest() - assert args[0] == request_msg @@ -126699,7 +126530,6 @@ def test_update_calculated_metric_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateCalculatedMetricRequest() - assert args[0] == request_msg @@ -126721,7 +126551,6 @@ def test_delete_calculated_metric_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteCalculatedMetricRequest() - assert args[0] == request_msg @@ -126743,7 +126572,6 @@ def test_create_rollup_property_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateRollupPropertyRequest() - assert args[0] == request_msg @@ -126765,7 +126593,6 @@ def test_get_rollup_property_source_link_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetRollupPropertySourceLinkRequest() - assert args[0] == request_msg @@ -126787,7 +126614,6 @@ def test_list_rollup_property_source_links_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListRollupPropertySourceLinksRequest() - assert args[0] == request_msg @@ -126809,7 +126635,6 @@ def test_create_rollup_property_source_link_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateRollupPropertySourceLinkRequest() - assert args[0] == request_msg @@ -126831,7 +126656,6 @@ def test_delete_rollup_property_source_link_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteRollupPropertySourceLinkRequest() - assert args[0] == request_msg @@ -126853,7 +126677,6 @@ def test_provision_subproperty_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ProvisionSubpropertyRequest() - assert args[0] == request_msg @@ -126875,7 +126698,6 @@ def test_create_subproperty_event_filter_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateSubpropertyEventFilterRequest() - assert args[0] == request_msg @@ -126897,7 +126719,6 @@ def test_get_subproperty_event_filter_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetSubpropertyEventFilterRequest() - assert args[0] == request_msg @@ -126919,7 +126740,6 @@ def test_list_subproperty_event_filters_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListSubpropertyEventFiltersRequest() - assert args[0] == request_msg @@ -126941,7 +126761,6 @@ def test_update_subproperty_event_filter_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateSubpropertyEventFilterRequest() - assert args[0] == request_msg @@ -126963,7 +126782,6 @@ def test_delete_subproperty_event_filter_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteSubpropertyEventFilterRequest() - assert args[0] == request_msg @@ -126985,7 +126803,6 @@ def test_create_reporting_data_annotation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateReportingDataAnnotationRequest() - assert args[0] == request_msg @@ -127007,7 +126824,6 @@ def test_get_reporting_data_annotation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetReportingDataAnnotationRequest() - assert args[0] == request_msg @@ -127029,7 +126845,6 @@ def test_list_reporting_data_annotations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListReportingDataAnnotationsRequest() - assert args[0] == request_msg @@ -127051,7 +126866,6 @@ def test_update_reporting_data_annotation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateReportingDataAnnotationRequest() - assert args[0] == request_msg @@ -127073,7 +126887,6 @@ def test_delete_reporting_data_annotation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteReportingDataAnnotationRequest() - assert args[0] == request_msg @@ -127095,7 +126908,6 @@ def test_submit_user_deletion_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.SubmitUserDeletionRequest() - assert args[0] == request_msg @@ -127117,7 +126929,6 @@ def test_list_subproperty_sync_configs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListSubpropertySyncConfigsRequest() - assert args[0] == request_msg @@ -127139,7 +126950,6 @@ def test_update_subproperty_sync_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateSubpropertySyncConfigRequest() - assert args[0] == request_msg @@ -127161,7 +126971,6 @@ def test_get_subproperty_sync_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetSubpropertySyncConfigRequest() - assert args[0] == request_msg @@ -127183,7 +126992,6 @@ def test_get_reporting_identity_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetReportingIdentitySettingsRequest() - assert args[0] == request_msg @@ -127205,7 +127013,6 @@ def test_get_user_provided_data_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetUserProvidedDataSettingsRequest() - assert args[0] == request_msg diff --git a/packages/google-analytics-admin/tests/unit/gapic/admin_v1beta/test_analytics_admin_service.py b/packages/google-analytics-admin/tests/unit/gapic/admin_v1beta/test_analytics_admin_service.py index 5913e3e1a6da..3a37e4f02f0b 100644 --- a/packages/google-analytics-admin/tests/unit/gapic/admin_v1beta/test_analytics_admin_service.py +++ b/packages/google-analytics-admin/tests/unit/gapic/admin_v1beta/test_analytics_admin_service.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 @@ -114,6 +115,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" @@ -1382,8 +1398,8 @@ def test_analytics_admin_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetAccountRequest, - dict, + analytics_admin.GetAccountRequest(), + {}, ], ) def test_get_account(request_type, transport: str = "grpc"): @@ -1394,7 +1410,7 @@ def test_get_account(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_account), "__call__") as call: @@ -1446,9 +1462,10 @@ def test_get_account_non_empty_request_with_auto_populated_field(): client.get_account(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetAccountRequest( + request_msg = analytics_admin.GetAccountRequest( name="name_value", ) + assert args[0] == request_msg def test_get_account_use_cached_wrapped_rpc(): @@ -1529,9 +1546,14 @@ async def test_get_account_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_account_async( - transport: str = "grpc_asyncio", request_type=analytics_admin.GetAccountRequest -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.GetAccountRequest(), + {}, + ], +) +async def test_get_account_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1539,7 +1561,7 @@ async def test_get_account_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_account), "__call__") as call: @@ -1570,11 +1592,6 @@ async def test_get_account_async( assert response.gmp_organization == "gmp_organization_value" -@pytest.mark.asyncio -async def test_get_account_async_from_dict(): - await test_get_account_async(request_type=dict) - - def test_get_account_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1717,8 +1734,8 @@ async def test_get_account_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListAccountsRequest, - dict, + analytics_admin.ListAccountsRequest(), + {}, ], ) def test_list_accounts(request_type, transport: str = "grpc"): @@ -1729,7 +1746,7 @@ def test_list_accounts(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_accounts), "__call__") as call: @@ -1773,9 +1790,10 @@ def test_list_accounts_non_empty_request_with_auto_populated_field(): client.list_accounts(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListAccountsRequest( + request_msg = analytics_admin.ListAccountsRequest( page_token="page_token_value", ) + assert args[0] == request_msg def test_list_accounts_use_cached_wrapped_rpc(): @@ -1856,9 +1874,14 @@ async def test_list_accounts_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_accounts_async( - transport: str = "grpc_asyncio", request_type=analytics_admin.ListAccountsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.ListAccountsRequest(), + {}, + ], +) +async def test_list_accounts_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1866,7 +1889,7 @@ async def test_list_accounts_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_accounts), "__call__") as call: @@ -1889,11 +1912,6 @@ async def test_list_accounts_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_accounts_async_from_dict(): - await test_list_accounts_async(request_type=dict) - - def test_list_accounts_pager(transport_name: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2084,8 +2102,8 @@ async def test_list_accounts_async_pages(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.DeleteAccountRequest, - dict, + analytics_admin.DeleteAccountRequest(), + {}, ], ) def test_delete_account(request_type, transport: str = "grpc"): @@ -2096,7 +2114,7 @@ def test_delete_account(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_account), "__call__") as call: @@ -2137,9 +2155,10 @@ def test_delete_account_non_empty_request_with_auto_populated_field(): client.delete_account(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.DeleteAccountRequest( + request_msg = analytics_admin.DeleteAccountRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_account_use_cached_wrapped_rpc(): @@ -2220,9 +2239,14 @@ async def test_delete_account_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_account_async( - transport: str = "grpc_asyncio", request_type=analytics_admin.DeleteAccountRequest -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.DeleteAccountRequest(), + {}, + ], +) +async def test_delete_account_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2230,7 +2254,7 @@ async def test_delete_account_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_account), "__call__") as call: @@ -2248,11 +2272,6 @@ async def test_delete_account_async( assert response is None -@pytest.mark.asyncio -async def test_delete_account_async_from_dict(): - await test_delete_account_async(request_type=dict) - - def test_delete_account_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2395,8 +2414,8 @@ async def test_delete_account_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdateAccountRequest, - dict, + analytics_admin.UpdateAccountRequest(), + {}, ], ) def test_update_account(request_type, transport: str = "grpc"): @@ -2407,7 +2426,7 @@ def test_update_account(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_account), "__call__") as call: @@ -2457,7 +2476,8 @@ def test_update_account_non_empty_request_with_auto_populated_field(): client.update_account(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateAccountRequest() + request_msg = analytics_admin.UpdateAccountRequest() + assert args[0] == request_msg def test_update_account_use_cached_wrapped_rpc(): @@ -2538,9 +2558,14 @@ async def test_update_account_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_account_async( - transport: str = "grpc_asyncio", request_type=analytics_admin.UpdateAccountRequest -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.UpdateAccountRequest(), + {}, + ], +) +async def test_update_account_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2548,7 +2573,7 @@ async def test_update_account_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_account), "__call__") as call: @@ -2579,11 +2604,6 @@ async def test_update_account_async( assert response.gmp_organization == "gmp_organization_value" -@pytest.mark.asyncio -async def test_update_account_async_from_dict(): - await test_update_account_async(request_type=dict) - - def test_update_account_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2736,8 +2756,8 @@ async def test_update_account_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.ProvisionAccountTicketRequest, - dict, + analytics_admin.ProvisionAccountTicketRequest(), + {}, ], ) def test_provision_account_ticket(request_type, transport: str = "grpc"): @@ -2748,7 +2768,7 @@ def test_provision_account_ticket(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2796,9 +2816,10 @@ def test_provision_account_ticket_non_empty_request_with_auto_populated_field(): client.provision_account_ticket(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ProvisionAccountTicketRequest( + request_msg = analytics_admin.ProvisionAccountTicketRequest( redirect_uri="redirect_uri_value", ) + assert args[0] == request_msg def test_provision_account_ticket_use_cached_wrapped_rpc(): @@ -2884,9 +2905,15 @@ async def test_provision_account_ticket_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.ProvisionAccountTicketRequest(), + {}, + ], +) async def test_provision_account_ticket_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.ProvisionAccountTicketRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2895,7 +2922,7 @@ async def test_provision_account_ticket_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( @@ -2920,16 +2947,11 @@ async def test_provision_account_ticket_async( assert response.account_ticket_id == "account_ticket_id_value" -@pytest.mark.asyncio -async def test_provision_account_ticket_async_from_dict(): - await test_provision_account_ticket_async(request_type=dict) - - @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListAccountSummariesRequest, - dict, + analytics_admin.ListAccountSummariesRequest(), + {}, ], ) def test_list_account_summaries(request_type, transport: str = "grpc"): @@ -2940,7 +2962,7 @@ def test_list_account_summaries(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2988,9 +3010,10 @@ def test_list_account_summaries_non_empty_request_with_auto_populated_field(): client.list_account_summaries(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListAccountSummariesRequest( + request_msg = analytics_admin.ListAccountSummariesRequest( page_token="page_token_value", ) + assert args[0] == request_msg def test_list_account_summaries_use_cached_wrapped_rpc(): @@ -3076,9 +3099,15 @@ async def test_list_account_summaries_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.ListAccountSummariesRequest(), + {}, + ], +) async def test_list_account_summaries_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.ListAccountSummariesRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3087,7 +3116,7 @@ async def test_list_account_summaries_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( @@ -3112,11 +3141,6 @@ async def test_list_account_summaries_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_account_summaries_async_from_dict(): - await test_list_account_summaries_async(request_type=dict) - - def test_list_account_summaries_pager(transport_name: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3315,8 +3339,8 @@ async def test_list_account_summaries_async_pages(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetPropertyRequest, - dict, + analytics_admin.GetPropertyRequest(), + {}, ], ) def test_get_property(request_type, transport: str = "grpc"): @@ -3327,7 +3351,7 @@ def test_get_property(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_property), "__call__") as call: @@ -3387,9 +3411,10 @@ def test_get_property_non_empty_request_with_auto_populated_field(): client.get_property(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetPropertyRequest( + request_msg = analytics_admin.GetPropertyRequest( name="name_value", ) + assert args[0] == request_msg def test_get_property_use_cached_wrapped_rpc(): @@ -3470,9 +3495,14 @@ async def test_get_property_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_property_async( - transport: str = "grpc_asyncio", request_type=analytics_admin.GetPropertyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.GetPropertyRequest(), + {}, + ], +) +async def test_get_property_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3480,7 +3510,7 @@ async def test_get_property_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_property), "__call__") as call: @@ -3519,11 +3549,6 @@ async def test_get_property_async( assert response.account == "account_value" -@pytest.mark.asyncio -async def test_get_property_async_from_dict(): - await test_get_property_async(request_type=dict) - - def test_get_property_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3666,8 +3691,8 @@ async def test_get_property_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListPropertiesRequest, - dict, + analytics_admin.ListPropertiesRequest(), + {}, ], ) def test_list_properties(request_type, transport: str = "grpc"): @@ -3678,7 +3703,7 @@ def test_list_properties(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_properties), "__call__") as call: @@ -3723,10 +3748,11 @@ def test_list_properties_non_empty_request_with_auto_populated_field(): client.list_properties(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListPropertiesRequest( + request_msg = analytics_admin.ListPropertiesRequest( filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_properties_use_cached_wrapped_rpc(): @@ -3807,9 +3833,14 @@ async def test_list_properties_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_properties_async( - transport: str = "grpc_asyncio", request_type=analytics_admin.ListPropertiesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.ListPropertiesRequest(), + {}, + ], +) +async def test_list_properties_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3817,7 +3848,7 @@ async def test_list_properties_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_properties), "__call__") as call: @@ -3840,11 +3871,6 @@ async def test_list_properties_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_properties_async_from_dict(): - await test_list_properties_async(request_type=dict) - - def test_list_properties_pager(transport_name: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4035,8 +4061,8 @@ async def test_list_properties_async_pages(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.CreatePropertyRequest, - dict, + analytics_admin.CreatePropertyRequest(), + {}, ], ) def test_create_property(request_type, transport: str = "grpc"): @@ -4047,7 +4073,7 @@ def test_create_property(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_property), "__call__") as call: @@ -4105,7 +4131,8 @@ def test_create_property_non_empty_request_with_auto_populated_field(): client.create_property(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreatePropertyRequest() + request_msg = analytics_admin.CreatePropertyRequest() + assert args[0] == request_msg def test_create_property_use_cached_wrapped_rpc(): @@ -4186,9 +4213,14 @@ async def test_create_property_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_property_async( - transport: str = "grpc_asyncio", request_type=analytics_admin.CreatePropertyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.CreatePropertyRequest(), + {}, + ], +) +async def test_create_property_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4196,7 +4228,7 @@ async def test_create_property_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_property), "__call__") as call: @@ -4235,11 +4267,6 @@ async def test_create_property_async( assert response.account == "account_value" -@pytest.mark.asyncio -async def test_create_property_async_from_dict(): - await test_create_property_async(request_type=dict) - - def test_create_property_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4323,8 +4350,8 @@ async def test_create_property_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.DeletePropertyRequest, - dict, + analytics_admin.DeletePropertyRequest(), + {}, ], ) def test_delete_property(request_type, transport: str = "grpc"): @@ -4335,7 +4362,7 @@ def test_delete_property(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_property), "__call__") as call: @@ -4395,9 +4422,10 @@ def test_delete_property_non_empty_request_with_auto_populated_field(): client.delete_property(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.DeletePropertyRequest( + request_msg = analytics_admin.DeletePropertyRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_property_use_cached_wrapped_rpc(): @@ -4478,9 +4506,14 @@ async def test_delete_property_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_property_async( - transport: str = "grpc_asyncio", request_type=analytics_admin.DeletePropertyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.DeletePropertyRequest(), + {}, + ], +) +async def test_delete_property_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4488,7 +4521,7 @@ async def test_delete_property_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_property), "__call__") as call: @@ -4527,11 +4560,6 @@ async def test_delete_property_async( assert response.account == "account_value" -@pytest.mark.asyncio -async def test_delete_property_async_from_dict(): - await test_delete_property_async(request_type=dict) - - def test_delete_property_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4674,8 +4702,8 @@ async def test_delete_property_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdatePropertyRequest, - dict, + analytics_admin.UpdatePropertyRequest(), + {}, ], ) def test_update_property(request_type, transport: str = "grpc"): @@ -4686,7 +4714,7 @@ def test_update_property(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_property), "__call__") as call: @@ -4744,7 +4772,8 @@ def test_update_property_non_empty_request_with_auto_populated_field(): client.update_property(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdatePropertyRequest() + request_msg = analytics_admin.UpdatePropertyRequest() + assert args[0] == request_msg def test_update_property_use_cached_wrapped_rpc(): @@ -4825,9 +4854,14 @@ async def test_update_property_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_property_async( - transport: str = "grpc_asyncio", request_type=analytics_admin.UpdatePropertyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.UpdatePropertyRequest(), + {}, + ], +) +async def test_update_property_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4835,7 +4869,7 @@ async def test_update_property_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_property), "__call__") as call: @@ -4874,11 +4908,6 @@ async def test_update_property_async( assert response.account == "account_value" -@pytest.mark.asyncio -async def test_update_property_async_from_dict(): - await test_update_property_async(request_type=dict) - - def test_update_property_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5031,8 +5060,8 @@ async def test_update_property_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.CreateFirebaseLinkRequest, - dict, + analytics_admin.CreateFirebaseLinkRequest(), + {}, ], ) def test_create_firebase_link(request_type, transport: str = "grpc"): @@ -5043,7 +5072,7 @@ def test_create_firebase_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( @@ -5093,9 +5122,10 @@ def test_create_firebase_link_non_empty_request_with_auto_populated_field(): client.create_firebase_link(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateFirebaseLinkRequest( + request_msg = analytics_admin.CreateFirebaseLinkRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_firebase_link_use_cached_wrapped_rpc(): @@ -5180,9 +5210,15 @@ async def test_create_firebase_link_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.CreateFirebaseLinkRequest(), + {}, + ], +) async def test_create_firebase_link_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.CreateFirebaseLinkRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5191,7 +5227,7 @@ async def test_create_firebase_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( @@ -5218,11 +5254,6 @@ async def test_create_firebase_link_async( assert response.project == "project_value" -@pytest.mark.asyncio -async def test_create_firebase_link_async_from_dict(): - await test_create_firebase_link_async(request_type=dict) - - def test_create_firebase_link_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5387,8 +5418,8 @@ async def test_create_firebase_link_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.DeleteFirebaseLinkRequest, - dict, + analytics_admin.DeleteFirebaseLinkRequest(), + {}, ], ) def test_delete_firebase_link(request_type, transport: str = "grpc"): @@ -5399,7 +5430,7 @@ def test_delete_firebase_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( @@ -5444,9 +5475,10 @@ def test_delete_firebase_link_non_empty_request_with_auto_populated_field(): client.delete_firebase_link(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.DeleteFirebaseLinkRequest( + request_msg = analytics_admin.DeleteFirebaseLinkRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_firebase_link_use_cached_wrapped_rpc(): @@ -5531,9 +5563,15 @@ async def test_delete_firebase_link_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.DeleteFirebaseLinkRequest(), + {}, + ], +) async def test_delete_firebase_link_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.DeleteFirebaseLinkRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5542,7 +5580,7 @@ async def test_delete_firebase_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( @@ -5562,11 +5600,6 @@ async def test_delete_firebase_link_async( assert response is None -@pytest.mark.asyncio -async def test_delete_firebase_link_async_from_dict(): - await test_delete_firebase_link_async(request_type=dict) - - def test_delete_firebase_link_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5717,8 +5750,8 @@ async def test_delete_firebase_link_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListFirebaseLinksRequest, - dict, + analytics_admin.ListFirebaseLinksRequest(), + {}, ], ) def test_list_firebase_links(request_type, transport: str = "grpc"): @@ -5729,7 +5762,7 @@ def test_list_firebase_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( @@ -5778,10 +5811,11 @@ def test_list_firebase_links_non_empty_request_with_auto_populated_field(): client.list_firebase_links(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListFirebaseLinksRequest( + request_msg = analytics_admin.ListFirebaseLinksRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_firebase_links_use_cached_wrapped_rpc(): @@ -5866,10 +5900,14 @@ async def test_list_firebase_links_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_firebase_links_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.ListFirebaseLinksRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.ListFirebaseLinksRequest(), + {}, + ], +) +async def test_list_firebase_links_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5877,7 +5915,7 @@ async def test_list_firebase_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( @@ -5902,11 +5940,6 @@ async def test_list_firebase_links_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_firebase_links_async_from_dict(): - await test_list_firebase_links_async(request_type=dict) - - def test_list_firebase_links_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6259,8 +6292,8 @@ async def test_list_firebase_links_async_pages(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.CreateGoogleAdsLinkRequest, - dict, + analytics_admin.CreateGoogleAdsLinkRequest(), + {}, ], ) def test_create_google_ads_link(request_type, transport: str = "grpc"): @@ -6271,7 +6304,7 @@ def test_create_google_ads_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( @@ -6325,9 +6358,10 @@ def test_create_google_ads_link_non_empty_request_with_auto_populated_field(): client.create_google_ads_link(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateGoogleAdsLinkRequest( + request_msg = analytics_admin.CreateGoogleAdsLinkRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_google_ads_link_use_cached_wrapped_rpc(): @@ -6413,9 +6447,15 @@ async def test_create_google_ads_link_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.CreateGoogleAdsLinkRequest(), + {}, + ], +) async def test_create_google_ads_link_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.CreateGoogleAdsLinkRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -6424,7 +6464,7 @@ async def test_create_google_ads_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( @@ -6455,11 +6495,6 @@ async def test_create_google_ads_link_async( assert response.creator_email_address == "creator_email_address_value" -@pytest.mark.asyncio -async def test_create_google_ads_link_async_from_dict(): - await test_create_google_ads_link_async(request_type=dict) - - def test_create_google_ads_link_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6624,8 +6659,8 @@ async def test_create_google_ads_link_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdateGoogleAdsLinkRequest, - dict, + analytics_admin.UpdateGoogleAdsLinkRequest(), + {}, ], ) def test_update_google_ads_link(request_type, transport: str = "grpc"): @@ -6636,7 +6671,7 @@ def test_update_google_ads_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( @@ -6688,7 +6723,8 @@ def test_update_google_ads_link_non_empty_request_with_auto_populated_field(): client.update_google_ads_link(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateGoogleAdsLinkRequest() + request_msg = analytics_admin.UpdateGoogleAdsLinkRequest() + assert args[0] == request_msg def test_update_google_ads_link_use_cached_wrapped_rpc(): @@ -6774,9 +6810,15 @@ async def test_update_google_ads_link_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.UpdateGoogleAdsLinkRequest(), + {}, + ], +) async def test_update_google_ads_link_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.UpdateGoogleAdsLinkRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -6785,7 +6827,7 @@ async def test_update_google_ads_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( @@ -6816,11 +6858,6 @@ async def test_update_google_ads_link_async( assert response.creator_email_address == "creator_email_address_value" -@pytest.mark.asyncio -async def test_update_google_ads_link_async_from_dict(): - await test_update_google_ads_link_async(request_type=dict) - - def test_update_google_ads_link_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6985,8 +7022,8 @@ async def test_update_google_ads_link_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.DeleteGoogleAdsLinkRequest, - dict, + analytics_admin.DeleteGoogleAdsLinkRequest(), + {}, ], ) def test_delete_google_ads_link(request_type, transport: str = "grpc"): @@ -6997,7 +7034,7 @@ def test_delete_google_ads_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( @@ -7042,9 +7079,10 @@ def test_delete_google_ads_link_non_empty_request_with_auto_populated_field(): client.delete_google_ads_link(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.DeleteGoogleAdsLinkRequest( + request_msg = analytics_admin.DeleteGoogleAdsLinkRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_google_ads_link_use_cached_wrapped_rpc(): @@ -7130,9 +7168,15 @@ async def test_delete_google_ads_link_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.DeleteGoogleAdsLinkRequest(), + {}, + ], +) async def test_delete_google_ads_link_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.DeleteGoogleAdsLinkRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -7141,7 +7185,7 @@ async def test_delete_google_ads_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( @@ -7161,11 +7205,6 @@ async def test_delete_google_ads_link_async( assert response is None -@pytest.mark.asyncio -async def test_delete_google_ads_link_async_from_dict(): - await test_delete_google_ads_link_async(request_type=dict) - - def test_delete_google_ads_link_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7316,8 +7355,8 @@ async def test_delete_google_ads_link_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListGoogleAdsLinksRequest, - dict, + analytics_admin.ListGoogleAdsLinksRequest(), + {}, ], ) def test_list_google_ads_links(request_type, transport: str = "grpc"): @@ -7328,7 +7367,7 @@ def test_list_google_ads_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( @@ -7377,10 +7416,11 @@ def test_list_google_ads_links_non_empty_request_with_auto_populated_field(): client.list_google_ads_links(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListGoogleAdsLinksRequest( + request_msg = analytics_admin.ListGoogleAdsLinksRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_google_ads_links_use_cached_wrapped_rpc(): @@ -7466,9 +7506,15 @@ async def test_list_google_ads_links_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.ListGoogleAdsLinksRequest(), + {}, + ], +) async def test_list_google_ads_links_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.ListGoogleAdsLinksRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -7477,7 +7523,7 @@ async def test_list_google_ads_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( @@ -7502,11 +7548,6 @@ async def test_list_google_ads_links_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_google_ads_links_async_from_dict(): - await test_list_google_ads_links_async(request_type=dict) - - def test_list_google_ads_links_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7859,8 +7900,8 @@ async def test_list_google_ads_links_async_pages(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetDataSharingSettingsRequest, - dict, + analytics_admin.GetDataSharingSettingsRequest(), + {}, ], ) def test_get_data_sharing_settings(request_type, transport: str = "grpc"): @@ -7871,7 +7912,7 @@ def test_get_data_sharing_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( @@ -7929,9 +7970,10 @@ def test_get_data_sharing_settings_non_empty_request_with_auto_populated_field() client.get_data_sharing_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetDataSharingSettingsRequest( + request_msg = analytics_admin.GetDataSharingSettingsRequest( name="name_value", ) + assert args[0] == request_msg def test_get_data_sharing_settings_use_cached_wrapped_rpc(): @@ -8017,9 +8059,15 @@ async def test_get_data_sharing_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.GetDataSharingSettingsRequest(), + {}, + ], +) async def test_get_data_sharing_settings_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.GetDataSharingSettingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -8028,7 +8076,7 @@ async def test_get_data_sharing_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( @@ -8063,11 +8111,6 @@ async def test_get_data_sharing_settings_async( assert response.sharing_with_others_enabled is True -@pytest.mark.asyncio -async def test_get_data_sharing_settings_async_from_dict(): - await test_get_data_sharing_settings_async(request_type=dict) - - def test_get_data_sharing_settings_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8222,8 +8265,8 @@ async def test_get_data_sharing_settings_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetMeasurementProtocolSecretRequest, - dict, + analytics_admin.GetMeasurementProtocolSecretRequest(), + {}, ], ) def test_get_measurement_protocol_secret(request_type, transport: str = "grpc"): @@ -8234,7 +8277,7 @@ def test_get_measurement_protocol_secret(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8286,9 +8329,10 @@ def test_get_measurement_protocol_secret_non_empty_request_with_auto_populated_f client.get_measurement_protocol_secret(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetMeasurementProtocolSecretRequest( + request_msg = analytics_admin.GetMeasurementProtocolSecretRequest( name="name_value", ) + assert args[0] == request_msg def test_get_measurement_protocol_secret_use_cached_wrapped_rpc(): @@ -8374,9 +8418,15 @@ async def test_get_measurement_protocol_secret_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.GetMeasurementProtocolSecretRequest(), + {}, + ], +) async def test_get_measurement_protocol_secret_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.GetMeasurementProtocolSecretRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -8385,7 +8435,7 @@ async def test_get_measurement_protocol_secret_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( @@ -8414,11 +8464,6 @@ async def test_get_measurement_protocol_secret_async( assert response.secret_value == "secret_value_value" -@pytest.mark.asyncio -async def test_get_measurement_protocol_secret_async_from_dict(): - await test_get_measurement_protocol_secret_async(request_type=dict) - - def test_get_measurement_protocol_secret_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8573,8 +8618,8 @@ async def test_get_measurement_protocol_secret_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListMeasurementProtocolSecretsRequest, - dict, + analytics_admin.ListMeasurementProtocolSecretsRequest(), + {}, ], ) def test_list_measurement_protocol_secrets(request_type, transport: str = "grpc"): @@ -8585,7 +8630,7 @@ def test_list_measurement_protocol_secrets(request_type, transport: str = "grpc" # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8634,10 +8679,11 @@ def test_list_measurement_protocol_secrets_non_empty_request_with_auto_populated client.list_measurement_protocol_secrets(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListMeasurementProtocolSecretsRequest( + request_msg = analytics_admin.ListMeasurementProtocolSecretsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_measurement_protocol_secrets_use_cached_wrapped_rpc(): @@ -8723,9 +8769,15 @@ async def test_list_measurement_protocol_secrets_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.ListMeasurementProtocolSecretsRequest(), + {}, + ], +) async def test_list_measurement_protocol_secrets_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.ListMeasurementProtocolSecretsRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -8734,7 +8786,7 @@ async def test_list_measurement_protocol_secrets_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( @@ -8759,11 +8811,6 @@ async def test_list_measurement_protocol_secrets_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_measurement_protocol_secrets_async_from_dict(): - await test_list_measurement_protocol_secrets_async(request_type=dict) - - def test_list_measurement_protocol_secrets_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9122,8 +9169,8 @@ async def test_list_measurement_protocol_secrets_async_pages(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.CreateMeasurementProtocolSecretRequest, - dict, + analytics_admin.CreateMeasurementProtocolSecretRequest(), + {}, ], ) def test_create_measurement_protocol_secret(request_type, transport: str = "grpc"): @@ -9134,7 +9181,7 @@ def test_create_measurement_protocol_secret(request_type, transport: str = "grpc # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9186,9 +9233,10 @@ def test_create_measurement_protocol_secret_non_empty_request_with_auto_populate client.create_measurement_protocol_secret(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateMeasurementProtocolSecretRequest( + request_msg = analytics_admin.CreateMeasurementProtocolSecretRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_measurement_protocol_secret_use_cached_wrapped_rpc(): @@ -9274,9 +9322,15 @@ async def test_create_measurement_protocol_secret_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.CreateMeasurementProtocolSecretRequest(), + {}, + ], +) async def test_create_measurement_protocol_secret_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.CreateMeasurementProtocolSecretRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -9285,7 +9339,7 @@ async def test_create_measurement_protocol_secret_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( @@ -9314,11 +9368,6 @@ async def test_create_measurement_protocol_secret_async( assert response.secret_value == "secret_value_value" -@pytest.mark.asyncio -async def test_create_measurement_protocol_secret_async_from_dict(): - await test_create_measurement_protocol_secret_async(request_type=dict) - - def test_create_measurement_protocol_secret_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9491,8 +9540,8 @@ async def test_create_measurement_protocol_secret_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.DeleteMeasurementProtocolSecretRequest, - dict, + analytics_admin.DeleteMeasurementProtocolSecretRequest(), + {}, ], ) def test_delete_measurement_protocol_secret(request_type, transport: str = "grpc"): @@ -9503,7 +9552,7 @@ def test_delete_measurement_protocol_secret(request_type, transport: str = "grpc # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9548,9 +9597,10 @@ def test_delete_measurement_protocol_secret_non_empty_request_with_auto_populate client.delete_measurement_protocol_secret(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.DeleteMeasurementProtocolSecretRequest( + request_msg = analytics_admin.DeleteMeasurementProtocolSecretRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_measurement_protocol_secret_use_cached_wrapped_rpc(): @@ -9636,9 +9686,15 @@ async def test_delete_measurement_protocol_secret_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.DeleteMeasurementProtocolSecretRequest(), + {}, + ], +) async def test_delete_measurement_protocol_secret_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.DeleteMeasurementProtocolSecretRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -9647,7 +9703,7 @@ async def test_delete_measurement_protocol_secret_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( @@ -9667,11 +9723,6 @@ async def test_delete_measurement_protocol_secret_async( assert response is None -@pytest.mark.asyncio -async def test_delete_measurement_protocol_secret_async_from_dict(): - await test_delete_measurement_protocol_secret_async(request_type=dict) - - def test_delete_measurement_protocol_secret_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9822,8 +9873,8 @@ async def test_delete_measurement_protocol_secret_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdateMeasurementProtocolSecretRequest, - dict, + analytics_admin.UpdateMeasurementProtocolSecretRequest(), + {}, ], ) def test_update_measurement_protocol_secret(request_type, transport: str = "grpc"): @@ -9834,7 +9885,7 @@ def test_update_measurement_protocol_secret(request_type, transport: str = "grpc # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9884,7 +9935,8 @@ def test_update_measurement_protocol_secret_non_empty_request_with_auto_populate client.update_measurement_protocol_secret(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateMeasurementProtocolSecretRequest() + request_msg = analytics_admin.UpdateMeasurementProtocolSecretRequest() + assert args[0] == request_msg def test_update_measurement_protocol_secret_use_cached_wrapped_rpc(): @@ -9970,9 +10022,15 @@ async def test_update_measurement_protocol_secret_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.UpdateMeasurementProtocolSecretRequest(), + {}, + ], +) async def test_update_measurement_protocol_secret_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.UpdateMeasurementProtocolSecretRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -9981,7 +10039,7 @@ async def test_update_measurement_protocol_secret_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( @@ -10010,11 +10068,6 @@ async def test_update_measurement_protocol_secret_async( assert response.secret_value == "secret_value_value" -@pytest.mark.asyncio -async def test_update_measurement_protocol_secret_async_from_dict(): - await test_update_measurement_protocol_secret_async(request_type=dict) - - def test_update_measurement_protocol_secret_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10187,8 +10240,8 @@ async def test_update_measurement_protocol_secret_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.AcknowledgeUserDataCollectionRequest, - dict, + analytics_admin.AcknowledgeUserDataCollectionRequest(), + {}, ], ) def test_acknowledge_user_data_collection(request_type, transport: str = "grpc"): @@ -10199,7 +10252,7 @@ def test_acknowledge_user_data_collection(request_type, transport: str = "grpc") # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10245,10 +10298,11 @@ def test_acknowledge_user_data_collection_non_empty_request_with_auto_populated_ client.acknowledge_user_data_collection(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.AcknowledgeUserDataCollectionRequest( + request_msg = analytics_admin.AcknowledgeUserDataCollectionRequest( property="property_value", acknowledgement="acknowledgement_value", ) + assert args[0] == request_msg def test_acknowledge_user_data_collection_use_cached_wrapped_rpc(): @@ -10334,9 +10388,15 @@ async def test_acknowledge_user_data_collection_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.AcknowledgeUserDataCollectionRequest(), + {}, + ], +) async def test_acknowledge_user_data_collection_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.AcknowledgeUserDataCollectionRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -10345,7 +10405,7 @@ async def test_acknowledge_user_data_collection_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( @@ -10367,11 +10427,6 @@ async def test_acknowledge_user_data_collection_async( assert isinstance(response, analytics_admin.AcknowledgeUserDataCollectionResponse) -@pytest.mark.asyncio -async def test_acknowledge_user_data_collection_async_from_dict(): - await test_acknowledge_user_data_collection_async(request_type=dict) - - def test_acknowledge_user_data_collection_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10440,8 +10495,8 @@ async def test_acknowledge_user_data_collection_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.SearchChangeHistoryEventsRequest, - dict, + analytics_admin.SearchChangeHistoryEventsRequest(), + {}, ], ) def test_search_change_history_events(request_type, transport: str = "grpc"): @@ -10452,7 +10507,7 @@ def test_search_change_history_events(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10502,11 +10557,12 @@ def test_search_change_history_events_non_empty_request_with_auto_populated_fiel client.search_change_history_events(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.SearchChangeHistoryEventsRequest( + request_msg = analytics_admin.SearchChangeHistoryEventsRequest( account="account_value", property="property_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_search_change_history_events_use_cached_wrapped_rpc(): @@ -10592,9 +10648,15 @@ async def test_search_change_history_events_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.SearchChangeHistoryEventsRequest(), + {}, + ], +) async def test_search_change_history_events_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.SearchChangeHistoryEventsRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -10603,7 +10665,7 @@ async def test_search_change_history_events_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( @@ -10628,11 +10690,6 @@ async def test_search_change_history_events_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_search_change_history_events_async_from_dict(): - await test_search_change_history_events_async(request_type=dict) - - def test_search_change_history_events_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10903,8 +10960,8 @@ async def test_search_change_history_events_async_pages(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.CreateConversionEventRequest, - dict, + analytics_admin.CreateConversionEventRequest(), + {}, ], ) def test_create_conversion_event(request_type, transport: str = "grpc"): @@ -10915,7 +10972,7 @@ def test_create_conversion_event(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10974,9 +11031,10 @@ def test_create_conversion_event_non_empty_request_with_auto_populated_field(): client.create_conversion_event(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateConversionEventRequest( + request_msg = analytics_admin.CreateConversionEventRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_conversion_event_use_cached_wrapped_rpc(): @@ -11062,9 +11120,15 @@ async def test_create_conversion_event_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.CreateConversionEventRequest(), + {}, + ], +) async def test_create_conversion_event_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.CreateConversionEventRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -11073,7 +11137,7 @@ async def test_create_conversion_event_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( @@ -11109,11 +11173,6 @@ async def test_create_conversion_event_async( ) -@pytest.mark.asyncio -async def test_create_conversion_event_async_from_dict(): - await test_create_conversion_event_async(request_type=dict) - - def test_create_conversion_event_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11278,8 +11337,8 @@ async def test_create_conversion_event_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdateConversionEventRequest, - dict, + analytics_admin.UpdateConversionEventRequest(), + {}, ], ) def test_update_conversion_event(request_type, transport: str = "grpc"): @@ -11290,7 +11349,7 @@ def test_update_conversion_event(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11347,7 +11406,8 @@ def test_update_conversion_event_non_empty_request_with_auto_populated_field(): client.update_conversion_event(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateConversionEventRequest() + request_msg = analytics_admin.UpdateConversionEventRequest() + assert args[0] == request_msg def test_update_conversion_event_use_cached_wrapped_rpc(): @@ -11433,9 +11493,15 @@ async def test_update_conversion_event_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.UpdateConversionEventRequest(), + {}, + ], +) async def test_update_conversion_event_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.UpdateConversionEventRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -11444,7 +11510,7 @@ async def test_update_conversion_event_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( @@ -11480,11 +11546,6 @@ async def test_update_conversion_event_async( ) -@pytest.mark.asyncio -async def test_update_conversion_event_async_from_dict(): - await test_update_conversion_event_async(request_type=dict) - - def test_update_conversion_event_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11649,8 +11710,8 @@ async def test_update_conversion_event_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetConversionEventRequest, - dict, + analytics_admin.GetConversionEventRequest(), + {}, ], ) def test_get_conversion_event(request_type, transport: str = "grpc"): @@ -11661,7 +11722,7 @@ def test_get_conversion_event(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11720,9 +11781,10 @@ def test_get_conversion_event_non_empty_request_with_auto_populated_field(): client.get_conversion_event(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetConversionEventRequest( + request_msg = analytics_admin.GetConversionEventRequest( name="name_value", ) + assert args[0] == request_msg def test_get_conversion_event_use_cached_wrapped_rpc(): @@ -11807,9 +11869,15 @@ async def test_get_conversion_event_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.GetConversionEventRequest(), + {}, + ], +) async def test_get_conversion_event_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.GetConversionEventRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -11818,7 +11886,7 @@ async def test_get_conversion_event_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( @@ -11854,11 +11922,6 @@ async def test_get_conversion_event_async( ) -@pytest.mark.asyncio -async def test_get_conversion_event_async_from_dict(): - await test_get_conversion_event_async(request_type=dict) - - def test_get_conversion_event_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12013,8 +12076,8 @@ async def test_get_conversion_event_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.DeleteConversionEventRequest, - dict, + analytics_admin.DeleteConversionEventRequest(), + {}, ], ) def test_delete_conversion_event(request_type, transport: str = "grpc"): @@ -12025,7 +12088,7 @@ def test_delete_conversion_event(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -12070,9 +12133,10 @@ def test_delete_conversion_event_non_empty_request_with_auto_populated_field(): client.delete_conversion_event(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.DeleteConversionEventRequest( + request_msg = analytics_admin.DeleteConversionEventRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_conversion_event_use_cached_wrapped_rpc(): @@ -12158,9 +12222,15 @@ async def test_delete_conversion_event_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.DeleteConversionEventRequest(), + {}, + ], +) async def test_delete_conversion_event_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.DeleteConversionEventRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -12169,7 +12239,7 @@ async def test_delete_conversion_event_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( @@ -12189,11 +12259,6 @@ async def test_delete_conversion_event_async( assert response is None -@pytest.mark.asyncio -async def test_delete_conversion_event_async_from_dict(): - await test_delete_conversion_event_async(request_type=dict) - - def test_delete_conversion_event_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12344,8 +12409,8 @@ async def test_delete_conversion_event_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListConversionEventsRequest, - dict, + analytics_admin.ListConversionEventsRequest(), + {}, ], ) def test_list_conversion_events(request_type, transport: str = "grpc"): @@ -12356,7 +12421,7 @@ def test_list_conversion_events(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -12405,10 +12470,11 @@ def test_list_conversion_events_non_empty_request_with_auto_populated_field(): client.list_conversion_events(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListConversionEventsRequest( + request_msg = analytics_admin.ListConversionEventsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_conversion_events_use_cached_wrapped_rpc(): @@ -12494,9 +12560,15 @@ async def test_list_conversion_events_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.ListConversionEventsRequest(), + {}, + ], +) async def test_list_conversion_events_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.ListConversionEventsRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -12505,7 +12577,7 @@ async def test_list_conversion_events_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( @@ -12530,11 +12602,6 @@ async def test_list_conversion_events_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_conversion_events_async_from_dict(): - await test_list_conversion_events_async(request_type=dict) - - def test_list_conversion_events_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12887,8 +12954,8 @@ async def test_list_conversion_events_async_pages(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.CreateKeyEventRequest, - dict, + analytics_admin.CreateKeyEventRequest(), + {}, ], ) def test_create_key_event(request_type, transport: str = "grpc"): @@ -12899,7 +12966,7 @@ def test_create_key_event(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_key_event), "__call__") as call: @@ -12951,9 +13018,10 @@ def test_create_key_event_non_empty_request_with_auto_populated_field(): client.create_key_event(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateKeyEventRequest( + request_msg = analytics_admin.CreateKeyEventRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_key_event_use_cached_wrapped_rpc(): @@ -13036,9 +13104,14 @@ async def test_create_key_event_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_key_event_async( - transport: str = "grpc_asyncio", request_type=analytics_admin.CreateKeyEventRequest -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.CreateKeyEventRequest(), + {}, + ], +) +async def test_create_key_event_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13046,7 +13119,7 @@ async def test_create_key_event_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_key_event), "__call__") as call: @@ -13077,11 +13150,6 @@ async def test_create_key_event_async( assert response.counting_method == resources.KeyEvent.CountingMethod.ONCE_PER_EVENT -@pytest.mark.asyncio -async def test_create_key_event_async_from_dict(): - await test_create_key_event_async(request_type=dict) - - def test_create_key_event_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13234,8 +13302,8 @@ async def test_create_key_event_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdateKeyEventRequest, - dict, + analytics_admin.UpdateKeyEventRequest(), + {}, ], ) def test_update_key_event(request_type, transport: str = "grpc"): @@ -13246,7 +13314,7 @@ def test_update_key_event(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_key_event), "__call__") as call: @@ -13296,7 +13364,8 @@ def test_update_key_event_non_empty_request_with_auto_populated_field(): client.update_key_event(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateKeyEventRequest() + request_msg = analytics_admin.UpdateKeyEventRequest() + assert args[0] == request_msg def test_update_key_event_use_cached_wrapped_rpc(): @@ -13379,9 +13448,14 @@ async def test_update_key_event_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_key_event_async( - transport: str = "grpc_asyncio", request_type=analytics_admin.UpdateKeyEventRequest -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.UpdateKeyEventRequest(), + {}, + ], +) +async def test_update_key_event_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13389,7 +13463,7 @@ async def test_update_key_event_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_key_event), "__call__") as call: @@ -13420,11 +13494,6 @@ async def test_update_key_event_async( assert response.counting_method == resources.KeyEvent.CountingMethod.ONCE_PER_EVENT -@pytest.mark.asyncio -async def test_update_key_event_async_from_dict(): - await test_update_key_event_async(request_type=dict) - - def test_update_key_event_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13577,8 +13646,8 @@ async def test_update_key_event_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetKeyEventRequest, - dict, + analytics_admin.GetKeyEventRequest(), + {}, ], ) def test_get_key_event(request_type, transport: str = "grpc"): @@ -13589,7 +13658,7 @@ def test_get_key_event(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_key_event), "__call__") as call: @@ -13641,9 +13710,10 @@ def test_get_key_event_non_empty_request_with_auto_populated_field(): client.get_key_event(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetKeyEventRequest( + request_msg = analytics_admin.GetKeyEventRequest( name="name_value", ) + assert args[0] == request_msg def test_get_key_event_use_cached_wrapped_rpc(): @@ -13724,9 +13794,14 @@ async def test_get_key_event_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_key_event_async( - transport: str = "grpc_asyncio", request_type=analytics_admin.GetKeyEventRequest -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.GetKeyEventRequest(), + {}, + ], +) +async def test_get_key_event_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13734,7 +13809,7 @@ async def test_get_key_event_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_key_event), "__call__") as call: @@ -13765,11 +13840,6 @@ async def test_get_key_event_async( assert response.counting_method == resources.KeyEvent.CountingMethod.ONCE_PER_EVENT -@pytest.mark.asyncio -async def test_get_key_event_async_from_dict(): - await test_get_key_event_async(request_type=dict) - - def test_get_key_event_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13912,8 +13982,8 @@ async def test_get_key_event_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.DeleteKeyEventRequest, - dict, + analytics_admin.DeleteKeyEventRequest(), + {}, ], ) def test_delete_key_event(request_type, transport: str = "grpc"): @@ -13924,7 +13994,7 @@ def test_delete_key_event(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_key_event), "__call__") as call: @@ -13965,9 +14035,10 @@ def test_delete_key_event_non_empty_request_with_auto_populated_field(): client.delete_key_event(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.DeleteKeyEventRequest( + request_msg = analytics_admin.DeleteKeyEventRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_key_event_use_cached_wrapped_rpc(): @@ -14050,9 +14121,14 @@ async def test_delete_key_event_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_key_event_async( - transport: str = "grpc_asyncio", request_type=analytics_admin.DeleteKeyEventRequest -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.DeleteKeyEventRequest(), + {}, + ], +) +async def test_delete_key_event_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14060,7 +14136,7 @@ async def test_delete_key_event_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_key_event), "__call__") as call: @@ -14078,11 +14154,6 @@ async def test_delete_key_event_async( assert response is None -@pytest.mark.asyncio -async def test_delete_key_event_async_from_dict(): - await test_delete_key_event_async(request_type=dict) - - def test_delete_key_event_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14225,8 +14296,8 @@ async def test_delete_key_event_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListKeyEventsRequest, - dict, + analytics_admin.ListKeyEventsRequest(), + {}, ], ) def test_list_key_events(request_type, transport: str = "grpc"): @@ -14237,7 +14308,7 @@ def test_list_key_events(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_key_events), "__call__") as call: @@ -14282,10 +14353,11 @@ def test_list_key_events_non_empty_request_with_auto_populated_field(): client.list_key_events(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListKeyEventsRequest( + request_msg = analytics_admin.ListKeyEventsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_key_events_use_cached_wrapped_rpc(): @@ -14366,9 +14438,14 @@ async def test_list_key_events_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_key_events_async( - transport: str = "grpc_asyncio", request_type=analytics_admin.ListKeyEventsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.ListKeyEventsRequest(), + {}, + ], +) +async def test_list_key_events_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14376,7 +14453,7 @@ async def test_list_key_events_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_key_events), "__call__") as call: @@ -14399,11 +14476,6 @@ async def test_list_key_events_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_key_events_async_from_dict(): - await test_list_key_events_async(request_type=dict) - - def test_list_key_events_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14740,8 +14812,8 @@ async def test_list_key_events_async_pages(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.CreateCustomDimensionRequest, - dict, + analytics_admin.CreateCustomDimensionRequest(), + {}, ], ) def test_create_custom_dimension(request_type, transport: str = "grpc"): @@ -14752,7 +14824,7 @@ def test_create_custom_dimension(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -14810,9 +14882,10 @@ def test_create_custom_dimension_non_empty_request_with_auto_populated_field(): client.create_custom_dimension(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateCustomDimensionRequest( + request_msg = analytics_admin.CreateCustomDimensionRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_custom_dimension_use_cached_wrapped_rpc(): @@ -14898,9 +14971,15 @@ async def test_create_custom_dimension_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.CreateCustomDimensionRequest(), + {}, + ], +) async def test_create_custom_dimension_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.CreateCustomDimensionRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -14909,7 +14988,7 @@ async def test_create_custom_dimension_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( @@ -14944,11 +15023,6 @@ async def test_create_custom_dimension_async( assert response.disallow_ads_personalization is True -@pytest.mark.asyncio -async def test_create_custom_dimension_async_from_dict(): - await test_create_custom_dimension_async(request_type=dict) - - def test_create_custom_dimension_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15113,8 +15187,8 @@ async def test_create_custom_dimension_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdateCustomDimensionRequest, - dict, + analytics_admin.UpdateCustomDimensionRequest(), + {}, ], ) def test_update_custom_dimension(request_type, transport: str = "grpc"): @@ -15125,7 +15199,7 @@ def test_update_custom_dimension(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -15181,7 +15255,8 @@ def test_update_custom_dimension_non_empty_request_with_auto_populated_field(): client.update_custom_dimension(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateCustomDimensionRequest() + request_msg = analytics_admin.UpdateCustomDimensionRequest() + assert args[0] == request_msg def test_update_custom_dimension_use_cached_wrapped_rpc(): @@ -15267,9 +15342,15 @@ async def test_update_custom_dimension_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.UpdateCustomDimensionRequest(), + {}, + ], +) async def test_update_custom_dimension_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.UpdateCustomDimensionRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -15278,7 +15359,7 @@ async def test_update_custom_dimension_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( @@ -15313,11 +15394,6 @@ async def test_update_custom_dimension_async( assert response.disallow_ads_personalization is True -@pytest.mark.asyncio -async def test_update_custom_dimension_async_from_dict(): - await test_update_custom_dimension_async(request_type=dict) - - def test_update_custom_dimension_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15482,8 +15558,8 @@ async def test_update_custom_dimension_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListCustomDimensionsRequest, - dict, + analytics_admin.ListCustomDimensionsRequest(), + {}, ], ) def test_list_custom_dimensions(request_type, transport: str = "grpc"): @@ -15494,7 +15570,7 @@ def test_list_custom_dimensions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -15543,10 +15619,11 @@ def test_list_custom_dimensions_non_empty_request_with_auto_populated_field(): client.list_custom_dimensions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListCustomDimensionsRequest( + request_msg = analytics_admin.ListCustomDimensionsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_custom_dimensions_use_cached_wrapped_rpc(): @@ -15632,9 +15709,15 @@ async def test_list_custom_dimensions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.ListCustomDimensionsRequest(), + {}, + ], +) async def test_list_custom_dimensions_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.ListCustomDimensionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -15643,7 +15726,7 @@ async def test_list_custom_dimensions_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( @@ -15668,11 +15751,6 @@ async def test_list_custom_dimensions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_custom_dimensions_async_from_dict(): - await test_list_custom_dimensions_async(request_type=dict) - - def test_list_custom_dimensions_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16025,8 +16103,8 @@ async def test_list_custom_dimensions_async_pages(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.ArchiveCustomDimensionRequest, - dict, + analytics_admin.ArchiveCustomDimensionRequest(), + {}, ], ) def test_archive_custom_dimension(request_type, transport: str = "grpc"): @@ -16037,7 +16115,7 @@ def test_archive_custom_dimension(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -16082,9 +16160,10 @@ def test_archive_custom_dimension_non_empty_request_with_auto_populated_field(): client.archive_custom_dimension(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ArchiveCustomDimensionRequest( + request_msg = analytics_admin.ArchiveCustomDimensionRequest( name="name_value", ) + assert args[0] == request_msg def test_archive_custom_dimension_use_cached_wrapped_rpc(): @@ -16170,9 +16249,15 @@ async def test_archive_custom_dimension_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.ArchiveCustomDimensionRequest(), + {}, + ], +) async def test_archive_custom_dimension_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.ArchiveCustomDimensionRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -16181,7 +16266,7 @@ async def test_archive_custom_dimension_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( @@ -16201,11 +16286,6 @@ async def test_archive_custom_dimension_async( assert response is None -@pytest.mark.asyncio -async def test_archive_custom_dimension_async_from_dict(): - await test_archive_custom_dimension_async(request_type=dict) - - def test_archive_custom_dimension_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16356,8 +16436,8 @@ async def test_archive_custom_dimension_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetCustomDimensionRequest, - dict, + analytics_admin.GetCustomDimensionRequest(), + {}, ], ) def test_get_custom_dimension(request_type, transport: str = "grpc"): @@ -16368,7 +16448,7 @@ def test_get_custom_dimension(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -16426,9 +16506,10 @@ def test_get_custom_dimension_non_empty_request_with_auto_populated_field(): client.get_custom_dimension(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetCustomDimensionRequest( + request_msg = analytics_admin.GetCustomDimensionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_custom_dimension_use_cached_wrapped_rpc(): @@ -16513,9 +16594,15 @@ async def test_get_custom_dimension_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.GetCustomDimensionRequest(), + {}, + ], +) async def test_get_custom_dimension_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.GetCustomDimensionRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -16524,7 +16611,7 @@ async def test_get_custom_dimension_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( @@ -16559,11 +16646,6 @@ async def test_get_custom_dimension_async( assert response.disallow_ads_personalization is True -@pytest.mark.asyncio -async def test_get_custom_dimension_async_from_dict(): - await test_get_custom_dimension_async(request_type=dict) - - def test_get_custom_dimension_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16718,8 +16800,8 @@ async def test_get_custom_dimension_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.CreateCustomMetricRequest, - dict, + analytics_admin.CreateCustomMetricRequest(), + {}, ], ) def test_create_custom_metric(request_type, transport: str = "grpc"): @@ -16730,7 +16812,7 @@ def test_create_custom_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( @@ -16794,9 +16876,10 @@ def test_create_custom_metric_non_empty_request_with_auto_populated_field(): client.create_custom_metric(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateCustomMetricRequest( + request_msg = analytics_admin.CreateCustomMetricRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_custom_metric_use_cached_wrapped_rpc(): @@ -16881,9 +16964,15 @@ async def test_create_custom_metric_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.CreateCustomMetricRequest(), + {}, + ], +) async def test_create_custom_metric_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.CreateCustomMetricRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -16892,7 +16981,7 @@ async def test_create_custom_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( @@ -16933,11 +17022,6 @@ async def test_create_custom_metric_async( ] -@pytest.mark.asyncio -async def test_create_custom_metric_async_from_dict(): - await test_create_custom_metric_async(request_type=dict) - - def test_create_custom_metric_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17102,8 +17186,8 @@ async def test_create_custom_metric_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdateCustomMetricRequest, - dict, + analytics_admin.UpdateCustomMetricRequest(), + {}, ], ) def test_update_custom_metric(request_type, transport: str = "grpc"): @@ -17114,7 +17198,7 @@ def test_update_custom_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( @@ -17176,7 +17260,8 @@ def test_update_custom_metric_non_empty_request_with_auto_populated_field(): client.update_custom_metric(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateCustomMetricRequest() + request_msg = analytics_admin.UpdateCustomMetricRequest() + assert args[0] == request_msg def test_update_custom_metric_use_cached_wrapped_rpc(): @@ -17261,9 +17346,15 @@ async def test_update_custom_metric_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.UpdateCustomMetricRequest(), + {}, + ], +) async def test_update_custom_metric_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.UpdateCustomMetricRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -17272,7 +17363,7 @@ async def test_update_custom_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( @@ -17313,11 +17404,6 @@ async def test_update_custom_metric_async( ] -@pytest.mark.asyncio -async def test_update_custom_metric_async_from_dict(): - await test_update_custom_metric_async(request_type=dict) - - def test_update_custom_metric_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17482,8 +17568,8 @@ async def test_update_custom_metric_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListCustomMetricsRequest, - dict, + analytics_admin.ListCustomMetricsRequest(), + {}, ], ) def test_list_custom_metrics(request_type, transport: str = "grpc"): @@ -17494,7 +17580,7 @@ def test_list_custom_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( @@ -17543,10 +17629,11 @@ def test_list_custom_metrics_non_empty_request_with_auto_populated_field(): client.list_custom_metrics(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListCustomMetricsRequest( + request_msg = analytics_admin.ListCustomMetricsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_custom_metrics_use_cached_wrapped_rpc(): @@ -17631,10 +17718,14 @@ async def test_list_custom_metrics_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_custom_metrics_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.ListCustomMetricsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.ListCustomMetricsRequest(), + {}, + ], +) +async def test_list_custom_metrics_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -17642,7 +17733,7 @@ async def test_list_custom_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( @@ -17667,11 +17758,6 @@ async def test_list_custom_metrics_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_custom_metrics_async_from_dict(): - await test_list_custom_metrics_async(request_type=dict) - - def test_list_custom_metrics_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18024,8 +18110,8 @@ async def test_list_custom_metrics_async_pages(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.ArchiveCustomMetricRequest, - dict, + analytics_admin.ArchiveCustomMetricRequest(), + {}, ], ) def test_archive_custom_metric(request_type, transport: str = "grpc"): @@ -18036,7 +18122,7 @@ def test_archive_custom_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( @@ -18081,9 +18167,10 @@ def test_archive_custom_metric_non_empty_request_with_auto_populated_field(): client.archive_custom_metric(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ArchiveCustomMetricRequest( + request_msg = analytics_admin.ArchiveCustomMetricRequest( name="name_value", ) + assert args[0] == request_msg def test_archive_custom_metric_use_cached_wrapped_rpc(): @@ -18169,9 +18256,15 @@ async def test_archive_custom_metric_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.ArchiveCustomMetricRequest(), + {}, + ], +) async def test_archive_custom_metric_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.ArchiveCustomMetricRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -18180,7 +18273,7 @@ async def test_archive_custom_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( @@ -18200,11 +18293,6 @@ async def test_archive_custom_metric_async( assert response is None -@pytest.mark.asyncio -async def test_archive_custom_metric_async_from_dict(): - await test_archive_custom_metric_async(request_type=dict) - - def test_archive_custom_metric_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18355,8 +18443,8 @@ async def test_archive_custom_metric_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetCustomMetricRequest, - dict, + analytics_admin.GetCustomMetricRequest(), + {}, ], ) def test_get_custom_metric(request_type, transport: str = "grpc"): @@ -18367,7 +18455,7 @@ def test_get_custom_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( @@ -18431,9 +18519,10 @@ def test_get_custom_metric_non_empty_request_with_auto_populated_field(): client.get_custom_metric(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetCustomMetricRequest( + request_msg = analytics_admin.GetCustomMetricRequest( name="name_value", ) + assert args[0] == request_msg def test_get_custom_metric_use_cached_wrapped_rpc(): @@ -18516,9 +18605,14 @@ async def test_get_custom_metric_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_custom_metric_async( - transport: str = "grpc_asyncio", request_type=analytics_admin.GetCustomMetricRequest -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.GetCustomMetricRequest(), + {}, + ], +) +async def test_get_custom_metric_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -18526,7 +18620,7 @@ async def test_get_custom_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( @@ -18567,11 +18661,6 @@ async def test_get_custom_metric_async( ] -@pytest.mark.asyncio -async def test_get_custom_metric_async_from_dict(): - await test_get_custom_metric_async(request_type=dict) - - def test_get_custom_metric_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18726,8 +18815,8 @@ async def test_get_custom_metric_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetDataRetentionSettingsRequest, - dict, + analytics_admin.GetDataRetentionSettingsRequest(), + {}, ], ) def test_get_data_retention_settings(request_type, transport: str = "grpc"): @@ -18738,7 +18827,7 @@ def test_get_data_retention_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( @@ -18798,9 +18887,10 @@ def test_get_data_retention_settings_non_empty_request_with_auto_populated_field client.get_data_retention_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetDataRetentionSettingsRequest( + request_msg = analytics_admin.GetDataRetentionSettingsRequest( name="name_value", ) + assert args[0] == request_msg def test_get_data_retention_settings_use_cached_wrapped_rpc(): @@ -18886,9 +18976,15 @@ async def test_get_data_retention_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.GetDataRetentionSettingsRequest(), + {}, + ], +) async def test_get_data_retention_settings_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.GetDataRetentionSettingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -18897,7 +18993,7 @@ async def test_get_data_retention_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( @@ -18934,11 +19030,6 @@ async def test_get_data_retention_settings_async( assert response.reset_user_data_on_new_activity is True -@pytest.mark.asyncio -async def test_get_data_retention_settings_async_from_dict(): - await test_get_data_retention_settings_async(request_type=dict) - - def test_get_data_retention_settings_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -19093,8 +19184,8 @@ async def test_get_data_retention_settings_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdateDataRetentionSettingsRequest, - dict, + analytics_admin.UpdateDataRetentionSettingsRequest(), + {}, ], ) def test_update_data_retention_settings(request_type, transport: str = "grpc"): @@ -19105,7 +19196,7 @@ def test_update_data_retention_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( @@ -19163,7 +19254,8 @@ def test_update_data_retention_settings_non_empty_request_with_auto_populated_fi client.update_data_retention_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateDataRetentionSettingsRequest() + request_msg = analytics_admin.UpdateDataRetentionSettingsRequest() + assert args[0] == request_msg def test_update_data_retention_settings_use_cached_wrapped_rpc(): @@ -19249,9 +19341,15 @@ async def test_update_data_retention_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.UpdateDataRetentionSettingsRequest(), + {}, + ], +) async def test_update_data_retention_settings_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.UpdateDataRetentionSettingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -19260,7 +19358,7 @@ async def test_update_data_retention_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( @@ -19297,11 +19395,6 @@ async def test_update_data_retention_settings_async( assert response.reset_user_data_on_new_activity is True -@pytest.mark.asyncio -async def test_update_data_retention_settings_async_from_dict(): - await test_update_data_retention_settings_async(request_type=dict) - - def test_update_data_retention_settings_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -19466,8 +19559,8 @@ async def test_update_data_retention_settings_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.CreateDataStreamRequest, - dict, + analytics_admin.CreateDataStreamRequest(), + {}, ], ) def test_create_data_stream(request_type, transport: str = "grpc"): @@ -19478,7 +19571,7 @@ def test_create_data_stream(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -19530,9 +19623,10 @@ def test_create_data_stream_non_empty_request_with_auto_populated_field(): client.create_data_stream(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateDataStreamRequest( + request_msg = analytics_admin.CreateDataStreamRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_data_stream_use_cached_wrapped_rpc(): @@ -19617,10 +19711,14 @@ async def test_create_data_stream_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_data_stream_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.CreateDataStreamRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.CreateDataStreamRequest(), + {}, + ], +) +async def test_create_data_stream_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -19628,7 +19726,7 @@ async def test_create_data_stream_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( @@ -19657,11 +19755,6 @@ async def test_create_data_stream_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_create_data_stream_async_from_dict(): - await test_create_data_stream_async(request_type=dict) - - def test_create_data_stream_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -19850,8 +19943,8 @@ async def test_create_data_stream_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.DeleteDataStreamRequest, - dict, + analytics_admin.DeleteDataStreamRequest(), + {}, ], ) def test_delete_data_stream(request_type, transport: str = "grpc"): @@ -19862,7 +19955,7 @@ def test_delete_data_stream(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -19907,9 +20000,10 @@ def test_delete_data_stream_non_empty_request_with_auto_populated_field(): client.delete_data_stream(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.DeleteDataStreamRequest( + request_msg = analytics_admin.DeleteDataStreamRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_data_stream_use_cached_wrapped_rpc(): @@ -19994,10 +20088,14 @@ async def test_delete_data_stream_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_data_stream_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.DeleteDataStreamRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.DeleteDataStreamRequest(), + {}, + ], +) +async def test_delete_data_stream_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -20005,7 +20103,7 @@ async def test_delete_data_stream_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( @@ -20025,11 +20123,6 @@ async def test_delete_data_stream_async( assert response is None -@pytest.mark.asyncio -async def test_delete_data_stream_async_from_dict(): - await test_delete_data_stream_async(request_type=dict) - - def test_delete_data_stream_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -20180,8 +20273,8 @@ async def test_delete_data_stream_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdateDataStreamRequest, - dict, + analytics_admin.UpdateDataStreamRequest(), + {}, ], ) def test_update_data_stream(request_type, transport: str = "grpc"): @@ -20192,7 +20285,7 @@ def test_update_data_stream(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -20242,7 +20335,8 @@ def test_update_data_stream_non_empty_request_with_auto_populated_field(): client.update_data_stream(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateDataStreamRequest() + request_msg = analytics_admin.UpdateDataStreamRequest() + assert args[0] == request_msg def test_update_data_stream_use_cached_wrapped_rpc(): @@ -20327,10 +20421,14 @@ async def test_update_data_stream_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_data_stream_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.UpdateDataStreamRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.UpdateDataStreamRequest(), + {}, + ], +) +async def test_update_data_stream_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -20338,7 +20436,7 @@ async def test_update_data_stream_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( @@ -20367,11 +20465,6 @@ async def test_update_data_stream_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_update_data_stream_async_from_dict(): - await test_update_data_stream_async(request_type=dict) - - def test_update_data_stream_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -20560,8 +20653,8 @@ async def test_update_data_stream_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListDataStreamsRequest, - dict, + analytics_admin.ListDataStreamsRequest(), + {}, ], ) def test_list_data_streams(request_type, transport: str = "grpc"): @@ -20572,7 +20665,7 @@ def test_list_data_streams(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -20621,10 +20714,11 @@ def test_list_data_streams_non_empty_request_with_auto_populated_field(): client.list_data_streams(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListDataStreamsRequest( + request_msg = analytics_admin.ListDataStreamsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_data_streams_use_cached_wrapped_rpc(): @@ -20707,9 +20801,14 @@ async def test_list_data_streams_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_data_streams_async( - transport: str = "grpc_asyncio", request_type=analytics_admin.ListDataStreamsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.ListDataStreamsRequest(), + {}, + ], +) +async def test_list_data_streams_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -20717,7 +20816,7 @@ async def test_list_data_streams_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( @@ -20742,11 +20841,6 @@ async def test_list_data_streams_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_data_streams_async_from_dict(): - await test_list_data_streams_async(request_type=dict) - - def test_list_data_streams_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -21099,8 +21193,8 @@ async def test_list_data_streams_async_pages(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetDataStreamRequest, - dict, + analytics_admin.GetDataStreamRequest(), + {}, ], ) def test_get_data_stream(request_type, transport: str = "grpc"): @@ -21111,7 +21205,7 @@ def test_get_data_stream(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_data_stream), "__call__") as call: @@ -21159,9 +21253,10 @@ def test_get_data_stream_non_empty_request_with_auto_populated_field(): client.get_data_stream(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetDataStreamRequest( + request_msg = analytics_admin.GetDataStreamRequest( name="name_value", ) + assert args[0] == request_msg def test_get_data_stream_use_cached_wrapped_rpc(): @@ -21242,9 +21337,14 @@ async def test_get_data_stream_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_data_stream_async( - transport: str = "grpc_asyncio", request_type=analytics_admin.GetDataStreamRequest -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.GetDataStreamRequest(), + {}, + ], +) +async def test_get_data_stream_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -21252,7 +21352,7 @@ async def test_get_data_stream_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_data_stream), "__call__") as call: @@ -21279,11 +21379,6 @@ async def test_get_data_stream_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_get_data_stream_async_from_dict(): - await test_get_data_stream_async(request_type=dict) - - def test_get_data_stream_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -21430,8 +21525,8 @@ async def test_get_data_stream_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.RunAccessReportRequest, - dict, + analytics_admin.RunAccessReportRequest(), + {}, ], ) def test_run_access_report(request_type, transport: str = "grpc"): @@ -21442,7 +21537,7 @@ def test_run_access_report(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -21491,10 +21586,11 @@ def test_run_access_report_non_empty_request_with_auto_populated_field(): client.run_access_report(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.RunAccessReportRequest( + request_msg = analytics_admin.RunAccessReportRequest( entity="entity_value", time_zone="time_zone_value", ) + assert args[0] == request_msg def test_run_access_report_use_cached_wrapped_rpc(): @@ -21577,9 +21673,14 @@ async def test_run_access_report_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_run_access_report_async( - transport: str = "grpc_asyncio", request_type=analytics_admin.RunAccessReportRequest -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.RunAccessReportRequest(), + {}, + ], +) +async def test_run_access_report_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsAdminServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -21587,7 +21688,7 @@ async def test_run_access_report_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( @@ -21612,11 +21713,6 @@ async def test_run_access_report_async( assert response.row_count == 992 -@pytest.mark.asyncio -async def test_run_access_report_async_from_dict(): - await test_run_access_report_async(request_type=dict) - - def test_run_access_report_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -31904,7 +32000,6 @@ def test_get_account_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetAccountRequest() - assert args[0] == request_msg @@ -31925,7 +32020,6 @@ def test_list_accounts_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListAccountsRequest() - assert args[0] == request_msg @@ -31946,7 +32040,6 @@ def test_delete_account_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteAccountRequest() - assert args[0] == request_msg @@ -31967,7 +32060,6 @@ def test_update_account_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateAccountRequest() - assert args[0] == request_msg @@ -31990,7 +32082,6 @@ def test_provision_account_ticket_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ProvisionAccountTicketRequest() - assert args[0] == request_msg @@ -32013,7 +32104,6 @@ def test_list_account_summaries_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListAccountSummariesRequest() - assert args[0] == request_msg @@ -32034,7 +32124,6 @@ def test_get_property_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetPropertyRequest() - assert args[0] == request_msg @@ -32055,7 +32144,6 @@ def test_list_properties_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListPropertiesRequest() - assert args[0] == request_msg @@ -32076,7 +32164,6 @@ def test_create_property_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreatePropertyRequest() - assert args[0] == request_msg @@ -32097,7 +32184,6 @@ def test_delete_property_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeletePropertyRequest() - assert args[0] == request_msg @@ -32118,7 +32204,6 @@ def test_update_property_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdatePropertyRequest() - assert args[0] == request_msg @@ -32141,7 +32226,6 @@ def test_create_firebase_link_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateFirebaseLinkRequest() - assert args[0] == request_msg @@ -32164,7 +32248,6 @@ def test_delete_firebase_link_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteFirebaseLinkRequest() - assert args[0] == request_msg @@ -32187,7 +32270,6 @@ def test_list_firebase_links_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListFirebaseLinksRequest() - assert args[0] == request_msg @@ -32210,7 +32292,6 @@ def test_create_google_ads_link_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateGoogleAdsLinkRequest() - assert args[0] == request_msg @@ -32233,7 +32314,6 @@ def test_update_google_ads_link_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateGoogleAdsLinkRequest() - assert args[0] == request_msg @@ -32256,7 +32336,6 @@ def test_delete_google_ads_link_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteGoogleAdsLinkRequest() - assert args[0] == request_msg @@ -32279,7 +32358,6 @@ def test_list_google_ads_links_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListGoogleAdsLinksRequest() - assert args[0] == request_msg @@ -32302,7 +32380,6 @@ def test_get_data_sharing_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetDataSharingSettingsRequest() - assert args[0] == request_msg @@ -32325,7 +32402,6 @@ def test_get_measurement_protocol_secret_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetMeasurementProtocolSecretRequest() - assert args[0] == request_msg @@ -32348,7 +32424,6 @@ def test_list_measurement_protocol_secrets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListMeasurementProtocolSecretsRequest() - assert args[0] == request_msg @@ -32371,7 +32446,6 @@ def test_create_measurement_protocol_secret_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateMeasurementProtocolSecretRequest() - assert args[0] == request_msg @@ -32394,7 +32468,6 @@ def test_delete_measurement_protocol_secret_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteMeasurementProtocolSecretRequest() - assert args[0] == request_msg @@ -32417,7 +32490,6 @@ def test_update_measurement_protocol_secret_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateMeasurementProtocolSecretRequest() - assert args[0] == request_msg @@ -32440,7 +32512,6 @@ def test_acknowledge_user_data_collection_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.AcknowledgeUserDataCollectionRequest() - assert args[0] == request_msg @@ -32463,7 +32534,6 @@ def test_search_change_history_events_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.SearchChangeHistoryEventsRequest() - assert args[0] == request_msg @@ -32486,7 +32556,6 @@ def test_create_conversion_event_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateConversionEventRequest() - assert args[0] == request_msg @@ -32509,7 +32578,6 @@ def test_update_conversion_event_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateConversionEventRequest() - assert args[0] == request_msg @@ -32532,7 +32600,6 @@ def test_get_conversion_event_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetConversionEventRequest() - assert args[0] == request_msg @@ -32555,7 +32622,6 @@ def test_delete_conversion_event_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteConversionEventRequest() - assert args[0] == request_msg @@ -32578,7 +32644,6 @@ def test_list_conversion_events_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListConversionEventsRequest() - assert args[0] == request_msg @@ -32599,7 +32664,6 @@ def test_create_key_event_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateKeyEventRequest() - assert args[0] == request_msg @@ -32620,7 +32684,6 @@ def test_update_key_event_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateKeyEventRequest() - assert args[0] == request_msg @@ -32641,7 +32704,6 @@ def test_get_key_event_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetKeyEventRequest() - assert args[0] == request_msg @@ -32662,7 +32724,6 @@ def test_delete_key_event_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteKeyEventRequest() - assert args[0] == request_msg @@ -32683,7 +32744,6 @@ def test_list_key_events_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListKeyEventsRequest() - assert args[0] == request_msg @@ -32706,7 +32766,6 @@ def test_create_custom_dimension_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateCustomDimensionRequest() - assert args[0] == request_msg @@ -32729,7 +32788,6 @@ def test_update_custom_dimension_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateCustomDimensionRequest() - assert args[0] == request_msg @@ -32752,7 +32810,6 @@ def test_list_custom_dimensions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListCustomDimensionsRequest() - assert args[0] == request_msg @@ -32775,7 +32832,6 @@ def test_archive_custom_dimension_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ArchiveCustomDimensionRequest() - assert args[0] == request_msg @@ -32798,7 +32854,6 @@ def test_get_custom_dimension_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetCustomDimensionRequest() - assert args[0] == request_msg @@ -32821,7 +32876,6 @@ def test_create_custom_metric_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateCustomMetricRequest() - assert args[0] == request_msg @@ -32844,7 +32898,6 @@ def test_update_custom_metric_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateCustomMetricRequest() - assert args[0] == request_msg @@ -32867,7 +32920,6 @@ def test_list_custom_metrics_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListCustomMetricsRequest() - assert args[0] == request_msg @@ -32890,7 +32942,6 @@ def test_archive_custom_metric_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ArchiveCustomMetricRequest() - assert args[0] == request_msg @@ -32913,7 +32964,6 @@ def test_get_custom_metric_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetCustomMetricRequest() - assert args[0] == request_msg @@ -32936,7 +32986,6 @@ def test_get_data_retention_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetDataRetentionSettingsRequest() - assert args[0] == request_msg @@ -32959,7 +33008,6 @@ def test_update_data_retention_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateDataRetentionSettingsRequest() - assert args[0] == request_msg @@ -32982,7 +33030,6 @@ def test_create_data_stream_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateDataStreamRequest() - assert args[0] == request_msg @@ -33005,7 +33052,6 @@ def test_delete_data_stream_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteDataStreamRequest() - assert args[0] == request_msg @@ -33028,7 +33074,6 @@ def test_update_data_stream_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateDataStreamRequest() - assert args[0] == request_msg @@ -33051,7 +33096,6 @@ def test_list_data_streams_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListDataStreamsRequest() - assert args[0] == request_msg @@ -33072,7 +33116,6 @@ def test_get_data_stream_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetDataStreamRequest() - assert args[0] == request_msg @@ -33095,7 +33138,6 @@ def test_run_access_report_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.RunAccessReportRequest() - assert args[0] == request_msg @@ -33140,7 +33182,6 @@ async def test_get_account_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetAccountRequest() - assert args[0] == request_msg @@ -33167,7 +33208,6 @@ async def test_list_accounts_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListAccountsRequest() - assert args[0] == request_msg @@ -33190,7 +33230,6 @@ async def test_delete_account_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteAccountRequest() - assert args[0] == request_msg @@ -33221,7 +33260,6 @@ async def test_update_account_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateAccountRequest() - assert args[0] == request_msg @@ -33250,7 +33288,6 @@ async def test_provision_account_ticket_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ProvisionAccountTicketRequest() - assert args[0] == request_msg @@ -33279,7 +33316,6 @@ async def test_list_account_summaries_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListAccountSummariesRequest() - assert args[0] == request_msg @@ -33314,7 +33350,6 @@ async def test_get_property_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetPropertyRequest() - assert args[0] == request_msg @@ -33341,7 +33376,6 @@ async def test_list_properties_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListPropertiesRequest() - assert args[0] == request_msg @@ -33376,7 +33410,6 @@ async def test_create_property_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreatePropertyRequest() - assert args[0] == request_msg @@ -33411,7 +33444,6 @@ async def test_delete_property_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeletePropertyRequest() - assert args[0] == request_msg @@ -33446,7 +33478,6 @@ async def test_update_property_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdatePropertyRequest() - assert args[0] == request_msg @@ -33476,7 +33507,6 @@ async def test_create_firebase_link_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateFirebaseLinkRequest() - assert args[0] == request_msg @@ -33501,7 +33531,6 @@ async def test_delete_firebase_link_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteFirebaseLinkRequest() - assert args[0] == request_msg @@ -33530,7 +33559,6 @@ async def test_list_firebase_links_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListFirebaseLinksRequest() - assert args[0] == request_msg @@ -33562,7 +33590,6 @@ async def test_create_google_ads_link_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateGoogleAdsLinkRequest() - assert args[0] == request_msg @@ -33594,7 +33621,6 @@ async def test_update_google_ads_link_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateGoogleAdsLinkRequest() - assert args[0] == request_msg @@ -33619,7 +33645,6 @@ async def test_delete_google_ads_link_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteGoogleAdsLinkRequest() - assert args[0] == request_msg @@ -33648,7 +33673,6 @@ async def test_list_google_ads_links_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListGoogleAdsLinksRequest() - assert args[0] == request_msg @@ -33682,7 +33706,6 @@ async def test_get_data_sharing_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetDataSharingSettingsRequest() - assert args[0] == request_msg @@ -33713,7 +33736,6 @@ async def test_get_measurement_protocol_secret_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetMeasurementProtocolSecretRequest() - assert args[0] == request_msg @@ -33742,7 +33764,6 @@ async def test_list_measurement_protocol_secrets_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListMeasurementProtocolSecretsRequest() - assert args[0] == request_msg @@ -33773,7 +33794,6 @@ async def test_create_measurement_protocol_secret_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateMeasurementProtocolSecretRequest() - assert args[0] == request_msg @@ -33798,7 +33818,6 @@ async def test_delete_measurement_protocol_secret_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteMeasurementProtocolSecretRequest() - assert args[0] == request_msg @@ -33829,7 +33848,6 @@ async def test_update_measurement_protocol_secret_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateMeasurementProtocolSecretRequest() - assert args[0] == request_msg @@ -33856,7 +33874,6 @@ async def test_acknowledge_user_data_collection_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.AcknowledgeUserDataCollectionRequest() - assert args[0] == request_msg @@ -33885,7 +33902,6 @@ async def test_search_change_history_events_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.SearchChangeHistoryEventsRequest() - assert args[0] == request_msg @@ -33918,7 +33934,6 @@ async def test_create_conversion_event_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateConversionEventRequest() - assert args[0] == request_msg @@ -33951,7 +33966,6 @@ async def test_update_conversion_event_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateConversionEventRequest() - assert args[0] == request_msg @@ -33984,7 +33998,6 @@ async def test_get_conversion_event_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetConversionEventRequest() - assert args[0] == request_msg @@ -34009,7 +34022,6 @@ async def test_delete_conversion_event_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteConversionEventRequest() - assert args[0] == request_msg @@ -34038,7 +34050,6 @@ async def test_list_conversion_events_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListConversionEventsRequest() - assert args[0] == request_msg @@ -34069,7 +34080,6 @@ async def test_create_key_event_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateKeyEventRequest() - assert args[0] == request_msg @@ -34100,7 +34110,6 @@ async def test_update_key_event_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateKeyEventRequest() - assert args[0] == request_msg @@ -34131,7 +34140,6 @@ async def test_get_key_event_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetKeyEventRequest() - assert args[0] == request_msg @@ -34154,7 +34162,6 @@ async def test_delete_key_event_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteKeyEventRequest() - assert args[0] == request_msg @@ -34181,7 +34188,6 @@ async def test_list_key_events_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListKeyEventsRequest() - assert args[0] == request_msg @@ -34215,7 +34221,6 @@ async def test_create_custom_dimension_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateCustomDimensionRequest() - assert args[0] == request_msg @@ -34249,7 +34254,6 @@ async def test_update_custom_dimension_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateCustomDimensionRequest() - assert args[0] == request_msg @@ -34278,7 +34282,6 @@ async def test_list_custom_dimensions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListCustomDimensionsRequest() - assert args[0] == request_msg @@ -34303,7 +34306,6 @@ async def test_archive_custom_dimension_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ArchiveCustomDimensionRequest() - assert args[0] == request_msg @@ -34337,7 +34339,6 @@ async def test_get_custom_dimension_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetCustomDimensionRequest() - assert args[0] == request_msg @@ -34374,7 +34375,6 @@ async def test_create_custom_metric_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateCustomMetricRequest() - assert args[0] == request_msg @@ -34411,7 +34411,6 @@ async def test_update_custom_metric_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateCustomMetricRequest() - assert args[0] == request_msg @@ -34440,7 +34439,6 @@ async def test_list_custom_metrics_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListCustomMetricsRequest() - assert args[0] == request_msg @@ -34465,7 +34463,6 @@ async def test_archive_custom_metric_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ArchiveCustomMetricRequest() - assert args[0] == request_msg @@ -34502,7 +34499,6 @@ async def test_get_custom_metric_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetCustomMetricRequest() - assert args[0] == request_msg @@ -34534,7 +34530,6 @@ async def test_get_data_retention_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetDataRetentionSettingsRequest() - assert args[0] == request_msg @@ -34566,7 +34561,6 @@ async def test_update_data_retention_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateDataRetentionSettingsRequest() - assert args[0] == request_msg @@ -34597,7 +34591,6 @@ async def test_create_data_stream_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateDataStreamRequest() - assert args[0] == request_msg @@ -34622,7 +34615,6 @@ async def test_delete_data_stream_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteDataStreamRequest() - assert args[0] == request_msg @@ -34653,7 +34645,6 @@ async def test_update_data_stream_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateDataStreamRequest() - assert args[0] == request_msg @@ -34682,7 +34673,6 @@ async def test_list_data_streams_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListDataStreamsRequest() - assert args[0] == request_msg @@ -34711,7 +34701,6 @@ async def test_get_data_stream_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetDataStreamRequest() - assert args[0] == request_msg @@ -34740,7 +34729,6 @@ async def test_run_access_report_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.RunAccessReportRequest() - assert args[0] == request_msg @@ -43621,7 +43609,6 @@ def test_get_account_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetAccountRequest() - assert args[0] == request_msg @@ -43641,7 +43628,6 @@ def test_list_accounts_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListAccountsRequest() - assert args[0] == request_msg @@ -43661,7 +43647,6 @@ def test_delete_account_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteAccountRequest() - assert args[0] == request_msg @@ -43681,7 +43666,6 @@ def test_update_account_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateAccountRequest() - assert args[0] == request_msg @@ -43703,7 +43687,6 @@ def test_provision_account_ticket_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ProvisionAccountTicketRequest() - assert args[0] == request_msg @@ -43725,7 +43708,6 @@ def test_list_account_summaries_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListAccountSummariesRequest() - assert args[0] == request_msg @@ -43745,7 +43727,6 @@ def test_get_property_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetPropertyRequest() - assert args[0] == request_msg @@ -43765,7 +43746,6 @@ def test_list_properties_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListPropertiesRequest() - assert args[0] == request_msg @@ -43785,7 +43765,6 @@ def test_create_property_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreatePropertyRequest() - assert args[0] == request_msg @@ -43805,7 +43784,6 @@ def test_delete_property_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeletePropertyRequest() - assert args[0] == request_msg @@ -43825,7 +43803,6 @@ def test_update_property_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdatePropertyRequest() - assert args[0] == request_msg @@ -43847,7 +43824,6 @@ def test_create_firebase_link_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateFirebaseLinkRequest() - assert args[0] == request_msg @@ -43869,7 +43845,6 @@ def test_delete_firebase_link_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteFirebaseLinkRequest() - assert args[0] == request_msg @@ -43891,7 +43866,6 @@ def test_list_firebase_links_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListFirebaseLinksRequest() - assert args[0] == request_msg @@ -43913,7 +43887,6 @@ def test_create_google_ads_link_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateGoogleAdsLinkRequest() - assert args[0] == request_msg @@ -43935,7 +43908,6 @@ def test_update_google_ads_link_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateGoogleAdsLinkRequest() - assert args[0] == request_msg @@ -43957,7 +43929,6 @@ def test_delete_google_ads_link_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteGoogleAdsLinkRequest() - assert args[0] == request_msg @@ -43979,7 +43950,6 @@ def test_list_google_ads_links_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListGoogleAdsLinksRequest() - assert args[0] == request_msg @@ -44001,7 +43971,6 @@ def test_get_data_sharing_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetDataSharingSettingsRequest() - assert args[0] == request_msg @@ -44023,7 +43992,6 @@ def test_get_measurement_protocol_secret_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetMeasurementProtocolSecretRequest() - assert args[0] == request_msg @@ -44045,7 +44013,6 @@ def test_list_measurement_protocol_secrets_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListMeasurementProtocolSecretsRequest() - assert args[0] == request_msg @@ -44067,7 +44034,6 @@ def test_create_measurement_protocol_secret_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateMeasurementProtocolSecretRequest() - assert args[0] == request_msg @@ -44089,7 +44055,6 @@ def test_delete_measurement_protocol_secret_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteMeasurementProtocolSecretRequest() - assert args[0] == request_msg @@ -44111,7 +44076,6 @@ def test_update_measurement_protocol_secret_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateMeasurementProtocolSecretRequest() - assert args[0] == request_msg @@ -44133,7 +44097,6 @@ def test_acknowledge_user_data_collection_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.AcknowledgeUserDataCollectionRequest() - assert args[0] == request_msg @@ -44155,7 +44118,6 @@ def test_search_change_history_events_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.SearchChangeHistoryEventsRequest() - assert args[0] == request_msg @@ -44177,7 +44139,6 @@ def test_create_conversion_event_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateConversionEventRequest() - assert args[0] == request_msg @@ -44199,7 +44160,6 @@ def test_update_conversion_event_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateConversionEventRequest() - assert args[0] == request_msg @@ -44221,7 +44181,6 @@ def test_get_conversion_event_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetConversionEventRequest() - assert args[0] == request_msg @@ -44243,7 +44202,6 @@ def test_delete_conversion_event_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteConversionEventRequest() - assert args[0] == request_msg @@ -44265,7 +44223,6 @@ def test_list_conversion_events_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListConversionEventsRequest() - assert args[0] == request_msg @@ -44285,7 +44242,6 @@ def test_create_key_event_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateKeyEventRequest() - assert args[0] == request_msg @@ -44305,7 +44261,6 @@ def test_update_key_event_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateKeyEventRequest() - assert args[0] == request_msg @@ -44325,7 +44280,6 @@ def test_get_key_event_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetKeyEventRequest() - assert args[0] == request_msg @@ -44345,7 +44299,6 @@ def test_delete_key_event_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteKeyEventRequest() - assert args[0] == request_msg @@ -44365,7 +44318,6 @@ def test_list_key_events_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListKeyEventsRequest() - assert args[0] == request_msg @@ -44387,7 +44339,6 @@ def test_create_custom_dimension_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateCustomDimensionRequest() - assert args[0] == request_msg @@ -44409,7 +44360,6 @@ def test_update_custom_dimension_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateCustomDimensionRequest() - assert args[0] == request_msg @@ -44431,7 +44381,6 @@ def test_list_custom_dimensions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListCustomDimensionsRequest() - assert args[0] == request_msg @@ -44453,7 +44402,6 @@ def test_archive_custom_dimension_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ArchiveCustomDimensionRequest() - assert args[0] == request_msg @@ -44475,7 +44423,6 @@ def test_get_custom_dimension_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetCustomDimensionRequest() - assert args[0] == request_msg @@ -44497,7 +44444,6 @@ def test_create_custom_metric_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateCustomMetricRequest() - assert args[0] == request_msg @@ -44519,7 +44465,6 @@ def test_update_custom_metric_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateCustomMetricRequest() - assert args[0] == request_msg @@ -44541,7 +44486,6 @@ def test_list_custom_metrics_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListCustomMetricsRequest() - assert args[0] == request_msg @@ -44563,7 +44507,6 @@ def test_archive_custom_metric_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ArchiveCustomMetricRequest() - assert args[0] == request_msg @@ -44585,7 +44528,6 @@ def test_get_custom_metric_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetCustomMetricRequest() - assert args[0] == request_msg @@ -44607,7 +44549,6 @@ def test_get_data_retention_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetDataRetentionSettingsRequest() - assert args[0] == request_msg @@ -44629,7 +44570,6 @@ def test_update_data_retention_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateDataRetentionSettingsRequest() - assert args[0] == request_msg @@ -44651,7 +44591,6 @@ def test_create_data_stream_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.CreateDataStreamRequest() - assert args[0] == request_msg @@ -44673,7 +44612,6 @@ def test_delete_data_stream_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.DeleteDataStreamRequest() - assert args[0] == request_msg @@ -44695,7 +44633,6 @@ def test_update_data_stream_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.UpdateDataStreamRequest() - assert args[0] == request_msg @@ -44717,7 +44654,6 @@ def test_list_data_streams_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.ListDataStreamsRequest() - assert args[0] == request_msg @@ -44737,7 +44673,6 @@ def test_get_data_stream_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.GetDataStreamRequest() - assert args[0] == request_msg @@ -44759,7 +44694,6 @@ def test_run_access_report_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_admin.RunAccessReportRequest() - assert args[0] == request_msg diff --git a/packages/google-analytics-data/noxfile.py b/packages/google-analytics-data/noxfile.py index 37580c01e288..0fcdca3b449b 100644 --- a/packages/google-analytics-data/noxfile.py +++ b/packages/google-analytics-data/noxfile.py @@ -47,7 +47,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-analytics-data" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-analytics-data/setup.py b/packages/google-analytics-data/setup.py index 0573a0ae7d5e..2587aad63f16 100644 --- a/packages/google-analytics-data/setup.py +++ b/packages/google-analytics-data/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/google-analytics-data/testing/constraints-3.10.txt b/packages/google-analytics-data/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-analytics-data/testing/constraints-3.10.txt +++ b/packages/google-analytics-data/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-analytics-data/tests/unit/gapic/data_v1alpha/test_alpha_analytics_data.py b/packages/google-analytics-data/tests/unit/gapic/data_v1alpha/test_alpha_analytics_data.py index de00c32ac9b6..01bf8b72ab53 100644 --- a/packages/google-analytics-data/tests/unit/gapic/data_v1alpha/test_alpha_analytics_data.py +++ b/packages/google-analytics-data/tests/unit/gapic/data_v1alpha/test_alpha_analytics_data.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 @@ -114,6 +115,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" @@ -1362,8 +1378,8 @@ def test_alpha_analytics_data_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - analytics_data_api.RunFunnelReportRequest, - dict, + analytics_data_api.RunFunnelReportRequest(), + {}, ], ) def test_run_funnel_report(request_type, transport: str = "grpc"): @@ -1374,7 +1390,7 @@ def test_run_funnel_report(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1422,9 +1438,10 @@ def test_run_funnel_report_non_empty_request_with_auto_populated_field(): client.run_funnel_report(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_data_api.RunFunnelReportRequest( + request_msg = analytics_data_api.RunFunnelReportRequest( property="property_value", ) + assert args[0] == request_msg def test_run_funnel_report_use_cached_wrapped_rpc(): @@ -1507,10 +1524,14 @@ async def test_run_funnel_report_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_run_funnel_report_async( - transport: str = "grpc_asyncio", - request_type=analytics_data_api.RunFunnelReportRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_data_api.RunFunnelReportRequest(), + {}, + ], +) +async def test_run_funnel_report_async(request_type, transport: str = "grpc_asyncio"): client = AlphaAnalyticsDataAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1518,7 +1539,7 @@ async def test_run_funnel_report_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( @@ -1543,11 +1564,6 @@ async def test_run_funnel_report_async( assert response.kind == "kind_value" -@pytest.mark.asyncio -async def test_run_funnel_report_async_from_dict(): - await test_run_funnel_report_async(request_type=dict) - - def test_run_funnel_report_field_headers(): client = AlphaAnalyticsDataClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1616,8 +1632,8 @@ async def test_run_funnel_report_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - analytics_data_api.CreateAudienceListRequest, - dict, + analytics_data_api.CreateAudienceListRequest(), + {}, ], ) def test_create_audience_list(request_type, transport: str = "grpc"): @@ -1628,7 +1644,7 @@ def test_create_audience_list(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1673,9 +1689,10 @@ def test_create_audience_list_non_empty_request_with_auto_populated_field(): client.create_audience_list(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_data_api.CreateAudienceListRequest( + request_msg = analytics_data_api.CreateAudienceListRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_audience_list_use_cached_wrapped_rpc(): @@ -1770,9 +1787,15 @@ async def test_create_audience_list_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_data_api.CreateAudienceListRequest(), + {}, + ], +) async def test_create_audience_list_async( - transport: str = "grpc_asyncio", - request_type=analytics_data_api.CreateAudienceListRequest, + request_type, transport: str = "grpc_asyncio" ): client = AlphaAnalyticsDataAsyncClient( credentials=async_anonymous_credentials(), @@ -1781,7 +1804,7 @@ async def test_create_audience_list_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( @@ -1803,11 +1826,6 @@ async def test_create_audience_list_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_audience_list_async_from_dict(): - await test_create_audience_list_async(request_type=dict) - - def test_create_audience_list_field_headers(): client = AlphaAnalyticsDataClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1972,8 +1990,8 @@ async def test_create_audience_list_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_data_api.QueryAudienceListRequest, - dict, + analytics_data_api.QueryAudienceListRequest(), + {}, ], ) def test_query_audience_list(request_type, transport: str = "grpc"): @@ -1984,7 +2002,7 @@ def test_query_audience_list(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,9 +2050,10 @@ def test_query_audience_list_non_empty_request_with_auto_populated_field(): client.query_audience_list(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_data_api.QueryAudienceListRequest( + request_msg = analytics_data_api.QueryAudienceListRequest( name="name_value", ) + assert args[0] == request_msg def test_query_audience_list_use_cached_wrapped_rpc(): @@ -2119,10 +2138,14 @@ async def test_query_audience_list_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_query_audience_list_async( - transport: str = "grpc_asyncio", - request_type=analytics_data_api.QueryAudienceListRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_data_api.QueryAudienceListRequest(), + {}, + ], +) +async def test_query_audience_list_async(request_type, transport: str = "grpc_asyncio"): client = AlphaAnalyticsDataAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2130,7 +2153,7 @@ async def test_query_audience_list_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( @@ -2155,11 +2178,6 @@ async def test_query_audience_list_async( assert response.row_count == 992 -@pytest.mark.asyncio -async def test_query_audience_list_async_from_dict(): - await test_query_audience_list_async(request_type=dict) - - def test_query_audience_list_field_headers(): client = AlphaAnalyticsDataClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2314,8 +2332,8 @@ async def test_query_audience_list_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_data_api.GetAudienceListRequest, - dict, + analytics_data_api.GetAudienceListRequest(), + {}, ], ) def test_get_audience_list(request_type, transport: str = "grpc"): @@ -2326,7 +2344,7 @@ def test_get_audience_list(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2390,9 +2408,10 @@ def test_get_audience_list_non_empty_request_with_auto_populated_field(): client.get_audience_list(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_data_api.GetAudienceListRequest( + request_msg = analytics_data_api.GetAudienceListRequest( name="name_value", ) + assert args[0] == request_msg def test_get_audience_list_use_cached_wrapped_rpc(): @@ -2475,10 +2494,14 @@ async def test_get_audience_list_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_audience_list_async( - transport: str = "grpc_asyncio", - request_type=analytics_data_api.GetAudienceListRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_data_api.GetAudienceListRequest(), + {}, + ], +) +async def test_get_audience_list_async(request_type, transport: str = "grpc_asyncio"): client = AlphaAnalyticsDataAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2486,7 +2509,7 @@ async def test_get_audience_list_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( @@ -2527,11 +2550,6 @@ async def test_get_audience_list_async( assert response.recurring_audience_list == "recurring_audience_list_value" -@pytest.mark.asyncio -async def test_get_audience_list_async_from_dict(): - await test_get_audience_list_async(request_type=dict) - - def test_get_audience_list_field_headers(): client = AlphaAnalyticsDataClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2686,8 +2704,8 @@ async def test_get_audience_list_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_data_api.ListAudienceListsRequest, - dict, + analytics_data_api.ListAudienceListsRequest(), + {}, ], ) def test_list_audience_lists(request_type, transport: str = "grpc"): @@ -2698,7 +2716,7 @@ def test_list_audience_lists(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2747,10 +2765,11 @@ def test_list_audience_lists_non_empty_request_with_auto_populated_field(): client.list_audience_lists(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_data_api.ListAudienceListsRequest( + request_msg = analytics_data_api.ListAudienceListsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_audience_lists_use_cached_wrapped_rpc(): @@ -2835,10 +2854,14 @@ async def test_list_audience_lists_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_audience_lists_async( - transport: str = "grpc_asyncio", - request_type=analytics_data_api.ListAudienceListsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_data_api.ListAudienceListsRequest(), + {}, + ], +) +async def test_list_audience_lists_async(request_type, transport: str = "grpc_asyncio"): client = AlphaAnalyticsDataAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2846,7 +2869,7 @@ async def test_list_audience_lists_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( @@ -2871,11 +2894,6 @@ async def test_list_audience_lists_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_audience_lists_async_from_dict(): - await test_list_audience_lists_async(request_type=dict) - - def test_list_audience_lists_field_headers(): client = AlphaAnalyticsDataClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3228,8 +3246,8 @@ async def test_list_audience_lists_async_pages(): @pytest.mark.parametrize( "request_type", [ - analytics_data_api.CreateRecurringAudienceListRequest, - dict, + analytics_data_api.CreateRecurringAudienceListRequest(), + {}, ], ) def test_create_recurring_audience_list(request_type, transport: str = "grpc"): @@ -3240,7 +3258,7 @@ def test_create_recurring_audience_list(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3296,9 +3314,10 @@ def test_create_recurring_audience_list_non_empty_request_with_auto_populated_fi client.create_recurring_audience_list(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_data_api.CreateRecurringAudienceListRequest( + request_msg = analytics_data_api.CreateRecurringAudienceListRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_recurring_audience_list_use_cached_wrapped_rpc(): @@ -3384,9 +3403,15 @@ async def test_create_recurring_audience_list_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_data_api.CreateRecurringAudienceListRequest(), + {}, + ], +) async def test_create_recurring_audience_list_async( - transport: str = "grpc_asyncio", - request_type=analytics_data_api.CreateRecurringAudienceListRequest, + request_type, transport: str = "grpc_asyncio" ): client = AlphaAnalyticsDataAsyncClient( credentials=async_anonymous_credentials(), @@ -3395,7 +3420,7 @@ async def test_create_recurring_audience_list_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( @@ -3428,11 +3453,6 @@ async def test_create_recurring_audience_list_async( assert response.audience_lists == ["audience_lists_value"] -@pytest.mark.asyncio -async def test_create_recurring_audience_list_async_from_dict(): - await test_create_recurring_audience_list_async(request_type=dict) - - def test_create_recurring_audience_list_field_headers(): client = AlphaAnalyticsDataClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3605,8 +3625,8 @@ async def test_create_recurring_audience_list_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_data_api.GetRecurringAudienceListRequest, - dict, + analytics_data_api.GetRecurringAudienceListRequest(), + {}, ], ) def test_get_recurring_audience_list(request_type, transport: str = "grpc"): @@ -3617,7 +3637,7 @@ def test_get_recurring_audience_list(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3673,9 +3693,10 @@ def test_get_recurring_audience_list_non_empty_request_with_auto_populated_field client.get_recurring_audience_list(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_data_api.GetRecurringAudienceListRequest( + request_msg = analytics_data_api.GetRecurringAudienceListRequest( name="name_value", ) + assert args[0] == request_msg def test_get_recurring_audience_list_use_cached_wrapped_rpc(): @@ -3761,9 +3782,15 @@ async def test_get_recurring_audience_list_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_data_api.GetRecurringAudienceListRequest(), + {}, + ], +) async def test_get_recurring_audience_list_async( - transport: str = "grpc_asyncio", - request_type=analytics_data_api.GetRecurringAudienceListRequest, + request_type, transport: str = "grpc_asyncio" ): client = AlphaAnalyticsDataAsyncClient( credentials=async_anonymous_credentials(), @@ -3772,7 +3799,7 @@ async def test_get_recurring_audience_list_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( @@ -3805,11 +3832,6 @@ async def test_get_recurring_audience_list_async( assert response.audience_lists == ["audience_lists_value"] -@pytest.mark.asyncio -async def test_get_recurring_audience_list_async_from_dict(): - await test_get_recurring_audience_list_async(request_type=dict) - - def test_get_recurring_audience_list_field_headers(): client = AlphaAnalyticsDataClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3964,8 +3986,8 @@ async def test_get_recurring_audience_list_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_data_api.ListRecurringAudienceListsRequest, - dict, + analytics_data_api.ListRecurringAudienceListsRequest(), + {}, ], ) def test_list_recurring_audience_lists(request_type, transport: str = "grpc"): @@ -3976,7 +3998,7 @@ def test_list_recurring_audience_lists(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4025,10 +4047,11 @@ def test_list_recurring_audience_lists_non_empty_request_with_auto_populated_fie client.list_recurring_audience_lists(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_data_api.ListRecurringAudienceListsRequest( + request_msg = analytics_data_api.ListRecurringAudienceListsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_recurring_audience_lists_use_cached_wrapped_rpc(): @@ -4114,9 +4137,15 @@ async def test_list_recurring_audience_lists_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_data_api.ListRecurringAudienceListsRequest(), + {}, + ], +) async def test_list_recurring_audience_lists_async( - transport: str = "grpc_asyncio", - request_type=analytics_data_api.ListRecurringAudienceListsRequest, + request_type, transport: str = "grpc_asyncio" ): client = AlphaAnalyticsDataAsyncClient( credentials=async_anonymous_credentials(), @@ -4125,7 +4154,7 @@ async def test_list_recurring_audience_lists_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( @@ -4150,11 +4179,6 @@ async def test_list_recurring_audience_lists_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_recurring_audience_lists_async_from_dict(): - await test_list_recurring_audience_lists_async(request_type=dict) - - def test_list_recurring_audience_lists_field_headers(): client = AlphaAnalyticsDataClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4515,8 +4539,8 @@ async def test_list_recurring_audience_lists_async_pages(): @pytest.mark.parametrize( "request_type", [ - analytics_data_api.GetPropertyQuotasSnapshotRequest, - dict, + analytics_data_api.GetPropertyQuotasSnapshotRequest(), + {}, ], ) def test_get_property_quotas_snapshot(request_type, transport: str = "grpc"): @@ -4527,7 +4551,7 @@ def test_get_property_quotas_snapshot(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4575,9 +4599,10 @@ def test_get_property_quotas_snapshot_non_empty_request_with_auto_populated_fiel client.get_property_quotas_snapshot(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_data_api.GetPropertyQuotasSnapshotRequest( + request_msg = analytics_data_api.GetPropertyQuotasSnapshotRequest( name="name_value", ) + assert args[0] == request_msg def test_get_property_quotas_snapshot_use_cached_wrapped_rpc(): @@ -4663,9 +4688,15 @@ async def test_get_property_quotas_snapshot_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_data_api.GetPropertyQuotasSnapshotRequest(), + {}, + ], +) async def test_get_property_quotas_snapshot_async( - transport: str = "grpc_asyncio", - request_type=analytics_data_api.GetPropertyQuotasSnapshotRequest, + request_type, transport: str = "grpc_asyncio" ): client = AlphaAnalyticsDataAsyncClient( credentials=async_anonymous_credentials(), @@ -4674,7 +4705,7 @@ async def test_get_property_quotas_snapshot_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( @@ -4699,11 +4730,6 @@ async def test_get_property_quotas_snapshot_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_property_quotas_snapshot_async_from_dict(): - await test_get_property_quotas_snapshot_async(request_type=dict) - - def test_get_property_quotas_snapshot_field_headers(): client = AlphaAnalyticsDataClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4858,8 +4884,8 @@ async def test_get_property_quotas_snapshot_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_data_api.CreateReportTaskRequest, - dict, + analytics_data_api.CreateReportTaskRequest(), + {}, ], ) def test_create_report_task(request_type, transport: str = "grpc"): @@ -4870,7 +4896,7 @@ def test_create_report_task(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4915,9 +4941,10 @@ def test_create_report_task_non_empty_request_with_auto_populated_field(): client.create_report_task(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_data_api.CreateReportTaskRequest( + request_msg = analytics_data_api.CreateReportTaskRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_report_task_use_cached_wrapped_rpc(): @@ -5012,10 +5039,14 @@ async def test_create_report_task_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_report_task_async( - transport: str = "grpc_asyncio", - request_type=analytics_data_api.CreateReportTaskRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_data_api.CreateReportTaskRequest(), + {}, + ], +) +async def test_create_report_task_async(request_type, transport: str = "grpc_asyncio"): client = AlphaAnalyticsDataAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5023,7 +5054,7 @@ async def test_create_report_task_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( @@ -5045,11 +5076,6 @@ async def test_create_report_task_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_report_task_async_from_dict(): - await test_create_report_task_async(request_type=dict) - - def test_create_report_task_field_headers(): client = AlphaAnalyticsDataClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5214,8 +5240,8 @@ async def test_create_report_task_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_data_api.QueryReportTaskRequest, - dict, + analytics_data_api.QueryReportTaskRequest(), + {}, ], ) def test_query_report_task(request_type, transport: str = "grpc"): @@ -5226,7 +5252,7 @@ def test_query_report_task(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5274,9 +5300,10 @@ def test_query_report_task_non_empty_request_with_auto_populated_field(): client.query_report_task(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_data_api.QueryReportTaskRequest( + request_msg = analytics_data_api.QueryReportTaskRequest( name="name_value", ) + assert args[0] == request_msg def test_query_report_task_use_cached_wrapped_rpc(): @@ -5359,10 +5386,14 @@ async def test_query_report_task_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_query_report_task_async( - transport: str = "grpc_asyncio", - request_type=analytics_data_api.QueryReportTaskRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_data_api.QueryReportTaskRequest(), + {}, + ], +) +async def test_query_report_task_async(request_type, transport: str = "grpc_asyncio"): client = AlphaAnalyticsDataAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5370,7 +5401,7 @@ async def test_query_report_task_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( @@ -5395,11 +5426,6 @@ async def test_query_report_task_async( assert response.row_count == 992 -@pytest.mark.asyncio -async def test_query_report_task_async_from_dict(): - await test_query_report_task_async(request_type=dict) - - def test_query_report_task_field_headers(): client = AlphaAnalyticsDataClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5554,8 +5580,8 @@ async def test_query_report_task_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_data_api.GetReportTaskRequest, - dict, + analytics_data_api.GetReportTaskRequest(), + {}, ], ) def test_get_report_task(request_type, transport: str = "grpc"): @@ -5566,7 +5592,7 @@ def test_get_report_task(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_report_task), "__call__") as call: @@ -5610,9 +5636,10 @@ def test_get_report_task_non_empty_request_with_auto_populated_field(): client.get_report_task(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_data_api.GetReportTaskRequest( + request_msg = analytics_data_api.GetReportTaskRequest( name="name_value", ) + assert args[0] == request_msg def test_get_report_task_use_cached_wrapped_rpc(): @@ -5693,10 +5720,14 @@ async def test_get_report_task_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_report_task_async( - transport: str = "grpc_asyncio", - request_type=analytics_data_api.GetReportTaskRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_data_api.GetReportTaskRequest(), + {}, + ], +) +async def test_get_report_task_async(request_type, transport: str = "grpc_asyncio"): client = AlphaAnalyticsDataAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5704,7 +5735,7 @@ async def test_get_report_task_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_report_task), "__call__") as call: @@ -5727,11 +5758,6 @@ async def test_get_report_task_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_report_task_async_from_dict(): - await test_get_report_task_async(request_type=dict) - - def test_get_report_task_field_headers(): client = AlphaAnalyticsDataClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5878,8 +5904,8 @@ async def test_get_report_task_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_data_api.ListReportTasksRequest, - dict, + analytics_data_api.ListReportTasksRequest(), + {}, ], ) def test_list_report_tasks(request_type, transport: str = "grpc"): @@ -5890,7 +5916,7 @@ def test_list_report_tasks(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5939,10 +5965,11 @@ def test_list_report_tasks_non_empty_request_with_auto_populated_field(): client.list_report_tasks(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_data_api.ListReportTasksRequest( + request_msg = analytics_data_api.ListReportTasksRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_report_tasks_use_cached_wrapped_rpc(): @@ -6025,10 +6052,14 @@ async def test_list_report_tasks_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_report_tasks_async( - transport: str = "grpc_asyncio", - request_type=analytics_data_api.ListReportTasksRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_data_api.ListReportTasksRequest(), + {}, + ], +) +async def test_list_report_tasks_async(request_type, transport: str = "grpc_asyncio"): client = AlphaAnalyticsDataAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6036,7 +6067,7 @@ async def test_list_report_tasks_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( @@ -6061,11 +6092,6 @@ async def test_list_report_tasks_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_report_tasks_async_from_dict(): - await test_list_report_tasks_async(request_type=dict) - - def test_list_report_tasks_field_headers(): client = AlphaAnalyticsDataClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6418,8 +6444,8 @@ async def test_list_report_tasks_async_pages(): @pytest.mark.parametrize( "request_type", [ - analytics_data_api.RunReportRequest, - dict, + analytics_data_api.RunReportRequest(), + {}, ], ) def test_run_report(request_type, transport: str = "grpc"): @@ -6430,7 +6456,7 @@ def test_run_report(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.run_report), "__call__") as call: @@ -6480,10 +6506,11 @@ def test_run_report_non_empty_request_with_auto_populated_field(): client.run_report(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_data_api.RunReportRequest( + request_msg = analytics_data_api.RunReportRequest( property="property_value", currency_code="currency_code_value", ) + assert args[0] == request_msg def test_run_report_use_cached_wrapped_rpc(): @@ -6562,9 +6589,14 @@ async def test_run_report_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_run_report_async( - transport: str = "grpc_asyncio", request_type=analytics_data_api.RunReportRequest -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_data_api.RunReportRequest(), + {}, + ], +) +async def test_run_report_async(request_type, transport: str = "grpc_asyncio"): client = AlphaAnalyticsDataAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6572,7 +6604,7 @@ async def test_run_report_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.run_report), "__call__") as call: @@ -6599,11 +6631,6 @@ async def test_run_report_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_run_report_async_from_dict(): - await test_run_report_async(request_type=dict) - - def test_run_report_field_headers(): client = AlphaAnalyticsDataClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6668,8 +6695,8 @@ async def test_run_report_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - analytics_data_api.GetMetadataRequest, - dict, + analytics_data_api.GetMetadataRequest(), + {}, ], ) def test_get_metadata(request_type, transport: str = "grpc"): @@ -6680,7 +6707,7 @@ def test_get_metadata(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_metadata), "__call__") as call: @@ -6724,9 +6751,10 @@ def test_get_metadata_non_empty_request_with_auto_populated_field(): client.get_metadata(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_data_api.GetMetadataRequest( + request_msg = analytics_data_api.GetMetadataRequest( name="name_value", ) + assert args[0] == request_msg def test_get_metadata_use_cached_wrapped_rpc(): @@ -6807,9 +6835,14 @@ async def test_get_metadata_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_metadata_async( - transport: str = "grpc_asyncio", request_type=analytics_data_api.GetMetadataRequest -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_data_api.GetMetadataRequest(), + {}, + ], +) +async def test_get_metadata_async(request_type, transport: str = "grpc_asyncio"): client = AlphaAnalyticsDataAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6817,7 +6850,7 @@ async def test_get_metadata_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_metadata), "__call__") as call: @@ -6840,11 +6873,6 @@ async def test_get_metadata_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_metadata_async_from_dict(): - await test_get_metadata_async(request_type=dict) - - def test_get_metadata_field_headers(): client = AlphaAnalyticsDataClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9902,7 +9930,6 @@ def test_run_funnel_report_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.RunFunnelReportRequest() - assert args[0] == request_msg @@ -9925,7 +9952,6 @@ def test_create_audience_list_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.CreateAudienceListRequest() - assert args[0] == request_msg @@ -9948,7 +9974,6 @@ def test_query_audience_list_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.QueryAudienceListRequest() - assert args[0] == request_msg @@ -9971,7 +9996,6 @@ def test_get_audience_list_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.GetAudienceListRequest() - assert args[0] == request_msg @@ -9994,7 +10018,6 @@ def test_list_audience_lists_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.ListAudienceListsRequest() - assert args[0] == request_msg @@ -10017,7 +10040,6 @@ def test_create_recurring_audience_list_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.CreateRecurringAudienceListRequest() - assert args[0] == request_msg @@ -10040,7 +10062,6 @@ def test_get_recurring_audience_list_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.GetRecurringAudienceListRequest() - assert args[0] == request_msg @@ -10063,7 +10084,6 @@ def test_list_recurring_audience_lists_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.ListRecurringAudienceListsRequest() - assert args[0] == request_msg @@ -10086,7 +10106,6 @@ def test_get_property_quotas_snapshot_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.GetPropertyQuotasSnapshotRequest() - assert args[0] == request_msg @@ -10109,7 +10128,6 @@ def test_create_report_task_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.CreateReportTaskRequest() - assert args[0] == request_msg @@ -10132,7 +10150,6 @@ def test_query_report_task_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.QueryReportTaskRequest() - assert args[0] == request_msg @@ -10153,7 +10170,6 @@ def test_get_report_task_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.GetReportTaskRequest() - assert args[0] == request_msg @@ -10176,7 +10192,6 @@ def test_list_report_tasks_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.ListReportTasksRequest() - assert args[0] == request_msg @@ -10197,7 +10212,6 @@ def test_run_report_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.RunReportRequest() - assert args[0] == request_msg @@ -10218,7 +10232,6 @@ def test_get_metadata_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.GetMetadataRequest() - assert args[0] == request_msg @@ -10261,7 +10274,6 @@ async def test_run_funnel_report_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.RunFunnelReportRequest() - assert args[0] == request_msg @@ -10288,7 +10300,6 @@ async def test_create_audience_list_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.CreateAudienceListRequest() - assert args[0] == request_msg @@ -10317,7 +10328,6 @@ async def test_query_audience_list_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.QueryAudienceListRequest() - assert args[0] == request_msg @@ -10354,7 +10364,6 @@ async def test_get_audience_list_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.GetAudienceListRequest() - assert args[0] == request_msg @@ -10383,7 +10392,6 @@ async def test_list_audience_lists_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.ListAudienceListsRequest() - assert args[0] == request_msg @@ -10416,7 +10424,6 @@ async def test_create_recurring_audience_list_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.CreateRecurringAudienceListRequest() - assert args[0] == request_msg @@ -10449,7 +10456,6 @@ async def test_get_recurring_audience_list_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.GetRecurringAudienceListRequest() - assert args[0] == request_msg @@ -10478,7 +10484,6 @@ async def test_list_recurring_audience_lists_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.ListRecurringAudienceListsRequest() - assert args[0] == request_msg @@ -10507,7 +10512,6 @@ async def test_get_property_quotas_snapshot_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.GetPropertyQuotasSnapshotRequest() - assert args[0] == request_msg @@ -10534,7 +10538,6 @@ async def test_create_report_task_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.CreateReportTaskRequest() - assert args[0] == request_msg @@ -10563,7 +10566,6 @@ async def test_query_report_task_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.QueryReportTaskRequest() - assert args[0] == request_msg @@ -10590,7 +10592,6 @@ async def test_get_report_task_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.GetReportTaskRequest() - assert args[0] == request_msg @@ -10619,7 +10620,6 @@ async def test_list_report_tasks_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.ListReportTasksRequest() - assert args[0] == request_msg @@ -10648,7 +10648,6 @@ async def test_run_report_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.RunReportRequest() - assert args[0] == request_msg @@ -10675,7 +10674,6 @@ async def test_get_metadata_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.GetMetadataRequest() - assert args[0] == request_msg @@ -13105,7 +13103,6 @@ def test_run_funnel_report_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.RunFunnelReportRequest() - assert args[0] == request_msg @@ -13127,7 +13124,6 @@ def test_create_audience_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.CreateAudienceListRequest() - assert args[0] == request_msg @@ -13149,7 +13145,6 @@ def test_query_audience_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.QueryAudienceListRequest() - assert args[0] == request_msg @@ -13171,7 +13166,6 @@ def test_get_audience_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.GetAudienceListRequest() - assert args[0] == request_msg @@ -13193,7 +13187,6 @@ def test_list_audience_lists_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.ListAudienceListsRequest() - assert args[0] == request_msg @@ -13215,7 +13208,6 @@ def test_create_recurring_audience_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.CreateRecurringAudienceListRequest() - assert args[0] == request_msg @@ -13237,7 +13229,6 @@ def test_get_recurring_audience_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.GetRecurringAudienceListRequest() - assert args[0] == request_msg @@ -13259,7 +13250,6 @@ def test_list_recurring_audience_lists_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.ListRecurringAudienceListsRequest() - assert args[0] == request_msg @@ -13281,7 +13271,6 @@ def test_get_property_quotas_snapshot_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.GetPropertyQuotasSnapshotRequest() - assert args[0] == request_msg @@ -13303,7 +13292,6 @@ def test_create_report_task_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.CreateReportTaskRequest() - assert args[0] == request_msg @@ -13325,7 +13313,6 @@ def test_query_report_task_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.QueryReportTaskRequest() - assert args[0] == request_msg @@ -13345,7 +13332,6 @@ def test_get_report_task_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.GetReportTaskRequest() - assert args[0] == request_msg @@ -13367,7 +13353,6 @@ def test_list_report_tasks_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.ListReportTasksRequest() - assert args[0] == request_msg @@ -13387,7 +13372,6 @@ def test_run_report_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.RunReportRequest() - assert args[0] == request_msg @@ -13407,7 +13391,6 @@ def test_get_metadata_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.GetMetadataRequest() - assert args[0] == request_msg diff --git a/packages/google-analytics-data/tests/unit/gapic/data_v1beta/test_beta_analytics_data.py b/packages/google-analytics-data/tests/unit/gapic/data_v1beta/test_beta_analytics_data.py index bb9aeb43e3d9..2916de36cc8a 100644 --- a/packages/google-analytics-data/tests/unit/gapic/data_v1beta/test_beta_analytics_data.py +++ b/packages/google-analytics-data/tests/unit/gapic/data_v1beta/test_beta_analytics_data.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 @@ -113,6 +114,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" @@ -1357,8 +1373,8 @@ def test_beta_analytics_data_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - analytics_data_api.RunReportRequest, - dict, + analytics_data_api.RunReportRequest(), + {}, ], ) def test_run_report(request_type, transport: str = "grpc"): @@ -1369,7 +1385,7 @@ def test_run_report(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.run_report), "__call__") as call: @@ -1416,10 +1432,11 @@ def test_run_report_non_empty_request_with_auto_populated_field(): client.run_report(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_data_api.RunReportRequest( + request_msg = analytics_data_api.RunReportRequest( property="property_value", currency_code="currency_code_value", ) + assert args[0] == request_msg def test_run_report_use_cached_wrapped_rpc(): @@ -1498,9 +1515,14 @@ async def test_run_report_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_run_report_async( - transport: str = "grpc_asyncio", request_type=analytics_data_api.RunReportRequest -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_data_api.RunReportRequest(), + {}, + ], +) +async def test_run_report_async(request_type, transport: str = "grpc_asyncio"): client = BetaAnalyticsDataAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1508,7 +1530,7 @@ async def test_run_report_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.run_report), "__call__") as call: @@ -1533,11 +1555,6 @@ async def test_run_report_async( assert response.kind == "kind_value" -@pytest.mark.asyncio -async def test_run_report_async_from_dict(): - await test_run_report_async(request_type=dict) - - def test_run_report_field_headers(): client = BetaAnalyticsDataClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1602,8 +1619,8 @@ async def test_run_report_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - analytics_data_api.RunPivotReportRequest, - dict, + analytics_data_api.RunPivotReportRequest(), + {}, ], ) def test_run_pivot_report(request_type, transport: str = "grpc"): @@ -1614,7 +1631,7 @@ def test_run_pivot_report(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.run_pivot_report), "__call__") as call: @@ -1659,10 +1676,11 @@ def test_run_pivot_report_non_empty_request_with_auto_populated_field(): client.run_pivot_report(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_data_api.RunPivotReportRequest( + request_msg = analytics_data_api.RunPivotReportRequest( property="property_value", currency_code="currency_code_value", ) + assert args[0] == request_msg def test_run_pivot_report_use_cached_wrapped_rpc(): @@ -1745,10 +1763,14 @@ async def test_run_pivot_report_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_run_pivot_report_async( - transport: str = "grpc_asyncio", - request_type=analytics_data_api.RunPivotReportRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_data_api.RunPivotReportRequest(), + {}, + ], +) +async def test_run_pivot_report_async(request_type, transport: str = "grpc_asyncio"): client = BetaAnalyticsDataAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1756,7 +1778,7 @@ async def test_run_pivot_report_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.run_pivot_report), "__call__") as call: @@ -1779,11 +1801,6 @@ async def test_run_pivot_report_async( assert response.kind == "kind_value" -@pytest.mark.asyncio -async def test_run_pivot_report_async_from_dict(): - await test_run_pivot_report_async(request_type=dict) - - def test_run_pivot_report_field_headers(): client = BetaAnalyticsDataClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1848,8 +1865,8 @@ async def test_run_pivot_report_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - analytics_data_api.BatchRunReportsRequest, - dict, + analytics_data_api.BatchRunReportsRequest(), + {}, ], ) def test_batch_run_reports(request_type, transport: str = "grpc"): @@ -1860,7 +1877,7 @@ def test_batch_run_reports(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1908,9 +1925,10 @@ def test_batch_run_reports_non_empty_request_with_auto_populated_field(): client.batch_run_reports(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_data_api.BatchRunReportsRequest( + request_msg = analytics_data_api.BatchRunReportsRequest( property="property_value", ) + assert args[0] == request_msg def test_batch_run_reports_use_cached_wrapped_rpc(): @@ -1993,10 +2011,14 @@ async def test_batch_run_reports_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_batch_run_reports_async( - transport: str = "grpc_asyncio", - request_type=analytics_data_api.BatchRunReportsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_data_api.BatchRunReportsRequest(), + {}, + ], +) +async def test_batch_run_reports_async(request_type, transport: str = "grpc_asyncio"): client = BetaAnalyticsDataAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2004,7 +2026,7 @@ async def test_batch_run_reports_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( @@ -2029,11 +2051,6 @@ async def test_batch_run_reports_async( assert response.kind == "kind_value" -@pytest.mark.asyncio -async def test_batch_run_reports_async_from_dict(): - await test_batch_run_reports_async(request_type=dict) - - def test_batch_run_reports_field_headers(): client = BetaAnalyticsDataClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2102,8 +2119,8 @@ async def test_batch_run_reports_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - analytics_data_api.BatchRunPivotReportsRequest, - dict, + analytics_data_api.BatchRunPivotReportsRequest(), + {}, ], ) def test_batch_run_pivot_reports(request_type, transport: str = "grpc"): @@ -2114,7 +2131,7 @@ def test_batch_run_pivot_reports(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2162,9 +2179,10 @@ def test_batch_run_pivot_reports_non_empty_request_with_auto_populated_field(): client.batch_run_pivot_reports(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_data_api.BatchRunPivotReportsRequest( + request_msg = analytics_data_api.BatchRunPivotReportsRequest( property="property_value", ) + assert args[0] == request_msg def test_batch_run_pivot_reports_use_cached_wrapped_rpc(): @@ -2250,9 +2268,15 @@ async def test_batch_run_pivot_reports_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_data_api.BatchRunPivotReportsRequest(), + {}, + ], +) async def test_batch_run_pivot_reports_async( - transport: str = "grpc_asyncio", - request_type=analytics_data_api.BatchRunPivotReportsRequest, + request_type, transport: str = "grpc_asyncio" ): client = BetaAnalyticsDataAsyncClient( credentials=async_anonymous_credentials(), @@ -2261,7 +2285,7 @@ async def test_batch_run_pivot_reports_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( @@ -2286,11 +2310,6 @@ async def test_batch_run_pivot_reports_async( assert response.kind == "kind_value" -@pytest.mark.asyncio -async def test_batch_run_pivot_reports_async_from_dict(): - await test_batch_run_pivot_reports_async(request_type=dict) - - def test_batch_run_pivot_reports_field_headers(): client = BetaAnalyticsDataClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2359,8 +2378,8 @@ async def test_batch_run_pivot_reports_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - analytics_data_api.GetMetadataRequest, - dict, + analytics_data_api.GetMetadataRequest(), + {}, ], ) def test_get_metadata(request_type, transport: str = "grpc"): @@ -2371,7 +2390,7 @@ def test_get_metadata(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_metadata), "__call__") as call: @@ -2415,9 +2434,10 @@ def test_get_metadata_non_empty_request_with_auto_populated_field(): client.get_metadata(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_data_api.GetMetadataRequest( + request_msg = analytics_data_api.GetMetadataRequest( name="name_value", ) + assert args[0] == request_msg def test_get_metadata_use_cached_wrapped_rpc(): @@ -2498,9 +2518,14 @@ async def test_get_metadata_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_metadata_async( - transport: str = "grpc_asyncio", request_type=analytics_data_api.GetMetadataRequest -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_data_api.GetMetadataRequest(), + {}, + ], +) +async def test_get_metadata_async(request_type, transport: str = "grpc_asyncio"): client = BetaAnalyticsDataAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2508,7 +2533,7 @@ async def test_get_metadata_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_metadata), "__call__") as call: @@ -2531,11 +2556,6 @@ async def test_get_metadata_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_metadata_async_from_dict(): - await test_get_metadata_async(request_type=dict) - - def test_get_metadata_field_headers(): client = BetaAnalyticsDataClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2682,8 +2702,8 @@ async def test_get_metadata_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_data_api.RunRealtimeReportRequest, - dict, + analytics_data_api.RunRealtimeReportRequest(), + {}, ], ) def test_run_realtime_report(request_type, transport: str = "grpc"): @@ -2694,7 +2714,7 @@ def test_run_realtime_report(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2744,9 +2764,10 @@ def test_run_realtime_report_non_empty_request_with_auto_populated_field(): client.run_realtime_report(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_data_api.RunRealtimeReportRequest( + request_msg = analytics_data_api.RunRealtimeReportRequest( property="property_value", ) + assert args[0] == request_msg def test_run_realtime_report_use_cached_wrapped_rpc(): @@ -2831,10 +2852,14 @@ async def test_run_realtime_report_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_run_realtime_report_async( - transport: str = "grpc_asyncio", - request_type=analytics_data_api.RunRealtimeReportRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_data_api.RunRealtimeReportRequest(), + {}, + ], +) +async def test_run_realtime_report_async(request_type, transport: str = "grpc_asyncio"): client = BetaAnalyticsDataAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2842,7 +2867,7 @@ async def test_run_realtime_report_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( @@ -2869,11 +2894,6 @@ async def test_run_realtime_report_async( assert response.kind == "kind_value" -@pytest.mark.asyncio -async def test_run_realtime_report_async_from_dict(): - await test_run_realtime_report_async(request_type=dict) - - def test_run_realtime_report_field_headers(): client = BetaAnalyticsDataClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2942,8 +2962,8 @@ async def test_run_realtime_report_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - analytics_data_api.CheckCompatibilityRequest, - dict, + analytics_data_api.CheckCompatibilityRequest(), + {}, ], ) def test_check_compatibility(request_type, transport: str = "grpc"): @@ -2954,7 +2974,7 @@ def test_check_compatibility(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2999,9 +3019,10 @@ def test_check_compatibility_non_empty_request_with_auto_populated_field(): client.check_compatibility(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_data_api.CheckCompatibilityRequest( + request_msg = analytics_data_api.CheckCompatibilityRequest( property="property_value", ) + assert args[0] == request_msg def test_check_compatibility_use_cached_wrapped_rpc(): @@ -3086,10 +3107,14 @@ async def test_check_compatibility_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_check_compatibility_async( - transport: str = "grpc_asyncio", - request_type=analytics_data_api.CheckCompatibilityRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_data_api.CheckCompatibilityRequest(), + {}, + ], +) +async def test_check_compatibility_async(request_type, transport: str = "grpc_asyncio"): client = BetaAnalyticsDataAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3097,7 +3122,7 @@ async def test_check_compatibility_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( @@ -3119,11 +3144,6 @@ async def test_check_compatibility_async( assert isinstance(response, analytics_data_api.CheckCompatibilityResponse) -@pytest.mark.asyncio -async def test_check_compatibility_async_from_dict(): - await test_check_compatibility_async(request_type=dict) - - def test_check_compatibility_field_headers(): client = BetaAnalyticsDataClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3192,8 +3212,8 @@ async def test_check_compatibility_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - analytics_data_api.CreateAudienceExportRequest, - dict, + analytics_data_api.CreateAudienceExportRequest(), + {}, ], ) def test_create_audience_export(request_type, transport: str = "grpc"): @@ -3204,7 +3224,7 @@ def test_create_audience_export(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3249,9 +3269,10 @@ def test_create_audience_export_non_empty_request_with_auto_populated_field(): client.create_audience_export(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_data_api.CreateAudienceExportRequest( + request_msg = analytics_data_api.CreateAudienceExportRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_audience_export_use_cached_wrapped_rpc(): @@ -3347,9 +3368,15 @@ async def test_create_audience_export_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_data_api.CreateAudienceExportRequest(), + {}, + ], +) async def test_create_audience_export_async( - transport: str = "grpc_asyncio", - request_type=analytics_data_api.CreateAudienceExportRequest, + request_type, transport: str = "grpc_asyncio" ): client = BetaAnalyticsDataAsyncClient( credentials=async_anonymous_credentials(), @@ -3358,7 +3385,7 @@ async def test_create_audience_export_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( @@ -3380,11 +3407,6 @@ async def test_create_audience_export_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_audience_export_async_from_dict(): - await test_create_audience_export_async(request_type=dict) - - def test_create_audience_export_field_headers(): client = BetaAnalyticsDataClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3549,8 +3571,8 @@ async def test_create_audience_export_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_data_api.QueryAudienceExportRequest, - dict, + analytics_data_api.QueryAudienceExportRequest(), + {}, ], ) def test_query_audience_export(request_type, transport: str = "grpc"): @@ -3561,7 +3583,7 @@ def test_query_audience_export(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3609,9 +3631,10 @@ def test_query_audience_export_non_empty_request_with_auto_populated_field(): client.query_audience_export(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_data_api.QueryAudienceExportRequest( + request_msg = analytics_data_api.QueryAudienceExportRequest( name="name_value", ) + assert args[0] == request_msg def test_query_audience_export_use_cached_wrapped_rpc(): @@ -3697,9 +3720,15 @@ async def test_query_audience_export_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_data_api.QueryAudienceExportRequest(), + {}, + ], +) async def test_query_audience_export_async( - transport: str = "grpc_asyncio", - request_type=analytics_data_api.QueryAudienceExportRequest, + request_type, transport: str = "grpc_asyncio" ): client = BetaAnalyticsDataAsyncClient( credentials=async_anonymous_credentials(), @@ -3708,7 +3737,7 @@ async def test_query_audience_export_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( @@ -3733,11 +3762,6 @@ async def test_query_audience_export_async( assert response.row_count == 992 -@pytest.mark.asyncio -async def test_query_audience_export_async_from_dict(): - await test_query_audience_export_async(request_type=dict) - - def test_query_audience_export_field_headers(): client = BetaAnalyticsDataClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3892,8 +3916,8 @@ async def test_query_audience_export_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_data_api.GetAudienceExportRequest, - dict, + analytics_data_api.GetAudienceExportRequest(), + {}, ], ) def test_get_audience_export(request_type, transport: str = "grpc"): @@ -3904,7 +3928,7 @@ def test_get_audience_export(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3966,9 +3990,10 @@ def test_get_audience_export_non_empty_request_with_auto_populated_field(): client.get_audience_export(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_data_api.GetAudienceExportRequest( + request_msg = analytics_data_api.GetAudienceExportRequest( name="name_value", ) + assert args[0] == request_msg def test_get_audience_export_use_cached_wrapped_rpc(): @@ -4053,10 +4078,14 @@ async def test_get_audience_export_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_audience_export_async( - transport: str = "grpc_asyncio", - request_type=analytics_data_api.GetAudienceExportRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + analytics_data_api.GetAudienceExportRequest(), + {}, + ], +) +async def test_get_audience_export_async(request_type, transport: str = "grpc_asyncio"): client = BetaAnalyticsDataAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4064,7 +4093,7 @@ async def test_get_audience_export_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( @@ -4103,11 +4132,6 @@ async def test_get_audience_export_async( assert math.isclose(response.percentage_completed, 0.2106, rel_tol=1e-6) -@pytest.mark.asyncio -async def test_get_audience_export_async_from_dict(): - await test_get_audience_export_async(request_type=dict) - - def test_get_audience_export_field_headers(): client = BetaAnalyticsDataClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4262,8 +4286,8 @@ async def test_get_audience_export_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_data_api.ListAudienceExportsRequest, - dict, + analytics_data_api.ListAudienceExportsRequest(), + {}, ], ) def test_list_audience_exports(request_type, transport: str = "grpc"): @@ -4274,7 +4298,7 @@ def test_list_audience_exports(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4323,10 +4347,11 @@ def test_list_audience_exports_non_empty_request_with_auto_populated_field(): client.list_audience_exports(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_data_api.ListAudienceExportsRequest( + request_msg = analytics_data_api.ListAudienceExportsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_audience_exports_use_cached_wrapped_rpc(): @@ -4412,9 +4437,15 @@ async def test_list_audience_exports_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analytics_data_api.ListAudienceExportsRequest(), + {}, + ], +) async def test_list_audience_exports_async( - transport: str = "grpc_asyncio", - request_type=analytics_data_api.ListAudienceExportsRequest, + request_type, transport: str = "grpc_asyncio" ): client = BetaAnalyticsDataAsyncClient( credentials=async_anonymous_credentials(), @@ -4423,7 +4454,7 @@ async def test_list_audience_exports_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( @@ -4448,11 +4479,6 @@ async def test_list_audience_exports_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_audience_exports_async_from_dict(): - await test_list_audience_exports_async(request_type=dict) - - def test_list_audience_exports_field_headers(): client = BetaAnalyticsDataClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6155,7 +6181,6 @@ def test_run_report_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.RunReportRequest() - assert args[0] == request_msg @@ -6176,7 +6201,6 @@ def test_run_pivot_report_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.RunPivotReportRequest() - assert args[0] == request_msg @@ -6199,7 +6223,6 @@ def test_batch_run_reports_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.BatchRunReportsRequest() - assert args[0] == request_msg @@ -6222,7 +6245,6 @@ def test_batch_run_pivot_reports_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.BatchRunPivotReportsRequest() - assert args[0] == request_msg @@ -6243,7 +6265,6 @@ def test_get_metadata_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.GetMetadataRequest() - assert args[0] == request_msg @@ -6266,7 +6287,6 @@ def test_run_realtime_report_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.RunRealtimeReportRequest() - assert args[0] == request_msg @@ -6289,7 +6309,6 @@ def test_check_compatibility_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.CheckCompatibilityRequest() - assert args[0] == request_msg @@ -6312,7 +6331,6 @@ def test_create_audience_export_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.CreateAudienceExportRequest() - assert args[0] == request_msg @@ -6335,7 +6353,6 @@ def test_query_audience_export_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.QueryAudienceExportRequest() - assert args[0] == request_msg @@ -6358,7 +6375,6 @@ def test_get_audience_export_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.GetAudienceExportRequest() - assert args[0] == request_msg @@ -6381,7 +6397,6 @@ def test_list_audience_exports_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.ListAudienceExportsRequest() - assert args[0] == request_msg @@ -6423,7 +6438,6 @@ async def test_run_report_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.RunReportRequest() - assert args[0] == request_msg @@ -6450,7 +6464,6 @@ async def test_run_pivot_report_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.RunPivotReportRequest() - assert args[0] == request_msg @@ -6479,7 +6492,6 @@ async def test_batch_run_reports_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.BatchRunReportsRequest() - assert args[0] == request_msg @@ -6508,7 +6520,6 @@ async def test_batch_run_pivot_reports_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.BatchRunPivotReportsRequest() - assert args[0] == request_msg @@ -6535,7 +6546,6 @@ async def test_get_metadata_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.GetMetadataRequest() - assert args[0] == request_msg @@ -6565,7 +6575,6 @@ async def test_run_realtime_report_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.RunRealtimeReportRequest() - assert args[0] == request_msg @@ -6592,7 +6601,6 @@ async def test_check_compatibility_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.CheckCompatibilityRequest() - assert args[0] == request_msg @@ -6619,7 +6627,6 @@ async def test_create_audience_export_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.CreateAudienceExportRequest() - assert args[0] == request_msg @@ -6648,7 +6655,6 @@ async def test_query_audience_export_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.QueryAudienceExportRequest() - assert args[0] == request_msg @@ -6684,7 +6690,6 @@ async def test_get_audience_export_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.GetAudienceExportRequest() - assert args[0] == request_msg @@ -6713,7 +6718,6 @@ async def test_list_audience_exports_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.ListAudienceExportsRequest() - assert args[0] == request_msg @@ -8320,7 +8324,6 @@ def test_run_report_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.RunReportRequest() - assert args[0] == request_msg @@ -8340,7 +8343,6 @@ def test_run_pivot_report_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.RunPivotReportRequest() - assert args[0] == request_msg @@ -8362,7 +8364,6 @@ def test_batch_run_reports_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.BatchRunReportsRequest() - assert args[0] == request_msg @@ -8384,7 +8385,6 @@ def test_batch_run_pivot_reports_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.BatchRunPivotReportsRequest() - assert args[0] == request_msg @@ -8404,7 +8404,6 @@ def test_get_metadata_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.GetMetadataRequest() - assert args[0] == request_msg @@ -8426,7 +8425,6 @@ def test_run_realtime_report_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.RunRealtimeReportRequest() - assert args[0] == request_msg @@ -8448,7 +8446,6 @@ def test_check_compatibility_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.CheckCompatibilityRequest() - assert args[0] == request_msg @@ -8470,7 +8467,6 @@ def test_create_audience_export_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.CreateAudienceExportRequest() - assert args[0] == request_msg @@ -8492,7 +8488,6 @@ def test_query_audience_export_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.QueryAudienceExportRequest() - assert args[0] == request_msg @@ -8514,7 +8509,6 @@ def test_get_audience_export_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.GetAudienceExportRequest() - assert args[0] == request_msg @@ -8536,7 +8530,6 @@ def test_list_audience_exports_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analytics_data_api.ListAudienceExportsRequest() - assert args[0] == request_msg diff --git a/packages/google-apps-card/noxfile.py b/packages/google-apps-card/noxfile.py index 898ee6c587ea..07e5821e034b 100644 --- a/packages/google-apps-card/noxfile.py +++ b/packages/google-apps-card/noxfile.py @@ -47,7 +47,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-apps-card" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-apps-card/setup.py b/packages/google-apps-card/setup.py index a15a2bde8fd9..318cd93ce4d4 100644 --- a/packages/google-apps-card/setup.py +++ b/packages/google-apps-card/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/google-apps-card/testing/constraints-3.10.txt b/packages/google-apps-card/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-apps-card/testing/constraints-3.10.txt +++ b/packages/google-apps-card/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-apps-chat/noxfile.py b/packages/google-apps-chat/noxfile.py index 993f4e26c9b8..068d9b29104c 100644 --- a/packages/google-apps-chat/noxfile.py +++ b/packages/google-apps-chat/noxfile.py @@ -47,7 +47,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-apps-chat" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-apps-chat/setup.py b/packages/google-apps-chat/setup.py index a9ee3ad9d02c..2c5c14bd9670 100644 --- a/packages/google-apps-chat/setup.py +++ b/packages/google-apps-chat/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/google-apps-chat/testing/constraints-3.10.txt b/packages/google-apps-chat/testing/constraints-3.10.txt index 98c1a2c2b930..3af90f8e61b8 100644 --- a/packages/google-apps-chat/testing/constraints-3.10.txt +++ b/packages/google-apps-chat/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-apps-card==0.3.0 diff --git a/packages/google-apps-chat/tests/unit/gapic/chat_v1/test_chat_service.py b/packages/google-apps-chat/tests/unit/gapic/chat_v1/test_chat_service.py index 3edc1171ab8b..833b2f207c53 100644 --- a/packages/google-apps-chat/tests/unit/gapic/chat_v1/test_chat_service.py +++ b/packages/google-apps-chat/tests/unit/gapic/chat_v1/test_chat_service.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 @@ -145,6 +146,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" @@ -1345,8 +1361,8 @@ def test_chat_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - gc_message.CreateMessageRequest, - dict, + gc_message.CreateMessageRequest(), + {}, ], ) def test_create_message(request_type, transport: str = "grpc"): @@ -1357,7 +1373,7 @@ def test_create_message(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_message), "__call__") as call: @@ -1418,12 +1434,13 @@ def test_create_message_non_empty_request_with_auto_populated_field(): client.create_message(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gc_message.CreateMessageRequest( + request_msg = gc_message.CreateMessageRequest( parent="parent_value", thread_key="thread_key_value", request_id="request_id_value", message_id="message_id_value", ) + assert args[0] == request_msg def test_create_message_use_cached_wrapped_rpc(): @@ -1504,9 +1521,14 @@ async def test_create_message_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_message_async( - transport: str = "grpc_asyncio", request_type=gc_message.CreateMessageRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gc_message.CreateMessageRequest(), + {}, + ], +) +async def test_create_message_async(request_type, transport: str = "grpc_asyncio"): client = ChatServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1514,7 +1536,7 @@ async def test_create_message_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_message), "__call__") as call: @@ -1551,11 +1573,6 @@ async def test_create_message_async( assert response.client_assigned_message_id == "client_assigned_message_id_value" -@pytest.mark.asyncio -async def test_create_message_async_from_dict(): - await test_create_message_async(request_type=dict) - - def test_create_message_field_headers(): client = ChatServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1718,8 +1735,8 @@ async def test_create_message_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - message.ListMessagesRequest, - dict, + message.ListMessagesRequest(), + {}, ], ) def test_list_messages(request_type, transport: str = "grpc"): @@ -1730,7 +1747,7 @@ def test_list_messages(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_messages), "__call__") as call: @@ -1777,12 +1794,13 @@ def test_list_messages_non_empty_request_with_auto_populated_field(): client.list_messages(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == message.ListMessagesRequest( + request_msg = message.ListMessagesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_messages_use_cached_wrapped_rpc(): @@ -1863,9 +1881,14 @@ async def test_list_messages_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_messages_async( - transport: str = "grpc_asyncio", request_type=message.ListMessagesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + message.ListMessagesRequest(), + {}, + ], +) +async def test_list_messages_async(request_type, transport: str = "grpc_asyncio"): client = ChatServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1873,7 +1896,7 @@ async def test_list_messages_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_messages), "__call__") as call: @@ -1896,11 +1919,6 @@ async def test_list_messages_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_messages_async_from_dict(): - await test_list_messages_async(request_type=dict) - - def test_list_messages_field_headers(): client = ChatServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2237,8 +2255,8 @@ async def test_list_messages_async_pages(): @pytest.mark.parametrize( "request_type", [ - membership.ListMembershipsRequest, - dict, + membership.ListMembershipsRequest(), + {}, ], ) def test_list_memberships(request_type, transport: str = "grpc"): @@ -2249,7 +2267,7 @@ def test_list_memberships(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_memberships), "__call__") as call: @@ -2295,11 +2313,12 @@ def test_list_memberships_non_empty_request_with_auto_populated_field(): client.list_memberships(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == membership.ListMembershipsRequest( + request_msg = membership.ListMembershipsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_memberships_use_cached_wrapped_rpc(): @@ -2382,9 +2401,14 @@ async def test_list_memberships_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_memberships_async( - transport: str = "grpc_asyncio", request_type=membership.ListMembershipsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + membership.ListMembershipsRequest(), + {}, + ], +) +async def test_list_memberships_async(request_type, transport: str = "grpc_asyncio"): client = ChatServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2392,7 +2416,7 @@ async def test_list_memberships_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_memberships), "__call__") as call: @@ -2415,11 +2439,6 @@ async def test_list_memberships_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_memberships_async_from_dict(): - await test_list_memberships_async(request_type=dict) - - def test_list_memberships_field_headers(): client = ChatServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2756,8 +2775,8 @@ async def test_list_memberships_async_pages(): @pytest.mark.parametrize( "request_type", [ - membership.GetMembershipRequest, - dict, + membership.GetMembershipRequest(), + {}, ], ) def test_get_membership(request_type, transport: str = "grpc"): @@ -2768,7 +2787,7 @@ def test_get_membership(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_membership), "__call__") as call: @@ -2816,9 +2835,10 @@ def test_get_membership_non_empty_request_with_auto_populated_field(): client.get_membership(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == membership.GetMembershipRequest( + request_msg = membership.GetMembershipRequest( name="name_value", ) + assert args[0] == request_msg def test_get_membership_use_cached_wrapped_rpc(): @@ -2899,9 +2919,14 @@ async def test_get_membership_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_membership_async( - transport: str = "grpc_asyncio", request_type=membership.GetMembershipRequest -): +@pytest.mark.parametrize( + "request_type", + [ + membership.GetMembershipRequest(), + {}, + ], +) +async def test_get_membership_async(request_type, transport: str = "grpc_asyncio"): client = ChatServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2909,7 +2934,7 @@ async def test_get_membership_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_membership), "__call__") as call: @@ -2936,11 +2961,6 @@ async def test_get_membership_async( assert response.role == membership.Membership.MembershipRole.ROLE_MEMBER -@pytest.mark.asyncio -async def test_get_membership_async_from_dict(): - await test_get_membership_async(request_type=dict) - - def test_get_membership_field_headers(): client = ChatServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3087,8 +3107,8 @@ async def test_get_membership_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - message.GetMessageRequest, - dict, + message.GetMessageRequest(), + {}, ], ) def test_get_message(request_type, transport: str = "grpc"): @@ -3099,7 +3119,7 @@ def test_get_message(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_message), "__call__") as call: @@ -3157,9 +3177,10 @@ def test_get_message_non_empty_request_with_auto_populated_field(): client.get_message(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == message.GetMessageRequest( + request_msg = message.GetMessageRequest( name="name_value", ) + assert args[0] == request_msg def test_get_message_use_cached_wrapped_rpc(): @@ -3240,9 +3261,14 @@ async def test_get_message_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_message_async( - transport: str = "grpc_asyncio", request_type=message.GetMessageRequest -): +@pytest.mark.parametrize( + "request_type", + [ + message.GetMessageRequest(), + {}, + ], +) +async def test_get_message_async(request_type, transport: str = "grpc_asyncio"): client = ChatServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3250,7 +3276,7 @@ async def test_get_message_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_message), "__call__") as call: @@ -3287,11 +3313,6 @@ async def test_get_message_async( assert response.client_assigned_message_id == "client_assigned_message_id_value" -@pytest.mark.asyncio -async def test_get_message_async_from_dict(): - await test_get_message_async(request_type=dict) - - def test_get_message_field_headers(): client = ChatServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3434,8 +3455,8 @@ async def test_get_message_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gc_message.UpdateMessageRequest, - dict, + gc_message.UpdateMessageRequest(), + {}, ], ) def test_update_message(request_type, transport: str = "grpc"): @@ -3446,7 +3467,7 @@ def test_update_message(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_message), "__call__") as call: @@ -3502,7 +3523,8 @@ def test_update_message_non_empty_request_with_auto_populated_field(): client.update_message(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gc_message.UpdateMessageRequest() + request_msg = gc_message.UpdateMessageRequest() + assert args[0] == request_msg def test_update_message_use_cached_wrapped_rpc(): @@ -3583,9 +3605,14 @@ async def test_update_message_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_message_async( - transport: str = "grpc_asyncio", request_type=gc_message.UpdateMessageRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gc_message.UpdateMessageRequest(), + {}, + ], +) +async def test_update_message_async(request_type, transport: str = "grpc_asyncio"): client = ChatServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3593,7 +3620,7 @@ async def test_update_message_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_message), "__call__") as call: @@ -3630,11 +3657,6 @@ async def test_update_message_async( assert response.client_assigned_message_id == "client_assigned_message_id_value" -@pytest.mark.asyncio -async def test_update_message_async_from_dict(): - await test_update_message_async(request_type=dict) - - def test_update_message_field_headers(): client = ChatServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3787,8 +3809,8 @@ async def test_update_message_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - message.DeleteMessageRequest, - dict, + message.DeleteMessageRequest(), + {}, ], ) def test_delete_message(request_type, transport: str = "grpc"): @@ -3799,7 +3821,7 @@ def test_delete_message(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_message), "__call__") as call: @@ -3840,9 +3862,10 @@ def test_delete_message_non_empty_request_with_auto_populated_field(): client.delete_message(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == message.DeleteMessageRequest( + request_msg = message.DeleteMessageRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_message_use_cached_wrapped_rpc(): @@ -3923,9 +3946,14 @@ async def test_delete_message_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_message_async( - transport: str = "grpc_asyncio", request_type=message.DeleteMessageRequest -): +@pytest.mark.parametrize( + "request_type", + [ + message.DeleteMessageRequest(), + {}, + ], +) +async def test_delete_message_async(request_type, transport: str = "grpc_asyncio"): client = ChatServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3933,7 +3961,7 @@ async def test_delete_message_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_message), "__call__") as call: @@ -3951,11 +3979,6 @@ async def test_delete_message_async( assert response is None -@pytest.mark.asyncio -async def test_delete_message_async_from_dict(): - await test_delete_message_async(request_type=dict) - - def test_delete_message_field_headers(): client = ChatServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4098,8 +4121,8 @@ async def test_delete_message_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - attachment.GetAttachmentRequest, - dict, + attachment.GetAttachmentRequest(), + {}, ], ) def test_get_attachment(request_type, transport: str = "grpc"): @@ -4110,7 +4133,7 @@ def test_get_attachment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_attachment), "__call__") as call: @@ -4164,9 +4187,10 @@ def test_get_attachment_non_empty_request_with_auto_populated_field(): client.get_attachment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == attachment.GetAttachmentRequest( + request_msg = attachment.GetAttachmentRequest( name="name_value", ) + assert args[0] == request_msg def test_get_attachment_use_cached_wrapped_rpc(): @@ -4247,9 +4271,14 @@ async def test_get_attachment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_attachment_async( - transport: str = "grpc_asyncio", request_type=attachment.GetAttachmentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + attachment.GetAttachmentRequest(), + {}, + ], +) +async def test_get_attachment_async(request_type, transport: str = "grpc_asyncio"): client = ChatServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4257,7 +4286,7 @@ async def test_get_attachment_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_attachment), "__call__") as call: @@ -4290,11 +4319,6 @@ async def test_get_attachment_async( assert response.source == attachment.Attachment.Source.DRIVE_FILE -@pytest.mark.asyncio -async def test_get_attachment_async_from_dict(): - await test_get_attachment_async(request_type=dict) - - def test_get_attachment_field_headers(): client = ChatServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4441,8 +4465,8 @@ async def test_get_attachment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - attachment.UploadAttachmentRequest, - dict, + attachment.UploadAttachmentRequest(), + {}, ], ) def test_upload_attachment(request_type, transport: str = "grpc"): @@ -4453,7 +4477,7 @@ def test_upload_attachment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4499,10 +4523,11 @@ def test_upload_attachment_non_empty_request_with_auto_populated_field(): client.upload_attachment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == attachment.UploadAttachmentRequest( + request_msg = attachment.UploadAttachmentRequest( parent="parent_value", filename="filename_value", ) + assert args[0] == request_msg def test_upload_attachment_use_cached_wrapped_rpc(): @@ -4585,9 +4610,14 @@ async def test_upload_attachment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_upload_attachment_async( - transport: str = "grpc_asyncio", request_type=attachment.UploadAttachmentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + attachment.UploadAttachmentRequest(), + {}, + ], +) +async def test_upload_attachment_async(request_type, transport: str = "grpc_asyncio"): client = ChatServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4595,7 +4625,7 @@ async def test_upload_attachment_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( @@ -4617,11 +4647,6 @@ async def test_upload_attachment_async( assert isinstance(response, attachment.UploadAttachmentResponse) -@pytest.mark.asyncio -async def test_upload_attachment_async_from_dict(): - await test_upload_attachment_async(request_type=dict) - - def test_upload_attachment_field_headers(): client = ChatServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4690,8 +4715,8 @@ async def test_upload_attachment_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - space.ListSpacesRequest, - dict, + space.ListSpacesRequest(), + {}, ], ) def test_list_spaces(request_type, transport: str = "grpc"): @@ -4702,7 +4727,7 @@ def test_list_spaces(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_spaces), "__call__") as call: @@ -4747,10 +4772,11 @@ def test_list_spaces_non_empty_request_with_auto_populated_field(): client.list_spaces(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == space.ListSpacesRequest( + request_msg = space.ListSpacesRequest( page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_spaces_use_cached_wrapped_rpc(): @@ -4831,9 +4857,14 @@ async def test_list_spaces_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_spaces_async( - transport: str = "grpc_asyncio", request_type=space.ListSpacesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + space.ListSpacesRequest(), + {}, + ], +) +async def test_list_spaces_async(request_type, transport: str = "grpc_asyncio"): client = ChatServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4841,7 +4872,7 @@ async def test_list_spaces_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_spaces), "__call__") as call: @@ -4864,11 +4895,6 @@ async def test_list_spaces_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_spaces_async_from_dict(): - await test_list_spaces_async(request_type=dict) - - def test_list_spaces_pager(transport_name: str = "grpc"): client = ChatServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5059,8 +5085,8 @@ async def test_list_spaces_async_pages(): @pytest.mark.parametrize( "request_type", [ - space.SearchSpacesRequest, - dict, + space.SearchSpacesRequest(), + {}, ], ) def test_search_spaces(request_type, transport: str = "grpc"): @@ -5071,7 +5097,7 @@ def test_search_spaces(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.search_spaces), "__call__") as call: @@ -5119,11 +5145,12 @@ def test_search_spaces_non_empty_request_with_auto_populated_field(): client.search_spaces(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == space.SearchSpacesRequest( + request_msg = space.SearchSpacesRequest( page_token="page_token_value", query="query_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_search_spaces_use_cached_wrapped_rpc(): @@ -5204,9 +5231,14 @@ async def test_search_spaces_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_search_spaces_async( - transport: str = "grpc_asyncio", request_type=space.SearchSpacesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + space.SearchSpacesRequest(), + {}, + ], +) +async def test_search_spaces_async(request_type, transport: str = "grpc_asyncio"): client = ChatServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5214,7 +5246,7 @@ async def test_search_spaces_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.search_spaces), "__call__") as call: @@ -5239,11 +5271,6 @@ async def test_search_spaces_async( assert response.total_size == 1086 -@pytest.mark.asyncio -async def test_search_spaces_async_from_dict(): - await test_search_spaces_async(request_type=dict) - - def test_search_spaces_pager(transport_name: str = "grpc"): client = ChatServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5434,8 +5461,8 @@ async def test_search_spaces_async_pages(): @pytest.mark.parametrize( "request_type", [ - space.GetSpaceRequest, - dict, + space.GetSpaceRequest(), + {}, ], ) def test_get_space(request_type, transport: str = "grpc"): @@ -5446,7 +5473,7 @@ def test_get_space(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_space), "__call__") as call: @@ -5518,9 +5545,10 @@ def test_get_space_non_empty_request_with_auto_populated_field(): client.get_space(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == space.GetSpaceRequest( + request_msg = space.GetSpaceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_space_use_cached_wrapped_rpc(): @@ -5599,9 +5627,14 @@ async def test_get_space_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_space_async( - transport: str = "grpc_asyncio", request_type=space.GetSpaceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + space.GetSpaceRequest(), + {}, + ], +) +async def test_get_space_async(request_type, transport: str = "grpc_asyncio"): client = ChatServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5609,7 +5642,7 @@ async def test_get_space_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_space), "__call__") as call: @@ -5659,11 +5692,6 @@ async def test_get_space_async( assert response.space_uri == "space_uri_value" -@pytest.mark.asyncio -async def test_get_space_async_from_dict(): - await test_get_space_async(request_type=dict) - - def test_get_space_field_headers(): client = ChatServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5806,8 +5834,8 @@ async def test_get_space_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gc_space.CreateSpaceRequest, - dict, + gc_space.CreateSpaceRequest(), + {}, ], ) def test_create_space(request_type, transport: str = "grpc"): @@ -5818,7 +5846,7 @@ def test_create_space(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_space), "__call__") as call: @@ -5890,9 +5918,10 @@ def test_create_space_non_empty_request_with_auto_populated_field(): client.create_space(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gc_space.CreateSpaceRequest( + request_msg = gc_space.CreateSpaceRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_create_space_use_cached_wrapped_rpc(): @@ -5973,9 +6002,14 @@ async def test_create_space_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_space_async( - transport: str = "grpc_asyncio", request_type=gc_space.CreateSpaceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gc_space.CreateSpaceRequest(), + {}, + ], +) +async def test_create_space_async(request_type, transport: str = "grpc_asyncio"): client = ChatServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5983,7 +6017,7 @@ async def test_create_space_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_space), "__call__") as call: @@ -6033,11 +6067,6 @@ async def test_create_space_async( assert response.space_uri == "space_uri_value" -@pytest.mark.asyncio -async def test_create_space_async_from_dict(): - await test_create_space_async(request_type=dict) - - def test_create_space_flattened(): client = ChatServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6121,8 +6150,8 @@ async def test_create_space_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - space_setup.SetUpSpaceRequest, - dict, + space_setup.SetUpSpaceRequest(), + {}, ], ) def test_set_up_space(request_type, transport: str = "grpc"): @@ -6133,7 +6162,7 @@ def test_set_up_space(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.set_up_space), "__call__") as call: @@ -6205,9 +6234,10 @@ def test_set_up_space_non_empty_request_with_auto_populated_field(): client.set_up_space(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == space_setup.SetUpSpaceRequest( + request_msg = space_setup.SetUpSpaceRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_set_up_space_use_cached_wrapped_rpc(): @@ -6288,9 +6318,14 @@ async def test_set_up_space_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_up_space_async( - transport: str = "grpc_asyncio", request_type=space_setup.SetUpSpaceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + space_setup.SetUpSpaceRequest(), + {}, + ], +) +async def test_set_up_space_async(request_type, transport: str = "grpc_asyncio"): client = ChatServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6298,7 +6333,7 @@ async def test_set_up_space_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.set_up_space), "__call__") as call: @@ -6348,16 +6383,11 @@ async def test_set_up_space_async( assert response.space_uri == "space_uri_value" -@pytest.mark.asyncio -async def test_set_up_space_async_from_dict(): - await test_set_up_space_async(request_type=dict) - - @pytest.mark.parametrize( "request_type", [ - gc_space.UpdateSpaceRequest, - dict, + gc_space.UpdateSpaceRequest(), + {}, ], ) def test_update_space(request_type, transport: str = "grpc"): @@ -6368,7 +6398,7 @@ def test_update_space(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_space), "__call__") as call: @@ -6438,7 +6468,8 @@ def test_update_space_non_empty_request_with_auto_populated_field(): client.update_space(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gc_space.UpdateSpaceRequest() + request_msg = gc_space.UpdateSpaceRequest() + assert args[0] == request_msg def test_update_space_use_cached_wrapped_rpc(): @@ -6519,9 +6550,14 @@ async def test_update_space_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_space_async( - transport: str = "grpc_asyncio", request_type=gc_space.UpdateSpaceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gc_space.UpdateSpaceRequest(), + {}, + ], +) +async def test_update_space_async(request_type, transport: str = "grpc_asyncio"): client = ChatServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6529,7 +6565,7 @@ async def test_update_space_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_space), "__call__") as call: @@ -6579,11 +6615,6 @@ async def test_update_space_async( assert response.space_uri == "space_uri_value" -@pytest.mark.asyncio -async def test_update_space_async_from_dict(): - await test_update_space_async(request_type=dict) - - def test_update_space_field_headers(): client = ChatServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6736,8 +6767,8 @@ async def test_update_space_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - space.DeleteSpaceRequest, - dict, + space.DeleteSpaceRequest(), + {}, ], ) def test_delete_space(request_type, transport: str = "grpc"): @@ -6748,7 +6779,7 @@ def test_delete_space(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_space), "__call__") as call: @@ -6789,9 +6820,10 @@ def test_delete_space_non_empty_request_with_auto_populated_field(): client.delete_space(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == space.DeleteSpaceRequest( + request_msg = space.DeleteSpaceRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_space_use_cached_wrapped_rpc(): @@ -6872,9 +6904,14 @@ async def test_delete_space_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_space_async( - transport: str = "grpc_asyncio", request_type=space.DeleteSpaceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + space.DeleteSpaceRequest(), + {}, + ], +) +async def test_delete_space_async(request_type, transport: str = "grpc_asyncio"): client = ChatServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6882,7 +6919,7 @@ async def test_delete_space_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_space), "__call__") as call: @@ -6900,11 +6937,6 @@ async def test_delete_space_async( assert response is None -@pytest.mark.asyncio -async def test_delete_space_async_from_dict(): - await test_delete_space_async(request_type=dict) - - def test_delete_space_field_headers(): client = ChatServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7047,8 +7079,8 @@ async def test_delete_space_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - space.CompleteImportSpaceRequest, - dict, + space.CompleteImportSpaceRequest(), + {}, ], ) def test_complete_import_space(request_type, transport: str = "grpc"): @@ -7059,7 +7091,7 @@ def test_complete_import_space(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7104,9 +7136,10 @@ def test_complete_import_space_non_empty_request_with_auto_populated_field(): client.complete_import_space(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == space.CompleteImportSpaceRequest( + request_msg = space.CompleteImportSpaceRequest( name="name_value", ) + assert args[0] == request_msg def test_complete_import_space_use_cached_wrapped_rpc(): @@ -7192,8 +7225,15 @@ async def test_complete_import_space_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + space.CompleteImportSpaceRequest(), + {}, + ], +) async def test_complete_import_space_async( - transport: str = "grpc_asyncio", request_type=space.CompleteImportSpaceRequest + request_type, transport: str = "grpc_asyncio" ): client = ChatServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -7202,7 +7242,7 @@ async def test_complete_import_space_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( @@ -7224,11 +7264,6 @@ async def test_complete_import_space_async( assert isinstance(response, space.CompleteImportSpaceResponse) -@pytest.mark.asyncio -async def test_complete_import_space_async_from_dict(): - await test_complete_import_space_async(request_type=dict) - - def test_complete_import_space_field_headers(): client = ChatServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7297,8 +7332,8 @@ async def test_complete_import_space_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - space.FindDirectMessageRequest, - dict, + space.FindDirectMessageRequest(), + {}, ], ) def test_find_direct_message(request_type, transport: str = "grpc"): @@ -7309,7 +7344,7 @@ def test_find_direct_message(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7385,9 +7420,10 @@ def test_find_direct_message_non_empty_request_with_auto_populated_field(): client.find_direct_message(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == space.FindDirectMessageRequest( + request_msg = space.FindDirectMessageRequest( name="name_value", ) + assert args[0] == request_msg def test_find_direct_message_use_cached_wrapped_rpc(): @@ -7472,9 +7508,14 @@ async def test_find_direct_message_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_find_direct_message_async( - transport: str = "grpc_asyncio", request_type=space.FindDirectMessageRequest -): +@pytest.mark.parametrize( + "request_type", + [ + space.FindDirectMessageRequest(), + {}, + ], +) +async def test_find_direct_message_async(request_type, transport: str = "grpc_asyncio"): client = ChatServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7482,7 +7523,7 @@ async def test_find_direct_message_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( @@ -7534,16 +7575,11 @@ async def test_find_direct_message_async( assert response.space_uri == "space_uri_value" -@pytest.mark.asyncio -async def test_find_direct_message_async_from_dict(): - await test_find_direct_message_async(request_type=dict) - - @pytest.mark.parametrize( "request_type", [ - space.FindGroupChatsRequest, - dict, + space.FindGroupChatsRequest(), + {}, ], ) def test_find_group_chats(request_type, transport: str = "grpc"): @@ -7554,7 +7590,7 @@ def test_find_group_chats(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.find_group_chats), "__call__") as call: @@ -7598,9 +7634,10 @@ def test_find_group_chats_non_empty_request_with_auto_populated_field(): client.find_group_chats(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == space.FindGroupChatsRequest( + request_msg = space.FindGroupChatsRequest( page_token="page_token_value", ) + assert args[0] == request_msg def test_find_group_chats_use_cached_wrapped_rpc(): @@ -7683,9 +7720,14 @@ async def test_find_group_chats_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_find_group_chats_async( - transport: str = "grpc_asyncio", request_type=space.FindGroupChatsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + space.FindGroupChatsRequest(), + {}, + ], +) +async def test_find_group_chats_async(request_type, transport: str = "grpc_asyncio"): client = ChatServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7693,7 +7735,7 @@ async def test_find_group_chats_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.find_group_chats), "__call__") as call: @@ -7716,11 +7758,6 @@ async def test_find_group_chats_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_find_group_chats_async_from_dict(): - await test_find_group_chats_async(request_type=dict) - - def test_find_group_chats_pager(transport_name: str = "grpc"): client = ChatServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7911,8 +7948,8 @@ async def test_find_group_chats_async_pages(): @pytest.mark.parametrize( "request_type", [ - gc_membership.CreateMembershipRequest, - dict, + gc_membership.CreateMembershipRequest(), + {}, ], ) def test_create_membership(request_type, transport: str = "grpc"): @@ -7923,7 +7960,7 @@ def test_create_membership(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7975,9 +8012,10 @@ def test_create_membership_non_empty_request_with_auto_populated_field(): client.create_membership(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gc_membership.CreateMembershipRequest( + request_msg = gc_membership.CreateMembershipRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_membership_use_cached_wrapped_rpc(): @@ -8060,9 +8098,14 @@ async def test_create_membership_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_membership_async( - transport: str = "grpc_asyncio", request_type=gc_membership.CreateMembershipRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gc_membership.CreateMembershipRequest(), + {}, + ], +) +async def test_create_membership_async(request_type, transport: str = "grpc_asyncio"): client = ChatServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8070,7 +8113,7 @@ async def test_create_membership_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( @@ -8099,11 +8142,6 @@ async def test_create_membership_async( assert response.role == gc_membership.Membership.MembershipRole.ROLE_MEMBER -@pytest.mark.asyncio -async def test_create_membership_async_from_dict(): - await test_create_membership_async(request_type=dict) - - def test_create_membership_field_headers(): client = ChatServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8268,8 +8306,8 @@ async def test_create_membership_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gc_membership.UpdateMembershipRequest, - dict, + gc_membership.UpdateMembershipRequest(), + {}, ], ) def test_update_membership(request_type, transport: str = "grpc"): @@ -8280,7 +8318,7 @@ def test_update_membership(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8330,7 +8368,8 @@ def test_update_membership_non_empty_request_with_auto_populated_field(): client.update_membership(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gc_membership.UpdateMembershipRequest() + request_msg = gc_membership.UpdateMembershipRequest() + assert args[0] == request_msg def test_update_membership_use_cached_wrapped_rpc(): @@ -8413,9 +8452,14 @@ async def test_update_membership_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_membership_async( - transport: str = "grpc_asyncio", request_type=gc_membership.UpdateMembershipRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gc_membership.UpdateMembershipRequest(), + {}, + ], +) +async def test_update_membership_async(request_type, transport: str = "grpc_asyncio"): client = ChatServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8423,7 +8467,7 @@ async def test_update_membership_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( @@ -8452,11 +8496,6 @@ async def test_update_membership_async( assert response.role == gc_membership.Membership.MembershipRole.ROLE_MEMBER -@pytest.mark.asyncio -async def test_update_membership_async_from_dict(): - await test_update_membership_async(request_type=dict) - - def test_update_membership_field_headers(): client = ChatServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8621,8 +8660,8 @@ async def test_update_membership_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - membership.DeleteMembershipRequest, - dict, + membership.DeleteMembershipRequest(), + {}, ], ) def test_delete_membership(request_type, transport: str = "grpc"): @@ -8633,7 +8672,7 @@ def test_delete_membership(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8685,9 +8724,10 @@ def test_delete_membership_non_empty_request_with_auto_populated_field(): client.delete_membership(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == membership.DeleteMembershipRequest( + request_msg = membership.DeleteMembershipRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_membership_use_cached_wrapped_rpc(): @@ -8770,9 +8810,14 @@ async def test_delete_membership_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_membership_async( - transport: str = "grpc_asyncio", request_type=membership.DeleteMembershipRequest -): +@pytest.mark.parametrize( + "request_type", + [ + membership.DeleteMembershipRequest(), + {}, + ], +) +async def test_delete_membership_async(request_type, transport: str = "grpc_asyncio"): client = ChatServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8780,7 +8825,7 @@ async def test_delete_membership_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( @@ -8809,11 +8854,6 @@ async def test_delete_membership_async( assert response.role == membership.Membership.MembershipRole.ROLE_MEMBER -@pytest.mark.asyncio -async def test_delete_membership_async_from_dict(): - await test_delete_membership_async(request_type=dict) - - def test_delete_membership_field_headers(): client = ChatServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8968,8 +9008,8 @@ async def test_delete_membership_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gc_reaction.CreateReactionRequest, - dict, + gc_reaction.CreateReactionRequest(), + {}, ], ) def test_create_reaction(request_type, transport: str = "grpc"): @@ -8980,7 +9020,7 @@ def test_create_reaction(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_reaction), "__call__") as call: @@ -9024,9 +9064,10 @@ def test_create_reaction_non_empty_request_with_auto_populated_field(): client.create_reaction(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gc_reaction.CreateReactionRequest( + request_msg = gc_reaction.CreateReactionRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_reaction_use_cached_wrapped_rpc(): @@ -9107,9 +9148,14 @@ async def test_create_reaction_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_reaction_async( - transport: str = "grpc_asyncio", request_type=gc_reaction.CreateReactionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gc_reaction.CreateReactionRequest(), + {}, + ], +) +async def test_create_reaction_async(request_type, transport: str = "grpc_asyncio"): client = ChatServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9117,7 +9163,7 @@ async def test_create_reaction_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_reaction), "__call__") as call: @@ -9140,11 +9186,6 @@ async def test_create_reaction_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_create_reaction_async_from_dict(): - await test_create_reaction_async(request_type=dict) - - def test_create_reaction_field_headers(): client = ChatServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9301,8 +9342,8 @@ async def test_create_reaction_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - reaction.ListReactionsRequest, - dict, + reaction.ListReactionsRequest(), + {}, ], ) def test_list_reactions(request_type, transport: str = "grpc"): @@ -9313,7 +9354,7 @@ def test_list_reactions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_reactions), "__call__") as call: @@ -9359,11 +9400,12 @@ def test_list_reactions_non_empty_request_with_auto_populated_field(): client.list_reactions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == reaction.ListReactionsRequest( + request_msg = reaction.ListReactionsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_reactions_use_cached_wrapped_rpc(): @@ -9444,9 +9486,14 @@ async def test_list_reactions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_reactions_async( - transport: str = "grpc_asyncio", request_type=reaction.ListReactionsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + reaction.ListReactionsRequest(), + {}, + ], +) +async def test_list_reactions_async(request_type, transport: str = "grpc_asyncio"): client = ChatServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9454,7 +9501,7 @@ async def test_list_reactions_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_reactions), "__call__") as call: @@ -9477,11 +9524,6 @@ async def test_list_reactions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_reactions_async_from_dict(): - await test_list_reactions_async(request_type=dict) - - def test_list_reactions_field_headers(): client = ChatServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9818,8 +9860,8 @@ async def test_list_reactions_async_pages(): @pytest.mark.parametrize( "request_type", [ - reaction.DeleteReactionRequest, - dict, + reaction.DeleteReactionRequest(), + {}, ], ) def test_delete_reaction(request_type, transport: str = "grpc"): @@ -9830,7 +9872,7 @@ def test_delete_reaction(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_reaction), "__call__") as call: @@ -9871,9 +9913,10 @@ def test_delete_reaction_non_empty_request_with_auto_populated_field(): client.delete_reaction(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == reaction.DeleteReactionRequest( + request_msg = reaction.DeleteReactionRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_reaction_use_cached_wrapped_rpc(): @@ -9954,9 +9997,14 @@ async def test_delete_reaction_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_reaction_async( - transport: str = "grpc_asyncio", request_type=reaction.DeleteReactionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + reaction.DeleteReactionRequest(), + {}, + ], +) +async def test_delete_reaction_async(request_type, transport: str = "grpc_asyncio"): client = ChatServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9964,7 +10012,7 @@ async def test_delete_reaction_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_reaction), "__call__") as call: @@ -9982,11 +10030,6 @@ async def test_delete_reaction_async( assert response is None -@pytest.mark.asyncio -async def test_delete_reaction_async_from_dict(): - await test_delete_reaction_async(request_type=dict) - - def test_delete_reaction_field_headers(): client = ChatServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10129,8 +10172,8 @@ async def test_delete_reaction_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - reaction.CreateCustomEmojiRequest, - dict, + reaction.CreateCustomEmojiRequest(), + {}, ], ) def test_create_custom_emoji(request_type, transport: str = "grpc"): @@ -10141,7 +10184,7 @@ def test_create_custom_emoji(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10193,7 +10236,8 @@ def test_create_custom_emoji_non_empty_request_with_auto_populated_field(): client.create_custom_emoji(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == reaction.CreateCustomEmojiRequest() + request_msg = reaction.CreateCustomEmojiRequest() + assert args[0] == request_msg def test_create_custom_emoji_use_cached_wrapped_rpc(): @@ -10278,9 +10322,14 @@ async def test_create_custom_emoji_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_custom_emoji_async( - transport: str = "grpc_asyncio", request_type=reaction.CreateCustomEmojiRequest -): +@pytest.mark.parametrize( + "request_type", + [ + reaction.CreateCustomEmojiRequest(), + {}, + ], +) +async def test_create_custom_emoji_async(request_type, transport: str = "grpc_asyncio"): client = ChatServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10288,7 +10337,7 @@ async def test_create_custom_emoji_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( @@ -10319,11 +10368,6 @@ async def test_create_custom_emoji_async( assert response.temporary_image_uri == "temporary_image_uri_value" -@pytest.mark.asyncio -async def test_create_custom_emoji_async_from_dict(): - await test_create_custom_emoji_async(request_type=dict) - - def test_create_custom_emoji_flattened(): client = ChatServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10413,8 +10457,8 @@ async def test_create_custom_emoji_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - reaction.GetCustomEmojiRequest, - dict, + reaction.GetCustomEmojiRequest(), + {}, ], ) def test_get_custom_emoji(request_type, transport: str = "grpc"): @@ -10425,7 +10469,7 @@ def test_get_custom_emoji(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_custom_emoji), "__call__") as call: @@ -10475,9 +10519,10 @@ def test_get_custom_emoji_non_empty_request_with_auto_populated_field(): client.get_custom_emoji(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == reaction.GetCustomEmojiRequest( + request_msg = reaction.GetCustomEmojiRequest( name="name_value", ) + assert args[0] == request_msg def test_get_custom_emoji_use_cached_wrapped_rpc(): @@ -10560,9 +10605,14 @@ async def test_get_custom_emoji_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_custom_emoji_async( - transport: str = "grpc_asyncio", request_type=reaction.GetCustomEmojiRequest -): +@pytest.mark.parametrize( + "request_type", + [ + reaction.GetCustomEmojiRequest(), + {}, + ], +) +async def test_get_custom_emoji_async(request_type, transport: str = "grpc_asyncio"): client = ChatServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10570,7 +10620,7 @@ async def test_get_custom_emoji_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_custom_emoji), "__call__") as call: @@ -10599,11 +10649,6 @@ async def test_get_custom_emoji_async( assert response.temporary_image_uri == "temporary_image_uri_value" -@pytest.mark.asyncio -async def test_get_custom_emoji_async_from_dict(): - await test_get_custom_emoji_async(request_type=dict) - - def test_get_custom_emoji_field_headers(): client = ChatServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10750,8 +10795,8 @@ async def test_get_custom_emoji_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - reaction.ListCustomEmojisRequest, - dict, + reaction.ListCustomEmojisRequest(), + {}, ], ) def test_list_custom_emojis(request_type, transport: str = "grpc"): @@ -10762,7 +10807,7 @@ def test_list_custom_emojis(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10811,10 +10856,11 @@ def test_list_custom_emojis_non_empty_request_with_auto_populated_field(): client.list_custom_emojis(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == reaction.ListCustomEmojisRequest( + request_msg = reaction.ListCustomEmojisRequest( page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_custom_emojis_use_cached_wrapped_rpc(): @@ -10899,9 +10945,14 @@ async def test_list_custom_emojis_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_custom_emojis_async( - transport: str = "grpc_asyncio", request_type=reaction.ListCustomEmojisRequest -): +@pytest.mark.parametrize( + "request_type", + [ + reaction.ListCustomEmojisRequest(), + {}, + ], +) +async def test_list_custom_emojis_async(request_type, transport: str = "grpc_asyncio"): client = ChatServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10909,7 +10960,7 @@ async def test_list_custom_emojis_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( @@ -10934,11 +10985,6 @@ async def test_list_custom_emojis_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_custom_emojis_async_from_dict(): - await test_list_custom_emojis_async(request_type=dict) - - def test_list_custom_emojis_pager(transport_name: str = "grpc"): client = ChatServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11137,8 +11183,8 @@ async def test_list_custom_emojis_async_pages(): @pytest.mark.parametrize( "request_type", [ - reaction.DeleteCustomEmojiRequest, - dict, + reaction.DeleteCustomEmojiRequest(), + {}, ], ) def test_delete_custom_emoji(request_type, transport: str = "grpc"): @@ -11149,7 +11195,7 @@ def test_delete_custom_emoji(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11194,9 +11240,10 @@ def test_delete_custom_emoji_non_empty_request_with_auto_populated_field(): client.delete_custom_emoji(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == reaction.DeleteCustomEmojiRequest( + request_msg = reaction.DeleteCustomEmojiRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_custom_emoji_use_cached_wrapped_rpc(): @@ -11281,9 +11328,14 @@ async def test_delete_custom_emoji_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_custom_emoji_async( - transport: str = "grpc_asyncio", request_type=reaction.DeleteCustomEmojiRequest -): +@pytest.mark.parametrize( + "request_type", + [ + reaction.DeleteCustomEmojiRequest(), + {}, + ], +) +async def test_delete_custom_emoji_async(request_type, transport: str = "grpc_asyncio"): client = ChatServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11291,7 +11343,7 @@ async def test_delete_custom_emoji_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( @@ -11311,11 +11363,6 @@ async def test_delete_custom_emoji_async( assert response is None -@pytest.mark.asyncio -async def test_delete_custom_emoji_async_from_dict(): - await test_delete_custom_emoji_async(request_type=dict) - - def test_delete_custom_emoji_field_headers(): client = ChatServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11466,8 +11513,8 @@ async def test_delete_custom_emoji_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - space_read_state.GetSpaceReadStateRequest, - dict, + space_read_state.GetSpaceReadStateRequest(), + {}, ], ) def test_get_space_read_state(request_type, transport: str = "grpc"): @@ -11478,7 +11525,7 @@ def test_get_space_read_state(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11526,9 +11573,10 @@ def test_get_space_read_state_non_empty_request_with_auto_populated_field(): client.get_space_read_state(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == space_read_state.GetSpaceReadStateRequest( + request_msg = space_read_state.GetSpaceReadStateRequest( name="name_value", ) + assert args[0] == request_msg def test_get_space_read_state_use_cached_wrapped_rpc(): @@ -11613,9 +11661,15 @@ async def test_get_space_read_state_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + space_read_state.GetSpaceReadStateRequest(), + {}, + ], +) async def test_get_space_read_state_async( - transport: str = "grpc_asyncio", - request_type=space_read_state.GetSpaceReadStateRequest, + request_type, transport: str = "grpc_asyncio" ): client = ChatServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -11624,7 +11678,7 @@ async def test_get_space_read_state_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( @@ -11649,11 +11703,6 @@ async def test_get_space_read_state_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_space_read_state_async_from_dict(): - await test_get_space_read_state_async(request_type=dict) - - def test_get_space_read_state_field_headers(): client = ChatServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11808,8 +11857,8 @@ async def test_get_space_read_state_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gc_space_read_state.UpdateSpaceReadStateRequest, - dict, + gc_space_read_state.UpdateSpaceReadStateRequest(), + {}, ], ) def test_update_space_read_state(request_type, transport: str = "grpc"): @@ -11820,7 +11869,7 @@ def test_update_space_read_state(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11866,7 +11915,8 @@ def test_update_space_read_state_non_empty_request_with_auto_populated_field(): client.update_space_read_state(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gc_space_read_state.UpdateSpaceReadStateRequest() + request_msg = gc_space_read_state.UpdateSpaceReadStateRequest() + assert args[0] == request_msg def test_update_space_read_state_use_cached_wrapped_rpc(): @@ -11952,9 +12002,15 @@ async def test_update_space_read_state_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gc_space_read_state.UpdateSpaceReadStateRequest(), + {}, + ], +) async def test_update_space_read_state_async( - transport: str = "grpc_asyncio", - request_type=gc_space_read_state.UpdateSpaceReadStateRequest, + request_type, transport: str = "grpc_asyncio" ): client = ChatServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -11963,7 +12019,7 @@ async def test_update_space_read_state_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( @@ -11988,11 +12044,6 @@ async def test_update_space_read_state_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_update_space_read_state_async_from_dict(): - await test_update_space_read_state_async(request_type=dict) - - def test_update_space_read_state_field_headers(): client = ChatServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12157,8 +12208,8 @@ async def test_update_space_read_state_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - thread_read_state.GetThreadReadStateRequest, - dict, + thread_read_state.GetThreadReadStateRequest(), + {}, ], ) def test_get_thread_read_state(request_type, transport: str = "grpc"): @@ -12169,7 +12220,7 @@ def test_get_thread_read_state(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -12217,9 +12268,10 @@ def test_get_thread_read_state_non_empty_request_with_auto_populated_field(): client.get_thread_read_state(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == thread_read_state.GetThreadReadStateRequest( + request_msg = thread_read_state.GetThreadReadStateRequest( name="name_value", ) + assert args[0] == request_msg def test_get_thread_read_state_use_cached_wrapped_rpc(): @@ -12305,9 +12357,15 @@ async def test_get_thread_read_state_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + thread_read_state.GetThreadReadStateRequest(), + {}, + ], +) async def test_get_thread_read_state_async( - transport: str = "grpc_asyncio", - request_type=thread_read_state.GetThreadReadStateRequest, + request_type, transport: str = "grpc_asyncio" ): client = ChatServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -12316,7 +12374,7 @@ async def test_get_thread_read_state_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( @@ -12341,11 +12399,6 @@ async def test_get_thread_read_state_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_thread_read_state_async_from_dict(): - await test_get_thread_read_state_async(request_type=dict) - - def test_get_thread_read_state_field_headers(): client = ChatServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12500,8 +12553,8 @@ async def test_get_thread_read_state_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - space_event.GetSpaceEventRequest, - dict, + space_event.GetSpaceEventRequest(), + {}, ], ) def test_get_space_event(request_type, transport: str = "grpc"): @@ -12512,7 +12565,7 @@ def test_get_space_event(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_space_event), "__call__") as call: @@ -12558,9 +12611,10 @@ def test_get_space_event_non_empty_request_with_auto_populated_field(): client.get_space_event(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == space_event.GetSpaceEventRequest( + request_msg = space_event.GetSpaceEventRequest( name="name_value", ) + assert args[0] == request_msg def test_get_space_event_use_cached_wrapped_rpc(): @@ -12641,9 +12695,14 @@ async def test_get_space_event_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_space_event_async( - transport: str = "grpc_asyncio", request_type=space_event.GetSpaceEventRequest -): +@pytest.mark.parametrize( + "request_type", + [ + space_event.GetSpaceEventRequest(), + {}, + ], +) +async def test_get_space_event_async(request_type, transport: str = "grpc_asyncio"): client = ChatServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12651,7 +12710,7 @@ async def test_get_space_event_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_space_event), "__call__") as call: @@ -12676,11 +12735,6 @@ async def test_get_space_event_async( assert response.event_type == "event_type_value" -@pytest.mark.asyncio -async def test_get_space_event_async_from_dict(): - await test_get_space_event_async(request_type=dict) - - def test_get_space_event_field_headers(): client = ChatServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12827,8 +12881,8 @@ async def test_get_space_event_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - space_event.ListSpaceEventsRequest, - dict, + space_event.ListSpaceEventsRequest(), + {}, ], ) def test_list_space_events(request_type, transport: str = "grpc"): @@ -12839,7 +12893,7 @@ def test_list_space_events(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -12889,11 +12943,12 @@ def test_list_space_events_non_empty_request_with_auto_populated_field(): client.list_space_events(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == space_event.ListSpaceEventsRequest( + request_msg = space_event.ListSpaceEventsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_space_events_use_cached_wrapped_rpc(): @@ -12976,9 +13031,14 @@ async def test_list_space_events_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_space_events_async( - transport: str = "grpc_asyncio", request_type=space_event.ListSpaceEventsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + space_event.ListSpaceEventsRequest(), + {}, + ], +) +async def test_list_space_events_async(request_type, transport: str = "grpc_asyncio"): client = ChatServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12986,7 +13046,7 @@ async def test_list_space_events_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( @@ -13011,11 +13071,6 @@ async def test_list_space_events_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_space_events_async_from_dict(): - await test_list_space_events_async(request_type=dict) - - def test_list_space_events_field_headers(): client = ChatServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13378,8 +13433,8 @@ async def test_list_space_events_async_pages(): @pytest.mark.parametrize( "request_type", [ - space_notification_setting.GetSpaceNotificationSettingRequest, - dict, + space_notification_setting.GetSpaceNotificationSettingRequest(), + {}, ], ) def test_get_space_notification_setting(request_type, transport: str = "grpc"): @@ -13390,7 +13445,7 @@ def test_get_space_notification_setting(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -13448,9 +13503,10 @@ def test_get_space_notification_setting_non_empty_request_with_auto_populated_fi client.get_space_notification_setting(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == space_notification_setting.GetSpaceNotificationSettingRequest( + request_msg = space_notification_setting.GetSpaceNotificationSettingRequest( name="name_value", ) + assert args[0] == request_msg def test_get_space_notification_setting_use_cached_wrapped_rpc(): @@ -13536,9 +13592,15 @@ async def test_get_space_notification_setting_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + space_notification_setting.GetSpaceNotificationSettingRequest(), + {}, + ], +) async def test_get_space_notification_setting_async( - transport: str = "grpc_asyncio", - request_type=space_notification_setting.GetSpaceNotificationSettingRequest, + request_type, transport: str = "grpc_asyncio" ): client = ChatServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -13547,7 +13609,7 @@ async def test_get_space_notification_setting_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( @@ -13582,11 +13644,6 @@ async def test_get_space_notification_setting_async( ) -@pytest.mark.asyncio -async def test_get_space_notification_setting_async_from_dict(): - await test_get_space_notification_setting_async(request_type=dict) - - def test_get_space_notification_setting_field_headers(): client = ChatServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13741,8 +13798,8 @@ async def test_get_space_notification_setting_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gc_space_notification_setting.UpdateSpaceNotificationSettingRequest, - dict, + gc_space_notification_setting.UpdateSpaceNotificationSettingRequest(), + {}, ], ) def test_update_space_notification_setting(request_type, transport: str = "grpc"): @@ -13753,7 +13810,7 @@ def test_update_space_notification_setting(request_type, transport: str = "grpc" # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -13809,10 +13866,10 @@ def test_update_space_notification_setting_non_empty_request_with_auto_populated client.update_space_notification_setting(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert ( - args[0] - == gc_space_notification_setting.UpdateSpaceNotificationSettingRequest() + request_msg = ( + gc_space_notification_setting.UpdateSpaceNotificationSettingRequest() ) + assert args[0] == request_msg def test_update_space_notification_setting_use_cached_wrapped_rpc(): @@ -13898,9 +13955,15 @@ async def test_update_space_notification_setting_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gc_space_notification_setting.UpdateSpaceNotificationSettingRequest(), + {}, + ], +) async def test_update_space_notification_setting_async( - transport: str = "grpc_asyncio", - request_type=gc_space_notification_setting.UpdateSpaceNotificationSettingRequest, + request_type, transport: str = "grpc_asyncio" ): client = ChatServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -13909,7 +13972,7 @@ async def test_update_space_notification_setting_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( @@ -13944,11 +14007,6 @@ async def test_update_space_notification_setting_async( ) -@pytest.mark.asyncio -async def test_update_space_notification_setting_async_from_dict(): - await test_update_space_notification_setting_async(request_type=dict) - - def test_update_space_notification_setting_field_headers(): client = ChatServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14125,8 +14183,8 @@ async def test_update_space_notification_setting_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gc_section.CreateSectionRequest, - dict, + gc_section.CreateSectionRequest(), + {}, ], ) def test_create_section(request_type, transport: str = "grpc"): @@ -14137,7 +14195,7 @@ def test_create_section(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_section), "__call__") as call: @@ -14187,9 +14245,10 @@ def test_create_section_non_empty_request_with_auto_populated_field(): client.create_section(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gc_section.CreateSectionRequest( + request_msg = gc_section.CreateSectionRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_section_use_cached_wrapped_rpc(): @@ -14270,9 +14329,14 @@ async def test_create_section_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_section_async( - transport: str = "grpc_asyncio", request_type=gc_section.CreateSectionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gc_section.CreateSectionRequest(), + {}, + ], +) +async def test_create_section_async(request_type, transport: str = "grpc_asyncio"): client = ChatServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14280,7 +14344,7 @@ async def test_create_section_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_section), "__call__") as call: @@ -14309,11 +14373,6 @@ async def test_create_section_async( assert response.type_ == gc_section.Section.SectionType.CUSTOM_SECTION -@pytest.mark.asyncio -async def test_create_section_async_from_dict(): - await test_create_section_async(request_type=dict) - - def test_create_section_field_headers(): client = ChatServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14466,8 +14525,8 @@ async def test_create_section_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - section.DeleteSectionRequest, - dict, + section.DeleteSectionRequest(), + {}, ], ) def test_delete_section(request_type, transport: str = "grpc"): @@ -14478,7 +14537,7 @@ def test_delete_section(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_section), "__call__") as call: @@ -14519,9 +14578,10 @@ def test_delete_section_non_empty_request_with_auto_populated_field(): client.delete_section(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == section.DeleteSectionRequest( + request_msg = section.DeleteSectionRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_section_use_cached_wrapped_rpc(): @@ -14602,9 +14662,14 @@ async def test_delete_section_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_section_async( - transport: str = "grpc_asyncio", request_type=section.DeleteSectionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + section.DeleteSectionRequest(), + {}, + ], +) +async def test_delete_section_async(request_type, transport: str = "grpc_asyncio"): client = ChatServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14612,7 +14677,7 @@ async def test_delete_section_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_section), "__call__") as call: @@ -14630,11 +14695,6 @@ async def test_delete_section_async( assert response is None -@pytest.mark.asyncio -async def test_delete_section_async_from_dict(): - await test_delete_section_async(request_type=dict) - - def test_delete_section_field_headers(): client = ChatServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14777,8 +14837,8 @@ async def test_delete_section_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gc_section.UpdateSectionRequest, - dict, + gc_section.UpdateSectionRequest(), + {}, ], ) def test_update_section(request_type, transport: str = "grpc"): @@ -14789,7 +14849,7 @@ def test_update_section(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_section), "__call__") as call: @@ -14837,7 +14897,8 @@ def test_update_section_non_empty_request_with_auto_populated_field(): client.update_section(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gc_section.UpdateSectionRequest() + request_msg = gc_section.UpdateSectionRequest() + assert args[0] == request_msg def test_update_section_use_cached_wrapped_rpc(): @@ -14918,9 +14979,14 @@ async def test_update_section_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_section_async( - transport: str = "grpc_asyncio", request_type=gc_section.UpdateSectionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gc_section.UpdateSectionRequest(), + {}, + ], +) +async def test_update_section_async(request_type, transport: str = "grpc_asyncio"): client = ChatServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14928,7 +14994,7 @@ async def test_update_section_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_section), "__call__") as call: @@ -14957,11 +15023,6 @@ async def test_update_section_async( assert response.type_ == gc_section.Section.SectionType.CUSTOM_SECTION -@pytest.mark.asyncio -async def test_update_section_async_from_dict(): - await test_update_section_async(request_type=dict) - - def test_update_section_field_headers(): client = ChatServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15114,8 +15175,8 @@ async def test_update_section_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - section.ListSectionsRequest, - dict, + section.ListSectionsRequest(), + {}, ], ) def test_list_sections(request_type, transport: str = "grpc"): @@ -15126,7 +15187,7 @@ def test_list_sections(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_sections), "__call__") as call: @@ -15171,10 +15232,11 @@ def test_list_sections_non_empty_request_with_auto_populated_field(): client.list_sections(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == section.ListSectionsRequest( + request_msg = section.ListSectionsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_sections_use_cached_wrapped_rpc(): @@ -15255,9 +15317,14 @@ async def test_list_sections_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_sections_async( - transport: str = "grpc_asyncio", request_type=section.ListSectionsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + section.ListSectionsRequest(), + {}, + ], +) +async def test_list_sections_async(request_type, transport: str = "grpc_asyncio"): client = ChatServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -15265,7 +15332,7 @@ async def test_list_sections_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_sections), "__call__") as call: @@ -15288,11 +15355,6 @@ async def test_list_sections_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_sections_async_from_dict(): - await test_list_sections_async(request_type=dict) - - def test_list_sections_field_headers(): client = ChatServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15629,8 +15691,8 @@ async def test_list_sections_async_pages(): @pytest.mark.parametrize( "request_type", [ - section.PositionSectionRequest, - dict, + section.PositionSectionRequest(), + {}, ], ) def test_position_section(request_type, transport: str = "grpc"): @@ -15641,7 +15703,7 @@ def test_position_section(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.position_section), "__call__") as call: @@ -15682,9 +15744,10 @@ def test_position_section_non_empty_request_with_auto_populated_field(): client.position_section(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == section.PositionSectionRequest( + request_msg = section.PositionSectionRequest( name="name_value", ) + assert args[0] == request_msg def test_position_section_use_cached_wrapped_rpc(): @@ -15767,9 +15830,14 @@ async def test_position_section_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_position_section_async( - transport: str = "grpc_asyncio", request_type=section.PositionSectionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + section.PositionSectionRequest(), + {}, + ], +) +async def test_position_section_async(request_type, transport: str = "grpc_asyncio"): client = ChatServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -15777,7 +15845,7 @@ async def test_position_section_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.position_section), "__call__") as call: @@ -15797,11 +15865,6 @@ async def test_position_section_async( assert isinstance(response, section.PositionSectionResponse) -@pytest.mark.asyncio -async def test_position_section_async_from_dict(): - await test_position_section_async(request_type=dict) - - def test_position_section_field_headers(): client = ChatServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15866,8 +15929,8 @@ async def test_position_section_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - section.ListSectionItemsRequest, - dict, + section.ListSectionItemsRequest(), + {}, ], ) def test_list_section_items(request_type, transport: str = "grpc"): @@ -15878,7 +15941,7 @@ def test_list_section_items(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -15928,11 +15991,12 @@ def test_list_section_items_non_empty_request_with_auto_populated_field(): client.list_section_items(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == section.ListSectionItemsRequest( + request_msg = section.ListSectionItemsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_section_items_use_cached_wrapped_rpc(): @@ -16017,9 +16081,14 @@ async def test_list_section_items_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_section_items_async( - transport: str = "grpc_asyncio", request_type=section.ListSectionItemsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + section.ListSectionItemsRequest(), + {}, + ], +) +async def test_list_section_items_async(request_type, transport: str = "grpc_asyncio"): client = ChatServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -16027,7 +16096,7 @@ async def test_list_section_items_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( @@ -16052,11 +16121,6 @@ async def test_list_section_items_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_section_items_async_from_dict(): - await test_list_section_items_async(request_type=dict) - - def test_list_section_items_field_headers(): client = ChatServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16409,8 +16473,8 @@ async def test_list_section_items_async_pages(): @pytest.mark.parametrize( "request_type", [ - section.MoveSectionItemRequest, - dict, + section.MoveSectionItemRequest(), + {}, ], ) def test_move_section_item(request_type, transport: str = "grpc"): @@ -16421,7 +16485,7 @@ def test_move_section_item(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -16467,10 +16531,11 @@ def test_move_section_item_non_empty_request_with_auto_populated_field(): client.move_section_item(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == section.MoveSectionItemRequest( + request_msg = section.MoveSectionItemRequest( name="name_value", target_section="target_section_value", ) + assert args[0] == request_msg def test_move_section_item_use_cached_wrapped_rpc(): @@ -16553,9 +16618,14 @@ async def test_move_section_item_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_move_section_item_async( - transport: str = "grpc_asyncio", request_type=section.MoveSectionItemRequest -): +@pytest.mark.parametrize( + "request_type", + [ + section.MoveSectionItemRequest(), + {}, + ], +) +async def test_move_section_item_async(request_type, transport: str = "grpc_asyncio"): client = ChatServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -16563,7 +16633,7 @@ async def test_move_section_item_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( @@ -16585,11 +16655,6 @@ async def test_move_section_item_async( assert isinstance(response, section.MoveSectionItemResponse) -@pytest.mark.asyncio -async def test_move_section_item_async_from_dict(): - await test_move_section_item_async(request_type=dict) - - def test_move_section_item_field_headers(): client = ChatServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -24708,7 +24773,6 @@ def test_create_message_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gc_message.CreateMessageRequest() - assert args[0] == request_msg @@ -24729,7 +24793,6 @@ def test_list_messages_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = message.ListMessagesRequest() - assert args[0] == request_msg @@ -24750,7 +24813,6 @@ def test_list_memberships_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = membership.ListMembershipsRequest() - assert args[0] == request_msg @@ -24771,7 +24833,6 @@ def test_get_membership_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = membership.GetMembershipRequest() - assert args[0] == request_msg @@ -24792,7 +24853,6 @@ def test_get_message_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = message.GetMessageRequest() - assert args[0] == request_msg @@ -24813,7 +24873,6 @@ def test_update_message_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gc_message.UpdateMessageRequest() - assert args[0] == request_msg @@ -24834,7 +24893,6 @@ def test_delete_message_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = message.DeleteMessageRequest() - assert args[0] == request_msg @@ -24855,7 +24913,6 @@ def test_get_attachment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = attachment.GetAttachmentRequest() - assert args[0] == request_msg @@ -24878,7 +24935,6 @@ def test_upload_attachment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = attachment.UploadAttachmentRequest() - assert args[0] == request_msg @@ -24899,7 +24955,6 @@ def test_list_spaces_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = space.ListSpacesRequest() - assert args[0] == request_msg @@ -24920,7 +24975,6 @@ def test_search_spaces_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = space.SearchSpacesRequest() - assert args[0] == request_msg @@ -24941,7 +24995,6 @@ def test_get_space_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = space.GetSpaceRequest() - assert args[0] == request_msg @@ -24962,7 +25015,6 @@ def test_create_space_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gc_space.CreateSpaceRequest() - assert args[0] == request_msg @@ -24983,7 +25035,6 @@ def test_set_up_space_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = space_setup.SetUpSpaceRequest() - assert args[0] == request_msg @@ -25004,7 +25055,6 @@ def test_update_space_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gc_space.UpdateSpaceRequest() - assert args[0] == request_msg @@ -25025,7 +25075,6 @@ def test_delete_space_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = space.DeleteSpaceRequest() - assert args[0] == request_msg @@ -25048,7 +25097,6 @@ def test_complete_import_space_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = space.CompleteImportSpaceRequest() - assert args[0] == request_msg @@ -25071,7 +25119,6 @@ def test_find_direct_message_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = space.FindDirectMessageRequest() - assert args[0] == request_msg @@ -25092,7 +25139,6 @@ def test_find_group_chats_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = space.FindGroupChatsRequest() - assert args[0] == request_msg @@ -25115,7 +25161,6 @@ def test_create_membership_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gc_membership.CreateMembershipRequest() - assert args[0] == request_msg @@ -25138,7 +25183,6 @@ def test_update_membership_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gc_membership.UpdateMembershipRequest() - assert args[0] == request_msg @@ -25161,7 +25205,6 @@ def test_delete_membership_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = membership.DeleteMembershipRequest() - assert args[0] == request_msg @@ -25182,7 +25225,6 @@ def test_create_reaction_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gc_reaction.CreateReactionRequest() - assert args[0] == request_msg @@ -25203,7 +25245,6 @@ def test_list_reactions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reaction.ListReactionsRequest() - assert args[0] == request_msg @@ -25224,7 +25265,6 @@ def test_delete_reaction_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reaction.DeleteReactionRequest() - assert args[0] == request_msg @@ -25247,7 +25287,6 @@ def test_create_custom_emoji_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reaction.CreateCustomEmojiRequest() - assert args[0] == request_msg @@ -25268,7 +25307,6 @@ def test_get_custom_emoji_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reaction.GetCustomEmojiRequest() - assert args[0] == request_msg @@ -25291,7 +25329,6 @@ def test_list_custom_emojis_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reaction.ListCustomEmojisRequest() - assert args[0] == request_msg @@ -25314,7 +25351,6 @@ def test_delete_custom_emoji_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reaction.DeleteCustomEmojiRequest() - assert args[0] == request_msg @@ -25337,7 +25373,6 @@ def test_get_space_read_state_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = space_read_state.GetSpaceReadStateRequest() - assert args[0] == request_msg @@ -25360,7 +25395,6 @@ def test_update_space_read_state_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gc_space_read_state.UpdateSpaceReadStateRequest() - assert args[0] == request_msg @@ -25383,7 +25417,6 @@ def test_get_thread_read_state_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = thread_read_state.GetThreadReadStateRequest() - assert args[0] == request_msg @@ -25404,7 +25437,6 @@ def test_get_space_event_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = space_event.GetSpaceEventRequest() - assert args[0] == request_msg @@ -25427,7 +25459,6 @@ def test_list_space_events_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = space_event.ListSpaceEventsRequest() - assert args[0] == request_msg @@ -25450,7 +25481,6 @@ def test_get_space_notification_setting_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = space_notification_setting.GetSpaceNotificationSettingRequest() - assert args[0] == request_msg @@ -25475,7 +25505,6 @@ def test_update_space_notification_setting_empty_call_grpc(): request_msg = ( gc_space_notification_setting.UpdateSpaceNotificationSettingRequest() ) - assert args[0] == request_msg @@ -25496,7 +25525,6 @@ def test_create_section_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gc_section.CreateSectionRequest() - assert args[0] == request_msg @@ -25517,7 +25545,6 @@ def test_delete_section_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = section.DeleteSectionRequest() - assert args[0] == request_msg @@ -25538,7 +25565,6 @@ def test_update_section_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gc_section.UpdateSectionRequest() - assert args[0] == request_msg @@ -25559,7 +25585,6 @@ def test_list_sections_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = section.ListSectionsRequest() - assert args[0] == request_msg @@ -25580,7 +25605,6 @@ def test_position_section_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = section.PositionSectionRequest() - assert args[0] == request_msg @@ -25603,7 +25627,6 @@ def test_list_section_items_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = section.ListSectionItemsRequest() - assert args[0] == request_msg @@ -25626,7 +25649,6 @@ def test_move_section_item_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = section.MoveSectionItemRequest() - assert args[0] == request_msg @@ -25674,7 +25696,6 @@ async def test_create_message_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gc_message.CreateMessageRequest() - assert args[0] == request_msg @@ -25701,7 +25722,6 @@ async def test_list_messages_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = message.ListMessagesRequest() - assert args[0] == request_msg @@ -25728,7 +25748,6 @@ async def test_list_memberships_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = membership.ListMembershipsRequest() - assert args[0] == request_msg @@ -25757,7 +25776,6 @@ async def test_get_membership_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = membership.GetMembershipRequest() - assert args[0] == request_msg @@ -25791,7 +25809,6 @@ async def test_get_message_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = message.GetMessageRequest() - assert args[0] == request_msg @@ -25825,7 +25842,6 @@ async def test_update_message_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gc_message.UpdateMessageRequest() - assert args[0] == request_msg @@ -25848,7 +25864,6 @@ async def test_delete_message_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = message.DeleteMessageRequest() - assert args[0] == request_msg @@ -25880,7 +25895,6 @@ async def test_get_attachment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = attachment.GetAttachmentRequest() - assert args[0] == request_msg @@ -25907,7 +25921,6 @@ async def test_upload_attachment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = attachment.UploadAttachmentRequest() - assert args[0] == request_msg @@ -25934,7 +25947,6 @@ async def test_list_spaces_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = space.ListSpacesRequest() - assert args[0] == request_msg @@ -25962,7 +25974,6 @@ async def test_search_spaces_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = space.SearchSpacesRequest() - assert args[0] == request_msg @@ -26001,7 +26012,6 @@ async def test_get_space_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = space.GetSpaceRequest() - assert args[0] == request_msg @@ -26040,7 +26050,6 @@ async def test_create_space_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gc_space.CreateSpaceRequest() - assert args[0] == request_msg @@ -26079,7 +26088,6 @@ async def test_set_up_space_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = space_setup.SetUpSpaceRequest() - assert args[0] == request_msg @@ -26118,7 +26126,6 @@ async def test_update_space_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gc_space.UpdateSpaceRequest() - assert args[0] == request_msg @@ -26141,7 +26148,6 @@ async def test_delete_space_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = space.DeleteSpaceRequest() - assert args[0] == request_msg @@ -26168,7 +26174,6 @@ async def test_complete_import_space_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = space.CompleteImportSpaceRequest() - assert args[0] == request_msg @@ -26209,7 +26214,6 @@ async def test_find_direct_message_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = space.FindDirectMessageRequest() - assert args[0] == request_msg @@ -26236,7 +26240,6 @@ async def test_find_group_chats_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = space.FindGroupChatsRequest() - assert args[0] == request_msg @@ -26267,7 +26270,6 @@ async def test_create_membership_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gc_membership.CreateMembershipRequest() - assert args[0] == request_msg @@ -26298,7 +26300,6 @@ async def test_update_membership_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gc_membership.UpdateMembershipRequest() - assert args[0] == request_msg @@ -26329,7 +26330,6 @@ async def test_delete_membership_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = membership.DeleteMembershipRequest() - assert args[0] == request_msg @@ -26356,7 +26356,6 @@ async def test_create_reaction_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gc_reaction.CreateReactionRequest() - assert args[0] == request_msg @@ -26383,7 +26382,6 @@ async def test_list_reactions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reaction.ListReactionsRequest() - assert args[0] == request_msg @@ -26406,7 +26404,6 @@ async def test_delete_reaction_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reaction.DeleteReactionRequest() - assert args[0] == request_msg @@ -26438,7 +26435,6 @@ async def test_create_custom_emoji_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reaction.CreateCustomEmojiRequest() - assert args[0] == request_msg @@ -26468,7 +26464,6 @@ async def test_get_custom_emoji_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reaction.GetCustomEmojiRequest() - assert args[0] == request_msg @@ -26497,7 +26492,6 @@ async def test_list_custom_emojis_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reaction.ListCustomEmojisRequest() - assert args[0] == request_msg @@ -26522,7 +26516,6 @@ async def test_delete_custom_emoji_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reaction.DeleteCustomEmojiRequest() - assert args[0] == request_msg @@ -26551,7 +26544,6 @@ async def test_get_space_read_state_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = space_read_state.GetSpaceReadStateRequest() - assert args[0] == request_msg @@ -26580,7 +26572,6 @@ async def test_update_space_read_state_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gc_space_read_state.UpdateSpaceReadStateRequest() - assert args[0] == request_msg @@ -26609,7 +26600,6 @@ async def test_get_thread_read_state_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = thread_read_state.GetThreadReadStateRequest() - assert args[0] == request_msg @@ -26637,7 +26627,6 @@ async def test_get_space_event_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = space_event.GetSpaceEventRequest() - assert args[0] == request_msg @@ -26666,7 +26655,6 @@ async def test_list_space_events_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = space_event.ListSpaceEventsRequest() - assert args[0] == request_msg @@ -26697,7 +26685,6 @@ async def test_get_space_notification_setting_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = space_notification_setting.GetSpaceNotificationSettingRequest() - assert args[0] == request_msg @@ -26730,7 +26717,6 @@ async def test_update_space_notification_setting_empty_call_grpc_asyncio(): request_msg = ( gc_space_notification_setting.UpdateSpaceNotificationSettingRequest() ) - assert args[0] == request_msg @@ -26760,7 +26746,6 @@ async def test_create_section_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gc_section.CreateSectionRequest() - assert args[0] == request_msg @@ -26783,7 +26768,6 @@ async def test_delete_section_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = section.DeleteSectionRequest() - assert args[0] == request_msg @@ -26813,7 +26797,6 @@ async def test_update_section_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gc_section.UpdateSectionRequest() - assert args[0] == request_msg @@ -26840,7 +26823,6 @@ async def test_list_sections_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = section.ListSectionsRequest() - assert args[0] == request_msg @@ -26865,7 +26847,6 @@ async def test_position_section_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = section.PositionSectionRequest() - assert args[0] == request_msg @@ -26894,7 +26875,6 @@ async def test_list_section_items_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = section.ListSectionItemsRequest() - assert args[0] == request_msg @@ -26921,7 +26901,6 @@ async def test_move_section_item_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = section.MoveSectionItemRequest() - assert args[0] == request_msg @@ -34634,7 +34613,6 @@ def test_create_message_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gc_message.CreateMessageRequest() - assert args[0] == request_msg @@ -34654,7 +34632,6 @@ def test_list_messages_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = message.ListMessagesRequest() - assert args[0] == request_msg @@ -34674,7 +34651,6 @@ def test_list_memberships_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = membership.ListMembershipsRequest() - assert args[0] == request_msg @@ -34694,7 +34670,6 @@ def test_get_membership_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = membership.GetMembershipRequest() - assert args[0] == request_msg @@ -34714,7 +34689,6 @@ def test_get_message_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = message.GetMessageRequest() - assert args[0] == request_msg @@ -34734,7 +34708,6 @@ def test_update_message_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gc_message.UpdateMessageRequest() - assert args[0] == request_msg @@ -34754,7 +34727,6 @@ def test_delete_message_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = message.DeleteMessageRequest() - assert args[0] == request_msg @@ -34774,7 +34746,6 @@ def test_get_attachment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = attachment.GetAttachmentRequest() - assert args[0] == request_msg @@ -34796,7 +34767,6 @@ def test_upload_attachment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = attachment.UploadAttachmentRequest() - assert args[0] == request_msg @@ -34816,7 +34786,6 @@ def test_list_spaces_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = space.ListSpacesRequest() - assert args[0] == request_msg @@ -34836,7 +34805,6 @@ def test_search_spaces_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = space.SearchSpacesRequest() - assert args[0] == request_msg @@ -34856,7 +34824,6 @@ def test_get_space_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = space.GetSpaceRequest() - assert args[0] == request_msg @@ -34876,7 +34843,6 @@ def test_create_space_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gc_space.CreateSpaceRequest() - assert args[0] == request_msg @@ -34896,7 +34862,6 @@ def test_set_up_space_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = space_setup.SetUpSpaceRequest() - assert args[0] == request_msg @@ -34916,7 +34881,6 @@ def test_update_space_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gc_space.UpdateSpaceRequest() - assert args[0] == request_msg @@ -34936,7 +34900,6 @@ def test_delete_space_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = space.DeleteSpaceRequest() - assert args[0] == request_msg @@ -34958,7 +34921,6 @@ def test_complete_import_space_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = space.CompleteImportSpaceRequest() - assert args[0] == request_msg @@ -34980,7 +34942,6 @@ def test_find_direct_message_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = space.FindDirectMessageRequest() - assert args[0] == request_msg @@ -35000,7 +34961,6 @@ def test_find_group_chats_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = space.FindGroupChatsRequest() - assert args[0] == request_msg @@ -35022,7 +34982,6 @@ def test_create_membership_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gc_membership.CreateMembershipRequest() - assert args[0] == request_msg @@ -35044,7 +35003,6 @@ def test_update_membership_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gc_membership.UpdateMembershipRequest() - assert args[0] == request_msg @@ -35066,7 +35024,6 @@ def test_delete_membership_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = membership.DeleteMembershipRequest() - assert args[0] == request_msg @@ -35086,7 +35043,6 @@ def test_create_reaction_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gc_reaction.CreateReactionRequest() - assert args[0] == request_msg @@ -35106,7 +35062,6 @@ def test_list_reactions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reaction.ListReactionsRequest() - assert args[0] == request_msg @@ -35126,7 +35081,6 @@ def test_delete_reaction_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reaction.DeleteReactionRequest() - assert args[0] == request_msg @@ -35148,7 +35102,6 @@ def test_create_custom_emoji_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reaction.CreateCustomEmojiRequest() - assert args[0] == request_msg @@ -35168,7 +35121,6 @@ def test_get_custom_emoji_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reaction.GetCustomEmojiRequest() - assert args[0] == request_msg @@ -35190,7 +35142,6 @@ def test_list_custom_emojis_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reaction.ListCustomEmojisRequest() - assert args[0] == request_msg @@ -35212,7 +35163,6 @@ def test_delete_custom_emoji_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reaction.DeleteCustomEmojiRequest() - assert args[0] == request_msg @@ -35234,7 +35184,6 @@ def test_get_space_read_state_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = space_read_state.GetSpaceReadStateRequest() - assert args[0] == request_msg @@ -35256,7 +35205,6 @@ def test_update_space_read_state_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gc_space_read_state.UpdateSpaceReadStateRequest() - assert args[0] == request_msg @@ -35278,7 +35226,6 @@ def test_get_thread_read_state_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = thread_read_state.GetThreadReadStateRequest() - assert args[0] == request_msg @@ -35298,7 +35245,6 @@ def test_get_space_event_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = space_event.GetSpaceEventRequest() - assert args[0] == request_msg @@ -35320,7 +35266,6 @@ def test_list_space_events_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = space_event.ListSpaceEventsRequest() - assert args[0] == request_msg @@ -35342,7 +35287,6 @@ def test_get_space_notification_setting_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = space_notification_setting.GetSpaceNotificationSettingRequest() - assert args[0] == request_msg @@ -35366,7 +35310,6 @@ def test_update_space_notification_setting_empty_call_rest(): request_msg = ( gc_space_notification_setting.UpdateSpaceNotificationSettingRequest() ) - assert args[0] == request_msg @@ -35386,7 +35329,6 @@ def test_create_section_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gc_section.CreateSectionRequest() - assert args[0] == request_msg @@ -35406,7 +35348,6 @@ def test_delete_section_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = section.DeleteSectionRequest() - assert args[0] == request_msg @@ -35426,7 +35367,6 @@ def test_update_section_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gc_section.UpdateSectionRequest() - assert args[0] == request_msg @@ -35446,7 +35386,6 @@ def test_list_sections_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = section.ListSectionsRequest() - assert args[0] == request_msg @@ -35466,7 +35405,6 @@ def test_position_section_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = section.PositionSectionRequest() - assert args[0] == request_msg @@ -35488,7 +35426,6 @@ def test_list_section_items_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = section.ListSectionItemsRequest() - assert args[0] == request_msg @@ -35510,7 +35447,6 @@ def test_move_section_item_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = section.MoveSectionItemRequest() - assert args[0] == request_msg diff --git a/packages/google-apps-events-subscriptions/noxfile.py b/packages/google-apps-events-subscriptions/noxfile.py index bd4d892b2c84..13b14c1d293c 100644 --- a/packages/google-apps-events-subscriptions/noxfile.py +++ b/packages/google-apps-events-subscriptions/noxfile.py @@ -47,7 +47,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-apps-events-subscriptions" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-apps-events-subscriptions/setup.py b/packages/google-apps-events-subscriptions/setup.py index 778215870d14..639938a7908d 100644 --- a/packages/google-apps-events-subscriptions/setup.py +++ b/packages/google-apps-events-subscriptions/setup.py @@ -45,7 +45,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/google-apps-events-subscriptions/testing/constraints-3.10.txt b/packages/google-apps-events-subscriptions/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-apps-events-subscriptions/testing/constraints-3.10.txt +++ b/packages/google-apps-events-subscriptions/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-apps-events-subscriptions/tests/unit/gapic/events_subscriptions_v1/test_subscriptions_service.py b/packages/google-apps-events-subscriptions/tests/unit/gapic/events_subscriptions_v1/test_subscriptions_service.py index 160180f922b7..605bf17a9c00 100644 --- a/packages/google-apps-events-subscriptions/tests/unit/gapic/events_subscriptions_v1/test_subscriptions_service.py +++ b/packages/google-apps-events-subscriptions/tests/unit/gapic/events_subscriptions_v1/test_subscriptions_service.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 @@ -119,6 +120,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" @@ -1393,8 +1409,8 @@ def test_subscriptions_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - subscriptions_service.CreateSubscriptionRequest, - dict, + subscriptions_service.CreateSubscriptionRequest(), + {}, ], ) def test_create_subscription(request_type, transport: str = "grpc"): @@ -1405,7 +1421,7 @@ def test_create_subscription(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1448,7 +1464,8 @@ def test_create_subscription_non_empty_request_with_auto_populated_field(): client.create_subscription(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == subscriptions_service.CreateSubscriptionRequest() + request_msg = subscriptions_service.CreateSubscriptionRequest() + assert args[0] == request_msg def test_create_subscription_use_cached_wrapped_rpc(): @@ -1543,10 +1560,14 @@ async def test_create_subscription_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_subscription_async( - transport: str = "grpc_asyncio", - request_type=subscriptions_service.CreateSubscriptionRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + subscriptions_service.CreateSubscriptionRequest(), + {}, + ], +) +async def test_create_subscription_async(request_type, transport: str = "grpc_asyncio"): client = SubscriptionsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1554,7 +1575,7 @@ async def test_create_subscription_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( @@ -1576,11 +1597,6 @@ async def test_create_subscription_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_subscription_async_from_dict(): - await test_create_subscription_async(request_type=dict) - - def test_create_subscription_flattened(): client = SubscriptionsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1682,8 +1698,8 @@ async def test_create_subscription_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - subscriptions_service.DeleteSubscriptionRequest, - dict, + subscriptions_service.DeleteSubscriptionRequest(), + {}, ], ) def test_delete_subscription(request_type, transport: str = "grpc"): @@ -1694,7 +1710,7 @@ def test_delete_subscription(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1740,10 +1756,11 @@ def test_delete_subscription_non_empty_request_with_auto_populated_field(): client.delete_subscription(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == subscriptions_service.DeleteSubscriptionRequest( + request_msg = subscriptions_service.DeleteSubscriptionRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_subscription_use_cached_wrapped_rpc(): @@ -1838,10 +1855,14 @@ async def test_delete_subscription_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_subscription_async( - transport: str = "grpc_asyncio", - request_type=subscriptions_service.DeleteSubscriptionRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + subscriptions_service.DeleteSubscriptionRequest(), + {}, + ], +) +async def test_delete_subscription_async(request_type, transport: str = "grpc_asyncio"): client = SubscriptionsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1849,7 +1870,7 @@ async def test_delete_subscription_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( @@ -1871,11 +1892,6 @@ async def test_delete_subscription_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_subscription_async_from_dict(): - await test_delete_subscription_async(request_type=dict) - - def test_delete_subscription_field_headers(): client = SubscriptionsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2030,8 +2046,8 @@ async def test_delete_subscription_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - subscriptions_service.GetSubscriptionRequest, - dict, + subscriptions_service.GetSubscriptionRequest(), + {}, ], ) def test_get_subscription(request_type, transport: str = "grpc"): @@ -2042,7 +2058,7 @@ def test_get_subscription(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_subscription), "__call__") as call: @@ -2105,9 +2121,10 @@ def test_get_subscription_non_empty_request_with_auto_populated_field(): client.get_subscription(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == subscriptions_service.GetSubscriptionRequest( + request_msg = subscriptions_service.GetSubscriptionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_subscription_use_cached_wrapped_rpc(): @@ -2190,10 +2207,14 @@ async def test_get_subscription_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_subscription_async( - transport: str = "grpc_asyncio", - request_type=subscriptions_service.GetSubscriptionRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + subscriptions_service.GetSubscriptionRequest(), + {}, + ], +) +async def test_get_subscription_async(request_type, transport: str = "grpc_asyncio"): client = SubscriptionsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2201,7 +2222,7 @@ async def test_get_subscription_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_subscription), "__call__") as call: @@ -2243,11 +2264,6 @@ async def test_get_subscription_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_subscription_async_from_dict(): - await test_get_subscription_async(request_type=dict) - - def test_get_subscription_field_headers(): client = SubscriptionsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2394,8 +2410,8 @@ async def test_get_subscription_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - subscriptions_service.ListSubscriptionsRequest, - dict, + subscriptions_service.ListSubscriptionsRequest(), + {}, ], ) def test_list_subscriptions(request_type, transport: str = "grpc"): @@ -2406,7 +2422,7 @@ def test_list_subscriptions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2455,10 +2471,11 @@ def test_list_subscriptions_non_empty_request_with_auto_populated_field(): client.list_subscriptions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == subscriptions_service.ListSubscriptionsRequest( + request_msg = subscriptions_service.ListSubscriptionsRequest( page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_subscriptions_use_cached_wrapped_rpc(): @@ -2543,10 +2560,14 @@ async def test_list_subscriptions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_subscriptions_async( - transport: str = "grpc_asyncio", - request_type=subscriptions_service.ListSubscriptionsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + subscriptions_service.ListSubscriptionsRequest(), + {}, + ], +) +async def test_list_subscriptions_async(request_type, transport: str = "grpc_asyncio"): client = SubscriptionsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2554,7 +2575,7 @@ async def test_list_subscriptions_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( @@ -2579,11 +2600,6 @@ async def test_list_subscriptions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_subscriptions_async_from_dict(): - await test_list_subscriptions_async(request_type=dict) - - def test_list_subscriptions_flattened(): client = SubscriptionsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2868,8 +2884,8 @@ async def test_list_subscriptions_async_pages(): @pytest.mark.parametrize( "request_type", [ - subscriptions_service.UpdateSubscriptionRequest, - dict, + subscriptions_service.UpdateSubscriptionRequest(), + {}, ], ) def test_update_subscription(request_type, transport: str = "grpc"): @@ -2880,7 +2896,7 @@ def test_update_subscription(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2923,7 +2939,8 @@ def test_update_subscription_non_empty_request_with_auto_populated_field(): client.update_subscription(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == subscriptions_service.UpdateSubscriptionRequest() + request_msg = subscriptions_service.UpdateSubscriptionRequest() + assert args[0] == request_msg def test_update_subscription_use_cached_wrapped_rpc(): @@ -3018,10 +3035,14 @@ async def test_update_subscription_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_subscription_async( - transport: str = "grpc_asyncio", - request_type=subscriptions_service.UpdateSubscriptionRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + subscriptions_service.UpdateSubscriptionRequest(), + {}, + ], +) +async def test_update_subscription_async(request_type, transport: str = "grpc_asyncio"): client = SubscriptionsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3029,7 +3050,7 @@ async def test_update_subscription_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,11 +3072,6 @@ async def test_update_subscription_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_subscription_async_from_dict(): - await test_update_subscription_async(request_type=dict) - - def test_update_subscription_field_headers(): client = SubscriptionsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3232,8 +3248,8 @@ async def test_update_subscription_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - subscriptions_service.ReactivateSubscriptionRequest, - dict, + subscriptions_service.ReactivateSubscriptionRequest(), + {}, ], ) def test_reactivate_subscription(request_type, transport: str = "grpc"): @@ -3244,7 +3260,7 @@ def test_reactivate_subscription(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3289,9 +3305,10 @@ def test_reactivate_subscription_non_empty_request_with_auto_populated_field(): client.reactivate_subscription(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == subscriptions_service.ReactivateSubscriptionRequest( + request_msg = subscriptions_service.ReactivateSubscriptionRequest( name="name_value", ) + assert args[0] == request_msg def test_reactivate_subscription_use_cached_wrapped_rpc(): @@ -3387,9 +3404,15 @@ async def test_reactivate_subscription_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + subscriptions_service.ReactivateSubscriptionRequest(), + {}, + ], +) async def test_reactivate_subscription_async( - transport: str = "grpc_asyncio", - request_type=subscriptions_service.ReactivateSubscriptionRequest, + request_type, transport: str = "grpc_asyncio" ): client = SubscriptionsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3398,7 +3421,7 @@ async def test_reactivate_subscription_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( @@ -3420,11 +3443,6 @@ async def test_reactivate_subscription_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_reactivate_subscription_async_from_dict(): - await test_reactivate_subscription_async(request_type=dict) - - def test_reactivate_subscription_field_headers(): client = SubscriptionsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4905,7 +4923,6 @@ def test_create_subscription_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = subscriptions_service.CreateSubscriptionRequest() - assert args[0] == request_msg @@ -4928,7 +4945,6 @@ def test_delete_subscription_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = subscriptions_service.DeleteSubscriptionRequest() - assert args[0] == request_msg @@ -4949,7 +4965,6 @@ def test_get_subscription_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = subscriptions_service.GetSubscriptionRequest() - assert args[0] == request_msg @@ -4972,7 +4987,6 @@ def test_list_subscriptions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = subscriptions_service.ListSubscriptionsRequest() - assert args[0] == request_msg @@ -4995,7 +5009,6 @@ def test_update_subscription_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = subscriptions_service.UpdateSubscriptionRequest() - assert args[0] == request_msg @@ -5018,7 +5031,6 @@ def test_reactivate_subscription_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = subscriptions_service.ReactivateSubscriptionRequest() - assert args[0] == request_msg @@ -5059,7 +5071,6 @@ async def test_create_subscription_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = subscriptions_service.CreateSubscriptionRequest() - assert args[0] == request_msg @@ -5086,7 +5097,6 @@ async def test_delete_subscription_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = subscriptions_service.DeleteSubscriptionRequest() - assert args[0] == request_msg @@ -5121,7 +5131,6 @@ async def test_get_subscription_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = subscriptions_service.GetSubscriptionRequest() - assert args[0] == request_msg @@ -5150,7 +5159,6 @@ async def test_list_subscriptions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = subscriptions_service.ListSubscriptionsRequest() - assert args[0] == request_msg @@ -5177,7 +5185,6 @@ async def test_update_subscription_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = subscriptions_service.UpdateSubscriptionRequest() - assert args[0] == request_msg @@ -5204,7 +5211,6 @@ async def test_reactivate_subscription_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = subscriptions_service.ReactivateSubscriptionRequest() - assert args[0] == request_msg @@ -6273,7 +6279,6 @@ def test_create_subscription_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = subscriptions_service.CreateSubscriptionRequest() - assert args[0] == request_msg @@ -6295,7 +6300,6 @@ def test_delete_subscription_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = subscriptions_service.DeleteSubscriptionRequest() - assert args[0] == request_msg @@ -6315,7 +6319,6 @@ def test_get_subscription_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = subscriptions_service.GetSubscriptionRequest() - assert args[0] == request_msg @@ -6337,7 +6340,6 @@ def test_list_subscriptions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = subscriptions_service.ListSubscriptionsRequest() - assert args[0] == request_msg @@ -6359,7 +6361,6 @@ def test_update_subscription_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = subscriptions_service.UpdateSubscriptionRequest() - assert args[0] == request_msg @@ -6381,7 +6382,6 @@ def test_reactivate_subscription_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = subscriptions_service.ReactivateSubscriptionRequest() - assert args[0] == request_msg diff --git a/packages/google-apps-events-subscriptions/tests/unit/gapic/events_subscriptions_v1beta/test_subscriptions_service.py b/packages/google-apps-events-subscriptions/tests/unit/gapic/events_subscriptions_v1beta/test_subscriptions_service.py index 5bae09f867fe..345cfccdded1 100644 --- a/packages/google-apps-events-subscriptions/tests/unit/gapic/events_subscriptions_v1beta/test_subscriptions_service.py +++ b/packages/google-apps-events-subscriptions/tests/unit/gapic/events_subscriptions_v1beta/test_subscriptions_service.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 @@ -119,6 +120,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" @@ -1398,8 +1414,8 @@ def test_subscriptions_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - subscriptions_service.CreateSubscriptionRequest, - dict, + subscriptions_service.CreateSubscriptionRequest(), + {}, ], ) def test_create_subscription(request_type, transport: str = "grpc"): @@ -1410,7 +1426,7 @@ def test_create_subscription(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1453,7 +1469,8 @@ def test_create_subscription_non_empty_request_with_auto_populated_field(): client.create_subscription(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == subscriptions_service.CreateSubscriptionRequest() + request_msg = subscriptions_service.CreateSubscriptionRequest() + assert args[0] == request_msg def test_create_subscription_use_cached_wrapped_rpc(): @@ -1548,10 +1565,14 @@ async def test_create_subscription_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_subscription_async( - transport: str = "grpc_asyncio", - request_type=subscriptions_service.CreateSubscriptionRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + subscriptions_service.CreateSubscriptionRequest(), + {}, + ], +) +async def test_create_subscription_async(request_type, transport: str = "grpc_asyncio"): client = SubscriptionsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1559,7 +1580,7 @@ async def test_create_subscription_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( @@ -1581,11 +1602,6 @@ async def test_create_subscription_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_subscription_async_from_dict(): - await test_create_subscription_async(request_type=dict) - - def test_create_subscription_flattened(): client = SubscriptionsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1699,8 +1715,8 @@ async def test_create_subscription_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - subscriptions_service.DeleteSubscriptionRequest, - dict, + subscriptions_service.DeleteSubscriptionRequest(), + {}, ], ) def test_delete_subscription(request_type, transport: str = "grpc"): @@ -1711,7 +1727,7 @@ def test_delete_subscription(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1757,10 +1773,11 @@ def test_delete_subscription_non_empty_request_with_auto_populated_field(): client.delete_subscription(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == subscriptions_service.DeleteSubscriptionRequest( + request_msg = subscriptions_service.DeleteSubscriptionRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_subscription_use_cached_wrapped_rpc(): @@ -1855,10 +1872,14 @@ async def test_delete_subscription_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_subscription_async( - transport: str = "grpc_asyncio", - request_type=subscriptions_service.DeleteSubscriptionRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + subscriptions_service.DeleteSubscriptionRequest(), + {}, + ], +) +async def test_delete_subscription_async(request_type, transport: str = "grpc_asyncio"): client = SubscriptionsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1866,7 +1887,7 @@ async def test_delete_subscription_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( @@ -1888,11 +1909,6 @@ async def test_delete_subscription_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_subscription_async_from_dict(): - await test_delete_subscription_async(request_type=dict) - - def test_delete_subscription_field_headers(): client = SubscriptionsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2047,8 +2063,8 @@ async def test_delete_subscription_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - subscriptions_service.GetSubscriptionRequest, - dict, + subscriptions_service.GetSubscriptionRequest(), + {}, ], ) def test_get_subscription(request_type, transport: str = "grpc"): @@ -2059,7 +2075,7 @@ def test_get_subscription(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_subscription), "__call__") as call: @@ -2122,9 +2138,10 @@ def test_get_subscription_non_empty_request_with_auto_populated_field(): client.get_subscription(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == subscriptions_service.GetSubscriptionRequest( + request_msg = subscriptions_service.GetSubscriptionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_subscription_use_cached_wrapped_rpc(): @@ -2207,10 +2224,14 @@ async def test_get_subscription_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_subscription_async( - transport: str = "grpc_asyncio", - request_type=subscriptions_service.GetSubscriptionRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + subscriptions_service.GetSubscriptionRequest(), + {}, + ], +) +async def test_get_subscription_async(request_type, transport: str = "grpc_asyncio"): client = SubscriptionsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2218,7 +2239,7 @@ async def test_get_subscription_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_subscription), "__call__") as call: @@ -2260,11 +2281,6 @@ async def test_get_subscription_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_subscription_async_from_dict(): - await test_get_subscription_async(request_type=dict) - - def test_get_subscription_field_headers(): client = SubscriptionsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2411,8 +2427,8 @@ async def test_get_subscription_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - subscriptions_service.ListSubscriptionsRequest, - dict, + subscriptions_service.ListSubscriptionsRequest(), + {}, ], ) def test_list_subscriptions(request_type, transport: str = "grpc"): @@ -2423,7 +2439,7 @@ def test_list_subscriptions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2472,10 +2488,11 @@ def test_list_subscriptions_non_empty_request_with_auto_populated_field(): client.list_subscriptions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == subscriptions_service.ListSubscriptionsRequest( + request_msg = subscriptions_service.ListSubscriptionsRequest( page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_subscriptions_use_cached_wrapped_rpc(): @@ -2560,10 +2577,14 @@ async def test_list_subscriptions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_subscriptions_async( - transport: str = "grpc_asyncio", - request_type=subscriptions_service.ListSubscriptionsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + subscriptions_service.ListSubscriptionsRequest(), + {}, + ], +) +async def test_list_subscriptions_async(request_type, transport: str = "grpc_asyncio"): client = SubscriptionsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2571,7 +2592,7 @@ async def test_list_subscriptions_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( @@ -2596,11 +2617,6 @@ async def test_list_subscriptions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_subscriptions_async_from_dict(): - await test_list_subscriptions_async(request_type=dict) - - def test_list_subscriptions_flattened(): client = SubscriptionsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2885,8 +2901,8 @@ async def test_list_subscriptions_async_pages(): @pytest.mark.parametrize( "request_type", [ - subscriptions_service.UpdateSubscriptionRequest, - dict, + subscriptions_service.UpdateSubscriptionRequest(), + {}, ], ) def test_update_subscription(request_type, transport: str = "grpc"): @@ -2897,7 +2913,7 @@ def test_update_subscription(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2940,7 +2956,8 @@ def test_update_subscription_non_empty_request_with_auto_populated_field(): client.update_subscription(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == subscriptions_service.UpdateSubscriptionRequest() + request_msg = subscriptions_service.UpdateSubscriptionRequest() + assert args[0] == request_msg def test_update_subscription_use_cached_wrapped_rpc(): @@ -3035,10 +3052,14 @@ async def test_update_subscription_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_subscription_async( - transport: str = "grpc_asyncio", - request_type=subscriptions_service.UpdateSubscriptionRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + subscriptions_service.UpdateSubscriptionRequest(), + {}, + ], +) +async def test_update_subscription_async(request_type, transport: str = "grpc_asyncio"): client = SubscriptionsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3046,7 +3067,7 @@ async def test_update_subscription_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( @@ -3068,11 +3089,6 @@ async def test_update_subscription_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_subscription_async_from_dict(): - await test_update_subscription_async(request_type=dict) - - def test_update_subscription_field_headers(): client = SubscriptionsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3261,8 +3277,8 @@ async def test_update_subscription_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - subscriptions_service.ReactivateSubscriptionRequest, - dict, + subscriptions_service.ReactivateSubscriptionRequest(), + {}, ], ) def test_reactivate_subscription(request_type, transport: str = "grpc"): @@ -3273,7 +3289,7 @@ def test_reactivate_subscription(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3318,9 +3334,10 @@ def test_reactivate_subscription_non_empty_request_with_auto_populated_field(): client.reactivate_subscription(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == subscriptions_service.ReactivateSubscriptionRequest( + request_msg = subscriptions_service.ReactivateSubscriptionRequest( name="name_value", ) + assert args[0] == request_msg def test_reactivate_subscription_use_cached_wrapped_rpc(): @@ -3416,9 +3433,15 @@ async def test_reactivate_subscription_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + subscriptions_service.ReactivateSubscriptionRequest(), + {}, + ], +) async def test_reactivate_subscription_async( - transport: str = "grpc_asyncio", - request_type=subscriptions_service.ReactivateSubscriptionRequest, + request_type, transport: str = "grpc_asyncio" ): client = SubscriptionsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3427,7 +3450,7 @@ async def test_reactivate_subscription_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( @@ -3449,11 +3472,6 @@ async def test_reactivate_subscription_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_reactivate_subscription_async_from_dict(): - await test_reactivate_subscription_async(request_type=dict) - - def test_reactivate_subscription_field_headers(): client = SubscriptionsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4943,7 +4961,6 @@ def test_create_subscription_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = subscriptions_service.CreateSubscriptionRequest() - assert args[0] == request_msg @@ -4966,7 +4983,6 @@ def test_delete_subscription_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = subscriptions_service.DeleteSubscriptionRequest() - assert args[0] == request_msg @@ -4987,7 +5003,6 @@ def test_get_subscription_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = subscriptions_service.GetSubscriptionRequest() - assert args[0] == request_msg @@ -5010,7 +5025,6 @@ def test_list_subscriptions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = subscriptions_service.ListSubscriptionsRequest() - assert args[0] == request_msg @@ -5033,7 +5047,6 @@ def test_update_subscription_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = subscriptions_service.UpdateSubscriptionRequest() - assert args[0] == request_msg @@ -5056,7 +5069,6 @@ def test_reactivate_subscription_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = subscriptions_service.ReactivateSubscriptionRequest() - assert args[0] == request_msg @@ -5097,7 +5109,6 @@ async def test_create_subscription_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = subscriptions_service.CreateSubscriptionRequest() - assert args[0] == request_msg @@ -5124,7 +5135,6 @@ async def test_delete_subscription_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = subscriptions_service.DeleteSubscriptionRequest() - assert args[0] == request_msg @@ -5159,7 +5169,6 @@ async def test_get_subscription_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = subscriptions_service.GetSubscriptionRequest() - assert args[0] == request_msg @@ -5188,7 +5197,6 @@ async def test_list_subscriptions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = subscriptions_service.ListSubscriptionsRequest() - assert args[0] == request_msg @@ -5215,7 +5223,6 @@ async def test_update_subscription_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = subscriptions_service.UpdateSubscriptionRequest() - assert args[0] == request_msg @@ -5242,7 +5249,6 @@ async def test_reactivate_subscription_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = subscriptions_service.ReactivateSubscriptionRequest() - assert args[0] == request_msg @@ -6313,7 +6319,6 @@ def test_create_subscription_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = subscriptions_service.CreateSubscriptionRequest() - assert args[0] == request_msg @@ -6335,7 +6340,6 @@ def test_delete_subscription_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = subscriptions_service.DeleteSubscriptionRequest() - assert args[0] == request_msg @@ -6355,7 +6359,6 @@ def test_get_subscription_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = subscriptions_service.GetSubscriptionRequest() - assert args[0] == request_msg @@ -6377,7 +6380,6 @@ def test_list_subscriptions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = subscriptions_service.ListSubscriptionsRequest() - assert args[0] == request_msg @@ -6399,7 +6401,6 @@ def test_update_subscription_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = subscriptions_service.UpdateSubscriptionRequest() - assert args[0] == request_msg @@ -6421,7 +6422,6 @@ def test_reactivate_subscription_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = subscriptions_service.ReactivateSubscriptionRequest() - assert args[0] == request_msg diff --git a/packages/google-apps-meet/noxfile.py b/packages/google-apps-meet/noxfile.py index b4b0c6bcc531..e10102a15d42 100644 --- a/packages/google-apps-meet/noxfile.py +++ b/packages/google-apps-meet/noxfile.py @@ -47,7 +47,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-apps-meet" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-apps-meet/setup.py b/packages/google-apps-meet/setup.py index 0f453e544ef2..e6790d3df309 100644 --- a/packages/google-apps-meet/setup.py +++ b/packages/google-apps-meet/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/google-apps-meet/testing/constraints-3.10.txt b/packages/google-apps-meet/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-apps-meet/testing/constraints-3.10.txt +++ b/packages/google-apps-meet/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-apps-meet/tests/unit/gapic/meet_v2/test_conference_records_service.py b/packages/google-apps-meet/tests/unit/gapic/meet_v2/test_conference_records_service.py index e6b55e0fcd83..52ad350ae952 100644 --- a/packages/google-apps-meet/tests/unit/gapic/meet_v2/test_conference_records_service.py +++ b/packages/google-apps-meet/tests/unit/gapic/meet_v2/test_conference_records_service.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 @@ -108,6 +109,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" @@ -1386,8 +1402,8 @@ def test_conference_records_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - service.GetConferenceRecordRequest, - dict, + service.GetConferenceRecordRequest(), + {}, ], ) def test_get_conference_record(request_type, transport: str = "grpc"): @@ -1398,7 +1414,7 @@ def test_get_conference_record(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1448,9 +1464,10 @@ def test_get_conference_record_non_empty_request_with_auto_populated_field(): client.get_conference_record(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetConferenceRecordRequest( + request_msg = service.GetConferenceRecordRequest( name="name_value", ) + assert args[0] == request_msg def test_get_conference_record_use_cached_wrapped_rpc(): @@ -1536,8 +1553,15 @@ async def test_get_conference_record_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.GetConferenceRecordRequest(), + {}, + ], +) async def test_get_conference_record_async( - transport: str = "grpc_asyncio", request_type=service.GetConferenceRecordRequest + request_type, transport: str = "grpc_asyncio" ): client = ConferenceRecordsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1546,7 +1570,7 @@ async def test_get_conference_record_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( @@ -1573,11 +1597,6 @@ async def test_get_conference_record_async( assert response.space == "space_value" -@pytest.mark.asyncio -async def test_get_conference_record_async_from_dict(): - await test_get_conference_record_async(request_type=dict) - - def test_get_conference_record_field_headers(): client = ConferenceRecordsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1732,8 +1751,8 @@ async def test_get_conference_record_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListConferenceRecordsRequest, - dict, + service.ListConferenceRecordsRequest(), + {}, ], ) def test_list_conference_records(request_type, transport: str = "grpc"): @@ -1744,7 +1763,7 @@ def test_list_conference_records(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1793,10 +1812,11 @@ def test_list_conference_records_non_empty_request_with_auto_populated_field(): client.list_conference_records(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListConferenceRecordsRequest( + request_msg = service.ListConferenceRecordsRequest( page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_conference_records_use_cached_wrapped_rpc(): @@ -1882,8 +1902,15 @@ async def test_list_conference_records_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.ListConferenceRecordsRequest(), + {}, + ], +) async def test_list_conference_records_async( - transport: str = "grpc_asyncio", request_type=service.ListConferenceRecordsRequest + request_type, transport: str = "grpc_asyncio" ): client = ConferenceRecordsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1892,7 +1919,7 @@ async def test_list_conference_records_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( @@ -1917,11 +1944,6 @@ async def test_list_conference_records_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_conference_records_async_from_dict(): - await test_list_conference_records_async(request_type=dict) - - def test_list_conference_records_pager(transport_name: str = "grpc"): client = ConferenceRecordsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2120,8 +2142,8 @@ async def test_list_conference_records_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetParticipantRequest, - dict, + service.GetParticipantRequest(), + {}, ], ) def test_get_participant(request_type, transport: str = "grpc"): @@ -2132,7 +2154,7 @@ def test_get_participant(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_participant), "__call__") as call: @@ -2176,9 +2198,10 @@ def test_get_participant_non_empty_request_with_auto_populated_field(): client.get_participant(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetParticipantRequest( + request_msg = service.GetParticipantRequest( name="name_value", ) + assert args[0] == request_msg def test_get_participant_use_cached_wrapped_rpc(): @@ -2259,9 +2282,14 @@ async def test_get_participant_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_participant_async( - transport: str = "grpc_asyncio", request_type=service.GetParticipantRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetParticipantRequest(), + {}, + ], +) +async def test_get_participant_async(request_type, transport: str = "grpc_asyncio"): client = ConferenceRecordsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2269,7 +2297,7 @@ async def test_get_participant_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_participant), "__call__") as call: @@ -2292,11 +2320,6 @@ async def test_get_participant_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_participant_async_from_dict(): - await test_get_participant_async(request_type=dict) - - def test_get_participant_field_headers(): client = ConferenceRecordsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2443,8 +2466,8 @@ async def test_get_participant_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListParticipantsRequest, - dict, + service.ListParticipantsRequest(), + {}, ], ) def test_list_participants(request_type, transport: str = "grpc"): @@ -2455,7 +2478,7 @@ def test_list_participants(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2507,11 +2530,12 @@ def test_list_participants_non_empty_request_with_auto_populated_field(): client.list_participants(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListParticipantsRequest( + request_msg = service.ListParticipantsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_participants_use_cached_wrapped_rpc(): @@ -2594,9 +2618,14 @@ async def test_list_participants_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_participants_async( - transport: str = "grpc_asyncio", request_type=service.ListParticipantsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListParticipantsRequest(), + {}, + ], +) +async def test_list_participants_async(request_type, transport: str = "grpc_asyncio"): client = ConferenceRecordsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2604,7 +2633,7 @@ async def test_list_participants_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( @@ -2631,11 +2660,6 @@ async def test_list_participants_async( assert response.total_size == 1086 -@pytest.mark.asyncio -async def test_list_participants_async_from_dict(): - await test_list_participants_async(request_type=dict) - - def test_list_participants_field_headers(): client = ConferenceRecordsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2988,8 +3012,8 @@ async def test_list_participants_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetParticipantSessionRequest, - dict, + service.GetParticipantSessionRequest(), + {}, ], ) def test_get_participant_session(request_type, transport: str = "grpc"): @@ -3000,7 +3024,7 @@ def test_get_participant_session(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3048,9 +3072,10 @@ def test_get_participant_session_non_empty_request_with_auto_populated_field(): client.get_participant_session(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetParticipantSessionRequest( + request_msg = service.GetParticipantSessionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_participant_session_use_cached_wrapped_rpc(): @@ -3136,8 +3161,15 @@ async def test_get_participant_session_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.GetParticipantSessionRequest(), + {}, + ], +) async def test_get_participant_session_async( - transport: str = "grpc_asyncio", request_type=service.GetParticipantSessionRequest + request_type, transport: str = "grpc_asyncio" ): client = ConferenceRecordsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3146,7 +3178,7 @@ async def test_get_participant_session_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( @@ -3171,11 +3203,6 @@ async def test_get_participant_session_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_participant_session_async_from_dict(): - await test_get_participant_session_async(request_type=dict) - - def test_get_participant_session_field_headers(): client = ConferenceRecordsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3330,8 +3357,8 @@ async def test_get_participant_session_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListParticipantSessionsRequest, - dict, + service.ListParticipantSessionsRequest(), + {}, ], ) def test_list_participant_sessions(request_type, transport: str = "grpc"): @@ -3342,7 +3369,7 @@ def test_list_participant_sessions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3392,11 +3419,12 @@ def test_list_participant_sessions_non_empty_request_with_auto_populated_field() client.list_participant_sessions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListParticipantSessionsRequest( + request_msg = service.ListParticipantSessionsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_participant_sessions_use_cached_wrapped_rpc(): @@ -3482,8 +3510,15 @@ async def test_list_participant_sessions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.ListParticipantSessionsRequest(), + {}, + ], +) async def test_list_participant_sessions_async( - transport: str = "grpc_asyncio", request_type=service.ListParticipantSessionsRequest + request_type, transport: str = "grpc_asyncio" ): client = ConferenceRecordsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3492,7 +3527,7 @@ async def test_list_participant_sessions_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( @@ -3517,11 +3552,6 @@ async def test_list_participant_sessions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_participant_sessions_async_from_dict(): - await test_list_participant_sessions_async(request_type=dict) - - def test_list_participant_sessions_field_headers(): client = ConferenceRecordsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3876,8 +3906,8 @@ async def test_list_participant_sessions_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetRecordingRequest, - dict, + service.GetRecordingRequest(), + {}, ], ) def test_get_recording(request_type, transport: str = "grpc"): @@ -3888,7 +3918,7 @@ def test_get_recording(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_recording), "__call__") as call: @@ -3934,9 +3964,10 @@ def test_get_recording_non_empty_request_with_auto_populated_field(): client.get_recording(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetRecordingRequest( + request_msg = service.GetRecordingRequest( name="name_value", ) + assert args[0] == request_msg def test_get_recording_use_cached_wrapped_rpc(): @@ -4017,9 +4048,14 @@ async def test_get_recording_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_recording_async( - transport: str = "grpc_asyncio", request_type=service.GetRecordingRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetRecordingRequest(), + {}, + ], +) +async def test_get_recording_async(request_type, transport: str = "grpc_asyncio"): client = ConferenceRecordsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4027,7 +4063,7 @@ async def test_get_recording_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_recording), "__call__") as call: @@ -4052,11 +4088,6 @@ async def test_get_recording_async( assert response.state == resource.Recording.State.STARTED -@pytest.mark.asyncio -async def test_get_recording_async_from_dict(): - await test_get_recording_async(request_type=dict) - - def test_get_recording_field_headers(): client = ConferenceRecordsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4199,8 +4230,8 @@ async def test_get_recording_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListRecordingsRequest, - dict, + service.ListRecordingsRequest(), + {}, ], ) def test_list_recordings(request_type, transport: str = "grpc"): @@ -4211,7 +4242,7 @@ def test_list_recordings(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_recordings), "__call__") as call: @@ -4256,10 +4287,11 @@ def test_list_recordings_non_empty_request_with_auto_populated_field(): client.list_recordings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListRecordingsRequest( + request_msg = service.ListRecordingsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_recordings_use_cached_wrapped_rpc(): @@ -4340,9 +4372,14 @@ async def test_list_recordings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_recordings_async( - transport: str = "grpc_asyncio", request_type=service.ListRecordingsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListRecordingsRequest(), + {}, + ], +) +async def test_list_recordings_async(request_type, transport: str = "grpc_asyncio"): client = ConferenceRecordsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4350,7 +4387,7 @@ async def test_list_recordings_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_recordings), "__call__") as call: @@ -4373,11 +4410,6 @@ async def test_list_recordings_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_recordings_async_from_dict(): - await test_list_recordings_async(request_type=dict) - - def test_list_recordings_field_headers(): client = ConferenceRecordsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4714,8 +4746,8 @@ async def test_list_recordings_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetTranscriptRequest, - dict, + service.GetTranscriptRequest(), + {}, ], ) def test_get_transcript(request_type, transport: str = "grpc"): @@ -4726,7 +4758,7 @@ def test_get_transcript(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_transcript), "__call__") as call: @@ -4772,9 +4804,10 @@ def test_get_transcript_non_empty_request_with_auto_populated_field(): client.get_transcript(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetTranscriptRequest( + request_msg = service.GetTranscriptRequest( name="name_value", ) + assert args[0] == request_msg def test_get_transcript_use_cached_wrapped_rpc(): @@ -4855,9 +4888,14 @@ async def test_get_transcript_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_transcript_async( - transport: str = "grpc_asyncio", request_type=service.GetTranscriptRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetTranscriptRequest(), + {}, + ], +) +async def test_get_transcript_async(request_type, transport: str = "grpc_asyncio"): client = ConferenceRecordsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4865,7 +4903,7 @@ async def test_get_transcript_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_transcript), "__call__") as call: @@ -4890,11 +4928,6 @@ async def test_get_transcript_async( assert response.state == resource.Transcript.State.STARTED -@pytest.mark.asyncio -async def test_get_transcript_async_from_dict(): - await test_get_transcript_async(request_type=dict) - - def test_get_transcript_field_headers(): client = ConferenceRecordsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5037,8 +5070,8 @@ async def test_get_transcript_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListTranscriptsRequest, - dict, + service.ListTranscriptsRequest(), + {}, ], ) def test_list_transcripts(request_type, transport: str = "grpc"): @@ -5049,7 +5082,7 @@ def test_list_transcripts(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_transcripts), "__call__") as call: @@ -5094,10 +5127,11 @@ def test_list_transcripts_non_empty_request_with_auto_populated_field(): client.list_transcripts(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListTranscriptsRequest( + request_msg = service.ListTranscriptsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_transcripts_use_cached_wrapped_rpc(): @@ -5180,9 +5214,14 @@ async def test_list_transcripts_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_transcripts_async( - transport: str = "grpc_asyncio", request_type=service.ListTranscriptsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListTranscriptsRequest(), + {}, + ], +) +async def test_list_transcripts_async(request_type, transport: str = "grpc_asyncio"): client = ConferenceRecordsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5190,7 +5229,7 @@ async def test_list_transcripts_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_transcripts), "__call__") as call: @@ -5213,11 +5252,6 @@ async def test_list_transcripts_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_transcripts_async_from_dict(): - await test_list_transcripts_async(request_type=dict) - - def test_list_transcripts_field_headers(): client = ConferenceRecordsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5554,8 +5588,8 @@ async def test_list_transcripts_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetTranscriptEntryRequest, - dict, + service.GetTranscriptEntryRequest(), + {}, ], ) def test_get_transcript_entry(request_type, transport: str = "grpc"): @@ -5566,7 +5600,7 @@ def test_get_transcript_entry(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5620,9 +5654,10 @@ def test_get_transcript_entry_non_empty_request_with_auto_populated_field(): client.get_transcript_entry(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetTranscriptEntryRequest( + request_msg = service.GetTranscriptEntryRequest( name="name_value", ) + assert args[0] == request_msg def test_get_transcript_entry_use_cached_wrapped_rpc(): @@ -5707,8 +5742,15 @@ async def test_get_transcript_entry_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.GetTranscriptEntryRequest(), + {}, + ], +) async def test_get_transcript_entry_async( - transport: str = "grpc_asyncio", request_type=service.GetTranscriptEntryRequest + request_type, transport: str = "grpc_asyncio" ): client = ConferenceRecordsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5717,7 +5759,7 @@ async def test_get_transcript_entry_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( @@ -5748,11 +5790,6 @@ async def test_get_transcript_entry_async( assert response.language_code == "language_code_value" -@pytest.mark.asyncio -async def test_get_transcript_entry_async_from_dict(): - await test_get_transcript_entry_async(request_type=dict) - - def test_get_transcript_entry_field_headers(): client = ConferenceRecordsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5907,8 +5944,8 @@ async def test_get_transcript_entry_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListTranscriptEntriesRequest, - dict, + service.ListTranscriptEntriesRequest(), + {}, ], ) def test_list_transcript_entries(request_type, transport: str = "grpc"): @@ -5919,7 +5956,7 @@ def test_list_transcript_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( @@ -5968,10 +6005,11 @@ def test_list_transcript_entries_non_empty_request_with_auto_populated_field(): client.list_transcript_entries(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListTranscriptEntriesRequest( + request_msg = service.ListTranscriptEntriesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_transcript_entries_use_cached_wrapped_rpc(): @@ -6057,8 +6095,15 @@ async def test_list_transcript_entries_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.ListTranscriptEntriesRequest(), + {}, + ], +) async def test_list_transcript_entries_async( - transport: str = "grpc_asyncio", request_type=service.ListTranscriptEntriesRequest + request_type, transport: str = "grpc_asyncio" ): client = ConferenceRecordsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -6067,7 +6112,7 @@ async def test_list_transcript_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( @@ -6092,11 +6137,6 @@ async def test_list_transcript_entries_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_transcript_entries_async_from_dict(): - await test_list_transcript_entries_async(request_type=dict) - - def test_list_transcript_entries_field_headers(): client = ConferenceRecordsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9041,7 +9081,6 @@ def test_get_conference_record_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetConferenceRecordRequest() - assert args[0] == request_msg @@ -9064,7 +9103,6 @@ def test_list_conference_records_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListConferenceRecordsRequest() - assert args[0] == request_msg @@ -9085,7 +9123,6 @@ def test_get_participant_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetParticipantRequest() - assert args[0] == request_msg @@ -9108,7 +9145,6 @@ def test_list_participants_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListParticipantsRequest() - assert args[0] == request_msg @@ -9131,7 +9167,6 @@ def test_get_participant_session_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetParticipantSessionRequest() - assert args[0] == request_msg @@ -9154,7 +9189,6 @@ def test_list_participant_sessions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListParticipantSessionsRequest() - assert args[0] == request_msg @@ -9175,7 +9209,6 @@ def test_get_recording_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetRecordingRequest() - assert args[0] == request_msg @@ -9196,7 +9229,6 @@ def test_list_recordings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListRecordingsRequest() - assert args[0] == request_msg @@ -9217,7 +9249,6 @@ def test_get_transcript_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetTranscriptRequest() - assert args[0] == request_msg @@ -9238,7 +9269,6 @@ def test_list_transcripts_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListTranscriptsRequest() - assert args[0] == request_msg @@ -9261,7 +9291,6 @@ def test_get_transcript_entry_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetTranscriptEntryRequest() - assert args[0] == request_msg @@ -9284,7 +9313,6 @@ def test_list_transcript_entries_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListTranscriptEntriesRequest() - assert args[0] == request_msg @@ -9328,7 +9356,6 @@ async def test_get_conference_record_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetConferenceRecordRequest() - assert args[0] == request_msg @@ -9357,7 +9384,6 @@ async def test_list_conference_records_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListConferenceRecordsRequest() - assert args[0] == request_msg @@ -9384,7 +9410,6 @@ async def test_get_participant_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetParticipantRequest() - assert args[0] == request_msg @@ -9414,7 +9439,6 @@ async def test_list_participants_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListParticipantsRequest() - assert args[0] == request_msg @@ -9443,7 +9467,6 @@ async def test_get_participant_session_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetParticipantSessionRequest() - assert args[0] == request_msg @@ -9472,7 +9495,6 @@ async def test_list_participant_sessions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListParticipantSessionsRequest() - assert args[0] == request_msg @@ -9500,7 +9522,6 @@ async def test_get_recording_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetRecordingRequest() - assert args[0] == request_msg @@ -9527,7 +9548,6 @@ async def test_list_recordings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListRecordingsRequest() - assert args[0] == request_msg @@ -9555,7 +9575,6 @@ async def test_get_transcript_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetTranscriptRequest() - assert args[0] == request_msg @@ -9582,7 +9601,6 @@ async def test_list_transcripts_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListTranscriptsRequest() - assert args[0] == request_msg @@ -9614,7 +9632,6 @@ async def test_get_transcript_entry_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetTranscriptEntryRequest() - assert args[0] == request_msg @@ -9643,7 +9660,6 @@ async def test_list_transcript_entries_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListTranscriptEntriesRequest() - assert args[0] == request_msg @@ -11288,7 +11304,6 @@ def test_get_conference_record_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetConferenceRecordRequest() - assert args[0] == request_msg @@ -11310,7 +11325,6 @@ def test_list_conference_records_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListConferenceRecordsRequest() - assert args[0] == request_msg @@ -11330,7 +11344,6 @@ def test_get_participant_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetParticipantRequest() - assert args[0] == request_msg @@ -11352,7 +11365,6 @@ def test_list_participants_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListParticipantsRequest() - assert args[0] == request_msg @@ -11374,7 +11386,6 @@ def test_get_participant_session_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetParticipantSessionRequest() - assert args[0] == request_msg @@ -11396,7 +11407,6 @@ def test_list_participant_sessions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListParticipantSessionsRequest() - assert args[0] == request_msg @@ -11416,7 +11426,6 @@ def test_get_recording_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetRecordingRequest() - assert args[0] == request_msg @@ -11436,7 +11445,6 @@ def test_list_recordings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListRecordingsRequest() - assert args[0] == request_msg @@ -11456,7 +11464,6 @@ def test_get_transcript_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetTranscriptRequest() - assert args[0] == request_msg @@ -11476,7 +11483,6 @@ def test_list_transcripts_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListTranscriptsRequest() - assert args[0] == request_msg @@ -11498,7 +11504,6 @@ def test_get_transcript_entry_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetTranscriptEntryRequest() - assert args[0] == request_msg @@ -11520,7 +11525,6 @@ def test_list_transcript_entries_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListTranscriptEntriesRequest() - assert args[0] == request_msg diff --git a/packages/google-apps-meet/tests/unit/gapic/meet_v2/test_spaces_service.py b/packages/google-apps-meet/tests/unit/gapic/meet_v2/test_spaces_service.py index f308e5658fb7..e608f69359c6 100644 --- a/packages/google-apps-meet/tests/unit/gapic/meet_v2/test_spaces_service.py +++ b/packages/google-apps-meet/tests/unit/gapic/meet_v2/test_spaces_service.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 @@ -107,6 +108,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" @@ -1310,8 +1326,8 @@ def test_spaces_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - service.CreateSpaceRequest, - dict, + service.CreateSpaceRequest(), + {}, ], ) def test_create_space(request_type, transport: str = "grpc"): @@ -1322,7 +1338,7 @@ def test_create_space(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_space), "__call__") as call: @@ -1368,7 +1384,8 @@ def test_create_space_non_empty_request_with_auto_populated_field(): client.create_space(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateSpaceRequest() + request_msg = service.CreateSpaceRequest() + assert args[0] == request_msg def test_create_space_use_cached_wrapped_rpc(): @@ -1449,9 +1466,14 @@ async def test_create_space_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_space_async( - transport: str = "grpc_asyncio", request_type=service.CreateSpaceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CreateSpaceRequest(), + {}, + ], +) +async def test_create_space_async(request_type, transport: str = "grpc_asyncio"): client = SpacesServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1459,7 +1481,7 @@ async def test_create_space_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_space), "__call__") as call: @@ -1486,11 +1508,6 @@ async def test_create_space_async( assert response.meeting_code == "meeting_code_value" -@pytest.mark.asyncio -async def test_create_space_async_from_dict(): - await test_create_space_async(request_type=dict) - - def test_create_space_flattened(): client = SpacesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1574,8 +1591,8 @@ async def test_create_space_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.GetSpaceRequest, - dict, + service.GetSpaceRequest(), + {}, ], ) def test_get_space(request_type, transport: str = "grpc"): @@ -1586,7 +1603,7 @@ def test_get_space(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_space), "__call__") as call: @@ -1634,9 +1651,10 @@ def test_get_space_non_empty_request_with_auto_populated_field(): client.get_space(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetSpaceRequest( + request_msg = service.GetSpaceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_space_use_cached_wrapped_rpc(): @@ -1715,9 +1733,14 @@ async def test_get_space_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_space_async( - transport: str = "grpc_asyncio", request_type=service.GetSpaceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetSpaceRequest(), + {}, + ], +) +async def test_get_space_async(request_type, transport: str = "grpc_asyncio"): client = SpacesServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1725,7 +1748,7 @@ async def test_get_space_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_space), "__call__") as call: @@ -1752,11 +1775,6 @@ async def test_get_space_async( assert response.meeting_code == "meeting_code_value" -@pytest.mark.asyncio -async def test_get_space_async_from_dict(): - await test_get_space_async(request_type=dict) - - def test_get_space_field_headers(): client = SpacesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1899,8 +1917,8 @@ async def test_get_space_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdateSpaceRequest, - dict, + service.UpdateSpaceRequest(), + {}, ], ) def test_update_space(request_type, transport: str = "grpc"): @@ -1911,7 +1929,7 @@ def test_update_space(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_space), "__call__") as call: @@ -1957,7 +1975,8 @@ def test_update_space_non_empty_request_with_auto_populated_field(): client.update_space(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateSpaceRequest() + request_msg = service.UpdateSpaceRequest() + assert args[0] == request_msg def test_update_space_use_cached_wrapped_rpc(): @@ -2038,9 +2057,14 @@ async def test_update_space_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_space_async( - transport: str = "grpc_asyncio", request_type=service.UpdateSpaceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateSpaceRequest(), + {}, + ], +) +async def test_update_space_async(request_type, transport: str = "grpc_asyncio"): client = SpacesServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2048,7 +2072,7 @@ async def test_update_space_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_space), "__call__") as call: @@ -2075,11 +2099,6 @@ async def test_update_space_async( assert response.meeting_code == "meeting_code_value" -@pytest.mark.asyncio -async def test_update_space_async_from_dict(): - await test_update_space_async(request_type=dict) - - def test_update_space_field_headers(): client = SpacesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2232,8 +2251,8 @@ async def test_update_space_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.EndActiveConferenceRequest, - dict, + service.EndActiveConferenceRequest(), + {}, ], ) def test_end_active_conference(request_type, transport: str = "grpc"): @@ -2244,7 +2263,7 @@ def test_end_active_conference(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2289,9 +2308,10 @@ def test_end_active_conference_non_empty_request_with_auto_populated_field(): client.end_active_conference(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.EndActiveConferenceRequest( + request_msg = service.EndActiveConferenceRequest( name="name_value", ) + assert args[0] == request_msg def test_end_active_conference_use_cached_wrapped_rpc(): @@ -2377,8 +2397,15 @@ async def test_end_active_conference_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.EndActiveConferenceRequest(), + {}, + ], +) async def test_end_active_conference_async( - transport: str = "grpc_asyncio", request_type=service.EndActiveConferenceRequest + request_type, transport: str = "grpc_asyncio" ): client = SpacesServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2387,7 +2414,7 @@ async def test_end_active_conference_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( @@ -2407,11 +2434,6 @@ async def test_end_active_conference_async( assert response is None -@pytest.mark.asyncio -async def test_end_active_conference_async_from_dict(): - await test_end_active_conference_async(request_type=dict) - - def test_end_active_conference_field_headers(): client = SpacesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3298,7 +3320,6 @@ def test_create_space_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateSpaceRequest() - assert args[0] == request_msg @@ -3319,7 +3340,6 @@ def test_get_space_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetSpaceRequest() - assert args[0] == request_msg @@ -3340,7 +3360,6 @@ def test_update_space_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateSpaceRequest() - assert args[0] == request_msg @@ -3363,7 +3382,6 @@ def test_end_active_conference_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.EndActiveConferenceRequest() - assert args[0] == request_msg @@ -3406,7 +3424,6 @@ async def test_create_space_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateSpaceRequest() - assert args[0] == request_msg @@ -3435,7 +3452,6 @@ async def test_get_space_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetSpaceRequest() - assert args[0] == request_msg @@ -3464,7 +3480,6 @@ async def test_update_space_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateSpaceRequest() - assert args[0] == request_msg @@ -3489,7 +3504,6 @@ async def test_end_active_conference_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.EndActiveConferenceRequest() - assert args[0] == request_msg @@ -4171,7 +4185,6 @@ def test_create_space_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateSpaceRequest() - assert args[0] == request_msg @@ -4191,7 +4204,6 @@ def test_get_space_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetSpaceRequest() - assert args[0] == request_msg @@ -4211,7 +4223,6 @@ def test_update_space_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateSpaceRequest() - assert args[0] == request_msg @@ -4233,7 +4244,6 @@ def test_end_active_conference_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.EndActiveConferenceRequest() - assert args[0] == request_msg diff --git a/packages/google-apps-meet/tests/unit/gapic/meet_v2beta/test_conference_records_service.py b/packages/google-apps-meet/tests/unit/gapic/meet_v2beta/test_conference_records_service.py index 1e5bbd9b917c..994b620dfa15 100644 --- a/packages/google-apps-meet/tests/unit/gapic/meet_v2beta/test_conference_records_service.py +++ b/packages/google-apps-meet/tests/unit/gapic/meet_v2beta/test_conference_records_service.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 @@ -108,6 +109,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" @@ -1386,8 +1402,8 @@ def test_conference_records_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - service.GetConferenceRecordRequest, - dict, + service.GetConferenceRecordRequest(), + {}, ], ) def test_get_conference_record(request_type, transport: str = "grpc"): @@ -1398,7 +1414,7 @@ def test_get_conference_record(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1448,9 +1464,10 @@ def test_get_conference_record_non_empty_request_with_auto_populated_field(): client.get_conference_record(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetConferenceRecordRequest( + request_msg = service.GetConferenceRecordRequest( name="name_value", ) + assert args[0] == request_msg def test_get_conference_record_use_cached_wrapped_rpc(): @@ -1536,8 +1553,15 @@ async def test_get_conference_record_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.GetConferenceRecordRequest(), + {}, + ], +) async def test_get_conference_record_async( - transport: str = "grpc_asyncio", request_type=service.GetConferenceRecordRequest + request_type, transport: str = "grpc_asyncio" ): client = ConferenceRecordsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1546,7 +1570,7 @@ async def test_get_conference_record_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( @@ -1573,11 +1597,6 @@ async def test_get_conference_record_async( assert response.space == "space_value" -@pytest.mark.asyncio -async def test_get_conference_record_async_from_dict(): - await test_get_conference_record_async(request_type=dict) - - def test_get_conference_record_field_headers(): client = ConferenceRecordsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1732,8 +1751,8 @@ async def test_get_conference_record_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListConferenceRecordsRequest, - dict, + service.ListConferenceRecordsRequest(), + {}, ], ) def test_list_conference_records(request_type, transport: str = "grpc"): @@ -1744,7 +1763,7 @@ def test_list_conference_records(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1793,10 +1812,11 @@ def test_list_conference_records_non_empty_request_with_auto_populated_field(): client.list_conference_records(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListConferenceRecordsRequest( + request_msg = service.ListConferenceRecordsRequest( page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_conference_records_use_cached_wrapped_rpc(): @@ -1882,8 +1902,15 @@ async def test_list_conference_records_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.ListConferenceRecordsRequest(), + {}, + ], +) async def test_list_conference_records_async( - transport: str = "grpc_asyncio", request_type=service.ListConferenceRecordsRequest + request_type, transport: str = "grpc_asyncio" ): client = ConferenceRecordsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1892,7 +1919,7 @@ async def test_list_conference_records_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( @@ -1917,11 +1944,6 @@ async def test_list_conference_records_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_conference_records_async_from_dict(): - await test_list_conference_records_async(request_type=dict) - - def test_list_conference_records_pager(transport_name: str = "grpc"): client = ConferenceRecordsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2120,8 +2142,8 @@ async def test_list_conference_records_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetParticipantRequest, - dict, + service.GetParticipantRequest(), + {}, ], ) def test_get_participant(request_type, transport: str = "grpc"): @@ -2132,7 +2154,7 @@ def test_get_participant(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_participant), "__call__") as call: @@ -2176,9 +2198,10 @@ def test_get_participant_non_empty_request_with_auto_populated_field(): client.get_participant(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetParticipantRequest( + request_msg = service.GetParticipantRequest( name="name_value", ) + assert args[0] == request_msg def test_get_participant_use_cached_wrapped_rpc(): @@ -2259,9 +2282,14 @@ async def test_get_participant_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_participant_async( - transport: str = "grpc_asyncio", request_type=service.GetParticipantRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetParticipantRequest(), + {}, + ], +) +async def test_get_participant_async(request_type, transport: str = "grpc_asyncio"): client = ConferenceRecordsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2269,7 +2297,7 @@ async def test_get_participant_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_participant), "__call__") as call: @@ -2292,11 +2320,6 @@ async def test_get_participant_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_participant_async_from_dict(): - await test_get_participant_async(request_type=dict) - - def test_get_participant_field_headers(): client = ConferenceRecordsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2443,8 +2466,8 @@ async def test_get_participant_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListParticipantsRequest, - dict, + service.ListParticipantsRequest(), + {}, ], ) def test_list_participants(request_type, transport: str = "grpc"): @@ -2455,7 +2478,7 @@ def test_list_participants(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2507,11 +2530,12 @@ def test_list_participants_non_empty_request_with_auto_populated_field(): client.list_participants(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListParticipantsRequest( + request_msg = service.ListParticipantsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_participants_use_cached_wrapped_rpc(): @@ -2594,9 +2618,14 @@ async def test_list_participants_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_participants_async( - transport: str = "grpc_asyncio", request_type=service.ListParticipantsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListParticipantsRequest(), + {}, + ], +) +async def test_list_participants_async(request_type, transport: str = "grpc_asyncio"): client = ConferenceRecordsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2604,7 +2633,7 @@ async def test_list_participants_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( @@ -2631,11 +2660,6 @@ async def test_list_participants_async( assert response.total_size == 1086 -@pytest.mark.asyncio -async def test_list_participants_async_from_dict(): - await test_list_participants_async(request_type=dict) - - def test_list_participants_field_headers(): client = ConferenceRecordsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2988,8 +3012,8 @@ async def test_list_participants_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetParticipantSessionRequest, - dict, + service.GetParticipantSessionRequest(), + {}, ], ) def test_get_participant_session(request_type, transport: str = "grpc"): @@ -3000,7 +3024,7 @@ def test_get_participant_session(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3048,9 +3072,10 @@ def test_get_participant_session_non_empty_request_with_auto_populated_field(): client.get_participant_session(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetParticipantSessionRequest( + request_msg = service.GetParticipantSessionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_participant_session_use_cached_wrapped_rpc(): @@ -3136,8 +3161,15 @@ async def test_get_participant_session_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.GetParticipantSessionRequest(), + {}, + ], +) async def test_get_participant_session_async( - transport: str = "grpc_asyncio", request_type=service.GetParticipantSessionRequest + request_type, transport: str = "grpc_asyncio" ): client = ConferenceRecordsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3146,7 +3178,7 @@ async def test_get_participant_session_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( @@ -3171,11 +3203,6 @@ async def test_get_participant_session_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_participant_session_async_from_dict(): - await test_get_participant_session_async(request_type=dict) - - def test_get_participant_session_field_headers(): client = ConferenceRecordsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3330,8 +3357,8 @@ async def test_get_participant_session_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListParticipantSessionsRequest, - dict, + service.ListParticipantSessionsRequest(), + {}, ], ) def test_list_participant_sessions(request_type, transport: str = "grpc"): @@ -3342,7 +3369,7 @@ def test_list_participant_sessions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3392,11 +3419,12 @@ def test_list_participant_sessions_non_empty_request_with_auto_populated_field() client.list_participant_sessions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListParticipantSessionsRequest( + request_msg = service.ListParticipantSessionsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_participant_sessions_use_cached_wrapped_rpc(): @@ -3482,8 +3510,15 @@ async def test_list_participant_sessions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.ListParticipantSessionsRequest(), + {}, + ], +) async def test_list_participant_sessions_async( - transport: str = "grpc_asyncio", request_type=service.ListParticipantSessionsRequest + request_type, transport: str = "grpc_asyncio" ): client = ConferenceRecordsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3492,7 +3527,7 @@ async def test_list_participant_sessions_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( @@ -3517,11 +3552,6 @@ async def test_list_participant_sessions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_participant_sessions_async_from_dict(): - await test_list_participant_sessions_async(request_type=dict) - - def test_list_participant_sessions_field_headers(): client = ConferenceRecordsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3876,8 +3906,8 @@ async def test_list_participant_sessions_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetRecordingRequest, - dict, + service.GetRecordingRequest(), + {}, ], ) def test_get_recording(request_type, transport: str = "grpc"): @@ -3888,7 +3918,7 @@ def test_get_recording(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_recording), "__call__") as call: @@ -3934,9 +3964,10 @@ def test_get_recording_non_empty_request_with_auto_populated_field(): client.get_recording(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetRecordingRequest( + request_msg = service.GetRecordingRequest( name="name_value", ) + assert args[0] == request_msg def test_get_recording_use_cached_wrapped_rpc(): @@ -4017,9 +4048,14 @@ async def test_get_recording_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_recording_async( - transport: str = "grpc_asyncio", request_type=service.GetRecordingRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetRecordingRequest(), + {}, + ], +) +async def test_get_recording_async(request_type, transport: str = "grpc_asyncio"): client = ConferenceRecordsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4027,7 +4063,7 @@ async def test_get_recording_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_recording), "__call__") as call: @@ -4052,11 +4088,6 @@ async def test_get_recording_async( assert response.state == resource.Recording.State.STARTED -@pytest.mark.asyncio -async def test_get_recording_async_from_dict(): - await test_get_recording_async(request_type=dict) - - def test_get_recording_field_headers(): client = ConferenceRecordsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4199,8 +4230,8 @@ async def test_get_recording_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListRecordingsRequest, - dict, + service.ListRecordingsRequest(), + {}, ], ) def test_list_recordings(request_type, transport: str = "grpc"): @@ -4211,7 +4242,7 @@ def test_list_recordings(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_recordings), "__call__") as call: @@ -4256,10 +4287,11 @@ def test_list_recordings_non_empty_request_with_auto_populated_field(): client.list_recordings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListRecordingsRequest( + request_msg = service.ListRecordingsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_recordings_use_cached_wrapped_rpc(): @@ -4340,9 +4372,14 @@ async def test_list_recordings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_recordings_async( - transport: str = "grpc_asyncio", request_type=service.ListRecordingsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListRecordingsRequest(), + {}, + ], +) +async def test_list_recordings_async(request_type, transport: str = "grpc_asyncio"): client = ConferenceRecordsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4350,7 +4387,7 @@ async def test_list_recordings_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_recordings), "__call__") as call: @@ -4373,11 +4410,6 @@ async def test_list_recordings_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_recordings_async_from_dict(): - await test_list_recordings_async(request_type=dict) - - def test_list_recordings_field_headers(): client = ConferenceRecordsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4714,8 +4746,8 @@ async def test_list_recordings_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetTranscriptRequest, - dict, + service.GetTranscriptRequest(), + {}, ], ) def test_get_transcript(request_type, transport: str = "grpc"): @@ -4726,7 +4758,7 @@ def test_get_transcript(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_transcript), "__call__") as call: @@ -4772,9 +4804,10 @@ def test_get_transcript_non_empty_request_with_auto_populated_field(): client.get_transcript(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetTranscriptRequest( + request_msg = service.GetTranscriptRequest( name="name_value", ) + assert args[0] == request_msg def test_get_transcript_use_cached_wrapped_rpc(): @@ -4855,9 +4888,14 @@ async def test_get_transcript_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_transcript_async( - transport: str = "grpc_asyncio", request_type=service.GetTranscriptRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetTranscriptRequest(), + {}, + ], +) +async def test_get_transcript_async(request_type, transport: str = "grpc_asyncio"): client = ConferenceRecordsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4865,7 +4903,7 @@ async def test_get_transcript_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_transcript), "__call__") as call: @@ -4890,11 +4928,6 @@ async def test_get_transcript_async( assert response.state == resource.Transcript.State.STARTED -@pytest.mark.asyncio -async def test_get_transcript_async_from_dict(): - await test_get_transcript_async(request_type=dict) - - def test_get_transcript_field_headers(): client = ConferenceRecordsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5037,8 +5070,8 @@ async def test_get_transcript_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListTranscriptsRequest, - dict, + service.ListTranscriptsRequest(), + {}, ], ) def test_list_transcripts(request_type, transport: str = "grpc"): @@ -5049,7 +5082,7 @@ def test_list_transcripts(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_transcripts), "__call__") as call: @@ -5094,10 +5127,11 @@ def test_list_transcripts_non_empty_request_with_auto_populated_field(): client.list_transcripts(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListTranscriptsRequest( + request_msg = service.ListTranscriptsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_transcripts_use_cached_wrapped_rpc(): @@ -5180,9 +5214,14 @@ async def test_list_transcripts_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_transcripts_async( - transport: str = "grpc_asyncio", request_type=service.ListTranscriptsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListTranscriptsRequest(), + {}, + ], +) +async def test_list_transcripts_async(request_type, transport: str = "grpc_asyncio"): client = ConferenceRecordsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5190,7 +5229,7 @@ async def test_list_transcripts_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_transcripts), "__call__") as call: @@ -5213,11 +5252,6 @@ async def test_list_transcripts_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_transcripts_async_from_dict(): - await test_list_transcripts_async(request_type=dict) - - def test_list_transcripts_field_headers(): client = ConferenceRecordsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5554,8 +5588,8 @@ async def test_list_transcripts_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetTranscriptEntryRequest, - dict, + service.GetTranscriptEntryRequest(), + {}, ], ) def test_get_transcript_entry(request_type, transport: str = "grpc"): @@ -5566,7 +5600,7 @@ def test_get_transcript_entry(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5620,9 +5654,10 @@ def test_get_transcript_entry_non_empty_request_with_auto_populated_field(): client.get_transcript_entry(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetTranscriptEntryRequest( + request_msg = service.GetTranscriptEntryRequest( name="name_value", ) + assert args[0] == request_msg def test_get_transcript_entry_use_cached_wrapped_rpc(): @@ -5707,8 +5742,15 @@ async def test_get_transcript_entry_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.GetTranscriptEntryRequest(), + {}, + ], +) async def test_get_transcript_entry_async( - transport: str = "grpc_asyncio", request_type=service.GetTranscriptEntryRequest + request_type, transport: str = "grpc_asyncio" ): client = ConferenceRecordsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5717,7 +5759,7 @@ async def test_get_transcript_entry_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( @@ -5748,11 +5790,6 @@ async def test_get_transcript_entry_async( assert response.language_code == "language_code_value" -@pytest.mark.asyncio -async def test_get_transcript_entry_async_from_dict(): - await test_get_transcript_entry_async(request_type=dict) - - def test_get_transcript_entry_field_headers(): client = ConferenceRecordsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5907,8 +5944,8 @@ async def test_get_transcript_entry_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListTranscriptEntriesRequest, - dict, + service.ListTranscriptEntriesRequest(), + {}, ], ) def test_list_transcript_entries(request_type, transport: str = "grpc"): @@ -5919,7 +5956,7 @@ def test_list_transcript_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( @@ -5968,10 +6005,11 @@ def test_list_transcript_entries_non_empty_request_with_auto_populated_field(): client.list_transcript_entries(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListTranscriptEntriesRequest( + request_msg = service.ListTranscriptEntriesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_transcript_entries_use_cached_wrapped_rpc(): @@ -6057,8 +6095,15 @@ async def test_list_transcript_entries_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.ListTranscriptEntriesRequest(), + {}, + ], +) async def test_list_transcript_entries_async( - transport: str = "grpc_asyncio", request_type=service.ListTranscriptEntriesRequest + request_type, transport: str = "grpc_asyncio" ): client = ConferenceRecordsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -6067,7 +6112,7 @@ async def test_list_transcript_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( @@ -6092,11 +6137,6 @@ async def test_list_transcript_entries_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_transcript_entries_async_from_dict(): - await test_list_transcript_entries_async(request_type=dict) - - def test_list_transcript_entries_field_headers(): client = ConferenceRecordsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9047,7 +9087,6 @@ def test_get_conference_record_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetConferenceRecordRequest() - assert args[0] == request_msg @@ -9070,7 +9109,6 @@ def test_list_conference_records_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListConferenceRecordsRequest() - assert args[0] == request_msg @@ -9091,7 +9129,6 @@ def test_get_participant_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetParticipantRequest() - assert args[0] == request_msg @@ -9114,7 +9151,6 @@ def test_list_participants_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListParticipantsRequest() - assert args[0] == request_msg @@ -9137,7 +9173,6 @@ def test_get_participant_session_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetParticipantSessionRequest() - assert args[0] == request_msg @@ -9160,7 +9195,6 @@ def test_list_participant_sessions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListParticipantSessionsRequest() - assert args[0] == request_msg @@ -9181,7 +9215,6 @@ def test_get_recording_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetRecordingRequest() - assert args[0] == request_msg @@ -9202,7 +9235,6 @@ def test_list_recordings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListRecordingsRequest() - assert args[0] == request_msg @@ -9223,7 +9255,6 @@ def test_get_transcript_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetTranscriptRequest() - assert args[0] == request_msg @@ -9244,7 +9275,6 @@ def test_list_transcripts_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListTranscriptsRequest() - assert args[0] == request_msg @@ -9267,7 +9297,6 @@ def test_get_transcript_entry_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetTranscriptEntryRequest() - assert args[0] == request_msg @@ -9290,7 +9319,6 @@ def test_list_transcript_entries_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListTranscriptEntriesRequest() - assert args[0] == request_msg @@ -9334,7 +9362,6 @@ async def test_get_conference_record_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetConferenceRecordRequest() - assert args[0] == request_msg @@ -9363,7 +9390,6 @@ async def test_list_conference_records_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListConferenceRecordsRequest() - assert args[0] == request_msg @@ -9390,7 +9416,6 @@ async def test_get_participant_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetParticipantRequest() - assert args[0] == request_msg @@ -9420,7 +9445,6 @@ async def test_list_participants_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListParticipantsRequest() - assert args[0] == request_msg @@ -9449,7 +9473,6 @@ async def test_get_participant_session_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetParticipantSessionRequest() - assert args[0] == request_msg @@ -9478,7 +9501,6 @@ async def test_list_participant_sessions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListParticipantSessionsRequest() - assert args[0] == request_msg @@ -9506,7 +9528,6 @@ async def test_get_recording_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetRecordingRequest() - assert args[0] == request_msg @@ -9533,7 +9554,6 @@ async def test_list_recordings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListRecordingsRequest() - assert args[0] == request_msg @@ -9561,7 +9581,6 @@ async def test_get_transcript_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetTranscriptRequest() - assert args[0] == request_msg @@ -9588,7 +9607,6 @@ async def test_list_transcripts_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListTranscriptsRequest() - assert args[0] == request_msg @@ -9620,7 +9638,6 @@ async def test_get_transcript_entry_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetTranscriptEntryRequest() - assert args[0] == request_msg @@ -9649,7 +9666,6 @@ async def test_list_transcript_entries_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListTranscriptEntriesRequest() - assert args[0] == request_msg @@ -11294,7 +11310,6 @@ def test_get_conference_record_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetConferenceRecordRequest() - assert args[0] == request_msg @@ -11316,7 +11331,6 @@ def test_list_conference_records_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListConferenceRecordsRequest() - assert args[0] == request_msg @@ -11336,7 +11350,6 @@ def test_get_participant_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetParticipantRequest() - assert args[0] == request_msg @@ -11358,7 +11371,6 @@ def test_list_participants_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListParticipantsRequest() - assert args[0] == request_msg @@ -11380,7 +11392,6 @@ def test_get_participant_session_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetParticipantSessionRequest() - assert args[0] == request_msg @@ -11402,7 +11413,6 @@ def test_list_participant_sessions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListParticipantSessionsRequest() - assert args[0] == request_msg @@ -11422,7 +11432,6 @@ def test_get_recording_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetRecordingRequest() - assert args[0] == request_msg @@ -11442,7 +11451,6 @@ def test_list_recordings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListRecordingsRequest() - assert args[0] == request_msg @@ -11462,7 +11470,6 @@ def test_get_transcript_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetTranscriptRequest() - assert args[0] == request_msg @@ -11482,7 +11489,6 @@ def test_list_transcripts_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListTranscriptsRequest() - assert args[0] == request_msg @@ -11504,7 +11510,6 @@ def test_get_transcript_entry_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetTranscriptEntryRequest() - assert args[0] == request_msg @@ -11526,7 +11531,6 @@ def test_list_transcript_entries_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListTranscriptEntriesRequest() - assert args[0] == request_msg diff --git a/packages/google-apps-meet/tests/unit/gapic/meet_v2beta/test_spaces_service.py b/packages/google-apps-meet/tests/unit/gapic/meet_v2beta/test_spaces_service.py index c805588d817b..4768acc8166f 100644 --- a/packages/google-apps-meet/tests/unit/gapic/meet_v2beta/test_spaces_service.py +++ b/packages/google-apps-meet/tests/unit/gapic/meet_v2beta/test_spaces_service.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 @@ -108,6 +109,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" @@ -1314,8 +1330,8 @@ def test_spaces_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - service.CreateSpaceRequest, - dict, + service.CreateSpaceRequest(), + {}, ], ) def test_create_space(request_type, transport: str = "grpc"): @@ -1326,7 +1342,7 @@ def test_create_space(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_space), "__call__") as call: @@ -1372,7 +1388,8 @@ def test_create_space_non_empty_request_with_auto_populated_field(): client.create_space(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateSpaceRequest() + request_msg = service.CreateSpaceRequest() + assert args[0] == request_msg def test_create_space_use_cached_wrapped_rpc(): @@ -1453,9 +1470,14 @@ async def test_create_space_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_space_async( - transport: str = "grpc_asyncio", request_type=service.CreateSpaceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CreateSpaceRequest(), + {}, + ], +) +async def test_create_space_async(request_type, transport: str = "grpc_asyncio"): client = SpacesServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1463,7 +1485,7 @@ async def test_create_space_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_space), "__call__") as call: @@ -1490,11 +1512,6 @@ async def test_create_space_async( assert response.meeting_code == "meeting_code_value" -@pytest.mark.asyncio -async def test_create_space_async_from_dict(): - await test_create_space_async(request_type=dict) - - def test_create_space_flattened(): client = SpacesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1578,8 +1595,8 @@ async def test_create_space_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.GetSpaceRequest, - dict, + service.GetSpaceRequest(), + {}, ], ) def test_get_space(request_type, transport: str = "grpc"): @@ -1590,7 +1607,7 @@ def test_get_space(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_space), "__call__") as call: @@ -1638,9 +1655,10 @@ def test_get_space_non_empty_request_with_auto_populated_field(): client.get_space(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetSpaceRequest( + request_msg = service.GetSpaceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_space_use_cached_wrapped_rpc(): @@ -1719,9 +1737,14 @@ async def test_get_space_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_space_async( - transport: str = "grpc_asyncio", request_type=service.GetSpaceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetSpaceRequest(), + {}, + ], +) +async def test_get_space_async(request_type, transport: str = "grpc_asyncio"): client = SpacesServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1729,7 +1752,7 @@ async def test_get_space_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_space), "__call__") as call: @@ -1756,11 +1779,6 @@ async def test_get_space_async( assert response.meeting_code == "meeting_code_value" -@pytest.mark.asyncio -async def test_get_space_async_from_dict(): - await test_get_space_async(request_type=dict) - - def test_get_space_field_headers(): client = SpacesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1903,8 +1921,8 @@ async def test_get_space_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdateSpaceRequest, - dict, + service.UpdateSpaceRequest(), + {}, ], ) def test_update_space(request_type, transport: str = "grpc"): @@ -1915,7 +1933,7 @@ def test_update_space(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_space), "__call__") as call: @@ -1961,7 +1979,8 @@ def test_update_space_non_empty_request_with_auto_populated_field(): client.update_space(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateSpaceRequest() + request_msg = service.UpdateSpaceRequest() + assert args[0] == request_msg def test_update_space_use_cached_wrapped_rpc(): @@ -2042,9 +2061,14 @@ async def test_update_space_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_space_async( - transport: str = "grpc_asyncio", request_type=service.UpdateSpaceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateSpaceRequest(), + {}, + ], +) +async def test_update_space_async(request_type, transport: str = "grpc_asyncio"): client = SpacesServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2052,7 +2076,7 @@ async def test_update_space_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_space), "__call__") as call: @@ -2079,11 +2103,6 @@ async def test_update_space_async( assert response.meeting_code == "meeting_code_value" -@pytest.mark.asyncio -async def test_update_space_async_from_dict(): - await test_update_space_async(request_type=dict) - - def test_update_space_field_headers(): client = SpacesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2236,8 +2255,8 @@ async def test_update_space_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ConnectActiveConferenceRequest, - dict, + service.ConnectActiveConferenceRequest(), + {}, ], ) def test_connect_active_conference(request_type, transport: str = "grpc"): @@ -2248,7 +2267,7 @@ def test_connect_active_conference(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,10 +2318,11 @@ def test_connect_active_conference_non_empty_request_with_auto_populated_field() client.connect_active_conference(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ConnectActiveConferenceRequest( + request_msg = service.ConnectActiveConferenceRequest( name="name_value", offer="offer_value", ) + assert args[0] == request_msg def test_connect_active_conference_use_cached_wrapped_rpc(): @@ -2388,8 +2408,15 @@ async def test_connect_active_conference_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.ConnectActiveConferenceRequest(), + {}, + ], +) async def test_connect_active_conference_async( - transport: str = "grpc_asyncio", request_type=service.ConnectActiveConferenceRequest + request_type, transport: str = "grpc_asyncio" ): client = SpacesServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2398,7 +2425,7 @@ async def test_connect_active_conference_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( @@ -2425,11 +2452,6 @@ async def test_connect_active_conference_async( assert response.trace_id == "trace_id_value" -@pytest.mark.asyncio -async def test_connect_active_conference_async_from_dict(): - await test_connect_active_conference_async(request_type=dict) - - def test_connect_active_conference_field_headers(): client = SpacesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2584,8 +2606,8 @@ async def test_connect_active_conference_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.EndActiveConferenceRequest, - dict, + service.EndActiveConferenceRequest(), + {}, ], ) def test_end_active_conference(request_type, transport: str = "grpc"): @@ -2596,7 +2618,7 @@ def test_end_active_conference(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2641,9 +2663,10 @@ def test_end_active_conference_non_empty_request_with_auto_populated_field(): client.end_active_conference(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.EndActiveConferenceRequest( + request_msg = service.EndActiveConferenceRequest( name="name_value", ) + assert args[0] == request_msg def test_end_active_conference_use_cached_wrapped_rpc(): @@ -2729,8 +2752,15 @@ async def test_end_active_conference_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.EndActiveConferenceRequest(), + {}, + ], +) async def test_end_active_conference_async( - transport: str = "grpc_asyncio", request_type=service.EndActiveConferenceRequest + request_type, transport: str = "grpc_asyncio" ): client = SpacesServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2739,7 +2769,7 @@ async def test_end_active_conference_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( @@ -2759,11 +2789,6 @@ async def test_end_active_conference_async( assert response is None -@pytest.mark.asyncio -async def test_end_active_conference_async_from_dict(): - await test_end_active_conference_async(request_type=dict) - - def test_end_active_conference_field_headers(): client = SpacesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2914,8 +2939,8 @@ async def test_end_active_conference_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.CreateMemberRequest, - dict, + service.CreateMemberRequest(), + {}, ], ) def test_create_member(request_type, transport: str = "grpc"): @@ -2926,7 +2951,7 @@ def test_create_member(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_member), "__call__") as call: @@ -2976,9 +3001,10 @@ def test_create_member_non_empty_request_with_auto_populated_field(): client.create_member(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateMemberRequest( + request_msg = service.CreateMemberRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_member_use_cached_wrapped_rpc(): @@ -3059,9 +3085,14 @@ async def test_create_member_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_member_async( - transport: str = "grpc_asyncio", request_type=service.CreateMemberRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CreateMemberRequest(), + {}, + ], +) +async def test_create_member_async(request_type, transport: str = "grpc_asyncio"): client = SpacesServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3069,7 +3100,7 @@ async def test_create_member_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_member), "__call__") as call: @@ -3098,11 +3129,6 @@ async def test_create_member_async( assert response.user == "user_value" -@pytest.mark.asyncio -async def test_create_member_async_from_dict(): - await test_create_member_async(request_type=dict) - - def test_create_member_field_headers(): client = SpacesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3255,8 +3281,8 @@ async def test_create_member_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.GetMemberRequest, - dict, + service.GetMemberRequest(), + {}, ], ) def test_get_member(request_type, transport: str = "grpc"): @@ -3267,7 +3293,7 @@ def test_get_member(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_member), "__call__") as call: @@ -3317,9 +3343,10 @@ def test_get_member_non_empty_request_with_auto_populated_field(): client.get_member(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetMemberRequest( + request_msg = service.GetMemberRequest( name="name_value", ) + assert args[0] == request_msg def test_get_member_use_cached_wrapped_rpc(): @@ -3398,9 +3425,14 @@ async def test_get_member_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_member_async( - transport: str = "grpc_asyncio", request_type=service.GetMemberRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetMemberRequest(), + {}, + ], +) +async def test_get_member_async(request_type, transport: str = "grpc_asyncio"): client = SpacesServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3408,7 +3440,7 @@ async def test_get_member_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_member), "__call__") as call: @@ -3437,11 +3469,6 @@ async def test_get_member_async( assert response.user == "user_value" -@pytest.mark.asyncio -async def test_get_member_async_from_dict(): - await test_get_member_async(request_type=dict) - - def test_get_member_field_headers(): client = SpacesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3584,8 +3611,8 @@ async def test_get_member_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListMembersRequest, - dict, + service.ListMembersRequest(), + {}, ], ) def test_list_members(request_type, transport: str = "grpc"): @@ -3596,7 +3623,7 @@ def test_list_members(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_members), "__call__") as call: @@ -3641,10 +3668,11 @@ def test_list_members_non_empty_request_with_auto_populated_field(): client.list_members(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListMembersRequest( + request_msg = service.ListMembersRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_members_use_cached_wrapped_rpc(): @@ -3725,9 +3753,14 @@ async def test_list_members_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_members_async( - transport: str = "grpc_asyncio", request_type=service.ListMembersRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListMembersRequest(), + {}, + ], +) +async def test_list_members_async(request_type, transport: str = "grpc_asyncio"): client = SpacesServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3735,7 +3768,7 @@ async def test_list_members_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_members), "__call__") as call: @@ -3758,11 +3791,6 @@ async def test_list_members_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_members_async_from_dict(): - await test_list_members_async(request_type=dict) - - def test_list_members_field_headers(): client = SpacesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4099,8 +4127,8 @@ async def test_list_members_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.DeleteMemberRequest, - dict, + service.DeleteMemberRequest(), + {}, ], ) def test_delete_member(request_type, transport: str = "grpc"): @@ -4111,7 +4139,7 @@ def test_delete_member(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_member), "__call__") as call: @@ -4152,9 +4180,10 @@ def test_delete_member_non_empty_request_with_auto_populated_field(): client.delete_member(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteMemberRequest( + request_msg = service.DeleteMemberRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_member_use_cached_wrapped_rpc(): @@ -4235,9 +4264,14 @@ async def test_delete_member_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_member_async( - transport: str = "grpc_asyncio", request_type=service.DeleteMemberRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteMemberRequest(), + {}, + ], +) +async def test_delete_member_async(request_type, transport: str = "grpc_asyncio"): client = SpacesServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4245,7 +4279,7 @@ async def test_delete_member_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_member), "__call__") as call: @@ -4263,11 +4297,6 @@ async def test_delete_member_async( assert response is None -@pytest.mark.asyncio -async def test_delete_member_async_from_dict(): - await test_delete_member_async(request_type=dict) - - def test_delete_member_field_headers(): client = SpacesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6122,7 +6151,6 @@ def test_create_space_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateSpaceRequest() - assert args[0] == request_msg @@ -6143,7 +6171,6 @@ def test_get_space_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetSpaceRequest() - assert args[0] == request_msg @@ -6164,7 +6191,6 @@ def test_update_space_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateSpaceRequest() - assert args[0] == request_msg @@ -6187,7 +6213,6 @@ def test_connect_active_conference_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ConnectActiveConferenceRequest() - assert args[0] == request_msg @@ -6210,7 +6235,6 @@ def test_end_active_conference_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.EndActiveConferenceRequest() - assert args[0] == request_msg @@ -6231,7 +6255,6 @@ def test_create_member_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateMemberRequest() - assert args[0] == request_msg @@ -6252,7 +6275,6 @@ def test_get_member_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetMemberRequest() - assert args[0] == request_msg @@ -6273,7 +6295,6 @@ def test_list_members_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListMembersRequest() - assert args[0] == request_msg @@ -6294,7 +6315,6 @@ def test_delete_member_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteMemberRequest() - assert args[0] == request_msg @@ -6337,7 +6357,6 @@ async def test_create_space_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateSpaceRequest() - assert args[0] == request_msg @@ -6366,7 +6385,6 @@ async def test_get_space_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetSpaceRequest() - assert args[0] == request_msg @@ -6395,7 +6413,6 @@ async def test_update_space_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateSpaceRequest() - assert args[0] == request_msg @@ -6425,7 +6442,6 @@ async def test_connect_active_conference_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ConnectActiveConferenceRequest() - assert args[0] == request_msg @@ -6450,7 +6466,6 @@ async def test_end_active_conference_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.EndActiveConferenceRequest() - assert args[0] == request_msg @@ -6480,7 +6495,6 @@ async def test_create_member_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateMemberRequest() - assert args[0] == request_msg @@ -6510,7 +6524,6 @@ async def test_get_member_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetMemberRequest() - assert args[0] == request_msg @@ -6537,7 +6550,6 @@ async def test_list_members_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListMembersRequest() - assert args[0] == request_msg @@ -6560,7 +6572,6 @@ async def test_delete_member_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteMemberRequest() - assert args[0] == request_msg @@ -7983,7 +7994,6 @@ def test_create_space_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateSpaceRequest() - assert args[0] == request_msg @@ -8003,7 +8013,6 @@ def test_get_space_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetSpaceRequest() - assert args[0] == request_msg @@ -8023,7 +8032,6 @@ def test_update_space_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateSpaceRequest() - assert args[0] == request_msg @@ -8045,7 +8053,6 @@ def test_connect_active_conference_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ConnectActiveConferenceRequest() - assert args[0] == request_msg @@ -8067,7 +8074,6 @@ def test_end_active_conference_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.EndActiveConferenceRequest() - assert args[0] == request_msg @@ -8087,7 +8093,6 @@ def test_create_member_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateMemberRequest() - assert args[0] == request_msg @@ -8107,7 +8112,6 @@ def test_get_member_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetMemberRequest() - assert args[0] == request_msg @@ -8127,7 +8131,6 @@ def test_list_members_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListMembersRequest() - assert args[0] == request_msg @@ -8147,7 +8150,6 @@ def test_delete_member_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteMemberRequest() - assert args[0] == request_msg diff --git a/packages/google-apps-script-type/noxfile.py b/packages/google-apps-script-type/noxfile.py index 3d0b7a331611..a40e278a5761 100644 --- a/packages/google-apps-script-type/noxfile.py +++ b/packages/google-apps-script-type/noxfile.py @@ -47,7 +47,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-apps-script-type" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-apps-script-type/setup.py b/packages/google-apps-script-type/setup.py index bf9f17982766..7a4b08ab118e 100644 --- a/packages/google-apps-script-type/setup.py +++ b/packages/google-apps-script-type/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/google-apps-script-type/testing/constraints-3.10.txt b/packages/google-apps-script-type/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-apps-script-type/testing/constraints-3.10.txt +++ b/packages/google-apps-script-type/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-area120-tables/noxfile.py b/packages/google-area120-tables/noxfile.py index 14bd4a59f8f4..4bcfad6e486e 100644 --- a/packages/google-area120-tables/noxfile.py +++ b/packages/google-area120-tables/noxfile.py @@ -47,7 +47,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-area120-tables" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-area120-tables/setup.py b/packages/google-area120-tables/setup.py index 633e018a1a86..033db87198aa 100644 --- a/packages/google-area120-tables/setup.py +++ b/packages/google-area120-tables/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/google-area120-tables/testing/constraints-3.10.txt b/packages/google-area120-tables/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-area120-tables/testing/constraints-3.10.txt +++ b/packages/google-area120-tables/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-area120-tables/tests/unit/gapic/tables_v1alpha1/test_tables_service.py b/packages/google-area120-tables/tests/unit/gapic/tables_v1alpha1/test_tables_service.py index 22a964085a5c..9645104fc34f 100644 --- a/packages/google-area120-tables/tests/unit/gapic/tables_v1alpha1/test_tables_service.py +++ b/packages/google-area120-tables/tests/unit/gapic/tables_v1alpha1/test_tables_service.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 @@ -109,6 +110,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" @@ -1315,8 +1331,8 @@ def test_tables_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - tables.GetTableRequest, - dict, + tables.GetTableRequest(), + {}, ], ) def test_get_table(request_type, transport: str = "grpc"): @@ -1327,7 +1343,7 @@ def test_get_table(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_table), "__call__") as call: @@ -1373,9 +1389,10 @@ def test_get_table_non_empty_request_with_auto_populated_field(): client.get_table(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tables.GetTableRequest( + request_msg = tables.GetTableRequest( name="name_value", ) + assert args[0] == request_msg def test_get_table_use_cached_wrapped_rpc(): @@ -1454,9 +1471,14 @@ async def test_get_table_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_table_async( - transport: str = "grpc_asyncio", request_type=tables.GetTableRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tables.GetTableRequest(), + {}, + ], +) +async def test_get_table_async(request_type, transport: str = "grpc_asyncio"): client = TablesServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1464,7 +1486,7 @@ async def test_get_table_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_table), "__call__") as call: @@ -1489,11 +1511,6 @@ async def test_get_table_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_get_table_async_from_dict(): - await test_get_table_async(request_type=dict) - - def test_get_table_field_headers(): client = TablesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1636,8 +1653,8 @@ async def test_get_table_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - tables.ListTablesRequest, - dict, + tables.ListTablesRequest(), + {}, ], ) def test_list_tables(request_type, transport: str = "grpc"): @@ -1648,7 +1665,7 @@ def test_list_tables(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tables), "__call__") as call: @@ -1692,9 +1709,10 @@ def test_list_tables_non_empty_request_with_auto_populated_field(): client.list_tables(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tables.ListTablesRequest( + request_msg = tables.ListTablesRequest( page_token="page_token_value", ) + assert args[0] == request_msg def test_list_tables_use_cached_wrapped_rpc(): @@ -1775,9 +1793,14 @@ async def test_list_tables_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_tables_async( - transport: str = "grpc_asyncio", request_type=tables.ListTablesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tables.ListTablesRequest(), + {}, + ], +) +async def test_list_tables_async(request_type, transport: str = "grpc_asyncio"): client = TablesServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1785,7 +1808,7 @@ async def test_list_tables_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_tables), "__call__") as call: @@ -1808,11 +1831,6 @@ async def test_list_tables_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_tables_async_from_dict(): - await test_list_tables_async(request_type=dict) - - def test_list_tables_pager(transport_name: str = "grpc"): client = TablesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2003,8 +2021,8 @@ async def test_list_tables_async_pages(): @pytest.mark.parametrize( "request_type", [ - tables.GetWorkspaceRequest, - dict, + tables.GetWorkspaceRequest(), + {}, ], ) def test_get_workspace(request_type, transport: str = "grpc"): @@ -2015,7 +2033,7 @@ def test_get_workspace(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_workspace), "__call__") as call: @@ -2061,9 +2079,10 @@ def test_get_workspace_non_empty_request_with_auto_populated_field(): client.get_workspace(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tables.GetWorkspaceRequest( + request_msg = tables.GetWorkspaceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_workspace_use_cached_wrapped_rpc(): @@ -2144,9 +2163,14 @@ async def test_get_workspace_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_workspace_async( - transport: str = "grpc_asyncio", request_type=tables.GetWorkspaceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tables.GetWorkspaceRequest(), + {}, + ], +) +async def test_get_workspace_async(request_type, transport: str = "grpc_asyncio"): client = TablesServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2154,7 +2178,7 @@ async def test_get_workspace_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_workspace), "__call__") as call: @@ -2179,11 +2203,6 @@ async def test_get_workspace_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_get_workspace_async_from_dict(): - await test_get_workspace_async(request_type=dict) - - def test_get_workspace_field_headers(): client = TablesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2326,8 +2345,8 @@ async def test_get_workspace_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - tables.ListWorkspacesRequest, - dict, + tables.ListWorkspacesRequest(), + {}, ], ) def test_list_workspaces(request_type, transport: str = "grpc"): @@ -2338,7 +2357,7 @@ def test_list_workspaces(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_workspaces), "__call__") as call: @@ -2382,9 +2401,10 @@ def test_list_workspaces_non_empty_request_with_auto_populated_field(): client.list_workspaces(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tables.ListWorkspacesRequest( + request_msg = tables.ListWorkspacesRequest( page_token="page_token_value", ) + assert args[0] == request_msg def test_list_workspaces_use_cached_wrapped_rpc(): @@ -2465,9 +2485,14 @@ async def test_list_workspaces_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_workspaces_async( - transport: str = "grpc_asyncio", request_type=tables.ListWorkspacesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tables.ListWorkspacesRequest(), + {}, + ], +) +async def test_list_workspaces_async(request_type, transport: str = "grpc_asyncio"): client = TablesServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2475,7 +2500,7 @@ async def test_list_workspaces_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_workspaces), "__call__") as call: @@ -2498,11 +2523,6 @@ async def test_list_workspaces_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_workspaces_async_from_dict(): - await test_list_workspaces_async(request_type=dict) - - def test_list_workspaces_pager(transport_name: str = "grpc"): client = TablesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2693,8 +2713,8 @@ async def test_list_workspaces_async_pages(): @pytest.mark.parametrize( "request_type", [ - tables.GetRowRequest, - dict, + tables.GetRowRequest(), + {}, ], ) def test_get_row(request_type, transport: str = "grpc"): @@ -2705,7 +2725,7 @@ def test_get_row(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_row), "__call__") as call: @@ -2749,9 +2769,10 @@ def test_get_row_non_empty_request_with_auto_populated_field(): client.get_row(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tables.GetRowRequest( + request_msg = tables.GetRowRequest( name="name_value", ) + assert args[0] == request_msg def test_get_row_use_cached_wrapped_rpc(): @@ -2830,9 +2851,14 @@ async def test_get_row_async_use_cached_wrapped_rpc(transport: str = "grpc_async @pytest.mark.asyncio -async def test_get_row_async( - transport: str = "grpc_asyncio", request_type=tables.GetRowRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tables.GetRowRequest(), + {}, + ], +) +async def test_get_row_async(request_type, transport: str = "grpc_asyncio"): client = TablesServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2840,7 +2866,7 @@ async def test_get_row_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_row), "__call__") as call: @@ -2863,11 +2889,6 @@ async def test_get_row_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_row_async_from_dict(): - await test_get_row_async(request_type=dict) - - def test_get_row_field_headers(): client = TablesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3010,8 +3031,8 @@ async def test_get_row_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - tables.ListRowsRequest, - dict, + tables.ListRowsRequest(), + {}, ], ) def test_list_rows(request_type, transport: str = "grpc"): @@ -3022,7 +3043,7 @@ def test_list_rows(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_rows), "__call__") as call: @@ -3068,11 +3089,12 @@ def test_list_rows_non_empty_request_with_auto_populated_field(): client.list_rows(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tables.ListRowsRequest( + request_msg = tables.ListRowsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_rows_use_cached_wrapped_rpc(): @@ -3151,9 +3173,14 @@ async def test_list_rows_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_list_rows_async( - transport: str = "grpc_asyncio", request_type=tables.ListRowsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tables.ListRowsRequest(), + {}, + ], +) +async def test_list_rows_async(request_type, transport: str = "grpc_asyncio"): client = TablesServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3161,7 +3188,7 @@ async def test_list_rows_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_rows), "__call__") as call: @@ -3184,11 +3211,6 @@ async def test_list_rows_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_rows_async_from_dict(): - await test_list_rows_async(request_type=dict) - - def test_list_rows_field_headers(): client = TablesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3525,8 +3547,8 @@ async def test_list_rows_async_pages(): @pytest.mark.parametrize( "request_type", [ - tables.CreateRowRequest, - dict, + tables.CreateRowRequest(), + {}, ], ) def test_create_row(request_type, transport: str = "grpc"): @@ -3537,7 +3559,7 @@ def test_create_row(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_row), "__call__") as call: @@ -3581,9 +3603,10 @@ def test_create_row_non_empty_request_with_auto_populated_field(): client.create_row(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tables.CreateRowRequest( + request_msg = tables.CreateRowRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_row_use_cached_wrapped_rpc(): @@ -3662,9 +3685,14 @@ async def test_create_row_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_create_row_async( - transport: str = "grpc_asyncio", request_type=tables.CreateRowRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tables.CreateRowRequest(), + {}, + ], +) +async def test_create_row_async(request_type, transport: str = "grpc_asyncio"): client = TablesServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3672,7 +3700,7 @@ async def test_create_row_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_row), "__call__") as call: @@ -3695,11 +3723,6 @@ async def test_create_row_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_create_row_async_from_dict(): - await test_create_row_async(request_type=dict) - - def test_create_row_field_headers(): client = TablesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3852,8 +3875,8 @@ async def test_create_row_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - tables.BatchCreateRowsRequest, - dict, + tables.BatchCreateRowsRequest(), + {}, ], ) def test_batch_create_rows(request_type, transport: str = "grpc"): @@ -3864,7 +3887,7 @@ def test_batch_create_rows(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3909,9 +3932,10 @@ def test_batch_create_rows_non_empty_request_with_auto_populated_field(): client.batch_create_rows(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tables.BatchCreateRowsRequest( + request_msg = tables.BatchCreateRowsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_batch_create_rows_use_cached_wrapped_rpc(): @@ -3994,9 +4018,14 @@ async def test_batch_create_rows_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_batch_create_rows_async( - transport: str = "grpc_asyncio", request_type=tables.BatchCreateRowsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tables.BatchCreateRowsRequest(), + {}, + ], +) +async def test_batch_create_rows_async(request_type, transport: str = "grpc_asyncio"): client = TablesServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4004,7 +4033,7 @@ async def test_batch_create_rows_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( @@ -4026,11 +4055,6 @@ async def test_batch_create_rows_async( assert isinstance(response, tables.BatchCreateRowsResponse) -@pytest.mark.asyncio -async def test_batch_create_rows_async_from_dict(): - await test_batch_create_rows_async(request_type=dict) - - def test_batch_create_rows_field_headers(): client = TablesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4099,8 +4123,8 @@ async def test_batch_create_rows_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - tables.UpdateRowRequest, - dict, + tables.UpdateRowRequest(), + {}, ], ) def test_update_row(request_type, transport: str = "grpc"): @@ -4111,7 +4135,7 @@ def test_update_row(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_row), "__call__") as call: @@ -4153,7 +4177,8 @@ def test_update_row_non_empty_request_with_auto_populated_field(): client.update_row(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tables.UpdateRowRequest() + request_msg = tables.UpdateRowRequest() + assert args[0] == request_msg def test_update_row_use_cached_wrapped_rpc(): @@ -4232,9 +4257,14 @@ async def test_update_row_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_update_row_async( - transport: str = "grpc_asyncio", request_type=tables.UpdateRowRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tables.UpdateRowRequest(), + {}, + ], +) +async def test_update_row_async(request_type, transport: str = "grpc_asyncio"): client = TablesServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4242,7 +4272,7 @@ async def test_update_row_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_row), "__call__") as call: @@ -4265,11 +4295,6 @@ async def test_update_row_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_update_row_async_from_dict(): - await test_update_row_async(request_type=dict) - - def test_update_row_field_headers(): client = TablesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4422,8 +4447,8 @@ async def test_update_row_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - tables.BatchUpdateRowsRequest, - dict, + tables.BatchUpdateRowsRequest(), + {}, ], ) def test_batch_update_rows(request_type, transport: str = "grpc"): @@ -4434,7 +4459,7 @@ def test_batch_update_rows(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4479,9 +4504,10 @@ def test_batch_update_rows_non_empty_request_with_auto_populated_field(): client.batch_update_rows(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tables.BatchUpdateRowsRequest( + request_msg = tables.BatchUpdateRowsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_batch_update_rows_use_cached_wrapped_rpc(): @@ -4564,9 +4590,14 @@ async def test_batch_update_rows_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_batch_update_rows_async( - transport: str = "grpc_asyncio", request_type=tables.BatchUpdateRowsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tables.BatchUpdateRowsRequest(), + {}, + ], +) +async def test_batch_update_rows_async(request_type, transport: str = "grpc_asyncio"): client = TablesServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4574,7 +4605,7 @@ async def test_batch_update_rows_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( @@ -4596,11 +4627,6 @@ async def test_batch_update_rows_async( assert isinstance(response, tables.BatchUpdateRowsResponse) -@pytest.mark.asyncio -async def test_batch_update_rows_async_from_dict(): - await test_batch_update_rows_async(request_type=dict) - - def test_batch_update_rows_field_headers(): client = TablesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4669,8 +4695,8 @@ async def test_batch_update_rows_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - tables.DeleteRowRequest, - dict, + tables.DeleteRowRequest(), + {}, ], ) def test_delete_row(request_type, transport: str = "grpc"): @@ -4681,7 +4707,7 @@ def test_delete_row(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_row), "__call__") as call: @@ -4722,9 +4748,10 @@ def test_delete_row_non_empty_request_with_auto_populated_field(): client.delete_row(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tables.DeleteRowRequest( + request_msg = tables.DeleteRowRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_row_use_cached_wrapped_rpc(): @@ -4803,9 +4830,14 @@ async def test_delete_row_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_delete_row_async( - transport: str = "grpc_asyncio", request_type=tables.DeleteRowRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tables.DeleteRowRequest(), + {}, + ], +) +async def test_delete_row_async(request_type, transport: str = "grpc_asyncio"): client = TablesServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4813,7 +4845,7 @@ async def test_delete_row_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_row), "__call__") as call: @@ -4831,11 +4863,6 @@ async def test_delete_row_async( assert response is None -@pytest.mark.asyncio -async def test_delete_row_async_from_dict(): - await test_delete_row_async(request_type=dict) - - def test_delete_row_field_headers(): client = TablesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4978,8 +5005,8 @@ async def test_delete_row_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - tables.BatchDeleteRowsRequest, - dict, + tables.BatchDeleteRowsRequest(), + {}, ], ) def test_batch_delete_rows(request_type, transport: str = "grpc"): @@ -4990,7 +5017,7 @@ def test_batch_delete_rows(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5035,9 +5062,10 @@ def test_batch_delete_rows_non_empty_request_with_auto_populated_field(): client.batch_delete_rows(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tables.BatchDeleteRowsRequest( + request_msg = tables.BatchDeleteRowsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_batch_delete_rows_use_cached_wrapped_rpc(): @@ -5120,9 +5148,14 @@ async def test_batch_delete_rows_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_batch_delete_rows_async( - transport: str = "grpc_asyncio", request_type=tables.BatchDeleteRowsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tables.BatchDeleteRowsRequest(), + {}, + ], +) +async def test_batch_delete_rows_async(request_type, transport: str = "grpc_asyncio"): client = TablesServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5130,7 +5163,7 @@ async def test_batch_delete_rows_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( @@ -5150,11 +5183,6 @@ async def test_batch_delete_rows_async( assert response is None -@pytest.mark.asyncio -async def test_batch_delete_rows_async_from_dict(): - await test_batch_delete_rows_async(request_type=dict) - - def test_batch_delete_rows_field_headers(): client = TablesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7250,7 +7278,6 @@ def test_get_table_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tables.GetTableRequest() - assert args[0] == request_msg @@ -7271,7 +7298,6 @@ def test_list_tables_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tables.ListTablesRequest() - assert args[0] == request_msg @@ -7292,7 +7318,6 @@ def test_get_workspace_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tables.GetWorkspaceRequest() - assert args[0] == request_msg @@ -7313,7 +7338,6 @@ def test_list_workspaces_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tables.ListWorkspacesRequest() - assert args[0] == request_msg @@ -7334,7 +7358,6 @@ def test_get_row_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tables.GetRowRequest() - assert args[0] == request_msg @@ -7355,7 +7378,6 @@ def test_list_rows_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tables.ListRowsRequest() - assert args[0] == request_msg @@ -7376,7 +7398,6 @@ def test_create_row_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tables.CreateRowRequest() - assert args[0] == request_msg @@ -7399,7 +7420,6 @@ def test_batch_create_rows_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tables.BatchCreateRowsRequest() - assert args[0] == request_msg @@ -7420,7 +7440,6 @@ def test_update_row_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tables.UpdateRowRequest() - assert args[0] == request_msg @@ -7443,7 +7462,6 @@ def test_batch_update_rows_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tables.BatchUpdateRowsRequest() - assert args[0] == request_msg @@ -7464,7 +7482,6 @@ def test_delete_row_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tables.DeleteRowRequest() - assert args[0] == request_msg @@ -7487,7 +7504,6 @@ def test_batch_delete_rows_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tables.BatchDeleteRowsRequest() - assert args[0] == request_msg @@ -7529,7 +7545,6 @@ async def test_get_table_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tables.GetTableRequest() - assert args[0] == request_msg @@ -7556,7 +7571,6 @@ async def test_list_tables_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tables.ListTablesRequest() - assert args[0] == request_msg @@ -7584,7 +7598,6 @@ async def test_get_workspace_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tables.GetWorkspaceRequest() - assert args[0] == request_msg @@ -7611,7 +7624,6 @@ async def test_list_workspaces_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tables.ListWorkspacesRequest() - assert args[0] == request_msg @@ -7638,7 +7650,6 @@ async def test_get_row_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tables.GetRowRequest() - assert args[0] == request_msg @@ -7665,7 +7676,6 @@ async def test_list_rows_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tables.ListRowsRequest() - assert args[0] == request_msg @@ -7692,7 +7702,6 @@ async def test_create_row_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tables.CreateRowRequest() - assert args[0] == request_msg @@ -7719,7 +7728,6 @@ async def test_batch_create_rows_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tables.BatchCreateRowsRequest() - assert args[0] == request_msg @@ -7746,7 +7754,6 @@ async def test_update_row_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tables.UpdateRowRequest() - assert args[0] == request_msg @@ -7773,7 +7780,6 @@ async def test_batch_update_rows_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tables.BatchUpdateRowsRequest() - assert args[0] == request_msg @@ -7796,7 +7802,6 @@ async def test_delete_row_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tables.DeleteRowRequest() - assert args[0] == request_msg @@ -7821,7 +7826,6 @@ async def test_batch_delete_rows_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tables.BatchDeleteRowsRequest() - assert args[0] == request_msg @@ -9470,7 +9474,6 @@ def test_get_table_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tables.GetTableRequest() - assert args[0] == request_msg @@ -9490,7 +9493,6 @@ def test_list_tables_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tables.ListTablesRequest() - assert args[0] == request_msg @@ -9510,7 +9512,6 @@ def test_get_workspace_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tables.GetWorkspaceRequest() - assert args[0] == request_msg @@ -9530,7 +9531,6 @@ def test_list_workspaces_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tables.ListWorkspacesRequest() - assert args[0] == request_msg @@ -9550,7 +9550,6 @@ def test_get_row_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tables.GetRowRequest() - assert args[0] == request_msg @@ -9570,7 +9569,6 @@ def test_list_rows_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tables.ListRowsRequest() - assert args[0] == request_msg @@ -9590,7 +9588,6 @@ def test_create_row_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tables.CreateRowRequest() - assert args[0] == request_msg @@ -9612,7 +9609,6 @@ def test_batch_create_rows_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tables.BatchCreateRowsRequest() - assert args[0] == request_msg @@ -9632,7 +9628,6 @@ def test_update_row_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tables.UpdateRowRequest() - assert args[0] == request_msg @@ -9654,7 +9649,6 @@ def test_batch_update_rows_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tables.BatchUpdateRowsRequest() - assert args[0] == request_msg @@ -9674,7 +9668,6 @@ def test_delete_row_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tables.DeleteRowRequest() - assert args[0] == request_msg @@ -9696,7 +9689,6 @@ def test_batch_delete_rows_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tables.BatchDeleteRowsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-access-approval/noxfile.py b/packages/google-cloud-access-approval/noxfile.py index 3e13b85a4309..82e2a49f059d 100644 --- a/packages/google-cloud-access-approval/noxfile.py +++ b/packages/google-cloud-access-approval/noxfile.py @@ -47,7 +47,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-access-approval" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-access-approval/setup.py b/packages/google-cloud-access-approval/setup.py index cfe01a0a864d..7da5c9780181 100644 --- a/packages/google-cloud-access-approval/setup.py +++ b/packages/google-cloud-access-approval/setup.py @@ -45,7 +45,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/google-cloud-access-approval/testing/constraints-3.10.txt b/packages/google-cloud-access-approval/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-access-approval/testing/constraints-3.10.txt +++ b/packages/google-cloud-access-approval/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-access-approval/tests/unit/gapic/accessapproval_v1/test_access_approval.py b/packages/google-cloud-access-approval/tests/unit/gapic/accessapproval_v1/test_access_approval.py index 0d964d13f875..43c633e45e69 100644 --- a/packages/google-cloud-access-approval/tests/unit/gapic/accessapproval_v1/test_access_approval.py +++ b/packages/google-cloud-access-approval/tests/unit/gapic/accessapproval_v1/test_access_approval.py @@ -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 @@ -109,6 +110,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" @@ -1312,8 +1328,8 @@ def test_access_approval_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - accessapproval.ListApprovalRequestsMessage, - dict, + accessapproval.ListApprovalRequestsMessage(), + {}, ], ) def test_list_approval_requests(request_type, transport: str = "grpc"): @@ -1324,7 +1340,7 @@ def test_list_approval_requests(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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 +1390,12 @@ def test_list_approval_requests_non_empty_request_with_auto_populated_field(): client.list_approval_requests(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == accessapproval.ListApprovalRequestsMessage( + request_msg = accessapproval.ListApprovalRequestsMessage( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_approval_requests_use_cached_wrapped_rpc(): @@ -1464,9 +1481,15 @@ async def test_list_approval_requests_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + accessapproval.ListApprovalRequestsMessage(), + {}, + ], +) async def test_list_approval_requests_async( - transport: str = "grpc_asyncio", - request_type=accessapproval.ListApprovalRequestsMessage, + request_type, transport: str = "grpc_asyncio" ): client = AccessApprovalAsyncClient( credentials=async_anonymous_credentials(), @@ -1475,7 +1498,7 @@ async def test_list_approval_requests_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( @@ -1500,11 +1523,6 @@ async def test_list_approval_requests_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_approval_requests_async_from_dict(): - await test_list_approval_requests_async(request_type=dict) - - def test_list_approval_requests_field_headers(): client = AccessApprovalClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1857,8 +1875,8 @@ async def test_list_approval_requests_async_pages(): @pytest.mark.parametrize( "request_type", [ - accessapproval.GetApprovalRequestMessage, - dict, + accessapproval.GetApprovalRequestMessage(), + {}, ], ) def test_get_approval_request(request_type, transport: str = "grpc"): @@ -1869,7 +1887,7 @@ def test_get_approval_request(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1919,9 +1937,10 @@ def test_get_approval_request_non_empty_request_with_auto_populated_field(): client.get_approval_request(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == accessapproval.GetApprovalRequestMessage( + request_msg = accessapproval.GetApprovalRequestMessage( name="name_value", ) + assert args[0] == request_msg def test_get_approval_request_use_cached_wrapped_rpc(): @@ -2006,9 +2025,15 @@ async def test_get_approval_request_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + accessapproval.GetApprovalRequestMessage(), + {}, + ], +) async def test_get_approval_request_async( - transport: str = "grpc_asyncio", - request_type=accessapproval.GetApprovalRequestMessage, + request_type, transport: str = "grpc_asyncio" ): client = AccessApprovalAsyncClient( credentials=async_anonymous_credentials(), @@ -2017,7 +2042,7 @@ async def test_get_approval_request_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( @@ -2044,11 +2069,6 @@ async def test_get_approval_request_async( assert response.requested_resource_name == "requested_resource_name_value" -@pytest.mark.asyncio -async def test_get_approval_request_async_from_dict(): - await test_get_approval_request_async(request_type=dict) - - def test_get_approval_request_field_headers(): client = AccessApprovalClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2203,8 +2223,8 @@ async def test_get_approval_request_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - accessapproval.ApproveApprovalRequestMessage, - dict, + accessapproval.ApproveApprovalRequestMessage(), + {}, ], ) def test_approve_approval_request(request_type, transport: str = "grpc"): @@ -2215,7 +2235,7 @@ def test_approve_approval_request(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2265,9 +2285,10 @@ def test_approve_approval_request_non_empty_request_with_auto_populated_field(): client.approve_approval_request(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == accessapproval.ApproveApprovalRequestMessage( + request_msg = accessapproval.ApproveApprovalRequestMessage( name="name_value", ) + assert args[0] == request_msg def test_approve_approval_request_use_cached_wrapped_rpc(): @@ -2353,9 +2374,15 @@ async def test_approve_approval_request_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + accessapproval.ApproveApprovalRequestMessage(), + {}, + ], +) async def test_approve_approval_request_async( - transport: str = "grpc_asyncio", - request_type=accessapproval.ApproveApprovalRequestMessage, + request_type, transport: str = "grpc_asyncio" ): client = AccessApprovalAsyncClient( credentials=async_anonymous_credentials(), @@ -2364,7 +2391,7 @@ async def test_approve_approval_request_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( @@ -2391,11 +2418,6 @@ async def test_approve_approval_request_async( assert response.requested_resource_name == "requested_resource_name_value" -@pytest.mark.asyncio -async def test_approve_approval_request_async_from_dict(): - await test_approve_approval_request_async(request_type=dict) - - def test_approve_approval_request_field_headers(): client = AccessApprovalClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2464,8 +2486,8 @@ async def test_approve_approval_request_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - accessapproval.DismissApprovalRequestMessage, - dict, + accessapproval.DismissApprovalRequestMessage(), + {}, ], ) def test_dismiss_approval_request(request_type, transport: str = "grpc"): @@ -2476,7 +2498,7 @@ def test_dismiss_approval_request(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2526,9 +2548,10 @@ def test_dismiss_approval_request_non_empty_request_with_auto_populated_field(): client.dismiss_approval_request(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == accessapproval.DismissApprovalRequestMessage( + request_msg = accessapproval.DismissApprovalRequestMessage( name="name_value", ) + assert args[0] == request_msg def test_dismiss_approval_request_use_cached_wrapped_rpc(): @@ -2614,9 +2637,15 @@ async def test_dismiss_approval_request_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + accessapproval.DismissApprovalRequestMessage(), + {}, + ], +) async def test_dismiss_approval_request_async( - transport: str = "grpc_asyncio", - request_type=accessapproval.DismissApprovalRequestMessage, + request_type, transport: str = "grpc_asyncio" ): client = AccessApprovalAsyncClient( credentials=async_anonymous_credentials(), @@ -2625,7 +2654,7 @@ async def test_dismiss_approval_request_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( @@ -2652,11 +2681,6 @@ async def test_dismiss_approval_request_async( assert response.requested_resource_name == "requested_resource_name_value" -@pytest.mark.asyncio -async def test_dismiss_approval_request_async_from_dict(): - await test_dismiss_approval_request_async(request_type=dict) - - def test_dismiss_approval_request_field_headers(): client = AccessApprovalClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2725,8 +2749,8 @@ async def test_dismiss_approval_request_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - accessapproval.InvalidateApprovalRequestMessage, - dict, + accessapproval.InvalidateApprovalRequestMessage(), + {}, ], ) def test_invalidate_approval_request(request_type, transport: str = "grpc"): @@ -2737,7 +2761,7 @@ def test_invalidate_approval_request(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2787,9 +2811,10 @@ def test_invalidate_approval_request_non_empty_request_with_auto_populated_field client.invalidate_approval_request(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == accessapproval.InvalidateApprovalRequestMessage( + request_msg = accessapproval.InvalidateApprovalRequestMessage( name="name_value", ) + assert args[0] == request_msg def test_invalidate_approval_request_use_cached_wrapped_rpc(): @@ -2875,9 +2900,15 @@ async def test_invalidate_approval_request_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + accessapproval.InvalidateApprovalRequestMessage(), + {}, + ], +) async def test_invalidate_approval_request_async( - transport: str = "grpc_asyncio", - request_type=accessapproval.InvalidateApprovalRequestMessage, + request_type, transport: str = "grpc_asyncio" ): client = AccessApprovalAsyncClient( credentials=async_anonymous_credentials(), @@ -2886,7 +2917,7 @@ async def test_invalidate_approval_request_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( @@ -2913,11 +2944,6 @@ async def test_invalidate_approval_request_async( assert response.requested_resource_name == "requested_resource_name_value" -@pytest.mark.asyncio -async def test_invalidate_approval_request_async_from_dict(): - await test_invalidate_approval_request_async(request_type=dict) - - def test_invalidate_approval_request_field_headers(): client = AccessApprovalClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2986,8 +3012,8 @@ async def test_invalidate_approval_request_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - accessapproval.GetAccessApprovalSettingsMessage, - dict, + accessapproval.GetAccessApprovalSettingsMessage(), + {}, ], ) def test_get_access_approval_settings(request_type, transport: str = "grpc"): @@ -2998,7 +3024,7 @@ def test_get_access_approval_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( @@ -3056,9 +3082,10 @@ def test_get_access_approval_settings_non_empty_request_with_auto_populated_fiel client.get_access_approval_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == accessapproval.GetAccessApprovalSettingsMessage( + request_msg = accessapproval.GetAccessApprovalSettingsMessage( name="name_value", ) + assert args[0] == request_msg def test_get_access_approval_settings_use_cached_wrapped_rpc(): @@ -3144,9 +3171,15 @@ async def test_get_access_approval_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + accessapproval.GetAccessApprovalSettingsMessage(), + {}, + ], +) async def test_get_access_approval_settings_async( - transport: str = "grpc_asyncio", - request_type=accessapproval.GetAccessApprovalSettingsMessage, + request_type, transport: str = "grpc_asyncio" ): client = AccessApprovalAsyncClient( credentials=async_anonymous_credentials(), @@ -3155,7 +3188,7 @@ async def test_get_access_approval_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( @@ -3190,11 +3223,6 @@ async def test_get_access_approval_settings_async( assert response.invalid_key_version is True -@pytest.mark.asyncio -async def test_get_access_approval_settings_async_from_dict(): - await test_get_access_approval_settings_async(request_type=dict) - - def test_get_access_approval_settings_field_headers(): client = AccessApprovalClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3349,8 +3377,8 @@ async def test_get_access_approval_settings_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - accessapproval.UpdateAccessApprovalSettingsMessage, - dict, + accessapproval.UpdateAccessApprovalSettingsMessage(), + {}, ], ) def test_update_access_approval_settings(request_type, transport: str = "grpc"): @@ -3361,7 +3389,7 @@ def test_update_access_approval_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( @@ -3417,7 +3445,8 @@ def test_update_access_approval_settings_non_empty_request_with_auto_populated_f client.update_access_approval_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == accessapproval.UpdateAccessApprovalSettingsMessage() + request_msg = accessapproval.UpdateAccessApprovalSettingsMessage() + assert args[0] == request_msg def test_update_access_approval_settings_use_cached_wrapped_rpc(): @@ -3503,9 +3532,15 @@ async def test_update_access_approval_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + accessapproval.UpdateAccessApprovalSettingsMessage(), + {}, + ], +) async def test_update_access_approval_settings_async( - transport: str = "grpc_asyncio", - request_type=accessapproval.UpdateAccessApprovalSettingsMessage, + request_type, transport: str = "grpc_asyncio" ): client = AccessApprovalAsyncClient( credentials=async_anonymous_credentials(), @@ -3514,7 +3549,7 @@ async def test_update_access_approval_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( @@ -3549,11 +3584,6 @@ async def test_update_access_approval_settings_async( assert response.invalid_key_version is True -@pytest.mark.asyncio -async def test_update_access_approval_settings_async_from_dict(): - await test_update_access_approval_settings_async(request_type=dict) - - def test_update_access_approval_settings_field_headers(): client = AccessApprovalClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3718,8 +3748,8 @@ async def test_update_access_approval_settings_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - accessapproval.DeleteAccessApprovalSettingsMessage, - dict, + accessapproval.DeleteAccessApprovalSettingsMessage(), + {}, ], ) def test_delete_access_approval_settings(request_type, transport: str = "grpc"): @@ -3730,7 +3760,7 @@ def test_delete_access_approval_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( @@ -3775,9 +3805,10 @@ def test_delete_access_approval_settings_non_empty_request_with_auto_populated_f client.delete_access_approval_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == accessapproval.DeleteAccessApprovalSettingsMessage( + request_msg = accessapproval.DeleteAccessApprovalSettingsMessage( name="name_value", ) + assert args[0] == request_msg def test_delete_access_approval_settings_use_cached_wrapped_rpc(): @@ -3863,9 +3894,15 @@ async def test_delete_access_approval_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + accessapproval.DeleteAccessApprovalSettingsMessage(), + {}, + ], +) async def test_delete_access_approval_settings_async( - transport: str = "grpc_asyncio", - request_type=accessapproval.DeleteAccessApprovalSettingsMessage, + request_type, transport: str = "grpc_asyncio" ): client = AccessApprovalAsyncClient( credentials=async_anonymous_credentials(), @@ -3874,7 +3911,7 @@ async def test_delete_access_approval_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( @@ -3894,11 +3931,6 @@ async def test_delete_access_approval_settings_async( assert response is None -@pytest.mark.asyncio -async def test_delete_access_approval_settings_async_from_dict(): - await test_delete_access_approval_settings_async(request_type=dict) - - def test_delete_access_approval_settings_field_headers(): client = AccessApprovalClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4049,8 +4081,8 @@ async def test_delete_access_approval_settings_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - accessapproval.GetAccessApprovalServiceAccountMessage, - dict, + accessapproval.GetAccessApprovalServiceAccountMessage(), + {}, ], ) def test_get_access_approval_service_account(request_type, transport: str = "grpc"): @@ -4061,7 +4093,7 @@ def test_get_access_approval_service_account(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( @@ -4111,9 +4143,10 @@ def test_get_access_approval_service_account_non_empty_request_with_auto_populat client.get_access_approval_service_account(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == accessapproval.GetAccessApprovalServiceAccountMessage( + request_msg = accessapproval.GetAccessApprovalServiceAccountMessage( name="name_value", ) + assert args[0] == request_msg def test_get_access_approval_service_account_use_cached_wrapped_rpc(): @@ -4199,9 +4232,15 @@ async def test_get_access_approval_service_account_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + accessapproval.GetAccessApprovalServiceAccountMessage(), + {}, + ], +) async def test_get_access_approval_service_account_async( - transport: str = "grpc_asyncio", - request_type=accessapproval.GetAccessApprovalServiceAccountMessage, + request_type, transport: str = "grpc_asyncio" ): client = AccessApprovalAsyncClient( credentials=async_anonymous_credentials(), @@ -4210,7 +4249,7 @@ async def test_get_access_approval_service_account_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( @@ -4237,11 +4276,6 @@ async def test_get_access_approval_service_account_async( assert response.account_email == "account_email_value" -@pytest.mark.asyncio -async def test_get_access_approval_service_account_async_from_dict(): - await test_get_access_approval_service_account_async(request_type=dict) - - def test_get_access_approval_service_account_field_headers(): client = AccessApprovalClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5295,7 +5329,6 @@ def test_list_approval_requests_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accessapproval.ListApprovalRequestsMessage() - assert args[0] == request_msg @@ -5318,7 +5351,6 @@ def test_get_approval_request_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accessapproval.GetApprovalRequestMessage() - assert args[0] == request_msg @@ -5341,7 +5373,6 @@ def test_approve_approval_request_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accessapproval.ApproveApprovalRequestMessage() - assert args[0] == request_msg @@ -5364,7 +5395,6 @@ def test_dismiss_approval_request_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accessapproval.DismissApprovalRequestMessage() - assert args[0] == request_msg @@ -5387,7 +5417,6 @@ def test_invalidate_approval_request_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accessapproval.InvalidateApprovalRequestMessage() - assert args[0] == request_msg @@ -5410,7 +5439,6 @@ def test_get_access_approval_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accessapproval.GetAccessApprovalSettingsMessage() - assert args[0] == request_msg @@ -5433,7 +5461,6 @@ def test_update_access_approval_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accessapproval.UpdateAccessApprovalSettingsMessage() - assert args[0] == request_msg @@ -5456,7 +5483,6 @@ def test_delete_access_approval_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accessapproval.DeleteAccessApprovalSettingsMessage() - assert args[0] == request_msg @@ -5479,7 +5505,6 @@ def test_get_access_approval_service_account_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accessapproval.GetAccessApprovalServiceAccountMessage() - assert args[0] == request_msg @@ -5522,7 +5547,6 @@ async def test_list_approval_requests_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accessapproval.ListApprovalRequestsMessage() - assert args[0] == request_msg @@ -5552,7 +5576,6 @@ async def test_get_approval_request_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accessapproval.GetApprovalRequestMessage() - assert args[0] == request_msg @@ -5582,7 +5605,6 @@ async def test_approve_approval_request_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accessapproval.ApproveApprovalRequestMessage() - assert args[0] == request_msg @@ -5612,7 +5634,6 @@ async def test_dismiss_approval_request_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accessapproval.DismissApprovalRequestMessage() - assert args[0] == request_msg @@ -5642,7 +5663,6 @@ async def test_invalidate_approval_request_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accessapproval.InvalidateApprovalRequestMessage() - assert args[0] == request_msg @@ -5676,7 +5696,6 @@ async def test_get_access_approval_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accessapproval.GetAccessApprovalSettingsMessage() - assert args[0] == request_msg @@ -5710,7 +5729,6 @@ async def test_update_access_approval_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accessapproval.UpdateAccessApprovalSettingsMessage() - assert args[0] == request_msg @@ -5735,7 +5753,6 @@ async def test_delete_access_approval_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accessapproval.DeleteAccessApprovalSettingsMessage() - assert args[0] == request_msg @@ -5765,7 +5782,6 @@ async def test_get_access_approval_service_account_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accessapproval.GetAccessApprovalServiceAccountMessage() - assert args[0] == request_msg @@ -7106,7 +7122,6 @@ def test_list_approval_requests_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accessapproval.ListApprovalRequestsMessage() - assert args[0] == request_msg @@ -7128,7 +7143,6 @@ def test_get_approval_request_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accessapproval.GetApprovalRequestMessage() - assert args[0] == request_msg @@ -7150,7 +7164,6 @@ def test_approve_approval_request_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accessapproval.ApproveApprovalRequestMessage() - assert args[0] == request_msg @@ -7172,7 +7185,6 @@ def test_dismiss_approval_request_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accessapproval.DismissApprovalRequestMessage() - assert args[0] == request_msg @@ -7194,7 +7206,6 @@ def test_invalidate_approval_request_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accessapproval.InvalidateApprovalRequestMessage() - assert args[0] == request_msg @@ -7216,7 +7227,6 @@ def test_get_access_approval_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accessapproval.GetAccessApprovalSettingsMessage() - assert args[0] == request_msg @@ -7238,7 +7248,6 @@ def test_update_access_approval_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accessapproval.UpdateAccessApprovalSettingsMessage() - assert args[0] == request_msg @@ -7260,7 +7269,6 @@ def test_delete_access_approval_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accessapproval.DeleteAccessApprovalSettingsMessage() - assert args[0] == request_msg @@ -7282,7 +7290,6 @@ def test_get_access_approval_service_account_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accessapproval.GetAccessApprovalServiceAccountMessage() - assert args[0] == request_msg diff --git a/packages/google-cloud-advisorynotifications/noxfile.py b/packages/google-cloud-advisorynotifications/noxfile.py index 06394a25c211..af26b1ac1af3 100644 --- a/packages/google-cloud-advisorynotifications/noxfile.py +++ b/packages/google-cloud-advisorynotifications/noxfile.py @@ -47,7 +47,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-advisorynotifications" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-advisorynotifications/setup.py b/packages/google-cloud-advisorynotifications/setup.py index 69048b7597e7..8d0ca3914c4b 100644 --- a/packages/google-cloud-advisorynotifications/setup.py +++ b/packages/google-cloud-advisorynotifications/setup.py @@ -45,7 +45,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/google-cloud-advisorynotifications/testing/constraints-3.10.txt b/packages/google-cloud-advisorynotifications/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-advisorynotifications/testing/constraints-3.10.txt +++ b/packages/google-cloud-advisorynotifications/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-advisorynotifications/tests/unit/gapic/advisorynotifications_v1/test_advisory_notifications_service.py b/packages/google-cloud-advisorynotifications/tests/unit/gapic/advisorynotifications_v1/test_advisory_notifications_service.py index e5962310d51f..1943e69a832e 100644 --- a/packages/google-cloud-advisorynotifications/tests/unit/gapic/advisorynotifications_v1/test_advisory_notifications_service.py +++ b/packages/google-cloud-advisorynotifications/tests/unit/gapic/advisorynotifications_v1/test_advisory_notifications_service.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 @@ -108,6 +109,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" @@ -1418,8 +1434,8 @@ def test_advisory_notifications_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - service.ListNotificationsRequest, - dict, + service.ListNotificationsRequest(), + {}, ], ) def test_list_notifications(request_type, transport: str = "grpc"): @@ -1430,7 +1446,7 @@ def test_list_notifications(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1482,11 +1498,12 @@ def test_list_notifications_non_empty_request_with_auto_populated_field(): client.list_notifications(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListNotificationsRequest( + request_msg = service.ListNotificationsRequest( parent="parent_value", page_token="page_token_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_list_notifications_use_cached_wrapped_rpc(): @@ -1571,9 +1588,14 @@ async def test_list_notifications_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_notifications_async( - transport: str = "grpc_asyncio", request_type=service.ListNotificationsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListNotificationsRequest(), + {}, + ], +) +async def test_list_notifications_async(request_type, transport: str = "grpc_asyncio"): client = AdvisoryNotificationsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1581,7 +1603,7 @@ async def test_list_notifications_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( @@ -1608,11 +1630,6 @@ async def test_list_notifications_async( assert response.total_size == 1086 -@pytest.mark.asyncio -async def test_list_notifications_async_from_dict(): - await test_list_notifications_async(request_type=dict) - - def test_list_notifications_field_headers(): client = AdvisoryNotificationsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1965,8 +1982,8 @@ async def test_list_notifications_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetNotificationRequest, - dict, + service.GetNotificationRequest(), + {}, ], ) def test_get_notification(request_type, transport: str = "grpc"): @@ -1977,7 +1994,7 @@ def test_get_notification(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_notification), "__call__") as call: @@ -2027,10 +2044,11 @@ def test_get_notification_non_empty_request_with_auto_populated_field(): client.get_notification(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetNotificationRequest( + request_msg = service.GetNotificationRequest( name="name_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_get_notification_use_cached_wrapped_rpc(): @@ -2113,9 +2131,14 @@ async def test_get_notification_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_notification_async( - transport: str = "grpc_asyncio", request_type=service.GetNotificationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetNotificationRequest(), + {}, + ], +) +async def test_get_notification_async(request_type, transport: str = "grpc_asyncio"): client = AdvisoryNotificationsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2123,7 +2146,7 @@ async def test_get_notification_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_notification), "__call__") as call: @@ -2151,11 +2174,6 @@ async def test_get_notification_async( ) -@pytest.mark.asyncio -async def test_get_notification_async_from_dict(): - await test_get_notification_async(request_type=dict) - - def test_get_notification_field_headers(): client = AdvisoryNotificationsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2302,8 +2320,8 @@ async def test_get_notification_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.GetSettingsRequest, - dict, + service.GetSettingsRequest(), + {}, ], ) def test_get_settings(request_type, transport: str = "grpc"): @@ -2314,7 +2332,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: @@ -2360,9 +2378,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] == service.GetSettingsRequest( + request_msg = service.GetSettingsRequest( name="name_value", ) + assert args[0] == request_msg def test_get_settings_use_cached_wrapped_rpc(): @@ -2443,9 +2462,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=service.GetSettingsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetSettingsRequest(), + {}, + ], +) +async def test_get_settings_async(request_type, transport: str = "grpc_asyncio"): client = AdvisoryNotificationsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2453,7 +2477,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: @@ -2478,11 +2502,6 @@ async def test_get_settings_async( assert response.etag == "etag_value" -@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 = AdvisoryNotificationsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2625,8 +2644,8 @@ async def test_get_settings_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdateSettingsRequest, - dict, + service.UpdateSettingsRequest(), + {}, ], ) def test_update_settings(request_type, transport: str = "grpc"): @@ -2637,7 +2656,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: @@ -2681,7 +2700,8 @@ 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] == service.UpdateSettingsRequest() + request_msg = service.UpdateSettingsRequest() + assert args[0] == request_msg def test_update_settings_use_cached_wrapped_rpc(): @@ -2762,9 +2782,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=service.UpdateSettingsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateSettingsRequest(), + {}, + ], +) +async def test_update_settings_async(request_type, transport: str = "grpc_asyncio"): client = AdvisoryNotificationsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2772,7 +2797,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: @@ -2797,11 +2822,6 @@ async def test_update_settings_async( assert response.etag == "etag_value" -@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 = AdvisoryNotificationsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3864,7 +3884,6 @@ def test_list_notifications_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListNotificationsRequest() - assert args[0] == request_msg @@ -3885,7 +3904,6 @@ def test_get_notification_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetNotificationRequest() - assert args[0] == request_msg @@ -3906,7 +3924,6 @@ def test_get_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetSettingsRequest() - assert args[0] == request_msg @@ -3927,7 +3944,6 @@ def test_update_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateSettingsRequest() - assert args[0] == request_msg @@ -3971,7 +3987,6 @@ async def test_list_notifications_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListNotificationsRequest() - assert args[0] == request_msg @@ -3999,7 +4014,6 @@ async def test_get_notification_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetNotificationRequest() - assert args[0] == request_msg @@ -4027,7 +4041,6 @@ async def test_get_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetSettingsRequest() - assert args[0] == request_msg @@ -4055,7 +4068,6 @@ async def test_update_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateSettingsRequest() - assert args[0] == request_msg @@ -4702,7 +4714,6 @@ def test_list_notifications_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListNotificationsRequest() - assert args[0] == request_msg @@ -4722,7 +4733,6 @@ def test_get_notification_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetNotificationRequest() - assert args[0] == request_msg @@ -4742,7 +4752,6 @@ def test_get_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetSettingsRequest() - assert args[0] == request_msg @@ -4762,7 +4771,6 @@ def test_update_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateSettingsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-alloydb-connectors/noxfile.py b/packages/google-cloud-alloydb-connectors/noxfile.py index adf1fb12c8d8..a050f3c1881d 100644 --- a/packages/google-cloud-alloydb-connectors/noxfile.py +++ b/packages/google-cloud-alloydb-connectors/noxfile.py @@ -47,7 +47,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-alloydb-connectors" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-alloydb-connectors/setup.py b/packages/google-cloud-alloydb-connectors/setup.py index a32dd0c22e79..47dc6f396d48 100644 --- a/packages/google-cloud-alloydb-connectors/setup.py +++ b/packages/google-cloud-alloydb-connectors/setup.py @@ -45,7 +45,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/google-cloud-alloydb-connectors/testing/constraints-3.10.txt b/packages/google-cloud-alloydb-connectors/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-alloydb-connectors/testing/constraints-3.10.txt +++ b/packages/google-cloud-alloydb-connectors/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-alloydb/noxfile.py b/packages/google-cloud-alloydb/noxfile.py index 2585d86c1b8a..1f0b150ae2c6 100644 --- a/packages/google-cloud-alloydb/noxfile.py +++ b/packages/google-cloud-alloydb/noxfile.py @@ -47,7 +47,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-alloydb" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-alloydb/setup.py b/packages/google-cloud-alloydb/setup.py index 9fc5f7481d3a..87face2890a5 100644 --- a/packages/google-cloud-alloydb/setup.py +++ b/packages/google-cloud-alloydb/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/google-cloud-alloydb/testing/constraints-3.10.txt b/packages/google-cloud-alloydb/testing/constraints-3.10.txt index a92801e1c8e2..b39cd54634f9 100644 --- a/packages/google-cloud-alloydb/testing/constraints-3.10.txt +++ b/packages/google-cloud-alloydb/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/google-cloud-alloydb/tests/unit/gapic/alloydb_v1/test_alloy_db_admin.py b/packages/google-cloud-alloydb/tests/unit/gapic/alloydb_v1/test_alloy_db_admin.py index 9d9dea962d4e..f86c28e4e6b6 100644 --- a/packages/google-cloud-alloydb/tests/unit/gapic/alloydb_v1/test_alloy_db_admin.py +++ b/packages/google-cloud-alloydb/tests/unit/gapic/alloydb_v1/test_alloy_db_admin.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 @@ -125,6 +126,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" @@ -1305,8 +1321,8 @@ def test_alloy_db_admin_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - service.ListClustersRequest, - dict, + service.ListClustersRequest(), + {}, ], ) def test_list_clusters(request_type, transport: str = "grpc"): @@ -1317,7 +1333,7 @@ def test_list_clusters(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_clusters), "__call__") as call: @@ -1366,12 +1382,13 @@ def test_list_clusters_non_empty_request_with_auto_populated_field(): client.list_clusters(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListClustersRequest( + request_msg = service.ListClustersRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_clusters_use_cached_wrapped_rpc(): @@ -1452,9 +1469,14 @@ async def test_list_clusters_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_clusters_async( - transport: str = "grpc_asyncio", request_type=service.ListClustersRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListClustersRequest(), + {}, + ], +) +async def test_list_clusters_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1462,7 +1484,7 @@ async def test_list_clusters_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_clusters), "__call__") as call: @@ -1487,11 +1509,6 @@ async def test_list_clusters_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_clusters_async_from_dict(): - await test_list_clusters_async(request_type=dict) - - def test_list_clusters_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1828,8 +1845,8 @@ async def test_list_clusters_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetClusterRequest, - dict, + service.GetClusterRequest(), + {}, ], ) def test_get_cluster(request_type, transport: str = "grpc"): @@ -1840,7 +1857,7 @@ def test_get_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_cluster), "__call__") as call: @@ -1904,9 +1921,10 @@ def test_get_cluster_non_empty_request_with_auto_populated_field(): client.get_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetClusterRequest( + request_msg = service.GetClusterRequest( name="name_value", ) + assert args[0] == request_msg def test_get_cluster_use_cached_wrapped_rpc(): @@ -1987,9 +2005,14 @@ async def test_get_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_cluster_async( - transport: str = "grpc_asyncio", request_type=service.GetClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetClusterRequest(), + {}, + ], +) +async def test_get_cluster_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1997,7 +2020,7 @@ async def test_get_cluster_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_cluster), "__call__") as call: @@ -2040,11 +2063,6 @@ async def test_get_cluster_async( assert response.subscription_type == resources.SubscriptionType.STANDARD -@pytest.mark.asyncio -async def test_get_cluster_async_from_dict(): - await test_get_cluster_async(request_type=dict) - - def test_get_cluster_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2187,8 +2205,8 @@ async def test_get_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.CreateClusterRequest, - dict, + service.CreateClusterRequest(), + {}, ], ) def test_create_cluster(request_type, transport: str = "grpc"): @@ -2199,7 +2217,7 @@ def test_create_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_cluster), "__call__") as call: @@ -2242,11 +2260,12 @@ def test_create_cluster_non_empty_request_with_auto_populated_field(): client.create_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateClusterRequest( + request_msg = service.CreateClusterRequest( parent="parent_value", cluster_id="cluster_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_cluster_use_cached_wrapped_rpc(): @@ -2337,9 +2356,14 @@ async def test_create_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_cluster_async( - transport: str = "grpc_asyncio", request_type=service.CreateClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CreateClusterRequest(), + {}, + ], +) +async def test_create_cluster_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2347,7 +2371,7 @@ async def test_create_cluster_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_cluster), "__call__") as call: @@ -2367,11 +2391,6 @@ async def test_create_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_cluster_async_from_dict(): - await test_create_cluster_async(request_type=dict) - - def test_create_cluster_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2550,8 +2569,8 @@ async def test_create_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdateClusterRequest, - dict, + service.UpdateClusterRequest(), + {}, ], ) def test_update_cluster(request_type, transport: str = "grpc"): @@ -2562,7 +2581,7 @@ def test_update_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_cluster), "__call__") as call: @@ -2603,9 +2622,10 @@ def test_update_cluster_non_empty_request_with_auto_populated_field(): client.update_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateClusterRequest( + request_msg = service.UpdateClusterRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_cluster_use_cached_wrapped_rpc(): @@ -2696,9 +2716,14 @@ async def test_update_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_cluster_async( - transport: str = "grpc_asyncio", request_type=service.UpdateClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateClusterRequest(), + {}, + ], +) +async def test_update_cluster_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2706,7 +2731,7 @@ async def test_update_cluster_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_cluster), "__call__") as call: @@ -2726,11 +2751,6 @@ async def test_update_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_cluster_async_from_dict(): - await test_update_cluster_async(request_type=dict) - - def test_update_cluster_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2899,8 +2919,8 @@ async def test_update_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ExportClusterRequest, - dict, + service.ExportClusterRequest(), + {}, ], ) def test_export_cluster(request_type, transport: str = "grpc"): @@ -2911,7 +2931,7 @@ def test_export_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.export_cluster), "__call__") as call: @@ -2953,10 +2973,11 @@ def test_export_cluster_non_empty_request_with_auto_populated_field(): client.export_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ExportClusterRequest( + request_msg = service.ExportClusterRequest( name="name_value", database="database_value", ) + assert args[0] == request_msg def test_export_cluster_use_cached_wrapped_rpc(): @@ -3047,9 +3068,14 @@ async def test_export_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_export_cluster_async( - transport: str = "grpc_asyncio", request_type=service.ExportClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ExportClusterRequest(), + {}, + ], +) +async def test_export_cluster_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3057,7 +3083,7 @@ async def test_export_cluster_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.export_cluster), "__call__") as call: @@ -3077,11 +3103,6 @@ async def test_export_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_export_cluster_async_from_dict(): - await test_export_cluster_async(request_type=dict) - - def test_export_cluster_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3278,8 +3299,8 @@ async def test_export_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ImportClusterRequest, - dict, + service.ImportClusterRequest(), + {}, ], ) def test_import_cluster(request_type, transport: str = "grpc"): @@ -3290,7 +3311,7 @@ def test_import_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.import_cluster), "__call__") as call: @@ -3334,12 +3355,13 @@ def test_import_cluster_non_empty_request_with_auto_populated_field(): client.import_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ImportClusterRequest( + request_msg = service.ImportClusterRequest( name="name_value", gcs_uri="gcs_uri_value", database="database_value", user="user_value", ) + assert args[0] == request_msg def test_import_cluster_use_cached_wrapped_rpc(): @@ -3430,9 +3452,14 @@ async def test_import_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_import_cluster_async( - transport: str = "grpc_asyncio", request_type=service.ImportClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ImportClusterRequest(), + {}, + ], +) +async def test_import_cluster_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3440,7 +3467,7 @@ async def test_import_cluster_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.import_cluster), "__call__") as call: @@ -3460,11 +3487,6 @@ async def test_import_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_import_cluster_async_from_dict(): - await test_import_cluster_async(request_type=dict) - - def test_import_cluster_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3641,8 +3663,8 @@ async def test_import_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.UpgradeClusterRequest, - dict, + service.UpgradeClusterRequest(), + {}, ], ) def test_upgrade_cluster(request_type, transport: str = "grpc"): @@ -3653,7 +3675,7 @@ def test_upgrade_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.upgrade_cluster), "__call__") as call: @@ -3695,10 +3717,11 @@ def test_upgrade_cluster_non_empty_request_with_auto_populated_field(): client.upgrade_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpgradeClusterRequest( + request_msg = service.UpgradeClusterRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_upgrade_cluster_use_cached_wrapped_rpc(): @@ -3789,9 +3812,14 @@ async def test_upgrade_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_upgrade_cluster_async( - transport: str = "grpc_asyncio", request_type=service.UpgradeClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.UpgradeClusterRequest(), + {}, + ], +) +async def test_upgrade_cluster_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3799,7 +3827,7 @@ async def test_upgrade_cluster_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.upgrade_cluster), "__call__") as call: @@ -3819,11 +3847,6 @@ async def test_upgrade_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_upgrade_cluster_async_from_dict(): - await test_upgrade_cluster_async(request_type=dict) - - def test_upgrade_cluster_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3980,8 +4003,8 @@ async def test_upgrade_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DeleteClusterRequest, - dict, + service.DeleteClusterRequest(), + {}, ], ) def test_delete_cluster(request_type, transport: str = "grpc"): @@ -3992,7 +4015,7 @@ def test_delete_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_cluster), "__call__") as call: @@ -4035,11 +4058,12 @@ def test_delete_cluster_non_empty_request_with_auto_populated_field(): client.delete_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteClusterRequest( + request_msg = service.DeleteClusterRequest( name="name_value", request_id="request_id_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_cluster_use_cached_wrapped_rpc(): @@ -4130,9 +4154,14 @@ async def test_delete_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_cluster_async( - transport: str = "grpc_asyncio", request_type=service.DeleteClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteClusterRequest(), + {}, + ], +) +async def test_delete_cluster_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4140,7 +4169,7 @@ async def test_delete_cluster_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_cluster), "__call__") as call: @@ -4160,11 +4189,6 @@ async def test_delete_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_cluster_async_from_dict(): - await test_delete_cluster_async(request_type=dict) - - def test_delete_cluster_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4311,8 +4335,8 @@ async def test_delete_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.PromoteClusterRequest, - dict, + service.PromoteClusterRequest(), + {}, ], ) def test_promote_cluster(request_type, transport: str = "grpc"): @@ -4323,7 +4347,7 @@ def test_promote_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.promote_cluster), "__call__") as call: @@ -4366,11 +4390,12 @@ def test_promote_cluster_non_empty_request_with_auto_populated_field(): client.promote_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.PromoteClusterRequest( + request_msg = service.PromoteClusterRequest( name="name_value", request_id="request_id_value", etag="etag_value", ) + assert args[0] == request_msg def test_promote_cluster_use_cached_wrapped_rpc(): @@ -4461,9 +4486,14 @@ async def test_promote_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_promote_cluster_async( - transport: str = "grpc_asyncio", request_type=service.PromoteClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.PromoteClusterRequest(), + {}, + ], +) +async def test_promote_cluster_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4471,7 +4501,7 @@ async def test_promote_cluster_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.promote_cluster), "__call__") as call: @@ -4491,11 +4521,6 @@ async def test_promote_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_promote_cluster_async_from_dict(): - await test_promote_cluster_async(request_type=dict) - - def test_promote_cluster_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4642,8 +4667,8 @@ async def test_promote_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.SwitchoverClusterRequest, - dict, + service.SwitchoverClusterRequest(), + {}, ], ) def test_switchover_cluster(request_type, transport: str = "grpc"): @@ -4654,7 +4679,7 @@ def test_switchover_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4700,10 +4725,11 @@ def test_switchover_cluster_non_empty_request_with_auto_populated_field(): client.switchover_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.SwitchoverClusterRequest( + request_msg = service.SwitchoverClusterRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_switchover_cluster_use_cached_wrapped_rpc(): @@ -4798,9 +4824,14 @@ async def test_switchover_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_switchover_cluster_async( - transport: str = "grpc_asyncio", request_type=service.SwitchoverClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.SwitchoverClusterRequest(), + {}, + ], +) +async def test_switchover_cluster_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4808,7 +4839,7 @@ async def test_switchover_cluster_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( @@ -4830,11 +4861,6 @@ async def test_switchover_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_switchover_cluster_async_from_dict(): - await test_switchover_cluster_async(request_type=dict) - - def test_switchover_cluster_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4989,8 +5015,8 @@ async def test_switchover_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.RestoreClusterRequest, - dict, + service.RestoreClusterRequest(), + {}, ], ) def test_restore_cluster(request_type, transport: str = "grpc"): @@ -5001,7 +5027,7 @@ def test_restore_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.restore_cluster), "__call__") as call: @@ -5044,11 +5070,12 @@ def test_restore_cluster_non_empty_request_with_auto_populated_field(): client.restore_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.RestoreClusterRequest( + request_msg = service.RestoreClusterRequest( parent="parent_value", cluster_id="cluster_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_restore_cluster_use_cached_wrapped_rpc(): @@ -5139,9 +5166,14 @@ async def test_restore_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_restore_cluster_async( - transport: str = "grpc_asyncio", request_type=service.RestoreClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.RestoreClusterRequest(), + {}, + ], +) +async def test_restore_cluster_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5149,7 +5181,7 @@ async def test_restore_cluster_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.restore_cluster), "__call__") as call: @@ -5169,11 +5201,6 @@ async def test_restore_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_restore_cluster_async_from_dict(): - await test_restore_cluster_async(request_type=dict) - - def test_restore_cluster_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5238,8 +5265,8 @@ async def test_restore_cluster_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.CreateSecondaryClusterRequest, - dict, + service.CreateSecondaryClusterRequest(), + {}, ], ) def test_create_secondary_cluster(request_type, transport: str = "grpc"): @@ -5250,7 +5277,7 @@ def test_create_secondary_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5297,11 +5324,12 @@ def test_create_secondary_cluster_non_empty_request_with_auto_populated_field(): client.create_secondary_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateSecondaryClusterRequest( + request_msg = service.CreateSecondaryClusterRequest( parent="parent_value", cluster_id="cluster_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_secondary_cluster_use_cached_wrapped_rpc(): @@ -5397,8 +5425,15 @@ async def test_create_secondary_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.CreateSecondaryClusterRequest(), + {}, + ], +) async def test_create_secondary_cluster_async( - transport: str = "grpc_asyncio", request_type=service.CreateSecondaryClusterRequest + request_type, transport: str = "grpc_asyncio" ): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), @@ -5407,7 +5442,7 @@ async def test_create_secondary_cluster_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( @@ -5429,11 +5464,6 @@ async def test_create_secondary_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_secondary_cluster_async_from_dict(): - await test_create_secondary_cluster_async(request_type=dict) - - def test_create_secondary_cluster_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5620,8 +5650,8 @@ async def test_create_secondary_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListInstancesRequest, - dict, + service.ListInstancesRequest(), + {}, ], ) def test_list_instances(request_type, transport: str = "grpc"): @@ -5632,7 +5662,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(type(client.transport.list_instances), "__call__") as call: @@ -5681,12 +5711,13 @@ 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] == service.ListInstancesRequest( + request_msg = service.ListInstancesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_instances_use_cached_wrapped_rpc(): @@ -5767,9 +5798,14 @@ async def test_list_instances_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_instances_async( - transport: str = "grpc_asyncio", request_type=service.ListInstancesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListInstancesRequest(), + {}, + ], +) +async def test_list_instances_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5777,7 +5813,7 @@ async def test_list_instances_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_instances), "__call__") as call: @@ -5802,11 +5838,6 @@ async def test_list_instances_async( 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 = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6143,8 +6174,8 @@ async def test_list_instances_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetInstanceRequest, - dict, + service.GetInstanceRequest(), + {}, ], ) def test_get_instance(request_type, transport: str = "grpc"): @@ -6155,7 +6186,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(type(client.transport.get_instance), "__call__") as call: @@ -6227,9 +6258,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] == service.GetInstanceRequest( + request_msg = service.GetInstanceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_instance_use_cached_wrapped_rpc(): @@ -6310,9 +6342,14 @@ async def test_get_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_instance_async( - transport: str = "grpc_asyncio", request_type=service.GetInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetInstanceRequest(), + {}, + ], +) +async def test_get_instance_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6320,7 +6357,7 @@ async def test_get_instance_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_instance), "__call__") as call: @@ -6371,11 +6408,6 @@ async def test_get_instance_async( assert response.activation_policy == resources.Instance.ActivationPolicy.ALWAYS -@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 = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6518,8 +6550,8 @@ async def test_get_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.CreateInstanceRequest, - dict, + service.CreateInstanceRequest(), + {}, ], ) def test_create_instance(request_type, transport: str = "grpc"): @@ -6530,7 +6562,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(type(client.transport.create_instance), "__call__") as call: @@ -6573,11 +6605,12 @@ 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] == service.CreateInstanceRequest( + request_msg = service.CreateInstanceRequest( parent="parent_value", instance_id="instance_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_instance_use_cached_wrapped_rpc(): @@ -6668,9 +6701,14 @@ async def test_create_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_instance_async( - transport: str = "grpc_asyncio", request_type=service.CreateInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CreateInstanceRequest(), + {}, + ], +) +async def test_create_instance_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6678,7 +6716,7 @@ async def test_create_instance_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_instance), "__call__") as call: @@ -6698,11 +6736,6 @@ async def test_create_instance_async( 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 = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6869,8 +6902,8 @@ async def test_create_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.CreateSecondaryInstanceRequest, - dict, + service.CreateSecondaryInstanceRequest(), + {}, ], ) def test_create_secondary_instance(request_type, transport: str = "grpc"): @@ -6881,7 +6914,7 @@ def test_create_secondary_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( @@ -6928,11 +6961,12 @@ def test_create_secondary_instance_non_empty_request_with_auto_populated_field() client.create_secondary_instance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateSecondaryInstanceRequest( + request_msg = service.CreateSecondaryInstanceRequest( parent="parent_value", instance_id="instance_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_secondary_instance_use_cached_wrapped_rpc(): @@ -7028,8 +7062,15 @@ async def test_create_secondary_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.CreateSecondaryInstanceRequest(), + {}, + ], +) async def test_create_secondary_instance_async( - transport: str = "grpc_asyncio", request_type=service.CreateSecondaryInstanceRequest + request_type, transport: str = "grpc_asyncio" ): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), @@ -7038,7 +7079,7 @@ async def test_create_secondary_instance_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( @@ -7060,11 +7101,6 @@ async def test_create_secondary_instance_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_secondary_instance_async_from_dict(): - await test_create_secondary_instance_async(request_type=dict) - - def test_create_secondary_instance_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7239,8 +7275,8 @@ async def test_create_secondary_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.BatchCreateInstancesRequest, - dict, + service.BatchCreateInstancesRequest(), + {}, ], ) def test_batch_create_instances(request_type, transport: str = "grpc"): @@ -7251,7 +7287,7 @@ def test_batch_create_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( @@ -7297,10 +7333,11 @@ def test_batch_create_instances_non_empty_request_with_auto_populated_field(): client.batch_create_instances(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.BatchCreateInstancesRequest( + request_msg = service.BatchCreateInstancesRequest( parent="parent_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_batch_create_instances_use_cached_wrapped_rpc(): @@ -7396,8 +7433,15 @@ async def test_batch_create_instances_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.BatchCreateInstancesRequest(), + {}, + ], +) async def test_batch_create_instances_async( - transport: str = "grpc_asyncio", request_type=service.BatchCreateInstancesRequest + request_type, transport: str = "grpc_asyncio" ): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), @@ -7406,7 +7450,7 @@ async def test_batch_create_instances_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( @@ -7428,11 +7472,6 @@ async def test_batch_create_instances_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_batch_create_instances_async_from_dict(): - await test_batch_create_instances_async(request_type=dict) - - def test_batch_create_instances_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7501,8 +7540,8 @@ async def test_batch_create_instances_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdateInstanceRequest, - dict, + service.UpdateInstanceRequest(), + {}, ], ) def test_update_instance(request_type, transport: str = "grpc"): @@ -7513,7 +7552,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(type(client.transport.update_instance), "__call__") as call: @@ -7554,9 +7593,10 @@ 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] == service.UpdateInstanceRequest( + request_msg = service.UpdateInstanceRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_instance_use_cached_wrapped_rpc(): @@ -7647,9 +7687,14 @@ async def test_update_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_instance_async( - transport: str = "grpc_asyncio", request_type=service.UpdateInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateInstanceRequest(), + {}, + ], +) +async def test_update_instance_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7657,7 +7702,7 @@ async def test_update_instance_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_instance), "__call__") as call: @@ -7677,11 +7722,6 @@ async def test_update_instance_async( 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 = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7838,8 +7878,8 @@ async def test_update_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DeleteInstanceRequest, - dict, + service.DeleteInstanceRequest(), + {}, ], ) def test_delete_instance(request_type, transport: str = "grpc"): @@ -7850,7 +7890,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(type(client.transport.delete_instance), "__call__") as call: @@ -7893,11 +7933,12 @@ 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] == service.DeleteInstanceRequest( + request_msg = service.DeleteInstanceRequest( name="name_value", request_id="request_id_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_instance_use_cached_wrapped_rpc(): @@ -7988,9 +8029,14 @@ async def test_delete_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_instance_async( - transport: str = "grpc_asyncio", request_type=service.DeleteInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteInstanceRequest(), + {}, + ], +) +async def test_delete_instance_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7998,7 +8044,7 @@ async def test_delete_instance_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_instance), "__call__") as call: @@ -8018,11 +8064,6 @@ async def test_delete_instance_async( 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 = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8169,8 +8210,8 @@ async def test_delete_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.FailoverInstanceRequest, - dict, + service.FailoverInstanceRequest(), + {}, ], ) def test_failover_instance(request_type, transport: str = "grpc"): @@ -8181,7 +8222,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( @@ -8227,10 +8268,11 @@ 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] == service.FailoverInstanceRequest( + request_msg = service.FailoverInstanceRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_failover_instance_use_cached_wrapped_rpc(): @@ -8323,9 +8365,14 @@ async def test_failover_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_failover_instance_async( - transport: str = "grpc_asyncio", request_type=service.FailoverInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.FailoverInstanceRequest(), + {}, + ], +) +async def test_failover_instance_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8333,7 +8380,7 @@ async def test_failover_instance_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( @@ -8355,11 +8402,6 @@ async def test_failover_instance_async( 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 = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8514,8 +8556,8 @@ async def test_failover_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.InjectFaultRequest, - dict, + service.InjectFaultRequest(), + {}, ], ) def test_inject_fault(request_type, transport: str = "grpc"): @@ -8526,7 +8568,7 @@ def test_inject_fault(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.inject_fault), "__call__") as call: @@ -8568,10 +8610,11 @@ def test_inject_fault_non_empty_request_with_auto_populated_field(): client.inject_fault(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.InjectFaultRequest( + request_msg = service.InjectFaultRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_inject_fault_use_cached_wrapped_rpc(): @@ -8662,9 +8705,14 @@ async def test_inject_fault_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_inject_fault_async( - transport: str = "grpc_asyncio", request_type=service.InjectFaultRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.InjectFaultRequest(), + {}, + ], +) +async def test_inject_fault_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8672,7 +8720,7 @@ async def test_inject_fault_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.inject_fault), "__call__") as call: @@ -8692,11 +8740,6 @@ async def test_inject_fault_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_inject_fault_async_from_dict(): - await test_inject_fault_async(request_type=dict) - - def test_inject_fault_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8853,8 +8896,8 @@ async def test_inject_fault_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.RestartInstanceRequest, - dict, + service.RestartInstanceRequest(), + {}, ], ) def test_restart_instance(request_type, transport: str = "grpc"): @@ -8865,7 +8908,7 @@ def test_restart_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(type(client.transport.restart_instance), "__call__") as call: @@ -8907,10 +8950,11 @@ def test_restart_instance_non_empty_request_with_auto_populated_field(): client.restart_instance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.RestartInstanceRequest( + request_msg = service.RestartInstanceRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_restart_instance_use_cached_wrapped_rpc(): @@ -9003,9 +9047,14 @@ async def test_restart_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_restart_instance_async( - transport: str = "grpc_asyncio", request_type=service.RestartInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.RestartInstanceRequest(), + {}, + ], +) +async def test_restart_instance_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9013,7 +9062,7 @@ async def test_restart_instance_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.restart_instance), "__call__") as call: @@ -9033,11 +9082,6 @@ async def test_restart_instance_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_restart_instance_async_from_dict(): - await test_restart_instance_async(request_type=dict) - - def test_restart_instance_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9184,8 +9228,8 @@ async def test_restart_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ExecuteSqlRequest, - dict, + service.ExecuteSqlRequest(), + {}, ], ) def test_execute_sql(request_type, transport: str = "grpc"): @@ -9196,7 +9240,7 @@ def test_execute_sql(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.execute_sql), "__call__") as call: @@ -9241,13 +9285,14 @@ def test_execute_sql_non_empty_request_with_auto_populated_field(): client.execute_sql(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ExecuteSqlRequest( + request_msg = service.ExecuteSqlRequest( password="password_value", instance="instance_value", database="database_value", user="user_value", sql_statement="sql_statement_value", ) + assert args[0] == request_msg def test_execute_sql_use_cached_wrapped_rpc(): @@ -9328,9 +9373,14 @@ async def test_execute_sql_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_execute_sql_async( - transport: str = "grpc_asyncio", request_type=service.ExecuteSqlRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ExecuteSqlRequest(), + {}, + ], +) +async def test_execute_sql_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9338,7 +9388,7 @@ async def test_execute_sql_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.execute_sql), "__call__") as call: @@ -9358,11 +9408,6 @@ async def test_execute_sql_async( assert isinstance(response, service.ExecuteSqlResponse) -@pytest.mark.asyncio -async def test_execute_sql_async_from_dict(): - await test_execute_sql_async(request_type=dict) - - def test_execute_sql_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9545,8 +9590,8 @@ async def test_execute_sql_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListBackupsRequest, - dict, + service.ListBackupsRequest(), + {}, ], ) def test_list_backups(request_type, transport: str = "grpc"): @@ -9557,7 +9602,7 @@ def test_list_backups(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_backups), "__call__") as call: @@ -9606,12 +9651,13 @@ def test_list_backups_non_empty_request_with_auto_populated_field(): client.list_backups(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListBackupsRequest( + request_msg = service.ListBackupsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_backups_use_cached_wrapped_rpc(): @@ -9692,9 +9738,14 @@ async def test_list_backups_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_backups_async( - transport: str = "grpc_asyncio", request_type=service.ListBackupsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListBackupsRequest(), + {}, + ], +) +async def test_list_backups_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9702,7 +9753,7 @@ async def test_list_backups_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_backups), "__call__") as call: @@ -9727,11 +9778,6 @@ async def test_list_backups_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_backups_async_from_dict(): - await test_list_backups_async(request_type=dict) - - def test_list_backups_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10068,8 +10114,8 @@ async def test_list_backups_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetBackupRequest, - dict, + service.GetBackupRequest(), + {}, ], ) def test_get_backup(request_type, transport: str = "grpc"): @@ -10080,7 +10126,7 @@ def test_get_backup(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_backup), "__call__") as call: @@ -10148,9 +10194,10 @@ def test_get_backup_non_empty_request_with_auto_populated_field(): client.get_backup(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetBackupRequest( + request_msg = service.GetBackupRequest( name="name_value", ) + assert args[0] == request_msg def test_get_backup_use_cached_wrapped_rpc(): @@ -10229,9 +10276,14 @@ async def test_get_backup_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_backup_async( - transport: str = "grpc_asyncio", request_type=service.GetBackupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetBackupRequest(), + {}, + ], +) +async def test_get_backup_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10239,7 +10291,7 @@ async def test_get_backup_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_backup), "__call__") as call: @@ -10286,11 +10338,6 @@ async def test_get_backup_async( assert response.database_version == resources.DatabaseVersion.POSTGRES_13 -@pytest.mark.asyncio -async def test_get_backup_async_from_dict(): - await test_get_backup_async(request_type=dict) - - def test_get_backup_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10433,8 +10480,8 @@ async def test_get_backup_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.CreateBackupRequest, - dict, + service.CreateBackupRequest(), + {}, ], ) def test_create_backup(request_type, transport: str = "grpc"): @@ -10445,7 +10492,7 @@ def test_create_backup(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_backup), "__call__") as call: @@ -10488,11 +10535,12 @@ def test_create_backup_non_empty_request_with_auto_populated_field(): client.create_backup(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateBackupRequest( + request_msg = service.CreateBackupRequest( parent="parent_value", backup_id="backup_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_backup_use_cached_wrapped_rpc(): @@ -10583,9 +10631,14 @@ async def test_create_backup_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_backup_async( - transport: str = "grpc_asyncio", request_type=service.CreateBackupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CreateBackupRequest(), + {}, + ], +) +async def test_create_backup_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10593,7 +10646,7 @@ async def test_create_backup_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_backup), "__call__") as call: @@ -10613,11 +10666,6 @@ async def test_create_backup_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_backup_async_from_dict(): - await test_create_backup_async(request_type=dict) - - def test_create_backup_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10784,8 +10832,8 @@ async def test_create_backup_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdateBackupRequest, - dict, + service.UpdateBackupRequest(), + {}, ], ) def test_update_backup(request_type, transport: str = "grpc"): @@ -10796,7 +10844,7 @@ def test_update_backup(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_backup), "__call__") as call: @@ -10837,9 +10885,10 @@ def test_update_backup_non_empty_request_with_auto_populated_field(): client.update_backup(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateBackupRequest( + request_msg = service.UpdateBackupRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_backup_use_cached_wrapped_rpc(): @@ -10930,9 +10979,14 @@ async def test_update_backup_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_backup_async( - transport: str = "grpc_asyncio", request_type=service.UpdateBackupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateBackupRequest(), + {}, + ], +) +async def test_update_backup_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10940,7 +10994,7 @@ async def test_update_backup_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_backup), "__call__") as call: @@ -10960,11 +11014,6 @@ async def test_update_backup_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_backup_async_from_dict(): - await test_update_backup_async(request_type=dict) - - def test_update_backup_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11121,8 +11170,8 @@ async def test_update_backup_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DeleteBackupRequest, - dict, + service.DeleteBackupRequest(), + {}, ], ) def test_delete_backup(request_type, transport: str = "grpc"): @@ -11133,7 +11182,7 @@ def test_delete_backup(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_backup), "__call__") as call: @@ -11176,11 +11225,12 @@ def test_delete_backup_non_empty_request_with_auto_populated_field(): client.delete_backup(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteBackupRequest( + request_msg = service.DeleteBackupRequest( name="name_value", request_id="request_id_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_backup_use_cached_wrapped_rpc(): @@ -11271,9 +11321,14 @@ async def test_delete_backup_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_backup_async( - transport: str = "grpc_asyncio", request_type=service.DeleteBackupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteBackupRequest(), + {}, + ], +) +async def test_delete_backup_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11281,7 +11336,7 @@ async def test_delete_backup_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_backup), "__call__") as call: @@ -11301,11 +11356,6 @@ async def test_delete_backup_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_backup_async_from_dict(): - await test_delete_backup_async(request_type=dict) - - def test_delete_backup_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11452,8 +11502,8 @@ async def test_delete_backup_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListSupportedDatabaseFlagsRequest, - dict, + service.ListSupportedDatabaseFlagsRequest(), + {}, ], ) def test_list_supported_database_flags(request_type, transport: str = "grpc"): @@ -11464,7 +11514,7 @@ def test_list_supported_database_flags(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11513,10 +11563,11 @@ def test_list_supported_database_flags_non_empty_request_with_auto_populated_fie client.list_supported_database_flags(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListSupportedDatabaseFlagsRequest( + request_msg = service.ListSupportedDatabaseFlagsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_supported_database_flags_use_cached_wrapped_rpc(): @@ -11602,9 +11653,15 @@ async def test_list_supported_database_flags_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.ListSupportedDatabaseFlagsRequest(), + {}, + ], +) async def test_list_supported_database_flags_async( - transport: str = "grpc_asyncio", - request_type=service.ListSupportedDatabaseFlagsRequest, + request_type, transport: str = "grpc_asyncio" ): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), @@ -11613,7 +11670,7 @@ async def test_list_supported_database_flags_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( @@ -11638,11 +11695,6 @@ async def test_list_supported_database_flags_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_supported_database_flags_async_from_dict(): - await test_list_supported_database_flags_async(request_type=dict) - - def test_list_supported_database_flags_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11999,8 +12051,8 @@ async def test_list_supported_database_flags_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GenerateClientCertificateRequest, - dict, + service.GenerateClientCertificateRequest(), + {}, ], ) def test_generate_client_certificate(request_type, transport: str = "grpc"): @@ -12011,7 +12063,7 @@ def test_generate_client_certificate(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -12063,11 +12115,12 @@ def test_generate_client_certificate_non_empty_request_with_auto_populated_field client.generate_client_certificate(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GenerateClientCertificateRequest( + request_msg = service.GenerateClientCertificateRequest( parent="parent_value", request_id="request_id_value", public_key="public_key_value", ) + assert args[0] == request_msg def test_generate_client_certificate_use_cached_wrapped_rpc(): @@ -12153,9 +12206,15 @@ async def test_generate_client_certificate_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.GenerateClientCertificateRequest(), + {}, + ], +) async def test_generate_client_certificate_async( - transport: str = "grpc_asyncio", - request_type=service.GenerateClientCertificateRequest, + request_type, transport: str = "grpc_asyncio" ): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), @@ -12164,7 +12223,7 @@ async def test_generate_client_certificate_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( @@ -12191,11 +12250,6 @@ async def test_generate_client_certificate_async( assert response.ca_cert == "ca_cert_value" -@pytest.mark.asyncio -async def test_generate_client_certificate_async_from_dict(): - await test_generate_client_certificate_async(request_type=dict) - - def test_generate_client_certificate_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12350,8 +12404,8 @@ async def test_generate_client_certificate_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.GetConnectionInfoRequest, - dict, + service.GetConnectionInfoRequest(), + {}, ], ) def test_get_connection_info(request_type, transport: str = "grpc"): @@ -12362,7 +12416,7 @@ def test_get_connection_info(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -12417,10 +12471,11 @@ def test_get_connection_info_non_empty_request_with_auto_populated_field(): client.get_connection_info(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetConnectionInfoRequest( + request_msg = service.GetConnectionInfoRequest( parent="parent_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_get_connection_info_use_cached_wrapped_rpc(): @@ -12505,9 +12560,14 @@ async def test_get_connection_info_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_connection_info_async( - transport: str = "grpc_asyncio", request_type=service.GetConnectionInfoRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetConnectionInfoRequest(), + {}, + ], +) +async def test_get_connection_info_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12515,7 +12575,7 @@ async def test_get_connection_info_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( @@ -12546,11 +12606,6 @@ async def test_get_connection_info_async( assert response.instance_uid == "instance_uid_value" -@pytest.mark.asyncio -async def test_get_connection_info_async_from_dict(): - await test_get_connection_info_async(request_type=dict) - - def test_get_connection_info_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12705,8 +12760,8 @@ async def test_get_connection_info_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListUsersRequest, - dict, + service.ListUsersRequest(), + {}, ], ) def test_list_users(request_type, transport: str = "grpc"): @@ -12717,7 +12772,7 @@ def test_list_users(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_users), "__call__") as call: @@ -12766,12 +12821,13 @@ def test_list_users_non_empty_request_with_auto_populated_field(): client.list_users(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListUsersRequest( + request_msg = service.ListUsersRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_users_use_cached_wrapped_rpc(): @@ -12850,9 +12906,14 @@ async def test_list_users_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_list_users_async( - transport: str = "grpc_asyncio", request_type=service.ListUsersRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListUsersRequest(), + {}, + ], +) +async def test_list_users_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12860,7 +12921,7 @@ async def test_list_users_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_users), "__call__") as call: @@ -12885,11 +12946,6 @@ async def test_list_users_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_users_async_from_dict(): - await test_list_users_async(request_type=dict) - - def test_list_users_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13226,8 +13282,8 @@ async def test_list_users_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetUserRequest, - dict, + service.GetUserRequest(), + {}, ], ) def test_get_user(request_type, transport: str = "grpc"): @@ -13238,7 +13294,7 @@ def test_get_user(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_user), "__call__") as call: @@ -13290,9 +13346,10 @@ def test_get_user_non_empty_request_with_auto_populated_field(): client.get_user(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetUserRequest( + request_msg = service.GetUserRequest( name="name_value", ) + assert args[0] == request_msg def test_get_user_use_cached_wrapped_rpc(): @@ -13371,9 +13428,14 @@ async def test_get_user_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn @pytest.mark.asyncio -async def test_get_user_async( - transport: str = "grpc_asyncio", request_type=service.GetUserRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetUserRequest(), + {}, + ], +) +async def test_get_user_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13381,7 +13443,7 @@ async def test_get_user_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_user), "__call__") as call: @@ -13412,11 +13474,6 @@ async def test_get_user_async( assert response.keep_extra_roles is True -@pytest.mark.asyncio -async def test_get_user_async_from_dict(): - await test_get_user_async(request_type=dict) - - def test_get_user_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13559,8 +13616,8 @@ async def test_get_user_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.CreateUserRequest, - dict, + service.CreateUserRequest(), + {}, ], ) def test_create_user(request_type, transport: str = "grpc"): @@ -13571,7 +13628,7 @@ def test_create_user(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_user), "__call__") as call: @@ -13625,11 +13682,12 @@ def test_create_user_non_empty_request_with_auto_populated_field(): client.create_user(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateUserRequest( + request_msg = service.CreateUserRequest( parent="parent_value", user_id="user_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_user_use_cached_wrapped_rpc(): @@ -13710,9 +13768,14 @@ async def test_create_user_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_user_async( - transport: str = "grpc_asyncio", request_type=service.CreateUserRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CreateUserRequest(), + {}, + ], +) +async def test_create_user_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13720,7 +13783,7 @@ async def test_create_user_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_user), "__call__") as call: @@ -13751,11 +13814,6 @@ async def test_create_user_async( assert response.keep_extra_roles is True -@pytest.mark.asyncio -async def test_create_user_async_from_dict(): - await test_create_user_async(request_type=dict) - - def test_create_user_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13918,8 +13976,8 @@ async def test_create_user_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdateUserRequest, - dict, + service.UpdateUserRequest(), + {}, ], ) def test_update_user(request_type, transport: str = "grpc"): @@ -13930,7 +13988,7 @@ def test_update_user(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_user), "__call__") as call: @@ -13982,9 +14040,10 @@ def test_update_user_non_empty_request_with_auto_populated_field(): client.update_user(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateUserRequest( + request_msg = service.UpdateUserRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_user_use_cached_wrapped_rpc(): @@ -14065,9 +14124,14 @@ async def test_update_user_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_user_async( - transport: str = "grpc_asyncio", request_type=service.UpdateUserRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateUserRequest(), + {}, + ], +) +async def test_update_user_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14075,7 +14139,7 @@ async def test_update_user_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_user), "__call__") as call: @@ -14106,11 +14170,6 @@ async def test_update_user_async( assert response.keep_extra_roles is True -@pytest.mark.asyncio -async def test_update_user_async_from_dict(): - await test_update_user_async(request_type=dict) - - def test_update_user_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14263,8 +14322,8 @@ async def test_update_user_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DeleteUserRequest, - dict, + service.DeleteUserRequest(), + {}, ], ) def test_delete_user(request_type, transport: str = "grpc"): @@ -14275,7 +14334,7 @@ def test_delete_user(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_user), "__call__") as call: @@ -14317,10 +14376,11 @@ def test_delete_user_non_empty_request_with_auto_populated_field(): client.delete_user(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteUserRequest( + request_msg = service.DeleteUserRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_user_use_cached_wrapped_rpc(): @@ -14401,9 +14461,14 @@ async def test_delete_user_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_user_async( - transport: str = "grpc_asyncio", request_type=service.DeleteUserRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteUserRequest(), + {}, + ], +) +async def test_delete_user_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14411,7 +14476,7 @@ async def test_delete_user_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_user), "__call__") as call: @@ -14429,11 +14494,6 @@ async def test_delete_user_async( assert response is None -@pytest.mark.asyncio -async def test_delete_user_async_from_dict(): - await test_delete_user_async(request_type=dict) - - def test_delete_user_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14576,8 +14636,8 @@ async def test_delete_user_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListDatabasesRequest, - dict, + service.ListDatabasesRequest(), + {}, ], ) def test_list_databases(request_type, transport: str = "grpc"): @@ -14588,7 +14648,7 @@ def test_list_databases(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_databases), "__call__") as call: @@ -14634,11 +14694,12 @@ def test_list_databases_non_empty_request_with_auto_populated_field(): client.list_databases(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListDatabasesRequest( + request_msg = service.ListDatabasesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_databases_use_cached_wrapped_rpc(): @@ -14719,9 +14780,14 @@ async def test_list_databases_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_databases_async( - transport: str = "grpc_asyncio", request_type=service.ListDatabasesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListDatabasesRequest(), + {}, + ], +) +async def test_list_databases_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14729,7 +14795,7 @@ async def test_list_databases_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_databases), "__call__") as call: @@ -14752,11 +14818,6 @@ async def test_list_databases_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_databases_async_from_dict(): - await test_list_databases_async(request_type=dict) - - def test_list_databases_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -22695,7 +22756,6 @@ def test_list_clusters_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListClustersRequest() - assert args[0] == request_msg @@ -22716,7 +22776,6 @@ def test_get_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetClusterRequest() - assert args[0] == request_msg @@ -22737,7 +22796,6 @@ def test_create_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateClusterRequest() - assert args[0] == request_msg @@ -22758,7 +22816,6 @@ def test_update_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateClusterRequest() - assert args[0] == request_msg @@ -22779,7 +22836,6 @@ def test_export_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ExportClusterRequest() - assert args[0] == request_msg @@ -22800,7 +22856,6 @@ def test_import_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ImportClusterRequest() - assert args[0] == request_msg @@ -22821,7 +22876,6 @@ def test_upgrade_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpgradeClusterRequest() - assert args[0] == request_msg @@ -22842,7 +22896,6 @@ def test_delete_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteClusterRequest() - assert args[0] == request_msg @@ -22863,7 +22916,6 @@ def test_promote_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.PromoteClusterRequest() - assert args[0] == request_msg @@ -22886,7 +22938,6 @@ def test_switchover_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.SwitchoverClusterRequest() - assert args[0] == request_msg @@ -22907,7 +22958,6 @@ def test_restore_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.RestoreClusterRequest() - assert args[0] == request_msg @@ -22930,7 +22980,6 @@ def test_create_secondary_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateSecondaryClusterRequest() - assert args[0] == request_msg @@ -22951,7 +23000,6 @@ def test_list_instances_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListInstancesRequest() - assert args[0] == request_msg @@ -22972,7 +23020,6 @@ def test_get_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetInstanceRequest() - assert args[0] == request_msg @@ -22993,7 +23040,6 @@ def test_create_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateInstanceRequest() - assert args[0] == request_msg @@ -23016,7 +23062,6 @@ def test_create_secondary_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateSecondaryInstanceRequest() - assert args[0] == request_msg @@ -23039,7 +23084,6 @@ def test_batch_create_instances_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.BatchCreateInstancesRequest() - assert args[0] == request_msg @@ -23060,7 +23104,6 @@ def test_update_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateInstanceRequest() - assert args[0] == request_msg @@ -23081,7 +23124,6 @@ def test_delete_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteInstanceRequest() - assert args[0] == request_msg @@ -23104,7 +23146,6 @@ def test_failover_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.FailoverInstanceRequest() - assert args[0] == request_msg @@ -23125,7 +23166,6 @@ def test_inject_fault_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.InjectFaultRequest() - assert args[0] == request_msg @@ -23146,7 +23186,6 @@ def test_restart_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.RestartInstanceRequest() - assert args[0] == request_msg @@ -23167,7 +23206,6 @@ def test_execute_sql_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ExecuteSqlRequest() - assert args[0] == request_msg @@ -23188,7 +23226,6 @@ def test_list_backups_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListBackupsRequest() - assert args[0] == request_msg @@ -23209,7 +23246,6 @@ def test_get_backup_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetBackupRequest() - assert args[0] == request_msg @@ -23230,7 +23266,6 @@ def test_create_backup_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateBackupRequest() - assert args[0] == request_msg @@ -23251,7 +23286,6 @@ def test_update_backup_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateBackupRequest() - assert args[0] == request_msg @@ -23272,7 +23306,6 @@ def test_delete_backup_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteBackupRequest() - assert args[0] == request_msg @@ -23295,7 +23328,6 @@ def test_list_supported_database_flags_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListSupportedDatabaseFlagsRequest() - assert args[0] == request_msg @@ -23318,7 +23350,6 @@ def test_generate_client_certificate_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GenerateClientCertificateRequest() - assert args[0] == request_msg @@ -23341,7 +23372,6 @@ def test_get_connection_info_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetConnectionInfoRequest() - assert args[0] == request_msg @@ -23362,7 +23392,6 @@ def test_list_users_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListUsersRequest() - assert args[0] == request_msg @@ -23383,7 +23412,6 @@ def test_get_user_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetUserRequest() - assert args[0] == request_msg @@ -23404,7 +23432,6 @@ def test_create_user_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateUserRequest() - assert args[0] == request_msg @@ -23425,7 +23452,6 @@ def test_update_user_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateUserRequest() - assert args[0] == request_msg @@ -23446,7 +23472,6 @@ def test_delete_user_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteUserRequest() - assert args[0] == request_msg @@ -23467,7 +23492,6 @@ def test_list_databases_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListDatabasesRequest() - assert args[0] == request_msg @@ -23509,7 +23533,6 @@ async def test_list_clusters_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListClustersRequest() - assert args[0] == request_msg @@ -23546,7 +23569,6 @@ async def test_get_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetClusterRequest() - assert args[0] == request_msg @@ -23571,7 +23593,6 @@ async def test_create_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateClusterRequest() - assert args[0] == request_msg @@ -23596,7 +23617,6 @@ async def test_update_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateClusterRequest() - assert args[0] == request_msg @@ -23621,7 +23641,6 @@ async def test_export_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ExportClusterRequest() - assert args[0] == request_msg @@ -23646,7 +23665,6 @@ async def test_import_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ImportClusterRequest() - assert args[0] == request_msg @@ -23671,7 +23689,6 @@ async def test_upgrade_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpgradeClusterRequest() - assert args[0] == request_msg @@ -23696,7 +23713,6 @@ async def test_delete_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteClusterRequest() - assert args[0] == request_msg @@ -23721,7 +23737,6 @@ async def test_promote_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.PromoteClusterRequest() - assert args[0] == request_msg @@ -23748,7 +23763,6 @@ async def test_switchover_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.SwitchoverClusterRequest() - assert args[0] == request_msg @@ -23773,7 +23787,6 @@ async def test_restore_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.RestoreClusterRequest() - assert args[0] == request_msg @@ -23800,7 +23813,6 @@ async def test_create_secondary_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateSecondaryClusterRequest() - assert args[0] == request_msg @@ -23828,7 +23840,6 @@ async def test_list_instances_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListInstancesRequest() - assert args[0] == request_msg @@ -23868,7 +23879,6 @@ async def test_get_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetInstanceRequest() - assert args[0] == request_msg @@ -23893,7 +23903,6 @@ async def test_create_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateInstanceRequest() - assert args[0] == request_msg @@ -23920,7 +23929,6 @@ async def test_create_secondary_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateSecondaryInstanceRequest() - assert args[0] == request_msg @@ -23947,7 +23955,6 @@ async def test_batch_create_instances_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.BatchCreateInstancesRequest() - assert args[0] == request_msg @@ -23972,7 +23979,6 @@ async def test_update_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateInstanceRequest() - assert args[0] == request_msg @@ -23997,7 +24003,6 @@ async def test_delete_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteInstanceRequest() - assert args[0] == request_msg @@ -24024,7 +24029,6 @@ async def test_failover_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.FailoverInstanceRequest() - assert args[0] == request_msg @@ -24049,7 +24053,6 @@ async def test_inject_fault_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.InjectFaultRequest() - assert args[0] == request_msg @@ -24074,7 +24077,6 @@ async def test_restart_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.RestartInstanceRequest() - assert args[0] == request_msg @@ -24099,7 +24101,6 @@ async def test_execute_sql_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ExecuteSqlRequest() - assert args[0] == request_msg @@ -24127,7 +24128,6 @@ async def test_list_backups_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListBackupsRequest() - assert args[0] == request_msg @@ -24166,7 +24166,6 @@ async def test_get_backup_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetBackupRequest() - assert args[0] == request_msg @@ -24191,7 +24190,6 @@ async def test_create_backup_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateBackupRequest() - assert args[0] == request_msg @@ -24216,7 +24214,6 @@ async def test_update_backup_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateBackupRequest() - assert args[0] == request_msg @@ -24241,7 +24238,6 @@ async def test_delete_backup_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteBackupRequest() - assert args[0] == request_msg @@ -24270,7 +24266,6 @@ async def test_list_supported_database_flags_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListSupportedDatabaseFlagsRequest() - assert args[0] == request_msg @@ -24300,7 +24295,6 @@ async def test_generate_client_certificate_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GenerateClientCertificateRequest() - assert args[0] == request_msg @@ -24332,7 +24326,6 @@ async def test_get_connection_info_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetConnectionInfoRequest() - assert args[0] == request_msg @@ -24360,7 +24353,6 @@ async def test_list_users_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListUsersRequest() - assert args[0] == request_msg @@ -24391,7 +24383,6 @@ async def test_get_user_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetUserRequest() - assert args[0] == request_msg @@ -24422,7 +24413,6 @@ async def test_create_user_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateUserRequest() - assert args[0] == request_msg @@ -24453,7 +24443,6 @@ async def test_update_user_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateUserRequest() - assert args[0] == request_msg @@ -24476,7 +24465,6 @@ async def test_delete_user_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteUserRequest() - assert args[0] == request_msg @@ -24503,7 +24491,6 @@ async def test_list_databases_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListDatabasesRequest() - assert args[0] == request_msg @@ -31128,7 +31115,6 @@ def test_list_clusters_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListClustersRequest() - assert args[0] == request_msg @@ -31148,7 +31134,6 @@ def test_get_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetClusterRequest() - assert args[0] == request_msg @@ -31168,7 +31153,6 @@ def test_create_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateClusterRequest() - assert args[0] == request_msg @@ -31188,7 +31172,6 @@ def test_update_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateClusterRequest() - assert args[0] == request_msg @@ -31208,7 +31191,6 @@ def test_export_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ExportClusterRequest() - assert args[0] == request_msg @@ -31228,7 +31210,6 @@ def test_import_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ImportClusterRequest() - assert args[0] == request_msg @@ -31248,7 +31229,6 @@ def test_upgrade_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpgradeClusterRequest() - assert args[0] == request_msg @@ -31268,7 +31248,6 @@ def test_delete_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteClusterRequest() - assert args[0] == request_msg @@ -31288,7 +31267,6 @@ def test_promote_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.PromoteClusterRequest() - assert args[0] == request_msg @@ -31310,7 +31288,6 @@ def test_switchover_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.SwitchoverClusterRequest() - assert args[0] == request_msg @@ -31330,7 +31307,6 @@ def test_restore_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.RestoreClusterRequest() - assert args[0] == request_msg @@ -31352,7 +31328,6 @@ def test_create_secondary_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateSecondaryClusterRequest() - assert args[0] == request_msg @@ -31372,7 +31347,6 @@ def test_list_instances_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListInstancesRequest() - assert args[0] == request_msg @@ -31392,7 +31366,6 @@ def test_get_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetInstanceRequest() - assert args[0] == request_msg @@ -31412,7 +31385,6 @@ def test_create_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateInstanceRequest() - assert args[0] == request_msg @@ -31434,7 +31406,6 @@ def test_create_secondary_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateSecondaryInstanceRequest() - assert args[0] == request_msg @@ -31456,7 +31427,6 @@ def test_batch_create_instances_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.BatchCreateInstancesRequest() - assert args[0] == request_msg @@ -31476,7 +31446,6 @@ def test_update_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateInstanceRequest() - assert args[0] == request_msg @@ -31496,7 +31465,6 @@ def test_delete_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteInstanceRequest() - assert args[0] == request_msg @@ -31518,7 +31486,6 @@ def test_failover_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.FailoverInstanceRequest() - assert args[0] == request_msg @@ -31538,7 +31505,6 @@ def test_inject_fault_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.InjectFaultRequest() - assert args[0] == request_msg @@ -31558,7 +31524,6 @@ def test_restart_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.RestartInstanceRequest() - assert args[0] == request_msg @@ -31578,7 +31543,6 @@ def test_execute_sql_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ExecuteSqlRequest() - assert args[0] == request_msg @@ -31598,7 +31562,6 @@ def test_list_backups_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListBackupsRequest() - assert args[0] == request_msg @@ -31618,7 +31581,6 @@ def test_get_backup_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetBackupRequest() - assert args[0] == request_msg @@ -31638,7 +31600,6 @@ def test_create_backup_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateBackupRequest() - assert args[0] == request_msg @@ -31658,7 +31619,6 @@ def test_update_backup_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateBackupRequest() - assert args[0] == request_msg @@ -31678,7 +31638,6 @@ def test_delete_backup_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteBackupRequest() - assert args[0] == request_msg @@ -31700,7 +31659,6 @@ def test_list_supported_database_flags_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListSupportedDatabaseFlagsRequest() - assert args[0] == request_msg @@ -31722,7 +31680,6 @@ def test_generate_client_certificate_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GenerateClientCertificateRequest() - assert args[0] == request_msg @@ -31744,7 +31701,6 @@ def test_get_connection_info_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetConnectionInfoRequest() - assert args[0] == request_msg @@ -31764,7 +31720,6 @@ def test_list_users_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListUsersRequest() - assert args[0] == request_msg @@ -31784,7 +31739,6 @@ def test_get_user_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetUserRequest() - assert args[0] == request_msg @@ -31804,7 +31758,6 @@ def test_create_user_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateUserRequest() - assert args[0] == request_msg @@ -31824,7 +31777,6 @@ def test_update_user_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateUserRequest() - assert args[0] == request_msg @@ -31844,7 +31796,6 @@ def test_delete_user_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteUserRequest() - assert args[0] == request_msg @@ -31864,7 +31815,6 @@ def test_list_databases_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListDatabasesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-alloydb/tests/unit/gapic/alloydb_v1/test_alloy_dbcsql_admin.py b/packages/google-cloud-alloydb/tests/unit/gapic/alloydb_v1/test_alloy_dbcsql_admin.py index 362253db109d..f553b0dbe451 100644 --- a/packages/google-cloud-alloydb/tests/unit/gapic/alloydb_v1/test_alloy_dbcsql_admin.py +++ b/packages/google-cloud-alloydb/tests/unit/gapic/alloydb_v1/test_alloy_dbcsql_admin.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 @@ -127,6 +128,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" @@ -1360,8 +1376,8 @@ def test_alloy_dbcsql_admin_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - csql_service.RestoreFromCloudSQLRequest, - dict, + csql_service.RestoreFromCloudSQLRequest(), + {}, ], ) def test_restore_from_cloud_sql(request_type, transport: str = "grpc"): @@ -1372,7 +1388,7 @@ def test_restore_from_cloud_sql(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1418,10 +1434,11 @@ def test_restore_from_cloud_sql_non_empty_request_with_auto_populated_field(): client.restore_from_cloud_sql(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == csql_service.RestoreFromCloudSQLRequest( + request_msg = csql_service.RestoreFromCloudSQLRequest( parent="parent_value", cluster_id="cluster_id_value", ) + assert args[0] == request_msg def test_restore_from_cloud_sql_use_cached_wrapped_rpc(): @@ -1517,9 +1534,15 @@ async def test_restore_from_cloud_sql_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + csql_service.RestoreFromCloudSQLRequest(), + {}, + ], +) async def test_restore_from_cloud_sql_async( - transport: str = "grpc_asyncio", - request_type=csql_service.RestoreFromCloudSQLRequest, + request_type, transport: str = "grpc_asyncio" ): client = AlloyDBCSQLAdminAsyncClient( credentials=async_anonymous_credentials(), @@ -1528,7 +1551,7 @@ async def test_restore_from_cloud_sql_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( @@ -1550,11 +1573,6 @@ async def test_restore_from_cloud_sql_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_restore_from_cloud_sql_async_from_dict(): - await test_restore_from_cloud_sql_async(request_type=dict) - - def test_restore_from_cloud_sql_field_headers(): client = AlloyDBCSQLAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2039,7 +2057,6 @@ def test_restore_from_cloud_sql_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = csql_service.RestoreFromCloudSQLRequest() - assert args[0] == request_msg @@ -2080,7 +2097,6 @@ async def test_restore_from_cloud_sql_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = csql_service.RestoreFromCloudSQLRequest() - assert args[0] == request_msg @@ -2616,7 +2632,6 @@ def test_restore_from_cloud_sql_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = csql_service.RestoreFromCloudSQLRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-alloydb/tests/unit/gapic/alloydb_v1alpha/test_alloy_db_admin.py b/packages/google-cloud-alloydb/tests/unit/gapic/alloydb_v1alpha/test_alloy_db_admin.py index f76b8dcf853b..9e1045bee6f9 100644 --- a/packages/google-cloud-alloydb/tests/unit/gapic/alloydb_v1alpha/test_alloy_db_admin.py +++ b/packages/google-cloud-alloydb/tests/unit/gapic/alloydb_v1alpha/test_alloy_db_admin.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 @@ -131,6 +132,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" @@ -1311,8 +1327,8 @@ def test_alloy_db_admin_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - service.ListClustersRequest, - dict, + service.ListClustersRequest(), + {}, ], ) def test_list_clusters(request_type, transport: str = "grpc"): @@ -1323,7 +1339,7 @@ def test_list_clusters(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_clusters), "__call__") as call: @@ -1372,12 +1388,13 @@ def test_list_clusters_non_empty_request_with_auto_populated_field(): client.list_clusters(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListClustersRequest( + request_msg = service.ListClustersRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_clusters_use_cached_wrapped_rpc(): @@ -1458,9 +1475,14 @@ async def test_list_clusters_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_clusters_async( - transport: str = "grpc_asyncio", request_type=service.ListClustersRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListClustersRequest(), + {}, + ], +) +async def test_list_clusters_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1468,7 +1490,7 @@ async def test_list_clusters_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_clusters), "__call__") as call: @@ -1493,11 +1515,6 @@ async def test_list_clusters_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_clusters_async_from_dict(): - await test_list_clusters_async(request_type=dict) - - def test_list_clusters_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1834,8 +1851,8 @@ async def test_list_clusters_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetClusterRequest, - dict, + service.GetClusterRequest(), + {}, ], ) def test_get_cluster(request_type, transport: str = "grpc"): @@ -1846,7 +1863,7 @@ def test_get_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_cluster), "__call__") as call: @@ -1914,9 +1931,10 @@ def test_get_cluster_non_empty_request_with_auto_populated_field(): client.get_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetClusterRequest( + request_msg = service.GetClusterRequest( name="name_value", ) + assert args[0] == request_msg def test_get_cluster_use_cached_wrapped_rpc(): @@ -1997,9 +2015,14 @@ async def test_get_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_cluster_async( - transport: str = "grpc_asyncio", request_type=service.GetClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetClusterRequest(), + {}, + ], +) +async def test_get_cluster_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2007,7 +2030,7 @@ async def test_get_cluster_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_cluster), "__call__") as call: @@ -2054,11 +2077,6 @@ async def test_get_cluster_async( assert response.service_account_email == "service_account_email_value" -@pytest.mark.asyncio -async def test_get_cluster_async_from_dict(): - await test_get_cluster_async(request_type=dict) - - def test_get_cluster_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2201,8 +2219,8 @@ async def test_get_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.CreateClusterRequest, - dict, + service.CreateClusterRequest(), + {}, ], ) def test_create_cluster(request_type, transport: str = "grpc"): @@ -2213,7 +2231,7 @@ def test_create_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_cluster), "__call__") as call: @@ -2256,11 +2274,12 @@ def test_create_cluster_non_empty_request_with_auto_populated_field(): client.create_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateClusterRequest( + request_msg = service.CreateClusterRequest( parent="parent_value", cluster_id="cluster_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_cluster_use_cached_wrapped_rpc(): @@ -2351,9 +2370,14 @@ async def test_create_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_cluster_async( - transport: str = "grpc_asyncio", request_type=service.CreateClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CreateClusterRequest(), + {}, + ], +) +async def test_create_cluster_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2361,7 +2385,7 @@ async def test_create_cluster_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_cluster), "__call__") as call: @@ -2381,11 +2405,6 @@ async def test_create_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_cluster_async_from_dict(): - await test_create_cluster_async(request_type=dict) - - def test_create_cluster_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2564,8 +2583,8 @@ async def test_create_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdateClusterRequest, - dict, + service.UpdateClusterRequest(), + {}, ], ) def test_update_cluster(request_type, transport: str = "grpc"): @@ -2576,7 +2595,7 @@ def test_update_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_cluster), "__call__") as call: @@ -2617,9 +2636,10 @@ def test_update_cluster_non_empty_request_with_auto_populated_field(): client.update_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateClusterRequest( + request_msg = service.UpdateClusterRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_cluster_use_cached_wrapped_rpc(): @@ -2710,9 +2730,14 @@ async def test_update_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_cluster_async( - transport: str = "grpc_asyncio", request_type=service.UpdateClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateClusterRequest(), + {}, + ], +) +async def test_update_cluster_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2720,7 +2745,7 @@ async def test_update_cluster_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_cluster), "__call__") as call: @@ -2740,11 +2765,6 @@ async def test_update_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_cluster_async_from_dict(): - await test_update_cluster_async(request_type=dict) - - def test_update_cluster_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2913,8 +2933,8 @@ async def test_update_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ExportClusterRequest, - dict, + service.ExportClusterRequest(), + {}, ], ) def test_export_cluster(request_type, transport: str = "grpc"): @@ -2925,7 +2945,7 @@ def test_export_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.export_cluster), "__call__") as call: @@ -2967,10 +2987,11 @@ def test_export_cluster_non_empty_request_with_auto_populated_field(): client.export_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ExportClusterRequest( + request_msg = service.ExportClusterRequest( name="name_value", database="database_value", ) + assert args[0] == request_msg def test_export_cluster_use_cached_wrapped_rpc(): @@ -3061,9 +3082,14 @@ async def test_export_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_export_cluster_async( - transport: str = "grpc_asyncio", request_type=service.ExportClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ExportClusterRequest(), + {}, + ], +) +async def test_export_cluster_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3071,7 +3097,7 @@ async def test_export_cluster_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.export_cluster), "__call__") as call: @@ -3091,11 +3117,6 @@ async def test_export_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_export_cluster_async_from_dict(): - await test_export_cluster_async(request_type=dict) - - def test_export_cluster_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3292,8 +3313,8 @@ async def test_export_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ImportClusterRequest, - dict, + service.ImportClusterRequest(), + {}, ], ) def test_import_cluster(request_type, transport: str = "grpc"): @@ -3304,7 +3325,7 @@ def test_import_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.import_cluster), "__call__") as call: @@ -3348,12 +3369,13 @@ def test_import_cluster_non_empty_request_with_auto_populated_field(): client.import_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ImportClusterRequest( + request_msg = service.ImportClusterRequest( name="name_value", gcs_uri="gcs_uri_value", database="database_value", user="user_value", ) + assert args[0] == request_msg def test_import_cluster_use_cached_wrapped_rpc(): @@ -3444,9 +3466,14 @@ async def test_import_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_import_cluster_async( - transport: str = "grpc_asyncio", request_type=service.ImportClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ImportClusterRequest(), + {}, + ], +) +async def test_import_cluster_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3454,7 +3481,7 @@ async def test_import_cluster_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.import_cluster), "__call__") as call: @@ -3474,11 +3501,6 @@ async def test_import_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_import_cluster_async_from_dict(): - await test_import_cluster_async(request_type=dict) - - def test_import_cluster_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3655,8 +3677,8 @@ async def test_import_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.UpgradeClusterRequest, - dict, + service.UpgradeClusterRequest(), + {}, ], ) def test_upgrade_cluster(request_type, transport: str = "grpc"): @@ -3667,7 +3689,7 @@ def test_upgrade_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.upgrade_cluster), "__call__") as call: @@ -3709,10 +3731,11 @@ def test_upgrade_cluster_non_empty_request_with_auto_populated_field(): client.upgrade_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpgradeClusterRequest( + request_msg = service.UpgradeClusterRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_upgrade_cluster_use_cached_wrapped_rpc(): @@ -3803,9 +3826,14 @@ async def test_upgrade_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_upgrade_cluster_async( - transport: str = "grpc_asyncio", request_type=service.UpgradeClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.UpgradeClusterRequest(), + {}, + ], +) +async def test_upgrade_cluster_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3813,7 +3841,7 @@ async def test_upgrade_cluster_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.upgrade_cluster), "__call__") as call: @@ -3833,11 +3861,6 @@ async def test_upgrade_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_upgrade_cluster_async_from_dict(): - await test_upgrade_cluster_async(request_type=dict) - - def test_upgrade_cluster_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3994,8 +4017,8 @@ async def test_upgrade_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DeleteClusterRequest, - dict, + service.DeleteClusterRequest(), + {}, ], ) def test_delete_cluster(request_type, transport: str = "grpc"): @@ -4006,7 +4029,7 @@ def test_delete_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_cluster), "__call__") as call: @@ -4049,11 +4072,12 @@ def test_delete_cluster_non_empty_request_with_auto_populated_field(): client.delete_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteClusterRequest( + request_msg = service.DeleteClusterRequest( name="name_value", request_id="request_id_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_cluster_use_cached_wrapped_rpc(): @@ -4144,9 +4168,14 @@ async def test_delete_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_cluster_async( - transport: str = "grpc_asyncio", request_type=service.DeleteClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteClusterRequest(), + {}, + ], +) +async def test_delete_cluster_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4154,7 +4183,7 @@ async def test_delete_cluster_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_cluster), "__call__") as call: @@ -4174,11 +4203,6 @@ async def test_delete_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_cluster_async_from_dict(): - await test_delete_cluster_async(request_type=dict) - - def test_delete_cluster_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4325,8 +4349,8 @@ async def test_delete_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.PromoteClusterRequest, - dict, + service.PromoteClusterRequest(), + {}, ], ) def test_promote_cluster(request_type, transport: str = "grpc"): @@ -4337,7 +4361,7 @@ def test_promote_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.promote_cluster), "__call__") as call: @@ -4380,11 +4404,12 @@ def test_promote_cluster_non_empty_request_with_auto_populated_field(): client.promote_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.PromoteClusterRequest( + request_msg = service.PromoteClusterRequest( name="name_value", request_id="request_id_value", etag="etag_value", ) + assert args[0] == request_msg def test_promote_cluster_use_cached_wrapped_rpc(): @@ -4475,9 +4500,14 @@ async def test_promote_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_promote_cluster_async( - transport: str = "grpc_asyncio", request_type=service.PromoteClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.PromoteClusterRequest(), + {}, + ], +) +async def test_promote_cluster_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4485,7 +4515,7 @@ async def test_promote_cluster_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.promote_cluster), "__call__") as call: @@ -4505,11 +4535,6 @@ async def test_promote_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_promote_cluster_async_from_dict(): - await test_promote_cluster_async(request_type=dict) - - def test_promote_cluster_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4656,8 +4681,8 @@ async def test_promote_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.SwitchoverClusterRequest, - dict, + service.SwitchoverClusterRequest(), + {}, ], ) def test_switchover_cluster(request_type, transport: str = "grpc"): @@ -4668,7 +4693,7 @@ def test_switchover_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4714,10 +4739,11 @@ def test_switchover_cluster_non_empty_request_with_auto_populated_field(): client.switchover_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.SwitchoverClusterRequest( + request_msg = service.SwitchoverClusterRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_switchover_cluster_use_cached_wrapped_rpc(): @@ -4812,9 +4838,14 @@ async def test_switchover_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_switchover_cluster_async( - transport: str = "grpc_asyncio", request_type=service.SwitchoverClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.SwitchoverClusterRequest(), + {}, + ], +) +async def test_switchover_cluster_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4822,7 +4853,7 @@ async def test_switchover_cluster_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( @@ -4844,11 +4875,6 @@ async def test_switchover_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_switchover_cluster_async_from_dict(): - await test_switchover_cluster_async(request_type=dict) - - def test_switchover_cluster_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5003,8 +5029,8 @@ async def test_switchover_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.RestoreClusterRequest, - dict, + service.RestoreClusterRequest(), + {}, ], ) def test_restore_cluster(request_type, transport: str = "grpc"): @@ -5015,7 +5041,7 @@ def test_restore_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.restore_cluster), "__call__") as call: @@ -5058,11 +5084,12 @@ def test_restore_cluster_non_empty_request_with_auto_populated_field(): client.restore_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.RestoreClusterRequest( + request_msg = service.RestoreClusterRequest( parent="parent_value", cluster_id="cluster_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_restore_cluster_use_cached_wrapped_rpc(): @@ -5153,9 +5180,14 @@ async def test_restore_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_restore_cluster_async( - transport: str = "grpc_asyncio", request_type=service.RestoreClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.RestoreClusterRequest(), + {}, + ], +) +async def test_restore_cluster_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5163,7 +5195,7 @@ async def test_restore_cluster_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.restore_cluster), "__call__") as call: @@ -5183,11 +5215,6 @@ async def test_restore_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_restore_cluster_async_from_dict(): - await test_restore_cluster_async(request_type=dict) - - def test_restore_cluster_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5252,8 +5279,8 @@ async def test_restore_cluster_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.CreateSecondaryClusterRequest, - dict, + service.CreateSecondaryClusterRequest(), + {}, ], ) def test_create_secondary_cluster(request_type, transport: str = "grpc"): @@ -5264,7 +5291,7 @@ def test_create_secondary_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5311,11 +5338,12 @@ def test_create_secondary_cluster_non_empty_request_with_auto_populated_field(): client.create_secondary_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateSecondaryClusterRequest( + request_msg = service.CreateSecondaryClusterRequest( parent="parent_value", cluster_id="cluster_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_secondary_cluster_use_cached_wrapped_rpc(): @@ -5411,8 +5439,15 @@ async def test_create_secondary_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.CreateSecondaryClusterRequest(), + {}, + ], +) async def test_create_secondary_cluster_async( - transport: str = "grpc_asyncio", request_type=service.CreateSecondaryClusterRequest + request_type, transport: str = "grpc_asyncio" ): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), @@ -5421,7 +5456,7 @@ async def test_create_secondary_cluster_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( @@ -5443,11 +5478,6 @@ async def test_create_secondary_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_secondary_cluster_async_from_dict(): - await test_create_secondary_cluster_async(request_type=dict) - - def test_create_secondary_cluster_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5634,8 +5664,8 @@ async def test_create_secondary_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListInstancesRequest, - dict, + service.ListInstancesRequest(), + {}, ], ) def test_list_instances(request_type, transport: str = "grpc"): @@ -5646,7 +5676,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(type(client.transport.list_instances), "__call__") as call: @@ -5695,12 +5725,13 @@ 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] == service.ListInstancesRequest( + request_msg = service.ListInstancesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_instances_use_cached_wrapped_rpc(): @@ -5781,9 +5812,14 @@ async def test_list_instances_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_instances_async( - transport: str = "grpc_asyncio", request_type=service.ListInstancesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListInstancesRequest(), + {}, + ], +) +async def test_list_instances_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5791,7 +5827,7 @@ async def test_list_instances_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_instances), "__call__") as call: @@ -5816,11 +5852,6 @@ async def test_list_instances_async( 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 = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6157,8 +6188,8 @@ async def test_list_instances_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetInstanceRequest, - dict, + service.GetInstanceRequest(), + {}, ], ) def test_get_instance(request_type, transport: str = "grpc"): @@ -6169,7 +6200,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(type(client.transport.get_instance), "__call__") as call: @@ -6243,9 +6274,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] == service.GetInstanceRequest( + request_msg = service.GetInstanceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_instance_use_cached_wrapped_rpc(): @@ -6326,9 +6358,14 @@ async def test_get_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_instance_async( - transport: str = "grpc_asyncio", request_type=service.GetInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetInstanceRequest(), + {}, + ], +) +async def test_get_instance_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6336,7 +6373,7 @@ async def test_get_instance_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_instance), "__call__") as call: @@ -6389,11 +6426,6 @@ async def test_get_instance_async( assert response.activation_policy == resources.Instance.ActivationPolicy.ALWAYS -@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 = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6536,8 +6568,8 @@ async def test_get_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.CreateInstanceRequest, - dict, + service.CreateInstanceRequest(), + {}, ], ) def test_create_instance(request_type, transport: str = "grpc"): @@ -6548,7 +6580,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(type(client.transport.create_instance), "__call__") as call: @@ -6591,11 +6623,12 @@ 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] == service.CreateInstanceRequest( + request_msg = service.CreateInstanceRequest( parent="parent_value", instance_id="instance_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_instance_use_cached_wrapped_rpc(): @@ -6686,9 +6719,14 @@ async def test_create_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_instance_async( - transport: str = "grpc_asyncio", request_type=service.CreateInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CreateInstanceRequest(), + {}, + ], +) +async def test_create_instance_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6696,7 +6734,7 @@ async def test_create_instance_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_instance), "__call__") as call: @@ -6716,11 +6754,6 @@ async def test_create_instance_async( 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 = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6887,8 +6920,8 @@ async def test_create_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.CreateSecondaryInstanceRequest, - dict, + service.CreateSecondaryInstanceRequest(), + {}, ], ) def test_create_secondary_instance(request_type, transport: str = "grpc"): @@ -6899,7 +6932,7 @@ def test_create_secondary_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( @@ -6946,11 +6979,12 @@ def test_create_secondary_instance_non_empty_request_with_auto_populated_field() client.create_secondary_instance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateSecondaryInstanceRequest( + request_msg = service.CreateSecondaryInstanceRequest( parent="parent_value", instance_id="instance_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_secondary_instance_use_cached_wrapped_rpc(): @@ -7046,8 +7080,15 @@ async def test_create_secondary_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.CreateSecondaryInstanceRequest(), + {}, + ], +) async def test_create_secondary_instance_async( - transport: str = "grpc_asyncio", request_type=service.CreateSecondaryInstanceRequest + request_type, transport: str = "grpc_asyncio" ): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), @@ -7056,7 +7097,7 @@ async def test_create_secondary_instance_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( @@ -7078,11 +7119,6 @@ async def test_create_secondary_instance_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_secondary_instance_async_from_dict(): - await test_create_secondary_instance_async(request_type=dict) - - def test_create_secondary_instance_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7257,8 +7293,8 @@ async def test_create_secondary_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.BatchCreateInstancesRequest, - dict, + service.BatchCreateInstancesRequest(), + {}, ], ) def test_batch_create_instances(request_type, transport: str = "grpc"): @@ -7269,7 +7305,7 @@ def test_batch_create_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( @@ -7315,10 +7351,11 @@ def test_batch_create_instances_non_empty_request_with_auto_populated_field(): client.batch_create_instances(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.BatchCreateInstancesRequest( + request_msg = service.BatchCreateInstancesRequest( parent="parent_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_batch_create_instances_use_cached_wrapped_rpc(): @@ -7414,8 +7451,15 @@ async def test_batch_create_instances_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.BatchCreateInstancesRequest(), + {}, + ], +) async def test_batch_create_instances_async( - transport: str = "grpc_asyncio", request_type=service.BatchCreateInstancesRequest + request_type, transport: str = "grpc_asyncio" ): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), @@ -7424,7 +7468,7 @@ async def test_batch_create_instances_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( @@ -7446,11 +7490,6 @@ async def test_batch_create_instances_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_batch_create_instances_async_from_dict(): - await test_batch_create_instances_async(request_type=dict) - - def test_batch_create_instances_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7519,8 +7558,8 @@ async def test_batch_create_instances_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdateInstanceRequest, - dict, + service.UpdateInstanceRequest(), + {}, ], ) def test_update_instance(request_type, transport: str = "grpc"): @@ -7531,7 +7570,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(type(client.transport.update_instance), "__call__") as call: @@ -7572,9 +7611,10 @@ 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] == service.UpdateInstanceRequest( + request_msg = service.UpdateInstanceRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_instance_use_cached_wrapped_rpc(): @@ -7665,9 +7705,14 @@ async def test_update_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_instance_async( - transport: str = "grpc_asyncio", request_type=service.UpdateInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateInstanceRequest(), + {}, + ], +) +async def test_update_instance_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7675,7 +7720,7 @@ async def test_update_instance_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_instance), "__call__") as call: @@ -7695,11 +7740,6 @@ async def test_update_instance_async( 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 = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7856,8 +7896,8 @@ async def test_update_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DeleteInstanceRequest, - dict, + service.DeleteInstanceRequest(), + {}, ], ) def test_delete_instance(request_type, transport: str = "grpc"): @@ -7868,7 +7908,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(type(client.transport.delete_instance), "__call__") as call: @@ -7911,11 +7951,12 @@ 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] == service.DeleteInstanceRequest( + request_msg = service.DeleteInstanceRequest( name="name_value", request_id="request_id_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_instance_use_cached_wrapped_rpc(): @@ -8006,9 +8047,14 @@ async def test_delete_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_instance_async( - transport: str = "grpc_asyncio", request_type=service.DeleteInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteInstanceRequest(), + {}, + ], +) +async def test_delete_instance_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8016,7 +8062,7 @@ async def test_delete_instance_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_instance), "__call__") as call: @@ -8036,11 +8082,6 @@ async def test_delete_instance_async( 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 = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8187,8 +8228,8 @@ async def test_delete_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.FailoverInstanceRequest, - dict, + service.FailoverInstanceRequest(), + {}, ], ) def test_failover_instance(request_type, transport: str = "grpc"): @@ -8199,7 +8240,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( @@ -8245,10 +8286,11 @@ 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] == service.FailoverInstanceRequest( + request_msg = service.FailoverInstanceRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_failover_instance_use_cached_wrapped_rpc(): @@ -8341,9 +8383,14 @@ async def test_failover_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_failover_instance_async( - transport: str = "grpc_asyncio", request_type=service.FailoverInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.FailoverInstanceRequest(), + {}, + ], +) +async def test_failover_instance_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8351,7 +8398,7 @@ async def test_failover_instance_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( @@ -8373,11 +8420,6 @@ async def test_failover_instance_async( 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 = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8532,8 +8574,8 @@ async def test_failover_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.InjectFaultRequest, - dict, + service.InjectFaultRequest(), + {}, ], ) def test_inject_fault(request_type, transport: str = "grpc"): @@ -8544,7 +8586,7 @@ def test_inject_fault(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.inject_fault), "__call__") as call: @@ -8586,10 +8628,11 @@ def test_inject_fault_non_empty_request_with_auto_populated_field(): client.inject_fault(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.InjectFaultRequest( + request_msg = service.InjectFaultRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_inject_fault_use_cached_wrapped_rpc(): @@ -8680,9 +8723,14 @@ async def test_inject_fault_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_inject_fault_async( - transport: str = "grpc_asyncio", request_type=service.InjectFaultRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.InjectFaultRequest(), + {}, + ], +) +async def test_inject_fault_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8690,7 +8738,7 @@ async def test_inject_fault_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.inject_fault), "__call__") as call: @@ -8710,11 +8758,6 @@ async def test_inject_fault_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_inject_fault_async_from_dict(): - await test_inject_fault_async(request_type=dict) - - def test_inject_fault_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8871,8 +8914,8 @@ async def test_inject_fault_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.RestartInstanceRequest, - dict, + service.RestartInstanceRequest(), + {}, ], ) def test_restart_instance(request_type, transport: str = "grpc"): @@ -8883,7 +8926,7 @@ def test_restart_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(type(client.transport.restart_instance), "__call__") as call: @@ -8925,10 +8968,11 @@ def test_restart_instance_non_empty_request_with_auto_populated_field(): client.restart_instance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.RestartInstanceRequest( + request_msg = service.RestartInstanceRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_restart_instance_use_cached_wrapped_rpc(): @@ -9021,9 +9065,14 @@ async def test_restart_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_restart_instance_async( - transport: str = "grpc_asyncio", request_type=service.RestartInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.RestartInstanceRequest(), + {}, + ], +) +async def test_restart_instance_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9031,7 +9080,7 @@ async def test_restart_instance_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.restart_instance), "__call__") as call: @@ -9051,11 +9100,6 @@ async def test_restart_instance_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_restart_instance_async_from_dict(): - await test_restart_instance_async(request_type=dict) - - def test_restart_instance_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9202,8 +9246,8 @@ async def test_restart_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ExecuteSqlRequest, - dict, + service.ExecuteSqlRequest(), + {}, ], ) def test_execute_sql(request_type, transport: str = "grpc"): @@ -9214,7 +9258,7 @@ def test_execute_sql(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.execute_sql), "__call__") as call: @@ -9259,13 +9303,14 @@ def test_execute_sql_non_empty_request_with_auto_populated_field(): client.execute_sql(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ExecuteSqlRequest( + request_msg = service.ExecuteSqlRequest( password="password_value", instance="instance_value", database="database_value", user="user_value", sql_statement="sql_statement_value", ) + assert args[0] == request_msg def test_execute_sql_use_cached_wrapped_rpc(): @@ -9346,9 +9391,14 @@ async def test_execute_sql_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_execute_sql_async( - transport: str = "grpc_asyncio", request_type=service.ExecuteSqlRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ExecuteSqlRequest(), + {}, + ], +) +async def test_execute_sql_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9356,7 +9406,7 @@ async def test_execute_sql_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.execute_sql), "__call__") as call: @@ -9376,11 +9426,6 @@ async def test_execute_sql_async( assert isinstance(response, service.ExecuteSqlResponse) -@pytest.mark.asyncio -async def test_execute_sql_async_from_dict(): - await test_execute_sql_async(request_type=dict) - - def test_execute_sql_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9563,8 +9608,8 @@ async def test_execute_sql_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListBackupsRequest, - dict, + service.ListBackupsRequest(), + {}, ], ) def test_list_backups(request_type, transport: str = "grpc"): @@ -9575,7 +9620,7 @@ def test_list_backups(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_backups), "__call__") as call: @@ -9624,12 +9669,13 @@ def test_list_backups_non_empty_request_with_auto_populated_field(): client.list_backups(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListBackupsRequest( + request_msg = service.ListBackupsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_backups_use_cached_wrapped_rpc(): @@ -9710,9 +9756,14 @@ async def test_list_backups_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_backups_async( - transport: str = "grpc_asyncio", request_type=service.ListBackupsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListBackupsRequest(), + {}, + ], +) +async def test_list_backups_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9720,7 +9771,7 @@ async def test_list_backups_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_backups), "__call__") as call: @@ -9745,11 +9796,6 @@ async def test_list_backups_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_backups_async_from_dict(): - await test_list_backups_async(request_type=dict) - - def test_list_backups_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10086,8 +10132,8 @@ async def test_list_backups_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetBackupRequest, - dict, + service.GetBackupRequest(), + {}, ], ) def test_get_backup(request_type, transport: str = "grpc"): @@ -10098,7 +10144,7 @@ def test_get_backup(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_backup), "__call__") as call: @@ -10168,9 +10214,10 @@ def test_get_backup_non_empty_request_with_auto_populated_field(): client.get_backup(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetBackupRequest( + request_msg = service.GetBackupRequest( name="name_value", ) + assert args[0] == request_msg def test_get_backup_use_cached_wrapped_rpc(): @@ -10249,9 +10296,14 @@ async def test_get_backup_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_backup_async( - transport: str = "grpc_asyncio", request_type=service.GetBackupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetBackupRequest(), + {}, + ], +) +async def test_get_backup_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10259,7 +10311,7 @@ async def test_get_backup_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_backup), "__call__") as call: @@ -10308,11 +10360,6 @@ async def test_get_backup_async( assert response.database_version == resources.DatabaseVersion.POSTGRES_13 -@pytest.mark.asyncio -async def test_get_backup_async_from_dict(): - await test_get_backup_async(request_type=dict) - - def test_get_backup_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10455,8 +10502,8 @@ async def test_get_backup_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.CreateBackupRequest, - dict, + service.CreateBackupRequest(), + {}, ], ) def test_create_backup(request_type, transport: str = "grpc"): @@ -10467,7 +10514,7 @@ def test_create_backup(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_backup), "__call__") as call: @@ -10510,11 +10557,12 @@ def test_create_backup_non_empty_request_with_auto_populated_field(): client.create_backup(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateBackupRequest( + request_msg = service.CreateBackupRequest( parent="parent_value", backup_id="backup_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_backup_use_cached_wrapped_rpc(): @@ -10605,9 +10653,14 @@ async def test_create_backup_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_backup_async( - transport: str = "grpc_asyncio", request_type=service.CreateBackupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CreateBackupRequest(), + {}, + ], +) +async def test_create_backup_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10615,7 +10668,7 @@ async def test_create_backup_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_backup), "__call__") as call: @@ -10635,11 +10688,6 @@ async def test_create_backup_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_backup_async_from_dict(): - await test_create_backup_async(request_type=dict) - - def test_create_backup_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10806,8 +10854,8 @@ async def test_create_backup_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdateBackupRequest, - dict, + service.UpdateBackupRequest(), + {}, ], ) def test_update_backup(request_type, transport: str = "grpc"): @@ -10818,7 +10866,7 @@ def test_update_backup(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_backup), "__call__") as call: @@ -10859,9 +10907,10 @@ def test_update_backup_non_empty_request_with_auto_populated_field(): client.update_backup(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateBackupRequest( + request_msg = service.UpdateBackupRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_backup_use_cached_wrapped_rpc(): @@ -10952,9 +11001,14 @@ async def test_update_backup_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_backup_async( - transport: str = "grpc_asyncio", request_type=service.UpdateBackupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateBackupRequest(), + {}, + ], +) +async def test_update_backup_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10962,7 +11016,7 @@ async def test_update_backup_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_backup), "__call__") as call: @@ -10982,11 +11036,6 @@ async def test_update_backup_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_backup_async_from_dict(): - await test_update_backup_async(request_type=dict) - - def test_update_backup_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11143,8 +11192,8 @@ async def test_update_backup_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DeleteBackupRequest, - dict, + service.DeleteBackupRequest(), + {}, ], ) def test_delete_backup(request_type, transport: str = "grpc"): @@ -11155,7 +11204,7 @@ def test_delete_backup(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_backup), "__call__") as call: @@ -11198,11 +11247,12 @@ def test_delete_backup_non_empty_request_with_auto_populated_field(): client.delete_backup(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteBackupRequest( + request_msg = service.DeleteBackupRequest( name="name_value", request_id="request_id_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_backup_use_cached_wrapped_rpc(): @@ -11293,9 +11343,14 @@ async def test_delete_backup_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_backup_async( - transport: str = "grpc_asyncio", request_type=service.DeleteBackupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteBackupRequest(), + {}, + ], +) +async def test_delete_backup_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11303,7 +11358,7 @@ async def test_delete_backup_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_backup), "__call__") as call: @@ -11323,11 +11378,6 @@ async def test_delete_backup_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_backup_async_from_dict(): - await test_delete_backup_async(request_type=dict) - - def test_delete_backup_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11474,8 +11524,8 @@ async def test_delete_backup_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListSupportedDatabaseFlagsRequest, - dict, + service.ListSupportedDatabaseFlagsRequest(), + {}, ], ) def test_list_supported_database_flags(request_type, transport: str = "grpc"): @@ -11486,7 +11536,7 @@ def test_list_supported_database_flags(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11535,10 +11585,11 @@ def test_list_supported_database_flags_non_empty_request_with_auto_populated_fie client.list_supported_database_flags(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListSupportedDatabaseFlagsRequest( + request_msg = service.ListSupportedDatabaseFlagsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_supported_database_flags_use_cached_wrapped_rpc(): @@ -11624,9 +11675,15 @@ async def test_list_supported_database_flags_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.ListSupportedDatabaseFlagsRequest(), + {}, + ], +) async def test_list_supported_database_flags_async( - transport: str = "grpc_asyncio", - request_type=service.ListSupportedDatabaseFlagsRequest, + request_type, transport: str = "grpc_asyncio" ): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), @@ -11635,7 +11692,7 @@ async def test_list_supported_database_flags_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( @@ -11660,11 +11717,6 @@ async def test_list_supported_database_flags_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_supported_database_flags_async_from_dict(): - await test_list_supported_database_flags_async(request_type=dict) - - def test_list_supported_database_flags_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12021,8 +12073,8 @@ async def test_list_supported_database_flags_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GenerateClientCertificateRequest, - dict, + service.GenerateClientCertificateRequest(), + {}, ], ) def test_generate_client_certificate(request_type, transport: str = "grpc"): @@ -12033,7 +12085,7 @@ def test_generate_client_certificate(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -12088,12 +12140,13 @@ def test_generate_client_certificate_non_empty_request_with_auto_populated_field client.generate_client_certificate(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GenerateClientCertificateRequest( + request_msg = service.GenerateClientCertificateRequest( parent="parent_value", request_id="request_id_value", pem_csr="pem_csr_value", public_key="public_key_value", ) + assert args[0] == request_msg def test_generate_client_certificate_use_cached_wrapped_rpc(): @@ -12179,9 +12232,15 @@ async def test_generate_client_certificate_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.GenerateClientCertificateRequest(), + {}, + ], +) async def test_generate_client_certificate_async( - transport: str = "grpc_asyncio", - request_type=service.GenerateClientCertificateRequest, + request_type, transport: str = "grpc_asyncio" ): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), @@ -12190,7 +12249,7 @@ async def test_generate_client_certificate_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( @@ -12219,11 +12278,6 @@ async def test_generate_client_certificate_async( assert response.ca_cert == "ca_cert_value" -@pytest.mark.asyncio -async def test_generate_client_certificate_async_from_dict(): - await test_generate_client_certificate_async(request_type=dict) - - def test_generate_client_certificate_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12378,8 +12432,8 @@ async def test_generate_client_certificate_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.GetConnectionInfoRequest, - dict, + service.GetConnectionInfoRequest(), + {}, ], ) def test_get_connection_info(request_type, transport: str = "grpc"): @@ -12390,7 +12444,7 @@ def test_get_connection_info(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -12449,10 +12503,11 @@ def test_get_connection_info_non_empty_request_with_auto_populated_field(): client.get_connection_info(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetConnectionInfoRequest( + request_msg = service.GetConnectionInfoRequest( parent="parent_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_get_connection_info_use_cached_wrapped_rpc(): @@ -12537,9 +12592,14 @@ async def test_get_connection_info_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_connection_info_async( - transport: str = "grpc_asyncio", request_type=service.GetConnectionInfoRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetConnectionInfoRequest(), + {}, + ], +) +async def test_get_connection_info_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12547,7 +12607,7 @@ async def test_get_connection_info_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( @@ -12582,11 +12642,6 @@ async def test_get_connection_info_async( assert response.psc_dns_name == "psc_dns_name_value" -@pytest.mark.asyncio -async def test_get_connection_info_async_from_dict(): - await test_get_connection_info_async(request_type=dict) - - def test_get_connection_info_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12741,8 +12796,8 @@ async def test_get_connection_info_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListUsersRequest, - dict, + service.ListUsersRequest(), + {}, ], ) def test_list_users(request_type, transport: str = "grpc"): @@ -12753,7 +12808,7 @@ def test_list_users(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_users), "__call__") as call: @@ -12802,12 +12857,13 @@ def test_list_users_non_empty_request_with_auto_populated_field(): client.list_users(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListUsersRequest( + request_msg = service.ListUsersRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_users_use_cached_wrapped_rpc(): @@ -12886,9 +12942,14 @@ async def test_list_users_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_list_users_async( - transport: str = "grpc_asyncio", request_type=service.ListUsersRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListUsersRequest(), + {}, + ], +) +async def test_list_users_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12896,7 +12957,7 @@ async def test_list_users_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_users), "__call__") as call: @@ -12921,11 +12982,6 @@ async def test_list_users_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_users_async_from_dict(): - await test_list_users_async(request_type=dict) - - def test_list_users_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13262,8 +13318,8 @@ async def test_list_users_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetUserRequest, - dict, + service.GetUserRequest(), + {}, ], ) def test_get_user(request_type, transport: str = "grpc"): @@ -13274,7 +13330,7 @@ def test_get_user(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_user), "__call__") as call: @@ -13326,9 +13382,10 @@ def test_get_user_non_empty_request_with_auto_populated_field(): client.get_user(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetUserRequest( + request_msg = service.GetUserRequest( name="name_value", ) + assert args[0] == request_msg def test_get_user_use_cached_wrapped_rpc(): @@ -13407,9 +13464,14 @@ async def test_get_user_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn @pytest.mark.asyncio -async def test_get_user_async( - transport: str = "grpc_asyncio", request_type=service.GetUserRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetUserRequest(), + {}, + ], +) +async def test_get_user_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13417,7 +13479,7 @@ async def test_get_user_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_user), "__call__") as call: @@ -13448,11 +13510,6 @@ async def test_get_user_async( assert response.keep_extra_roles is True -@pytest.mark.asyncio -async def test_get_user_async_from_dict(): - await test_get_user_async(request_type=dict) - - def test_get_user_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13595,8 +13652,8 @@ async def test_get_user_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.CreateUserRequest, - dict, + service.CreateUserRequest(), + {}, ], ) def test_create_user(request_type, transport: str = "grpc"): @@ -13607,7 +13664,7 @@ def test_create_user(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_user), "__call__") as call: @@ -13661,11 +13718,12 @@ def test_create_user_non_empty_request_with_auto_populated_field(): client.create_user(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateUserRequest( + request_msg = service.CreateUserRequest( parent="parent_value", user_id="user_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_user_use_cached_wrapped_rpc(): @@ -13746,9 +13804,14 @@ async def test_create_user_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_user_async( - transport: str = "grpc_asyncio", request_type=service.CreateUserRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CreateUserRequest(), + {}, + ], +) +async def test_create_user_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13756,7 +13819,7 @@ async def test_create_user_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_user), "__call__") as call: @@ -13787,11 +13850,6 @@ async def test_create_user_async( assert response.keep_extra_roles is True -@pytest.mark.asyncio -async def test_create_user_async_from_dict(): - await test_create_user_async(request_type=dict) - - def test_create_user_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13954,8 +14012,8 @@ async def test_create_user_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdateUserRequest, - dict, + service.UpdateUserRequest(), + {}, ], ) def test_update_user(request_type, transport: str = "grpc"): @@ -13966,7 +14024,7 @@ def test_update_user(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_user), "__call__") as call: @@ -14018,9 +14076,10 @@ def test_update_user_non_empty_request_with_auto_populated_field(): client.update_user(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateUserRequest( + request_msg = service.UpdateUserRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_user_use_cached_wrapped_rpc(): @@ -14101,9 +14160,14 @@ async def test_update_user_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_user_async( - transport: str = "grpc_asyncio", request_type=service.UpdateUserRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateUserRequest(), + {}, + ], +) +async def test_update_user_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14111,7 +14175,7 @@ async def test_update_user_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_user), "__call__") as call: @@ -14142,11 +14206,6 @@ async def test_update_user_async( assert response.keep_extra_roles is True -@pytest.mark.asyncio -async def test_update_user_async_from_dict(): - await test_update_user_async(request_type=dict) - - def test_update_user_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14299,8 +14358,8 @@ async def test_update_user_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DeleteUserRequest, - dict, + service.DeleteUserRequest(), + {}, ], ) def test_delete_user(request_type, transport: str = "grpc"): @@ -14311,7 +14370,7 @@ def test_delete_user(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_user), "__call__") as call: @@ -14353,10 +14412,11 @@ def test_delete_user_non_empty_request_with_auto_populated_field(): client.delete_user(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteUserRequest( + request_msg = service.DeleteUserRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_user_use_cached_wrapped_rpc(): @@ -14437,9 +14497,14 @@ async def test_delete_user_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_user_async( - transport: str = "grpc_asyncio", request_type=service.DeleteUserRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteUserRequest(), + {}, + ], +) +async def test_delete_user_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14447,7 +14512,7 @@ async def test_delete_user_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_user), "__call__") as call: @@ -14465,11 +14530,6 @@ async def test_delete_user_async( assert response is None -@pytest.mark.asyncio -async def test_delete_user_async_from_dict(): - await test_delete_user_async(request_type=dict) - - def test_delete_user_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14612,8 +14672,8 @@ async def test_delete_user_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListDatabasesRequest, - dict, + service.ListDatabasesRequest(), + {}, ], ) def test_list_databases(request_type, transport: str = "grpc"): @@ -14624,7 +14684,7 @@ def test_list_databases(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_databases), "__call__") as call: @@ -14670,11 +14730,12 @@ def test_list_databases_non_empty_request_with_auto_populated_field(): client.list_databases(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListDatabasesRequest( + request_msg = service.ListDatabasesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_databases_use_cached_wrapped_rpc(): @@ -14755,9 +14816,14 @@ async def test_list_databases_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_databases_async( - transport: str = "grpc_asyncio", request_type=service.ListDatabasesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListDatabasesRequest(), + {}, + ], +) +async def test_list_databases_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14765,7 +14831,7 @@ async def test_list_databases_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_databases), "__call__") as call: @@ -14788,11 +14854,6 @@ async def test_list_databases_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_databases_async_from_dict(): - await test_list_databases_async(request_type=dict) - - def test_list_databases_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15129,8 +15190,8 @@ async def test_list_databases_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.CreateDatabaseRequest, - dict, + service.CreateDatabaseRequest(), + {}, ], ) def test_create_database(request_type, transport: str = "grpc"): @@ -15141,7 +15202,7 @@ def test_create_database(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_database), "__call__") as call: @@ -15198,10 +15259,11 @@ def test_create_database_non_empty_request_with_auto_populated_field(): client.create_database(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateDatabaseRequest( + request_msg = service.CreateDatabaseRequest( parent="parent_value", database_id="database_id_value", ) + assert args[0] == request_msg def test_create_database_use_cached_wrapped_rpc(): @@ -15282,9 +15344,14 @@ async def test_create_database_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_database_async( - transport: str = "grpc_asyncio", request_type=service.CreateDatabaseRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CreateDatabaseRequest(), + {}, + ], +) +async def test_create_database_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -15292,7 +15359,7 @@ async def test_create_database_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_database), "__call__") as call: @@ -15327,11 +15394,6 @@ async def test_create_database_async( assert response.is_template_database is True -@pytest.mark.asyncio -async def test_create_database_async_from_dict(): - await test_create_database_async(request_type=dict) - - def test_create_database_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -23318,7 +23380,6 @@ def test_list_clusters_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListClustersRequest() - assert args[0] == request_msg @@ -23339,7 +23400,6 @@ def test_get_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetClusterRequest() - assert args[0] == request_msg @@ -23360,7 +23420,6 @@ def test_create_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateClusterRequest() - assert args[0] == request_msg @@ -23381,7 +23440,6 @@ def test_update_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateClusterRequest() - assert args[0] == request_msg @@ -23402,7 +23460,6 @@ def test_export_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ExportClusterRequest() - assert args[0] == request_msg @@ -23423,7 +23480,6 @@ def test_import_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ImportClusterRequest() - assert args[0] == request_msg @@ -23444,7 +23500,6 @@ def test_upgrade_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpgradeClusterRequest() - assert args[0] == request_msg @@ -23465,7 +23520,6 @@ def test_delete_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteClusterRequest() - assert args[0] == request_msg @@ -23486,7 +23540,6 @@ def test_promote_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.PromoteClusterRequest() - assert args[0] == request_msg @@ -23509,7 +23562,6 @@ def test_switchover_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.SwitchoverClusterRequest() - assert args[0] == request_msg @@ -23530,7 +23582,6 @@ def test_restore_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.RestoreClusterRequest() - assert args[0] == request_msg @@ -23553,7 +23604,6 @@ def test_create_secondary_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateSecondaryClusterRequest() - assert args[0] == request_msg @@ -23574,7 +23624,6 @@ def test_list_instances_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListInstancesRequest() - assert args[0] == request_msg @@ -23595,7 +23644,6 @@ def test_get_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetInstanceRequest() - assert args[0] == request_msg @@ -23616,7 +23664,6 @@ def test_create_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateInstanceRequest() - assert args[0] == request_msg @@ -23639,7 +23686,6 @@ def test_create_secondary_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateSecondaryInstanceRequest() - assert args[0] == request_msg @@ -23662,7 +23708,6 @@ def test_batch_create_instances_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.BatchCreateInstancesRequest() - assert args[0] == request_msg @@ -23683,7 +23728,6 @@ def test_update_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateInstanceRequest() - assert args[0] == request_msg @@ -23704,7 +23748,6 @@ def test_delete_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteInstanceRequest() - assert args[0] == request_msg @@ -23727,7 +23770,6 @@ def test_failover_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.FailoverInstanceRequest() - assert args[0] == request_msg @@ -23748,7 +23790,6 @@ def test_inject_fault_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.InjectFaultRequest() - assert args[0] == request_msg @@ -23769,7 +23810,6 @@ def test_restart_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.RestartInstanceRequest() - assert args[0] == request_msg @@ -23790,7 +23830,6 @@ def test_execute_sql_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ExecuteSqlRequest() - assert args[0] == request_msg @@ -23811,7 +23850,6 @@ def test_list_backups_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListBackupsRequest() - assert args[0] == request_msg @@ -23832,7 +23870,6 @@ def test_get_backup_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetBackupRequest() - assert args[0] == request_msg @@ -23853,7 +23890,6 @@ def test_create_backup_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateBackupRequest() - assert args[0] == request_msg @@ -23874,7 +23910,6 @@ def test_update_backup_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateBackupRequest() - assert args[0] == request_msg @@ -23895,7 +23930,6 @@ def test_delete_backup_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteBackupRequest() - assert args[0] == request_msg @@ -23918,7 +23952,6 @@ def test_list_supported_database_flags_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListSupportedDatabaseFlagsRequest() - assert args[0] == request_msg @@ -23941,7 +23974,6 @@ def test_generate_client_certificate_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GenerateClientCertificateRequest() - assert args[0] == request_msg @@ -23964,7 +23996,6 @@ def test_get_connection_info_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetConnectionInfoRequest() - assert args[0] == request_msg @@ -23985,7 +24016,6 @@ def test_list_users_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListUsersRequest() - assert args[0] == request_msg @@ -24006,7 +24036,6 @@ def test_get_user_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetUserRequest() - assert args[0] == request_msg @@ -24027,7 +24056,6 @@ def test_create_user_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateUserRequest() - assert args[0] == request_msg @@ -24048,7 +24076,6 @@ def test_update_user_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateUserRequest() - assert args[0] == request_msg @@ -24069,7 +24096,6 @@ def test_delete_user_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteUserRequest() - assert args[0] == request_msg @@ -24090,7 +24116,6 @@ def test_list_databases_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListDatabasesRequest() - assert args[0] == request_msg @@ -24111,7 +24136,6 @@ def test_create_database_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateDatabaseRequest() - assert args[0] == request_msg @@ -24153,7 +24177,6 @@ async def test_list_clusters_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListClustersRequest() - assert args[0] == request_msg @@ -24192,7 +24215,6 @@ async def test_get_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetClusterRequest() - assert args[0] == request_msg @@ -24217,7 +24239,6 @@ async def test_create_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateClusterRequest() - assert args[0] == request_msg @@ -24242,7 +24263,6 @@ async def test_update_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateClusterRequest() - assert args[0] == request_msg @@ -24267,7 +24287,6 @@ async def test_export_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ExportClusterRequest() - assert args[0] == request_msg @@ -24292,7 +24311,6 @@ async def test_import_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ImportClusterRequest() - assert args[0] == request_msg @@ -24317,7 +24335,6 @@ async def test_upgrade_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpgradeClusterRequest() - assert args[0] == request_msg @@ -24342,7 +24359,6 @@ async def test_delete_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteClusterRequest() - assert args[0] == request_msg @@ -24367,7 +24383,6 @@ async def test_promote_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.PromoteClusterRequest() - assert args[0] == request_msg @@ -24394,7 +24409,6 @@ async def test_switchover_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.SwitchoverClusterRequest() - assert args[0] == request_msg @@ -24419,7 +24433,6 @@ async def test_restore_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.RestoreClusterRequest() - assert args[0] == request_msg @@ -24446,7 +24459,6 @@ async def test_create_secondary_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateSecondaryClusterRequest() - assert args[0] == request_msg @@ -24474,7 +24486,6 @@ async def test_list_instances_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListInstancesRequest() - assert args[0] == request_msg @@ -24515,7 +24526,6 @@ async def test_get_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetInstanceRequest() - assert args[0] == request_msg @@ -24540,7 +24550,6 @@ async def test_create_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateInstanceRequest() - assert args[0] == request_msg @@ -24567,7 +24576,6 @@ async def test_create_secondary_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateSecondaryInstanceRequest() - assert args[0] == request_msg @@ -24594,7 +24602,6 @@ async def test_batch_create_instances_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.BatchCreateInstancesRequest() - assert args[0] == request_msg @@ -24619,7 +24626,6 @@ async def test_update_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateInstanceRequest() - assert args[0] == request_msg @@ -24644,7 +24650,6 @@ async def test_delete_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteInstanceRequest() - assert args[0] == request_msg @@ -24671,7 +24676,6 @@ async def test_failover_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.FailoverInstanceRequest() - assert args[0] == request_msg @@ -24696,7 +24700,6 @@ async def test_inject_fault_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.InjectFaultRequest() - assert args[0] == request_msg @@ -24721,7 +24724,6 @@ async def test_restart_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.RestartInstanceRequest() - assert args[0] == request_msg @@ -24746,7 +24748,6 @@ async def test_execute_sql_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ExecuteSqlRequest() - assert args[0] == request_msg @@ -24774,7 +24775,6 @@ async def test_list_backups_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListBackupsRequest() - assert args[0] == request_msg @@ -24814,7 +24814,6 @@ async def test_get_backup_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetBackupRequest() - assert args[0] == request_msg @@ -24839,7 +24838,6 @@ async def test_create_backup_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateBackupRequest() - assert args[0] == request_msg @@ -24864,7 +24862,6 @@ async def test_update_backup_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateBackupRequest() - assert args[0] == request_msg @@ -24889,7 +24886,6 @@ async def test_delete_backup_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteBackupRequest() - assert args[0] == request_msg @@ -24918,7 +24914,6 @@ async def test_list_supported_database_flags_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListSupportedDatabaseFlagsRequest() - assert args[0] == request_msg @@ -24949,7 +24944,6 @@ async def test_generate_client_certificate_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GenerateClientCertificateRequest() - assert args[0] == request_msg @@ -24983,7 +24977,6 @@ async def test_get_connection_info_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetConnectionInfoRequest() - assert args[0] == request_msg @@ -25011,7 +25004,6 @@ async def test_list_users_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListUsersRequest() - assert args[0] == request_msg @@ -25042,7 +25034,6 @@ async def test_get_user_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetUserRequest() - assert args[0] == request_msg @@ -25073,7 +25064,6 @@ async def test_create_user_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateUserRequest() - assert args[0] == request_msg @@ -25104,7 +25094,6 @@ async def test_update_user_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateUserRequest() - assert args[0] == request_msg @@ -25127,7 +25116,6 @@ async def test_delete_user_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteUserRequest() - assert args[0] == request_msg @@ -25154,7 +25142,6 @@ async def test_list_databases_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListDatabasesRequest() - assert args[0] == request_msg @@ -25187,7 +25174,6 @@ async def test_create_database_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateDatabaseRequest() - assert args[0] == request_msg @@ -32075,7 +32061,6 @@ def test_list_clusters_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListClustersRequest() - assert args[0] == request_msg @@ -32095,7 +32080,6 @@ def test_get_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetClusterRequest() - assert args[0] == request_msg @@ -32115,7 +32099,6 @@ def test_create_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateClusterRequest() - assert args[0] == request_msg @@ -32135,7 +32118,6 @@ def test_update_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateClusterRequest() - assert args[0] == request_msg @@ -32155,7 +32137,6 @@ def test_export_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ExportClusterRequest() - assert args[0] == request_msg @@ -32175,7 +32156,6 @@ def test_import_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ImportClusterRequest() - assert args[0] == request_msg @@ -32195,7 +32175,6 @@ def test_upgrade_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpgradeClusterRequest() - assert args[0] == request_msg @@ -32215,7 +32194,6 @@ def test_delete_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteClusterRequest() - assert args[0] == request_msg @@ -32235,7 +32213,6 @@ def test_promote_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.PromoteClusterRequest() - assert args[0] == request_msg @@ -32257,7 +32234,6 @@ def test_switchover_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.SwitchoverClusterRequest() - assert args[0] == request_msg @@ -32277,7 +32253,6 @@ def test_restore_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.RestoreClusterRequest() - assert args[0] == request_msg @@ -32299,7 +32274,6 @@ def test_create_secondary_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateSecondaryClusterRequest() - assert args[0] == request_msg @@ -32319,7 +32293,6 @@ def test_list_instances_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListInstancesRequest() - assert args[0] == request_msg @@ -32339,7 +32312,6 @@ def test_get_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetInstanceRequest() - assert args[0] == request_msg @@ -32359,7 +32331,6 @@ def test_create_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateInstanceRequest() - assert args[0] == request_msg @@ -32381,7 +32352,6 @@ def test_create_secondary_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateSecondaryInstanceRequest() - assert args[0] == request_msg @@ -32403,7 +32373,6 @@ def test_batch_create_instances_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.BatchCreateInstancesRequest() - assert args[0] == request_msg @@ -32423,7 +32392,6 @@ def test_update_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateInstanceRequest() - assert args[0] == request_msg @@ -32443,7 +32411,6 @@ def test_delete_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteInstanceRequest() - assert args[0] == request_msg @@ -32465,7 +32432,6 @@ def test_failover_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.FailoverInstanceRequest() - assert args[0] == request_msg @@ -32485,7 +32451,6 @@ def test_inject_fault_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.InjectFaultRequest() - assert args[0] == request_msg @@ -32505,7 +32470,6 @@ def test_restart_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.RestartInstanceRequest() - assert args[0] == request_msg @@ -32525,7 +32489,6 @@ def test_execute_sql_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ExecuteSqlRequest() - assert args[0] == request_msg @@ -32545,7 +32508,6 @@ def test_list_backups_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListBackupsRequest() - assert args[0] == request_msg @@ -32565,7 +32527,6 @@ def test_get_backup_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetBackupRequest() - assert args[0] == request_msg @@ -32585,7 +32546,6 @@ def test_create_backup_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateBackupRequest() - assert args[0] == request_msg @@ -32605,7 +32565,6 @@ def test_update_backup_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateBackupRequest() - assert args[0] == request_msg @@ -32625,7 +32584,6 @@ def test_delete_backup_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteBackupRequest() - assert args[0] == request_msg @@ -32647,7 +32605,6 @@ def test_list_supported_database_flags_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListSupportedDatabaseFlagsRequest() - assert args[0] == request_msg @@ -32669,7 +32626,6 @@ def test_generate_client_certificate_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GenerateClientCertificateRequest() - assert args[0] == request_msg @@ -32691,7 +32647,6 @@ def test_get_connection_info_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetConnectionInfoRequest() - assert args[0] == request_msg @@ -32711,7 +32666,6 @@ def test_list_users_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListUsersRequest() - assert args[0] == request_msg @@ -32731,7 +32685,6 @@ def test_get_user_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetUserRequest() - assert args[0] == request_msg @@ -32751,7 +32704,6 @@ def test_create_user_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateUserRequest() - assert args[0] == request_msg @@ -32771,7 +32723,6 @@ def test_update_user_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateUserRequest() - assert args[0] == request_msg @@ -32791,7 +32742,6 @@ def test_delete_user_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteUserRequest() - assert args[0] == request_msg @@ -32811,7 +32761,6 @@ def test_list_databases_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListDatabasesRequest() - assert args[0] == request_msg @@ -32831,7 +32780,6 @@ def test_create_database_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateDatabaseRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-alloydb/tests/unit/gapic/alloydb_v1alpha/test_alloy_dbcsql_admin.py b/packages/google-cloud-alloydb/tests/unit/gapic/alloydb_v1alpha/test_alloy_dbcsql_admin.py index e01821526c62..cc4dc6d3774f 100644 --- a/packages/google-cloud-alloydb/tests/unit/gapic/alloydb_v1alpha/test_alloy_dbcsql_admin.py +++ b/packages/google-cloud-alloydb/tests/unit/gapic/alloydb_v1alpha/test_alloy_dbcsql_admin.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 @@ -128,6 +129,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" @@ -1361,8 +1377,8 @@ def test_alloy_dbcsql_admin_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - csql_service.RestoreFromCloudSQLRequest, - dict, + csql_service.RestoreFromCloudSQLRequest(), + {}, ], ) def test_restore_from_cloud_sql(request_type, transport: str = "grpc"): @@ -1373,7 +1389,7 @@ def test_restore_from_cloud_sql(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1419,10 +1435,11 @@ def test_restore_from_cloud_sql_non_empty_request_with_auto_populated_field(): client.restore_from_cloud_sql(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == csql_service.RestoreFromCloudSQLRequest( + request_msg = csql_service.RestoreFromCloudSQLRequest( parent="parent_value", cluster_id="cluster_id_value", ) + assert args[0] == request_msg def test_restore_from_cloud_sql_use_cached_wrapped_rpc(): @@ -1518,9 +1535,15 @@ async def test_restore_from_cloud_sql_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + csql_service.RestoreFromCloudSQLRequest(), + {}, + ], +) async def test_restore_from_cloud_sql_async( - transport: str = "grpc_asyncio", - request_type=csql_service.RestoreFromCloudSQLRequest, + request_type, transport: str = "grpc_asyncio" ): client = AlloyDBCSQLAdminAsyncClient( credentials=async_anonymous_credentials(), @@ -1529,7 +1552,7 @@ async def test_restore_from_cloud_sql_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( @@ -1551,11 +1574,6 @@ async def test_restore_from_cloud_sql_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_restore_from_cloud_sql_async_from_dict(): - await test_restore_from_cloud_sql_async(request_type=dict) - - def test_restore_from_cloud_sql_field_headers(): client = AlloyDBCSQLAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2040,7 +2058,6 @@ def test_restore_from_cloud_sql_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = csql_service.RestoreFromCloudSQLRequest() - assert args[0] == request_msg @@ -2081,7 +2098,6 @@ async def test_restore_from_cloud_sql_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = csql_service.RestoreFromCloudSQLRequest() - assert args[0] == request_msg @@ -2617,7 +2633,6 @@ def test_restore_from_cloud_sql_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = csql_service.RestoreFromCloudSQLRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-alloydb/tests/unit/gapic/alloydb_v1beta/test_alloy_db_admin.py b/packages/google-cloud-alloydb/tests/unit/gapic/alloydb_v1beta/test_alloy_db_admin.py index cc69a02e5004..ef56d46aca05 100644 --- a/packages/google-cloud-alloydb/tests/unit/gapic/alloydb_v1beta/test_alloy_db_admin.py +++ b/packages/google-cloud-alloydb/tests/unit/gapic/alloydb_v1beta/test_alloy_db_admin.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 @@ -131,6 +132,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" @@ -1311,8 +1327,8 @@ def test_alloy_db_admin_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - service.ListClustersRequest, - dict, + service.ListClustersRequest(), + {}, ], ) def test_list_clusters(request_type, transport: str = "grpc"): @@ -1323,7 +1339,7 @@ def test_list_clusters(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_clusters), "__call__") as call: @@ -1372,12 +1388,13 @@ def test_list_clusters_non_empty_request_with_auto_populated_field(): client.list_clusters(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListClustersRequest( + request_msg = service.ListClustersRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_clusters_use_cached_wrapped_rpc(): @@ -1458,9 +1475,14 @@ async def test_list_clusters_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_clusters_async( - transport: str = "grpc_asyncio", request_type=service.ListClustersRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListClustersRequest(), + {}, + ], +) +async def test_list_clusters_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1468,7 +1490,7 @@ async def test_list_clusters_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_clusters), "__call__") as call: @@ -1493,11 +1515,6 @@ async def test_list_clusters_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_clusters_async_from_dict(): - await test_list_clusters_async(request_type=dict) - - def test_list_clusters_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1834,8 +1851,8 @@ async def test_list_clusters_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetClusterRequest, - dict, + service.GetClusterRequest(), + {}, ], ) def test_get_cluster(request_type, transport: str = "grpc"): @@ -1846,7 +1863,7 @@ def test_get_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_cluster), "__call__") as call: @@ -1912,9 +1929,10 @@ def test_get_cluster_non_empty_request_with_auto_populated_field(): client.get_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetClusterRequest( + request_msg = service.GetClusterRequest( name="name_value", ) + assert args[0] == request_msg def test_get_cluster_use_cached_wrapped_rpc(): @@ -1995,9 +2013,14 @@ async def test_get_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_cluster_async( - transport: str = "grpc_asyncio", request_type=service.GetClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetClusterRequest(), + {}, + ], +) +async def test_get_cluster_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2005,7 +2028,7 @@ async def test_get_cluster_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_cluster), "__call__") as call: @@ -2050,11 +2073,6 @@ async def test_get_cluster_async( assert response.service_account_email == "service_account_email_value" -@pytest.mark.asyncio -async def test_get_cluster_async_from_dict(): - await test_get_cluster_async(request_type=dict) - - def test_get_cluster_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2197,8 +2215,8 @@ async def test_get_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.CreateClusterRequest, - dict, + service.CreateClusterRequest(), + {}, ], ) def test_create_cluster(request_type, transport: str = "grpc"): @@ -2209,7 +2227,7 @@ def test_create_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_cluster), "__call__") as call: @@ -2252,11 +2270,12 @@ def test_create_cluster_non_empty_request_with_auto_populated_field(): client.create_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateClusterRequest( + request_msg = service.CreateClusterRequest( parent="parent_value", cluster_id="cluster_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_cluster_use_cached_wrapped_rpc(): @@ -2347,9 +2366,14 @@ async def test_create_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_cluster_async( - transport: str = "grpc_asyncio", request_type=service.CreateClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CreateClusterRequest(), + {}, + ], +) +async def test_create_cluster_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2357,7 +2381,7 @@ async def test_create_cluster_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_cluster), "__call__") as call: @@ -2377,11 +2401,6 @@ async def test_create_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_cluster_async_from_dict(): - await test_create_cluster_async(request_type=dict) - - def test_create_cluster_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2560,8 +2579,8 @@ async def test_create_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdateClusterRequest, - dict, + service.UpdateClusterRequest(), + {}, ], ) def test_update_cluster(request_type, transport: str = "grpc"): @@ -2572,7 +2591,7 @@ def test_update_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_cluster), "__call__") as call: @@ -2613,9 +2632,10 @@ def test_update_cluster_non_empty_request_with_auto_populated_field(): client.update_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateClusterRequest( + request_msg = service.UpdateClusterRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_cluster_use_cached_wrapped_rpc(): @@ -2706,9 +2726,14 @@ async def test_update_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_cluster_async( - transport: str = "grpc_asyncio", request_type=service.UpdateClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateClusterRequest(), + {}, + ], +) +async def test_update_cluster_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2716,7 +2741,7 @@ async def test_update_cluster_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_cluster), "__call__") as call: @@ -2736,11 +2761,6 @@ async def test_update_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_cluster_async_from_dict(): - await test_update_cluster_async(request_type=dict) - - def test_update_cluster_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2909,8 +2929,8 @@ async def test_update_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ExportClusterRequest, - dict, + service.ExportClusterRequest(), + {}, ], ) def test_export_cluster(request_type, transport: str = "grpc"): @@ -2921,7 +2941,7 @@ def test_export_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.export_cluster), "__call__") as call: @@ -2963,10 +2983,11 @@ def test_export_cluster_non_empty_request_with_auto_populated_field(): client.export_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ExportClusterRequest( + request_msg = service.ExportClusterRequest( name="name_value", database="database_value", ) + assert args[0] == request_msg def test_export_cluster_use_cached_wrapped_rpc(): @@ -3057,9 +3078,14 @@ async def test_export_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_export_cluster_async( - transport: str = "grpc_asyncio", request_type=service.ExportClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ExportClusterRequest(), + {}, + ], +) +async def test_export_cluster_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3067,7 +3093,7 @@ async def test_export_cluster_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.export_cluster), "__call__") as call: @@ -3087,11 +3113,6 @@ async def test_export_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_export_cluster_async_from_dict(): - await test_export_cluster_async(request_type=dict) - - def test_export_cluster_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3288,8 +3309,8 @@ async def test_export_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ImportClusterRequest, - dict, + service.ImportClusterRequest(), + {}, ], ) def test_import_cluster(request_type, transport: str = "grpc"): @@ -3300,7 +3321,7 @@ def test_import_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.import_cluster), "__call__") as call: @@ -3344,12 +3365,13 @@ def test_import_cluster_non_empty_request_with_auto_populated_field(): client.import_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ImportClusterRequest( + request_msg = service.ImportClusterRequest( name="name_value", gcs_uri="gcs_uri_value", database="database_value", user="user_value", ) + assert args[0] == request_msg def test_import_cluster_use_cached_wrapped_rpc(): @@ -3440,9 +3462,14 @@ async def test_import_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_import_cluster_async( - transport: str = "grpc_asyncio", request_type=service.ImportClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ImportClusterRequest(), + {}, + ], +) +async def test_import_cluster_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3450,7 +3477,7 @@ async def test_import_cluster_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.import_cluster), "__call__") as call: @@ -3470,11 +3497,6 @@ async def test_import_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_import_cluster_async_from_dict(): - await test_import_cluster_async(request_type=dict) - - def test_import_cluster_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3651,8 +3673,8 @@ async def test_import_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.UpgradeClusterRequest, - dict, + service.UpgradeClusterRequest(), + {}, ], ) def test_upgrade_cluster(request_type, transport: str = "grpc"): @@ -3663,7 +3685,7 @@ def test_upgrade_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.upgrade_cluster), "__call__") as call: @@ -3705,10 +3727,11 @@ def test_upgrade_cluster_non_empty_request_with_auto_populated_field(): client.upgrade_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpgradeClusterRequest( + request_msg = service.UpgradeClusterRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_upgrade_cluster_use_cached_wrapped_rpc(): @@ -3799,9 +3822,14 @@ async def test_upgrade_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_upgrade_cluster_async( - transport: str = "grpc_asyncio", request_type=service.UpgradeClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.UpgradeClusterRequest(), + {}, + ], +) +async def test_upgrade_cluster_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3809,7 +3837,7 @@ async def test_upgrade_cluster_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.upgrade_cluster), "__call__") as call: @@ -3829,11 +3857,6 @@ async def test_upgrade_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_upgrade_cluster_async_from_dict(): - await test_upgrade_cluster_async(request_type=dict) - - def test_upgrade_cluster_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3990,8 +4013,8 @@ async def test_upgrade_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DeleteClusterRequest, - dict, + service.DeleteClusterRequest(), + {}, ], ) def test_delete_cluster(request_type, transport: str = "grpc"): @@ -4002,7 +4025,7 @@ def test_delete_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_cluster), "__call__") as call: @@ -4045,11 +4068,12 @@ def test_delete_cluster_non_empty_request_with_auto_populated_field(): client.delete_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteClusterRequest( + request_msg = service.DeleteClusterRequest( name="name_value", request_id="request_id_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_cluster_use_cached_wrapped_rpc(): @@ -4140,9 +4164,14 @@ async def test_delete_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_cluster_async( - transport: str = "grpc_asyncio", request_type=service.DeleteClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteClusterRequest(), + {}, + ], +) +async def test_delete_cluster_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4150,7 +4179,7 @@ async def test_delete_cluster_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_cluster), "__call__") as call: @@ -4170,11 +4199,6 @@ async def test_delete_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_cluster_async_from_dict(): - await test_delete_cluster_async(request_type=dict) - - def test_delete_cluster_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4321,8 +4345,8 @@ async def test_delete_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.PromoteClusterRequest, - dict, + service.PromoteClusterRequest(), + {}, ], ) def test_promote_cluster(request_type, transport: str = "grpc"): @@ -4333,7 +4357,7 @@ def test_promote_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.promote_cluster), "__call__") as call: @@ -4376,11 +4400,12 @@ def test_promote_cluster_non_empty_request_with_auto_populated_field(): client.promote_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.PromoteClusterRequest( + request_msg = service.PromoteClusterRequest( name="name_value", request_id="request_id_value", etag="etag_value", ) + assert args[0] == request_msg def test_promote_cluster_use_cached_wrapped_rpc(): @@ -4471,9 +4496,14 @@ async def test_promote_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_promote_cluster_async( - transport: str = "grpc_asyncio", request_type=service.PromoteClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.PromoteClusterRequest(), + {}, + ], +) +async def test_promote_cluster_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4481,7 +4511,7 @@ async def test_promote_cluster_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.promote_cluster), "__call__") as call: @@ -4501,11 +4531,6 @@ async def test_promote_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_promote_cluster_async_from_dict(): - await test_promote_cluster_async(request_type=dict) - - def test_promote_cluster_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4652,8 +4677,8 @@ async def test_promote_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.SwitchoverClusterRequest, - dict, + service.SwitchoverClusterRequest(), + {}, ], ) def test_switchover_cluster(request_type, transport: str = "grpc"): @@ -4664,7 +4689,7 @@ def test_switchover_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4710,10 +4735,11 @@ def test_switchover_cluster_non_empty_request_with_auto_populated_field(): client.switchover_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.SwitchoverClusterRequest( + request_msg = service.SwitchoverClusterRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_switchover_cluster_use_cached_wrapped_rpc(): @@ -4808,9 +4834,14 @@ async def test_switchover_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_switchover_cluster_async( - transport: str = "grpc_asyncio", request_type=service.SwitchoverClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.SwitchoverClusterRequest(), + {}, + ], +) +async def test_switchover_cluster_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4818,7 +4849,7 @@ async def test_switchover_cluster_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( @@ -4840,11 +4871,6 @@ async def test_switchover_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_switchover_cluster_async_from_dict(): - await test_switchover_cluster_async(request_type=dict) - - def test_switchover_cluster_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4999,8 +5025,8 @@ async def test_switchover_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.RestoreClusterRequest, - dict, + service.RestoreClusterRequest(), + {}, ], ) def test_restore_cluster(request_type, transport: str = "grpc"): @@ -5011,7 +5037,7 @@ def test_restore_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.restore_cluster), "__call__") as call: @@ -5054,11 +5080,12 @@ def test_restore_cluster_non_empty_request_with_auto_populated_field(): client.restore_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.RestoreClusterRequest( + request_msg = service.RestoreClusterRequest( parent="parent_value", cluster_id="cluster_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_restore_cluster_use_cached_wrapped_rpc(): @@ -5149,9 +5176,14 @@ async def test_restore_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_restore_cluster_async( - transport: str = "grpc_asyncio", request_type=service.RestoreClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.RestoreClusterRequest(), + {}, + ], +) +async def test_restore_cluster_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5159,7 +5191,7 @@ async def test_restore_cluster_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.restore_cluster), "__call__") as call: @@ -5179,11 +5211,6 @@ async def test_restore_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_restore_cluster_async_from_dict(): - await test_restore_cluster_async(request_type=dict) - - def test_restore_cluster_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5248,8 +5275,8 @@ async def test_restore_cluster_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.CreateSecondaryClusterRequest, - dict, + service.CreateSecondaryClusterRequest(), + {}, ], ) def test_create_secondary_cluster(request_type, transport: str = "grpc"): @@ -5260,7 +5287,7 @@ def test_create_secondary_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5307,11 +5334,12 @@ def test_create_secondary_cluster_non_empty_request_with_auto_populated_field(): client.create_secondary_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateSecondaryClusterRequest( + request_msg = service.CreateSecondaryClusterRequest( parent="parent_value", cluster_id="cluster_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_secondary_cluster_use_cached_wrapped_rpc(): @@ -5407,8 +5435,15 @@ async def test_create_secondary_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.CreateSecondaryClusterRequest(), + {}, + ], +) async def test_create_secondary_cluster_async( - transport: str = "grpc_asyncio", request_type=service.CreateSecondaryClusterRequest + request_type, transport: str = "grpc_asyncio" ): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), @@ -5417,7 +5452,7 @@ async def test_create_secondary_cluster_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( @@ -5439,11 +5474,6 @@ async def test_create_secondary_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_secondary_cluster_async_from_dict(): - await test_create_secondary_cluster_async(request_type=dict) - - def test_create_secondary_cluster_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5630,8 +5660,8 @@ async def test_create_secondary_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListInstancesRequest, - dict, + service.ListInstancesRequest(), + {}, ], ) def test_list_instances(request_type, transport: str = "grpc"): @@ -5642,7 +5672,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(type(client.transport.list_instances), "__call__") as call: @@ -5691,12 +5721,13 @@ 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] == service.ListInstancesRequest( + request_msg = service.ListInstancesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_instances_use_cached_wrapped_rpc(): @@ -5777,9 +5808,14 @@ async def test_list_instances_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_instances_async( - transport: str = "grpc_asyncio", request_type=service.ListInstancesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListInstancesRequest(), + {}, + ], +) +async def test_list_instances_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5787,7 +5823,7 @@ async def test_list_instances_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_instances), "__call__") as call: @@ -5812,11 +5848,6 @@ async def test_list_instances_async( 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 = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6153,8 +6184,8 @@ async def test_list_instances_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetInstanceRequest, - dict, + service.GetInstanceRequest(), + {}, ], ) def test_get_instance(request_type, transport: str = "grpc"): @@ -6165,7 +6196,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(type(client.transport.get_instance), "__call__") as call: @@ -6237,9 +6268,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] == service.GetInstanceRequest( + request_msg = service.GetInstanceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_instance_use_cached_wrapped_rpc(): @@ -6320,9 +6352,14 @@ async def test_get_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_instance_async( - transport: str = "grpc_asyncio", request_type=service.GetInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetInstanceRequest(), + {}, + ], +) +async def test_get_instance_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6330,7 +6367,7 @@ async def test_get_instance_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_instance), "__call__") as call: @@ -6381,11 +6418,6 @@ async def test_get_instance_async( assert response.activation_policy == resources.Instance.ActivationPolicy.ALWAYS -@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 = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6528,8 +6560,8 @@ async def test_get_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.CreateInstanceRequest, - dict, + service.CreateInstanceRequest(), + {}, ], ) def test_create_instance(request_type, transport: str = "grpc"): @@ -6540,7 +6572,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(type(client.transport.create_instance), "__call__") as call: @@ -6583,11 +6615,12 @@ 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] == service.CreateInstanceRequest( + request_msg = service.CreateInstanceRequest( parent="parent_value", instance_id="instance_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_instance_use_cached_wrapped_rpc(): @@ -6678,9 +6711,14 @@ async def test_create_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_instance_async( - transport: str = "grpc_asyncio", request_type=service.CreateInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CreateInstanceRequest(), + {}, + ], +) +async def test_create_instance_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6688,7 +6726,7 @@ async def test_create_instance_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_instance), "__call__") as call: @@ -6708,11 +6746,6 @@ async def test_create_instance_async( 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 = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6879,8 +6912,8 @@ async def test_create_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.CreateSecondaryInstanceRequest, - dict, + service.CreateSecondaryInstanceRequest(), + {}, ], ) def test_create_secondary_instance(request_type, transport: str = "grpc"): @@ -6891,7 +6924,7 @@ def test_create_secondary_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( @@ -6938,11 +6971,12 @@ def test_create_secondary_instance_non_empty_request_with_auto_populated_field() client.create_secondary_instance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateSecondaryInstanceRequest( + request_msg = service.CreateSecondaryInstanceRequest( parent="parent_value", instance_id="instance_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_secondary_instance_use_cached_wrapped_rpc(): @@ -7038,8 +7072,15 @@ async def test_create_secondary_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.CreateSecondaryInstanceRequest(), + {}, + ], +) async def test_create_secondary_instance_async( - transport: str = "grpc_asyncio", request_type=service.CreateSecondaryInstanceRequest + request_type, transport: str = "grpc_asyncio" ): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), @@ -7048,7 +7089,7 @@ async def test_create_secondary_instance_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( @@ -7070,11 +7111,6 @@ async def test_create_secondary_instance_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_secondary_instance_async_from_dict(): - await test_create_secondary_instance_async(request_type=dict) - - def test_create_secondary_instance_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7249,8 +7285,8 @@ async def test_create_secondary_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.BatchCreateInstancesRequest, - dict, + service.BatchCreateInstancesRequest(), + {}, ], ) def test_batch_create_instances(request_type, transport: str = "grpc"): @@ -7261,7 +7297,7 @@ def test_batch_create_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( @@ -7307,10 +7343,11 @@ def test_batch_create_instances_non_empty_request_with_auto_populated_field(): client.batch_create_instances(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.BatchCreateInstancesRequest( + request_msg = service.BatchCreateInstancesRequest( parent="parent_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_batch_create_instances_use_cached_wrapped_rpc(): @@ -7406,8 +7443,15 @@ async def test_batch_create_instances_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.BatchCreateInstancesRequest(), + {}, + ], +) async def test_batch_create_instances_async( - transport: str = "grpc_asyncio", request_type=service.BatchCreateInstancesRequest + request_type, transport: str = "grpc_asyncio" ): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), @@ -7416,7 +7460,7 @@ async def test_batch_create_instances_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( @@ -7438,11 +7482,6 @@ async def test_batch_create_instances_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_batch_create_instances_async_from_dict(): - await test_batch_create_instances_async(request_type=dict) - - def test_batch_create_instances_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7511,8 +7550,8 @@ async def test_batch_create_instances_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdateInstanceRequest, - dict, + service.UpdateInstanceRequest(), + {}, ], ) def test_update_instance(request_type, transport: str = "grpc"): @@ -7523,7 +7562,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(type(client.transport.update_instance), "__call__") as call: @@ -7564,9 +7603,10 @@ 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] == service.UpdateInstanceRequest( + request_msg = service.UpdateInstanceRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_instance_use_cached_wrapped_rpc(): @@ -7657,9 +7697,14 @@ async def test_update_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_instance_async( - transport: str = "grpc_asyncio", request_type=service.UpdateInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateInstanceRequest(), + {}, + ], +) +async def test_update_instance_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7667,7 +7712,7 @@ async def test_update_instance_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_instance), "__call__") as call: @@ -7687,11 +7732,6 @@ async def test_update_instance_async( 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 = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7848,8 +7888,8 @@ async def test_update_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DeleteInstanceRequest, - dict, + service.DeleteInstanceRequest(), + {}, ], ) def test_delete_instance(request_type, transport: str = "grpc"): @@ -7860,7 +7900,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(type(client.transport.delete_instance), "__call__") as call: @@ -7903,11 +7943,12 @@ 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] == service.DeleteInstanceRequest( + request_msg = service.DeleteInstanceRequest( name="name_value", request_id="request_id_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_instance_use_cached_wrapped_rpc(): @@ -7998,9 +8039,14 @@ async def test_delete_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_instance_async( - transport: str = "grpc_asyncio", request_type=service.DeleteInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteInstanceRequest(), + {}, + ], +) +async def test_delete_instance_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8008,7 +8054,7 @@ async def test_delete_instance_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_instance), "__call__") as call: @@ -8028,11 +8074,6 @@ async def test_delete_instance_async( 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 = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8179,8 +8220,8 @@ async def test_delete_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.FailoverInstanceRequest, - dict, + service.FailoverInstanceRequest(), + {}, ], ) def test_failover_instance(request_type, transport: str = "grpc"): @@ -8191,7 +8232,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( @@ -8237,10 +8278,11 @@ 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] == service.FailoverInstanceRequest( + request_msg = service.FailoverInstanceRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_failover_instance_use_cached_wrapped_rpc(): @@ -8333,9 +8375,14 @@ async def test_failover_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_failover_instance_async( - transport: str = "grpc_asyncio", request_type=service.FailoverInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.FailoverInstanceRequest(), + {}, + ], +) +async def test_failover_instance_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8343,7 +8390,7 @@ async def test_failover_instance_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( @@ -8365,11 +8412,6 @@ async def test_failover_instance_async( 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 = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8524,8 +8566,8 @@ async def test_failover_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.InjectFaultRequest, - dict, + service.InjectFaultRequest(), + {}, ], ) def test_inject_fault(request_type, transport: str = "grpc"): @@ -8536,7 +8578,7 @@ def test_inject_fault(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.inject_fault), "__call__") as call: @@ -8578,10 +8620,11 @@ def test_inject_fault_non_empty_request_with_auto_populated_field(): client.inject_fault(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.InjectFaultRequest( + request_msg = service.InjectFaultRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_inject_fault_use_cached_wrapped_rpc(): @@ -8672,9 +8715,14 @@ async def test_inject_fault_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_inject_fault_async( - transport: str = "grpc_asyncio", request_type=service.InjectFaultRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.InjectFaultRequest(), + {}, + ], +) +async def test_inject_fault_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8682,7 +8730,7 @@ async def test_inject_fault_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.inject_fault), "__call__") as call: @@ -8702,11 +8750,6 @@ async def test_inject_fault_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_inject_fault_async_from_dict(): - await test_inject_fault_async(request_type=dict) - - def test_inject_fault_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8863,8 +8906,8 @@ async def test_inject_fault_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.RestartInstanceRequest, - dict, + service.RestartInstanceRequest(), + {}, ], ) def test_restart_instance(request_type, transport: str = "grpc"): @@ -8875,7 +8918,7 @@ def test_restart_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(type(client.transport.restart_instance), "__call__") as call: @@ -8917,10 +8960,11 @@ def test_restart_instance_non_empty_request_with_auto_populated_field(): client.restart_instance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.RestartInstanceRequest( + request_msg = service.RestartInstanceRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_restart_instance_use_cached_wrapped_rpc(): @@ -9013,9 +9057,14 @@ async def test_restart_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_restart_instance_async( - transport: str = "grpc_asyncio", request_type=service.RestartInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.RestartInstanceRequest(), + {}, + ], +) +async def test_restart_instance_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9023,7 +9072,7 @@ async def test_restart_instance_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.restart_instance), "__call__") as call: @@ -9043,11 +9092,6 @@ async def test_restart_instance_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_restart_instance_async_from_dict(): - await test_restart_instance_async(request_type=dict) - - def test_restart_instance_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9194,8 +9238,8 @@ async def test_restart_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ExecuteSqlRequest, - dict, + service.ExecuteSqlRequest(), + {}, ], ) def test_execute_sql(request_type, transport: str = "grpc"): @@ -9206,7 +9250,7 @@ def test_execute_sql(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.execute_sql), "__call__") as call: @@ -9251,13 +9295,14 @@ def test_execute_sql_non_empty_request_with_auto_populated_field(): client.execute_sql(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ExecuteSqlRequest( + request_msg = service.ExecuteSqlRequest( password="password_value", instance="instance_value", database="database_value", user="user_value", sql_statement="sql_statement_value", ) + assert args[0] == request_msg def test_execute_sql_use_cached_wrapped_rpc(): @@ -9338,9 +9383,14 @@ async def test_execute_sql_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_execute_sql_async( - transport: str = "grpc_asyncio", request_type=service.ExecuteSqlRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ExecuteSqlRequest(), + {}, + ], +) +async def test_execute_sql_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9348,7 +9398,7 @@ async def test_execute_sql_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.execute_sql), "__call__") as call: @@ -9368,11 +9418,6 @@ async def test_execute_sql_async( assert isinstance(response, service.ExecuteSqlResponse) -@pytest.mark.asyncio -async def test_execute_sql_async_from_dict(): - await test_execute_sql_async(request_type=dict) - - def test_execute_sql_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9555,8 +9600,8 @@ async def test_execute_sql_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListBackupsRequest, - dict, + service.ListBackupsRequest(), + {}, ], ) def test_list_backups(request_type, transport: str = "grpc"): @@ -9567,7 +9612,7 @@ def test_list_backups(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_backups), "__call__") as call: @@ -9616,12 +9661,13 @@ def test_list_backups_non_empty_request_with_auto_populated_field(): client.list_backups(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListBackupsRequest( + request_msg = service.ListBackupsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_backups_use_cached_wrapped_rpc(): @@ -9702,9 +9748,14 @@ async def test_list_backups_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_backups_async( - transport: str = "grpc_asyncio", request_type=service.ListBackupsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListBackupsRequest(), + {}, + ], +) +async def test_list_backups_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9712,7 +9763,7 @@ async def test_list_backups_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_backups), "__call__") as call: @@ -9737,11 +9788,6 @@ async def test_list_backups_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_backups_async_from_dict(): - await test_list_backups_async(request_type=dict) - - def test_list_backups_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10078,8 +10124,8 @@ async def test_list_backups_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetBackupRequest, - dict, + service.GetBackupRequest(), + {}, ], ) def test_get_backup(request_type, transport: str = "grpc"): @@ -10090,7 +10136,7 @@ def test_get_backup(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_backup), "__call__") as call: @@ -10158,9 +10204,10 @@ def test_get_backup_non_empty_request_with_auto_populated_field(): client.get_backup(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetBackupRequest( + request_msg = service.GetBackupRequest( name="name_value", ) + assert args[0] == request_msg def test_get_backup_use_cached_wrapped_rpc(): @@ -10239,9 +10286,14 @@ async def test_get_backup_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_backup_async( - transport: str = "grpc_asyncio", request_type=service.GetBackupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetBackupRequest(), + {}, + ], +) +async def test_get_backup_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10249,7 +10301,7 @@ async def test_get_backup_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_backup), "__call__") as call: @@ -10296,11 +10348,6 @@ async def test_get_backup_async( assert response.database_version == resources.DatabaseVersion.POSTGRES_13 -@pytest.mark.asyncio -async def test_get_backup_async_from_dict(): - await test_get_backup_async(request_type=dict) - - def test_get_backup_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10443,8 +10490,8 @@ async def test_get_backup_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.CreateBackupRequest, - dict, + service.CreateBackupRequest(), + {}, ], ) def test_create_backup(request_type, transport: str = "grpc"): @@ -10455,7 +10502,7 @@ def test_create_backup(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_backup), "__call__") as call: @@ -10498,11 +10545,12 @@ def test_create_backup_non_empty_request_with_auto_populated_field(): client.create_backup(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateBackupRequest( + request_msg = service.CreateBackupRequest( parent="parent_value", backup_id="backup_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_backup_use_cached_wrapped_rpc(): @@ -10593,9 +10641,14 @@ async def test_create_backup_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_backup_async( - transport: str = "grpc_asyncio", request_type=service.CreateBackupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CreateBackupRequest(), + {}, + ], +) +async def test_create_backup_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10603,7 +10656,7 @@ async def test_create_backup_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_backup), "__call__") as call: @@ -10623,11 +10676,6 @@ async def test_create_backup_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_backup_async_from_dict(): - await test_create_backup_async(request_type=dict) - - def test_create_backup_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10794,8 +10842,8 @@ async def test_create_backup_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdateBackupRequest, - dict, + service.UpdateBackupRequest(), + {}, ], ) def test_update_backup(request_type, transport: str = "grpc"): @@ -10806,7 +10854,7 @@ def test_update_backup(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_backup), "__call__") as call: @@ -10847,9 +10895,10 @@ def test_update_backup_non_empty_request_with_auto_populated_field(): client.update_backup(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateBackupRequest( + request_msg = service.UpdateBackupRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_backup_use_cached_wrapped_rpc(): @@ -10940,9 +10989,14 @@ async def test_update_backup_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_backup_async( - transport: str = "grpc_asyncio", request_type=service.UpdateBackupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateBackupRequest(), + {}, + ], +) +async def test_update_backup_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10950,7 +11004,7 @@ async def test_update_backup_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_backup), "__call__") as call: @@ -10970,11 +11024,6 @@ async def test_update_backup_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_backup_async_from_dict(): - await test_update_backup_async(request_type=dict) - - def test_update_backup_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11131,8 +11180,8 @@ async def test_update_backup_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DeleteBackupRequest, - dict, + service.DeleteBackupRequest(), + {}, ], ) def test_delete_backup(request_type, transport: str = "grpc"): @@ -11143,7 +11192,7 @@ def test_delete_backup(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_backup), "__call__") as call: @@ -11186,11 +11235,12 @@ def test_delete_backup_non_empty_request_with_auto_populated_field(): client.delete_backup(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteBackupRequest( + request_msg = service.DeleteBackupRequest( name="name_value", request_id="request_id_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_backup_use_cached_wrapped_rpc(): @@ -11281,9 +11331,14 @@ async def test_delete_backup_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_backup_async( - transport: str = "grpc_asyncio", request_type=service.DeleteBackupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteBackupRequest(), + {}, + ], +) +async def test_delete_backup_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11291,7 +11346,7 @@ async def test_delete_backup_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_backup), "__call__") as call: @@ -11311,11 +11366,6 @@ async def test_delete_backup_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_backup_async_from_dict(): - await test_delete_backup_async(request_type=dict) - - def test_delete_backup_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11462,8 +11512,8 @@ async def test_delete_backup_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListSupportedDatabaseFlagsRequest, - dict, + service.ListSupportedDatabaseFlagsRequest(), + {}, ], ) def test_list_supported_database_flags(request_type, transport: str = "grpc"): @@ -11474,7 +11524,7 @@ def test_list_supported_database_flags(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11523,10 +11573,11 @@ def test_list_supported_database_flags_non_empty_request_with_auto_populated_fie client.list_supported_database_flags(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListSupportedDatabaseFlagsRequest( + request_msg = service.ListSupportedDatabaseFlagsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_supported_database_flags_use_cached_wrapped_rpc(): @@ -11612,9 +11663,15 @@ async def test_list_supported_database_flags_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.ListSupportedDatabaseFlagsRequest(), + {}, + ], +) async def test_list_supported_database_flags_async( - transport: str = "grpc_asyncio", - request_type=service.ListSupportedDatabaseFlagsRequest, + request_type, transport: str = "grpc_asyncio" ): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), @@ -11623,7 +11680,7 @@ async def test_list_supported_database_flags_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( @@ -11648,11 +11705,6 @@ async def test_list_supported_database_flags_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_supported_database_flags_async_from_dict(): - await test_list_supported_database_flags_async(request_type=dict) - - def test_list_supported_database_flags_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12009,8 +12061,8 @@ async def test_list_supported_database_flags_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GenerateClientCertificateRequest, - dict, + service.GenerateClientCertificateRequest(), + {}, ], ) def test_generate_client_certificate(request_type, transport: str = "grpc"): @@ -12021,7 +12073,7 @@ def test_generate_client_certificate(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -12076,12 +12128,13 @@ def test_generate_client_certificate_non_empty_request_with_auto_populated_field client.generate_client_certificate(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GenerateClientCertificateRequest( + request_msg = service.GenerateClientCertificateRequest( parent="parent_value", request_id="request_id_value", pem_csr="pem_csr_value", public_key="public_key_value", ) + assert args[0] == request_msg def test_generate_client_certificate_use_cached_wrapped_rpc(): @@ -12167,9 +12220,15 @@ async def test_generate_client_certificate_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.GenerateClientCertificateRequest(), + {}, + ], +) async def test_generate_client_certificate_async( - transport: str = "grpc_asyncio", - request_type=service.GenerateClientCertificateRequest, + request_type, transport: str = "grpc_asyncio" ): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), @@ -12178,7 +12237,7 @@ async def test_generate_client_certificate_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( @@ -12207,11 +12266,6 @@ async def test_generate_client_certificate_async( assert response.ca_cert == "ca_cert_value" -@pytest.mark.asyncio -async def test_generate_client_certificate_async_from_dict(): - await test_generate_client_certificate_async(request_type=dict) - - def test_generate_client_certificate_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12366,8 +12420,8 @@ async def test_generate_client_certificate_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.GetConnectionInfoRequest, - dict, + service.GetConnectionInfoRequest(), + {}, ], ) def test_get_connection_info(request_type, transport: str = "grpc"): @@ -12378,7 +12432,7 @@ def test_get_connection_info(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -12437,10 +12491,11 @@ def test_get_connection_info_non_empty_request_with_auto_populated_field(): client.get_connection_info(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetConnectionInfoRequest( + request_msg = service.GetConnectionInfoRequest( parent="parent_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_get_connection_info_use_cached_wrapped_rpc(): @@ -12525,9 +12580,14 @@ async def test_get_connection_info_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_connection_info_async( - transport: str = "grpc_asyncio", request_type=service.GetConnectionInfoRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetConnectionInfoRequest(), + {}, + ], +) +async def test_get_connection_info_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12535,7 +12595,7 @@ async def test_get_connection_info_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( @@ -12570,11 +12630,6 @@ async def test_get_connection_info_async( assert response.psc_dns_name == "psc_dns_name_value" -@pytest.mark.asyncio -async def test_get_connection_info_async_from_dict(): - await test_get_connection_info_async(request_type=dict) - - def test_get_connection_info_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12729,8 +12784,8 @@ async def test_get_connection_info_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListUsersRequest, - dict, + service.ListUsersRequest(), + {}, ], ) def test_list_users(request_type, transport: str = "grpc"): @@ -12741,7 +12796,7 @@ def test_list_users(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_users), "__call__") as call: @@ -12790,12 +12845,13 @@ def test_list_users_non_empty_request_with_auto_populated_field(): client.list_users(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListUsersRequest( + request_msg = service.ListUsersRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_users_use_cached_wrapped_rpc(): @@ -12874,9 +12930,14 @@ async def test_list_users_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_list_users_async( - transport: str = "grpc_asyncio", request_type=service.ListUsersRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListUsersRequest(), + {}, + ], +) +async def test_list_users_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12884,7 +12945,7 @@ async def test_list_users_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_users), "__call__") as call: @@ -12909,11 +12970,6 @@ async def test_list_users_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_users_async_from_dict(): - await test_list_users_async(request_type=dict) - - def test_list_users_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13250,8 +13306,8 @@ async def test_list_users_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetUserRequest, - dict, + service.GetUserRequest(), + {}, ], ) def test_get_user(request_type, transport: str = "grpc"): @@ -13262,7 +13318,7 @@ def test_get_user(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_user), "__call__") as call: @@ -13314,9 +13370,10 @@ def test_get_user_non_empty_request_with_auto_populated_field(): client.get_user(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetUserRequest( + request_msg = service.GetUserRequest( name="name_value", ) + assert args[0] == request_msg def test_get_user_use_cached_wrapped_rpc(): @@ -13395,9 +13452,14 @@ async def test_get_user_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn @pytest.mark.asyncio -async def test_get_user_async( - transport: str = "grpc_asyncio", request_type=service.GetUserRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetUserRequest(), + {}, + ], +) +async def test_get_user_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13405,7 +13467,7 @@ async def test_get_user_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_user), "__call__") as call: @@ -13436,11 +13498,6 @@ async def test_get_user_async( assert response.keep_extra_roles is True -@pytest.mark.asyncio -async def test_get_user_async_from_dict(): - await test_get_user_async(request_type=dict) - - def test_get_user_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13583,8 +13640,8 @@ async def test_get_user_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.CreateUserRequest, - dict, + service.CreateUserRequest(), + {}, ], ) def test_create_user(request_type, transport: str = "grpc"): @@ -13595,7 +13652,7 @@ def test_create_user(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_user), "__call__") as call: @@ -13649,11 +13706,12 @@ def test_create_user_non_empty_request_with_auto_populated_field(): client.create_user(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateUserRequest( + request_msg = service.CreateUserRequest( parent="parent_value", user_id="user_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_user_use_cached_wrapped_rpc(): @@ -13734,9 +13792,14 @@ async def test_create_user_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_user_async( - transport: str = "grpc_asyncio", request_type=service.CreateUserRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CreateUserRequest(), + {}, + ], +) +async def test_create_user_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13744,7 +13807,7 @@ async def test_create_user_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_user), "__call__") as call: @@ -13775,11 +13838,6 @@ async def test_create_user_async( assert response.keep_extra_roles is True -@pytest.mark.asyncio -async def test_create_user_async_from_dict(): - await test_create_user_async(request_type=dict) - - def test_create_user_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13942,8 +14000,8 @@ async def test_create_user_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdateUserRequest, - dict, + service.UpdateUserRequest(), + {}, ], ) def test_update_user(request_type, transport: str = "grpc"): @@ -13954,7 +14012,7 @@ def test_update_user(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_user), "__call__") as call: @@ -14006,9 +14064,10 @@ def test_update_user_non_empty_request_with_auto_populated_field(): client.update_user(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateUserRequest( + request_msg = service.UpdateUserRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_user_use_cached_wrapped_rpc(): @@ -14089,9 +14148,14 @@ async def test_update_user_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_user_async( - transport: str = "grpc_asyncio", request_type=service.UpdateUserRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateUserRequest(), + {}, + ], +) +async def test_update_user_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14099,7 +14163,7 @@ async def test_update_user_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_user), "__call__") as call: @@ -14130,11 +14194,6 @@ async def test_update_user_async( assert response.keep_extra_roles is True -@pytest.mark.asyncio -async def test_update_user_async_from_dict(): - await test_update_user_async(request_type=dict) - - def test_update_user_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14287,8 +14346,8 @@ async def test_update_user_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DeleteUserRequest, - dict, + service.DeleteUserRequest(), + {}, ], ) def test_delete_user(request_type, transport: str = "grpc"): @@ -14299,7 +14358,7 @@ def test_delete_user(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_user), "__call__") as call: @@ -14341,10 +14400,11 @@ def test_delete_user_non_empty_request_with_auto_populated_field(): client.delete_user(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteUserRequest( + request_msg = service.DeleteUserRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_user_use_cached_wrapped_rpc(): @@ -14425,9 +14485,14 @@ async def test_delete_user_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_user_async( - transport: str = "grpc_asyncio", request_type=service.DeleteUserRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteUserRequest(), + {}, + ], +) +async def test_delete_user_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14435,7 +14500,7 @@ async def test_delete_user_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_user), "__call__") as call: @@ -14453,11 +14518,6 @@ async def test_delete_user_async( assert response is None -@pytest.mark.asyncio -async def test_delete_user_async_from_dict(): - await test_delete_user_async(request_type=dict) - - def test_delete_user_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14600,8 +14660,8 @@ async def test_delete_user_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListDatabasesRequest, - dict, + service.ListDatabasesRequest(), + {}, ], ) def test_list_databases(request_type, transport: str = "grpc"): @@ -14612,7 +14672,7 @@ def test_list_databases(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_databases), "__call__") as call: @@ -14658,11 +14718,12 @@ def test_list_databases_non_empty_request_with_auto_populated_field(): client.list_databases(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListDatabasesRequest( + request_msg = service.ListDatabasesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_databases_use_cached_wrapped_rpc(): @@ -14743,9 +14804,14 @@ async def test_list_databases_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_databases_async( - transport: str = "grpc_asyncio", request_type=service.ListDatabasesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListDatabasesRequest(), + {}, + ], +) +async def test_list_databases_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14753,7 +14819,7 @@ async def test_list_databases_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_databases), "__call__") as call: @@ -14776,11 +14842,6 @@ async def test_list_databases_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_databases_async_from_dict(): - await test_list_databases_async(request_type=dict) - - def test_list_databases_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15117,8 +15178,8 @@ async def test_list_databases_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.CreateDatabaseRequest, - dict, + service.CreateDatabaseRequest(), + {}, ], ) def test_create_database(request_type, transport: str = "grpc"): @@ -15129,7 +15190,7 @@ def test_create_database(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_database), "__call__") as call: @@ -15186,10 +15247,11 @@ def test_create_database_non_empty_request_with_auto_populated_field(): client.create_database(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateDatabaseRequest( + request_msg = service.CreateDatabaseRequest( parent="parent_value", database_id="database_id_value", ) + assert args[0] == request_msg def test_create_database_use_cached_wrapped_rpc(): @@ -15270,9 +15332,14 @@ async def test_create_database_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_database_async( - transport: str = "grpc_asyncio", request_type=service.CreateDatabaseRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CreateDatabaseRequest(), + {}, + ], +) +async def test_create_database_async(request_type, transport: str = "grpc_asyncio"): client = AlloyDBAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -15280,7 +15347,7 @@ async def test_create_database_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_database), "__call__") as call: @@ -15315,11 +15382,6 @@ async def test_create_database_async( assert response.is_template_database is True -@pytest.mark.asyncio -async def test_create_database_async_from_dict(): - await test_create_database_async(request_type=dict) - - def test_create_database_field_headers(): client = AlloyDBAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -23306,7 +23368,6 @@ def test_list_clusters_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListClustersRequest() - assert args[0] == request_msg @@ -23327,7 +23388,6 @@ def test_get_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetClusterRequest() - assert args[0] == request_msg @@ -23348,7 +23408,6 @@ def test_create_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateClusterRequest() - assert args[0] == request_msg @@ -23369,7 +23428,6 @@ def test_update_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateClusterRequest() - assert args[0] == request_msg @@ -23390,7 +23448,6 @@ def test_export_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ExportClusterRequest() - assert args[0] == request_msg @@ -23411,7 +23468,6 @@ def test_import_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ImportClusterRequest() - assert args[0] == request_msg @@ -23432,7 +23488,6 @@ def test_upgrade_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpgradeClusterRequest() - assert args[0] == request_msg @@ -23453,7 +23508,6 @@ def test_delete_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteClusterRequest() - assert args[0] == request_msg @@ -23474,7 +23528,6 @@ def test_promote_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.PromoteClusterRequest() - assert args[0] == request_msg @@ -23497,7 +23550,6 @@ def test_switchover_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.SwitchoverClusterRequest() - assert args[0] == request_msg @@ -23518,7 +23570,6 @@ def test_restore_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.RestoreClusterRequest() - assert args[0] == request_msg @@ -23541,7 +23592,6 @@ def test_create_secondary_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateSecondaryClusterRequest() - assert args[0] == request_msg @@ -23562,7 +23612,6 @@ def test_list_instances_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListInstancesRequest() - assert args[0] == request_msg @@ -23583,7 +23632,6 @@ def test_get_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetInstanceRequest() - assert args[0] == request_msg @@ -23604,7 +23652,6 @@ def test_create_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateInstanceRequest() - assert args[0] == request_msg @@ -23627,7 +23674,6 @@ def test_create_secondary_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateSecondaryInstanceRequest() - assert args[0] == request_msg @@ -23650,7 +23696,6 @@ def test_batch_create_instances_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.BatchCreateInstancesRequest() - assert args[0] == request_msg @@ -23671,7 +23716,6 @@ def test_update_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateInstanceRequest() - assert args[0] == request_msg @@ -23692,7 +23736,6 @@ def test_delete_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteInstanceRequest() - assert args[0] == request_msg @@ -23715,7 +23758,6 @@ def test_failover_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.FailoverInstanceRequest() - assert args[0] == request_msg @@ -23736,7 +23778,6 @@ def test_inject_fault_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.InjectFaultRequest() - assert args[0] == request_msg @@ -23757,7 +23798,6 @@ def test_restart_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.RestartInstanceRequest() - assert args[0] == request_msg @@ -23778,7 +23818,6 @@ def test_execute_sql_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ExecuteSqlRequest() - assert args[0] == request_msg @@ -23799,7 +23838,6 @@ def test_list_backups_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListBackupsRequest() - assert args[0] == request_msg @@ -23820,7 +23858,6 @@ def test_get_backup_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetBackupRequest() - assert args[0] == request_msg @@ -23841,7 +23878,6 @@ def test_create_backup_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateBackupRequest() - assert args[0] == request_msg @@ -23862,7 +23898,6 @@ def test_update_backup_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateBackupRequest() - assert args[0] == request_msg @@ -23883,7 +23918,6 @@ def test_delete_backup_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteBackupRequest() - assert args[0] == request_msg @@ -23906,7 +23940,6 @@ def test_list_supported_database_flags_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListSupportedDatabaseFlagsRequest() - assert args[0] == request_msg @@ -23929,7 +23962,6 @@ def test_generate_client_certificate_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GenerateClientCertificateRequest() - assert args[0] == request_msg @@ -23952,7 +23984,6 @@ def test_get_connection_info_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetConnectionInfoRequest() - assert args[0] == request_msg @@ -23973,7 +24004,6 @@ def test_list_users_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListUsersRequest() - assert args[0] == request_msg @@ -23994,7 +24024,6 @@ def test_get_user_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetUserRequest() - assert args[0] == request_msg @@ -24015,7 +24044,6 @@ def test_create_user_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateUserRequest() - assert args[0] == request_msg @@ -24036,7 +24064,6 @@ def test_update_user_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateUserRequest() - assert args[0] == request_msg @@ -24057,7 +24084,6 @@ def test_delete_user_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteUserRequest() - assert args[0] == request_msg @@ -24078,7 +24104,6 @@ def test_list_databases_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListDatabasesRequest() - assert args[0] == request_msg @@ -24099,7 +24124,6 @@ def test_create_database_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateDatabaseRequest() - assert args[0] == request_msg @@ -24141,7 +24165,6 @@ async def test_list_clusters_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListClustersRequest() - assert args[0] == request_msg @@ -24179,7 +24202,6 @@ async def test_get_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetClusterRequest() - assert args[0] == request_msg @@ -24204,7 +24226,6 @@ async def test_create_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateClusterRequest() - assert args[0] == request_msg @@ -24229,7 +24250,6 @@ async def test_update_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateClusterRequest() - assert args[0] == request_msg @@ -24254,7 +24274,6 @@ async def test_export_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ExportClusterRequest() - assert args[0] == request_msg @@ -24279,7 +24298,6 @@ async def test_import_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ImportClusterRequest() - assert args[0] == request_msg @@ -24304,7 +24322,6 @@ async def test_upgrade_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpgradeClusterRequest() - assert args[0] == request_msg @@ -24329,7 +24346,6 @@ async def test_delete_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteClusterRequest() - assert args[0] == request_msg @@ -24354,7 +24370,6 @@ async def test_promote_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.PromoteClusterRequest() - assert args[0] == request_msg @@ -24381,7 +24396,6 @@ async def test_switchover_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.SwitchoverClusterRequest() - assert args[0] == request_msg @@ -24406,7 +24420,6 @@ async def test_restore_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.RestoreClusterRequest() - assert args[0] == request_msg @@ -24433,7 +24446,6 @@ async def test_create_secondary_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateSecondaryClusterRequest() - assert args[0] == request_msg @@ -24461,7 +24473,6 @@ async def test_list_instances_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListInstancesRequest() - assert args[0] == request_msg @@ -24501,7 +24512,6 @@ async def test_get_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetInstanceRequest() - assert args[0] == request_msg @@ -24526,7 +24536,6 @@ async def test_create_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateInstanceRequest() - assert args[0] == request_msg @@ -24553,7 +24562,6 @@ async def test_create_secondary_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateSecondaryInstanceRequest() - assert args[0] == request_msg @@ -24580,7 +24588,6 @@ async def test_batch_create_instances_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.BatchCreateInstancesRequest() - assert args[0] == request_msg @@ -24605,7 +24612,6 @@ async def test_update_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateInstanceRequest() - assert args[0] == request_msg @@ -24630,7 +24636,6 @@ async def test_delete_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteInstanceRequest() - assert args[0] == request_msg @@ -24657,7 +24662,6 @@ async def test_failover_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.FailoverInstanceRequest() - assert args[0] == request_msg @@ -24682,7 +24686,6 @@ async def test_inject_fault_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.InjectFaultRequest() - assert args[0] == request_msg @@ -24707,7 +24710,6 @@ async def test_restart_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.RestartInstanceRequest() - assert args[0] == request_msg @@ -24732,7 +24734,6 @@ async def test_execute_sql_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ExecuteSqlRequest() - assert args[0] == request_msg @@ -24760,7 +24761,6 @@ async def test_list_backups_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListBackupsRequest() - assert args[0] == request_msg @@ -24799,7 +24799,6 @@ async def test_get_backup_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetBackupRequest() - assert args[0] == request_msg @@ -24824,7 +24823,6 @@ async def test_create_backup_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateBackupRequest() - assert args[0] == request_msg @@ -24849,7 +24847,6 @@ async def test_update_backup_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateBackupRequest() - assert args[0] == request_msg @@ -24874,7 +24871,6 @@ async def test_delete_backup_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteBackupRequest() - assert args[0] == request_msg @@ -24903,7 +24899,6 @@ async def test_list_supported_database_flags_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListSupportedDatabaseFlagsRequest() - assert args[0] == request_msg @@ -24934,7 +24929,6 @@ async def test_generate_client_certificate_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GenerateClientCertificateRequest() - assert args[0] == request_msg @@ -24968,7 +24962,6 @@ async def test_get_connection_info_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetConnectionInfoRequest() - assert args[0] == request_msg @@ -24996,7 +24989,6 @@ async def test_list_users_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListUsersRequest() - assert args[0] == request_msg @@ -25027,7 +25019,6 @@ async def test_get_user_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetUserRequest() - assert args[0] == request_msg @@ -25058,7 +25049,6 @@ async def test_create_user_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateUserRequest() - assert args[0] == request_msg @@ -25089,7 +25079,6 @@ async def test_update_user_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateUserRequest() - assert args[0] == request_msg @@ -25112,7 +25101,6 @@ async def test_delete_user_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteUserRequest() - assert args[0] == request_msg @@ -25139,7 +25127,6 @@ async def test_list_databases_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListDatabasesRequest() - assert args[0] == request_msg @@ -25172,7 +25159,6 @@ async def test_create_database_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateDatabaseRequest() - assert args[0] == request_msg @@ -32045,7 +32031,6 @@ def test_list_clusters_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListClustersRequest() - assert args[0] == request_msg @@ -32065,7 +32050,6 @@ def test_get_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetClusterRequest() - assert args[0] == request_msg @@ -32085,7 +32069,6 @@ def test_create_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateClusterRequest() - assert args[0] == request_msg @@ -32105,7 +32088,6 @@ def test_update_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateClusterRequest() - assert args[0] == request_msg @@ -32125,7 +32107,6 @@ def test_export_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ExportClusterRequest() - assert args[0] == request_msg @@ -32145,7 +32126,6 @@ def test_import_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ImportClusterRequest() - assert args[0] == request_msg @@ -32165,7 +32145,6 @@ def test_upgrade_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpgradeClusterRequest() - assert args[0] == request_msg @@ -32185,7 +32164,6 @@ def test_delete_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteClusterRequest() - assert args[0] == request_msg @@ -32205,7 +32183,6 @@ def test_promote_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.PromoteClusterRequest() - assert args[0] == request_msg @@ -32227,7 +32204,6 @@ def test_switchover_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.SwitchoverClusterRequest() - assert args[0] == request_msg @@ -32247,7 +32223,6 @@ def test_restore_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.RestoreClusterRequest() - assert args[0] == request_msg @@ -32269,7 +32244,6 @@ def test_create_secondary_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateSecondaryClusterRequest() - assert args[0] == request_msg @@ -32289,7 +32263,6 @@ def test_list_instances_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListInstancesRequest() - assert args[0] == request_msg @@ -32309,7 +32282,6 @@ def test_get_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetInstanceRequest() - assert args[0] == request_msg @@ -32329,7 +32301,6 @@ def test_create_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateInstanceRequest() - assert args[0] == request_msg @@ -32351,7 +32322,6 @@ def test_create_secondary_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateSecondaryInstanceRequest() - assert args[0] == request_msg @@ -32373,7 +32343,6 @@ def test_batch_create_instances_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.BatchCreateInstancesRequest() - assert args[0] == request_msg @@ -32393,7 +32362,6 @@ def test_update_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateInstanceRequest() - assert args[0] == request_msg @@ -32413,7 +32381,6 @@ def test_delete_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteInstanceRequest() - assert args[0] == request_msg @@ -32435,7 +32402,6 @@ def test_failover_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.FailoverInstanceRequest() - assert args[0] == request_msg @@ -32455,7 +32421,6 @@ def test_inject_fault_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.InjectFaultRequest() - assert args[0] == request_msg @@ -32475,7 +32440,6 @@ def test_restart_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.RestartInstanceRequest() - assert args[0] == request_msg @@ -32495,7 +32459,6 @@ def test_execute_sql_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ExecuteSqlRequest() - assert args[0] == request_msg @@ -32515,7 +32478,6 @@ def test_list_backups_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListBackupsRequest() - assert args[0] == request_msg @@ -32535,7 +32497,6 @@ def test_get_backup_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetBackupRequest() - assert args[0] == request_msg @@ -32555,7 +32516,6 @@ def test_create_backup_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateBackupRequest() - assert args[0] == request_msg @@ -32575,7 +32535,6 @@ def test_update_backup_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateBackupRequest() - assert args[0] == request_msg @@ -32595,7 +32554,6 @@ def test_delete_backup_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteBackupRequest() - assert args[0] == request_msg @@ -32617,7 +32575,6 @@ def test_list_supported_database_flags_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListSupportedDatabaseFlagsRequest() - assert args[0] == request_msg @@ -32639,7 +32596,6 @@ def test_generate_client_certificate_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GenerateClientCertificateRequest() - assert args[0] == request_msg @@ -32661,7 +32617,6 @@ def test_get_connection_info_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetConnectionInfoRequest() - assert args[0] == request_msg @@ -32681,7 +32636,6 @@ def test_list_users_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListUsersRequest() - assert args[0] == request_msg @@ -32701,7 +32655,6 @@ def test_get_user_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetUserRequest() - assert args[0] == request_msg @@ -32721,7 +32674,6 @@ def test_create_user_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateUserRequest() - assert args[0] == request_msg @@ -32741,7 +32693,6 @@ def test_update_user_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateUserRequest() - assert args[0] == request_msg @@ -32761,7 +32712,6 @@ def test_delete_user_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteUserRequest() - assert args[0] == request_msg @@ -32781,7 +32731,6 @@ def test_list_databases_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListDatabasesRequest() - assert args[0] == request_msg @@ -32801,7 +32750,6 @@ def test_create_database_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateDatabaseRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-alloydb/tests/unit/gapic/alloydb_v1beta/test_alloy_dbcsql_admin.py b/packages/google-cloud-alloydb/tests/unit/gapic/alloydb_v1beta/test_alloy_dbcsql_admin.py index d7bad496876e..0f2cb83ad19f 100644 --- a/packages/google-cloud-alloydb/tests/unit/gapic/alloydb_v1beta/test_alloy_dbcsql_admin.py +++ b/packages/google-cloud-alloydb/tests/unit/gapic/alloydb_v1beta/test_alloy_dbcsql_admin.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 @@ -128,6 +129,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" @@ -1361,8 +1377,8 @@ def test_alloy_dbcsql_admin_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - csql_service.RestoreFromCloudSQLRequest, - dict, + csql_service.RestoreFromCloudSQLRequest(), + {}, ], ) def test_restore_from_cloud_sql(request_type, transport: str = "grpc"): @@ -1373,7 +1389,7 @@ def test_restore_from_cloud_sql(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1419,10 +1435,11 @@ def test_restore_from_cloud_sql_non_empty_request_with_auto_populated_field(): client.restore_from_cloud_sql(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == csql_service.RestoreFromCloudSQLRequest( + request_msg = csql_service.RestoreFromCloudSQLRequest( parent="parent_value", cluster_id="cluster_id_value", ) + assert args[0] == request_msg def test_restore_from_cloud_sql_use_cached_wrapped_rpc(): @@ -1518,9 +1535,15 @@ async def test_restore_from_cloud_sql_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + csql_service.RestoreFromCloudSQLRequest(), + {}, + ], +) async def test_restore_from_cloud_sql_async( - transport: str = "grpc_asyncio", - request_type=csql_service.RestoreFromCloudSQLRequest, + request_type, transport: str = "grpc_asyncio" ): client = AlloyDBCSQLAdminAsyncClient( credentials=async_anonymous_credentials(), @@ -1529,7 +1552,7 @@ async def test_restore_from_cloud_sql_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( @@ -1551,11 +1574,6 @@ async def test_restore_from_cloud_sql_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_restore_from_cloud_sql_async_from_dict(): - await test_restore_from_cloud_sql_async(request_type=dict) - - def test_restore_from_cloud_sql_field_headers(): client = AlloyDBCSQLAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2040,7 +2058,6 @@ def test_restore_from_cloud_sql_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = csql_service.RestoreFromCloudSQLRequest() - assert args[0] == request_msg @@ -2081,7 +2098,6 @@ async def test_restore_from_cloud_sql_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = csql_service.RestoreFromCloudSQLRequest() - assert args[0] == request_msg @@ -2617,7 +2633,6 @@ def test_restore_from_cloud_sql_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = csql_service.RestoreFromCloudSQLRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-api-gateway/noxfile.py b/packages/google-cloud-api-gateway/noxfile.py index 59e2c8557b76..5d48da9f9b29 100644 --- a/packages/google-cloud-api-gateway/noxfile.py +++ b/packages/google-cloud-api-gateway/noxfile.py @@ -47,7 +47,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-api-gateway" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-api-gateway/setup.py b/packages/google-cloud-api-gateway/setup.py index a806ea5a50b2..9c62ef5a32e9 100644 --- a/packages/google-cloud-api-gateway/setup.py +++ b/packages/google-cloud-api-gateway/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/google-cloud-api-gateway/testing/constraints-3.10.txt b/packages/google-cloud-api-gateway/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-api-gateway/testing/constraints-3.10.txt +++ b/packages/google-cloud-api-gateway/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-api-gateway/tests/unit/gapic/apigateway_v1/test_api_gateway_service.py b/packages/google-cloud-api-gateway/tests/unit/gapic/apigateway_v1/test_api_gateway_service.py index 8c303a703e35..774368c084c5 100644 --- a/packages/google-cloud-api-gateway/tests/unit/gapic/apigateway_v1/test_api_gateway_service.py +++ b/packages/google-cloud-api-gateway/tests/unit/gapic/apigateway_v1/test_api_gateway_service.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 @@ -115,6 +116,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" @@ -1356,8 +1372,8 @@ def test_api_gateway_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - apigateway.ListGatewaysRequest, - dict, + apigateway.ListGatewaysRequest(), + {}, ], ) def test_list_gateways(request_type, transport: str = "grpc"): @@ -1368,7 +1384,7 @@ def test_list_gateways(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_gateways), "__call__") as call: @@ -1417,12 +1433,13 @@ def test_list_gateways_non_empty_request_with_auto_populated_field(): client.list_gateways(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apigateway.ListGatewaysRequest( + request_msg = apigateway.ListGatewaysRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_gateways_use_cached_wrapped_rpc(): @@ -1503,9 +1520,14 @@ async def test_list_gateways_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_gateways_async( - transport: str = "grpc_asyncio", request_type=apigateway.ListGatewaysRequest -): +@pytest.mark.parametrize( + "request_type", + [ + apigateway.ListGatewaysRequest(), + {}, + ], +) +async def test_list_gateways_async(request_type, transport: str = "grpc_asyncio"): client = ApiGatewayServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1513,7 +1535,7 @@ async def test_list_gateways_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_gateways), "__call__") as call: @@ -1538,11 +1560,6 @@ async def test_list_gateways_async( assert response.unreachable_locations == ["unreachable_locations_value"] -@pytest.mark.asyncio -async def test_list_gateways_async_from_dict(): - await test_list_gateways_async(request_type=dict) - - def test_list_gateways_field_headers(): client = ApiGatewayServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1879,8 +1896,8 @@ async def test_list_gateways_async_pages(): @pytest.mark.parametrize( "request_type", [ - apigateway.GetGatewayRequest, - dict, + apigateway.GetGatewayRequest(), + {}, ], ) def test_get_gateway(request_type, transport: str = "grpc"): @@ -1891,7 +1908,7 @@ def test_get_gateway(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_gateway), "__call__") as call: @@ -1943,9 +1960,10 @@ def test_get_gateway_non_empty_request_with_auto_populated_field(): client.get_gateway(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apigateway.GetGatewayRequest( + request_msg = apigateway.GetGatewayRequest( name="name_value", ) + assert args[0] == request_msg def test_get_gateway_use_cached_wrapped_rpc(): @@ -2026,9 +2044,14 @@ async def test_get_gateway_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_gateway_async( - transport: str = "grpc_asyncio", request_type=apigateway.GetGatewayRequest -): +@pytest.mark.parametrize( + "request_type", + [ + apigateway.GetGatewayRequest(), + {}, + ], +) +async def test_get_gateway_async(request_type, transport: str = "grpc_asyncio"): client = ApiGatewayServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2036,7 +2059,7 @@ async def test_get_gateway_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_gateway), "__call__") as call: @@ -2067,11 +2090,6 @@ async def test_get_gateway_async( assert response.default_hostname == "default_hostname_value" -@pytest.mark.asyncio -async def test_get_gateway_async_from_dict(): - await test_get_gateway_async(request_type=dict) - - def test_get_gateway_field_headers(): client = ApiGatewayServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2214,8 +2232,8 @@ async def test_get_gateway_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - apigateway.CreateGatewayRequest, - dict, + apigateway.CreateGatewayRequest(), + {}, ], ) def test_create_gateway(request_type, transport: str = "grpc"): @@ -2226,7 +2244,7 @@ def test_create_gateway(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_gateway), "__call__") as call: @@ -2268,10 +2286,11 @@ def test_create_gateway_non_empty_request_with_auto_populated_field(): client.create_gateway(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apigateway.CreateGatewayRequest( + request_msg = apigateway.CreateGatewayRequest( parent="parent_value", gateway_id="gateway_id_value", ) + assert args[0] == request_msg def test_create_gateway_use_cached_wrapped_rpc(): @@ -2362,9 +2381,14 @@ async def test_create_gateway_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_gateway_async( - transport: str = "grpc_asyncio", request_type=apigateway.CreateGatewayRequest -): +@pytest.mark.parametrize( + "request_type", + [ + apigateway.CreateGatewayRequest(), + {}, + ], +) +async def test_create_gateway_async(request_type, transport: str = "grpc_asyncio"): client = ApiGatewayServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2372,7 +2396,7 @@ async def test_create_gateway_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_gateway), "__call__") as call: @@ -2392,11 +2416,6 @@ async def test_create_gateway_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_gateway_async_from_dict(): - await test_create_gateway_async(request_type=dict) - - def test_create_gateway_field_headers(): client = ApiGatewayServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2563,8 +2582,8 @@ async def test_create_gateway_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - apigateway.UpdateGatewayRequest, - dict, + apigateway.UpdateGatewayRequest(), + {}, ], ) def test_update_gateway(request_type, transport: str = "grpc"): @@ -2575,7 +2594,7 @@ def test_update_gateway(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_gateway), "__call__") as call: @@ -2614,7 +2633,8 @@ def test_update_gateway_non_empty_request_with_auto_populated_field(): client.update_gateway(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apigateway.UpdateGatewayRequest() + request_msg = apigateway.UpdateGatewayRequest() + assert args[0] == request_msg def test_update_gateway_use_cached_wrapped_rpc(): @@ -2705,9 +2725,14 @@ async def test_update_gateway_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_gateway_async( - transport: str = "grpc_asyncio", request_type=apigateway.UpdateGatewayRequest -): +@pytest.mark.parametrize( + "request_type", + [ + apigateway.UpdateGatewayRequest(), + {}, + ], +) +async def test_update_gateway_async(request_type, transport: str = "grpc_asyncio"): client = ApiGatewayServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2715,7 +2740,7 @@ async def test_update_gateway_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_gateway), "__call__") as call: @@ -2735,11 +2760,6 @@ async def test_update_gateway_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_gateway_async_from_dict(): - await test_update_gateway_async(request_type=dict) - - def test_update_gateway_field_headers(): client = ApiGatewayServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2896,8 +2916,8 @@ async def test_update_gateway_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - apigateway.DeleteGatewayRequest, - dict, + apigateway.DeleteGatewayRequest(), + {}, ], ) def test_delete_gateway(request_type, transport: str = "grpc"): @@ -2908,7 +2928,7 @@ def test_delete_gateway(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_gateway), "__call__") as call: @@ -2949,9 +2969,10 @@ def test_delete_gateway_non_empty_request_with_auto_populated_field(): client.delete_gateway(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apigateway.DeleteGatewayRequest( + request_msg = apigateway.DeleteGatewayRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_gateway_use_cached_wrapped_rpc(): @@ -3042,9 +3063,14 @@ async def test_delete_gateway_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_gateway_async( - transport: str = "grpc_asyncio", request_type=apigateway.DeleteGatewayRequest -): +@pytest.mark.parametrize( + "request_type", + [ + apigateway.DeleteGatewayRequest(), + {}, + ], +) +async def test_delete_gateway_async(request_type, transport: str = "grpc_asyncio"): client = ApiGatewayServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3052,7 +3078,7 @@ async def test_delete_gateway_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_gateway), "__call__") as call: @@ -3072,11 +3098,6 @@ async def test_delete_gateway_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_gateway_async_from_dict(): - await test_delete_gateway_async(request_type=dict) - - def test_delete_gateway_field_headers(): client = ApiGatewayServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3223,8 +3244,8 @@ async def test_delete_gateway_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - apigateway.ListApisRequest, - dict, + apigateway.ListApisRequest(), + {}, ], ) def test_list_apis(request_type, transport: str = "grpc"): @@ -3235,7 +3256,7 @@ def test_list_apis(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_apis), "__call__") as call: @@ -3284,12 +3305,13 @@ def test_list_apis_non_empty_request_with_auto_populated_field(): client.list_apis(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apigateway.ListApisRequest( + request_msg = apigateway.ListApisRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_apis_use_cached_wrapped_rpc(): @@ -3368,9 +3390,14 @@ async def test_list_apis_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_list_apis_async( - transport: str = "grpc_asyncio", request_type=apigateway.ListApisRequest -): +@pytest.mark.parametrize( + "request_type", + [ + apigateway.ListApisRequest(), + {}, + ], +) +async def test_list_apis_async(request_type, transport: str = "grpc_asyncio"): client = ApiGatewayServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3378,7 +3405,7 @@ async def test_list_apis_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_apis), "__call__") as call: @@ -3403,11 +3430,6 @@ async def test_list_apis_async( assert response.unreachable_locations == ["unreachable_locations_value"] -@pytest.mark.asyncio -async def test_list_apis_async_from_dict(): - await test_list_apis_async(request_type=dict) - - def test_list_apis_field_headers(): client = ApiGatewayServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3744,8 +3766,8 @@ async def test_list_apis_async_pages(): @pytest.mark.parametrize( "request_type", [ - apigateway.GetApiRequest, - dict, + apigateway.GetApiRequest(), + {}, ], ) def test_get_api(request_type, transport: str = "grpc"): @@ -3756,7 +3778,7 @@ def test_get_api(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_api), "__call__") as call: @@ -3806,9 +3828,10 @@ def test_get_api_non_empty_request_with_auto_populated_field(): client.get_api(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apigateway.GetApiRequest( + request_msg = apigateway.GetApiRequest( name="name_value", ) + assert args[0] == request_msg def test_get_api_use_cached_wrapped_rpc(): @@ -3887,9 +3910,14 @@ async def test_get_api_async_use_cached_wrapped_rpc(transport: str = "grpc_async @pytest.mark.asyncio -async def test_get_api_async( - transport: str = "grpc_asyncio", request_type=apigateway.GetApiRequest -): +@pytest.mark.parametrize( + "request_type", + [ + apigateway.GetApiRequest(), + {}, + ], +) +async def test_get_api_async(request_type, transport: str = "grpc_asyncio"): client = ApiGatewayServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3897,7 +3925,7 @@ async def test_get_api_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_api), "__call__") as call: @@ -3926,11 +3954,6 @@ async def test_get_api_async( assert response.state == apigateway.Api.State.CREATING -@pytest.mark.asyncio -async def test_get_api_async_from_dict(): - await test_get_api_async(request_type=dict) - - def test_get_api_field_headers(): client = ApiGatewayServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4073,8 +4096,8 @@ async def test_get_api_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - apigateway.CreateApiRequest, - dict, + apigateway.CreateApiRequest(), + {}, ], ) def test_create_api(request_type, transport: str = "grpc"): @@ -4085,7 +4108,7 @@ def test_create_api(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_api), "__call__") as call: @@ -4127,10 +4150,11 @@ def test_create_api_non_empty_request_with_auto_populated_field(): client.create_api(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apigateway.CreateApiRequest( + request_msg = apigateway.CreateApiRequest( parent="parent_value", api_id="api_id_value", ) + assert args[0] == request_msg def test_create_api_use_cached_wrapped_rpc(): @@ -4219,9 +4243,14 @@ async def test_create_api_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_create_api_async( - transport: str = "grpc_asyncio", request_type=apigateway.CreateApiRequest -): +@pytest.mark.parametrize( + "request_type", + [ + apigateway.CreateApiRequest(), + {}, + ], +) +async def test_create_api_async(request_type, transport: str = "grpc_asyncio"): client = ApiGatewayServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4229,7 +4258,7 @@ async def test_create_api_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_api), "__call__") as call: @@ -4249,11 +4278,6 @@ async def test_create_api_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_api_async_from_dict(): - await test_create_api_async(request_type=dict) - - def test_create_api_field_headers(): client = ApiGatewayServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4420,8 +4444,8 @@ async def test_create_api_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - apigateway.UpdateApiRequest, - dict, + apigateway.UpdateApiRequest(), + {}, ], ) def test_update_api(request_type, transport: str = "grpc"): @@ -4432,7 +4456,7 @@ def test_update_api(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_api), "__call__") as call: @@ -4471,7 +4495,8 @@ def test_update_api_non_empty_request_with_auto_populated_field(): client.update_api(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apigateway.UpdateApiRequest() + request_msg = apigateway.UpdateApiRequest() + assert args[0] == request_msg def test_update_api_use_cached_wrapped_rpc(): @@ -4560,9 +4585,14 @@ async def test_update_api_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_update_api_async( - transport: str = "grpc_asyncio", request_type=apigateway.UpdateApiRequest -): +@pytest.mark.parametrize( + "request_type", + [ + apigateway.UpdateApiRequest(), + {}, + ], +) +async def test_update_api_async(request_type, transport: str = "grpc_asyncio"): client = ApiGatewayServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4570,7 +4600,7 @@ async def test_update_api_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_api), "__call__") as call: @@ -4590,11 +4620,6 @@ async def test_update_api_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_api_async_from_dict(): - await test_update_api_async(request_type=dict) - - def test_update_api_field_headers(): client = ApiGatewayServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4751,8 +4776,8 @@ async def test_update_api_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - apigateway.DeleteApiRequest, - dict, + apigateway.DeleteApiRequest(), + {}, ], ) def test_delete_api(request_type, transport: str = "grpc"): @@ -4763,7 +4788,7 @@ def test_delete_api(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_api), "__call__") as call: @@ -4804,9 +4829,10 @@ def test_delete_api_non_empty_request_with_auto_populated_field(): client.delete_api(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apigateway.DeleteApiRequest( + request_msg = apigateway.DeleteApiRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_api_use_cached_wrapped_rpc(): @@ -4895,9 +4921,14 @@ async def test_delete_api_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_delete_api_async( - transport: str = "grpc_asyncio", request_type=apigateway.DeleteApiRequest -): +@pytest.mark.parametrize( + "request_type", + [ + apigateway.DeleteApiRequest(), + {}, + ], +) +async def test_delete_api_async(request_type, transport: str = "grpc_asyncio"): client = ApiGatewayServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4905,7 +4936,7 @@ async def test_delete_api_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_api), "__call__") as call: @@ -4925,11 +4956,6 @@ async def test_delete_api_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_api_async_from_dict(): - await test_delete_api_async(request_type=dict) - - def test_delete_api_field_headers(): client = ApiGatewayServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5076,8 +5102,8 @@ async def test_delete_api_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - apigateway.ListApiConfigsRequest, - dict, + apigateway.ListApiConfigsRequest(), + {}, ], ) def test_list_api_configs(request_type, transport: str = "grpc"): @@ -5088,7 +5114,7 @@ def test_list_api_configs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_api_configs), "__call__") as call: @@ -5137,12 +5163,13 @@ def test_list_api_configs_non_empty_request_with_auto_populated_field(): client.list_api_configs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apigateway.ListApiConfigsRequest( + request_msg = apigateway.ListApiConfigsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_api_configs_use_cached_wrapped_rpc(): @@ -5225,9 +5252,14 @@ async def test_list_api_configs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_api_configs_async( - transport: str = "grpc_asyncio", request_type=apigateway.ListApiConfigsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + apigateway.ListApiConfigsRequest(), + {}, + ], +) +async def test_list_api_configs_async(request_type, transport: str = "grpc_asyncio"): client = ApiGatewayServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5235,7 +5267,7 @@ async def test_list_api_configs_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_api_configs), "__call__") as call: @@ -5260,11 +5292,6 @@ async def test_list_api_configs_async( assert response.unreachable_locations == ["unreachable_locations_value"] -@pytest.mark.asyncio -async def test_list_api_configs_async_from_dict(): - await test_list_api_configs_async(request_type=dict) - - def test_list_api_configs_field_headers(): client = ApiGatewayServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5601,8 +5628,8 @@ async def test_list_api_configs_async_pages(): @pytest.mark.parametrize( "request_type", [ - apigateway.GetApiConfigRequest, - dict, + apigateway.GetApiConfigRequest(), + {}, ], ) def test_get_api_config(request_type, transport: str = "grpc"): @@ -5613,7 +5640,7 @@ def test_get_api_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(type(client.transport.get_api_config), "__call__") as call: @@ -5665,9 +5692,10 @@ def test_get_api_config_non_empty_request_with_auto_populated_field(): client.get_api_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apigateway.GetApiConfigRequest( + request_msg = apigateway.GetApiConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_api_config_use_cached_wrapped_rpc(): @@ -5748,9 +5776,14 @@ async def test_get_api_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_api_config_async( - transport: str = "grpc_asyncio", request_type=apigateway.GetApiConfigRequest -): +@pytest.mark.parametrize( + "request_type", + [ + apigateway.GetApiConfigRequest(), + {}, + ], +) +async def test_get_api_config_async(request_type, transport: str = "grpc_asyncio"): client = ApiGatewayServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5758,7 +5791,7 @@ async def test_get_api_config_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_api_config), "__call__") as call: @@ -5789,11 +5822,6 @@ async def test_get_api_config_async( assert response.state == apigateway.ApiConfig.State.CREATING -@pytest.mark.asyncio -async def test_get_api_config_async_from_dict(): - await test_get_api_config_async(request_type=dict) - - def test_get_api_config_field_headers(): client = ApiGatewayServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5940,8 +5968,8 @@ async def test_get_api_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - apigateway.CreateApiConfigRequest, - dict, + apigateway.CreateApiConfigRequest(), + {}, ], ) def test_create_api_config(request_type, transport: str = "grpc"): @@ -5952,7 +5980,7 @@ def test_create_api_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( @@ -5998,10 +6026,11 @@ def test_create_api_config_non_empty_request_with_auto_populated_field(): client.create_api_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apigateway.CreateApiConfigRequest( + request_msg = apigateway.CreateApiConfigRequest( parent="parent_value", api_config_id="api_config_id_value", ) + assert args[0] == request_msg def test_create_api_config_use_cached_wrapped_rpc(): @@ -6094,9 +6123,14 @@ async def test_create_api_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_api_config_async( - transport: str = "grpc_asyncio", request_type=apigateway.CreateApiConfigRequest -): +@pytest.mark.parametrize( + "request_type", + [ + apigateway.CreateApiConfigRequest(), + {}, + ], +) +async def test_create_api_config_async(request_type, transport: str = "grpc_asyncio"): client = ApiGatewayServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6104,7 +6138,7 @@ async def test_create_api_config_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( @@ -6126,11 +6160,6 @@ async def test_create_api_config_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_api_config_async_from_dict(): - await test_create_api_config_async(request_type=dict) - - def test_create_api_config_field_headers(): client = ApiGatewayServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6305,8 +6334,8 @@ async def test_create_api_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - apigateway.UpdateApiConfigRequest, - dict, + apigateway.UpdateApiConfigRequest(), + {}, ], ) def test_update_api_config(request_type, transport: str = "grpc"): @@ -6317,7 +6346,7 @@ def test_update_api_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( @@ -6360,7 +6389,8 @@ def test_update_api_config_non_empty_request_with_auto_populated_field(): client.update_api_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apigateway.UpdateApiConfigRequest() + request_msg = apigateway.UpdateApiConfigRequest() + assert args[0] == request_msg def test_update_api_config_use_cached_wrapped_rpc(): @@ -6453,9 +6483,14 @@ async def test_update_api_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_api_config_async( - transport: str = "grpc_asyncio", request_type=apigateway.UpdateApiConfigRequest -): +@pytest.mark.parametrize( + "request_type", + [ + apigateway.UpdateApiConfigRequest(), + {}, + ], +) +async def test_update_api_config_async(request_type, transport: str = "grpc_asyncio"): client = ApiGatewayServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6463,7 +6498,7 @@ async def test_update_api_config_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( @@ -6485,11 +6520,6 @@ async def test_update_api_config_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_api_config_async_from_dict(): - await test_update_api_config_async(request_type=dict) - - def test_update_api_config_field_headers(): client = ApiGatewayServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6654,8 +6684,8 @@ async def test_update_api_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - apigateway.DeleteApiConfigRequest, - dict, + apigateway.DeleteApiConfigRequest(), + {}, ], ) def test_delete_api_config(request_type, transport: str = "grpc"): @@ -6666,7 +6696,7 @@ def test_delete_api_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( @@ -6711,9 +6741,10 @@ def test_delete_api_config_non_empty_request_with_auto_populated_field(): client.delete_api_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apigateway.DeleteApiConfigRequest( + request_msg = apigateway.DeleteApiConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_api_config_use_cached_wrapped_rpc(): @@ -6806,9 +6837,14 @@ async def test_delete_api_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_api_config_async( - transport: str = "grpc_asyncio", request_type=apigateway.DeleteApiConfigRequest -): +@pytest.mark.parametrize( + "request_type", + [ + apigateway.DeleteApiConfigRequest(), + {}, + ], +) +async def test_delete_api_config_async(request_type, transport: str = "grpc_asyncio"): client = ApiGatewayServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6816,7 +6852,7 @@ async def test_delete_api_config_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( @@ -6838,11 +6874,6 @@ async def test_delete_api_config_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_api_config_async_from_dict(): - await test_delete_api_config_async(request_type=dict) - - def test_delete_api_config_field_headers(): client = ApiGatewayServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10106,7 +10137,6 @@ def test_list_gateways_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apigateway.ListGatewaysRequest() - assert args[0] == request_msg @@ -10127,7 +10157,6 @@ def test_get_gateway_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apigateway.GetGatewayRequest() - assert args[0] == request_msg @@ -10148,7 +10177,6 @@ def test_create_gateway_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apigateway.CreateGatewayRequest() - assert args[0] == request_msg @@ -10169,7 +10197,6 @@ def test_update_gateway_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apigateway.UpdateGatewayRequest() - assert args[0] == request_msg @@ -10190,7 +10217,6 @@ def test_delete_gateway_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apigateway.DeleteGatewayRequest() - assert args[0] == request_msg @@ -10211,7 +10237,6 @@ def test_list_apis_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apigateway.ListApisRequest() - assert args[0] == request_msg @@ -10232,7 +10257,6 @@ def test_get_api_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apigateway.GetApiRequest() - assert args[0] == request_msg @@ -10253,7 +10277,6 @@ def test_create_api_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apigateway.CreateApiRequest() - assert args[0] == request_msg @@ -10274,7 +10297,6 @@ def test_update_api_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apigateway.UpdateApiRequest() - assert args[0] == request_msg @@ -10295,7 +10317,6 @@ def test_delete_api_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apigateway.DeleteApiRequest() - assert args[0] == request_msg @@ -10316,7 +10337,6 @@ def test_list_api_configs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apigateway.ListApiConfigsRequest() - assert args[0] == request_msg @@ -10337,7 +10357,6 @@ def test_get_api_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apigateway.GetApiConfigRequest() - assert args[0] == request_msg @@ -10360,7 +10379,6 @@ def test_create_api_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apigateway.CreateApiConfigRequest() - assert args[0] == request_msg @@ -10383,7 +10401,6 @@ def test_update_api_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apigateway.UpdateApiConfigRequest() - assert args[0] == request_msg @@ -10406,7 +10423,6 @@ def test_delete_api_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apigateway.DeleteApiConfigRequest() - assert args[0] == request_msg @@ -10448,7 +10464,6 @@ async def test_list_gateways_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apigateway.ListGatewaysRequest() - assert args[0] == request_msg @@ -10479,7 +10494,6 @@ async def test_get_gateway_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apigateway.GetGatewayRequest() - assert args[0] == request_msg @@ -10504,7 +10518,6 @@ async def test_create_gateway_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apigateway.CreateGatewayRequest() - assert args[0] == request_msg @@ -10529,7 +10542,6 @@ async def test_update_gateway_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apigateway.UpdateGatewayRequest() - assert args[0] == request_msg @@ -10554,7 +10566,6 @@ async def test_delete_gateway_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apigateway.DeleteGatewayRequest() - assert args[0] == request_msg @@ -10582,7 +10593,6 @@ async def test_list_apis_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apigateway.ListApisRequest() - assert args[0] == request_msg @@ -10612,7 +10622,6 @@ async def test_get_api_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apigateway.GetApiRequest() - assert args[0] == request_msg @@ -10637,7 +10646,6 @@ async def test_create_api_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apigateway.CreateApiRequest() - assert args[0] == request_msg @@ -10662,7 +10670,6 @@ async def test_update_api_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apigateway.UpdateApiRequest() - assert args[0] == request_msg @@ -10687,7 +10694,6 @@ async def test_delete_api_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apigateway.DeleteApiRequest() - assert args[0] == request_msg @@ -10715,7 +10721,6 @@ async def test_list_api_configs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apigateway.ListApiConfigsRequest() - assert args[0] == request_msg @@ -10746,7 +10751,6 @@ async def test_get_api_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apigateway.GetApiConfigRequest() - assert args[0] == request_msg @@ -10773,7 +10777,6 @@ async def test_create_api_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apigateway.CreateApiConfigRequest() - assert args[0] == request_msg @@ -10800,7 +10803,6 @@ async def test_update_api_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apigateway.UpdateApiConfigRequest() - assert args[0] == request_msg @@ -10827,7 +10829,6 @@ async def test_delete_api_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apigateway.DeleteApiConfigRequest() - assert args[0] == request_msg @@ -13262,7 +13263,6 @@ def test_list_gateways_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apigateway.ListGatewaysRequest() - assert args[0] == request_msg @@ -13282,7 +13282,6 @@ def test_get_gateway_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apigateway.GetGatewayRequest() - assert args[0] == request_msg @@ -13302,7 +13301,6 @@ def test_create_gateway_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apigateway.CreateGatewayRequest() - assert args[0] == request_msg @@ -13322,7 +13320,6 @@ def test_update_gateway_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apigateway.UpdateGatewayRequest() - assert args[0] == request_msg @@ -13342,7 +13339,6 @@ def test_delete_gateway_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apigateway.DeleteGatewayRequest() - assert args[0] == request_msg @@ -13362,7 +13358,6 @@ def test_list_apis_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apigateway.ListApisRequest() - assert args[0] == request_msg @@ -13382,7 +13377,6 @@ def test_get_api_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apigateway.GetApiRequest() - assert args[0] == request_msg @@ -13402,7 +13396,6 @@ def test_create_api_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apigateway.CreateApiRequest() - assert args[0] == request_msg @@ -13422,7 +13415,6 @@ def test_update_api_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apigateway.UpdateApiRequest() - assert args[0] == request_msg @@ -13442,7 +13434,6 @@ def test_delete_api_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apigateway.DeleteApiRequest() - assert args[0] == request_msg @@ -13462,7 +13453,6 @@ def test_list_api_configs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apigateway.ListApiConfigsRequest() - assert args[0] == request_msg @@ -13482,7 +13472,6 @@ def test_get_api_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apigateway.GetApiConfigRequest() - assert args[0] == request_msg @@ -13504,7 +13493,6 @@ def test_create_api_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apigateway.CreateApiConfigRequest() - assert args[0] == request_msg @@ -13526,7 +13514,6 @@ def test_update_api_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apigateway.UpdateApiConfigRequest() - assert args[0] == request_msg @@ -13548,7 +13535,6 @@ def test_delete_api_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apigateway.DeleteApiConfigRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-api-keys/noxfile.py b/packages/google-cloud-api-keys/noxfile.py index 9cf3d8f9a96b..086c9842c20b 100644 --- a/packages/google-cloud-api-keys/noxfile.py +++ b/packages/google-cloud-api-keys/noxfile.py @@ -47,7 +47,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-api-keys" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-api-keys/setup.py b/packages/google-cloud-api-keys/setup.py index afeeae5fd23c..1a6adc159e8e 100644 --- a/packages/google-cloud-api-keys/setup.py +++ b/packages/google-cloud-api-keys/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/google-cloud-api-keys/testing/constraints-3.10.txt b/packages/google-cloud-api-keys/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-api-keys/testing/constraints-3.10.txt +++ b/packages/google-cloud-api-keys/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-api-keys/tests/unit/gapic/api_keys_v2/test_api_keys.py b/packages/google-cloud-api-keys/tests/unit/gapic/api_keys_v2/test_api_keys.py index 17ee4cdb9144..f7b6efbe61b9 100644 --- a/packages/google-cloud-api-keys/tests/unit/gapic/api_keys_v2/test_api_keys.py +++ b/packages/google-cloud-api-keys/tests/unit/gapic/api_keys_v2/test_api_keys.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 @@ -115,6 +116,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" @@ -1253,8 +1269,8 @@ def test_api_keys_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - apikeys.CreateKeyRequest, - dict, + apikeys.CreateKeyRequest(), + {}, ], ) def test_create_key(request_type, transport: str = "grpc"): @@ -1265,7 +1281,7 @@ def test_create_key(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_key), "__call__") as call: @@ -1307,10 +1323,11 @@ def test_create_key_non_empty_request_with_auto_populated_field(): client.create_key(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apikeys.CreateKeyRequest( + request_msg = apikeys.CreateKeyRequest( parent="parent_value", key_id="key_id_value", ) + assert args[0] == request_msg def test_create_key_use_cached_wrapped_rpc(): @@ -1399,9 +1416,14 @@ async def test_create_key_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_create_key_async( - transport: str = "grpc_asyncio", request_type=apikeys.CreateKeyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + apikeys.CreateKeyRequest(), + {}, + ], +) +async def test_create_key_async(request_type, transport: str = "grpc_asyncio"): client = ApiKeysAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1409,7 +1431,7 @@ async def test_create_key_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_key), "__call__") as call: @@ -1429,11 +1451,6 @@ async def test_create_key_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_key_async_from_dict(): - await test_create_key_async(request_type=dict) - - def test_create_key_field_headers(): client = ApiKeysClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1600,8 +1617,8 @@ async def test_create_key_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - apikeys.ListKeysRequest, - dict, + apikeys.ListKeysRequest(), + {}, ], ) def test_list_keys(request_type, transport: str = "grpc"): @@ -1612,7 +1629,7 @@ def test_list_keys(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_keys), "__call__") as call: @@ -1657,10 +1674,11 @@ def test_list_keys_non_empty_request_with_auto_populated_field(): client.list_keys(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apikeys.ListKeysRequest( + request_msg = apikeys.ListKeysRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_keys_use_cached_wrapped_rpc(): @@ -1739,9 +1757,14 @@ async def test_list_keys_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_list_keys_async( - transport: str = "grpc_asyncio", request_type=apikeys.ListKeysRequest -): +@pytest.mark.parametrize( + "request_type", + [ + apikeys.ListKeysRequest(), + {}, + ], +) +async def test_list_keys_async(request_type, transport: str = "grpc_asyncio"): client = ApiKeysAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1749,7 +1772,7 @@ async def test_list_keys_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_keys), "__call__") as call: @@ -1772,11 +1795,6 @@ async def test_list_keys_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_keys_async_from_dict(): - await test_list_keys_async(request_type=dict) - - def test_list_keys_field_headers(): client = ApiKeysClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2113,8 +2131,8 @@ async def test_list_keys_async_pages(): @pytest.mark.parametrize( "request_type", [ - apikeys.GetKeyRequest, - dict, + apikeys.GetKeyRequest(), + {}, ], ) def test_get_key(request_type, transport: str = "grpc"): @@ -2125,7 +2143,7 @@ def test_get_key(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_key), "__call__") as call: @@ -2177,9 +2195,10 @@ def test_get_key_non_empty_request_with_auto_populated_field(): client.get_key(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apikeys.GetKeyRequest( + request_msg = apikeys.GetKeyRequest( name="name_value", ) + assert args[0] == request_msg def test_get_key_use_cached_wrapped_rpc(): @@ -2258,9 +2277,14 @@ async def test_get_key_async_use_cached_wrapped_rpc(transport: str = "grpc_async @pytest.mark.asyncio -async def test_get_key_async( - transport: str = "grpc_asyncio", request_type=apikeys.GetKeyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + apikeys.GetKeyRequest(), + {}, + ], +) +async def test_get_key_async(request_type, transport: str = "grpc_asyncio"): client = ApiKeysAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2268,7 +2292,7 @@ async def test_get_key_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_key), "__call__") as call: @@ -2299,11 +2323,6 @@ async def test_get_key_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_key_async_from_dict(): - await test_get_key_async(request_type=dict) - - def test_get_key_field_headers(): client = ApiKeysClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2446,8 +2465,8 @@ async def test_get_key_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - apikeys.GetKeyStringRequest, - dict, + apikeys.GetKeyStringRequest(), + {}, ], ) def test_get_key_string(request_type, transport: str = "grpc"): @@ -2458,7 +2477,7 @@ def test_get_key_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(type(client.transport.get_key_string), "__call__") as call: @@ -2502,9 +2521,10 @@ def test_get_key_string_non_empty_request_with_auto_populated_field(): client.get_key_string(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apikeys.GetKeyStringRequest( + request_msg = apikeys.GetKeyStringRequest( name="name_value", ) + assert args[0] == request_msg def test_get_key_string_use_cached_wrapped_rpc(): @@ -2585,9 +2605,14 @@ async def test_get_key_string_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_key_string_async( - transport: str = "grpc_asyncio", request_type=apikeys.GetKeyStringRequest -): +@pytest.mark.parametrize( + "request_type", + [ + apikeys.GetKeyStringRequest(), + {}, + ], +) +async def test_get_key_string_async(request_type, transport: str = "grpc_asyncio"): client = ApiKeysAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2595,7 +2620,7 @@ async def test_get_key_string_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_key_string), "__call__") as call: @@ -2618,11 +2643,6 @@ async def test_get_key_string_async( assert response.key_string == "key_string_value" -@pytest.mark.asyncio -async def test_get_key_string_async_from_dict(): - await test_get_key_string_async(request_type=dict) - - def test_get_key_string_field_headers(): client = ApiKeysClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2769,8 +2789,8 @@ async def test_get_key_string_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - apikeys.UpdateKeyRequest, - dict, + apikeys.UpdateKeyRequest(), + {}, ], ) def test_update_key(request_type, transport: str = "grpc"): @@ -2781,7 +2801,7 @@ def test_update_key(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_key), "__call__") as call: @@ -2820,7 +2840,8 @@ def test_update_key_non_empty_request_with_auto_populated_field(): client.update_key(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apikeys.UpdateKeyRequest() + request_msg = apikeys.UpdateKeyRequest() + assert args[0] == request_msg def test_update_key_use_cached_wrapped_rpc(): @@ -2909,9 +2930,14 @@ async def test_update_key_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_update_key_async( - transport: str = "grpc_asyncio", request_type=apikeys.UpdateKeyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + apikeys.UpdateKeyRequest(), + {}, + ], +) +async def test_update_key_async(request_type, transport: str = "grpc_asyncio"): client = ApiKeysAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2919,7 +2945,7 @@ async def test_update_key_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_key), "__call__") as call: @@ -2939,11 +2965,6 @@ async def test_update_key_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_key_async_from_dict(): - await test_update_key_async(request_type=dict) - - def test_update_key_field_headers(): client = ApiKeysClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3100,8 +3121,8 @@ async def test_update_key_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - apikeys.DeleteKeyRequest, - dict, + apikeys.DeleteKeyRequest(), + {}, ], ) def test_delete_key(request_type, transport: str = "grpc"): @@ -3112,7 +3133,7 @@ def test_delete_key(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_key), "__call__") as call: @@ -3154,10 +3175,11 @@ def test_delete_key_non_empty_request_with_auto_populated_field(): client.delete_key(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apikeys.DeleteKeyRequest( + request_msg = apikeys.DeleteKeyRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_key_use_cached_wrapped_rpc(): @@ -3246,9 +3268,14 @@ async def test_delete_key_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_delete_key_async( - transport: str = "grpc_asyncio", request_type=apikeys.DeleteKeyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + apikeys.DeleteKeyRequest(), + {}, + ], +) +async def test_delete_key_async(request_type, transport: str = "grpc_asyncio"): client = ApiKeysAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3256,7 +3283,7 @@ async def test_delete_key_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_key), "__call__") as call: @@ -3276,11 +3303,6 @@ async def test_delete_key_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_key_async_from_dict(): - await test_delete_key_async(request_type=dict) - - def test_delete_key_field_headers(): client = ApiKeysClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3427,8 +3449,8 @@ async def test_delete_key_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - apikeys.UndeleteKeyRequest, - dict, + apikeys.UndeleteKeyRequest(), + {}, ], ) def test_undelete_key(request_type, transport: str = "grpc"): @@ -3439,7 +3461,7 @@ def test_undelete_key(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_key), "__call__") as call: @@ -3480,9 +3502,10 @@ def test_undelete_key_non_empty_request_with_auto_populated_field(): client.undelete_key(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apikeys.UndeleteKeyRequest( + request_msg = apikeys.UndeleteKeyRequest( name="name_value", ) + assert args[0] == request_msg def test_undelete_key_use_cached_wrapped_rpc(): @@ -3573,9 +3596,14 @@ async def test_undelete_key_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_undelete_key_async( - transport: str = "grpc_asyncio", request_type=apikeys.UndeleteKeyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + apikeys.UndeleteKeyRequest(), + {}, + ], +) +async def test_undelete_key_async(request_type, transport: str = "grpc_asyncio"): client = ApiKeysAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3583,7 +3611,7 @@ async def test_undelete_key_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_key), "__call__") as call: @@ -3603,11 +3631,6 @@ async def test_undelete_key_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_undelete_key_async_from_dict(): - await test_undelete_key_async(request_type=dict) - - def test_undelete_key_field_headers(): client = ApiKeysClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3672,8 +3695,8 @@ async def test_undelete_key_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - apikeys.LookupKeyRequest, - dict, + apikeys.LookupKeyRequest(), + {}, ], ) def test_lookup_key(request_type, transport: str = "grpc"): @@ -3684,7 +3707,7 @@ def test_lookup_key(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.lookup_key), "__call__") as call: @@ -3730,9 +3753,10 @@ def test_lookup_key_non_empty_request_with_auto_populated_field(): client.lookup_key(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apikeys.LookupKeyRequest( + request_msg = apikeys.LookupKeyRequest( key_string="key_string_value", ) + assert args[0] == request_msg def test_lookup_key_use_cached_wrapped_rpc(): @@ -3811,9 +3835,14 @@ async def test_lookup_key_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_lookup_key_async( - transport: str = "grpc_asyncio", request_type=apikeys.LookupKeyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + apikeys.LookupKeyRequest(), + {}, + ], +) +async def test_lookup_key_async(request_type, transport: str = "grpc_asyncio"): client = ApiKeysAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3821,7 +3850,7 @@ async def test_lookup_key_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.lookup_key), "__call__") as call: @@ -3846,11 +3875,6 @@ async def test_lookup_key_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_lookup_key_async_from_dict(): - await test_lookup_key_async(request_type=dict) - - def test_create_key_rest_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, # instead of constructing them on each call @@ -5368,7 +5392,6 @@ def test_create_key_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apikeys.CreateKeyRequest() - assert args[0] == request_msg @@ -5389,7 +5412,6 @@ def test_list_keys_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apikeys.ListKeysRequest() - assert args[0] == request_msg @@ -5410,7 +5432,6 @@ def test_get_key_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apikeys.GetKeyRequest() - assert args[0] == request_msg @@ -5431,7 +5452,6 @@ def test_get_key_string_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apikeys.GetKeyStringRequest() - assert args[0] == request_msg @@ -5452,7 +5472,6 @@ def test_update_key_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apikeys.UpdateKeyRequest() - assert args[0] == request_msg @@ -5473,7 +5492,6 @@ def test_delete_key_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apikeys.DeleteKeyRequest() - assert args[0] == request_msg @@ -5494,7 +5512,6 @@ def test_undelete_key_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apikeys.UndeleteKeyRequest() - assert args[0] == request_msg @@ -5515,7 +5532,6 @@ def test_lookup_key_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apikeys.LookupKeyRequest() - assert args[0] == request_msg @@ -5554,7 +5570,6 @@ async def test_create_key_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apikeys.CreateKeyRequest() - assert args[0] == request_msg @@ -5581,7 +5596,6 @@ async def test_list_keys_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apikeys.ListKeysRequest() - assert args[0] == request_msg @@ -5612,7 +5626,6 @@ async def test_get_key_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apikeys.GetKeyRequest() - assert args[0] == request_msg @@ -5639,7 +5652,6 @@ async def test_get_key_string_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apikeys.GetKeyStringRequest() - assert args[0] == request_msg @@ -5664,7 +5676,6 @@ async def test_update_key_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apikeys.UpdateKeyRequest() - assert args[0] == request_msg @@ -5689,7 +5700,6 @@ async def test_delete_key_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apikeys.DeleteKeyRequest() - assert args[0] == request_msg @@ -5714,7 +5724,6 @@ async def test_undelete_key_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apikeys.UndeleteKeyRequest() - assert args[0] == request_msg @@ -5742,7 +5751,6 @@ async def test_lookup_key_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apikeys.LookupKeyRequest() - assert args[0] == request_msg @@ -7013,7 +7021,6 @@ def test_create_key_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apikeys.CreateKeyRequest() - assert args[0] == request_msg @@ -7033,7 +7040,6 @@ def test_list_keys_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apikeys.ListKeysRequest() - assert args[0] == request_msg @@ -7053,7 +7059,6 @@ def test_get_key_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apikeys.GetKeyRequest() - assert args[0] == request_msg @@ -7073,7 +7078,6 @@ def test_get_key_string_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apikeys.GetKeyStringRequest() - assert args[0] == request_msg @@ -7093,7 +7097,6 @@ def test_update_key_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apikeys.UpdateKeyRequest() - assert args[0] == request_msg @@ -7113,7 +7116,6 @@ def test_delete_key_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apikeys.DeleteKeyRequest() - assert args[0] == request_msg @@ -7133,7 +7135,6 @@ def test_undelete_key_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apikeys.UndeleteKeyRequest() - assert args[0] == request_msg @@ -7153,7 +7154,6 @@ def test_lookup_key_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apikeys.LookupKeyRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-apigee-connect/noxfile.py b/packages/google-cloud-apigee-connect/noxfile.py index 241a5970bbd9..3d316ce17189 100644 --- a/packages/google-cloud-apigee-connect/noxfile.py +++ b/packages/google-cloud-apigee-connect/noxfile.py @@ -47,7 +47,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-apigee-connect" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-apigee-connect/setup.py b/packages/google-cloud-apigee-connect/setup.py index 5d15add159a0..99b0c60e3202 100644 --- a/packages/google-cloud-apigee-connect/setup.py +++ b/packages/google-cloud-apigee-connect/setup.py @@ -45,7 +45,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/google-cloud-apigee-connect/testing/constraints-3.10.txt b/packages/google-cloud-apigee-connect/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-apigee-connect/testing/constraints-3.10.txt +++ b/packages/google-cloud-apigee-connect/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-apigee-connect/tests/unit/gapic/apigeeconnect_v1/test_connection_service.py b/packages/google-cloud-apigee-connect/tests/unit/gapic/apigeeconnect_v1/test_connection_service.py index f8b9d4bc5594..ad55c75c9fdb 100644 --- a/packages/google-cloud-apigee-connect/tests/unit/gapic/apigeeconnect_v1/test_connection_service.py +++ b/packages/google-cloud-apigee-connect/tests/unit/gapic/apigeeconnect_v1/test_connection_service.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 @@ -104,6 +105,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" @@ -1313,8 +1329,8 @@ def test_connection_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - connection.ListConnectionsRequest, - dict, + connection.ListConnectionsRequest(), + {}, ], ) def test_list_connections(request_type, transport: str = "grpc"): @@ -1325,7 +1341,7 @@ def test_list_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(type(client.transport.list_connections), "__call__") as call: @@ -1370,10 +1386,11 @@ def test_list_connections_non_empty_request_with_auto_populated_field(): client.list_connections(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == connection.ListConnectionsRequest( + request_msg = connection.ListConnectionsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_connections_use_cached_wrapped_rpc(): @@ -1456,9 +1473,14 @@ async def test_list_connections_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_connections_async( - transport: str = "grpc_asyncio", request_type=connection.ListConnectionsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + connection.ListConnectionsRequest(), + {}, + ], +) +async def test_list_connections_async(request_type, transport: str = "grpc_asyncio"): client = ConnectionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1466,7 +1488,7 @@ async def test_list_connections_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_connections), "__call__") as call: @@ -1489,11 +1511,6 @@ async def test_list_connections_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_connections_async_from_dict(): - await test_list_connections_async(request_type=dict) - - def test_list_connections_field_headers(): client = ConnectionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1949,7 +1966,6 @@ def test_list_connections_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = connection.ListConnectionsRequest() - assert args[0] == request_msg @@ -1990,7 +2006,6 @@ async def test_list_connections_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = connection.ListConnectionsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-apigee-connect/tests/unit/gapic/apigeeconnect_v1/test_tether.py b/packages/google-cloud-apigee-connect/tests/unit/gapic/apigeeconnect_v1/test_tether.py index 5ce84fdd3ec9..eb49702f267e 100644 --- a/packages/google-cloud-apigee-connect/tests/unit/gapic/apigeeconnect_v1/test_tether.py +++ b/packages/google-cloud-apigee-connect/tests/unit/gapic/apigeeconnect_v1/test_tether.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 @@ -106,6 +107,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" @@ -1221,8 +1237,8 @@ def test_tether_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - tether.EgressResponse, - dict, + tether.EgressResponse(), + {}, ], ) def test_egress(request_type, transport: str = "grpc"): @@ -1233,7 +1249,7 @@ def test_egress(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as 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. @@ -1328,9 +1344,14 @@ async def test_egress_async_use_cached_wrapped_rpc(transport: str = "grpc_asynci @pytest.mark.asyncio -async def test_egress_async( - transport: str = "grpc_asyncio", request_type=tether.EgressResponse -): +@pytest.mark.parametrize( + "request_type", + [ + tether.EgressResponse(), + {}, + ], +) +async def test_egress_async(request_type, transport: str = "grpc_asyncio"): client = TetherAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1338,7 +1359,7 @@ async def test_egress_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. @@ -1358,11 +1379,6 @@ async def test_egress_async( assert isinstance(message, tether.EgressRequest) -@pytest.mark.asyncio -async def test_egress_async_from_dict(): - await test_egress_async(request_type=dict) - - def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.TetherGrpcTransport( diff --git a/packages/google-cloud-apigee-registry/noxfile.py b/packages/google-cloud-apigee-registry/noxfile.py index f786e51354bf..48e99b7dc8f1 100644 --- a/packages/google-cloud-apigee-registry/noxfile.py +++ b/packages/google-cloud-apigee-registry/noxfile.py @@ -47,7 +47,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-apigee-registry" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-apigee-registry/setup.py b/packages/google-cloud-apigee-registry/setup.py index 3a05eba3b9ad..fc332bd518ed 100644 --- a/packages/google-cloud-apigee-registry/setup.py +++ b/packages/google-cloud-apigee-registry/setup.py @@ -45,7 +45,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/google-cloud-apigee-registry/testing/constraints-3.10.txt b/packages/google-cloud-apigee-registry/testing/constraints-3.10.txt index a92801e1c8e2..b39cd54634f9 100644 --- a/packages/google-cloud-apigee-registry/testing/constraints-3.10.txt +++ b/packages/google-cloud-apigee-registry/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/google-cloud-apigee-registry/tests/unit/gapic/apigee_registry_v1/test_provisioning.py b/packages/google-cloud-apigee-registry/tests/unit/gapic/apigee_registry_v1/test_provisioning.py index 7c2e1eaa08b3..2f11f1512f3d 100644 --- a/packages/google-cloud-apigee-registry/tests/unit/gapic/apigee_registry_v1/test_provisioning.py +++ b/packages/google-cloud-apigee-registry/tests/unit/gapic/apigee_registry_v1/test_provisioning.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 @@ -119,6 +120,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" @@ -1299,8 +1315,8 @@ def test_provisioning_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - provisioning_service.CreateInstanceRequest, - dict, + provisioning_service.CreateInstanceRequest(), + {}, ], ) def test_create_instance(request_type, transport: str = "grpc"): @@ -1311,7 +1327,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(type(client.transport.create_instance), "__call__") as call: @@ -1353,10 +1369,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] == provisioning_service.CreateInstanceRequest( + request_msg = provisioning_service.CreateInstanceRequest( parent="parent_value", instance_id="instance_id_value", ) + assert args[0] == request_msg def test_create_instance_use_cached_wrapped_rpc(): @@ -1447,10 +1464,14 @@ async def test_create_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_instance_async( - transport: str = "grpc_asyncio", - request_type=provisioning_service.CreateInstanceRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + provisioning_service.CreateInstanceRequest(), + {}, + ], +) +async def test_create_instance_async(request_type, transport: str = "grpc_asyncio"): client = ProvisioningAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1458,7 +1479,7 @@ async def test_create_instance_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_instance), "__call__") as call: @@ -1478,11 +1499,6 @@ async def test_create_instance_async( 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 = ProvisioningClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1649,8 +1665,8 @@ async def test_create_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - provisioning_service.DeleteInstanceRequest, - dict, + provisioning_service.DeleteInstanceRequest(), + {}, ], ) def test_delete_instance(request_type, transport: str = "grpc"): @@ -1661,7 +1677,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(type(client.transport.delete_instance), "__call__") as call: @@ -1702,9 +1718,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] == provisioning_service.DeleteInstanceRequest( + request_msg = provisioning_service.DeleteInstanceRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_instance_use_cached_wrapped_rpc(): @@ -1795,10 +1812,14 @@ async def test_delete_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_instance_async( - transport: str = "grpc_asyncio", - request_type=provisioning_service.DeleteInstanceRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + provisioning_service.DeleteInstanceRequest(), + {}, + ], +) +async def test_delete_instance_async(request_type, transport: str = "grpc_asyncio"): client = ProvisioningAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1806,7 +1827,7 @@ async def test_delete_instance_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_instance), "__call__") as call: @@ -1826,11 +1847,6 @@ async def test_delete_instance_async( 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 = ProvisioningClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1977,8 +1993,8 @@ async def test_delete_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - provisioning_service.GetInstanceRequest, - dict, + provisioning_service.GetInstanceRequest(), + {}, ], ) def test_get_instance(request_type, transport: str = "grpc"): @@ -1989,7 +2005,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(type(client.transport.get_instance), "__call__") as call: @@ -2037,9 +2053,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] == provisioning_service.GetInstanceRequest( + request_msg = provisioning_service.GetInstanceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_instance_use_cached_wrapped_rpc(): @@ -2120,10 +2137,14 @@ async def test_get_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_instance_async( - transport: str = "grpc_asyncio", - request_type=provisioning_service.GetInstanceRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + provisioning_service.GetInstanceRequest(), + {}, + ], +) +async def test_get_instance_async(request_type, transport: str = "grpc_asyncio"): client = ProvisioningAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2131,7 +2152,7 @@ async def test_get_instance_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_instance), "__call__") as call: @@ -2158,11 +2179,6 @@ async def test_get_instance_async( assert response.state_message == "state_message_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 = ProvisioningClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2991,7 +3007,6 @@ def test_create_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = provisioning_service.CreateInstanceRequest() - assert args[0] == request_msg @@ -3012,7 +3027,6 @@ def test_delete_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = provisioning_service.DeleteInstanceRequest() - assert args[0] == request_msg @@ -3033,7 +3047,6 @@ def test_get_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = provisioning_service.GetInstanceRequest() - assert args[0] == request_msg @@ -3072,7 +3085,6 @@ async def test_create_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = provisioning_service.CreateInstanceRequest() - assert args[0] == request_msg @@ -3097,7 +3109,6 @@ async def test_delete_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = provisioning_service.DeleteInstanceRequest() - assert args[0] == request_msg @@ -3126,7 +3137,6 @@ async def test_get_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = provisioning_service.GetInstanceRequest() - assert args[0] == request_msg @@ -4187,7 +4197,6 @@ def test_create_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = provisioning_service.CreateInstanceRequest() - assert args[0] == request_msg @@ -4207,7 +4216,6 @@ def test_delete_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = provisioning_service.DeleteInstanceRequest() - assert args[0] == request_msg @@ -4227,7 +4235,6 @@ def test_get_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = provisioning_service.GetInstanceRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-apigee-registry/tests/unit/gapic/apigee_registry_v1/test_registry.py b/packages/google-cloud-apigee-registry/tests/unit/gapic/apigee_registry_v1/test_registry.py index f477ed7a2d1b..2f34c448f99c 100644 --- a/packages/google-cloud-apigee-registry/tests/unit/gapic/apigee_registry_v1/test_registry.py +++ b/packages/google-cloud-apigee-registry/tests/unit/gapic/apigee_registry_v1/test_registry.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 @@ -118,6 +119,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" @@ -1262,8 +1278,8 @@ def test_registry_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - registry_service.ListApisRequest, - dict, + registry_service.ListApisRequest(), + {}, ], ) def test_list_apis(request_type, transport: str = "grpc"): @@ -1274,7 +1290,7 @@ def test_list_apis(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_apis), "__call__") as call: @@ -1320,11 +1336,12 @@ def test_list_apis_non_empty_request_with_auto_populated_field(): client.list_apis(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == registry_service.ListApisRequest( + request_msg = registry_service.ListApisRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_apis_use_cached_wrapped_rpc(): @@ -1403,9 +1420,14 @@ async def test_list_apis_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_list_apis_async( - transport: str = "grpc_asyncio", request_type=registry_service.ListApisRequest -): +@pytest.mark.parametrize( + "request_type", + [ + registry_service.ListApisRequest(), + {}, + ], +) +async def test_list_apis_async(request_type, transport: str = "grpc_asyncio"): client = RegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1413,7 +1435,7 @@ async def test_list_apis_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_apis), "__call__") as call: @@ -1436,11 +1458,6 @@ async def test_list_apis_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_apis_async_from_dict(): - await test_list_apis_async(request_type=dict) - - def test_list_apis_field_headers(): client = RegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1777,8 +1794,8 @@ async def test_list_apis_async_pages(): @pytest.mark.parametrize( "request_type", [ - registry_service.GetApiRequest, - dict, + registry_service.GetApiRequest(), + {}, ], ) def test_get_api(request_type, transport: str = "grpc"): @@ -1789,7 +1806,7 @@ def test_get_api(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_api), "__call__") as call: @@ -1843,9 +1860,10 @@ def test_get_api_non_empty_request_with_auto_populated_field(): client.get_api(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == registry_service.GetApiRequest( + request_msg = registry_service.GetApiRequest( name="name_value", ) + assert args[0] == request_msg def test_get_api_use_cached_wrapped_rpc(): @@ -1924,9 +1942,14 @@ async def test_get_api_async_use_cached_wrapped_rpc(transport: str = "grpc_async @pytest.mark.asyncio -async def test_get_api_async( - transport: str = "grpc_asyncio", request_type=registry_service.GetApiRequest -): +@pytest.mark.parametrize( + "request_type", + [ + registry_service.GetApiRequest(), + {}, + ], +) +async def test_get_api_async(request_type, transport: str = "grpc_asyncio"): client = RegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1934,7 +1957,7 @@ async def test_get_api_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_api), "__call__") as call: @@ -1967,11 +1990,6 @@ async def test_get_api_async( assert response.recommended_deployment == "recommended_deployment_value" -@pytest.mark.asyncio -async def test_get_api_async_from_dict(): - await test_get_api_async(request_type=dict) - - def test_get_api_field_headers(): client = RegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2114,8 +2132,8 @@ async def test_get_api_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - registry_service.CreateApiRequest, - dict, + registry_service.CreateApiRequest(), + {}, ], ) def test_create_api(request_type, transport: str = "grpc"): @@ -2126,7 +2144,7 @@ def test_create_api(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_api), "__call__") as call: @@ -2181,10 +2199,11 @@ def test_create_api_non_empty_request_with_auto_populated_field(): client.create_api(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == registry_service.CreateApiRequest( + request_msg = registry_service.CreateApiRequest( parent="parent_value", api_id="api_id_value", ) + assert args[0] == request_msg def test_create_api_use_cached_wrapped_rpc(): @@ -2263,9 +2282,14 @@ async def test_create_api_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_create_api_async( - transport: str = "grpc_asyncio", request_type=registry_service.CreateApiRequest -): +@pytest.mark.parametrize( + "request_type", + [ + registry_service.CreateApiRequest(), + {}, + ], +) +async def test_create_api_async(request_type, transport: str = "grpc_asyncio"): client = RegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2273,7 +2297,7 @@ async def test_create_api_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_api), "__call__") as call: @@ -2306,11 +2330,6 @@ async def test_create_api_async( assert response.recommended_deployment == "recommended_deployment_value" -@pytest.mark.asyncio -async def test_create_api_async_from_dict(): - await test_create_api_async(request_type=dict) - - def test_create_api_field_headers(): client = RegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2473,8 +2492,8 @@ async def test_create_api_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - registry_service.UpdateApiRequest, - dict, + registry_service.UpdateApiRequest(), + {}, ], ) def test_update_api(request_type, transport: str = "grpc"): @@ -2485,7 +2504,7 @@ def test_update_api(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_api), "__call__") as call: @@ -2537,7 +2556,8 @@ def test_update_api_non_empty_request_with_auto_populated_field(): client.update_api(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == registry_service.UpdateApiRequest() + request_msg = registry_service.UpdateApiRequest() + assert args[0] == request_msg def test_update_api_use_cached_wrapped_rpc(): @@ -2616,9 +2636,14 @@ async def test_update_api_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_update_api_async( - transport: str = "grpc_asyncio", request_type=registry_service.UpdateApiRequest -): +@pytest.mark.parametrize( + "request_type", + [ + registry_service.UpdateApiRequest(), + {}, + ], +) +async def test_update_api_async(request_type, transport: str = "grpc_asyncio"): client = RegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2626,7 +2651,7 @@ async def test_update_api_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_api), "__call__") as call: @@ -2659,11 +2684,6 @@ async def test_update_api_async( assert response.recommended_deployment == "recommended_deployment_value" -@pytest.mark.asyncio -async def test_update_api_async_from_dict(): - await test_update_api_async(request_type=dict) - - def test_update_api_field_headers(): client = RegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2816,8 +2836,8 @@ async def test_update_api_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - registry_service.DeleteApiRequest, - dict, + registry_service.DeleteApiRequest(), + {}, ], ) def test_delete_api(request_type, transport: str = "grpc"): @@ -2828,7 +2848,7 @@ def test_delete_api(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_api), "__call__") as call: @@ -2869,9 +2889,10 @@ def test_delete_api_non_empty_request_with_auto_populated_field(): client.delete_api(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == registry_service.DeleteApiRequest( + request_msg = registry_service.DeleteApiRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_api_use_cached_wrapped_rpc(): @@ -2950,9 +2971,14 @@ async def test_delete_api_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_delete_api_async( - transport: str = "grpc_asyncio", request_type=registry_service.DeleteApiRequest -): +@pytest.mark.parametrize( + "request_type", + [ + registry_service.DeleteApiRequest(), + {}, + ], +) +async def test_delete_api_async(request_type, transport: str = "grpc_asyncio"): client = RegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2960,7 +2986,7 @@ async def test_delete_api_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_api), "__call__") as call: @@ -2978,11 +3004,6 @@ async def test_delete_api_async( assert response is None -@pytest.mark.asyncio -async def test_delete_api_async_from_dict(): - await test_delete_api_async(request_type=dict) - - def test_delete_api_field_headers(): client = RegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3125,8 +3146,8 @@ async def test_delete_api_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - registry_service.ListApiVersionsRequest, - dict, + registry_service.ListApiVersionsRequest(), + {}, ], ) def test_list_api_versions(request_type, transport: str = "grpc"): @@ -3137,7 +3158,7 @@ def test_list_api_versions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3187,11 +3208,12 @@ def test_list_api_versions_non_empty_request_with_auto_populated_field(): client.list_api_versions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == registry_service.ListApiVersionsRequest( + request_msg = registry_service.ListApiVersionsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_api_versions_use_cached_wrapped_rpc(): @@ -3274,10 +3296,14 @@ async def test_list_api_versions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_api_versions_async( - transport: str = "grpc_asyncio", - request_type=registry_service.ListApiVersionsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + registry_service.ListApiVersionsRequest(), + {}, + ], +) +async def test_list_api_versions_async(request_type, transport: str = "grpc_asyncio"): client = RegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3285,7 +3311,7 @@ async def test_list_api_versions_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( @@ -3310,11 +3336,6 @@ async def test_list_api_versions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_api_versions_async_from_dict(): - await test_list_api_versions_async(request_type=dict) - - def test_list_api_versions_field_headers(): client = RegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3667,8 +3688,8 @@ async def test_list_api_versions_async_pages(): @pytest.mark.parametrize( "request_type", [ - registry_service.GetApiVersionRequest, - dict, + registry_service.GetApiVersionRequest(), + {}, ], ) def test_get_api_version(request_type, transport: str = "grpc"): @@ -3679,7 +3700,7 @@ def test_get_api_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_api_version), "__call__") as call: @@ -3729,9 +3750,10 @@ def test_get_api_version_non_empty_request_with_auto_populated_field(): client.get_api_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == registry_service.GetApiVersionRequest( + request_msg = registry_service.GetApiVersionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_api_version_use_cached_wrapped_rpc(): @@ -3812,9 +3834,14 @@ async def test_get_api_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_api_version_async( - transport: str = "grpc_asyncio", request_type=registry_service.GetApiVersionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + registry_service.GetApiVersionRequest(), + {}, + ], +) +async def test_get_api_version_async(request_type, transport: str = "grpc_asyncio"): client = RegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3822,7 +3849,7 @@ async def test_get_api_version_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_api_version), "__call__") as call: @@ -3851,11 +3878,6 @@ async def test_get_api_version_async( assert response.state == "state_value" -@pytest.mark.asyncio -async def test_get_api_version_async_from_dict(): - await test_get_api_version_async(request_type=dict) - - def test_get_api_version_field_headers(): client = RegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4002,8 +4024,8 @@ async def test_get_api_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - registry_service.CreateApiVersionRequest, - dict, + registry_service.CreateApiVersionRequest(), + {}, ], ) def test_create_api_version(request_type, transport: str = "grpc"): @@ -4014,7 +4036,7 @@ def test_create_api_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4069,10 +4091,11 @@ def test_create_api_version_non_empty_request_with_auto_populated_field(): client.create_api_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == registry_service.CreateApiVersionRequest( + request_msg = registry_service.CreateApiVersionRequest( parent="parent_value", api_version_id="api_version_id_value", ) + assert args[0] == request_msg def test_create_api_version_use_cached_wrapped_rpc(): @@ -4157,10 +4180,14 @@ async def test_create_api_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_api_version_async( - transport: str = "grpc_asyncio", - request_type=registry_service.CreateApiVersionRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + registry_service.CreateApiVersionRequest(), + {}, + ], +) +async def test_create_api_version_async(request_type, transport: str = "grpc_asyncio"): client = RegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4168,7 +4195,7 @@ async def test_create_api_version_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( @@ -4199,11 +4226,6 @@ async def test_create_api_version_async( assert response.state == "state_value" -@pytest.mark.asyncio -async def test_create_api_version_async_from_dict(): - await test_create_api_version_async(request_type=dict) - - def test_create_api_version_field_headers(): client = RegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4378,8 +4400,8 @@ async def test_create_api_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - registry_service.UpdateApiVersionRequest, - dict, + registry_service.UpdateApiVersionRequest(), + {}, ], ) def test_update_api_version(request_type, transport: str = "grpc"): @@ -4390,7 +4412,7 @@ def test_update_api_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4442,7 +4464,8 @@ def test_update_api_version_non_empty_request_with_auto_populated_field(): client.update_api_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == registry_service.UpdateApiVersionRequest() + request_msg = registry_service.UpdateApiVersionRequest() + assert args[0] == request_msg def test_update_api_version_use_cached_wrapped_rpc(): @@ -4527,10 +4550,14 @@ async def test_update_api_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_api_version_async( - transport: str = "grpc_asyncio", - request_type=registry_service.UpdateApiVersionRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + registry_service.UpdateApiVersionRequest(), + {}, + ], +) +async def test_update_api_version_async(request_type, transport: str = "grpc_asyncio"): client = RegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4538,7 +4565,7 @@ async def test_update_api_version_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( @@ -4569,11 +4596,6 @@ async def test_update_api_version_async( assert response.state == "state_value" -@pytest.mark.asyncio -async def test_update_api_version_async_from_dict(): - await test_update_api_version_async(request_type=dict) - - def test_update_api_version_field_headers(): client = RegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4738,8 +4760,8 @@ async def test_update_api_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - registry_service.DeleteApiVersionRequest, - dict, + registry_service.DeleteApiVersionRequest(), + {}, ], ) def test_delete_api_version(request_type, transport: str = "grpc"): @@ -4750,7 +4772,7 @@ def test_delete_api_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4795,9 +4817,10 @@ def test_delete_api_version_non_empty_request_with_auto_populated_field(): client.delete_api_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == registry_service.DeleteApiVersionRequest( + request_msg = registry_service.DeleteApiVersionRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_api_version_use_cached_wrapped_rpc(): @@ -4882,10 +4905,14 @@ async def test_delete_api_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_api_version_async( - transport: str = "grpc_asyncio", - request_type=registry_service.DeleteApiVersionRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + registry_service.DeleteApiVersionRequest(), + {}, + ], +) +async def test_delete_api_version_async(request_type, transport: str = "grpc_asyncio"): client = RegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4893,7 +4920,7 @@ async def test_delete_api_version_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( @@ -4913,11 +4940,6 @@ async def test_delete_api_version_async( assert response is None -@pytest.mark.asyncio -async def test_delete_api_version_async_from_dict(): - await test_delete_api_version_async(request_type=dict) - - def test_delete_api_version_field_headers(): client = RegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5068,8 +5090,8 @@ async def test_delete_api_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - registry_service.ListApiSpecsRequest, - dict, + registry_service.ListApiSpecsRequest(), + {}, ], ) def test_list_api_specs(request_type, transport: str = "grpc"): @@ -5080,7 +5102,7 @@ def test_list_api_specs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_api_specs), "__call__") as call: @@ -5126,11 +5148,12 @@ def test_list_api_specs_non_empty_request_with_auto_populated_field(): client.list_api_specs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == registry_service.ListApiSpecsRequest( + request_msg = registry_service.ListApiSpecsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_api_specs_use_cached_wrapped_rpc(): @@ -5211,9 +5234,14 @@ async def test_list_api_specs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_api_specs_async( - transport: str = "grpc_asyncio", request_type=registry_service.ListApiSpecsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + registry_service.ListApiSpecsRequest(), + {}, + ], +) +async def test_list_api_specs_async(request_type, transport: str = "grpc_asyncio"): client = RegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5221,7 +5249,7 @@ async def test_list_api_specs_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_api_specs), "__call__") as call: @@ -5244,11 +5272,6 @@ async def test_list_api_specs_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_api_specs_async_from_dict(): - await test_list_api_specs_async(request_type=dict) - - def test_list_api_specs_field_headers(): client = RegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5585,8 +5608,8 @@ async def test_list_api_specs_async_pages(): @pytest.mark.parametrize( "request_type", [ - registry_service.GetApiSpecRequest, - dict, + registry_service.GetApiSpecRequest(), + {}, ], ) def test_get_api_spec(request_type, transport: str = "grpc"): @@ -5597,7 +5620,7 @@ def test_get_api_spec(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_api_spec), "__call__") as call: @@ -5657,9 +5680,10 @@ def test_get_api_spec_non_empty_request_with_auto_populated_field(): client.get_api_spec(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == registry_service.GetApiSpecRequest( + request_msg = registry_service.GetApiSpecRequest( name="name_value", ) + assert args[0] == request_msg def test_get_api_spec_use_cached_wrapped_rpc(): @@ -5740,9 +5764,14 @@ async def test_get_api_spec_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_api_spec_async( - transport: str = "grpc_asyncio", request_type=registry_service.GetApiSpecRequest -): +@pytest.mark.parametrize( + "request_type", + [ + registry_service.GetApiSpecRequest(), + {}, + ], +) +async def test_get_api_spec_async(request_type, transport: str = "grpc_asyncio"): client = RegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5750,7 +5779,7 @@ async def test_get_api_spec_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_api_spec), "__call__") as call: @@ -5789,11 +5818,6 @@ async def test_get_api_spec_async( assert response.contents == b"contents_blob" -@pytest.mark.asyncio -async def test_get_api_spec_async_from_dict(): - await test_get_api_spec_async(request_type=dict) - - def test_get_api_spec_field_headers(): client = RegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5940,8 +5964,8 @@ async def test_get_api_spec_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - registry_service.GetApiSpecContentsRequest, - dict, + registry_service.GetApiSpecContentsRequest(), + {}, ], ) def test_get_api_spec_contents(request_type, transport: str = "grpc"): @@ -5952,7 +5976,7 @@ def test_get_api_spec_contents(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6002,9 +6026,10 @@ def test_get_api_spec_contents_non_empty_request_with_auto_populated_field(): client.get_api_spec_contents(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == registry_service.GetApiSpecContentsRequest( + request_msg = registry_service.GetApiSpecContentsRequest( name="name_value", ) + assert args[0] == request_msg def test_get_api_spec_contents_use_cached_wrapped_rpc(): @@ -6090,9 +6115,15 @@ async def test_get_api_spec_contents_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + registry_service.GetApiSpecContentsRequest(), + {}, + ], +) async def test_get_api_spec_contents_async( - transport: str = "grpc_asyncio", - request_type=registry_service.GetApiSpecContentsRequest, + request_type, transport: str = "grpc_asyncio" ): client = RegistryAsyncClient( credentials=async_anonymous_credentials(), @@ -6101,7 +6132,7 @@ async def test_get_api_spec_contents_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( @@ -6128,11 +6159,6 @@ async def test_get_api_spec_contents_async( assert response.data == b"data_blob" -@pytest.mark.asyncio -async def test_get_api_spec_contents_async_from_dict(): - await test_get_api_spec_contents_async(request_type=dict) - - def test_get_api_spec_contents_field_headers(): client = RegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6287,8 +6313,8 @@ async def test_get_api_spec_contents_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - registry_service.CreateApiSpecRequest, - dict, + registry_service.CreateApiSpecRequest(), + {}, ], ) def test_create_api_spec(request_type, transport: str = "grpc"): @@ -6299,7 +6325,7 @@ def test_create_api_spec(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_api_spec), "__call__") as call: @@ -6360,10 +6386,11 @@ def test_create_api_spec_non_empty_request_with_auto_populated_field(): client.create_api_spec(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == registry_service.CreateApiSpecRequest( + request_msg = registry_service.CreateApiSpecRequest( parent="parent_value", api_spec_id="api_spec_id_value", ) + assert args[0] == request_msg def test_create_api_spec_use_cached_wrapped_rpc(): @@ -6444,9 +6471,14 @@ async def test_create_api_spec_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_api_spec_async( - transport: str = "grpc_asyncio", request_type=registry_service.CreateApiSpecRequest -): +@pytest.mark.parametrize( + "request_type", + [ + registry_service.CreateApiSpecRequest(), + {}, + ], +) +async def test_create_api_spec_async(request_type, transport: str = "grpc_asyncio"): client = RegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6454,7 +6486,7 @@ async def test_create_api_spec_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_api_spec), "__call__") as call: @@ -6493,11 +6525,6 @@ async def test_create_api_spec_async( assert response.contents == b"contents_blob" -@pytest.mark.asyncio -async def test_create_api_spec_async_from_dict(): - await test_create_api_spec_async(request_type=dict) - - def test_create_api_spec_field_headers(): client = RegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6664,8 +6691,8 @@ async def test_create_api_spec_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - registry_service.UpdateApiSpecRequest, - dict, + registry_service.UpdateApiSpecRequest(), + {}, ], ) def test_update_api_spec(request_type, transport: str = "grpc"): @@ -6676,7 +6703,7 @@ def test_update_api_spec(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_api_spec), "__call__") as call: @@ -6734,7 +6761,8 @@ def test_update_api_spec_non_empty_request_with_auto_populated_field(): client.update_api_spec(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == registry_service.UpdateApiSpecRequest() + request_msg = registry_service.UpdateApiSpecRequest() + assert args[0] == request_msg def test_update_api_spec_use_cached_wrapped_rpc(): @@ -6815,9 +6843,14 @@ async def test_update_api_spec_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_api_spec_async( - transport: str = "grpc_asyncio", request_type=registry_service.UpdateApiSpecRequest -): +@pytest.mark.parametrize( + "request_type", + [ + registry_service.UpdateApiSpecRequest(), + {}, + ], +) +async def test_update_api_spec_async(request_type, transport: str = "grpc_asyncio"): client = RegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6825,7 +6858,7 @@ async def test_update_api_spec_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_api_spec), "__call__") as call: @@ -6864,11 +6897,6 @@ async def test_update_api_spec_async( assert response.contents == b"contents_blob" -@pytest.mark.asyncio -async def test_update_api_spec_async_from_dict(): - await test_update_api_spec_async(request_type=dict) - - def test_update_api_spec_field_headers(): client = RegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7025,8 +7053,8 @@ async def test_update_api_spec_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - registry_service.DeleteApiSpecRequest, - dict, + registry_service.DeleteApiSpecRequest(), + {}, ], ) def test_delete_api_spec(request_type, transport: str = "grpc"): @@ -7037,7 +7065,7 @@ def test_delete_api_spec(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_api_spec), "__call__") as call: @@ -7078,9 +7106,10 @@ def test_delete_api_spec_non_empty_request_with_auto_populated_field(): client.delete_api_spec(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == registry_service.DeleteApiSpecRequest( + request_msg = registry_service.DeleteApiSpecRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_api_spec_use_cached_wrapped_rpc(): @@ -7161,9 +7190,14 @@ async def test_delete_api_spec_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_api_spec_async( - transport: str = "grpc_asyncio", request_type=registry_service.DeleteApiSpecRequest -): +@pytest.mark.parametrize( + "request_type", + [ + registry_service.DeleteApiSpecRequest(), + {}, + ], +) +async def test_delete_api_spec_async(request_type, transport: str = "grpc_asyncio"): client = RegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7171,7 +7205,7 @@ async def test_delete_api_spec_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_api_spec), "__call__") as call: @@ -7189,11 +7223,6 @@ async def test_delete_api_spec_async( assert response is None -@pytest.mark.asyncio -async def test_delete_api_spec_async_from_dict(): - await test_delete_api_spec_async(request_type=dict) - - def test_delete_api_spec_field_headers(): client = RegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7336,8 +7365,8 @@ async def test_delete_api_spec_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - registry_service.TagApiSpecRevisionRequest, - dict, + registry_service.TagApiSpecRevisionRequest(), + {}, ], ) def test_tag_api_spec_revision(request_type, transport: str = "grpc"): @@ -7348,7 +7377,7 @@ def test_tag_api_spec_revision(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7413,10 +7442,11 @@ def test_tag_api_spec_revision_non_empty_request_with_auto_populated_field(): client.tag_api_spec_revision(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == registry_service.TagApiSpecRevisionRequest( + request_msg = registry_service.TagApiSpecRevisionRequest( name="name_value", tag="tag_value", ) + assert args[0] == request_msg def test_tag_api_spec_revision_use_cached_wrapped_rpc(): @@ -7502,9 +7532,15 @@ async def test_tag_api_spec_revision_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + registry_service.TagApiSpecRevisionRequest(), + {}, + ], +) async def test_tag_api_spec_revision_async( - transport: str = "grpc_asyncio", - request_type=registry_service.TagApiSpecRevisionRequest, + request_type, transport: str = "grpc_asyncio" ): client = RegistryAsyncClient( credentials=async_anonymous_credentials(), @@ -7513,7 +7549,7 @@ async def test_tag_api_spec_revision_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( @@ -7554,11 +7590,6 @@ async def test_tag_api_spec_revision_async( assert response.contents == b"contents_blob" -@pytest.mark.asyncio -async def test_tag_api_spec_revision_async_from_dict(): - await test_tag_api_spec_revision_async(request_type=dict) - - def test_tag_api_spec_revision_field_headers(): client = RegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7627,8 +7658,8 @@ async def test_tag_api_spec_revision_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - registry_service.ListApiSpecRevisionsRequest, - dict, + registry_service.ListApiSpecRevisionsRequest(), + {}, ], ) def test_list_api_spec_revisions(request_type, transport: str = "grpc"): @@ -7639,7 +7670,7 @@ def test_list_api_spec_revisions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,10 +7719,11 @@ def test_list_api_spec_revisions_non_empty_request_with_auto_populated_field(): client.list_api_spec_revisions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == registry_service.ListApiSpecRevisionsRequest( + request_msg = registry_service.ListApiSpecRevisionsRequest( name="name_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_api_spec_revisions_use_cached_wrapped_rpc(): @@ -7777,9 +7809,15 @@ async def test_list_api_spec_revisions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + registry_service.ListApiSpecRevisionsRequest(), + {}, + ], +) async def test_list_api_spec_revisions_async( - transport: str = "grpc_asyncio", - request_type=registry_service.ListApiSpecRevisionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = RegistryAsyncClient( credentials=async_anonymous_credentials(), @@ -7788,7 +7826,7 @@ async def test_list_api_spec_revisions_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( @@ -7813,11 +7851,6 @@ async def test_list_api_spec_revisions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_api_spec_revisions_async_from_dict(): - await test_list_api_spec_revisions_async(request_type=dict) - - def test_list_api_spec_revisions_field_headers(): client = RegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8084,8 +8117,8 @@ async def test_list_api_spec_revisions_async_pages(): @pytest.mark.parametrize( "request_type", [ - registry_service.RollbackApiSpecRequest, - dict, + registry_service.RollbackApiSpecRequest(), + {}, ], ) def test_rollback_api_spec(request_type, transport: str = "grpc"): @@ -8096,7 +8129,7 @@ def test_rollback_api_spec(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8161,10 +8194,11 @@ def test_rollback_api_spec_non_empty_request_with_auto_populated_field(): client.rollback_api_spec(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == registry_service.RollbackApiSpecRequest( + request_msg = registry_service.RollbackApiSpecRequest( name="name_value", revision_id="revision_id_value", ) + assert args[0] == request_msg def test_rollback_api_spec_use_cached_wrapped_rpc(): @@ -8247,10 +8281,14 @@ async def test_rollback_api_spec_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_rollback_api_spec_async( - transport: str = "grpc_asyncio", - request_type=registry_service.RollbackApiSpecRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + registry_service.RollbackApiSpecRequest(), + {}, + ], +) +async def test_rollback_api_spec_async(request_type, transport: str = "grpc_asyncio"): client = RegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8258,7 +8296,7 @@ async def test_rollback_api_spec_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( @@ -8299,11 +8337,6 @@ async def test_rollback_api_spec_async( assert response.contents == b"contents_blob" -@pytest.mark.asyncio -async def test_rollback_api_spec_async_from_dict(): - await test_rollback_api_spec_async(request_type=dict) - - def test_rollback_api_spec_field_headers(): client = RegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8372,8 +8405,8 @@ async def test_rollback_api_spec_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - registry_service.DeleteApiSpecRevisionRequest, - dict, + registry_service.DeleteApiSpecRevisionRequest(), + {}, ], ) def test_delete_api_spec_revision(request_type, transport: str = "grpc"): @@ -8384,7 +8417,7 @@ def test_delete_api_spec_revision(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8448,9 +8481,10 @@ def test_delete_api_spec_revision_non_empty_request_with_auto_populated_field(): client.delete_api_spec_revision(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == registry_service.DeleteApiSpecRevisionRequest( + request_msg = registry_service.DeleteApiSpecRevisionRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_api_spec_revision_use_cached_wrapped_rpc(): @@ -8536,9 +8570,15 @@ async def test_delete_api_spec_revision_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + registry_service.DeleteApiSpecRevisionRequest(), + {}, + ], +) async def test_delete_api_spec_revision_async( - transport: str = "grpc_asyncio", - request_type=registry_service.DeleteApiSpecRevisionRequest, + request_type, transport: str = "grpc_asyncio" ): client = RegistryAsyncClient( credentials=async_anonymous_credentials(), @@ -8547,7 +8587,7 @@ async def test_delete_api_spec_revision_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( @@ -8588,11 +8628,6 @@ async def test_delete_api_spec_revision_async( assert response.contents == b"contents_blob" -@pytest.mark.asyncio -async def test_delete_api_spec_revision_async_from_dict(): - await test_delete_api_spec_revision_async(request_type=dict) - - def test_delete_api_spec_revision_field_headers(): client = RegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8747,8 +8782,8 @@ async def test_delete_api_spec_revision_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - registry_service.ListApiDeploymentsRequest, - dict, + registry_service.ListApiDeploymentsRequest(), + {}, ], ) def test_list_api_deployments(request_type, transport: str = "grpc"): @@ -8759,7 +8794,7 @@ def test_list_api_deployments(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8809,11 +8844,12 @@ def test_list_api_deployments_non_empty_request_with_auto_populated_field(): client.list_api_deployments(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == registry_service.ListApiDeploymentsRequest( + request_msg = registry_service.ListApiDeploymentsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_api_deployments_use_cached_wrapped_rpc(): @@ -8898,9 +8934,15 @@ async def test_list_api_deployments_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + registry_service.ListApiDeploymentsRequest(), + {}, + ], +) async def test_list_api_deployments_async( - transport: str = "grpc_asyncio", - request_type=registry_service.ListApiDeploymentsRequest, + request_type, transport: str = "grpc_asyncio" ): client = RegistryAsyncClient( credentials=async_anonymous_credentials(), @@ -8909,7 +8951,7 @@ async def test_list_api_deployments_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( @@ -8934,11 +8976,6 @@ async def test_list_api_deployments_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_api_deployments_async_from_dict(): - await test_list_api_deployments_async(request_type=dict) - - def test_list_api_deployments_field_headers(): client = RegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9291,8 +9328,8 @@ async def test_list_api_deployments_async_pages(): @pytest.mark.parametrize( "request_type", [ - registry_service.GetApiDeploymentRequest, - dict, + registry_service.GetApiDeploymentRequest(), + {}, ], ) def test_get_api_deployment(request_type, transport: str = "grpc"): @@ -9303,7 +9340,7 @@ def test_get_api_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9367,9 +9404,10 @@ def test_get_api_deployment_non_empty_request_with_auto_populated_field(): client.get_api_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == registry_service.GetApiDeploymentRequest( + request_msg = registry_service.GetApiDeploymentRequest( name="name_value", ) + assert args[0] == request_msg def test_get_api_deployment_use_cached_wrapped_rpc(): @@ -9454,10 +9492,14 @@ async def test_get_api_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_api_deployment_async( - transport: str = "grpc_asyncio", - request_type=registry_service.GetApiDeploymentRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + registry_service.GetApiDeploymentRequest(), + {}, + ], +) +async def test_get_api_deployment_async(request_type, transport: str = "grpc_asyncio"): client = RegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9465,7 +9507,7 @@ async def test_get_api_deployment_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( @@ -9506,11 +9548,6 @@ async def test_get_api_deployment_async( assert response.access_guidance == "access_guidance_value" -@pytest.mark.asyncio -async def test_get_api_deployment_async_from_dict(): - await test_get_api_deployment_async(request_type=dict) - - def test_get_api_deployment_field_headers(): client = RegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9665,8 +9702,8 @@ async def test_get_api_deployment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - registry_service.CreateApiDeploymentRequest, - dict, + registry_service.CreateApiDeploymentRequest(), + {}, ], ) def test_create_api_deployment(request_type, transport: str = "grpc"): @@ -9677,7 +9714,7 @@ def test_create_api_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9742,10 +9779,11 @@ def test_create_api_deployment_non_empty_request_with_auto_populated_field(): client.create_api_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == registry_service.CreateApiDeploymentRequest( + request_msg = registry_service.CreateApiDeploymentRequest( parent="parent_value", api_deployment_id="api_deployment_id_value", ) + assert args[0] == request_msg def test_create_api_deployment_use_cached_wrapped_rpc(): @@ -9831,9 +9869,15 @@ async def test_create_api_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + registry_service.CreateApiDeploymentRequest(), + {}, + ], +) async def test_create_api_deployment_async( - transport: str = "grpc_asyncio", - request_type=registry_service.CreateApiDeploymentRequest, + request_type, transport: str = "grpc_asyncio" ): client = RegistryAsyncClient( credentials=async_anonymous_credentials(), @@ -9842,7 +9886,7 @@ async def test_create_api_deployment_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( @@ -9883,11 +9927,6 @@ async def test_create_api_deployment_async( assert response.access_guidance == "access_guidance_value" -@pytest.mark.asyncio -async def test_create_api_deployment_async_from_dict(): - await test_create_api_deployment_async(request_type=dict) - - def test_create_api_deployment_field_headers(): client = RegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10062,8 +10101,8 @@ async def test_create_api_deployment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - registry_service.UpdateApiDeploymentRequest, - dict, + registry_service.UpdateApiDeploymentRequest(), + {}, ], ) def test_update_api_deployment(request_type, transport: str = "grpc"): @@ -10074,7 +10113,7 @@ def test_update_api_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10136,7 +10175,8 @@ def test_update_api_deployment_non_empty_request_with_auto_populated_field(): client.update_api_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == registry_service.UpdateApiDeploymentRequest() + request_msg = registry_service.UpdateApiDeploymentRequest() + assert args[0] == request_msg def test_update_api_deployment_use_cached_wrapped_rpc(): @@ -10222,9 +10262,15 @@ async def test_update_api_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + registry_service.UpdateApiDeploymentRequest(), + {}, + ], +) async def test_update_api_deployment_async( - transport: str = "grpc_asyncio", - request_type=registry_service.UpdateApiDeploymentRequest, + request_type, transport: str = "grpc_asyncio" ): client = RegistryAsyncClient( credentials=async_anonymous_credentials(), @@ -10233,7 +10279,7 @@ async def test_update_api_deployment_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( @@ -10274,11 +10320,6 @@ async def test_update_api_deployment_async( assert response.access_guidance == "access_guidance_value" -@pytest.mark.asyncio -async def test_update_api_deployment_async_from_dict(): - await test_update_api_deployment_async(request_type=dict) - - def test_update_api_deployment_field_headers(): client = RegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10443,8 +10484,8 @@ async def test_update_api_deployment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - registry_service.DeleteApiDeploymentRequest, - dict, + registry_service.DeleteApiDeploymentRequest(), + {}, ], ) def test_delete_api_deployment(request_type, transport: str = "grpc"): @@ -10455,7 +10496,7 @@ def test_delete_api_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10500,9 +10541,10 @@ def test_delete_api_deployment_non_empty_request_with_auto_populated_field(): client.delete_api_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == registry_service.DeleteApiDeploymentRequest( + request_msg = registry_service.DeleteApiDeploymentRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_api_deployment_use_cached_wrapped_rpc(): @@ -10588,9 +10630,15 @@ async def test_delete_api_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + registry_service.DeleteApiDeploymentRequest(), + {}, + ], +) async def test_delete_api_deployment_async( - transport: str = "grpc_asyncio", - request_type=registry_service.DeleteApiDeploymentRequest, + request_type, transport: str = "grpc_asyncio" ): client = RegistryAsyncClient( credentials=async_anonymous_credentials(), @@ -10599,7 +10647,7 @@ async def test_delete_api_deployment_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( @@ -10619,11 +10667,6 @@ async def test_delete_api_deployment_async( assert response is None -@pytest.mark.asyncio -async def test_delete_api_deployment_async_from_dict(): - await test_delete_api_deployment_async(request_type=dict) - - def test_delete_api_deployment_field_headers(): client = RegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10774,8 +10817,8 @@ async def test_delete_api_deployment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - registry_service.TagApiDeploymentRevisionRequest, - dict, + registry_service.TagApiDeploymentRevisionRequest(), + {}, ], ) def test_tag_api_deployment_revision(request_type, transport: str = "grpc"): @@ -10786,7 +10829,7 @@ def test_tag_api_deployment_revision(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10851,10 +10894,11 @@ def test_tag_api_deployment_revision_non_empty_request_with_auto_populated_field client.tag_api_deployment_revision(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == registry_service.TagApiDeploymentRevisionRequest( + request_msg = registry_service.TagApiDeploymentRevisionRequest( name="name_value", tag="tag_value", ) + assert args[0] == request_msg def test_tag_api_deployment_revision_use_cached_wrapped_rpc(): @@ -10940,9 +10984,15 @@ async def test_tag_api_deployment_revision_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + registry_service.TagApiDeploymentRevisionRequest(), + {}, + ], +) async def test_tag_api_deployment_revision_async( - transport: str = "grpc_asyncio", - request_type=registry_service.TagApiDeploymentRevisionRequest, + request_type, transport: str = "grpc_asyncio" ): client = RegistryAsyncClient( credentials=async_anonymous_credentials(), @@ -10951,7 +11001,7 @@ async def test_tag_api_deployment_revision_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( @@ -10992,11 +11042,6 @@ async def test_tag_api_deployment_revision_async( assert response.access_guidance == "access_guidance_value" -@pytest.mark.asyncio -async def test_tag_api_deployment_revision_async_from_dict(): - await test_tag_api_deployment_revision_async(request_type=dict) - - def test_tag_api_deployment_revision_field_headers(): client = RegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11065,8 +11110,8 @@ async def test_tag_api_deployment_revision_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - registry_service.ListApiDeploymentRevisionsRequest, - dict, + registry_service.ListApiDeploymentRevisionsRequest(), + {}, ], ) def test_list_api_deployment_revisions(request_type, transport: str = "grpc"): @@ -11077,7 +11122,7 @@ def test_list_api_deployment_revisions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11126,10 +11171,11 @@ def test_list_api_deployment_revisions_non_empty_request_with_auto_populated_fie client.list_api_deployment_revisions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == registry_service.ListApiDeploymentRevisionsRequest( + request_msg = registry_service.ListApiDeploymentRevisionsRequest( name="name_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_api_deployment_revisions_use_cached_wrapped_rpc(): @@ -11215,9 +11261,15 @@ async def test_list_api_deployment_revisions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + registry_service.ListApiDeploymentRevisionsRequest(), + {}, + ], +) async def test_list_api_deployment_revisions_async( - transport: str = "grpc_asyncio", - request_type=registry_service.ListApiDeploymentRevisionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = RegistryAsyncClient( credentials=async_anonymous_credentials(), @@ -11226,7 +11278,7 @@ async def test_list_api_deployment_revisions_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( @@ -11251,11 +11303,6 @@ async def test_list_api_deployment_revisions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_api_deployment_revisions_async_from_dict(): - await test_list_api_deployment_revisions_async(request_type=dict) - - def test_list_api_deployment_revisions_field_headers(): client = RegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11526,8 +11573,8 @@ async def test_list_api_deployment_revisions_async_pages(): @pytest.mark.parametrize( "request_type", [ - registry_service.RollbackApiDeploymentRequest, - dict, + registry_service.RollbackApiDeploymentRequest(), + {}, ], ) def test_rollback_api_deployment(request_type, transport: str = "grpc"): @@ -11538,7 +11585,7 @@ def test_rollback_api_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11603,10 +11650,11 @@ def test_rollback_api_deployment_non_empty_request_with_auto_populated_field(): client.rollback_api_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == registry_service.RollbackApiDeploymentRequest( + request_msg = registry_service.RollbackApiDeploymentRequest( name="name_value", revision_id="revision_id_value", ) + assert args[0] == request_msg def test_rollback_api_deployment_use_cached_wrapped_rpc(): @@ -11692,9 +11740,15 @@ async def test_rollback_api_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + registry_service.RollbackApiDeploymentRequest(), + {}, + ], +) async def test_rollback_api_deployment_async( - transport: str = "grpc_asyncio", - request_type=registry_service.RollbackApiDeploymentRequest, + request_type, transport: str = "grpc_asyncio" ): client = RegistryAsyncClient( credentials=async_anonymous_credentials(), @@ -11703,7 +11757,7 @@ async def test_rollback_api_deployment_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( @@ -11744,11 +11798,6 @@ async def test_rollback_api_deployment_async( assert response.access_guidance == "access_guidance_value" -@pytest.mark.asyncio -async def test_rollback_api_deployment_async_from_dict(): - await test_rollback_api_deployment_async(request_type=dict) - - def test_rollback_api_deployment_field_headers(): client = RegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11817,8 +11866,8 @@ async def test_rollback_api_deployment_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - registry_service.DeleteApiDeploymentRevisionRequest, - dict, + registry_service.DeleteApiDeploymentRevisionRequest(), + {}, ], ) def test_delete_api_deployment_revision(request_type, transport: str = "grpc"): @@ -11829,7 +11878,7 @@ def test_delete_api_deployment_revision(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11893,9 +11942,10 @@ def test_delete_api_deployment_revision_non_empty_request_with_auto_populated_fi client.delete_api_deployment_revision(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == registry_service.DeleteApiDeploymentRevisionRequest( + request_msg = registry_service.DeleteApiDeploymentRevisionRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_api_deployment_revision_use_cached_wrapped_rpc(): @@ -11981,9 +12031,15 @@ async def test_delete_api_deployment_revision_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + registry_service.DeleteApiDeploymentRevisionRequest(), + {}, + ], +) async def test_delete_api_deployment_revision_async( - transport: str = "grpc_asyncio", - request_type=registry_service.DeleteApiDeploymentRevisionRequest, + request_type, transport: str = "grpc_asyncio" ): client = RegistryAsyncClient( credentials=async_anonymous_credentials(), @@ -11992,7 +12048,7 @@ async def test_delete_api_deployment_revision_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( @@ -12033,11 +12089,6 @@ async def test_delete_api_deployment_revision_async( assert response.access_guidance == "access_guidance_value" -@pytest.mark.asyncio -async def test_delete_api_deployment_revision_async_from_dict(): - await test_delete_api_deployment_revision_async(request_type=dict) - - def test_delete_api_deployment_revision_field_headers(): client = RegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12192,8 +12243,8 @@ async def test_delete_api_deployment_revision_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - registry_service.ListArtifactsRequest, - dict, + registry_service.ListArtifactsRequest(), + {}, ], ) def test_list_artifacts(request_type, transport: str = "grpc"): @@ -12204,7 +12255,7 @@ def test_list_artifacts(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_artifacts), "__call__") as call: @@ -12250,11 +12301,12 @@ def test_list_artifacts_non_empty_request_with_auto_populated_field(): client.list_artifacts(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == registry_service.ListArtifactsRequest( + request_msg = registry_service.ListArtifactsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_artifacts_use_cached_wrapped_rpc(): @@ -12335,9 +12387,14 @@ async def test_list_artifacts_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_artifacts_async( - transport: str = "grpc_asyncio", request_type=registry_service.ListArtifactsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + registry_service.ListArtifactsRequest(), + {}, + ], +) +async def test_list_artifacts_async(request_type, transport: str = "grpc_asyncio"): client = RegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12345,7 +12402,7 @@ async def test_list_artifacts_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_artifacts), "__call__") as call: @@ -12368,11 +12425,6 @@ async def test_list_artifacts_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_artifacts_async_from_dict(): - await test_list_artifacts_async(request_type=dict) - - def test_list_artifacts_field_headers(): client = RegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12709,8 +12761,8 @@ async def test_list_artifacts_async_pages(): @pytest.mark.parametrize( "request_type", [ - registry_service.GetArtifactRequest, - dict, + registry_service.GetArtifactRequest(), + {}, ], ) def test_get_artifact(request_type, transport: str = "grpc"): @@ -12721,7 +12773,7 @@ def test_get_artifact(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_artifact), "__call__") as call: @@ -12773,9 +12825,10 @@ def test_get_artifact_non_empty_request_with_auto_populated_field(): client.get_artifact(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == registry_service.GetArtifactRequest( + request_msg = registry_service.GetArtifactRequest( name="name_value", ) + assert args[0] == request_msg def test_get_artifact_use_cached_wrapped_rpc(): @@ -12856,9 +12909,14 @@ async def test_get_artifact_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_artifact_async( - transport: str = "grpc_asyncio", request_type=registry_service.GetArtifactRequest -): +@pytest.mark.parametrize( + "request_type", + [ + registry_service.GetArtifactRequest(), + {}, + ], +) +async def test_get_artifact_async(request_type, transport: str = "grpc_asyncio"): client = RegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12866,7 +12924,7 @@ async def test_get_artifact_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_artifact), "__call__") as call: @@ -12897,11 +12955,6 @@ async def test_get_artifact_async( assert response.contents == b"contents_blob" -@pytest.mark.asyncio -async def test_get_artifact_async_from_dict(): - await test_get_artifact_async(request_type=dict) - - def test_get_artifact_field_headers(): client = RegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13048,8 +13101,8 @@ async def test_get_artifact_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - registry_service.GetArtifactContentsRequest, - dict, + registry_service.GetArtifactContentsRequest(), + {}, ], ) def test_get_artifact_contents(request_type, transport: str = "grpc"): @@ -13060,7 +13113,7 @@ def test_get_artifact_contents(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -13110,9 +13163,10 @@ def test_get_artifact_contents_non_empty_request_with_auto_populated_field(): client.get_artifact_contents(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == registry_service.GetArtifactContentsRequest( + request_msg = registry_service.GetArtifactContentsRequest( name="name_value", ) + assert args[0] == request_msg def test_get_artifact_contents_use_cached_wrapped_rpc(): @@ -13198,9 +13252,15 @@ async def test_get_artifact_contents_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + registry_service.GetArtifactContentsRequest(), + {}, + ], +) async def test_get_artifact_contents_async( - transport: str = "grpc_asyncio", - request_type=registry_service.GetArtifactContentsRequest, + request_type, transport: str = "grpc_asyncio" ): client = RegistryAsyncClient( credentials=async_anonymous_credentials(), @@ -13209,7 +13269,7 @@ async def test_get_artifact_contents_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( @@ -13236,11 +13296,6 @@ async def test_get_artifact_contents_async( assert response.data == b"data_blob" -@pytest.mark.asyncio -async def test_get_artifact_contents_async_from_dict(): - await test_get_artifact_contents_async(request_type=dict) - - def test_get_artifact_contents_field_headers(): client = RegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13395,8 +13450,8 @@ async def test_get_artifact_contents_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - registry_service.CreateArtifactRequest, - dict, + registry_service.CreateArtifactRequest(), + {}, ], ) def test_create_artifact(request_type, transport: str = "grpc"): @@ -13407,7 +13462,7 @@ def test_create_artifact(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_artifact), "__call__") as call: @@ -13460,10 +13515,11 @@ def test_create_artifact_non_empty_request_with_auto_populated_field(): client.create_artifact(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == registry_service.CreateArtifactRequest( + request_msg = registry_service.CreateArtifactRequest( parent="parent_value", artifact_id="artifact_id_value", ) + assert args[0] == request_msg def test_create_artifact_use_cached_wrapped_rpc(): @@ -13544,9 +13600,14 @@ async def test_create_artifact_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_artifact_async( - transport: str = "grpc_asyncio", request_type=registry_service.CreateArtifactRequest -): +@pytest.mark.parametrize( + "request_type", + [ + registry_service.CreateArtifactRequest(), + {}, + ], +) +async def test_create_artifact_async(request_type, transport: str = "grpc_asyncio"): client = RegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13554,7 +13615,7 @@ async def test_create_artifact_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_artifact), "__call__") as call: @@ -13585,11 +13646,6 @@ async def test_create_artifact_async( assert response.contents == b"contents_blob" -@pytest.mark.asyncio -async def test_create_artifact_async_from_dict(): - await test_create_artifact_async(request_type=dict) - - def test_create_artifact_field_headers(): client = RegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13756,8 +13812,8 @@ async def test_create_artifact_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - registry_service.ReplaceArtifactRequest, - dict, + registry_service.ReplaceArtifactRequest(), + {}, ], ) def test_replace_artifact(request_type, transport: str = "grpc"): @@ -13768,7 +13824,7 @@ def test_replace_artifact(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.replace_artifact), "__call__") as call: @@ -13818,7 +13874,8 @@ def test_replace_artifact_non_empty_request_with_auto_populated_field(): client.replace_artifact(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == registry_service.ReplaceArtifactRequest() + request_msg = registry_service.ReplaceArtifactRequest() + assert args[0] == request_msg def test_replace_artifact_use_cached_wrapped_rpc(): @@ -13901,10 +13958,14 @@ async def test_replace_artifact_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_replace_artifact_async( - transport: str = "grpc_asyncio", - request_type=registry_service.ReplaceArtifactRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + registry_service.ReplaceArtifactRequest(), + {}, + ], +) +async def test_replace_artifact_async(request_type, transport: str = "grpc_asyncio"): client = RegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13912,7 +13973,7 @@ async def test_replace_artifact_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.replace_artifact), "__call__") as call: @@ -13943,11 +14004,6 @@ async def test_replace_artifact_async( assert response.contents == b"contents_blob" -@pytest.mark.asyncio -async def test_replace_artifact_async_from_dict(): - await test_replace_artifact_async(request_type=dict) - - def test_replace_artifact_field_headers(): client = RegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14094,8 +14150,8 @@ async def test_replace_artifact_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - registry_service.DeleteArtifactRequest, - dict, + registry_service.DeleteArtifactRequest(), + {}, ], ) def test_delete_artifact(request_type, transport: str = "grpc"): @@ -14106,7 +14162,7 @@ def test_delete_artifact(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_artifact), "__call__") as call: @@ -14147,9 +14203,10 @@ def test_delete_artifact_non_empty_request_with_auto_populated_field(): client.delete_artifact(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == registry_service.DeleteArtifactRequest( + request_msg = registry_service.DeleteArtifactRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_artifact_use_cached_wrapped_rpc(): @@ -14230,9 +14287,14 @@ async def test_delete_artifact_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_artifact_async( - transport: str = "grpc_asyncio", request_type=registry_service.DeleteArtifactRequest -): +@pytest.mark.parametrize( + "request_type", + [ + registry_service.DeleteArtifactRequest(), + {}, + ], +) +async def test_delete_artifact_async(request_type, transport: str = "grpc_asyncio"): client = RegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14240,7 +14302,7 @@ async def test_delete_artifact_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_artifact), "__call__") as call: @@ -14258,11 +14320,6 @@ async def test_delete_artifact_async( assert response is None -@pytest.mark.asyncio -async def test_delete_artifact_async_from_dict(): - await test_delete_artifact_async(request_type=dict) - - def test_delete_artifact_field_headers(): client = RegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -21313,7 +21370,6 @@ def test_list_apis_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.ListApisRequest() - assert args[0] == request_msg @@ -21334,7 +21390,6 @@ def test_get_api_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.GetApiRequest() - assert args[0] == request_msg @@ -21355,7 +21410,6 @@ def test_create_api_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.CreateApiRequest() - assert args[0] == request_msg @@ -21376,7 +21430,6 @@ def test_update_api_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.UpdateApiRequest() - assert args[0] == request_msg @@ -21397,7 +21450,6 @@ def test_delete_api_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.DeleteApiRequest() - assert args[0] == request_msg @@ -21420,7 +21472,6 @@ def test_list_api_versions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.ListApiVersionsRequest() - assert args[0] == request_msg @@ -21441,7 +21492,6 @@ def test_get_api_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.GetApiVersionRequest() - assert args[0] == request_msg @@ -21464,7 +21514,6 @@ def test_create_api_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.CreateApiVersionRequest() - assert args[0] == request_msg @@ -21487,7 +21536,6 @@ def test_update_api_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.UpdateApiVersionRequest() - assert args[0] == request_msg @@ -21510,7 +21558,6 @@ def test_delete_api_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.DeleteApiVersionRequest() - assert args[0] == request_msg @@ -21531,7 +21578,6 @@ def test_list_api_specs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.ListApiSpecsRequest() - assert args[0] == request_msg @@ -21552,7 +21598,6 @@ def test_get_api_spec_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.GetApiSpecRequest() - assert args[0] == request_msg @@ -21575,7 +21620,6 @@ def test_get_api_spec_contents_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.GetApiSpecContentsRequest() - assert args[0] == request_msg @@ -21596,7 +21640,6 @@ def test_create_api_spec_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.CreateApiSpecRequest() - assert args[0] == request_msg @@ -21617,7 +21660,6 @@ def test_update_api_spec_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.UpdateApiSpecRequest() - assert args[0] == request_msg @@ -21638,7 +21680,6 @@ def test_delete_api_spec_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.DeleteApiSpecRequest() - assert args[0] == request_msg @@ -21661,7 +21702,6 @@ def test_tag_api_spec_revision_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.TagApiSpecRevisionRequest() - assert args[0] == request_msg @@ -21684,7 +21724,6 @@ def test_list_api_spec_revisions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.ListApiSpecRevisionsRequest() - assert args[0] == request_msg @@ -21707,7 +21746,6 @@ def test_rollback_api_spec_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.RollbackApiSpecRequest() - assert args[0] == request_msg @@ -21730,7 +21768,6 @@ def test_delete_api_spec_revision_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.DeleteApiSpecRevisionRequest() - assert args[0] == request_msg @@ -21753,7 +21790,6 @@ def test_list_api_deployments_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.ListApiDeploymentsRequest() - assert args[0] == request_msg @@ -21776,7 +21812,6 @@ def test_get_api_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.GetApiDeploymentRequest() - assert args[0] == request_msg @@ -21799,7 +21834,6 @@ def test_create_api_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.CreateApiDeploymentRequest() - assert args[0] == request_msg @@ -21822,7 +21856,6 @@ def test_update_api_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.UpdateApiDeploymentRequest() - assert args[0] == request_msg @@ -21845,7 +21878,6 @@ def test_delete_api_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.DeleteApiDeploymentRequest() - assert args[0] == request_msg @@ -21868,7 +21900,6 @@ def test_tag_api_deployment_revision_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.TagApiDeploymentRevisionRequest() - assert args[0] == request_msg @@ -21891,7 +21922,6 @@ def test_list_api_deployment_revisions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.ListApiDeploymentRevisionsRequest() - assert args[0] == request_msg @@ -21914,7 +21944,6 @@ def test_rollback_api_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.RollbackApiDeploymentRequest() - assert args[0] == request_msg @@ -21937,7 +21966,6 @@ def test_delete_api_deployment_revision_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.DeleteApiDeploymentRevisionRequest() - assert args[0] == request_msg @@ -21958,7 +21986,6 @@ def test_list_artifacts_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.ListArtifactsRequest() - assert args[0] == request_msg @@ -21979,7 +22006,6 @@ def test_get_artifact_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.GetArtifactRequest() - assert args[0] == request_msg @@ -22002,7 +22028,6 @@ def test_get_artifact_contents_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.GetArtifactContentsRequest() - assert args[0] == request_msg @@ -22023,7 +22048,6 @@ def test_create_artifact_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.CreateArtifactRequest() - assert args[0] == request_msg @@ -22044,7 +22068,6 @@ def test_replace_artifact_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.ReplaceArtifactRequest() - assert args[0] == request_msg @@ -22065,7 +22088,6 @@ def test_delete_artifact_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.DeleteArtifactRequest() - assert args[0] == request_msg @@ -22106,7 +22128,6 @@ async def test_list_apis_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.ListApisRequest() - assert args[0] == request_msg @@ -22138,7 +22159,6 @@ async def test_get_api_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.GetApiRequest() - assert args[0] == request_msg @@ -22170,7 +22190,6 @@ async def test_create_api_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.CreateApiRequest() - assert args[0] == request_msg @@ -22202,7 +22221,6 @@ async def test_update_api_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.UpdateApiRequest() - assert args[0] == request_msg @@ -22225,7 +22243,6 @@ async def test_delete_api_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.DeleteApiRequest() - assert args[0] == request_msg @@ -22254,7 +22271,6 @@ async def test_list_api_versions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.ListApiVersionsRequest() - assert args[0] == request_msg @@ -22284,7 +22300,6 @@ async def test_get_api_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.GetApiVersionRequest() - assert args[0] == request_msg @@ -22316,7 +22331,6 @@ async def test_create_api_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.CreateApiVersionRequest() - assert args[0] == request_msg @@ -22348,7 +22362,6 @@ async def test_update_api_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.UpdateApiVersionRequest() - assert args[0] == request_msg @@ -22373,7 +22386,6 @@ async def test_delete_api_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.DeleteApiVersionRequest() - assert args[0] == request_msg @@ -22400,7 +22412,6 @@ async def test_list_api_specs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.ListApiSpecsRequest() - assert args[0] == request_msg @@ -22435,7 +22446,6 @@ async def test_get_api_spec_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.GetApiSpecRequest() - assert args[0] == request_msg @@ -22465,7 +22475,6 @@ async def test_get_api_spec_contents_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.GetApiSpecContentsRequest() - assert args[0] == request_msg @@ -22500,7 +22509,6 @@ async def test_create_api_spec_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.CreateApiSpecRequest() - assert args[0] == request_msg @@ -22535,7 +22543,6 @@ async def test_update_api_spec_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.UpdateApiSpecRequest() - assert args[0] == request_msg @@ -22558,7 +22565,6 @@ async def test_delete_api_spec_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.DeleteApiSpecRequest() - assert args[0] == request_msg @@ -22595,7 +22601,6 @@ async def test_tag_api_spec_revision_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.TagApiSpecRevisionRequest() - assert args[0] == request_msg @@ -22624,7 +22629,6 @@ async def test_list_api_spec_revisions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.ListApiSpecRevisionsRequest() - assert args[0] == request_msg @@ -22661,7 +22665,6 @@ async def test_rollback_api_spec_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.RollbackApiSpecRequest() - assert args[0] == request_msg @@ -22698,7 +22701,6 @@ async def test_delete_api_spec_revision_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.DeleteApiSpecRevisionRequest() - assert args[0] == request_msg @@ -22727,7 +22729,6 @@ async def test_list_api_deployments_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.ListApiDeploymentsRequest() - assert args[0] == request_msg @@ -22764,7 +22765,6 @@ async def test_get_api_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.GetApiDeploymentRequest() - assert args[0] == request_msg @@ -22801,7 +22801,6 @@ async def test_create_api_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.CreateApiDeploymentRequest() - assert args[0] == request_msg @@ -22838,7 +22837,6 @@ async def test_update_api_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.UpdateApiDeploymentRequest() - assert args[0] == request_msg @@ -22863,7 +22861,6 @@ async def test_delete_api_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.DeleteApiDeploymentRequest() - assert args[0] == request_msg @@ -22900,7 +22897,6 @@ async def test_tag_api_deployment_revision_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.TagApiDeploymentRevisionRequest() - assert args[0] == request_msg @@ -22929,7 +22925,6 @@ async def test_list_api_deployment_revisions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.ListApiDeploymentRevisionsRequest() - assert args[0] == request_msg @@ -22966,7 +22961,6 @@ async def test_rollback_api_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.RollbackApiDeploymentRequest() - assert args[0] == request_msg @@ -23003,7 +22997,6 @@ async def test_delete_api_deployment_revision_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.DeleteApiDeploymentRevisionRequest() - assert args[0] == request_msg @@ -23030,7 +23023,6 @@ async def test_list_artifacts_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.ListArtifactsRequest() - assert args[0] == request_msg @@ -23061,7 +23053,6 @@ async def test_get_artifact_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.GetArtifactRequest() - assert args[0] == request_msg @@ -23091,7 +23082,6 @@ async def test_get_artifact_contents_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.GetArtifactContentsRequest() - assert args[0] == request_msg @@ -23122,7 +23112,6 @@ async def test_create_artifact_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.CreateArtifactRequest() - assert args[0] == request_msg @@ -23153,7 +23142,6 @@ async def test_replace_artifact_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.ReplaceArtifactRequest() - assert args[0] == request_msg @@ -23176,7 +23164,6 @@ async def test_delete_artifact_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.DeleteArtifactRequest() - assert args[0] == request_msg @@ -29341,7 +29328,6 @@ def test_list_apis_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.ListApisRequest() - assert args[0] == request_msg @@ -29361,7 +29347,6 @@ def test_get_api_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.GetApiRequest() - assert args[0] == request_msg @@ -29381,7 +29366,6 @@ def test_create_api_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.CreateApiRequest() - assert args[0] == request_msg @@ -29401,7 +29385,6 @@ def test_update_api_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.UpdateApiRequest() - assert args[0] == request_msg @@ -29421,7 +29404,6 @@ def test_delete_api_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.DeleteApiRequest() - assert args[0] == request_msg @@ -29443,7 +29425,6 @@ def test_list_api_versions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.ListApiVersionsRequest() - assert args[0] == request_msg @@ -29463,7 +29444,6 @@ def test_get_api_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.GetApiVersionRequest() - assert args[0] == request_msg @@ -29485,7 +29465,6 @@ def test_create_api_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.CreateApiVersionRequest() - assert args[0] == request_msg @@ -29507,7 +29486,6 @@ def test_update_api_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.UpdateApiVersionRequest() - assert args[0] == request_msg @@ -29529,7 +29507,6 @@ def test_delete_api_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.DeleteApiVersionRequest() - assert args[0] == request_msg @@ -29549,7 +29526,6 @@ def test_list_api_specs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.ListApiSpecsRequest() - assert args[0] == request_msg @@ -29569,7 +29545,6 @@ def test_get_api_spec_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.GetApiSpecRequest() - assert args[0] == request_msg @@ -29591,7 +29566,6 @@ def test_get_api_spec_contents_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.GetApiSpecContentsRequest() - assert args[0] == request_msg @@ -29611,7 +29585,6 @@ def test_create_api_spec_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.CreateApiSpecRequest() - assert args[0] == request_msg @@ -29631,7 +29604,6 @@ def test_update_api_spec_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.UpdateApiSpecRequest() - assert args[0] == request_msg @@ -29651,7 +29623,6 @@ def test_delete_api_spec_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.DeleteApiSpecRequest() - assert args[0] == request_msg @@ -29673,7 +29644,6 @@ def test_tag_api_spec_revision_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.TagApiSpecRevisionRequest() - assert args[0] == request_msg @@ -29695,7 +29665,6 @@ def test_list_api_spec_revisions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.ListApiSpecRevisionsRequest() - assert args[0] == request_msg @@ -29717,7 +29686,6 @@ def test_rollback_api_spec_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.RollbackApiSpecRequest() - assert args[0] == request_msg @@ -29739,7 +29707,6 @@ def test_delete_api_spec_revision_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.DeleteApiSpecRevisionRequest() - assert args[0] == request_msg @@ -29761,7 +29728,6 @@ def test_list_api_deployments_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.ListApiDeploymentsRequest() - assert args[0] == request_msg @@ -29783,7 +29749,6 @@ def test_get_api_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.GetApiDeploymentRequest() - assert args[0] == request_msg @@ -29805,7 +29770,6 @@ def test_create_api_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.CreateApiDeploymentRequest() - assert args[0] == request_msg @@ -29827,7 +29791,6 @@ def test_update_api_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.UpdateApiDeploymentRequest() - assert args[0] == request_msg @@ -29849,7 +29812,6 @@ def test_delete_api_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.DeleteApiDeploymentRequest() - assert args[0] == request_msg @@ -29871,7 +29833,6 @@ def test_tag_api_deployment_revision_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.TagApiDeploymentRevisionRequest() - assert args[0] == request_msg @@ -29893,7 +29854,6 @@ def test_list_api_deployment_revisions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.ListApiDeploymentRevisionsRequest() - assert args[0] == request_msg @@ -29915,7 +29875,6 @@ def test_rollback_api_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.RollbackApiDeploymentRequest() - assert args[0] == request_msg @@ -29937,7 +29896,6 @@ def test_delete_api_deployment_revision_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.DeleteApiDeploymentRevisionRequest() - assert args[0] == request_msg @@ -29957,7 +29915,6 @@ def test_list_artifacts_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.ListArtifactsRequest() - assert args[0] == request_msg @@ -29977,7 +29934,6 @@ def test_get_artifact_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.GetArtifactRequest() - assert args[0] == request_msg @@ -29999,7 +29955,6 @@ def test_get_artifact_contents_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.GetArtifactContentsRequest() - assert args[0] == request_msg @@ -30019,7 +29974,6 @@ def test_create_artifact_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.CreateArtifactRequest() - assert args[0] == request_msg @@ -30039,7 +29993,6 @@ def test_replace_artifact_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.ReplaceArtifactRequest() - assert args[0] == request_msg @@ -30059,7 +30012,6 @@ def test_delete_artifact_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registry_service.DeleteArtifactRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-apihub/noxfile.py b/packages/google-cloud-apihub/noxfile.py index d58ec799245c..ce015b92c88c 100644 --- a/packages/google-cloud-apihub/noxfile.py +++ b/packages/google-cloud-apihub/noxfile.py @@ -47,7 +47,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-apihub" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-apihub/setup.py b/packages/google-cloud-apihub/setup.py index 37171bb3bb87..ac4c98f6d437 100644 --- a/packages/google-cloud-apihub/setup.py +++ b/packages/google-cloud-apihub/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/google-cloud-apihub/testing/constraints-3.10.txt b/packages/google-cloud-apihub/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-apihub/testing/constraints-3.10.txt +++ b/packages/google-cloud-apihub/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-apihub/tests/unit/gapic/apihub_v1/test_api_hub.py b/packages/google-cloud-apihub/tests/unit/gapic/apihub_v1/test_api_hub.py index 23684fed5df4..8dda1f320098 100644 --- a/packages/google-cloud-apihub/tests/unit/gapic/apihub_v1/test_api_hub.py +++ b/packages/google-cloud-apihub/tests/unit/gapic/apihub_v1/test_api_hub.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" @@ -1243,8 +1259,8 @@ def test_api_hub_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - apihub_service.CreateApiRequest, - dict, + apihub_service.CreateApiRequest(), + {}, ], ) def test_create_api(request_type, transport: str = "grpc"): @@ -1255,7 +1271,7 @@ def test_create_api(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_api), "__call__") as call: @@ -1310,10 +1326,11 @@ def test_create_api_non_empty_request_with_auto_populated_field(): client.create_api(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apihub_service.CreateApiRequest( + request_msg = apihub_service.CreateApiRequest( parent="parent_value", api_id="api_id_value", ) + assert args[0] == request_msg def test_create_api_use_cached_wrapped_rpc(): @@ -1392,9 +1409,14 @@ async def test_create_api_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_create_api_async( - transport: str = "grpc_asyncio", request_type=apihub_service.CreateApiRequest -): +@pytest.mark.parametrize( + "request_type", + [ + apihub_service.CreateApiRequest(), + {}, + ], +) +async def test_create_api_async(request_type, transport: str = "grpc_asyncio"): client = ApiHubAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1402,7 +1424,7 @@ async def test_create_api_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_api), "__call__") as call: @@ -1435,11 +1457,6 @@ async def test_create_api_async( assert response.fingerprint == "fingerprint_value" -@pytest.mark.asyncio -async def test_create_api_async_from_dict(): - await test_create_api_async(request_type=dict) - - def test_create_api_field_headers(): client = ApiHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1602,8 +1619,8 @@ async def test_create_api_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - apihub_service.GetApiRequest, - dict, + apihub_service.GetApiRequest(), + {}, ], ) def test_get_api(request_type, transport: str = "grpc"): @@ -1614,7 +1631,7 @@ def test_get_api(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_api), "__call__") as call: @@ -1668,9 +1685,10 @@ def test_get_api_non_empty_request_with_auto_populated_field(): client.get_api(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apihub_service.GetApiRequest( + request_msg = apihub_service.GetApiRequest( name="name_value", ) + assert args[0] == request_msg def test_get_api_use_cached_wrapped_rpc(): @@ -1749,9 +1767,14 @@ async def test_get_api_async_use_cached_wrapped_rpc(transport: str = "grpc_async @pytest.mark.asyncio -async def test_get_api_async( - transport: str = "grpc_asyncio", request_type=apihub_service.GetApiRequest -): +@pytest.mark.parametrize( + "request_type", + [ + apihub_service.GetApiRequest(), + {}, + ], +) +async def test_get_api_async(request_type, transport: str = "grpc_asyncio"): client = ApiHubAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1759,7 +1782,7 @@ async def test_get_api_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_api), "__call__") as call: @@ -1792,11 +1815,6 @@ async def test_get_api_async( assert response.fingerprint == "fingerprint_value" -@pytest.mark.asyncio -async def test_get_api_async_from_dict(): - await test_get_api_async(request_type=dict) - - def test_get_api_field_headers(): client = ApiHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1939,8 +1957,8 @@ async def test_get_api_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - apihub_service.ListApisRequest, - dict, + apihub_service.ListApisRequest(), + {}, ], ) def test_list_apis(request_type, transport: str = "grpc"): @@ -1951,7 +1969,7 @@ def test_list_apis(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_apis), "__call__") as call: @@ -1997,11 +2015,12 @@ def test_list_apis_non_empty_request_with_auto_populated_field(): client.list_apis(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apihub_service.ListApisRequest( + request_msg = apihub_service.ListApisRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_apis_use_cached_wrapped_rpc(): @@ -2080,9 +2099,14 @@ async def test_list_apis_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_list_apis_async( - transport: str = "grpc_asyncio", request_type=apihub_service.ListApisRequest -): +@pytest.mark.parametrize( + "request_type", + [ + apihub_service.ListApisRequest(), + {}, + ], +) +async def test_list_apis_async(request_type, transport: str = "grpc_asyncio"): client = ApiHubAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2090,7 +2114,7 @@ async def test_list_apis_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_apis), "__call__") as call: @@ -2113,11 +2137,6 @@ async def test_list_apis_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_apis_async_from_dict(): - await test_list_apis_async(request_type=dict) - - def test_list_apis_field_headers(): client = ApiHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2454,8 +2473,8 @@ async def test_list_apis_async_pages(): @pytest.mark.parametrize( "request_type", [ - apihub_service.UpdateApiRequest, - dict, + apihub_service.UpdateApiRequest(), + {}, ], ) def test_update_api(request_type, transport: str = "grpc"): @@ -2466,7 +2485,7 @@ def test_update_api(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_api), "__call__") as call: @@ -2518,7 +2537,8 @@ def test_update_api_non_empty_request_with_auto_populated_field(): client.update_api(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apihub_service.UpdateApiRequest() + request_msg = apihub_service.UpdateApiRequest() + assert args[0] == request_msg def test_update_api_use_cached_wrapped_rpc(): @@ -2597,9 +2617,14 @@ async def test_update_api_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_update_api_async( - transport: str = "grpc_asyncio", request_type=apihub_service.UpdateApiRequest -): +@pytest.mark.parametrize( + "request_type", + [ + apihub_service.UpdateApiRequest(), + {}, + ], +) +async def test_update_api_async(request_type, transport: str = "grpc_asyncio"): client = ApiHubAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2607,7 +2632,7 @@ async def test_update_api_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_api), "__call__") as call: @@ -2640,11 +2665,6 @@ async def test_update_api_async( assert response.fingerprint == "fingerprint_value" -@pytest.mark.asyncio -async def test_update_api_async_from_dict(): - await test_update_api_async(request_type=dict) - - def test_update_api_field_headers(): client = ApiHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2797,8 +2817,8 @@ async def test_update_api_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - apihub_service.DeleteApiRequest, - dict, + apihub_service.DeleteApiRequest(), + {}, ], ) def test_delete_api(request_type, transport: str = "grpc"): @@ -2809,7 +2829,7 @@ def test_delete_api(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_api), "__call__") as call: @@ -2850,9 +2870,10 @@ def test_delete_api_non_empty_request_with_auto_populated_field(): client.delete_api(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apihub_service.DeleteApiRequest( + request_msg = apihub_service.DeleteApiRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_api_use_cached_wrapped_rpc(): @@ -2931,9 +2952,14 @@ async def test_delete_api_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_delete_api_async( - transport: str = "grpc_asyncio", request_type=apihub_service.DeleteApiRequest -): +@pytest.mark.parametrize( + "request_type", + [ + apihub_service.DeleteApiRequest(), + {}, + ], +) +async def test_delete_api_async(request_type, transport: str = "grpc_asyncio"): client = ApiHubAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2941,7 +2967,7 @@ async def test_delete_api_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_api), "__call__") as call: @@ -2959,11 +2985,6 @@ async def test_delete_api_async( assert response is None -@pytest.mark.asyncio -async def test_delete_api_async_from_dict(): - await test_delete_api_async(request_type=dict) - - def test_delete_api_field_headers(): client = ApiHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3106,8 +3127,8 @@ async def test_delete_api_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - apihub_service.CreateVersionRequest, - dict, + apihub_service.CreateVersionRequest(), + {}, ], ) def test_create_version(request_type, transport: str = "grpc"): @@ -3118,7 +3139,7 @@ def test_create_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_version), "__call__") as call: @@ -3177,10 +3198,11 @@ def test_create_version_non_empty_request_with_auto_populated_field(): client.create_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apihub_service.CreateVersionRequest( + request_msg = apihub_service.CreateVersionRequest( parent="parent_value", version_id="version_id_value", ) + assert args[0] == request_msg def test_create_version_use_cached_wrapped_rpc(): @@ -3261,9 +3283,14 @@ async def test_create_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_version_async( - transport: str = "grpc_asyncio", request_type=apihub_service.CreateVersionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + apihub_service.CreateVersionRequest(), + {}, + ], +) +async def test_create_version_async(request_type, transport: str = "grpc_asyncio"): client = ApiHubAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3271,7 +3298,7 @@ async def test_create_version_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_version), "__call__") as call: @@ -3308,11 +3335,6 @@ async def test_create_version_async( assert response.selected_deployment == "selected_deployment_value" -@pytest.mark.asyncio -async def test_create_version_async_from_dict(): - await test_create_version_async(request_type=dict) - - def test_create_version_field_headers(): client = ApiHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3479,8 +3501,8 @@ async def test_create_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - apihub_service.GetVersionRequest, - dict, + apihub_service.GetVersionRequest(), + {}, ], ) def test_get_version(request_type, transport: str = "grpc"): @@ -3491,7 +3513,7 @@ def test_get_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_version), "__call__") as call: @@ -3549,9 +3571,10 @@ def test_get_version_non_empty_request_with_auto_populated_field(): client.get_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apihub_service.GetVersionRequest( + request_msg = apihub_service.GetVersionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_version_use_cached_wrapped_rpc(): @@ -3632,9 +3655,14 @@ async def test_get_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_version_async( - transport: str = "grpc_asyncio", request_type=apihub_service.GetVersionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + apihub_service.GetVersionRequest(), + {}, + ], +) +async def test_get_version_async(request_type, transport: str = "grpc_asyncio"): client = ApiHubAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3642,7 +3670,7 @@ async def test_get_version_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_version), "__call__") as call: @@ -3679,11 +3707,6 @@ async def test_get_version_async( assert response.selected_deployment == "selected_deployment_value" -@pytest.mark.asyncio -async def test_get_version_async_from_dict(): - await test_get_version_async(request_type=dict) - - def test_get_version_field_headers(): client = ApiHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3830,8 +3853,8 @@ async def test_get_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - apihub_service.ListVersionsRequest, - dict, + apihub_service.ListVersionsRequest(), + {}, ], ) def test_list_versions(request_type, transport: str = "grpc"): @@ -3842,7 +3865,7 @@ def test_list_versions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_versions), "__call__") as call: @@ -3888,11 +3911,12 @@ def test_list_versions_non_empty_request_with_auto_populated_field(): client.list_versions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apihub_service.ListVersionsRequest( + request_msg = apihub_service.ListVersionsRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_versions_use_cached_wrapped_rpc(): @@ -3973,9 +3997,14 @@ async def test_list_versions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_versions_async( - transport: str = "grpc_asyncio", request_type=apihub_service.ListVersionsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + apihub_service.ListVersionsRequest(), + {}, + ], +) +async def test_list_versions_async(request_type, transport: str = "grpc_asyncio"): client = ApiHubAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3983,7 +4012,7 @@ async def test_list_versions_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_versions), "__call__") as call: @@ -4006,11 +4035,6 @@ async def test_list_versions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_versions_async_from_dict(): - await test_list_versions_async(request_type=dict) - - def test_list_versions_field_headers(): client = ApiHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4347,8 +4371,8 @@ async def test_list_versions_async_pages(): @pytest.mark.parametrize( "request_type", [ - apihub_service.UpdateVersionRequest, - dict, + apihub_service.UpdateVersionRequest(), + {}, ], ) def test_update_version(request_type, transport: str = "grpc"): @@ -4359,7 +4383,7 @@ def test_update_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_version), "__call__") as call: @@ -4415,7 +4439,8 @@ def test_update_version_non_empty_request_with_auto_populated_field(): client.update_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apihub_service.UpdateVersionRequest() + request_msg = apihub_service.UpdateVersionRequest() + assert args[0] == request_msg def test_update_version_use_cached_wrapped_rpc(): @@ -4496,9 +4521,14 @@ async def test_update_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_version_async( - transport: str = "grpc_asyncio", request_type=apihub_service.UpdateVersionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + apihub_service.UpdateVersionRequest(), + {}, + ], +) +async def test_update_version_async(request_type, transport: str = "grpc_asyncio"): client = ApiHubAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4506,7 +4536,7 @@ async def test_update_version_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_version), "__call__") as call: @@ -4543,11 +4573,6 @@ async def test_update_version_async( assert response.selected_deployment == "selected_deployment_value" -@pytest.mark.asyncio -async def test_update_version_async_from_dict(): - await test_update_version_async(request_type=dict) - - def test_update_version_field_headers(): client = ApiHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4704,8 +4729,8 @@ async def test_update_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - apihub_service.DeleteVersionRequest, - dict, + apihub_service.DeleteVersionRequest(), + {}, ], ) def test_delete_version(request_type, transport: str = "grpc"): @@ -4716,7 +4741,7 @@ def test_delete_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_version), "__call__") as call: @@ -4757,9 +4782,10 @@ def test_delete_version_non_empty_request_with_auto_populated_field(): client.delete_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apihub_service.DeleteVersionRequest( + request_msg = apihub_service.DeleteVersionRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_version_use_cached_wrapped_rpc(): @@ -4840,9 +4866,14 @@ async def test_delete_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_version_async( - transport: str = "grpc_asyncio", request_type=apihub_service.DeleteVersionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + apihub_service.DeleteVersionRequest(), + {}, + ], +) +async def test_delete_version_async(request_type, transport: str = "grpc_asyncio"): client = ApiHubAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4850,7 +4881,7 @@ async def test_delete_version_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_version), "__call__") as call: @@ -4868,11 +4899,6 @@ async def test_delete_version_async( assert response is None -@pytest.mark.asyncio -async def test_delete_version_async_from_dict(): - await test_delete_version_async(request_type=dict) - - def test_delete_version_field_headers(): client = ApiHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5015,8 +5041,8 @@ async def test_delete_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - apihub_service.CreateSpecRequest, - dict, + apihub_service.CreateSpecRequest(), + {}, ], ) def test_create_spec(request_type, transport: str = "grpc"): @@ -5027,7 +5053,7 @@ def test_create_spec(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_spec), "__call__") as call: @@ -5078,10 +5104,11 @@ def test_create_spec_non_empty_request_with_auto_populated_field(): client.create_spec(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apihub_service.CreateSpecRequest( + request_msg = apihub_service.CreateSpecRequest( parent="parent_value", spec_id="spec_id_value", ) + assert args[0] == request_msg def test_create_spec_use_cached_wrapped_rpc(): @@ -5162,9 +5189,14 @@ async def test_create_spec_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_spec_async( - transport: str = "grpc_asyncio", request_type=apihub_service.CreateSpecRequest -): +@pytest.mark.parametrize( + "request_type", + [ + apihub_service.CreateSpecRequest(), + {}, + ], +) +async def test_create_spec_async(request_type, transport: str = "grpc_asyncio"): client = ApiHubAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5172,7 +5204,7 @@ async def test_create_spec_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_spec), "__call__") as call: @@ -5201,11 +5233,6 @@ async def test_create_spec_async( assert response.parsing_mode == common_fields.Spec.ParsingMode.RELAXED -@pytest.mark.asyncio -async def test_create_spec_async_from_dict(): - await test_create_spec_async(request_type=dict) - - def test_create_spec_field_headers(): client = ApiHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5368,8 +5395,8 @@ async def test_create_spec_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - apihub_service.GetSpecRequest, - dict, + apihub_service.GetSpecRequest(), + {}, ], ) def test_get_spec(request_type, transport: str = "grpc"): @@ -5380,7 +5407,7 @@ def test_get_spec(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_spec), "__call__") as call: @@ -5430,9 +5457,10 @@ def test_get_spec_non_empty_request_with_auto_populated_field(): client.get_spec(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apihub_service.GetSpecRequest( + request_msg = apihub_service.GetSpecRequest( name="name_value", ) + assert args[0] == request_msg def test_get_spec_use_cached_wrapped_rpc(): @@ -5511,9 +5539,14 @@ async def test_get_spec_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn @pytest.mark.asyncio -async def test_get_spec_async( - transport: str = "grpc_asyncio", request_type=apihub_service.GetSpecRequest -): +@pytest.mark.parametrize( + "request_type", + [ + apihub_service.GetSpecRequest(), + {}, + ], +) +async def test_get_spec_async(request_type, transport: str = "grpc_asyncio"): client = ApiHubAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5521,7 +5554,7 @@ async def test_get_spec_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_spec), "__call__") as call: @@ -5550,11 +5583,6 @@ async def test_get_spec_async( assert response.parsing_mode == common_fields.Spec.ParsingMode.RELAXED -@pytest.mark.asyncio -async def test_get_spec_async_from_dict(): - await test_get_spec_async(request_type=dict) - - def test_get_spec_field_headers(): client = ApiHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5697,8 +5725,8 @@ async def test_get_spec_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - apihub_service.GetSpecContentsRequest, - dict, + apihub_service.GetSpecContentsRequest(), + {}, ], ) def test_get_spec_contents(request_type, transport: str = "grpc"): @@ -5709,7 +5737,7 @@ def test_get_spec_contents(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5759,9 +5787,10 @@ def test_get_spec_contents_non_empty_request_with_auto_populated_field(): client.get_spec_contents(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apihub_service.GetSpecContentsRequest( + request_msg = apihub_service.GetSpecContentsRequest( name="name_value", ) + assert args[0] == request_msg def test_get_spec_contents_use_cached_wrapped_rpc(): @@ -5844,9 +5873,14 @@ async def test_get_spec_contents_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_spec_contents_async( - transport: str = "grpc_asyncio", request_type=apihub_service.GetSpecContentsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + apihub_service.GetSpecContentsRequest(), + {}, + ], +) +async def test_get_spec_contents_async(request_type, transport: str = "grpc_asyncio"): client = ApiHubAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5854,7 +5888,7 @@ async def test_get_spec_contents_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( @@ -5881,11 +5915,6 @@ async def test_get_spec_contents_async( assert response.mime_type == "mime_type_value" -@pytest.mark.asyncio -async def test_get_spec_contents_async_from_dict(): - await test_get_spec_contents_async(request_type=dict) - - def test_get_spec_contents_field_headers(): client = ApiHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6040,8 +6069,8 @@ async def test_get_spec_contents_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - apihub_service.ListSpecsRequest, - dict, + apihub_service.ListSpecsRequest(), + {}, ], ) def test_list_specs(request_type, transport: str = "grpc"): @@ -6052,7 +6081,7 @@ def test_list_specs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_specs), "__call__") as call: @@ -6098,11 +6127,12 @@ def test_list_specs_non_empty_request_with_auto_populated_field(): client.list_specs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apihub_service.ListSpecsRequest( + request_msg = apihub_service.ListSpecsRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_specs_use_cached_wrapped_rpc(): @@ -6181,9 +6211,14 @@ async def test_list_specs_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_list_specs_async( - transport: str = "grpc_asyncio", request_type=apihub_service.ListSpecsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + apihub_service.ListSpecsRequest(), + {}, + ], +) +async def test_list_specs_async(request_type, transport: str = "grpc_asyncio"): client = ApiHubAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6191,7 +6226,7 @@ async def test_list_specs_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_specs), "__call__") as call: @@ -6214,11 +6249,6 @@ async def test_list_specs_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_specs_async_from_dict(): - await test_list_specs_async(request_type=dict) - - def test_list_specs_field_headers(): client = ApiHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6555,8 +6585,8 @@ async def test_list_specs_async_pages(): @pytest.mark.parametrize( "request_type", [ - apihub_service.UpdateSpecRequest, - dict, + apihub_service.UpdateSpecRequest(), + {}, ], ) def test_update_spec(request_type, transport: str = "grpc"): @@ -6567,7 +6597,7 @@ def test_update_spec(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_spec), "__call__") as call: @@ -6615,7 +6645,8 @@ def test_update_spec_non_empty_request_with_auto_populated_field(): client.update_spec(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apihub_service.UpdateSpecRequest() + request_msg = apihub_service.UpdateSpecRequest() + assert args[0] == request_msg def test_update_spec_use_cached_wrapped_rpc(): @@ -6696,9 +6727,14 @@ async def test_update_spec_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_spec_async( - transport: str = "grpc_asyncio", request_type=apihub_service.UpdateSpecRequest -): +@pytest.mark.parametrize( + "request_type", + [ + apihub_service.UpdateSpecRequest(), + {}, + ], +) +async def test_update_spec_async(request_type, transport: str = "grpc_asyncio"): client = ApiHubAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6706,7 +6742,7 @@ async def test_update_spec_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_spec), "__call__") as call: @@ -6735,11 +6771,6 @@ async def test_update_spec_async( assert response.parsing_mode == common_fields.Spec.ParsingMode.RELAXED -@pytest.mark.asyncio -async def test_update_spec_async_from_dict(): - await test_update_spec_async(request_type=dict) - - def test_update_spec_field_headers(): client = ApiHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6892,8 +6923,8 @@ async def test_update_spec_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - apihub_service.DeleteSpecRequest, - dict, + apihub_service.DeleteSpecRequest(), + {}, ], ) def test_delete_spec(request_type, transport: str = "grpc"): @@ -6904,7 +6935,7 @@ def test_delete_spec(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_spec), "__call__") as call: @@ -6945,9 +6976,10 @@ def test_delete_spec_non_empty_request_with_auto_populated_field(): client.delete_spec(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apihub_service.DeleteSpecRequest( + request_msg = apihub_service.DeleteSpecRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_spec_use_cached_wrapped_rpc(): @@ -7028,9 +7060,14 @@ async def test_delete_spec_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_spec_async( - transport: str = "grpc_asyncio", request_type=apihub_service.DeleteSpecRequest -): +@pytest.mark.parametrize( + "request_type", + [ + apihub_service.DeleteSpecRequest(), + {}, + ], +) +async def test_delete_spec_async(request_type, transport: str = "grpc_asyncio"): client = ApiHubAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7038,7 +7075,7 @@ async def test_delete_spec_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_spec), "__call__") as call: @@ -7056,11 +7093,6 @@ async def test_delete_spec_async( assert response is None -@pytest.mark.asyncio -async def test_delete_spec_async_from_dict(): - await test_delete_spec_async(request_type=dict) - - def test_delete_spec_field_headers(): client = ApiHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7203,8 +7235,8 @@ async def test_delete_spec_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - apihub_service.CreateApiOperationRequest, - dict, + apihub_service.CreateApiOperationRequest(), + {}, ], ) def test_create_api_operation(request_type, transport: str = "grpc"): @@ -7215,7 +7247,7 @@ def test_create_api_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( @@ -7266,10 +7298,11 @@ def test_create_api_operation_non_empty_request_with_auto_populated_field(): client.create_api_operation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apihub_service.CreateApiOperationRequest( + request_msg = apihub_service.CreateApiOperationRequest( parent="parent_value", api_operation_id="api_operation_id_value", ) + assert args[0] == request_msg def test_create_api_operation_use_cached_wrapped_rpc(): @@ -7354,9 +7387,15 @@ async def test_create_api_operation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + apihub_service.CreateApiOperationRequest(), + {}, + ], +) async def test_create_api_operation_async( - transport: str = "grpc_asyncio", - request_type=apihub_service.CreateApiOperationRequest, + request_type, transport: str = "grpc_asyncio" ): client = ApiHubAsyncClient( credentials=async_anonymous_credentials(), @@ -7365,7 +7404,7 @@ async def test_create_api_operation_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( @@ -7392,11 +7431,6 @@ async def test_create_api_operation_async( assert response.spec == "spec_value" -@pytest.mark.asyncio -async def test_create_api_operation_async_from_dict(): - await test_create_api_operation_async(request_type=dict) - - def test_create_api_operation_field_headers(): client = ApiHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7571,8 +7605,8 @@ async def test_create_api_operation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - apihub_service.GetApiOperationRequest, - dict, + apihub_service.GetApiOperationRequest(), + {}, ], ) def test_get_api_operation(request_type, transport: str = "grpc"): @@ -7583,7 +7617,7 @@ def test_get_api_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( @@ -7633,9 +7667,10 @@ def test_get_api_operation_non_empty_request_with_auto_populated_field(): client.get_api_operation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apihub_service.GetApiOperationRequest( + request_msg = apihub_service.GetApiOperationRequest( name="name_value", ) + assert args[0] == request_msg def test_get_api_operation_use_cached_wrapped_rpc(): @@ -7718,9 +7753,14 @@ async def test_get_api_operation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_api_operation_async( - transport: str = "grpc_asyncio", request_type=apihub_service.GetApiOperationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + apihub_service.GetApiOperationRequest(), + {}, + ], +) +async def test_get_api_operation_async(request_type, transport: str = "grpc_asyncio"): client = ApiHubAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7728,7 +7768,7 @@ async def test_get_api_operation_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( @@ -7755,11 +7795,6 @@ async def test_get_api_operation_async( assert response.spec == "spec_value" -@pytest.mark.asyncio -async def test_get_api_operation_async_from_dict(): - await test_get_api_operation_async(request_type=dict) - - def test_get_api_operation_field_headers(): client = ApiHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7914,8 +7949,8 @@ async def test_get_api_operation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - apihub_service.ListApiOperationsRequest, - dict, + apihub_service.ListApiOperationsRequest(), + {}, ], ) def test_list_api_operations(request_type, transport: str = "grpc"): @@ -7926,7 +7961,7 @@ def test_list_api_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( @@ -7976,11 +8011,12 @@ def test_list_api_operations_non_empty_request_with_auto_populated_field(): client.list_api_operations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apihub_service.ListApiOperationsRequest( + request_msg = apihub_service.ListApiOperationsRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_api_operations_use_cached_wrapped_rpc(): @@ -8065,10 +8101,14 @@ async def test_list_api_operations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_api_operations_async( - transport: str = "grpc_asyncio", - request_type=apihub_service.ListApiOperationsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + apihub_service.ListApiOperationsRequest(), + {}, + ], +) +async def test_list_api_operations_async(request_type, transport: str = "grpc_asyncio"): client = ApiHubAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8076,7 +8116,7 @@ async def test_list_api_operations_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( @@ -8101,11 +8141,6 @@ async def test_list_api_operations_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_api_operations_async_from_dict(): - await test_list_api_operations_async(request_type=dict) - - def test_list_api_operations_field_headers(): client = ApiHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8458,8 +8493,8 @@ async def test_list_api_operations_async_pages(): @pytest.mark.parametrize( "request_type", [ - apihub_service.UpdateApiOperationRequest, - dict, + apihub_service.UpdateApiOperationRequest(), + {}, ], ) def test_update_api_operation(request_type, transport: str = "grpc"): @@ -8470,7 +8505,7 @@ def test_update_api_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( @@ -8518,7 +8553,8 @@ def test_update_api_operation_non_empty_request_with_auto_populated_field(): client.update_api_operation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apihub_service.UpdateApiOperationRequest() + request_msg = apihub_service.UpdateApiOperationRequest() + assert args[0] == request_msg def test_update_api_operation_use_cached_wrapped_rpc(): @@ -8603,9 +8639,15 @@ async def test_update_api_operation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + apihub_service.UpdateApiOperationRequest(), + {}, + ], +) async def test_update_api_operation_async( - transport: str = "grpc_asyncio", - request_type=apihub_service.UpdateApiOperationRequest, + request_type, transport: str = "grpc_asyncio" ): client = ApiHubAsyncClient( credentials=async_anonymous_credentials(), @@ -8614,7 +8656,7 @@ async def test_update_api_operation_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( @@ -8641,11 +8683,6 @@ async def test_update_api_operation_async( assert response.spec == "spec_value" -@pytest.mark.asyncio -async def test_update_api_operation_async_from_dict(): - await test_update_api_operation_async(request_type=dict) - - def test_update_api_operation_field_headers(): client = ApiHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8810,8 +8847,8 @@ async def test_update_api_operation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - apihub_service.DeleteApiOperationRequest, - dict, + apihub_service.DeleteApiOperationRequest(), + {}, ], ) def test_delete_api_operation(request_type, transport: str = "grpc"): @@ -8822,7 +8859,7 @@ def test_delete_api_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( @@ -8867,9 +8904,10 @@ def test_delete_api_operation_non_empty_request_with_auto_populated_field(): client.delete_api_operation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apihub_service.DeleteApiOperationRequest( + request_msg = apihub_service.DeleteApiOperationRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_api_operation_use_cached_wrapped_rpc(): @@ -8954,9 +8992,15 @@ async def test_delete_api_operation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + apihub_service.DeleteApiOperationRequest(), + {}, + ], +) async def test_delete_api_operation_async( - transport: str = "grpc_asyncio", - request_type=apihub_service.DeleteApiOperationRequest, + request_type, transport: str = "grpc_asyncio" ): client = ApiHubAsyncClient( credentials=async_anonymous_credentials(), @@ -8965,7 +9009,7 @@ async def test_delete_api_operation_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( @@ -8985,11 +9029,6 @@ async def test_delete_api_operation_async( assert response is None -@pytest.mark.asyncio -async def test_delete_api_operation_async_from_dict(): - await test_delete_api_operation_async(request_type=dict) - - def test_delete_api_operation_field_headers(): client = ApiHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9140,8 +9179,8 @@ async def test_delete_api_operation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - apihub_service.GetDefinitionRequest, - dict, + apihub_service.GetDefinitionRequest(), + {}, ], ) def test_get_definition(request_type, transport: str = "grpc"): @@ -9152,7 +9191,7 @@ def test_get_definition(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_definition), "__call__") as call: @@ -9200,9 +9239,10 @@ def test_get_definition_non_empty_request_with_auto_populated_field(): client.get_definition(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apihub_service.GetDefinitionRequest( + request_msg = apihub_service.GetDefinitionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_definition_use_cached_wrapped_rpc(): @@ -9283,9 +9323,14 @@ async def test_get_definition_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_definition_async( - transport: str = "grpc_asyncio", request_type=apihub_service.GetDefinitionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + apihub_service.GetDefinitionRequest(), + {}, + ], +) +async def test_get_definition_async(request_type, transport: str = "grpc_asyncio"): client = ApiHubAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9293,7 +9338,7 @@ async def test_get_definition_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_definition), "__call__") as call: @@ -9320,11 +9365,6 @@ async def test_get_definition_async( assert response.type_ == common_fields.Definition.Type.SCHEMA -@pytest.mark.asyncio -async def test_get_definition_async_from_dict(): - await test_get_definition_async(request_type=dict) - - def test_get_definition_field_headers(): client = ApiHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9471,8 +9511,8 @@ async def test_get_definition_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - apihub_service.CreateDeploymentRequest, - dict, + apihub_service.CreateDeploymentRequest(), + {}, ], ) def test_create_deployment(request_type, transport: str = "grpc"): @@ -9483,7 +9523,7 @@ def test_create_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9546,10 +9586,11 @@ def test_create_deployment_non_empty_request_with_auto_populated_field(): client.create_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apihub_service.CreateDeploymentRequest( + request_msg = apihub_service.CreateDeploymentRequest( parent="parent_value", deployment_id="deployment_id_value", ) + assert args[0] == request_msg def test_create_deployment_use_cached_wrapped_rpc(): @@ -9632,9 +9673,14 @@ async def test_create_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_deployment_async( - transport: str = "grpc_asyncio", request_type=apihub_service.CreateDeploymentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + apihub_service.CreateDeploymentRequest(), + {}, + ], +) +async def test_create_deployment_async(request_type, transport: str = "grpc_asyncio"): client = ApiHubAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9642,7 +9688,7 @@ async def test_create_deployment_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( @@ -9681,11 +9727,6 @@ async def test_create_deployment_async( assert response.source_environment == "source_environment_value" -@pytest.mark.asyncio -async def test_create_deployment_async_from_dict(): - await test_create_deployment_async(request_type=dict) - - def test_create_deployment_field_headers(): client = ApiHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9860,8 +9901,8 @@ async def test_create_deployment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - apihub_service.GetDeploymentRequest, - dict, + apihub_service.GetDeploymentRequest(), + {}, ], ) def test_get_deployment(request_type, transport: str = "grpc"): @@ -9872,7 +9913,7 @@ def test_get_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_deployment), "__call__") as call: @@ -9930,9 +9971,10 @@ def test_get_deployment_non_empty_request_with_auto_populated_field(): client.get_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apihub_service.GetDeploymentRequest( + request_msg = apihub_service.GetDeploymentRequest( name="name_value", ) + assert args[0] == request_msg def test_get_deployment_use_cached_wrapped_rpc(): @@ -10013,9 +10055,14 @@ async def test_get_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_deployment_async( - transport: str = "grpc_asyncio", request_type=apihub_service.GetDeploymentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + apihub_service.GetDeploymentRequest(), + {}, + ], +) +async def test_get_deployment_async(request_type, transport: str = "grpc_asyncio"): client = ApiHubAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10023,7 +10070,7 @@ async def test_get_deployment_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_deployment), "__call__") as call: @@ -10060,11 +10107,6 @@ async def test_get_deployment_async( assert response.source_environment == "source_environment_value" -@pytest.mark.asyncio -async def test_get_deployment_async_from_dict(): - await test_get_deployment_async(request_type=dict) - - def test_get_deployment_field_headers(): client = ApiHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10211,8 +10253,8 @@ async def test_get_deployment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - apihub_service.ListDeploymentsRequest, - dict, + apihub_service.ListDeploymentsRequest(), + {}, ], ) def test_list_deployments(request_type, transport: str = "grpc"): @@ -10223,7 +10265,7 @@ def test_list_deployments(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_deployments), "__call__") as call: @@ -10269,11 +10311,12 @@ def test_list_deployments_non_empty_request_with_auto_populated_field(): client.list_deployments(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apihub_service.ListDeploymentsRequest( + request_msg = apihub_service.ListDeploymentsRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_deployments_use_cached_wrapped_rpc(): @@ -10356,9 +10399,14 @@ async def test_list_deployments_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_deployments_async( - transport: str = "grpc_asyncio", request_type=apihub_service.ListDeploymentsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + apihub_service.ListDeploymentsRequest(), + {}, + ], +) +async def test_list_deployments_async(request_type, transport: str = "grpc_asyncio"): client = ApiHubAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10366,7 +10414,7 @@ async def test_list_deployments_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_deployments), "__call__") as call: @@ -10389,11 +10437,6 @@ async def test_list_deployments_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_deployments_async_from_dict(): - await test_list_deployments_async(request_type=dict) - - def test_list_deployments_field_headers(): client = ApiHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10730,8 +10773,8 @@ async def test_list_deployments_async_pages(): @pytest.mark.parametrize( "request_type", [ - apihub_service.UpdateDeploymentRequest, - dict, + apihub_service.UpdateDeploymentRequest(), + {}, ], ) def test_update_deployment(request_type, transport: str = "grpc"): @@ -10742,7 +10785,7 @@ def test_update_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10802,7 +10845,8 @@ def test_update_deployment_non_empty_request_with_auto_populated_field(): client.update_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apihub_service.UpdateDeploymentRequest() + request_msg = apihub_service.UpdateDeploymentRequest() + assert args[0] == request_msg def test_update_deployment_use_cached_wrapped_rpc(): @@ -10885,9 +10929,14 @@ async def test_update_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_deployment_async( - transport: str = "grpc_asyncio", request_type=apihub_service.UpdateDeploymentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + apihub_service.UpdateDeploymentRequest(), + {}, + ], +) +async def test_update_deployment_async(request_type, transport: str = "grpc_asyncio"): client = ApiHubAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10895,7 +10944,7 @@ async def test_update_deployment_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( @@ -10934,11 +10983,6 @@ async def test_update_deployment_async( assert response.source_environment == "source_environment_value" -@pytest.mark.asyncio -async def test_update_deployment_async_from_dict(): - await test_update_deployment_async(request_type=dict) - - def test_update_deployment_field_headers(): client = ApiHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11103,8 +11147,8 @@ async def test_update_deployment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - apihub_service.DeleteDeploymentRequest, - dict, + apihub_service.DeleteDeploymentRequest(), + {}, ], ) def test_delete_deployment(request_type, transport: str = "grpc"): @@ -11115,7 +11159,7 @@ def test_delete_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11160,9 +11204,10 @@ def test_delete_deployment_non_empty_request_with_auto_populated_field(): client.delete_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apihub_service.DeleteDeploymentRequest( + request_msg = apihub_service.DeleteDeploymentRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_deployment_use_cached_wrapped_rpc(): @@ -11245,9 +11290,14 @@ async def test_delete_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_deployment_async( - transport: str = "grpc_asyncio", request_type=apihub_service.DeleteDeploymentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + apihub_service.DeleteDeploymentRequest(), + {}, + ], +) +async def test_delete_deployment_async(request_type, transport: str = "grpc_asyncio"): client = ApiHubAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11255,7 +11305,7 @@ async def test_delete_deployment_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( @@ -11275,11 +11325,6 @@ async def test_delete_deployment_async( assert response is None -@pytest.mark.asyncio -async def test_delete_deployment_async_from_dict(): - await test_delete_deployment_async(request_type=dict) - - def test_delete_deployment_field_headers(): client = ApiHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11430,8 +11475,8 @@ async def test_delete_deployment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - apihub_service.CreateAttributeRequest, - dict, + apihub_service.CreateAttributeRequest(), + {}, ], ) def test_create_attribute(request_type, transport: str = "grpc"): @@ -11442,7 +11487,7 @@ def test_create_attribute(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_attribute), "__call__") as call: @@ -11504,10 +11549,11 @@ def test_create_attribute_non_empty_request_with_auto_populated_field(): client.create_attribute(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apihub_service.CreateAttributeRequest( + request_msg = apihub_service.CreateAttributeRequest( parent="parent_value", attribute_id="attribute_id_value", ) + assert args[0] == request_msg def test_create_attribute_use_cached_wrapped_rpc(): @@ -11590,9 +11636,14 @@ async def test_create_attribute_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_attribute_async( - transport: str = "grpc_asyncio", request_type=apihub_service.CreateAttributeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + apihub_service.CreateAttributeRequest(), + {}, + ], +) +async def test_create_attribute_async(request_type, transport: str = "grpc_asyncio"): client = ApiHubAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11600,7 +11651,7 @@ async def test_create_attribute_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_attribute), "__call__") as call: @@ -11640,11 +11691,6 @@ async def test_create_attribute_async( assert response.mandatory is True -@pytest.mark.asyncio -async def test_create_attribute_async_from_dict(): - await test_create_attribute_async(request_type=dict) - - def test_create_attribute_field_headers(): client = ApiHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11811,8 +11857,8 @@ async def test_create_attribute_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - apihub_service.GetAttributeRequest, - dict, + apihub_service.GetAttributeRequest(), + {}, ], ) def test_get_attribute(request_type, transport: str = "grpc"): @@ -11823,7 +11869,7 @@ def test_get_attribute(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_attribute), "__call__") as call: @@ -11884,9 +11930,10 @@ def test_get_attribute_non_empty_request_with_auto_populated_field(): client.get_attribute(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apihub_service.GetAttributeRequest( + request_msg = apihub_service.GetAttributeRequest( name="name_value", ) + assert args[0] == request_msg def test_get_attribute_use_cached_wrapped_rpc(): @@ -11967,9 +12014,14 @@ async def test_get_attribute_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_attribute_async( - transport: str = "grpc_asyncio", request_type=apihub_service.GetAttributeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + apihub_service.GetAttributeRequest(), + {}, + ], +) +async def test_get_attribute_async(request_type, transport: str = "grpc_asyncio"): client = ApiHubAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11977,7 +12029,7 @@ async def test_get_attribute_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_attribute), "__call__") as call: @@ -12017,11 +12069,6 @@ async def test_get_attribute_async( assert response.mandatory is True -@pytest.mark.asyncio -async def test_get_attribute_async_from_dict(): - await test_get_attribute_async(request_type=dict) - - def test_get_attribute_field_headers(): client = ApiHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12168,8 +12215,8 @@ async def test_get_attribute_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - apihub_service.UpdateAttributeRequest, - dict, + apihub_service.UpdateAttributeRequest(), + {}, ], ) def test_update_attribute(request_type, transport: str = "grpc"): @@ -12180,7 +12227,7 @@ def test_update_attribute(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_attribute), "__call__") as call: @@ -12239,7 +12286,8 @@ def test_update_attribute_non_empty_request_with_auto_populated_field(): client.update_attribute(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apihub_service.UpdateAttributeRequest() + request_msg = apihub_service.UpdateAttributeRequest() + assert args[0] == request_msg def test_update_attribute_use_cached_wrapped_rpc(): @@ -12322,9 +12370,14 @@ async def test_update_attribute_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_attribute_async( - transport: str = "grpc_asyncio", request_type=apihub_service.UpdateAttributeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + apihub_service.UpdateAttributeRequest(), + {}, + ], +) +async def test_update_attribute_async(request_type, transport: str = "grpc_asyncio"): client = ApiHubAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12332,7 +12385,7 @@ async def test_update_attribute_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_attribute), "__call__") as call: @@ -12372,11 +12425,6 @@ async def test_update_attribute_async( assert response.mandatory is True -@pytest.mark.asyncio -async def test_update_attribute_async_from_dict(): - await test_update_attribute_async(request_type=dict) - - def test_update_attribute_field_headers(): client = ApiHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12533,8 +12581,8 @@ async def test_update_attribute_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - apihub_service.DeleteAttributeRequest, - dict, + apihub_service.DeleteAttributeRequest(), + {}, ], ) def test_delete_attribute(request_type, transport: str = "grpc"): @@ -12545,7 +12593,7 @@ def test_delete_attribute(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_attribute), "__call__") as call: @@ -12586,9 +12634,10 @@ def test_delete_attribute_non_empty_request_with_auto_populated_field(): client.delete_attribute(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apihub_service.DeleteAttributeRequest( + request_msg = apihub_service.DeleteAttributeRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_attribute_use_cached_wrapped_rpc(): @@ -12671,9 +12720,14 @@ async def test_delete_attribute_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_attribute_async( - transport: str = "grpc_asyncio", request_type=apihub_service.DeleteAttributeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + apihub_service.DeleteAttributeRequest(), + {}, + ], +) +async def test_delete_attribute_async(request_type, transport: str = "grpc_asyncio"): client = ApiHubAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12681,7 +12735,7 @@ async def test_delete_attribute_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_attribute), "__call__") as call: @@ -12699,11 +12753,6 @@ async def test_delete_attribute_async( assert response is None -@pytest.mark.asyncio -async def test_delete_attribute_async_from_dict(): - await test_delete_attribute_async(request_type=dict) - - def test_delete_attribute_field_headers(): client = ApiHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12846,8 +12895,8 @@ async def test_delete_attribute_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - apihub_service.ListAttributesRequest, - dict, + apihub_service.ListAttributesRequest(), + {}, ], ) def test_list_attributes(request_type, transport: str = "grpc"): @@ -12858,7 +12907,7 @@ def test_list_attributes(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_attributes), "__call__") as call: @@ -12904,11 +12953,12 @@ def test_list_attributes_non_empty_request_with_auto_populated_field(): client.list_attributes(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apihub_service.ListAttributesRequest( + request_msg = apihub_service.ListAttributesRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_attributes_use_cached_wrapped_rpc(): @@ -12989,9 +13039,14 @@ async def test_list_attributes_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_attributes_async( - transport: str = "grpc_asyncio", request_type=apihub_service.ListAttributesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + apihub_service.ListAttributesRequest(), + {}, + ], +) +async def test_list_attributes_async(request_type, transport: str = "grpc_asyncio"): client = ApiHubAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12999,7 +13054,7 @@ async def test_list_attributes_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_attributes), "__call__") as call: @@ -13022,11 +13077,6 @@ async def test_list_attributes_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_attributes_async_from_dict(): - await test_list_attributes_async(request_type=dict) - - def test_list_attributes_field_headers(): client = ApiHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13363,8 +13413,8 @@ async def test_list_attributes_async_pages(): @pytest.mark.parametrize( "request_type", [ - apihub_service.SearchResourcesRequest, - dict, + apihub_service.SearchResourcesRequest(), + {}, ], ) def test_search_resources(request_type, transport: str = "grpc"): @@ -13375,7 +13425,7 @@ def test_search_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(type(client.transport.search_resources), "__call__") as call: @@ -13422,12 +13472,13 @@ def test_search_resources_non_empty_request_with_auto_populated_field(): client.search_resources(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apihub_service.SearchResourcesRequest( + request_msg = apihub_service.SearchResourcesRequest( location="location_value", query="query_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_search_resources_use_cached_wrapped_rpc(): @@ -13510,9 +13561,14 @@ async def test_search_resources_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_search_resources_async( - transport: str = "grpc_asyncio", request_type=apihub_service.SearchResourcesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + apihub_service.SearchResourcesRequest(), + {}, + ], +) +async def test_search_resources_async(request_type, transport: str = "grpc_asyncio"): client = ApiHubAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13520,7 +13576,7 @@ async def test_search_resources_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.search_resources), "__call__") as call: @@ -13543,11 +13599,6 @@ async def test_search_resources_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_search_resources_async_from_dict(): - await test_search_resources_async(request_type=dict) - - def test_search_resources_field_headers(): client = ApiHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13894,8 +13945,8 @@ async def test_search_resources_async_pages(): @pytest.mark.parametrize( "request_type", [ - apihub_service.CreateExternalApiRequest, - dict, + apihub_service.CreateExternalApiRequest(), + {}, ], ) def test_create_external_api(request_type, transport: str = "grpc"): @@ -13906,7 +13957,7 @@ def test_create_external_api(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -13963,10 +14014,11 @@ def test_create_external_api_non_empty_request_with_auto_populated_field(): client.create_external_api(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apihub_service.CreateExternalApiRequest( + request_msg = apihub_service.CreateExternalApiRequest( parent="parent_value", external_api_id="external_api_id_value", ) + assert args[0] == request_msg def test_create_external_api_use_cached_wrapped_rpc(): @@ -14051,10 +14103,14 @@ async def test_create_external_api_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_external_api_async( - transport: str = "grpc_asyncio", - request_type=apihub_service.CreateExternalApiRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + apihub_service.CreateExternalApiRequest(), + {}, + ], +) +async def test_create_external_api_async(request_type, transport: str = "grpc_asyncio"): client = ApiHubAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14062,7 +14118,7 @@ async def test_create_external_api_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( @@ -14095,11 +14151,6 @@ async def test_create_external_api_async( assert response.paths == ["paths_value"] -@pytest.mark.asyncio -async def test_create_external_api_async_from_dict(): - await test_create_external_api_async(request_type=dict) - - def test_create_external_api_field_headers(): client = ApiHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14274,8 +14325,8 @@ async def test_create_external_api_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - apihub_service.GetExternalApiRequest, - dict, + apihub_service.GetExternalApiRequest(), + {}, ], ) def test_get_external_api(request_type, transport: str = "grpc"): @@ -14286,7 +14337,7 @@ def test_get_external_api(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_external_api), "__call__") as call: @@ -14338,9 +14389,10 @@ def test_get_external_api_non_empty_request_with_auto_populated_field(): client.get_external_api(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apihub_service.GetExternalApiRequest( + request_msg = apihub_service.GetExternalApiRequest( name="name_value", ) + assert args[0] == request_msg def test_get_external_api_use_cached_wrapped_rpc(): @@ -14423,9 +14475,14 @@ async def test_get_external_api_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_external_api_async( - transport: str = "grpc_asyncio", request_type=apihub_service.GetExternalApiRequest -): +@pytest.mark.parametrize( + "request_type", + [ + apihub_service.GetExternalApiRequest(), + {}, + ], +) +async def test_get_external_api_async(request_type, transport: str = "grpc_asyncio"): client = ApiHubAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14433,7 +14490,7 @@ async def test_get_external_api_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_external_api), "__call__") as call: @@ -14464,11 +14521,6 @@ async def test_get_external_api_async( assert response.paths == ["paths_value"] -@pytest.mark.asyncio -async def test_get_external_api_async_from_dict(): - await test_get_external_api_async(request_type=dict) - - def test_get_external_api_field_headers(): client = ApiHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14615,8 +14667,8 @@ async def test_get_external_api_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - apihub_service.UpdateExternalApiRequest, - dict, + apihub_service.UpdateExternalApiRequest(), + {}, ], ) def test_update_external_api(request_type, transport: str = "grpc"): @@ -14627,7 +14679,7 @@ def test_update_external_api(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -14681,7 +14733,8 @@ def test_update_external_api_non_empty_request_with_auto_populated_field(): client.update_external_api(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apihub_service.UpdateExternalApiRequest() + request_msg = apihub_service.UpdateExternalApiRequest() + assert args[0] == request_msg def test_update_external_api_use_cached_wrapped_rpc(): @@ -14766,10 +14819,14 @@ async def test_update_external_api_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_external_api_async( - transport: str = "grpc_asyncio", - request_type=apihub_service.UpdateExternalApiRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + apihub_service.UpdateExternalApiRequest(), + {}, + ], +) +async def test_update_external_api_async(request_type, transport: str = "grpc_asyncio"): client = ApiHubAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14777,7 +14834,7 @@ async def test_update_external_api_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( @@ -14810,11 +14867,6 @@ async def test_update_external_api_async( assert response.paths == ["paths_value"] -@pytest.mark.asyncio -async def test_update_external_api_async_from_dict(): - await test_update_external_api_async(request_type=dict) - - def test_update_external_api_field_headers(): client = ApiHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14979,8 +15031,8 @@ async def test_update_external_api_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - apihub_service.DeleteExternalApiRequest, - dict, + apihub_service.DeleteExternalApiRequest(), + {}, ], ) def test_delete_external_api(request_type, transport: str = "grpc"): @@ -14991,7 +15043,7 @@ def test_delete_external_api(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -15036,9 +15088,10 @@ def test_delete_external_api_non_empty_request_with_auto_populated_field(): client.delete_external_api(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apihub_service.DeleteExternalApiRequest( + request_msg = apihub_service.DeleteExternalApiRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_external_api_use_cached_wrapped_rpc(): @@ -15123,10 +15176,14 @@ async def test_delete_external_api_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_external_api_async( - transport: str = "grpc_asyncio", - request_type=apihub_service.DeleteExternalApiRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + apihub_service.DeleteExternalApiRequest(), + {}, + ], +) +async def test_delete_external_api_async(request_type, transport: str = "grpc_asyncio"): client = ApiHubAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -15134,7 +15191,7 @@ async def test_delete_external_api_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( @@ -15154,11 +15211,6 @@ async def test_delete_external_api_async( assert response is None -@pytest.mark.asyncio -async def test_delete_external_api_async_from_dict(): - await test_delete_external_api_async(request_type=dict) - - def test_delete_external_api_field_headers(): client = ApiHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15309,8 +15361,8 @@ async def test_delete_external_api_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - apihub_service.ListExternalApisRequest, - dict, + apihub_service.ListExternalApisRequest(), + {}, ], ) def test_list_external_apis(request_type, transport: str = "grpc"): @@ -15321,7 +15373,7 @@ def test_list_external_apis(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -15370,10 +15422,11 @@ def test_list_external_apis_non_empty_request_with_auto_populated_field(): client.list_external_apis(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apihub_service.ListExternalApisRequest( + request_msg = apihub_service.ListExternalApisRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_external_apis_use_cached_wrapped_rpc(): @@ -15458,9 +15511,14 @@ async def test_list_external_apis_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_external_apis_async( - transport: str = "grpc_asyncio", request_type=apihub_service.ListExternalApisRequest -): +@pytest.mark.parametrize( + "request_type", + [ + apihub_service.ListExternalApisRequest(), + {}, + ], +) +async def test_list_external_apis_async(request_type, transport: str = "grpc_asyncio"): client = ApiHubAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -15468,7 +15526,7 @@ async def test_list_external_apis_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( @@ -15493,11 +15551,6 @@ async def test_list_external_apis_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_external_apis_async_from_dict(): - await test_list_external_apis_async(request_type=dict) - - def test_list_external_apis_field_headers(): client = ApiHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -23593,7 +23646,6 @@ def test_create_api_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.CreateApiRequest() - assert args[0] == request_msg @@ -23614,7 +23666,6 @@ def test_get_api_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.GetApiRequest() - assert args[0] == request_msg @@ -23635,7 +23686,6 @@ def test_list_apis_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.ListApisRequest() - assert args[0] == request_msg @@ -23656,7 +23706,6 @@ def test_update_api_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.UpdateApiRequest() - assert args[0] == request_msg @@ -23677,7 +23726,6 @@ def test_delete_api_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.DeleteApiRequest() - assert args[0] == request_msg @@ -23698,7 +23746,6 @@ def test_create_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.CreateVersionRequest() - assert args[0] == request_msg @@ -23719,7 +23766,6 @@ def test_get_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.GetVersionRequest() - assert args[0] == request_msg @@ -23740,7 +23786,6 @@ def test_list_versions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.ListVersionsRequest() - assert args[0] == request_msg @@ -23761,7 +23806,6 @@ def test_update_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.UpdateVersionRequest() - assert args[0] == request_msg @@ -23782,7 +23826,6 @@ def test_delete_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.DeleteVersionRequest() - assert args[0] == request_msg @@ -23803,7 +23846,6 @@ def test_create_spec_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.CreateSpecRequest() - assert args[0] == request_msg @@ -23824,7 +23866,6 @@ def test_get_spec_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.GetSpecRequest() - assert args[0] == request_msg @@ -23847,7 +23888,6 @@ def test_get_spec_contents_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.GetSpecContentsRequest() - assert args[0] == request_msg @@ -23868,7 +23908,6 @@ def test_list_specs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.ListSpecsRequest() - assert args[0] == request_msg @@ -23889,7 +23928,6 @@ def test_update_spec_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.UpdateSpecRequest() - assert args[0] == request_msg @@ -23910,7 +23948,6 @@ def test_delete_spec_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.DeleteSpecRequest() - assert args[0] == request_msg @@ -23933,7 +23970,6 @@ def test_create_api_operation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.CreateApiOperationRequest() - assert args[0] == request_msg @@ -23956,7 +23992,6 @@ def test_get_api_operation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.GetApiOperationRequest() - assert args[0] == request_msg @@ -23979,7 +24014,6 @@ def test_list_api_operations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.ListApiOperationsRequest() - assert args[0] == request_msg @@ -24002,7 +24036,6 @@ def test_update_api_operation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.UpdateApiOperationRequest() - assert args[0] == request_msg @@ -24025,7 +24058,6 @@ def test_delete_api_operation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.DeleteApiOperationRequest() - assert args[0] == request_msg @@ -24046,7 +24078,6 @@ def test_get_definition_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.GetDefinitionRequest() - assert args[0] == request_msg @@ -24069,7 +24100,6 @@ def test_create_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.CreateDeploymentRequest() - assert args[0] == request_msg @@ -24090,7 +24120,6 @@ def test_get_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.GetDeploymentRequest() - assert args[0] == request_msg @@ -24111,7 +24140,6 @@ def test_list_deployments_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.ListDeploymentsRequest() - assert args[0] == request_msg @@ -24134,7 +24162,6 @@ def test_update_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.UpdateDeploymentRequest() - assert args[0] == request_msg @@ -24157,7 +24184,6 @@ def test_delete_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.DeleteDeploymentRequest() - assert args[0] == request_msg @@ -24178,7 +24204,6 @@ def test_create_attribute_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.CreateAttributeRequest() - assert args[0] == request_msg @@ -24199,7 +24224,6 @@ def test_get_attribute_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.GetAttributeRequest() - assert args[0] == request_msg @@ -24220,7 +24244,6 @@ def test_update_attribute_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.UpdateAttributeRequest() - assert args[0] == request_msg @@ -24241,7 +24264,6 @@ def test_delete_attribute_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.DeleteAttributeRequest() - assert args[0] == request_msg @@ -24262,7 +24284,6 @@ def test_list_attributes_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.ListAttributesRequest() - assert args[0] == request_msg @@ -24283,7 +24304,6 @@ def test_search_resources_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.SearchResourcesRequest() - assert args[0] == request_msg @@ -24306,7 +24326,6 @@ def test_create_external_api_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.CreateExternalApiRequest() - assert args[0] == request_msg @@ -24327,7 +24346,6 @@ def test_get_external_api_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.GetExternalApiRequest() - assert args[0] == request_msg @@ -24350,7 +24368,6 @@ def test_update_external_api_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.UpdateExternalApiRequest() - assert args[0] == request_msg @@ -24373,7 +24390,6 @@ def test_delete_external_api_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.DeleteExternalApiRequest() - assert args[0] == request_msg @@ -24396,7 +24412,6 @@ def test_list_external_apis_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.ListExternalApisRequest() - assert args[0] == request_msg @@ -24442,7 +24457,6 @@ async def test_create_api_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.CreateApiRequest() - assert args[0] == request_msg @@ -24474,7 +24488,6 @@ async def test_get_api_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.GetApiRequest() - assert args[0] == request_msg @@ -24501,7 +24514,6 @@ async def test_list_apis_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.ListApisRequest() - assert args[0] == request_msg @@ -24533,7 +24545,6 @@ async def test_update_api_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.UpdateApiRequest() - assert args[0] == request_msg @@ -24556,7 +24567,6 @@ async def test_delete_api_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.DeleteApiRequest() - assert args[0] == request_msg @@ -24590,7 +24600,6 @@ async def test_create_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.CreateVersionRequest() - assert args[0] == request_msg @@ -24624,7 +24633,6 @@ async def test_get_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.GetVersionRequest() - assert args[0] == request_msg @@ -24651,7 +24659,6 @@ async def test_list_versions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.ListVersionsRequest() - assert args[0] == request_msg @@ -24685,7 +24692,6 @@ async def test_update_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.UpdateVersionRequest() - assert args[0] == request_msg @@ -24708,7 +24714,6 @@ async def test_delete_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.DeleteVersionRequest() - assert args[0] == request_msg @@ -24738,7 +24743,6 @@ async def test_create_spec_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.CreateSpecRequest() - assert args[0] == request_msg @@ -24768,7 +24772,6 @@ async def test_get_spec_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.GetSpecRequest() - assert args[0] == request_msg @@ -24798,7 +24801,6 @@ async def test_get_spec_contents_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.GetSpecContentsRequest() - assert args[0] == request_msg @@ -24825,7 +24827,6 @@ async def test_list_specs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.ListSpecsRequest() - assert args[0] == request_msg @@ -24855,7 +24856,6 @@ async def test_update_spec_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.UpdateSpecRequest() - assert args[0] == request_msg @@ -24878,7 +24878,6 @@ async def test_delete_spec_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.DeleteSpecRequest() - assert args[0] == request_msg @@ -24908,7 +24907,6 @@ async def test_create_api_operation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.CreateApiOperationRequest() - assert args[0] == request_msg @@ -24938,7 +24936,6 @@ async def test_get_api_operation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.GetApiOperationRequest() - assert args[0] == request_msg @@ -24967,7 +24964,6 @@ async def test_list_api_operations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.ListApiOperationsRequest() - assert args[0] == request_msg @@ -24997,7 +24993,6 @@ async def test_update_api_operation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.UpdateApiOperationRequest() - assert args[0] == request_msg @@ -25022,7 +25017,6 @@ async def test_delete_api_operation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.DeleteApiOperationRequest() - assert args[0] == request_msg @@ -25051,7 +25045,6 @@ async def test_get_definition_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.GetDefinitionRequest() - assert args[0] == request_msg @@ -25087,7 +25080,6 @@ async def test_create_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.CreateDeploymentRequest() - assert args[0] == request_msg @@ -25121,7 +25113,6 @@ async def test_get_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.GetDeploymentRequest() - assert args[0] == request_msg @@ -25148,7 +25139,6 @@ async def test_list_deployments_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.ListDeploymentsRequest() - assert args[0] == request_msg @@ -25184,7 +25174,6 @@ async def test_update_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.UpdateDeploymentRequest() - assert args[0] == request_msg @@ -25209,7 +25198,6 @@ async def test_delete_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.DeleteDeploymentRequest() - assert args[0] == request_msg @@ -25243,7 +25231,6 @@ async def test_create_attribute_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.CreateAttributeRequest() - assert args[0] == request_msg @@ -25277,7 +25264,6 @@ async def test_get_attribute_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.GetAttributeRequest() - assert args[0] == request_msg @@ -25311,7 +25297,6 @@ async def test_update_attribute_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.UpdateAttributeRequest() - assert args[0] == request_msg @@ -25334,7 +25319,6 @@ async def test_delete_attribute_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.DeleteAttributeRequest() - assert args[0] == request_msg @@ -25361,7 +25345,6 @@ async def test_list_attributes_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.ListAttributesRequest() - assert args[0] == request_msg @@ -25388,7 +25371,6 @@ async def test_search_resources_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.SearchResourcesRequest() - assert args[0] == request_msg @@ -25421,7 +25403,6 @@ async def test_create_external_api_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.CreateExternalApiRequest() - assert args[0] == request_msg @@ -25452,7 +25433,6 @@ async def test_get_external_api_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.GetExternalApiRequest() - assert args[0] == request_msg @@ -25485,7 +25465,6 @@ async def test_update_external_api_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.UpdateExternalApiRequest() - assert args[0] == request_msg @@ -25510,7 +25489,6 @@ async def test_delete_external_api_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.DeleteExternalApiRequest() - assert args[0] == request_msg @@ -25539,7 +25517,6 @@ async def test_list_external_apis_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.ListExternalApisRequest() - assert args[0] == request_msg @@ -32398,7 +32375,6 @@ def test_create_api_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.CreateApiRequest() - assert args[0] == request_msg @@ -32418,7 +32394,6 @@ def test_get_api_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.GetApiRequest() - assert args[0] == request_msg @@ -32438,7 +32413,6 @@ def test_list_apis_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.ListApisRequest() - assert args[0] == request_msg @@ -32458,7 +32432,6 @@ def test_update_api_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.UpdateApiRequest() - assert args[0] == request_msg @@ -32478,7 +32451,6 @@ def test_delete_api_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.DeleteApiRequest() - assert args[0] == request_msg @@ -32498,7 +32470,6 @@ def test_create_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.CreateVersionRequest() - assert args[0] == request_msg @@ -32518,7 +32489,6 @@ def test_get_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.GetVersionRequest() - assert args[0] == request_msg @@ -32538,7 +32508,6 @@ def test_list_versions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.ListVersionsRequest() - assert args[0] == request_msg @@ -32558,7 +32527,6 @@ def test_update_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.UpdateVersionRequest() - assert args[0] == request_msg @@ -32578,7 +32546,6 @@ def test_delete_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.DeleteVersionRequest() - assert args[0] == request_msg @@ -32598,7 +32565,6 @@ def test_create_spec_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.CreateSpecRequest() - assert args[0] == request_msg @@ -32618,7 +32584,6 @@ def test_get_spec_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.GetSpecRequest() - assert args[0] == request_msg @@ -32640,7 +32605,6 @@ def test_get_spec_contents_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.GetSpecContentsRequest() - assert args[0] == request_msg @@ -32660,7 +32624,6 @@ def test_list_specs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.ListSpecsRequest() - assert args[0] == request_msg @@ -32680,7 +32643,6 @@ def test_update_spec_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.UpdateSpecRequest() - assert args[0] == request_msg @@ -32700,7 +32662,6 @@ def test_delete_spec_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.DeleteSpecRequest() - assert args[0] == request_msg @@ -32722,7 +32683,6 @@ def test_create_api_operation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.CreateApiOperationRequest() - assert args[0] == request_msg @@ -32744,7 +32704,6 @@ def test_get_api_operation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.GetApiOperationRequest() - assert args[0] == request_msg @@ -32766,7 +32725,6 @@ def test_list_api_operations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.ListApiOperationsRequest() - assert args[0] == request_msg @@ -32788,7 +32746,6 @@ def test_update_api_operation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.UpdateApiOperationRequest() - assert args[0] == request_msg @@ -32810,7 +32767,6 @@ def test_delete_api_operation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.DeleteApiOperationRequest() - assert args[0] == request_msg @@ -32830,7 +32786,6 @@ def test_get_definition_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.GetDefinitionRequest() - assert args[0] == request_msg @@ -32852,7 +32807,6 @@ def test_create_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.CreateDeploymentRequest() - assert args[0] == request_msg @@ -32872,7 +32826,6 @@ def test_get_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.GetDeploymentRequest() - assert args[0] == request_msg @@ -32892,7 +32845,6 @@ def test_list_deployments_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.ListDeploymentsRequest() - assert args[0] == request_msg @@ -32914,7 +32866,6 @@ def test_update_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.UpdateDeploymentRequest() - assert args[0] == request_msg @@ -32936,7 +32887,6 @@ def test_delete_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.DeleteDeploymentRequest() - assert args[0] == request_msg @@ -32956,7 +32906,6 @@ def test_create_attribute_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.CreateAttributeRequest() - assert args[0] == request_msg @@ -32976,7 +32925,6 @@ def test_get_attribute_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.GetAttributeRequest() - assert args[0] == request_msg @@ -32996,7 +32944,6 @@ def test_update_attribute_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.UpdateAttributeRequest() - assert args[0] == request_msg @@ -33016,7 +32963,6 @@ def test_delete_attribute_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.DeleteAttributeRequest() - assert args[0] == request_msg @@ -33036,7 +32982,6 @@ def test_list_attributes_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.ListAttributesRequest() - assert args[0] == request_msg @@ -33056,7 +33001,6 @@ def test_search_resources_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.SearchResourcesRequest() - assert args[0] == request_msg @@ -33078,7 +33022,6 @@ def test_create_external_api_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.CreateExternalApiRequest() - assert args[0] == request_msg @@ -33098,7 +33041,6 @@ def test_get_external_api_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.GetExternalApiRequest() - assert args[0] == request_msg @@ -33120,7 +33062,6 @@ def test_update_external_api_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.UpdateExternalApiRequest() - assert args[0] == request_msg @@ -33142,7 +33083,6 @@ def test_delete_external_api_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.DeleteExternalApiRequest() - assert args[0] == request_msg @@ -33164,7 +33104,6 @@ def test_list_external_apis_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.ListExternalApisRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-apihub/tests/unit/gapic/apihub_v1/test_api_hub_collect.py b/packages/google-cloud-apihub/tests/unit/gapic/apihub_v1/test_api_hub_collect.py index 3bf7bdcec8a9..ab5b09c357ef 100644 --- a/packages/google-cloud-apihub/tests/unit/gapic/apihub_v1/test_api_hub_collect.py +++ b/packages/google-cloud-apihub/tests/unit/gapic/apihub_v1/test_api_hub_collect.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 @@ -113,6 +114,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" @@ -1312,8 +1328,8 @@ def test_api_hub_collect_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - collect_service.CollectApiDataRequest, - dict, + collect_service.CollectApiDataRequest(), + {}, ], ) def test_collect_api_data(request_type, transport: str = "grpc"): @@ -1324,7 +1340,7 @@ def test_collect_api_data(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.collect_api_data), "__call__") as call: @@ -1367,11 +1383,12 @@ def test_collect_api_data_non_empty_request_with_auto_populated_field(): client.collect_api_data(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == collect_service.CollectApiDataRequest( + request_msg = collect_service.CollectApiDataRequest( location="location_value", plugin_instance="plugin_instance_value", action_id="action_id_value", ) + assert args[0] == request_msg def test_collect_api_data_use_cached_wrapped_rpc(): @@ -1464,9 +1481,14 @@ async def test_collect_api_data_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_collect_api_data_async( - transport: str = "grpc_asyncio", request_type=collect_service.CollectApiDataRequest -): +@pytest.mark.parametrize( + "request_type", + [ + collect_service.CollectApiDataRequest(), + {}, + ], +) +async def test_collect_api_data_async(request_type, transport: str = "grpc_asyncio"): client = ApiHubCollectAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1474,7 +1496,7 @@ async def test_collect_api_data_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.collect_api_data), "__call__") as call: @@ -1494,11 +1516,6 @@ async def test_collect_api_data_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_collect_api_data_async_from_dict(): - await test_collect_api_data_async(request_type=dict) - - def test_collect_api_data_field_headers(): client = ApiHubCollectClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2052,7 +2069,6 @@ def test_collect_api_data_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = collect_service.CollectApiDataRequest() - assert args[0] == request_msg @@ -2091,7 +2107,6 @@ async def test_collect_api_data_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = collect_service.CollectApiDataRequest() - assert args[0] == request_msg @@ -2625,7 +2640,6 @@ def test_collect_api_data_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = collect_service.CollectApiDataRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-apihub/tests/unit/gapic/apihub_v1/test_api_hub_curate.py b/packages/google-cloud-apihub/tests/unit/gapic/apihub_v1/test_api_hub_curate.py index befebafd8e6b..a2d75330cf45 100644 --- a/packages/google-cloud-apihub/tests/unit/gapic/apihub_v1/test_api_hub_curate.py +++ b/packages/google-cloud-apihub/tests/unit/gapic/apihub_v1/test_api_hub_curate.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" @@ -1291,8 +1307,8 @@ def test_api_hub_curate_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - curate_service.CreateCurationRequest, - dict, + curate_service.CreateCurationRequest(), + {}, ], ) def test_create_curation(request_type, transport: str = "grpc"): @@ -1303,7 +1319,7 @@ def test_create_curation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_curation), "__call__") as call: @@ -1364,10 +1380,11 @@ def test_create_curation_non_empty_request_with_auto_populated_field(): client.create_curation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == curate_service.CreateCurationRequest( + request_msg = curate_service.CreateCurationRequest( parent="parent_value", curation_id="curation_id_value", ) + assert args[0] == request_msg def test_create_curation_use_cached_wrapped_rpc(): @@ -1448,9 +1465,14 @@ async def test_create_curation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_curation_async( - transport: str = "grpc_asyncio", request_type=curate_service.CreateCurationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + curate_service.CreateCurationRequest(), + {}, + ], +) +async def test_create_curation_async(request_type, transport: str = "grpc_asyncio"): client = ApiHubCurateAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1458,7 +1480,7 @@ async def test_create_curation_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_curation), "__call__") as call: @@ -1497,11 +1519,6 @@ async def test_create_curation_async( assert response.last_execution_error_message == "last_execution_error_message_value" -@pytest.mark.asyncio -async def test_create_curation_async_from_dict(): - await test_create_curation_async(request_type=dict) - - def test_create_curation_field_headers(): client = ApiHubCurateClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1668,8 +1685,8 @@ async def test_create_curation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - curate_service.GetCurationRequest, - dict, + curate_service.GetCurationRequest(), + {}, ], ) def test_get_curation(request_type, transport: str = "grpc"): @@ -1680,7 +1697,7 @@ def test_get_curation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_curation), "__call__") as call: @@ -1740,9 +1757,10 @@ def test_get_curation_non_empty_request_with_auto_populated_field(): client.get_curation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == curate_service.GetCurationRequest( + request_msg = curate_service.GetCurationRequest( name="name_value", ) + assert args[0] == request_msg def test_get_curation_use_cached_wrapped_rpc(): @@ -1823,9 +1841,14 @@ async def test_get_curation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_curation_async( - transport: str = "grpc_asyncio", request_type=curate_service.GetCurationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + curate_service.GetCurationRequest(), + {}, + ], +) +async def test_get_curation_async(request_type, transport: str = "grpc_asyncio"): client = ApiHubCurateAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1833,7 +1856,7 @@ async def test_get_curation_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_curation), "__call__") as call: @@ -1872,11 +1895,6 @@ async def test_get_curation_async( assert response.last_execution_error_message == "last_execution_error_message_value" -@pytest.mark.asyncio -async def test_get_curation_async_from_dict(): - await test_get_curation_async(request_type=dict) - - def test_get_curation_field_headers(): client = ApiHubCurateClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2023,8 +2041,8 @@ async def test_get_curation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - curate_service.ListCurationsRequest, - dict, + curate_service.ListCurationsRequest(), + {}, ], ) def test_list_curations(request_type, transport: str = "grpc"): @@ -2035,7 +2053,7 @@ def test_list_curations(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_curations), "__call__") as call: @@ -2081,11 +2099,12 @@ def test_list_curations_non_empty_request_with_auto_populated_field(): client.list_curations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == curate_service.ListCurationsRequest( + request_msg = curate_service.ListCurationsRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_curations_use_cached_wrapped_rpc(): @@ -2166,9 +2185,14 @@ async def test_list_curations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_curations_async( - transport: str = "grpc_asyncio", request_type=curate_service.ListCurationsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + curate_service.ListCurationsRequest(), + {}, + ], +) +async def test_list_curations_async(request_type, transport: str = "grpc_asyncio"): client = ApiHubCurateAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2176,7 +2200,7 @@ async def test_list_curations_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_curations), "__call__") as call: @@ -2199,11 +2223,6 @@ async def test_list_curations_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_curations_async_from_dict(): - await test_list_curations_async(request_type=dict) - - def test_list_curations_field_headers(): client = ApiHubCurateClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2540,8 +2559,8 @@ async def test_list_curations_async_pages(): @pytest.mark.parametrize( "request_type", [ - curate_service.UpdateCurationRequest, - dict, + curate_service.UpdateCurationRequest(), + {}, ], ) def test_update_curation(request_type, transport: str = "grpc"): @@ -2552,7 +2571,7 @@ def test_update_curation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_curation), "__call__") as call: @@ -2610,7 +2629,8 @@ def test_update_curation_non_empty_request_with_auto_populated_field(): client.update_curation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == curate_service.UpdateCurationRequest() + request_msg = curate_service.UpdateCurationRequest() + assert args[0] == request_msg def test_update_curation_use_cached_wrapped_rpc(): @@ -2691,9 +2711,14 @@ async def test_update_curation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_curation_async( - transport: str = "grpc_asyncio", request_type=curate_service.UpdateCurationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + curate_service.UpdateCurationRequest(), + {}, + ], +) +async def test_update_curation_async(request_type, transport: str = "grpc_asyncio"): client = ApiHubCurateAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2701,7 +2726,7 @@ async def test_update_curation_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_curation), "__call__") as call: @@ -2740,11 +2765,6 @@ async def test_update_curation_async( assert response.last_execution_error_message == "last_execution_error_message_value" -@pytest.mark.asyncio -async def test_update_curation_async_from_dict(): - await test_update_curation_async(request_type=dict) - - def test_update_curation_field_headers(): client = ApiHubCurateClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2901,8 +2921,8 @@ async def test_update_curation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - curate_service.DeleteCurationRequest, - dict, + curate_service.DeleteCurationRequest(), + {}, ], ) def test_delete_curation(request_type, transport: str = "grpc"): @@ -2913,7 +2933,7 @@ def test_delete_curation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_curation), "__call__") as call: @@ -2954,9 +2974,10 @@ def test_delete_curation_non_empty_request_with_auto_populated_field(): client.delete_curation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == curate_service.DeleteCurationRequest( + request_msg = curate_service.DeleteCurationRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_curation_use_cached_wrapped_rpc(): @@ -3037,9 +3058,14 @@ async def test_delete_curation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_curation_async( - transport: str = "grpc_asyncio", request_type=curate_service.DeleteCurationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + curate_service.DeleteCurationRequest(), + {}, + ], +) +async def test_delete_curation_async(request_type, transport: str = "grpc_asyncio"): client = ApiHubCurateAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3047,7 +3073,7 @@ async def test_delete_curation_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_curation), "__call__") as call: @@ -3065,11 +3091,6 @@ async def test_delete_curation_async( assert response is None -@pytest.mark.asyncio -async def test_delete_curation_async_from_dict(): - await test_delete_curation_async(request_type=dict) - - def test_delete_curation_field_headers(): client = ApiHubCurateClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4314,7 +4335,6 @@ def test_create_curation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = curate_service.CreateCurationRequest() - assert args[0] == request_msg @@ -4335,7 +4355,6 @@ def test_get_curation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = curate_service.GetCurationRequest() - assert args[0] == request_msg @@ -4356,7 +4375,6 @@ def test_list_curations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = curate_service.ListCurationsRequest() - assert args[0] == request_msg @@ -4377,7 +4395,6 @@ def test_update_curation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = curate_service.UpdateCurationRequest() - assert args[0] == request_msg @@ -4398,7 +4415,6 @@ def test_delete_curation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = curate_service.DeleteCurationRequest() - assert args[0] == request_msg @@ -4444,7 +4460,6 @@ async def test_create_curation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = curate_service.CreateCurationRequest() - assert args[0] == request_msg @@ -4476,7 +4491,6 @@ async def test_get_curation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = curate_service.GetCurationRequest() - assert args[0] == request_msg @@ -4503,7 +4517,6 @@ async def test_list_curations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = curate_service.ListCurationsRequest() - assert args[0] == request_msg @@ -4535,7 +4548,6 @@ async def test_update_curation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = curate_service.UpdateCurationRequest() - assert args[0] == request_msg @@ -4558,7 +4570,6 @@ async def test_delete_curation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = curate_service.DeleteCurationRequest() - assert args[0] == request_msg @@ -5823,7 +5834,6 @@ def test_create_curation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = curate_service.CreateCurationRequest() - assert args[0] == request_msg @@ -5843,7 +5853,6 @@ def test_get_curation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = curate_service.GetCurationRequest() - assert args[0] == request_msg @@ -5863,7 +5872,6 @@ def test_list_curations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = curate_service.ListCurationsRequest() - assert args[0] == request_msg @@ -5883,7 +5891,6 @@ def test_update_curation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = curate_service.UpdateCurationRequest() - assert args[0] == request_msg @@ -5903,7 +5910,6 @@ def test_delete_curation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = curate_service.DeleteCurationRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-apihub/tests/unit/gapic/apihub_v1/test_api_hub_dependencies.py b/packages/google-cloud-apihub/tests/unit/gapic/apihub_v1/test_api_hub_dependencies.py index 79aa33e4107d..e7485e221377 100644 --- a/packages/google-cloud-apihub/tests/unit/gapic/apihub_v1/test_api_hub_dependencies.py +++ b/packages/google-cloud-apihub/tests/unit/gapic/apihub_v1/test_api_hub_dependencies.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" @@ -1356,8 +1372,8 @@ def test_api_hub_dependencies_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - apihub_service.CreateDependencyRequest, - dict, + apihub_service.CreateDependencyRequest(), + {}, ], ) def test_create_dependency(request_type, transport: str = "grpc"): @@ -1368,7 +1384,7 @@ def test_create_dependency(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1423,10 +1439,11 @@ def test_create_dependency_non_empty_request_with_auto_populated_field(): client.create_dependency(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apihub_service.CreateDependencyRequest( + request_msg = apihub_service.CreateDependencyRequest( parent="parent_value", dependency_id="dependency_id_value", ) + assert args[0] == request_msg def test_create_dependency_use_cached_wrapped_rpc(): @@ -1509,9 +1526,14 @@ async def test_create_dependency_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_dependency_async( - transport: str = "grpc_asyncio", request_type=apihub_service.CreateDependencyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + apihub_service.CreateDependencyRequest(), + {}, + ], +) +async def test_create_dependency_async(request_type, transport: str = "grpc_asyncio"): client = ApiHubDependenciesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1519,7 +1541,7 @@ async def test_create_dependency_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( @@ -1550,11 +1572,6 @@ async def test_create_dependency_async( assert response.discovery_mode == common_fields.Dependency.DiscoveryMode.MANUAL -@pytest.mark.asyncio -async def test_create_dependency_async_from_dict(): - await test_create_dependency_async(request_type=dict) - - def test_create_dependency_field_headers(): client = ApiHubDependenciesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1729,8 +1746,8 @@ async def test_create_dependency_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - apihub_service.GetDependencyRequest, - dict, + apihub_service.GetDependencyRequest(), + {}, ], ) def test_get_dependency(request_type, transport: str = "grpc"): @@ -1741,7 +1758,7 @@ def test_get_dependency(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_dependency), "__call__") as call: @@ -1791,9 +1808,10 @@ def test_get_dependency_non_empty_request_with_auto_populated_field(): client.get_dependency(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apihub_service.GetDependencyRequest( + request_msg = apihub_service.GetDependencyRequest( name="name_value", ) + assert args[0] == request_msg def test_get_dependency_use_cached_wrapped_rpc(): @@ -1874,9 +1892,14 @@ async def test_get_dependency_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_dependency_async( - transport: str = "grpc_asyncio", request_type=apihub_service.GetDependencyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + apihub_service.GetDependencyRequest(), + {}, + ], +) +async def test_get_dependency_async(request_type, transport: str = "grpc_asyncio"): client = ApiHubDependenciesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1884,7 +1907,7 @@ async def test_get_dependency_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_dependency), "__call__") as call: @@ -1913,11 +1936,6 @@ async def test_get_dependency_async( assert response.discovery_mode == common_fields.Dependency.DiscoveryMode.MANUAL -@pytest.mark.asyncio -async def test_get_dependency_async_from_dict(): - await test_get_dependency_async(request_type=dict) - - def test_get_dependency_field_headers(): client = ApiHubDependenciesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2064,8 +2082,8 @@ async def test_get_dependency_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - apihub_service.UpdateDependencyRequest, - dict, + apihub_service.UpdateDependencyRequest(), + {}, ], ) def test_update_dependency(request_type, transport: str = "grpc"): @@ -2076,7 +2094,7 @@ def test_update_dependency(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2128,7 +2146,8 @@ def test_update_dependency_non_empty_request_with_auto_populated_field(): client.update_dependency(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apihub_service.UpdateDependencyRequest() + request_msg = apihub_service.UpdateDependencyRequest() + assert args[0] == request_msg def test_update_dependency_use_cached_wrapped_rpc(): @@ -2211,9 +2230,14 @@ async def test_update_dependency_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_dependency_async( - transport: str = "grpc_asyncio", request_type=apihub_service.UpdateDependencyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + apihub_service.UpdateDependencyRequest(), + {}, + ], +) +async def test_update_dependency_async(request_type, transport: str = "grpc_asyncio"): client = ApiHubDependenciesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2221,7 +2245,7 @@ async def test_update_dependency_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( @@ -2252,11 +2276,6 @@ async def test_update_dependency_async( assert response.discovery_mode == common_fields.Dependency.DiscoveryMode.MANUAL -@pytest.mark.asyncio -async def test_update_dependency_async_from_dict(): - await test_update_dependency_async(request_type=dict) - - def test_update_dependency_field_headers(): client = ApiHubDependenciesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2421,8 +2440,8 @@ async def test_update_dependency_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - apihub_service.DeleteDependencyRequest, - dict, + apihub_service.DeleteDependencyRequest(), + {}, ], ) def test_delete_dependency(request_type, transport: str = "grpc"): @@ -2433,7 +2452,7 @@ def test_delete_dependency(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2478,9 +2497,10 @@ def test_delete_dependency_non_empty_request_with_auto_populated_field(): client.delete_dependency(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apihub_service.DeleteDependencyRequest( + request_msg = apihub_service.DeleteDependencyRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_dependency_use_cached_wrapped_rpc(): @@ -2563,9 +2583,14 @@ async def test_delete_dependency_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_dependency_async( - transport: str = "grpc_asyncio", request_type=apihub_service.DeleteDependencyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + apihub_service.DeleteDependencyRequest(), + {}, + ], +) +async def test_delete_dependency_async(request_type, transport: str = "grpc_asyncio"): client = ApiHubDependenciesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2573,7 +2598,7 @@ async def test_delete_dependency_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( @@ -2593,11 +2618,6 @@ async def test_delete_dependency_async( assert response is None -@pytest.mark.asyncio -async def test_delete_dependency_async_from_dict(): - await test_delete_dependency_async(request_type=dict) - - def test_delete_dependency_field_headers(): client = ApiHubDependenciesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2748,8 +2768,8 @@ async def test_delete_dependency_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - apihub_service.ListDependenciesRequest, - dict, + apihub_service.ListDependenciesRequest(), + {}, ], ) def test_list_dependencies(request_type, transport: str = "grpc"): @@ -2760,7 +2780,7 @@ def test_list_dependencies(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2810,11 +2830,12 @@ def test_list_dependencies_non_empty_request_with_auto_populated_field(): client.list_dependencies(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apihub_service.ListDependenciesRequest( + request_msg = apihub_service.ListDependenciesRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_dependencies_use_cached_wrapped_rpc(): @@ -2897,9 +2918,14 @@ async def test_list_dependencies_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_dependencies_async( - transport: str = "grpc_asyncio", request_type=apihub_service.ListDependenciesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + apihub_service.ListDependenciesRequest(), + {}, + ], +) +async def test_list_dependencies_async(request_type, transport: str = "grpc_asyncio"): client = ApiHubDependenciesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2907,7 +2933,7 @@ async def test_list_dependencies_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( @@ -2932,11 +2958,6 @@ async def test_list_dependencies_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_dependencies_async_from_dict(): - await test_list_dependencies_async(request_type=dict) - - def test_list_dependencies_field_headers(): client = ApiHubDependenciesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4415,7 +4436,6 @@ def test_create_dependency_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.CreateDependencyRequest() - assert args[0] == request_msg @@ -4436,7 +4456,6 @@ def test_get_dependency_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.GetDependencyRequest() - assert args[0] == request_msg @@ -4459,7 +4478,6 @@ def test_update_dependency_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.UpdateDependencyRequest() - assert args[0] == request_msg @@ -4482,7 +4500,6 @@ def test_delete_dependency_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.DeleteDependencyRequest() - assert args[0] == request_msg @@ -4505,7 +4522,6 @@ def test_list_dependencies_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.ListDependenciesRequest() - assert args[0] == request_msg @@ -4551,7 +4567,6 @@ async def test_create_dependency_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.CreateDependencyRequest() - assert args[0] == request_msg @@ -4581,7 +4596,6 @@ async def test_get_dependency_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.GetDependencyRequest() - assert args[0] == request_msg @@ -4613,7 +4627,6 @@ async def test_update_dependency_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.UpdateDependencyRequest() - assert args[0] == request_msg @@ -4638,7 +4651,6 @@ async def test_delete_dependency_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.DeleteDependencyRequest() - assert args[0] == request_msg @@ -4667,7 +4679,6 @@ async def test_list_dependencies_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.ListDependenciesRequest() - assert args[0] == request_msg @@ -5908,7 +5919,6 @@ def test_create_dependency_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.CreateDependencyRequest() - assert args[0] == request_msg @@ -5928,7 +5938,6 @@ def test_get_dependency_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.GetDependencyRequest() - assert args[0] == request_msg @@ -5950,7 +5959,6 @@ def test_update_dependency_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.UpdateDependencyRequest() - assert args[0] == request_msg @@ -5972,7 +5980,6 @@ def test_delete_dependency_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.DeleteDependencyRequest() - assert args[0] == request_msg @@ -5994,7 +6001,6 @@ def test_list_dependencies_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apihub_service.ListDependenciesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-apihub/tests/unit/gapic/apihub_v1/test_api_hub_discovery.py b/packages/google-cloud-apihub/tests/unit/gapic/apihub_v1/test_api_hub_discovery.py index b34e1277e209..fcb71321ebd5 100644 --- a/packages/google-cloud-apihub/tests/unit/gapic/apihub_v1/test_api_hub_discovery.py +++ b/packages/google-cloud-apihub/tests/unit/gapic/apihub_v1/test_api_hub_discovery.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 @@ -110,6 +111,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" @@ -1337,8 +1353,8 @@ def test_api_hub_discovery_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - discovery_service.ListDiscoveredApiObservationsRequest, - dict, + discovery_service.ListDiscoveredApiObservationsRequest(), + {}, ], ) def test_list_discovered_api_observations(request_type, transport: str = "grpc"): @@ -1349,7 +1365,7 @@ def test_list_discovered_api_observations(request_type, transport: str = "grpc") # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1398,10 +1414,11 @@ def test_list_discovered_api_observations_non_empty_request_with_auto_populated_ client.list_discovered_api_observations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == discovery_service.ListDiscoveredApiObservationsRequest( + request_msg = discovery_service.ListDiscoveredApiObservationsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_discovered_api_observations_use_cached_wrapped_rpc(): @@ -1487,9 +1504,15 @@ async def test_list_discovered_api_observations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + discovery_service.ListDiscoveredApiObservationsRequest(), + {}, + ], +) async def test_list_discovered_api_observations_async( - transport: str = "grpc_asyncio", - request_type=discovery_service.ListDiscoveredApiObservationsRequest, + request_type, transport: str = "grpc_asyncio" ): client = ApiHubDiscoveryAsyncClient( credentials=async_anonymous_credentials(), @@ -1498,7 +1521,7 @@ async def test_list_discovered_api_observations_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( @@ -1523,11 +1546,6 @@ async def test_list_discovered_api_observations_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_discovered_api_observations_async_from_dict(): - await test_list_discovered_api_observations_async(request_type=dict) - - def test_list_discovered_api_observations_field_headers(): client = ApiHubDiscoveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1888,8 +1906,8 @@ async def test_list_discovered_api_observations_async_pages(): @pytest.mark.parametrize( "request_type", [ - discovery_service.GetDiscoveredApiObservationRequest, - dict, + discovery_service.GetDiscoveredApiObservationRequest(), + {}, ], ) def test_get_discovered_api_observation(request_type, transport: str = "grpc"): @@ -1900,7 +1918,7 @@ def test_get_discovered_api_observation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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 +1986,10 @@ def test_get_discovered_api_observation_non_empty_request_with_auto_populated_fi client.get_discovered_api_observation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == discovery_service.GetDiscoveredApiObservationRequest( + request_msg = discovery_service.GetDiscoveredApiObservationRequest( name="name_value", ) + assert args[0] == request_msg def test_get_discovered_api_observation_use_cached_wrapped_rpc(): @@ -2056,9 +2075,15 @@ async def test_get_discovered_api_observation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + discovery_service.GetDiscoveredApiObservationRequest(), + {}, + ], +) async def test_get_discovered_api_observation_async( - transport: str = "grpc_asyncio", - request_type=discovery_service.GetDiscoveredApiObservationRequest, + request_type, transport: str = "grpc_asyncio" ): client = ApiHubDiscoveryAsyncClient( credentials=async_anonymous_credentials(), @@ -2067,7 +2092,7 @@ async def test_get_discovered_api_observation_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( @@ -2114,11 +2139,6 @@ async def test_get_discovered_api_observation_async( assert response.unknown_operations_count == 2619 -@pytest.mark.asyncio -async def test_get_discovered_api_observation_async_from_dict(): - await test_get_discovered_api_observation_async(request_type=dict) - - def test_get_discovered_api_observation_field_headers(): client = ApiHubDiscoveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2273,8 +2293,8 @@ async def test_get_discovered_api_observation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - discovery_service.ListDiscoveredApiOperationsRequest, - dict, + discovery_service.ListDiscoveredApiOperationsRequest(), + {}, ], ) def test_list_discovered_api_operations(request_type, transport: str = "grpc"): @@ -2285,7 +2305,7 @@ def test_list_discovered_api_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( @@ -2334,10 +2354,11 @@ def test_list_discovered_api_operations_non_empty_request_with_auto_populated_fi client.list_discovered_api_operations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == discovery_service.ListDiscoveredApiOperationsRequest( + request_msg = discovery_service.ListDiscoveredApiOperationsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_discovered_api_operations_use_cached_wrapped_rpc(): @@ -2423,9 +2444,15 @@ async def test_list_discovered_api_operations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + discovery_service.ListDiscoveredApiOperationsRequest(), + {}, + ], +) async def test_list_discovered_api_operations_async( - transport: str = "grpc_asyncio", - request_type=discovery_service.ListDiscoveredApiOperationsRequest, + request_type, transport: str = "grpc_asyncio" ): client = ApiHubDiscoveryAsyncClient( credentials=async_anonymous_credentials(), @@ -2434,7 +2461,7 @@ async def test_list_discovered_api_operations_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( @@ -2459,11 +2486,6 @@ async def test_list_discovered_api_operations_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_discovered_api_operations_async_from_dict(): - await test_list_discovered_api_operations_async(request_type=dict) - - def test_list_discovered_api_operations_field_headers(): client = ApiHubDiscoveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2822,8 +2844,8 @@ async def test_list_discovered_api_operations_async_pages(): @pytest.mark.parametrize( "request_type", [ - discovery_service.GetDiscoveredApiOperationRequest, - dict, + discovery_service.GetDiscoveredApiOperationRequest(), + {}, ], ) def test_get_discovered_api_operation(request_type, transport: str = "grpc"): @@ -2834,7 +2856,7 @@ def test_get_discovered_api_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( @@ -2889,9 +2911,10 @@ def test_get_discovered_api_operation_non_empty_request_with_auto_populated_fiel client.get_discovered_api_operation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == discovery_service.GetDiscoveredApiOperationRequest( + request_msg = discovery_service.GetDiscoveredApiOperationRequest( name="name_value", ) + assert args[0] == request_msg def test_get_discovered_api_operation_use_cached_wrapped_rpc(): @@ -2977,9 +3000,15 @@ async def test_get_discovered_api_operation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + discovery_service.GetDiscoveredApiOperationRequest(), + {}, + ], +) async def test_get_discovered_api_operation_async( - transport: str = "grpc_asyncio", - request_type=discovery_service.GetDiscoveredApiOperationRequest, + request_type, transport: str = "grpc_asyncio" ): client = ApiHubDiscoveryAsyncClient( credentials=async_anonymous_credentials(), @@ -2988,7 +3017,7 @@ async def test_get_discovered_api_operation_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( @@ -3020,11 +3049,6 @@ async def test_get_discovered_api_operation_async( ) -@pytest.mark.asyncio -async def test_get_discovered_api_operation_async_from_dict(): - await test_get_discovered_api_operation_async(request_type=dict) - - def test_get_discovered_api_operation_field_headers(): client = ApiHubDiscoveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4219,7 +4243,6 @@ def test_list_discovered_api_observations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = discovery_service.ListDiscoveredApiObservationsRequest() - assert args[0] == request_msg @@ -4242,7 +4265,6 @@ def test_get_discovered_api_observation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = discovery_service.GetDiscoveredApiObservationRequest() - assert args[0] == request_msg @@ -4265,7 +4287,6 @@ def test_list_discovered_api_operations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = discovery_service.ListDiscoveredApiOperationsRequest() - assert args[0] == request_msg @@ -4288,7 +4309,6 @@ def test_get_discovered_api_operation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = discovery_service.GetDiscoveredApiOperationRequest() - assert args[0] == request_msg @@ -4331,7 +4351,6 @@ async def test_list_discovered_api_observations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = discovery_service.ListDiscoveredApiObservationsRequest() - assert args[0] == request_msg @@ -4371,7 +4390,6 @@ async def test_get_discovered_api_observation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = discovery_service.GetDiscoveredApiObservationRequest() - assert args[0] == request_msg @@ -4400,7 +4418,6 @@ async def test_list_discovered_api_operations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = discovery_service.ListDiscoveredApiOperationsRequest() - assert args[0] == request_msg @@ -4431,7 +4448,6 @@ async def test_get_discovered_api_operation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = discovery_service.GetDiscoveredApiOperationRequest() - assert args[0] == request_msg @@ -5436,7 +5452,6 @@ def test_list_discovered_api_observations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = discovery_service.ListDiscoveredApiObservationsRequest() - assert args[0] == request_msg @@ -5458,7 +5473,6 @@ def test_get_discovered_api_observation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = discovery_service.GetDiscoveredApiObservationRequest() - assert args[0] == request_msg @@ -5480,7 +5494,6 @@ def test_list_discovered_api_operations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = discovery_service.ListDiscoveredApiOperationsRequest() - assert args[0] == request_msg @@ -5502,7 +5515,6 @@ def test_get_discovered_api_operation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = discovery_service.GetDiscoveredApiOperationRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-apihub/tests/unit/gapic/apihub_v1/test_api_hub_plugin.py b/packages/google-cloud-apihub/tests/unit/gapic/apihub_v1/test_api_hub_plugin.py index f7a661d6b085..a50c3a9cd54c 100644 --- a/packages/google-cloud-apihub/tests/unit/gapic/apihub_v1/test_api_hub_plugin.py +++ b/packages/google-cloud-apihub/tests/unit/gapic/apihub_v1/test_api_hub_plugin.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 @@ -116,6 +117,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" @@ -1296,8 +1312,8 @@ def test_api_hub_plugin_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - plugin_service.GetPluginRequest, - dict, + plugin_service.GetPluginRequest(), + {}, ], ) def test_get_plugin(request_type, transport: str = "grpc"): @@ -1308,7 +1324,7 @@ def test_get_plugin(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_plugin), "__call__") as call: @@ -1364,9 +1380,10 @@ def test_get_plugin_non_empty_request_with_auto_populated_field(): client.get_plugin(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == plugin_service.GetPluginRequest( + request_msg = plugin_service.GetPluginRequest( name="name_value", ) + assert args[0] == request_msg def test_get_plugin_use_cached_wrapped_rpc(): @@ -1445,9 +1462,14 @@ async def test_get_plugin_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_plugin_async( - transport: str = "grpc_asyncio", request_type=plugin_service.GetPluginRequest -): +@pytest.mark.parametrize( + "request_type", + [ + plugin_service.GetPluginRequest(), + {}, + ], +) +async def test_get_plugin_async(request_type, transport: str = "grpc_asyncio"): client = ApiHubPluginAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1455,7 +1477,7 @@ async def test_get_plugin_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_plugin), "__call__") as call: @@ -1490,11 +1512,6 @@ async def test_get_plugin_async( assert response.gateway_type == plugin_service.GatewayType.APIGEE_X_AND_HYBRID -@pytest.mark.asyncio -async def test_get_plugin_async_from_dict(): - await test_get_plugin_async(request_type=dict) - - def test_get_plugin_field_headers(): client = ApiHubPluginClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1641,8 +1658,8 @@ async def test_get_plugin_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - plugin_service.EnablePluginRequest, - dict, + plugin_service.EnablePluginRequest(), + {}, ], ) def test_enable_plugin(request_type, transport: str = "grpc"): @@ -1653,7 +1670,7 @@ def test_enable_plugin(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.enable_plugin), "__call__") as call: @@ -1709,9 +1726,10 @@ def test_enable_plugin_non_empty_request_with_auto_populated_field(): client.enable_plugin(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == plugin_service.EnablePluginRequest( + request_msg = plugin_service.EnablePluginRequest( name="name_value", ) + assert args[0] == request_msg def test_enable_plugin_use_cached_wrapped_rpc(): @@ -1792,9 +1810,14 @@ async def test_enable_plugin_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_enable_plugin_async( - transport: str = "grpc_asyncio", request_type=plugin_service.EnablePluginRequest -): +@pytest.mark.parametrize( + "request_type", + [ + plugin_service.EnablePluginRequest(), + {}, + ], +) +async def test_enable_plugin_async(request_type, transport: str = "grpc_asyncio"): client = ApiHubPluginAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1802,7 +1825,7 @@ async def test_enable_plugin_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.enable_plugin), "__call__") as call: @@ -1837,11 +1860,6 @@ async def test_enable_plugin_async( assert response.gateway_type == plugin_service.GatewayType.APIGEE_X_AND_HYBRID -@pytest.mark.asyncio -async def test_enable_plugin_async_from_dict(): - await test_enable_plugin_async(request_type=dict) - - def test_enable_plugin_field_headers(): client = ApiHubPluginClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1988,8 +2006,8 @@ async def test_enable_plugin_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - plugin_service.DisablePluginRequest, - dict, + plugin_service.DisablePluginRequest(), + {}, ], ) def test_disable_plugin(request_type, transport: str = "grpc"): @@ -2000,7 +2018,7 @@ def test_disable_plugin(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.disable_plugin), "__call__") as call: @@ -2056,9 +2074,10 @@ def test_disable_plugin_non_empty_request_with_auto_populated_field(): client.disable_plugin(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == plugin_service.DisablePluginRequest( + request_msg = plugin_service.DisablePluginRequest( name="name_value", ) + assert args[0] == request_msg def test_disable_plugin_use_cached_wrapped_rpc(): @@ -2139,9 +2158,14 @@ async def test_disable_plugin_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_disable_plugin_async( - transport: str = "grpc_asyncio", request_type=plugin_service.DisablePluginRequest -): +@pytest.mark.parametrize( + "request_type", + [ + plugin_service.DisablePluginRequest(), + {}, + ], +) +async def test_disable_plugin_async(request_type, transport: str = "grpc_asyncio"): client = ApiHubPluginAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2149,7 +2173,7 @@ async def test_disable_plugin_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.disable_plugin), "__call__") as call: @@ -2184,11 +2208,6 @@ async def test_disable_plugin_async( assert response.gateway_type == plugin_service.GatewayType.APIGEE_X_AND_HYBRID -@pytest.mark.asyncio -async def test_disable_plugin_async_from_dict(): - await test_disable_plugin_async(request_type=dict) - - def test_disable_plugin_field_headers(): client = ApiHubPluginClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2335,8 +2354,8 @@ async def test_disable_plugin_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - plugin_service.CreatePluginRequest, - dict, + plugin_service.CreatePluginRequest(), + {}, ], ) def test_create_plugin(request_type, transport: str = "grpc"): @@ -2347,7 +2366,7 @@ def test_create_plugin(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_plugin), "__call__") as call: @@ -2404,10 +2423,11 @@ def test_create_plugin_non_empty_request_with_auto_populated_field(): client.create_plugin(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == plugin_service.CreatePluginRequest( + request_msg = plugin_service.CreatePluginRequest( parent="parent_value", plugin_id="plugin_id_value", ) + assert args[0] == request_msg def test_create_plugin_use_cached_wrapped_rpc(): @@ -2488,9 +2508,14 @@ async def test_create_plugin_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_plugin_async( - transport: str = "grpc_asyncio", request_type=plugin_service.CreatePluginRequest -): +@pytest.mark.parametrize( + "request_type", + [ + plugin_service.CreatePluginRequest(), + {}, + ], +) +async def test_create_plugin_async(request_type, transport: str = "grpc_asyncio"): client = ApiHubPluginAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2498,7 +2523,7 @@ async def test_create_plugin_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_plugin), "__call__") as call: @@ -2533,11 +2558,6 @@ async def test_create_plugin_async( assert response.gateway_type == plugin_service.GatewayType.APIGEE_X_AND_HYBRID -@pytest.mark.asyncio -async def test_create_plugin_async_from_dict(): - await test_create_plugin_async(request_type=dict) - - def test_create_plugin_field_headers(): client = ApiHubPluginClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2704,8 +2724,8 @@ async def test_create_plugin_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - plugin_service.ListPluginsRequest, - dict, + plugin_service.ListPluginsRequest(), + {}, ], ) def test_list_plugins(request_type, transport: str = "grpc"): @@ -2716,7 +2736,7 @@ def test_list_plugins(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_plugins), "__call__") as call: @@ -2762,11 +2782,12 @@ def test_list_plugins_non_empty_request_with_auto_populated_field(): client.list_plugins(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == plugin_service.ListPluginsRequest( + request_msg = plugin_service.ListPluginsRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_plugins_use_cached_wrapped_rpc(): @@ -2847,9 +2868,14 @@ async def test_list_plugins_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_plugins_async( - transport: str = "grpc_asyncio", request_type=plugin_service.ListPluginsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + plugin_service.ListPluginsRequest(), + {}, + ], +) +async def test_list_plugins_async(request_type, transport: str = "grpc_asyncio"): client = ApiHubPluginAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2857,7 +2883,7 @@ async def test_list_plugins_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_plugins), "__call__") as call: @@ -2880,11 +2906,6 @@ async def test_list_plugins_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_plugins_async_from_dict(): - await test_list_plugins_async(request_type=dict) - - def test_list_plugins_field_headers(): client = ApiHubPluginClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3221,8 +3242,8 @@ async def test_list_plugins_async_pages(): @pytest.mark.parametrize( "request_type", [ - plugin_service.DeletePluginRequest, - dict, + plugin_service.DeletePluginRequest(), + {}, ], ) def test_delete_plugin(request_type, transport: str = "grpc"): @@ -3233,7 +3254,7 @@ def test_delete_plugin(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_plugin), "__call__") as call: @@ -3274,9 +3295,10 @@ def test_delete_plugin_non_empty_request_with_auto_populated_field(): client.delete_plugin(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == plugin_service.DeletePluginRequest( + request_msg = plugin_service.DeletePluginRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_plugin_use_cached_wrapped_rpc(): @@ -3367,9 +3389,14 @@ async def test_delete_plugin_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_plugin_async( - transport: str = "grpc_asyncio", request_type=plugin_service.DeletePluginRequest -): +@pytest.mark.parametrize( + "request_type", + [ + plugin_service.DeletePluginRequest(), + {}, + ], +) +async def test_delete_plugin_async(request_type, transport: str = "grpc_asyncio"): client = ApiHubPluginAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3377,7 +3404,7 @@ async def test_delete_plugin_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_plugin), "__call__") as call: @@ -3397,11 +3424,6 @@ async def test_delete_plugin_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_plugin_async_from_dict(): - await test_delete_plugin_async(request_type=dict) - - def test_delete_plugin_field_headers(): client = ApiHubPluginClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3548,8 +3570,8 @@ async def test_delete_plugin_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - plugin_service.CreatePluginInstanceRequest, - dict, + plugin_service.CreatePluginInstanceRequest(), + {}, ], ) def test_create_plugin_instance(request_type, transport: str = "grpc"): @@ -3560,7 +3582,7 @@ def test_create_plugin_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( @@ -3606,10 +3628,11 @@ def test_create_plugin_instance_non_empty_request_with_auto_populated_field(): client.create_plugin_instance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == plugin_service.CreatePluginInstanceRequest( + request_msg = plugin_service.CreatePluginInstanceRequest( parent="parent_value", plugin_instance_id="plugin_instance_id_value", ) + assert args[0] == request_msg def test_create_plugin_instance_use_cached_wrapped_rpc(): @@ -3705,9 +3728,15 @@ async def test_create_plugin_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + plugin_service.CreatePluginInstanceRequest(), + {}, + ], +) async def test_create_plugin_instance_async( - transport: str = "grpc_asyncio", - request_type=plugin_service.CreatePluginInstanceRequest, + request_type, transport: str = "grpc_asyncio" ): client = ApiHubPluginAsyncClient( credentials=async_anonymous_credentials(), @@ -3716,7 +3745,7 @@ async def test_create_plugin_instance_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( @@ -3738,11 +3767,6 @@ async def test_create_plugin_instance_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_plugin_instance_async_from_dict(): - await test_create_plugin_instance_async(request_type=dict) - - def test_create_plugin_instance_field_headers(): client = ApiHubPluginClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3917,8 +3941,8 @@ async def test_create_plugin_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - plugin_service.ExecutePluginInstanceActionRequest, - dict, + plugin_service.ExecutePluginInstanceActionRequest(), + {}, ], ) def test_execute_plugin_instance_action(request_type, transport: str = "grpc"): @@ -3929,7 +3953,7 @@ def test_execute_plugin_instance_action(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3974,9 +3998,10 @@ def test_execute_plugin_instance_action_non_empty_request_with_auto_populated_fi client.execute_plugin_instance_action(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == plugin_service.ExecutePluginInstanceActionRequest( + request_msg = plugin_service.ExecutePluginInstanceActionRequest( name="name_value", ) + assert args[0] == request_msg def test_execute_plugin_instance_action_use_cached_wrapped_rpc(): @@ -4072,9 +4097,15 @@ async def test_execute_plugin_instance_action_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + plugin_service.ExecutePluginInstanceActionRequest(), + {}, + ], +) async def test_execute_plugin_instance_action_async( - transport: str = "grpc_asyncio", - request_type=plugin_service.ExecutePluginInstanceActionRequest, + request_type, transport: str = "grpc_asyncio" ): client = ApiHubPluginAsyncClient( credentials=async_anonymous_credentials(), @@ -4083,7 +4114,7 @@ async def test_execute_plugin_instance_action_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( @@ -4105,11 +4136,6 @@ async def test_execute_plugin_instance_action_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_execute_plugin_instance_action_async_from_dict(): - await test_execute_plugin_instance_action_async(request_type=dict) - - def test_execute_plugin_instance_action_field_headers(): client = ApiHubPluginClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4282,8 +4308,8 @@ async def test_execute_plugin_instance_action_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - plugin_service.GetPluginInstanceRequest, - dict, + plugin_service.GetPluginInstanceRequest(), + {}, ], ) def test_get_plugin_instance(request_type, transport: str = "grpc"): @@ -4294,7 +4320,7 @@ def test_get_plugin_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( @@ -4350,9 +4376,10 @@ def test_get_plugin_instance_non_empty_request_with_auto_populated_field(): client.get_plugin_instance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == plugin_service.GetPluginInstanceRequest( + request_msg = plugin_service.GetPluginInstanceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_plugin_instance_use_cached_wrapped_rpc(): @@ -4437,10 +4464,14 @@ async def test_get_plugin_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_plugin_instance_async( - transport: str = "grpc_asyncio", - request_type=plugin_service.GetPluginInstanceRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + plugin_service.GetPluginInstanceRequest(), + {}, + ], +) +async def test_get_plugin_instance_async(request_type, transport: str = "grpc_asyncio"): client = ApiHubPluginAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4448,7 +4479,7 @@ async def test_get_plugin_instance_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( @@ -4481,11 +4512,6 @@ async def test_get_plugin_instance_async( assert response.source_project_id == "source_project_id_value" -@pytest.mark.asyncio -async def test_get_plugin_instance_async_from_dict(): - await test_get_plugin_instance_async(request_type=dict) - - def test_get_plugin_instance_field_headers(): client = ApiHubPluginClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4640,8 +4666,8 @@ async def test_get_plugin_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - plugin_service.ListPluginInstancesRequest, - dict, + plugin_service.ListPluginInstancesRequest(), + {}, ], ) def test_list_plugin_instances(request_type, transport: str = "grpc"): @@ -4652,7 +4678,7 @@ def test_list_plugin_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( @@ -4702,11 +4728,12 @@ def test_list_plugin_instances_non_empty_request_with_auto_populated_field(): client.list_plugin_instances(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == plugin_service.ListPluginInstancesRequest( + request_msg = plugin_service.ListPluginInstancesRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_plugin_instances_use_cached_wrapped_rpc(): @@ -4792,9 +4819,15 @@ async def test_list_plugin_instances_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + plugin_service.ListPluginInstancesRequest(), + {}, + ], +) async def test_list_plugin_instances_async( - transport: str = "grpc_asyncio", - request_type=plugin_service.ListPluginInstancesRequest, + request_type, transport: str = "grpc_asyncio" ): client = ApiHubPluginAsyncClient( credentials=async_anonymous_credentials(), @@ -4803,7 +4836,7 @@ async def test_list_plugin_instances_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( @@ -4828,11 +4861,6 @@ async def test_list_plugin_instances_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_plugin_instances_async_from_dict(): - await test_list_plugin_instances_async(request_type=dict) - - def test_list_plugin_instances_field_headers(): client = ApiHubPluginClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5185,8 +5213,8 @@ async def test_list_plugin_instances_async_pages(): @pytest.mark.parametrize( "request_type", [ - plugin_service.EnablePluginInstanceActionRequest, - dict, + plugin_service.EnablePluginInstanceActionRequest(), + {}, ], ) def test_enable_plugin_instance_action(request_type, transport: str = "grpc"): @@ -5197,7 +5225,7 @@ def test_enable_plugin_instance_action(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5243,10 +5271,11 @@ def test_enable_plugin_instance_action_non_empty_request_with_auto_populated_fie client.enable_plugin_instance_action(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == plugin_service.EnablePluginInstanceActionRequest( + request_msg = plugin_service.EnablePluginInstanceActionRequest( name="name_value", action_id="action_id_value", ) + assert args[0] == request_msg def test_enable_plugin_instance_action_use_cached_wrapped_rpc(): @@ -5342,9 +5371,15 @@ async def test_enable_plugin_instance_action_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + plugin_service.EnablePluginInstanceActionRequest(), + {}, + ], +) async def test_enable_plugin_instance_action_async( - transport: str = "grpc_asyncio", - request_type=plugin_service.EnablePluginInstanceActionRequest, + request_type, transport: str = "grpc_asyncio" ): client = ApiHubPluginAsyncClient( credentials=async_anonymous_credentials(), @@ -5353,7 +5388,7 @@ async def test_enable_plugin_instance_action_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( @@ -5375,11 +5410,6 @@ async def test_enable_plugin_instance_action_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_enable_plugin_instance_action_async_from_dict(): - await test_enable_plugin_instance_action_async(request_type=dict) - - def test_enable_plugin_instance_action_field_headers(): client = ApiHubPluginClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5544,8 +5574,8 @@ async def test_enable_plugin_instance_action_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - plugin_service.DisablePluginInstanceActionRequest, - dict, + plugin_service.DisablePluginInstanceActionRequest(), + {}, ], ) def test_disable_plugin_instance_action(request_type, transport: str = "grpc"): @@ -5556,7 +5586,7 @@ def test_disable_plugin_instance_action(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5602,10 +5632,11 @@ def test_disable_plugin_instance_action_non_empty_request_with_auto_populated_fi client.disable_plugin_instance_action(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == plugin_service.DisablePluginInstanceActionRequest( + request_msg = plugin_service.DisablePluginInstanceActionRequest( name="name_value", action_id="action_id_value", ) + assert args[0] == request_msg def test_disable_plugin_instance_action_use_cached_wrapped_rpc(): @@ -5701,9 +5732,15 @@ async def test_disable_plugin_instance_action_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + plugin_service.DisablePluginInstanceActionRequest(), + {}, + ], +) async def test_disable_plugin_instance_action_async( - transport: str = "grpc_asyncio", - request_type=plugin_service.DisablePluginInstanceActionRequest, + request_type, transport: str = "grpc_asyncio" ): client = ApiHubPluginAsyncClient( credentials=async_anonymous_credentials(), @@ -5712,7 +5749,7 @@ async def test_disable_plugin_instance_action_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( @@ -5734,11 +5771,6 @@ async def test_disable_plugin_instance_action_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_disable_plugin_instance_action_async_from_dict(): - await test_disable_plugin_instance_action_async(request_type=dict) - - def test_disable_plugin_instance_action_field_headers(): client = ApiHubPluginClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5903,8 +5935,8 @@ async def test_disable_plugin_instance_action_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - plugin_service.UpdatePluginInstanceRequest, - dict, + plugin_service.UpdatePluginInstanceRequest(), + {}, ], ) def test_update_plugin_instance(request_type, transport: str = "grpc"): @@ -5915,7 +5947,7 @@ def test_update_plugin_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( @@ -5969,7 +6001,8 @@ def test_update_plugin_instance_non_empty_request_with_auto_populated_field(): client.update_plugin_instance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == plugin_service.UpdatePluginInstanceRequest() + request_msg = plugin_service.UpdatePluginInstanceRequest() + assert args[0] == request_msg def test_update_plugin_instance_use_cached_wrapped_rpc(): @@ -6055,9 +6088,15 @@ async def test_update_plugin_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + plugin_service.UpdatePluginInstanceRequest(), + {}, + ], +) async def test_update_plugin_instance_async( - transport: str = "grpc_asyncio", - request_type=plugin_service.UpdatePluginInstanceRequest, + request_type, transport: str = "grpc_asyncio" ): client = ApiHubPluginAsyncClient( credentials=async_anonymous_credentials(), @@ -6066,7 +6105,7 @@ async def test_update_plugin_instance_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( @@ -6099,11 +6138,6 @@ async def test_update_plugin_instance_async( assert response.source_project_id == "source_project_id_value" -@pytest.mark.asyncio -async def test_update_plugin_instance_async_from_dict(): - await test_update_plugin_instance_async(request_type=dict) - - def test_update_plugin_instance_field_headers(): client = ApiHubPluginClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6268,8 +6302,8 @@ async def test_update_plugin_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - plugin_service.DeletePluginInstanceRequest, - dict, + plugin_service.DeletePluginInstanceRequest(), + {}, ], ) def test_delete_plugin_instance(request_type, transport: str = "grpc"): @@ -6280,7 +6314,7 @@ def test_delete_plugin_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( @@ -6325,9 +6359,10 @@ def test_delete_plugin_instance_non_empty_request_with_auto_populated_field(): client.delete_plugin_instance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == plugin_service.DeletePluginInstanceRequest( + request_msg = plugin_service.DeletePluginInstanceRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_plugin_instance_use_cached_wrapped_rpc(): @@ -6423,9 +6458,15 @@ async def test_delete_plugin_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + plugin_service.DeletePluginInstanceRequest(), + {}, + ], +) async def test_delete_plugin_instance_async( - transport: str = "grpc_asyncio", - request_type=plugin_service.DeletePluginInstanceRequest, + request_type, transport: str = "grpc_asyncio" ): client = ApiHubPluginAsyncClient( credentials=async_anonymous_credentials(), @@ -6434,7 +6475,7 @@ async def test_delete_plugin_instance_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( @@ -6456,11 +6497,6 @@ async def test_delete_plugin_instance_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_plugin_instance_async_from_dict(): - await test_delete_plugin_instance_async(request_type=dict) - - def test_delete_plugin_instance_field_headers(): client = ApiHubPluginClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9517,7 +9553,6 @@ def test_get_plugin_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = plugin_service.GetPluginRequest() - assert args[0] == request_msg @@ -9538,7 +9573,6 @@ def test_enable_plugin_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = plugin_service.EnablePluginRequest() - assert args[0] == request_msg @@ -9559,7 +9593,6 @@ def test_disable_plugin_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = plugin_service.DisablePluginRequest() - assert args[0] == request_msg @@ -9580,7 +9613,6 @@ def test_create_plugin_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = plugin_service.CreatePluginRequest() - assert args[0] == request_msg @@ -9601,7 +9633,6 @@ def test_list_plugins_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = plugin_service.ListPluginsRequest() - assert args[0] == request_msg @@ -9622,7 +9653,6 @@ def test_delete_plugin_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = plugin_service.DeletePluginRequest() - assert args[0] == request_msg @@ -9645,7 +9675,6 @@ def test_create_plugin_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = plugin_service.CreatePluginInstanceRequest() - assert args[0] == request_msg @@ -9668,7 +9697,6 @@ def test_execute_plugin_instance_action_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = plugin_service.ExecutePluginInstanceActionRequest() - assert args[0] == request_msg @@ -9691,7 +9719,6 @@ def test_get_plugin_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = plugin_service.GetPluginInstanceRequest() - assert args[0] == request_msg @@ -9714,7 +9741,6 @@ def test_list_plugin_instances_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = plugin_service.ListPluginInstancesRequest() - assert args[0] == request_msg @@ -9737,7 +9763,6 @@ def test_enable_plugin_instance_action_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = plugin_service.EnablePluginInstanceActionRequest() - assert args[0] == request_msg @@ -9760,7 +9785,6 @@ def test_disable_plugin_instance_action_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = plugin_service.DisablePluginInstanceActionRequest() - assert args[0] == request_msg @@ -9783,7 +9807,6 @@ def test_update_plugin_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = plugin_service.UpdatePluginInstanceRequest() - assert args[0] == request_msg @@ -9806,7 +9829,6 @@ def test_delete_plugin_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = plugin_service.DeletePluginInstanceRequest() - assert args[0] == request_msg @@ -9853,7 +9875,6 @@ async def test_get_plugin_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = plugin_service.GetPluginRequest() - assert args[0] == request_msg @@ -9886,7 +9907,6 @@ async def test_enable_plugin_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = plugin_service.EnablePluginRequest() - assert args[0] == request_msg @@ -9919,7 +9939,6 @@ async def test_disable_plugin_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = plugin_service.DisablePluginRequest() - assert args[0] == request_msg @@ -9952,7 +9971,6 @@ async def test_create_plugin_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = plugin_service.CreatePluginRequest() - assert args[0] == request_msg @@ -9979,7 +9997,6 @@ async def test_list_plugins_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = plugin_service.ListPluginsRequest() - assert args[0] == request_msg @@ -10004,7 +10021,6 @@ async def test_delete_plugin_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = plugin_service.DeletePluginRequest() - assert args[0] == request_msg @@ -10031,7 +10047,6 @@ async def test_create_plugin_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = plugin_service.CreatePluginInstanceRequest() - assert args[0] == request_msg @@ -10058,7 +10073,6 @@ async def test_execute_plugin_instance_action_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = plugin_service.ExecutePluginInstanceActionRequest() - assert args[0] == request_msg @@ -10091,7 +10105,6 @@ async def test_get_plugin_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = plugin_service.GetPluginInstanceRequest() - assert args[0] == request_msg @@ -10120,7 +10133,6 @@ async def test_list_plugin_instances_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = plugin_service.ListPluginInstancesRequest() - assert args[0] == request_msg @@ -10147,7 +10159,6 @@ async def test_enable_plugin_instance_action_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = plugin_service.EnablePluginInstanceActionRequest() - assert args[0] == request_msg @@ -10174,7 +10185,6 @@ async def test_disable_plugin_instance_action_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = plugin_service.DisablePluginInstanceActionRequest() - assert args[0] == request_msg @@ -10207,7 +10217,6 @@ async def test_update_plugin_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = plugin_service.UpdatePluginInstanceRequest() - assert args[0] == request_msg @@ -10234,7 +10243,6 @@ async def test_delete_plugin_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = plugin_service.DeletePluginInstanceRequest() - assert args[0] == request_msg @@ -12916,7 +12924,6 @@ def test_get_plugin_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = plugin_service.GetPluginRequest() - assert args[0] == request_msg @@ -12936,7 +12943,6 @@ def test_enable_plugin_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = plugin_service.EnablePluginRequest() - assert args[0] == request_msg @@ -12956,7 +12962,6 @@ def test_disable_plugin_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = plugin_service.DisablePluginRequest() - assert args[0] == request_msg @@ -12976,7 +12981,6 @@ def test_create_plugin_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = plugin_service.CreatePluginRequest() - assert args[0] == request_msg @@ -12996,7 +13000,6 @@ def test_list_plugins_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = plugin_service.ListPluginsRequest() - assert args[0] == request_msg @@ -13016,7 +13019,6 @@ def test_delete_plugin_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = plugin_service.DeletePluginRequest() - assert args[0] == request_msg @@ -13038,7 +13040,6 @@ def test_create_plugin_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = plugin_service.CreatePluginInstanceRequest() - assert args[0] == request_msg @@ -13060,7 +13061,6 @@ def test_execute_plugin_instance_action_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = plugin_service.ExecutePluginInstanceActionRequest() - assert args[0] == request_msg @@ -13082,7 +13082,6 @@ def test_get_plugin_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = plugin_service.GetPluginInstanceRequest() - assert args[0] == request_msg @@ -13104,7 +13103,6 @@ def test_list_plugin_instances_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = plugin_service.ListPluginInstancesRequest() - assert args[0] == request_msg @@ -13126,7 +13124,6 @@ def test_enable_plugin_instance_action_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = plugin_service.EnablePluginInstanceActionRequest() - assert args[0] == request_msg @@ -13148,7 +13145,6 @@ def test_disable_plugin_instance_action_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = plugin_service.DisablePluginInstanceActionRequest() - assert args[0] == request_msg @@ -13170,7 +13166,6 @@ def test_update_plugin_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = plugin_service.UpdatePluginInstanceRequest() - assert args[0] == request_msg @@ -13192,7 +13187,6 @@ def test_delete_plugin_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = plugin_service.DeletePluginInstanceRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-apihub/tests/unit/gapic/apihub_v1/test_host_project_registration_service.py b/packages/google-cloud-apihub/tests/unit/gapic/apihub_v1/test_host_project_registration_service.py index 06d73bc7bced..eeb4692bf5de 100644 --- a/packages/google-cloud-apihub/tests/unit/gapic/apihub_v1/test_host_project_registration_service.py +++ b/packages/google-cloud-apihub/tests/unit/gapic/apihub_v1/test_host_project_registration_service.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 @@ -110,6 +111,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" @@ -1438,8 +1454,8 @@ def test_host_project_registration_service_client_create_channel_credentials_fil @pytest.mark.parametrize( "request_type", [ - host_project_registration_service.CreateHostProjectRegistrationRequest, - dict, + host_project_registration_service.CreateHostProjectRegistrationRequest(), + {}, ], ) def test_create_host_project_registration(request_type, transport: str = "grpc"): @@ -1450,7 +1466,7 @@ def test_create_host_project_registration(request_type, transport: str = "grpc") # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1505,12 +1521,13 @@ def test_create_host_project_registration_non_empty_request_with_auto_populated_ client.create_host_project_registration(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == host_project_registration_service.CreateHostProjectRegistrationRequest( - parent="parent_value", - host_project_registration_id="host_project_registration_id_value", + request_msg = ( + host_project_registration_service.CreateHostProjectRegistrationRequest( + parent="parent_value", + host_project_registration_id="host_project_registration_id_value", + ) ) + assert args[0] == request_msg def test_create_host_project_registration_use_cached_wrapped_rpc(): @@ -1596,9 +1613,15 @@ async def test_create_host_project_registration_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + host_project_registration_service.CreateHostProjectRegistrationRequest(), + {}, + ], +) async def test_create_host_project_registration_async( - transport: str = "grpc_asyncio", - request_type=host_project_registration_service.CreateHostProjectRegistrationRequest, + request_type, transport: str = "grpc_asyncio" ): client = HostProjectRegistrationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1607,7 +1630,7 @@ async def test_create_host_project_registration_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( @@ -1638,11 +1661,6 @@ async def test_create_host_project_registration_async( assert response.gcp_project == "gcp_project_value" -@pytest.mark.asyncio -async def test_create_host_project_registration_async_from_dict(): - await test_create_host_project_registration_async(request_type=dict) - - def test_create_host_project_registration_field_headers(): client = HostProjectRegistrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1829,8 +1847,8 @@ async def test_create_host_project_registration_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - host_project_registration_service.GetHostProjectRegistrationRequest, - dict, + host_project_registration_service.GetHostProjectRegistrationRequest(), + {}, ], ) def test_get_host_project_registration(request_type, transport: str = "grpc"): @@ -1841,7 +1859,7 @@ def test_get_host_project_registration(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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 +1911,12 @@ def test_get_host_project_registration_non_empty_request_with_auto_populated_fie client.get_host_project_registration(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == host_project_registration_service.GetHostProjectRegistrationRequest( - name="name_value", + request_msg = ( + host_project_registration_service.GetHostProjectRegistrationRequest( + name="name_value", + ) ) + assert args[0] == request_msg def test_get_host_project_registration_use_cached_wrapped_rpc(): @@ -1983,9 +2002,15 @@ async def test_get_host_project_registration_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + host_project_registration_service.GetHostProjectRegistrationRequest(), + {}, + ], +) async def test_get_host_project_registration_async( - transport: str = "grpc_asyncio", - request_type=host_project_registration_service.GetHostProjectRegistrationRequest, + request_type, transport: str = "grpc_asyncio" ): client = HostProjectRegistrationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1994,7 +2019,7 @@ async def test_get_host_project_registration_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( @@ -2023,11 +2048,6 @@ async def test_get_host_project_registration_async( assert response.gcp_project == "gcp_project_value" -@pytest.mark.asyncio -async def test_get_host_project_registration_async_from_dict(): - await test_get_host_project_registration_async(request_type=dict) - - def test_get_host_project_registration_field_headers(): client = HostProjectRegistrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2182,8 +2202,8 @@ async def test_get_host_project_registration_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - host_project_registration_service.ListHostProjectRegistrationsRequest, - dict, + host_project_registration_service.ListHostProjectRegistrationsRequest(), + {}, ], ) def test_list_host_project_registrations(request_type, transport: str = "grpc"): @@ -2194,7 +2214,7 @@ def test_list_host_project_registrations(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2249,14 +2269,15 @@ def test_list_host_project_registrations_non_empty_request_with_auto_populated_f client.list_host_project_registrations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == host_project_registration_service.ListHostProjectRegistrationsRequest( - parent="parent_value", - page_token="page_token_value", - filter="filter_value", - order_by="order_by_value", + request_msg = ( + host_project_registration_service.ListHostProjectRegistrationsRequest( + parent="parent_value", + page_token="page_token_value", + filter="filter_value", + order_by="order_by_value", + ) ) + assert args[0] == request_msg def test_list_host_project_registrations_use_cached_wrapped_rpc(): @@ -2342,9 +2363,15 @@ async def test_list_host_project_registrations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + host_project_registration_service.ListHostProjectRegistrationsRequest(), + {}, + ], +) async def test_list_host_project_registrations_async( - transport: str = "grpc_asyncio", - request_type=host_project_registration_service.ListHostProjectRegistrationsRequest, + request_type, transport: str = "grpc_asyncio" ): client = HostProjectRegistrationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2353,7 +2380,7 @@ async def test_list_host_project_registrations_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( @@ -2380,11 +2407,6 @@ async def test_list_host_project_registrations_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_host_project_registrations_async_from_dict(): - await test_list_host_project_registrations_async(request_type=dict) - - def test_list_host_project_registrations_field_headers(): client = HostProjectRegistrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3583,7 +3605,6 @@ def test_create_host_project_registration_empty_call_grpc(): request_msg = ( host_project_registration_service.CreateHostProjectRegistrationRequest() ) - assert args[0] == request_msg @@ -3608,7 +3629,6 @@ def test_get_host_project_registration_empty_call_grpc(): request_msg = ( host_project_registration_service.GetHostProjectRegistrationRequest() ) - assert args[0] == request_msg @@ -3635,7 +3655,6 @@ def test_list_host_project_registrations_empty_call_grpc(): request_msg = ( host_project_registration_service.ListHostProjectRegistrationsRequest() ) - assert args[0] == request_msg @@ -3681,7 +3700,6 @@ async def test_create_host_project_registration_empty_call_grpc_asyncio(): request_msg = ( host_project_registration_service.CreateHostProjectRegistrationRequest() ) - assert args[0] == request_msg @@ -3713,7 +3731,6 @@ async def test_get_host_project_registration_empty_call_grpc_asyncio(): request_msg = ( host_project_registration_service.GetHostProjectRegistrationRequest() ) - assert args[0] == request_msg @@ -3744,7 +3761,6 @@ async def test_list_host_project_registrations_empty_call_grpc_asyncio(): request_msg = ( host_project_registration_service.ListHostProjectRegistrationsRequest() ) - assert args[0] == request_msg @@ -4686,7 +4702,6 @@ def test_create_host_project_registration_empty_call_rest(): request_msg = ( host_project_registration_service.CreateHostProjectRegistrationRequest() ) - assert args[0] == request_msg @@ -4710,7 +4725,6 @@ def test_get_host_project_registration_empty_call_rest(): request_msg = ( host_project_registration_service.GetHostProjectRegistrationRequest() ) - assert args[0] == request_msg @@ -4734,7 +4748,6 @@ def test_list_host_project_registrations_empty_call_rest(): request_msg = ( host_project_registration_service.ListHostProjectRegistrationsRequest() ) - assert args[0] == request_msg diff --git a/packages/google-cloud-apihub/tests/unit/gapic/apihub_v1/test_linting_service.py b/packages/google-cloud-apihub/tests/unit/gapic/apihub_v1/test_linting_service.py index bac2d08351ee..b4070fc33746 100644 --- a/packages/google-cloud-apihub/tests/unit/gapic/apihub_v1/test_linting_service.py +++ b/packages/google-cloud-apihub/tests/unit/gapic/apihub_v1/test_linting_service.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 @@ -109,6 +110,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" @@ -1312,8 +1328,8 @@ def test_linting_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - linting_service.GetStyleGuideRequest, - dict, + linting_service.GetStyleGuideRequest(), + {}, ], ) def test_get_style_guide(request_type, transport: str = "grpc"): @@ -1324,7 +1340,7 @@ def test_get_style_guide(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_style_guide), "__call__") as call: @@ -1370,9 +1386,10 @@ def test_get_style_guide_non_empty_request_with_auto_populated_field(): client.get_style_guide(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == linting_service.GetStyleGuideRequest( + request_msg = linting_service.GetStyleGuideRequest( name="name_value", ) + assert args[0] == request_msg def test_get_style_guide_use_cached_wrapped_rpc(): @@ -1453,9 +1470,14 @@ async def test_get_style_guide_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_style_guide_async( - transport: str = "grpc_asyncio", request_type=linting_service.GetStyleGuideRequest -): +@pytest.mark.parametrize( + "request_type", + [ + linting_service.GetStyleGuideRequest(), + {}, + ], +) +async def test_get_style_guide_async(request_type, transport: str = "grpc_asyncio"): client = LintingServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1463,7 +1485,7 @@ async def test_get_style_guide_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_style_guide), "__call__") as call: @@ -1488,11 +1510,6 @@ async def test_get_style_guide_async( assert response.linter == common_fields.Linter.SPECTRAL -@pytest.mark.asyncio -async def test_get_style_guide_async_from_dict(): - await test_get_style_guide_async(request_type=dict) - - def test_get_style_guide_field_headers(): client = LintingServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1639,8 +1656,8 @@ async def test_get_style_guide_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - linting_service.UpdateStyleGuideRequest, - dict, + linting_service.UpdateStyleGuideRequest(), + {}, ], ) def test_update_style_guide(request_type, transport: str = "grpc"): @@ -1651,7 +1668,7 @@ def test_update_style_guide(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1699,7 +1716,8 @@ def test_update_style_guide_non_empty_request_with_auto_populated_field(): client.update_style_guide(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == linting_service.UpdateStyleGuideRequest() + request_msg = linting_service.UpdateStyleGuideRequest() + assert args[0] == request_msg def test_update_style_guide_use_cached_wrapped_rpc(): @@ -1784,10 +1802,14 @@ async def test_update_style_guide_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_style_guide_async( - transport: str = "grpc_asyncio", - request_type=linting_service.UpdateStyleGuideRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + linting_service.UpdateStyleGuideRequest(), + {}, + ], +) +async def test_update_style_guide_async(request_type, transport: str = "grpc_asyncio"): client = LintingServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1795,7 +1817,7 @@ async def test_update_style_guide_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( @@ -1822,11 +1844,6 @@ async def test_update_style_guide_async( assert response.linter == common_fields.Linter.SPECTRAL -@pytest.mark.asyncio -async def test_update_style_guide_async_from_dict(): - await test_update_style_guide_async(request_type=dict) - - def test_update_style_guide_field_headers(): client = LintingServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1991,8 +2008,8 @@ async def test_update_style_guide_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - linting_service.GetStyleGuideContentsRequest, - dict, + linting_service.GetStyleGuideContentsRequest(), + {}, ], ) def test_get_style_guide_contents(request_type, transport: str = "grpc"): @@ -2003,7 +2020,7 @@ def test_get_style_guide_contents(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2053,9 +2070,10 @@ def test_get_style_guide_contents_non_empty_request_with_auto_populated_field(): client.get_style_guide_contents(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == linting_service.GetStyleGuideContentsRequest( + request_msg = linting_service.GetStyleGuideContentsRequest( name="name_value", ) + assert args[0] == request_msg def test_get_style_guide_contents_use_cached_wrapped_rpc(): @@ -2141,9 +2159,15 @@ async def test_get_style_guide_contents_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + linting_service.GetStyleGuideContentsRequest(), + {}, + ], +) async def test_get_style_guide_contents_async( - transport: str = "grpc_asyncio", - request_type=linting_service.GetStyleGuideContentsRequest, + request_type, transport: str = "grpc_asyncio" ): client = LintingServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2152,7 +2176,7 @@ async def test_get_style_guide_contents_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( @@ -2179,11 +2203,6 @@ async def test_get_style_guide_contents_async( assert response.mime_type == "mime_type_value" -@pytest.mark.asyncio -async def test_get_style_guide_contents_async_from_dict(): - await test_get_style_guide_contents_async(request_type=dict) - - def test_get_style_guide_contents_field_headers(): client = LintingServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2338,8 +2357,8 @@ async def test_get_style_guide_contents_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - linting_service.LintSpecRequest, - dict, + linting_service.LintSpecRequest(), + {}, ], ) def test_lint_spec(request_type, transport: str = "grpc"): @@ -2350,7 +2369,7 @@ def test_lint_spec(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.lint_spec), "__call__") as call: @@ -2391,9 +2410,10 @@ def test_lint_spec_non_empty_request_with_auto_populated_field(): client.lint_spec(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == linting_service.LintSpecRequest( + request_msg = linting_service.LintSpecRequest( name="name_value", ) + assert args[0] == request_msg def test_lint_spec_use_cached_wrapped_rpc(): @@ -2472,9 +2492,14 @@ async def test_lint_spec_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_lint_spec_async( - transport: str = "grpc_asyncio", request_type=linting_service.LintSpecRequest -): +@pytest.mark.parametrize( + "request_type", + [ + linting_service.LintSpecRequest(), + {}, + ], +) +async def test_lint_spec_async(request_type, transport: str = "grpc_asyncio"): client = LintingServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2482,7 +2507,7 @@ async def test_lint_spec_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.lint_spec), "__call__") as call: @@ -2500,11 +2525,6 @@ async def test_lint_spec_async( assert response is None -@pytest.mark.asyncio -async def test_lint_spec_async_from_dict(): - await test_lint_spec_async(request_type=dict) - - def test_lint_spec_field_headers(): client = LintingServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3354,7 +3374,6 @@ def test_get_style_guide_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = linting_service.GetStyleGuideRequest() - assert args[0] == request_msg @@ -3377,7 +3396,6 @@ def test_update_style_guide_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = linting_service.UpdateStyleGuideRequest() - assert args[0] == request_msg @@ -3400,7 +3418,6 @@ def test_get_style_guide_contents_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = linting_service.GetStyleGuideContentsRequest() - assert args[0] == request_msg @@ -3421,7 +3438,6 @@ def test_lint_spec_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = linting_service.LintSpecRequest() - assert args[0] == request_msg @@ -3463,7 +3479,6 @@ async def test_get_style_guide_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = linting_service.GetStyleGuideRequest() - assert args[0] == request_msg @@ -3493,7 +3508,6 @@ async def test_update_style_guide_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = linting_service.UpdateStyleGuideRequest() - assert args[0] == request_msg @@ -3523,7 +3537,6 @@ async def test_get_style_guide_contents_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = linting_service.GetStyleGuideContentsRequest() - assert args[0] == request_msg @@ -3546,7 +3559,6 @@ async def test_lint_spec_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = linting_service.LintSpecRequest() - assert args[0] == request_msg @@ -4555,7 +4567,6 @@ def test_get_style_guide_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = linting_service.GetStyleGuideRequest() - assert args[0] == request_msg @@ -4577,7 +4588,6 @@ def test_update_style_guide_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = linting_service.UpdateStyleGuideRequest() - assert args[0] == request_msg @@ -4599,7 +4609,6 @@ def test_get_style_guide_contents_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = linting_service.GetStyleGuideContentsRequest() - assert args[0] == request_msg @@ -4619,7 +4628,6 @@ def test_lint_spec_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = linting_service.LintSpecRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-apihub/tests/unit/gapic/apihub_v1/test_provisioning.py b/packages/google-cloud-apihub/tests/unit/gapic/apihub_v1/test_provisioning.py index 033d3700d379..4709503737ef 100644 --- a/packages/google-cloud-apihub/tests/unit/gapic/apihub_v1/test_provisioning.py +++ b/packages/google-cloud-apihub/tests/unit/gapic/apihub_v1/test_provisioning.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 @@ -114,6 +115,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" @@ -1294,8 +1310,8 @@ def test_provisioning_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - provisioning_service.CreateApiHubInstanceRequest, - dict, + provisioning_service.CreateApiHubInstanceRequest(), + {}, ], ) def test_create_api_hub_instance(request_type, transport: str = "grpc"): @@ -1306,7 +1322,7 @@ def test_create_api_hub_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( @@ -1352,10 +1368,11 @@ def test_create_api_hub_instance_non_empty_request_with_auto_populated_field(): client.create_api_hub_instance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == provisioning_service.CreateApiHubInstanceRequest( + request_msg = provisioning_service.CreateApiHubInstanceRequest( parent="parent_value", api_hub_instance_id="api_hub_instance_id_value", ) + assert args[0] == request_msg def test_create_api_hub_instance_use_cached_wrapped_rpc(): @@ -1451,9 +1468,15 @@ async def test_create_api_hub_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + provisioning_service.CreateApiHubInstanceRequest(), + {}, + ], +) async def test_create_api_hub_instance_async( - transport: str = "grpc_asyncio", - request_type=provisioning_service.CreateApiHubInstanceRequest, + request_type, transport: str = "grpc_asyncio" ): client = ProvisioningAsyncClient( credentials=async_anonymous_credentials(), @@ -1462,7 +1485,7 @@ async def test_create_api_hub_instance_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( @@ -1484,11 +1507,6 @@ async def test_create_api_hub_instance_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_api_hub_instance_async_from_dict(): - await test_create_api_hub_instance_async(request_type=dict) - - def test_create_api_hub_instance_field_headers(): client = ProvisioningClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1663,8 +1681,8 @@ async def test_create_api_hub_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - provisioning_service.DeleteApiHubInstanceRequest, - dict, + provisioning_service.DeleteApiHubInstanceRequest(), + {}, ], ) def test_delete_api_hub_instance(request_type, transport: str = "grpc"): @@ -1675,7 +1693,7 @@ def test_delete_api_hub_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( @@ -1720,9 +1738,10 @@ def test_delete_api_hub_instance_non_empty_request_with_auto_populated_field(): client.delete_api_hub_instance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == provisioning_service.DeleteApiHubInstanceRequest( + request_msg = provisioning_service.DeleteApiHubInstanceRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_api_hub_instance_use_cached_wrapped_rpc(): @@ -1818,9 +1837,15 @@ async def test_delete_api_hub_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + provisioning_service.DeleteApiHubInstanceRequest(), + {}, + ], +) async def test_delete_api_hub_instance_async( - transport: str = "grpc_asyncio", - request_type=provisioning_service.DeleteApiHubInstanceRequest, + request_type, transport: str = "grpc_asyncio" ): client = ProvisioningAsyncClient( credentials=async_anonymous_credentials(), @@ -1829,7 +1854,7 @@ async def test_delete_api_hub_instance_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( @@ -1851,11 +1876,6 @@ async def test_delete_api_hub_instance_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_api_hub_instance_async_from_dict(): - await test_delete_api_hub_instance_async(request_type=dict) - - def test_delete_api_hub_instance_field_headers(): client = ProvisioningClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2010,8 +2030,8 @@ async def test_delete_api_hub_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - provisioning_service.GetApiHubInstanceRequest, - dict, + provisioning_service.GetApiHubInstanceRequest(), + {}, ], ) def test_get_api_hub_instance(request_type, transport: str = "grpc"): @@ -2022,7 +2042,7 @@ def test_get_api_hub_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( @@ -2076,9 +2096,10 @@ def test_get_api_hub_instance_non_empty_request_with_auto_populated_field(): client.get_api_hub_instance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == provisioning_service.GetApiHubInstanceRequest( + request_msg = provisioning_service.GetApiHubInstanceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_api_hub_instance_use_cached_wrapped_rpc(): @@ -2163,9 +2184,15 @@ async def test_get_api_hub_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + provisioning_service.GetApiHubInstanceRequest(), + {}, + ], +) async def test_get_api_hub_instance_async( - transport: str = "grpc_asyncio", - request_type=provisioning_service.GetApiHubInstanceRequest, + request_type, transport: str = "grpc_asyncio" ): client = ProvisioningAsyncClient( credentials=async_anonymous_credentials(), @@ -2174,7 +2201,7 @@ async def test_get_api_hub_instance_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( @@ -2205,11 +2232,6 @@ async def test_get_api_hub_instance_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_get_api_hub_instance_async_from_dict(): - await test_get_api_hub_instance_async(request_type=dict) - - def test_get_api_hub_instance_field_headers(): client = ProvisioningClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2364,8 +2386,8 @@ async def test_get_api_hub_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - provisioning_service.LookupApiHubInstanceRequest, - dict, + provisioning_service.LookupApiHubInstanceRequest(), + {}, ], ) def test_lookup_api_hub_instance(request_type, transport: str = "grpc"): @@ -2376,7 +2398,7 @@ def test_lookup_api_hub_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( @@ -2421,9 +2443,10 @@ def test_lookup_api_hub_instance_non_empty_request_with_auto_populated_field(): client.lookup_api_hub_instance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == provisioning_service.LookupApiHubInstanceRequest( + request_msg = provisioning_service.LookupApiHubInstanceRequest( parent="parent_value", ) + assert args[0] == request_msg def test_lookup_api_hub_instance_use_cached_wrapped_rpc(): @@ -2509,9 +2532,15 @@ async def test_lookup_api_hub_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + provisioning_service.LookupApiHubInstanceRequest(), + {}, + ], +) async def test_lookup_api_hub_instance_async( - transport: str = "grpc_asyncio", - request_type=provisioning_service.LookupApiHubInstanceRequest, + request_type, transport: str = "grpc_asyncio" ): client = ProvisioningAsyncClient( credentials=async_anonymous_credentials(), @@ -2520,7 +2549,7 @@ async def test_lookup_api_hub_instance_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( @@ -2542,11 +2571,6 @@ async def test_lookup_api_hub_instance_async( assert isinstance(response, provisioning_service.LookupApiHubInstanceResponse) -@pytest.mark.asyncio -async def test_lookup_api_hub_instance_async_from_dict(): - await test_lookup_api_hub_instance_async(request_type=dict) - - def test_lookup_api_hub_instance_field_headers(): client = ProvisioningClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3575,7 +3599,6 @@ def test_create_api_hub_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = provisioning_service.CreateApiHubInstanceRequest() - assert args[0] == request_msg @@ -3598,7 +3621,6 @@ def test_delete_api_hub_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = provisioning_service.DeleteApiHubInstanceRequest() - assert args[0] == request_msg @@ -3621,7 +3643,6 @@ def test_get_api_hub_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = provisioning_service.GetApiHubInstanceRequest() - assert args[0] == request_msg @@ -3644,7 +3665,6 @@ def test_lookup_api_hub_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = provisioning_service.LookupApiHubInstanceRequest() - assert args[0] == request_msg @@ -3685,7 +3705,6 @@ async def test_create_api_hub_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = provisioning_service.CreateApiHubInstanceRequest() - assert args[0] == request_msg @@ -3712,7 +3731,6 @@ async def test_delete_api_hub_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = provisioning_service.DeleteApiHubInstanceRequest() - assert args[0] == request_msg @@ -3744,7 +3762,6 @@ async def test_get_api_hub_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = provisioning_service.GetApiHubInstanceRequest() - assert args[0] == request_msg @@ -3771,7 +3788,6 @@ async def test_lookup_api_hub_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = provisioning_service.LookupApiHubInstanceRequest() - assert args[0] == request_msg @@ -4799,7 +4815,6 @@ def test_create_api_hub_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = provisioning_service.CreateApiHubInstanceRequest() - assert args[0] == request_msg @@ -4821,7 +4836,6 @@ def test_delete_api_hub_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = provisioning_service.DeleteApiHubInstanceRequest() - assert args[0] == request_msg @@ -4843,7 +4857,6 @@ def test_get_api_hub_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = provisioning_service.GetApiHubInstanceRequest() - assert args[0] == request_msg @@ -4865,7 +4878,6 @@ def test_lookup_api_hub_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = provisioning_service.LookupApiHubInstanceRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-apihub/tests/unit/gapic/apihub_v1/test_runtime_project_attachment_service.py b/packages/google-cloud-apihub/tests/unit/gapic/apihub_v1/test_runtime_project_attachment_service.py index 27800118a5f7..8d349bd07212 100644 --- a/packages/google-cloud-apihub/tests/unit/gapic/apihub_v1/test_runtime_project_attachment_service.py +++ b/packages/google-cloud-apihub/tests/unit/gapic/apihub_v1/test_runtime_project_attachment_service.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 @@ -110,6 +111,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" @@ -1447,8 +1463,8 @@ def test_runtime_project_attachment_service_client_create_channel_credentials_fi @pytest.mark.parametrize( "request_type", [ - runtime_project_attachment_service.CreateRuntimeProjectAttachmentRequest, - dict, + runtime_project_attachment_service.CreateRuntimeProjectAttachmentRequest(), + {}, ], ) def test_create_runtime_project_attachment(request_type, transport: str = "grpc"): @@ -1459,7 +1475,7 @@ def test_create_runtime_project_attachment(request_type, transport: str = "grpc" # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1514,12 +1530,13 @@ def test_create_runtime_project_attachment_non_empty_request_with_auto_populated client.create_runtime_project_attachment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == runtime_project_attachment_service.CreateRuntimeProjectAttachmentRequest( - parent="parent_value", - runtime_project_attachment_id="runtime_project_attachment_id_value", + request_msg = ( + runtime_project_attachment_service.CreateRuntimeProjectAttachmentRequest( + parent="parent_value", + runtime_project_attachment_id="runtime_project_attachment_id_value", + ) ) + assert args[0] == request_msg def test_create_runtime_project_attachment_use_cached_wrapped_rpc(): @@ -1605,9 +1622,15 @@ async def test_create_runtime_project_attachment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + runtime_project_attachment_service.CreateRuntimeProjectAttachmentRequest(), + {}, + ], +) async def test_create_runtime_project_attachment_async( - transport: str = "grpc_asyncio", - request_type=runtime_project_attachment_service.CreateRuntimeProjectAttachmentRequest, + request_type, transport: str = "grpc_asyncio" ): client = RuntimeProjectAttachmentServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1616,7 +1639,7 @@ async def test_create_runtime_project_attachment_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( @@ -1647,11 +1670,6 @@ async def test_create_runtime_project_attachment_async( assert response.runtime_project == "runtime_project_value" -@pytest.mark.asyncio -async def test_create_runtime_project_attachment_async_from_dict(): - await test_create_runtime_project_attachment_async(request_type=dict) - - def test_create_runtime_project_attachment_field_headers(): client = RuntimeProjectAttachmentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1844,8 +1862,8 @@ async def test_create_runtime_project_attachment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - runtime_project_attachment_service.GetRuntimeProjectAttachmentRequest, - dict, + runtime_project_attachment_service.GetRuntimeProjectAttachmentRequest(), + {}, ], ) def test_get_runtime_project_attachment(request_type, transport: str = "grpc"): @@ -1856,7 +1874,7 @@ def test_get_runtime_project_attachment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1910,11 +1928,12 @@ def test_get_runtime_project_attachment_non_empty_request_with_auto_populated_fi client.get_runtime_project_attachment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == runtime_project_attachment_service.GetRuntimeProjectAttachmentRequest( - name="name_value", + request_msg = ( + runtime_project_attachment_service.GetRuntimeProjectAttachmentRequest( + name="name_value", + ) ) + assert args[0] == request_msg def test_get_runtime_project_attachment_use_cached_wrapped_rpc(): @@ -2000,9 +2019,15 @@ async def test_get_runtime_project_attachment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + runtime_project_attachment_service.GetRuntimeProjectAttachmentRequest(), + {}, + ], +) async def test_get_runtime_project_attachment_async( - transport: str = "grpc_asyncio", - request_type=runtime_project_attachment_service.GetRuntimeProjectAttachmentRequest, + request_type, transport: str = "grpc_asyncio" ): client = RuntimeProjectAttachmentServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2011,7 +2036,7 @@ async def test_get_runtime_project_attachment_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( @@ -2042,11 +2067,6 @@ async def test_get_runtime_project_attachment_async( assert response.runtime_project == "runtime_project_value" -@pytest.mark.asyncio -async def test_get_runtime_project_attachment_async_from_dict(): - await test_get_runtime_project_attachment_async(request_type=dict) - - def test_get_runtime_project_attachment_field_headers(): client = RuntimeProjectAttachmentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2207,8 +2227,8 @@ async def test_get_runtime_project_attachment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - runtime_project_attachment_service.ListRuntimeProjectAttachmentsRequest, - dict, + runtime_project_attachment_service.ListRuntimeProjectAttachmentsRequest(), + {}, ], ) def test_list_runtime_project_attachments(request_type, transport: str = "grpc"): @@ -2219,7 +2239,7 @@ def test_list_runtime_project_attachments(request_type, transport: str = "grpc") # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2274,14 +2294,15 @@ def test_list_runtime_project_attachments_non_empty_request_with_auto_populated_ client.list_runtime_project_attachments(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == runtime_project_attachment_service.ListRuntimeProjectAttachmentsRequest( - parent="parent_value", - page_token="page_token_value", - filter="filter_value", - order_by="order_by_value", + request_msg = ( + runtime_project_attachment_service.ListRuntimeProjectAttachmentsRequest( + parent="parent_value", + page_token="page_token_value", + filter="filter_value", + order_by="order_by_value", + ) ) + assert args[0] == request_msg def test_list_runtime_project_attachments_use_cached_wrapped_rpc(): @@ -2367,9 +2388,15 @@ async def test_list_runtime_project_attachments_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + runtime_project_attachment_service.ListRuntimeProjectAttachmentsRequest(), + {}, + ], +) async def test_list_runtime_project_attachments_async( - transport: str = "grpc_asyncio", - request_type=runtime_project_attachment_service.ListRuntimeProjectAttachmentsRequest, + request_type, transport: str = "grpc_asyncio" ): client = RuntimeProjectAttachmentServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2378,7 +2405,7 @@ async def test_list_runtime_project_attachments_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( @@ -2405,11 +2432,6 @@ async def test_list_runtime_project_attachments_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_runtime_project_attachments_async_from_dict(): - await test_list_runtime_project_attachments_async(request_type=dict) - - def test_list_runtime_project_attachments_field_headers(): client = RuntimeProjectAttachmentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2778,8 +2800,8 @@ async def test_list_runtime_project_attachments_async_pages(): @pytest.mark.parametrize( "request_type", [ - runtime_project_attachment_service.DeleteRuntimeProjectAttachmentRequest, - dict, + runtime_project_attachment_service.DeleteRuntimeProjectAttachmentRequest(), + {}, ], ) def test_delete_runtime_project_attachment(request_type, transport: str = "grpc"): @@ -2790,7 +2812,7 @@ def test_delete_runtime_project_attachment(request_type, transport: str = "grpc" # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2837,11 +2859,12 @@ def test_delete_runtime_project_attachment_non_empty_request_with_auto_populated client.delete_runtime_project_attachment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == runtime_project_attachment_service.DeleteRuntimeProjectAttachmentRequest( - name="name_value", + request_msg = ( + runtime_project_attachment_service.DeleteRuntimeProjectAttachmentRequest( + name="name_value", + ) ) + assert args[0] == request_msg def test_delete_runtime_project_attachment_use_cached_wrapped_rpc(): @@ -2927,9 +2950,15 @@ async def test_delete_runtime_project_attachment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + runtime_project_attachment_service.DeleteRuntimeProjectAttachmentRequest(), + {}, + ], +) async def test_delete_runtime_project_attachment_async( - transport: str = "grpc_asyncio", - request_type=runtime_project_attachment_service.DeleteRuntimeProjectAttachmentRequest, + request_type, transport: str = "grpc_asyncio" ): client = RuntimeProjectAttachmentServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2938,7 +2967,7 @@ async def test_delete_runtime_project_attachment_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( @@ -2960,11 +2989,6 @@ async def test_delete_runtime_project_attachment_async( assert response is None -@pytest.mark.asyncio -async def test_delete_runtime_project_attachment_async_from_dict(): - await test_delete_runtime_project_attachment_async(request_type=dict) - - def test_delete_runtime_project_attachment_field_headers(): client = RuntimeProjectAttachmentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3115,8 +3139,8 @@ async def test_delete_runtime_project_attachment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - runtime_project_attachment_service.LookupRuntimeProjectAttachmentRequest, - dict, + runtime_project_attachment_service.LookupRuntimeProjectAttachmentRequest(), + {}, ], ) def test_lookup_runtime_project_attachment(request_type, transport: str = "grpc"): @@ -3127,7 +3151,7 @@ def test_lookup_runtime_project_attachment(request_type, transport: str = "grpc" # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3179,11 +3203,12 @@ def test_lookup_runtime_project_attachment_non_empty_request_with_auto_populated client.lookup_runtime_project_attachment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == runtime_project_attachment_service.LookupRuntimeProjectAttachmentRequest( - name="name_value", + request_msg = ( + runtime_project_attachment_service.LookupRuntimeProjectAttachmentRequest( + name="name_value", + ) ) + assert args[0] == request_msg def test_lookup_runtime_project_attachment_use_cached_wrapped_rpc(): @@ -3269,9 +3294,15 @@ async def test_lookup_runtime_project_attachment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + runtime_project_attachment_service.LookupRuntimeProjectAttachmentRequest(), + {}, + ], +) async def test_lookup_runtime_project_attachment_async( - transport: str = "grpc_asyncio", - request_type=runtime_project_attachment_service.LookupRuntimeProjectAttachmentRequest, + request_type, transport: str = "grpc_asyncio" ): client = RuntimeProjectAttachmentServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3280,7 +3311,7 @@ async def test_lookup_runtime_project_attachment_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( @@ -3307,11 +3338,6 @@ async def test_lookup_runtime_project_attachment_async( ) -@pytest.mark.asyncio -async def test_lookup_runtime_project_attachment_async_from_dict(): - await test_lookup_runtime_project_attachment_async(request_type=dict) - - def test_lookup_runtime_project_attachment_field_headers(): client = RuntimeProjectAttachmentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4689,7 +4715,6 @@ def test_create_runtime_project_attachment_empty_call_grpc(): request_msg = ( runtime_project_attachment_service.CreateRuntimeProjectAttachmentRequest() ) - assert args[0] == request_msg @@ -4716,7 +4741,6 @@ def test_get_runtime_project_attachment_empty_call_grpc(): request_msg = ( runtime_project_attachment_service.GetRuntimeProjectAttachmentRequest() ) - assert args[0] == request_msg @@ -4743,7 +4767,6 @@ def test_list_runtime_project_attachments_empty_call_grpc(): request_msg = ( runtime_project_attachment_service.ListRuntimeProjectAttachmentsRequest() ) - assert args[0] == request_msg @@ -4768,7 +4791,6 @@ def test_delete_runtime_project_attachment_empty_call_grpc(): request_msg = ( runtime_project_attachment_service.DeleteRuntimeProjectAttachmentRequest() ) - assert args[0] == request_msg @@ -4795,7 +4817,6 @@ def test_lookup_runtime_project_attachment_empty_call_grpc(): request_msg = ( runtime_project_attachment_service.LookupRuntimeProjectAttachmentRequest() ) - assert args[0] == request_msg @@ -4841,7 +4862,6 @@ async def test_create_runtime_project_attachment_empty_call_grpc_asyncio(): request_msg = ( runtime_project_attachment_service.CreateRuntimeProjectAttachmentRequest() ) - assert args[0] == request_msg @@ -4873,7 +4893,6 @@ async def test_get_runtime_project_attachment_empty_call_grpc_asyncio(): request_msg = ( runtime_project_attachment_service.GetRuntimeProjectAttachmentRequest() ) - assert args[0] == request_msg @@ -4904,7 +4923,6 @@ async def test_list_runtime_project_attachments_empty_call_grpc_asyncio(): request_msg = ( runtime_project_attachment_service.ListRuntimeProjectAttachmentsRequest() ) - assert args[0] == request_msg @@ -4931,7 +4949,6 @@ async def test_delete_runtime_project_attachment_empty_call_grpc_asyncio(): request_msg = ( runtime_project_attachment_service.DeleteRuntimeProjectAttachmentRequest() ) - assert args[0] == request_msg @@ -4960,7 +4977,6 @@ async def test_lookup_runtime_project_attachment_empty_call_grpc_asyncio(): request_msg = ( runtime_project_attachment_service.LookupRuntimeProjectAttachmentRequest() ) - assert args[0] == request_msg @@ -6167,7 +6183,6 @@ def test_create_runtime_project_attachment_empty_call_rest(): request_msg = ( runtime_project_attachment_service.CreateRuntimeProjectAttachmentRequest() ) - assert args[0] == request_msg @@ -6191,7 +6206,6 @@ def test_get_runtime_project_attachment_empty_call_rest(): request_msg = ( runtime_project_attachment_service.GetRuntimeProjectAttachmentRequest() ) - assert args[0] == request_msg @@ -6215,7 +6229,6 @@ def test_list_runtime_project_attachments_empty_call_rest(): request_msg = ( runtime_project_attachment_service.ListRuntimeProjectAttachmentsRequest() ) - assert args[0] == request_msg @@ -6239,7 +6252,6 @@ def test_delete_runtime_project_attachment_empty_call_rest(): request_msg = ( runtime_project_attachment_service.DeleteRuntimeProjectAttachmentRequest() ) - assert args[0] == request_msg @@ -6263,7 +6275,6 @@ def test_lookup_runtime_project_attachment_empty_call_rest(): request_msg = ( runtime_project_attachment_service.LookupRuntimeProjectAttachmentRequest() ) - assert args[0] == request_msg diff --git a/packages/google-cloud-apiregistry/noxfile.py b/packages/google-cloud-apiregistry/noxfile.py index 09a0177d8b1c..eea4a81bee54 100644 --- a/packages/google-cloud-apiregistry/noxfile.py +++ b/packages/google-cloud-apiregistry/noxfile.py @@ -47,7 +47,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-apiregistry" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-apiregistry/setup.py b/packages/google-cloud-apiregistry/setup.py index 698c33282650..5c9a2841ab1c 100644 --- a/packages/google-cloud-apiregistry/setup.py +++ b/packages/google-cloud-apiregistry/setup.py @@ -45,7 +45,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/google-cloud-apiregistry/testing/constraints-3.10.txt b/packages/google-cloud-apiregistry/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-apiregistry/testing/constraints-3.10.txt +++ b/packages/google-cloud-apiregistry/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-apiregistry/tests/unit/gapic/apiregistry_v1beta/test_cloud_api_registry.py b/packages/google-cloud-apiregistry/tests/unit/gapic/apiregistry_v1beta/test_cloud_api_registry.py index 8a6c8a76ed75..75819d8911d3 100644 --- a/packages/google-cloud-apiregistry/tests/unit/gapic/apiregistry_v1beta/test_cloud_api_registry.py +++ b/packages/google-cloud-apiregistry/tests/unit/gapic/apiregistry_v1beta/test_cloud_api_registry.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 @@ -109,6 +110,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" @@ -1342,8 +1358,8 @@ def test_cloud_api_registry_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - service.GetMcpServerRequest, - dict, + service.GetMcpServerRequest(), + {}, ], ) def test_get_mcp_server(request_type, transport: str = "grpc"): @@ -1354,7 +1370,7 @@ def test_get_mcp_server(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_mcp_server), "__call__") as call: @@ -1406,9 +1422,10 @@ def test_get_mcp_server_non_empty_request_with_auto_populated_field(): client.get_mcp_server(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetMcpServerRequest( + request_msg = service.GetMcpServerRequest( name="name_value", ) + assert args[0] == request_msg def test_get_mcp_server_use_cached_wrapped_rpc(): @@ -1489,9 +1506,14 @@ async def test_get_mcp_server_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_mcp_server_async( - transport: str = "grpc_asyncio", request_type=service.GetMcpServerRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetMcpServerRequest(), + {}, + ], +) +async def test_get_mcp_server_async(request_type, transport: str = "grpc_asyncio"): client = CloudApiRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1499,7 +1521,7 @@ async def test_get_mcp_server_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_mcp_server), "__call__") as call: @@ -1530,11 +1552,6 @@ async def test_get_mcp_server_async( assert response.state == common.State.ENABLED -@pytest.mark.asyncio -async def test_get_mcp_server_async_from_dict(): - await test_get_mcp_server_async(request_type=dict) - - def test_get_mcp_server_field_headers(): client = CloudApiRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1677,8 +1694,8 @@ async def test_get_mcp_server_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListMcpServersRequest, - dict, + service.ListMcpServersRequest(), + {}, ], ) def test_list_mcp_servers(request_type, transport: str = "grpc"): @@ -1689,7 +1706,7 @@ def test_list_mcp_servers(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_mcp_servers), "__call__") as call: @@ -1738,12 +1755,13 @@ def test_list_mcp_servers_non_empty_request_with_auto_populated_field(): client.list_mcp_servers(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListMcpServersRequest( + request_msg = service.ListMcpServersRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_mcp_servers_use_cached_wrapped_rpc(): @@ -1826,9 +1844,14 @@ async def test_list_mcp_servers_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_mcp_servers_async( - transport: str = "grpc_asyncio", request_type=service.ListMcpServersRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListMcpServersRequest(), + {}, + ], +) +async def test_list_mcp_servers_async(request_type, transport: str = "grpc_asyncio"): client = CloudApiRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1836,7 +1859,7 @@ async def test_list_mcp_servers_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_mcp_servers), "__call__") as call: @@ -1861,11 +1884,6 @@ async def test_list_mcp_servers_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_mcp_servers_async_from_dict(): - await test_list_mcp_servers_async(request_type=dict) - - def test_list_mcp_servers_field_headers(): client = CloudApiRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2202,8 +2220,8 @@ async def test_list_mcp_servers_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetMcpToolRequest, - dict, + service.GetMcpToolRequest(), + {}, ], ) def test_get_mcp_tool(request_type, transport: str = "grpc"): @@ -2214,7 +2232,7 @@ def test_get_mcp_tool(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_mcp_tool), "__call__") as call: @@ -2264,9 +2282,10 @@ def test_get_mcp_tool_non_empty_request_with_auto_populated_field(): client.get_mcp_tool(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetMcpToolRequest( + request_msg = service.GetMcpToolRequest( name="name_value", ) + assert args[0] == request_msg def test_get_mcp_tool_use_cached_wrapped_rpc(): @@ -2347,9 +2366,14 @@ async def test_get_mcp_tool_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_mcp_tool_async( - transport: str = "grpc_asyncio", request_type=service.GetMcpToolRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetMcpToolRequest(), + {}, + ], +) +async def test_get_mcp_tool_async(request_type, transport: str = "grpc_asyncio"): client = CloudApiRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2357,7 +2381,7 @@ async def test_get_mcp_tool_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_mcp_tool), "__call__") as call: @@ -2386,11 +2410,6 @@ async def test_get_mcp_tool_async( assert response.mcp_server_urls == ["mcp_server_urls_value"] -@pytest.mark.asyncio -async def test_get_mcp_tool_async_from_dict(): - await test_get_mcp_tool_async(request_type=dict) - - def test_get_mcp_tool_field_headers(): client = CloudApiRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2533,8 +2552,8 @@ async def test_get_mcp_tool_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListMcpToolsRequest, - dict, + service.ListMcpToolsRequest(), + {}, ], ) def test_list_mcp_tools(request_type, transport: str = "grpc"): @@ -2545,7 +2564,7 @@ def test_list_mcp_tools(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_mcp_tools), "__call__") as call: @@ -2594,12 +2613,13 @@ def test_list_mcp_tools_non_empty_request_with_auto_populated_field(): client.list_mcp_tools(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListMcpToolsRequest( + request_msg = service.ListMcpToolsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_mcp_tools_use_cached_wrapped_rpc(): @@ -2680,9 +2700,14 @@ async def test_list_mcp_tools_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_mcp_tools_async( - transport: str = "grpc_asyncio", request_type=service.ListMcpToolsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListMcpToolsRequest(), + {}, + ], +) +async def test_list_mcp_tools_async(request_type, transport: str = "grpc_asyncio"): client = CloudApiRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2690,7 +2715,7 @@ async def test_list_mcp_tools_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_mcp_tools), "__call__") as call: @@ -2715,11 +2740,6 @@ async def test_list_mcp_tools_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_mcp_tools_async_from_dict(): - await test_list_mcp_tools_async(request_type=dict) - - def test_list_mcp_tools_field_headers(): client = CloudApiRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4052,7 +4072,6 @@ def test_get_mcp_server_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetMcpServerRequest() - assert args[0] == request_msg @@ -4073,7 +4092,6 @@ def test_list_mcp_servers_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListMcpServersRequest() - assert args[0] == request_msg @@ -4094,7 +4112,6 @@ def test_get_mcp_tool_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetMcpToolRequest() - assert args[0] == request_msg @@ -4115,7 +4132,6 @@ def test_list_mcp_tools_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListMcpToolsRequest() - assert args[0] == request_msg @@ -4160,7 +4176,6 @@ async def test_get_mcp_server_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetMcpServerRequest() - assert args[0] == request_msg @@ -4188,7 +4203,6 @@ async def test_list_mcp_servers_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListMcpServersRequest() - assert args[0] == request_msg @@ -4218,7 +4232,6 @@ async def test_get_mcp_tool_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetMcpToolRequest() - assert args[0] == request_msg @@ -4246,7 +4259,6 @@ async def test_list_mcp_tools_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListMcpToolsRequest() - assert args[0] == request_msg @@ -4936,7 +4948,6 @@ def test_get_mcp_server_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetMcpServerRequest() - assert args[0] == request_msg @@ -4956,7 +4967,6 @@ def test_list_mcp_servers_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListMcpServersRequest() - assert args[0] == request_msg @@ -4976,7 +4986,6 @@ def test_get_mcp_tool_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetMcpToolRequest() - assert args[0] == request_msg @@ -4996,7 +5005,6 @@ def test_list_mcp_tools_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListMcpToolsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-appengine-admin/noxfile.py b/packages/google-cloud-appengine-admin/noxfile.py index 7a4c7310153b..ab3410edfff2 100644 --- a/packages/google-cloud-appengine-admin/noxfile.py +++ b/packages/google-cloud-appengine-admin/noxfile.py @@ -47,7 +47,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-appengine-admin" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-appengine-admin/setup.py b/packages/google-cloud-appengine-admin/setup.py index 455628185fb1..14d844e106b8 100644 --- a/packages/google-cloud-appengine-admin/setup.py +++ b/packages/google-cloud-appengine-admin/setup.py @@ -45,7 +45,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/google-cloud-appengine-admin/testing/constraints-3.10.txt b/packages/google-cloud-appengine-admin/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-appengine-admin/testing/constraints-3.10.txt +++ b/packages/google-cloud-appengine-admin/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-appengine-admin/tests/unit/gapic/appengine_admin_v1/test_applications.py b/packages/google-cloud-appengine-admin/tests/unit/gapic/appengine_admin_v1/test_applications.py index c96b1cc148f6..89282c34f1b5 100644 --- a/packages/google-cloud-appengine-admin/tests/unit/gapic/appengine_admin_v1/test_applications.py +++ b/packages/google-cloud-appengine-admin/tests/unit/gapic/appengine_admin_v1/test_applications.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 @@ -114,6 +115,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" @@ -1298,8 +1314,8 @@ def test_applications_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - appengine.GetApplicationRequest, - dict, + appengine.GetApplicationRequest(), + {}, ], ) def test_get_application(request_type, transport: str = "grpc"): @@ -1310,7 +1326,7 @@ def test_get_application(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_application), "__call__") as call: @@ -1376,9 +1392,10 @@ def test_get_application_non_empty_request_with_auto_populated_field(): client.get_application(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == appengine.GetApplicationRequest( + request_msg = appengine.GetApplicationRequest( name="name_value", ) + assert args[0] == request_msg def test_get_application_use_cached_wrapped_rpc(): @@ -1459,9 +1476,14 @@ async def test_get_application_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_application_async( - transport: str = "grpc_asyncio", request_type=appengine.GetApplicationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + appengine.GetApplicationRequest(), + {}, + ], +) +async def test_get_application_async(request_type, transport: str = "grpc_asyncio"): client = ApplicationsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1469,7 +1491,7 @@ async def test_get_application_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_application), "__call__") as call: @@ -1514,11 +1536,6 @@ async def test_get_application_async( ) -@pytest.mark.asyncio -async def test_get_application_async_from_dict(): - await test_get_application_async(request_type=dict) - - def test_get_application_field_headers(): client = ApplicationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1665,8 +1682,8 @@ async def test_get_application_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - appengine.CreateApplicationRequest, - dict, + appengine.CreateApplicationRequest(), + {}, ], ) def test_create_application(request_type, transport: str = "grpc"): @@ -1677,7 +1694,7 @@ def test_create_application(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1720,7 +1737,8 @@ def test_create_application_non_empty_request_with_auto_populated_field(): client.create_application(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == appengine.CreateApplicationRequest() + request_msg = appengine.CreateApplicationRequest() + assert args[0] == request_msg def test_create_application_use_cached_wrapped_rpc(): @@ -1815,9 +1833,14 @@ async def test_create_application_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_application_async( - transport: str = "grpc_asyncio", request_type=appengine.CreateApplicationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + appengine.CreateApplicationRequest(), + {}, + ], +) +async def test_create_application_async(request_type, transport: str = "grpc_asyncio"): client = ApplicationsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1825,7 +1848,7 @@ async def test_create_application_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( @@ -1847,16 +1870,11 @@ async def test_create_application_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_application_async_from_dict(): - await test_create_application_async(request_type=dict) - - @pytest.mark.parametrize( "request_type", [ - appengine.UpdateApplicationRequest, - dict, + appengine.UpdateApplicationRequest(), + {}, ], ) def test_update_application(request_type, transport: str = "grpc"): @@ -1867,7 +1885,7 @@ def test_update_application(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1912,9 +1930,10 @@ def test_update_application_non_empty_request_with_auto_populated_field(): client.update_application(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == appengine.UpdateApplicationRequest( + request_msg = appengine.UpdateApplicationRequest( name="name_value", ) + assert args[0] == request_msg def test_update_application_use_cached_wrapped_rpc(): @@ -2009,9 +2028,14 @@ async def test_update_application_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_application_async( - transport: str = "grpc_asyncio", request_type=appengine.UpdateApplicationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + appengine.UpdateApplicationRequest(), + {}, + ], +) +async def test_update_application_async(request_type, transport: str = "grpc_asyncio"): client = ApplicationsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2019,7 +2043,7 @@ async def test_update_application_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( @@ -2041,11 +2065,6 @@ async def test_update_application_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_application_async_from_dict(): - await test_update_application_async(request_type=dict) - - def test_update_application_field_headers(): client = ApplicationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2114,8 +2133,8 @@ async def test_update_application_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - appengine.RepairApplicationRequest, - dict, + appengine.RepairApplicationRequest(), + {}, ], ) def test_repair_application(request_type, transport: str = "grpc"): @@ -2126,7 +2145,7 @@ def test_repair_application(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2171,9 +2190,10 @@ def test_repair_application_non_empty_request_with_auto_populated_field(): client.repair_application(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == appengine.RepairApplicationRequest( + request_msg = appengine.RepairApplicationRequest( name="name_value", ) + assert args[0] == request_msg def test_repair_application_use_cached_wrapped_rpc(): @@ -2268,9 +2288,14 @@ async def test_repair_application_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_repair_application_async( - transport: str = "grpc_asyncio", request_type=appengine.RepairApplicationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + appengine.RepairApplicationRequest(), + {}, + ], +) +async def test_repair_application_async(request_type, transport: str = "grpc_asyncio"): client = ApplicationsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2278,7 +2303,7 @@ async def test_repair_application_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( @@ -2300,11 +2325,6 @@ async def test_repair_application_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_repair_application_async_from_dict(): - await test_repair_application_async(request_type=dict) - - def test_repair_application_field_headers(): client = ApplicationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2717,7 +2737,6 @@ def test_get_application_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.GetApplicationRequest() - assert args[0] == request_msg @@ -2740,7 +2759,6 @@ def test_create_application_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.CreateApplicationRequest() - assert args[0] == request_msg @@ -2763,7 +2781,6 @@ def test_update_application_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.UpdateApplicationRequest() - assert args[0] == request_msg @@ -2786,7 +2803,6 @@ def test_repair_application_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.RepairApplicationRequest() - assert args[0] == request_msg @@ -2837,7 +2853,6 @@ async def test_get_application_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.GetApplicationRequest() - assert args[0] == request_msg @@ -2864,7 +2879,6 @@ async def test_create_application_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.CreateApplicationRequest() - assert args[0] == request_msg @@ -2891,7 +2905,6 @@ async def test_update_application_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.UpdateApplicationRequest() - assert args[0] == request_msg @@ -2918,7 +2931,6 @@ async def test_repair_application_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.RepairApplicationRequest() - assert args[0] == request_msg @@ -3668,7 +3680,6 @@ def test_get_application_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.GetApplicationRequest() - assert args[0] == request_msg @@ -3690,7 +3701,6 @@ def test_create_application_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.CreateApplicationRequest() - assert args[0] == request_msg @@ -3712,7 +3722,6 @@ def test_update_application_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.UpdateApplicationRequest() - assert args[0] == request_msg @@ -3734,7 +3743,6 @@ def test_repair_application_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.RepairApplicationRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-appengine-admin/tests/unit/gapic/appengine_admin_v1/test_authorized_certificates.py b/packages/google-cloud-appengine-admin/tests/unit/gapic/appengine_admin_v1/test_authorized_certificates.py index 3f6d88add1c5..5378f4535dc3 100644 --- a/packages/google-cloud-appengine-admin/tests/unit/gapic/appengine_admin_v1/test_authorized_certificates.py +++ b/packages/google-cloud-appengine-admin/tests/unit/gapic/appengine_admin_v1/test_authorized_certificates.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 @@ -109,6 +110,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" @@ -1380,8 +1396,8 @@ def test_authorized_certificates_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - appengine.ListAuthorizedCertificatesRequest, - dict, + appengine.ListAuthorizedCertificatesRequest(), + {}, ], ) def test_list_authorized_certificates(request_type, transport: str = "grpc"): @@ -1392,7 +1408,7 @@ def test_list_authorized_certificates(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1441,10 +1457,11 @@ def test_list_authorized_certificates_non_empty_request_with_auto_populated_fiel client.list_authorized_certificates(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == appengine.ListAuthorizedCertificatesRequest( + request_msg = appengine.ListAuthorizedCertificatesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_authorized_certificates_use_cached_wrapped_rpc(): @@ -1530,9 +1547,15 @@ async def test_list_authorized_certificates_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + appengine.ListAuthorizedCertificatesRequest(), + {}, + ], +) async def test_list_authorized_certificates_async( - transport: str = "grpc_asyncio", - request_type=appengine.ListAuthorizedCertificatesRequest, + request_type, transport: str = "grpc_asyncio" ): client = AuthorizedCertificatesAsyncClient( credentials=async_anonymous_credentials(), @@ -1541,7 +1564,7 @@ async def test_list_authorized_certificates_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( @@ -1566,11 +1589,6 @@ async def test_list_authorized_certificates_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_authorized_certificates_async_from_dict(): - await test_list_authorized_certificates_async(request_type=dict) - - def test_list_authorized_certificates_field_headers(): client = AuthorizedCertificatesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1841,8 +1859,8 @@ async def test_list_authorized_certificates_async_pages(): @pytest.mark.parametrize( "request_type", [ - appengine.GetAuthorizedCertificateRequest, - dict, + appengine.GetAuthorizedCertificateRequest(), + {}, ], ) def test_get_authorized_certificate(request_type, transport: str = "grpc"): @@ -1853,7 +1871,7 @@ def test_get_authorized_certificate(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1911,9 +1929,10 @@ def test_get_authorized_certificate_non_empty_request_with_auto_populated_field( client.get_authorized_certificate(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == appengine.GetAuthorizedCertificateRequest( + request_msg = appengine.GetAuthorizedCertificateRequest( name="name_value", ) + assert args[0] == request_msg def test_get_authorized_certificate_use_cached_wrapped_rpc(): @@ -1999,9 +2018,15 @@ async def test_get_authorized_certificate_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + appengine.GetAuthorizedCertificateRequest(), + {}, + ], +) async def test_get_authorized_certificate_async( - transport: str = "grpc_asyncio", - request_type=appengine.GetAuthorizedCertificateRequest, + request_type, transport: str = "grpc_asyncio" ): client = AuthorizedCertificatesAsyncClient( credentials=async_anonymous_credentials(), @@ -2010,7 +2035,7 @@ async def test_get_authorized_certificate_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( @@ -2045,11 +2070,6 @@ async def test_get_authorized_certificate_async( assert response.domain_mappings_count == 2238 -@pytest.mark.asyncio -async def test_get_authorized_certificate_async_from_dict(): - await test_get_authorized_certificate_async(request_type=dict) - - def test_get_authorized_certificate_field_headers(): client = AuthorizedCertificatesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2118,8 +2138,8 @@ async def test_get_authorized_certificate_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - appengine.CreateAuthorizedCertificateRequest, - dict, + appengine.CreateAuthorizedCertificateRequest(), + {}, ], ) def test_create_authorized_certificate(request_type, transport: str = "grpc"): @@ -2130,7 +2150,7 @@ def test_create_authorized_certificate(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2188,9 +2208,10 @@ def test_create_authorized_certificate_non_empty_request_with_auto_populated_fie client.create_authorized_certificate(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == appengine.CreateAuthorizedCertificateRequest( + request_msg = appengine.CreateAuthorizedCertificateRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_authorized_certificate_use_cached_wrapped_rpc(): @@ -2276,9 +2297,15 @@ async def test_create_authorized_certificate_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + appengine.CreateAuthorizedCertificateRequest(), + {}, + ], +) async def test_create_authorized_certificate_async( - transport: str = "grpc_asyncio", - request_type=appengine.CreateAuthorizedCertificateRequest, + request_type, transport: str = "grpc_asyncio" ): client = AuthorizedCertificatesAsyncClient( credentials=async_anonymous_credentials(), @@ -2287,7 +2314,7 @@ async def test_create_authorized_certificate_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( @@ -2322,11 +2349,6 @@ async def test_create_authorized_certificate_async( assert response.domain_mappings_count == 2238 -@pytest.mark.asyncio -async def test_create_authorized_certificate_async_from_dict(): - await test_create_authorized_certificate_async(request_type=dict) - - def test_create_authorized_certificate_field_headers(): client = AuthorizedCertificatesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2395,8 +2417,8 @@ async def test_create_authorized_certificate_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - appengine.UpdateAuthorizedCertificateRequest, - dict, + appengine.UpdateAuthorizedCertificateRequest(), + {}, ], ) def test_update_authorized_certificate(request_type, transport: str = "grpc"): @@ -2407,7 +2429,7 @@ def test_update_authorized_certificate(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2465,9 +2487,10 @@ def test_update_authorized_certificate_non_empty_request_with_auto_populated_fie client.update_authorized_certificate(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == appengine.UpdateAuthorizedCertificateRequest( + request_msg = appengine.UpdateAuthorizedCertificateRequest( name="name_value", ) + assert args[0] == request_msg def test_update_authorized_certificate_use_cached_wrapped_rpc(): @@ -2553,9 +2576,15 @@ async def test_update_authorized_certificate_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + appengine.UpdateAuthorizedCertificateRequest(), + {}, + ], +) async def test_update_authorized_certificate_async( - transport: str = "grpc_asyncio", - request_type=appengine.UpdateAuthorizedCertificateRequest, + request_type, transport: str = "grpc_asyncio" ): client = AuthorizedCertificatesAsyncClient( credentials=async_anonymous_credentials(), @@ -2564,7 +2593,7 @@ async def test_update_authorized_certificate_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( @@ -2599,11 +2628,6 @@ async def test_update_authorized_certificate_async( assert response.domain_mappings_count == 2238 -@pytest.mark.asyncio -async def test_update_authorized_certificate_async_from_dict(): - await test_update_authorized_certificate_async(request_type=dict) - - def test_update_authorized_certificate_field_headers(): client = AuthorizedCertificatesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2672,8 +2696,8 @@ async def test_update_authorized_certificate_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - appengine.DeleteAuthorizedCertificateRequest, - dict, + appengine.DeleteAuthorizedCertificateRequest(), + {}, ], ) def test_delete_authorized_certificate(request_type, transport: str = "grpc"): @@ -2684,7 +2708,7 @@ def test_delete_authorized_certificate(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2729,9 +2753,10 @@ def test_delete_authorized_certificate_non_empty_request_with_auto_populated_fie client.delete_authorized_certificate(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == appengine.DeleteAuthorizedCertificateRequest( + request_msg = appengine.DeleteAuthorizedCertificateRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_authorized_certificate_use_cached_wrapped_rpc(): @@ -2817,9 +2842,15 @@ async def test_delete_authorized_certificate_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + appengine.DeleteAuthorizedCertificateRequest(), + {}, + ], +) async def test_delete_authorized_certificate_async( - transport: str = "grpc_asyncio", - request_type=appengine.DeleteAuthorizedCertificateRequest, + request_type, transport: str = "grpc_asyncio" ): client = AuthorizedCertificatesAsyncClient( credentials=async_anonymous_credentials(), @@ -2828,7 +2859,7 @@ async def test_delete_authorized_certificate_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( @@ -2848,11 +2879,6 @@ async def test_delete_authorized_certificate_async( assert response is None -@pytest.mark.asyncio -async def test_delete_authorized_certificate_async_from_dict(): - await test_delete_authorized_certificate_async(request_type=dict) - - def test_delete_authorized_certificate_field_headers(): client = AuthorizedCertificatesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3309,7 +3335,6 @@ def test_list_authorized_certificates_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.ListAuthorizedCertificatesRequest() - assert args[0] == request_msg @@ -3332,7 +3357,6 @@ def test_get_authorized_certificate_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.GetAuthorizedCertificateRequest() - assert args[0] == request_msg @@ -3355,7 +3379,6 @@ def test_create_authorized_certificate_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.CreateAuthorizedCertificateRequest() - assert args[0] == request_msg @@ -3378,7 +3401,6 @@ def test_update_authorized_certificate_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.UpdateAuthorizedCertificateRequest() - assert args[0] == request_msg @@ -3401,7 +3423,6 @@ def test_delete_authorized_certificate_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.DeleteAuthorizedCertificateRequest() - assert args[0] == request_msg @@ -3444,7 +3465,6 @@ async def test_list_authorized_certificates_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.ListAuthorizedCertificatesRequest() - assert args[0] == request_msg @@ -3478,7 +3498,6 @@ async def test_get_authorized_certificate_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.GetAuthorizedCertificateRequest() - assert args[0] == request_msg @@ -3512,7 +3531,6 @@ async def test_create_authorized_certificate_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.CreateAuthorizedCertificateRequest() - assert args[0] == request_msg @@ -3546,7 +3564,6 @@ async def test_update_authorized_certificate_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.UpdateAuthorizedCertificateRequest() - assert args[0] == request_msg @@ -3571,7 +3588,6 @@ async def test_delete_authorized_certificate_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.DeleteAuthorizedCertificateRequest() - assert args[0] == request_msg @@ -4459,7 +4475,6 @@ def test_list_authorized_certificates_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.ListAuthorizedCertificatesRequest() - assert args[0] == request_msg @@ -4481,7 +4496,6 @@ def test_get_authorized_certificate_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.GetAuthorizedCertificateRequest() - assert args[0] == request_msg @@ -4503,7 +4517,6 @@ def test_create_authorized_certificate_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.CreateAuthorizedCertificateRequest() - assert args[0] == request_msg @@ -4525,7 +4538,6 @@ def test_update_authorized_certificate_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.UpdateAuthorizedCertificateRequest() - assert args[0] == request_msg @@ -4547,7 +4559,6 @@ def test_delete_authorized_certificate_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.DeleteAuthorizedCertificateRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-appengine-admin/tests/unit/gapic/appengine_admin_v1/test_authorized_domains.py b/packages/google-cloud-appengine-admin/tests/unit/gapic/appengine_admin_v1/test_authorized_domains.py index 6d62c0d0d472..2892524340e3 100644 --- a/packages/google-cloud-appengine-admin/tests/unit/gapic/appengine_admin_v1/test_authorized_domains.py +++ b/packages/google-cloud-appengine-admin/tests/unit/gapic/appengine_admin_v1/test_authorized_domains.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 @@ -107,6 +108,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" @@ -1352,8 +1368,8 @@ def test_authorized_domains_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - appengine.ListAuthorizedDomainsRequest, - dict, + appengine.ListAuthorizedDomainsRequest(), + {}, ], ) def test_list_authorized_domains(request_type, transport: str = "grpc"): @@ -1364,7 +1380,7 @@ def test_list_authorized_domains(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,10 +1429,11 @@ def test_list_authorized_domains_non_empty_request_with_auto_populated_field(): client.list_authorized_domains(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == appengine.ListAuthorizedDomainsRequest( + request_msg = appengine.ListAuthorizedDomainsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_authorized_domains_use_cached_wrapped_rpc(): @@ -1502,8 +1519,15 @@ async def test_list_authorized_domains_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + appengine.ListAuthorizedDomainsRequest(), + {}, + ], +) async def test_list_authorized_domains_async( - transport: str = "grpc_asyncio", request_type=appengine.ListAuthorizedDomainsRequest + request_type, transport: str = "grpc_asyncio" ): client = AuthorizedDomainsAsyncClient( credentials=async_anonymous_credentials(), @@ -1512,7 +1536,7 @@ async def test_list_authorized_domains_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( @@ -1537,11 +1561,6 @@ async def test_list_authorized_domains_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_authorized_domains_async_from_dict(): - await test_list_authorized_domains_async(request_type=dict) - - def test_list_authorized_domains_field_headers(): client = AuthorizedDomainsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2034,7 +2053,6 @@ def test_list_authorized_domains_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.ListAuthorizedDomainsRequest() - assert args[0] == request_msg @@ -2077,7 +2095,6 @@ async def test_list_authorized_domains_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.ListAuthorizedDomainsRequest() - assert args[0] == request_msg @@ -2249,7 +2266,6 @@ def test_list_authorized_domains_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.ListAuthorizedDomainsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-appengine-admin/tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py b/packages/google-cloud-appengine-admin/tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py index eebcd77d0f73..2cd412e7944b 100644 --- a/packages/google-cloud-appengine-admin/tests/unit/gapic/appengine_admin_v1/test_domain_mappings.py +++ b/packages/google-cloud-appengine-admin/tests/unit/gapic/appengine_admin_v1/test_domain_mappings.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 @@ -115,6 +116,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" @@ -1322,8 +1338,8 @@ def test_domain_mappings_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - appengine.ListDomainMappingsRequest, - dict, + appengine.ListDomainMappingsRequest(), + {}, ], ) def test_list_domain_mappings(request_type, transport: str = "grpc"): @@ -1334,7 +1350,7 @@ def test_list_domain_mappings(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1383,10 +1399,11 @@ def test_list_domain_mappings_non_empty_request_with_auto_populated_field(): client.list_domain_mappings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == appengine.ListDomainMappingsRequest( + request_msg = appengine.ListDomainMappingsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_domain_mappings_use_cached_wrapped_rpc(): @@ -1471,8 +1488,15 @@ async def test_list_domain_mappings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + appengine.ListDomainMappingsRequest(), + {}, + ], +) async def test_list_domain_mappings_async( - transport: str = "grpc_asyncio", request_type=appengine.ListDomainMappingsRequest + request_type, transport: str = "grpc_asyncio" ): client = DomainMappingsAsyncClient( credentials=async_anonymous_credentials(), @@ -1481,7 +1505,7 @@ async def test_list_domain_mappings_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( @@ -1506,11 +1530,6 @@ async def test_list_domain_mappings_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_domain_mappings_async_from_dict(): - await test_list_domain_mappings_async(request_type=dict) - - def test_list_domain_mappings_field_headers(): client = DomainMappingsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1777,8 +1796,8 @@ async def test_list_domain_mappings_async_pages(): @pytest.mark.parametrize( "request_type", [ - appengine.GetDomainMappingRequest, - dict, + appengine.GetDomainMappingRequest(), + {}, ], ) def test_get_domain_mapping(request_type, transport: str = "grpc"): @@ -1789,7 +1808,7 @@ def test_get_domain_mapping(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1839,9 +1858,10 @@ def test_get_domain_mapping_non_empty_request_with_auto_populated_field(): client.get_domain_mapping(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == appengine.GetDomainMappingRequest( + request_msg = appengine.GetDomainMappingRequest( name="name_value", ) + assert args[0] == request_msg def test_get_domain_mapping_use_cached_wrapped_rpc(): @@ -1926,9 +1946,14 @@ async def test_get_domain_mapping_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_domain_mapping_async( - transport: str = "grpc_asyncio", request_type=appengine.GetDomainMappingRequest -): +@pytest.mark.parametrize( + "request_type", + [ + appengine.GetDomainMappingRequest(), + {}, + ], +) +async def test_get_domain_mapping_async(request_type, transport: str = "grpc_asyncio"): client = DomainMappingsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1936,7 +1961,7 @@ async def test_get_domain_mapping_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( @@ -1963,11 +1988,6 @@ async def test_get_domain_mapping_async( assert response.id == "id_value" -@pytest.mark.asyncio -async def test_get_domain_mapping_async_from_dict(): - await test_get_domain_mapping_async(request_type=dict) - - def test_get_domain_mapping_field_headers(): client = DomainMappingsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2036,8 +2056,8 @@ async def test_get_domain_mapping_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - appengine.CreateDomainMappingRequest, - dict, + appengine.CreateDomainMappingRequest(), + {}, ], ) def test_create_domain_mapping(request_type, transport: str = "grpc"): @@ -2048,7 +2068,7 @@ def test_create_domain_mapping(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2093,9 +2113,10 @@ def test_create_domain_mapping_non_empty_request_with_auto_populated_field(): client.create_domain_mapping(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == appengine.CreateDomainMappingRequest( + request_msg = appengine.CreateDomainMappingRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_domain_mapping_use_cached_wrapped_rpc(): @@ -2191,8 +2212,15 @@ async def test_create_domain_mapping_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + appengine.CreateDomainMappingRequest(), + {}, + ], +) async def test_create_domain_mapping_async( - transport: str = "grpc_asyncio", request_type=appengine.CreateDomainMappingRequest + request_type, transport: str = "grpc_asyncio" ): client = DomainMappingsAsyncClient( credentials=async_anonymous_credentials(), @@ -2201,7 +2229,7 @@ async def test_create_domain_mapping_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( @@ -2223,11 +2251,6 @@ async def test_create_domain_mapping_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_domain_mapping_async_from_dict(): - await test_create_domain_mapping_async(request_type=dict) - - def test_create_domain_mapping_field_headers(): client = DomainMappingsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2296,8 +2319,8 @@ async def test_create_domain_mapping_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - appengine.UpdateDomainMappingRequest, - dict, + appengine.UpdateDomainMappingRequest(), + {}, ], ) def test_update_domain_mapping(request_type, transport: str = "grpc"): @@ -2308,7 +2331,7 @@ def test_update_domain_mapping(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2353,9 +2376,10 @@ def test_update_domain_mapping_non_empty_request_with_auto_populated_field(): client.update_domain_mapping(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == appengine.UpdateDomainMappingRequest( + request_msg = appengine.UpdateDomainMappingRequest( name="name_value", ) + assert args[0] == request_msg def test_update_domain_mapping_use_cached_wrapped_rpc(): @@ -2451,8 +2475,15 @@ async def test_update_domain_mapping_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + appengine.UpdateDomainMappingRequest(), + {}, + ], +) async def test_update_domain_mapping_async( - transport: str = "grpc_asyncio", request_type=appengine.UpdateDomainMappingRequest + request_type, transport: str = "grpc_asyncio" ): client = DomainMappingsAsyncClient( credentials=async_anonymous_credentials(), @@ -2461,7 +2492,7 @@ async def test_update_domain_mapping_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( @@ -2483,11 +2514,6 @@ async def test_update_domain_mapping_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_domain_mapping_async_from_dict(): - await test_update_domain_mapping_async(request_type=dict) - - def test_update_domain_mapping_field_headers(): client = DomainMappingsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2556,8 +2582,8 @@ async def test_update_domain_mapping_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - appengine.DeleteDomainMappingRequest, - dict, + appengine.DeleteDomainMappingRequest(), + {}, ], ) def test_delete_domain_mapping(request_type, transport: str = "grpc"): @@ -2568,7 +2594,7 @@ def test_delete_domain_mapping(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2613,9 +2639,10 @@ def test_delete_domain_mapping_non_empty_request_with_auto_populated_field(): client.delete_domain_mapping(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == appengine.DeleteDomainMappingRequest( + request_msg = appengine.DeleteDomainMappingRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_domain_mapping_use_cached_wrapped_rpc(): @@ -2711,8 +2738,15 @@ async def test_delete_domain_mapping_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + appengine.DeleteDomainMappingRequest(), + {}, + ], +) async def test_delete_domain_mapping_async( - transport: str = "grpc_asyncio", request_type=appengine.DeleteDomainMappingRequest + request_type, transport: str = "grpc_asyncio" ): client = DomainMappingsAsyncClient( credentials=async_anonymous_credentials(), @@ -2721,7 +2755,7 @@ async def test_delete_domain_mapping_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( @@ -2743,11 +2777,6 @@ async def test_delete_domain_mapping_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_domain_mapping_async_from_dict(): - await test_delete_domain_mapping_async(request_type=dict) - - def test_delete_domain_mapping_field_headers(): client = DomainMappingsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3216,7 +3245,6 @@ def test_list_domain_mappings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.ListDomainMappingsRequest() - assert args[0] == request_msg @@ -3239,7 +3267,6 @@ def test_get_domain_mapping_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.GetDomainMappingRequest() - assert args[0] == request_msg @@ -3262,7 +3289,6 @@ def test_create_domain_mapping_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.CreateDomainMappingRequest() - assert args[0] == request_msg @@ -3285,7 +3311,6 @@ def test_update_domain_mapping_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.UpdateDomainMappingRequest() - assert args[0] == request_msg @@ -3308,7 +3333,6 @@ def test_delete_domain_mapping_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.DeleteDomainMappingRequest() - assert args[0] == request_msg @@ -3351,7 +3375,6 @@ async def test_list_domain_mappings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.ListDomainMappingsRequest() - assert args[0] == request_msg @@ -3381,7 +3404,6 @@ async def test_get_domain_mapping_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.GetDomainMappingRequest() - assert args[0] == request_msg @@ -3408,7 +3430,6 @@ async def test_create_domain_mapping_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.CreateDomainMappingRequest() - assert args[0] == request_msg @@ -3435,7 +3456,6 @@ async def test_update_domain_mapping_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.UpdateDomainMappingRequest() - assert args[0] == request_msg @@ -3462,7 +3482,6 @@ async def test_delete_domain_mapping_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.DeleteDomainMappingRequest() - assert args[0] == request_msg @@ -4305,7 +4324,6 @@ def test_list_domain_mappings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.ListDomainMappingsRequest() - assert args[0] == request_msg @@ -4327,7 +4345,6 @@ def test_get_domain_mapping_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.GetDomainMappingRequest() - assert args[0] == request_msg @@ -4349,7 +4366,6 @@ def test_create_domain_mapping_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.CreateDomainMappingRequest() - assert args[0] == request_msg @@ -4371,7 +4387,6 @@ def test_update_domain_mapping_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.UpdateDomainMappingRequest() - assert args[0] == request_msg @@ -4393,7 +4408,6 @@ def test_delete_domain_mapping_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.DeleteDomainMappingRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-appengine-admin/tests/unit/gapic/appengine_admin_v1/test_firewall.py b/packages/google-cloud-appengine-admin/tests/unit/gapic/appengine_admin_v1/test_firewall.py index 41aef708b941..302c63904964 100644 --- a/packages/google-cloud-appengine-admin/tests/unit/gapic/appengine_admin_v1/test_firewall.py +++ b/packages/google-cloud-appengine-admin/tests/unit/gapic/appengine_admin_v1/test_firewall.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 @@ -108,6 +109,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" @@ -1256,8 +1272,8 @@ def test_firewall_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - appengine.ListIngressRulesRequest, - dict, + appengine.ListIngressRulesRequest(), + {}, ], ) def test_list_ingress_rules(request_type, transport: str = "grpc"): @@ -1268,7 +1284,7 @@ def test_list_ingress_rules(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1318,11 +1334,12 @@ def test_list_ingress_rules_non_empty_request_with_auto_populated_field(): client.list_ingress_rules(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == appengine.ListIngressRulesRequest( + request_msg = appengine.ListIngressRulesRequest( parent="parent_value", page_token="page_token_value", matching_address="matching_address_value", ) + assert args[0] == request_msg def test_list_ingress_rules_use_cached_wrapped_rpc(): @@ -1407,9 +1424,14 @@ async def test_list_ingress_rules_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_ingress_rules_async( - transport: str = "grpc_asyncio", request_type=appengine.ListIngressRulesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + appengine.ListIngressRulesRequest(), + {}, + ], +) +async def test_list_ingress_rules_async(request_type, transport: str = "grpc_asyncio"): client = FirewallAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1417,7 +1439,7 @@ async def test_list_ingress_rules_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( @@ -1442,11 +1464,6 @@ async def test_list_ingress_rules_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_ingress_rules_async_from_dict(): - await test_list_ingress_rules_async(request_type=dict) - - def test_list_ingress_rules_field_headers(): client = FirewallClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1713,8 +1730,8 @@ async def test_list_ingress_rules_async_pages(): @pytest.mark.parametrize( "request_type", [ - appengine.BatchUpdateIngressRulesRequest, - dict, + appengine.BatchUpdateIngressRulesRequest(), + {}, ], ) def test_batch_update_ingress_rules(request_type, transport: str = "grpc"): @@ -1725,7 +1742,7 @@ def test_batch_update_ingress_rules(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1770,9 +1787,10 @@ def test_batch_update_ingress_rules_non_empty_request_with_auto_populated_field( client.batch_update_ingress_rules(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == appengine.BatchUpdateIngressRulesRequest( + request_msg = appengine.BatchUpdateIngressRulesRequest( name="name_value", ) + assert args[0] == request_msg def test_batch_update_ingress_rules_use_cached_wrapped_rpc(): @@ -1858,9 +1876,15 @@ async def test_batch_update_ingress_rules_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + appengine.BatchUpdateIngressRulesRequest(), + {}, + ], +) async def test_batch_update_ingress_rules_async( - transport: str = "grpc_asyncio", - request_type=appengine.BatchUpdateIngressRulesRequest, + request_type, transport: str = "grpc_asyncio" ): client = FirewallAsyncClient( credentials=async_anonymous_credentials(), @@ -1869,7 +1893,7 @@ async def test_batch_update_ingress_rules_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( @@ -1891,11 +1915,6 @@ async def test_batch_update_ingress_rules_async( assert isinstance(response, appengine.BatchUpdateIngressRulesResponse) -@pytest.mark.asyncio -async def test_batch_update_ingress_rules_async_from_dict(): - await test_batch_update_ingress_rules_async(request_type=dict) - - def test_batch_update_ingress_rules_field_headers(): client = FirewallClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1964,8 +1983,8 @@ async def test_batch_update_ingress_rules_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - appengine.CreateIngressRuleRequest, - dict, + appengine.CreateIngressRuleRequest(), + {}, ], ) def test_create_ingress_rule(request_type, transport: str = "grpc"): @@ -1976,7 +1995,7 @@ def test_create_ingress_rule(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2030,9 +2049,10 @@ def test_create_ingress_rule_non_empty_request_with_auto_populated_field(): client.create_ingress_rule(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == appengine.CreateIngressRuleRequest( + request_msg = appengine.CreateIngressRuleRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_ingress_rule_use_cached_wrapped_rpc(): @@ -2117,9 +2137,14 @@ async def test_create_ingress_rule_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_ingress_rule_async( - transport: str = "grpc_asyncio", request_type=appengine.CreateIngressRuleRequest -): +@pytest.mark.parametrize( + "request_type", + [ + appengine.CreateIngressRuleRequest(), + {}, + ], +) +async def test_create_ingress_rule_async(request_type, transport: str = "grpc_asyncio"): client = FirewallAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2127,7 +2152,7 @@ async def test_create_ingress_rule_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( @@ -2158,11 +2183,6 @@ async def test_create_ingress_rule_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_create_ingress_rule_async_from_dict(): - await test_create_ingress_rule_async(request_type=dict) - - def test_create_ingress_rule_field_headers(): client = FirewallClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2231,8 +2251,8 @@ async def test_create_ingress_rule_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - appengine.GetIngressRuleRequest, - dict, + appengine.GetIngressRuleRequest(), + {}, ], ) def test_get_ingress_rule(request_type, transport: str = "grpc"): @@ -2243,7 +2263,7 @@ def test_get_ingress_rule(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_ingress_rule), "__call__") as call: @@ -2293,9 +2313,10 @@ def test_get_ingress_rule_non_empty_request_with_auto_populated_field(): client.get_ingress_rule(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == appengine.GetIngressRuleRequest( + request_msg = appengine.GetIngressRuleRequest( name="name_value", ) + assert args[0] == request_msg def test_get_ingress_rule_use_cached_wrapped_rpc(): @@ -2378,9 +2399,14 @@ async def test_get_ingress_rule_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_ingress_rule_async( - transport: str = "grpc_asyncio", request_type=appengine.GetIngressRuleRequest -): +@pytest.mark.parametrize( + "request_type", + [ + appengine.GetIngressRuleRequest(), + {}, + ], +) +async def test_get_ingress_rule_async(request_type, transport: str = "grpc_asyncio"): client = FirewallAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2388,7 +2414,7 @@ async def test_get_ingress_rule_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_ingress_rule), "__call__") as call: @@ -2417,11 +2443,6 @@ async def test_get_ingress_rule_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_get_ingress_rule_async_from_dict(): - await test_get_ingress_rule_async(request_type=dict) - - def test_get_ingress_rule_field_headers(): client = FirewallClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2486,8 +2507,8 @@ async def test_get_ingress_rule_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - appengine.UpdateIngressRuleRequest, - dict, + appengine.UpdateIngressRuleRequest(), + {}, ], ) def test_update_ingress_rule(request_type, transport: str = "grpc"): @@ -2498,7 +2519,7 @@ def test_update_ingress_rule(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2552,9 +2573,10 @@ def test_update_ingress_rule_non_empty_request_with_auto_populated_field(): client.update_ingress_rule(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == appengine.UpdateIngressRuleRequest( + request_msg = appengine.UpdateIngressRuleRequest( name="name_value", ) + assert args[0] == request_msg def test_update_ingress_rule_use_cached_wrapped_rpc(): @@ -2639,9 +2661,14 @@ async def test_update_ingress_rule_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_ingress_rule_async( - transport: str = "grpc_asyncio", request_type=appengine.UpdateIngressRuleRequest -): +@pytest.mark.parametrize( + "request_type", + [ + appengine.UpdateIngressRuleRequest(), + {}, + ], +) +async def test_update_ingress_rule_async(request_type, transport: str = "grpc_asyncio"): client = FirewallAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2649,7 +2676,7 @@ async def test_update_ingress_rule_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( @@ -2680,11 +2707,6 @@ async def test_update_ingress_rule_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_update_ingress_rule_async_from_dict(): - await test_update_ingress_rule_async(request_type=dict) - - def test_update_ingress_rule_field_headers(): client = FirewallClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2753,8 +2775,8 @@ async def test_update_ingress_rule_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - appengine.DeleteIngressRuleRequest, - dict, + appengine.DeleteIngressRuleRequest(), + {}, ], ) def test_delete_ingress_rule(request_type, transport: str = "grpc"): @@ -2765,7 +2787,7 @@ def test_delete_ingress_rule(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2810,9 +2832,10 @@ def test_delete_ingress_rule_non_empty_request_with_auto_populated_field(): client.delete_ingress_rule(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == appengine.DeleteIngressRuleRequest( + request_msg = appengine.DeleteIngressRuleRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_ingress_rule_use_cached_wrapped_rpc(): @@ -2897,9 +2920,14 @@ async def test_delete_ingress_rule_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_ingress_rule_async( - transport: str = "grpc_asyncio", request_type=appengine.DeleteIngressRuleRequest -): +@pytest.mark.parametrize( + "request_type", + [ + appengine.DeleteIngressRuleRequest(), + {}, + ], +) +async def test_delete_ingress_rule_async(request_type, transport: str = "grpc_asyncio"): client = FirewallAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2907,7 +2935,7 @@ async def test_delete_ingress_rule_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( @@ -2927,11 +2955,6 @@ async def test_delete_ingress_rule_async( assert response is None -@pytest.mark.asyncio -async def test_delete_ingress_rule_async_from_dict(): - await test_delete_ingress_rule_async(request_type=dict) - - def test_delete_ingress_rule_field_headers(): client = FirewallClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3422,7 +3445,6 @@ def test_list_ingress_rules_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.ListIngressRulesRequest() - assert args[0] == request_msg @@ -3445,7 +3467,6 @@ def test_batch_update_ingress_rules_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.BatchUpdateIngressRulesRequest() - assert args[0] == request_msg @@ -3468,7 +3489,6 @@ def test_create_ingress_rule_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.CreateIngressRuleRequest() - assert args[0] == request_msg @@ -3489,7 +3509,6 @@ def test_get_ingress_rule_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.GetIngressRuleRequest() - assert args[0] == request_msg @@ -3512,7 +3531,6 @@ def test_update_ingress_rule_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.UpdateIngressRuleRequest() - assert args[0] == request_msg @@ -3535,7 +3553,6 @@ def test_delete_ingress_rule_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.DeleteIngressRuleRequest() - assert args[0] == request_msg @@ -3578,7 +3595,6 @@ async def test_list_ingress_rules_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.ListIngressRulesRequest() - assert args[0] == request_msg @@ -3605,7 +3621,6 @@ async def test_batch_update_ingress_rules_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.BatchUpdateIngressRulesRequest() - assert args[0] == request_msg @@ -3637,7 +3652,6 @@ async def test_create_ingress_rule_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.CreateIngressRuleRequest() - assert args[0] == request_msg @@ -3667,7 +3681,6 @@ async def test_get_ingress_rule_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.GetIngressRuleRequest() - assert args[0] == request_msg @@ -3699,7 +3712,6 @@ async def test_update_ingress_rule_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.UpdateIngressRuleRequest() - assert args[0] == request_msg @@ -3724,7 +3736,6 @@ async def test_delete_ingress_rule_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.DeleteIngressRuleRequest() - assert args[0] == request_msg @@ -4677,7 +4688,6 @@ def test_list_ingress_rules_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.ListIngressRulesRequest() - assert args[0] == request_msg @@ -4699,7 +4709,6 @@ def test_batch_update_ingress_rules_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.BatchUpdateIngressRulesRequest() - assert args[0] == request_msg @@ -4721,7 +4730,6 @@ def test_create_ingress_rule_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.CreateIngressRuleRequest() - assert args[0] == request_msg @@ -4741,7 +4749,6 @@ def test_get_ingress_rule_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.GetIngressRuleRequest() - assert args[0] == request_msg @@ -4763,7 +4770,6 @@ def test_update_ingress_rule_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.UpdateIngressRuleRequest() - assert args[0] == request_msg @@ -4785,7 +4791,6 @@ def test_delete_ingress_rule_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.DeleteIngressRuleRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-appengine-admin/tests/unit/gapic/appengine_admin_v1/test_instances.py b/packages/google-cloud-appengine-admin/tests/unit/gapic/appengine_admin_v1/test_instances.py index eaadaafe70e7..70b505b1ba4a 100644 --- a/packages/google-cloud-appengine-admin/tests/unit/gapic/appengine_admin_v1/test_instances.py +++ b/packages/google-cloud-appengine-admin/tests/unit/gapic/appengine_admin_v1/test_instances.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 @@ -115,6 +116,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" @@ -1276,8 +1292,8 @@ def test_instances_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - appengine.ListInstancesRequest, - dict, + appengine.ListInstancesRequest(), + {}, ], ) def test_list_instances(request_type, transport: str = "grpc"): @@ -1288,7 +1304,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(type(client.transport.list_instances), "__call__") as call: @@ -1333,10 +1349,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] == appengine.ListInstancesRequest( + request_msg = appengine.ListInstancesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_instances_use_cached_wrapped_rpc(): @@ -1417,9 +1434,14 @@ async def test_list_instances_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_instances_async( - transport: str = "grpc_asyncio", request_type=appengine.ListInstancesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + appengine.ListInstancesRequest(), + {}, + ], +) +async def test_list_instances_async(request_type, transport: str = "grpc_asyncio"): client = InstancesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1427,7 +1449,7 @@ async def test_list_instances_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_instances), "__call__") as call: @@ -1450,11 +1472,6 @@ async def test_list_instances_async( assert response.next_page_token == "next_page_token_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 = InstancesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1709,8 +1726,8 @@ async def test_list_instances_async_pages(): @pytest.mark.parametrize( "request_type", [ - appengine.GetInstanceRequest, - dict, + appengine.GetInstanceRequest(), + {}, ], ) def test_get_instance(request_type, transport: str = "grpc"): @@ -1721,7 +1738,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(type(client.transport.get_instance), "__call__") as call: @@ -1795,9 +1812,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] == appengine.GetInstanceRequest( + request_msg = appengine.GetInstanceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_instance_use_cached_wrapped_rpc(): @@ -1878,9 +1896,14 @@ async def test_get_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_instance_async( - transport: str = "grpc_asyncio", request_type=appengine.GetInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + appengine.GetInstanceRequest(), + {}, + ], +) +async def test_get_instance_async(request_type, transport: str = "grpc_asyncio"): client = InstancesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1888,7 +1911,7 @@ async def test_get_instance_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_instance), "__call__") as call: @@ -1941,11 +1964,6 @@ async def test_get_instance_async( assert response.vm_liveness == instance.Instance.Liveness.LivenessState.UNKNOWN -@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 = InstancesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2008,8 +2026,8 @@ async def test_get_instance_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - appengine.DeleteInstanceRequest, - dict, + appengine.DeleteInstanceRequest(), + {}, ], ) def test_delete_instance(request_type, transport: str = "grpc"): @@ -2020,7 +2038,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(type(client.transport.delete_instance), "__call__") as call: @@ -2061,9 +2079,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] == appengine.DeleteInstanceRequest( + request_msg = appengine.DeleteInstanceRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_instance_use_cached_wrapped_rpc(): @@ -2154,9 +2173,14 @@ async def test_delete_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_instance_async( - transport: str = "grpc_asyncio", request_type=appengine.DeleteInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + appengine.DeleteInstanceRequest(), + {}, + ], +) +async def test_delete_instance_async(request_type, transport: str = "grpc_asyncio"): client = InstancesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2164,7 +2188,7 @@ async def test_delete_instance_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_instance), "__call__") as call: @@ -2184,11 +2208,6 @@ async def test_delete_instance_async( 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 = InstancesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2253,8 +2272,8 @@ async def test_delete_instance_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - appengine.DebugInstanceRequest, - dict, + appengine.DebugInstanceRequest(), + {}, ], ) def test_debug_instance(request_type, transport: str = "grpc"): @@ -2265,7 +2284,7 @@ def test_debug_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(type(client.transport.debug_instance), "__call__") as call: @@ -2307,10 +2326,11 @@ def test_debug_instance_non_empty_request_with_auto_populated_field(): client.debug_instance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == appengine.DebugInstanceRequest( + request_msg = appengine.DebugInstanceRequest( name="name_value", ssh_key="ssh_key_value", ) + assert args[0] == request_msg def test_debug_instance_use_cached_wrapped_rpc(): @@ -2401,9 +2421,14 @@ async def test_debug_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_debug_instance_async( - transport: str = "grpc_asyncio", request_type=appengine.DebugInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + appengine.DebugInstanceRequest(), + {}, + ], +) +async def test_debug_instance_async(request_type, transport: str = "grpc_asyncio"): client = InstancesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2411,7 +2436,7 @@ async def test_debug_instance_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.debug_instance), "__call__") as call: @@ -2431,11 +2456,6 @@ async def test_debug_instance_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_debug_instance_async_from_dict(): - await test_debug_instance_async(request_type=dict) - - def test_debug_instance_field_headers(): client = InstancesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2833,7 +2853,6 @@ def test_list_instances_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.ListInstancesRequest() - assert args[0] == request_msg @@ -2854,7 +2873,6 @@ def test_get_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.GetInstanceRequest() - assert args[0] == request_msg @@ -2875,7 +2893,6 @@ def test_delete_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.DeleteInstanceRequest() - assert args[0] == request_msg @@ -2896,7 +2913,6 @@ def test_debug_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.DebugInstanceRequest() - assert args[0] == request_msg @@ -2937,7 +2953,6 @@ async def test_list_instances_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.ListInstancesRequest() - assert args[0] == request_msg @@ -2979,7 +2994,6 @@ async def test_get_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.GetInstanceRequest() - assert args[0] == request_msg @@ -3004,7 +3018,6 @@ async def test_delete_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.DeleteInstanceRequest() - assert args[0] == request_msg @@ -3029,7 +3042,6 @@ async def test_debug_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.DebugInstanceRequest() - assert args[0] == request_msg @@ -3595,7 +3607,6 @@ def test_list_instances_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.ListInstancesRequest() - assert args[0] == request_msg @@ -3615,7 +3626,6 @@ def test_get_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.GetInstanceRequest() - assert args[0] == request_msg @@ -3635,7 +3645,6 @@ def test_delete_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.DeleteInstanceRequest() - assert args[0] == request_msg @@ -3655,7 +3664,6 @@ def test_debug_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.DebugInstanceRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-appengine-admin/tests/unit/gapic/appengine_admin_v1/test_services.py b/packages/google-cloud-appengine-admin/tests/unit/gapic/appengine_admin_v1/test_services.py index b95183ee311d..675b975e3b5a 100644 --- a/packages/google-cloud-appengine-admin/tests/unit/gapic/appengine_admin_v1/test_services.py +++ b/packages/google-cloud-appengine-admin/tests/unit/gapic/appengine_admin_v1/test_services.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 @@ -115,6 +116,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" @@ -1263,8 +1279,8 @@ def test_services_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - appengine.ListServicesRequest, - dict, + appengine.ListServicesRequest(), + {}, ], ) def test_list_services(request_type, transport: str = "grpc"): @@ -1275,7 +1291,7 @@ def test_list_services(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_services), "__call__") as call: @@ -1320,10 +1336,11 @@ def test_list_services_non_empty_request_with_auto_populated_field(): client.list_services(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == appengine.ListServicesRequest( + request_msg = appengine.ListServicesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_services_use_cached_wrapped_rpc(): @@ -1404,9 +1421,14 @@ async def test_list_services_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_services_async( - transport: str = "grpc_asyncio", request_type=appengine.ListServicesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + appengine.ListServicesRequest(), + {}, + ], +) +async def test_list_services_async(request_type, transport: str = "grpc_asyncio"): client = ServicesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1414,7 +1436,7 @@ async def test_list_services_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_services), "__call__") as call: @@ -1437,11 +1459,6 @@ async def test_list_services_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_services_async_from_dict(): - await test_list_services_async(request_type=dict) - - def test_list_services_field_headers(): client = ServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1696,8 +1713,8 @@ async def test_list_services_async_pages(): @pytest.mark.parametrize( "request_type", [ - appengine.GetServiceRequest, - dict, + appengine.GetServiceRequest(), + {}, ], ) def test_get_service(request_type, transport: str = "grpc"): @@ -1708,7 +1725,7 @@ def test_get_service(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_service), "__call__") as call: @@ -1754,9 +1771,10 @@ def test_get_service_non_empty_request_with_auto_populated_field(): client.get_service(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == appengine.GetServiceRequest( + request_msg = appengine.GetServiceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_service_use_cached_wrapped_rpc(): @@ -1837,9 +1855,14 @@ async def test_get_service_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_service_async( - transport: str = "grpc_asyncio", request_type=appengine.GetServiceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + appengine.GetServiceRequest(), + {}, + ], +) +async def test_get_service_async(request_type, transport: str = "grpc_asyncio"): client = ServicesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1847,7 +1870,7 @@ async def test_get_service_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_service), "__call__") as call: @@ -1872,11 +1895,6 @@ async def test_get_service_async( assert response.id == "id_value" -@pytest.mark.asyncio -async def test_get_service_async_from_dict(): - await test_get_service_async(request_type=dict) - - def test_get_service_field_headers(): client = ServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1939,8 +1957,8 @@ async def test_get_service_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - appengine.UpdateServiceRequest, - dict, + appengine.UpdateServiceRequest(), + {}, ], ) def test_update_service(request_type, transport: str = "grpc"): @@ -1951,7 +1969,7 @@ def test_update_service(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_service), "__call__") as call: @@ -1992,9 +2010,10 @@ def test_update_service_non_empty_request_with_auto_populated_field(): client.update_service(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == appengine.UpdateServiceRequest( + request_msg = appengine.UpdateServiceRequest( name="name_value", ) + assert args[0] == request_msg def test_update_service_use_cached_wrapped_rpc(): @@ -2085,9 +2104,14 @@ async def test_update_service_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_service_async( - transport: str = "grpc_asyncio", request_type=appengine.UpdateServiceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + appengine.UpdateServiceRequest(), + {}, + ], +) +async def test_update_service_async(request_type, transport: str = "grpc_asyncio"): client = ServicesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2095,7 +2119,7 @@ async def test_update_service_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_service), "__call__") as call: @@ -2115,11 +2139,6 @@ async def test_update_service_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_service_async_from_dict(): - await test_update_service_async(request_type=dict) - - def test_update_service_field_headers(): client = ServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2184,8 +2203,8 @@ async def test_update_service_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - appengine.DeleteServiceRequest, - dict, + appengine.DeleteServiceRequest(), + {}, ], ) def test_delete_service(request_type, transport: str = "grpc"): @@ -2196,7 +2215,7 @@ def test_delete_service(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_service), "__call__") as call: @@ -2237,9 +2256,10 @@ def test_delete_service_non_empty_request_with_auto_populated_field(): client.delete_service(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == appengine.DeleteServiceRequest( + request_msg = appengine.DeleteServiceRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_service_use_cached_wrapped_rpc(): @@ -2330,9 +2350,14 @@ async def test_delete_service_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_service_async( - transport: str = "grpc_asyncio", request_type=appengine.DeleteServiceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + appengine.DeleteServiceRequest(), + {}, + ], +) +async def test_delete_service_async(request_type, transport: str = "grpc_asyncio"): client = ServicesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2340,7 +2365,7 @@ async def test_delete_service_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_service), "__call__") as call: @@ -2360,11 +2385,6 @@ async def test_delete_service_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_service_async_from_dict(): - await test_delete_service_async(request_type=dict) - - def test_delete_service_field_headers(): client = ServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2762,7 +2782,6 @@ def test_list_services_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.ListServicesRequest() - assert args[0] == request_msg @@ -2783,7 +2802,6 @@ def test_get_service_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.GetServiceRequest() - assert args[0] == request_msg @@ -2804,7 +2822,6 @@ def test_update_service_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.UpdateServiceRequest() - assert args[0] == request_msg @@ -2825,7 +2842,6 @@ def test_delete_service_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.DeleteServiceRequest() - assert args[0] == request_msg @@ -2866,7 +2882,6 @@ async def test_list_services_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.ListServicesRequest() - assert args[0] == request_msg @@ -2894,7 +2909,6 @@ async def test_get_service_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.GetServiceRequest() - assert args[0] == request_msg @@ -2919,7 +2933,6 @@ async def test_update_service_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.UpdateServiceRequest() - assert args[0] == request_msg @@ -2944,7 +2957,6 @@ async def test_delete_service_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.DeleteServiceRequest() - assert args[0] == request_msg @@ -3540,7 +3552,6 @@ def test_list_services_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.ListServicesRequest() - assert args[0] == request_msg @@ -3560,7 +3571,6 @@ def test_get_service_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.GetServiceRequest() - assert args[0] == request_msg @@ -3580,7 +3590,6 @@ def test_update_service_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.UpdateServiceRequest() - assert args[0] == request_msg @@ -3600,7 +3609,6 @@ def test_delete_service_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.DeleteServiceRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-appengine-admin/tests/unit/gapic/appengine_admin_v1/test_versions.py b/packages/google-cloud-appengine-admin/tests/unit/gapic/appengine_admin_v1/test_versions.py index 2fdb97d96808..aef53ff40353 100644 --- a/packages/google-cloud-appengine-admin/tests/unit/gapic/appengine_admin_v1/test_versions.py +++ b/packages/google-cloud-appengine-admin/tests/unit/gapic/appengine_admin_v1/test_versions.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 @@ -117,6 +118,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" @@ -1265,8 +1281,8 @@ def test_versions_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - appengine.ListVersionsRequest, - dict, + appengine.ListVersionsRequest(), + {}, ], ) def test_list_versions(request_type, transport: str = "grpc"): @@ -1277,7 +1293,7 @@ def test_list_versions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_versions), "__call__") as call: @@ -1322,10 +1338,11 @@ def test_list_versions_non_empty_request_with_auto_populated_field(): client.list_versions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == appengine.ListVersionsRequest( + request_msg = appengine.ListVersionsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_versions_use_cached_wrapped_rpc(): @@ -1406,9 +1423,14 @@ async def test_list_versions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_versions_async( - transport: str = "grpc_asyncio", request_type=appengine.ListVersionsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + appengine.ListVersionsRequest(), + {}, + ], +) +async def test_list_versions_async(request_type, transport: str = "grpc_asyncio"): client = VersionsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1416,7 +1438,7 @@ async def test_list_versions_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_versions), "__call__") as call: @@ -1439,11 +1461,6 @@ async def test_list_versions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_versions_async_from_dict(): - await test_list_versions_async(request_type=dict) - - def test_list_versions_field_headers(): client = VersionsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1698,8 +1715,8 @@ async def test_list_versions_async_pages(): @pytest.mark.parametrize( "request_type", [ - appengine.GetVersionRequest, - dict, + appengine.GetVersionRequest(), + {}, ], ) def test_get_version(request_type, transport: str = "grpc"): @@ -1710,7 +1727,7 @@ def test_get_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_version), "__call__") as call: @@ -1792,9 +1809,10 @@ def test_get_version_non_empty_request_with_auto_populated_field(): client.get_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == appengine.GetVersionRequest( + request_msg = appengine.GetVersionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_version_use_cached_wrapped_rpc(): @@ -1875,9 +1893,14 @@ async def test_get_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_version_async( - transport: str = "grpc_asyncio", request_type=appengine.GetVersionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + appengine.GetVersionRequest(), + {}, + ], +) +async def test_get_version_async(request_type, transport: str = "grpc_asyncio"): client = VersionsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1885,7 +1908,7 @@ async def test_get_version_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_version), "__call__") as call: @@ -1946,11 +1969,6 @@ async def test_get_version_async( assert response.version_url == "version_url_value" -@pytest.mark.asyncio -async def test_get_version_async_from_dict(): - await test_get_version_async(request_type=dict) - - def test_get_version_field_headers(): client = VersionsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2013,8 +2031,8 @@ async def test_get_version_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - appengine.CreateVersionRequest, - dict, + appengine.CreateVersionRequest(), + {}, ], ) def test_create_version(request_type, transport: str = "grpc"): @@ -2025,7 +2043,7 @@ def test_create_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_version), "__call__") as call: @@ -2066,9 +2084,10 @@ def test_create_version_non_empty_request_with_auto_populated_field(): client.create_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == appengine.CreateVersionRequest( + request_msg = appengine.CreateVersionRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_version_use_cached_wrapped_rpc(): @@ -2159,9 +2178,14 @@ async def test_create_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_version_async( - transport: str = "grpc_asyncio", request_type=appengine.CreateVersionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + appengine.CreateVersionRequest(), + {}, + ], +) +async def test_create_version_async(request_type, transport: str = "grpc_asyncio"): client = VersionsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2169,7 +2193,7 @@ async def test_create_version_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_version), "__call__") as call: @@ -2189,11 +2213,6 @@ async def test_create_version_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_version_async_from_dict(): - await test_create_version_async(request_type=dict) - - def test_create_version_field_headers(): client = VersionsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2258,8 +2277,8 @@ async def test_create_version_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - appengine.UpdateVersionRequest, - dict, + appengine.UpdateVersionRequest(), + {}, ], ) def test_update_version(request_type, transport: str = "grpc"): @@ -2270,7 +2289,7 @@ def test_update_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_version), "__call__") as call: @@ -2311,9 +2330,10 @@ def test_update_version_non_empty_request_with_auto_populated_field(): client.update_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == appengine.UpdateVersionRequest( + request_msg = appengine.UpdateVersionRequest( name="name_value", ) + assert args[0] == request_msg def test_update_version_use_cached_wrapped_rpc(): @@ -2404,9 +2424,14 @@ async def test_update_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_version_async( - transport: str = "grpc_asyncio", request_type=appengine.UpdateVersionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + appengine.UpdateVersionRequest(), + {}, + ], +) +async def test_update_version_async(request_type, transport: str = "grpc_asyncio"): client = VersionsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2414,7 +2439,7 @@ async def test_update_version_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_version), "__call__") as call: @@ -2434,11 +2459,6 @@ async def test_update_version_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_version_async_from_dict(): - await test_update_version_async(request_type=dict) - - def test_update_version_field_headers(): client = VersionsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2503,8 +2523,8 @@ async def test_update_version_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - appengine.DeleteVersionRequest, - dict, + appengine.DeleteVersionRequest(), + {}, ], ) def test_delete_version(request_type, transport: str = "grpc"): @@ -2515,7 +2535,7 @@ def test_delete_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_version), "__call__") as call: @@ -2556,9 +2576,10 @@ def test_delete_version_non_empty_request_with_auto_populated_field(): client.delete_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == appengine.DeleteVersionRequest( + request_msg = appengine.DeleteVersionRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_version_use_cached_wrapped_rpc(): @@ -2649,9 +2670,14 @@ async def test_delete_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_version_async( - transport: str = "grpc_asyncio", request_type=appengine.DeleteVersionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + appengine.DeleteVersionRequest(), + {}, + ], +) +async def test_delete_version_async(request_type, transport: str = "grpc_asyncio"): client = VersionsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2659,7 +2685,7 @@ async def test_delete_version_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_version), "__call__") as call: @@ -2679,11 +2705,6 @@ async def test_delete_version_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_version_async_from_dict(): - await test_delete_version_async(request_type=dict) - - def test_delete_version_field_headers(): client = VersionsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3121,7 +3142,6 @@ def test_list_versions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.ListVersionsRequest() - assert args[0] == request_msg @@ -3142,7 +3162,6 @@ def test_get_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.GetVersionRequest() - assert args[0] == request_msg @@ -3163,7 +3182,6 @@ def test_create_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.CreateVersionRequest() - assert args[0] == request_msg @@ -3184,7 +3202,6 @@ def test_update_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.UpdateVersionRequest() - assert args[0] == request_msg @@ -3205,7 +3222,6 @@ def test_delete_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.DeleteVersionRequest() - assert args[0] == request_msg @@ -3246,7 +3262,6 @@ async def test_list_versions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.ListVersionsRequest() - assert args[0] == request_msg @@ -3291,7 +3306,6 @@ async def test_get_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.GetVersionRequest() - assert args[0] == request_msg @@ -3316,7 +3330,6 @@ async def test_create_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.CreateVersionRequest() - assert args[0] == request_msg @@ -3341,7 +3354,6 @@ async def test_update_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.UpdateVersionRequest() - assert args[0] == request_msg @@ -3366,7 +3378,6 @@ async def test_delete_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.DeleteVersionRequest() - assert args[0] == request_msg @@ -4503,7 +4514,6 @@ def test_list_versions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.ListVersionsRequest() - assert args[0] == request_msg @@ -4523,7 +4533,6 @@ def test_get_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.GetVersionRequest() - assert args[0] == request_msg @@ -4543,7 +4552,6 @@ def test_create_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.CreateVersionRequest() - assert args[0] == request_msg @@ -4563,7 +4571,6 @@ def test_update_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.UpdateVersionRequest() - assert args[0] == request_msg @@ -4583,7 +4590,6 @@ def test_delete_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = appengine.DeleteVersionRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-appengine-logging/noxfile.py b/packages/google-cloud-appengine-logging/noxfile.py index fca71e5b91b2..9d295bb84faa 100644 --- a/packages/google-cloud-appengine-logging/noxfile.py +++ b/packages/google-cloud-appengine-logging/noxfile.py @@ -47,7 +47,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-appengine-logging" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-appengine-logging/setup.py b/packages/google-cloud-appengine-logging/setup.py index c52319addd88..422fb283d3e9 100644 --- a/packages/google-cloud-appengine-logging/setup.py +++ b/packages/google-cloud-appengine-logging/setup.py @@ -45,7 +45,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/google-cloud-appengine-logging/testing/constraints-3.10.txt b/packages/google-cloud-appengine-logging/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-appengine-logging/testing/constraints-3.10.txt +++ b/packages/google-cloud-appengine-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-apphub/noxfile.py b/packages/google-cloud-apphub/noxfile.py index b4d3e39a8aeb..1ef74909a0de 100644 --- a/packages/google-cloud-apphub/noxfile.py +++ b/packages/google-cloud-apphub/noxfile.py @@ -47,7 +47,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-apphub" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-apphub/setup.py b/packages/google-cloud-apphub/setup.py index 4ab798c48799..64006dd5326b 100644 --- a/packages/google-cloud-apphub/setup.py +++ b/packages/google-cloud-apphub/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/google-cloud-apphub/testing/constraints-3.10.txt b/packages/google-cloud-apphub/testing/constraints-3.10.txt index a92801e1c8e2..b39cd54634f9 100644 --- a/packages/google-cloud-apphub/testing/constraints-3.10.txt +++ b/packages/google-cloud-apphub/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/google-cloud-apphub/tests/unit/gapic/apphub_v1/test_app_hub.py b/packages/google-cloud-apphub/tests/unit/gapic/apphub_v1/test_app_hub.py index 036941ab0cae..c5c33787561a 100644 --- a/packages/google-cloud-apphub/tests/unit/gapic/apphub_v1/test_app_hub.py +++ b/packages/google-cloud-apphub/tests/unit/gapic/apphub_v1/test_app_hub.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 @@ -134,6 +135,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" @@ -1266,8 +1282,8 @@ def test_app_hub_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - apphub_service.LookupServiceProjectAttachmentRequest, - dict, + apphub_service.LookupServiceProjectAttachmentRequest(), + {}, ], ) def test_lookup_service_project_attachment(request_type, transport: str = "grpc"): @@ -1278,7 +1294,7 @@ def test_lookup_service_project_attachment(request_type, transport: str = "grpc" # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1323,9 +1339,10 @@ def test_lookup_service_project_attachment_non_empty_request_with_auto_populated client.lookup_service_project_attachment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apphub_service.LookupServiceProjectAttachmentRequest( + request_msg = apphub_service.LookupServiceProjectAttachmentRequest( name="name_value", ) + assert args[0] == request_msg def test_lookup_service_project_attachment_use_cached_wrapped_rpc(): @@ -1411,9 +1428,15 @@ async def test_lookup_service_project_attachment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + apphub_service.LookupServiceProjectAttachmentRequest(), + {}, + ], +) async def test_lookup_service_project_attachment_async( - transport: str = "grpc_asyncio", - request_type=apphub_service.LookupServiceProjectAttachmentRequest, + request_type, transport: str = "grpc_asyncio" ): client = AppHubAsyncClient( credentials=async_anonymous_credentials(), @@ -1422,7 +1445,7 @@ async def test_lookup_service_project_attachment_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( @@ -1444,11 +1467,6 @@ async def test_lookup_service_project_attachment_async( assert isinstance(response, apphub_service.LookupServiceProjectAttachmentResponse) -@pytest.mark.asyncio -async def test_lookup_service_project_attachment_async_from_dict(): - await test_lookup_service_project_attachment_async(request_type=dict) - - def test_lookup_service_project_attachment_field_headers(): client = AppHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1603,8 +1621,8 @@ async def test_lookup_service_project_attachment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - apphub_service.ListServiceProjectAttachmentsRequest, - dict, + apphub_service.ListServiceProjectAttachmentsRequest(), + {}, ], ) def test_list_service_project_attachments(request_type, transport: str = "grpc"): @@ -1615,7 +1633,7 @@ def test_list_service_project_attachments(request_type, transport: str = "grpc") # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1668,12 +1686,13 @@ def test_list_service_project_attachments_non_empty_request_with_auto_populated_ client.list_service_project_attachments(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apphub_service.ListServiceProjectAttachmentsRequest( + request_msg = apphub_service.ListServiceProjectAttachmentsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_service_project_attachments_use_cached_wrapped_rpc(): @@ -1759,9 +1778,15 @@ async def test_list_service_project_attachments_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + apphub_service.ListServiceProjectAttachmentsRequest(), + {}, + ], +) async def test_list_service_project_attachments_async( - transport: str = "grpc_asyncio", - request_type=apphub_service.ListServiceProjectAttachmentsRequest, + request_type, transport: str = "grpc_asyncio" ): client = AppHubAsyncClient( credentials=async_anonymous_credentials(), @@ -1770,7 +1795,7 @@ async def test_list_service_project_attachments_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( @@ -1797,11 +1822,6 @@ async def test_list_service_project_attachments_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_service_project_attachments_async_from_dict(): - await test_list_service_project_attachments_async(request_type=dict) - - def test_list_service_project_attachments_field_headers(): client = AppHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2164,8 +2184,8 @@ async def test_list_service_project_attachments_async_pages(): @pytest.mark.parametrize( "request_type", [ - apphub_service.CreateServiceProjectAttachmentRequest, - dict, + apphub_service.CreateServiceProjectAttachmentRequest(), + {}, ], ) def test_create_service_project_attachment(request_type, transport: str = "grpc"): @@ -2176,7 +2196,7 @@ def test_create_service_project_attachment(request_type, transport: str = "grpc" # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2223,11 +2243,12 @@ def test_create_service_project_attachment_non_empty_request_with_auto_populated client.create_service_project_attachment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apphub_service.CreateServiceProjectAttachmentRequest( + request_msg = apphub_service.CreateServiceProjectAttachmentRequest( parent="parent_value", service_project_attachment_id="service_project_attachment_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_service_project_attachment_use_cached_wrapped_rpc(): @@ -2323,9 +2344,15 @@ async def test_create_service_project_attachment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + apphub_service.CreateServiceProjectAttachmentRequest(), + {}, + ], +) async def test_create_service_project_attachment_async( - transport: str = "grpc_asyncio", - request_type=apphub_service.CreateServiceProjectAttachmentRequest, + request_type, transport: str = "grpc_asyncio" ): client = AppHubAsyncClient( credentials=async_anonymous_credentials(), @@ -2334,7 +2361,7 @@ async def test_create_service_project_attachment_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( @@ -2356,11 +2383,6 @@ async def test_create_service_project_attachment_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_service_project_attachment_async_from_dict(): - await test_create_service_project_attachment_async(request_type=dict) - - def test_create_service_project_attachment_field_headers(): client = AppHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2547,8 +2569,8 @@ async def test_create_service_project_attachment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - apphub_service.GetServiceProjectAttachmentRequest, - dict, + apphub_service.GetServiceProjectAttachmentRequest(), + {}, ], ) def test_get_service_project_attachment(request_type, transport: str = "grpc"): @@ -2559,7 +2581,7 @@ def test_get_service_project_attachment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2616,9 +2638,10 @@ def test_get_service_project_attachment_non_empty_request_with_auto_populated_fi client.get_service_project_attachment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apphub_service.GetServiceProjectAttachmentRequest( + request_msg = apphub_service.GetServiceProjectAttachmentRequest( name="name_value", ) + assert args[0] == request_msg def test_get_service_project_attachment_use_cached_wrapped_rpc(): @@ -2704,9 +2727,15 @@ async def test_get_service_project_attachment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + apphub_service.GetServiceProjectAttachmentRequest(), + {}, + ], +) async def test_get_service_project_attachment_async( - transport: str = "grpc_asyncio", - request_type=apphub_service.GetServiceProjectAttachmentRequest, + request_type, transport: str = "grpc_asyncio" ): client = AppHubAsyncClient( credentials=async_anonymous_credentials(), @@ -2715,7 +2744,7 @@ async def test_get_service_project_attachment_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( @@ -2749,11 +2778,6 @@ async def test_get_service_project_attachment_async( ) -@pytest.mark.asyncio -async def test_get_service_project_attachment_async_from_dict(): - await test_get_service_project_attachment_async(request_type=dict) - - def test_get_service_project_attachment_field_headers(): client = AppHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2908,8 +2932,8 @@ async def test_get_service_project_attachment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - apphub_service.DeleteServiceProjectAttachmentRequest, - dict, + apphub_service.DeleteServiceProjectAttachmentRequest(), + {}, ], ) def test_delete_service_project_attachment(request_type, transport: str = "grpc"): @@ -2920,7 +2944,7 @@ def test_delete_service_project_attachment(request_type, transport: str = "grpc" # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2966,10 +2990,11 @@ def test_delete_service_project_attachment_non_empty_request_with_auto_populated client.delete_service_project_attachment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apphub_service.DeleteServiceProjectAttachmentRequest( + request_msg = apphub_service.DeleteServiceProjectAttachmentRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_service_project_attachment_use_cached_wrapped_rpc(): @@ -3065,9 +3090,15 @@ async def test_delete_service_project_attachment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + apphub_service.DeleteServiceProjectAttachmentRequest(), + {}, + ], +) async def test_delete_service_project_attachment_async( - transport: str = "grpc_asyncio", - request_type=apphub_service.DeleteServiceProjectAttachmentRequest, + request_type, transport: str = "grpc_asyncio" ): client = AppHubAsyncClient( credentials=async_anonymous_credentials(), @@ -3076,7 +3107,7 @@ async def test_delete_service_project_attachment_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( @@ -3098,11 +3129,6 @@ async def test_delete_service_project_attachment_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_service_project_attachment_async_from_dict(): - await test_delete_service_project_attachment_async(request_type=dict) - - def test_delete_service_project_attachment_field_headers(): client = AppHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3257,8 +3283,8 @@ async def test_delete_service_project_attachment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - apphub_service.DetachServiceProjectAttachmentRequest, - dict, + apphub_service.DetachServiceProjectAttachmentRequest(), + {}, ], ) def test_detach_service_project_attachment(request_type, transport: str = "grpc"): @@ -3269,7 +3295,7 @@ def test_detach_service_project_attachment(request_type, transport: str = "grpc" # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3314,9 +3340,10 @@ def test_detach_service_project_attachment_non_empty_request_with_auto_populated client.detach_service_project_attachment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apphub_service.DetachServiceProjectAttachmentRequest( + request_msg = apphub_service.DetachServiceProjectAttachmentRequest( name="name_value", ) + assert args[0] == request_msg def test_detach_service_project_attachment_use_cached_wrapped_rpc(): @@ -3402,9 +3429,15 @@ async def test_detach_service_project_attachment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + apphub_service.DetachServiceProjectAttachmentRequest(), + {}, + ], +) async def test_detach_service_project_attachment_async( - transport: str = "grpc_asyncio", - request_type=apphub_service.DetachServiceProjectAttachmentRequest, + request_type, transport: str = "grpc_asyncio" ): client = AppHubAsyncClient( credentials=async_anonymous_credentials(), @@ -3413,7 +3446,7 @@ async def test_detach_service_project_attachment_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( @@ -3435,11 +3468,6 @@ async def test_detach_service_project_attachment_async( assert isinstance(response, apphub_service.DetachServiceProjectAttachmentResponse) -@pytest.mark.asyncio -async def test_detach_service_project_attachment_async_from_dict(): - await test_detach_service_project_attachment_async(request_type=dict) - - def test_detach_service_project_attachment_field_headers(): client = AppHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3594,8 +3622,8 @@ async def test_detach_service_project_attachment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - apphub_service.ListDiscoveredServicesRequest, - dict, + apphub_service.ListDiscoveredServicesRequest(), + {}, ], ) def test_list_discovered_services(request_type, transport: str = "grpc"): @@ -3606,7 +3634,7 @@ def test_list_discovered_services(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3659,12 +3687,13 @@ def test_list_discovered_services_non_empty_request_with_auto_populated_field(): client.list_discovered_services(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apphub_service.ListDiscoveredServicesRequest( + request_msg = apphub_service.ListDiscoveredServicesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_discovered_services_use_cached_wrapped_rpc(): @@ -3750,9 +3779,15 @@ async def test_list_discovered_services_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + apphub_service.ListDiscoveredServicesRequest(), + {}, + ], +) async def test_list_discovered_services_async( - transport: str = "grpc_asyncio", - request_type=apphub_service.ListDiscoveredServicesRequest, + request_type, transport: str = "grpc_asyncio" ): client = AppHubAsyncClient( credentials=async_anonymous_credentials(), @@ -3761,7 +3796,7 @@ async def test_list_discovered_services_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( @@ -3788,11 +3823,6 @@ async def test_list_discovered_services_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_discovered_services_async_from_dict(): - await test_list_discovered_services_async(request_type=dict) - - def test_list_discovered_services_field_headers(): client = AppHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4147,8 +4177,8 @@ async def test_list_discovered_services_async_pages(): @pytest.mark.parametrize( "request_type", [ - apphub_service.GetDiscoveredServiceRequest, - dict, + apphub_service.GetDiscoveredServiceRequest(), + {}, ], ) def test_get_discovered_service(request_type, transport: str = "grpc"): @@ -4159,7 +4189,7 @@ def test_get_discovered_service(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4207,9 +4237,10 @@ def test_get_discovered_service_non_empty_request_with_auto_populated_field(): client.get_discovered_service(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apphub_service.GetDiscoveredServiceRequest( + request_msg = apphub_service.GetDiscoveredServiceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_discovered_service_use_cached_wrapped_rpc(): @@ -4295,9 +4326,15 @@ async def test_get_discovered_service_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + apphub_service.GetDiscoveredServiceRequest(), + {}, + ], +) async def test_get_discovered_service_async( - transport: str = "grpc_asyncio", - request_type=apphub_service.GetDiscoveredServiceRequest, + request_type, transport: str = "grpc_asyncio" ): client = AppHubAsyncClient( credentials=async_anonymous_credentials(), @@ -4306,7 +4343,7 @@ async def test_get_discovered_service_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( @@ -4331,11 +4368,6 @@ async def test_get_discovered_service_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_discovered_service_async_from_dict(): - await test_get_discovered_service_async(request_type=dict) - - def test_get_discovered_service_field_headers(): client = AppHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4490,8 +4522,8 @@ async def test_get_discovered_service_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - apphub_service.LookupDiscoveredServiceRequest, - dict, + apphub_service.LookupDiscoveredServiceRequest(), + {}, ], ) def test_lookup_discovered_service(request_type, transport: str = "grpc"): @@ -4502,7 +4534,7 @@ def test_lookup_discovered_service(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4548,10 +4580,11 @@ def test_lookup_discovered_service_non_empty_request_with_auto_populated_field() client.lookup_discovered_service(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apphub_service.LookupDiscoveredServiceRequest( + request_msg = apphub_service.LookupDiscoveredServiceRequest( parent="parent_value", uri="uri_value", ) + assert args[0] == request_msg def test_lookup_discovered_service_use_cached_wrapped_rpc(): @@ -4637,9 +4670,15 @@ async def test_lookup_discovered_service_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + apphub_service.LookupDiscoveredServiceRequest(), + {}, + ], +) async def test_lookup_discovered_service_async( - transport: str = "grpc_asyncio", - request_type=apphub_service.LookupDiscoveredServiceRequest, + request_type, transport: str = "grpc_asyncio" ): client = AppHubAsyncClient( credentials=async_anonymous_credentials(), @@ -4648,7 +4687,7 @@ async def test_lookup_discovered_service_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( @@ -4670,11 +4709,6 @@ async def test_lookup_discovered_service_async( assert isinstance(response, apphub_service.LookupDiscoveredServiceResponse) -@pytest.mark.asyncio -async def test_lookup_discovered_service_async_from_dict(): - await test_lookup_discovered_service_async(request_type=dict) - - def test_lookup_discovered_service_field_headers(): client = AppHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4839,8 +4873,8 @@ async def test_lookup_discovered_service_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - apphub_service.ListServicesRequest, - dict, + apphub_service.ListServicesRequest(), + {}, ], ) def test_list_services(request_type, transport: str = "grpc"): @@ -4851,7 +4885,7 @@ def test_list_services(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_services), "__call__") as call: @@ -4900,12 +4934,13 @@ def test_list_services_non_empty_request_with_auto_populated_field(): client.list_services(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apphub_service.ListServicesRequest( + request_msg = apphub_service.ListServicesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_services_use_cached_wrapped_rpc(): @@ -4986,9 +5021,14 @@ async def test_list_services_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_services_async( - transport: str = "grpc_asyncio", request_type=apphub_service.ListServicesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + apphub_service.ListServicesRequest(), + {}, + ], +) +async def test_list_services_async(request_type, transport: str = "grpc_asyncio"): client = AppHubAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4996,7 +5036,7 @@ async def test_list_services_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_services), "__call__") as call: @@ -5021,11 +5061,6 @@ async def test_list_services_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_services_async_from_dict(): - await test_list_services_async(request_type=dict) - - def test_list_services_field_headers(): client = AppHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5362,8 +5397,8 @@ async def test_list_services_async_pages(): @pytest.mark.parametrize( "request_type", [ - apphub_service.CreateServiceRequest, - dict, + apphub_service.CreateServiceRequest(), + {}, ], ) def test_create_service(request_type, transport: str = "grpc"): @@ -5374,7 +5409,7 @@ def test_create_service(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_service), "__call__") as call: @@ -5417,11 +5452,12 @@ def test_create_service_non_empty_request_with_auto_populated_field(): client.create_service(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apphub_service.CreateServiceRequest( + request_msg = apphub_service.CreateServiceRequest( parent="parent_value", service_id="service_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_service_use_cached_wrapped_rpc(): @@ -5512,9 +5548,14 @@ async def test_create_service_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_service_async( - transport: str = "grpc_asyncio", request_type=apphub_service.CreateServiceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + apphub_service.CreateServiceRequest(), + {}, + ], +) +async def test_create_service_async(request_type, transport: str = "grpc_asyncio"): client = AppHubAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5522,7 +5563,7 @@ async def test_create_service_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_service), "__call__") as call: @@ -5542,11 +5583,6 @@ async def test_create_service_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_service_async_from_dict(): - await test_create_service_async(request_type=dict) - - def test_create_service_field_headers(): client = AppHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5713,8 +5749,8 @@ async def test_create_service_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - apphub_service.GetServiceRequest, - dict, + apphub_service.GetServiceRequest(), + {}, ], ) def test_get_service(request_type, transport: str = "grpc"): @@ -5725,7 +5761,7 @@ def test_get_service(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_service), "__call__") as call: @@ -5779,9 +5815,10 @@ def test_get_service_non_empty_request_with_auto_populated_field(): client.get_service(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apphub_service.GetServiceRequest( + request_msg = apphub_service.GetServiceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_service_use_cached_wrapped_rpc(): @@ -5862,9 +5899,14 @@ async def test_get_service_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_service_async( - transport: str = "grpc_asyncio", request_type=apphub_service.GetServiceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + apphub_service.GetServiceRequest(), + {}, + ], +) +async def test_get_service_async(request_type, transport: str = "grpc_asyncio"): client = AppHubAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5872,7 +5914,7 @@ async def test_get_service_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_service), "__call__") as call: @@ -5905,11 +5947,6 @@ async def test_get_service_async( assert response.state == service.Service.State.CREATING -@pytest.mark.asyncio -async def test_get_service_async_from_dict(): - await test_get_service_async(request_type=dict) - - def test_get_service_field_headers(): client = AppHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6052,8 +6089,8 @@ async def test_get_service_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - apphub_service.UpdateServiceRequest, - dict, + apphub_service.UpdateServiceRequest(), + {}, ], ) def test_update_service(request_type, transport: str = "grpc"): @@ -6064,7 +6101,7 @@ def test_update_service(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_service), "__call__") as call: @@ -6105,9 +6142,10 @@ def test_update_service_non_empty_request_with_auto_populated_field(): client.update_service(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apphub_service.UpdateServiceRequest( + request_msg = apphub_service.UpdateServiceRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_service_use_cached_wrapped_rpc(): @@ -6198,9 +6236,14 @@ async def test_update_service_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_service_async( - transport: str = "grpc_asyncio", request_type=apphub_service.UpdateServiceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + apphub_service.UpdateServiceRequest(), + {}, + ], +) +async def test_update_service_async(request_type, transport: str = "grpc_asyncio"): client = AppHubAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6208,7 +6251,7 @@ async def test_update_service_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_service), "__call__") as call: @@ -6228,11 +6271,6 @@ async def test_update_service_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_service_async_from_dict(): - await test_update_service_async(request_type=dict) - - def test_update_service_field_headers(): client = AppHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6389,8 +6427,8 @@ async def test_update_service_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - apphub_service.DeleteServiceRequest, - dict, + apphub_service.DeleteServiceRequest(), + {}, ], ) def test_delete_service(request_type, transport: str = "grpc"): @@ -6401,7 +6439,7 @@ def test_delete_service(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_service), "__call__") as call: @@ -6443,10 +6481,11 @@ def test_delete_service_non_empty_request_with_auto_populated_field(): client.delete_service(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apphub_service.DeleteServiceRequest( + request_msg = apphub_service.DeleteServiceRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_service_use_cached_wrapped_rpc(): @@ -6537,9 +6576,14 @@ async def test_delete_service_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_service_async( - transport: str = "grpc_asyncio", request_type=apphub_service.DeleteServiceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + apphub_service.DeleteServiceRequest(), + {}, + ], +) +async def test_delete_service_async(request_type, transport: str = "grpc_asyncio"): client = AppHubAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6547,7 +6591,7 @@ async def test_delete_service_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_service), "__call__") as call: @@ -6567,11 +6611,6 @@ async def test_delete_service_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_service_async_from_dict(): - await test_delete_service_async(request_type=dict) - - def test_delete_service_field_headers(): client = AppHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6718,8 +6757,8 @@ async def test_delete_service_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - apphub_service.ListDiscoveredWorkloadsRequest, - dict, + apphub_service.ListDiscoveredWorkloadsRequest(), + {}, ], ) def test_list_discovered_workloads(request_type, transport: str = "grpc"): @@ -6730,7 +6769,7 @@ def test_list_discovered_workloads(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6783,12 +6822,13 @@ def test_list_discovered_workloads_non_empty_request_with_auto_populated_field() client.list_discovered_workloads(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apphub_service.ListDiscoveredWorkloadsRequest( + request_msg = apphub_service.ListDiscoveredWorkloadsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_discovered_workloads_use_cached_wrapped_rpc(): @@ -6874,9 +6914,15 @@ async def test_list_discovered_workloads_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + apphub_service.ListDiscoveredWorkloadsRequest(), + {}, + ], +) async def test_list_discovered_workloads_async( - transport: str = "grpc_asyncio", - request_type=apphub_service.ListDiscoveredWorkloadsRequest, + request_type, transport: str = "grpc_asyncio" ): client = AppHubAsyncClient( credentials=async_anonymous_credentials(), @@ -6885,7 +6931,7 @@ async def test_list_discovered_workloads_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( @@ -6912,11 +6958,6 @@ async def test_list_discovered_workloads_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_discovered_workloads_async_from_dict(): - await test_list_discovered_workloads_async(request_type=dict) - - def test_list_discovered_workloads_field_headers(): client = AppHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7271,8 +7312,8 @@ async def test_list_discovered_workloads_async_pages(): @pytest.mark.parametrize( "request_type", [ - apphub_service.GetDiscoveredWorkloadRequest, - dict, + apphub_service.GetDiscoveredWorkloadRequest(), + {}, ], ) def test_get_discovered_workload(request_type, transport: str = "grpc"): @@ -7283,7 +7324,7 @@ def test_get_discovered_workload(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7331,9 +7372,10 @@ def test_get_discovered_workload_non_empty_request_with_auto_populated_field(): client.get_discovered_workload(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apphub_service.GetDiscoveredWorkloadRequest( + request_msg = apphub_service.GetDiscoveredWorkloadRequest( name="name_value", ) + assert args[0] == request_msg def test_get_discovered_workload_use_cached_wrapped_rpc(): @@ -7419,9 +7461,15 @@ async def test_get_discovered_workload_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + apphub_service.GetDiscoveredWorkloadRequest(), + {}, + ], +) async def test_get_discovered_workload_async( - transport: str = "grpc_asyncio", - request_type=apphub_service.GetDiscoveredWorkloadRequest, + request_type, transport: str = "grpc_asyncio" ): client = AppHubAsyncClient( credentials=async_anonymous_credentials(), @@ -7430,7 +7478,7 @@ async def test_get_discovered_workload_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( @@ -7455,11 +7503,6 @@ async def test_get_discovered_workload_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_discovered_workload_async_from_dict(): - await test_get_discovered_workload_async(request_type=dict) - - def test_get_discovered_workload_field_headers(): client = AppHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7614,8 +7657,8 @@ async def test_get_discovered_workload_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - apphub_service.LookupDiscoveredWorkloadRequest, - dict, + apphub_service.LookupDiscoveredWorkloadRequest(), + {}, ], ) def test_lookup_discovered_workload(request_type, transport: str = "grpc"): @@ -7626,7 +7669,7 @@ def test_lookup_discovered_workload(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7672,10 +7715,11 @@ def test_lookup_discovered_workload_non_empty_request_with_auto_populated_field( client.lookup_discovered_workload(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apphub_service.LookupDiscoveredWorkloadRequest( + request_msg = apphub_service.LookupDiscoveredWorkloadRequest( parent="parent_value", uri="uri_value", ) + assert args[0] == request_msg def test_lookup_discovered_workload_use_cached_wrapped_rpc(): @@ -7761,9 +7805,15 @@ async def test_lookup_discovered_workload_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + apphub_service.LookupDiscoveredWorkloadRequest(), + {}, + ], +) async def test_lookup_discovered_workload_async( - transport: str = "grpc_asyncio", - request_type=apphub_service.LookupDiscoveredWorkloadRequest, + request_type, transport: str = "grpc_asyncio" ): client = AppHubAsyncClient( credentials=async_anonymous_credentials(), @@ -7772,7 +7822,7 @@ async def test_lookup_discovered_workload_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( @@ -7794,11 +7844,6 @@ async def test_lookup_discovered_workload_async( assert isinstance(response, apphub_service.LookupDiscoveredWorkloadResponse) -@pytest.mark.asyncio -async def test_lookup_discovered_workload_async_from_dict(): - await test_lookup_discovered_workload_async(request_type=dict) - - def test_lookup_discovered_workload_field_headers(): client = AppHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7963,8 +8008,8 @@ async def test_lookup_discovered_workload_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - apphub_service.ListWorkloadsRequest, - dict, + apphub_service.ListWorkloadsRequest(), + {}, ], ) def test_list_workloads(request_type, transport: str = "grpc"): @@ -7975,7 +8020,7 @@ def test_list_workloads(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_workloads), "__call__") as call: @@ -8024,12 +8069,13 @@ def test_list_workloads_non_empty_request_with_auto_populated_field(): client.list_workloads(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apphub_service.ListWorkloadsRequest( + request_msg = apphub_service.ListWorkloadsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_workloads_use_cached_wrapped_rpc(): @@ -8110,9 +8156,14 @@ async def test_list_workloads_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_workloads_async( - transport: str = "grpc_asyncio", request_type=apphub_service.ListWorkloadsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + apphub_service.ListWorkloadsRequest(), + {}, + ], +) +async def test_list_workloads_async(request_type, transport: str = "grpc_asyncio"): client = AppHubAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8120,7 +8171,7 @@ async def test_list_workloads_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_workloads), "__call__") as call: @@ -8145,11 +8196,6 @@ async def test_list_workloads_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_workloads_async_from_dict(): - await test_list_workloads_async(request_type=dict) - - def test_list_workloads_field_headers(): client = AppHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8486,8 +8532,8 @@ async def test_list_workloads_async_pages(): @pytest.mark.parametrize( "request_type", [ - apphub_service.CreateWorkloadRequest, - dict, + apphub_service.CreateWorkloadRequest(), + {}, ], ) def test_create_workload(request_type, transport: str = "grpc"): @@ -8498,7 +8544,7 @@ def test_create_workload(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_workload), "__call__") as call: @@ -8541,11 +8587,12 @@ def test_create_workload_non_empty_request_with_auto_populated_field(): client.create_workload(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apphub_service.CreateWorkloadRequest( + request_msg = apphub_service.CreateWorkloadRequest( parent="parent_value", workload_id="workload_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_workload_use_cached_wrapped_rpc(): @@ -8636,9 +8683,14 @@ async def test_create_workload_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_workload_async( - transport: str = "grpc_asyncio", request_type=apphub_service.CreateWorkloadRequest -): +@pytest.mark.parametrize( + "request_type", + [ + apphub_service.CreateWorkloadRequest(), + {}, + ], +) +async def test_create_workload_async(request_type, transport: str = "grpc_asyncio"): client = AppHubAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8646,7 +8698,7 @@ async def test_create_workload_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_workload), "__call__") as call: @@ -8666,11 +8718,6 @@ async def test_create_workload_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_workload_async_from_dict(): - await test_create_workload_async(request_type=dict) - - def test_create_workload_field_headers(): client = AppHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8837,8 +8884,8 @@ async def test_create_workload_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - apphub_service.GetWorkloadRequest, - dict, + apphub_service.GetWorkloadRequest(), + {}, ], ) def test_get_workload(request_type, transport: str = "grpc"): @@ -8849,7 +8896,7 @@ def test_get_workload(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_workload), "__call__") as call: @@ -8903,9 +8950,10 @@ def test_get_workload_non_empty_request_with_auto_populated_field(): client.get_workload(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apphub_service.GetWorkloadRequest( + request_msg = apphub_service.GetWorkloadRequest( name="name_value", ) + assert args[0] == request_msg def test_get_workload_use_cached_wrapped_rpc(): @@ -8986,9 +9034,14 @@ async def test_get_workload_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_workload_async( - transport: str = "grpc_asyncio", request_type=apphub_service.GetWorkloadRequest -): +@pytest.mark.parametrize( + "request_type", + [ + apphub_service.GetWorkloadRequest(), + {}, + ], +) +async def test_get_workload_async(request_type, transport: str = "grpc_asyncio"): client = AppHubAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8996,7 +9049,7 @@ async def test_get_workload_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_workload), "__call__") as call: @@ -9029,11 +9082,6 @@ async def test_get_workload_async( assert response.state == workload.Workload.State.CREATING -@pytest.mark.asyncio -async def test_get_workload_async_from_dict(): - await test_get_workload_async(request_type=dict) - - def test_get_workload_field_headers(): client = AppHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9176,8 +9224,8 @@ async def test_get_workload_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - apphub_service.UpdateWorkloadRequest, - dict, + apphub_service.UpdateWorkloadRequest(), + {}, ], ) def test_update_workload(request_type, transport: str = "grpc"): @@ -9188,7 +9236,7 @@ def test_update_workload(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_workload), "__call__") as call: @@ -9229,9 +9277,10 @@ def test_update_workload_non_empty_request_with_auto_populated_field(): client.update_workload(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apphub_service.UpdateWorkloadRequest( + request_msg = apphub_service.UpdateWorkloadRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_workload_use_cached_wrapped_rpc(): @@ -9322,9 +9371,14 @@ async def test_update_workload_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_workload_async( - transport: str = "grpc_asyncio", request_type=apphub_service.UpdateWorkloadRequest -): +@pytest.mark.parametrize( + "request_type", + [ + apphub_service.UpdateWorkloadRequest(), + {}, + ], +) +async def test_update_workload_async(request_type, transport: str = "grpc_asyncio"): client = AppHubAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9332,7 +9386,7 @@ async def test_update_workload_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_workload), "__call__") as call: @@ -9352,11 +9406,6 @@ async def test_update_workload_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_workload_async_from_dict(): - await test_update_workload_async(request_type=dict) - - def test_update_workload_field_headers(): client = AppHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9513,8 +9562,8 @@ async def test_update_workload_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - apphub_service.DeleteWorkloadRequest, - dict, + apphub_service.DeleteWorkloadRequest(), + {}, ], ) def test_delete_workload(request_type, transport: str = "grpc"): @@ -9525,7 +9574,7 @@ def test_delete_workload(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_workload), "__call__") as call: @@ -9567,10 +9616,11 @@ def test_delete_workload_non_empty_request_with_auto_populated_field(): client.delete_workload(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apphub_service.DeleteWorkloadRequest( + request_msg = apphub_service.DeleteWorkloadRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_workload_use_cached_wrapped_rpc(): @@ -9661,9 +9711,14 @@ async def test_delete_workload_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_workload_async( - transport: str = "grpc_asyncio", request_type=apphub_service.DeleteWorkloadRequest -): +@pytest.mark.parametrize( + "request_type", + [ + apphub_service.DeleteWorkloadRequest(), + {}, + ], +) +async def test_delete_workload_async(request_type, transport: str = "grpc_asyncio"): client = AppHubAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9671,7 +9726,7 @@ async def test_delete_workload_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_workload), "__call__") as call: @@ -9691,11 +9746,6 @@ async def test_delete_workload_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_workload_async_from_dict(): - await test_delete_workload_async(request_type=dict) - - def test_delete_workload_field_headers(): client = AppHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9842,8 +9892,8 @@ async def test_delete_workload_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - apphub_service.ListApplicationsRequest, - dict, + apphub_service.ListApplicationsRequest(), + {}, ], ) def test_list_applications(request_type, transport: str = "grpc"): @@ -9854,7 +9904,7 @@ def test_list_applications(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9907,12 +9957,13 @@ def test_list_applications_non_empty_request_with_auto_populated_field(): client.list_applications(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apphub_service.ListApplicationsRequest( + request_msg = apphub_service.ListApplicationsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_applications_use_cached_wrapped_rpc(): @@ -9995,9 +10046,14 @@ async def test_list_applications_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_applications_async( - transport: str = "grpc_asyncio", request_type=apphub_service.ListApplicationsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + apphub_service.ListApplicationsRequest(), + {}, + ], +) +async def test_list_applications_async(request_type, transport: str = "grpc_asyncio"): client = AppHubAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10005,7 +10061,7 @@ async def test_list_applications_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( @@ -10032,11 +10088,6 @@ async def test_list_applications_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_applications_async_from_dict(): - await test_list_applications_async(request_type=dict) - - def test_list_applications_field_headers(): client = AppHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10389,8 +10440,8 @@ async def test_list_applications_async_pages(): @pytest.mark.parametrize( "request_type", [ - apphub_service.CreateApplicationRequest, - dict, + apphub_service.CreateApplicationRequest(), + {}, ], ) def test_create_application(request_type, transport: str = "grpc"): @@ -10401,7 +10452,7 @@ def test_create_application(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10448,11 +10499,12 @@ def test_create_application_non_empty_request_with_auto_populated_field(): client.create_application(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apphub_service.CreateApplicationRequest( + request_msg = apphub_service.CreateApplicationRequest( parent="parent_value", application_id="application_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_application_use_cached_wrapped_rpc(): @@ -10547,10 +10599,14 @@ async def test_create_application_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_application_async( - transport: str = "grpc_asyncio", - request_type=apphub_service.CreateApplicationRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + apphub_service.CreateApplicationRequest(), + {}, + ], +) +async def test_create_application_async(request_type, transport: str = "grpc_asyncio"): client = AppHubAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10558,7 +10614,7 @@ async def test_create_application_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( @@ -10580,11 +10636,6 @@ async def test_create_application_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_application_async_from_dict(): - await test_create_application_async(request_type=dict) - - def test_create_application_field_headers(): client = AppHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10759,8 +10810,8 @@ async def test_create_application_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - apphub_service.GetApplicationRequest, - dict, + apphub_service.GetApplicationRequest(), + {}, ], ) def test_get_application(request_type, transport: str = "grpc"): @@ -10771,7 +10822,7 @@ def test_get_application(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_application), "__call__") as call: @@ -10823,9 +10874,10 @@ def test_get_application_non_empty_request_with_auto_populated_field(): client.get_application(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apphub_service.GetApplicationRequest( + request_msg = apphub_service.GetApplicationRequest( name="name_value", ) + assert args[0] == request_msg def test_get_application_use_cached_wrapped_rpc(): @@ -10906,9 +10958,14 @@ async def test_get_application_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_application_async( - transport: str = "grpc_asyncio", request_type=apphub_service.GetApplicationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + apphub_service.GetApplicationRequest(), + {}, + ], +) +async def test_get_application_async(request_type, transport: str = "grpc_asyncio"): client = AppHubAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10916,7 +10973,7 @@ async def test_get_application_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_application), "__call__") as call: @@ -10947,11 +11004,6 @@ async def test_get_application_async( assert response.state == application.Application.State.CREATING -@pytest.mark.asyncio -async def test_get_application_async_from_dict(): - await test_get_application_async(request_type=dict) - - def test_get_application_field_headers(): client = AppHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11098,8 +11150,8 @@ async def test_get_application_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - apphub_service.UpdateApplicationRequest, - dict, + apphub_service.UpdateApplicationRequest(), + {}, ], ) def test_update_application(request_type, transport: str = "grpc"): @@ -11110,7 +11162,7 @@ def test_update_application(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11155,9 +11207,10 @@ def test_update_application_non_empty_request_with_auto_populated_field(): client.update_application(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apphub_service.UpdateApplicationRequest( + request_msg = apphub_service.UpdateApplicationRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_application_use_cached_wrapped_rpc(): @@ -11252,10 +11305,14 @@ async def test_update_application_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_application_async( - transport: str = "grpc_asyncio", - request_type=apphub_service.UpdateApplicationRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + apphub_service.UpdateApplicationRequest(), + {}, + ], +) +async def test_update_application_async(request_type, transport: str = "grpc_asyncio"): client = AppHubAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11263,7 +11320,7 @@ async def test_update_application_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( @@ -11285,11 +11342,6 @@ async def test_update_application_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_application_async_from_dict(): - await test_update_application_async(request_type=dict) - - def test_update_application_field_headers(): client = AppHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11454,8 +11506,8 @@ async def test_update_application_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - apphub_service.DeleteApplicationRequest, - dict, + apphub_service.DeleteApplicationRequest(), + {}, ], ) def test_delete_application(request_type, transport: str = "grpc"): @@ -11466,7 +11518,7 @@ def test_delete_application(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11512,10 +11564,11 @@ def test_delete_application_non_empty_request_with_auto_populated_field(): client.delete_application(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apphub_service.DeleteApplicationRequest( + request_msg = apphub_service.DeleteApplicationRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_application_use_cached_wrapped_rpc(): @@ -11610,10 +11663,14 @@ async def test_delete_application_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_application_async( - transport: str = "grpc_asyncio", - request_type=apphub_service.DeleteApplicationRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + apphub_service.DeleteApplicationRequest(), + {}, + ], +) +async def test_delete_application_async(request_type, transport: str = "grpc_asyncio"): client = AppHubAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11621,7 +11678,7 @@ async def test_delete_application_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( @@ -11643,11 +11700,6 @@ async def test_delete_application_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_application_async_from_dict(): - await test_delete_application_async(request_type=dict) - - def test_delete_application_field_headers(): client = AppHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17660,7 +17712,6 @@ def test_lookup_service_project_attachment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.LookupServiceProjectAttachmentRequest() - assert args[0] == request_msg @@ -17683,7 +17734,6 @@ def test_list_service_project_attachments_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.ListServiceProjectAttachmentsRequest() - assert args[0] == request_msg @@ -17706,7 +17756,6 @@ def test_create_service_project_attachment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.CreateServiceProjectAttachmentRequest() - assert args[0] == request_msg @@ -17729,7 +17778,6 @@ def test_get_service_project_attachment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.GetServiceProjectAttachmentRequest() - assert args[0] == request_msg @@ -17752,7 +17800,6 @@ def test_delete_service_project_attachment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.DeleteServiceProjectAttachmentRequest() - assert args[0] == request_msg @@ -17775,7 +17822,6 @@ def test_detach_service_project_attachment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.DetachServiceProjectAttachmentRequest() - assert args[0] == request_msg @@ -17798,7 +17844,6 @@ def test_list_discovered_services_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.ListDiscoveredServicesRequest() - assert args[0] == request_msg @@ -17821,7 +17866,6 @@ def test_get_discovered_service_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.GetDiscoveredServiceRequest() - assert args[0] == request_msg @@ -17844,7 +17888,6 @@ def test_lookup_discovered_service_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.LookupDiscoveredServiceRequest() - assert args[0] == request_msg @@ -17865,7 +17908,6 @@ def test_list_services_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.ListServicesRequest() - assert args[0] == request_msg @@ -17886,7 +17928,6 @@ def test_create_service_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.CreateServiceRequest() - assert args[0] == request_msg @@ -17907,7 +17948,6 @@ def test_get_service_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.GetServiceRequest() - assert args[0] == request_msg @@ -17928,7 +17968,6 @@ def test_update_service_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.UpdateServiceRequest() - assert args[0] == request_msg @@ -17949,7 +17988,6 @@ def test_delete_service_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.DeleteServiceRequest() - assert args[0] == request_msg @@ -17972,7 +18010,6 @@ def test_list_discovered_workloads_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.ListDiscoveredWorkloadsRequest() - assert args[0] == request_msg @@ -17995,7 +18032,6 @@ def test_get_discovered_workload_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.GetDiscoveredWorkloadRequest() - assert args[0] == request_msg @@ -18018,7 +18054,6 @@ def test_lookup_discovered_workload_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.LookupDiscoveredWorkloadRequest() - assert args[0] == request_msg @@ -18039,7 +18074,6 @@ def test_list_workloads_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.ListWorkloadsRequest() - assert args[0] == request_msg @@ -18060,7 +18094,6 @@ def test_create_workload_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.CreateWorkloadRequest() - assert args[0] == request_msg @@ -18081,7 +18114,6 @@ def test_get_workload_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.GetWorkloadRequest() - assert args[0] == request_msg @@ -18102,7 +18134,6 @@ def test_update_workload_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.UpdateWorkloadRequest() - assert args[0] == request_msg @@ -18123,7 +18154,6 @@ def test_delete_workload_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.DeleteWorkloadRequest() - assert args[0] == request_msg @@ -18146,7 +18176,6 @@ def test_list_applications_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.ListApplicationsRequest() - assert args[0] == request_msg @@ -18169,7 +18198,6 @@ def test_create_application_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.CreateApplicationRequest() - assert args[0] == request_msg @@ -18190,7 +18218,6 @@ def test_get_application_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.GetApplicationRequest() - assert args[0] == request_msg @@ -18213,7 +18240,6 @@ def test_update_application_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.UpdateApplicationRequest() - assert args[0] == request_msg @@ -18236,7 +18262,6 @@ def test_delete_application_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.DeleteApplicationRequest() - assert args[0] == request_msg @@ -18277,7 +18302,6 @@ async def test_lookup_service_project_attachment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.LookupServiceProjectAttachmentRequest() - assert args[0] == request_msg @@ -18307,7 +18331,6 @@ async def test_list_service_project_attachments_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.ListServiceProjectAttachmentsRequest() - assert args[0] == request_msg @@ -18334,7 +18357,6 @@ async def test_create_service_project_attachment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.CreateServiceProjectAttachmentRequest() - assert args[0] == request_msg @@ -18366,7 +18388,6 @@ async def test_get_service_project_attachment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.GetServiceProjectAttachmentRequest() - assert args[0] == request_msg @@ -18393,7 +18414,6 @@ async def test_delete_service_project_attachment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.DeleteServiceProjectAttachmentRequest() - assert args[0] == request_msg @@ -18420,7 +18440,6 @@ async def test_detach_service_project_attachment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.DetachServiceProjectAttachmentRequest() - assert args[0] == request_msg @@ -18450,7 +18469,6 @@ async def test_list_discovered_services_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.ListDiscoveredServicesRequest() - assert args[0] == request_msg @@ -18479,7 +18497,6 @@ async def test_get_discovered_service_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.GetDiscoveredServiceRequest() - assert args[0] == request_msg @@ -18506,7 +18523,6 @@ async def test_lookup_discovered_service_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.LookupDiscoveredServiceRequest() - assert args[0] == request_msg @@ -18534,7 +18550,6 @@ async def test_list_services_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.ListServicesRequest() - assert args[0] == request_msg @@ -18559,7 +18574,6 @@ async def test_create_service_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.CreateServiceRequest() - assert args[0] == request_msg @@ -18591,7 +18605,6 @@ async def test_get_service_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.GetServiceRequest() - assert args[0] == request_msg @@ -18616,7 +18629,6 @@ async def test_update_service_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.UpdateServiceRequest() - assert args[0] == request_msg @@ -18641,7 +18653,6 @@ async def test_delete_service_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.DeleteServiceRequest() - assert args[0] == request_msg @@ -18671,7 +18682,6 @@ async def test_list_discovered_workloads_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.ListDiscoveredWorkloadsRequest() - assert args[0] == request_msg @@ -18700,7 +18710,6 @@ async def test_get_discovered_workload_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.GetDiscoveredWorkloadRequest() - assert args[0] == request_msg @@ -18727,7 +18736,6 @@ async def test_lookup_discovered_workload_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.LookupDiscoveredWorkloadRequest() - assert args[0] == request_msg @@ -18755,7 +18763,6 @@ async def test_list_workloads_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.ListWorkloadsRequest() - assert args[0] == request_msg @@ -18780,7 +18787,6 @@ async def test_create_workload_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.CreateWorkloadRequest() - assert args[0] == request_msg @@ -18812,7 +18818,6 @@ async def test_get_workload_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.GetWorkloadRequest() - assert args[0] == request_msg @@ -18837,7 +18842,6 @@ async def test_update_workload_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.UpdateWorkloadRequest() - assert args[0] == request_msg @@ -18862,7 +18866,6 @@ async def test_delete_workload_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.DeleteWorkloadRequest() - assert args[0] == request_msg @@ -18892,7 +18895,6 @@ async def test_list_applications_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.ListApplicationsRequest() - assert args[0] == request_msg @@ -18919,7 +18921,6 @@ async def test_create_application_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.CreateApplicationRequest() - assert args[0] == request_msg @@ -18950,7 +18951,6 @@ async def test_get_application_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.GetApplicationRequest() - assert args[0] == request_msg @@ -18977,7 +18977,6 @@ async def test_update_application_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.UpdateApplicationRequest() - assert args[0] == request_msg @@ -19004,7 +19003,6 @@ async def test_delete_application_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.DeleteApplicationRequest() - assert args[0] == request_msg @@ -23788,7 +23786,6 @@ def test_lookup_service_project_attachment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.LookupServiceProjectAttachmentRequest() - assert args[0] == request_msg @@ -23810,7 +23807,6 @@ def test_list_service_project_attachments_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.ListServiceProjectAttachmentsRequest() - assert args[0] == request_msg @@ -23832,7 +23828,6 @@ def test_create_service_project_attachment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.CreateServiceProjectAttachmentRequest() - assert args[0] == request_msg @@ -23854,7 +23849,6 @@ def test_get_service_project_attachment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.GetServiceProjectAttachmentRequest() - assert args[0] == request_msg @@ -23876,7 +23870,6 @@ def test_delete_service_project_attachment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.DeleteServiceProjectAttachmentRequest() - assert args[0] == request_msg @@ -23898,7 +23891,6 @@ def test_detach_service_project_attachment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.DetachServiceProjectAttachmentRequest() - assert args[0] == request_msg @@ -23920,7 +23912,6 @@ def test_list_discovered_services_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.ListDiscoveredServicesRequest() - assert args[0] == request_msg @@ -23942,7 +23933,6 @@ def test_get_discovered_service_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.GetDiscoveredServiceRequest() - assert args[0] == request_msg @@ -23964,7 +23954,6 @@ def test_lookup_discovered_service_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.LookupDiscoveredServiceRequest() - assert args[0] == request_msg @@ -23984,7 +23973,6 @@ def test_list_services_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.ListServicesRequest() - assert args[0] == request_msg @@ -24004,7 +23992,6 @@ def test_create_service_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.CreateServiceRequest() - assert args[0] == request_msg @@ -24024,7 +24011,6 @@ def test_get_service_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.GetServiceRequest() - assert args[0] == request_msg @@ -24044,7 +24030,6 @@ def test_update_service_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.UpdateServiceRequest() - assert args[0] == request_msg @@ -24064,7 +24049,6 @@ def test_delete_service_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.DeleteServiceRequest() - assert args[0] == request_msg @@ -24086,7 +24070,6 @@ def test_list_discovered_workloads_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.ListDiscoveredWorkloadsRequest() - assert args[0] == request_msg @@ -24108,7 +24091,6 @@ def test_get_discovered_workload_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.GetDiscoveredWorkloadRequest() - assert args[0] == request_msg @@ -24130,7 +24112,6 @@ def test_lookup_discovered_workload_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.LookupDiscoveredWorkloadRequest() - assert args[0] == request_msg @@ -24150,7 +24131,6 @@ def test_list_workloads_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.ListWorkloadsRequest() - assert args[0] == request_msg @@ -24170,7 +24150,6 @@ def test_create_workload_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.CreateWorkloadRequest() - assert args[0] == request_msg @@ -24190,7 +24169,6 @@ def test_get_workload_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.GetWorkloadRequest() - assert args[0] == request_msg @@ -24210,7 +24188,6 @@ def test_update_workload_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.UpdateWorkloadRequest() - assert args[0] == request_msg @@ -24230,7 +24207,6 @@ def test_delete_workload_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.DeleteWorkloadRequest() - assert args[0] == request_msg @@ -24252,7 +24228,6 @@ def test_list_applications_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.ListApplicationsRequest() - assert args[0] == request_msg @@ -24274,7 +24249,6 @@ def test_create_application_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.CreateApplicationRequest() - assert args[0] == request_msg @@ -24294,7 +24268,6 @@ def test_get_application_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.GetApplicationRequest() - assert args[0] == request_msg @@ -24316,7 +24289,6 @@ def test_update_application_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.UpdateApplicationRequest() - assert args[0] == request_msg @@ -24338,7 +24310,6 @@ def test_delete_application_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apphub_service.DeleteApplicationRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-appoptimize/noxfile.py b/packages/google-cloud-appoptimize/noxfile.py index 5f9c56fd98ad..00436f115a7e 100644 --- a/packages/google-cloud-appoptimize/noxfile.py +++ b/packages/google-cloud-appoptimize/noxfile.py @@ -47,7 +47,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-appoptimize" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-appoptimize/setup.py b/packages/google-cloud-appoptimize/setup.py index dbade304ecba..be384ed6d500 100644 --- a/packages/google-cloud-appoptimize/setup.py +++ b/packages/google-cloud-appoptimize/setup.py @@ -45,7 +45,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/google-cloud-appoptimize/testing/constraints-3.10.txt b/packages/google-cloud-appoptimize/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-appoptimize/testing/constraints-3.10.txt +++ b/packages/google-cloud-appoptimize/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-appoptimize/tests/unit/gapic/appoptimize_v1beta/test_app_optimize.py b/packages/google-cloud-appoptimize/tests/unit/gapic/appoptimize_v1beta/test_app_optimize.py index c4ea67dccf08..b67a1cfab08b 100644 --- a/packages/google-cloud-appoptimize/tests/unit/gapic/appoptimize_v1beta/test_app_optimize.py +++ b/packages/google-cloud-appoptimize/tests/unit/gapic/appoptimize_v1beta/test_app_optimize.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 @@ -115,6 +116,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" @@ -1280,8 +1296,8 @@ def test_app_optimize_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - app_optimize.CreateReportRequest, - dict, + app_optimize.CreateReportRequest(), + {}, ], ) def test_create_report(request_type, transport: str = "grpc"): @@ -1292,7 +1308,7 @@ def test_create_report(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_report), "__call__") as call: @@ -1334,10 +1350,11 @@ def test_create_report_non_empty_request_with_auto_populated_field(): client.create_report(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == app_optimize.CreateReportRequest( + request_msg = app_optimize.CreateReportRequest( parent="parent_value", report_id="report_id_value", ) + assert args[0] == request_msg def test_create_report_use_cached_wrapped_rpc(): @@ -1428,9 +1445,14 @@ async def test_create_report_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_report_async( - transport: str = "grpc_asyncio", request_type=app_optimize.CreateReportRequest -): +@pytest.mark.parametrize( + "request_type", + [ + app_optimize.CreateReportRequest(), + {}, + ], +) +async def test_create_report_async(request_type, transport: str = "grpc_asyncio"): client = AppOptimizeAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1438,7 +1460,7 @@ async def test_create_report_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_report), "__call__") as call: @@ -1458,11 +1480,6 @@ async def test_create_report_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_report_async_from_dict(): - await test_create_report_async(request_type=dict) - - def test_create_report_field_headers(): client = AppOptimizeClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1637,8 +1654,8 @@ async def test_create_report_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - app_optimize.GetReportRequest, - dict, + app_optimize.GetReportRequest(), + {}, ], ) def test_get_report(request_type, transport: str = "grpc"): @@ -1649,7 +1666,7 @@ def test_get_report(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_report), "__call__") as call: @@ -1699,9 +1716,10 @@ def test_get_report_non_empty_request_with_auto_populated_field(): client.get_report(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == app_optimize.GetReportRequest( + request_msg = app_optimize.GetReportRequest( name="name_value", ) + assert args[0] == request_msg def test_get_report_use_cached_wrapped_rpc(): @@ -1780,9 +1798,14 @@ async def test_get_report_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_report_async( - transport: str = "grpc_asyncio", request_type=app_optimize.GetReportRequest -): +@pytest.mark.parametrize( + "request_type", + [ + app_optimize.GetReportRequest(), + {}, + ], +) +async def test_get_report_async(request_type, transport: str = "grpc_asyncio"): client = AppOptimizeAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1790,7 +1813,7 @@ async def test_get_report_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_report), "__call__") as call: @@ -1819,11 +1842,6 @@ async def test_get_report_async( assert response.filter == "filter_value" -@pytest.mark.asyncio -async def test_get_report_async_from_dict(): - await test_get_report_async(request_type=dict) - - def test_get_report_field_headers(): client = AppOptimizeClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1966,8 +1984,8 @@ async def test_get_report_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - app_optimize.ListReportsRequest, - dict, + app_optimize.ListReportsRequest(), + {}, ], ) def test_list_reports(request_type, transport: str = "grpc"): @@ -1978,7 +1996,7 @@ def test_list_reports(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_reports), "__call__") as call: @@ -2023,10 +2041,11 @@ def test_list_reports_non_empty_request_with_auto_populated_field(): client.list_reports(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == app_optimize.ListReportsRequest( + request_msg = app_optimize.ListReportsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_reports_use_cached_wrapped_rpc(): @@ -2107,9 +2126,14 @@ async def test_list_reports_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_reports_async( - transport: str = "grpc_asyncio", request_type=app_optimize.ListReportsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + app_optimize.ListReportsRequest(), + {}, + ], +) +async def test_list_reports_async(request_type, transport: str = "grpc_asyncio"): client = AppOptimizeAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2117,7 +2141,7 @@ async def test_list_reports_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_reports), "__call__") as call: @@ -2140,11 +2164,6 @@ async def test_list_reports_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_reports_async_from_dict(): - await test_list_reports_async(request_type=dict) - - def test_list_reports_field_headers(): client = AppOptimizeClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2481,8 +2500,8 @@ async def test_list_reports_async_pages(): @pytest.mark.parametrize( "request_type", [ - app_optimize.DeleteReportRequest, - dict, + app_optimize.DeleteReportRequest(), + {}, ], ) def test_delete_report(request_type, transport: str = "grpc"): @@ -2493,7 +2512,7 @@ def test_delete_report(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_report), "__call__") as call: @@ -2534,9 +2553,10 @@ def test_delete_report_non_empty_request_with_auto_populated_field(): client.delete_report(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == app_optimize.DeleteReportRequest( + request_msg = app_optimize.DeleteReportRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_report_use_cached_wrapped_rpc(): @@ -2617,9 +2637,14 @@ async def test_delete_report_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_report_async( - transport: str = "grpc_asyncio", request_type=app_optimize.DeleteReportRequest -): +@pytest.mark.parametrize( + "request_type", + [ + app_optimize.DeleteReportRequest(), + {}, + ], +) +async def test_delete_report_async(request_type, transport: str = "grpc_asyncio"): client = AppOptimizeAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2627,7 +2652,7 @@ async def test_delete_report_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_report), "__call__") as call: @@ -2645,11 +2670,6 @@ async def test_delete_report_async( assert response is None -@pytest.mark.asyncio -async def test_delete_report_async_from_dict(): - await test_delete_report_async(request_type=dict) - - def test_delete_report_field_headers(): client = AppOptimizeClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2792,8 +2812,8 @@ async def test_delete_report_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - app_optimize.ReadReportRequest, - dict, + app_optimize.ReadReportRequest(), + {}, ], ) def test_read_report(request_type, transport: str = "grpc"): @@ -2804,7 +2824,7 @@ def test_read_report(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.read_report), "__call__") as call: @@ -2849,10 +2869,11 @@ def test_read_report_non_empty_request_with_auto_populated_field(): client.read_report(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == app_optimize.ReadReportRequest( + request_msg = app_optimize.ReadReportRequest( name="name_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_read_report_use_cached_wrapped_rpc(): @@ -2933,9 +2954,14 @@ async def test_read_report_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_read_report_async( - transport: str = "grpc_asyncio", request_type=app_optimize.ReadReportRequest -): +@pytest.mark.parametrize( + "request_type", + [ + app_optimize.ReadReportRequest(), + {}, + ], +) +async def test_read_report_async(request_type, transport: str = "grpc_asyncio"): client = AppOptimizeAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2943,7 +2969,7 @@ async def test_read_report_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.read_report), "__call__") as call: @@ -2966,11 +2992,6 @@ async def test_read_report_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_read_report_async_from_dict(): - await test_read_report_async(request_type=dict) - - def test_read_report_field_headers(): client = AppOptimizeClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4480,7 +4501,6 @@ def test_create_report_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = app_optimize.CreateReportRequest() - assert args[0] == request_msg @@ -4501,7 +4521,6 @@ def test_get_report_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = app_optimize.GetReportRequest() - assert args[0] == request_msg @@ -4522,7 +4541,6 @@ def test_list_reports_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = app_optimize.ListReportsRequest() - assert args[0] == request_msg @@ -4543,7 +4561,6 @@ def test_delete_report_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = app_optimize.DeleteReportRequest() - assert args[0] == request_msg @@ -4564,7 +4581,6 @@ def test_read_report_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = app_optimize.ReadReportRequest() - assert args[0] == request_msg @@ -4603,7 +4619,6 @@ async def test_create_report_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = app_optimize.CreateReportRequest() - assert args[0] == request_msg @@ -4633,7 +4648,6 @@ async def test_get_report_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = app_optimize.GetReportRequest() - assert args[0] == request_msg @@ -4660,7 +4674,6 @@ async def test_list_reports_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = app_optimize.ListReportsRequest() - assert args[0] == request_msg @@ -4683,7 +4696,6 @@ async def test_delete_report_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = app_optimize.DeleteReportRequest() - assert args[0] == request_msg @@ -4710,7 +4722,6 @@ async def test_read_report_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = app_optimize.ReadReportRequest() - assert args[0] == request_msg @@ -5814,7 +5825,6 @@ def test_create_report_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = app_optimize.CreateReportRequest() - assert args[0] == request_msg @@ -5834,7 +5844,6 @@ def test_get_report_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = app_optimize.GetReportRequest() - assert args[0] == request_msg @@ -5854,7 +5863,6 @@ def test_list_reports_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = app_optimize.ListReportsRequest() - assert args[0] == request_msg @@ -5874,7 +5882,6 @@ def test_delete_report_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = app_optimize.DeleteReportRequest() - assert args[0] == request_msg @@ -5894,7 +5901,6 @@ def test_read_report_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = app_optimize.ReadReportRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-artifact-registry/noxfile.py b/packages/google-cloud-artifact-registry/noxfile.py index b61da23b9536..a5ca48ed78cc 100644 --- a/packages/google-cloud-artifact-registry/noxfile.py +++ b/packages/google-cloud-artifact-registry/noxfile.py @@ -47,7 +47,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-artifact-registry" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-artifact-registry/setup.py b/packages/google-cloud-artifact-registry/setup.py index 113101468e94..ed26efd33d9f 100644 --- a/packages/google-cloud-artifact-registry/setup.py +++ b/packages/google-cloud-artifact-registry/setup.py @@ -45,7 +45,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/google-cloud-artifact-registry/testing/constraints-3.10.txt b/packages/google-cloud-artifact-registry/testing/constraints-3.10.txt index a92801e1c8e2..b39cd54634f9 100644 --- a/packages/google-cloud-artifact-registry/testing/constraints-3.10.txt +++ b/packages/google-cloud-artifact-registry/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/google-cloud-artifact-registry/tests/unit/gapic/artifactregistry_v1/test_artifact_registry.py b/packages/google-cloud-artifact-registry/tests/unit/gapic/artifactregistry_v1/test_artifact_registry.py index ce9e5da76de5..ed2c9c4277b6 100644 --- a/packages/google-cloud-artifact-registry/tests/unit/gapic/artifactregistry_v1/test_artifact_registry.py +++ b/packages/google-cloud-artifact-registry/tests/unit/gapic/artifactregistry_v1/test_artifact_registry.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 @@ -145,6 +146,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" @@ -1381,8 +1397,8 @@ def test_artifact_registry_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - artifact.ListDockerImagesRequest, - dict, + artifact.ListDockerImagesRequest(), + {}, ], ) def test_list_docker_images(request_type, transport: str = "grpc"): @@ -1393,7 +1409,7 @@ def test_list_docker_images(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1443,11 +1459,12 @@ def test_list_docker_images_non_empty_request_with_auto_populated_field(): client.list_docker_images(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == artifact.ListDockerImagesRequest( + request_msg = artifact.ListDockerImagesRequest( parent="parent_value", page_token="page_token_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_docker_images_use_cached_wrapped_rpc(): @@ -1532,9 +1549,14 @@ async def test_list_docker_images_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_docker_images_async( - transport: str = "grpc_asyncio", request_type=artifact.ListDockerImagesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + artifact.ListDockerImagesRequest(), + {}, + ], +) +async def test_list_docker_images_async(request_type, transport: str = "grpc_asyncio"): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1542,7 +1564,7 @@ async def test_list_docker_images_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( @@ -1567,11 +1589,6 @@ async def test_list_docker_images_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_docker_images_async_from_dict(): - await test_list_docker_images_async(request_type=dict) - - def test_list_docker_images_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1924,8 +1941,8 @@ async def test_list_docker_images_async_pages(): @pytest.mark.parametrize( "request_type", [ - artifact.GetDockerImageRequest, - dict, + artifact.GetDockerImageRequest(), + {}, ], ) def test_get_docker_image(request_type, transport: str = "grpc"): @@ -1936,7 +1953,7 @@ def test_get_docker_image(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_docker_image), "__call__") as call: @@ -1990,9 +2007,10 @@ def test_get_docker_image_non_empty_request_with_auto_populated_field(): client.get_docker_image(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == artifact.GetDockerImageRequest( + request_msg = artifact.GetDockerImageRequest( name="name_value", ) + assert args[0] == request_msg def test_get_docker_image_use_cached_wrapped_rpc(): @@ -2075,9 +2093,14 @@ async def test_get_docker_image_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_docker_image_async( - transport: str = "grpc_asyncio", request_type=artifact.GetDockerImageRequest -): +@pytest.mark.parametrize( + "request_type", + [ + artifact.GetDockerImageRequest(), + {}, + ], +) +async def test_get_docker_image_async(request_type, transport: str = "grpc_asyncio"): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2085,7 +2108,7 @@ async def test_get_docker_image_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_docker_image), "__call__") as call: @@ -2118,11 +2141,6 @@ async def test_get_docker_image_async( assert response.artifact_type == "artifact_type_value" -@pytest.mark.asyncio -async def test_get_docker_image_async_from_dict(): - await test_get_docker_image_async(request_type=dict) - - def test_get_docker_image_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2269,8 +2287,8 @@ async def test_get_docker_image_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - artifact.ListMavenArtifactsRequest, - dict, + artifact.ListMavenArtifactsRequest(), + {}, ], ) def test_list_maven_artifacts(request_type, transport: str = "grpc"): @@ -2281,7 +2299,7 @@ def test_list_maven_artifacts(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2330,10 +2348,11 @@ def test_list_maven_artifacts_non_empty_request_with_auto_populated_field(): client.list_maven_artifacts(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == artifact.ListMavenArtifactsRequest( + request_msg = artifact.ListMavenArtifactsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_maven_artifacts_use_cached_wrapped_rpc(): @@ -2418,8 +2437,15 @@ async def test_list_maven_artifacts_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + artifact.ListMavenArtifactsRequest(), + {}, + ], +) async def test_list_maven_artifacts_async( - transport: str = "grpc_asyncio", request_type=artifact.ListMavenArtifactsRequest + request_type, transport: str = "grpc_asyncio" ): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), @@ -2428,7 +2454,7 @@ async def test_list_maven_artifacts_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( @@ -2453,11 +2479,6 @@ async def test_list_maven_artifacts_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_maven_artifacts_async_from_dict(): - await test_list_maven_artifacts_async(request_type=dict) - - def test_list_maven_artifacts_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2810,8 +2831,8 @@ async def test_list_maven_artifacts_async_pages(): @pytest.mark.parametrize( "request_type", [ - artifact.GetMavenArtifactRequest, - dict, + artifact.GetMavenArtifactRequest(), + {}, ], ) def test_get_maven_artifact(request_type, transport: str = "grpc"): @@ -2822,7 +2843,7 @@ def test_get_maven_artifact(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2878,9 +2899,10 @@ def test_get_maven_artifact_non_empty_request_with_auto_populated_field(): client.get_maven_artifact(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == artifact.GetMavenArtifactRequest( + request_msg = artifact.GetMavenArtifactRequest( name="name_value", ) + assert args[0] == request_msg def test_get_maven_artifact_use_cached_wrapped_rpc(): @@ -2965,9 +2987,14 @@ async def test_get_maven_artifact_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_maven_artifact_async( - transport: str = "grpc_asyncio", request_type=artifact.GetMavenArtifactRequest -): +@pytest.mark.parametrize( + "request_type", + [ + artifact.GetMavenArtifactRequest(), + {}, + ], +) +async def test_get_maven_artifact_async(request_type, transport: str = "grpc_asyncio"): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2975,7 +3002,7 @@ async def test_get_maven_artifact_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( @@ -3008,11 +3035,6 @@ async def test_get_maven_artifact_async( assert response.version == "version_value" -@pytest.mark.asyncio -async def test_get_maven_artifact_async_from_dict(): - await test_get_maven_artifact_async(request_type=dict) - - def test_get_maven_artifact_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3167,8 +3189,8 @@ async def test_get_maven_artifact_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - artifact.ListNpmPackagesRequest, - dict, + artifact.ListNpmPackagesRequest(), + {}, ], ) def test_list_npm_packages(request_type, transport: str = "grpc"): @@ -3179,7 +3201,7 @@ def test_list_npm_packages(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3228,10 +3250,11 @@ def test_list_npm_packages_non_empty_request_with_auto_populated_field(): client.list_npm_packages(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == artifact.ListNpmPackagesRequest( + request_msg = artifact.ListNpmPackagesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_npm_packages_use_cached_wrapped_rpc(): @@ -3314,9 +3337,14 @@ async def test_list_npm_packages_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_npm_packages_async( - transport: str = "grpc_asyncio", request_type=artifact.ListNpmPackagesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + artifact.ListNpmPackagesRequest(), + {}, + ], +) +async def test_list_npm_packages_async(request_type, transport: str = "grpc_asyncio"): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3324,7 +3352,7 @@ async def test_list_npm_packages_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( @@ -3349,11 +3377,6 @@ async def test_list_npm_packages_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_npm_packages_async_from_dict(): - await test_list_npm_packages_async(request_type=dict) - - def test_list_npm_packages_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3706,8 +3729,8 @@ async def test_list_npm_packages_async_pages(): @pytest.mark.parametrize( "request_type", [ - artifact.GetNpmPackageRequest, - dict, + artifact.GetNpmPackageRequest(), + {}, ], ) def test_get_npm_package(request_type, transport: str = "grpc"): @@ -3718,7 +3741,7 @@ def test_get_npm_package(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_npm_package), "__call__") as call: @@ -3768,9 +3791,10 @@ def test_get_npm_package_non_empty_request_with_auto_populated_field(): client.get_npm_package(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == artifact.GetNpmPackageRequest( + request_msg = artifact.GetNpmPackageRequest( name="name_value", ) + assert args[0] == request_msg def test_get_npm_package_use_cached_wrapped_rpc(): @@ -3851,9 +3875,14 @@ async def test_get_npm_package_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_npm_package_async( - transport: str = "grpc_asyncio", request_type=artifact.GetNpmPackageRequest -): +@pytest.mark.parametrize( + "request_type", + [ + artifact.GetNpmPackageRequest(), + {}, + ], +) +async def test_get_npm_package_async(request_type, transport: str = "grpc_asyncio"): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3861,7 +3890,7 @@ async def test_get_npm_package_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_npm_package), "__call__") as call: @@ -3890,11 +3919,6 @@ async def test_get_npm_package_async( assert response.tags == ["tags_value"] -@pytest.mark.asyncio -async def test_get_npm_package_async_from_dict(): - await test_get_npm_package_async(request_type=dict) - - def test_get_npm_package_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4037,8 +4061,8 @@ async def test_get_npm_package_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - artifact.ListPythonPackagesRequest, - dict, + artifact.ListPythonPackagesRequest(), + {}, ], ) def test_list_python_packages(request_type, transport: str = "grpc"): @@ -4049,7 +4073,7 @@ def test_list_python_packages(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4098,10 +4122,11 @@ def test_list_python_packages_non_empty_request_with_auto_populated_field(): client.list_python_packages(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == artifact.ListPythonPackagesRequest( + request_msg = artifact.ListPythonPackagesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_python_packages_use_cached_wrapped_rpc(): @@ -4186,8 +4211,15 @@ async def test_list_python_packages_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + artifact.ListPythonPackagesRequest(), + {}, + ], +) async def test_list_python_packages_async( - transport: str = "grpc_asyncio", request_type=artifact.ListPythonPackagesRequest + request_type, transport: str = "grpc_asyncio" ): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), @@ -4196,7 +4228,7 @@ async def test_list_python_packages_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( @@ -4221,11 +4253,6 @@ async def test_list_python_packages_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_python_packages_async_from_dict(): - await test_list_python_packages_async(request_type=dict) - - def test_list_python_packages_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4578,8 +4605,8 @@ async def test_list_python_packages_async_pages(): @pytest.mark.parametrize( "request_type", [ - artifact.GetPythonPackageRequest, - dict, + artifact.GetPythonPackageRequest(), + {}, ], ) def test_get_python_package(request_type, transport: str = "grpc"): @@ -4590,7 +4617,7 @@ def test_get_python_package(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4644,9 +4671,10 @@ def test_get_python_package_non_empty_request_with_auto_populated_field(): client.get_python_package(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == artifact.GetPythonPackageRequest( + request_msg = artifact.GetPythonPackageRequest( name="name_value", ) + assert args[0] == request_msg def test_get_python_package_use_cached_wrapped_rpc(): @@ -4731,9 +4759,14 @@ async def test_get_python_package_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_python_package_async( - transport: str = "grpc_asyncio", request_type=artifact.GetPythonPackageRequest -): +@pytest.mark.parametrize( + "request_type", + [ + artifact.GetPythonPackageRequest(), + {}, + ], +) +async def test_get_python_package_async(request_type, transport: str = "grpc_asyncio"): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4741,7 +4774,7 @@ async def test_get_python_package_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( @@ -4772,11 +4805,6 @@ async def test_get_python_package_async( assert response.version == "version_value" -@pytest.mark.asyncio -async def test_get_python_package_async_from_dict(): - await test_get_python_package_async(request_type=dict) - - def test_get_python_package_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4931,8 +4959,8 @@ async def test_get_python_package_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - apt_artifact.ImportAptArtifactsRequest, - dict, + apt_artifact.ImportAptArtifactsRequest(), + {}, ], ) def test_import_apt_artifacts(request_type, transport: str = "grpc"): @@ -4943,7 +4971,7 @@ def test_import_apt_artifacts(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4988,9 +5016,10 @@ def test_import_apt_artifacts_non_empty_request_with_auto_populated_field(): client.import_apt_artifacts(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apt_artifact.ImportAptArtifactsRequest( + request_msg = apt_artifact.ImportAptArtifactsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_import_apt_artifacts_use_cached_wrapped_rpc(): @@ -5085,8 +5114,15 @@ async def test_import_apt_artifacts_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + apt_artifact.ImportAptArtifactsRequest(), + {}, + ], +) async def test_import_apt_artifacts_async( - transport: str = "grpc_asyncio", request_type=apt_artifact.ImportAptArtifactsRequest + request_type, transport: str = "grpc_asyncio" ): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), @@ -5095,7 +5131,7 @@ async def test_import_apt_artifacts_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( @@ -5117,11 +5153,6 @@ async def test_import_apt_artifacts_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_import_apt_artifacts_async_from_dict(): - await test_import_apt_artifacts_async(request_type=dict) - - def test_import_apt_artifacts_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5190,8 +5221,8 @@ async def test_import_apt_artifacts_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - yum_artifact.ImportYumArtifactsRequest, - dict, + yum_artifact.ImportYumArtifactsRequest(), + {}, ], ) def test_import_yum_artifacts(request_type, transport: str = "grpc"): @@ -5202,7 +5233,7 @@ def test_import_yum_artifacts(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5247,9 +5278,10 @@ def test_import_yum_artifacts_non_empty_request_with_auto_populated_field(): client.import_yum_artifacts(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == yum_artifact.ImportYumArtifactsRequest( + request_msg = yum_artifact.ImportYumArtifactsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_import_yum_artifacts_use_cached_wrapped_rpc(): @@ -5344,8 +5376,15 @@ async def test_import_yum_artifacts_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + yum_artifact.ImportYumArtifactsRequest(), + {}, + ], +) async def test_import_yum_artifacts_async( - transport: str = "grpc_asyncio", request_type=yum_artifact.ImportYumArtifactsRequest + request_type, transport: str = "grpc_asyncio" ): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), @@ -5354,7 +5393,7 @@ async def test_import_yum_artifacts_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( @@ -5376,11 +5415,6 @@ async def test_import_yum_artifacts_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_import_yum_artifacts_async_from_dict(): - await test_import_yum_artifacts_async(request_type=dict) - - def test_import_yum_artifacts_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5449,8 +5483,8 @@ async def test_import_yum_artifacts_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - repository.ListRepositoriesRequest, - dict, + repository.ListRepositoriesRequest(), + {}, ], ) def test_list_repositories(request_type, transport: str = "grpc"): @@ -5461,7 +5495,7 @@ def test_list_repositories(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5512,12 +5546,13 @@ def test_list_repositories_non_empty_request_with_auto_populated_field(): client.list_repositories(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == repository.ListRepositoriesRequest( + request_msg = repository.ListRepositoriesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_repositories_use_cached_wrapped_rpc(): @@ -5600,9 +5635,14 @@ async def test_list_repositories_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_repositories_async( - transport: str = "grpc_asyncio", request_type=repository.ListRepositoriesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + repository.ListRepositoriesRequest(), + {}, + ], +) +async def test_list_repositories_async(request_type, transport: str = "grpc_asyncio"): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5610,7 +5650,7 @@ async def test_list_repositories_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( @@ -5635,11 +5675,6 @@ async def test_list_repositories_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_repositories_async_from_dict(): - await test_list_repositories_async(request_type=dict) - - def test_list_repositories_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5992,8 +6027,8 @@ async def test_list_repositories_async_pages(): @pytest.mark.parametrize( "request_type", [ - repository.GetRepositoryRequest, - dict, + repository.GetRepositoryRequest(), + {}, ], ) def test_get_repository(request_type, transport: str = "grpc"): @@ -6004,7 +6039,7 @@ def test_get_repository(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_repository), "__call__") as call: @@ -6068,9 +6103,10 @@ def test_get_repository_non_empty_request_with_auto_populated_field(): client.get_repository(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == repository.GetRepositoryRequest( + request_msg = repository.GetRepositoryRequest( name="name_value", ) + assert args[0] == request_msg def test_get_repository_use_cached_wrapped_rpc(): @@ -6151,9 +6187,14 @@ async def test_get_repository_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_repository_async( - transport: str = "grpc_asyncio", request_type=repository.GetRepositoryRequest -): +@pytest.mark.parametrize( + "request_type", + [ + repository.GetRepositoryRequest(), + {}, + ], +) +async def test_get_repository_async(request_type, transport: str = "grpc_asyncio"): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6161,7 +6202,7 @@ async def test_get_repository_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_repository), "__call__") as call: @@ -6204,11 +6245,6 @@ async def test_get_repository_async( assert response.registry_uri == "registry_uri_value" -@pytest.mark.asyncio -async def test_get_repository_async_from_dict(): - await test_get_repository_async(request_type=dict) - - def test_get_repository_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6355,8 +6391,8 @@ async def test_get_repository_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gda_repository.CreateRepositoryRequest, - dict, + gda_repository.CreateRepositoryRequest(), + {}, ], ) def test_create_repository(request_type, transport: str = "grpc"): @@ -6367,7 +6403,7 @@ def test_create_repository(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6413,10 +6449,11 @@ def test_create_repository_non_empty_request_with_auto_populated_field(): client.create_repository(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gda_repository.CreateRepositoryRequest( + request_msg = gda_repository.CreateRepositoryRequest( parent="parent_value", repository_id="repository_id_value", ) + assert args[0] == request_msg def test_create_repository_use_cached_wrapped_rpc(): @@ -6509,9 +6546,14 @@ async def test_create_repository_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_repository_async( - transport: str = "grpc_asyncio", request_type=gda_repository.CreateRepositoryRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gda_repository.CreateRepositoryRequest(), + {}, + ], +) +async def test_create_repository_async(request_type, transport: str = "grpc_asyncio"): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6519,7 +6561,7 @@ async def test_create_repository_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( @@ -6541,11 +6583,6 @@ async def test_create_repository_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_repository_async_from_dict(): - await test_create_repository_async(request_type=dict) - - def test_create_repository_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6744,8 +6781,8 @@ async def test_create_repository_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gda_repository.UpdateRepositoryRequest, - dict, + gda_repository.UpdateRepositoryRequest(), + {}, ], ) def test_update_repository(request_type, transport: str = "grpc"): @@ -6756,7 +6793,7 @@ def test_update_repository(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6822,7 +6859,8 @@ def test_update_repository_non_empty_request_with_auto_populated_field(): client.update_repository(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gda_repository.UpdateRepositoryRequest() + request_msg = gda_repository.UpdateRepositoryRequest() + assert args[0] == request_msg def test_update_repository_use_cached_wrapped_rpc(): @@ -6905,9 +6943,14 @@ async def test_update_repository_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_repository_async( - transport: str = "grpc_asyncio", request_type=gda_repository.UpdateRepositoryRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gda_repository.UpdateRepositoryRequest(), + {}, + ], +) +async def test_update_repository_async(request_type, transport: str = "grpc_asyncio"): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6915,7 +6958,7 @@ async def test_update_repository_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( @@ -6960,11 +7003,6 @@ async def test_update_repository_async( assert response.registry_uri == "registry_uri_value" -@pytest.mark.asyncio -async def test_update_repository_async_from_dict(): - await test_update_repository_async(request_type=dict) - - def test_update_repository_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7153,8 +7191,8 @@ async def test_update_repository_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - repository.DeleteRepositoryRequest, - dict, + repository.DeleteRepositoryRequest(), + {}, ], ) def test_delete_repository(request_type, transport: str = "grpc"): @@ -7165,7 +7203,7 @@ def test_delete_repository(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7210,9 +7248,10 @@ def test_delete_repository_non_empty_request_with_auto_populated_field(): client.delete_repository(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == repository.DeleteRepositoryRequest( + request_msg = repository.DeleteRepositoryRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_repository_use_cached_wrapped_rpc(): @@ -7305,9 +7344,14 @@ async def test_delete_repository_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_repository_async( - transport: str = "grpc_asyncio", request_type=repository.DeleteRepositoryRequest -): +@pytest.mark.parametrize( + "request_type", + [ + repository.DeleteRepositoryRequest(), + {}, + ], +) +async def test_delete_repository_async(request_type, transport: str = "grpc_asyncio"): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7315,7 +7359,7 @@ async def test_delete_repository_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( @@ -7337,11 +7381,6 @@ async def test_delete_repository_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_repository_async_from_dict(): - await test_delete_repository_async(request_type=dict) - - def test_delete_repository_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7496,8 +7535,8 @@ async def test_delete_repository_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - package.ListPackagesRequest, - dict, + package.ListPackagesRequest(), + {}, ], ) def test_list_packages(request_type, transport: str = "grpc"): @@ -7508,7 +7547,7 @@ def test_list_packages(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_packages), "__call__") as call: @@ -7555,12 +7594,13 @@ def test_list_packages_non_empty_request_with_auto_populated_field(): client.list_packages(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == package.ListPackagesRequest( + request_msg = package.ListPackagesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_packages_use_cached_wrapped_rpc(): @@ -7641,9 +7681,14 @@ async def test_list_packages_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_packages_async( - transport: str = "grpc_asyncio", request_type=package.ListPackagesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + package.ListPackagesRequest(), + {}, + ], +) +async def test_list_packages_async(request_type, transport: str = "grpc_asyncio"): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7651,7 +7696,7 @@ async def test_list_packages_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_packages), "__call__") as call: @@ -7674,11 +7719,6 @@ async def test_list_packages_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_packages_async_from_dict(): - await test_list_packages_async(request_type=dict) - - def test_list_packages_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8015,8 +8055,8 @@ async def test_list_packages_async_pages(): @pytest.mark.parametrize( "request_type", [ - package.GetPackageRequest, - dict, + package.GetPackageRequest(), + {}, ], ) def test_get_package(request_type, transport: str = "grpc"): @@ -8027,7 +8067,7 @@ def test_get_package(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_package), "__call__") as call: @@ -8073,9 +8113,10 @@ def test_get_package_non_empty_request_with_auto_populated_field(): client.get_package(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == package.GetPackageRequest( + request_msg = package.GetPackageRequest( name="name_value", ) + assert args[0] == request_msg def test_get_package_use_cached_wrapped_rpc(): @@ -8156,9 +8197,14 @@ async def test_get_package_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_package_async( - transport: str = "grpc_asyncio", request_type=package.GetPackageRequest -): +@pytest.mark.parametrize( + "request_type", + [ + package.GetPackageRequest(), + {}, + ], +) +async def test_get_package_async(request_type, transport: str = "grpc_asyncio"): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8166,7 +8212,7 @@ async def test_get_package_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_package), "__call__") as call: @@ -8191,11 +8237,6 @@ async def test_get_package_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_get_package_async_from_dict(): - await test_get_package_async(request_type=dict) - - def test_get_package_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8338,8 +8379,8 @@ async def test_get_package_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - package.DeletePackageRequest, - dict, + package.DeletePackageRequest(), + {}, ], ) def test_delete_package(request_type, transport: str = "grpc"): @@ -8350,7 +8391,7 @@ def test_delete_package(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_package), "__call__") as call: @@ -8391,9 +8432,10 @@ def test_delete_package_non_empty_request_with_auto_populated_field(): client.delete_package(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == package.DeletePackageRequest( + request_msg = package.DeletePackageRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_package_use_cached_wrapped_rpc(): @@ -8484,9 +8526,14 @@ async def test_delete_package_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_package_async( - transport: str = "grpc_asyncio", request_type=package.DeletePackageRequest -): +@pytest.mark.parametrize( + "request_type", + [ + package.DeletePackageRequest(), + {}, + ], +) +async def test_delete_package_async(request_type, transport: str = "grpc_asyncio"): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8494,7 +8541,7 @@ async def test_delete_package_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_package), "__call__") as call: @@ -8514,11 +8561,6 @@ async def test_delete_package_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_package_async_from_dict(): - await test_delete_package_async(request_type=dict) - - def test_delete_package_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8665,8 +8707,8 @@ async def test_delete_package_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - version.ListVersionsRequest, - dict, + version.ListVersionsRequest(), + {}, ], ) def test_list_versions(request_type, transport: str = "grpc"): @@ -8677,7 +8719,7 @@ def test_list_versions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_versions), "__call__") as call: @@ -8724,12 +8766,13 @@ def test_list_versions_non_empty_request_with_auto_populated_field(): client.list_versions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == version.ListVersionsRequest( + request_msg = version.ListVersionsRequest( parent="parent_value", page_token="page_token_value", order_by="order_by_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_versions_use_cached_wrapped_rpc(): @@ -8810,9 +8853,14 @@ async def test_list_versions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_versions_async( - transport: str = "grpc_asyncio", request_type=version.ListVersionsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + version.ListVersionsRequest(), + {}, + ], +) +async def test_list_versions_async(request_type, transport: str = "grpc_asyncio"): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8820,7 +8868,7 @@ async def test_list_versions_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_versions), "__call__") as call: @@ -8843,11 +8891,6 @@ async def test_list_versions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_versions_async_from_dict(): - await test_list_versions_async(request_type=dict) - - def test_list_versions_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9184,8 +9227,8 @@ async def test_list_versions_async_pages(): @pytest.mark.parametrize( "request_type", [ - version.GetVersionRequest, - dict, + version.GetVersionRequest(), + {}, ], ) def test_get_version(request_type, transport: str = "grpc"): @@ -9196,7 +9239,7 @@ def test_get_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_version), "__call__") as call: @@ -9242,9 +9285,10 @@ def test_get_version_non_empty_request_with_auto_populated_field(): client.get_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == version.GetVersionRequest( + request_msg = version.GetVersionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_version_use_cached_wrapped_rpc(): @@ -9325,9 +9369,14 @@ async def test_get_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_version_async( - transport: str = "grpc_asyncio", request_type=version.GetVersionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + version.GetVersionRequest(), + {}, + ], +) +async def test_get_version_async(request_type, transport: str = "grpc_asyncio"): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9335,7 +9384,7 @@ async def test_get_version_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_version), "__call__") as call: @@ -9360,11 +9409,6 @@ async def test_get_version_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_get_version_async_from_dict(): - await test_get_version_async(request_type=dict) - - def test_get_version_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9507,8 +9551,8 @@ async def test_get_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - version.DeleteVersionRequest, - dict, + version.DeleteVersionRequest(), + {}, ], ) def test_delete_version(request_type, transport: str = "grpc"): @@ -9519,7 +9563,7 @@ def test_delete_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_version), "__call__") as call: @@ -9560,9 +9604,10 @@ def test_delete_version_non_empty_request_with_auto_populated_field(): client.delete_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == version.DeleteVersionRequest( + request_msg = version.DeleteVersionRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_version_use_cached_wrapped_rpc(): @@ -9653,9 +9698,14 @@ async def test_delete_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_version_async( - transport: str = "grpc_asyncio", request_type=version.DeleteVersionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + version.DeleteVersionRequest(), + {}, + ], +) +async def test_delete_version_async(request_type, transport: str = "grpc_asyncio"): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9663,7 +9713,7 @@ async def test_delete_version_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_version), "__call__") as call: @@ -9683,11 +9733,6 @@ async def test_delete_version_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_version_async_from_dict(): - await test_delete_version_async(request_type=dict) - - def test_delete_version_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9834,8 +9879,8 @@ async def test_delete_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - version.BatchDeleteVersionsRequest, - dict, + version.BatchDeleteVersionsRequest(), + {}, ], ) def test_batch_delete_versions(request_type, transport: str = "grpc"): @@ -9846,7 +9891,7 @@ def test_batch_delete_versions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9891,9 +9936,10 @@ def test_batch_delete_versions_non_empty_request_with_auto_populated_field(): client.batch_delete_versions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == version.BatchDeleteVersionsRequest( + request_msg = version.BatchDeleteVersionsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_batch_delete_versions_use_cached_wrapped_rpc(): @@ -9989,8 +10035,15 @@ async def test_batch_delete_versions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + version.BatchDeleteVersionsRequest(), + {}, + ], +) async def test_batch_delete_versions_async( - transport: str = "grpc_asyncio", request_type=version.BatchDeleteVersionsRequest + request_type, transport: str = "grpc_asyncio" ): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), @@ -9999,7 +10052,7 @@ async def test_batch_delete_versions_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( @@ -10021,11 +10074,6 @@ async def test_batch_delete_versions_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_batch_delete_versions_async_from_dict(): - await test_batch_delete_versions_async(request_type=dict) - - def test_batch_delete_versions_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10190,8 +10238,8 @@ async def test_batch_delete_versions_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gda_version.UpdateVersionRequest, - dict, + gda_version.UpdateVersionRequest(), + {}, ], ) def test_update_version(request_type, transport: str = "grpc"): @@ -10202,7 +10250,7 @@ def test_update_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_version), "__call__") as call: @@ -10246,7 +10294,8 @@ def test_update_version_non_empty_request_with_auto_populated_field(): client.update_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gda_version.UpdateVersionRequest() + request_msg = gda_version.UpdateVersionRequest() + assert args[0] == request_msg def test_update_version_use_cached_wrapped_rpc(): @@ -10327,9 +10376,14 @@ async def test_update_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_version_async( - transport: str = "grpc_asyncio", request_type=gda_version.UpdateVersionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gda_version.UpdateVersionRequest(), + {}, + ], +) +async def test_update_version_async(request_type, transport: str = "grpc_asyncio"): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10337,7 +10391,7 @@ async def test_update_version_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_version), "__call__") as call: @@ -10362,11 +10416,6 @@ async def test_update_version_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_update_version_async_from_dict(): - await test_update_version_async(request_type=dict) - - def test_update_version_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10519,8 +10568,8 @@ async def test_update_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - file.ListFilesRequest, - dict, + file.ListFilesRequest(), + {}, ], ) def test_list_files(request_type, transport: str = "grpc"): @@ -10531,7 +10580,7 @@ def test_list_files(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_files), "__call__") as call: @@ -10578,12 +10627,13 @@ def test_list_files_non_empty_request_with_auto_populated_field(): client.list_files(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == file.ListFilesRequest( + request_msg = file.ListFilesRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_files_use_cached_wrapped_rpc(): @@ -10662,9 +10712,14 @@ async def test_list_files_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_list_files_async( - transport: str = "grpc_asyncio", request_type=file.ListFilesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + file.ListFilesRequest(), + {}, + ], +) +async def test_list_files_async(request_type, transport: str = "grpc_asyncio"): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10672,7 +10727,7 @@ async def test_list_files_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_files), "__call__") as call: @@ -10695,11 +10750,6 @@ async def test_list_files_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_files_async_from_dict(): - await test_list_files_async(request_type=dict) - - def test_list_files_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11036,8 +11086,8 @@ async def test_list_files_async_pages(): @pytest.mark.parametrize( "request_type", [ - file.GetFileRequest, - dict, + file.GetFileRequest(), + {}, ], ) def test_get_file(request_type, transport: str = "grpc"): @@ -11048,7 +11098,7 @@ def test_get_file(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_file), "__call__") as call: @@ -11096,9 +11146,10 @@ def test_get_file_non_empty_request_with_auto_populated_field(): client.get_file(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == file.GetFileRequest( + request_msg = file.GetFileRequest( name="name_value", ) + assert args[0] == request_msg def test_get_file_use_cached_wrapped_rpc(): @@ -11177,9 +11228,14 @@ async def test_get_file_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn @pytest.mark.asyncio -async def test_get_file_async( - transport: str = "grpc_asyncio", request_type=file.GetFileRequest -): +@pytest.mark.parametrize( + "request_type", + [ + file.GetFileRequest(), + {}, + ], +) +async def test_get_file_async(request_type, transport: str = "grpc_asyncio"): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11187,7 +11243,7 @@ async def test_get_file_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_file), "__call__") as call: @@ -11214,11 +11270,6 @@ async def test_get_file_async( assert response.owner == "owner_value" -@pytest.mark.asyncio -async def test_get_file_async_from_dict(): - await test_get_file_async(request_type=dict) - - def test_get_file_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11361,8 +11412,8 @@ async def test_get_file_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - file.DeleteFileRequest, - dict, + file.DeleteFileRequest(), + {}, ], ) def test_delete_file(request_type, transport: str = "grpc"): @@ -11373,7 +11424,7 @@ def test_delete_file(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_file), "__call__") as call: @@ -11414,9 +11465,10 @@ def test_delete_file_non_empty_request_with_auto_populated_field(): client.delete_file(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == file.DeleteFileRequest( + request_msg = file.DeleteFileRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_file_use_cached_wrapped_rpc(): @@ -11507,9 +11559,14 @@ async def test_delete_file_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_file_async( - transport: str = "grpc_asyncio", request_type=file.DeleteFileRequest -): +@pytest.mark.parametrize( + "request_type", + [ + file.DeleteFileRequest(), + {}, + ], +) +async def test_delete_file_async(request_type, transport: str = "grpc_asyncio"): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11517,7 +11574,7 @@ async def test_delete_file_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_file), "__call__") as call: @@ -11537,11 +11594,6 @@ async def test_delete_file_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_file_async_from_dict(): - await test_delete_file_async(request_type=dict) - - def test_delete_file_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11688,8 +11740,8 @@ async def test_delete_file_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gda_file.UpdateFileRequest, - dict, + gda_file.UpdateFileRequest(), + {}, ], ) def test_update_file(request_type, transport: str = "grpc"): @@ -11700,7 +11752,7 @@ def test_update_file(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_file), "__call__") as call: @@ -11746,7 +11798,8 @@ def test_update_file_non_empty_request_with_auto_populated_field(): client.update_file(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gda_file.UpdateFileRequest() + request_msg = gda_file.UpdateFileRequest() + assert args[0] == request_msg def test_update_file_use_cached_wrapped_rpc(): @@ -11827,9 +11880,14 @@ async def test_update_file_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_file_async( - transport: str = "grpc_asyncio", request_type=gda_file.UpdateFileRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gda_file.UpdateFileRequest(), + {}, + ], +) +async def test_update_file_async(request_type, transport: str = "grpc_asyncio"): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11837,7 +11895,7 @@ async def test_update_file_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_file), "__call__") as call: @@ -11864,11 +11922,6 @@ async def test_update_file_async( assert response.owner == "owner_value" -@pytest.mark.asyncio -async def test_update_file_async_from_dict(): - await test_update_file_async(request_type=dict) - - def test_update_file_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12021,8 +12074,8 @@ async def test_update_file_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - tag.ListTagsRequest, - dict, + tag.ListTagsRequest(), + {}, ], ) def test_list_tags(request_type, transport: str = "grpc"): @@ -12033,7 +12086,7 @@ def test_list_tags(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tags), "__call__") as call: @@ -12079,11 +12132,12 @@ def test_list_tags_non_empty_request_with_auto_populated_field(): client.list_tags(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tag.ListTagsRequest( + request_msg = tag.ListTagsRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_tags_use_cached_wrapped_rpc(): @@ -12162,9 +12216,14 @@ async def test_list_tags_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_list_tags_async( - transport: str = "grpc_asyncio", request_type=tag.ListTagsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tag.ListTagsRequest(), + {}, + ], +) +async def test_list_tags_async(request_type, transport: str = "grpc_asyncio"): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12172,7 +12231,7 @@ async def test_list_tags_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_tags), "__call__") as call: @@ -12195,11 +12254,6 @@ async def test_list_tags_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_tags_async_from_dict(): - await test_list_tags_async(request_type=dict) - - def test_list_tags_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12536,8 +12590,8 @@ async def test_list_tags_async_pages(): @pytest.mark.parametrize( "request_type", [ - tag.GetTagRequest, - dict, + tag.GetTagRequest(), + {}, ], ) def test_get_tag(request_type, transport: str = "grpc"): @@ -12548,7 +12602,7 @@ def test_get_tag(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tag), "__call__") as call: @@ -12594,9 +12648,10 @@ def test_get_tag_non_empty_request_with_auto_populated_field(): client.get_tag(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tag.GetTagRequest( + request_msg = tag.GetTagRequest( name="name_value", ) + assert args[0] == request_msg def test_get_tag_use_cached_wrapped_rpc(): @@ -12675,9 +12730,14 @@ async def test_get_tag_async_use_cached_wrapped_rpc(transport: str = "grpc_async @pytest.mark.asyncio -async def test_get_tag_async( - transport: str = "grpc_asyncio", request_type=tag.GetTagRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tag.GetTagRequest(), + {}, + ], +) +async def test_get_tag_async(request_type, transport: str = "grpc_asyncio"): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12685,7 +12745,7 @@ async def test_get_tag_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_tag), "__call__") as call: @@ -12710,11 +12770,6 @@ async def test_get_tag_async( assert response.version == "version_value" -@pytest.mark.asyncio -async def test_get_tag_async_from_dict(): - await test_get_tag_async(request_type=dict) - - def test_get_tag_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12857,8 +12912,8 @@ async def test_get_tag_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gda_tag.CreateTagRequest, - dict, + gda_tag.CreateTagRequest(), + {}, ], ) def test_create_tag(request_type, transport: str = "grpc"): @@ -12869,7 +12924,7 @@ def test_create_tag(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tag), "__call__") as call: @@ -12916,10 +12971,11 @@ def test_create_tag_non_empty_request_with_auto_populated_field(): client.create_tag(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gda_tag.CreateTagRequest( + request_msg = gda_tag.CreateTagRequest( parent="parent_value", tag_id="tag_id_value", ) + assert args[0] == request_msg def test_create_tag_use_cached_wrapped_rpc(): @@ -12998,9 +13054,14 @@ async def test_create_tag_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_create_tag_async( - transport: str = "grpc_asyncio", request_type=gda_tag.CreateTagRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gda_tag.CreateTagRequest(), + {}, + ], +) +async def test_create_tag_async(request_type, transport: str = "grpc_asyncio"): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13008,7 +13069,7 @@ async def test_create_tag_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_tag), "__call__") as call: @@ -13033,11 +13094,6 @@ async def test_create_tag_async( assert response.version == "version_value" -@pytest.mark.asyncio -async def test_create_tag_async_from_dict(): - await test_create_tag_async(request_type=dict) - - def test_create_tag_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13200,8 +13256,8 @@ async def test_create_tag_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gda_tag.UpdateTagRequest, - dict, + gda_tag.UpdateTagRequest(), + {}, ], ) def test_update_tag(request_type, transport: str = "grpc"): @@ -13212,7 +13268,7 @@ def test_update_tag(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tag), "__call__") as call: @@ -13256,7 +13312,8 @@ def test_update_tag_non_empty_request_with_auto_populated_field(): client.update_tag(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gda_tag.UpdateTagRequest() + request_msg = gda_tag.UpdateTagRequest() + assert args[0] == request_msg def test_update_tag_use_cached_wrapped_rpc(): @@ -13335,9 +13392,14 @@ async def test_update_tag_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_update_tag_async( - transport: str = "grpc_asyncio", request_type=gda_tag.UpdateTagRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gda_tag.UpdateTagRequest(), + {}, + ], +) +async def test_update_tag_async(request_type, transport: str = "grpc_asyncio"): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13345,7 +13407,7 @@ async def test_update_tag_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_tag), "__call__") as call: @@ -13370,11 +13432,6 @@ async def test_update_tag_async( assert response.version == "version_value" -@pytest.mark.asyncio -async def test_update_tag_async_from_dict(): - await test_update_tag_async(request_type=dict) - - def test_update_tag_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13527,8 +13584,8 @@ async def test_update_tag_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - tag.DeleteTagRequest, - dict, + tag.DeleteTagRequest(), + {}, ], ) def test_delete_tag(request_type, transport: str = "grpc"): @@ -13539,7 +13596,7 @@ def test_delete_tag(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tag), "__call__") as call: @@ -13580,9 +13637,10 @@ def test_delete_tag_non_empty_request_with_auto_populated_field(): client.delete_tag(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tag.DeleteTagRequest( + request_msg = tag.DeleteTagRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_tag_use_cached_wrapped_rpc(): @@ -13661,9 +13719,14 @@ async def test_delete_tag_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_delete_tag_async( - transport: str = "grpc_asyncio", request_type=tag.DeleteTagRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tag.DeleteTagRequest(), + {}, + ], +) +async def test_delete_tag_async(request_type, transport: str = "grpc_asyncio"): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13671,7 +13734,7 @@ async def test_delete_tag_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_tag), "__call__") as call: @@ -13689,11 +13752,6 @@ async def test_delete_tag_async( assert response is None -@pytest.mark.asyncio -async def test_delete_tag_async_from_dict(): - await test_delete_tag_async(request_type=dict) - - def test_delete_tag_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13836,8 +13894,8 @@ async def test_delete_tag_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gda_rule.CreateRuleRequest, - dict, + gda_rule.CreateRuleRequest(), + {}, ], ) def test_create_rule(request_type, transport: str = "grpc"): @@ -13848,7 +13906,7 @@ def test_create_rule(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_rule), "__call__") as call: @@ -13899,10 +13957,11 @@ def test_create_rule_non_empty_request_with_auto_populated_field(): client.create_rule(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gda_rule.CreateRuleRequest( + request_msg = gda_rule.CreateRuleRequest( parent="parent_value", rule_id="rule_id_value", ) + assert args[0] == request_msg def test_create_rule_use_cached_wrapped_rpc(): @@ -13983,9 +14042,14 @@ async def test_create_rule_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_rule_async( - transport: str = "grpc_asyncio", request_type=gda_rule.CreateRuleRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gda_rule.CreateRuleRequest(), + {}, + ], +) +async def test_create_rule_async(request_type, transport: str = "grpc_asyncio"): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13993,7 +14057,7 @@ async def test_create_rule_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_rule), "__call__") as call: @@ -14022,11 +14086,6 @@ async def test_create_rule_async( assert response.package_id == "package_id_value" -@pytest.mark.asyncio -async def test_create_rule_async_from_dict(): - await test_create_rule_async(request_type=dict) - - def test_create_rule_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14189,8 +14248,8 @@ async def test_create_rule_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - rule.ListRulesRequest, - dict, + rule.ListRulesRequest(), + {}, ], ) def test_list_rules(request_type, transport: str = "grpc"): @@ -14201,7 +14260,7 @@ def test_list_rules(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_rules), "__call__") as call: @@ -14246,10 +14305,11 @@ def test_list_rules_non_empty_request_with_auto_populated_field(): client.list_rules(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == rule.ListRulesRequest( + request_msg = rule.ListRulesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_rules_use_cached_wrapped_rpc(): @@ -14328,9 +14388,14 @@ async def test_list_rules_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_list_rules_async( - transport: str = "grpc_asyncio", request_type=rule.ListRulesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + rule.ListRulesRequest(), + {}, + ], +) +async def test_list_rules_async(request_type, transport: str = "grpc_asyncio"): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14338,7 +14403,7 @@ async def test_list_rules_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_rules), "__call__") as call: @@ -14361,11 +14426,6 @@ async def test_list_rules_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_rules_async_from_dict(): - await test_list_rules_async(request_type=dict) - - def test_list_rules_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14702,8 +14762,8 @@ async def test_list_rules_async_pages(): @pytest.mark.parametrize( "request_type", [ - rule.GetRuleRequest, - dict, + rule.GetRuleRequest(), + {}, ], ) def test_get_rule(request_type, transport: str = "grpc"): @@ -14714,7 +14774,7 @@ def test_get_rule(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_rule), "__call__") as call: @@ -14764,9 +14824,10 @@ def test_get_rule_non_empty_request_with_auto_populated_field(): client.get_rule(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == rule.GetRuleRequest( + request_msg = rule.GetRuleRequest( name="name_value", ) + assert args[0] == request_msg def test_get_rule_use_cached_wrapped_rpc(): @@ -14845,9 +14906,14 @@ async def test_get_rule_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn @pytest.mark.asyncio -async def test_get_rule_async( - transport: str = "grpc_asyncio", request_type=rule.GetRuleRequest -): +@pytest.mark.parametrize( + "request_type", + [ + rule.GetRuleRequest(), + {}, + ], +) +async def test_get_rule_async(request_type, transport: str = "grpc_asyncio"): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14855,7 +14921,7 @@ async def test_get_rule_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_rule), "__call__") as call: @@ -14884,11 +14950,6 @@ async def test_get_rule_async( assert response.package_id == "package_id_value" -@pytest.mark.asyncio -async def test_get_rule_async_from_dict(): - await test_get_rule_async(request_type=dict) - - def test_get_rule_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15031,8 +15092,8 @@ async def test_get_rule_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gda_rule.UpdateRuleRequest, - dict, + gda_rule.UpdateRuleRequest(), + {}, ], ) def test_update_rule(request_type, transport: str = "grpc"): @@ -15043,7 +15104,7 @@ def test_update_rule(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_rule), "__call__") as call: @@ -15091,7 +15152,8 @@ def test_update_rule_non_empty_request_with_auto_populated_field(): client.update_rule(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gda_rule.UpdateRuleRequest() + request_msg = gda_rule.UpdateRuleRequest() + assert args[0] == request_msg def test_update_rule_use_cached_wrapped_rpc(): @@ -15172,9 +15234,14 @@ async def test_update_rule_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_rule_async( - transport: str = "grpc_asyncio", request_type=gda_rule.UpdateRuleRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gda_rule.UpdateRuleRequest(), + {}, + ], +) +async def test_update_rule_async(request_type, transport: str = "grpc_asyncio"): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -15182,7 +15249,7 @@ async def test_update_rule_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_rule), "__call__") as call: @@ -15211,11 +15278,6 @@ async def test_update_rule_async( assert response.package_id == "package_id_value" -@pytest.mark.asyncio -async def test_update_rule_async_from_dict(): - await test_update_rule_async(request_type=dict) - - def test_update_rule_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15368,8 +15430,8 @@ async def test_update_rule_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - rule.DeleteRuleRequest, - dict, + rule.DeleteRuleRequest(), + {}, ], ) def test_delete_rule(request_type, transport: str = "grpc"): @@ -15380,7 +15442,7 @@ def test_delete_rule(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_rule), "__call__") as call: @@ -15421,9 +15483,10 @@ def test_delete_rule_non_empty_request_with_auto_populated_field(): client.delete_rule(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == rule.DeleteRuleRequest( + request_msg = rule.DeleteRuleRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_rule_use_cached_wrapped_rpc(): @@ -15504,9 +15567,14 @@ async def test_delete_rule_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_rule_async( - transport: str = "grpc_asyncio", request_type=rule.DeleteRuleRequest -): +@pytest.mark.parametrize( + "request_type", + [ + rule.DeleteRuleRequest(), + {}, + ], +) +async def test_delete_rule_async(request_type, transport: str = "grpc_asyncio"): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -15514,7 +15582,7 @@ async def test_delete_rule_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_rule), "__call__") as call: @@ -15532,11 +15600,6 @@ async def test_delete_rule_async( assert response is None -@pytest.mark.asyncio -async def test_delete_rule_async_from_dict(): - await test_delete_rule_async(request_type=dict) - - def test_delete_rule_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15679,8 +15742,8 @@ async def test_delete_rule_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.SetIamPolicyRequest, - dict, + iam_policy_pb2.SetIamPolicyRequest(), + {}, ], ) def test_set_iam_policy(request_type, transport: str = "grpc"): @@ -15691,7 +15754,7 @@ def test_set_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(type(client.transport.set_iam_policy), "__call__") as call: @@ -15737,9 +15800,10 @@ def test_set_iam_policy_non_empty_request_with_auto_populated_field(): client.set_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.SetIamPolicyRequest( + request_msg = iam_policy_pb2.SetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_set_iam_policy_use_cached_wrapped_rpc(): @@ -15820,9 +15884,14 @@ async def test_set_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.SetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.SetIamPolicyRequest(), + {}, + ], +) +async def test_set_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -15830,7 +15899,7 @@ async def test_set_iam_policy_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.set_iam_policy), "__call__") as call: @@ -15855,11 +15924,6 @@ async def test_set_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_set_iam_policy_async_from_dict(): - await test_set_iam_policy_async(request_type=dict) - - def test_set_iam_policy_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15940,8 +16004,8 @@ def test_set_iam_policy_from_dict_foreign(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.GetIamPolicyRequest, - dict, + iam_policy_pb2.GetIamPolicyRequest(), + {}, ], ) def test_get_iam_policy(request_type, transport: str = "grpc"): @@ -15952,7 +16016,7 @@ def test_get_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(type(client.transport.get_iam_policy), "__call__") as call: @@ -15998,9 +16062,10 @@ def test_get_iam_policy_non_empty_request_with_auto_populated_field(): client.get_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.GetIamPolicyRequest( + request_msg = iam_policy_pb2.GetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_get_iam_policy_use_cached_wrapped_rpc(): @@ -16081,9 +16146,14 @@ async def test_get_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.GetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.GetIamPolicyRequest(), + {}, + ], +) +async def test_get_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -16091,7 +16161,7 @@ async def test_get_iam_policy_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_iam_policy), "__call__") as call: @@ -16116,11 +16186,6 @@ async def test_get_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_get_iam_policy_async_from_dict(): - await test_get_iam_policy_async(request_type=dict) - - def test_get_iam_policy_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16200,8 +16265,8 @@ def test_get_iam_policy_from_dict_foreign(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.TestIamPermissionsRequest, - dict, + iam_policy_pb2.TestIamPermissionsRequest(), + {}, ], ) def test_test_iam_permissions(request_type, transport: str = "grpc"): @@ -16212,7 +16277,7 @@ def test_test_iam_permissions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -16260,9 +16325,10 @@ def test_test_iam_permissions_non_empty_request_with_auto_populated_field(): client.test_iam_permissions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.TestIamPermissionsRequest( + request_msg = iam_policy_pb2.TestIamPermissionsRequest( resource="resource_value", ) + assert args[0] == request_msg def test_test_iam_permissions_use_cached_wrapped_rpc(): @@ -16347,9 +16413,15 @@ async def test_test_iam_permissions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.TestIamPermissionsRequest(), + {}, + ], +) async def test_test_iam_permissions_async( - transport: str = "grpc_asyncio", - request_type=iam_policy_pb2.TestIamPermissionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), @@ -16358,7 +16430,7 @@ async def test_test_iam_permissions_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( @@ -16383,11 +16455,6 @@ async def test_test_iam_permissions_async( assert response.permissions == ["permissions_value"] -@pytest.mark.asyncio -async def test_test_iam_permissions_async_from_dict(): - await test_test_iam_permissions_async(request_type=dict) - - def test_test_iam_permissions_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16475,8 +16542,8 @@ def test_test_iam_permissions_from_dict_foreign(): @pytest.mark.parametrize( "request_type", [ - settings.GetProjectSettingsRequest, - dict, + settings.GetProjectSettingsRequest(), + {}, ], ) def test_get_project_settings(request_type, transport: str = "grpc"): @@ -16487,7 +16554,7 @@ def test_get_project_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( @@ -16542,9 +16609,10 @@ def test_get_project_settings_non_empty_request_with_auto_populated_field(): client.get_project_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == settings.GetProjectSettingsRequest( + request_msg = settings.GetProjectSettingsRequest( name="name_value", ) + assert args[0] == request_msg def test_get_project_settings_use_cached_wrapped_rpc(): @@ -16629,8 +16697,15 @@ async def test_get_project_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + settings.GetProjectSettingsRequest(), + {}, + ], +) async def test_get_project_settings_async( - transport: str = "grpc_asyncio", request_type=settings.GetProjectSettingsRequest + request_type, transport: str = "grpc_asyncio" ): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), @@ -16639,7 +16714,7 @@ async def test_get_project_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( @@ -16671,11 +16746,6 @@ async def test_get_project_settings_async( assert response.pull_percent == 1293 -@pytest.mark.asyncio -async def test_get_project_settings_async_from_dict(): - await test_get_project_settings_async(request_type=dict) - - def test_get_project_settings_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16830,8 +16900,8 @@ async def test_get_project_settings_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - settings.UpdateProjectSettingsRequest, - dict, + settings.UpdateProjectSettingsRequest(), + {}, ], ) def test_update_project_settings(request_type, transport: str = "grpc"): @@ -16842,7 +16912,7 @@ def test_update_project_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( @@ -16895,7 +16965,8 @@ def test_update_project_settings_non_empty_request_with_auto_populated_field(): client.update_project_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == settings.UpdateProjectSettingsRequest() + request_msg = settings.UpdateProjectSettingsRequest() + assert args[0] == request_msg def test_update_project_settings_use_cached_wrapped_rpc(): @@ -16981,8 +17052,15 @@ async def test_update_project_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + settings.UpdateProjectSettingsRequest(), + {}, + ], +) async def test_update_project_settings_async( - transport: str = "grpc_asyncio", request_type=settings.UpdateProjectSettingsRequest + request_type, transport: str = "grpc_asyncio" ): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), @@ -16991,7 +17069,7 @@ async def test_update_project_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( @@ -17023,11 +17101,6 @@ async def test_update_project_settings_async( assert response.pull_percent == 1293 -@pytest.mark.asyncio -async def test_update_project_settings_async_from_dict(): - await test_update_project_settings_async(request_type=dict) - - def test_update_project_settings_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17192,8 +17265,8 @@ async def test_update_project_settings_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vpcsc_config.GetVPCSCConfigRequest, - dict, + vpcsc_config.GetVPCSCConfigRequest(), + {}, ], ) def test_get_vpcsc_config(request_type, transport: str = "grpc"): @@ -17204,7 +17277,7 @@ def test_get_vpcsc_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(type(client.transport.get_vpcsc_config), "__call__") as call: @@ -17250,9 +17323,10 @@ def test_get_vpcsc_config_non_empty_request_with_auto_populated_field(): client.get_vpcsc_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vpcsc_config.GetVPCSCConfigRequest( + request_msg = vpcsc_config.GetVPCSCConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_vpcsc_config_use_cached_wrapped_rpc(): @@ -17335,9 +17409,14 @@ async def test_get_vpcsc_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_vpcsc_config_async( - transport: str = "grpc_asyncio", request_type=vpcsc_config.GetVPCSCConfigRequest -): +@pytest.mark.parametrize( + "request_type", + [ + vpcsc_config.GetVPCSCConfigRequest(), + {}, + ], +) +async def test_get_vpcsc_config_async(request_type, transport: str = "grpc_asyncio"): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -17345,7 +17424,7 @@ async def test_get_vpcsc_config_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_vpcsc_config), "__call__") as call: @@ -17370,11 +17449,6 @@ async def test_get_vpcsc_config_async( assert response.vpcsc_policy == vpcsc_config.VPCSCConfig.VPCSCPolicy.DENY -@pytest.mark.asyncio -async def test_get_vpcsc_config_async_from_dict(): - await test_get_vpcsc_config_async(request_type=dict) - - def test_get_vpcsc_config_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17521,8 +17595,8 @@ async def test_get_vpcsc_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gda_vpcsc_config.UpdateVPCSCConfigRequest, - dict, + gda_vpcsc_config.UpdateVPCSCConfigRequest(), + {}, ], ) def test_update_vpcsc_config(request_type, transport: str = "grpc"): @@ -17533,7 +17607,7 @@ def test_update_vpcsc_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( @@ -17581,7 +17655,8 @@ def test_update_vpcsc_config_non_empty_request_with_auto_populated_field(): client.update_vpcsc_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gda_vpcsc_config.UpdateVPCSCConfigRequest() + request_msg = gda_vpcsc_config.UpdateVPCSCConfigRequest() + assert args[0] == request_msg def test_update_vpcsc_config_use_cached_wrapped_rpc(): @@ -17666,10 +17741,14 @@ async def test_update_vpcsc_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_vpcsc_config_async( - transport: str = "grpc_asyncio", - request_type=gda_vpcsc_config.UpdateVPCSCConfigRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + gda_vpcsc_config.UpdateVPCSCConfigRequest(), + {}, + ], +) +async def test_update_vpcsc_config_async(request_type, transport: str = "grpc_asyncio"): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -17677,7 +17756,7 @@ async def test_update_vpcsc_config_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( @@ -17704,11 +17783,6 @@ async def test_update_vpcsc_config_async( assert response.vpcsc_policy == gda_vpcsc_config.VPCSCConfig.VPCSCPolicy.DENY -@pytest.mark.asyncio -async def test_update_vpcsc_config_async_from_dict(): - await test_update_vpcsc_config_async(request_type=dict) - - def test_update_vpcsc_config_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17873,8 +17947,8 @@ async def test_update_vpcsc_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gda_package.UpdatePackageRequest, - dict, + gda_package.UpdatePackageRequest(), + {}, ], ) def test_update_package(request_type, transport: str = "grpc"): @@ -17885,7 +17959,7 @@ def test_update_package(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_package), "__call__") as call: @@ -17929,7 +18003,8 @@ def test_update_package_non_empty_request_with_auto_populated_field(): client.update_package(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gda_package.UpdatePackageRequest() + request_msg = gda_package.UpdatePackageRequest() + assert args[0] == request_msg def test_update_package_use_cached_wrapped_rpc(): @@ -18010,9 +18085,14 @@ async def test_update_package_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_package_async( - transport: str = "grpc_asyncio", request_type=gda_package.UpdatePackageRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gda_package.UpdatePackageRequest(), + {}, + ], +) +async def test_update_package_async(request_type, transport: str = "grpc_asyncio"): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -18020,7 +18100,7 @@ async def test_update_package_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_package), "__call__") as call: @@ -18045,11 +18125,6 @@ async def test_update_package_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_update_package_async_from_dict(): - await test_update_package_async(request_type=dict) - - def test_update_package_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18202,8 +18277,8 @@ async def test_update_package_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - attachment.ListAttachmentsRequest, - dict, + attachment.ListAttachmentsRequest(), + {}, ], ) def test_list_attachments(request_type, transport: str = "grpc"): @@ -18214,7 +18289,7 @@ def test_list_attachments(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_attachments), "__call__") as call: @@ -18260,11 +18335,12 @@ def test_list_attachments_non_empty_request_with_auto_populated_field(): client.list_attachments(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == attachment.ListAttachmentsRequest( + request_msg = attachment.ListAttachmentsRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_attachments_use_cached_wrapped_rpc(): @@ -18347,9 +18423,14 @@ async def test_list_attachments_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_attachments_async( - transport: str = "grpc_asyncio", request_type=attachment.ListAttachmentsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + attachment.ListAttachmentsRequest(), + {}, + ], +) +async def test_list_attachments_async(request_type, transport: str = "grpc_asyncio"): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -18357,7 +18438,7 @@ async def test_list_attachments_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_attachments), "__call__") as call: @@ -18380,11 +18461,6 @@ async def test_list_attachments_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_attachments_async_from_dict(): - await test_list_attachments_async(request_type=dict) - - def test_list_attachments_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18721,8 +18797,8 @@ async def test_list_attachments_async_pages(): @pytest.mark.parametrize( "request_type", [ - attachment.GetAttachmentRequest, - dict, + attachment.GetAttachmentRequest(), + {}, ], ) def test_get_attachment(request_type, transport: str = "grpc"): @@ -18733,7 +18809,7 @@ def test_get_attachment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_attachment), "__call__") as call: @@ -18787,9 +18863,10 @@ def test_get_attachment_non_empty_request_with_auto_populated_field(): client.get_attachment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == attachment.GetAttachmentRequest( + request_msg = attachment.GetAttachmentRequest( name="name_value", ) + assert args[0] == request_msg def test_get_attachment_use_cached_wrapped_rpc(): @@ -18870,9 +18947,14 @@ async def test_get_attachment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_attachment_async( - transport: str = "grpc_asyncio", request_type=attachment.GetAttachmentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + attachment.GetAttachmentRequest(), + {}, + ], +) +async def test_get_attachment_async(request_type, transport: str = "grpc_asyncio"): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -18880,7 +18962,7 @@ async def test_get_attachment_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_attachment), "__call__") as call: @@ -18913,11 +18995,6 @@ async def test_get_attachment_async( assert response.oci_version_name == "oci_version_name_value" -@pytest.mark.asyncio -async def test_get_attachment_async_from_dict(): - await test_get_attachment_async(request_type=dict) - - def test_get_attachment_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -19064,8 +19141,8 @@ async def test_get_attachment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gda_attachment.CreateAttachmentRequest, - dict, + gda_attachment.CreateAttachmentRequest(), + {}, ], ) def test_create_attachment(request_type, transport: str = "grpc"): @@ -19076,7 +19153,7 @@ def test_create_attachment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -19122,10 +19199,11 @@ def test_create_attachment_non_empty_request_with_auto_populated_field(): client.create_attachment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gda_attachment.CreateAttachmentRequest( + request_msg = gda_attachment.CreateAttachmentRequest( parent="parent_value", attachment_id="attachment_id_value", ) + assert args[0] == request_msg def test_create_attachment_use_cached_wrapped_rpc(): @@ -19218,9 +19296,14 @@ async def test_create_attachment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_attachment_async( - transport: str = "grpc_asyncio", request_type=gda_attachment.CreateAttachmentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gda_attachment.CreateAttachmentRequest(), + {}, + ], +) +async def test_create_attachment_async(request_type, transport: str = "grpc_asyncio"): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -19228,7 +19311,7 @@ async def test_create_attachment_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( @@ -19250,11 +19333,6 @@ async def test_create_attachment_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_attachment_async_from_dict(): - await test_create_attachment_async(request_type=dict) - - def test_create_attachment_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -19429,8 +19507,8 @@ async def test_create_attachment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - attachment.DeleteAttachmentRequest, - dict, + attachment.DeleteAttachmentRequest(), + {}, ], ) def test_delete_attachment(request_type, transport: str = "grpc"): @@ -19441,7 +19519,7 @@ def test_delete_attachment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -19486,9 +19564,10 @@ def test_delete_attachment_non_empty_request_with_auto_populated_field(): client.delete_attachment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == attachment.DeleteAttachmentRequest( + request_msg = attachment.DeleteAttachmentRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_attachment_use_cached_wrapped_rpc(): @@ -19581,9 +19660,14 @@ async def test_delete_attachment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_attachment_async( - transport: str = "grpc_asyncio", request_type=attachment.DeleteAttachmentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + attachment.DeleteAttachmentRequest(), + {}, + ], +) +async def test_delete_attachment_async(request_type, transport: str = "grpc_asyncio"): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -19591,7 +19675,7 @@ async def test_delete_attachment_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( @@ -19613,11 +19697,6 @@ async def test_delete_attachment_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_attachment_async_from_dict(): - await test_delete_attachment_async(request_type=dict) - - def test_delete_attachment_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -19772,8 +19851,8 @@ async def test_delete_attachment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - export.ExportArtifactRequest, - dict, + export.ExportArtifactRequest(), + {}, ], ) def test_export_artifact(request_type, transport: str = "grpc"): @@ -19784,7 +19863,7 @@ def test_export_artifact(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.export_artifact), "__call__") as call: @@ -19828,12 +19907,13 @@ def test_export_artifact_non_empty_request_with_auto_populated_field(): client.export_artifact(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == export.ExportArtifactRequest( + request_msg = export.ExportArtifactRequest( source_version="source_version_value", source_tag="source_tag_value", gcs_path="gcs_path_value", repository="repository_value", ) + assert args[0] == request_msg def test_export_artifact_use_cached_wrapped_rpc(): @@ -19924,9 +20004,14 @@ async def test_export_artifact_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_export_artifact_async( - transport: str = "grpc_asyncio", request_type=export.ExportArtifactRequest -): +@pytest.mark.parametrize( + "request_type", + [ + export.ExportArtifactRequest(), + {}, + ], +) +async def test_export_artifact_async(request_type, transport: str = "grpc_asyncio"): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -19934,7 +20019,7 @@ async def test_export_artifact_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.export_artifact), "__call__") as call: @@ -19954,11 +20039,6 @@ async def test_export_artifact_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_export_artifact_async_from_dict(): - await test_export_artifact_async(request_type=dict) - - def test_export_artifact_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -28548,7 +28628,6 @@ def test_list_docker_images_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = artifact.ListDockerImagesRequest() - assert args[0] == request_msg @@ -28569,7 +28648,6 @@ def test_get_docker_image_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = artifact.GetDockerImageRequest() - assert args[0] == request_msg @@ -28592,7 +28670,6 @@ def test_list_maven_artifacts_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = artifact.ListMavenArtifactsRequest() - assert args[0] == request_msg @@ -28615,7 +28692,6 @@ def test_get_maven_artifact_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = artifact.GetMavenArtifactRequest() - assert args[0] == request_msg @@ -28638,7 +28714,6 @@ def test_list_npm_packages_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = artifact.ListNpmPackagesRequest() - assert args[0] == request_msg @@ -28659,7 +28734,6 @@ def test_get_npm_package_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = artifact.GetNpmPackageRequest() - assert args[0] == request_msg @@ -28682,7 +28756,6 @@ def test_list_python_packages_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = artifact.ListPythonPackagesRequest() - assert args[0] == request_msg @@ -28705,7 +28778,6 @@ def test_get_python_package_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = artifact.GetPythonPackageRequest() - assert args[0] == request_msg @@ -28728,7 +28800,6 @@ def test_import_apt_artifacts_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apt_artifact.ImportAptArtifactsRequest() - assert args[0] == request_msg @@ -28751,7 +28822,6 @@ def test_import_yum_artifacts_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = yum_artifact.ImportYumArtifactsRequest() - assert args[0] == request_msg @@ -28774,7 +28844,6 @@ def test_list_repositories_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = repository.ListRepositoriesRequest() - assert args[0] == request_msg @@ -28795,7 +28864,6 @@ def test_get_repository_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = repository.GetRepositoryRequest() - assert args[0] == request_msg @@ -28818,7 +28886,6 @@ def test_create_repository_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gda_repository.CreateRepositoryRequest() - assert args[0] == request_msg @@ -28841,7 +28908,6 @@ def test_update_repository_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gda_repository.UpdateRepositoryRequest() - assert args[0] == request_msg @@ -28864,7 +28930,6 @@ def test_delete_repository_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = repository.DeleteRepositoryRequest() - assert args[0] == request_msg @@ -28885,7 +28950,6 @@ def test_list_packages_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = package.ListPackagesRequest() - assert args[0] == request_msg @@ -28906,7 +28970,6 @@ def test_get_package_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = package.GetPackageRequest() - assert args[0] == request_msg @@ -28927,7 +28990,6 @@ def test_delete_package_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = package.DeletePackageRequest() - assert args[0] == request_msg @@ -28948,7 +29010,6 @@ def test_list_versions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = version.ListVersionsRequest() - assert args[0] == request_msg @@ -28969,7 +29030,6 @@ def test_get_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = version.GetVersionRequest() - assert args[0] == request_msg @@ -28990,7 +29050,6 @@ def test_delete_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = version.DeleteVersionRequest() - assert args[0] == request_msg @@ -29013,7 +29072,6 @@ def test_batch_delete_versions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = version.BatchDeleteVersionsRequest() - assert args[0] == request_msg @@ -29034,7 +29092,6 @@ def test_update_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gda_version.UpdateVersionRequest() - assert args[0] == request_msg @@ -29055,7 +29112,6 @@ def test_list_files_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = file.ListFilesRequest() - assert args[0] == request_msg @@ -29076,7 +29132,6 @@ def test_get_file_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = file.GetFileRequest() - assert args[0] == request_msg @@ -29097,7 +29152,6 @@ def test_delete_file_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = file.DeleteFileRequest() - assert args[0] == request_msg @@ -29118,7 +29172,6 @@ def test_update_file_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gda_file.UpdateFileRequest() - assert args[0] == request_msg @@ -29139,7 +29192,6 @@ def test_list_tags_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag.ListTagsRequest() - assert args[0] == request_msg @@ -29160,7 +29212,6 @@ def test_get_tag_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag.GetTagRequest() - assert args[0] == request_msg @@ -29181,7 +29232,6 @@ def test_create_tag_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gda_tag.CreateTagRequest() - assert args[0] == request_msg @@ -29202,7 +29252,6 @@ def test_update_tag_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gda_tag.UpdateTagRequest() - assert args[0] == request_msg @@ -29223,7 +29272,6 @@ def test_delete_tag_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag.DeleteTagRequest() - assert args[0] == request_msg @@ -29244,7 +29292,6 @@ def test_create_rule_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gda_rule.CreateRuleRequest() - assert args[0] == request_msg @@ -29265,7 +29312,6 @@ def test_list_rules_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rule.ListRulesRequest() - assert args[0] == request_msg @@ -29286,7 +29332,6 @@ def test_get_rule_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rule.GetRuleRequest() - assert args[0] == request_msg @@ -29307,7 +29352,6 @@ def test_update_rule_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gda_rule.UpdateRuleRequest() - assert args[0] == request_msg @@ -29328,7 +29372,6 @@ def test_delete_rule_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rule.DeleteRuleRequest() - assert args[0] == request_msg @@ -29349,7 +29392,6 @@ def test_set_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -29370,7 +29412,6 @@ def test_get_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -29393,7 +29434,6 @@ def test_test_iam_permissions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -29416,7 +29456,6 @@ def test_get_project_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = settings.GetProjectSettingsRequest() - assert args[0] == request_msg @@ -29439,7 +29478,6 @@ def test_update_project_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = settings.UpdateProjectSettingsRequest() - assert args[0] == request_msg @@ -29460,7 +29498,6 @@ def test_get_vpcsc_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vpcsc_config.GetVPCSCConfigRequest() - assert args[0] == request_msg @@ -29483,7 +29520,6 @@ def test_update_vpcsc_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gda_vpcsc_config.UpdateVPCSCConfigRequest() - assert args[0] == request_msg @@ -29504,7 +29540,6 @@ def test_update_package_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gda_package.UpdatePackageRequest() - assert args[0] == request_msg @@ -29525,7 +29560,6 @@ def test_list_attachments_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = attachment.ListAttachmentsRequest() - assert args[0] == request_msg @@ -29546,7 +29580,6 @@ def test_get_attachment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = attachment.GetAttachmentRequest() - assert args[0] == request_msg @@ -29569,7 +29602,6 @@ def test_create_attachment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gda_attachment.CreateAttachmentRequest() - assert args[0] == request_msg @@ -29592,7 +29624,6 @@ def test_delete_attachment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = attachment.DeleteAttachmentRequest() - assert args[0] == request_msg @@ -29613,7 +29644,6 @@ def test_export_artifact_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = export.ExportArtifactRequest() - assert args[0] == request_msg @@ -29656,7 +29686,6 @@ async def test_list_docker_images_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = artifact.ListDockerImagesRequest() - assert args[0] == request_msg @@ -29688,7 +29717,6 @@ async def test_get_docker_image_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = artifact.GetDockerImageRequest() - assert args[0] == request_msg @@ -29717,7 +29745,6 @@ async def test_list_maven_artifacts_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = artifact.ListMavenArtifactsRequest() - assert args[0] == request_msg @@ -29750,7 +29777,6 @@ async def test_get_maven_artifact_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = artifact.GetMavenArtifactRequest() - assert args[0] == request_msg @@ -29779,7 +29805,6 @@ async def test_list_npm_packages_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = artifact.ListNpmPackagesRequest() - assert args[0] == request_msg @@ -29809,7 +29834,6 @@ async def test_get_npm_package_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = artifact.GetNpmPackageRequest() - assert args[0] == request_msg @@ -29838,7 +29862,6 @@ async def test_list_python_packages_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = artifact.ListPythonPackagesRequest() - assert args[0] == request_msg @@ -29870,7 +29893,6 @@ async def test_get_python_package_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = artifact.GetPythonPackageRequest() - assert args[0] == request_msg @@ -29897,7 +29919,6 @@ async def test_import_apt_artifacts_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apt_artifact.ImportAptArtifactsRequest() - assert args[0] == request_msg @@ -29924,7 +29945,6 @@ async def test_import_yum_artifacts_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = yum_artifact.ImportYumArtifactsRequest() - assert args[0] == request_msg @@ -29953,7 +29973,6 @@ async def test_list_repositories_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = repository.ListRepositoriesRequest() - assert args[0] == request_msg @@ -29990,7 +30009,6 @@ async def test_get_repository_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = repository.GetRepositoryRequest() - assert args[0] == request_msg @@ -30017,7 +30035,6 @@ async def test_create_repository_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gda_repository.CreateRepositoryRequest() - assert args[0] == request_msg @@ -30056,7 +30073,6 @@ async def test_update_repository_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gda_repository.UpdateRepositoryRequest() - assert args[0] == request_msg @@ -30083,7 +30099,6 @@ async def test_delete_repository_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = repository.DeleteRepositoryRequest() - assert args[0] == request_msg @@ -30110,7 +30125,6 @@ async def test_list_packages_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = package.ListPackagesRequest() - assert args[0] == request_msg @@ -30138,7 +30152,6 @@ async def test_get_package_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = package.GetPackageRequest() - assert args[0] == request_msg @@ -30163,7 +30176,6 @@ async def test_delete_package_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = package.DeletePackageRequest() - assert args[0] == request_msg @@ -30190,7 +30202,6 @@ async def test_list_versions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = version.ListVersionsRequest() - assert args[0] == request_msg @@ -30218,7 +30229,6 @@ async def test_get_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = version.GetVersionRequest() - assert args[0] == request_msg @@ -30243,7 +30253,6 @@ async def test_delete_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = version.DeleteVersionRequest() - assert args[0] == request_msg @@ -30270,7 +30279,6 @@ async def test_batch_delete_versions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = version.BatchDeleteVersionsRequest() - assert args[0] == request_msg @@ -30298,7 +30306,6 @@ async def test_update_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gda_version.UpdateVersionRequest() - assert args[0] == request_msg @@ -30325,7 +30332,6 @@ async def test_list_files_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = file.ListFilesRequest() - assert args[0] == request_msg @@ -30354,7 +30360,6 @@ async def test_get_file_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = file.GetFileRequest() - assert args[0] == request_msg @@ -30379,7 +30384,6 @@ async def test_delete_file_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = file.DeleteFileRequest() - assert args[0] == request_msg @@ -30408,7 +30412,6 @@ async def test_update_file_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gda_file.UpdateFileRequest() - assert args[0] == request_msg @@ -30435,7 +30438,6 @@ async def test_list_tags_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag.ListTagsRequest() - assert args[0] == request_msg @@ -30463,7 +30465,6 @@ async def test_get_tag_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag.GetTagRequest() - assert args[0] == request_msg @@ -30491,7 +30492,6 @@ async def test_create_tag_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gda_tag.CreateTagRequest() - assert args[0] == request_msg @@ -30519,7 +30519,6 @@ async def test_update_tag_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gda_tag.UpdateTagRequest() - assert args[0] == request_msg @@ -30542,7 +30541,6 @@ async def test_delete_tag_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag.DeleteTagRequest() - assert args[0] == request_msg @@ -30572,7 +30570,6 @@ async def test_create_rule_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gda_rule.CreateRuleRequest() - assert args[0] == request_msg @@ -30599,7 +30596,6 @@ async def test_list_rules_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rule.ListRulesRequest() - assert args[0] == request_msg @@ -30629,7 +30625,6 @@ async def test_get_rule_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rule.GetRuleRequest() - assert args[0] == request_msg @@ -30659,7 +30654,6 @@ async def test_update_rule_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gda_rule.UpdateRuleRequest() - assert args[0] == request_msg @@ -30682,7 +30676,6 @@ async def test_delete_rule_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rule.DeleteRuleRequest() - assert args[0] == request_msg @@ -30710,7 +30703,6 @@ async def test_set_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -30738,7 +30730,6 @@ async def test_get_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -30767,7 +30758,6 @@ async def test_test_iam_permissions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -30798,7 +30788,6 @@ async def test_get_project_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = settings.GetProjectSettingsRequest() - assert args[0] == request_msg @@ -30829,7 +30818,6 @@ async def test_update_project_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = settings.UpdateProjectSettingsRequest() - assert args[0] == request_msg @@ -30857,7 +30845,6 @@ async def test_get_vpcsc_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vpcsc_config.GetVPCSCConfigRequest() - assert args[0] == request_msg @@ -30887,7 +30874,6 @@ async def test_update_vpcsc_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gda_vpcsc_config.UpdateVPCSCConfigRequest() - assert args[0] == request_msg @@ -30915,7 +30901,6 @@ async def test_update_package_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gda_package.UpdatePackageRequest() - assert args[0] == request_msg @@ -30942,7 +30927,6 @@ async def test_list_attachments_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = attachment.ListAttachmentsRequest() - assert args[0] == request_msg @@ -30974,7 +30958,6 @@ async def test_get_attachment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = attachment.GetAttachmentRequest() - assert args[0] == request_msg @@ -31001,7 +30984,6 @@ async def test_create_attachment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gda_attachment.CreateAttachmentRequest() - assert args[0] == request_msg @@ -31028,7 +31010,6 @@ async def test_delete_attachment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = attachment.DeleteAttachmentRequest() - assert args[0] == request_msg @@ -31053,7 +31034,6 @@ async def test_export_artifact_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = export.ExportArtifactRequest() - assert args[0] == request_msg @@ -38942,7 +38922,6 @@ def test_list_docker_images_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = artifact.ListDockerImagesRequest() - assert args[0] == request_msg @@ -38962,7 +38941,6 @@ def test_get_docker_image_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = artifact.GetDockerImageRequest() - assert args[0] == request_msg @@ -38984,7 +38962,6 @@ def test_list_maven_artifacts_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = artifact.ListMavenArtifactsRequest() - assert args[0] == request_msg @@ -39006,7 +38983,6 @@ def test_get_maven_artifact_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = artifact.GetMavenArtifactRequest() - assert args[0] == request_msg @@ -39028,7 +39004,6 @@ def test_list_npm_packages_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = artifact.ListNpmPackagesRequest() - assert args[0] == request_msg @@ -39048,7 +39023,6 @@ def test_get_npm_package_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = artifact.GetNpmPackageRequest() - assert args[0] == request_msg @@ -39070,7 +39044,6 @@ def test_list_python_packages_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = artifact.ListPythonPackagesRequest() - assert args[0] == request_msg @@ -39092,7 +39065,6 @@ def test_get_python_package_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = artifact.GetPythonPackageRequest() - assert args[0] == request_msg @@ -39114,7 +39086,6 @@ def test_import_apt_artifacts_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apt_artifact.ImportAptArtifactsRequest() - assert args[0] == request_msg @@ -39136,7 +39107,6 @@ def test_import_yum_artifacts_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = yum_artifact.ImportYumArtifactsRequest() - assert args[0] == request_msg @@ -39158,7 +39128,6 @@ def test_list_repositories_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = repository.ListRepositoriesRequest() - assert args[0] == request_msg @@ -39178,7 +39147,6 @@ def test_get_repository_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = repository.GetRepositoryRequest() - assert args[0] == request_msg @@ -39200,7 +39168,6 @@ def test_create_repository_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gda_repository.CreateRepositoryRequest() - assert args[0] == request_msg @@ -39222,7 +39189,6 @@ def test_update_repository_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gda_repository.UpdateRepositoryRequest() - assert args[0] == request_msg @@ -39244,7 +39210,6 @@ def test_delete_repository_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = repository.DeleteRepositoryRequest() - assert args[0] == request_msg @@ -39264,7 +39229,6 @@ def test_list_packages_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = package.ListPackagesRequest() - assert args[0] == request_msg @@ -39284,7 +39248,6 @@ def test_get_package_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = package.GetPackageRequest() - assert args[0] == request_msg @@ -39304,7 +39267,6 @@ def test_delete_package_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = package.DeletePackageRequest() - assert args[0] == request_msg @@ -39324,7 +39286,6 @@ def test_list_versions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = version.ListVersionsRequest() - assert args[0] == request_msg @@ -39344,7 +39305,6 @@ def test_get_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = version.GetVersionRequest() - assert args[0] == request_msg @@ -39364,7 +39324,6 @@ def test_delete_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = version.DeleteVersionRequest() - assert args[0] == request_msg @@ -39386,7 +39345,6 @@ def test_batch_delete_versions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = version.BatchDeleteVersionsRequest() - assert args[0] == request_msg @@ -39406,7 +39364,6 @@ def test_update_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gda_version.UpdateVersionRequest() - assert args[0] == request_msg @@ -39426,7 +39383,6 @@ def test_list_files_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = file.ListFilesRequest() - assert args[0] == request_msg @@ -39446,7 +39402,6 @@ def test_get_file_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = file.GetFileRequest() - assert args[0] == request_msg @@ -39466,7 +39421,6 @@ def test_delete_file_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = file.DeleteFileRequest() - assert args[0] == request_msg @@ -39486,7 +39440,6 @@ def test_update_file_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gda_file.UpdateFileRequest() - assert args[0] == request_msg @@ -39506,7 +39459,6 @@ def test_list_tags_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag.ListTagsRequest() - assert args[0] == request_msg @@ -39526,7 +39478,6 @@ def test_get_tag_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag.GetTagRequest() - assert args[0] == request_msg @@ -39546,7 +39497,6 @@ def test_create_tag_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gda_tag.CreateTagRequest() - assert args[0] == request_msg @@ -39566,7 +39516,6 @@ def test_update_tag_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gda_tag.UpdateTagRequest() - assert args[0] == request_msg @@ -39586,7 +39535,6 @@ def test_delete_tag_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag.DeleteTagRequest() - assert args[0] == request_msg @@ -39606,7 +39554,6 @@ def test_create_rule_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gda_rule.CreateRuleRequest() - assert args[0] == request_msg @@ -39626,7 +39573,6 @@ def test_list_rules_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rule.ListRulesRequest() - assert args[0] == request_msg @@ -39646,7 +39592,6 @@ def test_get_rule_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rule.GetRuleRequest() - assert args[0] == request_msg @@ -39666,7 +39611,6 @@ def test_update_rule_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gda_rule.UpdateRuleRequest() - assert args[0] == request_msg @@ -39686,7 +39630,6 @@ def test_delete_rule_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rule.DeleteRuleRequest() - assert args[0] == request_msg @@ -39706,7 +39649,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -39726,7 +39668,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -39748,7 +39689,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -39770,7 +39710,6 @@ def test_get_project_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = settings.GetProjectSettingsRequest() - assert args[0] == request_msg @@ -39792,7 +39731,6 @@ def test_update_project_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = settings.UpdateProjectSettingsRequest() - assert args[0] == request_msg @@ -39812,7 +39750,6 @@ def test_get_vpcsc_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vpcsc_config.GetVPCSCConfigRequest() - assert args[0] == request_msg @@ -39834,7 +39771,6 @@ def test_update_vpcsc_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gda_vpcsc_config.UpdateVPCSCConfigRequest() - assert args[0] == request_msg @@ -39854,7 +39790,6 @@ def test_update_package_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gda_package.UpdatePackageRequest() - assert args[0] == request_msg @@ -39874,7 +39809,6 @@ def test_list_attachments_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = attachment.ListAttachmentsRequest() - assert args[0] == request_msg @@ -39894,7 +39828,6 @@ def test_get_attachment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = attachment.GetAttachmentRequest() - assert args[0] == request_msg @@ -39916,7 +39849,6 @@ def test_create_attachment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gda_attachment.CreateAttachmentRequest() - assert args[0] == request_msg @@ -39938,7 +39870,6 @@ def test_delete_attachment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = attachment.DeleteAttachmentRequest() - assert args[0] == request_msg @@ -39958,7 +39889,6 @@ def test_export_artifact_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = export.ExportArtifactRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-artifact-registry/tests/unit/gapic/artifactregistry_v1beta2/test_artifact_registry.py b/packages/google-cloud-artifact-registry/tests/unit/gapic/artifactregistry_v1beta2/test_artifact_registry.py index 72c8d5b9deaf..1512454de4fd 100644 --- a/packages/google-cloud-artifact-registry/tests/unit/gapic/artifactregistry_v1beta2/test_artifact_registry.py +++ b/packages/google-cloud-artifact-registry/tests/unit/gapic/artifactregistry_v1beta2/test_artifact_registry.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 @@ -133,6 +134,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" @@ -1369,8 +1385,8 @@ def test_artifact_registry_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - apt_artifact.ImportAptArtifactsRequest, - dict, + apt_artifact.ImportAptArtifactsRequest(), + {}, ], ) def test_import_apt_artifacts(request_type, transport: str = "grpc"): @@ -1381,7 +1397,7 @@ def test_import_apt_artifacts(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1426,9 +1442,10 @@ def test_import_apt_artifacts_non_empty_request_with_auto_populated_field(): client.import_apt_artifacts(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == apt_artifact.ImportAptArtifactsRequest( + request_msg = apt_artifact.ImportAptArtifactsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_import_apt_artifacts_use_cached_wrapped_rpc(): @@ -1523,8 +1540,15 @@ async def test_import_apt_artifacts_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + apt_artifact.ImportAptArtifactsRequest(), + {}, + ], +) async def test_import_apt_artifacts_async( - transport: str = "grpc_asyncio", request_type=apt_artifact.ImportAptArtifactsRequest + request_type, transport: str = "grpc_asyncio" ): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), @@ -1533,7 +1557,7 @@ async def test_import_apt_artifacts_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( @@ -1555,11 +1579,6 @@ async def test_import_apt_artifacts_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_import_apt_artifacts_async_from_dict(): - await test_import_apt_artifacts_async(request_type=dict) - - def test_import_apt_artifacts_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1628,8 +1647,8 @@ async def test_import_apt_artifacts_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - yum_artifact.ImportYumArtifactsRequest, - dict, + yum_artifact.ImportYumArtifactsRequest(), + {}, ], ) def test_import_yum_artifacts(request_type, transport: str = "grpc"): @@ -1640,7 +1659,7 @@ def test_import_yum_artifacts(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1685,9 +1704,10 @@ def test_import_yum_artifacts_non_empty_request_with_auto_populated_field(): client.import_yum_artifacts(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == yum_artifact.ImportYumArtifactsRequest( + request_msg = yum_artifact.ImportYumArtifactsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_import_yum_artifacts_use_cached_wrapped_rpc(): @@ -1782,8 +1802,15 @@ async def test_import_yum_artifacts_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + yum_artifact.ImportYumArtifactsRequest(), + {}, + ], +) async def test_import_yum_artifacts_async( - transport: str = "grpc_asyncio", request_type=yum_artifact.ImportYumArtifactsRequest + request_type, transport: str = "grpc_asyncio" ): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), @@ -1792,7 +1819,7 @@ async def test_import_yum_artifacts_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( @@ -1814,11 +1841,6 @@ async def test_import_yum_artifacts_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_import_yum_artifacts_async_from_dict(): - await test_import_yum_artifacts_async(request_type=dict) - - def test_import_yum_artifacts_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1887,8 +1909,8 @@ async def test_import_yum_artifacts_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - repository.ListRepositoriesRequest, - dict, + repository.ListRepositoriesRequest(), + {}, ], ) def test_list_repositories(request_type, transport: str = "grpc"): @@ -1899,7 +1921,7 @@ def test_list_repositories(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1948,10 +1970,11 @@ def test_list_repositories_non_empty_request_with_auto_populated_field(): client.list_repositories(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == repository.ListRepositoriesRequest( + request_msg = repository.ListRepositoriesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_repositories_use_cached_wrapped_rpc(): @@ -2034,9 +2057,14 @@ async def test_list_repositories_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_repositories_async( - transport: str = "grpc_asyncio", request_type=repository.ListRepositoriesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + repository.ListRepositoriesRequest(), + {}, + ], +) +async def test_list_repositories_async(request_type, transport: str = "grpc_asyncio"): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2044,7 +2072,7 @@ async def test_list_repositories_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( @@ -2069,11 +2097,6 @@ async def test_list_repositories_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_repositories_async_from_dict(): - await test_list_repositories_async(request_type=dict) - - def test_list_repositories_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2426,8 +2449,8 @@ async def test_list_repositories_async_pages(): @pytest.mark.parametrize( "request_type", [ - repository.GetRepositoryRequest, - dict, + repository.GetRepositoryRequest(), + {}, ], ) def test_get_repository(request_type, transport: str = "grpc"): @@ -2438,7 +2461,7 @@ def test_get_repository(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_repository), "__call__") as call: @@ -2488,9 +2511,10 @@ def test_get_repository_non_empty_request_with_auto_populated_field(): client.get_repository(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == repository.GetRepositoryRequest( + request_msg = repository.GetRepositoryRequest( name="name_value", ) + assert args[0] == request_msg def test_get_repository_use_cached_wrapped_rpc(): @@ -2571,9 +2595,14 @@ async def test_get_repository_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_repository_async( - transport: str = "grpc_asyncio", request_type=repository.GetRepositoryRequest -): +@pytest.mark.parametrize( + "request_type", + [ + repository.GetRepositoryRequest(), + {}, + ], +) +async def test_get_repository_async(request_type, transport: str = "grpc_asyncio"): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2581,7 +2610,7 @@ async def test_get_repository_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_repository), "__call__") as call: @@ -2610,11 +2639,6 @@ async def test_get_repository_async( assert response.kms_key_name == "kms_key_name_value" -@pytest.mark.asyncio -async def test_get_repository_async_from_dict(): - await test_get_repository_async(request_type=dict) - - def test_get_repository_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2761,8 +2785,8 @@ async def test_get_repository_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gda_repository.CreateRepositoryRequest, - dict, + gda_repository.CreateRepositoryRequest(), + {}, ], ) def test_create_repository(request_type, transport: str = "grpc"): @@ -2773,7 +2797,7 @@ def test_create_repository(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2819,10 +2843,11 @@ def test_create_repository_non_empty_request_with_auto_populated_field(): client.create_repository(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gda_repository.CreateRepositoryRequest( + request_msg = gda_repository.CreateRepositoryRequest( parent="parent_value", repository_id="repository_id_value", ) + assert args[0] == request_msg def test_create_repository_use_cached_wrapped_rpc(): @@ -2915,9 +2940,14 @@ async def test_create_repository_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_repository_async( - transport: str = "grpc_asyncio", request_type=gda_repository.CreateRepositoryRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gda_repository.CreateRepositoryRequest(), + {}, + ], +) +async def test_create_repository_async(request_type, transport: str = "grpc_asyncio"): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2925,7 +2955,7 @@ async def test_create_repository_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( @@ -2947,11 +2977,6 @@ async def test_create_repository_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_repository_async_from_dict(): - await test_create_repository_async(request_type=dict) - - def test_create_repository_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3150,8 +3175,8 @@ async def test_create_repository_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gda_repository.UpdateRepositoryRequest, - dict, + gda_repository.UpdateRepositoryRequest(), + {}, ], ) def test_update_repository(request_type, transport: str = "grpc"): @@ -3162,7 +3187,7 @@ def test_update_repository(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3214,7 +3239,8 @@ def test_update_repository_non_empty_request_with_auto_populated_field(): client.update_repository(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gda_repository.UpdateRepositoryRequest() + request_msg = gda_repository.UpdateRepositoryRequest() + assert args[0] == request_msg def test_update_repository_use_cached_wrapped_rpc(): @@ -3297,9 +3323,14 @@ async def test_update_repository_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_repository_async( - transport: str = "grpc_asyncio", request_type=gda_repository.UpdateRepositoryRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gda_repository.UpdateRepositoryRequest(), + {}, + ], +) +async def test_update_repository_async(request_type, transport: str = "grpc_asyncio"): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3307,7 +3338,7 @@ async def test_update_repository_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( @@ -3338,11 +3369,6 @@ async def test_update_repository_async( assert response.kms_key_name == "kms_key_name_value" -@pytest.mark.asyncio -async def test_update_repository_async_from_dict(): - await test_update_repository_async(request_type=dict) - - def test_update_repository_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3531,8 +3557,8 @@ async def test_update_repository_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - repository.DeleteRepositoryRequest, - dict, + repository.DeleteRepositoryRequest(), + {}, ], ) def test_delete_repository(request_type, transport: str = "grpc"): @@ -3543,7 +3569,7 @@ def test_delete_repository(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3588,9 +3614,10 @@ def test_delete_repository_non_empty_request_with_auto_populated_field(): client.delete_repository(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == repository.DeleteRepositoryRequest( + request_msg = repository.DeleteRepositoryRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_repository_use_cached_wrapped_rpc(): @@ -3683,9 +3710,14 @@ async def test_delete_repository_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_repository_async( - transport: str = "grpc_asyncio", request_type=repository.DeleteRepositoryRequest -): +@pytest.mark.parametrize( + "request_type", + [ + repository.DeleteRepositoryRequest(), + {}, + ], +) +async def test_delete_repository_async(request_type, transport: str = "grpc_asyncio"): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3693,7 +3725,7 @@ async def test_delete_repository_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( @@ -3715,11 +3747,6 @@ async def test_delete_repository_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_repository_async_from_dict(): - await test_delete_repository_async(request_type=dict) - - def test_delete_repository_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3874,8 +3901,8 @@ async def test_delete_repository_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - package.ListPackagesRequest, - dict, + package.ListPackagesRequest(), + {}, ], ) def test_list_packages(request_type, transport: str = "grpc"): @@ -3886,7 +3913,7 @@ def test_list_packages(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_packages), "__call__") as call: @@ -3931,10 +3958,11 @@ def test_list_packages_non_empty_request_with_auto_populated_field(): client.list_packages(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == package.ListPackagesRequest( + request_msg = package.ListPackagesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_packages_use_cached_wrapped_rpc(): @@ -4015,9 +4043,14 @@ async def test_list_packages_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_packages_async( - transport: str = "grpc_asyncio", request_type=package.ListPackagesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + package.ListPackagesRequest(), + {}, + ], +) +async def test_list_packages_async(request_type, transport: str = "grpc_asyncio"): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4025,7 +4058,7 @@ async def test_list_packages_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_packages), "__call__") as call: @@ -4048,11 +4081,6 @@ async def test_list_packages_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_packages_async_from_dict(): - await test_list_packages_async(request_type=dict) - - def test_list_packages_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4389,8 +4417,8 @@ async def test_list_packages_async_pages(): @pytest.mark.parametrize( "request_type", [ - package.GetPackageRequest, - dict, + package.GetPackageRequest(), + {}, ], ) def test_get_package(request_type, transport: str = "grpc"): @@ -4401,7 +4429,7 @@ def test_get_package(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_package), "__call__") as call: @@ -4447,9 +4475,10 @@ def test_get_package_non_empty_request_with_auto_populated_field(): client.get_package(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == package.GetPackageRequest( + request_msg = package.GetPackageRequest( name="name_value", ) + assert args[0] == request_msg def test_get_package_use_cached_wrapped_rpc(): @@ -4530,9 +4559,14 @@ async def test_get_package_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_package_async( - transport: str = "grpc_asyncio", request_type=package.GetPackageRequest -): +@pytest.mark.parametrize( + "request_type", + [ + package.GetPackageRequest(), + {}, + ], +) +async def test_get_package_async(request_type, transport: str = "grpc_asyncio"): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4540,7 +4574,7 @@ async def test_get_package_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_package), "__call__") as call: @@ -4565,11 +4599,6 @@ async def test_get_package_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_get_package_async_from_dict(): - await test_get_package_async(request_type=dict) - - def test_get_package_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4712,8 +4741,8 @@ async def test_get_package_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - package.DeletePackageRequest, - dict, + package.DeletePackageRequest(), + {}, ], ) def test_delete_package(request_type, transport: str = "grpc"): @@ -4724,7 +4753,7 @@ def test_delete_package(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_package), "__call__") as call: @@ -4765,9 +4794,10 @@ def test_delete_package_non_empty_request_with_auto_populated_field(): client.delete_package(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == package.DeletePackageRequest( + request_msg = package.DeletePackageRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_package_use_cached_wrapped_rpc(): @@ -4858,9 +4888,14 @@ async def test_delete_package_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_package_async( - transport: str = "grpc_asyncio", request_type=package.DeletePackageRequest -): +@pytest.mark.parametrize( + "request_type", + [ + package.DeletePackageRequest(), + {}, + ], +) +async def test_delete_package_async(request_type, transport: str = "grpc_asyncio"): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4868,7 +4903,7 @@ async def test_delete_package_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_package), "__call__") as call: @@ -4888,11 +4923,6 @@ async def test_delete_package_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_package_async_from_dict(): - await test_delete_package_async(request_type=dict) - - def test_delete_package_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5039,8 +5069,8 @@ async def test_delete_package_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - version.ListVersionsRequest, - dict, + version.ListVersionsRequest(), + {}, ], ) def test_list_versions(request_type, transport: str = "grpc"): @@ -5051,7 +5081,7 @@ def test_list_versions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_versions), "__call__") as call: @@ -5097,11 +5127,12 @@ def test_list_versions_non_empty_request_with_auto_populated_field(): client.list_versions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == version.ListVersionsRequest( + request_msg = version.ListVersionsRequest( parent="parent_value", page_token="page_token_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_versions_use_cached_wrapped_rpc(): @@ -5182,9 +5213,14 @@ async def test_list_versions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_versions_async( - transport: str = "grpc_asyncio", request_type=version.ListVersionsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + version.ListVersionsRequest(), + {}, + ], +) +async def test_list_versions_async(request_type, transport: str = "grpc_asyncio"): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5192,7 +5228,7 @@ async def test_list_versions_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_versions), "__call__") as call: @@ -5215,11 +5251,6 @@ async def test_list_versions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_versions_async_from_dict(): - await test_list_versions_async(request_type=dict) - - def test_list_versions_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5556,8 +5587,8 @@ async def test_list_versions_async_pages(): @pytest.mark.parametrize( "request_type", [ - version.GetVersionRequest, - dict, + version.GetVersionRequest(), + {}, ], ) def test_get_version(request_type, transport: str = "grpc"): @@ -5568,7 +5599,7 @@ def test_get_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_version), "__call__") as call: @@ -5614,9 +5645,10 @@ def test_get_version_non_empty_request_with_auto_populated_field(): client.get_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == version.GetVersionRequest( + request_msg = version.GetVersionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_version_use_cached_wrapped_rpc(): @@ -5697,9 +5729,14 @@ async def test_get_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_version_async( - transport: str = "grpc_asyncio", request_type=version.GetVersionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + version.GetVersionRequest(), + {}, + ], +) +async def test_get_version_async(request_type, transport: str = "grpc_asyncio"): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5707,7 +5744,7 @@ async def test_get_version_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_version), "__call__") as call: @@ -5732,11 +5769,6 @@ async def test_get_version_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_get_version_async_from_dict(): - await test_get_version_async(request_type=dict) - - def test_get_version_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5879,8 +5911,8 @@ async def test_get_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - version.DeleteVersionRequest, - dict, + version.DeleteVersionRequest(), + {}, ], ) def test_delete_version(request_type, transport: str = "grpc"): @@ -5891,7 +5923,7 @@ def test_delete_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_version), "__call__") as call: @@ -5932,9 +5964,10 @@ def test_delete_version_non_empty_request_with_auto_populated_field(): client.delete_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == version.DeleteVersionRequest( + request_msg = version.DeleteVersionRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_version_use_cached_wrapped_rpc(): @@ -6025,9 +6058,14 @@ async def test_delete_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_version_async( - transport: str = "grpc_asyncio", request_type=version.DeleteVersionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + version.DeleteVersionRequest(), + {}, + ], +) +async def test_delete_version_async(request_type, transport: str = "grpc_asyncio"): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6035,7 +6073,7 @@ async def test_delete_version_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_version), "__call__") as call: @@ -6055,11 +6093,6 @@ async def test_delete_version_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_version_async_from_dict(): - await test_delete_version_async(request_type=dict) - - def test_delete_version_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6206,8 +6239,8 @@ async def test_delete_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - file.ListFilesRequest, - dict, + file.ListFilesRequest(), + {}, ], ) def test_list_files(request_type, transport: str = "grpc"): @@ -6218,7 +6251,7 @@ def test_list_files(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_files), "__call__") as call: @@ -6264,11 +6297,12 @@ def test_list_files_non_empty_request_with_auto_populated_field(): client.list_files(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == file.ListFilesRequest( + request_msg = file.ListFilesRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_files_use_cached_wrapped_rpc(): @@ -6347,9 +6381,14 @@ async def test_list_files_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_list_files_async( - transport: str = "grpc_asyncio", request_type=file.ListFilesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + file.ListFilesRequest(), + {}, + ], +) +async def test_list_files_async(request_type, transport: str = "grpc_asyncio"): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6357,7 +6396,7 @@ async def test_list_files_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_files), "__call__") as call: @@ -6380,11 +6419,6 @@ async def test_list_files_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_files_async_from_dict(): - await test_list_files_async(request_type=dict) - - def test_list_files_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6721,8 +6755,8 @@ async def test_list_files_async_pages(): @pytest.mark.parametrize( "request_type", [ - file.GetFileRequest, - dict, + file.GetFileRequest(), + {}, ], ) def test_get_file(request_type, transport: str = "grpc"): @@ -6733,7 +6767,7 @@ def test_get_file(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_file), "__call__") as call: @@ -6781,9 +6815,10 @@ def test_get_file_non_empty_request_with_auto_populated_field(): client.get_file(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == file.GetFileRequest( + request_msg = file.GetFileRequest( name="name_value", ) + assert args[0] == request_msg def test_get_file_use_cached_wrapped_rpc(): @@ -6862,9 +6897,14 @@ async def test_get_file_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn @pytest.mark.asyncio -async def test_get_file_async( - transport: str = "grpc_asyncio", request_type=file.GetFileRequest -): +@pytest.mark.parametrize( + "request_type", + [ + file.GetFileRequest(), + {}, + ], +) +async def test_get_file_async(request_type, transport: str = "grpc_asyncio"): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6872,7 +6912,7 @@ async def test_get_file_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_file), "__call__") as call: @@ -6899,11 +6939,6 @@ async def test_get_file_async( assert response.owner == "owner_value" -@pytest.mark.asyncio -async def test_get_file_async_from_dict(): - await test_get_file_async(request_type=dict) - - def test_get_file_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7046,8 +7081,8 @@ async def test_get_file_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - tag.ListTagsRequest, - dict, + tag.ListTagsRequest(), + {}, ], ) def test_list_tags(request_type, transport: str = "grpc"): @@ -7058,7 +7093,7 @@ def test_list_tags(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tags), "__call__") as call: @@ -7104,11 +7139,12 @@ def test_list_tags_non_empty_request_with_auto_populated_field(): client.list_tags(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tag.ListTagsRequest( + request_msg = tag.ListTagsRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_tags_use_cached_wrapped_rpc(): @@ -7187,9 +7223,14 @@ async def test_list_tags_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_list_tags_async( - transport: str = "grpc_asyncio", request_type=tag.ListTagsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tag.ListTagsRequest(), + {}, + ], +) +async def test_list_tags_async(request_type, transport: str = "grpc_asyncio"): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7197,7 +7238,7 @@ async def test_list_tags_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_tags), "__call__") as call: @@ -7220,11 +7261,6 @@ async def test_list_tags_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_tags_async_from_dict(): - await test_list_tags_async(request_type=dict) - - def test_list_tags_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7561,8 +7597,8 @@ async def test_list_tags_async_pages(): @pytest.mark.parametrize( "request_type", [ - tag.GetTagRequest, - dict, + tag.GetTagRequest(), + {}, ], ) def test_get_tag(request_type, transport: str = "grpc"): @@ -7573,7 +7609,7 @@ def test_get_tag(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tag), "__call__") as call: @@ -7619,9 +7655,10 @@ def test_get_tag_non_empty_request_with_auto_populated_field(): client.get_tag(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tag.GetTagRequest( + request_msg = tag.GetTagRequest( name="name_value", ) + assert args[0] == request_msg def test_get_tag_use_cached_wrapped_rpc(): @@ -7700,9 +7737,14 @@ async def test_get_tag_async_use_cached_wrapped_rpc(transport: str = "grpc_async @pytest.mark.asyncio -async def test_get_tag_async( - transport: str = "grpc_asyncio", request_type=tag.GetTagRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tag.GetTagRequest(), + {}, + ], +) +async def test_get_tag_async(request_type, transport: str = "grpc_asyncio"): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7710,7 +7752,7 @@ async def test_get_tag_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_tag), "__call__") as call: @@ -7735,11 +7777,6 @@ async def test_get_tag_async( assert response.version == "version_value" -@pytest.mark.asyncio -async def test_get_tag_async_from_dict(): - await test_get_tag_async(request_type=dict) - - def test_get_tag_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7882,8 +7919,8 @@ async def test_get_tag_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gda_tag.CreateTagRequest, - dict, + gda_tag.CreateTagRequest(), + {}, ], ) def test_create_tag(request_type, transport: str = "grpc"): @@ -7894,7 +7931,7 @@ def test_create_tag(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tag), "__call__") as call: @@ -7941,10 +7978,11 @@ def test_create_tag_non_empty_request_with_auto_populated_field(): client.create_tag(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gda_tag.CreateTagRequest( + request_msg = gda_tag.CreateTagRequest( parent="parent_value", tag_id="tag_id_value", ) + assert args[0] == request_msg def test_create_tag_use_cached_wrapped_rpc(): @@ -8023,9 +8061,14 @@ async def test_create_tag_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_create_tag_async( - transport: str = "grpc_asyncio", request_type=gda_tag.CreateTagRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gda_tag.CreateTagRequest(), + {}, + ], +) +async def test_create_tag_async(request_type, transport: str = "grpc_asyncio"): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8033,7 +8076,7 @@ async def test_create_tag_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_tag), "__call__") as call: @@ -8058,11 +8101,6 @@ async def test_create_tag_async( assert response.version == "version_value" -@pytest.mark.asyncio -async def test_create_tag_async_from_dict(): - await test_create_tag_async(request_type=dict) - - def test_create_tag_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8225,8 +8263,8 @@ async def test_create_tag_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gda_tag.UpdateTagRequest, - dict, + gda_tag.UpdateTagRequest(), + {}, ], ) def test_update_tag(request_type, transport: str = "grpc"): @@ -8237,7 +8275,7 @@ def test_update_tag(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tag), "__call__") as call: @@ -8281,7 +8319,8 @@ def test_update_tag_non_empty_request_with_auto_populated_field(): client.update_tag(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gda_tag.UpdateTagRequest() + request_msg = gda_tag.UpdateTagRequest() + assert args[0] == request_msg def test_update_tag_use_cached_wrapped_rpc(): @@ -8360,9 +8399,14 @@ async def test_update_tag_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_update_tag_async( - transport: str = "grpc_asyncio", request_type=gda_tag.UpdateTagRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gda_tag.UpdateTagRequest(), + {}, + ], +) +async def test_update_tag_async(request_type, transport: str = "grpc_asyncio"): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8370,7 +8414,7 @@ async def test_update_tag_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_tag), "__call__") as call: @@ -8395,11 +8439,6 @@ async def test_update_tag_async( assert response.version == "version_value" -@pytest.mark.asyncio -async def test_update_tag_async_from_dict(): - await test_update_tag_async(request_type=dict) - - def test_update_tag_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8552,8 +8591,8 @@ async def test_update_tag_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - tag.DeleteTagRequest, - dict, + tag.DeleteTagRequest(), + {}, ], ) def test_delete_tag(request_type, transport: str = "grpc"): @@ -8564,7 +8603,7 @@ def test_delete_tag(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tag), "__call__") as call: @@ -8605,9 +8644,10 @@ def test_delete_tag_non_empty_request_with_auto_populated_field(): client.delete_tag(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tag.DeleteTagRequest( + request_msg = tag.DeleteTagRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_tag_use_cached_wrapped_rpc(): @@ -8686,9 +8726,14 @@ async def test_delete_tag_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_delete_tag_async( - transport: str = "grpc_asyncio", request_type=tag.DeleteTagRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tag.DeleteTagRequest(), + {}, + ], +) +async def test_delete_tag_async(request_type, transport: str = "grpc_asyncio"): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8696,7 +8741,7 @@ async def test_delete_tag_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_tag), "__call__") as call: @@ -8714,11 +8759,6 @@ async def test_delete_tag_async( assert response is None -@pytest.mark.asyncio -async def test_delete_tag_async_from_dict(): - await test_delete_tag_async(request_type=dict) - - def test_delete_tag_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8861,8 +8901,8 @@ async def test_delete_tag_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.SetIamPolicyRequest, - dict, + iam_policy_pb2.SetIamPolicyRequest(), + {}, ], ) def test_set_iam_policy(request_type, transport: str = "grpc"): @@ -8873,7 +8913,7 @@ def test_set_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(type(client.transport.set_iam_policy), "__call__") as call: @@ -8919,9 +8959,10 @@ def test_set_iam_policy_non_empty_request_with_auto_populated_field(): client.set_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.SetIamPolicyRequest( + request_msg = iam_policy_pb2.SetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_set_iam_policy_use_cached_wrapped_rpc(): @@ -9002,9 +9043,14 @@ async def test_set_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.SetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.SetIamPolicyRequest(), + {}, + ], +) +async def test_set_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9012,7 +9058,7 @@ async def test_set_iam_policy_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.set_iam_policy), "__call__") as call: @@ -9037,11 +9083,6 @@ async def test_set_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_set_iam_policy_async_from_dict(): - await test_set_iam_policy_async(request_type=dict) - - def test_set_iam_policy_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9122,8 +9163,8 @@ def test_set_iam_policy_from_dict_foreign(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.GetIamPolicyRequest, - dict, + iam_policy_pb2.GetIamPolicyRequest(), + {}, ], ) def test_get_iam_policy(request_type, transport: str = "grpc"): @@ -9134,7 +9175,7 @@ def test_get_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(type(client.transport.get_iam_policy), "__call__") as call: @@ -9180,9 +9221,10 @@ def test_get_iam_policy_non_empty_request_with_auto_populated_field(): client.get_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.GetIamPolicyRequest( + request_msg = iam_policy_pb2.GetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_get_iam_policy_use_cached_wrapped_rpc(): @@ -9263,9 +9305,14 @@ async def test_get_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.GetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.GetIamPolicyRequest(), + {}, + ], +) +async def test_get_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9273,7 +9320,7 @@ async def test_get_iam_policy_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_iam_policy), "__call__") as call: @@ -9298,11 +9345,6 @@ async def test_get_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_get_iam_policy_async_from_dict(): - await test_get_iam_policy_async(request_type=dict) - - def test_get_iam_policy_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9382,8 +9424,8 @@ def test_get_iam_policy_from_dict_foreign(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.TestIamPermissionsRequest, - dict, + iam_policy_pb2.TestIamPermissionsRequest(), + {}, ], ) def test_test_iam_permissions(request_type, transport: str = "grpc"): @@ -9394,7 +9436,7 @@ def test_test_iam_permissions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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 +9484,10 @@ def test_test_iam_permissions_non_empty_request_with_auto_populated_field(): client.test_iam_permissions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.TestIamPermissionsRequest( + request_msg = iam_policy_pb2.TestIamPermissionsRequest( resource="resource_value", ) + assert args[0] == request_msg def test_test_iam_permissions_use_cached_wrapped_rpc(): @@ -9529,9 +9572,15 @@ async def test_test_iam_permissions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.TestIamPermissionsRequest(), + {}, + ], +) async def test_test_iam_permissions_async( - transport: str = "grpc_asyncio", - request_type=iam_policy_pb2.TestIamPermissionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), @@ -9540,7 +9589,7 @@ async def test_test_iam_permissions_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( @@ -9565,11 +9614,6 @@ async def test_test_iam_permissions_async( assert response.permissions == ["permissions_value"] -@pytest.mark.asyncio -async def test_test_iam_permissions_async_from_dict(): - await test_test_iam_permissions_async(request_type=dict) - - def test_test_iam_permissions_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9657,8 +9701,8 @@ def test_test_iam_permissions_from_dict_foreign(): @pytest.mark.parametrize( "request_type", [ - settings.GetProjectSettingsRequest, - dict, + settings.GetProjectSettingsRequest(), + {}, ], ) def test_get_project_settings(request_type, transport: str = "grpc"): @@ -9669,7 +9713,7 @@ def test_get_project_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( @@ -9722,9 +9766,10 @@ def test_get_project_settings_non_empty_request_with_auto_populated_field(): client.get_project_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == settings.GetProjectSettingsRequest( + request_msg = settings.GetProjectSettingsRequest( name="name_value", ) + assert args[0] == request_msg def test_get_project_settings_use_cached_wrapped_rpc(): @@ -9809,8 +9854,15 @@ async def test_get_project_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + settings.GetProjectSettingsRequest(), + {}, + ], +) async def test_get_project_settings_async( - transport: str = "grpc_asyncio", request_type=settings.GetProjectSettingsRequest + request_type, transport: str = "grpc_asyncio" ): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), @@ -9819,7 +9871,7 @@ async def test_get_project_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( @@ -9849,11 +9901,6 @@ async def test_get_project_settings_async( ) -@pytest.mark.asyncio -async def test_get_project_settings_async_from_dict(): - await test_get_project_settings_async(request_type=dict) - - def test_get_project_settings_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10008,8 +10055,8 @@ async def test_get_project_settings_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - settings.UpdateProjectSettingsRequest, - dict, + settings.UpdateProjectSettingsRequest(), + {}, ], ) def test_update_project_settings(request_type, transport: str = "grpc"): @@ -10020,7 +10067,7 @@ def test_update_project_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( @@ -10071,7 +10118,8 @@ def test_update_project_settings_non_empty_request_with_auto_populated_field(): client.update_project_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == settings.UpdateProjectSettingsRequest() + request_msg = settings.UpdateProjectSettingsRequest() + assert args[0] == request_msg def test_update_project_settings_use_cached_wrapped_rpc(): @@ -10157,8 +10205,15 @@ async def test_update_project_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + settings.UpdateProjectSettingsRequest(), + {}, + ], +) async def test_update_project_settings_async( - transport: str = "grpc_asyncio", request_type=settings.UpdateProjectSettingsRequest + request_type, transport: str = "grpc_asyncio" ): client = ArtifactRegistryAsyncClient( credentials=async_anonymous_credentials(), @@ -10167,7 +10222,7 @@ async def test_update_project_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( @@ -10197,11 +10252,6 @@ async def test_update_project_settings_async( ) -@pytest.mark.asyncio -async def test_update_project_settings_async_from_dict(): - await test_update_project_settings_async(request_type=dict) - - def test_update_project_settings_field_headers(): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13675,7 +13725,6 @@ def test_import_apt_artifacts_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apt_artifact.ImportAptArtifactsRequest() - assert args[0] == request_msg @@ -13698,7 +13747,6 @@ def test_import_yum_artifacts_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = yum_artifact.ImportYumArtifactsRequest() - assert args[0] == request_msg @@ -13721,7 +13769,6 @@ def test_list_repositories_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = repository.ListRepositoriesRequest() - assert args[0] == request_msg @@ -13742,7 +13789,6 @@ def test_get_repository_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = repository.GetRepositoryRequest() - assert args[0] == request_msg @@ -13765,7 +13811,6 @@ def test_create_repository_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gda_repository.CreateRepositoryRequest() - assert args[0] == request_msg @@ -13788,7 +13833,6 @@ def test_update_repository_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gda_repository.UpdateRepositoryRequest() - assert args[0] == request_msg @@ -13811,7 +13855,6 @@ def test_delete_repository_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = repository.DeleteRepositoryRequest() - assert args[0] == request_msg @@ -13832,7 +13875,6 @@ def test_list_packages_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = package.ListPackagesRequest() - assert args[0] == request_msg @@ -13853,7 +13895,6 @@ def test_get_package_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = package.GetPackageRequest() - assert args[0] == request_msg @@ -13874,7 +13915,6 @@ def test_delete_package_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = package.DeletePackageRequest() - assert args[0] == request_msg @@ -13895,7 +13935,6 @@ def test_list_versions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = version.ListVersionsRequest() - assert args[0] == request_msg @@ -13916,7 +13955,6 @@ def test_get_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = version.GetVersionRequest() - assert args[0] == request_msg @@ -13937,7 +13975,6 @@ def test_delete_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = version.DeleteVersionRequest() - assert args[0] == request_msg @@ -13958,7 +13995,6 @@ def test_list_files_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = file.ListFilesRequest() - assert args[0] == request_msg @@ -13979,7 +14015,6 @@ def test_get_file_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = file.GetFileRequest() - assert args[0] == request_msg @@ -14000,7 +14035,6 @@ def test_list_tags_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag.ListTagsRequest() - assert args[0] == request_msg @@ -14021,7 +14055,6 @@ def test_get_tag_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag.GetTagRequest() - assert args[0] == request_msg @@ -14042,7 +14075,6 @@ def test_create_tag_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gda_tag.CreateTagRequest() - assert args[0] == request_msg @@ -14063,7 +14095,6 @@ def test_update_tag_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gda_tag.UpdateTagRequest() - assert args[0] == request_msg @@ -14084,7 +14115,6 @@ def test_delete_tag_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag.DeleteTagRequest() - assert args[0] == request_msg @@ -14105,7 +14135,6 @@ def test_set_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -14126,7 +14155,6 @@ def test_get_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -14149,7 +14177,6 @@ def test_test_iam_permissions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -14172,7 +14199,6 @@ def test_get_project_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = settings.GetProjectSettingsRequest() - assert args[0] == request_msg @@ -14195,7 +14221,6 @@ def test_update_project_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = settings.UpdateProjectSettingsRequest() - assert args[0] == request_msg @@ -14236,7 +14261,6 @@ async def test_import_apt_artifacts_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apt_artifact.ImportAptArtifactsRequest() - assert args[0] == request_msg @@ -14263,7 +14287,6 @@ async def test_import_yum_artifacts_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = yum_artifact.ImportYumArtifactsRequest() - assert args[0] == request_msg @@ -14292,7 +14315,6 @@ async def test_list_repositories_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = repository.ListRepositoriesRequest() - assert args[0] == request_msg @@ -14322,7 +14344,6 @@ async def test_get_repository_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = repository.GetRepositoryRequest() - assert args[0] == request_msg @@ -14349,7 +14370,6 @@ async def test_create_repository_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gda_repository.CreateRepositoryRequest() - assert args[0] == request_msg @@ -14381,7 +14401,6 @@ async def test_update_repository_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gda_repository.UpdateRepositoryRequest() - assert args[0] == request_msg @@ -14408,7 +14427,6 @@ async def test_delete_repository_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = repository.DeleteRepositoryRequest() - assert args[0] == request_msg @@ -14435,7 +14453,6 @@ async def test_list_packages_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = package.ListPackagesRequest() - assert args[0] == request_msg @@ -14463,7 +14480,6 @@ async def test_get_package_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = package.GetPackageRequest() - assert args[0] == request_msg @@ -14488,7 +14504,6 @@ async def test_delete_package_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = package.DeletePackageRequest() - assert args[0] == request_msg @@ -14515,7 +14530,6 @@ async def test_list_versions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = version.ListVersionsRequest() - assert args[0] == request_msg @@ -14543,7 +14557,6 @@ async def test_get_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = version.GetVersionRequest() - assert args[0] == request_msg @@ -14568,7 +14581,6 @@ async def test_delete_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = version.DeleteVersionRequest() - assert args[0] == request_msg @@ -14595,7 +14607,6 @@ async def test_list_files_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = file.ListFilesRequest() - assert args[0] == request_msg @@ -14624,7 +14635,6 @@ async def test_get_file_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = file.GetFileRequest() - assert args[0] == request_msg @@ -14651,7 +14661,6 @@ async def test_list_tags_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag.ListTagsRequest() - assert args[0] == request_msg @@ -14679,7 +14688,6 @@ async def test_get_tag_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag.GetTagRequest() - assert args[0] == request_msg @@ -14707,7 +14715,6 @@ async def test_create_tag_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gda_tag.CreateTagRequest() - assert args[0] == request_msg @@ -14735,7 +14742,6 @@ async def test_update_tag_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gda_tag.UpdateTagRequest() - assert args[0] == request_msg @@ -14758,7 +14764,6 @@ async def test_delete_tag_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag.DeleteTagRequest() - assert args[0] == request_msg @@ -14786,7 +14791,6 @@ async def test_set_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -14814,7 +14818,6 @@ async def test_get_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -14843,7 +14846,6 @@ async def test_test_iam_permissions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -14873,7 +14875,6 @@ async def test_get_project_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = settings.GetProjectSettingsRequest() - assert args[0] == request_msg @@ -14903,7 +14904,6 @@ async def test_update_project_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = settings.UpdateProjectSettingsRequest() - assert args[0] == request_msg @@ -18694,7 +18694,6 @@ def test_import_apt_artifacts_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = apt_artifact.ImportAptArtifactsRequest() - assert args[0] == request_msg @@ -18716,7 +18715,6 @@ def test_import_yum_artifacts_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = yum_artifact.ImportYumArtifactsRequest() - assert args[0] == request_msg @@ -18738,7 +18736,6 @@ def test_list_repositories_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = repository.ListRepositoriesRequest() - assert args[0] == request_msg @@ -18758,7 +18755,6 @@ def test_get_repository_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = repository.GetRepositoryRequest() - assert args[0] == request_msg @@ -18780,7 +18776,6 @@ def test_create_repository_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gda_repository.CreateRepositoryRequest() - assert args[0] == request_msg @@ -18802,7 +18797,6 @@ def test_update_repository_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gda_repository.UpdateRepositoryRequest() - assert args[0] == request_msg @@ -18824,7 +18818,6 @@ def test_delete_repository_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = repository.DeleteRepositoryRequest() - assert args[0] == request_msg @@ -18844,7 +18837,6 @@ def test_list_packages_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = package.ListPackagesRequest() - assert args[0] == request_msg @@ -18864,7 +18856,6 @@ def test_get_package_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = package.GetPackageRequest() - assert args[0] == request_msg @@ -18884,7 +18875,6 @@ def test_delete_package_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = package.DeletePackageRequest() - assert args[0] == request_msg @@ -18904,7 +18894,6 @@ def test_list_versions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = version.ListVersionsRequest() - assert args[0] == request_msg @@ -18924,7 +18913,6 @@ def test_get_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = version.GetVersionRequest() - assert args[0] == request_msg @@ -18944,7 +18932,6 @@ def test_delete_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = version.DeleteVersionRequest() - assert args[0] == request_msg @@ -18964,7 +18951,6 @@ def test_list_files_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = file.ListFilesRequest() - assert args[0] == request_msg @@ -18984,7 +18970,6 @@ def test_get_file_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = file.GetFileRequest() - assert args[0] == request_msg @@ -19004,7 +18989,6 @@ def test_list_tags_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag.ListTagsRequest() - assert args[0] == request_msg @@ -19024,7 +19008,6 @@ def test_get_tag_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag.GetTagRequest() - assert args[0] == request_msg @@ -19044,7 +19027,6 @@ def test_create_tag_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gda_tag.CreateTagRequest() - assert args[0] == request_msg @@ -19064,7 +19046,6 @@ def test_update_tag_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gda_tag.UpdateTagRequest() - assert args[0] == request_msg @@ -19084,7 +19065,6 @@ def test_delete_tag_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag.DeleteTagRequest() - assert args[0] == request_msg @@ -19104,7 +19084,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -19124,7 +19103,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -19146,7 +19124,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -19168,7 +19145,6 @@ def test_get_project_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = settings.GetProjectSettingsRequest() - assert args[0] == request_msg @@ -19190,7 +19166,6 @@ def test_update_project_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = settings.UpdateProjectSettingsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-asset/noxfile.py b/packages/google-cloud-asset/noxfile.py index 03b63f92814b..b044cb25e9bd 100644 --- a/packages/google-cloud-asset/noxfile.py +++ b/packages/google-cloud-asset/noxfile.py @@ -47,7 +47,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 = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-asset/setup.py b/packages/google-cloud-asset/setup.py index ed8b047af20b..cec358ae0145 100644 --- a/packages/google-cloud-asset/setup.py +++ b/packages/google-cloud-asset/setup.py @@ -44,7 +44,7 @@ # See https://github.com/googleapis/google-cloud-python/issues/12364 "google-auth >= 2.14.1, <3.0.0,!=2.24.0,!=2.25.0", "google-cloud-org-policy >= 1.11.1, <2.0.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-asset/testing/constraints-3.10.txt b/packages/google-cloud-asset/testing/constraints-3.10.txt index b4cb6ff946ab..7d034c762509 100644 --- a/packages/google-cloud-asset/testing/constraints-3.10.txt +++ b/packages/google-cloud-asset/testing/constraints-3.10.txt @@ -7,7 +7,7 @@ google-api-core==2.17.1 google-cloud-org-policy==1.11.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/google-cloud-asset/tests/unit/gapic/asset_v1/test_asset_service.py b/packages/google-cloud-asset/tests/unit/gapic/asset_v1/test_asset_service.py index 2e516c73227d..bc2a7924209e 100644 --- a/packages/google-cloud-asset/tests/unit/gapic/asset_v1/test_asset_service.py +++ b/packages/google-cloud-asset/tests/unit/gapic/asset_v1/test_asset_service.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 @@ -117,6 +118,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" @@ -1297,8 +1313,8 @@ def test_asset_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - asset_service.ExportAssetsRequest, - dict, + asset_service.ExportAssetsRequest(), + {}, ], ) def test_export_assets(request_type, transport: str = "grpc"): @@ -1309,7 +1325,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(type(client.transport.export_assets), "__call__") as call: @@ -1350,9 +1366,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(): @@ -1443,9 +1460,14 @@ async def test_export_assets_async_use_cached_wrapped_rpc( @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, @@ -1453,7 +1475,7 @@ async def test_export_assets_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.export_assets), "__call__") as call: @@ -1473,11 +1495,6 @@ async def test_export_assets_async( 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(), @@ -1542,8 +1559,8 @@ 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"): @@ -1554,7 +1571,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(type(client.transport.list_assets), "__call__") as call: @@ -1599,10 +1616,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(): @@ -1683,9 +1701,14 @@ async def test_list_assets_async_use_cached_wrapped_rpc( @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, @@ -1693,7 +1716,7 @@ async def test_list_assets_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_assets), "__call__") as call: @@ -1716,11 +1739,6 @@ async def test_list_assets_async( 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(), @@ -2057,8 +2075,8 @@ async def test_list_assets_async_pages(): @pytest.mark.parametrize( "request_type", [ - asset_service.BatchGetAssetsHistoryRequest, - dict, + asset_service.BatchGetAssetsHistoryRequest(), + {}, ], ) def test_batch_get_assets_history(request_type, transport: str = "grpc"): @@ -2069,7 +2087,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( @@ -2114,9 +2132,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(): @@ -2202,9 +2221,15 @@ async def test_batch_get_assets_history_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + asset_service.BatchGetAssetsHistoryRequest(), + {}, + ], +) async def test_batch_get_assets_history_async( - transport: str = "grpc_asyncio", - request_type=asset_service.BatchGetAssetsHistoryRequest, + request_type, transport: str = "grpc_asyncio" ): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2213,7 +2238,7 @@ async def test_batch_get_assets_history_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( @@ -2235,11 +2260,6 @@ async def test_batch_get_assets_history_async( 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(), @@ -2308,8 +2328,8 @@ 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"): @@ -2320,7 +2340,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(type(client.transport.create_feed), "__call__") as call: @@ -2373,10 +2393,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(): @@ -2457,9 +2478,14 @@ async def test_create_feed_async_use_cached_wrapped_rpc( @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, @@ -2467,7 +2493,7 @@ async def test_create_feed_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_feed), "__call__") as call: @@ -2498,11 +2524,6 @@ async def test_create_feed_async( 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(), @@ -2645,8 +2666,8 @@ 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"): @@ -2657,7 +2678,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(type(client.transport.get_feed), "__call__") as call: @@ -2709,9 +2730,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(): @@ -2790,9 +2812,14 @@ async def test_get_feed_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn @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, @@ -2800,7 +2827,7 @@ async def test_get_feed_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_feed), "__call__") as call: @@ -2831,11 +2858,6 @@ async def test_get_feed_async( 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(), @@ -2978,8 +3000,8 @@ 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"): @@ -2990,7 +3012,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(type(client.transport.list_feeds), "__call__") as call: @@ -3031,9 +3053,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(): @@ -3112,9 +3135,14 @@ async def test_list_feeds_async_use_cached_wrapped_rpc(transport: str = "grpc_as @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, @@ -3122,7 +3150,7 @@ async def test_list_feeds_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_feeds), "__call__") as call: @@ -3142,11 +3170,6 @@ async def test_list_feeds_async( 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(), @@ -3293,8 +3316,8 @@ 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"): @@ -3305,7 +3328,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(type(client.transport.update_feed), "__call__") as call: @@ -3355,7 +3378,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] - assert args[0] == asset_service.UpdateFeedRequest() + request_msg = asset_service.UpdateFeedRequest() + assert args[0] == request_msg def test_update_feed_use_cached_wrapped_rpc(): @@ -3436,9 +3460,14 @@ async def test_update_feed_async_use_cached_wrapped_rpc( @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, @@ -3446,7 +3475,7 @@ async def test_update_feed_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_feed), "__call__") as call: @@ -3477,11 +3506,6 @@ async def test_update_feed_async( 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(), @@ -3624,8 +3648,8 @@ 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"): @@ -3636,7 +3660,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(type(client.transport.delete_feed), "__call__") as call: @@ -3677,9 +3701,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(): @@ -3760,9 +3785,14 @@ async def test_delete_feed_async_use_cached_wrapped_rpc( @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, @@ -3770,7 +3800,7 @@ async def test_delete_feed_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_feed), "__call__") as call: @@ -3788,11 +3818,6 @@ async def test_delete_feed_async( 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(), @@ -3935,8 +3960,8 @@ 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"): @@ -3947,7 +3972,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( @@ -3998,12 +4023,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(): @@ -4088,9 +4114,15 @@ async def test_search_all_resources_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + asset_service.SearchAllResourcesRequest(), + {}, + ], +) async def test_search_all_resources_async( - transport: str = "grpc_asyncio", - request_type=asset_service.SearchAllResourcesRequest, + request_type, transport: str = "grpc_asyncio" ): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4099,7 +4131,7 @@ async def test_search_all_resources_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( @@ -4124,11 +4156,6 @@ async def test_search_all_resources_async( 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(), @@ -4501,8 +4528,8 @@ async def test_search_all_resources_async_pages(): @pytest.mark.parametrize( "request_type", [ - asset_service.SearchAllIamPoliciesRequest, - dict, + asset_service.SearchAllIamPoliciesRequest(), + {}, ], ) def test_search_all_iam_policies(request_type, transport: str = "grpc"): @@ -4513,7 +4540,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( @@ -4564,12 +4591,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(): @@ -4655,9 +4683,15 @@ async def test_search_all_iam_policies_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + asset_service.SearchAllIamPoliciesRequest(), + {}, + ], +) async def test_search_all_iam_policies_async( - transport: str = "grpc_asyncio", - request_type=asset_service.SearchAllIamPoliciesRequest, + request_type, transport: str = "grpc_asyncio" ): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4666,7 +4700,7 @@ async def test_search_all_iam_policies_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( @@ -4691,11 +4725,6 @@ async def test_search_all_iam_policies_async( 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(), @@ -5058,8 +5087,8 @@ async def test_search_all_iam_policies_async_pages(): @pytest.mark.parametrize( "request_type", [ - asset_service.AnalyzeIamPolicyRequest, - dict, + asset_service.AnalyzeIamPolicyRequest(), + {}, ], ) def test_analyze_iam_policy(request_type, transport: str = "grpc"): @@ -5070,7 +5099,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( @@ -5118,9 +5147,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(): @@ -5205,9 +5235,14 @@ async def test_analyze_iam_policy_async_use_cached_wrapped_rpc( @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, @@ -5215,7 +5250,7 @@ async def test_analyze_iam_policy_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( @@ -5240,11 +5275,6 @@ async def test_analyze_iam_policy_async( 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(), @@ -5313,8 +5343,8 @@ 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"): @@ -5325,7 +5355,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( @@ -5370,9 +5400,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(): @@ -5468,9 +5499,15 @@ async def test_analyze_iam_policy_longrunning_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + asset_service.AnalyzeIamPolicyLongrunningRequest(), + {}, + ], +) async def test_analyze_iam_policy_longrunning_async( - transport: str = "grpc_asyncio", - request_type=asset_service.AnalyzeIamPolicyLongrunningRequest, + request_type, transport: str = "grpc_asyncio" ): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5479,7 +5516,7 @@ async def test_analyze_iam_policy_longrunning_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( @@ -5501,11 +5538,6 @@ async def test_analyze_iam_policy_longrunning_async( 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(), @@ -5574,8 +5606,8 @@ 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"): @@ -5586,7 +5618,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(type(client.transport.analyze_move), "__call__") as call: @@ -5628,10 +5660,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(): @@ -5712,9 +5745,14 @@ async def test_analyze_move_async_use_cached_wrapped_rpc( @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, @@ -5722,7 +5760,7 @@ async def test_analyze_move_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.analyze_move), "__call__") as call: @@ -5742,11 +5780,6 @@ async def test_analyze_move_async( 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(), @@ -5811,8 +5844,8 @@ 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"): @@ -5823,7 +5856,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(type(client.transport.query_assets), "__call__") as call: @@ -5872,12 +5905,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(): @@ -5958,9 +5992,14 @@ async def test_query_assets_async_use_cached_wrapped_rpc( @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, @@ -5968,7 +6007,7 @@ async def test_query_assets_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.query_assets), "__call__") as call: @@ -5993,11 +6032,6 @@ async def test_query_assets_async( 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(), @@ -6062,8 +6096,8 @@ 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"): @@ -6074,7 +6108,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( @@ -6129,10 +6163,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(): @@ -6217,9 +6252,14 @@ async def test_create_saved_query_async_use_cached_wrapped_rpc( @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, @@ -6227,7 +6267,7 @@ async def test_create_saved_query_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( @@ -6258,11 +6298,6 @@ async def test_create_saved_query_async( 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(), @@ -6437,8 +6472,8 @@ 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"): @@ -6449,7 +6484,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(type(client.transport.get_saved_query), "__call__") as call: @@ -6499,9 +6534,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(): @@ -6582,9 +6618,14 @@ async def test_get_saved_query_async_use_cached_wrapped_rpc( @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, @@ -6592,7 +6633,7 @@ async def test_get_saved_query_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_saved_query), "__call__") as call: @@ -6621,11 +6662,6 @@ async def test_get_saved_query_async( 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(), @@ -6772,8 +6808,8 @@ 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"): @@ -6784,7 +6820,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( @@ -6834,11 +6870,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(): @@ -6923,9 +6960,14 @@ async def test_list_saved_queries_async_use_cached_wrapped_rpc( @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, @@ -6933,7 +6975,7 @@ async def test_list_saved_queries_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( @@ -6958,11 +7000,6 @@ async def test_list_saved_queries_async( 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(), @@ -7315,8 +7352,8 @@ async def test_list_saved_queries_async_pages(): @pytest.mark.parametrize( "request_type", [ - asset_service.UpdateSavedQueryRequest, - dict, + asset_service.UpdateSavedQueryRequest(), + {}, ], ) def test_update_saved_query(request_type, transport: str = "grpc"): @@ -7327,7 +7364,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( @@ -7379,7 +7416,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] - 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(): @@ -7464,9 +7502,14 @@ async def test_update_saved_query_async_use_cached_wrapped_rpc( @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, @@ -7474,7 +7517,7 @@ async def test_update_saved_query_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( @@ -7505,11 +7548,6 @@ async def test_update_saved_query_async( 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(), @@ -7674,8 +7712,8 @@ 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"): @@ -7686,7 +7724,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( @@ -7731,9 +7769,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(): @@ -7818,9 +7857,14 @@ async def test_delete_saved_query_async_use_cached_wrapped_rpc( @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, @@ -7828,7 +7872,7 @@ async def test_delete_saved_query_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( @@ -7848,11 +7892,6 @@ async def test_delete_saved_query_async( 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(), @@ -8003,8 +8042,8 @@ 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"): @@ -8015,7 +8054,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( @@ -8060,9 +8099,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(): @@ -8148,9 +8188,15 @@ async def test_batch_get_effective_iam_policies_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + asset_service.BatchGetEffectiveIamPoliciesRequest(), + {}, + ], +) async def test_batch_get_effective_iam_policies_async( - transport: str = "grpc_asyncio", - request_type=asset_service.BatchGetEffectiveIamPoliciesRequest, + request_type, transport: str = "grpc_asyncio" ): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -8159,7 +8205,7 @@ async def test_batch_get_effective_iam_policies_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( @@ -8181,11 +8227,6 @@ async def test_batch_get_effective_iam_policies_async( 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(), @@ -8254,8 +8295,8 @@ 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"): @@ -8266,7 +8307,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( @@ -8317,12 +8358,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(): @@ -8407,9 +8449,15 @@ async def test_analyze_org_policies_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + asset_service.AnalyzeOrgPoliciesRequest(), + {}, + ], +) async def test_analyze_org_policies_async( - transport: str = "grpc_asyncio", - request_type=asset_service.AnalyzeOrgPoliciesRequest, + request_type, transport: str = "grpc_asyncio" ): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -8418,7 +8466,7 @@ async def test_analyze_org_policies_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( @@ -8443,11 +8491,6 @@ async def test_analyze_org_policies_async( 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(), @@ -8826,8 +8869,8 @@ async def test_analyze_org_policies_async_pages(): @pytest.mark.parametrize( "request_type", [ - asset_service.AnalyzeOrgPolicyGovernedContainersRequest, - dict, + asset_service.AnalyzeOrgPolicyGovernedContainersRequest(), + {}, ], ) def test_analyze_org_policy_governed_containers(request_type, transport: str = "grpc"): @@ -8838,7 +8881,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( @@ -8889,12 +8932,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(): @@ -8980,9 +9024,15 @@ async def test_analyze_org_policy_governed_containers_async_use_cached_wrapped_r @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + asset_service.AnalyzeOrgPolicyGovernedContainersRequest(), + {}, + ], +) async def test_analyze_org_policy_governed_containers_async( - transport: str = "grpc_asyncio", - request_type=asset_service.AnalyzeOrgPolicyGovernedContainersRequest, + request_type, transport: str = "grpc_asyncio" ): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -8991,7 +9041,7 @@ async def test_analyze_org_policy_governed_containers_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( @@ -9016,11 +9066,6 @@ async def test_analyze_org_policy_governed_containers_async( 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(), @@ -9409,8 +9454,8 @@ async def test_analyze_org_policy_governed_containers_async_pages(): @pytest.mark.parametrize( "request_type", [ - asset_service.AnalyzeOrgPolicyGovernedAssetsRequest, - dict, + asset_service.AnalyzeOrgPolicyGovernedAssetsRequest(), + {}, ], ) def test_analyze_org_policy_governed_assets(request_type, transport: str = "grpc"): @@ -9421,7 +9466,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( @@ -9472,12 +9517,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(): @@ -9563,9 +9609,15 @@ async def test_analyze_org_policy_governed_assets_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + asset_service.AnalyzeOrgPolicyGovernedAssetsRequest(), + {}, + ], +) async def test_analyze_org_policy_governed_assets_async( - transport: str = "grpc_asyncio", - request_type=asset_service.AnalyzeOrgPolicyGovernedAssetsRequest, + request_type, transport: str = "grpc_asyncio" ): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -9574,7 +9626,7 @@ async def test_analyze_org_policy_governed_assets_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( @@ -9599,11 +9651,6 @@ async def test_analyze_org_policy_governed_assets_async( 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(), @@ -14664,7 +14711,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 @@ -14685,7 +14731,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 @@ -14708,7 +14753,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 @@ -14729,7 +14773,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 @@ -14750,7 +14793,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 @@ -14771,7 +14813,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 @@ -14792,7 +14833,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 @@ -14813,7 +14853,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 @@ -14836,7 +14875,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 @@ -14859,7 +14897,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 @@ -14882,7 +14919,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 @@ -14905,7 +14941,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 @@ -14926,7 +14961,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 @@ -14947,7 +14981,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 @@ -14970,7 +15003,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 @@ -14991,7 +15023,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 @@ -15014,7 +15045,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 @@ -15037,7 +15067,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 @@ -15060,7 +15089,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 @@ -15083,7 +15111,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 @@ -15106,7 +15133,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 @@ -15129,7 +15155,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 @@ -15152,7 +15177,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 @@ -15191,7 +15215,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 @@ -15218,7 +15241,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 @@ -15245,7 +15267,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 @@ -15276,7 +15297,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 @@ -15307,7 +15327,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 @@ -15332,7 +15351,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 @@ -15363,7 +15381,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 @@ -15386,7 +15403,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 @@ -15415,7 +15431,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 @@ -15444,7 +15459,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 @@ -15473,7 +15487,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 @@ -15500,7 +15513,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 @@ -15525,7 +15537,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 @@ -15553,7 +15564,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 @@ -15585,7 +15595,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 @@ -15615,7 +15624,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 @@ -15644,7 +15652,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 @@ -15676,7 +15683,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 @@ -15701,7 +15707,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 @@ -15728,7 +15733,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 @@ -15757,7 +15761,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 @@ -15786,7 +15789,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 @@ -15815,7 +15817,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 @@ -19132,7 +19133,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 @@ -19152,7 +19152,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 @@ -19174,7 +19173,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 @@ -19194,7 +19192,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 @@ -19214,7 +19211,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 @@ -19234,7 +19230,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 @@ -19254,7 +19249,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 @@ -19274,7 +19268,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 @@ -19296,7 +19289,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 @@ -19318,7 +19310,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 @@ -19340,7 +19331,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 @@ -19362,7 +19352,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 @@ -19382,7 +19371,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 @@ -19402,7 +19390,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 @@ -19424,7 +19411,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 @@ -19444,7 +19430,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 @@ -19466,7 +19451,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 @@ -19488,7 +19472,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 @@ -19510,7 +19493,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 @@ -19532,7 +19514,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 @@ -19554,7 +19535,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 @@ -19576,7 +19556,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 @@ -19598,7 +19577,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/google-cloud-asset/tests/unit/gapic/asset_v1p1beta1/test_asset_service.py b/packages/google-cloud-asset/tests/unit/gapic/asset_v1p1beta1/test_asset_service.py index 0c9158568eee..66d15e9339dd 100644 --- a/packages/google-cloud-asset/tests/unit/gapic/asset_v1p1beta1/test_asset_service.py +++ b/packages/google-cloud-asset/tests/unit/gapic/asset_v1p1beta1/test_asset_service.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 @@ -108,6 +109,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" @@ -1288,8 +1304,8 @@ def test_asset_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - asset_service.SearchAllResourcesRequest, - dict, + asset_service.SearchAllResourcesRequest(), + {}, ], ) def test_search_all_resources(request_type, transport: str = "grpc"): @@ -1300,7 +1316,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( @@ -1351,12 +1367,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(): @@ -1441,9 +1458,15 @@ async def test_search_all_resources_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + asset_service.SearchAllResourcesRequest(), + {}, + ], +) async def test_search_all_resources_async( - transport: str = "grpc_asyncio", - request_type=asset_service.SearchAllResourcesRequest, + request_type, transport: str = "grpc_asyncio" ): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1452,7 +1475,7 @@ async def test_search_all_resources_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( @@ -1477,11 +1500,6 @@ async def test_search_all_resources_async( 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(), @@ -1854,8 +1872,8 @@ async def test_search_all_resources_async_pages(): @pytest.mark.parametrize( "request_type", [ - asset_service.SearchAllIamPoliciesRequest, - dict, + asset_service.SearchAllIamPoliciesRequest(), + {}, ], ) def test_search_all_iam_policies(request_type, transport: str = "grpc"): @@ -1866,7 +1884,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( @@ -1916,11 +1934,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] - assert args[0] == asset_service.SearchAllIamPoliciesRequest( + request_msg = asset_service.SearchAllIamPoliciesRequest( scope="scope_value", query="query_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_search_all_iam_policies_use_cached_wrapped_rpc(): @@ -2006,9 +2025,15 @@ async def test_search_all_iam_policies_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + asset_service.SearchAllIamPoliciesRequest(), + {}, + ], +) async def test_search_all_iam_policies_async( - transport: str = "grpc_asyncio", - request_type=asset_service.SearchAllIamPoliciesRequest, + request_type, transport: str = "grpc_asyncio" ): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2017,7 +2042,7 @@ async def test_search_all_iam_policies_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( @@ -2042,11 +2067,6 @@ async def test_search_all_iam_policies_async( 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(), @@ -3064,7 +3084,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 @@ -3087,7 +3106,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 @@ -3130,7 +3148,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 @@ -3159,7 +3176,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 @@ -3467,7 +3483,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 @@ -3489,7 +3504,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 diff --git a/packages/google-cloud-asset/tests/unit/gapic/asset_v1p2beta1/test_asset_service.py b/packages/google-cloud-asset/tests/unit/gapic/asset_v1p2beta1/test_asset_service.py index 2d5176fb8e92..aa6a5fd5fa10 100644 --- a/packages/google-cloud-asset/tests/unit/gapic/asset_v1p2beta1/test_asset_service.py +++ b/packages/google-cloud-asset/tests/unit/gapic/asset_v1p2beta1/test_asset_service.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 @@ -108,6 +109,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" @@ -1288,8 +1304,8 @@ def test_asset_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - asset_service.CreateFeedRequest, - dict, + asset_service.CreateFeedRequest(), + {}, ], ) def test_create_feed(request_type, transport: str = "grpc"): @@ -1300,7 +1316,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(type(client.transport.create_feed), "__call__") as call: @@ -1351,10 +1367,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(): @@ -1435,9 +1452,14 @@ async def test_create_feed_async_use_cached_wrapped_rpc( @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, @@ -1445,7 +1467,7 @@ async def test_create_feed_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_feed), "__call__") as call: @@ -1474,11 +1496,6 @@ async def test_create_feed_async( assert response.content_type == asset_service.ContentType.RESOURCE -@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(), @@ -1621,8 +1638,8 @@ 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"): @@ -1633,7 +1650,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(type(client.transport.get_feed), "__call__") as call: @@ -1683,9 +1700,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(): @@ -1764,9 +1782,14 @@ async def test_get_feed_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn @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, @@ -1774,7 +1797,7 @@ async def test_get_feed_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_feed), "__call__") as call: @@ -1803,11 +1826,6 @@ async def test_get_feed_async( assert response.content_type == asset_service.ContentType.RESOURCE -@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(), @@ -1950,8 +1968,8 @@ 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"): @@ -1962,7 +1980,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(type(client.transport.list_feeds), "__call__") as call: @@ -2003,9 +2021,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(): @@ -2084,9 +2103,14 @@ async def test_list_feeds_async_use_cached_wrapped_rpc(transport: str = "grpc_as @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, @@ -2094,7 +2118,7 @@ async def test_list_feeds_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_feeds), "__call__") as call: @@ -2114,11 +2138,6 @@ async def test_list_feeds_async( 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(), @@ -2265,8 +2284,8 @@ 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"): @@ -2277,7 +2296,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(type(client.transport.update_feed), "__call__") as call: @@ -2325,7 +2344,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] - assert args[0] == asset_service.UpdateFeedRequest() + request_msg = asset_service.UpdateFeedRequest() + assert args[0] == request_msg def test_update_feed_use_cached_wrapped_rpc(): @@ -2406,9 +2426,14 @@ async def test_update_feed_async_use_cached_wrapped_rpc( @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, @@ -2416,7 +2441,7 @@ async def test_update_feed_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_feed), "__call__") as call: @@ -2445,11 +2470,6 @@ async def test_update_feed_async( assert response.content_type == asset_service.ContentType.RESOURCE -@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(), @@ -2592,8 +2612,8 @@ 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"): @@ -2604,7 +2624,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(type(client.transport.delete_feed), "__call__") as call: @@ -2645,9 +2665,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(): @@ -2728,9 +2749,14 @@ async def test_delete_feed_async_use_cached_wrapped_rpc( @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, @@ -2738,7 +2764,7 @@ async def test_delete_feed_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_feed), "__call__") as call: @@ -2756,11 +2782,6 @@ async def test_delete_feed_async( 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(), @@ -3906,7 +3927,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 @@ -3927,7 +3947,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 @@ -3948,7 +3967,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 @@ -3969,7 +3987,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 @@ -3990,7 +4007,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 @@ -4034,7 +4050,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 @@ -4064,7 +4079,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 @@ -4089,7 +4103,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 @@ -4119,7 +4132,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 @@ -4142,7 +4154,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 @@ -4872,7 +4883,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 @@ -4892,7 +4902,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 @@ -4912,7 +4921,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 @@ -4932,7 +4940,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 @@ -4952,7 +4959,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 diff --git a/packages/google-cloud-asset/tests/unit/gapic/asset_v1p5beta1/test_asset_service.py b/packages/google-cloud-asset/tests/unit/gapic/asset_v1p5beta1/test_asset_service.py index c7ade516bbc5..c6784e98558a 100644 --- a/packages/google-cloud-asset/tests/unit/gapic/asset_v1p5beta1/test_asset_service.py +++ b/packages/google-cloud-asset/tests/unit/gapic/asset_v1p5beta1/test_asset_service.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 @@ -109,6 +110,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" @@ -1289,8 +1305,8 @@ def test_asset_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - asset_service.ListAssetsRequest, - dict, + asset_service.ListAssetsRequest(), + {}, ], ) def test_list_assets(request_type, transport: str = "grpc"): @@ -1301,7 +1317,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(type(client.transport.list_assets), "__call__") as call: @@ -1346,10 +1362,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(): @@ -1430,9 +1447,14 @@ async def test_list_assets_async_use_cached_wrapped_rpc( @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, @@ -1440,7 +1462,7 @@ async def test_list_assets_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_assets), "__call__") as call: @@ -1463,11 +1485,6 @@ async def test_list_assets_async( 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(), @@ -2180,7 +2197,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 @@ -2221,7 +2237,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 @@ -2385,7 +2400,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 diff --git a/packages/google-cloud-assured-workloads/noxfile.py b/packages/google-cloud-assured-workloads/noxfile.py index 9b0662c7ff88..a643c7d6ccd9 100644 --- a/packages/google-cloud-assured-workloads/noxfile.py +++ b/packages/google-cloud-assured-workloads/noxfile.py @@ -47,7 +47,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-assured-workloads" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-assured-workloads/setup.py b/packages/google-cloud-assured-workloads/setup.py index 9a18ee7fa52f..f5ee5362e2de 100644 --- a/packages/google-cloud-assured-workloads/setup.py +++ b/packages/google-cloud-assured-workloads/setup.py @@ -45,7 +45,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/google-cloud-assured-workloads/testing/constraints-3.10.txt b/packages/google-cloud-assured-workloads/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-assured-workloads/testing/constraints-3.10.txt +++ b/packages/google-cloud-assured-workloads/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-assured-workloads/tests/unit/gapic/assuredworkloads_v1/test_assured_workloads_service.py b/packages/google-cloud-assured-workloads/tests/unit/gapic/assuredworkloads_v1/test_assured_workloads_service.py index ecadca5b1226..e50809bda64e 100644 --- a/packages/google-cloud-assured-workloads/tests/unit/gapic/assuredworkloads_v1/test_assured_workloads_service.py +++ b/packages/google-cloud-assured-workloads/tests/unit/gapic/assuredworkloads_v1/test_assured_workloads_service.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 @@ -115,6 +116,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" @@ -1384,8 +1400,8 @@ def test_assured_workloads_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - assuredworkloads.CreateWorkloadRequest, - dict, + assuredworkloads.CreateWorkloadRequest(), + {}, ], ) def test_create_workload(request_type, transport: str = "grpc"): @@ -1396,7 +1412,7 @@ def test_create_workload(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_workload), "__call__") as call: @@ -1438,10 +1454,11 @@ def test_create_workload_non_empty_request_with_auto_populated_field(): client.create_workload(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == assuredworkloads.CreateWorkloadRequest( + request_msg = assuredworkloads.CreateWorkloadRequest( parent="parent_value", external_id="external_id_value", ) + assert args[0] == request_msg def test_create_workload_use_cached_wrapped_rpc(): @@ -1532,9 +1549,14 @@ async def test_create_workload_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_workload_async( - transport: str = "grpc_asyncio", request_type=assuredworkloads.CreateWorkloadRequest -): +@pytest.mark.parametrize( + "request_type", + [ + assuredworkloads.CreateWorkloadRequest(), + {}, + ], +) +async def test_create_workload_async(request_type, transport: str = "grpc_asyncio"): client = AssuredWorkloadsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1542,7 +1564,7 @@ async def test_create_workload_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_workload), "__call__") as call: @@ -1562,11 +1584,6 @@ async def test_create_workload_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_workload_async_from_dict(): - await test_create_workload_async(request_type=dict) - - def test_create_workload_field_headers(): client = AssuredWorkloadsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1723,8 +1740,8 @@ async def test_create_workload_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - assuredworkloads.UpdateWorkloadRequest, - dict, + assuredworkloads.UpdateWorkloadRequest(), + {}, ], ) def test_update_workload(request_type, transport: str = "grpc"): @@ -1735,7 +1752,7 @@ def test_update_workload(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_workload), "__call__") as call: @@ -1802,7 +1819,8 @@ def test_update_workload_non_empty_request_with_auto_populated_field(): client.update_workload(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == assuredworkloads.UpdateWorkloadRequest() + request_msg = assuredworkloads.UpdateWorkloadRequest() + assert args[0] == request_msg def test_update_workload_use_cached_wrapped_rpc(): @@ -1883,9 +1901,14 @@ async def test_update_workload_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_workload_async( - transport: str = "grpc_asyncio", request_type=assuredworkloads.UpdateWorkloadRequest -): +@pytest.mark.parametrize( + "request_type", + [ + assuredworkloads.UpdateWorkloadRequest(), + {}, + ], +) +async def test_update_workload_async(request_type, transport: str = "grpc_asyncio"): client = AssuredWorkloadsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1893,7 +1916,7 @@ async def test_update_workload_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_workload), "__call__") as call: @@ -1941,11 +1964,6 @@ async def test_update_workload_async( assert response.partner == assuredworkloads.Workload.Partner.LOCAL_CONTROLS_BY_S3NS -@pytest.mark.asyncio -async def test_update_workload_async_from_dict(): - await test_update_workload_async(request_type=dict) - - def test_update_workload_field_headers(): client = AssuredWorkloadsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2102,8 +2120,8 @@ async def test_update_workload_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - assuredworkloads.RestrictAllowedResourcesRequest, - dict, + assuredworkloads.RestrictAllowedResourcesRequest(), + {}, ], ) def test_restrict_allowed_resources(request_type, transport: str = "grpc"): @@ -2114,7 +2132,7 @@ def test_restrict_allowed_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( @@ -2159,9 +2177,10 @@ def test_restrict_allowed_resources_non_empty_request_with_auto_populated_field( client.restrict_allowed_resources(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == assuredworkloads.RestrictAllowedResourcesRequest( + request_msg = assuredworkloads.RestrictAllowedResourcesRequest( name="name_value", ) + assert args[0] == request_msg def test_restrict_allowed_resources_use_cached_wrapped_rpc(): @@ -2247,9 +2266,15 @@ async def test_restrict_allowed_resources_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + assuredworkloads.RestrictAllowedResourcesRequest(), + {}, + ], +) async def test_restrict_allowed_resources_async( - transport: str = "grpc_asyncio", - request_type=assuredworkloads.RestrictAllowedResourcesRequest, + request_type, transport: str = "grpc_asyncio" ): client = AssuredWorkloadsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2258,7 +2283,7 @@ async def test_restrict_allowed_resources_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( @@ -2280,11 +2305,6 @@ async def test_restrict_allowed_resources_async( assert isinstance(response, assuredworkloads.RestrictAllowedResourcesResponse) -@pytest.mark.asyncio -async def test_restrict_allowed_resources_async_from_dict(): - await test_restrict_allowed_resources_async(request_type=dict) - - def test_restrict_allowed_resources_field_headers(): client = AssuredWorkloadsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2353,8 +2373,8 @@ async def test_restrict_allowed_resources_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - assuredworkloads.DeleteWorkloadRequest, - dict, + assuredworkloads.DeleteWorkloadRequest(), + {}, ], ) def test_delete_workload(request_type, transport: str = "grpc"): @@ -2365,7 +2385,7 @@ def test_delete_workload(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_workload), "__call__") as call: @@ -2407,10 +2427,11 @@ def test_delete_workload_non_empty_request_with_auto_populated_field(): client.delete_workload(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == assuredworkloads.DeleteWorkloadRequest( + request_msg = assuredworkloads.DeleteWorkloadRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_workload_use_cached_wrapped_rpc(): @@ -2491,9 +2512,14 @@ async def test_delete_workload_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_workload_async( - transport: str = "grpc_asyncio", request_type=assuredworkloads.DeleteWorkloadRequest -): +@pytest.mark.parametrize( + "request_type", + [ + assuredworkloads.DeleteWorkloadRequest(), + {}, + ], +) +async def test_delete_workload_async(request_type, transport: str = "grpc_asyncio"): client = AssuredWorkloadsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2501,7 +2527,7 @@ async def test_delete_workload_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_workload), "__call__") as call: @@ -2519,11 +2545,6 @@ async def test_delete_workload_async( assert response is None -@pytest.mark.asyncio -async def test_delete_workload_async_from_dict(): - await test_delete_workload_async(request_type=dict) - - def test_delete_workload_field_headers(): client = AssuredWorkloadsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2666,8 +2687,8 @@ async def test_delete_workload_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - assuredworkloads.GetWorkloadRequest, - dict, + assuredworkloads.GetWorkloadRequest(), + {}, ], ) def test_get_workload(request_type, transport: str = "grpc"): @@ -2678,7 +2699,7 @@ def test_get_workload(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_workload), "__call__") as call: @@ -2747,9 +2768,10 @@ def test_get_workload_non_empty_request_with_auto_populated_field(): client.get_workload(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == assuredworkloads.GetWorkloadRequest( + request_msg = assuredworkloads.GetWorkloadRequest( name="name_value", ) + assert args[0] == request_msg def test_get_workload_use_cached_wrapped_rpc(): @@ -2830,9 +2852,14 @@ async def test_get_workload_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_workload_async( - transport: str = "grpc_asyncio", request_type=assuredworkloads.GetWorkloadRequest -): +@pytest.mark.parametrize( + "request_type", + [ + assuredworkloads.GetWorkloadRequest(), + {}, + ], +) +async def test_get_workload_async(request_type, transport: str = "grpc_asyncio"): client = AssuredWorkloadsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2840,7 +2867,7 @@ async def test_get_workload_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_workload), "__call__") as call: @@ -2888,11 +2915,6 @@ async def test_get_workload_async( assert response.partner == assuredworkloads.Workload.Partner.LOCAL_CONTROLS_BY_S3NS -@pytest.mark.asyncio -async def test_get_workload_async_from_dict(): - await test_get_workload_async(request_type=dict) - - def test_get_workload_field_headers(): client = AssuredWorkloadsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3039,8 +3061,8 @@ async def test_get_workload_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - assuredworkloads.ListWorkloadsRequest, - dict, + assuredworkloads.ListWorkloadsRequest(), + {}, ], ) def test_list_workloads(request_type, transport: str = "grpc"): @@ -3051,7 +3073,7 @@ def test_list_workloads(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_workloads), "__call__") as call: @@ -3097,11 +3119,12 @@ def test_list_workloads_non_empty_request_with_auto_populated_field(): client.list_workloads(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == assuredworkloads.ListWorkloadsRequest( + request_msg = assuredworkloads.ListWorkloadsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_workloads_use_cached_wrapped_rpc(): @@ -3182,9 +3205,14 @@ async def test_list_workloads_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_workloads_async( - transport: str = "grpc_asyncio", request_type=assuredworkloads.ListWorkloadsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + assuredworkloads.ListWorkloadsRequest(), + {}, + ], +) +async def test_list_workloads_async(request_type, transport: str = "grpc_asyncio"): client = AssuredWorkloadsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3192,7 +3220,7 @@ async def test_list_workloads_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_workloads), "__call__") as call: @@ -3215,11 +3243,6 @@ async def test_list_workloads_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_workloads_async_from_dict(): - await test_list_workloads_async(request_type=dict) - - def test_list_workloads_field_headers(): client = AssuredWorkloadsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3556,8 +3579,8 @@ async def test_list_workloads_async_pages(): @pytest.mark.parametrize( "request_type", [ - assuredworkloads.ListViolationsRequest, - dict, + assuredworkloads.ListViolationsRequest(), + {}, ], ) def test_list_violations(request_type, transport: str = "grpc"): @@ -3568,7 +3591,7 @@ def test_list_violations(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_violations), "__call__") as call: @@ -3614,11 +3637,12 @@ def test_list_violations_non_empty_request_with_auto_populated_field(): client.list_violations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == assuredworkloads.ListViolationsRequest( + request_msg = assuredworkloads.ListViolationsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_violations_use_cached_wrapped_rpc(): @@ -3699,9 +3723,14 @@ async def test_list_violations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_violations_async( - transport: str = "grpc_asyncio", request_type=assuredworkloads.ListViolationsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + assuredworkloads.ListViolationsRequest(), + {}, + ], +) +async def test_list_violations_async(request_type, transport: str = "grpc_asyncio"): client = AssuredWorkloadsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3709,7 +3738,7 @@ async def test_list_violations_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_violations), "__call__") as call: @@ -3732,11 +3761,6 @@ async def test_list_violations_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_violations_async_from_dict(): - await test_list_violations_async(request_type=dict) - - def test_list_violations_flattened(): client = AssuredWorkloadsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4009,8 +4033,8 @@ async def test_list_violations_async_pages(): @pytest.mark.parametrize( "request_type", [ - assuredworkloads.GetViolationRequest, - dict, + assuredworkloads.GetViolationRequest(), + {}, ], ) def test_get_violation(request_type, transport: str = "grpc"): @@ -4021,7 +4045,7 @@ def test_get_violation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_violation), "__call__") as call: @@ -4081,9 +4105,10 @@ def test_get_violation_non_empty_request_with_auto_populated_field(): client.get_violation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == assuredworkloads.GetViolationRequest( + request_msg = assuredworkloads.GetViolationRequest( name="name_value", ) + assert args[0] == request_msg def test_get_violation_use_cached_wrapped_rpc(): @@ -4164,9 +4189,14 @@ async def test_get_violation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_violation_async( - transport: str = "grpc_asyncio", request_type=assuredworkloads.GetViolationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + assuredworkloads.GetViolationRequest(), + {}, + ], +) +async def test_get_violation_async(request_type, transport: str = "grpc_asyncio"): client = AssuredWorkloadsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4174,7 +4204,7 @@ async def test_get_violation_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_violation), "__call__") as call: @@ -4213,11 +4243,6 @@ async def test_get_violation_async( assert response.exception_audit_log_link == "exception_audit_log_link_value" -@pytest.mark.asyncio -async def test_get_violation_async_from_dict(): - await test_get_violation_async(request_type=dict) - - def test_get_violation_flattened(): client = AssuredWorkloadsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4303,8 +4328,8 @@ async def test_get_violation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - assuredworkloads.AcknowledgeViolationRequest, - dict, + assuredworkloads.AcknowledgeViolationRequest(), + {}, ], ) def test_acknowledge_violation(request_type, transport: str = "grpc"): @@ -4315,7 +4340,7 @@ def test_acknowledge_violation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4362,11 +4387,12 @@ def test_acknowledge_violation_non_empty_request_with_auto_populated_field(): client.acknowledge_violation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == assuredworkloads.AcknowledgeViolationRequest( + request_msg = assuredworkloads.AcknowledgeViolationRequest( name="name_value", comment="comment_value", non_compliant_org_policy="non_compliant_org_policy_value", ) + assert args[0] == request_msg def test_acknowledge_violation_use_cached_wrapped_rpc(): @@ -4452,9 +4478,15 @@ async def test_acknowledge_violation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + assuredworkloads.AcknowledgeViolationRequest(), + {}, + ], +) async def test_acknowledge_violation_async( - transport: str = "grpc_asyncio", - request_type=assuredworkloads.AcknowledgeViolationRequest, + request_type, transport: str = "grpc_asyncio" ): client = AssuredWorkloadsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4463,7 +4495,7 @@ async def test_acknowledge_violation_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( @@ -4485,11 +4517,6 @@ async def test_acknowledge_violation_async( assert isinstance(response, assuredworkloads.AcknowledgeViolationResponse) -@pytest.mark.asyncio -async def test_acknowledge_violation_async_from_dict(): - await test_acknowledge_violation_async(request_type=dict) - - def test_create_workload_rest_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, # instead of constructing them on each call @@ -5813,7 +5840,6 @@ def test_create_workload_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = assuredworkloads.CreateWorkloadRequest() - assert args[0] == request_msg @@ -5834,7 +5860,6 @@ def test_update_workload_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = assuredworkloads.UpdateWorkloadRequest() - assert args[0] == request_msg @@ -5857,7 +5882,6 @@ def test_restrict_allowed_resources_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = assuredworkloads.RestrictAllowedResourcesRequest() - assert args[0] == request_msg @@ -5878,7 +5902,6 @@ def test_delete_workload_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = assuredworkloads.DeleteWorkloadRequest() - assert args[0] == request_msg @@ -5899,7 +5922,6 @@ def test_get_workload_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = assuredworkloads.GetWorkloadRequest() - assert args[0] == request_msg @@ -5920,7 +5942,6 @@ def test_list_workloads_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = assuredworkloads.ListWorkloadsRequest() - assert args[0] == request_msg @@ -5941,7 +5962,6 @@ def test_list_violations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = assuredworkloads.ListViolationsRequest() - assert args[0] == request_msg @@ -5962,7 +5982,6 @@ def test_get_violation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = assuredworkloads.GetViolationRequest() - assert args[0] == request_msg @@ -5985,7 +6004,6 @@ def test_acknowledge_violation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = assuredworkloads.AcknowledgeViolationRequest() - assert args[0] == request_msg @@ -6024,7 +6042,6 @@ async def test_create_workload_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = assuredworkloads.CreateWorkloadRequest() - assert args[0] == request_msg @@ -6062,7 +6079,6 @@ async def test_update_workload_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = assuredworkloads.UpdateWorkloadRequest() - assert args[0] == request_msg @@ -6089,7 +6105,6 @@ async def test_restrict_allowed_resources_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = assuredworkloads.RestrictAllowedResourcesRequest() - assert args[0] == request_msg @@ -6112,7 +6127,6 @@ async def test_delete_workload_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = assuredworkloads.DeleteWorkloadRequest() - assert args[0] == request_msg @@ -6150,7 +6164,6 @@ async def test_get_workload_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = assuredworkloads.GetWorkloadRequest() - assert args[0] == request_msg @@ -6177,7 +6190,6 @@ async def test_list_workloads_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = assuredworkloads.ListWorkloadsRequest() - assert args[0] == request_msg @@ -6204,7 +6216,6 @@ async def test_list_violations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = assuredworkloads.ListViolationsRequest() - assert args[0] == request_msg @@ -6239,7 +6250,6 @@ async def test_get_violation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = assuredworkloads.GetViolationRequest() - assert args[0] == request_msg @@ -6266,7 +6276,6 @@ async def test_acknowledge_violation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = assuredworkloads.AcknowledgeViolationRequest() - assert args[0] == request_msg @@ -7487,7 +7496,6 @@ def test_create_workload_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = assuredworkloads.CreateWorkloadRequest() - assert args[0] == request_msg @@ -7507,7 +7515,6 @@ def test_update_workload_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = assuredworkloads.UpdateWorkloadRequest() - assert args[0] == request_msg @@ -7529,7 +7536,6 @@ def test_restrict_allowed_resources_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = assuredworkloads.RestrictAllowedResourcesRequest() - assert args[0] == request_msg @@ -7549,7 +7555,6 @@ def test_delete_workload_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = assuredworkloads.DeleteWorkloadRequest() - assert args[0] == request_msg @@ -7569,7 +7574,6 @@ def test_get_workload_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = assuredworkloads.GetWorkloadRequest() - assert args[0] == request_msg @@ -7589,7 +7593,6 @@ def test_list_workloads_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = assuredworkloads.ListWorkloadsRequest() - assert args[0] == request_msg @@ -7609,7 +7612,6 @@ def test_list_violations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = assuredworkloads.ListViolationsRequest() - assert args[0] == request_msg @@ -7629,7 +7631,6 @@ def test_get_violation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = assuredworkloads.GetViolationRequest() - assert args[0] == request_msg @@ -7651,7 +7652,6 @@ def test_acknowledge_violation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = assuredworkloads.AcknowledgeViolationRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-assured-workloads/tests/unit/gapic/assuredworkloads_v1beta1/test_assured_workloads_service.py b/packages/google-cloud-assured-workloads/tests/unit/gapic/assuredworkloads_v1beta1/test_assured_workloads_service.py index 03c650c68eaa..45e4e5f269bb 100644 --- a/packages/google-cloud-assured-workloads/tests/unit/gapic/assuredworkloads_v1beta1/test_assured_workloads_service.py +++ b/packages/google-cloud-assured-workloads/tests/unit/gapic/assuredworkloads_v1beta1/test_assured_workloads_service.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 @@ -115,6 +116,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" @@ -1384,8 +1400,8 @@ def test_assured_workloads_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - assuredworkloads.CreateWorkloadRequest, - dict, + assuredworkloads.CreateWorkloadRequest(), + {}, ], ) def test_create_workload(request_type, transport: str = "grpc"): @@ -1396,7 +1412,7 @@ def test_create_workload(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_workload), "__call__") as call: @@ -1438,10 +1454,11 @@ def test_create_workload_non_empty_request_with_auto_populated_field(): client.create_workload(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == assuredworkloads.CreateWorkloadRequest( + request_msg = assuredworkloads.CreateWorkloadRequest( parent="parent_value", external_id="external_id_value", ) + assert args[0] == request_msg def test_create_workload_use_cached_wrapped_rpc(): @@ -1532,9 +1549,14 @@ async def test_create_workload_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_workload_async( - transport: str = "grpc_asyncio", request_type=assuredworkloads.CreateWorkloadRequest -): +@pytest.mark.parametrize( + "request_type", + [ + assuredworkloads.CreateWorkloadRequest(), + {}, + ], +) +async def test_create_workload_async(request_type, transport: str = "grpc_asyncio"): client = AssuredWorkloadsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1542,7 +1564,7 @@ async def test_create_workload_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_workload), "__call__") as call: @@ -1562,11 +1584,6 @@ async def test_create_workload_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_workload_async_from_dict(): - await test_create_workload_async(request_type=dict) - - def test_create_workload_field_headers(): client = AssuredWorkloadsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1723,8 +1740,8 @@ async def test_create_workload_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - assuredworkloads.UpdateWorkloadRequest, - dict, + assuredworkloads.UpdateWorkloadRequest(), + {}, ], ) def test_update_workload(request_type, transport: str = "grpc"): @@ -1735,7 +1752,7 @@ def test_update_workload(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_workload), "__call__") as call: @@ -1800,7 +1817,8 @@ def test_update_workload_non_empty_request_with_auto_populated_field(): client.update_workload(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == assuredworkloads.UpdateWorkloadRequest() + request_msg = assuredworkloads.UpdateWorkloadRequest() + assert args[0] == request_msg def test_update_workload_use_cached_wrapped_rpc(): @@ -1881,9 +1899,14 @@ async def test_update_workload_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_workload_async( - transport: str = "grpc_asyncio", request_type=assuredworkloads.UpdateWorkloadRequest -): +@pytest.mark.parametrize( + "request_type", + [ + assuredworkloads.UpdateWorkloadRequest(), + {}, + ], +) +async def test_update_workload_async(request_type, transport: str = "grpc_asyncio"): client = AssuredWorkloadsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1891,7 +1914,7 @@ async def test_update_workload_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_workload), "__call__") as call: @@ -1937,11 +1960,6 @@ async def test_update_workload_async( ] -@pytest.mark.asyncio -async def test_update_workload_async_from_dict(): - await test_update_workload_async(request_type=dict) - - def test_update_workload_flattened(): client = AssuredWorkloadsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2037,8 +2055,8 @@ async def test_update_workload_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - assuredworkloads.RestrictAllowedResourcesRequest, - dict, + assuredworkloads.RestrictAllowedResourcesRequest(), + {}, ], ) def test_restrict_allowed_resources(request_type, transport: str = "grpc"): @@ -2049,7 +2067,7 @@ def test_restrict_allowed_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( @@ -2094,9 +2112,10 @@ def test_restrict_allowed_resources_non_empty_request_with_auto_populated_field( client.restrict_allowed_resources(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == assuredworkloads.RestrictAllowedResourcesRequest( + request_msg = assuredworkloads.RestrictAllowedResourcesRequest( name="name_value", ) + assert args[0] == request_msg def test_restrict_allowed_resources_use_cached_wrapped_rpc(): @@ -2182,9 +2201,15 @@ async def test_restrict_allowed_resources_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + assuredworkloads.RestrictAllowedResourcesRequest(), + {}, + ], +) async def test_restrict_allowed_resources_async( - transport: str = "grpc_asyncio", - request_type=assuredworkloads.RestrictAllowedResourcesRequest, + request_type, transport: str = "grpc_asyncio" ): client = AssuredWorkloadsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2193,7 +2218,7 @@ async def test_restrict_allowed_resources_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( @@ -2215,11 +2240,6 @@ async def test_restrict_allowed_resources_async( assert isinstance(response, assuredworkloads.RestrictAllowedResourcesResponse) -@pytest.mark.asyncio -async def test_restrict_allowed_resources_async_from_dict(): - await test_restrict_allowed_resources_async(request_type=dict) - - def test_restrict_allowed_resources_field_headers(): client = AssuredWorkloadsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2288,8 +2308,8 @@ async def test_restrict_allowed_resources_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - assuredworkloads.DeleteWorkloadRequest, - dict, + assuredworkloads.DeleteWorkloadRequest(), + {}, ], ) def test_delete_workload(request_type, transport: str = "grpc"): @@ -2300,7 +2320,7 @@ def test_delete_workload(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_workload), "__call__") as call: @@ -2342,10 +2362,11 @@ def test_delete_workload_non_empty_request_with_auto_populated_field(): client.delete_workload(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == assuredworkloads.DeleteWorkloadRequest( + request_msg = assuredworkloads.DeleteWorkloadRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_workload_use_cached_wrapped_rpc(): @@ -2426,9 +2447,14 @@ async def test_delete_workload_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_workload_async( - transport: str = "grpc_asyncio", request_type=assuredworkloads.DeleteWorkloadRequest -): +@pytest.mark.parametrize( + "request_type", + [ + assuredworkloads.DeleteWorkloadRequest(), + {}, + ], +) +async def test_delete_workload_async(request_type, transport: str = "grpc_asyncio"): client = AssuredWorkloadsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2436,7 +2462,7 @@ async def test_delete_workload_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_workload), "__call__") as call: @@ -2454,11 +2480,6 @@ async def test_delete_workload_async( assert response is None -@pytest.mark.asyncio -async def test_delete_workload_async_from_dict(): - await test_delete_workload_async(request_type=dict) - - def test_delete_workload_field_headers(): client = AssuredWorkloadsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2601,8 +2622,8 @@ async def test_delete_workload_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - assuredworkloads.GetWorkloadRequest, - dict, + assuredworkloads.GetWorkloadRequest(), + {}, ], ) def test_get_workload(request_type, transport: str = "grpc"): @@ -2613,7 +2634,7 @@ def test_get_workload(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_workload), "__call__") as call: @@ -2680,9 +2701,10 @@ def test_get_workload_non_empty_request_with_auto_populated_field(): client.get_workload(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == assuredworkloads.GetWorkloadRequest( + request_msg = assuredworkloads.GetWorkloadRequest( name="name_value", ) + assert args[0] == request_msg def test_get_workload_use_cached_wrapped_rpc(): @@ -2763,9 +2785,14 @@ async def test_get_workload_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_workload_async( - transport: str = "grpc_asyncio", request_type=assuredworkloads.GetWorkloadRequest -): +@pytest.mark.parametrize( + "request_type", + [ + assuredworkloads.GetWorkloadRequest(), + {}, + ], +) +async def test_get_workload_async(request_type, transport: str = "grpc_asyncio"): client = AssuredWorkloadsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2773,7 +2800,7 @@ async def test_get_workload_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_workload), "__call__") as call: @@ -2819,11 +2846,6 @@ async def test_get_workload_async( ] -@pytest.mark.asyncio -async def test_get_workload_async_from_dict(): - await test_get_workload_async(request_type=dict) - - def test_get_workload_flattened(): client = AssuredWorkloadsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2909,8 +2931,8 @@ async def test_get_workload_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - assuredworkloads.AnalyzeWorkloadMoveRequest, - dict, + assuredworkloads.AnalyzeWorkloadMoveRequest(), + {}, ], ) def test_analyze_workload_move(request_type, transport: str = "grpc"): @@ -2921,7 +2943,7 @@ def test_analyze_workload_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( @@ -2971,11 +2993,12 @@ def test_analyze_workload_move_non_empty_request_with_auto_populated_field(): client.analyze_workload_move(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == assuredworkloads.AnalyzeWorkloadMoveRequest( + request_msg = assuredworkloads.AnalyzeWorkloadMoveRequest( source="source_value", project="project_value", target="target_value", ) + assert args[0] == request_msg def test_analyze_workload_move_use_cached_wrapped_rpc(): @@ -3061,9 +3084,15 @@ async def test_analyze_workload_move_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + assuredworkloads.AnalyzeWorkloadMoveRequest(), + {}, + ], +) async def test_analyze_workload_move_async( - transport: str = "grpc_asyncio", - request_type=assuredworkloads.AnalyzeWorkloadMoveRequest, + request_type, transport: str = "grpc_asyncio" ): client = AssuredWorkloadsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3072,7 +3101,7 @@ async def test_analyze_workload_move_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( @@ -3097,11 +3126,6 @@ async def test_analyze_workload_move_async( assert response.blockers == ["blockers_value"] -@pytest.mark.asyncio -async def test_analyze_workload_move_async_from_dict(): - await test_analyze_workload_move_async(request_type=dict) - - def test_analyze_workload_move_flattened(): client = AssuredWorkloadsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3197,8 +3221,8 @@ async def test_analyze_workload_move_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - assuredworkloads.ListWorkloadsRequest, - dict, + assuredworkloads.ListWorkloadsRequest(), + {}, ], ) def test_list_workloads(request_type, transport: str = "grpc"): @@ -3209,7 +3233,7 @@ def test_list_workloads(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_workloads), "__call__") as call: @@ -3255,11 +3279,12 @@ def test_list_workloads_non_empty_request_with_auto_populated_field(): client.list_workloads(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == assuredworkloads.ListWorkloadsRequest( + request_msg = assuredworkloads.ListWorkloadsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_workloads_use_cached_wrapped_rpc(): @@ -3340,9 +3365,14 @@ async def test_list_workloads_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_workloads_async( - transport: str = "grpc_asyncio", request_type=assuredworkloads.ListWorkloadsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + assuredworkloads.ListWorkloadsRequest(), + {}, + ], +) +async def test_list_workloads_async(request_type, transport: str = "grpc_asyncio"): client = AssuredWorkloadsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3350,7 +3380,7 @@ async def test_list_workloads_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_workloads), "__call__") as call: @@ -3373,11 +3403,6 @@ async def test_list_workloads_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_workloads_async_from_dict(): - await test_list_workloads_async(request_type=dict) - - def test_list_workloads_flattened(): client = AssuredWorkloadsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4365,7 +4390,6 @@ def test_create_workload_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = assuredworkloads.CreateWorkloadRequest() - assert args[0] == request_msg @@ -4386,7 +4410,6 @@ def test_update_workload_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = assuredworkloads.UpdateWorkloadRequest() - assert args[0] == request_msg @@ -4409,7 +4432,6 @@ def test_restrict_allowed_resources_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = assuredworkloads.RestrictAllowedResourcesRequest() - assert args[0] == request_msg @@ -4430,7 +4452,6 @@ def test_delete_workload_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = assuredworkloads.DeleteWorkloadRequest() - assert args[0] == request_msg @@ -4451,7 +4472,6 @@ def test_get_workload_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = assuredworkloads.GetWorkloadRequest() - assert args[0] == request_msg @@ -4474,7 +4494,6 @@ def test_analyze_workload_move_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = assuredworkloads.AnalyzeWorkloadMoveRequest() - assert args[0] == request_msg @@ -4495,7 +4514,6 @@ def test_list_workloads_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = assuredworkloads.ListWorkloadsRequest() - assert args[0] == request_msg @@ -4534,7 +4552,6 @@ async def test_create_workload_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = assuredworkloads.CreateWorkloadRequest() - assert args[0] == request_msg @@ -4571,7 +4588,6 @@ async def test_update_workload_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = assuredworkloads.UpdateWorkloadRequest() - assert args[0] == request_msg @@ -4598,7 +4614,6 @@ async def test_restrict_allowed_resources_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = assuredworkloads.RestrictAllowedResourcesRequest() - assert args[0] == request_msg @@ -4621,7 +4636,6 @@ async def test_delete_workload_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = assuredworkloads.DeleteWorkloadRequest() - assert args[0] == request_msg @@ -4658,7 +4672,6 @@ async def test_get_workload_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = assuredworkloads.GetWorkloadRequest() - assert args[0] == request_msg @@ -4687,7 +4700,6 @@ async def test_analyze_workload_move_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = assuredworkloads.AnalyzeWorkloadMoveRequest() - assert args[0] == request_msg @@ -4714,7 +4726,6 @@ async def test_list_workloads_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = assuredworkloads.ListWorkloadsRequest() - assert args[0] == request_msg @@ -5399,7 +5410,6 @@ def test_create_workload_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = assuredworkloads.CreateWorkloadRequest() - assert args[0] == request_msg @@ -5419,7 +5429,6 @@ def test_update_workload_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = assuredworkloads.UpdateWorkloadRequest() - assert args[0] == request_msg @@ -5441,7 +5450,6 @@ def test_restrict_allowed_resources_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = assuredworkloads.RestrictAllowedResourcesRequest() - assert args[0] == request_msg @@ -5461,7 +5469,6 @@ def test_delete_workload_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = assuredworkloads.DeleteWorkloadRequest() - assert args[0] == request_msg @@ -5481,7 +5488,6 @@ def test_get_workload_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = assuredworkloads.GetWorkloadRequest() - assert args[0] == request_msg @@ -5503,7 +5509,6 @@ def test_analyze_workload_move_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = assuredworkloads.AnalyzeWorkloadMoveRequest() - assert args[0] == request_msg @@ -5523,7 +5528,6 @@ def test_list_workloads_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = assuredworkloads.ListWorkloadsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-auditmanager/noxfile.py b/packages/google-cloud-auditmanager/noxfile.py index dca3e6e46572..20b95fcccee0 100644 --- a/packages/google-cloud-auditmanager/noxfile.py +++ b/packages/google-cloud-auditmanager/noxfile.py @@ -47,7 +47,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-auditmanager" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-auditmanager/setup.py b/packages/google-cloud-auditmanager/setup.py index d9be6022d2e6..ce758e6b51b6 100644 --- a/packages/google-cloud-auditmanager/setup.py +++ b/packages/google-cloud-auditmanager/setup.py @@ -45,7 +45,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/google-cloud-auditmanager/testing/constraints-3.10.txt b/packages/google-cloud-auditmanager/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-auditmanager/testing/constraints-3.10.txt +++ b/packages/google-cloud-auditmanager/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-auditmanager/tests/unit/gapic/auditmanager_v1/test_audit_manager.py b/packages/google-cloud-auditmanager/tests/unit/gapic/auditmanager_v1/test_audit_manager.py index 0518ab508410..9e473fcbb851 100644 --- a/packages/google-cloud-auditmanager/tests/unit/gapic/auditmanager_v1/test_audit_manager.py +++ b/packages/google-cloud-auditmanager/tests/unit/gapic/auditmanager_v1/test_audit_manager.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 @@ -114,6 +115,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" @@ -1294,8 +1310,8 @@ def test_audit_manager_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - auditmanager.EnrollResourceRequest, - dict, + auditmanager.EnrollResourceRequest(), + {}, ], ) def test_enroll_resource(request_type, transport: str = "grpc"): @@ -1306,7 +1322,7 @@ def test_enroll_resource(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.enroll_resource), "__call__") as call: @@ -1350,9 +1366,10 @@ def test_enroll_resource_non_empty_request_with_auto_populated_field(): client.enroll_resource(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == auditmanager.EnrollResourceRequest( + request_msg = auditmanager.EnrollResourceRequest( scope="scope_value", ) + assert args[0] == request_msg def test_enroll_resource_use_cached_wrapped_rpc(): @@ -1433,9 +1450,14 @@ async def test_enroll_resource_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_enroll_resource_async( - transport: str = "grpc_asyncio", request_type=auditmanager.EnrollResourceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + auditmanager.EnrollResourceRequest(), + {}, + ], +) +async def test_enroll_resource_async(request_type, transport: str = "grpc_asyncio"): client = AuditManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1443,7 +1465,7 @@ async def test_enroll_resource_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.enroll_resource), "__call__") as call: @@ -1466,11 +1488,6 @@ async def test_enroll_resource_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_enroll_resource_async_from_dict(): - await test_enroll_resource_async(request_type=dict) - - def test_enroll_resource_field_headers(): client = AuditManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1651,8 +1668,8 @@ async def test_enroll_resource_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - auditmanager.GenerateAuditScopeReportRequest, - dict, + auditmanager.GenerateAuditScopeReportRequest(), + {}, ], ) def test_generate_audit_scope_report(request_type, transport: str = "grpc"): @@ -1663,7 +1680,7 @@ def test_generate_audit_scope_report(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1714,11 +1731,12 @@ def test_generate_audit_scope_report_non_empty_request_with_auto_populated_field client.generate_audit_scope_report(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == auditmanager.GenerateAuditScopeReportRequest( + request_msg = auditmanager.GenerateAuditScopeReportRequest( scope="scope_value", compliance_standard="compliance_standard_value", compliance_framework="compliance_framework_value", ) + assert args[0] == request_msg def test_generate_audit_scope_report_use_cached_wrapped_rpc(): @@ -1804,9 +1822,15 @@ async def test_generate_audit_scope_report_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + auditmanager.GenerateAuditScopeReportRequest(), + {}, + ], +) async def test_generate_audit_scope_report_async( - transport: str = "grpc_asyncio", - request_type=auditmanager.GenerateAuditScopeReportRequest, + request_type, transport: str = "grpc_asyncio" ): client = AuditManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -1815,7 +1839,7 @@ async def test_generate_audit_scope_report_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( @@ -1840,11 +1864,6 @@ async def test_generate_audit_scope_report_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_generate_audit_scope_report_async_from_dict(): - await test_generate_audit_scope_report_async(request_type=dict) - - def test_generate_audit_scope_report_field_headers(): client = AuditManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2019,8 +2038,8 @@ async def test_generate_audit_scope_report_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - auditmanager.GenerateAuditReportRequest, - dict, + auditmanager.GenerateAuditReportRequest(), + {}, ], ) def test_generate_audit_report(request_type, transport: str = "grpc"): @@ -2031,7 +2050,7 @@ def test_generate_audit_report(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2079,12 +2098,13 @@ def test_generate_audit_report_non_empty_request_with_auto_populated_field(): client.generate_audit_report(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == auditmanager.GenerateAuditReportRequest( + request_msg = auditmanager.GenerateAuditReportRequest( gcs_uri="gcs_uri_value", scope="scope_value", compliance_standard="compliance_standard_value", compliance_framework="compliance_framework_value", ) + assert args[0] == request_msg def test_generate_audit_report_use_cached_wrapped_rpc(): @@ -2180,9 +2200,15 @@ async def test_generate_audit_report_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + auditmanager.GenerateAuditReportRequest(), + {}, + ], +) async def test_generate_audit_report_async( - transport: str = "grpc_asyncio", - request_type=auditmanager.GenerateAuditReportRequest, + request_type, transport: str = "grpc_asyncio" ): client = AuditManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -2191,7 +2217,7 @@ async def test_generate_audit_report_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( @@ -2213,11 +2239,6 @@ async def test_generate_audit_report_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_generate_audit_report_async_from_dict(): - await test_generate_audit_report_async(request_type=dict) - - def test_generate_audit_report_field_headers(): client = AuditManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2398,8 +2419,8 @@ async def test_generate_audit_report_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - auditmanager.ListAuditReportsRequest, - dict, + auditmanager.ListAuditReportsRequest(), + {}, ], ) def test_list_audit_reports(request_type, transport: str = "grpc"): @@ -2410,7 +2431,7 @@ def test_list_audit_reports(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2459,10 +2480,11 @@ def test_list_audit_reports_non_empty_request_with_auto_populated_field(): client.list_audit_reports(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == auditmanager.ListAuditReportsRequest( + request_msg = auditmanager.ListAuditReportsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_audit_reports_use_cached_wrapped_rpc(): @@ -2547,9 +2569,14 @@ async def test_list_audit_reports_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_audit_reports_async( - transport: str = "grpc_asyncio", request_type=auditmanager.ListAuditReportsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + auditmanager.ListAuditReportsRequest(), + {}, + ], +) +async def test_list_audit_reports_async(request_type, transport: str = "grpc_asyncio"): client = AuditManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2557,7 +2584,7 @@ async def test_list_audit_reports_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( @@ -2582,11 +2609,6 @@ async def test_list_audit_reports_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_audit_reports_async_from_dict(): - await test_list_audit_reports_async(request_type=dict) - - def test_list_audit_reports_field_headers(): client = AuditManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2939,8 +2961,8 @@ async def test_list_audit_reports_async_pages(): @pytest.mark.parametrize( "request_type", [ - auditmanager.GetAuditReportRequest, - dict, + auditmanager.GetAuditReportRequest(), + {}, ], ) def test_get_audit_report(request_type, transport: str = "grpc"): @@ -2951,7 +2973,7 @@ def test_get_audit_report(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_audit_report), "__call__") as call: @@ -3010,9 +3032,10 @@ def test_get_audit_report_non_empty_request_with_auto_populated_field(): client.get_audit_report(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == auditmanager.GetAuditReportRequest( + request_msg = auditmanager.GetAuditReportRequest( name="name_value", ) + assert args[0] == request_msg def test_get_audit_report_use_cached_wrapped_rpc(): @@ -3095,9 +3118,14 @@ async def test_get_audit_report_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_audit_report_async( - transport: str = "grpc_asyncio", request_type=auditmanager.GetAuditReportRequest -): +@pytest.mark.parametrize( + "request_type", + [ + auditmanager.GetAuditReportRequest(), + {}, + ], +) +async def test_get_audit_report_async(request_type, transport: str = "grpc_asyncio"): client = AuditManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3105,7 +3133,7 @@ async def test_get_audit_report_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_audit_report), "__call__") as call: @@ -3143,11 +3171,6 @@ async def test_get_audit_report_async( assert response.scope_id == "scope_id_value" -@pytest.mark.asyncio -async def test_get_audit_report_async_from_dict(): - await test_get_audit_report_async(request_type=dict) - - def test_get_audit_report_field_headers(): client = AuditManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3294,8 +3317,8 @@ async def test_get_audit_report_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - auditmanager.GetResourceEnrollmentStatusRequest, - dict, + auditmanager.GetResourceEnrollmentStatusRequest(), + {}, ], ) def test_get_resource_enrollment_status(request_type, transport: str = "grpc"): @@ -3306,7 +3329,7 @@ def test_get_resource_enrollment_status(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3363,9 +3386,10 @@ def test_get_resource_enrollment_status_non_empty_request_with_auto_populated_fi client.get_resource_enrollment_status(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == auditmanager.GetResourceEnrollmentStatusRequest( + request_msg = auditmanager.GetResourceEnrollmentStatusRequest( name="name_value", ) + assert args[0] == request_msg def test_get_resource_enrollment_status_use_cached_wrapped_rpc(): @@ -3451,9 +3475,15 @@ async def test_get_resource_enrollment_status_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + auditmanager.GetResourceEnrollmentStatusRequest(), + {}, + ], +) async def test_get_resource_enrollment_status_async( - transport: str = "grpc_asyncio", - request_type=auditmanager.GetResourceEnrollmentStatusRequest, + request_type, transport: str = "grpc_asyncio" ): client = AuditManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -3462,7 +3492,7 @@ async def test_get_resource_enrollment_status_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( @@ -3496,11 +3526,6 @@ async def test_get_resource_enrollment_status_async( ) -@pytest.mark.asyncio -async def test_get_resource_enrollment_status_async_from_dict(): - await test_get_resource_enrollment_status_async(request_type=dict) - - def test_get_resource_enrollment_status_field_headers(): client = AuditManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3655,8 +3680,8 @@ async def test_get_resource_enrollment_status_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - auditmanager.ListResourceEnrollmentStatusesRequest, - dict, + auditmanager.ListResourceEnrollmentStatusesRequest(), + {}, ], ) def test_list_resource_enrollment_statuses(request_type, transport: str = "grpc"): @@ -3667,7 +3692,7 @@ def test_list_resource_enrollment_statuses(request_type, transport: str = "grpc" # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3716,10 +3741,11 @@ def test_list_resource_enrollment_statuses_non_empty_request_with_auto_populated client.list_resource_enrollment_statuses(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == auditmanager.ListResourceEnrollmentStatusesRequest( + request_msg = auditmanager.ListResourceEnrollmentStatusesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_resource_enrollment_statuses_use_cached_wrapped_rpc(): @@ -3805,9 +3831,15 @@ async def test_list_resource_enrollment_statuses_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + auditmanager.ListResourceEnrollmentStatusesRequest(), + {}, + ], +) async def test_list_resource_enrollment_statuses_async( - transport: str = "grpc_asyncio", - request_type=auditmanager.ListResourceEnrollmentStatusesRequest, + request_type, transport: str = "grpc_asyncio" ): client = AuditManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -3816,7 +3848,7 @@ async def test_list_resource_enrollment_statuses_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( @@ -3841,11 +3873,6 @@ async def test_list_resource_enrollment_statuses_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_resource_enrollment_statuses_async_from_dict(): - await test_list_resource_enrollment_statuses_async(request_type=dict) - - def test_list_resource_enrollment_statuses_field_headers(): client = AuditManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4206,8 +4233,8 @@ async def test_list_resource_enrollment_statuses_async_pages(): @pytest.mark.parametrize( "request_type", [ - auditmanager.ListControlsRequest, - dict, + auditmanager.ListControlsRequest(), + {}, ], ) def test_list_controls(request_type, transport: str = "grpc"): @@ -4218,7 +4245,7 @@ def test_list_controls(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_controls), "__call__") as call: @@ -4263,10 +4290,11 @@ def test_list_controls_non_empty_request_with_auto_populated_field(): client.list_controls(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == auditmanager.ListControlsRequest( + request_msg = auditmanager.ListControlsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_controls_use_cached_wrapped_rpc(): @@ -4347,9 +4375,14 @@ async def test_list_controls_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_controls_async( - transport: str = "grpc_asyncio", request_type=auditmanager.ListControlsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + auditmanager.ListControlsRequest(), + {}, + ], +) +async def test_list_controls_async(request_type, transport: str = "grpc_asyncio"): client = AuditManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4357,7 +4390,7 @@ async def test_list_controls_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_controls), "__call__") as call: @@ -4380,11 +4413,6 @@ async def test_list_controls_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_controls_async_from_dict(): - await test_list_controls_async(request_type=dict) - - def test_list_controls_field_headers(): client = AuditManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6611,7 +6639,6 @@ def test_enroll_resource_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = auditmanager.EnrollResourceRequest() - assert args[0] == request_msg @@ -6634,7 +6661,6 @@ def test_generate_audit_scope_report_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = auditmanager.GenerateAuditScopeReportRequest() - assert args[0] == request_msg @@ -6657,7 +6683,6 @@ def test_generate_audit_report_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = auditmanager.GenerateAuditReportRequest() - assert args[0] == request_msg @@ -6680,7 +6705,6 @@ def test_list_audit_reports_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = auditmanager.ListAuditReportsRequest() - assert args[0] == request_msg @@ -6701,7 +6725,6 @@ def test_get_audit_report_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = auditmanager.GetAuditReportRequest() - assert args[0] == request_msg @@ -6724,7 +6747,6 @@ def test_get_resource_enrollment_status_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = auditmanager.GetResourceEnrollmentStatusRequest() - assert args[0] == request_msg @@ -6747,7 +6769,6 @@ def test_list_resource_enrollment_statuses_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = auditmanager.ListResourceEnrollmentStatusesRequest() - assert args[0] == request_msg @@ -6768,7 +6789,6 @@ def test_list_controls_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = auditmanager.ListControlsRequest() - assert args[0] == request_msg @@ -6809,7 +6829,6 @@ async def test_enroll_resource_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = auditmanager.EnrollResourceRequest() - assert args[0] == request_msg @@ -6838,7 +6857,6 @@ async def test_generate_audit_scope_report_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = auditmanager.GenerateAuditScopeReportRequest() - assert args[0] == request_msg @@ -6865,7 +6883,6 @@ async def test_generate_audit_report_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = auditmanager.GenerateAuditReportRequest() - assert args[0] == request_msg @@ -6894,7 +6911,6 @@ async def test_list_audit_reports_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = auditmanager.ListAuditReportsRequest() - assert args[0] == request_msg @@ -6927,7 +6943,6 @@ async def test_get_audit_report_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = auditmanager.GetAuditReportRequest() - assert args[0] == request_msg @@ -6959,7 +6974,6 @@ async def test_get_resource_enrollment_status_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = auditmanager.GetResourceEnrollmentStatusRequest() - assert args[0] == request_msg @@ -6988,7 +7002,6 @@ async def test_list_resource_enrollment_statuses_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = auditmanager.ListResourceEnrollmentStatusesRequest() - assert args[0] == request_msg @@ -7015,7 +7028,6 @@ async def test_list_controls_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = auditmanager.ListControlsRequest() - assert args[0] == request_msg @@ -8519,7 +8531,6 @@ def test_enroll_resource_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = auditmanager.EnrollResourceRequest() - assert args[0] == request_msg @@ -8541,7 +8552,6 @@ def test_generate_audit_scope_report_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = auditmanager.GenerateAuditScopeReportRequest() - assert args[0] == request_msg @@ -8563,7 +8573,6 @@ def test_generate_audit_report_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = auditmanager.GenerateAuditReportRequest() - assert args[0] == request_msg @@ -8585,7 +8594,6 @@ def test_list_audit_reports_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = auditmanager.ListAuditReportsRequest() - assert args[0] == request_msg @@ -8605,7 +8613,6 @@ def test_get_audit_report_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = auditmanager.GetAuditReportRequest() - assert args[0] == request_msg @@ -8627,7 +8634,6 @@ def test_get_resource_enrollment_status_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = auditmanager.GetResourceEnrollmentStatusRequest() - assert args[0] == request_msg @@ -8649,7 +8655,6 @@ def test_list_resource_enrollment_statuses_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = auditmanager.ListResourceEnrollmentStatusesRequest() - assert args[0] == request_msg @@ -8669,7 +8674,6 @@ def test_list_controls_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = auditmanager.ListControlsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-automl/noxfile.py b/packages/google-cloud-automl/noxfile.py index 3fb9ff3a18b3..a819955ec879 100644 --- a/packages/google-cloud-automl/noxfile.py +++ b/packages/google-cloud-automl/noxfile.py @@ -47,7 +47,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-automl" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -468,14 +473,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -587,14 +584,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-automl/setup.py b/packages/google-cloud-automl/setup.py index e272b706ebd0..fc5d8bfa6429 100644 --- a/packages/google-cloud-automl/setup.py +++ b/packages/google-cloud-automl/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/google-cloud-automl/testing/constraints-3.10.txt b/packages/google-cloud-automl/testing/constraints-3.10.txt index 9f75f9aab88f..81484ad92a64 100644 --- a/packages/google-cloud-automl/testing/constraints-3.10.txt +++ b/packages/google-cloud-automl/testing/constraints-3.10.txt @@ -11,6 +11,6 @@ pandas==1.3.4 # numpy is a dependency of pandas numpy==1.21.3 google-auth==2.23.3 -grpcio==1.44.0 +grpcio==1.59.0 proto-plus==1.22.3 protobuf==4.25.8 diff --git a/packages/google-cloud-automl/tests/unit/gapic/automl_v1/test_auto_ml.py b/packages/google-cloud-automl/tests/unit/gapic/automl_v1/test_auto_ml.py index 879cab860a75..fdc28635d68a 100644 --- a/packages/google-cloud-automl/tests/unit/gapic/automl_v1/test_auto_ml.py +++ b/packages/google-cloud-automl/tests/unit/gapic/automl_v1/test_auto_ml.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 @@ -132,6 +133,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" @@ -1264,8 +1280,8 @@ def test_auto_ml_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - service.CreateDatasetRequest, - dict, + service.CreateDatasetRequest(), + {}, ], ) def test_create_dataset(request_type, transport: str = "grpc"): @@ -1276,7 +1292,7 @@ def test_create_dataset(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_dataset), "__call__") as call: @@ -1317,9 +1333,10 @@ def test_create_dataset_non_empty_request_with_auto_populated_field(): client.create_dataset(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateDatasetRequest( + request_msg = service.CreateDatasetRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_dataset_use_cached_wrapped_rpc(): @@ -1410,9 +1427,14 @@ async def test_create_dataset_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_dataset_async( - transport: str = "grpc_asyncio", request_type=service.CreateDatasetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CreateDatasetRequest(), + {}, + ], +) +async def test_create_dataset_async(request_type, transport: str = "grpc_asyncio"): client = AutoMlAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1420,7 +1442,7 @@ async def test_create_dataset_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_dataset), "__call__") as call: @@ -1440,11 +1462,6 @@ async def test_create_dataset_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_dataset_async_from_dict(): - await test_create_dataset_async(request_type=dict) - - def test_create_dataset_field_headers(): client = AutoMlClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1625,8 +1642,8 @@ async def test_create_dataset_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.GetDatasetRequest, - dict, + service.GetDatasetRequest(), + {}, ], ) def test_get_dataset(request_type, transport: str = "grpc"): @@ -1637,7 +1654,7 @@ def test_get_dataset(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_dataset), "__call__") as call: @@ -1689,9 +1706,10 @@ def test_get_dataset_non_empty_request_with_auto_populated_field(): client.get_dataset(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetDatasetRequest( + request_msg = service.GetDatasetRequest( name="name_value", ) + assert args[0] == request_msg def test_get_dataset_use_cached_wrapped_rpc(): @@ -1772,9 +1790,14 @@ async def test_get_dataset_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_dataset_async( - transport: str = "grpc_asyncio", request_type=service.GetDatasetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetDatasetRequest(), + {}, + ], +) +async def test_get_dataset_async(request_type, transport: str = "grpc_asyncio"): client = AutoMlAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1782,7 +1805,7 @@ async def test_get_dataset_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_dataset), "__call__") as call: @@ -1813,11 +1836,6 @@ async def test_get_dataset_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_dataset_async_from_dict(): - await test_get_dataset_async(request_type=dict) - - def test_get_dataset_field_headers(): client = AutoMlClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1960,8 +1978,8 @@ async def test_get_dataset_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListDatasetsRequest, - dict, + service.ListDatasetsRequest(), + {}, ], ) def test_list_datasets(request_type, transport: str = "grpc"): @@ -1972,7 +1990,7 @@ def test_list_datasets(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_datasets), "__call__") as call: @@ -2018,11 +2036,12 @@ def test_list_datasets_non_empty_request_with_auto_populated_field(): client.list_datasets(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListDatasetsRequest( + request_msg = service.ListDatasetsRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_datasets_use_cached_wrapped_rpc(): @@ -2103,9 +2122,14 @@ async def test_list_datasets_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_datasets_async( - transport: str = "grpc_asyncio", request_type=service.ListDatasetsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListDatasetsRequest(), + {}, + ], +) +async def test_list_datasets_async(request_type, transport: str = "grpc_asyncio"): client = AutoMlAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2113,7 +2137,7 @@ async def test_list_datasets_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_datasets), "__call__") as call: @@ -2136,11 +2160,6 @@ async def test_list_datasets_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_datasets_async_from_dict(): - await test_list_datasets_async(request_type=dict) - - def test_list_datasets_field_headers(): client = AutoMlClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2477,8 +2496,8 @@ async def test_list_datasets_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.UpdateDatasetRequest, - dict, + service.UpdateDatasetRequest(), + {}, ], ) def test_update_dataset(request_type, transport: str = "grpc"): @@ -2489,7 +2508,7 @@ def test_update_dataset(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_dataset), "__call__") as call: @@ -2539,7 +2558,8 @@ def test_update_dataset_non_empty_request_with_auto_populated_field(): client.update_dataset(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateDatasetRequest() + request_msg = service.UpdateDatasetRequest() + assert args[0] == request_msg def test_update_dataset_use_cached_wrapped_rpc(): @@ -2620,9 +2640,14 @@ async def test_update_dataset_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_dataset_async( - transport: str = "grpc_asyncio", request_type=service.UpdateDatasetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateDatasetRequest(), + {}, + ], +) +async def test_update_dataset_async(request_type, transport: str = "grpc_asyncio"): client = AutoMlAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2630,7 +2655,7 @@ async def test_update_dataset_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_dataset), "__call__") as call: @@ -2661,11 +2686,6 @@ async def test_update_dataset_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_update_dataset_async_from_dict(): - await test_update_dataset_async(request_type=dict) - - def test_update_dataset_field_headers(): client = AutoMlClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2842,8 +2862,8 @@ async def test_update_dataset_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DeleteDatasetRequest, - dict, + service.DeleteDatasetRequest(), + {}, ], ) def test_delete_dataset(request_type, transport: str = "grpc"): @@ -2854,7 +2874,7 @@ def test_delete_dataset(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_dataset), "__call__") as call: @@ -2895,9 +2915,10 @@ def test_delete_dataset_non_empty_request_with_auto_populated_field(): client.delete_dataset(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteDatasetRequest( + request_msg = service.DeleteDatasetRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_dataset_use_cached_wrapped_rpc(): @@ -2988,9 +3009,14 @@ async def test_delete_dataset_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_dataset_async( - transport: str = "grpc_asyncio", request_type=service.DeleteDatasetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteDatasetRequest(), + {}, + ], +) +async def test_delete_dataset_async(request_type, transport: str = "grpc_asyncio"): client = AutoMlAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2998,7 +3024,7 @@ async def test_delete_dataset_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_dataset), "__call__") as call: @@ -3018,11 +3044,6 @@ async def test_delete_dataset_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_dataset_async_from_dict(): - await test_delete_dataset_async(request_type=dict) - - def test_delete_dataset_field_headers(): client = AutoMlClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3169,8 +3190,8 @@ async def test_delete_dataset_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ImportDataRequest, - dict, + service.ImportDataRequest(), + {}, ], ) def test_import_data(request_type, transport: str = "grpc"): @@ -3181,7 +3202,7 @@ def test_import_data(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.import_data), "__call__") as call: @@ -3222,9 +3243,10 @@ def test_import_data_non_empty_request_with_auto_populated_field(): client.import_data(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ImportDataRequest( + request_msg = service.ImportDataRequest( name="name_value", ) + assert args[0] == request_msg def test_import_data_use_cached_wrapped_rpc(): @@ -3315,9 +3337,14 @@ async def test_import_data_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_import_data_async( - transport: str = "grpc_asyncio", request_type=service.ImportDataRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ImportDataRequest(), + {}, + ], +) +async def test_import_data_async(request_type, transport: str = "grpc_asyncio"): client = AutoMlAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3325,7 +3352,7 @@ async def test_import_data_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.import_data), "__call__") as call: @@ -3345,11 +3372,6 @@ async def test_import_data_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_import_data_async_from_dict(): - await test_import_data_async(request_type=dict) - - def test_import_data_field_headers(): client = AutoMlClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3518,8 +3540,8 @@ async def test_import_data_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ExportDataRequest, - dict, + service.ExportDataRequest(), + {}, ], ) def test_export_data(request_type, transport: str = "grpc"): @@ -3530,7 +3552,7 @@ def test_export_data(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.export_data), "__call__") as call: @@ -3571,9 +3593,10 @@ def test_export_data_non_empty_request_with_auto_populated_field(): client.export_data(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ExportDataRequest( + request_msg = service.ExportDataRequest( name="name_value", ) + assert args[0] == request_msg def test_export_data_use_cached_wrapped_rpc(): @@ -3664,9 +3687,14 @@ async def test_export_data_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_export_data_async( - transport: str = "grpc_asyncio", request_type=service.ExportDataRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ExportDataRequest(), + {}, + ], +) +async def test_export_data_async(request_type, transport: str = "grpc_asyncio"): client = AutoMlAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3674,7 +3702,7 @@ async def test_export_data_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.export_data), "__call__") as call: @@ -3694,11 +3722,6 @@ async def test_export_data_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_export_data_async_from_dict(): - await test_export_data_async(request_type=dict) - - def test_export_data_field_headers(): client = AutoMlClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3879,8 +3902,8 @@ async def test_export_data_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.GetAnnotationSpecRequest, - dict, + service.GetAnnotationSpecRequest(), + {}, ], ) def test_get_annotation_spec(request_type, transport: str = "grpc"): @@ -3891,7 +3914,7 @@ def test_get_annotation_spec(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3943,9 +3966,10 @@ def test_get_annotation_spec_non_empty_request_with_auto_populated_field(): client.get_annotation_spec(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetAnnotationSpecRequest( + request_msg = service.GetAnnotationSpecRequest( name="name_value", ) + assert args[0] == request_msg def test_get_annotation_spec_use_cached_wrapped_rpc(): @@ -4030,9 +4054,14 @@ async def test_get_annotation_spec_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_annotation_spec_async( - transport: str = "grpc_asyncio", request_type=service.GetAnnotationSpecRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetAnnotationSpecRequest(), + {}, + ], +) +async def test_get_annotation_spec_async(request_type, transport: str = "grpc_asyncio"): client = AutoMlAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4040,7 +4069,7 @@ async def test_get_annotation_spec_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( @@ -4069,11 +4098,6 @@ async def test_get_annotation_spec_async( assert response.example_count == 1396 -@pytest.mark.asyncio -async def test_get_annotation_spec_async_from_dict(): - await test_get_annotation_spec_async(request_type=dict) - - def test_get_annotation_spec_field_headers(): client = AutoMlClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4228,8 +4252,8 @@ async def test_get_annotation_spec_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.CreateModelRequest, - dict, + service.CreateModelRequest(), + {}, ], ) def test_create_model(request_type, transport: str = "grpc"): @@ -4240,7 +4264,7 @@ def test_create_model(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_model), "__call__") as call: @@ -4281,9 +4305,10 @@ def test_create_model_non_empty_request_with_auto_populated_field(): client.create_model(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateModelRequest( + request_msg = service.CreateModelRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_model_use_cached_wrapped_rpc(): @@ -4374,9 +4399,14 @@ async def test_create_model_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_model_async( - transport: str = "grpc_asyncio", request_type=service.CreateModelRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CreateModelRequest(), + {}, + ], +) +async def test_create_model_async(request_type, transport: str = "grpc_asyncio"): client = AutoMlAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4384,7 +4414,7 @@ async def test_create_model_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_model), "__call__") as call: @@ -4404,11 +4434,6 @@ async def test_create_model_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_model_async_from_dict(): - await test_create_model_async(request_type=dict) - - def test_create_model_field_headers(): client = AutoMlClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4589,8 +4614,8 @@ async def test_create_model_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.GetModelRequest, - dict, + service.GetModelRequest(), + {}, ], ) def test_get_model(request_type, transport: str = "grpc"): @@ -4601,7 +4626,7 @@ def test_get_model(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_model), "__call__") as call: @@ -4653,9 +4678,10 @@ def test_get_model_non_empty_request_with_auto_populated_field(): client.get_model(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetModelRequest( + request_msg = service.GetModelRequest( name="name_value", ) + assert args[0] == request_msg def test_get_model_use_cached_wrapped_rpc(): @@ -4734,9 +4760,14 @@ async def test_get_model_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_model_async( - transport: str = "grpc_asyncio", request_type=service.GetModelRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetModelRequest(), + {}, + ], +) +async def test_get_model_async(request_type, transport: str = "grpc_asyncio"): client = AutoMlAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4744,7 +4775,7 @@ async def test_get_model_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_model), "__call__") as call: @@ -4775,11 +4806,6 @@ async def test_get_model_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_model_async_from_dict(): - await test_get_model_async(request_type=dict) - - def test_get_model_field_headers(): client = AutoMlClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4922,8 +4948,8 @@ async def test_get_model_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListModelsRequest, - dict, + service.ListModelsRequest(), + {}, ], ) def test_list_models(request_type, transport: str = "grpc"): @@ -4934,7 +4960,7 @@ def test_list_models(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_models), "__call__") as call: @@ -4980,11 +5006,12 @@ def test_list_models_non_empty_request_with_auto_populated_field(): client.list_models(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListModelsRequest( + request_msg = service.ListModelsRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_models_use_cached_wrapped_rpc(): @@ -5065,9 +5092,14 @@ async def test_list_models_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_models_async( - transport: str = "grpc_asyncio", request_type=service.ListModelsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListModelsRequest(), + {}, + ], +) +async def test_list_models_async(request_type, transport: str = "grpc_asyncio"): client = AutoMlAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5075,7 +5107,7 @@ async def test_list_models_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_models), "__call__") as call: @@ -5098,11 +5130,6 @@ async def test_list_models_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_models_async_from_dict(): - await test_list_models_async(request_type=dict) - - def test_list_models_field_headers(): client = AutoMlClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5439,8 +5466,8 @@ async def test_list_models_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.DeleteModelRequest, - dict, + service.DeleteModelRequest(), + {}, ], ) def test_delete_model(request_type, transport: str = "grpc"): @@ -5451,7 +5478,7 @@ def test_delete_model(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_model), "__call__") as call: @@ -5492,9 +5519,10 @@ def test_delete_model_non_empty_request_with_auto_populated_field(): client.delete_model(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteModelRequest( + request_msg = service.DeleteModelRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_model_use_cached_wrapped_rpc(): @@ -5585,9 +5613,14 @@ async def test_delete_model_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_model_async( - transport: str = "grpc_asyncio", request_type=service.DeleteModelRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteModelRequest(), + {}, + ], +) +async def test_delete_model_async(request_type, transport: str = "grpc_asyncio"): client = AutoMlAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5595,7 +5628,7 @@ async def test_delete_model_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_model), "__call__") as call: @@ -5615,11 +5648,6 @@ async def test_delete_model_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_model_async_from_dict(): - await test_delete_model_async(request_type=dict) - - def test_delete_model_field_headers(): client = AutoMlClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5766,8 +5794,8 @@ async def test_delete_model_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdateModelRequest, - dict, + service.UpdateModelRequest(), + {}, ], ) def test_update_model(request_type, transport: str = "grpc"): @@ -5778,7 +5806,7 @@ def test_update_model(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_model), "__call__") as call: @@ -5828,7 +5856,8 @@ def test_update_model_non_empty_request_with_auto_populated_field(): client.update_model(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateModelRequest() + request_msg = service.UpdateModelRequest() + assert args[0] == request_msg def test_update_model_use_cached_wrapped_rpc(): @@ -5909,9 +5938,14 @@ async def test_update_model_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_model_async( - transport: str = "grpc_asyncio", request_type=service.UpdateModelRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateModelRequest(), + {}, + ], +) +async def test_update_model_async(request_type, transport: str = "grpc_asyncio"): client = AutoMlAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5919,7 +5953,7 @@ async def test_update_model_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_model), "__call__") as call: @@ -5950,11 +5984,6 @@ async def test_update_model_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_update_model_async_from_dict(): - await test_update_model_async(request_type=dict) - - def test_update_model_field_headers(): client = AutoMlClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6131,8 +6160,8 @@ async def test_update_model_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DeployModelRequest, - dict, + service.DeployModelRequest(), + {}, ], ) def test_deploy_model(request_type, transport: str = "grpc"): @@ -6143,7 +6172,7 @@ def test_deploy_model(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.deploy_model), "__call__") as call: @@ -6184,9 +6213,10 @@ def test_deploy_model_non_empty_request_with_auto_populated_field(): client.deploy_model(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeployModelRequest( + request_msg = service.DeployModelRequest( name="name_value", ) + assert args[0] == request_msg def test_deploy_model_use_cached_wrapped_rpc(): @@ -6277,9 +6307,14 @@ async def test_deploy_model_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_deploy_model_async( - transport: str = "grpc_asyncio", request_type=service.DeployModelRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.DeployModelRequest(), + {}, + ], +) +async def test_deploy_model_async(request_type, transport: str = "grpc_asyncio"): client = AutoMlAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6287,7 +6322,7 @@ async def test_deploy_model_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.deploy_model), "__call__") as call: @@ -6307,11 +6342,6 @@ async def test_deploy_model_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_deploy_model_async_from_dict(): - await test_deploy_model_async(request_type=dict) - - def test_deploy_model_field_headers(): client = AutoMlClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6458,8 +6488,8 @@ async def test_deploy_model_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.UndeployModelRequest, - dict, + service.UndeployModelRequest(), + {}, ], ) def test_undeploy_model(request_type, transport: str = "grpc"): @@ -6470,7 +6500,7 @@ def test_undeploy_model(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.undeploy_model), "__call__") as call: @@ -6511,9 +6541,10 @@ def test_undeploy_model_non_empty_request_with_auto_populated_field(): client.undeploy_model(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UndeployModelRequest( + request_msg = service.UndeployModelRequest( name="name_value", ) + assert args[0] == request_msg def test_undeploy_model_use_cached_wrapped_rpc(): @@ -6604,9 +6635,14 @@ async def test_undeploy_model_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_undeploy_model_async( - transport: str = "grpc_asyncio", request_type=service.UndeployModelRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.UndeployModelRequest(), + {}, + ], +) +async def test_undeploy_model_async(request_type, transport: str = "grpc_asyncio"): client = AutoMlAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6614,7 +6650,7 @@ async def test_undeploy_model_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.undeploy_model), "__call__") as call: @@ -6634,11 +6670,6 @@ async def test_undeploy_model_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_undeploy_model_async_from_dict(): - await test_undeploy_model_async(request_type=dict) - - def test_undeploy_model_field_headers(): client = AutoMlClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6785,8 +6816,8 @@ async def test_undeploy_model_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ExportModelRequest, - dict, + service.ExportModelRequest(), + {}, ], ) def test_export_model(request_type, transport: str = "grpc"): @@ -6797,7 +6828,7 @@ def test_export_model(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.export_model), "__call__") as call: @@ -6838,9 +6869,10 @@ def test_export_model_non_empty_request_with_auto_populated_field(): client.export_model(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ExportModelRequest( + request_msg = service.ExportModelRequest( name="name_value", ) + assert args[0] == request_msg def test_export_model_use_cached_wrapped_rpc(): @@ -6931,9 +6963,14 @@ async def test_export_model_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_export_model_async( - transport: str = "grpc_asyncio", request_type=service.ExportModelRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ExportModelRequest(), + {}, + ], +) +async def test_export_model_async(request_type, transport: str = "grpc_asyncio"): client = AutoMlAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6941,7 +6978,7 @@ async def test_export_model_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.export_model), "__call__") as call: @@ -6961,11 +6998,6 @@ async def test_export_model_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_export_model_async_from_dict(): - await test_export_model_async(request_type=dict) - - def test_export_model_field_headers(): client = AutoMlClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7146,8 +7178,8 @@ async def test_export_model_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.GetModelEvaluationRequest, - dict, + service.GetModelEvaluationRequest(), + {}, ], ) def test_get_model_evaluation(request_type, transport: str = "grpc"): @@ -7158,7 +7190,7 @@ def test_get_model_evaluation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7212,9 +7244,10 @@ def test_get_model_evaluation_non_empty_request_with_auto_populated_field(): client.get_model_evaluation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetModelEvaluationRequest( + request_msg = service.GetModelEvaluationRequest( name="name_value", ) + assert args[0] == request_msg def test_get_model_evaluation_use_cached_wrapped_rpc(): @@ -7299,8 +7332,15 @@ async def test_get_model_evaluation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.GetModelEvaluationRequest(), + {}, + ], +) async def test_get_model_evaluation_async( - transport: str = "grpc_asyncio", request_type=service.GetModelEvaluationRequest + request_type, transport: str = "grpc_asyncio" ): client = AutoMlAsyncClient( credentials=async_anonymous_credentials(), @@ -7309,7 +7349,7 @@ async def test_get_model_evaluation_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( @@ -7340,11 +7380,6 @@ async def test_get_model_evaluation_async( assert response.evaluated_example_count == 2446 -@pytest.mark.asyncio -async def test_get_model_evaluation_async_from_dict(): - await test_get_model_evaluation_async(request_type=dict) - - def test_get_model_evaluation_field_headers(): client = AutoMlClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7499,8 +7534,8 @@ async def test_get_model_evaluation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListModelEvaluationsRequest, - dict, + service.ListModelEvaluationsRequest(), + {}, ], ) def test_list_model_evaluations(request_type, transport: str = "grpc"): @@ -7511,7 +7546,7 @@ def test_list_model_evaluations(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7561,11 +7596,12 @@ def test_list_model_evaluations_non_empty_request_with_auto_populated_field(): client.list_model_evaluations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListModelEvaluationsRequest( + request_msg = service.ListModelEvaluationsRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_model_evaluations_use_cached_wrapped_rpc(): @@ -7651,8 +7687,15 @@ async def test_list_model_evaluations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.ListModelEvaluationsRequest(), + {}, + ], +) async def test_list_model_evaluations_async( - transport: str = "grpc_asyncio", request_type=service.ListModelEvaluationsRequest + request_type, transport: str = "grpc_asyncio" ): client = AutoMlAsyncClient( credentials=async_anonymous_credentials(), @@ -7661,7 +7704,7 @@ async def test_list_model_evaluations_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( @@ -7686,11 +7729,6 @@ async def test_list_model_evaluations_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_model_evaluations_async_from_dict(): - await test_list_model_evaluations_async(request_type=dict) - - def test_list_model_evaluations_field_headers(): client = AutoMlClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11732,7 +11770,6 @@ def test_create_dataset_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateDatasetRequest() - assert args[0] == request_msg @@ -11753,7 +11790,6 @@ def test_get_dataset_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetDatasetRequest() - assert args[0] == request_msg @@ -11774,7 +11810,6 @@ def test_list_datasets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListDatasetsRequest() - assert args[0] == request_msg @@ -11795,7 +11830,6 @@ def test_update_dataset_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateDatasetRequest() - assert args[0] == request_msg @@ -11816,7 +11850,6 @@ def test_delete_dataset_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteDatasetRequest() - assert args[0] == request_msg @@ -11837,7 +11870,6 @@ def test_import_data_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ImportDataRequest() - assert args[0] == request_msg @@ -11858,7 +11890,6 @@ def test_export_data_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ExportDataRequest() - assert args[0] == request_msg @@ -11881,7 +11912,6 @@ def test_get_annotation_spec_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetAnnotationSpecRequest() - assert args[0] == request_msg @@ -11902,7 +11932,6 @@ def test_create_model_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateModelRequest() - assert args[0] == request_msg @@ -11923,7 +11952,6 @@ def test_get_model_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetModelRequest() - assert args[0] == request_msg @@ -11944,7 +11972,6 @@ def test_list_models_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListModelsRequest() - assert args[0] == request_msg @@ -11965,7 +11992,6 @@ def test_delete_model_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteModelRequest() - assert args[0] == request_msg @@ -11986,7 +12012,6 @@ def test_update_model_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateModelRequest() - assert args[0] == request_msg @@ -12007,7 +12032,6 @@ def test_deploy_model_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeployModelRequest() - assert args[0] == request_msg @@ -12028,7 +12052,6 @@ def test_undeploy_model_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UndeployModelRequest() - assert args[0] == request_msg @@ -12049,7 +12072,6 @@ def test_export_model_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ExportModelRequest() - assert args[0] == request_msg @@ -12072,7 +12094,6 @@ def test_get_model_evaluation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetModelEvaluationRequest() - assert args[0] == request_msg @@ -12095,7 +12116,6 @@ def test_list_model_evaluations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListModelEvaluationsRequest() - assert args[0] == request_msg @@ -12134,7 +12154,6 @@ async def test_create_dataset_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateDatasetRequest() - assert args[0] == request_msg @@ -12165,7 +12184,6 @@ async def test_get_dataset_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetDatasetRequest() - assert args[0] == request_msg @@ -12192,7 +12210,6 @@ async def test_list_datasets_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListDatasetsRequest() - assert args[0] == request_msg @@ -12223,7 +12240,6 @@ async def test_update_dataset_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateDatasetRequest() - assert args[0] == request_msg @@ -12248,7 +12264,6 @@ async def test_delete_dataset_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteDatasetRequest() - assert args[0] == request_msg @@ -12273,7 +12288,6 @@ async def test_import_data_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ImportDataRequest() - assert args[0] == request_msg @@ -12298,7 +12312,6 @@ async def test_export_data_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ExportDataRequest() - assert args[0] == request_msg @@ -12329,7 +12342,6 @@ async def test_get_annotation_spec_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetAnnotationSpecRequest() - assert args[0] == request_msg @@ -12354,7 +12366,6 @@ async def test_create_model_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateModelRequest() - assert args[0] == request_msg @@ -12385,7 +12396,6 @@ async def test_get_model_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetModelRequest() - assert args[0] == request_msg @@ -12412,7 +12422,6 @@ async def test_list_models_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListModelsRequest() - assert args[0] == request_msg @@ -12437,7 +12446,6 @@ async def test_delete_model_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteModelRequest() - assert args[0] == request_msg @@ -12468,7 +12476,6 @@ async def test_update_model_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateModelRequest() - assert args[0] == request_msg @@ -12493,7 +12500,6 @@ async def test_deploy_model_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeployModelRequest() - assert args[0] == request_msg @@ -12518,7 +12524,6 @@ async def test_undeploy_model_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UndeployModelRequest() - assert args[0] == request_msg @@ -12543,7 +12548,6 @@ async def test_export_model_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ExportModelRequest() - assert args[0] == request_msg @@ -12575,7 +12579,6 @@ async def test_get_model_evaluation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetModelEvaluationRequest() - assert args[0] == request_msg @@ -12604,7 +12607,6 @@ async def test_list_model_evaluations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListModelEvaluationsRequest() - assert args[0] == request_msg @@ -15249,7 +15251,6 @@ def test_create_dataset_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateDatasetRequest() - assert args[0] == request_msg @@ -15269,7 +15270,6 @@ def test_get_dataset_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetDatasetRequest() - assert args[0] == request_msg @@ -15289,7 +15289,6 @@ def test_list_datasets_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListDatasetsRequest() - assert args[0] == request_msg @@ -15309,7 +15308,6 @@ def test_update_dataset_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateDatasetRequest() - assert args[0] == request_msg @@ -15329,7 +15327,6 @@ def test_delete_dataset_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteDatasetRequest() - assert args[0] == request_msg @@ -15349,7 +15346,6 @@ def test_import_data_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ImportDataRequest() - assert args[0] == request_msg @@ -15369,7 +15365,6 @@ def test_export_data_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ExportDataRequest() - assert args[0] == request_msg @@ -15391,7 +15386,6 @@ def test_get_annotation_spec_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetAnnotationSpecRequest() - assert args[0] == request_msg @@ -15411,7 +15405,6 @@ def test_create_model_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateModelRequest() - assert args[0] == request_msg @@ -15431,7 +15424,6 @@ def test_get_model_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetModelRequest() - assert args[0] == request_msg @@ -15451,7 +15443,6 @@ def test_list_models_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListModelsRequest() - assert args[0] == request_msg @@ -15471,7 +15462,6 @@ def test_delete_model_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteModelRequest() - assert args[0] == request_msg @@ -15491,7 +15481,6 @@ def test_update_model_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateModelRequest() - assert args[0] == request_msg @@ -15511,7 +15500,6 @@ def test_deploy_model_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeployModelRequest() - assert args[0] == request_msg @@ -15531,7 +15519,6 @@ def test_undeploy_model_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UndeployModelRequest() - assert args[0] == request_msg @@ -15551,7 +15538,6 @@ def test_export_model_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ExportModelRequest() - assert args[0] == request_msg @@ -15573,7 +15559,6 @@ def test_get_model_evaluation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetModelEvaluationRequest() - assert args[0] == request_msg @@ -15595,7 +15580,6 @@ def test_list_model_evaluations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListModelEvaluationsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-automl/tests/unit/gapic/automl_v1/test_prediction_service.py b/packages/google-cloud-automl/tests/unit/gapic/automl_v1/test_prediction_service.py index 150a650704b4..cf85eece4953 100644 --- a/packages/google-cloud-automl/tests/unit/gapic/automl_v1/test_prediction_service.py +++ b/packages/google-cloud-automl/tests/unit/gapic/automl_v1/test_prediction_service.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 @@ -119,6 +120,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" @@ -1360,8 +1376,8 @@ def test_prediction_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - prediction_service.PredictRequest, - dict, + prediction_service.PredictRequest(), + {}, ], ) def test_predict(request_type, transport: str = "grpc"): @@ -1372,7 +1388,7 @@ def test_predict(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.predict), "__call__") as call: @@ -1413,9 +1429,10 @@ def test_predict_non_empty_request_with_auto_populated_field(): client.predict(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == prediction_service.PredictRequest( + request_msg = prediction_service.PredictRequest( name="name_value", ) + assert args[0] == request_msg def test_predict_use_cached_wrapped_rpc(): @@ -1494,9 +1511,14 @@ async def test_predict_async_use_cached_wrapped_rpc(transport: str = "grpc_async @pytest.mark.asyncio -async def test_predict_async( - transport: str = "grpc_asyncio", request_type=prediction_service.PredictRequest -): +@pytest.mark.parametrize( + "request_type", + [ + prediction_service.PredictRequest(), + {}, + ], +) +async def test_predict_async(request_type, transport: str = "grpc_asyncio"): client = PredictionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1504,7 +1526,7 @@ async def test_predict_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.predict), "__call__") as call: @@ -1524,11 +1546,6 @@ async def test_predict_async( assert isinstance(response, prediction_service.PredictResponse) -@pytest.mark.asyncio -async def test_predict_async_from_dict(): - await test_predict_async(request_type=dict) - - def test_predict_field_headers(): client = PredictionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1707,8 +1724,8 @@ async def test_predict_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - prediction_service.BatchPredictRequest, - dict, + prediction_service.BatchPredictRequest(), + {}, ], ) def test_batch_predict(request_type, transport: str = "grpc"): @@ -1719,7 +1736,7 @@ def test_batch_predict(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.batch_predict), "__call__") as call: @@ -1760,9 +1777,10 @@ def test_batch_predict_non_empty_request_with_auto_populated_field(): client.batch_predict(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == prediction_service.BatchPredictRequest( + request_msg = prediction_service.BatchPredictRequest( name="name_value", ) + assert args[0] == request_msg def test_batch_predict_use_cached_wrapped_rpc(): @@ -1853,9 +1871,14 @@ async def test_batch_predict_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_batch_predict_async( - transport: str = "grpc_asyncio", request_type=prediction_service.BatchPredictRequest -): +@pytest.mark.parametrize( + "request_type", + [ + prediction_service.BatchPredictRequest(), + {}, + ], +) +async def test_batch_predict_async(request_type, transport: str = "grpc_asyncio"): client = PredictionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1863,7 +1886,7 @@ async def test_batch_predict_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.batch_predict), "__call__") as call: @@ -1883,11 +1906,6 @@ async def test_batch_predict_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_batch_predict_async_from_dict(): - await test_batch_predict_async(request_type=dict) - - def test_batch_predict_field_headers(): client = PredictionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2618,7 +2636,6 @@ def test_predict_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = prediction_service.PredictRequest() - assert args[0] == request_msg @@ -2639,7 +2656,6 @@ def test_batch_predict_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = prediction_service.BatchPredictRequest() - assert args[0] == request_msg @@ -2678,7 +2694,6 @@ async def test_predict_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = prediction_service.PredictRequest() - assert args[0] == request_msg @@ -2703,7 +2718,6 @@ async def test_batch_predict_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = prediction_service.BatchPredictRequest() - assert args[0] == request_msg @@ -2990,7 +3004,6 @@ def test_predict_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = prediction_service.PredictRequest() - assert args[0] == request_msg @@ -3010,7 +3023,6 @@ def test_batch_predict_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = prediction_service.BatchPredictRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-automl/tests/unit/gapic/automl_v1beta1/test_auto_ml.py b/packages/google-cloud-automl/tests/unit/gapic/automl_v1beta1/test_auto_ml.py index bfdfcb0279fc..955fbaec3f85 100644 --- a/packages/google-cloud-automl/tests/unit/gapic/automl_v1beta1/test_auto_ml.py +++ b/packages/google-cloud-automl/tests/unit/gapic/automl_v1beta1/test_auto_ml.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 @@ -141,6 +142,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" @@ -1273,8 +1289,8 @@ def test_auto_ml_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - service.CreateDatasetRequest, - dict, + service.CreateDatasetRequest(), + {}, ], ) def test_create_dataset(request_type, transport: str = "grpc"): @@ -1285,7 +1301,7 @@ def test_create_dataset(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_dataset), "__call__") as call: @@ -1337,9 +1353,10 @@ def test_create_dataset_non_empty_request_with_auto_populated_field(): client.create_dataset(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateDatasetRequest( + request_msg = service.CreateDatasetRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_dataset_use_cached_wrapped_rpc(): @@ -1420,9 +1437,14 @@ async def test_create_dataset_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_dataset_async( - transport: str = "grpc_asyncio", request_type=service.CreateDatasetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CreateDatasetRequest(), + {}, + ], +) +async def test_create_dataset_async(request_type, transport: str = "grpc_asyncio"): client = AutoMlAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1430,7 +1452,7 @@ async def test_create_dataset_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_dataset), "__call__") as call: @@ -1461,11 +1483,6 @@ async def test_create_dataset_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_create_dataset_async_from_dict(): - await test_create_dataset_async(request_type=dict) - - def test_create_dataset_field_headers(): client = AutoMlClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1642,8 +1659,8 @@ async def test_create_dataset_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.GetDatasetRequest, - dict, + service.GetDatasetRequest(), + {}, ], ) def test_get_dataset(request_type, transport: str = "grpc"): @@ -1654,7 +1671,7 @@ def test_get_dataset(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_dataset), "__call__") as call: @@ -1706,9 +1723,10 @@ def test_get_dataset_non_empty_request_with_auto_populated_field(): client.get_dataset(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetDatasetRequest( + request_msg = service.GetDatasetRequest( name="name_value", ) + assert args[0] == request_msg def test_get_dataset_use_cached_wrapped_rpc(): @@ -1789,9 +1807,14 @@ async def test_get_dataset_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_dataset_async( - transport: str = "grpc_asyncio", request_type=service.GetDatasetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetDatasetRequest(), + {}, + ], +) +async def test_get_dataset_async(request_type, transport: str = "grpc_asyncio"): client = AutoMlAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1799,7 +1822,7 @@ async def test_get_dataset_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_dataset), "__call__") as call: @@ -1830,11 +1853,6 @@ async def test_get_dataset_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_dataset_async_from_dict(): - await test_get_dataset_async(request_type=dict) - - def test_get_dataset_field_headers(): client = AutoMlClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1977,8 +1995,8 @@ async def test_get_dataset_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListDatasetsRequest, - dict, + service.ListDatasetsRequest(), + {}, ], ) def test_list_datasets(request_type, transport: str = "grpc"): @@ -1989,7 +2007,7 @@ def test_list_datasets(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_datasets), "__call__") as call: @@ -2035,11 +2053,12 @@ def test_list_datasets_non_empty_request_with_auto_populated_field(): client.list_datasets(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListDatasetsRequest( + request_msg = service.ListDatasetsRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_datasets_use_cached_wrapped_rpc(): @@ -2120,9 +2139,14 @@ async def test_list_datasets_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_datasets_async( - transport: str = "grpc_asyncio", request_type=service.ListDatasetsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListDatasetsRequest(), + {}, + ], +) +async def test_list_datasets_async(request_type, transport: str = "grpc_asyncio"): client = AutoMlAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2130,7 +2154,7 @@ async def test_list_datasets_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_datasets), "__call__") as call: @@ -2153,11 +2177,6 @@ async def test_list_datasets_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_datasets_async_from_dict(): - await test_list_datasets_async(request_type=dict) - - def test_list_datasets_field_headers(): client = AutoMlClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2494,8 +2513,8 @@ async def test_list_datasets_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.UpdateDatasetRequest, - dict, + service.UpdateDatasetRequest(), + {}, ], ) def test_update_dataset(request_type, transport: str = "grpc"): @@ -2506,7 +2525,7 @@ def test_update_dataset(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_dataset), "__call__") as call: @@ -2556,7 +2575,8 @@ def test_update_dataset_non_empty_request_with_auto_populated_field(): client.update_dataset(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateDatasetRequest() + request_msg = service.UpdateDatasetRequest() + assert args[0] == request_msg def test_update_dataset_use_cached_wrapped_rpc(): @@ -2637,9 +2657,14 @@ async def test_update_dataset_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_dataset_async( - transport: str = "grpc_asyncio", request_type=service.UpdateDatasetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateDatasetRequest(), + {}, + ], +) +async def test_update_dataset_async(request_type, transport: str = "grpc_asyncio"): client = AutoMlAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2647,7 +2672,7 @@ async def test_update_dataset_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_dataset), "__call__") as call: @@ -2678,11 +2703,6 @@ async def test_update_dataset_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_update_dataset_async_from_dict(): - await test_update_dataset_async(request_type=dict) - - def test_update_dataset_field_headers(): client = AutoMlClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2849,8 +2869,8 @@ async def test_update_dataset_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DeleteDatasetRequest, - dict, + service.DeleteDatasetRequest(), + {}, ], ) def test_delete_dataset(request_type, transport: str = "grpc"): @@ -2861,7 +2881,7 @@ def test_delete_dataset(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_dataset), "__call__") as call: @@ -2902,9 +2922,10 @@ def test_delete_dataset_non_empty_request_with_auto_populated_field(): client.delete_dataset(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteDatasetRequest( + request_msg = service.DeleteDatasetRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_dataset_use_cached_wrapped_rpc(): @@ -2995,9 +3016,14 @@ async def test_delete_dataset_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_dataset_async( - transport: str = "grpc_asyncio", request_type=service.DeleteDatasetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteDatasetRequest(), + {}, + ], +) +async def test_delete_dataset_async(request_type, transport: str = "grpc_asyncio"): client = AutoMlAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3005,7 +3031,7 @@ async def test_delete_dataset_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_dataset), "__call__") as call: @@ -3025,11 +3051,6 @@ async def test_delete_dataset_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_dataset_async_from_dict(): - await test_delete_dataset_async(request_type=dict) - - def test_delete_dataset_field_headers(): client = AutoMlClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3176,8 +3197,8 @@ async def test_delete_dataset_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ImportDataRequest, - dict, + service.ImportDataRequest(), + {}, ], ) def test_import_data(request_type, transport: str = "grpc"): @@ -3188,7 +3209,7 @@ def test_import_data(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.import_data), "__call__") as call: @@ -3229,9 +3250,10 @@ def test_import_data_non_empty_request_with_auto_populated_field(): client.import_data(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ImportDataRequest( + request_msg = service.ImportDataRequest( name="name_value", ) + assert args[0] == request_msg def test_import_data_use_cached_wrapped_rpc(): @@ -3322,9 +3344,14 @@ async def test_import_data_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_import_data_async( - transport: str = "grpc_asyncio", request_type=service.ImportDataRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ImportDataRequest(), + {}, + ], +) +async def test_import_data_async(request_type, transport: str = "grpc_asyncio"): client = AutoMlAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3332,7 +3359,7 @@ async def test_import_data_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.import_data), "__call__") as call: @@ -3352,11 +3379,6 @@ async def test_import_data_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_import_data_async_from_dict(): - await test_import_data_async(request_type=dict) - - def test_import_data_field_headers(): client = AutoMlClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3525,8 +3547,8 @@ async def test_import_data_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ExportDataRequest, - dict, + service.ExportDataRequest(), + {}, ], ) def test_export_data(request_type, transport: str = "grpc"): @@ -3537,7 +3559,7 @@ def test_export_data(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.export_data), "__call__") as call: @@ -3578,9 +3600,10 @@ def test_export_data_non_empty_request_with_auto_populated_field(): client.export_data(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ExportDataRequest( + request_msg = service.ExportDataRequest( name="name_value", ) + assert args[0] == request_msg def test_export_data_use_cached_wrapped_rpc(): @@ -3671,9 +3694,14 @@ async def test_export_data_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_export_data_async( - transport: str = "grpc_asyncio", request_type=service.ExportDataRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ExportDataRequest(), + {}, + ], +) +async def test_export_data_async(request_type, transport: str = "grpc_asyncio"): client = AutoMlAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3681,7 +3709,7 @@ async def test_export_data_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.export_data), "__call__") as call: @@ -3701,11 +3729,6 @@ async def test_export_data_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_export_data_async_from_dict(): - await test_export_data_async(request_type=dict) - - def test_export_data_field_headers(): client = AutoMlClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3886,8 +3909,8 @@ async def test_export_data_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.GetAnnotationSpecRequest, - dict, + service.GetAnnotationSpecRequest(), + {}, ], ) def test_get_annotation_spec(request_type, transport: str = "grpc"): @@ -3898,7 +3921,7 @@ def test_get_annotation_spec(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3950,9 +3973,10 @@ def test_get_annotation_spec_non_empty_request_with_auto_populated_field(): client.get_annotation_spec(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetAnnotationSpecRequest( + request_msg = service.GetAnnotationSpecRequest( name="name_value", ) + assert args[0] == request_msg def test_get_annotation_spec_use_cached_wrapped_rpc(): @@ -4037,9 +4061,14 @@ async def test_get_annotation_spec_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_annotation_spec_async( - transport: str = "grpc_asyncio", request_type=service.GetAnnotationSpecRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetAnnotationSpecRequest(), + {}, + ], +) +async def test_get_annotation_spec_async(request_type, transport: str = "grpc_asyncio"): client = AutoMlAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4047,7 +4076,7 @@ async def test_get_annotation_spec_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( @@ -4076,11 +4105,6 @@ async def test_get_annotation_spec_async( assert response.example_count == 1396 -@pytest.mark.asyncio -async def test_get_annotation_spec_async_from_dict(): - await test_get_annotation_spec_async(request_type=dict) - - def test_get_annotation_spec_field_headers(): client = AutoMlClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4235,8 +4259,8 @@ async def test_get_annotation_spec_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.GetTableSpecRequest, - dict, + service.GetTableSpecRequest(), + {}, ], ) def test_get_table_spec(request_type, transport: str = "grpc"): @@ -4247,7 +4271,7 @@ def test_get_table_spec(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_table_spec), "__call__") as call: @@ -4301,9 +4325,10 @@ def test_get_table_spec_non_empty_request_with_auto_populated_field(): client.get_table_spec(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetTableSpecRequest( + request_msg = service.GetTableSpecRequest( name="name_value", ) + assert args[0] == request_msg def test_get_table_spec_use_cached_wrapped_rpc(): @@ -4384,9 +4409,14 @@ async def test_get_table_spec_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_table_spec_async( - transport: str = "grpc_asyncio", request_type=service.GetTableSpecRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetTableSpecRequest(), + {}, + ], +) +async def test_get_table_spec_async(request_type, transport: str = "grpc_asyncio"): client = AutoMlAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4394,7 +4424,7 @@ async def test_get_table_spec_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_table_spec), "__call__") as call: @@ -4427,11 +4457,6 @@ async def test_get_table_spec_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_table_spec_async_from_dict(): - await test_get_table_spec_async(request_type=dict) - - def test_get_table_spec_field_headers(): client = AutoMlClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4578,8 +4603,8 @@ async def test_get_table_spec_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListTableSpecsRequest, - dict, + service.ListTableSpecsRequest(), + {}, ], ) def test_list_table_specs(request_type, transport: str = "grpc"): @@ -4590,7 +4615,7 @@ def test_list_table_specs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_table_specs), "__call__") as call: @@ -4636,11 +4661,12 @@ def test_list_table_specs_non_empty_request_with_auto_populated_field(): client.list_table_specs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListTableSpecsRequest( + request_msg = service.ListTableSpecsRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_table_specs_use_cached_wrapped_rpc(): @@ -4723,9 +4749,14 @@ async def test_list_table_specs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_table_specs_async( - transport: str = "grpc_asyncio", request_type=service.ListTableSpecsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListTableSpecsRequest(), + {}, + ], +) +async def test_list_table_specs_async(request_type, transport: str = "grpc_asyncio"): client = AutoMlAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4733,7 +4764,7 @@ async def test_list_table_specs_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_table_specs), "__call__") as call: @@ -4756,11 +4787,6 @@ async def test_list_table_specs_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_table_specs_async_from_dict(): - await test_list_table_specs_async(request_type=dict) - - def test_list_table_specs_field_headers(): client = AutoMlClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5097,8 +5123,8 @@ async def test_list_table_specs_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.UpdateTableSpecRequest, - dict, + service.UpdateTableSpecRequest(), + {}, ], ) def test_update_table_spec(request_type, transport: str = "grpc"): @@ -5109,7 +5135,7 @@ def test_update_table_spec(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5165,7 +5191,8 @@ def test_update_table_spec_non_empty_request_with_auto_populated_field(): client.update_table_spec(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateTableSpecRequest() + request_msg = service.UpdateTableSpecRequest() + assert args[0] == request_msg def test_update_table_spec_use_cached_wrapped_rpc(): @@ -5248,9 +5275,14 @@ async def test_update_table_spec_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_table_spec_async( - transport: str = "grpc_asyncio", request_type=service.UpdateTableSpecRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateTableSpecRequest(), + {}, + ], +) +async def test_update_table_spec_async(request_type, transport: str = "grpc_asyncio"): client = AutoMlAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5258,7 +5290,7 @@ async def test_update_table_spec_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( @@ -5293,11 +5325,6 @@ async def test_update_table_spec_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_update_table_spec_async_from_dict(): - await test_update_table_spec_async(request_type=dict) - - def test_update_table_spec_field_headers(): client = AutoMlClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5452,8 +5479,8 @@ async def test_update_table_spec_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.GetColumnSpecRequest, - dict, + service.GetColumnSpecRequest(), + {}, ], ) def test_get_column_spec(request_type, transport: str = "grpc"): @@ -5464,7 +5491,7 @@ def test_get_column_spec(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_column_spec), "__call__") as call: @@ -5512,9 +5539,10 @@ def test_get_column_spec_non_empty_request_with_auto_populated_field(): client.get_column_spec(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetColumnSpecRequest( + request_msg = service.GetColumnSpecRequest( name="name_value", ) + assert args[0] == request_msg def test_get_column_spec_use_cached_wrapped_rpc(): @@ -5595,9 +5623,14 @@ async def test_get_column_spec_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_column_spec_async( - transport: str = "grpc_asyncio", request_type=service.GetColumnSpecRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetColumnSpecRequest(), + {}, + ], +) +async def test_get_column_spec_async(request_type, transport: str = "grpc_asyncio"): client = AutoMlAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5605,7 +5638,7 @@ async def test_get_column_spec_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_column_spec), "__call__") as call: @@ -5632,11 +5665,6 @@ async def test_get_column_spec_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_column_spec_async_from_dict(): - await test_get_column_spec_async(request_type=dict) - - def test_get_column_spec_field_headers(): client = AutoMlClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5783,8 +5811,8 @@ async def test_get_column_spec_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListColumnSpecsRequest, - dict, + service.ListColumnSpecsRequest(), + {}, ], ) def test_list_column_specs(request_type, transport: str = "grpc"): @@ -5795,7 +5823,7 @@ def test_list_column_specs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5845,11 +5873,12 @@ def test_list_column_specs_non_empty_request_with_auto_populated_field(): client.list_column_specs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListColumnSpecsRequest( + request_msg = service.ListColumnSpecsRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_column_specs_use_cached_wrapped_rpc(): @@ -5932,9 +5961,14 @@ async def test_list_column_specs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_column_specs_async( - transport: str = "grpc_asyncio", request_type=service.ListColumnSpecsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListColumnSpecsRequest(), + {}, + ], +) +async def test_list_column_specs_async(request_type, transport: str = "grpc_asyncio"): client = AutoMlAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5942,7 +5976,7 @@ async def test_list_column_specs_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( @@ -5967,11 +6001,6 @@ async def test_list_column_specs_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_column_specs_async_from_dict(): - await test_list_column_specs_async(request_type=dict) - - def test_list_column_specs_field_headers(): client = AutoMlClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6324,8 +6353,8 @@ async def test_list_column_specs_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.UpdateColumnSpecRequest, - dict, + service.UpdateColumnSpecRequest(), + {}, ], ) def test_update_column_spec(request_type, transport: str = "grpc"): @@ -6336,7 +6365,7 @@ def test_update_column_spec(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6386,7 +6415,8 @@ def test_update_column_spec_non_empty_request_with_auto_populated_field(): client.update_column_spec(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateColumnSpecRequest() + request_msg = service.UpdateColumnSpecRequest() + assert args[0] == request_msg def test_update_column_spec_use_cached_wrapped_rpc(): @@ -6471,9 +6501,14 @@ async def test_update_column_spec_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_column_spec_async( - transport: str = "grpc_asyncio", request_type=service.UpdateColumnSpecRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateColumnSpecRequest(), + {}, + ], +) +async def test_update_column_spec_async(request_type, transport: str = "grpc_asyncio"): client = AutoMlAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6481,7 +6516,7 @@ async def test_update_column_spec_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( @@ -6510,11 +6545,6 @@ async def test_update_column_spec_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_update_column_spec_async_from_dict(): - await test_update_column_spec_async(request_type=dict) - - def test_update_column_spec_field_headers(): client = AutoMlClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6669,8 +6699,8 @@ async def test_update_column_spec_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.CreateModelRequest, - dict, + service.CreateModelRequest(), + {}, ], ) def test_create_model(request_type, transport: str = "grpc"): @@ -6681,7 +6711,7 @@ def test_create_model(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_model), "__call__") as call: @@ -6722,9 +6752,10 @@ def test_create_model_non_empty_request_with_auto_populated_field(): client.create_model(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateModelRequest( + request_msg = service.CreateModelRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_model_use_cached_wrapped_rpc(): @@ -6815,9 +6846,14 @@ async def test_create_model_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_model_async( - transport: str = "grpc_asyncio", request_type=service.CreateModelRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CreateModelRequest(), + {}, + ], +) +async def test_create_model_async(request_type, transport: str = "grpc_asyncio"): client = AutoMlAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6825,7 +6861,7 @@ async def test_create_model_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_model), "__call__") as call: @@ -6845,11 +6881,6 @@ async def test_create_model_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_model_async_from_dict(): - await test_create_model_async(request_type=dict) - - def test_create_model_field_headers(): client = AutoMlClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7030,8 +7061,8 @@ async def test_create_model_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.GetModelRequest, - dict, + service.GetModelRequest(), + {}, ], ) def test_get_model(request_type, transport: str = "grpc"): @@ -7042,7 +7073,7 @@ def test_get_model(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_model), "__call__") as call: @@ -7092,9 +7123,10 @@ def test_get_model_non_empty_request_with_auto_populated_field(): client.get_model(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetModelRequest( + request_msg = service.GetModelRequest( name="name_value", ) + assert args[0] == request_msg def test_get_model_use_cached_wrapped_rpc(): @@ -7173,9 +7205,14 @@ async def test_get_model_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_model_async( - transport: str = "grpc_asyncio", request_type=service.GetModelRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetModelRequest(), + {}, + ], +) +async def test_get_model_async(request_type, transport: str = "grpc_asyncio"): client = AutoMlAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7183,7 +7220,7 @@ async def test_get_model_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_model), "__call__") as call: @@ -7212,11 +7249,6 @@ async def test_get_model_async( assert response.deployment_state == model.Model.DeploymentState.DEPLOYED -@pytest.mark.asyncio -async def test_get_model_async_from_dict(): - await test_get_model_async(request_type=dict) - - def test_get_model_field_headers(): client = AutoMlClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7359,8 +7391,8 @@ async def test_get_model_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListModelsRequest, - dict, + service.ListModelsRequest(), + {}, ], ) def test_list_models(request_type, transport: str = "grpc"): @@ -7371,7 +7403,7 @@ def test_list_models(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_models), "__call__") as call: @@ -7417,11 +7449,12 @@ def test_list_models_non_empty_request_with_auto_populated_field(): client.list_models(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListModelsRequest( + request_msg = service.ListModelsRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_models_use_cached_wrapped_rpc(): @@ -7502,9 +7535,14 @@ async def test_list_models_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_models_async( - transport: str = "grpc_asyncio", request_type=service.ListModelsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListModelsRequest(), + {}, + ], +) +async def test_list_models_async(request_type, transport: str = "grpc_asyncio"): client = AutoMlAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7512,7 +7550,7 @@ async def test_list_models_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_models), "__call__") as call: @@ -7535,11 +7573,6 @@ async def test_list_models_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_models_async_from_dict(): - await test_list_models_async(request_type=dict) - - def test_list_models_field_headers(): client = AutoMlClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7876,8 +7909,8 @@ async def test_list_models_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.DeleteModelRequest, - dict, + service.DeleteModelRequest(), + {}, ], ) def test_delete_model(request_type, transport: str = "grpc"): @@ -7888,7 +7921,7 @@ def test_delete_model(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_model), "__call__") as call: @@ -7929,9 +7962,10 @@ def test_delete_model_non_empty_request_with_auto_populated_field(): client.delete_model(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteModelRequest( + request_msg = service.DeleteModelRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_model_use_cached_wrapped_rpc(): @@ -8022,9 +8056,14 @@ async def test_delete_model_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_model_async( - transport: str = "grpc_asyncio", request_type=service.DeleteModelRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteModelRequest(), + {}, + ], +) +async def test_delete_model_async(request_type, transport: str = "grpc_asyncio"): client = AutoMlAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8032,7 +8071,7 @@ async def test_delete_model_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_model), "__call__") as call: @@ -8052,11 +8091,6 @@ async def test_delete_model_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_model_async_from_dict(): - await test_delete_model_async(request_type=dict) - - def test_delete_model_field_headers(): client = AutoMlClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8203,8 +8237,8 @@ async def test_delete_model_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DeployModelRequest, - dict, + service.DeployModelRequest(), + {}, ], ) def test_deploy_model(request_type, transport: str = "grpc"): @@ -8215,7 +8249,7 @@ def test_deploy_model(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.deploy_model), "__call__") as call: @@ -8256,9 +8290,10 @@ def test_deploy_model_non_empty_request_with_auto_populated_field(): client.deploy_model(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeployModelRequest( + request_msg = service.DeployModelRequest( name="name_value", ) + assert args[0] == request_msg def test_deploy_model_use_cached_wrapped_rpc(): @@ -8349,9 +8384,14 @@ async def test_deploy_model_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_deploy_model_async( - transport: str = "grpc_asyncio", request_type=service.DeployModelRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.DeployModelRequest(), + {}, + ], +) +async def test_deploy_model_async(request_type, transport: str = "grpc_asyncio"): client = AutoMlAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8359,7 +8399,7 @@ async def test_deploy_model_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.deploy_model), "__call__") as call: @@ -8379,11 +8419,6 @@ async def test_deploy_model_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_deploy_model_async_from_dict(): - await test_deploy_model_async(request_type=dict) - - def test_deploy_model_field_headers(): client = AutoMlClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8530,8 +8565,8 @@ async def test_deploy_model_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.UndeployModelRequest, - dict, + service.UndeployModelRequest(), + {}, ], ) def test_undeploy_model(request_type, transport: str = "grpc"): @@ -8542,7 +8577,7 @@ def test_undeploy_model(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.undeploy_model), "__call__") as call: @@ -8583,9 +8618,10 @@ def test_undeploy_model_non_empty_request_with_auto_populated_field(): client.undeploy_model(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UndeployModelRequest( + request_msg = service.UndeployModelRequest( name="name_value", ) + assert args[0] == request_msg def test_undeploy_model_use_cached_wrapped_rpc(): @@ -8676,9 +8712,14 @@ async def test_undeploy_model_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_undeploy_model_async( - transport: str = "grpc_asyncio", request_type=service.UndeployModelRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.UndeployModelRequest(), + {}, + ], +) +async def test_undeploy_model_async(request_type, transport: str = "grpc_asyncio"): client = AutoMlAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8686,7 +8727,7 @@ async def test_undeploy_model_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.undeploy_model), "__call__") as call: @@ -8706,11 +8747,6 @@ async def test_undeploy_model_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_undeploy_model_async_from_dict(): - await test_undeploy_model_async(request_type=dict) - - def test_undeploy_model_field_headers(): client = AutoMlClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8857,8 +8893,8 @@ async def test_undeploy_model_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ExportModelRequest, - dict, + service.ExportModelRequest(), + {}, ], ) def test_export_model(request_type, transport: str = "grpc"): @@ -8869,7 +8905,7 @@ def test_export_model(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.export_model), "__call__") as call: @@ -8910,9 +8946,10 @@ def test_export_model_non_empty_request_with_auto_populated_field(): client.export_model(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ExportModelRequest( + request_msg = service.ExportModelRequest( name="name_value", ) + assert args[0] == request_msg def test_export_model_use_cached_wrapped_rpc(): @@ -9003,9 +9040,14 @@ async def test_export_model_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_export_model_async( - transport: str = "grpc_asyncio", request_type=service.ExportModelRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ExportModelRequest(), + {}, + ], +) +async def test_export_model_async(request_type, transport: str = "grpc_asyncio"): client = AutoMlAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9013,7 +9055,7 @@ async def test_export_model_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.export_model), "__call__") as call: @@ -9033,11 +9075,6 @@ async def test_export_model_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_export_model_async_from_dict(): - await test_export_model_async(request_type=dict) - - def test_export_model_field_headers(): client = AutoMlClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9218,8 +9255,8 @@ async def test_export_model_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ExportEvaluatedExamplesRequest, - dict, + service.ExportEvaluatedExamplesRequest(), + {}, ], ) def test_export_evaluated_examples(request_type, transport: str = "grpc"): @@ -9230,7 +9267,7 @@ def test_export_evaluated_examples(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9275,9 +9312,10 @@ def test_export_evaluated_examples_non_empty_request_with_auto_populated_field() client.export_evaluated_examples(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ExportEvaluatedExamplesRequest( + request_msg = service.ExportEvaluatedExamplesRequest( name="name_value", ) + assert args[0] == request_msg def test_export_evaluated_examples_use_cached_wrapped_rpc(): @@ -9373,8 +9411,15 @@ async def test_export_evaluated_examples_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.ExportEvaluatedExamplesRequest(), + {}, + ], +) async def test_export_evaluated_examples_async( - transport: str = "grpc_asyncio", request_type=service.ExportEvaluatedExamplesRequest + request_type, transport: str = "grpc_asyncio" ): client = AutoMlAsyncClient( credentials=async_anonymous_credentials(), @@ -9383,7 +9428,7 @@ async def test_export_evaluated_examples_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( @@ -9405,11 +9450,6 @@ async def test_export_evaluated_examples_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_export_evaluated_examples_async_from_dict(): - await test_export_evaluated_examples_async(request_type=dict) - - def test_export_evaluated_examples_field_headers(): client = AutoMlClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9594,8 +9634,8 @@ async def test_export_evaluated_examples_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.GetModelEvaluationRequest, - dict, + service.GetModelEvaluationRequest(), + {}, ], ) def test_get_model_evaluation(request_type, transport: str = "grpc"): @@ -9606,7 +9646,7 @@ def test_get_model_evaluation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9660,9 +9700,10 @@ def test_get_model_evaluation_non_empty_request_with_auto_populated_field(): client.get_model_evaluation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetModelEvaluationRequest( + request_msg = service.GetModelEvaluationRequest( name="name_value", ) + assert args[0] == request_msg def test_get_model_evaluation_use_cached_wrapped_rpc(): @@ -9747,8 +9788,15 @@ async def test_get_model_evaluation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.GetModelEvaluationRequest(), + {}, + ], +) async def test_get_model_evaluation_async( - transport: str = "grpc_asyncio", request_type=service.GetModelEvaluationRequest + request_type, transport: str = "grpc_asyncio" ): client = AutoMlAsyncClient( credentials=async_anonymous_credentials(), @@ -9757,7 +9805,7 @@ async def test_get_model_evaluation_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( @@ -9788,11 +9836,6 @@ async def test_get_model_evaluation_async( assert response.evaluated_example_count == 2446 -@pytest.mark.asyncio -async def test_get_model_evaluation_async_from_dict(): - await test_get_model_evaluation_async(request_type=dict) - - def test_get_model_evaluation_field_headers(): client = AutoMlClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9947,8 +9990,8 @@ async def test_get_model_evaluation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListModelEvaluationsRequest, - dict, + service.ListModelEvaluationsRequest(), + {}, ], ) def test_list_model_evaluations(request_type, transport: str = "grpc"): @@ -9959,7 +10002,7 @@ def test_list_model_evaluations(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10009,11 +10052,12 @@ def test_list_model_evaluations_non_empty_request_with_auto_populated_field(): client.list_model_evaluations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListModelEvaluationsRequest( + request_msg = service.ListModelEvaluationsRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_model_evaluations_use_cached_wrapped_rpc(): @@ -10099,8 +10143,15 @@ async def test_list_model_evaluations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.ListModelEvaluationsRequest(), + {}, + ], +) async def test_list_model_evaluations_async( - transport: str = "grpc_asyncio", request_type=service.ListModelEvaluationsRequest + request_type, transport: str = "grpc_asyncio" ): client = AutoMlAsyncClient( credentials=async_anonymous_credentials(), @@ -10109,7 +10160,7 @@ async def test_list_model_evaluations_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( @@ -10134,11 +10185,6 @@ async def test_list_model_evaluations_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_model_evaluations_async_from_dict(): - await test_list_model_evaluations_async(request_type=dict) - - def test_list_model_evaluations_field_headers(): client = AutoMlClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15412,7 +15458,6 @@ def test_create_dataset_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateDatasetRequest() - assert args[0] == request_msg @@ -15433,7 +15478,6 @@ def test_get_dataset_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetDatasetRequest() - assert args[0] == request_msg @@ -15454,7 +15498,6 @@ def test_list_datasets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListDatasetsRequest() - assert args[0] == request_msg @@ -15475,7 +15518,6 @@ def test_update_dataset_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateDatasetRequest() - assert args[0] == request_msg @@ -15496,7 +15538,6 @@ def test_delete_dataset_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteDatasetRequest() - assert args[0] == request_msg @@ -15517,7 +15558,6 @@ def test_import_data_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ImportDataRequest() - assert args[0] == request_msg @@ -15538,7 +15578,6 @@ def test_export_data_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ExportDataRequest() - assert args[0] == request_msg @@ -15561,7 +15600,6 @@ def test_get_annotation_spec_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetAnnotationSpecRequest() - assert args[0] == request_msg @@ -15582,7 +15620,6 @@ def test_get_table_spec_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetTableSpecRequest() - assert args[0] == request_msg @@ -15603,7 +15640,6 @@ def test_list_table_specs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListTableSpecsRequest() - assert args[0] == request_msg @@ -15626,7 +15662,6 @@ def test_update_table_spec_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateTableSpecRequest() - assert args[0] == request_msg @@ -15647,7 +15682,6 @@ def test_get_column_spec_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetColumnSpecRequest() - assert args[0] == request_msg @@ -15670,7 +15704,6 @@ def test_list_column_specs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListColumnSpecsRequest() - assert args[0] == request_msg @@ -15693,7 +15726,6 @@ def test_update_column_spec_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateColumnSpecRequest() - assert args[0] == request_msg @@ -15714,7 +15746,6 @@ def test_create_model_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateModelRequest() - assert args[0] == request_msg @@ -15735,7 +15766,6 @@ def test_get_model_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetModelRequest() - assert args[0] == request_msg @@ -15756,7 +15786,6 @@ def test_list_models_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListModelsRequest() - assert args[0] == request_msg @@ -15777,7 +15806,6 @@ def test_delete_model_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteModelRequest() - assert args[0] == request_msg @@ -15798,7 +15826,6 @@ def test_deploy_model_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeployModelRequest() - assert args[0] == request_msg @@ -15819,7 +15846,6 @@ def test_undeploy_model_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UndeployModelRequest() - assert args[0] == request_msg @@ -15840,7 +15866,6 @@ def test_export_model_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ExportModelRequest() - assert args[0] == request_msg @@ -15863,7 +15888,6 @@ def test_export_evaluated_examples_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ExportEvaluatedExamplesRequest() - assert args[0] == request_msg @@ -15886,7 +15910,6 @@ def test_get_model_evaluation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetModelEvaluationRequest() - assert args[0] == request_msg @@ -15909,7 +15932,6 @@ def test_list_model_evaluations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListModelEvaluationsRequest() - assert args[0] == request_msg @@ -15954,7 +15976,6 @@ async def test_create_dataset_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateDatasetRequest() - assert args[0] == request_msg @@ -15985,7 +16006,6 @@ async def test_get_dataset_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetDatasetRequest() - assert args[0] == request_msg @@ -16012,7 +16032,6 @@ async def test_list_datasets_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListDatasetsRequest() - assert args[0] == request_msg @@ -16043,7 +16062,6 @@ async def test_update_dataset_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateDatasetRequest() - assert args[0] == request_msg @@ -16068,7 +16086,6 @@ async def test_delete_dataset_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteDatasetRequest() - assert args[0] == request_msg @@ -16093,7 +16110,6 @@ async def test_import_data_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ImportDataRequest() - assert args[0] == request_msg @@ -16118,7 +16134,6 @@ async def test_export_data_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ExportDataRequest() - assert args[0] == request_msg @@ -16149,7 +16164,6 @@ async def test_get_annotation_spec_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetAnnotationSpecRequest() - assert args[0] == request_msg @@ -16181,7 +16195,6 @@ async def test_get_table_spec_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetTableSpecRequest() - assert args[0] == request_msg @@ -16208,7 +16221,6 @@ async def test_list_table_specs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListTableSpecsRequest() - assert args[0] == request_msg @@ -16242,7 +16254,6 @@ async def test_update_table_spec_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateTableSpecRequest() - assert args[0] == request_msg @@ -16271,7 +16282,6 @@ async def test_get_column_spec_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetColumnSpecRequest() - assert args[0] == request_msg @@ -16300,7 +16310,6 @@ async def test_list_column_specs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListColumnSpecsRequest() - assert args[0] == request_msg @@ -16331,7 +16340,6 @@ async def test_update_column_spec_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateColumnSpecRequest() - assert args[0] == request_msg @@ -16356,7 +16364,6 @@ async def test_create_model_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateModelRequest() - assert args[0] == request_msg @@ -16386,7 +16393,6 @@ async def test_get_model_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetModelRequest() - assert args[0] == request_msg @@ -16413,7 +16419,6 @@ async def test_list_models_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListModelsRequest() - assert args[0] == request_msg @@ -16438,7 +16443,6 @@ async def test_delete_model_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteModelRequest() - assert args[0] == request_msg @@ -16463,7 +16467,6 @@ async def test_deploy_model_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeployModelRequest() - assert args[0] == request_msg @@ -16488,7 +16491,6 @@ async def test_undeploy_model_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UndeployModelRequest() - assert args[0] == request_msg @@ -16513,7 +16515,6 @@ async def test_export_model_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ExportModelRequest() - assert args[0] == request_msg @@ -16540,7 +16541,6 @@ async def test_export_evaluated_examples_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ExportEvaluatedExamplesRequest() - assert args[0] == request_msg @@ -16572,7 +16572,6 @@ async def test_get_model_evaluation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetModelEvaluationRequest() - assert args[0] == request_msg @@ -16601,7 +16600,6 @@ async def test_list_model_evaluations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListModelEvaluationsRequest() - assert args[0] == request_msg @@ -20220,7 +20218,6 @@ def test_create_dataset_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateDatasetRequest() - assert args[0] == request_msg @@ -20240,7 +20237,6 @@ def test_get_dataset_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetDatasetRequest() - assert args[0] == request_msg @@ -20260,7 +20256,6 @@ def test_list_datasets_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListDatasetsRequest() - assert args[0] == request_msg @@ -20280,7 +20275,6 @@ def test_update_dataset_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateDatasetRequest() - assert args[0] == request_msg @@ -20300,7 +20294,6 @@ def test_delete_dataset_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteDatasetRequest() - assert args[0] == request_msg @@ -20320,7 +20313,6 @@ def test_import_data_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ImportDataRequest() - assert args[0] == request_msg @@ -20340,7 +20332,6 @@ def test_export_data_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ExportDataRequest() - assert args[0] == request_msg @@ -20362,7 +20353,6 @@ def test_get_annotation_spec_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetAnnotationSpecRequest() - assert args[0] == request_msg @@ -20382,7 +20372,6 @@ def test_get_table_spec_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetTableSpecRequest() - assert args[0] == request_msg @@ -20402,7 +20391,6 @@ def test_list_table_specs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListTableSpecsRequest() - assert args[0] == request_msg @@ -20424,7 +20412,6 @@ def test_update_table_spec_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateTableSpecRequest() - assert args[0] == request_msg @@ -20444,7 +20431,6 @@ def test_get_column_spec_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetColumnSpecRequest() - assert args[0] == request_msg @@ -20466,7 +20452,6 @@ def test_list_column_specs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListColumnSpecsRequest() - assert args[0] == request_msg @@ -20488,7 +20473,6 @@ def test_update_column_spec_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateColumnSpecRequest() - assert args[0] == request_msg @@ -20508,7 +20492,6 @@ def test_create_model_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateModelRequest() - assert args[0] == request_msg @@ -20528,7 +20511,6 @@ def test_get_model_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetModelRequest() - assert args[0] == request_msg @@ -20548,7 +20530,6 @@ def test_list_models_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListModelsRequest() - assert args[0] == request_msg @@ -20568,7 +20549,6 @@ def test_delete_model_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteModelRequest() - assert args[0] == request_msg @@ -20588,7 +20568,6 @@ def test_deploy_model_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeployModelRequest() - assert args[0] == request_msg @@ -20608,7 +20587,6 @@ def test_undeploy_model_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UndeployModelRequest() - assert args[0] == request_msg @@ -20628,7 +20606,6 @@ def test_export_model_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ExportModelRequest() - assert args[0] == request_msg @@ -20650,7 +20627,6 @@ def test_export_evaluated_examples_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ExportEvaluatedExamplesRequest() - assert args[0] == request_msg @@ -20672,7 +20648,6 @@ def test_get_model_evaluation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetModelEvaluationRequest() - assert args[0] == request_msg @@ -20694,7 +20669,6 @@ def test_list_model_evaluations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListModelEvaluationsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-automl/tests/unit/gapic/automl_v1beta1/test_prediction_service.py b/packages/google-cloud-automl/tests/unit/gapic/automl_v1beta1/test_prediction_service.py index 82e3197ef322..21b796893bb4 100644 --- a/packages/google-cloud-automl/tests/unit/gapic/automl_v1beta1/test_prediction_service.py +++ b/packages/google-cloud-automl/tests/unit/gapic/automl_v1beta1/test_prediction_service.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 @@ -120,6 +121,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" @@ -1361,8 +1377,8 @@ def test_prediction_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - prediction_service.PredictRequest, - dict, + prediction_service.PredictRequest(), + {}, ], ) def test_predict(request_type, transport: str = "grpc"): @@ -1373,7 +1389,7 @@ def test_predict(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.predict), "__call__") as call: @@ -1414,9 +1430,10 @@ def test_predict_non_empty_request_with_auto_populated_field(): client.predict(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == prediction_service.PredictRequest( + request_msg = prediction_service.PredictRequest( name="name_value", ) + assert args[0] == request_msg def test_predict_use_cached_wrapped_rpc(): @@ -1495,9 +1512,14 @@ async def test_predict_async_use_cached_wrapped_rpc(transport: str = "grpc_async @pytest.mark.asyncio -async def test_predict_async( - transport: str = "grpc_asyncio", request_type=prediction_service.PredictRequest -): +@pytest.mark.parametrize( + "request_type", + [ + prediction_service.PredictRequest(), + {}, + ], +) +async def test_predict_async(request_type, transport: str = "grpc_asyncio"): client = PredictionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1505,7 +1527,7 @@ async def test_predict_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.predict), "__call__") as call: @@ -1525,11 +1547,6 @@ async def test_predict_async( assert isinstance(response, prediction_service.PredictResponse) -@pytest.mark.asyncio -async def test_predict_async_from_dict(): - await test_predict_async(request_type=dict) - - def test_predict_field_headers(): client = PredictionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1708,8 +1725,8 @@ async def test_predict_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - prediction_service.BatchPredictRequest, - dict, + prediction_service.BatchPredictRequest(), + {}, ], ) def test_batch_predict(request_type, transport: str = "grpc"): @@ -1720,7 +1737,7 @@ def test_batch_predict(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.batch_predict), "__call__") as call: @@ -1761,9 +1778,10 @@ def test_batch_predict_non_empty_request_with_auto_populated_field(): client.batch_predict(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == prediction_service.BatchPredictRequest( + request_msg = prediction_service.BatchPredictRequest( name="name_value", ) + assert args[0] == request_msg def test_batch_predict_use_cached_wrapped_rpc(): @@ -1854,9 +1872,14 @@ async def test_batch_predict_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_batch_predict_async( - transport: str = "grpc_asyncio", request_type=prediction_service.BatchPredictRequest -): +@pytest.mark.parametrize( + "request_type", + [ + prediction_service.BatchPredictRequest(), + {}, + ], +) +async def test_batch_predict_async(request_type, transport: str = "grpc_asyncio"): client = PredictionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1864,7 +1887,7 @@ async def test_batch_predict_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.batch_predict), "__call__") as call: @@ -1884,11 +1907,6 @@ async def test_batch_predict_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_batch_predict_async_from_dict(): - await test_batch_predict_async(request_type=dict) - - def test_batch_predict_field_headers(): client = PredictionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2620,7 +2638,6 @@ def test_predict_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = prediction_service.PredictRequest() - assert args[0] == request_msg @@ -2641,7 +2658,6 @@ def test_batch_predict_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = prediction_service.BatchPredictRequest() - assert args[0] == request_msg @@ -2680,7 +2696,6 @@ async def test_predict_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = prediction_service.PredictRequest() - assert args[0] == request_msg @@ -2705,7 +2720,6 @@ async def test_batch_predict_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = prediction_service.BatchPredictRequest() - assert args[0] == request_msg @@ -2992,7 +3006,6 @@ def test_predict_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = prediction_service.PredictRequest() - assert args[0] == request_msg @@ -3012,7 +3025,6 @@ def test_batch_predict_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = prediction_service.BatchPredictRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-backupdr/noxfile.py b/packages/google-cloud-backupdr/noxfile.py index fc9c6ef6c89d..6a226a08584d 100644 --- a/packages/google-cloud-backupdr/noxfile.py +++ b/packages/google-cloud-backupdr/noxfile.py @@ -47,7 +47,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-backupdr" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-backupdr/setup.py b/packages/google-cloud-backupdr/setup.py index 491cceb9c408..bba6f7d0675e 100644 --- a/packages/google-cloud-backupdr/setup.py +++ b/packages/google-cloud-backupdr/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/google-cloud-backupdr/testing/constraints-3.10.txt b/packages/google-cloud-backupdr/testing/constraints-3.10.txt index a92801e1c8e2..b39cd54634f9 100644 --- a/packages/google-cloud-backupdr/testing/constraints-3.10.txt +++ b/packages/google-cloud-backupdr/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/google-cloud-backupdr/tests/unit/gapic/backupdr_v1/test_backup_dr.py b/packages/google-cloud-backupdr/tests/unit/gapic/backupdr_v1/test_backup_dr.py index 20ca7efc55d4..6ebeb9c24e6d 100644 --- a/packages/google-cloud-backupdr/tests/unit/gapic/backupdr_v1/test_backup_dr.py +++ b/packages/google-cloud-backupdr/tests/unit/gapic/backupdr_v1/test_backup_dr.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 @@ -138,6 +139,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" @@ -1282,8 +1298,8 @@ def test_backup_dr_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - backupdr.ListManagementServersRequest, - dict, + backupdr.ListManagementServersRequest(), + {}, ], ) def test_list_management_servers(request_type, transport: str = "grpc"): @@ -1294,7 +1310,7 @@ def test_list_management_servers(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1347,12 +1363,13 @@ def test_list_management_servers_non_empty_request_with_auto_populated_field(): client.list_management_servers(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == backupdr.ListManagementServersRequest( + request_msg = backupdr.ListManagementServersRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_management_servers_use_cached_wrapped_rpc(): @@ -1438,8 +1455,15 @@ async def test_list_management_servers_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + backupdr.ListManagementServersRequest(), + {}, + ], +) async def test_list_management_servers_async( - transport: str = "grpc_asyncio", request_type=backupdr.ListManagementServersRequest + request_type, transport: str = "grpc_asyncio" ): client = BackupDRAsyncClient( credentials=async_anonymous_credentials(), @@ -1448,7 +1472,7 @@ async def test_list_management_servers_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( @@ -1475,11 +1499,6 @@ async def test_list_management_servers_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_management_servers_async_from_dict(): - await test_list_management_servers_async(request_type=dict) - - def test_list_management_servers_field_headers(): client = BackupDRClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1832,8 +1851,8 @@ async def test_list_management_servers_async_pages(): @pytest.mark.parametrize( "request_type", [ - backupdr.GetManagementServerRequest, - dict, + backupdr.GetManagementServerRequest(), + {}, ], ) def test_get_management_server(request_type, transport: str = "grpc"): @@ -1844,7 +1863,7 @@ def test_get_management_server(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1906,9 +1925,10 @@ def test_get_management_server_non_empty_request_with_auto_populated_field(): client.get_management_server(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == backupdr.GetManagementServerRequest( + request_msg = backupdr.GetManagementServerRequest( name="name_value", ) + assert args[0] == request_msg def test_get_management_server_use_cached_wrapped_rpc(): @@ -1994,8 +2014,15 @@ async def test_get_management_server_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + backupdr.GetManagementServerRequest(), + {}, + ], +) async def test_get_management_server_async( - transport: str = "grpc_asyncio", request_type=backupdr.GetManagementServerRequest + request_type, transport: str = "grpc_asyncio" ): client = BackupDRAsyncClient( credentials=async_anonymous_credentials(), @@ -2004,7 +2031,7 @@ async def test_get_management_server_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( @@ -2043,11 +2070,6 @@ async def test_get_management_server_async( assert response.satisfies_pzi is True -@pytest.mark.asyncio -async def test_get_management_server_async_from_dict(): - await test_get_management_server_async(request_type=dict) - - def test_get_management_server_field_headers(): client = BackupDRClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2202,8 +2224,8 @@ async def test_get_management_server_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - backupdr.CreateManagementServerRequest, - dict, + backupdr.CreateManagementServerRequest(), + {}, ], ) def test_create_management_server(request_type, transport: str = "grpc"): @@ -2214,7 +2236,7 @@ def test_create_management_server(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2261,11 +2283,12 @@ def test_create_management_server_non_empty_request_with_auto_populated_field(): client.create_management_server(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == backupdr.CreateManagementServerRequest( + request_msg = backupdr.CreateManagementServerRequest( parent="parent_value", management_server_id="management_server_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_management_server_use_cached_wrapped_rpc(): @@ -2361,8 +2384,15 @@ async def test_create_management_server_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + backupdr.CreateManagementServerRequest(), + {}, + ], +) async def test_create_management_server_async( - transport: str = "grpc_asyncio", request_type=backupdr.CreateManagementServerRequest + request_type, transport: str = "grpc_asyncio" ): client = BackupDRAsyncClient( credentials=async_anonymous_credentials(), @@ -2371,7 +2401,7 @@ async def test_create_management_server_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( @@ -2393,11 +2423,6 @@ async def test_create_management_server_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_management_server_async_from_dict(): - await test_create_management_server_async(request_type=dict) - - def test_create_management_server_field_headers(): client = BackupDRClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2572,8 +2597,8 @@ async def test_create_management_server_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - backupdr.DeleteManagementServerRequest, - dict, + backupdr.DeleteManagementServerRequest(), + {}, ], ) def test_delete_management_server(request_type, transport: str = "grpc"): @@ -2584,7 +2609,7 @@ def test_delete_management_server(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2630,10 +2655,11 @@ def test_delete_management_server_non_empty_request_with_auto_populated_field(): client.delete_management_server(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == backupdr.DeleteManagementServerRequest( + request_msg = backupdr.DeleteManagementServerRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_management_server_use_cached_wrapped_rpc(): @@ -2729,8 +2755,15 @@ async def test_delete_management_server_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + backupdr.DeleteManagementServerRequest(), + {}, + ], +) async def test_delete_management_server_async( - transport: str = "grpc_asyncio", request_type=backupdr.DeleteManagementServerRequest + request_type, transport: str = "grpc_asyncio" ): client = BackupDRAsyncClient( credentials=async_anonymous_credentials(), @@ -2739,7 +2772,7 @@ async def test_delete_management_server_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( @@ -2761,11 +2794,6 @@ async def test_delete_management_server_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_management_server_async_from_dict(): - await test_delete_management_server_async(request_type=dict) - - def test_delete_management_server_field_headers(): client = BackupDRClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2920,8 +2948,8 @@ async def test_delete_management_server_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - backupvault.CreateBackupVaultRequest, - dict, + backupvault.CreateBackupVaultRequest(), + {}, ], ) def test_create_backup_vault(request_type, transport: str = "grpc"): @@ -2932,7 +2960,7 @@ def test_create_backup_vault(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2978,10 +3006,11 @@ def test_create_backup_vault_non_empty_request_with_auto_populated_field(): client.create_backup_vault(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == backupvault.CreateBackupVaultRequest( + request_msg = backupvault.CreateBackupVaultRequest( parent="parent_value", backup_vault_id="backup_vault_id_value", ) + assert args[0] == request_msg def test_create_backup_vault_use_cached_wrapped_rpc(): @@ -3076,9 +3105,14 @@ async def test_create_backup_vault_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_backup_vault_async( - transport: str = "grpc_asyncio", request_type=backupvault.CreateBackupVaultRequest -): +@pytest.mark.parametrize( + "request_type", + [ + backupvault.CreateBackupVaultRequest(), + {}, + ], +) +async def test_create_backup_vault_async(request_type, transport: str = "grpc_asyncio"): client = BackupDRAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3086,7 +3120,7 @@ async def test_create_backup_vault_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( @@ -3108,11 +3142,6 @@ async def test_create_backup_vault_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_backup_vault_async_from_dict(): - await test_create_backup_vault_async(request_type=dict) - - def test_create_backup_vault_field_headers(): client = BackupDRClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3287,8 +3316,8 @@ async def test_create_backup_vault_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - backupvault.ListBackupVaultsRequest, - dict, + backupvault.ListBackupVaultsRequest(), + {}, ], ) def test_list_backup_vaults(request_type, transport: str = "grpc"): @@ -3299,7 +3328,7 @@ def test_list_backup_vaults(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3352,12 +3381,13 @@ def test_list_backup_vaults_non_empty_request_with_auto_populated_field(): client.list_backup_vaults(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == backupvault.ListBackupVaultsRequest( + request_msg = backupvault.ListBackupVaultsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_backup_vaults_use_cached_wrapped_rpc(): @@ -3442,9 +3472,14 @@ async def test_list_backup_vaults_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_backup_vaults_async( - transport: str = "grpc_asyncio", request_type=backupvault.ListBackupVaultsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + backupvault.ListBackupVaultsRequest(), + {}, + ], +) +async def test_list_backup_vaults_async(request_type, transport: str = "grpc_asyncio"): client = BackupDRAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3452,7 +3487,7 @@ async def test_list_backup_vaults_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( @@ -3479,11 +3514,6 @@ async def test_list_backup_vaults_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_backup_vaults_async_from_dict(): - await test_list_backup_vaults_async(request_type=dict) - - def test_list_backup_vaults_field_headers(): client = BackupDRClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3836,8 +3866,8 @@ async def test_list_backup_vaults_async_pages(): @pytest.mark.parametrize( "request_type", [ - backupvault.FetchUsableBackupVaultsRequest, - dict, + backupvault.FetchUsableBackupVaultsRequest(), + {}, ], ) def test_fetch_usable_backup_vaults(request_type, transport: str = "grpc"): @@ -3848,7 +3878,7 @@ def test_fetch_usable_backup_vaults(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3901,12 +3931,13 @@ def test_fetch_usable_backup_vaults_non_empty_request_with_auto_populated_field( client.fetch_usable_backup_vaults(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == backupvault.FetchUsableBackupVaultsRequest( + request_msg = backupvault.FetchUsableBackupVaultsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_fetch_usable_backup_vaults_use_cached_wrapped_rpc(): @@ -3992,9 +4023,15 @@ async def test_fetch_usable_backup_vaults_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + backupvault.FetchUsableBackupVaultsRequest(), + {}, + ], +) async def test_fetch_usable_backup_vaults_async( - transport: str = "grpc_asyncio", - request_type=backupvault.FetchUsableBackupVaultsRequest, + request_type, transport: str = "grpc_asyncio" ): client = BackupDRAsyncClient( credentials=async_anonymous_credentials(), @@ -4003,7 +4040,7 @@ async def test_fetch_usable_backup_vaults_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( @@ -4030,11 +4067,6 @@ async def test_fetch_usable_backup_vaults_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_fetch_usable_backup_vaults_async_from_dict(): - await test_fetch_usable_backup_vaults_async(request_type=dict) - - def test_fetch_usable_backup_vaults_field_headers(): client = BackupDRClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4389,8 +4421,8 @@ async def test_fetch_usable_backup_vaults_async_pages(): @pytest.mark.parametrize( "request_type", [ - backupvault.GetBackupVaultRequest, - dict, + backupvault.GetBackupVaultRequest(), + {}, ], ) def test_get_backup_vault(request_type, transport: str = "grpc"): @@ -4401,7 +4433,7 @@ def test_get_backup_vault(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_backup_vault), "__call__") as call: @@ -4471,9 +4503,10 @@ def test_get_backup_vault_non_empty_request_with_auto_populated_field(): client.get_backup_vault(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == backupvault.GetBackupVaultRequest( + request_msg = backupvault.GetBackupVaultRequest( name="name_value", ) + assert args[0] == request_msg def test_get_backup_vault_use_cached_wrapped_rpc(): @@ -4556,9 +4589,14 @@ async def test_get_backup_vault_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_backup_vault_async( - transport: str = "grpc_asyncio", request_type=backupvault.GetBackupVaultRequest -): +@pytest.mark.parametrize( + "request_type", + [ + backupvault.GetBackupVaultRequest(), + {}, + ], +) +async def test_get_backup_vault_async(request_type, transport: str = "grpc_asyncio"): client = BackupDRAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4566,7 +4604,7 @@ async def test_get_backup_vault_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_backup_vault), "__call__") as call: @@ -4615,11 +4653,6 @@ async def test_get_backup_vault_async( ) -@pytest.mark.asyncio -async def test_get_backup_vault_async_from_dict(): - await test_get_backup_vault_async(request_type=dict) - - def test_get_backup_vault_field_headers(): client = BackupDRClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4766,8 +4799,8 @@ async def test_get_backup_vault_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - backupvault.UpdateBackupVaultRequest, - dict, + backupvault.UpdateBackupVaultRequest(), + {}, ], ) def test_update_backup_vault(request_type, transport: str = "grpc"): @@ -4778,7 +4811,7 @@ def test_update_backup_vault(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4821,7 +4854,8 @@ def test_update_backup_vault_non_empty_request_with_auto_populated_field(): client.update_backup_vault(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == backupvault.UpdateBackupVaultRequest() + request_msg = backupvault.UpdateBackupVaultRequest() + assert args[0] == request_msg def test_update_backup_vault_use_cached_wrapped_rpc(): @@ -4916,9 +4950,14 @@ async def test_update_backup_vault_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_backup_vault_async( - transport: str = "grpc_asyncio", request_type=backupvault.UpdateBackupVaultRequest -): +@pytest.mark.parametrize( + "request_type", + [ + backupvault.UpdateBackupVaultRequest(), + {}, + ], +) +async def test_update_backup_vault_async(request_type, transport: str = "grpc_asyncio"): client = BackupDRAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4926,7 +4965,7 @@ async def test_update_backup_vault_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( @@ -4948,11 +4987,6 @@ async def test_update_backup_vault_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_backup_vault_async_from_dict(): - await test_update_backup_vault_async(request_type=dict) - - def test_update_backup_vault_field_headers(): client = BackupDRClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5117,8 +5151,8 @@ async def test_update_backup_vault_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - backupvault.DeleteBackupVaultRequest, - dict, + backupvault.DeleteBackupVaultRequest(), + {}, ], ) def test_delete_backup_vault(request_type, transport: str = "grpc"): @@ -5129,7 +5163,7 @@ def test_delete_backup_vault(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5175,10 +5209,11 @@ def test_delete_backup_vault_non_empty_request_with_auto_populated_field(): client.delete_backup_vault(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == backupvault.DeleteBackupVaultRequest( + request_msg = backupvault.DeleteBackupVaultRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_backup_vault_use_cached_wrapped_rpc(): @@ -5273,9 +5308,14 @@ async def test_delete_backup_vault_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_backup_vault_async( - transport: str = "grpc_asyncio", request_type=backupvault.DeleteBackupVaultRequest -): +@pytest.mark.parametrize( + "request_type", + [ + backupvault.DeleteBackupVaultRequest(), + {}, + ], +) +async def test_delete_backup_vault_async(request_type, transport: str = "grpc_asyncio"): client = BackupDRAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5283,7 +5323,7 @@ async def test_delete_backup_vault_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( @@ -5305,11 +5345,6 @@ async def test_delete_backup_vault_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_backup_vault_async_from_dict(): - await test_delete_backup_vault_async(request_type=dict) - - def test_delete_backup_vault_field_headers(): client = BackupDRClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5464,8 +5499,8 @@ async def test_delete_backup_vault_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - backupvault.ListDataSourcesRequest, - dict, + backupvault.ListDataSourcesRequest(), + {}, ], ) def test_list_data_sources(request_type, transport: str = "grpc"): @@ -5476,7 +5511,7 @@ def test_list_data_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( @@ -5529,12 +5564,13 @@ def test_list_data_sources_non_empty_request_with_auto_populated_field(): client.list_data_sources(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == backupvault.ListDataSourcesRequest( + request_msg = backupvault.ListDataSourcesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_data_sources_use_cached_wrapped_rpc(): @@ -5617,9 +5653,14 @@ async def test_list_data_sources_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_data_sources_async( - transport: str = "grpc_asyncio", request_type=backupvault.ListDataSourcesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + backupvault.ListDataSourcesRequest(), + {}, + ], +) +async def test_list_data_sources_async(request_type, transport: str = "grpc_asyncio"): client = BackupDRAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5627,7 +5668,7 @@ async def test_list_data_sources_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( @@ -5654,11 +5695,6 @@ async def test_list_data_sources_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_data_sources_async_from_dict(): - await test_list_data_sources_async(request_type=dict) - - def test_list_data_sources_field_headers(): client = BackupDRClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6011,8 +6047,8 @@ async def test_list_data_sources_async_pages(): @pytest.mark.parametrize( "request_type", [ - backupvault.GetDataSourceRequest, - dict, + backupvault.GetDataSourceRequest(), + {}, ], ) def test_get_data_source(request_type, transport: str = "grpc"): @@ -6023,7 +6059,7 @@ def test_get_data_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(type(client.transport.get_data_source), "__call__") as call: @@ -6079,9 +6115,10 @@ def test_get_data_source_non_empty_request_with_auto_populated_field(): client.get_data_source(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == backupvault.GetDataSourceRequest( + request_msg = backupvault.GetDataSourceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_data_source_use_cached_wrapped_rpc(): @@ -6162,9 +6199,14 @@ async def test_get_data_source_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_data_source_async( - transport: str = "grpc_asyncio", request_type=backupvault.GetDataSourceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + backupvault.GetDataSourceRequest(), + {}, + ], +) +async def test_get_data_source_async(request_type, transport: str = "grpc_asyncio"): client = BackupDRAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6172,7 +6214,7 @@ async def test_get_data_source_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_data_source), "__call__") as call: @@ -6207,11 +6249,6 @@ async def test_get_data_source_async( assert response.backup_blocked_by_vault_access_restriction is True -@pytest.mark.asyncio -async def test_get_data_source_async_from_dict(): - await test_get_data_source_async(request_type=dict) - - def test_get_data_source_field_headers(): client = BackupDRClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6358,8 +6395,8 @@ async def test_get_data_source_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - backupvault.UpdateDataSourceRequest, - dict, + backupvault.UpdateDataSourceRequest(), + {}, ], ) def test_update_data_source(request_type, transport: str = "grpc"): @@ -6370,7 +6407,7 @@ def test_update_data_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( @@ -6413,7 +6450,8 @@ def test_update_data_source_non_empty_request_with_auto_populated_field(): client.update_data_source(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == backupvault.UpdateDataSourceRequest() + request_msg = backupvault.UpdateDataSourceRequest() + assert args[0] == request_msg def test_update_data_source_use_cached_wrapped_rpc(): @@ -6508,9 +6546,14 @@ async def test_update_data_source_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_data_source_async( - transport: str = "grpc_asyncio", request_type=backupvault.UpdateDataSourceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + backupvault.UpdateDataSourceRequest(), + {}, + ], +) +async def test_update_data_source_async(request_type, transport: str = "grpc_asyncio"): client = BackupDRAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6518,7 +6561,7 @@ async def test_update_data_source_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( @@ -6540,11 +6583,6 @@ async def test_update_data_source_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_data_source_async_from_dict(): - await test_update_data_source_async(request_type=dict) - - def test_update_data_source_field_headers(): client = BackupDRClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6709,8 +6747,8 @@ async def test_update_data_source_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - backupvault.ListBackupsRequest, - dict, + backupvault.ListBackupsRequest(), + {}, ], ) def test_list_backups(request_type, transport: str = "grpc"): @@ -6721,7 +6759,7 @@ def test_list_backups(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_backups), "__call__") as call: @@ -6770,12 +6808,13 @@ def test_list_backups_non_empty_request_with_auto_populated_field(): client.list_backups(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == backupvault.ListBackupsRequest( + request_msg = backupvault.ListBackupsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_backups_use_cached_wrapped_rpc(): @@ -6856,9 +6895,14 @@ async def test_list_backups_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_backups_async( - transport: str = "grpc_asyncio", request_type=backupvault.ListBackupsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + backupvault.ListBackupsRequest(), + {}, + ], +) +async def test_list_backups_async(request_type, transport: str = "grpc_asyncio"): client = BackupDRAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6866,7 +6910,7 @@ async def test_list_backups_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_backups), "__call__") as call: @@ -6891,11 +6935,6 @@ async def test_list_backups_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_backups_async_from_dict(): - await test_list_backups_async(request_type=dict) - - def test_list_backups_field_headers(): client = BackupDRClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7232,8 +7271,8 @@ async def test_list_backups_async_pages(): @pytest.mark.parametrize( "request_type", [ - backupvault.FetchBackupsForResourceTypeRequest, - dict, + backupvault.FetchBackupsForResourceTypeRequest(), + {}, ], ) def test_fetch_backups_for_resource_type(request_type, transport: str = "grpc"): @@ -7244,7 +7283,7 @@ def test_fetch_backups_for_resource_type(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7296,13 +7335,14 @@ def test_fetch_backups_for_resource_type_non_empty_request_with_auto_populated_f client.fetch_backups_for_resource_type(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == backupvault.FetchBackupsForResourceTypeRequest( + request_msg = backupvault.FetchBackupsForResourceTypeRequest( parent="parent_value", resource_type="resource_type_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_fetch_backups_for_resource_type_use_cached_wrapped_rpc(): @@ -7388,9 +7428,15 @@ async def test_fetch_backups_for_resource_type_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + backupvault.FetchBackupsForResourceTypeRequest(), + {}, + ], +) async def test_fetch_backups_for_resource_type_async( - transport: str = "grpc_asyncio", - request_type=backupvault.FetchBackupsForResourceTypeRequest, + request_type, transport: str = "grpc_asyncio" ): client = BackupDRAsyncClient( credentials=async_anonymous_credentials(), @@ -7399,7 +7445,7 @@ async def test_fetch_backups_for_resource_type_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( @@ -7424,11 +7470,6 @@ async def test_fetch_backups_for_resource_type_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_fetch_backups_for_resource_type_async_from_dict(): - await test_fetch_backups_for_resource_type_async(request_type=dict) - - def test_fetch_backups_for_resource_type_field_headers(): client = BackupDRClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7795,8 +7836,8 @@ async def test_fetch_backups_for_resource_type_async_pages(): @pytest.mark.parametrize( "request_type", [ - backupvault.GetBackupRequest, - dict, + backupvault.GetBackupRequest(), + {}, ], ) def test_get_backup(request_type, transport: str = "grpc"): @@ -7807,7 +7848,7 @@ def test_get_backup(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_backup), "__call__") as call: @@ -7872,9 +7913,10 @@ def test_get_backup_non_empty_request_with_auto_populated_field(): client.get_backup(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == backupvault.GetBackupRequest( + request_msg = backupvault.GetBackupRequest( name="name_value", ) + assert args[0] == request_msg def test_get_backup_use_cached_wrapped_rpc(): @@ -7953,9 +7995,14 @@ async def test_get_backup_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_backup_async( - transport: str = "grpc_asyncio", request_type=backupvault.GetBackupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + backupvault.GetBackupRequest(), + {}, + ], +) +async def test_get_backup_async(request_type, transport: str = "grpc_asyncio"): client = BackupDRAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7963,7 +8010,7 @@ async def test_get_backup_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_backup), "__call__") as call: @@ -8007,11 +8054,6 @@ async def test_get_backup_async( assert response.kms_key_versions == ["kms_key_versions_value"] -@pytest.mark.asyncio -async def test_get_backup_async_from_dict(): - await test_get_backup_async(request_type=dict) - - def test_get_backup_field_headers(): client = BackupDRClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8154,8 +8196,8 @@ async def test_get_backup_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - backupvault.UpdateBackupRequest, - dict, + backupvault.UpdateBackupRequest(), + {}, ], ) def test_update_backup(request_type, transport: str = "grpc"): @@ -8166,7 +8208,7 @@ def test_update_backup(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_backup), "__call__") as call: @@ -8205,7 +8247,8 @@ def test_update_backup_non_empty_request_with_auto_populated_field(): client.update_backup(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == backupvault.UpdateBackupRequest() + request_msg = backupvault.UpdateBackupRequest() + assert args[0] == request_msg def test_update_backup_use_cached_wrapped_rpc(): @@ -8296,9 +8339,14 @@ async def test_update_backup_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_backup_async( - transport: str = "grpc_asyncio", request_type=backupvault.UpdateBackupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + backupvault.UpdateBackupRequest(), + {}, + ], +) +async def test_update_backup_async(request_type, transport: str = "grpc_asyncio"): client = BackupDRAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8306,7 +8354,7 @@ async def test_update_backup_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_backup), "__call__") as call: @@ -8326,11 +8374,6 @@ async def test_update_backup_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_backup_async_from_dict(): - await test_update_backup_async(request_type=dict) - - def test_update_backup_field_headers(): client = BackupDRClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8487,8 +8530,8 @@ async def test_update_backup_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - backupvault.DeleteBackupRequest, - dict, + backupvault.DeleteBackupRequest(), + {}, ], ) def test_delete_backup(request_type, transport: str = "grpc"): @@ -8499,7 +8542,7 @@ def test_delete_backup(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_backup), "__call__") as call: @@ -8540,9 +8583,10 @@ def test_delete_backup_non_empty_request_with_auto_populated_field(): client.delete_backup(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == backupvault.DeleteBackupRequest( + request_msg = backupvault.DeleteBackupRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_backup_use_cached_wrapped_rpc(): @@ -8633,9 +8677,14 @@ async def test_delete_backup_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_backup_async( - transport: str = "grpc_asyncio", request_type=backupvault.DeleteBackupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + backupvault.DeleteBackupRequest(), + {}, + ], +) +async def test_delete_backup_async(request_type, transport: str = "grpc_asyncio"): client = BackupDRAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8643,7 +8692,7 @@ async def test_delete_backup_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_backup), "__call__") as call: @@ -8663,11 +8712,6 @@ async def test_delete_backup_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_backup_async_from_dict(): - await test_delete_backup_async(request_type=dict) - - def test_delete_backup_field_headers(): client = BackupDRClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8814,8 +8858,8 @@ async def test_delete_backup_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - backupvault.RestoreBackupRequest, - dict, + backupvault.RestoreBackupRequest(), + {}, ], ) def test_restore_backup(request_type, transport: str = "grpc"): @@ -8826,7 +8870,7 @@ def test_restore_backup(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.restore_backup), "__call__") as call: @@ -8867,9 +8911,10 @@ def test_restore_backup_non_empty_request_with_auto_populated_field(): client.restore_backup(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == backupvault.RestoreBackupRequest( + request_msg = backupvault.RestoreBackupRequest( name="name_value", ) + assert args[0] == request_msg def test_restore_backup_use_cached_wrapped_rpc(): @@ -8960,9 +9005,14 @@ async def test_restore_backup_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_restore_backup_async( - transport: str = "grpc_asyncio", request_type=backupvault.RestoreBackupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + backupvault.RestoreBackupRequest(), + {}, + ], +) +async def test_restore_backup_async(request_type, transport: str = "grpc_asyncio"): client = BackupDRAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8970,7 +9020,7 @@ async def test_restore_backup_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.restore_backup), "__call__") as call: @@ -8990,11 +9040,6 @@ async def test_restore_backup_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_restore_backup_async_from_dict(): - await test_restore_backup_async(request_type=dict) - - def test_restore_backup_field_headers(): client = BackupDRClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9141,8 +9186,8 @@ async def test_restore_backup_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - backupplan.CreateBackupPlanRequest, - dict, + backupplan.CreateBackupPlanRequest(), + {}, ], ) def test_create_backup_plan(request_type, transport: str = "grpc"): @@ -9153,7 +9198,7 @@ def test_create_backup_plan(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9199,10 +9244,11 @@ def test_create_backup_plan_non_empty_request_with_auto_populated_field(): client.create_backup_plan(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == backupplan.CreateBackupPlanRequest( + request_msg = backupplan.CreateBackupPlanRequest( parent="parent_value", backup_plan_id="backup_plan_id_value", ) + assert args[0] == request_msg def test_create_backup_plan_use_cached_wrapped_rpc(): @@ -9297,9 +9343,14 @@ async def test_create_backup_plan_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_backup_plan_async( - transport: str = "grpc_asyncio", request_type=backupplan.CreateBackupPlanRequest -): +@pytest.mark.parametrize( + "request_type", + [ + backupplan.CreateBackupPlanRequest(), + {}, + ], +) +async def test_create_backup_plan_async(request_type, transport: str = "grpc_asyncio"): client = BackupDRAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9307,7 +9358,7 @@ async def test_create_backup_plan_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( @@ -9329,11 +9380,6 @@ async def test_create_backup_plan_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_backup_plan_async_from_dict(): - await test_create_backup_plan_async(request_type=dict) - - def test_create_backup_plan_field_headers(): client = BackupDRClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9508,8 +9554,8 @@ async def test_create_backup_plan_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - backupplan.UpdateBackupPlanRequest, - dict, + backupplan.UpdateBackupPlanRequest(), + {}, ], ) def test_update_backup_plan(request_type, transport: str = "grpc"): @@ -9520,7 +9566,7 @@ def test_update_backup_plan(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9563,7 +9609,8 @@ def test_update_backup_plan_non_empty_request_with_auto_populated_field(): client.update_backup_plan(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == backupplan.UpdateBackupPlanRequest() + request_msg = backupplan.UpdateBackupPlanRequest() + assert args[0] == request_msg def test_update_backup_plan_use_cached_wrapped_rpc(): @@ -9658,9 +9705,14 @@ async def test_update_backup_plan_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_backup_plan_async( - transport: str = "grpc_asyncio", request_type=backupplan.UpdateBackupPlanRequest -): +@pytest.mark.parametrize( + "request_type", + [ + backupplan.UpdateBackupPlanRequest(), + {}, + ], +) +async def test_update_backup_plan_async(request_type, transport: str = "grpc_asyncio"): client = BackupDRAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9668,7 +9720,7 @@ async def test_update_backup_plan_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( @@ -9690,11 +9742,6 @@ async def test_update_backup_plan_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_backup_plan_async_from_dict(): - await test_update_backup_plan_async(request_type=dict) - - def test_update_backup_plan_field_headers(): client = BackupDRClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9859,8 +9906,8 @@ async def test_update_backup_plan_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - backupplan.GetBackupPlanRequest, - dict, + backupplan.GetBackupPlanRequest(), + {}, ], ) def test_get_backup_plan(request_type, transport: str = "grpc"): @@ -9871,7 +9918,7 @@ def test_get_backup_plan(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_backup_plan), "__call__") as call: @@ -9935,9 +9982,10 @@ def test_get_backup_plan_non_empty_request_with_auto_populated_field(): client.get_backup_plan(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == backupplan.GetBackupPlanRequest( + request_msg = backupplan.GetBackupPlanRequest( name="name_value", ) + assert args[0] == request_msg def test_get_backup_plan_use_cached_wrapped_rpc(): @@ -10018,9 +10066,14 @@ async def test_get_backup_plan_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_backup_plan_async( - transport: str = "grpc_asyncio", request_type=backupplan.GetBackupPlanRequest -): +@pytest.mark.parametrize( + "request_type", + [ + backupplan.GetBackupPlanRequest(), + {}, + ], +) +async def test_get_backup_plan_async(request_type, transport: str = "grpc_asyncio"): client = BackupDRAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10028,7 +10081,7 @@ async def test_get_backup_plan_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_backup_plan), "__call__") as call: @@ -10071,11 +10124,6 @@ async def test_get_backup_plan_async( assert response.revision_name == "revision_name_value" -@pytest.mark.asyncio -async def test_get_backup_plan_async_from_dict(): - await test_get_backup_plan_async(request_type=dict) - - def test_get_backup_plan_field_headers(): client = BackupDRClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10222,8 +10270,8 @@ async def test_get_backup_plan_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - backupplan.ListBackupPlansRequest, - dict, + backupplan.ListBackupPlansRequest(), + {}, ], ) def test_list_backup_plans(request_type, transport: str = "grpc"): @@ -10234,7 +10282,7 @@ def test_list_backup_plans(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10287,12 +10335,13 @@ def test_list_backup_plans_non_empty_request_with_auto_populated_field(): client.list_backup_plans(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == backupplan.ListBackupPlansRequest( + request_msg = backupplan.ListBackupPlansRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_backup_plans_use_cached_wrapped_rpc(): @@ -10375,9 +10424,14 @@ async def test_list_backup_plans_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_backup_plans_async( - transport: str = "grpc_asyncio", request_type=backupplan.ListBackupPlansRequest -): +@pytest.mark.parametrize( + "request_type", + [ + backupplan.ListBackupPlansRequest(), + {}, + ], +) +async def test_list_backup_plans_async(request_type, transport: str = "grpc_asyncio"): client = BackupDRAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10385,7 +10439,7 @@ async def test_list_backup_plans_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( @@ -10412,11 +10466,6 @@ async def test_list_backup_plans_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_backup_plans_async_from_dict(): - await test_list_backup_plans_async(request_type=dict) - - def test_list_backup_plans_field_headers(): client = BackupDRClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10769,8 +10818,8 @@ async def test_list_backup_plans_async_pages(): @pytest.mark.parametrize( "request_type", [ - backupplan.DeleteBackupPlanRequest, - dict, + backupplan.DeleteBackupPlanRequest(), + {}, ], ) def test_delete_backup_plan(request_type, transport: str = "grpc"): @@ -10781,7 +10830,7 @@ def test_delete_backup_plan(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10826,9 +10875,10 @@ def test_delete_backup_plan_non_empty_request_with_auto_populated_field(): client.delete_backup_plan(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == backupplan.DeleteBackupPlanRequest( + request_msg = backupplan.DeleteBackupPlanRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_backup_plan_use_cached_wrapped_rpc(): @@ -10923,9 +10973,14 @@ async def test_delete_backup_plan_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_backup_plan_async( - transport: str = "grpc_asyncio", request_type=backupplan.DeleteBackupPlanRequest -): +@pytest.mark.parametrize( + "request_type", + [ + backupplan.DeleteBackupPlanRequest(), + {}, + ], +) +async def test_delete_backup_plan_async(request_type, transport: str = "grpc_asyncio"): client = BackupDRAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10933,7 +10988,7 @@ async def test_delete_backup_plan_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( @@ -10955,11 +11010,6 @@ async def test_delete_backup_plan_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_backup_plan_async_from_dict(): - await test_delete_backup_plan_async(request_type=dict) - - def test_delete_backup_plan_field_headers(): client = BackupDRClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11114,8 +11164,8 @@ async def test_delete_backup_plan_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - backupplan.GetBackupPlanRevisionRequest, - dict, + backupplan.GetBackupPlanRevisionRequest(), + {}, ], ) def test_get_backup_plan_revision(request_type, transport: str = "grpc"): @@ -11126,7 +11176,7 @@ def test_get_backup_plan_revision(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11178,9 +11228,10 @@ def test_get_backup_plan_revision_non_empty_request_with_auto_populated_field(): client.get_backup_plan_revision(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == backupplan.GetBackupPlanRevisionRequest( + request_msg = backupplan.GetBackupPlanRevisionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_backup_plan_revision_use_cached_wrapped_rpc(): @@ -11266,9 +11317,15 @@ async def test_get_backup_plan_revision_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + backupplan.GetBackupPlanRevisionRequest(), + {}, + ], +) async def test_get_backup_plan_revision_async( - transport: str = "grpc_asyncio", - request_type=backupplan.GetBackupPlanRevisionRequest, + request_type, transport: str = "grpc_asyncio" ): client = BackupDRAsyncClient( credentials=async_anonymous_credentials(), @@ -11277,7 +11334,7 @@ async def test_get_backup_plan_revision_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( @@ -11306,11 +11363,6 @@ async def test_get_backup_plan_revision_async( assert response.state == backupplan.BackupPlanRevision.State.CREATING -@pytest.mark.asyncio -async def test_get_backup_plan_revision_async_from_dict(): - await test_get_backup_plan_revision_async(request_type=dict) - - def test_get_backup_plan_revision_field_headers(): client = BackupDRClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11465,8 +11517,8 @@ async def test_get_backup_plan_revision_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - backupplan.ListBackupPlanRevisionsRequest, - dict, + backupplan.ListBackupPlanRevisionsRequest(), + {}, ], ) def test_list_backup_plan_revisions(request_type, transport: str = "grpc"): @@ -11477,7 +11529,7 @@ def test_list_backup_plan_revisions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11528,10 +11580,11 @@ def test_list_backup_plan_revisions_non_empty_request_with_auto_populated_field( client.list_backup_plan_revisions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == backupplan.ListBackupPlanRevisionsRequest( + request_msg = backupplan.ListBackupPlanRevisionsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_backup_plan_revisions_use_cached_wrapped_rpc(): @@ -11617,9 +11670,15 @@ async def test_list_backup_plan_revisions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + backupplan.ListBackupPlanRevisionsRequest(), + {}, + ], +) async def test_list_backup_plan_revisions_async( - transport: str = "grpc_asyncio", - request_type=backupplan.ListBackupPlanRevisionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = BackupDRAsyncClient( credentials=async_anonymous_credentials(), @@ -11628,7 +11687,7 @@ async def test_list_backup_plan_revisions_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( @@ -11655,11 +11714,6 @@ async def test_list_backup_plan_revisions_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_backup_plan_revisions_async_from_dict(): - await test_list_backup_plan_revisions_async(request_type=dict) - - def test_list_backup_plan_revisions_field_headers(): client = BackupDRClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12014,8 +12068,8 @@ async def test_list_backup_plan_revisions_async_pages(): @pytest.mark.parametrize( "request_type", [ - backupplanassociation.CreateBackupPlanAssociationRequest, - dict, + backupplanassociation.CreateBackupPlanAssociationRequest(), + {}, ], ) def test_create_backup_plan_association(request_type, transport: str = "grpc"): @@ -12026,7 +12080,7 @@ def test_create_backup_plan_association(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -12072,10 +12126,11 @@ def test_create_backup_plan_association_non_empty_request_with_auto_populated_fi client.create_backup_plan_association(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == backupplanassociation.CreateBackupPlanAssociationRequest( + request_msg = backupplanassociation.CreateBackupPlanAssociationRequest( parent="parent_value", backup_plan_association_id="backup_plan_association_id_value", ) + assert args[0] == request_msg def test_create_backup_plan_association_use_cached_wrapped_rpc(): @@ -12171,9 +12226,15 @@ async def test_create_backup_plan_association_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + backupplanassociation.CreateBackupPlanAssociationRequest(), + {}, + ], +) async def test_create_backup_plan_association_async( - transport: str = "grpc_asyncio", - request_type=backupplanassociation.CreateBackupPlanAssociationRequest, + request_type, transport: str = "grpc_asyncio" ): client = BackupDRAsyncClient( credentials=async_anonymous_credentials(), @@ -12182,7 +12243,7 @@ async def test_create_backup_plan_association_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( @@ -12204,11 +12265,6 @@ async def test_create_backup_plan_association_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_backup_plan_association_async_from_dict(): - await test_create_backup_plan_association_async(request_type=dict) - - def test_create_backup_plan_association_field_headers(): client = BackupDRClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12391,8 +12447,8 @@ async def test_create_backup_plan_association_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - backupplanassociation.UpdateBackupPlanAssociationRequest, - dict, + backupplanassociation.UpdateBackupPlanAssociationRequest(), + {}, ], ) def test_update_backup_plan_association(request_type, transport: str = "grpc"): @@ -12403,7 +12459,7 @@ def test_update_backup_plan_association(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -12446,7 +12502,8 @@ def test_update_backup_plan_association_non_empty_request_with_auto_populated_fi client.update_backup_plan_association(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == backupplanassociation.UpdateBackupPlanAssociationRequest() + request_msg = backupplanassociation.UpdateBackupPlanAssociationRequest() + assert args[0] == request_msg def test_update_backup_plan_association_use_cached_wrapped_rpc(): @@ -12542,9 +12599,15 @@ async def test_update_backup_plan_association_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + backupplanassociation.UpdateBackupPlanAssociationRequest(), + {}, + ], +) async def test_update_backup_plan_association_async( - transport: str = "grpc_asyncio", - request_type=backupplanassociation.UpdateBackupPlanAssociationRequest, + request_type, transport: str = "grpc_asyncio" ): client = BackupDRAsyncClient( credentials=async_anonymous_credentials(), @@ -12553,7 +12616,7 @@ async def test_update_backup_plan_association_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( @@ -12575,11 +12638,6 @@ async def test_update_backup_plan_association_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_backup_plan_association_async_from_dict(): - await test_update_backup_plan_association_async(request_type=dict) - - def test_update_backup_plan_association_field_headers(): client = BackupDRClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12752,8 +12810,8 @@ async def test_update_backup_plan_association_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - backupplanassociation.GetBackupPlanAssociationRequest, - dict, + backupplanassociation.GetBackupPlanAssociationRequest(), + {}, ], ) def test_get_backup_plan_association(request_type, transport: str = "grpc"): @@ -12764,7 +12822,7 @@ def test_get_backup_plan_association(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -12826,9 +12884,10 @@ def test_get_backup_plan_association_non_empty_request_with_auto_populated_field client.get_backup_plan_association(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == backupplanassociation.GetBackupPlanAssociationRequest( + request_msg = backupplanassociation.GetBackupPlanAssociationRequest( name="name_value", ) + assert args[0] == request_msg def test_get_backup_plan_association_use_cached_wrapped_rpc(): @@ -12914,9 +12973,15 @@ async def test_get_backup_plan_association_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + backupplanassociation.GetBackupPlanAssociationRequest(), + {}, + ], +) async def test_get_backup_plan_association_async( - transport: str = "grpc_asyncio", - request_type=backupplanassociation.GetBackupPlanAssociationRequest, + request_type, transport: str = "grpc_asyncio" ): client = BackupDRAsyncClient( credentials=async_anonymous_credentials(), @@ -12925,7 +12990,7 @@ async def test_get_backup_plan_association_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( @@ -12964,11 +13029,6 @@ async def test_get_backup_plan_association_async( assert response.backup_plan_revision_name == "backup_plan_revision_name_value" -@pytest.mark.asyncio -async def test_get_backup_plan_association_async_from_dict(): - await test_get_backup_plan_association_async(request_type=dict) - - def test_get_backup_plan_association_field_headers(): client = BackupDRClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13123,8 +13183,8 @@ async def test_get_backup_plan_association_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - backupplanassociation.ListBackupPlanAssociationsRequest, - dict, + backupplanassociation.ListBackupPlanAssociationsRequest(), + {}, ], ) def test_list_backup_plan_associations(request_type, transport: str = "grpc"): @@ -13135,7 +13195,7 @@ def test_list_backup_plan_associations(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -13187,11 +13247,12 @@ def test_list_backup_plan_associations_non_empty_request_with_auto_populated_fie client.list_backup_plan_associations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == backupplanassociation.ListBackupPlanAssociationsRequest( + request_msg = backupplanassociation.ListBackupPlanAssociationsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_backup_plan_associations_use_cached_wrapped_rpc(): @@ -13277,9 +13338,15 @@ async def test_list_backup_plan_associations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + backupplanassociation.ListBackupPlanAssociationsRequest(), + {}, + ], +) async def test_list_backup_plan_associations_async( - transport: str = "grpc_asyncio", - request_type=backupplanassociation.ListBackupPlanAssociationsRequest, + request_type, transport: str = "grpc_asyncio" ): client = BackupDRAsyncClient( credentials=async_anonymous_credentials(), @@ -13288,7 +13355,7 @@ async def test_list_backup_plan_associations_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( @@ -13315,11 +13382,6 @@ async def test_list_backup_plan_associations_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_backup_plan_associations_async_from_dict(): - await test_list_backup_plan_associations_async(request_type=dict) - - def test_list_backup_plan_associations_field_headers(): client = BackupDRClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13681,8 +13743,8 @@ async def test_list_backup_plan_associations_async_pages(): @pytest.mark.parametrize( "request_type", [ - backupplanassociation.FetchBackupPlanAssociationsForResourceTypeRequest, - dict, + backupplanassociation.FetchBackupPlanAssociationsForResourceTypeRequest(), + {}, ], ) def test_fetch_backup_plan_associations_for_resource_type( @@ -13695,7 +13757,7 @@ def test_fetch_backup_plan_associations_for_resource_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( @@ -13753,15 +13815,16 @@ def test_fetch_backup_plan_associations_for_resource_type_non_empty_request_with client.fetch_backup_plan_associations_for_resource_type(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == backupplanassociation.FetchBackupPlanAssociationsForResourceTypeRequest( - parent="parent_value", - resource_type="resource_type_value", - page_token="page_token_value", - filter="filter_value", - order_by="order_by_value", + request_msg = ( + backupplanassociation.FetchBackupPlanAssociationsForResourceTypeRequest( + parent="parent_value", + resource_type="resource_type_value", + page_token="page_token_value", + filter="filter_value", + order_by="order_by_value", + ) ) + assert args[0] == request_msg def test_fetch_backup_plan_associations_for_resource_type_use_cached_wrapped_rpc(): @@ -13847,9 +13910,15 @@ async def test_fetch_backup_plan_associations_for_resource_type_async_use_cached @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + backupplanassociation.FetchBackupPlanAssociationsForResourceTypeRequest(), + {}, + ], +) async def test_fetch_backup_plan_associations_for_resource_type_async( - transport: str = "grpc_asyncio", - request_type=backupplanassociation.FetchBackupPlanAssociationsForResourceTypeRequest, + request_type, transport: str = "grpc_asyncio" ): client = BackupDRAsyncClient( credentials=async_anonymous_credentials(), @@ -13858,7 +13927,7 @@ async def test_fetch_backup_plan_associations_for_resource_type_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( @@ -13890,11 +13959,6 @@ async def test_fetch_backup_plan_associations_for_resource_type_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_fetch_backup_plan_associations_for_resource_type_async_from_dict(): - await test_fetch_backup_plan_associations_for_resource_type_async(request_type=dict) - - def test_fetch_backup_plan_associations_for_resource_type_field_headers(): client = BackupDRClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14284,8 +14348,8 @@ async def test_fetch_backup_plan_associations_for_resource_type_async_pages(): @pytest.mark.parametrize( "request_type", [ - backupplanassociation.DeleteBackupPlanAssociationRequest, - dict, + backupplanassociation.DeleteBackupPlanAssociationRequest(), + {}, ], ) def test_delete_backup_plan_association(request_type, transport: str = "grpc"): @@ -14296,7 +14360,7 @@ def test_delete_backup_plan_association(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -14341,9 +14405,10 @@ def test_delete_backup_plan_association_non_empty_request_with_auto_populated_fi client.delete_backup_plan_association(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == backupplanassociation.DeleteBackupPlanAssociationRequest( + request_msg = backupplanassociation.DeleteBackupPlanAssociationRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_backup_plan_association_use_cached_wrapped_rpc(): @@ -14439,9 +14504,15 @@ async def test_delete_backup_plan_association_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + backupplanassociation.DeleteBackupPlanAssociationRequest(), + {}, + ], +) async def test_delete_backup_plan_association_async( - transport: str = "grpc_asyncio", - request_type=backupplanassociation.DeleteBackupPlanAssociationRequest, + request_type, transport: str = "grpc_asyncio" ): client = BackupDRAsyncClient( credentials=async_anonymous_credentials(), @@ -14450,7 +14521,7 @@ async def test_delete_backup_plan_association_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( @@ -14472,11 +14543,6 @@ async def test_delete_backup_plan_association_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_backup_plan_association_async_from_dict(): - await test_delete_backup_plan_association_async(request_type=dict) - - def test_delete_backup_plan_association_field_headers(): client = BackupDRClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14631,8 +14697,8 @@ async def test_delete_backup_plan_association_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - backupplanassociation.TriggerBackupRequest, - dict, + backupplanassociation.TriggerBackupRequest(), + {}, ], ) def test_trigger_backup(request_type, transport: str = "grpc"): @@ -14643,7 +14709,7 @@ def test_trigger_backup(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.trigger_backup), "__call__") as call: @@ -14685,10 +14751,11 @@ def test_trigger_backup_non_empty_request_with_auto_populated_field(): client.trigger_backup(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == backupplanassociation.TriggerBackupRequest( + request_msg = backupplanassociation.TriggerBackupRequest( name="name_value", rule_id="rule_id_value", ) + assert args[0] == request_msg def test_trigger_backup_use_cached_wrapped_rpc(): @@ -14779,10 +14846,14 @@ async def test_trigger_backup_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_trigger_backup_async( - transport: str = "grpc_asyncio", - request_type=backupplanassociation.TriggerBackupRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + backupplanassociation.TriggerBackupRequest(), + {}, + ], +) +async def test_trigger_backup_async(request_type, transport: str = "grpc_asyncio"): client = BackupDRAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14790,7 +14861,7 @@ async def test_trigger_backup_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.trigger_backup), "__call__") as call: @@ -14810,11 +14881,6 @@ async def test_trigger_backup_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_trigger_backup_async_from_dict(): - await test_trigger_backup_async(request_type=dict) - - def test_trigger_backup_field_headers(): client = BackupDRClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14971,8 +15037,8 @@ async def test_trigger_backup_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datasourcereference.GetDataSourceReferenceRequest, - dict, + datasourcereference.GetDataSourceReferenceRequest(), + {}, ], ) def test_get_data_source_reference(request_type, transport: str = "grpc"): @@ -14983,7 +15049,7 @@ def test_get_data_source_reference(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -15041,9 +15107,10 @@ def test_get_data_source_reference_non_empty_request_with_auto_populated_field() client.get_data_source_reference(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datasourcereference.GetDataSourceReferenceRequest( + request_msg = datasourcereference.GetDataSourceReferenceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_data_source_reference_use_cached_wrapped_rpc(): @@ -15129,9 +15196,15 @@ async def test_get_data_source_reference_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + datasourcereference.GetDataSourceReferenceRequest(), + {}, + ], +) async def test_get_data_source_reference_async( - transport: str = "grpc_asyncio", - request_type=datasourcereference.GetDataSourceReferenceRequest, + request_type, transport: str = "grpc_asyncio" ): client = BackupDRAsyncClient( credentials=async_anonymous_credentials(), @@ -15140,7 +15213,7 @@ async def test_get_data_source_reference_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( @@ -15175,11 +15248,6 @@ async def test_get_data_source_reference_async( assert response.total_stored_bytes == 1946 -@pytest.mark.asyncio -async def test_get_data_source_reference_async_from_dict(): - await test_get_data_source_reference_async(request_type=dict) - - def test_get_data_source_reference_field_headers(): client = BackupDRClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15334,8 +15402,8 @@ async def test_get_data_source_reference_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datasourcereference.ListDataSourceReferencesRequest, - dict, + datasourcereference.ListDataSourceReferencesRequest(), + {}, ], ) def test_list_data_source_references(request_type, transport: str = "grpc"): @@ -15346,7 +15414,7 @@ def test_list_data_source_references(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -15399,12 +15467,13 @@ def test_list_data_source_references_non_empty_request_with_auto_populated_field client.list_data_source_references(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datasourcereference.ListDataSourceReferencesRequest( + request_msg = datasourcereference.ListDataSourceReferencesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_data_source_references_use_cached_wrapped_rpc(): @@ -15490,9 +15559,15 @@ async def test_list_data_source_references_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + datasourcereference.ListDataSourceReferencesRequest(), + {}, + ], +) async def test_list_data_source_references_async( - transport: str = "grpc_asyncio", - request_type=datasourcereference.ListDataSourceReferencesRequest, + request_type, transport: str = "grpc_asyncio" ): client = BackupDRAsyncClient( credentials=async_anonymous_credentials(), @@ -15501,7 +15576,7 @@ async def test_list_data_source_references_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( @@ -15528,11 +15603,6 @@ async def test_list_data_source_references_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_data_source_references_async_from_dict(): - await test_list_data_source_references_async(request_type=dict) - - def test_list_data_source_references_field_headers(): client = BackupDRClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15891,8 +15961,8 @@ async def test_list_data_source_references_async_pages(): @pytest.mark.parametrize( "request_type", [ - datasourcereference.FetchDataSourceReferencesForResourceTypeRequest, - dict, + datasourcereference.FetchDataSourceReferencesForResourceTypeRequest(), + {}, ], ) def test_fetch_data_source_references_for_resource_type( @@ -15905,7 +15975,7 @@ def test_fetch_data_source_references_for_resource_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( @@ -15961,15 +16031,16 @@ def test_fetch_data_source_references_for_resource_type_non_empty_request_with_a client.fetch_data_source_references_for_resource_type(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == datasourcereference.FetchDataSourceReferencesForResourceTypeRequest( - parent="parent_value", - resource_type="resource_type_value", - page_token="page_token_value", - filter="filter_value", - order_by="order_by_value", + request_msg = ( + datasourcereference.FetchDataSourceReferencesForResourceTypeRequest( + parent="parent_value", + resource_type="resource_type_value", + page_token="page_token_value", + filter="filter_value", + order_by="order_by_value", + ) ) + assert args[0] == request_msg def test_fetch_data_source_references_for_resource_type_use_cached_wrapped_rpc(): @@ -16055,9 +16126,15 @@ async def test_fetch_data_source_references_for_resource_type_async_use_cached_w @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + datasourcereference.FetchDataSourceReferencesForResourceTypeRequest(), + {}, + ], +) async def test_fetch_data_source_references_for_resource_type_async( - transport: str = "grpc_asyncio", - request_type=datasourcereference.FetchDataSourceReferencesForResourceTypeRequest, + request_type, transport: str = "grpc_asyncio" ): client = BackupDRAsyncClient( credentials=async_anonymous_credentials(), @@ -16066,7 +16143,7 @@ async def test_fetch_data_source_references_for_resource_type_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( @@ -16094,11 +16171,6 @@ async def test_fetch_data_source_references_for_resource_type_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_fetch_data_source_references_for_resource_type_async_from_dict(): - await test_fetch_data_source_references_for_resource_type_async(request_type=dict) - - def test_fetch_data_source_references_for_resource_type_field_headers(): client = BackupDRClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16487,8 +16559,8 @@ async def test_fetch_data_source_references_for_resource_type_async_pages(): @pytest.mark.parametrize( "request_type", [ - backupdr.InitializeServiceRequest, - dict, + backupdr.InitializeServiceRequest(), + {}, ], ) def test_initialize_service(request_type, transport: str = "grpc"): @@ -16499,7 +16571,7 @@ def test_initialize_service(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -16545,10 +16617,11 @@ def test_initialize_service_non_empty_request_with_auto_populated_field(): client.initialize_service(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == backupdr.InitializeServiceRequest( + request_msg = backupdr.InitializeServiceRequest( name="name_value", resource_type="resource_type_value", ) + assert args[0] == request_msg def test_initialize_service_use_cached_wrapped_rpc(): @@ -16643,9 +16716,14 @@ async def test_initialize_service_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_initialize_service_async( - transport: str = "grpc_asyncio", request_type=backupdr.InitializeServiceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + backupdr.InitializeServiceRequest(), + {}, + ], +) +async def test_initialize_service_async(request_type, transport: str = "grpc_asyncio"): client = BackupDRAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -16653,7 +16731,7 @@ async def test_initialize_service_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( @@ -16675,11 +16753,6 @@ async def test_initialize_service_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_initialize_service_async_from_dict(): - await test_initialize_service_async(request_type=dict) - - def test_initialize_service_field_headers(): client = BackupDRClient( credentials=ga_credentials.AnonymousCredentials(), @@ -25048,7 +25121,6 @@ def test_list_management_servers_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupdr.ListManagementServersRequest() - assert args[0] == request_msg @@ -25071,7 +25143,6 @@ def test_get_management_server_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupdr.GetManagementServerRequest() - assert args[0] == request_msg @@ -25094,7 +25165,6 @@ def test_create_management_server_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupdr.CreateManagementServerRequest() - assert args[0] == request_msg @@ -25117,7 +25187,6 @@ def test_delete_management_server_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupdr.DeleteManagementServerRequest() - assert args[0] == request_msg @@ -25140,7 +25209,6 @@ def test_create_backup_vault_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupvault.CreateBackupVaultRequest() - assert args[0] == request_msg @@ -25163,7 +25231,6 @@ def test_list_backup_vaults_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupvault.ListBackupVaultsRequest() - assert args[0] == request_msg @@ -25186,7 +25253,6 @@ def test_fetch_usable_backup_vaults_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupvault.FetchUsableBackupVaultsRequest() - assert args[0] == request_msg @@ -25207,7 +25273,6 @@ def test_get_backup_vault_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupvault.GetBackupVaultRequest() - assert args[0] == request_msg @@ -25230,7 +25295,6 @@ def test_update_backup_vault_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupvault.UpdateBackupVaultRequest() - assert args[0] == request_msg @@ -25253,7 +25317,6 @@ def test_delete_backup_vault_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupvault.DeleteBackupVaultRequest() - assert args[0] == request_msg @@ -25276,7 +25339,6 @@ def test_list_data_sources_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupvault.ListDataSourcesRequest() - assert args[0] == request_msg @@ -25297,7 +25359,6 @@ def test_get_data_source_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupvault.GetDataSourceRequest() - assert args[0] == request_msg @@ -25320,7 +25381,6 @@ def test_update_data_source_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupvault.UpdateDataSourceRequest() - assert args[0] == request_msg @@ -25341,7 +25401,6 @@ def test_list_backups_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupvault.ListBackupsRequest() - assert args[0] == request_msg @@ -25364,7 +25423,6 @@ def test_fetch_backups_for_resource_type_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupvault.FetchBackupsForResourceTypeRequest() - assert args[0] == request_msg @@ -25385,7 +25443,6 @@ def test_get_backup_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupvault.GetBackupRequest() - assert args[0] == request_msg @@ -25406,7 +25463,6 @@ def test_update_backup_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupvault.UpdateBackupRequest() - assert args[0] == request_msg @@ -25427,7 +25483,6 @@ def test_delete_backup_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupvault.DeleteBackupRequest() - assert args[0] == request_msg @@ -25448,7 +25503,6 @@ def test_restore_backup_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupvault.RestoreBackupRequest() - assert args[0] == request_msg @@ -25471,7 +25525,6 @@ def test_create_backup_plan_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupplan.CreateBackupPlanRequest() - assert args[0] == request_msg @@ -25494,7 +25547,6 @@ def test_update_backup_plan_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupplan.UpdateBackupPlanRequest() - assert args[0] == request_msg @@ -25515,7 +25567,6 @@ def test_get_backup_plan_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupplan.GetBackupPlanRequest() - assert args[0] == request_msg @@ -25538,7 +25589,6 @@ def test_list_backup_plans_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupplan.ListBackupPlansRequest() - assert args[0] == request_msg @@ -25561,7 +25611,6 @@ def test_delete_backup_plan_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupplan.DeleteBackupPlanRequest() - assert args[0] == request_msg @@ -25584,7 +25633,6 @@ def test_get_backup_plan_revision_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupplan.GetBackupPlanRevisionRequest() - assert args[0] == request_msg @@ -25607,7 +25655,6 @@ def test_list_backup_plan_revisions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupplan.ListBackupPlanRevisionsRequest() - assert args[0] == request_msg @@ -25630,7 +25677,6 @@ def test_create_backup_plan_association_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupplanassociation.CreateBackupPlanAssociationRequest() - assert args[0] == request_msg @@ -25653,7 +25699,6 @@ def test_update_backup_plan_association_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupplanassociation.UpdateBackupPlanAssociationRequest() - assert args[0] == request_msg @@ -25676,7 +25721,6 @@ def test_get_backup_plan_association_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupplanassociation.GetBackupPlanAssociationRequest() - assert args[0] == request_msg @@ -25699,7 +25743,6 @@ def test_list_backup_plan_associations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupplanassociation.ListBackupPlanAssociationsRequest() - assert args[0] == request_msg @@ -25727,7 +25770,6 @@ def test_fetch_backup_plan_associations_for_resource_type_empty_call_grpc(): request_msg = ( backupplanassociation.FetchBackupPlanAssociationsForResourceTypeRequest() ) - assert args[0] == request_msg @@ -25750,7 +25792,6 @@ def test_delete_backup_plan_association_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupplanassociation.DeleteBackupPlanAssociationRequest() - assert args[0] == request_msg @@ -25771,7 +25812,6 @@ def test_trigger_backup_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupplanassociation.TriggerBackupRequest() - assert args[0] == request_msg @@ -25794,7 +25834,6 @@ def test_get_data_source_reference_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datasourcereference.GetDataSourceReferenceRequest() - assert args[0] == request_msg @@ -25817,7 +25856,6 @@ def test_list_data_source_references_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datasourcereference.ListDataSourceReferencesRequest() - assert args[0] == request_msg @@ -25845,7 +25883,6 @@ def test_fetch_data_source_references_for_resource_type_empty_call_grpc(): request_msg = ( datasourcereference.FetchDataSourceReferencesForResourceTypeRequest() ) - assert args[0] == request_msg @@ -25868,7 +25905,6 @@ def test_initialize_service_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupdr.InitializeServiceRequest() - assert args[0] == request_msg @@ -25912,7 +25948,6 @@ async def test_list_management_servers_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupdr.ListManagementServersRequest() - assert args[0] == request_msg @@ -25948,7 +25983,6 @@ async def test_get_management_server_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupdr.GetManagementServerRequest() - assert args[0] == request_msg @@ -25975,7 +26009,6 @@ async def test_create_management_server_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupdr.CreateManagementServerRequest() - assert args[0] == request_msg @@ -26002,7 +26035,6 @@ async def test_delete_management_server_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupdr.DeleteManagementServerRequest() - assert args[0] == request_msg @@ -26029,7 +26061,6 @@ async def test_create_backup_vault_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupvault.CreateBackupVaultRequest() - assert args[0] == request_msg @@ -26059,7 +26090,6 @@ async def test_list_backup_vaults_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupvault.ListBackupVaultsRequest() - assert args[0] == request_msg @@ -26089,7 +26119,6 @@ async def test_fetch_usable_backup_vaults_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupvault.FetchUsableBackupVaultsRequest() - assert args[0] == request_msg @@ -26126,7 +26155,6 @@ async def test_get_backup_vault_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupvault.GetBackupVaultRequest() - assert args[0] == request_msg @@ -26153,7 +26181,6 @@ async def test_update_backup_vault_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupvault.UpdateBackupVaultRequest() - assert args[0] == request_msg @@ -26180,7 +26207,6 @@ async def test_delete_backup_vault_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupvault.DeleteBackupVaultRequest() - assert args[0] == request_msg @@ -26210,7 +26236,6 @@ async def test_list_data_sources_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupvault.ListDataSourcesRequest() - assert args[0] == request_msg @@ -26243,7 +26268,6 @@ async def test_get_data_source_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupvault.GetDataSourceRequest() - assert args[0] == request_msg @@ -26270,7 +26294,6 @@ async def test_update_data_source_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupvault.UpdateDataSourceRequest() - assert args[0] == request_msg @@ -26298,7 +26321,6 @@ async def test_list_backups_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupvault.ListBackupsRequest() - assert args[0] == request_msg @@ -26327,7 +26349,6 @@ async def test_fetch_backups_for_resource_type_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupvault.FetchBackupsForResourceTypeRequest() - assert args[0] == request_msg @@ -26363,7 +26384,6 @@ async def test_get_backup_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupvault.GetBackupRequest() - assert args[0] == request_msg @@ -26388,7 +26408,6 @@ async def test_update_backup_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupvault.UpdateBackupRequest() - assert args[0] == request_msg @@ -26413,7 +26432,6 @@ async def test_delete_backup_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupvault.DeleteBackupRequest() - assert args[0] == request_msg @@ -26438,7 +26456,6 @@ async def test_restore_backup_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupvault.RestoreBackupRequest() - assert args[0] == request_msg @@ -26465,7 +26482,6 @@ async def test_create_backup_plan_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupplan.CreateBackupPlanRequest() - assert args[0] == request_msg @@ -26492,7 +26508,6 @@ async def test_update_backup_plan_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupplan.UpdateBackupPlanRequest() - assert args[0] == request_msg @@ -26529,7 +26544,6 @@ async def test_get_backup_plan_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupplan.GetBackupPlanRequest() - assert args[0] == request_msg @@ -26559,7 +26573,6 @@ async def test_list_backup_plans_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupplan.ListBackupPlansRequest() - assert args[0] == request_msg @@ -26586,7 +26599,6 @@ async def test_delete_backup_plan_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupplan.DeleteBackupPlanRequest() - assert args[0] == request_msg @@ -26617,7 +26629,6 @@ async def test_get_backup_plan_revision_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupplan.GetBackupPlanRevisionRequest() - assert args[0] == request_msg @@ -26647,7 +26658,6 @@ async def test_list_backup_plan_revisions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupplan.ListBackupPlanRevisionsRequest() - assert args[0] == request_msg @@ -26674,7 +26684,6 @@ async def test_create_backup_plan_association_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupplanassociation.CreateBackupPlanAssociationRequest() - assert args[0] == request_msg @@ -26701,7 +26710,6 @@ async def test_update_backup_plan_association_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupplanassociation.UpdateBackupPlanAssociationRequest() - assert args[0] == request_msg @@ -26737,7 +26745,6 @@ async def test_get_backup_plan_association_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupplanassociation.GetBackupPlanAssociationRequest() - assert args[0] == request_msg @@ -26767,7 +26774,6 @@ async def test_list_backup_plan_associations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupplanassociation.ListBackupPlanAssociationsRequest() - assert args[0] == request_msg @@ -26799,7 +26805,6 @@ async def test_fetch_backup_plan_associations_for_resource_type_empty_call_grpc_ request_msg = ( backupplanassociation.FetchBackupPlanAssociationsForResourceTypeRequest() ) - assert args[0] == request_msg @@ -26826,7 +26831,6 @@ async def test_delete_backup_plan_association_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupplanassociation.DeleteBackupPlanAssociationRequest() - assert args[0] == request_msg @@ -26851,7 +26855,6 @@ async def test_trigger_backup_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupplanassociation.TriggerBackupRequest() - assert args[0] == request_msg @@ -26884,7 +26887,6 @@ async def test_get_data_source_reference_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datasourcereference.GetDataSourceReferenceRequest() - assert args[0] == request_msg @@ -26914,7 +26916,6 @@ async def test_list_data_source_references_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datasourcereference.ListDataSourceReferencesRequest() - assert args[0] == request_msg @@ -26946,7 +26947,6 @@ async def test_fetch_data_source_references_for_resource_type_empty_call_grpc_as request_msg = ( datasourcereference.FetchDataSourceReferencesForResourceTypeRequest() ) - assert args[0] == request_msg @@ -26973,7 +26973,6 @@ async def test_initialize_service_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupdr.InitializeServiceRequest() - assert args[0] == request_msg @@ -33641,7 +33640,6 @@ def test_list_management_servers_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupdr.ListManagementServersRequest() - assert args[0] == request_msg @@ -33663,7 +33661,6 @@ def test_get_management_server_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupdr.GetManagementServerRequest() - assert args[0] == request_msg @@ -33685,7 +33682,6 @@ def test_create_management_server_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupdr.CreateManagementServerRequest() - assert args[0] == request_msg @@ -33707,7 +33703,6 @@ def test_delete_management_server_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupdr.DeleteManagementServerRequest() - assert args[0] == request_msg @@ -33729,7 +33724,6 @@ def test_create_backup_vault_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupvault.CreateBackupVaultRequest() - assert args[0] == request_msg @@ -33751,7 +33745,6 @@ def test_list_backup_vaults_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupvault.ListBackupVaultsRequest() - assert args[0] == request_msg @@ -33773,7 +33766,6 @@ def test_fetch_usable_backup_vaults_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupvault.FetchUsableBackupVaultsRequest() - assert args[0] == request_msg @@ -33793,7 +33785,6 @@ def test_get_backup_vault_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupvault.GetBackupVaultRequest() - assert args[0] == request_msg @@ -33815,7 +33806,6 @@ def test_update_backup_vault_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupvault.UpdateBackupVaultRequest() - assert args[0] == request_msg @@ -33837,7 +33827,6 @@ def test_delete_backup_vault_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupvault.DeleteBackupVaultRequest() - assert args[0] == request_msg @@ -33859,7 +33848,6 @@ def test_list_data_sources_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupvault.ListDataSourcesRequest() - assert args[0] == request_msg @@ -33879,7 +33867,6 @@ def test_get_data_source_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupvault.GetDataSourceRequest() - assert args[0] == request_msg @@ -33901,7 +33888,6 @@ def test_update_data_source_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupvault.UpdateDataSourceRequest() - assert args[0] == request_msg @@ -33921,7 +33907,6 @@ def test_list_backups_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupvault.ListBackupsRequest() - assert args[0] == request_msg @@ -33943,7 +33928,6 @@ def test_fetch_backups_for_resource_type_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupvault.FetchBackupsForResourceTypeRequest() - assert args[0] == request_msg @@ -33963,7 +33947,6 @@ def test_get_backup_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupvault.GetBackupRequest() - assert args[0] == request_msg @@ -33983,7 +33966,6 @@ def test_update_backup_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupvault.UpdateBackupRequest() - assert args[0] == request_msg @@ -34003,7 +33985,6 @@ def test_delete_backup_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupvault.DeleteBackupRequest() - assert args[0] == request_msg @@ -34023,7 +34004,6 @@ def test_restore_backup_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupvault.RestoreBackupRequest() - assert args[0] == request_msg @@ -34045,7 +34025,6 @@ def test_create_backup_plan_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupplan.CreateBackupPlanRequest() - assert args[0] == request_msg @@ -34067,7 +34046,6 @@ def test_update_backup_plan_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupplan.UpdateBackupPlanRequest() - assert args[0] == request_msg @@ -34087,7 +34065,6 @@ def test_get_backup_plan_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupplan.GetBackupPlanRequest() - assert args[0] == request_msg @@ -34109,7 +34086,6 @@ def test_list_backup_plans_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupplan.ListBackupPlansRequest() - assert args[0] == request_msg @@ -34131,7 +34107,6 @@ def test_delete_backup_plan_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupplan.DeleteBackupPlanRequest() - assert args[0] == request_msg @@ -34153,7 +34128,6 @@ def test_get_backup_plan_revision_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupplan.GetBackupPlanRevisionRequest() - assert args[0] == request_msg @@ -34175,7 +34149,6 @@ def test_list_backup_plan_revisions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupplan.ListBackupPlanRevisionsRequest() - assert args[0] == request_msg @@ -34197,7 +34170,6 @@ def test_create_backup_plan_association_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupplanassociation.CreateBackupPlanAssociationRequest() - assert args[0] == request_msg @@ -34219,7 +34191,6 @@ def test_update_backup_plan_association_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupplanassociation.UpdateBackupPlanAssociationRequest() - assert args[0] == request_msg @@ -34241,7 +34212,6 @@ def test_get_backup_plan_association_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupplanassociation.GetBackupPlanAssociationRequest() - assert args[0] == request_msg @@ -34263,7 +34233,6 @@ def test_list_backup_plan_associations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupplanassociation.ListBackupPlanAssociationsRequest() - assert args[0] == request_msg @@ -34288,7 +34257,6 @@ def test_fetch_backup_plan_associations_for_resource_type_empty_call_rest(): request_msg = ( backupplanassociation.FetchBackupPlanAssociationsForResourceTypeRequest() ) - assert args[0] == request_msg @@ -34310,7 +34278,6 @@ def test_delete_backup_plan_association_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupplanassociation.DeleteBackupPlanAssociationRequest() - assert args[0] == request_msg @@ -34330,7 +34297,6 @@ def test_trigger_backup_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupplanassociation.TriggerBackupRequest() - assert args[0] == request_msg @@ -34352,7 +34318,6 @@ def test_get_data_source_reference_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datasourcereference.GetDataSourceReferenceRequest() - assert args[0] == request_msg @@ -34374,7 +34339,6 @@ def test_list_data_source_references_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datasourcereference.ListDataSourceReferencesRequest() - assert args[0] == request_msg @@ -34399,7 +34363,6 @@ def test_fetch_data_source_references_for_resource_type_empty_call_rest(): request_msg = ( datasourcereference.FetchDataSourceReferencesForResourceTypeRequest() ) - assert args[0] == request_msg @@ -34421,7 +34384,6 @@ def test_initialize_service_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backupdr.InitializeServiceRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-backupdr/tests/unit/gapic/backupdr_v1/test_backup_dr_protection_summary.py b/packages/google-cloud-backupdr/tests/unit/gapic/backupdr_v1/test_backup_dr_protection_summary.py index bebdc2e7c76e..94946da1710a 100644 --- a/packages/google-cloud-backupdr/tests/unit/gapic/backupdr_v1/test_backup_dr_protection_summary.py +++ b/packages/google-cloud-backupdr/tests/unit/gapic/backupdr_v1/test_backup_dr_protection_summary.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 @@ -114,6 +115,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" @@ -1396,8 +1412,8 @@ def test_backup_dr_protection_summary_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - protection_summary.ListResourceBackupConfigsRequest, - dict, + protection_summary.ListResourceBackupConfigsRequest(), + {}, ], ) def test_list_resource_backup_configs(request_type, transport: str = "grpc"): @@ -1408,7 +1424,7 @@ def test_list_resource_backup_configs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,12 +1475,13 @@ def test_list_resource_backup_configs_non_empty_request_with_auto_populated_fiel client.list_resource_backup_configs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == protection_summary.ListResourceBackupConfigsRequest( + request_msg = protection_summary.ListResourceBackupConfigsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_resource_backup_configs_use_cached_wrapped_rpc(): @@ -1550,9 +1567,15 @@ async def test_list_resource_backup_configs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + protection_summary.ListResourceBackupConfigsRequest(), + {}, + ], +) async def test_list_resource_backup_configs_async( - transport: str = "grpc_asyncio", - request_type=protection_summary.ListResourceBackupConfigsRequest, + request_type, transport: str = "grpc_asyncio" ): client = BackupDrProtectionSummaryAsyncClient( credentials=async_anonymous_credentials(), @@ -1561,7 +1584,7 @@ async def test_list_resource_backup_configs_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( @@ -1586,11 +1609,6 @@ async def test_list_resource_backup_configs_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_resource_backup_configs_async_from_dict(): - await test_list_resource_backup_configs_async(request_type=dict) - - def test_list_resource_backup_configs_field_headers(): client = BackupDrProtectionSummaryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2345,7 +2363,6 @@ def test_list_resource_backup_configs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = protection_summary.ListResourceBackupConfigsRequest() - assert args[0] == request_msg @@ -2388,7 +2405,6 @@ async def test_list_resource_backup_configs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = protection_summary.ListResourceBackupConfigsRequest() - assert args[0] == request_msg @@ -3136,7 +3152,6 @@ def test_list_resource_backup_configs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = protection_summary.ListResourceBackupConfigsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-bare-metal-solution/noxfile.py b/packages/google-cloud-bare-metal-solution/noxfile.py index 831bd41975b8..ff32011b2c06 100644 --- a/packages/google-cloud-bare-metal-solution/noxfile.py +++ b/packages/google-cloud-bare-metal-solution/noxfile.py @@ -47,7 +47,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-bare-metal-solution" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-bare-metal-solution/setup.py b/packages/google-cloud-bare-metal-solution/setup.py index 77993802b217..06ba1790302e 100644 --- a/packages/google-cloud-bare-metal-solution/setup.py +++ b/packages/google-cloud-bare-metal-solution/setup.py @@ -45,7 +45,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/google-cloud-bare-metal-solution/testing/constraints-3.10.txt b/packages/google-cloud-bare-metal-solution/testing/constraints-3.10.txt index a92801e1c8e2..b39cd54634f9 100644 --- a/packages/google-cloud-bare-metal-solution/testing/constraints-3.10.txt +++ b/packages/google-cloud-bare-metal-solution/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/google-cloud-bare-metal-solution/tests/unit/gapic/bare_metal_solution_v2/test_bare_metal_solution.py b/packages/google-cloud-bare-metal-solution/tests/unit/gapic/bare_metal_solution_v2/test_bare_metal_solution.py index b4e84764e7c5..0ac50ff64557 100644 --- a/packages/google-cloud-bare-metal-solution/tests/unit/gapic/bare_metal_solution_v2/test_bare_metal_solution.py +++ b/packages/google-cloud-bare-metal-solution/tests/unit/gapic/bare_metal_solution_v2/test_bare_metal_solution.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 @@ -141,6 +142,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" @@ -1382,8 +1398,8 @@ def test_bare_metal_solution_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - instance.ListInstancesRequest, - dict, + instance.ListInstancesRequest(), + {}, ], ) def test_list_instances(request_type, transport: str = "grpc"): @@ -1394,7 +1410,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(type(client.transport.list_instances), "__call__") as call: @@ -1442,11 +1458,12 @@ 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] == instance.ListInstancesRequest( + request_msg = instance.ListInstancesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_instances_use_cached_wrapped_rpc(): @@ -1527,9 +1544,14 @@ async def test_list_instances_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_instances_async( - transport: str = "grpc_asyncio", request_type=instance.ListInstancesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + instance.ListInstancesRequest(), + {}, + ], +) +async def test_list_instances_async(request_type, transport: str = "grpc_asyncio"): client = BareMetalSolutionAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1537,7 +1559,7 @@ async def test_list_instances_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_instances), "__call__") as call: @@ -1562,11 +1584,6 @@ async def test_list_instances_async( 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 = BareMetalSolutionClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1903,8 +1920,8 @@ async def test_list_instances_async_pages(): @pytest.mark.parametrize( "request_type", [ - instance.GetInstanceRequest, - dict, + instance.GetInstanceRequest(), + {}, ], ) def test_get_instance(request_type, transport: str = "grpc"): @@ -1915,7 +1932,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(type(client.transport.get_instance), "__call__") as call: @@ -1981,9 +1998,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] == instance.GetInstanceRequest( + request_msg = instance.GetInstanceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_instance_use_cached_wrapped_rpc(): @@ -2064,9 +2082,14 @@ async def test_get_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_instance_async( - transport: str = "grpc_asyncio", request_type=instance.GetInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + instance.GetInstanceRequest(), + {}, + ], +) +async def test_get_instance_async(request_type, transport: str = "grpc_asyncio"): client = BareMetalSolutionAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2074,7 +2097,7 @@ async def test_get_instance_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_instance), "__call__") as call: @@ -2119,11 +2142,6 @@ async def test_get_instance_async( assert response.firmware_version == "firmware_version_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 = BareMetalSolutionClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2266,8 +2284,8 @@ async def test_get_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcb_instance.UpdateInstanceRequest, - dict, + gcb_instance.UpdateInstanceRequest(), + {}, ], ) def test_update_instance(request_type, transport: str = "grpc"): @@ -2278,7 +2296,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(type(client.transport.update_instance), "__call__") as call: @@ -2317,7 +2335,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] - assert args[0] == gcb_instance.UpdateInstanceRequest() + request_msg = gcb_instance.UpdateInstanceRequest() + assert args[0] == request_msg def test_update_instance_use_cached_wrapped_rpc(): @@ -2408,9 +2427,14 @@ async def test_update_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_instance_async( - transport: str = "grpc_asyncio", request_type=gcb_instance.UpdateInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcb_instance.UpdateInstanceRequest(), + {}, + ], +) +async def test_update_instance_async(request_type, transport: str = "grpc_asyncio"): client = BareMetalSolutionAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2418,7 +2442,7 @@ async def test_update_instance_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_instance), "__call__") as call: @@ -2438,11 +2462,6 @@ async def test_update_instance_async( 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 = BareMetalSolutionClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2599,8 +2618,8 @@ async def test_update_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - instance.RenameInstanceRequest, - dict, + instance.RenameInstanceRequest(), + {}, ], ) def test_rename_instance(request_type, transport: str = "grpc"): @@ -2611,7 +2630,7 @@ def test_rename_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(type(client.transport.rename_instance), "__call__") as call: @@ -2678,10 +2697,11 @@ def test_rename_instance_non_empty_request_with_auto_populated_field(): client.rename_instance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == instance.RenameInstanceRequest( + request_msg = instance.RenameInstanceRequest( name="name_value", new_instance_id="new_instance_id_value", ) + assert args[0] == request_msg def test_rename_instance_use_cached_wrapped_rpc(): @@ -2762,9 +2782,14 @@ async def test_rename_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_rename_instance_async( - transport: str = "grpc_asyncio", request_type=instance.RenameInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + instance.RenameInstanceRequest(), + {}, + ], +) +async def test_rename_instance_async(request_type, transport: str = "grpc_asyncio"): client = BareMetalSolutionAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2772,7 +2797,7 @@ async def test_rename_instance_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.rename_instance), "__call__") as call: @@ -2817,11 +2842,6 @@ async def test_rename_instance_async( assert response.firmware_version == "firmware_version_value" -@pytest.mark.asyncio -async def test_rename_instance_async_from_dict(): - await test_rename_instance_async(request_type=dict) - - def test_rename_instance_field_headers(): client = BareMetalSolutionClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2974,8 +2994,8 @@ async def test_rename_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - instance.ResetInstanceRequest, - dict, + instance.ResetInstanceRequest(), + {}, ], ) def test_reset_instance(request_type, transport: str = "grpc"): @@ -2986,7 +3006,7 @@ def test_reset_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(type(client.transport.reset_instance), "__call__") as call: @@ -3027,9 +3047,10 @@ def test_reset_instance_non_empty_request_with_auto_populated_field(): client.reset_instance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == instance.ResetInstanceRequest( + request_msg = instance.ResetInstanceRequest( name="name_value", ) + assert args[0] == request_msg def test_reset_instance_use_cached_wrapped_rpc(): @@ -3120,9 +3141,14 @@ async def test_reset_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_reset_instance_async( - transport: str = "grpc_asyncio", request_type=instance.ResetInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + instance.ResetInstanceRequest(), + {}, + ], +) +async def test_reset_instance_async(request_type, transport: str = "grpc_asyncio"): client = BareMetalSolutionAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3130,7 +3156,7 @@ async def test_reset_instance_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.reset_instance), "__call__") as call: @@ -3150,11 +3176,6 @@ async def test_reset_instance_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_reset_instance_async_from_dict(): - await test_reset_instance_async(request_type=dict) - - def test_reset_instance_field_headers(): client = BareMetalSolutionClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3301,8 +3322,8 @@ async def test_reset_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - instance.StartInstanceRequest, - dict, + instance.StartInstanceRequest(), + {}, ], ) def test_start_instance(request_type, transport: str = "grpc"): @@ -3313,7 +3334,7 @@ def test_start_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(type(client.transport.start_instance), "__call__") as call: @@ -3354,9 +3375,10 @@ def test_start_instance_non_empty_request_with_auto_populated_field(): client.start_instance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == instance.StartInstanceRequest( + request_msg = instance.StartInstanceRequest( name="name_value", ) + assert args[0] == request_msg def test_start_instance_use_cached_wrapped_rpc(): @@ -3447,9 +3469,14 @@ async def test_start_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_start_instance_async( - transport: str = "grpc_asyncio", request_type=instance.StartInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + instance.StartInstanceRequest(), + {}, + ], +) +async def test_start_instance_async(request_type, transport: str = "grpc_asyncio"): client = BareMetalSolutionAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3457,7 +3484,7 @@ async def test_start_instance_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.start_instance), "__call__") as call: @@ -3477,11 +3504,6 @@ async def test_start_instance_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_start_instance_async_from_dict(): - await test_start_instance_async(request_type=dict) - - def test_start_instance_field_headers(): client = BareMetalSolutionClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3628,8 +3650,8 @@ async def test_start_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - instance.StopInstanceRequest, - dict, + instance.StopInstanceRequest(), + {}, ], ) def test_stop_instance(request_type, transport: str = "grpc"): @@ -3640,7 +3662,7 @@ def test_stop_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(type(client.transport.stop_instance), "__call__") as call: @@ -3681,9 +3703,10 @@ def test_stop_instance_non_empty_request_with_auto_populated_field(): client.stop_instance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == instance.StopInstanceRequest( + request_msg = instance.StopInstanceRequest( name="name_value", ) + assert args[0] == request_msg def test_stop_instance_use_cached_wrapped_rpc(): @@ -3774,9 +3797,14 @@ async def test_stop_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_stop_instance_async( - transport: str = "grpc_asyncio", request_type=instance.StopInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + instance.StopInstanceRequest(), + {}, + ], +) +async def test_stop_instance_async(request_type, transport: str = "grpc_asyncio"): client = BareMetalSolutionAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3784,7 +3812,7 @@ async def test_stop_instance_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.stop_instance), "__call__") as call: @@ -3804,11 +3832,6 @@ async def test_stop_instance_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_stop_instance_async_from_dict(): - await test_stop_instance_async(request_type=dict) - - def test_stop_instance_field_headers(): client = BareMetalSolutionClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3955,8 +3978,8 @@ async def test_stop_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - instance.EnableInteractiveSerialConsoleRequest, - dict, + instance.EnableInteractiveSerialConsoleRequest(), + {}, ], ) def test_enable_interactive_serial_console(request_type, transport: str = "grpc"): @@ -3967,7 +3990,7 @@ def test_enable_interactive_serial_console(request_type, transport: str = "grpc" # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4012,9 +4035,10 @@ def test_enable_interactive_serial_console_non_empty_request_with_auto_populated client.enable_interactive_serial_console(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == instance.EnableInteractiveSerialConsoleRequest( + request_msg = instance.EnableInteractiveSerialConsoleRequest( name="name_value", ) + assert args[0] == request_msg def test_enable_interactive_serial_console_use_cached_wrapped_rpc(): @@ -4110,9 +4134,15 @@ async def test_enable_interactive_serial_console_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + instance.EnableInteractiveSerialConsoleRequest(), + {}, + ], +) async def test_enable_interactive_serial_console_async( - transport: str = "grpc_asyncio", - request_type=instance.EnableInteractiveSerialConsoleRequest, + request_type, transport: str = "grpc_asyncio" ): client = BareMetalSolutionAsyncClient( credentials=async_anonymous_credentials(), @@ -4121,7 +4151,7 @@ async def test_enable_interactive_serial_console_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( @@ -4143,11 +4173,6 @@ async def test_enable_interactive_serial_console_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_enable_interactive_serial_console_async_from_dict(): - await test_enable_interactive_serial_console_async(request_type=dict) - - def test_enable_interactive_serial_console_field_headers(): client = BareMetalSolutionClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4302,8 +4327,8 @@ async def test_enable_interactive_serial_console_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - instance.DisableInteractiveSerialConsoleRequest, - dict, + instance.DisableInteractiveSerialConsoleRequest(), + {}, ], ) def test_disable_interactive_serial_console(request_type, transport: str = "grpc"): @@ -4314,7 +4339,7 @@ def test_disable_interactive_serial_console(request_type, transport: str = "grpc # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4359,9 +4384,10 @@ def test_disable_interactive_serial_console_non_empty_request_with_auto_populate client.disable_interactive_serial_console(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == instance.DisableInteractiveSerialConsoleRequest( + request_msg = instance.DisableInteractiveSerialConsoleRequest( name="name_value", ) + assert args[0] == request_msg def test_disable_interactive_serial_console_use_cached_wrapped_rpc(): @@ -4457,9 +4483,15 @@ async def test_disable_interactive_serial_console_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + instance.DisableInteractiveSerialConsoleRequest(), + {}, + ], +) async def test_disable_interactive_serial_console_async( - transport: str = "grpc_asyncio", - request_type=instance.DisableInteractiveSerialConsoleRequest, + request_type, transport: str = "grpc_asyncio" ): client = BareMetalSolutionAsyncClient( credentials=async_anonymous_credentials(), @@ -4468,7 +4500,7 @@ async def test_disable_interactive_serial_console_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( @@ -4490,11 +4522,6 @@ async def test_disable_interactive_serial_console_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_disable_interactive_serial_console_async_from_dict(): - await test_disable_interactive_serial_console_async(request_type=dict) - - def test_disable_interactive_serial_console_field_headers(): client = BareMetalSolutionClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4649,8 +4676,8 @@ async def test_disable_interactive_serial_console_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcb_instance.DetachLunRequest, - dict, + gcb_instance.DetachLunRequest(), + {}, ], ) def test_detach_lun(request_type, transport: str = "grpc"): @@ -4661,7 +4688,7 @@ def test_detach_lun(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.detach_lun), "__call__") as call: @@ -4703,10 +4730,11 @@ def test_detach_lun_non_empty_request_with_auto_populated_field(): client.detach_lun(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcb_instance.DetachLunRequest( + request_msg = gcb_instance.DetachLunRequest( instance="instance_value", lun="lun_value", ) + assert args[0] == request_msg def test_detach_lun_use_cached_wrapped_rpc(): @@ -4795,9 +4823,14 @@ async def test_detach_lun_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_detach_lun_async( - transport: str = "grpc_asyncio", request_type=gcb_instance.DetachLunRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcb_instance.DetachLunRequest(), + {}, + ], +) +async def test_detach_lun_async(request_type, transport: str = "grpc_asyncio"): client = BareMetalSolutionAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4805,7 +4838,7 @@ async def test_detach_lun_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.detach_lun), "__call__") as call: @@ -4825,11 +4858,6 @@ async def test_detach_lun_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_detach_lun_async_from_dict(): - await test_detach_lun_async(request_type=dict) - - def test_detach_lun_field_headers(): client = BareMetalSolutionClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4986,8 +5014,8 @@ async def test_detach_lun_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - ssh_key.ListSSHKeysRequest, - dict, + ssh_key.ListSSHKeysRequest(), + {}, ], ) def test_list_ssh_keys(request_type, transport: str = "grpc"): @@ -4998,7 +5026,7 @@ def test_list_ssh_keys(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_ssh_keys), "__call__") as call: @@ -5043,10 +5071,11 @@ def test_list_ssh_keys_non_empty_request_with_auto_populated_field(): client.list_ssh_keys(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == ssh_key.ListSSHKeysRequest( + request_msg = ssh_key.ListSSHKeysRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_ssh_keys_use_cached_wrapped_rpc(): @@ -5127,9 +5156,14 @@ async def test_list_ssh_keys_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_ssh_keys_async( - transport: str = "grpc_asyncio", request_type=ssh_key.ListSSHKeysRequest -): +@pytest.mark.parametrize( + "request_type", + [ + ssh_key.ListSSHKeysRequest(), + {}, + ], +) +async def test_list_ssh_keys_async(request_type, transport: str = "grpc_asyncio"): client = BareMetalSolutionAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5137,7 +5171,7 @@ async def test_list_ssh_keys_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_ssh_keys), "__call__") as call: @@ -5160,11 +5194,6 @@ async def test_list_ssh_keys_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_ssh_keys_async_from_dict(): - await test_list_ssh_keys_async(request_type=dict) - - def test_list_ssh_keys_field_headers(): client = BareMetalSolutionClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5501,8 +5530,8 @@ async def test_list_ssh_keys_async_pages(): @pytest.mark.parametrize( "request_type", [ - gcb_ssh_key.CreateSSHKeyRequest, - dict, + gcb_ssh_key.CreateSSHKeyRequest(), + {}, ], ) def test_create_ssh_key(request_type, transport: str = "grpc"): @@ -5513,7 +5542,7 @@ def test_create_ssh_key(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_ssh_key), "__call__") as call: @@ -5560,10 +5589,11 @@ def test_create_ssh_key_non_empty_request_with_auto_populated_field(): client.create_ssh_key(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcb_ssh_key.CreateSSHKeyRequest( + request_msg = gcb_ssh_key.CreateSSHKeyRequest( parent="parent_value", ssh_key_id="ssh_key_id_value", ) + assert args[0] == request_msg def test_create_ssh_key_use_cached_wrapped_rpc(): @@ -5644,9 +5674,14 @@ async def test_create_ssh_key_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_ssh_key_async( - transport: str = "grpc_asyncio", request_type=gcb_ssh_key.CreateSSHKeyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcb_ssh_key.CreateSSHKeyRequest(), + {}, + ], +) +async def test_create_ssh_key_async(request_type, transport: str = "grpc_asyncio"): client = BareMetalSolutionAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5654,7 +5689,7 @@ async def test_create_ssh_key_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_ssh_key), "__call__") as call: @@ -5679,11 +5714,6 @@ async def test_create_ssh_key_async( assert response.public_key == "public_key_value" -@pytest.mark.asyncio -async def test_create_ssh_key_async_from_dict(): - await test_create_ssh_key_async(request_type=dict) - - def test_create_ssh_key_field_headers(): client = BareMetalSolutionClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5846,8 +5876,8 @@ async def test_create_ssh_key_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - ssh_key.DeleteSSHKeyRequest, - dict, + ssh_key.DeleteSSHKeyRequest(), + {}, ], ) def test_delete_ssh_key(request_type, transport: str = "grpc"): @@ -5858,7 +5888,7 @@ def test_delete_ssh_key(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_ssh_key), "__call__") as call: @@ -5899,9 +5929,10 @@ def test_delete_ssh_key_non_empty_request_with_auto_populated_field(): client.delete_ssh_key(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == ssh_key.DeleteSSHKeyRequest( + request_msg = ssh_key.DeleteSSHKeyRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_ssh_key_use_cached_wrapped_rpc(): @@ -5982,9 +6013,14 @@ async def test_delete_ssh_key_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_ssh_key_async( - transport: str = "grpc_asyncio", request_type=ssh_key.DeleteSSHKeyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + ssh_key.DeleteSSHKeyRequest(), + {}, + ], +) +async def test_delete_ssh_key_async(request_type, transport: str = "grpc_asyncio"): client = BareMetalSolutionAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5992,7 +6028,7 @@ async def test_delete_ssh_key_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_ssh_key), "__call__") as call: @@ -6010,11 +6046,6 @@ async def test_delete_ssh_key_async( assert response is None -@pytest.mark.asyncio -async def test_delete_ssh_key_async_from_dict(): - await test_delete_ssh_key_async(request_type=dict) - - def test_delete_ssh_key_field_headers(): client = BareMetalSolutionClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6157,8 +6188,8 @@ async def test_delete_ssh_key_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - volume.ListVolumesRequest, - dict, + volume.ListVolumesRequest(), + {}, ], ) def test_list_volumes(request_type, transport: str = "grpc"): @@ -6169,7 +6200,7 @@ def test_list_volumes(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_volumes), "__call__") as call: @@ -6217,11 +6248,12 @@ def test_list_volumes_non_empty_request_with_auto_populated_field(): client.list_volumes(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == volume.ListVolumesRequest( + request_msg = volume.ListVolumesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_volumes_use_cached_wrapped_rpc(): @@ -6302,9 +6334,14 @@ async def test_list_volumes_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_volumes_async( - transport: str = "grpc_asyncio", request_type=volume.ListVolumesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + volume.ListVolumesRequest(), + {}, + ], +) +async def test_list_volumes_async(request_type, transport: str = "grpc_asyncio"): client = BareMetalSolutionAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6312,7 +6349,7 @@ async def test_list_volumes_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_volumes), "__call__") as call: @@ -6337,11 +6374,6 @@ async def test_list_volumes_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_volumes_async_from_dict(): - await test_list_volumes_async(request_type=dict) - - def test_list_volumes_field_headers(): client = BareMetalSolutionClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6678,8 +6710,8 @@ async def test_list_volumes_async_pages(): @pytest.mark.parametrize( "request_type", [ - volume.GetVolumeRequest, - dict, + volume.GetVolumeRequest(), + {}, ], ) def test_get_volume(request_type, transport: str = "grpc"): @@ -6690,7 +6722,7 @@ def test_get_volume(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_volume), "__call__") as call: @@ -6780,9 +6812,10 @@ def test_get_volume_non_empty_request_with_auto_populated_field(): client.get_volume(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == volume.GetVolumeRequest( + request_msg = volume.GetVolumeRequest( name="name_value", ) + assert args[0] == request_msg def test_get_volume_use_cached_wrapped_rpc(): @@ -6861,9 +6894,14 @@ async def test_get_volume_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_volume_async( - transport: str = "grpc_asyncio", request_type=volume.GetVolumeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + volume.GetVolumeRequest(), + {}, + ], +) +async def test_get_volume_async(request_type, transport: str = "grpc_asyncio"): client = BareMetalSolutionAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6871,7 +6909,7 @@ async def test_get_volume_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_volume), "__call__") as call: @@ -6940,11 +6978,6 @@ async def test_get_volume_async( assert response.attached is True -@pytest.mark.asyncio -async def test_get_volume_async_from_dict(): - await test_get_volume_async(request_type=dict) - - def test_get_volume_field_headers(): client = BareMetalSolutionClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7087,8 +7120,8 @@ async def test_get_volume_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcb_volume.UpdateVolumeRequest, - dict, + gcb_volume.UpdateVolumeRequest(), + {}, ], ) def test_update_volume(request_type, transport: str = "grpc"): @@ -7099,7 +7132,7 @@ def test_update_volume(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_volume), "__call__") as call: @@ -7138,7 +7171,8 @@ def test_update_volume_non_empty_request_with_auto_populated_field(): client.update_volume(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcb_volume.UpdateVolumeRequest() + request_msg = gcb_volume.UpdateVolumeRequest() + assert args[0] == request_msg def test_update_volume_use_cached_wrapped_rpc(): @@ -7229,9 +7263,14 @@ async def test_update_volume_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_volume_async( - transport: str = "grpc_asyncio", request_type=gcb_volume.UpdateVolumeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcb_volume.UpdateVolumeRequest(), + {}, + ], +) +async def test_update_volume_async(request_type, transport: str = "grpc_asyncio"): client = BareMetalSolutionAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7239,7 +7278,7 @@ async def test_update_volume_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_volume), "__call__") as call: @@ -7259,11 +7298,6 @@ async def test_update_volume_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_volume_async_from_dict(): - await test_update_volume_async(request_type=dict) - - def test_update_volume_field_headers(): client = BareMetalSolutionClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7420,8 +7454,8 @@ async def test_update_volume_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - volume.RenameVolumeRequest, - dict, + volume.RenameVolumeRequest(), + {}, ], ) def test_rename_volume(request_type, transport: str = "grpc"): @@ -7432,7 +7466,7 @@ def test_rename_volume(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.rename_volume), "__call__") as call: @@ -7523,10 +7557,11 @@ def test_rename_volume_non_empty_request_with_auto_populated_field(): client.rename_volume(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == volume.RenameVolumeRequest( + request_msg = volume.RenameVolumeRequest( name="name_value", new_volume_id="new_volume_id_value", ) + assert args[0] == request_msg def test_rename_volume_use_cached_wrapped_rpc(): @@ -7607,9 +7642,14 @@ async def test_rename_volume_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_rename_volume_async( - transport: str = "grpc_asyncio", request_type=volume.RenameVolumeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + volume.RenameVolumeRequest(), + {}, + ], +) +async def test_rename_volume_async(request_type, transport: str = "grpc_asyncio"): client = BareMetalSolutionAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7617,7 +7657,7 @@ async def test_rename_volume_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.rename_volume), "__call__") as call: @@ -7686,11 +7726,6 @@ async def test_rename_volume_async( assert response.attached is True -@pytest.mark.asyncio -async def test_rename_volume_async_from_dict(): - await test_rename_volume_async(request_type=dict) - - def test_rename_volume_field_headers(): client = BareMetalSolutionClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7843,8 +7878,8 @@ async def test_rename_volume_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - volume.EvictVolumeRequest, - dict, + volume.EvictVolumeRequest(), + {}, ], ) def test_evict_volume(request_type, transport: str = "grpc"): @@ -7855,7 +7890,7 @@ def test_evict_volume(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.evict_volume), "__call__") as call: @@ -7896,9 +7931,10 @@ def test_evict_volume_non_empty_request_with_auto_populated_field(): client.evict_volume(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == volume.EvictVolumeRequest( + request_msg = volume.EvictVolumeRequest( name="name_value", ) + assert args[0] == request_msg def test_evict_volume_use_cached_wrapped_rpc(): @@ -7989,9 +8025,14 @@ async def test_evict_volume_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_evict_volume_async( - transport: str = "grpc_asyncio", request_type=volume.EvictVolumeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + volume.EvictVolumeRequest(), + {}, + ], +) +async def test_evict_volume_async(request_type, transport: str = "grpc_asyncio"): client = BareMetalSolutionAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7999,7 +8040,7 @@ async def test_evict_volume_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.evict_volume), "__call__") as call: @@ -8019,11 +8060,6 @@ async def test_evict_volume_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_evict_volume_async_from_dict(): - await test_evict_volume_async(request_type=dict) - - def test_evict_volume_field_headers(): client = BareMetalSolutionClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8170,8 +8206,8 @@ async def test_evict_volume_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcb_volume.ResizeVolumeRequest, - dict, + gcb_volume.ResizeVolumeRequest(), + {}, ], ) def test_resize_volume(request_type, transport: str = "grpc"): @@ -8182,7 +8218,7 @@ def test_resize_volume(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.resize_volume), "__call__") as call: @@ -8223,9 +8259,10 @@ def test_resize_volume_non_empty_request_with_auto_populated_field(): client.resize_volume(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcb_volume.ResizeVolumeRequest( + request_msg = gcb_volume.ResizeVolumeRequest( volume="volume_value", ) + assert args[0] == request_msg def test_resize_volume_use_cached_wrapped_rpc(): @@ -8316,9 +8353,14 @@ async def test_resize_volume_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_resize_volume_async( - transport: str = "grpc_asyncio", request_type=gcb_volume.ResizeVolumeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcb_volume.ResizeVolumeRequest(), + {}, + ], +) +async def test_resize_volume_async(request_type, transport: str = "grpc_asyncio"): client = BareMetalSolutionAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8326,7 +8368,7 @@ async def test_resize_volume_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.resize_volume), "__call__") as call: @@ -8346,11 +8388,6 @@ async def test_resize_volume_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_resize_volume_async_from_dict(): - await test_resize_volume_async(request_type=dict) - - def test_resize_volume_field_headers(): client = BareMetalSolutionClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8507,8 +8544,8 @@ async def test_resize_volume_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - network.ListNetworksRequest, - dict, + network.ListNetworksRequest(), + {}, ], ) def test_list_networks(request_type, transport: str = "grpc"): @@ -8519,7 +8556,7 @@ def test_list_networks(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_networks), "__call__") as call: @@ -8567,11 +8604,12 @@ def test_list_networks_non_empty_request_with_auto_populated_field(): client.list_networks(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == network.ListNetworksRequest( + request_msg = network.ListNetworksRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_networks_use_cached_wrapped_rpc(): @@ -8652,9 +8690,14 @@ async def test_list_networks_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_networks_async( - transport: str = "grpc_asyncio", request_type=network.ListNetworksRequest -): +@pytest.mark.parametrize( + "request_type", + [ + network.ListNetworksRequest(), + {}, + ], +) +async def test_list_networks_async(request_type, transport: str = "grpc_asyncio"): client = BareMetalSolutionAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8662,7 +8705,7 @@ async def test_list_networks_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_networks), "__call__") as call: @@ -8687,11 +8730,6 @@ async def test_list_networks_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_networks_async_from_dict(): - await test_list_networks_async(request_type=dict) - - def test_list_networks_field_headers(): client = BareMetalSolutionClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9028,8 +9066,8 @@ async def test_list_networks_async_pages(): @pytest.mark.parametrize( "request_type", [ - network.ListNetworkUsageRequest, - dict, + network.ListNetworkUsageRequest(), + {}, ], ) def test_list_network_usage(request_type, transport: str = "grpc"): @@ -9040,7 +9078,7 @@ def test_list_network_usage(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9085,9 +9123,10 @@ def test_list_network_usage_non_empty_request_with_auto_populated_field(): client.list_network_usage(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == network.ListNetworkUsageRequest( + request_msg = network.ListNetworkUsageRequest( location="location_value", ) + assert args[0] == request_msg def test_list_network_usage_use_cached_wrapped_rpc(): @@ -9172,9 +9211,14 @@ async def test_list_network_usage_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_network_usage_async( - transport: str = "grpc_asyncio", request_type=network.ListNetworkUsageRequest -): +@pytest.mark.parametrize( + "request_type", + [ + network.ListNetworkUsageRequest(), + {}, + ], +) +async def test_list_network_usage_async(request_type, transport: str = "grpc_asyncio"): client = BareMetalSolutionAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9182,7 +9226,7 @@ async def test_list_network_usage_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( @@ -9204,11 +9248,6 @@ async def test_list_network_usage_async( assert isinstance(response, network.ListNetworkUsageResponse) -@pytest.mark.asyncio -async def test_list_network_usage_async_from_dict(): - await test_list_network_usage_async(request_type=dict) - - def test_list_network_usage_field_headers(): client = BareMetalSolutionClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9363,8 +9402,8 @@ async def test_list_network_usage_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - network.GetNetworkRequest, - dict, + network.GetNetworkRequest(), + {}, ], ) def test_get_network(request_type, transport: str = "grpc"): @@ -9375,7 +9414,7 @@ def test_get_network(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_network), "__call__") as call: @@ -9441,9 +9480,10 @@ def test_get_network_non_empty_request_with_auto_populated_field(): client.get_network(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == network.GetNetworkRequest( + request_msg = network.GetNetworkRequest( name="name_value", ) + assert args[0] == request_msg def test_get_network_use_cached_wrapped_rpc(): @@ -9524,9 +9564,14 @@ async def test_get_network_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_network_async( - transport: str = "grpc_asyncio", request_type=network.GetNetworkRequest -): +@pytest.mark.parametrize( + "request_type", + [ + network.GetNetworkRequest(), + {}, + ], +) +async def test_get_network_async(request_type, transport: str = "grpc_asyncio"): client = BareMetalSolutionAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9534,7 +9579,7 @@ async def test_get_network_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_network), "__call__") as call: @@ -9579,11 +9624,6 @@ async def test_get_network_async( assert response.gateway_ip == "gateway_ip_value" -@pytest.mark.asyncio -async def test_get_network_async_from_dict(): - await test_get_network_async(request_type=dict) - - def test_get_network_field_headers(): client = BareMetalSolutionClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9726,8 +9766,8 @@ async def test_get_network_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcb_network.UpdateNetworkRequest, - dict, + gcb_network.UpdateNetworkRequest(), + {}, ], ) def test_update_network(request_type, transport: str = "grpc"): @@ -9738,7 +9778,7 @@ def test_update_network(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_network), "__call__") as call: @@ -9777,7 +9817,8 @@ def test_update_network_non_empty_request_with_auto_populated_field(): client.update_network(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcb_network.UpdateNetworkRequest() + request_msg = gcb_network.UpdateNetworkRequest() + assert args[0] == request_msg def test_update_network_use_cached_wrapped_rpc(): @@ -9868,9 +9909,14 @@ async def test_update_network_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_network_async( - transport: str = "grpc_asyncio", request_type=gcb_network.UpdateNetworkRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcb_network.UpdateNetworkRequest(), + {}, + ], +) +async def test_update_network_async(request_type, transport: str = "grpc_asyncio"): client = BareMetalSolutionAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9878,7 +9924,7 @@ async def test_update_network_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_network), "__call__") as call: @@ -9898,11 +9944,6 @@ async def test_update_network_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_network_async_from_dict(): - await test_update_network_async(request_type=dict) - - def test_update_network_field_headers(): client = BareMetalSolutionClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10059,8 +10100,8 @@ async def test_update_network_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcb_volume_snapshot.CreateVolumeSnapshotRequest, - dict, + gcb_volume_snapshot.CreateVolumeSnapshotRequest(), + {}, ], ) def test_create_volume_snapshot(request_type, transport: str = "grpc"): @@ -10071,7 +10112,7 @@ def test_create_volume_snapshot(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10127,9 +10168,10 @@ def test_create_volume_snapshot_non_empty_request_with_auto_populated_field(): client.create_volume_snapshot(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcb_volume_snapshot.CreateVolumeSnapshotRequest( + request_msg = gcb_volume_snapshot.CreateVolumeSnapshotRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_volume_snapshot_use_cached_wrapped_rpc(): @@ -10215,9 +10257,15 @@ async def test_create_volume_snapshot_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcb_volume_snapshot.CreateVolumeSnapshotRequest(), + {}, + ], +) async def test_create_volume_snapshot_async( - transport: str = "grpc_asyncio", - request_type=gcb_volume_snapshot.CreateVolumeSnapshotRequest, + request_type, transport: str = "grpc_asyncio" ): client = BareMetalSolutionAsyncClient( credentials=async_anonymous_credentials(), @@ -10226,7 +10274,7 @@ async def test_create_volume_snapshot_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( @@ -10259,11 +10307,6 @@ async def test_create_volume_snapshot_async( assert response.type_ == gcb_volume_snapshot.VolumeSnapshot.SnapshotType.AD_HOC -@pytest.mark.asyncio -async def test_create_volume_snapshot_async_from_dict(): - await test_create_volume_snapshot_async(request_type=dict) - - def test_create_volume_snapshot_field_headers(): client = BareMetalSolutionClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10428,8 +10471,8 @@ async def test_create_volume_snapshot_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcb_volume_snapshot.RestoreVolumeSnapshotRequest, - dict, + gcb_volume_snapshot.RestoreVolumeSnapshotRequest(), + {}, ], ) def test_restore_volume_snapshot(request_type, transport: str = "grpc"): @@ -10440,7 +10483,7 @@ def test_restore_volume_snapshot(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10485,9 +10528,10 @@ def test_restore_volume_snapshot_non_empty_request_with_auto_populated_field(): client.restore_volume_snapshot(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcb_volume_snapshot.RestoreVolumeSnapshotRequest( + request_msg = gcb_volume_snapshot.RestoreVolumeSnapshotRequest( volume_snapshot="volume_snapshot_value", ) + assert args[0] == request_msg def test_restore_volume_snapshot_use_cached_wrapped_rpc(): @@ -10583,9 +10627,15 @@ async def test_restore_volume_snapshot_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcb_volume_snapshot.RestoreVolumeSnapshotRequest(), + {}, + ], +) async def test_restore_volume_snapshot_async( - transport: str = "grpc_asyncio", - request_type=gcb_volume_snapshot.RestoreVolumeSnapshotRequest, + request_type, transport: str = "grpc_asyncio" ): client = BareMetalSolutionAsyncClient( credentials=async_anonymous_credentials(), @@ -10594,7 +10644,7 @@ async def test_restore_volume_snapshot_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( @@ -10616,11 +10666,6 @@ async def test_restore_volume_snapshot_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_restore_volume_snapshot_async_from_dict(): - await test_restore_volume_snapshot_async(request_type=dict) - - def test_restore_volume_snapshot_field_headers(): client = BareMetalSolutionClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10775,8 +10820,8 @@ async def test_restore_volume_snapshot_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - volume_snapshot.DeleteVolumeSnapshotRequest, - dict, + volume_snapshot.DeleteVolumeSnapshotRequest(), + {}, ], ) def test_delete_volume_snapshot(request_type, transport: str = "grpc"): @@ -10787,7 +10832,7 @@ def test_delete_volume_snapshot(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10832,9 +10877,10 @@ def test_delete_volume_snapshot_non_empty_request_with_auto_populated_field(): client.delete_volume_snapshot(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == volume_snapshot.DeleteVolumeSnapshotRequest( + request_msg = volume_snapshot.DeleteVolumeSnapshotRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_volume_snapshot_use_cached_wrapped_rpc(): @@ -10920,9 +10966,15 @@ async def test_delete_volume_snapshot_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + volume_snapshot.DeleteVolumeSnapshotRequest(), + {}, + ], +) async def test_delete_volume_snapshot_async( - transport: str = "grpc_asyncio", - request_type=volume_snapshot.DeleteVolumeSnapshotRequest, + request_type, transport: str = "grpc_asyncio" ): client = BareMetalSolutionAsyncClient( credentials=async_anonymous_credentials(), @@ -10931,7 +10983,7 @@ async def test_delete_volume_snapshot_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( @@ -10951,11 +11003,6 @@ async def test_delete_volume_snapshot_async( assert response is None -@pytest.mark.asyncio -async def test_delete_volume_snapshot_async_from_dict(): - await test_delete_volume_snapshot_async(request_type=dict) - - def test_delete_volume_snapshot_field_headers(): client = BareMetalSolutionClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11106,8 +11153,8 @@ async def test_delete_volume_snapshot_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - volume_snapshot.GetVolumeSnapshotRequest, - dict, + volume_snapshot.GetVolumeSnapshotRequest(), + {}, ], ) def test_get_volume_snapshot(request_type, transport: str = "grpc"): @@ -11118,7 +11165,7 @@ def test_get_volume_snapshot(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11174,9 +11221,10 @@ def test_get_volume_snapshot_non_empty_request_with_auto_populated_field(): client.get_volume_snapshot(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == volume_snapshot.GetVolumeSnapshotRequest( + request_msg = volume_snapshot.GetVolumeSnapshotRequest( name="name_value", ) + assert args[0] == request_msg def test_get_volume_snapshot_use_cached_wrapped_rpc(): @@ -11261,10 +11309,14 @@ async def test_get_volume_snapshot_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_volume_snapshot_async( - transport: str = "grpc_asyncio", - request_type=volume_snapshot.GetVolumeSnapshotRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + volume_snapshot.GetVolumeSnapshotRequest(), + {}, + ], +) +async def test_get_volume_snapshot_async(request_type, transport: str = "grpc_asyncio"): client = BareMetalSolutionAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11272,7 +11324,7 @@ async def test_get_volume_snapshot_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( @@ -11305,11 +11357,6 @@ async def test_get_volume_snapshot_async( assert response.type_ == volume_snapshot.VolumeSnapshot.SnapshotType.AD_HOC -@pytest.mark.asyncio -async def test_get_volume_snapshot_async_from_dict(): - await test_get_volume_snapshot_async(request_type=dict) - - def test_get_volume_snapshot_field_headers(): client = BareMetalSolutionClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11464,8 +11511,8 @@ async def test_get_volume_snapshot_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - volume_snapshot.ListVolumeSnapshotsRequest, - dict, + volume_snapshot.ListVolumeSnapshotsRequest(), + {}, ], ) def test_list_volume_snapshots(request_type, transport: str = "grpc"): @@ -11476,7 +11523,7 @@ def test_list_volume_snapshots(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11527,10 +11574,11 @@ def test_list_volume_snapshots_non_empty_request_with_auto_populated_field(): client.list_volume_snapshots(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == volume_snapshot.ListVolumeSnapshotsRequest( + request_msg = volume_snapshot.ListVolumeSnapshotsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_volume_snapshots_use_cached_wrapped_rpc(): @@ -11616,9 +11664,15 @@ async def test_list_volume_snapshots_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + volume_snapshot.ListVolumeSnapshotsRequest(), + {}, + ], +) async def test_list_volume_snapshots_async( - transport: str = "grpc_asyncio", - request_type=volume_snapshot.ListVolumeSnapshotsRequest, + request_type, transport: str = "grpc_asyncio" ): client = BareMetalSolutionAsyncClient( credentials=async_anonymous_credentials(), @@ -11627,7 +11681,7 @@ async def test_list_volume_snapshots_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( @@ -11654,11 +11708,6 @@ async def test_list_volume_snapshots_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_volume_snapshots_async_from_dict(): - await test_list_volume_snapshots_async(request_type=dict) - - def test_list_volume_snapshots_field_headers(): client = BareMetalSolutionClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12011,8 +12060,8 @@ async def test_list_volume_snapshots_async_pages(): @pytest.mark.parametrize( "request_type", [ - lun.GetLunRequest, - dict, + lun.GetLunRequest(), + {}, ], ) def test_get_lun(request_type, transport: str = "grpc"): @@ -12023,7 +12072,7 @@ def test_get_lun(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_lun), "__call__") as call: @@ -12087,9 +12136,10 @@ def test_get_lun_non_empty_request_with_auto_populated_field(): client.get_lun(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == lun.GetLunRequest( + request_msg = lun.GetLunRequest( name="name_value", ) + assert args[0] == request_msg def test_get_lun_use_cached_wrapped_rpc(): @@ -12168,9 +12218,14 @@ async def test_get_lun_async_use_cached_wrapped_rpc(transport: str = "grpc_async @pytest.mark.asyncio -async def test_get_lun_async( - transport: str = "grpc_asyncio", request_type=lun.GetLunRequest -): +@pytest.mark.parametrize( + "request_type", + [ + lun.GetLunRequest(), + {}, + ], +) +async def test_get_lun_async(request_type, transport: str = "grpc_asyncio"): client = BareMetalSolutionAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12178,7 +12233,7 @@ async def test_get_lun_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_lun), "__call__") as call: @@ -12221,11 +12276,6 @@ async def test_get_lun_async( assert response.instances == ["instances_value"] -@pytest.mark.asyncio -async def test_get_lun_async_from_dict(): - await test_get_lun_async(request_type=dict) - - def test_get_lun_field_headers(): client = BareMetalSolutionClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12368,8 +12418,8 @@ async def test_get_lun_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - lun.ListLunsRequest, - dict, + lun.ListLunsRequest(), + {}, ], ) def test_list_luns(request_type, transport: str = "grpc"): @@ -12380,7 +12430,7 @@ def test_list_luns(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_luns), "__call__") as call: @@ -12427,10 +12477,11 @@ def test_list_luns_non_empty_request_with_auto_populated_field(): client.list_luns(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == lun.ListLunsRequest( + request_msg = lun.ListLunsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_luns_use_cached_wrapped_rpc(): @@ -12509,9 +12560,14 @@ async def test_list_luns_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_list_luns_async( - transport: str = "grpc_asyncio", request_type=lun.ListLunsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + lun.ListLunsRequest(), + {}, + ], +) +async def test_list_luns_async(request_type, transport: str = "grpc_asyncio"): client = BareMetalSolutionAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12519,7 +12575,7 @@ async def test_list_luns_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_luns), "__call__") as call: @@ -12544,11 +12600,6 @@ async def test_list_luns_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_luns_async_from_dict(): - await test_list_luns_async(request_type=dict) - - def test_list_luns_field_headers(): client = BareMetalSolutionClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12885,8 +12936,8 @@ async def test_list_luns_async_pages(): @pytest.mark.parametrize( "request_type", [ - lun.EvictLunRequest, - dict, + lun.EvictLunRequest(), + {}, ], ) def test_evict_lun(request_type, transport: str = "grpc"): @@ -12897,7 +12948,7 @@ def test_evict_lun(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.evict_lun), "__call__") as call: @@ -12938,9 +12989,10 @@ def test_evict_lun_non_empty_request_with_auto_populated_field(): client.evict_lun(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == lun.EvictLunRequest( + request_msg = lun.EvictLunRequest( name="name_value", ) + assert args[0] == request_msg def test_evict_lun_use_cached_wrapped_rpc(): @@ -13029,9 +13081,14 @@ async def test_evict_lun_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_evict_lun_async( - transport: str = "grpc_asyncio", request_type=lun.EvictLunRequest -): +@pytest.mark.parametrize( + "request_type", + [ + lun.EvictLunRequest(), + {}, + ], +) +async def test_evict_lun_async(request_type, transport: str = "grpc_asyncio"): client = BareMetalSolutionAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13039,7 +13096,7 @@ async def test_evict_lun_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.evict_lun), "__call__") as call: @@ -13059,11 +13116,6 @@ async def test_evict_lun_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_evict_lun_async_from_dict(): - await test_evict_lun_async(request_type=dict) - - def test_evict_lun_field_headers(): client = BareMetalSolutionClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13210,8 +13262,8 @@ async def test_evict_lun_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - nfs_share.GetNfsShareRequest, - dict, + nfs_share.GetNfsShareRequest(), + {}, ], ) def test_get_nfs_share(request_type, transport: str = "grpc"): @@ -13222,7 +13274,7 @@ def test_get_nfs_share(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_nfs_share), "__call__") as call: @@ -13278,9 +13330,10 @@ def test_get_nfs_share_non_empty_request_with_auto_populated_field(): client.get_nfs_share(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == nfs_share.GetNfsShareRequest( + request_msg = nfs_share.GetNfsShareRequest( name="name_value", ) + assert args[0] == request_msg def test_get_nfs_share_use_cached_wrapped_rpc(): @@ -13361,9 +13414,14 @@ async def test_get_nfs_share_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_nfs_share_async( - transport: str = "grpc_asyncio", request_type=nfs_share.GetNfsShareRequest -): +@pytest.mark.parametrize( + "request_type", + [ + nfs_share.GetNfsShareRequest(), + {}, + ], +) +async def test_get_nfs_share_async(request_type, transport: str = "grpc_asyncio"): client = BareMetalSolutionAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13371,7 +13429,7 @@ async def test_get_nfs_share_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_nfs_share), "__call__") as call: @@ -13406,11 +13464,6 @@ async def test_get_nfs_share_async( assert response.storage_type == nfs_share.NfsShare.StorageType.SSD -@pytest.mark.asyncio -async def test_get_nfs_share_async_from_dict(): - await test_get_nfs_share_async(request_type=dict) - - def test_get_nfs_share_field_headers(): client = BareMetalSolutionClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13553,8 +13606,8 @@ async def test_get_nfs_share_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - nfs_share.ListNfsSharesRequest, - dict, + nfs_share.ListNfsSharesRequest(), + {}, ], ) def test_list_nfs_shares(request_type, transport: str = "grpc"): @@ -13565,7 +13618,7 @@ def test_list_nfs_shares(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_nfs_shares), "__call__") as call: @@ -13613,11 +13666,12 @@ def test_list_nfs_shares_non_empty_request_with_auto_populated_field(): client.list_nfs_shares(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == nfs_share.ListNfsSharesRequest( + request_msg = nfs_share.ListNfsSharesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_nfs_shares_use_cached_wrapped_rpc(): @@ -13698,9 +13752,14 @@ async def test_list_nfs_shares_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_nfs_shares_async( - transport: str = "grpc_asyncio", request_type=nfs_share.ListNfsSharesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + nfs_share.ListNfsSharesRequest(), + {}, + ], +) +async def test_list_nfs_shares_async(request_type, transport: str = "grpc_asyncio"): client = BareMetalSolutionAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13708,7 +13767,7 @@ async def test_list_nfs_shares_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_nfs_shares), "__call__") as call: @@ -13733,11 +13792,6 @@ async def test_list_nfs_shares_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_nfs_shares_async_from_dict(): - await test_list_nfs_shares_async(request_type=dict) - - def test_list_nfs_shares_field_headers(): client = BareMetalSolutionClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14074,8 +14128,8 @@ async def test_list_nfs_shares_async_pages(): @pytest.mark.parametrize( "request_type", [ - gcb_nfs_share.UpdateNfsShareRequest, - dict, + gcb_nfs_share.UpdateNfsShareRequest(), + {}, ], ) def test_update_nfs_share(request_type, transport: str = "grpc"): @@ -14086,7 +14140,7 @@ def test_update_nfs_share(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_nfs_share), "__call__") as call: @@ -14125,7 +14179,8 @@ def test_update_nfs_share_non_empty_request_with_auto_populated_field(): client.update_nfs_share(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcb_nfs_share.UpdateNfsShareRequest() + request_msg = gcb_nfs_share.UpdateNfsShareRequest() + assert args[0] == request_msg def test_update_nfs_share_use_cached_wrapped_rpc(): @@ -14218,9 +14273,14 @@ async def test_update_nfs_share_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_nfs_share_async( - transport: str = "grpc_asyncio", request_type=gcb_nfs_share.UpdateNfsShareRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcb_nfs_share.UpdateNfsShareRequest(), + {}, + ], +) +async def test_update_nfs_share_async(request_type, transport: str = "grpc_asyncio"): client = BareMetalSolutionAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14228,7 +14288,7 @@ async def test_update_nfs_share_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_nfs_share), "__call__") as call: @@ -14248,11 +14308,6 @@ async def test_update_nfs_share_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_nfs_share_async_from_dict(): - await test_update_nfs_share_async(request_type=dict) - - def test_update_nfs_share_field_headers(): client = BareMetalSolutionClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14409,8 +14464,8 @@ async def test_update_nfs_share_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcb_nfs_share.CreateNfsShareRequest, - dict, + gcb_nfs_share.CreateNfsShareRequest(), + {}, ], ) def test_create_nfs_share(request_type, transport: str = "grpc"): @@ -14421,7 +14476,7 @@ def test_create_nfs_share(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_nfs_share), "__call__") as call: @@ -14462,9 +14517,10 @@ def test_create_nfs_share_non_empty_request_with_auto_populated_field(): client.create_nfs_share(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcb_nfs_share.CreateNfsShareRequest( + request_msg = gcb_nfs_share.CreateNfsShareRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_nfs_share_use_cached_wrapped_rpc(): @@ -14557,9 +14613,14 @@ async def test_create_nfs_share_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_nfs_share_async( - transport: str = "grpc_asyncio", request_type=gcb_nfs_share.CreateNfsShareRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcb_nfs_share.CreateNfsShareRequest(), + {}, + ], +) +async def test_create_nfs_share_async(request_type, transport: str = "grpc_asyncio"): client = BareMetalSolutionAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14567,7 +14628,7 @@ async def test_create_nfs_share_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_nfs_share), "__call__") as call: @@ -14587,11 +14648,6 @@ async def test_create_nfs_share_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_nfs_share_async_from_dict(): - await test_create_nfs_share_async(request_type=dict) - - def test_create_nfs_share_field_headers(): client = BareMetalSolutionClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14748,8 +14804,8 @@ async def test_create_nfs_share_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - nfs_share.RenameNfsShareRequest, - dict, + nfs_share.RenameNfsShareRequest(), + {}, ], ) def test_rename_nfs_share(request_type, transport: str = "grpc"): @@ -14760,7 +14816,7 @@ def test_rename_nfs_share(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.rename_nfs_share), "__call__") as call: @@ -14817,10 +14873,11 @@ def test_rename_nfs_share_non_empty_request_with_auto_populated_field(): client.rename_nfs_share(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == nfs_share.RenameNfsShareRequest( + request_msg = nfs_share.RenameNfsShareRequest( name="name_value", new_nfsshare_id="new_nfsshare_id_value", ) + assert args[0] == request_msg def test_rename_nfs_share_use_cached_wrapped_rpc(): @@ -14903,9 +14960,14 @@ async def test_rename_nfs_share_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_rename_nfs_share_async( - transport: str = "grpc_asyncio", request_type=nfs_share.RenameNfsShareRequest -): +@pytest.mark.parametrize( + "request_type", + [ + nfs_share.RenameNfsShareRequest(), + {}, + ], +) +async def test_rename_nfs_share_async(request_type, transport: str = "grpc_asyncio"): client = BareMetalSolutionAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14913,7 +14975,7 @@ async def test_rename_nfs_share_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.rename_nfs_share), "__call__") as call: @@ -14948,11 +15010,6 @@ async def test_rename_nfs_share_async( assert response.storage_type == nfs_share.NfsShare.StorageType.SSD -@pytest.mark.asyncio -async def test_rename_nfs_share_async_from_dict(): - await test_rename_nfs_share_async(request_type=dict) - - def test_rename_nfs_share_field_headers(): client = BareMetalSolutionClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15105,8 +15162,8 @@ async def test_rename_nfs_share_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - nfs_share.DeleteNfsShareRequest, - dict, + nfs_share.DeleteNfsShareRequest(), + {}, ], ) def test_delete_nfs_share(request_type, transport: str = "grpc"): @@ -15117,7 +15174,7 @@ def test_delete_nfs_share(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_nfs_share), "__call__") as call: @@ -15158,9 +15215,10 @@ def test_delete_nfs_share_non_empty_request_with_auto_populated_field(): client.delete_nfs_share(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == nfs_share.DeleteNfsShareRequest( + request_msg = nfs_share.DeleteNfsShareRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_nfs_share_use_cached_wrapped_rpc(): @@ -15253,9 +15311,14 @@ async def test_delete_nfs_share_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_nfs_share_async( - transport: str = "grpc_asyncio", request_type=nfs_share.DeleteNfsShareRequest -): +@pytest.mark.parametrize( + "request_type", + [ + nfs_share.DeleteNfsShareRequest(), + {}, + ], +) +async def test_delete_nfs_share_async(request_type, transport: str = "grpc_asyncio"): client = BareMetalSolutionAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -15263,7 +15326,7 @@ async def test_delete_nfs_share_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_nfs_share), "__call__") as call: @@ -15283,11 +15346,6 @@ async def test_delete_nfs_share_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_nfs_share_async_from_dict(): - await test_delete_nfs_share_async(request_type=dict) - - def test_delete_nfs_share_field_headers(): client = BareMetalSolutionClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15434,8 +15492,8 @@ async def test_delete_nfs_share_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - provisioning.ListProvisioningQuotasRequest, - dict, + provisioning.ListProvisioningQuotasRequest(), + {}, ], ) def test_list_provisioning_quotas(request_type, transport: str = "grpc"): @@ -15446,7 +15504,7 @@ def test_list_provisioning_quotas(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -15495,10 +15553,11 @@ def test_list_provisioning_quotas_non_empty_request_with_auto_populated_field(): client.list_provisioning_quotas(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == provisioning.ListProvisioningQuotasRequest( + request_msg = provisioning.ListProvisioningQuotasRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_provisioning_quotas_use_cached_wrapped_rpc(): @@ -15584,9 +15643,15 @@ async def test_list_provisioning_quotas_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + provisioning.ListProvisioningQuotasRequest(), + {}, + ], +) async def test_list_provisioning_quotas_async( - transport: str = "grpc_asyncio", - request_type=provisioning.ListProvisioningQuotasRequest, + request_type, transport: str = "grpc_asyncio" ): client = BareMetalSolutionAsyncClient( credentials=async_anonymous_credentials(), @@ -15595,7 +15660,7 @@ async def test_list_provisioning_quotas_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( @@ -15620,11 +15685,6 @@ async def test_list_provisioning_quotas_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_provisioning_quotas_async_from_dict(): - await test_list_provisioning_quotas_async(request_type=dict) - - def test_list_provisioning_quotas_field_headers(): client = BareMetalSolutionClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15979,8 +16039,8 @@ async def test_list_provisioning_quotas_async_pages(): @pytest.mark.parametrize( "request_type", [ - provisioning.SubmitProvisioningConfigRequest, - dict, + provisioning.SubmitProvisioningConfigRequest(), + {}, ], ) def test_submit_provisioning_config(request_type, transport: str = "grpc"): @@ -15991,7 +16051,7 @@ def test_submit_provisioning_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( @@ -16037,10 +16097,11 @@ def test_submit_provisioning_config_non_empty_request_with_auto_populated_field( client.submit_provisioning_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == provisioning.SubmitProvisioningConfigRequest( + request_msg = provisioning.SubmitProvisioningConfigRequest( parent="parent_value", email="email_value", ) + assert args[0] == request_msg def test_submit_provisioning_config_use_cached_wrapped_rpc(): @@ -16126,9 +16187,15 @@ async def test_submit_provisioning_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + provisioning.SubmitProvisioningConfigRequest(), + {}, + ], +) async def test_submit_provisioning_config_async( - transport: str = "grpc_asyncio", - request_type=provisioning.SubmitProvisioningConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = BareMetalSolutionAsyncClient( credentials=async_anonymous_credentials(), @@ -16137,7 +16204,7 @@ async def test_submit_provisioning_config_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( @@ -16159,11 +16226,6 @@ async def test_submit_provisioning_config_async( assert isinstance(response, provisioning.SubmitProvisioningConfigResponse) -@pytest.mark.asyncio -async def test_submit_provisioning_config_async_from_dict(): - await test_submit_provisioning_config_async(request_type=dict) - - def test_submit_provisioning_config_field_headers(): client = BareMetalSolutionClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16328,8 +16390,8 @@ async def test_submit_provisioning_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - provisioning.GetProvisioningConfigRequest, - dict, + provisioning.GetProvisioningConfigRequest(), + {}, ], ) def test_get_provisioning_config(request_type, transport: str = "grpc"): @@ -16340,7 +16402,7 @@ def test_get_provisioning_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( @@ -16406,9 +16468,10 @@ def test_get_provisioning_config_non_empty_request_with_auto_populated_field(): client.get_provisioning_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == provisioning.GetProvisioningConfigRequest( + request_msg = provisioning.GetProvisioningConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_provisioning_config_use_cached_wrapped_rpc(): @@ -16494,9 +16557,15 @@ async def test_get_provisioning_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + provisioning.GetProvisioningConfigRequest(), + {}, + ], +) async def test_get_provisioning_config_async( - transport: str = "grpc_asyncio", - request_type=provisioning.GetProvisioningConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = BareMetalSolutionAsyncClient( credentials=async_anonymous_credentials(), @@ -16505,7 +16574,7 @@ async def test_get_provisioning_config_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( @@ -16548,11 +16617,6 @@ async def test_get_provisioning_config_async( assert response.custom_id == "custom_id_value" -@pytest.mark.asyncio -async def test_get_provisioning_config_async_from_dict(): - await test_get_provisioning_config_async(request_type=dict) - - def test_get_provisioning_config_field_headers(): client = BareMetalSolutionClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16707,8 +16771,8 @@ async def test_get_provisioning_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - provisioning.CreateProvisioningConfigRequest, - dict, + provisioning.CreateProvisioningConfigRequest(), + {}, ], ) def test_create_provisioning_config(request_type, transport: str = "grpc"): @@ -16719,7 +16783,7 @@ def test_create_provisioning_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( @@ -16786,10 +16850,11 @@ def test_create_provisioning_config_non_empty_request_with_auto_populated_field( client.create_provisioning_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == provisioning.CreateProvisioningConfigRequest( + request_msg = provisioning.CreateProvisioningConfigRequest( parent="parent_value", email="email_value", ) + assert args[0] == request_msg def test_create_provisioning_config_use_cached_wrapped_rpc(): @@ -16875,9 +16940,15 @@ async def test_create_provisioning_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + provisioning.CreateProvisioningConfigRequest(), + {}, + ], +) async def test_create_provisioning_config_async( - transport: str = "grpc_asyncio", - request_type=provisioning.CreateProvisioningConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = BareMetalSolutionAsyncClient( credentials=async_anonymous_credentials(), @@ -16886,7 +16957,7 @@ async def test_create_provisioning_config_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( @@ -16929,11 +17000,6 @@ async def test_create_provisioning_config_async( assert response.custom_id == "custom_id_value" -@pytest.mark.asyncio -async def test_create_provisioning_config_async_from_dict(): - await test_create_provisioning_config_async(request_type=dict) - - def test_create_provisioning_config_field_headers(): client = BareMetalSolutionClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17098,8 +17164,8 @@ async def test_create_provisioning_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - provisioning.UpdateProvisioningConfigRequest, - dict, + provisioning.UpdateProvisioningConfigRequest(), + {}, ], ) def test_update_provisioning_config(request_type, transport: str = "grpc"): @@ -17110,7 +17176,7 @@ def test_update_provisioning_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( @@ -17176,9 +17242,10 @@ def test_update_provisioning_config_non_empty_request_with_auto_populated_field( client.update_provisioning_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == provisioning.UpdateProvisioningConfigRequest( + request_msg = provisioning.UpdateProvisioningConfigRequest( email="email_value", ) + assert args[0] == request_msg def test_update_provisioning_config_use_cached_wrapped_rpc(): @@ -17264,9 +17331,15 @@ async def test_update_provisioning_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + provisioning.UpdateProvisioningConfigRequest(), + {}, + ], +) async def test_update_provisioning_config_async( - transport: str = "grpc_asyncio", - request_type=provisioning.UpdateProvisioningConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = BareMetalSolutionAsyncClient( credentials=async_anonymous_credentials(), @@ -17275,7 +17348,7 @@ async def test_update_provisioning_config_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( @@ -17318,11 +17391,6 @@ async def test_update_provisioning_config_async( assert response.custom_id == "custom_id_value" -@pytest.mark.asyncio -async def test_update_provisioning_config_async_from_dict(): - await test_update_provisioning_config_async(request_type=dict) - - def test_update_provisioning_config_field_headers(): client = BareMetalSolutionClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17487,8 +17555,8 @@ async def test_update_provisioning_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - network.RenameNetworkRequest, - dict, + network.RenameNetworkRequest(), + {}, ], ) def test_rename_network(request_type, transport: str = "grpc"): @@ -17499,7 +17567,7 @@ def test_rename_network(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.rename_network), "__call__") as call: @@ -17566,10 +17634,11 @@ def test_rename_network_non_empty_request_with_auto_populated_field(): client.rename_network(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == network.RenameNetworkRequest( + request_msg = network.RenameNetworkRequest( name="name_value", new_network_id="new_network_id_value", ) + assert args[0] == request_msg def test_rename_network_use_cached_wrapped_rpc(): @@ -17650,9 +17719,14 @@ async def test_rename_network_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_rename_network_async( - transport: str = "grpc_asyncio", request_type=network.RenameNetworkRequest -): +@pytest.mark.parametrize( + "request_type", + [ + network.RenameNetworkRequest(), + {}, + ], +) +async def test_rename_network_async(request_type, transport: str = "grpc_asyncio"): client = BareMetalSolutionAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -17660,7 +17734,7 @@ async def test_rename_network_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.rename_network), "__call__") as call: @@ -17705,11 +17779,6 @@ async def test_rename_network_async( assert response.gateway_ip == "gateway_ip_value" -@pytest.mark.asyncio -async def test_rename_network_async_from_dict(): - await test_rename_network_async(request_type=dict) - - def test_rename_network_field_headers(): client = BareMetalSolutionClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17862,8 +17931,8 @@ async def test_rename_network_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - osimage.ListOSImagesRequest, - dict, + osimage.ListOSImagesRequest(), + {}, ], ) def test_list_os_images(request_type, transport: str = "grpc"): @@ -17874,7 +17943,7 @@ def test_list_os_images(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_os_images), "__call__") as call: @@ -17919,10 +17988,11 @@ def test_list_os_images_non_empty_request_with_auto_populated_field(): client.list_os_images(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == osimage.ListOSImagesRequest( + request_msg = osimage.ListOSImagesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_os_images_use_cached_wrapped_rpc(): @@ -18003,9 +18073,14 @@ async def test_list_os_images_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_os_images_async( - transport: str = "grpc_asyncio", request_type=osimage.ListOSImagesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + osimage.ListOSImagesRequest(), + {}, + ], +) +async def test_list_os_images_async(request_type, transport: str = "grpc_asyncio"): client = BareMetalSolutionAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -18013,7 +18088,7 @@ async def test_list_os_images_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_os_images), "__call__") as call: @@ -18036,11 +18111,6 @@ async def test_list_os_images_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_os_images_async_from_dict(): - await test_list_os_images_async(request_type=dict) - - def test_list_os_images_field_headers(): client = BareMetalSolutionClient( credentials=ga_credentials.AnonymousCredentials(), @@ -27271,7 +27341,6 @@ def test_list_instances_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = instance.ListInstancesRequest() - assert args[0] == request_msg @@ -27292,7 +27361,6 @@ def test_get_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = instance.GetInstanceRequest() - assert args[0] == request_msg @@ -27313,7 +27381,6 @@ def test_update_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcb_instance.UpdateInstanceRequest() - assert args[0] == request_msg @@ -27334,7 +27401,6 @@ def test_rename_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = instance.RenameInstanceRequest() - assert args[0] == request_msg @@ -27355,7 +27421,6 @@ def test_reset_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = instance.ResetInstanceRequest() - assert args[0] == request_msg @@ -27376,7 +27441,6 @@ def test_start_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = instance.StartInstanceRequest() - assert args[0] == request_msg @@ -27397,7 +27461,6 @@ def test_stop_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = instance.StopInstanceRequest() - assert args[0] == request_msg @@ -27420,7 +27483,6 @@ def test_enable_interactive_serial_console_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = instance.EnableInteractiveSerialConsoleRequest() - assert args[0] == request_msg @@ -27443,7 +27505,6 @@ def test_disable_interactive_serial_console_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = instance.DisableInteractiveSerialConsoleRequest() - assert args[0] == request_msg @@ -27464,7 +27525,6 @@ def test_detach_lun_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcb_instance.DetachLunRequest() - assert args[0] == request_msg @@ -27485,7 +27545,6 @@ def test_list_ssh_keys_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ssh_key.ListSSHKeysRequest() - assert args[0] == request_msg @@ -27506,7 +27565,6 @@ def test_create_ssh_key_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcb_ssh_key.CreateSSHKeyRequest() - assert args[0] == request_msg @@ -27527,7 +27585,6 @@ def test_delete_ssh_key_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ssh_key.DeleteSSHKeyRequest() - assert args[0] == request_msg @@ -27548,7 +27605,6 @@ def test_list_volumes_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = volume.ListVolumesRequest() - assert args[0] == request_msg @@ -27569,7 +27625,6 @@ def test_get_volume_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = volume.GetVolumeRequest() - assert args[0] == request_msg @@ -27590,7 +27645,6 @@ def test_update_volume_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcb_volume.UpdateVolumeRequest() - assert args[0] == request_msg @@ -27611,7 +27665,6 @@ def test_rename_volume_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = volume.RenameVolumeRequest() - assert args[0] == request_msg @@ -27632,7 +27685,6 @@ def test_evict_volume_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = volume.EvictVolumeRequest() - assert args[0] == request_msg @@ -27653,7 +27705,6 @@ def test_resize_volume_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcb_volume.ResizeVolumeRequest() - assert args[0] == request_msg @@ -27674,7 +27725,6 @@ def test_list_networks_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = network.ListNetworksRequest() - assert args[0] == request_msg @@ -27697,7 +27747,6 @@ def test_list_network_usage_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = network.ListNetworkUsageRequest() - assert args[0] == request_msg @@ -27718,7 +27767,6 @@ def test_get_network_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = network.GetNetworkRequest() - assert args[0] == request_msg @@ -27739,7 +27787,6 @@ def test_update_network_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcb_network.UpdateNetworkRequest() - assert args[0] == request_msg @@ -27762,7 +27809,6 @@ def test_create_volume_snapshot_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcb_volume_snapshot.CreateVolumeSnapshotRequest() - assert args[0] == request_msg @@ -27785,7 +27831,6 @@ def test_restore_volume_snapshot_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcb_volume_snapshot.RestoreVolumeSnapshotRequest() - assert args[0] == request_msg @@ -27808,7 +27853,6 @@ def test_delete_volume_snapshot_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = volume_snapshot.DeleteVolumeSnapshotRequest() - assert args[0] == request_msg @@ -27831,7 +27875,6 @@ def test_get_volume_snapshot_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = volume_snapshot.GetVolumeSnapshotRequest() - assert args[0] == request_msg @@ -27854,7 +27897,6 @@ def test_list_volume_snapshots_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = volume_snapshot.ListVolumeSnapshotsRequest() - assert args[0] == request_msg @@ -27875,7 +27917,6 @@ def test_get_lun_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lun.GetLunRequest() - assert args[0] == request_msg @@ -27896,7 +27937,6 @@ def test_list_luns_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lun.ListLunsRequest() - assert args[0] == request_msg @@ -27917,7 +27957,6 @@ def test_evict_lun_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lun.EvictLunRequest() - assert args[0] == request_msg @@ -27938,7 +27977,6 @@ def test_get_nfs_share_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = nfs_share.GetNfsShareRequest() - assert args[0] == request_msg @@ -27959,7 +27997,6 @@ def test_list_nfs_shares_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = nfs_share.ListNfsSharesRequest() - assert args[0] == request_msg @@ -27980,7 +28017,6 @@ def test_update_nfs_share_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcb_nfs_share.UpdateNfsShareRequest() - assert args[0] == request_msg @@ -28001,7 +28037,6 @@ def test_create_nfs_share_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcb_nfs_share.CreateNfsShareRequest() - assert args[0] == request_msg @@ -28022,7 +28057,6 @@ def test_rename_nfs_share_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = nfs_share.RenameNfsShareRequest() - assert args[0] == request_msg @@ -28043,7 +28077,6 @@ def test_delete_nfs_share_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = nfs_share.DeleteNfsShareRequest() - assert args[0] == request_msg @@ -28066,7 +28099,6 @@ def test_list_provisioning_quotas_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = provisioning.ListProvisioningQuotasRequest() - assert args[0] == request_msg @@ -28089,7 +28121,6 @@ def test_submit_provisioning_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = provisioning.SubmitProvisioningConfigRequest() - assert args[0] == request_msg @@ -28112,7 +28143,6 @@ def test_get_provisioning_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = provisioning.GetProvisioningConfigRequest() - assert args[0] == request_msg @@ -28135,7 +28165,6 @@ def test_create_provisioning_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = provisioning.CreateProvisioningConfigRequest() - assert args[0] == request_msg @@ -28158,7 +28187,6 @@ def test_update_provisioning_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = provisioning.UpdateProvisioningConfigRequest() - assert args[0] == request_msg @@ -28179,7 +28207,6 @@ def test_rename_network_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = network.RenameNetworkRequest() - assert args[0] == request_msg @@ -28200,7 +28227,6 @@ def test_list_os_images_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = osimage.ListOSImagesRequest() - assert args[0] == request_msg @@ -28242,7 +28268,6 @@ async def test_list_instances_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = instance.ListInstancesRequest() - assert args[0] == request_msg @@ -28280,7 +28305,6 @@ async def test_get_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = instance.GetInstanceRequest() - assert args[0] == request_msg @@ -28305,7 +28329,6 @@ async def test_update_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcb_instance.UpdateInstanceRequest() - assert args[0] == request_msg @@ -28343,7 +28366,6 @@ async def test_rename_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = instance.RenameInstanceRequest() - assert args[0] == request_msg @@ -28368,7 +28390,6 @@ async def test_reset_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = instance.ResetInstanceRequest() - assert args[0] == request_msg @@ -28393,7 +28414,6 @@ async def test_start_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = instance.StartInstanceRequest() - assert args[0] == request_msg @@ -28418,7 +28438,6 @@ async def test_stop_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = instance.StopInstanceRequest() - assert args[0] == request_msg @@ -28445,7 +28464,6 @@ async def test_enable_interactive_serial_console_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = instance.EnableInteractiveSerialConsoleRequest() - assert args[0] == request_msg @@ -28472,7 +28490,6 @@ async def test_disable_interactive_serial_console_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = instance.DisableInteractiveSerialConsoleRequest() - assert args[0] == request_msg @@ -28497,7 +28514,6 @@ async def test_detach_lun_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcb_instance.DetachLunRequest() - assert args[0] == request_msg @@ -28524,7 +28540,6 @@ async def test_list_ssh_keys_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ssh_key.ListSSHKeysRequest() - assert args[0] == request_msg @@ -28552,7 +28567,6 @@ async def test_create_ssh_key_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcb_ssh_key.CreateSSHKeyRequest() - assert args[0] == request_msg @@ -28575,7 +28589,6 @@ async def test_delete_ssh_key_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ssh_key.DeleteSSHKeyRequest() - assert args[0] == request_msg @@ -28603,7 +28616,6 @@ async def test_list_volumes_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = volume.ListVolumesRequest() - assert args[0] == request_msg @@ -28650,7 +28662,6 @@ async def test_get_volume_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = volume.GetVolumeRequest() - assert args[0] == request_msg @@ -28675,7 +28686,6 @@ async def test_update_volume_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcb_volume.UpdateVolumeRequest() - assert args[0] == request_msg @@ -28722,7 +28732,6 @@ async def test_rename_volume_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = volume.RenameVolumeRequest() - assert args[0] == request_msg @@ -28747,7 +28756,6 @@ async def test_evict_volume_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = volume.EvictVolumeRequest() - assert args[0] == request_msg @@ -28772,7 +28780,6 @@ async def test_resize_volume_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcb_volume.ResizeVolumeRequest() - assert args[0] == request_msg @@ -28800,7 +28807,6 @@ async def test_list_networks_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = network.ListNetworksRequest() - assert args[0] == request_msg @@ -28827,7 +28833,6 @@ async def test_list_network_usage_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = network.ListNetworkUsageRequest() - assert args[0] == request_msg @@ -28865,7 +28870,6 @@ async def test_get_network_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = network.GetNetworkRequest() - assert args[0] == request_msg @@ -28890,7 +28894,6 @@ async def test_update_network_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcb_network.UpdateNetworkRequest() - assert args[0] == request_msg @@ -28923,7 +28926,6 @@ async def test_create_volume_snapshot_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcb_volume_snapshot.CreateVolumeSnapshotRequest() - assert args[0] == request_msg @@ -28950,7 +28952,6 @@ async def test_restore_volume_snapshot_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcb_volume_snapshot.RestoreVolumeSnapshotRequest() - assert args[0] == request_msg @@ -28975,7 +28976,6 @@ async def test_delete_volume_snapshot_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = volume_snapshot.DeleteVolumeSnapshotRequest() - assert args[0] == request_msg @@ -29008,7 +29008,6 @@ async def test_get_volume_snapshot_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = volume_snapshot.GetVolumeSnapshotRequest() - assert args[0] == request_msg @@ -29038,7 +29037,6 @@ async def test_list_volume_snapshots_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = volume_snapshot.ListVolumeSnapshotsRequest() - assert args[0] == request_msg @@ -29075,7 +29073,6 @@ async def test_get_lun_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lun.GetLunRequest() - assert args[0] == request_msg @@ -29103,7 +29100,6 @@ async def test_list_luns_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lun.ListLunsRequest() - assert args[0] == request_msg @@ -29128,7 +29124,6 @@ async def test_evict_lun_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lun.EvictLunRequest() - assert args[0] == request_msg @@ -29161,7 +29156,6 @@ async def test_get_nfs_share_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = nfs_share.GetNfsShareRequest() - assert args[0] == request_msg @@ -29189,7 +29183,6 @@ async def test_list_nfs_shares_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = nfs_share.ListNfsSharesRequest() - assert args[0] == request_msg @@ -29214,7 +29207,6 @@ async def test_update_nfs_share_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcb_nfs_share.UpdateNfsShareRequest() - assert args[0] == request_msg @@ -29239,7 +29231,6 @@ async def test_create_nfs_share_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcb_nfs_share.CreateNfsShareRequest() - assert args[0] == request_msg @@ -29272,7 +29263,6 @@ async def test_rename_nfs_share_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = nfs_share.RenameNfsShareRequest() - assert args[0] == request_msg @@ -29297,7 +29287,6 @@ async def test_delete_nfs_share_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = nfs_share.DeleteNfsShareRequest() - assert args[0] == request_msg @@ -29326,7 +29315,6 @@ async def test_list_provisioning_quotas_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = provisioning.ListProvisioningQuotasRequest() - assert args[0] == request_msg @@ -29353,7 +29341,6 @@ async def test_submit_provisioning_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = provisioning.SubmitProvisioningConfigRequest() - assert args[0] == request_msg @@ -29391,7 +29378,6 @@ async def test_get_provisioning_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = provisioning.GetProvisioningConfigRequest() - assert args[0] == request_msg @@ -29429,7 +29415,6 @@ async def test_create_provisioning_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = provisioning.CreateProvisioningConfigRequest() - assert args[0] == request_msg @@ -29467,7 +29452,6 @@ async def test_update_provisioning_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = provisioning.UpdateProvisioningConfigRequest() - assert args[0] == request_msg @@ -29505,7 +29489,6 @@ async def test_rename_network_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = network.RenameNetworkRequest() - assert args[0] == request_msg @@ -29532,7 +29515,6 @@ async def test_list_os_images_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = osimage.ListOSImagesRequest() - assert args[0] == request_msg @@ -36672,7 +36654,6 @@ def test_list_instances_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = instance.ListInstancesRequest() - assert args[0] == request_msg @@ -36692,7 +36673,6 @@ def test_get_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = instance.GetInstanceRequest() - assert args[0] == request_msg @@ -36712,7 +36692,6 @@ def test_update_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcb_instance.UpdateInstanceRequest() - assert args[0] == request_msg @@ -36732,7 +36711,6 @@ def test_rename_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = instance.RenameInstanceRequest() - assert args[0] == request_msg @@ -36752,7 +36730,6 @@ def test_reset_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = instance.ResetInstanceRequest() - assert args[0] == request_msg @@ -36772,7 +36749,6 @@ def test_start_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = instance.StartInstanceRequest() - assert args[0] == request_msg @@ -36792,7 +36768,6 @@ def test_stop_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = instance.StopInstanceRequest() - assert args[0] == request_msg @@ -36814,7 +36789,6 @@ def test_enable_interactive_serial_console_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = instance.EnableInteractiveSerialConsoleRequest() - assert args[0] == request_msg @@ -36836,7 +36810,6 @@ def test_disable_interactive_serial_console_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = instance.DisableInteractiveSerialConsoleRequest() - assert args[0] == request_msg @@ -36856,7 +36829,6 @@ def test_detach_lun_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcb_instance.DetachLunRequest() - assert args[0] == request_msg @@ -36876,7 +36848,6 @@ def test_list_ssh_keys_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ssh_key.ListSSHKeysRequest() - assert args[0] == request_msg @@ -36896,7 +36867,6 @@ def test_create_ssh_key_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcb_ssh_key.CreateSSHKeyRequest() - assert args[0] == request_msg @@ -36916,7 +36886,6 @@ def test_delete_ssh_key_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ssh_key.DeleteSSHKeyRequest() - assert args[0] == request_msg @@ -36936,7 +36905,6 @@ def test_list_volumes_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = volume.ListVolumesRequest() - assert args[0] == request_msg @@ -36956,7 +36924,6 @@ def test_get_volume_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = volume.GetVolumeRequest() - assert args[0] == request_msg @@ -36976,7 +36943,6 @@ def test_update_volume_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcb_volume.UpdateVolumeRequest() - assert args[0] == request_msg @@ -36996,7 +36962,6 @@ def test_rename_volume_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = volume.RenameVolumeRequest() - assert args[0] == request_msg @@ -37016,7 +36981,6 @@ def test_evict_volume_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = volume.EvictVolumeRequest() - assert args[0] == request_msg @@ -37036,7 +37000,6 @@ def test_resize_volume_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcb_volume.ResizeVolumeRequest() - assert args[0] == request_msg @@ -37056,7 +37019,6 @@ def test_list_networks_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = network.ListNetworksRequest() - assert args[0] == request_msg @@ -37078,7 +37040,6 @@ def test_list_network_usage_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = network.ListNetworkUsageRequest() - assert args[0] == request_msg @@ -37098,7 +37059,6 @@ def test_get_network_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = network.GetNetworkRequest() - assert args[0] == request_msg @@ -37118,7 +37078,6 @@ def test_update_network_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcb_network.UpdateNetworkRequest() - assert args[0] == request_msg @@ -37140,7 +37099,6 @@ def test_create_volume_snapshot_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcb_volume_snapshot.CreateVolumeSnapshotRequest() - assert args[0] == request_msg @@ -37162,7 +37120,6 @@ def test_restore_volume_snapshot_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcb_volume_snapshot.RestoreVolumeSnapshotRequest() - assert args[0] == request_msg @@ -37184,7 +37141,6 @@ def test_delete_volume_snapshot_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = volume_snapshot.DeleteVolumeSnapshotRequest() - assert args[0] == request_msg @@ -37206,7 +37162,6 @@ def test_get_volume_snapshot_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = volume_snapshot.GetVolumeSnapshotRequest() - assert args[0] == request_msg @@ -37228,7 +37183,6 @@ def test_list_volume_snapshots_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = volume_snapshot.ListVolumeSnapshotsRequest() - assert args[0] == request_msg @@ -37248,7 +37202,6 @@ def test_get_lun_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lun.GetLunRequest() - assert args[0] == request_msg @@ -37268,7 +37221,6 @@ def test_list_luns_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lun.ListLunsRequest() - assert args[0] == request_msg @@ -37288,7 +37240,6 @@ def test_evict_lun_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lun.EvictLunRequest() - assert args[0] == request_msg @@ -37308,7 +37259,6 @@ def test_get_nfs_share_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = nfs_share.GetNfsShareRequest() - assert args[0] == request_msg @@ -37328,7 +37278,6 @@ def test_list_nfs_shares_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = nfs_share.ListNfsSharesRequest() - assert args[0] == request_msg @@ -37348,7 +37297,6 @@ def test_update_nfs_share_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcb_nfs_share.UpdateNfsShareRequest() - assert args[0] == request_msg @@ -37368,7 +37316,6 @@ def test_create_nfs_share_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcb_nfs_share.CreateNfsShareRequest() - assert args[0] == request_msg @@ -37388,7 +37335,6 @@ def test_rename_nfs_share_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = nfs_share.RenameNfsShareRequest() - assert args[0] == request_msg @@ -37408,7 +37354,6 @@ def test_delete_nfs_share_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = nfs_share.DeleteNfsShareRequest() - assert args[0] == request_msg @@ -37430,7 +37375,6 @@ def test_list_provisioning_quotas_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = provisioning.ListProvisioningQuotasRequest() - assert args[0] == request_msg @@ -37452,7 +37396,6 @@ def test_submit_provisioning_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = provisioning.SubmitProvisioningConfigRequest() - assert args[0] == request_msg @@ -37474,7 +37417,6 @@ def test_get_provisioning_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = provisioning.GetProvisioningConfigRequest() - assert args[0] == request_msg @@ -37496,7 +37438,6 @@ def test_create_provisioning_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = provisioning.CreateProvisioningConfigRequest() - assert args[0] == request_msg @@ -37518,7 +37459,6 @@ def test_update_provisioning_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = provisioning.UpdateProvisioningConfigRequest() - assert args[0] == request_msg @@ -37538,7 +37478,6 @@ def test_rename_network_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = network.RenameNetworkRequest() - assert args[0] == request_msg @@ -37558,7 +37497,6 @@ def test_list_os_images_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = osimage.ListOSImagesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-batch/noxfile.py b/packages/google-cloud-batch/noxfile.py index 91ad708b2d6f..976947da12cf 100644 --- a/packages/google-cloud-batch/noxfile.py +++ b/packages/google-cloud-batch/noxfile.py @@ -47,7 +47,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-batch" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-batch/setup.py b/packages/google-cloud-batch/setup.py index 6bac0c5cea95..e87950027e82 100644 --- a/packages/google-cloud-batch/setup.py +++ b/packages/google-cloud-batch/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/google-cloud-batch/testing/constraints-3.10.txt b/packages/google-cloud-batch/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-batch/testing/constraints-3.10.txt +++ b/packages/google-cloud-batch/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-batch/tests/unit/gapic/batch_v1/test_batch_service.py b/packages/google-cloud-batch/tests/unit/gapic/batch_v1/test_batch_service.py index dfa9c98b9815..a90616d74217 100644 --- a/packages/google-cloud-batch/tests/unit/gapic/batch_v1/test_batch_service.py +++ b/packages/google-cloud-batch/tests/unit/gapic/batch_v1/test_batch_service.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 @@ -117,6 +118,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" @@ -1297,8 +1313,8 @@ def test_batch_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - batch.CreateJobRequest, - dict, + batch.CreateJobRequest(), + {}, ], ) def test_create_job(request_type, transport: str = "grpc"): @@ -1309,7 +1325,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() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_job), "__call__") as call: @@ -1359,11 +1375,12 @@ def test_create_job_non_empty_request_with_auto_populated_field(): client.create_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == batch.CreateJobRequest( + request_msg = batch.CreateJobRequest( parent="parent_value", job_id="job_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_job_use_cached_wrapped_rpc(): @@ -1442,9 +1459,14 @@ async def test_create_job_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_create_job_async( - transport: str = "grpc_asyncio", request_type=batch.CreateJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + batch.CreateJobRequest(), + {}, + ], +) +async def test_create_job_async(request_type, transport: str = "grpc_asyncio"): client = BatchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1452,7 +1474,7 @@ async def test_create_job_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_job), "__call__") as call: @@ -1479,11 +1501,6 @@ async def test_create_job_async( assert response.priority == 898 -@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 = BatchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1646,8 +1663,8 @@ async def test_create_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - batch.GetJobRequest, - dict, + batch.GetJobRequest(), + {}, ], ) def test_get_job(request_type, transport: str = "grpc"): @@ -1658,7 +1675,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(type(client.transport.get_job), "__call__") as call: @@ -1706,9 +1723,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] == batch.GetJobRequest( + request_msg = batch.GetJobRequest( name="name_value", ) + assert args[0] == request_msg def test_get_job_use_cached_wrapped_rpc(): @@ -1787,9 +1805,14 @@ async def test_get_job_async_use_cached_wrapped_rpc(transport: str = "grpc_async @pytest.mark.asyncio -async def test_get_job_async( - transport: str = "grpc_asyncio", request_type=batch.GetJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + batch.GetJobRequest(), + {}, + ], +) +async def test_get_job_async(request_type, transport: str = "grpc_asyncio"): client = BatchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1797,7 +1820,7 @@ async def test_get_job_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_job), "__call__") as call: @@ -1824,11 +1847,6 @@ async def test_get_job_async( assert response.priority == 898 -@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 = BatchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1971,8 +1989,8 @@ async def test_get_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - batch.DeleteJobRequest, - dict, + batch.DeleteJobRequest(), + {}, ], ) def test_delete_job(request_type, transport: str = "grpc"): @@ -1983,7 +2001,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() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_job), "__call__") as call: @@ -2026,11 +2044,12 @@ def test_delete_job_non_empty_request_with_auto_populated_field(): client.delete_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == batch.DeleteJobRequest( + request_msg = batch.DeleteJobRequest( name="name_value", reason="reason_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_job_use_cached_wrapped_rpc(): @@ -2119,9 +2138,14 @@ async def test_delete_job_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_delete_job_async( - transport: str = "grpc_asyncio", request_type=batch.DeleteJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + batch.DeleteJobRequest(), + {}, + ], +) +async def test_delete_job_async(request_type, transport: str = "grpc_asyncio"): client = BatchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2129,7 +2153,7 @@ async def test_delete_job_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_job), "__call__") as call: @@ -2149,11 +2173,6 @@ async def test_delete_job_async( assert isinstance(response, future.Future) -@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 = BatchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2300,8 +2319,8 @@ async def test_delete_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - batch.CancelJobRequest, - dict, + batch.CancelJobRequest(), + {}, ], ) def test_cancel_job(request_type, transport: str = "grpc"): @@ -2312,7 +2331,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() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.cancel_job), "__call__") as call: @@ -2353,9 +2372,10 @@ def test_cancel_job_non_empty_request_with_auto_populated_field(): client.cancel_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == batch.CancelJobRequest( + request_msg = batch.CancelJobRequest( name="name_value", ) + assert args[0] == request_msg def test_cancel_job_use_cached_wrapped_rpc(): @@ -2444,9 +2464,14 @@ async def test_cancel_job_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_cancel_job_async( - transport: str = "grpc_asyncio", request_type=batch.CancelJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + batch.CancelJobRequest(), + {}, + ], +) +async def test_cancel_job_async(request_type, transport: str = "grpc_asyncio"): client = BatchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2454,7 +2479,7 @@ async def test_cancel_job_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.cancel_job), "__call__") as call: @@ -2474,11 +2499,6 @@ async def test_cancel_job_async( assert isinstance(response, future.Future) -@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 = BatchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2625,8 +2645,8 @@ async def test_cancel_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - batch.ListJobsRequest, - dict, + batch.ListJobsRequest(), + {}, ], ) def test_list_jobs(request_type, transport: str = "grpc"): @@ -2637,7 +2657,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(type(client.transport.list_jobs), "__call__") as call: @@ -2686,12 +2706,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] == batch.ListJobsRequest( + request_msg = batch.ListJobsRequest( parent="parent_value", filter="filter_value", order_by="order_by_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_jobs_use_cached_wrapped_rpc(): @@ -2770,9 +2791,14 @@ async def test_list_jobs_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_list_jobs_async( - transport: str = "grpc_asyncio", request_type=batch.ListJobsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + batch.ListJobsRequest(), + {}, + ], +) +async def test_list_jobs_async(request_type, transport: str = "grpc_asyncio"): client = BatchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2780,7 +2806,7 @@ async def test_list_jobs_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_jobs), "__call__") as call: @@ -2805,11 +2831,6 @@ async def test_list_jobs_async( 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 = BatchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3146,8 +3167,8 @@ async def test_list_jobs_async_pages(): @pytest.mark.parametrize( "request_type", [ - batch.GetTaskRequest, - dict, + batch.GetTaskRequest(), + {}, ], ) def test_get_task(request_type, transport: str = "grpc"): @@ -3158,7 +3179,7 @@ def test_get_task(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_task), "__call__") as call: @@ -3202,9 +3223,10 @@ def test_get_task_non_empty_request_with_auto_populated_field(): client.get_task(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == batch.GetTaskRequest( + request_msg = batch.GetTaskRequest( name="name_value", ) + assert args[0] == request_msg def test_get_task_use_cached_wrapped_rpc(): @@ -3283,9 +3305,14 @@ async def test_get_task_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn @pytest.mark.asyncio -async def test_get_task_async( - transport: str = "grpc_asyncio", request_type=batch.GetTaskRequest -): +@pytest.mark.parametrize( + "request_type", + [ + batch.GetTaskRequest(), + {}, + ], +) +async def test_get_task_async(request_type, transport: str = "grpc_asyncio"): client = BatchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3293,7 +3320,7 @@ async def test_get_task_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_task), "__call__") as call: @@ -3316,11 +3343,6 @@ async def test_get_task_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_task_async_from_dict(): - await test_get_task_async(request_type=dict) - - def test_get_task_field_headers(): client = BatchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3463,8 +3485,8 @@ async def test_get_task_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - batch.ListTasksRequest, - dict, + batch.ListTasksRequest(), + {}, ], ) def test_list_tasks(request_type, transport: str = "grpc"): @@ -3475,7 +3497,7 @@ def test_list_tasks(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tasks), "__call__") as call: @@ -3523,11 +3545,12 @@ def test_list_tasks_non_empty_request_with_auto_populated_field(): client.list_tasks(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == batch.ListTasksRequest( + request_msg = batch.ListTasksRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_tasks_use_cached_wrapped_rpc(): @@ -3606,9 +3629,14 @@ async def test_list_tasks_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_list_tasks_async( - transport: str = "grpc_asyncio", request_type=batch.ListTasksRequest -): +@pytest.mark.parametrize( + "request_type", + [ + batch.ListTasksRequest(), + {}, + ], +) +async def test_list_tasks_async(request_type, transport: str = "grpc_asyncio"): client = BatchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3616,7 +3644,7 @@ async def test_list_tasks_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_tasks), "__call__") as call: @@ -3641,11 +3669,6 @@ async def test_list_tasks_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_tasks_async_from_dict(): - await test_list_tasks_async(request_type=dict) - - def test_list_tasks_field_headers(): client = BatchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5338,7 +5361,6 @@ def test_create_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = batch.CreateJobRequest() - assert args[0] == request_msg @@ -5359,7 +5381,6 @@ def test_get_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = batch.GetJobRequest() - assert args[0] == request_msg @@ -5380,7 +5401,6 @@ def test_delete_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = batch.DeleteJobRequest() - assert args[0] == request_msg @@ -5401,7 +5421,6 @@ def test_cancel_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = batch.CancelJobRequest() - assert args[0] == request_msg @@ -5422,7 +5441,6 @@ def test_list_jobs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = batch.ListJobsRequest() - assert args[0] == request_msg @@ -5443,7 +5461,6 @@ def test_get_task_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = batch.GetTaskRequest() - assert args[0] == request_msg @@ -5464,7 +5481,6 @@ def test_list_tasks_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = batch.ListTasksRequest() - assert args[0] == request_msg @@ -5507,7 +5523,6 @@ async def test_create_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = batch.CreateJobRequest() - assert args[0] == request_msg @@ -5536,7 +5551,6 @@ async def test_get_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = batch.GetJobRequest() - assert args[0] == request_msg @@ -5561,7 +5575,6 @@ async def test_delete_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = batch.DeleteJobRequest() - assert args[0] == request_msg @@ -5586,7 +5599,6 @@ async def test_cancel_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = batch.CancelJobRequest() - assert args[0] == request_msg @@ -5614,7 +5626,6 @@ async def test_list_jobs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = batch.ListJobsRequest() - assert args[0] == request_msg @@ -5641,7 +5652,6 @@ async def test_get_task_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = batch.GetTaskRequest() - assert args[0] == request_msg @@ -5669,7 +5679,6 @@ async def test_list_tasks_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = batch.ListTasksRequest() - assert args[0] == request_msg @@ -7200,7 +7209,6 @@ def test_create_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = batch.CreateJobRequest() - assert args[0] == request_msg @@ -7220,7 +7228,6 @@ def test_get_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = batch.GetJobRequest() - assert args[0] == request_msg @@ -7240,7 +7247,6 @@ def test_delete_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = batch.DeleteJobRequest() - assert args[0] == request_msg @@ -7260,7 +7266,6 @@ def test_cancel_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = batch.CancelJobRequest() - assert args[0] == request_msg @@ -7280,7 +7285,6 @@ def test_list_jobs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = batch.ListJobsRequest() - assert args[0] == request_msg @@ -7300,7 +7304,6 @@ def test_get_task_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = batch.GetTaskRequest() - assert args[0] == request_msg @@ -7320,7 +7323,6 @@ def test_list_tasks_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = batch.ListTasksRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-batch/tests/unit/gapic/batch_v1alpha/test_batch_service.py b/packages/google-cloud-batch/tests/unit/gapic/batch_v1alpha/test_batch_service.py index 341f170ce3b8..3ab382b78c0c 100644 --- a/packages/google-cloud-batch/tests/unit/gapic/batch_v1alpha/test_batch_service.py +++ b/packages/google-cloud-batch/tests/unit/gapic/batch_v1alpha/test_batch_service.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 @@ -129,6 +130,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" @@ -1309,8 +1325,8 @@ def test_batch_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - batch.CreateJobRequest, - dict, + batch.CreateJobRequest(), + {}, ], ) def test_create_job(request_type, transport: str = "grpc"): @@ -1321,7 +1337,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() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_job), "__call__") as call: @@ -1375,11 +1391,12 @@ def test_create_job_non_empty_request_with_auto_populated_field(): client.create_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == batch.CreateJobRequest( + request_msg = batch.CreateJobRequest( parent="parent_value", job_id="job_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_job_use_cached_wrapped_rpc(): @@ -1458,9 +1475,14 @@ async def test_create_job_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_create_job_async( - transport: str = "grpc_asyncio", request_type=batch.CreateJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + batch.CreateJobRequest(), + {}, + ], +) +async def test_create_job_async(request_type, transport: str = "grpc_asyncio"): client = BatchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1468,7 +1490,7 @@ async def test_create_job_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_job), "__call__") as call: @@ -1499,11 +1521,6 @@ async def test_create_job_async( ) -@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 = BatchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1666,8 +1683,8 @@ async def test_create_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - batch.GetJobRequest, - dict, + batch.GetJobRequest(), + {}, ], ) def test_get_job(request_type, transport: str = "grpc"): @@ -1678,7 +1695,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(type(client.transport.get_job), "__call__") as call: @@ -1728,9 +1745,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] == batch.GetJobRequest( + request_msg = batch.GetJobRequest( name="name_value", ) + assert args[0] == request_msg def test_get_job_use_cached_wrapped_rpc(): @@ -1809,9 +1827,14 @@ async def test_get_job_async_use_cached_wrapped_rpc(transport: str = "grpc_async @pytest.mark.asyncio -async def test_get_job_async( - transport: str = "grpc_asyncio", request_type=batch.GetJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + batch.GetJobRequest(), + {}, + ], +) +async def test_get_job_async(request_type, transport: str = "grpc_asyncio"): client = BatchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1819,7 +1842,7 @@ async def test_get_job_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_job), "__call__") as call: @@ -1848,11 +1871,6 @@ async def test_get_job_async( assert response.scheduling_policy == job.Job.SchedulingPolicy.AS_SOON_AS_POSSIBLE -@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 = BatchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1995,8 +2013,8 @@ async def test_get_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - batch.DeleteJobRequest, - dict, + batch.DeleteJobRequest(), + {}, ], ) def test_delete_job(request_type, transport: str = "grpc"): @@ -2007,7 +2025,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() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_job), "__call__") as call: @@ -2050,11 +2068,12 @@ def test_delete_job_non_empty_request_with_auto_populated_field(): client.delete_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == batch.DeleteJobRequest( + request_msg = batch.DeleteJobRequest( name="name_value", reason="reason_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_job_use_cached_wrapped_rpc(): @@ -2143,9 +2162,14 @@ async def test_delete_job_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_delete_job_async( - transport: str = "grpc_asyncio", request_type=batch.DeleteJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + batch.DeleteJobRequest(), + {}, + ], +) +async def test_delete_job_async(request_type, transport: str = "grpc_asyncio"): client = BatchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2153,7 +2177,7 @@ async def test_delete_job_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_job), "__call__") as call: @@ -2173,11 +2197,6 @@ async def test_delete_job_async( assert isinstance(response, future.Future) -@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 = BatchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2324,8 +2343,8 @@ async def test_delete_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - batch.CancelJobRequest, - dict, + batch.CancelJobRequest(), + {}, ], ) def test_cancel_job(request_type, transport: str = "grpc"): @@ -2336,7 +2355,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() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.cancel_job), "__call__") as call: @@ -2377,9 +2396,10 @@ def test_cancel_job_non_empty_request_with_auto_populated_field(): client.cancel_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == batch.CancelJobRequest( + request_msg = batch.CancelJobRequest( name="name_value", ) + assert args[0] == request_msg def test_cancel_job_use_cached_wrapped_rpc(): @@ -2468,9 +2488,14 @@ async def test_cancel_job_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_cancel_job_async( - transport: str = "grpc_asyncio", request_type=batch.CancelJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + batch.CancelJobRequest(), + {}, + ], +) +async def test_cancel_job_async(request_type, transport: str = "grpc_asyncio"): client = BatchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2478,7 +2503,7 @@ async def test_cancel_job_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.cancel_job), "__call__") as call: @@ -2498,11 +2523,6 @@ async def test_cancel_job_async( assert isinstance(response, future.Future) -@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 = BatchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2649,8 +2669,8 @@ async def test_cancel_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - batch.UpdateJobRequest, - dict, + batch.UpdateJobRequest(), + {}, ], ) def test_update_job(request_type, transport: str = "grpc"): @@ -2661,7 +2681,7 @@ def test_update_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(type(client.transport.update_job), "__call__") as call: @@ -2711,7 +2731,8 @@ def test_update_job_non_empty_request_with_auto_populated_field(): client.update_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == batch.UpdateJobRequest() + request_msg = batch.UpdateJobRequest() + assert args[0] == request_msg def test_update_job_use_cached_wrapped_rpc(): @@ -2790,9 +2811,14 @@ async def test_update_job_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_update_job_async( - transport: str = "grpc_asyncio", request_type=batch.UpdateJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + batch.UpdateJobRequest(), + {}, + ], +) +async def test_update_job_async(request_type, transport: str = "grpc_asyncio"): client = BatchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2800,7 +2826,7 @@ async def test_update_job_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_job), "__call__") as call: @@ -2831,11 +2857,6 @@ async def test_update_job_async( ) -@pytest.mark.asyncio -async def test_update_job_async_from_dict(): - await test_update_job_async(request_type=dict) - - def test_update_job_field_headers(): client = BatchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2988,8 +3009,8 @@ async def test_update_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - batch.ListJobsRequest, - dict, + batch.ListJobsRequest(), + {}, ], ) def test_list_jobs(request_type, transport: str = "grpc"): @@ -3000,7 +3021,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(type(client.transport.list_jobs), "__call__") as call: @@ -3049,12 +3070,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] == batch.ListJobsRequest( + request_msg = batch.ListJobsRequest( parent="parent_value", filter="filter_value", order_by="order_by_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_jobs_use_cached_wrapped_rpc(): @@ -3133,9 +3155,14 @@ async def test_list_jobs_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_list_jobs_async( - transport: str = "grpc_asyncio", request_type=batch.ListJobsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + batch.ListJobsRequest(), + {}, + ], +) +async def test_list_jobs_async(request_type, transport: str = "grpc_asyncio"): client = BatchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3143,7 +3170,7 @@ async def test_list_jobs_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_jobs), "__call__") as call: @@ -3168,11 +3195,6 @@ async def test_list_jobs_async( 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 = BatchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3509,8 +3531,8 @@ async def test_list_jobs_async_pages(): @pytest.mark.parametrize( "request_type", [ - batch.GetTaskRequest, - dict, + batch.GetTaskRequest(), + {}, ], ) def test_get_task(request_type, transport: str = "grpc"): @@ -3521,7 +3543,7 @@ def test_get_task(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_task), "__call__") as call: @@ -3565,9 +3587,10 @@ def test_get_task_non_empty_request_with_auto_populated_field(): client.get_task(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == batch.GetTaskRequest( + request_msg = batch.GetTaskRequest( name="name_value", ) + assert args[0] == request_msg def test_get_task_use_cached_wrapped_rpc(): @@ -3646,9 +3669,14 @@ async def test_get_task_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn @pytest.mark.asyncio -async def test_get_task_async( - transport: str = "grpc_asyncio", request_type=batch.GetTaskRequest -): +@pytest.mark.parametrize( + "request_type", + [ + batch.GetTaskRequest(), + {}, + ], +) +async def test_get_task_async(request_type, transport: str = "grpc_asyncio"): client = BatchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3656,7 +3684,7 @@ async def test_get_task_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_task), "__call__") as call: @@ -3679,11 +3707,6 @@ async def test_get_task_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_task_async_from_dict(): - await test_get_task_async(request_type=dict) - - def test_get_task_field_headers(): client = BatchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3826,8 +3849,8 @@ async def test_get_task_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - batch.ListTasksRequest, - dict, + batch.ListTasksRequest(), + {}, ], ) def test_list_tasks(request_type, transport: str = "grpc"): @@ -3838,7 +3861,7 @@ def test_list_tasks(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tasks), "__call__") as call: @@ -3887,12 +3910,13 @@ def test_list_tasks_non_empty_request_with_auto_populated_field(): client.list_tasks(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == batch.ListTasksRequest( + request_msg = batch.ListTasksRequest( parent="parent_value", filter="filter_value", order_by="order_by_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_tasks_use_cached_wrapped_rpc(): @@ -3971,9 +3995,14 @@ async def test_list_tasks_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_list_tasks_async( - transport: str = "grpc_asyncio", request_type=batch.ListTasksRequest -): +@pytest.mark.parametrize( + "request_type", + [ + batch.ListTasksRequest(), + {}, + ], +) +async def test_list_tasks_async(request_type, transport: str = "grpc_asyncio"): client = BatchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3981,7 +4010,7 @@ async def test_list_tasks_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_tasks), "__call__") as call: @@ -4006,11 +4035,6 @@ async def test_list_tasks_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_tasks_async_from_dict(): - await test_list_tasks_async(request_type=dict) - - def test_list_tasks_field_headers(): client = BatchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4347,8 +4371,8 @@ async def test_list_tasks_async_pages(): @pytest.mark.parametrize( "request_type", [ - batch.CreateResourceAllowanceRequest, - dict, + batch.CreateResourceAllowanceRequest(), + {}, ], ) def test_create_resource_allowance(request_type, transport: str = "grpc"): @@ -4359,7 +4383,7 @@ def test_create_resource_allowance(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4410,10 +4434,11 @@ def test_create_resource_allowance_non_empty_request_with_auto_populated_field() client.create_resource_allowance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == batch.CreateResourceAllowanceRequest( + request_msg = batch.CreateResourceAllowanceRequest( parent="parent_value", resource_allowance_id="resource_allowance_id_value", ) + assert args[0] == request_msg def test_create_resource_allowance_use_cached_wrapped_rpc(): @@ -4499,8 +4524,15 @@ async def test_create_resource_allowance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + batch.CreateResourceAllowanceRequest(), + {}, + ], +) async def test_create_resource_allowance_async( - transport: str = "grpc_asyncio", request_type=batch.CreateResourceAllowanceRequest + request_type, transport: str = "grpc_asyncio" ): client = BatchServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4509,7 +4541,7 @@ async def test_create_resource_allowance_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( @@ -4536,11 +4568,6 @@ async def test_create_resource_allowance_async( assert response.uid == "uid_value" -@pytest.mark.asyncio -async def test_create_resource_allowance_async_from_dict(): - await test_create_resource_allowance_async(request_type=dict) - - def test_create_resource_allowance_field_headers(): client = BatchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4751,8 +4778,8 @@ async def test_create_resource_allowance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - batch.GetResourceAllowanceRequest, - dict, + batch.GetResourceAllowanceRequest(), + {}, ], ) def test_get_resource_allowance(request_type, transport: str = "grpc"): @@ -4763,7 +4790,7 @@ def test_get_resource_allowance(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4813,9 +4840,10 @@ def test_get_resource_allowance_non_empty_request_with_auto_populated_field(): client.get_resource_allowance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == batch.GetResourceAllowanceRequest( + request_msg = batch.GetResourceAllowanceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_resource_allowance_use_cached_wrapped_rpc(): @@ -4901,8 +4929,15 @@ async def test_get_resource_allowance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + batch.GetResourceAllowanceRequest(), + {}, + ], +) async def test_get_resource_allowance_async( - transport: str = "grpc_asyncio", request_type=batch.GetResourceAllowanceRequest + request_type, transport: str = "grpc_asyncio" ): client = BatchServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4911,7 +4946,7 @@ async def test_get_resource_allowance_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( @@ -4938,11 +4973,6 @@ async def test_get_resource_allowance_async( assert response.uid == "uid_value" -@pytest.mark.asyncio -async def test_get_resource_allowance_async_from_dict(): - await test_get_resource_allowance_async(request_type=dict) - - def test_get_resource_allowance_field_headers(): client = BatchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5097,8 +5127,8 @@ async def test_get_resource_allowance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - batch.DeleteResourceAllowanceRequest, - dict, + batch.DeleteResourceAllowanceRequest(), + {}, ], ) def test_delete_resource_allowance(request_type, transport: str = "grpc"): @@ -5109,7 +5139,7 @@ def test_delete_resource_allowance(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5155,10 +5185,11 @@ def test_delete_resource_allowance_non_empty_request_with_auto_populated_field() client.delete_resource_allowance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == batch.DeleteResourceAllowanceRequest( + request_msg = batch.DeleteResourceAllowanceRequest( name="name_value", reason="reason_value", ) + assert args[0] == request_msg def test_delete_resource_allowance_use_cached_wrapped_rpc(): @@ -5254,8 +5285,15 @@ async def test_delete_resource_allowance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + batch.DeleteResourceAllowanceRequest(), + {}, + ], +) async def test_delete_resource_allowance_async( - transport: str = "grpc_asyncio", request_type=batch.DeleteResourceAllowanceRequest + request_type, transport: str = "grpc_asyncio" ): client = BatchServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5264,7 +5302,7 @@ async def test_delete_resource_allowance_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( @@ -5286,11 +5324,6 @@ async def test_delete_resource_allowance_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_resource_allowance_async_from_dict(): - await test_delete_resource_allowance_async(request_type=dict) - - def test_delete_resource_allowance_field_headers(): client = BatchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5445,8 +5478,8 @@ async def test_delete_resource_allowance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - batch.ListResourceAllowancesRequest, - dict, + batch.ListResourceAllowancesRequest(), + {}, ], ) def test_list_resource_allowances(request_type, transport: str = "grpc"): @@ -5457,7 +5490,7 @@ def test_list_resource_allowances(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5508,10 +5541,11 @@ def test_list_resource_allowances_non_empty_request_with_auto_populated_field(): client.list_resource_allowances(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == batch.ListResourceAllowancesRequest( + request_msg = batch.ListResourceAllowancesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_resource_allowances_use_cached_wrapped_rpc(): @@ -5597,8 +5631,15 @@ async def test_list_resource_allowances_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + batch.ListResourceAllowancesRequest(), + {}, + ], +) async def test_list_resource_allowances_async( - transport: str = "grpc_asyncio", request_type=batch.ListResourceAllowancesRequest + request_type, transport: str = "grpc_asyncio" ): client = BatchServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5607,7 +5648,7 @@ async def test_list_resource_allowances_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( @@ -5634,11 +5675,6 @@ async def test_list_resource_allowances_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_resource_allowances_async_from_dict(): - await test_list_resource_allowances_async(request_type=dict) - - def test_list_resource_allowances_field_headers(): client = BatchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5995,8 +6031,8 @@ async def test_list_resource_allowances_async_pages(): @pytest.mark.parametrize( "request_type", [ - batch.UpdateResourceAllowanceRequest, - dict, + batch.UpdateResourceAllowanceRequest(), + {}, ], ) def test_update_resource_allowance(request_type, transport: str = "grpc"): @@ -6007,7 +6043,7 @@ def test_update_resource_allowance(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6055,7 +6091,8 @@ def test_update_resource_allowance_non_empty_request_with_auto_populated_field() client.update_resource_allowance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == batch.UpdateResourceAllowanceRequest() + request_msg = batch.UpdateResourceAllowanceRequest() + assert args[0] == request_msg def test_update_resource_allowance_use_cached_wrapped_rpc(): @@ -6141,8 +6178,15 @@ async def test_update_resource_allowance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + batch.UpdateResourceAllowanceRequest(), + {}, + ], +) async def test_update_resource_allowance_async( - transport: str = "grpc_asyncio", request_type=batch.UpdateResourceAllowanceRequest + request_type, transport: str = "grpc_asyncio" ): client = BatchServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -6151,7 +6195,7 @@ async def test_update_resource_allowance_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( @@ -6178,11 +6222,6 @@ async def test_update_resource_allowance_async( assert response.uid == "uid_value" -@pytest.mark.asyncio -async def test_update_resource_allowance_async_from_dict(): - await test_update_resource_allowance_async(request_type=dict) - - def test_update_resource_allowance_field_headers(): client = BatchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9019,7 +9058,6 @@ def test_create_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = batch.CreateJobRequest() - assert args[0] == request_msg @@ -9040,7 +9078,6 @@ def test_get_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = batch.GetJobRequest() - assert args[0] == request_msg @@ -9061,7 +9098,6 @@ def test_delete_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = batch.DeleteJobRequest() - assert args[0] == request_msg @@ -9082,7 +9118,6 @@ def test_cancel_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = batch.CancelJobRequest() - assert args[0] == request_msg @@ -9103,7 +9138,6 @@ def test_update_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = batch.UpdateJobRequest() - assert args[0] == request_msg @@ -9124,7 +9158,6 @@ def test_list_jobs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = batch.ListJobsRequest() - assert args[0] == request_msg @@ -9145,7 +9178,6 @@ def test_get_task_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = batch.GetTaskRequest() - assert args[0] == request_msg @@ -9166,7 +9198,6 @@ def test_list_tasks_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = batch.ListTasksRequest() - assert args[0] == request_msg @@ -9189,7 +9220,6 @@ def test_create_resource_allowance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = batch.CreateResourceAllowanceRequest() - assert args[0] == request_msg @@ -9212,7 +9242,6 @@ def test_get_resource_allowance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = batch.GetResourceAllowanceRequest() - assert args[0] == request_msg @@ -9235,7 +9264,6 @@ def test_delete_resource_allowance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = batch.DeleteResourceAllowanceRequest() - assert args[0] == request_msg @@ -9258,7 +9286,6 @@ def test_list_resource_allowances_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = batch.ListResourceAllowancesRequest() - assert args[0] == request_msg @@ -9281,7 +9308,6 @@ def test_update_resource_allowance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = batch.UpdateResourceAllowanceRequest() - assert args[0] == request_msg @@ -9325,7 +9351,6 @@ async def test_create_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = batch.CreateJobRequest() - assert args[0] == request_msg @@ -9355,7 +9380,6 @@ async def test_get_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = batch.GetJobRequest() - assert args[0] == request_msg @@ -9380,7 +9404,6 @@ async def test_delete_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = batch.DeleteJobRequest() - assert args[0] == request_msg @@ -9405,7 +9428,6 @@ async def test_cancel_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = batch.CancelJobRequest() - assert args[0] == request_msg @@ -9435,7 +9457,6 @@ async def test_update_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = batch.UpdateJobRequest() - assert args[0] == request_msg @@ -9463,7 +9484,6 @@ async def test_list_jobs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = batch.ListJobsRequest() - assert args[0] == request_msg @@ -9490,7 +9510,6 @@ async def test_get_task_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = batch.GetTaskRequest() - assert args[0] == request_msg @@ -9518,7 +9537,6 @@ async def test_list_tasks_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = batch.ListTasksRequest() - assert args[0] == request_msg @@ -9548,7 +9566,6 @@ async def test_create_resource_allowance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = batch.CreateResourceAllowanceRequest() - assert args[0] == request_msg @@ -9578,7 +9595,6 @@ async def test_get_resource_allowance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = batch.GetResourceAllowanceRequest() - assert args[0] == request_msg @@ -9605,7 +9621,6 @@ async def test_delete_resource_allowance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = batch.DeleteResourceAllowanceRequest() - assert args[0] == request_msg @@ -9635,7 +9650,6 @@ async def test_list_resource_allowances_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = batch.ListResourceAllowancesRequest() - assert args[0] == request_msg @@ -9665,7 +9679,6 @@ async def test_update_resource_allowance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = batch.UpdateResourceAllowanceRequest() - assert args[0] == request_msg @@ -12511,7 +12524,6 @@ def test_create_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = batch.CreateJobRequest() - assert args[0] == request_msg @@ -12531,7 +12543,6 @@ def test_get_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = batch.GetJobRequest() - assert args[0] == request_msg @@ -12551,7 +12562,6 @@ def test_delete_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = batch.DeleteJobRequest() - assert args[0] == request_msg @@ -12571,7 +12581,6 @@ def test_cancel_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = batch.CancelJobRequest() - assert args[0] == request_msg @@ -12591,7 +12600,6 @@ def test_update_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = batch.UpdateJobRequest() - assert args[0] == request_msg @@ -12611,7 +12619,6 @@ def test_list_jobs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = batch.ListJobsRequest() - assert args[0] == request_msg @@ -12631,7 +12638,6 @@ def test_get_task_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = batch.GetTaskRequest() - assert args[0] == request_msg @@ -12651,7 +12657,6 @@ def test_list_tasks_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = batch.ListTasksRequest() - assert args[0] == request_msg @@ -12673,7 +12678,6 @@ def test_create_resource_allowance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = batch.CreateResourceAllowanceRequest() - assert args[0] == request_msg @@ -12695,7 +12699,6 @@ def test_get_resource_allowance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = batch.GetResourceAllowanceRequest() - assert args[0] == request_msg @@ -12717,7 +12720,6 @@ def test_delete_resource_allowance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = batch.DeleteResourceAllowanceRequest() - assert args[0] == request_msg @@ -12739,7 +12741,6 @@ def test_list_resource_allowances_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = batch.ListResourceAllowancesRequest() - assert args[0] == request_msg @@ -12761,7 +12762,6 @@ def test_update_resource_allowance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = batch.UpdateResourceAllowanceRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-beyondcorp-appconnections/noxfile.py b/packages/google-cloud-beyondcorp-appconnections/noxfile.py index efacf15538f0..b4957d8a7c4b 100644 --- a/packages/google-cloud-beyondcorp-appconnections/noxfile.py +++ b/packages/google-cloud-beyondcorp-appconnections/noxfile.py @@ -47,7 +47,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-beyondcorp-appconnections" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-beyondcorp-appconnections/setup.py b/packages/google-cloud-beyondcorp-appconnections/setup.py index 2479de67d93c..9689016c75a5 100644 --- a/packages/google-cloud-beyondcorp-appconnections/setup.py +++ b/packages/google-cloud-beyondcorp-appconnections/setup.py @@ -47,7 +47,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/google-cloud-beyondcorp-appconnections/testing/constraints-3.10.txt b/packages/google-cloud-beyondcorp-appconnections/testing/constraints-3.10.txt index a92801e1c8e2..b39cd54634f9 100644 --- a/packages/google-cloud-beyondcorp-appconnections/testing/constraints-3.10.txt +++ b/packages/google-cloud-beyondcorp-appconnections/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/google-cloud-beyondcorp-appconnections/tests/unit/gapic/beyondcorp_appconnections_v1/test_app_connections_service.py b/packages/google-cloud-beyondcorp-appconnections/tests/unit/gapic/beyondcorp_appconnections_v1/test_app_connections_service.py index ee1aabd96bd4..234810b9f5ab 100644 --- a/packages/google-cloud-beyondcorp-appconnections/tests/unit/gapic/beyondcorp_appconnections_v1/test_app_connections_service.py +++ b/packages/google-cloud-beyondcorp-appconnections/tests/unit/gapic/beyondcorp_appconnections_v1/test_app_connections_service.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 @@ -121,6 +122,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" @@ -1386,8 +1402,8 @@ def test_app_connections_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - app_connections_service.ListAppConnectionsRequest, - dict, + app_connections_service.ListAppConnectionsRequest(), + {}, ], ) def test_list_app_connections(request_type, transport: str = "grpc"): @@ -1398,7 +1414,7 @@ def test_list_app_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( @@ -1451,12 +1467,13 @@ def test_list_app_connections_non_empty_request_with_auto_populated_field(): client.list_app_connections(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == app_connections_service.ListAppConnectionsRequest( + request_msg = app_connections_service.ListAppConnectionsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_app_connections_use_cached_wrapped_rpc(): @@ -1541,9 +1558,15 @@ async def test_list_app_connections_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + app_connections_service.ListAppConnectionsRequest(), + {}, + ], +) async def test_list_app_connections_async( - transport: str = "grpc_asyncio", - request_type=app_connections_service.ListAppConnectionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = AppConnectionsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1552,7 +1575,7 @@ async def test_list_app_connections_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( @@ -1579,11 +1602,6 @@ async def test_list_app_connections_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_app_connections_async_from_dict(): - await test_list_app_connections_async(request_type=dict) - - def test_list_app_connections_field_headers(): client = AppConnectionsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1940,8 +1958,8 @@ async def test_list_app_connections_async_pages(): @pytest.mark.parametrize( "request_type", [ - app_connections_service.GetAppConnectionRequest, - dict, + app_connections_service.GetAppConnectionRequest(), + {}, ], ) def test_get_app_connection(request_type, transport: str = "grpc"): @@ -1952,7 +1970,7 @@ def test_get_app_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( @@ -2010,9 +2028,10 @@ def test_get_app_connection_non_empty_request_with_auto_populated_field(): client.get_app_connection(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == app_connections_service.GetAppConnectionRequest( + request_msg = app_connections_service.GetAppConnectionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_app_connection_use_cached_wrapped_rpc(): @@ -2097,10 +2116,14 @@ async def test_get_app_connection_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_app_connection_async( - transport: str = "grpc_asyncio", - request_type=app_connections_service.GetAppConnectionRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + app_connections_service.GetAppConnectionRequest(), + {}, + ], +) +async def test_get_app_connection_async(request_type, transport: str = "grpc_asyncio"): client = AppConnectionsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2108,7 +2131,7 @@ async def test_get_app_connection_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( @@ -2143,11 +2166,6 @@ async def test_get_app_connection_async( assert response.state == app_connections_service.AppConnection.State.CREATING -@pytest.mark.asyncio -async def test_get_app_connection_async_from_dict(): - await test_get_app_connection_async(request_type=dict) - - def test_get_app_connection_field_headers(): client = AppConnectionsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2302,8 +2320,8 @@ async def test_get_app_connection_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - app_connections_service.CreateAppConnectionRequest, - dict, + app_connections_service.CreateAppConnectionRequest(), + {}, ], ) def test_create_app_connection(request_type, transport: str = "grpc"): @@ -2314,7 +2332,7 @@ def test_create_app_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( @@ -2361,11 +2379,12 @@ def test_create_app_connection_non_empty_request_with_auto_populated_field(): client.create_app_connection(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == app_connections_service.CreateAppConnectionRequest( + request_msg = app_connections_service.CreateAppConnectionRequest( parent="parent_value", app_connection_id="app_connection_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_app_connection_use_cached_wrapped_rpc(): @@ -2461,9 +2480,15 @@ async def test_create_app_connection_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + app_connections_service.CreateAppConnectionRequest(), + {}, + ], +) async def test_create_app_connection_async( - transport: str = "grpc_asyncio", - request_type=app_connections_service.CreateAppConnectionRequest, + request_type, transport: str = "grpc_asyncio" ): client = AppConnectionsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2472,7 +2497,7 @@ async def test_create_app_connection_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( @@ -2494,11 +2519,6 @@ async def test_create_app_connection_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_app_connection_async_from_dict(): - await test_create_app_connection_async(request_type=dict) - - def test_create_app_connection_field_headers(): client = AppConnectionsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2673,8 +2693,8 @@ async def test_create_app_connection_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - app_connections_service.UpdateAppConnectionRequest, - dict, + app_connections_service.UpdateAppConnectionRequest(), + {}, ], ) def test_update_app_connection(request_type, transport: str = "grpc"): @@ -2685,7 +2705,7 @@ def test_update_app_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( @@ -2730,9 +2750,10 @@ def test_update_app_connection_non_empty_request_with_auto_populated_field(): client.update_app_connection(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == app_connections_service.UpdateAppConnectionRequest( + request_msg = app_connections_service.UpdateAppConnectionRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_app_connection_use_cached_wrapped_rpc(): @@ -2828,9 +2849,15 @@ async def test_update_app_connection_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + app_connections_service.UpdateAppConnectionRequest(), + {}, + ], +) async def test_update_app_connection_async( - transport: str = "grpc_asyncio", - request_type=app_connections_service.UpdateAppConnectionRequest, + request_type, transport: str = "grpc_asyncio" ): client = AppConnectionsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2839,7 +2866,7 @@ async def test_update_app_connection_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( @@ -2861,11 +2888,6 @@ async def test_update_app_connection_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_app_connection_async_from_dict(): - await test_update_app_connection_async(request_type=dict) - - def test_update_app_connection_field_headers(): client = AppConnectionsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3030,8 +3052,8 @@ async def test_update_app_connection_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - app_connections_service.DeleteAppConnectionRequest, - dict, + app_connections_service.DeleteAppConnectionRequest(), + {}, ], ) def test_delete_app_connection(request_type, transport: str = "grpc"): @@ -3042,7 +3064,7 @@ def test_delete_app_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( @@ -3088,10 +3110,11 @@ def test_delete_app_connection_non_empty_request_with_auto_populated_field(): client.delete_app_connection(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == app_connections_service.DeleteAppConnectionRequest( + request_msg = app_connections_service.DeleteAppConnectionRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_app_connection_use_cached_wrapped_rpc(): @@ -3187,9 +3210,15 @@ async def test_delete_app_connection_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + app_connections_service.DeleteAppConnectionRequest(), + {}, + ], +) async def test_delete_app_connection_async( - transport: str = "grpc_asyncio", - request_type=app_connections_service.DeleteAppConnectionRequest, + request_type, transport: str = "grpc_asyncio" ): client = AppConnectionsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3198,7 +3227,7 @@ async def test_delete_app_connection_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( @@ -3220,11 +3249,6 @@ async def test_delete_app_connection_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_app_connection_async_from_dict(): - await test_delete_app_connection_async(request_type=dict) - - def test_delete_app_connection_field_headers(): client = AppConnectionsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3379,8 +3403,8 @@ async def test_delete_app_connection_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - app_connections_service.ResolveAppConnectionsRequest, - dict, + app_connections_service.ResolveAppConnectionsRequest(), + {}, ], ) def test_resolve_app_connections(request_type, transport: str = "grpc"): @@ -3391,7 +3415,7 @@ def test_resolve_app_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( @@ -3443,11 +3467,12 @@ def test_resolve_app_connections_non_empty_request_with_auto_populated_field(): client.resolve_app_connections(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == app_connections_service.ResolveAppConnectionsRequest( + request_msg = app_connections_service.ResolveAppConnectionsRequest( parent="parent_value", app_connector_id="app_connector_id_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_resolve_app_connections_use_cached_wrapped_rpc(): @@ -3533,9 +3558,15 @@ async def test_resolve_app_connections_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + app_connections_service.ResolveAppConnectionsRequest(), + {}, + ], +) async def test_resolve_app_connections_async( - transport: str = "grpc_asyncio", - request_type=app_connections_service.ResolveAppConnectionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = AppConnectionsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3544,7 +3575,7 @@ async def test_resolve_app_connections_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( @@ -3571,11 +3602,6 @@ async def test_resolve_app_connections_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_resolve_app_connections_async_from_dict(): - await test_resolve_app_connections_async(request_type=dict) - - def test_resolve_app_connections_field_headers(): client = AppConnectionsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5425,7 +5451,6 @@ def test_list_app_connections_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = app_connections_service.ListAppConnectionsRequest() - assert args[0] == request_msg @@ -5448,7 +5473,6 @@ def test_get_app_connection_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = app_connections_service.GetAppConnectionRequest() - assert args[0] == request_msg @@ -5471,7 +5495,6 @@ def test_create_app_connection_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = app_connections_service.CreateAppConnectionRequest() - assert args[0] == request_msg @@ -5494,7 +5517,6 @@ def test_update_app_connection_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = app_connections_service.UpdateAppConnectionRequest() - assert args[0] == request_msg @@ -5517,7 +5539,6 @@ def test_delete_app_connection_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = app_connections_service.DeleteAppConnectionRequest() - assert args[0] == request_msg @@ -5540,7 +5561,6 @@ def test_resolve_app_connections_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = app_connections_service.ResolveAppConnectionsRequest() - assert args[0] == request_msg @@ -5584,7 +5604,6 @@ async def test_list_app_connections_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = app_connections_service.ListAppConnectionsRequest() - assert args[0] == request_msg @@ -5618,7 +5637,6 @@ async def test_get_app_connection_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = app_connections_service.GetAppConnectionRequest() - assert args[0] == request_msg @@ -5645,7 +5663,6 @@ async def test_create_app_connection_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = app_connections_service.CreateAppConnectionRequest() - assert args[0] == request_msg @@ -5672,7 +5689,6 @@ async def test_update_app_connection_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = app_connections_service.UpdateAppConnectionRequest() - assert args[0] == request_msg @@ -5699,7 +5715,6 @@ async def test_delete_app_connection_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = app_connections_service.DeleteAppConnectionRequest() - assert args[0] == request_msg @@ -5729,7 +5744,6 @@ async def test_resolve_app_connections_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = app_connections_service.ResolveAppConnectionsRequest() - assert args[0] == request_msg @@ -7328,7 +7342,6 @@ def test_list_app_connections_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = app_connections_service.ListAppConnectionsRequest() - assert args[0] == request_msg @@ -7350,7 +7363,6 @@ def test_get_app_connection_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = app_connections_service.GetAppConnectionRequest() - assert args[0] == request_msg @@ -7372,7 +7384,6 @@ def test_create_app_connection_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = app_connections_service.CreateAppConnectionRequest() - assert args[0] == request_msg @@ -7394,7 +7405,6 @@ def test_update_app_connection_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = app_connections_service.UpdateAppConnectionRequest() - assert args[0] == request_msg @@ -7416,7 +7426,6 @@ def test_delete_app_connection_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = app_connections_service.DeleteAppConnectionRequest() - assert args[0] == request_msg @@ -7438,7 +7447,6 @@ def test_resolve_app_connections_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = app_connections_service.ResolveAppConnectionsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-beyondcorp-appconnectors/noxfile.py b/packages/google-cloud-beyondcorp-appconnectors/noxfile.py index a7dda23474cb..7b8f48b26a26 100644 --- a/packages/google-cloud-beyondcorp-appconnectors/noxfile.py +++ b/packages/google-cloud-beyondcorp-appconnectors/noxfile.py @@ -47,7 +47,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-beyondcorp-appconnectors" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-beyondcorp-appconnectors/setup.py b/packages/google-cloud-beyondcorp-appconnectors/setup.py index 8c57cde29f47..aa8f8581926a 100644 --- a/packages/google-cloud-beyondcorp-appconnectors/setup.py +++ b/packages/google-cloud-beyondcorp-appconnectors/setup.py @@ -45,7 +45,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/google-cloud-beyondcorp-appconnectors/testing/constraints-3.10.txt b/packages/google-cloud-beyondcorp-appconnectors/testing/constraints-3.10.txt index a92801e1c8e2..b39cd54634f9 100644 --- a/packages/google-cloud-beyondcorp-appconnectors/testing/constraints-3.10.txt +++ b/packages/google-cloud-beyondcorp-appconnectors/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/google-cloud-beyondcorp-appconnectors/tests/unit/gapic/beyondcorp_appconnectors_v1/test_app_connectors_service.py b/packages/google-cloud-beyondcorp-appconnectors/tests/unit/gapic/beyondcorp_appconnectors_v1/test_app_connectors_service.py index bfd1c0da32f6..e8474beccbcd 100644 --- a/packages/google-cloud-beyondcorp-appconnectors/tests/unit/gapic/beyondcorp_appconnectors_v1/test_app_connectors_service.py +++ b/packages/google-cloud-beyondcorp-appconnectors/tests/unit/gapic/beyondcorp_appconnectors_v1/test_app_connectors_service.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 @@ -128,6 +129,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" @@ -1391,8 +1407,8 @@ def test_app_connectors_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - app_connectors_service.ListAppConnectorsRequest, - dict, + app_connectors_service.ListAppConnectorsRequest(), + {}, ], ) def test_list_app_connectors(request_type, transport: str = "grpc"): @@ -1403,7 +1419,7 @@ def test_list_app_connectors(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1456,12 +1472,13 @@ def test_list_app_connectors_non_empty_request_with_auto_populated_field(): client.list_app_connectors(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == app_connectors_service.ListAppConnectorsRequest( + request_msg = app_connectors_service.ListAppConnectorsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_app_connectors_use_cached_wrapped_rpc(): @@ -1546,10 +1563,14 @@ async def test_list_app_connectors_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_app_connectors_async( - transport: str = "grpc_asyncio", - request_type=app_connectors_service.ListAppConnectorsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + app_connectors_service.ListAppConnectorsRequest(), + {}, + ], +) +async def test_list_app_connectors_async(request_type, transport: str = "grpc_asyncio"): client = AppConnectorsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1557,7 +1578,7 @@ async def test_list_app_connectors_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( @@ -1584,11 +1605,6 @@ async def test_list_app_connectors_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_app_connectors_async_from_dict(): - await test_list_app_connectors_async(request_type=dict) - - def test_list_app_connectors_field_headers(): client = AppConnectorsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1943,8 +1959,8 @@ async def test_list_app_connectors_async_pages(): @pytest.mark.parametrize( "request_type", [ - app_connectors_service.GetAppConnectorRequest, - dict, + app_connectors_service.GetAppConnectorRequest(), + {}, ], ) def test_get_app_connector(request_type, transport: str = "grpc"): @@ -1955,7 +1971,7 @@ def test_get_app_connector(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,9 +2025,10 @@ def test_get_app_connector_non_empty_request_with_auto_populated_field(): client.get_app_connector(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == app_connectors_service.GetAppConnectorRequest( + request_msg = app_connectors_service.GetAppConnectorRequest( name="name_value", ) + assert args[0] == request_msg def test_get_app_connector_use_cached_wrapped_rpc(): @@ -2094,10 +2111,14 @@ async def test_get_app_connector_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_app_connector_async( - transport: str = "grpc_asyncio", - request_type=app_connectors_service.GetAppConnectorRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + app_connectors_service.GetAppConnectorRequest(), + {}, + ], +) +async def test_get_app_connector_async(request_type, transport: str = "grpc_asyncio"): client = AppConnectorsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2105,7 +2126,7 @@ async def test_get_app_connector_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( @@ -2136,11 +2157,6 @@ async def test_get_app_connector_async( assert response.state == app_connectors_service.AppConnector.State.CREATING -@pytest.mark.asyncio -async def test_get_app_connector_async_from_dict(): - await test_get_app_connector_async(request_type=dict) - - def test_get_app_connector_field_headers(): client = AppConnectorsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2295,8 +2311,8 @@ async def test_get_app_connector_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - app_connectors_service.CreateAppConnectorRequest, - dict, + app_connectors_service.CreateAppConnectorRequest(), + {}, ], ) def test_create_app_connector(request_type, transport: str = "grpc"): @@ -2307,7 +2323,7 @@ def test_create_app_connector(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2354,11 +2370,12 @@ def test_create_app_connector_non_empty_request_with_auto_populated_field(): client.create_app_connector(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == app_connectors_service.CreateAppConnectorRequest( + request_msg = app_connectors_service.CreateAppConnectorRequest( parent="parent_value", app_connector_id="app_connector_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_app_connector_use_cached_wrapped_rpc(): @@ -2453,9 +2470,15 @@ async def test_create_app_connector_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + app_connectors_service.CreateAppConnectorRequest(), + {}, + ], +) async def test_create_app_connector_async( - transport: str = "grpc_asyncio", - request_type=app_connectors_service.CreateAppConnectorRequest, + request_type, transport: str = "grpc_asyncio" ): client = AppConnectorsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2464,7 +2487,7 @@ async def test_create_app_connector_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( @@ -2486,11 +2509,6 @@ async def test_create_app_connector_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_app_connector_async_from_dict(): - await test_create_app_connector_async(request_type=dict) - - def test_create_app_connector_field_headers(): client = AppConnectorsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2665,8 +2683,8 @@ async def test_create_app_connector_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - app_connectors_service.UpdateAppConnectorRequest, - dict, + app_connectors_service.UpdateAppConnectorRequest(), + {}, ], ) def test_update_app_connector(request_type, transport: str = "grpc"): @@ -2677,7 +2695,7 @@ def test_update_app_connector(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2722,9 +2740,10 @@ def test_update_app_connector_non_empty_request_with_auto_populated_field(): client.update_app_connector(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == app_connectors_service.UpdateAppConnectorRequest( + request_msg = app_connectors_service.UpdateAppConnectorRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_app_connector_use_cached_wrapped_rpc(): @@ -2819,9 +2838,15 @@ async def test_update_app_connector_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + app_connectors_service.UpdateAppConnectorRequest(), + {}, + ], +) async def test_update_app_connector_async( - transport: str = "grpc_asyncio", - request_type=app_connectors_service.UpdateAppConnectorRequest, + request_type, transport: str = "grpc_asyncio" ): client = AppConnectorsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2830,7 +2855,7 @@ async def test_update_app_connector_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( @@ -2852,11 +2877,6 @@ async def test_update_app_connector_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_app_connector_async_from_dict(): - await test_update_app_connector_async(request_type=dict) - - def test_update_app_connector_field_headers(): client = AppConnectorsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3021,8 +3041,8 @@ async def test_update_app_connector_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - app_connectors_service.DeleteAppConnectorRequest, - dict, + app_connectors_service.DeleteAppConnectorRequest(), + {}, ], ) def test_delete_app_connector(request_type, transport: str = "grpc"): @@ -3033,7 +3053,7 @@ def test_delete_app_connector(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3079,10 +3099,11 @@ def test_delete_app_connector_non_empty_request_with_auto_populated_field(): client.delete_app_connector(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == app_connectors_service.DeleteAppConnectorRequest( + request_msg = app_connectors_service.DeleteAppConnectorRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_app_connector_use_cached_wrapped_rpc(): @@ -3177,9 +3198,15 @@ async def test_delete_app_connector_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + app_connectors_service.DeleteAppConnectorRequest(), + {}, + ], +) async def test_delete_app_connector_async( - transport: str = "grpc_asyncio", - request_type=app_connectors_service.DeleteAppConnectorRequest, + request_type, transport: str = "grpc_asyncio" ): client = AppConnectorsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3188,7 +3215,7 @@ async def test_delete_app_connector_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( @@ -3210,11 +3237,6 @@ async def test_delete_app_connector_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_app_connector_async_from_dict(): - await test_delete_app_connector_async(request_type=dict) - - def test_delete_app_connector_field_headers(): client = AppConnectorsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3369,8 +3391,8 @@ async def test_delete_app_connector_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - app_connectors_service.ReportStatusRequest, - dict, + app_connectors_service.ReportStatusRequest(), + {}, ], ) def test_report_status(request_type, transport: str = "grpc"): @@ -3381,7 +3403,7 @@ def test_report_status(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.report_status), "__call__") as call: @@ -3423,10 +3445,11 @@ def test_report_status_non_empty_request_with_auto_populated_field(): client.report_status(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == app_connectors_service.ReportStatusRequest( + request_msg = app_connectors_service.ReportStatusRequest( app_connector="app_connector_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_report_status_use_cached_wrapped_rpc(): @@ -3517,10 +3540,14 @@ async def test_report_status_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_report_status_async( - transport: str = "grpc_asyncio", - request_type=app_connectors_service.ReportStatusRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + app_connectors_service.ReportStatusRequest(), + {}, + ], +) +async def test_report_status_async(request_type, transport: str = "grpc_asyncio"): client = AppConnectorsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3528,7 +3555,7 @@ async def test_report_status_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.report_status), "__call__") as call: @@ -3548,11 +3575,6 @@ async def test_report_status_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_report_status_async_from_dict(): - await test_report_status_async(request_type=dict) - - def test_report_status_field_headers(): client = AppConnectorsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5081,7 +5103,6 @@ def test_list_app_connectors_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = app_connectors_service.ListAppConnectorsRequest() - assert args[0] == request_msg @@ -5104,7 +5125,6 @@ def test_get_app_connector_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = app_connectors_service.GetAppConnectorRequest() - assert args[0] == request_msg @@ -5127,7 +5147,6 @@ def test_create_app_connector_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = app_connectors_service.CreateAppConnectorRequest() - assert args[0] == request_msg @@ -5150,7 +5169,6 @@ def test_update_app_connector_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = app_connectors_service.UpdateAppConnectorRequest() - assert args[0] == request_msg @@ -5173,7 +5191,6 @@ def test_delete_app_connector_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = app_connectors_service.DeleteAppConnectorRequest() - assert args[0] == request_msg @@ -5194,7 +5211,6 @@ def test_report_status_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = app_connectors_service.ReportStatusRequest() - assert args[0] == request_msg @@ -5238,7 +5254,6 @@ async def test_list_app_connectors_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = app_connectors_service.ListAppConnectorsRequest() - assert args[0] == request_msg @@ -5270,7 +5285,6 @@ async def test_get_app_connector_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = app_connectors_service.GetAppConnectorRequest() - assert args[0] == request_msg @@ -5297,7 +5311,6 @@ async def test_create_app_connector_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = app_connectors_service.CreateAppConnectorRequest() - assert args[0] == request_msg @@ -5324,7 +5337,6 @@ async def test_update_app_connector_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = app_connectors_service.UpdateAppConnectorRequest() - assert args[0] == request_msg @@ -5351,7 +5363,6 @@ async def test_delete_app_connector_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = app_connectors_service.DeleteAppConnectorRequest() - assert args[0] == request_msg @@ -5376,7 +5387,6 @@ async def test_report_status_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = app_connectors_service.ReportStatusRequest() - assert args[0] == request_msg @@ -6958,7 +6968,6 @@ def test_list_app_connectors_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = app_connectors_service.ListAppConnectorsRequest() - assert args[0] == request_msg @@ -6980,7 +6989,6 @@ def test_get_app_connector_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = app_connectors_service.GetAppConnectorRequest() - assert args[0] == request_msg @@ -7002,7 +7010,6 @@ def test_create_app_connector_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = app_connectors_service.CreateAppConnectorRequest() - assert args[0] == request_msg @@ -7024,7 +7031,6 @@ def test_update_app_connector_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = app_connectors_service.UpdateAppConnectorRequest() - assert args[0] == request_msg @@ -7046,7 +7052,6 @@ def test_delete_app_connector_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = app_connectors_service.DeleteAppConnectorRequest() - assert args[0] == request_msg @@ -7066,7 +7071,6 @@ def test_report_status_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = app_connectors_service.ReportStatusRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-beyondcorp-appgateways/noxfile.py b/packages/google-cloud-beyondcorp-appgateways/noxfile.py index eab637c2bdd5..dd399e3a0da4 100644 --- a/packages/google-cloud-beyondcorp-appgateways/noxfile.py +++ b/packages/google-cloud-beyondcorp-appgateways/noxfile.py @@ -47,7 +47,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-beyondcorp-appgateways" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-beyondcorp-appgateways/setup.py b/packages/google-cloud-beyondcorp-appgateways/setup.py index 6d1f4620e6f0..3c11fb6f7788 100644 --- a/packages/google-cloud-beyondcorp-appgateways/setup.py +++ b/packages/google-cloud-beyondcorp-appgateways/setup.py @@ -45,7 +45,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/google-cloud-beyondcorp-appgateways/testing/constraints-3.10.txt b/packages/google-cloud-beyondcorp-appgateways/testing/constraints-3.10.txt index a92801e1c8e2..b39cd54634f9 100644 --- a/packages/google-cloud-beyondcorp-appgateways/testing/constraints-3.10.txt +++ b/packages/google-cloud-beyondcorp-appgateways/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/google-cloud-beyondcorp-appgateways/tests/unit/gapic/beyondcorp_appgateways_v1/test_app_gateways_service.py b/packages/google-cloud-beyondcorp-appgateways/tests/unit/gapic/beyondcorp_appgateways_v1/test_app_gateways_service.py index e95672f323fb..2e27d071262c 100644 --- a/packages/google-cloud-beyondcorp-appgateways/tests/unit/gapic/beyondcorp_appgateways_v1/test_app_gateways_service.py +++ b/packages/google-cloud-beyondcorp-appgateways/tests/unit/gapic/beyondcorp_appgateways_v1/test_app_gateways_service.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 @@ -120,6 +121,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" @@ -1365,8 +1381,8 @@ def test_app_gateways_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - app_gateways_service.ListAppGatewaysRequest, - dict, + app_gateways_service.ListAppGatewaysRequest(), + {}, ], ) def test_list_app_gateways(request_type, transport: str = "grpc"): @@ -1377,7 +1393,7 @@ def test_list_app_gateways(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1430,12 +1446,13 @@ def test_list_app_gateways_non_empty_request_with_auto_populated_field(): client.list_app_gateways(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == app_gateways_service.ListAppGatewaysRequest( + request_msg = app_gateways_service.ListAppGatewaysRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_app_gateways_use_cached_wrapped_rpc(): @@ -1518,10 +1535,14 @@ async def test_list_app_gateways_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_app_gateways_async( - transport: str = "grpc_asyncio", - request_type=app_gateways_service.ListAppGatewaysRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + app_gateways_service.ListAppGatewaysRequest(), + {}, + ], +) +async def test_list_app_gateways_async(request_type, transport: str = "grpc_asyncio"): client = AppGatewaysServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1529,7 +1550,7 @@ async def test_list_app_gateways_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( @@ -1556,11 +1577,6 @@ async def test_list_app_gateways_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_app_gateways_async_from_dict(): - await test_list_app_gateways_async(request_type=dict) - - def test_list_app_gateways_field_headers(): client = AppGatewaysServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1913,8 +1929,8 @@ async def test_list_app_gateways_async_pages(): @pytest.mark.parametrize( "request_type", [ - app_gateways_service.GetAppGatewayRequest, - dict, + app_gateways_service.GetAppGatewayRequest(), + {}, ], ) def test_get_app_gateway(request_type, transport: str = "grpc"): @@ -1925,7 +1941,7 @@ def test_get_app_gateway(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_app_gateway), "__call__") as call: @@ -1983,9 +1999,10 @@ def test_get_app_gateway_non_empty_request_with_auto_populated_field(): client.get_app_gateway(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == app_gateways_service.GetAppGatewayRequest( + request_msg = app_gateways_service.GetAppGatewayRequest( name="name_value", ) + assert args[0] == request_msg def test_get_app_gateway_use_cached_wrapped_rpc(): @@ -2066,10 +2083,14 @@ async def test_get_app_gateway_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_app_gateway_async( - transport: str = "grpc_asyncio", - request_type=app_gateways_service.GetAppGatewayRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + app_gateways_service.GetAppGatewayRequest(), + {}, + ], +) +async def test_get_app_gateway_async(request_type, transport: str = "grpc_asyncio"): client = AppGatewaysServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2077,7 +2098,7 @@ async def test_get_app_gateway_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_app_gateway), "__call__") as call: @@ -2114,11 +2135,6 @@ async def test_get_app_gateway_async( ) -@pytest.mark.asyncio -async def test_get_app_gateway_async_from_dict(): - await test_get_app_gateway_async(request_type=dict) - - def test_get_app_gateway_field_headers(): client = AppGatewaysServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2265,8 +2281,8 @@ async def test_get_app_gateway_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - app_gateways_service.CreateAppGatewayRequest, - dict, + app_gateways_service.CreateAppGatewayRequest(), + {}, ], ) def test_create_app_gateway(request_type, transport: str = "grpc"): @@ -2277,7 +2293,7 @@ def test_create_app_gateway(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2324,11 +2340,12 @@ def test_create_app_gateway_non_empty_request_with_auto_populated_field(): client.create_app_gateway(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == app_gateways_service.CreateAppGatewayRequest( + request_msg = app_gateways_service.CreateAppGatewayRequest( parent="parent_value", app_gateway_id="app_gateway_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_app_gateway_use_cached_wrapped_rpc(): @@ -2423,10 +2440,14 @@ async def test_create_app_gateway_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_app_gateway_async( - transport: str = "grpc_asyncio", - request_type=app_gateways_service.CreateAppGatewayRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + app_gateways_service.CreateAppGatewayRequest(), + {}, + ], +) +async def test_create_app_gateway_async(request_type, transport: str = "grpc_asyncio"): client = AppGatewaysServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2434,7 +2455,7 @@ async def test_create_app_gateway_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( @@ -2456,11 +2477,6 @@ async def test_create_app_gateway_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_app_gateway_async_from_dict(): - await test_create_app_gateway_async(request_type=dict) - - def test_create_app_gateway_field_headers(): client = AppGatewaysServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2635,8 +2651,8 @@ async def test_create_app_gateway_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - app_gateways_service.DeleteAppGatewayRequest, - dict, + app_gateways_service.DeleteAppGatewayRequest(), + {}, ], ) def test_delete_app_gateway(request_type, transport: str = "grpc"): @@ -2647,7 +2663,7 @@ def test_delete_app_gateway(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2693,10 +2709,11 @@ def test_delete_app_gateway_non_empty_request_with_auto_populated_field(): client.delete_app_gateway(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == app_gateways_service.DeleteAppGatewayRequest( + request_msg = app_gateways_service.DeleteAppGatewayRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_app_gateway_use_cached_wrapped_rpc(): @@ -2791,10 +2808,14 @@ async def test_delete_app_gateway_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_app_gateway_async( - transport: str = "grpc_asyncio", - request_type=app_gateways_service.DeleteAppGatewayRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + app_gateways_service.DeleteAppGatewayRequest(), + {}, + ], +) +async def test_delete_app_gateway_async(request_type, transport: str = "grpc_asyncio"): client = AppGatewaysServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2802,7 +2823,7 @@ async def test_delete_app_gateway_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( @@ -2824,11 +2845,6 @@ async def test_delete_app_gateway_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_app_gateway_async_from_dict(): - await test_delete_app_gateway_async(request_type=dict) - - def test_delete_app_gateway_field_headers(): client = AppGatewaysServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3953,7 +3969,6 @@ def test_list_app_gateways_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = app_gateways_service.ListAppGatewaysRequest() - assert args[0] == request_msg @@ -3974,7 +3989,6 @@ def test_get_app_gateway_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = app_gateways_service.GetAppGatewayRequest() - assert args[0] == request_msg @@ -3997,7 +4011,6 @@ def test_create_app_gateway_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = app_gateways_service.CreateAppGatewayRequest() - assert args[0] == request_msg @@ -4020,7 +4033,6 @@ def test_delete_app_gateway_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = app_gateways_service.DeleteAppGatewayRequest() - assert args[0] == request_msg @@ -4064,7 +4076,6 @@ async def test_list_app_gateways_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = app_gateways_service.ListAppGatewaysRequest() - assert args[0] == request_msg @@ -4097,7 +4108,6 @@ async def test_get_app_gateway_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = app_gateways_service.GetAppGatewayRequest() - assert args[0] == request_msg @@ -4124,7 +4134,6 @@ async def test_create_app_gateway_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = app_gateways_service.CreateAppGatewayRequest() - assert args[0] == request_msg @@ -4151,7 +4160,6 @@ async def test_delete_app_gateway_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = app_gateways_service.DeleteAppGatewayRequest() - assert args[0] == request_msg @@ -5376,7 +5384,6 @@ def test_list_app_gateways_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = app_gateways_service.ListAppGatewaysRequest() - assert args[0] == request_msg @@ -5396,7 +5403,6 @@ def test_get_app_gateway_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = app_gateways_service.GetAppGatewayRequest() - assert args[0] == request_msg @@ -5418,7 +5424,6 @@ def test_create_app_gateway_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = app_gateways_service.CreateAppGatewayRequest() - assert args[0] == request_msg @@ -5440,7 +5445,6 @@ def test_delete_app_gateway_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = app_gateways_service.DeleteAppGatewayRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-beyondcorp-clientconnectorservices/noxfile.py b/packages/google-cloud-beyondcorp-clientconnectorservices/noxfile.py index c64da4f30633..60ca6ca1fcb1 100644 --- a/packages/google-cloud-beyondcorp-clientconnectorservices/noxfile.py +++ b/packages/google-cloud-beyondcorp-clientconnectorservices/noxfile.py @@ -47,7 +47,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-beyondcorp-clientconnectorservices" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-beyondcorp-clientconnectorservices/setup.py b/packages/google-cloud-beyondcorp-clientconnectorservices/setup.py index 648b3c98fa9e..8a24bca5f233 100644 --- a/packages/google-cloud-beyondcorp-clientconnectorservices/setup.py +++ b/packages/google-cloud-beyondcorp-clientconnectorservices/setup.py @@ -47,7 +47,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/google-cloud-beyondcorp-clientconnectorservices/testing/constraints-3.10.txt b/packages/google-cloud-beyondcorp-clientconnectorservices/testing/constraints-3.10.txt index a92801e1c8e2..b39cd54634f9 100644 --- a/packages/google-cloud-beyondcorp-clientconnectorservices/testing/constraints-3.10.txt +++ b/packages/google-cloud-beyondcorp-clientconnectorservices/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/google-cloud-beyondcorp-clientconnectorservices/tests/unit/gapic/beyondcorp_clientconnectorservices_v1/test_client_connector_services_service.py b/packages/google-cloud-beyondcorp-clientconnectorservices/tests/unit/gapic/beyondcorp_clientconnectorservices_v1/test_client_connector_services_service.py index 1daa4a6a15c5..89d119e5c252 100644 --- a/packages/google-cloud-beyondcorp-clientconnectorservices/tests/unit/gapic/beyondcorp_clientconnectorservices_v1/test_client_connector_services_service.py +++ b/packages/google-cloud-beyondcorp-clientconnectorservices/tests/unit/gapic/beyondcorp_clientconnectorservices_v1/test_client_connector_services_service.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 @@ -123,6 +124,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" @@ -1451,8 +1467,8 @@ def test_client_connector_services_service_client_create_channel_credentials_fil @pytest.mark.parametrize( "request_type", [ - client_connector_services_service.ListClientConnectorServicesRequest, - dict, + client_connector_services_service.ListClientConnectorServicesRequest(), + {}, ], ) def test_list_client_connector_services(request_type, transport: str = "grpc"): @@ -1463,7 +1479,7 @@ def test_list_client_connector_services(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1518,14 +1534,15 @@ def test_list_client_connector_services_non_empty_request_with_auto_populated_fi client.list_client_connector_services(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == client_connector_services_service.ListClientConnectorServicesRequest( - parent="parent_value", - page_token="page_token_value", - filter="filter_value", - order_by="order_by_value", + request_msg = ( + client_connector_services_service.ListClientConnectorServicesRequest( + parent="parent_value", + page_token="page_token_value", + filter="filter_value", + order_by="order_by_value", + ) ) + assert args[0] == request_msg def test_list_client_connector_services_use_cached_wrapped_rpc(): @@ -1611,9 +1628,15 @@ async def test_list_client_connector_services_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + client_connector_services_service.ListClientConnectorServicesRequest(), + {}, + ], +) async def test_list_client_connector_services_async( - transport: str = "grpc_asyncio", - request_type=client_connector_services_service.ListClientConnectorServicesRequest, + request_type, transport: str = "grpc_asyncio" ): client = ClientConnectorServicesServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1622,7 +1645,7 @@ async def test_list_client_connector_services_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( @@ -1649,11 +1672,6 @@ async def test_list_client_connector_services_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_client_connector_services_async_from_dict(): - await test_list_client_connector_services_async(request_type=dict) - - def test_list_client_connector_services_field_headers(): client = ClientConnectorServicesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2022,8 +2040,8 @@ async def test_list_client_connector_services_async_pages(): @pytest.mark.parametrize( "request_type", [ - client_connector_services_service.GetClientConnectorServiceRequest, - dict, + client_connector_services_service.GetClientConnectorServiceRequest(), + {}, ], ) def test_get_client_connector_service(request_type, transport: str = "grpc"): @@ -2034,7 +2052,7 @@ def test_get_client_connector_service(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2091,11 +2109,12 @@ def test_get_client_connector_service_non_empty_request_with_auto_populated_fiel client.get_client_connector_service(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == client_connector_services_service.GetClientConnectorServiceRequest( - name="name_value", + request_msg = ( + client_connector_services_service.GetClientConnectorServiceRequest( + name="name_value", + ) ) + assert args[0] == request_msg def test_get_client_connector_service_use_cached_wrapped_rpc(): @@ -2181,9 +2200,15 @@ async def test_get_client_connector_service_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + client_connector_services_service.GetClientConnectorServiceRequest(), + {}, + ], +) async def test_get_client_connector_service_async( - transport: str = "grpc_asyncio", - request_type=client_connector_services_service.GetClientConnectorServiceRequest, + request_type, transport: str = "grpc_asyncio" ): client = ClientConnectorServicesServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2192,7 +2217,7 @@ async def test_get_client_connector_service_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( @@ -2226,11 +2251,6 @@ async def test_get_client_connector_service_async( ) -@pytest.mark.asyncio -async def test_get_client_connector_service_async_from_dict(): - await test_get_client_connector_service_async(request_type=dict) - - def test_get_client_connector_service_field_headers(): client = ClientConnectorServicesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2385,8 +2405,8 @@ async def test_get_client_connector_service_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - client_connector_services_service.CreateClientConnectorServiceRequest, - dict, + client_connector_services_service.CreateClientConnectorServiceRequest(), + {}, ], ) def test_create_client_connector_service(request_type, transport: str = "grpc"): @@ -2397,7 +2417,7 @@ def test_create_client_connector_service(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2446,13 +2466,14 @@ def test_create_client_connector_service_non_empty_request_with_auto_populated_f client.create_client_connector_service(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == client_connector_services_service.CreateClientConnectorServiceRequest( - parent="parent_value", - client_connector_service_id="client_connector_service_id_value", - request_id="request_id_value", + request_msg = ( + client_connector_services_service.CreateClientConnectorServiceRequest( + parent="parent_value", + client_connector_service_id="client_connector_service_id_value", + request_id="request_id_value", + ) ) + assert args[0] == request_msg def test_create_client_connector_service_use_cached_wrapped_rpc(): @@ -2548,9 +2569,15 @@ async def test_create_client_connector_service_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + client_connector_services_service.CreateClientConnectorServiceRequest(), + {}, + ], +) async def test_create_client_connector_service_async( - transport: str = "grpc_asyncio", - request_type=client_connector_services_service.CreateClientConnectorServiceRequest, + request_type, transport: str = "grpc_asyncio" ): client = ClientConnectorServicesServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2559,7 +2586,7 @@ async def test_create_client_connector_service_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( @@ -2583,11 +2610,6 @@ async def test_create_client_connector_service_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_client_connector_service_async_from_dict(): - await test_create_client_connector_service_async(request_type=dict) - - def test_create_client_connector_service_field_headers(): client = ClientConnectorServicesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2774,8 +2796,8 @@ async def test_create_client_connector_service_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - client_connector_services_service.UpdateClientConnectorServiceRequest, - dict, + client_connector_services_service.UpdateClientConnectorServiceRequest(), + {}, ], ) def test_update_client_connector_service(request_type, transport: str = "grpc"): @@ -2786,7 +2808,7 @@ def test_update_client_connector_service(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2833,11 +2855,12 @@ def test_update_client_connector_service_non_empty_request_with_auto_populated_f client.update_client_connector_service(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == client_connector_services_service.UpdateClientConnectorServiceRequest( - request_id="request_id_value", + request_msg = ( + client_connector_services_service.UpdateClientConnectorServiceRequest( + request_id="request_id_value", + ) ) + assert args[0] == request_msg def test_update_client_connector_service_use_cached_wrapped_rpc(): @@ -2933,9 +2956,15 @@ async def test_update_client_connector_service_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + client_connector_services_service.UpdateClientConnectorServiceRequest(), + {}, + ], +) async def test_update_client_connector_service_async( - transport: str = "grpc_asyncio", - request_type=client_connector_services_service.UpdateClientConnectorServiceRequest, + request_type, transport: str = "grpc_asyncio" ): client = ClientConnectorServicesServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2944,7 +2973,7 @@ async def test_update_client_connector_service_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( @@ -2968,11 +2997,6 @@ async def test_update_client_connector_service_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_client_connector_service_async_from_dict(): - await test_update_client_connector_service_async(request_type=dict) - - def test_update_client_connector_service_field_headers(): client = ClientConnectorServicesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3149,8 +3173,8 @@ async def test_update_client_connector_service_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - client_connector_services_service.DeleteClientConnectorServiceRequest, - dict, + client_connector_services_service.DeleteClientConnectorServiceRequest(), + {}, ], ) def test_delete_client_connector_service(request_type, transport: str = "grpc"): @@ -3161,7 +3185,7 @@ def test_delete_client_connector_service(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3209,12 +3233,13 @@ def test_delete_client_connector_service_non_empty_request_with_auto_populated_f client.delete_client_connector_service(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == client_connector_services_service.DeleteClientConnectorServiceRequest( - name="name_value", - request_id="request_id_value", + request_msg = ( + client_connector_services_service.DeleteClientConnectorServiceRequest( + name="name_value", + request_id="request_id_value", + ) ) + assert args[0] == request_msg def test_delete_client_connector_service_use_cached_wrapped_rpc(): @@ -3310,9 +3335,15 @@ async def test_delete_client_connector_service_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + client_connector_services_service.DeleteClientConnectorServiceRequest(), + {}, + ], +) async def test_delete_client_connector_service_async( - transport: str = "grpc_asyncio", - request_type=client_connector_services_service.DeleteClientConnectorServiceRequest, + request_type, transport: str = "grpc_asyncio" ): client = ClientConnectorServicesServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3321,7 +3352,7 @@ async def test_delete_client_connector_service_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( @@ -3345,11 +3376,6 @@ async def test_delete_client_connector_service_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_client_connector_service_async_from_dict(): - await test_delete_client_connector_service_async(request_type=dict) - - def test_delete_client_connector_service_field_headers(): client = ClientConnectorServicesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4734,7 +4760,6 @@ def test_list_client_connector_services_empty_call_grpc(): request_msg = ( client_connector_services_service.ListClientConnectorServicesRequest() ) - assert args[0] == request_msg @@ -4759,7 +4784,6 @@ def test_get_client_connector_service_empty_call_grpc(): request_msg = ( client_connector_services_service.GetClientConnectorServiceRequest() ) - assert args[0] == request_msg @@ -4784,7 +4808,6 @@ def test_create_client_connector_service_empty_call_grpc(): request_msg = ( client_connector_services_service.CreateClientConnectorServiceRequest() ) - assert args[0] == request_msg @@ -4809,7 +4832,6 @@ def test_update_client_connector_service_empty_call_grpc(): request_msg = ( client_connector_services_service.UpdateClientConnectorServiceRequest() ) - assert args[0] == request_msg @@ -4834,7 +4856,6 @@ def test_delete_client_connector_service_empty_call_grpc(): request_msg = ( client_connector_services_service.DeleteClientConnectorServiceRequest() ) - assert args[0] == request_msg @@ -4880,7 +4901,6 @@ async def test_list_client_connector_services_empty_call_grpc_asyncio(): request_msg = ( client_connector_services_service.ListClientConnectorServicesRequest() ) - assert args[0] == request_msg @@ -4913,7 +4933,6 @@ async def test_get_client_connector_service_empty_call_grpc_asyncio(): request_msg = ( client_connector_services_service.GetClientConnectorServiceRequest() ) - assert args[0] == request_msg @@ -4942,7 +4961,6 @@ async def test_create_client_connector_service_empty_call_grpc_asyncio(): request_msg = ( client_connector_services_service.CreateClientConnectorServiceRequest() ) - assert args[0] == request_msg @@ -4971,7 +4989,6 @@ async def test_update_client_connector_service_empty_call_grpc_asyncio(): request_msg = ( client_connector_services_service.UpdateClientConnectorServiceRequest() ) - assert args[0] == request_msg @@ -5000,7 +5017,6 @@ async def test_delete_client_connector_service_empty_call_grpc_asyncio(): request_msg = ( client_connector_services_service.DeleteClientConnectorServiceRequest() ) - assert args[0] == request_msg @@ -6497,7 +6513,6 @@ def test_list_client_connector_services_empty_call_rest(): request_msg = ( client_connector_services_service.ListClientConnectorServicesRequest() ) - assert args[0] == request_msg @@ -6521,7 +6536,6 @@ def test_get_client_connector_service_empty_call_rest(): request_msg = ( client_connector_services_service.GetClientConnectorServiceRequest() ) - assert args[0] == request_msg @@ -6545,7 +6559,6 @@ def test_create_client_connector_service_empty_call_rest(): request_msg = ( client_connector_services_service.CreateClientConnectorServiceRequest() ) - assert args[0] == request_msg @@ -6569,7 +6582,6 @@ def test_update_client_connector_service_empty_call_rest(): request_msg = ( client_connector_services_service.UpdateClientConnectorServiceRequest() ) - assert args[0] == request_msg @@ -6593,7 +6605,6 @@ def test_delete_client_connector_service_empty_call_rest(): request_msg = ( client_connector_services_service.DeleteClientConnectorServiceRequest() ) - assert args[0] == request_msg diff --git a/packages/google-cloud-beyondcorp-clientgateways/noxfile.py b/packages/google-cloud-beyondcorp-clientgateways/noxfile.py index be1a5ad5314d..b97d73b7ebe9 100644 --- a/packages/google-cloud-beyondcorp-clientgateways/noxfile.py +++ b/packages/google-cloud-beyondcorp-clientgateways/noxfile.py @@ -47,7 +47,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-beyondcorp-clientgateways" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-beyondcorp-clientgateways/setup.py b/packages/google-cloud-beyondcorp-clientgateways/setup.py index 4841ae3047e7..29b091e58ee1 100644 --- a/packages/google-cloud-beyondcorp-clientgateways/setup.py +++ b/packages/google-cloud-beyondcorp-clientgateways/setup.py @@ -47,7 +47,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/google-cloud-beyondcorp-clientgateways/testing/constraints-3.10.txt b/packages/google-cloud-beyondcorp-clientgateways/testing/constraints-3.10.txt index a92801e1c8e2..b39cd54634f9 100644 --- a/packages/google-cloud-beyondcorp-clientgateways/testing/constraints-3.10.txt +++ b/packages/google-cloud-beyondcorp-clientgateways/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/google-cloud-beyondcorp-clientgateways/tests/unit/gapic/beyondcorp_clientgateways_v1/test_client_gateways_service.py b/packages/google-cloud-beyondcorp-clientgateways/tests/unit/gapic/beyondcorp_clientgateways_v1/test_client_gateways_service.py index ba77f8962d21..e341c3b08e0e 100644 --- a/packages/google-cloud-beyondcorp-clientgateways/tests/unit/gapic/beyondcorp_clientgateways_v1/test_client_gateways_service.py +++ b/packages/google-cloud-beyondcorp-clientgateways/tests/unit/gapic/beyondcorp_clientgateways_v1/test_client_gateways_service.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 @@ -120,6 +121,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" @@ -1385,8 +1401,8 @@ def test_client_gateways_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - client_gateways_service.ListClientGatewaysRequest, - dict, + client_gateways_service.ListClientGatewaysRequest(), + {}, ], ) def test_list_client_gateways(request_type, transport: str = "grpc"): @@ -1397,7 +1413,7 @@ def test_list_client_gateways(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1450,12 +1466,13 @@ def test_list_client_gateways_non_empty_request_with_auto_populated_field(): client.list_client_gateways(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == client_gateways_service.ListClientGatewaysRequest( + request_msg = client_gateways_service.ListClientGatewaysRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_client_gateways_use_cached_wrapped_rpc(): @@ -1540,9 +1557,15 @@ async def test_list_client_gateways_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + client_gateways_service.ListClientGatewaysRequest(), + {}, + ], +) async def test_list_client_gateways_async( - transport: str = "grpc_asyncio", - request_type=client_gateways_service.ListClientGatewaysRequest, + request_type, transport: str = "grpc_asyncio" ): client = ClientGatewaysServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1551,7 +1574,7 @@ async def test_list_client_gateways_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( @@ -1578,11 +1601,6 @@ async def test_list_client_gateways_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_client_gateways_async_from_dict(): - await test_list_client_gateways_async(request_type=dict) - - def test_list_client_gateways_field_headers(): client = ClientGatewaysServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1939,8 +1957,8 @@ async def test_list_client_gateways_async_pages(): @pytest.mark.parametrize( "request_type", [ - client_gateways_service.GetClientGatewayRequest, - dict, + client_gateways_service.GetClientGatewayRequest(), + {}, ], ) def test_get_client_gateway(request_type, transport: str = "grpc"): @@ -1951,7 +1969,7 @@ def test_get_client_gateway(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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 +2023,10 @@ def test_get_client_gateway_non_empty_request_with_auto_populated_field(): client.get_client_gateway(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == client_gateways_service.GetClientGatewayRequest( + request_msg = client_gateways_service.GetClientGatewayRequest( name="name_value", ) + assert args[0] == request_msg def test_get_client_gateway_use_cached_wrapped_rpc(): @@ -2092,10 +2111,14 @@ async def test_get_client_gateway_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_client_gateway_async( - transport: str = "grpc_asyncio", - request_type=client_gateways_service.GetClientGatewayRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + client_gateways_service.GetClientGatewayRequest(), + {}, + ], +) +async def test_get_client_gateway_async(request_type, transport: str = "grpc_asyncio"): client = ClientGatewaysServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2103,7 +2126,7 @@ async def test_get_client_gateway_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( @@ -2134,11 +2157,6 @@ async def test_get_client_gateway_async( assert response.client_connector_service == "client_connector_service_value" -@pytest.mark.asyncio -async def test_get_client_gateway_async_from_dict(): - await test_get_client_gateway_async(request_type=dict) - - def test_get_client_gateway_field_headers(): client = ClientGatewaysServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2293,8 +2311,8 @@ async def test_get_client_gateway_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - client_gateways_service.CreateClientGatewayRequest, - dict, + client_gateways_service.CreateClientGatewayRequest(), + {}, ], ) def test_create_client_gateway(request_type, transport: str = "grpc"): @@ -2305,7 +2323,7 @@ def test_create_client_gateway(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2352,11 +2370,12 @@ def test_create_client_gateway_non_empty_request_with_auto_populated_field(): client.create_client_gateway(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == client_gateways_service.CreateClientGatewayRequest( + request_msg = client_gateways_service.CreateClientGatewayRequest( parent="parent_value", client_gateway_id="client_gateway_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_client_gateway_use_cached_wrapped_rpc(): @@ -2452,9 +2471,15 @@ async def test_create_client_gateway_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + client_gateways_service.CreateClientGatewayRequest(), + {}, + ], +) async def test_create_client_gateway_async( - transport: str = "grpc_asyncio", - request_type=client_gateways_service.CreateClientGatewayRequest, + request_type, transport: str = "grpc_asyncio" ): client = ClientGatewaysServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2463,7 +2488,7 @@ async def test_create_client_gateway_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( @@ -2485,11 +2510,6 @@ async def test_create_client_gateway_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_client_gateway_async_from_dict(): - await test_create_client_gateway_async(request_type=dict) - - def test_create_client_gateway_field_headers(): client = ClientGatewaysServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2664,8 +2684,8 @@ async def test_create_client_gateway_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - client_gateways_service.DeleteClientGatewayRequest, - dict, + client_gateways_service.DeleteClientGatewayRequest(), + {}, ], ) def test_delete_client_gateway(request_type, transport: str = "grpc"): @@ -2676,7 +2696,7 @@ def test_delete_client_gateway(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2722,10 +2742,11 @@ def test_delete_client_gateway_non_empty_request_with_auto_populated_field(): client.delete_client_gateway(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == client_gateways_service.DeleteClientGatewayRequest( + request_msg = client_gateways_service.DeleteClientGatewayRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_client_gateway_use_cached_wrapped_rpc(): @@ -2821,9 +2842,15 @@ async def test_delete_client_gateway_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + client_gateways_service.DeleteClientGatewayRequest(), + {}, + ], +) async def test_delete_client_gateway_async( - transport: str = "grpc_asyncio", - request_type=client_gateways_service.DeleteClientGatewayRequest, + request_type, transport: str = "grpc_asyncio" ): client = ClientGatewaysServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2832,7 +2859,7 @@ async def test_delete_client_gateway_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( @@ -2854,11 +2881,6 @@ async def test_delete_client_gateway_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_client_gateway_async_from_dict(): - await test_delete_client_gateway_async(request_type=dict) - - def test_delete_client_gateway_field_headers(): client = ClientGatewaysServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3998,7 +4020,6 @@ def test_list_client_gateways_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = client_gateways_service.ListClientGatewaysRequest() - assert args[0] == request_msg @@ -4021,7 +4042,6 @@ def test_get_client_gateway_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = client_gateways_service.GetClientGatewayRequest() - assert args[0] == request_msg @@ -4044,7 +4064,6 @@ def test_create_client_gateway_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = client_gateways_service.CreateClientGatewayRequest() - assert args[0] == request_msg @@ -4067,7 +4086,6 @@ def test_delete_client_gateway_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = client_gateways_service.DeleteClientGatewayRequest() - assert args[0] == request_msg @@ -4111,7 +4129,6 @@ async def test_list_client_gateways_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = client_gateways_service.ListClientGatewaysRequest() - assert args[0] == request_msg @@ -4143,7 +4160,6 @@ async def test_get_client_gateway_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = client_gateways_service.GetClientGatewayRequest() - assert args[0] == request_msg @@ -4170,7 +4186,6 @@ async def test_create_client_gateway_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = client_gateways_service.CreateClientGatewayRequest() - assert args[0] == request_msg @@ -4197,7 +4212,6 @@ async def test_delete_client_gateway_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = client_gateways_service.DeleteClientGatewayRequest() - assert args[0] == request_msg @@ -5418,7 +5432,6 @@ def test_list_client_gateways_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = client_gateways_service.ListClientGatewaysRequest() - assert args[0] == request_msg @@ -5440,7 +5453,6 @@ def test_get_client_gateway_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = client_gateways_service.GetClientGatewayRequest() - assert args[0] == request_msg @@ -5462,7 +5474,6 @@ def test_create_client_gateway_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = client_gateways_service.CreateClientGatewayRequest() - assert args[0] == request_msg @@ -5484,7 +5495,6 @@ def test_delete_client_gateway_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = client_gateways_service.DeleteClientGatewayRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-biglake-hive/noxfile.py b/packages/google-cloud-biglake-hive/noxfile.py index c55747386973..77c7118d3dfd 100644 --- a/packages/google-cloud-biglake-hive/noxfile.py +++ b/packages/google-cloud-biglake-hive/noxfile.py @@ -47,7 +47,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-biglake-hive" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-biglake-hive/setup.py b/packages/google-cloud-biglake-hive/setup.py index ca03ba314851..552430cb475c 100644 --- a/packages/google-cloud-biglake-hive/setup.py +++ b/packages/google-cloud-biglake-hive/setup.py @@ -45,7 +45,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/google-cloud-biglake-hive/testing/constraints-3.10.txt b/packages/google-cloud-biglake-hive/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-biglake-hive/testing/constraints-3.10.txt +++ b/packages/google-cloud-biglake-hive/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-biglake-hive/tests/unit/gapic/biglake_hive_v1beta/test_hive_metastore_service.py b/packages/google-cloud-biglake-hive/tests/unit/gapic/biglake_hive_v1beta/test_hive_metastore_service.py index 26670c831b18..90081caf667f 100644 --- a/packages/google-cloud-biglake-hive/tests/unit/gapic/biglake_hive_v1beta/test_hive_metastore_service.py +++ b/packages/google-cloud-biglake-hive/tests/unit/gapic/biglake_hive_v1beta/test_hive_metastore_service.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 @@ -109,6 +110,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" @@ -1375,8 +1391,8 @@ def test_hive_metastore_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - hive_metastore.CreateHiveCatalogRequest, - dict, + hive_metastore.CreateHiveCatalogRequest(), + {}, ], ) def test_create_hive_catalog(request_type, transport: str = "grpc"): @@ -1387,7 +1403,7 @@ def test_create_hive_catalog(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1441,11 +1457,12 @@ def test_create_hive_catalog_non_empty_request_with_auto_populated_field(): client.create_hive_catalog(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hive_metastore.CreateHiveCatalogRequest( + request_msg = hive_metastore.CreateHiveCatalogRequest( parent="parent_value", hive_catalog_id="hive_catalog_id_value", primary_location="primary_location_value", ) + assert args[0] == request_msg def test_create_hive_catalog_use_cached_wrapped_rpc(): @@ -1530,10 +1547,14 @@ async def test_create_hive_catalog_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_hive_catalog_async( - transport: str = "grpc_asyncio", - request_type=hive_metastore.CreateHiveCatalogRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + hive_metastore.CreateHiveCatalogRequest(), + {}, + ], +) +async def test_create_hive_catalog_async(request_type, transport: str = "grpc_asyncio"): client = HiveMetastoreServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1541,7 +1562,7 @@ async def test_create_hive_catalog_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( @@ -1570,11 +1591,6 @@ async def test_create_hive_catalog_async( assert response.location_uri == "location_uri_value" -@pytest.mark.asyncio -async def test_create_hive_catalog_async_from_dict(): - await test_create_hive_catalog_async(request_type=dict) - - def test_create_hive_catalog_field_headers(): client = HiveMetastoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1749,8 +1765,8 @@ async def test_create_hive_catalog_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - hive_metastore.GetHiveCatalogRequest, - dict, + hive_metastore.GetHiveCatalogRequest(), + {}, ], ) def test_get_hive_catalog(request_type, transport: str = "grpc"): @@ -1761,7 +1777,7 @@ def test_get_hive_catalog(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_hive_catalog), "__call__") as call: @@ -1809,9 +1825,10 @@ def test_get_hive_catalog_non_empty_request_with_auto_populated_field(): client.get_hive_catalog(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hive_metastore.GetHiveCatalogRequest( + request_msg = hive_metastore.GetHiveCatalogRequest( name="name_value", ) + assert args[0] == request_msg def test_get_hive_catalog_use_cached_wrapped_rpc(): @@ -1894,9 +1911,14 @@ async def test_get_hive_catalog_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_hive_catalog_async( - transport: str = "grpc_asyncio", request_type=hive_metastore.GetHiveCatalogRequest -): +@pytest.mark.parametrize( + "request_type", + [ + hive_metastore.GetHiveCatalogRequest(), + {}, + ], +) +async def test_get_hive_catalog_async(request_type, transport: str = "grpc_asyncio"): client = HiveMetastoreServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1904,7 +1926,7 @@ async def test_get_hive_catalog_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_hive_catalog), "__call__") as call: @@ -1931,11 +1953,6 @@ async def test_get_hive_catalog_async( assert response.location_uri == "location_uri_value" -@pytest.mark.asyncio -async def test_get_hive_catalog_async_from_dict(): - await test_get_hive_catalog_async(request_type=dict) - - def test_get_hive_catalog_field_headers(): client = HiveMetastoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2082,8 +2099,8 @@ async def test_get_hive_catalog_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - hive_metastore.ListHiveCatalogsRequest, - dict, + hive_metastore.ListHiveCatalogsRequest(), + {}, ], ) def test_list_hive_catalogs(request_type, transport: str = "grpc"): @@ -2094,7 +2111,7 @@ def test_list_hive_catalogs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2145,10 +2162,11 @@ def test_list_hive_catalogs_non_empty_request_with_auto_populated_field(): client.list_hive_catalogs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hive_metastore.ListHiveCatalogsRequest( + request_msg = hive_metastore.ListHiveCatalogsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_hive_catalogs_use_cached_wrapped_rpc(): @@ -2233,9 +2251,14 @@ async def test_list_hive_catalogs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_hive_catalogs_async( - transport: str = "grpc_asyncio", request_type=hive_metastore.ListHiveCatalogsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + hive_metastore.ListHiveCatalogsRequest(), + {}, + ], +) +async def test_list_hive_catalogs_async(request_type, transport: str = "grpc_asyncio"): client = HiveMetastoreServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2243,7 +2266,7 @@ async def test_list_hive_catalogs_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( @@ -2270,11 +2293,6 @@ async def test_list_hive_catalogs_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_hive_catalogs_async_from_dict(): - await test_list_hive_catalogs_async(request_type=dict) - - def test_list_hive_catalogs_field_headers(): client = HiveMetastoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2627,8 +2645,8 @@ async def test_list_hive_catalogs_async_pages(): @pytest.mark.parametrize( "request_type", [ - hive_metastore.UpdateHiveCatalogRequest, - dict, + hive_metastore.UpdateHiveCatalogRequest(), + {}, ], ) def test_update_hive_catalog(request_type, transport: str = "grpc"): @@ -2639,7 +2657,7 @@ def test_update_hive_catalog(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2689,7 +2707,8 @@ def test_update_hive_catalog_non_empty_request_with_auto_populated_field(): client.update_hive_catalog(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hive_metastore.UpdateHiveCatalogRequest() + request_msg = hive_metastore.UpdateHiveCatalogRequest() + assert args[0] == request_msg def test_update_hive_catalog_use_cached_wrapped_rpc(): @@ -2774,10 +2793,14 @@ async def test_update_hive_catalog_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_hive_catalog_async( - transport: str = "grpc_asyncio", - request_type=hive_metastore.UpdateHiveCatalogRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + hive_metastore.UpdateHiveCatalogRequest(), + {}, + ], +) +async def test_update_hive_catalog_async(request_type, transport: str = "grpc_asyncio"): client = HiveMetastoreServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2785,7 +2808,7 @@ async def test_update_hive_catalog_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( @@ -2814,11 +2837,6 @@ async def test_update_hive_catalog_async( assert response.location_uri == "location_uri_value" -@pytest.mark.asyncio -async def test_update_hive_catalog_async_from_dict(): - await test_update_hive_catalog_async(request_type=dict) - - def test_update_hive_catalog_field_headers(): client = HiveMetastoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2983,8 +3001,8 @@ async def test_update_hive_catalog_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - hive_metastore.DeleteHiveCatalogRequest, - dict, + hive_metastore.DeleteHiveCatalogRequest(), + {}, ], ) def test_delete_hive_catalog(request_type, transport: str = "grpc"): @@ -2995,7 +3013,7 @@ def test_delete_hive_catalog(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3040,9 +3058,10 @@ def test_delete_hive_catalog_non_empty_request_with_auto_populated_field(): client.delete_hive_catalog(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hive_metastore.DeleteHiveCatalogRequest( + request_msg = hive_metastore.DeleteHiveCatalogRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_hive_catalog_use_cached_wrapped_rpc(): @@ -3127,10 +3146,14 @@ async def test_delete_hive_catalog_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_hive_catalog_async( - transport: str = "grpc_asyncio", - request_type=hive_metastore.DeleteHiveCatalogRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + hive_metastore.DeleteHiveCatalogRequest(), + {}, + ], +) +async def test_delete_hive_catalog_async(request_type, transport: str = "grpc_asyncio"): client = HiveMetastoreServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3138,7 +3161,7 @@ async def test_delete_hive_catalog_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( @@ -3158,11 +3181,6 @@ async def test_delete_hive_catalog_async( assert response is None -@pytest.mark.asyncio -async def test_delete_hive_catalog_async_from_dict(): - await test_delete_hive_catalog_async(request_type=dict) - - def test_delete_hive_catalog_field_headers(): client = HiveMetastoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3313,8 +3331,8 @@ async def test_delete_hive_catalog_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - hive_metastore.CreateHiveDatabaseRequest, - dict, + hive_metastore.CreateHiveDatabaseRequest(), + {}, ], ) def test_create_hive_database(request_type, transport: str = "grpc"): @@ -3325,7 +3343,7 @@ def test_create_hive_database(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3378,10 +3396,11 @@ def test_create_hive_database_non_empty_request_with_auto_populated_field(): client.create_hive_database(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hive_metastore.CreateHiveDatabaseRequest( + request_msg = hive_metastore.CreateHiveDatabaseRequest( parent="parent_value", hive_database_id="hive_database_id_value", ) + assert args[0] == request_msg def test_create_hive_database_use_cached_wrapped_rpc(): @@ -3466,9 +3485,15 @@ async def test_create_hive_database_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + hive_metastore.CreateHiveDatabaseRequest(), + {}, + ], +) async def test_create_hive_database_async( - transport: str = "grpc_asyncio", - request_type=hive_metastore.CreateHiveDatabaseRequest, + request_type, transport: str = "grpc_asyncio" ): client = HiveMetastoreServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3477,7 +3502,7 @@ async def test_create_hive_database_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( @@ -3506,11 +3531,6 @@ async def test_create_hive_database_async( assert response.location_uri == "location_uri_value" -@pytest.mark.asyncio -async def test_create_hive_database_async_from_dict(): - await test_create_hive_database_async(request_type=dict) - - def test_create_hive_database_field_headers(): client = HiveMetastoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3685,8 +3705,8 @@ async def test_create_hive_database_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - hive_metastore.GetHiveDatabaseRequest, - dict, + hive_metastore.GetHiveDatabaseRequest(), + {}, ], ) def test_get_hive_database(request_type, transport: str = "grpc"): @@ -3697,7 +3717,7 @@ def test_get_hive_database(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3749,9 +3769,10 @@ def test_get_hive_database_non_empty_request_with_auto_populated_field(): client.get_hive_database(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hive_metastore.GetHiveDatabaseRequest( + request_msg = hive_metastore.GetHiveDatabaseRequest( name="name_value", ) + assert args[0] == request_msg def test_get_hive_database_use_cached_wrapped_rpc(): @@ -3834,9 +3855,14 @@ async def test_get_hive_database_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_hive_database_async( - transport: str = "grpc_asyncio", request_type=hive_metastore.GetHiveDatabaseRequest -): +@pytest.mark.parametrize( + "request_type", + [ + hive_metastore.GetHiveDatabaseRequest(), + {}, + ], +) +async def test_get_hive_database_async(request_type, transport: str = "grpc_asyncio"): client = HiveMetastoreServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3844,7 +3870,7 @@ async def test_get_hive_database_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( @@ -3873,11 +3899,6 @@ async def test_get_hive_database_async( assert response.location_uri == "location_uri_value" -@pytest.mark.asyncio -async def test_get_hive_database_async_from_dict(): - await test_get_hive_database_async(request_type=dict) - - def test_get_hive_database_field_headers(): client = HiveMetastoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4032,8 +4053,8 @@ async def test_get_hive_database_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - hive_metastore.ListHiveDatabasesRequest, - dict, + hive_metastore.ListHiveDatabasesRequest(), + {}, ], ) def test_list_hive_databases(request_type, transport: str = "grpc"): @@ -4044,7 +4065,7 @@ def test_list_hive_databases(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4093,10 +4114,11 @@ def test_list_hive_databases_non_empty_request_with_auto_populated_field(): client.list_hive_databases(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hive_metastore.ListHiveDatabasesRequest( + request_msg = hive_metastore.ListHiveDatabasesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_hive_databases_use_cached_wrapped_rpc(): @@ -4181,10 +4203,14 @@ async def test_list_hive_databases_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_hive_databases_async( - transport: str = "grpc_asyncio", - request_type=hive_metastore.ListHiveDatabasesRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + hive_metastore.ListHiveDatabasesRequest(), + {}, + ], +) +async def test_list_hive_databases_async(request_type, transport: str = "grpc_asyncio"): client = HiveMetastoreServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4192,7 +4218,7 @@ async def test_list_hive_databases_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( @@ -4217,11 +4243,6 @@ async def test_list_hive_databases_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_hive_databases_async_from_dict(): - await test_list_hive_databases_async(request_type=dict) - - def test_list_hive_databases_field_headers(): client = HiveMetastoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4574,8 +4595,8 @@ async def test_list_hive_databases_async_pages(): @pytest.mark.parametrize( "request_type", [ - hive_metastore.UpdateHiveDatabaseRequest, - dict, + hive_metastore.UpdateHiveDatabaseRequest(), + {}, ], ) def test_update_hive_database(request_type, transport: str = "grpc"): @@ -4586,7 +4607,7 @@ def test_update_hive_database(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,7 +4657,8 @@ def test_update_hive_database_non_empty_request_with_auto_populated_field(): client.update_hive_database(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hive_metastore.UpdateHiveDatabaseRequest() + request_msg = hive_metastore.UpdateHiveDatabaseRequest() + assert args[0] == request_msg def test_update_hive_database_use_cached_wrapped_rpc(): @@ -4721,9 +4743,15 @@ async def test_update_hive_database_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + hive_metastore.UpdateHiveDatabaseRequest(), + {}, + ], +) async def test_update_hive_database_async( - transport: str = "grpc_asyncio", - request_type=hive_metastore.UpdateHiveDatabaseRequest, + request_type, transport: str = "grpc_asyncio" ): client = HiveMetastoreServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4732,7 +4760,7 @@ async def test_update_hive_database_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( @@ -4761,11 +4789,6 @@ async def test_update_hive_database_async( assert response.location_uri == "location_uri_value" -@pytest.mark.asyncio -async def test_update_hive_database_async_from_dict(): - await test_update_hive_database_async(request_type=dict) - - def test_update_hive_database_field_headers(): client = HiveMetastoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4930,8 +4953,8 @@ async def test_update_hive_database_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - hive_metastore.DeleteHiveDatabaseRequest, - dict, + hive_metastore.DeleteHiveDatabaseRequest(), + {}, ], ) def test_delete_hive_database(request_type, transport: str = "grpc"): @@ -4942,7 +4965,7 @@ def test_delete_hive_database(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4987,9 +5010,10 @@ def test_delete_hive_database_non_empty_request_with_auto_populated_field(): client.delete_hive_database(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hive_metastore.DeleteHiveDatabaseRequest( + request_msg = hive_metastore.DeleteHiveDatabaseRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_hive_database_use_cached_wrapped_rpc(): @@ -5074,9 +5098,15 @@ async def test_delete_hive_database_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + hive_metastore.DeleteHiveDatabaseRequest(), + {}, + ], +) async def test_delete_hive_database_async( - transport: str = "grpc_asyncio", - request_type=hive_metastore.DeleteHiveDatabaseRequest, + request_type, transport: str = "grpc_asyncio" ): client = HiveMetastoreServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5085,7 +5115,7 @@ async def test_delete_hive_database_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( @@ -5105,11 +5135,6 @@ async def test_delete_hive_database_async( assert response is None -@pytest.mark.asyncio -async def test_delete_hive_database_async_from_dict(): - await test_delete_hive_database_async(request_type=dict) - - def test_delete_hive_database_field_headers(): client = HiveMetastoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5260,8 +5285,8 @@ async def test_delete_hive_database_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - hive_metastore.CreateHiveTableRequest, - dict, + hive_metastore.CreateHiveTableRequest(), + {}, ], ) def test_create_hive_table(request_type, transport: str = "grpc"): @@ -5272,7 +5297,7 @@ def test_create_hive_table(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5325,10 +5350,11 @@ def test_create_hive_table_non_empty_request_with_auto_populated_field(): client.create_hive_table(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hive_metastore.CreateHiveTableRequest( + request_msg = hive_metastore.CreateHiveTableRequest( parent="parent_value", hive_table_id="hive_table_id_value", ) + assert args[0] == request_msg def test_create_hive_table_use_cached_wrapped_rpc(): @@ -5411,9 +5437,14 @@ async def test_create_hive_table_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_hive_table_async( - transport: str = "grpc_asyncio", request_type=hive_metastore.CreateHiveTableRequest -): +@pytest.mark.parametrize( + "request_type", + [ + hive_metastore.CreateHiveTableRequest(), + {}, + ], +) +async def test_create_hive_table_async(request_type, transport: str = "grpc_asyncio"): client = HiveMetastoreServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5421,7 +5452,7 @@ async def test_create_hive_table_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( @@ -5450,11 +5481,6 @@ async def test_create_hive_table_async( assert response.table_type == "table_type_value" -@pytest.mark.asyncio -async def test_create_hive_table_async_from_dict(): - await test_create_hive_table_async(request_type=dict) - - def test_create_hive_table_field_headers(): client = HiveMetastoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5629,8 +5655,8 @@ async def test_create_hive_table_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - hive_metastore.GetHiveTableRequest, - dict, + hive_metastore.GetHiveTableRequest(), + {}, ], ) def test_get_hive_table(request_type, transport: str = "grpc"): @@ -5641,7 +5667,7 @@ def test_get_hive_table(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_hive_table), "__call__") as call: @@ -5689,9 +5715,10 @@ def test_get_hive_table_non_empty_request_with_auto_populated_field(): client.get_hive_table(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hive_metastore.GetHiveTableRequest( + request_msg = hive_metastore.GetHiveTableRequest( name="name_value", ) + assert args[0] == request_msg def test_get_hive_table_use_cached_wrapped_rpc(): @@ -5772,9 +5799,14 @@ async def test_get_hive_table_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_hive_table_async( - transport: str = "grpc_asyncio", request_type=hive_metastore.GetHiveTableRequest -): +@pytest.mark.parametrize( + "request_type", + [ + hive_metastore.GetHiveTableRequest(), + {}, + ], +) +async def test_get_hive_table_async(request_type, transport: str = "grpc_asyncio"): client = HiveMetastoreServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5782,7 +5814,7 @@ async def test_get_hive_table_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_hive_table), "__call__") as call: @@ -5809,11 +5841,6 @@ async def test_get_hive_table_async( assert response.table_type == "table_type_value" -@pytest.mark.asyncio -async def test_get_hive_table_async_from_dict(): - await test_get_hive_table_async(request_type=dict) - - def test_get_hive_table_field_headers(): client = HiveMetastoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5960,8 +5987,8 @@ async def test_get_hive_table_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - hive_metastore.ListHiveTablesRequest, - dict, + hive_metastore.ListHiveTablesRequest(), + {}, ], ) def test_list_hive_tables(request_type, transport: str = "grpc"): @@ -5972,7 +5999,7 @@ def test_list_hive_tables(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_hive_tables), "__call__") as call: @@ -6017,10 +6044,11 @@ def test_list_hive_tables_non_empty_request_with_auto_populated_field(): client.list_hive_tables(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hive_metastore.ListHiveTablesRequest( + request_msg = hive_metastore.ListHiveTablesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_hive_tables_use_cached_wrapped_rpc(): @@ -6103,9 +6131,14 @@ async def test_list_hive_tables_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_hive_tables_async( - transport: str = "grpc_asyncio", request_type=hive_metastore.ListHiveTablesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + hive_metastore.ListHiveTablesRequest(), + {}, + ], +) +async def test_list_hive_tables_async(request_type, transport: str = "grpc_asyncio"): client = HiveMetastoreServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6113,7 +6146,7 @@ async def test_list_hive_tables_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_hive_tables), "__call__") as call: @@ -6136,11 +6169,6 @@ async def test_list_hive_tables_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_hive_tables_async_from_dict(): - await test_list_hive_tables_async(request_type=dict) - - def test_list_hive_tables_field_headers(): client = HiveMetastoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6477,8 +6505,8 @@ async def test_list_hive_tables_async_pages(): @pytest.mark.parametrize( "request_type", [ - hive_metastore.UpdateHiveTableRequest, - dict, + hive_metastore.UpdateHiveTableRequest(), + {}, ], ) def test_update_hive_table(request_type, transport: str = "grpc"): @@ -6489,7 +6517,7 @@ def test_update_hive_table(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6539,7 +6567,8 @@ def test_update_hive_table_non_empty_request_with_auto_populated_field(): client.update_hive_table(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hive_metastore.UpdateHiveTableRequest() + request_msg = hive_metastore.UpdateHiveTableRequest() + assert args[0] == request_msg def test_update_hive_table_use_cached_wrapped_rpc(): @@ -6622,9 +6651,14 @@ async def test_update_hive_table_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_hive_table_async( - transport: str = "grpc_asyncio", request_type=hive_metastore.UpdateHiveTableRequest -): +@pytest.mark.parametrize( + "request_type", + [ + hive_metastore.UpdateHiveTableRequest(), + {}, + ], +) +async def test_update_hive_table_async(request_type, transport: str = "grpc_asyncio"): client = HiveMetastoreServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6632,7 +6666,7 @@ async def test_update_hive_table_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( @@ -6661,11 +6695,6 @@ async def test_update_hive_table_async( assert response.table_type == "table_type_value" -@pytest.mark.asyncio -async def test_update_hive_table_async_from_dict(): - await test_update_hive_table_async(request_type=dict) - - def test_update_hive_table_field_headers(): client = HiveMetastoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6830,8 +6859,8 @@ async def test_update_hive_table_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - hive_metastore.DeleteHiveTableRequest, - dict, + hive_metastore.DeleteHiveTableRequest(), + {}, ], ) def test_delete_hive_table(request_type, transport: str = "grpc"): @@ -6842,7 +6871,7 @@ def test_delete_hive_table(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6887,9 +6916,10 @@ def test_delete_hive_table_non_empty_request_with_auto_populated_field(): client.delete_hive_table(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hive_metastore.DeleteHiveTableRequest( + request_msg = hive_metastore.DeleteHiveTableRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_hive_table_use_cached_wrapped_rpc(): @@ -6972,9 +7002,14 @@ async def test_delete_hive_table_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_hive_table_async( - transport: str = "grpc_asyncio", request_type=hive_metastore.DeleteHiveTableRequest -): +@pytest.mark.parametrize( + "request_type", + [ + hive_metastore.DeleteHiveTableRequest(), + {}, + ], +) +async def test_delete_hive_table_async(request_type, transport: str = "grpc_asyncio"): client = HiveMetastoreServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6982,7 +7017,7 @@ async def test_delete_hive_table_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( @@ -7002,11 +7037,6 @@ async def test_delete_hive_table_async( assert response is None -@pytest.mark.asyncio -async def test_delete_hive_table_async_from_dict(): - await test_delete_hive_table_async(request_type=dict) - - def test_delete_hive_table_field_headers(): client = HiveMetastoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7157,8 +7187,8 @@ async def test_delete_hive_table_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - hive_metastore.BatchCreatePartitionsRequest, - dict, + hive_metastore.BatchCreatePartitionsRequest(), + {}, ], ) def test_batch_create_partitions(request_type, transport: str = "grpc"): @@ -7169,7 +7199,7 @@ def test_batch_create_partitions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7214,9 +7244,10 @@ def test_batch_create_partitions_non_empty_request_with_auto_populated_field(): client.batch_create_partitions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hive_metastore.BatchCreatePartitionsRequest( + request_msg = hive_metastore.BatchCreatePartitionsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_batch_create_partitions_use_cached_wrapped_rpc(): @@ -7302,9 +7333,15 @@ async def test_batch_create_partitions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + hive_metastore.BatchCreatePartitionsRequest(), + {}, + ], +) async def test_batch_create_partitions_async( - transport: str = "grpc_asyncio", - request_type=hive_metastore.BatchCreatePartitionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = HiveMetastoreServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -7313,7 +7350,7 @@ async def test_batch_create_partitions_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( @@ -7335,11 +7372,6 @@ async def test_batch_create_partitions_async( assert isinstance(response, hive_metastore.BatchCreatePartitionsResponse) -@pytest.mark.asyncio -async def test_batch_create_partitions_async_from_dict(): - await test_batch_create_partitions_async(request_type=dict) - - def test_batch_create_partitions_field_headers(): client = HiveMetastoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7494,8 +7526,8 @@ async def test_batch_create_partitions_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - hive_metastore.BatchDeletePartitionsRequest, - dict, + hive_metastore.BatchDeletePartitionsRequest(), + {}, ], ) def test_batch_delete_partitions(request_type, transport: str = "grpc"): @@ -7506,7 +7538,7 @@ def test_batch_delete_partitions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7551,9 +7583,10 @@ def test_batch_delete_partitions_non_empty_request_with_auto_populated_field(): client.batch_delete_partitions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hive_metastore.BatchDeletePartitionsRequest( + request_msg = hive_metastore.BatchDeletePartitionsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_batch_delete_partitions_use_cached_wrapped_rpc(): @@ -7639,9 +7672,15 @@ async def test_batch_delete_partitions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + hive_metastore.BatchDeletePartitionsRequest(), + {}, + ], +) async def test_batch_delete_partitions_async( - transport: str = "grpc_asyncio", - request_type=hive_metastore.BatchDeletePartitionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = HiveMetastoreServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -7650,7 +7689,7 @@ async def test_batch_delete_partitions_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( @@ -7670,11 +7709,6 @@ async def test_batch_delete_partitions_async( assert response is None -@pytest.mark.asyncio -async def test_batch_delete_partitions_async_from_dict(): - await test_batch_delete_partitions_async(request_type=dict) - - def test_batch_delete_partitions_field_headers(): client = HiveMetastoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7825,8 +7859,8 @@ async def test_batch_delete_partitions_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - hive_metastore.BatchUpdatePartitionsRequest, - dict, + hive_metastore.BatchUpdatePartitionsRequest(), + {}, ], ) def test_batch_update_partitions(request_type, transport: str = "grpc"): @@ -7837,7 +7871,7 @@ def test_batch_update_partitions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7882,9 +7916,10 @@ def test_batch_update_partitions_non_empty_request_with_auto_populated_field(): client.batch_update_partitions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hive_metastore.BatchUpdatePartitionsRequest( + request_msg = hive_metastore.BatchUpdatePartitionsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_batch_update_partitions_use_cached_wrapped_rpc(): @@ -7970,9 +8005,15 @@ async def test_batch_update_partitions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + hive_metastore.BatchUpdatePartitionsRequest(), + {}, + ], +) async def test_batch_update_partitions_async( - transport: str = "grpc_asyncio", - request_type=hive_metastore.BatchUpdatePartitionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = HiveMetastoreServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -7981,7 +8022,7 @@ async def test_batch_update_partitions_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( @@ -8003,11 +8044,6 @@ async def test_batch_update_partitions_async( assert isinstance(response, hive_metastore.BatchUpdatePartitionsResponse) -@pytest.mark.asyncio -async def test_batch_update_partitions_async_from_dict(): - await test_batch_update_partitions_async(request_type=dict) - - def test_batch_update_partitions_field_headers(): client = HiveMetastoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8162,8 +8198,8 @@ async def test_batch_update_partitions_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - hive_metastore.ListPartitionsRequest, - dict, + hive_metastore.ListPartitionsRequest(), + {}, ], ) def test_list_partitions(request_type, transport: str = "grpc"): @@ -8174,7 +8210,7 @@ def test_list_partitions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_partitions), "__call__") as call: @@ -8217,10 +8253,11 @@ def test_list_partitions_non_empty_request_with_auto_populated_field(): client.list_partitions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hive_metastore.ListPartitionsRequest( + request_msg = hive_metastore.ListPartitionsRequest( parent="parent_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_partitions_use_cached_wrapped_rpc(): @@ -8301,9 +8338,14 @@ async def test_list_partitions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_partitions_async( - transport: str = "grpc_asyncio", request_type=hive_metastore.ListPartitionsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + hive_metastore.ListPartitionsRequest(), + {}, + ], +) +async def test_list_partitions_async(request_type, transport: str = "grpc_asyncio"): client = HiveMetastoreServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8311,7 +8353,7 @@ async def test_list_partitions_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_partitions), "__call__") as call: @@ -8333,11 +8375,6 @@ async def test_list_partitions_async( assert isinstance(message, hive_metastore.ListPartitionsResponse) -@pytest.mark.asyncio -async def test_list_partitions_async_from_dict(): - await test_list_partitions_async(request_type=dict) - - def test_list_partitions_field_headers(): client = HiveMetastoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12426,7 +12463,6 @@ def test_create_hive_catalog_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hive_metastore.CreateHiveCatalogRequest() - assert args[0] == request_msg @@ -12447,7 +12483,6 @@ def test_get_hive_catalog_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hive_metastore.GetHiveCatalogRequest() - assert args[0] == request_msg @@ -12470,7 +12505,6 @@ def test_list_hive_catalogs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hive_metastore.ListHiveCatalogsRequest() - assert args[0] == request_msg @@ -12493,7 +12527,6 @@ def test_update_hive_catalog_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hive_metastore.UpdateHiveCatalogRequest() - assert args[0] == request_msg @@ -12516,7 +12549,6 @@ def test_delete_hive_catalog_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hive_metastore.DeleteHiveCatalogRequest() - assert args[0] == request_msg @@ -12539,7 +12571,6 @@ def test_create_hive_database_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hive_metastore.CreateHiveDatabaseRequest() - assert args[0] == request_msg @@ -12562,7 +12593,6 @@ def test_get_hive_database_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hive_metastore.GetHiveDatabaseRequest() - assert args[0] == request_msg @@ -12585,7 +12615,6 @@ def test_list_hive_databases_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hive_metastore.ListHiveDatabasesRequest() - assert args[0] == request_msg @@ -12608,7 +12637,6 @@ def test_update_hive_database_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hive_metastore.UpdateHiveDatabaseRequest() - assert args[0] == request_msg @@ -12631,7 +12659,6 @@ def test_delete_hive_database_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hive_metastore.DeleteHiveDatabaseRequest() - assert args[0] == request_msg @@ -12654,7 +12681,6 @@ def test_create_hive_table_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hive_metastore.CreateHiveTableRequest() - assert args[0] == request_msg @@ -12675,7 +12701,6 @@ def test_get_hive_table_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hive_metastore.GetHiveTableRequest() - assert args[0] == request_msg @@ -12696,7 +12721,6 @@ def test_list_hive_tables_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hive_metastore.ListHiveTablesRequest() - assert args[0] == request_msg @@ -12719,7 +12743,6 @@ def test_update_hive_table_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hive_metastore.UpdateHiveTableRequest() - assert args[0] == request_msg @@ -12742,7 +12765,6 @@ def test_delete_hive_table_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hive_metastore.DeleteHiveTableRequest() - assert args[0] == request_msg @@ -12765,7 +12787,6 @@ def test_batch_create_partitions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hive_metastore.BatchCreatePartitionsRequest() - assert args[0] == request_msg @@ -12788,7 +12809,6 @@ def test_batch_delete_partitions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hive_metastore.BatchDeletePartitionsRequest() - assert args[0] == request_msg @@ -12811,7 +12831,6 @@ def test_batch_update_partitions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hive_metastore.BatchUpdatePartitionsRequest() - assert args[0] == request_msg @@ -12832,7 +12851,6 @@ def test_list_partitions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hive_metastore.ListPartitionsRequest() - assert args[0] == request_msg @@ -12877,7 +12895,6 @@ async def test_create_hive_catalog_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hive_metastore.CreateHiveCatalogRequest() - assert args[0] == request_msg @@ -12906,7 +12923,6 @@ async def test_get_hive_catalog_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hive_metastore.GetHiveCatalogRequest() - assert args[0] == request_msg @@ -12936,7 +12952,6 @@ async def test_list_hive_catalogs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hive_metastore.ListHiveCatalogsRequest() - assert args[0] == request_msg @@ -12967,7 +12982,6 @@ async def test_update_hive_catalog_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hive_metastore.UpdateHiveCatalogRequest() - assert args[0] == request_msg @@ -12992,7 +13006,6 @@ async def test_delete_hive_catalog_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hive_metastore.DeleteHiveCatalogRequest() - assert args[0] == request_msg @@ -13023,7 +13036,6 @@ async def test_create_hive_database_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hive_metastore.CreateHiveDatabaseRequest() - assert args[0] == request_msg @@ -13054,7 +13066,6 @@ async def test_get_hive_database_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hive_metastore.GetHiveDatabaseRequest() - assert args[0] == request_msg @@ -13083,7 +13094,6 @@ async def test_list_hive_databases_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hive_metastore.ListHiveDatabasesRequest() - assert args[0] == request_msg @@ -13114,7 +13124,6 @@ async def test_update_hive_database_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hive_metastore.UpdateHiveDatabaseRequest() - assert args[0] == request_msg @@ -13139,7 +13148,6 @@ async def test_delete_hive_database_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hive_metastore.DeleteHiveDatabaseRequest() - assert args[0] == request_msg @@ -13170,7 +13178,6 @@ async def test_create_hive_table_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hive_metastore.CreateHiveTableRequest() - assert args[0] == request_msg @@ -13199,7 +13206,6 @@ async def test_get_hive_table_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hive_metastore.GetHiveTableRequest() - assert args[0] == request_msg @@ -13226,7 +13232,6 @@ async def test_list_hive_tables_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hive_metastore.ListHiveTablesRequest() - assert args[0] == request_msg @@ -13257,7 +13262,6 @@ async def test_update_hive_table_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hive_metastore.UpdateHiveTableRequest() - assert args[0] == request_msg @@ -13282,7 +13286,6 @@ async def test_delete_hive_table_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hive_metastore.DeleteHiveTableRequest() - assert args[0] == request_msg @@ -13309,7 +13312,6 @@ async def test_batch_create_partitions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hive_metastore.BatchCreatePartitionsRequest() - assert args[0] == request_msg @@ -13334,7 +13336,6 @@ async def test_batch_delete_partitions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hive_metastore.BatchDeletePartitionsRequest() - assert args[0] == request_msg @@ -13361,7 +13362,6 @@ async def test_batch_update_partitions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hive_metastore.BatchUpdatePartitionsRequest() - assert args[0] == request_msg @@ -13387,7 +13387,6 @@ async def test_list_partitions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hive_metastore.ListPartitionsRequest() - assert args[0] == request_msg @@ -16460,7 +16459,6 @@ def test_create_hive_catalog_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hive_metastore.CreateHiveCatalogRequest() - assert args[0] == request_msg @@ -16480,7 +16478,6 @@ def test_get_hive_catalog_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hive_metastore.GetHiveCatalogRequest() - assert args[0] == request_msg @@ -16502,7 +16499,6 @@ def test_list_hive_catalogs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hive_metastore.ListHiveCatalogsRequest() - assert args[0] == request_msg @@ -16524,7 +16520,6 @@ def test_update_hive_catalog_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hive_metastore.UpdateHiveCatalogRequest() - assert args[0] == request_msg @@ -16546,7 +16541,6 @@ def test_delete_hive_catalog_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hive_metastore.DeleteHiveCatalogRequest() - assert args[0] == request_msg @@ -16568,7 +16562,6 @@ def test_create_hive_database_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hive_metastore.CreateHiveDatabaseRequest() - assert args[0] == request_msg @@ -16590,7 +16583,6 @@ def test_get_hive_database_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hive_metastore.GetHiveDatabaseRequest() - assert args[0] == request_msg @@ -16612,7 +16604,6 @@ def test_list_hive_databases_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hive_metastore.ListHiveDatabasesRequest() - assert args[0] == request_msg @@ -16634,7 +16625,6 @@ def test_update_hive_database_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hive_metastore.UpdateHiveDatabaseRequest() - assert args[0] == request_msg @@ -16656,7 +16646,6 @@ def test_delete_hive_database_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hive_metastore.DeleteHiveDatabaseRequest() - assert args[0] == request_msg @@ -16678,7 +16667,6 @@ def test_create_hive_table_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hive_metastore.CreateHiveTableRequest() - assert args[0] == request_msg @@ -16698,7 +16686,6 @@ def test_get_hive_table_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hive_metastore.GetHiveTableRequest() - assert args[0] == request_msg @@ -16718,7 +16705,6 @@ def test_list_hive_tables_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hive_metastore.ListHiveTablesRequest() - assert args[0] == request_msg @@ -16740,7 +16726,6 @@ def test_update_hive_table_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hive_metastore.UpdateHiveTableRequest() - assert args[0] == request_msg @@ -16762,7 +16747,6 @@ def test_delete_hive_table_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hive_metastore.DeleteHiveTableRequest() - assert args[0] == request_msg @@ -16784,7 +16768,6 @@ def test_batch_create_partitions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hive_metastore.BatchCreatePartitionsRequest() - assert args[0] == request_msg @@ -16806,7 +16789,6 @@ def test_batch_delete_partitions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hive_metastore.BatchDeletePartitionsRequest() - assert args[0] == request_msg @@ -16828,7 +16810,6 @@ def test_batch_update_partitions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hive_metastore.BatchUpdatePartitionsRequest() - assert args[0] == request_msg @@ -16848,7 +16829,6 @@ def test_list_partitions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hive_metastore.ListPartitionsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-biglake/noxfile.py b/packages/google-cloud-biglake/noxfile.py index 99ce8dcc2206..1ebc50a53211 100644 --- a/packages/google-cloud-biglake/noxfile.py +++ b/packages/google-cloud-biglake/noxfile.py @@ -47,7 +47,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-biglake" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-biglake/setup.py b/packages/google-cloud-biglake/setup.py index e2fc526b59fb..c1b3bb4bb6ba 100644 --- a/packages/google-cloud-biglake/setup.py +++ b/packages/google-cloud-biglake/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/google-cloud-biglake/testing/constraints-3.10.txt b/packages/google-cloud-biglake/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-biglake/testing/constraints-3.10.txt +++ b/packages/google-cloud-biglake/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-biglake/tests/unit/gapic/biglake_v1/test_iceberg_catalog_service.py b/packages/google-cloud-biglake/tests/unit/gapic/biglake_v1/test_iceberg_catalog_service.py index 57fc010896ec..71db32ccb04c 100644 --- a/packages/google-cloud-biglake/tests/unit/gapic/biglake_v1/test_iceberg_catalog_service.py +++ b/packages/google-cloud-biglake/tests/unit/gapic/biglake_v1/test_iceberg_catalog_service.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 @@ -109,6 +110,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" @@ -1377,8 +1393,8 @@ def test_iceberg_catalog_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - iceberg_rest_catalog.GetIcebergCatalogRequest, - dict, + iceberg_rest_catalog.GetIcebergCatalogRequest(), + {}, ], ) def test_get_iceberg_catalog(request_type, transport: str = "grpc"): @@ -1389,7 +1405,7 @@ def test_get_iceberg_catalog(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1453,9 +1469,10 @@ def test_get_iceberg_catalog_non_empty_request_with_auto_populated_field(): client.get_iceberg_catalog(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iceberg_rest_catalog.GetIcebergCatalogRequest( + request_msg = iceberg_rest_catalog.GetIcebergCatalogRequest( name="name_value", ) + assert args[0] == request_msg def test_get_iceberg_catalog_use_cached_wrapped_rpc(): @@ -1540,10 +1557,14 @@ async def test_get_iceberg_catalog_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_iceberg_catalog_async( - transport: str = "grpc_asyncio", - request_type=iceberg_rest_catalog.GetIcebergCatalogRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + iceberg_rest_catalog.GetIcebergCatalogRequest(), + {}, + ], +) +async def test_get_iceberg_catalog_async(request_type, transport: str = "grpc_asyncio"): client = IcebergCatalogServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1551,7 +1572,7 @@ async def test_get_iceberg_catalog_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( @@ -1592,11 +1613,6 @@ async def test_get_iceberg_catalog_async( assert response.catalog_regions == ["catalog_regions_value"] -@pytest.mark.asyncio -async def test_get_iceberg_catalog_async_from_dict(): - await test_get_iceberg_catalog_async(request_type=dict) - - def test_get_iceberg_catalog_field_headers(): client = IcebergCatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1751,8 +1767,8 @@ async def test_get_iceberg_catalog_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iceberg_rest_catalog.ListIcebergCatalogsRequest, - dict, + iceberg_rest_catalog.ListIcebergCatalogsRequest(), + {}, ], ) def test_list_iceberg_catalogs(request_type, transport: str = "grpc"): @@ -1763,7 +1779,7 @@ def test_list_iceberg_catalogs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1814,10 +1830,11 @@ def test_list_iceberg_catalogs_non_empty_request_with_auto_populated_field(): client.list_iceberg_catalogs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iceberg_rest_catalog.ListIcebergCatalogsRequest( + request_msg = iceberg_rest_catalog.ListIcebergCatalogsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_iceberg_catalogs_use_cached_wrapped_rpc(): @@ -1903,9 +1920,15 @@ async def test_list_iceberg_catalogs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + iceberg_rest_catalog.ListIcebergCatalogsRequest(), + {}, + ], +) async def test_list_iceberg_catalogs_async( - transport: str = "grpc_asyncio", - request_type=iceberg_rest_catalog.ListIcebergCatalogsRequest, + request_type, transport: str = "grpc_asyncio" ): client = IcebergCatalogServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1914,7 +1937,7 @@ async def test_list_iceberg_catalogs_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( @@ -1941,11 +1964,6 @@ async def test_list_iceberg_catalogs_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_iceberg_catalogs_async_from_dict(): - await test_list_iceberg_catalogs_async(request_type=dict) - - def test_list_iceberg_catalogs_field_headers(): client = IcebergCatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2300,8 +2318,8 @@ async def test_list_iceberg_catalogs_async_pages(): @pytest.mark.parametrize( "request_type", [ - iceberg_rest_catalog.UpdateIcebergCatalogRequest, - dict, + iceberg_rest_catalog.UpdateIcebergCatalogRequest(), + {}, ], ) def test_update_iceberg_catalog(request_type, transport: str = "grpc"): @@ -2312,7 +2330,7 @@ def test_update_iceberg_catalog(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2374,7 +2392,8 @@ def test_update_iceberg_catalog_non_empty_request_with_auto_populated_field(): client.update_iceberg_catalog(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iceberg_rest_catalog.UpdateIcebergCatalogRequest() + request_msg = iceberg_rest_catalog.UpdateIcebergCatalogRequest() + assert args[0] == request_msg def test_update_iceberg_catalog_use_cached_wrapped_rpc(): @@ -2460,9 +2479,15 @@ async def test_update_iceberg_catalog_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + iceberg_rest_catalog.UpdateIcebergCatalogRequest(), + {}, + ], +) async def test_update_iceberg_catalog_async( - transport: str = "grpc_asyncio", - request_type=iceberg_rest_catalog.UpdateIcebergCatalogRequest, + request_type, transport: str = "grpc_asyncio" ): client = IcebergCatalogServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2471,7 +2496,7 @@ async def test_update_iceberg_catalog_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( @@ -2512,11 +2537,6 @@ async def test_update_iceberg_catalog_async( assert response.catalog_regions == ["catalog_regions_value"] -@pytest.mark.asyncio -async def test_update_iceberg_catalog_async_from_dict(): - await test_update_iceberg_catalog_async(request_type=dict) - - def test_update_iceberg_catalog_field_headers(): client = IcebergCatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2681,8 +2701,8 @@ async def test_update_iceberg_catalog_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iceberg_rest_catalog.CreateIcebergCatalogRequest, - dict, + iceberg_rest_catalog.CreateIcebergCatalogRequest(), + {}, ], ) def test_create_iceberg_catalog(request_type, transport: str = "grpc"): @@ -2693,7 +2713,7 @@ def test_create_iceberg_catalog(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2758,10 +2778,11 @@ def test_create_iceberg_catalog_non_empty_request_with_auto_populated_field(): client.create_iceberg_catalog(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iceberg_rest_catalog.CreateIcebergCatalogRequest( + request_msg = iceberg_rest_catalog.CreateIcebergCatalogRequest( parent="parent_value", iceberg_catalog_id="iceberg_catalog_id_value", ) + assert args[0] == request_msg def test_create_iceberg_catalog_use_cached_wrapped_rpc(): @@ -2847,9 +2868,15 @@ async def test_create_iceberg_catalog_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + iceberg_rest_catalog.CreateIcebergCatalogRequest(), + {}, + ], +) async def test_create_iceberg_catalog_async( - transport: str = "grpc_asyncio", - request_type=iceberg_rest_catalog.CreateIcebergCatalogRequest, + request_type, transport: str = "grpc_asyncio" ): client = IcebergCatalogServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2858,7 +2885,7 @@ async def test_create_iceberg_catalog_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( @@ -2899,11 +2926,6 @@ async def test_create_iceberg_catalog_async( assert response.catalog_regions == ["catalog_regions_value"] -@pytest.mark.asyncio -async def test_create_iceberg_catalog_async_from_dict(): - await test_create_iceberg_catalog_async(request_type=dict) - - def test_create_iceberg_catalog_field_headers(): client = IcebergCatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3078,8 +3100,8 @@ async def test_create_iceberg_catalog_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iceberg_rest_catalog.FailoverIcebergCatalogRequest, - dict, + iceberg_rest_catalog.FailoverIcebergCatalogRequest(), + {}, ], ) def test_failover_iceberg_catalog(request_type, transport: str = "grpc"): @@ -3090,7 +3112,7 @@ def test_failover_iceberg_catalog(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3136,10 +3158,11 @@ def test_failover_iceberg_catalog_non_empty_request_with_auto_populated_field(): client.failover_iceberg_catalog(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iceberg_rest_catalog.FailoverIcebergCatalogRequest( + request_msg = iceberg_rest_catalog.FailoverIcebergCatalogRequest( name="name_value", primary_replica="primary_replica_value", ) + assert args[0] == request_msg def test_failover_iceberg_catalog_use_cached_wrapped_rpc(): @@ -3225,9 +3248,15 @@ async def test_failover_iceberg_catalog_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + iceberg_rest_catalog.FailoverIcebergCatalogRequest(), + {}, + ], +) async def test_failover_iceberg_catalog_async( - transport: str = "grpc_asyncio", - request_type=iceberg_rest_catalog.FailoverIcebergCatalogRequest, + request_type, transport: str = "grpc_asyncio" ): client = IcebergCatalogServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3236,7 +3265,7 @@ async def test_failover_iceberg_catalog_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( @@ -3258,11 +3287,6 @@ async def test_failover_iceberg_catalog_async( assert isinstance(response, iceberg_rest_catalog.FailoverIcebergCatalogResponse) -@pytest.mark.asyncio -async def test_failover_iceberg_catalog_async_from_dict(): - await test_failover_iceberg_catalog_async(request_type=dict) - - def test_failover_iceberg_catalog_field_headers(): client = IcebergCatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4596,7 +4620,6 @@ def test_get_iceberg_catalog_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iceberg_rest_catalog.GetIcebergCatalogRequest() - assert args[0] == request_msg @@ -4619,7 +4642,6 @@ def test_list_iceberg_catalogs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iceberg_rest_catalog.ListIcebergCatalogsRequest() - assert args[0] == request_msg @@ -4642,7 +4664,6 @@ def test_update_iceberg_catalog_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iceberg_rest_catalog.UpdateIcebergCatalogRequest() - assert args[0] == request_msg @@ -4665,7 +4686,6 @@ def test_create_iceberg_catalog_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iceberg_rest_catalog.CreateIcebergCatalogRequest() - assert args[0] == request_msg @@ -4688,7 +4708,6 @@ def test_failover_iceberg_catalog_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iceberg_rest_catalog.FailoverIcebergCatalogRequest() - assert args[0] == request_msg @@ -4736,7 +4755,6 @@ async def test_get_iceberg_catalog_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iceberg_rest_catalog.GetIcebergCatalogRequest() - assert args[0] == request_msg @@ -4766,7 +4784,6 @@ async def test_list_iceberg_catalogs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iceberg_rest_catalog.ListIcebergCatalogsRequest() - assert args[0] == request_msg @@ -4800,7 +4817,6 @@ async def test_update_iceberg_catalog_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iceberg_rest_catalog.UpdateIcebergCatalogRequest() - assert args[0] == request_msg @@ -4834,7 +4850,6 @@ async def test_create_iceberg_catalog_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iceberg_rest_catalog.CreateIcebergCatalogRequest() - assert args[0] == request_msg @@ -4861,7 +4876,6 @@ async def test_failover_iceberg_catalog_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iceberg_rest_catalog.FailoverIcebergCatalogRequest() - assert args[0] == request_msg @@ -5791,7 +5805,6 @@ def test_get_iceberg_catalog_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iceberg_rest_catalog.GetIcebergCatalogRequest() - assert args[0] == request_msg @@ -5813,7 +5826,6 @@ def test_list_iceberg_catalogs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iceberg_rest_catalog.ListIcebergCatalogsRequest() - assert args[0] == request_msg @@ -5835,7 +5847,6 @@ def test_update_iceberg_catalog_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iceberg_rest_catalog.UpdateIcebergCatalogRequest() - assert args[0] == request_msg @@ -5857,7 +5868,6 @@ def test_create_iceberg_catalog_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iceberg_rest_catalog.CreateIcebergCatalogRequest() - assert args[0] == request_msg @@ -5879,7 +5889,6 @@ def test_failover_iceberg_catalog_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iceberg_rest_catalog.FailoverIcebergCatalogRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-bigquery-analyticshub/noxfile.py b/packages/google-cloud-bigquery-analyticshub/noxfile.py index dc3bc867dc41..be6693d95ee7 100644 --- a/packages/google-cloud-bigquery-analyticshub/noxfile.py +++ b/packages/google-cloud-bigquery-analyticshub/noxfile.py @@ -47,7 +47,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-bigquery-analyticshub" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-bigquery-analyticshub/setup.py b/packages/google-cloud-bigquery-analyticshub/setup.py index 82c2c6718c79..c97c4f9bb548 100644 --- a/packages/google-cloud-bigquery-analyticshub/setup.py +++ b/packages/google-cloud-bigquery-analyticshub/setup.py @@ -45,7 +45,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/google-cloud-bigquery-analyticshub/testing/constraints-3.10.txt b/packages/google-cloud-bigquery-analyticshub/testing/constraints-3.10.txt index a92801e1c8e2..b39cd54634f9 100644 --- a/packages/google-cloud-bigquery-analyticshub/testing/constraints-3.10.txt +++ b/packages/google-cloud-bigquery-analyticshub/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/google-cloud-bigquery-analyticshub/tests/unit/gapic/bigquery_analyticshub_v1/test_analytics_hub_service.py b/packages/google-cloud-bigquery-analyticshub/tests/unit/gapic/bigquery_analyticshub_v1/test_analytics_hub_service.py index 8640caf59668..b20f9ebd2ed6 100644 --- a/packages/google-cloud-bigquery-analyticshub/tests/unit/gapic/bigquery_analyticshub_v1/test_analytics_hub_service.py +++ b/packages/google-cloud-bigquery-analyticshub/tests/unit/gapic/bigquery_analyticshub_v1/test_analytics_hub_service.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 @@ -118,6 +119,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" @@ -1344,8 +1360,8 @@ def test_analytics_hub_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - analyticshub.ListDataExchangesRequest, - dict, + analyticshub.ListDataExchangesRequest(), + {}, ], ) def test_list_data_exchanges(request_type, transport: str = "grpc"): @@ -1356,7 +1372,7 @@ def test_list_data_exchanges(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1405,10 +1421,11 @@ def test_list_data_exchanges_non_empty_request_with_auto_populated_field(): client.list_data_exchanges(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analyticshub.ListDataExchangesRequest( + request_msg = analyticshub.ListDataExchangesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_data_exchanges_use_cached_wrapped_rpc(): @@ -1493,9 +1510,14 @@ async def test_list_data_exchanges_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_data_exchanges_async( - transport: str = "grpc_asyncio", request_type=analyticshub.ListDataExchangesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + analyticshub.ListDataExchangesRequest(), + {}, + ], +) +async def test_list_data_exchanges_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsHubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1503,7 +1525,7 @@ async def test_list_data_exchanges_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( @@ -1528,11 +1550,6 @@ async def test_list_data_exchanges_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_data_exchanges_async_from_dict(): - await test_list_data_exchanges_async(request_type=dict) - - def test_list_data_exchanges_field_headers(): client = AnalyticsHubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1885,8 +1902,8 @@ async def test_list_data_exchanges_async_pages(): @pytest.mark.parametrize( "request_type", [ - analyticshub.ListOrgDataExchangesRequest, - dict, + analyticshub.ListOrgDataExchangesRequest(), + {}, ], ) def test_list_org_data_exchanges(request_type, transport: str = "grpc"): @@ -1897,7 +1914,7 @@ def test_list_org_data_exchanges(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1946,10 +1963,11 @@ def test_list_org_data_exchanges_non_empty_request_with_auto_populated_field(): client.list_org_data_exchanges(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analyticshub.ListOrgDataExchangesRequest( + request_msg = analyticshub.ListOrgDataExchangesRequest( organization="organization_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_org_data_exchanges_use_cached_wrapped_rpc(): @@ -2035,9 +2053,15 @@ async def test_list_org_data_exchanges_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analyticshub.ListOrgDataExchangesRequest(), + {}, + ], +) async def test_list_org_data_exchanges_async( - transport: str = "grpc_asyncio", - request_type=analyticshub.ListOrgDataExchangesRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsHubServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2046,7 +2070,7 @@ async def test_list_org_data_exchanges_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( @@ -2071,11 +2095,6 @@ async def test_list_org_data_exchanges_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_org_data_exchanges_async_from_dict(): - await test_list_org_data_exchanges_async(request_type=dict) - - def test_list_org_data_exchanges_field_headers(): client = AnalyticsHubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2428,8 +2447,8 @@ async def test_list_org_data_exchanges_async_pages(): @pytest.mark.parametrize( "request_type", [ - analyticshub.GetDataExchangeRequest, - dict, + analyticshub.GetDataExchangeRequest(), + {}, ], ) def test_get_data_exchange(request_type, transport: str = "grpc"): @@ -2440,7 +2459,7 @@ def test_get_data_exchange(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2504,9 +2523,10 @@ def test_get_data_exchange_non_empty_request_with_auto_populated_field(): client.get_data_exchange(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analyticshub.GetDataExchangeRequest( + request_msg = analyticshub.GetDataExchangeRequest( name="name_value", ) + assert args[0] == request_msg def test_get_data_exchange_use_cached_wrapped_rpc(): @@ -2589,9 +2609,14 @@ async def test_get_data_exchange_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_data_exchange_async( - transport: str = "grpc_asyncio", request_type=analyticshub.GetDataExchangeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + analyticshub.GetDataExchangeRequest(), + {}, + ], +) +async def test_get_data_exchange_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsHubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2599,7 +2624,7 @@ async def test_get_data_exchange_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( @@ -2640,11 +2665,6 @@ async def test_get_data_exchange_async( assert response.log_linked_dataset_query_user_email is True -@pytest.mark.asyncio -async def test_get_data_exchange_async_from_dict(): - await test_get_data_exchange_async(request_type=dict) - - def test_get_data_exchange_field_headers(): client = AnalyticsHubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2799,8 +2819,8 @@ async def test_get_data_exchange_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analyticshub.CreateDataExchangeRequest, - dict, + analyticshub.CreateDataExchangeRequest(), + {}, ], ) def test_create_data_exchange(request_type, transport: str = "grpc"): @@ -2811,7 +2831,7 @@ def test_create_data_exchange(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2876,10 +2896,11 @@ def test_create_data_exchange_non_empty_request_with_auto_populated_field(): client.create_data_exchange(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analyticshub.CreateDataExchangeRequest( + request_msg = analyticshub.CreateDataExchangeRequest( parent="parent_value", data_exchange_id="data_exchange_id_value", ) + assert args[0] == request_msg def test_create_data_exchange_use_cached_wrapped_rpc(): @@ -2964,8 +2985,15 @@ async def test_create_data_exchange_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analyticshub.CreateDataExchangeRequest(), + {}, + ], +) async def test_create_data_exchange_async( - transport: str = "grpc_asyncio", request_type=analyticshub.CreateDataExchangeRequest + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsHubServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2974,7 +3002,7 @@ async def test_create_data_exchange_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( @@ -3015,11 +3043,6 @@ async def test_create_data_exchange_async( assert response.log_linked_dataset_query_user_email is True -@pytest.mark.asyncio -async def test_create_data_exchange_async_from_dict(): - await test_create_data_exchange_async(request_type=dict) - - def test_create_data_exchange_field_headers(): client = AnalyticsHubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3184,8 +3207,8 @@ async def test_create_data_exchange_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analyticshub.UpdateDataExchangeRequest, - dict, + analyticshub.UpdateDataExchangeRequest(), + {}, ], ) def test_update_data_exchange(request_type, transport: str = "grpc"): @@ -3196,7 +3219,7 @@ def test_update_data_exchange(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3258,7 +3281,8 @@ def test_update_data_exchange_non_empty_request_with_auto_populated_field(): client.update_data_exchange(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analyticshub.UpdateDataExchangeRequest() + request_msg = analyticshub.UpdateDataExchangeRequest() + assert args[0] == request_msg def test_update_data_exchange_use_cached_wrapped_rpc(): @@ -3343,8 +3367,15 @@ async def test_update_data_exchange_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analyticshub.UpdateDataExchangeRequest(), + {}, + ], +) async def test_update_data_exchange_async( - transport: str = "grpc_asyncio", request_type=analyticshub.UpdateDataExchangeRequest + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsHubServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3353,7 +3384,7 @@ async def test_update_data_exchange_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( @@ -3394,11 +3425,6 @@ async def test_update_data_exchange_async( assert response.log_linked_dataset_query_user_email is True -@pytest.mark.asyncio -async def test_update_data_exchange_async_from_dict(): - await test_update_data_exchange_async(request_type=dict) - - def test_update_data_exchange_field_headers(): client = AnalyticsHubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3563,8 +3589,8 @@ async def test_update_data_exchange_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analyticshub.DeleteDataExchangeRequest, - dict, + analyticshub.DeleteDataExchangeRequest(), + {}, ], ) def test_delete_data_exchange(request_type, transport: str = "grpc"): @@ -3575,7 +3601,7 @@ def test_delete_data_exchange(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3620,9 +3646,10 @@ def test_delete_data_exchange_non_empty_request_with_auto_populated_field(): client.delete_data_exchange(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analyticshub.DeleteDataExchangeRequest( + request_msg = analyticshub.DeleteDataExchangeRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_data_exchange_use_cached_wrapped_rpc(): @@ -3707,8 +3734,15 @@ async def test_delete_data_exchange_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analyticshub.DeleteDataExchangeRequest(), + {}, + ], +) async def test_delete_data_exchange_async( - transport: str = "grpc_asyncio", request_type=analyticshub.DeleteDataExchangeRequest + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsHubServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3717,7 +3751,7 @@ async def test_delete_data_exchange_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( @@ -3737,11 +3771,6 @@ async def test_delete_data_exchange_async( assert response is None -@pytest.mark.asyncio -async def test_delete_data_exchange_async_from_dict(): - await test_delete_data_exchange_async(request_type=dict) - - def test_delete_data_exchange_field_headers(): client = AnalyticsHubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3892,8 +3921,8 @@ async def test_delete_data_exchange_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analyticshub.ListListingsRequest, - dict, + analyticshub.ListListingsRequest(), + {}, ], ) def test_list_listings(request_type, transport: str = "grpc"): @@ -3904,7 +3933,7 @@ def test_list_listings(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_listings), "__call__") as call: @@ -3949,10 +3978,11 @@ def test_list_listings_non_empty_request_with_auto_populated_field(): client.list_listings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analyticshub.ListListingsRequest( + request_msg = analyticshub.ListListingsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_listings_use_cached_wrapped_rpc(): @@ -4033,9 +4063,14 @@ async def test_list_listings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_listings_async( - transport: str = "grpc_asyncio", request_type=analyticshub.ListListingsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + analyticshub.ListListingsRequest(), + {}, + ], +) +async def test_list_listings_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsHubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4043,7 +4078,7 @@ async def test_list_listings_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_listings), "__call__") as call: @@ -4066,11 +4101,6 @@ async def test_list_listings_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_listings_async_from_dict(): - await test_list_listings_async(request_type=dict) - - def test_list_listings_field_headers(): client = AnalyticsHubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4407,8 +4437,8 @@ async def test_list_listings_async_pages(): @pytest.mark.parametrize( "request_type", [ - analyticshub.GetListingRequest, - dict, + analyticshub.GetListingRequest(), + {}, ], ) def test_get_listing(request_type, transport: str = "grpc"): @@ -4419,7 +4449,7 @@ def test_get_listing(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_listing), "__call__") as call: @@ -4487,9 +4517,10 @@ def test_get_listing_non_empty_request_with_auto_populated_field(): client.get_listing(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analyticshub.GetListingRequest( + request_msg = analyticshub.GetListingRequest( name="name_value", ) + assert args[0] == request_msg def test_get_listing_use_cached_wrapped_rpc(): @@ -4570,9 +4601,14 @@ async def test_get_listing_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_listing_async( - transport: str = "grpc_asyncio", request_type=analyticshub.GetListingRequest -): +@pytest.mark.parametrize( + "request_type", + [ + analyticshub.GetListingRequest(), + {}, + ], +) +async def test_get_listing_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsHubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4580,7 +4616,7 @@ async def test_get_listing_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_listing), "__call__") as call: @@ -4627,11 +4663,6 @@ async def test_get_listing_async( assert response.allow_only_metadata_sharing is True -@pytest.mark.asyncio -async def test_get_listing_async_from_dict(): - await test_get_listing_async(request_type=dict) - - def test_get_listing_field_headers(): client = AnalyticsHubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4778,8 +4809,8 @@ async def test_get_listing_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analyticshub.CreateListingRequest, - dict, + analyticshub.CreateListingRequest(), + {}, ], ) def test_create_listing(request_type, transport: str = "grpc"): @@ -4790,7 +4821,7 @@ def test_create_listing(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_listing), "__call__") as call: @@ -4859,10 +4890,11 @@ def test_create_listing_non_empty_request_with_auto_populated_field(): client.create_listing(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analyticshub.CreateListingRequest( + request_msg = analyticshub.CreateListingRequest( parent="parent_value", listing_id="listing_id_value", ) + assert args[0] == request_msg def test_create_listing_use_cached_wrapped_rpc(): @@ -4943,9 +4975,14 @@ async def test_create_listing_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_listing_async( - transport: str = "grpc_asyncio", request_type=analyticshub.CreateListingRequest -): +@pytest.mark.parametrize( + "request_type", + [ + analyticshub.CreateListingRequest(), + {}, + ], +) +async def test_create_listing_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsHubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4953,7 +4990,7 @@ async def test_create_listing_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_listing), "__call__") as call: @@ -5000,11 +5037,6 @@ async def test_create_listing_async( assert response.allow_only_metadata_sharing is True -@pytest.mark.asyncio -async def test_create_listing_async_from_dict(): - await test_create_listing_async(request_type=dict) - - def test_create_listing_field_headers(): client = AnalyticsHubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5185,8 +5217,8 @@ async def test_create_listing_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analyticshub.UpdateListingRequest, - dict, + analyticshub.UpdateListingRequest(), + {}, ], ) def test_update_listing(request_type, transport: str = "grpc"): @@ -5197,7 +5229,7 @@ def test_update_listing(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_listing), "__call__") as call: @@ -5263,7 +5295,8 @@ def test_update_listing_non_empty_request_with_auto_populated_field(): client.update_listing(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analyticshub.UpdateListingRequest() + request_msg = analyticshub.UpdateListingRequest() + assert args[0] == request_msg def test_update_listing_use_cached_wrapped_rpc(): @@ -5344,9 +5377,14 @@ async def test_update_listing_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_listing_async( - transport: str = "grpc_asyncio", request_type=analyticshub.UpdateListingRequest -): +@pytest.mark.parametrize( + "request_type", + [ + analyticshub.UpdateListingRequest(), + {}, + ], +) +async def test_update_listing_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsHubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5354,7 +5392,7 @@ async def test_update_listing_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_listing), "__call__") as call: @@ -5401,11 +5439,6 @@ async def test_update_listing_async( assert response.allow_only_metadata_sharing is True -@pytest.mark.asyncio -async def test_update_listing_async_from_dict(): - await test_update_listing_async(request_type=dict) - - def test_update_listing_field_headers(): client = AnalyticsHubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5586,8 +5619,8 @@ async def test_update_listing_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analyticshub.DeleteListingRequest, - dict, + analyticshub.DeleteListingRequest(), + {}, ], ) def test_delete_listing(request_type, transport: str = "grpc"): @@ -5598,7 +5631,7 @@ def test_delete_listing(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_listing), "__call__") as call: @@ -5639,9 +5672,10 @@ def test_delete_listing_non_empty_request_with_auto_populated_field(): client.delete_listing(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analyticshub.DeleteListingRequest( + request_msg = analyticshub.DeleteListingRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_listing_use_cached_wrapped_rpc(): @@ -5722,9 +5756,14 @@ async def test_delete_listing_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_listing_async( - transport: str = "grpc_asyncio", request_type=analyticshub.DeleteListingRequest -): +@pytest.mark.parametrize( + "request_type", + [ + analyticshub.DeleteListingRequest(), + {}, + ], +) +async def test_delete_listing_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsHubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5732,7 +5771,7 @@ async def test_delete_listing_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_listing), "__call__") as call: @@ -5750,11 +5789,6 @@ async def test_delete_listing_async( assert response is None -@pytest.mark.asyncio -async def test_delete_listing_async_from_dict(): - await test_delete_listing_async(request_type=dict) - - def test_delete_listing_field_headers(): client = AnalyticsHubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5897,8 +5931,8 @@ async def test_delete_listing_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analyticshub.SubscribeListingRequest, - dict, + analyticshub.SubscribeListingRequest(), + {}, ], ) def test_subscribe_listing(request_type, transport: str = "grpc"): @@ -5909,7 +5943,7 @@ def test_subscribe_listing(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5954,9 +5988,10 @@ def test_subscribe_listing_non_empty_request_with_auto_populated_field(): client.subscribe_listing(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analyticshub.SubscribeListingRequest( + request_msg = analyticshub.SubscribeListingRequest( name="name_value", ) + assert args[0] == request_msg def test_subscribe_listing_use_cached_wrapped_rpc(): @@ -6039,9 +6074,14 @@ async def test_subscribe_listing_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_subscribe_listing_async( - transport: str = "grpc_asyncio", request_type=analyticshub.SubscribeListingRequest -): +@pytest.mark.parametrize( + "request_type", + [ + analyticshub.SubscribeListingRequest(), + {}, + ], +) +async def test_subscribe_listing_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsHubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6049,7 +6089,7 @@ async def test_subscribe_listing_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( @@ -6071,11 +6111,6 @@ async def test_subscribe_listing_async( assert isinstance(response, analyticshub.SubscribeListingResponse) -@pytest.mark.asyncio -async def test_subscribe_listing_async_from_dict(): - await test_subscribe_listing_async(request_type=dict) - - def test_subscribe_listing_field_headers(): client = AnalyticsHubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6230,8 +6265,8 @@ async def test_subscribe_listing_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analyticshub.SubscribeDataExchangeRequest, - dict, + analyticshub.SubscribeDataExchangeRequest(), + {}, ], ) def test_subscribe_data_exchange(request_type, transport: str = "grpc"): @@ -6242,7 +6277,7 @@ def test_subscribe_data_exchange(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6290,12 +6325,13 @@ def test_subscribe_data_exchange_non_empty_request_with_auto_populated_field(): client.subscribe_data_exchange(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analyticshub.SubscribeDataExchangeRequest( + request_msg = analyticshub.SubscribeDataExchangeRequest( name="name_value", destination="destination_value", subscription="subscription_value", subscriber_contact="subscriber_contact_value", ) + assert args[0] == request_msg def test_subscribe_data_exchange_use_cached_wrapped_rpc(): @@ -6391,9 +6427,15 @@ async def test_subscribe_data_exchange_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analyticshub.SubscribeDataExchangeRequest(), + {}, + ], +) async def test_subscribe_data_exchange_async( - transport: str = "grpc_asyncio", - request_type=analyticshub.SubscribeDataExchangeRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsHubServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -6402,7 +6444,7 @@ async def test_subscribe_data_exchange_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( @@ -6424,11 +6466,6 @@ async def test_subscribe_data_exchange_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_subscribe_data_exchange_async_from_dict(): - await test_subscribe_data_exchange_async(request_type=dict) - - def test_subscribe_data_exchange_field_headers(): client = AnalyticsHubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6583,8 +6620,8 @@ async def test_subscribe_data_exchange_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analyticshub.RefreshSubscriptionRequest, - dict, + analyticshub.RefreshSubscriptionRequest(), + {}, ], ) def test_refresh_subscription(request_type, transport: str = "grpc"): @@ -6595,7 +6632,7 @@ def test_refresh_subscription(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6640,9 +6677,10 @@ def test_refresh_subscription_non_empty_request_with_auto_populated_field(): client.refresh_subscription(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analyticshub.RefreshSubscriptionRequest( + request_msg = analyticshub.RefreshSubscriptionRequest( name="name_value", ) + assert args[0] == request_msg def test_refresh_subscription_use_cached_wrapped_rpc(): @@ -6737,9 +6775,15 @@ async def test_refresh_subscription_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analyticshub.RefreshSubscriptionRequest(), + {}, + ], +) async def test_refresh_subscription_async( - transport: str = "grpc_asyncio", - request_type=analyticshub.RefreshSubscriptionRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsHubServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -6748,7 +6792,7 @@ async def test_refresh_subscription_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( @@ -6770,11 +6814,6 @@ async def test_refresh_subscription_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_refresh_subscription_async_from_dict(): - await test_refresh_subscription_async(request_type=dict) - - def test_refresh_subscription_field_headers(): client = AnalyticsHubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6929,8 +6968,8 @@ async def test_refresh_subscription_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analyticshub.GetSubscriptionRequest, - dict, + analyticshub.GetSubscriptionRequest(), + {}, ], ) def test_get_subscription(request_type, transport: str = "grpc"): @@ -6941,7 +6980,7 @@ def test_get_subscription(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_subscription), "__call__") as call: @@ -6998,9 +7037,10 @@ def test_get_subscription_non_empty_request_with_auto_populated_field(): client.get_subscription(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analyticshub.GetSubscriptionRequest( + request_msg = analyticshub.GetSubscriptionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_subscription_use_cached_wrapped_rpc(): @@ -7083,9 +7123,14 @@ async def test_get_subscription_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_subscription_async( - transport: str = "grpc_asyncio", request_type=analyticshub.GetSubscriptionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + analyticshub.GetSubscriptionRequest(), + {}, + ], +) +async def test_get_subscription_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsHubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7093,7 +7138,7 @@ async def test_get_subscription_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_subscription), "__call__") as call: @@ -7128,11 +7173,6 @@ async def test_get_subscription_async( assert response.log_linked_dataset_query_user_email is True -@pytest.mark.asyncio -async def test_get_subscription_async_from_dict(): - await test_get_subscription_async(request_type=dict) - - def test_get_subscription_field_headers(): client = AnalyticsHubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7279,8 +7319,8 @@ async def test_get_subscription_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analyticshub.ListSubscriptionsRequest, - dict, + analyticshub.ListSubscriptionsRequest(), + {}, ], ) def test_list_subscriptions(request_type, transport: str = "grpc"): @@ -7291,7 +7331,7 @@ def test_list_subscriptions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7341,11 +7381,12 @@ def test_list_subscriptions_non_empty_request_with_auto_populated_field(): client.list_subscriptions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analyticshub.ListSubscriptionsRequest( + request_msg = analyticshub.ListSubscriptionsRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_subscriptions_use_cached_wrapped_rpc(): @@ -7430,9 +7471,14 @@ async def test_list_subscriptions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_subscriptions_async( - transport: str = "grpc_asyncio", request_type=analyticshub.ListSubscriptionsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + analyticshub.ListSubscriptionsRequest(), + {}, + ], +) +async def test_list_subscriptions_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsHubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7440,7 +7486,7 @@ async def test_list_subscriptions_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( @@ -7465,11 +7511,6 @@ async def test_list_subscriptions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_subscriptions_async_from_dict(): - await test_list_subscriptions_async(request_type=dict) - - def test_list_subscriptions_field_headers(): client = AnalyticsHubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7822,8 +7863,8 @@ async def test_list_subscriptions_async_pages(): @pytest.mark.parametrize( "request_type", [ - analyticshub.ListSharedResourceSubscriptionsRequest, - dict, + analyticshub.ListSharedResourceSubscriptionsRequest(), + {}, ], ) def test_list_shared_resource_subscriptions(request_type, transport: str = "grpc"): @@ -7834,7 +7875,7 @@ def test_list_shared_resource_subscriptions(request_type, transport: str = "grpc # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7883,10 +7924,11 @@ def test_list_shared_resource_subscriptions_non_empty_request_with_auto_populate client.list_shared_resource_subscriptions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analyticshub.ListSharedResourceSubscriptionsRequest( + request_msg = analyticshub.ListSharedResourceSubscriptionsRequest( resource="resource_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_shared_resource_subscriptions_use_cached_wrapped_rpc(): @@ -7972,9 +8014,15 @@ async def test_list_shared_resource_subscriptions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analyticshub.ListSharedResourceSubscriptionsRequest(), + {}, + ], +) async def test_list_shared_resource_subscriptions_async( - transport: str = "grpc_asyncio", - request_type=analyticshub.ListSharedResourceSubscriptionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsHubServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -7983,7 +8031,7 @@ async def test_list_shared_resource_subscriptions_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( @@ -8008,11 +8056,6 @@ async def test_list_shared_resource_subscriptions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_shared_resource_subscriptions_async_from_dict(): - await test_list_shared_resource_subscriptions_async(request_type=dict) - - def test_list_shared_resource_subscriptions_field_headers(): client = AnalyticsHubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8369,8 +8412,8 @@ async def test_list_shared_resource_subscriptions_async_pages(): @pytest.mark.parametrize( "request_type", [ - analyticshub.RevokeSubscriptionRequest, - dict, + analyticshub.RevokeSubscriptionRequest(), + {}, ], ) def test_revoke_subscription(request_type, transport: str = "grpc"): @@ -8381,7 +8424,7 @@ def test_revoke_subscription(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8426,9 +8469,10 @@ def test_revoke_subscription_non_empty_request_with_auto_populated_field(): client.revoke_subscription(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analyticshub.RevokeSubscriptionRequest( + request_msg = analyticshub.RevokeSubscriptionRequest( name="name_value", ) + assert args[0] == request_msg def test_revoke_subscription_use_cached_wrapped_rpc(): @@ -8513,9 +8557,14 @@ async def test_revoke_subscription_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_revoke_subscription_async( - transport: str = "grpc_asyncio", request_type=analyticshub.RevokeSubscriptionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + analyticshub.RevokeSubscriptionRequest(), + {}, + ], +) +async def test_revoke_subscription_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsHubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8523,7 +8572,7 @@ async def test_revoke_subscription_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( @@ -8545,11 +8594,6 @@ async def test_revoke_subscription_async( assert isinstance(response, analyticshub.RevokeSubscriptionResponse) -@pytest.mark.asyncio -async def test_revoke_subscription_async_from_dict(): - await test_revoke_subscription_async(request_type=dict) - - def test_revoke_subscription_field_headers(): client = AnalyticsHubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8704,8 +8748,8 @@ async def test_revoke_subscription_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analyticshub.DeleteSubscriptionRequest, - dict, + analyticshub.DeleteSubscriptionRequest(), + {}, ], ) def test_delete_subscription(request_type, transport: str = "grpc"): @@ -8716,7 +8760,7 @@ def test_delete_subscription(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8761,9 +8805,10 @@ def test_delete_subscription_non_empty_request_with_auto_populated_field(): client.delete_subscription(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analyticshub.DeleteSubscriptionRequest( + request_msg = analyticshub.DeleteSubscriptionRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_subscription_use_cached_wrapped_rpc(): @@ -8858,9 +8903,14 @@ async def test_delete_subscription_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_subscription_async( - transport: str = "grpc_asyncio", request_type=analyticshub.DeleteSubscriptionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + analyticshub.DeleteSubscriptionRequest(), + {}, + ], +) +async def test_delete_subscription_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsHubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8868,7 +8918,7 @@ async def test_delete_subscription_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( @@ -8890,11 +8940,6 @@ async def test_delete_subscription_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_subscription_async_from_dict(): - await test_delete_subscription_async(request_type=dict) - - def test_delete_subscription_field_headers(): client = AnalyticsHubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9049,8 +9094,8 @@ async def test_delete_subscription_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.GetIamPolicyRequest, - dict, + iam_policy_pb2.GetIamPolicyRequest(), + {}, ], ) def test_get_iam_policy(request_type, transport: str = "grpc"): @@ -9061,7 +9106,7 @@ def test_get_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(type(client.transport.get_iam_policy), "__call__") as call: @@ -9107,9 +9152,10 @@ def test_get_iam_policy_non_empty_request_with_auto_populated_field(): client.get_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.GetIamPolicyRequest( + request_msg = iam_policy_pb2.GetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_get_iam_policy_use_cached_wrapped_rpc(): @@ -9190,9 +9236,14 @@ async def test_get_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.GetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.GetIamPolicyRequest(), + {}, + ], +) +async def test_get_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsHubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9200,7 +9251,7 @@ async def test_get_iam_policy_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_iam_policy), "__call__") as call: @@ -9225,11 +9276,6 @@ async def test_get_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_get_iam_policy_async_from_dict(): - await test_get_iam_policy_async(request_type=dict) - - def test_get_iam_policy_field_headers(): client = AnalyticsHubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9309,8 +9355,8 @@ def test_get_iam_policy_from_dict_foreign(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.SetIamPolicyRequest, - dict, + iam_policy_pb2.SetIamPolicyRequest(), + {}, ], ) def test_set_iam_policy(request_type, transport: str = "grpc"): @@ -9321,7 +9367,7 @@ def test_set_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(type(client.transport.set_iam_policy), "__call__") as call: @@ -9367,9 +9413,10 @@ def test_set_iam_policy_non_empty_request_with_auto_populated_field(): client.set_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.SetIamPolicyRequest( + request_msg = iam_policy_pb2.SetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_set_iam_policy_use_cached_wrapped_rpc(): @@ -9450,9 +9497,14 @@ async def test_set_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.SetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.SetIamPolicyRequest(), + {}, + ], +) +async def test_set_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsHubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9460,7 +9512,7 @@ async def test_set_iam_policy_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.set_iam_policy), "__call__") as call: @@ -9485,11 +9537,6 @@ async def test_set_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_set_iam_policy_async_from_dict(): - await test_set_iam_policy_async(request_type=dict) - - def test_set_iam_policy_field_headers(): client = AnalyticsHubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9570,8 +9617,8 @@ def test_set_iam_policy_from_dict_foreign(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.TestIamPermissionsRequest, - dict, + iam_policy_pb2.TestIamPermissionsRequest(), + {}, ], ) def test_test_iam_permissions(request_type, transport: str = "grpc"): @@ -9582,7 +9629,7 @@ def test_test_iam_permissions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9630,9 +9677,10 @@ def test_test_iam_permissions_non_empty_request_with_auto_populated_field(): client.test_iam_permissions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.TestIamPermissionsRequest( + request_msg = iam_policy_pb2.TestIamPermissionsRequest( resource="resource_value", ) + assert args[0] == request_msg def test_test_iam_permissions_use_cached_wrapped_rpc(): @@ -9717,9 +9765,15 @@ async def test_test_iam_permissions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.TestIamPermissionsRequest(), + {}, + ], +) async def test_test_iam_permissions_async( - transport: str = "grpc_asyncio", - request_type=iam_policy_pb2.TestIamPermissionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsHubServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -9728,7 +9782,7 @@ async def test_test_iam_permissions_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( @@ -9753,11 +9807,6 @@ async def test_test_iam_permissions_async( assert response.permissions == ["permissions_value"] -@pytest.mark.asyncio -async def test_test_iam_permissions_async_from_dict(): - await test_test_iam_permissions_async(request_type=dict) - - def test_test_iam_permissions_field_headers(): client = AnalyticsHubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9845,8 +9894,8 @@ def test_test_iam_permissions_from_dict_foreign(): @pytest.mark.parametrize( "request_type", [ - analyticshub.CreateQueryTemplateRequest, - dict, + analyticshub.CreateQueryTemplateRequest(), + {}, ], ) def test_create_query_template(request_type, transport: str = "grpc"): @@ -9857,7 +9906,7 @@ def test_create_query_template(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9918,10 +9967,11 @@ def test_create_query_template_non_empty_request_with_auto_populated_field(): client.create_query_template(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analyticshub.CreateQueryTemplateRequest( + request_msg = analyticshub.CreateQueryTemplateRequest( parent="parent_value", query_template_id="query_template_id_value", ) + assert args[0] == request_msg def test_create_query_template_use_cached_wrapped_rpc(): @@ -10007,9 +10057,15 @@ async def test_create_query_template_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analyticshub.CreateQueryTemplateRequest(), + {}, + ], +) async def test_create_query_template_async( - transport: str = "grpc_asyncio", - request_type=analyticshub.CreateQueryTemplateRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsHubServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -10018,7 +10074,7 @@ async def test_create_query_template_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( @@ -10055,11 +10111,6 @@ async def test_create_query_template_async( assert response.state == analyticshub.QueryTemplate.State.DRAFTED -@pytest.mark.asyncio -async def test_create_query_template_async_from_dict(): - await test_create_query_template_async(request_type=dict) - - def test_create_query_template_field_headers(): client = AnalyticsHubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10234,8 +10285,8 @@ async def test_create_query_template_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analyticshub.GetQueryTemplateRequest, - dict, + analyticshub.GetQueryTemplateRequest(), + {}, ], ) def test_get_query_template(request_type, transport: str = "grpc"): @@ -10246,7 +10297,7 @@ def test_get_query_template(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10306,9 +10357,10 @@ def test_get_query_template_non_empty_request_with_auto_populated_field(): client.get_query_template(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analyticshub.GetQueryTemplateRequest( + request_msg = analyticshub.GetQueryTemplateRequest( name="name_value", ) + assert args[0] == request_msg def test_get_query_template_use_cached_wrapped_rpc(): @@ -10393,9 +10445,14 @@ async def test_get_query_template_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_query_template_async( - transport: str = "grpc_asyncio", request_type=analyticshub.GetQueryTemplateRequest -): +@pytest.mark.parametrize( + "request_type", + [ + analyticshub.GetQueryTemplateRequest(), + {}, + ], +) +async def test_get_query_template_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsHubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10403,7 +10460,7 @@ async def test_get_query_template_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( @@ -10440,11 +10497,6 @@ async def test_get_query_template_async( assert response.state == analyticshub.QueryTemplate.State.DRAFTED -@pytest.mark.asyncio -async def test_get_query_template_async_from_dict(): - await test_get_query_template_async(request_type=dict) - - def test_get_query_template_field_headers(): client = AnalyticsHubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10599,8 +10651,8 @@ async def test_get_query_template_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analyticshub.ListQueryTemplatesRequest, - dict, + analyticshub.ListQueryTemplatesRequest(), + {}, ], ) def test_list_query_templates(request_type, transport: str = "grpc"): @@ -10611,7 +10663,7 @@ def test_list_query_templates(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10660,10 +10712,11 @@ def test_list_query_templates_non_empty_request_with_auto_populated_field(): client.list_query_templates(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analyticshub.ListQueryTemplatesRequest( + request_msg = analyticshub.ListQueryTemplatesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_query_templates_use_cached_wrapped_rpc(): @@ -10748,8 +10801,15 @@ async def test_list_query_templates_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analyticshub.ListQueryTemplatesRequest(), + {}, + ], +) async def test_list_query_templates_async( - transport: str = "grpc_asyncio", request_type=analyticshub.ListQueryTemplatesRequest + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsHubServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -10758,7 +10818,7 @@ async def test_list_query_templates_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( @@ -10783,11 +10843,6 @@ async def test_list_query_templates_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_query_templates_async_from_dict(): - await test_list_query_templates_async(request_type=dict) - - def test_list_query_templates_field_headers(): client = AnalyticsHubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11140,8 +11195,8 @@ async def test_list_query_templates_async_pages(): @pytest.mark.parametrize( "request_type", [ - analyticshub.UpdateQueryTemplateRequest, - dict, + analyticshub.UpdateQueryTemplateRequest(), + {}, ], ) def test_update_query_template(request_type, transport: str = "grpc"): @@ -11152,7 +11207,7 @@ def test_update_query_template(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11210,7 +11265,8 @@ def test_update_query_template_non_empty_request_with_auto_populated_field(): client.update_query_template(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analyticshub.UpdateQueryTemplateRequest() + request_msg = analyticshub.UpdateQueryTemplateRequest() + assert args[0] == request_msg def test_update_query_template_use_cached_wrapped_rpc(): @@ -11296,9 +11352,15 @@ async def test_update_query_template_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analyticshub.UpdateQueryTemplateRequest(), + {}, + ], +) async def test_update_query_template_async( - transport: str = "grpc_asyncio", - request_type=analyticshub.UpdateQueryTemplateRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsHubServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -11307,7 +11369,7 @@ async def test_update_query_template_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( @@ -11344,11 +11406,6 @@ async def test_update_query_template_async( assert response.state == analyticshub.QueryTemplate.State.DRAFTED -@pytest.mark.asyncio -async def test_update_query_template_async_from_dict(): - await test_update_query_template_async(request_type=dict) - - def test_update_query_template_field_headers(): client = AnalyticsHubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11513,8 +11570,8 @@ async def test_update_query_template_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analyticshub.DeleteQueryTemplateRequest, - dict, + analyticshub.DeleteQueryTemplateRequest(), + {}, ], ) def test_delete_query_template(request_type, transport: str = "grpc"): @@ -11525,7 +11582,7 @@ def test_delete_query_template(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11570,9 +11627,10 @@ def test_delete_query_template_non_empty_request_with_auto_populated_field(): client.delete_query_template(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analyticshub.DeleteQueryTemplateRequest( + request_msg = analyticshub.DeleteQueryTemplateRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_query_template_use_cached_wrapped_rpc(): @@ -11658,9 +11716,15 @@ async def test_delete_query_template_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analyticshub.DeleteQueryTemplateRequest(), + {}, + ], +) async def test_delete_query_template_async( - transport: str = "grpc_asyncio", - request_type=analyticshub.DeleteQueryTemplateRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsHubServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -11669,7 +11733,7 @@ async def test_delete_query_template_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( @@ -11689,11 +11753,6 @@ async def test_delete_query_template_async( assert response is None -@pytest.mark.asyncio -async def test_delete_query_template_async_from_dict(): - await test_delete_query_template_async(request_type=dict) - - def test_delete_query_template_field_headers(): client = AnalyticsHubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11844,8 +11903,8 @@ async def test_delete_query_template_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analyticshub.SubmitQueryTemplateRequest, - dict, + analyticshub.SubmitQueryTemplateRequest(), + {}, ], ) def test_submit_query_template(request_type, transport: str = "grpc"): @@ -11856,7 +11915,7 @@ def test_submit_query_template(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11916,9 +11975,10 @@ def test_submit_query_template_non_empty_request_with_auto_populated_field(): client.submit_query_template(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analyticshub.SubmitQueryTemplateRequest( + request_msg = analyticshub.SubmitQueryTemplateRequest( name="name_value", ) + assert args[0] == request_msg def test_submit_query_template_use_cached_wrapped_rpc(): @@ -12004,9 +12064,15 @@ async def test_submit_query_template_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analyticshub.SubmitQueryTemplateRequest(), + {}, + ], +) async def test_submit_query_template_async( - transport: str = "grpc_asyncio", - request_type=analyticshub.SubmitQueryTemplateRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsHubServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -12015,7 +12081,7 @@ async def test_submit_query_template_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( @@ -12052,11 +12118,6 @@ async def test_submit_query_template_async( assert response.state == analyticshub.QueryTemplate.State.DRAFTED -@pytest.mark.asyncio -async def test_submit_query_template_async_from_dict(): - await test_submit_query_template_async(request_type=dict) - - def test_submit_query_template_field_headers(): client = AnalyticsHubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12211,8 +12272,8 @@ async def test_submit_query_template_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analyticshub.ApproveQueryTemplateRequest, - dict, + analyticshub.ApproveQueryTemplateRequest(), + {}, ], ) def test_approve_query_template(request_type, transport: str = "grpc"): @@ -12223,7 +12284,7 @@ def test_approve_query_template(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -12283,9 +12344,10 @@ def test_approve_query_template_non_empty_request_with_auto_populated_field(): client.approve_query_template(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analyticshub.ApproveQueryTemplateRequest( + request_msg = analyticshub.ApproveQueryTemplateRequest( name="name_value", ) + assert args[0] == request_msg def test_approve_query_template_use_cached_wrapped_rpc(): @@ -12371,9 +12433,15 @@ async def test_approve_query_template_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + analyticshub.ApproveQueryTemplateRequest(), + {}, + ], +) async def test_approve_query_template_async( - transport: str = "grpc_asyncio", - request_type=analyticshub.ApproveQueryTemplateRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsHubServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -12382,7 +12450,7 @@ async def test_approve_query_template_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( @@ -12419,11 +12487,6 @@ async def test_approve_query_template_async( assert response.state == analyticshub.QueryTemplate.State.DRAFTED -@pytest.mark.asyncio -async def test_approve_query_template_async_from_dict(): - await test_approve_query_template_async(request_type=dict) - - def test_approve_query_template_field_headers(): client = AnalyticsHubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12699,7 +12762,6 @@ def test_list_data_exchanges_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analyticshub.ListDataExchangesRequest() - assert args[0] == request_msg @@ -12722,7 +12784,6 @@ def test_list_org_data_exchanges_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analyticshub.ListOrgDataExchangesRequest() - assert args[0] == request_msg @@ -12745,7 +12806,6 @@ def test_get_data_exchange_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analyticshub.GetDataExchangeRequest() - assert args[0] == request_msg @@ -12768,7 +12828,6 @@ def test_create_data_exchange_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analyticshub.CreateDataExchangeRequest() - assert args[0] == request_msg @@ -12791,7 +12850,6 @@ def test_update_data_exchange_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analyticshub.UpdateDataExchangeRequest() - assert args[0] == request_msg @@ -12814,7 +12872,6 @@ def test_delete_data_exchange_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analyticshub.DeleteDataExchangeRequest() - assert args[0] == request_msg @@ -12835,7 +12892,6 @@ def test_list_listings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analyticshub.ListListingsRequest() - assert args[0] == request_msg @@ -12856,7 +12912,6 @@ def test_get_listing_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analyticshub.GetListingRequest() - assert args[0] == request_msg @@ -12877,7 +12932,6 @@ def test_create_listing_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analyticshub.CreateListingRequest() - assert args[0] == request_msg @@ -12898,7 +12952,6 @@ def test_update_listing_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analyticshub.UpdateListingRequest() - assert args[0] == request_msg @@ -12919,7 +12972,6 @@ def test_delete_listing_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analyticshub.DeleteListingRequest() - assert args[0] == request_msg @@ -12942,7 +12994,6 @@ def test_subscribe_listing_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analyticshub.SubscribeListingRequest() - assert args[0] == request_msg @@ -12965,7 +13016,6 @@ def test_subscribe_data_exchange_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analyticshub.SubscribeDataExchangeRequest() - assert args[0] == request_msg @@ -12988,7 +13038,6 @@ def test_refresh_subscription_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analyticshub.RefreshSubscriptionRequest() - assert args[0] == request_msg @@ -13009,7 +13058,6 @@ def test_get_subscription_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analyticshub.GetSubscriptionRequest() - assert args[0] == request_msg @@ -13032,7 +13080,6 @@ def test_list_subscriptions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analyticshub.ListSubscriptionsRequest() - assert args[0] == request_msg @@ -13055,7 +13102,6 @@ def test_list_shared_resource_subscriptions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analyticshub.ListSharedResourceSubscriptionsRequest() - assert args[0] == request_msg @@ -13078,7 +13124,6 @@ def test_revoke_subscription_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analyticshub.RevokeSubscriptionRequest() - assert args[0] == request_msg @@ -13101,7 +13146,6 @@ def test_delete_subscription_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analyticshub.DeleteSubscriptionRequest() - assert args[0] == request_msg @@ -13122,7 +13166,6 @@ def test_get_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -13143,7 +13186,6 @@ def test_set_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -13166,7 +13208,6 @@ def test_test_iam_permissions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -13189,7 +13230,6 @@ def test_create_query_template_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analyticshub.CreateQueryTemplateRequest() - assert args[0] == request_msg @@ -13212,7 +13252,6 @@ def test_get_query_template_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analyticshub.GetQueryTemplateRequest() - assert args[0] == request_msg @@ -13235,7 +13274,6 @@ def test_list_query_templates_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analyticshub.ListQueryTemplatesRequest() - assert args[0] == request_msg @@ -13258,7 +13296,6 @@ def test_update_query_template_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analyticshub.UpdateQueryTemplateRequest() - assert args[0] == request_msg @@ -13281,7 +13318,6 @@ def test_delete_query_template_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analyticshub.DeleteQueryTemplateRequest() - assert args[0] == request_msg @@ -13304,7 +13340,6 @@ def test_submit_query_template_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analyticshub.SubmitQueryTemplateRequest() - assert args[0] == request_msg @@ -13327,7 +13362,6 @@ def test_approve_query_template_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analyticshub.ApproveQueryTemplateRequest() - assert args[0] == request_msg @@ -13370,7 +13404,6 @@ async def test_list_data_exchanges_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analyticshub.ListDataExchangesRequest() - assert args[0] == request_msg @@ -13399,7 +13432,6 @@ async def test_list_org_data_exchanges_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analyticshub.ListOrgDataExchangesRequest() - assert args[0] == request_msg @@ -13436,7 +13468,6 @@ async def test_get_data_exchange_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analyticshub.GetDataExchangeRequest() - assert args[0] == request_msg @@ -13473,7 +13504,6 @@ async def test_create_data_exchange_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analyticshub.CreateDataExchangeRequest() - assert args[0] == request_msg @@ -13510,7 +13540,6 @@ async def test_update_data_exchange_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analyticshub.UpdateDataExchangeRequest() - assert args[0] == request_msg @@ -13535,7 +13564,6 @@ async def test_delete_data_exchange_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analyticshub.DeleteDataExchangeRequest() - assert args[0] == request_msg @@ -13562,7 +13590,6 @@ async def test_list_listings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analyticshub.ListListingsRequest() - assert args[0] == request_msg @@ -13601,7 +13628,6 @@ async def test_get_listing_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analyticshub.GetListingRequest() - assert args[0] == request_msg @@ -13640,7 +13666,6 @@ async def test_create_listing_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analyticshub.CreateListingRequest() - assert args[0] == request_msg @@ -13679,7 +13704,6 @@ async def test_update_listing_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analyticshub.UpdateListingRequest() - assert args[0] == request_msg @@ -13702,7 +13726,6 @@ async def test_delete_listing_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analyticshub.DeleteListingRequest() - assert args[0] == request_msg @@ -13729,7 +13752,6 @@ async def test_subscribe_listing_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analyticshub.SubscribeListingRequest() - assert args[0] == request_msg @@ -13756,7 +13778,6 @@ async def test_subscribe_data_exchange_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analyticshub.SubscribeDataExchangeRequest() - assert args[0] == request_msg @@ -13783,7 +13804,6 @@ async def test_refresh_subscription_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analyticshub.RefreshSubscriptionRequest() - assert args[0] == request_msg @@ -13816,7 +13836,6 @@ async def test_get_subscription_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analyticshub.GetSubscriptionRequest() - assert args[0] == request_msg @@ -13845,7 +13864,6 @@ async def test_list_subscriptions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analyticshub.ListSubscriptionsRequest() - assert args[0] == request_msg @@ -13874,7 +13892,6 @@ async def test_list_shared_resource_subscriptions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analyticshub.ListSharedResourceSubscriptionsRequest() - assert args[0] == request_msg @@ -13901,7 +13918,6 @@ async def test_revoke_subscription_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analyticshub.RevokeSubscriptionRequest() - assert args[0] == request_msg @@ -13928,7 +13944,6 @@ async def test_delete_subscription_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analyticshub.DeleteSubscriptionRequest() - assert args[0] == request_msg @@ -13956,7 +13971,6 @@ async def test_get_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -13984,7 +13998,6 @@ async def test_set_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -14013,7 +14026,6 @@ async def test_test_iam_permissions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -14048,7 +14060,6 @@ async def test_create_query_template_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analyticshub.CreateQueryTemplateRequest() - assert args[0] == request_msg @@ -14083,7 +14094,6 @@ async def test_get_query_template_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analyticshub.GetQueryTemplateRequest() - assert args[0] == request_msg @@ -14112,7 +14122,6 @@ async def test_list_query_templates_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analyticshub.ListQueryTemplatesRequest() - assert args[0] == request_msg @@ -14147,7 +14156,6 @@ async def test_update_query_template_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analyticshub.UpdateQueryTemplateRequest() - assert args[0] == request_msg @@ -14172,7 +14180,6 @@ async def test_delete_query_template_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analyticshub.DeleteQueryTemplateRequest() - assert args[0] == request_msg @@ -14207,7 +14214,6 @@ async def test_submit_query_template_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analyticshub.SubmitQueryTemplateRequest() - assert args[0] == request_msg @@ -14242,7 +14248,6 @@ async def test_approve_query_template_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = analyticshub.ApproveQueryTemplateRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-bigquery-biglake/noxfile.py b/packages/google-cloud-bigquery-biglake/noxfile.py index 6840bb8cb8ba..0e743d519c6b 100644 --- a/packages/google-cloud-bigquery-biglake/noxfile.py +++ b/packages/google-cloud-bigquery-biglake/noxfile.py @@ -47,7 +47,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-bigquery-biglake" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-bigquery-biglake/setup.py b/packages/google-cloud-bigquery-biglake/setup.py index 4f5d58d8ee0e..7d62c606c564 100644 --- a/packages/google-cloud-bigquery-biglake/setup.py +++ b/packages/google-cloud-bigquery-biglake/setup.py @@ -45,7 +45,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/google-cloud-bigquery-biglake/testing/constraints-3.10.txt b/packages/google-cloud-bigquery-biglake/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-bigquery-biglake/testing/constraints-3.10.txt +++ b/packages/google-cloud-bigquery-biglake/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-bigquery-biglake/tests/unit/gapic/bigquery_biglake_v1/test_metastore_service.py b/packages/google-cloud-bigquery-biglake/tests/unit/gapic/bigquery_biglake_v1/test_metastore_service.py index ae4564e4669d..8a088f78416b 100644 --- a/packages/google-cloud-bigquery-biglake/tests/unit/gapic/bigquery_biglake_v1/test_metastore_service.py +++ b/packages/google-cloud-bigquery-biglake/tests/unit/gapic/bigquery_biglake_v1/test_metastore_service.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 @@ -109,6 +110,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" @@ -1345,8 +1361,8 @@ def test_metastore_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - metastore.CreateCatalogRequest, - dict, + metastore.CreateCatalogRequest(), + {}, ], ) def test_create_catalog(request_type, transport: str = "grpc"): @@ -1357,7 +1373,7 @@ def test_create_catalog(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_catalog), "__call__") as call: @@ -1402,10 +1418,11 @@ def test_create_catalog_non_empty_request_with_auto_populated_field(): client.create_catalog(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.CreateCatalogRequest( + request_msg = metastore.CreateCatalogRequest( parent="parent_value", catalog_id="catalog_id_value", ) + assert args[0] == request_msg def test_create_catalog_use_cached_wrapped_rpc(): @@ -1486,9 +1503,14 @@ async def test_create_catalog_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_catalog_async( - transport: str = "grpc_asyncio", request_type=metastore.CreateCatalogRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.CreateCatalogRequest(), + {}, + ], +) +async def test_create_catalog_async(request_type, transport: str = "grpc_asyncio"): client = MetastoreServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1496,7 +1518,7 @@ async def test_create_catalog_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_catalog), "__call__") as call: @@ -1519,11 +1541,6 @@ async def test_create_catalog_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_create_catalog_async_from_dict(): - await test_create_catalog_async(request_type=dict) - - def test_create_catalog_field_headers(): client = MetastoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1686,8 +1703,8 @@ async def test_create_catalog_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metastore.DeleteCatalogRequest, - dict, + metastore.DeleteCatalogRequest(), + {}, ], ) def test_delete_catalog(request_type, transport: str = "grpc"): @@ -1698,7 +1715,7 @@ def test_delete_catalog(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_catalog), "__call__") as call: @@ -1742,9 +1759,10 @@ def test_delete_catalog_non_empty_request_with_auto_populated_field(): client.delete_catalog(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.DeleteCatalogRequest( + request_msg = metastore.DeleteCatalogRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_catalog_use_cached_wrapped_rpc(): @@ -1825,9 +1843,14 @@ async def test_delete_catalog_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_catalog_async( - transport: str = "grpc_asyncio", request_type=metastore.DeleteCatalogRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.DeleteCatalogRequest(), + {}, + ], +) +async def test_delete_catalog_async(request_type, transport: str = "grpc_asyncio"): client = MetastoreServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1835,7 +1858,7 @@ async def test_delete_catalog_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_catalog), "__call__") as call: @@ -1858,11 +1881,6 @@ async def test_delete_catalog_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_delete_catalog_async_from_dict(): - await test_delete_catalog_async(request_type=dict) - - def test_delete_catalog_field_headers(): client = MetastoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2005,8 +2023,8 @@ async def test_delete_catalog_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metastore.GetCatalogRequest, - dict, + metastore.GetCatalogRequest(), + {}, ], ) def test_get_catalog(request_type, transport: str = "grpc"): @@ -2017,7 +2035,7 @@ def test_get_catalog(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_catalog), "__call__") as call: @@ -2061,9 +2079,10 @@ def test_get_catalog_non_empty_request_with_auto_populated_field(): client.get_catalog(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.GetCatalogRequest( + request_msg = metastore.GetCatalogRequest( name="name_value", ) + assert args[0] == request_msg def test_get_catalog_use_cached_wrapped_rpc(): @@ -2144,9 +2163,14 @@ async def test_get_catalog_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_catalog_async( - transport: str = "grpc_asyncio", request_type=metastore.GetCatalogRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.GetCatalogRequest(), + {}, + ], +) +async def test_get_catalog_async(request_type, transport: str = "grpc_asyncio"): client = MetastoreServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2154,7 +2178,7 @@ async def test_get_catalog_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_catalog), "__call__") as call: @@ -2177,11 +2201,6 @@ async def test_get_catalog_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_catalog_async_from_dict(): - await test_get_catalog_async(request_type=dict) - - def test_get_catalog_field_headers(): client = MetastoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2324,8 +2343,8 @@ async def test_get_catalog_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metastore.ListCatalogsRequest, - dict, + metastore.ListCatalogsRequest(), + {}, ], ) def test_list_catalogs(request_type, transport: str = "grpc"): @@ -2336,7 +2355,7 @@ def test_list_catalogs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_catalogs), "__call__") as call: @@ -2381,10 +2400,11 @@ def test_list_catalogs_non_empty_request_with_auto_populated_field(): client.list_catalogs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.ListCatalogsRequest( + request_msg = metastore.ListCatalogsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_catalogs_use_cached_wrapped_rpc(): @@ -2465,9 +2485,14 @@ async def test_list_catalogs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_catalogs_async( - transport: str = "grpc_asyncio", request_type=metastore.ListCatalogsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.ListCatalogsRequest(), + {}, + ], +) +async def test_list_catalogs_async(request_type, transport: str = "grpc_asyncio"): client = MetastoreServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2475,7 +2500,7 @@ async def test_list_catalogs_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_catalogs), "__call__") as call: @@ -2498,11 +2523,6 @@ async def test_list_catalogs_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_catalogs_async_from_dict(): - await test_list_catalogs_async(request_type=dict) - - def test_list_catalogs_field_headers(): client = MetastoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2839,8 +2859,8 @@ async def test_list_catalogs_async_pages(): @pytest.mark.parametrize( "request_type", [ - metastore.CreateDatabaseRequest, - dict, + metastore.CreateDatabaseRequest(), + {}, ], ) def test_create_database(request_type, transport: str = "grpc"): @@ -2851,7 +2871,7 @@ def test_create_database(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_database), "__call__") as call: @@ -2898,10 +2918,11 @@ def test_create_database_non_empty_request_with_auto_populated_field(): client.create_database(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.CreateDatabaseRequest( + request_msg = metastore.CreateDatabaseRequest( parent="parent_value", database_id="database_id_value", ) + assert args[0] == request_msg def test_create_database_use_cached_wrapped_rpc(): @@ -2982,9 +3003,14 @@ async def test_create_database_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_database_async( - transport: str = "grpc_asyncio", request_type=metastore.CreateDatabaseRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.CreateDatabaseRequest(), + {}, + ], +) +async def test_create_database_async(request_type, transport: str = "grpc_asyncio"): client = MetastoreServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2992,7 +3018,7 @@ async def test_create_database_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_database), "__call__") as call: @@ -3017,11 +3043,6 @@ async def test_create_database_async( assert response.type_ == metastore.Database.Type.HIVE -@pytest.mark.asyncio -async def test_create_database_async_from_dict(): - await test_create_database_async(request_type=dict) - - def test_create_database_field_headers(): client = MetastoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3208,8 +3229,8 @@ async def test_create_database_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metastore.DeleteDatabaseRequest, - dict, + metastore.DeleteDatabaseRequest(), + {}, ], ) def test_delete_database(request_type, transport: str = "grpc"): @@ -3220,7 +3241,7 @@ def test_delete_database(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_database), "__call__") as call: @@ -3266,9 +3287,10 @@ def test_delete_database_non_empty_request_with_auto_populated_field(): client.delete_database(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.DeleteDatabaseRequest( + request_msg = metastore.DeleteDatabaseRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_database_use_cached_wrapped_rpc(): @@ -3349,9 +3371,14 @@ async def test_delete_database_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_database_async( - transport: str = "grpc_asyncio", request_type=metastore.DeleteDatabaseRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.DeleteDatabaseRequest(), + {}, + ], +) +async def test_delete_database_async(request_type, transport: str = "grpc_asyncio"): client = MetastoreServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3359,7 +3386,7 @@ async def test_delete_database_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_database), "__call__") as call: @@ -3384,11 +3411,6 @@ async def test_delete_database_async( assert response.type_ == metastore.Database.Type.HIVE -@pytest.mark.asyncio -async def test_delete_database_async_from_dict(): - await test_delete_database_async(request_type=dict) - - def test_delete_database_field_headers(): client = MetastoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3531,8 +3553,8 @@ async def test_delete_database_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metastore.UpdateDatabaseRequest, - dict, + metastore.UpdateDatabaseRequest(), + {}, ], ) def test_update_database(request_type, transport: str = "grpc"): @@ -3543,7 +3565,7 @@ def test_update_database(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_database), "__call__") as call: @@ -3587,7 +3609,8 @@ def test_update_database_non_empty_request_with_auto_populated_field(): client.update_database(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.UpdateDatabaseRequest() + request_msg = metastore.UpdateDatabaseRequest() + assert args[0] == request_msg def test_update_database_use_cached_wrapped_rpc(): @@ -3668,9 +3691,14 @@ async def test_update_database_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_database_async( - transport: str = "grpc_asyncio", request_type=metastore.UpdateDatabaseRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.UpdateDatabaseRequest(), + {}, + ], +) +async def test_update_database_async(request_type, transport: str = "grpc_asyncio"): client = MetastoreServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3678,7 +3706,7 @@ async def test_update_database_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_database), "__call__") as call: @@ -3703,11 +3731,6 @@ async def test_update_database_async( assert response.type_ == metastore.Database.Type.HIVE -@pytest.mark.asyncio -async def test_update_database_async_from_dict(): - await test_update_database_async(request_type=dict) - - def test_update_database_field_headers(): client = MetastoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3884,8 +3907,8 @@ async def test_update_database_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metastore.GetDatabaseRequest, - dict, + metastore.GetDatabaseRequest(), + {}, ], ) def test_get_database(request_type, transport: str = "grpc"): @@ -3896,7 +3919,7 @@ def test_get_database(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_database), "__call__") as call: @@ -3942,9 +3965,10 @@ def test_get_database_non_empty_request_with_auto_populated_field(): client.get_database(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.GetDatabaseRequest( + request_msg = metastore.GetDatabaseRequest( name="name_value", ) + assert args[0] == request_msg def test_get_database_use_cached_wrapped_rpc(): @@ -4025,9 +4049,14 @@ async def test_get_database_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_database_async( - transport: str = "grpc_asyncio", request_type=metastore.GetDatabaseRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.GetDatabaseRequest(), + {}, + ], +) +async def test_get_database_async(request_type, transport: str = "grpc_asyncio"): client = MetastoreServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4035,7 +4064,7 @@ async def test_get_database_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_database), "__call__") as call: @@ -4060,11 +4089,6 @@ async def test_get_database_async( assert response.type_ == metastore.Database.Type.HIVE -@pytest.mark.asyncio -async def test_get_database_async_from_dict(): - await test_get_database_async(request_type=dict) - - def test_get_database_field_headers(): client = MetastoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4207,8 +4231,8 @@ async def test_get_database_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metastore.ListDatabasesRequest, - dict, + metastore.ListDatabasesRequest(), + {}, ], ) def test_list_databases(request_type, transport: str = "grpc"): @@ -4219,7 +4243,7 @@ def test_list_databases(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_databases), "__call__") as call: @@ -4264,10 +4288,11 @@ def test_list_databases_non_empty_request_with_auto_populated_field(): client.list_databases(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.ListDatabasesRequest( + request_msg = metastore.ListDatabasesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_databases_use_cached_wrapped_rpc(): @@ -4348,9 +4373,14 @@ async def test_list_databases_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_databases_async( - transport: str = "grpc_asyncio", request_type=metastore.ListDatabasesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.ListDatabasesRequest(), + {}, + ], +) +async def test_list_databases_async(request_type, transport: str = "grpc_asyncio"): client = MetastoreServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4358,7 +4388,7 @@ async def test_list_databases_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_databases), "__call__") as call: @@ -4381,11 +4411,6 @@ async def test_list_databases_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_databases_async_from_dict(): - await test_list_databases_async(request_type=dict) - - def test_list_databases_field_headers(): client = MetastoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4722,8 +4747,8 @@ async def test_list_databases_async_pages(): @pytest.mark.parametrize( "request_type", [ - metastore.CreateTableRequest, - dict, + metastore.CreateTableRequest(), + {}, ], ) def test_create_table(request_type, transport: str = "grpc"): @@ -4734,7 +4759,7 @@ def test_create_table(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_table), "__call__") as call: @@ -4783,10 +4808,11 @@ def test_create_table_non_empty_request_with_auto_populated_field(): client.create_table(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.CreateTableRequest( + request_msg = metastore.CreateTableRequest( parent="parent_value", table_id="table_id_value", ) + assert args[0] == request_msg def test_create_table_use_cached_wrapped_rpc(): @@ -4867,9 +4893,14 @@ async def test_create_table_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_table_async( - transport: str = "grpc_asyncio", request_type=metastore.CreateTableRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.CreateTableRequest(), + {}, + ], +) +async def test_create_table_async(request_type, transport: str = "grpc_asyncio"): client = MetastoreServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4877,7 +4908,7 @@ async def test_create_table_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_table), "__call__") as call: @@ -4904,11 +4935,6 @@ async def test_create_table_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_create_table_async_from_dict(): - await test_create_table_async(request_type=dict) - - def test_create_table_field_headers(): client = MetastoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5095,8 +5121,8 @@ async def test_create_table_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metastore.DeleteTableRequest, - dict, + metastore.DeleteTableRequest(), + {}, ], ) def test_delete_table(request_type, transport: str = "grpc"): @@ -5107,7 +5133,7 @@ def test_delete_table(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_table), "__call__") as call: @@ -5155,9 +5181,10 @@ def test_delete_table_non_empty_request_with_auto_populated_field(): client.delete_table(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.DeleteTableRequest( + request_msg = metastore.DeleteTableRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_table_use_cached_wrapped_rpc(): @@ -5238,9 +5265,14 @@ async def test_delete_table_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_table_async( - transport: str = "grpc_asyncio", request_type=metastore.DeleteTableRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.DeleteTableRequest(), + {}, + ], +) +async def test_delete_table_async(request_type, transport: str = "grpc_asyncio"): client = MetastoreServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5248,7 +5280,7 @@ async def test_delete_table_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_table), "__call__") as call: @@ -5275,11 +5307,6 @@ async def test_delete_table_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_delete_table_async_from_dict(): - await test_delete_table_async(request_type=dict) - - def test_delete_table_field_headers(): client = MetastoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5422,8 +5449,8 @@ async def test_delete_table_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metastore.UpdateTableRequest, - dict, + metastore.UpdateTableRequest(), + {}, ], ) def test_update_table(request_type, transport: str = "grpc"): @@ -5434,7 +5461,7 @@ def test_update_table(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_table), "__call__") as call: @@ -5480,7 +5507,8 @@ def test_update_table_non_empty_request_with_auto_populated_field(): client.update_table(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.UpdateTableRequest() + request_msg = metastore.UpdateTableRequest() + assert args[0] == request_msg def test_update_table_use_cached_wrapped_rpc(): @@ -5561,9 +5589,14 @@ async def test_update_table_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_table_async( - transport: str = "grpc_asyncio", request_type=metastore.UpdateTableRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.UpdateTableRequest(), + {}, + ], +) +async def test_update_table_async(request_type, transport: str = "grpc_asyncio"): client = MetastoreServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5571,7 +5604,7 @@ async def test_update_table_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_table), "__call__") as call: @@ -5598,11 +5631,6 @@ async def test_update_table_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_update_table_async_from_dict(): - await test_update_table_async(request_type=dict) - - def test_update_table_field_headers(): client = MetastoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5779,8 +5807,8 @@ async def test_update_table_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metastore.RenameTableRequest, - dict, + metastore.RenameTableRequest(), + {}, ], ) def test_rename_table(request_type, transport: str = "grpc"): @@ -5791,7 +5819,7 @@ def test_rename_table(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.rename_table), "__call__") as call: @@ -5840,10 +5868,11 @@ def test_rename_table_non_empty_request_with_auto_populated_field(): client.rename_table(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.RenameTableRequest( + request_msg = metastore.RenameTableRequest( name="name_value", new_name="new_name_value", ) + assert args[0] == request_msg def test_rename_table_use_cached_wrapped_rpc(): @@ -5924,9 +5953,14 @@ async def test_rename_table_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_rename_table_async( - transport: str = "grpc_asyncio", request_type=metastore.RenameTableRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.RenameTableRequest(), + {}, + ], +) +async def test_rename_table_async(request_type, transport: str = "grpc_asyncio"): client = MetastoreServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5934,7 +5968,7 @@ async def test_rename_table_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.rename_table), "__call__") as call: @@ -5961,11 +5995,6 @@ async def test_rename_table_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_rename_table_async_from_dict(): - await test_rename_table_async(request_type=dict) - - def test_rename_table_field_headers(): client = MetastoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6118,8 +6147,8 @@ async def test_rename_table_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metastore.GetTableRequest, - dict, + metastore.GetTableRequest(), + {}, ], ) def test_get_table(request_type, transport: str = "grpc"): @@ -6130,7 +6159,7 @@ def test_get_table(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_table), "__call__") as call: @@ -6178,9 +6207,10 @@ def test_get_table_non_empty_request_with_auto_populated_field(): client.get_table(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.GetTableRequest( + request_msg = metastore.GetTableRequest( name="name_value", ) + assert args[0] == request_msg def test_get_table_use_cached_wrapped_rpc(): @@ -6259,9 +6289,14 @@ async def test_get_table_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_table_async( - transport: str = "grpc_asyncio", request_type=metastore.GetTableRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.GetTableRequest(), + {}, + ], +) +async def test_get_table_async(request_type, transport: str = "grpc_asyncio"): client = MetastoreServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6269,7 +6304,7 @@ async def test_get_table_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_table), "__call__") as call: @@ -6296,11 +6331,6 @@ async def test_get_table_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_table_async_from_dict(): - await test_get_table_async(request_type=dict) - - def test_get_table_field_headers(): client = MetastoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6443,8 +6473,8 @@ async def test_get_table_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metastore.ListTablesRequest, - dict, + metastore.ListTablesRequest(), + {}, ], ) def test_list_tables(request_type, transport: str = "grpc"): @@ -6455,7 +6485,7 @@ def test_list_tables(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tables), "__call__") as call: @@ -6500,10 +6530,11 @@ def test_list_tables_non_empty_request_with_auto_populated_field(): client.list_tables(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.ListTablesRequest( + request_msg = metastore.ListTablesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_tables_use_cached_wrapped_rpc(): @@ -6584,9 +6615,14 @@ async def test_list_tables_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_tables_async( - transport: str = "grpc_asyncio", request_type=metastore.ListTablesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.ListTablesRequest(), + {}, + ], +) +async def test_list_tables_async(request_type, transport: str = "grpc_asyncio"): client = MetastoreServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6594,7 +6630,7 @@ async def test_list_tables_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_tables), "__call__") as call: @@ -6617,11 +6653,6 @@ async def test_list_tables_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_tables_async_from_dict(): - await test_list_tables_async(request_type=dict) - - def test_list_tables_field_headers(): client = MetastoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10120,7 +10151,6 @@ def test_create_catalog_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.CreateCatalogRequest() - assert args[0] == request_msg @@ -10141,7 +10171,6 @@ def test_delete_catalog_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.DeleteCatalogRequest() - assert args[0] == request_msg @@ -10162,7 +10191,6 @@ def test_get_catalog_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.GetCatalogRequest() - assert args[0] == request_msg @@ -10183,7 +10211,6 @@ def test_list_catalogs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.ListCatalogsRequest() - assert args[0] == request_msg @@ -10204,7 +10231,6 @@ def test_create_database_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.CreateDatabaseRequest() - assert args[0] == request_msg @@ -10225,7 +10251,6 @@ def test_delete_database_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.DeleteDatabaseRequest() - assert args[0] == request_msg @@ -10246,7 +10271,6 @@ def test_update_database_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.UpdateDatabaseRequest() - assert args[0] == request_msg @@ -10267,7 +10291,6 @@ def test_get_database_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.GetDatabaseRequest() - assert args[0] == request_msg @@ -10288,7 +10311,6 @@ def test_list_databases_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.ListDatabasesRequest() - assert args[0] == request_msg @@ -10309,7 +10331,6 @@ def test_create_table_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.CreateTableRequest() - assert args[0] == request_msg @@ -10330,7 +10351,6 @@ def test_delete_table_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.DeleteTableRequest() - assert args[0] == request_msg @@ -10351,7 +10371,6 @@ def test_update_table_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.UpdateTableRequest() - assert args[0] == request_msg @@ -10372,7 +10391,6 @@ def test_rename_table_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.RenameTableRequest() - assert args[0] == request_msg @@ -10393,7 +10411,6 @@ def test_get_table_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.GetTableRequest() - assert args[0] == request_msg @@ -10414,7 +10431,6 @@ def test_list_tables_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.ListTablesRequest() - assert args[0] == request_msg @@ -10455,7 +10471,6 @@ async def test_create_catalog_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.CreateCatalogRequest() - assert args[0] == request_msg @@ -10482,7 +10497,6 @@ async def test_delete_catalog_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.DeleteCatalogRequest() - assert args[0] == request_msg @@ -10509,7 +10523,6 @@ async def test_get_catalog_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.GetCatalogRequest() - assert args[0] == request_msg @@ -10536,7 +10549,6 @@ async def test_list_catalogs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.ListCatalogsRequest() - assert args[0] == request_msg @@ -10564,7 +10576,6 @@ async def test_create_database_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.CreateDatabaseRequest() - assert args[0] == request_msg @@ -10592,7 +10603,6 @@ async def test_delete_database_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.DeleteDatabaseRequest() - assert args[0] == request_msg @@ -10620,7 +10630,6 @@ async def test_update_database_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.UpdateDatabaseRequest() - assert args[0] == request_msg @@ -10648,7 +10657,6 @@ async def test_get_database_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.GetDatabaseRequest() - assert args[0] == request_msg @@ -10675,7 +10683,6 @@ async def test_list_databases_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.ListDatabasesRequest() - assert args[0] == request_msg @@ -10704,7 +10711,6 @@ async def test_create_table_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.CreateTableRequest() - assert args[0] == request_msg @@ -10733,7 +10739,6 @@ async def test_delete_table_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.DeleteTableRequest() - assert args[0] == request_msg @@ -10762,7 +10767,6 @@ async def test_update_table_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.UpdateTableRequest() - assert args[0] == request_msg @@ -10791,7 +10795,6 @@ async def test_rename_table_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.RenameTableRequest() - assert args[0] == request_msg @@ -10820,7 +10823,6 @@ async def test_get_table_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.GetTableRequest() - assert args[0] == request_msg @@ -10847,7 +10849,6 @@ async def test_list_tables_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.ListTablesRequest() - assert args[0] == request_msg @@ -13265,7 +13266,6 @@ def test_create_catalog_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.CreateCatalogRequest() - assert args[0] == request_msg @@ -13285,7 +13285,6 @@ def test_delete_catalog_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.DeleteCatalogRequest() - assert args[0] == request_msg @@ -13305,7 +13304,6 @@ def test_get_catalog_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.GetCatalogRequest() - assert args[0] == request_msg @@ -13325,7 +13323,6 @@ def test_list_catalogs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.ListCatalogsRequest() - assert args[0] == request_msg @@ -13345,7 +13342,6 @@ def test_create_database_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.CreateDatabaseRequest() - assert args[0] == request_msg @@ -13365,7 +13361,6 @@ def test_delete_database_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.DeleteDatabaseRequest() - assert args[0] == request_msg @@ -13385,7 +13380,6 @@ def test_update_database_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.UpdateDatabaseRequest() - assert args[0] == request_msg @@ -13405,7 +13399,6 @@ def test_get_database_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.GetDatabaseRequest() - assert args[0] == request_msg @@ -13425,7 +13418,6 @@ def test_list_databases_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.ListDatabasesRequest() - assert args[0] == request_msg @@ -13445,7 +13437,6 @@ def test_create_table_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.CreateTableRequest() - assert args[0] == request_msg @@ -13465,7 +13456,6 @@ def test_delete_table_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.DeleteTableRequest() - assert args[0] == request_msg @@ -13485,7 +13475,6 @@ def test_update_table_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.UpdateTableRequest() - assert args[0] == request_msg @@ -13505,7 +13494,6 @@ def test_rename_table_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.RenameTableRequest() - assert args[0] == request_msg @@ -13525,7 +13513,6 @@ def test_get_table_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.GetTableRequest() - assert args[0] == request_msg @@ -13545,7 +13532,6 @@ def test_list_tables_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.ListTablesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-bigquery-biglake/tests/unit/gapic/bigquery_biglake_v1alpha1/test_metastore_service.py b/packages/google-cloud-bigquery-biglake/tests/unit/gapic/bigquery_biglake_v1alpha1/test_metastore_service.py index 3ca9d29987bd..7acd5d2c069f 100644 --- a/packages/google-cloud-bigquery-biglake/tests/unit/gapic/bigquery_biglake_v1alpha1/test_metastore_service.py +++ b/packages/google-cloud-bigquery-biglake/tests/unit/gapic/bigquery_biglake_v1alpha1/test_metastore_service.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 @@ -109,6 +110,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" @@ -1345,8 +1361,8 @@ def test_metastore_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - metastore.CreateCatalogRequest, - dict, + metastore.CreateCatalogRequest(), + {}, ], ) def test_create_catalog(request_type, transport: str = "grpc"): @@ -1357,7 +1373,7 @@ def test_create_catalog(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_catalog), "__call__") as call: @@ -1402,10 +1418,11 @@ def test_create_catalog_non_empty_request_with_auto_populated_field(): client.create_catalog(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.CreateCatalogRequest( + request_msg = metastore.CreateCatalogRequest( parent="parent_value", catalog_id="catalog_id_value", ) + assert args[0] == request_msg def test_create_catalog_use_cached_wrapped_rpc(): @@ -1486,9 +1503,14 @@ async def test_create_catalog_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_catalog_async( - transport: str = "grpc_asyncio", request_type=metastore.CreateCatalogRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.CreateCatalogRequest(), + {}, + ], +) +async def test_create_catalog_async(request_type, transport: str = "grpc_asyncio"): client = MetastoreServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1496,7 +1518,7 @@ async def test_create_catalog_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_catalog), "__call__") as call: @@ -1519,11 +1541,6 @@ async def test_create_catalog_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_create_catalog_async_from_dict(): - await test_create_catalog_async(request_type=dict) - - def test_create_catalog_field_headers(): client = MetastoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1686,8 +1703,8 @@ async def test_create_catalog_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metastore.DeleteCatalogRequest, - dict, + metastore.DeleteCatalogRequest(), + {}, ], ) def test_delete_catalog(request_type, transport: str = "grpc"): @@ -1698,7 +1715,7 @@ def test_delete_catalog(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_catalog), "__call__") as call: @@ -1742,9 +1759,10 @@ def test_delete_catalog_non_empty_request_with_auto_populated_field(): client.delete_catalog(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.DeleteCatalogRequest( + request_msg = metastore.DeleteCatalogRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_catalog_use_cached_wrapped_rpc(): @@ -1825,9 +1843,14 @@ async def test_delete_catalog_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_catalog_async( - transport: str = "grpc_asyncio", request_type=metastore.DeleteCatalogRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.DeleteCatalogRequest(), + {}, + ], +) +async def test_delete_catalog_async(request_type, transport: str = "grpc_asyncio"): client = MetastoreServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1835,7 +1858,7 @@ async def test_delete_catalog_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_catalog), "__call__") as call: @@ -1858,11 +1881,6 @@ async def test_delete_catalog_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_delete_catalog_async_from_dict(): - await test_delete_catalog_async(request_type=dict) - - def test_delete_catalog_field_headers(): client = MetastoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2005,8 +2023,8 @@ async def test_delete_catalog_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metastore.GetCatalogRequest, - dict, + metastore.GetCatalogRequest(), + {}, ], ) def test_get_catalog(request_type, transport: str = "grpc"): @@ -2017,7 +2035,7 @@ def test_get_catalog(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_catalog), "__call__") as call: @@ -2061,9 +2079,10 @@ def test_get_catalog_non_empty_request_with_auto_populated_field(): client.get_catalog(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.GetCatalogRequest( + request_msg = metastore.GetCatalogRequest( name="name_value", ) + assert args[0] == request_msg def test_get_catalog_use_cached_wrapped_rpc(): @@ -2144,9 +2163,14 @@ async def test_get_catalog_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_catalog_async( - transport: str = "grpc_asyncio", request_type=metastore.GetCatalogRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.GetCatalogRequest(), + {}, + ], +) +async def test_get_catalog_async(request_type, transport: str = "grpc_asyncio"): client = MetastoreServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2154,7 +2178,7 @@ async def test_get_catalog_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_catalog), "__call__") as call: @@ -2177,11 +2201,6 @@ async def test_get_catalog_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_catalog_async_from_dict(): - await test_get_catalog_async(request_type=dict) - - def test_get_catalog_field_headers(): client = MetastoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2324,8 +2343,8 @@ async def test_get_catalog_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metastore.ListCatalogsRequest, - dict, + metastore.ListCatalogsRequest(), + {}, ], ) def test_list_catalogs(request_type, transport: str = "grpc"): @@ -2336,7 +2355,7 @@ def test_list_catalogs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_catalogs), "__call__") as call: @@ -2381,10 +2400,11 @@ def test_list_catalogs_non_empty_request_with_auto_populated_field(): client.list_catalogs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.ListCatalogsRequest( + request_msg = metastore.ListCatalogsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_catalogs_use_cached_wrapped_rpc(): @@ -2465,9 +2485,14 @@ async def test_list_catalogs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_catalogs_async( - transport: str = "grpc_asyncio", request_type=metastore.ListCatalogsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.ListCatalogsRequest(), + {}, + ], +) +async def test_list_catalogs_async(request_type, transport: str = "grpc_asyncio"): client = MetastoreServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2475,7 +2500,7 @@ async def test_list_catalogs_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_catalogs), "__call__") as call: @@ -2498,11 +2523,6 @@ async def test_list_catalogs_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_catalogs_async_from_dict(): - await test_list_catalogs_async(request_type=dict) - - def test_list_catalogs_field_headers(): client = MetastoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2839,8 +2859,8 @@ async def test_list_catalogs_async_pages(): @pytest.mark.parametrize( "request_type", [ - metastore.CreateDatabaseRequest, - dict, + metastore.CreateDatabaseRequest(), + {}, ], ) def test_create_database(request_type, transport: str = "grpc"): @@ -2851,7 +2871,7 @@ def test_create_database(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_database), "__call__") as call: @@ -2898,10 +2918,11 @@ def test_create_database_non_empty_request_with_auto_populated_field(): client.create_database(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.CreateDatabaseRequest( + request_msg = metastore.CreateDatabaseRequest( parent="parent_value", database_id="database_id_value", ) + assert args[0] == request_msg def test_create_database_use_cached_wrapped_rpc(): @@ -2982,9 +3003,14 @@ async def test_create_database_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_database_async( - transport: str = "grpc_asyncio", request_type=metastore.CreateDatabaseRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.CreateDatabaseRequest(), + {}, + ], +) +async def test_create_database_async(request_type, transport: str = "grpc_asyncio"): client = MetastoreServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2992,7 +3018,7 @@ async def test_create_database_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_database), "__call__") as call: @@ -3017,11 +3043,6 @@ async def test_create_database_async( assert response.type_ == metastore.Database.Type.HIVE -@pytest.mark.asyncio -async def test_create_database_async_from_dict(): - await test_create_database_async(request_type=dict) - - def test_create_database_field_headers(): client = MetastoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3208,8 +3229,8 @@ async def test_create_database_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metastore.DeleteDatabaseRequest, - dict, + metastore.DeleteDatabaseRequest(), + {}, ], ) def test_delete_database(request_type, transport: str = "grpc"): @@ -3220,7 +3241,7 @@ def test_delete_database(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_database), "__call__") as call: @@ -3266,9 +3287,10 @@ def test_delete_database_non_empty_request_with_auto_populated_field(): client.delete_database(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.DeleteDatabaseRequest( + request_msg = metastore.DeleteDatabaseRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_database_use_cached_wrapped_rpc(): @@ -3349,9 +3371,14 @@ async def test_delete_database_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_database_async( - transport: str = "grpc_asyncio", request_type=metastore.DeleteDatabaseRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.DeleteDatabaseRequest(), + {}, + ], +) +async def test_delete_database_async(request_type, transport: str = "grpc_asyncio"): client = MetastoreServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3359,7 +3386,7 @@ async def test_delete_database_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_database), "__call__") as call: @@ -3384,11 +3411,6 @@ async def test_delete_database_async( assert response.type_ == metastore.Database.Type.HIVE -@pytest.mark.asyncio -async def test_delete_database_async_from_dict(): - await test_delete_database_async(request_type=dict) - - def test_delete_database_field_headers(): client = MetastoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3531,8 +3553,8 @@ async def test_delete_database_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metastore.UpdateDatabaseRequest, - dict, + metastore.UpdateDatabaseRequest(), + {}, ], ) def test_update_database(request_type, transport: str = "grpc"): @@ -3543,7 +3565,7 @@ def test_update_database(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_database), "__call__") as call: @@ -3587,7 +3609,8 @@ def test_update_database_non_empty_request_with_auto_populated_field(): client.update_database(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.UpdateDatabaseRequest() + request_msg = metastore.UpdateDatabaseRequest() + assert args[0] == request_msg def test_update_database_use_cached_wrapped_rpc(): @@ -3668,9 +3691,14 @@ async def test_update_database_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_database_async( - transport: str = "grpc_asyncio", request_type=metastore.UpdateDatabaseRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.UpdateDatabaseRequest(), + {}, + ], +) +async def test_update_database_async(request_type, transport: str = "grpc_asyncio"): client = MetastoreServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3678,7 +3706,7 @@ async def test_update_database_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_database), "__call__") as call: @@ -3703,11 +3731,6 @@ async def test_update_database_async( assert response.type_ == metastore.Database.Type.HIVE -@pytest.mark.asyncio -async def test_update_database_async_from_dict(): - await test_update_database_async(request_type=dict) - - def test_update_database_field_headers(): client = MetastoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3884,8 +3907,8 @@ async def test_update_database_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metastore.GetDatabaseRequest, - dict, + metastore.GetDatabaseRequest(), + {}, ], ) def test_get_database(request_type, transport: str = "grpc"): @@ -3896,7 +3919,7 @@ def test_get_database(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_database), "__call__") as call: @@ -3942,9 +3965,10 @@ def test_get_database_non_empty_request_with_auto_populated_field(): client.get_database(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.GetDatabaseRequest( + request_msg = metastore.GetDatabaseRequest( name="name_value", ) + assert args[0] == request_msg def test_get_database_use_cached_wrapped_rpc(): @@ -4025,9 +4049,14 @@ async def test_get_database_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_database_async( - transport: str = "grpc_asyncio", request_type=metastore.GetDatabaseRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.GetDatabaseRequest(), + {}, + ], +) +async def test_get_database_async(request_type, transport: str = "grpc_asyncio"): client = MetastoreServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4035,7 +4064,7 @@ async def test_get_database_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_database), "__call__") as call: @@ -4060,11 +4089,6 @@ async def test_get_database_async( assert response.type_ == metastore.Database.Type.HIVE -@pytest.mark.asyncio -async def test_get_database_async_from_dict(): - await test_get_database_async(request_type=dict) - - def test_get_database_field_headers(): client = MetastoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4207,8 +4231,8 @@ async def test_get_database_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metastore.ListDatabasesRequest, - dict, + metastore.ListDatabasesRequest(), + {}, ], ) def test_list_databases(request_type, transport: str = "grpc"): @@ -4219,7 +4243,7 @@ def test_list_databases(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_databases), "__call__") as call: @@ -4264,10 +4288,11 @@ def test_list_databases_non_empty_request_with_auto_populated_field(): client.list_databases(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.ListDatabasesRequest( + request_msg = metastore.ListDatabasesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_databases_use_cached_wrapped_rpc(): @@ -4348,9 +4373,14 @@ async def test_list_databases_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_databases_async( - transport: str = "grpc_asyncio", request_type=metastore.ListDatabasesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.ListDatabasesRequest(), + {}, + ], +) +async def test_list_databases_async(request_type, transport: str = "grpc_asyncio"): client = MetastoreServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4358,7 +4388,7 @@ async def test_list_databases_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_databases), "__call__") as call: @@ -4381,11 +4411,6 @@ async def test_list_databases_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_databases_async_from_dict(): - await test_list_databases_async(request_type=dict) - - def test_list_databases_field_headers(): client = MetastoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4722,8 +4747,8 @@ async def test_list_databases_async_pages(): @pytest.mark.parametrize( "request_type", [ - metastore.CreateTableRequest, - dict, + metastore.CreateTableRequest(), + {}, ], ) def test_create_table(request_type, transport: str = "grpc"): @@ -4734,7 +4759,7 @@ def test_create_table(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_table), "__call__") as call: @@ -4783,10 +4808,11 @@ def test_create_table_non_empty_request_with_auto_populated_field(): client.create_table(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.CreateTableRequest( + request_msg = metastore.CreateTableRequest( parent="parent_value", table_id="table_id_value", ) + assert args[0] == request_msg def test_create_table_use_cached_wrapped_rpc(): @@ -4867,9 +4893,14 @@ async def test_create_table_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_table_async( - transport: str = "grpc_asyncio", request_type=metastore.CreateTableRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.CreateTableRequest(), + {}, + ], +) +async def test_create_table_async(request_type, transport: str = "grpc_asyncio"): client = MetastoreServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4877,7 +4908,7 @@ async def test_create_table_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_table), "__call__") as call: @@ -4904,11 +4935,6 @@ async def test_create_table_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_create_table_async_from_dict(): - await test_create_table_async(request_type=dict) - - def test_create_table_field_headers(): client = MetastoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5095,8 +5121,8 @@ async def test_create_table_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metastore.DeleteTableRequest, - dict, + metastore.DeleteTableRequest(), + {}, ], ) def test_delete_table(request_type, transport: str = "grpc"): @@ -5107,7 +5133,7 @@ def test_delete_table(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_table), "__call__") as call: @@ -5155,9 +5181,10 @@ def test_delete_table_non_empty_request_with_auto_populated_field(): client.delete_table(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.DeleteTableRequest( + request_msg = metastore.DeleteTableRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_table_use_cached_wrapped_rpc(): @@ -5238,9 +5265,14 @@ async def test_delete_table_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_table_async( - transport: str = "grpc_asyncio", request_type=metastore.DeleteTableRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.DeleteTableRequest(), + {}, + ], +) +async def test_delete_table_async(request_type, transport: str = "grpc_asyncio"): client = MetastoreServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5248,7 +5280,7 @@ async def test_delete_table_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_table), "__call__") as call: @@ -5275,11 +5307,6 @@ async def test_delete_table_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_delete_table_async_from_dict(): - await test_delete_table_async(request_type=dict) - - def test_delete_table_field_headers(): client = MetastoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5422,8 +5449,8 @@ async def test_delete_table_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metastore.UpdateTableRequest, - dict, + metastore.UpdateTableRequest(), + {}, ], ) def test_update_table(request_type, transport: str = "grpc"): @@ -5434,7 +5461,7 @@ def test_update_table(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_table), "__call__") as call: @@ -5480,7 +5507,8 @@ def test_update_table_non_empty_request_with_auto_populated_field(): client.update_table(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.UpdateTableRequest() + request_msg = metastore.UpdateTableRequest() + assert args[0] == request_msg def test_update_table_use_cached_wrapped_rpc(): @@ -5561,9 +5589,14 @@ async def test_update_table_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_table_async( - transport: str = "grpc_asyncio", request_type=metastore.UpdateTableRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.UpdateTableRequest(), + {}, + ], +) +async def test_update_table_async(request_type, transport: str = "grpc_asyncio"): client = MetastoreServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5571,7 +5604,7 @@ async def test_update_table_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_table), "__call__") as call: @@ -5598,11 +5631,6 @@ async def test_update_table_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_update_table_async_from_dict(): - await test_update_table_async(request_type=dict) - - def test_update_table_field_headers(): client = MetastoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5779,8 +5807,8 @@ async def test_update_table_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metastore.RenameTableRequest, - dict, + metastore.RenameTableRequest(), + {}, ], ) def test_rename_table(request_type, transport: str = "grpc"): @@ -5791,7 +5819,7 @@ def test_rename_table(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.rename_table), "__call__") as call: @@ -5840,10 +5868,11 @@ def test_rename_table_non_empty_request_with_auto_populated_field(): client.rename_table(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.RenameTableRequest( + request_msg = metastore.RenameTableRequest( name="name_value", new_name="new_name_value", ) + assert args[0] == request_msg def test_rename_table_use_cached_wrapped_rpc(): @@ -5924,9 +5953,14 @@ async def test_rename_table_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_rename_table_async( - transport: str = "grpc_asyncio", request_type=metastore.RenameTableRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.RenameTableRequest(), + {}, + ], +) +async def test_rename_table_async(request_type, transport: str = "grpc_asyncio"): client = MetastoreServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5934,7 +5968,7 @@ async def test_rename_table_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.rename_table), "__call__") as call: @@ -5961,11 +5995,6 @@ async def test_rename_table_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_rename_table_async_from_dict(): - await test_rename_table_async(request_type=dict) - - def test_rename_table_field_headers(): client = MetastoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6118,8 +6147,8 @@ async def test_rename_table_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metastore.GetTableRequest, - dict, + metastore.GetTableRequest(), + {}, ], ) def test_get_table(request_type, transport: str = "grpc"): @@ -6130,7 +6159,7 @@ def test_get_table(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_table), "__call__") as call: @@ -6178,9 +6207,10 @@ def test_get_table_non_empty_request_with_auto_populated_field(): client.get_table(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.GetTableRequest( + request_msg = metastore.GetTableRequest( name="name_value", ) + assert args[0] == request_msg def test_get_table_use_cached_wrapped_rpc(): @@ -6259,9 +6289,14 @@ async def test_get_table_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_table_async( - transport: str = "grpc_asyncio", request_type=metastore.GetTableRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.GetTableRequest(), + {}, + ], +) +async def test_get_table_async(request_type, transport: str = "grpc_asyncio"): client = MetastoreServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6269,7 +6304,7 @@ async def test_get_table_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_table), "__call__") as call: @@ -6296,11 +6331,6 @@ async def test_get_table_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_table_async_from_dict(): - await test_get_table_async(request_type=dict) - - def test_get_table_field_headers(): client = MetastoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6443,8 +6473,8 @@ async def test_get_table_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metastore.ListTablesRequest, - dict, + metastore.ListTablesRequest(), + {}, ], ) def test_list_tables(request_type, transport: str = "grpc"): @@ -6455,7 +6485,7 @@ def test_list_tables(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tables), "__call__") as call: @@ -6500,10 +6530,11 @@ def test_list_tables_non_empty_request_with_auto_populated_field(): client.list_tables(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.ListTablesRequest( + request_msg = metastore.ListTablesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_tables_use_cached_wrapped_rpc(): @@ -6584,9 +6615,14 @@ async def test_list_tables_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_tables_async( - transport: str = "grpc_asyncio", request_type=metastore.ListTablesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.ListTablesRequest(), + {}, + ], +) +async def test_list_tables_async(request_type, transport: str = "grpc_asyncio"): client = MetastoreServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6594,7 +6630,7 @@ async def test_list_tables_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_tables), "__call__") as call: @@ -6617,11 +6653,6 @@ async def test_list_tables_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_tables_async_from_dict(): - await test_list_tables_async(request_type=dict) - - def test_list_tables_field_headers(): client = MetastoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6958,8 +6989,8 @@ async def test_list_tables_async_pages(): @pytest.mark.parametrize( "request_type", [ - metastore.CreateLockRequest, - dict, + metastore.CreateLockRequest(), + {}, ], ) def test_create_lock(request_type, transport: str = "grpc"): @@ -6970,7 +7001,7 @@ def test_create_lock(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_lock), "__call__") as call: @@ -7019,9 +7050,10 @@ def test_create_lock_non_empty_request_with_auto_populated_field(): client.create_lock(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.CreateLockRequest( + request_msg = metastore.CreateLockRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_lock_use_cached_wrapped_rpc(): @@ -7102,9 +7134,14 @@ async def test_create_lock_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_lock_async( - transport: str = "grpc_asyncio", request_type=metastore.CreateLockRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.CreateLockRequest(), + {}, + ], +) +async def test_create_lock_async(request_type, transport: str = "grpc_asyncio"): client = MetastoreServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7112,7 +7149,7 @@ async def test_create_lock_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_lock), "__call__") as call: @@ -7139,11 +7176,6 @@ async def test_create_lock_async( assert response.state == metastore.Lock.State.WAITING -@pytest.mark.asyncio -async def test_create_lock_async_from_dict(): - await test_create_lock_async(request_type=dict) - - def test_create_lock_field_headers(): client = MetastoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7296,8 +7328,8 @@ async def test_create_lock_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metastore.DeleteLockRequest, - dict, + metastore.DeleteLockRequest(), + {}, ], ) def test_delete_lock(request_type, transport: str = "grpc"): @@ -7308,7 +7340,7 @@ def test_delete_lock(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_lock), "__call__") as call: @@ -7349,9 +7381,10 @@ def test_delete_lock_non_empty_request_with_auto_populated_field(): client.delete_lock(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.DeleteLockRequest( + request_msg = metastore.DeleteLockRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_lock_use_cached_wrapped_rpc(): @@ -7432,9 +7465,14 @@ async def test_delete_lock_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_lock_async( - transport: str = "grpc_asyncio", request_type=metastore.DeleteLockRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.DeleteLockRequest(), + {}, + ], +) +async def test_delete_lock_async(request_type, transport: str = "grpc_asyncio"): client = MetastoreServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7442,7 +7480,7 @@ async def test_delete_lock_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_lock), "__call__") as call: @@ -7460,11 +7498,6 @@ async def test_delete_lock_async( assert response is None -@pytest.mark.asyncio -async def test_delete_lock_async_from_dict(): - await test_delete_lock_async(request_type=dict) - - def test_delete_lock_field_headers(): client = MetastoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7607,8 +7640,8 @@ async def test_delete_lock_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metastore.CheckLockRequest, - dict, + metastore.CheckLockRequest(), + {}, ], ) def test_check_lock(request_type, transport: str = "grpc"): @@ -7619,7 +7652,7 @@ def test_check_lock(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.check_lock), "__call__") as call: @@ -7668,9 +7701,10 @@ def test_check_lock_non_empty_request_with_auto_populated_field(): client.check_lock(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.CheckLockRequest( + request_msg = metastore.CheckLockRequest( name="name_value", ) + assert args[0] == request_msg def test_check_lock_use_cached_wrapped_rpc(): @@ -7749,9 +7783,14 @@ async def test_check_lock_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_check_lock_async( - transport: str = "grpc_asyncio", request_type=metastore.CheckLockRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.CheckLockRequest(), + {}, + ], +) +async def test_check_lock_async(request_type, transport: str = "grpc_asyncio"): client = MetastoreServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7759,7 +7798,7 @@ async def test_check_lock_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.check_lock), "__call__") as call: @@ -7786,11 +7825,6 @@ async def test_check_lock_async( assert response.state == metastore.Lock.State.WAITING -@pytest.mark.asyncio -async def test_check_lock_async_from_dict(): - await test_check_lock_async(request_type=dict) - - def test_check_lock_field_headers(): client = MetastoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7933,8 +7967,8 @@ async def test_check_lock_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metastore.ListLocksRequest, - dict, + metastore.ListLocksRequest(), + {}, ], ) def test_list_locks(request_type, transport: str = "grpc"): @@ -7945,7 +7979,7 @@ def test_list_locks(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_locks), "__call__") as call: @@ -7990,10 +8024,11 @@ def test_list_locks_non_empty_request_with_auto_populated_field(): client.list_locks(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.ListLocksRequest( + request_msg = metastore.ListLocksRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_locks_use_cached_wrapped_rpc(): @@ -8072,9 +8107,14 @@ async def test_list_locks_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_list_locks_async( - transport: str = "grpc_asyncio", request_type=metastore.ListLocksRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.ListLocksRequest(), + {}, + ], +) +async def test_list_locks_async(request_type, transport: str = "grpc_asyncio"): client = MetastoreServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8082,7 +8122,7 @@ async def test_list_locks_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_locks), "__call__") as call: @@ -8105,11 +8145,6 @@ async def test_list_locks_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_locks_async_from_dict(): - await test_list_locks_async(request_type=dict) - - def test_list_locks_field_headers(): client = MetastoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12409,7 +12444,6 @@ def test_create_catalog_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.CreateCatalogRequest() - assert args[0] == request_msg @@ -12430,7 +12464,6 @@ def test_delete_catalog_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.DeleteCatalogRequest() - assert args[0] == request_msg @@ -12451,7 +12484,6 @@ def test_get_catalog_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.GetCatalogRequest() - assert args[0] == request_msg @@ -12472,7 +12504,6 @@ def test_list_catalogs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.ListCatalogsRequest() - assert args[0] == request_msg @@ -12493,7 +12524,6 @@ def test_create_database_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.CreateDatabaseRequest() - assert args[0] == request_msg @@ -12514,7 +12544,6 @@ def test_delete_database_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.DeleteDatabaseRequest() - assert args[0] == request_msg @@ -12535,7 +12564,6 @@ def test_update_database_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.UpdateDatabaseRequest() - assert args[0] == request_msg @@ -12556,7 +12584,6 @@ def test_get_database_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.GetDatabaseRequest() - assert args[0] == request_msg @@ -12577,7 +12604,6 @@ def test_list_databases_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.ListDatabasesRequest() - assert args[0] == request_msg @@ -12598,7 +12624,6 @@ def test_create_table_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.CreateTableRequest() - assert args[0] == request_msg @@ -12619,7 +12644,6 @@ def test_delete_table_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.DeleteTableRequest() - assert args[0] == request_msg @@ -12640,7 +12664,6 @@ def test_update_table_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.UpdateTableRequest() - assert args[0] == request_msg @@ -12661,7 +12684,6 @@ def test_rename_table_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.RenameTableRequest() - assert args[0] == request_msg @@ -12682,7 +12704,6 @@ def test_get_table_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.GetTableRequest() - assert args[0] == request_msg @@ -12703,7 +12724,6 @@ def test_list_tables_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.ListTablesRequest() - assert args[0] == request_msg @@ -12724,7 +12744,6 @@ def test_create_lock_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.CreateLockRequest() - assert args[0] == request_msg @@ -12745,7 +12764,6 @@ def test_delete_lock_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.DeleteLockRequest() - assert args[0] == request_msg @@ -12766,7 +12784,6 @@ def test_check_lock_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.CheckLockRequest() - assert args[0] == request_msg @@ -12787,7 +12804,6 @@ def test_list_locks_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.ListLocksRequest() - assert args[0] == request_msg @@ -12828,7 +12844,6 @@ async def test_create_catalog_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.CreateCatalogRequest() - assert args[0] == request_msg @@ -12855,7 +12870,6 @@ async def test_delete_catalog_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.DeleteCatalogRequest() - assert args[0] == request_msg @@ -12882,7 +12896,6 @@ async def test_get_catalog_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.GetCatalogRequest() - assert args[0] == request_msg @@ -12909,7 +12922,6 @@ async def test_list_catalogs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.ListCatalogsRequest() - assert args[0] == request_msg @@ -12937,7 +12949,6 @@ async def test_create_database_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.CreateDatabaseRequest() - assert args[0] == request_msg @@ -12965,7 +12976,6 @@ async def test_delete_database_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.DeleteDatabaseRequest() - assert args[0] == request_msg @@ -12993,7 +13003,6 @@ async def test_update_database_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.UpdateDatabaseRequest() - assert args[0] == request_msg @@ -13021,7 +13030,6 @@ async def test_get_database_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.GetDatabaseRequest() - assert args[0] == request_msg @@ -13048,7 +13056,6 @@ async def test_list_databases_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.ListDatabasesRequest() - assert args[0] == request_msg @@ -13077,7 +13084,6 @@ async def test_create_table_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.CreateTableRequest() - assert args[0] == request_msg @@ -13106,7 +13112,6 @@ async def test_delete_table_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.DeleteTableRequest() - assert args[0] == request_msg @@ -13135,7 +13140,6 @@ async def test_update_table_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.UpdateTableRequest() - assert args[0] == request_msg @@ -13164,7 +13168,6 @@ async def test_rename_table_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.RenameTableRequest() - assert args[0] == request_msg @@ -13193,7 +13196,6 @@ async def test_get_table_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.GetTableRequest() - assert args[0] == request_msg @@ -13220,7 +13222,6 @@ async def test_list_tables_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.ListTablesRequest() - assert args[0] == request_msg @@ -13249,7 +13250,6 @@ async def test_create_lock_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.CreateLockRequest() - assert args[0] == request_msg @@ -13272,7 +13272,6 @@ async def test_delete_lock_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.DeleteLockRequest() - assert args[0] == request_msg @@ -13301,7 +13300,6 @@ async def test_check_lock_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.CheckLockRequest() - assert args[0] == request_msg @@ -13328,7 +13326,6 @@ async def test_list_locks_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.ListLocksRequest() - assert args[0] == request_msg @@ -16332,7 +16329,6 @@ def test_create_catalog_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.CreateCatalogRequest() - assert args[0] == request_msg @@ -16352,7 +16348,6 @@ def test_delete_catalog_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.DeleteCatalogRequest() - assert args[0] == request_msg @@ -16372,7 +16367,6 @@ def test_get_catalog_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.GetCatalogRequest() - assert args[0] == request_msg @@ -16392,7 +16386,6 @@ def test_list_catalogs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.ListCatalogsRequest() - assert args[0] == request_msg @@ -16412,7 +16405,6 @@ def test_create_database_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.CreateDatabaseRequest() - assert args[0] == request_msg @@ -16432,7 +16424,6 @@ def test_delete_database_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.DeleteDatabaseRequest() - assert args[0] == request_msg @@ -16452,7 +16443,6 @@ def test_update_database_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.UpdateDatabaseRequest() - assert args[0] == request_msg @@ -16472,7 +16462,6 @@ def test_get_database_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.GetDatabaseRequest() - assert args[0] == request_msg @@ -16492,7 +16481,6 @@ def test_list_databases_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.ListDatabasesRequest() - assert args[0] == request_msg @@ -16512,7 +16500,6 @@ def test_create_table_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.CreateTableRequest() - assert args[0] == request_msg @@ -16532,7 +16519,6 @@ def test_delete_table_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.DeleteTableRequest() - assert args[0] == request_msg @@ -16552,7 +16538,6 @@ def test_update_table_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.UpdateTableRequest() - assert args[0] == request_msg @@ -16572,7 +16557,6 @@ def test_rename_table_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.RenameTableRequest() - assert args[0] == request_msg @@ -16592,7 +16576,6 @@ def test_get_table_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.GetTableRequest() - assert args[0] == request_msg @@ -16612,7 +16595,6 @@ def test_list_tables_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.ListTablesRequest() - assert args[0] == request_msg @@ -16632,7 +16614,6 @@ def test_create_lock_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.CreateLockRequest() - assert args[0] == request_msg @@ -16652,7 +16633,6 @@ def test_delete_lock_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.DeleteLockRequest() - assert args[0] == request_msg @@ -16672,7 +16652,6 @@ def test_check_lock_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.CheckLockRequest() - assert args[0] == request_msg @@ -16692,7 +16671,6 @@ def test_list_locks_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.ListLocksRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-bigquery-connection/noxfile.py b/packages/google-cloud-bigquery-connection/noxfile.py index 3eb87ea771f7..b6a28dbb4efc 100644 --- a/packages/google-cloud-bigquery-connection/noxfile.py +++ b/packages/google-cloud-bigquery-connection/noxfile.py @@ -47,7 +47,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-bigquery-connection" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-bigquery-connection/setup.py b/packages/google-cloud-bigquery-connection/setup.py index 3bc4592a6ce9..9515d7a90b2e 100644 --- a/packages/google-cloud-bigquery-connection/setup.py +++ b/packages/google-cloud-bigquery-connection/setup.py @@ -45,7 +45,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/google-cloud-bigquery-connection/testing/constraints-3.10.txt b/packages/google-cloud-bigquery-connection/testing/constraints-3.10.txt index a92801e1c8e2..b39cd54634f9 100644 --- a/packages/google-cloud-bigquery-connection/testing/constraints-3.10.txt +++ b/packages/google-cloud-bigquery-connection/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/google-cloud-bigquery-connection/tests/unit/gapic/bigquery_connection_v1/test_connection_service.py b/packages/google-cloud-bigquery-connection/tests/unit/gapic/bigquery_connection_v1/test_connection_service.py index c265112e029b..7d9bc4b58fe0 100644 --- a/packages/google-cloud-bigquery-connection/tests/unit/gapic/bigquery_connection_v1/test_connection_service.py +++ b/packages/google-cloud-bigquery-connection/tests/unit/gapic/bigquery_connection_v1/test_connection_service.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 @@ -113,6 +114,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" @@ -1357,8 +1373,8 @@ def test_connection_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - gcbc_connection.CreateConnectionRequest, - dict, + gcbc_connection.CreateConnectionRequest(), + {}, ], ) def test_create_connection(request_type, transport: str = "grpc"): @@ -1369,7 +1385,7 @@ def test_create_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( @@ -1428,10 +1444,11 @@ def test_create_connection_non_empty_request_with_auto_populated_field(): client.create_connection(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcbc_connection.CreateConnectionRequest( + request_msg = gcbc_connection.CreateConnectionRequest( parent="parent_value", connection_id="connection_id_value", ) + assert args[0] == request_msg def test_create_connection_use_cached_wrapped_rpc(): @@ -1514,10 +1531,14 @@ async def test_create_connection_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_connection_async( - transport: str = "grpc_asyncio", - request_type=gcbc_connection.CreateConnectionRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + gcbc_connection.CreateConnectionRequest(), + {}, + ], +) +async def test_create_connection_async(request_type, transport: str = "grpc_asyncio"): client = ConnectionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1525,7 +1546,7 @@ async def test_create_connection_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( @@ -1560,11 +1581,6 @@ async def test_create_connection_async( assert response.has_credential is True -@pytest.mark.asyncio -async def test_create_connection_async_from_dict(): - await test_create_connection_async(request_type=dict) - - def test_create_connection_field_headers(): client = ConnectionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1739,8 +1755,8 @@ async def test_create_connection_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - connection.GetConnectionRequest, - dict, + connection.GetConnectionRequest(), + {}, ], ) def test_get_connection(request_type, transport: str = "grpc"): @@ -1751,7 +1767,7 @@ def test_get_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(type(client.transport.get_connection), "__call__") as call: @@ -1805,9 +1821,10 @@ def test_get_connection_non_empty_request_with_auto_populated_field(): client.get_connection(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == connection.GetConnectionRequest( + request_msg = connection.GetConnectionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_connection_use_cached_wrapped_rpc(): @@ -1888,9 +1905,14 @@ async def test_get_connection_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_connection_async( - transport: str = "grpc_asyncio", request_type=connection.GetConnectionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + connection.GetConnectionRequest(), + {}, + ], +) +async def test_get_connection_async(request_type, transport: str = "grpc_asyncio"): client = ConnectionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1898,7 +1920,7 @@ async def test_get_connection_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_connection), "__call__") as call: @@ -1931,11 +1953,6 @@ async def test_get_connection_async( assert response.has_credential is True -@pytest.mark.asyncio -async def test_get_connection_async_from_dict(): - await test_get_connection_async(request_type=dict) - - def test_get_connection_field_headers(): client = ConnectionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2082,8 +2099,8 @@ async def test_get_connection_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - connection.ListConnectionsRequest, - dict, + connection.ListConnectionsRequest(), + {}, ], ) def test_list_connections(request_type, transport: str = "grpc"): @@ -2094,7 +2111,7 @@ def test_list_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(type(client.transport.list_connections), "__call__") as call: @@ -2139,10 +2156,11 @@ def test_list_connections_non_empty_request_with_auto_populated_field(): client.list_connections(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == connection.ListConnectionsRequest( + request_msg = connection.ListConnectionsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_connections_use_cached_wrapped_rpc(): @@ -2225,9 +2243,14 @@ async def test_list_connections_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_connections_async( - transport: str = "grpc_asyncio", request_type=connection.ListConnectionsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + connection.ListConnectionsRequest(), + {}, + ], +) +async def test_list_connections_async(request_type, transport: str = "grpc_asyncio"): client = ConnectionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2235,7 +2258,7 @@ async def test_list_connections_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_connections), "__call__") as call: @@ -2258,11 +2281,6 @@ async def test_list_connections_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_connections_async_from_dict(): - await test_list_connections_async(request_type=dict) - - def test_list_connections_field_headers(): client = ConnectionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2599,8 +2617,8 @@ async def test_list_connections_async_pages(): @pytest.mark.parametrize( "request_type", [ - gcbc_connection.UpdateConnectionRequest, - dict, + gcbc_connection.UpdateConnectionRequest(), + {}, ], ) def test_update_connection(request_type, transport: str = "grpc"): @@ -2611,7 +2629,7 @@ def test_update_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( @@ -2669,9 +2687,10 @@ def test_update_connection_non_empty_request_with_auto_populated_field(): client.update_connection(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcbc_connection.UpdateConnectionRequest( + request_msg = gcbc_connection.UpdateConnectionRequest( name="name_value", ) + assert args[0] == request_msg def test_update_connection_use_cached_wrapped_rpc(): @@ -2754,10 +2773,14 @@ async def test_update_connection_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_connection_async( - transport: str = "grpc_asyncio", - request_type=gcbc_connection.UpdateConnectionRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + gcbc_connection.UpdateConnectionRequest(), + {}, + ], +) +async def test_update_connection_async(request_type, transport: str = "grpc_asyncio"): client = ConnectionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2765,7 +2788,7 @@ async def test_update_connection_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( @@ -2800,11 +2823,6 @@ async def test_update_connection_async( assert response.has_credential is True -@pytest.mark.asyncio -async def test_update_connection_async_from_dict(): - await test_update_connection_async(request_type=dict) - - def test_update_connection_field_headers(): client = ConnectionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2979,8 +2997,8 @@ async def test_update_connection_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - connection.DeleteConnectionRequest, - dict, + connection.DeleteConnectionRequest(), + {}, ], ) def test_delete_connection(request_type, transport: str = "grpc"): @@ -2991,7 +3009,7 @@ def test_delete_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( @@ -3036,9 +3054,10 @@ def test_delete_connection_non_empty_request_with_auto_populated_field(): client.delete_connection(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == connection.DeleteConnectionRequest( + request_msg = connection.DeleteConnectionRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_connection_use_cached_wrapped_rpc(): @@ -3121,9 +3140,14 @@ async def test_delete_connection_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_connection_async( - transport: str = "grpc_asyncio", request_type=connection.DeleteConnectionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + connection.DeleteConnectionRequest(), + {}, + ], +) +async def test_delete_connection_async(request_type, transport: str = "grpc_asyncio"): client = ConnectionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3131,7 +3155,7 @@ async def test_delete_connection_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( @@ -3151,11 +3175,6 @@ async def test_delete_connection_async( assert response is None -@pytest.mark.asyncio -async def test_delete_connection_async_from_dict(): - await test_delete_connection_async(request_type=dict) - - def test_delete_connection_field_headers(): client = ConnectionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3306,8 +3325,8 @@ async def test_delete_connection_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.GetIamPolicyRequest, - dict, + iam_policy_pb2.GetIamPolicyRequest(), + {}, ], ) def test_get_iam_policy(request_type, transport: str = "grpc"): @@ -3318,7 +3337,7 @@ def test_get_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(type(client.transport.get_iam_policy), "__call__") as call: @@ -3364,9 +3383,10 @@ def test_get_iam_policy_non_empty_request_with_auto_populated_field(): client.get_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.GetIamPolicyRequest( + request_msg = iam_policy_pb2.GetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_get_iam_policy_use_cached_wrapped_rpc(): @@ -3447,9 +3467,14 @@ async def test_get_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.GetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.GetIamPolicyRequest(), + {}, + ], +) +async def test_get_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = ConnectionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3457,7 +3482,7 @@ async def test_get_iam_policy_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_iam_policy), "__call__") as call: @@ -3482,11 +3507,6 @@ async def test_get_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_get_iam_policy_async_from_dict(): - await test_get_iam_policy_async(request_type=dict) - - def test_get_iam_policy_field_headers(): client = ConnectionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3646,8 +3666,8 @@ async def test_get_iam_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.SetIamPolicyRequest, - dict, + iam_policy_pb2.SetIamPolicyRequest(), + {}, ], ) def test_set_iam_policy(request_type, transport: str = "grpc"): @@ -3658,7 +3678,7 @@ def test_set_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(type(client.transport.set_iam_policy), "__call__") as call: @@ -3704,9 +3724,10 @@ def test_set_iam_policy_non_empty_request_with_auto_populated_field(): client.set_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.SetIamPolicyRequest( + request_msg = iam_policy_pb2.SetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_set_iam_policy_use_cached_wrapped_rpc(): @@ -3787,9 +3808,14 @@ async def test_set_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.SetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.SetIamPolicyRequest(), + {}, + ], +) +async def test_set_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = ConnectionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3797,7 +3823,7 @@ async def test_set_iam_policy_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.set_iam_policy), "__call__") as call: @@ -3822,11 +3848,6 @@ async def test_set_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_set_iam_policy_async_from_dict(): - await test_set_iam_policy_async(request_type=dict) - - def test_set_iam_policy_field_headers(): client = ConnectionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3987,8 +4008,8 @@ async def test_set_iam_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.TestIamPermissionsRequest, - dict, + iam_policy_pb2.TestIamPermissionsRequest(), + {}, ], ) def test_test_iam_permissions(request_type, transport: str = "grpc"): @@ -3999,7 +4020,7 @@ def test_test_iam_permissions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4047,9 +4068,10 @@ def test_test_iam_permissions_non_empty_request_with_auto_populated_field(): client.test_iam_permissions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.TestIamPermissionsRequest( + request_msg = iam_policy_pb2.TestIamPermissionsRequest( resource="resource_value", ) + assert args[0] == request_msg def test_test_iam_permissions_use_cached_wrapped_rpc(): @@ -4134,9 +4156,15 @@ async def test_test_iam_permissions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.TestIamPermissionsRequest(), + {}, + ], +) async def test_test_iam_permissions_async( - transport: str = "grpc_asyncio", - request_type=iam_policy_pb2.TestIamPermissionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConnectionServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4145,7 +4173,7 @@ async def test_test_iam_permissions_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( @@ -4170,11 +4198,6 @@ async def test_test_iam_permissions_async( assert response.permissions == ["permissions_value"] -@pytest.mark.asyncio -async def test_test_iam_permissions_async_from_dict(): - await test_test_iam_permissions_async(request_type=dict) - - def test_test_iam_permissions_field_headers(): client = ConnectionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6063,7 +6086,6 @@ def test_create_connection_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcbc_connection.CreateConnectionRequest() - assert args[0] == request_msg @@ -6084,7 +6106,6 @@ def test_get_connection_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = connection.GetConnectionRequest() - assert args[0] == request_msg @@ -6105,7 +6126,6 @@ def test_list_connections_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = connection.ListConnectionsRequest() - assert args[0] == request_msg @@ -6128,7 +6148,6 @@ def test_update_connection_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcbc_connection.UpdateConnectionRequest() - assert args[0] == request_msg @@ -6151,7 +6170,6 @@ def test_delete_connection_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = connection.DeleteConnectionRequest() - assert args[0] == request_msg @@ -6172,7 +6190,6 @@ def test_get_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -6193,7 +6210,6 @@ def test_set_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -6216,7 +6232,6 @@ def test_test_iam_permissions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -6264,7 +6279,6 @@ async def test_create_connection_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcbc_connection.CreateConnectionRequest() - assert args[0] == request_msg @@ -6296,7 +6310,6 @@ async def test_get_connection_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = connection.GetConnectionRequest() - assert args[0] == request_msg @@ -6323,7 +6336,6 @@ async def test_list_connections_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = connection.ListConnectionsRequest() - assert args[0] == request_msg @@ -6357,7 +6369,6 @@ async def test_update_connection_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcbc_connection.UpdateConnectionRequest() - assert args[0] == request_msg @@ -6382,7 +6393,6 @@ async def test_delete_connection_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = connection.DeleteConnectionRequest() - assert args[0] == request_msg @@ -6410,7 +6420,6 @@ async def test_get_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -6438,7 +6447,6 @@ async def test_set_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -6467,7 +6475,6 @@ async def test_test_iam_permissions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -7816,7 +7823,6 @@ def test_create_connection_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcbc_connection.CreateConnectionRequest() - assert args[0] == request_msg @@ -7836,7 +7842,6 @@ def test_get_connection_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = connection.GetConnectionRequest() - assert args[0] == request_msg @@ -7856,7 +7861,6 @@ def test_list_connections_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = connection.ListConnectionsRequest() - assert args[0] == request_msg @@ -7878,7 +7882,6 @@ def test_update_connection_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcbc_connection.UpdateConnectionRequest() - assert args[0] == request_msg @@ -7900,7 +7903,6 @@ def test_delete_connection_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = connection.DeleteConnectionRequest() - assert args[0] == request_msg @@ -7920,7 +7922,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -7940,7 +7941,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -7962,7 +7962,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-bigquery-data-exchange/noxfile.py b/packages/google-cloud-bigquery-data-exchange/noxfile.py index 5747e444ff71..fb619fb7bb1a 100644 --- a/packages/google-cloud-bigquery-data-exchange/noxfile.py +++ b/packages/google-cloud-bigquery-data-exchange/noxfile.py @@ -47,7 +47,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-bigquery-data-exchange" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-bigquery-data-exchange/setup.py b/packages/google-cloud-bigquery-data-exchange/setup.py index 25e7fd686978..709a469cfe64 100644 --- a/packages/google-cloud-bigquery-data-exchange/setup.py +++ b/packages/google-cloud-bigquery-data-exchange/setup.py @@ -45,7 +45,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/google-cloud-bigquery-data-exchange/testing/constraints-3.10.txt b/packages/google-cloud-bigquery-data-exchange/testing/constraints-3.10.txt index a92801e1c8e2..b39cd54634f9 100644 --- a/packages/google-cloud-bigquery-data-exchange/testing/constraints-3.10.txt +++ b/packages/google-cloud-bigquery-data-exchange/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/google-cloud-bigquery-data-exchange/tests/unit/gapic/bigquery_data_exchange_v1beta1/test_analytics_hub_service.py b/packages/google-cloud-bigquery-data-exchange/tests/unit/gapic/bigquery_data_exchange_v1beta1/test_analytics_hub_service.py index fb15b1eb5391..c6aa08396a6b 100644 --- a/packages/google-cloud-bigquery-data-exchange/tests/unit/gapic/bigquery_data_exchange_v1beta1/test_analytics_hub_service.py +++ b/packages/google-cloud-bigquery-data-exchange/tests/unit/gapic/bigquery_data_exchange_v1beta1/test_analytics_hub_service.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" @@ -1337,8 +1353,8 @@ def test_analytics_hub_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - dataexchange.ListDataExchangesRequest, - dict, + dataexchange.ListDataExchangesRequest(), + {}, ], ) def test_list_data_exchanges(request_type, transport: str = "grpc"): @@ -1349,7 +1365,7 @@ def test_list_data_exchanges(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1398,10 +1414,11 @@ def test_list_data_exchanges_non_empty_request_with_auto_populated_field(): client.list_data_exchanges(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataexchange.ListDataExchangesRequest( + request_msg = dataexchange.ListDataExchangesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_data_exchanges_use_cached_wrapped_rpc(): @@ -1486,9 +1503,14 @@ async def test_list_data_exchanges_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_data_exchanges_async( - transport: str = "grpc_asyncio", request_type=dataexchange.ListDataExchangesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataexchange.ListDataExchangesRequest(), + {}, + ], +) +async def test_list_data_exchanges_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsHubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1496,7 +1518,7 @@ async def test_list_data_exchanges_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( @@ -1521,11 +1543,6 @@ async def test_list_data_exchanges_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_data_exchanges_async_from_dict(): - await test_list_data_exchanges_async(request_type=dict) - - def test_list_data_exchanges_field_headers(): client = AnalyticsHubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1878,8 +1895,8 @@ async def test_list_data_exchanges_async_pages(): @pytest.mark.parametrize( "request_type", [ - dataexchange.ListOrgDataExchangesRequest, - dict, + dataexchange.ListOrgDataExchangesRequest(), + {}, ], ) def test_list_org_data_exchanges(request_type, transport: str = "grpc"): @@ -1890,7 +1907,7 @@ def test_list_org_data_exchanges(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1939,10 +1956,11 @@ def test_list_org_data_exchanges_non_empty_request_with_auto_populated_field(): client.list_org_data_exchanges(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataexchange.ListOrgDataExchangesRequest( + request_msg = dataexchange.ListOrgDataExchangesRequest( organization="organization_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_org_data_exchanges_use_cached_wrapped_rpc(): @@ -2028,9 +2046,15 @@ async def test_list_org_data_exchanges_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dataexchange.ListOrgDataExchangesRequest(), + {}, + ], +) async def test_list_org_data_exchanges_async( - transport: str = "grpc_asyncio", - request_type=dataexchange.ListOrgDataExchangesRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsHubServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2039,7 +2063,7 @@ async def test_list_org_data_exchanges_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( @@ -2064,11 +2088,6 @@ async def test_list_org_data_exchanges_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_org_data_exchanges_async_from_dict(): - await test_list_org_data_exchanges_async(request_type=dict) - - def test_list_org_data_exchanges_field_headers(): client = AnalyticsHubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2421,8 +2440,8 @@ async def test_list_org_data_exchanges_async_pages(): @pytest.mark.parametrize( "request_type", [ - dataexchange.GetDataExchangeRequest, - dict, + dataexchange.GetDataExchangeRequest(), + {}, ], ) def test_get_data_exchange(request_type, transport: str = "grpc"): @@ -2433,7 +2452,7 @@ def test_get_data_exchange(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2493,9 +2512,10 @@ def test_get_data_exchange_non_empty_request_with_auto_populated_field(): client.get_data_exchange(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataexchange.GetDataExchangeRequest( + request_msg = dataexchange.GetDataExchangeRequest( name="name_value", ) + assert args[0] == request_msg def test_get_data_exchange_use_cached_wrapped_rpc(): @@ -2578,9 +2598,14 @@ async def test_get_data_exchange_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_data_exchange_async( - transport: str = "grpc_asyncio", request_type=dataexchange.GetDataExchangeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataexchange.GetDataExchangeRequest(), + {}, + ], +) +async def test_get_data_exchange_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsHubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2588,7 +2613,7 @@ async def test_get_data_exchange_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( @@ -2625,11 +2650,6 @@ async def test_get_data_exchange_async( assert response.icon == b"icon_blob" -@pytest.mark.asyncio -async def test_get_data_exchange_async_from_dict(): - await test_get_data_exchange_async(request_type=dict) - - def test_get_data_exchange_field_headers(): client = AnalyticsHubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2784,8 +2804,8 @@ async def test_get_data_exchange_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dataexchange.CreateDataExchangeRequest, - dict, + dataexchange.CreateDataExchangeRequest(), + {}, ], ) def test_create_data_exchange(request_type, transport: str = "grpc"): @@ -2796,7 +2816,7 @@ def test_create_data_exchange(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2857,10 +2877,11 @@ def test_create_data_exchange_non_empty_request_with_auto_populated_field(): client.create_data_exchange(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataexchange.CreateDataExchangeRequest( + request_msg = dataexchange.CreateDataExchangeRequest( parent="parent_value", data_exchange_id="data_exchange_id_value", ) + assert args[0] == request_msg def test_create_data_exchange_use_cached_wrapped_rpc(): @@ -2945,8 +2966,15 @@ async def test_create_data_exchange_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dataexchange.CreateDataExchangeRequest(), + {}, + ], +) async def test_create_data_exchange_async( - transport: str = "grpc_asyncio", request_type=dataexchange.CreateDataExchangeRequest + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsHubServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2955,7 +2983,7 @@ async def test_create_data_exchange_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( @@ -2992,11 +3020,6 @@ async def test_create_data_exchange_async( assert response.icon == b"icon_blob" -@pytest.mark.asyncio -async def test_create_data_exchange_async_from_dict(): - await test_create_data_exchange_async(request_type=dict) - - def test_create_data_exchange_field_headers(): client = AnalyticsHubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3161,8 +3184,8 @@ async def test_create_data_exchange_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dataexchange.UpdateDataExchangeRequest, - dict, + dataexchange.UpdateDataExchangeRequest(), + {}, ], ) def test_update_data_exchange(request_type, transport: str = "grpc"): @@ -3173,7 +3196,7 @@ def test_update_data_exchange(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3231,7 +3254,8 @@ def test_update_data_exchange_non_empty_request_with_auto_populated_field(): client.update_data_exchange(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataexchange.UpdateDataExchangeRequest() + request_msg = dataexchange.UpdateDataExchangeRequest() + assert args[0] == request_msg def test_update_data_exchange_use_cached_wrapped_rpc(): @@ -3316,8 +3340,15 @@ async def test_update_data_exchange_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dataexchange.UpdateDataExchangeRequest(), + {}, + ], +) async def test_update_data_exchange_async( - transport: str = "grpc_asyncio", request_type=dataexchange.UpdateDataExchangeRequest + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsHubServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3326,7 +3357,7 @@ async def test_update_data_exchange_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( @@ -3363,11 +3394,6 @@ async def test_update_data_exchange_async( assert response.icon == b"icon_blob" -@pytest.mark.asyncio -async def test_update_data_exchange_async_from_dict(): - await test_update_data_exchange_async(request_type=dict) - - def test_update_data_exchange_field_headers(): client = AnalyticsHubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3532,8 +3558,8 @@ async def test_update_data_exchange_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dataexchange.DeleteDataExchangeRequest, - dict, + dataexchange.DeleteDataExchangeRequest(), + {}, ], ) def test_delete_data_exchange(request_type, transport: str = "grpc"): @@ -3544,7 +3570,7 @@ def test_delete_data_exchange(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3589,9 +3615,10 @@ def test_delete_data_exchange_non_empty_request_with_auto_populated_field(): client.delete_data_exchange(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataexchange.DeleteDataExchangeRequest( + request_msg = dataexchange.DeleteDataExchangeRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_data_exchange_use_cached_wrapped_rpc(): @@ -3676,8 +3703,15 @@ async def test_delete_data_exchange_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dataexchange.DeleteDataExchangeRequest(), + {}, + ], +) async def test_delete_data_exchange_async( - transport: str = "grpc_asyncio", request_type=dataexchange.DeleteDataExchangeRequest + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsHubServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3686,7 +3720,7 @@ async def test_delete_data_exchange_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( @@ -3706,11 +3740,6 @@ async def test_delete_data_exchange_async( assert response is None -@pytest.mark.asyncio -async def test_delete_data_exchange_async_from_dict(): - await test_delete_data_exchange_async(request_type=dict) - - def test_delete_data_exchange_field_headers(): client = AnalyticsHubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3861,8 +3890,8 @@ async def test_delete_data_exchange_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dataexchange.ListListingsRequest, - dict, + dataexchange.ListListingsRequest(), + {}, ], ) def test_list_listings(request_type, transport: str = "grpc"): @@ -3873,7 +3902,7 @@ def test_list_listings(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_listings), "__call__") as call: @@ -3918,10 +3947,11 @@ def test_list_listings_non_empty_request_with_auto_populated_field(): client.list_listings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataexchange.ListListingsRequest( + request_msg = dataexchange.ListListingsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_listings_use_cached_wrapped_rpc(): @@ -4002,9 +4032,14 @@ async def test_list_listings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_listings_async( - transport: str = "grpc_asyncio", request_type=dataexchange.ListListingsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataexchange.ListListingsRequest(), + {}, + ], +) +async def test_list_listings_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsHubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4012,7 +4047,7 @@ async def test_list_listings_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_listings), "__call__") as call: @@ -4035,11 +4070,6 @@ async def test_list_listings_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_listings_async_from_dict(): - await test_list_listings_async(request_type=dict) - - def test_list_listings_field_headers(): client = AnalyticsHubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4376,8 +4406,8 @@ async def test_list_listings_async_pages(): @pytest.mark.parametrize( "request_type", [ - dataexchange.GetListingRequest, - dict, + dataexchange.GetListingRequest(), + {}, ], ) def test_get_listing(request_type, transport: str = "grpc"): @@ -4388,7 +4418,7 @@ def test_get_listing(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_listing), "__call__") as call: @@ -4448,9 +4478,10 @@ def test_get_listing_non_empty_request_with_auto_populated_field(): client.get_listing(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataexchange.GetListingRequest( + request_msg = dataexchange.GetListingRequest( name="name_value", ) + assert args[0] == request_msg def test_get_listing_use_cached_wrapped_rpc(): @@ -4531,9 +4562,14 @@ async def test_get_listing_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_listing_async( - transport: str = "grpc_asyncio", request_type=dataexchange.GetListingRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataexchange.GetListingRequest(), + {}, + ], +) +async def test_get_listing_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsHubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4541,7 +4577,7 @@ async def test_get_listing_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_listing), "__call__") as call: @@ -4580,11 +4616,6 @@ async def test_get_listing_async( assert response.request_access == "request_access_value" -@pytest.mark.asyncio -async def test_get_listing_async_from_dict(): - await test_get_listing_async(request_type=dict) - - def test_get_listing_field_headers(): client = AnalyticsHubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4731,8 +4762,8 @@ async def test_get_listing_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dataexchange.CreateListingRequest, - dict, + dataexchange.CreateListingRequest(), + {}, ], ) def test_create_listing(request_type, transport: str = "grpc"): @@ -4743,7 +4774,7 @@ def test_create_listing(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_listing), "__call__") as call: @@ -4804,10 +4835,11 @@ def test_create_listing_non_empty_request_with_auto_populated_field(): client.create_listing(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataexchange.CreateListingRequest( + request_msg = dataexchange.CreateListingRequest( parent="parent_value", listing_id="listing_id_value", ) + assert args[0] == request_msg def test_create_listing_use_cached_wrapped_rpc(): @@ -4888,9 +4920,14 @@ async def test_create_listing_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_listing_async( - transport: str = "grpc_asyncio", request_type=dataexchange.CreateListingRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataexchange.CreateListingRequest(), + {}, + ], +) +async def test_create_listing_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsHubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4898,7 +4935,7 @@ async def test_create_listing_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_listing), "__call__") as call: @@ -4937,11 +4974,6 @@ async def test_create_listing_async( assert response.request_access == "request_access_value" -@pytest.mark.asyncio -async def test_create_listing_async_from_dict(): - await test_create_listing_async(request_type=dict) - - def test_create_listing_field_headers(): client = AnalyticsHubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5122,8 +5154,8 @@ async def test_create_listing_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dataexchange.UpdateListingRequest, - dict, + dataexchange.UpdateListingRequest(), + {}, ], ) def test_update_listing(request_type, transport: str = "grpc"): @@ -5134,7 +5166,7 @@ def test_update_listing(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_listing), "__call__") as call: @@ -5192,7 +5224,8 @@ def test_update_listing_non_empty_request_with_auto_populated_field(): client.update_listing(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataexchange.UpdateListingRequest() + request_msg = dataexchange.UpdateListingRequest() + assert args[0] == request_msg def test_update_listing_use_cached_wrapped_rpc(): @@ -5273,9 +5306,14 @@ async def test_update_listing_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_listing_async( - transport: str = "grpc_asyncio", request_type=dataexchange.UpdateListingRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataexchange.UpdateListingRequest(), + {}, + ], +) +async def test_update_listing_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsHubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5283,7 +5321,7 @@ async def test_update_listing_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_listing), "__call__") as call: @@ -5322,11 +5360,6 @@ async def test_update_listing_async( assert response.request_access == "request_access_value" -@pytest.mark.asyncio -async def test_update_listing_async_from_dict(): - await test_update_listing_async(request_type=dict) - - def test_update_listing_field_headers(): client = AnalyticsHubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5507,8 +5540,8 @@ async def test_update_listing_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dataexchange.DeleteListingRequest, - dict, + dataexchange.DeleteListingRequest(), + {}, ], ) def test_delete_listing(request_type, transport: str = "grpc"): @@ -5519,7 +5552,7 @@ def test_delete_listing(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_listing), "__call__") as call: @@ -5560,9 +5593,10 @@ def test_delete_listing_non_empty_request_with_auto_populated_field(): client.delete_listing(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataexchange.DeleteListingRequest( + request_msg = dataexchange.DeleteListingRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_listing_use_cached_wrapped_rpc(): @@ -5643,9 +5677,14 @@ async def test_delete_listing_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_listing_async( - transport: str = "grpc_asyncio", request_type=dataexchange.DeleteListingRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataexchange.DeleteListingRequest(), + {}, + ], +) +async def test_delete_listing_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsHubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5653,7 +5692,7 @@ async def test_delete_listing_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_listing), "__call__") as call: @@ -5671,11 +5710,6 @@ async def test_delete_listing_async( assert response is None -@pytest.mark.asyncio -async def test_delete_listing_async_from_dict(): - await test_delete_listing_async(request_type=dict) - - def test_delete_listing_field_headers(): client = AnalyticsHubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5818,8 +5852,8 @@ async def test_delete_listing_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dataexchange.SubscribeListingRequest, - dict, + dataexchange.SubscribeListingRequest(), + {}, ], ) def test_subscribe_listing(request_type, transport: str = "grpc"): @@ -5830,7 +5864,7 @@ def test_subscribe_listing(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5875,9 +5909,10 @@ def test_subscribe_listing_non_empty_request_with_auto_populated_field(): client.subscribe_listing(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataexchange.SubscribeListingRequest( + request_msg = dataexchange.SubscribeListingRequest( name="name_value", ) + assert args[0] == request_msg def test_subscribe_listing_use_cached_wrapped_rpc(): @@ -5960,9 +5995,14 @@ async def test_subscribe_listing_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_subscribe_listing_async( - transport: str = "grpc_asyncio", request_type=dataexchange.SubscribeListingRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataexchange.SubscribeListingRequest(), + {}, + ], +) +async def test_subscribe_listing_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsHubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5970,7 +6010,7 @@ async def test_subscribe_listing_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( @@ -5992,11 +6032,6 @@ async def test_subscribe_listing_async( assert isinstance(response, dataexchange.SubscribeListingResponse) -@pytest.mark.asyncio -async def test_subscribe_listing_async_from_dict(): - await test_subscribe_listing_async(request_type=dict) - - def test_subscribe_listing_field_headers(): client = AnalyticsHubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6151,8 +6186,8 @@ async def test_subscribe_listing_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.GetIamPolicyRequest, - dict, + iam_policy_pb2.GetIamPolicyRequest(), + {}, ], ) def test_get_iam_policy(request_type, transport: str = "grpc"): @@ -6163,7 +6198,7 @@ def test_get_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(type(client.transport.get_iam_policy), "__call__") as call: @@ -6209,9 +6244,10 @@ def test_get_iam_policy_non_empty_request_with_auto_populated_field(): client.get_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.GetIamPolicyRequest( + request_msg = iam_policy_pb2.GetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_get_iam_policy_use_cached_wrapped_rpc(): @@ -6292,9 +6328,14 @@ async def test_get_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.GetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.GetIamPolicyRequest(), + {}, + ], +) +async def test_get_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsHubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6302,7 +6343,7 @@ async def test_get_iam_policy_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_iam_policy), "__call__") as call: @@ -6327,11 +6368,6 @@ async def test_get_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_get_iam_policy_async_from_dict(): - await test_get_iam_policy_async(request_type=dict) - - def test_get_iam_policy_field_headers(): client = AnalyticsHubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6411,8 +6447,8 @@ def test_get_iam_policy_from_dict_foreign(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.SetIamPolicyRequest, - dict, + iam_policy_pb2.SetIamPolicyRequest(), + {}, ], ) def test_set_iam_policy(request_type, transport: str = "grpc"): @@ -6423,7 +6459,7 @@ def test_set_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(type(client.transport.set_iam_policy), "__call__") as call: @@ -6469,9 +6505,10 @@ def test_set_iam_policy_non_empty_request_with_auto_populated_field(): client.set_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.SetIamPolicyRequest( + request_msg = iam_policy_pb2.SetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_set_iam_policy_use_cached_wrapped_rpc(): @@ -6552,9 +6589,14 @@ async def test_set_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.SetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.SetIamPolicyRequest(), + {}, + ], +) +async def test_set_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = AnalyticsHubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6562,7 +6604,7 @@ async def test_set_iam_policy_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.set_iam_policy), "__call__") as call: @@ -6587,11 +6629,6 @@ async def test_set_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_set_iam_policy_async_from_dict(): - await test_set_iam_policy_async(request_type=dict) - - def test_set_iam_policy_field_headers(): client = AnalyticsHubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6672,8 +6709,8 @@ def test_set_iam_policy_from_dict_foreign(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.TestIamPermissionsRequest, - dict, + iam_policy_pb2.TestIamPermissionsRequest(), + {}, ], ) def test_test_iam_permissions(request_type, transport: str = "grpc"): @@ -6684,7 +6721,7 @@ def test_test_iam_permissions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6732,9 +6769,10 @@ def test_test_iam_permissions_non_empty_request_with_auto_populated_field(): client.test_iam_permissions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.TestIamPermissionsRequest( + request_msg = iam_policy_pb2.TestIamPermissionsRequest( resource="resource_value", ) + assert args[0] == request_msg def test_test_iam_permissions_use_cached_wrapped_rpc(): @@ -6819,9 +6857,15 @@ async def test_test_iam_permissions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.TestIamPermissionsRequest(), + {}, + ], +) async def test_test_iam_permissions_async( - transport: str = "grpc_asyncio", - request_type=iam_policy_pb2.TestIamPermissionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsHubServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -6830,7 +6874,7 @@ async def test_test_iam_permissions_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( @@ -6855,11 +6899,6 @@ async def test_test_iam_permissions_async( assert response.permissions == ["permissions_value"] -@pytest.mark.asyncio -async def test_test_iam_permissions_async_from_dict(): - await test_test_iam_permissions_async(request_type=dict) - - def test_test_iam_permissions_field_headers(): client = AnalyticsHubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7068,7 +7107,6 @@ def test_list_data_exchanges_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataexchange.ListDataExchangesRequest() - assert args[0] == request_msg @@ -7091,7 +7129,6 @@ def test_list_org_data_exchanges_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataexchange.ListOrgDataExchangesRequest() - assert args[0] == request_msg @@ -7114,7 +7151,6 @@ def test_get_data_exchange_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataexchange.GetDataExchangeRequest() - assert args[0] == request_msg @@ -7137,7 +7173,6 @@ def test_create_data_exchange_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataexchange.CreateDataExchangeRequest() - assert args[0] == request_msg @@ -7160,7 +7195,6 @@ def test_update_data_exchange_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataexchange.UpdateDataExchangeRequest() - assert args[0] == request_msg @@ -7183,7 +7217,6 @@ def test_delete_data_exchange_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataexchange.DeleteDataExchangeRequest() - assert args[0] == request_msg @@ -7204,7 +7237,6 @@ def test_list_listings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataexchange.ListListingsRequest() - assert args[0] == request_msg @@ -7225,7 +7257,6 @@ def test_get_listing_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataexchange.GetListingRequest() - assert args[0] == request_msg @@ -7246,7 +7277,6 @@ def test_create_listing_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataexchange.CreateListingRequest() - assert args[0] == request_msg @@ -7267,7 +7297,6 @@ def test_update_listing_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataexchange.UpdateListingRequest() - assert args[0] == request_msg @@ -7288,7 +7317,6 @@ def test_delete_listing_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataexchange.DeleteListingRequest() - assert args[0] == request_msg @@ -7311,7 +7339,6 @@ def test_subscribe_listing_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataexchange.SubscribeListingRequest() - assert args[0] == request_msg @@ -7332,7 +7359,6 @@ def test_get_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -7353,7 +7379,6 @@ def test_set_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -7376,7 +7401,6 @@ def test_test_iam_permissions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -7419,7 +7443,6 @@ async def test_list_data_exchanges_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataexchange.ListDataExchangesRequest() - assert args[0] == request_msg @@ -7448,7 +7471,6 @@ async def test_list_org_data_exchanges_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataexchange.ListOrgDataExchangesRequest() - assert args[0] == request_msg @@ -7483,7 +7505,6 @@ async def test_get_data_exchange_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataexchange.GetDataExchangeRequest() - assert args[0] == request_msg @@ -7518,7 +7539,6 @@ async def test_create_data_exchange_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataexchange.CreateDataExchangeRequest() - assert args[0] == request_msg @@ -7553,7 +7573,6 @@ async def test_update_data_exchange_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataexchange.UpdateDataExchangeRequest() - assert args[0] == request_msg @@ -7578,7 +7597,6 @@ async def test_delete_data_exchange_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataexchange.DeleteDataExchangeRequest() - assert args[0] == request_msg @@ -7605,7 +7623,6 @@ async def test_list_listings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataexchange.ListListingsRequest() - assert args[0] == request_msg @@ -7640,7 +7657,6 @@ async def test_get_listing_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataexchange.GetListingRequest() - assert args[0] == request_msg @@ -7675,7 +7691,6 @@ async def test_create_listing_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataexchange.CreateListingRequest() - assert args[0] == request_msg @@ -7710,7 +7725,6 @@ async def test_update_listing_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataexchange.UpdateListingRequest() - assert args[0] == request_msg @@ -7733,7 +7747,6 @@ async def test_delete_listing_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataexchange.DeleteListingRequest() - assert args[0] == request_msg @@ -7760,7 +7773,6 @@ async def test_subscribe_listing_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataexchange.SubscribeListingRequest() - assert args[0] == request_msg @@ -7788,7 +7800,6 @@ async def test_get_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -7816,7 +7827,6 @@ async def test_set_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -7845,7 +7855,6 @@ async def test_test_iam_permissions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-bigquery-datapolicies/noxfile.py b/packages/google-cloud-bigquery-datapolicies/noxfile.py index ae6cb17f7426..aabe19bd4e27 100644 --- a/packages/google-cloud-bigquery-datapolicies/noxfile.py +++ b/packages/google-cloud-bigquery-datapolicies/noxfile.py @@ -47,7 +47,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-bigquery-datapolicies" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-bigquery-datapolicies/setup.py b/packages/google-cloud-bigquery-datapolicies/setup.py index 0de79bc848c8..6e5251e5523c 100644 --- a/packages/google-cloud-bigquery-datapolicies/setup.py +++ b/packages/google-cloud-bigquery-datapolicies/setup.py @@ -45,7 +45,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/google-cloud-bigquery-datapolicies/testing/constraints-3.10.txt b/packages/google-cloud-bigquery-datapolicies/testing/constraints-3.10.txt index a92801e1c8e2..b39cd54634f9 100644 --- a/packages/google-cloud-bigquery-datapolicies/testing/constraints-3.10.txt +++ b/packages/google-cloud-bigquery-datapolicies/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/google-cloud-bigquery-datapolicies/tests/unit/gapic/bigquery_datapolicies_v1/test_data_policy_service.py b/packages/google-cloud-bigquery-datapolicies/tests/unit/gapic/bigquery_datapolicies_v1/test_data_policy_service.py index 493b652a56d8..ecd9e6a7f2d9 100644 --- a/packages/google-cloud-bigquery-datapolicies/tests/unit/gapic/bigquery_datapolicies_v1/test_data_policy_service.py +++ b/packages/google-cloud-bigquery-datapolicies/tests/unit/gapic/bigquery_datapolicies_v1/test_data_policy_service.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" @@ -1356,8 +1372,8 @@ def test_data_policy_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - datapolicy.CreateDataPolicyRequest, - dict, + datapolicy.CreateDataPolicyRequest(), + {}, ], ) def test_create_data_policy(request_type, transport: str = "grpc"): @@ -1368,7 +1384,7 @@ def test_create_data_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( @@ -1424,9 +1440,10 @@ def test_create_data_policy_non_empty_request_with_auto_populated_field(): client.create_data_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datapolicy.CreateDataPolicyRequest( + request_msg = datapolicy.CreateDataPolicyRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_data_policy_use_cached_wrapped_rpc(): @@ -1511,9 +1528,14 @@ async def test_create_data_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_data_policy_async( - transport: str = "grpc_asyncio", request_type=datapolicy.CreateDataPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datapolicy.CreateDataPolicyRequest(), + {}, + ], +) +async def test_create_data_policy_async(request_type, transport: str = "grpc_asyncio"): client = DataPolicyServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1521,7 +1543,7 @@ async def test_create_data_policy_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( @@ -1553,11 +1575,6 @@ async def test_create_data_policy_async( assert response.data_policy_id == "data_policy_id_value" -@pytest.mark.asyncio -async def test_create_data_policy_async_from_dict(): - await test_create_data_policy_async(request_type=dict) - - def test_create_data_policy_field_headers(): client = DataPolicyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1722,8 +1739,8 @@ async def test_create_data_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datapolicy.UpdateDataPolicyRequest, - dict, + datapolicy.UpdateDataPolicyRequest(), + {}, ], ) def test_update_data_policy(request_type, transport: str = "grpc"): @@ -1734,7 +1751,7 @@ def test_update_data_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( @@ -1788,7 +1805,8 @@ def test_update_data_policy_non_empty_request_with_auto_populated_field(): client.update_data_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datapolicy.UpdateDataPolicyRequest() + request_msg = datapolicy.UpdateDataPolicyRequest() + assert args[0] == request_msg def test_update_data_policy_use_cached_wrapped_rpc(): @@ -1873,9 +1891,14 @@ async def test_update_data_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_data_policy_async( - transport: str = "grpc_asyncio", request_type=datapolicy.UpdateDataPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datapolicy.UpdateDataPolicyRequest(), + {}, + ], +) +async def test_update_data_policy_async(request_type, transport: str = "grpc_asyncio"): client = DataPolicyServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1883,7 +1906,7 @@ async def test_update_data_policy_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( @@ -1915,11 +1938,6 @@ async def test_update_data_policy_async( assert response.data_policy_id == "data_policy_id_value" -@pytest.mark.asyncio -async def test_update_data_policy_async_from_dict(): - await test_update_data_policy_async(request_type=dict) - - def test_update_data_policy_field_headers(): client = DataPolicyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2084,8 +2102,8 @@ async def test_update_data_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datapolicy.RenameDataPolicyRequest, - dict, + datapolicy.RenameDataPolicyRequest(), + {}, ], ) def test_rename_data_policy(request_type, transport: str = "grpc"): @@ -2096,7 +2114,7 @@ def test_rename_data_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( @@ -2153,10 +2171,11 @@ def test_rename_data_policy_non_empty_request_with_auto_populated_field(): client.rename_data_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datapolicy.RenameDataPolicyRequest( + request_msg = datapolicy.RenameDataPolicyRequest( name="name_value", new_data_policy_id="new_data_policy_id_value", ) + assert args[0] == request_msg def test_rename_data_policy_use_cached_wrapped_rpc(): @@ -2241,9 +2260,14 @@ async def test_rename_data_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_rename_data_policy_async( - transport: str = "grpc_asyncio", request_type=datapolicy.RenameDataPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datapolicy.RenameDataPolicyRequest(), + {}, + ], +) +async def test_rename_data_policy_async(request_type, transport: str = "grpc_asyncio"): client = DataPolicyServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2251,7 +2275,7 @@ async def test_rename_data_policy_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( @@ -2283,11 +2307,6 @@ async def test_rename_data_policy_async( assert response.data_policy_id == "data_policy_id_value" -@pytest.mark.asyncio -async def test_rename_data_policy_async_from_dict(): - await test_rename_data_policy_async(request_type=dict) - - def test_rename_data_policy_field_headers(): client = DataPolicyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2452,8 +2471,8 @@ async def test_rename_data_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datapolicy.DeleteDataPolicyRequest, - dict, + datapolicy.DeleteDataPolicyRequest(), + {}, ], ) def test_delete_data_policy(request_type, transport: str = "grpc"): @@ -2464,7 +2483,7 @@ def test_delete_data_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( @@ -2509,9 +2528,10 @@ def test_delete_data_policy_non_empty_request_with_auto_populated_field(): client.delete_data_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datapolicy.DeleteDataPolicyRequest( + request_msg = datapolicy.DeleteDataPolicyRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_data_policy_use_cached_wrapped_rpc(): @@ -2596,9 +2616,14 @@ async def test_delete_data_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_data_policy_async( - transport: str = "grpc_asyncio", request_type=datapolicy.DeleteDataPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datapolicy.DeleteDataPolicyRequest(), + {}, + ], +) +async def test_delete_data_policy_async(request_type, transport: str = "grpc_asyncio"): client = DataPolicyServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2606,7 +2631,7 @@ async def test_delete_data_policy_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( @@ -2626,11 +2651,6 @@ async def test_delete_data_policy_async( assert response is None -@pytest.mark.asyncio -async def test_delete_data_policy_async_from_dict(): - await test_delete_data_policy_async(request_type=dict) - - def test_delete_data_policy_field_headers(): client = DataPolicyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2781,8 +2801,8 @@ async def test_delete_data_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datapolicy.GetDataPolicyRequest, - dict, + datapolicy.GetDataPolicyRequest(), + {}, ], ) def test_get_data_policy(request_type, transport: str = "grpc"): @@ -2793,7 +2813,7 @@ def test_get_data_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(type(client.transport.get_data_policy), "__call__") as call: @@ -2845,9 +2865,10 @@ def test_get_data_policy_non_empty_request_with_auto_populated_field(): client.get_data_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datapolicy.GetDataPolicyRequest( + request_msg = datapolicy.GetDataPolicyRequest( name="name_value", ) + assert args[0] == request_msg def test_get_data_policy_use_cached_wrapped_rpc(): @@ -2928,9 +2949,14 @@ async def test_get_data_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_data_policy_async( - transport: str = "grpc_asyncio", request_type=datapolicy.GetDataPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datapolicy.GetDataPolicyRequest(), + {}, + ], +) +async def test_get_data_policy_async(request_type, transport: str = "grpc_asyncio"): client = DataPolicyServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2938,7 +2964,7 @@ async def test_get_data_policy_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_data_policy), "__call__") as call: @@ -2968,11 +2994,6 @@ async def test_get_data_policy_async( assert response.data_policy_id == "data_policy_id_value" -@pytest.mark.asyncio -async def test_get_data_policy_async_from_dict(): - await test_get_data_policy_async(request_type=dict) - - def test_get_data_policy_field_headers(): client = DataPolicyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3119,8 +3140,8 @@ async def test_get_data_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datapolicy.ListDataPoliciesRequest, - dict, + datapolicy.ListDataPoliciesRequest(), + {}, ], ) def test_list_data_policies(request_type, transport: str = "grpc"): @@ -3131,7 +3152,7 @@ def test_list_data_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( @@ -3181,11 +3202,12 @@ def test_list_data_policies_non_empty_request_with_auto_populated_field(): client.list_data_policies(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datapolicy.ListDataPoliciesRequest( + request_msg = datapolicy.ListDataPoliciesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_data_policies_use_cached_wrapped_rpc(): @@ -3270,9 +3292,14 @@ async def test_list_data_policies_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_data_policies_async( - transport: str = "grpc_asyncio", request_type=datapolicy.ListDataPoliciesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datapolicy.ListDataPoliciesRequest(), + {}, + ], +) +async def test_list_data_policies_async(request_type, transport: str = "grpc_asyncio"): client = DataPolicyServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3280,7 +3307,7 @@ async def test_list_data_policies_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( @@ -3305,11 +3332,6 @@ async def test_list_data_policies_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_data_policies_async_from_dict(): - await test_list_data_policies_async(request_type=dict) - - def test_list_data_policies_field_headers(): client = DataPolicyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3662,8 +3684,8 @@ async def test_list_data_policies_async_pages(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.GetIamPolicyRequest, - dict, + iam_policy_pb2.GetIamPolicyRequest(), + {}, ], ) def test_get_iam_policy(request_type, transport: str = "grpc"): @@ -3674,7 +3696,7 @@ def test_get_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(type(client.transport.get_iam_policy), "__call__") as call: @@ -3720,9 +3742,10 @@ def test_get_iam_policy_non_empty_request_with_auto_populated_field(): client.get_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.GetIamPolicyRequest( + request_msg = iam_policy_pb2.GetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_get_iam_policy_use_cached_wrapped_rpc(): @@ -3803,9 +3826,14 @@ async def test_get_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.GetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.GetIamPolicyRequest(), + {}, + ], +) +async def test_get_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = DataPolicyServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3813,7 +3841,7 @@ async def test_get_iam_policy_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_iam_policy), "__call__") as call: @@ -3838,11 +3866,6 @@ async def test_get_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_get_iam_policy_async_from_dict(): - await test_get_iam_policy_async(request_type=dict) - - def test_get_iam_policy_field_headers(): client = DataPolicyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3922,8 +3945,8 @@ def test_get_iam_policy_from_dict_foreign(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.SetIamPolicyRequest, - dict, + iam_policy_pb2.SetIamPolicyRequest(), + {}, ], ) def test_set_iam_policy(request_type, transport: str = "grpc"): @@ -3934,7 +3957,7 @@ def test_set_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(type(client.transport.set_iam_policy), "__call__") as call: @@ -3980,9 +4003,10 @@ def test_set_iam_policy_non_empty_request_with_auto_populated_field(): client.set_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.SetIamPolicyRequest( + request_msg = iam_policy_pb2.SetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_set_iam_policy_use_cached_wrapped_rpc(): @@ -4063,9 +4087,14 @@ async def test_set_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.SetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.SetIamPolicyRequest(), + {}, + ], +) +async def test_set_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = DataPolicyServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4073,7 +4102,7 @@ async def test_set_iam_policy_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.set_iam_policy), "__call__") as call: @@ -4098,11 +4127,6 @@ async def test_set_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_set_iam_policy_async_from_dict(): - await test_set_iam_policy_async(request_type=dict) - - def test_set_iam_policy_field_headers(): client = DataPolicyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4183,8 +4207,8 @@ def test_set_iam_policy_from_dict_foreign(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.TestIamPermissionsRequest, - dict, + iam_policy_pb2.TestIamPermissionsRequest(), + {}, ], ) def test_test_iam_permissions(request_type, transport: str = "grpc"): @@ -4195,7 +4219,7 @@ def test_test_iam_permissions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4243,9 +4267,10 @@ def test_test_iam_permissions_non_empty_request_with_auto_populated_field(): client.test_iam_permissions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.TestIamPermissionsRequest( + request_msg = iam_policy_pb2.TestIamPermissionsRequest( resource="resource_value", ) + assert args[0] == request_msg def test_test_iam_permissions_use_cached_wrapped_rpc(): @@ -4330,9 +4355,15 @@ async def test_test_iam_permissions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.TestIamPermissionsRequest(), + {}, + ], +) async def test_test_iam_permissions_async( - transport: str = "grpc_asyncio", - request_type=iam_policy_pb2.TestIamPermissionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataPolicyServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4341,7 +4372,7 @@ async def test_test_iam_permissions_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( @@ -4366,11 +4397,6 @@ async def test_test_iam_permissions_async( assert response.permissions == ["permissions_value"] -@pytest.mark.asyncio -async def test_test_iam_permissions_async_from_dict(): - await test_test_iam_permissions_async(request_type=dict) - - def test_test_iam_permissions_field_headers(): client = DataPolicyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6160,7 +6186,6 @@ def test_create_data_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datapolicy.CreateDataPolicyRequest() - assert args[0] == request_msg @@ -6183,7 +6208,6 @@ def test_update_data_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datapolicy.UpdateDataPolicyRequest() - assert args[0] == request_msg @@ -6206,7 +6230,6 @@ def test_rename_data_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datapolicy.RenameDataPolicyRequest() - assert args[0] == request_msg @@ -6229,7 +6252,6 @@ def test_delete_data_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datapolicy.DeleteDataPolicyRequest() - assert args[0] == request_msg @@ -6250,7 +6272,6 @@ def test_get_data_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datapolicy.GetDataPolicyRequest() - assert args[0] == request_msg @@ -6273,7 +6294,6 @@ def test_list_data_policies_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datapolicy.ListDataPoliciesRequest() - assert args[0] == request_msg @@ -6294,7 +6314,6 @@ def test_get_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -6315,7 +6334,6 @@ def test_set_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -6338,7 +6356,6 @@ def test_test_iam_permissions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -6383,7 +6400,6 @@ async def test_create_data_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datapolicy.CreateDataPolicyRequest() - assert args[0] == request_msg @@ -6414,7 +6430,6 @@ async def test_update_data_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datapolicy.UpdateDataPolicyRequest() - assert args[0] == request_msg @@ -6445,7 +6460,6 @@ async def test_rename_data_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datapolicy.RenameDataPolicyRequest() - assert args[0] == request_msg @@ -6470,7 +6484,6 @@ async def test_delete_data_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datapolicy.DeleteDataPolicyRequest() - assert args[0] == request_msg @@ -6499,7 +6512,6 @@ async def test_get_data_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datapolicy.GetDataPolicyRequest() - assert args[0] == request_msg @@ -6528,7 +6540,6 @@ async def test_list_data_policies_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datapolicy.ListDataPoliciesRequest() - assert args[0] == request_msg @@ -6556,7 +6567,6 @@ async def test_get_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -6584,7 +6594,6 @@ async def test_set_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -6613,7 +6622,6 @@ async def test_test_iam_permissions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -8004,7 +8012,6 @@ def test_create_data_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datapolicy.CreateDataPolicyRequest() - assert args[0] == request_msg @@ -8026,7 +8033,6 @@ def test_update_data_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datapolicy.UpdateDataPolicyRequest() - assert args[0] == request_msg @@ -8048,7 +8054,6 @@ def test_rename_data_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datapolicy.RenameDataPolicyRequest() - assert args[0] == request_msg @@ -8070,7 +8075,6 @@ def test_delete_data_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datapolicy.DeleteDataPolicyRequest() - assert args[0] == request_msg @@ -8090,7 +8094,6 @@ def test_get_data_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datapolicy.GetDataPolicyRequest() - assert args[0] == request_msg @@ -8112,7 +8115,6 @@ def test_list_data_policies_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datapolicy.ListDataPoliciesRequest() - assert args[0] == request_msg @@ -8132,7 +8134,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -8152,7 +8153,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -8174,7 +8174,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-bigquery-datapolicies/tests/unit/gapic/bigquery_datapolicies_v1beta1/test_data_policy_service.py b/packages/google-cloud-bigquery-datapolicies/tests/unit/gapic/bigquery_datapolicies_v1beta1/test_data_policy_service.py index b6a0efe0ca69..ec9549d242d2 100644 --- a/packages/google-cloud-bigquery-datapolicies/tests/unit/gapic/bigquery_datapolicies_v1beta1/test_data_policy_service.py +++ b/packages/google-cloud-bigquery-datapolicies/tests/unit/gapic/bigquery_datapolicies_v1beta1/test_data_policy_service.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 @@ -109,6 +110,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" @@ -1321,8 +1337,8 @@ def test_data_policy_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - datapolicy.CreateDataPolicyRequest, - dict, + datapolicy.CreateDataPolicyRequest(), + {}, ], ) def test_create_data_policy(request_type, transport: str = "grpc"): @@ -1333,7 +1349,7 @@ def test_create_data_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( @@ -1389,9 +1405,10 @@ def test_create_data_policy_non_empty_request_with_auto_populated_field(): client.create_data_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datapolicy.CreateDataPolicyRequest( + request_msg = datapolicy.CreateDataPolicyRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_data_policy_use_cached_wrapped_rpc(): @@ -1476,9 +1493,14 @@ async def test_create_data_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_data_policy_async( - transport: str = "grpc_asyncio", request_type=datapolicy.CreateDataPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datapolicy.CreateDataPolicyRequest(), + {}, + ], +) +async def test_create_data_policy_async(request_type, transport: str = "grpc_asyncio"): client = DataPolicyServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1486,7 +1508,7 @@ async def test_create_data_policy_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( @@ -1518,11 +1540,6 @@ async def test_create_data_policy_async( assert response.data_policy_id == "data_policy_id_value" -@pytest.mark.asyncio -async def test_create_data_policy_async_from_dict(): - await test_create_data_policy_async(request_type=dict) - - def test_create_data_policy_field_headers(): client = DataPolicyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1687,8 +1704,8 @@ async def test_create_data_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datapolicy.UpdateDataPolicyRequest, - dict, + datapolicy.UpdateDataPolicyRequest(), + {}, ], ) def test_update_data_policy(request_type, transport: str = "grpc"): @@ -1699,7 +1716,7 @@ def test_update_data_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( @@ -1753,7 +1770,8 @@ def test_update_data_policy_non_empty_request_with_auto_populated_field(): client.update_data_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datapolicy.UpdateDataPolicyRequest() + request_msg = datapolicy.UpdateDataPolicyRequest() + assert args[0] == request_msg def test_update_data_policy_use_cached_wrapped_rpc(): @@ -1838,9 +1856,14 @@ async def test_update_data_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_data_policy_async( - transport: str = "grpc_asyncio", request_type=datapolicy.UpdateDataPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datapolicy.UpdateDataPolicyRequest(), + {}, + ], +) +async def test_update_data_policy_async(request_type, transport: str = "grpc_asyncio"): client = DataPolicyServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1848,7 +1871,7 @@ async def test_update_data_policy_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( @@ -1880,11 +1903,6 @@ async def test_update_data_policy_async( assert response.data_policy_id == "data_policy_id_value" -@pytest.mark.asyncio -async def test_update_data_policy_async_from_dict(): - await test_update_data_policy_async(request_type=dict) - - def test_update_data_policy_field_headers(): client = DataPolicyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2049,8 +2067,8 @@ async def test_update_data_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datapolicy.DeleteDataPolicyRequest, - dict, + datapolicy.DeleteDataPolicyRequest(), + {}, ], ) def test_delete_data_policy(request_type, transport: str = "grpc"): @@ -2061,7 +2079,7 @@ def test_delete_data_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( @@ -2106,9 +2124,10 @@ def test_delete_data_policy_non_empty_request_with_auto_populated_field(): client.delete_data_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datapolicy.DeleteDataPolicyRequest( + request_msg = datapolicy.DeleteDataPolicyRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_data_policy_use_cached_wrapped_rpc(): @@ -2193,9 +2212,14 @@ async def test_delete_data_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_data_policy_async( - transport: str = "grpc_asyncio", request_type=datapolicy.DeleteDataPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datapolicy.DeleteDataPolicyRequest(), + {}, + ], +) +async def test_delete_data_policy_async(request_type, transport: str = "grpc_asyncio"): client = DataPolicyServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2203,7 +2227,7 @@ async def test_delete_data_policy_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( @@ -2223,11 +2247,6 @@ async def test_delete_data_policy_async( assert response is None -@pytest.mark.asyncio -async def test_delete_data_policy_async_from_dict(): - await test_delete_data_policy_async(request_type=dict) - - def test_delete_data_policy_field_headers(): client = DataPolicyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2378,8 +2397,8 @@ async def test_delete_data_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datapolicy.GetDataPolicyRequest, - dict, + datapolicy.GetDataPolicyRequest(), + {}, ], ) def test_get_data_policy(request_type, transport: str = "grpc"): @@ -2390,7 +2409,7 @@ def test_get_data_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(type(client.transport.get_data_policy), "__call__") as call: @@ -2442,9 +2461,10 @@ def test_get_data_policy_non_empty_request_with_auto_populated_field(): client.get_data_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datapolicy.GetDataPolicyRequest( + request_msg = datapolicy.GetDataPolicyRequest( name="name_value", ) + assert args[0] == request_msg def test_get_data_policy_use_cached_wrapped_rpc(): @@ -2525,9 +2545,14 @@ async def test_get_data_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_data_policy_async( - transport: str = "grpc_asyncio", request_type=datapolicy.GetDataPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datapolicy.GetDataPolicyRequest(), + {}, + ], +) +async def test_get_data_policy_async(request_type, transport: str = "grpc_asyncio"): client = DataPolicyServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2535,7 +2560,7 @@ async def test_get_data_policy_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_data_policy), "__call__") as call: @@ -2565,11 +2590,6 @@ async def test_get_data_policy_async( assert response.data_policy_id == "data_policy_id_value" -@pytest.mark.asyncio -async def test_get_data_policy_async_from_dict(): - await test_get_data_policy_async(request_type=dict) - - def test_get_data_policy_field_headers(): client = DataPolicyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2716,8 +2736,8 @@ async def test_get_data_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datapolicy.ListDataPoliciesRequest, - dict, + datapolicy.ListDataPoliciesRequest(), + {}, ], ) def test_list_data_policies(request_type, transport: str = "grpc"): @@ -2728,7 +2748,7 @@ def test_list_data_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( @@ -2777,10 +2797,11 @@ def test_list_data_policies_non_empty_request_with_auto_populated_field(): client.list_data_policies(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datapolicy.ListDataPoliciesRequest( + request_msg = datapolicy.ListDataPoliciesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_data_policies_use_cached_wrapped_rpc(): @@ -2865,9 +2886,14 @@ async def test_list_data_policies_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_data_policies_async( - transport: str = "grpc_asyncio", request_type=datapolicy.ListDataPoliciesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datapolicy.ListDataPoliciesRequest(), + {}, + ], +) +async def test_list_data_policies_async(request_type, transport: str = "grpc_asyncio"): client = DataPolicyServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2875,7 +2901,7 @@ async def test_list_data_policies_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( @@ -2900,11 +2926,6 @@ async def test_list_data_policies_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_data_policies_async_from_dict(): - await test_list_data_policies_async(request_type=dict) - - def test_list_data_policies_field_headers(): client = DataPolicyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3257,8 +3278,8 @@ async def test_list_data_policies_async_pages(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.GetIamPolicyRequest, - dict, + iam_policy_pb2.GetIamPolicyRequest(), + {}, ], ) def test_get_iam_policy(request_type, transport: str = "grpc"): @@ -3269,7 +3290,7 @@ def test_get_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(type(client.transport.get_iam_policy), "__call__") as call: @@ -3315,9 +3336,10 @@ def test_get_iam_policy_non_empty_request_with_auto_populated_field(): client.get_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.GetIamPolicyRequest( + request_msg = iam_policy_pb2.GetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_get_iam_policy_use_cached_wrapped_rpc(): @@ -3398,9 +3420,14 @@ async def test_get_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.GetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.GetIamPolicyRequest(), + {}, + ], +) +async def test_get_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = DataPolicyServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3408,7 +3435,7 @@ async def test_get_iam_policy_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_iam_policy), "__call__") as call: @@ -3433,11 +3460,6 @@ async def test_get_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_get_iam_policy_async_from_dict(): - await test_get_iam_policy_async(request_type=dict) - - def test_get_iam_policy_field_headers(): client = DataPolicyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3517,8 +3539,8 @@ def test_get_iam_policy_from_dict_foreign(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.SetIamPolicyRequest, - dict, + iam_policy_pb2.SetIamPolicyRequest(), + {}, ], ) def test_set_iam_policy(request_type, transport: str = "grpc"): @@ -3529,7 +3551,7 @@ def test_set_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(type(client.transport.set_iam_policy), "__call__") as call: @@ -3575,9 +3597,10 @@ def test_set_iam_policy_non_empty_request_with_auto_populated_field(): client.set_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.SetIamPolicyRequest( + request_msg = iam_policy_pb2.SetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_set_iam_policy_use_cached_wrapped_rpc(): @@ -3658,9 +3681,14 @@ async def test_set_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.SetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.SetIamPolicyRequest(), + {}, + ], +) +async def test_set_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = DataPolicyServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3668,7 +3696,7 @@ async def test_set_iam_policy_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.set_iam_policy), "__call__") as call: @@ -3693,11 +3721,6 @@ async def test_set_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_set_iam_policy_async_from_dict(): - await test_set_iam_policy_async(request_type=dict) - - def test_set_iam_policy_field_headers(): client = DataPolicyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3778,8 +3801,8 @@ def test_set_iam_policy_from_dict_foreign(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.TestIamPermissionsRequest, - dict, + iam_policy_pb2.TestIamPermissionsRequest(), + {}, ], ) def test_test_iam_permissions(request_type, transport: str = "grpc"): @@ -3790,7 +3813,7 @@ def test_test_iam_permissions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3838,9 +3861,10 @@ def test_test_iam_permissions_non_empty_request_with_auto_populated_field(): client.test_iam_permissions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.TestIamPermissionsRequest( + request_msg = iam_policy_pb2.TestIamPermissionsRequest( resource="resource_value", ) + assert args[0] == request_msg def test_test_iam_permissions_use_cached_wrapped_rpc(): @@ -3925,9 +3949,15 @@ async def test_test_iam_permissions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.TestIamPermissionsRequest(), + {}, + ], +) async def test_test_iam_permissions_async( - transport: str = "grpc_asyncio", - request_type=iam_policy_pb2.TestIamPermissionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataPolicyServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3936,7 +3966,7 @@ async def test_test_iam_permissions_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( @@ -3961,11 +3991,6 @@ async def test_test_iam_permissions_async( assert response.permissions == ["permissions_value"] -@pytest.mark.asyncio -async def test_test_iam_permissions_async_from_dict(): - await test_test_iam_permissions_async(request_type=dict) - - def test_test_iam_permissions_field_headers(): client = DataPolicyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4174,7 +4199,6 @@ def test_create_data_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datapolicy.CreateDataPolicyRequest() - assert args[0] == request_msg @@ -4197,7 +4221,6 @@ def test_update_data_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datapolicy.UpdateDataPolicyRequest() - assert args[0] == request_msg @@ -4220,7 +4243,6 @@ def test_delete_data_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datapolicy.DeleteDataPolicyRequest() - assert args[0] == request_msg @@ -4241,7 +4263,6 @@ def test_get_data_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datapolicy.GetDataPolicyRequest() - assert args[0] == request_msg @@ -4264,7 +4285,6 @@ def test_list_data_policies_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datapolicy.ListDataPoliciesRequest() - assert args[0] == request_msg @@ -4285,7 +4305,6 @@ def test_get_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -4306,7 +4325,6 @@ def test_set_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -4329,7 +4347,6 @@ def test_test_iam_permissions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -4374,7 +4391,6 @@ async def test_create_data_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datapolicy.CreateDataPolicyRequest() - assert args[0] == request_msg @@ -4405,7 +4421,6 @@ async def test_update_data_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datapolicy.UpdateDataPolicyRequest() - assert args[0] == request_msg @@ -4430,7 +4445,6 @@ async def test_delete_data_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datapolicy.DeleteDataPolicyRequest() - assert args[0] == request_msg @@ -4459,7 +4473,6 @@ async def test_get_data_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datapolicy.GetDataPolicyRequest() - assert args[0] == request_msg @@ -4488,7 +4501,6 @@ async def test_list_data_policies_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datapolicy.ListDataPoliciesRequest() - assert args[0] == request_msg @@ -4516,7 +4528,6 @@ async def test_get_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -4544,7 +4555,6 @@ async def test_set_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -4573,7 +4583,6 @@ async def test_test_iam_permissions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-bigquery-datapolicies/tests/unit/gapic/bigquery_datapolicies_v2/test_data_policy_service.py b/packages/google-cloud-bigquery-datapolicies/tests/unit/gapic/bigquery_datapolicies_v2/test_data_policy_service.py index 340bb030ba90..af82a1135624 100644 --- a/packages/google-cloud-bigquery-datapolicies/tests/unit/gapic/bigquery_datapolicies_v2/test_data_policy_service.py +++ b/packages/google-cloud-bigquery-datapolicies/tests/unit/gapic/bigquery_datapolicies_v2/test_data_policy_service.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" @@ -1356,8 +1372,8 @@ def test_data_policy_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - datapolicy.CreateDataPolicyRequest, - dict, + datapolicy.CreateDataPolicyRequest(), + {}, ], ) def test_create_data_policy(request_type, transport: str = "grpc"): @@ -1368,7 +1384,7 @@ def test_create_data_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( @@ -1432,10 +1448,11 @@ def test_create_data_policy_non_empty_request_with_auto_populated_field(): client.create_data_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datapolicy.CreateDataPolicyRequest( + request_msg = datapolicy.CreateDataPolicyRequest( parent="parent_value", data_policy_id="data_policy_id_value", ) + assert args[0] == request_msg def test_create_data_policy_use_cached_wrapped_rpc(): @@ -1520,9 +1537,14 @@ async def test_create_data_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_data_policy_async( - transport: str = "grpc_asyncio", request_type=datapolicy.CreateDataPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datapolicy.CreateDataPolicyRequest(), + {}, + ], +) +async def test_create_data_policy_async(request_type, transport: str = "grpc_asyncio"): client = DataPolicyServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1530,7 +1552,7 @@ async def test_create_data_policy_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( @@ -1570,11 +1592,6 @@ async def test_create_data_policy_async( assert response.version == datapolicy.DataPolicy.Version.V1 -@pytest.mark.asyncio -async def test_create_data_policy_async_from_dict(): - await test_create_data_policy_async(request_type=dict) - - def test_create_data_policy_field_headers(): client = DataPolicyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1773,8 +1790,8 @@ async def test_create_data_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datapolicy.AddGranteesRequest, - dict, + datapolicy.AddGranteesRequest(), + {}, ], ) def test_add_grantees(request_type, transport: str = "grpc"): @@ -1785,7 +1802,7 @@ def test_add_grantees(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.add_grantees), "__call__") as call: @@ -1844,9 +1861,10 @@ def test_add_grantees_non_empty_request_with_auto_populated_field(): client.add_grantees(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datapolicy.AddGranteesRequest( + request_msg = datapolicy.AddGranteesRequest( data_policy="data_policy_value", ) + assert args[0] == request_msg def test_add_grantees_use_cached_wrapped_rpc(): @@ -1927,9 +1945,14 @@ async def test_add_grantees_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_add_grantees_async( - transport: str = "grpc_asyncio", request_type=datapolicy.AddGranteesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datapolicy.AddGranteesRequest(), + {}, + ], +) +async def test_add_grantees_async(request_type, transport: str = "grpc_asyncio"): client = DataPolicyServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1937,7 +1960,7 @@ async def test_add_grantees_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.add_grantees), "__call__") as call: @@ -1975,11 +1998,6 @@ async def test_add_grantees_async( assert response.version == datapolicy.DataPolicy.Version.V1 -@pytest.mark.asyncio -async def test_add_grantees_async_from_dict(): - await test_add_grantees_async(request_type=dict) - - def test_add_grantees_field_headers(): client = DataPolicyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2136,8 +2154,8 @@ async def test_add_grantees_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datapolicy.RemoveGranteesRequest, - dict, + datapolicy.RemoveGranteesRequest(), + {}, ], ) def test_remove_grantees(request_type, transport: str = "grpc"): @@ -2148,7 +2166,7 @@ def test_remove_grantees(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.remove_grantees), "__call__") as call: @@ -2207,9 +2225,10 @@ def test_remove_grantees_non_empty_request_with_auto_populated_field(): client.remove_grantees(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datapolicy.RemoveGranteesRequest( + request_msg = datapolicy.RemoveGranteesRequest( data_policy="data_policy_value", ) + assert args[0] == request_msg def test_remove_grantees_use_cached_wrapped_rpc(): @@ -2290,9 +2309,14 @@ async def test_remove_grantees_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_remove_grantees_async( - transport: str = "grpc_asyncio", request_type=datapolicy.RemoveGranteesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datapolicy.RemoveGranteesRequest(), + {}, + ], +) +async def test_remove_grantees_async(request_type, transport: str = "grpc_asyncio"): client = DataPolicyServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2300,7 +2324,7 @@ async def test_remove_grantees_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.remove_grantees), "__call__") as call: @@ -2338,11 +2362,6 @@ async def test_remove_grantees_async( assert response.version == datapolicy.DataPolicy.Version.V1 -@pytest.mark.asyncio -async def test_remove_grantees_async_from_dict(): - await test_remove_grantees_async(request_type=dict) - - def test_remove_grantees_field_headers(): client = DataPolicyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2499,8 +2518,8 @@ async def test_remove_grantees_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datapolicy.UpdateDataPolicyRequest, - dict, + datapolicy.UpdateDataPolicyRequest(), + {}, ], ) def test_update_data_policy(request_type, transport: str = "grpc"): @@ -2511,7 +2530,7 @@ def test_update_data_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( @@ -2572,7 +2591,8 @@ def test_update_data_policy_non_empty_request_with_auto_populated_field(): client.update_data_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datapolicy.UpdateDataPolicyRequest() + request_msg = datapolicy.UpdateDataPolicyRequest() + assert args[0] == request_msg def test_update_data_policy_use_cached_wrapped_rpc(): @@ -2657,9 +2677,14 @@ async def test_update_data_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_data_policy_async( - transport: str = "grpc_asyncio", request_type=datapolicy.UpdateDataPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datapolicy.UpdateDataPolicyRequest(), + {}, + ], +) +async def test_update_data_policy_async(request_type, transport: str = "grpc_asyncio"): client = DataPolicyServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2667,7 +2692,7 @@ async def test_update_data_policy_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( @@ -2707,11 +2732,6 @@ async def test_update_data_policy_async( assert response.version == datapolicy.DataPolicy.Version.V1 -@pytest.mark.asyncio -async def test_update_data_policy_async_from_dict(): - await test_update_data_policy_async(request_type=dict) - - def test_update_data_policy_field_headers(): client = DataPolicyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2900,8 +2920,8 @@ async def test_update_data_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datapolicy.DeleteDataPolicyRequest, - dict, + datapolicy.DeleteDataPolicyRequest(), + {}, ], ) def test_delete_data_policy(request_type, transport: str = "grpc"): @@ -2912,7 +2932,7 @@ def test_delete_data_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( @@ -2957,9 +2977,10 @@ def test_delete_data_policy_non_empty_request_with_auto_populated_field(): client.delete_data_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datapolicy.DeleteDataPolicyRequest( + request_msg = datapolicy.DeleteDataPolicyRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_data_policy_use_cached_wrapped_rpc(): @@ -3044,9 +3065,14 @@ async def test_delete_data_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_data_policy_async( - transport: str = "grpc_asyncio", request_type=datapolicy.DeleteDataPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datapolicy.DeleteDataPolicyRequest(), + {}, + ], +) +async def test_delete_data_policy_async(request_type, transport: str = "grpc_asyncio"): client = DataPolicyServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3054,7 +3080,7 @@ async def test_delete_data_policy_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( @@ -3074,11 +3100,6 @@ async def test_delete_data_policy_async( assert response is None -@pytest.mark.asyncio -async def test_delete_data_policy_async_from_dict(): - await test_delete_data_policy_async(request_type=dict) - - def test_delete_data_policy_field_headers(): client = DataPolicyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3229,8 +3250,8 @@ async def test_delete_data_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datapolicy.GetDataPolicyRequest, - dict, + datapolicy.GetDataPolicyRequest(), + {}, ], ) def test_get_data_policy(request_type, transport: str = "grpc"): @@ -3241,7 +3262,7 @@ def test_get_data_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(type(client.transport.get_data_policy), "__call__") as call: @@ -3300,9 +3321,10 @@ def test_get_data_policy_non_empty_request_with_auto_populated_field(): client.get_data_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datapolicy.GetDataPolicyRequest( + request_msg = datapolicy.GetDataPolicyRequest( name="name_value", ) + assert args[0] == request_msg def test_get_data_policy_use_cached_wrapped_rpc(): @@ -3383,9 +3405,14 @@ async def test_get_data_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_data_policy_async( - transport: str = "grpc_asyncio", request_type=datapolicy.GetDataPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datapolicy.GetDataPolicyRequest(), + {}, + ], +) +async def test_get_data_policy_async(request_type, transport: str = "grpc_asyncio"): client = DataPolicyServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3393,7 +3420,7 @@ async def test_get_data_policy_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_data_policy), "__call__") as call: @@ -3431,11 +3458,6 @@ async def test_get_data_policy_async( assert response.version == datapolicy.DataPolicy.Version.V1 -@pytest.mark.asyncio -async def test_get_data_policy_async_from_dict(): - await test_get_data_policy_async(request_type=dict) - - def test_get_data_policy_field_headers(): client = DataPolicyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3582,8 +3604,8 @@ async def test_get_data_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datapolicy.ListDataPoliciesRequest, - dict, + datapolicy.ListDataPoliciesRequest(), + {}, ], ) def test_list_data_policies(request_type, transport: str = "grpc"): @@ -3594,7 +3616,7 @@ def test_list_data_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( @@ -3644,11 +3666,12 @@ def test_list_data_policies_non_empty_request_with_auto_populated_field(): client.list_data_policies(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datapolicy.ListDataPoliciesRequest( + request_msg = datapolicy.ListDataPoliciesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_data_policies_use_cached_wrapped_rpc(): @@ -3733,9 +3756,14 @@ async def test_list_data_policies_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_data_policies_async( - transport: str = "grpc_asyncio", request_type=datapolicy.ListDataPoliciesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datapolicy.ListDataPoliciesRequest(), + {}, + ], +) +async def test_list_data_policies_async(request_type, transport: str = "grpc_asyncio"): client = DataPolicyServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3743,7 +3771,7 @@ async def test_list_data_policies_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( @@ -3768,11 +3796,6 @@ async def test_list_data_policies_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_data_policies_async_from_dict(): - await test_list_data_policies_async(request_type=dict) - - def test_list_data_policies_field_headers(): client = DataPolicyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4125,8 +4148,8 @@ async def test_list_data_policies_async_pages(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.GetIamPolicyRequest, - dict, + iam_policy_pb2.GetIamPolicyRequest(), + {}, ], ) def test_get_iam_policy(request_type, transport: str = "grpc"): @@ -4137,7 +4160,7 @@ def test_get_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(type(client.transport.get_iam_policy), "__call__") as call: @@ -4183,9 +4206,10 @@ def test_get_iam_policy_non_empty_request_with_auto_populated_field(): client.get_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.GetIamPolicyRequest( + request_msg = iam_policy_pb2.GetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_get_iam_policy_use_cached_wrapped_rpc(): @@ -4266,9 +4290,14 @@ async def test_get_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.GetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.GetIamPolicyRequest(), + {}, + ], +) +async def test_get_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = DataPolicyServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4276,7 +4305,7 @@ async def test_get_iam_policy_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_iam_policy), "__call__") as call: @@ -4301,11 +4330,6 @@ async def test_get_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_get_iam_policy_async_from_dict(): - await test_get_iam_policy_async(request_type=dict) - - def test_get_iam_policy_field_headers(): client = DataPolicyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4385,8 +4409,8 @@ def test_get_iam_policy_from_dict_foreign(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.SetIamPolicyRequest, - dict, + iam_policy_pb2.SetIamPolicyRequest(), + {}, ], ) def test_set_iam_policy(request_type, transport: str = "grpc"): @@ -4397,7 +4421,7 @@ def test_set_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(type(client.transport.set_iam_policy), "__call__") as call: @@ -4443,9 +4467,10 @@ def test_set_iam_policy_non_empty_request_with_auto_populated_field(): client.set_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.SetIamPolicyRequest( + request_msg = iam_policy_pb2.SetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_set_iam_policy_use_cached_wrapped_rpc(): @@ -4526,9 +4551,14 @@ async def test_set_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.SetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.SetIamPolicyRequest(), + {}, + ], +) +async def test_set_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = DataPolicyServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4536,7 +4566,7 @@ async def test_set_iam_policy_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.set_iam_policy), "__call__") as call: @@ -4561,11 +4591,6 @@ async def test_set_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_set_iam_policy_async_from_dict(): - await test_set_iam_policy_async(request_type=dict) - - def test_set_iam_policy_field_headers(): client = DataPolicyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4646,8 +4671,8 @@ def test_set_iam_policy_from_dict_foreign(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.TestIamPermissionsRequest, - dict, + iam_policy_pb2.TestIamPermissionsRequest(), + {}, ], ) def test_test_iam_permissions(request_type, transport: str = "grpc"): @@ -4658,7 +4683,7 @@ def test_test_iam_permissions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4706,9 +4731,10 @@ def test_test_iam_permissions_non_empty_request_with_auto_populated_field(): client.test_iam_permissions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.TestIamPermissionsRequest( + request_msg = iam_policy_pb2.TestIamPermissionsRequest( resource="resource_value", ) + assert args[0] == request_msg def test_test_iam_permissions_use_cached_wrapped_rpc(): @@ -4793,9 +4819,15 @@ async def test_test_iam_permissions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.TestIamPermissionsRequest(), + {}, + ], +) async def test_test_iam_permissions_async( - transport: str = "grpc_asyncio", - request_type=iam_policy_pb2.TestIamPermissionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataPolicyServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4804,7 +4836,7 @@ async def test_test_iam_permissions_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( @@ -4829,11 +4861,6 @@ async def test_test_iam_permissions_async( assert response.permissions == ["permissions_value"] -@pytest.mark.asyncio -async def test_test_iam_permissions_async_from_dict(): - await test_test_iam_permissions_async(request_type=dict) - - def test_test_iam_permissions_field_headers(): client = DataPolicyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6848,7 +6875,6 @@ def test_create_data_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datapolicy.CreateDataPolicyRequest() - assert args[0] == request_msg @@ -6869,7 +6895,6 @@ def test_add_grantees_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datapolicy.AddGranteesRequest() - assert args[0] == request_msg @@ -6890,7 +6915,6 @@ def test_remove_grantees_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datapolicy.RemoveGranteesRequest() - assert args[0] == request_msg @@ -6913,7 +6937,6 @@ def test_update_data_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datapolicy.UpdateDataPolicyRequest() - assert args[0] == request_msg @@ -6936,7 +6959,6 @@ def test_delete_data_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datapolicy.DeleteDataPolicyRequest() - assert args[0] == request_msg @@ -6957,7 +6979,6 @@ def test_get_data_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datapolicy.GetDataPolicyRequest() - assert args[0] == request_msg @@ -6980,7 +7001,6 @@ def test_list_data_policies_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datapolicy.ListDataPoliciesRequest() - assert args[0] == request_msg @@ -7001,7 +7021,6 @@ def test_get_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -7022,7 +7041,6 @@ def test_set_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -7045,7 +7063,6 @@ def test_test_iam_permissions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -7094,7 +7111,6 @@ async def test_create_data_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datapolicy.CreateDataPolicyRequest() - assert args[0] == request_msg @@ -7127,7 +7143,6 @@ async def test_add_grantees_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datapolicy.AddGranteesRequest() - assert args[0] == request_msg @@ -7160,7 +7175,6 @@ async def test_remove_grantees_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datapolicy.RemoveGranteesRequest() - assert args[0] == request_msg @@ -7195,7 +7209,6 @@ async def test_update_data_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datapolicy.UpdateDataPolicyRequest() - assert args[0] == request_msg @@ -7220,7 +7233,6 @@ async def test_delete_data_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datapolicy.DeleteDataPolicyRequest() - assert args[0] == request_msg @@ -7253,7 +7265,6 @@ async def test_get_data_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datapolicy.GetDataPolicyRequest() - assert args[0] == request_msg @@ -7282,7 +7293,6 @@ async def test_list_data_policies_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datapolicy.ListDataPoliciesRequest() - assert args[0] == request_msg @@ -7310,7 +7320,6 @@ async def test_get_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -7338,7 +7347,6 @@ async def test_set_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -7367,7 +7375,6 @@ async def test_test_iam_permissions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -8865,7 +8872,6 @@ def test_create_data_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datapolicy.CreateDataPolicyRequest() - assert args[0] == request_msg @@ -8885,7 +8891,6 @@ def test_add_grantees_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datapolicy.AddGranteesRequest() - assert args[0] == request_msg @@ -8905,7 +8910,6 @@ def test_remove_grantees_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datapolicy.RemoveGranteesRequest() - assert args[0] == request_msg @@ -8927,7 +8931,6 @@ def test_update_data_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datapolicy.UpdateDataPolicyRequest() - assert args[0] == request_msg @@ -8949,7 +8952,6 @@ def test_delete_data_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datapolicy.DeleteDataPolicyRequest() - assert args[0] == request_msg @@ -8969,7 +8971,6 @@ def test_get_data_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datapolicy.GetDataPolicyRequest() - assert args[0] == request_msg @@ -8991,7 +8992,6 @@ def test_list_data_policies_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datapolicy.ListDataPoliciesRequest() - assert args[0] == request_msg @@ -9011,7 +9011,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -9031,7 +9030,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -9053,7 +9051,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-bigquery-datapolicies/tests/unit/gapic/bigquery_datapolicies_v2beta1/test_data_policy_service.py b/packages/google-cloud-bigquery-datapolicies/tests/unit/gapic/bigquery_datapolicies_v2beta1/test_data_policy_service.py index 0ad5caeb97c2..8975e3beaa06 100644 --- a/packages/google-cloud-bigquery-datapolicies/tests/unit/gapic/bigquery_datapolicies_v2beta1/test_data_policy_service.py +++ b/packages/google-cloud-bigquery-datapolicies/tests/unit/gapic/bigquery_datapolicies_v2beta1/test_data_policy_service.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" @@ -1356,8 +1372,8 @@ def test_data_policy_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - datapolicy.CreateDataPolicyRequest, - dict, + datapolicy.CreateDataPolicyRequest(), + {}, ], ) def test_create_data_policy(request_type, transport: str = "grpc"): @@ -1368,7 +1384,7 @@ def test_create_data_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( @@ -1432,10 +1448,11 @@ def test_create_data_policy_non_empty_request_with_auto_populated_field(): client.create_data_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datapolicy.CreateDataPolicyRequest( + request_msg = datapolicy.CreateDataPolicyRequest( parent="parent_value", data_policy_id="data_policy_id_value", ) + assert args[0] == request_msg def test_create_data_policy_use_cached_wrapped_rpc(): @@ -1520,9 +1537,14 @@ async def test_create_data_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_data_policy_async( - transport: str = "grpc_asyncio", request_type=datapolicy.CreateDataPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datapolicy.CreateDataPolicyRequest(), + {}, + ], +) +async def test_create_data_policy_async(request_type, transport: str = "grpc_asyncio"): client = DataPolicyServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1530,7 +1552,7 @@ async def test_create_data_policy_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( @@ -1570,11 +1592,6 @@ async def test_create_data_policy_async( assert response.version == datapolicy.DataPolicy.Version.V1 -@pytest.mark.asyncio -async def test_create_data_policy_async_from_dict(): - await test_create_data_policy_async(request_type=dict) - - def test_create_data_policy_field_headers(): client = DataPolicyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1773,8 +1790,8 @@ async def test_create_data_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datapolicy.AddGranteesRequest, - dict, + datapolicy.AddGranteesRequest(), + {}, ], ) def test_add_grantees(request_type, transport: str = "grpc"): @@ -1785,7 +1802,7 @@ def test_add_grantees(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.add_grantees), "__call__") as call: @@ -1844,9 +1861,10 @@ def test_add_grantees_non_empty_request_with_auto_populated_field(): client.add_grantees(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datapolicy.AddGranteesRequest( + request_msg = datapolicy.AddGranteesRequest( data_policy="data_policy_value", ) + assert args[0] == request_msg def test_add_grantees_use_cached_wrapped_rpc(): @@ -1927,9 +1945,14 @@ async def test_add_grantees_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_add_grantees_async( - transport: str = "grpc_asyncio", request_type=datapolicy.AddGranteesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datapolicy.AddGranteesRequest(), + {}, + ], +) +async def test_add_grantees_async(request_type, transport: str = "grpc_asyncio"): client = DataPolicyServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1937,7 +1960,7 @@ async def test_add_grantees_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.add_grantees), "__call__") as call: @@ -1975,11 +1998,6 @@ async def test_add_grantees_async( assert response.version == datapolicy.DataPolicy.Version.V1 -@pytest.mark.asyncio -async def test_add_grantees_async_from_dict(): - await test_add_grantees_async(request_type=dict) - - def test_add_grantees_field_headers(): client = DataPolicyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2136,8 +2154,8 @@ async def test_add_grantees_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datapolicy.RemoveGranteesRequest, - dict, + datapolicy.RemoveGranteesRequest(), + {}, ], ) def test_remove_grantees(request_type, transport: str = "grpc"): @@ -2148,7 +2166,7 @@ def test_remove_grantees(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.remove_grantees), "__call__") as call: @@ -2207,9 +2225,10 @@ def test_remove_grantees_non_empty_request_with_auto_populated_field(): client.remove_grantees(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datapolicy.RemoveGranteesRequest( + request_msg = datapolicy.RemoveGranteesRequest( data_policy="data_policy_value", ) + assert args[0] == request_msg def test_remove_grantees_use_cached_wrapped_rpc(): @@ -2290,9 +2309,14 @@ async def test_remove_grantees_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_remove_grantees_async( - transport: str = "grpc_asyncio", request_type=datapolicy.RemoveGranteesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datapolicy.RemoveGranteesRequest(), + {}, + ], +) +async def test_remove_grantees_async(request_type, transport: str = "grpc_asyncio"): client = DataPolicyServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2300,7 +2324,7 @@ async def test_remove_grantees_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.remove_grantees), "__call__") as call: @@ -2338,11 +2362,6 @@ async def test_remove_grantees_async( assert response.version == datapolicy.DataPolicy.Version.V1 -@pytest.mark.asyncio -async def test_remove_grantees_async_from_dict(): - await test_remove_grantees_async(request_type=dict) - - def test_remove_grantees_field_headers(): client = DataPolicyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2499,8 +2518,8 @@ async def test_remove_grantees_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datapolicy.UpdateDataPolicyRequest, - dict, + datapolicy.UpdateDataPolicyRequest(), + {}, ], ) def test_update_data_policy(request_type, transport: str = "grpc"): @@ -2511,7 +2530,7 @@ def test_update_data_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( @@ -2572,7 +2591,8 @@ def test_update_data_policy_non_empty_request_with_auto_populated_field(): client.update_data_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datapolicy.UpdateDataPolicyRequest() + request_msg = datapolicy.UpdateDataPolicyRequest() + assert args[0] == request_msg def test_update_data_policy_use_cached_wrapped_rpc(): @@ -2657,9 +2677,14 @@ async def test_update_data_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_data_policy_async( - transport: str = "grpc_asyncio", request_type=datapolicy.UpdateDataPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datapolicy.UpdateDataPolicyRequest(), + {}, + ], +) +async def test_update_data_policy_async(request_type, transport: str = "grpc_asyncio"): client = DataPolicyServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2667,7 +2692,7 @@ async def test_update_data_policy_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( @@ -2707,11 +2732,6 @@ async def test_update_data_policy_async( assert response.version == datapolicy.DataPolicy.Version.V1 -@pytest.mark.asyncio -async def test_update_data_policy_async_from_dict(): - await test_update_data_policy_async(request_type=dict) - - def test_update_data_policy_field_headers(): client = DataPolicyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2900,8 +2920,8 @@ async def test_update_data_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datapolicy.DeleteDataPolicyRequest, - dict, + datapolicy.DeleteDataPolicyRequest(), + {}, ], ) def test_delete_data_policy(request_type, transport: str = "grpc"): @@ -2912,7 +2932,7 @@ def test_delete_data_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( @@ -2957,9 +2977,10 @@ def test_delete_data_policy_non_empty_request_with_auto_populated_field(): client.delete_data_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datapolicy.DeleteDataPolicyRequest( + request_msg = datapolicy.DeleteDataPolicyRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_data_policy_use_cached_wrapped_rpc(): @@ -3044,9 +3065,14 @@ async def test_delete_data_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_data_policy_async( - transport: str = "grpc_asyncio", request_type=datapolicy.DeleteDataPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datapolicy.DeleteDataPolicyRequest(), + {}, + ], +) +async def test_delete_data_policy_async(request_type, transport: str = "grpc_asyncio"): client = DataPolicyServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3054,7 +3080,7 @@ async def test_delete_data_policy_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( @@ -3074,11 +3100,6 @@ async def test_delete_data_policy_async( assert response is None -@pytest.mark.asyncio -async def test_delete_data_policy_async_from_dict(): - await test_delete_data_policy_async(request_type=dict) - - def test_delete_data_policy_field_headers(): client = DataPolicyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3229,8 +3250,8 @@ async def test_delete_data_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datapolicy.GetDataPolicyRequest, - dict, + datapolicy.GetDataPolicyRequest(), + {}, ], ) def test_get_data_policy(request_type, transport: str = "grpc"): @@ -3241,7 +3262,7 @@ def test_get_data_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(type(client.transport.get_data_policy), "__call__") as call: @@ -3300,9 +3321,10 @@ def test_get_data_policy_non_empty_request_with_auto_populated_field(): client.get_data_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datapolicy.GetDataPolicyRequest( + request_msg = datapolicy.GetDataPolicyRequest( name="name_value", ) + assert args[0] == request_msg def test_get_data_policy_use_cached_wrapped_rpc(): @@ -3383,9 +3405,14 @@ async def test_get_data_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_data_policy_async( - transport: str = "grpc_asyncio", request_type=datapolicy.GetDataPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datapolicy.GetDataPolicyRequest(), + {}, + ], +) +async def test_get_data_policy_async(request_type, transport: str = "grpc_asyncio"): client = DataPolicyServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3393,7 +3420,7 @@ async def test_get_data_policy_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_data_policy), "__call__") as call: @@ -3431,11 +3458,6 @@ async def test_get_data_policy_async( assert response.version == datapolicy.DataPolicy.Version.V1 -@pytest.mark.asyncio -async def test_get_data_policy_async_from_dict(): - await test_get_data_policy_async(request_type=dict) - - def test_get_data_policy_field_headers(): client = DataPolicyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3582,8 +3604,8 @@ async def test_get_data_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datapolicy.ListDataPoliciesRequest, - dict, + datapolicy.ListDataPoliciesRequest(), + {}, ], ) def test_list_data_policies(request_type, transport: str = "grpc"): @@ -3594,7 +3616,7 @@ def test_list_data_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( @@ -3643,10 +3665,11 @@ def test_list_data_policies_non_empty_request_with_auto_populated_field(): client.list_data_policies(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datapolicy.ListDataPoliciesRequest( + request_msg = datapolicy.ListDataPoliciesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_data_policies_use_cached_wrapped_rpc(): @@ -3731,9 +3754,14 @@ async def test_list_data_policies_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_data_policies_async( - transport: str = "grpc_asyncio", request_type=datapolicy.ListDataPoliciesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datapolicy.ListDataPoliciesRequest(), + {}, + ], +) +async def test_list_data_policies_async(request_type, transport: str = "grpc_asyncio"): client = DataPolicyServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3741,7 +3769,7 @@ async def test_list_data_policies_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( @@ -3766,11 +3794,6 @@ async def test_list_data_policies_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_data_policies_async_from_dict(): - await test_list_data_policies_async(request_type=dict) - - def test_list_data_policies_field_headers(): client = DataPolicyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4123,8 +4146,8 @@ async def test_list_data_policies_async_pages(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.GetIamPolicyRequest, - dict, + iam_policy_pb2.GetIamPolicyRequest(), + {}, ], ) def test_get_iam_policy(request_type, transport: str = "grpc"): @@ -4135,7 +4158,7 @@ def test_get_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(type(client.transport.get_iam_policy), "__call__") as call: @@ -4181,9 +4204,10 @@ def test_get_iam_policy_non_empty_request_with_auto_populated_field(): client.get_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.GetIamPolicyRequest( + request_msg = iam_policy_pb2.GetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_get_iam_policy_use_cached_wrapped_rpc(): @@ -4264,9 +4288,14 @@ async def test_get_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.GetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.GetIamPolicyRequest(), + {}, + ], +) +async def test_get_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = DataPolicyServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4274,7 +4303,7 @@ async def test_get_iam_policy_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_iam_policy), "__call__") as call: @@ -4299,11 +4328,6 @@ async def test_get_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_get_iam_policy_async_from_dict(): - await test_get_iam_policy_async(request_type=dict) - - def test_get_iam_policy_field_headers(): client = DataPolicyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4383,8 +4407,8 @@ def test_get_iam_policy_from_dict_foreign(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.SetIamPolicyRequest, - dict, + iam_policy_pb2.SetIamPolicyRequest(), + {}, ], ) def test_set_iam_policy(request_type, transport: str = "grpc"): @@ -4395,7 +4419,7 @@ def test_set_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(type(client.transport.set_iam_policy), "__call__") as call: @@ -4441,9 +4465,10 @@ def test_set_iam_policy_non_empty_request_with_auto_populated_field(): client.set_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.SetIamPolicyRequest( + request_msg = iam_policy_pb2.SetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_set_iam_policy_use_cached_wrapped_rpc(): @@ -4524,9 +4549,14 @@ async def test_set_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.SetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.SetIamPolicyRequest(), + {}, + ], +) +async def test_set_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = DataPolicyServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4534,7 +4564,7 @@ async def test_set_iam_policy_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.set_iam_policy), "__call__") as call: @@ -4559,11 +4589,6 @@ async def test_set_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_set_iam_policy_async_from_dict(): - await test_set_iam_policy_async(request_type=dict) - - def test_set_iam_policy_field_headers(): client = DataPolicyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4644,8 +4669,8 @@ def test_set_iam_policy_from_dict_foreign(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.TestIamPermissionsRequest, - dict, + iam_policy_pb2.TestIamPermissionsRequest(), + {}, ], ) def test_test_iam_permissions(request_type, transport: str = "grpc"): @@ -4656,7 +4681,7 @@ def test_test_iam_permissions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4704,9 +4729,10 @@ def test_test_iam_permissions_non_empty_request_with_auto_populated_field(): client.test_iam_permissions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.TestIamPermissionsRequest( + request_msg = iam_policy_pb2.TestIamPermissionsRequest( resource="resource_value", ) + assert args[0] == request_msg def test_test_iam_permissions_use_cached_wrapped_rpc(): @@ -4791,9 +4817,15 @@ async def test_test_iam_permissions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.TestIamPermissionsRequest(), + {}, + ], +) async def test_test_iam_permissions_async( - transport: str = "grpc_asyncio", - request_type=iam_policy_pb2.TestIamPermissionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataPolicyServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4802,7 +4834,7 @@ async def test_test_iam_permissions_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( @@ -4827,11 +4859,6 @@ async def test_test_iam_permissions_async( assert response.permissions == ["permissions_value"] -@pytest.mark.asyncio -async def test_test_iam_permissions_async_from_dict(): - await test_test_iam_permissions_async(request_type=dict) - - def test_test_iam_permissions_field_headers(): client = DataPolicyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6831,7 +6858,6 @@ def test_create_data_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datapolicy.CreateDataPolicyRequest() - assert args[0] == request_msg @@ -6852,7 +6878,6 @@ def test_add_grantees_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datapolicy.AddGranteesRequest() - assert args[0] == request_msg @@ -6873,7 +6898,6 @@ def test_remove_grantees_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datapolicy.RemoveGranteesRequest() - assert args[0] == request_msg @@ -6896,7 +6920,6 @@ def test_update_data_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datapolicy.UpdateDataPolicyRequest() - assert args[0] == request_msg @@ -6919,7 +6942,6 @@ def test_delete_data_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datapolicy.DeleteDataPolicyRequest() - assert args[0] == request_msg @@ -6940,7 +6962,6 @@ def test_get_data_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datapolicy.GetDataPolicyRequest() - assert args[0] == request_msg @@ -6963,7 +6984,6 @@ def test_list_data_policies_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datapolicy.ListDataPoliciesRequest() - assert args[0] == request_msg @@ -6984,7 +7004,6 @@ def test_get_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -7005,7 +7024,6 @@ def test_set_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -7028,7 +7046,6 @@ def test_test_iam_permissions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -7077,7 +7094,6 @@ async def test_create_data_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datapolicy.CreateDataPolicyRequest() - assert args[0] == request_msg @@ -7110,7 +7126,6 @@ async def test_add_grantees_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datapolicy.AddGranteesRequest() - assert args[0] == request_msg @@ -7143,7 +7158,6 @@ async def test_remove_grantees_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datapolicy.RemoveGranteesRequest() - assert args[0] == request_msg @@ -7178,7 +7192,6 @@ async def test_update_data_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datapolicy.UpdateDataPolicyRequest() - assert args[0] == request_msg @@ -7203,7 +7216,6 @@ async def test_delete_data_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datapolicy.DeleteDataPolicyRequest() - assert args[0] == request_msg @@ -7236,7 +7248,6 @@ async def test_get_data_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datapolicy.GetDataPolicyRequest() - assert args[0] == request_msg @@ -7265,7 +7276,6 @@ async def test_list_data_policies_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datapolicy.ListDataPoliciesRequest() - assert args[0] == request_msg @@ -7293,7 +7303,6 @@ async def test_get_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -7321,7 +7330,6 @@ async def test_set_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -7350,7 +7358,6 @@ async def test_test_iam_permissions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -8848,7 +8855,6 @@ def test_create_data_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datapolicy.CreateDataPolicyRequest() - assert args[0] == request_msg @@ -8868,7 +8874,6 @@ def test_add_grantees_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datapolicy.AddGranteesRequest() - assert args[0] == request_msg @@ -8888,7 +8893,6 @@ def test_remove_grantees_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datapolicy.RemoveGranteesRequest() - assert args[0] == request_msg @@ -8910,7 +8914,6 @@ def test_update_data_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datapolicy.UpdateDataPolicyRequest() - assert args[0] == request_msg @@ -8932,7 +8935,6 @@ def test_delete_data_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datapolicy.DeleteDataPolicyRequest() - assert args[0] == request_msg @@ -8952,7 +8954,6 @@ def test_get_data_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datapolicy.GetDataPolicyRequest() - assert args[0] == request_msg @@ -8974,7 +8975,6 @@ def test_list_data_policies_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datapolicy.ListDataPoliciesRequest() - assert args[0] == request_msg @@ -8994,7 +8994,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -9014,7 +9013,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -9036,7 +9034,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-bigquery-datatransfer/noxfile.py b/packages/google-cloud-bigquery-datatransfer/noxfile.py index 6638b67c7c18..44d603729ba5 100644 --- a/packages/google-cloud-bigquery-datatransfer/noxfile.py +++ b/packages/google-cloud-bigquery-datatransfer/noxfile.py @@ -47,7 +47,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-bigquery-datatransfer" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-bigquery-datatransfer/setup.py b/packages/google-cloud-bigquery-datatransfer/setup.py index 45b65704d6e2..afeab9dee42b 100644 --- a/packages/google-cloud-bigquery-datatransfer/setup.py +++ b/packages/google-cloud-bigquery-datatransfer/setup.py @@ -45,7 +45,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/google-cloud-bigquery-datatransfer/testing/constraints-3.10.txt b/packages/google-cloud-bigquery-datatransfer/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-bigquery-datatransfer/testing/constraints-3.10.txt +++ b/packages/google-cloud-bigquery-datatransfer/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-bigquery-datatransfer/tests/unit/gapic/bigquery_datatransfer_v1/test_data_transfer_service.py b/packages/google-cloud-bigquery-datatransfer/tests/unit/gapic/bigquery_datatransfer_v1/test_data_transfer_service.py index cc08c3c8868b..11d901644e8a 100644 --- a/packages/google-cloud-bigquery-datatransfer/tests/unit/gapic/bigquery_datatransfer_v1/test_data_transfer_service.py +++ b/packages/google-cloud-bigquery-datatransfer/tests/unit/gapic/bigquery_datatransfer_v1/test_data_transfer_service.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 @@ -115,6 +116,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" @@ -1378,8 +1394,8 @@ def test_data_transfer_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - datatransfer.GetDataSourceRequest, - dict, + datatransfer.GetDataSourceRequest(), + {}, ], ) def test_get_data_source(request_type, transport: str = "grpc"): @@ -1390,7 +1406,7 @@ def test_get_data_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(type(client.transport.get_data_source), "__call__") as call: @@ -1470,9 +1486,10 @@ def test_get_data_source_non_empty_request_with_auto_populated_field(): client.get_data_source(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datatransfer.GetDataSourceRequest( + request_msg = datatransfer.GetDataSourceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_data_source_use_cached_wrapped_rpc(): @@ -1553,9 +1570,14 @@ async def test_get_data_source_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_data_source_async( - transport: str = "grpc_asyncio", request_type=datatransfer.GetDataSourceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datatransfer.GetDataSourceRequest(), + {}, + ], +) +async def test_get_data_source_async(request_type, transport: str = "grpc_asyncio"): client = DataTransferServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1563,7 +1585,7 @@ async def test_get_data_source_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_data_source), "__call__") as call: @@ -1622,11 +1644,6 @@ async def test_get_data_source_async( assert response.manual_runs_disabled is True -@pytest.mark.asyncio -async def test_get_data_source_async_from_dict(): - await test_get_data_source_async(request_type=dict) - - def test_get_data_source_field_headers(): client = DataTransferServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1773,8 +1790,8 @@ async def test_get_data_source_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datatransfer.ListDataSourcesRequest, - dict, + datatransfer.ListDataSourcesRequest(), + {}, ], ) def test_list_data_sources(request_type, transport: str = "grpc"): @@ -1785,7 +1802,7 @@ def test_list_data_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( @@ -1834,10 +1851,11 @@ def test_list_data_sources_non_empty_request_with_auto_populated_field(): client.list_data_sources(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datatransfer.ListDataSourcesRequest( + request_msg = datatransfer.ListDataSourcesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_data_sources_use_cached_wrapped_rpc(): @@ -1920,9 +1938,14 @@ async def test_list_data_sources_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_data_sources_async( - transport: str = "grpc_asyncio", request_type=datatransfer.ListDataSourcesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datatransfer.ListDataSourcesRequest(), + {}, + ], +) +async def test_list_data_sources_async(request_type, transport: str = "grpc_asyncio"): client = DataTransferServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1930,7 +1953,7 @@ async def test_list_data_sources_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( @@ -1955,11 +1978,6 @@ async def test_list_data_sources_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_data_sources_async_from_dict(): - await test_list_data_sources_async(request_type=dict) - - def test_list_data_sources_field_headers(): client = DataTransferServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2312,8 +2330,8 @@ async def test_list_data_sources_async_pages(): @pytest.mark.parametrize( "request_type", [ - datatransfer.CreateTransferConfigRequest, - dict, + datatransfer.CreateTransferConfigRequest(), + {}, ], ) def test_create_transfer_config(request_type, transport: str = "grpc"): @@ -2324,7 +2342,7 @@ def test_create_transfer_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( @@ -2394,12 +2412,13 @@ def test_create_transfer_config_non_empty_request_with_auto_populated_field(): client.create_transfer_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datatransfer.CreateTransferConfigRequest( + request_msg = datatransfer.CreateTransferConfigRequest( parent="parent_value", authorization_code="authorization_code_value", version_info="version_info_value", service_account_name="service_account_name_value", ) + assert args[0] == request_msg def test_create_transfer_config_use_cached_wrapped_rpc(): @@ -2485,9 +2504,15 @@ async def test_create_transfer_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + datatransfer.CreateTransferConfigRequest(), + {}, + ], +) async def test_create_transfer_config_async( - transport: str = "grpc_asyncio", - request_type=datatransfer.CreateTransferConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataTransferServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2496,7 +2521,7 @@ async def test_create_transfer_config_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( @@ -2539,11 +2564,6 @@ async def test_create_transfer_config_async( assert response.notification_pubsub_topic == "notification_pubsub_topic_value" -@pytest.mark.asyncio -async def test_create_transfer_config_async_from_dict(): - await test_create_transfer_config_async(request_type=dict) - - def test_create_transfer_config_field_headers(): client = DataTransferServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2708,8 +2728,8 @@ async def test_create_transfer_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datatransfer.UpdateTransferConfigRequest, - dict, + datatransfer.UpdateTransferConfigRequest(), + {}, ], ) def test_update_transfer_config(request_type, transport: str = "grpc"): @@ -2720,7 +2740,7 @@ def test_update_transfer_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( @@ -2789,11 +2809,12 @@ def test_update_transfer_config_non_empty_request_with_auto_populated_field(): client.update_transfer_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datatransfer.UpdateTransferConfigRequest( + request_msg = datatransfer.UpdateTransferConfigRequest( authorization_code="authorization_code_value", version_info="version_info_value", service_account_name="service_account_name_value", ) + assert args[0] == request_msg def test_update_transfer_config_use_cached_wrapped_rpc(): @@ -2879,9 +2900,15 @@ async def test_update_transfer_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + datatransfer.UpdateTransferConfigRequest(), + {}, + ], +) async def test_update_transfer_config_async( - transport: str = "grpc_asyncio", - request_type=datatransfer.UpdateTransferConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataTransferServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2890,7 +2917,7 @@ async def test_update_transfer_config_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( @@ -2933,11 +2960,6 @@ async def test_update_transfer_config_async( assert response.notification_pubsub_topic == "notification_pubsub_topic_value" -@pytest.mark.asyncio -async def test_update_transfer_config_async_from_dict(): - await test_update_transfer_config_async(request_type=dict) - - def test_update_transfer_config_field_headers(): client = DataTransferServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3102,8 +3124,8 @@ async def test_update_transfer_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datatransfer.DeleteTransferConfigRequest, - dict, + datatransfer.DeleteTransferConfigRequest(), + {}, ], ) def test_delete_transfer_config(request_type, transport: str = "grpc"): @@ -3114,7 +3136,7 @@ def test_delete_transfer_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( @@ -3159,9 +3181,10 @@ def test_delete_transfer_config_non_empty_request_with_auto_populated_field(): client.delete_transfer_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datatransfer.DeleteTransferConfigRequest( + request_msg = datatransfer.DeleteTransferConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_transfer_config_use_cached_wrapped_rpc(): @@ -3247,9 +3270,15 @@ async def test_delete_transfer_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + datatransfer.DeleteTransferConfigRequest(), + {}, + ], +) async def test_delete_transfer_config_async( - transport: str = "grpc_asyncio", - request_type=datatransfer.DeleteTransferConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataTransferServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3258,7 +3287,7 @@ async def test_delete_transfer_config_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( @@ -3278,11 +3307,6 @@ async def test_delete_transfer_config_async( assert response is None -@pytest.mark.asyncio -async def test_delete_transfer_config_async_from_dict(): - await test_delete_transfer_config_async(request_type=dict) - - def test_delete_transfer_config_field_headers(): client = DataTransferServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3433,8 +3457,8 @@ async def test_delete_transfer_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datatransfer.GetTransferConfigRequest, - dict, + datatransfer.GetTransferConfigRequest(), + {}, ], ) def test_get_transfer_config(request_type, transport: str = "grpc"): @@ -3445,7 +3469,7 @@ def test_get_transfer_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( @@ -3512,9 +3536,10 @@ def test_get_transfer_config_non_empty_request_with_auto_populated_field(): client.get_transfer_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datatransfer.GetTransferConfigRequest( + request_msg = datatransfer.GetTransferConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_transfer_config_use_cached_wrapped_rpc(): @@ -3599,9 +3624,14 @@ async def test_get_transfer_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_transfer_config_async( - transport: str = "grpc_asyncio", request_type=datatransfer.GetTransferConfigRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datatransfer.GetTransferConfigRequest(), + {}, + ], +) +async def test_get_transfer_config_async(request_type, transport: str = "grpc_asyncio"): client = DataTransferServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3609,7 +3639,7 @@ async def test_get_transfer_config_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( @@ -3652,11 +3682,6 @@ async def test_get_transfer_config_async( assert response.notification_pubsub_topic == "notification_pubsub_topic_value" -@pytest.mark.asyncio -async def test_get_transfer_config_async_from_dict(): - await test_get_transfer_config_async(request_type=dict) - - def test_get_transfer_config_field_headers(): client = DataTransferServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3811,8 +3836,8 @@ async def test_get_transfer_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datatransfer.ListTransferConfigsRequest, - dict, + datatransfer.ListTransferConfigsRequest(), + {}, ], ) def test_list_transfer_configs(request_type, transport: str = "grpc"): @@ -3823,7 +3848,7 @@ def test_list_transfer_configs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3872,10 +3897,11 @@ def test_list_transfer_configs_non_empty_request_with_auto_populated_field(): client.list_transfer_configs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datatransfer.ListTransferConfigsRequest( + request_msg = datatransfer.ListTransferConfigsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_transfer_configs_use_cached_wrapped_rpc(): @@ -3961,9 +3987,15 @@ async def test_list_transfer_configs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + datatransfer.ListTransferConfigsRequest(), + {}, + ], +) async def test_list_transfer_configs_async( - transport: str = "grpc_asyncio", - request_type=datatransfer.ListTransferConfigsRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataTransferServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3972,7 +4004,7 @@ async def test_list_transfer_configs_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( @@ -3997,11 +4029,6 @@ async def test_list_transfer_configs_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_transfer_configs_async_from_dict(): - await test_list_transfer_configs_async(request_type=dict) - - def test_list_transfer_configs_field_headers(): client = DataTransferServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4354,8 +4381,8 @@ async def test_list_transfer_configs_async_pages(): @pytest.mark.parametrize( "request_type", [ - datatransfer.ScheduleTransferRunsRequest, - dict, + datatransfer.ScheduleTransferRunsRequest(), + {}, ], ) def test_schedule_transfer_runs(request_type, transport: str = "grpc"): @@ -4366,7 +4393,7 @@ def test_schedule_transfer_runs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4411,9 +4438,10 @@ def test_schedule_transfer_runs_non_empty_request_with_auto_populated_field(): client.schedule_transfer_runs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datatransfer.ScheduleTransferRunsRequest( + request_msg = datatransfer.ScheduleTransferRunsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_schedule_transfer_runs_use_cached_wrapped_rpc(): @@ -4499,9 +4527,15 @@ async def test_schedule_transfer_runs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + datatransfer.ScheduleTransferRunsRequest(), + {}, + ], +) async def test_schedule_transfer_runs_async( - transport: str = "grpc_asyncio", - request_type=datatransfer.ScheduleTransferRunsRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataTransferServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4510,7 +4544,7 @@ async def test_schedule_transfer_runs_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( @@ -4532,11 +4566,6 @@ async def test_schedule_transfer_runs_async( assert isinstance(response, datatransfer.ScheduleTransferRunsResponse) -@pytest.mark.asyncio -async def test_schedule_transfer_runs_async_from_dict(): - await test_schedule_transfer_runs_async(request_type=dict) - - def test_schedule_transfer_runs_field_headers(): client = DataTransferServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4711,8 +4740,8 @@ async def test_schedule_transfer_runs_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datatransfer.StartManualTransferRunsRequest, - dict, + datatransfer.StartManualTransferRunsRequest(), + {}, ], ) def test_start_manual_transfer_runs(request_type, transport: str = "grpc"): @@ -4723,7 +4752,7 @@ def test_start_manual_transfer_runs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4768,9 +4797,10 @@ def test_start_manual_transfer_runs_non_empty_request_with_auto_populated_field( client.start_manual_transfer_runs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datatransfer.StartManualTransferRunsRequest( + request_msg = datatransfer.StartManualTransferRunsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_start_manual_transfer_runs_use_cached_wrapped_rpc(): @@ -4856,9 +4886,15 @@ async def test_start_manual_transfer_runs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + datatransfer.StartManualTransferRunsRequest(), + {}, + ], +) async def test_start_manual_transfer_runs_async( - transport: str = "grpc_asyncio", - request_type=datatransfer.StartManualTransferRunsRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataTransferServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4867,7 +4903,7 @@ async def test_start_manual_transfer_runs_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( @@ -4889,11 +4925,6 @@ async def test_start_manual_transfer_runs_async( assert isinstance(response, datatransfer.StartManualTransferRunsResponse) -@pytest.mark.asyncio -async def test_start_manual_transfer_runs_async_from_dict(): - await test_start_manual_transfer_runs_async(request_type=dict) - - def test_start_manual_transfer_runs_field_headers(): client = DataTransferServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4962,8 +4993,8 @@ async def test_start_manual_transfer_runs_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - datatransfer.GetTransferRunRequest, - dict, + datatransfer.GetTransferRunRequest(), + {}, ], ) def test_get_transfer_run(request_type, transport: str = "grpc"): @@ -4974,7 +5005,7 @@ def test_get_transfer_run(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_transfer_run), "__call__") as call: @@ -5029,9 +5060,10 @@ def test_get_transfer_run_non_empty_request_with_auto_populated_field(): client.get_transfer_run(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datatransfer.GetTransferRunRequest( + request_msg = datatransfer.GetTransferRunRequest( name="name_value", ) + assert args[0] == request_msg def test_get_transfer_run_use_cached_wrapped_rpc(): @@ -5114,9 +5146,14 @@ async def test_get_transfer_run_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_transfer_run_async( - transport: str = "grpc_asyncio", request_type=datatransfer.GetTransferRunRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datatransfer.GetTransferRunRequest(), + {}, + ], +) +async def test_get_transfer_run_async(request_type, transport: str = "grpc_asyncio"): client = DataTransferServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5124,7 +5161,7 @@ async def test_get_transfer_run_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_transfer_run), "__call__") as call: @@ -5157,11 +5194,6 @@ async def test_get_transfer_run_async( assert response.notification_pubsub_topic == "notification_pubsub_topic_value" -@pytest.mark.asyncio -async def test_get_transfer_run_async_from_dict(): - await test_get_transfer_run_async(request_type=dict) - - def test_get_transfer_run_field_headers(): client = DataTransferServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5308,8 +5340,8 @@ async def test_get_transfer_run_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datatransfer.DeleteTransferRunRequest, - dict, + datatransfer.DeleteTransferRunRequest(), + {}, ], ) def test_delete_transfer_run(request_type, transport: str = "grpc"): @@ -5320,7 +5352,7 @@ def test_delete_transfer_run(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5365,9 +5397,10 @@ def test_delete_transfer_run_non_empty_request_with_auto_populated_field(): client.delete_transfer_run(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datatransfer.DeleteTransferRunRequest( + request_msg = datatransfer.DeleteTransferRunRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_transfer_run_use_cached_wrapped_rpc(): @@ -5452,9 +5485,14 @@ async def test_delete_transfer_run_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_transfer_run_async( - transport: str = "grpc_asyncio", request_type=datatransfer.DeleteTransferRunRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datatransfer.DeleteTransferRunRequest(), + {}, + ], +) +async def test_delete_transfer_run_async(request_type, transport: str = "grpc_asyncio"): client = DataTransferServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5462,7 +5500,7 @@ async def test_delete_transfer_run_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( @@ -5482,11 +5520,6 @@ async def test_delete_transfer_run_async( assert response is None -@pytest.mark.asyncio -async def test_delete_transfer_run_async_from_dict(): - await test_delete_transfer_run_async(request_type=dict) - - def test_delete_transfer_run_field_headers(): client = DataTransferServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5637,8 +5670,8 @@ async def test_delete_transfer_run_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datatransfer.ListTransferRunsRequest, - dict, + datatransfer.ListTransferRunsRequest(), + {}, ], ) def test_list_transfer_runs(request_type, transport: str = "grpc"): @@ -5649,7 +5682,7 @@ def test_list_transfer_runs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5698,10 +5731,11 @@ def test_list_transfer_runs_non_empty_request_with_auto_populated_field(): client.list_transfer_runs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datatransfer.ListTransferRunsRequest( + request_msg = datatransfer.ListTransferRunsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_transfer_runs_use_cached_wrapped_rpc(): @@ -5786,9 +5820,14 @@ async def test_list_transfer_runs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_transfer_runs_async( - transport: str = "grpc_asyncio", request_type=datatransfer.ListTransferRunsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datatransfer.ListTransferRunsRequest(), + {}, + ], +) +async def test_list_transfer_runs_async(request_type, transport: str = "grpc_asyncio"): client = DataTransferServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5796,7 +5835,7 @@ async def test_list_transfer_runs_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( @@ -5821,11 +5860,6 @@ async def test_list_transfer_runs_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_transfer_runs_async_from_dict(): - await test_list_transfer_runs_async(request_type=dict) - - def test_list_transfer_runs_field_headers(): client = DataTransferServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6178,8 +6212,8 @@ async def test_list_transfer_runs_async_pages(): @pytest.mark.parametrize( "request_type", [ - datatransfer.ListTransferLogsRequest, - dict, + datatransfer.ListTransferLogsRequest(), + {}, ], ) def test_list_transfer_logs(request_type, transport: str = "grpc"): @@ -6190,7 +6224,7 @@ def test_list_transfer_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( @@ -6239,10 +6273,11 @@ def test_list_transfer_logs_non_empty_request_with_auto_populated_field(): client.list_transfer_logs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datatransfer.ListTransferLogsRequest( + request_msg = datatransfer.ListTransferLogsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_transfer_logs_use_cached_wrapped_rpc(): @@ -6327,9 +6362,14 @@ async def test_list_transfer_logs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_transfer_logs_async( - transport: str = "grpc_asyncio", request_type=datatransfer.ListTransferLogsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datatransfer.ListTransferLogsRequest(), + {}, + ], +) +async def test_list_transfer_logs_async(request_type, transport: str = "grpc_asyncio"): client = DataTransferServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6337,7 +6377,7 @@ async def test_list_transfer_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( @@ -6362,11 +6402,6 @@ async def test_list_transfer_logs_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_transfer_logs_async_from_dict(): - await test_list_transfer_logs_async(request_type=dict) - - def test_list_transfer_logs_field_headers(): client = DataTransferServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6719,8 +6754,8 @@ async def test_list_transfer_logs_async_pages(): @pytest.mark.parametrize( "request_type", [ - datatransfer.CheckValidCredsRequest, - dict, + datatransfer.CheckValidCredsRequest(), + {}, ], ) def test_check_valid_creds(request_type, transport: str = "grpc"): @@ -6731,7 +6766,7 @@ def test_check_valid_creds(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6779,9 +6814,10 @@ def test_check_valid_creds_non_empty_request_with_auto_populated_field(): client.check_valid_creds(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datatransfer.CheckValidCredsRequest( + request_msg = datatransfer.CheckValidCredsRequest( name="name_value", ) + assert args[0] == request_msg def test_check_valid_creds_use_cached_wrapped_rpc(): @@ -6864,9 +6900,14 @@ async def test_check_valid_creds_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_check_valid_creds_async( - transport: str = "grpc_asyncio", request_type=datatransfer.CheckValidCredsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datatransfer.CheckValidCredsRequest(), + {}, + ], +) +async def test_check_valid_creds_async(request_type, transport: str = "grpc_asyncio"): client = DataTransferServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6874,7 +6915,7 @@ async def test_check_valid_creds_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( @@ -6899,11 +6940,6 @@ async def test_check_valid_creds_async( assert response.has_valid_creds is True -@pytest.mark.asyncio -async def test_check_valid_creds_async_from_dict(): - await test_check_valid_creds_async(request_type=dict) - - def test_check_valid_creds_field_headers(): client = DataTransferServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7058,8 +7094,8 @@ async def test_check_valid_creds_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datatransfer.EnrollDataSourcesRequest, - dict, + datatransfer.EnrollDataSourcesRequest(), + {}, ], ) def test_enroll_data_sources(request_type, transport: str = "grpc"): @@ -7070,7 +7106,7 @@ def test_enroll_data_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( @@ -7115,9 +7151,10 @@ def test_enroll_data_sources_non_empty_request_with_auto_populated_field(): client.enroll_data_sources(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datatransfer.EnrollDataSourcesRequest( + request_msg = datatransfer.EnrollDataSourcesRequest( name="name_value", ) + assert args[0] == request_msg def test_enroll_data_sources_use_cached_wrapped_rpc(): @@ -7202,9 +7239,14 @@ async def test_enroll_data_sources_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_enroll_data_sources_async( - transport: str = "grpc_asyncio", request_type=datatransfer.EnrollDataSourcesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datatransfer.EnrollDataSourcesRequest(), + {}, + ], +) +async def test_enroll_data_sources_async(request_type, transport: str = "grpc_asyncio"): client = DataTransferServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7212,7 +7254,7 @@ async def test_enroll_data_sources_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( @@ -7232,11 +7274,6 @@ async def test_enroll_data_sources_async( assert response is None -@pytest.mark.asyncio -async def test_enroll_data_sources_async_from_dict(): - await test_enroll_data_sources_async(request_type=dict) - - def test_enroll_data_sources_field_headers(): client = DataTransferServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7303,8 +7340,8 @@ async def test_enroll_data_sources_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - datatransfer.UnenrollDataSourcesRequest, - dict, + datatransfer.UnenrollDataSourcesRequest(), + {}, ], ) def test_unenroll_data_sources(request_type, transport: str = "grpc"): @@ -7315,7 +7352,7 @@ def test_unenroll_data_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( @@ -7360,9 +7397,10 @@ def test_unenroll_data_sources_non_empty_request_with_auto_populated_field(): client.unenroll_data_sources(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datatransfer.UnenrollDataSourcesRequest( + request_msg = datatransfer.UnenrollDataSourcesRequest( name="name_value", ) + assert args[0] == request_msg def test_unenroll_data_sources_use_cached_wrapped_rpc(): @@ -7448,9 +7486,15 @@ async def test_unenroll_data_sources_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + datatransfer.UnenrollDataSourcesRequest(), + {}, + ], +) async def test_unenroll_data_sources_async( - transport: str = "grpc_asyncio", - request_type=datatransfer.UnenrollDataSourcesRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataTransferServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -7459,7 +7503,7 @@ async def test_unenroll_data_sources_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( @@ -7479,11 +7523,6 @@ async def test_unenroll_data_sources_async( assert response is None -@pytest.mark.asyncio -async def test_unenroll_data_sources_async_from_dict(): - await test_unenroll_data_sources_async(request_type=dict) - - def test_unenroll_data_sources_field_headers(): client = DataTransferServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10800,7 +10839,6 @@ def test_get_data_source_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datatransfer.GetDataSourceRequest() - assert args[0] == request_msg @@ -10823,7 +10861,6 @@ def test_list_data_sources_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datatransfer.ListDataSourcesRequest() - assert args[0] == request_msg @@ -10846,7 +10883,6 @@ def test_create_transfer_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datatransfer.CreateTransferConfigRequest() - assert args[0] == request_msg @@ -10869,7 +10905,6 @@ def test_update_transfer_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datatransfer.UpdateTransferConfigRequest() - assert args[0] == request_msg @@ -10892,7 +10927,6 @@ def test_delete_transfer_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datatransfer.DeleteTransferConfigRequest() - assert args[0] == request_msg @@ -10915,7 +10949,6 @@ def test_get_transfer_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datatransfer.GetTransferConfigRequest() - assert args[0] == request_msg @@ -10938,7 +10971,6 @@ def test_list_transfer_configs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datatransfer.ListTransferConfigsRequest() - assert args[0] == request_msg @@ -10961,7 +10993,6 @@ def test_schedule_transfer_runs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datatransfer.ScheduleTransferRunsRequest() - assert args[0] == request_msg @@ -10984,7 +11015,6 @@ def test_start_manual_transfer_runs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datatransfer.StartManualTransferRunsRequest() - assert args[0] == request_msg @@ -11005,7 +11035,6 @@ def test_get_transfer_run_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datatransfer.GetTransferRunRequest() - assert args[0] == request_msg @@ -11028,7 +11057,6 @@ def test_delete_transfer_run_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datatransfer.DeleteTransferRunRequest() - assert args[0] == request_msg @@ -11051,7 +11079,6 @@ def test_list_transfer_runs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datatransfer.ListTransferRunsRequest() - assert args[0] == request_msg @@ -11074,7 +11101,6 @@ def test_list_transfer_logs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datatransfer.ListTransferLogsRequest() - assert args[0] == request_msg @@ -11097,7 +11123,6 @@ def test_check_valid_creds_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datatransfer.CheckValidCredsRequest() - assert args[0] == request_msg @@ -11120,7 +11145,6 @@ def test_enroll_data_sources_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datatransfer.EnrollDataSourcesRequest() - assert args[0] == request_msg @@ -11143,7 +11167,6 @@ def test_unenroll_data_sources_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datatransfer.UnenrollDataSourcesRequest() - assert args[0] == request_msg @@ -11199,7 +11222,6 @@ async def test_get_data_source_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datatransfer.GetDataSourceRequest() - assert args[0] == request_msg @@ -11228,7 +11250,6 @@ async def test_list_data_sources_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datatransfer.ListDataSourcesRequest() - assert args[0] == request_msg @@ -11266,7 +11287,6 @@ async def test_create_transfer_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datatransfer.CreateTransferConfigRequest() - assert args[0] == request_msg @@ -11304,7 +11324,6 @@ async def test_update_transfer_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datatransfer.UpdateTransferConfigRequest() - assert args[0] == request_msg @@ -11329,7 +11348,6 @@ async def test_delete_transfer_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datatransfer.DeleteTransferConfigRequest() - assert args[0] == request_msg @@ -11367,7 +11385,6 @@ async def test_get_transfer_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datatransfer.GetTransferConfigRequest() - assert args[0] == request_msg @@ -11396,7 +11413,6 @@ async def test_list_transfer_configs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datatransfer.ListTransferConfigsRequest() - assert args[0] == request_msg @@ -11423,7 +11439,6 @@ async def test_schedule_transfer_runs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datatransfer.ScheduleTransferRunsRequest() - assert args[0] == request_msg @@ -11450,7 +11465,6 @@ async def test_start_manual_transfer_runs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datatransfer.StartManualTransferRunsRequest() - assert args[0] == request_msg @@ -11482,7 +11496,6 @@ async def test_get_transfer_run_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datatransfer.GetTransferRunRequest() - assert args[0] == request_msg @@ -11507,7 +11520,6 @@ async def test_delete_transfer_run_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datatransfer.DeleteTransferRunRequest() - assert args[0] == request_msg @@ -11536,7 +11548,6 @@ async def test_list_transfer_runs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datatransfer.ListTransferRunsRequest() - assert args[0] == request_msg @@ -11565,7 +11576,6 @@ async def test_list_transfer_logs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datatransfer.ListTransferLogsRequest() - assert args[0] == request_msg @@ -11594,7 +11604,6 @@ async def test_check_valid_creds_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datatransfer.CheckValidCredsRequest() - assert args[0] == request_msg @@ -11619,7 +11628,6 @@ async def test_enroll_data_sources_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datatransfer.EnrollDataSourcesRequest() - assert args[0] == request_msg @@ -11644,7 +11652,6 @@ async def test_unenroll_data_sources_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datatransfer.UnenrollDataSourcesRequest() - assert args[0] == request_msg @@ -14211,7 +14218,6 @@ def test_get_data_source_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datatransfer.GetDataSourceRequest() - assert args[0] == request_msg @@ -14233,7 +14239,6 @@ def test_list_data_sources_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datatransfer.ListDataSourcesRequest() - assert args[0] == request_msg @@ -14255,7 +14260,6 @@ def test_create_transfer_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datatransfer.CreateTransferConfigRequest() - assert args[0] == request_msg @@ -14277,7 +14281,6 @@ def test_update_transfer_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datatransfer.UpdateTransferConfigRequest() - assert args[0] == request_msg @@ -14299,7 +14302,6 @@ def test_delete_transfer_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datatransfer.DeleteTransferConfigRequest() - assert args[0] == request_msg @@ -14321,7 +14323,6 @@ def test_get_transfer_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datatransfer.GetTransferConfigRequest() - assert args[0] == request_msg @@ -14343,7 +14344,6 @@ def test_list_transfer_configs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datatransfer.ListTransferConfigsRequest() - assert args[0] == request_msg @@ -14365,7 +14365,6 @@ def test_schedule_transfer_runs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datatransfer.ScheduleTransferRunsRequest() - assert args[0] == request_msg @@ -14387,7 +14386,6 @@ def test_start_manual_transfer_runs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datatransfer.StartManualTransferRunsRequest() - assert args[0] == request_msg @@ -14407,7 +14405,6 @@ def test_get_transfer_run_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datatransfer.GetTransferRunRequest() - assert args[0] == request_msg @@ -14429,7 +14426,6 @@ def test_delete_transfer_run_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datatransfer.DeleteTransferRunRequest() - assert args[0] == request_msg @@ -14451,7 +14447,6 @@ def test_list_transfer_runs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datatransfer.ListTransferRunsRequest() - assert args[0] == request_msg @@ -14473,7 +14468,6 @@ def test_list_transfer_logs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datatransfer.ListTransferLogsRequest() - assert args[0] == request_msg @@ -14495,7 +14489,6 @@ def test_check_valid_creds_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datatransfer.CheckValidCredsRequest() - assert args[0] == request_msg @@ -14517,7 +14510,6 @@ def test_enroll_data_sources_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datatransfer.EnrollDataSourcesRequest() - assert args[0] == request_msg @@ -14539,7 +14531,6 @@ def test_unenroll_data_sources_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datatransfer.UnenrollDataSourcesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-bigquery-logging/noxfile.py b/packages/google-cloud-bigquery-logging/noxfile.py index 7913827b569e..357903bd6d52 100644 --- a/packages/google-cloud-bigquery-logging/noxfile.py +++ b/packages/google-cloud-bigquery-logging/noxfile.py @@ -47,7 +47,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-bigquery-logging" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-bigquery-logging/setup.py b/packages/google-cloud-bigquery-logging/setup.py index d46cdf0cb23f..ff79919fb839 100644 --- a/packages/google-cloud-bigquery-logging/setup.py +++ b/packages/google-cloud-bigquery-logging/setup.py @@ -45,7 +45,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/google-cloud-bigquery-logging/testing/constraints-3.10.txt b/packages/google-cloud-bigquery-logging/testing/constraints-3.10.txt index a92801e1c8e2..b39cd54634f9 100644 --- a/packages/google-cloud-bigquery-logging/testing/constraints-3.10.txt +++ b/packages/google-cloud-bigquery-logging/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/google-cloud-bigquery-migration/noxfile.py b/packages/google-cloud-bigquery-migration/noxfile.py index b0688797f060..4b9be68bf2a8 100644 --- a/packages/google-cloud-bigquery-migration/noxfile.py +++ b/packages/google-cloud-bigquery-migration/noxfile.py @@ -47,7 +47,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-bigquery-migration" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-bigquery-migration/setup.py b/packages/google-cloud-bigquery-migration/setup.py index a8308658766e..0ff1ca1557b4 100644 --- a/packages/google-cloud-bigquery-migration/setup.py +++ b/packages/google-cloud-bigquery-migration/setup.py @@ -45,7 +45,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/google-cloud-bigquery-migration/testing/constraints-3.10.txt b/packages/google-cloud-bigquery-migration/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-bigquery-migration/testing/constraints-3.10.txt +++ b/packages/google-cloud-bigquery-migration/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-bigquery-migration/tests/unit/gapic/bigquery_migration_v2/test_migration_service.py b/packages/google-cloud-bigquery-migration/tests/unit/gapic/bigquery_migration_v2/test_migration_service.py index d0b937eadabe..1fe9fbc581e8 100644 --- a/packages/google-cloud-bigquery-migration/tests/unit/gapic/bigquery_migration_v2/test_migration_service.py +++ b/packages/google-cloud-bigquery-migration/tests/unit/gapic/bigquery_migration_v2/test_migration_service.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 @@ -119,6 +120,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" @@ -1320,8 +1336,8 @@ def test_migration_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - migration_service.CreateMigrationWorkflowRequest, - dict, + migration_service.CreateMigrationWorkflowRequest(), + {}, ], ) def test_create_migration_workflow(request_type, transport: str = "grpc"): @@ -1332,7 +1348,7 @@ def test_create_migration_workflow(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1384,9 +1400,10 @@ def test_create_migration_workflow_non_empty_request_with_auto_populated_field() client.create_migration_workflow(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == migration_service.CreateMigrationWorkflowRequest( + request_msg = migration_service.CreateMigrationWorkflowRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_migration_workflow_use_cached_wrapped_rpc(): @@ -1472,9 +1489,15 @@ async def test_create_migration_workflow_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + migration_service.CreateMigrationWorkflowRequest(), + {}, + ], +) async def test_create_migration_workflow_async( - transport: str = "grpc_asyncio", - request_type=migration_service.CreateMigrationWorkflowRequest, + request_type, transport: str = "grpc_asyncio" ): client = MigrationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1483,7 +1506,7 @@ async def test_create_migration_workflow_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( @@ -1512,11 +1535,6 @@ async def test_create_migration_workflow_async( assert response.state == migration_entities.MigrationWorkflow.State.DRAFT -@pytest.mark.asyncio -async def test_create_migration_workflow_async_from_dict(): - await test_create_migration_workflow_async(request_type=dict) - - def test_create_migration_workflow_field_headers(): client = MigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1681,8 +1699,8 @@ async def test_create_migration_workflow_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - migration_service.GetMigrationWorkflowRequest, - dict, + migration_service.GetMigrationWorkflowRequest(), + {}, ], ) def test_get_migration_workflow(request_type, transport: str = "grpc"): @@ -1693,7 +1711,7 @@ def test_get_migration_workflow(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1745,9 +1763,10 @@ def test_get_migration_workflow_non_empty_request_with_auto_populated_field(): client.get_migration_workflow(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == migration_service.GetMigrationWorkflowRequest( + request_msg = migration_service.GetMigrationWorkflowRequest( name="name_value", ) + assert args[0] == request_msg def test_get_migration_workflow_use_cached_wrapped_rpc(): @@ -1833,9 +1852,15 @@ async def test_get_migration_workflow_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + migration_service.GetMigrationWorkflowRequest(), + {}, + ], +) async def test_get_migration_workflow_async( - transport: str = "grpc_asyncio", - request_type=migration_service.GetMigrationWorkflowRequest, + request_type, transport: str = "grpc_asyncio" ): client = MigrationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1844,7 +1869,7 @@ async def test_get_migration_workflow_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( @@ -1873,11 +1898,6 @@ async def test_get_migration_workflow_async( assert response.state == migration_entities.MigrationWorkflow.State.DRAFT -@pytest.mark.asyncio -async def test_get_migration_workflow_async_from_dict(): - await test_get_migration_workflow_async(request_type=dict) - - def test_get_migration_workflow_field_headers(): client = MigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2032,8 +2052,8 @@ async def test_get_migration_workflow_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - migration_service.ListMigrationWorkflowsRequest, - dict, + migration_service.ListMigrationWorkflowsRequest(), + {}, ], ) def test_list_migration_workflows(request_type, transport: str = "grpc"): @@ -2044,7 +2064,7 @@ def test_list_migration_workflows(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2093,10 +2113,11 @@ def test_list_migration_workflows_non_empty_request_with_auto_populated_field(): client.list_migration_workflows(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == migration_service.ListMigrationWorkflowsRequest( + request_msg = migration_service.ListMigrationWorkflowsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_migration_workflows_use_cached_wrapped_rpc(): @@ -2182,9 +2203,15 @@ async def test_list_migration_workflows_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + migration_service.ListMigrationWorkflowsRequest(), + {}, + ], +) async def test_list_migration_workflows_async( - transport: str = "grpc_asyncio", - request_type=migration_service.ListMigrationWorkflowsRequest, + request_type, transport: str = "grpc_asyncio" ): client = MigrationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2193,7 +2220,7 @@ async def test_list_migration_workflows_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( @@ -2218,11 +2245,6 @@ async def test_list_migration_workflows_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_migration_workflows_async_from_dict(): - await test_list_migration_workflows_async(request_type=dict) - - def test_list_migration_workflows_field_headers(): client = MigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2579,8 +2601,8 @@ async def test_list_migration_workflows_async_pages(): @pytest.mark.parametrize( "request_type", [ - migration_service.DeleteMigrationWorkflowRequest, - dict, + migration_service.DeleteMigrationWorkflowRequest(), + {}, ], ) def test_delete_migration_workflow(request_type, transport: str = "grpc"): @@ -2591,7 +2613,7 @@ def test_delete_migration_workflow(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,9 +2658,10 @@ def test_delete_migration_workflow_non_empty_request_with_auto_populated_field() client.delete_migration_workflow(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == migration_service.DeleteMigrationWorkflowRequest( + request_msg = migration_service.DeleteMigrationWorkflowRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_migration_workflow_use_cached_wrapped_rpc(): @@ -2724,9 +2747,15 @@ async def test_delete_migration_workflow_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + migration_service.DeleteMigrationWorkflowRequest(), + {}, + ], +) async def test_delete_migration_workflow_async( - transport: str = "grpc_asyncio", - request_type=migration_service.DeleteMigrationWorkflowRequest, + request_type, transport: str = "grpc_asyncio" ): client = MigrationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2735,7 +2764,7 @@ async def test_delete_migration_workflow_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( @@ -2755,11 +2784,6 @@ async def test_delete_migration_workflow_async( assert response is None -@pytest.mark.asyncio -async def test_delete_migration_workflow_async_from_dict(): - await test_delete_migration_workflow_async(request_type=dict) - - def test_delete_migration_workflow_field_headers(): client = MigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2910,8 +2934,8 @@ async def test_delete_migration_workflow_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - migration_service.StartMigrationWorkflowRequest, - dict, + migration_service.StartMigrationWorkflowRequest(), + {}, ], ) def test_start_migration_workflow(request_type, transport: str = "grpc"): @@ -2922,7 +2946,7 @@ def test_start_migration_workflow(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2967,9 +2991,10 @@ def test_start_migration_workflow_non_empty_request_with_auto_populated_field(): client.start_migration_workflow(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == migration_service.StartMigrationWorkflowRequest( + request_msg = migration_service.StartMigrationWorkflowRequest( name="name_value", ) + assert args[0] == request_msg def test_start_migration_workflow_use_cached_wrapped_rpc(): @@ -3055,9 +3080,15 @@ async def test_start_migration_workflow_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + migration_service.StartMigrationWorkflowRequest(), + {}, + ], +) async def test_start_migration_workflow_async( - transport: str = "grpc_asyncio", - request_type=migration_service.StartMigrationWorkflowRequest, + request_type, transport: str = "grpc_asyncio" ): client = MigrationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3066,7 +3097,7 @@ async def test_start_migration_workflow_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( @@ -3086,11 +3117,6 @@ async def test_start_migration_workflow_async( assert response is None -@pytest.mark.asyncio -async def test_start_migration_workflow_async_from_dict(): - await test_start_migration_workflow_async(request_type=dict) - - def test_start_migration_workflow_field_headers(): client = MigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3241,8 +3267,8 @@ async def test_start_migration_workflow_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - migration_service.GetMigrationSubtaskRequest, - dict, + migration_service.GetMigrationSubtaskRequest(), + {}, ], ) def test_get_migration_subtask(request_type, transport: str = "grpc"): @@ -3253,7 +3279,7 @@ def test_get_migration_subtask(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3309,9 +3335,10 @@ def test_get_migration_subtask_non_empty_request_with_auto_populated_field(): client.get_migration_subtask(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == migration_service.GetMigrationSubtaskRequest( + request_msg = migration_service.GetMigrationSubtaskRequest( name="name_value", ) + assert args[0] == request_msg def test_get_migration_subtask_use_cached_wrapped_rpc(): @@ -3397,9 +3424,15 @@ async def test_get_migration_subtask_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + migration_service.GetMigrationSubtaskRequest(), + {}, + ], +) async def test_get_migration_subtask_async( - transport: str = "grpc_asyncio", - request_type=migration_service.GetMigrationSubtaskRequest, + request_type, transport: str = "grpc_asyncio" ): client = MigrationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3408,7 +3441,7 @@ async def test_get_migration_subtask_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( @@ -3441,11 +3474,6 @@ async def test_get_migration_subtask_async( assert response.resource_error_count == 2169 -@pytest.mark.asyncio -async def test_get_migration_subtask_async_from_dict(): - await test_get_migration_subtask_async(request_type=dict) - - def test_get_migration_subtask_field_headers(): client = MigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3600,8 +3628,8 @@ async def test_get_migration_subtask_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - migration_service.ListMigrationSubtasksRequest, - dict, + migration_service.ListMigrationSubtasksRequest(), + {}, ], ) def test_list_migration_subtasks(request_type, transport: str = "grpc"): @@ -3612,7 +3640,7 @@ def test_list_migration_subtasks(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3662,11 +3690,12 @@ def test_list_migration_subtasks_non_empty_request_with_auto_populated_field(): client.list_migration_subtasks(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == migration_service.ListMigrationSubtasksRequest( + request_msg = migration_service.ListMigrationSubtasksRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_migration_subtasks_use_cached_wrapped_rpc(): @@ -3752,9 +3781,15 @@ async def test_list_migration_subtasks_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + migration_service.ListMigrationSubtasksRequest(), + {}, + ], +) async def test_list_migration_subtasks_async( - transport: str = "grpc_asyncio", - request_type=migration_service.ListMigrationSubtasksRequest, + request_type, transport: str = "grpc_asyncio" ): client = MigrationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3763,7 +3798,7 @@ async def test_list_migration_subtasks_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( @@ -3788,11 +3823,6 @@ async def test_list_migration_subtasks_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_migration_subtasks_async_from_dict(): - await test_list_migration_subtasks_async(request_type=dict) - - def test_list_migration_subtasks_field_headers(): client = MigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4268,7 +4298,6 @@ def test_create_migration_workflow_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migration_service.CreateMigrationWorkflowRequest() - assert args[0] == request_msg @@ -4291,7 +4320,6 @@ def test_get_migration_workflow_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migration_service.GetMigrationWorkflowRequest() - assert args[0] == request_msg @@ -4314,7 +4342,6 @@ def test_list_migration_workflows_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migration_service.ListMigrationWorkflowsRequest() - assert args[0] == request_msg @@ -4337,7 +4364,6 @@ def test_delete_migration_workflow_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migration_service.DeleteMigrationWorkflowRequest() - assert args[0] == request_msg @@ -4360,7 +4386,6 @@ def test_start_migration_workflow_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migration_service.StartMigrationWorkflowRequest() - assert args[0] == request_msg @@ -4383,7 +4408,6 @@ def test_get_migration_subtask_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migration_service.GetMigrationSubtaskRequest() - assert args[0] == request_msg @@ -4406,7 +4430,6 @@ def test_list_migration_subtasks_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migration_service.ListMigrationSubtasksRequest() - assert args[0] == request_msg @@ -4451,7 +4474,6 @@ async def test_create_migration_workflow_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migration_service.CreateMigrationWorkflowRequest() - assert args[0] == request_msg @@ -4482,7 +4504,6 @@ async def test_get_migration_workflow_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migration_service.GetMigrationWorkflowRequest() - assert args[0] == request_msg @@ -4511,7 +4532,6 @@ async def test_list_migration_workflows_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migration_service.ListMigrationWorkflowsRequest() - assert args[0] == request_msg @@ -4536,7 +4556,6 @@ async def test_delete_migration_workflow_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migration_service.DeleteMigrationWorkflowRequest() - assert args[0] == request_msg @@ -4561,7 +4580,6 @@ async def test_start_migration_workflow_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migration_service.StartMigrationWorkflowRequest() - assert args[0] == request_msg @@ -4594,7 +4612,6 @@ async def test_get_migration_subtask_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migration_service.GetMigrationSubtaskRequest() - assert args[0] == request_msg @@ -4623,7 +4640,6 @@ async def test_list_migration_subtasks_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migration_service.ListMigrationSubtasksRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-bigquery-migration/tests/unit/gapic/bigquery_migration_v2alpha/test_migration_service.py b/packages/google-cloud-bigquery-migration/tests/unit/gapic/bigquery_migration_v2alpha/test_migration_service.py index 5c7f44eac7bb..218f6d2e513e 100644 --- a/packages/google-cloud-bigquery-migration/tests/unit/gapic/bigquery_migration_v2alpha/test_migration_service.py +++ b/packages/google-cloud-bigquery-migration/tests/unit/gapic/bigquery_migration_v2alpha/test_migration_service.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 @@ -115,6 +116,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" @@ -1316,8 +1332,8 @@ def test_migration_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - migration_service.CreateMigrationWorkflowRequest, - dict, + migration_service.CreateMigrationWorkflowRequest(), + {}, ], ) def test_create_migration_workflow(request_type, transport: str = "grpc"): @@ -1328,7 +1344,7 @@ def test_create_migration_workflow(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1380,9 +1396,10 @@ def test_create_migration_workflow_non_empty_request_with_auto_populated_field() client.create_migration_workflow(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == migration_service.CreateMigrationWorkflowRequest( + request_msg = migration_service.CreateMigrationWorkflowRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_migration_workflow_use_cached_wrapped_rpc(): @@ -1468,9 +1485,15 @@ async def test_create_migration_workflow_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + migration_service.CreateMigrationWorkflowRequest(), + {}, + ], +) async def test_create_migration_workflow_async( - transport: str = "grpc_asyncio", - request_type=migration_service.CreateMigrationWorkflowRequest, + request_type, transport: str = "grpc_asyncio" ): client = MigrationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1479,7 +1502,7 @@ async def test_create_migration_workflow_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( @@ -1508,11 +1531,6 @@ async def test_create_migration_workflow_async( assert response.state == migration_entities.MigrationWorkflow.State.DRAFT -@pytest.mark.asyncio -async def test_create_migration_workflow_async_from_dict(): - await test_create_migration_workflow_async(request_type=dict) - - def test_create_migration_workflow_field_headers(): client = MigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1677,8 +1695,8 @@ async def test_create_migration_workflow_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - migration_service.GetMigrationWorkflowRequest, - dict, + migration_service.GetMigrationWorkflowRequest(), + {}, ], ) def test_get_migration_workflow(request_type, transport: str = "grpc"): @@ -1689,7 +1707,7 @@ def test_get_migration_workflow(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1741,9 +1759,10 @@ def test_get_migration_workflow_non_empty_request_with_auto_populated_field(): client.get_migration_workflow(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == migration_service.GetMigrationWorkflowRequest( + request_msg = migration_service.GetMigrationWorkflowRequest( name="name_value", ) + assert args[0] == request_msg def test_get_migration_workflow_use_cached_wrapped_rpc(): @@ -1829,9 +1848,15 @@ async def test_get_migration_workflow_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + migration_service.GetMigrationWorkflowRequest(), + {}, + ], +) async def test_get_migration_workflow_async( - transport: str = "grpc_asyncio", - request_type=migration_service.GetMigrationWorkflowRequest, + request_type, transport: str = "grpc_asyncio" ): client = MigrationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1840,7 +1865,7 @@ async def test_get_migration_workflow_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( @@ -1869,11 +1894,6 @@ async def test_get_migration_workflow_async( assert response.state == migration_entities.MigrationWorkflow.State.DRAFT -@pytest.mark.asyncio -async def test_get_migration_workflow_async_from_dict(): - await test_get_migration_workflow_async(request_type=dict) - - def test_get_migration_workflow_field_headers(): client = MigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2028,8 +2048,8 @@ async def test_get_migration_workflow_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - migration_service.ListMigrationWorkflowsRequest, - dict, + migration_service.ListMigrationWorkflowsRequest(), + {}, ], ) def test_list_migration_workflows(request_type, transport: str = "grpc"): @@ -2040,7 +2060,7 @@ def test_list_migration_workflows(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2089,10 +2109,11 @@ def test_list_migration_workflows_non_empty_request_with_auto_populated_field(): client.list_migration_workflows(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == migration_service.ListMigrationWorkflowsRequest( + request_msg = migration_service.ListMigrationWorkflowsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_migration_workflows_use_cached_wrapped_rpc(): @@ -2178,9 +2199,15 @@ async def test_list_migration_workflows_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + migration_service.ListMigrationWorkflowsRequest(), + {}, + ], +) async def test_list_migration_workflows_async( - transport: str = "grpc_asyncio", - request_type=migration_service.ListMigrationWorkflowsRequest, + request_type, transport: str = "grpc_asyncio" ): client = MigrationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2189,7 +2216,7 @@ async def test_list_migration_workflows_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( @@ -2214,11 +2241,6 @@ async def test_list_migration_workflows_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_migration_workflows_async_from_dict(): - await test_list_migration_workflows_async(request_type=dict) - - def test_list_migration_workflows_field_headers(): client = MigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2575,8 +2597,8 @@ async def test_list_migration_workflows_async_pages(): @pytest.mark.parametrize( "request_type", [ - migration_service.DeleteMigrationWorkflowRequest, - dict, + migration_service.DeleteMigrationWorkflowRequest(), + {}, ], ) def test_delete_migration_workflow(request_type, transport: str = "grpc"): @@ -2587,7 +2609,7 @@ def test_delete_migration_workflow(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2632,9 +2654,10 @@ def test_delete_migration_workflow_non_empty_request_with_auto_populated_field() client.delete_migration_workflow(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == migration_service.DeleteMigrationWorkflowRequest( + request_msg = migration_service.DeleteMigrationWorkflowRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_migration_workflow_use_cached_wrapped_rpc(): @@ -2720,9 +2743,15 @@ async def test_delete_migration_workflow_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + migration_service.DeleteMigrationWorkflowRequest(), + {}, + ], +) async def test_delete_migration_workflow_async( - transport: str = "grpc_asyncio", - request_type=migration_service.DeleteMigrationWorkflowRequest, + request_type, transport: str = "grpc_asyncio" ): client = MigrationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2731,7 +2760,7 @@ async def test_delete_migration_workflow_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( @@ -2751,11 +2780,6 @@ async def test_delete_migration_workflow_async( assert response is None -@pytest.mark.asyncio -async def test_delete_migration_workflow_async_from_dict(): - await test_delete_migration_workflow_async(request_type=dict) - - def test_delete_migration_workflow_field_headers(): client = MigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2906,8 +2930,8 @@ async def test_delete_migration_workflow_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - migration_service.StartMigrationWorkflowRequest, - dict, + migration_service.StartMigrationWorkflowRequest(), + {}, ], ) def test_start_migration_workflow(request_type, transport: str = "grpc"): @@ -2918,7 +2942,7 @@ def test_start_migration_workflow(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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 +2987,10 @@ def test_start_migration_workflow_non_empty_request_with_auto_populated_field(): client.start_migration_workflow(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == migration_service.StartMigrationWorkflowRequest( + request_msg = migration_service.StartMigrationWorkflowRequest( name="name_value", ) + assert args[0] == request_msg def test_start_migration_workflow_use_cached_wrapped_rpc(): @@ -3051,9 +3076,15 @@ async def test_start_migration_workflow_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + migration_service.StartMigrationWorkflowRequest(), + {}, + ], +) async def test_start_migration_workflow_async( - transport: str = "grpc_asyncio", - request_type=migration_service.StartMigrationWorkflowRequest, + request_type, transport: str = "grpc_asyncio" ): client = MigrationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3062,7 +3093,7 @@ async def test_start_migration_workflow_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( @@ -3082,11 +3113,6 @@ async def test_start_migration_workflow_async( assert response is None -@pytest.mark.asyncio -async def test_start_migration_workflow_async_from_dict(): - await test_start_migration_workflow_async(request_type=dict) - - def test_start_migration_workflow_field_headers(): client = MigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3237,8 +3263,8 @@ async def test_start_migration_workflow_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - migration_service.GetMigrationSubtaskRequest, - dict, + migration_service.GetMigrationSubtaskRequest(), + {}, ], ) def test_get_migration_subtask(request_type, transport: str = "grpc"): @@ -3249,7 +3275,7 @@ def test_get_migration_subtask(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3305,9 +3331,10 @@ def test_get_migration_subtask_non_empty_request_with_auto_populated_field(): client.get_migration_subtask(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == migration_service.GetMigrationSubtaskRequest( + request_msg = migration_service.GetMigrationSubtaskRequest( name="name_value", ) + assert args[0] == request_msg def test_get_migration_subtask_use_cached_wrapped_rpc(): @@ -3393,9 +3420,15 @@ async def test_get_migration_subtask_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + migration_service.GetMigrationSubtaskRequest(), + {}, + ], +) async def test_get_migration_subtask_async( - transport: str = "grpc_asyncio", - request_type=migration_service.GetMigrationSubtaskRequest, + request_type, transport: str = "grpc_asyncio" ): client = MigrationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3404,7 +3437,7 @@ async def test_get_migration_subtask_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( @@ -3437,11 +3470,6 @@ async def test_get_migration_subtask_async( assert response.resource_error_count == 2169 -@pytest.mark.asyncio -async def test_get_migration_subtask_async_from_dict(): - await test_get_migration_subtask_async(request_type=dict) - - def test_get_migration_subtask_field_headers(): client = MigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3596,8 +3624,8 @@ async def test_get_migration_subtask_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - migration_service.ListMigrationSubtasksRequest, - dict, + migration_service.ListMigrationSubtasksRequest(), + {}, ], ) def test_list_migration_subtasks(request_type, transport: str = "grpc"): @@ -3608,7 +3636,7 @@ def test_list_migration_subtasks(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3658,11 +3686,12 @@ def test_list_migration_subtasks_non_empty_request_with_auto_populated_field(): client.list_migration_subtasks(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == migration_service.ListMigrationSubtasksRequest( + request_msg = migration_service.ListMigrationSubtasksRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_migration_subtasks_use_cached_wrapped_rpc(): @@ -3748,9 +3777,15 @@ async def test_list_migration_subtasks_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + migration_service.ListMigrationSubtasksRequest(), + {}, + ], +) async def test_list_migration_subtasks_async( - transport: str = "grpc_asyncio", - request_type=migration_service.ListMigrationSubtasksRequest, + request_type, transport: str = "grpc_asyncio" ): client = MigrationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3759,7 +3794,7 @@ async def test_list_migration_subtasks_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( @@ -3784,11 +3819,6 @@ async def test_list_migration_subtasks_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_migration_subtasks_async_from_dict(): - await test_list_migration_subtasks_async(request_type=dict) - - def test_list_migration_subtasks_field_headers(): client = MigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4264,7 +4294,6 @@ def test_create_migration_workflow_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migration_service.CreateMigrationWorkflowRequest() - assert args[0] == request_msg @@ -4287,7 +4316,6 @@ def test_get_migration_workflow_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migration_service.GetMigrationWorkflowRequest() - assert args[0] == request_msg @@ -4310,7 +4338,6 @@ def test_list_migration_workflows_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migration_service.ListMigrationWorkflowsRequest() - assert args[0] == request_msg @@ -4333,7 +4360,6 @@ def test_delete_migration_workflow_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migration_service.DeleteMigrationWorkflowRequest() - assert args[0] == request_msg @@ -4356,7 +4382,6 @@ def test_start_migration_workflow_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migration_service.StartMigrationWorkflowRequest() - assert args[0] == request_msg @@ -4379,7 +4404,6 @@ def test_get_migration_subtask_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migration_service.GetMigrationSubtaskRequest() - assert args[0] == request_msg @@ -4402,7 +4426,6 @@ def test_list_migration_subtasks_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migration_service.ListMigrationSubtasksRequest() - assert args[0] == request_msg @@ -4447,7 +4470,6 @@ async def test_create_migration_workflow_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migration_service.CreateMigrationWorkflowRequest() - assert args[0] == request_msg @@ -4478,7 +4500,6 @@ async def test_get_migration_workflow_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migration_service.GetMigrationWorkflowRequest() - assert args[0] == request_msg @@ -4507,7 +4528,6 @@ async def test_list_migration_workflows_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migration_service.ListMigrationWorkflowsRequest() - assert args[0] == request_msg @@ -4532,7 +4552,6 @@ async def test_delete_migration_workflow_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migration_service.DeleteMigrationWorkflowRequest() - assert args[0] == request_msg @@ -4557,7 +4576,6 @@ async def test_start_migration_workflow_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migration_service.StartMigrationWorkflowRequest() - assert args[0] == request_msg @@ -4590,7 +4608,6 @@ async def test_get_migration_subtask_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migration_service.GetMigrationSubtaskRequest() - assert args[0] == request_msg @@ -4619,7 +4636,6 @@ async def test_list_migration_subtasks_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migration_service.ListMigrationSubtasksRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-bigquery-migration/tests/unit/gapic/bigquery_migration_v2alpha/test_sql_translation_service.py b/packages/google-cloud-bigquery-migration/tests/unit/gapic/bigquery_migration_v2alpha/test_sql_translation_service.py index 8e4e5361fb47..e3490ae70e5a 100644 --- a/packages/google-cloud-bigquery-migration/tests/unit/gapic/bigquery_migration_v2alpha/test_sql_translation_service.py +++ b/packages/google-cloud-bigquery-migration/tests/unit/gapic/bigquery_migration_v2alpha/test_sql_translation_service.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 @@ -103,6 +104,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" @@ -1328,8 +1344,8 @@ def test_sql_translation_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - translation_service.TranslateQueryRequest, - dict, + translation_service.TranslateQueryRequest(), + {}, ], ) def test_translate_query(request_type, transport: str = "grpc"): @@ -1340,7 +1356,7 @@ def test_translate_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(type(client.transport.translate_query), "__call__") as call: @@ -1387,10 +1403,11 @@ def test_translate_query_non_empty_request_with_auto_populated_field(): client.translate_query(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == translation_service.TranslateQueryRequest( + request_msg = translation_service.TranslateQueryRequest( parent="parent_value", query="query_value", ) + assert args[0] == request_msg def test_translate_query_use_cached_wrapped_rpc(): @@ -1471,10 +1488,14 @@ async def test_translate_query_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_translate_query_async( - transport: str = "grpc_asyncio", - request_type=translation_service.TranslateQueryRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + translation_service.TranslateQueryRequest(), + {}, + ], +) +async def test_translate_query_async(request_type, transport: str = "grpc_asyncio"): client = SqlTranslationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1482,7 +1503,7 @@ async def test_translate_query_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.translate_query), "__call__") as call: @@ -1507,11 +1528,6 @@ async def test_translate_query_async( assert response.translated_query == "translated_query_value" -@pytest.mark.asyncio -async def test_translate_query_async_from_dict(): - await test_translate_query_async(request_type=dict) - - def test_translate_query_field_headers(): client = SqlTranslationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1797,7 +1813,6 @@ def test_translate_query_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.TranslateQueryRequest() - assert args[0] == request_msg @@ -1839,7 +1854,6 @@ async def test_translate_query_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.TranslateQueryRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-bigquery-reservation/noxfile.py b/packages/google-cloud-bigquery-reservation/noxfile.py index ef0d53219dcd..839f10246119 100644 --- a/packages/google-cloud-bigquery-reservation/noxfile.py +++ b/packages/google-cloud-bigquery-reservation/noxfile.py @@ -47,7 +47,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-bigquery-reservation" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-bigquery-reservation/setup.py b/packages/google-cloud-bigquery-reservation/setup.py index d64c753b9047..07e6eba134b7 100644 --- a/packages/google-cloud-bigquery-reservation/setup.py +++ b/packages/google-cloud-bigquery-reservation/setup.py @@ -45,7 +45,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/google-cloud-bigquery-reservation/testing/constraints-3.10.txt b/packages/google-cloud-bigquery-reservation/testing/constraints-3.10.txt index a92801e1c8e2..b39cd54634f9 100644 --- a/packages/google-cloud-bigquery-reservation/testing/constraints-3.10.txt +++ b/packages/google-cloud-bigquery-reservation/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/google-cloud-bigquery-reservation/tests/unit/gapic/bigquery_reservation_v1/test_reservation_service.py b/packages/google-cloud-bigquery-reservation/tests/unit/gapic/bigquery_reservation_v1/test_reservation_service.py index 5641f0f5aada..49f949cd5cc3 100644 --- a/packages/google-cloud-bigquery-reservation/tests/unit/gapic/bigquery_reservation_v1/test_reservation_service.py +++ b/packages/google-cloud-bigquery-reservation/tests/unit/gapic/bigquery_reservation_v1/test_reservation_service.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 @@ -116,6 +117,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" @@ -1364,8 +1380,8 @@ def test_reservation_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - gcbr_reservation.CreateReservationRequest, - dict, + gcbr_reservation.CreateReservationRequest(), + {}, ], ) def test_create_reservation(request_type, transport: str = "grpc"): @@ -1376,7 +1392,7 @@ def test_create_reservation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1449,10 +1465,11 @@ def test_create_reservation_non_empty_request_with_auto_populated_field(): client.create_reservation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcbr_reservation.CreateReservationRequest( + request_msg = gcbr_reservation.CreateReservationRequest( parent="parent_value", reservation_id="reservation_id_value", ) + assert args[0] == request_msg def test_create_reservation_use_cached_wrapped_rpc(): @@ -1537,10 +1554,14 @@ async def test_create_reservation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_reservation_async( - transport: str = "grpc_asyncio", - request_type=gcbr_reservation.CreateReservationRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + gcbr_reservation.CreateReservationRequest(), + {}, + ], +) +async def test_create_reservation_async(request_type, transport: str = "grpc_asyncio"): client = ReservationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1548,7 +1569,7 @@ async def test_create_reservation_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( @@ -1597,11 +1618,6 @@ async def test_create_reservation_async( assert response.reservation_group == "reservation_group_value" -@pytest.mark.asyncio -async def test_create_reservation_async_from_dict(): - await test_create_reservation_async(request_type=dict) - - def test_create_reservation_field_headers(): client = ReservationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1776,8 +1792,8 @@ async def test_create_reservation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - reservation.ListReservationsRequest, - dict, + reservation.ListReservationsRequest(), + {}, ], ) def test_list_reservations(request_type, transport: str = "grpc"): @@ -1788,7 +1804,7 @@ def test_list_reservations(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1837,10 +1853,11 @@ def test_list_reservations_non_empty_request_with_auto_populated_field(): client.list_reservations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == reservation.ListReservationsRequest( + request_msg = reservation.ListReservationsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_reservations_use_cached_wrapped_rpc(): @@ -1923,9 +1940,14 @@ async def test_list_reservations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_reservations_async( - transport: str = "grpc_asyncio", request_type=reservation.ListReservationsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + reservation.ListReservationsRequest(), + {}, + ], +) +async def test_list_reservations_async(request_type, transport: str = "grpc_asyncio"): client = ReservationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1933,7 +1955,7 @@ async def test_list_reservations_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( @@ -1958,11 +1980,6 @@ async def test_list_reservations_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_reservations_async_from_dict(): - await test_list_reservations_async(request_type=dict) - - def test_list_reservations_field_headers(): client = ReservationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2315,8 +2332,8 @@ async def test_list_reservations_async_pages(): @pytest.mark.parametrize( "request_type", [ - reservation.GetReservationRequest, - dict, + reservation.GetReservationRequest(), + {}, ], ) def test_get_reservation(request_type, transport: str = "grpc"): @@ -2327,7 +2344,7 @@ def test_get_reservation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_reservation), "__call__") as call: @@ -2393,9 +2410,10 @@ def test_get_reservation_non_empty_request_with_auto_populated_field(): client.get_reservation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == reservation.GetReservationRequest( + request_msg = reservation.GetReservationRequest( name="name_value", ) + assert args[0] == request_msg def test_get_reservation_use_cached_wrapped_rpc(): @@ -2476,9 +2494,14 @@ async def test_get_reservation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_reservation_async( - transport: str = "grpc_asyncio", request_type=reservation.GetReservationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + reservation.GetReservationRequest(), + {}, + ], +) +async def test_get_reservation_async(request_type, transport: str = "grpc_asyncio"): client = ReservationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2486,7 +2509,7 @@ async def test_get_reservation_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_reservation), "__call__") as call: @@ -2531,11 +2554,6 @@ async def test_get_reservation_async( assert response.reservation_group == "reservation_group_value" -@pytest.mark.asyncio -async def test_get_reservation_async_from_dict(): - await test_get_reservation_async(request_type=dict) - - def test_get_reservation_field_headers(): client = ReservationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2682,8 +2700,8 @@ async def test_get_reservation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - reservation.DeleteReservationRequest, - dict, + reservation.DeleteReservationRequest(), + {}, ], ) def test_delete_reservation(request_type, transport: str = "grpc"): @@ -2694,7 +2712,7 @@ def test_delete_reservation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,9 +2757,10 @@ def test_delete_reservation_non_empty_request_with_auto_populated_field(): client.delete_reservation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == reservation.DeleteReservationRequest( + request_msg = reservation.DeleteReservationRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_reservation_use_cached_wrapped_rpc(): @@ -2826,9 +2845,14 @@ async def test_delete_reservation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_reservation_async( - transport: str = "grpc_asyncio", request_type=reservation.DeleteReservationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + reservation.DeleteReservationRequest(), + {}, + ], +) +async def test_delete_reservation_async(request_type, transport: str = "grpc_asyncio"): client = ReservationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2836,7 +2860,7 @@ async def test_delete_reservation_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( @@ -2856,11 +2880,6 @@ async def test_delete_reservation_async( assert response is None -@pytest.mark.asyncio -async def test_delete_reservation_async_from_dict(): - await test_delete_reservation_async(request_type=dict) - - def test_delete_reservation_field_headers(): client = ReservationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3011,8 +3030,8 @@ async def test_delete_reservation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcbr_reservation.UpdateReservationRequest, - dict, + gcbr_reservation.UpdateReservationRequest(), + {}, ], ) def test_update_reservation(request_type, transport: str = "grpc"): @@ -3023,7 +3042,7 @@ def test_update_reservation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3093,7 +3112,8 @@ def test_update_reservation_non_empty_request_with_auto_populated_field(): client.update_reservation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcbr_reservation.UpdateReservationRequest() + request_msg = gcbr_reservation.UpdateReservationRequest() + assert args[0] == request_msg def test_update_reservation_use_cached_wrapped_rpc(): @@ -3178,10 +3198,14 @@ async def test_update_reservation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_reservation_async( - transport: str = "grpc_asyncio", - request_type=gcbr_reservation.UpdateReservationRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + gcbr_reservation.UpdateReservationRequest(), + {}, + ], +) +async def test_update_reservation_async(request_type, transport: str = "grpc_asyncio"): client = ReservationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3189,7 +3213,7 @@ async def test_update_reservation_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( @@ -3238,11 +3262,6 @@ async def test_update_reservation_async( assert response.reservation_group == "reservation_group_value" -@pytest.mark.asyncio -async def test_update_reservation_async_from_dict(): - await test_update_reservation_async(request_type=dict) - - def test_update_reservation_field_headers(): client = ReservationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3407,8 +3426,8 @@ async def test_update_reservation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - reservation.FailoverReservationRequest, - dict, + reservation.FailoverReservationRequest(), + {}, ], ) def test_failover_reservation(request_type, transport: str = "grpc"): @@ -3419,7 +3438,7 @@ def test_failover_reservation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3489,9 +3508,10 @@ def test_failover_reservation_non_empty_request_with_auto_populated_field(): client.failover_reservation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == reservation.FailoverReservationRequest( + request_msg = reservation.FailoverReservationRequest( name="name_value", ) + assert args[0] == request_msg def test_failover_reservation_use_cached_wrapped_rpc(): @@ -3576,8 +3596,15 @@ async def test_failover_reservation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + reservation.FailoverReservationRequest(), + {}, + ], +) async def test_failover_reservation_async( - transport: str = "grpc_asyncio", request_type=reservation.FailoverReservationRequest + request_type, transport: str = "grpc_asyncio" ): client = ReservationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3586,7 +3613,7 @@ async def test_failover_reservation_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( @@ -3633,11 +3660,6 @@ async def test_failover_reservation_async( assert response.reservation_group == "reservation_group_value" -@pytest.mark.asyncio -async def test_failover_reservation_async_from_dict(): - await test_failover_reservation_async(request_type=dict) - - def test_failover_reservation_field_headers(): client = ReservationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3706,8 +3728,8 @@ async def test_failover_reservation_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - reservation.CreateCapacityCommitmentRequest, - dict, + reservation.CreateCapacityCommitmentRequest(), + {}, ], ) def test_create_capacity_commitment(request_type, transport: str = "grpc"): @@ -3718,7 +3740,7 @@ def test_create_capacity_commitment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3781,10 +3803,11 @@ def test_create_capacity_commitment_non_empty_request_with_auto_populated_field( client.create_capacity_commitment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == reservation.CreateCapacityCommitmentRequest( + request_msg = reservation.CreateCapacityCommitmentRequest( parent="parent_value", capacity_commitment_id="capacity_commitment_id_value", ) + assert args[0] == request_msg def test_create_capacity_commitment_use_cached_wrapped_rpc(): @@ -3870,9 +3893,15 @@ async def test_create_capacity_commitment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + reservation.CreateCapacityCommitmentRequest(), + {}, + ], +) async def test_create_capacity_commitment_async( - transport: str = "grpc_asyncio", - request_type=reservation.CreateCapacityCommitmentRequest, + request_type, transport: str = "grpc_asyncio" ): client = ReservationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3881,7 +3910,7 @@ async def test_create_capacity_commitment_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( @@ -3920,11 +3949,6 @@ async def test_create_capacity_commitment_async( assert response.is_flat_rate is True -@pytest.mark.asyncio -async def test_create_capacity_commitment_async_from_dict(): - await test_create_capacity_commitment_async(request_type=dict) - - def test_create_capacity_commitment_field_headers(): client = ReservationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4089,8 +4113,8 @@ async def test_create_capacity_commitment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - reservation.ListCapacityCommitmentsRequest, - dict, + reservation.ListCapacityCommitmentsRequest(), + {}, ], ) def test_list_capacity_commitments(request_type, transport: str = "grpc"): @@ -4101,7 +4125,7 @@ def test_list_capacity_commitments(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4150,10 +4174,11 @@ def test_list_capacity_commitments_non_empty_request_with_auto_populated_field() client.list_capacity_commitments(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == reservation.ListCapacityCommitmentsRequest( + request_msg = reservation.ListCapacityCommitmentsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_capacity_commitments_use_cached_wrapped_rpc(): @@ -4239,9 +4264,15 @@ async def test_list_capacity_commitments_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + reservation.ListCapacityCommitmentsRequest(), + {}, + ], +) async def test_list_capacity_commitments_async( - transport: str = "grpc_asyncio", - request_type=reservation.ListCapacityCommitmentsRequest, + request_type, transport: str = "grpc_asyncio" ): client = ReservationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4250,7 +4281,7 @@ async def test_list_capacity_commitments_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( @@ -4275,11 +4306,6 @@ async def test_list_capacity_commitments_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_capacity_commitments_async_from_dict(): - await test_list_capacity_commitments_async(request_type=dict) - - def test_list_capacity_commitments_field_headers(): client = ReservationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4634,8 +4660,8 @@ async def test_list_capacity_commitments_async_pages(): @pytest.mark.parametrize( "request_type", [ - reservation.GetCapacityCommitmentRequest, - dict, + reservation.GetCapacityCommitmentRequest(), + {}, ], ) def test_get_capacity_commitment(request_type, transport: str = "grpc"): @@ -4646,7 +4672,7 @@ def test_get_capacity_commitment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4708,9 +4734,10 @@ def test_get_capacity_commitment_non_empty_request_with_auto_populated_field(): client.get_capacity_commitment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == reservation.GetCapacityCommitmentRequest( + request_msg = reservation.GetCapacityCommitmentRequest( name="name_value", ) + assert args[0] == request_msg def test_get_capacity_commitment_use_cached_wrapped_rpc(): @@ -4796,9 +4823,15 @@ async def test_get_capacity_commitment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + reservation.GetCapacityCommitmentRequest(), + {}, + ], +) async def test_get_capacity_commitment_async( - transport: str = "grpc_asyncio", - request_type=reservation.GetCapacityCommitmentRequest, + request_type, transport: str = "grpc_asyncio" ): client = ReservationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4807,7 +4840,7 @@ async def test_get_capacity_commitment_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( @@ -4846,11 +4879,6 @@ async def test_get_capacity_commitment_async( assert response.is_flat_rate is True -@pytest.mark.asyncio -async def test_get_capacity_commitment_async_from_dict(): - await test_get_capacity_commitment_async(request_type=dict) - - def test_get_capacity_commitment_field_headers(): client = ReservationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5005,8 +5033,8 @@ async def test_get_capacity_commitment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - reservation.DeleteCapacityCommitmentRequest, - dict, + reservation.DeleteCapacityCommitmentRequest(), + {}, ], ) def test_delete_capacity_commitment(request_type, transport: str = "grpc"): @@ -5017,7 +5045,7 @@ def test_delete_capacity_commitment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5062,9 +5090,10 @@ def test_delete_capacity_commitment_non_empty_request_with_auto_populated_field( client.delete_capacity_commitment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == reservation.DeleteCapacityCommitmentRequest( + request_msg = reservation.DeleteCapacityCommitmentRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_capacity_commitment_use_cached_wrapped_rpc(): @@ -5150,9 +5179,15 @@ async def test_delete_capacity_commitment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + reservation.DeleteCapacityCommitmentRequest(), + {}, + ], +) async def test_delete_capacity_commitment_async( - transport: str = "grpc_asyncio", - request_type=reservation.DeleteCapacityCommitmentRequest, + request_type, transport: str = "grpc_asyncio" ): client = ReservationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5161,7 +5196,7 @@ async def test_delete_capacity_commitment_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( @@ -5181,11 +5216,6 @@ async def test_delete_capacity_commitment_async( assert response is None -@pytest.mark.asyncio -async def test_delete_capacity_commitment_async_from_dict(): - await test_delete_capacity_commitment_async(request_type=dict) - - def test_delete_capacity_commitment_field_headers(): client = ReservationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5336,8 +5366,8 @@ async def test_delete_capacity_commitment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - reservation.UpdateCapacityCommitmentRequest, - dict, + reservation.UpdateCapacityCommitmentRequest(), + {}, ], ) def test_update_capacity_commitment(request_type, transport: str = "grpc"): @@ -5348,7 +5378,7 @@ def test_update_capacity_commitment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5408,7 +5438,8 @@ def test_update_capacity_commitment_non_empty_request_with_auto_populated_field( client.update_capacity_commitment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == reservation.UpdateCapacityCommitmentRequest() + request_msg = reservation.UpdateCapacityCommitmentRequest() + assert args[0] == request_msg def test_update_capacity_commitment_use_cached_wrapped_rpc(): @@ -5494,9 +5525,15 @@ async def test_update_capacity_commitment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + reservation.UpdateCapacityCommitmentRequest(), + {}, + ], +) async def test_update_capacity_commitment_async( - transport: str = "grpc_asyncio", - request_type=reservation.UpdateCapacityCommitmentRequest, + request_type, transport: str = "grpc_asyncio" ): client = ReservationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5505,7 +5542,7 @@ async def test_update_capacity_commitment_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( @@ -5544,11 +5581,6 @@ async def test_update_capacity_commitment_async( assert response.is_flat_rate is True -@pytest.mark.asyncio -async def test_update_capacity_commitment_async_from_dict(): - await test_update_capacity_commitment_async(request_type=dict) - - def test_update_capacity_commitment_field_headers(): client = ReservationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5713,8 +5745,8 @@ async def test_update_capacity_commitment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - reservation.SplitCapacityCommitmentRequest, - dict, + reservation.SplitCapacityCommitmentRequest(), + {}, ], ) def test_split_capacity_commitment(request_type, transport: str = "grpc"): @@ -5725,7 +5757,7 @@ def test_split_capacity_commitment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5770,9 +5802,10 @@ def test_split_capacity_commitment_non_empty_request_with_auto_populated_field() client.split_capacity_commitment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == reservation.SplitCapacityCommitmentRequest( + request_msg = reservation.SplitCapacityCommitmentRequest( name="name_value", ) + assert args[0] == request_msg def test_split_capacity_commitment_use_cached_wrapped_rpc(): @@ -5858,9 +5891,15 @@ async def test_split_capacity_commitment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + reservation.SplitCapacityCommitmentRequest(), + {}, + ], +) async def test_split_capacity_commitment_async( - transport: str = "grpc_asyncio", - request_type=reservation.SplitCapacityCommitmentRequest, + request_type, transport: str = "grpc_asyncio" ): client = ReservationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5869,7 +5908,7 @@ async def test_split_capacity_commitment_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( @@ -5891,11 +5930,6 @@ async def test_split_capacity_commitment_async( assert isinstance(response, reservation.SplitCapacityCommitmentResponse) -@pytest.mark.asyncio -async def test_split_capacity_commitment_async_from_dict(): - await test_split_capacity_commitment_async(request_type=dict) - - def test_split_capacity_commitment_field_headers(): client = ReservationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6060,8 +6094,8 @@ async def test_split_capacity_commitment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - reservation.MergeCapacityCommitmentsRequest, - dict, + reservation.MergeCapacityCommitmentsRequest(), + {}, ], ) def test_merge_capacity_commitments(request_type, transport: str = "grpc"): @@ -6072,7 +6106,7 @@ def test_merge_capacity_commitments(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6135,10 +6169,11 @@ def test_merge_capacity_commitments_non_empty_request_with_auto_populated_field( client.merge_capacity_commitments(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == reservation.MergeCapacityCommitmentsRequest( + request_msg = reservation.MergeCapacityCommitmentsRequest( parent="parent_value", capacity_commitment_id="capacity_commitment_id_value", ) + assert args[0] == request_msg def test_merge_capacity_commitments_use_cached_wrapped_rpc(): @@ -6224,9 +6259,15 @@ async def test_merge_capacity_commitments_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + reservation.MergeCapacityCommitmentsRequest(), + {}, + ], +) async def test_merge_capacity_commitments_async( - transport: str = "grpc_asyncio", - request_type=reservation.MergeCapacityCommitmentsRequest, + request_type, transport: str = "grpc_asyncio" ): client = ReservationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -6235,7 +6276,7 @@ async def test_merge_capacity_commitments_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( @@ -6274,11 +6315,6 @@ async def test_merge_capacity_commitments_async( assert response.is_flat_rate is True -@pytest.mark.asyncio -async def test_merge_capacity_commitments_async_from_dict(): - await test_merge_capacity_commitments_async(request_type=dict) - - def test_merge_capacity_commitments_field_headers(): client = ReservationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6443,8 +6479,8 @@ async def test_merge_capacity_commitments_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - reservation.CreateAssignmentRequest, - dict, + reservation.CreateAssignmentRequest(), + {}, ], ) def test_create_assignment(request_type, transport: str = "grpc"): @@ -6455,7 +6491,7 @@ def test_create_assignment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6514,10 +6550,11 @@ def test_create_assignment_non_empty_request_with_auto_populated_field(): client.create_assignment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == reservation.CreateAssignmentRequest( + request_msg = reservation.CreateAssignmentRequest( parent="parent_value", assignment_id="assignment_id_value", ) + assert args[0] == request_msg def test_create_assignment_use_cached_wrapped_rpc(): @@ -6600,9 +6637,14 @@ async def test_create_assignment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_assignment_async( - transport: str = "grpc_asyncio", request_type=reservation.CreateAssignmentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + reservation.CreateAssignmentRequest(), + {}, + ], +) +async def test_create_assignment_async(request_type, transport: str = "grpc_asyncio"): client = ReservationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6610,7 +6652,7 @@ async def test_create_assignment_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( @@ -6645,11 +6687,6 @@ async def test_create_assignment_async( assert response.principal == "principal_value" -@pytest.mark.asyncio -async def test_create_assignment_async_from_dict(): - await test_create_assignment_async(request_type=dict) - - def test_create_assignment_field_headers(): client = ReservationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6814,8 +6851,8 @@ async def test_create_assignment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - reservation.ListAssignmentsRequest, - dict, + reservation.ListAssignmentsRequest(), + {}, ], ) def test_list_assignments(request_type, transport: str = "grpc"): @@ -6826,7 +6863,7 @@ def test_list_assignments(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_assignments), "__call__") as call: @@ -6871,10 +6908,11 @@ def test_list_assignments_non_empty_request_with_auto_populated_field(): client.list_assignments(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == reservation.ListAssignmentsRequest( + request_msg = reservation.ListAssignmentsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_assignments_use_cached_wrapped_rpc(): @@ -6957,9 +6995,14 @@ async def test_list_assignments_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_assignments_async( - transport: str = "grpc_asyncio", request_type=reservation.ListAssignmentsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + reservation.ListAssignmentsRequest(), + {}, + ], +) +async def test_list_assignments_async(request_type, transport: str = "grpc_asyncio"): client = ReservationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6967,7 +7010,7 @@ async def test_list_assignments_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_assignments), "__call__") as call: @@ -6990,11 +7033,6 @@ async def test_list_assignments_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_assignments_async_from_dict(): - await test_list_assignments_async(request_type=dict) - - def test_list_assignments_field_headers(): client = ReservationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7331,8 +7369,8 @@ async def test_list_assignments_async_pages(): @pytest.mark.parametrize( "request_type", [ - reservation.DeleteAssignmentRequest, - dict, + reservation.DeleteAssignmentRequest(), + {}, ], ) def test_delete_assignment(request_type, transport: str = "grpc"): @@ -7343,7 +7381,7 @@ def test_delete_assignment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7388,9 +7426,10 @@ def test_delete_assignment_non_empty_request_with_auto_populated_field(): client.delete_assignment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == reservation.DeleteAssignmentRequest( + request_msg = reservation.DeleteAssignmentRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_assignment_use_cached_wrapped_rpc(): @@ -7473,9 +7512,14 @@ async def test_delete_assignment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_assignment_async( - transport: str = "grpc_asyncio", request_type=reservation.DeleteAssignmentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + reservation.DeleteAssignmentRequest(), + {}, + ], +) +async def test_delete_assignment_async(request_type, transport: str = "grpc_asyncio"): client = ReservationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7483,7 +7527,7 @@ async def test_delete_assignment_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( @@ -7503,11 +7547,6 @@ async def test_delete_assignment_async( assert response is None -@pytest.mark.asyncio -async def test_delete_assignment_async_from_dict(): - await test_delete_assignment_async(request_type=dict) - - def test_delete_assignment_field_headers(): client = ReservationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7658,8 +7697,8 @@ async def test_delete_assignment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - reservation.SearchAssignmentsRequest, - dict, + reservation.SearchAssignmentsRequest(), + {}, ], ) def test_search_assignments(request_type, transport: str = "grpc"): @@ -7670,7 +7709,7 @@ def test_search_assignments(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7720,11 +7759,12 @@ def test_search_assignments_non_empty_request_with_auto_populated_field(): client.search_assignments(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == reservation.SearchAssignmentsRequest( + request_msg = reservation.SearchAssignmentsRequest( parent="parent_value", query="query_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_search_assignments_use_cached_wrapped_rpc(): @@ -7809,9 +7849,14 @@ async def test_search_assignments_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_search_assignments_async( - transport: str = "grpc_asyncio", request_type=reservation.SearchAssignmentsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + reservation.SearchAssignmentsRequest(), + {}, + ], +) +async def test_search_assignments_async(request_type, transport: str = "grpc_asyncio"): client = ReservationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7819,7 +7864,7 @@ async def test_search_assignments_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( @@ -7844,11 +7889,6 @@ async def test_search_assignments_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_search_assignments_async_from_dict(): - await test_search_assignments_async(request_type=dict) - - def test_search_assignments_field_headers(): client = ReservationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8211,8 +8251,8 @@ async def test_search_assignments_async_pages(): @pytest.mark.parametrize( "request_type", [ - reservation.SearchAllAssignmentsRequest, - dict, + reservation.SearchAllAssignmentsRequest(), + {}, ], ) def test_search_all_assignments(request_type, transport: str = "grpc"): @@ -8223,7 +8263,7 @@ def test_search_all_assignments(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8273,11 +8313,12 @@ def test_search_all_assignments_non_empty_request_with_auto_populated_field(): client.search_all_assignments(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == reservation.SearchAllAssignmentsRequest( + request_msg = reservation.SearchAllAssignmentsRequest( parent="parent_value", query="query_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_search_all_assignments_use_cached_wrapped_rpc(): @@ -8363,9 +8404,15 @@ async def test_search_all_assignments_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + reservation.SearchAllAssignmentsRequest(), + {}, + ], +) async def test_search_all_assignments_async( - transport: str = "grpc_asyncio", - request_type=reservation.SearchAllAssignmentsRequest, + request_type, transport: str = "grpc_asyncio" ): client = ReservationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -8374,7 +8421,7 @@ async def test_search_all_assignments_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( @@ -8399,11 +8446,6 @@ async def test_search_all_assignments_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_search_all_assignments_async_from_dict(): - await test_search_all_assignments_async(request_type=dict) - - def test_search_all_assignments_field_headers(): client = ReservationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8766,8 +8808,8 @@ async def test_search_all_assignments_async_pages(): @pytest.mark.parametrize( "request_type", [ - reservation.MoveAssignmentRequest, - dict, + reservation.MoveAssignmentRequest(), + {}, ], ) def test_move_assignment(request_type, transport: str = "grpc"): @@ -8778,7 +8820,7 @@ def test_move_assignment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.move_assignment), "__call__") as call: @@ -8834,11 +8876,12 @@ def test_move_assignment_non_empty_request_with_auto_populated_field(): client.move_assignment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == reservation.MoveAssignmentRequest( + request_msg = reservation.MoveAssignmentRequest( name="name_value", destination_id="destination_id_value", assignment_id="assignment_id_value", ) + assert args[0] == request_msg def test_move_assignment_use_cached_wrapped_rpc(): @@ -8919,9 +8962,14 @@ async def test_move_assignment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_move_assignment_async( - transport: str = "grpc_asyncio", request_type=reservation.MoveAssignmentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + reservation.MoveAssignmentRequest(), + {}, + ], +) +async def test_move_assignment_async(request_type, transport: str = "grpc_asyncio"): client = ReservationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8929,7 +8977,7 @@ async def test_move_assignment_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.move_assignment), "__call__") as call: @@ -8962,11 +9010,6 @@ async def test_move_assignment_async( assert response.principal == "principal_value" -@pytest.mark.asyncio -async def test_move_assignment_async_from_dict(): - await test_move_assignment_async(request_type=dict) - - def test_move_assignment_field_headers(): client = ReservationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9123,8 +9166,8 @@ async def test_move_assignment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - reservation.UpdateAssignmentRequest, - dict, + reservation.UpdateAssignmentRequest(), + {}, ], ) def test_update_assignment(request_type, transport: str = "grpc"): @@ -9135,7 +9178,7 @@ def test_update_assignment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9191,7 +9234,8 @@ def test_update_assignment_non_empty_request_with_auto_populated_field(): client.update_assignment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == reservation.UpdateAssignmentRequest() + request_msg = reservation.UpdateAssignmentRequest() + assert args[0] == request_msg def test_update_assignment_use_cached_wrapped_rpc(): @@ -9274,9 +9318,14 @@ async def test_update_assignment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_assignment_async( - transport: str = "grpc_asyncio", request_type=reservation.UpdateAssignmentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + reservation.UpdateAssignmentRequest(), + {}, + ], +) +async def test_update_assignment_async(request_type, transport: str = "grpc_asyncio"): client = ReservationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9284,7 +9333,7 @@ async def test_update_assignment_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( @@ -9319,11 +9368,6 @@ async def test_update_assignment_async( assert response.principal == "principal_value" -@pytest.mark.asyncio -async def test_update_assignment_async_from_dict(): - await test_update_assignment_async(request_type=dict) - - def test_update_assignment_field_headers(): client = ReservationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9488,8 +9532,8 @@ async def test_update_assignment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - reservation.GetBiReservationRequest, - dict, + reservation.GetBiReservationRequest(), + {}, ], ) def test_get_bi_reservation(request_type, transport: str = "grpc"): @@ -9500,7 +9544,7 @@ def test_get_bi_reservation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9550,9 +9594,10 @@ def test_get_bi_reservation_non_empty_request_with_auto_populated_field(): client.get_bi_reservation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == reservation.GetBiReservationRequest( + request_msg = reservation.GetBiReservationRequest( name="name_value", ) + assert args[0] == request_msg def test_get_bi_reservation_use_cached_wrapped_rpc(): @@ -9637,9 +9682,14 @@ async def test_get_bi_reservation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_bi_reservation_async( - transport: str = "grpc_asyncio", request_type=reservation.GetBiReservationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + reservation.GetBiReservationRequest(), + {}, + ], +) +async def test_get_bi_reservation_async(request_type, transport: str = "grpc_asyncio"): client = ReservationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9647,7 +9697,7 @@ async def test_get_bi_reservation_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( @@ -9674,11 +9724,6 @@ async def test_get_bi_reservation_async( assert response.size == 443 -@pytest.mark.asyncio -async def test_get_bi_reservation_async_from_dict(): - await test_get_bi_reservation_async(request_type=dict) - - def test_get_bi_reservation_field_headers(): client = ReservationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9833,8 +9878,8 @@ async def test_get_bi_reservation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - reservation.UpdateBiReservationRequest, - dict, + reservation.UpdateBiReservationRequest(), + {}, ], ) def test_update_bi_reservation(request_type, transport: str = "grpc"): @@ -9845,7 +9890,7 @@ def test_update_bi_reservation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9893,7 +9938,8 @@ def test_update_bi_reservation_non_empty_request_with_auto_populated_field(): client.update_bi_reservation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == reservation.UpdateBiReservationRequest() + request_msg = reservation.UpdateBiReservationRequest() + assert args[0] == request_msg def test_update_bi_reservation_use_cached_wrapped_rpc(): @@ -9979,8 +10025,15 @@ async def test_update_bi_reservation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + reservation.UpdateBiReservationRequest(), + {}, + ], +) async def test_update_bi_reservation_async( - transport: str = "grpc_asyncio", request_type=reservation.UpdateBiReservationRequest + request_type, transport: str = "grpc_asyncio" ): client = ReservationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -9989,7 +10042,7 @@ async def test_update_bi_reservation_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( @@ -10016,11 +10069,6 @@ async def test_update_bi_reservation_async( assert response.size == 443 -@pytest.mark.asyncio -async def test_update_bi_reservation_async_from_dict(): - await test_update_bi_reservation_async(request_type=dict) - - def test_update_bi_reservation_field_headers(): client = ReservationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10185,8 +10233,8 @@ async def test_update_bi_reservation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.GetIamPolicyRequest, - dict, + iam_policy_pb2.GetIamPolicyRequest(), + {}, ], ) def test_get_iam_policy(request_type, transport: str = "grpc"): @@ -10197,7 +10245,7 @@ def test_get_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(type(client.transport.get_iam_policy), "__call__") as call: @@ -10243,9 +10291,10 @@ def test_get_iam_policy_non_empty_request_with_auto_populated_field(): client.get_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.GetIamPolicyRequest( + request_msg = iam_policy_pb2.GetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_get_iam_policy_use_cached_wrapped_rpc(): @@ -10326,9 +10375,14 @@ async def test_get_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.GetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.GetIamPolicyRequest(), + {}, + ], +) +async def test_get_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = ReservationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10336,7 +10390,7 @@ async def test_get_iam_policy_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_iam_policy), "__call__") as call: @@ -10361,11 +10415,6 @@ async def test_get_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_get_iam_policy_async_from_dict(): - await test_get_iam_policy_async(request_type=dict) - - def test_get_iam_policy_field_headers(): client = ReservationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10525,8 +10574,8 @@ async def test_get_iam_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.SetIamPolicyRequest, - dict, + iam_policy_pb2.SetIamPolicyRequest(), + {}, ], ) def test_set_iam_policy(request_type, transport: str = "grpc"): @@ -10537,7 +10586,7 @@ def test_set_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(type(client.transport.set_iam_policy), "__call__") as call: @@ -10583,9 +10632,10 @@ def test_set_iam_policy_non_empty_request_with_auto_populated_field(): client.set_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.SetIamPolicyRequest( + request_msg = iam_policy_pb2.SetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_set_iam_policy_use_cached_wrapped_rpc(): @@ -10666,9 +10716,14 @@ async def test_set_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.SetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.SetIamPolicyRequest(), + {}, + ], +) +async def test_set_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = ReservationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10676,7 +10731,7 @@ async def test_set_iam_policy_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.set_iam_policy), "__call__") as call: @@ -10701,11 +10756,6 @@ async def test_set_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_set_iam_policy_async_from_dict(): - await test_set_iam_policy_async(request_type=dict) - - def test_set_iam_policy_field_headers(): client = ReservationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10866,8 +10916,8 @@ async def test_set_iam_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.TestIamPermissionsRequest, - dict, + iam_policy_pb2.TestIamPermissionsRequest(), + {}, ], ) def test_test_iam_permissions(request_type, transport: str = "grpc"): @@ -10878,7 +10928,7 @@ def test_test_iam_permissions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10926,9 +10976,10 @@ def test_test_iam_permissions_non_empty_request_with_auto_populated_field(): client.test_iam_permissions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.TestIamPermissionsRequest( + request_msg = iam_policy_pb2.TestIamPermissionsRequest( resource="resource_value", ) + assert args[0] == request_msg def test_test_iam_permissions_use_cached_wrapped_rpc(): @@ -11013,9 +11064,15 @@ async def test_test_iam_permissions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.TestIamPermissionsRequest(), + {}, + ], +) async def test_test_iam_permissions_async( - transport: str = "grpc_asyncio", - request_type=iam_policy_pb2.TestIamPermissionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = ReservationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -11024,7 +11081,7 @@ async def test_test_iam_permissions_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( @@ -11049,11 +11106,6 @@ async def test_test_iam_permissions_async( assert response.permissions == ["permissions_value"] -@pytest.mark.asyncio -async def test_test_iam_permissions_async_from_dict(): - await test_test_iam_permissions_async(request_type=dict) - - def test_test_iam_permissions_field_headers(): client = ReservationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11141,8 +11193,8 @@ def test_test_iam_permissions_from_dict_foreign(): @pytest.mark.parametrize( "request_type", [ - reservation.CreateReservationGroupRequest, - dict, + reservation.CreateReservationGroupRequest(), + {}, ], ) def test_create_reservation_group(request_type, transport: str = "grpc"): @@ -11153,7 +11205,7 @@ def test_create_reservation_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11202,10 +11254,11 @@ def test_create_reservation_group_non_empty_request_with_auto_populated_field(): client.create_reservation_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == reservation.CreateReservationGroupRequest( + request_msg = reservation.CreateReservationGroupRequest( parent="parent_value", reservation_group_id="reservation_group_id_value", ) + assert args[0] == request_msg def test_create_reservation_group_use_cached_wrapped_rpc(): @@ -11291,9 +11344,15 @@ async def test_create_reservation_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + reservation.CreateReservationGroupRequest(), + {}, + ], +) async def test_create_reservation_group_async( - transport: str = "grpc_asyncio", - request_type=reservation.CreateReservationGroupRequest, + request_type, transport: str = "grpc_asyncio" ): client = ReservationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -11302,7 +11361,7 @@ async def test_create_reservation_group_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( @@ -11327,11 +11386,6 @@ async def test_create_reservation_group_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_create_reservation_group_async_from_dict(): - await test_create_reservation_group_async(request_type=dict) - - def test_create_reservation_group_field_headers(): client = ReservationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11400,8 +11454,8 @@ async def test_create_reservation_group_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - reservation.GetReservationGroupRequest, - dict, + reservation.GetReservationGroupRequest(), + {}, ], ) def test_get_reservation_group(request_type, transport: str = "grpc"): @@ -11412,7 +11466,7 @@ def test_get_reservation_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11460,9 +11514,10 @@ def test_get_reservation_group_non_empty_request_with_auto_populated_field(): client.get_reservation_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == reservation.GetReservationGroupRequest( + request_msg = reservation.GetReservationGroupRequest( name="name_value", ) + assert args[0] == request_msg def test_get_reservation_group_use_cached_wrapped_rpc(): @@ -11548,8 +11603,15 @@ async def test_get_reservation_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + reservation.GetReservationGroupRequest(), + {}, + ], +) async def test_get_reservation_group_async( - transport: str = "grpc_asyncio", request_type=reservation.GetReservationGroupRequest + request_type, transport: str = "grpc_asyncio" ): client = ReservationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -11558,7 +11620,7 @@ async def test_get_reservation_group_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( @@ -11583,11 +11645,6 @@ async def test_get_reservation_group_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_reservation_group_async_from_dict(): - await test_get_reservation_group_async(request_type=dict) - - def test_get_reservation_group_field_headers(): client = ReservationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11742,8 +11799,8 @@ async def test_get_reservation_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - reservation.DeleteReservationGroupRequest, - dict, + reservation.DeleteReservationGroupRequest(), + {}, ], ) def test_delete_reservation_group(request_type, transport: str = "grpc"): @@ -11754,7 +11811,7 @@ def test_delete_reservation_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11799,9 +11856,10 @@ def test_delete_reservation_group_non_empty_request_with_auto_populated_field(): client.delete_reservation_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == reservation.DeleteReservationGroupRequest( + request_msg = reservation.DeleteReservationGroupRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_reservation_group_use_cached_wrapped_rpc(): @@ -11887,9 +11945,15 @@ async def test_delete_reservation_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + reservation.DeleteReservationGroupRequest(), + {}, + ], +) async def test_delete_reservation_group_async( - transport: str = "grpc_asyncio", - request_type=reservation.DeleteReservationGroupRequest, + request_type, transport: str = "grpc_asyncio" ): client = ReservationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -11898,7 +11962,7 @@ async def test_delete_reservation_group_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( @@ -11918,11 +11982,6 @@ async def test_delete_reservation_group_async( assert response is None -@pytest.mark.asyncio -async def test_delete_reservation_group_async_from_dict(): - await test_delete_reservation_group_async(request_type=dict) - - def test_delete_reservation_group_field_headers(): client = ReservationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12073,8 +12132,8 @@ async def test_delete_reservation_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - reservation.ListReservationGroupsRequest, - dict, + reservation.ListReservationGroupsRequest(), + {}, ], ) def test_list_reservation_groups(request_type, transport: str = "grpc"): @@ -12085,7 +12144,7 @@ def test_list_reservation_groups(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -12134,10 +12193,11 @@ def test_list_reservation_groups_non_empty_request_with_auto_populated_field(): client.list_reservation_groups(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == reservation.ListReservationGroupsRequest( + request_msg = reservation.ListReservationGroupsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_reservation_groups_use_cached_wrapped_rpc(): @@ -12223,9 +12283,15 @@ async def test_list_reservation_groups_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + reservation.ListReservationGroupsRequest(), + {}, + ], +) async def test_list_reservation_groups_async( - transport: str = "grpc_asyncio", - request_type=reservation.ListReservationGroupsRequest, + request_type, transport: str = "grpc_asyncio" ): client = ReservationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -12234,7 +12300,7 @@ async def test_list_reservation_groups_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( @@ -12259,11 +12325,6 @@ async def test_list_reservation_groups_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_reservation_groups_async_from_dict(): - await test_list_reservation_groups_async(request_type=dict) - - def test_list_reservation_groups_field_headers(): client = ReservationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17999,7 +18060,6 @@ def test_create_reservation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcbr_reservation.CreateReservationRequest() - assert args[0] == request_msg @@ -18022,7 +18082,6 @@ def test_list_reservations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reservation.ListReservationsRequest() - assert args[0] == request_msg @@ -18043,7 +18102,6 @@ def test_get_reservation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reservation.GetReservationRequest() - assert args[0] == request_msg @@ -18066,7 +18124,6 @@ def test_delete_reservation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reservation.DeleteReservationRequest() - assert args[0] == request_msg @@ -18089,7 +18146,6 @@ def test_update_reservation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcbr_reservation.UpdateReservationRequest() - assert args[0] == request_msg @@ -18112,7 +18168,6 @@ def test_failover_reservation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reservation.FailoverReservationRequest() - assert args[0] == request_msg @@ -18135,7 +18190,6 @@ def test_create_capacity_commitment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reservation.CreateCapacityCommitmentRequest() - assert args[0] == request_msg @@ -18158,7 +18212,6 @@ def test_list_capacity_commitments_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reservation.ListCapacityCommitmentsRequest() - assert args[0] == request_msg @@ -18181,7 +18234,6 @@ def test_get_capacity_commitment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reservation.GetCapacityCommitmentRequest() - assert args[0] == request_msg @@ -18204,7 +18256,6 @@ def test_delete_capacity_commitment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reservation.DeleteCapacityCommitmentRequest() - assert args[0] == request_msg @@ -18227,7 +18278,6 @@ def test_update_capacity_commitment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reservation.UpdateCapacityCommitmentRequest() - assert args[0] == request_msg @@ -18250,7 +18300,6 @@ def test_split_capacity_commitment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reservation.SplitCapacityCommitmentRequest() - assert args[0] == request_msg @@ -18273,7 +18322,6 @@ def test_merge_capacity_commitments_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reservation.MergeCapacityCommitmentsRequest() - assert args[0] == request_msg @@ -18296,7 +18344,6 @@ def test_create_assignment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reservation.CreateAssignmentRequest() - assert args[0] == request_msg @@ -18317,7 +18364,6 @@ def test_list_assignments_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reservation.ListAssignmentsRequest() - assert args[0] == request_msg @@ -18340,7 +18386,6 @@ def test_delete_assignment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reservation.DeleteAssignmentRequest() - assert args[0] == request_msg @@ -18363,7 +18408,6 @@ def test_search_assignments_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reservation.SearchAssignmentsRequest() - assert args[0] == request_msg @@ -18386,7 +18430,6 @@ def test_search_all_assignments_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reservation.SearchAllAssignmentsRequest() - assert args[0] == request_msg @@ -18407,7 +18450,6 @@ def test_move_assignment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reservation.MoveAssignmentRequest() - assert args[0] == request_msg @@ -18430,7 +18472,6 @@ def test_update_assignment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reservation.UpdateAssignmentRequest() - assert args[0] == request_msg @@ -18453,7 +18494,6 @@ def test_get_bi_reservation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reservation.GetBiReservationRequest() - assert args[0] == request_msg @@ -18476,7 +18516,6 @@ def test_update_bi_reservation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reservation.UpdateBiReservationRequest() - assert args[0] == request_msg @@ -18497,7 +18536,6 @@ def test_get_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -18518,7 +18556,6 @@ def test_set_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -18541,7 +18578,6 @@ def test_test_iam_permissions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -18564,7 +18600,6 @@ def test_create_reservation_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reservation.CreateReservationGroupRequest() - assert args[0] == request_msg @@ -18587,7 +18622,6 @@ def test_get_reservation_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reservation.GetReservationGroupRequest() - assert args[0] == request_msg @@ -18610,7 +18644,6 @@ def test_delete_reservation_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reservation.DeleteReservationGroupRequest() - assert args[0] == request_msg @@ -18633,7 +18666,6 @@ def test_list_reservation_groups_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reservation.ListReservationGroupsRequest() - assert args[0] == request_msg @@ -18687,7 +18719,6 @@ async def test_create_reservation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcbr_reservation.CreateReservationRequest() - assert args[0] == request_msg @@ -18716,7 +18747,6 @@ async def test_list_reservations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reservation.ListReservationsRequest() - assert args[0] == request_msg @@ -18754,7 +18784,6 @@ async def test_get_reservation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reservation.GetReservationRequest() - assert args[0] == request_msg @@ -18779,7 +18808,6 @@ async def test_delete_reservation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reservation.DeleteReservationRequest() - assert args[0] == request_msg @@ -18819,7 +18847,6 @@ async def test_update_reservation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcbr_reservation.UpdateReservationRequest() - assert args[0] == request_msg @@ -18859,7 +18886,6 @@ async def test_failover_reservation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reservation.FailoverReservationRequest() - assert args[0] == request_msg @@ -18895,7 +18921,6 @@ async def test_create_capacity_commitment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reservation.CreateCapacityCommitmentRequest() - assert args[0] == request_msg @@ -18924,7 +18949,6 @@ async def test_list_capacity_commitments_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reservation.ListCapacityCommitmentsRequest() - assert args[0] == request_msg @@ -18960,7 +18984,6 @@ async def test_get_capacity_commitment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reservation.GetCapacityCommitmentRequest() - assert args[0] == request_msg @@ -18985,7 +19008,6 @@ async def test_delete_capacity_commitment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reservation.DeleteCapacityCommitmentRequest() - assert args[0] == request_msg @@ -19021,7 +19043,6 @@ async def test_update_capacity_commitment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reservation.UpdateCapacityCommitmentRequest() - assert args[0] == request_msg @@ -19048,7 +19069,6 @@ async def test_split_capacity_commitment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reservation.SplitCapacityCommitmentRequest() - assert args[0] == request_msg @@ -19084,7 +19104,6 @@ async def test_merge_capacity_commitments_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reservation.MergeCapacityCommitmentsRequest() - assert args[0] == request_msg @@ -19118,7 +19137,6 @@ async def test_create_assignment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reservation.CreateAssignmentRequest() - assert args[0] == request_msg @@ -19145,7 +19163,6 @@ async def test_list_assignments_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reservation.ListAssignmentsRequest() - assert args[0] == request_msg @@ -19170,7 +19187,6 @@ async def test_delete_assignment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reservation.DeleteAssignmentRequest() - assert args[0] == request_msg @@ -19199,7 +19215,6 @@ async def test_search_assignments_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reservation.SearchAssignmentsRequest() - assert args[0] == request_msg @@ -19228,7 +19243,6 @@ async def test_search_all_assignments_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reservation.SearchAllAssignmentsRequest() - assert args[0] == request_msg @@ -19260,7 +19274,6 @@ async def test_move_assignment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reservation.MoveAssignmentRequest() - assert args[0] == request_msg @@ -19294,7 +19307,6 @@ async def test_update_assignment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reservation.UpdateAssignmentRequest() - assert args[0] == request_msg @@ -19324,7 +19336,6 @@ async def test_get_bi_reservation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reservation.GetBiReservationRequest() - assert args[0] == request_msg @@ -19354,7 +19365,6 @@ async def test_update_bi_reservation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reservation.UpdateBiReservationRequest() - assert args[0] == request_msg @@ -19382,7 +19392,6 @@ async def test_get_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -19410,7 +19419,6 @@ async def test_set_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -19439,7 +19447,6 @@ async def test_test_iam_permissions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -19468,7 +19475,6 @@ async def test_create_reservation_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reservation.CreateReservationGroupRequest() - assert args[0] == request_msg @@ -19497,7 +19503,6 @@ async def test_get_reservation_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reservation.GetReservationGroupRequest() - assert args[0] == request_msg @@ -19522,7 +19527,6 @@ async def test_delete_reservation_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reservation.DeleteReservationGroupRequest() - assert args[0] == request_msg @@ -19551,7 +19555,6 @@ async def test_list_reservation_groups_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reservation.ListReservationGroupsRequest() - assert args[0] == request_msg @@ -24291,7 +24294,6 @@ def test_create_reservation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcbr_reservation.CreateReservationRequest() - assert args[0] == request_msg @@ -24313,7 +24315,6 @@ def test_list_reservations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reservation.ListReservationsRequest() - assert args[0] == request_msg @@ -24333,7 +24334,6 @@ def test_get_reservation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reservation.GetReservationRequest() - assert args[0] == request_msg @@ -24355,7 +24355,6 @@ def test_delete_reservation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reservation.DeleteReservationRequest() - assert args[0] == request_msg @@ -24377,7 +24376,6 @@ def test_update_reservation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcbr_reservation.UpdateReservationRequest() - assert args[0] == request_msg @@ -24399,7 +24397,6 @@ def test_failover_reservation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reservation.FailoverReservationRequest() - assert args[0] == request_msg @@ -24421,7 +24418,6 @@ def test_create_capacity_commitment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reservation.CreateCapacityCommitmentRequest() - assert args[0] == request_msg @@ -24443,7 +24439,6 @@ def test_list_capacity_commitments_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reservation.ListCapacityCommitmentsRequest() - assert args[0] == request_msg @@ -24465,7 +24460,6 @@ def test_get_capacity_commitment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reservation.GetCapacityCommitmentRequest() - assert args[0] == request_msg @@ -24487,7 +24481,6 @@ def test_delete_capacity_commitment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reservation.DeleteCapacityCommitmentRequest() - assert args[0] == request_msg @@ -24509,7 +24502,6 @@ def test_update_capacity_commitment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reservation.UpdateCapacityCommitmentRequest() - assert args[0] == request_msg @@ -24531,7 +24523,6 @@ def test_split_capacity_commitment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reservation.SplitCapacityCommitmentRequest() - assert args[0] == request_msg @@ -24553,7 +24544,6 @@ def test_merge_capacity_commitments_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reservation.MergeCapacityCommitmentsRequest() - assert args[0] == request_msg @@ -24575,7 +24565,6 @@ def test_create_assignment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reservation.CreateAssignmentRequest() - assert args[0] == request_msg @@ -24595,7 +24584,6 @@ def test_list_assignments_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reservation.ListAssignmentsRequest() - assert args[0] == request_msg @@ -24617,7 +24605,6 @@ def test_delete_assignment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reservation.DeleteAssignmentRequest() - assert args[0] == request_msg @@ -24639,7 +24626,6 @@ def test_search_assignments_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reservation.SearchAssignmentsRequest() - assert args[0] == request_msg @@ -24661,7 +24647,6 @@ def test_search_all_assignments_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reservation.SearchAllAssignmentsRequest() - assert args[0] == request_msg @@ -24681,7 +24666,6 @@ def test_move_assignment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reservation.MoveAssignmentRequest() - assert args[0] == request_msg @@ -24703,7 +24687,6 @@ def test_update_assignment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reservation.UpdateAssignmentRequest() - assert args[0] == request_msg @@ -24725,7 +24708,6 @@ def test_get_bi_reservation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reservation.GetBiReservationRequest() - assert args[0] == request_msg @@ -24747,7 +24729,6 @@ def test_update_bi_reservation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reservation.UpdateBiReservationRequest() - assert args[0] == request_msg @@ -24767,7 +24748,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -24787,7 +24767,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -24809,7 +24788,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -24831,7 +24809,6 @@ def test_create_reservation_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reservation.CreateReservationGroupRequest() - assert args[0] == request_msg @@ -24853,7 +24830,6 @@ def test_get_reservation_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reservation.GetReservationGroupRequest() - assert args[0] == request_msg @@ -24875,7 +24851,6 @@ def test_delete_reservation_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reservation.DeleteReservationGroupRequest() - assert args[0] == request_msg @@ -24897,7 +24872,6 @@ def test_list_reservation_groups_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reservation.ListReservationGroupsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-bigquery-storage/noxfile.py b/packages/google-cloud-bigquery-storage/noxfile.py index 2623124988cd..e7c22b165e90 100644 --- a/packages/google-cloud-bigquery-storage/noxfile.py +++ b/packages/google-cloud-bigquery-storage/noxfile.py @@ -47,7 +47,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-bigquery-storage" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -508,14 +513,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -627,14 +624,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-bigquery-storage/setup.py b/packages/google-cloud-bigquery-storage/setup.py index 8a56f9f81b07..d3a6bc437845 100644 --- a/packages/google-cloud-bigquery-storage/setup.py +++ b/packages/google-cloud-bigquery-storage/setup.py @@ -45,7 +45,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/google-cloud-bigquery-storage/testing/constraints-3.10.txt b/packages/google-cloud-bigquery-storage/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-bigquery-storage/testing/constraints-3.10.txt +++ b/packages/google-cloud-bigquery-storage/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-bigquery-storage/tests/unit/gapic/bigquery_storage_v1/test_big_query_read.py b/packages/google-cloud-bigquery-storage/tests/unit/gapic/bigquery_storage_v1/test_big_query_read.py index e7b27793ac16..94777cf8d914 100644 --- a/packages/google-cloud-bigquery-storage/tests/unit/gapic/bigquery_storage_v1/test_big_query_read.py +++ b/packages/google-cloud-bigquery-storage/tests/unit/gapic/bigquery_storage_v1/test_big_query_read.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 @@ -104,6 +105,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" @@ -1270,8 +1286,8 @@ def test_big_query_read_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - storage.CreateReadSessionRequest, - dict, + storage.CreateReadSessionRequest(), + {}, ], ) def test_create_read_session(request_type, transport: str = "grpc"): @@ -1282,7 +1298,7 @@ def test_create_read_session(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1342,9 +1358,10 @@ def test_create_read_session_non_empty_request_with_auto_populated_field(): client.create_read_session(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == storage.CreateReadSessionRequest( + request_msg = storage.CreateReadSessionRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_read_session_use_cached_wrapped_rpc(): @@ -1429,9 +1446,14 @@ async def test_create_read_session_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_read_session_async( - transport: str = "grpc_asyncio", request_type=storage.CreateReadSessionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + storage.CreateReadSessionRequest(), + {}, + ], +) +async def test_create_read_session_async(request_type, transport: str = "grpc_asyncio"): client = BigQueryReadAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1439,7 +1461,7 @@ async def test_create_read_session_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( @@ -1476,11 +1498,6 @@ async def test_create_read_session_async( assert response.trace_id == "trace_id_value" -@pytest.mark.asyncio -async def test_create_read_session_async_from_dict(): - await test_create_read_session_async(request_type=dict) - - def test_create_read_session_field_headers(): client = BigQueryReadClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1651,8 +1668,8 @@ async def test_create_read_session_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - storage.ReadRowsRequest, - dict, + storage.ReadRowsRequest(), + {}, ], ) def test_read_rows(request_type, transport: str = "grpc"): @@ -1663,7 +1680,7 @@ def test_read_rows(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.read_rows), "__call__") as call: @@ -1705,9 +1722,10 @@ def test_read_rows_non_empty_request_with_auto_populated_field(): client.read_rows(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == storage.ReadRowsRequest( + request_msg = storage.ReadRowsRequest( read_stream="read_stream_value", ) + assert args[0] == request_msg def test_read_rows_use_cached_wrapped_rpc(): @@ -1786,9 +1804,14 @@ async def test_read_rows_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_read_rows_async( - transport: str = "grpc_asyncio", request_type=storage.ReadRowsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + storage.ReadRowsRequest(), + {}, + ], +) +async def test_read_rows_async(request_type, transport: str = "grpc_asyncio"): client = BigQueryReadAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1796,7 +1819,7 @@ async def test_read_rows_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.read_rows), "__call__") as call: @@ -1818,11 +1841,6 @@ async def test_read_rows_async( assert isinstance(message, storage.ReadRowsResponse) -@pytest.mark.asyncio -async def test_read_rows_async_from_dict(): - await test_read_rows_async(request_type=dict) - - def test_read_rows_field_headers(): client = BigQueryReadClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1978,8 +1996,8 @@ async def test_read_rows_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - storage.SplitReadStreamRequest, - dict, + storage.SplitReadStreamRequest(), + {}, ], ) def test_split_read_stream(request_type, transport: str = "grpc"): @@ -1990,7 +2008,7 @@ def test_split_read_stream(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2035,9 +2053,10 @@ def test_split_read_stream_non_empty_request_with_auto_populated_field(): client.split_read_stream(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == storage.SplitReadStreamRequest( + request_msg = storage.SplitReadStreamRequest( name="name_value", ) + assert args[0] == request_msg def test_split_read_stream_use_cached_wrapped_rpc(): @@ -2120,9 +2139,14 @@ async def test_split_read_stream_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_split_read_stream_async( - transport: str = "grpc_asyncio", request_type=storage.SplitReadStreamRequest -): +@pytest.mark.parametrize( + "request_type", + [ + storage.SplitReadStreamRequest(), + {}, + ], +) +async def test_split_read_stream_async(request_type, transport: str = "grpc_asyncio"): client = BigQueryReadAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2130,7 +2154,7 @@ async def test_split_read_stream_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( @@ -2152,11 +2176,6 @@ async def test_split_read_stream_async( assert isinstance(response, storage.SplitReadStreamResponse) -@pytest.mark.asyncio -async def test_split_read_stream_async_from_dict(): - await test_split_read_stream_async(request_type=dict) - - def test_split_read_stream_field_headers(): client = BigQueryReadClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2346,7 +2365,6 @@ def test_create_read_session_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage.CreateReadSessionRequest() - assert args[0] == request_msg @@ -2367,7 +2385,6 @@ def test_read_rows_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage.ReadRowsRequest() - assert args[0] == request_msg @@ -2390,7 +2407,6 @@ def test_split_read_stream_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage.SplitReadStreamRequest() - assert args[0] == request_msg @@ -2439,7 +2455,6 @@ async def test_create_read_session_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage.CreateReadSessionRequest() - assert args[0] == request_msg @@ -2465,7 +2480,6 @@ async def test_read_rows_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage.ReadRowsRequest() - assert args[0] == request_msg @@ -2492,7 +2506,6 @@ async def test_split_read_stream_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage.SplitReadStreamRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-bigquery-storage/tests/unit/gapic/bigquery_storage_v1/test_big_query_write.py b/packages/google-cloud-bigquery-storage/tests/unit/gapic/bigquery_storage_v1/test_big_query_write.py index f3d15d409dd9..c31a0503eb4f 100644 --- a/packages/google-cloud-bigquery-storage/tests/unit/gapic/bigquery_storage_v1/test_big_query_write.py +++ b/packages/google-cloud-bigquery-storage/tests/unit/gapic/bigquery_storage_v1/test_big_query_write.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 @@ -113,6 +114,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" @@ -1299,8 +1315,8 @@ def test_big_query_write_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - storage.CreateWriteStreamRequest, - dict, + storage.CreateWriteStreamRequest(), + {}, ], ) def test_create_write_stream(request_type, transport: str = "grpc"): @@ -1311,7 +1327,7 @@ def test_create_write_stream(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1365,9 +1381,10 @@ def test_create_write_stream_non_empty_request_with_auto_populated_field(): client.create_write_stream(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == storage.CreateWriteStreamRequest( + request_msg = storage.CreateWriteStreamRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_write_stream_use_cached_wrapped_rpc(): @@ -1452,9 +1469,14 @@ async def test_create_write_stream_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_write_stream_async( - transport: str = "grpc_asyncio", request_type=storage.CreateWriteStreamRequest -): +@pytest.mark.parametrize( + "request_type", + [ + storage.CreateWriteStreamRequest(), + {}, + ], +) +async def test_create_write_stream_async(request_type, transport: str = "grpc_asyncio"): client = BigQueryWriteAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1462,7 +1484,7 @@ async def test_create_write_stream_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( @@ -1493,11 +1515,6 @@ async def test_create_write_stream_async( assert response.location == "location_value" -@pytest.mark.asyncio -async def test_create_write_stream_async_from_dict(): - await test_create_write_stream_async(request_type=dict) - - def test_create_write_stream_field_headers(): client = BigQueryWriteClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1658,8 +1675,8 @@ async def test_create_write_stream_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - storage.AppendRowsRequest, - dict, + storage.AppendRowsRequest(), + {}, ], ) def test_append_rows(request_type, transport: str = "grpc"): @@ -1670,7 +1687,7 @@ def test_append_rows(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as 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. @@ -1767,9 +1784,14 @@ async def test_append_rows_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_append_rows_async( - transport: str = "grpc_asyncio", request_type=storage.AppendRowsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + storage.AppendRowsRequest(), + {}, + ], +) +async def test_append_rows_async(request_type, transport: str = "grpc_asyncio"): client = BigQueryWriteAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1777,7 +1799,7 @@ async def test_append_rows_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. @@ -1799,16 +1821,11 @@ async def test_append_rows_async( assert isinstance(message, storage.AppendRowsResponse) -@pytest.mark.asyncio -async def test_append_rows_async_from_dict(): - await test_append_rows_async(request_type=dict) - - @pytest.mark.parametrize( "request_type", [ - storage.GetWriteStreamRequest, - dict, + storage.GetWriteStreamRequest(), + {}, ], ) def test_get_write_stream(request_type, transport: str = "grpc"): @@ -1819,7 +1836,7 @@ def test_get_write_stream(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_write_stream), "__call__") as call: @@ -1869,9 +1886,10 @@ def test_get_write_stream_non_empty_request_with_auto_populated_field(): client.get_write_stream(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == storage.GetWriteStreamRequest( + request_msg = storage.GetWriteStreamRequest( name="name_value", ) + assert args[0] == request_msg def test_get_write_stream_use_cached_wrapped_rpc(): @@ -1954,9 +1972,14 @@ async def test_get_write_stream_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_write_stream_async( - transport: str = "grpc_asyncio", request_type=storage.GetWriteStreamRequest -): +@pytest.mark.parametrize( + "request_type", + [ + storage.GetWriteStreamRequest(), + {}, + ], +) +async def test_get_write_stream_async(request_type, transport: str = "grpc_asyncio"): client = BigQueryWriteAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1964,7 +1987,7 @@ async def test_get_write_stream_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_write_stream), "__call__") as call: @@ -1993,11 +2016,6 @@ async def test_get_write_stream_async( assert response.location == "location_value" -@pytest.mark.asyncio -async def test_get_write_stream_async_from_dict(): - await test_get_write_stream_async(request_type=dict) - - def test_get_write_stream_field_headers(): client = BigQueryWriteClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2140,8 +2158,8 @@ async def test_get_write_stream_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - storage.FinalizeWriteStreamRequest, - dict, + storage.FinalizeWriteStreamRequest(), + {}, ], ) def test_finalize_write_stream(request_type, transport: str = "grpc"): @@ -2152,7 +2170,7 @@ def test_finalize_write_stream(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2200,9 +2218,10 @@ def test_finalize_write_stream_non_empty_request_with_auto_populated_field(): client.finalize_write_stream(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == storage.FinalizeWriteStreamRequest( + request_msg = storage.FinalizeWriteStreamRequest( name="name_value", ) + assert args[0] == request_msg def test_finalize_write_stream_use_cached_wrapped_rpc(): @@ -2288,8 +2307,15 @@ async def test_finalize_write_stream_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + storage.FinalizeWriteStreamRequest(), + {}, + ], +) async def test_finalize_write_stream_async( - transport: str = "grpc_asyncio", request_type=storage.FinalizeWriteStreamRequest + request_type, transport: str = "grpc_asyncio" ): client = BigQueryWriteAsyncClient( credentials=async_anonymous_credentials(), @@ -2298,7 +2324,7 @@ async def test_finalize_write_stream_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( @@ -2323,11 +2349,6 @@ async def test_finalize_write_stream_async( assert response.row_count == 992 -@pytest.mark.asyncio -async def test_finalize_write_stream_async_from_dict(): - await test_finalize_write_stream_async(request_type=dict) - - def test_finalize_write_stream_field_headers(): client = BigQueryWriteClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2482,8 +2503,8 @@ async def test_finalize_write_stream_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - storage.BatchCommitWriteStreamsRequest, - dict, + storage.BatchCommitWriteStreamsRequest(), + {}, ], ) def test_batch_commit_write_streams(request_type, transport: str = "grpc"): @@ -2494,7 +2515,7 @@ def test_batch_commit_write_streams(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2539,9 +2560,10 @@ def test_batch_commit_write_streams_non_empty_request_with_auto_populated_field( client.batch_commit_write_streams(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == storage.BatchCommitWriteStreamsRequest( + request_msg = storage.BatchCommitWriteStreamsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_batch_commit_write_streams_use_cached_wrapped_rpc(): @@ -2627,8 +2649,15 @@ async def test_batch_commit_write_streams_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + storage.BatchCommitWriteStreamsRequest(), + {}, + ], +) async def test_batch_commit_write_streams_async( - transport: str = "grpc_asyncio", request_type=storage.BatchCommitWriteStreamsRequest + request_type, transport: str = "grpc_asyncio" ): client = BigQueryWriteAsyncClient( credentials=async_anonymous_credentials(), @@ -2637,7 +2666,7 @@ async def test_batch_commit_write_streams_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( @@ -2659,11 +2688,6 @@ async def test_batch_commit_write_streams_async( assert isinstance(response, storage.BatchCommitWriteStreamsResponse) -@pytest.mark.asyncio -async def test_batch_commit_write_streams_async_from_dict(): - await test_batch_commit_write_streams_async(request_type=dict) - - def test_batch_commit_write_streams_field_headers(): client = BigQueryWriteClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2818,8 +2842,8 @@ async def test_batch_commit_write_streams_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - storage.FlushRowsRequest, - dict, + storage.FlushRowsRequest(), + {}, ], ) def test_flush_rows(request_type, transport: str = "grpc"): @@ -2830,7 +2854,7 @@ def test_flush_rows(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.flush_rows), "__call__") as call: @@ -2874,9 +2898,10 @@ def test_flush_rows_non_empty_request_with_auto_populated_field(): client.flush_rows(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == storage.FlushRowsRequest( + request_msg = storage.FlushRowsRequest( write_stream="write_stream_value", ) + assert args[0] == request_msg def test_flush_rows_use_cached_wrapped_rpc(): @@ -2955,9 +2980,14 @@ async def test_flush_rows_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_flush_rows_async( - transport: str = "grpc_asyncio", request_type=storage.FlushRowsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + storage.FlushRowsRequest(), + {}, + ], +) +async def test_flush_rows_async(request_type, transport: str = "grpc_asyncio"): client = BigQueryWriteAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2965,7 +2995,7 @@ async def test_flush_rows_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.flush_rows), "__call__") as call: @@ -2988,11 +3018,6 @@ async def test_flush_rows_async( assert response.offset == 647 -@pytest.mark.asyncio -async def test_flush_rows_async_from_dict(): - await test_flush_rows_async(request_type=dict) - - def test_flush_rows_field_headers(): client = BigQueryWriteClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3260,7 +3285,6 @@ def test_create_write_stream_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage.CreateWriteStreamRequest() - assert args[0] == request_msg @@ -3281,7 +3305,6 @@ def test_get_write_stream_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage.GetWriteStreamRequest() - assert args[0] == request_msg @@ -3304,7 +3327,6 @@ def test_finalize_write_stream_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage.FinalizeWriteStreamRequest() - assert args[0] == request_msg @@ -3327,7 +3349,6 @@ def test_batch_commit_write_streams_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage.BatchCommitWriteStreamsRequest() - assert args[0] == request_msg @@ -3348,7 +3369,6 @@ def test_flush_rows_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage.FlushRowsRequest() - assert args[0] == request_msg @@ -3394,7 +3414,6 @@ async def test_create_write_stream_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage.CreateWriteStreamRequest() - assert args[0] == request_msg @@ -3424,7 +3443,6 @@ async def test_get_write_stream_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage.GetWriteStreamRequest() - assert args[0] == request_msg @@ -3453,7 +3471,6 @@ async def test_finalize_write_stream_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage.FinalizeWriteStreamRequest() - assert args[0] == request_msg @@ -3480,7 +3497,6 @@ async def test_batch_commit_write_streams_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage.BatchCommitWriteStreamsRequest() - assert args[0] == request_msg @@ -3507,7 +3523,6 @@ async def test_flush_rows_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage.FlushRowsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-bigquery-storage/tests/unit/gapic/bigquery_storage_v1alpha/test_metastore_partition_service.py b/packages/google-cloud-bigquery-storage/tests/unit/gapic/bigquery_storage_v1alpha/test_metastore_partition_service.py index 3895db3cfa92..18b3097543d5 100644 --- a/packages/google-cloud-bigquery-storage/tests/unit/gapic/bigquery_storage_v1alpha/test_metastore_partition_service.py +++ b/packages/google-cloud-bigquery-storage/tests/unit/gapic/bigquery_storage_v1alpha/test_metastore_partition_service.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 @@ -105,6 +106,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" @@ -1350,8 +1366,8 @@ def test_metastore_partition_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - metastore_partition.BatchCreateMetastorePartitionsRequest, - dict, + metastore_partition.BatchCreateMetastorePartitionsRequest(), + {}, ], ) def test_batch_create_metastore_partitions(request_type, transport: str = "grpc"): @@ -1362,7 +1378,7 @@ def test_batch_create_metastore_partitions(request_type, transport: str = "grpc" # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1410,10 +1426,11 @@ def test_batch_create_metastore_partitions_non_empty_request_with_auto_populated client.batch_create_metastore_partitions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore_partition.BatchCreateMetastorePartitionsRequest( + request_msg = metastore_partition.BatchCreateMetastorePartitionsRequest( parent="parent_value", trace_id="trace_id_value", ) + assert args[0] == request_msg def test_batch_create_metastore_partitions_use_cached_wrapped_rpc(): @@ -1499,9 +1516,15 @@ async def test_batch_create_metastore_partitions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + metastore_partition.BatchCreateMetastorePartitionsRequest(), + {}, + ], +) async def test_batch_create_metastore_partitions_async( - transport: str = "grpc_asyncio", - request_type=metastore_partition.BatchCreateMetastorePartitionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = MetastorePartitionServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1510,7 +1533,7 @@ async def test_batch_create_metastore_partitions_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( @@ -1534,11 +1557,6 @@ async def test_batch_create_metastore_partitions_async( ) -@pytest.mark.asyncio -async def test_batch_create_metastore_partitions_async_from_dict(): - await test_batch_create_metastore_partitions_async(request_type=dict) - - def test_batch_create_metastore_partitions_field_headers(): client = MetastorePartitionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1607,8 +1625,8 @@ async def test_batch_create_metastore_partitions_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - metastore_partition.BatchDeleteMetastorePartitionsRequest, - dict, + metastore_partition.BatchDeleteMetastorePartitionsRequest(), + {}, ], ) def test_batch_delete_metastore_partitions(request_type, transport: str = "grpc"): @@ -1619,7 +1637,7 @@ def test_batch_delete_metastore_partitions(request_type, transport: str = "grpc" # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1665,10 +1683,11 @@ def test_batch_delete_metastore_partitions_non_empty_request_with_auto_populated client.batch_delete_metastore_partitions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore_partition.BatchDeleteMetastorePartitionsRequest( + request_msg = metastore_partition.BatchDeleteMetastorePartitionsRequest( parent="parent_value", trace_id="trace_id_value", ) + assert args[0] == request_msg def test_batch_delete_metastore_partitions_use_cached_wrapped_rpc(): @@ -1754,9 +1773,15 @@ async def test_batch_delete_metastore_partitions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + metastore_partition.BatchDeleteMetastorePartitionsRequest(), + {}, + ], +) async def test_batch_delete_metastore_partitions_async( - transport: str = "grpc_asyncio", - request_type=metastore_partition.BatchDeleteMetastorePartitionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = MetastorePartitionServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1765,7 +1790,7 @@ async def test_batch_delete_metastore_partitions_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( @@ -1785,11 +1810,6 @@ async def test_batch_delete_metastore_partitions_async( assert response is None -@pytest.mark.asyncio -async def test_batch_delete_metastore_partitions_async_from_dict(): - await test_batch_delete_metastore_partitions_async(request_type=dict) - - def test_batch_delete_metastore_partitions_field_headers(): client = MetastorePartitionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1856,8 +1876,8 @@ async def test_batch_delete_metastore_partitions_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - metastore_partition.BatchUpdateMetastorePartitionsRequest, - dict, + metastore_partition.BatchUpdateMetastorePartitionsRequest(), + {}, ], ) def test_batch_update_metastore_partitions(request_type, transport: str = "grpc"): @@ -1868,7 +1888,7 @@ def test_batch_update_metastore_partitions(request_type, transport: str = "grpc" # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1916,10 +1936,11 @@ def test_batch_update_metastore_partitions_non_empty_request_with_auto_populated client.batch_update_metastore_partitions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore_partition.BatchUpdateMetastorePartitionsRequest( + request_msg = metastore_partition.BatchUpdateMetastorePartitionsRequest( parent="parent_value", trace_id="trace_id_value", ) + assert args[0] == request_msg def test_batch_update_metastore_partitions_use_cached_wrapped_rpc(): @@ -2005,9 +2026,15 @@ async def test_batch_update_metastore_partitions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + metastore_partition.BatchUpdateMetastorePartitionsRequest(), + {}, + ], +) async def test_batch_update_metastore_partitions_async( - transport: str = "grpc_asyncio", - request_type=metastore_partition.BatchUpdateMetastorePartitionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = MetastorePartitionServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2016,7 +2043,7 @@ async def test_batch_update_metastore_partitions_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( @@ -2040,11 +2067,6 @@ async def test_batch_update_metastore_partitions_async( ) -@pytest.mark.asyncio -async def test_batch_update_metastore_partitions_async_from_dict(): - await test_batch_update_metastore_partitions_async(request_type=dict) - - def test_batch_update_metastore_partitions_field_headers(): client = MetastorePartitionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2113,8 +2135,8 @@ async def test_batch_update_metastore_partitions_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - metastore_partition.ListMetastorePartitionsRequest, - dict, + metastore_partition.ListMetastorePartitionsRequest(), + {}, ], ) def test_list_metastore_partitions(request_type, transport: str = "grpc"): @@ -2125,7 +2147,7 @@ def test_list_metastore_partitions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2172,11 +2194,12 @@ def test_list_metastore_partitions_non_empty_request_with_auto_populated_field() client.list_metastore_partitions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore_partition.ListMetastorePartitionsRequest( + request_msg = metastore_partition.ListMetastorePartitionsRequest( parent="parent_value", filter="filter_value", trace_id="trace_id_value", ) + assert args[0] == request_msg def test_list_metastore_partitions_use_cached_wrapped_rpc(): @@ -2262,9 +2285,15 @@ async def test_list_metastore_partitions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + metastore_partition.ListMetastorePartitionsRequest(), + {}, + ], +) async def test_list_metastore_partitions_async( - transport: str = "grpc_asyncio", - request_type=metastore_partition.ListMetastorePartitionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = MetastorePartitionServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2273,7 +2302,7 @@ async def test_list_metastore_partitions_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( @@ -2295,11 +2324,6 @@ async def test_list_metastore_partitions_async( assert isinstance(response, metastore_partition.ListMetastorePartitionsResponse) -@pytest.mark.asyncio -async def test_list_metastore_partitions_async_from_dict(): - await test_list_metastore_partitions_async(request_type=dict) - - def test_list_metastore_partitions_field_headers(): client = MetastorePartitionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2454,8 +2478,8 @@ async def test_list_metastore_partitions_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metastore_partition.StreamMetastorePartitionsRequest, - dict, + metastore_partition.StreamMetastorePartitionsRequest(), + {}, ], ) def test_stream_metastore_partitions(request_type, transport: str = "grpc"): @@ -2466,7 +2490,7 @@ def test_stream_metastore_partitions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as 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. @@ -2574,9 +2598,15 @@ async def test_stream_metastore_partitions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + metastore_partition.StreamMetastorePartitionsRequest(), + {}, + ], +) async def test_stream_metastore_partitions_async( - transport: str = "grpc_asyncio", - request_type=metastore_partition.StreamMetastorePartitionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = MetastorePartitionServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2585,7 +2615,7 @@ async def test_stream_metastore_partitions_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. @@ -2609,11 +2639,6 @@ async def test_stream_metastore_partitions_async( assert isinstance(message, metastore_partition.StreamMetastorePartitionsResponse) -@pytest.mark.asyncio -async def test_stream_metastore_partitions_async_from_dict(): - await test_stream_metastore_partitions_async(request_type=dict) - - def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.MetastorePartitionServiceGrpcTransport( @@ -2738,7 +2763,6 @@ def test_batch_create_metastore_partitions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore_partition.BatchCreateMetastorePartitionsRequest() - assert args[0] == request_msg @@ -2761,7 +2785,6 @@ def test_batch_delete_metastore_partitions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore_partition.BatchDeleteMetastorePartitionsRequest() - assert args[0] == request_msg @@ -2784,7 +2807,6 @@ def test_batch_update_metastore_partitions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore_partition.BatchUpdateMetastorePartitionsRequest() - assert args[0] == request_msg @@ -2807,7 +2829,6 @@ def test_list_metastore_partitions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore_partition.ListMetastorePartitionsRequest() - assert args[0] == request_msg @@ -2848,7 +2869,6 @@ async def test_batch_create_metastore_partitions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore_partition.BatchCreateMetastorePartitionsRequest() - assert args[0] == request_msg @@ -2873,7 +2893,6 @@ async def test_batch_delete_metastore_partitions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore_partition.BatchDeleteMetastorePartitionsRequest() - assert args[0] == request_msg @@ -2900,7 +2919,6 @@ async def test_batch_update_metastore_partitions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore_partition.BatchUpdateMetastorePartitionsRequest() - assert args[0] == request_msg @@ -2927,7 +2945,6 @@ async def test_list_metastore_partitions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore_partition.ListMetastorePartitionsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-bigquery-storage/tests/unit/gapic/bigquery_storage_v1beta/test_metastore_partition_service.py b/packages/google-cloud-bigquery-storage/tests/unit/gapic/bigquery_storage_v1beta/test_metastore_partition_service.py index d8c0cc6af9d6..114a0e1ea507 100644 --- a/packages/google-cloud-bigquery-storage/tests/unit/gapic/bigquery_storage_v1beta/test_metastore_partition_service.py +++ b/packages/google-cloud-bigquery-storage/tests/unit/gapic/bigquery_storage_v1beta/test_metastore_partition_service.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 @@ -105,6 +106,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" @@ -1350,8 +1366,8 @@ def test_metastore_partition_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - metastore_partition.BatchCreateMetastorePartitionsRequest, - dict, + metastore_partition.BatchCreateMetastorePartitionsRequest(), + {}, ], ) def test_batch_create_metastore_partitions(request_type, transport: str = "grpc"): @@ -1362,7 +1378,7 @@ def test_batch_create_metastore_partitions(request_type, transport: str = "grpc" # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1410,10 +1426,11 @@ def test_batch_create_metastore_partitions_non_empty_request_with_auto_populated client.batch_create_metastore_partitions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore_partition.BatchCreateMetastorePartitionsRequest( + request_msg = metastore_partition.BatchCreateMetastorePartitionsRequest( parent="parent_value", trace_id="trace_id_value", ) + assert args[0] == request_msg def test_batch_create_metastore_partitions_use_cached_wrapped_rpc(): @@ -1499,9 +1516,15 @@ async def test_batch_create_metastore_partitions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + metastore_partition.BatchCreateMetastorePartitionsRequest(), + {}, + ], +) async def test_batch_create_metastore_partitions_async( - transport: str = "grpc_asyncio", - request_type=metastore_partition.BatchCreateMetastorePartitionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = MetastorePartitionServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1510,7 +1533,7 @@ async def test_batch_create_metastore_partitions_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( @@ -1534,11 +1557,6 @@ async def test_batch_create_metastore_partitions_async( ) -@pytest.mark.asyncio -async def test_batch_create_metastore_partitions_async_from_dict(): - await test_batch_create_metastore_partitions_async(request_type=dict) - - def test_batch_create_metastore_partitions_field_headers(): client = MetastorePartitionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1607,8 +1625,8 @@ async def test_batch_create_metastore_partitions_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - metastore_partition.BatchDeleteMetastorePartitionsRequest, - dict, + metastore_partition.BatchDeleteMetastorePartitionsRequest(), + {}, ], ) def test_batch_delete_metastore_partitions(request_type, transport: str = "grpc"): @@ -1619,7 +1637,7 @@ def test_batch_delete_metastore_partitions(request_type, transport: str = "grpc" # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1665,10 +1683,11 @@ def test_batch_delete_metastore_partitions_non_empty_request_with_auto_populated client.batch_delete_metastore_partitions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore_partition.BatchDeleteMetastorePartitionsRequest( + request_msg = metastore_partition.BatchDeleteMetastorePartitionsRequest( parent="parent_value", trace_id="trace_id_value", ) + assert args[0] == request_msg def test_batch_delete_metastore_partitions_use_cached_wrapped_rpc(): @@ -1754,9 +1773,15 @@ async def test_batch_delete_metastore_partitions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + metastore_partition.BatchDeleteMetastorePartitionsRequest(), + {}, + ], +) async def test_batch_delete_metastore_partitions_async( - transport: str = "grpc_asyncio", - request_type=metastore_partition.BatchDeleteMetastorePartitionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = MetastorePartitionServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1765,7 +1790,7 @@ async def test_batch_delete_metastore_partitions_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( @@ -1785,11 +1810,6 @@ async def test_batch_delete_metastore_partitions_async( assert response is None -@pytest.mark.asyncio -async def test_batch_delete_metastore_partitions_async_from_dict(): - await test_batch_delete_metastore_partitions_async(request_type=dict) - - def test_batch_delete_metastore_partitions_field_headers(): client = MetastorePartitionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1856,8 +1876,8 @@ async def test_batch_delete_metastore_partitions_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - metastore_partition.BatchUpdateMetastorePartitionsRequest, - dict, + metastore_partition.BatchUpdateMetastorePartitionsRequest(), + {}, ], ) def test_batch_update_metastore_partitions(request_type, transport: str = "grpc"): @@ -1868,7 +1888,7 @@ def test_batch_update_metastore_partitions(request_type, transport: str = "grpc" # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1916,10 +1936,11 @@ def test_batch_update_metastore_partitions_non_empty_request_with_auto_populated client.batch_update_metastore_partitions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore_partition.BatchUpdateMetastorePartitionsRequest( + request_msg = metastore_partition.BatchUpdateMetastorePartitionsRequest( parent="parent_value", trace_id="trace_id_value", ) + assert args[0] == request_msg def test_batch_update_metastore_partitions_use_cached_wrapped_rpc(): @@ -2005,9 +2026,15 @@ async def test_batch_update_metastore_partitions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + metastore_partition.BatchUpdateMetastorePartitionsRequest(), + {}, + ], +) async def test_batch_update_metastore_partitions_async( - transport: str = "grpc_asyncio", - request_type=metastore_partition.BatchUpdateMetastorePartitionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = MetastorePartitionServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2016,7 +2043,7 @@ async def test_batch_update_metastore_partitions_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( @@ -2040,11 +2067,6 @@ async def test_batch_update_metastore_partitions_async( ) -@pytest.mark.asyncio -async def test_batch_update_metastore_partitions_async_from_dict(): - await test_batch_update_metastore_partitions_async(request_type=dict) - - def test_batch_update_metastore_partitions_field_headers(): client = MetastorePartitionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2113,8 +2135,8 @@ async def test_batch_update_metastore_partitions_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - metastore_partition.ListMetastorePartitionsRequest, - dict, + metastore_partition.ListMetastorePartitionsRequest(), + {}, ], ) def test_list_metastore_partitions(request_type, transport: str = "grpc"): @@ -2125,7 +2147,7 @@ def test_list_metastore_partitions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2172,11 +2194,12 @@ def test_list_metastore_partitions_non_empty_request_with_auto_populated_field() client.list_metastore_partitions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore_partition.ListMetastorePartitionsRequest( + request_msg = metastore_partition.ListMetastorePartitionsRequest( parent="parent_value", filter="filter_value", trace_id="trace_id_value", ) + assert args[0] == request_msg def test_list_metastore_partitions_use_cached_wrapped_rpc(): @@ -2262,9 +2285,15 @@ async def test_list_metastore_partitions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + metastore_partition.ListMetastorePartitionsRequest(), + {}, + ], +) async def test_list_metastore_partitions_async( - transport: str = "grpc_asyncio", - request_type=metastore_partition.ListMetastorePartitionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = MetastorePartitionServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2273,7 +2302,7 @@ async def test_list_metastore_partitions_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( @@ -2295,11 +2324,6 @@ async def test_list_metastore_partitions_async( assert isinstance(response, metastore_partition.ListMetastorePartitionsResponse) -@pytest.mark.asyncio -async def test_list_metastore_partitions_async_from_dict(): - await test_list_metastore_partitions_async(request_type=dict) - - def test_list_metastore_partitions_field_headers(): client = MetastorePartitionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2454,8 +2478,8 @@ async def test_list_metastore_partitions_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metastore_partition.StreamMetastorePartitionsRequest, - dict, + metastore_partition.StreamMetastorePartitionsRequest(), + {}, ], ) def test_stream_metastore_partitions(request_type, transport: str = "grpc"): @@ -2466,7 +2490,7 @@ def test_stream_metastore_partitions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as 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. @@ -2574,9 +2598,15 @@ async def test_stream_metastore_partitions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + metastore_partition.StreamMetastorePartitionsRequest(), + {}, + ], +) async def test_stream_metastore_partitions_async( - transport: str = "grpc_asyncio", - request_type=metastore_partition.StreamMetastorePartitionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = MetastorePartitionServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2585,7 +2615,7 @@ async def test_stream_metastore_partitions_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. @@ -2609,11 +2639,6 @@ async def test_stream_metastore_partitions_async( assert isinstance(message, metastore_partition.StreamMetastorePartitionsResponse) -@pytest.mark.asyncio -async def test_stream_metastore_partitions_async_from_dict(): - await test_stream_metastore_partitions_async(request_type=dict) - - def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.MetastorePartitionServiceGrpcTransport( @@ -2738,7 +2763,6 @@ def test_batch_create_metastore_partitions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore_partition.BatchCreateMetastorePartitionsRequest() - assert args[0] == request_msg @@ -2761,7 +2785,6 @@ def test_batch_delete_metastore_partitions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore_partition.BatchDeleteMetastorePartitionsRequest() - assert args[0] == request_msg @@ -2784,7 +2807,6 @@ def test_batch_update_metastore_partitions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore_partition.BatchUpdateMetastorePartitionsRequest() - assert args[0] == request_msg @@ -2807,7 +2829,6 @@ def test_list_metastore_partitions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore_partition.ListMetastorePartitionsRequest() - assert args[0] == request_msg @@ -2848,7 +2869,6 @@ async def test_batch_create_metastore_partitions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore_partition.BatchCreateMetastorePartitionsRequest() - assert args[0] == request_msg @@ -2873,7 +2893,6 @@ async def test_batch_delete_metastore_partitions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore_partition.BatchDeleteMetastorePartitionsRequest() - assert args[0] == request_msg @@ -2900,7 +2919,6 @@ async def test_batch_update_metastore_partitions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore_partition.BatchUpdateMetastorePartitionsRequest() - assert args[0] == request_msg @@ -2927,7 +2945,6 @@ async def test_list_metastore_partitions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore_partition.ListMetastorePartitionsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-bigquery-storage/tests/unit/gapic/bigquery_storage_v1beta2/test_big_query_read.py b/packages/google-cloud-bigquery-storage/tests/unit/gapic/bigquery_storage_v1beta2/test_big_query_read.py index 5a4b99a47dc6..329d06f67d7b 100644 --- a/packages/google-cloud-bigquery-storage/tests/unit/gapic/bigquery_storage_v1beta2/test_big_query_read.py +++ b/packages/google-cloud-bigquery-storage/tests/unit/gapic/bigquery_storage_v1beta2/test_big_query_read.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 @@ -104,6 +105,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" @@ -1270,8 +1286,8 @@ def test_big_query_read_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - storage.CreateReadSessionRequest, - dict, + storage.CreateReadSessionRequest(), + {}, ], ) def test_create_read_session(request_type, transport: str = "grpc"): @@ -1282,7 +1298,7 @@ def test_create_read_session(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1334,9 +1350,10 @@ def test_create_read_session_non_empty_request_with_auto_populated_field(): client.create_read_session(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == storage.CreateReadSessionRequest( + request_msg = storage.CreateReadSessionRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_read_session_use_cached_wrapped_rpc(): @@ -1421,9 +1438,14 @@ async def test_create_read_session_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_read_session_async( - transport: str = "grpc_asyncio", request_type=storage.CreateReadSessionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + storage.CreateReadSessionRequest(), + {}, + ], +) +async def test_create_read_session_async(request_type, transport: str = "grpc_asyncio"): client = BigQueryReadAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1431,7 +1453,7 @@ async def test_create_read_session_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( @@ -1460,11 +1482,6 @@ async def test_create_read_session_async( assert response.table == "table_value" -@pytest.mark.asyncio -async def test_create_read_session_async_from_dict(): - await test_create_read_session_async(request_type=dict) - - def test_create_read_session_field_headers(): client = BigQueryReadClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1635,8 +1652,8 @@ async def test_create_read_session_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - storage.ReadRowsRequest, - dict, + storage.ReadRowsRequest(), + {}, ], ) def test_read_rows(request_type, transport: str = "grpc"): @@ -1647,7 +1664,7 @@ def test_read_rows(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.read_rows), "__call__") as call: @@ -1689,9 +1706,10 @@ def test_read_rows_non_empty_request_with_auto_populated_field(): client.read_rows(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == storage.ReadRowsRequest( + request_msg = storage.ReadRowsRequest( read_stream="read_stream_value", ) + assert args[0] == request_msg def test_read_rows_use_cached_wrapped_rpc(): @@ -1770,9 +1788,14 @@ async def test_read_rows_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_read_rows_async( - transport: str = "grpc_asyncio", request_type=storage.ReadRowsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + storage.ReadRowsRequest(), + {}, + ], +) +async def test_read_rows_async(request_type, transport: str = "grpc_asyncio"): client = BigQueryReadAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1780,7 +1803,7 @@ async def test_read_rows_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.read_rows), "__call__") as call: @@ -1802,11 +1825,6 @@ async def test_read_rows_async( assert isinstance(message, storage.ReadRowsResponse) -@pytest.mark.asyncio -async def test_read_rows_async_from_dict(): - await test_read_rows_async(request_type=dict) - - def test_read_rows_field_headers(): client = BigQueryReadClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1962,8 +1980,8 @@ async def test_read_rows_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - storage.SplitReadStreamRequest, - dict, + storage.SplitReadStreamRequest(), + {}, ], ) def test_split_read_stream(request_type, transport: str = "grpc"): @@ -1974,7 +1992,7 @@ def test_split_read_stream(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2019,9 +2037,10 @@ def test_split_read_stream_non_empty_request_with_auto_populated_field(): client.split_read_stream(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == storage.SplitReadStreamRequest( + request_msg = storage.SplitReadStreamRequest( name="name_value", ) + assert args[0] == request_msg def test_split_read_stream_use_cached_wrapped_rpc(): @@ -2104,9 +2123,14 @@ async def test_split_read_stream_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_split_read_stream_async( - transport: str = "grpc_asyncio", request_type=storage.SplitReadStreamRequest -): +@pytest.mark.parametrize( + "request_type", + [ + storage.SplitReadStreamRequest(), + {}, + ], +) +async def test_split_read_stream_async(request_type, transport: str = "grpc_asyncio"): client = BigQueryReadAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2114,7 +2138,7 @@ async def test_split_read_stream_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( @@ -2136,11 +2160,6 @@ async def test_split_read_stream_async( assert isinstance(response, storage.SplitReadStreamResponse) -@pytest.mark.asyncio -async def test_split_read_stream_async_from_dict(): - await test_split_read_stream_async(request_type=dict) - - def test_split_read_stream_field_headers(): client = BigQueryReadClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2330,7 +2349,6 @@ def test_create_read_session_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage.CreateReadSessionRequest() - assert args[0] == request_msg @@ -2351,7 +2369,6 @@ def test_read_rows_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage.ReadRowsRequest() - assert args[0] == request_msg @@ -2374,7 +2391,6 @@ def test_split_read_stream_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage.SplitReadStreamRequest() - assert args[0] == request_msg @@ -2419,7 +2435,6 @@ async def test_create_read_session_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage.CreateReadSessionRequest() - assert args[0] == request_msg @@ -2445,7 +2460,6 @@ async def test_read_rows_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage.ReadRowsRequest() - assert args[0] == request_msg @@ -2472,7 +2486,6 @@ async def test_split_read_stream_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage.SplitReadStreamRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-bigquery-storage/tests/unit/gapic/bigquery_storage_v1beta2/test_big_query_write.py b/packages/google-cloud-bigquery-storage/tests/unit/gapic/bigquery_storage_v1beta2/test_big_query_write.py index 609820db11c7..b113807821a8 100644 --- a/packages/google-cloud-bigquery-storage/tests/unit/gapic/bigquery_storage_v1beta2/test_big_query_write.py +++ b/packages/google-cloud-bigquery-storage/tests/unit/gapic/bigquery_storage_v1beta2/test_big_query_write.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 @@ -107,6 +108,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" @@ -1293,8 +1309,8 @@ def test_big_query_write_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - storage.CreateWriteStreamRequest, - dict, + storage.CreateWriteStreamRequest(), + {}, ], ) def test_create_write_stream(request_type, transport: str = "grpc"): @@ -1305,7 +1321,7 @@ def test_create_write_stream(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1355,9 +1371,10 @@ def test_create_write_stream_non_empty_request_with_auto_populated_field(): client.create_write_stream(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == storage.CreateWriteStreamRequest( + request_msg = storage.CreateWriteStreamRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_write_stream_use_cached_wrapped_rpc(): @@ -1442,9 +1459,14 @@ async def test_create_write_stream_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_write_stream_async( - transport: str = "grpc_asyncio", request_type=storage.CreateWriteStreamRequest -): +@pytest.mark.parametrize( + "request_type", + [ + storage.CreateWriteStreamRequest(), + {}, + ], +) +async def test_create_write_stream_async(request_type, transport: str = "grpc_asyncio"): client = BigQueryWriteAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1452,7 +1474,7 @@ async def test_create_write_stream_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( @@ -1479,11 +1501,6 @@ async def test_create_write_stream_async( assert response.type_ == stream.WriteStream.Type.COMMITTED -@pytest.mark.asyncio -async def test_create_write_stream_async_from_dict(): - await test_create_write_stream_async(request_type=dict) - - def test_create_write_stream_field_headers(): client = BigQueryWriteClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1644,8 +1661,8 @@ async def test_create_write_stream_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - storage.AppendRowsRequest, - dict, + storage.AppendRowsRequest(), + {}, ], ) def test_append_rows(request_type, transport: str = "grpc"): @@ -1656,7 +1673,7 @@ def test_append_rows(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as 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. @@ -1753,9 +1770,14 @@ async def test_append_rows_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_append_rows_async( - transport: str = "grpc_asyncio", request_type=storage.AppendRowsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + storage.AppendRowsRequest(), + {}, + ], +) +async def test_append_rows_async(request_type, transport: str = "grpc_asyncio"): client = BigQueryWriteAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1763,7 +1785,7 @@ async def test_append_rows_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. @@ -1785,16 +1807,11 @@ async def test_append_rows_async( assert isinstance(message, storage.AppendRowsResponse) -@pytest.mark.asyncio -async def test_append_rows_async_from_dict(): - await test_append_rows_async(request_type=dict) - - @pytest.mark.parametrize( "request_type", [ - storage.GetWriteStreamRequest, - dict, + storage.GetWriteStreamRequest(), + {}, ], ) def test_get_write_stream(request_type, transport: str = "grpc"): @@ -1805,7 +1822,7 @@ def test_get_write_stream(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_write_stream), "__call__") as call: @@ -1851,9 +1868,10 @@ def test_get_write_stream_non_empty_request_with_auto_populated_field(): client.get_write_stream(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == storage.GetWriteStreamRequest( + request_msg = storage.GetWriteStreamRequest( name="name_value", ) + assert args[0] == request_msg def test_get_write_stream_use_cached_wrapped_rpc(): @@ -1936,9 +1954,14 @@ async def test_get_write_stream_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_write_stream_async( - transport: str = "grpc_asyncio", request_type=storage.GetWriteStreamRequest -): +@pytest.mark.parametrize( + "request_type", + [ + storage.GetWriteStreamRequest(), + {}, + ], +) +async def test_get_write_stream_async(request_type, transport: str = "grpc_asyncio"): client = BigQueryWriteAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1946,7 +1969,7 @@ async def test_get_write_stream_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_write_stream), "__call__") as call: @@ -1971,11 +1994,6 @@ async def test_get_write_stream_async( assert response.type_ == stream.WriteStream.Type.COMMITTED -@pytest.mark.asyncio -async def test_get_write_stream_async_from_dict(): - await test_get_write_stream_async(request_type=dict) - - def test_get_write_stream_field_headers(): client = BigQueryWriteClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2118,8 +2136,8 @@ async def test_get_write_stream_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - storage.FinalizeWriteStreamRequest, - dict, + storage.FinalizeWriteStreamRequest(), + {}, ], ) def test_finalize_write_stream(request_type, transport: str = "grpc"): @@ -2130,7 +2148,7 @@ def test_finalize_write_stream(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2178,9 +2196,10 @@ def test_finalize_write_stream_non_empty_request_with_auto_populated_field(): client.finalize_write_stream(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == storage.FinalizeWriteStreamRequest( + request_msg = storage.FinalizeWriteStreamRequest( name="name_value", ) + assert args[0] == request_msg def test_finalize_write_stream_use_cached_wrapped_rpc(): @@ -2266,8 +2285,15 @@ async def test_finalize_write_stream_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + storage.FinalizeWriteStreamRequest(), + {}, + ], +) async def test_finalize_write_stream_async( - transport: str = "grpc_asyncio", request_type=storage.FinalizeWriteStreamRequest + request_type, transport: str = "grpc_asyncio" ): client = BigQueryWriteAsyncClient( credentials=async_anonymous_credentials(), @@ -2276,7 +2302,7 @@ async def test_finalize_write_stream_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( @@ -2301,11 +2327,6 @@ async def test_finalize_write_stream_async( assert response.row_count == 992 -@pytest.mark.asyncio -async def test_finalize_write_stream_async_from_dict(): - await test_finalize_write_stream_async(request_type=dict) - - def test_finalize_write_stream_field_headers(): client = BigQueryWriteClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2460,8 +2481,8 @@ async def test_finalize_write_stream_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - storage.BatchCommitWriteStreamsRequest, - dict, + storage.BatchCommitWriteStreamsRequest(), + {}, ], ) def test_batch_commit_write_streams(request_type, transport: str = "grpc"): @@ -2472,7 +2493,7 @@ def test_batch_commit_write_streams(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2517,9 +2538,10 @@ def test_batch_commit_write_streams_non_empty_request_with_auto_populated_field( client.batch_commit_write_streams(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == storage.BatchCommitWriteStreamsRequest( + request_msg = storage.BatchCommitWriteStreamsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_batch_commit_write_streams_use_cached_wrapped_rpc(): @@ -2605,8 +2627,15 @@ async def test_batch_commit_write_streams_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + storage.BatchCommitWriteStreamsRequest(), + {}, + ], +) async def test_batch_commit_write_streams_async( - transport: str = "grpc_asyncio", request_type=storage.BatchCommitWriteStreamsRequest + request_type, transport: str = "grpc_asyncio" ): client = BigQueryWriteAsyncClient( credentials=async_anonymous_credentials(), @@ -2615,7 +2644,7 @@ async def test_batch_commit_write_streams_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( @@ -2637,11 +2666,6 @@ async def test_batch_commit_write_streams_async( assert isinstance(response, storage.BatchCommitWriteStreamsResponse) -@pytest.mark.asyncio -async def test_batch_commit_write_streams_async_from_dict(): - await test_batch_commit_write_streams_async(request_type=dict) - - def test_batch_commit_write_streams_field_headers(): client = BigQueryWriteClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2796,8 +2820,8 @@ async def test_batch_commit_write_streams_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - storage.FlushRowsRequest, - dict, + storage.FlushRowsRequest(), + {}, ], ) def test_flush_rows(request_type, transport: str = "grpc"): @@ -2808,7 +2832,7 @@ def test_flush_rows(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.flush_rows), "__call__") as call: @@ -2852,9 +2876,10 @@ def test_flush_rows_non_empty_request_with_auto_populated_field(): client.flush_rows(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == storage.FlushRowsRequest( + request_msg = storage.FlushRowsRequest( write_stream="write_stream_value", ) + assert args[0] == request_msg def test_flush_rows_use_cached_wrapped_rpc(): @@ -2933,9 +2958,14 @@ async def test_flush_rows_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_flush_rows_async( - transport: str = "grpc_asyncio", request_type=storage.FlushRowsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + storage.FlushRowsRequest(), + {}, + ], +) +async def test_flush_rows_async(request_type, transport: str = "grpc_asyncio"): client = BigQueryWriteAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2943,7 +2973,7 @@ async def test_flush_rows_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.flush_rows), "__call__") as call: @@ -2966,11 +2996,6 @@ async def test_flush_rows_async( assert response.offset == 647 -@pytest.mark.asyncio -async def test_flush_rows_async_from_dict(): - await test_flush_rows_async(request_type=dict) - - def test_flush_rows_field_headers(): client = BigQueryWriteClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3238,7 +3263,6 @@ def test_create_write_stream_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage.CreateWriteStreamRequest() - assert args[0] == request_msg @@ -3259,7 +3283,6 @@ def test_get_write_stream_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage.GetWriteStreamRequest() - assert args[0] == request_msg @@ -3282,7 +3305,6 @@ def test_finalize_write_stream_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage.FinalizeWriteStreamRequest() - assert args[0] == request_msg @@ -3305,7 +3327,6 @@ def test_batch_commit_write_streams_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage.BatchCommitWriteStreamsRequest() - assert args[0] == request_msg @@ -3326,7 +3347,6 @@ def test_flush_rows_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage.FlushRowsRequest() - assert args[0] == request_msg @@ -3370,7 +3390,6 @@ async def test_create_write_stream_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage.CreateWriteStreamRequest() - assert args[0] == request_msg @@ -3398,7 +3417,6 @@ async def test_get_write_stream_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage.GetWriteStreamRequest() - assert args[0] == request_msg @@ -3427,7 +3445,6 @@ async def test_finalize_write_stream_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage.FinalizeWriteStreamRequest() - assert args[0] == request_msg @@ -3454,7 +3471,6 @@ async def test_batch_commit_write_streams_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage.BatchCommitWriteStreamsRequest() - assert args[0] == request_msg @@ -3481,7 +3497,6 @@ async def test_flush_rows_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage.FlushRowsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-billing-budgets/noxfile.py b/packages/google-cloud-billing-budgets/noxfile.py index 7fc1bd80e712..d1f4e6341b46 100644 --- a/packages/google-cloud-billing-budgets/noxfile.py +++ b/packages/google-cloud-billing-budgets/noxfile.py @@ -47,7 +47,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-billing-budgets" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-billing-budgets/setup.py b/packages/google-cloud-billing-budgets/setup.py index 5c3a7e281a7f..eda177d690aa 100644 --- a/packages/google-cloud-billing-budgets/setup.py +++ b/packages/google-cloud-billing-budgets/setup.py @@ -45,7 +45,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/google-cloud-billing-budgets/testing/constraints-3.10.txt b/packages/google-cloud-billing-budgets/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-billing-budgets/testing/constraints-3.10.txt +++ b/packages/google-cloud-billing-budgets/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-billing-budgets/tests/unit/gapic/budgets_v1/test_budget_service.py b/packages/google-cloud-billing-budgets/tests/unit/gapic/budgets_v1/test_budget_service.py index ee471c71f1a8..6e13188d096a 100644 --- a/packages/google-cloud-billing-budgets/tests/unit/gapic/budgets_v1/test_budget_service.py +++ b/packages/google-cloud-billing-budgets/tests/unit/gapic/budgets_v1/test_budget_service.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" @@ -1313,8 +1329,8 @@ def test_budget_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - budget_service.CreateBudgetRequest, - dict, + budget_service.CreateBudgetRequest(), + {}, ], ) def test_create_budget(request_type, transport: str = "grpc"): @@ -1325,7 +1341,7 @@ def test_create_budget(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_budget), "__call__") as call: @@ -1373,9 +1389,10 @@ def test_create_budget_non_empty_request_with_auto_populated_field(): client.create_budget(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == budget_service.CreateBudgetRequest( + request_msg = budget_service.CreateBudgetRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_budget_use_cached_wrapped_rpc(): @@ -1456,9 +1473,14 @@ async def test_create_budget_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_budget_async( - transport: str = "grpc_asyncio", request_type=budget_service.CreateBudgetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + budget_service.CreateBudgetRequest(), + {}, + ], +) +async def test_create_budget_async(request_type, transport: str = "grpc_asyncio"): client = BudgetServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1466,7 +1488,7 @@ async def test_create_budget_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_budget), "__call__") as call: @@ -1493,11 +1515,6 @@ async def test_create_budget_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_create_budget_async_from_dict(): - await test_create_budget_async(request_type=dict) - - def test_create_budget_field_headers(): client = BudgetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1650,8 +1667,8 @@ async def test_create_budget_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - budget_service.UpdateBudgetRequest, - dict, + budget_service.UpdateBudgetRequest(), + {}, ], ) def test_update_budget(request_type, transport: str = "grpc"): @@ -1662,7 +1679,7 @@ def test_update_budget(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_budget), "__call__") as call: @@ -1708,7 +1725,8 @@ def test_update_budget_non_empty_request_with_auto_populated_field(): client.update_budget(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == budget_service.UpdateBudgetRequest() + request_msg = budget_service.UpdateBudgetRequest() + assert args[0] == request_msg def test_update_budget_use_cached_wrapped_rpc(): @@ -1789,9 +1807,14 @@ async def test_update_budget_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_budget_async( - transport: str = "grpc_asyncio", request_type=budget_service.UpdateBudgetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + budget_service.UpdateBudgetRequest(), + {}, + ], +) +async def test_update_budget_async(request_type, transport: str = "grpc_asyncio"): client = BudgetServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1799,7 +1822,7 @@ async def test_update_budget_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_budget), "__call__") as call: @@ -1826,11 +1849,6 @@ async def test_update_budget_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_update_budget_async_from_dict(): - await test_update_budget_async(request_type=dict) - - def test_update_budget_field_headers(): client = BudgetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1983,8 +2001,8 @@ async def test_update_budget_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - budget_service.GetBudgetRequest, - dict, + budget_service.GetBudgetRequest(), + {}, ], ) def test_get_budget(request_type, transport: str = "grpc"): @@ -1995,7 +2013,7 @@ def test_get_budget(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_budget), "__call__") as call: @@ -2043,9 +2061,10 @@ def test_get_budget_non_empty_request_with_auto_populated_field(): client.get_budget(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == budget_service.GetBudgetRequest( + request_msg = budget_service.GetBudgetRequest( name="name_value", ) + assert args[0] == request_msg def test_get_budget_use_cached_wrapped_rpc(): @@ -2124,9 +2143,14 @@ async def test_get_budget_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_budget_async( - transport: str = "grpc_asyncio", request_type=budget_service.GetBudgetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + budget_service.GetBudgetRequest(), + {}, + ], +) +async def test_get_budget_async(request_type, transport: str = "grpc_asyncio"): client = BudgetServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2134,7 +2158,7 @@ async def test_get_budget_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_budget), "__call__") as call: @@ -2161,11 +2185,6 @@ async def test_get_budget_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_budget_async_from_dict(): - await test_get_budget_async(request_type=dict) - - def test_get_budget_field_headers(): client = BudgetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2308,8 +2327,8 @@ async def test_get_budget_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - budget_service.ListBudgetsRequest, - dict, + budget_service.ListBudgetsRequest(), + {}, ], ) def test_list_budgets(request_type, transport: str = "grpc"): @@ -2320,7 +2339,7 @@ def test_list_budgets(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_budgets), "__call__") as call: @@ -2366,11 +2385,12 @@ def test_list_budgets_non_empty_request_with_auto_populated_field(): client.list_budgets(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == budget_service.ListBudgetsRequest( + request_msg = budget_service.ListBudgetsRequest( parent="parent_value", scope="scope_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_budgets_use_cached_wrapped_rpc(): @@ -2451,9 +2471,14 @@ async def test_list_budgets_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_budgets_async( - transport: str = "grpc_asyncio", request_type=budget_service.ListBudgetsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + budget_service.ListBudgetsRequest(), + {}, + ], +) +async def test_list_budgets_async(request_type, transport: str = "grpc_asyncio"): client = BudgetServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2461,7 +2486,7 @@ async def test_list_budgets_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_budgets), "__call__") as call: @@ -2484,11 +2509,6 @@ async def test_list_budgets_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_budgets_async_from_dict(): - await test_list_budgets_async(request_type=dict) - - def test_list_budgets_field_headers(): client = BudgetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2825,8 +2845,8 @@ async def test_list_budgets_async_pages(): @pytest.mark.parametrize( "request_type", [ - budget_service.DeleteBudgetRequest, - dict, + budget_service.DeleteBudgetRequest(), + {}, ], ) def test_delete_budget(request_type, transport: str = "grpc"): @@ -2837,7 +2857,7 @@ def test_delete_budget(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_budget), "__call__") as call: @@ -2878,9 +2898,10 @@ def test_delete_budget_non_empty_request_with_auto_populated_field(): client.delete_budget(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == budget_service.DeleteBudgetRequest( + request_msg = budget_service.DeleteBudgetRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_budget_use_cached_wrapped_rpc(): @@ -2961,9 +2982,14 @@ async def test_delete_budget_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_budget_async( - transport: str = "grpc_asyncio", request_type=budget_service.DeleteBudgetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + budget_service.DeleteBudgetRequest(), + {}, + ], +) +async def test_delete_budget_async(request_type, transport: str = "grpc_asyncio"): client = BudgetServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2971,7 +2997,7 @@ async def test_delete_budget_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_budget), "__call__") as call: @@ -2989,11 +3015,6 @@ async def test_delete_budget_async( assert response is None -@pytest.mark.asyncio -async def test_delete_budget_async_from_dict(): - await test_delete_budget_async(request_type=dict) - - def test_delete_budget_field_headers(): client = BudgetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4221,7 +4242,6 @@ def test_create_budget_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = budget_service.CreateBudgetRequest() - assert args[0] == request_msg @@ -4242,7 +4262,6 @@ def test_update_budget_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = budget_service.UpdateBudgetRequest() - assert args[0] == request_msg @@ -4263,7 +4282,6 @@ def test_get_budget_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = budget_service.GetBudgetRequest() - assert args[0] == request_msg @@ -4284,7 +4302,6 @@ def test_list_budgets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = budget_service.ListBudgetsRequest() - assert args[0] == request_msg @@ -4305,7 +4322,6 @@ def test_delete_budget_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = budget_service.DeleteBudgetRequest() - assert args[0] == request_msg @@ -4348,7 +4364,6 @@ async def test_create_budget_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = budget_service.CreateBudgetRequest() - assert args[0] == request_msg @@ -4377,7 +4392,6 @@ async def test_update_budget_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = budget_service.UpdateBudgetRequest() - assert args[0] == request_msg @@ -4406,7 +4420,6 @@ async def test_get_budget_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = budget_service.GetBudgetRequest() - assert args[0] == request_msg @@ -4433,7 +4446,6 @@ async def test_list_budgets_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = budget_service.ListBudgetsRequest() - assert args[0] == request_msg @@ -4456,7 +4468,6 @@ async def test_delete_budget_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = budget_service.DeleteBudgetRequest() - assert args[0] == request_msg @@ -5346,7 +5357,6 @@ def test_create_budget_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = budget_service.CreateBudgetRequest() - assert args[0] == request_msg @@ -5366,7 +5376,6 @@ def test_update_budget_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = budget_service.UpdateBudgetRequest() - assert args[0] == request_msg @@ -5386,7 +5395,6 @@ def test_get_budget_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = budget_service.GetBudgetRequest() - assert args[0] == request_msg @@ -5406,7 +5414,6 @@ def test_list_budgets_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = budget_service.ListBudgetsRequest() - assert args[0] == request_msg @@ -5426,7 +5433,6 @@ def test_delete_budget_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = budget_service.DeleteBudgetRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-billing-budgets/tests/unit/gapic/budgets_v1beta1/test_budget_service.py b/packages/google-cloud-billing-budgets/tests/unit/gapic/budgets_v1beta1/test_budget_service.py index d2d6b082354d..b88e36a86ca8 100644 --- a/packages/google-cloud-billing-budgets/tests/unit/gapic/budgets_v1beta1/test_budget_service.py +++ b/packages/google-cloud-billing-budgets/tests/unit/gapic/budgets_v1beta1/test_budget_service.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 @@ -108,6 +109,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" @@ -1293,8 +1309,8 @@ def test_budget_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - budget_service.CreateBudgetRequest, - dict, + budget_service.CreateBudgetRequest(), + {}, ], ) def test_create_budget(request_type, transport: str = "grpc"): @@ -1305,7 +1321,7 @@ def test_create_budget(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_budget), "__call__") as call: @@ -1353,9 +1369,10 @@ def test_create_budget_non_empty_request_with_auto_populated_field(): client.create_budget(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == budget_service.CreateBudgetRequest( + request_msg = budget_service.CreateBudgetRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_budget_use_cached_wrapped_rpc(): @@ -1436,9 +1453,14 @@ async def test_create_budget_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_budget_async( - transport: str = "grpc_asyncio", request_type=budget_service.CreateBudgetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + budget_service.CreateBudgetRequest(), + {}, + ], +) +async def test_create_budget_async(request_type, transport: str = "grpc_asyncio"): client = BudgetServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1446,7 +1468,7 @@ async def test_create_budget_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_budget), "__call__") as call: @@ -1473,11 +1495,6 @@ async def test_create_budget_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_create_budget_async_from_dict(): - await test_create_budget_async(request_type=dict) - - def test_create_budget_field_headers(): client = BudgetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1540,8 +1557,8 @@ async def test_create_budget_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - budget_service.UpdateBudgetRequest, - dict, + budget_service.UpdateBudgetRequest(), + {}, ], ) def test_update_budget(request_type, transport: str = "grpc"): @@ -1552,7 +1569,7 @@ def test_update_budget(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_budget), "__call__") as call: @@ -1598,7 +1615,8 @@ def test_update_budget_non_empty_request_with_auto_populated_field(): client.update_budget(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == budget_service.UpdateBudgetRequest() + request_msg = budget_service.UpdateBudgetRequest() + assert args[0] == request_msg def test_update_budget_use_cached_wrapped_rpc(): @@ -1679,9 +1697,14 @@ async def test_update_budget_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_budget_async( - transport: str = "grpc_asyncio", request_type=budget_service.UpdateBudgetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + budget_service.UpdateBudgetRequest(), + {}, + ], +) +async def test_update_budget_async(request_type, transport: str = "grpc_asyncio"): client = BudgetServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1689,7 +1712,7 @@ async def test_update_budget_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_budget), "__call__") as call: @@ -1716,11 +1739,6 @@ async def test_update_budget_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_update_budget_async_from_dict(): - await test_update_budget_async(request_type=dict) - - def test_update_budget_field_headers(): client = BudgetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1783,8 +1801,8 @@ async def test_update_budget_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - budget_service.GetBudgetRequest, - dict, + budget_service.GetBudgetRequest(), + {}, ], ) def test_get_budget(request_type, transport: str = "grpc"): @@ -1795,7 +1813,7 @@ def test_get_budget(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_budget), "__call__") as call: @@ -1843,9 +1861,10 @@ def test_get_budget_non_empty_request_with_auto_populated_field(): client.get_budget(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == budget_service.GetBudgetRequest( + request_msg = budget_service.GetBudgetRequest( name="name_value", ) + assert args[0] == request_msg def test_get_budget_use_cached_wrapped_rpc(): @@ -1924,9 +1943,14 @@ async def test_get_budget_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_budget_async( - transport: str = "grpc_asyncio", request_type=budget_service.GetBudgetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + budget_service.GetBudgetRequest(), + {}, + ], +) +async def test_get_budget_async(request_type, transport: str = "grpc_asyncio"): client = BudgetServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1934,7 +1958,7 @@ async def test_get_budget_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_budget), "__call__") as call: @@ -1961,11 +1985,6 @@ async def test_get_budget_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_budget_async_from_dict(): - await test_get_budget_async(request_type=dict) - - def test_get_budget_field_headers(): client = BudgetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2028,8 +2047,8 @@ async def test_get_budget_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - budget_service.ListBudgetsRequest, - dict, + budget_service.ListBudgetsRequest(), + {}, ], ) def test_list_budgets(request_type, transport: str = "grpc"): @@ -2040,7 +2059,7 @@ def test_list_budgets(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_budgets), "__call__") as call: @@ -2086,11 +2105,12 @@ def test_list_budgets_non_empty_request_with_auto_populated_field(): client.list_budgets(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == budget_service.ListBudgetsRequest( + request_msg = budget_service.ListBudgetsRequest( parent="parent_value", scope="scope_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_budgets_use_cached_wrapped_rpc(): @@ -2171,9 +2191,14 @@ async def test_list_budgets_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_budgets_async( - transport: str = "grpc_asyncio", request_type=budget_service.ListBudgetsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + budget_service.ListBudgetsRequest(), + {}, + ], +) +async def test_list_budgets_async(request_type, transport: str = "grpc_asyncio"): client = BudgetServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2181,7 +2206,7 @@ async def test_list_budgets_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_budgets), "__call__") as call: @@ -2204,11 +2229,6 @@ async def test_list_budgets_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_budgets_async_from_dict(): - await test_list_budgets_async(request_type=dict) - - def test_list_budgets_field_headers(): client = BudgetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2463,8 +2483,8 @@ async def test_list_budgets_async_pages(): @pytest.mark.parametrize( "request_type", [ - budget_service.DeleteBudgetRequest, - dict, + budget_service.DeleteBudgetRequest(), + {}, ], ) def test_delete_budget(request_type, transport: str = "grpc"): @@ -2475,7 +2495,7 @@ def test_delete_budget(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_budget), "__call__") as call: @@ -2516,9 +2536,10 @@ def test_delete_budget_non_empty_request_with_auto_populated_field(): client.delete_budget(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == budget_service.DeleteBudgetRequest( + request_msg = budget_service.DeleteBudgetRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_budget_use_cached_wrapped_rpc(): @@ -2599,9 +2620,14 @@ async def test_delete_budget_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_budget_async( - transport: str = "grpc_asyncio", request_type=budget_service.DeleteBudgetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + budget_service.DeleteBudgetRequest(), + {}, + ], +) +async def test_delete_budget_async(request_type, transport: str = "grpc_asyncio"): client = BudgetServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2609,7 +2635,7 @@ async def test_delete_budget_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_budget), "__call__") as call: @@ -2627,11 +2653,6 @@ async def test_delete_budget_async( assert response is None -@pytest.mark.asyncio -async def test_delete_budget_async_from_dict(): - await test_delete_budget_async(request_type=dict) - - def test_delete_budget_field_headers(): client = BudgetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2813,7 +2834,6 @@ def test_create_budget_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = budget_service.CreateBudgetRequest() - assert args[0] == request_msg @@ -2834,7 +2854,6 @@ def test_update_budget_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = budget_service.UpdateBudgetRequest() - assert args[0] == request_msg @@ -2855,7 +2874,6 @@ def test_get_budget_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = budget_service.GetBudgetRequest() - assert args[0] == request_msg @@ -2876,7 +2894,6 @@ def test_list_budgets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = budget_service.ListBudgetsRequest() - assert args[0] == request_msg @@ -2897,7 +2914,6 @@ def test_delete_budget_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = budget_service.DeleteBudgetRequest() - assert args[0] == request_msg @@ -2940,7 +2956,6 @@ async def test_create_budget_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = budget_service.CreateBudgetRequest() - assert args[0] == request_msg @@ -2969,7 +2984,6 @@ async def test_update_budget_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = budget_service.UpdateBudgetRequest() - assert args[0] == request_msg @@ -2998,7 +3012,6 @@ async def test_get_budget_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = budget_service.GetBudgetRequest() - assert args[0] == request_msg @@ -3025,7 +3038,6 @@ async def test_list_budgets_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = budget_service.ListBudgetsRequest() - assert args[0] == request_msg @@ -3048,7 +3060,6 @@ async def test_delete_budget_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = budget_service.DeleteBudgetRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-billing/noxfile.py b/packages/google-cloud-billing/noxfile.py index be671e7869bf..3f1f9d83aaf2 100644 --- a/packages/google-cloud-billing/noxfile.py +++ b/packages/google-cloud-billing/noxfile.py @@ -47,7 +47,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-billing" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-billing/setup.py b/packages/google-cloud-billing/setup.py index 3c246aec8214..d09922705fe2 100644 --- a/packages/google-cloud-billing/setup.py +++ b/packages/google-cloud-billing/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/google-cloud-billing/testing/constraints-3.10.txt b/packages/google-cloud-billing/testing/constraints-3.10.txt index a92801e1c8e2..b39cd54634f9 100644 --- a/packages/google-cloud-billing/testing/constraints-3.10.txt +++ b/packages/google-cloud-billing/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/google-cloud-billing/tests/unit/gapic/billing_v1/test_cloud_billing.py b/packages/google-cloud-billing/tests/unit/gapic/billing_v1/test_cloud_billing.py index 7a0334aca1ad..1c271d45ead8 100644 --- a/packages/google-cloud-billing/tests/unit/gapic/billing_v1/test_cloud_billing.py +++ b/packages/google-cloud-billing/tests/unit/gapic/billing_v1/test_cloud_billing.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" @@ -1296,8 +1312,8 @@ def test_cloud_billing_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - cloud_billing.GetBillingAccountRequest, - dict, + cloud_billing.GetBillingAccountRequest(), + {}, ], ) def test_get_billing_account(request_type, transport: str = "grpc"): @@ -1308,7 +1324,7 @@ def test_get_billing_account(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1366,9 +1382,10 @@ def test_get_billing_account_non_empty_request_with_auto_populated_field(): client.get_billing_account(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_billing.GetBillingAccountRequest( + request_msg = cloud_billing.GetBillingAccountRequest( name="name_value", ) + assert args[0] == request_msg def test_get_billing_account_use_cached_wrapped_rpc(): @@ -1453,9 +1470,14 @@ async def test_get_billing_account_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_billing_account_async( - transport: str = "grpc_asyncio", request_type=cloud_billing.GetBillingAccountRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_billing.GetBillingAccountRequest(), + {}, + ], +) +async def test_get_billing_account_async(request_type, transport: str = "grpc_asyncio"): client = CloudBillingAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1463,7 +1485,7 @@ async def test_get_billing_account_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( @@ -1498,11 +1520,6 @@ async def test_get_billing_account_async( assert response.currency_code == "currency_code_value" -@pytest.mark.asyncio -async def test_get_billing_account_async_from_dict(): - await test_get_billing_account_async(request_type=dict) - - def test_get_billing_account_field_headers(): client = CloudBillingClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1657,8 +1674,8 @@ async def test_get_billing_account_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_billing.ListBillingAccountsRequest, - dict, + cloud_billing.ListBillingAccountsRequest(), + {}, ], ) def test_list_billing_accounts(request_type, transport: str = "grpc"): @@ -1669,7 +1686,7 @@ def test_list_billing_accounts(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1719,11 +1736,12 @@ def test_list_billing_accounts_non_empty_request_with_auto_populated_field(): client.list_billing_accounts(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_billing.ListBillingAccountsRequest( + request_msg = cloud_billing.ListBillingAccountsRequest( page_token="page_token_value", filter="filter_value", parent="parent_value", ) + assert args[0] == request_msg def test_list_billing_accounts_use_cached_wrapped_rpc(): @@ -1809,9 +1827,15 @@ async def test_list_billing_accounts_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloud_billing.ListBillingAccountsRequest(), + {}, + ], +) async def test_list_billing_accounts_async( - transport: str = "grpc_asyncio", - request_type=cloud_billing.ListBillingAccountsRequest, + request_type, transport: str = "grpc_asyncio" ): client = CloudBillingAsyncClient( credentials=async_anonymous_credentials(), @@ -1820,7 +1844,7 @@ async def test_list_billing_accounts_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( @@ -1845,11 +1869,6 @@ async def test_list_billing_accounts_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_billing_accounts_async_from_dict(): - await test_list_billing_accounts_async(request_type=dict) - - def test_list_billing_accounts_flattened(): client = CloudBillingClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2134,8 +2153,8 @@ async def test_list_billing_accounts_async_pages(): @pytest.mark.parametrize( "request_type", [ - cloud_billing.UpdateBillingAccountRequest, - dict, + cloud_billing.UpdateBillingAccountRequest(), + {}, ], ) def test_update_billing_account(request_type, transport: str = "grpc"): @@ -2146,7 +2165,7 @@ def test_update_billing_account(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2204,9 +2223,10 @@ def test_update_billing_account_non_empty_request_with_auto_populated_field(): client.update_billing_account(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_billing.UpdateBillingAccountRequest( + request_msg = cloud_billing.UpdateBillingAccountRequest( name="name_value", ) + assert args[0] == request_msg def test_update_billing_account_use_cached_wrapped_rpc(): @@ -2292,9 +2312,15 @@ async def test_update_billing_account_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloud_billing.UpdateBillingAccountRequest(), + {}, + ], +) async def test_update_billing_account_async( - transport: str = "grpc_asyncio", - request_type=cloud_billing.UpdateBillingAccountRequest, + request_type, transport: str = "grpc_asyncio" ): client = CloudBillingAsyncClient( credentials=async_anonymous_credentials(), @@ -2303,7 +2329,7 @@ async def test_update_billing_account_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( @@ -2338,11 +2364,6 @@ async def test_update_billing_account_async( assert response.currency_code == "currency_code_value" -@pytest.mark.asyncio -async def test_update_billing_account_async_from_dict(): - await test_update_billing_account_async(request_type=dict) - - def test_update_billing_account_field_headers(): client = CloudBillingClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2507,8 +2528,8 @@ async def test_update_billing_account_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_billing.CreateBillingAccountRequest, - dict, + cloud_billing.CreateBillingAccountRequest(), + {}, ], ) def test_create_billing_account(request_type, transport: str = "grpc"): @@ -2519,7 +2540,7 @@ def test_create_billing_account(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,9 +2598,10 @@ def test_create_billing_account_non_empty_request_with_auto_populated_field(): client.create_billing_account(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_billing.CreateBillingAccountRequest( + request_msg = cloud_billing.CreateBillingAccountRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_billing_account_use_cached_wrapped_rpc(): @@ -2665,9 +2687,15 @@ async def test_create_billing_account_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloud_billing.CreateBillingAccountRequest(), + {}, + ], +) async def test_create_billing_account_async( - transport: str = "grpc_asyncio", - request_type=cloud_billing.CreateBillingAccountRequest, + request_type, transport: str = "grpc_asyncio" ): client = CloudBillingAsyncClient( credentials=async_anonymous_credentials(), @@ -2676,7 +2704,7 @@ async def test_create_billing_account_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( @@ -2711,11 +2739,6 @@ async def test_create_billing_account_async( assert response.currency_code == "currency_code_value" -@pytest.mark.asyncio -async def test_create_billing_account_async_from_dict(): - await test_create_billing_account_async(request_type=dict) - - def test_create_billing_account_flattened(): client = CloudBillingClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2815,8 +2838,8 @@ async def test_create_billing_account_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_billing.ListProjectBillingInfoRequest, - dict, + cloud_billing.ListProjectBillingInfoRequest(), + {}, ], ) def test_list_project_billing_info(request_type, transport: str = "grpc"): @@ -2827,7 +2850,7 @@ def test_list_project_billing_info(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2876,10 +2899,11 @@ def test_list_project_billing_info_non_empty_request_with_auto_populated_field() client.list_project_billing_info(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_billing.ListProjectBillingInfoRequest( + request_msg = cloud_billing.ListProjectBillingInfoRequest( name="name_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_project_billing_info_use_cached_wrapped_rpc(): @@ -2965,9 +2989,15 @@ async def test_list_project_billing_info_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloud_billing.ListProjectBillingInfoRequest(), + {}, + ], +) async def test_list_project_billing_info_async( - transport: str = "grpc_asyncio", - request_type=cloud_billing.ListProjectBillingInfoRequest, + request_type, transport: str = "grpc_asyncio" ): client = CloudBillingAsyncClient( credentials=async_anonymous_credentials(), @@ -2976,7 +3006,7 @@ async def test_list_project_billing_info_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( @@ -3001,11 +3031,6 @@ async def test_list_project_billing_info_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_project_billing_info_async_from_dict(): - await test_list_project_billing_info_async(request_type=dict) - - def test_list_project_billing_info_field_headers(): client = CloudBillingClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3360,8 +3385,8 @@ async def test_list_project_billing_info_async_pages(): @pytest.mark.parametrize( "request_type", [ - cloud_billing.GetProjectBillingInfoRequest, - dict, + cloud_billing.GetProjectBillingInfoRequest(), + {}, ], ) def test_get_project_billing_info(request_type, transport: str = "grpc"): @@ -3372,7 +3397,7 @@ def test_get_project_billing_info(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3426,9 +3451,10 @@ def test_get_project_billing_info_non_empty_request_with_auto_populated_field(): client.get_project_billing_info(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_billing.GetProjectBillingInfoRequest( + request_msg = cloud_billing.GetProjectBillingInfoRequest( name="name_value", ) + assert args[0] == request_msg def test_get_project_billing_info_use_cached_wrapped_rpc(): @@ -3514,9 +3540,15 @@ async def test_get_project_billing_info_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloud_billing.GetProjectBillingInfoRequest(), + {}, + ], +) async def test_get_project_billing_info_async( - transport: str = "grpc_asyncio", - request_type=cloud_billing.GetProjectBillingInfoRequest, + request_type, transport: str = "grpc_asyncio" ): client = CloudBillingAsyncClient( credentials=async_anonymous_credentials(), @@ -3525,7 +3557,7 @@ async def test_get_project_billing_info_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( @@ -3556,11 +3588,6 @@ async def test_get_project_billing_info_async( assert response.billing_enabled is True -@pytest.mark.asyncio -async def test_get_project_billing_info_async_from_dict(): - await test_get_project_billing_info_async(request_type=dict) - - def test_get_project_billing_info_field_headers(): client = CloudBillingClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3715,8 +3742,8 @@ async def test_get_project_billing_info_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_billing.UpdateProjectBillingInfoRequest, - dict, + cloud_billing.UpdateProjectBillingInfoRequest(), + {}, ], ) def test_update_project_billing_info(request_type, transport: str = "grpc"): @@ -3727,7 +3754,7 @@ def test_update_project_billing_info(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3781,9 +3808,10 @@ def test_update_project_billing_info_non_empty_request_with_auto_populated_field client.update_project_billing_info(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_billing.UpdateProjectBillingInfoRequest( + request_msg = cloud_billing.UpdateProjectBillingInfoRequest( name="name_value", ) + assert args[0] == request_msg def test_update_project_billing_info_use_cached_wrapped_rpc(): @@ -3869,9 +3897,15 @@ async def test_update_project_billing_info_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloud_billing.UpdateProjectBillingInfoRequest(), + {}, + ], +) async def test_update_project_billing_info_async( - transport: str = "grpc_asyncio", - request_type=cloud_billing.UpdateProjectBillingInfoRequest, + request_type, transport: str = "grpc_asyncio" ): client = CloudBillingAsyncClient( credentials=async_anonymous_credentials(), @@ -3880,7 +3914,7 @@ async def test_update_project_billing_info_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( @@ -3911,11 +3945,6 @@ async def test_update_project_billing_info_async( assert response.billing_enabled is True -@pytest.mark.asyncio -async def test_update_project_billing_info_async_from_dict(): - await test_update_project_billing_info_async(request_type=dict) - - def test_update_project_billing_info_field_headers(): client = CloudBillingClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4080,8 +4109,8 @@ async def test_update_project_billing_info_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.GetIamPolicyRequest, - dict, + iam_policy_pb2.GetIamPolicyRequest(), + {}, ], ) def test_get_iam_policy(request_type, transport: str = "grpc"): @@ -4092,7 +4121,7 @@ def test_get_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(type(client.transport.get_iam_policy), "__call__") as call: @@ -4138,9 +4167,10 @@ def test_get_iam_policy_non_empty_request_with_auto_populated_field(): client.get_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.GetIamPolicyRequest( + request_msg = iam_policy_pb2.GetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_get_iam_policy_use_cached_wrapped_rpc(): @@ -4221,9 +4251,14 @@ async def test_get_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.GetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.GetIamPolicyRequest(), + {}, + ], +) +async def test_get_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = CloudBillingAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4231,7 +4266,7 @@ async def test_get_iam_policy_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_iam_policy), "__call__") as call: @@ -4256,11 +4291,6 @@ async def test_get_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_get_iam_policy_async_from_dict(): - await test_get_iam_policy_async(request_type=dict) - - def test_get_iam_policy_field_headers(): client = CloudBillingClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4420,8 +4450,8 @@ async def test_get_iam_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.SetIamPolicyRequest, - dict, + iam_policy_pb2.SetIamPolicyRequest(), + {}, ], ) def test_set_iam_policy(request_type, transport: str = "grpc"): @@ -4432,7 +4462,7 @@ def test_set_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(type(client.transport.set_iam_policy), "__call__") as call: @@ -4478,9 +4508,10 @@ def test_set_iam_policy_non_empty_request_with_auto_populated_field(): client.set_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.SetIamPolicyRequest( + request_msg = iam_policy_pb2.SetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_set_iam_policy_use_cached_wrapped_rpc(): @@ -4561,9 +4592,14 @@ async def test_set_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.SetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.SetIamPolicyRequest(), + {}, + ], +) +async def test_set_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = CloudBillingAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4571,7 +4607,7 @@ async def test_set_iam_policy_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.set_iam_policy), "__call__") as call: @@ -4596,11 +4632,6 @@ async def test_set_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_set_iam_policy_async_from_dict(): - await test_set_iam_policy_async(request_type=dict) - - def test_set_iam_policy_field_headers(): client = CloudBillingClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4761,8 +4792,8 @@ async def test_set_iam_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.TestIamPermissionsRequest, - dict, + iam_policy_pb2.TestIamPermissionsRequest(), + {}, ], ) def test_test_iam_permissions(request_type, transport: str = "grpc"): @@ -4773,7 +4804,7 @@ def test_test_iam_permissions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4821,9 +4852,10 @@ def test_test_iam_permissions_non_empty_request_with_auto_populated_field(): client.test_iam_permissions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.TestIamPermissionsRequest( + request_msg = iam_policy_pb2.TestIamPermissionsRequest( resource="resource_value", ) + assert args[0] == request_msg def test_test_iam_permissions_use_cached_wrapped_rpc(): @@ -4908,9 +4940,15 @@ async def test_test_iam_permissions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.TestIamPermissionsRequest(), + {}, + ], +) async def test_test_iam_permissions_async( - transport: str = "grpc_asyncio", - request_type=iam_policy_pb2.TestIamPermissionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = CloudBillingAsyncClient( credentials=async_anonymous_credentials(), @@ -4919,7 +4957,7 @@ async def test_test_iam_permissions_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( @@ -4944,11 +4982,6 @@ async def test_test_iam_permissions_async( assert response.permissions == ["permissions_value"] -@pytest.mark.asyncio -async def test_test_iam_permissions_async_from_dict(): - await test_test_iam_permissions_async(request_type=dict) - - def test_test_iam_permissions_field_headers(): client = CloudBillingClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5132,8 +5165,8 @@ async def test_test_iam_permissions_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_billing.MoveBillingAccountRequest, - dict, + cloud_billing.MoveBillingAccountRequest(), + {}, ], ) def test_move_billing_account(request_type, transport: str = "grpc"): @@ -5144,7 +5177,7 @@ def test_move_billing_account(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5203,10 +5236,11 @@ def test_move_billing_account_non_empty_request_with_auto_populated_field(): client.move_billing_account(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_billing.MoveBillingAccountRequest( + request_msg = cloud_billing.MoveBillingAccountRequest( name="name_value", destination_parent="destination_parent_value", ) + assert args[0] == request_msg def test_move_billing_account_use_cached_wrapped_rpc(): @@ -5291,9 +5325,15 @@ async def test_move_billing_account_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloud_billing.MoveBillingAccountRequest(), + {}, + ], +) async def test_move_billing_account_async( - transport: str = "grpc_asyncio", - request_type=cloud_billing.MoveBillingAccountRequest, + request_type, transport: str = "grpc_asyncio" ): client = CloudBillingAsyncClient( credentials=async_anonymous_credentials(), @@ -5302,7 +5342,7 @@ async def test_move_billing_account_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( @@ -5337,11 +5377,6 @@ async def test_move_billing_account_async( assert response.currency_code == "currency_code_value" -@pytest.mark.asyncio -async def test_move_billing_account_async_from_dict(): - await test_move_billing_account_async(request_type=dict) - - def test_move_billing_account_field_headers(): client = CloudBillingClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7558,7 +7593,6 @@ def test_get_billing_account_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_billing.GetBillingAccountRequest() - assert args[0] == request_msg @@ -7581,7 +7615,6 @@ def test_list_billing_accounts_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_billing.ListBillingAccountsRequest() - assert args[0] == request_msg @@ -7604,7 +7637,6 @@ def test_update_billing_account_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_billing.UpdateBillingAccountRequest() - assert args[0] == request_msg @@ -7627,7 +7659,6 @@ def test_create_billing_account_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_billing.CreateBillingAccountRequest() - assert args[0] == request_msg @@ -7650,7 +7681,6 @@ def test_list_project_billing_info_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_billing.ListProjectBillingInfoRequest() - assert args[0] == request_msg @@ -7673,7 +7703,6 @@ def test_get_project_billing_info_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_billing.GetProjectBillingInfoRequest() - assert args[0] == request_msg @@ -7696,7 +7725,6 @@ def test_update_project_billing_info_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_billing.UpdateProjectBillingInfoRequest() - assert args[0] == request_msg @@ -7717,7 +7745,6 @@ def test_get_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -7738,7 +7765,6 @@ def test_set_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -7761,7 +7787,6 @@ def test_test_iam_permissions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -7784,7 +7809,6 @@ def test_move_billing_account_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_billing.MoveBillingAccountRequest() - assert args[0] == request_msg @@ -7832,7 +7856,6 @@ async def test_get_billing_account_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_billing.GetBillingAccountRequest() - assert args[0] == request_msg @@ -7861,7 +7884,6 @@ async def test_list_billing_accounts_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_billing.ListBillingAccountsRequest() - assert args[0] == request_msg @@ -7895,7 +7917,6 @@ async def test_update_billing_account_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_billing.UpdateBillingAccountRequest() - assert args[0] == request_msg @@ -7929,7 +7950,6 @@ async def test_create_billing_account_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_billing.CreateBillingAccountRequest() - assert args[0] == request_msg @@ -7958,7 +7978,6 @@ async def test_list_project_billing_info_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_billing.ListProjectBillingInfoRequest() - assert args[0] == request_msg @@ -7990,7 +8009,6 @@ async def test_get_project_billing_info_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_billing.GetProjectBillingInfoRequest() - assert args[0] == request_msg @@ -8022,7 +8040,6 @@ async def test_update_project_billing_info_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_billing.UpdateProjectBillingInfoRequest() - assert args[0] == request_msg @@ -8050,7 +8067,6 @@ async def test_get_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -8078,7 +8094,6 @@ async def test_set_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -8107,7 +8122,6 @@ async def test_test_iam_permissions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -8141,7 +8155,6 @@ async def test_move_billing_account_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_billing.MoveBillingAccountRequest() - assert args[0] == request_msg @@ -9913,7 +9926,6 @@ def test_get_billing_account_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_billing.GetBillingAccountRequest() - assert args[0] == request_msg @@ -9935,7 +9947,6 @@ def test_list_billing_accounts_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_billing.ListBillingAccountsRequest() - assert args[0] == request_msg @@ -9957,7 +9968,6 @@ def test_update_billing_account_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_billing.UpdateBillingAccountRequest() - assert args[0] == request_msg @@ -9979,7 +9989,6 @@ def test_create_billing_account_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_billing.CreateBillingAccountRequest() - assert args[0] == request_msg @@ -10001,7 +10010,6 @@ def test_list_project_billing_info_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_billing.ListProjectBillingInfoRequest() - assert args[0] == request_msg @@ -10023,7 +10031,6 @@ def test_get_project_billing_info_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_billing.GetProjectBillingInfoRequest() - assert args[0] == request_msg @@ -10045,7 +10052,6 @@ def test_update_project_billing_info_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_billing.UpdateProjectBillingInfoRequest() - assert args[0] == request_msg @@ -10065,7 +10071,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -10085,7 +10090,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -10107,7 +10111,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -10129,7 +10132,6 @@ def test_move_billing_account_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_billing.MoveBillingAccountRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-billing/tests/unit/gapic/billing_v1/test_cloud_catalog.py b/packages/google-cloud-billing/tests/unit/gapic/billing_v1/test_cloud_catalog.py index 9943822fdc00..90e824a5518c 100644 --- a/packages/google-cloud-billing/tests/unit/gapic/billing_v1/test_cloud_catalog.py +++ b/packages/google-cloud-billing/tests/unit/gapic/billing_v1/test_cloud_catalog.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 @@ -108,6 +109,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" @@ -1292,8 +1308,8 @@ def test_cloud_catalog_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - cloud_catalog.ListServicesRequest, - dict, + cloud_catalog.ListServicesRequest(), + {}, ], ) def test_list_services(request_type, transport: str = "grpc"): @@ -1304,7 +1320,7 @@ def test_list_services(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_services), "__call__") as call: @@ -1348,9 +1364,10 @@ def test_list_services_non_empty_request_with_auto_populated_field(): client.list_services(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_catalog.ListServicesRequest( + request_msg = cloud_catalog.ListServicesRequest( page_token="page_token_value", ) + assert args[0] == request_msg def test_list_services_use_cached_wrapped_rpc(): @@ -1431,9 +1448,14 @@ async def test_list_services_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_services_async( - transport: str = "grpc_asyncio", request_type=cloud_catalog.ListServicesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_catalog.ListServicesRequest(), + {}, + ], +) +async def test_list_services_async(request_type, transport: str = "grpc_asyncio"): client = CloudCatalogAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1441,7 +1463,7 @@ async def test_list_services_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_services), "__call__") as call: @@ -1464,11 +1486,6 @@ async def test_list_services_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_services_async_from_dict(): - await test_list_services_async(request_type=dict) - - def test_list_services_pager(transport_name: str = "grpc"): client = CloudCatalogClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1659,8 +1676,8 @@ async def test_list_services_async_pages(): @pytest.mark.parametrize( "request_type", [ - cloud_catalog.ListSkusRequest, - dict, + cloud_catalog.ListSkusRequest(), + {}, ], ) def test_list_skus(request_type, transport: str = "grpc"): @@ -1671,7 +1688,7 @@ def test_list_skus(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_skus), "__call__") as call: @@ -1717,11 +1734,12 @@ def test_list_skus_non_empty_request_with_auto_populated_field(): client.list_skus(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_catalog.ListSkusRequest( + request_msg = cloud_catalog.ListSkusRequest( parent="parent_value", currency_code="currency_code_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_skus_use_cached_wrapped_rpc(): @@ -1800,9 +1818,14 @@ async def test_list_skus_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_list_skus_async( - transport: str = "grpc_asyncio", request_type=cloud_catalog.ListSkusRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_catalog.ListSkusRequest(), + {}, + ], +) +async def test_list_skus_async(request_type, transport: str = "grpc_asyncio"): client = CloudCatalogAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1810,7 +1833,7 @@ async def test_list_skus_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_skus), "__call__") as call: @@ -1833,11 +1856,6 @@ async def test_list_skus_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_skus_async_from_dict(): - await test_list_skus_async(request_type=dict) - - def test_list_skus_field_headers(): client = CloudCatalogClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2649,7 +2667,6 @@ def test_list_services_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_catalog.ListServicesRequest() - assert args[0] == request_msg @@ -2670,7 +2687,6 @@ def test_list_skus_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_catalog.ListSkusRequest() - assert args[0] == request_msg @@ -2711,7 +2727,6 @@ async def test_list_services_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_catalog.ListServicesRequest() - assert args[0] == request_msg @@ -2738,7 +2753,6 @@ async def test_list_skus_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_catalog.ListSkusRequest() - assert args[0] == request_msg @@ -3030,7 +3044,6 @@ def test_list_services_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_catalog.ListServicesRequest() - assert args[0] == request_msg @@ -3050,7 +3063,6 @@ def test_list_skus_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_catalog.ListSkusRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-binary-authorization/noxfile.py b/packages/google-cloud-binary-authorization/noxfile.py index c0c165592abe..4ed4e5ad9604 100644 --- a/packages/google-cloud-binary-authorization/noxfile.py +++ b/packages/google-cloud-binary-authorization/noxfile.py @@ -47,7 +47,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-binary-authorization" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-binary-authorization/setup.py b/packages/google-cloud-binary-authorization/setup.py index 2e9500cff958..801bbc527e32 100644 --- a/packages/google-cloud-binary-authorization/setup.py +++ b/packages/google-cloud-binary-authorization/setup.py @@ -46,7 +46,7 @@ # See https://github.com/googleapis/google-cloud-python/issues/12364 "google-auth >= 2.14.1, <3.0.0,!=2.24.0,!=2.25.0", "grafeas >= 1.7.0, <2.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-binary-authorization/testing/constraints-3.10.txt b/packages/google-cloud-binary-authorization/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-binary-authorization/testing/constraints-3.10.txt +++ b/packages/google-cloud-binary-authorization/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-binary-authorization/tests/unit/gapic/binaryauthorization_v1/test_binauthz_management_service_v1.py b/packages/google-cloud-binary-authorization/tests/unit/gapic/binaryauthorization_v1/test_binauthz_management_service_v1.py index 469fb2c0c258..450f321c6436 100644 --- a/packages/google-cloud-binary-authorization/tests/unit/gapic/binaryauthorization_v1/test_binauthz_management_service_v1.py +++ b/packages/google-cloud-binary-authorization/tests/unit/gapic/binaryauthorization_v1/test_binauthz_management_service_v1.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 @@ -108,6 +109,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" @@ -1414,8 +1430,8 @@ def test_binauthz_management_service_v1_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - service.GetPolicyRequest, - dict, + service.GetPolicyRequest(), + {}, ], ) def test_get_policy(request_type, transport: str = "grpc"): @@ -1426,7 +1442,7 @@ def test_get_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(type(client.transport.get_policy), "__call__") as call: @@ -1477,9 +1493,10 @@ def test_get_policy_non_empty_request_with_auto_populated_field(): client.get_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetPolicyRequest( + request_msg = service.GetPolicyRequest( name="name_value", ) + assert args[0] == request_msg def test_get_policy_use_cached_wrapped_rpc(): @@ -1558,9 +1575,14 @@ async def test_get_policy_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_policy_async( - transport: str = "grpc_asyncio", request_type=service.GetPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetPolicyRequest(), + {}, + ], +) +async def test_get_policy_async(request_type, transport: str = "grpc_asyncio"): client = BinauthzManagementServiceV1AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1568,7 +1590,7 @@ async def test_get_policy_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_policy), "__call__") as call: @@ -1598,11 +1620,6 @@ async def test_get_policy_async( ) -@pytest.mark.asyncio -async def test_get_policy_async_from_dict(): - await test_get_policy_async(request_type=dict) - - def test_get_policy_field_headers(): client = BinauthzManagementServiceV1Client( credentials=ga_credentials.AnonymousCredentials(), @@ -1745,8 +1762,8 @@ async def test_get_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdatePolicyRequest, - dict, + service.UpdatePolicyRequest(), + {}, ], ) def test_update_policy(request_type, transport: str = "grpc"): @@ -1757,7 +1774,7 @@ def test_update_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(type(client.transport.update_policy), "__call__") as call: @@ -1806,7 +1823,8 @@ def test_update_policy_non_empty_request_with_auto_populated_field(): client.update_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdatePolicyRequest() + request_msg = service.UpdatePolicyRequest() + assert args[0] == request_msg def test_update_policy_use_cached_wrapped_rpc(): @@ -1887,9 +1905,14 @@ async def test_update_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_policy_async( - transport: str = "grpc_asyncio", request_type=service.UpdatePolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.UpdatePolicyRequest(), + {}, + ], +) +async def test_update_policy_async(request_type, transport: str = "grpc_asyncio"): client = BinauthzManagementServiceV1AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1897,7 +1920,7 @@ async def test_update_policy_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_policy), "__call__") as call: @@ -1927,11 +1950,6 @@ async def test_update_policy_async( ) -@pytest.mark.asyncio -async def test_update_policy_async_from_dict(): - await test_update_policy_async(request_type=dict) - - def test_update_policy_field_headers(): client = BinauthzManagementServiceV1Client( credentials=ga_credentials.AnonymousCredentials(), @@ -2074,8 +2092,8 @@ async def test_update_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.CreateAttestorRequest, - dict, + service.CreateAttestorRequest(), + {}, ], ) def test_create_attestor(request_type, transport: str = "grpc"): @@ -2086,7 +2104,7 @@ def test_create_attestor(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_attestor), "__call__") as call: @@ -2133,10 +2151,11 @@ def test_create_attestor_non_empty_request_with_auto_populated_field(): client.create_attestor(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateAttestorRequest( + request_msg = service.CreateAttestorRequest( parent="parent_value", attestor_id="attestor_id_value", ) + assert args[0] == request_msg def test_create_attestor_use_cached_wrapped_rpc(): @@ -2217,9 +2236,14 @@ async def test_create_attestor_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_attestor_async( - transport: str = "grpc_asyncio", request_type=service.CreateAttestorRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CreateAttestorRequest(), + {}, + ], +) +async def test_create_attestor_async(request_type, transport: str = "grpc_asyncio"): client = BinauthzManagementServiceV1AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2227,7 +2251,7 @@ async def test_create_attestor_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_attestor), "__call__") as call: @@ -2252,11 +2276,6 @@ async def test_create_attestor_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_create_attestor_async_from_dict(): - await test_create_attestor_async(request_type=dict) - - def test_create_attestor_field_headers(): client = BinauthzManagementServiceV1Client( credentials=ga_credentials.AnonymousCredentials(), @@ -2419,8 +2438,8 @@ async def test_create_attestor_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.GetAttestorRequest, - dict, + service.GetAttestorRequest(), + {}, ], ) def test_get_attestor(request_type, transport: str = "grpc"): @@ -2431,7 +2450,7 @@ def test_get_attestor(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_attestor), "__call__") as call: @@ -2477,9 +2496,10 @@ def test_get_attestor_non_empty_request_with_auto_populated_field(): client.get_attestor(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetAttestorRequest( + request_msg = service.GetAttestorRequest( name="name_value", ) + assert args[0] == request_msg def test_get_attestor_use_cached_wrapped_rpc(): @@ -2560,9 +2580,14 @@ async def test_get_attestor_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_attestor_async( - transport: str = "grpc_asyncio", request_type=service.GetAttestorRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetAttestorRequest(), + {}, + ], +) +async def test_get_attestor_async(request_type, transport: str = "grpc_asyncio"): client = BinauthzManagementServiceV1AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2570,7 +2595,7 @@ async def test_get_attestor_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_attestor), "__call__") as call: @@ -2595,11 +2620,6 @@ async def test_get_attestor_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_get_attestor_async_from_dict(): - await test_get_attestor_async(request_type=dict) - - def test_get_attestor_field_headers(): client = BinauthzManagementServiceV1Client( credentials=ga_credentials.AnonymousCredentials(), @@ -2742,8 +2762,8 @@ async def test_get_attestor_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdateAttestorRequest, - dict, + service.UpdateAttestorRequest(), + {}, ], ) def test_update_attestor(request_type, transport: str = "grpc"): @@ -2754,7 +2774,7 @@ def test_update_attestor(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_attestor), "__call__") as call: @@ -2798,7 +2818,8 @@ def test_update_attestor_non_empty_request_with_auto_populated_field(): client.update_attestor(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateAttestorRequest() + request_msg = service.UpdateAttestorRequest() + assert args[0] == request_msg def test_update_attestor_use_cached_wrapped_rpc(): @@ -2879,9 +2900,14 @@ async def test_update_attestor_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_attestor_async( - transport: str = "grpc_asyncio", request_type=service.UpdateAttestorRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateAttestorRequest(), + {}, + ], +) +async def test_update_attestor_async(request_type, transport: str = "grpc_asyncio"): client = BinauthzManagementServiceV1AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2889,7 +2915,7 @@ async def test_update_attestor_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_attestor), "__call__") as call: @@ -2914,11 +2940,6 @@ async def test_update_attestor_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_update_attestor_async_from_dict(): - await test_update_attestor_async(request_type=dict) - - def test_update_attestor_field_headers(): client = BinauthzManagementServiceV1Client( credentials=ga_credentials.AnonymousCredentials(), @@ -3061,8 +3082,8 @@ async def test_update_attestor_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListAttestorsRequest, - dict, + service.ListAttestorsRequest(), + {}, ], ) def test_list_attestors(request_type, transport: str = "grpc"): @@ -3073,7 +3094,7 @@ def test_list_attestors(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_attestors), "__call__") as call: @@ -3118,10 +3139,11 @@ def test_list_attestors_non_empty_request_with_auto_populated_field(): client.list_attestors(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListAttestorsRequest( + request_msg = service.ListAttestorsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_attestors_use_cached_wrapped_rpc(): @@ -3202,9 +3224,14 @@ async def test_list_attestors_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_attestors_async( - transport: str = "grpc_asyncio", request_type=service.ListAttestorsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListAttestorsRequest(), + {}, + ], +) +async def test_list_attestors_async(request_type, transport: str = "grpc_asyncio"): client = BinauthzManagementServiceV1AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3212,7 +3239,7 @@ async def test_list_attestors_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_attestors), "__call__") as call: @@ -3235,11 +3262,6 @@ async def test_list_attestors_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_attestors_async_from_dict(): - await test_list_attestors_async(request_type=dict) - - def test_list_attestors_field_headers(): client = BinauthzManagementServiceV1Client( credentials=ga_credentials.AnonymousCredentials(), @@ -3576,8 +3598,8 @@ async def test_list_attestors_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.DeleteAttestorRequest, - dict, + service.DeleteAttestorRequest(), + {}, ], ) def test_delete_attestor(request_type, transport: str = "grpc"): @@ -3588,7 +3610,7 @@ def test_delete_attestor(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_attestor), "__call__") as call: @@ -3629,9 +3651,10 @@ def test_delete_attestor_non_empty_request_with_auto_populated_field(): client.delete_attestor(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteAttestorRequest( + request_msg = service.DeleteAttestorRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_attestor_use_cached_wrapped_rpc(): @@ -3712,9 +3735,14 @@ async def test_delete_attestor_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_attestor_async( - transport: str = "grpc_asyncio", request_type=service.DeleteAttestorRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteAttestorRequest(), + {}, + ], +) +async def test_delete_attestor_async(request_type, transport: str = "grpc_asyncio"): client = BinauthzManagementServiceV1AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3722,7 +3750,7 @@ async def test_delete_attestor_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_attestor), "__call__") as call: @@ -3740,11 +3768,6 @@ async def test_delete_attestor_async( assert response is None -@pytest.mark.asyncio -async def test_delete_attestor_async_from_dict(): - await test_delete_attestor_async(request_type=dict) - - def test_delete_attestor_field_headers(): client = BinauthzManagementServiceV1Client( credentials=ga_credentials.AnonymousCredentials(), @@ -5324,7 +5347,6 @@ def test_get_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetPolicyRequest() - assert args[0] == request_msg @@ -5345,7 +5367,6 @@ def test_update_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdatePolicyRequest() - assert args[0] == request_msg @@ -5366,7 +5387,6 @@ def test_create_attestor_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateAttestorRequest() - assert args[0] == request_msg @@ -5387,7 +5407,6 @@ def test_get_attestor_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetAttestorRequest() - assert args[0] == request_msg @@ -5408,7 +5427,6 @@ def test_update_attestor_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateAttestorRequest() - assert args[0] == request_msg @@ -5429,7 +5447,6 @@ def test_list_attestors_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListAttestorsRequest() - assert args[0] == request_msg @@ -5450,7 +5467,6 @@ def test_delete_attestor_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteAttestorRequest() - assert args[0] == request_msg @@ -5493,7 +5509,6 @@ async def test_get_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetPolicyRequest() - assert args[0] == request_msg @@ -5522,7 +5537,6 @@ async def test_update_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdatePolicyRequest() - assert args[0] == request_msg @@ -5550,7 +5564,6 @@ async def test_create_attestor_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateAttestorRequest() - assert args[0] == request_msg @@ -5578,7 +5591,6 @@ async def test_get_attestor_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetAttestorRequest() - assert args[0] == request_msg @@ -5606,7 +5618,6 @@ async def test_update_attestor_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateAttestorRequest() - assert args[0] == request_msg @@ -5633,7 +5644,6 @@ async def test_list_attestors_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListAttestorsRequest() - assert args[0] == request_msg @@ -5656,7 +5666,6 @@ async def test_delete_attestor_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteAttestorRequest() - assert args[0] == request_msg @@ -6842,7 +6851,6 @@ def test_get_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetPolicyRequest() - assert args[0] == request_msg @@ -6862,7 +6870,6 @@ def test_update_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdatePolicyRequest() - assert args[0] == request_msg @@ -6882,7 +6889,6 @@ def test_create_attestor_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateAttestorRequest() - assert args[0] == request_msg @@ -6902,7 +6908,6 @@ def test_get_attestor_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetAttestorRequest() - assert args[0] == request_msg @@ -6922,7 +6927,6 @@ def test_update_attestor_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateAttestorRequest() - assert args[0] == request_msg @@ -6942,7 +6946,6 @@ def test_list_attestors_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListAttestorsRequest() - assert args[0] == request_msg @@ -6962,7 +6965,6 @@ def test_delete_attestor_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteAttestorRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-binary-authorization/tests/unit/gapic/binaryauthorization_v1/test_system_policy_v1.py b/packages/google-cloud-binary-authorization/tests/unit/gapic/binaryauthorization_v1/test_system_policy_v1.py index d471b45572c9..d87f29b79e3b 100644 --- a/packages/google-cloud-binary-authorization/tests/unit/gapic/binaryauthorization_v1/test_system_policy_v1.py +++ b/packages/google-cloud-binary-authorization/tests/unit/gapic/binaryauthorization_v1/test_system_policy_v1.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 @@ -107,6 +108,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" @@ -1314,8 +1330,8 @@ def test_system_policy_v1_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - service.GetSystemPolicyRequest, - dict, + service.GetSystemPolicyRequest(), + {}, ], ) def test_get_system_policy(request_type, transport: str = "grpc"): @@ -1326,7 +1342,7 @@ def test_get_system_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( @@ -1381,9 +1397,10 @@ def test_get_system_policy_non_empty_request_with_auto_populated_field(): client.get_system_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetSystemPolicyRequest( + request_msg = service.GetSystemPolicyRequest( name="name_value", ) + assert args[0] == request_msg def test_get_system_policy_use_cached_wrapped_rpc(): @@ -1466,9 +1483,14 @@ async def test_get_system_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_system_policy_async( - transport: str = "grpc_asyncio", request_type=service.GetSystemPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetSystemPolicyRequest(), + {}, + ], +) +async def test_get_system_policy_async(request_type, transport: str = "grpc_asyncio"): client = SystemPolicyV1AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1476,7 +1498,7 @@ async def test_get_system_policy_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( @@ -1508,11 +1530,6 @@ async def test_get_system_policy_async( ) -@pytest.mark.asyncio -async def test_get_system_policy_async_from_dict(): - await test_get_system_policy_async(request_type=dict) - - def test_get_system_policy_field_headers(): client = SystemPolicyV1Client( credentials=ga_credentials.AnonymousCredentials(), @@ -1963,7 +1980,6 @@ def test_get_system_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetSystemPolicyRequest() - assert args[0] == request_msg @@ -2008,7 +2024,6 @@ async def test_get_system_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetSystemPolicyRequest() - assert args[0] == request_msg @@ -2180,7 +2195,6 @@ def test_get_system_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetSystemPolicyRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-binary-authorization/tests/unit/gapic/binaryauthorization_v1/test_validation_helper_v1.py b/packages/google-cloud-binary-authorization/tests/unit/gapic/binaryauthorization_v1/test_validation_helper_v1.py index 684a88c79f59..9c8a41ce1cf5 100644 --- a/packages/google-cloud-binary-authorization/tests/unit/gapic/binaryauthorization_v1/test_validation_helper_v1.py +++ b/packages/google-cloud-binary-authorization/tests/unit/gapic/binaryauthorization_v1/test_validation_helper_v1.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 @@ -106,6 +107,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" @@ -1351,8 +1367,8 @@ def test_validation_helper_v1_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - service.ValidateAttestationOccurrenceRequest, - dict, + service.ValidateAttestationOccurrenceRequest(), + {}, ], ) def test_validate_attestation_occurrence(request_type, transport: str = "grpc"): @@ -1363,7 +1379,7 @@ def test_validate_attestation_occurrence(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1417,11 +1433,12 @@ def test_validate_attestation_occurrence_non_empty_request_with_auto_populated_f client.validate_attestation_occurrence(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ValidateAttestationOccurrenceRequest( + request_msg = service.ValidateAttestationOccurrenceRequest( attestor="attestor_value", occurrence_note="occurrence_note_value", occurrence_resource_uri="occurrence_resource_uri_value", ) + assert args[0] == request_msg def test_validate_attestation_occurrence_use_cached_wrapped_rpc(): @@ -1507,9 +1524,15 @@ async def test_validate_attestation_occurrence_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.ValidateAttestationOccurrenceRequest(), + {}, + ], +) async def test_validate_attestation_occurrence_async( - transport: str = "grpc_asyncio", - request_type=service.ValidateAttestationOccurrenceRequest, + request_type, transport: str = "grpc_asyncio" ): client = ValidationHelperV1AsyncClient( credentials=async_anonymous_credentials(), @@ -1518,7 +1541,7 @@ async def test_validate_attestation_occurrence_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( @@ -1547,11 +1570,6 @@ async def test_validate_attestation_occurrence_async( assert response.denial_reason == "denial_reason_value" -@pytest.mark.asyncio -async def test_validate_attestation_occurrence_async_from_dict(): - await test_validate_attestation_occurrence_async(request_type=dict) - - def test_validate_attestation_occurrence_field_headers(): client = ValidationHelperV1Client( credentials=ga_credentials.AnonymousCredentials(), @@ -1890,7 +1908,6 @@ def test_validate_attestation_occurrence_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ValidateAttestationOccurrenceRequest() - assert args[0] == request_msg @@ -1934,7 +1951,6 @@ async def test_validate_attestation_occurrence_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ValidateAttestationOccurrenceRequest() - assert args[0] == request_msg @@ -2112,7 +2128,6 @@ def test_validate_attestation_occurrence_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ValidateAttestationOccurrenceRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-binary-authorization/tests/unit/gapic/binaryauthorization_v1beta1/test_binauthz_management_service_v1_beta1.py b/packages/google-cloud-binary-authorization/tests/unit/gapic/binaryauthorization_v1beta1/test_binauthz_management_service_v1_beta1.py index f78aa8668f61..e0bdc08172d1 100644 --- a/packages/google-cloud-binary-authorization/tests/unit/gapic/binaryauthorization_v1beta1/test_binauthz_management_service_v1_beta1.py +++ b/packages/google-cloud-binary-authorization/tests/unit/gapic/binaryauthorization_v1beta1/test_binauthz_management_service_v1_beta1.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 @@ -108,6 +109,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" @@ -1451,8 +1467,8 @@ def test_binauthz_management_service_v1_beta1_client_create_channel_credentials_ @pytest.mark.parametrize( "request_type", [ - service.GetPolicyRequest, - dict, + service.GetPolicyRequest(), + {}, ], ) def test_get_policy(request_type, transport: str = "grpc"): @@ -1463,7 +1479,7 @@ def test_get_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(type(client.transport.get_policy), "__call__") as call: @@ -1514,9 +1530,10 @@ def test_get_policy_non_empty_request_with_auto_populated_field(): client.get_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetPolicyRequest( + request_msg = service.GetPolicyRequest( name="name_value", ) + assert args[0] == request_msg def test_get_policy_use_cached_wrapped_rpc(): @@ -1595,9 +1612,14 @@ async def test_get_policy_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_policy_async( - transport: str = "grpc_asyncio", request_type=service.GetPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetPolicyRequest(), + {}, + ], +) +async def test_get_policy_async(request_type, transport: str = "grpc_asyncio"): client = BinauthzManagementServiceV1Beta1AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1605,7 +1627,7 @@ async def test_get_policy_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_policy), "__call__") as call: @@ -1635,11 +1657,6 @@ async def test_get_policy_async( ) -@pytest.mark.asyncio -async def test_get_policy_async_from_dict(): - await test_get_policy_async(request_type=dict) - - def test_get_policy_field_headers(): client = BinauthzManagementServiceV1Beta1Client( credentials=ga_credentials.AnonymousCredentials(), @@ -1782,8 +1799,8 @@ async def test_get_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdatePolicyRequest, - dict, + service.UpdatePolicyRequest(), + {}, ], ) def test_update_policy(request_type, transport: str = "grpc"): @@ -1794,7 +1811,7 @@ def test_update_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(type(client.transport.update_policy), "__call__") as call: @@ -1843,7 +1860,8 @@ def test_update_policy_non_empty_request_with_auto_populated_field(): client.update_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdatePolicyRequest() + request_msg = service.UpdatePolicyRequest() + assert args[0] == request_msg def test_update_policy_use_cached_wrapped_rpc(): @@ -1924,9 +1942,14 @@ async def test_update_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_policy_async( - transport: str = "grpc_asyncio", request_type=service.UpdatePolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.UpdatePolicyRequest(), + {}, + ], +) +async def test_update_policy_async(request_type, transport: str = "grpc_asyncio"): client = BinauthzManagementServiceV1Beta1AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1934,7 +1957,7 @@ async def test_update_policy_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_policy), "__call__") as call: @@ -1964,11 +1987,6 @@ async def test_update_policy_async( ) -@pytest.mark.asyncio -async def test_update_policy_async_from_dict(): - await test_update_policy_async(request_type=dict) - - def test_update_policy_field_headers(): client = BinauthzManagementServiceV1Beta1Client( credentials=ga_credentials.AnonymousCredentials(), @@ -2111,8 +2129,8 @@ async def test_update_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.CreateAttestorRequest, - dict, + service.CreateAttestorRequest(), + {}, ], ) def test_create_attestor(request_type, transport: str = "grpc"): @@ -2123,7 +2141,7 @@ def test_create_attestor(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_attestor), "__call__") as call: @@ -2170,10 +2188,11 @@ def test_create_attestor_non_empty_request_with_auto_populated_field(): client.create_attestor(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateAttestorRequest( + request_msg = service.CreateAttestorRequest( parent="parent_value", attestor_id="attestor_id_value", ) + assert args[0] == request_msg def test_create_attestor_use_cached_wrapped_rpc(): @@ -2254,9 +2273,14 @@ async def test_create_attestor_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_attestor_async( - transport: str = "grpc_asyncio", request_type=service.CreateAttestorRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CreateAttestorRequest(), + {}, + ], +) +async def test_create_attestor_async(request_type, transport: str = "grpc_asyncio"): client = BinauthzManagementServiceV1Beta1AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2264,7 +2288,7 @@ async def test_create_attestor_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_attestor), "__call__") as call: @@ -2289,11 +2313,6 @@ async def test_create_attestor_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_create_attestor_async_from_dict(): - await test_create_attestor_async(request_type=dict) - - def test_create_attestor_field_headers(): client = BinauthzManagementServiceV1Beta1Client( credentials=ga_credentials.AnonymousCredentials(), @@ -2456,8 +2475,8 @@ async def test_create_attestor_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.GetAttestorRequest, - dict, + service.GetAttestorRequest(), + {}, ], ) def test_get_attestor(request_type, transport: str = "grpc"): @@ -2468,7 +2487,7 @@ def test_get_attestor(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_attestor), "__call__") as call: @@ -2514,9 +2533,10 @@ def test_get_attestor_non_empty_request_with_auto_populated_field(): client.get_attestor(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetAttestorRequest( + request_msg = service.GetAttestorRequest( name="name_value", ) + assert args[0] == request_msg def test_get_attestor_use_cached_wrapped_rpc(): @@ -2597,9 +2617,14 @@ async def test_get_attestor_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_attestor_async( - transport: str = "grpc_asyncio", request_type=service.GetAttestorRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetAttestorRequest(), + {}, + ], +) +async def test_get_attestor_async(request_type, transport: str = "grpc_asyncio"): client = BinauthzManagementServiceV1Beta1AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2607,7 +2632,7 @@ async def test_get_attestor_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_attestor), "__call__") as call: @@ -2632,11 +2657,6 @@ async def test_get_attestor_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_get_attestor_async_from_dict(): - await test_get_attestor_async(request_type=dict) - - def test_get_attestor_field_headers(): client = BinauthzManagementServiceV1Beta1Client( credentials=ga_credentials.AnonymousCredentials(), @@ -2779,8 +2799,8 @@ async def test_get_attestor_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdateAttestorRequest, - dict, + service.UpdateAttestorRequest(), + {}, ], ) def test_update_attestor(request_type, transport: str = "grpc"): @@ -2791,7 +2811,7 @@ def test_update_attestor(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_attestor), "__call__") as call: @@ -2835,7 +2855,8 @@ def test_update_attestor_non_empty_request_with_auto_populated_field(): client.update_attestor(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateAttestorRequest() + request_msg = service.UpdateAttestorRequest() + assert args[0] == request_msg def test_update_attestor_use_cached_wrapped_rpc(): @@ -2916,9 +2937,14 @@ async def test_update_attestor_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_attestor_async( - transport: str = "grpc_asyncio", request_type=service.UpdateAttestorRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateAttestorRequest(), + {}, + ], +) +async def test_update_attestor_async(request_type, transport: str = "grpc_asyncio"): client = BinauthzManagementServiceV1Beta1AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2926,7 +2952,7 @@ async def test_update_attestor_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_attestor), "__call__") as call: @@ -2951,11 +2977,6 @@ async def test_update_attestor_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_update_attestor_async_from_dict(): - await test_update_attestor_async(request_type=dict) - - def test_update_attestor_field_headers(): client = BinauthzManagementServiceV1Beta1Client( credentials=ga_credentials.AnonymousCredentials(), @@ -3098,8 +3119,8 @@ async def test_update_attestor_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListAttestorsRequest, - dict, + service.ListAttestorsRequest(), + {}, ], ) def test_list_attestors(request_type, transport: str = "grpc"): @@ -3110,7 +3131,7 @@ def test_list_attestors(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_attestors), "__call__") as call: @@ -3155,10 +3176,11 @@ def test_list_attestors_non_empty_request_with_auto_populated_field(): client.list_attestors(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListAttestorsRequest( + request_msg = service.ListAttestorsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_attestors_use_cached_wrapped_rpc(): @@ -3239,9 +3261,14 @@ async def test_list_attestors_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_attestors_async( - transport: str = "grpc_asyncio", request_type=service.ListAttestorsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListAttestorsRequest(), + {}, + ], +) +async def test_list_attestors_async(request_type, transport: str = "grpc_asyncio"): client = BinauthzManagementServiceV1Beta1AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3249,7 +3276,7 @@ async def test_list_attestors_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_attestors), "__call__") as call: @@ -3272,11 +3299,6 @@ async def test_list_attestors_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_attestors_async_from_dict(): - await test_list_attestors_async(request_type=dict) - - def test_list_attestors_field_headers(): client = BinauthzManagementServiceV1Beta1Client( credentials=ga_credentials.AnonymousCredentials(), @@ -3613,8 +3635,8 @@ async def test_list_attestors_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.DeleteAttestorRequest, - dict, + service.DeleteAttestorRequest(), + {}, ], ) def test_delete_attestor(request_type, transport: str = "grpc"): @@ -3625,7 +3647,7 @@ def test_delete_attestor(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_attestor), "__call__") as call: @@ -3666,9 +3688,10 @@ def test_delete_attestor_non_empty_request_with_auto_populated_field(): client.delete_attestor(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteAttestorRequest( + request_msg = service.DeleteAttestorRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_attestor_use_cached_wrapped_rpc(): @@ -3749,9 +3772,14 @@ async def test_delete_attestor_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_attestor_async( - transport: str = "grpc_asyncio", request_type=service.DeleteAttestorRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteAttestorRequest(), + {}, + ], +) +async def test_delete_attestor_async(request_type, transport: str = "grpc_asyncio"): client = BinauthzManagementServiceV1Beta1AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3759,7 +3787,7 @@ async def test_delete_attestor_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_attestor), "__call__") as call: @@ -3777,11 +3805,6 @@ async def test_delete_attestor_async( assert response is None -@pytest.mark.asyncio -async def test_delete_attestor_async_from_dict(): - await test_delete_attestor_async(request_type=dict) - - def test_delete_attestor_field_headers(): client = BinauthzManagementServiceV1Beta1Client( credentials=ga_credentials.AnonymousCredentials(), @@ -5363,7 +5386,6 @@ def test_get_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetPolicyRequest() - assert args[0] == request_msg @@ -5384,7 +5406,6 @@ def test_update_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdatePolicyRequest() - assert args[0] == request_msg @@ -5405,7 +5426,6 @@ def test_create_attestor_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateAttestorRequest() - assert args[0] == request_msg @@ -5426,7 +5446,6 @@ def test_get_attestor_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetAttestorRequest() - assert args[0] == request_msg @@ -5447,7 +5466,6 @@ def test_update_attestor_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateAttestorRequest() - assert args[0] == request_msg @@ -5468,7 +5486,6 @@ def test_list_attestors_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListAttestorsRequest() - assert args[0] == request_msg @@ -5489,7 +5506,6 @@ def test_delete_attestor_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteAttestorRequest() - assert args[0] == request_msg @@ -5532,7 +5548,6 @@ async def test_get_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetPolicyRequest() - assert args[0] == request_msg @@ -5561,7 +5576,6 @@ async def test_update_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdatePolicyRequest() - assert args[0] == request_msg @@ -5589,7 +5603,6 @@ async def test_create_attestor_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateAttestorRequest() - assert args[0] == request_msg @@ -5617,7 +5630,6 @@ async def test_get_attestor_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetAttestorRequest() - assert args[0] == request_msg @@ -5645,7 +5657,6 @@ async def test_update_attestor_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateAttestorRequest() - assert args[0] == request_msg @@ -5672,7 +5683,6 @@ async def test_list_attestors_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListAttestorsRequest() - assert args[0] == request_msg @@ -5695,7 +5705,6 @@ async def test_delete_attestor_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteAttestorRequest() - assert args[0] == request_msg @@ -6891,7 +6900,6 @@ def test_get_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetPolicyRequest() - assert args[0] == request_msg @@ -6911,7 +6919,6 @@ def test_update_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdatePolicyRequest() - assert args[0] == request_msg @@ -6931,7 +6938,6 @@ def test_create_attestor_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateAttestorRequest() - assert args[0] == request_msg @@ -6951,7 +6957,6 @@ def test_get_attestor_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetAttestorRequest() - assert args[0] == request_msg @@ -6971,7 +6976,6 @@ def test_update_attestor_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateAttestorRequest() - assert args[0] == request_msg @@ -6991,7 +6995,6 @@ def test_list_attestors_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListAttestorsRequest() - assert args[0] == request_msg @@ -7011,7 +7014,6 @@ def test_delete_attestor_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteAttestorRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-binary-authorization/tests/unit/gapic/binaryauthorization_v1beta1/test_system_policy_v1_beta1.py b/packages/google-cloud-binary-authorization/tests/unit/gapic/binaryauthorization_v1beta1/test_system_policy_v1_beta1.py index ab4c6d890cf6..1dff1352d34f 100644 --- a/packages/google-cloud-binary-authorization/tests/unit/gapic/binaryauthorization_v1beta1/test_system_policy_v1_beta1.py +++ b/packages/google-cloud-binary-authorization/tests/unit/gapic/binaryauthorization_v1beta1/test_system_policy_v1_beta1.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 @@ -107,6 +108,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" @@ -1370,8 +1386,8 @@ def test_system_policy_v1_beta1_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - service.GetSystemPolicyRequest, - dict, + service.GetSystemPolicyRequest(), + {}, ], ) def test_get_system_policy(request_type, transport: str = "grpc"): @@ -1382,7 +1398,7 @@ def test_get_system_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( @@ -1437,9 +1453,10 @@ def test_get_system_policy_non_empty_request_with_auto_populated_field(): client.get_system_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetSystemPolicyRequest( + request_msg = service.GetSystemPolicyRequest( name="name_value", ) + assert args[0] == request_msg def test_get_system_policy_use_cached_wrapped_rpc(): @@ -1522,9 +1539,14 @@ async def test_get_system_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_system_policy_async( - transport: str = "grpc_asyncio", request_type=service.GetSystemPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetSystemPolicyRequest(), + {}, + ], +) +async def test_get_system_policy_async(request_type, transport: str = "grpc_asyncio"): client = SystemPolicyV1Beta1AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1532,7 +1554,7 @@ async def test_get_system_policy_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( @@ -1564,11 +1586,6 @@ async def test_get_system_policy_async( ) -@pytest.mark.asyncio -async def test_get_system_policy_async_from_dict(): - await test_get_system_policy_async(request_type=dict) - - def test_get_system_policy_field_headers(): client = SystemPolicyV1Beta1Client( credentials=ga_credentials.AnonymousCredentials(), @@ -2019,7 +2036,6 @@ def test_get_system_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetSystemPolicyRequest() - assert args[0] == request_msg @@ -2064,7 +2080,6 @@ async def test_get_system_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetSystemPolicyRequest() - assert args[0] == request_msg @@ -2236,7 +2251,6 @@ def test_get_system_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetSystemPolicyRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-build/noxfile.py b/packages/google-cloud-build/noxfile.py index 6bc5ffe19019..a0694e258d3f 100644 --- a/packages/google-cloud-build/noxfile.py +++ b/packages/google-cloud-build/noxfile.py @@ -47,7 +47,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-build" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-build/setup.py b/packages/google-cloud-build/setup.py index a0998d8ba18c..103e6bbcc6f5 100644 --- a/packages/google-cloud-build/setup.py +++ b/packages/google-cloud-build/setup.py @@ -46,7 +46,7 @@ # See https://github.com/googleapis/google-cloud-python/issues/12364 "google-auth >= 2.14.1, <3.0.0,!=2.24.0,!=2.25.0", "grpc-google-iam-v1 >=0.12.4, <1.0.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-build/testing/constraints-3.10.txt b/packages/google-cloud-build/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-build/testing/constraints-3.10.txt +++ b/packages/google-cloud-build/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-build/tests/unit/gapic/cloudbuild_v1/test_cloud_build.py b/packages/google-cloud-build/tests/unit/gapic/cloudbuild_v1/test_cloud_build.py index 8cf3565b45a3..0a29eafbef44 100644 --- a/packages/google-cloud-build/tests/unit/gapic/cloudbuild_v1/test_cloud_build.py +++ b/packages/google-cloud-build/tests/unit/gapic/cloudbuild_v1/test_cloud_build.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 @@ -118,6 +119,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" @@ -1279,8 +1295,8 @@ def test_cloud_build_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - cloudbuild.CreateBuildRequest, - dict, + cloudbuild.CreateBuildRequest(), + {}, ], ) def test_create_build(request_type, transport: str = "grpc"): @@ -1291,7 +1307,7 @@ def test_create_build(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_build), "__call__") as call: @@ -1333,10 +1349,11 @@ def test_create_build_non_empty_request_with_auto_populated_field(): client.create_build(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudbuild.CreateBuildRequest( + request_msg = cloudbuild.CreateBuildRequest( parent="parent_value", project_id="project_id_value", ) + assert args[0] == request_msg def test_create_build_use_cached_wrapped_rpc(): @@ -1427,9 +1444,14 @@ async def test_create_build_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_build_async( - transport: str = "grpc_asyncio", request_type=cloudbuild.CreateBuildRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudbuild.CreateBuildRequest(), + {}, + ], +) +async def test_create_build_async(request_type, transport: str = "grpc_asyncio"): client = CloudBuildAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1437,7 +1459,7 @@ async def test_create_build_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_build), "__call__") as call: @@ -1457,11 +1479,6 @@ async def test_create_build_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_build_async_from_dict(): - await test_create_build_async(request_type=dict) - - def test_create_build_flattened(): client = CloudBuildClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1567,8 +1584,8 @@ async def test_create_build_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloudbuild.GetBuildRequest, - dict, + cloudbuild.GetBuildRequest(), + {}, ], ) def test_get_build(request_type, transport: str = "grpc"): @@ -1579,7 +1596,7 @@ def test_get_build(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_build), "__call__") as call: @@ -1645,11 +1662,12 @@ def test_get_build_non_empty_request_with_auto_populated_field(): client.get_build(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudbuild.GetBuildRequest( + request_msg = cloudbuild.GetBuildRequest( name="name_value", project_id="project_id_value", id="id_value", ) + assert args[0] == request_msg def test_get_build_use_cached_wrapped_rpc(): @@ -1728,9 +1746,14 @@ async def test_get_build_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_build_async( - transport: str = "grpc_asyncio", request_type=cloudbuild.GetBuildRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudbuild.GetBuildRequest(), + {}, + ], +) +async def test_get_build_async(request_type, transport: str = "grpc_asyncio"): client = CloudBuildAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1738,7 +1761,7 @@ async def test_get_build_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_build), "__call__") as call: @@ -1781,11 +1804,6 @@ async def test_get_build_async( assert response.service_account == "service_account_value" -@pytest.mark.asyncio -async def test_get_build_async_from_dict(): - await test_get_build_async(request_type=dict) - - def test_get_build_flattened(): client = CloudBuildClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1889,8 +1907,8 @@ async def test_get_build_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloudbuild.ListBuildsRequest, - dict, + cloudbuild.ListBuildsRequest(), + {}, ], ) def test_list_builds(request_type, transport: str = "grpc"): @@ -1901,7 +1919,7 @@ def test_list_builds(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_builds), "__call__") as call: @@ -1948,12 +1966,13 @@ def test_list_builds_non_empty_request_with_auto_populated_field(): client.list_builds(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudbuild.ListBuildsRequest( + request_msg = cloudbuild.ListBuildsRequest( parent="parent_value", project_id="project_id_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_builds_use_cached_wrapped_rpc(): @@ -2034,9 +2053,14 @@ async def test_list_builds_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_builds_async( - transport: str = "grpc_asyncio", request_type=cloudbuild.ListBuildsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudbuild.ListBuildsRequest(), + {}, + ], +) +async def test_list_builds_async(request_type, transport: str = "grpc_asyncio"): client = CloudBuildAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2044,7 +2068,7 @@ async def test_list_builds_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_builds), "__call__") as call: @@ -2067,11 +2091,6 @@ async def test_list_builds_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_builds_async_from_dict(): - await test_list_builds_async(request_type=dict) - - def test_list_builds_flattened(): client = CloudBuildClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2354,8 +2373,8 @@ async def test_list_builds_async_pages(): @pytest.mark.parametrize( "request_type", [ - cloudbuild.CancelBuildRequest, - dict, + cloudbuild.CancelBuildRequest(), + {}, ], ) def test_cancel_build(request_type, transport: str = "grpc"): @@ -2366,7 +2385,7 @@ def test_cancel_build(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.cancel_build), "__call__") as call: @@ -2432,11 +2451,12 @@ def test_cancel_build_non_empty_request_with_auto_populated_field(): client.cancel_build(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudbuild.CancelBuildRequest( + request_msg = cloudbuild.CancelBuildRequest( name="name_value", project_id="project_id_value", id="id_value", ) + assert args[0] == request_msg def test_cancel_build_use_cached_wrapped_rpc(): @@ -2517,9 +2537,14 @@ async def test_cancel_build_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_cancel_build_async( - transport: str = "grpc_asyncio", request_type=cloudbuild.CancelBuildRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudbuild.CancelBuildRequest(), + {}, + ], +) +async def test_cancel_build_async(request_type, transport: str = "grpc_asyncio"): client = CloudBuildAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2527,7 +2552,7 @@ async def test_cancel_build_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.cancel_build), "__call__") as call: @@ -2570,11 +2595,6 @@ async def test_cancel_build_async( assert response.service_account == "service_account_value" -@pytest.mark.asyncio -async def test_cancel_build_async_from_dict(): - await test_cancel_build_async(request_type=dict) - - def test_cancel_build_flattened(): client = CloudBuildClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2678,8 +2698,8 @@ async def test_cancel_build_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloudbuild.RetryBuildRequest, - dict, + cloudbuild.RetryBuildRequest(), + {}, ], ) def test_retry_build(request_type, transport: str = "grpc"): @@ -2690,7 +2710,7 @@ def test_retry_build(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.retry_build), "__call__") as call: @@ -2733,11 +2753,12 @@ def test_retry_build_non_empty_request_with_auto_populated_field(): client.retry_build(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudbuild.RetryBuildRequest( + request_msg = cloudbuild.RetryBuildRequest( name="name_value", project_id="project_id_value", id="id_value", ) + assert args[0] == request_msg def test_retry_build_use_cached_wrapped_rpc(): @@ -2828,9 +2849,14 @@ async def test_retry_build_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_retry_build_async( - transport: str = "grpc_asyncio", request_type=cloudbuild.RetryBuildRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudbuild.RetryBuildRequest(), + {}, + ], +) +async def test_retry_build_async(request_type, transport: str = "grpc_asyncio"): client = CloudBuildAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2838,7 +2864,7 @@ async def test_retry_build_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.retry_build), "__call__") as call: @@ -2858,11 +2884,6 @@ async def test_retry_build_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_retry_build_async_from_dict(): - await test_retry_build_async(request_type=dict) - - def test_retry_build_flattened(): client = CloudBuildClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2968,8 +2989,8 @@ async def test_retry_build_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloudbuild.ApproveBuildRequest, - dict, + cloudbuild.ApproveBuildRequest(), + {}, ], ) def test_approve_build(request_type, transport: str = "grpc"): @@ -2980,7 +3001,7 @@ def test_approve_build(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.approve_build), "__call__") as call: @@ -3021,9 +3042,10 @@ def test_approve_build_non_empty_request_with_auto_populated_field(): client.approve_build(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudbuild.ApproveBuildRequest( + request_msg = cloudbuild.ApproveBuildRequest( name="name_value", ) + assert args[0] == request_msg def test_approve_build_use_cached_wrapped_rpc(): @@ -3114,9 +3136,14 @@ async def test_approve_build_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_approve_build_async( - transport: str = "grpc_asyncio", request_type=cloudbuild.ApproveBuildRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudbuild.ApproveBuildRequest(), + {}, + ], +) +async def test_approve_build_async(request_type, transport: str = "grpc_asyncio"): client = CloudBuildAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3124,7 +3151,7 @@ async def test_approve_build_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.approve_build), "__call__") as call: @@ -3144,11 +3171,6 @@ async def test_approve_build_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_approve_build_async_from_dict(): - await test_approve_build_async(request_type=dict) - - def test_approve_build_flattened(): client = CloudBuildClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3252,8 +3274,8 @@ async def test_approve_build_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloudbuild.CreateBuildTriggerRequest, - dict, + cloudbuild.CreateBuildTriggerRequest(), + {}, ], ) def test_create_build_trigger(request_type, transport: str = "grpc"): @@ -3264,7 +3286,7 @@ def test_create_build_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( @@ -3332,10 +3354,11 @@ def test_create_build_trigger_non_empty_request_with_auto_populated_field(): client.create_build_trigger(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudbuild.CreateBuildTriggerRequest( + request_msg = cloudbuild.CreateBuildTriggerRequest( parent="parent_value", project_id="project_id_value", ) + assert args[0] == request_msg def test_create_build_trigger_use_cached_wrapped_rpc(): @@ -3420,8 +3443,15 @@ async def test_create_build_trigger_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloudbuild.CreateBuildTriggerRequest(), + {}, + ], +) async def test_create_build_trigger_async( - transport: str = "grpc_asyncio", request_type=cloudbuild.CreateBuildTriggerRequest + request_type, transport: str = "grpc_asyncio" ): client = CloudBuildAsyncClient( credentials=async_anonymous_credentials(), @@ -3430,7 +3460,7 @@ async def test_create_build_trigger_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( @@ -3473,11 +3503,6 @@ async def test_create_build_trigger_async( assert response.service_account == "service_account_value" -@pytest.mark.asyncio -async def test_create_build_trigger_async_from_dict(): - await test_create_build_trigger_async(request_type=dict) - - def test_create_build_trigger_flattened(): client = CloudBuildClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3587,8 +3612,8 @@ async def test_create_build_trigger_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloudbuild.GetBuildTriggerRequest, - dict, + cloudbuild.GetBuildTriggerRequest(), + {}, ], ) def test_get_build_trigger(request_type, transport: str = "grpc"): @@ -3599,7 +3624,7 @@ def test_get_build_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( @@ -3668,11 +3693,12 @@ def test_get_build_trigger_non_empty_request_with_auto_populated_field(): client.get_build_trigger(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudbuild.GetBuildTriggerRequest( + request_msg = cloudbuild.GetBuildTriggerRequest( name="name_value", project_id="project_id_value", trigger_id="trigger_id_value", ) + assert args[0] == request_msg def test_get_build_trigger_use_cached_wrapped_rpc(): @@ -3755,9 +3781,14 @@ async def test_get_build_trigger_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_build_trigger_async( - transport: str = "grpc_asyncio", request_type=cloudbuild.GetBuildTriggerRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudbuild.GetBuildTriggerRequest(), + {}, + ], +) +async def test_get_build_trigger_async(request_type, transport: str = "grpc_asyncio"): client = CloudBuildAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3765,7 +3796,7 @@ async def test_get_build_trigger_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( @@ -3808,11 +3839,6 @@ async def test_get_build_trigger_async( assert response.service_account == "service_account_value" -@pytest.mark.asyncio -async def test_get_build_trigger_async_from_dict(): - await test_get_build_trigger_async(request_type=dict) - - def test_get_build_trigger_flattened(): client = CloudBuildClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3922,8 +3948,8 @@ async def test_get_build_trigger_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloudbuild.ListBuildTriggersRequest, - dict, + cloudbuild.ListBuildTriggersRequest(), + {}, ], ) def test_list_build_triggers(request_type, transport: str = "grpc"): @@ -3934,7 +3960,7 @@ def test_list_build_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( @@ -3984,11 +4010,12 @@ def test_list_build_triggers_non_empty_request_with_auto_populated_field(): client.list_build_triggers(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudbuild.ListBuildTriggersRequest( + request_msg = cloudbuild.ListBuildTriggersRequest( parent="parent_value", project_id="project_id_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_build_triggers_use_cached_wrapped_rpc(): @@ -4073,9 +4100,14 @@ async def test_list_build_triggers_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_build_triggers_async( - transport: str = "grpc_asyncio", request_type=cloudbuild.ListBuildTriggersRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudbuild.ListBuildTriggersRequest(), + {}, + ], +) +async def test_list_build_triggers_async(request_type, transport: str = "grpc_asyncio"): client = CloudBuildAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4083,7 +4115,7 @@ async def test_list_build_triggers_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( @@ -4108,11 +4140,6 @@ async def test_list_build_triggers_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_build_triggers_async_from_dict(): - await test_list_build_triggers_async(request_type=dict) - - def test_list_build_triggers_flattened(): client = CloudBuildClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4397,8 +4424,8 @@ async def test_list_build_triggers_async_pages(): @pytest.mark.parametrize( "request_type", [ - cloudbuild.DeleteBuildTriggerRequest, - dict, + cloudbuild.DeleteBuildTriggerRequest(), + {}, ], ) def test_delete_build_trigger(request_type, transport: str = "grpc"): @@ -4409,7 +4436,7 @@ def test_delete_build_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( @@ -4456,11 +4483,12 @@ def test_delete_build_trigger_non_empty_request_with_auto_populated_field(): client.delete_build_trigger(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudbuild.DeleteBuildTriggerRequest( + request_msg = cloudbuild.DeleteBuildTriggerRequest( name="name_value", project_id="project_id_value", trigger_id="trigger_id_value", ) + assert args[0] == request_msg def test_delete_build_trigger_use_cached_wrapped_rpc(): @@ -4545,8 +4573,15 @@ async def test_delete_build_trigger_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloudbuild.DeleteBuildTriggerRequest(), + {}, + ], +) async def test_delete_build_trigger_async( - transport: str = "grpc_asyncio", request_type=cloudbuild.DeleteBuildTriggerRequest + request_type, transport: str = "grpc_asyncio" ): client = CloudBuildAsyncClient( credentials=async_anonymous_credentials(), @@ -4555,7 +4590,7 @@ async def test_delete_build_trigger_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( @@ -4575,11 +4610,6 @@ async def test_delete_build_trigger_async( assert response is None -@pytest.mark.asyncio -async def test_delete_build_trigger_async_from_dict(): - await test_delete_build_trigger_async(request_type=dict) - - def test_delete_build_trigger_flattened(): client = CloudBuildClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4687,8 +4717,8 @@ async def test_delete_build_trigger_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloudbuild.UpdateBuildTriggerRequest, - dict, + cloudbuild.UpdateBuildTriggerRequest(), + {}, ], ) def test_update_build_trigger(request_type, transport: str = "grpc"): @@ -4699,7 +4729,7 @@ def test_update_build_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( @@ -4767,10 +4797,11 @@ def test_update_build_trigger_non_empty_request_with_auto_populated_field(): client.update_build_trigger(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudbuild.UpdateBuildTriggerRequest( + request_msg = cloudbuild.UpdateBuildTriggerRequest( project_id="project_id_value", trigger_id="trigger_id_value", ) + assert args[0] == request_msg def test_update_build_trigger_use_cached_wrapped_rpc(): @@ -4855,8 +4886,15 @@ async def test_update_build_trigger_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloudbuild.UpdateBuildTriggerRequest(), + {}, + ], +) async def test_update_build_trigger_async( - transport: str = "grpc_asyncio", request_type=cloudbuild.UpdateBuildTriggerRequest + request_type, transport: str = "grpc_asyncio" ): client = CloudBuildAsyncClient( credentials=async_anonymous_credentials(), @@ -4865,7 +4903,7 @@ async def test_update_build_trigger_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( @@ -4908,11 +4946,6 @@ async def test_update_build_trigger_async( assert response.service_account == "service_account_value" -@pytest.mark.asyncio -async def test_update_build_trigger_async_from_dict(): - await test_update_build_trigger_async(request_type=dict) - - def test_update_build_trigger_flattened(): client = CloudBuildClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5022,8 +5055,8 @@ async def test_update_build_trigger_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloudbuild.RunBuildTriggerRequest, - dict, + cloudbuild.RunBuildTriggerRequest(), + {}, ], ) def test_run_build_trigger(request_type, transport: str = "grpc"): @@ -5034,7 +5067,7 @@ def test_run_build_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( @@ -5081,11 +5114,12 @@ def test_run_build_trigger_non_empty_request_with_auto_populated_field(): client.run_build_trigger(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudbuild.RunBuildTriggerRequest( + request_msg = cloudbuild.RunBuildTriggerRequest( name="name_value", project_id="project_id_value", trigger_id="trigger_id_value", ) + assert args[0] == request_msg def test_run_build_trigger_use_cached_wrapped_rpc(): @@ -5178,9 +5212,14 @@ async def test_run_build_trigger_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_run_build_trigger_async( - transport: str = "grpc_asyncio", request_type=cloudbuild.RunBuildTriggerRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudbuild.RunBuildTriggerRequest(), + {}, + ], +) +async def test_run_build_trigger_async(request_type, transport: str = "grpc_asyncio"): client = CloudBuildAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5188,7 +5227,7 @@ async def test_run_build_trigger_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( @@ -5210,11 +5249,6 @@ async def test_run_build_trigger_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_run_build_trigger_async_from_dict(): - await test_run_build_trigger_async(request_type=dict) - - def test_run_build_trigger_flattened(): client = CloudBuildClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5324,8 +5358,8 @@ async def test_run_build_trigger_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloudbuild.ReceiveTriggerWebhookRequest, - dict, + cloudbuild.ReceiveTriggerWebhookRequest(), + {}, ], ) def test_receive_trigger_webhook(request_type, transport: str = "grpc"): @@ -5336,7 +5370,7 @@ def test_receive_trigger_webhook(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5384,12 +5418,13 @@ def test_receive_trigger_webhook_non_empty_request_with_auto_populated_field(): client.receive_trigger_webhook(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudbuild.ReceiveTriggerWebhookRequest( + request_msg = cloudbuild.ReceiveTriggerWebhookRequest( name="name_value", project_id="project_id_value", trigger="trigger_value", secret="secret_value", ) + assert args[0] == request_msg def test_receive_trigger_webhook_use_cached_wrapped_rpc(): @@ -5475,9 +5510,15 @@ async def test_receive_trigger_webhook_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloudbuild.ReceiveTriggerWebhookRequest(), + {}, + ], +) async def test_receive_trigger_webhook_async( - transport: str = "grpc_asyncio", - request_type=cloudbuild.ReceiveTriggerWebhookRequest, + request_type, transport: str = "grpc_asyncio" ): client = CloudBuildAsyncClient( credentials=async_anonymous_credentials(), @@ -5486,7 +5527,7 @@ async def test_receive_trigger_webhook_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( @@ -5508,11 +5549,6 @@ async def test_receive_trigger_webhook_async( assert isinstance(response, cloudbuild.ReceiveTriggerWebhookResponse) -@pytest.mark.asyncio -async def test_receive_trigger_webhook_async_from_dict(): - await test_receive_trigger_webhook_async(request_type=dict) - - def test_receive_trigger_webhook_field_headers(): client = CloudBuildClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5583,8 +5619,8 @@ async def test_receive_trigger_webhook_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - cloudbuild.CreateWorkerPoolRequest, - dict, + cloudbuild.CreateWorkerPoolRequest(), + {}, ], ) def test_create_worker_pool(request_type, transport: str = "grpc"): @@ -5595,7 +5631,7 @@ def test_create_worker_pool(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5641,10 +5677,11 @@ def test_create_worker_pool_non_empty_request_with_auto_populated_field(): client.create_worker_pool(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudbuild.CreateWorkerPoolRequest( + request_msg = cloudbuild.CreateWorkerPoolRequest( parent="parent_value", worker_pool_id="worker_pool_id_value", ) + assert args[0] == request_msg def test_create_worker_pool_use_cached_wrapped_rpc(): @@ -5739,9 +5776,14 @@ async def test_create_worker_pool_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_worker_pool_async( - transport: str = "grpc_asyncio", request_type=cloudbuild.CreateWorkerPoolRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudbuild.CreateWorkerPoolRequest(), + {}, + ], +) +async def test_create_worker_pool_async(request_type, transport: str = "grpc_asyncio"): client = CloudBuildAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5749,7 +5791,7 @@ async def test_create_worker_pool_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( @@ -5771,11 +5813,6 @@ async def test_create_worker_pool_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_worker_pool_async_from_dict(): - await test_create_worker_pool_async(request_type=dict) - - def test_create_worker_pool_flattened(): client = CloudBuildClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5885,8 +5922,8 @@ async def test_create_worker_pool_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloudbuild.GetWorkerPoolRequest, - dict, + cloudbuild.GetWorkerPoolRequest(), + {}, ], ) def test_get_worker_pool(request_type, transport: str = "grpc"): @@ -5897,7 +5934,7 @@ def test_get_worker_pool(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_worker_pool), "__call__") as call: @@ -5949,9 +5986,10 @@ def test_get_worker_pool_non_empty_request_with_auto_populated_field(): client.get_worker_pool(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudbuild.GetWorkerPoolRequest( + request_msg = cloudbuild.GetWorkerPoolRequest( name="name_value", ) + assert args[0] == request_msg def test_get_worker_pool_use_cached_wrapped_rpc(): @@ -6032,9 +6070,14 @@ async def test_get_worker_pool_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_worker_pool_async( - transport: str = "grpc_asyncio", request_type=cloudbuild.GetWorkerPoolRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudbuild.GetWorkerPoolRequest(), + {}, + ], +) +async def test_get_worker_pool_async(request_type, transport: str = "grpc_asyncio"): client = CloudBuildAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6042,7 +6085,7 @@ async def test_get_worker_pool_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_worker_pool), "__call__") as call: @@ -6073,11 +6116,6 @@ async def test_get_worker_pool_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_worker_pool_async_from_dict(): - await test_get_worker_pool_async(request_type=dict) - - def test_get_worker_pool_flattened(): client = CloudBuildClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6163,8 +6201,8 @@ async def test_get_worker_pool_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloudbuild.DeleteWorkerPoolRequest, - dict, + cloudbuild.DeleteWorkerPoolRequest(), + {}, ], ) def test_delete_worker_pool(request_type, transport: str = "grpc"): @@ -6175,7 +6213,7 @@ def test_delete_worker_pool(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6221,10 +6259,11 @@ def test_delete_worker_pool_non_empty_request_with_auto_populated_field(): client.delete_worker_pool(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudbuild.DeleteWorkerPoolRequest( + request_msg = cloudbuild.DeleteWorkerPoolRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_worker_pool_use_cached_wrapped_rpc(): @@ -6319,9 +6358,14 @@ async def test_delete_worker_pool_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_worker_pool_async( - transport: str = "grpc_asyncio", request_type=cloudbuild.DeleteWorkerPoolRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudbuild.DeleteWorkerPoolRequest(), + {}, + ], +) +async def test_delete_worker_pool_async(request_type, transport: str = "grpc_asyncio"): client = CloudBuildAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6329,7 +6373,7 @@ async def test_delete_worker_pool_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( @@ -6351,11 +6395,6 @@ async def test_delete_worker_pool_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_worker_pool_async_from_dict(): - await test_delete_worker_pool_async(request_type=dict) - - def test_delete_worker_pool_flattened(): client = CloudBuildClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6445,8 +6484,8 @@ async def test_delete_worker_pool_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloudbuild.UpdateWorkerPoolRequest, - dict, + cloudbuild.UpdateWorkerPoolRequest(), + {}, ], ) def test_update_worker_pool(request_type, transport: str = "grpc"): @@ -6457,7 +6496,7 @@ def test_update_worker_pool(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6500,7 +6539,8 @@ def test_update_worker_pool_non_empty_request_with_auto_populated_field(): client.update_worker_pool(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudbuild.UpdateWorkerPoolRequest() + request_msg = cloudbuild.UpdateWorkerPoolRequest() + assert args[0] == request_msg def test_update_worker_pool_use_cached_wrapped_rpc(): @@ -6595,9 +6635,14 @@ async def test_update_worker_pool_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_worker_pool_async( - transport: str = "grpc_asyncio", request_type=cloudbuild.UpdateWorkerPoolRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudbuild.UpdateWorkerPoolRequest(), + {}, + ], +) +async def test_update_worker_pool_async(request_type, transport: str = "grpc_asyncio"): client = CloudBuildAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6605,7 +6650,7 @@ async def test_update_worker_pool_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( @@ -6627,11 +6672,6 @@ async def test_update_worker_pool_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_worker_pool_async_from_dict(): - await test_update_worker_pool_async(request_type=dict) - - def test_update_worker_pool_flattened(): client = CloudBuildClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6731,8 +6771,8 @@ async def test_update_worker_pool_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloudbuild.ListWorkerPoolsRequest, - dict, + cloudbuild.ListWorkerPoolsRequest(), + {}, ], ) def test_list_worker_pools(request_type, transport: str = "grpc"): @@ -6743,7 +6783,7 @@ def test_list_worker_pools(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6792,10 +6832,11 @@ def test_list_worker_pools_non_empty_request_with_auto_populated_field(): client.list_worker_pools(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudbuild.ListWorkerPoolsRequest( + request_msg = cloudbuild.ListWorkerPoolsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_worker_pools_use_cached_wrapped_rpc(): @@ -6878,9 +6919,14 @@ async def test_list_worker_pools_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_worker_pools_async( - transport: str = "grpc_asyncio", request_type=cloudbuild.ListWorkerPoolsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudbuild.ListWorkerPoolsRequest(), + {}, + ], +) +async def test_list_worker_pools_async(request_type, transport: str = "grpc_asyncio"): client = CloudBuildAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6888,7 +6934,7 @@ async def test_list_worker_pools_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( @@ -6913,11 +6959,6 @@ async def test_list_worker_pools_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_worker_pools_async_from_dict(): - await test_list_worker_pools_async(request_type=dict) - - def test_list_worker_pools_flattened(): client = CloudBuildClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7202,8 +7243,8 @@ async def test_list_worker_pools_async_pages(): @pytest.mark.parametrize( "request_type", [ - cloudbuild.GetDefaultServiceAccountRequest, - dict, + cloudbuild.GetDefaultServiceAccountRequest(), + {}, ], ) def test_get_default_service_account(request_type, transport: str = "grpc"): @@ -7214,7 +7255,7 @@ def test_get_default_service_account(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7264,9 +7305,10 @@ def test_get_default_service_account_non_empty_request_with_auto_populated_field client.get_default_service_account(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudbuild.GetDefaultServiceAccountRequest( + request_msg = cloudbuild.GetDefaultServiceAccountRequest( name="name_value", ) + assert args[0] == request_msg def test_get_default_service_account_use_cached_wrapped_rpc(): @@ -7352,9 +7394,15 @@ async def test_get_default_service_account_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloudbuild.GetDefaultServiceAccountRequest(), + {}, + ], +) async def test_get_default_service_account_async( - transport: str = "grpc_asyncio", - request_type=cloudbuild.GetDefaultServiceAccountRequest, + request_type, transport: str = "grpc_asyncio" ): client = CloudBuildAsyncClient( credentials=async_anonymous_credentials(), @@ -7363,7 +7411,7 @@ async def test_get_default_service_account_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( @@ -7390,11 +7438,6 @@ async def test_get_default_service_account_async( assert response.service_account_email == "service_account_email_value" -@pytest.mark.asyncio -async def test_get_default_service_account_async_from_dict(): - await test_get_default_service_account_async(request_type=dict) - - def test_get_default_service_account_flattened(): client = CloudBuildClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11335,7 +11378,6 @@ def test_create_build_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudbuild.CreateBuildRequest() - assert args[0] == request_msg @@ -11356,7 +11398,6 @@ def test_get_build_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudbuild.GetBuildRequest() - assert args[0] == request_msg @@ -11377,7 +11418,6 @@ def test_list_builds_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudbuild.ListBuildsRequest() - assert args[0] == request_msg @@ -11398,7 +11438,6 @@ def test_cancel_build_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudbuild.CancelBuildRequest() - assert args[0] == request_msg @@ -11419,7 +11458,6 @@ def test_retry_build_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudbuild.RetryBuildRequest() - assert args[0] == request_msg @@ -11440,7 +11478,6 @@ def test_approve_build_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudbuild.ApproveBuildRequest() - assert args[0] == request_msg @@ -11463,7 +11500,6 @@ def test_create_build_trigger_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudbuild.CreateBuildTriggerRequest() - assert args[0] == request_msg @@ -11486,7 +11522,6 @@ def test_get_build_trigger_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudbuild.GetBuildTriggerRequest() - assert args[0] == request_msg @@ -11509,7 +11544,6 @@ def test_list_build_triggers_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudbuild.ListBuildTriggersRequest() - assert args[0] == request_msg @@ -11532,7 +11566,6 @@ def test_delete_build_trigger_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudbuild.DeleteBuildTriggerRequest() - assert args[0] == request_msg @@ -11555,7 +11588,6 @@ def test_update_build_trigger_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudbuild.UpdateBuildTriggerRequest() - assert args[0] == request_msg @@ -11578,7 +11610,6 @@ def test_run_build_trigger_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudbuild.RunBuildTriggerRequest() - assert args[0] == request_msg @@ -11601,7 +11632,6 @@ def test_receive_trigger_webhook_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudbuild.ReceiveTriggerWebhookRequest() - assert args[0] == request_msg @@ -11624,7 +11654,6 @@ def test_create_worker_pool_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudbuild.CreateWorkerPoolRequest() - assert args[0] == request_msg @@ -11645,7 +11674,6 @@ def test_get_worker_pool_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudbuild.GetWorkerPoolRequest() - assert args[0] == request_msg @@ -11668,7 +11696,6 @@ def test_delete_worker_pool_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudbuild.DeleteWorkerPoolRequest() - assert args[0] == request_msg @@ -11691,7 +11718,6 @@ def test_update_worker_pool_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudbuild.UpdateWorkerPoolRequest() - assert args[0] == request_msg @@ -11714,7 +11740,6 @@ def test_list_worker_pools_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudbuild.ListWorkerPoolsRequest() - assert args[0] == request_msg @@ -11737,7 +11762,6 @@ def test_get_default_service_account_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudbuild.GetDefaultServiceAccountRequest() - assert args[0] == request_msg @@ -11758,7 +11782,6 @@ def test_create_build_routing_parameters_request_1_grpc(): request_msg = cloudbuild.CreateBuildRequest( **{"parent": "projects/sample1/locations/sample2"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -11786,7 +11809,6 @@ def test_get_build_routing_parameters_request_1_grpc(): request_msg = cloudbuild.GetBuildRequest( **{"name": "projects/sample1/locations/sample2/builds/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -11812,7 +11834,6 @@ def test_list_builds_routing_parameters_request_1_grpc(): request_msg = cloudbuild.ListBuildsRequest( **{"parent": "projects/sample1/locations/sample2"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -11840,7 +11861,6 @@ def test_cancel_build_routing_parameters_request_1_grpc(): request_msg = cloudbuild.CancelBuildRequest( **{"name": "projects/sample1/locations/sample2/builds/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -11868,7 +11888,6 @@ def test_retry_build_routing_parameters_request_1_grpc(): request_msg = cloudbuild.RetryBuildRequest( **{"name": "projects/sample1/locations/sample2/builds/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -11896,7 +11915,6 @@ def test_approve_build_routing_parameters_request_1_grpc(): request_msg = cloudbuild.ApproveBuildRequest( **{"name": "projects/sample1/locations/sample2/builds/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -11926,7 +11944,6 @@ def test_create_build_trigger_routing_parameters_request_1_grpc(): request_msg = cloudbuild.CreateBuildTriggerRequest( **{"parent": "projects/sample1/locations/sample2"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -11956,7 +11973,6 @@ def test_get_build_trigger_routing_parameters_request_1_grpc(): request_msg = cloudbuild.GetBuildTriggerRequest( **{"name": "projects/sample1/locations/sample2/triggers/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -11986,7 +12002,6 @@ def test_list_build_triggers_routing_parameters_request_1_grpc(): request_msg = cloudbuild.ListBuildTriggersRequest( **{"parent": "projects/sample1/locations/sample2"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -12016,7 +12031,6 @@ def test_delete_build_trigger_routing_parameters_request_1_grpc(): request_msg = cloudbuild.DeleteBuildTriggerRequest( **{"name": "projects/sample1/locations/sample2/triggers/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -12054,7 +12068,6 @@ def test_update_build_trigger_routing_parameters_request_1_grpc(): } } ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -12084,7 +12097,6 @@ def test_run_build_trigger_routing_parameters_request_1_grpc(): request_msg = cloudbuild.RunBuildTriggerRequest( **{"name": "projects/sample1/locations/sample2/triggers/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -12114,7 +12126,6 @@ def test_create_worker_pool_routing_parameters_request_1_grpc(): request_msg = cloudbuild.CreateWorkerPoolRequest( **{"parent": "projects/sample1/locations/sample2"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -12142,7 +12153,6 @@ def test_get_worker_pool_routing_parameters_request_1_grpc(): request_msg = cloudbuild.GetWorkerPoolRequest( **{"name": "projects/sample1/locations/sample2/workerPools/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -12172,7 +12182,6 @@ def test_delete_worker_pool_routing_parameters_request_1_grpc(): request_msg = cloudbuild.DeleteWorkerPoolRequest( **{"name": "projects/sample1/locations/sample2/workerPools/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -12210,7 +12219,6 @@ def test_update_worker_pool_routing_parameters_request_1_grpc(): } } ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -12240,7 +12248,6 @@ def test_list_worker_pools_routing_parameters_request_1_grpc(): request_msg = cloudbuild.ListWorkerPoolsRequest( **{"parent": "projects/sample1/locations/sample2"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -12270,7 +12277,6 @@ def test_get_default_service_account_routing_parameters_request_1_grpc(): request_msg = cloudbuild.GetDefaultServiceAccountRequest( **{"name": "projects/sample1/locations/sample2/defaultServiceAccount"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -12314,7 +12320,6 @@ async def test_create_build_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudbuild.CreateBuildRequest() - assert args[0] == request_msg @@ -12351,7 +12356,6 @@ async def test_get_build_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudbuild.GetBuildRequest() - assert args[0] == request_msg @@ -12378,7 +12382,6 @@ async def test_list_builds_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudbuild.ListBuildsRequest() - assert args[0] == request_msg @@ -12415,7 +12418,6 @@ async def test_cancel_build_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudbuild.CancelBuildRequest() - assert args[0] == request_msg @@ -12440,7 +12442,6 @@ async def test_retry_build_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudbuild.RetryBuildRequest() - assert args[0] == request_msg @@ -12465,7 +12466,6 @@ async def test_approve_build_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudbuild.ApproveBuildRequest() - assert args[0] == request_msg @@ -12503,7 +12503,6 @@ async def test_create_build_trigger_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudbuild.CreateBuildTriggerRequest() - assert args[0] == request_msg @@ -12541,7 +12540,6 @@ async def test_get_build_trigger_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudbuild.GetBuildTriggerRequest() - assert args[0] == request_msg @@ -12570,7 +12568,6 @@ async def test_list_build_triggers_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudbuild.ListBuildTriggersRequest() - assert args[0] == request_msg @@ -12595,7 +12592,6 @@ async def test_delete_build_trigger_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudbuild.DeleteBuildTriggerRequest() - assert args[0] == request_msg @@ -12633,7 +12629,6 @@ async def test_update_build_trigger_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudbuild.UpdateBuildTriggerRequest() - assert args[0] == request_msg @@ -12660,7 +12655,6 @@ async def test_run_build_trigger_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudbuild.RunBuildTriggerRequest() - assert args[0] == request_msg @@ -12687,7 +12681,6 @@ async def test_receive_trigger_webhook_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudbuild.ReceiveTriggerWebhookRequest() - assert args[0] == request_msg @@ -12714,7 +12707,6 @@ async def test_create_worker_pool_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudbuild.CreateWorkerPoolRequest() - assert args[0] == request_msg @@ -12745,7 +12737,6 @@ async def test_get_worker_pool_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudbuild.GetWorkerPoolRequest() - assert args[0] == request_msg @@ -12772,7 +12763,6 @@ async def test_delete_worker_pool_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudbuild.DeleteWorkerPoolRequest() - assert args[0] == request_msg @@ -12799,7 +12789,6 @@ async def test_update_worker_pool_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudbuild.UpdateWorkerPoolRequest() - assert args[0] == request_msg @@ -12828,7 +12817,6 @@ async def test_list_worker_pools_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudbuild.ListWorkerPoolsRequest() - assert args[0] == request_msg @@ -12858,7 +12846,6 @@ async def test_get_default_service_account_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudbuild.GetDefaultServiceAccountRequest() - assert args[0] == request_msg @@ -12885,7 +12872,6 @@ async def test_create_build_routing_parameters_request_1_grpc_asyncio(): request_msg = cloudbuild.CreateBuildRequest( **{"parent": "projects/sample1/locations/sample2"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -12929,7 +12915,6 @@ async def test_get_build_routing_parameters_request_1_grpc_asyncio(): request_msg = cloudbuild.GetBuildRequest( **{"name": "projects/sample1/locations/sample2/builds/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -12963,7 +12948,6 @@ async def test_list_builds_routing_parameters_request_1_grpc_asyncio(): request_msg = cloudbuild.ListBuildsRequest( **{"parent": "projects/sample1/locations/sample2"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -13007,7 +12991,6 @@ async def test_cancel_build_routing_parameters_request_1_grpc_asyncio(): request_msg = cloudbuild.CancelBuildRequest( **{"name": "projects/sample1/locations/sample2/builds/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -13039,7 +13022,6 @@ async def test_retry_build_routing_parameters_request_1_grpc_asyncio(): request_msg = cloudbuild.RetryBuildRequest( **{"name": "projects/sample1/locations/sample2/builds/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -13071,7 +13053,6 @@ async def test_approve_build_routing_parameters_request_1_grpc_asyncio(): request_msg = cloudbuild.ApproveBuildRequest( **{"name": "projects/sample1/locations/sample2/builds/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -13116,7 +13097,6 @@ async def test_create_build_trigger_routing_parameters_request_1_grpc_asyncio(): request_msg = cloudbuild.CreateBuildTriggerRequest( **{"parent": "projects/sample1/locations/sample2"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -13161,7 +13141,6 @@ async def test_get_build_trigger_routing_parameters_request_1_grpc_asyncio(): request_msg = cloudbuild.GetBuildTriggerRequest( **{"name": "projects/sample1/locations/sample2/triggers/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -13197,7 +13176,6 @@ async def test_list_build_triggers_routing_parameters_request_1_grpc_asyncio(): request_msg = cloudbuild.ListBuildTriggersRequest( **{"parent": "projects/sample1/locations/sample2"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -13229,7 +13207,6 @@ async def test_delete_build_trigger_routing_parameters_request_1_grpc_asyncio(): request_msg = cloudbuild.DeleteBuildTriggerRequest( **{"name": "projects/sample1/locations/sample2/triggers/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -13282,7 +13259,6 @@ async def test_update_build_trigger_routing_parameters_request_1_grpc_asyncio(): } } ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -13316,7 +13292,6 @@ async def test_run_build_trigger_routing_parameters_request_1_grpc_asyncio(): request_msg = cloudbuild.RunBuildTriggerRequest( **{"name": "projects/sample1/locations/sample2/triggers/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -13350,7 +13325,6 @@ async def test_create_worker_pool_routing_parameters_request_1_grpc_asyncio(): request_msg = cloudbuild.CreateWorkerPoolRequest( **{"parent": "projects/sample1/locations/sample2"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -13388,7 +13362,6 @@ async def test_get_worker_pool_routing_parameters_request_1_grpc_asyncio(): request_msg = cloudbuild.GetWorkerPoolRequest( **{"name": "projects/sample1/locations/sample2/workerPools/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -13422,7 +13395,6 @@ async def test_delete_worker_pool_routing_parameters_request_1_grpc_asyncio(): request_msg = cloudbuild.DeleteWorkerPoolRequest( **{"name": "projects/sample1/locations/sample2/workerPools/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -13464,7 +13436,6 @@ async def test_update_worker_pool_routing_parameters_request_1_grpc_asyncio(): } } ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -13500,7 +13471,6 @@ async def test_list_worker_pools_routing_parameters_request_1_grpc_asyncio(): request_msg = cloudbuild.ListWorkerPoolsRequest( **{"parent": "projects/sample1/locations/sample2"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -13537,7 +13507,6 @@ async def test_get_default_service_account_routing_parameters_request_1_grpc_asy request_msg = cloudbuild.GetDefaultServiceAccountRequest( **{"name": "projects/sample1/locations/sample2/defaultServiceAccount"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -17469,7 +17438,6 @@ def test_create_build_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudbuild.CreateBuildRequest() - assert args[0] == request_msg @@ -17489,7 +17457,6 @@ def test_get_build_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudbuild.GetBuildRequest() - assert args[0] == request_msg @@ -17509,7 +17476,6 @@ def test_list_builds_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudbuild.ListBuildsRequest() - assert args[0] == request_msg @@ -17529,7 +17495,6 @@ def test_cancel_build_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudbuild.CancelBuildRequest() - assert args[0] == request_msg @@ -17549,7 +17514,6 @@ def test_retry_build_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudbuild.RetryBuildRequest() - assert args[0] == request_msg @@ -17569,7 +17533,6 @@ def test_approve_build_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudbuild.ApproveBuildRequest() - assert args[0] == request_msg @@ -17591,7 +17554,6 @@ def test_create_build_trigger_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudbuild.CreateBuildTriggerRequest() - assert args[0] == request_msg @@ -17613,7 +17575,6 @@ def test_get_build_trigger_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudbuild.GetBuildTriggerRequest() - assert args[0] == request_msg @@ -17635,7 +17596,6 @@ def test_list_build_triggers_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudbuild.ListBuildTriggersRequest() - assert args[0] == request_msg @@ -17657,7 +17617,6 @@ def test_delete_build_trigger_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudbuild.DeleteBuildTriggerRequest() - assert args[0] == request_msg @@ -17679,7 +17638,6 @@ def test_update_build_trigger_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudbuild.UpdateBuildTriggerRequest() - assert args[0] == request_msg @@ -17701,7 +17659,6 @@ def test_run_build_trigger_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudbuild.RunBuildTriggerRequest() - assert args[0] == request_msg @@ -17723,7 +17680,6 @@ def test_receive_trigger_webhook_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudbuild.ReceiveTriggerWebhookRequest() - assert args[0] == request_msg @@ -17745,7 +17701,6 @@ def test_create_worker_pool_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudbuild.CreateWorkerPoolRequest() - assert args[0] == request_msg @@ -17765,7 +17720,6 @@ def test_get_worker_pool_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudbuild.GetWorkerPoolRequest() - assert args[0] == request_msg @@ -17787,7 +17741,6 @@ def test_delete_worker_pool_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudbuild.DeleteWorkerPoolRequest() - assert args[0] == request_msg @@ -17809,7 +17762,6 @@ def test_update_worker_pool_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudbuild.UpdateWorkerPoolRequest() - assert args[0] == request_msg @@ -17831,7 +17783,6 @@ def test_list_worker_pools_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudbuild.ListWorkerPoolsRequest() - assert args[0] == request_msg @@ -17853,7 +17804,6 @@ def test_get_default_service_account_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudbuild.GetDefaultServiceAccountRequest() - assert args[0] == request_msg @@ -17873,7 +17823,6 @@ def test_create_build_routing_parameters_request_1_rest(): request_msg = cloudbuild.CreateBuildRequest( **{"parent": "projects/sample1/locations/sample2"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -17900,7 +17849,6 @@ def test_get_build_routing_parameters_request_1_rest(): request_msg = cloudbuild.GetBuildRequest( **{"name": "projects/sample1/locations/sample2/builds/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -17925,7 +17873,6 @@ def test_list_builds_routing_parameters_request_1_rest(): request_msg = cloudbuild.ListBuildsRequest( **{"parent": "projects/sample1/locations/sample2"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -17952,7 +17899,6 @@ def test_cancel_build_routing_parameters_request_1_rest(): request_msg = cloudbuild.CancelBuildRequest( **{"name": "projects/sample1/locations/sample2/builds/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -17979,7 +17925,6 @@ def test_retry_build_routing_parameters_request_1_rest(): request_msg = cloudbuild.RetryBuildRequest( **{"name": "projects/sample1/locations/sample2/builds/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -18006,7 +17951,6 @@ def test_approve_build_routing_parameters_request_1_rest(): request_msg = cloudbuild.ApproveBuildRequest( **{"name": "projects/sample1/locations/sample2/builds/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -18035,7 +17979,6 @@ def test_create_build_trigger_routing_parameters_request_1_rest(): request_msg = cloudbuild.CreateBuildTriggerRequest( **{"parent": "projects/sample1/locations/sample2"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -18064,7 +18007,6 @@ def test_get_build_trigger_routing_parameters_request_1_rest(): request_msg = cloudbuild.GetBuildTriggerRequest( **{"name": "projects/sample1/locations/sample2/triggers/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -18093,7 +18035,6 @@ def test_list_build_triggers_routing_parameters_request_1_rest(): request_msg = cloudbuild.ListBuildTriggersRequest( **{"parent": "projects/sample1/locations/sample2"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -18122,7 +18063,6 @@ def test_delete_build_trigger_routing_parameters_request_1_rest(): request_msg = cloudbuild.DeleteBuildTriggerRequest( **{"name": "projects/sample1/locations/sample2/triggers/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -18159,7 +18099,6 @@ def test_update_build_trigger_routing_parameters_request_1_rest(): } } ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -18188,7 +18127,6 @@ def test_run_build_trigger_routing_parameters_request_1_rest(): request_msg = cloudbuild.RunBuildTriggerRequest( **{"name": "projects/sample1/locations/sample2/triggers/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -18217,7 +18155,6 @@ def test_create_worker_pool_routing_parameters_request_1_rest(): request_msg = cloudbuild.CreateWorkerPoolRequest( **{"parent": "projects/sample1/locations/sample2"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -18244,7 +18181,6 @@ def test_get_worker_pool_routing_parameters_request_1_rest(): request_msg = cloudbuild.GetWorkerPoolRequest( **{"name": "projects/sample1/locations/sample2/workerPools/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -18273,7 +18209,6 @@ def test_delete_worker_pool_routing_parameters_request_1_rest(): request_msg = cloudbuild.DeleteWorkerPoolRequest( **{"name": "projects/sample1/locations/sample2/workerPools/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -18310,7 +18245,6 @@ def test_update_worker_pool_routing_parameters_request_1_rest(): } } ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -18339,7 +18273,6 @@ def test_list_worker_pools_routing_parameters_request_1_rest(): request_msg = cloudbuild.ListWorkerPoolsRequest( **{"parent": "projects/sample1/locations/sample2"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -18368,7 +18301,6 @@ def test_get_default_service_account_routing_parameters_request_1_rest(): request_msg = cloudbuild.GetDefaultServiceAccountRequest( **{"name": "projects/sample1/locations/sample2/defaultServiceAccount"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} diff --git a/packages/google-cloud-build/tests/unit/gapic/cloudbuild_v2/test_repository_manager.py b/packages/google-cloud-build/tests/unit/gapic/cloudbuild_v2/test_repository_manager.py index bde0c107f8c5..ac0f4615203d 100644 --- a/packages/google-cloud-build/tests/unit/gapic/cloudbuild_v2/test_repository_manager.py +++ b/packages/google-cloud-build/tests/unit/gapic/cloudbuild_v2/test_repository_manager.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 @@ -121,6 +122,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" @@ -1362,8 +1378,8 @@ def test_repository_manager_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - repositories.CreateConnectionRequest, - dict, + repositories.CreateConnectionRequest(), + {}, ], ) def test_create_connection(request_type, transport: str = "grpc"): @@ -1374,7 +1390,7 @@ def test_create_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( @@ -1420,10 +1436,11 @@ def test_create_connection_non_empty_request_with_auto_populated_field(): client.create_connection(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == repositories.CreateConnectionRequest( + request_msg = repositories.CreateConnectionRequest( parent="parent_value", connection_id="connection_id_value", ) + assert args[0] == request_msg def test_create_connection_use_cached_wrapped_rpc(): @@ -1516,9 +1533,14 @@ async def test_create_connection_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_connection_async( - transport: str = "grpc_asyncio", request_type=repositories.CreateConnectionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + repositories.CreateConnectionRequest(), + {}, + ], +) +async def test_create_connection_async(request_type, transport: str = "grpc_asyncio"): client = RepositoryManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1526,7 +1548,7 @@ async def test_create_connection_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( @@ -1548,11 +1570,6 @@ async def test_create_connection_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_connection_async_from_dict(): - await test_create_connection_async(request_type=dict) - - def test_create_connection_field_headers(): client = RepositoryManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1727,8 +1744,8 @@ async def test_create_connection_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - repositories.GetConnectionRequest, - dict, + repositories.GetConnectionRequest(), + {}, ], ) def test_get_connection(request_type, transport: str = "grpc"): @@ -1739,7 +1756,7 @@ def test_get_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(type(client.transport.get_connection), "__call__") as call: @@ -1789,9 +1806,10 @@ def test_get_connection_non_empty_request_with_auto_populated_field(): client.get_connection(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == repositories.GetConnectionRequest( + request_msg = repositories.GetConnectionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_connection_use_cached_wrapped_rpc(): @@ -1872,9 +1890,14 @@ async def test_get_connection_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_connection_async( - transport: str = "grpc_asyncio", request_type=repositories.GetConnectionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + repositories.GetConnectionRequest(), + {}, + ], +) +async def test_get_connection_async(request_type, transport: str = "grpc_asyncio"): client = RepositoryManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1882,7 +1905,7 @@ async def test_get_connection_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_connection), "__call__") as call: @@ -1911,11 +1934,6 @@ async def test_get_connection_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_connection_async_from_dict(): - await test_get_connection_async(request_type=dict) - - def test_get_connection_field_headers(): client = RepositoryManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2062,8 +2080,8 @@ async def test_get_connection_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - repositories.ListConnectionsRequest, - dict, + repositories.ListConnectionsRequest(), + {}, ], ) def test_list_connections(request_type, transport: str = "grpc"): @@ -2074,7 +2092,7 @@ def test_list_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(type(client.transport.list_connections), "__call__") as call: @@ -2119,10 +2137,11 @@ def test_list_connections_non_empty_request_with_auto_populated_field(): client.list_connections(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == repositories.ListConnectionsRequest( + request_msg = repositories.ListConnectionsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_connections_use_cached_wrapped_rpc(): @@ -2205,9 +2224,14 @@ async def test_list_connections_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_connections_async( - transport: str = "grpc_asyncio", request_type=repositories.ListConnectionsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + repositories.ListConnectionsRequest(), + {}, + ], +) +async def test_list_connections_async(request_type, transport: str = "grpc_asyncio"): client = RepositoryManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2215,7 +2239,7 @@ async def test_list_connections_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_connections), "__call__") as call: @@ -2238,11 +2262,6 @@ async def test_list_connections_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_connections_async_from_dict(): - await test_list_connections_async(request_type=dict) - - def test_list_connections_field_headers(): client = RepositoryManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2579,8 +2598,8 @@ async def test_list_connections_async_pages(): @pytest.mark.parametrize( "request_type", [ - repositories.UpdateConnectionRequest, - dict, + repositories.UpdateConnectionRequest(), + {}, ], ) def test_update_connection(request_type, transport: str = "grpc"): @@ -2591,7 +2610,7 @@ def test_update_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( @@ -2636,9 +2655,10 @@ def test_update_connection_non_empty_request_with_auto_populated_field(): client.update_connection(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == repositories.UpdateConnectionRequest( + request_msg = repositories.UpdateConnectionRequest( etag="etag_value", ) + assert args[0] == request_msg def test_update_connection_use_cached_wrapped_rpc(): @@ -2731,9 +2751,14 @@ async def test_update_connection_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_connection_async( - transport: str = "grpc_asyncio", request_type=repositories.UpdateConnectionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + repositories.UpdateConnectionRequest(), + {}, + ], +) +async def test_update_connection_async(request_type, transport: str = "grpc_asyncio"): client = RepositoryManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2741,7 +2766,7 @@ async def test_update_connection_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( @@ -2763,11 +2788,6 @@ async def test_update_connection_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_connection_async_from_dict(): - await test_update_connection_async(request_type=dict) - - def test_update_connection_field_headers(): client = RepositoryManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2932,8 +2952,8 @@ async def test_update_connection_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - repositories.DeleteConnectionRequest, - dict, + repositories.DeleteConnectionRequest(), + {}, ], ) def test_delete_connection(request_type, transport: str = "grpc"): @@ -2944,7 +2964,7 @@ def test_delete_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( @@ -2990,10 +3010,11 @@ def test_delete_connection_non_empty_request_with_auto_populated_field(): client.delete_connection(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == repositories.DeleteConnectionRequest( + request_msg = repositories.DeleteConnectionRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_connection_use_cached_wrapped_rpc(): @@ -3086,9 +3107,14 @@ async def test_delete_connection_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_connection_async( - transport: str = "grpc_asyncio", request_type=repositories.DeleteConnectionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + repositories.DeleteConnectionRequest(), + {}, + ], +) +async def test_delete_connection_async(request_type, transport: str = "grpc_asyncio"): client = RepositoryManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3096,7 +3122,7 @@ async def test_delete_connection_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( @@ -3118,11 +3144,6 @@ async def test_delete_connection_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_connection_async_from_dict(): - await test_delete_connection_async(request_type=dict) - - def test_delete_connection_field_headers(): client = RepositoryManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3277,8 +3298,8 @@ async def test_delete_connection_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - repositories.CreateRepositoryRequest, - dict, + repositories.CreateRepositoryRequest(), + {}, ], ) def test_create_repository(request_type, transport: str = "grpc"): @@ -3289,7 +3310,7 @@ def test_create_repository(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3335,10 +3356,11 @@ def test_create_repository_non_empty_request_with_auto_populated_field(): client.create_repository(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == repositories.CreateRepositoryRequest( + request_msg = repositories.CreateRepositoryRequest( parent="parent_value", repository_id="repository_id_value", ) + assert args[0] == request_msg def test_create_repository_use_cached_wrapped_rpc(): @@ -3431,9 +3453,14 @@ async def test_create_repository_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_repository_async( - transport: str = "grpc_asyncio", request_type=repositories.CreateRepositoryRequest -): +@pytest.mark.parametrize( + "request_type", + [ + repositories.CreateRepositoryRequest(), + {}, + ], +) +async def test_create_repository_async(request_type, transport: str = "grpc_asyncio"): client = RepositoryManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3441,7 +3468,7 @@ async def test_create_repository_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( @@ -3463,11 +3490,6 @@ async def test_create_repository_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_repository_async_from_dict(): - await test_create_repository_async(request_type=dict) - - def test_create_repository_field_headers(): client = RepositoryManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3642,8 +3664,8 @@ async def test_create_repository_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - repositories.BatchCreateRepositoriesRequest, - dict, + repositories.BatchCreateRepositoriesRequest(), + {}, ], ) def test_batch_create_repositories(request_type, transport: str = "grpc"): @@ -3654,7 +3676,7 @@ def test_batch_create_repositories(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3699,9 +3721,10 @@ def test_batch_create_repositories_non_empty_request_with_auto_populated_field() client.batch_create_repositories(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == repositories.BatchCreateRepositoriesRequest( + request_msg = repositories.BatchCreateRepositoriesRequest( parent="parent_value", ) + assert args[0] == request_msg def test_batch_create_repositories_use_cached_wrapped_rpc(): @@ -3797,9 +3820,15 @@ async def test_batch_create_repositories_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + repositories.BatchCreateRepositoriesRequest(), + {}, + ], +) async def test_batch_create_repositories_async( - transport: str = "grpc_asyncio", - request_type=repositories.BatchCreateRepositoriesRequest, + request_type, transport: str = "grpc_asyncio" ): client = RepositoryManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -3808,7 +3837,7 @@ async def test_batch_create_repositories_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( @@ -3830,11 +3859,6 @@ async def test_batch_create_repositories_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_batch_create_repositories_async_from_dict(): - await test_batch_create_repositories_async(request_type=dict) - - def test_batch_create_repositories_field_headers(): client = RepositoryManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3999,8 +4023,8 @@ async def test_batch_create_repositories_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - repositories.GetRepositoryRequest, - dict, + repositories.GetRepositoryRequest(), + {}, ], ) def test_get_repository(request_type, transport: str = "grpc"): @@ -4011,7 +4035,7 @@ def test_get_repository(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_repository), "__call__") as call: @@ -4061,9 +4085,10 @@ def test_get_repository_non_empty_request_with_auto_populated_field(): client.get_repository(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == repositories.GetRepositoryRequest( + request_msg = repositories.GetRepositoryRequest( name="name_value", ) + assert args[0] == request_msg def test_get_repository_use_cached_wrapped_rpc(): @@ -4144,9 +4169,14 @@ async def test_get_repository_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_repository_async( - transport: str = "grpc_asyncio", request_type=repositories.GetRepositoryRequest -): +@pytest.mark.parametrize( + "request_type", + [ + repositories.GetRepositoryRequest(), + {}, + ], +) +async def test_get_repository_async(request_type, transport: str = "grpc_asyncio"): client = RepositoryManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4154,7 +4184,7 @@ async def test_get_repository_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_repository), "__call__") as call: @@ -4183,11 +4213,6 @@ async def test_get_repository_async( assert response.webhook_id == "webhook_id_value" -@pytest.mark.asyncio -async def test_get_repository_async_from_dict(): - await test_get_repository_async(request_type=dict) - - def test_get_repository_field_headers(): client = RepositoryManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4334,8 +4359,8 @@ async def test_get_repository_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - repositories.ListRepositoriesRequest, - dict, + repositories.ListRepositoriesRequest(), + {}, ], ) def test_list_repositories(request_type, transport: str = "grpc"): @@ -4346,7 +4371,7 @@ def test_list_repositories(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,11 +4421,12 @@ def test_list_repositories_non_empty_request_with_auto_populated_field(): client.list_repositories(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == repositories.ListRepositoriesRequest( + request_msg = repositories.ListRepositoriesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_repositories_use_cached_wrapped_rpc(): @@ -4483,9 +4509,14 @@ async def test_list_repositories_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_repositories_async( - transport: str = "grpc_asyncio", request_type=repositories.ListRepositoriesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + repositories.ListRepositoriesRequest(), + {}, + ], +) +async def test_list_repositories_async(request_type, transport: str = "grpc_asyncio"): client = RepositoryManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4493,7 +4524,7 @@ async def test_list_repositories_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( @@ -4518,11 +4549,6 @@ async def test_list_repositories_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_repositories_async_from_dict(): - await test_list_repositories_async(request_type=dict) - - def test_list_repositories_field_headers(): client = RepositoryManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4875,8 +4901,8 @@ async def test_list_repositories_async_pages(): @pytest.mark.parametrize( "request_type", [ - repositories.DeleteRepositoryRequest, - dict, + repositories.DeleteRepositoryRequest(), + {}, ], ) def test_delete_repository(request_type, transport: str = "grpc"): @@ -4887,7 +4913,7 @@ def test_delete_repository(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4933,10 +4959,11 @@ def test_delete_repository_non_empty_request_with_auto_populated_field(): client.delete_repository(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == repositories.DeleteRepositoryRequest( + request_msg = repositories.DeleteRepositoryRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_repository_use_cached_wrapped_rpc(): @@ -5029,9 +5056,14 @@ async def test_delete_repository_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_repository_async( - transport: str = "grpc_asyncio", request_type=repositories.DeleteRepositoryRequest -): +@pytest.mark.parametrize( + "request_type", + [ + repositories.DeleteRepositoryRequest(), + {}, + ], +) +async def test_delete_repository_async(request_type, transport: str = "grpc_asyncio"): client = RepositoryManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5039,7 +5071,7 @@ async def test_delete_repository_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( @@ -5061,11 +5093,6 @@ async def test_delete_repository_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_repository_async_from_dict(): - await test_delete_repository_async(request_type=dict) - - def test_delete_repository_field_headers(): client = RepositoryManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5220,8 +5247,8 @@ async def test_delete_repository_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - repositories.FetchReadWriteTokenRequest, - dict, + repositories.FetchReadWriteTokenRequest(), + {}, ], ) def test_fetch_read_write_token(request_type, transport: str = "grpc"): @@ -5232,7 +5259,7 @@ def test_fetch_read_write_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( @@ -5280,9 +5307,10 @@ def test_fetch_read_write_token_non_empty_request_with_auto_populated_field(): client.fetch_read_write_token(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == repositories.FetchReadWriteTokenRequest( + request_msg = repositories.FetchReadWriteTokenRequest( repository="repository_value", ) + assert args[0] == request_msg def test_fetch_read_write_token_use_cached_wrapped_rpc(): @@ -5368,9 +5396,15 @@ async def test_fetch_read_write_token_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + repositories.FetchReadWriteTokenRequest(), + {}, + ], +) async def test_fetch_read_write_token_async( - transport: str = "grpc_asyncio", - request_type=repositories.FetchReadWriteTokenRequest, + request_type, transport: str = "grpc_asyncio" ): client = RepositoryManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -5379,7 +5413,7 @@ async def test_fetch_read_write_token_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( @@ -5404,11 +5438,6 @@ async def test_fetch_read_write_token_async( assert response.token == "token_value" -@pytest.mark.asyncio -async def test_fetch_read_write_token_async_from_dict(): - await test_fetch_read_write_token_async(request_type=dict) - - def test_fetch_read_write_token_field_headers(): client = RepositoryManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5563,8 +5592,8 @@ async def test_fetch_read_write_token_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - repositories.FetchReadTokenRequest, - dict, + repositories.FetchReadTokenRequest(), + {}, ], ) def test_fetch_read_token(request_type, transport: str = "grpc"): @@ -5575,7 +5604,7 @@ def test_fetch_read_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(type(client.transport.fetch_read_token), "__call__") as call: @@ -5619,9 +5648,10 @@ def test_fetch_read_token_non_empty_request_with_auto_populated_field(): client.fetch_read_token(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == repositories.FetchReadTokenRequest( + request_msg = repositories.FetchReadTokenRequest( repository="repository_value", ) + assert args[0] == request_msg def test_fetch_read_token_use_cached_wrapped_rpc(): @@ -5704,9 +5734,14 @@ async def test_fetch_read_token_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_fetch_read_token_async( - transport: str = "grpc_asyncio", request_type=repositories.FetchReadTokenRequest -): +@pytest.mark.parametrize( + "request_type", + [ + repositories.FetchReadTokenRequest(), + {}, + ], +) +async def test_fetch_read_token_async(request_type, transport: str = "grpc_asyncio"): client = RepositoryManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5714,7 +5749,7 @@ async def test_fetch_read_token_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.fetch_read_token), "__call__") as call: @@ -5737,11 +5772,6 @@ async def test_fetch_read_token_async( assert response.token == "token_value" -@pytest.mark.asyncio -async def test_fetch_read_token_async_from_dict(): - await test_fetch_read_token_async(request_type=dict) - - def test_fetch_read_token_field_headers(): client = RepositoryManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5888,8 +5918,8 @@ async def test_fetch_read_token_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - repositories.FetchLinkableRepositoriesRequest, - dict, + repositories.FetchLinkableRepositoriesRequest(), + {}, ], ) def test_fetch_linkable_repositories(request_type, transport: str = "grpc"): @@ -5900,7 +5930,7 @@ def test_fetch_linkable_repositories(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5949,10 +5979,11 @@ def test_fetch_linkable_repositories_non_empty_request_with_auto_populated_field client.fetch_linkable_repositories(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == repositories.FetchLinkableRepositoriesRequest( + request_msg = repositories.FetchLinkableRepositoriesRequest( connection="connection_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_fetch_linkable_repositories_use_cached_wrapped_rpc(): @@ -6038,9 +6069,15 @@ async def test_fetch_linkable_repositories_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + repositories.FetchLinkableRepositoriesRequest(), + {}, + ], +) async def test_fetch_linkable_repositories_async( - transport: str = "grpc_asyncio", - request_type=repositories.FetchLinkableRepositoriesRequest, + request_type, transport: str = "grpc_asyncio" ): client = RepositoryManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -6049,7 +6086,7 @@ async def test_fetch_linkable_repositories_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( @@ -6074,11 +6111,6 @@ async def test_fetch_linkable_repositories_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_fetch_linkable_repositories_async_from_dict(): - await test_fetch_linkable_repositories_async(request_type=dict) - - def test_fetch_linkable_repositories_field_headers(): client = RepositoryManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6347,8 +6379,8 @@ async def test_fetch_linkable_repositories_async_pages(): @pytest.mark.parametrize( "request_type", [ - repositories.FetchGitRefsRequest, - dict, + repositories.FetchGitRefsRequest(), + {}, ], ) def test_fetch_git_refs(request_type, transport: str = "grpc"): @@ -6359,7 +6391,7 @@ def test_fetch_git_refs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.fetch_git_refs), "__call__") as call: @@ -6403,9 +6435,10 @@ def test_fetch_git_refs_non_empty_request_with_auto_populated_field(): client.fetch_git_refs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == repositories.FetchGitRefsRequest( + request_msg = repositories.FetchGitRefsRequest( repository="repository_value", ) + assert args[0] == request_msg def test_fetch_git_refs_use_cached_wrapped_rpc(): @@ -6486,9 +6519,14 @@ async def test_fetch_git_refs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_fetch_git_refs_async( - transport: str = "grpc_asyncio", request_type=repositories.FetchGitRefsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + repositories.FetchGitRefsRequest(), + {}, + ], +) +async def test_fetch_git_refs_async(request_type, transport: str = "grpc_asyncio"): client = RepositoryManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6496,7 +6534,7 @@ async def test_fetch_git_refs_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.fetch_git_refs), "__call__") as call: @@ -6519,11 +6557,6 @@ async def test_fetch_git_refs_async( assert response.ref_names == ["ref_names_value"] -@pytest.mark.asyncio -async def test_fetch_git_refs_async_from_dict(): - await test_fetch_git_refs_async(request_type=dict) - - def test_fetch_git_refs_field_headers(): client = RepositoryManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9635,7 +9668,6 @@ def test_create_connection_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = repositories.CreateConnectionRequest() - assert args[0] == request_msg @@ -9656,7 +9688,6 @@ def test_get_connection_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = repositories.GetConnectionRequest() - assert args[0] == request_msg @@ -9677,7 +9708,6 @@ def test_list_connections_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = repositories.ListConnectionsRequest() - assert args[0] == request_msg @@ -9700,7 +9730,6 @@ def test_update_connection_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = repositories.UpdateConnectionRequest() - assert args[0] == request_msg @@ -9723,7 +9752,6 @@ def test_delete_connection_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = repositories.DeleteConnectionRequest() - assert args[0] == request_msg @@ -9746,7 +9774,6 @@ def test_create_repository_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = repositories.CreateRepositoryRequest() - assert args[0] == request_msg @@ -9769,7 +9796,6 @@ def test_batch_create_repositories_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = repositories.BatchCreateRepositoriesRequest() - assert args[0] == request_msg @@ -9790,7 +9816,6 @@ def test_get_repository_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = repositories.GetRepositoryRequest() - assert args[0] == request_msg @@ -9813,7 +9838,6 @@ def test_list_repositories_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = repositories.ListRepositoriesRequest() - assert args[0] == request_msg @@ -9836,7 +9860,6 @@ def test_delete_repository_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = repositories.DeleteRepositoryRequest() - assert args[0] == request_msg @@ -9859,7 +9882,6 @@ def test_fetch_read_write_token_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = repositories.FetchReadWriteTokenRequest() - assert args[0] == request_msg @@ -9880,7 +9902,6 @@ def test_fetch_read_token_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = repositories.FetchReadTokenRequest() - assert args[0] == request_msg @@ -9903,7 +9924,6 @@ def test_fetch_linkable_repositories_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = repositories.FetchLinkableRepositoriesRequest() - assert args[0] == request_msg @@ -9924,7 +9944,6 @@ def test_fetch_git_refs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = repositories.FetchGitRefsRequest() - assert args[0] == request_msg @@ -9965,7 +9984,6 @@ async def test_create_connection_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = repositories.CreateConnectionRequest() - assert args[0] == request_msg @@ -9995,7 +10013,6 @@ async def test_get_connection_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = repositories.GetConnectionRequest() - assert args[0] == request_msg @@ -10022,7 +10039,6 @@ async def test_list_connections_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = repositories.ListConnectionsRequest() - assert args[0] == request_msg @@ -10049,7 +10065,6 @@ async def test_update_connection_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = repositories.UpdateConnectionRequest() - assert args[0] == request_msg @@ -10076,7 +10091,6 @@ async def test_delete_connection_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = repositories.DeleteConnectionRequest() - assert args[0] == request_msg @@ -10103,7 +10117,6 @@ async def test_create_repository_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = repositories.CreateRepositoryRequest() - assert args[0] == request_msg @@ -10130,7 +10143,6 @@ async def test_batch_create_repositories_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = repositories.BatchCreateRepositoriesRequest() - assert args[0] == request_msg @@ -10160,7 +10172,6 @@ async def test_get_repository_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = repositories.GetRepositoryRequest() - assert args[0] == request_msg @@ -10189,7 +10200,6 @@ async def test_list_repositories_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = repositories.ListRepositoriesRequest() - assert args[0] == request_msg @@ -10216,7 +10226,6 @@ async def test_delete_repository_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = repositories.DeleteRepositoryRequest() - assert args[0] == request_msg @@ -10245,7 +10254,6 @@ async def test_fetch_read_write_token_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = repositories.FetchReadWriteTokenRequest() - assert args[0] == request_msg @@ -10272,7 +10280,6 @@ async def test_fetch_read_token_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = repositories.FetchReadTokenRequest() - assert args[0] == request_msg @@ -10301,7 +10308,6 @@ async def test_fetch_linkable_repositories_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = repositories.FetchLinkableRepositoriesRequest() - assert args[0] == request_msg @@ -10328,7 +10334,6 @@ async def test_fetch_git_refs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = repositories.FetchGitRefsRequest() - assert args[0] == request_msg @@ -12887,7 +12892,6 @@ def test_create_connection_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = repositories.CreateConnectionRequest() - assert args[0] == request_msg @@ -12907,7 +12911,6 @@ def test_get_connection_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = repositories.GetConnectionRequest() - assert args[0] == request_msg @@ -12927,7 +12930,6 @@ def test_list_connections_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = repositories.ListConnectionsRequest() - assert args[0] == request_msg @@ -12949,7 +12951,6 @@ def test_update_connection_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = repositories.UpdateConnectionRequest() - assert args[0] == request_msg @@ -12971,7 +12972,6 @@ def test_delete_connection_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = repositories.DeleteConnectionRequest() - assert args[0] == request_msg @@ -12993,7 +12993,6 @@ def test_create_repository_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = repositories.CreateRepositoryRequest() - assert args[0] == request_msg @@ -13015,7 +13014,6 @@ def test_batch_create_repositories_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = repositories.BatchCreateRepositoriesRequest() - assert args[0] == request_msg @@ -13035,7 +13033,6 @@ def test_get_repository_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = repositories.GetRepositoryRequest() - assert args[0] == request_msg @@ -13057,7 +13054,6 @@ def test_list_repositories_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = repositories.ListRepositoriesRequest() - assert args[0] == request_msg @@ -13079,7 +13075,6 @@ def test_delete_repository_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = repositories.DeleteRepositoryRequest() - assert args[0] == request_msg @@ -13101,7 +13096,6 @@ def test_fetch_read_write_token_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = repositories.FetchReadWriteTokenRequest() - assert args[0] == request_msg @@ -13121,7 +13115,6 @@ def test_fetch_read_token_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = repositories.FetchReadTokenRequest() - assert args[0] == request_msg @@ -13143,7 +13136,6 @@ def test_fetch_linkable_repositories_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = repositories.FetchLinkableRepositoriesRequest() - assert args[0] == request_msg @@ -13163,7 +13155,6 @@ def test_fetch_git_refs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = repositories.FetchGitRefsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-capacityplanner/noxfile.py b/packages/google-cloud-capacityplanner/noxfile.py index f19217365c67..100e4db93531 100644 --- a/packages/google-cloud-capacityplanner/noxfile.py +++ b/packages/google-cloud-capacityplanner/noxfile.py @@ -47,7 +47,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-capacityplanner" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-capacityplanner/setup.py b/packages/google-cloud-capacityplanner/setup.py index cf95ddcbb661..cf377b7839a8 100644 --- a/packages/google-cloud-capacityplanner/setup.py +++ b/packages/google-cloud-capacityplanner/setup.py @@ -45,7 +45,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/google-cloud-capacityplanner/testing/constraints-3.10.txt b/packages/google-cloud-capacityplanner/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-capacityplanner/testing/constraints-3.10.txt +++ b/packages/google-cloud-capacityplanner/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-capacityplanner/tests/unit/gapic/capacityplanner_v1beta/test_usage_service.py b/packages/google-cloud-capacityplanner/tests/unit/gapic/capacityplanner_v1beta/test_usage_service.py index 624812d75bc9..6f400d680b92 100644 --- a/packages/google-cloud-capacityplanner/tests/unit/gapic/capacityplanner_v1beta/test_usage_service.py +++ b/packages/google-cloud-capacityplanner/tests/unit/gapic/capacityplanner_v1beta/test_usage_service.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" @@ -1295,8 +1311,8 @@ def test_usage_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - usage_service.QueryUsageHistoriesRequest, - dict, + usage_service.QueryUsageHistoriesRequest(), + {}, ], ) def test_query_usage_histories(request_type, transport: str = "grpc"): @@ -1307,7 +1323,7 @@ def test_query_usage_histories(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1357,7 +1373,7 @@ def test_query_usage_histories_non_empty_request_with_auto_populated_field(): client.query_usage_histories(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == usage_service.QueryUsageHistoriesRequest( + request_msg = usage_service.QueryUsageHistoriesRequest( parent="parent_value", machine_family="machine_family_value", disk_type="disk_type_value", @@ -1365,6 +1381,7 @@ def test_query_usage_histories_non_empty_request_with_auto_populated_field(): tpu_type="tpu_type_value", cloud_resource_type="cloud_resource_type_value", ) + assert args[0] == request_msg def test_query_usage_histories_use_cached_wrapped_rpc(): @@ -1450,9 +1467,15 @@ async def test_query_usage_histories_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + usage_service.QueryUsageHistoriesRequest(), + {}, + ], +) async def test_query_usage_histories_async( - transport: str = "grpc_asyncio", - request_type=usage_service.QueryUsageHistoriesRequest, + request_type, transport: str = "grpc_asyncio" ): client = UsageServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1461,7 +1484,7 @@ async def test_query_usage_histories_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( @@ -1483,11 +1506,6 @@ async def test_query_usage_histories_async( assert isinstance(response, usage_service.QueryUsageHistoriesResponse) -@pytest.mark.asyncio -async def test_query_usage_histories_async_from_dict(): - await test_query_usage_histories_async(request_type=dict) - - def test_query_usage_histories_field_headers(): client = UsageServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1556,8 +1574,8 @@ async def test_query_usage_histories_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - usage_service.QueryForecastsRequest, - dict, + usage_service.QueryForecastsRequest(), + {}, ], ) def test_query_forecasts(request_type, transport: str = "grpc"): @@ -1568,7 +1586,7 @@ def test_query_forecasts(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.query_forecasts), "__call__") as call: @@ -1614,7 +1632,7 @@ def test_query_forecasts_non_empty_request_with_auto_populated_field(): client.query_forecasts(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == usage_service.QueryForecastsRequest( + request_msg = usage_service.QueryForecastsRequest( parent="parent_value", machine_family="machine_family_value", disk_type="disk_type_value", @@ -1622,6 +1640,7 @@ def test_query_forecasts_non_empty_request_with_auto_populated_field(): tpu_type="tpu_type_value", cloud_resource_type="cloud_resource_type_value", ) + assert args[0] == request_msg def test_query_forecasts_use_cached_wrapped_rpc(): @@ -1702,9 +1721,14 @@ async def test_query_forecasts_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_query_forecasts_async( - transport: str = "grpc_asyncio", request_type=usage_service.QueryForecastsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + usage_service.QueryForecastsRequest(), + {}, + ], +) +async def test_query_forecasts_async(request_type, transport: str = "grpc_asyncio"): client = UsageServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1712,7 +1736,7 @@ async def test_query_forecasts_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.query_forecasts), "__call__") as call: @@ -1732,11 +1756,6 @@ async def test_query_forecasts_async( assert isinstance(response, usage_service.QueryForecastsResponse) -@pytest.mark.asyncio -async def test_query_forecasts_async_from_dict(): - await test_query_forecasts_async(request_type=dict) - - def test_query_forecasts_field_headers(): client = UsageServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1801,8 +1820,8 @@ async def test_query_forecasts_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - usage_service.QueryReservationsRequest, - dict, + usage_service.QueryReservationsRequest(), + {}, ], ) def test_query_reservations(request_type, transport: str = "grpc"): @@ -1813,7 +1832,7 @@ def test_query_reservations(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1861,12 +1880,13 @@ def test_query_reservations_non_empty_request_with_auto_populated_field(): client.query_reservations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == usage_service.QueryReservationsRequest( + request_msg = usage_service.QueryReservationsRequest( parent="parent_value", machine_family="machine_family_value", gpu_type="gpu_type_value", cloud_resource_type="cloud_resource_type_value", ) + assert args[0] == request_msg def test_query_reservations_use_cached_wrapped_rpc(): @@ -1951,9 +1971,14 @@ async def test_query_reservations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_query_reservations_async( - transport: str = "grpc_asyncio", request_type=usage_service.QueryReservationsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + usage_service.QueryReservationsRequest(), + {}, + ], +) +async def test_query_reservations_async(request_type, transport: str = "grpc_asyncio"): client = UsageServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1961,7 +1986,7 @@ async def test_query_reservations_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( @@ -1983,11 +2008,6 @@ async def test_query_reservations_async( assert isinstance(response, usage_service.QueryReservationsResponse) -@pytest.mark.asyncio -async def test_query_reservations_async_from_dict(): - await test_query_reservations_async(request_type=dict) - - def test_query_reservations_field_headers(): client = UsageServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2142,8 +2162,8 @@ async def test_query_reservations_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - usage_service.ExportUsageHistoriesRequest, - dict, + usage_service.ExportUsageHistoriesRequest(), + {}, ], ) def test_export_usage_histories(request_type, transport: str = "grpc"): @@ -2154,7 +2174,7 @@ def test_export_usage_histories(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2204,7 +2224,7 @@ def test_export_usage_histories_non_empty_request_with_auto_populated_field(): client.export_usage_histories(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == usage_service.ExportUsageHistoriesRequest( + request_msg = usage_service.ExportUsageHistoriesRequest( parent="parent_value", machine_family="machine_family_value", disk_type="disk_type_value", @@ -2212,6 +2232,7 @@ def test_export_usage_histories_non_empty_request_with_auto_populated_field(): tpu_type="tpu_type_value", resource_type="resource_type_value", ) + assert args[0] == request_msg def test_export_usage_histories_use_cached_wrapped_rpc(): @@ -2307,9 +2328,15 @@ async def test_export_usage_histories_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + usage_service.ExportUsageHistoriesRequest(), + {}, + ], +) async def test_export_usage_histories_async( - transport: str = "grpc_asyncio", - request_type=usage_service.ExportUsageHistoriesRequest, + request_type, transport: str = "grpc_asyncio" ): client = UsageServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2318,7 +2345,7 @@ async def test_export_usage_histories_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( @@ -2340,11 +2367,6 @@ async def test_export_usage_histories_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_export_usage_histories_async_from_dict(): - await test_export_usage_histories_async(request_type=dict) - - def test_export_usage_histories_field_headers(): client = UsageServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2413,8 +2435,8 @@ async def test_export_usage_histories_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - usage_service.ExportForecastsRequest, - dict, + usage_service.ExportForecastsRequest(), + {}, ], ) def test_export_forecasts(request_type, transport: str = "grpc"): @@ -2425,7 +2447,7 @@ def test_export_forecasts(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.export_forecasts), "__call__") as call: @@ -2471,7 +2493,7 @@ def test_export_forecasts_non_empty_request_with_auto_populated_field(): client.export_forecasts(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == usage_service.ExportForecastsRequest( + request_msg = usage_service.ExportForecastsRequest( parent="parent_value", machine_family="machine_family_value", disk_type="disk_type_value", @@ -2479,6 +2501,7 @@ def test_export_forecasts_non_empty_request_with_auto_populated_field(): tpu_type="tpu_type_value", resource_type="resource_type_value", ) + assert args[0] == request_msg def test_export_forecasts_use_cached_wrapped_rpc(): @@ -2571,9 +2594,14 @@ async def test_export_forecasts_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_export_forecasts_async( - transport: str = "grpc_asyncio", request_type=usage_service.ExportForecastsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + usage_service.ExportForecastsRequest(), + {}, + ], +) +async def test_export_forecasts_async(request_type, transport: str = "grpc_asyncio"): client = UsageServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2581,7 +2609,7 @@ async def test_export_forecasts_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.export_forecasts), "__call__") as call: @@ -2601,11 +2629,6 @@ async def test_export_forecasts_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_export_forecasts_async_from_dict(): - await test_export_forecasts_async(request_type=dict) - - def test_export_forecasts_field_headers(): client = UsageServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2670,8 +2693,8 @@ async def test_export_forecasts_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - usage_service.ExportReservationsUsageRequest, - dict, + usage_service.ExportReservationsUsageRequest(), + {}, ], ) def test_export_reservations_usage(request_type, transport: str = "grpc"): @@ -2682,7 +2705,7 @@ def test_export_reservations_usage(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2730,12 +2753,13 @@ def test_export_reservations_usage_non_empty_request_with_auto_populated_field() client.export_reservations_usage(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == usage_service.ExportReservationsUsageRequest( + request_msg = usage_service.ExportReservationsUsageRequest( machine_family="machine_family_value", gpu_type="gpu_type_value", parent="parent_value", cloud_resource_type="cloud_resource_type_value", ) + assert args[0] == request_msg def test_export_reservations_usage_use_cached_wrapped_rpc(): @@ -2831,9 +2855,15 @@ async def test_export_reservations_usage_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + usage_service.ExportReservationsUsageRequest(), + {}, + ], +) async def test_export_reservations_usage_async( - transport: str = "grpc_asyncio", - request_type=usage_service.ExportReservationsUsageRequest, + request_type, transport: str = "grpc_asyncio" ): client = UsageServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2842,7 +2872,7 @@ async def test_export_reservations_usage_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( @@ -2864,11 +2894,6 @@ async def test_export_reservations_usage_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_export_reservations_usage_async_from_dict(): - await test_export_reservations_usage_async(request_type=dict) - - def test_export_reservations_usage_field_headers(): client = UsageServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3987,7 +4012,6 @@ def test_query_usage_histories_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = usage_service.QueryUsageHistoriesRequest() - assert args[0] == request_msg @@ -4008,7 +4032,6 @@ def test_query_forecasts_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = usage_service.QueryForecastsRequest() - assert args[0] == request_msg @@ -4031,7 +4054,6 @@ def test_query_reservations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = usage_service.QueryReservationsRequest() - assert args[0] == request_msg @@ -4054,7 +4076,6 @@ def test_export_usage_histories_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = usage_service.ExportUsageHistoriesRequest() - assert args[0] == request_msg @@ -4075,7 +4096,6 @@ def test_export_forecasts_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = usage_service.ExportForecastsRequest() - assert args[0] == request_msg @@ -4098,7 +4118,6 @@ def test_export_reservations_usage_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = usage_service.ExportReservationsUsageRequest() - assert args[0] == request_msg @@ -4139,7 +4158,6 @@ async def test_query_usage_histories_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = usage_service.QueryUsageHistoriesRequest() - assert args[0] == request_msg @@ -4164,7 +4182,6 @@ async def test_query_forecasts_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = usage_service.QueryForecastsRequest() - assert args[0] == request_msg @@ -4191,7 +4208,6 @@ async def test_query_reservations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = usage_service.QueryReservationsRequest() - assert args[0] == request_msg @@ -4218,7 +4234,6 @@ async def test_export_usage_histories_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = usage_service.ExportUsageHistoriesRequest() - assert args[0] == request_msg @@ -4243,7 +4258,6 @@ async def test_export_forecasts_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = usage_service.ExportForecastsRequest() - assert args[0] == request_msg @@ -4270,7 +4284,6 @@ async def test_export_reservations_usage_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = usage_service.ExportReservationsUsageRequest() - assert args[0] == request_msg @@ -5082,7 +5095,6 @@ def test_query_usage_histories_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = usage_service.QueryUsageHistoriesRequest() - assert args[0] == request_msg @@ -5102,7 +5114,6 @@ def test_query_forecasts_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = usage_service.QueryForecastsRequest() - assert args[0] == request_msg @@ -5124,7 +5135,6 @@ def test_query_reservations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = usage_service.QueryReservationsRequest() - assert args[0] == request_msg @@ -5146,7 +5156,6 @@ def test_export_usage_histories_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = usage_service.ExportUsageHistoriesRequest() - assert args[0] == request_msg @@ -5166,7 +5175,6 @@ def test_export_forecasts_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = usage_service.ExportForecastsRequest() - assert args[0] == request_msg @@ -5188,7 +5196,6 @@ def test_export_reservations_usage_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = usage_service.ExportReservationsUsageRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-certificate-manager/noxfile.py b/packages/google-cloud-certificate-manager/noxfile.py index c82919c8be09..7d2237416f29 100644 --- a/packages/google-cloud-certificate-manager/noxfile.py +++ b/packages/google-cloud-certificate-manager/noxfile.py @@ -47,7 +47,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-certificate-manager" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-certificate-manager/setup.py b/packages/google-cloud-certificate-manager/setup.py index e25ededb8d69..e3e6d2d628db 100644 --- a/packages/google-cloud-certificate-manager/setup.py +++ b/packages/google-cloud-certificate-manager/setup.py @@ -45,7 +45,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/google-cloud-certificate-manager/testing/constraints-3.10.txt b/packages/google-cloud-certificate-manager/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-certificate-manager/testing/constraints-3.10.txt +++ b/packages/google-cloud-certificate-manager/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-certificate-manager/tests/unit/gapic/certificate_manager_v1/test_certificate_manager.py b/packages/google-cloud-certificate-manager/tests/unit/gapic/certificate_manager_v1/test_certificate_manager.py index 1d846ba33e0d..ca1121a20f45 100644 --- a/packages/google-cloud-certificate-manager/tests/unit/gapic/certificate_manager_v1/test_certificate_manager.py +++ b/packages/google-cloud-certificate-manager/tests/unit/gapic/certificate_manager_v1/test_certificate_manager.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 @@ -125,6 +126,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" @@ -1370,8 +1386,8 @@ def test_certificate_manager_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - certificate_manager.ListCertificatesRequest, - dict, + certificate_manager.ListCertificatesRequest(), + {}, ], ) def test_list_certificates(request_type, transport: str = "grpc"): @@ -1382,7 +1398,7 @@ def test_list_certificates(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1435,12 +1451,13 @@ def test_list_certificates_non_empty_request_with_auto_populated_field(): client.list_certificates(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == certificate_manager.ListCertificatesRequest( + request_msg = certificate_manager.ListCertificatesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_certificates_use_cached_wrapped_rpc(): @@ -1523,10 +1540,14 @@ async def test_list_certificates_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_certificates_async( - transport: str = "grpc_asyncio", - request_type=certificate_manager.ListCertificatesRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + certificate_manager.ListCertificatesRequest(), + {}, + ], +) +async def test_list_certificates_async(request_type, transport: str = "grpc_asyncio"): client = CertificateManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1534,7 +1555,7 @@ async def test_list_certificates_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( @@ -1561,11 +1582,6 @@ async def test_list_certificates_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_certificates_async_from_dict(): - await test_list_certificates_async(request_type=dict) - - def test_list_certificates_field_headers(): client = CertificateManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1918,8 +1934,8 @@ async def test_list_certificates_async_pages(): @pytest.mark.parametrize( "request_type", [ - certificate_manager.GetCertificateRequest, - dict, + certificate_manager.GetCertificateRequest(), + {}, ], ) def test_get_certificate(request_type, transport: str = "grpc"): @@ -1930,7 +1946,7 @@ def test_get_certificate(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_certificate), "__call__") as call: @@ -1982,9 +1998,10 @@ def test_get_certificate_non_empty_request_with_auto_populated_field(): client.get_certificate(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == certificate_manager.GetCertificateRequest( + request_msg = certificate_manager.GetCertificateRequest( name="name_value", ) + assert args[0] == request_msg def test_get_certificate_use_cached_wrapped_rpc(): @@ -2065,10 +2082,14 @@ async def test_get_certificate_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_certificate_async( - transport: str = "grpc_asyncio", - request_type=certificate_manager.GetCertificateRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + certificate_manager.GetCertificateRequest(), + {}, + ], +) +async def test_get_certificate_async(request_type, transport: str = "grpc_asyncio"): client = CertificateManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2076,7 +2097,7 @@ async def test_get_certificate_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_certificate), "__call__") as call: @@ -2107,11 +2128,6 @@ async def test_get_certificate_async( assert response.scope == certificate_manager.Certificate.Scope.EDGE_CACHE -@pytest.mark.asyncio -async def test_get_certificate_async_from_dict(): - await test_get_certificate_async(request_type=dict) - - def test_get_certificate_field_headers(): client = CertificateManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2258,8 +2274,8 @@ async def test_get_certificate_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - certificate_manager.CreateCertificateRequest, - dict, + certificate_manager.CreateCertificateRequest(), + {}, ], ) def test_create_certificate(request_type, transport: str = "grpc"): @@ -2270,7 +2286,7 @@ def test_create_certificate(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2316,10 +2332,11 @@ def test_create_certificate_non_empty_request_with_auto_populated_field(): client.create_certificate(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == certificate_manager.CreateCertificateRequest( + request_msg = certificate_manager.CreateCertificateRequest( parent="parent_value", certificate_id="certificate_id_value", ) + assert args[0] == request_msg def test_create_certificate_use_cached_wrapped_rpc(): @@ -2414,10 +2431,14 @@ async def test_create_certificate_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_certificate_async( - transport: str = "grpc_asyncio", - request_type=certificate_manager.CreateCertificateRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + certificate_manager.CreateCertificateRequest(), + {}, + ], +) +async def test_create_certificate_async(request_type, transport: str = "grpc_asyncio"): client = CertificateManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2425,7 +2446,7 @@ async def test_create_certificate_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( @@ -2447,11 +2468,6 @@ async def test_create_certificate_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_certificate_async_from_dict(): - await test_create_certificate_async(request_type=dict) - - def test_create_certificate_field_headers(): client = CertificateManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2626,8 +2642,8 @@ async def test_create_certificate_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - certificate_manager.UpdateCertificateRequest, - dict, + certificate_manager.UpdateCertificateRequest(), + {}, ], ) def test_update_certificate(request_type, transport: str = "grpc"): @@ -2638,7 +2654,7 @@ def test_update_certificate(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2681,7 +2697,8 @@ def test_update_certificate_non_empty_request_with_auto_populated_field(): client.update_certificate(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == certificate_manager.UpdateCertificateRequest() + request_msg = certificate_manager.UpdateCertificateRequest() + assert args[0] == request_msg def test_update_certificate_use_cached_wrapped_rpc(): @@ -2776,10 +2793,14 @@ async def test_update_certificate_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_certificate_async( - transport: str = "grpc_asyncio", - request_type=certificate_manager.UpdateCertificateRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + certificate_manager.UpdateCertificateRequest(), + {}, + ], +) +async def test_update_certificate_async(request_type, transport: str = "grpc_asyncio"): client = CertificateManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2787,7 +2808,7 @@ async def test_update_certificate_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( @@ -2809,11 +2830,6 @@ async def test_update_certificate_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_certificate_async_from_dict(): - await test_update_certificate_async(request_type=dict) - - def test_update_certificate_field_headers(): client = CertificateManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2978,8 +2994,8 @@ async def test_update_certificate_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - certificate_manager.DeleteCertificateRequest, - dict, + certificate_manager.DeleteCertificateRequest(), + {}, ], ) def test_delete_certificate(request_type, transport: str = "grpc"): @@ -2990,7 +3006,7 @@ def test_delete_certificate(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,9 +3051,10 @@ def test_delete_certificate_non_empty_request_with_auto_populated_field(): client.delete_certificate(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == certificate_manager.DeleteCertificateRequest( + request_msg = certificate_manager.DeleteCertificateRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_certificate_use_cached_wrapped_rpc(): @@ -3132,10 +3149,14 @@ async def test_delete_certificate_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_certificate_async( - transport: str = "grpc_asyncio", - request_type=certificate_manager.DeleteCertificateRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + certificate_manager.DeleteCertificateRequest(), + {}, + ], +) +async def test_delete_certificate_async(request_type, transport: str = "grpc_asyncio"): client = CertificateManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3143,7 +3164,7 @@ async def test_delete_certificate_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( @@ -3165,11 +3186,6 @@ async def test_delete_certificate_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_certificate_async_from_dict(): - await test_delete_certificate_async(request_type=dict) - - def test_delete_certificate_field_headers(): client = CertificateManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3324,8 +3340,8 @@ async def test_delete_certificate_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - certificate_manager.ListCertificateMapsRequest, - dict, + certificate_manager.ListCertificateMapsRequest(), + {}, ], ) def test_list_certificate_maps(request_type, transport: str = "grpc"): @@ -3336,7 +3352,7 @@ def test_list_certificate_maps(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3389,12 +3405,13 @@ def test_list_certificate_maps_non_empty_request_with_auto_populated_field(): client.list_certificate_maps(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == certificate_manager.ListCertificateMapsRequest( + request_msg = certificate_manager.ListCertificateMapsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_certificate_maps_use_cached_wrapped_rpc(): @@ -3480,9 +3497,15 @@ async def test_list_certificate_maps_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + certificate_manager.ListCertificateMapsRequest(), + {}, + ], +) async def test_list_certificate_maps_async( - transport: str = "grpc_asyncio", - request_type=certificate_manager.ListCertificateMapsRequest, + request_type, transport: str = "grpc_asyncio" ): client = CertificateManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -3491,7 +3514,7 @@ async def test_list_certificate_maps_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( @@ -3518,11 +3541,6 @@ async def test_list_certificate_maps_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_certificate_maps_async_from_dict(): - await test_list_certificate_maps_async(request_type=dict) - - def test_list_certificate_maps_field_headers(): client = CertificateManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3875,8 +3893,8 @@ async def test_list_certificate_maps_async_pages(): @pytest.mark.parametrize( "request_type", [ - certificate_manager.GetCertificateMapRequest, - dict, + certificate_manager.GetCertificateMapRequest(), + {}, ], ) def test_get_certificate_map(request_type, transport: str = "grpc"): @@ -3887,7 +3905,7 @@ def test_get_certificate_map(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3937,9 +3955,10 @@ def test_get_certificate_map_non_empty_request_with_auto_populated_field(): client.get_certificate_map(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == certificate_manager.GetCertificateMapRequest( + request_msg = certificate_manager.GetCertificateMapRequest( name="name_value", ) + assert args[0] == request_msg def test_get_certificate_map_use_cached_wrapped_rpc(): @@ -4024,10 +4043,14 @@ async def test_get_certificate_map_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_certificate_map_async( - transport: str = "grpc_asyncio", - request_type=certificate_manager.GetCertificateMapRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + certificate_manager.GetCertificateMapRequest(), + {}, + ], +) +async def test_get_certificate_map_async(request_type, transport: str = "grpc_asyncio"): client = CertificateManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4035,7 +4058,7 @@ async def test_get_certificate_map_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( @@ -4062,11 +4085,6 @@ async def test_get_certificate_map_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_get_certificate_map_async_from_dict(): - await test_get_certificate_map_async(request_type=dict) - - def test_get_certificate_map_field_headers(): client = CertificateManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4221,8 +4239,8 @@ async def test_get_certificate_map_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - certificate_manager.CreateCertificateMapRequest, - dict, + certificate_manager.CreateCertificateMapRequest(), + {}, ], ) def test_create_certificate_map(request_type, transport: str = "grpc"): @@ -4233,7 +4251,7 @@ def test_create_certificate_map(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4279,10 +4297,11 @@ def test_create_certificate_map_non_empty_request_with_auto_populated_field(): client.create_certificate_map(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == certificate_manager.CreateCertificateMapRequest( + request_msg = certificate_manager.CreateCertificateMapRequest( parent="parent_value", certificate_map_id="certificate_map_id_value", ) + assert args[0] == request_msg def test_create_certificate_map_use_cached_wrapped_rpc(): @@ -4378,9 +4397,15 @@ async def test_create_certificate_map_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + certificate_manager.CreateCertificateMapRequest(), + {}, + ], +) async def test_create_certificate_map_async( - transport: str = "grpc_asyncio", - request_type=certificate_manager.CreateCertificateMapRequest, + request_type, transport: str = "grpc_asyncio" ): client = CertificateManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -4389,7 +4414,7 @@ async def test_create_certificate_map_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( @@ -4411,11 +4436,6 @@ async def test_create_certificate_map_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_certificate_map_async_from_dict(): - await test_create_certificate_map_async(request_type=dict) - - def test_create_certificate_map_field_headers(): client = CertificateManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4590,8 +4610,8 @@ async def test_create_certificate_map_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - certificate_manager.UpdateCertificateMapRequest, - dict, + certificate_manager.UpdateCertificateMapRequest(), + {}, ], ) def test_update_certificate_map(request_type, transport: str = "grpc"): @@ -4602,7 +4622,7 @@ def test_update_certificate_map(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4645,7 +4665,8 @@ def test_update_certificate_map_non_empty_request_with_auto_populated_field(): client.update_certificate_map(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == certificate_manager.UpdateCertificateMapRequest() + request_msg = certificate_manager.UpdateCertificateMapRequest() + assert args[0] == request_msg def test_update_certificate_map_use_cached_wrapped_rpc(): @@ -4741,9 +4762,15 @@ async def test_update_certificate_map_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + certificate_manager.UpdateCertificateMapRequest(), + {}, + ], +) async def test_update_certificate_map_async( - transport: str = "grpc_asyncio", - request_type=certificate_manager.UpdateCertificateMapRequest, + request_type, transport: str = "grpc_asyncio" ): client = CertificateManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -4752,7 +4779,7 @@ async def test_update_certificate_map_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( @@ -4774,11 +4801,6 @@ async def test_update_certificate_map_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_certificate_map_async_from_dict(): - await test_update_certificate_map_async(request_type=dict) - - def test_update_certificate_map_field_headers(): client = CertificateManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4943,8 +4965,8 @@ async def test_update_certificate_map_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - certificate_manager.DeleteCertificateMapRequest, - dict, + certificate_manager.DeleteCertificateMapRequest(), + {}, ], ) def test_delete_certificate_map(request_type, transport: str = "grpc"): @@ -4955,7 +4977,7 @@ def test_delete_certificate_map(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5000,9 +5022,10 @@ def test_delete_certificate_map_non_empty_request_with_auto_populated_field(): client.delete_certificate_map(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == certificate_manager.DeleteCertificateMapRequest( + request_msg = certificate_manager.DeleteCertificateMapRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_certificate_map_use_cached_wrapped_rpc(): @@ -5098,9 +5121,15 @@ async def test_delete_certificate_map_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + certificate_manager.DeleteCertificateMapRequest(), + {}, + ], +) async def test_delete_certificate_map_async( - transport: str = "grpc_asyncio", - request_type=certificate_manager.DeleteCertificateMapRequest, + request_type, transport: str = "grpc_asyncio" ): client = CertificateManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -5109,7 +5138,7 @@ async def test_delete_certificate_map_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( @@ -5131,11 +5160,6 @@ async def test_delete_certificate_map_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_certificate_map_async_from_dict(): - await test_delete_certificate_map_async(request_type=dict) - - def test_delete_certificate_map_field_headers(): client = CertificateManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5290,8 +5314,8 @@ async def test_delete_certificate_map_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - certificate_manager.ListCertificateMapEntriesRequest, - dict, + certificate_manager.ListCertificateMapEntriesRequest(), + {}, ], ) def test_list_certificate_map_entries(request_type, transport: str = "grpc"): @@ -5302,7 +5326,7 @@ def test_list_certificate_map_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( @@ -5355,12 +5379,13 @@ def test_list_certificate_map_entries_non_empty_request_with_auto_populated_fiel client.list_certificate_map_entries(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == certificate_manager.ListCertificateMapEntriesRequest( + request_msg = certificate_manager.ListCertificateMapEntriesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_certificate_map_entries_use_cached_wrapped_rpc(): @@ -5446,9 +5471,15 @@ async def test_list_certificate_map_entries_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + certificate_manager.ListCertificateMapEntriesRequest(), + {}, + ], +) async def test_list_certificate_map_entries_async( - transport: str = "grpc_asyncio", - request_type=certificate_manager.ListCertificateMapEntriesRequest, + request_type, transport: str = "grpc_asyncio" ): client = CertificateManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -5457,7 +5488,7 @@ async def test_list_certificate_map_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( @@ -5484,11 +5515,6 @@ async def test_list_certificate_map_entries_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_certificate_map_entries_async_from_dict(): - await test_list_certificate_map_entries_async(request_type=dict) - - def test_list_certificate_map_entries_field_headers(): client = CertificateManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5849,8 +5875,8 @@ async def test_list_certificate_map_entries_async_pages(): @pytest.mark.parametrize( "request_type", [ - certificate_manager.GetCertificateMapEntryRequest, - dict, + certificate_manager.GetCertificateMapEntryRequest(), + {}, ], ) def test_get_certificate_map_entry(request_type, transport: str = "grpc"): @@ -5861,7 +5887,7 @@ def test_get_certificate_map_entry(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5916,9 +5942,10 @@ def test_get_certificate_map_entry_non_empty_request_with_auto_populated_field() client.get_certificate_map_entry(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == certificate_manager.GetCertificateMapEntryRequest( + request_msg = certificate_manager.GetCertificateMapEntryRequest( name="name_value", ) + assert args[0] == request_msg def test_get_certificate_map_entry_use_cached_wrapped_rpc(): @@ -6004,9 +6031,15 @@ async def test_get_certificate_map_entry_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + certificate_manager.GetCertificateMapEntryRequest(), + {}, + ], +) async def test_get_certificate_map_entry_async( - transport: str = "grpc_asyncio", - request_type=certificate_manager.GetCertificateMapEntryRequest, + request_type, transport: str = "grpc_asyncio" ): client = CertificateManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -6015,7 +6048,7 @@ async def test_get_certificate_map_entry_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( @@ -6046,11 +6079,6 @@ async def test_get_certificate_map_entry_async( assert response.state == certificate_manager.ServingState.ACTIVE -@pytest.mark.asyncio -async def test_get_certificate_map_entry_async_from_dict(): - await test_get_certificate_map_entry_async(request_type=dict) - - def test_get_certificate_map_entry_field_headers(): client = CertificateManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6205,8 +6233,8 @@ async def test_get_certificate_map_entry_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - certificate_manager.CreateCertificateMapEntryRequest, - dict, + certificate_manager.CreateCertificateMapEntryRequest(), + {}, ], ) def test_create_certificate_map_entry(request_type, transport: str = "grpc"): @@ -6217,7 +6245,7 @@ def test_create_certificate_map_entry(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6263,10 +6291,11 @@ def test_create_certificate_map_entry_non_empty_request_with_auto_populated_fiel client.create_certificate_map_entry(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == certificate_manager.CreateCertificateMapEntryRequest( + request_msg = certificate_manager.CreateCertificateMapEntryRequest( parent="parent_value", certificate_map_entry_id="certificate_map_entry_id_value", ) + assert args[0] == request_msg def test_create_certificate_map_entry_use_cached_wrapped_rpc(): @@ -6362,9 +6391,15 @@ async def test_create_certificate_map_entry_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + certificate_manager.CreateCertificateMapEntryRequest(), + {}, + ], +) async def test_create_certificate_map_entry_async( - transport: str = "grpc_asyncio", - request_type=certificate_manager.CreateCertificateMapEntryRequest, + request_type, transport: str = "grpc_asyncio" ): client = CertificateManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -6373,7 +6408,7 @@ async def test_create_certificate_map_entry_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( @@ -6395,11 +6430,6 @@ async def test_create_certificate_map_entry_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_certificate_map_entry_async_from_dict(): - await test_create_certificate_map_entry_async(request_type=dict) - - def test_create_certificate_map_entry_field_headers(): client = CertificateManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6582,8 +6612,8 @@ async def test_create_certificate_map_entry_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - certificate_manager.UpdateCertificateMapEntryRequest, - dict, + certificate_manager.UpdateCertificateMapEntryRequest(), + {}, ], ) def test_update_certificate_map_entry(request_type, transport: str = "grpc"): @@ -6594,7 +6624,7 @@ def test_update_certificate_map_entry(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6637,7 +6667,8 @@ def test_update_certificate_map_entry_non_empty_request_with_auto_populated_fiel client.update_certificate_map_entry(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == certificate_manager.UpdateCertificateMapEntryRequest() + request_msg = certificate_manager.UpdateCertificateMapEntryRequest() + assert args[0] == request_msg def test_update_certificate_map_entry_use_cached_wrapped_rpc(): @@ -6733,9 +6764,15 @@ async def test_update_certificate_map_entry_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + certificate_manager.UpdateCertificateMapEntryRequest(), + {}, + ], +) async def test_update_certificate_map_entry_async( - transport: str = "grpc_asyncio", - request_type=certificate_manager.UpdateCertificateMapEntryRequest, + request_type, transport: str = "grpc_asyncio" ): client = CertificateManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -6744,7 +6781,7 @@ async def test_update_certificate_map_entry_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( @@ -6766,11 +6803,6 @@ async def test_update_certificate_map_entry_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_certificate_map_entry_async_from_dict(): - await test_update_certificate_map_entry_async(request_type=dict) - - def test_update_certificate_map_entry_field_headers(): client = CertificateManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6943,8 +6975,8 @@ async def test_update_certificate_map_entry_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - certificate_manager.DeleteCertificateMapEntryRequest, - dict, + certificate_manager.DeleteCertificateMapEntryRequest(), + {}, ], ) def test_delete_certificate_map_entry(request_type, transport: str = "grpc"): @@ -6955,7 +6987,7 @@ def test_delete_certificate_map_entry(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7000,9 +7032,10 @@ def test_delete_certificate_map_entry_non_empty_request_with_auto_populated_fiel client.delete_certificate_map_entry(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == certificate_manager.DeleteCertificateMapEntryRequest( + request_msg = certificate_manager.DeleteCertificateMapEntryRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_certificate_map_entry_use_cached_wrapped_rpc(): @@ -7098,9 +7131,15 @@ async def test_delete_certificate_map_entry_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + certificate_manager.DeleteCertificateMapEntryRequest(), + {}, + ], +) async def test_delete_certificate_map_entry_async( - transport: str = "grpc_asyncio", - request_type=certificate_manager.DeleteCertificateMapEntryRequest, + request_type, transport: str = "grpc_asyncio" ): client = CertificateManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -7109,7 +7148,7 @@ async def test_delete_certificate_map_entry_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( @@ -7131,11 +7170,6 @@ async def test_delete_certificate_map_entry_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_certificate_map_entry_async_from_dict(): - await test_delete_certificate_map_entry_async(request_type=dict) - - def test_delete_certificate_map_entry_field_headers(): client = CertificateManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7290,8 +7324,8 @@ async def test_delete_certificate_map_entry_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - certificate_manager.ListDnsAuthorizationsRequest, - dict, + certificate_manager.ListDnsAuthorizationsRequest(), + {}, ], ) def test_list_dns_authorizations(request_type, transport: str = "grpc"): @@ -7302,7 +7336,7 @@ def test_list_dns_authorizations(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7355,12 +7389,13 @@ def test_list_dns_authorizations_non_empty_request_with_auto_populated_field(): client.list_dns_authorizations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == certificate_manager.ListDnsAuthorizationsRequest( + request_msg = certificate_manager.ListDnsAuthorizationsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_dns_authorizations_use_cached_wrapped_rpc(): @@ -7446,9 +7481,15 @@ async def test_list_dns_authorizations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + certificate_manager.ListDnsAuthorizationsRequest(), + {}, + ], +) async def test_list_dns_authorizations_async( - transport: str = "grpc_asyncio", - request_type=certificate_manager.ListDnsAuthorizationsRequest, + request_type, transport: str = "grpc_asyncio" ): client = CertificateManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -7457,7 +7498,7 @@ async def test_list_dns_authorizations_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( @@ -7484,11 +7525,6 @@ async def test_list_dns_authorizations_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_dns_authorizations_async_from_dict(): - await test_list_dns_authorizations_async(request_type=dict) - - def test_list_dns_authorizations_field_headers(): client = CertificateManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7843,8 +7879,8 @@ async def test_list_dns_authorizations_async_pages(): @pytest.mark.parametrize( "request_type", [ - certificate_manager.GetDnsAuthorizationRequest, - dict, + certificate_manager.GetDnsAuthorizationRequest(), + {}, ], ) def test_get_dns_authorization(request_type, transport: str = "grpc"): @@ -7855,7 +7891,7 @@ def test_get_dns_authorization(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7909,9 +7945,10 @@ def test_get_dns_authorization_non_empty_request_with_auto_populated_field(): client.get_dns_authorization(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == certificate_manager.GetDnsAuthorizationRequest( + request_msg = certificate_manager.GetDnsAuthorizationRequest( name="name_value", ) + assert args[0] == request_msg def test_get_dns_authorization_use_cached_wrapped_rpc(): @@ -7997,9 +8034,15 @@ async def test_get_dns_authorization_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + certificate_manager.GetDnsAuthorizationRequest(), + {}, + ], +) async def test_get_dns_authorization_async( - transport: str = "grpc_asyncio", - request_type=certificate_manager.GetDnsAuthorizationRequest, + request_type, transport: str = "grpc_asyncio" ): client = CertificateManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -8008,7 +8051,7 @@ async def test_get_dns_authorization_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( @@ -8039,11 +8082,6 @@ async def test_get_dns_authorization_async( assert response.type_ == certificate_manager.DnsAuthorization.Type.FIXED_RECORD -@pytest.mark.asyncio -async def test_get_dns_authorization_async_from_dict(): - await test_get_dns_authorization_async(request_type=dict) - - def test_get_dns_authorization_field_headers(): client = CertificateManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8198,8 +8236,8 @@ async def test_get_dns_authorization_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - certificate_manager.CreateDnsAuthorizationRequest, - dict, + certificate_manager.CreateDnsAuthorizationRequest(), + {}, ], ) def test_create_dns_authorization(request_type, transport: str = "grpc"): @@ -8210,7 +8248,7 @@ def test_create_dns_authorization(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8256,10 +8294,11 @@ def test_create_dns_authorization_non_empty_request_with_auto_populated_field(): client.create_dns_authorization(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == certificate_manager.CreateDnsAuthorizationRequest( + request_msg = certificate_manager.CreateDnsAuthorizationRequest( parent="parent_value", dns_authorization_id="dns_authorization_id_value", ) + assert args[0] == request_msg def test_create_dns_authorization_use_cached_wrapped_rpc(): @@ -8355,9 +8394,15 @@ async def test_create_dns_authorization_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + certificate_manager.CreateDnsAuthorizationRequest(), + {}, + ], +) async def test_create_dns_authorization_async( - transport: str = "grpc_asyncio", - request_type=certificate_manager.CreateDnsAuthorizationRequest, + request_type, transport: str = "grpc_asyncio" ): client = CertificateManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -8366,7 +8411,7 @@ async def test_create_dns_authorization_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( @@ -8388,11 +8433,6 @@ async def test_create_dns_authorization_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_dns_authorization_async_from_dict(): - await test_create_dns_authorization_async(request_type=dict) - - def test_create_dns_authorization_field_headers(): client = CertificateManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8567,8 +8607,8 @@ async def test_create_dns_authorization_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - certificate_manager.UpdateDnsAuthorizationRequest, - dict, + certificate_manager.UpdateDnsAuthorizationRequest(), + {}, ], ) def test_update_dns_authorization(request_type, transport: str = "grpc"): @@ -8579,7 +8619,7 @@ def test_update_dns_authorization(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8622,7 +8662,8 @@ def test_update_dns_authorization_non_empty_request_with_auto_populated_field(): client.update_dns_authorization(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == certificate_manager.UpdateDnsAuthorizationRequest() + request_msg = certificate_manager.UpdateDnsAuthorizationRequest() + assert args[0] == request_msg def test_update_dns_authorization_use_cached_wrapped_rpc(): @@ -8718,9 +8759,15 @@ async def test_update_dns_authorization_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + certificate_manager.UpdateDnsAuthorizationRequest(), + {}, + ], +) async def test_update_dns_authorization_async( - transport: str = "grpc_asyncio", - request_type=certificate_manager.UpdateDnsAuthorizationRequest, + request_type, transport: str = "grpc_asyncio" ): client = CertificateManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -8729,7 +8776,7 @@ async def test_update_dns_authorization_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( @@ -8751,11 +8798,6 @@ async def test_update_dns_authorization_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_dns_authorization_async_from_dict(): - await test_update_dns_authorization_async(request_type=dict) - - def test_update_dns_authorization_field_headers(): client = CertificateManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8920,8 +8962,8 @@ async def test_update_dns_authorization_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - certificate_manager.DeleteDnsAuthorizationRequest, - dict, + certificate_manager.DeleteDnsAuthorizationRequest(), + {}, ], ) def test_delete_dns_authorization(request_type, transport: str = "grpc"): @@ -8932,7 +8974,7 @@ def test_delete_dns_authorization(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8977,9 +9019,10 @@ def test_delete_dns_authorization_non_empty_request_with_auto_populated_field(): client.delete_dns_authorization(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == certificate_manager.DeleteDnsAuthorizationRequest( + request_msg = certificate_manager.DeleteDnsAuthorizationRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_dns_authorization_use_cached_wrapped_rpc(): @@ -9075,9 +9118,15 @@ async def test_delete_dns_authorization_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + certificate_manager.DeleteDnsAuthorizationRequest(), + {}, + ], +) async def test_delete_dns_authorization_async( - transport: str = "grpc_asyncio", - request_type=certificate_manager.DeleteDnsAuthorizationRequest, + request_type, transport: str = "grpc_asyncio" ): client = CertificateManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -9086,7 +9135,7 @@ async def test_delete_dns_authorization_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( @@ -9108,11 +9157,6 @@ async def test_delete_dns_authorization_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_dns_authorization_async_from_dict(): - await test_delete_dns_authorization_async(request_type=dict) - - def test_delete_dns_authorization_field_headers(): client = CertificateManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9267,8 +9311,8 @@ async def test_delete_dns_authorization_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - certificate_issuance_config.ListCertificateIssuanceConfigsRequest, - dict, + certificate_issuance_config.ListCertificateIssuanceConfigsRequest(), + {}, ], ) def test_list_certificate_issuance_configs(request_type, transport: str = "grpc"): @@ -9279,7 +9323,7 @@ def test_list_certificate_issuance_configs(request_type, transport: str = "grpc" # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9334,14 +9378,13 @@ def test_list_certificate_issuance_configs_non_empty_request_with_auto_populated client.list_certificate_issuance_configs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == certificate_issuance_config.ListCertificateIssuanceConfigsRequest( + request_msg = certificate_issuance_config.ListCertificateIssuanceConfigsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_certificate_issuance_configs_use_cached_wrapped_rpc(): @@ -9427,9 +9470,15 @@ async def test_list_certificate_issuance_configs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + certificate_issuance_config.ListCertificateIssuanceConfigsRequest(), + {}, + ], +) async def test_list_certificate_issuance_configs_async( - transport: str = "grpc_asyncio", - request_type=certificate_issuance_config.ListCertificateIssuanceConfigsRequest, + request_type, transport: str = "grpc_asyncio" ): client = CertificateManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -9438,7 +9487,7 @@ async def test_list_certificate_issuance_configs_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( @@ -9465,11 +9514,6 @@ async def test_list_certificate_issuance_configs_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_certificate_issuance_configs_async_from_dict(): - await test_list_certificate_issuance_configs_async(request_type=dict) - - def test_list_certificate_issuance_configs_field_headers(): client = CertificateManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9838,8 +9882,8 @@ async def test_list_certificate_issuance_configs_async_pages(): @pytest.mark.parametrize( "request_type", [ - certificate_issuance_config.GetCertificateIssuanceConfigRequest, - dict, + certificate_issuance_config.GetCertificateIssuanceConfigRequest(), + {}, ], ) def test_get_certificate_issuance_config(request_type, transport: str = "grpc"): @@ -9850,7 +9894,7 @@ def test_get_certificate_issuance_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( @@ -9907,11 +9951,10 @@ def test_get_certificate_issuance_config_non_empty_request_with_auto_populated_f client.get_certificate_issuance_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == certificate_issuance_config.GetCertificateIssuanceConfigRequest( + request_msg = certificate_issuance_config.GetCertificateIssuanceConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_certificate_issuance_config_use_cached_wrapped_rpc(): @@ -9997,9 +10040,15 @@ async def test_get_certificate_issuance_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + certificate_issuance_config.GetCertificateIssuanceConfigRequest(), + {}, + ], +) async def test_get_certificate_issuance_config_async( - transport: str = "grpc_asyncio", - request_type=certificate_issuance_config.GetCertificateIssuanceConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = CertificateManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -10008,7 +10057,7 @@ async def test_get_certificate_issuance_config_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( @@ -10042,11 +10091,6 @@ async def test_get_certificate_issuance_config_async( ) -@pytest.mark.asyncio -async def test_get_certificate_issuance_config_async_from_dict(): - await test_get_certificate_issuance_config_async(request_type=dict) - - def test_get_certificate_issuance_config_field_headers(): client = CertificateManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10201,8 +10245,8 @@ async def test_get_certificate_issuance_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcc_certificate_issuance_config.CreateCertificateIssuanceConfigRequest, - dict, + gcc_certificate_issuance_config.CreateCertificateIssuanceConfigRequest(), + {}, ], ) def test_create_certificate_issuance_config(request_type, transport: str = "grpc"): @@ -10213,7 +10257,7 @@ def test_create_certificate_issuance_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( @@ -10261,12 +10305,13 @@ def test_create_certificate_issuance_config_non_empty_request_with_auto_populate client.create_certificate_issuance_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == gcc_certificate_issuance_config.CreateCertificateIssuanceConfigRequest( - parent="parent_value", - certificate_issuance_config_id="certificate_issuance_config_id_value", + request_msg = ( + gcc_certificate_issuance_config.CreateCertificateIssuanceConfigRequest( + parent="parent_value", + certificate_issuance_config_id="certificate_issuance_config_id_value", + ) ) + assert args[0] == request_msg def test_create_certificate_issuance_config_use_cached_wrapped_rpc(): @@ -10362,9 +10407,15 @@ async def test_create_certificate_issuance_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcc_certificate_issuance_config.CreateCertificateIssuanceConfigRequest(), + {}, + ], +) async def test_create_certificate_issuance_config_async( - transport: str = "grpc_asyncio", - request_type=gcc_certificate_issuance_config.CreateCertificateIssuanceConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = CertificateManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -10373,7 +10424,7 @@ async def test_create_certificate_issuance_config_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( @@ -10397,11 +10448,6 @@ async def test_create_certificate_issuance_config_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_certificate_issuance_config_async_from_dict(): - await test_create_certificate_issuance_config_async(request_type=dict) - - def test_create_certificate_issuance_config_field_headers(): client = CertificateManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10588,8 +10634,8 @@ async def test_create_certificate_issuance_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - certificate_issuance_config.DeleteCertificateIssuanceConfigRequest, - dict, + certificate_issuance_config.DeleteCertificateIssuanceConfigRequest(), + {}, ], ) def test_delete_certificate_issuance_config(request_type, transport: str = "grpc"): @@ -10600,7 +10646,7 @@ def test_delete_certificate_issuance_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( @@ -10645,11 +10691,12 @@ def test_delete_certificate_issuance_config_non_empty_request_with_auto_populate client.delete_certificate_issuance_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == certificate_issuance_config.DeleteCertificateIssuanceConfigRequest( - name="name_value", + request_msg = ( + certificate_issuance_config.DeleteCertificateIssuanceConfigRequest( + name="name_value", + ) ) + assert args[0] == request_msg def test_delete_certificate_issuance_config_use_cached_wrapped_rpc(): @@ -10745,9 +10792,15 @@ async def test_delete_certificate_issuance_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + certificate_issuance_config.DeleteCertificateIssuanceConfigRequest(), + {}, + ], +) async def test_delete_certificate_issuance_config_async( - transport: str = "grpc_asyncio", - request_type=certificate_issuance_config.DeleteCertificateIssuanceConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = CertificateManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -10756,7 +10809,7 @@ async def test_delete_certificate_issuance_config_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( @@ -10778,11 +10831,6 @@ async def test_delete_certificate_issuance_config_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_certificate_issuance_config_async_from_dict(): - await test_delete_certificate_issuance_config_async(request_type=dict) - - def test_delete_certificate_issuance_config_field_headers(): client = CertificateManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10937,8 +10985,8 @@ async def test_delete_certificate_issuance_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - trust_config.ListTrustConfigsRequest, - dict, + trust_config.ListTrustConfigsRequest(), + {}, ], ) def test_list_trust_configs(request_type, transport: str = "grpc"): @@ -10949,7 +10997,7 @@ def test_list_trust_configs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11002,12 +11050,13 @@ def test_list_trust_configs_non_empty_request_with_auto_populated_field(): client.list_trust_configs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == trust_config.ListTrustConfigsRequest( + request_msg = trust_config.ListTrustConfigsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_trust_configs_use_cached_wrapped_rpc(): @@ -11092,9 +11141,14 @@ async def test_list_trust_configs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_trust_configs_async( - transport: str = "grpc_asyncio", request_type=trust_config.ListTrustConfigsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + trust_config.ListTrustConfigsRequest(), + {}, + ], +) +async def test_list_trust_configs_async(request_type, transport: str = "grpc_asyncio"): client = CertificateManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11102,7 +11156,7 @@ async def test_list_trust_configs_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( @@ -11129,11 +11183,6 @@ async def test_list_trust_configs_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_trust_configs_async_from_dict(): - await test_list_trust_configs_async(request_type=dict) - - def test_list_trust_configs_field_headers(): client = CertificateManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11486,8 +11535,8 @@ async def test_list_trust_configs_async_pages(): @pytest.mark.parametrize( "request_type", [ - trust_config.GetTrustConfigRequest, - dict, + trust_config.GetTrustConfigRequest(), + {}, ], ) def test_get_trust_config(request_type, transport: str = "grpc"): @@ -11498,7 +11547,7 @@ def test_get_trust_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(type(client.transport.get_trust_config), "__call__") as call: @@ -11546,9 +11595,10 @@ def test_get_trust_config_non_empty_request_with_auto_populated_field(): client.get_trust_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == trust_config.GetTrustConfigRequest( + request_msg = trust_config.GetTrustConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_trust_config_use_cached_wrapped_rpc(): @@ -11631,9 +11681,14 @@ async def test_get_trust_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_trust_config_async( - transport: str = "grpc_asyncio", request_type=trust_config.GetTrustConfigRequest -): +@pytest.mark.parametrize( + "request_type", + [ + trust_config.GetTrustConfigRequest(), + {}, + ], +) +async def test_get_trust_config_async(request_type, transport: str = "grpc_asyncio"): client = CertificateManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11641,7 +11696,7 @@ async def test_get_trust_config_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_trust_config), "__call__") as call: @@ -11668,11 +11723,6 @@ async def test_get_trust_config_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_trust_config_async_from_dict(): - await test_get_trust_config_async(request_type=dict) - - def test_get_trust_config_field_headers(): client = CertificateManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11819,8 +11869,8 @@ async def test_get_trust_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcc_trust_config.CreateTrustConfigRequest, - dict, + gcc_trust_config.CreateTrustConfigRequest(), + {}, ], ) def test_create_trust_config(request_type, transport: str = "grpc"): @@ -11831,7 +11881,7 @@ def test_create_trust_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( @@ -11877,10 +11927,11 @@ def test_create_trust_config_non_empty_request_with_auto_populated_field(): client.create_trust_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcc_trust_config.CreateTrustConfigRequest( + request_msg = gcc_trust_config.CreateTrustConfigRequest( parent="parent_value", trust_config_id="trust_config_id_value", ) + assert args[0] == request_msg def test_create_trust_config_use_cached_wrapped_rpc(): @@ -11975,10 +12026,14 @@ async def test_create_trust_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_trust_config_async( - transport: str = "grpc_asyncio", - request_type=gcc_trust_config.CreateTrustConfigRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + gcc_trust_config.CreateTrustConfigRequest(), + {}, + ], +) +async def test_create_trust_config_async(request_type, transport: str = "grpc_asyncio"): client = CertificateManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11986,7 +12041,7 @@ async def test_create_trust_config_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( @@ -12008,11 +12063,6 @@ async def test_create_trust_config_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_trust_config_async_from_dict(): - await test_create_trust_config_async(request_type=dict) - - def test_create_trust_config_field_headers(): client = CertificateManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12187,8 +12237,8 @@ async def test_create_trust_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcc_trust_config.UpdateTrustConfigRequest, - dict, + gcc_trust_config.UpdateTrustConfigRequest(), + {}, ], ) def test_update_trust_config(request_type, transport: str = "grpc"): @@ -12199,7 +12249,7 @@ def test_update_trust_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( @@ -12242,7 +12292,8 @@ def test_update_trust_config_non_empty_request_with_auto_populated_field(): client.update_trust_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcc_trust_config.UpdateTrustConfigRequest() + request_msg = gcc_trust_config.UpdateTrustConfigRequest() + assert args[0] == request_msg def test_update_trust_config_use_cached_wrapped_rpc(): @@ -12337,10 +12388,14 @@ async def test_update_trust_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_trust_config_async( - transport: str = "grpc_asyncio", - request_type=gcc_trust_config.UpdateTrustConfigRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + gcc_trust_config.UpdateTrustConfigRequest(), + {}, + ], +) +async def test_update_trust_config_async(request_type, transport: str = "grpc_asyncio"): client = CertificateManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12348,7 +12403,7 @@ async def test_update_trust_config_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( @@ -12370,11 +12425,6 @@ async def test_update_trust_config_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_trust_config_async_from_dict(): - await test_update_trust_config_async(request_type=dict) - - def test_update_trust_config_field_headers(): client = CertificateManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12539,8 +12589,8 @@ async def test_update_trust_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - trust_config.DeleteTrustConfigRequest, - dict, + trust_config.DeleteTrustConfigRequest(), + {}, ], ) def test_delete_trust_config(request_type, transport: str = "grpc"): @@ -12551,7 +12601,7 @@ def test_delete_trust_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( @@ -12597,10 +12647,11 @@ def test_delete_trust_config_non_empty_request_with_auto_populated_field(): client.delete_trust_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == trust_config.DeleteTrustConfigRequest( + request_msg = trust_config.DeleteTrustConfigRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_trust_config_use_cached_wrapped_rpc(): @@ -12695,9 +12746,14 @@ async def test_delete_trust_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_trust_config_async( - transport: str = "grpc_asyncio", request_type=trust_config.DeleteTrustConfigRequest -): +@pytest.mark.parametrize( + "request_type", + [ + trust_config.DeleteTrustConfigRequest(), + {}, + ], +) +async def test_delete_trust_config_async(request_type, transport: str = "grpc_asyncio"): client = CertificateManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12705,7 +12761,7 @@ async def test_delete_trust_config_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( @@ -12727,11 +12783,6 @@ async def test_delete_trust_config_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_trust_config_async_from_dict(): - await test_delete_trust_config_async(request_type=dict) - - def test_delete_trust_config_field_headers(): client = CertificateManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -19114,7 +19165,6 @@ def test_list_certificates_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = certificate_manager.ListCertificatesRequest() - assert args[0] == request_msg @@ -19135,7 +19185,6 @@ def test_get_certificate_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = certificate_manager.GetCertificateRequest() - assert args[0] == request_msg @@ -19158,7 +19207,6 @@ def test_create_certificate_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = certificate_manager.CreateCertificateRequest() - assert args[0] == request_msg @@ -19181,7 +19229,6 @@ def test_update_certificate_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = certificate_manager.UpdateCertificateRequest() - assert args[0] == request_msg @@ -19204,7 +19251,6 @@ def test_delete_certificate_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = certificate_manager.DeleteCertificateRequest() - assert args[0] == request_msg @@ -19227,7 +19273,6 @@ def test_list_certificate_maps_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = certificate_manager.ListCertificateMapsRequest() - assert args[0] == request_msg @@ -19250,7 +19295,6 @@ def test_get_certificate_map_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = certificate_manager.GetCertificateMapRequest() - assert args[0] == request_msg @@ -19273,7 +19317,6 @@ def test_create_certificate_map_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = certificate_manager.CreateCertificateMapRequest() - assert args[0] == request_msg @@ -19296,7 +19339,6 @@ def test_update_certificate_map_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = certificate_manager.UpdateCertificateMapRequest() - assert args[0] == request_msg @@ -19319,7 +19361,6 @@ def test_delete_certificate_map_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = certificate_manager.DeleteCertificateMapRequest() - assert args[0] == request_msg @@ -19342,7 +19383,6 @@ def test_list_certificate_map_entries_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = certificate_manager.ListCertificateMapEntriesRequest() - assert args[0] == request_msg @@ -19365,7 +19405,6 @@ def test_get_certificate_map_entry_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = certificate_manager.GetCertificateMapEntryRequest() - assert args[0] == request_msg @@ -19388,7 +19427,6 @@ def test_create_certificate_map_entry_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = certificate_manager.CreateCertificateMapEntryRequest() - assert args[0] == request_msg @@ -19411,7 +19449,6 @@ def test_update_certificate_map_entry_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = certificate_manager.UpdateCertificateMapEntryRequest() - assert args[0] == request_msg @@ -19434,7 +19471,6 @@ def test_delete_certificate_map_entry_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = certificate_manager.DeleteCertificateMapEntryRequest() - assert args[0] == request_msg @@ -19457,7 +19493,6 @@ def test_list_dns_authorizations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = certificate_manager.ListDnsAuthorizationsRequest() - assert args[0] == request_msg @@ -19480,7 +19515,6 @@ def test_get_dns_authorization_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = certificate_manager.GetDnsAuthorizationRequest() - assert args[0] == request_msg @@ -19503,7 +19537,6 @@ def test_create_dns_authorization_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = certificate_manager.CreateDnsAuthorizationRequest() - assert args[0] == request_msg @@ -19526,7 +19559,6 @@ def test_update_dns_authorization_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = certificate_manager.UpdateDnsAuthorizationRequest() - assert args[0] == request_msg @@ -19549,7 +19581,6 @@ def test_delete_dns_authorization_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = certificate_manager.DeleteDnsAuthorizationRequest() - assert args[0] == request_msg @@ -19576,7 +19607,6 @@ def test_list_certificate_issuance_configs_empty_call_grpc(): request_msg = ( certificate_issuance_config.ListCertificateIssuanceConfigsRequest() ) - assert args[0] == request_msg @@ -19599,7 +19629,6 @@ def test_get_certificate_issuance_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = certificate_issuance_config.GetCertificateIssuanceConfigRequest() - assert args[0] == request_msg @@ -19624,7 +19653,6 @@ def test_create_certificate_issuance_config_empty_call_grpc(): request_msg = ( gcc_certificate_issuance_config.CreateCertificateIssuanceConfigRequest() ) - assert args[0] == request_msg @@ -19649,7 +19677,6 @@ def test_delete_certificate_issuance_config_empty_call_grpc(): request_msg = ( certificate_issuance_config.DeleteCertificateIssuanceConfigRequest() ) - assert args[0] == request_msg @@ -19672,7 +19699,6 @@ def test_list_trust_configs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = trust_config.ListTrustConfigsRequest() - assert args[0] == request_msg @@ -19693,7 +19719,6 @@ def test_get_trust_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = trust_config.GetTrustConfigRequest() - assert args[0] == request_msg @@ -19716,7 +19741,6 @@ def test_create_trust_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcc_trust_config.CreateTrustConfigRequest() - assert args[0] == request_msg @@ -19739,7 +19763,6 @@ def test_update_trust_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcc_trust_config.UpdateTrustConfigRequest() - assert args[0] == request_msg @@ -19762,7 +19785,6 @@ def test_delete_trust_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = trust_config.DeleteTrustConfigRequest() - assert args[0] == request_msg @@ -19806,7 +19828,6 @@ async def test_list_certificates_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = certificate_manager.ListCertificatesRequest() - assert args[0] == request_msg @@ -19837,7 +19858,6 @@ async def test_get_certificate_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = certificate_manager.GetCertificateRequest() - assert args[0] == request_msg @@ -19864,7 +19884,6 @@ async def test_create_certificate_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = certificate_manager.CreateCertificateRequest() - assert args[0] == request_msg @@ -19891,7 +19910,6 @@ async def test_update_certificate_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = certificate_manager.UpdateCertificateRequest() - assert args[0] == request_msg @@ -19918,7 +19936,6 @@ async def test_delete_certificate_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = certificate_manager.DeleteCertificateRequest() - assert args[0] == request_msg @@ -19948,7 +19965,6 @@ async def test_list_certificate_maps_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = certificate_manager.ListCertificateMapsRequest() - assert args[0] == request_msg @@ -19978,7 +19994,6 @@ async def test_get_certificate_map_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = certificate_manager.GetCertificateMapRequest() - assert args[0] == request_msg @@ -20005,7 +20020,6 @@ async def test_create_certificate_map_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = certificate_manager.CreateCertificateMapRequest() - assert args[0] == request_msg @@ -20032,7 +20046,6 @@ async def test_update_certificate_map_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = certificate_manager.UpdateCertificateMapRequest() - assert args[0] == request_msg @@ -20059,7 +20072,6 @@ async def test_delete_certificate_map_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = certificate_manager.DeleteCertificateMapRequest() - assert args[0] == request_msg @@ -20089,7 +20101,6 @@ async def test_list_certificate_map_entries_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = certificate_manager.ListCertificateMapEntriesRequest() - assert args[0] == request_msg @@ -20121,7 +20132,6 @@ async def test_get_certificate_map_entry_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = certificate_manager.GetCertificateMapEntryRequest() - assert args[0] == request_msg @@ -20148,7 +20158,6 @@ async def test_create_certificate_map_entry_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = certificate_manager.CreateCertificateMapEntryRequest() - assert args[0] == request_msg @@ -20175,7 +20184,6 @@ async def test_update_certificate_map_entry_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = certificate_manager.UpdateCertificateMapEntryRequest() - assert args[0] == request_msg @@ -20202,7 +20210,6 @@ async def test_delete_certificate_map_entry_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = certificate_manager.DeleteCertificateMapEntryRequest() - assert args[0] == request_msg @@ -20232,7 +20239,6 @@ async def test_list_dns_authorizations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = certificate_manager.ListDnsAuthorizationsRequest() - assert args[0] == request_msg @@ -20264,7 +20270,6 @@ async def test_get_dns_authorization_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = certificate_manager.GetDnsAuthorizationRequest() - assert args[0] == request_msg @@ -20291,7 +20296,6 @@ async def test_create_dns_authorization_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = certificate_manager.CreateDnsAuthorizationRequest() - assert args[0] == request_msg @@ -20318,7 +20322,6 @@ async def test_update_dns_authorization_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = certificate_manager.UpdateDnsAuthorizationRequest() - assert args[0] == request_msg @@ -20345,7 +20348,6 @@ async def test_delete_dns_authorization_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = certificate_manager.DeleteDnsAuthorizationRequest() - assert args[0] == request_msg @@ -20377,7 +20379,6 @@ async def test_list_certificate_issuance_configs_empty_call_grpc_asyncio(): request_msg = ( certificate_issuance_config.ListCertificateIssuanceConfigsRequest() ) - assert args[0] == request_msg @@ -20409,7 +20410,6 @@ async def test_get_certificate_issuance_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = certificate_issuance_config.GetCertificateIssuanceConfigRequest() - assert args[0] == request_msg @@ -20438,7 +20438,6 @@ async def test_create_certificate_issuance_config_empty_call_grpc_asyncio(): request_msg = ( gcc_certificate_issuance_config.CreateCertificateIssuanceConfigRequest() ) - assert args[0] == request_msg @@ -20467,7 +20466,6 @@ async def test_delete_certificate_issuance_config_empty_call_grpc_asyncio(): request_msg = ( certificate_issuance_config.DeleteCertificateIssuanceConfigRequest() ) - assert args[0] == request_msg @@ -20497,7 +20495,6 @@ async def test_list_trust_configs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = trust_config.ListTrustConfigsRequest() - assert args[0] == request_msg @@ -20526,7 +20523,6 @@ async def test_get_trust_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = trust_config.GetTrustConfigRequest() - assert args[0] == request_msg @@ -20553,7 +20549,6 @@ async def test_create_trust_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcc_trust_config.CreateTrustConfigRequest() - assert args[0] == request_msg @@ -20580,7 +20575,6 @@ async def test_update_trust_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcc_trust_config.UpdateTrustConfigRequest() - assert args[0] == request_msg @@ -20607,7 +20601,6 @@ async def test_delete_trust_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = trust_config.DeleteTrustConfigRequest() - assert args[0] == request_msg @@ -25897,7 +25890,6 @@ def test_list_certificates_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = certificate_manager.ListCertificatesRequest() - assert args[0] == request_msg @@ -25917,7 +25909,6 @@ def test_get_certificate_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = certificate_manager.GetCertificateRequest() - assert args[0] == request_msg @@ -25939,7 +25930,6 @@ def test_create_certificate_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = certificate_manager.CreateCertificateRequest() - assert args[0] == request_msg @@ -25961,7 +25951,6 @@ def test_update_certificate_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = certificate_manager.UpdateCertificateRequest() - assert args[0] == request_msg @@ -25983,7 +25972,6 @@ def test_delete_certificate_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = certificate_manager.DeleteCertificateRequest() - assert args[0] == request_msg @@ -26005,7 +25993,6 @@ def test_list_certificate_maps_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = certificate_manager.ListCertificateMapsRequest() - assert args[0] == request_msg @@ -26027,7 +26014,6 @@ def test_get_certificate_map_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = certificate_manager.GetCertificateMapRequest() - assert args[0] == request_msg @@ -26049,7 +26035,6 @@ def test_create_certificate_map_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = certificate_manager.CreateCertificateMapRequest() - assert args[0] == request_msg @@ -26071,7 +26056,6 @@ def test_update_certificate_map_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = certificate_manager.UpdateCertificateMapRequest() - assert args[0] == request_msg @@ -26093,7 +26077,6 @@ def test_delete_certificate_map_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = certificate_manager.DeleteCertificateMapRequest() - assert args[0] == request_msg @@ -26115,7 +26098,6 @@ def test_list_certificate_map_entries_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = certificate_manager.ListCertificateMapEntriesRequest() - assert args[0] == request_msg @@ -26137,7 +26119,6 @@ def test_get_certificate_map_entry_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = certificate_manager.GetCertificateMapEntryRequest() - assert args[0] == request_msg @@ -26159,7 +26140,6 @@ def test_create_certificate_map_entry_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = certificate_manager.CreateCertificateMapEntryRequest() - assert args[0] == request_msg @@ -26181,7 +26161,6 @@ def test_update_certificate_map_entry_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = certificate_manager.UpdateCertificateMapEntryRequest() - assert args[0] == request_msg @@ -26203,7 +26182,6 @@ def test_delete_certificate_map_entry_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = certificate_manager.DeleteCertificateMapEntryRequest() - assert args[0] == request_msg @@ -26225,7 +26203,6 @@ def test_list_dns_authorizations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = certificate_manager.ListDnsAuthorizationsRequest() - assert args[0] == request_msg @@ -26247,7 +26224,6 @@ def test_get_dns_authorization_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = certificate_manager.GetDnsAuthorizationRequest() - assert args[0] == request_msg @@ -26269,7 +26245,6 @@ def test_create_dns_authorization_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = certificate_manager.CreateDnsAuthorizationRequest() - assert args[0] == request_msg @@ -26291,7 +26266,6 @@ def test_update_dns_authorization_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = certificate_manager.UpdateDnsAuthorizationRequest() - assert args[0] == request_msg @@ -26313,7 +26287,6 @@ def test_delete_dns_authorization_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = certificate_manager.DeleteDnsAuthorizationRequest() - assert args[0] == request_msg @@ -26337,7 +26310,6 @@ def test_list_certificate_issuance_configs_empty_call_rest(): request_msg = ( certificate_issuance_config.ListCertificateIssuanceConfigsRequest() ) - assert args[0] == request_msg @@ -26359,7 +26331,6 @@ def test_get_certificate_issuance_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = certificate_issuance_config.GetCertificateIssuanceConfigRequest() - assert args[0] == request_msg @@ -26383,7 +26354,6 @@ def test_create_certificate_issuance_config_empty_call_rest(): request_msg = ( gcc_certificate_issuance_config.CreateCertificateIssuanceConfigRequest() ) - assert args[0] == request_msg @@ -26407,7 +26377,6 @@ def test_delete_certificate_issuance_config_empty_call_rest(): request_msg = ( certificate_issuance_config.DeleteCertificateIssuanceConfigRequest() ) - assert args[0] == request_msg @@ -26429,7 +26398,6 @@ def test_list_trust_configs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = trust_config.ListTrustConfigsRequest() - assert args[0] == request_msg @@ -26449,7 +26417,6 @@ def test_get_trust_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = trust_config.GetTrustConfigRequest() - assert args[0] == request_msg @@ -26471,7 +26438,6 @@ def test_create_trust_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcc_trust_config.CreateTrustConfigRequest() - assert args[0] == request_msg @@ -26493,7 +26459,6 @@ def test_update_trust_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcc_trust_config.UpdateTrustConfigRequest() - assert args[0] == request_msg @@ -26515,7 +26480,6 @@ def test_delete_trust_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = trust_config.DeleteTrustConfigRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-ces/noxfile.py b/packages/google-cloud-ces/noxfile.py index bdea85afe754..e52903354c45 100644 --- a/packages/google-cloud-ces/noxfile.py +++ b/packages/google-cloud-ces/noxfile.py @@ -47,7 +47,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-ces" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-ces/setup.py b/packages/google-cloud-ces/setup.py index cc0ee83c0d7e..c0021061dc76 100644 --- a/packages/google-cloud-ces/setup.py +++ b/packages/google-cloud-ces/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/google-cloud-ces/testing/constraints-3.10.txt b/packages/google-cloud-ces/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-ces/testing/constraints-3.10.txt +++ b/packages/google-cloud-ces/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-ces/tests/unit/gapic/ces_v1/test_agent_service.py b/packages/google-cloud-ces/tests/unit/gapic/ces_v1/test_agent_service.py index ae0c19bbbaa0..dee5b0d37f20 100644 --- a/packages/google-cloud-ces/tests/unit/gapic/ces_v1/test_agent_service.py +++ b/packages/google-cloud-ces/tests/unit/gapic/ces_v1/test_agent_service.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 @@ -160,6 +161,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" @@ -1343,8 +1359,8 @@ def test_agent_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - agent_service.ListAppsRequest, - dict, + agent_service.ListAppsRequest(), + {}, ], ) def test_list_apps(request_type, transport: str = "grpc"): @@ -1355,7 +1371,7 @@ def test_list_apps(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_apps), "__call__") as call: @@ -1404,12 +1420,13 @@ def test_list_apps_non_empty_request_with_auto_populated_field(): client.list_apps(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.ListAppsRequest( + request_msg = agent_service.ListAppsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_apps_use_cached_wrapped_rpc(): @@ -1488,9 +1505,14 @@ async def test_list_apps_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_list_apps_async( - transport: str = "grpc_asyncio", request_type=agent_service.ListAppsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.ListAppsRequest(), + {}, + ], +) +async def test_list_apps_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1498,7 +1520,7 @@ async def test_list_apps_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_apps), "__call__") as call: @@ -1523,11 +1545,6 @@ async def test_list_apps_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_apps_async_from_dict(): - await test_list_apps_async(request_type=dict) - - def test_list_apps_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1864,8 +1881,8 @@ async def test_list_apps_async_pages(): @pytest.mark.parametrize( "request_type", [ - agent_service.GetAppRequest, - dict, + agent_service.GetAppRequest(), + {}, ], ) def test_get_app(request_type, transport: str = "grpc"): @@ -1876,7 +1893,7 @@ def test_get_app(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_app), "__call__") as call: @@ -1940,9 +1957,10 @@ def test_get_app_non_empty_request_with_auto_populated_field(): client.get_app(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.GetAppRequest( + request_msg = agent_service.GetAppRequest( name="name_value", ) + assert args[0] == request_msg def test_get_app_use_cached_wrapped_rpc(): @@ -2021,9 +2039,14 @@ async def test_get_app_async_use_cached_wrapped_rpc(transport: str = "grpc_async @pytest.mark.asyncio -async def test_get_app_async( - transport: str = "grpc_asyncio", request_type=agent_service.GetAppRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.GetAppRequest(), + {}, + ], +) +async def test_get_app_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2031,7 +2054,7 @@ async def test_get_app_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_app), "__call__") as call: @@ -2074,11 +2097,6 @@ async def test_get_app_async( assert response.locked is True -@pytest.mark.asyncio -async def test_get_app_async_from_dict(): - await test_get_app_async(request_type=dict) - - def test_get_app_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2221,8 +2239,8 @@ async def test_get_app_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.CreateAppRequest, - dict, + agent_service.CreateAppRequest(), + {}, ], ) def test_create_app(request_type, transport: str = "grpc"): @@ -2233,7 +2251,7 @@ def test_create_app(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_app), "__call__") as call: @@ -2275,10 +2293,11 @@ def test_create_app_non_empty_request_with_auto_populated_field(): client.create_app(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.CreateAppRequest( + request_msg = agent_service.CreateAppRequest( parent="parent_value", app_id="app_id_value", ) + assert args[0] == request_msg def test_create_app_use_cached_wrapped_rpc(): @@ -2367,9 +2386,14 @@ async def test_create_app_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_create_app_async( - transport: str = "grpc_asyncio", request_type=agent_service.CreateAppRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.CreateAppRequest(), + {}, + ], +) +async def test_create_app_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2377,7 +2401,7 @@ async def test_create_app_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_app), "__call__") as call: @@ -2397,11 +2421,6 @@ async def test_create_app_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_app_async_from_dict(): - await test_create_app_async(request_type=dict) - - def test_create_app_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2568,8 +2587,8 @@ async def test_create_app_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.UpdateAppRequest, - dict, + agent_service.UpdateAppRequest(), + {}, ], ) def test_update_app(request_type, transport: str = "grpc"): @@ -2580,7 +2599,7 @@ def test_update_app(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_app), "__call__") as call: @@ -2642,7 +2661,8 @@ def test_update_app_non_empty_request_with_auto_populated_field(): client.update_app(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.UpdateAppRequest() + request_msg = agent_service.UpdateAppRequest() + assert args[0] == request_msg def test_update_app_use_cached_wrapped_rpc(): @@ -2721,9 +2741,14 @@ async def test_update_app_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_update_app_async( - transport: str = "grpc_asyncio", request_type=agent_service.UpdateAppRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.UpdateAppRequest(), + {}, + ], +) +async def test_update_app_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2731,7 +2756,7 @@ async def test_update_app_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_app), "__call__") as call: @@ -2774,11 +2799,6 @@ async def test_update_app_async( assert response.locked is True -@pytest.mark.asyncio -async def test_update_app_async_from_dict(): - await test_update_app_async(request_type=dict) - - def test_update_app_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2931,8 +2951,8 @@ async def test_update_app_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.DeleteAppRequest, - dict, + agent_service.DeleteAppRequest(), + {}, ], ) def test_delete_app(request_type, transport: str = "grpc"): @@ -2943,7 +2963,7 @@ def test_delete_app(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_app), "__call__") as call: @@ -2985,10 +3005,11 @@ def test_delete_app_non_empty_request_with_auto_populated_field(): client.delete_app(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.DeleteAppRequest( + request_msg = agent_service.DeleteAppRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_app_use_cached_wrapped_rpc(): @@ -3077,9 +3098,14 @@ async def test_delete_app_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_delete_app_async( - transport: str = "grpc_asyncio", request_type=agent_service.DeleteAppRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.DeleteAppRequest(), + {}, + ], +) +async def test_delete_app_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3087,7 +3113,7 @@ async def test_delete_app_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_app), "__call__") as call: @@ -3107,11 +3133,6 @@ async def test_delete_app_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_app_async_from_dict(): - await test_delete_app_async(request_type=dict) - - def test_delete_app_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3258,8 +3279,8 @@ async def test_delete_app_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.ExportAppRequest, - dict, + agent_service.ExportAppRequest(), + {}, ], ) def test_export_app(request_type, transport: str = "grpc"): @@ -3270,7 +3291,7 @@ def test_export_app(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.export_app), "__call__") as call: @@ -3313,11 +3334,12 @@ def test_export_app_non_empty_request_with_auto_populated_field(): client.export_app(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.ExportAppRequest( + request_msg = agent_service.ExportAppRequest( name="name_value", gcs_uri="gcs_uri_value", app_version="app_version_value", ) + assert args[0] == request_msg def test_export_app_use_cached_wrapped_rpc(): @@ -3406,9 +3428,14 @@ async def test_export_app_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_export_app_async( - transport: str = "grpc_asyncio", request_type=agent_service.ExportAppRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.ExportAppRequest(), + {}, + ], +) +async def test_export_app_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3416,7 +3443,7 @@ async def test_export_app_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.export_app), "__call__") as call: @@ -3436,11 +3463,6 @@ async def test_export_app_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_export_app_async_from_dict(): - await test_export_app_async(request_type=dict) - - def test_export_app_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3587,8 +3609,8 @@ async def test_export_app_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.ImportAppRequest, - dict, + agent_service.ImportAppRequest(), + {}, ], ) def test_import_app(request_type, transport: str = "grpc"): @@ -3599,7 +3621,7 @@ def test_import_app(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.import_app), "__call__") as call: @@ -3643,12 +3665,13 @@ def test_import_app_non_empty_request_with_auto_populated_field(): client.import_app(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.ImportAppRequest( + request_msg = agent_service.ImportAppRequest( gcs_uri="gcs_uri_value", parent="parent_value", display_name="display_name_value", app_id="app_id_value", ) + assert args[0] == request_msg def test_import_app_use_cached_wrapped_rpc(): @@ -3737,9 +3760,14 @@ async def test_import_app_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_import_app_async( - transport: str = "grpc_asyncio", request_type=agent_service.ImportAppRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.ImportAppRequest(), + {}, + ], +) +async def test_import_app_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3747,7 +3775,7 @@ async def test_import_app_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.import_app), "__call__") as call: @@ -3767,11 +3795,6 @@ async def test_import_app_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_import_app_async_from_dict(): - await test_import_app_async(request_type=dict) - - def test_import_app_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3938,8 +3961,8 @@ async def test_import_app_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.ListAgentsRequest, - dict, + agent_service.ListAgentsRequest(), + {}, ], ) def test_list_agents(request_type, transport: str = "grpc"): @@ -3950,7 +3973,7 @@ def test_list_agents(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_agents), "__call__") as call: @@ -3997,12 +4020,13 @@ def test_list_agents_non_empty_request_with_auto_populated_field(): client.list_agents(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.ListAgentsRequest( + request_msg = agent_service.ListAgentsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_agents_use_cached_wrapped_rpc(): @@ -4083,9 +4107,14 @@ async def test_list_agents_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_agents_async( - transport: str = "grpc_asyncio", request_type=agent_service.ListAgentsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.ListAgentsRequest(), + {}, + ], +) +async def test_list_agents_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4093,7 +4122,7 @@ async def test_list_agents_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_agents), "__call__") as call: @@ -4116,11 +4145,6 @@ async def test_list_agents_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_agents_async_from_dict(): - await test_list_agents_async(request_type=dict) - - def test_list_agents_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4457,8 +4481,8 @@ async def test_list_agents_async_pages(): @pytest.mark.parametrize( "request_type", [ - agent_service.GetAgentRequest, - dict, + agent_service.GetAgentRequest(), + {}, ], ) def test_get_agent(request_type, transport: str = "grpc"): @@ -4469,7 +4493,7 @@ def test_get_agent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_agent), "__call__") as call: @@ -4529,9 +4553,10 @@ def test_get_agent_non_empty_request_with_auto_populated_field(): client.get_agent(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.GetAgentRequest( + request_msg = agent_service.GetAgentRequest( name="name_value", ) + assert args[0] == request_msg def test_get_agent_use_cached_wrapped_rpc(): @@ -4610,9 +4635,14 @@ async def test_get_agent_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_agent_async( - transport: str = "grpc_asyncio", request_type=agent_service.GetAgentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.GetAgentRequest(), + {}, + ], +) +async def test_get_agent_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4620,7 +4650,7 @@ async def test_get_agent_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_agent), "__call__") as call: @@ -4659,11 +4689,6 @@ async def test_get_agent_async( assert response.generated_summary == "generated_summary_value" -@pytest.mark.asyncio -async def test_get_agent_async_from_dict(): - await test_get_agent_async(request_type=dict) - - def test_get_agent_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4806,8 +4831,8 @@ async def test_get_agent_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.CreateAgentRequest, - dict, + agent_service.CreateAgentRequest(), + {}, ], ) def test_create_agent(request_type, transport: str = "grpc"): @@ -4818,7 +4843,7 @@ def test_create_agent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_agent), "__call__") as call: @@ -4879,10 +4904,11 @@ def test_create_agent_non_empty_request_with_auto_populated_field(): client.create_agent(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.CreateAgentRequest( + request_msg = agent_service.CreateAgentRequest( parent="parent_value", agent_id="agent_id_value", ) + assert args[0] == request_msg def test_create_agent_use_cached_wrapped_rpc(): @@ -4963,9 +4989,14 @@ async def test_create_agent_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_agent_async( - transport: str = "grpc_asyncio", request_type=agent_service.CreateAgentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.CreateAgentRequest(), + {}, + ], +) +async def test_create_agent_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4973,7 +5004,7 @@ async def test_create_agent_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_agent), "__call__") as call: @@ -5012,11 +5043,6 @@ async def test_create_agent_async( assert response.generated_summary == "generated_summary_value" -@pytest.mark.asyncio -async def test_create_agent_async_from_dict(): - await test_create_agent_async(request_type=dict) - - def test_create_agent_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5179,8 +5205,8 @@ async def test_create_agent_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.UpdateAgentRequest, - dict, + agent_service.UpdateAgentRequest(), + {}, ], ) def test_update_agent(request_type, transport: str = "grpc"): @@ -5191,7 +5217,7 @@ def test_update_agent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_agent), "__call__") as call: @@ -5249,7 +5275,8 @@ def test_update_agent_non_empty_request_with_auto_populated_field(): client.update_agent(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.UpdateAgentRequest() + request_msg = agent_service.UpdateAgentRequest() + assert args[0] == request_msg def test_update_agent_use_cached_wrapped_rpc(): @@ -5330,9 +5357,14 @@ async def test_update_agent_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_agent_async( - transport: str = "grpc_asyncio", request_type=agent_service.UpdateAgentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.UpdateAgentRequest(), + {}, + ], +) +async def test_update_agent_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5340,7 +5372,7 @@ async def test_update_agent_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_agent), "__call__") as call: @@ -5379,11 +5411,6 @@ async def test_update_agent_async( assert response.generated_summary == "generated_summary_value" -@pytest.mark.asyncio -async def test_update_agent_async_from_dict(): - await test_update_agent_async(request_type=dict) - - def test_update_agent_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5536,8 +5563,8 @@ async def test_update_agent_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.DeleteAgentRequest, - dict, + agent_service.DeleteAgentRequest(), + {}, ], ) def test_delete_agent(request_type, transport: str = "grpc"): @@ -5548,7 +5575,7 @@ def test_delete_agent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_agent), "__call__") as call: @@ -5590,10 +5617,11 @@ def test_delete_agent_non_empty_request_with_auto_populated_field(): client.delete_agent(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.DeleteAgentRequest( + request_msg = agent_service.DeleteAgentRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_agent_use_cached_wrapped_rpc(): @@ -5674,9 +5702,14 @@ async def test_delete_agent_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_agent_async( - transport: str = "grpc_asyncio", request_type=agent_service.DeleteAgentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.DeleteAgentRequest(), + {}, + ], +) +async def test_delete_agent_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5684,7 +5717,7 @@ async def test_delete_agent_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_agent), "__call__") as call: @@ -5702,11 +5735,6 @@ async def test_delete_agent_async( assert response is None -@pytest.mark.asyncio -async def test_delete_agent_async_from_dict(): - await test_delete_agent_async(request_type=dict) - - def test_delete_agent_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5849,8 +5877,8 @@ async def test_delete_agent_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.ListExamplesRequest, - dict, + agent_service.ListExamplesRequest(), + {}, ], ) def test_list_examples(request_type, transport: str = "grpc"): @@ -5861,7 +5889,7 @@ def test_list_examples(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_examples), "__call__") as call: @@ -5908,12 +5936,13 @@ def test_list_examples_non_empty_request_with_auto_populated_field(): client.list_examples(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.ListExamplesRequest( + request_msg = agent_service.ListExamplesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_examples_use_cached_wrapped_rpc(): @@ -5994,9 +6023,14 @@ async def test_list_examples_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_examples_async( - transport: str = "grpc_asyncio", request_type=agent_service.ListExamplesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.ListExamplesRequest(), + {}, + ], +) +async def test_list_examples_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6004,7 +6038,7 @@ async def test_list_examples_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_examples), "__call__") as call: @@ -6027,11 +6061,6 @@ async def test_list_examples_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_examples_async_from_dict(): - await test_list_examples_async(request_type=dict) - - def test_list_examples_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6368,8 +6397,8 @@ async def test_list_examples_async_pages(): @pytest.mark.parametrize( "request_type", [ - agent_service.GetExampleRequest, - dict, + agent_service.GetExampleRequest(), + {}, ], ) def test_get_example(request_type, transport: str = "grpc"): @@ -6380,7 +6409,7 @@ def test_get_example(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_example), "__call__") as call: @@ -6434,9 +6463,10 @@ def test_get_example_non_empty_request_with_auto_populated_field(): client.get_example(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.GetExampleRequest( + request_msg = agent_service.GetExampleRequest( name="name_value", ) + assert args[0] == request_msg def test_get_example_use_cached_wrapped_rpc(): @@ -6517,9 +6547,14 @@ async def test_get_example_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_example_async( - transport: str = "grpc_asyncio", request_type=agent_service.GetExampleRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.GetExampleRequest(), + {}, + ], +) +async def test_get_example_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6527,7 +6562,7 @@ async def test_get_example_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_example), "__call__") as call: @@ -6560,11 +6595,6 @@ async def test_get_example_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_example_async_from_dict(): - await test_get_example_async(request_type=dict) - - def test_get_example_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6707,8 +6737,8 @@ async def test_get_example_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.CreateExampleRequest, - dict, + agent_service.CreateExampleRequest(), + {}, ], ) def test_create_example(request_type, transport: str = "grpc"): @@ -6719,7 +6749,7 @@ def test_create_example(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_example), "__call__") as call: @@ -6774,10 +6804,11 @@ def test_create_example_non_empty_request_with_auto_populated_field(): client.create_example(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.CreateExampleRequest( + request_msg = agent_service.CreateExampleRequest( parent="parent_value", example_id="example_id_value", ) + assert args[0] == request_msg def test_create_example_use_cached_wrapped_rpc(): @@ -6858,9 +6889,14 @@ async def test_create_example_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_example_async( - transport: str = "grpc_asyncio", request_type=agent_service.CreateExampleRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.CreateExampleRequest(), + {}, + ], +) +async def test_create_example_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6868,7 +6904,7 @@ async def test_create_example_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_example), "__call__") as call: @@ -6901,11 +6937,6 @@ async def test_create_example_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_create_example_async_from_dict(): - await test_create_example_async(request_type=dict) - - def test_create_example_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7068,8 +7099,8 @@ async def test_create_example_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.UpdateExampleRequest, - dict, + agent_service.UpdateExampleRequest(), + {}, ], ) def test_update_example(request_type, transport: str = "grpc"): @@ -7080,7 +7111,7 @@ def test_update_example(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_example), "__call__") as call: @@ -7132,7 +7163,8 @@ def test_update_example_non_empty_request_with_auto_populated_field(): client.update_example(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.UpdateExampleRequest() + request_msg = agent_service.UpdateExampleRequest() + assert args[0] == request_msg def test_update_example_use_cached_wrapped_rpc(): @@ -7213,9 +7245,14 @@ async def test_update_example_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_example_async( - transport: str = "grpc_asyncio", request_type=agent_service.UpdateExampleRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.UpdateExampleRequest(), + {}, + ], +) +async def test_update_example_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7223,7 +7260,7 @@ async def test_update_example_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_example), "__call__") as call: @@ -7256,11 +7293,6 @@ async def test_update_example_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_update_example_async_from_dict(): - await test_update_example_async(request_type=dict) - - def test_update_example_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7413,8 +7445,8 @@ async def test_update_example_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.DeleteExampleRequest, - dict, + agent_service.DeleteExampleRequest(), + {}, ], ) def test_delete_example(request_type, transport: str = "grpc"): @@ -7425,7 +7457,7 @@ def test_delete_example(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_example), "__call__") as call: @@ -7467,10 +7499,11 @@ def test_delete_example_non_empty_request_with_auto_populated_field(): client.delete_example(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.DeleteExampleRequest( + request_msg = agent_service.DeleteExampleRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_example_use_cached_wrapped_rpc(): @@ -7551,9 +7584,14 @@ async def test_delete_example_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_example_async( - transport: str = "grpc_asyncio", request_type=agent_service.DeleteExampleRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.DeleteExampleRequest(), + {}, + ], +) +async def test_delete_example_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7561,7 +7599,7 @@ async def test_delete_example_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_example), "__call__") as call: @@ -7579,11 +7617,6 @@ async def test_delete_example_async( assert response is None -@pytest.mark.asyncio -async def test_delete_example_async_from_dict(): - await test_delete_example_async(request_type=dict) - - def test_delete_example_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7726,8 +7759,8 @@ async def test_delete_example_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.ListToolsRequest, - dict, + agent_service.ListToolsRequest(), + {}, ], ) def test_list_tools(request_type, transport: str = "grpc"): @@ -7738,7 +7771,7 @@ def test_list_tools(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tools), "__call__") as call: @@ -7785,12 +7818,13 @@ def test_list_tools_non_empty_request_with_auto_populated_field(): client.list_tools(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.ListToolsRequest( + request_msg = agent_service.ListToolsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_tools_use_cached_wrapped_rpc(): @@ -7869,9 +7903,14 @@ async def test_list_tools_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_list_tools_async( - transport: str = "grpc_asyncio", request_type=agent_service.ListToolsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.ListToolsRequest(), + {}, + ], +) +async def test_list_tools_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7879,7 +7918,7 @@ async def test_list_tools_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_tools), "__call__") as call: @@ -7902,11 +7941,6 @@ async def test_list_tools_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_tools_async_from_dict(): - await test_list_tools_async(request_type=dict) - - def test_list_tools_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8243,8 +8277,8 @@ async def test_list_tools_async_pages(): @pytest.mark.parametrize( "request_type", [ - agent_service.GetToolRequest, - dict, + agent_service.GetToolRequest(), + {}, ], ) def test_get_tool(request_type, transport: str = "grpc"): @@ -8255,7 +8289,7 @@ def test_get_tool(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tool), "__call__") as call: @@ -8307,9 +8341,10 @@ def test_get_tool_non_empty_request_with_auto_populated_field(): client.get_tool(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.GetToolRequest( + request_msg = agent_service.GetToolRequest( name="name_value", ) + assert args[0] == request_msg def test_get_tool_use_cached_wrapped_rpc(): @@ -8388,9 +8423,14 @@ async def test_get_tool_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn @pytest.mark.asyncio -async def test_get_tool_async( - transport: str = "grpc_asyncio", request_type=agent_service.GetToolRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.GetToolRequest(), + {}, + ], +) +async def test_get_tool_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8398,7 +8438,7 @@ async def test_get_tool_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_tool), "__call__") as call: @@ -8429,11 +8469,6 @@ async def test_get_tool_async( assert response.generated_summary == "generated_summary_value" -@pytest.mark.asyncio -async def test_get_tool_async_from_dict(): - await test_get_tool_async(request_type=dict) - - def test_get_tool_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8576,8 +8611,8 @@ async def test_get_tool_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.ListConversationsRequest, - dict, + agent_service.ListConversationsRequest(), + {}, ], ) def test_list_conversations(request_type, transport: str = "grpc"): @@ -8588,7 +8623,7 @@ def test_list_conversations(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8638,11 +8673,12 @@ def test_list_conversations_non_empty_request_with_auto_populated_field(): client.list_conversations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.ListConversationsRequest( + request_msg = agent_service.ListConversationsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_conversations_use_cached_wrapped_rpc(): @@ -8727,9 +8763,14 @@ async def test_list_conversations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_conversations_async( - transport: str = "grpc_asyncio", request_type=agent_service.ListConversationsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.ListConversationsRequest(), + {}, + ], +) +async def test_list_conversations_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8737,7 +8778,7 @@ async def test_list_conversations_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( @@ -8762,11 +8803,6 @@ async def test_list_conversations_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_conversations_async_from_dict(): - await test_list_conversations_async(request_type=dict) - - def test_list_conversations_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9119,8 +9155,8 @@ async def test_list_conversations_async_pages(): @pytest.mark.parametrize( "request_type", [ - agent_service.GetConversationRequest, - dict, + agent_service.GetConversationRequest(), + {}, ], ) def test_get_conversation(request_type, transport: str = "grpc"): @@ -9131,7 +9167,7 @@ def test_get_conversation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_conversation), "__call__") as call: @@ -9191,9 +9227,10 @@ def test_get_conversation_non_empty_request_with_auto_populated_field(): client.get_conversation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.GetConversationRequest( + request_msg = agent_service.GetConversationRequest( name="name_value", ) + assert args[0] == request_msg def test_get_conversation_use_cached_wrapped_rpc(): @@ -9276,9 +9313,14 @@ async def test_get_conversation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_conversation_async( - transport: str = "grpc_asyncio", request_type=agent_service.GetConversationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.GetConversationRequest(), + {}, + ], +) +async def test_get_conversation_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9286,7 +9328,7 @@ async def test_get_conversation_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_conversation), "__call__") as call: @@ -9325,11 +9367,6 @@ async def test_get_conversation_async( assert response.language_code == "language_code_value" -@pytest.mark.asyncio -async def test_get_conversation_async_from_dict(): - await test_get_conversation_async(request_type=dict) - - def test_get_conversation_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9476,8 +9513,8 @@ async def test_get_conversation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.DeleteConversationRequest, - dict, + agent_service.DeleteConversationRequest(), + {}, ], ) def test_delete_conversation(request_type, transport: str = "grpc"): @@ -9488,7 +9525,7 @@ def test_delete_conversation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9533,9 +9570,10 @@ def test_delete_conversation_non_empty_request_with_auto_populated_field(): client.delete_conversation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.DeleteConversationRequest( + request_msg = agent_service.DeleteConversationRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_conversation_use_cached_wrapped_rpc(): @@ -9620,10 +9658,14 @@ async def test_delete_conversation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_conversation_async( - transport: str = "grpc_asyncio", - request_type=agent_service.DeleteConversationRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.DeleteConversationRequest(), + {}, + ], +) +async def test_delete_conversation_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9631,7 +9673,7 @@ async def test_delete_conversation_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( @@ -9651,11 +9693,6 @@ async def test_delete_conversation_async( assert response is None -@pytest.mark.asyncio -async def test_delete_conversation_async_from_dict(): - await test_delete_conversation_async(request_type=dict) - - def test_delete_conversation_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9806,8 +9843,8 @@ async def test_delete_conversation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.BatchDeleteConversationsRequest, - dict, + agent_service.BatchDeleteConversationsRequest(), + {}, ], ) def test_batch_delete_conversations(request_type, transport: str = "grpc"): @@ -9818,7 +9855,7 @@ def test_batch_delete_conversations(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9863,9 +9900,10 @@ def test_batch_delete_conversations_non_empty_request_with_auto_populated_field( client.batch_delete_conversations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.BatchDeleteConversationsRequest( + request_msg = agent_service.BatchDeleteConversationsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_batch_delete_conversations_use_cached_wrapped_rpc(): @@ -9961,9 +9999,15 @@ async def test_batch_delete_conversations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + agent_service.BatchDeleteConversationsRequest(), + {}, + ], +) async def test_batch_delete_conversations_async( - transport: str = "grpc_asyncio", - request_type=agent_service.BatchDeleteConversationsRequest, + request_type, transport: str = "grpc_asyncio" ): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -9972,7 +10016,7 @@ async def test_batch_delete_conversations_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( @@ -9994,11 +10038,6 @@ async def test_batch_delete_conversations_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_batch_delete_conversations_async_from_dict(): - await test_batch_delete_conversations_async(request_type=dict) - - def test_batch_delete_conversations_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10153,8 +10192,8 @@ async def test_batch_delete_conversations_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.CreateToolRequest, - dict, + agent_service.CreateToolRequest(), + {}, ], ) def test_create_tool(request_type, transport: str = "grpc"): @@ -10165,7 +10204,7 @@ def test_create_tool(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tool), "__call__") as call: @@ -10218,10 +10257,11 @@ def test_create_tool_non_empty_request_with_auto_populated_field(): client.create_tool(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.CreateToolRequest( + request_msg = agent_service.CreateToolRequest( parent="parent_value", tool_id="tool_id_value", ) + assert args[0] == request_msg def test_create_tool_use_cached_wrapped_rpc(): @@ -10302,9 +10342,14 @@ async def test_create_tool_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_tool_async( - transport: str = "grpc_asyncio", request_type=agent_service.CreateToolRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.CreateToolRequest(), + {}, + ], +) +async def test_create_tool_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10312,7 +10357,7 @@ async def test_create_tool_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_tool), "__call__") as call: @@ -10343,11 +10388,6 @@ async def test_create_tool_async( assert response.generated_summary == "generated_summary_value" -@pytest.mark.asyncio -async def test_create_tool_async_from_dict(): - await test_create_tool_async(request_type=dict) - - def test_create_tool_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10522,8 +10562,8 @@ async def test_create_tool_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.UpdateToolRequest, - dict, + agent_service.UpdateToolRequest(), + {}, ], ) def test_update_tool(request_type, transport: str = "grpc"): @@ -10534,7 +10574,7 @@ def test_update_tool(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tool), "__call__") as call: @@ -10584,7 +10624,8 @@ def test_update_tool_non_empty_request_with_auto_populated_field(): client.update_tool(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.UpdateToolRequest() + request_msg = agent_service.UpdateToolRequest() + assert args[0] == request_msg def test_update_tool_use_cached_wrapped_rpc(): @@ -10665,9 +10706,14 @@ async def test_update_tool_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_tool_async( - transport: str = "grpc_asyncio", request_type=agent_service.UpdateToolRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.UpdateToolRequest(), + {}, + ], +) +async def test_update_tool_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10675,7 +10721,7 @@ async def test_update_tool_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_tool), "__call__") as call: @@ -10706,11 +10752,6 @@ async def test_update_tool_async( assert response.generated_summary == "generated_summary_value" -@pytest.mark.asyncio -async def test_update_tool_async_from_dict(): - await test_update_tool_async(request_type=dict) - - def test_update_tool_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10875,8 +10916,8 @@ async def test_update_tool_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.DeleteToolRequest, - dict, + agent_service.DeleteToolRequest(), + {}, ], ) def test_delete_tool(request_type, transport: str = "grpc"): @@ -10887,7 +10928,7 @@ def test_delete_tool(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tool), "__call__") as call: @@ -10929,10 +10970,11 @@ def test_delete_tool_non_empty_request_with_auto_populated_field(): client.delete_tool(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.DeleteToolRequest( + request_msg = agent_service.DeleteToolRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_tool_use_cached_wrapped_rpc(): @@ -11013,9 +11055,14 @@ async def test_delete_tool_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_tool_async( - transport: str = "grpc_asyncio", request_type=agent_service.DeleteToolRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.DeleteToolRequest(), + {}, + ], +) +async def test_delete_tool_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11023,7 +11070,7 @@ async def test_delete_tool_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_tool), "__call__") as call: @@ -11041,11 +11088,6 @@ async def test_delete_tool_async( assert response is None -@pytest.mark.asyncio -async def test_delete_tool_async_from_dict(): - await test_delete_tool_async(request_type=dict) - - def test_delete_tool_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11188,8 +11230,8 @@ async def test_delete_tool_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.ListGuardrailsRequest, - dict, + agent_service.ListGuardrailsRequest(), + {}, ], ) def test_list_guardrails(request_type, transport: str = "grpc"): @@ -11200,7 +11242,7 @@ def test_list_guardrails(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_guardrails), "__call__") as call: @@ -11247,12 +11289,13 @@ def test_list_guardrails_non_empty_request_with_auto_populated_field(): client.list_guardrails(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.ListGuardrailsRequest( + request_msg = agent_service.ListGuardrailsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_guardrails_use_cached_wrapped_rpc(): @@ -11333,9 +11376,14 @@ async def test_list_guardrails_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_guardrails_async( - transport: str = "grpc_asyncio", request_type=agent_service.ListGuardrailsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.ListGuardrailsRequest(), + {}, + ], +) +async def test_list_guardrails_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11343,7 +11391,7 @@ async def test_list_guardrails_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_guardrails), "__call__") as call: @@ -11366,11 +11414,6 @@ async def test_list_guardrails_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_guardrails_async_from_dict(): - await test_list_guardrails_async(request_type=dict) - - def test_list_guardrails_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11707,8 +11750,8 @@ async def test_list_guardrails_async_pages(): @pytest.mark.parametrize( "request_type", [ - agent_service.GetGuardrailRequest, - dict, + agent_service.GetGuardrailRequest(), + {}, ], ) def test_get_guardrail(request_type, transport: str = "grpc"): @@ -11719,7 +11762,7 @@ def test_get_guardrail(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_guardrail), "__call__") as call: @@ -11771,9 +11814,10 @@ def test_get_guardrail_non_empty_request_with_auto_populated_field(): client.get_guardrail(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.GetGuardrailRequest( + request_msg = agent_service.GetGuardrailRequest( name="name_value", ) + assert args[0] == request_msg def test_get_guardrail_use_cached_wrapped_rpc(): @@ -11854,9 +11898,14 @@ async def test_get_guardrail_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_guardrail_async( - transport: str = "grpc_asyncio", request_type=agent_service.GetGuardrailRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.GetGuardrailRequest(), + {}, + ], +) +async def test_get_guardrail_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11864,7 +11913,7 @@ async def test_get_guardrail_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_guardrail), "__call__") as call: @@ -11895,11 +11944,6 @@ async def test_get_guardrail_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_guardrail_async_from_dict(): - await test_get_guardrail_async(request_type=dict) - - def test_get_guardrail_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12042,8 +12086,8 @@ async def test_get_guardrail_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.CreateGuardrailRequest, - dict, + agent_service.CreateGuardrailRequest(), + {}, ], ) def test_create_guardrail(request_type, transport: str = "grpc"): @@ -12054,7 +12098,7 @@ def test_create_guardrail(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_guardrail), "__call__") as call: @@ -12107,10 +12151,11 @@ def test_create_guardrail_non_empty_request_with_auto_populated_field(): client.create_guardrail(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.CreateGuardrailRequest( + request_msg = agent_service.CreateGuardrailRequest( parent="parent_value", guardrail_id="guardrail_id_value", ) + assert args[0] == request_msg def test_create_guardrail_use_cached_wrapped_rpc(): @@ -12193,9 +12238,14 @@ async def test_create_guardrail_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_guardrail_async( - transport: str = "grpc_asyncio", request_type=agent_service.CreateGuardrailRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.CreateGuardrailRequest(), + {}, + ], +) +async def test_create_guardrail_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12203,7 +12253,7 @@ async def test_create_guardrail_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_guardrail), "__call__") as call: @@ -12234,11 +12284,6 @@ async def test_create_guardrail_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_create_guardrail_async_from_dict(): - await test_create_guardrail_async(request_type=dict) - - def test_create_guardrail_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12429,8 +12474,8 @@ async def test_create_guardrail_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.UpdateGuardrailRequest, - dict, + agent_service.UpdateGuardrailRequest(), + {}, ], ) def test_update_guardrail(request_type, transport: str = "grpc"): @@ -12441,7 +12486,7 @@ def test_update_guardrail(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_guardrail), "__call__") as call: @@ -12491,7 +12536,8 @@ def test_update_guardrail_non_empty_request_with_auto_populated_field(): client.update_guardrail(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.UpdateGuardrailRequest() + request_msg = agent_service.UpdateGuardrailRequest() + assert args[0] == request_msg def test_update_guardrail_use_cached_wrapped_rpc(): @@ -12574,9 +12620,14 @@ async def test_update_guardrail_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_guardrail_async( - transport: str = "grpc_asyncio", request_type=agent_service.UpdateGuardrailRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.UpdateGuardrailRequest(), + {}, + ], +) +async def test_update_guardrail_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12584,7 +12635,7 @@ async def test_update_guardrail_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_guardrail), "__call__") as call: @@ -12615,11 +12666,6 @@ async def test_update_guardrail_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_update_guardrail_async_from_dict(): - await test_update_guardrail_async(request_type=dict) - - def test_update_guardrail_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12800,8 +12846,8 @@ async def test_update_guardrail_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.DeleteGuardrailRequest, - dict, + agent_service.DeleteGuardrailRequest(), + {}, ], ) def test_delete_guardrail(request_type, transport: str = "grpc"): @@ -12812,7 +12858,7 @@ def test_delete_guardrail(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_guardrail), "__call__") as call: @@ -12854,10 +12900,11 @@ def test_delete_guardrail_non_empty_request_with_auto_populated_field(): client.delete_guardrail(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.DeleteGuardrailRequest( + request_msg = agent_service.DeleteGuardrailRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_guardrail_use_cached_wrapped_rpc(): @@ -12940,9 +12987,14 @@ async def test_delete_guardrail_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_guardrail_async( - transport: str = "grpc_asyncio", request_type=agent_service.DeleteGuardrailRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.DeleteGuardrailRequest(), + {}, + ], +) +async def test_delete_guardrail_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12950,7 +13002,7 @@ async def test_delete_guardrail_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_guardrail), "__call__") as call: @@ -12968,11 +13020,6 @@ async def test_delete_guardrail_async( assert response is None -@pytest.mark.asyncio -async def test_delete_guardrail_async_from_dict(): - await test_delete_guardrail_async(request_type=dict) - - def test_delete_guardrail_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13115,8 +13162,8 @@ async def test_delete_guardrail_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.ListDeploymentsRequest, - dict, + agent_service.ListDeploymentsRequest(), + {}, ], ) def test_list_deployments(request_type, transport: str = "grpc"): @@ -13127,7 +13174,7 @@ def test_list_deployments(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_deployments), "__call__") as call: @@ -13173,11 +13220,12 @@ def test_list_deployments_non_empty_request_with_auto_populated_field(): client.list_deployments(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.ListDeploymentsRequest( + request_msg = agent_service.ListDeploymentsRequest( parent="parent_value", page_token="page_token_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_deployments_use_cached_wrapped_rpc(): @@ -13260,9 +13308,14 @@ async def test_list_deployments_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_deployments_async( - transport: str = "grpc_asyncio", request_type=agent_service.ListDeploymentsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.ListDeploymentsRequest(), + {}, + ], +) +async def test_list_deployments_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13270,7 +13323,7 @@ async def test_list_deployments_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_deployments), "__call__") as call: @@ -13293,11 +13346,6 @@ async def test_list_deployments_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_deployments_async_from_dict(): - await test_list_deployments_async(request_type=dict) - - def test_list_deployments_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13634,8 +13682,8 @@ async def test_list_deployments_async_pages(): @pytest.mark.parametrize( "request_type", [ - agent_service.GetDeploymentRequest, - dict, + agent_service.GetDeploymentRequest(), + {}, ], ) def test_get_deployment(request_type, transport: str = "grpc"): @@ -13646,7 +13694,7 @@ def test_get_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_deployment), "__call__") as call: @@ -13696,9 +13744,10 @@ def test_get_deployment_non_empty_request_with_auto_populated_field(): client.get_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.GetDeploymentRequest( + request_msg = agent_service.GetDeploymentRequest( name="name_value", ) + assert args[0] == request_msg def test_get_deployment_use_cached_wrapped_rpc(): @@ -13779,9 +13828,14 @@ async def test_get_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_deployment_async( - transport: str = "grpc_asyncio", request_type=agent_service.GetDeploymentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.GetDeploymentRequest(), + {}, + ], +) +async def test_get_deployment_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13789,7 +13843,7 @@ async def test_get_deployment_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_deployment), "__call__") as call: @@ -13818,11 +13872,6 @@ async def test_get_deployment_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_deployment_async_from_dict(): - await test_get_deployment_async(request_type=dict) - - def test_get_deployment_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13969,8 +14018,8 @@ async def test_get_deployment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.CreateDeploymentRequest, - dict, + agent_service.CreateDeploymentRequest(), + {}, ], ) def test_create_deployment(request_type, transport: str = "grpc"): @@ -13981,7 +14030,7 @@ def test_create_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -14036,10 +14085,11 @@ def test_create_deployment_non_empty_request_with_auto_populated_field(): client.create_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.CreateDeploymentRequest( + request_msg = agent_service.CreateDeploymentRequest( parent="parent_value", deployment_id="deployment_id_value", ) + assert args[0] == request_msg def test_create_deployment_use_cached_wrapped_rpc(): @@ -14122,9 +14172,14 @@ async def test_create_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_deployment_async( - transport: str = "grpc_asyncio", request_type=agent_service.CreateDeploymentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.CreateDeploymentRequest(), + {}, + ], +) +async def test_create_deployment_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14132,7 +14187,7 @@ async def test_create_deployment_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( @@ -14163,11 +14218,6 @@ async def test_create_deployment_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_create_deployment_async_from_dict(): - await test_create_deployment_async(request_type=dict) - - def test_create_deployment_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14342,8 +14392,8 @@ async def test_create_deployment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.UpdateDeploymentRequest, - dict, + agent_service.UpdateDeploymentRequest(), + {}, ], ) def test_update_deployment(request_type, transport: str = "grpc"): @@ -14354,7 +14404,7 @@ def test_update_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -14406,7 +14456,8 @@ def test_update_deployment_non_empty_request_with_auto_populated_field(): client.update_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.UpdateDeploymentRequest() + request_msg = agent_service.UpdateDeploymentRequest() + assert args[0] == request_msg def test_update_deployment_use_cached_wrapped_rpc(): @@ -14489,9 +14540,14 @@ async def test_update_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_deployment_async( - transport: str = "grpc_asyncio", request_type=agent_service.UpdateDeploymentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.UpdateDeploymentRequest(), + {}, + ], +) +async def test_update_deployment_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14499,7 +14555,7 @@ async def test_update_deployment_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( @@ -14530,11 +14586,6 @@ async def test_update_deployment_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_update_deployment_async_from_dict(): - await test_update_deployment_async(request_type=dict) - - def test_update_deployment_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14699,8 +14750,8 @@ async def test_update_deployment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.DeleteDeploymentRequest, - dict, + agent_service.DeleteDeploymentRequest(), + {}, ], ) def test_delete_deployment(request_type, transport: str = "grpc"): @@ -14711,7 +14762,7 @@ def test_delete_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -14757,10 +14808,11 @@ def test_delete_deployment_non_empty_request_with_auto_populated_field(): client.delete_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.DeleteDeploymentRequest( + request_msg = agent_service.DeleteDeploymentRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_deployment_use_cached_wrapped_rpc(): @@ -14843,9 +14895,14 @@ async def test_delete_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_deployment_async( - transport: str = "grpc_asyncio", request_type=agent_service.DeleteDeploymentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.DeleteDeploymentRequest(), + {}, + ], +) +async def test_delete_deployment_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14853,7 +14910,7 @@ async def test_delete_deployment_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( @@ -14873,11 +14930,6 @@ async def test_delete_deployment_async( assert response is None -@pytest.mark.asyncio -async def test_delete_deployment_async_from_dict(): - await test_delete_deployment_async(request_type=dict) - - def test_delete_deployment_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15028,8 +15080,8 @@ async def test_delete_deployment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.ListToolsetsRequest, - dict, + agent_service.ListToolsetsRequest(), + {}, ], ) def test_list_toolsets(request_type, transport: str = "grpc"): @@ -15040,7 +15092,7 @@ def test_list_toolsets(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_toolsets), "__call__") as call: @@ -15087,12 +15139,13 @@ def test_list_toolsets_non_empty_request_with_auto_populated_field(): client.list_toolsets(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.ListToolsetsRequest( + request_msg = agent_service.ListToolsetsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_toolsets_use_cached_wrapped_rpc(): @@ -15173,9 +15226,14 @@ async def test_list_toolsets_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_toolsets_async( - transport: str = "grpc_asyncio", request_type=agent_service.ListToolsetsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.ListToolsetsRequest(), + {}, + ], +) +async def test_list_toolsets_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -15183,7 +15241,7 @@ async def test_list_toolsets_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_toolsets), "__call__") as call: @@ -15206,11 +15264,6 @@ async def test_list_toolsets_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_toolsets_async_from_dict(): - await test_list_toolsets_async(request_type=dict) - - def test_list_toolsets_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15547,8 +15600,8 @@ async def test_list_toolsets_async_pages(): @pytest.mark.parametrize( "request_type", [ - agent_service.GetToolsetRequest, - dict, + agent_service.GetToolsetRequest(), + {}, ], ) def test_get_toolset(request_type, transport: str = "grpc"): @@ -15559,7 +15612,7 @@ def test_get_toolset(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_toolset), "__call__") as call: @@ -15611,9 +15664,10 @@ def test_get_toolset_non_empty_request_with_auto_populated_field(): client.get_toolset(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.GetToolsetRequest( + request_msg = agent_service.GetToolsetRequest( name="name_value", ) + assert args[0] == request_msg def test_get_toolset_use_cached_wrapped_rpc(): @@ -15694,9 +15748,14 @@ async def test_get_toolset_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_toolset_async( - transport: str = "grpc_asyncio", request_type=agent_service.GetToolsetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.GetToolsetRequest(), + {}, + ], +) +async def test_get_toolset_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -15704,7 +15763,7 @@ async def test_get_toolset_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_toolset), "__call__") as call: @@ -15735,11 +15794,6 @@ async def test_get_toolset_async( assert response.execution_type == common.ExecutionType.SYNCHRONOUS -@pytest.mark.asyncio -async def test_get_toolset_async_from_dict(): - await test_get_toolset_async(request_type=dict) - - def test_get_toolset_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15882,8 +15936,8 @@ async def test_get_toolset_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.CreateToolsetRequest, - dict, + agent_service.CreateToolsetRequest(), + {}, ], ) def test_create_toolset(request_type, transport: str = "grpc"): @@ -15894,7 +15948,7 @@ def test_create_toolset(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_toolset), "__call__") as call: @@ -15947,10 +16001,11 @@ def test_create_toolset_non_empty_request_with_auto_populated_field(): client.create_toolset(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.CreateToolsetRequest( + request_msg = agent_service.CreateToolsetRequest( parent="parent_value", toolset_id="toolset_id_value", ) + assert args[0] == request_msg def test_create_toolset_use_cached_wrapped_rpc(): @@ -16031,9 +16086,14 @@ async def test_create_toolset_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_toolset_async( - transport: str = "grpc_asyncio", request_type=agent_service.CreateToolsetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.CreateToolsetRequest(), + {}, + ], +) +async def test_create_toolset_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -16041,7 +16101,7 @@ async def test_create_toolset_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_toolset), "__call__") as call: @@ -16072,11 +16132,6 @@ async def test_create_toolset_async( assert response.execution_type == common.ExecutionType.SYNCHRONOUS -@pytest.mark.asyncio -async def test_create_toolset_async_from_dict(): - await test_create_toolset_async(request_type=dict) - - def test_create_toolset_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16259,8 +16314,8 @@ async def test_create_toolset_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.UpdateToolsetRequest, - dict, + agent_service.UpdateToolsetRequest(), + {}, ], ) def test_update_toolset(request_type, transport: str = "grpc"): @@ -16271,7 +16326,7 @@ def test_update_toolset(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_toolset), "__call__") as call: @@ -16321,7 +16376,8 @@ def test_update_toolset_non_empty_request_with_auto_populated_field(): client.update_toolset(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.UpdateToolsetRequest() + request_msg = agent_service.UpdateToolsetRequest() + assert args[0] == request_msg def test_update_toolset_use_cached_wrapped_rpc(): @@ -16402,9 +16458,14 @@ async def test_update_toolset_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_toolset_async( - transport: str = "grpc_asyncio", request_type=agent_service.UpdateToolsetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.UpdateToolsetRequest(), + {}, + ], +) +async def test_update_toolset_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -16412,7 +16473,7 @@ async def test_update_toolset_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_toolset), "__call__") as call: @@ -16443,11 +16504,6 @@ async def test_update_toolset_async( assert response.execution_type == common.ExecutionType.SYNCHRONOUS -@pytest.mark.asyncio -async def test_update_toolset_async_from_dict(): - await test_update_toolset_async(request_type=dict) - - def test_update_toolset_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16620,8 +16676,8 @@ async def test_update_toolset_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.DeleteToolsetRequest, - dict, + agent_service.DeleteToolsetRequest(), + {}, ], ) def test_delete_toolset(request_type, transport: str = "grpc"): @@ -16632,7 +16688,7 @@ def test_delete_toolset(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_toolset), "__call__") as call: @@ -16674,10 +16730,11 @@ def test_delete_toolset_non_empty_request_with_auto_populated_field(): client.delete_toolset(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.DeleteToolsetRequest( + request_msg = agent_service.DeleteToolsetRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_toolset_use_cached_wrapped_rpc(): @@ -16758,9 +16815,14 @@ async def test_delete_toolset_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_toolset_async( - transport: str = "grpc_asyncio", request_type=agent_service.DeleteToolsetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.DeleteToolsetRequest(), + {}, + ], +) +async def test_delete_toolset_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -16768,7 +16830,7 @@ async def test_delete_toolset_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_toolset), "__call__") as call: @@ -16786,11 +16848,6 @@ async def test_delete_toolset_async( assert response is None -@pytest.mark.asyncio -async def test_delete_toolset_async_from_dict(): - await test_delete_toolset_async(request_type=dict) - - def test_delete_toolset_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16933,8 +16990,8 @@ async def test_delete_toolset_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.ListAppVersionsRequest, - dict, + agent_service.ListAppVersionsRequest(), + {}, ], ) def test_list_app_versions(request_type, transport: str = "grpc"): @@ -16945,7 +17002,7 @@ def test_list_app_versions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -16996,12 +17053,13 @@ def test_list_app_versions_non_empty_request_with_auto_populated_field(): client.list_app_versions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.ListAppVersionsRequest( + request_msg = agent_service.ListAppVersionsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_app_versions_use_cached_wrapped_rpc(): @@ -17084,9 +17142,14 @@ async def test_list_app_versions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_app_versions_async( - transport: str = "grpc_asyncio", request_type=agent_service.ListAppVersionsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.ListAppVersionsRequest(), + {}, + ], +) +async def test_list_app_versions_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -17094,7 +17157,7 @@ async def test_list_app_versions_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( @@ -17119,11 +17182,6 @@ async def test_list_app_versions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_app_versions_async_from_dict(): - await test_list_app_versions_async(request_type=dict) - - def test_list_app_versions_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17476,8 +17534,8 @@ async def test_list_app_versions_async_pages(): @pytest.mark.parametrize( "request_type", [ - agent_service.GetAppVersionRequest, - dict, + agent_service.GetAppVersionRequest(), + {}, ], ) def test_get_app_version(request_type, transport: str = "grpc"): @@ -17488,7 +17546,7 @@ def test_get_app_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_app_version), "__call__") as call: @@ -17540,9 +17598,10 @@ def test_get_app_version_non_empty_request_with_auto_populated_field(): client.get_app_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.GetAppVersionRequest( + request_msg = agent_service.GetAppVersionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_app_version_use_cached_wrapped_rpc(): @@ -17623,9 +17682,14 @@ async def test_get_app_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_app_version_async( - transport: str = "grpc_asyncio", request_type=agent_service.GetAppVersionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.GetAppVersionRequest(), + {}, + ], +) +async def test_get_app_version_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -17633,7 +17697,7 @@ async def test_get_app_version_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_app_version), "__call__") as call: @@ -17664,11 +17728,6 @@ async def test_get_app_version_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_app_version_async_from_dict(): - await test_get_app_version_async(request_type=dict) - - def test_get_app_version_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17815,8 +17874,8 @@ async def test_get_app_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.CreateAppVersionRequest, - dict, + agent_service.CreateAppVersionRequest(), + {}, ], ) def test_create_app_version(request_type, transport: str = "grpc"): @@ -17827,7 +17886,7 @@ def test_create_app_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -17884,10 +17943,11 @@ def test_create_app_version_non_empty_request_with_auto_populated_field(): client.create_app_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.CreateAppVersionRequest( + request_msg = agent_service.CreateAppVersionRequest( parent="parent_value", app_version_id="app_version_id_value", ) + assert args[0] == request_msg def test_create_app_version_use_cached_wrapped_rpc(): @@ -17972,9 +18032,14 @@ async def test_create_app_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_app_version_async( - transport: str = "grpc_asyncio", request_type=agent_service.CreateAppVersionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.CreateAppVersionRequest(), + {}, + ], +) +async def test_create_app_version_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -17982,7 +18047,7 @@ async def test_create_app_version_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( @@ -18015,11 +18080,6 @@ async def test_create_app_version_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_create_app_version_async_from_dict(): - await test_create_app_version_async(request_type=dict) - - def test_create_app_version_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18194,8 +18254,8 @@ async def test_create_app_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.DeleteAppVersionRequest, - dict, + agent_service.DeleteAppVersionRequest(), + {}, ], ) def test_delete_app_version(request_type, transport: str = "grpc"): @@ -18206,7 +18266,7 @@ def test_delete_app_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -18252,10 +18312,11 @@ def test_delete_app_version_non_empty_request_with_auto_populated_field(): client.delete_app_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.DeleteAppVersionRequest( + request_msg = agent_service.DeleteAppVersionRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_app_version_use_cached_wrapped_rpc(): @@ -18340,9 +18401,14 @@ async def test_delete_app_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_app_version_async( - transport: str = "grpc_asyncio", request_type=agent_service.DeleteAppVersionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.DeleteAppVersionRequest(), + {}, + ], +) +async def test_delete_app_version_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -18350,7 +18416,7 @@ async def test_delete_app_version_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( @@ -18370,11 +18436,6 @@ async def test_delete_app_version_async( assert response is None -@pytest.mark.asyncio -async def test_delete_app_version_async_from_dict(): - await test_delete_app_version_async(request_type=dict) - - def test_delete_app_version_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18525,8 +18586,8 @@ async def test_delete_app_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.RestoreAppVersionRequest, - dict, + agent_service.RestoreAppVersionRequest(), + {}, ], ) def test_restore_app_version(request_type, transport: str = "grpc"): @@ -18537,7 +18598,7 @@ def test_restore_app_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -18582,9 +18643,10 @@ def test_restore_app_version_non_empty_request_with_auto_populated_field(): client.restore_app_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.RestoreAppVersionRequest( + request_msg = agent_service.RestoreAppVersionRequest( name="name_value", ) + assert args[0] == request_msg def test_restore_app_version_use_cached_wrapped_rpc(): @@ -18679,9 +18741,14 @@ async def test_restore_app_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_restore_app_version_async( - transport: str = "grpc_asyncio", request_type=agent_service.RestoreAppVersionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.RestoreAppVersionRequest(), + {}, + ], +) +async def test_restore_app_version_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -18689,7 +18756,7 @@ async def test_restore_app_version_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( @@ -18711,11 +18778,6 @@ async def test_restore_app_version_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_restore_app_version_async_from_dict(): - await test_restore_app_version_async(request_type=dict) - - def test_restore_app_version_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18870,8 +18932,8 @@ async def test_restore_app_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.ListChangelogsRequest, - dict, + agent_service.ListChangelogsRequest(), + {}, ], ) def test_list_changelogs(request_type, transport: str = "grpc"): @@ -18882,7 +18944,7 @@ def test_list_changelogs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_changelogs), "__call__") as call: @@ -18929,12 +18991,13 @@ def test_list_changelogs_non_empty_request_with_auto_populated_field(): client.list_changelogs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.ListChangelogsRequest( + request_msg = agent_service.ListChangelogsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_changelogs_use_cached_wrapped_rpc(): @@ -19015,9 +19078,14 @@ async def test_list_changelogs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_changelogs_async( - transport: str = "grpc_asyncio", request_type=agent_service.ListChangelogsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.ListChangelogsRequest(), + {}, + ], +) +async def test_list_changelogs_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -19025,7 +19093,7 @@ async def test_list_changelogs_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_changelogs), "__call__") as call: @@ -19048,11 +19116,6 @@ async def test_list_changelogs_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_changelogs_async_from_dict(): - await test_list_changelogs_async(request_type=dict) - - def test_list_changelogs_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -19389,8 +19452,8 @@ async def test_list_changelogs_async_pages(): @pytest.mark.parametrize( "request_type", [ - agent_service.GetChangelogRequest, - dict, + agent_service.GetChangelogRequest(), + {}, ], ) def test_get_changelog(request_type, transport: str = "grpc"): @@ -19401,7 +19464,7 @@ def test_get_changelog(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_changelog), "__call__") as call: @@ -19459,9 +19522,10 @@ def test_get_changelog_non_empty_request_with_auto_populated_field(): client.get_changelog(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.GetChangelogRequest( + request_msg = agent_service.GetChangelogRequest( name="name_value", ) + assert args[0] == request_msg def test_get_changelog_use_cached_wrapped_rpc(): @@ -19542,9 +19606,14 @@ async def test_get_changelog_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_changelog_async( - transport: str = "grpc_asyncio", request_type=agent_service.GetChangelogRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.GetChangelogRequest(), + {}, + ], +) +async def test_get_changelog_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -19552,7 +19621,7 @@ async def test_get_changelog_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_changelog), "__call__") as call: @@ -19589,11 +19658,6 @@ async def test_get_changelog_async( assert response.sequence_number == 1601 -@pytest.mark.asyncio -async def test_get_changelog_async_from_dict(): - await test_get_changelog_async(request_type=dict) - - def test_get_changelog_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -29496,7 +29560,6 @@ def test_list_apps_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.ListAppsRequest() - assert args[0] == request_msg @@ -29517,7 +29580,6 @@ def test_get_app_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.GetAppRequest() - assert args[0] == request_msg @@ -29538,7 +29600,6 @@ def test_create_app_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.CreateAppRequest() - assert args[0] == request_msg @@ -29559,7 +29620,6 @@ def test_update_app_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.UpdateAppRequest() - assert args[0] == request_msg @@ -29580,7 +29640,6 @@ def test_delete_app_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.DeleteAppRequest() - assert args[0] == request_msg @@ -29601,7 +29660,6 @@ def test_export_app_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.ExportAppRequest() - assert args[0] == request_msg @@ -29622,7 +29680,6 @@ def test_import_app_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.ImportAppRequest() - assert args[0] == request_msg @@ -29643,7 +29700,6 @@ def test_list_agents_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.ListAgentsRequest() - assert args[0] == request_msg @@ -29664,7 +29720,6 @@ def test_get_agent_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.GetAgentRequest() - assert args[0] == request_msg @@ -29685,7 +29740,6 @@ def test_create_agent_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.CreateAgentRequest() - assert args[0] == request_msg @@ -29706,7 +29760,6 @@ def test_update_agent_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.UpdateAgentRequest() - assert args[0] == request_msg @@ -29727,7 +29780,6 @@ def test_delete_agent_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.DeleteAgentRequest() - assert args[0] == request_msg @@ -29748,7 +29800,6 @@ def test_list_examples_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.ListExamplesRequest() - assert args[0] == request_msg @@ -29769,7 +29820,6 @@ def test_get_example_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.GetExampleRequest() - assert args[0] == request_msg @@ -29790,7 +29840,6 @@ def test_create_example_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.CreateExampleRequest() - assert args[0] == request_msg @@ -29811,7 +29860,6 @@ def test_update_example_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.UpdateExampleRequest() - assert args[0] == request_msg @@ -29832,7 +29880,6 @@ def test_delete_example_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.DeleteExampleRequest() - assert args[0] == request_msg @@ -29853,7 +29900,6 @@ def test_list_tools_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.ListToolsRequest() - assert args[0] == request_msg @@ -29874,7 +29920,6 @@ def test_get_tool_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.GetToolRequest() - assert args[0] == request_msg @@ -29897,7 +29942,6 @@ def test_list_conversations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.ListConversationsRequest() - assert args[0] == request_msg @@ -29918,7 +29962,6 @@ def test_get_conversation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.GetConversationRequest() - assert args[0] == request_msg @@ -29941,7 +29984,6 @@ def test_delete_conversation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.DeleteConversationRequest() - assert args[0] == request_msg @@ -29964,7 +30006,6 @@ def test_batch_delete_conversations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.BatchDeleteConversationsRequest() - assert args[0] == request_msg @@ -29985,7 +30026,6 @@ def test_create_tool_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.CreateToolRequest() - assert args[0] == request_msg @@ -30006,7 +30046,6 @@ def test_update_tool_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.UpdateToolRequest() - assert args[0] == request_msg @@ -30027,7 +30066,6 @@ def test_delete_tool_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.DeleteToolRequest() - assert args[0] == request_msg @@ -30048,7 +30086,6 @@ def test_list_guardrails_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.ListGuardrailsRequest() - assert args[0] == request_msg @@ -30069,7 +30106,6 @@ def test_get_guardrail_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.GetGuardrailRequest() - assert args[0] == request_msg @@ -30090,7 +30126,6 @@ def test_create_guardrail_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.CreateGuardrailRequest() - assert args[0] == request_msg @@ -30111,7 +30146,6 @@ def test_update_guardrail_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.UpdateGuardrailRequest() - assert args[0] == request_msg @@ -30132,7 +30166,6 @@ def test_delete_guardrail_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.DeleteGuardrailRequest() - assert args[0] == request_msg @@ -30153,7 +30186,6 @@ def test_list_deployments_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.ListDeploymentsRequest() - assert args[0] == request_msg @@ -30174,7 +30206,6 @@ def test_get_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.GetDeploymentRequest() - assert args[0] == request_msg @@ -30197,7 +30228,6 @@ def test_create_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.CreateDeploymentRequest() - assert args[0] == request_msg @@ -30220,7 +30250,6 @@ def test_update_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.UpdateDeploymentRequest() - assert args[0] == request_msg @@ -30243,7 +30272,6 @@ def test_delete_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.DeleteDeploymentRequest() - assert args[0] == request_msg @@ -30264,7 +30292,6 @@ def test_list_toolsets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.ListToolsetsRequest() - assert args[0] == request_msg @@ -30285,7 +30312,6 @@ def test_get_toolset_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.GetToolsetRequest() - assert args[0] == request_msg @@ -30306,7 +30332,6 @@ def test_create_toolset_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.CreateToolsetRequest() - assert args[0] == request_msg @@ -30327,7 +30352,6 @@ def test_update_toolset_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.UpdateToolsetRequest() - assert args[0] == request_msg @@ -30348,7 +30372,6 @@ def test_delete_toolset_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.DeleteToolsetRequest() - assert args[0] == request_msg @@ -30371,7 +30394,6 @@ def test_list_app_versions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.ListAppVersionsRequest() - assert args[0] == request_msg @@ -30392,7 +30414,6 @@ def test_get_app_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.GetAppVersionRequest() - assert args[0] == request_msg @@ -30415,7 +30436,6 @@ def test_create_app_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.CreateAppVersionRequest() - assert args[0] == request_msg @@ -30438,7 +30458,6 @@ def test_delete_app_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.DeleteAppVersionRequest() - assert args[0] == request_msg @@ -30461,7 +30480,6 @@ def test_restore_app_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.RestoreAppVersionRequest() - assert args[0] == request_msg @@ -30482,7 +30500,6 @@ def test_list_changelogs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.ListChangelogsRequest() - assert args[0] == request_msg @@ -30503,7 +30520,6 @@ def test_get_changelog_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.GetChangelogRequest() - assert args[0] == request_msg @@ -30545,7 +30561,6 @@ async def test_list_apps_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.ListAppsRequest() - assert args[0] == request_msg @@ -30582,7 +30597,6 @@ async def test_get_app_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.GetAppRequest() - assert args[0] == request_msg @@ -30607,7 +30621,6 @@ async def test_create_app_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.CreateAppRequest() - assert args[0] == request_msg @@ -30644,7 +30657,6 @@ async def test_update_app_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.UpdateAppRequest() - assert args[0] == request_msg @@ -30669,7 +30681,6 @@ async def test_delete_app_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.DeleteAppRequest() - assert args[0] == request_msg @@ -30694,7 +30705,6 @@ async def test_export_app_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.ExportAppRequest() - assert args[0] == request_msg @@ -30719,7 +30729,6 @@ async def test_import_app_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.ImportAppRequest() - assert args[0] == request_msg @@ -30746,7 +30755,6 @@ async def test_list_agents_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.ListAgentsRequest() - assert args[0] == request_msg @@ -30781,7 +30789,6 @@ async def test_get_agent_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.GetAgentRequest() - assert args[0] == request_msg @@ -30816,7 +30823,6 @@ async def test_create_agent_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.CreateAgentRequest() - assert args[0] == request_msg @@ -30851,7 +30857,6 @@ async def test_update_agent_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.UpdateAgentRequest() - assert args[0] == request_msg @@ -30874,7 +30879,6 @@ async def test_delete_agent_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.DeleteAgentRequest() - assert args[0] == request_msg @@ -30901,7 +30905,6 @@ async def test_list_examples_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.ListExamplesRequest() - assert args[0] == request_msg @@ -30933,7 +30936,6 @@ async def test_get_example_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.GetExampleRequest() - assert args[0] == request_msg @@ -30965,7 +30967,6 @@ async def test_create_example_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.CreateExampleRequest() - assert args[0] == request_msg @@ -30997,7 +30998,6 @@ async def test_update_example_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.UpdateExampleRequest() - assert args[0] == request_msg @@ -31020,7 +31020,6 @@ async def test_delete_example_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.DeleteExampleRequest() - assert args[0] == request_msg @@ -31047,7 +31046,6 @@ async def test_list_tools_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.ListToolsRequest() - assert args[0] == request_msg @@ -31078,7 +31076,6 @@ async def test_get_tool_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.GetToolRequest() - assert args[0] == request_msg @@ -31107,7 +31104,6 @@ async def test_list_conversations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.ListConversationsRequest() - assert args[0] == request_msg @@ -31142,7 +31138,6 @@ async def test_get_conversation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.GetConversationRequest() - assert args[0] == request_msg @@ -31167,7 +31162,6 @@ async def test_delete_conversation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.DeleteConversationRequest() - assert args[0] == request_msg @@ -31194,7 +31188,6 @@ async def test_batch_delete_conversations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.BatchDeleteConversationsRequest() - assert args[0] == request_msg @@ -31225,7 +31218,6 @@ async def test_create_tool_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.CreateToolRequest() - assert args[0] == request_msg @@ -31256,7 +31248,6 @@ async def test_update_tool_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.UpdateToolRequest() - assert args[0] == request_msg @@ -31279,7 +31270,6 @@ async def test_delete_tool_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.DeleteToolRequest() - assert args[0] == request_msg @@ -31306,7 +31296,6 @@ async def test_list_guardrails_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.ListGuardrailsRequest() - assert args[0] == request_msg @@ -31337,7 +31326,6 @@ async def test_get_guardrail_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.GetGuardrailRequest() - assert args[0] == request_msg @@ -31368,7 +31356,6 @@ async def test_create_guardrail_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.CreateGuardrailRequest() - assert args[0] == request_msg @@ -31399,7 +31386,6 @@ async def test_update_guardrail_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.UpdateGuardrailRequest() - assert args[0] == request_msg @@ -31422,7 +31408,6 @@ async def test_delete_guardrail_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.DeleteGuardrailRequest() - assert args[0] == request_msg @@ -31449,7 +31434,6 @@ async def test_list_deployments_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.ListDeploymentsRequest() - assert args[0] == request_msg @@ -31479,7 +31463,6 @@ async def test_get_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.GetDeploymentRequest() - assert args[0] == request_msg @@ -31511,7 +31494,6 @@ async def test_create_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.CreateDeploymentRequest() - assert args[0] == request_msg @@ -31543,7 +31525,6 @@ async def test_update_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.UpdateDeploymentRequest() - assert args[0] == request_msg @@ -31568,7 +31549,6 @@ async def test_delete_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.DeleteDeploymentRequest() - assert args[0] == request_msg @@ -31595,7 +31575,6 @@ async def test_list_toolsets_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.ListToolsetsRequest() - assert args[0] == request_msg @@ -31626,7 +31605,6 @@ async def test_get_toolset_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.GetToolsetRequest() - assert args[0] == request_msg @@ -31657,7 +31635,6 @@ async def test_create_toolset_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.CreateToolsetRequest() - assert args[0] == request_msg @@ -31688,7 +31665,6 @@ async def test_update_toolset_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.UpdateToolsetRequest() - assert args[0] == request_msg @@ -31711,7 +31687,6 @@ async def test_delete_toolset_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.DeleteToolsetRequest() - assert args[0] == request_msg @@ -31740,7 +31715,6 @@ async def test_list_app_versions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.ListAppVersionsRequest() - assert args[0] == request_msg @@ -31771,7 +31745,6 @@ async def test_get_app_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.GetAppVersionRequest() - assert args[0] == request_msg @@ -31804,7 +31777,6 @@ async def test_create_app_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.CreateAppVersionRequest() - assert args[0] == request_msg @@ -31829,7 +31801,6 @@ async def test_delete_app_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.DeleteAppVersionRequest() - assert args[0] == request_msg @@ -31856,7 +31827,6 @@ async def test_restore_app_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.RestoreAppVersionRequest() - assert args[0] == request_msg @@ -31883,7 +31853,6 @@ async def test_list_changelogs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.ListChangelogsRequest() - assert args[0] == request_msg @@ -31917,7 +31886,6 @@ async def test_get_changelog_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.GetChangelogRequest() - assert args[0] == request_msg @@ -41566,7 +41534,6 @@ def test_list_apps_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.ListAppsRequest() - assert args[0] == request_msg @@ -41586,7 +41553,6 @@ def test_get_app_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.GetAppRequest() - assert args[0] == request_msg @@ -41606,7 +41572,6 @@ def test_create_app_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.CreateAppRequest() - assert args[0] == request_msg @@ -41626,7 +41591,6 @@ def test_update_app_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.UpdateAppRequest() - assert args[0] == request_msg @@ -41646,7 +41610,6 @@ def test_delete_app_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.DeleteAppRequest() - assert args[0] == request_msg @@ -41666,7 +41629,6 @@ def test_export_app_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.ExportAppRequest() - assert args[0] == request_msg @@ -41686,7 +41648,6 @@ def test_import_app_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.ImportAppRequest() - assert args[0] == request_msg @@ -41706,7 +41667,6 @@ def test_list_agents_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.ListAgentsRequest() - assert args[0] == request_msg @@ -41726,7 +41686,6 @@ def test_get_agent_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.GetAgentRequest() - assert args[0] == request_msg @@ -41746,7 +41705,6 @@ def test_create_agent_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.CreateAgentRequest() - assert args[0] == request_msg @@ -41766,7 +41724,6 @@ def test_update_agent_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.UpdateAgentRequest() - assert args[0] == request_msg @@ -41786,7 +41743,6 @@ def test_delete_agent_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.DeleteAgentRequest() - assert args[0] == request_msg @@ -41806,7 +41762,6 @@ def test_list_examples_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.ListExamplesRequest() - assert args[0] == request_msg @@ -41826,7 +41781,6 @@ def test_get_example_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.GetExampleRequest() - assert args[0] == request_msg @@ -41846,7 +41800,6 @@ def test_create_example_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.CreateExampleRequest() - assert args[0] == request_msg @@ -41866,7 +41819,6 @@ def test_update_example_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.UpdateExampleRequest() - assert args[0] == request_msg @@ -41886,7 +41838,6 @@ def test_delete_example_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.DeleteExampleRequest() - assert args[0] == request_msg @@ -41906,7 +41857,6 @@ def test_list_tools_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.ListToolsRequest() - assert args[0] == request_msg @@ -41926,7 +41876,6 @@ def test_get_tool_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.GetToolRequest() - assert args[0] == request_msg @@ -41948,7 +41897,6 @@ def test_list_conversations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.ListConversationsRequest() - assert args[0] == request_msg @@ -41968,7 +41916,6 @@ def test_get_conversation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.GetConversationRequest() - assert args[0] == request_msg @@ -41990,7 +41937,6 @@ def test_delete_conversation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.DeleteConversationRequest() - assert args[0] == request_msg @@ -42012,7 +41958,6 @@ def test_batch_delete_conversations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.BatchDeleteConversationsRequest() - assert args[0] == request_msg @@ -42032,7 +41977,6 @@ def test_create_tool_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.CreateToolRequest() - assert args[0] == request_msg @@ -42052,7 +41996,6 @@ def test_update_tool_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.UpdateToolRequest() - assert args[0] == request_msg @@ -42072,7 +42015,6 @@ def test_delete_tool_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.DeleteToolRequest() - assert args[0] == request_msg @@ -42092,7 +42034,6 @@ def test_list_guardrails_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.ListGuardrailsRequest() - assert args[0] == request_msg @@ -42112,7 +42053,6 @@ def test_get_guardrail_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.GetGuardrailRequest() - assert args[0] == request_msg @@ -42132,7 +42072,6 @@ def test_create_guardrail_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.CreateGuardrailRequest() - assert args[0] == request_msg @@ -42152,7 +42091,6 @@ def test_update_guardrail_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.UpdateGuardrailRequest() - assert args[0] == request_msg @@ -42172,7 +42110,6 @@ def test_delete_guardrail_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.DeleteGuardrailRequest() - assert args[0] == request_msg @@ -42192,7 +42129,6 @@ def test_list_deployments_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.ListDeploymentsRequest() - assert args[0] == request_msg @@ -42212,7 +42148,6 @@ def test_get_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.GetDeploymentRequest() - assert args[0] == request_msg @@ -42234,7 +42169,6 @@ def test_create_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.CreateDeploymentRequest() - assert args[0] == request_msg @@ -42256,7 +42190,6 @@ def test_update_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.UpdateDeploymentRequest() - assert args[0] == request_msg @@ -42278,7 +42211,6 @@ def test_delete_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.DeleteDeploymentRequest() - assert args[0] == request_msg @@ -42298,7 +42230,6 @@ def test_list_toolsets_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.ListToolsetsRequest() - assert args[0] == request_msg @@ -42318,7 +42249,6 @@ def test_get_toolset_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.GetToolsetRequest() - assert args[0] == request_msg @@ -42338,7 +42268,6 @@ def test_create_toolset_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.CreateToolsetRequest() - assert args[0] == request_msg @@ -42358,7 +42287,6 @@ def test_update_toolset_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.UpdateToolsetRequest() - assert args[0] == request_msg @@ -42378,7 +42306,6 @@ def test_delete_toolset_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.DeleteToolsetRequest() - assert args[0] == request_msg @@ -42400,7 +42327,6 @@ def test_list_app_versions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.ListAppVersionsRequest() - assert args[0] == request_msg @@ -42420,7 +42346,6 @@ def test_get_app_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.GetAppVersionRequest() - assert args[0] == request_msg @@ -42442,7 +42367,6 @@ def test_create_app_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.CreateAppVersionRequest() - assert args[0] == request_msg @@ -42464,7 +42388,6 @@ def test_delete_app_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.DeleteAppVersionRequest() - assert args[0] == request_msg @@ -42486,7 +42409,6 @@ def test_restore_app_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.RestoreAppVersionRequest() - assert args[0] == request_msg @@ -42506,7 +42428,6 @@ def test_list_changelogs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.ListChangelogsRequest() - assert args[0] == request_msg @@ -42526,7 +42447,6 @@ def test_get_changelog_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.GetChangelogRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-ces/tests/unit/gapic/ces_v1/test_session_service.py b/packages/google-cloud-ces/tests/unit/gapic/ces_v1/test_session_service.py index 4cad00d6bf19..6247be649eee 100644 --- a/packages/google-cloud-ces/tests/unit/gapic/ces_v1/test_session_service.py +++ b/packages/google-cloud-ces/tests/unit/gapic/ces_v1/test_session_service.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 @@ -110,6 +111,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" @@ -1316,8 +1332,8 @@ def test_session_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - session_service.RunSessionRequest, - dict, + session_service.RunSessionRequest(), + {}, ], ) def test_run_session(request_type, transport: str = "grpc"): @@ -1328,7 +1344,7 @@ def test_run_session(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.run_session), "__call__") as call: @@ -1367,7 +1383,8 @@ def test_run_session_non_empty_request_with_auto_populated_field(): client.run_session(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == session_service.RunSessionRequest() + request_msg = session_service.RunSessionRequest() + assert args[0] == request_msg def test_run_session_use_cached_wrapped_rpc(): @@ -1448,9 +1465,14 @@ async def test_run_session_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_run_session_async( - transport: str = "grpc_asyncio", request_type=session_service.RunSessionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + session_service.RunSessionRequest(), + {}, + ], +) +async def test_run_session_async(request_type, transport: str = "grpc_asyncio"): client = SessionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1458,7 +1480,7 @@ async def test_run_session_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.run_session), "__call__") as call: @@ -1478,11 +1500,6 @@ async def test_run_session_async( assert isinstance(response, session_service.RunSessionResponse) -@pytest.mark.asyncio -async def test_run_session_async_from_dict(): - await test_run_session_async(request_type=dict) - - def test_run_session_field_headers(): client = SessionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1547,8 +1564,8 @@ async def test_run_session_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - session_service.RunSessionRequest, - dict, + session_service.RunSessionRequest(), + {}, ], ) def test_stream_run_session(request_type, transport: str = "grpc"): @@ -1559,7 +1576,7 @@ def test_stream_run_session(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1603,7 +1620,8 @@ def test_stream_run_session_non_empty_request_with_auto_populated_field(): client.stream_run_session(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == session_service.RunSessionRequest() + request_msg = session_service.RunSessionRequest() + assert args[0] == request_msg def test_stream_run_session_use_cached_wrapped_rpc(): @@ -1688,9 +1706,14 @@ async def test_stream_run_session_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_stream_run_session_async( - transport: str = "grpc_asyncio", request_type=session_service.RunSessionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + session_service.RunSessionRequest(), + {}, + ], +) +async def test_stream_run_session_async(request_type, transport: str = "grpc_asyncio"): client = SessionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1698,7 +1721,7 @@ async def test_stream_run_session_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( @@ -1722,11 +1745,6 @@ async def test_stream_run_session_async( assert isinstance(message, session_service.RunSessionResponse) -@pytest.mark.asyncio -async def test_stream_run_session_async_from_dict(): - await test_stream_run_session_async(request_type=dict) - - def test_stream_run_session_field_headers(): client = SessionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1796,8 +1814,8 @@ async def test_stream_run_session_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - session_service.BidiSessionClientMessage, - dict, + session_service.BidiSessionClientMessage(), + {}, ], ) def test_bidi_run_session(request_type, transport: str = "grpc"): @@ -1808,7 +1826,7 @@ def test_bidi_run_session(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as 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. @@ -1907,10 +1925,14 @@ async def test_bidi_run_session_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_bidi_run_session_async( - transport: str = "grpc_asyncio", - request_type=session_service.BidiSessionClientMessage, -): +@pytest.mark.parametrize( + "request_type", + [ + session_service.BidiSessionClientMessage(), + {}, + ], +) +async def test_bidi_run_session_async(request_type, transport: str = "grpc_asyncio"): client = SessionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1918,7 +1940,7 @@ async def test_bidi_run_session_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. @@ -1940,11 +1962,6 @@ async def test_bidi_run_session_async( assert isinstance(message, session_service.BidiSessionServerMessage) -@pytest.mark.asyncio -async def test_bidi_run_session_async_from_dict(): - await test_bidi_run_session_async(request_type=dict) - - def test_run_session_rest_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, # instead of constructing them on each call @@ -2347,7 +2364,6 @@ def test_run_session_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session_service.RunSessionRequest() - assert args[0] == request_msg @@ -2370,7 +2386,6 @@ def test_stream_run_session_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session_service.RunSessionRequest() - assert args[0] == request_msg @@ -2409,7 +2424,6 @@ async def test_run_session_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session_service.RunSessionRequest() - assert args[0] == request_msg @@ -2437,7 +2451,6 @@ async def test_stream_run_session_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session_service.RunSessionRequest() - assert args[0] == request_msg @@ -3134,7 +3147,6 @@ def test_run_session_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session_service.RunSessionRequest() - assert args[0] == request_msg @@ -3156,7 +3168,6 @@ def test_stream_run_session_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session_service.RunSessionRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-ces/tests/unit/gapic/ces_v1/test_tool_service.py b/packages/google-cloud-ces/tests/unit/gapic/ces_v1/test_tool_service.py index 8943b3244fb7..d167580b969e 100644 --- a/packages/google-cloud-ces/tests/unit/gapic/ces_v1/test_tool_service.py +++ b/packages/google-cloud-ces/tests/unit/gapic/ces_v1/test_tool_service.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 @@ -109,6 +110,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" @@ -1277,8 +1293,8 @@ def test_tool_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - tool_service.ExecuteToolRequest, - dict, + tool_service.ExecuteToolRequest(), + {}, ], ) def test_execute_tool(request_type, transport: str = "grpc"): @@ -1289,7 +1305,7 @@ def test_execute_tool(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.execute_tool), "__call__") as call: @@ -1333,10 +1349,11 @@ def test_execute_tool_non_empty_request_with_auto_populated_field(): client.execute_tool(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tool_service.ExecuteToolRequest( + request_msg = tool_service.ExecuteToolRequest( tool="tool_value", parent="parent_value", ) + assert args[0] == request_msg def test_execute_tool_use_cached_wrapped_rpc(): @@ -1417,9 +1434,14 @@ async def test_execute_tool_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_execute_tool_async( - transport: str = "grpc_asyncio", request_type=tool_service.ExecuteToolRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tool_service.ExecuteToolRequest(), + {}, + ], +) +async def test_execute_tool_async(request_type, transport: str = "grpc_asyncio"): client = ToolServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1427,7 +1449,7 @@ async def test_execute_tool_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.execute_tool), "__call__") as call: @@ -1447,11 +1469,6 @@ async def test_execute_tool_async( assert isinstance(response, tool_service.ExecuteToolResponse) -@pytest.mark.asyncio -async def test_execute_tool_async_from_dict(): - await test_execute_tool_async(request_type=dict) - - def test_execute_tool_field_headers(): client = ToolServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1516,8 +1533,8 @@ async def test_execute_tool_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - tool_service.RetrieveToolSchemaRequest, - dict, + tool_service.RetrieveToolSchemaRequest(), + {}, ], ) def test_retrieve_tool_schema(request_type, transport: str = "grpc"): @@ -1528,7 +1545,7 @@ def test_retrieve_tool_schema(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1576,10 +1593,11 @@ def test_retrieve_tool_schema_non_empty_request_with_auto_populated_field(): client.retrieve_tool_schema(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tool_service.RetrieveToolSchemaRequest( + request_msg = tool_service.RetrieveToolSchemaRequest( tool="tool_value", parent="parent_value", ) + assert args[0] == request_msg def test_retrieve_tool_schema_use_cached_wrapped_rpc(): @@ -1664,8 +1682,15 @@ async def test_retrieve_tool_schema_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + tool_service.RetrieveToolSchemaRequest(), + {}, + ], +) async def test_retrieve_tool_schema_async( - transport: str = "grpc_asyncio", request_type=tool_service.RetrieveToolSchemaRequest + request_type, transport: str = "grpc_asyncio" ): client = ToolServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1674,7 +1699,7 @@ async def test_retrieve_tool_schema_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,11 +1721,6 @@ async def test_retrieve_tool_schema_async( assert isinstance(response, tool_service.RetrieveToolSchemaResponse) -@pytest.mark.asyncio -async def test_retrieve_tool_schema_async_from_dict(): - await test_retrieve_tool_schema_async(request_type=dict) - - def test_retrieve_tool_schema_field_headers(): client = ToolServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1769,8 +1789,8 @@ async def test_retrieve_tool_schema_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - tool_service.RetrieveToolsRequest, - dict, + tool_service.RetrieveToolsRequest(), + {}, ], ) def test_retrieve_tools(request_type, transport: str = "grpc"): @@ -1781,7 +1801,7 @@ def test_retrieve_tools(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.retrieve_tools), "__call__") as call: @@ -1822,9 +1842,10 @@ def test_retrieve_tools_non_empty_request_with_auto_populated_field(): client.retrieve_tools(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tool_service.RetrieveToolsRequest( + request_msg = tool_service.RetrieveToolsRequest( toolset="toolset_value", ) + assert args[0] == request_msg def test_retrieve_tools_use_cached_wrapped_rpc(): @@ -1905,9 +1926,14 @@ async def test_retrieve_tools_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_retrieve_tools_async( - transport: str = "grpc_asyncio", request_type=tool_service.RetrieveToolsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tool_service.RetrieveToolsRequest(), + {}, + ], +) +async def test_retrieve_tools_async(request_type, transport: str = "grpc_asyncio"): client = ToolServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1915,7 +1941,7 @@ async def test_retrieve_tools_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.retrieve_tools), "__call__") as call: @@ -1935,11 +1961,6 @@ async def test_retrieve_tools_async( assert isinstance(response, tool_service.RetrieveToolsResponse) -@pytest.mark.asyncio -async def test_retrieve_tools_async_from_dict(): - await test_retrieve_tools_async(request_type=dict) - - def test_retrieve_tools_field_headers(): client = ToolServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2491,7 +2512,6 @@ def test_execute_tool_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool_service.ExecuteToolRequest() - assert args[0] == request_msg @@ -2514,7 +2534,6 @@ def test_retrieve_tool_schema_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool_service.RetrieveToolSchemaRequest() - assert args[0] == request_msg @@ -2535,7 +2554,6 @@ def test_retrieve_tools_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool_service.RetrieveToolsRequest() - assert args[0] == request_msg @@ -2574,7 +2592,6 @@ async def test_execute_tool_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool_service.ExecuteToolRequest() - assert args[0] == request_msg @@ -2601,7 +2618,6 @@ async def test_retrieve_tool_schema_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool_service.RetrieveToolSchemaRequest() - assert args[0] == request_msg @@ -2626,7 +2642,6 @@ async def test_retrieve_tools_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool_service.RetrieveToolsRequest() - assert args[0] == request_msg @@ -3431,7 +3446,6 @@ def test_execute_tool_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool_service.ExecuteToolRequest() - assert args[0] == request_msg @@ -3453,7 +3467,6 @@ def test_retrieve_tool_schema_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool_service.RetrieveToolSchemaRequest() - assert args[0] == request_msg @@ -3473,7 +3486,6 @@ def test_retrieve_tools_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool_service.RetrieveToolsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-ces/tests/unit/gapic/ces_v1/test_widget_service.py b/packages/google-cloud-ces/tests/unit/gapic/ces_v1/test_widget_service.py index a6ac0e521319..c75a63a1f32b 100644 --- a/packages/google-cloud-ces/tests/unit/gapic/ces_v1/test_widget_service.py +++ b/packages/google-cloud-ces/tests/unit/gapic/ces_v1/test_widget_service.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 @@ -109,6 +110,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" @@ -1311,8 +1327,8 @@ def test_widget_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - widget_service.GenerateChatTokenRequest, - dict, + widget_service.GenerateChatTokenRequest(), + {}, ], ) def test_generate_chat_token(request_type, transport: str = "grpc"): @@ -1323,7 +1339,7 @@ def test_generate_chat_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( @@ -1373,11 +1389,12 @@ def test_generate_chat_token_non_empty_request_with_auto_populated_field(): client.generate_chat_token(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == widget_service.GenerateChatTokenRequest( + request_msg = widget_service.GenerateChatTokenRequest( name="name_value", deployment="deployment_value", recaptcha_token="recaptcha_token_value", ) + assert args[0] == request_msg def test_generate_chat_token_use_cached_wrapped_rpc(): @@ -1462,10 +1479,14 @@ async def test_generate_chat_token_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_generate_chat_token_async( - transport: str = "grpc_asyncio", - request_type=widget_service.GenerateChatTokenRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + widget_service.GenerateChatTokenRequest(), + {}, + ], +) +async def test_generate_chat_token_async(request_type, transport: str = "grpc_asyncio"): client = WidgetServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1473,7 +1494,7 @@ async def test_generate_chat_token_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( @@ -1498,11 +1519,6 @@ async def test_generate_chat_token_async( assert response.chat_token == "chat_token_value" -@pytest.mark.asyncio -async def test_generate_chat_token_async_from_dict(): - await test_generate_chat_token_async(request_type=dict) - - def test_generate_chat_token_field_headers(): client = WidgetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1830,7 +1846,6 @@ def test_generate_chat_token_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = widget_service.GenerateChatTokenRequest() - assert args[0] == request_msg @@ -1873,7 +1888,6 @@ async def test_generate_chat_token_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = widget_service.GenerateChatTokenRequest() - assert args[0] == request_msg @@ -2423,7 +2437,6 @@ def test_generate_chat_token_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = widget_service.GenerateChatTokenRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-ces/tests/unit/gapic/ces_v1beta/test_agent_service.py b/packages/google-cloud-ces/tests/unit/gapic/ces_v1beta/test_agent_service.py index 39138880925e..11f7b2fae5ea 100644 --- a/packages/google-cloud-ces/tests/unit/gapic/ces_v1beta/test_agent_service.py +++ b/packages/google-cloud-ces/tests/unit/gapic/ces_v1beta/test_agent_service.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 @@ -164,6 +165,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" @@ -1347,8 +1363,8 @@ def test_agent_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - agent_service.ListAppsRequest, - dict, + agent_service.ListAppsRequest(), + {}, ], ) def test_list_apps(request_type, transport: str = "grpc"): @@ -1359,7 +1375,7 @@ def test_list_apps(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_apps), "__call__") as call: @@ -1408,12 +1424,13 @@ def test_list_apps_non_empty_request_with_auto_populated_field(): client.list_apps(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.ListAppsRequest( + request_msg = agent_service.ListAppsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_apps_use_cached_wrapped_rpc(): @@ -1492,9 +1509,14 @@ async def test_list_apps_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_list_apps_async( - transport: str = "grpc_asyncio", request_type=agent_service.ListAppsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.ListAppsRequest(), + {}, + ], +) +async def test_list_apps_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1502,7 +1524,7 @@ async def test_list_apps_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_apps), "__call__") as call: @@ -1527,11 +1549,6 @@ async def test_list_apps_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_apps_async_from_dict(): - await test_list_apps_async(request_type=dict) - - def test_list_apps_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1868,8 +1885,8 @@ async def test_list_apps_async_pages(): @pytest.mark.parametrize( "request_type", [ - agent_service.GetAppRequest, - dict, + agent_service.GetAppRequest(), + {}, ], ) def test_get_app(request_type, transport: str = "grpc"): @@ -1880,7 +1897,7 @@ def test_get_app(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_app), "__call__") as call: @@ -1944,9 +1961,10 @@ def test_get_app_non_empty_request_with_auto_populated_field(): client.get_app(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.GetAppRequest( + request_msg = agent_service.GetAppRequest( name="name_value", ) + assert args[0] == request_msg def test_get_app_use_cached_wrapped_rpc(): @@ -2025,9 +2043,14 @@ async def test_get_app_async_use_cached_wrapped_rpc(transport: str = "grpc_async @pytest.mark.asyncio -async def test_get_app_async( - transport: str = "grpc_asyncio", request_type=agent_service.GetAppRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.GetAppRequest(), + {}, + ], +) +async def test_get_app_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2035,7 +2058,7 @@ async def test_get_app_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_app), "__call__") as call: @@ -2078,11 +2101,6 @@ async def test_get_app_async( assert response.locked is True -@pytest.mark.asyncio -async def test_get_app_async_from_dict(): - await test_get_app_async(request_type=dict) - - def test_get_app_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2225,8 +2243,8 @@ async def test_get_app_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.CreateAppRequest, - dict, + agent_service.CreateAppRequest(), + {}, ], ) def test_create_app(request_type, transport: str = "grpc"): @@ -2237,7 +2255,7 @@ def test_create_app(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_app), "__call__") as call: @@ -2279,10 +2297,11 @@ def test_create_app_non_empty_request_with_auto_populated_field(): client.create_app(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.CreateAppRequest( + request_msg = agent_service.CreateAppRequest( parent="parent_value", app_id="app_id_value", ) + assert args[0] == request_msg def test_create_app_use_cached_wrapped_rpc(): @@ -2371,9 +2390,14 @@ async def test_create_app_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_create_app_async( - transport: str = "grpc_asyncio", request_type=agent_service.CreateAppRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.CreateAppRequest(), + {}, + ], +) +async def test_create_app_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2381,7 +2405,7 @@ async def test_create_app_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_app), "__call__") as call: @@ -2401,11 +2425,6 @@ async def test_create_app_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_app_async_from_dict(): - await test_create_app_async(request_type=dict) - - def test_create_app_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2572,8 +2591,8 @@ async def test_create_app_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.UpdateAppRequest, - dict, + agent_service.UpdateAppRequest(), + {}, ], ) def test_update_app(request_type, transport: str = "grpc"): @@ -2584,7 +2603,7 @@ def test_update_app(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_app), "__call__") as call: @@ -2646,7 +2665,8 @@ def test_update_app_non_empty_request_with_auto_populated_field(): client.update_app(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.UpdateAppRequest() + request_msg = agent_service.UpdateAppRequest() + assert args[0] == request_msg def test_update_app_use_cached_wrapped_rpc(): @@ -2725,9 +2745,14 @@ async def test_update_app_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_update_app_async( - transport: str = "grpc_asyncio", request_type=agent_service.UpdateAppRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.UpdateAppRequest(), + {}, + ], +) +async def test_update_app_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2735,7 +2760,7 @@ async def test_update_app_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_app), "__call__") as call: @@ -2778,11 +2803,6 @@ async def test_update_app_async( assert response.locked is True -@pytest.mark.asyncio -async def test_update_app_async_from_dict(): - await test_update_app_async(request_type=dict) - - def test_update_app_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2935,8 +2955,8 @@ async def test_update_app_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.DeleteAppRequest, - dict, + agent_service.DeleteAppRequest(), + {}, ], ) def test_delete_app(request_type, transport: str = "grpc"): @@ -2947,7 +2967,7 @@ def test_delete_app(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_app), "__call__") as call: @@ -2989,10 +3009,11 @@ def test_delete_app_non_empty_request_with_auto_populated_field(): client.delete_app(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.DeleteAppRequest( + request_msg = agent_service.DeleteAppRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_app_use_cached_wrapped_rpc(): @@ -3081,9 +3102,14 @@ async def test_delete_app_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_delete_app_async( - transport: str = "grpc_asyncio", request_type=agent_service.DeleteAppRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.DeleteAppRequest(), + {}, + ], +) +async def test_delete_app_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3091,7 +3117,7 @@ async def test_delete_app_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_app), "__call__") as call: @@ -3111,11 +3137,6 @@ async def test_delete_app_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_app_async_from_dict(): - await test_delete_app_async(request_type=dict) - - def test_delete_app_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3262,8 +3283,8 @@ async def test_delete_app_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.ExportAppRequest, - dict, + agent_service.ExportAppRequest(), + {}, ], ) def test_export_app(request_type, transport: str = "grpc"): @@ -3274,7 +3295,7 @@ def test_export_app(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.export_app), "__call__") as call: @@ -3317,11 +3338,12 @@ def test_export_app_non_empty_request_with_auto_populated_field(): client.export_app(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.ExportAppRequest( + request_msg = agent_service.ExportAppRequest( name="name_value", gcs_uri="gcs_uri_value", app_version="app_version_value", ) + assert args[0] == request_msg def test_export_app_use_cached_wrapped_rpc(): @@ -3410,9 +3432,14 @@ async def test_export_app_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_export_app_async( - transport: str = "grpc_asyncio", request_type=agent_service.ExportAppRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.ExportAppRequest(), + {}, + ], +) +async def test_export_app_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3420,7 +3447,7 @@ async def test_export_app_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.export_app), "__call__") as call: @@ -3440,11 +3467,6 @@ async def test_export_app_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_export_app_async_from_dict(): - await test_export_app_async(request_type=dict) - - def test_export_app_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3591,8 +3613,8 @@ async def test_export_app_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.ImportAppRequest, - dict, + agent_service.ImportAppRequest(), + {}, ], ) def test_import_app(request_type, transport: str = "grpc"): @@ -3603,7 +3625,7 @@ def test_import_app(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.import_app), "__call__") as call: @@ -3647,12 +3669,13 @@ def test_import_app_non_empty_request_with_auto_populated_field(): client.import_app(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.ImportAppRequest( + request_msg = agent_service.ImportAppRequest( gcs_uri="gcs_uri_value", parent="parent_value", display_name="display_name_value", app_id="app_id_value", ) + assert args[0] == request_msg def test_import_app_use_cached_wrapped_rpc(): @@ -3741,9 +3764,14 @@ async def test_import_app_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_import_app_async( - transport: str = "grpc_asyncio", request_type=agent_service.ImportAppRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.ImportAppRequest(), + {}, + ], +) +async def test_import_app_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3751,7 +3779,7 @@ async def test_import_app_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.import_app), "__call__") as call: @@ -3771,11 +3799,6 @@ async def test_import_app_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_import_app_async_from_dict(): - await test_import_app_async(request_type=dict) - - def test_import_app_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3942,8 +3965,8 @@ async def test_import_app_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.GetSecuritySettingsRequest, - dict, + agent_service.GetSecuritySettingsRequest(), + {}, ], ) def test_get_security_settings(request_type, transport: str = "grpc"): @@ -3954,7 +3977,7 @@ def test_get_security_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( @@ -4004,9 +4027,10 @@ def test_get_security_settings_non_empty_request_with_auto_populated_field(): client.get_security_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.GetSecuritySettingsRequest( + request_msg = agent_service.GetSecuritySettingsRequest( name="name_value", ) + assert args[0] == request_msg def test_get_security_settings_use_cached_wrapped_rpc(): @@ -4092,9 +4116,15 @@ async def test_get_security_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + agent_service.GetSecuritySettingsRequest(), + {}, + ], +) async def test_get_security_settings_async( - transport: str = "grpc_asyncio", - request_type=agent_service.GetSecuritySettingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4103,7 +4133,7 @@ async def test_get_security_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( @@ -4130,11 +4160,6 @@ async def test_get_security_settings_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_security_settings_async_from_dict(): - await test_get_security_settings_async(request_type=dict) - - def test_get_security_settings_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4289,8 +4314,8 @@ async def test_get_security_settings_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.UpdateSecuritySettingsRequest, - dict, + agent_service.UpdateSecuritySettingsRequest(), + {}, ], ) def test_update_security_settings(request_type, transport: str = "grpc"): @@ -4301,7 +4326,7 @@ def test_update_security_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( @@ -4349,7 +4374,8 @@ def test_update_security_settings_non_empty_request_with_auto_populated_field(): client.update_security_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.UpdateSecuritySettingsRequest() + request_msg = agent_service.UpdateSecuritySettingsRequest() + assert args[0] == request_msg def test_update_security_settings_use_cached_wrapped_rpc(): @@ -4435,9 +4461,15 @@ async def test_update_security_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + agent_service.UpdateSecuritySettingsRequest(), + {}, + ], +) async def test_update_security_settings_async( - transport: str = "grpc_asyncio", - request_type=agent_service.UpdateSecuritySettingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4446,7 +4478,7 @@ async def test_update_security_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( @@ -4473,11 +4505,6 @@ async def test_update_security_settings_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_update_security_settings_async_from_dict(): - await test_update_security_settings_async(request_type=dict) - - def test_update_security_settings_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4642,8 +4669,8 @@ async def test_update_security_settings_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.ListAgentsRequest, - dict, + agent_service.ListAgentsRequest(), + {}, ], ) def test_list_agents(request_type, transport: str = "grpc"): @@ -4654,7 +4681,7 @@ def test_list_agents(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_agents), "__call__") as call: @@ -4701,12 +4728,13 @@ def test_list_agents_non_empty_request_with_auto_populated_field(): client.list_agents(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.ListAgentsRequest( + request_msg = agent_service.ListAgentsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_agents_use_cached_wrapped_rpc(): @@ -4787,9 +4815,14 @@ async def test_list_agents_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_agents_async( - transport: str = "grpc_asyncio", request_type=agent_service.ListAgentsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.ListAgentsRequest(), + {}, + ], +) +async def test_list_agents_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4797,7 +4830,7 @@ async def test_list_agents_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_agents), "__call__") as call: @@ -4820,11 +4853,6 @@ async def test_list_agents_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_agents_async_from_dict(): - await test_list_agents_async(request_type=dict) - - def test_list_agents_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5161,8 +5189,8 @@ async def test_list_agents_async_pages(): @pytest.mark.parametrize( "request_type", [ - agent_service.GetAgentRequest, - dict, + agent_service.GetAgentRequest(), + {}, ], ) def test_get_agent(request_type, transport: str = "grpc"): @@ -5173,7 +5201,7 @@ def test_get_agent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_agent), "__call__") as call: @@ -5233,9 +5261,10 @@ def test_get_agent_non_empty_request_with_auto_populated_field(): client.get_agent(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.GetAgentRequest( + request_msg = agent_service.GetAgentRequest( name="name_value", ) + assert args[0] == request_msg def test_get_agent_use_cached_wrapped_rpc(): @@ -5314,9 +5343,14 @@ async def test_get_agent_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_agent_async( - transport: str = "grpc_asyncio", request_type=agent_service.GetAgentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.GetAgentRequest(), + {}, + ], +) +async def test_get_agent_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5324,7 +5358,7 @@ async def test_get_agent_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_agent), "__call__") as call: @@ -5363,11 +5397,6 @@ async def test_get_agent_async( assert response.generated_summary == "generated_summary_value" -@pytest.mark.asyncio -async def test_get_agent_async_from_dict(): - await test_get_agent_async(request_type=dict) - - def test_get_agent_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5510,8 +5539,8 @@ async def test_get_agent_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.CreateAgentRequest, - dict, + agent_service.CreateAgentRequest(), + {}, ], ) def test_create_agent(request_type, transport: str = "grpc"): @@ -5522,7 +5551,7 @@ def test_create_agent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_agent), "__call__") as call: @@ -5583,10 +5612,11 @@ def test_create_agent_non_empty_request_with_auto_populated_field(): client.create_agent(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.CreateAgentRequest( + request_msg = agent_service.CreateAgentRequest( parent="parent_value", agent_id="agent_id_value", ) + assert args[0] == request_msg def test_create_agent_use_cached_wrapped_rpc(): @@ -5667,9 +5697,14 @@ async def test_create_agent_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_agent_async( - transport: str = "grpc_asyncio", request_type=agent_service.CreateAgentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.CreateAgentRequest(), + {}, + ], +) +async def test_create_agent_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5677,7 +5712,7 @@ async def test_create_agent_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_agent), "__call__") as call: @@ -5716,11 +5751,6 @@ async def test_create_agent_async( assert response.generated_summary == "generated_summary_value" -@pytest.mark.asyncio -async def test_create_agent_async_from_dict(): - await test_create_agent_async(request_type=dict) - - def test_create_agent_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5883,8 +5913,8 @@ async def test_create_agent_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.UpdateAgentRequest, - dict, + agent_service.UpdateAgentRequest(), + {}, ], ) def test_update_agent(request_type, transport: str = "grpc"): @@ -5895,7 +5925,7 @@ def test_update_agent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_agent), "__call__") as call: @@ -5953,7 +5983,8 @@ def test_update_agent_non_empty_request_with_auto_populated_field(): client.update_agent(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.UpdateAgentRequest() + request_msg = agent_service.UpdateAgentRequest() + assert args[0] == request_msg def test_update_agent_use_cached_wrapped_rpc(): @@ -6034,9 +6065,14 @@ async def test_update_agent_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_agent_async( - transport: str = "grpc_asyncio", request_type=agent_service.UpdateAgentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.UpdateAgentRequest(), + {}, + ], +) +async def test_update_agent_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6044,7 +6080,7 @@ async def test_update_agent_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_agent), "__call__") as call: @@ -6083,11 +6119,6 @@ async def test_update_agent_async( assert response.generated_summary == "generated_summary_value" -@pytest.mark.asyncio -async def test_update_agent_async_from_dict(): - await test_update_agent_async(request_type=dict) - - def test_update_agent_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6240,8 +6271,8 @@ async def test_update_agent_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.DeleteAgentRequest, - dict, + agent_service.DeleteAgentRequest(), + {}, ], ) def test_delete_agent(request_type, transport: str = "grpc"): @@ -6252,7 +6283,7 @@ def test_delete_agent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_agent), "__call__") as call: @@ -6294,10 +6325,11 @@ def test_delete_agent_non_empty_request_with_auto_populated_field(): client.delete_agent(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.DeleteAgentRequest( + request_msg = agent_service.DeleteAgentRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_agent_use_cached_wrapped_rpc(): @@ -6378,9 +6410,14 @@ async def test_delete_agent_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_agent_async( - transport: str = "grpc_asyncio", request_type=agent_service.DeleteAgentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.DeleteAgentRequest(), + {}, + ], +) +async def test_delete_agent_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6388,7 +6425,7 @@ async def test_delete_agent_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_agent), "__call__") as call: @@ -6406,11 +6443,6 @@ async def test_delete_agent_async( assert response is None -@pytest.mark.asyncio -async def test_delete_agent_async_from_dict(): - await test_delete_agent_async(request_type=dict) - - def test_delete_agent_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6553,8 +6585,8 @@ async def test_delete_agent_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.ListExamplesRequest, - dict, + agent_service.ListExamplesRequest(), + {}, ], ) def test_list_examples(request_type, transport: str = "grpc"): @@ -6565,7 +6597,7 @@ def test_list_examples(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_examples), "__call__") as call: @@ -6612,12 +6644,13 @@ def test_list_examples_non_empty_request_with_auto_populated_field(): client.list_examples(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.ListExamplesRequest( + request_msg = agent_service.ListExamplesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_examples_use_cached_wrapped_rpc(): @@ -6698,9 +6731,14 @@ async def test_list_examples_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_examples_async( - transport: str = "grpc_asyncio", request_type=agent_service.ListExamplesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.ListExamplesRequest(), + {}, + ], +) +async def test_list_examples_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6708,7 +6746,7 @@ async def test_list_examples_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_examples), "__call__") as call: @@ -6731,11 +6769,6 @@ async def test_list_examples_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_examples_async_from_dict(): - await test_list_examples_async(request_type=dict) - - def test_list_examples_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7072,8 +7105,8 @@ async def test_list_examples_async_pages(): @pytest.mark.parametrize( "request_type", [ - agent_service.GetExampleRequest, - dict, + agent_service.GetExampleRequest(), + {}, ], ) def test_get_example(request_type, transport: str = "grpc"): @@ -7084,7 +7117,7 @@ def test_get_example(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_example), "__call__") as call: @@ -7138,9 +7171,10 @@ def test_get_example_non_empty_request_with_auto_populated_field(): client.get_example(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.GetExampleRequest( + request_msg = agent_service.GetExampleRequest( name="name_value", ) + assert args[0] == request_msg def test_get_example_use_cached_wrapped_rpc(): @@ -7221,9 +7255,14 @@ async def test_get_example_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_example_async( - transport: str = "grpc_asyncio", request_type=agent_service.GetExampleRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.GetExampleRequest(), + {}, + ], +) +async def test_get_example_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7231,7 +7270,7 @@ async def test_get_example_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_example), "__call__") as call: @@ -7264,11 +7303,6 @@ async def test_get_example_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_example_async_from_dict(): - await test_get_example_async(request_type=dict) - - def test_get_example_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7411,8 +7445,8 @@ async def test_get_example_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.CreateExampleRequest, - dict, + agent_service.CreateExampleRequest(), + {}, ], ) def test_create_example(request_type, transport: str = "grpc"): @@ -7423,7 +7457,7 @@ def test_create_example(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_example), "__call__") as call: @@ -7478,10 +7512,11 @@ def test_create_example_non_empty_request_with_auto_populated_field(): client.create_example(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.CreateExampleRequest( + request_msg = agent_service.CreateExampleRequest( parent="parent_value", example_id="example_id_value", ) + assert args[0] == request_msg def test_create_example_use_cached_wrapped_rpc(): @@ -7562,9 +7597,14 @@ async def test_create_example_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_example_async( - transport: str = "grpc_asyncio", request_type=agent_service.CreateExampleRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.CreateExampleRequest(), + {}, + ], +) +async def test_create_example_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7572,7 +7612,7 @@ async def test_create_example_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_example), "__call__") as call: @@ -7605,11 +7645,6 @@ async def test_create_example_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_create_example_async_from_dict(): - await test_create_example_async(request_type=dict) - - def test_create_example_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7772,8 +7807,8 @@ async def test_create_example_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.UpdateExampleRequest, - dict, + agent_service.UpdateExampleRequest(), + {}, ], ) def test_update_example(request_type, transport: str = "grpc"): @@ -7784,7 +7819,7 @@ def test_update_example(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_example), "__call__") as call: @@ -7836,7 +7871,8 @@ def test_update_example_non_empty_request_with_auto_populated_field(): client.update_example(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.UpdateExampleRequest() + request_msg = agent_service.UpdateExampleRequest() + assert args[0] == request_msg def test_update_example_use_cached_wrapped_rpc(): @@ -7917,9 +7953,14 @@ async def test_update_example_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_example_async( - transport: str = "grpc_asyncio", request_type=agent_service.UpdateExampleRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.UpdateExampleRequest(), + {}, + ], +) +async def test_update_example_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7927,7 +7968,7 @@ async def test_update_example_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_example), "__call__") as call: @@ -7960,11 +8001,6 @@ async def test_update_example_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_update_example_async_from_dict(): - await test_update_example_async(request_type=dict) - - def test_update_example_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8117,8 +8153,8 @@ async def test_update_example_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.DeleteExampleRequest, - dict, + agent_service.DeleteExampleRequest(), + {}, ], ) def test_delete_example(request_type, transport: str = "grpc"): @@ -8129,7 +8165,7 @@ def test_delete_example(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_example), "__call__") as call: @@ -8171,10 +8207,11 @@ def test_delete_example_non_empty_request_with_auto_populated_field(): client.delete_example(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.DeleteExampleRequest( + request_msg = agent_service.DeleteExampleRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_example_use_cached_wrapped_rpc(): @@ -8255,9 +8292,14 @@ async def test_delete_example_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_example_async( - transport: str = "grpc_asyncio", request_type=agent_service.DeleteExampleRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.DeleteExampleRequest(), + {}, + ], +) +async def test_delete_example_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8265,7 +8307,7 @@ async def test_delete_example_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_example), "__call__") as call: @@ -8283,11 +8325,6 @@ async def test_delete_example_async( assert response is None -@pytest.mark.asyncio -async def test_delete_example_async_from_dict(): - await test_delete_example_async(request_type=dict) - - def test_delete_example_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8430,8 +8467,8 @@ async def test_delete_example_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.ListToolsRequest, - dict, + agent_service.ListToolsRequest(), + {}, ], ) def test_list_tools(request_type, transport: str = "grpc"): @@ -8442,7 +8479,7 @@ def test_list_tools(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tools), "__call__") as call: @@ -8489,12 +8526,13 @@ def test_list_tools_non_empty_request_with_auto_populated_field(): client.list_tools(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.ListToolsRequest( + request_msg = agent_service.ListToolsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_tools_use_cached_wrapped_rpc(): @@ -8573,9 +8611,14 @@ async def test_list_tools_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_list_tools_async( - transport: str = "grpc_asyncio", request_type=agent_service.ListToolsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.ListToolsRequest(), + {}, + ], +) +async def test_list_tools_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8583,7 +8626,7 @@ async def test_list_tools_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_tools), "__call__") as call: @@ -8606,11 +8649,6 @@ async def test_list_tools_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_tools_async_from_dict(): - await test_list_tools_async(request_type=dict) - - def test_list_tools_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8947,8 +8985,8 @@ async def test_list_tools_async_pages(): @pytest.mark.parametrize( "request_type", [ - agent_service.GetToolRequest, - dict, + agent_service.GetToolRequest(), + {}, ], ) def test_get_tool(request_type, transport: str = "grpc"): @@ -8959,7 +8997,7 @@ def test_get_tool(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tool), "__call__") as call: @@ -9011,9 +9049,10 @@ def test_get_tool_non_empty_request_with_auto_populated_field(): client.get_tool(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.GetToolRequest( + request_msg = agent_service.GetToolRequest( name="name_value", ) + assert args[0] == request_msg def test_get_tool_use_cached_wrapped_rpc(): @@ -9092,9 +9131,14 @@ async def test_get_tool_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn @pytest.mark.asyncio -async def test_get_tool_async( - transport: str = "grpc_asyncio", request_type=agent_service.GetToolRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.GetToolRequest(), + {}, + ], +) +async def test_get_tool_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9102,7 +9146,7 @@ async def test_get_tool_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_tool), "__call__") as call: @@ -9133,11 +9177,6 @@ async def test_get_tool_async( assert response.generated_summary == "generated_summary_value" -@pytest.mark.asyncio -async def test_get_tool_async_from_dict(): - await test_get_tool_async(request_type=dict) - - def test_get_tool_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9280,8 +9319,8 @@ async def test_get_tool_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.ListConversationsRequest, - dict, + agent_service.ListConversationsRequest(), + {}, ], ) def test_list_conversations(request_type, transport: str = "grpc"): @@ -9292,7 +9331,7 @@ def test_list_conversations(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9342,11 +9381,12 @@ def test_list_conversations_non_empty_request_with_auto_populated_field(): client.list_conversations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.ListConversationsRequest( + request_msg = agent_service.ListConversationsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_conversations_use_cached_wrapped_rpc(): @@ -9431,9 +9471,14 @@ async def test_list_conversations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_conversations_async( - transport: str = "grpc_asyncio", request_type=agent_service.ListConversationsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.ListConversationsRequest(), + {}, + ], +) +async def test_list_conversations_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9441,7 +9486,7 @@ async def test_list_conversations_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( @@ -9466,11 +9511,6 @@ async def test_list_conversations_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_conversations_async_from_dict(): - await test_list_conversations_async(request_type=dict) - - def test_list_conversations_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9823,8 +9863,8 @@ async def test_list_conversations_async_pages(): @pytest.mark.parametrize( "request_type", [ - agent_service.GetConversationRequest, - dict, + agent_service.GetConversationRequest(), + {}, ], ) def test_get_conversation(request_type, transport: str = "grpc"): @@ -9835,7 +9875,7 @@ def test_get_conversation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_conversation), "__call__") as call: @@ -9895,9 +9935,10 @@ def test_get_conversation_non_empty_request_with_auto_populated_field(): client.get_conversation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.GetConversationRequest( + request_msg = agent_service.GetConversationRequest( name="name_value", ) + assert args[0] == request_msg def test_get_conversation_use_cached_wrapped_rpc(): @@ -9980,9 +10021,14 @@ async def test_get_conversation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_conversation_async( - transport: str = "grpc_asyncio", request_type=agent_service.GetConversationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.GetConversationRequest(), + {}, + ], +) +async def test_get_conversation_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9990,7 +10036,7 @@ async def test_get_conversation_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_conversation), "__call__") as call: @@ -10029,11 +10075,6 @@ async def test_get_conversation_async( assert response.language_code == "language_code_value" -@pytest.mark.asyncio -async def test_get_conversation_async_from_dict(): - await test_get_conversation_async(request_type=dict) - - def test_get_conversation_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10180,8 +10221,8 @@ async def test_get_conversation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.DeleteConversationRequest, - dict, + agent_service.DeleteConversationRequest(), + {}, ], ) def test_delete_conversation(request_type, transport: str = "grpc"): @@ -10192,7 +10233,7 @@ def test_delete_conversation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10237,9 +10278,10 @@ def test_delete_conversation_non_empty_request_with_auto_populated_field(): client.delete_conversation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.DeleteConversationRequest( + request_msg = agent_service.DeleteConversationRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_conversation_use_cached_wrapped_rpc(): @@ -10324,10 +10366,14 @@ async def test_delete_conversation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_conversation_async( - transport: str = "grpc_asyncio", - request_type=agent_service.DeleteConversationRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.DeleteConversationRequest(), + {}, + ], +) +async def test_delete_conversation_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10335,7 +10381,7 @@ async def test_delete_conversation_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( @@ -10355,11 +10401,6 @@ async def test_delete_conversation_async( assert response is None -@pytest.mark.asyncio -async def test_delete_conversation_async_from_dict(): - await test_delete_conversation_async(request_type=dict) - - def test_delete_conversation_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10510,8 +10551,8 @@ async def test_delete_conversation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.BatchDeleteConversationsRequest, - dict, + agent_service.BatchDeleteConversationsRequest(), + {}, ], ) def test_batch_delete_conversations(request_type, transport: str = "grpc"): @@ -10522,7 +10563,7 @@ def test_batch_delete_conversations(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10567,9 +10608,10 @@ def test_batch_delete_conversations_non_empty_request_with_auto_populated_field( client.batch_delete_conversations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.BatchDeleteConversationsRequest( + request_msg = agent_service.BatchDeleteConversationsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_batch_delete_conversations_use_cached_wrapped_rpc(): @@ -10665,9 +10707,15 @@ async def test_batch_delete_conversations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + agent_service.BatchDeleteConversationsRequest(), + {}, + ], +) async def test_batch_delete_conversations_async( - transport: str = "grpc_asyncio", - request_type=agent_service.BatchDeleteConversationsRequest, + request_type, transport: str = "grpc_asyncio" ): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -10676,7 +10724,7 @@ async def test_batch_delete_conversations_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( @@ -10698,11 +10746,6 @@ async def test_batch_delete_conversations_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_batch_delete_conversations_async_from_dict(): - await test_batch_delete_conversations_async(request_type=dict) - - def test_batch_delete_conversations_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10857,8 +10900,8 @@ async def test_batch_delete_conversations_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.CreateToolRequest, - dict, + agent_service.CreateToolRequest(), + {}, ], ) def test_create_tool(request_type, transport: str = "grpc"): @@ -10869,7 +10912,7 @@ def test_create_tool(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tool), "__call__") as call: @@ -10922,10 +10965,11 @@ def test_create_tool_non_empty_request_with_auto_populated_field(): client.create_tool(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.CreateToolRequest( + request_msg = agent_service.CreateToolRequest( parent="parent_value", tool_id="tool_id_value", ) + assert args[0] == request_msg def test_create_tool_use_cached_wrapped_rpc(): @@ -11006,9 +11050,14 @@ async def test_create_tool_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_tool_async( - transport: str = "grpc_asyncio", request_type=agent_service.CreateToolRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.CreateToolRequest(), + {}, + ], +) +async def test_create_tool_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11016,7 +11065,7 @@ async def test_create_tool_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_tool), "__call__") as call: @@ -11047,11 +11096,6 @@ async def test_create_tool_async( assert response.generated_summary == "generated_summary_value" -@pytest.mark.asyncio -async def test_create_tool_async_from_dict(): - await test_create_tool_async(request_type=dict) - - def test_create_tool_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11226,8 +11270,8 @@ async def test_create_tool_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.UpdateToolRequest, - dict, + agent_service.UpdateToolRequest(), + {}, ], ) def test_update_tool(request_type, transport: str = "grpc"): @@ -11238,7 +11282,7 @@ def test_update_tool(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tool), "__call__") as call: @@ -11288,7 +11332,8 @@ def test_update_tool_non_empty_request_with_auto_populated_field(): client.update_tool(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.UpdateToolRequest() + request_msg = agent_service.UpdateToolRequest() + assert args[0] == request_msg def test_update_tool_use_cached_wrapped_rpc(): @@ -11369,9 +11414,14 @@ async def test_update_tool_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_tool_async( - transport: str = "grpc_asyncio", request_type=agent_service.UpdateToolRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.UpdateToolRequest(), + {}, + ], +) +async def test_update_tool_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11379,7 +11429,7 @@ async def test_update_tool_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_tool), "__call__") as call: @@ -11410,11 +11460,6 @@ async def test_update_tool_async( assert response.generated_summary == "generated_summary_value" -@pytest.mark.asyncio -async def test_update_tool_async_from_dict(): - await test_update_tool_async(request_type=dict) - - def test_update_tool_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11579,8 +11624,8 @@ async def test_update_tool_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.DeleteToolRequest, - dict, + agent_service.DeleteToolRequest(), + {}, ], ) def test_delete_tool(request_type, transport: str = "grpc"): @@ -11591,7 +11636,7 @@ def test_delete_tool(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tool), "__call__") as call: @@ -11633,10 +11678,11 @@ def test_delete_tool_non_empty_request_with_auto_populated_field(): client.delete_tool(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.DeleteToolRequest( + request_msg = agent_service.DeleteToolRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_tool_use_cached_wrapped_rpc(): @@ -11717,9 +11763,14 @@ async def test_delete_tool_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_tool_async( - transport: str = "grpc_asyncio", request_type=agent_service.DeleteToolRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.DeleteToolRequest(), + {}, + ], +) +async def test_delete_tool_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11727,7 +11778,7 @@ async def test_delete_tool_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_tool), "__call__") as call: @@ -11745,11 +11796,6 @@ async def test_delete_tool_async( assert response is None -@pytest.mark.asyncio -async def test_delete_tool_async_from_dict(): - await test_delete_tool_async(request_type=dict) - - def test_delete_tool_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11892,8 +11938,8 @@ async def test_delete_tool_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.ListGuardrailsRequest, - dict, + agent_service.ListGuardrailsRequest(), + {}, ], ) def test_list_guardrails(request_type, transport: str = "grpc"): @@ -11904,7 +11950,7 @@ def test_list_guardrails(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_guardrails), "__call__") as call: @@ -11951,12 +11997,13 @@ def test_list_guardrails_non_empty_request_with_auto_populated_field(): client.list_guardrails(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.ListGuardrailsRequest( + request_msg = agent_service.ListGuardrailsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_guardrails_use_cached_wrapped_rpc(): @@ -12037,9 +12084,14 @@ async def test_list_guardrails_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_guardrails_async( - transport: str = "grpc_asyncio", request_type=agent_service.ListGuardrailsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.ListGuardrailsRequest(), + {}, + ], +) +async def test_list_guardrails_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12047,7 +12099,7 @@ async def test_list_guardrails_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_guardrails), "__call__") as call: @@ -12070,11 +12122,6 @@ async def test_list_guardrails_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_guardrails_async_from_dict(): - await test_list_guardrails_async(request_type=dict) - - def test_list_guardrails_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12411,8 +12458,8 @@ async def test_list_guardrails_async_pages(): @pytest.mark.parametrize( "request_type", [ - agent_service.GetGuardrailRequest, - dict, + agent_service.GetGuardrailRequest(), + {}, ], ) def test_get_guardrail(request_type, transport: str = "grpc"): @@ -12423,7 +12470,7 @@ def test_get_guardrail(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_guardrail), "__call__") as call: @@ -12475,9 +12522,10 @@ def test_get_guardrail_non_empty_request_with_auto_populated_field(): client.get_guardrail(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.GetGuardrailRequest( + request_msg = agent_service.GetGuardrailRequest( name="name_value", ) + assert args[0] == request_msg def test_get_guardrail_use_cached_wrapped_rpc(): @@ -12558,9 +12606,14 @@ async def test_get_guardrail_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_guardrail_async( - transport: str = "grpc_asyncio", request_type=agent_service.GetGuardrailRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.GetGuardrailRequest(), + {}, + ], +) +async def test_get_guardrail_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12568,7 +12621,7 @@ async def test_get_guardrail_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_guardrail), "__call__") as call: @@ -12599,11 +12652,6 @@ async def test_get_guardrail_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_guardrail_async_from_dict(): - await test_get_guardrail_async(request_type=dict) - - def test_get_guardrail_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12746,8 +12794,8 @@ async def test_get_guardrail_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.CreateGuardrailRequest, - dict, + agent_service.CreateGuardrailRequest(), + {}, ], ) def test_create_guardrail(request_type, transport: str = "grpc"): @@ -12758,7 +12806,7 @@ def test_create_guardrail(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_guardrail), "__call__") as call: @@ -12811,10 +12859,11 @@ def test_create_guardrail_non_empty_request_with_auto_populated_field(): client.create_guardrail(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.CreateGuardrailRequest( + request_msg = agent_service.CreateGuardrailRequest( parent="parent_value", guardrail_id="guardrail_id_value", ) + assert args[0] == request_msg def test_create_guardrail_use_cached_wrapped_rpc(): @@ -12897,9 +12946,14 @@ async def test_create_guardrail_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_guardrail_async( - transport: str = "grpc_asyncio", request_type=agent_service.CreateGuardrailRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.CreateGuardrailRequest(), + {}, + ], +) +async def test_create_guardrail_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12907,7 +12961,7 @@ async def test_create_guardrail_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_guardrail), "__call__") as call: @@ -12938,11 +12992,6 @@ async def test_create_guardrail_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_create_guardrail_async_from_dict(): - await test_create_guardrail_async(request_type=dict) - - def test_create_guardrail_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13133,8 +13182,8 @@ async def test_create_guardrail_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.UpdateGuardrailRequest, - dict, + agent_service.UpdateGuardrailRequest(), + {}, ], ) def test_update_guardrail(request_type, transport: str = "grpc"): @@ -13145,7 +13194,7 @@ def test_update_guardrail(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_guardrail), "__call__") as call: @@ -13195,7 +13244,8 @@ def test_update_guardrail_non_empty_request_with_auto_populated_field(): client.update_guardrail(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.UpdateGuardrailRequest() + request_msg = agent_service.UpdateGuardrailRequest() + assert args[0] == request_msg def test_update_guardrail_use_cached_wrapped_rpc(): @@ -13278,9 +13328,14 @@ async def test_update_guardrail_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_guardrail_async( - transport: str = "grpc_asyncio", request_type=agent_service.UpdateGuardrailRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.UpdateGuardrailRequest(), + {}, + ], +) +async def test_update_guardrail_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13288,7 +13343,7 @@ async def test_update_guardrail_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_guardrail), "__call__") as call: @@ -13319,11 +13374,6 @@ async def test_update_guardrail_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_update_guardrail_async_from_dict(): - await test_update_guardrail_async(request_type=dict) - - def test_update_guardrail_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13504,8 +13554,8 @@ async def test_update_guardrail_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.DeleteGuardrailRequest, - dict, + agent_service.DeleteGuardrailRequest(), + {}, ], ) def test_delete_guardrail(request_type, transport: str = "grpc"): @@ -13516,7 +13566,7 @@ def test_delete_guardrail(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_guardrail), "__call__") as call: @@ -13558,10 +13608,11 @@ def test_delete_guardrail_non_empty_request_with_auto_populated_field(): client.delete_guardrail(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.DeleteGuardrailRequest( + request_msg = agent_service.DeleteGuardrailRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_guardrail_use_cached_wrapped_rpc(): @@ -13644,9 +13695,14 @@ async def test_delete_guardrail_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_guardrail_async( - transport: str = "grpc_asyncio", request_type=agent_service.DeleteGuardrailRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.DeleteGuardrailRequest(), + {}, + ], +) +async def test_delete_guardrail_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13654,7 +13710,7 @@ async def test_delete_guardrail_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_guardrail), "__call__") as call: @@ -13672,11 +13728,6 @@ async def test_delete_guardrail_async( assert response is None -@pytest.mark.asyncio -async def test_delete_guardrail_async_from_dict(): - await test_delete_guardrail_async(request_type=dict) - - def test_delete_guardrail_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13819,8 +13870,8 @@ async def test_delete_guardrail_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.ListDeploymentsRequest, - dict, + agent_service.ListDeploymentsRequest(), + {}, ], ) def test_list_deployments(request_type, transport: str = "grpc"): @@ -13831,7 +13882,7 @@ def test_list_deployments(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_deployments), "__call__") as call: @@ -13877,11 +13928,12 @@ def test_list_deployments_non_empty_request_with_auto_populated_field(): client.list_deployments(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.ListDeploymentsRequest( + request_msg = agent_service.ListDeploymentsRequest( parent="parent_value", page_token="page_token_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_deployments_use_cached_wrapped_rpc(): @@ -13964,9 +14016,14 @@ async def test_list_deployments_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_deployments_async( - transport: str = "grpc_asyncio", request_type=agent_service.ListDeploymentsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.ListDeploymentsRequest(), + {}, + ], +) +async def test_list_deployments_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13974,7 +14031,7 @@ async def test_list_deployments_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_deployments), "__call__") as call: @@ -13997,11 +14054,6 @@ async def test_list_deployments_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_deployments_async_from_dict(): - await test_list_deployments_async(request_type=dict) - - def test_list_deployments_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14338,8 +14390,8 @@ async def test_list_deployments_async_pages(): @pytest.mark.parametrize( "request_type", [ - agent_service.GetDeploymentRequest, - dict, + agent_service.GetDeploymentRequest(), + {}, ], ) def test_get_deployment(request_type, transport: str = "grpc"): @@ -14350,7 +14402,7 @@ def test_get_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_deployment), "__call__") as call: @@ -14400,9 +14452,10 @@ def test_get_deployment_non_empty_request_with_auto_populated_field(): client.get_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.GetDeploymentRequest( + request_msg = agent_service.GetDeploymentRequest( name="name_value", ) + assert args[0] == request_msg def test_get_deployment_use_cached_wrapped_rpc(): @@ -14483,9 +14536,14 @@ async def test_get_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_deployment_async( - transport: str = "grpc_asyncio", request_type=agent_service.GetDeploymentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.GetDeploymentRequest(), + {}, + ], +) +async def test_get_deployment_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14493,7 +14551,7 @@ async def test_get_deployment_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_deployment), "__call__") as call: @@ -14522,11 +14580,6 @@ async def test_get_deployment_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_deployment_async_from_dict(): - await test_get_deployment_async(request_type=dict) - - def test_get_deployment_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14673,8 +14726,8 @@ async def test_get_deployment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.CreateDeploymentRequest, - dict, + agent_service.CreateDeploymentRequest(), + {}, ], ) def test_create_deployment(request_type, transport: str = "grpc"): @@ -14685,7 +14738,7 @@ def test_create_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -14740,10 +14793,11 @@ def test_create_deployment_non_empty_request_with_auto_populated_field(): client.create_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.CreateDeploymentRequest( + request_msg = agent_service.CreateDeploymentRequest( parent="parent_value", deployment_id="deployment_id_value", ) + assert args[0] == request_msg def test_create_deployment_use_cached_wrapped_rpc(): @@ -14826,9 +14880,14 @@ async def test_create_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_deployment_async( - transport: str = "grpc_asyncio", request_type=agent_service.CreateDeploymentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.CreateDeploymentRequest(), + {}, + ], +) +async def test_create_deployment_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14836,7 +14895,7 @@ async def test_create_deployment_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( @@ -14867,11 +14926,6 @@ async def test_create_deployment_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_create_deployment_async_from_dict(): - await test_create_deployment_async(request_type=dict) - - def test_create_deployment_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15046,8 +15100,8 @@ async def test_create_deployment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.UpdateDeploymentRequest, - dict, + agent_service.UpdateDeploymentRequest(), + {}, ], ) def test_update_deployment(request_type, transport: str = "grpc"): @@ -15058,7 +15112,7 @@ def test_update_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -15110,7 +15164,8 @@ def test_update_deployment_non_empty_request_with_auto_populated_field(): client.update_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.UpdateDeploymentRequest() + request_msg = agent_service.UpdateDeploymentRequest() + assert args[0] == request_msg def test_update_deployment_use_cached_wrapped_rpc(): @@ -15193,9 +15248,14 @@ async def test_update_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_deployment_async( - transport: str = "grpc_asyncio", request_type=agent_service.UpdateDeploymentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.UpdateDeploymentRequest(), + {}, + ], +) +async def test_update_deployment_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -15203,7 +15263,7 @@ async def test_update_deployment_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( @@ -15234,11 +15294,6 @@ async def test_update_deployment_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_update_deployment_async_from_dict(): - await test_update_deployment_async(request_type=dict) - - def test_update_deployment_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15403,8 +15458,8 @@ async def test_update_deployment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.DeleteDeploymentRequest, - dict, + agent_service.DeleteDeploymentRequest(), + {}, ], ) def test_delete_deployment(request_type, transport: str = "grpc"): @@ -15415,7 +15470,7 @@ def test_delete_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -15461,10 +15516,11 @@ def test_delete_deployment_non_empty_request_with_auto_populated_field(): client.delete_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.DeleteDeploymentRequest( + request_msg = agent_service.DeleteDeploymentRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_deployment_use_cached_wrapped_rpc(): @@ -15547,9 +15603,14 @@ async def test_delete_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_deployment_async( - transport: str = "grpc_asyncio", request_type=agent_service.DeleteDeploymentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.DeleteDeploymentRequest(), + {}, + ], +) +async def test_delete_deployment_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -15557,7 +15618,7 @@ async def test_delete_deployment_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( @@ -15577,11 +15638,6 @@ async def test_delete_deployment_async( assert response is None -@pytest.mark.asyncio -async def test_delete_deployment_async_from_dict(): - await test_delete_deployment_async(request_type=dict) - - def test_delete_deployment_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15732,8 +15788,8 @@ async def test_delete_deployment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.ListToolsetsRequest, - dict, + agent_service.ListToolsetsRequest(), + {}, ], ) def test_list_toolsets(request_type, transport: str = "grpc"): @@ -15744,7 +15800,7 @@ def test_list_toolsets(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_toolsets), "__call__") as call: @@ -15791,12 +15847,13 @@ def test_list_toolsets_non_empty_request_with_auto_populated_field(): client.list_toolsets(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.ListToolsetsRequest( + request_msg = agent_service.ListToolsetsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_toolsets_use_cached_wrapped_rpc(): @@ -15877,9 +15934,14 @@ async def test_list_toolsets_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_toolsets_async( - transport: str = "grpc_asyncio", request_type=agent_service.ListToolsetsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.ListToolsetsRequest(), + {}, + ], +) +async def test_list_toolsets_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -15887,7 +15949,7 @@ async def test_list_toolsets_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_toolsets), "__call__") as call: @@ -15910,11 +15972,6 @@ async def test_list_toolsets_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_toolsets_async_from_dict(): - await test_list_toolsets_async(request_type=dict) - - def test_list_toolsets_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16251,8 +16308,8 @@ async def test_list_toolsets_async_pages(): @pytest.mark.parametrize( "request_type", [ - agent_service.GetToolsetRequest, - dict, + agent_service.GetToolsetRequest(), + {}, ], ) def test_get_toolset(request_type, transport: str = "grpc"): @@ -16263,7 +16320,7 @@ def test_get_toolset(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_toolset), "__call__") as call: @@ -16315,9 +16372,10 @@ def test_get_toolset_non_empty_request_with_auto_populated_field(): client.get_toolset(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.GetToolsetRequest( + request_msg = agent_service.GetToolsetRequest( name="name_value", ) + assert args[0] == request_msg def test_get_toolset_use_cached_wrapped_rpc(): @@ -16398,9 +16456,14 @@ async def test_get_toolset_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_toolset_async( - transport: str = "grpc_asyncio", request_type=agent_service.GetToolsetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.GetToolsetRequest(), + {}, + ], +) +async def test_get_toolset_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -16408,7 +16471,7 @@ async def test_get_toolset_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_toolset), "__call__") as call: @@ -16439,11 +16502,6 @@ async def test_get_toolset_async( assert response.execution_type == common.ExecutionType.SYNCHRONOUS -@pytest.mark.asyncio -async def test_get_toolset_async_from_dict(): - await test_get_toolset_async(request_type=dict) - - def test_get_toolset_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16586,8 +16644,8 @@ async def test_get_toolset_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.CreateToolsetRequest, - dict, + agent_service.CreateToolsetRequest(), + {}, ], ) def test_create_toolset(request_type, transport: str = "grpc"): @@ -16598,7 +16656,7 @@ def test_create_toolset(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_toolset), "__call__") as call: @@ -16651,10 +16709,11 @@ def test_create_toolset_non_empty_request_with_auto_populated_field(): client.create_toolset(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.CreateToolsetRequest( + request_msg = agent_service.CreateToolsetRequest( parent="parent_value", toolset_id="toolset_id_value", ) + assert args[0] == request_msg def test_create_toolset_use_cached_wrapped_rpc(): @@ -16735,9 +16794,14 @@ async def test_create_toolset_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_toolset_async( - transport: str = "grpc_asyncio", request_type=agent_service.CreateToolsetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.CreateToolsetRequest(), + {}, + ], +) +async def test_create_toolset_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -16745,7 +16809,7 @@ async def test_create_toolset_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_toolset), "__call__") as call: @@ -16776,11 +16840,6 @@ async def test_create_toolset_async( assert response.execution_type == common.ExecutionType.SYNCHRONOUS -@pytest.mark.asyncio -async def test_create_toolset_async_from_dict(): - await test_create_toolset_async(request_type=dict) - - def test_create_toolset_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16963,8 +17022,8 @@ async def test_create_toolset_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.UpdateToolsetRequest, - dict, + agent_service.UpdateToolsetRequest(), + {}, ], ) def test_update_toolset(request_type, transport: str = "grpc"): @@ -16975,7 +17034,7 @@ def test_update_toolset(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_toolset), "__call__") as call: @@ -17025,7 +17084,8 @@ def test_update_toolset_non_empty_request_with_auto_populated_field(): client.update_toolset(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.UpdateToolsetRequest() + request_msg = agent_service.UpdateToolsetRequest() + assert args[0] == request_msg def test_update_toolset_use_cached_wrapped_rpc(): @@ -17106,9 +17166,14 @@ async def test_update_toolset_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_toolset_async( - transport: str = "grpc_asyncio", request_type=agent_service.UpdateToolsetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.UpdateToolsetRequest(), + {}, + ], +) +async def test_update_toolset_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -17116,7 +17181,7 @@ async def test_update_toolset_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_toolset), "__call__") as call: @@ -17147,11 +17212,6 @@ async def test_update_toolset_async( assert response.execution_type == common.ExecutionType.SYNCHRONOUS -@pytest.mark.asyncio -async def test_update_toolset_async_from_dict(): - await test_update_toolset_async(request_type=dict) - - def test_update_toolset_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17324,8 +17384,8 @@ async def test_update_toolset_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.DeleteToolsetRequest, - dict, + agent_service.DeleteToolsetRequest(), + {}, ], ) def test_delete_toolset(request_type, transport: str = "grpc"): @@ -17336,7 +17396,7 @@ def test_delete_toolset(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_toolset), "__call__") as call: @@ -17378,10 +17438,11 @@ def test_delete_toolset_non_empty_request_with_auto_populated_field(): client.delete_toolset(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.DeleteToolsetRequest( + request_msg = agent_service.DeleteToolsetRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_toolset_use_cached_wrapped_rpc(): @@ -17462,9 +17523,14 @@ async def test_delete_toolset_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_toolset_async( - transport: str = "grpc_asyncio", request_type=agent_service.DeleteToolsetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.DeleteToolsetRequest(), + {}, + ], +) +async def test_delete_toolset_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -17472,7 +17538,7 @@ async def test_delete_toolset_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_toolset), "__call__") as call: @@ -17490,11 +17556,6 @@ async def test_delete_toolset_async( assert response is None -@pytest.mark.asyncio -async def test_delete_toolset_async_from_dict(): - await test_delete_toolset_async(request_type=dict) - - def test_delete_toolset_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17637,8 +17698,8 @@ async def test_delete_toolset_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.ListAppVersionsRequest, - dict, + agent_service.ListAppVersionsRequest(), + {}, ], ) def test_list_app_versions(request_type, transport: str = "grpc"): @@ -17649,7 +17710,7 @@ def test_list_app_versions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -17700,12 +17761,13 @@ def test_list_app_versions_non_empty_request_with_auto_populated_field(): client.list_app_versions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.ListAppVersionsRequest( + request_msg = agent_service.ListAppVersionsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_app_versions_use_cached_wrapped_rpc(): @@ -17788,9 +17850,14 @@ async def test_list_app_versions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_app_versions_async( - transport: str = "grpc_asyncio", request_type=agent_service.ListAppVersionsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.ListAppVersionsRequest(), + {}, + ], +) +async def test_list_app_versions_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -17798,7 +17865,7 @@ async def test_list_app_versions_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( @@ -17823,11 +17890,6 @@ async def test_list_app_versions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_app_versions_async_from_dict(): - await test_list_app_versions_async(request_type=dict) - - def test_list_app_versions_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18180,8 +18242,8 @@ async def test_list_app_versions_async_pages(): @pytest.mark.parametrize( "request_type", [ - agent_service.GetAppVersionRequest, - dict, + agent_service.GetAppVersionRequest(), + {}, ], ) def test_get_app_version(request_type, transport: str = "grpc"): @@ -18192,7 +18254,7 @@ def test_get_app_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_app_version), "__call__") as call: @@ -18244,9 +18306,10 @@ def test_get_app_version_non_empty_request_with_auto_populated_field(): client.get_app_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.GetAppVersionRequest( + request_msg = agent_service.GetAppVersionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_app_version_use_cached_wrapped_rpc(): @@ -18327,9 +18390,14 @@ async def test_get_app_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_app_version_async( - transport: str = "grpc_asyncio", request_type=agent_service.GetAppVersionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.GetAppVersionRequest(), + {}, + ], +) +async def test_get_app_version_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -18337,7 +18405,7 @@ async def test_get_app_version_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_app_version), "__call__") as call: @@ -18368,11 +18436,6 @@ async def test_get_app_version_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_app_version_async_from_dict(): - await test_get_app_version_async(request_type=dict) - - def test_get_app_version_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18519,8 +18582,8 @@ async def test_get_app_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.CreateAppVersionRequest, - dict, + agent_service.CreateAppVersionRequest(), + {}, ], ) def test_create_app_version(request_type, transport: str = "grpc"): @@ -18531,7 +18594,7 @@ def test_create_app_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -18588,10 +18651,11 @@ def test_create_app_version_non_empty_request_with_auto_populated_field(): client.create_app_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.CreateAppVersionRequest( + request_msg = agent_service.CreateAppVersionRequest( parent="parent_value", app_version_id="app_version_id_value", ) + assert args[0] == request_msg def test_create_app_version_use_cached_wrapped_rpc(): @@ -18676,9 +18740,14 @@ async def test_create_app_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_app_version_async( - transport: str = "grpc_asyncio", request_type=agent_service.CreateAppVersionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.CreateAppVersionRequest(), + {}, + ], +) +async def test_create_app_version_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -18686,7 +18755,7 @@ async def test_create_app_version_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( @@ -18719,11 +18788,6 @@ async def test_create_app_version_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_create_app_version_async_from_dict(): - await test_create_app_version_async(request_type=dict) - - def test_create_app_version_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18898,8 +18962,8 @@ async def test_create_app_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.DeleteAppVersionRequest, - dict, + agent_service.DeleteAppVersionRequest(), + {}, ], ) def test_delete_app_version(request_type, transport: str = "grpc"): @@ -18910,7 +18974,7 @@ def test_delete_app_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -18956,10 +19020,11 @@ def test_delete_app_version_non_empty_request_with_auto_populated_field(): client.delete_app_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.DeleteAppVersionRequest( + request_msg = agent_service.DeleteAppVersionRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_app_version_use_cached_wrapped_rpc(): @@ -19044,9 +19109,14 @@ async def test_delete_app_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_app_version_async( - transport: str = "grpc_asyncio", request_type=agent_service.DeleteAppVersionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.DeleteAppVersionRequest(), + {}, + ], +) +async def test_delete_app_version_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -19054,7 +19124,7 @@ async def test_delete_app_version_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( @@ -19074,11 +19144,6 @@ async def test_delete_app_version_async( assert response is None -@pytest.mark.asyncio -async def test_delete_app_version_async_from_dict(): - await test_delete_app_version_async(request_type=dict) - - def test_delete_app_version_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -19229,8 +19294,8 @@ async def test_delete_app_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.RestoreAppVersionRequest, - dict, + agent_service.RestoreAppVersionRequest(), + {}, ], ) def test_restore_app_version(request_type, transport: str = "grpc"): @@ -19241,7 +19306,7 @@ def test_restore_app_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -19286,9 +19351,10 @@ def test_restore_app_version_non_empty_request_with_auto_populated_field(): client.restore_app_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.RestoreAppVersionRequest( + request_msg = agent_service.RestoreAppVersionRequest( name="name_value", ) + assert args[0] == request_msg def test_restore_app_version_use_cached_wrapped_rpc(): @@ -19383,9 +19449,14 @@ async def test_restore_app_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_restore_app_version_async( - transport: str = "grpc_asyncio", request_type=agent_service.RestoreAppVersionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.RestoreAppVersionRequest(), + {}, + ], +) +async def test_restore_app_version_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -19393,7 +19464,7 @@ async def test_restore_app_version_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( @@ -19415,11 +19486,6 @@ async def test_restore_app_version_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_restore_app_version_async_from_dict(): - await test_restore_app_version_async(request_type=dict) - - def test_restore_app_version_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -19574,8 +19640,8 @@ async def test_restore_app_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.GenerateAppResourceRequest, - dict, + agent_service.GenerateAppResourceRequest(), + {}, ], ) def test_generate_app_resource(request_type, transport: str = "grpc"): @@ -19586,7 +19652,7 @@ def test_generate_app_resource(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -19631,9 +19697,10 @@ def test_generate_app_resource_non_empty_request_with_auto_populated_field(): client.generate_app_resource(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.GenerateAppResourceRequest( + request_msg = agent_service.GenerateAppResourceRequest( parent="parent_value", ) + assert args[0] == request_msg def test_generate_app_resource_use_cached_wrapped_rpc(): @@ -19729,9 +19796,15 @@ async def test_generate_app_resource_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + agent_service.GenerateAppResourceRequest(), + {}, + ], +) async def test_generate_app_resource_async( - transport: str = "grpc_asyncio", - request_type=agent_service.GenerateAppResourceRequest, + request_type, transport: str = "grpc_asyncio" ): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -19740,7 +19813,7 @@ async def test_generate_app_resource_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( @@ -19762,11 +19835,6 @@ async def test_generate_app_resource_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_generate_app_resource_async_from_dict(): - await test_generate_app_resource_async(request_type=dict) - - def test_generate_app_resource_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -19921,8 +19989,8 @@ async def test_generate_app_resource_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent_service.ListChangelogsRequest, - dict, + agent_service.ListChangelogsRequest(), + {}, ], ) def test_list_changelogs(request_type, transport: str = "grpc"): @@ -19933,7 +20001,7 @@ def test_list_changelogs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_changelogs), "__call__") as call: @@ -19980,12 +20048,13 @@ def test_list_changelogs_non_empty_request_with_auto_populated_field(): client.list_changelogs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.ListChangelogsRequest( + request_msg = agent_service.ListChangelogsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_changelogs_use_cached_wrapped_rpc(): @@ -20066,9 +20135,14 @@ async def test_list_changelogs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_changelogs_async( - transport: str = "grpc_asyncio", request_type=agent_service.ListChangelogsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.ListChangelogsRequest(), + {}, + ], +) +async def test_list_changelogs_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -20076,7 +20150,7 @@ async def test_list_changelogs_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_changelogs), "__call__") as call: @@ -20099,11 +20173,6 @@ async def test_list_changelogs_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_changelogs_async_from_dict(): - await test_list_changelogs_async(request_type=dict) - - def test_list_changelogs_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -20440,8 +20509,8 @@ async def test_list_changelogs_async_pages(): @pytest.mark.parametrize( "request_type", [ - agent_service.GetChangelogRequest, - dict, + agent_service.GetChangelogRequest(), + {}, ], ) def test_get_changelog(request_type, transport: str = "grpc"): @@ -20452,7 +20521,7 @@ def test_get_changelog(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_changelog), "__call__") as call: @@ -20510,9 +20579,10 @@ def test_get_changelog_non_empty_request_with_auto_populated_field(): client.get_changelog(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent_service.GetChangelogRequest( + request_msg = agent_service.GetChangelogRequest( name="name_value", ) + assert args[0] == request_msg def test_get_changelog_use_cached_wrapped_rpc(): @@ -20593,9 +20663,14 @@ async def test_get_changelog_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_changelog_async( - transport: str = "grpc_asyncio", request_type=agent_service.GetChangelogRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent_service.GetChangelogRequest(), + {}, + ], +) +async def test_get_changelog_async(request_type, transport: str = "grpc_asyncio"): client = AgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -20603,7 +20678,7 @@ async def test_get_changelog_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_changelog), "__call__") as call: @@ -20640,11 +20715,6 @@ async def test_get_changelog_async( assert response.sequence_number == 1601 -@pytest.mark.asyncio -async def test_get_changelog_async_from_dict(): - await test_get_changelog_async(request_type=dict) - - def test_get_changelog_field_headers(): client = AgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -31101,7 +31171,6 @@ def test_list_apps_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.ListAppsRequest() - assert args[0] == request_msg @@ -31122,7 +31191,6 @@ def test_get_app_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.GetAppRequest() - assert args[0] == request_msg @@ -31143,7 +31211,6 @@ def test_create_app_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.CreateAppRequest() - assert args[0] == request_msg @@ -31164,7 +31231,6 @@ def test_update_app_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.UpdateAppRequest() - assert args[0] == request_msg @@ -31185,7 +31251,6 @@ def test_delete_app_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.DeleteAppRequest() - assert args[0] == request_msg @@ -31206,7 +31271,6 @@ def test_export_app_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.ExportAppRequest() - assert args[0] == request_msg @@ -31227,7 +31291,6 @@ def test_import_app_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.ImportAppRequest() - assert args[0] == request_msg @@ -31250,7 +31313,6 @@ def test_get_security_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.GetSecuritySettingsRequest() - assert args[0] == request_msg @@ -31273,7 +31335,6 @@ def test_update_security_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.UpdateSecuritySettingsRequest() - assert args[0] == request_msg @@ -31294,7 +31355,6 @@ def test_list_agents_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.ListAgentsRequest() - assert args[0] == request_msg @@ -31315,7 +31375,6 @@ def test_get_agent_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.GetAgentRequest() - assert args[0] == request_msg @@ -31336,7 +31395,6 @@ def test_create_agent_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.CreateAgentRequest() - assert args[0] == request_msg @@ -31357,7 +31415,6 @@ def test_update_agent_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.UpdateAgentRequest() - assert args[0] == request_msg @@ -31378,7 +31435,6 @@ def test_delete_agent_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.DeleteAgentRequest() - assert args[0] == request_msg @@ -31399,7 +31455,6 @@ def test_list_examples_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.ListExamplesRequest() - assert args[0] == request_msg @@ -31420,7 +31475,6 @@ def test_get_example_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.GetExampleRequest() - assert args[0] == request_msg @@ -31441,7 +31495,6 @@ def test_create_example_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.CreateExampleRequest() - assert args[0] == request_msg @@ -31462,7 +31515,6 @@ def test_update_example_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.UpdateExampleRequest() - assert args[0] == request_msg @@ -31483,7 +31535,6 @@ def test_delete_example_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.DeleteExampleRequest() - assert args[0] == request_msg @@ -31504,7 +31555,6 @@ def test_list_tools_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.ListToolsRequest() - assert args[0] == request_msg @@ -31525,7 +31575,6 @@ def test_get_tool_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.GetToolRequest() - assert args[0] == request_msg @@ -31548,7 +31597,6 @@ def test_list_conversations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.ListConversationsRequest() - assert args[0] == request_msg @@ -31569,7 +31617,6 @@ def test_get_conversation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.GetConversationRequest() - assert args[0] == request_msg @@ -31592,7 +31639,6 @@ def test_delete_conversation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.DeleteConversationRequest() - assert args[0] == request_msg @@ -31615,7 +31661,6 @@ def test_batch_delete_conversations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.BatchDeleteConversationsRequest() - assert args[0] == request_msg @@ -31636,7 +31681,6 @@ def test_create_tool_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.CreateToolRequest() - assert args[0] == request_msg @@ -31657,7 +31701,6 @@ def test_update_tool_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.UpdateToolRequest() - assert args[0] == request_msg @@ -31678,7 +31721,6 @@ def test_delete_tool_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.DeleteToolRequest() - assert args[0] == request_msg @@ -31699,7 +31741,6 @@ def test_list_guardrails_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.ListGuardrailsRequest() - assert args[0] == request_msg @@ -31720,7 +31761,6 @@ def test_get_guardrail_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.GetGuardrailRequest() - assert args[0] == request_msg @@ -31741,7 +31781,6 @@ def test_create_guardrail_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.CreateGuardrailRequest() - assert args[0] == request_msg @@ -31762,7 +31801,6 @@ def test_update_guardrail_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.UpdateGuardrailRequest() - assert args[0] == request_msg @@ -31783,7 +31821,6 @@ def test_delete_guardrail_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.DeleteGuardrailRequest() - assert args[0] == request_msg @@ -31804,7 +31841,6 @@ def test_list_deployments_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.ListDeploymentsRequest() - assert args[0] == request_msg @@ -31825,7 +31861,6 @@ def test_get_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.GetDeploymentRequest() - assert args[0] == request_msg @@ -31848,7 +31883,6 @@ def test_create_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.CreateDeploymentRequest() - assert args[0] == request_msg @@ -31871,7 +31905,6 @@ def test_update_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.UpdateDeploymentRequest() - assert args[0] == request_msg @@ -31894,7 +31927,6 @@ def test_delete_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.DeleteDeploymentRequest() - assert args[0] == request_msg @@ -31915,7 +31947,6 @@ def test_list_toolsets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.ListToolsetsRequest() - assert args[0] == request_msg @@ -31936,7 +31967,6 @@ def test_get_toolset_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.GetToolsetRequest() - assert args[0] == request_msg @@ -31957,7 +31987,6 @@ def test_create_toolset_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.CreateToolsetRequest() - assert args[0] == request_msg @@ -31978,7 +32007,6 @@ def test_update_toolset_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.UpdateToolsetRequest() - assert args[0] == request_msg @@ -31999,7 +32027,6 @@ def test_delete_toolset_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.DeleteToolsetRequest() - assert args[0] == request_msg @@ -32022,7 +32049,6 @@ def test_list_app_versions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.ListAppVersionsRequest() - assert args[0] == request_msg @@ -32043,7 +32069,6 @@ def test_get_app_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.GetAppVersionRequest() - assert args[0] == request_msg @@ -32066,7 +32091,6 @@ def test_create_app_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.CreateAppVersionRequest() - assert args[0] == request_msg @@ -32089,7 +32113,6 @@ def test_delete_app_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.DeleteAppVersionRequest() - assert args[0] == request_msg @@ -32112,7 +32135,6 @@ def test_restore_app_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.RestoreAppVersionRequest() - assert args[0] == request_msg @@ -32135,7 +32157,6 @@ def test_generate_app_resource_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.GenerateAppResourceRequest() - assert args[0] == request_msg @@ -32156,7 +32177,6 @@ def test_list_changelogs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.ListChangelogsRequest() - assert args[0] == request_msg @@ -32177,7 +32197,6 @@ def test_get_changelog_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.GetChangelogRequest() - assert args[0] == request_msg @@ -32219,7 +32238,6 @@ async def test_list_apps_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.ListAppsRequest() - assert args[0] == request_msg @@ -32256,7 +32274,6 @@ async def test_get_app_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.GetAppRequest() - assert args[0] == request_msg @@ -32281,7 +32298,6 @@ async def test_create_app_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.CreateAppRequest() - assert args[0] == request_msg @@ -32318,7 +32334,6 @@ async def test_update_app_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.UpdateAppRequest() - assert args[0] == request_msg @@ -32343,7 +32358,6 @@ async def test_delete_app_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.DeleteAppRequest() - assert args[0] == request_msg @@ -32368,7 +32382,6 @@ async def test_export_app_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.ExportAppRequest() - assert args[0] == request_msg @@ -32393,7 +32406,6 @@ async def test_import_app_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.ImportAppRequest() - assert args[0] == request_msg @@ -32423,7 +32435,6 @@ async def test_get_security_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.GetSecuritySettingsRequest() - assert args[0] == request_msg @@ -32453,7 +32464,6 @@ async def test_update_security_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.UpdateSecuritySettingsRequest() - assert args[0] == request_msg @@ -32480,7 +32490,6 @@ async def test_list_agents_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.ListAgentsRequest() - assert args[0] == request_msg @@ -32515,7 +32524,6 @@ async def test_get_agent_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.GetAgentRequest() - assert args[0] == request_msg @@ -32550,7 +32558,6 @@ async def test_create_agent_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.CreateAgentRequest() - assert args[0] == request_msg @@ -32585,7 +32592,6 @@ async def test_update_agent_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.UpdateAgentRequest() - assert args[0] == request_msg @@ -32608,7 +32614,6 @@ async def test_delete_agent_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.DeleteAgentRequest() - assert args[0] == request_msg @@ -32635,7 +32640,6 @@ async def test_list_examples_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.ListExamplesRequest() - assert args[0] == request_msg @@ -32667,7 +32671,6 @@ async def test_get_example_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.GetExampleRequest() - assert args[0] == request_msg @@ -32699,7 +32702,6 @@ async def test_create_example_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.CreateExampleRequest() - assert args[0] == request_msg @@ -32731,7 +32733,6 @@ async def test_update_example_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.UpdateExampleRequest() - assert args[0] == request_msg @@ -32754,7 +32755,6 @@ async def test_delete_example_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.DeleteExampleRequest() - assert args[0] == request_msg @@ -32781,7 +32781,6 @@ async def test_list_tools_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.ListToolsRequest() - assert args[0] == request_msg @@ -32812,7 +32811,6 @@ async def test_get_tool_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.GetToolRequest() - assert args[0] == request_msg @@ -32841,7 +32839,6 @@ async def test_list_conversations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.ListConversationsRequest() - assert args[0] == request_msg @@ -32876,7 +32873,6 @@ async def test_get_conversation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.GetConversationRequest() - assert args[0] == request_msg @@ -32901,7 +32897,6 @@ async def test_delete_conversation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.DeleteConversationRequest() - assert args[0] == request_msg @@ -32928,7 +32923,6 @@ async def test_batch_delete_conversations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.BatchDeleteConversationsRequest() - assert args[0] == request_msg @@ -32959,7 +32953,6 @@ async def test_create_tool_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.CreateToolRequest() - assert args[0] == request_msg @@ -32990,7 +32983,6 @@ async def test_update_tool_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.UpdateToolRequest() - assert args[0] == request_msg @@ -33013,7 +33005,6 @@ async def test_delete_tool_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.DeleteToolRequest() - assert args[0] == request_msg @@ -33040,7 +33031,6 @@ async def test_list_guardrails_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.ListGuardrailsRequest() - assert args[0] == request_msg @@ -33071,7 +33061,6 @@ async def test_get_guardrail_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.GetGuardrailRequest() - assert args[0] == request_msg @@ -33102,7 +33091,6 @@ async def test_create_guardrail_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.CreateGuardrailRequest() - assert args[0] == request_msg @@ -33133,7 +33121,6 @@ async def test_update_guardrail_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.UpdateGuardrailRequest() - assert args[0] == request_msg @@ -33156,7 +33143,6 @@ async def test_delete_guardrail_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.DeleteGuardrailRequest() - assert args[0] == request_msg @@ -33183,7 +33169,6 @@ async def test_list_deployments_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.ListDeploymentsRequest() - assert args[0] == request_msg @@ -33213,7 +33198,6 @@ async def test_get_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.GetDeploymentRequest() - assert args[0] == request_msg @@ -33245,7 +33229,6 @@ async def test_create_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.CreateDeploymentRequest() - assert args[0] == request_msg @@ -33277,7 +33260,6 @@ async def test_update_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.UpdateDeploymentRequest() - assert args[0] == request_msg @@ -33302,7 +33284,6 @@ async def test_delete_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.DeleteDeploymentRequest() - assert args[0] == request_msg @@ -33329,7 +33310,6 @@ async def test_list_toolsets_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.ListToolsetsRequest() - assert args[0] == request_msg @@ -33360,7 +33340,6 @@ async def test_get_toolset_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.GetToolsetRequest() - assert args[0] == request_msg @@ -33391,7 +33370,6 @@ async def test_create_toolset_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.CreateToolsetRequest() - assert args[0] == request_msg @@ -33422,7 +33400,6 @@ async def test_update_toolset_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.UpdateToolsetRequest() - assert args[0] == request_msg @@ -33445,7 +33422,6 @@ async def test_delete_toolset_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.DeleteToolsetRequest() - assert args[0] == request_msg @@ -33474,7 +33450,6 @@ async def test_list_app_versions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.ListAppVersionsRequest() - assert args[0] == request_msg @@ -33505,7 +33480,6 @@ async def test_get_app_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.GetAppVersionRequest() - assert args[0] == request_msg @@ -33538,7 +33512,6 @@ async def test_create_app_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.CreateAppVersionRequest() - assert args[0] == request_msg @@ -33563,7 +33536,6 @@ async def test_delete_app_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.DeleteAppVersionRequest() - assert args[0] == request_msg @@ -33590,7 +33562,6 @@ async def test_restore_app_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.RestoreAppVersionRequest() - assert args[0] == request_msg @@ -33617,7 +33588,6 @@ async def test_generate_app_resource_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.GenerateAppResourceRequest() - assert args[0] == request_msg @@ -33644,7 +33614,6 @@ async def test_list_changelogs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.ListChangelogsRequest() - assert args[0] == request_msg @@ -33678,7 +33647,6 @@ async def test_get_changelog_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.GetChangelogRequest() - assert args[0] == request_msg @@ -43901,7 +43869,6 @@ def test_list_apps_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.ListAppsRequest() - assert args[0] == request_msg @@ -43921,7 +43888,6 @@ def test_get_app_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.GetAppRequest() - assert args[0] == request_msg @@ -43941,7 +43907,6 @@ def test_create_app_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.CreateAppRequest() - assert args[0] == request_msg @@ -43961,7 +43926,6 @@ def test_update_app_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.UpdateAppRequest() - assert args[0] == request_msg @@ -43981,7 +43945,6 @@ def test_delete_app_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.DeleteAppRequest() - assert args[0] == request_msg @@ -44001,7 +43964,6 @@ def test_export_app_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.ExportAppRequest() - assert args[0] == request_msg @@ -44021,7 +43983,6 @@ def test_import_app_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.ImportAppRequest() - assert args[0] == request_msg @@ -44043,7 +44004,6 @@ def test_get_security_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.GetSecuritySettingsRequest() - assert args[0] == request_msg @@ -44065,7 +44025,6 @@ def test_update_security_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.UpdateSecuritySettingsRequest() - assert args[0] == request_msg @@ -44085,7 +44044,6 @@ def test_list_agents_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.ListAgentsRequest() - assert args[0] == request_msg @@ -44105,7 +44063,6 @@ def test_get_agent_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.GetAgentRequest() - assert args[0] == request_msg @@ -44125,7 +44082,6 @@ def test_create_agent_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.CreateAgentRequest() - assert args[0] == request_msg @@ -44145,7 +44101,6 @@ def test_update_agent_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.UpdateAgentRequest() - assert args[0] == request_msg @@ -44165,7 +44120,6 @@ def test_delete_agent_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.DeleteAgentRequest() - assert args[0] == request_msg @@ -44185,7 +44139,6 @@ def test_list_examples_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.ListExamplesRequest() - assert args[0] == request_msg @@ -44205,7 +44158,6 @@ def test_get_example_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.GetExampleRequest() - assert args[0] == request_msg @@ -44225,7 +44177,6 @@ def test_create_example_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.CreateExampleRequest() - assert args[0] == request_msg @@ -44245,7 +44196,6 @@ def test_update_example_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.UpdateExampleRequest() - assert args[0] == request_msg @@ -44265,7 +44215,6 @@ def test_delete_example_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.DeleteExampleRequest() - assert args[0] == request_msg @@ -44285,7 +44234,6 @@ def test_list_tools_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.ListToolsRequest() - assert args[0] == request_msg @@ -44305,7 +44253,6 @@ def test_get_tool_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.GetToolRequest() - assert args[0] == request_msg @@ -44327,7 +44274,6 @@ def test_list_conversations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.ListConversationsRequest() - assert args[0] == request_msg @@ -44347,7 +44293,6 @@ def test_get_conversation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.GetConversationRequest() - assert args[0] == request_msg @@ -44369,7 +44314,6 @@ def test_delete_conversation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.DeleteConversationRequest() - assert args[0] == request_msg @@ -44391,7 +44335,6 @@ def test_batch_delete_conversations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.BatchDeleteConversationsRequest() - assert args[0] == request_msg @@ -44411,7 +44354,6 @@ def test_create_tool_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.CreateToolRequest() - assert args[0] == request_msg @@ -44431,7 +44373,6 @@ def test_update_tool_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.UpdateToolRequest() - assert args[0] == request_msg @@ -44451,7 +44392,6 @@ def test_delete_tool_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.DeleteToolRequest() - assert args[0] == request_msg @@ -44471,7 +44411,6 @@ def test_list_guardrails_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.ListGuardrailsRequest() - assert args[0] == request_msg @@ -44491,7 +44430,6 @@ def test_get_guardrail_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.GetGuardrailRequest() - assert args[0] == request_msg @@ -44511,7 +44449,6 @@ def test_create_guardrail_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.CreateGuardrailRequest() - assert args[0] == request_msg @@ -44531,7 +44468,6 @@ def test_update_guardrail_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.UpdateGuardrailRequest() - assert args[0] == request_msg @@ -44551,7 +44487,6 @@ def test_delete_guardrail_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.DeleteGuardrailRequest() - assert args[0] == request_msg @@ -44571,7 +44506,6 @@ def test_list_deployments_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.ListDeploymentsRequest() - assert args[0] == request_msg @@ -44591,7 +44525,6 @@ def test_get_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.GetDeploymentRequest() - assert args[0] == request_msg @@ -44613,7 +44546,6 @@ def test_create_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.CreateDeploymentRequest() - assert args[0] == request_msg @@ -44635,7 +44567,6 @@ def test_update_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.UpdateDeploymentRequest() - assert args[0] == request_msg @@ -44657,7 +44588,6 @@ def test_delete_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.DeleteDeploymentRequest() - assert args[0] == request_msg @@ -44677,7 +44607,6 @@ def test_list_toolsets_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.ListToolsetsRequest() - assert args[0] == request_msg @@ -44697,7 +44626,6 @@ def test_get_toolset_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.GetToolsetRequest() - assert args[0] == request_msg @@ -44717,7 +44645,6 @@ def test_create_toolset_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.CreateToolsetRequest() - assert args[0] == request_msg @@ -44737,7 +44664,6 @@ def test_update_toolset_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.UpdateToolsetRequest() - assert args[0] == request_msg @@ -44757,7 +44683,6 @@ def test_delete_toolset_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.DeleteToolsetRequest() - assert args[0] == request_msg @@ -44779,7 +44704,6 @@ def test_list_app_versions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.ListAppVersionsRequest() - assert args[0] == request_msg @@ -44799,7 +44723,6 @@ def test_get_app_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.GetAppVersionRequest() - assert args[0] == request_msg @@ -44821,7 +44744,6 @@ def test_create_app_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.CreateAppVersionRequest() - assert args[0] == request_msg @@ -44843,7 +44765,6 @@ def test_delete_app_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.DeleteAppVersionRequest() - assert args[0] == request_msg @@ -44865,7 +44786,6 @@ def test_restore_app_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.RestoreAppVersionRequest() - assert args[0] == request_msg @@ -44887,7 +44807,6 @@ def test_generate_app_resource_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.GenerateAppResourceRequest() - assert args[0] == request_msg @@ -44907,7 +44826,6 @@ def test_list_changelogs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.ListChangelogsRequest() - assert args[0] == request_msg @@ -44927,7 +44845,6 @@ def test_get_changelog_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent_service.GetChangelogRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-ces/tests/unit/gapic/ces_v1beta/test_evaluation_service.py b/packages/google-cloud-ces/tests/unit/gapic/ces_v1beta/test_evaluation_service.py index d712cc1f753f..3fb631bf3d04 100644 --- a/packages/google-cloud-ces/tests/unit/gapic/ces_v1beta/test_evaluation_service.py +++ b/packages/google-cloud-ces/tests/unit/gapic/ces_v1beta/test_evaluation_service.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 @@ -133,6 +134,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" @@ -1377,8 +1393,8 @@ def test_evaluation_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - evaluation.RunEvaluationRequest, - dict, + evaluation.RunEvaluationRequest(), + {}, ], ) def test_run_evaluation(request_type, transport: str = "grpc"): @@ -1389,7 +1405,7 @@ def test_run_evaluation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.run_evaluation), "__call__") as call: @@ -1434,13 +1450,14 @@ def test_run_evaluation_non_empty_request_with_auto_populated_field(): client.run_evaluation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == evaluation.RunEvaluationRequest( + request_msg = evaluation.RunEvaluationRequest( app="app_value", evaluation_dataset="evaluation_dataset_value", display_name="display_name_value", app_version="app_version_value", scheduled_evaluation_run="scheduled_evaluation_run_value", ) + assert args[0] == request_msg def test_run_evaluation_use_cached_wrapped_rpc(): @@ -1531,9 +1548,14 @@ async def test_run_evaluation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_run_evaluation_async( - transport: str = "grpc_asyncio", request_type=evaluation.RunEvaluationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + evaluation.RunEvaluationRequest(), + {}, + ], +) +async def test_run_evaluation_async(request_type, transport: str = "grpc_asyncio"): client = EvaluationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1541,7 +1563,7 @@ async def test_run_evaluation_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.run_evaluation), "__call__") as call: @@ -1561,11 +1583,6 @@ async def test_run_evaluation_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_run_evaluation_async_from_dict(): - await test_run_evaluation_async(request_type=dict) - - def test_run_evaluation_field_headers(): client = EvaluationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1712,8 +1729,8 @@ async def test_run_evaluation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - evaluation_service.UploadEvaluationAudioRequest, - dict, + evaluation_service.UploadEvaluationAudioRequest(), + {}, ], ) def test_upload_evaluation_audio(request_type, transport: str = "grpc"): @@ -1724,7 +1741,7 @@ def test_upload_evaluation_audio(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1775,10 +1792,11 @@ def test_upload_evaluation_audio_non_empty_request_with_auto_populated_field(): client.upload_evaluation_audio(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == evaluation_service.UploadEvaluationAudioRequest( + request_msg = evaluation_service.UploadEvaluationAudioRequest( name="name_value", previous_audio_gcs_uri="previous_audio_gcs_uri_value", ) + assert args[0] == request_msg def test_upload_evaluation_audio_use_cached_wrapped_rpc(): @@ -1864,9 +1882,15 @@ async def test_upload_evaluation_audio_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + evaluation_service.UploadEvaluationAudioRequest(), + {}, + ], +) async def test_upload_evaluation_audio_async( - transport: str = "grpc_asyncio", - request_type=evaluation_service.UploadEvaluationAudioRequest, + request_type, transport: str = "grpc_asyncio" ): client = EvaluationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1875,7 +1899,7 @@ async def test_upload_evaluation_audio_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( @@ -1902,11 +1926,6 @@ async def test_upload_evaluation_audio_async( assert response.transcript == "transcript_value" -@pytest.mark.asyncio -async def test_upload_evaluation_audio_async_from_dict(): - await test_upload_evaluation_audio_async(request_type=dict) - - def test_upload_evaluation_audio_field_headers(): client = EvaluationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2071,8 +2090,8 @@ async def test_upload_evaluation_audio_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - evaluation_service.CreateEvaluationRequest, - dict, + evaluation_service.CreateEvaluationRequest(), + {}, ], ) def test_create_evaluation(request_type, transport: str = "grpc"): @@ -2083,7 +2102,7 @@ def test_create_evaluation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2150,10 +2169,11 @@ def test_create_evaluation_non_empty_request_with_auto_populated_field(): client.create_evaluation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == evaluation_service.CreateEvaluationRequest( + request_msg = evaluation_service.CreateEvaluationRequest( parent="parent_value", evaluation_id="evaluation_id_value", ) + assert args[0] == request_msg def test_create_evaluation_use_cached_wrapped_rpc(): @@ -2236,10 +2256,14 @@ async def test_create_evaluation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_evaluation_async( - transport: str = "grpc_asyncio", - request_type=evaluation_service.CreateEvaluationRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + evaluation_service.CreateEvaluationRequest(), + {}, + ], +) +async def test_create_evaluation_async(request_type, transport: str = "grpc_asyncio"): client = EvaluationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2247,7 +2271,7 @@ async def test_create_evaluation_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( @@ -2290,11 +2314,6 @@ async def test_create_evaluation_async( assert response.invalid is True -@pytest.mark.asyncio -async def test_create_evaluation_async_from_dict(): - await test_create_evaluation_async(request_type=dict) - - def test_create_evaluation_field_headers(): client = EvaluationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2553,8 +2572,8 @@ async def test_create_evaluation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - evaluation_service.GenerateEvaluationRequest, - dict, + evaluation_service.GenerateEvaluationRequest(), + {}, ], ) def test_generate_evaluation(request_type, transport: str = "grpc"): @@ -2565,7 +2584,7 @@ def test_generate_evaluation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2610,9 +2629,10 @@ def test_generate_evaluation_non_empty_request_with_auto_populated_field(): client.generate_evaluation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == evaluation_service.GenerateEvaluationRequest( + request_msg = evaluation_service.GenerateEvaluationRequest( conversation="conversation_value", ) + assert args[0] == request_msg def test_generate_evaluation_use_cached_wrapped_rpc(): @@ -2707,10 +2727,14 @@ async def test_generate_evaluation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_generate_evaluation_async( - transport: str = "grpc_asyncio", - request_type=evaluation_service.GenerateEvaluationRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + evaluation_service.GenerateEvaluationRequest(), + {}, + ], +) +async def test_generate_evaluation_async(request_type, transport: str = "grpc_asyncio"): client = EvaluationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2718,7 +2742,7 @@ async def test_generate_evaluation_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( @@ -2740,11 +2764,6 @@ async def test_generate_evaluation_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_generate_evaluation_async_from_dict(): - await test_generate_evaluation_async(request_type=dict) - - def test_generate_evaluation_field_headers(): client = EvaluationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2899,8 +2918,8 @@ async def test_generate_evaluation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - evaluation_service.ImportEvaluationsRequest, - dict, + evaluation_service.ImportEvaluationsRequest(), + {}, ], ) def test_import_evaluations(request_type, transport: str = "grpc"): @@ -2911,7 +2930,7 @@ def test_import_evaluations(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2957,10 +2976,11 @@ def test_import_evaluations_non_empty_request_with_auto_populated_field(): client.import_evaluations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == evaluation_service.ImportEvaluationsRequest( + request_msg = evaluation_service.ImportEvaluationsRequest( gcs_uri="gcs_uri_value", parent="parent_value", ) + assert args[0] == request_msg def test_import_evaluations_use_cached_wrapped_rpc(): @@ -3055,10 +3075,14 @@ async def test_import_evaluations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_import_evaluations_async( - transport: str = "grpc_asyncio", - request_type=evaluation_service.ImportEvaluationsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + evaluation_service.ImportEvaluationsRequest(), + {}, + ], +) +async def test_import_evaluations_async(request_type, transport: str = "grpc_asyncio"): client = EvaluationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3066,7 +3090,7 @@ async def test_import_evaluations_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( @@ -3088,11 +3112,6 @@ async def test_import_evaluations_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_import_evaluations_async_from_dict(): - await test_import_evaluations_async(request_type=dict) - - def test_import_evaluations_field_headers(): client = EvaluationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3247,8 +3266,8 @@ async def test_import_evaluations_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - evaluation_service.CreateEvaluationDatasetRequest, - dict, + evaluation_service.CreateEvaluationDatasetRequest(), + {}, ], ) def test_create_evaluation_dataset(request_type, transport: str = "grpc"): @@ -3259,7 +3278,7 @@ def test_create_evaluation_dataset(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3318,10 +3337,11 @@ def test_create_evaluation_dataset_non_empty_request_with_auto_populated_field() client.create_evaluation_dataset(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == evaluation_service.CreateEvaluationDatasetRequest( + request_msg = evaluation_service.CreateEvaluationDatasetRequest( parent="parent_value", evaluation_dataset_id="evaluation_dataset_id_value", ) + assert args[0] == request_msg def test_create_evaluation_dataset_use_cached_wrapped_rpc(): @@ -3407,9 +3427,15 @@ async def test_create_evaluation_dataset_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + evaluation_service.CreateEvaluationDatasetRequest(), + {}, + ], +) async def test_create_evaluation_dataset_async( - transport: str = "grpc_asyncio", - request_type=evaluation_service.CreateEvaluationDatasetRequest, + request_type, transport: str = "grpc_asyncio" ): client = EvaluationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3418,7 +3444,7 @@ async def test_create_evaluation_dataset_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( @@ -3453,11 +3479,6 @@ async def test_create_evaluation_dataset_async( assert response.last_updated_by == "last_updated_by_value" -@pytest.mark.asyncio -async def test_create_evaluation_dataset_async_from_dict(): - await test_create_evaluation_dataset_async(request_type=dict) - - def test_create_evaluation_dataset_field_headers(): client = EvaluationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3632,8 +3653,8 @@ async def test_create_evaluation_dataset_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - evaluation_service.UpdateEvaluationRequest, - dict, + evaluation_service.UpdateEvaluationRequest(), + {}, ], ) def test_update_evaluation(request_type, transport: str = "grpc"): @@ -3644,7 +3665,7 @@ def test_update_evaluation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3708,7 +3729,8 @@ def test_update_evaluation_non_empty_request_with_auto_populated_field(): client.update_evaluation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == evaluation_service.UpdateEvaluationRequest() + request_msg = evaluation_service.UpdateEvaluationRequest() + assert args[0] == request_msg def test_update_evaluation_use_cached_wrapped_rpc(): @@ -3791,10 +3813,14 @@ async def test_update_evaluation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_evaluation_async( - transport: str = "grpc_asyncio", - request_type=evaluation_service.UpdateEvaluationRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + evaluation_service.UpdateEvaluationRequest(), + {}, + ], +) +async def test_update_evaluation_async(request_type, transport: str = "grpc_asyncio"): client = EvaluationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3802,7 +3828,7 @@ async def test_update_evaluation_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( @@ -3845,11 +3871,6 @@ async def test_update_evaluation_async( assert response.invalid is True -@pytest.mark.asyncio -async def test_update_evaluation_async_from_dict(): - await test_update_evaluation_async(request_type=dict) - - def test_update_evaluation_field_headers(): client = EvaluationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4098,8 +4119,8 @@ async def test_update_evaluation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - evaluation_service.UpdateEvaluationDatasetRequest, - dict, + evaluation_service.UpdateEvaluationDatasetRequest(), + {}, ], ) def test_update_evaluation_dataset(request_type, transport: str = "grpc"): @@ -4110,7 +4131,7 @@ def test_update_evaluation_dataset(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4166,7 +4187,8 @@ def test_update_evaluation_dataset_non_empty_request_with_auto_populated_field() client.update_evaluation_dataset(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == evaluation_service.UpdateEvaluationDatasetRequest() + request_msg = evaluation_service.UpdateEvaluationDatasetRequest() + assert args[0] == request_msg def test_update_evaluation_dataset_use_cached_wrapped_rpc(): @@ -4252,9 +4274,15 @@ async def test_update_evaluation_dataset_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + evaluation_service.UpdateEvaluationDatasetRequest(), + {}, + ], +) async def test_update_evaluation_dataset_async( - transport: str = "grpc_asyncio", - request_type=evaluation_service.UpdateEvaluationDatasetRequest, + request_type, transport: str = "grpc_asyncio" ): client = EvaluationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4263,7 +4291,7 @@ async def test_update_evaluation_dataset_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( @@ -4298,11 +4326,6 @@ async def test_update_evaluation_dataset_async( assert response.last_updated_by == "last_updated_by_value" -@pytest.mark.asyncio -async def test_update_evaluation_dataset_async_from_dict(): - await test_update_evaluation_dataset_async(request_type=dict) - - def test_update_evaluation_dataset_field_headers(): client = EvaluationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4467,8 +4490,8 @@ async def test_update_evaluation_dataset_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - evaluation_service.DeleteEvaluationRequest, - dict, + evaluation_service.DeleteEvaluationRequest(), + {}, ], ) def test_delete_evaluation(request_type, transport: str = "grpc"): @@ -4479,7 +4502,7 @@ def test_delete_evaluation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4525,10 +4548,11 @@ def test_delete_evaluation_non_empty_request_with_auto_populated_field(): client.delete_evaluation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == evaluation_service.DeleteEvaluationRequest( + request_msg = evaluation_service.DeleteEvaluationRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_evaluation_use_cached_wrapped_rpc(): @@ -4611,10 +4635,14 @@ async def test_delete_evaluation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_evaluation_async( - transport: str = "grpc_asyncio", - request_type=evaluation_service.DeleteEvaluationRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + evaluation_service.DeleteEvaluationRequest(), + {}, + ], +) +async def test_delete_evaluation_async(request_type, transport: str = "grpc_asyncio"): client = EvaluationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4622,7 +4650,7 @@ async def test_delete_evaluation_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( @@ -4642,11 +4670,6 @@ async def test_delete_evaluation_async( assert response is None -@pytest.mark.asyncio -async def test_delete_evaluation_async_from_dict(): - await test_delete_evaluation_async(request_type=dict) - - def test_delete_evaluation_field_headers(): client = EvaluationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4797,8 +4820,8 @@ async def test_delete_evaluation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - evaluation_service.DeleteEvaluationResultRequest, - dict, + evaluation_service.DeleteEvaluationResultRequest(), + {}, ], ) def test_delete_evaluation_result(request_type, transport: str = "grpc"): @@ -4809,7 +4832,7 @@ def test_delete_evaluation_result(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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 +4877,10 @@ def test_delete_evaluation_result_non_empty_request_with_auto_populated_field(): client.delete_evaluation_result(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == evaluation_service.DeleteEvaluationResultRequest( + request_msg = evaluation_service.DeleteEvaluationResultRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_evaluation_result_use_cached_wrapped_rpc(): @@ -4942,9 +4966,15 @@ async def test_delete_evaluation_result_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + evaluation_service.DeleteEvaluationResultRequest(), + {}, + ], +) async def test_delete_evaluation_result_async( - transport: str = "grpc_asyncio", - request_type=evaluation_service.DeleteEvaluationResultRequest, + request_type, transport: str = "grpc_asyncio" ): client = EvaluationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4953,7 +4983,7 @@ async def test_delete_evaluation_result_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( @@ -4973,11 +5003,6 @@ async def test_delete_evaluation_result_async( assert response is None -@pytest.mark.asyncio -async def test_delete_evaluation_result_async_from_dict(): - await test_delete_evaluation_result_async(request_type=dict) - - def test_delete_evaluation_result_field_headers(): client = EvaluationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5128,8 +5153,8 @@ async def test_delete_evaluation_result_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - evaluation_service.DeleteEvaluationDatasetRequest, - dict, + evaluation_service.DeleteEvaluationDatasetRequest(), + {}, ], ) def test_delete_evaluation_dataset(request_type, transport: str = "grpc"): @@ -5140,7 +5165,7 @@ def test_delete_evaluation_dataset(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5186,10 +5211,11 @@ def test_delete_evaluation_dataset_non_empty_request_with_auto_populated_field() client.delete_evaluation_dataset(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == evaluation_service.DeleteEvaluationDatasetRequest( + request_msg = evaluation_service.DeleteEvaluationDatasetRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_evaluation_dataset_use_cached_wrapped_rpc(): @@ -5275,9 +5301,15 @@ async def test_delete_evaluation_dataset_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + evaluation_service.DeleteEvaluationDatasetRequest(), + {}, + ], +) async def test_delete_evaluation_dataset_async( - transport: str = "grpc_asyncio", - request_type=evaluation_service.DeleteEvaluationDatasetRequest, + request_type, transport: str = "grpc_asyncio" ): client = EvaluationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5286,7 +5318,7 @@ async def test_delete_evaluation_dataset_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( @@ -5306,11 +5338,6 @@ async def test_delete_evaluation_dataset_async( assert response is None -@pytest.mark.asyncio -async def test_delete_evaluation_dataset_async_from_dict(): - await test_delete_evaluation_dataset_async(request_type=dict) - - def test_delete_evaluation_dataset_field_headers(): client = EvaluationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5461,8 +5488,8 @@ async def test_delete_evaluation_dataset_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - evaluation_service.DeleteEvaluationRunRequest, - dict, + evaluation_service.DeleteEvaluationRunRequest(), + {}, ], ) def test_delete_evaluation_run(request_type, transport: str = "grpc"): @@ -5473,7 +5500,7 @@ def test_delete_evaluation_run(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5518,9 +5545,10 @@ def test_delete_evaluation_run_non_empty_request_with_auto_populated_field(): client.delete_evaluation_run(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == evaluation_service.DeleteEvaluationRunRequest( + request_msg = evaluation_service.DeleteEvaluationRunRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_evaluation_run_use_cached_wrapped_rpc(): @@ -5616,9 +5644,15 @@ async def test_delete_evaluation_run_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + evaluation_service.DeleteEvaluationRunRequest(), + {}, + ], +) async def test_delete_evaluation_run_async( - transport: str = "grpc_asyncio", - request_type=evaluation_service.DeleteEvaluationRunRequest, + request_type, transport: str = "grpc_asyncio" ): client = EvaluationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5627,7 +5661,7 @@ async def test_delete_evaluation_run_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( @@ -5649,11 +5683,6 @@ async def test_delete_evaluation_run_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_evaluation_run_async_from_dict(): - await test_delete_evaluation_run_async(request_type=dict) - - def test_delete_evaluation_run_field_headers(): client = EvaluationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5808,8 +5837,8 @@ async def test_delete_evaluation_run_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - evaluation_service.GetEvaluationRequest, - dict, + evaluation_service.GetEvaluationRequest(), + {}, ], ) def test_get_evaluation(request_type, transport: str = "grpc"): @@ -5820,7 +5849,7 @@ def test_get_evaluation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_evaluation), "__call__") as call: @@ -5882,9 +5911,10 @@ def test_get_evaluation_non_empty_request_with_auto_populated_field(): client.get_evaluation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == evaluation_service.GetEvaluationRequest( + request_msg = evaluation_service.GetEvaluationRequest( name="name_value", ) + assert args[0] == request_msg def test_get_evaluation_use_cached_wrapped_rpc(): @@ -5965,10 +5995,14 @@ async def test_get_evaluation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_evaluation_async( - transport: str = "grpc_asyncio", - request_type=evaluation_service.GetEvaluationRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + evaluation_service.GetEvaluationRequest(), + {}, + ], +) +async def test_get_evaluation_async(request_type, transport: str = "grpc_asyncio"): client = EvaluationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5976,7 +6010,7 @@ async def test_get_evaluation_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_evaluation), "__call__") as call: @@ -6017,11 +6051,6 @@ async def test_get_evaluation_async( assert response.invalid is True -@pytest.mark.asyncio -async def test_get_evaluation_async_from_dict(): - await test_get_evaluation_async(request_type=dict) - - def test_get_evaluation_field_headers(): client = EvaluationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6168,8 +6197,8 @@ async def test_get_evaluation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - evaluation_service.GetEvaluationResultRequest, - dict, + evaluation_service.GetEvaluationResultRequest(), + {}, ], ) def test_get_evaluation_result(request_type, transport: str = "grpc"): @@ -6180,7 +6209,7 @@ def test_get_evaluation_result(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6248,9 +6277,10 @@ def test_get_evaluation_result_non_empty_request_with_auto_populated_field(): client.get_evaluation_result(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == evaluation_service.GetEvaluationResultRequest( + request_msg = evaluation_service.GetEvaluationResultRequest( name="name_value", ) + assert args[0] == request_msg def test_get_evaluation_result_use_cached_wrapped_rpc(): @@ -6336,9 +6366,15 @@ async def test_get_evaluation_result_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + evaluation_service.GetEvaluationResultRequest(), + {}, + ], +) async def test_get_evaluation_result_async( - transport: str = "grpc_asyncio", - request_type=evaluation_service.GetEvaluationResultRequest, + request_type, transport: str = "grpc_asyncio" ): client = EvaluationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -6347,7 +6383,7 @@ async def test_get_evaluation_result_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( @@ -6392,11 +6428,6 @@ async def test_get_evaluation_result_async( assert response.golden_run_method == golden_run.GoldenRunMethod.STABLE -@pytest.mark.asyncio -async def test_get_evaluation_result_async_from_dict(): - await test_get_evaluation_result_async(request_type=dict) - - def test_get_evaluation_result_field_headers(): client = EvaluationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6551,8 +6582,8 @@ async def test_get_evaluation_result_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - evaluation_service.GetEvaluationDatasetRequest, - dict, + evaluation_service.GetEvaluationDatasetRequest(), + {}, ], ) def test_get_evaluation_dataset(request_type, transport: str = "grpc"): @@ -6563,7 +6594,7 @@ def test_get_evaluation_dataset(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6621,9 +6652,10 @@ def test_get_evaluation_dataset_non_empty_request_with_auto_populated_field(): client.get_evaluation_dataset(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == evaluation_service.GetEvaluationDatasetRequest( + request_msg = evaluation_service.GetEvaluationDatasetRequest( name="name_value", ) + assert args[0] == request_msg def test_get_evaluation_dataset_use_cached_wrapped_rpc(): @@ -6709,9 +6741,15 @@ async def test_get_evaluation_dataset_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + evaluation_service.GetEvaluationDatasetRequest(), + {}, + ], +) async def test_get_evaluation_dataset_async( - transport: str = "grpc_asyncio", - request_type=evaluation_service.GetEvaluationDatasetRequest, + request_type, transport: str = "grpc_asyncio" ): client = EvaluationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -6720,7 +6758,7 @@ async def test_get_evaluation_dataset_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( @@ -6755,11 +6793,6 @@ async def test_get_evaluation_dataset_async( assert response.last_updated_by == "last_updated_by_value" -@pytest.mark.asyncio -async def test_get_evaluation_dataset_async_from_dict(): - await test_get_evaluation_dataset_async(request_type=dict) - - def test_get_evaluation_dataset_field_headers(): client = EvaluationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6914,8 +6947,8 @@ async def test_get_evaluation_dataset_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - evaluation_service.GetEvaluationRunRequest, - dict, + evaluation_service.GetEvaluationRunRequest(), + {}, ], ) def test_get_evaluation_run(request_type, transport: str = "grpc"): @@ -6926,7 +6959,7 @@ def test_get_evaluation_run(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7000,9 +7033,10 @@ def test_get_evaluation_run_non_empty_request_with_auto_populated_field(): client.get_evaluation_run(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == evaluation_service.GetEvaluationRunRequest( + request_msg = evaluation_service.GetEvaluationRunRequest( name="name_value", ) + assert args[0] == request_msg def test_get_evaluation_run_use_cached_wrapped_rpc(): @@ -7087,10 +7121,14 @@ async def test_get_evaluation_run_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_evaluation_run_async( - transport: str = "grpc_asyncio", - request_type=evaluation_service.GetEvaluationRunRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + evaluation_service.GetEvaluationRunRequest(), + {}, + ], +) +async def test_get_evaluation_run_async(request_type, transport: str = "grpc_asyncio"): client = EvaluationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7098,7 +7136,7 @@ async def test_get_evaluation_run_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( @@ -7149,11 +7187,6 @@ async def test_get_evaluation_run_async( assert response.golden_run_method == golden_run.GoldenRunMethod.STABLE -@pytest.mark.asyncio -async def test_get_evaluation_run_async_from_dict(): - await test_get_evaluation_run_async(request_type=dict) - - def test_get_evaluation_run_field_headers(): client = EvaluationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7308,8 +7341,8 @@ async def test_get_evaluation_run_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - evaluation_service.ListEvaluationsRequest, - dict, + evaluation_service.ListEvaluationsRequest(), + {}, ], ) def test_list_evaluations(request_type, transport: str = "grpc"): @@ -7320,7 +7353,7 @@ def test_list_evaluations(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_evaluations), "__call__") as call: @@ -7369,7 +7402,7 @@ def test_list_evaluations_non_empty_request_with_auto_populated_field(): client.list_evaluations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == evaluation_service.ListEvaluationsRequest( + request_msg = evaluation_service.ListEvaluationsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", @@ -7377,6 +7410,7 @@ def test_list_evaluations_non_empty_request_with_auto_populated_field(): evaluation_run_filter="evaluation_run_filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_evaluations_use_cached_wrapped_rpc(): @@ -7459,10 +7493,14 @@ async def test_list_evaluations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_evaluations_async( - transport: str = "grpc_asyncio", - request_type=evaluation_service.ListEvaluationsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + evaluation_service.ListEvaluationsRequest(), + {}, + ], +) +async def test_list_evaluations_async(request_type, transport: str = "grpc_asyncio"): client = EvaluationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7470,7 +7508,7 @@ async def test_list_evaluations_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_evaluations), "__call__") as call: @@ -7493,11 +7531,6 @@ async def test_list_evaluations_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_evaluations_async_from_dict(): - await test_list_evaluations_async(request_type=dict) - - def test_list_evaluations_field_headers(): client = EvaluationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7834,8 +7867,8 @@ async def test_list_evaluations_async_pages(): @pytest.mark.parametrize( "request_type", [ - evaluation_service.ListEvaluationResultsRequest, - dict, + evaluation_service.ListEvaluationResultsRequest(), + {}, ], ) def test_list_evaluation_results(request_type, transport: str = "grpc"): @@ -7846,7 +7879,7 @@ def test_list_evaluation_results(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7897,12 +7930,13 @@ def test_list_evaluation_results_non_empty_request_with_auto_populated_field(): client.list_evaluation_results(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == evaluation_service.ListEvaluationResultsRequest( + request_msg = evaluation_service.ListEvaluationResultsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_evaluation_results_use_cached_wrapped_rpc(): @@ -7988,9 +8022,15 @@ async def test_list_evaluation_results_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + evaluation_service.ListEvaluationResultsRequest(), + {}, + ], +) async def test_list_evaluation_results_async( - transport: str = "grpc_asyncio", - request_type=evaluation_service.ListEvaluationResultsRequest, + request_type, transport: str = "grpc_asyncio" ): client = EvaluationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -7999,7 +8039,7 @@ async def test_list_evaluation_results_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( @@ -8024,11 +8064,6 @@ async def test_list_evaluation_results_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_evaluation_results_async_from_dict(): - await test_list_evaluation_results_async(request_type=dict) - - def test_list_evaluation_results_field_headers(): client = EvaluationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8381,8 +8416,8 @@ async def test_list_evaluation_results_async_pages(): @pytest.mark.parametrize( "request_type", [ - evaluation_service.ListEvaluationDatasetsRequest, - dict, + evaluation_service.ListEvaluationDatasetsRequest(), + {}, ], ) def test_list_evaluation_datasets(request_type, transport: str = "grpc"): @@ -8393,7 +8428,7 @@ def test_list_evaluation_datasets(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8444,12 +8479,13 @@ def test_list_evaluation_datasets_non_empty_request_with_auto_populated_field(): client.list_evaluation_datasets(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == evaluation_service.ListEvaluationDatasetsRequest( + request_msg = evaluation_service.ListEvaluationDatasetsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_evaluation_datasets_use_cached_wrapped_rpc(): @@ -8535,9 +8571,15 @@ async def test_list_evaluation_datasets_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + evaluation_service.ListEvaluationDatasetsRequest(), + {}, + ], +) async def test_list_evaluation_datasets_async( - transport: str = "grpc_asyncio", - request_type=evaluation_service.ListEvaluationDatasetsRequest, + request_type, transport: str = "grpc_asyncio" ): client = EvaluationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -8546,7 +8588,7 @@ async def test_list_evaluation_datasets_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( @@ -8571,11 +8613,6 @@ async def test_list_evaluation_datasets_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_evaluation_datasets_async_from_dict(): - await test_list_evaluation_datasets_async(request_type=dict) - - def test_list_evaluation_datasets_field_headers(): client = EvaluationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8930,8 +8967,8 @@ async def test_list_evaluation_datasets_async_pages(): @pytest.mark.parametrize( "request_type", [ - evaluation_service.ListEvaluationRunsRequest, - dict, + evaluation_service.ListEvaluationRunsRequest(), + {}, ], ) def test_list_evaluation_runs(request_type, transport: str = "grpc"): @@ -8942,7 +8979,7 @@ def test_list_evaluation_runs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8993,12 +9030,13 @@ def test_list_evaluation_runs_non_empty_request_with_auto_populated_field(): client.list_evaluation_runs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == evaluation_service.ListEvaluationRunsRequest( + request_msg = evaluation_service.ListEvaluationRunsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_evaluation_runs_use_cached_wrapped_rpc(): @@ -9083,9 +9121,15 @@ async def test_list_evaluation_runs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + evaluation_service.ListEvaluationRunsRequest(), + {}, + ], +) async def test_list_evaluation_runs_async( - transport: str = "grpc_asyncio", - request_type=evaluation_service.ListEvaluationRunsRequest, + request_type, transport: str = "grpc_asyncio" ): client = EvaluationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -9094,7 +9138,7 @@ async def test_list_evaluation_runs_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( @@ -9119,11 +9163,6 @@ async def test_list_evaluation_runs_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_evaluation_runs_async_from_dict(): - await test_list_evaluation_runs_async(request_type=dict) - - def test_list_evaluation_runs_field_headers(): client = EvaluationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9476,8 +9515,8 @@ async def test_list_evaluation_runs_async_pages(): @pytest.mark.parametrize( "request_type", [ - evaluation_service.ListEvaluationExpectationsRequest, - dict, + evaluation_service.ListEvaluationExpectationsRequest(), + {}, ], ) def test_list_evaluation_expectations(request_type, transport: str = "grpc"): @@ -9488,7 +9527,7 @@ def test_list_evaluation_expectations(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9539,12 +9578,13 @@ def test_list_evaluation_expectations_non_empty_request_with_auto_populated_fiel client.list_evaluation_expectations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == evaluation_service.ListEvaluationExpectationsRequest( + request_msg = evaluation_service.ListEvaluationExpectationsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_evaluation_expectations_use_cached_wrapped_rpc(): @@ -9630,9 +9670,15 @@ async def test_list_evaluation_expectations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + evaluation_service.ListEvaluationExpectationsRequest(), + {}, + ], +) async def test_list_evaluation_expectations_async( - transport: str = "grpc_asyncio", - request_type=evaluation_service.ListEvaluationExpectationsRequest, + request_type, transport: str = "grpc_asyncio" ): client = EvaluationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -9641,7 +9687,7 @@ async def test_list_evaluation_expectations_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( @@ -9666,11 +9712,6 @@ async def test_list_evaluation_expectations_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_evaluation_expectations_async_from_dict(): - await test_list_evaluation_expectations_async(request_type=dict) - - def test_list_evaluation_expectations_field_headers(): client = EvaluationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10027,8 +10068,8 @@ async def test_list_evaluation_expectations_async_pages(): @pytest.mark.parametrize( "request_type", [ - evaluation_service.GetEvaluationExpectationRequest, - dict, + evaluation_service.GetEvaluationExpectationRequest(), + {}, ], ) def test_get_evaluation_expectation(request_type, transport: str = "grpc"): @@ -10039,7 +10080,7 @@ def test_get_evaluation_expectation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10093,9 +10134,10 @@ def test_get_evaluation_expectation_non_empty_request_with_auto_populated_field( client.get_evaluation_expectation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == evaluation_service.GetEvaluationExpectationRequest( + request_msg = evaluation_service.GetEvaluationExpectationRequest( name="name_value", ) + assert args[0] == request_msg def test_get_evaluation_expectation_use_cached_wrapped_rpc(): @@ -10181,9 +10223,15 @@ async def test_get_evaluation_expectation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + evaluation_service.GetEvaluationExpectationRequest(), + {}, + ], +) async def test_get_evaluation_expectation_async( - transport: str = "grpc_asyncio", - request_type=evaluation_service.GetEvaluationExpectationRequest, + request_type, transport: str = "grpc_asyncio" ): client = EvaluationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -10192,7 +10240,7 @@ async def test_get_evaluation_expectation_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( @@ -10223,11 +10271,6 @@ async def test_get_evaluation_expectation_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_evaluation_expectation_async_from_dict(): - await test_get_evaluation_expectation_async(request_type=dict) - - def test_get_evaluation_expectation_field_headers(): client = EvaluationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10382,8 +10425,8 @@ async def test_get_evaluation_expectation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - evaluation_service.CreateEvaluationExpectationRequest, - dict, + evaluation_service.CreateEvaluationExpectationRequest(), + {}, ], ) def test_create_evaluation_expectation(request_type, transport: str = "grpc"): @@ -10394,7 +10437,7 @@ def test_create_evaluation_expectation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10449,10 +10492,11 @@ def test_create_evaluation_expectation_non_empty_request_with_auto_populated_fie client.create_evaluation_expectation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == evaluation_service.CreateEvaluationExpectationRequest( + request_msg = evaluation_service.CreateEvaluationExpectationRequest( parent="parent_value", evaluation_expectation_id="evaluation_expectation_id_value", ) + assert args[0] == request_msg def test_create_evaluation_expectation_use_cached_wrapped_rpc(): @@ -10538,9 +10582,15 @@ async def test_create_evaluation_expectation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + evaluation_service.CreateEvaluationExpectationRequest(), + {}, + ], +) async def test_create_evaluation_expectation_async( - transport: str = "grpc_asyncio", - request_type=evaluation_service.CreateEvaluationExpectationRequest, + request_type, transport: str = "grpc_asyncio" ): client = EvaluationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -10549,7 +10599,7 @@ async def test_create_evaluation_expectation_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( @@ -10580,11 +10630,6 @@ async def test_create_evaluation_expectation_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_create_evaluation_expectation_async_from_dict(): - await test_create_evaluation_expectation_async(request_type=dict) - - def test_create_evaluation_expectation_field_headers(): client = EvaluationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10783,8 +10828,8 @@ async def test_create_evaluation_expectation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - evaluation_service.UpdateEvaluationExpectationRequest, - dict, + evaluation_service.UpdateEvaluationExpectationRequest(), + {}, ], ) def test_update_evaluation_expectation(request_type, transport: str = "grpc"): @@ -10795,7 +10840,7 @@ def test_update_evaluation_expectation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10847,7 +10892,8 @@ def test_update_evaluation_expectation_non_empty_request_with_auto_populated_fie client.update_evaluation_expectation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == evaluation_service.UpdateEvaluationExpectationRequest() + request_msg = evaluation_service.UpdateEvaluationExpectationRequest() + assert args[0] == request_msg def test_update_evaluation_expectation_use_cached_wrapped_rpc(): @@ -10933,9 +10979,15 @@ async def test_update_evaluation_expectation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + evaluation_service.UpdateEvaluationExpectationRequest(), + {}, + ], +) async def test_update_evaluation_expectation_async( - transport: str = "grpc_asyncio", - request_type=evaluation_service.UpdateEvaluationExpectationRequest, + request_type, transport: str = "grpc_asyncio" ): client = EvaluationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -10944,7 +10996,7 @@ async def test_update_evaluation_expectation_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( @@ -10975,11 +11027,6 @@ async def test_update_evaluation_expectation_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_update_evaluation_expectation_async_from_dict(): - await test_update_evaluation_expectation_async(request_type=dict) - - def test_update_evaluation_expectation_field_headers(): client = EvaluationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11168,8 +11215,8 @@ async def test_update_evaluation_expectation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - evaluation_service.DeleteEvaluationExpectationRequest, - dict, + evaluation_service.DeleteEvaluationExpectationRequest(), + {}, ], ) def test_delete_evaluation_expectation(request_type, transport: str = "grpc"): @@ -11180,7 +11227,7 @@ def test_delete_evaluation_expectation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11226,10 +11273,11 @@ def test_delete_evaluation_expectation_non_empty_request_with_auto_populated_fie client.delete_evaluation_expectation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == evaluation_service.DeleteEvaluationExpectationRequest( + request_msg = evaluation_service.DeleteEvaluationExpectationRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_evaluation_expectation_use_cached_wrapped_rpc(): @@ -11315,9 +11363,15 @@ async def test_delete_evaluation_expectation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + evaluation_service.DeleteEvaluationExpectationRequest(), + {}, + ], +) async def test_delete_evaluation_expectation_async( - transport: str = "grpc_asyncio", - request_type=evaluation_service.DeleteEvaluationExpectationRequest, + request_type, transport: str = "grpc_asyncio" ): client = EvaluationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -11326,7 +11380,7 @@ async def test_delete_evaluation_expectation_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( @@ -11346,11 +11400,6 @@ async def test_delete_evaluation_expectation_async( assert response is None -@pytest.mark.asyncio -async def test_delete_evaluation_expectation_async_from_dict(): - await test_delete_evaluation_expectation_async(request_type=dict) - - def test_delete_evaluation_expectation_field_headers(): client = EvaluationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11501,8 +11550,8 @@ async def test_delete_evaluation_expectation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - evaluation_service.CreateScheduledEvaluationRunRequest, - dict, + evaluation_service.CreateScheduledEvaluationRunRequest(), + {}, ], ) def test_create_scheduled_evaluation_run(request_type, transport: str = "grpc"): @@ -11513,7 +11562,7 @@ def test_create_scheduled_evaluation_run(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11578,10 +11627,11 @@ def test_create_scheduled_evaluation_run_non_empty_request_with_auto_populated_f client.create_scheduled_evaluation_run(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == evaluation_service.CreateScheduledEvaluationRunRequest( + request_msg = evaluation_service.CreateScheduledEvaluationRunRequest( parent="parent_value", scheduled_evaluation_run_id="scheduled_evaluation_run_id_value", ) + assert args[0] == request_msg def test_create_scheduled_evaluation_run_use_cached_wrapped_rpc(): @@ -11667,9 +11717,15 @@ async def test_create_scheduled_evaluation_run_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + evaluation_service.CreateScheduledEvaluationRunRequest(), + {}, + ], +) async def test_create_scheduled_evaluation_run_async( - transport: str = "grpc_asyncio", - request_type=evaluation_service.CreateScheduledEvaluationRunRequest, + request_type, transport: str = "grpc_asyncio" ): client = EvaluationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -11678,7 +11734,7 @@ async def test_create_scheduled_evaluation_run_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( @@ -11719,11 +11775,6 @@ async def test_create_scheduled_evaluation_run_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_create_scheduled_evaluation_run_async_from_dict(): - await test_create_scheduled_evaluation_run_async(request_type=dict) - - def test_create_scheduled_evaluation_run_field_headers(): client = EvaluationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11906,8 +11957,8 @@ async def test_create_scheduled_evaluation_run_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - evaluation_service.GetScheduledEvaluationRunRequest, - dict, + evaluation_service.GetScheduledEvaluationRunRequest(), + {}, ], ) def test_get_scheduled_evaluation_run(request_type, transport: str = "grpc"): @@ -11918,7 +11969,7 @@ def test_get_scheduled_evaluation_run(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11982,9 +12033,10 @@ def test_get_scheduled_evaluation_run_non_empty_request_with_auto_populated_fiel client.get_scheduled_evaluation_run(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == evaluation_service.GetScheduledEvaluationRunRequest( + request_msg = evaluation_service.GetScheduledEvaluationRunRequest( name="name_value", ) + assert args[0] == request_msg def test_get_scheduled_evaluation_run_use_cached_wrapped_rpc(): @@ -12070,9 +12122,15 @@ async def test_get_scheduled_evaluation_run_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + evaluation_service.GetScheduledEvaluationRunRequest(), + {}, + ], +) async def test_get_scheduled_evaluation_run_async( - transport: str = "grpc_asyncio", - request_type=evaluation_service.GetScheduledEvaluationRunRequest, + request_type, transport: str = "grpc_asyncio" ): client = EvaluationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -12081,7 +12139,7 @@ async def test_get_scheduled_evaluation_run_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( @@ -12122,11 +12180,6 @@ async def test_get_scheduled_evaluation_run_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_scheduled_evaluation_run_async_from_dict(): - await test_get_scheduled_evaluation_run_async(request_type=dict) - - def test_get_scheduled_evaluation_run_field_headers(): client = EvaluationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12281,8 +12334,8 @@ async def test_get_scheduled_evaluation_run_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - evaluation_service.ListScheduledEvaluationRunsRequest, - dict, + evaluation_service.ListScheduledEvaluationRunsRequest(), + {}, ], ) def test_list_scheduled_evaluation_runs(request_type, transport: str = "grpc"): @@ -12293,7 +12346,7 @@ def test_list_scheduled_evaluation_runs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -12344,12 +12397,13 @@ def test_list_scheduled_evaluation_runs_non_empty_request_with_auto_populated_fi client.list_scheduled_evaluation_runs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == evaluation_service.ListScheduledEvaluationRunsRequest( + request_msg = evaluation_service.ListScheduledEvaluationRunsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_scheduled_evaluation_runs_use_cached_wrapped_rpc(): @@ -12435,9 +12489,15 @@ async def test_list_scheduled_evaluation_runs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + evaluation_service.ListScheduledEvaluationRunsRequest(), + {}, + ], +) async def test_list_scheduled_evaluation_runs_async( - transport: str = "grpc_asyncio", - request_type=evaluation_service.ListScheduledEvaluationRunsRequest, + request_type, transport: str = "grpc_asyncio" ): client = EvaluationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -12446,7 +12506,7 @@ async def test_list_scheduled_evaluation_runs_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( @@ -12471,11 +12531,6 @@ async def test_list_scheduled_evaluation_runs_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_scheduled_evaluation_runs_async_from_dict(): - await test_list_scheduled_evaluation_runs_async(request_type=dict) - - def test_list_scheduled_evaluation_runs_field_headers(): client = EvaluationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12832,8 +12887,8 @@ async def test_list_scheduled_evaluation_runs_async_pages(): @pytest.mark.parametrize( "request_type", [ - evaluation_service.UpdateScheduledEvaluationRunRequest, - dict, + evaluation_service.UpdateScheduledEvaluationRunRequest(), + {}, ], ) def test_update_scheduled_evaluation_run(request_type, transport: str = "grpc"): @@ -12844,7 +12899,7 @@ def test_update_scheduled_evaluation_run(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -12906,7 +12961,8 @@ def test_update_scheduled_evaluation_run_non_empty_request_with_auto_populated_f client.update_scheduled_evaluation_run(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == evaluation_service.UpdateScheduledEvaluationRunRequest() + request_msg = evaluation_service.UpdateScheduledEvaluationRunRequest() + assert args[0] == request_msg def test_update_scheduled_evaluation_run_use_cached_wrapped_rpc(): @@ -12992,9 +13048,15 @@ async def test_update_scheduled_evaluation_run_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + evaluation_service.UpdateScheduledEvaluationRunRequest(), + {}, + ], +) async def test_update_scheduled_evaluation_run_async( - transport: str = "grpc_asyncio", - request_type=evaluation_service.UpdateScheduledEvaluationRunRequest, + request_type, transport: str = "grpc_asyncio" ): client = EvaluationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -13003,7 +13065,7 @@ async def test_update_scheduled_evaluation_run_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( @@ -13044,11 +13106,6 @@ async def test_update_scheduled_evaluation_run_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_update_scheduled_evaluation_run_async_from_dict(): - await test_update_scheduled_evaluation_run_async(request_type=dict) - - def test_update_scheduled_evaluation_run_field_headers(): client = EvaluationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13221,8 +13278,8 @@ async def test_update_scheduled_evaluation_run_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - evaluation_service.DeleteScheduledEvaluationRunRequest, - dict, + evaluation_service.DeleteScheduledEvaluationRunRequest(), + {}, ], ) def test_delete_scheduled_evaluation_run(request_type, transport: str = "grpc"): @@ -13233,7 +13290,7 @@ def test_delete_scheduled_evaluation_run(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -13279,10 +13336,11 @@ def test_delete_scheduled_evaluation_run_non_empty_request_with_auto_populated_f client.delete_scheduled_evaluation_run(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == evaluation_service.DeleteScheduledEvaluationRunRequest( + request_msg = evaluation_service.DeleteScheduledEvaluationRunRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_scheduled_evaluation_run_use_cached_wrapped_rpc(): @@ -13368,9 +13426,15 @@ async def test_delete_scheduled_evaluation_run_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + evaluation_service.DeleteScheduledEvaluationRunRequest(), + {}, + ], +) async def test_delete_scheduled_evaluation_run_async( - transport: str = "grpc_asyncio", - request_type=evaluation_service.DeleteScheduledEvaluationRunRequest, + request_type, transport: str = "grpc_asyncio" ): client = EvaluationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -13379,7 +13443,7 @@ async def test_delete_scheduled_evaluation_run_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( @@ -13399,11 +13463,6 @@ async def test_delete_scheduled_evaluation_run_async( assert response is None -@pytest.mark.asyncio -async def test_delete_scheduled_evaluation_run_async_from_dict(): - await test_delete_scheduled_evaluation_run_async(request_type=dict) - - def test_delete_scheduled_evaluation_run_field_headers(): client = EvaluationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13554,8 +13613,8 @@ async def test_delete_scheduled_evaluation_run_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - evaluation_service.TestPersonaVoiceRequest, - dict, + evaluation_service.TestPersonaVoiceRequest(), + {}, ], ) def test_test_persona_voice(request_type, transport: str = "grpc"): @@ -13566,7 +13625,7 @@ def test_test_persona_voice(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -13616,11 +13675,12 @@ def test_test_persona_voice_non_empty_request_with_auto_populated_field(): client.test_persona_voice(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == evaluation_service.TestPersonaVoiceRequest( + request_msg = evaluation_service.TestPersonaVoiceRequest( app="app_value", persona_id="persona_id_value", text="text_value", ) + assert args[0] == request_msg def test_test_persona_voice_use_cached_wrapped_rpc(): @@ -13705,10 +13765,14 @@ async def test_test_persona_voice_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_test_persona_voice_async( - transport: str = "grpc_asyncio", - request_type=evaluation_service.TestPersonaVoiceRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + evaluation_service.TestPersonaVoiceRequest(), + {}, + ], +) +async def test_test_persona_voice_async(request_type, transport: str = "grpc_asyncio"): client = EvaluationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13716,7 +13780,7 @@ async def test_test_persona_voice_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( @@ -13741,11 +13805,6 @@ async def test_test_persona_voice_async( assert response.audio == b"audio_blob" -@pytest.mark.asyncio -async def test_test_persona_voice_async_from_dict(): - await test_test_persona_voice_async(request_type=dict) - - def test_test_persona_voice_field_headers(): client = EvaluationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13900,8 +13959,8 @@ async def test_test_persona_voice_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - evaluation_service.ExportEvaluationsRequest, - dict, + evaluation_service.ExportEvaluationsRequest(), + {}, ], ) def test_export_evaluations(request_type, transport: str = "grpc"): @@ -13912,7 +13971,7 @@ def test_export_evaluations(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -13957,9 +14016,10 @@ def test_export_evaluations_non_empty_request_with_auto_populated_field(): client.export_evaluations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == evaluation_service.ExportEvaluationsRequest( + request_msg = evaluation_service.ExportEvaluationsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_export_evaluations_use_cached_wrapped_rpc(): @@ -14054,10 +14114,14 @@ async def test_export_evaluations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_export_evaluations_async( - transport: str = "grpc_asyncio", - request_type=evaluation_service.ExportEvaluationsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + evaluation_service.ExportEvaluationsRequest(), + {}, + ], +) +async def test_export_evaluations_async(request_type, transport: str = "grpc_asyncio"): client = EvaluationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14065,7 +14129,7 @@ async def test_export_evaluations_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( @@ -14087,11 +14151,6 @@ async def test_export_evaluations_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_export_evaluations_async_from_dict(): - await test_export_evaluations_async(request_type=dict) - - def test_export_evaluations_field_headers(): client = EvaluationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -20960,7 +21019,6 @@ def test_run_evaluation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation.RunEvaluationRequest() - assert args[0] == request_msg @@ -20983,7 +21041,6 @@ def test_upload_evaluation_audio_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.UploadEvaluationAudioRequest() - assert args[0] == request_msg @@ -21006,7 +21063,6 @@ def test_create_evaluation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.CreateEvaluationRequest() - assert args[0] == request_msg @@ -21029,7 +21085,6 @@ def test_generate_evaluation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.GenerateEvaluationRequest() - assert args[0] == request_msg @@ -21052,7 +21107,6 @@ def test_import_evaluations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.ImportEvaluationsRequest() - assert args[0] == request_msg @@ -21075,7 +21129,6 @@ def test_create_evaluation_dataset_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.CreateEvaluationDatasetRequest() - assert args[0] == request_msg @@ -21098,7 +21151,6 @@ def test_update_evaluation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.UpdateEvaluationRequest() - assert args[0] == request_msg @@ -21121,7 +21173,6 @@ def test_update_evaluation_dataset_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.UpdateEvaluationDatasetRequest() - assert args[0] == request_msg @@ -21144,7 +21195,6 @@ def test_delete_evaluation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.DeleteEvaluationRequest() - assert args[0] == request_msg @@ -21167,7 +21217,6 @@ def test_delete_evaluation_result_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.DeleteEvaluationResultRequest() - assert args[0] == request_msg @@ -21190,7 +21239,6 @@ def test_delete_evaluation_dataset_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.DeleteEvaluationDatasetRequest() - assert args[0] == request_msg @@ -21213,7 +21261,6 @@ def test_delete_evaluation_run_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.DeleteEvaluationRunRequest() - assert args[0] == request_msg @@ -21234,7 +21281,6 @@ def test_get_evaluation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.GetEvaluationRequest() - assert args[0] == request_msg @@ -21257,7 +21303,6 @@ def test_get_evaluation_result_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.GetEvaluationResultRequest() - assert args[0] == request_msg @@ -21280,7 +21325,6 @@ def test_get_evaluation_dataset_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.GetEvaluationDatasetRequest() - assert args[0] == request_msg @@ -21303,7 +21347,6 @@ def test_get_evaluation_run_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.GetEvaluationRunRequest() - assert args[0] == request_msg @@ -21324,7 +21367,6 @@ def test_list_evaluations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.ListEvaluationsRequest() - assert args[0] == request_msg @@ -21347,7 +21389,6 @@ def test_list_evaluation_results_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.ListEvaluationResultsRequest() - assert args[0] == request_msg @@ -21370,7 +21411,6 @@ def test_list_evaluation_datasets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.ListEvaluationDatasetsRequest() - assert args[0] == request_msg @@ -21393,7 +21433,6 @@ def test_list_evaluation_runs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.ListEvaluationRunsRequest() - assert args[0] == request_msg @@ -21416,7 +21455,6 @@ def test_list_evaluation_expectations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.ListEvaluationExpectationsRequest() - assert args[0] == request_msg @@ -21439,7 +21477,6 @@ def test_get_evaluation_expectation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.GetEvaluationExpectationRequest() - assert args[0] == request_msg @@ -21462,7 +21499,6 @@ def test_create_evaluation_expectation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.CreateEvaluationExpectationRequest() - assert args[0] == request_msg @@ -21485,7 +21521,6 @@ def test_update_evaluation_expectation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.UpdateEvaluationExpectationRequest() - assert args[0] == request_msg @@ -21508,7 +21543,6 @@ def test_delete_evaluation_expectation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.DeleteEvaluationExpectationRequest() - assert args[0] == request_msg @@ -21531,7 +21565,6 @@ def test_create_scheduled_evaluation_run_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.CreateScheduledEvaluationRunRequest() - assert args[0] == request_msg @@ -21554,7 +21587,6 @@ def test_get_scheduled_evaluation_run_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.GetScheduledEvaluationRunRequest() - assert args[0] == request_msg @@ -21577,7 +21609,6 @@ def test_list_scheduled_evaluation_runs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.ListScheduledEvaluationRunsRequest() - assert args[0] == request_msg @@ -21600,7 +21631,6 @@ def test_update_scheduled_evaluation_run_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.UpdateScheduledEvaluationRunRequest() - assert args[0] == request_msg @@ -21623,7 +21653,6 @@ def test_delete_scheduled_evaluation_run_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.DeleteScheduledEvaluationRunRequest() - assert args[0] == request_msg @@ -21646,7 +21675,6 @@ def test_test_persona_voice_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.TestPersonaVoiceRequest() - assert args[0] == request_msg @@ -21669,7 +21697,6 @@ def test_export_evaluations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.ExportEvaluationsRequest() - assert args[0] == request_msg @@ -21708,7 +21735,6 @@ async def test_run_evaluation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation.RunEvaluationRequest() - assert args[0] == request_msg @@ -21738,7 +21764,6 @@ async def test_upload_evaluation_audio_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.UploadEvaluationAudioRequest() - assert args[0] == request_msg @@ -21776,7 +21801,6 @@ async def test_create_evaluation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.CreateEvaluationRequest() - assert args[0] == request_msg @@ -21803,7 +21827,6 @@ async def test_generate_evaluation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.GenerateEvaluationRequest() - assert args[0] == request_msg @@ -21830,7 +21853,6 @@ async def test_import_evaluations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.ImportEvaluationsRequest() - assert args[0] == request_msg @@ -21864,7 +21886,6 @@ async def test_create_evaluation_dataset_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.CreateEvaluationDatasetRequest() - assert args[0] == request_msg @@ -21902,7 +21923,6 @@ async def test_update_evaluation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.UpdateEvaluationRequest() - assert args[0] == request_msg @@ -21936,7 +21956,6 @@ async def test_update_evaluation_dataset_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.UpdateEvaluationDatasetRequest() - assert args[0] == request_msg @@ -21961,7 +21980,6 @@ async def test_delete_evaluation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.DeleteEvaluationRequest() - assert args[0] == request_msg @@ -21986,7 +22004,6 @@ async def test_delete_evaluation_result_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.DeleteEvaluationResultRequest() - assert args[0] == request_msg @@ -22011,7 +22028,6 @@ async def test_delete_evaluation_dataset_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.DeleteEvaluationDatasetRequest() - assert args[0] == request_msg @@ -22038,7 +22054,6 @@ async def test_delete_evaluation_run_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.DeleteEvaluationRunRequest() - assert args[0] == request_msg @@ -22074,7 +22089,6 @@ async def test_get_evaluation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.GetEvaluationRequest() - assert args[0] == request_msg @@ -22112,7 +22126,6 @@ async def test_get_evaluation_result_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.GetEvaluationResultRequest() - assert args[0] == request_msg @@ -22146,7 +22159,6 @@ async def test_get_evaluation_dataset_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.GetEvaluationDatasetRequest() - assert args[0] == request_msg @@ -22188,7 +22200,6 @@ async def test_get_evaluation_run_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.GetEvaluationRunRequest() - assert args[0] == request_msg @@ -22215,7 +22226,6 @@ async def test_list_evaluations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.ListEvaluationsRequest() - assert args[0] == request_msg @@ -22244,7 +22254,6 @@ async def test_list_evaluation_results_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.ListEvaluationResultsRequest() - assert args[0] == request_msg @@ -22273,7 +22282,6 @@ async def test_list_evaluation_datasets_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.ListEvaluationDatasetsRequest() - assert args[0] == request_msg @@ -22302,7 +22310,6 @@ async def test_list_evaluation_runs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.ListEvaluationRunsRequest() - assert args[0] == request_msg @@ -22331,7 +22338,6 @@ async def test_list_evaluation_expectations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.ListEvaluationExpectationsRequest() - assert args[0] == request_msg @@ -22363,7 +22369,6 @@ async def test_get_evaluation_expectation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.GetEvaluationExpectationRequest() - assert args[0] == request_msg @@ -22395,7 +22400,6 @@ async def test_create_evaluation_expectation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.CreateEvaluationExpectationRequest() - assert args[0] == request_msg @@ -22427,7 +22431,6 @@ async def test_update_evaluation_expectation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.UpdateEvaluationExpectationRequest() - assert args[0] == request_msg @@ -22452,7 +22455,6 @@ async def test_delete_evaluation_expectation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.DeleteEvaluationExpectationRequest() - assert args[0] == request_msg @@ -22489,7 +22491,6 @@ async def test_create_scheduled_evaluation_run_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.CreateScheduledEvaluationRunRequest() - assert args[0] == request_msg @@ -22526,7 +22527,6 @@ async def test_get_scheduled_evaluation_run_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.GetScheduledEvaluationRunRequest() - assert args[0] == request_msg @@ -22555,7 +22555,6 @@ async def test_list_scheduled_evaluation_runs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.ListScheduledEvaluationRunsRequest() - assert args[0] == request_msg @@ -22592,7 +22591,6 @@ async def test_update_scheduled_evaluation_run_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.UpdateScheduledEvaluationRunRequest() - assert args[0] == request_msg @@ -22617,7 +22615,6 @@ async def test_delete_scheduled_evaluation_run_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.DeleteScheduledEvaluationRunRequest() - assert args[0] == request_msg @@ -22646,7 +22643,6 @@ async def test_test_persona_voice_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.TestPersonaVoiceRequest() - assert args[0] == request_msg @@ -22673,7 +22669,6 @@ async def test_export_evaluations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.ExportEvaluationsRequest() - assert args[0] == request_msg @@ -28933,7 +28928,6 @@ def test_run_evaluation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation.RunEvaluationRequest() - assert args[0] == request_msg @@ -28955,7 +28949,6 @@ def test_upload_evaluation_audio_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.UploadEvaluationAudioRequest() - assert args[0] == request_msg @@ -28977,7 +28970,6 @@ def test_create_evaluation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.CreateEvaluationRequest() - assert args[0] == request_msg @@ -28999,7 +28991,6 @@ def test_generate_evaluation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.GenerateEvaluationRequest() - assert args[0] == request_msg @@ -29021,7 +29012,6 @@ def test_import_evaluations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.ImportEvaluationsRequest() - assert args[0] == request_msg @@ -29043,7 +29033,6 @@ def test_create_evaluation_dataset_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.CreateEvaluationDatasetRequest() - assert args[0] == request_msg @@ -29065,7 +29054,6 @@ def test_update_evaluation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.UpdateEvaluationRequest() - assert args[0] == request_msg @@ -29087,7 +29075,6 @@ def test_update_evaluation_dataset_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.UpdateEvaluationDatasetRequest() - assert args[0] == request_msg @@ -29109,7 +29096,6 @@ def test_delete_evaluation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.DeleteEvaluationRequest() - assert args[0] == request_msg @@ -29131,7 +29117,6 @@ def test_delete_evaluation_result_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.DeleteEvaluationResultRequest() - assert args[0] == request_msg @@ -29153,7 +29138,6 @@ def test_delete_evaluation_dataset_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.DeleteEvaluationDatasetRequest() - assert args[0] == request_msg @@ -29175,7 +29159,6 @@ def test_delete_evaluation_run_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.DeleteEvaluationRunRequest() - assert args[0] == request_msg @@ -29195,7 +29178,6 @@ def test_get_evaluation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.GetEvaluationRequest() - assert args[0] == request_msg @@ -29217,7 +29199,6 @@ def test_get_evaluation_result_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.GetEvaluationResultRequest() - assert args[0] == request_msg @@ -29239,7 +29220,6 @@ def test_get_evaluation_dataset_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.GetEvaluationDatasetRequest() - assert args[0] == request_msg @@ -29261,7 +29241,6 @@ def test_get_evaluation_run_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.GetEvaluationRunRequest() - assert args[0] == request_msg @@ -29281,7 +29260,6 @@ def test_list_evaluations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.ListEvaluationsRequest() - assert args[0] == request_msg @@ -29303,7 +29281,6 @@ def test_list_evaluation_results_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.ListEvaluationResultsRequest() - assert args[0] == request_msg @@ -29325,7 +29302,6 @@ def test_list_evaluation_datasets_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.ListEvaluationDatasetsRequest() - assert args[0] == request_msg @@ -29347,7 +29323,6 @@ def test_list_evaluation_runs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.ListEvaluationRunsRequest() - assert args[0] == request_msg @@ -29369,7 +29344,6 @@ def test_list_evaluation_expectations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.ListEvaluationExpectationsRequest() - assert args[0] == request_msg @@ -29391,7 +29365,6 @@ def test_get_evaluation_expectation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.GetEvaluationExpectationRequest() - assert args[0] == request_msg @@ -29413,7 +29386,6 @@ def test_create_evaluation_expectation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.CreateEvaluationExpectationRequest() - assert args[0] == request_msg @@ -29435,7 +29407,6 @@ def test_update_evaluation_expectation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.UpdateEvaluationExpectationRequest() - assert args[0] == request_msg @@ -29457,7 +29428,6 @@ def test_delete_evaluation_expectation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.DeleteEvaluationExpectationRequest() - assert args[0] == request_msg @@ -29479,7 +29449,6 @@ def test_create_scheduled_evaluation_run_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.CreateScheduledEvaluationRunRequest() - assert args[0] == request_msg @@ -29501,7 +29470,6 @@ def test_get_scheduled_evaluation_run_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.GetScheduledEvaluationRunRequest() - assert args[0] == request_msg @@ -29523,7 +29491,6 @@ def test_list_scheduled_evaluation_runs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.ListScheduledEvaluationRunsRequest() - assert args[0] == request_msg @@ -29545,7 +29512,6 @@ def test_update_scheduled_evaluation_run_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.UpdateScheduledEvaluationRunRequest() - assert args[0] == request_msg @@ -29567,7 +29533,6 @@ def test_delete_scheduled_evaluation_run_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.DeleteScheduledEvaluationRunRequest() - assert args[0] == request_msg @@ -29589,7 +29554,6 @@ def test_test_persona_voice_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.TestPersonaVoiceRequest() - assert args[0] == request_msg @@ -29611,7 +29575,6 @@ def test_export_evaluations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.ExportEvaluationsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-ces/tests/unit/gapic/ces_v1beta/test_session_service.py b/packages/google-cloud-ces/tests/unit/gapic/ces_v1beta/test_session_service.py index 97221f210049..7d83bb1ee630 100644 --- a/packages/google-cloud-ces/tests/unit/gapic/ces_v1beta/test_session_service.py +++ b/packages/google-cloud-ces/tests/unit/gapic/ces_v1beta/test_session_service.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 @@ -110,6 +111,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" @@ -1316,8 +1332,8 @@ def test_session_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - session_service.RunSessionRequest, - dict, + session_service.RunSessionRequest(), + {}, ], ) def test_run_session(request_type, transport: str = "grpc"): @@ -1328,7 +1344,7 @@ def test_run_session(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.run_session), "__call__") as call: @@ -1367,7 +1383,8 @@ def test_run_session_non_empty_request_with_auto_populated_field(): client.run_session(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == session_service.RunSessionRequest() + request_msg = session_service.RunSessionRequest() + assert args[0] == request_msg def test_run_session_use_cached_wrapped_rpc(): @@ -1448,9 +1465,14 @@ async def test_run_session_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_run_session_async( - transport: str = "grpc_asyncio", request_type=session_service.RunSessionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + session_service.RunSessionRequest(), + {}, + ], +) +async def test_run_session_async(request_type, transport: str = "grpc_asyncio"): client = SessionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1458,7 +1480,7 @@ async def test_run_session_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.run_session), "__call__") as call: @@ -1478,11 +1500,6 @@ async def test_run_session_async( assert isinstance(response, session_service.RunSessionResponse) -@pytest.mark.asyncio -async def test_run_session_async_from_dict(): - await test_run_session_async(request_type=dict) - - def test_run_session_field_headers(): client = SessionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1547,8 +1564,8 @@ async def test_run_session_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - session_service.RunSessionRequest, - dict, + session_service.RunSessionRequest(), + {}, ], ) def test_stream_run_session(request_type, transport: str = "grpc"): @@ -1559,7 +1576,7 @@ def test_stream_run_session(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1603,7 +1620,8 @@ def test_stream_run_session_non_empty_request_with_auto_populated_field(): client.stream_run_session(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == session_service.RunSessionRequest() + request_msg = session_service.RunSessionRequest() + assert args[0] == request_msg def test_stream_run_session_use_cached_wrapped_rpc(): @@ -1688,9 +1706,14 @@ async def test_stream_run_session_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_stream_run_session_async( - transport: str = "grpc_asyncio", request_type=session_service.RunSessionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + session_service.RunSessionRequest(), + {}, + ], +) +async def test_stream_run_session_async(request_type, transport: str = "grpc_asyncio"): client = SessionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1698,7 +1721,7 @@ async def test_stream_run_session_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( @@ -1722,11 +1745,6 @@ async def test_stream_run_session_async( assert isinstance(message, session_service.RunSessionResponse) -@pytest.mark.asyncio -async def test_stream_run_session_async_from_dict(): - await test_stream_run_session_async(request_type=dict) - - def test_stream_run_session_field_headers(): client = SessionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1796,8 +1814,8 @@ async def test_stream_run_session_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - session_service.BidiSessionClientMessage, - dict, + session_service.BidiSessionClientMessage(), + {}, ], ) def test_bidi_run_session(request_type, transport: str = "grpc"): @@ -1808,7 +1826,7 @@ def test_bidi_run_session(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as 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. @@ -1907,10 +1925,14 @@ async def test_bidi_run_session_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_bidi_run_session_async( - transport: str = "grpc_asyncio", - request_type=session_service.BidiSessionClientMessage, -): +@pytest.mark.parametrize( + "request_type", + [ + session_service.BidiSessionClientMessage(), + {}, + ], +) +async def test_bidi_run_session_async(request_type, transport: str = "grpc_asyncio"): client = SessionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1918,7 +1940,7 @@ async def test_bidi_run_session_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. @@ -1940,11 +1962,6 @@ async def test_bidi_run_session_async( assert isinstance(message, session_service.BidiSessionServerMessage) -@pytest.mark.asyncio -async def test_bidi_run_session_async_from_dict(): - await test_bidi_run_session_async(request_type=dict) - - def test_run_session_rest_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, # instead of constructing them on each call @@ -2347,7 +2364,6 @@ def test_run_session_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session_service.RunSessionRequest() - assert args[0] == request_msg @@ -2370,7 +2386,6 @@ def test_stream_run_session_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session_service.RunSessionRequest() - assert args[0] == request_msg @@ -2409,7 +2424,6 @@ async def test_run_session_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session_service.RunSessionRequest() - assert args[0] == request_msg @@ -2437,7 +2451,6 @@ async def test_stream_run_session_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session_service.RunSessionRequest() - assert args[0] == request_msg @@ -3134,7 +3147,6 @@ def test_run_session_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session_service.RunSessionRequest() - assert args[0] == request_msg @@ -3156,7 +3168,6 @@ def test_stream_run_session_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session_service.RunSessionRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-ces/tests/unit/gapic/ces_v1beta/test_tool_service.py b/packages/google-cloud-ces/tests/unit/gapic/ces_v1beta/test_tool_service.py index 222c422b3553..91b7ed58b66b 100644 --- a/packages/google-cloud-ces/tests/unit/gapic/ces_v1beta/test_tool_service.py +++ b/packages/google-cloud-ces/tests/unit/gapic/ces_v1beta/test_tool_service.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 @@ -116,6 +117,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" @@ -1284,8 +1300,8 @@ def test_tool_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - tool_service.ExecuteToolRequest, - dict, + tool_service.ExecuteToolRequest(), + {}, ], ) def test_execute_tool(request_type, transport: str = "grpc"): @@ -1296,7 +1312,7 @@ def test_execute_tool(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.execute_tool), "__call__") as call: @@ -1340,10 +1356,11 @@ def test_execute_tool_non_empty_request_with_auto_populated_field(): client.execute_tool(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tool_service.ExecuteToolRequest( + request_msg = tool_service.ExecuteToolRequest( tool="tool_value", parent="parent_value", ) + assert args[0] == request_msg def test_execute_tool_use_cached_wrapped_rpc(): @@ -1424,9 +1441,14 @@ async def test_execute_tool_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_execute_tool_async( - transport: str = "grpc_asyncio", request_type=tool_service.ExecuteToolRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tool_service.ExecuteToolRequest(), + {}, + ], +) +async def test_execute_tool_async(request_type, transport: str = "grpc_asyncio"): client = ToolServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1434,7 +1456,7 @@ async def test_execute_tool_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.execute_tool), "__call__") as call: @@ -1454,11 +1476,6 @@ async def test_execute_tool_async( assert isinstance(response, tool_service.ExecuteToolResponse) -@pytest.mark.asyncio -async def test_execute_tool_async_from_dict(): - await test_execute_tool_async(request_type=dict) - - def test_execute_tool_field_headers(): client = ToolServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1523,8 +1540,8 @@ async def test_execute_tool_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - tool_service.RetrieveToolSchemaRequest, - dict, + tool_service.RetrieveToolSchemaRequest(), + {}, ], ) def test_retrieve_tool_schema(request_type, transport: str = "grpc"): @@ -1535,7 +1552,7 @@ def test_retrieve_tool_schema(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1583,10 +1600,11 @@ def test_retrieve_tool_schema_non_empty_request_with_auto_populated_field(): client.retrieve_tool_schema(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tool_service.RetrieveToolSchemaRequest( + request_msg = tool_service.RetrieveToolSchemaRequest( tool="tool_value", parent="parent_value", ) + assert args[0] == request_msg def test_retrieve_tool_schema_use_cached_wrapped_rpc(): @@ -1671,8 +1689,15 @@ async def test_retrieve_tool_schema_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + tool_service.RetrieveToolSchemaRequest(), + {}, + ], +) async def test_retrieve_tool_schema_async( - transport: str = "grpc_asyncio", request_type=tool_service.RetrieveToolSchemaRequest + request_type, transport: str = "grpc_asyncio" ): client = ToolServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1681,7 +1706,7 @@ async def test_retrieve_tool_schema_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( @@ -1703,11 +1728,6 @@ async def test_retrieve_tool_schema_async( assert isinstance(response, tool_service.RetrieveToolSchemaResponse) -@pytest.mark.asyncio -async def test_retrieve_tool_schema_async_from_dict(): - await test_retrieve_tool_schema_async(request_type=dict) - - def test_retrieve_tool_schema_field_headers(): client = ToolServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1776,8 +1796,8 @@ async def test_retrieve_tool_schema_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - tool_service.RetrieveToolsRequest, - dict, + tool_service.RetrieveToolsRequest(), + {}, ], ) def test_retrieve_tools(request_type, transport: str = "grpc"): @@ -1788,7 +1808,7 @@ def test_retrieve_tools(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.retrieve_tools), "__call__") as call: @@ -1829,9 +1849,10 @@ def test_retrieve_tools_non_empty_request_with_auto_populated_field(): client.retrieve_tools(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tool_service.RetrieveToolsRequest( + request_msg = tool_service.RetrieveToolsRequest( toolset="toolset_value", ) + assert args[0] == request_msg def test_retrieve_tools_use_cached_wrapped_rpc(): @@ -1912,9 +1933,14 @@ async def test_retrieve_tools_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_retrieve_tools_async( - transport: str = "grpc_asyncio", request_type=tool_service.RetrieveToolsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tool_service.RetrieveToolsRequest(), + {}, + ], +) +async def test_retrieve_tools_async(request_type, transport: str = "grpc_asyncio"): client = ToolServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1922,7 +1948,7 @@ async def test_retrieve_tools_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.retrieve_tools), "__call__") as call: @@ -1942,11 +1968,6 @@ async def test_retrieve_tools_async( assert isinstance(response, tool_service.RetrieveToolsResponse) -@pytest.mark.asyncio -async def test_retrieve_tools_async_from_dict(): - await test_retrieve_tools_async(request_type=dict) - - def test_retrieve_tools_field_headers(): client = ToolServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2498,7 +2519,6 @@ def test_execute_tool_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool_service.ExecuteToolRequest() - assert args[0] == request_msg @@ -2521,7 +2541,6 @@ def test_retrieve_tool_schema_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool_service.RetrieveToolSchemaRequest() - assert args[0] == request_msg @@ -2542,7 +2561,6 @@ def test_retrieve_tools_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool_service.RetrieveToolsRequest() - assert args[0] == request_msg @@ -2581,7 +2599,6 @@ async def test_execute_tool_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool_service.ExecuteToolRequest() - assert args[0] == request_msg @@ -2608,7 +2625,6 @@ async def test_retrieve_tool_schema_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool_service.RetrieveToolSchemaRequest() - assert args[0] == request_msg @@ -2633,7 +2649,6 @@ async def test_retrieve_tools_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool_service.RetrieveToolsRequest() - assert args[0] == request_msg @@ -3438,7 +3453,6 @@ def test_execute_tool_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool_service.ExecuteToolRequest() - assert args[0] == request_msg @@ -3460,7 +3474,6 @@ def test_retrieve_tool_schema_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool_service.RetrieveToolSchemaRequest() - assert args[0] == request_msg @@ -3480,7 +3493,6 @@ def test_retrieve_tools_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool_service.RetrieveToolsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-ces/tests/unit/gapic/ces_v1beta/test_widget_service.py b/packages/google-cloud-ces/tests/unit/gapic/ces_v1beta/test_widget_service.py index 09c0165e783b..126b752c9508 100644 --- a/packages/google-cloud-ces/tests/unit/gapic/ces_v1beta/test_widget_service.py +++ b/packages/google-cloud-ces/tests/unit/gapic/ces_v1beta/test_widget_service.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 @@ -109,6 +110,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" @@ -1311,8 +1327,8 @@ def test_widget_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - widget_service.GenerateChatTokenRequest, - dict, + widget_service.GenerateChatTokenRequest(), + {}, ], ) def test_generate_chat_token(request_type, transport: str = "grpc"): @@ -1323,7 +1339,7 @@ def test_generate_chat_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( @@ -1373,11 +1389,12 @@ def test_generate_chat_token_non_empty_request_with_auto_populated_field(): client.generate_chat_token(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == widget_service.GenerateChatTokenRequest( + request_msg = widget_service.GenerateChatTokenRequest( name="name_value", deployment="deployment_value", recaptcha_token="recaptcha_token_value", ) + assert args[0] == request_msg def test_generate_chat_token_use_cached_wrapped_rpc(): @@ -1462,10 +1479,14 @@ async def test_generate_chat_token_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_generate_chat_token_async( - transport: str = "grpc_asyncio", - request_type=widget_service.GenerateChatTokenRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + widget_service.GenerateChatTokenRequest(), + {}, + ], +) +async def test_generate_chat_token_async(request_type, transport: str = "grpc_asyncio"): client = WidgetServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1473,7 +1494,7 @@ async def test_generate_chat_token_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( @@ -1498,11 +1519,6 @@ async def test_generate_chat_token_async( assert response.chat_token == "chat_token_value" -@pytest.mark.asyncio -async def test_generate_chat_token_async_from_dict(): - await test_generate_chat_token_async(request_type=dict) - - def test_generate_chat_token_field_headers(): client = WidgetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1830,7 +1846,6 @@ def test_generate_chat_token_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = widget_service.GenerateChatTokenRequest() - assert args[0] == request_msg @@ -1873,7 +1888,6 @@ async def test_generate_chat_token_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = widget_service.GenerateChatTokenRequest() - assert args[0] == request_msg @@ -2423,7 +2437,6 @@ def test_generate_chat_token_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = widget_service.GenerateChatTokenRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-channel/noxfile.py b/packages/google-cloud-channel/noxfile.py index 20439fa3b87c..026a1cb20eec 100644 --- a/packages/google-cloud-channel/noxfile.py +++ b/packages/google-cloud-channel/noxfile.py @@ -47,7 +47,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-channel" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-channel/setup.py b/packages/google-cloud-channel/setup.py index c31d4ca50ef6..9e84aea01f00 100644 --- a/packages/google-cloud-channel/setup.py +++ b/packages/google-cloud-channel/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/google-cloud-channel/testing/constraints-3.10.txt b/packages/google-cloud-channel/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-channel/testing/constraints-3.10.txt +++ b/packages/google-cloud-channel/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-channel/tests/unit/gapic/channel_v1/test_cloud_channel_reports_service.py b/packages/google-cloud-channel/tests/unit/gapic/channel_v1/test_cloud_channel_reports_service.py index 6462da285e46..a9d093bec4d5 100644 --- a/packages/google-cloud-channel/tests/unit/gapic/channel_v1/test_cloud_channel_reports_service.py +++ b/packages/google-cloud-channel/tests/unit/gapic/channel_v1/test_cloud_channel_reports_service.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" @@ -1368,8 +1384,8 @@ def test_cloud_channel_reports_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - reports_service.RunReportJobRequest, - dict, + reports_service.RunReportJobRequest(), + {}, ], ) def test_run_report_job(request_type, transport: str = "grpc"): @@ -1380,7 +1396,7 @@ def test_run_report_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(type(client.transport.run_report_job), "__call__") as call: @@ -1423,11 +1439,12 @@ def test_run_report_job_non_empty_request_with_auto_populated_field(): client.run_report_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == reports_service.RunReportJobRequest( + request_msg = reports_service.RunReportJobRequest( name="name_value", filter="filter_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_run_report_job_use_cached_wrapped_rpc(): @@ -1518,9 +1535,14 @@ async def test_run_report_job_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_run_report_job_async( - transport: str = "grpc_asyncio", request_type=reports_service.RunReportJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + reports_service.RunReportJobRequest(), + {}, + ], +) +async def test_run_report_job_async(request_type, transport: str = "grpc_asyncio"): client = CloudChannelReportsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1528,7 +1550,7 @@ async def test_run_report_job_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.run_report_job), "__call__") as call: @@ -1548,11 +1570,6 @@ async def test_run_report_job_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_run_report_job_async_from_dict(): - await test_run_report_job_async(request_type=dict) - - def test_run_report_job_field_headers(): client = CloudChannelReportsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1617,8 +1634,8 @@ async def test_run_report_job_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - reports_service.FetchReportResultsRequest, - dict, + reports_service.FetchReportResultsRequest(), + {}, ], ) def test_fetch_report_results(request_type, transport: str = "grpc"): @@ -1629,7 +1646,7 @@ def test_fetch_report_results(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1678,10 +1695,11 @@ def test_fetch_report_results_non_empty_request_with_auto_populated_field(): client.fetch_report_results(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == reports_service.FetchReportResultsRequest( + request_msg = reports_service.FetchReportResultsRequest( report_job="report_job_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_fetch_report_results_use_cached_wrapped_rpc(): @@ -1766,9 +1784,15 @@ async def test_fetch_report_results_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + reports_service.FetchReportResultsRequest(), + {}, + ], +) async def test_fetch_report_results_async( - transport: str = "grpc_asyncio", - request_type=reports_service.FetchReportResultsRequest, + request_type, transport: str = "grpc_asyncio" ): client = CloudChannelReportsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1777,7 +1801,7 @@ async def test_fetch_report_results_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( @@ -1802,11 +1826,6 @@ async def test_fetch_report_results_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_fetch_report_results_async_from_dict(): - await test_fetch_report_results_async(request_type=dict) - - def test_fetch_report_results_field_headers(): client = CloudChannelReportsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2159,8 +2178,8 @@ async def test_fetch_report_results_async_pages(): @pytest.mark.parametrize( "request_type", [ - reports_service.ListReportsRequest, - dict, + reports_service.ListReportsRequest(), + {}, ], ) def test_list_reports(request_type, transport: str = "grpc"): @@ -2171,7 +2190,7 @@ def test_list_reports(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_reports), "__call__") as call: @@ -2217,11 +2236,12 @@ def test_list_reports_non_empty_request_with_auto_populated_field(): client.list_reports(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == reports_service.ListReportsRequest( + request_msg = reports_service.ListReportsRequest( parent="parent_value", page_token="page_token_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_list_reports_use_cached_wrapped_rpc(): @@ -2302,9 +2322,14 @@ async def test_list_reports_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_reports_async( - transport: str = "grpc_asyncio", request_type=reports_service.ListReportsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + reports_service.ListReportsRequest(), + {}, + ], +) +async def test_list_reports_async(request_type, transport: str = "grpc_asyncio"): client = CloudChannelReportsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2312,7 +2337,7 @@ async def test_list_reports_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_reports), "__call__") as call: @@ -2335,11 +2360,6 @@ async def test_list_reports_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_reports_async_from_dict(): - await test_list_reports_async(request_type=dict) - - def test_list_reports_field_headers(): client = CloudChannelReportsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2795,7 +2815,6 @@ def test_run_report_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reports_service.RunReportJobRequest() - assert args[0] == request_msg @@ -2818,7 +2837,6 @@ def test_fetch_report_results_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reports_service.FetchReportResultsRequest() - assert args[0] == request_msg @@ -2839,7 +2857,6 @@ def test_list_reports_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reports_service.ListReportsRequest() - assert args[0] == request_msg @@ -2878,7 +2895,6 @@ async def test_run_report_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reports_service.RunReportJobRequest() - assert args[0] == request_msg @@ -2907,7 +2923,6 @@ async def test_fetch_report_results_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reports_service.FetchReportResultsRequest() - assert args[0] == request_msg @@ -2934,7 +2949,6 @@ async def test_list_reports_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reports_service.ListReportsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-channel/tests/unit/gapic/channel_v1/test_cloud_channel_service.py b/packages/google-cloud-channel/tests/unit/gapic/channel_v1/test_cloud_channel_service.py index f07bbdac87b2..df935c0e17f5 100644 --- a/packages/google-cloud-channel/tests/unit/gapic/channel_v1/test_cloud_channel_service.py +++ b/packages/google-cloud-channel/tests/unit/gapic/channel_v1/test_cloud_channel_service.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 @@ -127,6 +128,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" @@ -1350,8 +1366,8 @@ def test_cloud_channel_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - service.ListCustomersRequest, - dict, + service.ListCustomersRequest(), + {}, ], ) def test_list_customers(request_type, transport: str = "grpc"): @@ -1362,7 +1378,7 @@ def test_list_customers(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_customers), "__call__") as call: @@ -1408,11 +1424,12 @@ def test_list_customers_non_empty_request_with_auto_populated_field(): client.list_customers(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListCustomersRequest( + request_msg = service.ListCustomersRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_customers_use_cached_wrapped_rpc(): @@ -1493,9 +1510,14 @@ async def test_list_customers_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_customers_async( - transport: str = "grpc_asyncio", request_type=service.ListCustomersRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListCustomersRequest(), + {}, + ], +) +async def test_list_customers_async(request_type, transport: str = "grpc_asyncio"): client = CloudChannelServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1503,7 +1525,7 @@ async def test_list_customers_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_customers), "__call__") as call: @@ -1526,11 +1548,6 @@ async def test_list_customers_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_customers_async_from_dict(): - await test_list_customers_async(request_type=dict) - - def test_list_customers_field_headers(): client = CloudChannelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1785,8 +1802,8 @@ async def test_list_customers_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetCustomerRequest, - dict, + service.GetCustomerRequest(), + {}, ], ) def test_get_customer(request_type, transport: str = "grpc"): @@ -1797,7 +1814,7 @@ def test_get_customer(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_customer), "__call__") as call: @@ -1860,9 +1877,10 @@ def test_get_customer_non_empty_request_with_auto_populated_field(): client.get_customer(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetCustomerRequest( + request_msg = service.GetCustomerRequest( name="name_value", ) + assert args[0] == request_msg def test_get_customer_use_cached_wrapped_rpc(): @@ -1943,9 +1961,14 @@ async def test_get_customer_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_customer_async( - transport: str = "grpc_asyncio", request_type=service.GetCustomerRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetCustomerRequest(), + {}, + ], +) +async def test_get_customer_async(request_type, transport: str = "grpc_asyncio"): client = CloudChannelServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1953,7 +1976,7 @@ async def test_get_customer_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_customer), "__call__") as call: @@ -1995,11 +2018,6 @@ async def test_get_customer_async( ) -@pytest.mark.asyncio -async def test_get_customer_async_from_dict(): - await test_get_customer_async(request_type=dict) - - def test_get_customer_field_headers(): client = CloudChannelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2142,8 +2160,8 @@ async def test_get_customer_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.CheckCloudIdentityAccountsExistRequest, - dict, + service.CheckCloudIdentityAccountsExistRequest(), + {}, ], ) def test_check_cloud_identity_accounts_exist(request_type, transport: str = "grpc"): @@ -2154,7 +2172,7 @@ def test_check_cloud_identity_accounts_exist(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( @@ -2201,11 +2219,12 @@ def test_check_cloud_identity_accounts_exist_non_empty_request_with_auto_populat client.check_cloud_identity_accounts_exist(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CheckCloudIdentityAccountsExistRequest( + request_msg = service.CheckCloudIdentityAccountsExistRequest( parent="parent_value", domain="domain_value", primary_admin_email="primary_admin_email_value", ) + assert args[0] == request_msg def test_check_cloud_identity_accounts_exist_use_cached_wrapped_rpc(): @@ -2291,9 +2310,15 @@ async def test_check_cloud_identity_accounts_exist_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.CheckCloudIdentityAccountsExistRequest(), + {}, + ], +) async def test_check_cloud_identity_accounts_exist_async( - transport: str = "grpc_asyncio", - request_type=service.CheckCloudIdentityAccountsExistRequest, + request_type, transport: str = "grpc_asyncio" ): client = CloudChannelServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2302,7 +2327,7 @@ async def test_check_cloud_identity_accounts_exist_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( @@ -2324,11 +2349,6 @@ async def test_check_cloud_identity_accounts_exist_async( assert isinstance(response, service.CheckCloudIdentityAccountsExistResponse) -@pytest.mark.asyncio -async def test_check_cloud_identity_accounts_exist_async_from_dict(): - await test_check_cloud_identity_accounts_exist_async(request_type=dict) - - def test_check_cloud_identity_accounts_exist_field_headers(): client = CloudChannelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2397,8 +2417,8 @@ async def test_check_cloud_identity_accounts_exist_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.CreateCustomerRequest, - dict, + service.CreateCustomerRequest(), + {}, ], ) def test_create_customer(request_type, transport: str = "grpc"): @@ -2409,7 +2429,7 @@ def test_create_customer(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_customer), "__call__") as call: @@ -2472,9 +2492,10 @@ def test_create_customer_non_empty_request_with_auto_populated_field(): client.create_customer(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateCustomerRequest( + request_msg = service.CreateCustomerRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_customer_use_cached_wrapped_rpc(): @@ -2555,9 +2576,14 @@ async def test_create_customer_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_customer_async( - transport: str = "grpc_asyncio", request_type=service.CreateCustomerRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CreateCustomerRequest(), + {}, + ], +) +async def test_create_customer_async(request_type, transport: str = "grpc_asyncio"): client = CloudChannelServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2565,7 +2591,7 @@ async def test_create_customer_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_customer), "__call__") as call: @@ -2607,11 +2633,6 @@ async def test_create_customer_async( ) -@pytest.mark.asyncio -async def test_create_customer_async_from_dict(): - await test_create_customer_async(request_type=dict) - - def test_create_customer_field_headers(): client = CloudChannelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2674,8 +2695,8 @@ async def test_create_customer_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdateCustomerRequest, - dict, + service.UpdateCustomerRequest(), + {}, ], ) def test_update_customer(request_type, transport: str = "grpc"): @@ -2686,7 +2707,7 @@ def test_update_customer(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_customer), "__call__") as call: @@ -2747,7 +2768,8 @@ def test_update_customer_non_empty_request_with_auto_populated_field(): client.update_customer(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateCustomerRequest() + request_msg = service.UpdateCustomerRequest() + assert args[0] == request_msg def test_update_customer_use_cached_wrapped_rpc(): @@ -2828,9 +2850,14 @@ async def test_update_customer_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_customer_async( - transport: str = "grpc_asyncio", request_type=service.UpdateCustomerRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateCustomerRequest(), + {}, + ], +) +async def test_update_customer_async(request_type, transport: str = "grpc_asyncio"): client = CloudChannelServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2838,7 +2865,7 @@ async def test_update_customer_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_customer), "__call__") as call: @@ -2880,11 +2907,6 @@ async def test_update_customer_async( ) -@pytest.mark.asyncio -async def test_update_customer_async_from_dict(): - await test_update_customer_async(request_type=dict) - - def test_update_customer_field_headers(): client = CloudChannelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2947,8 +2969,8 @@ async def test_update_customer_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.DeleteCustomerRequest, - dict, + service.DeleteCustomerRequest(), + {}, ], ) def test_delete_customer(request_type, transport: str = "grpc"): @@ -2959,7 +2981,7 @@ def test_delete_customer(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_customer), "__call__") as call: @@ -3000,9 +3022,10 @@ def test_delete_customer_non_empty_request_with_auto_populated_field(): client.delete_customer(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteCustomerRequest( + request_msg = service.DeleteCustomerRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_customer_use_cached_wrapped_rpc(): @@ -3083,9 +3106,14 @@ async def test_delete_customer_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_customer_async( - transport: str = "grpc_asyncio", request_type=service.DeleteCustomerRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteCustomerRequest(), + {}, + ], +) +async def test_delete_customer_async(request_type, transport: str = "grpc_asyncio"): client = CloudChannelServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3093,7 +3121,7 @@ async def test_delete_customer_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_customer), "__call__") as call: @@ -3111,11 +3139,6 @@ async def test_delete_customer_async( assert response is None -@pytest.mark.asyncio -async def test_delete_customer_async_from_dict(): - await test_delete_customer_async(request_type=dict) - - def test_delete_customer_field_headers(): client = CloudChannelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3258,8 +3281,8 @@ async def test_delete_customer_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ImportCustomerRequest, - dict, + service.ImportCustomerRequest(), + {}, ], ) def test_import_customer(request_type, transport: str = "grpc"): @@ -3270,7 +3293,7 @@ def test_import_customer(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.import_customer), "__call__") as call: @@ -3339,7 +3362,7 @@ def test_import_customer_non_empty_request_with_auto_populated_field(): client.import_customer(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ImportCustomerRequest( + request_msg = service.ImportCustomerRequest( domain="domain_value", cloud_identity_id="cloud_identity_id_value", primary_admin_email="primary_admin_email_value", @@ -3348,6 +3371,7 @@ def test_import_customer_non_empty_request_with_auto_populated_field(): channel_partner_id="channel_partner_id_value", customer="customer_value", ) + assert args[0] == request_msg def test_import_customer_use_cached_wrapped_rpc(): @@ -3428,9 +3452,14 @@ async def test_import_customer_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_import_customer_async( - transport: str = "grpc_asyncio", request_type=service.ImportCustomerRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ImportCustomerRequest(), + {}, + ], +) +async def test_import_customer_async(request_type, transport: str = "grpc_asyncio"): client = CloudChannelServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3438,7 +3467,7 @@ async def test_import_customer_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.import_customer), "__call__") as call: @@ -3480,11 +3509,6 @@ async def test_import_customer_async( ) -@pytest.mark.asyncio -async def test_import_customer_async_from_dict(): - await test_import_customer_async(request_type=dict) - - def test_import_customer_field_headers(): client = CloudChannelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3547,8 +3571,8 @@ async def test_import_customer_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.ProvisionCloudIdentityRequest, - dict, + service.ProvisionCloudIdentityRequest(), + {}, ], ) def test_provision_cloud_identity(request_type, transport: str = "grpc"): @@ -3559,7 +3583,7 @@ def test_provision_cloud_identity(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3604,9 +3628,10 @@ def test_provision_cloud_identity_non_empty_request_with_auto_populated_field(): client.provision_cloud_identity(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ProvisionCloudIdentityRequest( + request_msg = service.ProvisionCloudIdentityRequest( customer="customer_value", ) + assert args[0] == request_msg def test_provision_cloud_identity_use_cached_wrapped_rpc(): @@ -3702,8 +3727,15 @@ async def test_provision_cloud_identity_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.ProvisionCloudIdentityRequest(), + {}, + ], +) async def test_provision_cloud_identity_async( - transport: str = "grpc_asyncio", request_type=service.ProvisionCloudIdentityRequest + request_type, transport: str = "grpc_asyncio" ): client = CloudChannelServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3712,7 +3744,7 @@ async def test_provision_cloud_identity_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( @@ -3734,11 +3766,6 @@ async def test_provision_cloud_identity_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_provision_cloud_identity_async_from_dict(): - await test_provision_cloud_identity_async(request_type=dict) - - def test_provision_cloud_identity_field_headers(): client = CloudChannelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3807,8 +3834,8 @@ async def test_provision_cloud_identity_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.ListEntitlementsRequest, - dict, + service.ListEntitlementsRequest(), + {}, ], ) def test_list_entitlements(request_type, transport: str = "grpc"): @@ -3819,7 +3846,7 @@ def test_list_entitlements(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3868,10 +3895,11 @@ def test_list_entitlements_non_empty_request_with_auto_populated_field(): client.list_entitlements(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListEntitlementsRequest( + request_msg = service.ListEntitlementsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_entitlements_use_cached_wrapped_rpc(): @@ -3954,9 +3982,14 @@ async def test_list_entitlements_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_entitlements_async( - transport: str = "grpc_asyncio", request_type=service.ListEntitlementsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListEntitlementsRequest(), + {}, + ], +) +async def test_list_entitlements_async(request_type, transport: str = "grpc_asyncio"): client = CloudChannelServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3964,7 +3997,7 @@ async def test_list_entitlements_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( @@ -3989,11 +4022,6 @@ async def test_list_entitlements_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_entitlements_async_from_dict(): - await test_list_entitlements_async(request_type=dict) - - def test_list_entitlements_field_headers(): client = CloudChannelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4260,8 +4288,8 @@ async def test_list_entitlements_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.ListTransferableSkusRequest, - dict, + service.ListTransferableSkusRequest(), + {}, ], ) def test_list_transferable_skus(request_type, transport: str = "grpc"): @@ -4272,7 +4300,7 @@ def test_list_transferable_skus(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4325,7 +4353,7 @@ def test_list_transferable_skus_non_empty_request_with_auto_populated_field(): client.list_transferable_skus(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListTransferableSkusRequest( + request_msg = service.ListTransferableSkusRequest( cloud_identity_id="cloud_identity_id_value", customer_name="customer_name_value", parent="parent_value", @@ -4333,6 +4361,7 @@ def test_list_transferable_skus_non_empty_request_with_auto_populated_field(): auth_token="auth_token_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_list_transferable_skus_use_cached_wrapped_rpc(): @@ -4418,8 +4447,15 @@ async def test_list_transferable_skus_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.ListTransferableSkusRequest(), + {}, + ], +) async def test_list_transferable_skus_async( - transport: str = "grpc_asyncio", request_type=service.ListTransferableSkusRequest + request_type, transport: str = "grpc_asyncio" ): client = CloudChannelServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4428,7 +4464,7 @@ async def test_list_transferable_skus_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( @@ -4453,11 +4489,6 @@ async def test_list_transferable_skus_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_transferable_skus_async_from_dict(): - await test_list_transferable_skus_async(request_type=dict) - - def test_list_transferable_skus_field_headers(): client = CloudChannelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4724,8 +4755,8 @@ async def test_list_transferable_skus_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.ListTransferableOffersRequest, - dict, + service.ListTransferableOffersRequest(), + {}, ], ) def test_list_transferable_offers(request_type, transport: str = "grpc"): @@ -4736,7 +4767,7 @@ def test_list_transferable_offers(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4790,7 +4821,7 @@ def test_list_transferable_offers_non_empty_request_with_auto_populated_field(): client.list_transferable_offers(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListTransferableOffersRequest( + request_msg = service.ListTransferableOffersRequest( cloud_identity_id="cloud_identity_id_value", customer_name="customer_name_value", parent="parent_value", @@ -4799,6 +4830,7 @@ def test_list_transferable_offers_non_empty_request_with_auto_populated_field(): language_code="language_code_value", billing_account="billing_account_value", ) + assert args[0] == request_msg def test_list_transferable_offers_use_cached_wrapped_rpc(): @@ -4884,8 +4916,15 @@ async def test_list_transferable_offers_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.ListTransferableOffersRequest(), + {}, + ], +) async def test_list_transferable_offers_async( - transport: str = "grpc_asyncio", request_type=service.ListTransferableOffersRequest + request_type, transport: str = "grpc_asyncio" ): client = CloudChannelServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4894,7 +4933,7 @@ async def test_list_transferable_offers_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( @@ -4919,11 +4958,6 @@ async def test_list_transferable_offers_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_transferable_offers_async_from_dict(): - await test_list_transferable_offers_async(request_type=dict) - - def test_list_transferable_offers_field_headers(): client = CloudChannelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5192,8 +5226,8 @@ async def test_list_transferable_offers_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetEntitlementRequest, - dict, + service.GetEntitlementRequest(), + {}, ], ) def test_get_entitlement(request_type, transport: str = "grpc"): @@ -5204,7 +5238,7 @@ def test_get_entitlement(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_entitlement), "__call__") as call: @@ -5266,9 +5300,10 @@ def test_get_entitlement_non_empty_request_with_auto_populated_field(): client.get_entitlement(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetEntitlementRequest( + request_msg = service.GetEntitlementRequest( name="name_value", ) + assert args[0] == request_msg def test_get_entitlement_use_cached_wrapped_rpc(): @@ -5349,9 +5384,14 @@ async def test_get_entitlement_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_entitlement_async( - transport: str = "grpc_asyncio", request_type=service.GetEntitlementRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetEntitlementRequest(), + {}, + ], +) +async def test_get_entitlement_async(request_type, transport: str = "grpc_asyncio"): client = CloudChannelServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5359,7 +5399,7 @@ async def test_get_entitlement_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_entitlement), "__call__") as call: @@ -5400,11 +5440,6 @@ async def test_get_entitlement_async( assert response.price_reference_id == "price_reference_id_value" -@pytest.mark.asyncio -async def test_get_entitlement_async_from_dict(): - await test_get_entitlement_async(request_type=dict) - - def test_get_entitlement_field_headers(): client = CloudChannelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5469,8 +5504,8 @@ async def test_get_entitlement_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.CreateEntitlementRequest, - dict, + service.CreateEntitlementRequest(), + {}, ], ) def test_create_entitlement(request_type, transport: str = "grpc"): @@ -5481,7 +5516,7 @@ def test_create_entitlement(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5527,10 +5562,11 @@ def test_create_entitlement_non_empty_request_with_auto_populated_field(): client.create_entitlement(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateEntitlementRequest( + request_msg = service.CreateEntitlementRequest( parent="parent_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_entitlement_use_cached_wrapped_rpc(): @@ -5625,9 +5661,14 @@ async def test_create_entitlement_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_entitlement_async( - transport: str = "grpc_asyncio", request_type=service.CreateEntitlementRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CreateEntitlementRequest(), + {}, + ], +) +async def test_create_entitlement_async(request_type, transport: str = "grpc_asyncio"): client = CloudChannelServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5635,7 +5676,7 @@ async def test_create_entitlement_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( @@ -5657,11 +5698,6 @@ async def test_create_entitlement_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_entitlement_async_from_dict(): - await test_create_entitlement_async(request_type=dict) - - def test_create_entitlement_field_headers(): client = CloudChannelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5730,8 +5766,8 @@ async def test_create_entitlement_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.ChangeParametersRequest, - dict, + service.ChangeParametersRequest(), + {}, ], ) def test_change_parameters(request_type, transport: str = "grpc"): @@ -5742,7 +5778,7 @@ def test_change_parameters(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5789,11 +5825,12 @@ def test_change_parameters_non_empty_request_with_auto_populated_field(): client.change_parameters(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ChangeParametersRequest( + request_msg = service.ChangeParametersRequest( name="name_value", request_id="request_id_value", purchase_order_id="purchase_order_id_value", ) + assert args[0] == request_msg def test_change_parameters_use_cached_wrapped_rpc(): @@ -5886,9 +5923,14 @@ async def test_change_parameters_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_change_parameters_async( - transport: str = "grpc_asyncio", request_type=service.ChangeParametersRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ChangeParametersRequest(), + {}, + ], +) +async def test_change_parameters_async(request_type, transport: str = "grpc_asyncio"): client = CloudChannelServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5896,7 +5938,7 @@ async def test_change_parameters_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( @@ -5918,11 +5960,6 @@ async def test_change_parameters_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_change_parameters_async_from_dict(): - await test_change_parameters_async(request_type=dict) - - def test_change_parameters_field_headers(): client = CloudChannelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5991,8 +6028,8 @@ async def test_change_parameters_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.ChangeRenewalSettingsRequest, - dict, + service.ChangeRenewalSettingsRequest(), + {}, ], ) def test_change_renewal_settings(request_type, transport: str = "grpc"): @@ -6003,7 +6040,7 @@ def test_change_renewal_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( @@ -6049,10 +6086,11 @@ def test_change_renewal_settings_non_empty_request_with_auto_populated_field(): client.change_renewal_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ChangeRenewalSettingsRequest( + request_msg = service.ChangeRenewalSettingsRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_change_renewal_settings_use_cached_wrapped_rpc(): @@ -6148,8 +6186,15 @@ async def test_change_renewal_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.ChangeRenewalSettingsRequest(), + {}, + ], +) async def test_change_renewal_settings_async( - transport: str = "grpc_asyncio", request_type=service.ChangeRenewalSettingsRequest + request_type, transport: str = "grpc_asyncio" ): client = CloudChannelServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -6158,7 +6203,7 @@ async def test_change_renewal_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( @@ -6180,11 +6225,6 @@ async def test_change_renewal_settings_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_change_renewal_settings_async_from_dict(): - await test_change_renewal_settings_async(request_type=dict) - - def test_change_renewal_settings_field_headers(): client = CloudChannelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6253,8 +6293,8 @@ async def test_change_renewal_settings_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.ChangeOfferRequest, - dict, + service.ChangeOfferRequest(), + {}, ], ) def test_change_offer(request_type, transport: str = "grpc"): @@ -6265,7 +6305,7 @@ def test_change_offer(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.change_offer), "__call__") as call: @@ -6311,7 +6351,7 @@ def test_change_offer_non_empty_request_with_auto_populated_field(): client.change_offer(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ChangeOfferRequest( + request_msg = service.ChangeOfferRequest( name="name_value", offer="offer_value", purchase_order_id="purchase_order_id_value", @@ -6319,6 +6359,7 @@ def test_change_offer_non_empty_request_with_auto_populated_field(): billing_account="billing_account_value", price_reference_id="price_reference_id_value", ) + assert args[0] == request_msg def test_change_offer_use_cached_wrapped_rpc(): @@ -6409,9 +6450,14 @@ async def test_change_offer_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_change_offer_async( - transport: str = "grpc_asyncio", request_type=service.ChangeOfferRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ChangeOfferRequest(), + {}, + ], +) +async def test_change_offer_async(request_type, transport: str = "grpc_asyncio"): client = CloudChannelServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6419,7 +6465,7 @@ async def test_change_offer_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.change_offer), "__call__") as call: @@ -6439,11 +6485,6 @@ async def test_change_offer_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_change_offer_async_from_dict(): - await test_change_offer_async(request_type=dict) - - def test_change_offer_field_headers(): client = CloudChannelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6508,8 +6549,8 @@ async def test_change_offer_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.StartPaidServiceRequest, - dict, + service.StartPaidServiceRequest(), + {}, ], ) def test_start_paid_service(request_type, transport: str = "grpc"): @@ -6520,7 +6561,7 @@ def test_start_paid_service(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6566,10 +6607,11 @@ def test_start_paid_service_non_empty_request_with_auto_populated_field(): client.start_paid_service(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.StartPaidServiceRequest( + request_msg = service.StartPaidServiceRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_start_paid_service_use_cached_wrapped_rpc(): @@ -6664,9 +6706,14 @@ async def test_start_paid_service_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_start_paid_service_async( - transport: str = "grpc_asyncio", request_type=service.StartPaidServiceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.StartPaidServiceRequest(), + {}, + ], +) +async def test_start_paid_service_async(request_type, transport: str = "grpc_asyncio"): client = CloudChannelServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6674,7 +6721,7 @@ async def test_start_paid_service_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( @@ -6696,11 +6743,6 @@ async def test_start_paid_service_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_start_paid_service_async_from_dict(): - await test_start_paid_service_async(request_type=dict) - - def test_start_paid_service_field_headers(): client = CloudChannelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6769,8 +6811,8 @@ async def test_start_paid_service_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.SuspendEntitlementRequest, - dict, + service.SuspendEntitlementRequest(), + {}, ], ) def test_suspend_entitlement(request_type, transport: str = "grpc"): @@ -6781,7 +6823,7 @@ def test_suspend_entitlement(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6827,10 +6869,11 @@ def test_suspend_entitlement_non_empty_request_with_auto_populated_field(): client.suspend_entitlement(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.SuspendEntitlementRequest( + request_msg = service.SuspendEntitlementRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_suspend_entitlement_use_cached_wrapped_rpc(): @@ -6925,9 +6968,14 @@ async def test_suspend_entitlement_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_suspend_entitlement_async( - transport: str = "grpc_asyncio", request_type=service.SuspendEntitlementRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.SuspendEntitlementRequest(), + {}, + ], +) +async def test_suspend_entitlement_async(request_type, transport: str = "grpc_asyncio"): client = CloudChannelServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6935,7 +6983,7 @@ async def test_suspend_entitlement_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( @@ -6957,11 +7005,6 @@ async def test_suspend_entitlement_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_suspend_entitlement_async_from_dict(): - await test_suspend_entitlement_async(request_type=dict) - - def test_suspend_entitlement_field_headers(): client = CloudChannelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7030,8 +7073,8 @@ async def test_suspend_entitlement_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.CancelEntitlementRequest, - dict, + service.CancelEntitlementRequest(), + {}, ], ) def test_cancel_entitlement(request_type, transport: str = "grpc"): @@ -7042,7 +7085,7 @@ def test_cancel_entitlement(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7088,10 +7131,11 @@ def test_cancel_entitlement_non_empty_request_with_auto_populated_field(): client.cancel_entitlement(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CancelEntitlementRequest( + request_msg = service.CancelEntitlementRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_cancel_entitlement_use_cached_wrapped_rpc(): @@ -7186,9 +7230,14 @@ async def test_cancel_entitlement_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_cancel_entitlement_async( - transport: str = "grpc_asyncio", request_type=service.CancelEntitlementRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CancelEntitlementRequest(), + {}, + ], +) +async def test_cancel_entitlement_async(request_type, transport: str = "grpc_asyncio"): client = CloudChannelServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7196,7 +7245,7 @@ async def test_cancel_entitlement_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( @@ -7218,11 +7267,6 @@ async def test_cancel_entitlement_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_cancel_entitlement_async_from_dict(): - await test_cancel_entitlement_async(request_type=dict) - - def test_cancel_entitlement_field_headers(): client = CloudChannelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7291,8 +7335,8 @@ async def test_cancel_entitlement_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.ActivateEntitlementRequest, - dict, + service.ActivateEntitlementRequest(), + {}, ], ) def test_activate_entitlement(request_type, transport: str = "grpc"): @@ -7303,7 +7347,7 @@ def test_activate_entitlement(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7349,10 +7393,11 @@ def test_activate_entitlement_non_empty_request_with_auto_populated_field(): client.activate_entitlement(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ActivateEntitlementRequest( + request_msg = service.ActivateEntitlementRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_activate_entitlement_use_cached_wrapped_rpc(): @@ -7447,8 +7492,15 @@ async def test_activate_entitlement_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.ActivateEntitlementRequest(), + {}, + ], +) async def test_activate_entitlement_async( - transport: str = "grpc_asyncio", request_type=service.ActivateEntitlementRequest + request_type, transport: str = "grpc_asyncio" ): client = CloudChannelServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -7457,7 +7509,7 @@ async def test_activate_entitlement_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( @@ -7479,11 +7531,6 @@ async def test_activate_entitlement_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_activate_entitlement_async_from_dict(): - await test_activate_entitlement_async(request_type=dict) - - def test_activate_entitlement_field_headers(): client = CloudChannelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7552,8 +7599,8 @@ async def test_activate_entitlement_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.TransferEntitlementsRequest, - dict, + service.TransferEntitlementsRequest(), + {}, ], ) def test_transfer_entitlements(request_type, transport: str = "grpc"): @@ -7564,7 +7611,7 @@ def test_transfer_entitlements(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7611,11 +7658,12 @@ def test_transfer_entitlements_non_empty_request_with_auto_populated_field(): client.transfer_entitlements(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.TransferEntitlementsRequest( + request_msg = service.TransferEntitlementsRequest( parent="parent_value", auth_token="auth_token_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_transfer_entitlements_use_cached_wrapped_rpc(): @@ -7711,8 +7759,15 @@ async def test_transfer_entitlements_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.TransferEntitlementsRequest(), + {}, + ], +) async def test_transfer_entitlements_async( - transport: str = "grpc_asyncio", request_type=service.TransferEntitlementsRequest + request_type, transport: str = "grpc_asyncio" ): client = CloudChannelServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -7721,7 +7776,7 @@ async def test_transfer_entitlements_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( @@ -7743,11 +7798,6 @@ async def test_transfer_entitlements_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_transfer_entitlements_async_from_dict(): - await test_transfer_entitlements_async(request_type=dict) - - def test_transfer_entitlements_field_headers(): client = CloudChannelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7816,8 +7866,8 @@ async def test_transfer_entitlements_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.TransferEntitlementsToGoogleRequest, - dict, + service.TransferEntitlementsToGoogleRequest(), + {}, ], ) def test_transfer_entitlements_to_google(request_type, transport: str = "grpc"): @@ -7828,7 +7878,7 @@ def test_transfer_entitlements_to_google(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7874,10 +7924,11 @@ def test_transfer_entitlements_to_google_non_empty_request_with_auto_populated_f client.transfer_entitlements_to_google(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.TransferEntitlementsToGoogleRequest( + request_msg = service.TransferEntitlementsToGoogleRequest( parent="parent_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_transfer_entitlements_to_google_use_cached_wrapped_rpc(): @@ -7973,9 +8024,15 @@ async def test_transfer_entitlements_to_google_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.TransferEntitlementsToGoogleRequest(), + {}, + ], +) async def test_transfer_entitlements_to_google_async( - transport: str = "grpc_asyncio", - request_type=service.TransferEntitlementsToGoogleRequest, + request_type, transport: str = "grpc_asyncio" ): client = CloudChannelServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -7984,7 +8041,7 @@ async def test_transfer_entitlements_to_google_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( @@ -8006,11 +8063,6 @@ async def test_transfer_entitlements_to_google_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_transfer_entitlements_to_google_async_from_dict(): - await test_transfer_entitlements_to_google_async(request_type=dict) - - def test_transfer_entitlements_to_google_field_headers(): client = CloudChannelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8079,8 +8131,8 @@ async def test_transfer_entitlements_to_google_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.ListChannelPartnerLinksRequest, - dict, + service.ListChannelPartnerLinksRequest(), + {}, ], ) def test_list_channel_partner_links(request_type, transport: str = "grpc"): @@ -8091,7 +8143,7 @@ def test_list_channel_partner_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( @@ -8140,10 +8192,11 @@ def test_list_channel_partner_links_non_empty_request_with_auto_populated_field( client.list_channel_partner_links(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListChannelPartnerLinksRequest( + request_msg = service.ListChannelPartnerLinksRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_channel_partner_links_use_cached_wrapped_rpc(): @@ -8229,8 +8282,15 @@ async def test_list_channel_partner_links_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.ListChannelPartnerLinksRequest(), + {}, + ], +) async def test_list_channel_partner_links_async( - transport: str = "grpc_asyncio", request_type=service.ListChannelPartnerLinksRequest + request_type, transport: str = "grpc_asyncio" ): client = CloudChannelServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -8239,7 +8299,7 @@ async def test_list_channel_partner_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( @@ -8264,11 +8324,6 @@ async def test_list_channel_partner_links_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_channel_partner_links_async_from_dict(): - await test_list_channel_partner_links_async(request_type=dict) - - def test_list_channel_partner_links_field_headers(): client = CloudChannelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8541,8 +8596,8 @@ async def test_list_channel_partner_links_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetChannelPartnerLinkRequest, - dict, + service.GetChannelPartnerLinkRequest(), + {}, ], ) def test_get_channel_partner_link(request_type, transport: str = "grpc"): @@ -8553,7 +8608,7 @@ def test_get_channel_partner_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( @@ -8609,9 +8664,10 @@ def test_get_channel_partner_link_non_empty_request_with_auto_populated_field(): client.get_channel_partner_link(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetChannelPartnerLinkRequest( + request_msg = service.GetChannelPartnerLinkRequest( name="name_value", ) + assert args[0] == request_msg def test_get_channel_partner_link_use_cached_wrapped_rpc(): @@ -8697,8 +8753,15 @@ async def test_get_channel_partner_link_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.GetChannelPartnerLinkRequest(), + {}, + ], +) async def test_get_channel_partner_link_async( - transport: str = "grpc_asyncio", request_type=service.GetChannelPartnerLinkRequest + request_type, transport: str = "grpc_asyncio" ): client = CloudChannelServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -8707,7 +8770,7 @@ async def test_get_channel_partner_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( @@ -8740,11 +8803,6 @@ async def test_get_channel_partner_link_async( assert response.public_id == "public_id_value" -@pytest.mark.asyncio -async def test_get_channel_partner_link_async_from_dict(): - await test_get_channel_partner_link_async(request_type=dict) - - def test_get_channel_partner_link_field_headers(): client = CloudChannelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8813,8 +8871,8 @@ async def test_get_channel_partner_link_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.CreateChannelPartnerLinkRequest, - dict, + service.CreateChannelPartnerLinkRequest(), + {}, ], ) def test_create_channel_partner_link(request_type, transport: str = "grpc"): @@ -8825,7 +8883,7 @@ def test_create_channel_partner_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( @@ -8881,9 +8939,10 @@ def test_create_channel_partner_link_non_empty_request_with_auto_populated_field client.create_channel_partner_link(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateChannelPartnerLinkRequest( + request_msg = service.CreateChannelPartnerLinkRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_channel_partner_link_use_cached_wrapped_rpc(): @@ -8969,9 +9028,15 @@ async def test_create_channel_partner_link_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.CreateChannelPartnerLinkRequest(), + {}, + ], +) async def test_create_channel_partner_link_async( - transport: str = "grpc_asyncio", - request_type=service.CreateChannelPartnerLinkRequest, + request_type, transport: str = "grpc_asyncio" ): client = CloudChannelServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -8980,7 +9045,7 @@ async def test_create_channel_partner_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( @@ -9013,11 +9078,6 @@ async def test_create_channel_partner_link_async( assert response.public_id == "public_id_value" -@pytest.mark.asyncio -async def test_create_channel_partner_link_async_from_dict(): - await test_create_channel_partner_link_async(request_type=dict) - - def test_create_channel_partner_link_field_headers(): client = CloudChannelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9086,8 +9146,8 @@ async def test_create_channel_partner_link_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdateChannelPartnerLinkRequest, - dict, + service.UpdateChannelPartnerLinkRequest(), + {}, ], ) def test_update_channel_partner_link(request_type, transport: str = "grpc"): @@ -9098,7 +9158,7 @@ def test_update_channel_partner_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( @@ -9154,9 +9214,10 @@ def test_update_channel_partner_link_non_empty_request_with_auto_populated_field client.update_channel_partner_link(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateChannelPartnerLinkRequest( + request_msg = service.UpdateChannelPartnerLinkRequest( name="name_value", ) + assert args[0] == request_msg def test_update_channel_partner_link_use_cached_wrapped_rpc(): @@ -9242,9 +9303,15 @@ async def test_update_channel_partner_link_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateChannelPartnerLinkRequest(), + {}, + ], +) async def test_update_channel_partner_link_async( - transport: str = "grpc_asyncio", - request_type=service.UpdateChannelPartnerLinkRequest, + request_type, transport: str = "grpc_asyncio" ): client = CloudChannelServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -9253,7 +9320,7 @@ async def test_update_channel_partner_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( @@ -9286,11 +9353,6 @@ async def test_update_channel_partner_link_async( assert response.public_id == "public_id_value" -@pytest.mark.asyncio -async def test_update_channel_partner_link_async_from_dict(): - await test_update_channel_partner_link_async(request_type=dict) - - def test_update_channel_partner_link_field_headers(): client = CloudChannelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9359,8 +9421,8 @@ async def test_update_channel_partner_link_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.GetCustomerRepricingConfigRequest, - dict, + service.GetCustomerRepricingConfigRequest(), + {}, ], ) def test_get_customer_repricing_config(request_type, transport: str = "grpc"): @@ -9371,7 +9433,7 @@ def test_get_customer_repricing_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( @@ -9419,9 +9481,10 @@ def test_get_customer_repricing_config_non_empty_request_with_auto_populated_fie client.get_customer_repricing_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetCustomerRepricingConfigRequest( + request_msg = service.GetCustomerRepricingConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_customer_repricing_config_use_cached_wrapped_rpc(): @@ -9507,9 +9570,15 @@ async def test_get_customer_repricing_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.GetCustomerRepricingConfigRequest(), + {}, + ], +) async def test_get_customer_repricing_config_async( - transport: str = "grpc_asyncio", - request_type=service.GetCustomerRepricingConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = CloudChannelServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -9518,7 +9587,7 @@ async def test_get_customer_repricing_config_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( @@ -9543,11 +9612,6 @@ async def test_get_customer_repricing_config_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_customer_repricing_config_async_from_dict(): - await test_get_customer_repricing_config_async(request_type=dict) - - def test_get_customer_repricing_config_field_headers(): client = CloudChannelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9702,8 +9766,8 @@ async def test_get_customer_repricing_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListCustomerRepricingConfigsRequest, - dict, + service.ListCustomerRepricingConfigsRequest(), + {}, ], ) def test_list_customer_repricing_configs(request_type, transport: str = "grpc"): @@ -9714,7 +9778,7 @@ def test_list_customer_repricing_configs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9764,11 +9828,12 @@ def test_list_customer_repricing_configs_non_empty_request_with_auto_populated_f client.list_customer_repricing_configs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListCustomerRepricingConfigsRequest( + request_msg = service.ListCustomerRepricingConfigsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_customer_repricing_configs_use_cached_wrapped_rpc(): @@ -9854,9 +9919,15 @@ async def test_list_customer_repricing_configs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.ListCustomerRepricingConfigsRequest(), + {}, + ], +) async def test_list_customer_repricing_configs_async( - transport: str = "grpc_asyncio", - request_type=service.ListCustomerRepricingConfigsRequest, + request_type, transport: str = "grpc_asyncio" ): client = CloudChannelServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -9865,7 +9936,7 @@ async def test_list_customer_repricing_configs_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( @@ -9890,11 +9961,6 @@ async def test_list_customer_repricing_configs_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_customer_repricing_configs_async_from_dict(): - await test_list_customer_repricing_configs_async(request_type=dict) - - def test_list_customer_repricing_configs_field_headers(): client = CloudChannelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10251,8 +10317,8 @@ async def test_list_customer_repricing_configs_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.CreateCustomerRepricingConfigRequest, - dict, + service.CreateCustomerRepricingConfigRequest(), + {}, ], ) def test_create_customer_repricing_config(request_type, transport: str = "grpc"): @@ -10263,7 +10329,7 @@ def test_create_customer_repricing_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( @@ -10311,9 +10377,10 @@ def test_create_customer_repricing_config_non_empty_request_with_auto_populated_ client.create_customer_repricing_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateCustomerRepricingConfigRequest( + request_msg = service.CreateCustomerRepricingConfigRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_customer_repricing_config_use_cached_wrapped_rpc(): @@ -10399,9 +10466,15 @@ async def test_create_customer_repricing_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.CreateCustomerRepricingConfigRequest(), + {}, + ], +) async def test_create_customer_repricing_config_async( - transport: str = "grpc_asyncio", - request_type=service.CreateCustomerRepricingConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = CloudChannelServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -10410,7 +10483,7 @@ async def test_create_customer_repricing_config_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( @@ -10435,11 +10508,6 @@ async def test_create_customer_repricing_config_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_create_customer_repricing_config_async_from_dict(): - await test_create_customer_repricing_config_async(request_type=dict) - - def test_create_customer_repricing_config_field_headers(): client = CloudChannelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10612,8 +10680,8 @@ async def test_create_customer_repricing_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdateCustomerRepricingConfigRequest, - dict, + service.UpdateCustomerRepricingConfigRequest(), + {}, ], ) def test_update_customer_repricing_config(request_type, transport: str = "grpc"): @@ -10624,7 +10692,7 @@ def test_update_customer_repricing_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( @@ -10670,7 +10738,8 @@ def test_update_customer_repricing_config_non_empty_request_with_auto_populated_ client.update_customer_repricing_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateCustomerRepricingConfigRequest() + request_msg = service.UpdateCustomerRepricingConfigRequest() + assert args[0] == request_msg def test_update_customer_repricing_config_use_cached_wrapped_rpc(): @@ -10756,9 +10825,15 @@ async def test_update_customer_repricing_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateCustomerRepricingConfigRequest(), + {}, + ], +) async def test_update_customer_repricing_config_async( - transport: str = "grpc_asyncio", - request_type=service.UpdateCustomerRepricingConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = CloudChannelServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -10767,7 +10842,7 @@ async def test_update_customer_repricing_config_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( @@ -10792,11 +10867,6 @@ async def test_update_customer_repricing_config_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_update_customer_repricing_config_async_from_dict(): - await test_update_customer_repricing_config_async(request_type=dict) - - def test_update_customer_repricing_config_field_headers(): client = CloudChannelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10959,8 +11029,8 @@ async def test_update_customer_repricing_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DeleteCustomerRepricingConfigRequest, - dict, + service.DeleteCustomerRepricingConfigRequest(), + {}, ], ) def test_delete_customer_repricing_config(request_type, transport: str = "grpc"): @@ -10971,7 +11041,7 @@ def test_delete_customer_repricing_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( @@ -11016,9 +11086,10 @@ def test_delete_customer_repricing_config_non_empty_request_with_auto_populated_ client.delete_customer_repricing_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteCustomerRepricingConfigRequest( + request_msg = service.DeleteCustomerRepricingConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_customer_repricing_config_use_cached_wrapped_rpc(): @@ -11104,9 +11175,15 @@ async def test_delete_customer_repricing_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteCustomerRepricingConfigRequest(), + {}, + ], +) async def test_delete_customer_repricing_config_async( - transport: str = "grpc_asyncio", - request_type=service.DeleteCustomerRepricingConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = CloudChannelServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -11115,7 +11192,7 @@ async def test_delete_customer_repricing_config_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( @@ -11135,11 +11212,6 @@ async def test_delete_customer_repricing_config_async( assert response is None -@pytest.mark.asyncio -async def test_delete_customer_repricing_config_async_from_dict(): - await test_delete_customer_repricing_config_async(request_type=dict) - - def test_delete_customer_repricing_config_field_headers(): client = CloudChannelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11290,8 +11362,8 @@ async def test_delete_customer_repricing_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.GetChannelPartnerRepricingConfigRequest, - dict, + service.GetChannelPartnerRepricingConfigRequest(), + {}, ], ) def test_get_channel_partner_repricing_config(request_type, transport: str = "grpc"): @@ -11302,7 +11374,7 @@ def test_get_channel_partner_repricing_config(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( @@ -11350,9 +11422,10 @@ def test_get_channel_partner_repricing_config_non_empty_request_with_auto_popula client.get_channel_partner_repricing_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetChannelPartnerRepricingConfigRequest( + request_msg = service.GetChannelPartnerRepricingConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_channel_partner_repricing_config_use_cached_wrapped_rpc(): @@ -11438,9 +11511,15 @@ async def test_get_channel_partner_repricing_config_async_use_cached_wrapped_rpc @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.GetChannelPartnerRepricingConfigRequest(), + {}, + ], +) async def test_get_channel_partner_repricing_config_async( - transport: str = "grpc_asyncio", - request_type=service.GetChannelPartnerRepricingConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = CloudChannelServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -11449,7 +11528,7 @@ async def test_get_channel_partner_repricing_config_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( @@ -11474,11 +11553,6 @@ async def test_get_channel_partner_repricing_config_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_channel_partner_repricing_config_async_from_dict(): - await test_get_channel_partner_repricing_config_async(request_type=dict) - - def test_get_channel_partner_repricing_config_field_headers(): client = CloudChannelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11633,8 +11707,8 @@ async def test_get_channel_partner_repricing_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListChannelPartnerRepricingConfigsRequest, - dict, + service.ListChannelPartnerRepricingConfigsRequest(), + {}, ], ) def test_list_channel_partner_repricing_configs(request_type, transport: str = "grpc"): @@ -11645,7 +11719,7 @@ def test_list_channel_partner_repricing_configs(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( @@ -11695,11 +11769,12 @@ def test_list_channel_partner_repricing_configs_non_empty_request_with_auto_popu client.list_channel_partner_repricing_configs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListChannelPartnerRepricingConfigsRequest( + request_msg = service.ListChannelPartnerRepricingConfigsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_channel_partner_repricing_configs_use_cached_wrapped_rpc(): @@ -11785,9 +11860,15 @@ async def test_list_channel_partner_repricing_configs_async_use_cached_wrapped_r @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.ListChannelPartnerRepricingConfigsRequest(), + {}, + ], +) async def test_list_channel_partner_repricing_configs_async( - transport: str = "grpc_asyncio", - request_type=service.ListChannelPartnerRepricingConfigsRequest, + request_type, transport: str = "grpc_asyncio" ): client = CloudChannelServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -11796,7 +11877,7 @@ async def test_list_channel_partner_repricing_configs_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( @@ -11821,11 +11902,6 @@ async def test_list_channel_partner_repricing_configs_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_channel_partner_repricing_configs_async_from_dict(): - await test_list_channel_partner_repricing_configs_async(request_type=dict) - - def test_list_channel_partner_repricing_configs_field_headers(): client = CloudChannelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12186,8 +12262,8 @@ async def test_list_channel_partner_repricing_configs_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.CreateChannelPartnerRepricingConfigRequest, - dict, + service.CreateChannelPartnerRepricingConfigRequest(), + {}, ], ) def test_create_channel_partner_repricing_config(request_type, transport: str = "grpc"): @@ -12198,7 +12274,7 @@ def test_create_channel_partner_repricing_config(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( @@ -12246,9 +12322,10 @@ def test_create_channel_partner_repricing_config_non_empty_request_with_auto_pop client.create_channel_partner_repricing_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateChannelPartnerRepricingConfigRequest( + request_msg = service.CreateChannelPartnerRepricingConfigRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_channel_partner_repricing_config_use_cached_wrapped_rpc(): @@ -12334,9 +12411,15 @@ async def test_create_channel_partner_repricing_config_async_use_cached_wrapped_ @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.CreateChannelPartnerRepricingConfigRequest(), + {}, + ], +) async def test_create_channel_partner_repricing_config_async( - transport: str = "grpc_asyncio", - request_type=service.CreateChannelPartnerRepricingConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = CloudChannelServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -12345,7 +12428,7 @@ async def test_create_channel_partner_repricing_config_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( @@ -12370,11 +12453,6 @@ async def test_create_channel_partner_repricing_config_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_create_channel_partner_repricing_config_async_from_dict(): - await test_create_channel_partner_repricing_config_async(request_type=dict) - - def test_create_channel_partner_repricing_config_field_headers(): client = CloudChannelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12547,8 +12625,8 @@ async def test_create_channel_partner_repricing_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdateChannelPartnerRepricingConfigRequest, - dict, + service.UpdateChannelPartnerRepricingConfigRequest(), + {}, ], ) def test_update_channel_partner_repricing_config(request_type, transport: str = "grpc"): @@ -12559,7 +12637,7 @@ def test_update_channel_partner_repricing_config(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( @@ -12605,7 +12683,8 @@ def test_update_channel_partner_repricing_config_non_empty_request_with_auto_pop client.update_channel_partner_repricing_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateChannelPartnerRepricingConfigRequest() + request_msg = service.UpdateChannelPartnerRepricingConfigRequest() + assert args[0] == request_msg def test_update_channel_partner_repricing_config_use_cached_wrapped_rpc(): @@ -12691,9 +12770,15 @@ async def test_update_channel_partner_repricing_config_async_use_cached_wrapped_ @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateChannelPartnerRepricingConfigRequest(), + {}, + ], +) async def test_update_channel_partner_repricing_config_async( - transport: str = "grpc_asyncio", - request_type=service.UpdateChannelPartnerRepricingConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = CloudChannelServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -12702,7 +12787,7 @@ async def test_update_channel_partner_repricing_config_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( @@ -12727,11 +12812,6 @@ async def test_update_channel_partner_repricing_config_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_update_channel_partner_repricing_config_async_from_dict(): - await test_update_channel_partner_repricing_config_async(request_type=dict) - - def test_update_channel_partner_repricing_config_field_headers(): client = CloudChannelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12894,8 +12974,8 @@ async def test_update_channel_partner_repricing_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DeleteChannelPartnerRepricingConfigRequest, - dict, + service.DeleteChannelPartnerRepricingConfigRequest(), + {}, ], ) def test_delete_channel_partner_repricing_config(request_type, transport: str = "grpc"): @@ -12906,7 +12986,7 @@ def test_delete_channel_partner_repricing_config(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( @@ -12951,9 +13031,10 @@ def test_delete_channel_partner_repricing_config_non_empty_request_with_auto_pop client.delete_channel_partner_repricing_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteChannelPartnerRepricingConfigRequest( + request_msg = service.DeleteChannelPartnerRepricingConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_channel_partner_repricing_config_use_cached_wrapped_rpc(): @@ -13039,9 +13120,15 @@ async def test_delete_channel_partner_repricing_config_async_use_cached_wrapped_ @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteChannelPartnerRepricingConfigRequest(), + {}, + ], +) async def test_delete_channel_partner_repricing_config_async( - transport: str = "grpc_asyncio", - request_type=service.DeleteChannelPartnerRepricingConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = CloudChannelServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -13050,7 +13137,7 @@ async def test_delete_channel_partner_repricing_config_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( @@ -13070,11 +13157,6 @@ async def test_delete_channel_partner_repricing_config_async( assert response is None -@pytest.mark.asyncio -async def test_delete_channel_partner_repricing_config_async_from_dict(): - await test_delete_channel_partner_repricing_config_async(request_type=dict) - - def test_delete_channel_partner_repricing_config_field_headers(): client = CloudChannelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13225,8 +13307,8 @@ async def test_delete_channel_partner_repricing_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListSkuGroupsRequest, - dict, + service.ListSkuGroupsRequest(), + {}, ], ) def test_list_sku_groups(request_type, transport: str = "grpc"): @@ -13237,7 +13319,7 @@ def test_list_sku_groups(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_sku_groups), "__call__") as call: @@ -13282,10 +13364,11 @@ def test_list_sku_groups_non_empty_request_with_auto_populated_field(): client.list_sku_groups(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListSkuGroupsRequest( + request_msg = service.ListSkuGroupsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_sku_groups_use_cached_wrapped_rpc(): @@ -13366,9 +13449,14 @@ async def test_list_sku_groups_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_sku_groups_async( - transport: str = "grpc_asyncio", request_type=service.ListSkuGroupsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListSkuGroupsRequest(), + {}, + ], +) +async def test_list_sku_groups_async(request_type, transport: str = "grpc_asyncio"): client = CloudChannelServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13376,7 +13464,7 @@ async def test_list_sku_groups_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_sku_groups), "__call__") as call: @@ -13399,11 +13487,6 @@ async def test_list_sku_groups_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_sku_groups_async_from_dict(): - await test_list_sku_groups_async(request_type=dict) - - def test_list_sku_groups_field_headers(): client = CloudChannelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13740,8 +13823,8 @@ async def test_list_sku_groups_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.ListSkuGroupBillableSkusRequest, - dict, + service.ListSkuGroupBillableSkusRequest(), + {}, ], ) def test_list_sku_group_billable_skus(request_type, transport: str = "grpc"): @@ -13752,7 +13835,7 @@ def test_list_sku_group_billable_skus(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -13801,10 +13884,11 @@ def test_list_sku_group_billable_skus_non_empty_request_with_auto_populated_fiel client.list_sku_group_billable_skus(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListSkuGroupBillableSkusRequest( + request_msg = service.ListSkuGroupBillableSkusRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_sku_group_billable_skus_use_cached_wrapped_rpc(): @@ -13890,9 +13974,15 @@ async def test_list_sku_group_billable_skus_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.ListSkuGroupBillableSkusRequest(), + {}, + ], +) async def test_list_sku_group_billable_skus_async( - transport: str = "grpc_asyncio", - request_type=service.ListSkuGroupBillableSkusRequest, + request_type, transport: str = "grpc_asyncio" ): client = CloudChannelServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -13901,7 +13991,7 @@ async def test_list_sku_group_billable_skus_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( @@ -13926,11 +14016,6 @@ async def test_list_sku_group_billable_skus_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_sku_group_billable_skus_async_from_dict(): - await test_list_sku_group_billable_skus_async(request_type=dict) - - def test_list_sku_group_billable_skus_field_headers(): client = CloudChannelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14287,8 +14372,8 @@ async def test_list_sku_group_billable_skus_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.LookupOfferRequest, - dict, + service.LookupOfferRequest(), + {}, ], ) def test_lookup_offer(request_type, transport: str = "grpc"): @@ -14299,7 +14384,7 @@ def test_lookup_offer(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.lookup_offer), "__call__") as call: @@ -14345,9 +14430,10 @@ def test_lookup_offer_non_empty_request_with_auto_populated_field(): client.lookup_offer(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.LookupOfferRequest( + request_msg = service.LookupOfferRequest( entitlement="entitlement_value", ) + assert args[0] == request_msg def test_lookup_offer_use_cached_wrapped_rpc(): @@ -14428,9 +14514,14 @@ async def test_lookup_offer_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_lookup_offer_async( - transport: str = "grpc_asyncio", request_type=service.LookupOfferRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.LookupOfferRequest(), + {}, + ], +) +async def test_lookup_offer_async(request_type, transport: str = "grpc_asyncio"): client = CloudChannelServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14438,7 +14529,7 @@ async def test_lookup_offer_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.lookup_offer), "__call__") as call: @@ -14463,11 +14554,6 @@ async def test_lookup_offer_async( assert response.deal_code == "deal_code_value" -@pytest.mark.asyncio -async def test_lookup_offer_async_from_dict(): - await test_lookup_offer_async(request_type=dict) - - def test_lookup_offer_field_headers(): client = CloudChannelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14530,8 +14616,8 @@ async def test_lookup_offer_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.ListProductsRequest, - dict, + service.ListProductsRequest(), + {}, ], ) def test_list_products(request_type, transport: str = "grpc"): @@ -14542,7 +14628,7 @@ def test_list_products(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_products), "__call__") as call: @@ -14588,11 +14674,12 @@ def test_list_products_non_empty_request_with_auto_populated_field(): client.list_products(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListProductsRequest( + request_msg = service.ListProductsRequest( account="account_value", page_token="page_token_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_list_products_use_cached_wrapped_rpc(): @@ -14673,9 +14760,14 @@ async def test_list_products_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_products_async( - transport: str = "grpc_asyncio", request_type=service.ListProductsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListProductsRequest(), + {}, + ], +) +async def test_list_products_async(request_type, transport: str = "grpc_asyncio"): client = CloudChannelServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14683,7 +14775,7 @@ async def test_list_products_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_products), "__call__") as call: @@ -14706,11 +14798,6 @@ async def test_list_products_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_products_async_from_dict(): - await test_list_products_async(request_type=dict) - - def test_list_products_pager(transport_name: str = "grpc"): client = CloudChannelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14901,8 +14988,8 @@ async def test_list_products_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.ListSkusRequest, - dict, + service.ListSkusRequest(), + {}, ], ) def test_list_skus(request_type, transport: str = "grpc"): @@ -14913,7 +15000,7 @@ def test_list_skus(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_skus), "__call__") as call: @@ -14960,12 +15047,13 @@ def test_list_skus_non_empty_request_with_auto_populated_field(): client.list_skus(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListSkusRequest( + request_msg = service.ListSkusRequest( parent="parent_value", account="account_value", page_token="page_token_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_list_skus_use_cached_wrapped_rpc(): @@ -15044,9 +15132,14 @@ async def test_list_skus_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_list_skus_async( - transport: str = "grpc_asyncio", request_type=service.ListSkusRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListSkusRequest(), + {}, + ], +) +async def test_list_skus_async(request_type, transport: str = "grpc_asyncio"): client = CloudChannelServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -15054,7 +15147,7 @@ async def test_list_skus_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_skus), "__call__") as call: @@ -15077,11 +15170,6 @@ async def test_list_skus_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_skus_async_from_dict(): - await test_list_skus_async(request_type=dict) - - def test_list_skus_field_headers(): client = CloudChannelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15336,8 +15424,8 @@ async def test_list_skus_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.ListOffersRequest, - dict, + service.ListOffersRequest(), + {}, ], ) def test_list_offers(request_type, transport: str = "grpc"): @@ -15348,7 +15436,7 @@ def test_list_offers(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_offers), "__call__") as call: @@ -15395,12 +15483,13 @@ def test_list_offers_non_empty_request_with_auto_populated_field(): client.list_offers(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListOffersRequest( + request_msg = service.ListOffersRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_list_offers_use_cached_wrapped_rpc(): @@ -15481,9 +15570,14 @@ async def test_list_offers_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_offers_async( - transport: str = "grpc_asyncio", request_type=service.ListOffersRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListOffersRequest(), + {}, + ], +) +async def test_list_offers_async(request_type, transport: str = "grpc_asyncio"): client = CloudChannelServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -15491,7 +15585,7 @@ async def test_list_offers_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_offers), "__call__") as call: @@ -15514,11 +15608,6 @@ async def test_list_offers_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_offers_async_from_dict(): - await test_list_offers_async(request_type=dict) - - def test_list_offers_field_headers(): client = CloudChannelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15773,8 +15862,8 @@ async def test_list_offers_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.ListPurchasableSkusRequest, - dict, + service.ListPurchasableSkusRequest(), + {}, ], ) def test_list_purchasable_skus(request_type, transport: str = "grpc"): @@ -15785,7 +15874,7 @@ def test_list_purchasable_skus(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -15835,11 +15924,12 @@ def test_list_purchasable_skus_non_empty_request_with_auto_populated_field(): client.list_purchasable_skus(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListPurchasableSkusRequest( + request_msg = service.ListPurchasableSkusRequest( customer="customer_value", page_token="page_token_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_list_purchasable_skus_use_cached_wrapped_rpc(): @@ -15925,8 +16015,15 @@ async def test_list_purchasable_skus_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.ListPurchasableSkusRequest(), + {}, + ], +) async def test_list_purchasable_skus_async( - transport: str = "grpc_asyncio", request_type=service.ListPurchasableSkusRequest + request_type, transport: str = "grpc_asyncio" ): client = CloudChannelServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -15935,7 +16032,7 @@ async def test_list_purchasable_skus_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( @@ -15960,11 +16057,6 @@ async def test_list_purchasable_skus_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_purchasable_skus_async_from_dict(): - await test_list_purchasable_skus_async(request_type=dict) - - def test_list_purchasable_skus_field_headers(): client = CloudChannelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16231,8 +16323,8 @@ async def test_list_purchasable_skus_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.ListPurchasableOffersRequest, - dict, + service.ListPurchasableOffersRequest(), + {}, ], ) def test_list_purchasable_offers(request_type, transport: str = "grpc"): @@ -16243,7 +16335,7 @@ def test_list_purchasable_offers(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -16293,11 +16385,12 @@ def test_list_purchasable_offers_non_empty_request_with_auto_populated_field(): client.list_purchasable_offers(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListPurchasableOffersRequest( + request_msg = service.ListPurchasableOffersRequest( customer="customer_value", page_token="page_token_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_list_purchasable_offers_use_cached_wrapped_rpc(): @@ -16383,8 +16476,15 @@ async def test_list_purchasable_offers_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.ListPurchasableOffersRequest(), + {}, + ], +) async def test_list_purchasable_offers_async( - transport: str = "grpc_asyncio", request_type=service.ListPurchasableOffersRequest + request_type, transport: str = "grpc_asyncio" ): client = CloudChannelServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -16393,7 +16493,7 @@ async def test_list_purchasable_offers_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( @@ -16418,11 +16518,6 @@ async def test_list_purchasable_offers_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_purchasable_offers_async_from_dict(): - await test_list_purchasable_offers_async(request_type=dict) - - def test_list_purchasable_offers_field_headers(): client = CloudChannelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16689,8 +16784,8 @@ async def test_list_purchasable_offers_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.QueryEligibleBillingAccountsRequest, - dict, + service.QueryEligibleBillingAccountsRequest(), + {}, ], ) def test_query_eligible_billing_accounts(request_type, transport: str = "grpc"): @@ -16701,7 +16796,7 @@ def test_query_eligible_billing_accounts(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -16746,9 +16841,10 @@ def test_query_eligible_billing_accounts_non_empty_request_with_auto_populated_f client.query_eligible_billing_accounts(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.QueryEligibleBillingAccountsRequest( + request_msg = service.QueryEligibleBillingAccountsRequest( customer="customer_value", ) + assert args[0] == request_msg def test_query_eligible_billing_accounts_use_cached_wrapped_rpc(): @@ -16834,9 +16930,15 @@ async def test_query_eligible_billing_accounts_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.QueryEligibleBillingAccountsRequest(), + {}, + ], +) async def test_query_eligible_billing_accounts_async( - transport: str = "grpc_asyncio", - request_type=service.QueryEligibleBillingAccountsRequest, + request_type, transport: str = "grpc_asyncio" ): client = CloudChannelServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -16845,7 +16947,7 @@ async def test_query_eligible_billing_accounts_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( @@ -16867,11 +16969,6 @@ async def test_query_eligible_billing_accounts_async( assert isinstance(response, service.QueryEligibleBillingAccountsResponse) -@pytest.mark.asyncio -async def test_query_eligible_billing_accounts_async_from_dict(): - await test_query_eligible_billing_accounts_async(request_type=dict) - - def test_query_eligible_billing_accounts_field_headers(): client = CloudChannelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16940,8 +17037,8 @@ async def test_query_eligible_billing_accounts_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.RegisterSubscriberRequest, - dict, + service.RegisterSubscriberRequest(), + {}, ], ) def test_register_subscriber(request_type, transport: str = "grpc"): @@ -16952,7 +17049,7 @@ def test_register_subscriber(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -17002,11 +17099,12 @@ def test_register_subscriber_non_empty_request_with_auto_populated_field(): client.register_subscriber(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.RegisterSubscriberRequest( + request_msg = service.RegisterSubscriberRequest( account="account_value", service_account="service_account_value", integrator="integrator_value", ) + assert args[0] == request_msg def test_register_subscriber_use_cached_wrapped_rpc(): @@ -17091,9 +17189,14 @@ async def test_register_subscriber_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_register_subscriber_async( - transport: str = "grpc_asyncio", request_type=service.RegisterSubscriberRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.RegisterSubscriberRequest(), + {}, + ], +) +async def test_register_subscriber_async(request_type, transport: str = "grpc_asyncio"): client = CloudChannelServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -17101,7 +17204,7 @@ async def test_register_subscriber_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( @@ -17126,11 +17229,6 @@ async def test_register_subscriber_async( assert response.topic == "topic_value" -@pytest.mark.asyncio -async def test_register_subscriber_async_from_dict(): - await test_register_subscriber_async(request_type=dict) - - def test_register_subscriber_field_headers(): client = CloudChannelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17199,8 +17297,8 @@ async def test_register_subscriber_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.UnregisterSubscriberRequest, - dict, + service.UnregisterSubscriberRequest(), + {}, ], ) def test_unregister_subscriber(request_type, transport: str = "grpc"): @@ -17211,7 +17309,7 @@ def test_unregister_subscriber(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -17261,11 +17359,12 @@ def test_unregister_subscriber_non_empty_request_with_auto_populated_field(): client.unregister_subscriber(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UnregisterSubscriberRequest( + request_msg = service.UnregisterSubscriberRequest( account="account_value", service_account="service_account_value", integrator="integrator_value", ) + assert args[0] == request_msg def test_unregister_subscriber_use_cached_wrapped_rpc(): @@ -17351,8 +17450,15 @@ async def test_unregister_subscriber_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.UnregisterSubscriberRequest(), + {}, + ], +) async def test_unregister_subscriber_async( - transport: str = "grpc_asyncio", request_type=service.UnregisterSubscriberRequest + request_type, transport: str = "grpc_asyncio" ): client = CloudChannelServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -17361,7 +17467,7 @@ async def test_unregister_subscriber_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( @@ -17386,11 +17492,6 @@ async def test_unregister_subscriber_async( assert response.topic == "topic_value" -@pytest.mark.asyncio -async def test_unregister_subscriber_async_from_dict(): - await test_unregister_subscriber_async(request_type=dict) - - def test_unregister_subscriber_field_headers(): client = CloudChannelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17459,8 +17560,8 @@ async def test_unregister_subscriber_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.ListSubscribersRequest, - dict, + service.ListSubscribersRequest(), + {}, ], ) def test_list_subscribers(request_type, transport: str = "grpc"): @@ -17471,7 +17572,7 @@ def test_list_subscribers(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_subscribers), "__call__") as call: @@ -17521,11 +17622,12 @@ def test_list_subscribers_non_empty_request_with_auto_populated_field(): client.list_subscribers(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListSubscribersRequest( + request_msg = service.ListSubscribersRequest( account="account_value", page_token="page_token_value", integrator="integrator_value", ) + assert args[0] == request_msg def test_list_subscribers_use_cached_wrapped_rpc(): @@ -17608,9 +17710,14 @@ async def test_list_subscribers_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_subscribers_async( - transport: str = "grpc_asyncio", request_type=service.ListSubscribersRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListSubscribersRequest(), + {}, + ], +) +async def test_list_subscribers_async(request_type, transport: str = "grpc_asyncio"): client = CloudChannelServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -17618,7 +17725,7 @@ async def test_list_subscribers_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_subscribers), "__call__") as call: @@ -17645,11 +17752,6 @@ async def test_list_subscribers_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_subscribers_async_from_dict(): - await test_list_subscribers_async(request_type=dict) - - def test_list_subscribers_field_headers(): client = CloudChannelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17904,8 +18006,8 @@ async def test_list_subscribers_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.ListEntitlementChangesRequest, - dict, + service.ListEntitlementChangesRequest(), + {}, ], ) def test_list_entitlement_changes(request_type, transport: str = "grpc"): @@ -17916,7 +18018,7 @@ def test_list_entitlement_changes(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -17966,11 +18068,12 @@ def test_list_entitlement_changes_non_empty_request_with_auto_populated_field(): client.list_entitlement_changes(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListEntitlementChangesRequest( + request_msg = service.ListEntitlementChangesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_entitlement_changes_use_cached_wrapped_rpc(): @@ -18056,8 +18159,15 @@ async def test_list_entitlement_changes_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.ListEntitlementChangesRequest(), + {}, + ], +) async def test_list_entitlement_changes_async( - transport: str = "grpc_asyncio", request_type=service.ListEntitlementChangesRequest + request_type, transport: str = "grpc_asyncio" ): client = CloudChannelServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -18066,7 +18176,7 @@ async def test_list_entitlement_changes_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( @@ -18091,11 +18201,6 @@ async def test_list_entitlement_changes_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_entitlement_changes_async_from_dict(): - await test_list_entitlement_changes_async(request_type=dict) - - def test_list_entitlement_changes_field_headers(): client = CloudChannelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18573,7 +18678,6 @@ def test_list_customers_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListCustomersRequest() - assert args[0] == request_msg @@ -18594,7 +18698,6 @@ def test_get_customer_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetCustomerRequest() - assert args[0] == request_msg @@ -18617,7 +18720,6 @@ def test_check_cloud_identity_accounts_exist_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CheckCloudIdentityAccountsExistRequest() - assert args[0] == request_msg @@ -18638,7 +18740,6 @@ def test_create_customer_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateCustomerRequest() - assert args[0] == request_msg @@ -18659,7 +18760,6 @@ def test_update_customer_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateCustomerRequest() - assert args[0] == request_msg @@ -18680,7 +18780,6 @@ def test_delete_customer_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteCustomerRequest() - assert args[0] == request_msg @@ -18701,7 +18800,6 @@ def test_import_customer_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ImportCustomerRequest() - assert args[0] == request_msg @@ -18724,7 +18822,6 @@ def test_provision_cloud_identity_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ProvisionCloudIdentityRequest() - assert args[0] == request_msg @@ -18747,7 +18844,6 @@ def test_list_entitlements_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListEntitlementsRequest() - assert args[0] == request_msg @@ -18770,7 +18866,6 @@ def test_list_transferable_skus_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListTransferableSkusRequest() - assert args[0] == request_msg @@ -18793,7 +18888,6 @@ def test_list_transferable_offers_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListTransferableOffersRequest() - assert args[0] == request_msg @@ -18814,7 +18908,6 @@ def test_get_entitlement_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetEntitlementRequest() - assert args[0] == request_msg @@ -18837,7 +18930,6 @@ def test_create_entitlement_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateEntitlementRequest() - assert args[0] == request_msg @@ -18860,7 +18952,6 @@ def test_change_parameters_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ChangeParametersRequest() - assert args[0] == request_msg @@ -18883,7 +18974,6 @@ def test_change_renewal_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ChangeRenewalSettingsRequest() - assert args[0] == request_msg @@ -18904,7 +18994,6 @@ def test_change_offer_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ChangeOfferRequest() - assert args[0] == request_msg @@ -18927,7 +19016,6 @@ def test_start_paid_service_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.StartPaidServiceRequest() - assert args[0] == request_msg @@ -18950,7 +19038,6 @@ def test_suspend_entitlement_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.SuspendEntitlementRequest() - assert args[0] == request_msg @@ -18973,7 +19060,6 @@ def test_cancel_entitlement_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CancelEntitlementRequest() - assert args[0] == request_msg @@ -18996,7 +19082,6 @@ def test_activate_entitlement_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ActivateEntitlementRequest() - assert args[0] == request_msg @@ -19019,7 +19104,6 @@ def test_transfer_entitlements_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.TransferEntitlementsRequest() - assert args[0] == request_msg @@ -19042,7 +19126,6 @@ def test_transfer_entitlements_to_google_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.TransferEntitlementsToGoogleRequest() - assert args[0] == request_msg @@ -19065,7 +19148,6 @@ def test_list_channel_partner_links_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListChannelPartnerLinksRequest() - assert args[0] == request_msg @@ -19088,7 +19170,6 @@ def test_get_channel_partner_link_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetChannelPartnerLinkRequest() - assert args[0] == request_msg @@ -19111,7 +19192,6 @@ def test_create_channel_partner_link_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateChannelPartnerLinkRequest() - assert args[0] == request_msg @@ -19134,7 +19214,6 @@ def test_update_channel_partner_link_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateChannelPartnerLinkRequest() - assert args[0] == request_msg @@ -19157,7 +19236,6 @@ def test_get_customer_repricing_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetCustomerRepricingConfigRequest() - assert args[0] == request_msg @@ -19180,7 +19258,6 @@ def test_list_customer_repricing_configs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListCustomerRepricingConfigsRequest() - assert args[0] == request_msg @@ -19203,7 +19280,6 @@ def test_create_customer_repricing_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateCustomerRepricingConfigRequest() - assert args[0] == request_msg @@ -19226,7 +19302,6 @@ def test_update_customer_repricing_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateCustomerRepricingConfigRequest() - assert args[0] == request_msg @@ -19249,7 +19324,6 @@ def test_delete_customer_repricing_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteCustomerRepricingConfigRequest() - assert args[0] == request_msg @@ -19272,7 +19346,6 @@ def test_get_channel_partner_repricing_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetChannelPartnerRepricingConfigRequest() - assert args[0] == request_msg @@ -19295,7 +19368,6 @@ def test_list_channel_partner_repricing_configs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListChannelPartnerRepricingConfigsRequest() - assert args[0] == request_msg @@ -19318,7 +19390,6 @@ def test_create_channel_partner_repricing_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateChannelPartnerRepricingConfigRequest() - assert args[0] == request_msg @@ -19341,7 +19412,6 @@ def test_update_channel_partner_repricing_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateChannelPartnerRepricingConfigRequest() - assert args[0] == request_msg @@ -19364,7 +19434,6 @@ def test_delete_channel_partner_repricing_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteChannelPartnerRepricingConfigRequest() - assert args[0] == request_msg @@ -19385,7 +19454,6 @@ def test_list_sku_groups_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListSkuGroupsRequest() - assert args[0] == request_msg @@ -19408,7 +19476,6 @@ def test_list_sku_group_billable_skus_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListSkuGroupBillableSkusRequest() - assert args[0] == request_msg @@ -19429,7 +19496,6 @@ def test_lookup_offer_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.LookupOfferRequest() - assert args[0] == request_msg @@ -19450,7 +19516,6 @@ def test_list_products_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListProductsRequest() - assert args[0] == request_msg @@ -19471,7 +19536,6 @@ def test_list_skus_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListSkusRequest() - assert args[0] == request_msg @@ -19492,7 +19556,6 @@ def test_list_offers_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListOffersRequest() - assert args[0] == request_msg @@ -19515,7 +19578,6 @@ def test_list_purchasable_skus_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListPurchasableSkusRequest() - assert args[0] == request_msg @@ -19538,7 +19600,6 @@ def test_list_purchasable_offers_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListPurchasableOffersRequest() - assert args[0] == request_msg @@ -19561,7 +19622,6 @@ def test_query_eligible_billing_accounts_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.QueryEligibleBillingAccountsRequest() - assert args[0] == request_msg @@ -19584,7 +19644,6 @@ def test_register_subscriber_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.RegisterSubscriberRequest() - assert args[0] == request_msg @@ -19607,7 +19666,6 @@ def test_unregister_subscriber_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UnregisterSubscriberRequest() - assert args[0] == request_msg @@ -19628,7 +19686,6 @@ def test_list_subscribers_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListSubscribersRequest() - assert args[0] == request_msg @@ -19651,7 +19708,6 @@ def test_list_entitlement_changes_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListEntitlementChangesRequest() - assert args[0] == request_msg @@ -19692,7 +19748,6 @@ async def test_list_customers_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListCustomersRequest() - assert args[0] == request_msg @@ -19727,7 +19782,6 @@ async def test_get_customer_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetCustomerRequest() - assert args[0] == request_msg @@ -19754,7 +19808,6 @@ async def test_check_cloud_identity_accounts_exist_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CheckCloudIdentityAccountsExistRequest() - assert args[0] == request_msg @@ -19789,7 +19842,6 @@ async def test_create_customer_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateCustomerRequest() - assert args[0] == request_msg @@ -19824,7 +19876,6 @@ async def test_update_customer_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateCustomerRequest() - assert args[0] == request_msg @@ -19847,7 +19898,6 @@ async def test_delete_customer_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteCustomerRequest() - assert args[0] == request_msg @@ -19882,7 +19932,6 @@ async def test_import_customer_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ImportCustomerRequest() - assert args[0] == request_msg @@ -19909,7 +19958,6 @@ async def test_provision_cloud_identity_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ProvisionCloudIdentityRequest() - assert args[0] == request_msg @@ -19938,7 +19986,6 @@ async def test_list_entitlements_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListEntitlementsRequest() - assert args[0] == request_msg @@ -19967,7 +20014,6 @@ async def test_list_transferable_skus_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListTransferableSkusRequest() - assert args[0] == request_msg @@ -19996,7 +20042,6 @@ async def test_list_transferable_offers_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListTransferableOffersRequest() - assert args[0] == request_msg @@ -20031,7 +20076,6 @@ async def test_get_entitlement_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetEntitlementRequest() - assert args[0] == request_msg @@ -20058,7 +20102,6 @@ async def test_create_entitlement_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateEntitlementRequest() - assert args[0] == request_msg @@ -20085,7 +20128,6 @@ async def test_change_parameters_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ChangeParametersRequest() - assert args[0] == request_msg @@ -20112,7 +20154,6 @@ async def test_change_renewal_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ChangeRenewalSettingsRequest() - assert args[0] == request_msg @@ -20137,7 +20178,6 @@ async def test_change_offer_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ChangeOfferRequest() - assert args[0] == request_msg @@ -20164,7 +20204,6 @@ async def test_start_paid_service_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.StartPaidServiceRequest() - assert args[0] == request_msg @@ -20191,7 +20230,6 @@ async def test_suspend_entitlement_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.SuspendEntitlementRequest() - assert args[0] == request_msg @@ -20218,7 +20256,6 @@ async def test_cancel_entitlement_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CancelEntitlementRequest() - assert args[0] == request_msg @@ -20245,7 +20282,6 @@ async def test_activate_entitlement_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ActivateEntitlementRequest() - assert args[0] == request_msg @@ -20272,7 +20308,6 @@ async def test_transfer_entitlements_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.TransferEntitlementsRequest() - assert args[0] == request_msg @@ -20299,7 +20334,6 @@ async def test_transfer_entitlements_to_google_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.TransferEntitlementsToGoogleRequest() - assert args[0] == request_msg @@ -20328,7 +20362,6 @@ async def test_list_channel_partner_links_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListChannelPartnerLinksRequest() - assert args[0] == request_msg @@ -20361,7 +20394,6 @@ async def test_get_channel_partner_link_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetChannelPartnerLinkRequest() - assert args[0] == request_msg @@ -20394,7 +20426,6 @@ async def test_create_channel_partner_link_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateChannelPartnerLinkRequest() - assert args[0] == request_msg @@ -20427,7 +20458,6 @@ async def test_update_channel_partner_link_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateChannelPartnerLinkRequest() - assert args[0] == request_msg @@ -20456,7 +20486,6 @@ async def test_get_customer_repricing_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetCustomerRepricingConfigRequest() - assert args[0] == request_msg @@ -20485,7 +20514,6 @@ async def test_list_customer_repricing_configs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListCustomerRepricingConfigsRequest() - assert args[0] == request_msg @@ -20514,7 +20542,6 @@ async def test_create_customer_repricing_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateCustomerRepricingConfigRequest() - assert args[0] == request_msg @@ -20543,7 +20570,6 @@ async def test_update_customer_repricing_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateCustomerRepricingConfigRequest() - assert args[0] == request_msg @@ -20568,7 +20594,6 @@ async def test_delete_customer_repricing_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteCustomerRepricingConfigRequest() - assert args[0] == request_msg @@ -20597,7 +20622,6 @@ async def test_get_channel_partner_repricing_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetChannelPartnerRepricingConfigRequest() - assert args[0] == request_msg @@ -20626,7 +20650,6 @@ async def test_list_channel_partner_repricing_configs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListChannelPartnerRepricingConfigsRequest() - assert args[0] == request_msg @@ -20655,7 +20678,6 @@ async def test_create_channel_partner_repricing_config_empty_call_grpc_asyncio() call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateChannelPartnerRepricingConfigRequest() - assert args[0] == request_msg @@ -20684,7 +20706,6 @@ async def test_update_channel_partner_repricing_config_empty_call_grpc_asyncio() call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateChannelPartnerRepricingConfigRequest() - assert args[0] == request_msg @@ -20709,7 +20730,6 @@ async def test_delete_channel_partner_repricing_config_empty_call_grpc_asyncio() call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteChannelPartnerRepricingConfigRequest() - assert args[0] == request_msg @@ -20736,7 +20756,6 @@ async def test_list_sku_groups_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListSkuGroupsRequest() - assert args[0] == request_msg @@ -20765,7 +20784,6 @@ async def test_list_sku_group_billable_skus_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListSkuGroupBillableSkusRequest() - assert args[0] == request_msg @@ -20793,7 +20811,6 @@ async def test_lookup_offer_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.LookupOfferRequest() - assert args[0] == request_msg @@ -20820,7 +20837,6 @@ async def test_list_products_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListProductsRequest() - assert args[0] == request_msg @@ -20847,7 +20863,6 @@ async def test_list_skus_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListSkusRequest() - assert args[0] == request_msg @@ -20874,7 +20889,6 @@ async def test_list_offers_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListOffersRequest() - assert args[0] == request_msg @@ -20903,7 +20917,6 @@ async def test_list_purchasable_skus_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListPurchasableSkusRequest() - assert args[0] == request_msg @@ -20932,7 +20945,6 @@ async def test_list_purchasable_offers_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListPurchasableOffersRequest() - assert args[0] == request_msg @@ -20959,7 +20971,6 @@ async def test_query_eligible_billing_accounts_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.QueryEligibleBillingAccountsRequest() - assert args[0] == request_msg @@ -20988,7 +20999,6 @@ async def test_register_subscriber_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.RegisterSubscriberRequest() - assert args[0] == request_msg @@ -21017,7 +21027,6 @@ async def test_unregister_subscriber_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UnregisterSubscriberRequest() - assert args[0] == request_msg @@ -21046,7 +21055,6 @@ async def test_list_subscribers_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListSubscribersRequest() - assert args[0] == request_msg @@ -21075,7 +21083,6 @@ async def test_list_entitlement_changes_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListEntitlementChangesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-chronicle/noxfile.py b/packages/google-cloud-chronicle/noxfile.py index d77a0aa720a7..0bd323608bc8 100644 --- a/packages/google-cloud-chronicle/noxfile.py +++ b/packages/google-cloud-chronicle/noxfile.py @@ -47,7 +47,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-chronicle" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-chronicle/setup.py b/packages/google-cloud-chronicle/setup.py index 83c9959c32aa..238ccb8ccf34 100644 --- a/packages/google-cloud-chronicle/setup.py +++ b/packages/google-cloud-chronicle/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/google-cloud-chronicle/testing/constraints-3.10.txt b/packages/google-cloud-chronicle/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-chronicle/testing/constraints-3.10.txt +++ b/packages/google-cloud-chronicle/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-chronicle/tests/unit/gapic/chronicle_v1/test_big_query_export_service.py b/packages/google-cloud-chronicle/tests/unit/gapic/chronicle_v1/test_big_query_export_service.py index 1e60b2bfcc42..2388031b63cc 100644 --- a/packages/google-cloud-chronicle/tests/unit/gapic/chronicle_v1/test_big_query_export_service.py +++ b/packages/google-cloud-chronicle/tests/unit/gapic/chronicle_v1/test_big_query_export_service.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 @@ -110,6 +111,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" @@ -1381,8 +1397,8 @@ def test_big_query_export_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - big_query_export.GetBigQueryExportRequest, - dict, + big_query_export.GetBigQueryExportRequest(), + {}, ], ) def test_get_big_query_export(request_type, transport: str = "grpc"): @@ -1393,7 +1409,7 @@ def test_get_big_query_export(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1448,9 +1464,10 @@ def test_get_big_query_export_non_empty_request_with_auto_populated_field(): client.get_big_query_export(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == big_query_export.GetBigQueryExportRequest( + request_msg = big_query_export.GetBigQueryExportRequest( name="name_value", ) + assert args[0] == request_msg def test_get_big_query_export_use_cached_wrapped_rpc(): @@ -1535,9 +1552,15 @@ async def test_get_big_query_export_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + big_query_export.GetBigQueryExportRequest(), + {}, + ], +) async def test_get_big_query_export_async( - transport: str = "grpc_asyncio", - request_type=big_query_export.GetBigQueryExportRequest, + request_type, transport: str = "grpc_asyncio" ): client = BigQueryExportServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1546,7 +1569,7 @@ async def test_get_big_query_export_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( @@ -1578,11 +1601,6 @@ async def test_get_big_query_export_async( ) -@pytest.mark.asyncio -async def test_get_big_query_export_async_from_dict(): - await test_get_big_query_export_async(request_type=dict) - - def test_get_big_query_export_field_headers(): client = BigQueryExportServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1737,8 +1755,8 @@ async def test_get_big_query_export_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcc_big_query_export.UpdateBigQueryExportRequest, - dict, + gcc_big_query_export.UpdateBigQueryExportRequest(), + {}, ], ) def test_update_big_query_export(request_type, transport: str = "grpc"): @@ -1749,7 +1767,7 @@ def test_update_big_query_export(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1802,7 +1820,8 @@ def test_update_big_query_export_non_empty_request_with_auto_populated_field(): client.update_big_query_export(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcc_big_query_export.UpdateBigQueryExportRequest() + request_msg = gcc_big_query_export.UpdateBigQueryExportRequest() + assert args[0] == request_msg def test_update_big_query_export_use_cached_wrapped_rpc(): @@ -1888,9 +1907,15 @@ async def test_update_big_query_export_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcc_big_query_export.UpdateBigQueryExportRequest(), + {}, + ], +) async def test_update_big_query_export_async( - transport: str = "grpc_asyncio", - request_type=gcc_big_query_export.UpdateBigQueryExportRequest, + request_type, transport: str = "grpc_asyncio" ): client = BigQueryExportServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1899,7 +1924,7 @@ async def test_update_big_query_export_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( @@ -1931,11 +1956,6 @@ async def test_update_big_query_export_async( ) -@pytest.mark.asyncio -async def test_update_big_query_export_async_from_dict(): - await test_update_big_query_export_async(request_type=dict) - - def test_update_big_query_export_field_headers(): client = BigQueryExportServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2100,8 +2120,8 @@ async def test_update_big_query_export_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - big_query_export.ProvisionBigQueryExportRequest, - dict, + big_query_export.ProvisionBigQueryExportRequest(), + {}, ], ) def test_provision_big_query_export(request_type, transport: str = "grpc"): @@ -2112,7 +2132,7 @@ def test_provision_big_query_export(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2167,9 +2187,10 @@ def test_provision_big_query_export_non_empty_request_with_auto_populated_field( client.provision_big_query_export(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == big_query_export.ProvisionBigQueryExportRequest( + request_msg = big_query_export.ProvisionBigQueryExportRequest( parent="parent_value", ) + assert args[0] == request_msg def test_provision_big_query_export_use_cached_wrapped_rpc(): @@ -2255,9 +2276,15 @@ async def test_provision_big_query_export_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + big_query_export.ProvisionBigQueryExportRequest(), + {}, + ], +) async def test_provision_big_query_export_async( - transport: str = "grpc_asyncio", - request_type=big_query_export.ProvisionBigQueryExportRequest, + request_type, transport: str = "grpc_asyncio" ): client = BigQueryExportServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2266,7 +2293,7 @@ async def test_provision_big_query_export_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( @@ -2298,11 +2325,6 @@ async def test_provision_big_query_export_async( ) -@pytest.mark.asyncio -async def test_provision_big_query_export_async_from_dict(): - await test_provision_big_query_export_async(request_type=dict) - - def test_provision_big_query_export_field_headers(): client = BigQueryExportServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3136,7 +3158,6 @@ def test_get_big_query_export_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = big_query_export.GetBigQueryExportRequest() - assert args[0] == request_msg @@ -3159,7 +3180,6 @@ def test_update_big_query_export_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcc_big_query_export.UpdateBigQueryExportRequest() - assert args[0] == request_msg @@ -3182,7 +3202,6 @@ def test_provision_big_query_export_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = big_query_export.ProvisionBigQueryExportRequest() - assert args[0] == request_msg @@ -3227,7 +3246,6 @@ async def test_get_big_query_export_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = big_query_export.GetBigQueryExportRequest() - assert args[0] == request_msg @@ -3258,7 +3276,6 @@ async def test_update_big_query_export_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcc_big_query_export.UpdateBigQueryExportRequest() - assert args[0] == request_msg @@ -3289,7 +3306,6 @@ async def test_provision_big_query_export_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = big_query_export.ProvisionBigQueryExportRequest() - assert args[0] == request_msg @@ -4116,7 +4132,6 @@ def test_get_big_query_export_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = big_query_export.GetBigQueryExportRequest() - assert args[0] == request_msg @@ -4138,7 +4153,6 @@ def test_update_big_query_export_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcc_big_query_export.UpdateBigQueryExportRequest() - assert args[0] == request_msg @@ -4160,7 +4174,6 @@ def test_provision_big_query_export_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = big_query_export.ProvisionBigQueryExportRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-chronicle/tests/unit/gapic/chronicle_v1/test_dashboard_chart_service.py b/packages/google-cloud-chronicle/tests/unit/gapic/chronicle_v1/test_dashboard_chart_service.py index 438841d588b3..d00e3de6d6c2 100644 --- a/packages/google-cloud-chronicle/tests/unit/gapic/chronicle_v1/test_dashboard_chart_service.py +++ b/packages/google-cloud-chronicle/tests/unit/gapic/chronicle_v1/test_dashboard_chart_service.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 @@ -107,6 +108,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" @@ -1376,8 +1392,8 @@ def test_dashboard_chart_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - dashboard_chart.GetDashboardChartRequest, - dict, + dashboard_chart.GetDashboardChartRequest(), + {}, ], ) def test_get_dashboard_chart(request_type, transport: str = "grpc"): @@ -1388,7 +1404,7 @@ def test_get_dashboard_chart(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1448,9 +1464,10 @@ def test_get_dashboard_chart_non_empty_request_with_auto_populated_field(): client.get_dashboard_chart(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dashboard_chart.GetDashboardChartRequest( + request_msg = dashboard_chart.GetDashboardChartRequest( name="name_value", ) + assert args[0] == request_msg def test_get_dashboard_chart_use_cached_wrapped_rpc(): @@ -1535,10 +1552,14 @@ async def test_get_dashboard_chart_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_dashboard_chart_async( - transport: str = "grpc_asyncio", - request_type=dashboard_chart.GetDashboardChartRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + dashboard_chart.GetDashboardChartRequest(), + {}, + ], +) +async def test_get_dashboard_chart_async(request_type, transport: str = "grpc_asyncio"): client = DashboardChartServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1546,7 +1567,7 @@ async def test_get_dashboard_chart_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( @@ -1583,11 +1604,6 @@ async def test_get_dashboard_chart_async( assert response.tokens == ["tokens_value"] -@pytest.mark.asyncio -async def test_get_dashboard_chart_async_from_dict(): - await test_get_dashboard_chart_async(request_type=dict) - - def test_get_dashboard_chart_field_headers(): client = DashboardChartServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1742,8 +1758,8 @@ async def test_get_dashboard_chart_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dashboard_chart.BatchGetDashboardChartsRequest, - dict, + dashboard_chart.BatchGetDashboardChartsRequest(), + {}, ], ) def test_batch_get_dashboard_charts(request_type, transport: str = "grpc"): @@ -1754,7 +1770,7 @@ def test_batch_get_dashboard_charts(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1799,9 +1815,10 @@ def test_batch_get_dashboard_charts_non_empty_request_with_auto_populated_field( client.batch_get_dashboard_charts(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dashboard_chart.BatchGetDashboardChartsRequest( + request_msg = dashboard_chart.BatchGetDashboardChartsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_batch_get_dashboard_charts_use_cached_wrapped_rpc(): @@ -1887,9 +1904,15 @@ async def test_batch_get_dashboard_charts_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dashboard_chart.BatchGetDashboardChartsRequest(), + {}, + ], +) async def test_batch_get_dashboard_charts_async( - transport: str = "grpc_asyncio", - request_type=dashboard_chart.BatchGetDashboardChartsRequest, + request_type, transport: str = "grpc_asyncio" ): client = DashboardChartServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1898,7 +1921,7 @@ async def test_batch_get_dashboard_charts_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( @@ -1920,11 +1943,6 @@ async def test_batch_get_dashboard_charts_async( assert isinstance(response, dashboard_chart.BatchGetDashboardChartsResponse) -@pytest.mark.asyncio -async def test_batch_get_dashboard_charts_async_from_dict(): - await test_batch_get_dashboard_charts_async(request_type=dict) - - def test_batch_get_dashboard_charts_field_headers(): client = DashboardChartServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2607,7 +2625,6 @@ def test_get_dashboard_chart_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dashboard_chart.GetDashboardChartRequest() - assert args[0] == request_msg @@ -2630,7 +2647,6 @@ def test_batch_get_dashboard_charts_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dashboard_chart.BatchGetDashboardChartsRequest() - assert args[0] == request_msg @@ -2679,7 +2695,6 @@ async def test_get_dashboard_chart_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dashboard_chart.GetDashboardChartRequest() - assert args[0] == request_msg @@ -2706,7 +2721,6 @@ async def test_batch_get_dashboard_charts_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dashboard_chart.BatchGetDashboardChartsRequest() - assert args[0] == request_msg @@ -3293,7 +3307,6 @@ def test_get_dashboard_chart_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dashboard_chart.GetDashboardChartRequest() - assert args[0] == request_msg @@ -3315,7 +3328,6 @@ def test_batch_get_dashboard_charts_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dashboard_chart.BatchGetDashboardChartsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-chronicle/tests/unit/gapic/chronicle_v1/test_dashboard_query_service.py b/packages/google-cloud-chronicle/tests/unit/gapic/chronicle_v1/test_dashboard_query_service.py index 0c18f4f33717..4c30bd4666c3 100644 --- a/packages/google-cloud-chronicle/tests/unit/gapic/chronicle_v1/test_dashboard_query_service.py +++ b/packages/google-cloud-chronicle/tests/unit/gapic/chronicle_v1/test_dashboard_query_service.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 @@ -109,6 +110,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" @@ -1378,8 +1394,8 @@ def test_dashboard_query_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - dashboard_query.GetDashboardQueryRequest, - dict, + dashboard_query.GetDashboardQueryRequest(), + {}, ], ) def test_get_dashboard_query(request_type, transport: str = "grpc"): @@ -1390,7 +1406,7 @@ def test_get_dashboard_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( @@ -1444,9 +1460,10 @@ def test_get_dashboard_query_non_empty_request_with_auto_populated_field(): client.get_dashboard_query(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dashboard_query.GetDashboardQueryRequest( + request_msg = dashboard_query.GetDashboardQueryRequest( name="name_value", ) + assert args[0] == request_msg def test_get_dashboard_query_use_cached_wrapped_rpc(): @@ -1531,10 +1548,14 @@ async def test_get_dashboard_query_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_dashboard_query_async( - transport: str = "grpc_asyncio", - request_type=dashboard_query.GetDashboardQueryRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + dashboard_query.GetDashboardQueryRequest(), + {}, + ], +) +async def test_get_dashboard_query_async(request_type, transport: str = "grpc_asyncio"): client = DashboardQueryServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1542,7 +1563,7 @@ async def test_get_dashboard_query_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( @@ -1573,11 +1594,6 @@ async def test_get_dashboard_query_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_dashboard_query_async_from_dict(): - await test_get_dashboard_query_async(request_type=dict) - - def test_get_dashboard_query_field_headers(): client = DashboardQueryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1732,8 +1748,8 @@ async def test_get_dashboard_query_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dashboard_query.ExecuteDashboardQueryRequest, - dict, + dashboard_query.ExecuteDashboardQueryRequest(), + {}, ], ) def test_execute_dashboard_query(request_type, transport: str = "grpc"): @@ -1744,7 +1760,7 @@ def test_execute_dashboard_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( @@ -1794,9 +1810,10 @@ def test_execute_dashboard_query_non_empty_request_with_auto_populated_field(): client.execute_dashboard_query(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dashboard_query.ExecuteDashboardQueryRequest( + request_msg = dashboard_query.ExecuteDashboardQueryRequest( parent="parent_value", ) + assert args[0] == request_msg def test_execute_dashboard_query_use_cached_wrapped_rpc(): @@ -1882,9 +1899,15 @@ async def test_execute_dashboard_query_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dashboard_query.ExecuteDashboardQueryRequest(), + {}, + ], +) async def test_execute_dashboard_query_async( - transport: str = "grpc_asyncio", - request_type=dashboard_query.ExecuteDashboardQueryRequest, + request_type, transport: str = "grpc_asyncio" ): client = DashboardQueryServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1893,7 +1916,7 @@ async def test_execute_dashboard_query_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( @@ -1920,11 +1943,6 @@ async def test_execute_dashboard_query_async( assert response.language_features == [dashboard_query.LanguageFeature.JOINS] -@pytest.mark.asyncio -async def test_execute_dashboard_query_async_from_dict(): - await test_execute_dashboard_query_async(request_type=dict) - - def test_execute_dashboard_query_field_headers(): client = DashboardQueryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2593,7 +2611,6 @@ def test_get_dashboard_query_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dashboard_query.GetDashboardQueryRequest() - assert args[0] == request_msg @@ -2616,7 +2633,6 @@ def test_execute_dashboard_query_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dashboard_query.ExecuteDashboardQueryRequest() - assert args[0] == request_msg @@ -2662,7 +2678,6 @@ async def test_get_dashboard_query_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dashboard_query.GetDashboardQueryRequest() - assert args[0] == request_msg @@ -2692,7 +2707,6 @@ async def test_execute_dashboard_query_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dashboard_query.ExecuteDashboardQueryRequest() - assert args[0] == request_msg @@ -3278,7 +3292,6 @@ def test_get_dashboard_query_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dashboard_query.GetDashboardQueryRequest() - assert args[0] == request_msg @@ -3300,7 +3313,6 @@ def test_execute_dashboard_query_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dashboard_query.ExecuteDashboardQueryRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-chronicle/tests/unit/gapic/chronicle_v1/test_data_access_control_service.py b/packages/google-cloud-chronicle/tests/unit/gapic/chronicle_v1/test_data_access_control_service.py index f8b31a39b9f5..1c8133b2e450 100644 --- a/packages/google-cloud-chronicle/tests/unit/gapic/chronicle_v1/test_data_access_control_service.py +++ b/packages/google-cloud-chronicle/tests/unit/gapic/chronicle_v1/test_data_access_control_service.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 @@ -110,6 +111,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" @@ -1385,8 +1401,8 @@ def test_data_access_control_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - data_access_control.CreateDataAccessLabelRequest, - dict, + data_access_control.CreateDataAccessLabelRequest(), + {}, ], ) def test_create_data_access_label(request_type, transport: str = "grpc"): @@ -1397,7 +1413,7 @@ def test_create_data_access_label(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1455,10 +1471,11 @@ def test_create_data_access_label_non_empty_request_with_auto_populated_field(): client.create_data_access_label(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_access_control.CreateDataAccessLabelRequest( + request_msg = data_access_control.CreateDataAccessLabelRequest( parent="parent_value", data_access_label_id="data_access_label_id_value", ) + assert args[0] == request_msg def test_create_data_access_label_use_cached_wrapped_rpc(): @@ -1544,9 +1561,15 @@ async def test_create_data_access_label_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_access_control.CreateDataAccessLabelRequest(), + {}, + ], +) async def test_create_data_access_label_async( - transport: str = "grpc_asyncio", - request_type=data_access_control.CreateDataAccessLabelRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataAccessControlServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1555,7 +1578,7 @@ async def test_create_data_access_label_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( @@ -1588,11 +1611,6 @@ async def test_create_data_access_label_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_create_data_access_label_async_from_dict(): - await test_create_data_access_label_async(request_type=dict) - - def test_create_data_access_label_field_headers(): client = DataAccessControlServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1775,8 +1793,8 @@ async def test_create_data_access_label_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_access_control.GetDataAccessLabelRequest, - dict, + data_access_control.GetDataAccessLabelRequest(), + {}, ], ) def test_get_data_access_label(request_type, transport: str = "grpc"): @@ -1787,7 +1805,7 @@ def test_get_data_access_label(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1844,9 +1862,10 @@ def test_get_data_access_label_non_empty_request_with_auto_populated_field(): client.get_data_access_label(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_access_control.GetDataAccessLabelRequest( + request_msg = data_access_control.GetDataAccessLabelRequest( name="name_value", ) + assert args[0] == request_msg def test_get_data_access_label_use_cached_wrapped_rpc(): @@ -1932,9 +1951,15 @@ async def test_get_data_access_label_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_access_control.GetDataAccessLabelRequest(), + {}, + ], +) async def test_get_data_access_label_async( - transport: str = "grpc_asyncio", - request_type=data_access_control.GetDataAccessLabelRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataAccessControlServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1943,7 +1968,7 @@ async def test_get_data_access_label_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( @@ -1976,11 +2001,6 @@ async def test_get_data_access_label_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_get_data_access_label_async_from_dict(): - await test_get_data_access_label_async(request_type=dict) - - def test_get_data_access_label_field_headers(): client = DataAccessControlServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2135,8 +2155,8 @@ async def test_get_data_access_label_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_access_control.ListDataAccessLabelsRequest, - dict, + data_access_control.ListDataAccessLabelsRequest(), + {}, ], ) def test_list_data_access_labels(request_type, transport: str = "grpc"): @@ -2147,7 +2167,7 @@ def test_list_data_access_labels(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2197,11 +2217,12 @@ def test_list_data_access_labels_non_empty_request_with_auto_populated_field(): client.list_data_access_labels(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_access_control.ListDataAccessLabelsRequest( + request_msg = data_access_control.ListDataAccessLabelsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_data_access_labels_use_cached_wrapped_rpc(): @@ -2287,9 +2308,15 @@ async def test_list_data_access_labels_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_access_control.ListDataAccessLabelsRequest(), + {}, + ], +) async def test_list_data_access_labels_async( - transport: str = "grpc_asyncio", - request_type=data_access_control.ListDataAccessLabelsRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataAccessControlServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2298,7 +2325,7 @@ async def test_list_data_access_labels_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( @@ -2323,11 +2350,6 @@ async def test_list_data_access_labels_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_data_access_labels_async_from_dict(): - await test_list_data_access_labels_async(request_type=dict) - - def test_list_data_access_labels_field_headers(): client = DataAccessControlServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2682,8 +2704,8 @@ async def test_list_data_access_labels_async_pages(): @pytest.mark.parametrize( "request_type", [ - data_access_control.UpdateDataAccessLabelRequest, - dict, + data_access_control.UpdateDataAccessLabelRequest(), + {}, ], ) def test_update_data_access_label(request_type, transport: str = "grpc"): @@ -2694,7 +2716,7 @@ def test_update_data_access_label(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,7 +2771,8 @@ def test_update_data_access_label_non_empty_request_with_auto_populated_field(): client.update_data_access_label(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_access_control.UpdateDataAccessLabelRequest() + request_msg = data_access_control.UpdateDataAccessLabelRequest() + assert args[0] == request_msg def test_update_data_access_label_use_cached_wrapped_rpc(): @@ -2835,9 +2858,15 @@ async def test_update_data_access_label_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_access_control.UpdateDataAccessLabelRequest(), + {}, + ], +) async def test_update_data_access_label_async( - transport: str = "grpc_asyncio", - request_type=data_access_control.UpdateDataAccessLabelRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataAccessControlServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2846,7 +2875,7 @@ async def test_update_data_access_label_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( @@ -2879,11 +2908,6 @@ async def test_update_data_access_label_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_update_data_access_label_async_from_dict(): - await test_update_data_access_label_async(request_type=dict) - - def test_update_data_access_label_field_headers(): client = DataAccessControlServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3056,8 +3080,8 @@ async def test_update_data_access_label_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_access_control.DeleteDataAccessLabelRequest, - dict, + data_access_control.DeleteDataAccessLabelRequest(), + {}, ], ) def test_delete_data_access_label(request_type, transport: str = "grpc"): @@ -3068,7 +3092,7 @@ def test_delete_data_access_label(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3113,9 +3137,10 @@ def test_delete_data_access_label_non_empty_request_with_auto_populated_field(): client.delete_data_access_label(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_access_control.DeleteDataAccessLabelRequest( + request_msg = data_access_control.DeleteDataAccessLabelRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_data_access_label_use_cached_wrapped_rpc(): @@ -3201,9 +3226,15 @@ async def test_delete_data_access_label_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_access_control.DeleteDataAccessLabelRequest(), + {}, + ], +) async def test_delete_data_access_label_async( - transport: str = "grpc_asyncio", - request_type=data_access_control.DeleteDataAccessLabelRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataAccessControlServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3212,7 +3243,7 @@ async def test_delete_data_access_label_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( @@ -3232,11 +3263,6 @@ async def test_delete_data_access_label_async( assert response is None -@pytest.mark.asyncio -async def test_delete_data_access_label_async_from_dict(): - await test_delete_data_access_label_async(request_type=dict) - - def test_delete_data_access_label_field_headers(): client = DataAccessControlServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3387,8 +3413,8 @@ async def test_delete_data_access_label_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_access_control.CreateDataAccessScopeRequest, - dict, + data_access_control.CreateDataAccessScopeRequest(), + {}, ], ) def test_create_data_access_scope(request_type, transport: str = "grpc"): @@ -3399,7 +3425,7 @@ def test_create_data_access_scope(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3458,10 +3484,11 @@ def test_create_data_access_scope_non_empty_request_with_auto_populated_field(): client.create_data_access_scope(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_access_control.CreateDataAccessScopeRequest( + request_msg = data_access_control.CreateDataAccessScopeRequest( parent="parent_value", data_access_scope_id="data_access_scope_id_value", ) + assert args[0] == request_msg def test_create_data_access_scope_use_cached_wrapped_rpc(): @@ -3547,9 +3574,15 @@ async def test_create_data_access_scope_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_access_control.CreateDataAccessScopeRequest(), + {}, + ], +) async def test_create_data_access_scope_async( - transport: str = "grpc_asyncio", - request_type=data_access_control.CreateDataAccessScopeRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataAccessControlServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3558,7 +3591,7 @@ async def test_create_data_access_scope_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( @@ -3593,11 +3626,6 @@ async def test_create_data_access_scope_async( assert response.allow_all is True -@pytest.mark.asyncio -async def test_create_data_access_scope_async_from_dict(): - await test_create_data_access_scope_async(request_type=dict) - - def test_create_data_access_scope_field_headers(): client = DataAccessControlServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3772,8 +3800,8 @@ async def test_create_data_access_scope_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_access_control.GetDataAccessScopeRequest, - dict, + data_access_control.GetDataAccessScopeRequest(), + {}, ], ) def test_get_data_access_scope(request_type, transport: str = "grpc"): @@ -3784,7 +3812,7 @@ def test_get_data_access_scope(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3842,9 +3870,10 @@ def test_get_data_access_scope_non_empty_request_with_auto_populated_field(): client.get_data_access_scope(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_access_control.GetDataAccessScopeRequest( + request_msg = data_access_control.GetDataAccessScopeRequest( name="name_value", ) + assert args[0] == request_msg def test_get_data_access_scope_use_cached_wrapped_rpc(): @@ -3930,9 +3959,15 @@ async def test_get_data_access_scope_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_access_control.GetDataAccessScopeRequest(), + {}, + ], +) async def test_get_data_access_scope_async( - transport: str = "grpc_asyncio", - request_type=data_access_control.GetDataAccessScopeRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataAccessControlServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3941,7 +3976,7 @@ async def test_get_data_access_scope_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( @@ -3976,11 +4011,6 @@ async def test_get_data_access_scope_async( assert response.allow_all is True -@pytest.mark.asyncio -async def test_get_data_access_scope_async_from_dict(): - await test_get_data_access_scope_async(request_type=dict) - - def test_get_data_access_scope_field_headers(): client = DataAccessControlServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4135,8 +4165,8 @@ async def test_get_data_access_scope_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_access_control.ListDataAccessScopesRequest, - dict, + data_access_control.ListDataAccessScopesRequest(), + {}, ], ) def test_list_data_access_scopes(request_type, transport: str = "grpc"): @@ -4147,7 +4177,7 @@ def test_list_data_access_scopes(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4199,11 +4229,12 @@ def test_list_data_access_scopes_non_empty_request_with_auto_populated_field(): client.list_data_access_scopes(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_access_control.ListDataAccessScopesRequest( + request_msg = data_access_control.ListDataAccessScopesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_data_access_scopes_use_cached_wrapped_rpc(): @@ -4289,9 +4320,15 @@ async def test_list_data_access_scopes_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_access_control.ListDataAccessScopesRequest(), + {}, + ], +) async def test_list_data_access_scopes_async( - transport: str = "grpc_asyncio", - request_type=data_access_control.ListDataAccessScopesRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataAccessControlServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4300,7 +4337,7 @@ async def test_list_data_access_scopes_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( @@ -4327,11 +4364,6 @@ async def test_list_data_access_scopes_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_data_access_scopes_async_from_dict(): - await test_list_data_access_scopes_async(request_type=dict) - - def test_list_data_access_scopes_field_headers(): client = DataAccessControlServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4686,8 +4718,8 @@ async def test_list_data_access_scopes_async_pages(): @pytest.mark.parametrize( "request_type", [ - data_access_control.UpdateDataAccessScopeRequest, - dict, + data_access_control.UpdateDataAccessScopeRequest(), + {}, ], ) def test_update_data_access_scope(request_type, transport: str = "grpc"): @@ -4698,7 +4730,7 @@ def test_update_data_access_scope(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4754,7 +4786,8 @@ def test_update_data_access_scope_non_empty_request_with_auto_populated_field(): client.update_data_access_scope(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_access_control.UpdateDataAccessScopeRequest() + request_msg = data_access_control.UpdateDataAccessScopeRequest() + assert args[0] == request_msg def test_update_data_access_scope_use_cached_wrapped_rpc(): @@ -4840,9 +4873,15 @@ async def test_update_data_access_scope_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_access_control.UpdateDataAccessScopeRequest(), + {}, + ], +) async def test_update_data_access_scope_async( - transport: str = "grpc_asyncio", - request_type=data_access_control.UpdateDataAccessScopeRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataAccessControlServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4851,7 +4890,7 @@ async def test_update_data_access_scope_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( @@ -4886,11 +4925,6 @@ async def test_update_data_access_scope_async( assert response.allow_all is True -@pytest.mark.asyncio -async def test_update_data_access_scope_async_from_dict(): - await test_update_data_access_scope_async(request_type=dict) - - def test_update_data_access_scope_field_headers(): client = DataAccessControlServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5055,8 +5089,8 @@ async def test_update_data_access_scope_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_access_control.DeleteDataAccessScopeRequest, - dict, + data_access_control.DeleteDataAccessScopeRequest(), + {}, ], ) def test_delete_data_access_scope(request_type, transport: str = "grpc"): @@ -5067,7 +5101,7 @@ def test_delete_data_access_scope(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5112,9 +5146,10 @@ def test_delete_data_access_scope_non_empty_request_with_auto_populated_field(): client.delete_data_access_scope(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_access_control.DeleteDataAccessScopeRequest( + request_msg = data_access_control.DeleteDataAccessScopeRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_data_access_scope_use_cached_wrapped_rpc(): @@ -5200,9 +5235,15 @@ async def test_delete_data_access_scope_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_access_control.DeleteDataAccessScopeRequest(), + {}, + ], +) async def test_delete_data_access_scope_async( - transport: str = "grpc_asyncio", - request_type=data_access_control.DeleteDataAccessScopeRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataAccessControlServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5211,7 +5252,7 @@ async def test_delete_data_access_scope_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( @@ -5231,11 +5272,6 @@ async def test_delete_data_access_scope_async( assert response is None -@pytest.mark.asyncio -async def test_delete_data_access_scope_async_from_dict(): - await test_delete_data_access_scope_async(request_type=dict) - - def test_delete_data_access_scope_field_headers(): client = DataAccessControlServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7592,7 +7628,6 @@ def test_create_data_access_label_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_access_control.CreateDataAccessLabelRequest() - assert args[0] == request_msg @@ -7615,7 +7650,6 @@ def test_get_data_access_label_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_access_control.GetDataAccessLabelRequest() - assert args[0] == request_msg @@ -7638,7 +7672,6 @@ def test_list_data_access_labels_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_access_control.ListDataAccessLabelsRequest() - assert args[0] == request_msg @@ -7661,7 +7694,6 @@ def test_update_data_access_label_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_access_control.UpdateDataAccessLabelRequest() - assert args[0] == request_msg @@ -7684,7 +7716,6 @@ def test_delete_data_access_label_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_access_control.DeleteDataAccessLabelRequest() - assert args[0] == request_msg @@ -7707,7 +7738,6 @@ def test_create_data_access_scope_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_access_control.CreateDataAccessScopeRequest() - assert args[0] == request_msg @@ -7730,7 +7760,6 @@ def test_get_data_access_scope_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_access_control.GetDataAccessScopeRequest() - assert args[0] == request_msg @@ -7753,7 +7782,6 @@ def test_list_data_access_scopes_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_access_control.ListDataAccessScopesRequest() - assert args[0] == request_msg @@ -7776,7 +7804,6 @@ def test_update_data_access_scope_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_access_control.UpdateDataAccessScopeRequest() - assert args[0] == request_msg @@ -7799,7 +7826,6 @@ def test_delete_data_access_scope_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_access_control.DeleteDataAccessScopeRequest() - assert args[0] == request_msg @@ -7846,7 +7872,6 @@ async def test_create_data_access_label_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_access_control.CreateDataAccessLabelRequest() - assert args[0] == request_msg @@ -7879,7 +7904,6 @@ async def test_get_data_access_label_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_access_control.GetDataAccessLabelRequest() - assert args[0] == request_msg @@ -7908,7 +7932,6 @@ async def test_list_data_access_labels_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_access_control.ListDataAccessLabelsRequest() - assert args[0] == request_msg @@ -7941,7 +7964,6 @@ async def test_update_data_access_label_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_access_control.UpdateDataAccessLabelRequest() - assert args[0] == request_msg @@ -7966,7 +7988,6 @@ async def test_delete_data_access_label_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_access_control.DeleteDataAccessLabelRequest() - assert args[0] == request_msg @@ -8000,7 +8021,6 @@ async def test_create_data_access_scope_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_access_control.CreateDataAccessScopeRequest() - assert args[0] == request_msg @@ -8034,7 +8054,6 @@ async def test_get_data_access_scope_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_access_control.GetDataAccessScopeRequest() - assert args[0] == request_msg @@ -8064,7 +8083,6 @@ async def test_list_data_access_scopes_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_access_control.ListDataAccessScopesRequest() - assert args[0] == request_msg @@ -8098,7 +8116,6 @@ async def test_update_data_access_scope_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_access_control.UpdateDataAccessScopeRequest() - assert args[0] == request_msg @@ -8123,7 +8140,6 @@ async def test_delete_data_access_scope_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_access_control.DeleteDataAccessScopeRequest() - assert args[0] == request_msg @@ -10185,7 +10201,6 @@ def test_create_data_access_label_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_access_control.CreateDataAccessLabelRequest() - assert args[0] == request_msg @@ -10207,7 +10222,6 @@ def test_get_data_access_label_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_access_control.GetDataAccessLabelRequest() - assert args[0] == request_msg @@ -10229,7 +10243,6 @@ def test_list_data_access_labels_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_access_control.ListDataAccessLabelsRequest() - assert args[0] == request_msg @@ -10251,7 +10264,6 @@ def test_update_data_access_label_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_access_control.UpdateDataAccessLabelRequest() - assert args[0] == request_msg @@ -10273,7 +10285,6 @@ def test_delete_data_access_label_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_access_control.DeleteDataAccessLabelRequest() - assert args[0] == request_msg @@ -10295,7 +10306,6 @@ def test_create_data_access_scope_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_access_control.CreateDataAccessScopeRequest() - assert args[0] == request_msg @@ -10317,7 +10327,6 @@ def test_get_data_access_scope_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_access_control.GetDataAccessScopeRequest() - assert args[0] == request_msg @@ -10339,7 +10348,6 @@ def test_list_data_access_scopes_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_access_control.ListDataAccessScopesRequest() - assert args[0] == request_msg @@ -10361,7 +10369,6 @@ def test_update_data_access_scope_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_access_control.UpdateDataAccessScopeRequest() - assert args[0] == request_msg @@ -10383,7 +10390,6 @@ def test_delete_data_access_scope_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_access_control.DeleteDataAccessScopeRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-chronicle/tests/unit/gapic/chronicle_v1/test_data_table_service.py b/packages/google-cloud-chronicle/tests/unit/gapic/chronicle_v1/test_data_table_service.py index b3485795f9f3..f251cdccae9f 100644 --- a/packages/google-cloud-chronicle/tests/unit/gapic/chronicle_v1/test_data_table_service.py +++ b/packages/google-cloud-chronicle/tests/unit/gapic/chronicle_v1/test_data_table_service.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" @@ -1349,8 +1365,8 @@ def test_data_table_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - gcc_data_table.CreateDataTableRequest, - dict, + gcc_data_table.CreateDataTableRequest(), + {}, ], ) def test_create_data_table(request_type, transport: str = "grpc"): @@ -1361,7 +1377,7 @@ def test_create_data_table(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1426,10 +1442,11 @@ def test_create_data_table_non_empty_request_with_auto_populated_field(): client.create_data_table(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcc_data_table.CreateDataTableRequest( + request_msg = gcc_data_table.CreateDataTableRequest( parent="parent_value", data_table_id="data_table_id_value", ) + assert args[0] == request_msg def test_create_data_table_use_cached_wrapped_rpc(): @@ -1512,9 +1529,14 @@ async def test_create_data_table_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_data_table_async( - transport: str = "grpc_asyncio", request_type=gcc_data_table.CreateDataTableRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcc_data_table.CreateDataTableRequest(), + {}, + ], +) +async def test_create_data_table_async(request_type, transport: str = "grpc_asyncio"): client = DataTableServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1522,7 +1544,7 @@ async def test_create_data_table_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( @@ -1563,11 +1585,6 @@ async def test_create_data_table_async( assert response.update_source == gcc_data_table.DataTableUpdateSource.USER -@pytest.mark.asyncio -async def test_create_data_table_async_from_dict(): - await test_create_data_table_async(request_type=dict) - - def test_create_data_table_field_headers(): client = DataTableServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1742,8 +1759,8 @@ async def test_create_data_table_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_table.ListDataTablesRequest, - dict, + data_table.ListDataTablesRequest(), + {}, ], ) def test_list_data_tables(request_type, transport: str = "grpc"): @@ -1754,7 +1771,7 @@ def test_list_data_tables(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_data_tables), "__call__") as call: @@ -1800,11 +1817,12 @@ def test_list_data_tables_non_empty_request_with_auto_populated_field(): client.list_data_tables(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_table.ListDataTablesRequest( + request_msg = data_table.ListDataTablesRequest( parent="parent_value", page_token="page_token_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_data_tables_use_cached_wrapped_rpc(): @@ -1887,9 +1905,14 @@ async def test_list_data_tables_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_data_tables_async( - transport: str = "grpc_asyncio", request_type=data_table.ListDataTablesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + data_table.ListDataTablesRequest(), + {}, + ], +) +async def test_list_data_tables_async(request_type, transport: str = "grpc_asyncio"): client = DataTableServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1897,7 +1920,7 @@ async def test_list_data_tables_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_data_tables), "__call__") as call: @@ -1920,11 +1943,6 @@ async def test_list_data_tables_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_data_tables_async_from_dict(): - await test_list_data_tables_async(request_type=dict) - - def test_list_data_tables_field_headers(): client = DataTableServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2261,8 +2279,8 @@ async def test_list_data_tables_async_pages(): @pytest.mark.parametrize( "request_type", [ - data_table.GetDataTableRequest, - dict, + data_table.GetDataTableRequest(), + {}, ], ) def test_get_data_table(request_type, transport: str = "grpc"): @@ -2273,7 +2291,7 @@ def test_get_data_table(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_data_table), "__call__") as call: @@ -2333,9 +2351,10 @@ def test_get_data_table_non_empty_request_with_auto_populated_field(): client.get_data_table(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_table.GetDataTableRequest( + request_msg = data_table.GetDataTableRequest( name="name_value", ) + assert args[0] == request_msg def test_get_data_table_use_cached_wrapped_rpc(): @@ -2416,9 +2435,14 @@ async def test_get_data_table_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_data_table_async( - transport: str = "grpc_asyncio", request_type=data_table.GetDataTableRequest -): +@pytest.mark.parametrize( + "request_type", + [ + data_table.GetDataTableRequest(), + {}, + ], +) +async def test_get_data_table_async(request_type, transport: str = "grpc_asyncio"): client = DataTableServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2426,7 +2450,7 @@ async def test_get_data_table_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_data_table), "__call__") as call: @@ -2465,11 +2489,6 @@ async def test_get_data_table_async( assert response.update_source == data_table.DataTableUpdateSource.USER -@pytest.mark.asyncio -async def test_get_data_table_async_from_dict(): - await test_get_data_table_async(request_type=dict) - - def test_get_data_table_field_headers(): client = DataTableServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2616,8 +2635,8 @@ async def test_get_data_table_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcc_data_table.UpdateDataTableRequest, - dict, + gcc_data_table.UpdateDataTableRequest(), + {}, ], ) def test_update_data_table(request_type, transport: str = "grpc"): @@ -2628,7 +2647,7 @@ def test_update_data_table(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2690,7 +2709,8 @@ def test_update_data_table_non_empty_request_with_auto_populated_field(): client.update_data_table(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcc_data_table.UpdateDataTableRequest() + request_msg = gcc_data_table.UpdateDataTableRequest() + assert args[0] == request_msg def test_update_data_table_use_cached_wrapped_rpc(): @@ -2773,9 +2793,14 @@ async def test_update_data_table_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_data_table_async( - transport: str = "grpc_asyncio", request_type=gcc_data_table.UpdateDataTableRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcc_data_table.UpdateDataTableRequest(), + {}, + ], +) +async def test_update_data_table_async(request_type, transport: str = "grpc_asyncio"): client = DataTableServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2783,7 +2808,7 @@ async def test_update_data_table_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( @@ -2824,11 +2849,6 @@ async def test_update_data_table_async( assert response.update_source == gcc_data_table.DataTableUpdateSource.USER -@pytest.mark.asyncio -async def test_update_data_table_async_from_dict(): - await test_update_data_table_async(request_type=dict) - - def test_update_data_table_field_headers(): client = DataTableServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2993,8 +3013,8 @@ async def test_update_data_table_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_table.DeleteDataTableRequest, - dict, + data_table.DeleteDataTableRequest(), + {}, ], ) def test_delete_data_table(request_type, transport: str = "grpc"): @@ -3005,7 +3025,7 @@ def test_delete_data_table(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,9 +3070,10 @@ def test_delete_data_table_non_empty_request_with_auto_populated_field(): client.delete_data_table(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_table.DeleteDataTableRequest( + request_msg = data_table.DeleteDataTableRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_data_table_use_cached_wrapped_rpc(): @@ -3135,9 +3156,14 @@ async def test_delete_data_table_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_data_table_async( - transport: str = "grpc_asyncio", request_type=data_table.DeleteDataTableRequest -): +@pytest.mark.parametrize( + "request_type", + [ + data_table.DeleteDataTableRequest(), + {}, + ], +) +async def test_delete_data_table_async(request_type, transport: str = "grpc_asyncio"): client = DataTableServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3145,7 +3171,7 @@ async def test_delete_data_table_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( @@ -3165,11 +3191,6 @@ async def test_delete_data_table_async( assert response is None -@pytest.mark.asyncio -async def test_delete_data_table_async_from_dict(): - await test_delete_data_table_async(request_type=dict) - - def test_delete_data_table_field_headers(): client = DataTableServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3330,8 +3351,8 @@ async def test_delete_data_table_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_table.CreateDataTableRowRequest, - dict, + data_table.CreateDataTableRowRequest(), + {}, ], ) def test_create_data_table_row(request_type, transport: str = "grpc"): @@ -3342,7 +3363,7 @@ def test_create_data_table_row(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3394,9 +3415,10 @@ def test_create_data_table_row_non_empty_request_with_auto_populated_field(): client.create_data_table_row(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_table.CreateDataTableRowRequest( + request_msg = data_table.CreateDataTableRowRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_data_table_row_use_cached_wrapped_rpc(): @@ -3482,8 +3504,15 @@ async def test_create_data_table_row_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_table.CreateDataTableRowRequest(), + {}, + ], +) async def test_create_data_table_row_async( - transport: str = "grpc_asyncio", request_type=data_table.CreateDataTableRowRequest + request_type, transport: str = "grpc_asyncio" ): client = DataTableServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3492,7 +3521,7 @@ async def test_create_data_table_row_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( @@ -3521,11 +3550,6 @@ async def test_create_data_table_row_async( assert response.row_time_to_live == "row_time_to_live_value" -@pytest.mark.asyncio -async def test_create_data_table_row_async_from_dict(): - await test_create_data_table_row_async(request_type=dict) - - def test_create_data_table_row_field_headers(): client = DataTableServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3690,8 +3714,8 @@ async def test_create_data_table_row_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_table.UpdateDataTableRowRequest, - dict, + data_table.UpdateDataTableRowRequest(), + {}, ], ) def test_update_data_table_row(request_type, transport: str = "grpc"): @@ -3702,7 +3726,7 @@ def test_update_data_table_row(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3752,7 +3776,8 @@ def test_update_data_table_row_non_empty_request_with_auto_populated_field(): client.update_data_table_row(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_table.UpdateDataTableRowRequest() + request_msg = data_table.UpdateDataTableRowRequest() + assert args[0] == request_msg def test_update_data_table_row_use_cached_wrapped_rpc(): @@ -3838,8 +3863,15 @@ async def test_update_data_table_row_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_table.UpdateDataTableRowRequest(), + {}, + ], +) async def test_update_data_table_row_async( - transport: str = "grpc_asyncio", request_type=data_table.UpdateDataTableRowRequest + request_type, transport: str = "grpc_asyncio" ): client = DataTableServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3848,7 +3880,7 @@ async def test_update_data_table_row_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( @@ -3877,11 +3909,6 @@ async def test_update_data_table_row_async( assert response.row_time_to_live == "row_time_to_live_value" -@pytest.mark.asyncio -async def test_update_data_table_row_async_from_dict(): - await test_update_data_table_row_async(request_type=dict) - - def test_update_data_table_row_field_headers(): client = DataTableServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4046,8 +4073,8 @@ async def test_update_data_table_row_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_table.ListDataTableRowsRequest, - dict, + data_table.ListDataTableRowsRequest(), + {}, ], ) def test_list_data_table_rows(request_type, transport: str = "grpc"): @@ -4058,7 +4085,7 @@ def test_list_data_table_rows(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4109,12 +4136,13 @@ def test_list_data_table_rows_non_empty_request_with_auto_populated_field(): client.list_data_table_rows(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_table.ListDataTableRowsRequest( + request_msg = data_table.ListDataTableRowsRequest( parent="parent_value", page_token="page_token_value", order_by="order_by_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_data_table_rows_use_cached_wrapped_rpc(): @@ -4199,8 +4227,15 @@ async def test_list_data_table_rows_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_table.ListDataTableRowsRequest(), + {}, + ], +) async def test_list_data_table_rows_async( - transport: str = "grpc_asyncio", request_type=data_table.ListDataTableRowsRequest + request_type, transport: str = "grpc_asyncio" ): client = DataTableServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4209,7 +4244,7 @@ async def test_list_data_table_rows_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( @@ -4234,11 +4269,6 @@ async def test_list_data_table_rows_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_data_table_rows_async_from_dict(): - await test_list_data_table_rows_async(request_type=dict) - - def test_list_data_table_rows_field_headers(): client = DataTableServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4591,8 +4621,8 @@ async def test_list_data_table_rows_async_pages(): @pytest.mark.parametrize( "request_type", [ - data_table.GetDataTableRowRequest, - dict, + data_table.GetDataTableRowRequest(), + {}, ], ) def test_get_data_table_row(request_type, transport: str = "grpc"): @@ -4603,7 +4633,7 @@ def test_get_data_table_row(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4655,9 +4685,10 @@ def test_get_data_table_row_non_empty_request_with_auto_populated_field(): client.get_data_table_row(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_table.GetDataTableRowRequest( + request_msg = data_table.GetDataTableRowRequest( name="name_value", ) + assert args[0] == request_msg def test_get_data_table_row_use_cached_wrapped_rpc(): @@ -4742,9 +4773,14 @@ async def test_get_data_table_row_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_data_table_row_async( - transport: str = "grpc_asyncio", request_type=data_table.GetDataTableRowRequest -): +@pytest.mark.parametrize( + "request_type", + [ + data_table.GetDataTableRowRequest(), + {}, + ], +) +async def test_get_data_table_row_async(request_type, transport: str = "grpc_asyncio"): client = DataTableServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4752,7 +4788,7 @@ async def test_get_data_table_row_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( @@ -4781,11 +4817,6 @@ async def test_get_data_table_row_async( assert response.row_time_to_live == "row_time_to_live_value" -@pytest.mark.asyncio -async def test_get_data_table_row_async_from_dict(): - await test_get_data_table_row_async(request_type=dict) - - def test_get_data_table_row_field_headers(): client = DataTableServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4940,8 +4971,8 @@ async def test_get_data_table_row_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_table.DeleteDataTableRowRequest, - dict, + data_table.DeleteDataTableRowRequest(), + {}, ], ) def test_delete_data_table_row(request_type, transport: str = "grpc"): @@ -4952,7 +4983,7 @@ def test_delete_data_table_row(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4997,9 +5028,10 @@ def test_delete_data_table_row_non_empty_request_with_auto_populated_field(): client.delete_data_table_row(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_table.DeleteDataTableRowRequest( + request_msg = data_table.DeleteDataTableRowRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_data_table_row_use_cached_wrapped_rpc(): @@ -5085,8 +5117,15 @@ async def test_delete_data_table_row_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_table.DeleteDataTableRowRequest(), + {}, + ], +) async def test_delete_data_table_row_async( - transport: str = "grpc_asyncio", request_type=data_table.DeleteDataTableRowRequest + request_type, transport: str = "grpc_asyncio" ): client = DataTableServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5095,7 +5134,7 @@ async def test_delete_data_table_row_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( @@ -5115,11 +5154,6 @@ async def test_delete_data_table_row_async( assert response is None -@pytest.mark.asyncio -async def test_delete_data_table_row_async_from_dict(): - await test_delete_data_table_row_async(request_type=dict) - - def test_delete_data_table_row_field_headers(): client = DataTableServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5270,8 +5304,8 @@ async def test_delete_data_table_row_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_table.BulkCreateDataTableRowsRequest, - dict, + data_table.BulkCreateDataTableRowsRequest(), + {}, ], ) def test_bulk_create_data_table_rows(request_type, transport: str = "grpc"): @@ -5282,7 +5316,7 @@ def test_bulk_create_data_table_rows(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5327,9 +5361,10 @@ def test_bulk_create_data_table_rows_non_empty_request_with_auto_populated_field client.bulk_create_data_table_rows(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_table.BulkCreateDataTableRowsRequest( + request_msg = data_table.BulkCreateDataTableRowsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_bulk_create_data_table_rows_use_cached_wrapped_rpc(): @@ -5415,9 +5450,15 @@ async def test_bulk_create_data_table_rows_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_table.BulkCreateDataTableRowsRequest(), + {}, + ], +) async def test_bulk_create_data_table_rows_async( - transport: str = "grpc_asyncio", - request_type=data_table.BulkCreateDataTableRowsRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataTableServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5426,7 +5467,7 @@ async def test_bulk_create_data_table_rows_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( @@ -5448,11 +5489,6 @@ async def test_bulk_create_data_table_rows_async( assert isinstance(response, data_table.BulkCreateDataTableRowsResponse) -@pytest.mark.asyncio -async def test_bulk_create_data_table_rows_async_from_dict(): - await test_bulk_create_data_table_rows_async(request_type=dict) - - def test_bulk_create_data_table_rows_field_headers(): client = DataTableServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5617,8 +5653,8 @@ async def test_bulk_create_data_table_rows_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_table.BulkGetDataTableRowsRequest, - dict, + data_table.BulkGetDataTableRowsRequest(), + {}, ], ) def test_bulk_get_data_table_rows(request_type, transport: str = "grpc"): @@ -5629,7 +5665,7 @@ def test_bulk_get_data_table_rows(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5674,9 +5710,10 @@ def test_bulk_get_data_table_rows_non_empty_request_with_auto_populated_field(): client.bulk_get_data_table_rows(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_table.BulkGetDataTableRowsRequest( + request_msg = data_table.BulkGetDataTableRowsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_bulk_get_data_table_rows_use_cached_wrapped_rpc(): @@ -5762,8 +5799,15 @@ async def test_bulk_get_data_table_rows_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_table.BulkGetDataTableRowsRequest(), + {}, + ], +) async def test_bulk_get_data_table_rows_async( - transport: str = "grpc_asyncio", request_type=data_table.BulkGetDataTableRowsRequest + request_type, transport: str = "grpc_asyncio" ): client = DataTableServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5772,7 +5816,7 @@ async def test_bulk_get_data_table_rows_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( @@ -5794,11 +5838,6 @@ async def test_bulk_get_data_table_rows_async( assert isinstance(response, data_table.BulkGetDataTableRowsResponse) -@pytest.mark.asyncio -async def test_bulk_get_data_table_rows_async_from_dict(): - await test_bulk_get_data_table_rows_async(request_type=dict) - - def test_bulk_get_data_table_rows_field_headers(): client = DataTableServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5963,8 +6002,8 @@ async def test_bulk_get_data_table_rows_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_table.BulkReplaceDataTableRowsRequest, - dict, + data_table.BulkReplaceDataTableRowsRequest(), + {}, ], ) def test_bulk_replace_data_table_rows(request_type, transport: str = "grpc"): @@ -5975,7 +6014,7 @@ def test_bulk_replace_data_table_rows(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6020,9 +6059,10 @@ def test_bulk_replace_data_table_rows_non_empty_request_with_auto_populated_fiel client.bulk_replace_data_table_rows(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_table.BulkReplaceDataTableRowsRequest( + request_msg = data_table.BulkReplaceDataTableRowsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_bulk_replace_data_table_rows_use_cached_wrapped_rpc(): @@ -6108,9 +6148,15 @@ async def test_bulk_replace_data_table_rows_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_table.BulkReplaceDataTableRowsRequest(), + {}, + ], +) async def test_bulk_replace_data_table_rows_async( - transport: str = "grpc_asyncio", - request_type=data_table.BulkReplaceDataTableRowsRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataTableServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -6119,7 +6165,7 @@ async def test_bulk_replace_data_table_rows_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( @@ -6141,11 +6187,6 @@ async def test_bulk_replace_data_table_rows_async( assert isinstance(response, data_table.BulkReplaceDataTableRowsResponse) -@pytest.mark.asyncio -async def test_bulk_replace_data_table_rows_async_from_dict(): - await test_bulk_replace_data_table_rows_async(request_type=dict) - - def test_bulk_replace_data_table_rows_field_headers(): client = DataTableServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6310,8 +6351,8 @@ async def test_bulk_replace_data_table_rows_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_table.BulkUpdateDataTableRowsRequest, - dict, + data_table.BulkUpdateDataTableRowsRequest(), + {}, ], ) def test_bulk_update_data_table_rows(request_type, transport: str = "grpc"): @@ -6322,7 +6363,7 @@ def test_bulk_update_data_table_rows(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6367,9 +6408,10 @@ def test_bulk_update_data_table_rows_non_empty_request_with_auto_populated_field client.bulk_update_data_table_rows(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_table.BulkUpdateDataTableRowsRequest( + request_msg = data_table.BulkUpdateDataTableRowsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_bulk_update_data_table_rows_use_cached_wrapped_rpc(): @@ -6455,9 +6497,15 @@ async def test_bulk_update_data_table_rows_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_table.BulkUpdateDataTableRowsRequest(), + {}, + ], +) async def test_bulk_update_data_table_rows_async( - transport: str = "grpc_asyncio", - request_type=data_table.BulkUpdateDataTableRowsRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataTableServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -6466,7 +6514,7 @@ async def test_bulk_update_data_table_rows_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( @@ -6488,11 +6536,6 @@ async def test_bulk_update_data_table_rows_async( assert isinstance(response, data_table.BulkUpdateDataTableRowsResponse) -@pytest.mark.asyncio -async def test_bulk_update_data_table_rows_async_from_dict(): - await test_bulk_update_data_table_rows_async(request_type=dict) - - def test_bulk_update_data_table_rows_field_headers(): client = DataTableServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6681,8 +6724,8 @@ async def test_bulk_update_data_table_rows_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_table.GetDataTableOperationErrorsRequest, - dict, + data_table.GetDataTableOperationErrorsRequest(), + {}, ], ) def test_get_data_table_operation_errors(request_type, transport: str = "grpc"): @@ -6693,7 +6736,7 @@ def test_get_data_table_operation_errors(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6741,9 +6784,10 @@ def test_get_data_table_operation_errors_non_empty_request_with_auto_populated_f client.get_data_table_operation_errors(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_table.GetDataTableOperationErrorsRequest( + request_msg = data_table.GetDataTableOperationErrorsRequest( name="name_value", ) + assert args[0] == request_msg def test_get_data_table_operation_errors_use_cached_wrapped_rpc(): @@ -6829,9 +6873,15 @@ async def test_get_data_table_operation_errors_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_table.GetDataTableOperationErrorsRequest(), + {}, + ], +) async def test_get_data_table_operation_errors_async( - transport: str = "grpc_asyncio", - request_type=data_table.GetDataTableOperationErrorsRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataTableServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -6840,7 +6890,7 @@ async def test_get_data_table_operation_errors_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( @@ -6865,11 +6915,6 @@ async def test_get_data_table_operation_errors_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_data_table_operation_errors_async_from_dict(): - await test_get_data_table_operation_errors_async(request_type=dict) - - def test_get_data_table_operation_errors_field_headers(): client = DataTableServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10158,7 +10203,6 @@ def test_create_data_table_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcc_data_table.CreateDataTableRequest() - assert args[0] == request_msg @@ -10179,7 +10223,6 @@ def test_list_data_tables_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_table.ListDataTablesRequest() - assert args[0] == request_msg @@ -10200,7 +10243,6 @@ def test_get_data_table_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_table.GetDataTableRequest() - assert args[0] == request_msg @@ -10223,7 +10265,6 @@ def test_update_data_table_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcc_data_table.UpdateDataTableRequest() - assert args[0] == request_msg @@ -10246,7 +10287,6 @@ def test_delete_data_table_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_table.DeleteDataTableRequest() - assert args[0] == request_msg @@ -10269,7 +10309,6 @@ def test_create_data_table_row_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_table.CreateDataTableRowRequest() - assert args[0] == request_msg @@ -10292,7 +10331,6 @@ def test_update_data_table_row_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_table.UpdateDataTableRowRequest() - assert args[0] == request_msg @@ -10315,7 +10353,6 @@ def test_list_data_table_rows_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_table.ListDataTableRowsRequest() - assert args[0] == request_msg @@ -10338,7 +10375,6 @@ def test_get_data_table_row_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_table.GetDataTableRowRequest() - assert args[0] == request_msg @@ -10361,7 +10397,6 @@ def test_delete_data_table_row_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_table.DeleteDataTableRowRequest() - assert args[0] == request_msg @@ -10384,7 +10419,6 @@ def test_bulk_create_data_table_rows_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_table.BulkCreateDataTableRowsRequest() - assert args[0] == request_msg @@ -10407,7 +10441,6 @@ def test_bulk_get_data_table_rows_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_table.BulkGetDataTableRowsRequest() - assert args[0] == request_msg @@ -10430,7 +10463,6 @@ def test_bulk_replace_data_table_rows_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_table.BulkReplaceDataTableRowsRequest() - assert args[0] == request_msg @@ -10453,7 +10485,6 @@ def test_bulk_update_data_table_rows_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_table.BulkUpdateDataTableRowsRequest() - assert args[0] == request_msg @@ -10476,7 +10507,6 @@ def test_get_data_table_operation_errors_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_table.GetDataTableOperationErrorsRequest() - assert args[0] == request_msg @@ -10527,7 +10557,6 @@ async def test_create_data_table_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcc_data_table.CreateDataTableRequest() - assert args[0] == request_msg @@ -10554,7 +10583,6 @@ async def test_list_data_tables_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_table.ListDataTablesRequest() - assert args[0] == request_msg @@ -10589,7 +10617,6 @@ async def test_get_data_table_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_table.GetDataTableRequest() - assert args[0] == request_msg @@ -10626,7 +10653,6 @@ async def test_update_data_table_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcc_data_table.UpdateDataTableRequest() - assert args[0] == request_msg @@ -10651,7 +10677,6 @@ async def test_delete_data_table_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_table.DeleteDataTableRequest() - assert args[0] == request_msg @@ -10682,7 +10707,6 @@ async def test_create_data_table_row_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_table.CreateDataTableRowRequest() - assert args[0] == request_msg @@ -10713,7 +10737,6 @@ async def test_update_data_table_row_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_table.UpdateDataTableRowRequest() - assert args[0] == request_msg @@ -10742,7 +10765,6 @@ async def test_list_data_table_rows_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_table.ListDataTableRowsRequest() - assert args[0] == request_msg @@ -10773,7 +10795,6 @@ async def test_get_data_table_row_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_table.GetDataTableRowRequest() - assert args[0] == request_msg @@ -10798,7 +10819,6 @@ async def test_delete_data_table_row_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_table.DeleteDataTableRowRequest() - assert args[0] == request_msg @@ -10825,7 +10845,6 @@ async def test_bulk_create_data_table_rows_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_table.BulkCreateDataTableRowsRequest() - assert args[0] == request_msg @@ -10852,7 +10871,6 @@ async def test_bulk_get_data_table_rows_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_table.BulkGetDataTableRowsRequest() - assert args[0] == request_msg @@ -10879,7 +10897,6 @@ async def test_bulk_replace_data_table_rows_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_table.BulkReplaceDataTableRowsRequest() - assert args[0] == request_msg @@ -10906,7 +10923,6 @@ async def test_bulk_update_data_table_rows_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_table.BulkUpdateDataTableRowsRequest() - assert args[0] == request_msg @@ -10935,7 +10951,6 @@ async def test_get_data_table_operation_errors_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_table.GetDataTableOperationErrorsRequest() - assert args[0] == request_msg @@ -13647,7 +13662,6 @@ def test_create_data_table_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcc_data_table.CreateDataTableRequest() - assert args[0] == request_msg @@ -13667,7 +13681,6 @@ def test_list_data_tables_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_table.ListDataTablesRequest() - assert args[0] == request_msg @@ -13687,7 +13700,6 @@ def test_get_data_table_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_table.GetDataTableRequest() - assert args[0] == request_msg @@ -13709,7 +13721,6 @@ def test_update_data_table_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcc_data_table.UpdateDataTableRequest() - assert args[0] == request_msg @@ -13731,7 +13742,6 @@ def test_delete_data_table_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_table.DeleteDataTableRequest() - assert args[0] == request_msg @@ -13753,7 +13763,6 @@ def test_create_data_table_row_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_table.CreateDataTableRowRequest() - assert args[0] == request_msg @@ -13775,7 +13784,6 @@ def test_update_data_table_row_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_table.UpdateDataTableRowRequest() - assert args[0] == request_msg @@ -13797,7 +13805,6 @@ def test_list_data_table_rows_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_table.ListDataTableRowsRequest() - assert args[0] == request_msg @@ -13819,7 +13826,6 @@ def test_get_data_table_row_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_table.GetDataTableRowRequest() - assert args[0] == request_msg @@ -13841,7 +13847,6 @@ def test_delete_data_table_row_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_table.DeleteDataTableRowRequest() - assert args[0] == request_msg @@ -13863,7 +13868,6 @@ def test_bulk_create_data_table_rows_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_table.BulkCreateDataTableRowsRequest() - assert args[0] == request_msg @@ -13885,7 +13889,6 @@ def test_bulk_get_data_table_rows_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_table.BulkGetDataTableRowsRequest() - assert args[0] == request_msg @@ -13907,7 +13910,6 @@ def test_bulk_replace_data_table_rows_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_table.BulkReplaceDataTableRowsRequest() - assert args[0] == request_msg @@ -13929,7 +13931,6 @@ def test_bulk_update_data_table_rows_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_table.BulkUpdateDataTableRowsRequest() - assert args[0] == request_msg @@ -13951,7 +13952,6 @@ def test_get_data_table_operation_errors_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_table.GetDataTableOperationErrorsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-chronicle/tests/unit/gapic/chronicle_v1/test_entity_service.py b/packages/google-cloud-chronicle/tests/unit/gapic/chronicle_v1/test_entity_service.py index 79463d8a23d2..40a14de186e0 100644 --- a/packages/google-cloud-chronicle/tests/unit/gapic/chronicle_v1/test_entity_service.py +++ b/packages/google-cloud-chronicle/tests/unit/gapic/chronicle_v1/test_entity_service.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 @@ -110,6 +111,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" @@ -1309,8 +1325,8 @@ def test_entity_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - entity.GetWatchlistRequest, - dict, + entity.GetWatchlistRequest(), + {}, ], ) def test_get_watchlist(request_type, transport: str = "grpc"): @@ -1321,7 +1337,7 @@ def test_get_watchlist(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_watchlist), "__call__") as call: @@ -1371,9 +1387,10 @@ def test_get_watchlist_non_empty_request_with_auto_populated_field(): client.get_watchlist(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == entity.GetWatchlistRequest( + request_msg = entity.GetWatchlistRequest( name="name_value", ) + assert args[0] == request_msg def test_get_watchlist_use_cached_wrapped_rpc(): @@ -1454,9 +1471,14 @@ async def test_get_watchlist_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_watchlist_async( - transport: str = "grpc_asyncio", request_type=entity.GetWatchlistRequest -): +@pytest.mark.parametrize( + "request_type", + [ + entity.GetWatchlistRequest(), + {}, + ], +) +async def test_get_watchlist_async(request_type, transport: str = "grpc_asyncio"): client = EntityServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1464,7 +1486,7 @@ async def test_get_watchlist_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_watchlist), "__call__") as call: @@ -1493,11 +1515,6 @@ async def test_get_watchlist_async( assert math.isclose(response.multiplying_factor, 0.1948, rel_tol=1e-6) -@pytest.mark.asyncio -async def test_get_watchlist_async_from_dict(): - await test_get_watchlist_async(request_type=dict) - - def test_get_watchlist_field_headers(): client = EntityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1640,8 +1657,8 @@ async def test_get_watchlist_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - entity.ListWatchlistsRequest, - dict, + entity.ListWatchlistsRequest(), + {}, ], ) def test_list_watchlists(request_type, transport: str = "grpc"): @@ -1652,7 +1669,7 @@ def test_list_watchlists(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_watchlists), "__call__") as call: @@ -1698,11 +1715,12 @@ def test_list_watchlists_non_empty_request_with_auto_populated_field(): client.list_watchlists(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == entity.ListWatchlistsRequest( + request_msg = entity.ListWatchlistsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_watchlists_use_cached_wrapped_rpc(): @@ -1783,9 +1801,14 @@ async def test_list_watchlists_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_watchlists_async( - transport: str = "grpc_asyncio", request_type=entity.ListWatchlistsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + entity.ListWatchlistsRequest(), + {}, + ], +) +async def test_list_watchlists_async(request_type, transport: str = "grpc_asyncio"): client = EntityServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1793,7 +1816,7 @@ async def test_list_watchlists_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_watchlists), "__call__") as call: @@ -1816,11 +1839,6 @@ async def test_list_watchlists_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_watchlists_async_from_dict(): - await test_list_watchlists_async(request_type=dict) - - def test_list_watchlists_field_headers(): client = EntityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2157,8 +2175,8 @@ async def test_list_watchlists_async_pages(): @pytest.mark.parametrize( "request_type", [ - entity.CreateWatchlistRequest, - dict, + entity.CreateWatchlistRequest(), + {}, ], ) def test_create_watchlist(request_type, transport: str = "grpc"): @@ -2169,7 +2187,7 @@ def test_create_watchlist(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_watchlist), "__call__") as call: @@ -2220,10 +2238,11 @@ def test_create_watchlist_non_empty_request_with_auto_populated_field(): client.create_watchlist(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == entity.CreateWatchlistRequest( + request_msg = entity.CreateWatchlistRequest( parent="parent_value", watchlist_id="watchlist_id_value", ) + assert args[0] == request_msg def test_create_watchlist_use_cached_wrapped_rpc(): @@ -2306,9 +2325,14 @@ async def test_create_watchlist_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_watchlist_async( - transport: str = "grpc_asyncio", request_type=entity.CreateWatchlistRequest -): +@pytest.mark.parametrize( + "request_type", + [ + entity.CreateWatchlistRequest(), + {}, + ], +) +async def test_create_watchlist_async(request_type, transport: str = "grpc_asyncio"): client = EntityServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2316,7 +2340,7 @@ async def test_create_watchlist_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_watchlist), "__call__") as call: @@ -2345,11 +2369,6 @@ async def test_create_watchlist_async( assert math.isclose(response.multiplying_factor, 0.1948, rel_tol=1e-6) -@pytest.mark.asyncio -async def test_create_watchlist_async_from_dict(): - await test_create_watchlist_async(request_type=dict) - - def test_create_watchlist_field_headers(): client = EntityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2512,8 +2531,8 @@ async def test_create_watchlist_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - entity.UpdateWatchlistRequest, - dict, + entity.UpdateWatchlistRequest(), + {}, ], ) def test_update_watchlist(request_type, transport: str = "grpc"): @@ -2524,7 +2543,7 @@ def test_update_watchlist(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_watchlist), "__call__") as call: @@ -2572,7 +2591,8 @@ def test_update_watchlist_non_empty_request_with_auto_populated_field(): client.update_watchlist(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == entity.UpdateWatchlistRequest() + request_msg = entity.UpdateWatchlistRequest() + assert args[0] == request_msg def test_update_watchlist_use_cached_wrapped_rpc(): @@ -2655,9 +2675,14 @@ async def test_update_watchlist_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_watchlist_async( - transport: str = "grpc_asyncio", request_type=entity.UpdateWatchlistRequest -): +@pytest.mark.parametrize( + "request_type", + [ + entity.UpdateWatchlistRequest(), + {}, + ], +) +async def test_update_watchlist_async(request_type, transport: str = "grpc_asyncio"): client = EntityServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2665,7 +2690,7 @@ async def test_update_watchlist_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_watchlist), "__call__") as call: @@ -2694,11 +2719,6 @@ async def test_update_watchlist_async( assert math.isclose(response.multiplying_factor, 0.1948, rel_tol=1e-6) -@pytest.mark.asyncio -async def test_update_watchlist_async_from_dict(): - await test_update_watchlist_async(request_type=dict) - - def test_update_watchlist_field_headers(): client = EntityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2851,8 +2871,8 @@ async def test_update_watchlist_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - entity.DeleteWatchlistRequest, - dict, + entity.DeleteWatchlistRequest(), + {}, ], ) def test_delete_watchlist(request_type, transport: str = "grpc"): @@ -2863,7 +2883,7 @@ def test_delete_watchlist(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_watchlist), "__call__") as call: @@ -2904,9 +2924,10 @@ def test_delete_watchlist_non_empty_request_with_auto_populated_field(): client.delete_watchlist(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == entity.DeleteWatchlistRequest( + request_msg = entity.DeleteWatchlistRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_watchlist_use_cached_wrapped_rpc(): @@ -2989,9 +3010,14 @@ async def test_delete_watchlist_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_watchlist_async( - transport: str = "grpc_asyncio", request_type=entity.DeleteWatchlistRequest -): +@pytest.mark.parametrize( + "request_type", + [ + entity.DeleteWatchlistRequest(), + {}, + ], +) +async def test_delete_watchlist_async(request_type, transport: str = "grpc_asyncio"): client = EntityServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2999,7 +3025,7 @@ async def test_delete_watchlist_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_watchlist), "__call__") as call: @@ -3017,11 +3043,6 @@ async def test_delete_watchlist_async( assert response is None -@pytest.mark.asyncio -async def test_delete_watchlist_async_from_dict(): - await test_delete_watchlist_async(request_type=dict) - - def test_delete_watchlist_field_headers(): client = EntityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4294,7 +4315,6 @@ def test_get_watchlist_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity.GetWatchlistRequest() - assert args[0] == request_msg @@ -4315,7 +4335,6 @@ def test_list_watchlists_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity.ListWatchlistsRequest() - assert args[0] == request_msg @@ -4336,7 +4355,6 @@ def test_create_watchlist_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity.CreateWatchlistRequest() - assert args[0] == request_msg @@ -4357,7 +4375,6 @@ def test_update_watchlist_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity.UpdateWatchlistRequest() - assert args[0] == request_msg @@ -4378,7 +4395,6 @@ def test_delete_watchlist_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity.DeleteWatchlistRequest() - assert args[0] == request_msg @@ -4422,7 +4438,6 @@ async def test_get_watchlist_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity.GetWatchlistRequest() - assert args[0] == request_msg @@ -4449,7 +4464,6 @@ async def test_list_watchlists_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity.ListWatchlistsRequest() - assert args[0] == request_msg @@ -4479,7 +4493,6 @@ async def test_create_watchlist_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity.CreateWatchlistRequest() - assert args[0] == request_msg @@ -4509,7 +4522,6 @@ async def test_update_watchlist_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity.UpdateWatchlistRequest() - assert args[0] == request_msg @@ -4532,7 +4544,6 @@ async def test_delete_watchlist_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity.DeleteWatchlistRequest() - assert args[0] == request_msg @@ -5638,7 +5649,6 @@ def test_get_watchlist_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity.GetWatchlistRequest() - assert args[0] == request_msg @@ -5658,7 +5668,6 @@ def test_list_watchlists_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity.ListWatchlistsRequest() - assert args[0] == request_msg @@ -5678,7 +5687,6 @@ def test_create_watchlist_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity.CreateWatchlistRequest() - assert args[0] == request_msg @@ -5698,7 +5706,6 @@ def test_update_watchlist_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity.UpdateWatchlistRequest() - assert args[0] == request_msg @@ -5718,7 +5725,6 @@ def test_delete_watchlist_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity.DeleteWatchlistRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-chronicle/tests/unit/gapic/chronicle_v1/test_featured_content_native_dashboard_service.py b/packages/google-cloud-chronicle/tests/unit/gapic/chronicle_v1/test_featured_content_native_dashboard_service.py index 137ed5fa0ea0..d55470d6080e 100644 --- a/packages/google-cloud-chronicle/tests/unit/gapic/chronicle_v1/test_featured_content_native_dashboard_service.py +++ b/packages/google-cloud-chronicle/tests/unit/gapic/chronicle_v1/test_featured_content_native_dashboard_service.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 @@ -116,6 +117,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" @@ -1463,8 +1479,8 @@ def test_featured_content_native_dashboard_service_client_create_channel_credent @pytest.mark.parametrize( "request_type", [ - featured_content_native_dashboard.GetFeaturedContentNativeDashboardRequest, - dict, + featured_content_native_dashboard.GetFeaturedContentNativeDashboardRequest(), + {}, ], ) def test_get_featured_content_native_dashboard(request_type, transport: str = "grpc"): @@ -1475,7 +1491,7 @@ def test_get_featured_content_native_dashboard(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( @@ -1531,11 +1547,12 @@ def test_get_featured_content_native_dashboard_non_empty_request_with_auto_popul client.get_featured_content_native_dashboard(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == featured_content_native_dashboard.GetFeaturedContentNativeDashboardRequest( - name="name_value", + request_msg = ( + featured_content_native_dashboard.GetFeaturedContentNativeDashboardRequest( + name="name_value", + ) ) + assert args[0] == request_msg def test_get_featured_content_native_dashboard_use_cached_wrapped_rpc(): @@ -1621,9 +1638,15 @@ async def test_get_featured_content_native_dashboard_async_use_cached_wrapped_rp @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + featured_content_native_dashboard.GetFeaturedContentNativeDashboardRequest(), + {}, + ], +) async def test_get_featured_content_native_dashboard_async( - transport: str = "grpc_asyncio", - request_type=featured_content_native_dashboard.GetFeaturedContentNativeDashboardRequest, + request_type, transport: str = "grpc_asyncio" ): client = FeaturedContentNativeDashboardServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1632,7 +1655,7 @@ async def test_get_featured_content_native_dashboard_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( @@ -1661,11 +1684,6 @@ async def test_get_featured_content_native_dashboard_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_featured_content_native_dashboard_async_from_dict(): - await test_get_featured_content_native_dashboard_async(request_type=dict) - - def test_get_featured_content_native_dashboard_field_headers(): client = FeaturedContentNativeDashboardServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1830,8 +1848,8 @@ async def test_get_featured_content_native_dashboard_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - featured_content_native_dashboard.ListFeaturedContentNativeDashboardsRequest, - dict, + featured_content_native_dashboard.ListFeaturedContentNativeDashboardsRequest(), + {}, ], ) def test_list_featured_content_native_dashboards(request_type, transport: str = "grpc"): @@ -1842,7 +1860,7 @@ def test_list_featured_content_native_dashboards(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( @@ -1894,14 +1912,12 @@ def test_list_featured_content_native_dashboards_non_empty_request_with_auto_pop client.list_featured_content_native_dashboards(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert ( - args[0] - == featured_content_native_dashboard.ListFeaturedContentNativeDashboardsRequest( - parent="parent_value", - page_token="page_token_value", - filter="filter_value", - ) + request_msg = featured_content_native_dashboard.ListFeaturedContentNativeDashboardsRequest( + parent="parent_value", + page_token="page_token_value", + filter="filter_value", ) + assert args[0] == request_msg def test_list_featured_content_native_dashboards_use_cached_wrapped_rpc(): @@ -1987,9 +2003,15 @@ async def test_list_featured_content_native_dashboards_async_use_cached_wrapped_ @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + featured_content_native_dashboard.ListFeaturedContentNativeDashboardsRequest(), + {}, + ], +) async def test_list_featured_content_native_dashboards_async( - transport: str = "grpc_asyncio", - request_type=featured_content_native_dashboard.ListFeaturedContentNativeDashboardsRequest, + request_type, transport: str = "grpc_asyncio" ): client = FeaturedContentNativeDashboardServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1998,7 +2020,7 @@ async def test_list_featured_content_native_dashboards_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( @@ -2023,11 +2045,6 @@ async def test_list_featured_content_native_dashboards_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_featured_content_native_dashboards_async_from_dict(): - await test_list_featured_content_native_dashboards_async(request_type=dict) - - def test_list_featured_content_native_dashboards_field_headers(): client = FeaturedContentNativeDashboardServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2398,8 +2415,8 @@ async def test_list_featured_content_native_dashboards_async_pages(): @pytest.mark.parametrize( "request_type", [ - featured_content_native_dashboard.InstallFeaturedContentNativeDashboardRequest, - dict, + featured_content_native_dashboard.InstallFeaturedContentNativeDashboardRequest(), + {}, ], ) def test_install_featured_content_native_dashboard( @@ -2412,7 +2429,7 @@ def test_install_featured_content_native_dashboard( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2465,12 +2482,10 @@ def test_install_featured_content_native_dashboard_non_empty_request_with_auto_p client.install_featured_content_native_dashboard(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert ( - args[0] - == featured_content_native_dashboard.InstallFeaturedContentNativeDashboardRequest( - name="name_value", - ) + request_msg = featured_content_native_dashboard.InstallFeaturedContentNativeDashboardRequest( + name="name_value", ) + assert args[0] == request_msg def test_install_featured_content_native_dashboard_use_cached_wrapped_rpc(): @@ -2556,9 +2571,15 @@ async def test_install_featured_content_native_dashboard_async_use_cached_wrappe @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + featured_content_native_dashboard.InstallFeaturedContentNativeDashboardRequest(), + {}, + ], +) async def test_install_featured_content_native_dashboard_async( - transport: str = "grpc_asyncio", - request_type=featured_content_native_dashboard.InstallFeaturedContentNativeDashboardRequest, + request_type, transport: str = "grpc_asyncio" ): client = FeaturedContentNativeDashboardServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2567,7 +2588,7 @@ async def test_install_featured_content_native_dashboard_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( @@ -2595,11 +2616,6 @@ async def test_install_featured_content_native_dashboard_async( assert response.native_dashboard == "native_dashboard_value" -@pytest.mark.asyncio -async def test_install_featured_content_native_dashboard_async_from_dict(): - await test_install_featured_content_native_dashboard_async(request_type=dict) - - def test_install_featured_content_native_dashboard_field_headers(): client = FeaturedContentNativeDashboardServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3578,7 +3594,6 @@ def test_get_featured_content_native_dashboard_empty_call_grpc(): request_msg = ( featured_content_native_dashboard.GetFeaturedContentNativeDashboardRequest() ) - assert args[0] == request_msg @@ -3601,7 +3616,6 @@ def test_list_featured_content_native_dashboards_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = featured_content_native_dashboard.ListFeaturedContentNativeDashboardsRequest() - assert args[0] == request_msg @@ -3624,7 +3638,6 @@ def test_install_featured_content_native_dashboard_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = featured_content_native_dashboard.InstallFeaturedContentNativeDashboardRequest() - assert args[0] == request_msg @@ -3669,7 +3682,6 @@ async def test_get_featured_content_native_dashboard_empty_call_grpc_asyncio(): request_msg = ( featured_content_native_dashboard.GetFeaturedContentNativeDashboardRequest() ) - assert args[0] == request_msg @@ -3698,7 +3710,6 @@ async def test_list_featured_content_native_dashboards_empty_call_grpc_asyncio() call.assert_called() _, args, _ = call.mock_calls[0] request_msg = featured_content_native_dashboard.ListFeaturedContentNativeDashboardsRequest() - assert args[0] == request_msg @@ -3727,7 +3738,6 @@ async def test_install_featured_content_native_dashboard_empty_call_grpc_asyncio call.assert_called() _, args, _ = call.mock_calls[0] request_msg = featured_content_native_dashboard.InstallFeaturedContentNativeDashboardRequest() - assert args[0] == request_msg @@ -4477,7 +4487,6 @@ def test_get_featured_content_native_dashboard_empty_call_rest(): request_msg = ( featured_content_native_dashboard.GetFeaturedContentNativeDashboardRequest() ) - assert args[0] == request_msg @@ -4499,7 +4508,6 @@ def test_list_featured_content_native_dashboards_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = featured_content_native_dashboard.ListFeaturedContentNativeDashboardsRequest() - assert args[0] == request_msg @@ -4521,7 +4529,6 @@ def test_install_featured_content_native_dashboard_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = featured_content_native_dashboard.InstallFeaturedContentNativeDashboardRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-chronicle/tests/unit/gapic/chronicle_v1/test_instance_service.py b/packages/google-cloud-chronicle/tests/unit/gapic/chronicle_v1/test_instance_service.py index ae06d78260ee..342efca86531 100644 --- a/packages/google-cloud-chronicle/tests/unit/gapic/chronicle_v1/test_instance_service.py +++ b/packages/google-cloud-chronicle/tests/unit/gapic/chronicle_v1/test_instance_service.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 @@ -107,6 +108,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" @@ -1334,8 +1350,8 @@ def test_instance_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - instance.GetInstanceRequest, - dict, + instance.GetInstanceRequest(), + {}, ], ) def test_get_instance(request_type, transport: str = "grpc"): @@ -1346,7 +1362,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(type(client.transport.get_instance), "__call__") as call: @@ -1390,9 +1406,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] == instance.GetInstanceRequest( + request_msg = instance.GetInstanceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_instance_use_cached_wrapped_rpc(): @@ -1473,9 +1490,14 @@ async def test_get_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_instance_async( - transport: str = "grpc_asyncio", request_type=instance.GetInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + instance.GetInstanceRequest(), + {}, + ], +) +async def test_get_instance_async(request_type, transport: str = "grpc_asyncio"): client = InstanceServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1483,7 +1505,7 @@ async def test_get_instance_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_instance), "__call__") as call: @@ -1506,11 +1528,6 @@ async def test_get_instance_async( assert response.name == "name_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 = InstanceServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1950,7 +1967,6 @@ def test_get_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = instance.GetInstanceRequest() - assert args[0] == request_msg @@ -1991,7 +2007,6 @@ async def test_get_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = instance.GetInstanceRequest() - assert args[0] == request_msg @@ -2418,7 +2433,6 @@ def test_get_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = instance.GetInstanceRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-chronicle/tests/unit/gapic/chronicle_v1/test_native_dashboard_service.py b/packages/google-cloud-chronicle/tests/unit/gapic/chronicle_v1/test_native_dashboard_service.py index 181421cd8919..d2695239967c 100644 --- a/packages/google-cloud-chronicle/tests/unit/gapic/chronicle_v1/test_native_dashboard_service.py +++ b/packages/google-cloud-chronicle/tests/unit/gapic/chronicle_v1/test_native_dashboard_service.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 @@ -118,6 +119,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" @@ -1391,8 +1407,8 @@ def test_native_dashboard_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - gcc_native_dashboard.CreateNativeDashboardRequest, - dict, + gcc_native_dashboard.CreateNativeDashboardRequest(), + {}, ], ) def test_create_native_dashboard(request_type, transport: str = "grpc"): @@ -1403,7 +1419,7 @@ def test_create_native_dashboard(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1465,9 +1481,10 @@ def test_create_native_dashboard_non_empty_request_with_auto_populated_field(): client.create_native_dashboard(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcc_native_dashboard.CreateNativeDashboardRequest( + request_msg = gcc_native_dashboard.CreateNativeDashboardRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_native_dashboard_use_cached_wrapped_rpc(): @@ -1553,9 +1570,15 @@ async def test_create_native_dashboard_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcc_native_dashboard.CreateNativeDashboardRequest(), + {}, + ], +) async def test_create_native_dashboard_async( - transport: str = "grpc_asyncio", - request_type=gcc_native_dashboard.CreateNativeDashboardRequest, + request_type, transport: str = "grpc_asyncio" ): client = NativeDashboardServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1564,7 +1587,7 @@ async def test_create_native_dashboard_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( @@ -1603,11 +1626,6 @@ async def test_create_native_dashboard_async( assert response.access == gcc_native_dashboard.DashboardAccess.DASHBOARD_PRIVATE -@pytest.mark.asyncio -async def test_create_native_dashboard_async_from_dict(): - await test_create_native_dashboard_async(request_type=dict) - - def test_create_native_dashboard_field_headers(): client = NativeDashboardServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1772,8 +1790,8 @@ async def test_create_native_dashboard_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - native_dashboard.GetNativeDashboardRequest, - dict, + native_dashboard.GetNativeDashboardRequest(), + {}, ], ) def test_get_native_dashboard(request_type, transport: str = "grpc"): @@ -1784,7 +1802,7 @@ def test_get_native_dashboard(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1846,9 +1864,10 @@ def test_get_native_dashboard_non_empty_request_with_auto_populated_field(): client.get_native_dashboard(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == native_dashboard.GetNativeDashboardRequest( + request_msg = native_dashboard.GetNativeDashboardRequest( name="name_value", ) + assert args[0] == request_msg def test_get_native_dashboard_use_cached_wrapped_rpc(): @@ -1933,9 +1952,15 @@ async def test_get_native_dashboard_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + native_dashboard.GetNativeDashboardRequest(), + {}, + ], +) async def test_get_native_dashboard_async( - transport: str = "grpc_asyncio", - request_type=native_dashboard.GetNativeDashboardRequest, + request_type, transport: str = "grpc_asyncio" ): client = NativeDashboardServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1944,7 +1969,7 @@ async def test_get_native_dashboard_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( @@ -1983,11 +2008,6 @@ async def test_get_native_dashboard_async( assert response.access == native_dashboard.DashboardAccess.DASHBOARD_PRIVATE -@pytest.mark.asyncio -async def test_get_native_dashboard_async_from_dict(): - await test_get_native_dashboard_async(request_type=dict) - - def test_get_native_dashboard_field_headers(): client = NativeDashboardServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2142,8 +2162,8 @@ async def test_get_native_dashboard_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - native_dashboard.ListNativeDashboardsRequest, - dict, + native_dashboard.ListNativeDashboardsRequest(), + {}, ], ) def test_list_native_dashboards(request_type, transport: str = "grpc"): @@ -2154,7 +2174,7 @@ def test_list_native_dashboards(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2203,10 +2223,11 @@ def test_list_native_dashboards_non_empty_request_with_auto_populated_field(): client.list_native_dashboards(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == native_dashboard.ListNativeDashboardsRequest( + request_msg = native_dashboard.ListNativeDashboardsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_native_dashboards_use_cached_wrapped_rpc(): @@ -2292,9 +2313,15 @@ async def test_list_native_dashboards_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + native_dashboard.ListNativeDashboardsRequest(), + {}, + ], +) async def test_list_native_dashboards_async( - transport: str = "grpc_asyncio", - request_type=native_dashboard.ListNativeDashboardsRequest, + request_type, transport: str = "grpc_asyncio" ): client = NativeDashboardServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2303,7 +2330,7 @@ async def test_list_native_dashboards_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( @@ -2328,11 +2355,6 @@ async def test_list_native_dashboards_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_native_dashboards_async_from_dict(): - await test_list_native_dashboards_async(request_type=dict) - - def test_list_native_dashboards_field_headers(): client = NativeDashboardServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2685,8 +2707,8 @@ async def test_list_native_dashboards_async_pages(): @pytest.mark.parametrize( "request_type", [ - gcc_native_dashboard.UpdateNativeDashboardRequest, - dict, + gcc_native_dashboard.UpdateNativeDashboardRequest(), + {}, ], ) def test_update_native_dashboard(request_type, transport: str = "grpc"): @@ -2697,7 +2719,7 @@ def test_update_native_dashboard(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2757,7 +2779,8 @@ def test_update_native_dashboard_non_empty_request_with_auto_populated_field(): client.update_native_dashboard(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcc_native_dashboard.UpdateNativeDashboardRequest() + request_msg = gcc_native_dashboard.UpdateNativeDashboardRequest() + assert args[0] == request_msg def test_update_native_dashboard_use_cached_wrapped_rpc(): @@ -2843,9 +2866,15 @@ async def test_update_native_dashboard_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcc_native_dashboard.UpdateNativeDashboardRequest(), + {}, + ], +) async def test_update_native_dashboard_async( - transport: str = "grpc_asyncio", - request_type=gcc_native_dashboard.UpdateNativeDashboardRequest, + request_type, transport: str = "grpc_asyncio" ): client = NativeDashboardServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2854,7 +2883,7 @@ async def test_update_native_dashboard_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( @@ -2893,11 +2922,6 @@ async def test_update_native_dashboard_async( assert response.access == gcc_native_dashboard.DashboardAccess.DASHBOARD_PRIVATE -@pytest.mark.asyncio -async def test_update_native_dashboard_async_from_dict(): - await test_update_native_dashboard_async(request_type=dict) - - def test_update_native_dashboard_field_headers(): client = NativeDashboardServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3062,8 +3086,8 @@ async def test_update_native_dashboard_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcc_native_dashboard.DuplicateNativeDashboardRequest, - dict, + gcc_native_dashboard.DuplicateNativeDashboardRequest(), + {}, ], ) def test_duplicate_native_dashboard(request_type, transport: str = "grpc"): @@ -3074,7 +3098,7 @@ def test_duplicate_native_dashboard(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3136,9 +3160,10 @@ def test_duplicate_native_dashboard_non_empty_request_with_auto_populated_field( client.duplicate_native_dashboard(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcc_native_dashboard.DuplicateNativeDashboardRequest( + request_msg = gcc_native_dashboard.DuplicateNativeDashboardRequest( name="name_value", ) + assert args[0] == request_msg def test_duplicate_native_dashboard_use_cached_wrapped_rpc(): @@ -3224,9 +3249,15 @@ async def test_duplicate_native_dashboard_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcc_native_dashboard.DuplicateNativeDashboardRequest(), + {}, + ], +) async def test_duplicate_native_dashboard_async( - transport: str = "grpc_asyncio", - request_type=gcc_native_dashboard.DuplicateNativeDashboardRequest, + request_type, transport: str = "grpc_asyncio" ): client = NativeDashboardServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3235,7 +3266,7 @@ async def test_duplicate_native_dashboard_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( @@ -3274,11 +3305,6 @@ async def test_duplicate_native_dashboard_async( assert response.access == gcc_native_dashboard.DashboardAccess.DASHBOARD_PRIVATE -@pytest.mark.asyncio -async def test_duplicate_native_dashboard_async_from_dict(): - await test_duplicate_native_dashboard_async(request_type=dict) - - def test_duplicate_native_dashboard_field_headers(): client = NativeDashboardServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3443,8 +3469,8 @@ async def test_duplicate_native_dashboard_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - native_dashboard.DeleteNativeDashboardRequest, - dict, + native_dashboard.DeleteNativeDashboardRequest(), + {}, ], ) def test_delete_native_dashboard(request_type, transport: str = "grpc"): @@ -3455,7 +3481,7 @@ def test_delete_native_dashboard(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3500,9 +3526,10 @@ def test_delete_native_dashboard_non_empty_request_with_auto_populated_field(): client.delete_native_dashboard(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == native_dashboard.DeleteNativeDashboardRequest( + request_msg = native_dashboard.DeleteNativeDashboardRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_native_dashboard_use_cached_wrapped_rpc(): @@ -3588,9 +3615,15 @@ async def test_delete_native_dashboard_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + native_dashboard.DeleteNativeDashboardRequest(), + {}, + ], +) async def test_delete_native_dashboard_async( - transport: str = "grpc_asyncio", - request_type=native_dashboard.DeleteNativeDashboardRequest, + request_type, transport: str = "grpc_asyncio" ): client = NativeDashboardServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3599,7 +3632,7 @@ async def test_delete_native_dashboard_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( @@ -3619,11 +3652,6 @@ async def test_delete_native_dashboard_async( assert response is None -@pytest.mark.asyncio -async def test_delete_native_dashboard_async_from_dict(): - await test_delete_native_dashboard_async(request_type=dict) - - def test_delete_native_dashboard_field_headers(): client = NativeDashboardServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3774,8 +3802,8 @@ async def test_delete_native_dashboard_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - native_dashboard.AddChartRequest, - dict, + native_dashboard.AddChartRequest(), + {}, ], ) def test_add_chart(request_type, transport: str = "grpc"): @@ -3786,7 +3814,7 @@ def test_add_chart(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.add_chart), "__call__") as call: @@ -3827,9 +3855,10 @@ def test_add_chart_non_empty_request_with_auto_populated_field(): client.add_chart(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == native_dashboard.AddChartRequest( + request_msg = native_dashboard.AddChartRequest( name="name_value", ) + assert args[0] == request_msg def test_add_chart_use_cached_wrapped_rpc(): @@ -3908,9 +3937,14 @@ async def test_add_chart_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_add_chart_async( - transport: str = "grpc_asyncio", request_type=native_dashboard.AddChartRequest -): +@pytest.mark.parametrize( + "request_type", + [ + native_dashboard.AddChartRequest(), + {}, + ], +) +async def test_add_chart_async(request_type, transport: str = "grpc_asyncio"): client = NativeDashboardServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3918,7 +3952,7 @@ async def test_add_chart_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.add_chart), "__call__") as call: @@ -3938,11 +3972,6 @@ async def test_add_chart_async( assert isinstance(response, native_dashboard.AddChartResponse) -@pytest.mark.asyncio -async def test_add_chart_async_from_dict(): - await test_add_chart_async(request_type=dict) - - def test_add_chart_field_headers(): client = NativeDashboardServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4109,8 +4138,8 @@ async def test_add_chart_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - native_dashboard.RemoveChartRequest, - dict, + native_dashboard.RemoveChartRequest(), + {}, ], ) def test_remove_chart(request_type, transport: str = "grpc"): @@ -4121,7 +4150,7 @@ def test_remove_chart(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.remove_chart), "__call__") as call: @@ -4180,10 +4209,11 @@ def test_remove_chart_non_empty_request_with_auto_populated_field(): client.remove_chart(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == native_dashboard.RemoveChartRequest( + request_msg = native_dashboard.RemoveChartRequest( name="name_value", dashboard_chart="dashboard_chart_value", ) + assert args[0] == request_msg def test_remove_chart_use_cached_wrapped_rpc(): @@ -4264,9 +4294,14 @@ async def test_remove_chart_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_remove_chart_async( - transport: str = "grpc_asyncio", request_type=native_dashboard.RemoveChartRequest -): +@pytest.mark.parametrize( + "request_type", + [ + native_dashboard.RemoveChartRequest(), + {}, + ], +) +async def test_remove_chart_async(request_type, transport: str = "grpc_asyncio"): client = NativeDashboardServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4274,7 +4309,7 @@ async def test_remove_chart_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.remove_chart), "__call__") as call: @@ -4311,11 +4346,6 @@ async def test_remove_chart_async( assert response.access == native_dashboard.DashboardAccess.DASHBOARD_PRIVATE -@pytest.mark.asyncio -async def test_remove_chart_async_from_dict(): - await test_remove_chart_async(request_type=dict) - - def test_remove_chart_field_headers(): client = NativeDashboardServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4462,8 +4492,8 @@ async def test_remove_chart_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - native_dashboard.EditChartRequest, - dict, + native_dashboard.EditChartRequest(), + {}, ], ) def test_edit_chart(request_type, transport: str = "grpc"): @@ -4474,7 +4504,7 @@ def test_edit_chart(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.edit_chart), "__call__") as call: @@ -4515,9 +4545,10 @@ def test_edit_chart_non_empty_request_with_auto_populated_field(): client.edit_chart(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == native_dashboard.EditChartRequest( + request_msg = native_dashboard.EditChartRequest( name="name_value", ) + assert args[0] == request_msg def test_edit_chart_use_cached_wrapped_rpc(): @@ -4596,9 +4627,14 @@ async def test_edit_chart_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_edit_chart_async( - transport: str = "grpc_asyncio", request_type=native_dashboard.EditChartRequest -): +@pytest.mark.parametrize( + "request_type", + [ + native_dashboard.EditChartRequest(), + {}, + ], +) +async def test_edit_chart_async(request_type, transport: str = "grpc_asyncio"): client = NativeDashboardServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4606,7 +4642,7 @@ async def test_edit_chart_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.edit_chart), "__call__") as call: @@ -4626,11 +4662,6 @@ async def test_edit_chart_async( assert isinstance(response, native_dashboard.EditChartResponse) -@pytest.mark.asyncio -async def test_edit_chart_async_from_dict(): - await test_edit_chart_async(request_type=dict) - - def test_edit_chart_field_headers(): client = NativeDashboardServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4807,8 +4838,8 @@ async def test_edit_chart_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - native_dashboard.DuplicateChartRequest, - dict, + native_dashboard.DuplicateChartRequest(), + {}, ], ) def test_duplicate_chart(request_type, transport: str = "grpc"): @@ -4819,7 +4850,7 @@ def test_duplicate_chart(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.duplicate_chart), "__call__") as call: @@ -4861,10 +4892,11 @@ def test_duplicate_chart_non_empty_request_with_auto_populated_field(): client.duplicate_chart(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == native_dashboard.DuplicateChartRequest( + request_msg = native_dashboard.DuplicateChartRequest( name="name_value", dashboard_chart="dashboard_chart_value", ) + assert args[0] == request_msg def test_duplicate_chart_use_cached_wrapped_rpc(): @@ -4945,9 +4977,14 @@ async def test_duplicate_chart_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_duplicate_chart_async( - transport: str = "grpc_asyncio", request_type=native_dashboard.DuplicateChartRequest -): +@pytest.mark.parametrize( + "request_type", + [ + native_dashboard.DuplicateChartRequest(), + {}, + ], +) +async def test_duplicate_chart_async(request_type, transport: str = "grpc_asyncio"): client = NativeDashboardServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4955,7 +4992,7 @@ async def test_duplicate_chart_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.duplicate_chart), "__call__") as call: @@ -4975,11 +5012,6 @@ async def test_duplicate_chart_async( assert isinstance(response, native_dashboard.DuplicateChartResponse) -@pytest.mark.asyncio -async def test_duplicate_chart_async_from_dict(): - await test_duplicate_chart_async(request_type=dict) - - def test_duplicate_chart_field_headers(): client = NativeDashboardServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5126,8 +5158,8 @@ async def test_duplicate_chart_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - native_dashboard.ExportNativeDashboardsRequest, - dict, + native_dashboard.ExportNativeDashboardsRequest(), + {}, ], ) def test_export_native_dashboards(request_type, transport: str = "grpc"): @@ -5138,7 +5170,7 @@ def test_export_native_dashboards(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5183,9 +5215,10 @@ def test_export_native_dashboards_non_empty_request_with_auto_populated_field(): client.export_native_dashboards(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == native_dashboard.ExportNativeDashboardsRequest( + request_msg = native_dashboard.ExportNativeDashboardsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_export_native_dashboards_use_cached_wrapped_rpc(): @@ -5271,9 +5304,15 @@ async def test_export_native_dashboards_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + native_dashboard.ExportNativeDashboardsRequest(), + {}, + ], +) async def test_export_native_dashboards_async( - transport: str = "grpc_asyncio", - request_type=native_dashboard.ExportNativeDashboardsRequest, + request_type, transport: str = "grpc_asyncio" ): client = NativeDashboardServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5282,7 +5321,7 @@ async def test_export_native_dashboards_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( @@ -5304,11 +5343,6 @@ async def test_export_native_dashboards_async( assert isinstance(response, native_dashboard.ExportNativeDashboardsResponse) -@pytest.mark.asyncio -async def test_export_native_dashboards_async_from_dict(): - await test_export_native_dashboards_async(request_type=dict) - - def test_export_native_dashboards_field_headers(): client = NativeDashboardServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5473,8 +5507,8 @@ async def test_export_native_dashboards_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - native_dashboard.ImportNativeDashboardsRequest, - dict, + native_dashboard.ImportNativeDashboardsRequest(), + {}, ], ) def test_import_native_dashboards(request_type, transport: str = "grpc"): @@ -5485,7 +5519,7 @@ def test_import_native_dashboards(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5530,9 +5564,10 @@ def test_import_native_dashboards_non_empty_request_with_auto_populated_field(): client.import_native_dashboards(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == native_dashboard.ImportNativeDashboardsRequest( + request_msg = native_dashboard.ImportNativeDashboardsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_import_native_dashboards_use_cached_wrapped_rpc(): @@ -5618,9 +5653,15 @@ async def test_import_native_dashboards_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + native_dashboard.ImportNativeDashboardsRequest(), + {}, + ], +) async def test_import_native_dashboards_async( - transport: str = "grpc_asyncio", - request_type=native_dashboard.ImportNativeDashboardsRequest, + request_type, transport: str = "grpc_asyncio" ): client = NativeDashboardServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5629,7 +5670,7 @@ async def test_import_native_dashboards_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( @@ -5651,11 +5692,6 @@ async def test_import_native_dashboards_async( assert isinstance(response, native_dashboard.ImportNativeDashboardsResponse) -@pytest.mark.asyncio -async def test_import_native_dashboards_async_from_dict(): - await test_import_native_dashboards_async(request_type=dict) - - def test_import_native_dashboards_field_headers(): client = NativeDashboardServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8385,7 +8421,6 @@ def test_create_native_dashboard_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcc_native_dashboard.CreateNativeDashboardRequest() - assert args[0] == request_msg @@ -8408,7 +8443,6 @@ def test_get_native_dashboard_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = native_dashboard.GetNativeDashboardRequest() - assert args[0] == request_msg @@ -8431,7 +8465,6 @@ def test_list_native_dashboards_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = native_dashboard.ListNativeDashboardsRequest() - assert args[0] == request_msg @@ -8454,7 +8487,6 @@ def test_update_native_dashboard_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcc_native_dashboard.UpdateNativeDashboardRequest() - assert args[0] == request_msg @@ -8477,7 +8509,6 @@ def test_duplicate_native_dashboard_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcc_native_dashboard.DuplicateNativeDashboardRequest() - assert args[0] == request_msg @@ -8500,7 +8531,6 @@ def test_delete_native_dashboard_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = native_dashboard.DeleteNativeDashboardRequest() - assert args[0] == request_msg @@ -8521,7 +8551,6 @@ def test_add_chart_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = native_dashboard.AddChartRequest() - assert args[0] == request_msg @@ -8542,7 +8571,6 @@ def test_remove_chart_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = native_dashboard.RemoveChartRequest() - assert args[0] == request_msg @@ -8563,7 +8591,6 @@ def test_edit_chart_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = native_dashboard.EditChartRequest() - assert args[0] == request_msg @@ -8584,7 +8611,6 @@ def test_duplicate_chart_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = native_dashboard.DuplicateChartRequest() - assert args[0] == request_msg @@ -8607,7 +8633,6 @@ def test_export_native_dashboards_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = native_dashboard.ExportNativeDashboardsRequest() - assert args[0] == request_msg @@ -8630,7 +8655,6 @@ def test_import_native_dashboards_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = native_dashboard.ImportNativeDashboardsRequest() - assert args[0] == request_msg @@ -8680,7 +8704,6 @@ async def test_create_native_dashboard_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcc_native_dashboard.CreateNativeDashboardRequest() - assert args[0] == request_msg @@ -8716,7 +8739,6 @@ async def test_get_native_dashboard_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = native_dashboard.GetNativeDashboardRequest() - assert args[0] == request_msg @@ -8745,7 +8767,6 @@ async def test_list_native_dashboards_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = native_dashboard.ListNativeDashboardsRequest() - assert args[0] == request_msg @@ -8781,7 +8802,6 @@ async def test_update_native_dashboard_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcc_native_dashboard.UpdateNativeDashboardRequest() - assert args[0] == request_msg @@ -8817,7 +8837,6 @@ async def test_duplicate_native_dashboard_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcc_native_dashboard.DuplicateNativeDashboardRequest() - assert args[0] == request_msg @@ -8842,7 +8861,6 @@ async def test_delete_native_dashboard_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = native_dashboard.DeleteNativeDashboardRequest() - assert args[0] == request_msg @@ -8867,7 +8885,6 @@ async def test_add_chart_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = native_dashboard.AddChartRequest() - assert args[0] == request_msg @@ -8901,7 +8918,6 @@ async def test_remove_chart_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = native_dashboard.RemoveChartRequest() - assert args[0] == request_msg @@ -8926,7 +8942,6 @@ async def test_edit_chart_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = native_dashboard.EditChartRequest() - assert args[0] == request_msg @@ -8951,7 +8966,6 @@ async def test_duplicate_chart_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = native_dashboard.DuplicateChartRequest() - assert args[0] == request_msg @@ -8978,7 +8992,6 @@ async def test_export_native_dashboards_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = native_dashboard.ExportNativeDashboardsRequest() - assert args[0] == request_msg @@ -9005,7 +9018,6 @@ async def test_import_native_dashboards_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = native_dashboard.ImportNativeDashboardsRequest() - assert args[0] == request_msg @@ -11303,7 +11315,6 @@ def test_create_native_dashboard_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcc_native_dashboard.CreateNativeDashboardRequest() - assert args[0] == request_msg @@ -11325,7 +11336,6 @@ def test_get_native_dashboard_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = native_dashboard.GetNativeDashboardRequest() - assert args[0] == request_msg @@ -11347,7 +11357,6 @@ def test_list_native_dashboards_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = native_dashboard.ListNativeDashboardsRequest() - assert args[0] == request_msg @@ -11369,7 +11378,6 @@ def test_update_native_dashboard_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcc_native_dashboard.UpdateNativeDashboardRequest() - assert args[0] == request_msg @@ -11391,7 +11399,6 @@ def test_duplicate_native_dashboard_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcc_native_dashboard.DuplicateNativeDashboardRequest() - assert args[0] == request_msg @@ -11413,7 +11420,6 @@ def test_delete_native_dashboard_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = native_dashboard.DeleteNativeDashboardRequest() - assert args[0] == request_msg @@ -11433,7 +11439,6 @@ def test_add_chart_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = native_dashboard.AddChartRequest() - assert args[0] == request_msg @@ -11453,7 +11458,6 @@ def test_remove_chart_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = native_dashboard.RemoveChartRequest() - assert args[0] == request_msg @@ -11473,7 +11477,6 @@ def test_edit_chart_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = native_dashboard.EditChartRequest() - assert args[0] == request_msg @@ -11493,7 +11496,6 @@ def test_duplicate_chart_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = native_dashboard.DuplicateChartRequest() - assert args[0] == request_msg @@ -11515,7 +11517,6 @@ def test_export_native_dashboards_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = native_dashboard.ExportNativeDashboardsRequest() - assert args[0] == request_msg @@ -11537,7 +11538,6 @@ def test_import_native_dashboards_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = native_dashboard.ImportNativeDashboardsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-chronicle/tests/unit/gapic/chronicle_v1/test_reference_list_service.py b/packages/google-cloud-chronicle/tests/unit/gapic/chronicle_v1/test_reference_list_service.py index 328286ac2e28..ab8bd59e5917 100644 --- a/packages/google-cloud-chronicle/tests/unit/gapic/chronicle_v1/test_reference_list_service.py +++ b/packages/google-cloud-chronicle/tests/unit/gapic/chronicle_v1/test_reference_list_service.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" @@ -1374,8 +1390,8 @@ def test_reference_list_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - reference_list.GetReferenceListRequest, - dict, + reference_list.GetReferenceListRequest(), + {}, ], ) def test_get_reference_list(request_type, transport: str = "grpc"): @@ -1386,7 +1402,7 @@ def test_get_reference_list(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1447,9 +1463,10 @@ def test_get_reference_list_non_empty_request_with_auto_populated_field(): client.get_reference_list(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == reference_list.GetReferenceListRequest( + request_msg = reference_list.GetReferenceListRequest( name="name_value", ) + assert args[0] == request_msg def test_get_reference_list_use_cached_wrapped_rpc(): @@ -1534,9 +1551,14 @@ async def test_get_reference_list_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_reference_list_async( - transport: str = "grpc_asyncio", request_type=reference_list.GetReferenceListRequest -): +@pytest.mark.parametrize( + "request_type", + [ + reference_list.GetReferenceListRequest(), + {}, + ], +) +async def test_get_reference_list_async(request_type, transport: str = "grpc_asyncio"): client = ReferenceListServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1544,7 +1566,7 @@ async def test_get_reference_list_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( @@ -1582,11 +1604,6 @@ async def test_get_reference_list_async( assert response.rule_associations_count == 2479 -@pytest.mark.asyncio -async def test_get_reference_list_async_from_dict(): - await test_get_reference_list_async(request_type=dict) - - def test_get_reference_list_field_headers(): client = ReferenceListServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1741,8 +1758,8 @@ async def test_get_reference_list_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - reference_list.ListReferenceListsRequest, - dict, + reference_list.ListReferenceListsRequest(), + {}, ], ) def test_list_reference_lists(request_type, transport: str = "grpc"): @@ -1753,7 +1770,7 @@ def test_list_reference_lists(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1802,10 +1819,11 @@ def test_list_reference_lists_non_empty_request_with_auto_populated_field(): client.list_reference_lists(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == reference_list.ListReferenceListsRequest( + request_msg = reference_list.ListReferenceListsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_reference_lists_use_cached_wrapped_rpc(): @@ -1890,9 +1908,15 @@ async def test_list_reference_lists_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + reference_list.ListReferenceListsRequest(), + {}, + ], +) async def test_list_reference_lists_async( - transport: str = "grpc_asyncio", - request_type=reference_list.ListReferenceListsRequest, + request_type, transport: str = "grpc_asyncio" ): client = ReferenceListServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1901,7 +1925,7 @@ async def test_list_reference_lists_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( @@ -1926,11 +1950,6 @@ async def test_list_reference_lists_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_reference_lists_async_from_dict(): - await test_list_reference_lists_async(request_type=dict) - - def test_list_reference_lists_field_headers(): client = ReferenceListServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2283,8 +2302,8 @@ async def test_list_reference_lists_async_pages(): @pytest.mark.parametrize( "request_type", [ - gcc_reference_list.CreateReferenceListRequest, - dict, + gcc_reference_list.CreateReferenceListRequest(), + {}, ], ) def test_create_reference_list(request_type, transport: str = "grpc"): @@ -2295,7 +2314,7 @@ def test_create_reference_list(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2357,10 +2376,11 @@ def test_create_reference_list_non_empty_request_with_auto_populated_field(): client.create_reference_list(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcc_reference_list.CreateReferenceListRequest( + request_msg = gcc_reference_list.CreateReferenceListRequest( parent="parent_value", reference_list_id="reference_list_id_value", ) + assert args[0] == request_msg def test_create_reference_list_use_cached_wrapped_rpc(): @@ -2446,9 +2466,15 @@ async def test_create_reference_list_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcc_reference_list.CreateReferenceListRequest(), + {}, + ], +) async def test_create_reference_list_async( - transport: str = "grpc_asyncio", - request_type=gcc_reference_list.CreateReferenceListRequest, + request_type, transport: str = "grpc_asyncio" ): client = ReferenceListServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2457,7 +2483,7 @@ async def test_create_reference_list_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( @@ -2495,11 +2521,6 @@ async def test_create_reference_list_async( assert response.rule_associations_count == 2479 -@pytest.mark.asyncio -async def test_create_reference_list_async_from_dict(): - await test_create_reference_list_async(request_type=dict) - - def test_create_reference_list_field_headers(): client = ReferenceListServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2674,8 +2695,8 @@ async def test_create_reference_list_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcc_reference_list.UpdateReferenceListRequest, - dict, + gcc_reference_list.UpdateReferenceListRequest(), + {}, ], ) def test_update_reference_list(request_type, transport: str = "grpc"): @@ -2686,7 +2707,7 @@ def test_update_reference_list(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2745,7 +2766,8 @@ def test_update_reference_list_non_empty_request_with_auto_populated_field(): client.update_reference_list(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcc_reference_list.UpdateReferenceListRequest() + request_msg = gcc_reference_list.UpdateReferenceListRequest() + assert args[0] == request_msg def test_update_reference_list_use_cached_wrapped_rpc(): @@ -2831,9 +2853,15 @@ async def test_update_reference_list_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcc_reference_list.UpdateReferenceListRequest(), + {}, + ], +) async def test_update_reference_list_async( - transport: str = "grpc_asyncio", - request_type=gcc_reference_list.UpdateReferenceListRequest, + request_type, transport: str = "grpc_asyncio" ): client = ReferenceListServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2842,7 +2870,7 @@ async def test_update_reference_list_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( @@ -2880,11 +2908,6 @@ async def test_update_reference_list_async( assert response.rule_associations_count == 2479 -@pytest.mark.asyncio -async def test_update_reference_list_async_from_dict(): - await test_update_reference_list_async(request_type=dict) - - def test_update_reference_list_field_headers(): client = ReferenceListServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4024,7 +4047,6 @@ def test_get_reference_list_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reference_list.GetReferenceListRequest() - assert args[0] == request_msg @@ -4047,7 +4069,6 @@ def test_list_reference_lists_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reference_list.ListReferenceListsRequest() - assert args[0] == request_msg @@ -4070,7 +4091,6 @@ def test_create_reference_list_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcc_reference_list.CreateReferenceListRequest() - assert args[0] == request_msg @@ -4093,7 +4113,6 @@ def test_update_reference_list_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcc_reference_list.UpdateReferenceListRequest() - assert args[0] == request_msg @@ -4141,7 +4160,6 @@ async def test_get_reference_list_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reference_list.GetReferenceListRequest() - assert args[0] == request_msg @@ -4170,7 +4188,6 @@ async def test_list_reference_lists_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reference_list.ListReferenceListsRequest() - assert args[0] == request_msg @@ -4204,7 +4221,6 @@ async def test_create_reference_list_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcc_reference_list.CreateReferenceListRequest() - assert args[0] == request_msg @@ -4238,7 +4254,6 @@ async def test_update_reference_list_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcc_reference_list.UpdateReferenceListRequest() - assert args[0] == request_msg @@ -5295,7 +5310,6 @@ def test_get_reference_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reference_list.GetReferenceListRequest() - assert args[0] == request_msg @@ -5317,7 +5331,6 @@ def test_list_reference_lists_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reference_list.ListReferenceListsRequest() - assert args[0] == request_msg @@ -5339,7 +5352,6 @@ def test_create_reference_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcc_reference_list.CreateReferenceListRequest() - assert args[0] == request_msg @@ -5361,7 +5373,6 @@ def test_update_reference_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcc_reference_list.UpdateReferenceListRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-chronicle/tests/unit/gapic/chronicle_v1/test_rule_service.py b/packages/google-cloud-chronicle/tests/unit/gapic/chronicle_v1/test_rule_service.py index 5798e1908b62..699fba4cebd9 100644 --- a/packages/google-cloud-chronicle/tests/unit/gapic/chronicle_v1/test_rule_service.py +++ b/packages/google-cloud-chronicle/tests/unit/gapic/chronicle_v1/test_rule_service.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 @@ -116,6 +117,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" @@ -1281,8 +1297,8 @@ def test_rule_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - gcc_rule.CreateRuleRequest, - dict, + gcc_rule.CreateRuleRequest(), + {}, ], ) def test_create_rule(request_type, transport: str = "grpc"): @@ -1293,7 +1309,7 @@ def test_create_rule(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_rule), "__call__") as call: @@ -1359,9 +1375,10 @@ def test_create_rule_non_empty_request_with_auto_populated_field(): client.create_rule(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcc_rule.CreateRuleRequest( + request_msg = gcc_rule.CreateRuleRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_rule_use_cached_wrapped_rpc(): @@ -1442,9 +1459,14 @@ async def test_create_rule_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_rule_async( - transport: str = "grpc_asyncio", request_type=gcc_rule.CreateRuleRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcc_rule.CreateRuleRequest(), + {}, + ], +) +async def test_create_rule_async(request_type, transport: str = "grpc_asyncio"): client = RuleServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1452,7 +1474,7 @@ async def test_create_rule_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_rule), "__call__") as call: @@ -1497,11 +1519,6 @@ async def test_create_rule_async( assert response.near_real_time_live_rule_eligible is True -@pytest.mark.asyncio -async def test_create_rule_async_from_dict(): - await test_create_rule_async(request_type=dict) - - def test_create_rule_field_headers(): client = RuleServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1654,8 +1671,8 @@ async def test_create_rule_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - rule.GetRuleRequest, - dict, + rule.GetRuleRequest(), + {}, ], ) def test_get_rule(request_type, transport: str = "grpc"): @@ -1666,7 +1683,7 @@ def test_get_rule(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_rule), "__call__") as call: @@ -1732,9 +1749,10 @@ def test_get_rule_non_empty_request_with_auto_populated_field(): client.get_rule(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == rule.GetRuleRequest( + request_msg = rule.GetRuleRequest( name="name_value", ) + assert args[0] == request_msg def test_get_rule_use_cached_wrapped_rpc(): @@ -1813,9 +1831,14 @@ async def test_get_rule_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn @pytest.mark.asyncio -async def test_get_rule_async( - transport: str = "grpc_asyncio", request_type=rule.GetRuleRequest -): +@pytest.mark.parametrize( + "request_type", + [ + rule.GetRuleRequest(), + {}, + ], +) +async def test_get_rule_async(request_type, transport: str = "grpc_asyncio"): client = RuleServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1823,7 +1846,7 @@ async def test_get_rule_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_rule), "__call__") as call: @@ -1868,11 +1891,6 @@ async def test_get_rule_async( assert response.near_real_time_live_rule_eligible is True -@pytest.mark.asyncio -async def test_get_rule_async_from_dict(): - await test_get_rule_async(request_type=dict) - - def test_get_rule_field_headers(): client = RuleServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2015,8 +2033,8 @@ async def test_get_rule_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - rule.ListRulesRequest, - dict, + rule.ListRulesRequest(), + {}, ], ) def test_list_rules(request_type, transport: str = "grpc"): @@ -2027,7 +2045,7 @@ def test_list_rules(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_rules), "__call__") as call: @@ -2073,11 +2091,12 @@ def test_list_rules_non_empty_request_with_auto_populated_field(): client.list_rules(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == rule.ListRulesRequest( + request_msg = rule.ListRulesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_rules_use_cached_wrapped_rpc(): @@ -2156,9 +2175,14 @@ async def test_list_rules_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_list_rules_async( - transport: str = "grpc_asyncio", request_type=rule.ListRulesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + rule.ListRulesRequest(), + {}, + ], +) +async def test_list_rules_async(request_type, transport: str = "grpc_asyncio"): client = RuleServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2166,7 +2190,7 @@ async def test_list_rules_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_rules), "__call__") as call: @@ -2189,11 +2213,6 @@ async def test_list_rules_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_rules_async_from_dict(): - await test_list_rules_async(request_type=dict) - - def test_list_rules_field_headers(): client = RuleServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2530,8 +2549,8 @@ async def test_list_rules_async_pages(): @pytest.mark.parametrize( "request_type", [ - gcc_rule.UpdateRuleRequest, - dict, + gcc_rule.UpdateRuleRequest(), + {}, ], ) def test_update_rule(request_type, transport: str = "grpc"): @@ -2542,7 +2561,7 @@ def test_update_rule(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_rule), "__call__") as call: @@ -2606,7 +2625,8 @@ def test_update_rule_non_empty_request_with_auto_populated_field(): client.update_rule(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcc_rule.UpdateRuleRequest() + request_msg = gcc_rule.UpdateRuleRequest() + assert args[0] == request_msg def test_update_rule_use_cached_wrapped_rpc(): @@ -2687,9 +2707,14 @@ async def test_update_rule_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_rule_async( - transport: str = "grpc_asyncio", request_type=gcc_rule.UpdateRuleRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcc_rule.UpdateRuleRequest(), + {}, + ], +) +async def test_update_rule_async(request_type, transport: str = "grpc_asyncio"): client = RuleServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2697,7 +2722,7 @@ async def test_update_rule_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_rule), "__call__") as call: @@ -2742,11 +2767,6 @@ async def test_update_rule_async( assert response.near_real_time_live_rule_eligible is True -@pytest.mark.asyncio -async def test_update_rule_async_from_dict(): - await test_update_rule_async(request_type=dict) - - def test_update_rule_field_headers(): client = RuleServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2899,8 +2919,8 @@ async def test_update_rule_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - rule.DeleteRuleRequest, - dict, + rule.DeleteRuleRequest(), + {}, ], ) def test_delete_rule(request_type, transport: str = "grpc"): @@ -2911,7 +2931,7 @@ def test_delete_rule(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_rule), "__call__") as call: @@ -2952,9 +2972,10 @@ def test_delete_rule_non_empty_request_with_auto_populated_field(): client.delete_rule(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == rule.DeleteRuleRequest( + request_msg = rule.DeleteRuleRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_rule_use_cached_wrapped_rpc(): @@ -3035,9 +3056,14 @@ async def test_delete_rule_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_rule_async( - transport: str = "grpc_asyncio", request_type=rule.DeleteRuleRequest -): +@pytest.mark.parametrize( + "request_type", + [ + rule.DeleteRuleRequest(), + {}, + ], +) +async def test_delete_rule_async(request_type, transport: str = "grpc_asyncio"): client = RuleServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3045,7 +3071,7 @@ async def test_delete_rule_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_rule), "__call__") as call: @@ -3063,11 +3089,6 @@ async def test_delete_rule_async( assert response is None -@pytest.mark.asyncio -async def test_delete_rule_async_from_dict(): - await test_delete_rule_async(request_type=dict) - - def test_delete_rule_field_headers(): client = RuleServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3210,8 +3231,8 @@ async def test_delete_rule_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - rule.ListRuleRevisionsRequest, - dict, + rule.ListRuleRevisionsRequest(), + {}, ], ) def test_list_rule_revisions(request_type, transport: str = "grpc"): @@ -3222,7 +3243,7 @@ def test_list_rule_revisions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3271,10 +3292,11 @@ def test_list_rule_revisions_non_empty_request_with_auto_populated_field(): client.list_rule_revisions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == rule.ListRuleRevisionsRequest( + request_msg = rule.ListRuleRevisionsRequest( name="name_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_rule_revisions_use_cached_wrapped_rpc(): @@ -3359,9 +3381,14 @@ async def test_list_rule_revisions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_rule_revisions_async( - transport: str = "grpc_asyncio", request_type=rule.ListRuleRevisionsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + rule.ListRuleRevisionsRequest(), + {}, + ], +) +async def test_list_rule_revisions_async(request_type, transport: str = "grpc_asyncio"): client = RuleServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3369,7 +3396,7 @@ async def test_list_rule_revisions_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( @@ -3394,11 +3421,6 @@ async def test_list_rule_revisions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_rule_revisions_async_from_dict(): - await test_list_rule_revisions_async(request_type=dict) - - def test_list_rule_revisions_field_headers(): client = RuleServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3751,8 +3773,8 @@ async def test_list_rule_revisions_async_pages(): @pytest.mark.parametrize( "request_type", [ - rule.CreateRetrohuntRequest, - dict, + rule.CreateRetrohuntRequest(), + {}, ], ) def test_create_retrohunt(request_type, transport: str = "grpc"): @@ -3763,7 +3785,7 @@ def test_create_retrohunt(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_retrohunt), "__call__") as call: @@ -3804,9 +3826,10 @@ def test_create_retrohunt_non_empty_request_with_auto_populated_field(): client.create_retrohunt(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == rule.CreateRetrohuntRequest( + request_msg = rule.CreateRetrohuntRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_retrohunt_use_cached_wrapped_rpc(): @@ -3899,9 +3922,14 @@ async def test_create_retrohunt_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_retrohunt_async( - transport: str = "grpc_asyncio", request_type=rule.CreateRetrohuntRequest -): +@pytest.mark.parametrize( + "request_type", + [ + rule.CreateRetrohuntRequest(), + {}, + ], +) +async def test_create_retrohunt_async(request_type, transport: str = "grpc_asyncio"): client = RuleServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3909,7 +3937,7 @@ async def test_create_retrohunt_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_retrohunt), "__call__") as call: @@ -3929,11 +3957,6 @@ async def test_create_retrohunt_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_retrohunt_async_from_dict(): - await test_create_retrohunt_async(request_type=dict) - - def test_create_retrohunt_field_headers(): client = RuleServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4090,8 +4113,8 @@ async def test_create_retrohunt_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - rule.GetRetrohuntRequest, - dict, + rule.GetRetrohuntRequest(), + {}, ], ) def test_get_retrohunt(request_type, transport: str = "grpc"): @@ -4102,7 +4125,7 @@ def test_get_retrohunt(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_retrohunt), "__call__") as call: @@ -4150,9 +4173,10 @@ def test_get_retrohunt_non_empty_request_with_auto_populated_field(): client.get_retrohunt(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == rule.GetRetrohuntRequest( + request_msg = rule.GetRetrohuntRequest( name="name_value", ) + assert args[0] == request_msg def test_get_retrohunt_use_cached_wrapped_rpc(): @@ -4233,9 +4257,14 @@ async def test_get_retrohunt_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_retrohunt_async( - transport: str = "grpc_asyncio", request_type=rule.GetRetrohuntRequest -): +@pytest.mark.parametrize( + "request_type", + [ + rule.GetRetrohuntRequest(), + {}, + ], +) +async def test_get_retrohunt_async(request_type, transport: str = "grpc_asyncio"): client = RuleServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4243,7 +4272,7 @@ async def test_get_retrohunt_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_retrohunt), "__call__") as call: @@ -4270,11 +4299,6 @@ async def test_get_retrohunt_async( assert math.isclose(response.progress_percentage, 0.2034, rel_tol=1e-6) -@pytest.mark.asyncio -async def test_get_retrohunt_async_from_dict(): - await test_get_retrohunt_async(request_type=dict) - - def test_get_retrohunt_field_headers(): client = RuleServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4417,8 +4441,8 @@ async def test_get_retrohunt_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - rule.ListRetrohuntsRequest, - dict, + rule.ListRetrohuntsRequest(), + {}, ], ) def test_list_retrohunts(request_type, transport: str = "grpc"): @@ -4429,7 +4453,7 @@ def test_list_retrohunts(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_retrohunts), "__call__") as call: @@ -4475,11 +4499,12 @@ def test_list_retrohunts_non_empty_request_with_auto_populated_field(): client.list_retrohunts(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == rule.ListRetrohuntsRequest( + request_msg = rule.ListRetrohuntsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_retrohunts_use_cached_wrapped_rpc(): @@ -4560,9 +4585,14 @@ async def test_list_retrohunts_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_retrohunts_async( - transport: str = "grpc_asyncio", request_type=rule.ListRetrohuntsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + rule.ListRetrohuntsRequest(), + {}, + ], +) +async def test_list_retrohunts_async(request_type, transport: str = "grpc_asyncio"): client = RuleServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4570,7 +4600,7 @@ async def test_list_retrohunts_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_retrohunts), "__call__") as call: @@ -4593,11 +4623,6 @@ async def test_list_retrohunts_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_retrohunts_async_from_dict(): - await test_list_retrohunts_async(request_type=dict) - - def test_list_retrohunts_field_headers(): client = RuleServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4934,8 +4959,8 @@ async def test_list_retrohunts_async_pages(): @pytest.mark.parametrize( "request_type", [ - rule.GetRuleDeploymentRequest, - dict, + rule.GetRuleDeploymentRequest(), + {}, ], ) def test_get_rule_deployment(request_type, transport: str = "grpc"): @@ -4946,7 +4971,7 @@ def test_get_rule_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5008,9 +5033,10 @@ def test_get_rule_deployment_non_empty_request_with_auto_populated_field(): client.get_rule_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == rule.GetRuleDeploymentRequest( + request_msg = rule.GetRuleDeploymentRequest( name="name_value", ) + assert args[0] == request_msg def test_get_rule_deployment_use_cached_wrapped_rpc(): @@ -5095,9 +5121,14 @@ async def test_get_rule_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_rule_deployment_async( - transport: str = "grpc_asyncio", request_type=rule.GetRuleDeploymentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + rule.GetRuleDeploymentRequest(), + {}, + ], +) +async def test_get_rule_deployment_async(request_type, transport: str = "grpc_asyncio"): client = RuleServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5105,7 +5136,7 @@ async def test_get_rule_deployment_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( @@ -5144,11 +5175,6 @@ async def test_get_rule_deployment_async( assert response.consumer_rules == ["consumer_rules_value"] -@pytest.mark.asyncio -async def test_get_rule_deployment_async_from_dict(): - await test_get_rule_deployment_async(request_type=dict) - - def test_get_rule_deployment_field_headers(): client = RuleServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5299,8 +5325,8 @@ async def test_get_rule_deployment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - rule.ListRuleDeploymentsRequest, - dict, + rule.ListRuleDeploymentsRequest(), + {}, ], ) def test_list_rule_deployments(request_type, transport: str = "grpc"): @@ -5311,7 +5337,7 @@ def test_list_rule_deployments(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5361,11 +5387,12 @@ def test_list_rule_deployments_non_empty_request_with_auto_populated_field(): client.list_rule_deployments(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == rule.ListRuleDeploymentsRequest( + request_msg = rule.ListRuleDeploymentsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_rule_deployments_use_cached_wrapped_rpc(): @@ -5451,8 +5478,15 @@ async def test_list_rule_deployments_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + rule.ListRuleDeploymentsRequest(), + {}, + ], +) async def test_list_rule_deployments_async( - transport: str = "grpc_asyncio", request_type=rule.ListRuleDeploymentsRequest + request_type, transport: str = "grpc_asyncio" ): client = RuleServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5461,7 +5495,7 @@ async def test_list_rule_deployments_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( @@ -5486,11 +5520,6 @@ async def test_list_rule_deployments_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_rule_deployments_async_from_dict(): - await test_list_rule_deployments_async(request_type=dict) - - def test_list_rule_deployments_field_headers(): client = RuleServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5843,8 +5872,8 @@ async def test_list_rule_deployments_async_pages(): @pytest.mark.parametrize( "request_type", [ - rule.UpdateRuleDeploymentRequest, - dict, + rule.UpdateRuleDeploymentRequest(), + {}, ], ) def test_update_rule_deployment(request_type, transport: str = "grpc"): @@ -5855,7 +5884,7 @@ def test_update_rule_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5915,7 +5944,8 @@ def test_update_rule_deployment_non_empty_request_with_auto_populated_field(): client.update_rule_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == rule.UpdateRuleDeploymentRequest() + request_msg = rule.UpdateRuleDeploymentRequest() + assert args[0] == request_msg def test_update_rule_deployment_use_cached_wrapped_rpc(): @@ -6001,8 +6031,15 @@ async def test_update_rule_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + rule.UpdateRuleDeploymentRequest(), + {}, + ], +) async def test_update_rule_deployment_async( - transport: str = "grpc_asyncio", request_type=rule.UpdateRuleDeploymentRequest + request_type, transport: str = "grpc_asyncio" ): client = RuleServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -6011,7 +6048,7 @@ async def test_update_rule_deployment_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( @@ -6050,11 +6087,6 @@ async def test_update_rule_deployment_async( assert response.consumer_rules == ["consumer_rules_value"] -@pytest.mark.asyncio -async def test_update_rule_deployment_async_from_dict(): - await test_update_rule_deployment_async(request_type=dict) - - def test_update_rule_deployment_field_headers(): client = RuleServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8855,7 +8887,6 @@ def test_create_rule_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcc_rule.CreateRuleRequest() - assert args[0] == request_msg @@ -8876,7 +8907,6 @@ def test_get_rule_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rule.GetRuleRequest() - assert args[0] == request_msg @@ -8897,7 +8927,6 @@ def test_list_rules_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rule.ListRulesRequest() - assert args[0] == request_msg @@ -8918,7 +8947,6 @@ def test_update_rule_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcc_rule.UpdateRuleRequest() - assert args[0] == request_msg @@ -8939,7 +8967,6 @@ def test_delete_rule_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rule.DeleteRuleRequest() - assert args[0] == request_msg @@ -8962,7 +8989,6 @@ def test_list_rule_revisions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rule.ListRuleRevisionsRequest() - assert args[0] == request_msg @@ -8983,7 +9009,6 @@ def test_create_retrohunt_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rule.CreateRetrohuntRequest() - assert args[0] == request_msg @@ -9004,7 +9029,6 @@ def test_get_retrohunt_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rule.GetRetrohuntRequest() - assert args[0] == request_msg @@ -9025,7 +9049,6 @@ def test_list_retrohunts_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rule.ListRetrohuntsRequest() - assert args[0] == request_msg @@ -9048,7 +9071,6 @@ def test_get_rule_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rule.GetRuleDeploymentRequest() - assert args[0] == request_msg @@ -9071,7 +9093,6 @@ def test_list_rule_deployments_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rule.ListRuleDeploymentsRequest() - assert args[0] == request_msg @@ -9094,7 +9115,6 @@ def test_update_rule_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rule.UpdateRuleDeploymentRequest() - assert args[0] == request_msg @@ -9146,7 +9166,6 @@ async def test_create_rule_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcc_rule.CreateRuleRequest() - assert args[0] == request_msg @@ -9184,7 +9203,6 @@ async def test_get_rule_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rule.GetRuleRequest() - assert args[0] == request_msg @@ -9211,7 +9229,6 @@ async def test_list_rules_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rule.ListRulesRequest() - assert args[0] == request_msg @@ -9249,7 +9266,6 @@ async def test_update_rule_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcc_rule.UpdateRuleRequest() - assert args[0] == request_msg @@ -9272,7 +9288,6 @@ async def test_delete_rule_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rule.DeleteRuleRequest() - assert args[0] == request_msg @@ -9301,7 +9316,6 @@ async def test_list_rule_revisions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rule.ListRuleRevisionsRequest() - assert args[0] == request_msg @@ -9326,7 +9340,6 @@ async def test_create_retrohunt_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rule.CreateRetrohuntRequest() - assert args[0] == request_msg @@ -9355,7 +9368,6 @@ async def test_get_retrohunt_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rule.GetRetrohuntRequest() - assert args[0] == request_msg @@ -9382,7 +9394,6 @@ async def test_list_retrohunts_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rule.ListRetrohuntsRequest() - assert args[0] == request_msg @@ -9418,7 +9429,6 @@ async def test_get_rule_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rule.GetRuleDeploymentRequest() - assert args[0] == request_msg @@ -9447,7 +9457,6 @@ async def test_list_rule_deployments_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rule.ListRuleDeploymentsRequest() - assert args[0] == request_msg @@ -9483,7 +9492,6 @@ async def test_update_rule_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rule.UpdateRuleDeploymentRequest() - assert args[0] == request_msg @@ -11791,7 +11799,6 @@ def test_create_rule_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcc_rule.CreateRuleRequest() - assert args[0] == request_msg @@ -11811,7 +11818,6 @@ def test_get_rule_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rule.GetRuleRequest() - assert args[0] == request_msg @@ -11831,7 +11837,6 @@ def test_list_rules_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rule.ListRulesRequest() - assert args[0] == request_msg @@ -11851,7 +11856,6 @@ def test_update_rule_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcc_rule.UpdateRuleRequest() - assert args[0] == request_msg @@ -11871,7 +11875,6 @@ def test_delete_rule_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rule.DeleteRuleRequest() - assert args[0] == request_msg @@ -11893,7 +11896,6 @@ def test_list_rule_revisions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rule.ListRuleRevisionsRequest() - assert args[0] == request_msg @@ -11913,7 +11915,6 @@ def test_create_retrohunt_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rule.CreateRetrohuntRequest() - assert args[0] == request_msg @@ -11933,7 +11934,6 @@ def test_get_retrohunt_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rule.GetRetrohuntRequest() - assert args[0] == request_msg @@ -11953,7 +11953,6 @@ def test_list_retrohunts_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rule.ListRetrohuntsRequest() - assert args[0] == request_msg @@ -11975,7 +11974,6 @@ def test_get_rule_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rule.GetRuleDeploymentRequest() - assert args[0] == request_msg @@ -11997,7 +11995,6 @@ def test_list_rule_deployments_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rule.ListRuleDeploymentsRequest() - assert args[0] == request_msg @@ -12019,7 +12016,6 @@ def test_update_rule_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rule.UpdateRuleDeploymentRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-cloudcontrolspartner/noxfile.py b/packages/google-cloud-cloudcontrolspartner/noxfile.py index 3df840200340..26cc3368c7ba 100644 --- a/packages/google-cloud-cloudcontrolspartner/noxfile.py +++ b/packages/google-cloud-cloudcontrolspartner/noxfile.py @@ -47,7 +47,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-cloudcontrolspartner" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-cloudcontrolspartner/setup.py b/packages/google-cloud-cloudcontrolspartner/setup.py index 28c6d936de67..72d0d864e14f 100644 --- a/packages/google-cloud-cloudcontrolspartner/setup.py +++ b/packages/google-cloud-cloudcontrolspartner/setup.py @@ -45,7 +45,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/google-cloud-cloudcontrolspartner/testing/constraints-3.10.txt b/packages/google-cloud-cloudcontrolspartner/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-cloudcontrolspartner/testing/constraints-3.10.txt +++ b/packages/google-cloud-cloudcontrolspartner/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-cloudcontrolspartner/tests/unit/gapic/cloudcontrolspartner_v1/test_cloud_controls_partner_core.py b/packages/google-cloud-cloudcontrolspartner/tests/unit/gapic/cloudcontrolspartner_v1/test_cloud_controls_partner_core.py index b436581c84b3..c9b1de8f1c8b 100644 --- a/packages/google-cloud-cloudcontrolspartner/tests/unit/gapic/cloudcontrolspartner_v1/test_cloud_controls_partner_core.py +++ b/packages/google-cloud-cloudcontrolspartner/tests/unit/gapic/cloudcontrolspartner_v1/test_cloud_controls_partner_core.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 @@ -117,6 +118,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" @@ -1392,8 +1408,8 @@ def test_cloud_controls_partner_core_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - customer_workloads.GetWorkloadRequest, - dict, + customer_workloads.GetWorkloadRequest(), + {}, ], ) def test_get_workload(request_type, transport: str = "grpc"): @@ -1404,7 +1420,7 @@ def test_get_workload(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_workload), "__call__") as call: @@ -1463,9 +1479,10 @@ def test_get_workload_non_empty_request_with_auto_populated_field(): client.get_workload(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == customer_workloads.GetWorkloadRequest( + request_msg = customer_workloads.GetWorkloadRequest( name="name_value", ) + assert args[0] == request_msg def test_get_workload_use_cached_wrapped_rpc(): @@ -1546,9 +1563,14 @@ async def test_get_workload_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_workload_async( - transport: str = "grpc_asyncio", request_type=customer_workloads.GetWorkloadRequest -): +@pytest.mark.parametrize( + "request_type", + [ + customer_workloads.GetWorkloadRequest(), + {}, + ], +) +async def test_get_workload_async(request_type, transport: str = "grpc_asyncio"): client = CloudControlsPartnerCoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1556,7 +1578,7 @@ async def test_get_workload_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_workload), "__call__") as call: @@ -1594,11 +1616,6 @@ async def test_get_workload_async( ) -@pytest.mark.asyncio -async def test_get_workload_async_from_dict(): - await test_get_workload_async(request_type=dict) - - def test_get_workload_field_headers(): client = CloudControlsPartnerCoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1745,8 +1762,8 @@ async def test_get_workload_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - customer_workloads.ListWorkloadsRequest, - dict, + customer_workloads.ListWorkloadsRequest(), + {}, ], ) def test_list_workloads(request_type, transport: str = "grpc"): @@ -1757,7 +1774,7 @@ def test_list_workloads(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_workloads), "__call__") as call: @@ -1806,12 +1823,13 @@ def test_list_workloads_non_empty_request_with_auto_populated_field(): client.list_workloads(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == customer_workloads.ListWorkloadsRequest( + request_msg = customer_workloads.ListWorkloadsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_workloads_use_cached_wrapped_rpc(): @@ -1892,10 +1910,14 @@ async def test_list_workloads_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_workloads_async( - transport: str = "grpc_asyncio", - request_type=customer_workloads.ListWorkloadsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + customer_workloads.ListWorkloadsRequest(), + {}, + ], +) +async def test_list_workloads_async(request_type, transport: str = "grpc_asyncio"): client = CloudControlsPartnerCoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1903,7 +1925,7 @@ async def test_list_workloads_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_workloads), "__call__") as call: @@ -1928,11 +1950,6 @@ async def test_list_workloads_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_workloads_async_from_dict(): - await test_list_workloads_async(request_type=dict) - - def test_list_workloads_field_headers(): client = CloudControlsPartnerCoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2269,8 +2286,8 @@ async def test_list_workloads_async_pages(): @pytest.mark.parametrize( "request_type", [ - customers.GetCustomerRequest, - dict, + customers.GetCustomerRequest(), + {}, ], ) def test_get_customer(request_type, transport: str = "grpc"): @@ -2281,7 +2298,7 @@ def test_get_customer(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_customer), "__call__") as call: @@ -2331,9 +2348,10 @@ def test_get_customer_non_empty_request_with_auto_populated_field(): client.get_customer(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == customers.GetCustomerRequest( + request_msg = customers.GetCustomerRequest( name="name_value", ) + assert args[0] == request_msg def test_get_customer_use_cached_wrapped_rpc(): @@ -2414,9 +2432,14 @@ async def test_get_customer_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_customer_async( - transport: str = "grpc_asyncio", request_type=customers.GetCustomerRequest -): +@pytest.mark.parametrize( + "request_type", + [ + customers.GetCustomerRequest(), + {}, + ], +) +async def test_get_customer_async(request_type, transport: str = "grpc_asyncio"): client = CloudControlsPartnerCoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2424,7 +2447,7 @@ async def test_get_customer_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_customer), "__call__") as call: @@ -2453,11 +2476,6 @@ async def test_get_customer_async( assert response.organization_domain == "organization_domain_value" -@pytest.mark.asyncio -async def test_get_customer_async_from_dict(): - await test_get_customer_async(request_type=dict) - - def test_get_customer_field_headers(): client = CloudControlsPartnerCoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2600,8 +2618,8 @@ async def test_get_customer_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - customers.ListCustomersRequest, - dict, + customers.ListCustomersRequest(), + {}, ], ) def test_list_customers(request_type, transport: str = "grpc"): @@ -2612,7 +2630,7 @@ def test_list_customers(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_customers), "__call__") as call: @@ -2661,12 +2679,13 @@ def test_list_customers_non_empty_request_with_auto_populated_field(): client.list_customers(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == customers.ListCustomersRequest( + request_msg = customers.ListCustomersRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_customers_use_cached_wrapped_rpc(): @@ -2747,9 +2766,14 @@ async def test_list_customers_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_customers_async( - transport: str = "grpc_asyncio", request_type=customers.ListCustomersRequest -): +@pytest.mark.parametrize( + "request_type", + [ + customers.ListCustomersRequest(), + {}, + ], +) +async def test_list_customers_async(request_type, transport: str = "grpc_asyncio"): client = CloudControlsPartnerCoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2757,7 +2781,7 @@ async def test_list_customers_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_customers), "__call__") as call: @@ -2782,11 +2806,6 @@ async def test_list_customers_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_customers_async_from_dict(): - await test_list_customers_async(request_type=dict) - - def test_list_customers_field_headers(): client = CloudControlsPartnerCoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3123,8 +3142,8 @@ async def test_list_customers_async_pages(): @pytest.mark.parametrize( "request_type", [ - ekm_connections.GetEkmConnectionsRequest, - dict, + ekm_connections.GetEkmConnectionsRequest(), + {}, ], ) def test_get_ekm_connections(request_type, transport: str = "grpc"): @@ -3135,7 +3154,7 @@ def test_get_ekm_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( @@ -3183,9 +3202,10 @@ def test_get_ekm_connections_non_empty_request_with_auto_populated_field(): client.get_ekm_connections(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == ekm_connections.GetEkmConnectionsRequest( + request_msg = ekm_connections.GetEkmConnectionsRequest( name="name_value", ) + assert args[0] == request_msg def test_get_ekm_connections_use_cached_wrapped_rpc(): @@ -3270,10 +3290,14 @@ async def test_get_ekm_connections_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_ekm_connections_async( - transport: str = "grpc_asyncio", - request_type=ekm_connections.GetEkmConnectionsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + ekm_connections.GetEkmConnectionsRequest(), + {}, + ], +) +async def test_get_ekm_connections_async(request_type, transport: str = "grpc_asyncio"): client = CloudControlsPartnerCoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3281,7 +3305,7 @@ async def test_get_ekm_connections_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( @@ -3306,11 +3330,6 @@ async def test_get_ekm_connections_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_ekm_connections_async_from_dict(): - await test_get_ekm_connections_async(request_type=dict) - - def test_get_ekm_connections_field_headers(): client = CloudControlsPartnerCoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3465,8 +3484,8 @@ async def test_get_ekm_connections_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - partner_permissions.GetPartnerPermissionsRequest, - dict, + partner_permissions.GetPartnerPermissionsRequest(), + {}, ], ) def test_get_partner_permissions(request_type, transport: str = "grpc"): @@ -3477,7 +3496,7 @@ def test_get_partner_permissions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3531,9 +3550,10 @@ def test_get_partner_permissions_non_empty_request_with_auto_populated_field(): client.get_partner_permissions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == partner_permissions.GetPartnerPermissionsRequest( + request_msg = partner_permissions.GetPartnerPermissionsRequest( name="name_value", ) + assert args[0] == request_msg def test_get_partner_permissions_use_cached_wrapped_rpc(): @@ -3619,9 +3639,15 @@ async def test_get_partner_permissions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + partner_permissions.GetPartnerPermissionsRequest(), + {}, + ], +) async def test_get_partner_permissions_async( - transport: str = "grpc_asyncio", - request_type=partner_permissions.GetPartnerPermissionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = CloudControlsPartnerCoreAsyncClient( credentials=async_anonymous_credentials(), @@ -3630,7 +3656,7 @@ async def test_get_partner_permissions_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( @@ -3661,11 +3687,6 @@ async def test_get_partner_permissions_async( ] -@pytest.mark.asyncio -async def test_get_partner_permissions_async_from_dict(): - await test_get_partner_permissions_async(request_type=dict) - - def test_get_partner_permissions_field_headers(): client = CloudControlsPartnerCoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3820,8 +3841,8 @@ async def test_get_partner_permissions_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - access_approval_requests.ListAccessApprovalRequestsRequest, - dict, + access_approval_requests.ListAccessApprovalRequestsRequest(), + {}, ], ) def test_list_access_approval_requests(request_type, transport: str = "grpc"): @@ -3832,7 +3853,7 @@ def test_list_access_approval_requests(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3885,12 +3906,13 @@ def test_list_access_approval_requests_non_empty_request_with_auto_populated_fie client.list_access_approval_requests(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == access_approval_requests.ListAccessApprovalRequestsRequest( + request_msg = access_approval_requests.ListAccessApprovalRequestsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_access_approval_requests_use_cached_wrapped_rpc(): @@ -3976,9 +3998,15 @@ async def test_list_access_approval_requests_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + access_approval_requests.ListAccessApprovalRequestsRequest(), + {}, + ], +) async def test_list_access_approval_requests_async( - transport: str = "grpc_asyncio", - request_type=access_approval_requests.ListAccessApprovalRequestsRequest, + request_type, transport: str = "grpc_asyncio" ): client = CloudControlsPartnerCoreAsyncClient( credentials=async_anonymous_credentials(), @@ -3987,7 +4015,7 @@ async def test_list_access_approval_requests_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( @@ -4014,11 +4042,6 @@ async def test_list_access_approval_requests_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_access_approval_requests_async_from_dict(): - await test_list_access_approval_requests_async(request_type=dict) - - def test_list_access_approval_requests_field_headers(): client = CloudControlsPartnerCoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4387,8 +4410,8 @@ async def test_list_access_approval_requests_async_pages(): @pytest.mark.parametrize( "request_type", [ - partners.GetPartnerRequest, - dict, + partners.GetPartnerRequest(), + {}, ], ) def test_get_partner(request_type, transport: str = "grpc"): @@ -4399,7 +4422,7 @@ def test_get_partner(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_partner), "__call__") as call: @@ -4447,9 +4470,10 @@ def test_get_partner_non_empty_request_with_auto_populated_field(): client.get_partner(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == partners.GetPartnerRequest( + request_msg = partners.GetPartnerRequest( name="name_value", ) + assert args[0] == request_msg def test_get_partner_use_cached_wrapped_rpc(): @@ -4530,9 +4554,14 @@ async def test_get_partner_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_partner_async( - transport: str = "grpc_asyncio", request_type=partners.GetPartnerRequest -): +@pytest.mark.parametrize( + "request_type", + [ + partners.GetPartnerRequest(), + {}, + ], +) +async def test_get_partner_async(request_type, transport: str = "grpc_asyncio"): client = CloudControlsPartnerCoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4540,7 +4569,7 @@ async def test_get_partner_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_partner), "__call__") as call: @@ -4567,11 +4596,6 @@ async def test_get_partner_async( assert response.partner_project_id == "partner_project_id_value" -@pytest.mark.asyncio -async def test_get_partner_async_from_dict(): - await test_get_partner_async(request_type=dict) - - def test_get_partner_field_headers(): client = CloudControlsPartnerCoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4714,8 +4738,8 @@ async def test_get_partner_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - customers.CreateCustomerRequest, - dict, + customers.CreateCustomerRequest(), + {}, ], ) def test_create_customer(request_type, transport: str = "grpc"): @@ -4726,7 +4750,7 @@ def test_create_customer(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_customer), "__call__") as call: @@ -4777,10 +4801,11 @@ def test_create_customer_non_empty_request_with_auto_populated_field(): client.create_customer(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == customers.CreateCustomerRequest( + request_msg = customers.CreateCustomerRequest( parent="parent_value", customer_id="customer_id_value", ) + assert args[0] == request_msg def test_create_customer_use_cached_wrapped_rpc(): @@ -4861,9 +4886,14 @@ async def test_create_customer_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_customer_async( - transport: str = "grpc_asyncio", request_type=customers.CreateCustomerRequest -): +@pytest.mark.parametrize( + "request_type", + [ + customers.CreateCustomerRequest(), + {}, + ], +) +async def test_create_customer_async(request_type, transport: str = "grpc_asyncio"): client = CloudControlsPartnerCoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4871,7 +4901,7 @@ async def test_create_customer_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_customer), "__call__") as call: @@ -4900,11 +4930,6 @@ async def test_create_customer_async( assert response.organization_domain == "organization_domain_value" -@pytest.mark.asyncio -async def test_create_customer_async_from_dict(): - await test_create_customer_async(request_type=dict) - - def test_create_customer_field_headers(): client = CloudControlsPartnerCoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5067,8 +5092,8 @@ async def test_create_customer_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - customers.UpdateCustomerRequest, - dict, + customers.UpdateCustomerRequest(), + {}, ], ) def test_update_customer(request_type, transport: str = "grpc"): @@ -5079,7 +5104,7 @@ def test_update_customer(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_customer), "__call__") as call: @@ -5127,7 +5152,8 @@ def test_update_customer_non_empty_request_with_auto_populated_field(): client.update_customer(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == customers.UpdateCustomerRequest() + request_msg = customers.UpdateCustomerRequest() + assert args[0] == request_msg def test_update_customer_use_cached_wrapped_rpc(): @@ -5208,9 +5234,14 @@ async def test_update_customer_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_customer_async( - transport: str = "grpc_asyncio", request_type=customers.UpdateCustomerRequest -): +@pytest.mark.parametrize( + "request_type", + [ + customers.UpdateCustomerRequest(), + {}, + ], +) +async def test_update_customer_async(request_type, transport: str = "grpc_asyncio"): client = CloudControlsPartnerCoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5218,7 +5249,7 @@ async def test_update_customer_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_customer), "__call__") as call: @@ -5247,11 +5278,6 @@ async def test_update_customer_async( assert response.organization_domain == "organization_domain_value" -@pytest.mark.asyncio -async def test_update_customer_async_from_dict(): - await test_update_customer_async(request_type=dict) - - def test_update_customer_field_headers(): client = CloudControlsPartnerCoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5404,8 +5430,8 @@ async def test_update_customer_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - customers.DeleteCustomerRequest, - dict, + customers.DeleteCustomerRequest(), + {}, ], ) def test_delete_customer(request_type, transport: str = "grpc"): @@ -5416,7 +5442,7 @@ def test_delete_customer(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_customer), "__call__") as call: @@ -5457,9 +5483,10 @@ def test_delete_customer_non_empty_request_with_auto_populated_field(): client.delete_customer(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == customers.DeleteCustomerRequest( + request_msg = customers.DeleteCustomerRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_customer_use_cached_wrapped_rpc(): @@ -5540,9 +5567,14 @@ async def test_delete_customer_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_customer_async( - transport: str = "grpc_asyncio", request_type=customers.DeleteCustomerRequest -): +@pytest.mark.parametrize( + "request_type", + [ + customers.DeleteCustomerRequest(), + {}, + ], +) +async def test_delete_customer_async(request_type, transport: str = "grpc_asyncio"): client = CloudControlsPartnerCoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5550,7 +5582,7 @@ async def test_delete_customer_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_customer), "__call__") as call: @@ -5568,11 +5600,6 @@ async def test_delete_customer_async( assert response is None -@pytest.mark.asyncio -async def test_delete_customer_async_from_dict(): - await test_delete_customer_async(request_type=dict) - - def test_delete_customer_field_headers(): client = CloudControlsPartnerCoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8104,7 +8131,6 @@ def test_get_workload_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = customer_workloads.GetWorkloadRequest() - assert args[0] == request_msg @@ -8125,7 +8151,6 @@ def test_list_workloads_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = customer_workloads.ListWorkloadsRequest() - assert args[0] == request_msg @@ -8146,7 +8171,6 @@ def test_get_customer_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = customers.GetCustomerRequest() - assert args[0] == request_msg @@ -8167,7 +8191,6 @@ def test_list_customers_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = customers.ListCustomersRequest() - assert args[0] == request_msg @@ -8190,7 +8213,6 @@ def test_get_ekm_connections_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ekm_connections.GetEkmConnectionsRequest() - assert args[0] == request_msg @@ -8213,7 +8235,6 @@ def test_get_partner_permissions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = partner_permissions.GetPartnerPermissionsRequest() - assert args[0] == request_msg @@ -8238,7 +8259,6 @@ def test_list_access_approval_requests_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = access_approval_requests.ListAccessApprovalRequestsRequest() - assert args[0] == request_msg @@ -8259,7 +8279,6 @@ def test_get_partner_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = partners.GetPartnerRequest() - assert args[0] == request_msg @@ -8280,7 +8299,6 @@ def test_create_customer_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = customers.CreateCustomerRequest() - assert args[0] == request_msg @@ -8301,7 +8319,6 @@ def test_update_customer_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = customers.UpdateCustomerRequest() - assert args[0] == request_msg @@ -8322,7 +8339,6 @@ def test_delete_customer_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = customers.DeleteCustomerRequest() - assert args[0] == request_msg @@ -8369,7 +8385,6 @@ async def test_get_workload_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = customer_workloads.GetWorkloadRequest() - assert args[0] == request_msg @@ -8397,7 +8412,6 @@ async def test_list_workloads_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = customer_workloads.ListWorkloadsRequest() - assert args[0] == request_msg @@ -8427,7 +8441,6 @@ async def test_get_customer_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = customers.GetCustomerRequest() - assert args[0] == request_msg @@ -8455,7 +8468,6 @@ async def test_list_customers_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = customers.ListCustomersRequest() - assert args[0] == request_msg @@ -8484,7 +8496,6 @@ async def test_get_ekm_connections_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ekm_connections.GetEkmConnectionsRequest() - assert args[0] == request_msg @@ -8516,7 +8527,6 @@ async def test_get_partner_permissions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = partner_permissions.GetPartnerPermissionsRequest() - assert args[0] == request_msg @@ -8546,7 +8556,6 @@ async def test_list_access_approval_requests_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = access_approval_requests.ListAccessApprovalRequestsRequest() - assert args[0] == request_msg @@ -8575,7 +8584,6 @@ async def test_get_partner_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = partners.GetPartnerRequest() - assert args[0] == request_msg @@ -8605,7 +8613,6 @@ async def test_create_customer_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = customers.CreateCustomerRequest() - assert args[0] == request_msg @@ -8635,7 +8642,6 @@ async def test_update_customer_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = customers.UpdateCustomerRequest() - assert args[0] == request_msg @@ -8658,7 +8664,6 @@ async def test_delete_customer_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = customers.DeleteCustomerRequest() - assert args[0] == request_msg @@ -10370,7 +10375,6 @@ def test_get_workload_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = customer_workloads.GetWorkloadRequest() - assert args[0] == request_msg @@ -10390,7 +10394,6 @@ def test_list_workloads_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = customer_workloads.ListWorkloadsRequest() - assert args[0] == request_msg @@ -10410,7 +10413,6 @@ def test_get_customer_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = customers.GetCustomerRequest() - assert args[0] == request_msg @@ -10430,7 +10432,6 @@ def test_list_customers_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = customers.ListCustomersRequest() - assert args[0] == request_msg @@ -10452,7 +10453,6 @@ def test_get_ekm_connections_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ekm_connections.GetEkmConnectionsRequest() - assert args[0] == request_msg @@ -10474,7 +10474,6 @@ def test_get_partner_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = partner_permissions.GetPartnerPermissionsRequest() - assert args[0] == request_msg @@ -10496,7 +10495,6 @@ def test_list_access_approval_requests_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = access_approval_requests.ListAccessApprovalRequestsRequest() - assert args[0] == request_msg @@ -10516,7 +10514,6 @@ def test_get_partner_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = partners.GetPartnerRequest() - assert args[0] == request_msg @@ -10536,7 +10533,6 @@ def test_create_customer_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = customers.CreateCustomerRequest() - assert args[0] == request_msg @@ -10556,7 +10552,6 @@ def test_update_customer_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = customers.UpdateCustomerRequest() - assert args[0] == request_msg @@ -10576,7 +10571,6 @@ def test_delete_customer_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = customers.DeleteCustomerRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-cloudcontrolspartner/tests/unit/gapic/cloudcontrolspartner_v1/test_cloud_controls_partner_monitoring.py b/packages/google-cloud-cloudcontrolspartner/tests/unit/gapic/cloudcontrolspartner_v1/test_cloud_controls_partner_monitoring.py index c32e49348f09..5c3c03ec1707 100644 --- a/packages/google-cloud-cloudcontrolspartner/tests/unit/gapic/cloudcontrolspartner_v1/test_cloud_controls_partner_monitoring.py +++ b/packages/google-cloud-cloudcontrolspartner/tests/unit/gapic/cloudcontrolspartner_v1/test_cloud_controls_partner_monitoring.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 @@ -109,6 +110,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" @@ -1437,8 +1453,8 @@ def test_cloud_controls_partner_monitoring_client_create_channel_credentials_fil @pytest.mark.parametrize( "request_type", [ - violations.ListViolationsRequest, - dict, + violations.ListViolationsRequest(), + {}, ], ) def test_list_violations(request_type, transport: str = "grpc"): @@ -1449,7 +1465,7 @@ def test_list_violations(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_violations), "__call__") as call: @@ -1498,12 +1514,13 @@ def test_list_violations_non_empty_request_with_auto_populated_field(): client.list_violations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == violations.ListViolationsRequest( + request_msg = violations.ListViolationsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_violations_use_cached_wrapped_rpc(): @@ -1584,9 +1601,14 @@ async def test_list_violations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_violations_async( - transport: str = "grpc_asyncio", request_type=violations.ListViolationsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + violations.ListViolationsRequest(), + {}, + ], +) +async def test_list_violations_async(request_type, transport: str = "grpc_asyncio"): client = CloudControlsPartnerMonitoringAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1594,7 +1616,7 @@ async def test_list_violations_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_violations), "__call__") as call: @@ -1619,11 +1641,6 @@ async def test_list_violations_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_violations_async_from_dict(): - await test_list_violations_async(request_type=dict) - - def test_list_violations_field_headers(): client = CloudControlsPartnerMonitoringClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1960,8 +1977,8 @@ async def test_list_violations_async_pages(): @pytest.mark.parametrize( "request_type", [ - violations.GetViolationRequest, - dict, + violations.GetViolationRequest(), + {}, ], ) def test_get_violation(request_type, transport: str = "grpc"): @@ -1972,7 +1989,7 @@ def test_get_violation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_violation), "__call__") as call: @@ -2026,9 +2043,10 @@ def test_get_violation_non_empty_request_with_auto_populated_field(): client.get_violation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == violations.GetViolationRequest( + request_msg = violations.GetViolationRequest( name="name_value", ) + assert args[0] == request_msg def test_get_violation_use_cached_wrapped_rpc(): @@ -2109,9 +2127,14 @@ async def test_get_violation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_violation_async( - transport: str = "grpc_asyncio", request_type=violations.GetViolationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + violations.GetViolationRequest(), + {}, + ], +) +async def test_get_violation_async(request_type, transport: str = "grpc_asyncio"): client = CloudControlsPartnerMonitoringAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2119,7 +2142,7 @@ async def test_get_violation_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_violation), "__call__") as call: @@ -2152,11 +2175,6 @@ async def test_get_violation_async( assert response.folder_id == 936 -@pytest.mark.asyncio -async def test_get_violation_async_from_dict(): - await test_get_violation_async(request_type=dict) - - def test_get_violation_field_headers(): client = CloudControlsPartnerMonitoringClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2867,7 +2885,6 @@ def test_list_violations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = violations.ListViolationsRequest() - assert args[0] == request_msg @@ -2888,7 +2905,6 @@ def test_get_violation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = violations.GetViolationRequest() - assert args[0] == request_msg @@ -2930,7 +2946,6 @@ async def test_list_violations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = violations.ListViolationsRequest() - assert args[0] == request_msg @@ -2962,7 +2977,6 @@ async def test_get_violation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = violations.GetViolationRequest() - assert args[0] == request_msg @@ -3280,7 +3294,6 @@ def test_list_violations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = violations.ListViolationsRequest() - assert args[0] == request_msg @@ -3300,7 +3313,6 @@ def test_get_violation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = violations.GetViolationRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-cloudcontrolspartner/tests/unit/gapic/cloudcontrolspartner_v1beta/test_cloud_controls_partner_core.py b/packages/google-cloud-cloudcontrolspartner/tests/unit/gapic/cloudcontrolspartner_v1beta/test_cloud_controls_partner_core.py index 3d52dae7d34e..20c298d95ebd 100644 --- a/packages/google-cloud-cloudcontrolspartner/tests/unit/gapic/cloudcontrolspartner_v1beta/test_cloud_controls_partner_core.py +++ b/packages/google-cloud-cloudcontrolspartner/tests/unit/gapic/cloudcontrolspartner_v1beta/test_cloud_controls_partner_core.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 @@ -117,6 +118,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" @@ -1392,8 +1408,8 @@ def test_cloud_controls_partner_core_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - customer_workloads.GetWorkloadRequest, - dict, + customer_workloads.GetWorkloadRequest(), + {}, ], ) def test_get_workload(request_type, transport: str = "grpc"): @@ -1404,7 +1420,7 @@ def test_get_workload(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_workload), "__call__") as call: @@ -1463,9 +1479,10 @@ def test_get_workload_non_empty_request_with_auto_populated_field(): client.get_workload(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == customer_workloads.GetWorkloadRequest( + request_msg = customer_workloads.GetWorkloadRequest( name="name_value", ) + assert args[0] == request_msg def test_get_workload_use_cached_wrapped_rpc(): @@ -1546,9 +1563,14 @@ async def test_get_workload_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_workload_async( - transport: str = "grpc_asyncio", request_type=customer_workloads.GetWorkloadRequest -): +@pytest.mark.parametrize( + "request_type", + [ + customer_workloads.GetWorkloadRequest(), + {}, + ], +) +async def test_get_workload_async(request_type, transport: str = "grpc_asyncio"): client = CloudControlsPartnerCoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1556,7 +1578,7 @@ async def test_get_workload_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_workload), "__call__") as call: @@ -1594,11 +1616,6 @@ async def test_get_workload_async( ) -@pytest.mark.asyncio -async def test_get_workload_async_from_dict(): - await test_get_workload_async(request_type=dict) - - def test_get_workload_field_headers(): client = CloudControlsPartnerCoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1745,8 +1762,8 @@ async def test_get_workload_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - customer_workloads.ListWorkloadsRequest, - dict, + customer_workloads.ListWorkloadsRequest(), + {}, ], ) def test_list_workloads(request_type, transport: str = "grpc"): @@ -1757,7 +1774,7 @@ def test_list_workloads(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_workloads), "__call__") as call: @@ -1806,12 +1823,13 @@ def test_list_workloads_non_empty_request_with_auto_populated_field(): client.list_workloads(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == customer_workloads.ListWorkloadsRequest( + request_msg = customer_workloads.ListWorkloadsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_workloads_use_cached_wrapped_rpc(): @@ -1892,10 +1910,14 @@ async def test_list_workloads_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_workloads_async( - transport: str = "grpc_asyncio", - request_type=customer_workloads.ListWorkloadsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + customer_workloads.ListWorkloadsRequest(), + {}, + ], +) +async def test_list_workloads_async(request_type, transport: str = "grpc_asyncio"): client = CloudControlsPartnerCoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1903,7 +1925,7 @@ async def test_list_workloads_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_workloads), "__call__") as call: @@ -1928,11 +1950,6 @@ async def test_list_workloads_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_workloads_async_from_dict(): - await test_list_workloads_async(request_type=dict) - - def test_list_workloads_field_headers(): client = CloudControlsPartnerCoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2269,8 +2286,8 @@ async def test_list_workloads_async_pages(): @pytest.mark.parametrize( "request_type", [ - customers.GetCustomerRequest, - dict, + customers.GetCustomerRequest(), + {}, ], ) def test_get_customer(request_type, transport: str = "grpc"): @@ -2281,7 +2298,7 @@ def test_get_customer(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_customer), "__call__") as call: @@ -2331,9 +2348,10 @@ def test_get_customer_non_empty_request_with_auto_populated_field(): client.get_customer(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == customers.GetCustomerRequest( + request_msg = customers.GetCustomerRequest( name="name_value", ) + assert args[0] == request_msg def test_get_customer_use_cached_wrapped_rpc(): @@ -2414,9 +2432,14 @@ async def test_get_customer_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_customer_async( - transport: str = "grpc_asyncio", request_type=customers.GetCustomerRequest -): +@pytest.mark.parametrize( + "request_type", + [ + customers.GetCustomerRequest(), + {}, + ], +) +async def test_get_customer_async(request_type, transport: str = "grpc_asyncio"): client = CloudControlsPartnerCoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2424,7 +2447,7 @@ async def test_get_customer_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_customer), "__call__") as call: @@ -2453,11 +2476,6 @@ async def test_get_customer_async( assert response.organization_domain == "organization_domain_value" -@pytest.mark.asyncio -async def test_get_customer_async_from_dict(): - await test_get_customer_async(request_type=dict) - - def test_get_customer_field_headers(): client = CloudControlsPartnerCoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2600,8 +2618,8 @@ async def test_get_customer_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - customers.ListCustomersRequest, - dict, + customers.ListCustomersRequest(), + {}, ], ) def test_list_customers(request_type, transport: str = "grpc"): @@ -2612,7 +2630,7 @@ def test_list_customers(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_customers), "__call__") as call: @@ -2661,12 +2679,13 @@ def test_list_customers_non_empty_request_with_auto_populated_field(): client.list_customers(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == customers.ListCustomersRequest( + request_msg = customers.ListCustomersRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_customers_use_cached_wrapped_rpc(): @@ -2747,9 +2766,14 @@ async def test_list_customers_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_customers_async( - transport: str = "grpc_asyncio", request_type=customers.ListCustomersRequest -): +@pytest.mark.parametrize( + "request_type", + [ + customers.ListCustomersRequest(), + {}, + ], +) +async def test_list_customers_async(request_type, transport: str = "grpc_asyncio"): client = CloudControlsPartnerCoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2757,7 +2781,7 @@ async def test_list_customers_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_customers), "__call__") as call: @@ -2782,11 +2806,6 @@ async def test_list_customers_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_customers_async_from_dict(): - await test_list_customers_async(request_type=dict) - - def test_list_customers_field_headers(): client = CloudControlsPartnerCoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3123,8 +3142,8 @@ async def test_list_customers_async_pages(): @pytest.mark.parametrize( "request_type", [ - ekm_connections.GetEkmConnectionsRequest, - dict, + ekm_connections.GetEkmConnectionsRequest(), + {}, ], ) def test_get_ekm_connections(request_type, transport: str = "grpc"): @@ -3135,7 +3154,7 @@ def test_get_ekm_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( @@ -3183,9 +3202,10 @@ def test_get_ekm_connections_non_empty_request_with_auto_populated_field(): client.get_ekm_connections(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == ekm_connections.GetEkmConnectionsRequest( + request_msg = ekm_connections.GetEkmConnectionsRequest( name="name_value", ) + assert args[0] == request_msg def test_get_ekm_connections_use_cached_wrapped_rpc(): @@ -3270,10 +3290,14 @@ async def test_get_ekm_connections_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_ekm_connections_async( - transport: str = "grpc_asyncio", - request_type=ekm_connections.GetEkmConnectionsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + ekm_connections.GetEkmConnectionsRequest(), + {}, + ], +) +async def test_get_ekm_connections_async(request_type, transport: str = "grpc_asyncio"): client = CloudControlsPartnerCoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3281,7 +3305,7 @@ async def test_get_ekm_connections_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( @@ -3306,11 +3330,6 @@ async def test_get_ekm_connections_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_ekm_connections_async_from_dict(): - await test_get_ekm_connections_async(request_type=dict) - - def test_get_ekm_connections_field_headers(): client = CloudControlsPartnerCoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3465,8 +3484,8 @@ async def test_get_ekm_connections_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - partner_permissions.GetPartnerPermissionsRequest, - dict, + partner_permissions.GetPartnerPermissionsRequest(), + {}, ], ) def test_get_partner_permissions(request_type, transport: str = "grpc"): @@ -3477,7 +3496,7 @@ def test_get_partner_permissions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3531,9 +3550,10 @@ def test_get_partner_permissions_non_empty_request_with_auto_populated_field(): client.get_partner_permissions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == partner_permissions.GetPartnerPermissionsRequest( + request_msg = partner_permissions.GetPartnerPermissionsRequest( name="name_value", ) + assert args[0] == request_msg def test_get_partner_permissions_use_cached_wrapped_rpc(): @@ -3619,9 +3639,15 @@ async def test_get_partner_permissions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + partner_permissions.GetPartnerPermissionsRequest(), + {}, + ], +) async def test_get_partner_permissions_async( - transport: str = "grpc_asyncio", - request_type=partner_permissions.GetPartnerPermissionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = CloudControlsPartnerCoreAsyncClient( credentials=async_anonymous_credentials(), @@ -3630,7 +3656,7 @@ async def test_get_partner_permissions_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( @@ -3661,11 +3687,6 @@ async def test_get_partner_permissions_async( ] -@pytest.mark.asyncio -async def test_get_partner_permissions_async_from_dict(): - await test_get_partner_permissions_async(request_type=dict) - - def test_get_partner_permissions_field_headers(): client = CloudControlsPartnerCoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3820,8 +3841,8 @@ async def test_get_partner_permissions_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - access_approval_requests.ListAccessApprovalRequestsRequest, - dict, + access_approval_requests.ListAccessApprovalRequestsRequest(), + {}, ], ) def test_list_access_approval_requests(request_type, transport: str = "grpc"): @@ -3832,7 +3853,7 @@ def test_list_access_approval_requests(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3885,12 +3906,13 @@ def test_list_access_approval_requests_non_empty_request_with_auto_populated_fie client.list_access_approval_requests(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == access_approval_requests.ListAccessApprovalRequestsRequest( + request_msg = access_approval_requests.ListAccessApprovalRequestsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_access_approval_requests_use_cached_wrapped_rpc(): @@ -3976,9 +3998,15 @@ async def test_list_access_approval_requests_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + access_approval_requests.ListAccessApprovalRequestsRequest(), + {}, + ], +) async def test_list_access_approval_requests_async( - transport: str = "grpc_asyncio", - request_type=access_approval_requests.ListAccessApprovalRequestsRequest, + request_type, transport: str = "grpc_asyncio" ): client = CloudControlsPartnerCoreAsyncClient( credentials=async_anonymous_credentials(), @@ -3987,7 +4015,7 @@ async def test_list_access_approval_requests_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( @@ -4014,11 +4042,6 @@ async def test_list_access_approval_requests_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_access_approval_requests_async_from_dict(): - await test_list_access_approval_requests_async(request_type=dict) - - def test_list_access_approval_requests_field_headers(): client = CloudControlsPartnerCoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4387,8 +4410,8 @@ async def test_list_access_approval_requests_async_pages(): @pytest.mark.parametrize( "request_type", [ - partners.GetPartnerRequest, - dict, + partners.GetPartnerRequest(), + {}, ], ) def test_get_partner(request_type, transport: str = "grpc"): @@ -4399,7 +4422,7 @@ def test_get_partner(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_partner), "__call__") as call: @@ -4447,9 +4470,10 @@ def test_get_partner_non_empty_request_with_auto_populated_field(): client.get_partner(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == partners.GetPartnerRequest( + request_msg = partners.GetPartnerRequest( name="name_value", ) + assert args[0] == request_msg def test_get_partner_use_cached_wrapped_rpc(): @@ -4530,9 +4554,14 @@ async def test_get_partner_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_partner_async( - transport: str = "grpc_asyncio", request_type=partners.GetPartnerRequest -): +@pytest.mark.parametrize( + "request_type", + [ + partners.GetPartnerRequest(), + {}, + ], +) +async def test_get_partner_async(request_type, transport: str = "grpc_asyncio"): client = CloudControlsPartnerCoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4540,7 +4569,7 @@ async def test_get_partner_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_partner), "__call__") as call: @@ -4567,11 +4596,6 @@ async def test_get_partner_async( assert response.partner_project_id == "partner_project_id_value" -@pytest.mark.asyncio -async def test_get_partner_async_from_dict(): - await test_get_partner_async(request_type=dict) - - def test_get_partner_field_headers(): client = CloudControlsPartnerCoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4714,8 +4738,8 @@ async def test_get_partner_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - customers.CreateCustomerRequest, - dict, + customers.CreateCustomerRequest(), + {}, ], ) def test_create_customer(request_type, transport: str = "grpc"): @@ -4726,7 +4750,7 @@ def test_create_customer(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_customer), "__call__") as call: @@ -4777,10 +4801,11 @@ def test_create_customer_non_empty_request_with_auto_populated_field(): client.create_customer(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == customers.CreateCustomerRequest( + request_msg = customers.CreateCustomerRequest( parent="parent_value", customer_id="customer_id_value", ) + assert args[0] == request_msg def test_create_customer_use_cached_wrapped_rpc(): @@ -4861,9 +4886,14 @@ async def test_create_customer_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_customer_async( - transport: str = "grpc_asyncio", request_type=customers.CreateCustomerRequest -): +@pytest.mark.parametrize( + "request_type", + [ + customers.CreateCustomerRequest(), + {}, + ], +) +async def test_create_customer_async(request_type, transport: str = "grpc_asyncio"): client = CloudControlsPartnerCoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4871,7 +4901,7 @@ async def test_create_customer_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_customer), "__call__") as call: @@ -4900,11 +4930,6 @@ async def test_create_customer_async( assert response.organization_domain == "organization_domain_value" -@pytest.mark.asyncio -async def test_create_customer_async_from_dict(): - await test_create_customer_async(request_type=dict) - - def test_create_customer_field_headers(): client = CloudControlsPartnerCoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5067,8 +5092,8 @@ async def test_create_customer_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - customers.UpdateCustomerRequest, - dict, + customers.UpdateCustomerRequest(), + {}, ], ) def test_update_customer(request_type, transport: str = "grpc"): @@ -5079,7 +5104,7 @@ def test_update_customer(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_customer), "__call__") as call: @@ -5127,7 +5152,8 @@ def test_update_customer_non_empty_request_with_auto_populated_field(): client.update_customer(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == customers.UpdateCustomerRequest() + request_msg = customers.UpdateCustomerRequest() + assert args[0] == request_msg def test_update_customer_use_cached_wrapped_rpc(): @@ -5208,9 +5234,14 @@ async def test_update_customer_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_customer_async( - transport: str = "grpc_asyncio", request_type=customers.UpdateCustomerRequest -): +@pytest.mark.parametrize( + "request_type", + [ + customers.UpdateCustomerRequest(), + {}, + ], +) +async def test_update_customer_async(request_type, transport: str = "grpc_asyncio"): client = CloudControlsPartnerCoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5218,7 +5249,7 @@ async def test_update_customer_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_customer), "__call__") as call: @@ -5247,11 +5278,6 @@ async def test_update_customer_async( assert response.organization_domain == "organization_domain_value" -@pytest.mark.asyncio -async def test_update_customer_async_from_dict(): - await test_update_customer_async(request_type=dict) - - def test_update_customer_field_headers(): client = CloudControlsPartnerCoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5404,8 +5430,8 @@ async def test_update_customer_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - customers.DeleteCustomerRequest, - dict, + customers.DeleteCustomerRequest(), + {}, ], ) def test_delete_customer(request_type, transport: str = "grpc"): @@ -5416,7 +5442,7 @@ def test_delete_customer(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_customer), "__call__") as call: @@ -5457,9 +5483,10 @@ def test_delete_customer_non_empty_request_with_auto_populated_field(): client.delete_customer(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == customers.DeleteCustomerRequest( + request_msg = customers.DeleteCustomerRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_customer_use_cached_wrapped_rpc(): @@ -5540,9 +5567,14 @@ async def test_delete_customer_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_customer_async( - transport: str = "grpc_asyncio", request_type=customers.DeleteCustomerRequest -): +@pytest.mark.parametrize( + "request_type", + [ + customers.DeleteCustomerRequest(), + {}, + ], +) +async def test_delete_customer_async(request_type, transport: str = "grpc_asyncio"): client = CloudControlsPartnerCoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5550,7 +5582,7 @@ async def test_delete_customer_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_customer), "__call__") as call: @@ -5568,11 +5600,6 @@ async def test_delete_customer_async( assert response is None -@pytest.mark.asyncio -async def test_delete_customer_async_from_dict(): - await test_delete_customer_async(request_type=dict) - - def test_delete_customer_field_headers(): client = CloudControlsPartnerCoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8105,7 +8132,6 @@ def test_get_workload_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = customer_workloads.GetWorkloadRequest() - assert args[0] == request_msg @@ -8126,7 +8152,6 @@ def test_list_workloads_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = customer_workloads.ListWorkloadsRequest() - assert args[0] == request_msg @@ -8147,7 +8172,6 @@ def test_get_customer_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = customers.GetCustomerRequest() - assert args[0] == request_msg @@ -8168,7 +8192,6 @@ def test_list_customers_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = customers.ListCustomersRequest() - assert args[0] == request_msg @@ -8191,7 +8214,6 @@ def test_get_ekm_connections_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ekm_connections.GetEkmConnectionsRequest() - assert args[0] == request_msg @@ -8214,7 +8236,6 @@ def test_get_partner_permissions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = partner_permissions.GetPartnerPermissionsRequest() - assert args[0] == request_msg @@ -8239,7 +8260,6 @@ def test_list_access_approval_requests_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = access_approval_requests.ListAccessApprovalRequestsRequest() - assert args[0] == request_msg @@ -8260,7 +8280,6 @@ def test_get_partner_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = partners.GetPartnerRequest() - assert args[0] == request_msg @@ -8281,7 +8300,6 @@ def test_create_customer_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = customers.CreateCustomerRequest() - assert args[0] == request_msg @@ -8302,7 +8320,6 @@ def test_update_customer_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = customers.UpdateCustomerRequest() - assert args[0] == request_msg @@ -8323,7 +8340,6 @@ def test_delete_customer_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = customers.DeleteCustomerRequest() - assert args[0] == request_msg @@ -8370,7 +8386,6 @@ async def test_get_workload_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = customer_workloads.GetWorkloadRequest() - assert args[0] == request_msg @@ -8398,7 +8413,6 @@ async def test_list_workloads_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = customer_workloads.ListWorkloadsRequest() - assert args[0] == request_msg @@ -8428,7 +8442,6 @@ async def test_get_customer_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = customers.GetCustomerRequest() - assert args[0] == request_msg @@ -8456,7 +8469,6 @@ async def test_list_customers_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = customers.ListCustomersRequest() - assert args[0] == request_msg @@ -8485,7 +8497,6 @@ async def test_get_ekm_connections_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ekm_connections.GetEkmConnectionsRequest() - assert args[0] == request_msg @@ -8517,7 +8528,6 @@ async def test_get_partner_permissions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = partner_permissions.GetPartnerPermissionsRequest() - assert args[0] == request_msg @@ -8547,7 +8557,6 @@ async def test_list_access_approval_requests_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = access_approval_requests.ListAccessApprovalRequestsRequest() - assert args[0] == request_msg @@ -8576,7 +8585,6 @@ async def test_get_partner_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = partners.GetPartnerRequest() - assert args[0] == request_msg @@ -8606,7 +8614,6 @@ async def test_create_customer_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = customers.CreateCustomerRequest() - assert args[0] == request_msg @@ -8636,7 +8643,6 @@ async def test_update_customer_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = customers.UpdateCustomerRequest() - assert args[0] == request_msg @@ -8659,7 +8665,6 @@ async def test_delete_customer_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = customers.DeleteCustomerRequest() - assert args[0] == request_msg @@ -10371,7 +10376,6 @@ def test_get_workload_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = customer_workloads.GetWorkloadRequest() - assert args[0] == request_msg @@ -10391,7 +10395,6 @@ def test_list_workloads_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = customer_workloads.ListWorkloadsRequest() - assert args[0] == request_msg @@ -10411,7 +10414,6 @@ def test_get_customer_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = customers.GetCustomerRequest() - assert args[0] == request_msg @@ -10431,7 +10433,6 @@ def test_list_customers_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = customers.ListCustomersRequest() - assert args[0] == request_msg @@ -10453,7 +10454,6 @@ def test_get_ekm_connections_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ekm_connections.GetEkmConnectionsRequest() - assert args[0] == request_msg @@ -10475,7 +10475,6 @@ def test_get_partner_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = partner_permissions.GetPartnerPermissionsRequest() - assert args[0] == request_msg @@ -10497,7 +10496,6 @@ def test_list_access_approval_requests_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = access_approval_requests.ListAccessApprovalRequestsRequest() - assert args[0] == request_msg @@ -10517,7 +10515,6 @@ def test_get_partner_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = partners.GetPartnerRequest() - assert args[0] == request_msg @@ -10537,7 +10534,6 @@ def test_create_customer_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = customers.CreateCustomerRequest() - assert args[0] == request_msg @@ -10557,7 +10553,6 @@ def test_update_customer_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = customers.UpdateCustomerRequest() - assert args[0] == request_msg @@ -10577,7 +10572,6 @@ def test_delete_customer_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = customers.DeleteCustomerRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-cloudcontrolspartner/tests/unit/gapic/cloudcontrolspartner_v1beta/test_cloud_controls_partner_monitoring.py b/packages/google-cloud-cloudcontrolspartner/tests/unit/gapic/cloudcontrolspartner_v1beta/test_cloud_controls_partner_monitoring.py index 51ed0fa6c129..40ce9e46ce66 100644 --- a/packages/google-cloud-cloudcontrolspartner/tests/unit/gapic/cloudcontrolspartner_v1beta/test_cloud_controls_partner_monitoring.py +++ b/packages/google-cloud-cloudcontrolspartner/tests/unit/gapic/cloudcontrolspartner_v1beta/test_cloud_controls_partner_monitoring.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 @@ -109,6 +110,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" @@ -1437,8 +1453,8 @@ def test_cloud_controls_partner_monitoring_client_create_channel_credentials_fil @pytest.mark.parametrize( "request_type", [ - violations.ListViolationsRequest, - dict, + violations.ListViolationsRequest(), + {}, ], ) def test_list_violations(request_type, transport: str = "grpc"): @@ -1449,7 +1465,7 @@ def test_list_violations(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_violations), "__call__") as call: @@ -1498,12 +1514,13 @@ def test_list_violations_non_empty_request_with_auto_populated_field(): client.list_violations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == violations.ListViolationsRequest( + request_msg = violations.ListViolationsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_violations_use_cached_wrapped_rpc(): @@ -1584,9 +1601,14 @@ async def test_list_violations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_violations_async( - transport: str = "grpc_asyncio", request_type=violations.ListViolationsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + violations.ListViolationsRequest(), + {}, + ], +) +async def test_list_violations_async(request_type, transport: str = "grpc_asyncio"): client = CloudControlsPartnerMonitoringAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1594,7 +1616,7 @@ async def test_list_violations_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_violations), "__call__") as call: @@ -1619,11 +1641,6 @@ async def test_list_violations_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_violations_async_from_dict(): - await test_list_violations_async(request_type=dict) - - def test_list_violations_field_headers(): client = CloudControlsPartnerMonitoringClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1960,8 +1977,8 @@ async def test_list_violations_async_pages(): @pytest.mark.parametrize( "request_type", [ - violations.GetViolationRequest, - dict, + violations.GetViolationRequest(), + {}, ], ) def test_get_violation(request_type, transport: str = "grpc"): @@ -1972,7 +1989,7 @@ def test_get_violation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_violation), "__call__") as call: @@ -2026,9 +2043,10 @@ def test_get_violation_non_empty_request_with_auto_populated_field(): client.get_violation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == violations.GetViolationRequest( + request_msg = violations.GetViolationRequest( name="name_value", ) + assert args[0] == request_msg def test_get_violation_use_cached_wrapped_rpc(): @@ -2109,9 +2127,14 @@ async def test_get_violation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_violation_async( - transport: str = "grpc_asyncio", request_type=violations.GetViolationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + violations.GetViolationRequest(), + {}, + ], +) +async def test_get_violation_async(request_type, transport: str = "grpc_asyncio"): client = CloudControlsPartnerMonitoringAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2119,7 +2142,7 @@ async def test_get_violation_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_violation), "__call__") as call: @@ -2152,11 +2175,6 @@ async def test_get_violation_async( assert response.folder_id == 936 -@pytest.mark.asyncio -async def test_get_violation_async_from_dict(): - await test_get_violation_async(request_type=dict) - - def test_get_violation_field_headers(): client = CloudControlsPartnerMonitoringClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2867,7 +2885,6 @@ def test_list_violations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = violations.ListViolationsRequest() - assert args[0] == request_msg @@ -2888,7 +2905,6 @@ def test_get_violation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = violations.GetViolationRequest() - assert args[0] == request_msg @@ -2930,7 +2946,6 @@ async def test_list_violations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = violations.ListViolationsRequest() - assert args[0] == request_msg @@ -2962,7 +2977,6 @@ async def test_get_violation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = violations.GetViolationRequest() - assert args[0] == request_msg @@ -3280,7 +3294,6 @@ def test_list_violations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = violations.ListViolationsRequest() - assert args[0] == request_msg @@ -3300,7 +3313,6 @@ def test_get_violation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = violations.GetViolationRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-cloudsecuritycompliance/noxfile.py b/packages/google-cloud-cloudsecuritycompliance/noxfile.py index 930e75914579..5f79e1a8c2b5 100644 --- a/packages/google-cloud-cloudsecuritycompliance/noxfile.py +++ b/packages/google-cloud-cloudsecuritycompliance/noxfile.py @@ -47,7 +47,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-cloudsecuritycompliance" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-cloudsecuritycompliance/setup.py b/packages/google-cloud-cloudsecuritycompliance/setup.py index f2ab576f540c..4ed3b0065cf7 100644 --- a/packages/google-cloud-cloudsecuritycompliance/setup.py +++ b/packages/google-cloud-cloudsecuritycompliance/setup.py @@ -45,7 +45,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/google-cloud-cloudsecuritycompliance/testing/constraints-3.10.txt b/packages/google-cloud-cloudsecuritycompliance/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-cloudsecuritycompliance/testing/constraints-3.10.txt +++ b/packages/google-cloud-cloudsecuritycompliance/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-cloudsecuritycompliance/tests/unit/gapic/cloudsecuritycompliance_v1/test_audit.py b/packages/google-cloud-cloudsecuritycompliance/tests/unit/gapic/cloudsecuritycompliance_v1/test_audit.py index 887d24bda82e..715ec9979288 100644 --- a/packages/google-cloud-cloudsecuritycompliance/tests/unit/gapic/cloudsecuritycompliance_v1/test_audit.py +++ b/packages/google-cloud-cloudsecuritycompliance/tests/unit/gapic/cloudsecuritycompliance_v1/test_audit.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 @@ -114,6 +115,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" @@ -1242,8 +1258,8 @@ def test_audit_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - audit.GenerateFrameworkAuditScopeReportRequest, - dict, + audit.GenerateFrameworkAuditScopeReportRequest(), + {}, ], ) def test_generate_framework_audit_scope_report(request_type, transport: str = "grpc"): @@ -1254,7 +1270,7 @@ def test_generate_framework_audit_scope_report(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( @@ -1306,10 +1322,11 @@ def test_generate_framework_audit_scope_report_non_empty_request_with_auto_popul client.generate_framework_audit_scope_report(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == audit.GenerateFrameworkAuditScopeReportRequest( + request_msg = audit.GenerateFrameworkAuditScopeReportRequest( scope="scope_value", compliance_framework="compliance_framework_value", ) + assert args[0] == request_msg def test_generate_framework_audit_scope_report_use_cached_wrapped_rpc(): @@ -1395,9 +1412,15 @@ async def test_generate_framework_audit_scope_report_async_use_cached_wrapped_rp @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + audit.GenerateFrameworkAuditScopeReportRequest(), + {}, + ], +) async def test_generate_framework_audit_scope_report_async( - transport: str = "grpc_asyncio", - request_type=audit.GenerateFrameworkAuditScopeReportRequest, + request_type, transport: str = "grpc_asyncio" ): client = AuditAsyncClient( credentials=async_anonymous_credentials(), @@ -1406,7 +1429,7 @@ async def test_generate_framework_audit_scope_report_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( @@ -1433,11 +1456,6 @@ async def test_generate_framework_audit_scope_report_async( assert response.compliance_framework == "compliance_framework_value" -@pytest.mark.asyncio -async def test_generate_framework_audit_scope_report_async_from_dict(): - await test_generate_framework_audit_scope_report_async(request_type=dict) - - def test_generate_framework_audit_scope_report_field_headers(): client = AuditClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1612,8 +1630,8 @@ async def test_generate_framework_audit_scope_report_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - audit.CreateFrameworkAuditRequest, - dict, + audit.CreateFrameworkAuditRequest(), + {}, ], ) def test_create_framework_audit(request_type, transport: str = "grpc"): @@ -1624,7 +1642,7 @@ def test_create_framework_audit(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1670,10 +1688,11 @@ def test_create_framework_audit_non_empty_request_with_auto_populated_field(): client.create_framework_audit(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == audit.CreateFrameworkAuditRequest( + request_msg = audit.CreateFrameworkAuditRequest( parent="parent_value", framework_audit_id="framework_audit_id_value", ) + assert args[0] == request_msg def test_create_framework_audit_use_cached_wrapped_rpc(): @@ -1769,8 +1788,15 @@ async def test_create_framework_audit_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + audit.CreateFrameworkAuditRequest(), + {}, + ], +) async def test_create_framework_audit_async( - transport: str = "grpc_asyncio", request_type=audit.CreateFrameworkAuditRequest + request_type, transport: str = "grpc_asyncio" ): client = AuditAsyncClient( credentials=async_anonymous_credentials(), @@ -1779,7 +1805,7 @@ async def test_create_framework_audit_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( @@ -1801,11 +1827,6 @@ async def test_create_framework_audit_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_framework_audit_async_from_dict(): - await test_create_framework_audit_async(request_type=dict) - - def test_create_framework_audit_field_headers(): client = AuditClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1980,8 +2001,8 @@ async def test_create_framework_audit_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - audit.ListFrameworkAuditsRequest, - dict, + audit.ListFrameworkAuditsRequest(), + {}, ], ) def test_list_framework_audits(request_type, transport: str = "grpc"): @@ -1992,7 +2013,7 @@ def test_list_framework_audits(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2042,11 +2063,12 @@ def test_list_framework_audits_non_empty_request_with_auto_populated_field(): client.list_framework_audits(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == audit.ListFrameworkAuditsRequest( + request_msg = audit.ListFrameworkAuditsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_framework_audits_use_cached_wrapped_rpc(): @@ -2132,8 +2154,15 @@ async def test_list_framework_audits_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + audit.ListFrameworkAuditsRequest(), + {}, + ], +) async def test_list_framework_audits_async( - transport: str = "grpc_asyncio", request_type=audit.ListFrameworkAuditsRequest + request_type, transport: str = "grpc_asyncio" ): client = AuditAsyncClient( credentials=async_anonymous_credentials(), @@ -2142,7 +2171,7 @@ async def test_list_framework_audits_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( @@ -2167,11 +2196,6 @@ async def test_list_framework_audits_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_framework_audits_async_from_dict(): - await test_list_framework_audits_async(request_type=dict) - - def test_list_framework_audits_field_headers(): client = AuditClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2524,8 +2548,8 @@ async def test_list_framework_audits_async_pages(): @pytest.mark.parametrize( "request_type", [ - audit.GetFrameworkAuditRequest, - dict, + audit.GetFrameworkAuditRequest(), + {}, ], ) def test_get_framework_audit(request_type, transport: str = "grpc"): @@ -2536,7 +2560,7 @@ def test_get_framework_audit(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2596,9 +2620,10 @@ def test_get_framework_audit_non_empty_request_with_auto_populated_field(): client.get_framework_audit(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == audit.GetFrameworkAuditRequest( + request_msg = audit.GetFrameworkAuditRequest( name="name_value", ) + assert args[0] == request_msg def test_get_framework_audit_use_cached_wrapped_rpc(): @@ -2683,9 +2708,14 @@ async def test_get_framework_audit_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_framework_audit_async( - transport: str = "grpc_asyncio", request_type=audit.GetFrameworkAuditRequest -): +@pytest.mark.parametrize( + "request_type", + [ + audit.GetFrameworkAuditRequest(), + {}, + ], +) +async def test_get_framework_audit_async(request_type, transport: str = "grpc_asyncio"): client = AuditAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2693,7 +2723,7 @@ async def test_get_framework_audit_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( @@ -2730,11 +2760,6 @@ async def test_get_framework_audit_async( assert response.state == audit.FrameworkAudit.State.SCHEDULED -@pytest.mark.asyncio -async def test_get_framework_audit_async_from_dict(): - await test_get_framework_audit_async(request_type=dict) - - def test_get_framework_audit_field_headers(): client = AuditClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3864,7 +3889,6 @@ def test_generate_framework_audit_scope_report_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = audit.GenerateFrameworkAuditScopeReportRequest() - assert args[0] == request_msg @@ -3887,7 +3911,6 @@ def test_create_framework_audit_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = audit.CreateFrameworkAuditRequest() - assert args[0] == request_msg @@ -3910,7 +3933,6 @@ def test_list_framework_audits_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = audit.ListFrameworkAuditsRequest() - assert args[0] == request_msg @@ -3933,7 +3955,6 @@ def test_get_framework_audit_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = audit.GetFrameworkAuditRequest() - assert args[0] == request_msg @@ -3977,7 +3998,6 @@ async def test_generate_framework_audit_scope_report_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = audit.GenerateFrameworkAuditScopeReportRequest() - assert args[0] == request_msg @@ -4004,7 +4024,6 @@ async def test_create_framework_audit_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = audit.CreateFrameworkAuditRequest() - assert args[0] == request_msg @@ -4033,7 +4052,6 @@ async def test_list_framework_audits_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = audit.ListFrameworkAuditsRequest() - assert args[0] == request_msg @@ -4068,7 +4086,6 @@ async def test_get_framework_audit_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = audit.GetFrameworkAuditRequest() - assert args[0] == request_msg @@ -5150,7 +5167,6 @@ def test_generate_framework_audit_scope_report_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = audit.GenerateFrameworkAuditScopeReportRequest() - assert args[0] == request_msg @@ -5172,7 +5188,6 @@ def test_create_framework_audit_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = audit.CreateFrameworkAuditRequest() - assert args[0] == request_msg @@ -5194,7 +5209,6 @@ def test_list_framework_audits_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = audit.ListFrameworkAuditsRequest() - assert args[0] == request_msg @@ -5216,7 +5230,6 @@ def test_get_framework_audit_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = audit.GetFrameworkAuditRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-cloudsecuritycompliance/tests/unit/gapic/cloudsecuritycompliance_v1/test_cm_enrollment_service.py b/packages/google-cloud-cloudsecuritycompliance/tests/unit/gapic/cloudsecuritycompliance_v1/test_cm_enrollment_service.py index ac6db1612fce..3add026caf62 100644 --- a/packages/google-cloud-cloudsecuritycompliance/tests/unit/gapic/cloudsecuritycompliance_v1/test_cm_enrollment_service.py +++ b/packages/google-cloud-cloudsecuritycompliance/tests/unit/gapic/cloudsecuritycompliance_v1/test_cm_enrollment_service.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 @@ -109,6 +110,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" @@ -1372,8 +1388,8 @@ def test_cm_enrollment_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - cm_enrollment_service.UpdateCmEnrollmentRequest, - dict, + cm_enrollment_service.UpdateCmEnrollmentRequest(), + {}, ], ) def test_update_cm_enrollment(request_type, transport: str = "grpc"): @@ -1384,7 +1400,7 @@ def test_update_cm_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( @@ -1432,7 +1448,8 @@ def test_update_cm_enrollment_non_empty_request_with_auto_populated_field(): client.update_cm_enrollment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cm_enrollment_service.UpdateCmEnrollmentRequest() + request_msg = cm_enrollment_service.UpdateCmEnrollmentRequest() + assert args[0] == request_msg def test_update_cm_enrollment_use_cached_wrapped_rpc(): @@ -1517,9 +1534,15 @@ async def test_update_cm_enrollment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cm_enrollment_service.UpdateCmEnrollmentRequest(), + {}, + ], +) async def test_update_cm_enrollment_async( - transport: str = "grpc_asyncio", - request_type=cm_enrollment_service.UpdateCmEnrollmentRequest, + request_type, transport: str = "grpc_asyncio" ): client = CmEnrollmentServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1528,7 +1551,7 @@ async def test_update_cm_enrollment_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( @@ -1555,11 +1578,6 @@ async def test_update_cm_enrollment_async( assert response.enrolled is True -@pytest.mark.asyncio -async def test_update_cm_enrollment_async_from_dict(): - await test_update_cm_enrollment_async(request_type=dict) - - def test_update_cm_enrollment_field_headers(): client = CmEnrollmentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1724,8 +1742,8 @@ async def test_update_cm_enrollment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cm_enrollment_service.CalculateEffectiveCmEnrollmentRequest, - dict, + cm_enrollment_service.CalculateEffectiveCmEnrollmentRequest(), + {}, ], ) def test_calculate_effective_cm_enrollment(request_type, transport: str = "grpc"): @@ -1736,7 +1754,7 @@ def test_calculate_effective_cm_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( @@ -1785,9 +1803,10 @@ def test_calculate_effective_cm_enrollment_non_empty_request_with_auto_populated client.calculate_effective_cm_enrollment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cm_enrollment_service.CalculateEffectiveCmEnrollmentRequest( + request_msg = cm_enrollment_service.CalculateEffectiveCmEnrollmentRequest( name="name_value", ) + assert args[0] == request_msg def test_calculate_effective_cm_enrollment_use_cached_wrapped_rpc(): @@ -1873,9 +1892,15 @@ async def test_calculate_effective_cm_enrollment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cm_enrollment_service.CalculateEffectiveCmEnrollmentRequest(), + {}, + ], +) async def test_calculate_effective_cm_enrollment_async( - transport: str = "grpc_asyncio", - request_type=cm_enrollment_service.CalculateEffectiveCmEnrollmentRequest, + request_type, transport: str = "grpc_asyncio" ): client = CmEnrollmentServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1884,7 +1909,7 @@ async def test_calculate_effective_cm_enrollment_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( @@ -1908,11 +1933,6 @@ async def test_calculate_effective_cm_enrollment_async( ) -@pytest.mark.asyncio -async def test_calculate_effective_cm_enrollment_async_from_dict(): - await test_calculate_effective_cm_enrollment_async(request_type=dict) - - def test_calculate_effective_cm_enrollment_field_headers(): client = CmEnrollmentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2576,7 +2596,6 @@ def test_update_cm_enrollment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cm_enrollment_service.UpdateCmEnrollmentRequest() - assert args[0] == request_msg @@ -2601,7 +2620,6 @@ def test_calculate_effective_cm_enrollment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cm_enrollment_service.CalculateEffectiveCmEnrollmentRequest() - assert args[0] == request_msg @@ -2645,7 +2663,6 @@ async def test_update_cm_enrollment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cm_enrollment_service.UpdateCmEnrollmentRequest() - assert args[0] == request_msg @@ -2672,7 +2689,6 @@ async def test_calculate_effective_cm_enrollment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cm_enrollment_service.CalculateEffectiveCmEnrollmentRequest() - assert args[0] == request_msg @@ -3448,7 +3464,6 @@ def test_update_cm_enrollment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cm_enrollment_service.UpdateCmEnrollmentRequest() - assert args[0] == request_msg @@ -3470,7 +3485,6 @@ def test_calculate_effective_cm_enrollment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cm_enrollment_service.CalculateEffectiveCmEnrollmentRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-cloudsecuritycompliance/tests/unit/gapic/cloudsecuritycompliance_v1/test_config.py b/packages/google-cloud-cloudsecuritycompliance/tests/unit/gapic/cloudsecuritycompliance_v1/test_config.py index 5b357c15439e..38dd8df3938f 100644 --- a/packages/google-cloud-cloudsecuritycompliance/tests/unit/gapic/cloudsecuritycompliance_v1/test_config.py +++ b/packages/google-cloud-cloudsecuritycompliance/tests/unit/gapic/cloudsecuritycompliance_v1/test_config.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" @@ -1243,8 +1259,8 @@ def test_config_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - config.ListFrameworksRequest, - dict, + config.ListFrameworksRequest(), + {}, ], ) def test_list_frameworks(request_type, transport: str = "grpc"): @@ -1255,7 +1271,7 @@ def test_list_frameworks(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_frameworks), "__call__") as call: @@ -1300,10 +1316,11 @@ def test_list_frameworks_non_empty_request_with_auto_populated_field(): client.list_frameworks(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config.ListFrameworksRequest( + request_msg = config.ListFrameworksRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_frameworks_use_cached_wrapped_rpc(): @@ -1384,9 +1401,14 @@ async def test_list_frameworks_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_frameworks_async( - transport: str = "grpc_asyncio", request_type=config.ListFrameworksRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config.ListFrameworksRequest(), + {}, + ], +) +async def test_list_frameworks_async(request_type, transport: str = "grpc_asyncio"): client = ConfigAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1394,7 +1416,7 @@ async def test_list_frameworks_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_frameworks), "__call__") as call: @@ -1417,11 +1439,6 @@ async def test_list_frameworks_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_frameworks_async_from_dict(): - await test_list_frameworks_async(request_type=dict) - - def test_list_frameworks_field_headers(): client = ConfigClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1758,8 +1775,8 @@ async def test_list_frameworks_async_pages(): @pytest.mark.parametrize( "request_type", [ - config.GetFrameworkRequest, - dict, + config.GetFrameworkRequest(), + {}, ], ) def test_get_framework(request_type, transport: str = "grpc"): @@ -1770,7 +1787,7 @@ def test_get_framework(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_framework), "__call__") as call: @@ -1834,9 +1851,10 @@ def test_get_framework_non_empty_request_with_auto_populated_field(): client.get_framework(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config.GetFrameworkRequest( + request_msg = config.GetFrameworkRequest( name="name_value", ) + assert args[0] == request_msg def test_get_framework_use_cached_wrapped_rpc(): @@ -1917,9 +1935,14 @@ async def test_get_framework_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_framework_async( - transport: str = "grpc_asyncio", request_type=config.GetFrameworkRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config.GetFrameworkRequest(), + {}, + ], +) +async def test_get_framework_async(request_type, transport: str = "grpc_asyncio"): client = ConfigAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1927,7 +1950,7 @@ async def test_get_framework_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_framework), "__call__") as call: @@ -1970,11 +1993,6 @@ async def test_get_framework_async( assert response.supported_enforcement_modes == [common.EnforcementMode.PREVENTIVE] -@pytest.mark.asyncio -async def test_get_framework_async_from_dict(): - await test_get_framework_async(request_type=dict) - - def test_get_framework_field_headers(): client = ConfigClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2117,8 +2135,8 @@ async def test_get_framework_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config.CreateFrameworkRequest, - dict, + config.CreateFrameworkRequest(), + {}, ], ) def test_create_framework(request_type, transport: str = "grpc"): @@ -2129,7 +2147,7 @@ def test_create_framework(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_framework), "__call__") as call: @@ -2194,10 +2212,11 @@ def test_create_framework_non_empty_request_with_auto_populated_field(): client.create_framework(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config.CreateFrameworkRequest( + request_msg = config.CreateFrameworkRequest( parent="parent_value", framework_id="framework_id_value", ) + assert args[0] == request_msg def test_create_framework_use_cached_wrapped_rpc(): @@ -2280,9 +2299,14 @@ async def test_create_framework_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_framework_async( - transport: str = "grpc_asyncio", request_type=config.CreateFrameworkRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config.CreateFrameworkRequest(), + {}, + ], +) +async def test_create_framework_async(request_type, transport: str = "grpc_asyncio"): client = ConfigAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2290,7 +2314,7 @@ async def test_create_framework_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_framework), "__call__") as call: @@ -2333,11 +2357,6 @@ async def test_create_framework_async( assert response.supported_enforcement_modes == [common.EnforcementMode.PREVENTIVE] -@pytest.mark.asyncio -async def test_create_framework_async_from_dict(): - await test_create_framework_async(request_type=dict) - - def test_create_framework_field_headers(): client = ConfigClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2500,8 +2519,8 @@ async def test_create_framework_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config.UpdateFrameworkRequest, - dict, + config.UpdateFrameworkRequest(), + {}, ], ) def test_update_framework(request_type, transport: str = "grpc"): @@ -2512,7 +2531,7 @@ def test_update_framework(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_framework), "__call__") as call: @@ -2574,7 +2593,8 @@ def test_update_framework_non_empty_request_with_auto_populated_field(): client.update_framework(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config.UpdateFrameworkRequest() + request_msg = config.UpdateFrameworkRequest() + assert args[0] == request_msg def test_update_framework_use_cached_wrapped_rpc(): @@ -2657,9 +2677,14 @@ async def test_update_framework_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_framework_async( - transport: str = "grpc_asyncio", request_type=config.UpdateFrameworkRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config.UpdateFrameworkRequest(), + {}, + ], +) +async def test_update_framework_async(request_type, transport: str = "grpc_asyncio"): client = ConfigAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2667,7 +2692,7 @@ async def test_update_framework_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_framework), "__call__") as call: @@ -2710,11 +2735,6 @@ async def test_update_framework_async( assert response.supported_enforcement_modes == [common.EnforcementMode.PREVENTIVE] -@pytest.mark.asyncio -async def test_update_framework_async_from_dict(): - await test_update_framework_async(request_type=dict) - - def test_update_framework_field_headers(): client = ConfigClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2867,8 +2887,8 @@ async def test_update_framework_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config.DeleteFrameworkRequest, - dict, + config.DeleteFrameworkRequest(), + {}, ], ) def test_delete_framework(request_type, transport: str = "grpc"): @@ -2879,7 +2899,7 @@ def test_delete_framework(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_framework), "__call__") as call: @@ -2920,9 +2940,10 @@ def test_delete_framework_non_empty_request_with_auto_populated_field(): client.delete_framework(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config.DeleteFrameworkRequest( + request_msg = config.DeleteFrameworkRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_framework_use_cached_wrapped_rpc(): @@ -3005,9 +3026,14 @@ async def test_delete_framework_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_framework_async( - transport: str = "grpc_asyncio", request_type=config.DeleteFrameworkRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config.DeleteFrameworkRequest(), + {}, + ], +) +async def test_delete_framework_async(request_type, transport: str = "grpc_asyncio"): client = ConfigAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3015,7 +3041,7 @@ async def test_delete_framework_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_framework), "__call__") as call: @@ -3033,11 +3059,6 @@ async def test_delete_framework_async( assert response is None -@pytest.mark.asyncio -async def test_delete_framework_async_from_dict(): - await test_delete_framework_async(request_type=dict) - - def test_delete_framework_field_headers(): client = ConfigClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3180,8 +3201,8 @@ async def test_delete_framework_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config.ListCloudControlsRequest, - dict, + config.ListCloudControlsRequest(), + {}, ], ) def test_list_cloud_controls(request_type, transport: str = "grpc"): @@ -3192,7 +3213,7 @@ def test_list_cloud_controls(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3241,10 +3262,11 @@ def test_list_cloud_controls_non_empty_request_with_auto_populated_field(): client.list_cloud_controls(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config.ListCloudControlsRequest( + request_msg = config.ListCloudControlsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_cloud_controls_use_cached_wrapped_rpc(): @@ -3329,9 +3351,14 @@ async def test_list_cloud_controls_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_cloud_controls_async( - transport: str = "grpc_asyncio", request_type=config.ListCloudControlsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config.ListCloudControlsRequest(), + {}, + ], +) +async def test_list_cloud_controls_async(request_type, transport: str = "grpc_asyncio"): client = ConfigAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3339,7 +3366,7 @@ async def test_list_cloud_controls_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( @@ -3364,11 +3391,6 @@ async def test_list_cloud_controls_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_cloud_controls_async_from_dict(): - await test_list_cloud_controls_async(request_type=dict) - - def test_list_cloud_controls_field_headers(): client = ConfigClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3721,8 +3743,8 @@ async def test_list_cloud_controls_async_pages(): @pytest.mark.parametrize( "request_type", [ - config.GetCloudControlRequest, - dict, + config.GetCloudControlRequest(), + {}, ], ) def test_get_cloud_control(request_type, transport: str = "grpc"): @@ -3733,7 +3755,7 @@ def test_get_cloud_control(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3809,9 +3831,10 @@ def test_get_cloud_control_non_empty_request_with_auto_populated_field(): client.get_cloud_control(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config.GetCloudControlRequest( + request_msg = config.GetCloudControlRequest( name="name_value", ) + assert args[0] == request_msg def test_get_cloud_control_use_cached_wrapped_rpc(): @@ -3894,9 +3917,14 @@ async def test_get_cloud_control_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_cloud_control_async( - transport: str = "grpc_asyncio", request_type=config.GetCloudControlRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config.GetCloudControlRequest(), + {}, + ], +) +async def test_get_cloud_control_async(request_type, transport: str = "grpc_asyncio"): client = ConfigAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3904,7 +3932,7 @@ async def test_get_cloud_control_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( @@ -3957,11 +3985,6 @@ async def test_get_cloud_control_async( ] -@pytest.mark.asyncio -async def test_get_cloud_control_async_from_dict(): - await test_get_cloud_control_async(request_type=dict) - - def test_get_cloud_control_field_headers(): client = ConfigClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4112,8 +4135,8 @@ async def test_get_cloud_control_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config.CreateCloudControlRequest, - dict, + config.CreateCloudControlRequest(), + {}, ], ) def test_create_cloud_control(request_type, transport: str = "grpc"): @@ -4124,7 +4147,7 @@ def test_create_cloud_control(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4201,10 +4224,11 @@ def test_create_cloud_control_non_empty_request_with_auto_populated_field(): client.create_cloud_control(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config.CreateCloudControlRequest( + request_msg = config.CreateCloudControlRequest( parent="parent_value", cloud_control_id="cloud_control_id_value", ) + assert args[0] == request_msg def test_create_cloud_control_use_cached_wrapped_rpc(): @@ -4289,8 +4313,15 @@ async def test_create_cloud_control_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + config.CreateCloudControlRequest(), + {}, + ], +) async def test_create_cloud_control_async( - transport: str = "grpc_asyncio", request_type=config.CreateCloudControlRequest + request_type, transport: str = "grpc_asyncio" ): client = ConfigAsyncClient( credentials=async_anonymous_credentials(), @@ -4299,7 +4330,7 @@ async def test_create_cloud_control_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( @@ -4352,11 +4383,6 @@ async def test_create_cloud_control_async( ] -@pytest.mark.asyncio -async def test_create_cloud_control_async_from_dict(): - await test_create_cloud_control_async(request_type=dict) - - def test_create_cloud_control_field_headers(): client = ConfigClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4527,8 +4553,8 @@ async def test_create_cloud_control_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config.UpdateCloudControlRequest, - dict, + config.UpdateCloudControlRequest(), + {}, ], ) def test_update_cloud_control(request_type, transport: str = "grpc"): @@ -4539,7 +4565,7 @@ def test_update_cloud_control(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4613,7 +4639,8 @@ def test_update_cloud_control_non_empty_request_with_auto_populated_field(): client.update_cloud_control(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config.UpdateCloudControlRequest() + request_msg = config.UpdateCloudControlRequest() + assert args[0] == request_msg def test_update_cloud_control_use_cached_wrapped_rpc(): @@ -4698,8 +4725,15 @@ async def test_update_cloud_control_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + config.UpdateCloudControlRequest(), + {}, + ], +) async def test_update_cloud_control_async( - transport: str = "grpc_asyncio", request_type=config.UpdateCloudControlRequest + request_type, transport: str = "grpc_asyncio" ): client = ConfigAsyncClient( credentials=async_anonymous_credentials(), @@ -4708,7 +4742,7 @@ async def test_update_cloud_control_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( @@ -4761,11 +4795,6 @@ async def test_update_cloud_control_async( ] -@pytest.mark.asyncio -async def test_update_cloud_control_async_from_dict(): - await test_update_cloud_control_async(request_type=dict) - - def test_update_cloud_control_field_headers(): client = ConfigClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4926,8 +4955,8 @@ async def test_update_cloud_control_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config.DeleteCloudControlRequest, - dict, + config.DeleteCloudControlRequest(), + {}, ], ) def test_delete_cloud_control(request_type, transport: str = "grpc"): @@ -4938,7 +4967,7 @@ def test_delete_cloud_control(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4983,9 +5012,10 @@ def test_delete_cloud_control_non_empty_request_with_auto_populated_field(): client.delete_cloud_control(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config.DeleteCloudControlRequest( + request_msg = config.DeleteCloudControlRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_cloud_control_use_cached_wrapped_rpc(): @@ -5070,8 +5100,15 @@ async def test_delete_cloud_control_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + config.DeleteCloudControlRequest(), + {}, + ], +) async def test_delete_cloud_control_async( - transport: str = "grpc_asyncio", request_type=config.DeleteCloudControlRequest + request_type, transport: str = "grpc_asyncio" ): client = ConfigAsyncClient( credentials=async_anonymous_credentials(), @@ -5080,7 +5117,7 @@ async def test_delete_cloud_control_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( @@ -5100,11 +5137,6 @@ async def test_delete_cloud_control_async( assert response is None -@pytest.mark.asyncio -async def test_delete_cloud_control_async_from_dict(): - await test_delete_cloud_control_async(request_type=dict) - - def test_delete_cloud_control_field_headers(): client = ConfigClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7410,7 +7442,6 @@ def test_list_frameworks_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.ListFrameworksRequest() - assert args[0] == request_msg @@ -7431,7 +7462,6 @@ def test_get_framework_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.GetFrameworkRequest() - assert args[0] == request_msg @@ -7452,7 +7482,6 @@ def test_create_framework_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.CreateFrameworkRequest() - assert args[0] == request_msg @@ -7473,7 +7502,6 @@ def test_update_framework_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.UpdateFrameworkRequest() - assert args[0] == request_msg @@ -7494,7 +7522,6 @@ def test_delete_framework_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.DeleteFrameworkRequest() - assert args[0] == request_msg @@ -7517,7 +7544,6 @@ def test_list_cloud_controls_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.ListCloudControlsRequest() - assert args[0] == request_msg @@ -7540,7 +7566,6 @@ def test_get_cloud_control_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.GetCloudControlRequest() - assert args[0] == request_msg @@ -7563,7 +7588,6 @@ def test_create_cloud_control_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.CreateCloudControlRequest() - assert args[0] == request_msg @@ -7586,7 +7610,6 @@ def test_update_cloud_control_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.UpdateCloudControlRequest() - assert args[0] == request_msg @@ -7609,7 +7632,6 @@ def test_delete_cloud_control_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.DeleteCloudControlRequest() - assert args[0] == request_msg @@ -7650,7 +7672,6 @@ async def test_list_frameworks_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.ListFrameworksRequest() - assert args[0] == request_msg @@ -7687,7 +7708,6 @@ async def test_get_framework_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.GetFrameworkRequest() - assert args[0] == request_msg @@ -7724,7 +7744,6 @@ async def test_create_framework_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.CreateFrameworkRequest() - assert args[0] == request_msg @@ -7761,7 +7780,6 @@ async def test_update_framework_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.UpdateFrameworkRequest() - assert args[0] == request_msg @@ -7784,7 +7802,6 @@ async def test_delete_framework_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.DeleteFrameworkRequest() - assert args[0] == request_msg @@ -7813,7 +7830,6 @@ async def test_list_cloud_controls_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.ListCloudControlsRequest() - assert args[0] == request_msg @@ -7855,7 +7871,6 @@ async def test_get_cloud_control_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.GetCloudControlRequest() - assert args[0] == request_msg @@ -7897,7 +7912,6 @@ async def test_create_cloud_control_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.CreateCloudControlRequest() - assert args[0] == request_msg @@ -7939,7 +7953,6 @@ async def test_update_cloud_control_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.UpdateCloudControlRequest() - assert args[0] == request_msg @@ -7964,7 +7977,6 @@ async def test_delete_cloud_control_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.DeleteCloudControlRequest() - assert args[0] == request_msg @@ -10218,7 +10230,6 @@ def test_list_frameworks_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.ListFrameworksRequest() - assert args[0] == request_msg @@ -10238,7 +10249,6 @@ def test_get_framework_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.GetFrameworkRequest() - assert args[0] == request_msg @@ -10258,7 +10268,6 @@ def test_create_framework_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.CreateFrameworkRequest() - assert args[0] == request_msg @@ -10278,7 +10287,6 @@ def test_update_framework_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.UpdateFrameworkRequest() - assert args[0] == request_msg @@ -10298,7 +10306,6 @@ def test_delete_framework_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.DeleteFrameworkRequest() - assert args[0] == request_msg @@ -10320,7 +10327,6 @@ def test_list_cloud_controls_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.ListCloudControlsRequest() - assert args[0] == request_msg @@ -10342,7 +10348,6 @@ def test_get_cloud_control_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.GetCloudControlRequest() - assert args[0] == request_msg @@ -10364,7 +10369,6 @@ def test_create_cloud_control_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.CreateCloudControlRequest() - assert args[0] == request_msg @@ -10386,7 +10390,6 @@ def test_update_cloud_control_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.UpdateCloudControlRequest() - assert args[0] == request_msg @@ -10408,7 +10411,6 @@ def test_delete_cloud_control_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.DeleteCloudControlRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-cloudsecuritycompliance/tests/unit/gapic/cloudsecuritycompliance_v1/test_deployment.py b/packages/google-cloud-cloudsecuritycompliance/tests/unit/gapic/cloudsecuritycompliance_v1/test_deployment.py index c683fa049e54..e18ce79b07a0 100644 --- a/packages/google-cloud-cloudsecuritycompliance/tests/unit/gapic/cloudsecuritycompliance_v1/test_deployment.py +++ b/packages/google-cloud-cloudsecuritycompliance/tests/unit/gapic/cloudsecuritycompliance_v1/test_deployment.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 @@ -115,6 +116,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" @@ -1276,8 +1292,8 @@ def test_deployment_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - deployment.CreateFrameworkDeploymentRequest, - dict, + deployment.CreateFrameworkDeploymentRequest(), + {}, ], ) def test_create_framework_deployment(request_type, transport: str = "grpc"): @@ -1288,7 +1304,7 @@ def test_create_framework_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1334,10 +1350,11 @@ def test_create_framework_deployment_non_empty_request_with_auto_populated_field client.create_framework_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == deployment.CreateFrameworkDeploymentRequest( + request_msg = deployment.CreateFrameworkDeploymentRequest( parent="parent_value", framework_deployment_id="framework_deployment_id_value", ) + assert args[0] == request_msg def test_create_framework_deployment_use_cached_wrapped_rpc(): @@ -1433,9 +1450,15 @@ async def test_create_framework_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + deployment.CreateFrameworkDeploymentRequest(), + {}, + ], +) async def test_create_framework_deployment_async( - transport: str = "grpc_asyncio", - request_type=deployment.CreateFrameworkDeploymentRequest, + request_type, transport: str = "grpc_asyncio" ): client = DeploymentAsyncClient( credentials=async_anonymous_credentials(), @@ -1444,7 +1467,7 @@ async def test_create_framework_deployment_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( @@ -1466,11 +1489,6 @@ async def test_create_framework_deployment_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_framework_deployment_async_from_dict(): - await test_create_framework_deployment_async(request_type=dict) - - def test_create_framework_deployment_field_headers(): client = DeploymentClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1645,8 +1663,8 @@ async def test_create_framework_deployment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - deployment.DeleteFrameworkDeploymentRequest, - dict, + deployment.DeleteFrameworkDeploymentRequest(), + {}, ], ) def test_delete_framework_deployment(request_type, transport: str = "grpc"): @@ -1657,7 +1675,7 @@ def test_delete_framework_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1703,10 +1721,11 @@ def test_delete_framework_deployment_non_empty_request_with_auto_populated_field client.delete_framework_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == deployment.DeleteFrameworkDeploymentRequest( + request_msg = deployment.DeleteFrameworkDeploymentRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_framework_deployment_use_cached_wrapped_rpc(): @@ -1802,9 +1821,15 @@ async def test_delete_framework_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + deployment.DeleteFrameworkDeploymentRequest(), + {}, + ], +) async def test_delete_framework_deployment_async( - transport: str = "grpc_asyncio", - request_type=deployment.DeleteFrameworkDeploymentRequest, + request_type, transport: str = "grpc_asyncio" ): client = DeploymentAsyncClient( credentials=async_anonymous_credentials(), @@ -1813,7 +1838,7 @@ async def test_delete_framework_deployment_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( @@ -1835,11 +1860,6 @@ async def test_delete_framework_deployment_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_framework_deployment_async_from_dict(): - await test_delete_framework_deployment_async(request_type=dict) - - def test_delete_framework_deployment_field_headers(): client = DeploymentClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1994,8 +2014,8 @@ async def test_delete_framework_deployment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - deployment.GetFrameworkDeploymentRequest, - dict, + deployment.GetFrameworkDeploymentRequest(), + {}, ], ) def test_get_framework_deployment(request_type, transport: str = "grpc"): @@ -2006,7 +2026,7 @@ def test_get_framework_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2067,9 +2087,10 @@ def test_get_framework_deployment_non_empty_request_with_auto_populated_field(): client.get_framework_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == deployment.GetFrameworkDeploymentRequest( + request_msg = deployment.GetFrameworkDeploymentRequest( name="name_value", ) + assert args[0] == request_msg def test_get_framework_deployment_use_cached_wrapped_rpc(): @@ -2155,9 +2176,15 @@ async def test_get_framework_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + deployment.GetFrameworkDeploymentRequest(), + {}, + ], +) async def test_get_framework_deployment_async( - transport: str = "grpc_asyncio", - request_type=deployment.GetFrameworkDeploymentRequest, + request_type, transport: str = "grpc_asyncio" ): client = DeploymentAsyncClient( credentials=async_anonymous_credentials(), @@ -2166,7 +2193,7 @@ async def test_get_framework_deployment_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( @@ -2204,11 +2231,6 @@ async def test_get_framework_deployment_async( assert response.target_resource_display_name == "target_resource_display_name_value" -@pytest.mark.asyncio -async def test_get_framework_deployment_async_from_dict(): - await test_get_framework_deployment_async(request_type=dict) - - def test_get_framework_deployment_field_headers(): client = DeploymentClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2363,8 +2385,8 @@ async def test_get_framework_deployment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - deployment.ListFrameworkDeploymentsRequest, - dict, + deployment.ListFrameworkDeploymentsRequest(), + {}, ], ) def test_list_framework_deployments(request_type, transport: str = "grpc"): @@ -2375,7 +2397,7 @@ def test_list_framework_deployments(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2426,12 +2448,13 @@ def test_list_framework_deployments_non_empty_request_with_auto_populated_field( client.list_framework_deployments(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == deployment.ListFrameworkDeploymentsRequest( + request_msg = deployment.ListFrameworkDeploymentsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_framework_deployments_use_cached_wrapped_rpc(): @@ -2517,9 +2540,15 @@ async def test_list_framework_deployments_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + deployment.ListFrameworkDeploymentsRequest(), + {}, + ], +) async def test_list_framework_deployments_async( - transport: str = "grpc_asyncio", - request_type=deployment.ListFrameworkDeploymentsRequest, + request_type, transport: str = "grpc_asyncio" ): client = DeploymentAsyncClient( credentials=async_anonymous_credentials(), @@ -2528,7 +2557,7 @@ async def test_list_framework_deployments_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( @@ -2553,11 +2582,6 @@ async def test_list_framework_deployments_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_framework_deployments_async_from_dict(): - await test_list_framework_deployments_async(request_type=dict) - - def test_list_framework_deployments_field_headers(): client = DeploymentClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2912,8 +2936,8 @@ async def test_list_framework_deployments_async_pages(): @pytest.mark.parametrize( "request_type", [ - deployment.GetCloudControlDeploymentRequest, - dict, + deployment.GetCloudControlDeploymentRequest(), + {}, ], ) def test_get_cloud_control_deployment(request_type, transport: str = "grpc"): @@ -2924,7 +2948,7 @@ def test_get_cloud_control_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2985,9 +3009,10 @@ def test_get_cloud_control_deployment_non_empty_request_with_auto_populated_fiel client.get_cloud_control_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == deployment.GetCloudControlDeploymentRequest( + request_msg = deployment.GetCloudControlDeploymentRequest( name="name_value", ) + assert args[0] == request_msg def test_get_cloud_control_deployment_use_cached_wrapped_rpc(): @@ -3073,9 +3098,15 @@ async def test_get_cloud_control_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + deployment.GetCloudControlDeploymentRequest(), + {}, + ], +) async def test_get_cloud_control_deployment_async( - transport: str = "grpc_asyncio", - request_type=deployment.GetCloudControlDeploymentRequest, + request_type, transport: str = "grpc_asyncio" ): client = DeploymentAsyncClient( credentials=async_anonymous_credentials(), @@ -3084,7 +3115,7 @@ async def test_get_cloud_control_deployment_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( @@ -3122,11 +3153,6 @@ async def test_get_cloud_control_deployment_async( assert response.target_resource_display_name == "target_resource_display_name_value" -@pytest.mark.asyncio -async def test_get_cloud_control_deployment_async_from_dict(): - await test_get_cloud_control_deployment_async(request_type=dict) - - def test_get_cloud_control_deployment_field_headers(): client = DeploymentClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3281,8 +3307,8 @@ async def test_get_cloud_control_deployment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - deployment.ListCloudControlDeploymentsRequest, - dict, + deployment.ListCloudControlDeploymentsRequest(), + {}, ], ) def test_list_cloud_control_deployments(request_type, transport: str = "grpc"): @@ -3293,7 +3319,7 @@ def test_list_cloud_control_deployments(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3344,12 +3370,13 @@ def test_list_cloud_control_deployments_non_empty_request_with_auto_populated_fi client.list_cloud_control_deployments(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == deployment.ListCloudControlDeploymentsRequest( + request_msg = deployment.ListCloudControlDeploymentsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_cloud_control_deployments_use_cached_wrapped_rpc(): @@ -3435,9 +3462,15 @@ async def test_list_cloud_control_deployments_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + deployment.ListCloudControlDeploymentsRequest(), + {}, + ], +) async def test_list_cloud_control_deployments_async( - transport: str = "grpc_asyncio", - request_type=deployment.ListCloudControlDeploymentsRequest, + request_type, transport: str = "grpc_asyncio" ): client = DeploymentAsyncClient( credentials=async_anonymous_credentials(), @@ -3446,7 +3479,7 @@ async def test_list_cloud_control_deployments_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( @@ -3471,11 +3504,6 @@ async def test_list_cloud_control_deployments_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_cloud_control_deployments_async_from_dict(): - await test_list_cloud_control_deployments_async(request_type=dict) - - def test_list_cloud_control_deployments_field_headers(): client = DeploymentClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5243,7 +5271,6 @@ def test_create_framework_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployment.CreateFrameworkDeploymentRequest() - assert args[0] == request_msg @@ -5266,7 +5293,6 @@ def test_delete_framework_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployment.DeleteFrameworkDeploymentRequest() - assert args[0] == request_msg @@ -5289,7 +5315,6 @@ def test_get_framework_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployment.GetFrameworkDeploymentRequest() - assert args[0] == request_msg @@ -5312,7 +5337,6 @@ def test_list_framework_deployments_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployment.ListFrameworkDeploymentsRequest() - assert args[0] == request_msg @@ -5335,7 +5359,6 @@ def test_get_cloud_control_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployment.GetCloudControlDeploymentRequest() - assert args[0] == request_msg @@ -5358,7 +5381,6 @@ def test_list_cloud_control_deployments_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployment.ListCloudControlDeploymentsRequest() - assert args[0] == request_msg @@ -5399,7 +5421,6 @@ async def test_create_framework_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployment.CreateFrameworkDeploymentRequest() - assert args[0] == request_msg @@ -5426,7 +5447,6 @@ async def test_delete_framework_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployment.DeleteFrameworkDeploymentRequest() - assert args[0] == request_msg @@ -5460,7 +5480,6 @@ async def test_get_framework_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployment.GetFrameworkDeploymentRequest() - assert args[0] == request_msg @@ -5489,7 +5508,6 @@ async def test_list_framework_deployments_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployment.ListFrameworkDeploymentsRequest() - assert args[0] == request_msg @@ -5523,7 +5541,6 @@ async def test_get_cloud_control_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployment.GetCloudControlDeploymentRequest() - assert args[0] == request_msg @@ -5552,7 +5569,6 @@ async def test_list_cloud_control_deployments_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployment.ListCloudControlDeploymentsRequest() - assert args[0] == request_msg @@ -6918,7 +6934,6 @@ def test_create_framework_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployment.CreateFrameworkDeploymentRequest() - assert args[0] == request_msg @@ -6940,7 +6955,6 @@ def test_delete_framework_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployment.DeleteFrameworkDeploymentRequest() - assert args[0] == request_msg @@ -6962,7 +6976,6 @@ def test_get_framework_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployment.GetFrameworkDeploymentRequest() - assert args[0] == request_msg @@ -6984,7 +6997,6 @@ def test_list_framework_deployments_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployment.ListFrameworkDeploymentsRequest() - assert args[0] == request_msg @@ -7006,7 +7018,6 @@ def test_get_cloud_control_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployment.GetCloudControlDeploymentRequest() - assert args[0] == request_msg @@ -7028,7 +7039,6 @@ def test_list_cloud_control_deployments_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployment.ListCloudControlDeploymentsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-cloudsecuritycompliance/tests/unit/gapic/cloudsecuritycompliance_v1/test_monitoring.py b/packages/google-cloud-cloudsecuritycompliance/tests/unit/gapic/cloudsecuritycompliance_v1/test_monitoring.py index 350881b33666..0be8291c35c7 100644 --- a/packages/google-cloud-cloudsecuritycompliance/tests/unit/gapic/cloudsecuritycompliance_v1/test_monitoring.py +++ b/packages/google-cloud-cloudsecuritycompliance/tests/unit/gapic/cloudsecuritycompliance_v1/test_monitoring.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" @@ -1272,8 +1288,8 @@ def test_monitoring_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - monitoring.ListFrameworkComplianceSummariesRequest, - dict, + monitoring.ListFrameworkComplianceSummariesRequest(), + {}, ], ) def test_list_framework_compliance_summaries(request_type, transport: str = "grpc"): @@ -1284,7 +1300,7 @@ def test_list_framework_compliance_summaries(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( @@ -1334,11 +1350,12 @@ def test_list_framework_compliance_summaries_non_empty_request_with_auto_populat client.list_framework_compliance_summaries(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == monitoring.ListFrameworkComplianceSummariesRequest( + request_msg = monitoring.ListFrameworkComplianceSummariesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_framework_compliance_summaries_use_cached_wrapped_rpc(): @@ -1424,9 +1441,15 @@ async def test_list_framework_compliance_summaries_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + monitoring.ListFrameworkComplianceSummariesRequest(), + {}, + ], +) async def test_list_framework_compliance_summaries_async( - transport: str = "grpc_asyncio", - request_type=monitoring.ListFrameworkComplianceSummariesRequest, + request_type, transport: str = "grpc_asyncio" ): client = MonitoringAsyncClient( credentials=async_anonymous_credentials(), @@ -1435,7 +1458,7 @@ async def test_list_framework_compliance_summaries_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( @@ -1460,11 +1483,6 @@ async def test_list_framework_compliance_summaries_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_framework_compliance_summaries_async_from_dict(): - await test_list_framework_compliance_summaries_async(request_type=dict) - - def test_list_framework_compliance_summaries_field_headers(): client = MonitoringClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1825,8 +1843,8 @@ async def test_list_framework_compliance_summaries_async_pages(): @pytest.mark.parametrize( "request_type", [ - monitoring.ListFindingSummariesRequest, - dict, + monitoring.ListFindingSummariesRequest(), + {}, ], ) def test_list_finding_summaries(request_type, transport: str = "grpc"): @@ -1837,7 +1855,7 @@ def test_list_finding_summaries(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1887,11 +1905,12 @@ def test_list_finding_summaries_non_empty_request_with_auto_populated_field(): client.list_finding_summaries(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == monitoring.ListFindingSummariesRequest( + request_msg = monitoring.ListFindingSummariesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_finding_summaries_use_cached_wrapped_rpc(): @@ -1977,8 +1996,15 @@ async def test_list_finding_summaries_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + monitoring.ListFindingSummariesRequest(), + {}, + ], +) async def test_list_finding_summaries_async( - transport: str = "grpc_asyncio", request_type=monitoring.ListFindingSummariesRequest + request_type, transport: str = "grpc_asyncio" ): client = MonitoringAsyncClient( credentials=async_anonymous_credentials(), @@ -1987,7 +2013,7 @@ async def test_list_finding_summaries_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( @@ -2012,11 +2038,6 @@ async def test_list_finding_summaries_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_finding_summaries_async_from_dict(): - await test_list_finding_summaries_async(request_type=dict) - - def test_list_finding_summaries_field_headers(): client = MonitoringClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2369,8 +2390,8 @@ async def test_list_finding_summaries_async_pages(): @pytest.mark.parametrize( "request_type", [ - monitoring.FetchFrameworkComplianceReportRequest, - dict, + monitoring.FetchFrameworkComplianceReportRequest(), + {}, ], ) def test_fetch_framework_compliance_report(request_type, transport: str = "grpc"): @@ -2381,7 +2402,7 @@ def test_fetch_framework_compliance_report(request_type, transport: str = "grpc" # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2448,10 +2469,11 @@ def test_fetch_framework_compliance_report_non_empty_request_with_auto_populated client.fetch_framework_compliance_report(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == monitoring.FetchFrameworkComplianceReportRequest( + request_msg = monitoring.FetchFrameworkComplianceReportRequest( name="name_value", filter="filter_value", ) + assert args[0] == request_msg def test_fetch_framework_compliance_report_use_cached_wrapped_rpc(): @@ -2537,9 +2559,15 @@ async def test_fetch_framework_compliance_report_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + monitoring.FetchFrameworkComplianceReportRequest(), + {}, + ], +) async def test_fetch_framework_compliance_report_async( - transport: str = "grpc_asyncio", - request_type=monitoring.FetchFrameworkComplianceReportRequest, + request_type, transport: str = "grpc_asyncio" ): client = MonitoringAsyncClient( credentials=async_anonymous_credentials(), @@ -2548,7 +2576,7 @@ async def test_fetch_framework_compliance_report_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( @@ -2593,11 +2621,6 @@ async def test_fetch_framework_compliance_report_async( assert response.minor_revision_id == 1823 -@pytest.mark.asyncio -async def test_fetch_framework_compliance_report_async_from_dict(): - await test_fetch_framework_compliance_report_async(request_type=dict) - - def test_fetch_framework_compliance_report_field_headers(): client = MonitoringClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2752,8 +2775,8 @@ async def test_fetch_framework_compliance_report_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - monitoring.ListControlComplianceSummariesRequest, - dict, + monitoring.ListControlComplianceSummariesRequest(), + {}, ], ) def test_list_control_compliance_summaries(request_type, transport: str = "grpc"): @@ -2764,7 +2787,7 @@ def test_list_control_compliance_summaries(request_type, transport: str = "grpc" # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2814,11 +2837,12 @@ def test_list_control_compliance_summaries_non_empty_request_with_auto_populated client.list_control_compliance_summaries(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == monitoring.ListControlComplianceSummariesRequest( + request_msg = monitoring.ListControlComplianceSummariesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_control_compliance_summaries_use_cached_wrapped_rpc(): @@ -2904,9 +2928,15 @@ async def test_list_control_compliance_summaries_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + monitoring.ListControlComplianceSummariesRequest(), + {}, + ], +) async def test_list_control_compliance_summaries_async( - transport: str = "grpc_asyncio", - request_type=monitoring.ListControlComplianceSummariesRequest, + request_type, transport: str = "grpc_asyncio" ): client = MonitoringAsyncClient( credentials=async_anonymous_credentials(), @@ -2915,7 +2945,7 @@ async def test_list_control_compliance_summaries_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( @@ -2940,11 +2970,6 @@ async def test_list_control_compliance_summaries_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_control_compliance_summaries_async_from_dict(): - await test_list_control_compliance_summaries_async(request_type=dict) - - def test_list_control_compliance_summaries_field_headers(): client = MonitoringClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3303,8 +3328,8 @@ async def test_list_control_compliance_summaries_async_pages(): @pytest.mark.parametrize( "request_type", [ - monitoring.AggregateFrameworkComplianceReportRequest, - dict, + monitoring.AggregateFrameworkComplianceReportRequest(), + {}, ], ) def test_aggregate_framework_compliance_report(request_type, transport: str = "grpc"): @@ -3315,7 +3340,7 @@ def test_aggregate_framework_compliance_report(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( @@ -3361,10 +3386,11 @@ def test_aggregate_framework_compliance_report_non_empty_request_with_auto_popul client.aggregate_framework_compliance_report(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == monitoring.AggregateFrameworkComplianceReportRequest( + request_msg = monitoring.AggregateFrameworkComplianceReportRequest( name="name_value", filter="filter_value", ) + assert args[0] == request_msg def test_aggregate_framework_compliance_report_use_cached_wrapped_rpc(): @@ -3450,9 +3476,15 @@ async def test_aggregate_framework_compliance_report_async_use_cached_wrapped_rp @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + monitoring.AggregateFrameworkComplianceReportRequest(), + {}, + ], +) async def test_aggregate_framework_compliance_report_async( - transport: str = "grpc_asyncio", - request_type=monitoring.AggregateFrameworkComplianceReportRequest, + request_type, transport: str = "grpc_asyncio" ): client = MonitoringAsyncClient( credentials=async_anonymous_credentials(), @@ -3461,7 +3493,7 @@ async def test_aggregate_framework_compliance_report_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( @@ -3483,11 +3515,6 @@ async def test_aggregate_framework_compliance_report_async( assert isinstance(response, monitoring.AggregateFrameworkComplianceReportResponse) -@pytest.mark.asyncio -async def test_aggregate_framework_compliance_report_async_from_dict(): - await test_aggregate_framework_compliance_report_async(request_type=dict) - - def test_aggregate_framework_compliance_report_field_headers(): client = MonitoringClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5003,7 +5030,6 @@ def test_list_framework_compliance_summaries_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = monitoring.ListFrameworkComplianceSummariesRequest() - assert args[0] == request_msg @@ -5026,7 +5052,6 @@ def test_list_finding_summaries_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = monitoring.ListFindingSummariesRequest() - assert args[0] == request_msg @@ -5049,7 +5074,6 @@ def test_fetch_framework_compliance_report_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = monitoring.FetchFrameworkComplianceReportRequest() - assert args[0] == request_msg @@ -5072,7 +5096,6 @@ def test_list_control_compliance_summaries_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = monitoring.ListControlComplianceSummariesRequest() - assert args[0] == request_msg @@ -5095,7 +5118,6 @@ def test_aggregate_framework_compliance_report_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = monitoring.AggregateFrameworkComplianceReportRequest() - assert args[0] == request_msg @@ -5138,7 +5160,6 @@ async def test_list_framework_compliance_summaries_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = monitoring.ListFrameworkComplianceSummariesRequest() - assert args[0] == request_msg @@ -5167,7 +5188,6 @@ async def test_list_finding_summaries_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = monitoring.ListFindingSummariesRequest() - assert args[0] == request_msg @@ -5206,7 +5226,6 @@ async def test_fetch_framework_compliance_report_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = monitoring.FetchFrameworkComplianceReportRequest() - assert args[0] == request_msg @@ -5235,7 +5254,6 @@ async def test_list_control_compliance_summaries_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = monitoring.ListControlComplianceSummariesRequest() - assert args[0] == request_msg @@ -5262,7 +5280,6 @@ async def test_aggregate_framework_compliance_report_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = monitoring.AggregateFrameworkComplianceReportRequest() - assert args[0] == request_msg @@ -6399,7 +6416,6 @@ def test_list_framework_compliance_summaries_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = monitoring.ListFrameworkComplianceSummariesRequest() - assert args[0] == request_msg @@ -6421,7 +6437,6 @@ def test_list_finding_summaries_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = monitoring.ListFindingSummariesRequest() - assert args[0] == request_msg @@ -6443,7 +6458,6 @@ def test_fetch_framework_compliance_report_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = monitoring.FetchFrameworkComplianceReportRequest() - assert args[0] == request_msg @@ -6465,7 +6479,6 @@ def test_list_control_compliance_summaries_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = monitoring.ListControlComplianceSummariesRequest() - assert args[0] == request_msg @@ -6487,7 +6500,6 @@ def test_aggregate_framework_compliance_report_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = monitoring.AggregateFrameworkComplianceReportRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-commerce-consumer-procurement/noxfile.py b/packages/google-cloud-commerce-consumer-procurement/noxfile.py index 24a3c03b5574..620844bc9d4f 100644 --- a/packages/google-cloud-commerce-consumer-procurement/noxfile.py +++ b/packages/google-cloud-commerce-consumer-procurement/noxfile.py @@ -47,7 +47,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-commerce-consumer-procurement" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-commerce-consumer-procurement/setup.py b/packages/google-cloud-commerce-consumer-procurement/setup.py index f3a5ed4b917b..c4dca6e9f508 100644 --- a/packages/google-cloud-commerce-consumer-procurement/setup.py +++ b/packages/google-cloud-commerce-consumer-procurement/setup.py @@ -47,7 +47,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/google-cloud-commerce-consumer-procurement/testing/constraints-3.10.txt b/packages/google-cloud-commerce-consumer-procurement/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-commerce-consumer-procurement/testing/constraints-3.10.txt +++ b/packages/google-cloud-commerce-consumer-procurement/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-commerce-consumer-procurement/tests/unit/gapic/commerce_consumer_procurement_v1/test_consumer_procurement_service.py b/packages/google-cloud-commerce-consumer-procurement/tests/unit/gapic/commerce_consumer_procurement_v1/test_consumer_procurement_service.py index 4d8e71be58a9..8a41703e2452 100644 --- a/packages/google-cloud-commerce-consumer-procurement/tests/unit/gapic/commerce_consumer_procurement_v1/test_consumer_procurement_service.py +++ b/packages/google-cloud-commerce-consumer-procurement/tests/unit/gapic/commerce_consumer_procurement_v1/test_consumer_procurement_service.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 @@ -116,6 +117,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" @@ -1410,8 +1426,8 @@ def test_consumer_procurement_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - procurement_service.PlaceOrderRequest, - dict, + procurement_service.PlaceOrderRequest(), + {}, ], ) def test_place_order(request_type, transport: str = "grpc"): @@ -1422,7 +1438,7 @@ def test_place_order(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.place_order), "__call__") as call: @@ -1465,11 +1481,12 @@ def test_place_order_non_empty_request_with_auto_populated_field(): client.place_order(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == procurement_service.PlaceOrderRequest( + request_msg = procurement_service.PlaceOrderRequest( parent="parent_value", display_name="display_name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_place_order_use_cached_wrapped_rpc(): @@ -1560,9 +1577,14 @@ async def test_place_order_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_place_order_async( - transport: str = "grpc_asyncio", request_type=procurement_service.PlaceOrderRequest -): +@pytest.mark.parametrize( + "request_type", + [ + procurement_service.PlaceOrderRequest(), + {}, + ], +) +async def test_place_order_async(request_type, transport: str = "grpc_asyncio"): client = ConsumerProcurementServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1570,7 +1592,7 @@ async def test_place_order_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.place_order), "__call__") as call: @@ -1590,11 +1612,6 @@ async def test_place_order_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_place_order_async_from_dict(): - await test_place_order_async(request_type=dict) - - def test_place_order_field_headers(): client = ConsumerProcurementServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1659,8 +1676,8 @@ async def test_place_order_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - procurement_service.GetOrderRequest, - dict, + procurement_service.GetOrderRequest(), + {}, ], ) def test_get_order(request_type, transport: str = "grpc"): @@ -1671,7 +1688,7 @@ def test_get_order(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_order), "__call__") as call: @@ -1719,9 +1736,10 @@ def test_get_order_non_empty_request_with_auto_populated_field(): client.get_order(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == procurement_service.GetOrderRequest( + request_msg = procurement_service.GetOrderRequest( name="name_value", ) + assert args[0] == request_msg def test_get_order_use_cached_wrapped_rpc(): @@ -1800,9 +1818,14 @@ async def test_get_order_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_order_async( - transport: str = "grpc_asyncio", request_type=procurement_service.GetOrderRequest -): +@pytest.mark.parametrize( + "request_type", + [ + procurement_service.GetOrderRequest(), + {}, + ], +) +async def test_get_order_async(request_type, transport: str = "grpc_asyncio"): client = ConsumerProcurementServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1810,7 +1833,7 @@ async def test_get_order_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_order), "__call__") as call: @@ -1837,11 +1860,6 @@ async def test_get_order_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_order_async_from_dict(): - await test_get_order_async(request_type=dict) - - def test_get_order_field_headers(): client = ConsumerProcurementServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1984,8 +2002,8 @@ async def test_get_order_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - procurement_service.ListOrdersRequest, - dict, + procurement_service.ListOrdersRequest(), + {}, ], ) def test_list_orders(request_type, transport: str = "grpc"): @@ -1996,7 +2014,7 @@ def test_list_orders(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_orders), "__call__") as call: @@ -2042,11 +2060,12 @@ def test_list_orders_non_empty_request_with_auto_populated_field(): client.list_orders(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == procurement_service.ListOrdersRequest( + request_msg = procurement_service.ListOrdersRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_orders_use_cached_wrapped_rpc(): @@ -2127,9 +2146,14 @@ async def test_list_orders_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_orders_async( - transport: str = "grpc_asyncio", request_type=procurement_service.ListOrdersRequest -): +@pytest.mark.parametrize( + "request_type", + [ + procurement_service.ListOrdersRequest(), + {}, + ], +) +async def test_list_orders_async(request_type, transport: str = "grpc_asyncio"): client = ConsumerProcurementServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2137,7 +2161,7 @@ async def test_list_orders_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_orders), "__call__") as call: @@ -2160,11 +2184,6 @@ async def test_list_orders_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_orders_async_from_dict(): - await test_list_orders_async(request_type=dict) - - def test_list_orders_field_headers(): client = ConsumerProcurementServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2501,8 +2520,8 @@ async def test_list_orders_async_pages(): @pytest.mark.parametrize( "request_type", [ - procurement_service.ModifyOrderRequest, - dict, + procurement_service.ModifyOrderRequest(), + {}, ], ) def test_modify_order(request_type, transport: str = "grpc"): @@ -2513,7 +2532,7 @@ def test_modify_order(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.modify_order), "__call__") as call: @@ -2556,11 +2575,12 @@ def test_modify_order_non_empty_request_with_auto_populated_field(): client.modify_order(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == procurement_service.ModifyOrderRequest( + request_msg = procurement_service.ModifyOrderRequest( name="name_value", display_name="display_name_value", etag="etag_value", ) + assert args[0] == request_msg def test_modify_order_use_cached_wrapped_rpc(): @@ -2651,9 +2671,14 @@ async def test_modify_order_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_modify_order_async( - transport: str = "grpc_asyncio", request_type=procurement_service.ModifyOrderRequest -): +@pytest.mark.parametrize( + "request_type", + [ + procurement_service.ModifyOrderRequest(), + {}, + ], +) +async def test_modify_order_async(request_type, transport: str = "grpc_asyncio"): client = ConsumerProcurementServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2661,7 +2686,7 @@ async def test_modify_order_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.modify_order), "__call__") as call: @@ -2681,11 +2706,6 @@ async def test_modify_order_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_modify_order_async_from_dict(): - await test_modify_order_async(request_type=dict) - - def test_modify_order_field_headers(): client = ConsumerProcurementServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2750,8 +2770,8 @@ async def test_modify_order_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - procurement_service.CancelOrderRequest, - dict, + procurement_service.CancelOrderRequest(), + {}, ], ) def test_cancel_order(request_type, transport: str = "grpc"): @@ -2762,7 +2782,7 @@ def test_cancel_order(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.cancel_order), "__call__") as call: @@ -2804,10 +2824,11 @@ def test_cancel_order_non_empty_request_with_auto_populated_field(): client.cancel_order(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == procurement_service.CancelOrderRequest( + request_msg = procurement_service.CancelOrderRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_cancel_order_use_cached_wrapped_rpc(): @@ -2898,9 +2919,14 @@ async def test_cancel_order_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_cancel_order_async( - transport: str = "grpc_asyncio", request_type=procurement_service.CancelOrderRequest -): +@pytest.mark.parametrize( + "request_type", + [ + procurement_service.CancelOrderRequest(), + {}, + ], +) +async def test_cancel_order_async(request_type, transport: str = "grpc_asyncio"): client = ConsumerProcurementServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2908,7 +2934,7 @@ async def test_cancel_order_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.cancel_order), "__call__") as call: @@ -2928,11 +2954,6 @@ async def test_cancel_order_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_cancel_order_async_from_dict(): - await test_cancel_order_async(request_type=dict) - - def test_cancel_order_field_headers(): client = ConsumerProcurementServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3927,7 +3948,6 @@ def test_place_order_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = procurement_service.PlaceOrderRequest() - assert args[0] == request_msg @@ -3948,7 +3968,6 @@ def test_get_order_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = procurement_service.GetOrderRequest() - assert args[0] == request_msg @@ -3969,7 +3988,6 @@ def test_list_orders_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = procurement_service.ListOrdersRequest() - assert args[0] == request_msg @@ -3990,7 +4008,6 @@ def test_modify_order_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = procurement_service.ModifyOrderRequest() - assert args[0] == request_msg @@ -4011,7 +4028,6 @@ def test_cancel_order_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = procurement_service.CancelOrderRequest() - assert args[0] == request_msg @@ -4050,7 +4066,6 @@ async def test_place_order_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = procurement_service.PlaceOrderRequest() - assert args[0] == request_msg @@ -4079,7 +4094,6 @@ async def test_get_order_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = procurement_service.GetOrderRequest() - assert args[0] == request_msg @@ -4106,7 +4120,6 @@ async def test_list_orders_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = procurement_service.ListOrdersRequest() - assert args[0] == request_msg @@ -4131,7 +4144,6 @@ async def test_modify_order_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = procurement_service.ModifyOrderRequest() - assert args[0] == request_msg @@ -4156,7 +4168,6 @@ async def test_cancel_order_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = procurement_service.CancelOrderRequest() - assert args[0] == request_msg @@ -4900,7 +4911,6 @@ def test_place_order_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = procurement_service.PlaceOrderRequest() - assert args[0] == request_msg @@ -4920,7 +4930,6 @@ def test_get_order_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = procurement_service.GetOrderRequest() - assert args[0] == request_msg @@ -4940,7 +4949,6 @@ def test_list_orders_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = procurement_service.ListOrdersRequest() - assert args[0] == request_msg @@ -4960,7 +4968,6 @@ def test_modify_order_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = procurement_service.ModifyOrderRequest() - assert args[0] == request_msg @@ -4980,7 +4987,6 @@ def test_cancel_order_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = procurement_service.CancelOrderRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-commerce-consumer-procurement/tests/unit/gapic/commerce_consumer_procurement_v1/test_license_management_service.py b/packages/google-cloud-commerce-consumer-procurement/tests/unit/gapic/commerce_consumer_procurement_v1/test_license_management_service.py index feb231f524e9..2ce4382ae21f 100644 --- a/packages/google-cloud-commerce-consumer-procurement/tests/unit/gapic/commerce_consumer_procurement_v1/test_license_management_service.py +++ b/packages/google-cloud-commerce-consumer-procurement/tests/unit/gapic/commerce_consumer_procurement_v1/test_license_management_service.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" @@ -1387,8 +1403,8 @@ def test_license_management_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - license_management_service.GetLicensePoolRequest, - dict, + license_management_service.GetLicensePoolRequest(), + {}, ], ) def test_get_license_pool(request_type, transport: str = "grpc"): @@ -1399,7 +1415,7 @@ def test_get_license_pool(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_license_pool), "__call__") as call: @@ -1447,9 +1463,10 @@ def test_get_license_pool_non_empty_request_with_auto_populated_field(): client.get_license_pool(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == license_management_service.GetLicensePoolRequest( + request_msg = license_management_service.GetLicensePoolRequest( name="name_value", ) + assert args[0] == request_msg def test_get_license_pool_use_cached_wrapped_rpc(): @@ -1532,10 +1549,14 @@ async def test_get_license_pool_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_license_pool_async( - transport: str = "grpc_asyncio", - request_type=license_management_service.GetLicensePoolRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + license_management_service.GetLicensePoolRequest(), + {}, + ], +) +async def test_get_license_pool_async(request_type, transport: str = "grpc_asyncio"): client = LicenseManagementServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1543,7 +1564,7 @@ async def test_get_license_pool_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_license_pool), "__call__") as call: @@ -1570,11 +1591,6 @@ async def test_get_license_pool_async( assert response.total_license_count == 2030 -@pytest.mark.asyncio -async def test_get_license_pool_async_from_dict(): - await test_get_license_pool_async(request_type=dict) - - def test_get_license_pool_field_headers(): client = LicenseManagementServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1721,8 +1737,8 @@ async def test_get_license_pool_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - license_management_service.UpdateLicensePoolRequest, - dict, + license_management_service.UpdateLicensePoolRequest(), + {}, ], ) def test_update_license_pool(request_type, transport: str = "grpc"): @@ -1733,7 +1749,7 @@ def test_update_license_pool(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1783,7 +1799,8 @@ def test_update_license_pool_non_empty_request_with_auto_populated_field(): client.update_license_pool(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == license_management_service.UpdateLicensePoolRequest() + request_msg = license_management_service.UpdateLicensePoolRequest() + assert args[0] == request_msg def test_update_license_pool_use_cached_wrapped_rpc(): @@ -1868,10 +1885,14 @@ async def test_update_license_pool_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_license_pool_async( - transport: str = "grpc_asyncio", - request_type=license_management_service.UpdateLicensePoolRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + license_management_service.UpdateLicensePoolRequest(), + {}, + ], +) +async def test_update_license_pool_async(request_type, transport: str = "grpc_asyncio"): client = LicenseManagementServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1879,7 +1900,7 @@ async def test_update_license_pool_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( @@ -1908,11 +1929,6 @@ async def test_update_license_pool_async( assert response.total_license_count == 2030 -@pytest.mark.asyncio -async def test_update_license_pool_async_from_dict(): - await test_update_license_pool_async(request_type=dict) - - def test_update_license_pool_field_headers(): client = LicenseManagementServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2077,8 +2093,8 @@ async def test_update_license_pool_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - license_management_service.AssignRequest, - dict, + license_management_service.AssignRequest(), + {}, ], ) def test_assign(request_type, transport: str = "grpc"): @@ -2089,7 +2105,7 @@ def test_assign(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.assign), "__call__") as call: @@ -2130,9 +2146,10 @@ def test_assign_non_empty_request_with_auto_populated_field(): client.assign(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == license_management_service.AssignRequest( + request_msg = license_management_service.AssignRequest( parent="parent_value", ) + assert args[0] == request_msg def test_assign_use_cached_wrapped_rpc(): @@ -2211,10 +2228,14 @@ async def test_assign_async_use_cached_wrapped_rpc(transport: str = "grpc_asynci @pytest.mark.asyncio -async def test_assign_async( - transport: str = "grpc_asyncio", - request_type=license_management_service.AssignRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + license_management_service.AssignRequest(), + {}, + ], +) +async def test_assign_async(request_type, transport: str = "grpc_asyncio"): client = LicenseManagementServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2222,7 +2243,7 @@ async def test_assign_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.assign), "__call__") as call: @@ -2242,11 +2263,6 @@ async def test_assign_async( assert isinstance(response, license_management_service.AssignResponse) -@pytest.mark.asyncio -async def test_assign_async_from_dict(): - await test_assign_async(request_type=dict) - - def test_assign_field_headers(): client = LicenseManagementServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2403,8 +2419,8 @@ async def test_assign_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - license_management_service.UnassignRequest, - dict, + license_management_service.UnassignRequest(), + {}, ], ) def test_unassign(request_type, transport: str = "grpc"): @@ -2415,7 +2431,7 @@ def test_unassign(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.unassign), "__call__") as call: @@ -2456,9 +2472,10 @@ def test_unassign_non_empty_request_with_auto_populated_field(): client.unassign(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == license_management_service.UnassignRequest( + request_msg = license_management_service.UnassignRequest( parent="parent_value", ) + assert args[0] == request_msg def test_unassign_use_cached_wrapped_rpc(): @@ -2537,10 +2554,14 @@ async def test_unassign_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn @pytest.mark.asyncio -async def test_unassign_async( - transport: str = "grpc_asyncio", - request_type=license_management_service.UnassignRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + license_management_service.UnassignRequest(), + {}, + ], +) +async def test_unassign_async(request_type, transport: str = "grpc_asyncio"): client = LicenseManagementServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2548,7 +2569,7 @@ async def test_unassign_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.unassign), "__call__") as call: @@ -2568,11 +2589,6 @@ async def test_unassign_async( assert isinstance(response, license_management_service.UnassignResponse) -@pytest.mark.asyncio -async def test_unassign_async_from_dict(): - await test_unassign_async(request_type=dict) - - def test_unassign_field_headers(): client = LicenseManagementServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2729,8 +2745,8 @@ async def test_unassign_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - license_management_service.EnumerateLicensedUsersRequest, - dict, + license_management_service.EnumerateLicensedUsersRequest(), + {}, ], ) def test_enumerate_licensed_users(request_type, transport: str = "grpc"): @@ -2741,7 +2757,7 @@ def test_enumerate_licensed_users(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2790,10 +2806,11 @@ def test_enumerate_licensed_users_non_empty_request_with_auto_populated_field(): client.enumerate_licensed_users(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == license_management_service.EnumerateLicensedUsersRequest( + request_msg = license_management_service.EnumerateLicensedUsersRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_enumerate_licensed_users_use_cached_wrapped_rpc(): @@ -2879,9 +2896,15 @@ async def test_enumerate_licensed_users_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + license_management_service.EnumerateLicensedUsersRequest(), + {}, + ], +) async def test_enumerate_licensed_users_async( - transport: str = "grpc_asyncio", - request_type=license_management_service.EnumerateLicensedUsersRequest, + request_type, transport: str = "grpc_asyncio" ): client = LicenseManagementServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2890,7 +2913,7 @@ async def test_enumerate_licensed_users_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( @@ -2915,11 +2938,6 @@ async def test_enumerate_licensed_users_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_enumerate_licensed_users_async_from_dict(): - await test_enumerate_licensed_users_async(request_type=dict) - - def test_enumerate_licensed_users_field_headers(): client = LicenseManagementServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4434,7 +4452,6 @@ def test_get_license_pool_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = license_management_service.GetLicensePoolRequest() - assert args[0] == request_msg @@ -4457,7 +4474,6 @@ def test_update_license_pool_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = license_management_service.UpdateLicensePoolRequest() - assert args[0] == request_msg @@ -4478,7 +4494,6 @@ def test_assign_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = license_management_service.AssignRequest() - assert args[0] == request_msg @@ -4499,7 +4514,6 @@ def test_unassign_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = license_management_service.UnassignRequest() - assert args[0] == request_msg @@ -4522,7 +4536,6 @@ def test_enumerate_licensed_users_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = license_management_service.EnumerateLicensedUsersRequest() - assert args[0] == request_msg @@ -4565,7 +4578,6 @@ async def test_get_license_pool_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = license_management_service.GetLicensePoolRequest() - assert args[0] == request_msg @@ -4596,7 +4608,6 @@ async def test_update_license_pool_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = license_management_service.UpdateLicensePoolRequest() - assert args[0] == request_msg @@ -4621,7 +4632,6 @@ async def test_assign_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = license_management_service.AssignRequest() - assert args[0] == request_msg @@ -4646,7 +4656,6 @@ async def test_unassign_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = license_management_service.UnassignRequest() - assert args[0] == request_msg @@ -4675,7 +4684,6 @@ async def test_enumerate_licensed_users_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = license_management_service.EnumerateLicensedUsersRequest() - assert args[0] == request_msg @@ -5544,7 +5552,6 @@ def test_get_license_pool_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = license_management_service.GetLicensePoolRequest() - assert args[0] == request_msg @@ -5566,7 +5573,6 @@ def test_update_license_pool_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = license_management_service.UpdateLicensePoolRequest() - assert args[0] == request_msg @@ -5586,7 +5592,6 @@ def test_assign_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = license_management_service.AssignRequest() - assert args[0] == request_msg @@ -5606,7 +5611,6 @@ def test_unassign_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = license_management_service.UnassignRequest() - assert args[0] == request_msg @@ -5628,7 +5632,6 @@ def test_enumerate_licensed_users_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = license_management_service.EnumerateLicensedUsersRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-commerce-consumer-procurement/tests/unit/gapic/commerce_consumer_procurement_v1alpha1/test_consumer_procurement_service.py b/packages/google-cloud-commerce-consumer-procurement/tests/unit/gapic/commerce_consumer_procurement_v1alpha1/test_consumer_procurement_service.py index 687e96b389b2..6a0530afc768 100644 --- a/packages/google-cloud-commerce-consumer-procurement/tests/unit/gapic/commerce_consumer_procurement_v1alpha1/test_consumer_procurement_service.py +++ b/packages/google-cloud-commerce-consumer-procurement/tests/unit/gapic/commerce_consumer_procurement_v1alpha1/test_consumer_procurement_service.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 @@ -116,6 +117,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" @@ -1410,8 +1426,8 @@ def test_consumer_procurement_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - procurement_service.PlaceOrderRequest, - dict, + procurement_service.PlaceOrderRequest(), + {}, ], ) def test_place_order(request_type, transport: str = "grpc"): @@ -1422,7 +1438,7 @@ def test_place_order(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.place_order), "__call__") as call: @@ -1465,11 +1481,12 @@ def test_place_order_non_empty_request_with_auto_populated_field(): client.place_order(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == procurement_service.PlaceOrderRequest( + request_msg = procurement_service.PlaceOrderRequest( parent="parent_value", display_name="display_name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_place_order_use_cached_wrapped_rpc(): @@ -1560,9 +1577,14 @@ async def test_place_order_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_place_order_async( - transport: str = "grpc_asyncio", request_type=procurement_service.PlaceOrderRequest -): +@pytest.mark.parametrize( + "request_type", + [ + procurement_service.PlaceOrderRequest(), + {}, + ], +) +async def test_place_order_async(request_type, transport: str = "grpc_asyncio"): client = ConsumerProcurementServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1570,7 +1592,7 @@ async def test_place_order_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.place_order), "__call__") as call: @@ -1590,11 +1612,6 @@ async def test_place_order_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_place_order_async_from_dict(): - await test_place_order_async(request_type=dict) - - def test_place_order_field_headers(): client = ConsumerProcurementServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1659,8 +1676,8 @@ async def test_place_order_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - procurement_service.GetOrderRequest, - dict, + procurement_service.GetOrderRequest(), + {}, ], ) def test_get_order(request_type, transport: str = "grpc"): @@ -1671,7 +1688,7 @@ def test_get_order(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_order), "__call__") as call: @@ -1719,9 +1736,10 @@ def test_get_order_non_empty_request_with_auto_populated_field(): client.get_order(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == procurement_service.GetOrderRequest( + request_msg = procurement_service.GetOrderRequest( name="name_value", ) + assert args[0] == request_msg def test_get_order_use_cached_wrapped_rpc(): @@ -1800,9 +1818,14 @@ async def test_get_order_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_order_async( - transport: str = "grpc_asyncio", request_type=procurement_service.GetOrderRequest -): +@pytest.mark.parametrize( + "request_type", + [ + procurement_service.GetOrderRequest(), + {}, + ], +) +async def test_get_order_async(request_type, transport: str = "grpc_asyncio"): client = ConsumerProcurementServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1810,7 +1833,7 @@ async def test_get_order_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_order), "__call__") as call: @@ -1837,11 +1860,6 @@ async def test_get_order_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_order_async_from_dict(): - await test_get_order_async(request_type=dict) - - def test_get_order_field_headers(): client = ConsumerProcurementServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1984,8 +2002,8 @@ async def test_get_order_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - procurement_service.ListOrdersRequest, - dict, + procurement_service.ListOrdersRequest(), + {}, ], ) def test_list_orders(request_type, transport: str = "grpc"): @@ -1996,7 +2014,7 @@ def test_list_orders(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_orders), "__call__") as call: @@ -2042,11 +2060,12 @@ def test_list_orders_non_empty_request_with_auto_populated_field(): client.list_orders(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == procurement_service.ListOrdersRequest( + request_msg = procurement_service.ListOrdersRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_orders_use_cached_wrapped_rpc(): @@ -2127,9 +2146,14 @@ async def test_list_orders_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_orders_async( - transport: str = "grpc_asyncio", request_type=procurement_service.ListOrdersRequest -): +@pytest.mark.parametrize( + "request_type", + [ + procurement_service.ListOrdersRequest(), + {}, + ], +) +async def test_list_orders_async(request_type, transport: str = "grpc_asyncio"): client = ConsumerProcurementServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2137,7 +2161,7 @@ async def test_list_orders_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_orders), "__call__") as call: @@ -2160,11 +2184,6 @@ async def test_list_orders_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_orders_async_from_dict(): - await test_list_orders_async(request_type=dict) - - def test_list_orders_field_headers(): client = ConsumerProcurementServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3189,7 +3208,6 @@ def test_place_order_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = procurement_service.PlaceOrderRequest() - assert args[0] == request_msg @@ -3210,7 +3228,6 @@ def test_get_order_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = procurement_service.GetOrderRequest() - assert args[0] == request_msg @@ -3231,7 +3248,6 @@ def test_list_orders_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = procurement_service.ListOrdersRequest() - assert args[0] == request_msg @@ -3270,7 +3286,6 @@ async def test_place_order_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = procurement_service.PlaceOrderRequest() - assert args[0] == request_msg @@ -3299,7 +3314,6 @@ async def test_get_order_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = procurement_service.GetOrderRequest() - assert args[0] == request_msg @@ -3326,7 +3340,6 @@ async def test_list_orders_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = procurement_service.ListOrdersRequest() - assert args[0] == request_msg @@ -3818,7 +3831,6 @@ def test_place_order_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = procurement_service.PlaceOrderRequest() - assert args[0] == request_msg @@ -3838,7 +3850,6 @@ def test_get_order_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = procurement_service.GetOrderRequest() - assert args[0] == request_msg @@ -3858,7 +3869,6 @@ def test_list_orders_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = procurement_service.ListOrdersRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-common/noxfile.py b/packages/google-cloud-common/noxfile.py index 53e76a40e549..58d097ef35dc 100644 --- a/packages/google-cloud-common/noxfile.py +++ b/packages/google-cloud-common/noxfile.py @@ -47,7 +47,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-common" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-common/setup.py b/packages/google-cloud-common/setup.py index 8f06bf86adaf..1e5cbf370808 100644 --- a/packages/google-cloud-common/setup.py +++ b/packages/google-cloud-common/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/google-cloud-common/testing/constraints-3.10.txt b/packages/google-cloud-common/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-common/testing/constraints-3.10.txt +++ b/packages/google-cloud-common/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-compute-v1beta/noxfile.py b/packages/google-cloud-compute-v1beta/noxfile.py index 8b40a17b616a..b0d0ee4f53ec 100644 --- a/packages/google-cloud-compute-v1beta/noxfile.py +++ b/packages/google-cloud-compute-v1beta/noxfile.py @@ -47,7 +47,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-compute-v1beta" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-compute-v1beta/setup.py b/packages/google-cloud-compute-v1beta/setup.py index d3ea66062210..36f6a285726e 100644 --- a/packages/google-cloud-compute-v1beta/setup.py +++ b/packages/google-cloud-compute-v1beta/setup.py @@ -45,7 +45,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/google-cloud-compute-v1beta/testing/constraints-3.10.txt b/packages/google-cloud-compute-v1beta/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-compute-v1beta/testing/constraints-3.10.txt +++ b/packages/google-cloud-compute-v1beta/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-compute-v1beta/tests/unit/gapic/compute_v1beta/test_accelerator_types.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_accelerator_types.py index 779f31b01ac4..22b1bdb1a9d2 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_accelerator_types.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_accelerator_types.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 @@ -106,6 +107,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" @@ -2443,7 +2459,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListAcceleratorTypesRequest() - assert args[0] == request_msg @@ -2463,7 +2478,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetAcceleratorTypeRequest() - assert args[0] == request_msg @@ -2483,7 +2497,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListAcceleratorTypesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_addresses.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_addresses.py index 218b4a0d9ba9..abee5956b984 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_addresses.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_addresses.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 @@ -108,6 +109,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" @@ -5387,7 +5403,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListAddressesRequest() - assert args[0] == request_msg @@ -5407,7 +5422,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteAddressRequest() - assert args[0] == request_msg @@ -5427,7 +5441,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetAddressRequest() - assert args[0] == request_msg @@ -5447,7 +5460,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertAddressRequest() - assert args[0] == request_msg @@ -5467,7 +5479,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListAddressesRequest() - assert args[0] == request_msg @@ -5487,7 +5498,6 @@ def test_move_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.MoveAddressRequest() - assert args[0] == request_msg @@ -5507,7 +5517,6 @@ def test_set_labels_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetLabelsAddressRequest() - assert args[0] == request_msg @@ -5529,7 +5538,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsAddressRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_advice.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_advice.py index 02e2d405031d..5d5ca9174108 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_advice.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_advice.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 @@ -102,6 +103,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" @@ -2441,7 +2457,6 @@ def test_calendar_mode_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.CalendarModeAdviceRpcRequest() - assert args[0] == request_msg @@ -2461,7 +2476,6 @@ def test_capacity_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.CapacityAdviceRpcRequest() - assert args[0] == request_msg @@ -2481,7 +2495,6 @@ def test_capacity_history_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.CapacityHistoryAdviceRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_autoscalers.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_autoscalers.py index 2a92700183a3..14a50574c75a 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_autoscalers.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_autoscalers.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 @@ -108,6 +109,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" @@ -5494,7 +5510,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListAutoscalersRequest() - assert args[0] == request_msg @@ -5514,7 +5529,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteAutoscalerRequest() - assert args[0] == request_msg @@ -5534,7 +5548,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetAutoscalerRequest() - assert args[0] == request_msg @@ -5554,7 +5567,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertAutoscalerRequest() - assert args[0] == request_msg @@ -5574,7 +5586,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListAutoscalersRequest() - assert args[0] == request_msg @@ -5594,7 +5605,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchAutoscalerRequest() - assert args[0] == request_msg @@ -5616,7 +5626,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsAutoscalerRequest() - assert args[0] == request_msg @@ -5636,7 +5645,6 @@ def test_update_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.UpdateAutoscalerRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_backend_buckets.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_backend_buckets.py index 2b97ad52d0cc..598b953145c6 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_backend_buckets.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_backend_buckets.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 @@ -108,6 +109,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" @@ -8593,7 +8609,6 @@ def test_add_signed_url_key_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AddSignedUrlKeyBackendBucketRequest() - assert args[0] == request_msg @@ -8613,7 +8628,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListBackendBucketsRequest() - assert args[0] == request_msg @@ -8633,7 +8647,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteBackendBucketRequest() - assert args[0] == request_msg @@ -8655,7 +8668,6 @@ def test_delete_signed_url_key_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteSignedUrlKeyBackendBucketRequest() - assert args[0] == request_msg @@ -8675,7 +8687,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetBackendBucketRequest() - assert args[0] == request_msg @@ -8695,7 +8706,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetIamPolicyBackendBucketRequest() - assert args[0] == request_msg @@ -8715,7 +8725,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertBackendBucketRequest() - assert args[0] == request_msg @@ -8735,7 +8744,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListBackendBucketsRequest() - assert args[0] == request_msg @@ -8755,7 +8763,6 @@ def test_list_usable_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListUsableBackendBucketsRequest() - assert args[0] == request_msg @@ -8775,7 +8782,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchBackendBucketRequest() - assert args[0] == request_msg @@ -8797,7 +8803,6 @@ def test_set_edge_security_policy_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetEdgeSecurityPolicyBackendBucketRequest() - assert args[0] == request_msg @@ -8817,7 +8822,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetIamPolicyBackendBucketRequest() - assert args[0] == request_msg @@ -8839,7 +8843,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsBackendBucketRequest() - assert args[0] == request_msg @@ -8859,7 +8862,6 @@ def test_update_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.UpdateBackendBucketRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_backend_services.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_backend_services.py index d43982487b75..6c84bf89e5ea 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_backend_services.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_backend_services.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 @@ -108,6 +109,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" @@ -10562,7 +10578,6 @@ def test_add_signed_url_key_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AddSignedUrlKeyBackendServiceRequest() - assert args[0] == request_msg @@ -10582,7 +10597,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListBackendServicesRequest() - assert args[0] == request_msg @@ -10602,7 +10616,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteBackendServiceRequest() - assert args[0] == request_msg @@ -10624,7 +10637,6 @@ def test_delete_signed_url_key_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteSignedUrlKeyBackendServiceRequest() - assert args[0] == request_msg @@ -10644,7 +10656,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetBackendServiceRequest() - assert args[0] == request_msg @@ -10666,7 +10677,6 @@ def test_get_effective_security_policies_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetEffectiveSecurityPoliciesBackendServiceRequest() - assert args[0] == request_msg @@ -10686,7 +10696,6 @@ def test_get_health_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetHealthBackendServiceRequest() - assert args[0] == request_msg @@ -10706,7 +10715,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetIamPolicyBackendServiceRequest() - assert args[0] == request_msg @@ -10726,7 +10734,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertBackendServiceRequest() - assert args[0] == request_msg @@ -10746,7 +10753,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListBackendServicesRequest() - assert args[0] == request_msg @@ -10766,7 +10772,6 @@ def test_list_usable_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListUsableBackendServicesRequest() - assert args[0] == request_msg @@ -10786,7 +10791,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchBackendServiceRequest() - assert args[0] == request_msg @@ -10808,7 +10812,6 @@ def test_set_edge_security_policy_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetEdgeSecurityPolicyBackendServiceRequest() - assert args[0] == request_msg @@ -10828,7 +10831,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetIamPolicyBackendServiceRequest() - assert args[0] == request_msg @@ -10850,7 +10852,6 @@ def test_set_security_policy_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetSecurityPolicyBackendServiceRequest() - assert args[0] == request_msg @@ -10872,7 +10873,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsBackendServiceRequest() - assert args[0] == request_msg @@ -10892,7 +10892,6 @@ def test_update_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.UpdateBackendServiceRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_cross_site_networks.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_cross_site_networks.py index d87976047f7d..793b2e39023b 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_cross_site_networks.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_cross_site_networks.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 @@ -108,6 +109,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" @@ -3923,7 +3939,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteCrossSiteNetworkRequest() - assert args[0] == request_msg @@ -3943,7 +3958,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetCrossSiteNetworkRequest() - assert args[0] == request_msg @@ -3963,7 +3977,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertCrossSiteNetworkRequest() - assert args[0] == request_msg @@ -3983,7 +3996,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListCrossSiteNetworksRequest() - assert args[0] == request_msg @@ -4003,7 +4015,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchCrossSiteNetworkRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_disk_settings_service.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_disk_settings_service.py index 3420d7ad689f..8e67f77c185f 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_disk_settings_service.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_disk_settings_service.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 @@ -107,6 +108,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" @@ -2297,7 +2313,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetDiskSettingRequest() - assert args[0] == request_msg @@ -2317,7 +2332,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchDiskSettingRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_disk_types.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_disk_types.py index 629c5f09394e..0c1694e518f4 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_disk_types.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_disk_types.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 @@ -106,6 +107,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" @@ -2364,7 +2380,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListDiskTypesRequest() - assert args[0] == request_msg @@ -2384,7 +2399,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetDiskTypeRequest() - assert args[0] == request_msg @@ -2404,7 +2418,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListDiskTypesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_disks.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_disks.py index 3574dc2b9a77..d18d87c60fed 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_disks.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_disks.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 @@ -104,6 +105,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" @@ -13085,7 +13101,6 @@ def test_add_resource_policies_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AddResourcePoliciesDiskRequest() - assert args[0] == request_msg @@ -13105,7 +13120,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListDisksRequest() - assert args[0] == request_msg @@ -13125,7 +13139,6 @@ def test_bulk_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.BulkInsertDiskRequest() - assert args[0] == request_msg @@ -13145,7 +13158,6 @@ def test_bulk_set_labels_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.BulkSetLabelsDiskRequest() - assert args[0] == request_msg @@ -13165,7 +13177,6 @@ def test_create_snapshot_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.CreateSnapshotDiskRequest() - assert args[0] == request_msg @@ -13185,7 +13196,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteDiskRequest() - assert args[0] == request_msg @@ -13205,7 +13215,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetDiskRequest() - assert args[0] == request_msg @@ -13225,7 +13234,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetIamPolicyDiskRequest() - assert args[0] == request_msg @@ -13245,7 +13253,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertDiskRequest() - assert args[0] == request_msg @@ -13265,7 +13272,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListDisksRequest() - assert args[0] == request_msg @@ -13287,7 +13293,6 @@ def test_remove_resource_policies_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.RemoveResourcePoliciesDiskRequest() - assert args[0] == request_msg @@ -13307,7 +13312,6 @@ def test_resize_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ResizeDiskRequest() - assert args[0] == request_msg @@ -13327,7 +13331,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetIamPolicyDiskRequest() - assert args[0] == request_msg @@ -13347,7 +13350,6 @@ def test_set_labels_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetLabelsDiskRequest() - assert args[0] == request_msg @@ -13369,7 +13371,6 @@ def test_start_async_replication_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.StartAsyncReplicationDiskRequest() - assert args[0] == request_msg @@ -13391,7 +13392,6 @@ def test_stop_async_replication_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.StopAsyncReplicationDiskRequest() - assert args[0] == request_msg @@ -13413,7 +13413,6 @@ def test_stop_group_async_replication_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.StopGroupAsyncReplicationDiskRequest() - assert args[0] == request_msg @@ -13435,7 +13434,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsDiskRequest() - assert args[0] == request_msg @@ -13455,7 +13453,6 @@ def test_update_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.UpdateDiskRequest() - assert args[0] == request_msg @@ -13475,7 +13472,6 @@ def test_update_kms_key_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.UpdateKmsKeyDiskRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_external_vpn_gateways.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_external_vpn_gateways.py index 0a64b0f5d204..54999d028d89 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_external_vpn_gateways.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_external_vpn_gateways.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 @@ -108,6 +109,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" @@ -4322,7 +4338,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteExternalVpnGatewayRequest() - assert args[0] == request_msg @@ -4342,7 +4357,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetExternalVpnGatewayRequest() - assert args[0] == request_msg @@ -4362,7 +4376,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertExternalVpnGatewayRequest() - assert args[0] == request_msg @@ -4382,7 +4395,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListExternalVpnGatewaysRequest() - assert args[0] == request_msg @@ -4402,7 +4414,6 @@ def test_set_labels_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetLabelsExternalVpnGatewayRequest() - assert args[0] == request_msg @@ -4424,7 +4435,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsExternalVpnGatewayRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_firewall_policies.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_firewall_policies.py index bfa40c175d75..0c564fea77da 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_firewall_policies.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_firewall_policies.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 @@ -108,6 +109,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" @@ -12735,7 +12751,6 @@ def test_add_association_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AddAssociationFirewallPolicyRequest() - assert args[0] == request_msg @@ -12757,7 +12772,6 @@ def test_add_packet_mirroring_rule_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AddPacketMirroringRuleFirewallPolicyRequest() - assert args[0] == request_msg @@ -12777,7 +12791,6 @@ def test_add_rule_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AddRuleFirewallPolicyRequest() - assert args[0] == request_msg @@ -12797,7 +12810,6 @@ def test_clone_rules_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.CloneRulesFirewallPolicyRequest() - assert args[0] == request_msg @@ -12817,7 +12829,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteFirewallPolicyRequest() - assert args[0] == request_msg @@ -12837,7 +12848,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetFirewallPolicyRequest() - assert args[0] == request_msg @@ -12857,7 +12867,6 @@ def test_get_association_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetAssociationFirewallPolicyRequest() - assert args[0] == request_msg @@ -12877,7 +12886,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetIamPolicyFirewallPolicyRequest() - assert args[0] == request_msg @@ -12899,7 +12907,6 @@ def test_get_packet_mirroring_rule_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetPacketMirroringRuleFirewallPolicyRequest() - assert args[0] == request_msg @@ -12919,7 +12926,6 @@ def test_get_rule_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRuleFirewallPolicyRequest() - assert args[0] == request_msg @@ -12939,7 +12945,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertFirewallPolicyRequest() - assert args[0] == request_msg @@ -12959,7 +12964,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListFirewallPoliciesRequest() - assert args[0] == request_msg @@ -12981,7 +12985,6 @@ def test_list_associations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListAssociationsFirewallPolicyRequest() - assert args[0] == request_msg @@ -13001,7 +13004,6 @@ def test_move_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.MoveFirewallPolicyRequest() - assert args[0] == request_msg @@ -13021,7 +13023,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchFirewallPolicyRequest() - assert args[0] == request_msg @@ -13043,7 +13044,6 @@ def test_patch_packet_mirroring_rule_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchPacketMirroringRuleFirewallPolicyRequest() - assert args[0] == request_msg @@ -13063,7 +13063,6 @@ def test_patch_rule_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchRuleFirewallPolicyRequest() - assert args[0] == request_msg @@ -13085,7 +13084,6 @@ def test_remove_association_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.RemoveAssociationFirewallPolicyRequest() - assert args[0] == request_msg @@ -13107,7 +13105,6 @@ def test_remove_packet_mirroring_rule_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.RemovePacketMirroringRuleFirewallPolicyRequest() - assert args[0] == request_msg @@ -13127,7 +13124,6 @@ def test_remove_rule_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.RemoveRuleFirewallPolicyRequest() - assert args[0] == request_msg @@ -13147,7 +13143,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetIamPolicyFirewallPolicyRequest() - assert args[0] == request_msg @@ -13169,7 +13164,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsFirewallPolicyRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_firewalls.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_firewalls.py index 99d0f2a973be..eabd1cc62532 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_firewalls.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_firewalls.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 @@ -108,6 +109,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" @@ -4935,7 +4951,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteFirewallRequest() - assert args[0] == request_msg @@ -4955,7 +4970,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetFirewallRequest() - assert args[0] == request_msg @@ -4975,7 +4989,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertFirewallRequest() - assert args[0] == request_msg @@ -4995,7 +5008,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListFirewallsRequest() - assert args[0] == request_msg @@ -5015,7 +5027,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchFirewallRequest() - assert args[0] == request_msg @@ -5037,7 +5048,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsFirewallRequest() - assert args[0] == request_msg @@ -5057,7 +5067,6 @@ def test_update_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.UpdateFirewallRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_forwarding_rules.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_forwarding_rules.py index ab02704e22d7..6295a26e5e65 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_forwarding_rules.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_forwarding_rules.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 @@ -108,6 +109,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" @@ -6345,7 +6361,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListForwardingRulesRequest() - assert args[0] == request_msg @@ -6365,7 +6380,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteForwardingRuleRequest() - assert args[0] == request_msg @@ -6385,7 +6399,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetForwardingRuleRequest() - assert args[0] == request_msg @@ -6405,7 +6418,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertForwardingRuleRequest() - assert args[0] == request_msg @@ -6425,7 +6437,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListForwardingRulesRequest() - assert args[0] == request_msg @@ -6445,7 +6456,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchForwardingRuleRequest() - assert args[0] == request_msg @@ -6465,7 +6475,6 @@ def test_set_labels_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetLabelsForwardingRuleRequest() - assert args[0] == request_msg @@ -6485,7 +6494,6 @@ def test_set_target_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetTargetForwardingRuleRequest() - assert args[0] == request_msg @@ -6507,7 +6515,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsForwardingRuleRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_future_reservations.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_future_reservations.py index 4e8e8cfbe491..bf8f908e600c 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_future_reservations.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_future_reservations.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 @@ -108,6 +109,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" @@ -5278,7 +5294,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListFutureReservationsRequest() - assert args[0] == request_msg @@ -5298,7 +5313,6 @@ def test_cancel_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.CancelFutureReservationRequest() - assert args[0] == request_msg @@ -5318,7 +5332,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteFutureReservationRequest() - assert args[0] == request_msg @@ -5338,7 +5351,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetFutureReservationRequest() - assert args[0] == request_msg @@ -5358,7 +5370,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertFutureReservationRequest() - assert args[0] == request_msg @@ -5378,7 +5389,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListFutureReservationsRequest() - assert args[0] == request_msg @@ -5398,7 +5408,6 @@ def test_update_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.UpdateFutureReservationRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_global_addresses.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_global_addresses.py index d553d45d97cd..50bb32e1e479 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_global_addresses.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_global_addresses.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 @@ -108,6 +109,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" @@ -4951,7 +4967,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteGlobalAddressRequest() - assert args[0] == request_msg @@ -4971,7 +4986,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetGlobalAddressRequest() - assert args[0] == request_msg @@ -4991,7 +5005,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertGlobalAddressRequest() - assert args[0] == request_msg @@ -5011,7 +5024,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListGlobalAddressesRequest() - assert args[0] == request_msg @@ -5031,7 +5043,6 @@ def test_move_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.MoveGlobalAddressRequest() - assert args[0] == request_msg @@ -5051,7 +5062,6 @@ def test_set_labels_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetLabelsGlobalAddressRequest() - assert args[0] == request_msg @@ -5073,7 +5083,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsGlobalAddressRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_global_forwarding_rules.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_global_forwarding_rules.py index 9fbd8746c3a3..d4be9b6a895c 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_global_forwarding_rules.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_global_forwarding_rules.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 @@ -108,6 +109,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" @@ -5800,7 +5816,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteGlobalForwardingRuleRequest() - assert args[0] == request_msg @@ -5820,7 +5835,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetGlobalForwardingRuleRequest() - assert args[0] == request_msg @@ -5840,7 +5854,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertGlobalForwardingRuleRequest() - assert args[0] == request_msg @@ -5860,7 +5873,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListGlobalForwardingRulesRequest() - assert args[0] == request_msg @@ -5880,7 +5892,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchGlobalForwardingRuleRequest() - assert args[0] == request_msg @@ -5900,7 +5911,6 @@ def test_set_labels_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetLabelsGlobalForwardingRuleRequest() - assert args[0] == request_msg @@ -5920,7 +5930,6 @@ def test_set_target_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetTargetGlobalForwardingRuleRequest() - assert args[0] == request_msg @@ -5942,7 +5951,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsGlobalForwardingRuleRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_global_network_endpoint_groups.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_global_network_endpoint_groups.py index 622d91973af9..80dece0799b5 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_global_network_endpoint_groups.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_global_network_endpoint_groups.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 @@ -108,6 +109,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" @@ -5178,7 +5194,6 @@ def test_attach_network_endpoints_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AttachNetworkEndpointsGlobalNetworkEndpointGroupRequest() - assert args[0] == request_msg @@ -5198,7 +5213,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteGlobalNetworkEndpointGroupRequest() - assert args[0] == request_msg @@ -5220,7 +5234,6 @@ def test_detach_network_endpoints_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DetachNetworkEndpointsGlobalNetworkEndpointGroupRequest() - assert args[0] == request_msg @@ -5240,7 +5253,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetGlobalNetworkEndpointGroupRequest() - assert args[0] == request_msg @@ -5260,7 +5272,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertGlobalNetworkEndpointGroupRequest() - assert args[0] == request_msg @@ -5280,7 +5291,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListGlobalNetworkEndpointGroupsRequest() - assert args[0] == request_msg @@ -5302,7 +5312,6 @@ def test_list_network_endpoints_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListNetworkEndpointsGlobalNetworkEndpointGroupsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_global_operations.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_global_operations.py index e7f0669bc830..2757febe3e0c 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_global_operations.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_global_operations.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 @@ -106,6 +107,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" @@ -3111,7 +3127,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListGlobalOperationsRequest() - assert args[0] == request_msg @@ -3131,7 +3146,6 @@ def test_delete_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteGlobalOperationRequest() - assert args[0] == request_msg @@ -3151,7 +3165,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetGlobalOperationRequest() - assert args[0] == request_msg @@ -3171,7 +3184,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListGlobalOperationsRequest() - assert args[0] == request_msg @@ -3191,7 +3203,6 @@ def test_wait_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.WaitGlobalOperationRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_global_organization_operations.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_global_organization_operations.py index b6a9aa6fc840..e459ff13fea9 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_global_organization_operations.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_global_organization_operations.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 @@ -106,6 +107,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" @@ -2240,7 +2256,6 @@ def test_delete_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteGlobalOrganizationOperationRequest() - assert args[0] == request_msg @@ -2260,7 +2275,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetGlobalOrganizationOperationRequest() - assert args[0] == request_msg @@ -2280,7 +2294,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListGlobalOrganizationOperationsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_global_public_delegated_prefixes.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_global_public_delegated_prefixes.py index 44056f95e300..248527fc81cf 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_global_public_delegated_prefixes.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_global_public_delegated_prefixes.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 @@ -108,6 +109,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" @@ -4052,7 +4068,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteGlobalPublicDelegatedPrefixeRequest() - assert args[0] == request_msg @@ -4072,7 +4087,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetGlobalPublicDelegatedPrefixeRequest() - assert args[0] == request_msg @@ -4092,7 +4106,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertGlobalPublicDelegatedPrefixeRequest() - assert args[0] == request_msg @@ -4112,7 +4125,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListGlobalPublicDelegatedPrefixesRequest() - assert args[0] == request_msg @@ -4132,7 +4144,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchGlobalPublicDelegatedPrefixeRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_global_vm_extension_policies.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_global_vm_extension_policies.py index 659c4f276555..2f1a45637fa0 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_global_vm_extension_policies.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_global_vm_extension_policies.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 @@ -108,6 +109,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" @@ -4545,7 +4561,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListGlobalVmExtensionPoliciesRequest() - assert args[0] == request_msg @@ -4565,7 +4580,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteGlobalVmExtensionPolicyRequest() - assert args[0] == request_msg @@ -4585,7 +4599,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetGlobalVmExtensionPolicyRequest() - assert args[0] == request_msg @@ -4605,7 +4618,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertGlobalVmExtensionPolicyRequest() - assert args[0] == request_msg @@ -4625,7 +4637,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListGlobalVmExtensionPoliciesRequest() - assert args[0] == request_msg @@ -4645,7 +4656,6 @@ def test_update_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.UpdateGlobalVmExtensionPolicyRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_health_checks.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_health_checks.py index db7ad091012a..6a91b434015e 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_health_checks.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_health_checks.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 @@ -108,6 +109,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" @@ -5460,7 +5476,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListHealthChecksRequest() - assert args[0] == request_msg @@ -5480,7 +5495,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteHealthCheckRequest() - assert args[0] == request_msg @@ -5500,7 +5514,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetHealthCheckRequest() - assert args[0] == request_msg @@ -5520,7 +5533,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertHealthCheckRequest() - assert args[0] == request_msg @@ -5540,7 +5552,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListHealthChecksRequest() - assert args[0] == request_msg @@ -5560,7 +5571,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchHealthCheckRequest() - assert args[0] == request_msg @@ -5582,7 +5592,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsHealthCheckRequest() - assert args[0] == request_msg @@ -5602,7 +5611,6 @@ def test_update_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.UpdateHealthCheckRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_image_family_views.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_image_family_views.py index 6109b44f1bcb..1b7798ef1830 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_image_family_views.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_image_family_views.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 @@ -105,6 +106,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" @@ -1586,7 +1602,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetImageFamilyViewRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_images.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_images.py index 0d74fa337825..67b1affb39d2 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_images.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_images.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 @@ -104,6 +105,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" @@ -6750,7 +6766,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteImageRequest() - assert args[0] == request_msg @@ -6770,7 +6785,6 @@ def test_deprecate_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeprecateImageRequest() - assert args[0] == request_msg @@ -6790,7 +6804,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetImageRequest() - assert args[0] == request_msg @@ -6810,7 +6823,6 @@ def test_get_from_family_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetFromFamilyImageRequest() - assert args[0] == request_msg @@ -6830,7 +6842,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetIamPolicyImageRequest() - assert args[0] == request_msg @@ -6850,7 +6861,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertImageRequest() - assert args[0] == request_msg @@ -6870,7 +6880,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListImagesRequest() - assert args[0] == request_msg @@ -6890,7 +6899,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchImageRequest() - assert args[0] == request_msg @@ -6910,7 +6918,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetIamPolicyImageRequest() - assert args[0] == request_msg @@ -6930,7 +6937,6 @@ def test_set_labels_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetLabelsImageRequest() - assert args[0] == request_msg @@ -6952,7 +6958,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsImageRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_instance_group_manager_resize_requests.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_instance_group_manager_resize_requests.py index fff085ded072..77a2d11cc459 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_instance_group_manager_resize_requests.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_instance_group_manager_resize_requests.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 @@ -108,6 +109,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" @@ -4187,7 +4203,6 @@ def test_cancel_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.CancelInstanceGroupManagerResizeRequestRequest() - assert args[0] == request_msg @@ -4207,7 +4222,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteInstanceGroupManagerResizeRequestRequest() - assert args[0] == request_msg @@ -4227,7 +4241,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetInstanceGroupManagerResizeRequestRequest() - assert args[0] == request_msg @@ -4247,7 +4260,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertInstanceGroupManagerResizeRequestRequest() - assert args[0] == request_msg @@ -4267,7 +4279,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListInstanceGroupManagerResizeRequestsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_instance_group_managers.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_instance_group_managers.py index 20bc64229e5e..7bfa1915f68e 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_instance_group_managers.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_instance_group_managers.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 @@ -108,6 +109,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" @@ -20644,7 +20660,6 @@ def test_abandon_instances_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AbandonInstancesInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -20664,7 +20679,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListInstanceGroupManagersRequest() - assert args[0] == request_msg @@ -20686,7 +20700,6 @@ def test_apply_updates_to_instances_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ApplyUpdatesToInstancesInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -20710,7 +20723,6 @@ def test_configure_accelerator_topologies_unary_empty_call_rest(): request_msg = ( compute.ConfigureAcceleratorTopologiesInstanceGroupManagerRequest() ) - assert args[0] == request_msg @@ -20730,7 +20742,6 @@ def test_create_instances_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.CreateInstancesInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -20750,7 +20761,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -20770,7 +20780,6 @@ def test_delete_instances_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteInstancesInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -20792,7 +20801,6 @@ def test_delete_per_instance_configs_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeletePerInstanceConfigsInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -20812,7 +20820,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -20836,7 +20843,6 @@ def test_get_available_accelerator_topologies_empty_call_rest(): request_msg = ( compute.GetAvailableAcceleratorTopologiesInstanceGroupManagerRequest() ) - assert args[0] == request_msg @@ -20856,7 +20862,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -20876,7 +20881,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListInstanceGroupManagersRequest() - assert args[0] == request_msg @@ -20896,7 +20900,6 @@ def test_list_errors_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListErrorsInstanceGroupManagersRequest() - assert args[0] == request_msg @@ -20918,7 +20921,6 @@ def test_list_managed_instances_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListManagedInstancesInstanceGroupManagersRequest() - assert args[0] == request_msg @@ -20940,7 +20942,6 @@ def test_list_per_instance_configs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListPerInstanceConfigsInstanceGroupManagersRequest() - assert args[0] == request_msg @@ -20960,7 +20961,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -20982,7 +20982,6 @@ def test_patch_per_instance_configs_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchPerInstanceConfigsInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -21004,7 +21003,6 @@ def test_recreate_instances_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.RecreateInstancesInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -21024,7 +21022,6 @@ def test_resize_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ResizeInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -21044,7 +21041,6 @@ def test_resize_advanced_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ResizeAdvancedInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -21064,7 +21060,6 @@ def test_resume_instances_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ResumeInstancesInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -21086,7 +21081,6 @@ def test_set_auto_healing_policies_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetAutoHealingPoliciesInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -21108,7 +21102,6 @@ def test_set_instance_template_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetInstanceTemplateInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -21128,7 +21121,6 @@ def test_set_target_pools_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetTargetPoolsInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -21148,7 +21140,6 @@ def test_start_instances_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.StartInstancesInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -21168,7 +21159,6 @@ def test_stop_instances_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.StopInstancesInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -21190,7 +21180,6 @@ def test_suspend_instances_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SuspendInstancesInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -21212,7 +21201,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -21232,7 +21220,6 @@ def test_update_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.UpdateInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -21254,7 +21241,6 @@ def test_update_per_instance_configs_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.UpdatePerInstanceConfigsInstanceGroupManagerRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_instance_groups.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_instance_groups.py index ac5f5a9f2eee..c395218bc9ac 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_instance_groups.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_instance_groups.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 @@ -108,6 +109,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" @@ -6753,7 +6769,6 @@ def test_add_instances_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AddInstancesInstanceGroupRequest() - assert args[0] == request_msg @@ -6773,7 +6788,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListInstanceGroupsRequest() - assert args[0] == request_msg @@ -6793,7 +6807,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteInstanceGroupRequest() - assert args[0] == request_msg @@ -6813,7 +6826,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetInstanceGroupRequest() - assert args[0] == request_msg @@ -6833,7 +6845,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertInstanceGroupRequest() - assert args[0] == request_msg @@ -6853,7 +6864,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListInstanceGroupsRequest() - assert args[0] == request_msg @@ -6873,7 +6883,6 @@ def test_list_instances_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListInstancesInstanceGroupsRequest() - assert args[0] == request_msg @@ -6893,7 +6902,6 @@ def test_remove_instances_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.RemoveInstancesInstanceGroupRequest() - assert args[0] == request_msg @@ -6913,7 +6921,6 @@ def test_set_named_ports_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetNamedPortsInstanceGroupRequest() - assert args[0] == request_msg @@ -6935,7 +6942,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsInstanceGroupRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_instance_settings_service.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_instance_settings_service.py index e795e7e313c7..302a9d5e401d 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_instance_settings_service.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_instance_settings_service.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 @@ -107,6 +108,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" @@ -2298,7 +2314,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetInstanceSettingRequest() - assert args[0] == request_msg @@ -2318,7 +2333,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchInstanceSettingRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_instance_templates.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_instance_templates.py index b7fe4d5523b3..4866b5f6a9b0 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_instance_templates.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_instance_templates.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 @@ -109,6 +110,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" @@ -5060,7 +5076,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListInstanceTemplatesRequest() - assert args[0] == request_msg @@ -5080,7 +5095,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteInstanceTemplateRequest() - assert args[0] == request_msg @@ -5100,7 +5114,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetInstanceTemplateRequest() - assert args[0] == request_msg @@ -5120,7 +5133,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetIamPolicyInstanceTemplateRequest() - assert args[0] == request_msg @@ -5140,7 +5152,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertInstanceTemplateRequest() - assert args[0] == request_msg @@ -5160,7 +5171,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListInstanceTemplatesRequest() - assert args[0] == request_msg @@ -5180,7 +5190,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetIamPolicyInstanceTemplateRequest() - assert args[0] == request_msg @@ -5202,7 +5211,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsInstanceTemplateRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_instances.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_instances.py index afc29b2c014f..fbdbfbcdd131 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_instances.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_instances.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 @@ -109,6 +110,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" @@ -35353,7 +35369,6 @@ def test_add_access_config_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AddAccessConfigInstanceRequest() - assert args[0] == request_msg @@ -35375,7 +35390,6 @@ def test_add_network_interface_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AddNetworkInterfaceInstanceRequest() - assert args[0] == request_msg @@ -35397,7 +35411,6 @@ def test_add_resource_policies_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AddResourcePoliciesInstanceRequest() - assert args[0] == request_msg @@ -35417,7 +35430,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListInstancesRequest() - assert args[0] == request_msg @@ -35437,7 +35449,6 @@ def test_attach_disk_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AttachDiskInstanceRequest() - assert args[0] == request_msg @@ -35457,7 +35468,6 @@ def test_bulk_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.BulkInsertInstanceRequest() - assert args[0] == request_msg @@ -35477,7 +35487,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteInstanceRequest() - assert args[0] == request_msg @@ -35499,7 +35508,6 @@ def test_delete_access_config_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteAccessConfigInstanceRequest() - assert args[0] == request_msg @@ -35521,7 +35529,6 @@ def test_delete_network_interface_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteNetworkInterfaceInstanceRequest() - assert args[0] == request_msg @@ -35541,7 +35548,6 @@ def test_detach_disk_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DetachDiskInstanceRequest() - assert args[0] == request_msg @@ -35561,7 +35567,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetInstanceRequest() - assert args[0] == request_msg @@ -35583,7 +35588,6 @@ def test_get_effective_firewalls_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetEffectiveFirewallsInstanceRequest() - assert args[0] == request_msg @@ -35605,7 +35609,6 @@ def test_get_guest_attributes_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetGuestAttributesInstanceRequest() - assert args[0] == request_msg @@ -35625,7 +35628,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetIamPolicyInstanceRequest() - assert args[0] == request_msg @@ -35647,7 +35649,6 @@ def test_get_partner_metadata_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetPartnerMetadataInstanceRequest() - assert args[0] == request_msg @@ -35667,7 +35668,6 @@ def test_get_screenshot_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetScreenshotInstanceRequest() - assert args[0] == request_msg @@ -35689,7 +35689,6 @@ def test_get_serial_port_output_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetSerialPortOutputInstanceRequest() - assert args[0] == request_msg @@ -35711,7 +35710,6 @@ def test_get_shielded_instance_identity_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetShieldedInstanceIdentityInstanceRequest() - assert args[0] == request_msg @@ -35733,7 +35731,6 @@ def test_get_shielded_vm_identity_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetShieldedVmIdentityInstanceRequest() - assert args[0] == request_msg @@ -35753,7 +35750,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertInstanceRequest() - assert args[0] == request_msg @@ -35773,7 +35769,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListInstancesRequest() - assert args[0] == request_msg @@ -35793,7 +35788,6 @@ def test_list_referrers_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListReferrersInstancesRequest() - assert args[0] == request_msg @@ -35815,7 +35809,6 @@ def test_patch_partner_metadata_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchPartnerMetadataInstanceRequest() - assert args[0] == request_msg @@ -35837,7 +35830,6 @@ def test_perform_maintenance_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PerformMaintenanceInstanceRequest() - assert args[0] == request_msg @@ -35859,7 +35851,6 @@ def test_remove_resource_policies_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.RemoveResourcePoliciesInstanceRequest() - assert args[0] == request_msg @@ -35881,7 +35872,6 @@ def test_report_host_as_faulty_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ReportHostAsFaultyInstanceRequest() - assert args[0] == request_msg @@ -35901,7 +35891,6 @@ def test_reset_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ResetInstanceRequest() - assert args[0] == request_msg @@ -35921,7 +35910,6 @@ def test_resume_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ResumeInstanceRequest() - assert args[0] == request_msg @@ -35943,7 +35931,6 @@ def test_send_diagnostic_interrupt_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SendDiagnosticInterruptInstanceRequest() - assert args[0] == request_msg @@ -35965,7 +35952,6 @@ def test_set_deletion_protection_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetDeletionProtectionInstanceRequest() - assert args[0] == request_msg @@ -35987,7 +35973,6 @@ def test_set_disk_auto_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetDiskAutoDeleteInstanceRequest() - assert args[0] == request_msg @@ -36007,7 +35992,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetIamPolicyInstanceRequest() - assert args[0] == request_msg @@ -36027,7 +36011,6 @@ def test_set_labels_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetLabelsInstanceRequest() - assert args[0] == request_msg @@ -36049,7 +36032,6 @@ def test_set_machine_resources_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetMachineResourcesInstanceRequest() - assert args[0] == request_msg @@ -36069,7 +36051,6 @@ def test_set_machine_type_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetMachineTypeInstanceRequest() - assert args[0] == request_msg @@ -36089,7 +36070,6 @@ def test_set_metadata_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetMetadataInstanceRequest() - assert args[0] == request_msg @@ -36111,7 +36091,6 @@ def test_set_min_cpu_platform_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetMinCpuPlatformInstanceRequest() - assert args[0] == request_msg @@ -36131,7 +36110,6 @@ def test_set_name_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetNameInstanceRequest() - assert args[0] == request_msg @@ -36151,7 +36129,6 @@ def test_set_scheduling_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetSchedulingInstanceRequest() - assert args[0] == request_msg @@ -36173,7 +36150,6 @@ def test_set_security_policy_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetSecurityPolicyInstanceRequest() - assert args[0] == request_msg @@ -36195,7 +36171,6 @@ def test_set_service_account_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetServiceAccountInstanceRequest() - assert args[0] == request_msg @@ -36217,7 +36192,6 @@ def test_set_shielded_instance_integrity_policy_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetShieldedInstanceIntegrityPolicyInstanceRequest() - assert args[0] == request_msg @@ -36239,7 +36213,6 @@ def test_set_shielded_vm_integrity_policy_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetShieldedVmIntegrityPolicyInstanceRequest() - assert args[0] == request_msg @@ -36259,7 +36232,6 @@ def test_set_tags_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetTagsInstanceRequest() - assert args[0] == request_msg @@ -36281,7 +36253,6 @@ def test_simulate_maintenance_event_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SimulateMaintenanceEventInstanceRequest() - assert args[0] == request_msg @@ -36301,7 +36272,6 @@ def test_start_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.StartInstanceRequest() - assert args[0] == request_msg @@ -36323,7 +36293,6 @@ def test_start_with_encryption_key_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.StartWithEncryptionKeyInstanceRequest() - assert args[0] == request_msg @@ -36343,7 +36312,6 @@ def test_stop_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.StopInstanceRequest() - assert args[0] == request_msg @@ -36363,7 +36331,6 @@ def test_suspend_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SuspendInstanceRequest() - assert args[0] == request_msg @@ -36385,7 +36352,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsInstanceRequest() - assert args[0] == request_msg @@ -36405,7 +36371,6 @@ def test_update_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.UpdateInstanceRequest() - assert args[0] == request_msg @@ -36427,7 +36392,6 @@ def test_update_access_config_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.UpdateAccessConfigInstanceRequest() - assert args[0] == request_msg @@ -36449,7 +36413,6 @@ def test_update_display_device_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.UpdateDisplayDeviceInstanceRequest() - assert args[0] == request_msg @@ -36471,7 +36434,6 @@ def test_update_network_interface_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.UpdateNetworkInterfaceInstanceRequest() - assert args[0] == request_msg @@ -36493,7 +36455,6 @@ def test_update_shielded_instance_config_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.UpdateShieldedInstanceConfigInstanceRequest() - assert args[0] == request_msg @@ -36515,7 +36476,6 @@ def test_update_shielded_vm_config_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.UpdateShieldedVmConfigInstanceRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_instant_snapshot_groups.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_instant_snapshot_groups.py index fd0e1bf4b2cc..a166cb608d20 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_instant_snapshot_groups.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_instant_snapshot_groups.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 @@ -108,6 +109,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" @@ -4588,7 +4604,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteInstantSnapshotGroupRequest() - assert args[0] == request_msg @@ -4608,7 +4623,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetInstantSnapshotGroupRequest() - assert args[0] == request_msg @@ -4628,7 +4642,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetIamPolicyInstantSnapshotGroupRequest() - assert args[0] == request_msg @@ -4648,7 +4661,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertInstantSnapshotGroupRequest() - assert args[0] == request_msg @@ -4668,7 +4680,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListInstantSnapshotGroupsRequest() - assert args[0] == request_msg @@ -4688,7 +4699,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetIamPolicyInstantSnapshotGroupRequest() - assert args[0] == request_msg @@ -4710,7 +4720,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsInstantSnapshotGroupRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_instant_snapshots.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_instant_snapshots.py index de23afb00c47..1c02af7b2ec6 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_instant_snapshots.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_instant_snapshots.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 @@ -108,6 +109,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" @@ -5656,7 +5672,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListInstantSnapshotsRequest() - assert args[0] == request_msg @@ -5676,7 +5691,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteInstantSnapshotRequest() - assert args[0] == request_msg @@ -5696,7 +5710,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetInstantSnapshotRequest() - assert args[0] == request_msg @@ -5716,7 +5729,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetIamPolicyInstantSnapshotRequest() - assert args[0] == request_msg @@ -5736,7 +5748,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertInstantSnapshotRequest() - assert args[0] == request_msg @@ -5756,7 +5767,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListInstantSnapshotsRequest() - assert args[0] == request_msg @@ -5776,7 +5786,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetIamPolicyInstantSnapshotRequest() - assert args[0] == request_msg @@ -5796,7 +5805,6 @@ def test_set_labels_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetLabelsInstantSnapshotRequest() - assert args[0] == request_msg @@ -5818,7 +5826,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsInstantSnapshotRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_interconnect_attachment_groups.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_interconnect_attachment_groups.py index 6a0a231b8375..cd2cb840383c 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_interconnect_attachment_groups.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_interconnect_attachment_groups.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 @@ -108,6 +109,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" @@ -5734,7 +5750,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteInterconnectAttachmentGroupRequest() - assert args[0] == request_msg @@ -5754,7 +5769,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetInterconnectAttachmentGroupRequest() - assert args[0] == request_msg @@ -5774,7 +5788,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetIamPolicyInterconnectAttachmentGroupRequest() - assert args[0] == request_msg @@ -5796,7 +5809,6 @@ def test_get_operational_status_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetOperationalStatusInterconnectAttachmentGroupRequest() - assert args[0] == request_msg @@ -5816,7 +5828,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertInterconnectAttachmentGroupRequest() - assert args[0] == request_msg @@ -5836,7 +5847,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListInterconnectAttachmentGroupsRequest() - assert args[0] == request_msg @@ -5856,7 +5866,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchInterconnectAttachmentGroupRequest() - assert args[0] == request_msg @@ -5876,7 +5885,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetIamPolicyInterconnectAttachmentGroupRequest() - assert args[0] == request_msg @@ -5898,7 +5906,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsInterconnectAttachmentGroupRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_interconnect_attachments.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_interconnect_attachments.py index bf074e881414..3cf5f1caf653 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_interconnect_attachments.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_interconnect_attachments.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 @@ -108,6 +109,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" @@ -5796,7 +5812,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListInterconnectAttachmentsRequest() - assert args[0] == request_msg @@ -5816,7 +5831,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteInterconnectAttachmentRequest() - assert args[0] == request_msg @@ -5836,7 +5850,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetInterconnectAttachmentRequest() - assert args[0] == request_msg @@ -5856,7 +5869,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertInterconnectAttachmentRequest() - assert args[0] == request_msg @@ -5876,7 +5888,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListInterconnectAttachmentsRequest() - assert args[0] == request_msg @@ -5896,7 +5907,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchInterconnectAttachmentRequest() - assert args[0] == request_msg @@ -5916,7 +5926,6 @@ def test_set_labels_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetLabelsInterconnectAttachmentRequest() - assert args[0] == request_msg @@ -5938,7 +5947,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsInterconnectAttachmentRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_interconnect_groups.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_interconnect_groups.py index 89d141dd3402..a12a8d9f2805 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_interconnect_groups.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_interconnect_groups.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 @@ -108,6 +109,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" @@ -6289,7 +6305,6 @@ def test_create_members_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.CreateMembersInterconnectGroupRequest() - assert args[0] == request_msg @@ -6309,7 +6324,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteInterconnectGroupRequest() - assert args[0] == request_msg @@ -6329,7 +6343,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetInterconnectGroupRequest() - assert args[0] == request_msg @@ -6349,7 +6362,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetIamPolicyInterconnectGroupRequest() - assert args[0] == request_msg @@ -6371,7 +6383,6 @@ def test_get_operational_status_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetOperationalStatusInterconnectGroupRequest() - assert args[0] == request_msg @@ -6391,7 +6402,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertInterconnectGroupRequest() - assert args[0] == request_msg @@ -6411,7 +6421,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListInterconnectGroupsRequest() - assert args[0] == request_msg @@ -6431,7 +6440,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchInterconnectGroupRequest() - assert args[0] == request_msg @@ -6451,7 +6459,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetIamPolicyInterconnectGroupRequest() - assert args[0] == request_msg @@ -6473,7 +6480,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsInterconnectGroupRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_interconnect_locations.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_interconnect_locations.py index 0ad1f54b3b21..e95b7a015f22 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_interconnect_locations.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_interconnect_locations.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 @@ -106,6 +107,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" @@ -2047,7 +2063,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetInterconnectLocationRequest() - assert args[0] == request_msg @@ -2067,7 +2082,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListInterconnectLocationsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_interconnect_remote_locations.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_interconnect_remote_locations.py index 5958094e0e36..7bac86230b3a 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_interconnect_remote_locations.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_interconnect_remote_locations.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 @@ -106,6 +107,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" @@ -2103,7 +2119,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetInterconnectRemoteLocationRequest() - assert args[0] == request_msg @@ -2123,7 +2138,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListInterconnectRemoteLocationsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_interconnects.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_interconnects.py index 20945713e0f2..a5cb974939da 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_interconnects.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_interconnects.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 @@ -108,6 +109,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" @@ -5724,7 +5740,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteInterconnectRequest() - assert args[0] == request_msg @@ -5744,7 +5759,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetInterconnectRequest() - assert args[0] == request_msg @@ -5764,7 +5778,6 @@ def test_get_diagnostics_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetDiagnosticsInterconnectRequest() - assert args[0] == request_msg @@ -5786,7 +5799,6 @@ def test_get_macsec_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetMacsecConfigInterconnectRequest() - assert args[0] == request_msg @@ -5806,7 +5818,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertInterconnectRequest() - assert args[0] == request_msg @@ -5826,7 +5837,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListInterconnectsRequest() - assert args[0] == request_msg @@ -5846,7 +5856,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchInterconnectRequest() - assert args[0] == request_msg @@ -5866,7 +5875,6 @@ def test_set_labels_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetLabelsInterconnectRequest() - assert args[0] == request_msg @@ -5888,7 +5896,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsInterconnectRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_license_codes.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_license_codes.py index 6a2082b21a70..67ec86368d57 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_license_codes.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_license_codes.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 @@ -105,6 +106,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" @@ -2770,7 +2786,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetLicenseCodeRequest() - assert args[0] == request_msg @@ -2790,7 +2805,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetIamPolicyLicenseCodeRequest() - assert args[0] == request_msg @@ -2810,7 +2824,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetIamPolicyLicenseCodeRequest() - assert args[0] == request_msg @@ -2832,7 +2845,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsLicenseCodeRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_licenses.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_licenses.py index 2af4fba822dc..ec14f2e2bb28 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_licenses.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_licenses.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 @@ -108,6 +109,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" @@ -5101,7 +5117,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteLicenseRequest() - assert args[0] == request_msg @@ -5121,7 +5136,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetLicenseRequest() - assert args[0] == request_msg @@ -5141,7 +5155,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetIamPolicyLicenseRequest() - assert args[0] == request_msg @@ -5161,7 +5174,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertLicenseRequest() - assert args[0] == request_msg @@ -5181,7 +5193,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListLicensesRequest() - assert args[0] == request_msg @@ -5201,7 +5212,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetIamPolicyLicenseRequest() - assert args[0] == request_msg @@ -5223,7 +5233,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsLicenseRequest() - assert args[0] == request_msg @@ -5243,7 +5252,6 @@ def test_update_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.UpdateLicenseRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_machine_images.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_machine_images.py index be181a757069..7841f5641454 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_machine_images.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_machine_images.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 @@ -109,6 +110,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" @@ -5314,7 +5330,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteMachineImageRequest() - assert args[0] == request_msg @@ -5334,7 +5349,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetMachineImageRequest() - assert args[0] == request_msg @@ -5354,7 +5368,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetIamPolicyMachineImageRequest() - assert args[0] == request_msg @@ -5374,7 +5387,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertMachineImageRequest() - assert args[0] == request_msg @@ -5394,7 +5406,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListMachineImagesRequest() - assert args[0] == request_msg @@ -5414,7 +5425,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetIamPolicyMachineImageRequest() - assert args[0] == request_msg @@ -5434,7 +5444,6 @@ def test_set_labels_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetLabelsMachineImageRequest() - assert args[0] == request_msg @@ -5456,7 +5465,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsMachineImageRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_machine_types.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_machine_types.py index 93c85bc5c794..7487efd6622f 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_machine_types.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_machine_types.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 @@ -106,6 +107,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" @@ -2394,7 +2410,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListMachineTypesRequest() - assert args[0] == request_msg @@ -2414,7 +2429,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetMachineTypeRequest() - assert args[0] == request_msg @@ -2434,7 +2448,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListMachineTypesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_network_attachments.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_network_attachments.py index 0657a1b515d7..081c5ac74def 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_network_attachments.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_network_attachments.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 @@ -108,6 +109,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" @@ -5737,7 +5753,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListNetworkAttachmentsRequest() - assert args[0] == request_msg @@ -5757,7 +5772,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteNetworkAttachmentRequest() - assert args[0] == request_msg @@ -5777,7 +5791,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetNetworkAttachmentRequest() - assert args[0] == request_msg @@ -5797,7 +5810,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetIamPolicyNetworkAttachmentRequest() - assert args[0] == request_msg @@ -5817,7 +5829,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertNetworkAttachmentRequest() - assert args[0] == request_msg @@ -5837,7 +5848,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListNetworkAttachmentsRequest() - assert args[0] == request_msg @@ -5857,7 +5867,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchNetworkAttachmentRequest() - assert args[0] == request_msg @@ -5877,7 +5886,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetIamPolicyNetworkAttachmentRequest() - assert args[0] == request_msg @@ -5899,7 +5907,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsNetworkAttachmentRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_network_edge_security_services.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_network_edge_security_services.py index 602b35dd9fd8..f2de45fa0242 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_network_edge_security_services.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_network_edge_security_services.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 @@ -108,6 +109,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" @@ -4170,7 +4186,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListNetworkEdgeSecurityServicesRequest() - assert args[0] == request_msg @@ -4190,7 +4205,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteNetworkEdgeSecurityServiceRequest() - assert args[0] == request_msg @@ -4210,7 +4224,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetNetworkEdgeSecurityServiceRequest() - assert args[0] == request_msg @@ -4230,7 +4243,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertNetworkEdgeSecurityServiceRequest() - assert args[0] == request_msg @@ -4250,7 +4262,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchNetworkEdgeSecurityServiceRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_network_endpoint_groups.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_network_endpoint_groups.py index 4c996be429c4..03c020bb96c2 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_network_endpoint_groups.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_network_endpoint_groups.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 @@ -108,6 +109,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" @@ -6257,7 +6273,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListNetworkEndpointGroupsRequest() - assert args[0] == request_msg @@ -6279,7 +6294,6 @@ def test_attach_network_endpoints_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AttachNetworkEndpointsNetworkEndpointGroupRequest() - assert args[0] == request_msg @@ -6299,7 +6313,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteNetworkEndpointGroupRequest() - assert args[0] == request_msg @@ -6321,7 +6334,6 @@ def test_detach_network_endpoints_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DetachNetworkEndpointsNetworkEndpointGroupRequest() - assert args[0] == request_msg @@ -6341,7 +6353,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetNetworkEndpointGroupRequest() - assert args[0] == request_msg @@ -6361,7 +6372,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertNetworkEndpointGroupRequest() - assert args[0] == request_msg @@ -6381,7 +6391,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListNetworkEndpointGroupsRequest() - assert args[0] == request_msg @@ -6403,7 +6412,6 @@ def test_list_network_endpoints_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListNetworkEndpointsNetworkEndpointGroupsRequest() - assert args[0] == request_msg @@ -6425,7 +6433,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsNetworkEndpointGroupRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_network_firewall_policies.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_network_firewall_policies.py index d174c488a543..5ab74aaa9578 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_network_firewall_policies.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_network_firewall_policies.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 @@ -108,6 +109,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" @@ -12893,7 +12909,6 @@ def test_add_association_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AddAssociationNetworkFirewallPolicyRequest() - assert args[0] == request_msg @@ -12915,7 +12930,6 @@ def test_add_packet_mirroring_rule_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AddPacketMirroringRuleNetworkFirewallPolicyRequest() - assert args[0] == request_msg @@ -12935,7 +12949,6 @@ def test_add_rule_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AddRuleNetworkFirewallPolicyRequest() - assert args[0] == request_msg @@ -12955,7 +12968,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListNetworkFirewallPoliciesRequest() - assert args[0] == request_msg @@ -12975,7 +12987,6 @@ def test_clone_rules_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.CloneRulesNetworkFirewallPolicyRequest() - assert args[0] == request_msg @@ -12995,7 +13006,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteNetworkFirewallPolicyRequest() - assert args[0] == request_msg @@ -13015,7 +13025,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetNetworkFirewallPolicyRequest() - assert args[0] == request_msg @@ -13035,7 +13044,6 @@ def test_get_association_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetAssociationNetworkFirewallPolicyRequest() - assert args[0] == request_msg @@ -13055,7 +13063,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetIamPolicyNetworkFirewallPolicyRequest() - assert args[0] == request_msg @@ -13077,7 +13084,6 @@ def test_get_packet_mirroring_rule_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetPacketMirroringRuleNetworkFirewallPolicyRequest() - assert args[0] == request_msg @@ -13097,7 +13103,6 @@ def test_get_rule_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRuleNetworkFirewallPolicyRequest() - assert args[0] == request_msg @@ -13117,7 +13122,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertNetworkFirewallPolicyRequest() - assert args[0] == request_msg @@ -13137,7 +13141,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListNetworkFirewallPoliciesRequest() - assert args[0] == request_msg @@ -13157,7 +13160,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchNetworkFirewallPolicyRequest() - assert args[0] == request_msg @@ -13179,7 +13181,6 @@ def test_patch_packet_mirroring_rule_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchPacketMirroringRuleNetworkFirewallPolicyRequest() - assert args[0] == request_msg @@ -13199,7 +13200,6 @@ def test_patch_rule_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchRuleNetworkFirewallPolicyRequest() - assert args[0] == request_msg @@ -13221,7 +13221,6 @@ def test_remove_association_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.RemoveAssociationNetworkFirewallPolicyRequest() - assert args[0] == request_msg @@ -13243,7 +13242,6 @@ def test_remove_packet_mirroring_rule_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.RemovePacketMirroringRuleNetworkFirewallPolicyRequest() - assert args[0] == request_msg @@ -13263,7 +13261,6 @@ def test_remove_rule_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.RemoveRuleNetworkFirewallPolicyRequest() - assert args[0] == request_msg @@ -13283,7 +13280,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetIamPolicyNetworkFirewallPolicyRequest() - assert args[0] == request_msg @@ -13305,7 +13301,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsNetworkFirewallPolicyRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_network_profiles.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_network_profiles.py index 8c8c56353f6c..212b28ab1afb 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_network_profiles.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_network_profiles.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 @@ -106,6 +107,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" @@ -1992,7 +2008,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetNetworkProfileRequest() - assert args[0] == request_msg @@ -2012,7 +2027,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListNetworkProfilesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_networks.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_networks.py index 90702bfbdd8d..643e4cafcf5a 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_networks.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_networks.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 @@ -108,6 +109,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" @@ -9005,7 +9021,6 @@ def test_add_peering_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AddPeeringNetworkRequest() - assert args[0] == request_msg @@ -9027,7 +9042,6 @@ def test_cancel_request_remove_peering_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.CancelRequestRemovePeeringNetworkRequest() - assert args[0] == request_msg @@ -9047,7 +9061,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteNetworkRequest() - assert args[0] == request_msg @@ -9067,7 +9080,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetNetworkRequest() - assert args[0] == request_msg @@ -9089,7 +9101,6 @@ def test_get_effective_firewalls_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetEffectiveFirewallsNetworkRequest() - assert args[0] == request_msg @@ -9109,7 +9120,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertNetworkRequest() - assert args[0] == request_msg @@ -9129,7 +9139,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListNetworksRequest() - assert args[0] == request_msg @@ -9151,7 +9160,6 @@ def test_list_peering_routes_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListPeeringRoutesNetworksRequest() - assert args[0] == request_msg @@ -9171,7 +9179,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchNetworkRequest() - assert args[0] == request_msg @@ -9191,7 +9198,6 @@ def test_remove_peering_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.RemovePeeringNetworkRequest() - assert args[0] == request_msg @@ -9213,7 +9219,6 @@ def test_request_remove_peering_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.RequestRemovePeeringNetworkRequest() - assert args[0] == request_msg @@ -9235,7 +9240,6 @@ def test_switch_to_custom_mode_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SwitchToCustomModeNetworkRequest() - assert args[0] == request_msg @@ -9257,7 +9261,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsNetworkRequest() - assert args[0] == request_msg @@ -9277,7 +9280,6 @@ def test_update_peering_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.UpdatePeeringNetworkRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_node_groups.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_node_groups.py index 04125db0adb6..c23e466cc0f3 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_node_groups.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_node_groups.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 @@ -108,6 +109,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" @@ -9486,7 +9502,6 @@ def test_add_nodes_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AddNodesNodeGroupRequest() - assert args[0] == request_msg @@ -9506,7 +9521,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListNodeGroupsRequest() - assert args[0] == request_msg @@ -9526,7 +9540,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteNodeGroupRequest() - assert args[0] == request_msg @@ -9546,7 +9559,6 @@ def test_delete_nodes_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteNodesNodeGroupRequest() - assert args[0] == request_msg @@ -9566,7 +9578,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetNodeGroupRequest() - assert args[0] == request_msg @@ -9586,7 +9597,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetIamPolicyNodeGroupRequest() - assert args[0] == request_msg @@ -9606,7 +9616,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertNodeGroupRequest() - assert args[0] == request_msg @@ -9626,7 +9635,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListNodeGroupsRequest() - assert args[0] == request_msg @@ -9646,7 +9654,6 @@ def test_list_nodes_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListNodesNodeGroupsRequest() - assert args[0] == request_msg @@ -9666,7 +9673,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchNodeGroupRequest() - assert args[0] == request_msg @@ -9688,7 +9694,6 @@ def test_perform_maintenance_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PerformMaintenanceNodeGroupRequest() - assert args[0] == request_msg @@ -9708,7 +9713,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetIamPolicyNodeGroupRequest() - assert args[0] == request_msg @@ -9730,7 +9734,6 @@ def test_set_node_template_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetNodeTemplateNodeGroupRequest() - assert args[0] == request_msg @@ -9752,7 +9755,6 @@ def test_simulate_maintenance_event_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SimulateMaintenanceEventNodeGroupRequest() - assert args[0] == request_msg @@ -9774,7 +9776,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsNodeGroupRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_node_templates.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_node_templates.py index 1e1e10d82ff6..57a66957e77a 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_node_templates.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_node_templates.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 @@ -108,6 +109,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" @@ -4905,7 +4921,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListNodeTemplatesRequest() - assert args[0] == request_msg @@ -4925,7 +4940,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteNodeTemplateRequest() - assert args[0] == request_msg @@ -4945,7 +4959,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetNodeTemplateRequest() - assert args[0] == request_msg @@ -4965,7 +4978,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetIamPolicyNodeTemplateRequest() - assert args[0] == request_msg @@ -4985,7 +4997,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertNodeTemplateRequest() - assert args[0] == request_msg @@ -5005,7 +5016,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListNodeTemplatesRequest() - assert args[0] == request_msg @@ -5025,7 +5035,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetIamPolicyNodeTemplateRequest() - assert args[0] == request_msg @@ -5047,7 +5056,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsNodeTemplateRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_node_types.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_node_types.py index 781ca798d19e..ca4bb7a68e8e 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_node_types.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_node_types.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 @@ -106,6 +107,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" @@ -2368,7 +2384,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListNodeTypesRequest() - assert args[0] == request_msg @@ -2388,7 +2403,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetNodeTypeRequest() - assert args[0] == request_msg @@ -2408,7 +2422,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListNodeTypesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_organization_security_policies.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_organization_security_policies.py index 1dc04c670136..033507393fbb 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_organization_security_policies.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_organization_security_policies.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 @@ -108,6 +109,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" @@ -9727,7 +9743,6 @@ def test_add_association_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AddAssociationOrganizationSecurityPolicyRequest() - assert args[0] == request_msg @@ -9747,7 +9762,6 @@ def test_add_rule_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AddRuleOrganizationSecurityPolicyRequest() - assert args[0] == request_msg @@ -9767,7 +9781,6 @@ def test_copy_rules_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.CopyRulesOrganizationSecurityPolicyRequest() - assert args[0] == request_msg @@ -9787,7 +9800,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteOrganizationSecurityPolicyRequest() - assert args[0] == request_msg @@ -9807,7 +9819,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetOrganizationSecurityPolicyRequest() - assert args[0] == request_msg @@ -9827,7 +9838,6 @@ def test_get_association_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetAssociationOrganizationSecurityPolicyRequest() - assert args[0] == request_msg @@ -9847,7 +9857,6 @@ def test_get_rule_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRuleOrganizationSecurityPolicyRequest() - assert args[0] == request_msg @@ -9867,7 +9876,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertOrganizationSecurityPolicyRequest() - assert args[0] == request_msg @@ -9887,7 +9895,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListOrganizationSecurityPoliciesRequest() - assert args[0] == request_msg @@ -9909,7 +9916,6 @@ def test_list_associations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListAssociationsOrganizationSecurityPolicyRequest() - assert args[0] == request_msg @@ -9933,7 +9939,6 @@ def test_list_preconfigured_expression_sets_empty_call_rest(): request_msg = ( compute.ListPreconfiguredExpressionSetsOrganizationSecurityPoliciesRequest() ) - assert args[0] == request_msg @@ -9953,7 +9958,6 @@ def test_move_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.MoveOrganizationSecurityPolicyRequest() - assert args[0] == request_msg @@ -9973,7 +9977,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchOrganizationSecurityPolicyRequest() - assert args[0] == request_msg @@ -9993,7 +9996,6 @@ def test_patch_rule_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchRuleOrganizationSecurityPolicyRequest() - assert args[0] == request_msg @@ -10015,7 +10017,6 @@ def test_remove_association_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.RemoveAssociationOrganizationSecurityPolicyRequest() - assert args[0] == request_msg @@ -10035,7 +10036,6 @@ def test_remove_rule_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.RemoveRuleOrganizationSecurityPolicyRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_packet_mirrorings.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_packet_mirrorings.py index 1f13fdd7a171..4e2a0e133358 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_packet_mirrorings.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_packet_mirrorings.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 @@ -108,6 +109,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" @@ -4869,7 +4885,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListPacketMirroringsRequest() - assert args[0] == request_msg @@ -4889,7 +4904,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeletePacketMirroringRequest() - assert args[0] == request_msg @@ -4909,7 +4923,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetPacketMirroringRequest() - assert args[0] == request_msg @@ -4929,7 +4942,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertPacketMirroringRequest() - assert args[0] == request_msg @@ -4949,7 +4961,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListPacketMirroringsRequest() - assert args[0] == request_msg @@ -4969,7 +4980,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchPacketMirroringRequest() - assert args[0] == request_msg @@ -4991,7 +5001,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsPacketMirroringRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_preview_features.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_preview_features.py index 4a7c83f69633..f0e3ebba5661 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_preview_features.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_preview_features.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 @@ -108,6 +109,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" @@ -2658,7 +2674,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetPreviewFeatureRequest() - assert args[0] == request_msg @@ -2678,7 +2693,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListPreviewFeaturesRequest() - assert args[0] == request_msg @@ -2698,7 +2712,6 @@ def test_update_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.UpdatePreviewFeatureRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_projects.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_projects.py index 9c2405cb5838..78c9da19cbd8 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_projects.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_projects.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 @@ -108,6 +109,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" @@ -9720,7 +9736,6 @@ def test_disable_xpn_host_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DisableXpnHostProjectRequest() - assert args[0] == request_msg @@ -9742,7 +9757,6 @@ def test_disable_xpn_resource_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DisableXpnResourceProjectRequest() - assert args[0] == request_msg @@ -9762,7 +9776,6 @@ def test_enable_xpn_host_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.EnableXpnHostProjectRequest() - assert args[0] == request_msg @@ -9784,7 +9797,6 @@ def test_enable_xpn_resource_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.EnableXpnResourceProjectRequest() - assert args[0] == request_msg @@ -9804,7 +9816,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetProjectRequest() - assert args[0] == request_msg @@ -9824,7 +9835,6 @@ def test_get_xpn_host_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetXpnHostProjectRequest() - assert args[0] == request_msg @@ -9846,7 +9856,6 @@ def test_get_xpn_resources_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetXpnResourcesProjectsRequest() - assert args[0] == request_msg @@ -9866,7 +9875,6 @@ def test_list_xpn_hosts_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListXpnHostsProjectsRequest() - assert args[0] == request_msg @@ -9886,7 +9894,6 @@ def test_move_disk_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.MoveDiskProjectRequest() - assert args[0] == request_msg @@ -9906,7 +9913,6 @@ def test_move_instance_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.MoveInstanceProjectRequest() - assert args[0] == request_msg @@ -9928,7 +9934,6 @@ def test_set_cloud_armor_tier_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetCloudArmorTierProjectRequest() - assert args[0] == request_msg @@ -9950,7 +9955,6 @@ def test_set_common_instance_metadata_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetCommonInstanceMetadataProjectRequest() - assert args[0] == request_msg @@ -9972,7 +9976,6 @@ def test_set_default_network_tier_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetDefaultNetworkTierProjectRequest() - assert args[0] == request_msg @@ -9994,7 +9997,6 @@ def test_set_managed_protection_tier_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetManagedProtectionTierProjectRequest() - assert args[0] == request_msg @@ -10016,7 +10018,6 @@ def test_set_usage_export_bucket_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetUsageExportBucketProjectRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_public_advertised_prefixes.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_public_advertised_prefixes.py index 855609267715..60322e34a279 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_public_advertised_prefixes.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_public_advertised_prefixes.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 @@ -108,6 +109,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" @@ -5131,7 +5147,6 @@ def test_announce_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AnnouncePublicAdvertisedPrefixeRequest() - assert args[0] == request_msg @@ -5151,7 +5166,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeletePublicAdvertisedPrefixeRequest() - assert args[0] == request_msg @@ -5171,7 +5185,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetPublicAdvertisedPrefixeRequest() - assert args[0] == request_msg @@ -5191,7 +5204,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertPublicAdvertisedPrefixeRequest() - assert args[0] == request_msg @@ -5211,7 +5223,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListPublicAdvertisedPrefixesRequest() - assert args[0] == request_msg @@ -5231,7 +5242,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchPublicAdvertisedPrefixeRequest() - assert args[0] == request_msg @@ -5251,7 +5261,6 @@ def test_withdraw_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.WithdrawPublicAdvertisedPrefixeRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_public_delegated_prefixes.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_public_delegated_prefixes.py index ad15e3f8cac6..a5d7cfef9710 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_public_delegated_prefixes.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_public_delegated_prefixes.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 @@ -108,6 +109,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" @@ -5720,7 +5736,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListPublicDelegatedPrefixesRequest() - assert args[0] == request_msg @@ -5740,7 +5755,6 @@ def test_announce_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AnnouncePublicDelegatedPrefixeRequest() - assert args[0] == request_msg @@ -5760,7 +5774,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeletePublicDelegatedPrefixeRequest() - assert args[0] == request_msg @@ -5780,7 +5793,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetPublicDelegatedPrefixeRequest() - assert args[0] == request_msg @@ -5800,7 +5812,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertPublicDelegatedPrefixeRequest() - assert args[0] == request_msg @@ -5820,7 +5831,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListPublicDelegatedPrefixesRequest() - assert args[0] == request_msg @@ -5840,7 +5850,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchPublicDelegatedPrefixeRequest() - assert args[0] == request_msg @@ -5860,7 +5869,6 @@ def test_withdraw_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.WithdrawPublicDelegatedPrefixeRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_autoscalers.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_autoscalers.py index 79b88523ad8a..d69e31197964 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_autoscalers.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_autoscalers.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 @@ -108,6 +109,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" @@ -5172,7 +5188,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteRegionAutoscalerRequest() - assert args[0] == request_msg @@ -5192,7 +5207,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRegionAutoscalerRequest() - assert args[0] == request_msg @@ -5212,7 +5226,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertRegionAutoscalerRequest() - assert args[0] == request_msg @@ -5232,7 +5245,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRegionAutoscalersRequest() - assert args[0] == request_msg @@ -5252,7 +5264,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchRegionAutoscalerRequest() - assert args[0] == request_msg @@ -5274,7 +5285,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsRegionAutoscalerRequest() - assert args[0] == request_msg @@ -5294,7 +5304,6 @@ def test_update_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.UpdateRegionAutoscalerRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_backend_buckets.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_backend_buckets.py index 0c380cd7305d..5182d5256c97 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_backend_buckets.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_backend_buckets.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 @@ -108,6 +109,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" @@ -5739,7 +5755,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteRegionBackendBucketRequest() - assert args[0] == request_msg @@ -5759,7 +5774,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRegionBackendBucketRequest() - assert args[0] == request_msg @@ -5779,7 +5793,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetIamPolicyRegionBackendBucketRequest() - assert args[0] == request_msg @@ -5799,7 +5812,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertRegionBackendBucketRequest() - assert args[0] == request_msg @@ -5819,7 +5831,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRegionBackendBucketsRequest() - assert args[0] == request_msg @@ -5839,7 +5850,6 @@ def test_list_usable_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListUsableRegionBackendBucketsRequest() - assert args[0] == request_msg @@ -5859,7 +5869,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchRegionBackendBucketRequest() - assert args[0] == request_msg @@ -5879,7 +5888,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetIamPolicyRegionBackendBucketRequest() - assert args[0] == request_msg @@ -5901,7 +5909,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsRegionBackendBucketRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_backend_services.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_backend_services.py index 6606e53f50bb..281e3ba07707 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_backend_services.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_backend_services.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 @@ -108,6 +109,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" @@ -8107,7 +8123,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteRegionBackendServiceRequest() - assert args[0] == request_msg @@ -8127,7 +8142,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRegionBackendServiceRequest() - assert args[0] == request_msg @@ -8147,7 +8161,6 @@ def test_get_health_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetHealthRegionBackendServiceRequest() - assert args[0] == request_msg @@ -8167,7 +8180,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetIamPolicyRegionBackendServiceRequest() - assert args[0] == request_msg @@ -8187,7 +8199,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertRegionBackendServiceRequest() - assert args[0] == request_msg @@ -8207,7 +8218,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRegionBackendServicesRequest() - assert args[0] == request_msg @@ -8227,7 +8237,6 @@ def test_list_usable_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListUsableRegionBackendServicesRequest() - assert args[0] == request_msg @@ -8247,7 +8256,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchRegionBackendServiceRequest() - assert args[0] == request_msg @@ -8267,7 +8275,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetIamPolicyRegionBackendServiceRequest() - assert args[0] == request_msg @@ -8289,7 +8296,6 @@ def test_set_security_policy_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetSecurityPolicyRegionBackendServiceRequest() - assert args[0] == request_msg @@ -8311,7 +8317,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsRegionBackendServiceRequest() - assert args[0] == request_msg @@ -8331,7 +8336,6 @@ def test_update_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.UpdateRegionBackendServiceRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_commitments.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_commitments.py index 84fd3a303a72..0144e5b3f62d 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_commitments.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_commitments.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 @@ -108,6 +109,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" @@ -5368,7 +5384,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListRegionCommitmentsRequest() - assert args[0] == request_msg @@ -5388,7 +5403,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRegionCommitmentRequest() - assert args[0] == request_msg @@ -5408,7 +5422,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertRegionCommitmentRequest() - assert args[0] == request_msg @@ -5428,7 +5441,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRegionCommitmentsRequest() - assert args[0] == request_msg @@ -5450,7 +5462,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsRegionCommitmentRequest() - assert args[0] == request_msg @@ -5470,7 +5481,6 @@ def test_update_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.UpdateRegionCommitmentRequest() - assert args[0] == request_msg @@ -5492,7 +5502,6 @@ def test_update_reservations_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.UpdateReservationsRegionCommitmentRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_composite_health_checks.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_composite_health_checks.py index 839223640347..70040505c722 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_composite_health_checks.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_composite_health_checks.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 @@ -108,6 +109,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" @@ -5280,7 +5296,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListRegionCompositeHealthChecksRequest() - assert args[0] == request_msg @@ -5300,7 +5315,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteRegionCompositeHealthCheckRequest() - assert args[0] == request_msg @@ -5320,7 +5334,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRegionCompositeHealthCheckRequest() - assert args[0] == request_msg @@ -5340,7 +5353,6 @@ def test_get_health_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetHealthRegionCompositeHealthCheckRequest() - assert args[0] == request_msg @@ -5360,7 +5372,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertRegionCompositeHealthCheckRequest() - assert args[0] == request_msg @@ -5380,7 +5391,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRegionCompositeHealthChecksRequest() - assert args[0] == request_msg @@ -5400,7 +5410,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchRegionCompositeHealthCheckRequest() - assert args[0] == request_msg @@ -5422,7 +5431,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsRegionCompositeHealthCheckRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_disk_settings.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_disk_settings.py index 2c208932b5ae..3a70f59f022a 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_disk_settings.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_disk_settings.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 @@ -107,6 +108,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" @@ -2293,7 +2309,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRegionDiskSettingRequest() - assert args[0] == request_msg @@ -2313,7 +2328,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchRegionDiskSettingRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_disk_types.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_disk_types.py index 08b97f3465fd..09906297d1af 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_disk_types.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_disk_types.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 @@ -106,6 +107,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" @@ -2007,7 +2023,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRegionDiskTypeRequest() - assert args[0] == request_msg @@ -2027,7 +2042,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRegionDiskTypesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_disks.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_disks.py index 3a35a422cc5c..b53d4bac735f 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_disks.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_disks.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 @@ -108,6 +109,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" @@ -12091,7 +12107,6 @@ def test_add_resource_policies_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AddResourcePoliciesRegionDiskRequest() - assert args[0] == request_msg @@ -12111,7 +12126,6 @@ def test_bulk_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.BulkInsertRegionDiskRequest() - assert args[0] == request_msg @@ -12131,7 +12145,6 @@ def test_create_snapshot_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.CreateSnapshotRegionDiskRequest() - assert args[0] == request_msg @@ -12151,7 +12164,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteRegionDiskRequest() - assert args[0] == request_msg @@ -12171,7 +12183,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRegionDiskRequest() - assert args[0] == request_msg @@ -12191,7 +12202,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetIamPolicyRegionDiskRequest() - assert args[0] == request_msg @@ -12211,7 +12221,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertRegionDiskRequest() - assert args[0] == request_msg @@ -12231,7 +12240,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRegionDisksRequest() - assert args[0] == request_msg @@ -12253,7 +12261,6 @@ def test_remove_resource_policies_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.RemoveResourcePoliciesRegionDiskRequest() - assert args[0] == request_msg @@ -12273,7 +12280,6 @@ def test_resize_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ResizeRegionDiskRequest() - assert args[0] == request_msg @@ -12293,7 +12299,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetIamPolicyRegionDiskRequest() - assert args[0] == request_msg @@ -12313,7 +12318,6 @@ def test_set_labels_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetLabelsRegionDiskRequest() - assert args[0] == request_msg @@ -12335,7 +12339,6 @@ def test_start_async_replication_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.StartAsyncReplicationRegionDiskRequest() - assert args[0] == request_msg @@ -12357,7 +12360,6 @@ def test_stop_async_replication_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.StopAsyncReplicationRegionDiskRequest() - assert args[0] == request_msg @@ -12379,7 +12381,6 @@ def test_stop_group_async_replication_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.StopGroupAsyncReplicationRegionDiskRequest() - assert args[0] == request_msg @@ -12401,7 +12402,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsRegionDiskRequest() - assert args[0] == request_msg @@ -12421,7 +12421,6 @@ def test_update_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.UpdateRegionDiskRequest() - assert args[0] == request_msg @@ -12441,7 +12440,6 @@ def test_update_kms_key_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.UpdateKmsKeyRegionDiskRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_health_aggregation_policies.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_health_aggregation_policies.py index 070f192bcdda..a37f374a52d4 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_health_aggregation_policies.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_health_aggregation_policies.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 @@ -108,6 +109,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" @@ -4989,7 +5005,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListRegionHealthAggregationPoliciesRequest() - assert args[0] == request_msg @@ -5009,7 +5024,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteRegionHealthAggregationPolicyRequest() - assert args[0] == request_msg @@ -5029,7 +5043,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRegionHealthAggregationPolicyRequest() - assert args[0] == request_msg @@ -5049,7 +5062,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertRegionHealthAggregationPolicyRequest() - assert args[0] == request_msg @@ -5069,7 +5081,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRegionHealthAggregationPoliciesRequest() - assert args[0] == request_msg @@ -5089,7 +5100,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchRegionHealthAggregationPolicyRequest() - assert args[0] == request_msg @@ -5111,7 +5121,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsRegionHealthAggregationPolicyRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_health_check_services.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_health_check_services.py index f14714a463a1..98c0464cebda 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_health_check_services.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_health_check_services.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 @@ -108,6 +109,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" @@ -4929,7 +4945,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListRegionHealthCheckServicesRequest() - assert args[0] == request_msg @@ -4949,7 +4964,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteRegionHealthCheckServiceRequest() - assert args[0] == request_msg @@ -4969,7 +4983,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRegionHealthCheckServiceRequest() - assert args[0] == request_msg @@ -4989,7 +5002,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertRegionHealthCheckServiceRequest() - assert args[0] == request_msg @@ -5009,7 +5021,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRegionHealthCheckServicesRequest() - assert args[0] == request_msg @@ -5029,7 +5040,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchRegionHealthCheckServiceRequest() - assert args[0] == request_msg @@ -5051,7 +5061,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsRegionHealthCheckServiceRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_health_checks.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_health_checks.py index 807cb68d51e2..20fb0f1e4b89 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_health_checks.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_health_checks.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 @@ -108,6 +109,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" @@ -5270,7 +5286,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteRegionHealthCheckRequest() - assert args[0] == request_msg @@ -5290,7 +5305,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRegionHealthCheckRequest() - assert args[0] == request_msg @@ -5310,7 +5324,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertRegionHealthCheckRequest() - assert args[0] == request_msg @@ -5330,7 +5343,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRegionHealthChecksRequest() - assert args[0] == request_msg @@ -5350,7 +5362,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchRegionHealthCheckRequest() - assert args[0] == request_msg @@ -5372,7 +5383,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsRegionHealthCheckRequest() - assert args[0] == request_msg @@ -5392,7 +5402,6 @@ def test_update_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.UpdateRegionHealthCheckRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_health_sources.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_health_sources.py index 9f61ba389bf7..095859c08748 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_health_sources.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_health_sources.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 @@ -108,6 +109,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" @@ -5202,7 +5218,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListRegionHealthSourcesRequest() - assert args[0] == request_msg @@ -5222,7 +5237,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteRegionHealthSourceRequest() - assert args[0] == request_msg @@ -5242,7 +5256,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRegionHealthSourceRequest() - assert args[0] == request_msg @@ -5262,7 +5275,6 @@ def test_get_health_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetHealthRegionHealthSourceRequest() - assert args[0] == request_msg @@ -5282,7 +5294,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertRegionHealthSourceRequest() - assert args[0] == request_msg @@ -5302,7 +5313,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRegionHealthSourcesRequest() - assert args[0] == request_msg @@ -5322,7 +5332,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchRegionHealthSourceRequest() - assert args[0] == request_msg @@ -5344,7 +5353,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsRegionHealthSourceRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_instance_group_manager_resize_requests.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_instance_group_manager_resize_requests.py index e3a559230969..baf83fffc68c 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_instance_group_manager_resize_requests.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_instance_group_manager_resize_requests.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 @@ -108,6 +109,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" @@ -4208,7 +4224,6 @@ def test_cancel_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.CancelRegionInstanceGroupManagerResizeRequestRequest() - assert args[0] == request_msg @@ -4228,7 +4243,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteRegionInstanceGroupManagerResizeRequestRequest() - assert args[0] == request_msg @@ -4248,7 +4262,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRegionInstanceGroupManagerResizeRequestRequest() - assert args[0] == request_msg @@ -4268,7 +4281,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertRegionInstanceGroupManagerResizeRequestRequest() - assert args[0] == request_msg @@ -4288,7 +4300,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRegionInstanceGroupManagerResizeRequestsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_instance_group_managers.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_instance_group_managers.py index a7b792bad66a..b47d6acc1cf5 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_instance_group_managers.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_instance_group_managers.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 @@ -108,6 +109,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" @@ -19947,7 +19963,6 @@ def test_abandon_instances_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AbandonInstancesRegionInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -19967,7 +19982,6 @@ def test_adopt_instances_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AdoptInstancesRegionInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -19989,7 +20003,6 @@ def test_apply_updates_to_instances_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ApplyUpdatesToInstancesRegionInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -20009,7 +20022,6 @@ def test_create_instances_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.CreateInstancesRegionInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -20029,7 +20041,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteRegionInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -20049,7 +20060,6 @@ def test_delete_instances_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteInstancesRegionInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -20073,7 +20083,6 @@ def test_delete_per_instance_configs_unary_empty_call_rest(): request_msg = ( compute.DeletePerInstanceConfigsRegionInstanceGroupManagerRequest() ) - assert args[0] == request_msg @@ -20093,7 +20102,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRegionInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -20113,7 +20121,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertRegionInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -20133,7 +20140,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRegionInstanceGroupManagersRequest() - assert args[0] == request_msg @@ -20153,7 +20159,6 @@ def test_list_errors_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListErrorsRegionInstanceGroupManagersRequest() - assert args[0] == request_msg @@ -20175,7 +20180,6 @@ def test_list_managed_instances_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListManagedInstancesRegionInstanceGroupManagersRequest() - assert args[0] == request_msg @@ -20197,7 +20201,6 @@ def test_list_per_instance_configs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListPerInstanceConfigsRegionInstanceGroupManagersRequest() - assert args[0] == request_msg @@ -20217,7 +20220,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchRegionInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -20239,7 +20241,6 @@ def test_patch_per_instance_configs_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchPerInstanceConfigsRegionInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -20261,7 +20262,6 @@ def test_recreate_instances_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.RecreateInstancesRegionInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -20281,7 +20281,6 @@ def test_resize_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ResizeRegionInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -20301,7 +20300,6 @@ def test_resize_advanced_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ResizeAdvancedRegionInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -20321,7 +20319,6 @@ def test_resume_instances_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ResumeInstancesRegionInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -20343,7 +20340,6 @@ def test_set_auto_healing_policies_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetAutoHealingPoliciesRegionInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -20365,7 +20361,6 @@ def test_set_instance_template_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetInstanceTemplateRegionInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -20385,7 +20380,6 @@ def test_set_target_pools_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetTargetPoolsRegionInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -20405,7 +20399,6 @@ def test_start_instances_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.StartInstancesRegionInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -20425,7 +20418,6 @@ def test_stop_instances_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.StopInstancesRegionInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -20447,7 +20439,6 @@ def test_suspend_instances_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SuspendInstancesRegionInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -20469,7 +20460,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsRegionInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -20489,7 +20479,6 @@ def test_update_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.UpdateRegionInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -20513,7 +20502,6 @@ def test_update_per_instance_configs_unary_empty_call_rest(): request_msg = ( compute.UpdatePerInstanceConfigsRegionInstanceGroupManagerRequest() ) - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_instance_groups.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_instance_groups.py index 0cfa14b53276..641ad716277e 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_instance_groups.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_instance_groups.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 @@ -108,6 +109,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" @@ -3721,7 +3737,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRegionInstanceGroupRequest() - assert args[0] == request_msg @@ -3741,7 +3756,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRegionInstanceGroupsRequest() - assert args[0] == request_msg @@ -3761,7 +3775,6 @@ def test_list_instances_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListInstancesRegionInstanceGroupsRequest() - assert args[0] == request_msg @@ -3781,7 +3794,6 @@ def test_set_named_ports_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetNamedPortsRegionInstanceGroupRequest() - assert args[0] == request_msg @@ -3803,7 +3815,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsRegionInstanceGroupRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_instance_templates.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_instance_templates.py index 67e758592f38..2ed8ed37de24 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_instance_templates.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_instance_templates.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 @@ -109,6 +110,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" @@ -3549,7 +3565,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteRegionInstanceTemplateRequest() - assert args[0] == request_msg @@ -3569,7 +3584,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRegionInstanceTemplateRequest() - assert args[0] == request_msg @@ -3589,7 +3603,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertRegionInstanceTemplateRequest() - assert args[0] == request_msg @@ -3609,7 +3622,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRegionInstanceTemplatesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_instances.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_instances.py index 4a2b9aa771d0..951921ea7bd1 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_instances.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_instances.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 @@ -108,6 +109,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" @@ -2148,7 +2164,6 @@ def test_bulk_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.BulkInsertRegionInstanceRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_instant_snapshot_groups.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_instant_snapshot_groups.py index ad4ce76e9eb1..89e8b46c7493 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_instant_snapshot_groups.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_instant_snapshot_groups.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 @@ -108,6 +109,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" @@ -4641,7 +4657,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteRegionInstantSnapshotGroupRequest() - assert args[0] == request_msg @@ -4661,7 +4676,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRegionInstantSnapshotGroupRequest() - assert args[0] == request_msg @@ -4681,7 +4695,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetIamPolicyRegionInstantSnapshotGroupRequest() - assert args[0] == request_msg @@ -4701,7 +4714,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertRegionInstantSnapshotGroupRequest() - assert args[0] == request_msg @@ -4721,7 +4733,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRegionInstantSnapshotGroupsRequest() - assert args[0] == request_msg @@ -4741,7 +4752,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetIamPolicyRegionInstantSnapshotGroupRequest() - assert args[0] == request_msg @@ -4763,7 +4773,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsRegionInstantSnapshotGroupRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_instant_snapshots.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_instant_snapshots.py index b2be10532742..155b4c2dbbe5 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_instant_snapshots.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_instant_snapshots.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 @@ -108,6 +109,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" @@ -5278,7 +5294,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteRegionInstantSnapshotRequest() - assert args[0] == request_msg @@ -5298,7 +5313,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRegionInstantSnapshotRequest() - assert args[0] == request_msg @@ -5318,7 +5332,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetIamPolicyRegionInstantSnapshotRequest() - assert args[0] == request_msg @@ -5338,7 +5351,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertRegionInstantSnapshotRequest() - assert args[0] == request_msg @@ -5358,7 +5370,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRegionInstantSnapshotsRequest() - assert args[0] == request_msg @@ -5378,7 +5389,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetIamPolicyRegionInstantSnapshotRequest() - assert args[0] == request_msg @@ -5398,7 +5408,6 @@ def test_set_labels_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetLabelsRegionInstantSnapshotRequest() - assert args[0] == request_msg @@ -5420,7 +5429,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsRegionInstantSnapshotRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_multi_mig_members.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_multi_mig_members.py index 2fc04b4c1615..a36c0307d68c 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_multi_mig_members.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_multi_mig_members.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 @@ -106,6 +107,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" @@ -2070,7 +2086,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRegionMultiMigMemberRequest() - assert args[0] == request_msg @@ -2090,7 +2105,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRegionMultiMigMembersRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_multi_migs.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_multi_migs.py index c5ee264aacf0..20b10de5bd23 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_multi_migs.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_multi_migs.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 @@ -108,6 +109,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" @@ -3300,7 +3316,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteRegionMultiMigRequest() - assert args[0] == request_msg @@ -3320,7 +3335,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRegionMultiMigRequest() - assert args[0] == request_msg @@ -3340,7 +3354,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertRegionMultiMigRequest() - assert args[0] == request_msg @@ -3360,7 +3373,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRegionMultiMigsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_network_endpoint_groups.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_network_endpoint_groups.py index 47ec38a7f570..f48b7d935c50 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_network_endpoint_groups.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_network_endpoint_groups.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 @@ -108,6 +109,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" @@ -5335,7 +5351,6 @@ def test_attach_network_endpoints_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AttachNetworkEndpointsRegionNetworkEndpointGroupRequest() - assert args[0] == request_msg @@ -5355,7 +5370,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteRegionNetworkEndpointGroupRequest() - assert args[0] == request_msg @@ -5377,7 +5391,6 @@ def test_detach_network_endpoints_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DetachNetworkEndpointsRegionNetworkEndpointGroupRequest() - assert args[0] == request_msg @@ -5397,7 +5410,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRegionNetworkEndpointGroupRequest() - assert args[0] == request_msg @@ -5417,7 +5429,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertRegionNetworkEndpointGroupRequest() - assert args[0] == request_msg @@ -5437,7 +5448,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRegionNetworkEndpointGroupsRequest() - assert args[0] == request_msg @@ -5459,7 +5469,6 @@ def test_list_network_endpoints_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListNetworkEndpointsRegionNetworkEndpointGroupsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_network_firewall_policies.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_network_firewall_policies.py index 2b3c1d2687b0..7c75f0f5353e 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_network_firewall_policies.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_network_firewall_policies.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 @@ -108,6 +109,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" @@ -11494,7 +11510,6 @@ def test_add_association_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AddAssociationRegionNetworkFirewallPolicyRequest() - assert args[0] == request_msg @@ -11514,7 +11529,6 @@ def test_add_rule_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AddRuleRegionNetworkFirewallPolicyRequest() - assert args[0] == request_msg @@ -11534,7 +11548,6 @@ def test_clone_rules_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.CloneRulesRegionNetworkFirewallPolicyRequest() - assert args[0] == request_msg @@ -11554,7 +11567,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteRegionNetworkFirewallPolicyRequest() - assert args[0] == request_msg @@ -11574,7 +11586,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRegionNetworkFirewallPolicyRequest() - assert args[0] == request_msg @@ -11594,7 +11605,6 @@ def test_get_association_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetAssociationRegionNetworkFirewallPolicyRequest() - assert args[0] == request_msg @@ -11616,7 +11626,6 @@ def test_get_effective_firewalls_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetEffectiveFirewallsRegionNetworkFirewallPolicyRequest() - assert args[0] == request_msg @@ -11636,7 +11645,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetIamPolicyRegionNetworkFirewallPolicyRequest() - assert args[0] == request_msg @@ -11656,7 +11664,6 @@ def test_get_rule_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRuleRegionNetworkFirewallPolicyRequest() - assert args[0] == request_msg @@ -11676,7 +11683,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertRegionNetworkFirewallPolicyRequest() - assert args[0] == request_msg @@ -11696,7 +11702,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRegionNetworkFirewallPoliciesRequest() - assert args[0] == request_msg @@ -11716,7 +11721,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchRegionNetworkFirewallPolicyRequest() - assert args[0] == request_msg @@ -11738,7 +11742,6 @@ def test_patch_association_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchAssociationRegionNetworkFirewallPolicyRequest() - assert args[0] == request_msg @@ -11758,7 +11761,6 @@ def test_patch_rule_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchRuleRegionNetworkFirewallPolicyRequest() - assert args[0] == request_msg @@ -11780,7 +11782,6 @@ def test_remove_association_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.RemoveAssociationRegionNetworkFirewallPolicyRequest() - assert args[0] == request_msg @@ -11800,7 +11801,6 @@ def test_remove_rule_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.RemoveRuleRegionNetworkFirewallPolicyRequest() - assert args[0] == request_msg @@ -11820,7 +11820,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetIamPolicyRegionNetworkFirewallPolicyRequest() - assert args[0] == request_msg @@ -11842,7 +11841,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsRegionNetworkFirewallPolicyRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_network_policies.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_network_policies.py index f5a78686a80d..2c0745b79289 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_network_policies.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_network_policies.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 @@ -108,6 +109,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" @@ -8745,7 +8761,6 @@ def test_add_association_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AddAssociationRegionNetworkPolicyRequest() - assert args[0] == request_msg @@ -8767,7 +8782,6 @@ def test_add_traffic_classification_rule_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AddTrafficClassificationRuleRegionNetworkPolicyRequest() - assert args[0] == request_msg @@ -8787,7 +8801,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListRegionNetworkPoliciesRequest() - assert args[0] == request_msg @@ -8807,7 +8820,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteRegionNetworkPolicyRequest() - assert args[0] == request_msg @@ -8827,7 +8839,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRegionNetworkPolicyRequest() - assert args[0] == request_msg @@ -8847,7 +8858,6 @@ def test_get_association_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetAssociationRegionNetworkPolicyRequest() - assert args[0] == request_msg @@ -8869,7 +8879,6 @@ def test_get_traffic_classification_rule_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetTrafficClassificationRuleRegionNetworkPolicyRequest() - assert args[0] == request_msg @@ -8889,7 +8898,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertRegionNetworkPolicyRequest() - assert args[0] == request_msg @@ -8909,7 +8917,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRegionNetworkPoliciesRequest() - assert args[0] == request_msg @@ -8929,7 +8936,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchRegionNetworkPolicyRequest() - assert args[0] == request_msg @@ -8951,7 +8957,6 @@ def test_patch_traffic_classification_rule_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchTrafficClassificationRuleRegionNetworkPolicyRequest() - assert args[0] == request_msg @@ -8973,7 +8978,6 @@ def test_remove_association_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.RemoveAssociationRegionNetworkPolicyRequest() - assert args[0] == request_msg @@ -8997,7 +9001,6 @@ def test_remove_traffic_classification_rule_unary_empty_call_rest(): request_msg = ( compute.RemoveTrafficClassificationRuleRegionNetworkPolicyRequest() ) - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_notification_endpoints.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_notification_endpoints.py index a50c12b58da0..479301c95d13 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_notification_endpoints.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_notification_endpoints.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 @@ -108,6 +109,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" @@ -4226,7 +4242,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListRegionNotificationEndpointsRequest() - assert args[0] == request_msg @@ -4246,7 +4261,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteRegionNotificationEndpointRequest() - assert args[0] == request_msg @@ -4266,7 +4280,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRegionNotificationEndpointRequest() - assert args[0] == request_msg @@ -4286,7 +4299,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertRegionNotificationEndpointRequest() - assert args[0] == request_msg @@ -4306,7 +4318,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRegionNotificationEndpointsRequest() - assert args[0] == request_msg @@ -4328,7 +4339,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsRegionNotificationEndpointRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_operations.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_operations.py index 15a8328010e5..4d2d0d8e4fc4 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_operations.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_operations.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 @@ -106,6 +107,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" @@ -2741,7 +2757,6 @@ def test_delete_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteRegionOperationRequest() - assert args[0] == request_msg @@ -2761,7 +2776,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRegionOperationRequest() - assert args[0] == request_msg @@ -2781,7 +2795,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRegionOperationsRequest() - assert args[0] == request_msg @@ -2801,7 +2814,6 @@ def test_wait_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.WaitRegionOperationRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_security_policies.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_security_policies.py index ee6763febfc0..1acfbfd1172d 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_security_policies.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_security_policies.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 @@ -108,6 +109,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" @@ -7774,7 +7790,6 @@ def test_add_rule_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AddRuleRegionSecurityPolicyRequest() - assert args[0] == request_msg @@ -7794,7 +7809,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteRegionSecurityPolicyRequest() - assert args[0] == request_msg @@ -7814,7 +7828,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRegionSecurityPolicyRequest() - assert args[0] == request_msg @@ -7834,7 +7847,6 @@ def test_get_rule_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRuleRegionSecurityPolicyRequest() - assert args[0] == request_msg @@ -7854,7 +7866,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertRegionSecurityPolicyRequest() - assert args[0] == request_msg @@ -7874,7 +7885,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRegionSecurityPoliciesRequest() - assert args[0] == request_msg @@ -7894,7 +7904,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchRegionSecurityPolicyRequest() - assert args[0] == request_msg @@ -7914,7 +7923,6 @@ def test_patch_rule_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchRuleRegionSecurityPolicyRequest() - assert args[0] == request_msg @@ -7934,7 +7942,6 @@ def test_remove_rule_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.RemoveRuleRegionSecurityPolicyRequest() - assert args[0] == request_msg @@ -7954,7 +7961,6 @@ def test_set_labels_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetLabelsRegionSecurityPolicyRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_snapshot_settings.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_snapshot_settings.py index fb3bbcfd313d..9c7fe37c3bb4 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_snapshot_settings.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_snapshot_settings.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 @@ -107,6 +108,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" @@ -2314,7 +2330,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRegionSnapshotSettingRequest() - assert args[0] == request_msg @@ -2334,7 +2349,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchRegionSnapshotSettingRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_snapshots.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_snapshots.py index 543fd482eb13..16f6aebb2be5 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_snapshots.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_snapshots.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 @@ -108,6 +109,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" @@ -5950,7 +5966,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteRegionSnapshotRequest() - assert args[0] == request_msg @@ -5970,7 +5985,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRegionSnapshotRequest() - assert args[0] == request_msg @@ -5990,7 +6004,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetIamPolicyRegionSnapshotRequest() - assert args[0] == request_msg @@ -6010,7 +6023,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertRegionSnapshotRequest() - assert args[0] == request_msg @@ -6030,7 +6042,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRegionSnapshotsRequest() - assert args[0] == request_msg @@ -6050,7 +6061,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetIamPolicyRegionSnapshotRequest() - assert args[0] == request_msg @@ -6070,7 +6080,6 @@ def test_set_labels_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetLabelsRegionSnapshotRequest() - assert args[0] == request_msg @@ -6092,7 +6101,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsRegionSnapshotRequest() - assert args[0] == request_msg @@ -6112,7 +6120,6 @@ def test_update_kms_key_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.UpdateKmsKeyRegionSnapshotRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_ssl_certificates.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_ssl_certificates.py index 4781755aac47..1dda0261ff89 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_ssl_certificates.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_ssl_certificates.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 @@ -108,6 +109,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" @@ -3762,7 +3778,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteRegionSslCertificateRequest() - assert args[0] == request_msg @@ -3782,7 +3797,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRegionSslCertificateRequest() - assert args[0] == request_msg @@ -3802,7 +3816,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertRegionSslCertificateRequest() - assert args[0] == request_msg @@ -3822,7 +3835,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRegionSslCertificatesRequest() - assert args[0] == request_msg @@ -3844,7 +3856,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsRegionSslCertificateRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_ssl_policies.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_ssl_policies.py index fbbbd6f40e78..0472d4732b07 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_ssl_policies.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_ssl_policies.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 @@ -108,6 +109,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" @@ -4758,7 +4774,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteRegionSslPolicyRequest() - assert args[0] == request_msg @@ -4778,7 +4793,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRegionSslPolicyRequest() - assert args[0] == request_msg @@ -4798,7 +4812,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertRegionSslPolicyRequest() - assert args[0] == request_msg @@ -4818,7 +4831,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRegionSslPoliciesRequest() - assert args[0] == request_msg @@ -4840,7 +4852,6 @@ def test_list_available_features_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListAvailableFeaturesRegionSslPoliciesRequest() - assert args[0] == request_msg @@ -4860,7 +4871,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchRegionSslPolicyRequest() - assert args[0] == request_msg @@ -4882,7 +4892,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsRegionSslPolicyRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_target_http_proxies.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_target_http_proxies.py index d8b358dd42d2..cb216f5f457b 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_target_http_proxies.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_target_http_proxies.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 @@ -108,6 +109,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" @@ -4443,7 +4459,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteRegionTargetHttpProxyRequest() - assert args[0] == request_msg @@ -4463,7 +4478,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRegionTargetHttpProxyRequest() - assert args[0] == request_msg @@ -4483,7 +4497,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertRegionTargetHttpProxyRequest() - assert args[0] == request_msg @@ -4503,7 +4516,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRegionTargetHttpProxiesRequest() - assert args[0] == request_msg @@ -4523,7 +4535,6 @@ def test_set_url_map_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetUrlMapRegionTargetHttpProxyRequest() - assert args[0] == request_msg @@ -4545,7 +4556,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsRegionTargetHttpProxyRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_target_https_proxies.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_target_https_proxies.py index 74a499e51b05..07ce34bad37e 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_target_https_proxies.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_target_https_proxies.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 @@ -108,6 +109,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" @@ -5900,7 +5916,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteRegionTargetHttpsProxyRequest() - assert args[0] == request_msg @@ -5920,7 +5935,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRegionTargetHttpsProxyRequest() - assert args[0] == request_msg @@ -5940,7 +5954,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertRegionTargetHttpsProxyRequest() - assert args[0] == request_msg @@ -5960,7 +5973,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRegionTargetHttpsProxiesRequest() - assert args[0] == request_msg @@ -5980,7 +5992,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchRegionTargetHttpsProxyRequest() - assert args[0] == request_msg @@ -6002,7 +6013,6 @@ def test_set_ssl_certificates_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetSslCertificatesRegionTargetHttpsProxyRequest() - assert args[0] == request_msg @@ -6022,7 +6032,6 @@ def test_set_url_map_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetUrlMapRegionTargetHttpsProxyRequest() - assert args[0] == request_msg @@ -6044,7 +6053,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsRegionTargetHttpsProxyRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_target_tcp_proxies.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_target_tcp_proxies.py index 99d173afd180..d6853a756112 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_target_tcp_proxies.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_target_tcp_proxies.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 @@ -108,6 +109,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" @@ -3756,7 +3772,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteRegionTargetTcpProxyRequest() - assert args[0] == request_msg @@ -3776,7 +3791,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRegionTargetTcpProxyRequest() - assert args[0] == request_msg @@ -3796,7 +3810,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertRegionTargetTcpProxyRequest() - assert args[0] == request_msg @@ -3816,7 +3829,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRegionTargetTcpProxiesRequest() - assert args[0] == request_msg @@ -3838,7 +3850,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsRegionTargetTcpProxyRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_url_maps.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_url_maps.py index 8c8df8caea8b..baefae2eaa84 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_url_maps.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_url_maps.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 @@ -108,6 +109,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" @@ -7010,7 +7026,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteRegionUrlMapRequest() - assert args[0] == request_msg @@ -7030,7 +7045,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRegionUrlMapRequest() - assert args[0] == request_msg @@ -7050,7 +7064,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertRegionUrlMapRequest() - assert args[0] == request_msg @@ -7070,7 +7083,6 @@ def test_invalidate_cache_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InvalidateCacheRegionUrlMapRequest() - assert args[0] == request_msg @@ -7090,7 +7102,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRegionUrlMapsRequest() - assert args[0] == request_msg @@ -7110,7 +7121,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchRegionUrlMapRequest() - assert args[0] == request_msg @@ -7132,7 +7142,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsRegionUrlMapRequest() - assert args[0] == request_msg @@ -7152,7 +7161,6 @@ def test_update_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.UpdateRegionUrlMapRequest() - assert args[0] == request_msg @@ -7172,7 +7180,6 @@ def test_validate_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ValidateRegionUrlMapRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_zones.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_zones.py index 99928a0544de..4a1c1a3c24c0 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_zones.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_region_zones.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 @@ -106,6 +107,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" @@ -1622,7 +1638,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRegionZonesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_regions.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_regions.py index a340cfeec5eb..2e551c6270e0 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_regions.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_regions.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 @@ -106,6 +107,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" @@ -1912,7 +1928,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRegionRequest() - assert args[0] == request_msg @@ -1932,7 +1947,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRegionsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_reservation_blocks.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_reservation_blocks.py index 97ca26a060f9..f8f0f122cda2 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_reservation_blocks.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_reservation_blocks.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 @@ -108,6 +109,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" @@ -4064,7 +4080,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetReservationBlockRequest() - assert args[0] == request_msg @@ -4084,7 +4099,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetIamPolicyReservationBlockRequest() - assert args[0] == request_msg @@ -4104,7 +4118,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListReservationBlocksRequest() - assert args[0] == request_msg @@ -4126,7 +4139,6 @@ def test_perform_maintenance_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PerformMaintenanceReservationBlockRequest() - assert args[0] == request_msg @@ -4146,7 +4158,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetIamPolicyReservationBlockRequest() - assert args[0] == request_msg @@ -4168,7 +4179,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsReservationBlockRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_reservation_slots.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_reservation_slots.py index e92dea193fa4..b39b23f01009 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_reservation_slots.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_reservation_slots.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 @@ -108,6 +109,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" @@ -3499,7 +3515,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetReservationSlotRequest() - assert args[0] == request_msg @@ -3519,7 +3534,6 @@ def test_get_version_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetVersionReservationSlotRequest() - assert args[0] == request_msg @@ -3539,7 +3553,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListReservationSlotsRequest() - assert args[0] == request_msg @@ -3559,7 +3572,6 @@ def test_update_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.UpdateReservationSlotRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_reservation_sub_blocks.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_reservation_sub_blocks.py index f4a4093c02b5..041ef1014b3c 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_reservation_sub_blocks.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_reservation_sub_blocks.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 @@ -108,6 +109,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" @@ -5427,7 +5443,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetReservationSubBlockRequest() - assert args[0] == request_msg @@ -5447,7 +5462,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetIamPolicyReservationSubBlockRequest() - assert args[0] == request_msg @@ -5467,7 +5481,6 @@ def test_get_version_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetVersionReservationSubBlockRequest() - assert args[0] == request_msg @@ -5487,7 +5500,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListReservationSubBlocksRequest() - assert args[0] == request_msg @@ -5509,7 +5521,6 @@ def test_perform_maintenance_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PerformMaintenanceReservationSubBlockRequest() - assert args[0] == request_msg @@ -5529,7 +5540,6 @@ def test_report_faulty_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ReportFaultyReservationSubBlockRequest() - assert args[0] == request_msg @@ -5549,7 +5559,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetIamPolicyReservationSubBlockRequest() - assert args[0] == request_msg @@ -5571,7 +5580,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsReservationSubBlockRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_reservations.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_reservations.py index 16e5d6c6d844..558ad08ae301 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_reservations.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_reservations.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 @@ -108,6 +109,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" @@ -7170,7 +7186,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListReservationsRequest() - assert args[0] == request_msg @@ -7190,7 +7205,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteReservationRequest() - assert args[0] == request_msg @@ -7210,7 +7224,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetReservationRequest() - assert args[0] == request_msg @@ -7230,7 +7243,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetIamPolicyReservationRequest() - assert args[0] == request_msg @@ -7250,7 +7262,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertReservationRequest() - assert args[0] == request_msg @@ -7270,7 +7281,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListReservationsRequest() - assert args[0] == request_msg @@ -7292,7 +7302,6 @@ def test_perform_maintenance_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PerformMaintenanceReservationRequest() - assert args[0] == request_msg @@ -7312,7 +7321,6 @@ def test_resize_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ResizeReservationRequest() - assert args[0] == request_msg @@ -7332,7 +7340,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetIamPolicyReservationRequest() - assert args[0] == request_msg @@ -7354,7 +7361,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsReservationRequest() - assert args[0] == request_msg @@ -7374,7 +7380,6 @@ def test_update_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.UpdateReservationRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_resource_policies.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_resource_policies.py index 0935d20fffb8..3d0a9cf2d15a 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_resource_policies.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_resource_policies.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 @@ -108,6 +109,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" @@ -5775,7 +5791,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListResourcePoliciesRequest() - assert args[0] == request_msg @@ -5795,7 +5810,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteResourcePolicyRequest() - assert args[0] == request_msg @@ -5815,7 +5829,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetResourcePolicyRequest() - assert args[0] == request_msg @@ -5835,7 +5848,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetIamPolicyResourcePolicyRequest() - assert args[0] == request_msg @@ -5855,7 +5867,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertResourcePolicyRequest() - assert args[0] == request_msg @@ -5875,7 +5886,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListResourcePoliciesRequest() - assert args[0] == request_msg @@ -5895,7 +5905,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchResourcePolicyRequest() - assert args[0] == request_msg @@ -5915,7 +5924,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetIamPolicyResourcePolicyRequest() - assert args[0] == request_msg @@ -5937,7 +5945,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsResourcePolicyRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_rollout_plans.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_rollout_plans.py index ebaf15e0d0a3..d62bc6c3c51b 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_rollout_plans.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_rollout_plans.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 @@ -108,6 +109,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" @@ -3202,7 +3218,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteRolloutPlanRequest() - assert args[0] == request_msg @@ -3222,7 +3237,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRolloutPlanRequest() - assert args[0] == request_msg @@ -3242,7 +3256,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertRolloutPlanRequest() - assert args[0] == request_msg @@ -3262,7 +3275,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRolloutPlansRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_rollouts.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_rollouts.py index 82a3f7182f9a..f0b0d41c39ae 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_rollouts.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_rollouts.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 @@ -108,6 +109,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" @@ -3064,7 +3080,6 @@ def test_cancel_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.CancelRolloutRequest() - assert args[0] == request_msg @@ -3084,7 +3099,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteRolloutRequest() - assert args[0] == request_msg @@ -3104,7 +3118,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRolloutRequest() - assert args[0] == request_msg @@ -3124,7 +3137,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRolloutsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_routers.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_routers.py index 59a3d005122b..60368af286ef 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_routers.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_routers.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 @@ -108,6 +109,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" @@ -13282,7 +13298,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListRoutersRequest() - assert args[0] == request_msg @@ -13302,7 +13317,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteRouterRequest() - assert args[0] == request_msg @@ -13322,7 +13336,6 @@ def test_delete_named_set_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteNamedSetRouterRequest() - assert args[0] == request_msg @@ -13344,7 +13357,6 @@ def test_delete_route_policy_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteRoutePolicyRouterRequest() - assert args[0] == request_msg @@ -13364,7 +13376,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRouterRequest() - assert args[0] == request_msg @@ -13384,7 +13395,6 @@ def test_get_named_set_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetNamedSetRouterRequest() - assert args[0] == request_msg @@ -13404,7 +13414,6 @@ def test_get_nat_ip_info_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetNatIpInfoRouterRequest() - assert args[0] == request_msg @@ -13426,7 +13435,6 @@ def test_get_nat_mapping_info_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetNatMappingInfoRoutersRequest() - assert args[0] == request_msg @@ -13446,7 +13454,6 @@ def test_get_route_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRoutePolicyRouterRequest() - assert args[0] == request_msg @@ -13468,7 +13475,6 @@ def test_get_router_status_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRouterStatusRouterRequest() - assert args[0] == request_msg @@ -13488,7 +13494,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertRouterRequest() - assert args[0] == request_msg @@ -13508,7 +13513,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRoutersRequest() - assert args[0] == request_msg @@ -13528,7 +13532,6 @@ def test_list_bgp_routes_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListBgpRoutesRoutersRequest() - assert args[0] == request_msg @@ -13548,7 +13551,6 @@ def test_list_named_sets_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListNamedSetsRoutersRequest() - assert args[0] == request_msg @@ -13570,7 +13572,6 @@ def test_list_route_policies_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRoutePoliciesRoutersRequest() - assert args[0] == request_msg @@ -13590,7 +13591,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchRouterRequest() - assert args[0] == request_msg @@ -13610,7 +13610,6 @@ def test_patch_named_set_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchNamedSetRouterRequest() - assert args[0] == request_msg @@ -13632,7 +13631,6 @@ def test_patch_route_policy_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchRoutePolicyRouterRequest() - assert args[0] == request_msg @@ -13652,7 +13650,6 @@ def test_preview_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PreviewRouterRequest() - assert args[0] == request_msg @@ -13674,7 +13671,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsRouterRequest() - assert args[0] == request_msg @@ -13694,7 +13690,6 @@ def test_update_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.UpdateRouterRequest() - assert args[0] == request_msg @@ -13714,7 +13709,6 @@ def test_update_named_set_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.UpdateNamedSetRouterRequest() - assert args[0] == request_msg @@ -13736,7 +13730,6 @@ def test_update_route_policy_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.UpdateRoutePolicyRouterRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_routes.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_routes.py index fb981c2aee02..c5d6a911d9ca 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_routes.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_routes.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 @@ -104,6 +105,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" @@ -3566,7 +3582,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteRouteRequest() - assert args[0] == request_msg @@ -3586,7 +3601,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRouteRequest() - assert args[0] == request_msg @@ -3606,7 +3620,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertRouteRequest() - assert args[0] == request_msg @@ -3626,7 +3639,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRoutesRequest() - assert args[0] == request_msg @@ -3648,7 +3660,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsRouteRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_security_policies.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_security_policies.py index 6e8ba92df543..24b0776215a8 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_security_policies.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_security_policies.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 @@ -108,6 +109,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" @@ -8682,7 +8698,6 @@ def test_add_rule_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AddRuleSecurityPolicyRequest() - assert args[0] == request_msg @@ -8702,7 +8717,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListSecurityPoliciesRequest() - assert args[0] == request_msg @@ -8722,7 +8736,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteSecurityPolicyRequest() - assert args[0] == request_msg @@ -8742,7 +8755,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetSecurityPolicyRequest() - assert args[0] == request_msg @@ -8762,7 +8774,6 @@ def test_get_rule_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRuleSecurityPolicyRequest() - assert args[0] == request_msg @@ -8782,7 +8793,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertSecurityPolicyRequest() - assert args[0] == request_msg @@ -8802,7 +8812,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListSecurityPoliciesRequest() - assert args[0] == request_msg @@ -8824,7 +8833,6 @@ def test_list_preconfigured_expression_sets_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListPreconfiguredExpressionSetsSecurityPoliciesRequest() - assert args[0] == request_msg @@ -8844,7 +8852,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchSecurityPolicyRequest() - assert args[0] == request_msg @@ -8864,7 +8871,6 @@ def test_patch_rule_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchRuleSecurityPolicyRequest() - assert args[0] == request_msg @@ -8884,7 +8890,6 @@ def test_remove_rule_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.RemoveRuleSecurityPolicyRequest() - assert args[0] == request_msg @@ -8904,7 +8909,6 @@ def test_set_labels_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetLabelsSecurityPolicyRequest() - assert args[0] == request_msg @@ -8926,7 +8930,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsSecurityPolicyRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_service_attachments.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_service_attachments.py index 7b5ee219aadb..28c6da3abcc6 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_service_attachments.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_service_attachments.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 @@ -108,6 +109,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" @@ -5767,7 +5783,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListServiceAttachmentsRequest() - assert args[0] == request_msg @@ -5787,7 +5802,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteServiceAttachmentRequest() - assert args[0] == request_msg @@ -5807,7 +5821,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetServiceAttachmentRequest() - assert args[0] == request_msg @@ -5827,7 +5840,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetIamPolicyServiceAttachmentRequest() - assert args[0] == request_msg @@ -5847,7 +5859,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertServiceAttachmentRequest() - assert args[0] == request_msg @@ -5867,7 +5878,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListServiceAttachmentsRequest() - assert args[0] == request_msg @@ -5887,7 +5897,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchServiceAttachmentRequest() - assert args[0] == request_msg @@ -5907,7 +5916,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetIamPolicyServiceAttachmentRequest() - assert args[0] == request_msg @@ -5929,7 +5937,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsServiceAttachmentRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_snapshot_groups.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_snapshot_groups.py index dde55280f5fc..9ab095946f5a 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_snapshot_groups.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_snapshot_groups.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 @@ -108,6 +109,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" @@ -4390,7 +4406,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteSnapshotGroupRequest() - assert args[0] == request_msg @@ -4410,7 +4425,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetSnapshotGroupRequest() - assert args[0] == request_msg @@ -4430,7 +4444,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetIamPolicySnapshotGroupRequest() - assert args[0] == request_msg @@ -4450,7 +4463,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertSnapshotGroupRequest() - assert args[0] == request_msg @@ -4470,7 +4482,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListSnapshotGroupsRequest() - assert args[0] == request_msg @@ -4490,7 +4501,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetIamPolicySnapshotGroupRequest() - assert args[0] == request_msg @@ -4512,7 +4522,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsSnapshotGroupRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_snapshot_settings_service.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_snapshot_settings_service.py index 7c6be016c6b0..14a6f2048e17 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_snapshot_settings_service.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_snapshot_settings_service.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 @@ -107,6 +108,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" @@ -2285,7 +2301,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetSnapshotSettingRequest() - assert args[0] == request_msg @@ -2305,7 +2320,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchSnapshotSettingRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_snapshots.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_snapshots.py index 63535b0d4795..f07c302ada8b 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_snapshots.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_snapshots.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 @@ -108,6 +109,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" @@ -6127,7 +6143,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListSnapshotsRequest() - assert args[0] == request_msg @@ -6147,7 +6162,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteSnapshotRequest() - assert args[0] == request_msg @@ -6167,7 +6181,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetSnapshotRequest() - assert args[0] == request_msg @@ -6187,7 +6200,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetIamPolicySnapshotRequest() - assert args[0] == request_msg @@ -6207,7 +6219,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertSnapshotRequest() - assert args[0] == request_msg @@ -6227,7 +6238,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListSnapshotsRequest() - assert args[0] == request_msg @@ -6247,7 +6257,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetIamPolicySnapshotRequest() - assert args[0] == request_msg @@ -6267,7 +6276,6 @@ def test_set_labels_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetLabelsSnapshotRequest() - assert args[0] == request_msg @@ -6289,7 +6297,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsSnapshotRequest() - assert args[0] == request_msg @@ -6309,7 +6316,6 @@ def test_update_kms_key_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.UpdateKmsKeySnapshotRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_ssl_certificates.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_ssl_certificates.py index aeed191e2961..65235f416393 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_ssl_certificates.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_ssl_certificates.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 @@ -108,6 +109,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" @@ -4055,7 +4071,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListSslCertificatesRequest() - assert args[0] == request_msg @@ -4075,7 +4090,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteSslCertificateRequest() - assert args[0] == request_msg @@ -4095,7 +4109,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetSslCertificateRequest() - assert args[0] == request_msg @@ -4115,7 +4128,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertSslCertificateRequest() - assert args[0] == request_msg @@ -4135,7 +4147,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListSslCertificatesRequest() - assert args[0] == request_msg @@ -4157,7 +4168,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsSslCertificateRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_ssl_policies.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_ssl_policies.py index bcd42371991f..a626ee50d4e8 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_ssl_policies.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_ssl_policies.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 @@ -108,6 +109,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" @@ -4988,7 +5004,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListSslPoliciesRequest() - assert args[0] == request_msg @@ -5008,7 +5023,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteSslPolicyRequest() - assert args[0] == request_msg @@ -5028,7 +5042,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetSslPolicyRequest() - assert args[0] == request_msg @@ -5048,7 +5061,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertSslPolicyRequest() - assert args[0] == request_msg @@ -5068,7 +5080,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListSslPoliciesRequest() - assert args[0] == request_msg @@ -5090,7 +5101,6 @@ def test_list_available_features_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListAvailableFeaturesSslPoliciesRequest() - assert args[0] == request_msg @@ -5110,7 +5120,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchSslPolicyRequest() - assert args[0] == request_msg @@ -5132,7 +5141,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsSslPolicyRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_storage_pool_types.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_storage_pool_types.py index 671d0032b071..f970444108a5 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_storage_pool_types.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_storage_pool_types.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 @@ -106,6 +107,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" @@ -2457,7 +2473,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListStoragePoolTypesRequest() - assert args[0] == request_msg @@ -2477,7 +2492,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetStoragePoolTypeRequest() - assert args[0] == request_msg @@ -2497,7 +2511,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListStoragePoolTypesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_storage_pools.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_storage_pools.py index 5a1fe9ebbc52..0ee8123bbe1e 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_storage_pools.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_storage_pools.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 @@ -108,6 +109,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" @@ -6064,7 +6080,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListStoragePoolsRequest() - assert args[0] == request_msg @@ -6084,7 +6099,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteStoragePoolRequest() - assert args[0] == request_msg @@ -6104,7 +6118,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetStoragePoolRequest() - assert args[0] == request_msg @@ -6124,7 +6137,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetIamPolicyStoragePoolRequest() - assert args[0] == request_msg @@ -6144,7 +6156,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertStoragePoolRequest() - assert args[0] == request_msg @@ -6164,7 +6175,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListStoragePoolsRequest() - assert args[0] == request_msg @@ -6184,7 +6194,6 @@ def test_list_disks_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListDisksStoragePoolsRequest() - assert args[0] == request_msg @@ -6204,7 +6213,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetIamPolicyStoragePoolRequest() - assert args[0] == request_msg @@ -6226,7 +6234,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsStoragePoolRequest() - assert args[0] == request_msg @@ -6246,7 +6253,6 @@ def test_update_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.UpdateStoragePoolRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_subnetworks.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_subnetworks.py index 231875b0e43a..f603dd5200a5 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_subnetworks.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_subnetworks.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 @@ -108,6 +109,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" @@ -7516,7 +7532,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListSubnetworksRequest() - assert args[0] == request_msg @@ -7536,7 +7551,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteSubnetworkRequest() - assert args[0] == request_msg @@ -7558,7 +7572,6 @@ def test_expand_ip_cidr_range_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ExpandIpCidrRangeSubnetworkRequest() - assert args[0] == request_msg @@ -7578,7 +7591,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetSubnetworkRequest() - assert args[0] == request_msg @@ -7598,7 +7610,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetIamPolicySubnetworkRequest() - assert args[0] == request_msg @@ -7618,7 +7629,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertSubnetworkRequest() - assert args[0] == request_msg @@ -7638,7 +7648,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListSubnetworksRequest() - assert args[0] == request_msg @@ -7658,7 +7667,6 @@ def test_list_usable_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListUsableSubnetworksRequest() - assert args[0] == request_msg @@ -7678,7 +7686,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchSubnetworkRequest() - assert args[0] == request_msg @@ -7698,7 +7705,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetIamPolicySubnetworkRequest() - assert args[0] == request_msg @@ -7720,7 +7726,6 @@ def test_set_private_ip_google_access_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetPrivateIpGoogleAccessSubnetworkRequest() - assert args[0] == request_msg @@ -7742,7 +7747,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsSubnetworkRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_target_grpc_proxies.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_target_grpc_proxies.py index 1306cb0bee07..7b3c5b23ab49 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_target_grpc_proxies.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_target_grpc_proxies.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 @@ -108,6 +109,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" @@ -4302,7 +4318,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteTargetGrpcProxyRequest() - assert args[0] == request_msg @@ -4322,7 +4337,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetTargetGrpcProxyRequest() - assert args[0] == request_msg @@ -4342,7 +4356,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertTargetGrpcProxyRequest() - assert args[0] == request_msg @@ -4362,7 +4375,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListTargetGrpcProxiesRequest() - assert args[0] == request_msg @@ -4382,7 +4394,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchTargetGrpcProxyRequest() - assert args[0] == request_msg @@ -4404,7 +4415,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsTargetGrpcProxyRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_target_http_proxies.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_target_http_proxies.py index b7385b252e8e..6248ac48b451 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_target_http_proxies.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_target_http_proxies.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 @@ -108,6 +109,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" @@ -5383,7 +5399,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListTargetHttpProxiesRequest() - assert args[0] == request_msg @@ -5403,7 +5418,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteTargetHttpProxyRequest() - assert args[0] == request_msg @@ -5423,7 +5437,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetTargetHttpProxyRequest() - assert args[0] == request_msg @@ -5443,7 +5456,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertTargetHttpProxyRequest() - assert args[0] == request_msg @@ -5463,7 +5475,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListTargetHttpProxiesRequest() - assert args[0] == request_msg @@ -5483,7 +5494,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchTargetHttpProxyRequest() - assert args[0] == request_msg @@ -5503,7 +5513,6 @@ def test_set_url_map_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetUrlMapTargetHttpProxyRequest() - assert args[0] == request_msg @@ -5525,7 +5534,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsTargetHttpProxyRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_target_https_proxies.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_target_https_proxies.py index d472ca9aa6d7..fcf61067982c 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_target_https_proxies.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_target_https_proxies.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 @@ -108,6 +109,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" @@ -8118,7 +8134,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListTargetHttpsProxiesRequest() - assert args[0] == request_msg @@ -8138,7 +8153,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteTargetHttpsProxyRequest() - assert args[0] == request_msg @@ -8158,7 +8172,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetTargetHttpsProxyRequest() - assert args[0] == request_msg @@ -8178,7 +8191,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertTargetHttpsProxyRequest() - assert args[0] == request_msg @@ -8198,7 +8210,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListTargetHttpsProxiesRequest() - assert args[0] == request_msg @@ -8218,7 +8229,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchTargetHttpsProxyRequest() - assert args[0] == request_msg @@ -8240,7 +8250,6 @@ def test_set_certificate_map_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetCertificateMapTargetHttpsProxyRequest() - assert args[0] == request_msg @@ -8262,7 +8271,6 @@ def test_set_quic_override_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetQuicOverrideTargetHttpsProxyRequest() - assert args[0] == request_msg @@ -8284,7 +8292,6 @@ def test_set_ssl_certificates_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetSslCertificatesTargetHttpsProxyRequest() - assert args[0] == request_msg @@ -8304,7 +8311,6 @@ def test_set_ssl_policy_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetSslPolicyTargetHttpsProxyRequest() - assert args[0] == request_msg @@ -8324,7 +8330,6 @@ def test_set_url_map_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetUrlMapTargetHttpsProxyRequest() - assert args[0] == request_msg @@ -8346,7 +8351,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsTargetHttpsProxyRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_target_instances.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_target_instances.py index e228022233e9..6707993e39d0 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_target_instances.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_target_instances.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 @@ -108,6 +109,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" @@ -4826,7 +4842,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListTargetInstancesRequest() - assert args[0] == request_msg @@ -4846,7 +4861,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteTargetInstanceRequest() - assert args[0] == request_msg @@ -4866,7 +4880,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetTargetInstanceRequest() - assert args[0] == request_msg @@ -4886,7 +4899,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertTargetInstanceRequest() - assert args[0] == request_msg @@ -4906,7 +4918,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListTargetInstancesRequest() - assert args[0] == request_msg @@ -4928,7 +4939,6 @@ def test_set_security_policy_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetSecurityPolicyTargetInstanceRequest() - assert args[0] == request_msg @@ -4950,7 +4960,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsTargetInstanceRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_target_pools.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_target_pools.py index def65365377a..9ae9b01dca3e 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_target_pools.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_target_pools.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 @@ -108,6 +109,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" @@ -8638,7 +8654,6 @@ def test_add_health_check_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AddHealthCheckTargetPoolRequest() - assert args[0] == request_msg @@ -8658,7 +8673,6 @@ def test_add_instance_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AddInstanceTargetPoolRequest() - assert args[0] == request_msg @@ -8678,7 +8692,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListTargetPoolsRequest() - assert args[0] == request_msg @@ -8698,7 +8711,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteTargetPoolRequest() - assert args[0] == request_msg @@ -8718,7 +8730,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetTargetPoolRequest() - assert args[0] == request_msg @@ -8738,7 +8749,6 @@ def test_get_health_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetHealthTargetPoolRequest() - assert args[0] == request_msg @@ -8758,7 +8768,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertTargetPoolRequest() - assert args[0] == request_msg @@ -8778,7 +8787,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListTargetPoolsRequest() - assert args[0] == request_msg @@ -8800,7 +8808,6 @@ def test_remove_health_check_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.RemoveHealthCheckTargetPoolRequest() - assert args[0] == request_msg @@ -8820,7 +8827,6 @@ def test_remove_instance_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.RemoveInstanceTargetPoolRequest() - assert args[0] == request_msg @@ -8840,7 +8846,6 @@ def test_set_backup_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetBackupTargetPoolRequest() - assert args[0] == request_msg @@ -8862,7 +8867,6 @@ def test_set_security_policy_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetSecurityPolicyTargetPoolRequest() - assert args[0] == request_msg @@ -8884,7 +8888,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsTargetPoolRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_target_ssl_proxies.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_target_ssl_proxies.py index 3fd6d4516467..d8bf5462473f 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_target_ssl_proxies.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_target_ssl_proxies.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 @@ -108,6 +109,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" @@ -6997,7 +7013,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteTargetSslProxyRequest() - assert args[0] == request_msg @@ -7017,7 +7032,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetTargetSslProxyRequest() - assert args[0] == request_msg @@ -7037,7 +7051,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertTargetSslProxyRequest() - assert args[0] == request_msg @@ -7057,7 +7070,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListTargetSslProxiesRequest() - assert args[0] == request_msg @@ -7079,7 +7091,6 @@ def test_set_backend_service_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetBackendServiceTargetSslProxyRequest() - assert args[0] == request_msg @@ -7101,7 +7112,6 @@ def test_set_certificate_map_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetCertificateMapTargetSslProxyRequest() - assert args[0] == request_msg @@ -7121,7 +7131,6 @@ def test_set_proxy_header_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetProxyHeaderTargetSslProxyRequest() - assert args[0] == request_msg @@ -7143,7 +7152,6 @@ def test_set_ssl_certificates_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetSslCertificatesTargetSslProxyRequest() - assert args[0] == request_msg @@ -7163,7 +7171,6 @@ def test_set_ssl_policy_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetSslPolicyTargetSslProxyRequest() - assert args[0] == request_msg @@ -7185,7 +7192,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsTargetSslProxyRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_target_tcp_proxies.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_target_tcp_proxies.py index 5f4d8116fcea..2d9db5c0d821 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_target_tcp_proxies.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_target_tcp_proxies.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 @@ -108,6 +109,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" @@ -5402,7 +5418,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListTargetTcpProxiesRequest() - assert args[0] == request_msg @@ -5422,7 +5437,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteTargetTcpProxyRequest() - assert args[0] == request_msg @@ -5442,7 +5456,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetTargetTcpProxyRequest() - assert args[0] == request_msg @@ -5462,7 +5475,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertTargetTcpProxyRequest() - assert args[0] == request_msg @@ -5482,7 +5494,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListTargetTcpProxiesRequest() - assert args[0] == request_msg @@ -5504,7 +5515,6 @@ def test_set_backend_service_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetBackendServiceTargetTcpProxyRequest() - assert args[0] == request_msg @@ -5524,7 +5534,6 @@ def test_set_proxy_header_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetProxyHeaderTargetTcpProxyRequest() - assert args[0] == request_msg @@ -5546,7 +5555,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsTargetTcpProxyRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_target_vpn_gateways.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_target_vpn_gateways.py index bb49992b09a5..735721479d18 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_target_vpn_gateways.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_target_vpn_gateways.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 @@ -108,6 +109,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" @@ -4841,7 +4857,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListTargetVpnGatewaysRequest() - assert args[0] == request_msg @@ -4861,7 +4876,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteTargetVpnGatewayRequest() - assert args[0] == request_msg @@ -4881,7 +4895,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetTargetVpnGatewayRequest() - assert args[0] == request_msg @@ -4901,7 +4914,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertTargetVpnGatewayRequest() - assert args[0] == request_msg @@ -4921,7 +4933,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListTargetVpnGatewaysRequest() - assert args[0] == request_msg @@ -4941,7 +4952,6 @@ def test_set_labels_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetLabelsTargetVpnGatewayRequest() - assert args[0] == request_msg @@ -4963,7 +4973,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsTargetVpnGatewayRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_url_maps.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_url_maps.py index 77d69e270987..faaea38b8120 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_url_maps.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_url_maps.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 @@ -108,6 +109,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" @@ -7182,7 +7198,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListUrlMapsRequest() - assert args[0] == request_msg @@ -7202,7 +7217,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteUrlMapRequest() - assert args[0] == request_msg @@ -7222,7 +7236,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetUrlMapRequest() - assert args[0] == request_msg @@ -7242,7 +7255,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertUrlMapRequest() - assert args[0] == request_msg @@ -7262,7 +7274,6 @@ def test_invalidate_cache_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InvalidateCacheUrlMapRequest() - assert args[0] == request_msg @@ -7282,7 +7293,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListUrlMapsRequest() - assert args[0] == request_msg @@ -7302,7 +7312,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchUrlMapRequest() - assert args[0] == request_msg @@ -7324,7 +7333,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsUrlMapRequest() - assert args[0] == request_msg @@ -7344,7 +7352,6 @@ def test_update_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.UpdateUrlMapRequest() - assert args[0] == request_msg @@ -7364,7 +7371,6 @@ def test_validate_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ValidateUrlMapRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_vpn_gateways.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_vpn_gateways.py index f0bea677defc..e3f5513bb0b2 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_vpn_gateways.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_vpn_gateways.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 @@ -108,6 +109,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" @@ -5075,7 +5091,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListVpnGatewaysRequest() - assert args[0] == request_msg @@ -5095,7 +5110,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteVpnGatewayRequest() - assert args[0] == request_msg @@ -5115,7 +5129,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetVpnGatewayRequest() - assert args[0] == request_msg @@ -5135,7 +5148,6 @@ def test_get_status_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetStatusVpnGatewayRequest() - assert args[0] == request_msg @@ -5155,7 +5167,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertVpnGatewayRequest() - assert args[0] == request_msg @@ -5175,7 +5186,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListVpnGatewaysRequest() - assert args[0] == request_msg @@ -5195,7 +5205,6 @@ def test_set_labels_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetLabelsVpnGatewayRequest() - assert args[0] == request_msg @@ -5217,7 +5226,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsVpnGatewayRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_vpn_tunnels.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_vpn_tunnels.py index 81f6b3e021d6..69d8a264221d 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_vpn_tunnels.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_vpn_tunnels.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 @@ -108,6 +109,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" @@ -4767,7 +4783,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListVpnTunnelsRequest() - assert args[0] == request_msg @@ -4787,7 +4802,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteVpnTunnelRequest() - assert args[0] == request_msg @@ -4807,7 +4821,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetVpnTunnelRequest() - assert args[0] == request_msg @@ -4827,7 +4840,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertVpnTunnelRequest() - assert args[0] == request_msg @@ -4847,7 +4859,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListVpnTunnelsRequest() - assert args[0] == request_msg @@ -4867,7 +4878,6 @@ def test_set_labels_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetLabelsVpnTunnelRequest() - assert args[0] == request_msg @@ -4889,7 +4899,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsVpnTunnelRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_wire_groups.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_wire_groups.py index 5d220677aae8..4426bcf6e1ee 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_wire_groups.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_wire_groups.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 @@ -108,6 +109,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" @@ -3943,7 +3959,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteWireGroupRequest() - assert args[0] == request_msg @@ -3963,7 +3978,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetWireGroupRequest() - assert args[0] == request_msg @@ -3983,7 +3997,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertWireGroupRequest() - assert args[0] == request_msg @@ -4003,7 +4016,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListWireGroupsRequest() - assert args[0] == request_msg @@ -4023,7 +4035,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchWireGroupRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_zone_operations.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_zone_operations.py index ec7b917f3f96..8c9857f8302f 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_zone_operations.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_zone_operations.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 @@ -106,6 +107,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" @@ -2715,7 +2731,6 @@ def test_delete_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteZoneOperationRequest() - assert args[0] == request_msg @@ -2735,7 +2750,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetZoneOperationRequest() - assert args[0] == request_msg @@ -2755,7 +2769,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListZoneOperationsRequest() - assert args[0] == request_msg @@ -2775,7 +2788,6 @@ def test_wait_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.WaitZoneOperationRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_zone_vm_extension_policies.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_zone_vm_extension_policies.py index 2a9ea8964fdb..9d238c93006e 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_zone_vm_extension_policies.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_zone_vm_extension_policies.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 @@ -108,6 +109,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" @@ -4044,7 +4060,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteZoneVmExtensionPolicyRequest() - assert args[0] == request_msg @@ -4064,7 +4079,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetZoneVmExtensionPolicyRequest() - assert args[0] == request_msg @@ -4084,7 +4098,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertZoneVmExtensionPolicyRequest() - assert args[0] == request_msg @@ -4104,7 +4117,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListZoneVmExtensionPoliciesRequest() - assert args[0] == request_msg @@ -4124,7 +4136,6 @@ def test_update_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.UpdateZoneVmExtensionPolicyRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_zones.py b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_zones.py index accda8f4bce6..5921b45843e0 100644 --- a/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_zones.py +++ b/packages/google-cloud-compute-v1beta/tests/unit/gapic/compute_v1beta/test_zones.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 @@ -102,6 +103,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" @@ -1903,7 +1919,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetZoneRequest() - assert args[0] == request_msg @@ -1923,7 +1938,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListZonesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/noxfile.py b/packages/google-cloud-compute/noxfile.py index 7351f5965b60..e4103b0c9ffb 100644 --- a/packages/google-cloud-compute/noxfile.py +++ b/packages/google-cloud-compute/noxfile.py @@ -47,7 +47,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-compute" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-compute/setup.py b/packages/google-cloud-compute/setup.py index a9100e892b83..3cf505112844 100644 --- a/packages/google-cloud-compute/setup.py +++ b/packages/google-cloud-compute/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/google-cloud-compute/testing/constraints-3.10.txt b/packages/google-cloud-compute/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-compute/testing/constraints-3.10.txt +++ b/packages/google-cloud-compute/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-compute/tests/unit/gapic/compute_v1/test_accelerator_types.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_accelerator_types.py index 5f52fdcd85ea..99a1f52f88ad 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_accelerator_types.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_accelerator_types.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 @@ -106,6 +107,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" @@ -2443,7 +2459,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListAcceleratorTypesRequest() - assert args[0] == request_msg @@ -2463,7 +2478,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetAcceleratorTypeRequest() - assert args[0] == request_msg @@ -2483,7 +2497,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListAcceleratorTypesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_addresses.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_addresses.py index 6e494ea2ddc3..62df4ab7a6af 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_addresses.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_addresses.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 @@ -108,6 +109,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" @@ -5387,7 +5403,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListAddressesRequest() - assert args[0] == request_msg @@ -5407,7 +5422,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteAddressRequest() - assert args[0] == request_msg @@ -5427,7 +5441,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetAddressRequest() - assert args[0] == request_msg @@ -5447,7 +5460,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertAddressRequest() - assert args[0] == request_msg @@ -5467,7 +5479,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListAddressesRequest() - assert args[0] == request_msg @@ -5487,7 +5498,6 @@ def test_move_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.MoveAddressRequest() - assert args[0] == request_msg @@ -5507,7 +5517,6 @@ def test_set_labels_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetLabelsAddressRequest() - assert args[0] == request_msg @@ -5529,7 +5538,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsAddressRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_advice.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_advice.py index 9de5fdbd8f42..aa3326842842 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_advice.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_advice.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 @@ -102,6 +103,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" @@ -1611,7 +1627,6 @@ def test_calendar_mode_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.CalendarModeAdviceRpcRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_autoscalers.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_autoscalers.py index 1f53698f8960..d5866a5d78c9 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_autoscalers.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_autoscalers.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 @@ -108,6 +109,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" @@ -5491,7 +5507,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListAutoscalersRequest() - assert args[0] == request_msg @@ -5511,7 +5526,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteAutoscalerRequest() - assert args[0] == request_msg @@ -5531,7 +5545,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetAutoscalerRequest() - assert args[0] == request_msg @@ -5551,7 +5564,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertAutoscalerRequest() - assert args[0] == request_msg @@ -5571,7 +5583,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListAutoscalersRequest() - assert args[0] == request_msg @@ -5591,7 +5602,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchAutoscalerRequest() - assert args[0] == request_msg @@ -5613,7 +5623,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsAutoscalerRequest() - assert args[0] == request_msg @@ -5633,7 +5642,6 @@ def test_update_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.UpdateAutoscalerRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_backend_buckets.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_backend_buckets.py index 97bd4f655d44..e6d3a673c756 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_backend_buckets.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_backend_buckets.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 @@ -108,6 +109,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" @@ -8593,7 +8609,6 @@ def test_add_signed_url_key_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AddSignedUrlKeyBackendBucketRequest() - assert args[0] == request_msg @@ -8613,7 +8628,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListBackendBucketsRequest() - assert args[0] == request_msg @@ -8633,7 +8647,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteBackendBucketRequest() - assert args[0] == request_msg @@ -8655,7 +8668,6 @@ def test_delete_signed_url_key_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteSignedUrlKeyBackendBucketRequest() - assert args[0] == request_msg @@ -8675,7 +8687,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetBackendBucketRequest() - assert args[0] == request_msg @@ -8695,7 +8706,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetIamPolicyBackendBucketRequest() - assert args[0] == request_msg @@ -8715,7 +8725,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertBackendBucketRequest() - assert args[0] == request_msg @@ -8735,7 +8744,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListBackendBucketsRequest() - assert args[0] == request_msg @@ -8755,7 +8763,6 @@ def test_list_usable_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListUsableBackendBucketsRequest() - assert args[0] == request_msg @@ -8775,7 +8782,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchBackendBucketRequest() - assert args[0] == request_msg @@ -8797,7 +8803,6 @@ def test_set_edge_security_policy_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetEdgeSecurityPolicyBackendBucketRequest() - assert args[0] == request_msg @@ -8817,7 +8822,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetIamPolicyBackendBucketRequest() - assert args[0] == request_msg @@ -8839,7 +8843,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsBackendBucketRequest() - assert args[0] == request_msg @@ -8859,7 +8862,6 @@ def test_update_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.UpdateBackendBucketRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_backend_services.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_backend_services.py index 42da16262389..95ab9a564e58 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_backend_services.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_backend_services.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 @@ -108,6 +109,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" @@ -10548,7 +10564,6 @@ def test_add_signed_url_key_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AddSignedUrlKeyBackendServiceRequest() - assert args[0] == request_msg @@ -10568,7 +10583,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListBackendServicesRequest() - assert args[0] == request_msg @@ -10588,7 +10602,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteBackendServiceRequest() - assert args[0] == request_msg @@ -10610,7 +10623,6 @@ def test_delete_signed_url_key_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteSignedUrlKeyBackendServiceRequest() - assert args[0] == request_msg @@ -10630,7 +10642,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetBackendServiceRequest() - assert args[0] == request_msg @@ -10652,7 +10663,6 @@ def test_get_effective_security_policies_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetEffectiveSecurityPoliciesBackendServiceRequest() - assert args[0] == request_msg @@ -10672,7 +10682,6 @@ def test_get_health_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetHealthBackendServiceRequest() - assert args[0] == request_msg @@ -10692,7 +10701,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetIamPolicyBackendServiceRequest() - assert args[0] == request_msg @@ -10712,7 +10720,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertBackendServiceRequest() - assert args[0] == request_msg @@ -10732,7 +10739,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListBackendServicesRequest() - assert args[0] == request_msg @@ -10752,7 +10758,6 @@ def test_list_usable_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListUsableBackendServicesRequest() - assert args[0] == request_msg @@ -10772,7 +10777,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchBackendServiceRequest() - assert args[0] == request_msg @@ -10794,7 +10798,6 @@ def test_set_edge_security_policy_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetEdgeSecurityPolicyBackendServiceRequest() - assert args[0] == request_msg @@ -10814,7 +10817,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetIamPolicyBackendServiceRequest() - assert args[0] == request_msg @@ -10836,7 +10838,6 @@ def test_set_security_policy_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetSecurityPolicyBackendServiceRequest() - assert args[0] == request_msg @@ -10858,7 +10859,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsBackendServiceRequest() - assert args[0] == request_msg @@ -10878,7 +10878,6 @@ def test_update_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.UpdateBackendServiceRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_cross_site_networks.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_cross_site_networks.py index 1b8e826b4182..ec43daf337d6 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_cross_site_networks.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_cross_site_networks.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 @@ -108,6 +109,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" @@ -3923,7 +3939,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteCrossSiteNetworkRequest() - assert args[0] == request_msg @@ -3943,7 +3958,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetCrossSiteNetworkRequest() - assert args[0] == request_msg @@ -3963,7 +3977,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertCrossSiteNetworkRequest() - assert args[0] == request_msg @@ -3983,7 +3996,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListCrossSiteNetworksRequest() - assert args[0] == request_msg @@ -4003,7 +4015,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchCrossSiteNetworkRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_disk_types.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_disk_types.py index 3fbd269dff28..5eb9d011281c 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_disk_types.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_disk_types.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 @@ -106,6 +107,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" @@ -2364,7 +2380,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListDiskTypesRequest() - assert args[0] == request_msg @@ -2384,7 +2399,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetDiskTypeRequest() - assert args[0] == request_msg @@ -2404,7 +2418,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListDiskTypesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_disks.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_disks.py index c908499201c0..0caf1ff58f10 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_disks.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_disks.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 @@ -104,6 +105,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" @@ -13060,7 +13076,6 @@ def test_add_resource_policies_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AddResourcePoliciesDiskRequest() - assert args[0] == request_msg @@ -13080,7 +13095,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListDisksRequest() - assert args[0] == request_msg @@ -13100,7 +13114,6 @@ def test_bulk_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.BulkInsertDiskRequest() - assert args[0] == request_msg @@ -13120,7 +13133,6 @@ def test_bulk_set_labels_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.BulkSetLabelsDiskRequest() - assert args[0] == request_msg @@ -13140,7 +13152,6 @@ def test_create_snapshot_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.CreateSnapshotDiskRequest() - assert args[0] == request_msg @@ -13160,7 +13171,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteDiskRequest() - assert args[0] == request_msg @@ -13180,7 +13190,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetDiskRequest() - assert args[0] == request_msg @@ -13200,7 +13209,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetIamPolicyDiskRequest() - assert args[0] == request_msg @@ -13220,7 +13228,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertDiskRequest() - assert args[0] == request_msg @@ -13240,7 +13247,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListDisksRequest() - assert args[0] == request_msg @@ -13262,7 +13268,6 @@ def test_remove_resource_policies_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.RemoveResourcePoliciesDiskRequest() - assert args[0] == request_msg @@ -13282,7 +13287,6 @@ def test_resize_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ResizeDiskRequest() - assert args[0] == request_msg @@ -13302,7 +13306,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetIamPolicyDiskRequest() - assert args[0] == request_msg @@ -13322,7 +13325,6 @@ def test_set_labels_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetLabelsDiskRequest() - assert args[0] == request_msg @@ -13344,7 +13346,6 @@ def test_start_async_replication_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.StartAsyncReplicationDiskRequest() - assert args[0] == request_msg @@ -13366,7 +13367,6 @@ def test_stop_async_replication_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.StopAsyncReplicationDiskRequest() - assert args[0] == request_msg @@ -13388,7 +13388,6 @@ def test_stop_group_async_replication_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.StopGroupAsyncReplicationDiskRequest() - assert args[0] == request_msg @@ -13410,7 +13409,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsDiskRequest() - assert args[0] == request_msg @@ -13430,7 +13428,6 @@ def test_update_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.UpdateDiskRequest() - assert args[0] == request_msg @@ -13450,7 +13447,6 @@ def test_update_kms_key_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.UpdateKmsKeyDiskRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_external_vpn_gateways.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_external_vpn_gateways.py index 4657d3071180..b5c9cc513298 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_external_vpn_gateways.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_external_vpn_gateways.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 @@ -108,6 +109,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" @@ -4322,7 +4338,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteExternalVpnGatewayRequest() - assert args[0] == request_msg @@ -4342,7 +4357,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetExternalVpnGatewayRequest() - assert args[0] == request_msg @@ -4362,7 +4376,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertExternalVpnGatewayRequest() - assert args[0] == request_msg @@ -4382,7 +4395,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListExternalVpnGatewaysRequest() - assert args[0] == request_msg @@ -4402,7 +4414,6 @@ def test_set_labels_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetLabelsExternalVpnGatewayRequest() - assert args[0] == request_msg @@ -4424,7 +4435,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsExternalVpnGatewayRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_firewall_policies.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_firewall_policies.py index 16d81fd7f146..b06a943f8aec 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_firewall_policies.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_firewall_policies.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 @@ -108,6 +109,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" @@ -10301,7 +10317,6 @@ def test_add_association_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AddAssociationFirewallPolicyRequest() - assert args[0] == request_msg @@ -10321,7 +10336,6 @@ def test_add_rule_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AddRuleFirewallPolicyRequest() - assert args[0] == request_msg @@ -10341,7 +10355,6 @@ def test_clone_rules_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.CloneRulesFirewallPolicyRequest() - assert args[0] == request_msg @@ -10361,7 +10374,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteFirewallPolicyRequest() - assert args[0] == request_msg @@ -10381,7 +10393,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetFirewallPolicyRequest() - assert args[0] == request_msg @@ -10401,7 +10412,6 @@ def test_get_association_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetAssociationFirewallPolicyRequest() - assert args[0] == request_msg @@ -10421,7 +10431,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetIamPolicyFirewallPolicyRequest() - assert args[0] == request_msg @@ -10441,7 +10450,6 @@ def test_get_rule_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRuleFirewallPolicyRequest() - assert args[0] == request_msg @@ -10461,7 +10469,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertFirewallPolicyRequest() - assert args[0] == request_msg @@ -10481,7 +10488,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListFirewallPoliciesRequest() - assert args[0] == request_msg @@ -10503,7 +10509,6 @@ def test_list_associations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListAssociationsFirewallPolicyRequest() - assert args[0] == request_msg @@ -10523,7 +10528,6 @@ def test_move_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.MoveFirewallPolicyRequest() - assert args[0] == request_msg @@ -10543,7 +10547,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchFirewallPolicyRequest() - assert args[0] == request_msg @@ -10563,7 +10566,6 @@ def test_patch_rule_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchRuleFirewallPolicyRequest() - assert args[0] == request_msg @@ -10585,7 +10587,6 @@ def test_remove_association_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.RemoveAssociationFirewallPolicyRequest() - assert args[0] == request_msg @@ -10605,7 +10606,6 @@ def test_remove_rule_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.RemoveRuleFirewallPolicyRequest() - assert args[0] == request_msg @@ -10625,7 +10625,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetIamPolicyFirewallPolicyRequest() - assert args[0] == request_msg @@ -10647,7 +10646,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsFirewallPolicyRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_firewalls.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_firewalls.py index 2e9fc7f13df1..59ebb116a36c 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_firewalls.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_firewalls.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 @@ -108,6 +109,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" @@ -4930,7 +4946,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteFirewallRequest() - assert args[0] == request_msg @@ -4950,7 +4965,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetFirewallRequest() - assert args[0] == request_msg @@ -4970,7 +4984,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertFirewallRequest() - assert args[0] == request_msg @@ -4990,7 +5003,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListFirewallsRequest() - assert args[0] == request_msg @@ -5010,7 +5022,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchFirewallRequest() - assert args[0] == request_msg @@ -5032,7 +5043,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsFirewallRequest() - assert args[0] == request_msg @@ -5052,7 +5062,6 @@ def test_update_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.UpdateFirewallRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_forwarding_rules.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_forwarding_rules.py index 6414d2f9d159..5fd572188039 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_forwarding_rules.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_forwarding_rules.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 @@ -108,6 +109,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" @@ -5889,7 +5905,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListForwardingRulesRequest() - assert args[0] == request_msg @@ -5909,7 +5924,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteForwardingRuleRequest() - assert args[0] == request_msg @@ -5929,7 +5943,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetForwardingRuleRequest() - assert args[0] == request_msg @@ -5949,7 +5962,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertForwardingRuleRequest() - assert args[0] == request_msg @@ -5969,7 +5981,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListForwardingRulesRequest() - assert args[0] == request_msg @@ -5989,7 +6000,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchForwardingRuleRequest() - assert args[0] == request_msg @@ -6009,7 +6019,6 @@ def test_set_labels_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetLabelsForwardingRuleRequest() - assert args[0] == request_msg @@ -6029,7 +6038,6 @@ def test_set_target_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetTargetForwardingRuleRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_future_reservations.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_future_reservations.py index 073bc2f03f99..41b994261459 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_future_reservations.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_future_reservations.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 @@ -108,6 +109,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" @@ -5298,7 +5314,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListFutureReservationsRequest() - assert args[0] == request_msg @@ -5318,7 +5333,6 @@ def test_cancel_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.CancelFutureReservationRequest() - assert args[0] == request_msg @@ -5338,7 +5352,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteFutureReservationRequest() - assert args[0] == request_msg @@ -5358,7 +5371,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetFutureReservationRequest() - assert args[0] == request_msg @@ -5378,7 +5390,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertFutureReservationRequest() - assert args[0] == request_msg @@ -5398,7 +5409,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListFutureReservationsRequest() - assert args[0] == request_msg @@ -5418,7 +5428,6 @@ def test_update_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.UpdateFutureReservationRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_global_addresses.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_global_addresses.py index 62049a650a41..1552af617d74 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_global_addresses.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_global_addresses.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 @@ -108,6 +109,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" @@ -4951,7 +4967,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteGlobalAddressRequest() - assert args[0] == request_msg @@ -4971,7 +4986,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetGlobalAddressRequest() - assert args[0] == request_msg @@ -4991,7 +5005,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertGlobalAddressRequest() - assert args[0] == request_msg @@ -5011,7 +5024,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListGlobalAddressesRequest() - assert args[0] == request_msg @@ -5031,7 +5043,6 @@ def test_move_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.MoveGlobalAddressRequest() - assert args[0] == request_msg @@ -5051,7 +5062,6 @@ def test_set_labels_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetLabelsGlobalAddressRequest() - assert args[0] == request_msg @@ -5073,7 +5083,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsGlobalAddressRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_global_forwarding_rules.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_global_forwarding_rules.py index 60cc6ac3285b..fdffa23f7ea5 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_global_forwarding_rules.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_global_forwarding_rules.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 @@ -108,6 +109,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" @@ -5355,7 +5371,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteGlobalForwardingRuleRequest() - assert args[0] == request_msg @@ -5375,7 +5390,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetGlobalForwardingRuleRequest() - assert args[0] == request_msg @@ -5395,7 +5409,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertGlobalForwardingRuleRequest() - assert args[0] == request_msg @@ -5415,7 +5428,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListGlobalForwardingRulesRequest() - assert args[0] == request_msg @@ -5435,7 +5447,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchGlobalForwardingRuleRequest() - assert args[0] == request_msg @@ -5455,7 +5466,6 @@ def test_set_labels_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetLabelsGlobalForwardingRuleRequest() - assert args[0] == request_msg @@ -5475,7 +5485,6 @@ def test_set_target_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetTargetGlobalForwardingRuleRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_global_network_endpoint_groups.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_global_network_endpoint_groups.py index 1e8276b2cde9..f6765d4a0728 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_global_network_endpoint_groups.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_global_network_endpoint_groups.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 @@ -108,6 +109,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" @@ -5166,7 +5182,6 @@ def test_attach_network_endpoints_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AttachNetworkEndpointsGlobalNetworkEndpointGroupRequest() - assert args[0] == request_msg @@ -5186,7 +5201,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteGlobalNetworkEndpointGroupRequest() - assert args[0] == request_msg @@ -5208,7 +5222,6 @@ def test_detach_network_endpoints_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DetachNetworkEndpointsGlobalNetworkEndpointGroupRequest() - assert args[0] == request_msg @@ -5228,7 +5241,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetGlobalNetworkEndpointGroupRequest() - assert args[0] == request_msg @@ -5248,7 +5260,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertGlobalNetworkEndpointGroupRequest() - assert args[0] == request_msg @@ -5268,7 +5279,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListGlobalNetworkEndpointGroupsRequest() - assert args[0] == request_msg @@ -5290,7 +5300,6 @@ def test_list_network_endpoints_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListNetworkEndpointsGlobalNetworkEndpointGroupsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_global_operations.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_global_operations.py index e778c33a2398..63875d1534e5 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_global_operations.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_global_operations.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 @@ -106,6 +107,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" @@ -3111,7 +3127,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListGlobalOperationsRequest() - assert args[0] == request_msg @@ -3131,7 +3146,6 @@ def test_delete_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteGlobalOperationRequest() - assert args[0] == request_msg @@ -3151,7 +3165,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetGlobalOperationRequest() - assert args[0] == request_msg @@ -3171,7 +3184,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListGlobalOperationsRequest() - assert args[0] == request_msg @@ -3191,7 +3203,6 @@ def test_wait_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.WaitGlobalOperationRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_global_organization_operations.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_global_organization_operations.py index 65e0f4a31a17..8b98b994c752 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_global_organization_operations.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_global_organization_operations.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 @@ -106,6 +107,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" @@ -2240,7 +2256,6 @@ def test_delete_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteGlobalOrganizationOperationRequest() - assert args[0] == request_msg @@ -2260,7 +2275,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetGlobalOrganizationOperationRequest() - assert args[0] == request_msg @@ -2280,7 +2294,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListGlobalOrganizationOperationsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_global_public_delegated_prefixes.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_global_public_delegated_prefixes.py index 8ccbf057ca2a..5062ed56e923 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_global_public_delegated_prefixes.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_global_public_delegated_prefixes.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 @@ -108,6 +109,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" @@ -4046,7 +4062,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteGlobalPublicDelegatedPrefixeRequest() - assert args[0] == request_msg @@ -4066,7 +4081,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetGlobalPublicDelegatedPrefixeRequest() - assert args[0] == request_msg @@ -4086,7 +4100,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertGlobalPublicDelegatedPrefixeRequest() - assert args[0] == request_msg @@ -4106,7 +4119,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListGlobalPublicDelegatedPrefixesRequest() - assert args[0] == request_msg @@ -4126,7 +4138,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchGlobalPublicDelegatedPrefixeRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_global_vm_extension_policies.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_global_vm_extension_policies.py index fbdb820cbe6a..a1fc0366a889 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_global_vm_extension_policies.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_global_vm_extension_policies.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 @@ -108,6 +109,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" @@ -4545,7 +4561,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListGlobalVmExtensionPoliciesRequest() - assert args[0] == request_msg @@ -4565,7 +4580,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteGlobalVmExtensionPolicyRequest() - assert args[0] == request_msg @@ -4585,7 +4599,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetGlobalVmExtensionPolicyRequest() - assert args[0] == request_msg @@ -4605,7 +4618,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertGlobalVmExtensionPolicyRequest() - assert args[0] == request_msg @@ -4625,7 +4637,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListGlobalVmExtensionPoliciesRequest() - assert args[0] == request_msg @@ -4645,7 +4656,6 @@ def test_update_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.UpdateGlobalVmExtensionPolicyRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_health_checks.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_health_checks.py index 941f3a76038b..63f6029b1754 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_health_checks.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_health_checks.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 @@ -108,6 +109,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" @@ -5460,7 +5476,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListHealthChecksRequest() - assert args[0] == request_msg @@ -5480,7 +5495,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteHealthCheckRequest() - assert args[0] == request_msg @@ -5500,7 +5514,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetHealthCheckRequest() - assert args[0] == request_msg @@ -5520,7 +5533,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertHealthCheckRequest() - assert args[0] == request_msg @@ -5540,7 +5552,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListHealthChecksRequest() - assert args[0] == request_msg @@ -5560,7 +5571,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchHealthCheckRequest() - assert args[0] == request_msg @@ -5582,7 +5592,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsHealthCheckRequest() - assert args[0] == request_msg @@ -5602,7 +5611,6 @@ def test_update_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.UpdateHealthCheckRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_image_family_views.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_image_family_views.py index 1a4e72bcd21a..e61eac78270b 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_image_family_views.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_image_family_views.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 @@ -105,6 +106,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" @@ -1586,7 +1602,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetImageFamilyViewRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_images.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_images.py index f7e7f6f4b170..f7da36f26890 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_images.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_images.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 @@ -104,6 +105,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" @@ -6722,7 +6738,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteImageRequest() - assert args[0] == request_msg @@ -6742,7 +6757,6 @@ def test_deprecate_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeprecateImageRequest() - assert args[0] == request_msg @@ -6762,7 +6776,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetImageRequest() - assert args[0] == request_msg @@ -6782,7 +6795,6 @@ def test_get_from_family_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetFromFamilyImageRequest() - assert args[0] == request_msg @@ -6802,7 +6814,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetIamPolicyImageRequest() - assert args[0] == request_msg @@ -6822,7 +6833,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertImageRequest() - assert args[0] == request_msg @@ -6842,7 +6852,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListImagesRequest() - assert args[0] == request_msg @@ -6862,7 +6871,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchImageRequest() - assert args[0] == request_msg @@ -6882,7 +6890,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetIamPolicyImageRequest() - assert args[0] == request_msg @@ -6902,7 +6909,6 @@ def test_set_labels_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetLabelsImageRequest() - assert args[0] == request_msg @@ -6924,7 +6930,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsImageRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_instance_group_manager_resize_requests.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_instance_group_manager_resize_requests.py index b481036cad29..de0dcd08fb49 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_instance_group_manager_resize_requests.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_instance_group_manager_resize_requests.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 @@ -108,6 +109,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" @@ -4171,7 +4187,6 @@ def test_cancel_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.CancelInstanceGroupManagerResizeRequestRequest() - assert args[0] == request_msg @@ -4191,7 +4206,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteInstanceGroupManagerResizeRequestRequest() - assert args[0] == request_msg @@ -4211,7 +4225,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetInstanceGroupManagerResizeRequestRequest() - assert args[0] == request_msg @@ -4231,7 +4244,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertInstanceGroupManagerResizeRequestRequest() - assert args[0] == request_msg @@ -4251,7 +4263,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListInstanceGroupManagerResizeRequestsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_instance_group_managers.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_instance_group_managers.py index b860d60a7b82..95f62a989def 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_instance_group_managers.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_instance_group_managers.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 @@ -108,6 +109,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" @@ -16708,7 +16724,6 @@ def test_abandon_instances_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AbandonInstancesInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -16728,7 +16743,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListInstanceGroupManagersRequest() - assert args[0] == request_msg @@ -16750,7 +16764,6 @@ def test_apply_updates_to_instances_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ApplyUpdatesToInstancesInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -16770,7 +16783,6 @@ def test_create_instances_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.CreateInstancesInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -16790,7 +16802,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -16810,7 +16821,6 @@ def test_delete_instances_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteInstancesInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -16832,7 +16842,6 @@ def test_delete_per_instance_configs_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeletePerInstanceConfigsInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -16852,7 +16861,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -16872,7 +16880,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -16892,7 +16899,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListInstanceGroupManagersRequest() - assert args[0] == request_msg @@ -16912,7 +16918,6 @@ def test_list_errors_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListErrorsInstanceGroupManagersRequest() - assert args[0] == request_msg @@ -16934,7 +16939,6 @@ def test_list_managed_instances_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListManagedInstancesInstanceGroupManagersRequest() - assert args[0] == request_msg @@ -16956,7 +16960,6 @@ def test_list_per_instance_configs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListPerInstanceConfigsInstanceGroupManagersRequest() - assert args[0] == request_msg @@ -16976,7 +16979,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -16998,7 +17000,6 @@ def test_patch_per_instance_configs_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchPerInstanceConfigsInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -17020,7 +17021,6 @@ def test_recreate_instances_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.RecreateInstancesInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -17040,7 +17040,6 @@ def test_resize_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ResizeInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -17060,7 +17059,6 @@ def test_resume_instances_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ResumeInstancesInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -17082,7 +17080,6 @@ def test_set_instance_template_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetInstanceTemplateInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -17102,7 +17099,6 @@ def test_set_target_pools_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetTargetPoolsInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -17122,7 +17118,6 @@ def test_start_instances_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.StartInstancesInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -17142,7 +17137,6 @@ def test_stop_instances_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.StopInstancesInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -17164,7 +17158,6 @@ def test_suspend_instances_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SuspendInstancesInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -17186,7 +17179,6 @@ def test_update_per_instance_configs_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.UpdatePerInstanceConfigsInstanceGroupManagerRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_instance_groups.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_instance_groups.py index 9b4f34f659a2..cfec3448dd89 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_instance_groups.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_instance_groups.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 @@ -108,6 +109,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" @@ -6753,7 +6769,6 @@ def test_add_instances_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AddInstancesInstanceGroupRequest() - assert args[0] == request_msg @@ -6773,7 +6788,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListInstanceGroupsRequest() - assert args[0] == request_msg @@ -6793,7 +6807,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteInstanceGroupRequest() - assert args[0] == request_msg @@ -6813,7 +6826,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetInstanceGroupRequest() - assert args[0] == request_msg @@ -6833,7 +6845,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertInstanceGroupRequest() - assert args[0] == request_msg @@ -6853,7 +6864,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListInstanceGroupsRequest() - assert args[0] == request_msg @@ -6873,7 +6883,6 @@ def test_list_instances_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListInstancesInstanceGroupsRequest() - assert args[0] == request_msg @@ -6893,7 +6902,6 @@ def test_remove_instances_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.RemoveInstancesInstanceGroupRequest() - assert args[0] == request_msg @@ -6913,7 +6921,6 @@ def test_set_named_ports_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetNamedPortsInstanceGroupRequest() - assert args[0] == request_msg @@ -6935,7 +6942,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsInstanceGroupRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_instance_settings_service.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_instance_settings_service.py index b2f02f7225c0..6ccdf0f7e44d 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_instance_settings_service.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_instance_settings_service.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 @@ -107,6 +108,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" @@ -2298,7 +2314,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetInstanceSettingRequest() - assert args[0] == request_msg @@ -2318,7 +2333,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchInstanceSettingRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_instance_templates.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_instance_templates.py index 578a6f1143c8..5687586225e5 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_instance_templates.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_instance_templates.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 @@ -108,6 +109,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" @@ -5033,7 +5049,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListInstanceTemplatesRequest() - assert args[0] == request_msg @@ -5053,7 +5068,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteInstanceTemplateRequest() - assert args[0] == request_msg @@ -5073,7 +5087,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetInstanceTemplateRequest() - assert args[0] == request_msg @@ -5093,7 +5106,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetIamPolicyInstanceTemplateRequest() - assert args[0] == request_msg @@ -5113,7 +5125,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertInstanceTemplateRequest() - assert args[0] == request_msg @@ -5133,7 +5144,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListInstanceTemplatesRequest() - assert args[0] == request_msg @@ -5153,7 +5163,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetIamPolicyInstanceTemplateRequest() - assert args[0] == request_msg @@ -5175,7 +5184,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsInstanceTemplateRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_instances.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_instances.py index c35109aa1709..148ff1da7bc9 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_instances.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_instances.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 @@ -108,6 +109,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" @@ -32366,7 +32382,6 @@ def test_add_access_config_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AddAccessConfigInstanceRequest() - assert args[0] == request_msg @@ -32388,7 +32403,6 @@ def test_add_network_interface_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AddNetworkInterfaceInstanceRequest() - assert args[0] == request_msg @@ -32410,7 +32424,6 @@ def test_add_resource_policies_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AddResourcePoliciesInstanceRequest() - assert args[0] == request_msg @@ -32430,7 +32443,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListInstancesRequest() - assert args[0] == request_msg @@ -32450,7 +32462,6 @@ def test_attach_disk_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AttachDiskInstanceRequest() - assert args[0] == request_msg @@ -32470,7 +32481,6 @@ def test_bulk_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.BulkInsertInstanceRequest() - assert args[0] == request_msg @@ -32490,7 +32500,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteInstanceRequest() - assert args[0] == request_msg @@ -32512,7 +32521,6 @@ def test_delete_access_config_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteAccessConfigInstanceRequest() - assert args[0] == request_msg @@ -32534,7 +32542,6 @@ def test_delete_network_interface_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteNetworkInterfaceInstanceRequest() - assert args[0] == request_msg @@ -32554,7 +32561,6 @@ def test_detach_disk_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DetachDiskInstanceRequest() - assert args[0] == request_msg @@ -32574,7 +32580,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetInstanceRequest() - assert args[0] == request_msg @@ -32596,7 +32601,6 @@ def test_get_effective_firewalls_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetEffectiveFirewallsInstanceRequest() - assert args[0] == request_msg @@ -32618,7 +32622,6 @@ def test_get_guest_attributes_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetGuestAttributesInstanceRequest() - assert args[0] == request_msg @@ -32638,7 +32641,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetIamPolicyInstanceRequest() - assert args[0] == request_msg @@ -32658,7 +32660,6 @@ def test_get_screenshot_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetScreenshotInstanceRequest() - assert args[0] == request_msg @@ -32680,7 +32681,6 @@ def test_get_serial_port_output_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetSerialPortOutputInstanceRequest() - assert args[0] == request_msg @@ -32702,7 +32702,6 @@ def test_get_shielded_instance_identity_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetShieldedInstanceIdentityInstanceRequest() - assert args[0] == request_msg @@ -32722,7 +32721,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertInstanceRequest() - assert args[0] == request_msg @@ -32742,7 +32740,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListInstancesRequest() - assert args[0] == request_msg @@ -32762,7 +32759,6 @@ def test_list_referrers_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListReferrersInstancesRequest() - assert args[0] == request_msg @@ -32784,7 +32780,6 @@ def test_perform_maintenance_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PerformMaintenanceInstanceRequest() - assert args[0] == request_msg @@ -32806,7 +32801,6 @@ def test_remove_resource_policies_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.RemoveResourcePoliciesInstanceRequest() - assert args[0] == request_msg @@ -32828,7 +32822,6 @@ def test_report_host_as_faulty_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ReportHostAsFaultyInstanceRequest() - assert args[0] == request_msg @@ -32848,7 +32841,6 @@ def test_reset_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ResetInstanceRequest() - assert args[0] == request_msg @@ -32868,7 +32860,6 @@ def test_resume_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ResumeInstanceRequest() - assert args[0] == request_msg @@ -32890,7 +32881,6 @@ def test_send_diagnostic_interrupt_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SendDiagnosticInterruptInstanceRequest() - assert args[0] == request_msg @@ -32912,7 +32902,6 @@ def test_set_deletion_protection_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetDeletionProtectionInstanceRequest() - assert args[0] == request_msg @@ -32934,7 +32923,6 @@ def test_set_disk_auto_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetDiskAutoDeleteInstanceRequest() - assert args[0] == request_msg @@ -32954,7 +32942,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetIamPolicyInstanceRequest() - assert args[0] == request_msg @@ -32974,7 +32961,6 @@ def test_set_labels_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetLabelsInstanceRequest() - assert args[0] == request_msg @@ -32996,7 +32982,6 @@ def test_set_machine_resources_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetMachineResourcesInstanceRequest() - assert args[0] == request_msg @@ -33016,7 +33001,6 @@ def test_set_machine_type_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetMachineTypeInstanceRequest() - assert args[0] == request_msg @@ -33036,7 +33020,6 @@ def test_set_metadata_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetMetadataInstanceRequest() - assert args[0] == request_msg @@ -33058,7 +33041,6 @@ def test_set_min_cpu_platform_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetMinCpuPlatformInstanceRequest() - assert args[0] == request_msg @@ -33078,7 +33060,6 @@ def test_set_name_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetNameInstanceRequest() - assert args[0] == request_msg @@ -33098,7 +33079,6 @@ def test_set_scheduling_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetSchedulingInstanceRequest() - assert args[0] == request_msg @@ -33120,7 +33100,6 @@ def test_set_security_policy_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetSecurityPolicyInstanceRequest() - assert args[0] == request_msg @@ -33142,7 +33121,6 @@ def test_set_service_account_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetServiceAccountInstanceRequest() - assert args[0] == request_msg @@ -33164,7 +33142,6 @@ def test_set_shielded_instance_integrity_policy_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetShieldedInstanceIntegrityPolicyInstanceRequest() - assert args[0] == request_msg @@ -33184,7 +33161,6 @@ def test_set_tags_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetTagsInstanceRequest() - assert args[0] == request_msg @@ -33206,7 +33182,6 @@ def test_simulate_maintenance_event_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SimulateMaintenanceEventInstanceRequest() - assert args[0] == request_msg @@ -33226,7 +33201,6 @@ def test_start_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.StartInstanceRequest() - assert args[0] == request_msg @@ -33248,7 +33222,6 @@ def test_start_with_encryption_key_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.StartWithEncryptionKeyInstanceRequest() - assert args[0] == request_msg @@ -33268,7 +33241,6 @@ def test_stop_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.StopInstanceRequest() - assert args[0] == request_msg @@ -33288,7 +33260,6 @@ def test_suspend_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SuspendInstanceRequest() - assert args[0] == request_msg @@ -33310,7 +33281,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsInstanceRequest() - assert args[0] == request_msg @@ -33330,7 +33300,6 @@ def test_update_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.UpdateInstanceRequest() - assert args[0] == request_msg @@ -33352,7 +33321,6 @@ def test_update_access_config_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.UpdateAccessConfigInstanceRequest() - assert args[0] == request_msg @@ -33374,7 +33342,6 @@ def test_update_display_device_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.UpdateDisplayDeviceInstanceRequest() - assert args[0] == request_msg @@ -33396,7 +33363,6 @@ def test_update_network_interface_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.UpdateNetworkInterfaceInstanceRequest() - assert args[0] == request_msg @@ -33418,7 +33384,6 @@ def test_update_shielded_instance_config_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.UpdateShieldedInstanceConfigInstanceRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_instant_snapshot_groups.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_instant_snapshot_groups.py index 3ef9bdb68056..18ca39521d3e 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_instant_snapshot_groups.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_instant_snapshot_groups.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 @@ -108,6 +109,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" @@ -4588,7 +4604,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteInstantSnapshotGroupRequest() - assert args[0] == request_msg @@ -4608,7 +4623,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetInstantSnapshotGroupRequest() - assert args[0] == request_msg @@ -4628,7 +4642,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetIamPolicyInstantSnapshotGroupRequest() - assert args[0] == request_msg @@ -4648,7 +4661,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertInstantSnapshotGroupRequest() - assert args[0] == request_msg @@ -4668,7 +4680,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListInstantSnapshotGroupsRequest() - assert args[0] == request_msg @@ -4688,7 +4699,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetIamPolicyInstantSnapshotGroupRequest() - assert args[0] == request_msg @@ -4710,7 +4720,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsInstantSnapshotGroupRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_instant_snapshots.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_instant_snapshots.py index 58167cd8fe6a..83a9ddef8cdc 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_instant_snapshots.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_instant_snapshots.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 @@ -108,6 +109,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" @@ -5656,7 +5672,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListInstantSnapshotsRequest() - assert args[0] == request_msg @@ -5676,7 +5691,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteInstantSnapshotRequest() - assert args[0] == request_msg @@ -5696,7 +5710,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetInstantSnapshotRequest() - assert args[0] == request_msg @@ -5716,7 +5729,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetIamPolicyInstantSnapshotRequest() - assert args[0] == request_msg @@ -5736,7 +5748,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertInstantSnapshotRequest() - assert args[0] == request_msg @@ -5756,7 +5767,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListInstantSnapshotsRequest() - assert args[0] == request_msg @@ -5776,7 +5786,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetIamPolicyInstantSnapshotRequest() - assert args[0] == request_msg @@ -5796,7 +5805,6 @@ def test_set_labels_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetLabelsInstantSnapshotRequest() - assert args[0] == request_msg @@ -5818,7 +5826,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsInstantSnapshotRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_interconnect_attachment_groups.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_interconnect_attachment_groups.py index bcf0c3bdebd2..f515b794d4a6 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_interconnect_attachment_groups.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_interconnect_attachment_groups.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 @@ -108,6 +109,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" @@ -5734,7 +5750,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteInterconnectAttachmentGroupRequest() - assert args[0] == request_msg @@ -5754,7 +5769,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetInterconnectAttachmentGroupRequest() - assert args[0] == request_msg @@ -5774,7 +5788,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetIamPolicyInterconnectAttachmentGroupRequest() - assert args[0] == request_msg @@ -5796,7 +5809,6 @@ def test_get_operational_status_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetOperationalStatusInterconnectAttachmentGroupRequest() - assert args[0] == request_msg @@ -5816,7 +5828,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertInterconnectAttachmentGroupRequest() - assert args[0] == request_msg @@ -5836,7 +5847,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListInterconnectAttachmentGroupsRequest() - assert args[0] == request_msg @@ -5856,7 +5866,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchInterconnectAttachmentGroupRequest() - assert args[0] == request_msg @@ -5876,7 +5885,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetIamPolicyInterconnectAttachmentGroupRequest() - assert args[0] == request_msg @@ -5898,7 +5906,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsInterconnectAttachmentGroupRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_interconnect_attachments.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_interconnect_attachments.py index 01adef63c904..a223032c05e3 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_interconnect_attachments.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_interconnect_attachments.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 @@ -108,6 +109,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" @@ -5368,7 +5384,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListInterconnectAttachmentsRequest() - assert args[0] == request_msg @@ -5388,7 +5403,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteInterconnectAttachmentRequest() - assert args[0] == request_msg @@ -5408,7 +5422,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetInterconnectAttachmentRequest() - assert args[0] == request_msg @@ -5428,7 +5441,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertInterconnectAttachmentRequest() - assert args[0] == request_msg @@ -5448,7 +5460,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListInterconnectAttachmentsRequest() - assert args[0] == request_msg @@ -5468,7 +5479,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchInterconnectAttachmentRequest() - assert args[0] == request_msg @@ -5488,7 +5498,6 @@ def test_set_labels_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetLabelsInterconnectAttachmentRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_interconnect_groups.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_interconnect_groups.py index 10ca7d438e05..fe728ac9a2dd 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_interconnect_groups.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_interconnect_groups.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 @@ -108,6 +109,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" @@ -6289,7 +6305,6 @@ def test_create_members_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.CreateMembersInterconnectGroupRequest() - assert args[0] == request_msg @@ -6309,7 +6324,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteInterconnectGroupRequest() - assert args[0] == request_msg @@ -6329,7 +6343,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetInterconnectGroupRequest() - assert args[0] == request_msg @@ -6349,7 +6362,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetIamPolicyInterconnectGroupRequest() - assert args[0] == request_msg @@ -6371,7 +6383,6 @@ def test_get_operational_status_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetOperationalStatusInterconnectGroupRequest() - assert args[0] == request_msg @@ -6391,7 +6402,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertInterconnectGroupRequest() - assert args[0] == request_msg @@ -6411,7 +6421,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListInterconnectGroupsRequest() - assert args[0] == request_msg @@ -6431,7 +6440,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchInterconnectGroupRequest() - assert args[0] == request_msg @@ -6451,7 +6459,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetIamPolicyInterconnectGroupRequest() - assert args[0] == request_msg @@ -6473,7 +6480,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsInterconnectGroupRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_interconnect_locations.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_interconnect_locations.py index a3385f0eb3bb..b0decc0c5294 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_interconnect_locations.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_interconnect_locations.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 @@ -106,6 +107,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" @@ -2047,7 +2063,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetInterconnectLocationRequest() - assert args[0] == request_msg @@ -2067,7 +2082,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListInterconnectLocationsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_interconnect_remote_locations.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_interconnect_remote_locations.py index ee0f8e9dae75..cb327677a0e4 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_interconnect_remote_locations.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_interconnect_remote_locations.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 @@ -106,6 +107,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" @@ -2103,7 +2119,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetInterconnectRemoteLocationRequest() - assert args[0] == request_msg @@ -2123,7 +2138,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListInterconnectRemoteLocationsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_interconnects.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_interconnects.py index 46bd4d72e7e5..f6666abd4803 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_interconnects.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_interconnects.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 @@ -108,6 +109,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" @@ -5309,7 +5325,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteInterconnectRequest() - assert args[0] == request_msg @@ -5329,7 +5344,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetInterconnectRequest() - assert args[0] == request_msg @@ -5349,7 +5363,6 @@ def test_get_diagnostics_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetDiagnosticsInterconnectRequest() - assert args[0] == request_msg @@ -5371,7 +5384,6 @@ def test_get_macsec_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetMacsecConfigInterconnectRequest() - assert args[0] == request_msg @@ -5391,7 +5403,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertInterconnectRequest() - assert args[0] == request_msg @@ -5411,7 +5422,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListInterconnectsRequest() - assert args[0] == request_msg @@ -5431,7 +5441,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchInterconnectRequest() - assert args[0] == request_msg @@ -5451,7 +5460,6 @@ def test_set_labels_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetLabelsInterconnectRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_license_codes.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_license_codes.py index c277dd20ad22..91bc89ac8379 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_license_codes.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_license_codes.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 @@ -105,6 +106,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" @@ -2770,7 +2786,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetLicenseCodeRequest() - assert args[0] == request_msg @@ -2790,7 +2805,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetIamPolicyLicenseCodeRequest() - assert args[0] == request_msg @@ -2810,7 +2824,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetIamPolicyLicenseCodeRequest() - assert args[0] == request_msg @@ -2832,7 +2845,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsLicenseCodeRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_licenses.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_licenses.py index 3e466edf2b4d..2cbc54d2bdbf 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_licenses.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_licenses.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 @@ -104,6 +105,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" @@ -5094,7 +5110,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteLicenseRequest() - assert args[0] == request_msg @@ -5114,7 +5129,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetLicenseRequest() - assert args[0] == request_msg @@ -5134,7 +5148,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetIamPolicyLicenseRequest() - assert args[0] == request_msg @@ -5154,7 +5167,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertLicenseRequest() - assert args[0] == request_msg @@ -5174,7 +5186,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListLicensesRequest() - assert args[0] == request_msg @@ -5194,7 +5205,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetIamPolicyLicenseRequest() - assert args[0] == request_msg @@ -5216,7 +5226,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsLicenseRequest() - assert args[0] == request_msg @@ -5236,7 +5245,6 @@ def test_update_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.UpdateLicenseRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_machine_images.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_machine_images.py index c87057d2c526..497bf9f25d7c 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_machine_images.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_machine_images.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 @@ -108,6 +109,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" @@ -5291,7 +5307,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteMachineImageRequest() - assert args[0] == request_msg @@ -5311,7 +5326,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetMachineImageRequest() - assert args[0] == request_msg @@ -5331,7 +5345,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetIamPolicyMachineImageRequest() - assert args[0] == request_msg @@ -5351,7 +5364,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertMachineImageRequest() - assert args[0] == request_msg @@ -5371,7 +5383,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListMachineImagesRequest() - assert args[0] == request_msg @@ -5391,7 +5402,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetIamPolicyMachineImageRequest() - assert args[0] == request_msg @@ -5411,7 +5421,6 @@ def test_set_labels_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetLabelsMachineImageRequest() - assert args[0] == request_msg @@ -5433,7 +5442,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsMachineImageRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_machine_types.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_machine_types.py index 55036313dfea..4c3c8dbf9610 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_machine_types.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_machine_types.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 @@ -106,6 +107,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" @@ -2394,7 +2410,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListMachineTypesRequest() - assert args[0] == request_msg @@ -2414,7 +2429,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetMachineTypeRequest() - assert args[0] == request_msg @@ -2434,7 +2448,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListMachineTypesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_network_attachments.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_network_attachments.py index 18b617c0681c..c50bd38c6c68 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_network_attachments.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_network_attachments.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 @@ -108,6 +109,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" @@ -5737,7 +5753,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListNetworkAttachmentsRequest() - assert args[0] == request_msg @@ -5757,7 +5772,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteNetworkAttachmentRequest() - assert args[0] == request_msg @@ -5777,7 +5791,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetNetworkAttachmentRequest() - assert args[0] == request_msg @@ -5797,7 +5810,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetIamPolicyNetworkAttachmentRequest() - assert args[0] == request_msg @@ -5817,7 +5829,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertNetworkAttachmentRequest() - assert args[0] == request_msg @@ -5837,7 +5848,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListNetworkAttachmentsRequest() - assert args[0] == request_msg @@ -5857,7 +5867,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchNetworkAttachmentRequest() - assert args[0] == request_msg @@ -5877,7 +5886,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetIamPolicyNetworkAttachmentRequest() - assert args[0] == request_msg @@ -5899,7 +5907,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsNetworkAttachmentRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_network_edge_security_services.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_network_edge_security_services.py index 8190d3cba605..4596d38dcfcc 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_network_edge_security_services.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_network_edge_security_services.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 @@ -108,6 +109,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" @@ -4170,7 +4186,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListNetworkEdgeSecurityServicesRequest() - assert args[0] == request_msg @@ -4190,7 +4205,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteNetworkEdgeSecurityServiceRequest() - assert args[0] == request_msg @@ -4210,7 +4224,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetNetworkEdgeSecurityServiceRequest() - assert args[0] == request_msg @@ -4230,7 +4243,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertNetworkEdgeSecurityServiceRequest() - assert args[0] == request_msg @@ -4250,7 +4262,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchNetworkEdgeSecurityServiceRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_network_endpoint_groups.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_network_endpoint_groups.py index bb228d6cf7ec..94f1b8cfcc42 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_network_endpoint_groups.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_network_endpoint_groups.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 @@ -108,6 +109,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" @@ -6214,7 +6230,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListNetworkEndpointGroupsRequest() - assert args[0] == request_msg @@ -6236,7 +6251,6 @@ def test_attach_network_endpoints_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AttachNetworkEndpointsNetworkEndpointGroupRequest() - assert args[0] == request_msg @@ -6256,7 +6270,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteNetworkEndpointGroupRequest() - assert args[0] == request_msg @@ -6278,7 +6291,6 @@ def test_detach_network_endpoints_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DetachNetworkEndpointsNetworkEndpointGroupRequest() - assert args[0] == request_msg @@ -6298,7 +6310,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetNetworkEndpointGroupRequest() - assert args[0] == request_msg @@ -6318,7 +6329,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertNetworkEndpointGroupRequest() - assert args[0] == request_msg @@ -6338,7 +6348,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListNetworkEndpointGroupsRequest() - assert args[0] == request_msg @@ -6360,7 +6369,6 @@ def test_list_network_endpoints_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListNetworkEndpointsNetworkEndpointGroupsRequest() - assert args[0] == request_msg @@ -6382,7 +6390,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsNetworkEndpointGroupRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_network_firewall_policies.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_network_firewall_policies.py index da7ca3c189ef..60f17133d250 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_network_firewall_policies.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_network_firewall_policies.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 @@ -108,6 +109,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" @@ -12834,7 +12850,6 @@ def test_add_association_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AddAssociationNetworkFirewallPolicyRequest() - assert args[0] == request_msg @@ -12856,7 +12871,6 @@ def test_add_packet_mirroring_rule_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AddPacketMirroringRuleNetworkFirewallPolicyRequest() - assert args[0] == request_msg @@ -12876,7 +12890,6 @@ def test_add_rule_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AddRuleNetworkFirewallPolicyRequest() - assert args[0] == request_msg @@ -12896,7 +12909,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListNetworkFirewallPoliciesRequest() - assert args[0] == request_msg @@ -12916,7 +12928,6 @@ def test_clone_rules_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.CloneRulesNetworkFirewallPolicyRequest() - assert args[0] == request_msg @@ -12936,7 +12947,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteNetworkFirewallPolicyRequest() - assert args[0] == request_msg @@ -12956,7 +12966,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetNetworkFirewallPolicyRequest() - assert args[0] == request_msg @@ -12976,7 +12985,6 @@ def test_get_association_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetAssociationNetworkFirewallPolicyRequest() - assert args[0] == request_msg @@ -12996,7 +13004,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetIamPolicyNetworkFirewallPolicyRequest() - assert args[0] == request_msg @@ -13018,7 +13025,6 @@ def test_get_packet_mirroring_rule_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetPacketMirroringRuleNetworkFirewallPolicyRequest() - assert args[0] == request_msg @@ -13038,7 +13044,6 @@ def test_get_rule_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRuleNetworkFirewallPolicyRequest() - assert args[0] == request_msg @@ -13058,7 +13063,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertNetworkFirewallPolicyRequest() - assert args[0] == request_msg @@ -13078,7 +13082,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListNetworkFirewallPoliciesRequest() - assert args[0] == request_msg @@ -13098,7 +13101,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchNetworkFirewallPolicyRequest() - assert args[0] == request_msg @@ -13120,7 +13122,6 @@ def test_patch_packet_mirroring_rule_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchPacketMirroringRuleNetworkFirewallPolicyRequest() - assert args[0] == request_msg @@ -13140,7 +13141,6 @@ def test_patch_rule_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchRuleNetworkFirewallPolicyRequest() - assert args[0] == request_msg @@ -13162,7 +13162,6 @@ def test_remove_association_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.RemoveAssociationNetworkFirewallPolicyRequest() - assert args[0] == request_msg @@ -13184,7 +13183,6 @@ def test_remove_packet_mirroring_rule_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.RemovePacketMirroringRuleNetworkFirewallPolicyRequest() - assert args[0] == request_msg @@ -13204,7 +13202,6 @@ def test_remove_rule_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.RemoveRuleNetworkFirewallPolicyRequest() - assert args[0] == request_msg @@ -13224,7 +13221,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetIamPolicyNetworkFirewallPolicyRequest() - assert args[0] == request_msg @@ -13246,7 +13242,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsNetworkFirewallPolicyRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_network_profiles.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_network_profiles.py index b98a8351e93d..19c4a4d8f2f4 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_network_profiles.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_network_profiles.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 @@ -106,6 +107,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" @@ -1992,7 +2008,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetNetworkProfileRequest() - assert args[0] == request_msg @@ -2012,7 +2027,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListNetworkProfilesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_networks.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_networks.py index b3fefdb89e2f..460953b57cc6 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_networks.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_networks.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 @@ -104,6 +105,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" @@ -8585,7 +8601,6 @@ def test_add_peering_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AddPeeringNetworkRequest() - assert args[0] == request_msg @@ -8607,7 +8622,6 @@ def test_cancel_request_remove_peering_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.CancelRequestRemovePeeringNetworkRequest() - assert args[0] == request_msg @@ -8627,7 +8641,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteNetworkRequest() - assert args[0] == request_msg @@ -8647,7 +8660,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetNetworkRequest() - assert args[0] == request_msg @@ -8669,7 +8681,6 @@ def test_get_effective_firewalls_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetEffectiveFirewallsNetworkRequest() - assert args[0] == request_msg @@ -8689,7 +8700,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertNetworkRequest() - assert args[0] == request_msg @@ -8709,7 +8719,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListNetworksRequest() - assert args[0] == request_msg @@ -8731,7 +8740,6 @@ def test_list_peering_routes_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListPeeringRoutesNetworksRequest() - assert args[0] == request_msg @@ -8751,7 +8759,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchNetworkRequest() - assert args[0] == request_msg @@ -8771,7 +8778,6 @@ def test_remove_peering_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.RemovePeeringNetworkRequest() - assert args[0] == request_msg @@ -8793,7 +8799,6 @@ def test_request_remove_peering_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.RequestRemovePeeringNetworkRequest() - assert args[0] == request_msg @@ -8815,7 +8820,6 @@ def test_switch_to_custom_mode_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SwitchToCustomModeNetworkRequest() - assert args[0] == request_msg @@ -8835,7 +8839,6 @@ def test_update_peering_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.UpdatePeeringNetworkRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_node_groups.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_node_groups.py index df49bc3fd52d..c39a677f4f57 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_node_groups.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_node_groups.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 @@ -108,6 +109,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" @@ -9478,7 +9494,6 @@ def test_add_nodes_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AddNodesNodeGroupRequest() - assert args[0] == request_msg @@ -9498,7 +9513,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListNodeGroupsRequest() - assert args[0] == request_msg @@ -9518,7 +9532,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteNodeGroupRequest() - assert args[0] == request_msg @@ -9538,7 +9551,6 @@ def test_delete_nodes_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteNodesNodeGroupRequest() - assert args[0] == request_msg @@ -9558,7 +9570,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetNodeGroupRequest() - assert args[0] == request_msg @@ -9578,7 +9589,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetIamPolicyNodeGroupRequest() - assert args[0] == request_msg @@ -9598,7 +9608,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertNodeGroupRequest() - assert args[0] == request_msg @@ -9618,7 +9627,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListNodeGroupsRequest() - assert args[0] == request_msg @@ -9638,7 +9646,6 @@ def test_list_nodes_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListNodesNodeGroupsRequest() - assert args[0] == request_msg @@ -9658,7 +9665,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchNodeGroupRequest() - assert args[0] == request_msg @@ -9680,7 +9686,6 @@ def test_perform_maintenance_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PerformMaintenanceNodeGroupRequest() - assert args[0] == request_msg @@ -9700,7 +9705,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetIamPolicyNodeGroupRequest() - assert args[0] == request_msg @@ -9722,7 +9726,6 @@ def test_set_node_template_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetNodeTemplateNodeGroupRequest() - assert args[0] == request_msg @@ -9744,7 +9747,6 @@ def test_simulate_maintenance_event_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SimulateMaintenanceEventNodeGroupRequest() - assert args[0] == request_msg @@ -9766,7 +9768,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsNodeGroupRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_node_templates.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_node_templates.py index 381f94f36145..e9d9bd6e746f 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_node_templates.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_node_templates.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 @@ -108,6 +109,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" @@ -4905,7 +4921,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListNodeTemplatesRequest() - assert args[0] == request_msg @@ -4925,7 +4940,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteNodeTemplateRequest() - assert args[0] == request_msg @@ -4945,7 +4959,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetNodeTemplateRequest() - assert args[0] == request_msg @@ -4965,7 +4978,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetIamPolicyNodeTemplateRequest() - assert args[0] == request_msg @@ -4985,7 +4997,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertNodeTemplateRequest() - assert args[0] == request_msg @@ -5005,7 +5016,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListNodeTemplatesRequest() - assert args[0] == request_msg @@ -5025,7 +5035,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetIamPolicyNodeTemplateRequest() - assert args[0] == request_msg @@ -5047,7 +5056,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsNodeTemplateRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_node_types.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_node_types.py index bf2f65e73731..9e95270b39da 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_node_types.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_node_types.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 @@ -106,6 +107,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" @@ -2368,7 +2384,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListNodeTypesRequest() - assert args[0] == request_msg @@ -2388,7 +2403,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetNodeTypeRequest() - assert args[0] == request_msg @@ -2408,7 +2422,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListNodeTypesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_organization_security_policies.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_organization_security_policies.py index 40bed8157cbf..8c1822bf2bf2 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_organization_security_policies.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_organization_security_policies.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 @@ -108,6 +109,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" @@ -9577,7 +9593,6 @@ def test_add_association_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AddAssociationOrganizationSecurityPolicyRequest() - assert args[0] == request_msg @@ -9597,7 +9612,6 @@ def test_add_rule_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AddRuleOrganizationSecurityPolicyRequest() - assert args[0] == request_msg @@ -9617,7 +9631,6 @@ def test_copy_rules_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.CopyRulesOrganizationSecurityPolicyRequest() - assert args[0] == request_msg @@ -9637,7 +9650,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteOrganizationSecurityPolicyRequest() - assert args[0] == request_msg @@ -9657,7 +9669,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetOrganizationSecurityPolicyRequest() - assert args[0] == request_msg @@ -9677,7 +9688,6 @@ def test_get_association_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetAssociationOrganizationSecurityPolicyRequest() - assert args[0] == request_msg @@ -9697,7 +9707,6 @@ def test_get_rule_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRuleOrganizationSecurityPolicyRequest() - assert args[0] == request_msg @@ -9717,7 +9726,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertOrganizationSecurityPolicyRequest() - assert args[0] == request_msg @@ -9737,7 +9745,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListOrganizationSecurityPoliciesRequest() - assert args[0] == request_msg @@ -9759,7 +9766,6 @@ def test_list_associations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListAssociationsOrganizationSecurityPolicyRequest() - assert args[0] == request_msg @@ -9783,7 +9789,6 @@ def test_list_preconfigured_expression_sets_empty_call_rest(): request_msg = ( compute.ListPreconfiguredExpressionSetsOrganizationSecurityPoliciesRequest() ) - assert args[0] == request_msg @@ -9803,7 +9808,6 @@ def test_move_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.MoveOrganizationSecurityPolicyRequest() - assert args[0] == request_msg @@ -9823,7 +9827,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchOrganizationSecurityPolicyRequest() - assert args[0] == request_msg @@ -9843,7 +9846,6 @@ def test_patch_rule_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchRuleOrganizationSecurityPolicyRequest() - assert args[0] == request_msg @@ -9865,7 +9867,6 @@ def test_remove_association_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.RemoveAssociationOrganizationSecurityPolicyRequest() - assert args[0] == request_msg @@ -9885,7 +9886,6 @@ def test_remove_rule_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.RemoveRuleOrganizationSecurityPolicyRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_packet_mirrorings.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_packet_mirrorings.py index 7f91476f1b31..d21741de55f4 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_packet_mirrorings.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_packet_mirrorings.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 @@ -108,6 +109,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" @@ -4869,7 +4885,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListPacketMirroringsRequest() - assert args[0] == request_msg @@ -4889,7 +4904,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeletePacketMirroringRequest() - assert args[0] == request_msg @@ -4909,7 +4923,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetPacketMirroringRequest() - assert args[0] == request_msg @@ -4929,7 +4942,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertPacketMirroringRequest() - assert args[0] == request_msg @@ -4949,7 +4961,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListPacketMirroringsRequest() - assert args[0] == request_msg @@ -4969,7 +4980,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchPacketMirroringRequest() - assert args[0] == request_msg @@ -4991,7 +5001,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsPacketMirroringRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_preview_features.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_preview_features.py index d37d4618f850..14bbde257666 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_preview_features.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_preview_features.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 @@ -108,6 +109,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" @@ -2657,7 +2673,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetPreviewFeatureRequest() - assert args[0] == request_msg @@ -2677,7 +2692,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListPreviewFeaturesRequest() - assert args[0] == request_msg @@ -2697,7 +2711,6 @@ def test_update_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.UpdatePreviewFeatureRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_projects.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_projects.py index a8189708c1ee..dcc290ca63b5 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_projects.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_projects.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 @@ -104,6 +105,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" @@ -9043,7 +9059,6 @@ def test_disable_xpn_host_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DisableXpnHostProjectRequest() - assert args[0] == request_msg @@ -9065,7 +9080,6 @@ def test_disable_xpn_resource_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DisableXpnResourceProjectRequest() - assert args[0] == request_msg @@ -9085,7 +9099,6 @@ def test_enable_xpn_host_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.EnableXpnHostProjectRequest() - assert args[0] == request_msg @@ -9107,7 +9120,6 @@ def test_enable_xpn_resource_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.EnableXpnResourceProjectRequest() - assert args[0] == request_msg @@ -9127,7 +9139,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetProjectRequest() - assert args[0] == request_msg @@ -9147,7 +9158,6 @@ def test_get_xpn_host_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetXpnHostProjectRequest() - assert args[0] == request_msg @@ -9169,7 +9179,6 @@ def test_get_xpn_resources_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetXpnResourcesProjectsRequest() - assert args[0] == request_msg @@ -9189,7 +9198,6 @@ def test_list_xpn_hosts_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListXpnHostsProjectsRequest() - assert args[0] == request_msg @@ -9209,7 +9217,6 @@ def test_move_disk_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.MoveDiskProjectRequest() - assert args[0] == request_msg @@ -9229,7 +9236,6 @@ def test_move_instance_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.MoveInstanceProjectRequest() - assert args[0] == request_msg @@ -9251,7 +9257,6 @@ def test_set_cloud_armor_tier_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetCloudArmorTierProjectRequest() - assert args[0] == request_msg @@ -9273,7 +9278,6 @@ def test_set_common_instance_metadata_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetCommonInstanceMetadataProjectRequest() - assert args[0] == request_msg @@ -9295,7 +9299,6 @@ def test_set_default_network_tier_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetDefaultNetworkTierProjectRequest() - assert args[0] == request_msg @@ -9317,7 +9320,6 @@ def test_set_usage_export_bucket_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetUsageExportBucketProjectRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_public_advertised_prefixes.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_public_advertised_prefixes.py index 8a25c2954479..297b511c6c43 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_public_advertised_prefixes.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_public_advertised_prefixes.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 @@ -108,6 +109,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" @@ -5131,7 +5147,6 @@ def test_announce_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AnnouncePublicAdvertisedPrefixeRequest() - assert args[0] == request_msg @@ -5151,7 +5166,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeletePublicAdvertisedPrefixeRequest() - assert args[0] == request_msg @@ -5171,7 +5185,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetPublicAdvertisedPrefixeRequest() - assert args[0] == request_msg @@ -5191,7 +5204,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertPublicAdvertisedPrefixeRequest() - assert args[0] == request_msg @@ -5211,7 +5223,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListPublicAdvertisedPrefixesRequest() - assert args[0] == request_msg @@ -5231,7 +5242,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchPublicAdvertisedPrefixeRequest() - assert args[0] == request_msg @@ -5251,7 +5261,6 @@ def test_withdraw_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.WithdrawPublicAdvertisedPrefixeRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_public_delegated_prefixes.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_public_delegated_prefixes.py index 055e60a6af20..9c622ec0c012 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_public_delegated_prefixes.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_public_delegated_prefixes.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 @@ -108,6 +109,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" @@ -5714,7 +5730,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListPublicDelegatedPrefixesRequest() - assert args[0] == request_msg @@ -5734,7 +5749,6 @@ def test_announce_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AnnouncePublicDelegatedPrefixeRequest() - assert args[0] == request_msg @@ -5754,7 +5768,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeletePublicDelegatedPrefixeRequest() - assert args[0] == request_msg @@ -5774,7 +5787,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetPublicDelegatedPrefixeRequest() - assert args[0] == request_msg @@ -5794,7 +5806,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertPublicDelegatedPrefixeRequest() - assert args[0] == request_msg @@ -5814,7 +5825,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListPublicDelegatedPrefixesRequest() - assert args[0] == request_msg @@ -5834,7 +5844,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchPublicDelegatedPrefixeRequest() - assert args[0] == request_msg @@ -5854,7 +5863,6 @@ def test_withdraw_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.WithdrawPublicDelegatedPrefixeRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_autoscalers.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_autoscalers.py index 5b15b2dffb9b..bfc8bbb7a6fd 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_autoscalers.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_autoscalers.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 @@ -108,6 +109,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" @@ -5169,7 +5185,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteRegionAutoscalerRequest() - assert args[0] == request_msg @@ -5189,7 +5204,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRegionAutoscalerRequest() - assert args[0] == request_msg @@ -5209,7 +5223,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertRegionAutoscalerRequest() - assert args[0] == request_msg @@ -5229,7 +5242,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRegionAutoscalersRequest() - assert args[0] == request_msg @@ -5249,7 +5261,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchRegionAutoscalerRequest() - assert args[0] == request_msg @@ -5271,7 +5282,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsRegionAutoscalerRequest() - assert args[0] == request_msg @@ -5291,7 +5301,6 @@ def test_update_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.UpdateRegionAutoscalerRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_backend_buckets.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_backend_buckets.py index 259a236d581d..75ee6ca17d7f 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_backend_buckets.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_backend_buckets.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 @@ -108,6 +109,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" @@ -5719,7 +5735,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteRegionBackendBucketRequest() - assert args[0] == request_msg @@ -5739,7 +5754,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRegionBackendBucketRequest() - assert args[0] == request_msg @@ -5759,7 +5773,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetIamPolicyRegionBackendBucketRequest() - assert args[0] == request_msg @@ -5779,7 +5792,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertRegionBackendBucketRequest() - assert args[0] == request_msg @@ -5799,7 +5811,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRegionBackendBucketsRequest() - assert args[0] == request_msg @@ -5819,7 +5830,6 @@ def test_list_usable_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListUsableRegionBackendBucketsRequest() - assert args[0] == request_msg @@ -5839,7 +5849,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchRegionBackendBucketRequest() - assert args[0] == request_msg @@ -5859,7 +5868,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetIamPolicyRegionBackendBucketRequest() - assert args[0] == request_msg @@ -5881,7 +5889,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsRegionBackendBucketRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_backend_services.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_backend_services.py index 2ee37b1360ce..0b632d8e895b 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_backend_services.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_backend_services.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 @@ -108,6 +109,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" @@ -8095,7 +8111,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteRegionBackendServiceRequest() - assert args[0] == request_msg @@ -8115,7 +8130,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRegionBackendServiceRequest() - assert args[0] == request_msg @@ -8135,7 +8149,6 @@ def test_get_health_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetHealthRegionBackendServiceRequest() - assert args[0] == request_msg @@ -8155,7 +8168,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetIamPolicyRegionBackendServiceRequest() - assert args[0] == request_msg @@ -8175,7 +8187,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertRegionBackendServiceRequest() - assert args[0] == request_msg @@ -8195,7 +8206,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRegionBackendServicesRequest() - assert args[0] == request_msg @@ -8215,7 +8225,6 @@ def test_list_usable_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListUsableRegionBackendServicesRequest() - assert args[0] == request_msg @@ -8235,7 +8244,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchRegionBackendServiceRequest() - assert args[0] == request_msg @@ -8255,7 +8263,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetIamPolicyRegionBackendServiceRequest() - assert args[0] == request_msg @@ -8277,7 +8284,6 @@ def test_set_security_policy_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetSecurityPolicyRegionBackendServiceRequest() - assert args[0] == request_msg @@ -8299,7 +8305,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsRegionBackendServiceRequest() - assert args[0] == request_msg @@ -8319,7 +8324,6 @@ def test_update_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.UpdateRegionBackendServiceRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_commitments.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_commitments.py index a582df2c2b5c..70b298963d6e 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_commitments.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_commitments.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 @@ -108,6 +109,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" @@ -4086,7 +4102,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListRegionCommitmentsRequest() - assert args[0] == request_msg @@ -4106,7 +4121,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRegionCommitmentRequest() - assert args[0] == request_msg @@ -4126,7 +4140,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertRegionCommitmentRequest() - assert args[0] == request_msg @@ -4146,7 +4159,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRegionCommitmentsRequest() - assert args[0] == request_msg @@ -4166,7 +4178,6 @@ def test_update_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.UpdateRegionCommitmentRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_composite_health_checks.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_composite_health_checks.py index 4da514f8c46a..4d78dea1257f 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_composite_health_checks.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_composite_health_checks.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 @@ -108,6 +109,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" @@ -5280,7 +5296,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListRegionCompositeHealthChecksRequest() - assert args[0] == request_msg @@ -5300,7 +5315,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteRegionCompositeHealthCheckRequest() - assert args[0] == request_msg @@ -5320,7 +5334,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRegionCompositeHealthCheckRequest() - assert args[0] == request_msg @@ -5340,7 +5353,6 @@ def test_get_health_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetHealthRegionCompositeHealthCheckRequest() - assert args[0] == request_msg @@ -5360,7 +5372,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertRegionCompositeHealthCheckRequest() - assert args[0] == request_msg @@ -5380,7 +5391,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRegionCompositeHealthChecksRequest() - assert args[0] == request_msg @@ -5400,7 +5410,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchRegionCompositeHealthCheckRequest() - assert args[0] == request_msg @@ -5422,7 +5431,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsRegionCompositeHealthCheckRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_disk_types.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_disk_types.py index a22eb6cc1b3c..0beffe9a940c 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_disk_types.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_disk_types.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 @@ -106,6 +107,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" @@ -2007,7 +2023,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRegionDiskTypeRequest() - assert args[0] == request_msg @@ -2027,7 +2042,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRegionDiskTypesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_disks.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_disks.py index b3cf4010db1b..cc4c565a9e8d 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_disks.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_disks.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 @@ -108,6 +109,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" @@ -12066,7 +12082,6 @@ def test_add_resource_policies_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AddResourcePoliciesRegionDiskRequest() - assert args[0] == request_msg @@ -12086,7 +12101,6 @@ def test_bulk_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.BulkInsertRegionDiskRequest() - assert args[0] == request_msg @@ -12106,7 +12120,6 @@ def test_create_snapshot_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.CreateSnapshotRegionDiskRequest() - assert args[0] == request_msg @@ -12126,7 +12139,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteRegionDiskRequest() - assert args[0] == request_msg @@ -12146,7 +12158,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRegionDiskRequest() - assert args[0] == request_msg @@ -12166,7 +12177,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetIamPolicyRegionDiskRequest() - assert args[0] == request_msg @@ -12186,7 +12196,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertRegionDiskRequest() - assert args[0] == request_msg @@ -12206,7 +12215,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRegionDisksRequest() - assert args[0] == request_msg @@ -12228,7 +12236,6 @@ def test_remove_resource_policies_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.RemoveResourcePoliciesRegionDiskRequest() - assert args[0] == request_msg @@ -12248,7 +12255,6 @@ def test_resize_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ResizeRegionDiskRequest() - assert args[0] == request_msg @@ -12268,7 +12274,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetIamPolicyRegionDiskRequest() - assert args[0] == request_msg @@ -12288,7 +12293,6 @@ def test_set_labels_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetLabelsRegionDiskRequest() - assert args[0] == request_msg @@ -12310,7 +12314,6 @@ def test_start_async_replication_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.StartAsyncReplicationRegionDiskRequest() - assert args[0] == request_msg @@ -12332,7 +12335,6 @@ def test_stop_async_replication_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.StopAsyncReplicationRegionDiskRequest() - assert args[0] == request_msg @@ -12354,7 +12356,6 @@ def test_stop_group_async_replication_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.StopGroupAsyncReplicationRegionDiskRequest() - assert args[0] == request_msg @@ -12376,7 +12377,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsRegionDiskRequest() - assert args[0] == request_msg @@ -12396,7 +12396,6 @@ def test_update_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.UpdateRegionDiskRequest() - assert args[0] == request_msg @@ -12416,7 +12415,6 @@ def test_update_kms_key_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.UpdateKmsKeyRegionDiskRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_health_aggregation_policies.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_health_aggregation_policies.py index 079b5f418f29..be62503c7a1e 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_health_aggregation_policies.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_health_aggregation_policies.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 @@ -108,6 +109,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" @@ -4989,7 +5005,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListRegionHealthAggregationPoliciesRequest() - assert args[0] == request_msg @@ -5009,7 +5024,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteRegionHealthAggregationPolicyRequest() - assert args[0] == request_msg @@ -5029,7 +5043,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRegionHealthAggregationPolicyRequest() - assert args[0] == request_msg @@ -5049,7 +5062,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertRegionHealthAggregationPolicyRequest() - assert args[0] == request_msg @@ -5069,7 +5081,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRegionHealthAggregationPoliciesRequest() - assert args[0] == request_msg @@ -5089,7 +5100,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchRegionHealthAggregationPolicyRequest() - assert args[0] == request_msg @@ -5111,7 +5121,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsRegionHealthAggregationPolicyRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_health_check_services.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_health_check_services.py index 26aa6e15704e..5943a6710b2b 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_health_check_services.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_health_check_services.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 @@ -108,6 +109,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" @@ -4922,7 +4938,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListRegionHealthCheckServicesRequest() - assert args[0] == request_msg @@ -4942,7 +4957,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteRegionHealthCheckServiceRequest() - assert args[0] == request_msg @@ -4962,7 +4976,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRegionHealthCheckServiceRequest() - assert args[0] == request_msg @@ -4982,7 +4995,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertRegionHealthCheckServiceRequest() - assert args[0] == request_msg @@ -5002,7 +5014,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRegionHealthCheckServicesRequest() - assert args[0] == request_msg @@ -5022,7 +5033,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchRegionHealthCheckServiceRequest() - assert args[0] == request_msg @@ -5044,7 +5054,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsRegionHealthCheckServiceRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_health_checks.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_health_checks.py index 3ad92a859f52..609d716a8edc 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_health_checks.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_health_checks.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 @@ -108,6 +109,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" @@ -5270,7 +5286,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteRegionHealthCheckRequest() - assert args[0] == request_msg @@ -5290,7 +5305,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRegionHealthCheckRequest() - assert args[0] == request_msg @@ -5310,7 +5324,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertRegionHealthCheckRequest() - assert args[0] == request_msg @@ -5330,7 +5343,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRegionHealthChecksRequest() - assert args[0] == request_msg @@ -5350,7 +5362,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchRegionHealthCheckRequest() - assert args[0] == request_msg @@ -5372,7 +5383,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsRegionHealthCheckRequest() - assert args[0] == request_msg @@ -5392,7 +5402,6 @@ def test_update_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.UpdateRegionHealthCheckRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_health_sources.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_health_sources.py index 9f72a5d292ae..63e76cd74312 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_health_sources.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_health_sources.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 @@ -108,6 +109,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" @@ -5202,7 +5218,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListRegionHealthSourcesRequest() - assert args[0] == request_msg @@ -5222,7 +5237,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteRegionHealthSourceRequest() - assert args[0] == request_msg @@ -5242,7 +5256,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRegionHealthSourceRequest() - assert args[0] == request_msg @@ -5262,7 +5275,6 @@ def test_get_health_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetHealthRegionHealthSourceRequest() - assert args[0] == request_msg @@ -5282,7 +5294,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertRegionHealthSourceRequest() - assert args[0] == request_msg @@ -5302,7 +5313,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRegionHealthSourcesRequest() - assert args[0] == request_msg @@ -5322,7 +5332,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchRegionHealthSourceRequest() - assert args[0] == request_msg @@ -5344,7 +5353,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsRegionHealthSourceRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_instance_group_manager_resize_requests.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_instance_group_manager_resize_requests.py index 46c9ea2449b4..69ddcb3b1704 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_instance_group_manager_resize_requests.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_instance_group_manager_resize_requests.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 @@ -108,6 +109,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" @@ -4192,7 +4208,6 @@ def test_cancel_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.CancelRegionInstanceGroupManagerResizeRequestRequest() - assert args[0] == request_msg @@ -4212,7 +4227,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteRegionInstanceGroupManagerResizeRequestRequest() - assert args[0] == request_msg @@ -4232,7 +4246,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRegionInstanceGroupManagerResizeRequestRequest() - assert args[0] == request_msg @@ -4252,7 +4265,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertRegionInstanceGroupManagerResizeRequestRequest() - assert args[0] == request_msg @@ -4272,7 +4284,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRegionInstanceGroupManagerResizeRequestsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_instance_group_managers.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_instance_group_managers.py index c06499f55fd2..e40ba0bb7c04 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_instance_group_managers.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_instance_group_managers.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 @@ -108,6 +109,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" @@ -16384,7 +16400,6 @@ def test_abandon_instances_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AbandonInstancesRegionInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -16406,7 +16421,6 @@ def test_apply_updates_to_instances_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ApplyUpdatesToInstancesRegionInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -16426,7 +16440,6 @@ def test_create_instances_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.CreateInstancesRegionInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -16446,7 +16459,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteRegionInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -16466,7 +16478,6 @@ def test_delete_instances_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteInstancesRegionInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -16490,7 +16501,6 @@ def test_delete_per_instance_configs_unary_empty_call_rest(): request_msg = ( compute.DeletePerInstanceConfigsRegionInstanceGroupManagerRequest() ) - assert args[0] == request_msg @@ -16510,7 +16520,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRegionInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -16530,7 +16539,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertRegionInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -16550,7 +16558,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRegionInstanceGroupManagersRequest() - assert args[0] == request_msg @@ -16570,7 +16577,6 @@ def test_list_errors_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListErrorsRegionInstanceGroupManagersRequest() - assert args[0] == request_msg @@ -16592,7 +16598,6 @@ def test_list_managed_instances_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListManagedInstancesRegionInstanceGroupManagersRequest() - assert args[0] == request_msg @@ -16614,7 +16619,6 @@ def test_list_per_instance_configs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListPerInstanceConfigsRegionInstanceGroupManagersRequest() - assert args[0] == request_msg @@ -16634,7 +16638,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchRegionInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -16656,7 +16659,6 @@ def test_patch_per_instance_configs_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchPerInstanceConfigsRegionInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -16678,7 +16680,6 @@ def test_recreate_instances_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.RecreateInstancesRegionInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -16698,7 +16699,6 @@ def test_resize_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ResizeRegionInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -16718,7 +16718,6 @@ def test_resume_instances_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ResumeInstancesRegionInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -16740,7 +16739,6 @@ def test_set_instance_template_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetInstanceTemplateRegionInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -16760,7 +16758,6 @@ def test_set_target_pools_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetTargetPoolsRegionInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -16780,7 +16777,6 @@ def test_start_instances_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.StartInstancesRegionInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -16800,7 +16796,6 @@ def test_stop_instances_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.StopInstancesRegionInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -16822,7 +16817,6 @@ def test_suspend_instances_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SuspendInstancesRegionInstanceGroupManagerRequest() - assert args[0] == request_msg @@ -16846,7 +16840,6 @@ def test_update_per_instance_configs_unary_empty_call_rest(): request_msg = ( compute.UpdatePerInstanceConfigsRegionInstanceGroupManagerRequest() ) - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_instance_groups.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_instance_groups.py index 0ed89718104b..03a6fe171d7b 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_instance_groups.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_instance_groups.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 @@ -108,6 +109,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" @@ -3721,7 +3737,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRegionInstanceGroupRequest() - assert args[0] == request_msg @@ -3741,7 +3756,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRegionInstanceGroupsRequest() - assert args[0] == request_msg @@ -3761,7 +3775,6 @@ def test_list_instances_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListInstancesRegionInstanceGroupsRequest() - assert args[0] == request_msg @@ -3781,7 +3794,6 @@ def test_set_named_ports_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetNamedPortsRegionInstanceGroupRequest() - assert args[0] == request_msg @@ -3803,7 +3815,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsRegionInstanceGroupRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_instance_templates.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_instance_templates.py index 4b648274d71d..dfc00ca57de9 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_instance_templates.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_instance_templates.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 @@ -108,6 +109,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" @@ -3522,7 +3538,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteRegionInstanceTemplateRequest() - assert args[0] == request_msg @@ -3542,7 +3557,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRegionInstanceTemplateRequest() - assert args[0] == request_msg @@ -3562,7 +3576,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertRegionInstanceTemplateRequest() - assert args[0] == request_msg @@ -3582,7 +3595,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRegionInstanceTemplatesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_instances.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_instances.py index 3f63ec263dee..00f1ed6062cd 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_instances.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_instances.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 @@ -107,6 +108,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" @@ -2125,7 +2141,6 @@ def test_bulk_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.BulkInsertRegionInstanceRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_instant_snapshot_groups.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_instant_snapshot_groups.py index acd50831390a..712cbce3b774 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_instant_snapshot_groups.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_instant_snapshot_groups.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 @@ -108,6 +109,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" @@ -4641,7 +4657,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteRegionInstantSnapshotGroupRequest() - assert args[0] == request_msg @@ -4661,7 +4676,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRegionInstantSnapshotGroupRequest() - assert args[0] == request_msg @@ -4681,7 +4695,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetIamPolicyRegionInstantSnapshotGroupRequest() - assert args[0] == request_msg @@ -4701,7 +4714,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertRegionInstantSnapshotGroupRequest() - assert args[0] == request_msg @@ -4721,7 +4733,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRegionInstantSnapshotGroupsRequest() - assert args[0] == request_msg @@ -4741,7 +4752,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetIamPolicyRegionInstantSnapshotGroupRequest() - assert args[0] == request_msg @@ -4763,7 +4773,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsRegionInstantSnapshotGroupRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_instant_snapshots.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_instant_snapshots.py index e90d4a3a151f..84b07738f78f 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_instant_snapshots.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_instant_snapshots.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 @@ -108,6 +109,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" @@ -5278,7 +5294,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteRegionInstantSnapshotRequest() - assert args[0] == request_msg @@ -5298,7 +5313,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRegionInstantSnapshotRequest() - assert args[0] == request_msg @@ -5318,7 +5332,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetIamPolicyRegionInstantSnapshotRequest() - assert args[0] == request_msg @@ -5338,7 +5351,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertRegionInstantSnapshotRequest() - assert args[0] == request_msg @@ -5358,7 +5370,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRegionInstantSnapshotsRequest() - assert args[0] == request_msg @@ -5378,7 +5389,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetIamPolicyRegionInstantSnapshotRequest() - assert args[0] == request_msg @@ -5398,7 +5408,6 @@ def test_set_labels_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetLabelsRegionInstantSnapshotRequest() - assert args[0] == request_msg @@ -5420,7 +5429,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsRegionInstantSnapshotRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_network_endpoint_groups.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_network_endpoint_groups.py index a1d669f30c15..3c42fe43e578 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_network_endpoint_groups.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_network_endpoint_groups.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 @@ -108,6 +109,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" @@ -5323,7 +5339,6 @@ def test_attach_network_endpoints_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AttachNetworkEndpointsRegionNetworkEndpointGroupRequest() - assert args[0] == request_msg @@ -5343,7 +5358,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteRegionNetworkEndpointGroupRequest() - assert args[0] == request_msg @@ -5365,7 +5379,6 @@ def test_detach_network_endpoints_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DetachNetworkEndpointsRegionNetworkEndpointGroupRequest() - assert args[0] == request_msg @@ -5385,7 +5398,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRegionNetworkEndpointGroupRequest() - assert args[0] == request_msg @@ -5405,7 +5417,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertRegionNetworkEndpointGroupRequest() - assert args[0] == request_msg @@ -5425,7 +5436,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRegionNetworkEndpointGroupsRequest() - assert args[0] == request_msg @@ -5447,7 +5457,6 @@ def test_list_network_endpoints_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListNetworkEndpointsRegionNetworkEndpointGroupsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_network_firewall_policies.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_network_firewall_policies.py index 7c4b2fc7d924..04beb47edf64 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_network_firewall_policies.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_network_firewall_policies.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 @@ -108,6 +109,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" @@ -10743,7 +10759,6 @@ def test_add_association_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AddAssociationRegionNetworkFirewallPolicyRequest() - assert args[0] == request_msg @@ -10763,7 +10778,6 @@ def test_add_rule_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AddRuleRegionNetworkFirewallPolicyRequest() - assert args[0] == request_msg @@ -10783,7 +10797,6 @@ def test_clone_rules_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.CloneRulesRegionNetworkFirewallPolicyRequest() - assert args[0] == request_msg @@ -10803,7 +10816,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteRegionNetworkFirewallPolicyRequest() - assert args[0] == request_msg @@ -10823,7 +10835,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRegionNetworkFirewallPolicyRequest() - assert args[0] == request_msg @@ -10843,7 +10854,6 @@ def test_get_association_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetAssociationRegionNetworkFirewallPolicyRequest() - assert args[0] == request_msg @@ -10865,7 +10875,6 @@ def test_get_effective_firewalls_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetEffectiveFirewallsRegionNetworkFirewallPolicyRequest() - assert args[0] == request_msg @@ -10885,7 +10894,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetIamPolicyRegionNetworkFirewallPolicyRequest() - assert args[0] == request_msg @@ -10905,7 +10913,6 @@ def test_get_rule_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRuleRegionNetworkFirewallPolicyRequest() - assert args[0] == request_msg @@ -10925,7 +10932,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertRegionNetworkFirewallPolicyRequest() - assert args[0] == request_msg @@ -10945,7 +10951,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRegionNetworkFirewallPoliciesRequest() - assert args[0] == request_msg @@ -10965,7 +10970,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchRegionNetworkFirewallPolicyRequest() - assert args[0] == request_msg @@ -10985,7 +10989,6 @@ def test_patch_rule_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchRuleRegionNetworkFirewallPolicyRequest() - assert args[0] == request_msg @@ -11007,7 +11010,6 @@ def test_remove_association_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.RemoveAssociationRegionNetworkFirewallPolicyRequest() - assert args[0] == request_msg @@ -11027,7 +11029,6 @@ def test_remove_rule_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.RemoveRuleRegionNetworkFirewallPolicyRequest() - assert args[0] == request_msg @@ -11047,7 +11048,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetIamPolicyRegionNetworkFirewallPolicyRequest() - assert args[0] == request_msg @@ -11069,7 +11069,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsRegionNetworkFirewallPolicyRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_notification_endpoints.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_notification_endpoints.py index 5fa517e0e891..9840f4ded022 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_notification_endpoints.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_notification_endpoints.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 @@ -108,6 +109,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" @@ -4226,7 +4242,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListRegionNotificationEndpointsRequest() - assert args[0] == request_msg @@ -4246,7 +4261,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteRegionNotificationEndpointRequest() - assert args[0] == request_msg @@ -4266,7 +4280,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRegionNotificationEndpointRequest() - assert args[0] == request_msg @@ -4286,7 +4299,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertRegionNotificationEndpointRequest() - assert args[0] == request_msg @@ -4306,7 +4318,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRegionNotificationEndpointsRequest() - assert args[0] == request_msg @@ -4328,7 +4339,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsRegionNotificationEndpointRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_operations.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_operations.py index 751db857d426..06c43e5b25af 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_operations.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_operations.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 @@ -106,6 +107,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" @@ -2741,7 +2757,6 @@ def test_delete_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteRegionOperationRequest() - assert args[0] == request_msg @@ -2761,7 +2776,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRegionOperationRequest() - assert args[0] == request_msg @@ -2781,7 +2795,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRegionOperationsRequest() - assert args[0] == request_msg @@ -2801,7 +2814,6 @@ def test_wait_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.WaitRegionOperationRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_security_policies.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_security_policies.py index 80ddba0bc7f7..043f6ed7a477 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_security_policies.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_security_policies.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 @@ -108,6 +109,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" @@ -7650,7 +7666,6 @@ def test_add_rule_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AddRuleRegionSecurityPolicyRequest() - assert args[0] == request_msg @@ -7670,7 +7685,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteRegionSecurityPolicyRequest() - assert args[0] == request_msg @@ -7690,7 +7704,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRegionSecurityPolicyRequest() - assert args[0] == request_msg @@ -7710,7 +7723,6 @@ def test_get_rule_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRuleRegionSecurityPolicyRequest() - assert args[0] == request_msg @@ -7730,7 +7742,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertRegionSecurityPolicyRequest() - assert args[0] == request_msg @@ -7750,7 +7761,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRegionSecurityPoliciesRequest() - assert args[0] == request_msg @@ -7770,7 +7780,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchRegionSecurityPolicyRequest() - assert args[0] == request_msg @@ -7790,7 +7799,6 @@ def test_patch_rule_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchRuleRegionSecurityPolicyRequest() - assert args[0] == request_msg @@ -7810,7 +7818,6 @@ def test_remove_rule_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.RemoveRuleRegionSecurityPolicyRequest() - assert args[0] == request_msg @@ -7830,7 +7837,6 @@ def test_set_labels_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetLabelsRegionSecurityPolicyRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_snapshot_settings.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_snapshot_settings.py index 5a7f31d99fdf..4de4d90b5ecd 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_snapshot_settings.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_snapshot_settings.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 @@ -107,6 +108,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" @@ -2314,7 +2330,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRegionSnapshotSettingRequest() - assert args[0] == request_msg @@ -2334,7 +2349,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchRegionSnapshotSettingRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_snapshots.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_snapshots.py index f890fe46e1ac..b60558c60d73 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_snapshots.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_snapshots.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 @@ -108,6 +109,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" @@ -5947,7 +5963,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteRegionSnapshotRequest() - assert args[0] == request_msg @@ -5967,7 +5982,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRegionSnapshotRequest() - assert args[0] == request_msg @@ -5987,7 +6001,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetIamPolicyRegionSnapshotRequest() - assert args[0] == request_msg @@ -6007,7 +6020,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertRegionSnapshotRequest() - assert args[0] == request_msg @@ -6027,7 +6039,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRegionSnapshotsRequest() - assert args[0] == request_msg @@ -6047,7 +6058,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetIamPolicyRegionSnapshotRequest() - assert args[0] == request_msg @@ -6067,7 +6077,6 @@ def test_set_labels_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetLabelsRegionSnapshotRequest() - assert args[0] == request_msg @@ -6089,7 +6098,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsRegionSnapshotRequest() - assert args[0] == request_msg @@ -6109,7 +6117,6 @@ def test_update_kms_key_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.UpdateKmsKeyRegionSnapshotRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_ssl_certificates.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_ssl_certificates.py index 75e8f9fb4c80..c1007cc35f57 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_ssl_certificates.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_ssl_certificates.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 @@ -108,6 +109,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" @@ -3336,7 +3352,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteRegionSslCertificateRequest() - assert args[0] == request_msg @@ -3356,7 +3371,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRegionSslCertificateRequest() - assert args[0] == request_msg @@ -3376,7 +3390,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertRegionSslCertificateRequest() - assert args[0] == request_msg @@ -3396,7 +3409,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRegionSslCertificatesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_ssl_policies.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_ssl_policies.py index e69ff5b99602..2d86879f5160 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_ssl_policies.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_ssl_policies.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 @@ -108,6 +109,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" @@ -4332,7 +4348,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteRegionSslPolicyRequest() - assert args[0] == request_msg @@ -4352,7 +4367,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRegionSslPolicyRequest() - assert args[0] == request_msg @@ -4372,7 +4386,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertRegionSslPolicyRequest() - assert args[0] == request_msg @@ -4392,7 +4405,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRegionSslPoliciesRequest() - assert args[0] == request_msg @@ -4414,7 +4426,6 @@ def test_list_available_features_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListAvailableFeaturesRegionSslPoliciesRequest() - assert args[0] == request_msg @@ -4434,7 +4445,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchRegionSslPolicyRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_target_http_proxies.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_target_http_proxies.py index 8dd406c46c76..dac69375ca33 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_target_http_proxies.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_target_http_proxies.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 @@ -108,6 +109,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" @@ -4012,7 +4028,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteRegionTargetHttpProxyRequest() - assert args[0] == request_msg @@ -4032,7 +4047,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRegionTargetHttpProxyRequest() - assert args[0] == request_msg @@ -4052,7 +4066,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertRegionTargetHttpProxyRequest() - assert args[0] == request_msg @@ -4072,7 +4085,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRegionTargetHttpProxiesRequest() - assert args[0] == request_msg @@ -4092,7 +4104,6 @@ def test_set_url_map_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetUrlMapRegionTargetHttpProxyRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_target_https_proxies.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_target_https_proxies.py index 960deba76884..446e40b8001e 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_target_https_proxies.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_target_https_proxies.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 @@ -108,6 +109,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" @@ -5460,7 +5476,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteRegionTargetHttpsProxyRequest() - assert args[0] == request_msg @@ -5480,7 +5495,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRegionTargetHttpsProxyRequest() - assert args[0] == request_msg @@ -5500,7 +5514,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertRegionTargetHttpsProxyRequest() - assert args[0] == request_msg @@ -5520,7 +5533,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRegionTargetHttpsProxiesRequest() - assert args[0] == request_msg @@ -5540,7 +5552,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchRegionTargetHttpsProxyRequest() - assert args[0] == request_msg @@ -5562,7 +5573,6 @@ def test_set_ssl_certificates_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetSslCertificatesRegionTargetHttpsProxyRequest() - assert args[0] == request_msg @@ -5582,7 +5592,6 @@ def test_set_url_map_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetUrlMapRegionTargetHttpsProxyRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_target_tcp_proxies.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_target_tcp_proxies.py index 7d91246ab414..813ce0718222 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_target_tcp_proxies.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_target_tcp_proxies.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 @@ -108,6 +109,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" @@ -3326,7 +3342,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteRegionTargetTcpProxyRequest() - assert args[0] == request_msg @@ -3346,7 +3361,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRegionTargetTcpProxyRequest() - assert args[0] == request_msg @@ -3366,7 +3380,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertRegionTargetTcpProxyRequest() - assert args[0] == request_msg @@ -3386,7 +3399,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRegionTargetTcpProxiesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_url_maps.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_url_maps.py index 4e07ccc49a47..ad20e8f2d698 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_url_maps.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_url_maps.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 @@ -108,6 +109,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" @@ -5857,7 +5873,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteRegionUrlMapRequest() - assert args[0] == request_msg @@ -5877,7 +5892,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRegionUrlMapRequest() - assert args[0] == request_msg @@ -5897,7 +5911,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertRegionUrlMapRequest() - assert args[0] == request_msg @@ -5917,7 +5930,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRegionUrlMapsRequest() - assert args[0] == request_msg @@ -5937,7 +5949,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchRegionUrlMapRequest() - assert args[0] == request_msg @@ -5957,7 +5968,6 @@ def test_update_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.UpdateRegionUrlMapRequest() - assert args[0] == request_msg @@ -5977,7 +5987,6 @@ def test_validate_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ValidateRegionUrlMapRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_zones.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_zones.py index eb89ce9dd599..ecc04703cf04 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_zones.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_region_zones.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 @@ -106,6 +107,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" @@ -1622,7 +1638,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRegionZonesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_regions.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_regions.py index aa60ad4a94e1..d772ee5c8ce1 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_regions.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_regions.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 @@ -102,6 +103,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" @@ -1907,7 +1923,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRegionRequest() - assert args[0] == request_msg @@ -1927,7 +1942,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRegionsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_reservation_blocks.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_reservation_blocks.py index f5f49febe25c..7be5161ab263 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_reservation_blocks.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_reservation_blocks.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 @@ -108,6 +109,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" @@ -4064,7 +4080,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetReservationBlockRequest() - assert args[0] == request_msg @@ -4084,7 +4099,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetIamPolicyReservationBlockRequest() - assert args[0] == request_msg @@ -4104,7 +4118,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListReservationBlocksRequest() - assert args[0] == request_msg @@ -4126,7 +4139,6 @@ def test_perform_maintenance_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PerformMaintenanceReservationBlockRequest() - assert args[0] == request_msg @@ -4146,7 +4158,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetIamPolicyReservationBlockRequest() - assert args[0] == request_msg @@ -4168,7 +4179,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsReservationBlockRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_reservation_slots.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_reservation_slots.py index 63b2385aa1a3..13c86774cc39 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_reservation_slots.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_reservation_slots.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 @@ -108,6 +109,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" @@ -3495,7 +3511,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetReservationSlotRequest() - assert args[0] == request_msg @@ -3515,7 +3530,6 @@ def test_get_version_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetVersionReservationSlotRequest() - assert args[0] == request_msg @@ -3535,7 +3549,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListReservationSlotsRequest() - assert args[0] == request_msg @@ -3555,7 +3568,6 @@ def test_update_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.UpdateReservationSlotRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_reservation_sub_blocks.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_reservation_sub_blocks.py index 35a0667d9292..d18a0a4ec5f3 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_reservation_sub_blocks.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_reservation_sub_blocks.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 @@ -108,6 +109,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" @@ -5427,7 +5443,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetReservationSubBlockRequest() - assert args[0] == request_msg @@ -5447,7 +5462,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetIamPolicyReservationSubBlockRequest() - assert args[0] == request_msg @@ -5467,7 +5481,6 @@ def test_get_version_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetVersionReservationSubBlockRequest() - assert args[0] == request_msg @@ -5487,7 +5500,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListReservationSubBlocksRequest() - assert args[0] == request_msg @@ -5509,7 +5521,6 @@ def test_perform_maintenance_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PerformMaintenanceReservationSubBlockRequest() - assert args[0] == request_msg @@ -5529,7 +5540,6 @@ def test_report_faulty_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ReportFaultyReservationSubBlockRequest() - assert args[0] == request_msg @@ -5549,7 +5559,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetIamPolicyReservationSubBlockRequest() - assert args[0] == request_msg @@ -5571,7 +5580,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsReservationSubBlockRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_reservations.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_reservations.py index 739fad8385b0..cd9b69736957 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_reservations.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_reservations.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 @@ -108,6 +109,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" @@ -7148,7 +7164,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListReservationsRequest() - assert args[0] == request_msg @@ -7168,7 +7183,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteReservationRequest() - assert args[0] == request_msg @@ -7188,7 +7202,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetReservationRequest() - assert args[0] == request_msg @@ -7208,7 +7221,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetIamPolicyReservationRequest() - assert args[0] == request_msg @@ -7228,7 +7240,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertReservationRequest() - assert args[0] == request_msg @@ -7248,7 +7259,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListReservationsRequest() - assert args[0] == request_msg @@ -7270,7 +7280,6 @@ def test_perform_maintenance_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PerformMaintenanceReservationRequest() - assert args[0] == request_msg @@ -7290,7 +7299,6 @@ def test_resize_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ResizeReservationRequest() - assert args[0] == request_msg @@ -7310,7 +7318,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetIamPolicyReservationRequest() - assert args[0] == request_msg @@ -7332,7 +7339,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsReservationRequest() - assert args[0] == request_msg @@ -7352,7 +7358,6 @@ def test_update_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.UpdateReservationRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_resource_policies.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_resource_policies.py index cc932ad2ab52..361d4e9c2bef 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_resource_policies.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_resource_policies.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 @@ -108,6 +109,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" @@ -5767,7 +5783,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListResourcePoliciesRequest() - assert args[0] == request_msg @@ -5787,7 +5802,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteResourcePolicyRequest() - assert args[0] == request_msg @@ -5807,7 +5821,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetResourcePolicyRequest() - assert args[0] == request_msg @@ -5827,7 +5840,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetIamPolicyResourcePolicyRequest() - assert args[0] == request_msg @@ -5847,7 +5859,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertResourcePolicyRequest() - assert args[0] == request_msg @@ -5867,7 +5878,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListResourcePoliciesRequest() - assert args[0] == request_msg @@ -5887,7 +5897,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchResourcePolicyRequest() - assert args[0] == request_msg @@ -5907,7 +5916,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetIamPolicyResourcePolicyRequest() - assert args[0] == request_msg @@ -5929,7 +5937,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsResourcePolicyRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_rollout_plans.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_rollout_plans.py index c7b8233d3697..5c0662083cfc 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_rollout_plans.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_rollout_plans.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 @@ -108,6 +109,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" @@ -3202,7 +3218,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteRolloutPlanRequest() - assert args[0] == request_msg @@ -3222,7 +3237,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRolloutPlanRequest() - assert args[0] == request_msg @@ -3242,7 +3256,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertRolloutPlanRequest() - assert args[0] == request_msg @@ -3262,7 +3275,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRolloutPlansRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_rollouts.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_rollouts.py index fc21a7d57c9c..56e7675248b7 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_rollouts.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_rollouts.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 @@ -104,6 +105,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" @@ -3059,7 +3075,6 @@ def test_cancel_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.CancelRolloutRequest() - assert args[0] == request_msg @@ -3079,7 +3094,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteRolloutRequest() - assert args[0] == request_msg @@ -3099,7 +3113,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRolloutRequest() - assert args[0] == request_msg @@ -3119,7 +3132,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRolloutsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_routers.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_routers.py index ad2222389ae1..0ca86df3170f 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_routers.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_routers.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 @@ -104,6 +105,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" @@ -10120,7 +10136,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListRoutersRequest() - assert args[0] == request_msg @@ -10140,7 +10155,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteRouterRequest() - assert args[0] == request_msg @@ -10162,7 +10176,6 @@ def test_delete_route_policy_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteRoutePolicyRouterRequest() - assert args[0] == request_msg @@ -10182,7 +10195,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRouterRequest() - assert args[0] == request_msg @@ -10202,7 +10214,6 @@ def test_get_nat_ip_info_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetNatIpInfoRouterRequest() - assert args[0] == request_msg @@ -10224,7 +10235,6 @@ def test_get_nat_mapping_info_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetNatMappingInfoRoutersRequest() - assert args[0] == request_msg @@ -10244,7 +10254,6 @@ def test_get_route_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRoutePolicyRouterRequest() - assert args[0] == request_msg @@ -10266,7 +10275,6 @@ def test_get_router_status_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRouterStatusRouterRequest() - assert args[0] == request_msg @@ -10286,7 +10294,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertRouterRequest() - assert args[0] == request_msg @@ -10306,7 +10313,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRoutersRequest() - assert args[0] == request_msg @@ -10326,7 +10332,6 @@ def test_list_bgp_routes_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListBgpRoutesRoutersRequest() - assert args[0] == request_msg @@ -10348,7 +10353,6 @@ def test_list_route_policies_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRoutePoliciesRoutersRequest() - assert args[0] == request_msg @@ -10368,7 +10372,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchRouterRequest() - assert args[0] == request_msg @@ -10390,7 +10393,6 @@ def test_patch_route_policy_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchRoutePolicyRouterRequest() - assert args[0] == request_msg @@ -10410,7 +10412,6 @@ def test_preview_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PreviewRouterRequest() - assert args[0] == request_msg @@ -10430,7 +10431,6 @@ def test_update_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.UpdateRouterRequest() - assert args[0] == request_msg @@ -10452,7 +10452,6 @@ def test_update_route_policy_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.UpdateRoutePolicyRouterRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_routes.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_routes.py index b75216a3c796..b83831282cc8 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_routes.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_routes.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 @@ -104,6 +105,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" @@ -3566,7 +3582,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteRouteRequest() - assert args[0] == request_msg @@ -3586,7 +3601,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRouteRequest() - assert args[0] == request_msg @@ -3606,7 +3620,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertRouteRequest() - assert args[0] == request_msg @@ -3626,7 +3639,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListRoutesRequest() - assert args[0] == request_msg @@ -3648,7 +3660,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsRouteRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_security_policies.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_security_policies.py index c2f76df6c4f8..8737cb2db6d8 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_security_policies.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_security_policies.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 @@ -108,6 +109,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" @@ -8143,7 +8159,6 @@ def test_add_rule_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AddRuleSecurityPolicyRequest() - assert args[0] == request_msg @@ -8163,7 +8178,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListSecurityPoliciesRequest() - assert args[0] == request_msg @@ -8183,7 +8197,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteSecurityPolicyRequest() - assert args[0] == request_msg @@ -8203,7 +8216,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetSecurityPolicyRequest() - assert args[0] == request_msg @@ -8223,7 +8235,6 @@ def test_get_rule_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetRuleSecurityPolicyRequest() - assert args[0] == request_msg @@ -8243,7 +8254,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertSecurityPolicyRequest() - assert args[0] == request_msg @@ -8263,7 +8273,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListSecurityPoliciesRequest() - assert args[0] == request_msg @@ -8285,7 +8294,6 @@ def test_list_preconfigured_expression_sets_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListPreconfiguredExpressionSetsSecurityPoliciesRequest() - assert args[0] == request_msg @@ -8305,7 +8313,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchSecurityPolicyRequest() - assert args[0] == request_msg @@ -8325,7 +8332,6 @@ def test_patch_rule_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchRuleSecurityPolicyRequest() - assert args[0] == request_msg @@ -8345,7 +8351,6 @@ def test_remove_rule_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.RemoveRuleSecurityPolicyRequest() - assert args[0] == request_msg @@ -8365,7 +8370,6 @@ def test_set_labels_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetLabelsSecurityPolicyRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_service_attachments.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_service_attachments.py index 7a25bd8b6000..0f69685e7650 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_service_attachments.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_service_attachments.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 @@ -108,6 +109,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" @@ -5759,7 +5775,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListServiceAttachmentsRequest() - assert args[0] == request_msg @@ -5779,7 +5794,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteServiceAttachmentRequest() - assert args[0] == request_msg @@ -5799,7 +5813,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetServiceAttachmentRequest() - assert args[0] == request_msg @@ -5819,7 +5832,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetIamPolicyServiceAttachmentRequest() - assert args[0] == request_msg @@ -5839,7 +5851,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertServiceAttachmentRequest() - assert args[0] == request_msg @@ -5859,7 +5870,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListServiceAttachmentsRequest() - assert args[0] == request_msg @@ -5879,7 +5889,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchServiceAttachmentRequest() - assert args[0] == request_msg @@ -5899,7 +5908,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetIamPolicyServiceAttachmentRequest() - assert args[0] == request_msg @@ -5921,7 +5929,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsServiceAttachmentRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_snapshot_settings_service.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_snapshot_settings_service.py index df21d3c25d50..1824fc191932 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_snapshot_settings_service.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_snapshot_settings_service.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 @@ -107,6 +108,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" @@ -2285,7 +2301,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetSnapshotSettingRequest() - assert args[0] == request_msg @@ -2305,7 +2320,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchSnapshotSettingRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_snapshots.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_snapshots.py index 8d9239ec25b2..0e06a6d8a8d4 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_snapshots.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_snapshots.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 @@ -108,6 +109,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" @@ -5711,7 +5727,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteSnapshotRequest() - assert args[0] == request_msg @@ -5731,7 +5746,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetSnapshotRequest() - assert args[0] == request_msg @@ -5751,7 +5765,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetIamPolicySnapshotRequest() - assert args[0] == request_msg @@ -5771,7 +5784,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertSnapshotRequest() - assert args[0] == request_msg @@ -5791,7 +5803,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListSnapshotsRequest() - assert args[0] == request_msg @@ -5811,7 +5822,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetIamPolicySnapshotRequest() - assert args[0] == request_msg @@ -5831,7 +5841,6 @@ def test_set_labels_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetLabelsSnapshotRequest() - assert args[0] == request_msg @@ -5853,7 +5862,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsSnapshotRequest() - assert args[0] == request_msg @@ -5873,7 +5881,6 @@ def test_update_kms_key_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.UpdateKmsKeySnapshotRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_ssl_certificates.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_ssl_certificates.py index 2ddf4b6a00c3..ed997bece3f2 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_ssl_certificates.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_ssl_certificates.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 @@ -108,6 +109,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" @@ -3640,7 +3656,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListSslCertificatesRequest() - assert args[0] == request_msg @@ -3660,7 +3675,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteSslCertificateRequest() - assert args[0] == request_msg @@ -3680,7 +3694,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetSslCertificateRequest() - assert args[0] == request_msg @@ -3700,7 +3713,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertSslCertificateRequest() - assert args[0] == request_msg @@ -3720,7 +3732,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListSslCertificatesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_ssl_policies.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_ssl_policies.py index 4e49142e3985..a419db6eb501 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_ssl_policies.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_ssl_policies.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 @@ -108,6 +109,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" @@ -4573,7 +4589,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListSslPoliciesRequest() - assert args[0] == request_msg @@ -4593,7 +4608,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteSslPolicyRequest() - assert args[0] == request_msg @@ -4613,7 +4627,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetSslPolicyRequest() - assert args[0] == request_msg @@ -4633,7 +4646,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertSslPolicyRequest() - assert args[0] == request_msg @@ -4653,7 +4665,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListSslPoliciesRequest() - assert args[0] == request_msg @@ -4675,7 +4686,6 @@ def test_list_available_features_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListAvailableFeaturesSslPoliciesRequest() - assert args[0] == request_msg @@ -4695,7 +4705,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchSslPolicyRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_storage_pool_types.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_storage_pool_types.py index 5f86476847cb..cbfc7e47c97f 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_storage_pool_types.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_storage_pool_types.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 @@ -106,6 +107,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" @@ -2457,7 +2473,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListStoragePoolTypesRequest() - assert args[0] == request_msg @@ -2477,7 +2492,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetStoragePoolTypeRequest() - assert args[0] == request_msg @@ -2497,7 +2511,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListStoragePoolTypesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_storage_pools.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_storage_pools.py index 41069fbf3c99..6f0f47581bbc 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_storage_pools.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_storage_pools.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 @@ -108,6 +109,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" @@ -6064,7 +6080,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListStoragePoolsRequest() - assert args[0] == request_msg @@ -6084,7 +6099,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteStoragePoolRequest() - assert args[0] == request_msg @@ -6104,7 +6118,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetStoragePoolRequest() - assert args[0] == request_msg @@ -6124,7 +6137,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetIamPolicyStoragePoolRequest() - assert args[0] == request_msg @@ -6144,7 +6156,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertStoragePoolRequest() - assert args[0] == request_msg @@ -6164,7 +6175,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListStoragePoolsRequest() - assert args[0] == request_msg @@ -6184,7 +6194,6 @@ def test_list_disks_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListDisksStoragePoolsRequest() - assert args[0] == request_msg @@ -6204,7 +6213,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetIamPolicyStoragePoolRequest() - assert args[0] == request_msg @@ -6226,7 +6234,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsStoragePoolRequest() - assert args[0] == request_msg @@ -6246,7 +6253,6 @@ def test_update_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.UpdateStoragePoolRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_subnetworks.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_subnetworks.py index 34b2716bc1b4..25ac421bf6e2 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_subnetworks.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_subnetworks.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 @@ -108,6 +109,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" @@ -7512,7 +7528,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListSubnetworksRequest() - assert args[0] == request_msg @@ -7532,7 +7547,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteSubnetworkRequest() - assert args[0] == request_msg @@ -7554,7 +7568,6 @@ def test_expand_ip_cidr_range_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ExpandIpCidrRangeSubnetworkRequest() - assert args[0] == request_msg @@ -7574,7 +7587,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetSubnetworkRequest() - assert args[0] == request_msg @@ -7594,7 +7606,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetIamPolicySubnetworkRequest() - assert args[0] == request_msg @@ -7614,7 +7625,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertSubnetworkRequest() - assert args[0] == request_msg @@ -7634,7 +7644,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListSubnetworksRequest() - assert args[0] == request_msg @@ -7654,7 +7663,6 @@ def test_list_usable_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListUsableSubnetworksRequest() - assert args[0] == request_msg @@ -7674,7 +7682,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchSubnetworkRequest() - assert args[0] == request_msg @@ -7694,7 +7701,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetIamPolicySubnetworkRequest() - assert args[0] == request_msg @@ -7716,7 +7722,6 @@ def test_set_private_ip_google_access_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetPrivateIpGoogleAccessSubnetworkRequest() - assert args[0] == request_msg @@ -7738,7 +7743,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsSubnetworkRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_target_grpc_proxies.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_target_grpc_proxies.py index a706ac860919..0268212ffa36 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_target_grpc_proxies.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_target_grpc_proxies.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 @@ -108,6 +109,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" @@ -3887,7 +3903,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteTargetGrpcProxyRequest() - assert args[0] == request_msg @@ -3907,7 +3922,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetTargetGrpcProxyRequest() - assert args[0] == request_msg @@ -3927,7 +3941,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertTargetGrpcProxyRequest() - assert args[0] == request_msg @@ -3947,7 +3960,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListTargetGrpcProxiesRequest() - assert args[0] == request_msg @@ -3967,7 +3979,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchTargetGrpcProxyRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_target_http_proxies.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_target_http_proxies.py index 71c7c7c83e6f..9f4923818c9b 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_target_http_proxies.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_target_http_proxies.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 @@ -108,6 +109,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" @@ -4964,7 +4980,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListTargetHttpProxiesRequest() - assert args[0] == request_msg @@ -4984,7 +4999,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteTargetHttpProxyRequest() - assert args[0] == request_msg @@ -5004,7 +5018,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetTargetHttpProxyRequest() - assert args[0] == request_msg @@ -5024,7 +5037,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertTargetHttpProxyRequest() - assert args[0] == request_msg @@ -5044,7 +5056,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListTargetHttpProxiesRequest() - assert args[0] == request_msg @@ -5064,7 +5075,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchTargetHttpProxyRequest() - assert args[0] == request_msg @@ -5084,7 +5094,6 @@ def test_set_url_map_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetUrlMapTargetHttpProxyRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_target_https_proxies.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_target_https_proxies.py index ff8d5c10ac1a..9ecebe7c082d 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_target_https_proxies.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_target_https_proxies.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 @@ -108,6 +109,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" @@ -7691,7 +7707,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListTargetHttpsProxiesRequest() - assert args[0] == request_msg @@ -7711,7 +7726,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteTargetHttpsProxyRequest() - assert args[0] == request_msg @@ -7731,7 +7745,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetTargetHttpsProxyRequest() - assert args[0] == request_msg @@ -7751,7 +7764,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertTargetHttpsProxyRequest() - assert args[0] == request_msg @@ -7771,7 +7783,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListTargetHttpsProxiesRequest() - assert args[0] == request_msg @@ -7791,7 +7802,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchTargetHttpsProxyRequest() - assert args[0] == request_msg @@ -7813,7 +7823,6 @@ def test_set_certificate_map_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetCertificateMapTargetHttpsProxyRequest() - assert args[0] == request_msg @@ -7835,7 +7844,6 @@ def test_set_quic_override_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetQuicOverrideTargetHttpsProxyRequest() - assert args[0] == request_msg @@ -7857,7 +7865,6 @@ def test_set_ssl_certificates_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetSslCertificatesTargetHttpsProxyRequest() - assert args[0] == request_msg @@ -7877,7 +7884,6 @@ def test_set_ssl_policy_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetSslPolicyTargetHttpsProxyRequest() - assert args[0] == request_msg @@ -7897,7 +7903,6 @@ def test_set_url_map_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetUrlMapTargetHttpsProxyRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_target_instances.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_target_instances.py index 2a9f21b07d44..1696c75c29c0 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_target_instances.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_target_instances.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 @@ -108,6 +109,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" @@ -4826,7 +4842,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListTargetInstancesRequest() - assert args[0] == request_msg @@ -4846,7 +4861,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteTargetInstanceRequest() - assert args[0] == request_msg @@ -4866,7 +4880,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetTargetInstanceRequest() - assert args[0] == request_msg @@ -4886,7 +4899,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertTargetInstanceRequest() - assert args[0] == request_msg @@ -4906,7 +4918,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListTargetInstancesRequest() - assert args[0] == request_msg @@ -4928,7 +4939,6 @@ def test_set_security_policy_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetSecurityPolicyTargetInstanceRequest() - assert args[0] == request_msg @@ -4950,7 +4960,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsTargetInstanceRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_target_pools.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_target_pools.py index 38a542eb34e1..7dada4bc0652 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_target_pools.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_target_pools.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 @@ -108,6 +109,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" @@ -8638,7 +8654,6 @@ def test_add_health_check_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AddHealthCheckTargetPoolRequest() - assert args[0] == request_msg @@ -8658,7 +8673,6 @@ def test_add_instance_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AddInstanceTargetPoolRequest() - assert args[0] == request_msg @@ -8678,7 +8692,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListTargetPoolsRequest() - assert args[0] == request_msg @@ -8698,7 +8711,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteTargetPoolRequest() - assert args[0] == request_msg @@ -8718,7 +8730,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetTargetPoolRequest() - assert args[0] == request_msg @@ -8738,7 +8749,6 @@ def test_get_health_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetHealthTargetPoolRequest() - assert args[0] == request_msg @@ -8758,7 +8768,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertTargetPoolRequest() - assert args[0] == request_msg @@ -8778,7 +8787,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListTargetPoolsRequest() - assert args[0] == request_msg @@ -8800,7 +8808,6 @@ def test_remove_health_check_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.RemoveHealthCheckTargetPoolRequest() - assert args[0] == request_msg @@ -8820,7 +8827,6 @@ def test_remove_instance_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.RemoveInstanceTargetPoolRequest() - assert args[0] == request_msg @@ -8840,7 +8846,6 @@ def test_set_backup_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetBackupTargetPoolRequest() - assert args[0] == request_msg @@ -8862,7 +8867,6 @@ def test_set_security_policy_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetSecurityPolicyTargetPoolRequest() - assert args[0] == request_msg @@ -8884,7 +8888,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsTargetPoolRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_target_ssl_proxies.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_target_ssl_proxies.py index 60ed287bbed2..40af50218748 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_target_ssl_proxies.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_target_ssl_proxies.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 @@ -108,6 +109,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" @@ -6997,7 +7013,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteTargetSslProxyRequest() - assert args[0] == request_msg @@ -7017,7 +7032,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetTargetSslProxyRequest() - assert args[0] == request_msg @@ -7037,7 +7051,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertTargetSslProxyRequest() - assert args[0] == request_msg @@ -7057,7 +7070,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListTargetSslProxiesRequest() - assert args[0] == request_msg @@ -7079,7 +7091,6 @@ def test_set_backend_service_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetBackendServiceTargetSslProxyRequest() - assert args[0] == request_msg @@ -7101,7 +7112,6 @@ def test_set_certificate_map_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetCertificateMapTargetSslProxyRequest() - assert args[0] == request_msg @@ -7121,7 +7131,6 @@ def test_set_proxy_header_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetProxyHeaderTargetSslProxyRequest() - assert args[0] == request_msg @@ -7143,7 +7152,6 @@ def test_set_ssl_certificates_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetSslCertificatesTargetSslProxyRequest() - assert args[0] == request_msg @@ -7163,7 +7171,6 @@ def test_set_ssl_policy_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetSslPolicyTargetSslProxyRequest() - assert args[0] == request_msg @@ -7185,7 +7192,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsTargetSslProxyRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_target_tcp_proxies.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_target_tcp_proxies.py index 64bf21291a44..f03a99c47593 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_target_tcp_proxies.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_target_tcp_proxies.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 @@ -108,6 +109,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" @@ -5399,7 +5415,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListTargetTcpProxiesRequest() - assert args[0] == request_msg @@ -5419,7 +5434,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteTargetTcpProxyRequest() - assert args[0] == request_msg @@ -5439,7 +5453,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetTargetTcpProxyRequest() - assert args[0] == request_msg @@ -5459,7 +5472,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertTargetTcpProxyRequest() - assert args[0] == request_msg @@ -5479,7 +5491,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListTargetTcpProxiesRequest() - assert args[0] == request_msg @@ -5501,7 +5512,6 @@ def test_set_backend_service_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetBackendServiceTargetTcpProxyRequest() - assert args[0] == request_msg @@ -5521,7 +5531,6 @@ def test_set_proxy_header_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetProxyHeaderTargetTcpProxyRequest() - assert args[0] == request_msg @@ -5543,7 +5552,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsTargetTcpProxyRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_target_vpn_gateways.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_target_vpn_gateways.py index 192d76965c8b..390114420627 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_target_vpn_gateways.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_target_vpn_gateways.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 @@ -108,6 +109,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" @@ -4415,7 +4431,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListTargetVpnGatewaysRequest() - assert args[0] == request_msg @@ -4435,7 +4450,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteTargetVpnGatewayRequest() - assert args[0] == request_msg @@ -4455,7 +4469,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetTargetVpnGatewayRequest() - assert args[0] == request_msg @@ -4475,7 +4488,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertTargetVpnGatewayRequest() - assert args[0] == request_msg @@ -4495,7 +4507,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListTargetVpnGatewaysRequest() - assert args[0] == request_msg @@ -4515,7 +4526,6 @@ def test_set_labels_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetLabelsTargetVpnGatewayRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_url_maps.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_url_maps.py index f36f65565a4e..6530f38821b3 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_url_maps.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_url_maps.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 @@ -104,6 +105,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" @@ -7139,7 +7155,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListUrlMapsRequest() - assert args[0] == request_msg @@ -7159,7 +7174,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteUrlMapRequest() - assert args[0] == request_msg @@ -7179,7 +7193,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetUrlMapRequest() - assert args[0] == request_msg @@ -7199,7 +7212,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertUrlMapRequest() - assert args[0] == request_msg @@ -7219,7 +7231,6 @@ def test_invalidate_cache_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InvalidateCacheUrlMapRequest() - assert args[0] == request_msg @@ -7239,7 +7250,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListUrlMapsRequest() - assert args[0] == request_msg @@ -7259,7 +7269,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchUrlMapRequest() - assert args[0] == request_msg @@ -7281,7 +7290,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsUrlMapRequest() - assert args[0] == request_msg @@ -7301,7 +7309,6 @@ def test_update_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.UpdateUrlMapRequest() - assert args[0] == request_msg @@ -7321,7 +7328,6 @@ def test_validate_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ValidateUrlMapRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_vpn_gateways.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_vpn_gateways.py index 58588f1b5b88..362f844e8023 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_vpn_gateways.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_vpn_gateways.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 @@ -108,6 +109,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" @@ -5075,7 +5091,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListVpnGatewaysRequest() - assert args[0] == request_msg @@ -5095,7 +5110,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteVpnGatewayRequest() - assert args[0] == request_msg @@ -5115,7 +5129,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetVpnGatewayRequest() - assert args[0] == request_msg @@ -5135,7 +5148,6 @@ def test_get_status_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetStatusVpnGatewayRequest() - assert args[0] == request_msg @@ -5155,7 +5167,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertVpnGatewayRequest() - assert args[0] == request_msg @@ -5175,7 +5186,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListVpnGatewaysRequest() - assert args[0] == request_msg @@ -5195,7 +5205,6 @@ def test_set_labels_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetLabelsVpnGatewayRequest() - assert args[0] == request_msg @@ -5217,7 +5226,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.TestIamPermissionsVpnGatewayRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_vpn_tunnels.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_vpn_tunnels.py index dcfbcf2f3f3f..d1d8e9b66c5a 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_vpn_tunnels.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_vpn_tunnels.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 @@ -108,6 +109,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" @@ -4354,7 +4370,6 @@ def test_aggregated_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.AggregatedListVpnTunnelsRequest() - assert args[0] == request_msg @@ -4374,7 +4389,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteVpnTunnelRequest() - assert args[0] == request_msg @@ -4394,7 +4408,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetVpnTunnelRequest() - assert args[0] == request_msg @@ -4414,7 +4427,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertVpnTunnelRequest() - assert args[0] == request_msg @@ -4434,7 +4446,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListVpnTunnelsRequest() - assert args[0] == request_msg @@ -4454,7 +4465,6 @@ def test_set_labels_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.SetLabelsVpnTunnelRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_wire_groups.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_wire_groups.py index 36ed69425c31..de14f4d541fc 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_wire_groups.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_wire_groups.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 @@ -108,6 +109,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" @@ -3941,7 +3957,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteWireGroupRequest() - assert args[0] == request_msg @@ -3961,7 +3976,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetWireGroupRequest() - assert args[0] == request_msg @@ -3981,7 +3995,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertWireGroupRequest() - assert args[0] == request_msg @@ -4001,7 +4014,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListWireGroupsRequest() - assert args[0] == request_msg @@ -4021,7 +4033,6 @@ def test_patch_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.PatchWireGroupRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_zone_operations.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_zone_operations.py index c70505ddc007..113c314ef25f 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_zone_operations.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_zone_operations.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 @@ -106,6 +107,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" @@ -2715,7 +2731,6 @@ def test_delete_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteZoneOperationRequest() - assert args[0] == request_msg @@ -2735,7 +2750,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetZoneOperationRequest() - assert args[0] == request_msg @@ -2755,7 +2769,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListZoneOperationsRequest() - assert args[0] == request_msg @@ -2775,7 +2788,6 @@ def test_wait_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.WaitZoneOperationRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_zone_vm_extension_policies.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_zone_vm_extension_policies.py index 100527462683..654b2f1737f6 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_zone_vm_extension_policies.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_zone_vm_extension_policies.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 @@ -108,6 +109,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" @@ -4044,7 +4060,6 @@ def test_delete_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.DeleteZoneVmExtensionPolicyRequest() - assert args[0] == request_msg @@ -4064,7 +4079,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetZoneVmExtensionPolicyRequest() - assert args[0] == request_msg @@ -4084,7 +4098,6 @@ def test_insert_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.InsertZoneVmExtensionPolicyRequest() - assert args[0] == request_msg @@ -4104,7 +4117,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListZoneVmExtensionPoliciesRequest() - assert args[0] == request_msg @@ -4124,7 +4136,6 @@ def test_update_unary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.UpdateZoneVmExtensionPolicyRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_zones.py b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_zones.py index ebeb3c2fa6c6..722d0d783337 100644 --- a/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_zones.py +++ b/packages/google-cloud-compute/tests/unit/gapic/compute_v1/test_zones.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 @@ -102,6 +103,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" @@ -1903,7 +1919,6 @@ def test_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.GetZoneRequest() - assert args[0] == request_msg @@ -1923,7 +1938,6 @@ def test_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = compute.ListZonesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-confidentialcomputing/noxfile.py b/packages/google-cloud-confidentialcomputing/noxfile.py index 5a288be6a4bf..2a3d9e9aa558 100644 --- a/packages/google-cloud-confidentialcomputing/noxfile.py +++ b/packages/google-cloud-confidentialcomputing/noxfile.py @@ -47,7 +47,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-confidentialcomputing" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-confidentialcomputing/setup.py b/packages/google-cloud-confidentialcomputing/setup.py index 0b800c9e931d..f91a86958f03 100644 --- a/packages/google-cloud-confidentialcomputing/setup.py +++ b/packages/google-cloud-confidentialcomputing/setup.py @@ -45,7 +45,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/google-cloud-confidentialcomputing/testing/constraints-3.10.txt b/packages/google-cloud-confidentialcomputing/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-confidentialcomputing/testing/constraints-3.10.txt +++ b/packages/google-cloud-confidentialcomputing/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-confidentialcomputing/tests/unit/gapic/confidentialcomputing_v1/test_confidential_computing.py b/packages/google-cloud-confidentialcomputing/tests/unit/gapic/confidentialcomputing_v1/test_confidential_computing.py index 63d0c779eb5b..d41ba1beb121 100644 --- a/packages/google-cloud-confidentialcomputing/tests/unit/gapic/confidentialcomputing_v1/test_confidential_computing.py +++ b/packages/google-cloud-confidentialcomputing/tests/unit/gapic/confidentialcomputing_v1/test_confidential_computing.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 @@ -109,6 +110,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" @@ -1374,8 +1390,8 @@ def test_confidential_computing_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - service.CreateChallengeRequest, - dict, + service.CreateChallengeRequest(), + {}, ], ) def test_create_challenge(request_type, transport: str = "grpc"): @@ -1386,7 +1402,7 @@ def test_create_challenge(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_challenge), "__call__") as call: @@ -1434,9 +1450,10 @@ def test_create_challenge_non_empty_request_with_auto_populated_field(): client.create_challenge(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateChallengeRequest( + request_msg = service.CreateChallengeRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_challenge_use_cached_wrapped_rpc(): @@ -1519,9 +1536,14 @@ async def test_create_challenge_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_challenge_async( - transport: str = "grpc_asyncio", request_type=service.CreateChallengeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CreateChallengeRequest(), + {}, + ], +) +async def test_create_challenge_async(request_type, transport: str = "grpc_asyncio"): client = ConfidentialComputingAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1529,7 +1551,7 @@ async def test_create_challenge_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_challenge), "__call__") as call: @@ -1556,11 +1578,6 @@ async def test_create_challenge_async( assert response.tpm_nonce == "tpm_nonce_value" -@pytest.mark.asyncio -async def test_create_challenge_async_from_dict(): - await test_create_challenge_async(request_type=dict) - - def test_create_challenge_field_headers(): client = ConfidentialComputingClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1713,8 +1730,8 @@ async def test_create_challenge_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.VerifyAttestationRequest, - dict, + service.VerifyAttestationRequest(), + {}, ], ) def test_verify_attestation(request_type, transport: str = "grpc"): @@ -1725,7 +1742,7 @@ def test_verify_attestation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,10 +1791,11 @@ def test_verify_attestation_non_empty_request_with_auto_populated_field(): client.verify_attestation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.VerifyAttestationRequest( + request_msg = service.VerifyAttestationRequest( challenge="challenge_value", attester="attester_value", ) + assert args[0] == request_msg def test_verify_attestation_use_cached_wrapped_rpc(): @@ -1862,9 +1880,14 @@ async def test_verify_attestation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_verify_attestation_async( - transport: str = "grpc_asyncio", request_type=service.VerifyAttestationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.VerifyAttestationRequest(), + {}, + ], +) +async def test_verify_attestation_async(request_type, transport: str = "grpc_asyncio"): client = ConfidentialComputingAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1872,7 +1895,7 @@ async def test_verify_attestation_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( @@ -1897,11 +1920,6 @@ async def test_verify_attestation_async( assert response.oidc_claims_token == "oidc_claims_token_value" -@pytest.mark.asyncio -async def test_verify_attestation_async_from_dict(): - await test_verify_attestation_async(request_type=dict) - - def test_verify_attestation_field_headers(): client = ConfidentialComputingClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1970,8 +1988,8 @@ async def test_verify_attestation_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.VerifyConfidentialSpaceRequest, - dict, + service.VerifyConfidentialSpaceRequest(), + {}, ], ) def test_verify_confidential_space(request_type, transport: str = "grpc"): @@ -1982,7 +2000,7 @@ def test_verify_confidential_space(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2030,9 +2048,10 @@ def test_verify_confidential_space_non_empty_request_with_auto_populated_field() client.verify_confidential_space(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.VerifyConfidentialSpaceRequest( + request_msg = service.VerifyConfidentialSpaceRequest( challenge="challenge_value", ) + assert args[0] == request_msg def test_verify_confidential_space_use_cached_wrapped_rpc(): @@ -2118,8 +2137,15 @@ async def test_verify_confidential_space_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.VerifyConfidentialSpaceRequest(), + {}, + ], +) async def test_verify_confidential_space_async( - transport: str = "grpc_asyncio", request_type=service.VerifyConfidentialSpaceRequest + request_type, transport: str = "grpc_asyncio" ): client = ConfidentialComputingAsyncClient( credentials=async_anonymous_credentials(), @@ -2128,7 +2154,7 @@ async def test_verify_confidential_space_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( @@ -2153,11 +2179,6 @@ async def test_verify_confidential_space_async( assert response.attestation_token == "attestation_token_value" -@pytest.mark.asyncio -async def test_verify_confidential_space_async_from_dict(): - await test_verify_confidential_space_async(request_type=dict) - - def test_verify_confidential_space_field_headers(): client = ConfidentialComputingClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2226,8 +2247,8 @@ async def test_verify_confidential_space_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.VerifyConfidentialGkeRequest, - dict, + service.VerifyConfidentialGkeRequest(), + {}, ], ) def test_verify_confidential_gke(request_type, transport: str = "grpc"): @@ -2238,7 +2259,7 @@ def test_verify_confidential_gke(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2286,9 +2307,10 @@ def test_verify_confidential_gke_non_empty_request_with_auto_populated_field(): client.verify_confidential_gke(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.VerifyConfidentialGkeRequest( + request_msg = service.VerifyConfidentialGkeRequest( challenge="challenge_value", ) + assert args[0] == request_msg def test_verify_confidential_gke_use_cached_wrapped_rpc(): @@ -2374,8 +2396,15 @@ async def test_verify_confidential_gke_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.VerifyConfidentialGkeRequest(), + {}, + ], +) async def test_verify_confidential_gke_async( - transport: str = "grpc_asyncio", request_type=service.VerifyConfidentialGkeRequest + request_type, transport: str = "grpc_asyncio" ): client = ConfidentialComputingAsyncClient( credentials=async_anonymous_credentials(), @@ -2384,7 +2413,7 @@ async def test_verify_confidential_gke_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( @@ -2409,11 +2438,6 @@ async def test_verify_confidential_gke_async( assert response.attestation_token == "attestation_token_value" -@pytest.mark.asyncio -async def test_verify_confidential_gke_async_from_dict(): - await test_verify_confidential_gke_async(request_type=dict) - - def test_verify_confidential_gke_field_headers(): client = ConfidentialComputingClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3177,7 +3201,6 @@ def test_create_challenge_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateChallengeRequest() - assert args[0] == request_msg @@ -3200,7 +3223,6 @@ def test_verify_attestation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.VerifyAttestationRequest() - assert args[0] == request_msg @@ -3223,7 +3245,6 @@ def test_verify_confidential_space_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.VerifyConfidentialSpaceRequest() - assert args[0] == request_msg @@ -3246,7 +3267,6 @@ def test_verify_confidential_gke_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.VerifyConfidentialGkeRequest() - assert args[0] == request_msg @@ -3289,7 +3309,6 @@ async def test_create_challenge_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateChallengeRequest() - assert args[0] == request_msg @@ -3318,7 +3337,6 @@ async def test_verify_attestation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.VerifyAttestationRequest() - assert args[0] == request_msg @@ -3347,7 +3365,6 @@ async def test_verify_confidential_space_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.VerifyConfidentialSpaceRequest() - assert args[0] == request_msg @@ -3376,7 +3393,6 @@ async def test_verify_confidential_gke_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.VerifyConfidentialGkeRequest() - assert args[0] == request_msg @@ -4158,7 +4174,6 @@ def test_create_challenge_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateChallengeRequest() - assert args[0] == request_msg @@ -4180,7 +4195,6 @@ def test_verify_attestation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.VerifyAttestationRequest() - assert args[0] == request_msg @@ -4202,7 +4216,6 @@ def test_verify_confidential_space_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.VerifyConfidentialSpaceRequest() - assert args[0] == request_msg @@ -4224,7 +4237,6 @@ def test_verify_confidential_gke_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.VerifyConfidentialGkeRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-config/noxfile.py b/packages/google-cloud-config/noxfile.py index a4cd9de8e633..9e253aa7bb01 100644 --- a/packages/google-cloud-config/noxfile.py +++ b/packages/google-cloud-config/noxfile.py @@ -47,7 +47,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-config" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-config/setup.py b/packages/google-cloud-config/setup.py index db53af392662..0fe433100501 100644 --- a/packages/google-cloud-config/setup.py +++ b/packages/google-cloud-config/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/google-cloud-config/testing/constraints-3.10.txt b/packages/google-cloud-config/testing/constraints-3.10.txt index a92801e1c8e2..b39cd54634f9 100644 --- a/packages/google-cloud-config/testing/constraints-3.10.txt +++ b/packages/google-cloud-config/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/google-cloud-config/tests/unit/gapic/config_v1/test_config.py b/packages/google-cloud-config/tests/unit/gapic/config_v1/test_config.py index c98f5c0894a5..dd7a2fb2f702 100644 --- a/packages/google-cloud-config/tests/unit/gapic/config_v1/test_config.py +++ b/packages/google-cloud-config/tests/unit/gapic/config_v1/test_config.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 @@ -123,6 +124,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" @@ -1255,8 +1271,8 @@ def test_config_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - config.ListDeploymentsRequest, - dict, + config.ListDeploymentsRequest(), + {}, ], ) def test_list_deployments(request_type, transport: str = "grpc"): @@ -1267,7 +1283,7 @@ def test_list_deployments(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_deployments), "__call__") as call: @@ -1316,12 +1332,13 @@ def test_list_deployments_non_empty_request_with_auto_populated_field(): client.list_deployments(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config.ListDeploymentsRequest( + request_msg = config.ListDeploymentsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_deployments_use_cached_wrapped_rpc(): @@ -1404,9 +1421,14 @@ async def test_list_deployments_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_deployments_async( - transport: str = "grpc_asyncio", request_type=config.ListDeploymentsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config.ListDeploymentsRequest(), + {}, + ], +) +async def test_list_deployments_async(request_type, transport: str = "grpc_asyncio"): client = ConfigAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1414,7 +1436,7 @@ async def test_list_deployments_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_deployments), "__call__") as call: @@ -1439,11 +1461,6 @@ async def test_list_deployments_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_deployments_async_from_dict(): - await test_list_deployments_async(request_type=dict) - - def test_list_deployments_field_headers(): client = ConfigClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1780,8 +1797,8 @@ async def test_list_deployments_async_pages(): @pytest.mark.parametrize( "request_type", [ - config.GetDeploymentRequest, - dict, + config.GetDeploymentRequest(), + {}, ], ) def test_get_deployment(request_type, transport: str = "grpc"): @@ -1792,7 +1809,7 @@ def test_get_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_deployment), "__call__") as call: @@ -1866,9 +1883,10 @@ def test_get_deployment_non_empty_request_with_auto_populated_field(): client.get_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config.GetDeploymentRequest( + request_msg = config.GetDeploymentRequest( name="name_value", ) + assert args[0] == request_msg def test_get_deployment_use_cached_wrapped_rpc(): @@ -1949,9 +1967,14 @@ async def test_get_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_deployment_async( - transport: str = "grpc_asyncio", request_type=config.GetDeploymentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config.GetDeploymentRequest(), + {}, + ], +) +async def test_get_deployment_async(request_type, transport: str = "grpc_asyncio"): client = ConfigAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1959,7 +1982,7 @@ async def test_get_deployment_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_deployment), "__call__") as call: @@ -2012,11 +2035,6 @@ async def test_get_deployment_async( assert response.quota_validation == config.QuotaValidation.ENABLED -@pytest.mark.asyncio -async def test_get_deployment_async_from_dict(): - await test_get_deployment_async(request_type=dict) - - def test_get_deployment_field_headers(): client = ConfigClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2159,8 +2177,8 @@ async def test_get_deployment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config.CreateDeploymentRequest, - dict, + config.CreateDeploymentRequest(), + {}, ], ) def test_create_deployment(request_type, transport: str = "grpc"): @@ -2171,7 +2189,7 @@ def test_create_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2218,11 +2236,12 @@ def test_create_deployment_non_empty_request_with_auto_populated_field(): client.create_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config.CreateDeploymentRequest( + request_msg = config.CreateDeploymentRequest( parent="parent_value", deployment_id="deployment_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_deployment_use_cached_wrapped_rpc(): @@ -2315,9 +2334,14 @@ async def test_create_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_deployment_async( - transport: str = "grpc_asyncio", request_type=config.CreateDeploymentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config.CreateDeploymentRequest(), + {}, + ], +) +async def test_create_deployment_async(request_type, transport: str = "grpc_asyncio"): client = ConfigAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2325,7 +2349,7 @@ async def test_create_deployment_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( @@ -2347,11 +2371,6 @@ async def test_create_deployment_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_deployment_async_from_dict(): - await test_create_deployment_async(request_type=dict) - - def test_create_deployment_field_headers(): client = ConfigClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2546,8 +2565,8 @@ async def test_create_deployment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config.UpdateDeploymentRequest, - dict, + config.UpdateDeploymentRequest(), + {}, ], ) def test_update_deployment(request_type, transport: str = "grpc"): @@ -2558,7 +2577,7 @@ def test_update_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2603,9 +2622,10 @@ def test_update_deployment_non_empty_request_with_auto_populated_field(): client.update_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config.UpdateDeploymentRequest( + request_msg = config.UpdateDeploymentRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_deployment_use_cached_wrapped_rpc(): @@ -2698,9 +2718,14 @@ async def test_update_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_deployment_async( - transport: str = "grpc_asyncio", request_type=config.UpdateDeploymentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config.UpdateDeploymentRequest(), + {}, + ], +) +async def test_update_deployment_async(request_type, transport: str = "grpc_asyncio"): client = ConfigAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2708,7 +2733,7 @@ async def test_update_deployment_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( @@ -2730,11 +2755,6 @@ async def test_update_deployment_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_deployment_async_from_dict(): - await test_update_deployment_async(request_type=dict) - - def test_update_deployment_field_headers(): client = ConfigClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2919,8 +2939,8 @@ async def test_update_deployment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config.DeleteDeploymentRequest, - dict, + config.DeleteDeploymentRequest(), + {}, ], ) def test_delete_deployment(request_type, transport: str = "grpc"): @@ -2931,7 +2951,7 @@ def test_delete_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2977,10 +2997,11 @@ def test_delete_deployment_non_empty_request_with_auto_populated_field(): client.delete_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config.DeleteDeploymentRequest( + request_msg = config.DeleteDeploymentRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_deployment_use_cached_wrapped_rpc(): @@ -3073,9 +3094,14 @@ async def test_delete_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_deployment_async( - transport: str = "grpc_asyncio", request_type=config.DeleteDeploymentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config.DeleteDeploymentRequest(), + {}, + ], +) +async def test_delete_deployment_async(request_type, transport: str = "grpc_asyncio"): client = ConfigAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3083,7 +3109,7 @@ async def test_delete_deployment_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( @@ -3105,11 +3131,6 @@ async def test_delete_deployment_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_deployment_async_from_dict(): - await test_delete_deployment_async(request_type=dict) - - def test_delete_deployment_field_headers(): client = ConfigClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3264,8 +3285,8 @@ async def test_delete_deployment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config.ListRevisionsRequest, - dict, + config.ListRevisionsRequest(), + {}, ], ) def test_list_revisions(request_type, transport: str = "grpc"): @@ -3276,7 +3297,7 @@ def test_list_revisions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_revisions), "__call__") as call: @@ -3325,12 +3346,13 @@ def test_list_revisions_non_empty_request_with_auto_populated_field(): client.list_revisions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config.ListRevisionsRequest( + request_msg = config.ListRevisionsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_revisions_use_cached_wrapped_rpc(): @@ -3411,9 +3433,14 @@ async def test_list_revisions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_revisions_async( - transport: str = "grpc_asyncio", request_type=config.ListRevisionsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config.ListRevisionsRequest(), + {}, + ], +) +async def test_list_revisions_async(request_type, transport: str = "grpc_asyncio"): client = ConfigAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3421,7 +3448,7 @@ async def test_list_revisions_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_revisions), "__call__") as call: @@ -3446,11 +3473,6 @@ async def test_list_revisions_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_revisions_async_from_dict(): - await test_list_revisions_async(request_type=dict) - - def test_list_revisions_field_headers(): client = ConfigClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3787,8 +3809,8 @@ async def test_list_revisions_async_pages(): @pytest.mark.parametrize( "request_type", [ - config.GetRevisionRequest, - dict, + config.GetRevisionRequest(), + {}, ], ) def test_get_revision(request_type, transport: str = "grpc"): @@ -3799,7 +3821,7 @@ def test_get_revision(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_revision), "__call__") as call: @@ -3873,9 +3895,10 @@ def test_get_revision_non_empty_request_with_auto_populated_field(): client.get_revision(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config.GetRevisionRequest( + request_msg = config.GetRevisionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_revision_use_cached_wrapped_rpc(): @@ -3956,9 +3979,14 @@ async def test_get_revision_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_revision_async( - transport: str = "grpc_asyncio", request_type=config.GetRevisionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config.GetRevisionRequest(), + {}, + ], +) +async def test_get_revision_async(request_type, transport: str = "grpc_asyncio"): client = ConfigAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3966,7 +3994,7 @@ async def test_get_revision_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_revision), "__call__") as call: @@ -4019,11 +4047,6 @@ async def test_get_revision_async( assert response.quota_validation == config.QuotaValidation.ENABLED -@pytest.mark.asyncio -async def test_get_revision_async_from_dict(): - await test_get_revision_async(request_type=dict) - - def test_get_revision_field_headers(): client = ConfigClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4166,8 +4189,8 @@ async def test_get_revision_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config.GetResourceRequest, - dict, + config.GetResourceRequest(), + {}, ], ) def test_get_resource(request_type, transport: str = "grpc"): @@ -4178,7 +4201,7 @@ def test_get_resource(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_resource), "__call__") as call: @@ -4226,9 +4249,10 @@ def test_get_resource_non_empty_request_with_auto_populated_field(): client.get_resource(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config.GetResourceRequest( + request_msg = config.GetResourceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_resource_use_cached_wrapped_rpc(): @@ -4309,9 +4333,14 @@ async def test_get_resource_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_resource_async( - transport: str = "grpc_asyncio", request_type=config.GetResourceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config.GetResourceRequest(), + {}, + ], +) +async def test_get_resource_async(request_type, transport: str = "grpc_asyncio"): client = ConfigAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4319,7 +4348,7 @@ async def test_get_resource_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_resource), "__call__") as call: @@ -4346,11 +4375,6 @@ async def test_get_resource_async( assert response.state == config.Resource.State.PLANNED -@pytest.mark.asyncio -async def test_get_resource_async_from_dict(): - await test_get_resource_async(request_type=dict) - - def test_get_resource_field_headers(): client = ConfigClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4493,8 +4517,8 @@ async def test_get_resource_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config.ListResourcesRequest, - dict, + config.ListResourcesRequest(), + {}, ], ) def test_list_resources(request_type, transport: str = "grpc"): @@ -4505,7 +4529,7 @@ def test_list_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(type(client.transport.list_resources), "__call__") as call: @@ -4554,12 +4578,13 @@ def test_list_resources_non_empty_request_with_auto_populated_field(): client.list_resources(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config.ListResourcesRequest( + request_msg = config.ListResourcesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_resources_use_cached_wrapped_rpc(): @@ -4640,9 +4665,14 @@ async def test_list_resources_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_resources_async( - transport: str = "grpc_asyncio", request_type=config.ListResourcesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config.ListResourcesRequest(), + {}, + ], +) +async def test_list_resources_async(request_type, transport: str = "grpc_asyncio"): client = ConfigAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4650,7 +4680,7 @@ async def test_list_resources_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_resources), "__call__") as call: @@ -4675,11 +4705,6 @@ async def test_list_resources_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_resources_async_from_dict(): - await test_list_resources_async(request_type=dict) - - def test_list_resources_field_headers(): client = ConfigClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5016,8 +5041,8 @@ async def test_list_resources_async_pages(): @pytest.mark.parametrize( "request_type", [ - config.ExportDeploymentStatefileRequest, - dict, + config.ExportDeploymentStatefileRequest(), + {}, ], ) def test_export_deployment_statefile(request_type, transport: str = "grpc"): @@ -5028,7 +5053,7 @@ def test_export_deployment_statefile(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5076,9 +5101,10 @@ def test_export_deployment_statefile_non_empty_request_with_auto_populated_field client.export_deployment_statefile(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config.ExportDeploymentStatefileRequest( + request_msg = config.ExportDeploymentStatefileRequest( parent="parent_value", ) + assert args[0] == request_msg def test_export_deployment_statefile_use_cached_wrapped_rpc(): @@ -5164,9 +5190,15 @@ async def test_export_deployment_statefile_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + config.ExportDeploymentStatefileRequest(), + {}, + ], +) async def test_export_deployment_statefile_async( - transport: str = "grpc_asyncio", - request_type=config.ExportDeploymentStatefileRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConfigAsyncClient( credentials=async_anonymous_credentials(), @@ -5175,7 +5207,7 @@ async def test_export_deployment_statefile_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( @@ -5200,11 +5232,6 @@ async def test_export_deployment_statefile_async( assert response.signed_uri == "signed_uri_value" -@pytest.mark.asyncio -async def test_export_deployment_statefile_async_from_dict(): - await test_export_deployment_statefile_async(request_type=dict) - - def test_export_deployment_statefile_field_headers(): client = ConfigClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5271,8 +5298,8 @@ async def test_export_deployment_statefile_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - config.ExportRevisionStatefileRequest, - dict, + config.ExportRevisionStatefileRequest(), + {}, ], ) def test_export_revision_statefile(request_type, transport: str = "grpc"): @@ -5283,7 +5310,7 @@ def test_export_revision_statefile(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5331,9 +5358,10 @@ def test_export_revision_statefile_non_empty_request_with_auto_populated_field() client.export_revision_statefile(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config.ExportRevisionStatefileRequest( + request_msg = config.ExportRevisionStatefileRequest( parent="parent_value", ) + assert args[0] == request_msg def test_export_revision_statefile_use_cached_wrapped_rpc(): @@ -5419,8 +5447,15 @@ async def test_export_revision_statefile_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + config.ExportRevisionStatefileRequest(), + {}, + ], +) async def test_export_revision_statefile_async( - transport: str = "grpc_asyncio", request_type=config.ExportRevisionStatefileRequest + request_type, transport: str = "grpc_asyncio" ): client = ConfigAsyncClient( credentials=async_anonymous_credentials(), @@ -5429,7 +5464,7 @@ async def test_export_revision_statefile_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( @@ -5454,11 +5489,6 @@ async def test_export_revision_statefile_async( assert response.signed_uri == "signed_uri_value" -@pytest.mark.asyncio -async def test_export_revision_statefile_async_from_dict(): - await test_export_revision_statefile_async(request_type=dict) - - def test_export_revision_statefile_field_headers(): client = ConfigClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5525,8 +5555,8 @@ async def test_export_revision_statefile_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - config.ImportStatefileRequest, - dict, + config.ImportStatefileRequest(), + {}, ], ) def test_import_statefile(request_type, transport: str = "grpc"): @@ -5537,7 +5567,7 @@ def test_import_statefile(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.import_statefile), "__call__") as call: @@ -5581,9 +5611,10 @@ def test_import_statefile_non_empty_request_with_auto_populated_field(): client.import_statefile(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config.ImportStatefileRequest( + request_msg = config.ImportStatefileRequest( parent="parent_value", ) + assert args[0] == request_msg def test_import_statefile_use_cached_wrapped_rpc(): @@ -5666,9 +5697,14 @@ async def test_import_statefile_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_import_statefile_async( - transport: str = "grpc_asyncio", request_type=config.ImportStatefileRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config.ImportStatefileRequest(), + {}, + ], +) +async def test_import_statefile_async(request_type, transport: str = "grpc_asyncio"): client = ConfigAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5676,7 +5712,7 @@ async def test_import_statefile_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.import_statefile), "__call__") as call: @@ -5699,11 +5735,6 @@ async def test_import_statefile_async( assert response.signed_uri == "signed_uri_value" -@pytest.mark.asyncio -async def test_import_statefile_async_from_dict(): - await test_import_statefile_async(request_type=dict) - - def test_import_statefile_field_headers(): client = ConfigClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5856,8 +5887,8 @@ async def test_import_statefile_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config.DeleteStatefileRequest, - dict, + config.DeleteStatefileRequest(), + {}, ], ) def test_delete_statefile(request_type, transport: str = "grpc"): @@ -5868,7 +5899,7 @@ def test_delete_statefile(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_statefile), "__call__") as call: @@ -5909,9 +5940,10 @@ def test_delete_statefile_non_empty_request_with_auto_populated_field(): client.delete_statefile(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config.DeleteStatefileRequest( + request_msg = config.DeleteStatefileRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_statefile_use_cached_wrapped_rpc(): @@ -5994,9 +6026,14 @@ async def test_delete_statefile_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_statefile_async( - transport: str = "grpc_asyncio", request_type=config.DeleteStatefileRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config.DeleteStatefileRequest(), + {}, + ], +) +async def test_delete_statefile_async(request_type, transport: str = "grpc_asyncio"): client = ConfigAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6004,7 +6041,7 @@ async def test_delete_statefile_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_statefile), "__call__") as call: @@ -6022,11 +6059,6 @@ async def test_delete_statefile_async( assert response is None -@pytest.mark.asyncio -async def test_delete_statefile_async_from_dict(): - await test_delete_statefile_async(request_type=dict) - - def test_delete_statefile_field_headers(): client = ConfigClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6169,8 +6201,8 @@ async def test_delete_statefile_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config.LockDeploymentRequest, - dict, + config.LockDeploymentRequest(), + {}, ], ) def test_lock_deployment(request_type, transport: str = "grpc"): @@ -6181,7 +6213,7 @@ def test_lock_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.lock_deployment), "__call__") as call: @@ -6222,9 +6254,10 @@ def test_lock_deployment_non_empty_request_with_auto_populated_field(): client.lock_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config.LockDeploymentRequest( + request_msg = config.LockDeploymentRequest( name="name_value", ) + assert args[0] == request_msg def test_lock_deployment_use_cached_wrapped_rpc(): @@ -6315,9 +6348,14 @@ async def test_lock_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_lock_deployment_async( - transport: str = "grpc_asyncio", request_type=config.LockDeploymentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config.LockDeploymentRequest(), + {}, + ], +) +async def test_lock_deployment_async(request_type, transport: str = "grpc_asyncio"): client = ConfigAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6325,7 +6363,7 @@ async def test_lock_deployment_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.lock_deployment), "__call__") as call: @@ -6345,11 +6383,6 @@ async def test_lock_deployment_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_lock_deployment_async_from_dict(): - await test_lock_deployment_async(request_type=dict) - - def test_lock_deployment_field_headers(): client = ConfigClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6496,8 +6529,8 @@ async def test_lock_deployment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config.UnlockDeploymentRequest, - dict, + config.UnlockDeploymentRequest(), + {}, ], ) def test_unlock_deployment(request_type, transport: str = "grpc"): @@ -6508,7 +6541,7 @@ def test_unlock_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6553,9 +6586,10 @@ def test_unlock_deployment_non_empty_request_with_auto_populated_field(): client.unlock_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config.UnlockDeploymentRequest( + request_msg = config.UnlockDeploymentRequest( name="name_value", ) + assert args[0] == request_msg def test_unlock_deployment_use_cached_wrapped_rpc(): @@ -6648,9 +6682,14 @@ async def test_unlock_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_unlock_deployment_async( - transport: str = "grpc_asyncio", request_type=config.UnlockDeploymentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config.UnlockDeploymentRequest(), + {}, + ], +) +async def test_unlock_deployment_async(request_type, transport: str = "grpc_asyncio"): client = ConfigAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6658,7 +6697,7 @@ async def test_unlock_deployment_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( @@ -6680,11 +6719,6 @@ async def test_unlock_deployment_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_unlock_deployment_async_from_dict(): - await test_unlock_deployment_async(request_type=dict) - - def test_unlock_deployment_field_headers(): client = ConfigClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6849,8 +6883,8 @@ async def test_unlock_deployment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config.ExportLockInfoRequest, - dict, + config.ExportLockInfoRequest(), + {}, ], ) def test_export_lock_info(request_type, transport: str = "grpc"): @@ -6861,7 +6895,7 @@ def test_export_lock_info(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.export_lock_info), "__call__") as call: @@ -6913,9 +6947,10 @@ def test_export_lock_info_non_empty_request_with_auto_populated_field(): client.export_lock_info(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config.ExportLockInfoRequest( + request_msg = config.ExportLockInfoRequest( name="name_value", ) + assert args[0] == request_msg def test_export_lock_info_use_cached_wrapped_rpc(): @@ -6998,9 +7033,14 @@ async def test_export_lock_info_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_export_lock_info_async( - transport: str = "grpc_asyncio", request_type=config.ExportLockInfoRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config.ExportLockInfoRequest(), + {}, + ], +) +async def test_export_lock_info_async(request_type, transport: str = "grpc_asyncio"): client = ConfigAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7008,7 +7048,7 @@ async def test_export_lock_info_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.export_lock_info), "__call__") as call: @@ -7039,11 +7079,6 @@ async def test_export_lock_info_async( assert response.version == "version_value" -@pytest.mark.asyncio -async def test_export_lock_info_async_from_dict(): - await test_export_lock_info_async(request_type=dict) - - def test_export_lock_info_field_headers(): client = ConfigClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7186,8 +7221,8 @@ async def test_export_lock_info_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config.CreatePreviewRequest, - dict, + config.CreatePreviewRequest(), + {}, ], ) def test_create_preview(request_type, transport: str = "grpc"): @@ -7198,7 +7233,7 @@ def test_create_preview(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_preview), "__call__") as call: @@ -7240,10 +7275,11 @@ def test_create_preview_non_empty_request_with_auto_populated_field(): client.create_preview(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config.CreatePreviewRequest( + request_msg = config.CreatePreviewRequest( parent="parent_value", preview_id="preview_id_value", ) + assert args[0] == request_msg def test_create_preview_use_cached_wrapped_rpc(): @@ -7334,9 +7370,14 @@ async def test_create_preview_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_preview_async( - transport: str = "grpc_asyncio", request_type=config.CreatePreviewRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config.CreatePreviewRequest(), + {}, + ], +) +async def test_create_preview_async(request_type, transport: str = "grpc_asyncio"): client = ConfigAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7344,7 +7385,7 @@ async def test_create_preview_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_preview), "__call__") as call: @@ -7364,11 +7405,6 @@ async def test_create_preview_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_preview_async_from_dict(): - await test_create_preview_async(request_type=dict) - - def test_create_preview_field_headers(): client = ConfigClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7545,8 +7581,8 @@ async def test_create_preview_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config.GetPreviewRequest, - dict, + config.GetPreviewRequest(), + {}, ], ) def test_get_preview(request_type, transport: str = "grpc"): @@ -7557,7 +7593,7 @@ def test_get_preview(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_preview), "__call__") as call: @@ -7625,9 +7661,10 @@ def test_get_preview_non_empty_request_with_auto_populated_field(): client.get_preview(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config.GetPreviewRequest( + request_msg = config.GetPreviewRequest( name="name_value", ) + assert args[0] == request_msg def test_get_preview_use_cached_wrapped_rpc(): @@ -7708,9 +7745,14 @@ async def test_get_preview_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_preview_async( - transport: str = "grpc_asyncio", request_type=config.GetPreviewRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config.GetPreviewRequest(), + {}, + ], +) +async def test_get_preview_async(request_type, transport: str = "grpc_asyncio"): client = ConfigAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7718,7 +7760,7 @@ async def test_get_preview_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_preview), "__call__") as call: @@ -7765,11 +7807,6 @@ async def test_get_preview_async( assert response.tf_version_constraint == "tf_version_constraint_value" -@pytest.mark.asyncio -async def test_get_preview_async_from_dict(): - await test_get_preview_async(request_type=dict) - - def test_get_preview_field_headers(): client = ConfigClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7912,8 +7949,8 @@ async def test_get_preview_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config.ListPreviewsRequest, - dict, + config.ListPreviewsRequest(), + {}, ], ) def test_list_previews(request_type, transport: str = "grpc"): @@ -7924,7 +7961,7 @@ def test_list_previews(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_previews), "__call__") as call: @@ -7973,12 +8010,13 @@ def test_list_previews_non_empty_request_with_auto_populated_field(): client.list_previews(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config.ListPreviewsRequest( + request_msg = config.ListPreviewsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_previews_use_cached_wrapped_rpc(): @@ -8059,9 +8097,14 @@ async def test_list_previews_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_previews_async( - transport: str = "grpc_asyncio", request_type=config.ListPreviewsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config.ListPreviewsRequest(), + {}, + ], +) +async def test_list_previews_async(request_type, transport: str = "grpc_asyncio"): client = ConfigAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8069,7 +8112,7 @@ async def test_list_previews_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_previews), "__call__") as call: @@ -8094,11 +8137,6 @@ async def test_list_previews_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_previews_async_from_dict(): - await test_list_previews_async(request_type=dict) - - def test_list_previews_field_headers(): client = ConfigClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8435,8 +8473,8 @@ async def test_list_previews_async_pages(): @pytest.mark.parametrize( "request_type", [ - config.DeletePreviewRequest, - dict, + config.DeletePreviewRequest(), + {}, ], ) def test_delete_preview(request_type, transport: str = "grpc"): @@ -8447,7 +8485,7 @@ def test_delete_preview(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_preview), "__call__") as call: @@ -8488,9 +8526,10 @@ def test_delete_preview_non_empty_request_with_auto_populated_field(): client.delete_preview(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config.DeletePreviewRequest( + request_msg = config.DeletePreviewRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_preview_use_cached_wrapped_rpc(): @@ -8581,9 +8620,14 @@ async def test_delete_preview_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_preview_async( - transport: str = "grpc_asyncio", request_type=config.DeletePreviewRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config.DeletePreviewRequest(), + {}, + ], +) +async def test_delete_preview_async(request_type, transport: str = "grpc_asyncio"): client = ConfigAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8591,7 +8635,7 @@ async def test_delete_preview_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_preview), "__call__") as call: @@ -8611,11 +8655,6 @@ async def test_delete_preview_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_preview_async_from_dict(): - await test_delete_preview_async(request_type=dict) - - def test_delete_preview_field_headers(): client = ConfigClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8762,8 +8801,8 @@ async def test_delete_preview_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config.ExportPreviewResultRequest, - dict, + config.ExportPreviewResultRequest(), + {}, ], ) def test_export_preview_result(request_type, transport: str = "grpc"): @@ -8774,7 +8813,7 @@ def test_export_preview_result(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8819,9 +8858,10 @@ def test_export_preview_result_non_empty_request_with_auto_populated_field(): client.export_preview_result(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config.ExportPreviewResultRequest( + request_msg = config.ExportPreviewResultRequest( parent="parent_value", ) + assert args[0] == request_msg def test_export_preview_result_use_cached_wrapped_rpc(): @@ -8907,8 +8947,15 @@ async def test_export_preview_result_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + config.ExportPreviewResultRequest(), + {}, + ], +) async def test_export_preview_result_async( - transport: str = "grpc_asyncio", request_type=config.ExportPreviewResultRequest + request_type, transport: str = "grpc_asyncio" ): client = ConfigAsyncClient( credentials=async_anonymous_credentials(), @@ -8917,7 +8964,7 @@ async def test_export_preview_result_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( @@ -8939,11 +8986,6 @@ async def test_export_preview_result_async( assert isinstance(response, config.ExportPreviewResultResponse) -@pytest.mark.asyncio -async def test_export_preview_result_async_from_dict(): - await test_export_preview_result_async(request_type=dict) - - def test_export_preview_result_field_headers(): client = ConfigClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9012,8 +9054,8 @@ async def test_export_preview_result_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - config.ListTerraformVersionsRequest, - dict, + config.ListTerraformVersionsRequest(), + {}, ], ) def test_list_terraform_versions(request_type, transport: str = "grpc"): @@ -9024,7 +9066,7 @@ def test_list_terraform_versions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9077,12 +9119,13 @@ def test_list_terraform_versions_non_empty_request_with_auto_populated_field(): client.list_terraform_versions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config.ListTerraformVersionsRequest( + request_msg = config.ListTerraformVersionsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_terraform_versions_use_cached_wrapped_rpc(): @@ -9168,8 +9211,15 @@ async def test_list_terraform_versions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + config.ListTerraformVersionsRequest(), + {}, + ], +) async def test_list_terraform_versions_async( - transport: str = "grpc_asyncio", request_type=config.ListTerraformVersionsRequest + request_type, transport: str = "grpc_asyncio" ): client = ConfigAsyncClient( credentials=async_anonymous_credentials(), @@ -9178,7 +9228,7 @@ async def test_list_terraform_versions_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( @@ -9205,11 +9255,6 @@ async def test_list_terraform_versions_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_terraform_versions_async_from_dict(): - await test_list_terraform_versions_async(request_type=dict) - - def test_list_terraform_versions_field_headers(): client = ConfigClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9562,8 +9607,8 @@ async def test_list_terraform_versions_async_pages(): @pytest.mark.parametrize( "request_type", [ - config.GetTerraformVersionRequest, - dict, + config.GetTerraformVersionRequest(), + {}, ], ) def test_get_terraform_version(request_type, transport: str = "grpc"): @@ -9574,7 +9619,7 @@ def test_get_terraform_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9624,9 +9669,10 @@ def test_get_terraform_version_non_empty_request_with_auto_populated_field(): client.get_terraform_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config.GetTerraformVersionRequest( + request_msg = config.GetTerraformVersionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_terraform_version_use_cached_wrapped_rpc(): @@ -9712,8 +9758,15 @@ async def test_get_terraform_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + config.GetTerraformVersionRequest(), + {}, + ], +) async def test_get_terraform_version_async( - transport: str = "grpc_asyncio", request_type=config.GetTerraformVersionRequest + request_type, transport: str = "grpc_asyncio" ): client = ConfigAsyncClient( credentials=async_anonymous_credentials(), @@ -9722,7 +9775,7 @@ async def test_get_terraform_version_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( @@ -9749,11 +9802,6 @@ async def test_get_terraform_version_async( assert response.state == config.TerraformVersion.State.ACTIVE -@pytest.mark.asyncio -async def test_get_terraform_version_async_from_dict(): - await test_get_terraform_version_async(request_type=dict) - - def test_get_terraform_version_field_headers(): client = ConfigClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9908,8 +9956,8 @@ async def test_get_terraform_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config.ListResourceChangesRequest, - dict, + config.ListResourceChangesRequest(), + {}, ], ) def test_list_resource_changes(request_type, transport: str = "grpc"): @@ -9920,7 +9968,7 @@ def test_list_resource_changes(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9973,12 +10021,13 @@ def test_list_resource_changes_non_empty_request_with_auto_populated_field(): client.list_resource_changes(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config.ListResourceChangesRequest( + request_msg = config.ListResourceChangesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_resource_changes_use_cached_wrapped_rpc(): @@ -10064,8 +10113,15 @@ async def test_list_resource_changes_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + config.ListResourceChangesRequest(), + {}, + ], +) async def test_list_resource_changes_async( - transport: str = "grpc_asyncio", request_type=config.ListResourceChangesRequest + request_type, transport: str = "grpc_asyncio" ): client = ConfigAsyncClient( credentials=async_anonymous_credentials(), @@ -10074,7 +10130,7 @@ async def test_list_resource_changes_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( @@ -10101,11 +10157,6 @@ async def test_list_resource_changes_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_resource_changes_async_from_dict(): - await test_list_resource_changes_async(request_type=dict) - - def test_list_resource_changes_field_headers(): client = ConfigClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10458,8 +10509,8 @@ async def test_list_resource_changes_async_pages(): @pytest.mark.parametrize( "request_type", [ - config.GetResourceChangeRequest, - dict, + config.GetResourceChangeRequest(), + {}, ], ) def test_get_resource_change(request_type, transport: str = "grpc"): @@ -10470,7 +10521,7 @@ def test_get_resource_change(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10520,9 +10571,10 @@ def test_get_resource_change_non_empty_request_with_auto_populated_field(): client.get_resource_change(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config.GetResourceChangeRequest( + request_msg = config.GetResourceChangeRequest( name="name_value", ) + assert args[0] == request_msg def test_get_resource_change_use_cached_wrapped_rpc(): @@ -10607,9 +10659,14 @@ async def test_get_resource_change_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_resource_change_async( - transport: str = "grpc_asyncio", request_type=config.GetResourceChangeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config.GetResourceChangeRequest(), + {}, + ], +) +async def test_get_resource_change_async(request_type, transport: str = "grpc_asyncio"): client = ConfigAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10617,7 +10674,7 @@ async def test_get_resource_change_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( @@ -10644,11 +10701,6 @@ async def test_get_resource_change_async( assert response.intent == config.ResourceChange.Intent.CREATE -@pytest.mark.asyncio -async def test_get_resource_change_async_from_dict(): - await test_get_resource_change_async(request_type=dict) - - def test_get_resource_change_field_headers(): client = ConfigClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10803,8 +10855,8 @@ async def test_get_resource_change_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config.ListResourceDriftsRequest, - dict, + config.ListResourceDriftsRequest(), + {}, ], ) def test_list_resource_drifts(request_type, transport: str = "grpc"): @@ -10815,7 +10867,7 @@ def test_list_resource_drifts(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,12 +10920,13 @@ def test_list_resource_drifts_non_empty_request_with_auto_populated_field(): client.list_resource_drifts(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config.ListResourceDriftsRequest( + request_msg = config.ListResourceDriftsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_resource_drifts_use_cached_wrapped_rpc(): @@ -10958,8 +11011,15 @@ async def test_list_resource_drifts_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + config.ListResourceDriftsRequest(), + {}, + ], +) async def test_list_resource_drifts_async( - transport: str = "grpc_asyncio", request_type=config.ListResourceDriftsRequest + request_type, transport: str = "grpc_asyncio" ): client = ConfigAsyncClient( credentials=async_anonymous_credentials(), @@ -10968,7 +11028,7 @@ async def test_list_resource_drifts_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( @@ -10995,11 +11055,6 @@ async def test_list_resource_drifts_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_resource_drifts_async_from_dict(): - await test_list_resource_drifts_async(request_type=dict) - - def test_list_resource_drifts_field_headers(): client = ConfigClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11352,8 +11407,8 @@ async def test_list_resource_drifts_async_pages(): @pytest.mark.parametrize( "request_type", [ - config.GetResourceDriftRequest, - dict, + config.GetResourceDriftRequest(), + {}, ], ) def test_get_resource_drift(request_type, transport: str = "grpc"): @@ -11364,7 +11419,7 @@ def test_get_resource_drift(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11412,9 +11467,10 @@ def test_get_resource_drift_non_empty_request_with_auto_populated_field(): client.get_resource_drift(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config.GetResourceDriftRequest( + request_msg = config.GetResourceDriftRequest( name="name_value", ) + assert args[0] == request_msg def test_get_resource_drift_use_cached_wrapped_rpc(): @@ -11499,9 +11555,14 @@ async def test_get_resource_drift_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_resource_drift_async( - transport: str = "grpc_asyncio", request_type=config.GetResourceDriftRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config.GetResourceDriftRequest(), + {}, + ], +) +async def test_get_resource_drift_async(request_type, transport: str = "grpc_asyncio"): client = ConfigAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11509,7 +11570,7 @@ async def test_get_resource_drift_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( @@ -11534,11 +11595,6 @@ async def test_get_resource_drift_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_resource_drift_async_from_dict(): - await test_get_resource_drift_async(request_type=dict) - - def test_get_resource_drift_field_headers(): client = ConfigClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11693,8 +11749,8 @@ async def test_get_resource_drift_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config.GetAutoMigrationConfigRequest, - dict, + config.GetAutoMigrationConfigRequest(), + {}, ], ) def test_get_auto_migration_config(request_type, transport: str = "grpc"): @@ -11705,7 +11761,7 @@ def test_get_auto_migration_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( @@ -11755,9 +11811,10 @@ def test_get_auto_migration_config_non_empty_request_with_auto_populated_field() client.get_auto_migration_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config.GetAutoMigrationConfigRequest( + request_msg = config.GetAutoMigrationConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_auto_migration_config_use_cached_wrapped_rpc(): @@ -11843,8 +11900,15 @@ async def test_get_auto_migration_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + config.GetAutoMigrationConfigRequest(), + {}, + ], +) async def test_get_auto_migration_config_async( - transport: str = "grpc_asyncio", request_type=config.GetAutoMigrationConfigRequest + request_type, transport: str = "grpc_asyncio" ): client = ConfigAsyncClient( credentials=async_anonymous_credentials(), @@ -11853,7 +11917,7 @@ async def test_get_auto_migration_config_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( @@ -11876,13 +11940,8 @@ async def test_get_auto_migration_config_async( # Establish that the response is the type that we expect. assert isinstance(response, config.AutoMigrationConfig) - assert response.name == "name_value" - assert response.auto_migration_enabled is True - - -@pytest.mark.asyncio -async def test_get_auto_migration_config_async_from_dict(): - await test_get_auto_migration_config_async(request_type=dict) + assert response.name == "name_value" + assert response.auto_migration_enabled is True def test_get_auto_migration_config_field_headers(): @@ -12039,8 +12098,8 @@ async def test_get_auto_migration_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config.UpdateAutoMigrationConfigRequest, - dict, + config.UpdateAutoMigrationConfigRequest(), + {}, ], ) def test_update_auto_migration_config(request_type, transport: str = "grpc"): @@ -12051,7 +12110,7 @@ def test_update_auto_migration_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( @@ -12094,7 +12153,8 @@ def test_update_auto_migration_config_non_empty_request_with_auto_populated_fiel client.update_auto_migration_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config.UpdateAutoMigrationConfigRequest() + request_msg = config.UpdateAutoMigrationConfigRequest() + assert args[0] == request_msg def test_update_auto_migration_config_use_cached_wrapped_rpc(): @@ -12190,9 +12250,15 @@ async def test_update_auto_migration_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + config.UpdateAutoMigrationConfigRequest(), + {}, + ], +) async def test_update_auto_migration_config_async( - transport: str = "grpc_asyncio", - request_type=config.UpdateAutoMigrationConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConfigAsyncClient( credentials=async_anonymous_credentials(), @@ -12201,7 +12267,7 @@ async def test_update_auto_migration_config_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( @@ -12223,11 +12289,6 @@ async def test_update_auto_migration_config_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_auto_migration_config_async_from_dict(): - await test_update_auto_migration_config_async(request_type=dict) - - def test_update_auto_migration_config_field_headers(): client = ConfigClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12392,8 +12453,8 @@ async def test_update_auto_migration_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config.GetDeploymentGroupRequest, - dict, + config.GetDeploymentGroupRequest(), + {}, ], ) def test_get_deployment_group(request_type, transport: str = "grpc"): @@ -12404,7 +12465,7 @@ def test_get_deployment_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -12466,9 +12527,10 @@ def test_get_deployment_group_non_empty_request_with_auto_populated_field(): client.get_deployment_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config.GetDeploymentGroupRequest( + request_msg = config.GetDeploymentGroupRequest( name="name_value", ) + assert args[0] == request_msg def test_get_deployment_group_use_cached_wrapped_rpc(): @@ -12553,8 +12615,15 @@ async def test_get_deployment_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + config.GetDeploymentGroupRequest(), + {}, + ], +) async def test_get_deployment_group_async( - transport: str = "grpc_asyncio", request_type=config.GetDeploymentGroupRequest + request_type, transport: str = "grpc_asyncio" ): client = ConfigAsyncClient( credentials=async_anonymous_credentials(), @@ -12563,7 +12632,7 @@ async def test_get_deployment_group_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( @@ -12602,11 +12671,6 @@ async def test_get_deployment_group_async( ) -@pytest.mark.asyncio -async def test_get_deployment_group_async_from_dict(): - await test_get_deployment_group_async(request_type=dict) - - def test_get_deployment_group_field_headers(): client = ConfigClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12761,8 +12825,8 @@ async def test_get_deployment_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config.CreateDeploymentGroupRequest, - dict, + config.CreateDeploymentGroupRequest(), + {}, ], ) def test_create_deployment_group(request_type, transport: str = "grpc"): @@ -12773,7 +12837,7 @@ def test_create_deployment_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -12819,10 +12883,11 @@ def test_create_deployment_group_non_empty_request_with_auto_populated_field(): client.create_deployment_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config.CreateDeploymentGroupRequest( + request_msg = config.CreateDeploymentGroupRequest( parent="parent_value", deployment_group_id="deployment_group_id_value", ) + assert args[0] == request_msg def test_create_deployment_group_use_cached_wrapped_rpc(): @@ -12918,8 +12983,15 @@ async def test_create_deployment_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + config.CreateDeploymentGroupRequest(), + {}, + ], +) async def test_create_deployment_group_async( - transport: str = "grpc_asyncio", request_type=config.CreateDeploymentGroupRequest + request_type, transport: str = "grpc_asyncio" ): client = ConfigAsyncClient( credentials=async_anonymous_credentials(), @@ -12928,7 +13000,7 @@ async def test_create_deployment_group_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( @@ -12950,11 +13022,6 @@ async def test_create_deployment_group_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_deployment_group_async_from_dict(): - await test_create_deployment_group_async(request_type=dict) - - def test_create_deployment_group_field_headers(): client = ConfigClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13129,8 +13196,8 @@ async def test_create_deployment_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config.UpdateDeploymentGroupRequest, - dict, + config.UpdateDeploymentGroupRequest(), + {}, ], ) def test_update_deployment_group(request_type, transport: str = "grpc"): @@ -13141,7 +13208,7 @@ def test_update_deployment_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -13184,7 +13251,8 @@ def test_update_deployment_group_non_empty_request_with_auto_populated_field(): client.update_deployment_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config.UpdateDeploymentGroupRequest() + request_msg = config.UpdateDeploymentGroupRequest() + assert args[0] == request_msg def test_update_deployment_group_use_cached_wrapped_rpc(): @@ -13280,8 +13348,15 @@ async def test_update_deployment_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + config.UpdateDeploymentGroupRequest(), + {}, + ], +) async def test_update_deployment_group_async( - transport: str = "grpc_asyncio", request_type=config.UpdateDeploymentGroupRequest + request_type, transport: str = "grpc_asyncio" ): client = ConfigAsyncClient( credentials=async_anonymous_credentials(), @@ -13290,7 +13365,7 @@ async def test_update_deployment_group_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( @@ -13312,11 +13387,6 @@ async def test_update_deployment_group_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_deployment_group_async_from_dict(): - await test_update_deployment_group_async(request_type=dict) - - def test_update_deployment_group_field_headers(): client = ConfigClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13481,8 +13551,8 @@ async def test_update_deployment_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config.DeleteDeploymentGroupRequest, - dict, + config.DeleteDeploymentGroupRequest(), + {}, ], ) def test_delete_deployment_group(request_type, transport: str = "grpc"): @@ -13493,7 +13563,7 @@ def test_delete_deployment_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -13538,9 +13608,10 @@ def test_delete_deployment_group_non_empty_request_with_auto_populated_field(): client.delete_deployment_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config.DeleteDeploymentGroupRequest( + request_msg = config.DeleteDeploymentGroupRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_deployment_group_use_cached_wrapped_rpc(): @@ -13636,8 +13707,15 @@ async def test_delete_deployment_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + config.DeleteDeploymentGroupRequest(), + {}, + ], +) async def test_delete_deployment_group_async( - transport: str = "grpc_asyncio", request_type=config.DeleteDeploymentGroupRequest + request_type, transport: str = "grpc_asyncio" ): client = ConfigAsyncClient( credentials=async_anonymous_credentials(), @@ -13646,7 +13724,7 @@ async def test_delete_deployment_group_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( @@ -13668,11 +13746,6 @@ async def test_delete_deployment_group_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_deployment_group_async_from_dict(): - await test_delete_deployment_group_async(request_type=dict) - - def test_delete_deployment_group_field_headers(): client = ConfigClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13827,8 +13900,8 @@ async def test_delete_deployment_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config.ListDeploymentGroupsRequest, - dict, + config.ListDeploymentGroupsRequest(), + {}, ], ) def test_list_deployment_groups(request_type, transport: str = "grpc"): @@ -13839,7 +13912,7 @@ def test_list_deployment_groups(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -13892,12 +13965,13 @@ def test_list_deployment_groups_non_empty_request_with_auto_populated_field(): client.list_deployment_groups(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config.ListDeploymentGroupsRequest( + request_msg = config.ListDeploymentGroupsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_deployment_groups_use_cached_wrapped_rpc(): @@ -13983,8 +14057,15 @@ async def test_list_deployment_groups_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + config.ListDeploymentGroupsRequest(), + {}, + ], +) async def test_list_deployment_groups_async( - transport: str = "grpc_asyncio", request_type=config.ListDeploymentGroupsRequest + request_type, transport: str = "grpc_asyncio" ): client = ConfigAsyncClient( credentials=async_anonymous_credentials(), @@ -13993,7 +14074,7 @@ async def test_list_deployment_groups_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( @@ -14020,11 +14101,6 @@ async def test_list_deployment_groups_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_deployment_groups_async_from_dict(): - await test_list_deployment_groups_async(request_type=dict) - - def test_list_deployment_groups_field_headers(): client = ConfigClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14377,8 +14453,8 @@ async def test_list_deployment_groups_async_pages(): @pytest.mark.parametrize( "request_type", [ - config.ProvisionDeploymentGroupRequest, - dict, + config.ProvisionDeploymentGroupRequest(), + {}, ], ) def test_provision_deployment_group(request_type, transport: str = "grpc"): @@ -14389,7 +14465,7 @@ def test_provision_deployment_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -14434,9 +14510,10 @@ def test_provision_deployment_group_non_empty_request_with_auto_populated_field( client.provision_deployment_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config.ProvisionDeploymentGroupRequest( + request_msg = config.ProvisionDeploymentGroupRequest( name="name_value", ) + assert args[0] == request_msg def test_provision_deployment_group_use_cached_wrapped_rpc(): @@ -14532,8 +14609,15 @@ async def test_provision_deployment_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + config.ProvisionDeploymentGroupRequest(), + {}, + ], +) async def test_provision_deployment_group_async( - transport: str = "grpc_asyncio", request_type=config.ProvisionDeploymentGroupRequest + request_type, transport: str = "grpc_asyncio" ): client = ConfigAsyncClient( credentials=async_anonymous_credentials(), @@ -14542,7 +14626,7 @@ async def test_provision_deployment_group_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( @@ -14564,11 +14648,6 @@ async def test_provision_deployment_group_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_provision_deployment_group_async_from_dict(): - await test_provision_deployment_group_async(request_type=dict) - - def test_provision_deployment_group_field_headers(): client = ConfigClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14723,8 +14802,8 @@ async def test_provision_deployment_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config.DeprovisionDeploymentGroupRequest, - dict, + config.DeprovisionDeploymentGroupRequest(), + {}, ], ) def test_deprovision_deployment_group(request_type, transport: str = "grpc"): @@ -14735,7 +14814,7 @@ def test_deprovision_deployment_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -14780,9 +14859,10 @@ def test_deprovision_deployment_group_non_empty_request_with_auto_populated_fiel client.deprovision_deployment_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config.DeprovisionDeploymentGroupRequest( + request_msg = config.DeprovisionDeploymentGroupRequest( name="name_value", ) + assert args[0] == request_msg def test_deprovision_deployment_group_use_cached_wrapped_rpc(): @@ -14878,9 +14958,15 @@ async def test_deprovision_deployment_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + config.DeprovisionDeploymentGroupRequest(), + {}, + ], +) async def test_deprovision_deployment_group_async( - transport: str = "grpc_asyncio", - request_type=config.DeprovisionDeploymentGroupRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConfigAsyncClient( credentials=async_anonymous_credentials(), @@ -14889,7 +14975,7 @@ async def test_deprovision_deployment_group_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( @@ -14911,11 +14997,6 @@ async def test_deprovision_deployment_group_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_deprovision_deployment_group_async_from_dict(): - await test_deprovision_deployment_group_async(request_type=dict) - - def test_deprovision_deployment_group_field_headers(): client = ConfigClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15070,8 +15151,8 @@ async def test_deprovision_deployment_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config.GetDeploymentGroupRevisionRequest, - dict, + config.GetDeploymentGroupRevisionRequest(), + {}, ], ) def test_get_deployment_group_revision(request_type, transport: str = "grpc"): @@ -15082,7 +15163,7 @@ def test_get_deployment_group_revision(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -15132,9 +15213,10 @@ def test_get_deployment_group_revision_non_empty_request_with_auto_populated_fie client.get_deployment_group_revision(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config.GetDeploymentGroupRevisionRequest( + request_msg = config.GetDeploymentGroupRevisionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_deployment_group_revision_use_cached_wrapped_rpc(): @@ -15220,9 +15302,15 @@ async def test_get_deployment_group_revision_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + config.GetDeploymentGroupRevisionRequest(), + {}, + ], +) async def test_get_deployment_group_revision_async( - transport: str = "grpc_asyncio", - request_type=config.GetDeploymentGroupRevisionRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConfigAsyncClient( credentials=async_anonymous_credentials(), @@ -15231,7 +15319,7 @@ async def test_get_deployment_group_revision_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( @@ -15258,11 +15346,6 @@ async def test_get_deployment_group_revision_async( assert response.alternative_ids == ["alternative_ids_value"] -@pytest.mark.asyncio -async def test_get_deployment_group_revision_async_from_dict(): - await test_get_deployment_group_revision_async(request_type=dict) - - def test_get_deployment_group_revision_field_headers(): client = ConfigClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15417,8 +15500,8 @@ async def test_get_deployment_group_revision_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config.ListDeploymentGroupRevisionsRequest, - dict, + config.ListDeploymentGroupRevisionsRequest(), + {}, ], ) def test_list_deployment_group_revisions(request_type, transport: str = "grpc"): @@ -15429,7 +15512,7 @@ def test_list_deployment_group_revisions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -15480,10 +15563,11 @@ def test_list_deployment_group_revisions_non_empty_request_with_auto_populated_f client.list_deployment_group_revisions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config.ListDeploymentGroupRevisionsRequest( + request_msg = config.ListDeploymentGroupRevisionsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_deployment_group_revisions_use_cached_wrapped_rpc(): @@ -15569,9 +15653,15 @@ async def test_list_deployment_group_revisions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + config.ListDeploymentGroupRevisionsRequest(), + {}, + ], +) async def test_list_deployment_group_revisions_async( - transport: str = "grpc_asyncio", - request_type=config.ListDeploymentGroupRevisionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConfigAsyncClient( credentials=async_anonymous_credentials(), @@ -15580,7 +15670,7 @@ async def test_list_deployment_group_revisions_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( @@ -15607,11 +15697,6 @@ async def test_list_deployment_group_revisions_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_deployment_group_revisions_async_from_dict(): - await test_list_deployment_group_revisions_async(request_type=dict) - - def test_list_deployment_group_revisions_field_headers(): client = ConfigClient( credentials=ga_credentials.AnonymousCredentials(), @@ -23784,7 +23869,6 @@ def test_list_deployments_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.ListDeploymentsRequest() - assert args[0] == request_msg @@ -23805,7 +23889,6 @@ def test_get_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.GetDeploymentRequest() - assert args[0] == request_msg @@ -23828,7 +23911,6 @@ def test_create_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.CreateDeploymentRequest() - assert args[0] == request_msg @@ -23851,7 +23933,6 @@ def test_update_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.UpdateDeploymentRequest() - assert args[0] == request_msg @@ -23874,7 +23955,6 @@ def test_delete_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.DeleteDeploymentRequest() - assert args[0] == request_msg @@ -23895,7 +23975,6 @@ def test_list_revisions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.ListRevisionsRequest() - assert args[0] == request_msg @@ -23916,7 +23995,6 @@ def test_get_revision_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.GetRevisionRequest() - assert args[0] == request_msg @@ -23937,7 +24015,6 @@ def test_get_resource_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.GetResourceRequest() - assert args[0] == request_msg @@ -23958,7 +24035,6 @@ def test_list_resources_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.ListResourcesRequest() - assert args[0] == request_msg @@ -23981,7 +24057,6 @@ def test_export_deployment_statefile_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.ExportDeploymentStatefileRequest() - assert args[0] == request_msg @@ -24004,7 +24079,6 @@ def test_export_revision_statefile_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.ExportRevisionStatefileRequest() - assert args[0] == request_msg @@ -24025,7 +24099,6 @@ def test_import_statefile_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.ImportStatefileRequest() - assert args[0] == request_msg @@ -24046,7 +24119,6 @@ def test_delete_statefile_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.DeleteStatefileRequest() - assert args[0] == request_msg @@ -24067,7 +24139,6 @@ def test_lock_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.LockDeploymentRequest() - assert args[0] == request_msg @@ -24090,7 +24161,6 @@ def test_unlock_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.UnlockDeploymentRequest() - assert args[0] == request_msg @@ -24111,7 +24181,6 @@ def test_export_lock_info_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.ExportLockInfoRequest() - assert args[0] == request_msg @@ -24132,7 +24201,6 @@ def test_create_preview_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.CreatePreviewRequest() - assert args[0] == request_msg @@ -24153,7 +24221,6 @@ def test_get_preview_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.GetPreviewRequest() - assert args[0] == request_msg @@ -24174,7 +24241,6 @@ def test_list_previews_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.ListPreviewsRequest() - assert args[0] == request_msg @@ -24195,7 +24261,6 @@ def test_delete_preview_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.DeletePreviewRequest() - assert args[0] == request_msg @@ -24218,7 +24283,6 @@ def test_export_preview_result_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.ExportPreviewResultRequest() - assert args[0] == request_msg @@ -24241,7 +24305,6 @@ def test_list_terraform_versions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.ListTerraformVersionsRequest() - assert args[0] == request_msg @@ -24264,7 +24327,6 @@ def test_get_terraform_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.GetTerraformVersionRequest() - assert args[0] == request_msg @@ -24287,7 +24349,6 @@ def test_list_resource_changes_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.ListResourceChangesRequest() - assert args[0] == request_msg @@ -24310,7 +24371,6 @@ def test_get_resource_change_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.GetResourceChangeRequest() - assert args[0] == request_msg @@ -24333,7 +24393,6 @@ def test_list_resource_drifts_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.ListResourceDriftsRequest() - assert args[0] == request_msg @@ -24356,7 +24415,6 @@ def test_get_resource_drift_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.GetResourceDriftRequest() - assert args[0] == request_msg @@ -24379,7 +24437,6 @@ def test_get_auto_migration_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.GetAutoMigrationConfigRequest() - assert args[0] == request_msg @@ -24402,7 +24459,6 @@ def test_update_auto_migration_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.UpdateAutoMigrationConfigRequest() - assert args[0] == request_msg @@ -24425,7 +24481,6 @@ def test_get_deployment_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.GetDeploymentGroupRequest() - assert args[0] == request_msg @@ -24448,7 +24503,6 @@ def test_create_deployment_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.CreateDeploymentGroupRequest() - assert args[0] == request_msg @@ -24471,7 +24525,6 @@ def test_update_deployment_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.UpdateDeploymentGroupRequest() - assert args[0] == request_msg @@ -24494,7 +24547,6 @@ def test_delete_deployment_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.DeleteDeploymentGroupRequest() - assert args[0] == request_msg @@ -24517,7 +24569,6 @@ def test_list_deployment_groups_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.ListDeploymentGroupsRequest() - assert args[0] == request_msg @@ -24540,7 +24591,6 @@ def test_provision_deployment_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.ProvisionDeploymentGroupRequest() - assert args[0] == request_msg @@ -24563,7 +24613,6 @@ def test_deprovision_deployment_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.DeprovisionDeploymentGroupRequest() - assert args[0] == request_msg @@ -24586,7 +24635,6 @@ def test_get_deployment_group_revision_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.GetDeploymentGroupRevisionRequest() - assert args[0] == request_msg @@ -24609,7 +24657,6 @@ def test_list_deployment_group_revisions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.ListDeploymentGroupRevisionsRequest() - assert args[0] == request_msg @@ -24651,7 +24698,6 @@ async def test_list_deployments_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.ListDeploymentsRequest() - assert args[0] == request_msg @@ -24693,7 +24739,6 @@ async def test_get_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.GetDeploymentRequest() - assert args[0] == request_msg @@ -24720,7 +24765,6 @@ async def test_create_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.CreateDeploymentRequest() - assert args[0] == request_msg @@ -24747,7 +24791,6 @@ async def test_update_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.UpdateDeploymentRequest() - assert args[0] == request_msg @@ -24774,7 +24817,6 @@ async def test_delete_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.DeleteDeploymentRequest() - assert args[0] == request_msg @@ -24802,7 +24844,6 @@ async def test_list_revisions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.ListRevisionsRequest() - assert args[0] == request_msg @@ -24843,7 +24884,6 @@ async def test_get_revision_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.GetRevisionRequest() - assert args[0] == request_msg @@ -24872,7 +24912,6 @@ async def test_get_resource_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.GetResourceRequest() - assert args[0] == request_msg @@ -24900,7 +24939,6 @@ async def test_list_resources_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.ListResourcesRequest() - assert args[0] == request_msg @@ -24929,7 +24967,6 @@ async def test_export_deployment_statefile_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.ExportDeploymentStatefileRequest() - assert args[0] == request_msg @@ -24958,7 +24995,6 @@ async def test_export_revision_statefile_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.ExportRevisionStatefileRequest() - assert args[0] == request_msg @@ -24985,7 +25021,6 @@ async def test_import_statefile_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.ImportStatefileRequest() - assert args[0] == request_msg @@ -25008,7 +25043,6 @@ async def test_delete_statefile_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.DeleteStatefileRequest() - assert args[0] == request_msg @@ -25033,7 +25067,6 @@ async def test_lock_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.LockDeploymentRequest() - assert args[0] == request_msg @@ -25060,7 +25093,6 @@ async def test_unlock_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.UnlockDeploymentRequest() - assert args[0] == request_msg @@ -25091,7 +25123,6 @@ async def test_export_lock_info_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.ExportLockInfoRequest() - assert args[0] == request_msg @@ -25116,7 +25147,6 @@ async def test_create_preview_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.CreatePreviewRequest() - assert args[0] == request_msg @@ -25155,7 +25185,6 @@ async def test_get_preview_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.GetPreviewRequest() - assert args[0] == request_msg @@ -25183,7 +25212,6 @@ async def test_list_previews_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.ListPreviewsRequest() - assert args[0] == request_msg @@ -25208,7 +25236,6 @@ async def test_delete_preview_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.DeletePreviewRequest() - assert args[0] == request_msg @@ -25235,7 +25262,6 @@ async def test_export_preview_result_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.ExportPreviewResultRequest() - assert args[0] == request_msg @@ -25265,7 +25291,6 @@ async def test_list_terraform_versions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.ListTerraformVersionsRequest() - assert args[0] == request_msg @@ -25295,7 +25320,6 @@ async def test_get_terraform_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.GetTerraformVersionRequest() - assert args[0] == request_msg @@ -25325,7 +25349,6 @@ async def test_list_resource_changes_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.ListResourceChangesRequest() - assert args[0] == request_msg @@ -25355,7 +25378,6 @@ async def test_get_resource_change_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.GetResourceChangeRequest() - assert args[0] == request_msg @@ -25385,7 +25407,6 @@ async def test_list_resource_drifts_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.ListResourceDriftsRequest() - assert args[0] == request_msg @@ -25414,7 +25435,6 @@ async def test_get_resource_drift_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.GetResourceDriftRequest() - assert args[0] == request_msg @@ -25444,7 +25464,6 @@ async def test_get_auto_migration_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.GetAutoMigrationConfigRequest() - assert args[0] == request_msg @@ -25471,7 +25490,6 @@ async def test_update_auto_migration_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.UpdateAutoMigrationConfigRequest() - assert args[0] == request_msg @@ -25504,7 +25522,6 @@ async def test_get_deployment_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.GetDeploymentGroupRequest() - assert args[0] == request_msg @@ -25531,7 +25548,6 @@ async def test_create_deployment_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.CreateDeploymentGroupRequest() - assert args[0] == request_msg @@ -25558,7 +25574,6 @@ async def test_update_deployment_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.UpdateDeploymentGroupRequest() - assert args[0] == request_msg @@ -25585,7 +25600,6 @@ async def test_delete_deployment_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.DeleteDeploymentGroupRequest() - assert args[0] == request_msg @@ -25615,7 +25629,6 @@ async def test_list_deployment_groups_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.ListDeploymentGroupsRequest() - assert args[0] == request_msg @@ -25642,7 +25655,6 @@ async def test_provision_deployment_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.ProvisionDeploymentGroupRequest() - assert args[0] == request_msg @@ -25669,7 +25681,6 @@ async def test_deprovision_deployment_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.DeprovisionDeploymentGroupRequest() - assert args[0] == request_msg @@ -25699,7 +25710,6 @@ async def test_get_deployment_group_revision_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.GetDeploymentGroupRevisionRequest() - assert args[0] == request_msg @@ -25729,7 +25739,6 @@ async def test_list_deployment_group_revisions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.ListDeploymentGroupRevisionsRequest() - assert args[0] == request_msg @@ -31912,7 +31921,6 @@ def test_list_deployments_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.ListDeploymentsRequest() - assert args[0] == request_msg @@ -31932,7 +31940,6 @@ def test_get_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.GetDeploymentRequest() - assert args[0] == request_msg @@ -31954,7 +31961,6 @@ def test_create_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.CreateDeploymentRequest() - assert args[0] == request_msg @@ -31976,7 +31982,6 @@ def test_update_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.UpdateDeploymentRequest() - assert args[0] == request_msg @@ -31998,7 +32003,6 @@ def test_delete_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.DeleteDeploymentRequest() - assert args[0] == request_msg @@ -32018,7 +32022,6 @@ def test_list_revisions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.ListRevisionsRequest() - assert args[0] == request_msg @@ -32038,7 +32041,6 @@ def test_get_revision_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.GetRevisionRequest() - assert args[0] == request_msg @@ -32058,7 +32060,6 @@ def test_get_resource_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.GetResourceRequest() - assert args[0] == request_msg @@ -32078,7 +32079,6 @@ def test_list_resources_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.ListResourcesRequest() - assert args[0] == request_msg @@ -32100,7 +32100,6 @@ def test_export_deployment_statefile_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.ExportDeploymentStatefileRequest() - assert args[0] == request_msg @@ -32122,7 +32121,6 @@ def test_export_revision_statefile_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.ExportRevisionStatefileRequest() - assert args[0] == request_msg @@ -32142,7 +32140,6 @@ def test_import_statefile_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.ImportStatefileRequest() - assert args[0] == request_msg @@ -32162,7 +32159,6 @@ def test_delete_statefile_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.DeleteStatefileRequest() - assert args[0] == request_msg @@ -32182,7 +32178,6 @@ def test_lock_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.LockDeploymentRequest() - assert args[0] == request_msg @@ -32204,7 +32199,6 @@ def test_unlock_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.UnlockDeploymentRequest() - assert args[0] == request_msg @@ -32224,7 +32218,6 @@ def test_export_lock_info_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.ExportLockInfoRequest() - assert args[0] == request_msg @@ -32244,7 +32237,6 @@ def test_create_preview_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.CreatePreviewRequest() - assert args[0] == request_msg @@ -32264,7 +32256,6 @@ def test_get_preview_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.GetPreviewRequest() - assert args[0] == request_msg @@ -32284,7 +32275,6 @@ def test_list_previews_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.ListPreviewsRequest() - assert args[0] == request_msg @@ -32304,7 +32294,6 @@ def test_delete_preview_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.DeletePreviewRequest() - assert args[0] == request_msg @@ -32326,7 +32315,6 @@ def test_export_preview_result_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.ExportPreviewResultRequest() - assert args[0] == request_msg @@ -32348,7 +32336,6 @@ def test_list_terraform_versions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.ListTerraformVersionsRequest() - assert args[0] == request_msg @@ -32370,7 +32357,6 @@ def test_get_terraform_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.GetTerraformVersionRequest() - assert args[0] == request_msg @@ -32392,7 +32378,6 @@ def test_list_resource_changes_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.ListResourceChangesRequest() - assert args[0] == request_msg @@ -32414,7 +32399,6 @@ def test_get_resource_change_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.GetResourceChangeRequest() - assert args[0] == request_msg @@ -32436,7 +32420,6 @@ def test_list_resource_drifts_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.ListResourceDriftsRequest() - assert args[0] == request_msg @@ -32458,7 +32441,6 @@ def test_get_resource_drift_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.GetResourceDriftRequest() - assert args[0] == request_msg @@ -32480,7 +32462,6 @@ def test_get_auto_migration_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.GetAutoMigrationConfigRequest() - assert args[0] == request_msg @@ -32502,7 +32483,6 @@ def test_update_auto_migration_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.UpdateAutoMigrationConfigRequest() - assert args[0] == request_msg @@ -32524,7 +32504,6 @@ def test_get_deployment_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.GetDeploymentGroupRequest() - assert args[0] == request_msg @@ -32546,7 +32525,6 @@ def test_create_deployment_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.CreateDeploymentGroupRequest() - assert args[0] == request_msg @@ -32568,7 +32546,6 @@ def test_update_deployment_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.UpdateDeploymentGroupRequest() - assert args[0] == request_msg @@ -32590,7 +32567,6 @@ def test_delete_deployment_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.DeleteDeploymentGroupRequest() - assert args[0] == request_msg @@ -32612,7 +32588,6 @@ def test_list_deployment_groups_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.ListDeploymentGroupsRequest() - assert args[0] == request_msg @@ -32634,7 +32609,6 @@ def test_provision_deployment_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.ProvisionDeploymentGroupRequest() - assert args[0] == request_msg @@ -32656,7 +32630,6 @@ def test_deprovision_deployment_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.DeprovisionDeploymentGroupRequest() - assert args[0] == request_msg @@ -32678,7 +32651,6 @@ def test_get_deployment_group_revision_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.GetDeploymentGroupRevisionRequest() - assert args[0] == request_msg @@ -32700,7 +32672,6 @@ def test_list_deployment_group_revisions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config.ListDeploymentGroupRevisionsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-configdelivery/noxfile.py b/packages/google-cloud-configdelivery/noxfile.py index 20202718ed33..b030cca9d976 100644 --- a/packages/google-cloud-configdelivery/noxfile.py +++ b/packages/google-cloud-configdelivery/noxfile.py @@ -47,7 +47,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-configdelivery" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-configdelivery/setup.py b/packages/google-cloud-configdelivery/setup.py index 4d38070b93e1..61419b531d46 100644 --- a/packages/google-cloud-configdelivery/setup.py +++ b/packages/google-cloud-configdelivery/setup.py @@ -45,7 +45,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/google-cloud-configdelivery/testing/constraints-3.10.txt b/packages/google-cloud-configdelivery/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-configdelivery/testing/constraints-3.10.txt +++ b/packages/google-cloud-configdelivery/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-configdelivery/tests/unit/gapic/configdelivery_v1/test_config_delivery.py b/packages/google-cloud-configdelivery/tests/unit/gapic/configdelivery_v1/test_config_delivery.py index db3319fdcace..17eaeaf67cc6 100644 --- a/packages/google-cloud-configdelivery/tests/unit/gapic/configdelivery_v1/test_config_delivery.py +++ b/packages/google-cloud-configdelivery/tests/unit/gapic/configdelivery_v1/test_config_delivery.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 @@ -116,6 +117,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" @@ -1319,8 +1335,8 @@ def test_config_delivery_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - config_delivery.ListResourceBundlesRequest, - dict, + config_delivery.ListResourceBundlesRequest(), + {}, ], ) def test_list_resource_bundles(request_type, transport: str = "grpc"): @@ -1331,7 +1347,7 @@ def test_list_resource_bundles(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1384,12 +1400,13 @@ def test_list_resource_bundles_non_empty_request_with_auto_populated_field(): client.list_resource_bundles(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.ListResourceBundlesRequest( + request_msg = config_delivery.ListResourceBundlesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_resource_bundles_use_cached_wrapped_rpc(): @@ -1475,9 +1492,15 @@ async def test_list_resource_bundles_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.ListResourceBundlesRequest(), + {}, + ], +) async def test_list_resource_bundles_async( - transport: str = "grpc_asyncio", - request_type=config_delivery.ListResourceBundlesRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), @@ -1486,7 +1509,7 @@ async def test_list_resource_bundles_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( @@ -1513,11 +1536,6 @@ async def test_list_resource_bundles_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_resource_bundles_async_from_dict(): - await test_list_resource_bundles_async(request_type=dict) - - def test_list_resource_bundles_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1870,8 +1888,8 @@ async def test_list_resource_bundles_async_pages(): @pytest.mark.parametrize( "request_type", [ - config_delivery.GetResourceBundleRequest, - dict, + config_delivery.GetResourceBundleRequest(), + {}, ], ) def test_get_resource_bundle(request_type, transport: str = "grpc"): @@ -1882,7 +1900,7 @@ def test_get_resource_bundle(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1932,9 +1950,10 @@ def test_get_resource_bundle_non_empty_request_with_auto_populated_field(): client.get_resource_bundle(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.GetResourceBundleRequest( + request_msg = config_delivery.GetResourceBundleRequest( name="name_value", ) + assert args[0] == request_msg def test_get_resource_bundle_use_cached_wrapped_rpc(): @@ -2019,10 +2038,14 @@ async def test_get_resource_bundle_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_resource_bundle_async( - transport: str = "grpc_asyncio", - request_type=config_delivery.GetResourceBundleRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.GetResourceBundleRequest(), + {}, + ], +) +async def test_get_resource_bundle_async(request_type, transport: str = "grpc_asyncio"): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2030,7 +2053,7 @@ async def test_get_resource_bundle_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( @@ -2057,11 +2080,6 @@ async def test_get_resource_bundle_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_get_resource_bundle_async_from_dict(): - await test_get_resource_bundle_async(request_type=dict) - - def test_get_resource_bundle_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2216,8 +2234,8 @@ async def test_get_resource_bundle_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config_delivery.CreateResourceBundleRequest, - dict, + config_delivery.CreateResourceBundleRequest(), + {}, ], ) def test_create_resource_bundle(request_type, transport: str = "grpc"): @@ -2228,7 +2246,7 @@ def test_create_resource_bundle(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2274,10 +2292,11 @@ def test_create_resource_bundle_non_empty_request_with_auto_populated_field(): client.create_resource_bundle(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.CreateResourceBundleRequest( + request_msg = config_delivery.CreateResourceBundleRequest( parent="parent_value", resource_bundle_id="resource_bundle_id_value", ) + assert args[0] == request_msg def test_create_resource_bundle_use_cached_wrapped_rpc(): @@ -2373,9 +2392,15 @@ async def test_create_resource_bundle_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.CreateResourceBundleRequest(), + {}, + ], +) async def test_create_resource_bundle_async( - transport: str = "grpc_asyncio", - request_type=config_delivery.CreateResourceBundleRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), @@ -2384,7 +2409,7 @@ async def test_create_resource_bundle_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( @@ -2406,11 +2431,6 @@ async def test_create_resource_bundle_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_resource_bundle_async_from_dict(): - await test_create_resource_bundle_async(request_type=dict) - - def test_create_resource_bundle_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2585,8 +2605,8 @@ async def test_create_resource_bundle_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config_delivery.UpdateResourceBundleRequest, - dict, + config_delivery.UpdateResourceBundleRequest(), + {}, ], ) def test_update_resource_bundle(request_type, transport: str = "grpc"): @@ -2597,7 +2617,7 @@ def test_update_resource_bundle(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2640,7 +2660,8 @@ def test_update_resource_bundle_non_empty_request_with_auto_populated_field(): client.update_resource_bundle(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.UpdateResourceBundleRequest() + request_msg = config_delivery.UpdateResourceBundleRequest() + assert args[0] == request_msg def test_update_resource_bundle_use_cached_wrapped_rpc(): @@ -2736,9 +2757,15 @@ async def test_update_resource_bundle_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.UpdateResourceBundleRequest(), + {}, + ], +) async def test_update_resource_bundle_async( - transport: str = "grpc_asyncio", - request_type=config_delivery.UpdateResourceBundleRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), @@ -2747,7 +2774,7 @@ async def test_update_resource_bundle_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( @@ -2769,11 +2796,6 @@ async def test_update_resource_bundle_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_resource_bundle_async_from_dict(): - await test_update_resource_bundle_async(request_type=dict) - - def test_update_resource_bundle_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2938,8 +2960,8 @@ async def test_update_resource_bundle_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config_delivery.DeleteResourceBundleRequest, - dict, + config_delivery.DeleteResourceBundleRequest(), + {}, ], ) def test_delete_resource_bundle(request_type, transport: str = "grpc"): @@ -2950,7 +2972,7 @@ def test_delete_resource_bundle(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2995,9 +3017,10 @@ def test_delete_resource_bundle_non_empty_request_with_auto_populated_field(): client.delete_resource_bundle(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.DeleteResourceBundleRequest( + request_msg = config_delivery.DeleteResourceBundleRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_resource_bundle_use_cached_wrapped_rpc(): @@ -3093,9 +3116,15 @@ async def test_delete_resource_bundle_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.DeleteResourceBundleRequest(), + {}, + ], +) async def test_delete_resource_bundle_async( - transport: str = "grpc_asyncio", - request_type=config_delivery.DeleteResourceBundleRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), @@ -3104,7 +3133,7 @@ async def test_delete_resource_bundle_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( @@ -3126,11 +3155,6 @@ async def test_delete_resource_bundle_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_resource_bundle_async_from_dict(): - await test_delete_resource_bundle_async(request_type=dict) - - def test_delete_resource_bundle_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3285,8 +3309,8 @@ async def test_delete_resource_bundle_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config_delivery.ListFleetPackagesRequest, - dict, + config_delivery.ListFleetPackagesRequest(), + {}, ], ) def test_list_fleet_packages(request_type, transport: str = "grpc"): @@ -3297,7 +3321,7 @@ def test_list_fleet_packages(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3350,12 +3374,13 @@ def test_list_fleet_packages_non_empty_request_with_auto_populated_field(): client.list_fleet_packages(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.ListFleetPackagesRequest( + request_msg = config_delivery.ListFleetPackagesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_fleet_packages_use_cached_wrapped_rpc(): @@ -3440,10 +3465,14 @@ async def test_list_fleet_packages_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_fleet_packages_async( - transport: str = "grpc_asyncio", - request_type=config_delivery.ListFleetPackagesRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.ListFleetPackagesRequest(), + {}, + ], +) +async def test_list_fleet_packages_async(request_type, transport: str = "grpc_asyncio"): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3451,7 +3480,7 @@ async def test_list_fleet_packages_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( @@ -3478,11 +3507,6 @@ async def test_list_fleet_packages_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_fleet_packages_async_from_dict(): - await test_list_fleet_packages_async(request_type=dict) - - def test_list_fleet_packages_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3835,8 +3859,8 @@ async def test_list_fleet_packages_async_pages(): @pytest.mark.parametrize( "request_type", [ - config_delivery.GetFleetPackageRequest, - dict, + config_delivery.GetFleetPackageRequest(), + {}, ], ) def test_get_fleet_package(request_type, transport: str = "grpc"): @@ -3847,7 +3871,7 @@ def test_get_fleet_package(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3902,9 +3926,10 @@ def test_get_fleet_package_non_empty_request_with_auto_populated_field(): client.get_fleet_package(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.GetFleetPackageRequest( + request_msg = config_delivery.GetFleetPackageRequest( name="name_value", ) + assert args[0] == request_msg def test_get_fleet_package_use_cached_wrapped_rpc(): @@ -3987,9 +4012,14 @@ async def test_get_fleet_package_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_fleet_package_async( - transport: str = "grpc_asyncio", request_type=config_delivery.GetFleetPackageRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.GetFleetPackageRequest(), + {}, + ], +) +async def test_get_fleet_package_async(request_type, transport: str = "grpc_asyncio"): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3997,7 +4027,7 @@ async def test_get_fleet_package_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( @@ -4029,11 +4059,6 @@ async def test_get_fleet_package_async( assert response.state == config_delivery.FleetPackage.State.ACTIVE -@pytest.mark.asyncio -async def test_get_fleet_package_async_from_dict(): - await test_get_fleet_package_async(request_type=dict) - - def test_get_fleet_package_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4188,8 +4213,8 @@ async def test_get_fleet_package_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config_delivery.CreateFleetPackageRequest, - dict, + config_delivery.CreateFleetPackageRequest(), + {}, ], ) def test_create_fleet_package(request_type, transport: str = "grpc"): @@ -4200,7 +4225,7 @@ def test_create_fleet_package(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4246,10 +4271,11 @@ def test_create_fleet_package_non_empty_request_with_auto_populated_field(): client.create_fleet_package(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.CreateFleetPackageRequest( + request_msg = config_delivery.CreateFleetPackageRequest( parent="parent_value", fleet_package_id="fleet_package_id_value", ) + assert args[0] == request_msg def test_create_fleet_package_use_cached_wrapped_rpc(): @@ -4344,9 +4370,15 @@ async def test_create_fleet_package_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.CreateFleetPackageRequest(), + {}, + ], +) async def test_create_fleet_package_async( - transport: str = "grpc_asyncio", - request_type=config_delivery.CreateFleetPackageRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), @@ -4355,7 +4387,7 @@ async def test_create_fleet_package_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( @@ -4377,11 +4409,6 @@ async def test_create_fleet_package_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_fleet_package_async_from_dict(): - await test_create_fleet_package_async(request_type=dict) - - def test_create_fleet_package_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4556,8 +4583,8 @@ async def test_create_fleet_package_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config_delivery.UpdateFleetPackageRequest, - dict, + config_delivery.UpdateFleetPackageRequest(), + {}, ], ) def test_update_fleet_package(request_type, transport: str = "grpc"): @@ -4568,7 +4595,7 @@ def test_update_fleet_package(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4611,7 +4638,8 @@ def test_update_fleet_package_non_empty_request_with_auto_populated_field(): client.update_fleet_package(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.UpdateFleetPackageRequest() + request_msg = config_delivery.UpdateFleetPackageRequest() + assert args[0] == request_msg def test_update_fleet_package_use_cached_wrapped_rpc(): @@ -4706,9 +4734,15 @@ async def test_update_fleet_package_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.UpdateFleetPackageRequest(), + {}, + ], +) async def test_update_fleet_package_async( - transport: str = "grpc_asyncio", - request_type=config_delivery.UpdateFleetPackageRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), @@ -4717,7 +4751,7 @@ async def test_update_fleet_package_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( @@ -4739,11 +4773,6 @@ async def test_update_fleet_package_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_fleet_package_async_from_dict(): - await test_update_fleet_package_async(request_type=dict) - - def test_update_fleet_package_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4908,8 +4937,8 @@ async def test_update_fleet_package_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config_delivery.DeleteFleetPackageRequest, - dict, + config_delivery.DeleteFleetPackageRequest(), + {}, ], ) def test_delete_fleet_package(request_type, transport: str = "grpc"): @@ -4920,7 +4949,7 @@ def test_delete_fleet_package(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4965,9 +4994,10 @@ def test_delete_fleet_package_non_empty_request_with_auto_populated_field(): client.delete_fleet_package(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.DeleteFleetPackageRequest( + request_msg = config_delivery.DeleteFleetPackageRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_fleet_package_use_cached_wrapped_rpc(): @@ -5062,9 +5092,15 @@ async def test_delete_fleet_package_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.DeleteFleetPackageRequest(), + {}, + ], +) async def test_delete_fleet_package_async( - transport: str = "grpc_asyncio", - request_type=config_delivery.DeleteFleetPackageRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), @@ -5073,7 +5109,7 @@ async def test_delete_fleet_package_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( @@ -5095,11 +5131,6 @@ async def test_delete_fleet_package_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_fleet_package_async_from_dict(): - await test_delete_fleet_package_async(request_type=dict) - - def test_delete_fleet_package_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5254,8 +5285,8 @@ async def test_delete_fleet_package_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config_delivery.ListReleasesRequest, - dict, + config_delivery.ListReleasesRequest(), + {}, ], ) def test_list_releases(request_type, transport: str = "grpc"): @@ -5266,7 +5297,7 @@ def test_list_releases(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_releases), "__call__") as call: @@ -5315,12 +5346,13 @@ def test_list_releases_non_empty_request_with_auto_populated_field(): client.list_releases(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.ListReleasesRequest( + request_msg = config_delivery.ListReleasesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_releases_use_cached_wrapped_rpc(): @@ -5401,9 +5433,14 @@ async def test_list_releases_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_releases_async( - transport: str = "grpc_asyncio", request_type=config_delivery.ListReleasesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.ListReleasesRequest(), + {}, + ], +) +async def test_list_releases_async(request_type, transport: str = "grpc_asyncio"): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5411,7 +5448,7 @@ async def test_list_releases_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_releases), "__call__") as call: @@ -5436,11 +5473,6 @@ async def test_list_releases_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_releases_async_from_dict(): - await test_list_releases_async(request_type=dict) - - def test_list_releases_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5777,8 +5809,8 @@ async def test_list_releases_async_pages(): @pytest.mark.parametrize( "request_type", [ - config_delivery.GetReleaseRequest, - dict, + config_delivery.GetReleaseRequest(), + {}, ], ) def test_get_release(request_type, transport: str = "grpc"): @@ -5789,7 +5821,7 @@ def test_get_release(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_release), "__call__") as call: @@ -5837,9 +5869,10 @@ def test_get_release_non_empty_request_with_auto_populated_field(): client.get_release(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.GetReleaseRequest( + request_msg = config_delivery.GetReleaseRequest( name="name_value", ) + assert args[0] == request_msg def test_get_release_use_cached_wrapped_rpc(): @@ -5920,9 +5953,14 @@ async def test_get_release_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_release_async( - transport: str = "grpc_asyncio", request_type=config_delivery.GetReleaseRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.GetReleaseRequest(), + {}, + ], +) +async def test_get_release_async(request_type, transport: str = "grpc_asyncio"): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5930,7 +5968,7 @@ async def test_get_release_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_release), "__call__") as call: @@ -5957,11 +5995,6 @@ async def test_get_release_async( assert response.version == "version_value" -@pytest.mark.asyncio -async def test_get_release_async_from_dict(): - await test_get_release_async(request_type=dict) - - def test_get_release_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6108,8 +6141,8 @@ async def test_get_release_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config_delivery.CreateReleaseRequest, - dict, + config_delivery.CreateReleaseRequest(), + {}, ], ) def test_create_release(request_type, transport: str = "grpc"): @@ -6120,7 +6153,7 @@ def test_create_release(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_release), "__call__") as call: @@ -6162,10 +6195,11 @@ def test_create_release_non_empty_request_with_auto_populated_field(): client.create_release(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.CreateReleaseRequest( + request_msg = config_delivery.CreateReleaseRequest( parent="parent_value", release_id="release_id_value", ) + assert args[0] == request_msg def test_create_release_use_cached_wrapped_rpc(): @@ -6256,9 +6290,14 @@ async def test_create_release_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_release_async( - transport: str = "grpc_asyncio", request_type=config_delivery.CreateReleaseRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.CreateReleaseRequest(), + {}, + ], +) +async def test_create_release_async(request_type, transport: str = "grpc_asyncio"): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6266,7 +6305,7 @@ async def test_create_release_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_release), "__call__") as call: @@ -6286,11 +6325,6 @@ async def test_create_release_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_release_async_from_dict(): - await test_create_release_async(request_type=dict) - - def test_create_release_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6457,8 +6491,8 @@ async def test_create_release_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config_delivery.UpdateReleaseRequest, - dict, + config_delivery.UpdateReleaseRequest(), + {}, ], ) def test_update_release(request_type, transport: str = "grpc"): @@ -6469,7 +6503,7 @@ def test_update_release(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_release), "__call__") as call: @@ -6508,7 +6542,8 @@ def test_update_release_non_empty_request_with_auto_populated_field(): client.update_release(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.UpdateReleaseRequest() + request_msg = config_delivery.UpdateReleaseRequest() + assert args[0] == request_msg def test_update_release_use_cached_wrapped_rpc(): @@ -6599,9 +6634,14 @@ async def test_update_release_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_release_async( - transport: str = "grpc_asyncio", request_type=config_delivery.UpdateReleaseRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.UpdateReleaseRequest(), + {}, + ], +) +async def test_update_release_async(request_type, transport: str = "grpc_asyncio"): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6609,7 +6649,7 @@ async def test_update_release_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_release), "__call__") as call: @@ -6629,11 +6669,6 @@ async def test_update_release_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_release_async_from_dict(): - await test_update_release_async(request_type=dict) - - def test_update_release_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6790,8 +6825,8 @@ async def test_update_release_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config_delivery.DeleteReleaseRequest, - dict, + config_delivery.DeleteReleaseRequest(), + {}, ], ) def test_delete_release(request_type, transport: str = "grpc"): @@ -6802,7 +6837,7 @@ def test_delete_release(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_release), "__call__") as call: @@ -6843,9 +6878,10 @@ def test_delete_release_non_empty_request_with_auto_populated_field(): client.delete_release(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.DeleteReleaseRequest( + request_msg = config_delivery.DeleteReleaseRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_release_use_cached_wrapped_rpc(): @@ -6936,9 +6972,14 @@ async def test_delete_release_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_release_async( - transport: str = "grpc_asyncio", request_type=config_delivery.DeleteReleaseRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.DeleteReleaseRequest(), + {}, + ], +) +async def test_delete_release_async(request_type, transport: str = "grpc_asyncio"): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6946,7 +6987,7 @@ async def test_delete_release_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_release), "__call__") as call: @@ -6966,11 +7007,6 @@ async def test_delete_release_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_release_async_from_dict(): - await test_delete_release_async(request_type=dict) - - def test_delete_release_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7117,8 +7153,8 @@ async def test_delete_release_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config_delivery.ListVariantsRequest, - dict, + config_delivery.ListVariantsRequest(), + {}, ], ) def test_list_variants(request_type, transport: str = "grpc"): @@ -7129,7 +7165,7 @@ def test_list_variants(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_variants), "__call__") as call: @@ -7178,12 +7214,13 @@ def test_list_variants_non_empty_request_with_auto_populated_field(): client.list_variants(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.ListVariantsRequest( + request_msg = config_delivery.ListVariantsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_variants_use_cached_wrapped_rpc(): @@ -7264,9 +7301,14 @@ async def test_list_variants_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_variants_async( - transport: str = "grpc_asyncio", request_type=config_delivery.ListVariantsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.ListVariantsRequest(), + {}, + ], +) +async def test_list_variants_async(request_type, transport: str = "grpc_asyncio"): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7274,7 +7316,7 @@ async def test_list_variants_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_variants), "__call__") as call: @@ -7299,11 +7341,6 @@ async def test_list_variants_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_variants_async_from_dict(): - await test_list_variants_async(request_type=dict) - - def test_list_variants_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7640,8 +7677,8 @@ async def test_list_variants_async_pages(): @pytest.mark.parametrize( "request_type", [ - config_delivery.GetVariantRequest, - dict, + config_delivery.GetVariantRequest(), + {}, ], ) def test_get_variant(request_type, transport: str = "grpc"): @@ -7652,7 +7689,7 @@ def test_get_variant(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_variant), "__call__") as call: @@ -7698,9 +7735,10 @@ def test_get_variant_non_empty_request_with_auto_populated_field(): client.get_variant(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.GetVariantRequest( + request_msg = config_delivery.GetVariantRequest( name="name_value", ) + assert args[0] == request_msg def test_get_variant_use_cached_wrapped_rpc(): @@ -7781,9 +7819,14 @@ async def test_get_variant_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_variant_async( - transport: str = "grpc_asyncio", request_type=config_delivery.GetVariantRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.GetVariantRequest(), + {}, + ], +) +async def test_get_variant_async(request_type, transport: str = "grpc_asyncio"): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7791,7 +7834,7 @@ async def test_get_variant_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_variant), "__call__") as call: @@ -7816,11 +7859,6 @@ async def test_get_variant_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_variant_async_from_dict(): - await test_get_variant_async(request_type=dict) - - def test_get_variant_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7967,8 +8005,8 @@ async def test_get_variant_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config_delivery.CreateVariantRequest, - dict, + config_delivery.CreateVariantRequest(), + {}, ], ) def test_create_variant(request_type, transport: str = "grpc"): @@ -7979,7 +8017,7 @@ def test_create_variant(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_variant), "__call__") as call: @@ -8021,10 +8059,11 @@ def test_create_variant_non_empty_request_with_auto_populated_field(): client.create_variant(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.CreateVariantRequest( + request_msg = config_delivery.CreateVariantRequest( parent="parent_value", variant_id="variant_id_value", ) + assert args[0] == request_msg def test_create_variant_use_cached_wrapped_rpc(): @@ -8115,9 +8154,14 @@ async def test_create_variant_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_variant_async( - transport: str = "grpc_asyncio", request_type=config_delivery.CreateVariantRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.CreateVariantRequest(), + {}, + ], +) +async def test_create_variant_async(request_type, transport: str = "grpc_asyncio"): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8125,7 +8169,7 @@ async def test_create_variant_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_variant), "__call__") as call: @@ -8145,11 +8189,6 @@ async def test_create_variant_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_variant_async_from_dict(): - await test_create_variant_async(request_type=dict) - - def test_create_variant_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8316,8 +8355,8 @@ async def test_create_variant_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config_delivery.UpdateVariantRequest, - dict, + config_delivery.UpdateVariantRequest(), + {}, ], ) def test_update_variant(request_type, transport: str = "grpc"): @@ -8328,7 +8367,7 @@ def test_update_variant(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_variant), "__call__") as call: @@ -8367,7 +8406,8 @@ def test_update_variant_non_empty_request_with_auto_populated_field(): client.update_variant(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.UpdateVariantRequest() + request_msg = config_delivery.UpdateVariantRequest() + assert args[0] == request_msg def test_update_variant_use_cached_wrapped_rpc(): @@ -8458,9 +8498,14 @@ async def test_update_variant_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_variant_async( - transport: str = "grpc_asyncio", request_type=config_delivery.UpdateVariantRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.UpdateVariantRequest(), + {}, + ], +) +async def test_update_variant_async(request_type, transport: str = "grpc_asyncio"): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8468,7 +8513,7 @@ async def test_update_variant_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_variant), "__call__") as call: @@ -8488,11 +8533,6 @@ async def test_update_variant_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_variant_async_from_dict(): - await test_update_variant_async(request_type=dict) - - def test_update_variant_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8649,8 +8689,8 @@ async def test_update_variant_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config_delivery.DeleteVariantRequest, - dict, + config_delivery.DeleteVariantRequest(), + {}, ], ) def test_delete_variant(request_type, transport: str = "grpc"): @@ -8661,7 +8701,7 @@ def test_delete_variant(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_variant), "__call__") as call: @@ -8702,9 +8742,10 @@ def test_delete_variant_non_empty_request_with_auto_populated_field(): client.delete_variant(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.DeleteVariantRequest( + request_msg = config_delivery.DeleteVariantRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_variant_use_cached_wrapped_rpc(): @@ -8795,9 +8836,14 @@ async def test_delete_variant_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_variant_async( - transport: str = "grpc_asyncio", request_type=config_delivery.DeleteVariantRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.DeleteVariantRequest(), + {}, + ], +) +async def test_delete_variant_async(request_type, transport: str = "grpc_asyncio"): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8805,7 +8851,7 @@ async def test_delete_variant_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_variant), "__call__") as call: @@ -8825,11 +8871,6 @@ async def test_delete_variant_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_variant_async_from_dict(): - await test_delete_variant_async(request_type=dict) - - def test_delete_variant_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8976,8 +9017,8 @@ async def test_delete_variant_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config_delivery.ListRolloutsRequest, - dict, + config_delivery.ListRolloutsRequest(), + {}, ], ) def test_list_rollouts(request_type, transport: str = "grpc"): @@ -8988,7 +9029,7 @@ def test_list_rollouts(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_rollouts), "__call__") as call: @@ -9037,12 +9078,13 @@ def test_list_rollouts_non_empty_request_with_auto_populated_field(): client.list_rollouts(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.ListRolloutsRequest( + request_msg = config_delivery.ListRolloutsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_rollouts_use_cached_wrapped_rpc(): @@ -9123,9 +9165,14 @@ async def test_list_rollouts_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_rollouts_async( - transport: str = "grpc_asyncio", request_type=config_delivery.ListRolloutsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.ListRolloutsRequest(), + {}, + ], +) +async def test_list_rollouts_async(request_type, transport: str = "grpc_asyncio"): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9133,7 +9180,7 @@ async def test_list_rollouts_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_rollouts), "__call__") as call: @@ -9158,11 +9205,6 @@ async def test_list_rollouts_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_rollouts_async_from_dict(): - await test_list_rollouts_async(request_type=dict) - - def test_list_rollouts_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9499,8 +9541,8 @@ async def test_list_rollouts_async_pages(): @pytest.mark.parametrize( "request_type", [ - config_delivery.GetRolloutRequest, - dict, + config_delivery.GetRolloutRequest(), + {}, ], ) def test_get_rollout(request_type, transport: str = "grpc"): @@ -9511,7 +9553,7 @@ def test_get_rollout(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_rollout), "__call__") as call: @@ -9562,9 +9604,10 @@ def test_get_rollout_non_empty_request_with_auto_populated_field(): client.get_rollout(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.GetRolloutRequest( + request_msg = config_delivery.GetRolloutRequest( name="name_value", ) + assert args[0] == request_msg def test_get_rollout_use_cached_wrapped_rpc(): @@ -9645,9 +9688,14 @@ async def test_get_rollout_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_rollout_async( - transport: str = "grpc_asyncio", request_type=config_delivery.GetRolloutRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.GetRolloutRequest(), + {}, + ], +) +async def test_get_rollout_async(request_type, transport: str = "grpc_asyncio"): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9655,7 +9703,7 @@ async def test_get_rollout_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_rollout), "__call__") as call: @@ -9685,11 +9733,6 @@ async def test_get_rollout_async( ) -@pytest.mark.asyncio -async def test_get_rollout_async_from_dict(): - await test_get_rollout_async(request_type=dict) - - def test_get_rollout_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9836,8 +9879,8 @@ async def test_get_rollout_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config_delivery.SuspendRolloutRequest, - dict, + config_delivery.SuspendRolloutRequest(), + {}, ], ) def test_suspend_rollout(request_type, transport: str = "grpc"): @@ -9848,7 +9891,7 @@ def test_suspend_rollout(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.suspend_rollout), "__call__") as call: @@ -9890,10 +9933,11 @@ def test_suspend_rollout_non_empty_request_with_auto_populated_field(): client.suspend_rollout(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.SuspendRolloutRequest( + request_msg = config_delivery.SuspendRolloutRequest( name="name_value", reason="reason_value", ) + assert args[0] == request_msg def test_suspend_rollout_use_cached_wrapped_rpc(): @@ -9984,9 +10028,14 @@ async def test_suspend_rollout_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_suspend_rollout_async( - transport: str = "grpc_asyncio", request_type=config_delivery.SuspendRolloutRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.SuspendRolloutRequest(), + {}, + ], +) +async def test_suspend_rollout_async(request_type, transport: str = "grpc_asyncio"): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9994,7 +10043,7 @@ async def test_suspend_rollout_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.suspend_rollout), "__call__") as call: @@ -10014,11 +10063,6 @@ async def test_suspend_rollout_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_suspend_rollout_async_from_dict(): - await test_suspend_rollout_async(request_type=dict) - - def test_suspend_rollout_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10165,8 +10209,8 @@ async def test_suspend_rollout_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config_delivery.ResumeRolloutRequest, - dict, + config_delivery.ResumeRolloutRequest(), + {}, ], ) def test_resume_rollout(request_type, transport: str = "grpc"): @@ -10177,7 +10221,7 @@ def test_resume_rollout(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.resume_rollout), "__call__") as call: @@ -10219,10 +10263,11 @@ def test_resume_rollout_non_empty_request_with_auto_populated_field(): client.resume_rollout(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.ResumeRolloutRequest( + request_msg = config_delivery.ResumeRolloutRequest( name="name_value", reason="reason_value", ) + assert args[0] == request_msg def test_resume_rollout_use_cached_wrapped_rpc(): @@ -10313,9 +10358,14 @@ async def test_resume_rollout_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_resume_rollout_async( - transport: str = "grpc_asyncio", request_type=config_delivery.ResumeRolloutRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.ResumeRolloutRequest(), + {}, + ], +) +async def test_resume_rollout_async(request_type, transport: str = "grpc_asyncio"): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10323,7 +10373,7 @@ async def test_resume_rollout_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.resume_rollout), "__call__") as call: @@ -10343,11 +10393,6 @@ async def test_resume_rollout_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_resume_rollout_async_from_dict(): - await test_resume_rollout_async(request_type=dict) - - def test_resume_rollout_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10494,8 +10539,8 @@ async def test_resume_rollout_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config_delivery.AbortRolloutRequest, - dict, + config_delivery.AbortRolloutRequest(), + {}, ], ) def test_abort_rollout(request_type, transport: str = "grpc"): @@ -10506,7 +10551,7 @@ def test_abort_rollout(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.abort_rollout), "__call__") as call: @@ -10548,10 +10593,11 @@ def test_abort_rollout_non_empty_request_with_auto_populated_field(): client.abort_rollout(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.AbortRolloutRequest( + request_msg = config_delivery.AbortRolloutRequest( name="name_value", reason="reason_value", ) + assert args[0] == request_msg def test_abort_rollout_use_cached_wrapped_rpc(): @@ -10642,9 +10688,14 @@ async def test_abort_rollout_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_abort_rollout_async( - transport: str = "grpc_asyncio", request_type=config_delivery.AbortRolloutRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.AbortRolloutRequest(), + {}, + ], +) +async def test_abort_rollout_async(request_type, transport: str = "grpc_asyncio"): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10652,7 +10703,7 @@ async def test_abort_rollout_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.abort_rollout), "__call__") as call: @@ -10672,11 +10723,6 @@ async def test_abort_rollout_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_abort_rollout_async_from_dict(): - await test_abort_rollout_async(request_type=dict) - - def test_abort_rollout_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16163,7 +16209,6 @@ def test_list_resource_bundles_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.ListResourceBundlesRequest() - assert args[0] == request_msg @@ -16186,7 +16231,6 @@ def test_get_resource_bundle_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.GetResourceBundleRequest() - assert args[0] == request_msg @@ -16209,7 +16253,6 @@ def test_create_resource_bundle_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.CreateResourceBundleRequest() - assert args[0] == request_msg @@ -16232,7 +16275,6 @@ def test_update_resource_bundle_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.UpdateResourceBundleRequest() - assert args[0] == request_msg @@ -16255,7 +16297,6 @@ def test_delete_resource_bundle_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.DeleteResourceBundleRequest() - assert args[0] == request_msg @@ -16278,7 +16319,6 @@ def test_list_fleet_packages_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.ListFleetPackagesRequest() - assert args[0] == request_msg @@ -16301,7 +16341,6 @@ def test_get_fleet_package_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.GetFleetPackageRequest() - assert args[0] == request_msg @@ -16324,7 +16363,6 @@ def test_create_fleet_package_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.CreateFleetPackageRequest() - assert args[0] == request_msg @@ -16347,7 +16385,6 @@ def test_update_fleet_package_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.UpdateFleetPackageRequest() - assert args[0] == request_msg @@ -16370,7 +16407,6 @@ def test_delete_fleet_package_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.DeleteFleetPackageRequest() - assert args[0] == request_msg @@ -16391,7 +16427,6 @@ def test_list_releases_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.ListReleasesRequest() - assert args[0] == request_msg @@ -16412,7 +16447,6 @@ def test_get_release_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.GetReleaseRequest() - assert args[0] == request_msg @@ -16433,7 +16467,6 @@ def test_create_release_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.CreateReleaseRequest() - assert args[0] == request_msg @@ -16454,7 +16487,6 @@ def test_update_release_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.UpdateReleaseRequest() - assert args[0] == request_msg @@ -16475,7 +16507,6 @@ def test_delete_release_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.DeleteReleaseRequest() - assert args[0] == request_msg @@ -16496,7 +16527,6 @@ def test_list_variants_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.ListVariantsRequest() - assert args[0] == request_msg @@ -16517,7 +16547,6 @@ def test_get_variant_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.GetVariantRequest() - assert args[0] == request_msg @@ -16538,7 +16567,6 @@ def test_create_variant_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.CreateVariantRequest() - assert args[0] == request_msg @@ -16559,7 +16587,6 @@ def test_update_variant_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.UpdateVariantRequest() - assert args[0] == request_msg @@ -16580,7 +16607,6 @@ def test_delete_variant_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.DeleteVariantRequest() - assert args[0] == request_msg @@ -16601,7 +16627,6 @@ def test_list_rollouts_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.ListRolloutsRequest() - assert args[0] == request_msg @@ -16622,7 +16647,6 @@ def test_get_rollout_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.GetRolloutRequest() - assert args[0] == request_msg @@ -16643,7 +16667,6 @@ def test_suspend_rollout_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.SuspendRolloutRequest() - assert args[0] == request_msg @@ -16664,7 +16687,6 @@ def test_resume_rollout_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.ResumeRolloutRequest() - assert args[0] == request_msg @@ -16685,7 +16707,6 @@ def test_abort_rollout_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.AbortRolloutRequest() - assert args[0] == request_msg @@ -16729,7 +16750,6 @@ async def test_list_resource_bundles_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.ListResourceBundlesRequest() - assert args[0] == request_msg @@ -16759,7 +16779,6 @@ async def test_get_resource_bundle_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.GetResourceBundleRequest() - assert args[0] == request_msg @@ -16786,7 +16805,6 @@ async def test_create_resource_bundle_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.CreateResourceBundleRequest() - assert args[0] == request_msg @@ -16813,7 +16831,6 @@ async def test_update_resource_bundle_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.UpdateResourceBundleRequest() - assert args[0] == request_msg @@ -16840,7 +16857,6 @@ async def test_delete_resource_bundle_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.DeleteResourceBundleRequest() - assert args[0] == request_msg @@ -16870,7 +16886,6 @@ async def test_list_fleet_packages_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.ListFleetPackagesRequest() - assert args[0] == request_msg @@ -16901,7 +16916,6 @@ async def test_get_fleet_package_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.GetFleetPackageRequest() - assert args[0] == request_msg @@ -16928,7 +16942,6 @@ async def test_create_fleet_package_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.CreateFleetPackageRequest() - assert args[0] == request_msg @@ -16955,7 +16968,6 @@ async def test_update_fleet_package_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.UpdateFleetPackageRequest() - assert args[0] == request_msg @@ -16982,7 +16994,6 @@ async def test_delete_fleet_package_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.DeleteFleetPackageRequest() - assert args[0] == request_msg @@ -17010,7 +17021,6 @@ async def test_list_releases_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.ListReleasesRequest() - assert args[0] == request_msg @@ -17039,7 +17049,6 @@ async def test_get_release_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.GetReleaseRequest() - assert args[0] == request_msg @@ -17064,7 +17073,6 @@ async def test_create_release_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.CreateReleaseRequest() - assert args[0] == request_msg @@ -17089,7 +17097,6 @@ async def test_update_release_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.UpdateReleaseRequest() - assert args[0] == request_msg @@ -17114,7 +17121,6 @@ async def test_delete_release_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.DeleteReleaseRequest() - assert args[0] == request_msg @@ -17142,7 +17148,6 @@ async def test_list_variants_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.ListVariantsRequest() - assert args[0] == request_msg @@ -17170,7 +17175,6 @@ async def test_get_variant_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.GetVariantRequest() - assert args[0] == request_msg @@ -17195,7 +17199,6 @@ async def test_create_variant_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.CreateVariantRequest() - assert args[0] == request_msg @@ -17220,7 +17223,6 @@ async def test_update_variant_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.UpdateVariantRequest() - assert args[0] == request_msg @@ -17245,7 +17247,6 @@ async def test_delete_variant_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.DeleteVariantRequest() - assert args[0] == request_msg @@ -17273,7 +17274,6 @@ async def test_list_rollouts_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.ListRolloutsRequest() - assert args[0] == request_msg @@ -17302,7 +17302,6 @@ async def test_get_rollout_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.GetRolloutRequest() - assert args[0] == request_msg @@ -17327,7 +17326,6 @@ async def test_suspend_rollout_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.SuspendRolloutRequest() - assert args[0] == request_msg @@ -17352,7 +17350,6 @@ async def test_resume_rollout_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.ResumeRolloutRequest() - assert args[0] == request_msg @@ -17377,7 +17374,6 @@ async def test_abort_rollout_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.AbortRolloutRequest() - assert args[0] == request_msg @@ -21779,7 +21775,6 @@ def test_list_resource_bundles_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.ListResourceBundlesRequest() - assert args[0] == request_msg @@ -21801,7 +21796,6 @@ def test_get_resource_bundle_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.GetResourceBundleRequest() - assert args[0] == request_msg @@ -21823,7 +21817,6 @@ def test_create_resource_bundle_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.CreateResourceBundleRequest() - assert args[0] == request_msg @@ -21845,7 +21838,6 @@ def test_update_resource_bundle_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.UpdateResourceBundleRequest() - assert args[0] == request_msg @@ -21867,7 +21859,6 @@ def test_delete_resource_bundle_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.DeleteResourceBundleRequest() - assert args[0] == request_msg @@ -21889,7 +21880,6 @@ def test_list_fleet_packages_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.ListFleetPackagesRequest() - assert args[0] == request_msg @@ -21911,7 +21901,6 @@ def test_get_fleet_package_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.GetFleetPackageRequest() - assert args[0] == request_msg @@ -21933,7 +21922,6 @@ def test_create_fleet_package_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.CreateFleetPackageRequest() - assert args[0] == request_msg @@ -21955,7 +21943,6 @@ def test_update_fleet_package_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.UpdateFleetPackageRequest() - assert args[0] == request_msg @@ -21977,7 +21964,6 @@ def test_delete_fleet_package_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.DeleteFleetPackageRequest() - assert args[0] == request_msg @@ -21997,7 +21983,6 @@ def test_list_releases_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.ListReleasesRequest() - assert args[0] == request_msg @@ -22017,7 +22002,6 @@ def test_get_release_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.GetReleaseRequest() - assert args[0] == request_msg @@ -22037,7 +22021,6 @@ def test_create_release_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.CreateReleaseRequest() - assert args[0] == request_msg @@ -22057,7 +22040,6 @@ def test_update_release_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.UpdateReleaseRequest() - assert args[0] == request_msg @@ -22077,7 +22059,6 @@ def test_delete_release_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.DeleteReleaseRequest() - assert args[0] == request_msg @@ -22097,7 +22078,6 @@ def test_list_variants_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.ListVariantsRequest() - assert args[0] == request_msg @@ -22117,7 +22097,6 @@ def test_get_variant_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.GetVariantRequest() - assert args[0] == request_msg @@ -22137,7 +22116,6 @@ def test_create_variant_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.CreateVariantRequest() - assert args[0] == request_msg @@ -22157,7 +22135,6 @@ def test_update_variant_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.UpdateVariantRequest() - assert args[0] == request_msg @@ -22177,7 +22154,6 @@ def test_delete_variant_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.DeleteVariantRequest() - assert args[0] == request_msg @@ -22197,7 +22173,6 @@ def test_list_rollouts_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.ListRolloutsRequest() - assert args[0] == request_msg @@ -22217,7 +22192,6 @@ def test_get_rollout_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.GetRolloutRequest() - assert args[0] == request_msg @@ -22237,7 +22211,6 @@ def test_suspend_rollout_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.SuspendRolloutRequest() - assert args[0] == request_msg @@ -22257,7 +22230,6 @@ def test_resume_rollout_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.ResumeRolloutRequest() - assert args[0] == request_msg @@ -22277,7 +22249,6 @@ def test_abort_rollout_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.AbortRolloutRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-configdelivery/tests/unit/gapic/configdelivery_v1alpha/test_config_delivery.py b/packages/google-cloud-configdelivery/tests/unit/gapic/configdelivery_v1alpha/test_config_delivery.py index 130660f27557..8f0d9b53bceb 100644 --- a/packages/google-cloud-configdelivery/tests/unit/gapic/configdelivery_v1alpha/test_config_delivery.py +++ b/packages/google-cloud-configdelivery/tests/unit/gapic/configdelivery_v1alpha/test_config_delivery.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 @@ -116,6 +117,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" @@ -1319,8 +1335,8 @@ def test_config_delivery_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - config_delivery.ListResourceBundlesRequest, - dict, + config_delivery.ListResourceBundlesRequest(), + {}, ], ) def test_list_resource_bundles(request_type, transport: str = "grpc"): @@ -1331,7 +1347,7 @@ def test_list_resource_bundles(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1384,12 +1400,13 @@ def test_list_resource_bundles_non_empty_request_with_auto_populated_field(): client.list_resource_bundles(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.ListResourceBundlesRequest( + request_msg = config_delivery.ListResourceBundlesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_resource_bundles_use_cached_wrapped_rpc(): @@ -1475,9 +1492,15 @@ async def test_list_resource_bundles_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.ListResourceBundlesRequest(), + {}, + ], +) async def test_list_resource_bundles_async( - transport: str = "grpc_asyncio", - request_type=config_delivery.ListResourceBundlesRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), @@ -1486,7 +1509,7 @@ async def test_list_resource_bundles_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( @@ -1513,11 +1536,6 @@ async def test_list_resource_bundles_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_resource_bundles_async_from_dict(): - await test_list_resource_bundles_async(request_type=dict) - - def test_list_resource_bundles_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1870,8 +1888,8 @@ async def test_list_resource_bundles_async_pages(): @pytest.mark.parametrize( "request_type", [ - config_delivery.GetResourceBundleRequest, - dict, + config_delivery.GetResourceBundleRequest(), + {}, ], ) def test_get_resource_bundle(request_type, transport: str = "grpc"): @@ -1882,7 +1900,7 @@ def test_get_resource_bundle(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1932,9 +1950,10 @@ def test_get_resource_bundle_non_empty_request_with_auto_populated_field(): client.get_resource_bundle(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.GetResourceBundleRequest( + request_msg = config_delivery.GetResourceBundleRequest( name="name_value", ) + assert args[0] == request_msg def test_get_resource_bundle_use_cached_wrapped_rpc(): @@ -2019,10 +2038,14 @@ async def test_get_resource_bundle_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_resource_bundle_async( - transport: str = "grpc_asyncio", - request_type=config_delivery.GetResourceBundleRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.GetResourceBundleRequest(), + {}, + ], +) +async def test_get_resource_bundle_async(request_type, transport: str = "grpc_asyncio"): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2030,7 +2053,7 @@ async def test_get_resource_bundle_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( @@ -2057,11 +2080,6 @@ async def test_get_resource_bundle_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_get_resource_bundle_async_from_dict(): - await test_get_resource_bundle_async(request_type=dict) - - def test_get_resource_bundle_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2216,8 +2234,8 @@ async def test_get_resource_bundle_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config_delivery.CreateResourceBundleRequest, - dict, + config_delivery.CreateResourceBundleRequest(), + {}, ], ) def test_create_resource_bundle(request_type, transport: str = "grpc"): @@ -2228,7 +2246,7 @@ def test_create_resource_bundle(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2274,10 +2292,11 @@ def test_create_resource_bundle_non_empty_request_with_auto_populated_field(): client.create_resource_bundle(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.CreateResourceBundleRequest( + request_msg = config_delivery.CreateResourceBundleRequest( parent="parent_value", resource_bundle_id="resource_bundle_id_value", ) + assert args[0] == request_msg def test_create_resource_bundle_use_cached_wrapped_rpc(): @@ -2373,9 +2392,15 @@ async def test_create_resource_bundle_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.CreateResourceBundleRequest(), + {}, + ], +) async def test_create_resource_bundle_async( - transport: str = "grpc_asyncio", - request_type=config_delivery.CreateResourceBundleRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), @@ -2384,7 +2409,7 @@ async def test_create_resource_bundle_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( @@ -2406,11 +2431,6 @@ async def test_create_resource_bundle_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_resource_bundle_async_from_dict(): - await test_create_resource_bundle_async(request_type=dict) - - def test_create_resource_bundle_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2585,8 +2605,8 @@ async def test_create_resource_bundle_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config_delivery.UpdateResourceBundleRequest, - dict, + config_delivery.UpdateResourceBundleRequest(), + {}, ], ) def test_update_resource_bundle(request_type, transport: str = "grpc"): @@ -2597,7 +2617,7 @@ def test_update_resource_bundle(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2640,7 +2660,8 @@ def test_update_resource_bundle_non_empty_request_with_auto_populated_field(): client.update_resource_bundle(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.UpdateResourceBundleRequest() + request_msg = config_delivery.UpdateResourceBundleRequest() + assert args[0] == request_msg def test_update_resource_bundle_use_cached_wrapped_rpc(): @@ -2736,9 +2757,15 @@ async def test_update_resource_bundle_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.UpdateResourceBundleRequest(), + {}, + ], +) async def test_update_resource_bundle_async( - transport: str = "grpc_asyncio", - request_type=config_delivery.UpdateResourceBundleRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), @@ -2747,7 +2774,7 @@ async def test_update_resource_bundle_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( @@ -2769,11 +2796,6 @@ async def test_update_resource_bundle_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_resource_bundle_async_from_dict(): - await test_update_resource_bundle_async(request_type=dict) - - def test_update_resource_bundle_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2938,8 +2960,8 @@ async def test_update_resource_bundle_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config_delivery.DeleteResourceBundleRequest, - dict, + config_delivery.DeleteResourceBundleRequest(), + {}, ], ) def test_delete_resource_bundle(request_type, transport: str = "grpc"): @@ -2950,7 +2972,7 @@ def test_delete_resource_bundle(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2995,9 +3017,10 @@ def test_delete_resource_bundle_non_empty_request_with_auto_populated_field(): client.delete_resource_bundle(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.DeleteResourceBundleRequest( + request_msg = config_delivery.DeleteResourceBundleRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_resource_bundle_use_cached_wrapped_rpc(): @@ -3093,9 +3116,15 @@ async def test_delete_resource_bundle_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.DeleteResourceBundleRequest(), + {}, + ], +) async def test_delete_resource_bundle_async( - transport: str = "grpc_asyncio", - request_type=config_delivery.DeleteResourceBundleRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), @@ -3104,7 +3133,7 @@ async def test_delete_resource_bundle_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( @@ -3126,11 +3155,6 @@ async def test_delete_resource_bundle_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_resource_bundle_async_from_dict(): - await test_delete_resource_bundle_async(request_type=dict) - - def test_delete_resource_bundle_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3285,8 +3309,8 @@ async def test_delete_resource_bundle_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config_delivery.ListFleetPackagesRequest, - dict, + config_delivery.ListFleetPackagesRequest(), + {}, ], ) def test_list_fleet_packages(request_type, transport: str = "grpc"): @@ -3297,7 +3321,7 @@ def test_list_fleet_packages(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3350,12 +3374,13 @@ def test_list_fleet_packages_non_empty_request_with_auto_populated_field(): client.list_fleet_packages(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.ListFleetPackagesRequest( + request_msg = config_delivery.ListFleetPackagesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_fleet_packages_use_cached_wrapped_rpc(): @@ -3440,10 +3465,14 @@ async def test_list_fleet_packages_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_fleet_packages_async( - transport: str = "grpc_asyncio", - request_type=config_delivery.ListFleetPackagesRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.ListFleetPackagesRequest(), + {}, + ], +) +async def test_list_fleet_packages_async(request_type, transport: str = "grpc_asyncio"): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3451,7 +3480,7 @@ async def test_list_fleet_packages_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( @@ -3478,11 +3507,6 @@ async def test_list_fleet_packages_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_fleet_packages_async_from_dict(): - await test_list_fleet_packages_async(request_type=dict) - - def test_list_fleet_packages_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3835,8 +3859,8 @@ async def test_list_fleet_packages_async_pages(): @pytest.mark.parametrize( "request_type", [ - config_delivery.GetFleetPackageRequest, - dict, + config_delivery.GetFleetPackageRequest(), + {}, ], ) def test_get_fleet_package(request_type, transport: str = "grpc"): @@ -3847,7 +3871,7 @@ def test_get_fleet_package(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3902,9 +3926,10 @@ def test_get_fleet_package_non_empty_request_with_auto_populated_field(): client.get_fleet_package(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.GetFleetPackageRequest( + request_msg = config_delivery.GetFleetPackageRequest( name="name_value", ) + assert args[0] == request_msg def test_get_fleet_package_use_cached_wrapped_rpc(): @@ -3987,9 +4012,14 @@ async def test_get_fleet_package_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_fleet_package_async( - transport: str = "grpc_asyncio", request_type=config_delivery.GetFleetPackageRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.GetFleetPackageRequest(), + {}, + ], +) +async def test_get_fleet_package_async(request_type, transport: str = "grpc_asyncio"): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3997,7 +4027,7 @@ async def test_get_fleet_package_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( @@ -4029,11 +4059,6 @@ async def test_get_fleet_package_async( assert response.state == config_delivery.FleetPackage.State.ACTIVE -@pytest.mark.asyncio -async def test_get_fleet_package_async_from_dict(): - await test_get_fleet_package_async(request_type=dict) - - def test_get_fleet_package_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4188,8 +4213,8 @@ async def test_get_fleet_package_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config_delivery.CreateFleetPackageRequest, - dict, + config_delivery.CreateFleetPackageRequest(), + {}, ], ) def test_create_fleet_package(request_type, transport: str = "grpc"): @@ -4200,7 +4225,7 @@ def test_create_fleet_package(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4246,10 +4271,11 @@ def test_create_fleet_package_non_empty_request_with_auto_populated_field(): client.create_fleet_package(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.CreateFleetPackageRequest( + request_msg = config_delivery.CreateFleetPackageRequest( parent="parent_value", fleet_package_id="fleet_package_id_value", ) + assert args[0] == request_msg def test_create_fleet_package_use_cached_wrapped_rpc(): @@ -4344,9 +4370,15 @@ async def test_create_fleet_package_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.CreateFleetPackageRequest(), + {}, + ], +) async def test_create_fleet_package_async( - transport: str = "grpc_asyncio", - request_type=config_delivery.CreateFleetPackageRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), @@ -4355,7 +4387,7 @@ async def test_create_fleet_package_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( @@ -4377,11 +4409,6 @@ async def test_create_fleet_package_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_fleet_package_async_from_dict(): - await test_create_fleet_package_async(request_type=dict) - - def test_create_fleet_package_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4556,8 +4583,8 @@ async def test_create_fleet_package_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config_delivery.UpdateFleetPackageRequest, - dict, + config_delivery.UpdateFleetPackageRequest(), + {}, ], ) def test_update_fleet_package(request_type, transport: str = "grpc"): @@ -4568,7 +4595,7 @@ def test_update_fleet_package(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4611,7 +4638,8 @@ def test_update_fleet_package_non_empty_request_with_auto_populated_field(): client.update_fleet_package(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.UpdateFleetPackageRequest() + request_msg = config_delivery.UpdateFleetPackageRequest() + assert args[0] == request_msg def test_update_fleet_package_use_cached_wrapped_rpc(): @@ -4706,9 +4734,15 @@ async def test_update_fleet_package_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.UpdateFleetPackageRequest(), + {}, + ], +) async def test_update_fleet_package_async( - transport: str = "grpc_asyncio", - request_type=config_delivery.UpdateFleetPackageRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), @@ -4717,7 +4751,7 @@ async def test_update_fleet_package_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( @@ -4739,11 +4773,6 @@ async def test_update_fleet_package_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_fleet_package_async_from_dict(): - await test_update_fleet_package_async(request_type=dict) - - def test_update_fleet_package_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4908,8 +4937,8 @@ async def test_update_fleet_package_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config_delivery.DeleteFleetPackageRequest, - dict, + config_delivery.DeleteFleetPackageRequest(), + {}, ], ) def test_delete_fleet_package(request_type, transport: str = "grpc"): @@ -4920,7 +4949,7 @@ def test_delete_fleet_package(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4965,9 +4994,10 @@ def test_delete_fleet_package_non_empty_request_with_auto_populated_field(): client.delete_fleet_package(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.DeleteFleetPackageRequest( + request_msg = config_delivery.DeleteFleetPackageRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_fleet_package_use_cached_wrapped_rpc(): @@ -5062,9 +5092,15 @@ async def test_delete_fleet_package_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.DeleteFleetPackageRequest(), + {}, + ], +) async def test_delete_fleet_package_async( - transport: str = "grpc_asyncio", - request_type=config_delivery.DeleteFleetPackageRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), @@ -5073,7 +5109,7 @@ async def test_delete_fleet_package_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( @@ -5095,11 +5131,6 @@ async def test_delete_fleet_package_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_fleet_package_async_from_dict(): - await test_delete_fleet_package_async(request_type=dict) - - def test_delete_fleet_package_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5254,8 +5285,8 @@ async def test_delete_fleet_package_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config_delivery.ListReleasesRequest, - dict, + config_delivery.ListReleasesRequest(), + {}, ], ) def test_list_releases(request_type, transport: str = "grpc"): @@ -5266,7 +5297,7 @@ def test_list_releases(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_releases), "__call__") as call: @@ -5315,12 +5346,13 @@ def test_list_releases_non_empty_request_with_auto_populated_field(): client.list_releases(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.ListReleasesRequest( + request_msg = config_delivery.ListReleasesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_releases_use_cached_wrapped_rpc(): @@ -5401,9 +5433,14 @@ async def test_list_releases_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_releases_async( - transport: str = "grpc_asyncio", request_type=config_delivery.ListReleasesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.ListReleasesRequest(), + {}, + ], +) +async def test_list_releases_async(request_type, transport: str = "grpc_asyncio"): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5411,7 +5448,7 @@ async def test_list_releases_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_releases), "__call__") as call: @@ -5436,11 +5473,6 @@ async def test_list_releases_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_releases_async_from_dict(): - await test_list_releases_async(request_type=dict) - - def test_list_releases_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5777,8 +5809,8 @@ async def test_list_releases_async_pages(): @pytest.mark.parametrize( "request_type", [ - config_delivery.GetReleaseRequest, - dict, + config_delivery.GetReleaseRequest(), + {}, ], ) def test_get_release(request_type, transport: str = "grpc"): @@ -5789,7 +5821,7 @@ def test_get_release(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_release), "__call__") as call: @@ -5837,9 +5869,10 @@ def test_get_release_non_empty_request_with_auto_populated_field(): client.get_release(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.GetReleaseRequest( + request_msg = config_delivery.GetReleaseRequest( name="name_value", ) + assert args[0] == request_msg def test_get_release_use_cached_wrapped_rpc(): @@ -5920,9 +5953,14 @@ async def test_get_release_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_release_async( - transport: str = "grpc_asyncio", request_type=config_delivery.GetReleaseRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.GetReleaseRequest(), + {}, + ], +) +async def test_get_release_async(request_type, transport: str = "grpc_asyncio"): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5930,7 +5968,7 @@ async def test_get_release_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_release), "__call__") as call: @@ -5957,11 +5995,6 @@ async def test_get_release_async( assert response.version == "version_value" -@pytest.mark.asyncio -async def test_get_release_async_from_dict(): - await test_get_release_async(request_type=dict) - - def test_get_release_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6108,8 +6141,8 @@ async def test_get_release_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config_delivery.CreateReleaseRequest, - dict, + config_delivery.CreateReleaseRequest(), + {}, ], ) def test_create_release(request_type, transport: str = "grpc"): @@ -6120,7 +6153,7 @@ def test_create_release(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_release), "__call__") as call: @@ -6162,10 +6195,11 @@ def test_create_release_non_empty_request_with_auto_populated_field(): client.create_release(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.CreateReleaseRequest( + request_msg = config_delivery.CreateReleaseRequest( parent="parent_value", release_id="release_id_value", ) + assert args[0] == request_msg def test_create_release_use_cached_wrapped_rpc(): @@ -6256,9 +6290,14 @@ async def test_create_release_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_release_async( - transport: str = "grpc_asyncio", request_type=config_delivery.CreateReleaseRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.CreateReleaseRequest(), + {}, + ], +) +async def test_create_release_async(request_type, transport: str = "grpc_asyncio"): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6266,7 +6305,7 @@ async def test_create_release_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_release), "__call__") as call: @@ -6286,11 +6325,6 @@ async def test_create_release_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_release_async_from_dict(): - await test_create_release_async(request_type=dict) - - def test_create_release_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6457,8 +6491,8 @@ async def test_create_release_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config_delivery.UpdateReleaseRequest, - dict, + config_delivery.UpdateReleaseRequest(), + {}, ], ) def test_update_release(request_type, transport: str = "grpc"): @@ -6469,7 +6503,7 @@ def test_update_release(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_release), "__call__") as call: @@ -6508,7 +6542,8 @@ def test_update_release_non_empty_request_with_auto_populated_field(): client.update_release(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.UpdateReleaseRequest() + request_msg = config_delivery.UpdateReleaseRequest() + assert args[0] == request_msg def test_update_release_use_cached_wrapped_rpc(): @@ -6599,9 +6634,14 @@ async def test_update_release_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_release_async( - transport: str = "grpc_asyncio", request_type=config_delivery.UpdateReleaseRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.UpdateReleaseRequest(), + {}, + ], +) +async def test_update_release_async(request_type, transport: str = "grpc_asyncio"): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6609,7 +6649,7 @@ async def test_update_release_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_release), "__call__") as call: @@ -6629,11 +6669,6 @@ async def test_update_release_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_release_async_from_dict(): - await test_update_release_async(request_type=dict) - - def test_update_release_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6790,8 +6825,8 @@ async def test_update_release_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config_delivery.DeleteReleaseRequest, - dict, + config_delivery.DeleteReleaseRequest(), + {}, ], ) def test_delete_release(request_type, transport: str = "grpc"): @@ -6802,7 +6837,7 @@ def test_delete_release(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_release), "__call__") as call: @@ -6843,9 +6878,10 @@ def test_delete_release_non_empty_request_with_auto_populated_field(): client.delete_release(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.DeleteReleaseRequest( + request_msg = config_delivery.DeleteReleaseRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_release_use_cached_wrapped_rpc(): @@ -6936,9 +6972,14 @@ async def test_delete_release_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_release_async( - transport: str = "grpc_asyncio", request_type=config_delivery.DeleteReleaseRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.DeleteReleaseRequest(), + {}, + ], +) +async def test_delete_release_async(request_type, transport: str = "grpc_asyncio"): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6946,7 +6987,7 @@ async def test_delete_release_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_release), "__call__") as call: @@ -6966,11 +7007,6 @@ async def test_delete_release_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_release_async_from_dict(): - await test_delete_release_async(request_type=dict) - - def test_delete_release_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7117,8 +7153,8 @@ async def test_delete_release_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config_delivery.ListVariantsRequest, - dict, + config_delivery.ListVariantsRequest(), + {}, ], ) def test_list_variants(request_type, transport: str = "grpc"): @@ -7129,7 +7165,7 @@ def test_list_variants(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_variants), "__call__") as call: @@ -7178,12 +7214,13 @@ def test_list_variants_non_empty_request_with_auto_populated_field(): client.list_variants(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.ListVariantsRequest( + request_msg = config_delivery.ListVariantsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_variants_use_cached_wrapped_rpc(): @@ -7264,9 +7301,14 @@ async def test_list_variants_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_variants_async( - transport: str = "grpc_asyncio", request_type=config_delivery.ListVariantsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.ListVariantsRequest(), + {}, + ], +) +async def test_list_variants_async(request_type, transport: str = "grpc_asyncio"): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7274,7 +7316,7 @@ async def test_list_variants_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_variants), "__call__") as call: @@ -7299,11 +7341,6 @@ async def test_list_variants_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_variants_async_from_dict(): - await test_list_variants_async(request_type=dict) - - def test_list_variants_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7640,8 +7677,8 @@ async def test_list_variants_async_pages(): @pytest.mark.parametrize( "request_type", [ - config_delivery.GetVariantRequest, - dict, + config_delivery.GetVariantRequest(), + {}, ], ) def test_get_variant(request_type, transport: str = "grpc"): @@ -7652,7 +7689,7 @@ def test_get_variant(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_variant), "__call__") as call: @@ -7698,9 +7735,10 @@ def test_get_variant_non_empty_request_with_auto_populated_field(): client.get_variant(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.GetVariantRequest( + request_msg = config_delivery.GetVariantRequest( name="name_value", ) + assert args[0] == request_msg def test_get_variant_use_cached_wrapped_rpc(): @@ -7781,9 +7819,14 @@ async def test_get_variant_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_variant_async( - transport: str = "grpc_asyncio", request_type=config_delivery.GetVariantRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.GetVariantRequest(), + {}, + ], +) +async def test_get_variant_async(request_type, transport: str = "grpc_asyncio"): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7791,7 +7834,7 @@ async def test_get_variant_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_variant), "__call__") as call: @@ -7816,11 +7859,6 @@ async def test_get_variant_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_variant_async_from_dict(): - await test_get_variant_async(request_type=dict) - - def test_get_variant_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7967,8 +8005,8 @@ async def test_get_variant_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config_delivery.CreateVariantRequest, - dict, + config_delivery.CreateVariantRequest(), + {}, ], ) def test_create_variant(request_type, transport: str = "grpc"): @@ -7979,7 +8017,7 @@ def test_create_variant(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_variant), "__call__") as call: @@ -8021,10 +8059,11 @@ def test_create_variant_non_empty_request_with_auto_populated_field(): client.create_variant(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.CreateVariantRequest( + request_msg = config_delivery.CreateVariantRequest( parent="parent_value", variant_id="variant_id_value", ) + assert args[0] == request_msg def test_create_variant_use_cached_wrapped_rpc(): @@ -8115,9 +8154,14 @@ async def test_create_variant_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_variant_async( - transport: str = "grpc_asyncio", request_type=config_delivery.CreateVariantRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.CreateVariantRequest(), + {}, + ], +) +async def test_create_variant_async(request_type, transport: str = "grpc_asyncio"): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8125,7 +8169,7 @@ async def test_create_variant_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_variant), "__call__") as call: @@ -8145,11 +8189,6 @@ async def test_create_variant_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_variant_async_from_dict(): - await test_create_variant_async(request_type=dict) - - def test_create_variant_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8316,8 +8355,8 @@ async def test_create_variant_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config_delivery.UpdateVariantRequest, - dict, + config_delivery.UpdateVariantRequest(), + {}, ], ) def test_update_variant(request_type, transport: str = "grpc"): @@ -8328,7 +8367,7 @@ def test_update_variant(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_variant), "__call__") as call: @@ -8367,7 +8406,8 @@ def test_update_variant_non_empty_request_with_auto_populated_field(): client.update_variant(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.UpdateVariantRequest() + request_msg = config_delivery.UpdateVariantRequest() + assert args[0] == request_msg def test_update_variant_use_cached_wrapped_rpc(): @@ -8458,9 +8498,14 @@ async def test_update_variant_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_variant_async( - transport: str = "grpc_asyncio", request_type=config_delivery.UpdateVariantRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.UpdateVariantRequest(), + {}, + ], +) +async def test_update_variant_async(request_type, transport: str = "grpc_asyncio"): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8468,7 +8513,7 @@ async def test_update_variant_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_variant), "__call__") as call: @@ -8488,11 +8533,6 @@ async def test_update_variant_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_variant_async_from_dict(): - await test_update_variant_async(request_type=dict) - - def test_update_variant_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8649,8 +8689,8 @@ async def test_update_variant_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config_delivery.DeleteVariantRequest, - dict, + config_delivery.DeleteVariantRequest(), + {}, ], ) def test_delete_variant(request_type, transport: str = "grpc"): @@ -8661,7 +8701,7 @@ def test_delete_variant(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_variant), "__call__") as call: @@ -8702,9 +8742,10 @@ def test_delete_variant_non_empty_request_with_auto_populated_field(): client.delete_variant(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.DeleteVariantRequest( + request_msg = config_delivery.DeleteVariantRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_variant_use_cached_wrapped_rpc(): @@ -8795,9 +8836,14 @@ async def test_delete_variant_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_variant_async( - transport: str = "grpc_asyncio", request_type=config_delivery.DeleteVariantRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.DeleteVariantRequest(), + {}, + ], +) +async def test_delete_variant_async(request_type, transport: str = "grpc_asyncio"): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8805,7 +8851,7 @@ async def test_delete_variant_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_variant), "__call__") as call: @@ -8825,11 +8871,6 @@ async def test_delete_variant_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_variant_async_from_dict(): - await test_delete_variant_async(request_type=dict) - - def test_delete_variant_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8976,8 +9017,8 @@ async def test_delete_variant_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config_delivery.ListRolloutsRequest, - dict, + config_delivery.ListRolloutsRequest(), + {}, ], ) def test_list_rollouts(request_type, transport: str = "grpc"): @@ -8988,7 +9029,7 @@ def test_list_rollouts(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_rollouts), "__call__") as call: @@ -9037,12 +9078,13 @@ def test_list_rollouts_non_empty_request_with_auto_populated_field(): client.list_rollouts(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.ListRolloutsRequest( + request_msg = config_delivery.ListRolloutsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_rollouts_use_cached_wrapped_rpc(): @@ -9123,9 +9165,14 @@ async def test_list_rollouts_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_rollouts_async( - transport: str = "grpc_asyncio", request_type=config_delivery.ListRolloutsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.ListRolloutsRequest(), + {}, + ], +) +async def test_list_rollouts_async(request_type, transport: str = "grpc_asyncio"): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9133,7 +9180,7 @@ async def test_list_rollouts_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_rollouts), "__call__") as call: @@ -9158,11 +9205,6 @@ async def test_list_rollouts_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_rollouts_async_from_dict(): - await test_list_rollouts_async(request_type=dict) - - def test_list_rollouts_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9499,8 +9541,8 @@ async def test_list_rollouts_async_pages(): @pytest.mark.parametrize( "request_type", [ - config_delivery.GetRolloutRequest, - dict, + config_delivery.GetRolloutRequest(), + {}, ], ) def test_get_rollout(request_type, transport: str = "grpc"): @@ -9511,7 +9553,7 @@ def test_get_rollout(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_rollout), "__call__") as call: @@ -9562,9 +9604,10 @@ def test_get_rollout_non_empty_request_with_auto_populated_field(): client.get_rollout(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.GetRolloutRequest( + request_msg = config_delivery.GetRolloutRequest( name="name_value", ) + assert args[0] == request_msg def test_get_rollout_use_cached_wrapped_rpc(): @@ -9645,9 +9688,14 @@ async def test_get_rollout_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_rollout_async( - transport: str = "grpc_asyncio", request_type=config_delivery.GetRolloutRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.GetRolloutRequest(), + {}, + ], +) +async def test_get_rollout_async(request_type, transport: str = "grpc_asyncio"): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9655,7 +9703,7 @@ async def test_get_rollout_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_rollout), "__call__") as call: @@ -9685,11 +9733,6 @@ async def test_get_rollout_async( ) -@pytest.mark.asyncio -async def test_get_rollout_async_from_dict(): - await test_get_rollout_async(request_type=dict) - - def test_get_rollout_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9836,8 +9879,8 @@ async def test_get_rollout_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config_delivery.SuspendRolloutRequest, - dict, + config_delivery.SuspendRolloutRequest(), + {}, ], ) def test_suspend_rollout(request_type, transport: str = "grpc"): @@ -9848,7 +9891,7 @@ def test_suspend_rollout(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.suspend_rollout), "__call__") as call: @@ -9890,10 +9933,11 @@ def test_suspend_rollout_non_empty_request_with_auto_populated_field(): client.suspend_rollout(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.SuspendRolloutRequest( + request_msg = config_delivery.SuspendRolloutRequest( name="name_value", reason="reason_value", ) + assert args[0] == request_msg def test_suspend_rollout_use_cached_wrapped_rpc(): @@ -9984,9 +10028,14 @@ async def test_suspend_rollout_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_suspend_rollout_async( - transport: str = "grpc_asyncio", request_type=config_delivery.SuspendRolloutRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.SuspendRolloutRequest(), + {}, + ], +) +async def test_suspend_rollout_async(request_type, transport: str = "grpc_asyncio"): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9994,7 +10043,7 @@ async def test_suspend_rollout_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.suspend_rollout), "__call__") as call: @@ -10014,11 +10063,6 @@ async def test_suspend_rollout_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_suspend_rollout_async_from_dict(): - await test_suspend_rollout_async(request_type=dict) - - def test_suspend_rollout_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10165,8 +10209,8 @@ async def test_suspend_rollout_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config_delivery.ResumeRolloutRequest, - dict, + config_delivery.ResumeRolloutRequest(), + {}, ], ) def test_resume_rollout(request_type, transport: str = "grpc"): @@ -10177,7 +10221,7 @@ def test_resume_rollout(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.resume_rollout), "__call__") as call: @@ -10219,10 +10263,11 @@ def test_resume_rollout_non_empty_request_with_auto_populated_field(): client.resume_rollout(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.ResumeRolloutRequest( + request_msg = config_delivery.ResumeRolloutRequest( name="name_value", reason="reason_value", ) + assert args[0] == request_msg def test_resume_rollout_use_cached_wrapped_rpc(): @@ -10313,9 +10358,14 @@ async def test_resume_rollout_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_resume_rollout_async( - transport: str = "grpc_asyncio", request_type=config_delivery.ResumeRolloutRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.ResumeRolloutRequest(), + {}, + ], +) +async def test_resume_rollout_async(request_type, transport: str = "grpc_asyncio"): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10323,7 +10373,7 @@ async def test_resume_rollout_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.resume_rollout), "__call__") as call: @@ -10343,11 +10393,6 @@ async def test_resume_rollout_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_resume_rollout_async_from_dict(): - await test_resume_rollout_async(request_type=dict) - - def test_resume_rollout_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10494,8 +10539,8 @@ async def test_resume_rollout_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config_delivery.AbortRolloutRequest, - dict, + config_delivery.AbortRolloutRequest(), + {}, ], ) def test_abort_rollout(request_type, transport: str = "grpc"): @@ -10506,7 +10551,7 @@ def test_abort_rollout(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.abort_rollout), "__call__") as call: @@ -10548,10 +10593,11 @@ def test_abort_rollout_non_empty_request_with_auto_populated_field(): client.abort_rollout(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.AbortRolloutRequest( + request_msg = config_delivery.AbortRolloutRequest( name="name_value", reason="reason_value", ) + assert args[0] == request_msg def test_abort_rollout_use_cached_wrapped_rpc(): @@ -10642,9 +10688,14 @@ async def test_abort_rollout_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_abort_rollout_async( - transport: str = "grpc_asyncio", request_type=config_delivery.AbortRolloutRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.AbortRolloutRequest(), + {}, + ], +) +async def test_abort_rollout_async(request_type, transport: str = "grpc_asyncio"): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10652,7 +10703,7 @@ async def test_abort_rollout_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.abort_rollout), "__call__") as call: @@ -10672,11 +10723,6 @@ async def test_abort_rollout_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_abort_rollout_async_from_dict(): - await test_abort_rollout_async(request_type=dict) - - def test_abort_rollout_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16163,7 +16209,6 @@ def test_list_resource_bundles_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.ListResourceBundlesRequest() - assert args[0] == request_msg @@ -16186,7 +16231,6 @@ def test_get_resource_bundle_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.GetResourceBundleRequest() - assert args[0] == request_msg @@ -16209,7 +16253,6 @@ def test_create_resource_bundle_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.CreateResourceBundleRequest() - assert args[0] == request_msg @@ -16232,7 +16275,6 @@ def test_update_resource_bundle_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.UpdateResourceBundleRequest() - assert args[0] == request_msg @@ -16255,7 +16297,6 @@ def test_delete_resource_bundle_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.DeleteResourceBundleRequest() - assert args[0] == request_msg @@ -16278,7 +16319,6 @@ def test_list_fleet_packages_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.ListFleetPackagesRequest() - assert args[0] == request_msg @@ -16301,7 +16341,6 @@ def test_get_fleet_package_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.GetFleetPackageRequest() - assert args[0] == request_msg @@ -16324,7 +16363,6 @@ def test_create_fleet_package_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.CreateFleetPackageRequest() - assert args[0] == request_msg @@ -16347,7 +16385,6 @@ def test_update_fleet_package_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.UpdateFleetPackageRequest() - assert args[0] == request_msg @@ -16370,7 +16407,6 @@ def test_delete_fleet_package_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.DeleteFleetPackageRequest() - assert args[0] == request_msg @@ -16391,7 +16427,6 @@ def test_list_releases_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.ListReleasesRequest() - assert args[0] == request_msg @@ -16412,7 +16447,6 @@ def test_get_release_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.GetReleaseRequest() - assert args[0] == request_msg @@ -16433,7 +16467,6 @@ def test_create_release_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.CreateReleaseRequest() - assert args[0] == request_msg @@ -16454,7 +16487,6 @@ def test_update_release_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.UpdateReleaseRequest() - assert args[0] == request_msg @@ -16475,7 +16507,6 @@ def test_delete_release_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.DeleteReleaseRequest() - assert args[0] == request_msg @@ -16496,7 +16527,6 @@ def test_list_variants_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.ListVariantsRequest() - assert args[0] == request_msg @@ -16517,7 +16547,6 @@ def test_get_variant_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.GetVariantRequest() - assert args[0] == request_msg @@ -16538,7 +16567,6 @@ def test_create_variant_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.CreateVariantRequest() - assert args[0] == request_msg @@ -16559,7 +16587,6 @@ def test_update_variant_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.UpdateVariantRequest() - assert args[0] == request_msg @@ -16580,7 +16607,6 @@ def test_delete_variant_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.DeleteVariantRequest() - assert args[0] == request_msg @@ -16601,7 +16627,6 @@ def test_list_rollouts_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.ListRolloutsRequest() - assert args[0] == request_msg @@ -16622,7 +16647,6 @@ def test_get_rollout_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.GetRolloutRequest() - assert args[0] == request_msg @@ -16643,7 +16667,6 @@ def test_suspend_rollout_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.SuspendRolloutRequest() - assert args[0] == request_msg @@ -16664,7 +16687,6 @@ def test_resume_rollout_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.ResumeRolloutRequest() - assert args[0] == request_msg @@ -16685,7 +16707,6 @@ def test_abort_rollout_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.AbortRolloutRequest() - assert args[0] == request_msg @@ -16729,7 +16750,6 @@ async def test_list_resource_bundles_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.ListResourceBundlesRequest() - assert args[0] == request_msg @@ -16759,7 +16779,6 @@ async def test_get_resource_bundle_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.GetResourceBundleRequest() - assert args[0] == request_msg @@ -16786,7 +16805,6 @@ async def test_create_resource_bundle_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.CreateResourceBundleRequest() - assert args[0] == request_msg @@ -16813,7 +16831,6 @@ async def test_update_resource_bundle_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.UpdateResourceBundleRequest() - assert args[0] == request_msg @@ -16840,7 +16857,6 @@ async def test_delete_resource_bundle_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.DeleteResourceBundleRequest() - assert args[0] == request_msg @@ -16870,7 +16886,6 @@ async def test_list_fleet_packages_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.ListFleetPackagesRequest() - assert args[0] == request_msg @@ -16901,7 +16916,6 @@ async def test_get_fleet_package_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.GetFleetPackageRequest() - assert args[0] == request_msg @@ -16928,7 +16942,6 @@ async def test_create_fleet_package_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.CreateFleetPackageRequest() - assert args[0] == request_msg @@ -16955,7 +16968,6 @@ async def test_update_fleet_package_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.UpdateFleetPackageRequest() - assert args[0] == request_msg @@ -16982,7 +16994,6 @@ async def test_delete_fleet_package_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.DeleteFleetPackageRequest() - assert args[0] == request_msg @@ -17010,7 +17021,6 @@ async def test_list_releases_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.ListReleasesRequest() - assert args[0] == request_msg @@ -17039,7 +17049,6 @@ async def test_get_release_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.GetReleaseRequest() - assert args[0] == request_msg @@ -17064,7 +17073,6 @@ async def test_create_release_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.CreateReleaseRequest() - assert args[0] == request_msg @@ -17089,7 +17097,6 @@ async def test_update_release_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.UpdateReleaseRequest() - assert args[0] == request_msg @@ -17114,7 +17121,6 @@ async def test_delete_release_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.DeleteReleaseRequest() - assert args[0] == request_msg @@ -17142,7 +17148,6 @@ async def test_list_variants_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.ListVariantsRequest() - assert args[0] == request_msg @@ -17170,7 +17175,6 @@ async def test_get_variant_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.GetVariantRequest() - assert args[0] == request_msg @@ -17195,7 +17199,6 @@ async def test_create_variant_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.CreateVariantRequest() - assert args[0] == request_msg @@ -17220,7 +17223,6 @@ async def test_update_variant_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.UpdateVariantRequest() - assert args[0] == request_msg @@ -17245,7 +17247,6 @@ async def test_delete_variant_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.DeleteVariantRequest() - assert args[0] == request_msg @@ -17273,7 +17274,6 @@ async def test_list_rollouts_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.ListRolloutsRequest() - assert args[0] == request_msg @@ -17302,7 +17302,6 @@ async def test_get_rollout_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.GetRolloutRequest() - assert args[0] == request_msg @@ -17327,7 +17326,6 @@ async def test_suspend_rollout_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.SuspendRolloutRequest() - assert args[0] == request_msg @@ -17352,7 +17350,6 @@ async def test_resume_rollout_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.ResumeRolloutRequest() - assert args[0] == request_msg @@ -17377,7 +17374,6 @@ async def test_abort_rollout_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.AbortRolloutRequest() - assert args[0] == request_msg @@ -21779,7 +21775,6 @@ def test_list_resource_bundles_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.ListResourceBundlesRequest() - assert args[0] == request_msg @@ -21801,7 +21796,6 @@ def test_get_resource_bundle_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.GetResourceBundleRequest() - assert args[0] == request_msg @@ -21823,7 +21817,6 @@ def test_create_resource_bundle_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.CreateResourceBundleRequest() - assert args[0] == request_msg @@ -21845,7 +21838,6 @@ def test_update_resource_bundle_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.UpdateResourceBundleRequest() - assert args[0] == request_msg @@ -21867,7 +21859,6 @@ def test_delete_resource_bundle_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.DeleteResourceBundleRequest() - assert args[0] == request_msg @@ -21889,7 +21880,6 @@ def test_list_fleet_packages_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.ListFleetPackagesRequest() - assert args[0] == request_msg @@ -21911,7 +21901,6 @@ def test_get_fleet_package_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.GetFleetPackageRequest() - assert args[0] == request_msg @@ -21933,7 +21922,6 @@ def test_create_fleet_package_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.CreateFleetPackageRequest() - assert args[0] == request_msg @@ -21955,7 +21943,6 @@ def test_update_fleet_package_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.UpdateFleetPackageRequest() - assert args[0] == request_msg @@ -21977,7 +21964,6 @@ def test_delete_fleet_package_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.DeleteFleetPackageRequest() - assert args[0] == request_msg @@ -21997,7 +21983,6 @@ def test_list_releases_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.ListReleasesRequest() - assert args[0] == request_msg @@ -22017,7 +22002,6 @@ def test_get_release_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.GetReleaseRequest() - assert args[0] == request_msg @@ -22037,7 +22021,6 @@ def test_create_release_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.CreateReleaseRequest() - assert args[0] == request_msg @@ -22057,7 +22040,6 @@ def test_update_release_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.UpdateReleaseRequest() - assert args[0] == request_msg @@ -22077,7 +22059,6 @@ def test_delete_release_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.DeleteReleaseRequest() - assert args[0] == request_msg @@ -22097,7 +22078,6 @@ def test_list_variants_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.ListVariantsRequest() - assert args[0] == request_msg @@ -22117,7 +22097,6 @@ def test_get_variant_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.GetVariantRequest() - assert args[0] == request_msg @@ -22137,7 +22116,6 @@ def test_create_variant_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.CreateVariantRequest() - assert args[0] == request_msg @@ -22157,7 +22135,6 @@ def test_update_variant_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.UpdateVariantRequest() - assert args[0] == request_msg @@ -22177,7 +22154,6 @@ def test_delete_variant_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.DeleteVariantRequest() - assert args[0] == request_msg @@ -22197,7 +22173,6 @@ def test_list_rollouts_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.ListRolloutsRequest() - assert args[0] == request_msg @@ -22217,7 +22192,6 @@ def test_get_rollout_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.GetRolloutRequest() - assert args[0] == request_msg @@ -22237,7 +22211,6 @@ def test_suspend_rollout_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.SuspendRolloutRequest() - assert args[0] == request_msg @@ -22257,7 +22230,6 @@ def test_resume_rollout_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.ResumeRolloutRequest() - assert args[0] == request_msg @@ -22277,7 +22249,6 @@ def test_abort_rollout_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.AbortRolloutRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-configdelivery/tests/unit/gapic/configdelivery_v1beta/test_config_delivery.py b/packages/google-cloud-configdelivery/tests/unit/gapic/configdelivery_v1beta/test_config_delivery.py index 4e9f03cd1302..be4d893e87f0 100644 --- a/packages/google-cloud-configdelivery/tests/unit/gapic/configdelivery_v1beta/test_config_delivery.py +++ b/packages/google-cloud-configdelivery/tests/unit/gapic/configdelivery_v1beta/test_config_delivery.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 @@ -116,6 +117,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" @@ -1319,8 +1335,8 @@ def test_config_delivery_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - config_delivery.ListResourceBundlesRequest, - dict, + config_delivery.ListResourceBundlesRequest(), + {}, ], ) def test_list_resource_bundles(request_type, transport: str = "grpc"): @@ -1331,7 +1347,7 @@ def test_list_resource_bundles(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1384,12 +1400,13 @@ def test_list_resource_bundles_non_empty_request_with_auto_populated_field(): client.list_resource_bundles(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.ListResourceBundlesRequest( + request_msg = config_delivery.ListResourceBundlesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_resource_bundles_use_cached_wrapped_rpc(): @@ -1475,9 +1492,15 @@ async def test_list_resource_bundles_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.ListResourceBundlesRequest(), + {}, + ], +) async def test_list_resource_bundles_async( - transport: str = "grpc_asyncio", - request_type=config_delivery.ListResourceBundlesRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), @@ -1486,7 +1509,7 @@ async def test_list_resource_bundles_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( @@ -1513,11 +1536,6 @@ async def test_list_resource_bundles_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_resource_bundles_async_from_dict(): - await test_list_resource_bundles_async(request_type=dict) - - def test_list_resource_bundles_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1870,8 +1888,8 @@ async def test_list_resource_bundles_async_pages(): @pytest.mark.parametrize( "request_type", [ - config_delivery.GetResourceBundleRequest, - dict, + config_delivery.GetResourceBundleRequest(), + {}, ], ) def test_get_resource_bundle(request_type, transport: str = "grpc"): @@ -1882,7 +1900,7 @@ def test_get_resource_bundle(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1932,9 +1950,10 @@ def test_get_resource_bundle_non_empty_request_with_auto_populated_field(): client.get_resource_bundle(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.GetResourceBundleRequest( + request_msg = config_delivery.GetResourceBundleRequest( name="name_value", ) + assert args[0] == request_msg def test_get_resource_bundle_use_cached_wrapped_rpc(): @@ -2019,10 +2038,14 @@ async def test_get_resource_bundle_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_resource_bundle_async( - transport: str = "grpc_asyncio", - request_type=config_delivery.GetResourceBundleRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.GetResourceBundleRequest(), + {}, + ], +) +async def test_get_resource_bundle_async(request_type, transport: str = "grpc_asyncio"): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2030,7 +2053,7 @@ async def test_get_resource_bundle_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( @@ -2057,11 +2080,6 @@ async def test_get_resource_bundle_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_get_resource_bundle_async_from_dict(): - await test_get_resource_bundle_async(request_type=dict) - - def test_get_resource_bundle_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2216,8 +2234,8 @@ async def test_get_resource_bundle_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config_delivery.CreateResourceBundleRequest, - dict, + config_delivery.CreateResourceBundleRequest(), + {}, ], ) def test_create_resource_bundle(request_type, transport: str = "grpc"): @@ -2228,7 +2246,7 @@ def test_create_resource_bundle(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2274,10 +2292,11 @@ def test_create_resource_bundle_non_empty_request_with_auto_populated_field(): client.create_resource_bundle(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.CreateResourceBundleRequest( + request_msg = config_delivery.CreateResourceBundleRequest( parent="parent_value", resource_bundle_id="resource_bundle_id_value", ) + assert args[0] == request_msg def test_create_resource_bundle_use_cached_wrapped_rpc(): @@ -2373,9 +2392,15 @@ async def test_create_resource_bundle_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.CreateResourceBundleRequest(), + {}, + ], +) async def test_create_resource_bundle_async( - transport: str = "grpc_asyncio", - request_type=config_delivery.CreateResourceBundleRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), @@ -2384,7 +2409,7 @@ async def test_create_resource_bundle_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( @@ -2406,11 +2431,6 @@ async def test_create_resource_bundle_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_resource_bundle_async_from_dict(): - await test_create_resource_bundle_async(request_type=dict) - - def test_create_resource_bundle_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2585,8 +2605,8 @@ async def test_create_resource_bundle_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config_delivery.UpdateResourceBundleRequest, - dict, + config_delivery.UpdateResourceBundleRequest(), + {}, ], ) def test_update_resource_bundle(request_type, transport: str = "grpc"): @@ -2597,7 +2617,7 @@ def test_update_resource_bundle(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2640,7 +2660,8 @@ def test_update_resource_bundle_non_empty_request_with_auto_populated_field(): client.update_resource_bundle(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.UpdateResourceBundleRequest() + request_msg = config_delivery.UpdateResourceBundleRequest() + assert args[0] == request_msg def test_update_resource_bundle_use_cached_wrapped_rpc(): @@ -2736,9 +2757,15 @@ async def test_update_resource_bundle_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.UpdateResourceBundleRequest(), + {}, + ], +) async def test_update_resource_bundle_async( - transport: str = "grpc_asyncio", - request_type=config_delivery.UpdateResourceBundleRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), @@ -2747,7 +2774,7 @@ async def test_update_resource_bundle_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( @@ -2769,11 +2796,6 @@ async def test_update_resource_bundle_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_resource_bundle_async_from_dict(): - await test_update_resource_bundle_async(request_type=dict) - - def test_update_resource_bundle_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2938,8 +2960,8 @@ async def test_update_resource_bundle_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config_delivery.DeleteResourceBundleRequest, - dict, + config_delivery.DeleteResourceBundleRequest(), + {}, ], ) def test_delete_resource_bundle(request_type, transport: str = "grpc"): @@ -2950,7 +2972,7 @@ def test_delete_resource_bundle(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2995,9 +3017,10 @@ def test_delete_resource_bundle_non_empty_request_with_auto_populated_field(): client.delete_resource_bundle(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.DeleteResourceBundleRequest( + request_msg = config_delivery.DeleteResourceBundleRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_resource_bundle_use_cached_wrapped_rpc(): @@ -3093,9 +3116,15 @@ async def test_delete_resource_bundle_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.DeleteResourceBundleRequest(), + {}, + ], +) async def test_delete_resource_bundle_async( - transport: str = "grpc_asyncio", - request_type=config_delivery.DeleteResourceBundleRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), @@ -3104,7 +3133,7 @@ async def test_delete_resource_bundle_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( @@ -3126,11 +3155,6 @@ async def test_delete_resource_bundle_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_resource_bundle_async_from_dict(): - await test_delete_resource_bundle_async(request_type=dict) - - def test_delete_resource_bundle_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3285,8 +3309,8 @@ async def test_delete_resource_bundle_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config_delivery.ListFleetPackagesRequest, - dict, + config_delivery.ListFleetPackagesRequest(), + {}, ], ) def test_list_fleet_packages(request_type, transport: str = "grpc"): @@ -3297,7 +3321,7 @@ def test_list_fleet_packages(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3350,12 +3374,13 @@ def test_list_fleet_packages_non_empty_request_with_auto_populated_field(): client.list_fleet_packages(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.ListFleetPackagesRequest( + request_msg = config_delivery.ListFleetPackagesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_fleet_packages_use_cached_wrapped_rpc(): @@ -3440,10 +3465,14 @@ async def test_list_fleet_packages_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_fleet_packages_async( - transport: str = "grpc_asyncio", - request_type=config_delivery.ListFleetPackagesRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.ListFleetPackagesRequest(), + {}, + ], +) +async def test_list_fleet_packages_async(request_type, transport: str = "grpc_asyncio"): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3451,7 +3480,7 @@ async def test_list_fleet_packages_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( @@ -3478,11 +3507,6 @@ async def test_list_fleet_packages_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_fleet_packages_async_from_dict(): - await test_list_fleet_packages_async(request_type=dict) - - def test_list_fleet_packages_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3835,8 +3859,8 @@ async def test_list_fleet_packages_async_pages(): @pytest.mark.parametrize( "request_type", [ - config_delivery.GetFleetPackageRequest, - dict, + config_delivery.GetFleetPackageRequest(), + {}, ], ) def test_get_fleet_package(request_type, transport: str = "grpc"): @@ -3847,7 +3871,7 @@ def test_get_fleet_package(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3902,9 +3926,10 @@ def test_get_fleet_package_non_empty_request_with_auto_populated_field(): client.get_fleet_package(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.GetFleetPackageRequest( + request_msg = config_delivery.GetFleetPackageRequest( name="name_value", ) + assert args[0] == request_msg def test_get_fleet_package_use_cached_wrapped_rpc(): @@ -3987,9 +4012,14 @@ async def test_get_fleet_package_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_fleet_package_async( - transport: str = "grpc_asyncio", request_type=config_delivery.GetFleetPackageRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.GetFleetPackageRequest(), + {}, + ], +) +async def test_get_fleet_package_async(request_type, transport: str = "grpc_asyncio"): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3997,7 +4027,7 @@ async def test_get_fleet_package_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( @@ -4029,11 +4059,6 @@ async def test_get_fleet_package_async( assert response.state == config_delivery.FleetPackage.State.ACTIVE -@pytest.mark.asyncio -async def test_get_fleet_package_async_from_dict(): - await test_get_fleet_package_async(request_type=dict) - - def test_get_fleet_package_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4188,8 +4213,8 @@ async def test_get_fleet_package_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config_delivery.CreateFleetPackageRequest, - dict, + config_delivery.CreateFleetPackageRequest(), + {}, ], ) def test_create_fleet_package(request_type, transport: str = "grpc"): @@ -4200,7 +4225,7 @@ def test_create_fleet_package(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4246,10 +4271,11 @@ def test_create_fleet_package_non_empty_request_with_auto_populated_field(): client.create_fleet_package(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.CreateFleetPackageRequest( + request_msg = config_delivery.CreateFleetPackageRequest( parent="parent_value", fleet_package_id="fleet_package_id_value", ) + assert args[0] == request_msg def test_create_fleet_package_use_cached_wrapped_rpc(): @@ -4344,9 +4370,15 @@ async def test_create_fleet_package_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.CreateFleetPackageRequest(), + {}, + ], +) async def test_create_fleet_package_async( - transport: str = "grpc_asyncio", - request_type=config_delivery.CreateFleetPackageRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), @@ -4355,7 +4387,7 @@ async def test_create_fleet_package_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( @@ -4377,11 +4409,6 @@ async def test_create_fleet_package_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_fleet_package_async_from_dict(): - await test_create_fleet_package_async(request_type=dict) - - def test_create_fleet_package_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4556,8 +4583,8 @@ async def test_create_fleet_package_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config_delivery.UpdateFleetPackageRequest, - dict, + config_delivery.UpdateFleetPackageRequest(), + {}, ], ) def test_update_fleet_package(request_type, transport: str = "grpc"): @@ -4568,7 +4595,7 @@ def test_update_fleet_package(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4611,7 +4638,8 @@ def test_update_fleet_package_non_empty_request_with_auto_populated_field(): client.update_fleet_package(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.UpdateFleetPackageRequest() + request_msg = config_delivery.UpdateFleetPackageRequest() + assert args[0] == request_msg def test_update_fleet_package_use_cached_wrapped_rpc(): @@ -4706,9 +4734,15 @@ async def test_update_fleet_package_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.UpdateFleetPackageRequest(), + {}, + ], +) async def test_update_fleet_package_async( - transport: str = "grpc_asyncio", - request_type=config_delivery.UpdateFleetPackageRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), @@ -4717,7 +4751,7 @@ async def test_update_fleet_package_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( @@ -4739,11 +4773,6 @@ async def test_update_fleet_package_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_fleet_package_async_from_dict(): - await test_update_fleet_package_async(request_type=dict) - - def test_update_fleet_package_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4908,8 +4937,8 @@ async def test_update_fleet_package_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config_delivery.DeleteFleetPackageRequest, - dict, + config_delivery.DeleteFleetPackageRequest(), + {}, ], ) def test_delete_fleet_package(request_type, transport: str = "grpc"): @@ -4920,7 +4949,7 @@ def test_delete_fleet_package(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4965,9 +4994,10 @@ def test_delete_fleet_package_non_empty_request_with_auto_populated_field(): client.delete_fleet_package(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.DeleteFleetPackageRequest( + request_msg = config_delivery.DeleteFleetPackageRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_fleet_package_use_cached_wrapped_rpc(): @@ -5062,9 +5092,15 @@ async def test_delete_fleet_package_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.DeleteFleetPackageRequest(), + {}, + ], +) async def test_delete_fleet_package_async( - transport: str = "grpc_asyncio", - request_type=config_delivery.DeleteFleetPackageRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), @@ -5073,7 +5109,7 @@ async def test_delete_fleet_package_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( @@ -5095,11 +5131,6 @@ async def test_delete_fleet_package_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_fleet_package_async_from_dict(): - await test_delete_fleet_package_async(request_type=dict) - - def test_delete_fleet_package_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5254,8 +5285,8 @@ async def test_delete_fleet_package_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config_delivery.ListReleasesRequest, - dict, + config_delivery.ListReleasesRequest(), + {}, ], ) def test_list_releases(request_type, transport: str = "grpc"): @@ -5266,7 +5297,7 @@ def test_list_releases(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_releases), "__call__") as call: @@ -5315,12 +5346,13 @@ def test_list_releases_non_empty_request_with_auto_populated_field(): client.list_releases(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.ListReleasesRequest( + request_msg = config_delivery.ListReleasesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_releases_use_cached_wrapped_rpc(): @@ -5401,9 +5433,14 @@ async def test_list_releases_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_releases_async( - transport: str = "grpc_asyncio", request_type=config_delivery.ListReleasesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.ListReleasesRequest(), + {}, + ], +) +async def test_list_releases_async(request_type, transport: str = "grpc_asyncio"): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5411,7 +5448,7 @@ async def test_list_releases_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_releases), "__call__") as call: @@ -5436,11 +5473,6 @@ async def test_list_releases_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_releases_async_from_dict(): - await test_list_releases_async(request_type=dict) - - def test_list_releases_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5777,8 +5809,8 @@ async def test_list_releases_async_pages(): @pytest.mark.parametrize( "request_type", [ - config_delivery.GetReleaseRequest, - dict, + config_delivery.GetReleaseRequest(), + {}, ], ) def test_get_release(request_type, transport: str = "grpc"): @@ -5789,7 +5821,7 @@ def test_get_release(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_release), "__call__") as call: @@ -5837,9 +5869,10 @@ def test_get_release_non_empty_request_with_auto_populated_field(): client.get_release(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.GetReleaseRequest( + request_msg = config_delivery.GetReleaseRequest( name="name_value", ) + assert args[0] == request_msg def test_get_release_use_cached_wrapped_rpc(): @@ -5920,9 +5953,14 @@ async def test_get_release_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_release_async( - transport: str = "grpc_asyncio", request_type=config_delivery.GetReleaseRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.GetReleaseRequest(), + {}, + ], +) +async def test_get_release_async(request_type, transport: str = "grpc_asyncio"): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5930,7 +5968,7 @@ async def test_get_release_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_release), "__call__") as call: @@ -5957,11 +5995,6 @@ async def test_get_release_async( assert response.version == "version_value" -@pytest.mark.asyncio -async def test_get_release_async_from_dict(): - await test_get_release_async(request_type=dict) - - def test_get_release_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6108,8 +6141,8 @@ async def test_get_release_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config_delivery.CreateReleaseRequest, - dict, + config_delivery.CreateReleaseRequest(), + {}, ], ) def test_create_release(request_type, transport: str = "grpc"): @@ -6120,7 +6153,7 @@ def test_create_release(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_release), "__call__") as call: @@ -6162,10 +6195,11 @@ def test_create_release_non_empty_request_with_auto_populated_field(): client.create_release(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.CreateReleaseRequest( + request_msg = config_delivery.CreateReleaseRequest( parent="parent_value", release_id="release_id_value", ) + assert args[0] == request_msg def test_create_release_use_cached_wrapped_rpc(): @@ -6256,9 +6290,14 @@ async def test_create_release_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_release_async( - transport: str = "grpc_asyncio", request_type=config_delivery.CreateReleaseRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.CreateReleaseRequest(), + {}, + ], +) +async def test_create_release_async(request_type, transport: str = "grpc_asyncio"): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6266,7 +6305,7 @@ async def test_create_release_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_release), "__call__") as call: @@ -6286,11 +6325,6 @@ async def test_create_release_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_release_async_from_dict(): - await test_create_release_async(request_type=dict) - - def test_create_release_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6457,8 +6491,8 @@ async def test_create_release_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config_delivery.UpdateReleaseRequest, - dict, + config_delivery.UpdateReleaseRequest(), + {}, ], ) def test_update_release(request_type, transport: str = "grpc"): @@ -6469,7 +6503,7 @@ def test_update_release(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_release), "__call__") as call: @@ -6508,7 +6542,8 @@ def test_update_release_non_empty_request_with_auto_populated_field(): client.update_release(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.UpdateReleaseRequest() + request_msg = config_delivery.UpdateReleaseRequest() + assert args[0] == request_msg def test_update_release_use_cached_wrapped_rpc(): @@ -6599,9 +6634,14 @@ async def test_update_release_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_release_async( - transport: str = "grpc_asyncio", request_type=config_delivery.UpdateReleaseRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.UpdateReleaseRequest(), + {}, + ], +) +async def test_update_release_async(request_type, transport: str = "grpc_asyncio"): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6609,7 +6649,7 @@ async def test_update_release_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_release), "__call__") as call: @@ -6629,11 +6669,6 @@ async def test_update_release_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_release_async_from_dict(): - await test_update_release_async(request_type=dict) - - def test_update_release_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6790,8 +6825,8 @@ async def test_update_release_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config_delivery.DeleteReleaseRequest, - dict, + config_delivery.DeleteReleaseRequest(), + {}, ], ) def test_delete_release(request_type, transport: str = "grpc"): @@ -6802,7 +6837,7 @@ def test_delete_release(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_release), "__call__") as call: @@ -6843,9 +6878,10 @@ def test_delete_release_non_empty_request_with_auto_populated_field(): client.delete_release(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.DeleteReleaseRequest( + request_msg = config_delivery.DeleteReleaseRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_release_use_cached_wrapped_rpc(): @@ -6936,9 +6972,14 @@ async def test_delete_release_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_release_async( - transport: str = "grpc_asyncio", request_type=config_delivery.DeleteReleaseRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.DeleteReleaseRequest(), + {}, + ], +) +async def test_delete_release_async(request_type, transport: str = "grpc_asyncio"): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6946,7 +6987,7 @@ async def test_delete_release_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_release), "__call__") as call: @@ -6966,11 +7007,6 @@ async def test_delete_release_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_release_async_from_dict(): - await test_delete_release_async(request_type=dict) - - def test_delete_release_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7117,8 +7153,8 @@ async def test_delete_release_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config_delivery.ListVariantsRequest, - dict, + config_delivery.ListVariantsRequest(), + {}, ], ) def test_list_variants(request_type, transport: str = "grpc"): @@ -7129,7 +7165,7 @@ def test_list_variants(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_variants), "__call__") as call: @@ -7178,12 +7214,13 @@ def test_list_variants_non_empty_request_with_auto_populated_field(): client.list_variants(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.ListVariantsRequest( + request_msg = config_delivery.ListVariantsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_variants_use_cached_wrapped_rpc(): @@ -7264,9 +7301,14 @@ async def test_list_variants_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_variants_async( - transport: str = "grpc_asyncio", request_type=config_delivery.ListVariantsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.ListVariantsRequest(), + {}, + ], +) +async def test_list_variants_async(request_type, transport: str = "grpc_asyncio"): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7274,7 +7316,7 @@ async def test_list_variants_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_variants), "__call__") as call: @@ -7299,11 +7341,6 @@ async def test_list_variants_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_variants_async_from_dict(): - await test_list_variants_async(request_type=dict) - - def test_list_variants_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7640,8 +7677,8 @@ async def test_list_variants_async_pages(): @pytest.mark.parametrize( "request_type", [ - config_delivery.GetVariantRequest, - dict, + config_delivery.GetVariantRequest(), + {}, ], ) def test_get_variant(request_type, transport: str = "grpc"): @@ -7652,7 +7689,7 @@ def test_get_variant(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_variant), "__call__") as call: @@ -7698,9 +7735,10 @@ def test_get_variant_non_empty_request_with_auto_populated_field(): client.get_variant(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.GetVariantRequest( + request_msg = config_delivery.GetVariantRequest( name="name_value", ) + assert args[0] == request_msg def test_get_variant_use_cached_wrapped_rpc(): @@ -7781,9 +7819,14 @@ async def test_get_variant_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_variant_async( - transport: str = "grpc_asyncio", request_type=config_delivery.GetVariantRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.GetVariantRequest(), + {}, + ], +) +async def test_get_variant_async(request_type, transport: str = "grpc_asyncio"): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7791,7 +7834,7 @@ async def test_get_variant_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_variant), "__call__") as call: @@ -7816,11 +7859,6 @@ async def test_get_variant_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_variant_async_from_dict(): - await test_get_variant_async(request_type=dict) - - def test_get_variant_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7967,8 +8005,8 @@ async def test_get_variant_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config_delivery.CreateVariantRequest, - dict, + config_delivery.CreateVariantRequest(), + {}, ], ) def test_create_variant(request_type, transport: str = "grpc"): @@ -7979,7 +8017,7 @@ def test_create_variant(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_variant), "__call__") as call: @@ -8021,10 +8059,11 @@ def test_create_variant_non_empty_request_with_auto_populated_field(): client.create_variant(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.CreateVariantRequest( + request_msg = config_delivery.CreateVariantRequest( parent="parent_value", variant_id="variant_id_value", ) + assert args[0] == request_msg def test_create_variant_use_cached_wrapped_rpc(): @@ -8115,9 +8154,14 @@ async def test_create_variant_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_variant_async( - transport: str = "grpc_asyncio", request_type=config_delivery.CreateVariantRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.CreateVariantRequest(), + {}, + ], +) +async def test_create_variant_async(request_type, transport: str = "grpc_asyncio"): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8125,7 +8169,7 @@ async def test_create_variant_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_variant), "__call__") as call: @@ -8145,11 +8189,6 @@ async def test_create_variant_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_variant_async_from_dict(): - await test_create_variant_async(request_type=dict) - - def test_create_variant_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8316,8 +8355,8 @@ async def test_create_variant_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config_delivery.UpdateVariantRequest, - dict, + config_delivery.UpdateVariantRequest(), + {}, ], ) def test_update_variant(request_type, transport: str = "grpc"): @@ -8328,7 +8367,7 @@ def test_update_variant(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_variant), "__call__") as call: @@ -8367,7 +8406,8 @@ def test_update_variant_non_empty_request_with_auto_populated_field(): client.update_variant(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.UpdateVariantRequest() + request_msg = config_delivery.UpdateVariantRequest() + assert args[0] == request_msg def test_update_variant_use_cached_wrapped_rpc(): @@ -8458,9 +8498,14 @@ async def test_update_variant_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_variant_async( - transport: str = "grpc_asyncio", request_type=config_delivery.UpdateVariantRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.UpdateVariantRequest(), + {}, + ], +) +async def test_update_variant_async(request_type, transport: str = "grpc_asyncio"): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8468,7 +8513,7 @@ async def test_update_variant_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_variant), "__call__") as call: @@ -8488,11 +8533,6 @@ async def test_update_variant_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_variant_async_from_dict(): - await test_update_variant_async(request_type=dict) - - def test_update_variant_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8649,8 +8689,8 @@ async def test_update_variant_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config_delivery.DeleteVariantRequest, - dict, + config_delivery.DeleteVariantRequest(), + {}, ], ) def test_delete_variant(request_type, transport: str = "grpc"): @@ -8661,7 +8701,7 @@ def test_delete_variant(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_variant), "__call__") as call: @@ -8702,9 +8742,10 @@ def test_delete_variant_non_empty_request_with_auto_populated_field(): client.delete_variant(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.DeleteVariantRequest( + request_msg = config_delivery.DeleteVariantRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_variant_use_cached_wrapped_rpc(): @@ -8795,9 +8836,14 @@ async def test_delete_variant_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_variant_async( - transport: str = "grpc_asyncio", request_type=config_delivery.DeleteVariantRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.DeleteVariantRequest(), + {}, + ], +) +async def test_delete_variant_async(request_type, transport: str = "grpc_asyncio"): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8805,7 +8851,7 @@ async def test_delete_variant_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_variant), "__call__") as call: @@ -8825,11 +8871,6 @@ async def test_delete_variant_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_variant_async_from_dict(): - await test_delete_variant_async(request_type=dict) - - def test_delete_variant_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8976,8 +9017,8 @@ async def test_delete_variant_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config_delivery.ListRolloutsRequest, - dict, + config_delivery.ListRolloutsRequest(), + {}, ], ) def test_list_rollouts(request_type, transport: str = "grpc"): @@ -8988,7 +9029,7 @@ def test_list_rollouts(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_rollouts), "__call__") as call: @@ -9037,12 +9078,13 @@ def test_list_rollouts_non_empty_request_with_auto_populated_field(): client.list_rollouts(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.ListRolloutsRequest( + request_msg = config_delivery.ListRolloutsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_rollouts_use_cached_wrapped_rpc(): @@ -9123,9 +9165,14 @@ async def test_list_rollouts_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_rollouts_async( - transport: str = "grpc_asyncio", request_type=config_delivery.ListRolloutsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.ListRolloutsRequest(), + {}, + ], +) +async def test_list_rollouts_async(request_type, transport: str = "grpc_asyncio"): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9133,7 +9180,7 @@ async def test_list_rollouts_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_rollouts), "__call__") as call: @@ -9158,11 +9205,6 @@ async def test_list_rollouts_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_rollouts_async_from_dict(): - await test_list_rollouts_async(request_type=dict) - - def test_list_rollouts_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9499,8 +9541,8 @@ async def test_list_rollouts_async_pages(): @pytest.mark.parametrize( "request_type", [ - config_delivery.GetRolloutRequest, - dict, + config_delivery.GetRolloutRequest(), + {}, ], ) def test_get_rollout(request_type, transport: str = "grpc"): @@ -9511,7 +9553,7 @@ def test_get_rollout(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_rollout), "__call__") as call: @@ -9562,9 +9604,10 @@ def test_get_rollout_non_empty_request_with_auto_populated_field(): client.get_rollout(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.GetRolloutRequest( + request_msg = config_delivery.GetRolloutRequest( name="name_value", ) + assert args[0] == request_msg def test_get_rollout_use_cached_wrapped_rpc(): @@ -9645,9 +9688,14 @@ async def test_get_rollout_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_rollout_async( - transport: str = "grpc_asyncio", request_type=config_delivery.GetRolloutRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.GetRolloutRequest(), + {}, + ], +) +async def test_get_rollout_async(request_type, transport: str = "grpc_asyncio"): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9655,7 +9703,7 @@ async def test_get_rollout_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_rollout), "__call__") as call: @@ -9685,11 +9733,6 @@ async def test_get_rollout_async( ) -@pytest.mark.asyncio -async def test_get_rollout_async_from_dict(): - await test_get_rollout_async(request_type=dict) - - def test_get_rollout_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9836,8 +9879,8 @@ async def test_get_rollout_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config_delivery.SuspendRolloutRequest, - dict, + config_delivery.SuspendRolloutRequest(), + {}, ], ) def test_suspend_rollout(request_type, transport: str = "grpc"): @@ -9848,7 +9891,7 @@ def test_suspend_rollout(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.suspend_rollout), "__call__") as call: @@ -9890,10 +9933,11 @@ def test_suspend_rollout_non_empty_request_with_auto_populated_field(): client.suspend_rollout(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.SuspendRolloutRequest( + request_msg = config_delivery.SuspendRolloutRequest( name="name_value", reason="reason_value", ) + assert args[0] == request_msg def test_suspend_rollout_use_cached_wrapped_rpc(): @@ -9984,9 +10028,14 @@ async def test_suspend_rollout_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_suspend_rollout_async( - transport: str = "grpc_asyncio", request_type=config_delivery.SuspendRolloutRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.SuspendRolloutRequest(), + {}, + ], +) +async def test_suspend_rollout_async(request_type, transport: str = "grpc_asyncio"): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9994,7 +10043,7 @@ async def test_suspend_rollout_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.suspend_rollout), "__call__") as call: @@ -10014,11 +10063,6 @@ async def test_suspend_rollout_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_suspend_rollout_async_from_dict(): - await test_suspend_rollout_async(request_type=dict) - - def test_suspend_rollout_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10165,8 +10209,8 @@ async def test_suspend_rollout_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config_delivery.ResumeRolloutRequest, - dict, + config_delivery.ResumeRolloutRequest(), + {}, ], ) def test_resume_rollout(request_type, transport: str = "grpc"): @@ -10177,7 +10221,7 @@ def test_resume_rollout(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.resume_rollout), "__call__") as call: @@ -10219,10 +10263,11 @@ def test_resume_rollout_non_empty_request_with_auto_populated_field(): client.resume_rollout(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.ResumeRolloutRequest( + request_msg = config_delivery.ResumeRolloutRequest( name="name_value", reason="reason_value", ) + assert args[0] == request_msg def test_resume_rollout_use_cached_wrapped_rpc(): @@ -10313,9 +10358,14 @@ async def test_resume_rollout_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_resume_rollout_async( - transport: str = "grpc_asyncio", request_type=config_delivery.ResumeRolloutRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.ResumeRolloutRequest(), + {}, + ], +) +async def test_resume_rollout_async(request_type, transport: str = "grpc_asyncio"): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10323,7 +10373,7 @@ async def test_resume_rollout_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.resume_rollout), "__call__") as call: @@ -10343,11 +10393,6 @@ async def test_resume_rollout_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_resume_rollout_async_from_dict(): - await test_resume_rollout_async(request_type=dict) - - def test_resume_rollout_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10494,8 +10539,8 @@ async def test_resume_rollout_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - config_delivery.AbortRolloutRequest, - dict, + config_delivery.AbortRolloutRequest(), + {}, ], ) def test_abort_rollout(request_type, transport: str = "grpc"): @@ -10506,7 +10551,7 @@ def test_abort_rollout(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.abort_rollout), "__call__") as call: @@ -10548,10 +10593,11 @@ def test_abort_rollout_non_empty_request_with_auto_populated_field(): client.abort_rollout(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == config_delivery.AbortRolloutRequest( + request_msg = config_delivery.AbortRolloutRequest( name="name_value", reason="reason_value", ) + assert args[0] == request_msg def test_abort_rollout_use_cached_wrapped_rpc(): @@ -10642,9 +10688,14 @@ async def test_abort_rollout_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_abort_rollout_async( - transport: str = "grpc_asyncio", request_type=config_delivery.AbortRolloutRequest -): +@pytest.mark.parametrize( + "request_type", + [ + config_delivery.AbortRolloutRequest(), + {}, + ], +) +async def test_abort_rollout_async(request_type, transport: str = "grpc_asyncio"): client = ConfigDeliveryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10652,7 +10703,7 @@ async def test_abort_rollout_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.abort_rollout), "__call__") as call: @@ -10672,11 +10723,6 @@ async def test_abort_rollout_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_abort_rollout_async_from_dict(): - await test_abort_rollout_async(request_type=dict) - - def test_abort_rollout_field_headers(): client = ConfigDeliveryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16163,7 +16209,6 @@ def test_list_resource_bundles_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.ListResourceBundlesRequest() - assert args[0] == request_msg @@ -16186,7 +16231,6 @@ def test_get_resource_bundle_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.GetResourceBundleRequest() - assert args[0] == request_msg @@ -16209,7 +16253,6 @@ def test_create_resource_bundle_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.CreateResourceBundleRequest() - assert args[0] == request_msg @@ -16232,7 +16275,6 @@ def test_update_resource_bundle_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.UpdateResourceBundleRequest() - assert args[0] == request_msg @@ -16255,7 +16297,6 @@ def test_delete_resource_bundle_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.DeleteResourceBundleRequest() - assert args[0] == request_msg @@ -16278,7 +16319,6 @@ def test_list_fleet_packages_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.ListFleetPackagesRequest() - assert args[0] == request_msg @@ -16301,7 +16341,6 @@ def test_get_fleet_package_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.GetFleetPackageRequest() - assert args[0] == request_msg @@ -16324,7 +16363,6 @@ def test_create_fleet_package_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.CreateFleetPackageRequest() - assert args[0] == request_msg @@ -16347,7 +16385,6 @@ def test_update_fleet_package_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.UpdateFleetPackageRequest() - assert args[0] == request_msg @@ -16370,7 +16407,6 @@ def test_delete_fleet_package_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.DeleteFleetPackageRequest() - assert args[0] == request_msg @@ -16391,7 +16427,6 @@ def test_list_releases_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.ListReleasesRequest() - assert args[0] == request_msg @@ -16412,7 +16447,6 @@ def test_get_release_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.GetReleaseRequest() - assert args[0] == request_msg @@ -16433,7 +16467,6 @@ def test_create_release_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.CreateReleaseRequest() - assert args[0] == request_msg @@ -16454,7 +16487,6 @@ def test_update_release_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.UpdateReleaseRequest() - assert args[0] == request_msg @@ -16475,7 +16507,6 @@ def test_delete_release_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.DeleteReleaseRequest() - assert args[0] == request_msg @@ -16496,7 +16527,6 @@ def test_list_variants_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.ListVariantsRequest() - assert args[0] == request_msg @@ -16517,7 +16547,6 @@ def test_get_variant_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.GetVariantRequest() - assert args[0] == request_msg @@ -16538,7 +16567,6 @@ def test_create_variant_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.CreateVariantRequest() - assert args[0] == request_msg @@ -16559,7 +16587,6 @@ def test_update_variant_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.UpdateVariantRequest() - assert args[0] == request_msg @@ -16580,7 +16607,6 @@ def test_delete_variant_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.DeleteVariantRequest() - assert args[0] == request_msg @@ -16601,7 +16627,6 @@ def test_list_rollouts_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.ListRolloutsRequest() - assert args[0] == request_msg @@ -16622,7 +16647,6 @@ def test_get_rollout_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.GetRolloutRequest() - assert args[0] == request_msg @@ -16643,7 +16667,6 @@ def test_suspend_rollout_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.SuspendRolloutRequest() - assert args[0] == request_msg @@ -16664,7 +16687,6 @@ def test_resume_rollout_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.ResumeRolloutRequest() - assert args[0] == request_msg @@ -16685,7 +16707,6 @@ def test_abort_rollout_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.AbortRolloutRequest() - assert args[0] == request_msg @@ -16729,7 +16750,6 @@ async def test_list_resource_bundles_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.ListResourceBundlesRequest() - assert args[0] == request_msg @@ -16759,7 +16779,6 @@ async def test_get_resource_bundle_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.GetResourceBundleRequest() - assert args[0] == request_msg @@ -16786,7 +16805,6 @@ async def test_create_resource_bundle_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.CreateResourceBundleRequest() - assert args[0] == request_msg @@ -16813,7 +16831,6 @@ async def test_update_resource_bundle_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.UpdateResourceBundleRequest() - assert args[0] == request_msg @@ -16840,7 +16857,6 @@ async def test_delete_resource_bundle_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.DeleteResourceBundleRequest() - assert args[0] == request_msg @@ -16870,7 +16886,6 @@ async def test_list_fleet_packages_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.ListFleetPackagesRequest() - assert args[0] == request_msg @@ -16901,7 +16916,6 @@ async def test_get_fleet_package_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.GetFleetPackageRequest() - assert args[0] == request_msg @@ -16928,7 +16942,6 @@ async def test_create_fleet_package_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.CreateFleetPackageRequest() - assert args[0] == request_msg @@ -16955,7 +16968,6 @@ async def test_update_fleet_package_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.UpdateFleetPackageRequest() - assert args[0] == request_msg @@ -16982,7 +16994,6 @@ async def test_delete_fleet_package_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.DeleteFleetPackageRequest() - assert args[0] == request_msg @@ -17010,7 +17021,6 @@ async def test_list_releases_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.ListReleasesRequest() - assert args[0] == request_msg @@ -17039,7 +17049,6 @@ async def test_get_release_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.GetReleaseRequest() - assert args[0] == request_msg @@ -17064,7 +17073,6 @@ async def test_create_release_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.CreateReleaseRequest() - assert args[0] == request_msg @@ -17089,7 +17097,6 @@ async def test_update_release_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.UpdateReleaseRequest() - assert args[0] == request_msg @@ -17114,7 +17121,6 @@ async def test_delete_release_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.DeleteReleaseRequest() - assert args[0] == request_msg @@ -17142,7 +17148,6 @@ async def test_list_variants_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.ListVariantsRequest() - assert args[0] == request_msg @@ -17170,7 +17175,6 @@ async def test_get_variant_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.GetVariantRequest() - assert args[0] == request_msg @@ -17195,7 +17199,6 @@ async def test_create_variant_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.CreateVariantRequest() - assert args[0] == request_msg @@ -17220,7 +17223,6 @@ async def test_update_variant_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.UpdateVariantRequest() - assert args[0] == request_msg @@ -17245,7 +17247,6 @@ async def test_delete_variant_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.DeleteVariantRequest() - assert args[0] == request_msg @@ -17273,7 +17274,6 @@ async def test_list_rollouts_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.ListRolloutsRequest() - assert args[0] == request_msg @@ -17302,7 +17302,6 @@ async def test_get_rollout_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.GetRolloutRequest() - assert args[0] == request_msg @@ -17327,7 +17326,6 @@ async def test_suspend_rollout_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.SuspendRolloutRequest() - assert args[0] == request_msg @@ -17352,7 +17350,6 @@ async def test_resume_rollout_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.ResumeRolloutRequest() - assert args[0] == request_msg @@ -17377,7 +17374,6 @@ async def test_abort_rollout_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.AbortRolloutRequest() - assert args[0] == request_msg @@ -21779,7 +21775,6 @@ def test_list_resource_bundles_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.ListResourceBundlesRequest() - assert args[0] == request_msg @@ -21801,7 +21796,6 @@ def test_get_resource_bundle_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.GetResourceBundleRequest() - assert args[0] == request_msg @@ -21823,7 +21817,6 @@ def test_create_resource_bundle_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.CreateResourceBundleRequest() - assert args[0] == request_msg @@ -21845,7 +21838,6 @@ def test_update_resource_bundle_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.UpdateResourceBundleRequest() - assert args[0] == request_msg @@ -21867,7 +21859,6 @@ def test_delete_resource_bundle_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.DeleteResourceBundleRequest() - assert args[0] == request_msg @@ -21889,7 +21880,6 @@ def test_list_fleet_packages_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.ListFleetPackagesRequest() - assert args[0] == request_msg @@ -21911,7 +21901,6 @@ def test_get_fleet_package_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.GetFleetPackageRequest() - assert args[0] == request_msg @@ -21933,7 +21922,6 @@ def test_create_fleet_package_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.CreateFleetPackageRequest() - assert args[0] == request_msg @@ -21955,7 +21943,6 @@ def test_update_fleet_package_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.UpdateFleetPackageRequest() - assert args[0] == request_msg @@ -21977,7 +21964,6 @@ def test_delete_fleet_package_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.DeleteFleetPackageRequest() - assert args[0] == request_msg @@ -21997,7 +21983,6 @@ def test_list_releases_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.ListReleasesRequest() - assert args[0] == request_msg @@ -22017,7 +22002,6 @@ def test_get_release_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.GetReleaseRequest() - assert args[0] == request_msg @@ -22037,7 +22021,6 @@ def test_create_release_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.CreateReleaseRequest() - assert args[0] == request_msg @@ -22057,7 +22040,6 @@ def test_update_release_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.UpdateReleaseRequest() - assert args[0] == request_msg @@ -22077,7 +22059,6 @@ def test_delete_release_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.DeleteReleaseRequest() - assert args[0] == request_msg @@ -22097,7 +22078,6 @@ def test_list_variants_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.ListVariantsRequest() - assert args[0] == request_msg @@ -22117,7 +22097,6 @@ def test_get_variant_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.GetVariantRequest() - assert args[0] == request_msg @@ -22137,7 +22116,6 @@ def test_create_variant_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.CreateVariantRequest() - assert args[0] == request_msg @@ -22157,7 +22135,6 @@ def test_update_variant_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.UpdateVariantRequest() - assert args[0] == request_msg @@ -22177,7 +22154,6 @@ def test_delete_variant_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.DeleteVariantRequest() - assert args[0] == request_msg @@ -22197,7 +22173,6 @@ def test_list_rollouts_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.ListRolloutsRequest() - assert args[0] == request_msg @@ -22217,7 +22192,6 @@ def test_get_rollout_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.GetRolloutRequest() - assert args[0] == request_msg @@ -22237,7 +22211,6 @@ def test_suspend_rollout_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.SuspendRolloutRequest() - assert args[0] == request_msg @@ -22257,7 +22230,6 @@ def test_resume_rollout_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.ResumeRolloutRequest() - assert args[0] == request_msg @@ -22277,7 +22249,6 @@ def test_abort_rollout_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = config_delivery.AbortRolloutRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-contact-center-insights/noxfile.py b/packages/google-cloud-contact-center-insights/noxfile.py index 771c5bd9227a..fa7a8ecf4016 100644 --- a/packages/google-cloud-contact-center-insights/noxfile.py +++ b/packages/google-cloud-contact-center-insights/noxfile.py @@ -47,7 +47,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-contact-center-insights" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-contact-center-insights/setup.py b/packages/google-cloud-contact-center-insights/setup.py index aa0f11145271..f9d7d118c5e5 100644 --- a/packages/google-cloud-contact-center-insights/setup.py +++ b/packages/google-cloud-contact-center-insights/setup.py @@ -45,7 +45,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/google-cloud-contact-center-insights/testing/constraints-3.10.txt b/packages/google-cloud-contact-center-insights/testing/constraints-3.10.txt index a92801e1c8e2..b39cd54634f9 100644 --- a/packages/google-cloud-contact-center-insights/testing/constraints-3.10.txt +++ b/packages/google-cloud-contact-center-insights/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/google-cloud-contact-center-insights/tests/unit/gapic/contact_center_insights_v1/test_contact_center_insights.py b/packages/google-cloud-contact-center-insights/tests/unit/gapic/contact_center_insights_v1/test_contact_center_insights.py index 9a44a56ae7c4..9503ead9389e 100644 --- a/packages/google-cloud-contact-center-insights/tests/unit/gapic/contact_center_insights_v1/test_contact_center_insights.py +++ b/packages/google-cloud-contact-center-insights/tests/unit/gapic/contact_center_insights_v1/test_contact_center_insights.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 @@ -124,6 +125,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" @@ -1389,8 +1405,8 @@ def test_contact_center_insights_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - contact_center_insights.CreateConversationRequest, - dict, + contact_center_insights.CreateConversationRequest(), + {}, ], ) def test_create_conversation(request_type, transport: str = "grpc"): @@ -1401,7 +1417,7 @@ def test_create_conversation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1462,10 +1478,11 @@ def test_create_conversation_non_empty_request_with_auto_populated_field(): client.create_conversation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == contact_center_insights.CreateConversationRequest( + request_msg = contact_center_insights.CreateConversationRequest( parent="parent_value", conversation_id="conversation_id_value", ) + assert args[0] == request_msg def test_create_conversation_use_cached_wrapped_rpc(): @@ -1550,10 +1567,14 @@ async def test_create_conversation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_conversation_async( - transport: str = "grpc_asyncio", - request_type=contact_center_insights.CreateConversationRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + contact_center_insights.CreateConversationRequest(), + {}, + ], +) +async def test_create_conversation_async(request_type, transport: str = "grpc_asyncio"): client = ContactCenterInsightsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1561,7 +1582,7 @@ async def test_create_conversation_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( @@ -1598,11 +1619,6 @@ async def test_create_conversation_async( assert response.obfuscated_user_id == "obfuscated_user_id_value" -@pytest.mark.asyncio -async def test_create_conversation_async_from_dict(): - await test_create_conversation_async(request_type=dict) - - def test_create_conversation_field_headers(): client = ContactCenterInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1789,8 +1805,8 @@ async def test_create_conversation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - contact_center_insights.UploadConversationRequest, - dict, + contact_center_insights.UploadConversationRequest(), + {}, ], ) def test_upload_conversation(request_type, transport: str = "grpc"): @@ -1801,7 +1817,7 @@ def test_upload_conversation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1847,10 +1863,11 @@ def test_upload_conversation_non_empty_request_with_auto_populated_field(): client.upload_conversation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == contact_center_insights.UploadConversationRequest( + request_msg = contact_center_insights.UploadConversationRequest( parent="parent_value", conversation_id="conversation_id_value", ) + assert args[0] == request_msg def test_upload_conversation_use_cached_wrapped_rpc(): @@ -1945,10 +1962,14 @@ async def test_upload_conversation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_upload_conversation_async( - transport: str = "grpc_asyncio", - request_type=contact_center_insights.UploadConversationRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + contact_center_insights.UploadConversationRequest(), + {}, + ], +) +async def test_upload_conversation_async(request_type, transport: str = "grpc_asyncio"): client = ContactCenterInsightsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1956,7 +1977,7 @@ async def test_upload_conversation_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( @@ -1978,11 +1999,6 @@ async def test_upload_conversation_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_upload_conversation_async_from_dict(): - await test_upload_conversation_async(request_type=dict) - - def test_upload_conversation_field_headers(): client = ContactCenterInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2051,8 +2067,8 @@ async def test_upload_conversation_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - contact_center_insights.UpdateConversationRequest, - dict, + contact_center_insights.UpdateConversationRequest(), + {}, ], ) def test_update_conversation(request_type, transport: str = "grpc"): @@ -2063,7 +2079,7 @@ def test_update_conversation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2121,7 +2137,8 @@ def test_update_conversation_non_empty_request_with_auto_populated_field(): client.update_conversation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == contact_center_insights.UpdateConversationRequest() + request_msg = contact_center_insights.UpdateConversationRequest() + assert args[0] == request_msg def test_update_conversation_use_cached_wrapped_rpc(): @@ -2206,10 +2223,14 @@ async def test_update_conversation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_conversation_async( - transport: str = "grpc_asyncio", - request_type=contact_center_insights.UpdateConversationRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + contact_center_insights.UpdateConversationRequest(), + {}, + ], +) +async def test_update_conversation_async(request_type, transport: str = "grpc_asyncio"): client = ContactCenterInsightsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2217,7 +2238,7 @@ async def test_update_conversation_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( @@ -2254,11 +2275,6 @@ async def test_update_conversation_async( assert response.obfuscated_user_id == "obfuscated_user_id_value" -@pytest.mark.asyncio -async def test_update_conversation_async_from_dict(): - await test_update_conversation_async(request_type=dict) - - def test_update_conversation_field_headers(): client = ContactCenterInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2435,8 +2451,8 @@ async def test_update_conversation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - contact_center_insights.GetConversationRequest, - dict, + contact_center_insights.GetConversationRequest(), + {}, ], ) def test_get_conversation(request_type, transport: str = "grpc"): @@ -2447,7 +2463,7 @@ def test_get_conversation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_conversation), "__call__") as call: @@ -2503,9 +2519,10 @@ def test_get_conversation_non_empty_request_with_auto_populated_field(): client.get_conversation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == contact_center_insights.GetConversationRequest( + request_msg = contact_center_insights.GetConversationRequest( name="name_value", ) + assert args[0] == request_msg def test_get_conversation_use_cached_wrapped_rpc(): @@ -2588,10 +2605,14 @@ async def test_get_conversation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_conversation_async( - transport: str = "grpc_asyncio", - request_type=contact_center_insights.GetConversationRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + contact_center_insights.GetConversationRequest(), + {}, + ], +) +async def test_get_conversation_async(request_type, transport: str = "grpc_asyncio"): client = ContactCenterInsightsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2599,7 +2620,7 @@ async def test_get_conversation_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_conversation), "__call__") as call: @@ -2634,11 +2655,6 @@ async def test_get_conversation_async( assert response.obfuscated_user_id == "obfuscated_user_id_value" -@pytest.mark.asyncio -async def test_get_conversation_async_from_dict(): - await test_get_conversation_async(request_type=dict) - - def test_get_conversation_field_headers(): client = ContactCenterInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2785,8 +2801,8 @@ async def test_get_conversation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - contact_center_insights.ListConversationsRequest, - dict, + contact_center_insights.ListConversationsRequest(), + {}, ], ) def test_list_conversations(request_type, transport: str = "grpc"): @@ -2797,7 +2813,7 @@ def test_list_conversations(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2848,12 +2864,13 @@ def test_list_conversations_non_empty_request_with_auto_populated_field(): client.list_conversations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == contact_center_insights.ListConversationsRequest( + request_msg = contact_center_insights.ListConversationsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_conversations_use_cached_wrapped_rpc(): @@ -2938,10 +2955,14 @@ async def test_list_conversations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_conversations_async( - transport: str = "grpc_asyncio", - request_type=contact_center_insights.ListConversationsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + contact_center_insights.ListConversationsRequest(), + {}, + ], +) +async def test_list_conversations_async(request_type, transport: str = "grpc_asyncio"): client = ContactCenterInsightsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2949,7 +2970,7 @@ async def test_list_conversations_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( @@ -2974,11 +2995,6 @@ async def test_list_conversations_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_conversations_async_from_dict(): - await test_list_conversations_async(request_type=dict) - - def test_list_conversations_field_headers(): client = ContactCenterInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3331,8 +3347,8 @@ async def test_list_conversations_async_pages(): @pytest.mark.parametrize( "request_type", [ - contact_center_insights.DeleteConversationRequest, - dict, + contact_center_insights.DeleteConversationRequest(), + {}, ], ) def test_delete_conversation(request_type, transport: str = "grpc"): @@ -3343,7 +3359,7 @@ def test_delete_conversation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3388,9 +3404,10 @@ def test_delete_conversation_non_empty_request_with_auto_populated_field(): client.delete_conversation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == contact_center_insights.DeleteConversationRequest( + request_msg = contact_center_insights.DeleteConversationRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_conversation_use_cached_wrapped_rpc(): @@ -3475,10 +3492,14 @@ async def test_delete_conversation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_conversation_async( - transport: str = "grpc_asyncio", - request_type=contact_center_insights.DeleteConversationRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + contact_center_insights.DeleteConversationRequest(), + {}, + ], +) +async def test_delete_conversation_async(request_type, transport: str = "grpc_asyncio"): client = ContactCenterInsightsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3486,7 +3507,7 @@ async def test_delete_conversation_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( @@ -3506,11 +3527,6 @@ async def test_delete_conversation_async( assert response is None -@pytest.mark.asyncio -async def test_delete_conversation_async_from_dict(): - await test_delete_conversation_async(request_type=dict) - - def test_delete_conversation_field_headers(): client = ContactCenterInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3661,8 +3677,8 @@ async def test_delete_conversation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - contact_center_insights.CreateAnalysisRequest, - dict, + contact_center_insights.CreateAnalysisRequest(), + {}, ], ) def test_create_analysis(request_type, transport: str = "grpc"): @@ -3673,7 +3689,7 @@ def test_create_analysis(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_analysis), "__call__") as call: @@ -3714,9 +3730,10 @@ def test_create_analysis_non_empty_request_with_auto_populated_field(): client.create_analysis(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == contact_center_insights.CreateAnalysisRequest( + request_msg = contact_center_insights.CreateAnalysisRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_analysis_use_cached_wrapped_rpc(): @@ -3807,10 +3824,14 @@ async def test_create_analysis_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_analysis_async( - transport: str = "grpc_asyncio", - request_type=contact_center_insights.CreateAnalysisRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + contact_center_insights.CreateAnalysisRequest(), + {}, + ], +) +async def test_create_analysis_async(request_type, transport: str = "grpc_asyncio"): client = ContactCenterInsightsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3818,7 +3839,7 @@ async def test_create_analysis_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_analysis), "__call__") as call: @@ -3838,11 +3859,6 @@ async def test_create_analysis_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_analysis_async_from_dict(): - await test_create_analysis_async(request_type=dict) - - def test_create_analysis_field_headers(): client = ContactCenterInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3999,8 +4015,8 @@ async def test_create_analysis_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - contact_center_insights.GetAnalysisRequest, - dict, + contact_center_insights.GetAnalysisRequest(), + {}, ], ) def test_get_analysis(request_type, transport: str = "grpc"): @@ -4011,7 +4027,7 @@ def test_get_analysis(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_analysis), "__call__") as call: @@ -4055,9 +4071,10 @@ def test_get_analysis_non_empty_request_with_auto_populated_field(): client.get_analysis(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == contact_center_insights.GetAnalysisRequest( + request_msg = contact_center_insights.GetAnalysisRequest( name="name_value", ) + assert args[0] == request_msg def test_get_analysis_use_cached_wrapped_rpc(): @@ -4138,10 +4155,14 @@ async def test_get_analysis_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_analysis_async( - transport: str = "grpc_asyncio", - request_type=contact_center_insights.GetAnalysisRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + contact_center_insights.GetAnalysisRequest(), + {}, + ], +) +async def test_get_analysis_async(request_type, transport: str = "grpc_asyncio"): client = ContactCenterInsightsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4149,7 +4170,7 @@ async def test_get_analysis_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_analysis), "__call__") as call: @@ -4172,11 +4193,6 @@ async def test_get_analysis_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_analysis_async_from_dict(): - await test_get_analysis_async(request_type=dict) - - def test_get_analysis_field_headers(): client = ContactCenterInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4319,8 +4335,8 @@ async def test_get_analysis_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - contact_center_insights.ListAnalysesRequest, - dict, + contact_center_insights.ListAnalysesRequest(), + {}, ], ) def test_list_analyses(request_type, transport: str = "grpc"): @@ -4331,7 +4347,7 @@ def test_list_analyses(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_analyses), "__call__") as call: @@ -4377,11 +4393,12 @@ def test_list_analyses_non_empty_request_with_auto_populated_field(): client.list_analyses(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == contact_center_insights.ListAnalysesRequest( + request_msg = contact_center_insights.ListAnalysesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_analyses_use_cached_wrapped_rpc(): @@ -4462,10 +4479,14 @@ async def test_list_analyses_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_analyses_async( - transport: str = "grpc_asyncio", - request_type=contact_center_insights.ListAnalysesRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + contact_center_insights.ListAnalysesRequest(), + {}, + ], +) +async def test_list_analyses_async(request_type, transport: str = "grpc_asyncio"): client = ContactCenterInsightsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4473,7 +4494,7 @@ async def test_list_analyses_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_analyses), "__call__") as call: @@ -4496,11 +4517,6 @@ async def test_list_analyses_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_analyses_async_from_dict(): - await test_list_analyses_async(request_type=dict) - - def test_list_analyses_field_headers(): client = ContactCenterInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4837,8 +4853,8 @@ async def test_list_analyses_async_pages(): @pytest.mark.parametrize( "request_type", [ - contact_center_insights.DeleteAnalysisRequest, - dict, + contact_center_insights.DeleteAnalysisRequest(), + {}, ], ) def test_delete_analysis(request_type, transport: str = "grpc"): @@ -4849,7 +4865,7 @@ def test_delete_analysis(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_analysis), "__call__") as call: @@ -4890,9 +4906,10 @@ def test_delete_analysis_non_empty_request_with_auto_populated_field(): client.delete_analysis(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == contact_center_insights.DeleteAnalysisRequest( + request_msg = contact_center_insights.DeleteAnalysisRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_analysis_use_cached_wrapped_rpc(): @@ -4973,10 +4990,14 @@ async def test_delete_analysis_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_analysis_async( - transport: str = "grpc_asyncio", - request_type=contact_center_insights.DeleteAnalysisRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + contact_center_insights.DeleteAnalysisRequest(), + {}, + ], +) +async def test_delete_analysis_async(request_type, transport: str = "grpc_asyncio"): client = ContactCenterInsightsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4984,7 +5005,7 @@ async def test_delete_analysis_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_analysis), "__call__") as call: @@ -5002,11 +5023,6 @@ async def test_delete_analysis_async( assert response is None -@pytest.mark.asyncio -async def test_delete_analysis_async_from_dict(): - await test_delete_analysis_async(request_type=dict) - - def test_delete_analysis_field_headers(): client = ContactCenterInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5149,8 +5165,8 @@ async def test_delete_analysis_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - contact_center_insights.BulkAnalyzeConversationsRequest, - dict, + contact_center_insights.BulkAnalyzeConversationsRequest(), + {}, ], ) def test_bulk_analyze_conversations(request_type, transport: str = "grpc"): @@ -5161,7 +5177,7 @@ def test_bulk_analyze_conversations(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5207,10 +5223,11 @@ def test_bulk_analyze_conversations_non_empty_request_with_auto_populated_field( client.bulk_analyze_conversations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == contact_center_insights.BulkAnalyzeConversationsRequest( + request_msg = contact_center_insights.BulkAnalyzeConversationsRequest( parent="parent_value", filter="filter_value", ) + assert args[0] == request_msg def test_bulk_analyze_conversations_use_cached_wrapped_rpc(): @@ -5306,9 +5323,15 @@ async def test_bulk_analyze_conversations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + contact_center_insights.BulkAnalyzeConversationsRequest(), + {}, + ], +) async def test_bulk_analyze_conversations_async( - transport: str = "grpc_asyncio", - request_type=contact_center_insights.BulkAnalyzeConversationsRequest, + request_type, transport: str = "grpc_asyncio" ): client = ContactCenterInsightsAsyncClient( credentials=async_anonymous_credentials(), @@ -5317,7 +5340,7 @@ async def test_bulk_analyze_conversations_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( @@ -5339,11 +5362,6 @@ async def test_bulk_analyze_conversations_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_bulk_analyze_conversations_async_from_dict(): - await test_bulk_analyze_conversations_async(request_type=dict) - - def test_bulk_analyze_conversations_field_headers(): client = ContactCenterInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5518,8 +5536,8 @@ async def test_bulk_analyze_conversations_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - contact_center_insights.BulkDeleteConversationsRequest, - dict, + contact_center_insights.BulkDeleteConversationsRequest(), + {}, ], ) def test_bulk_delete_conversations(request_type, transport: str = "grpc"): @@ -5530,7 +5548,7 @@ def test_bulk_delete_conversations(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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 +5594,11 @@ def test_bulk_delete_conversations_non_empty_request_with_auto_populated_field() client.bulk_delete_conversations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == contact_center_insights.BulkDeleteConversationsRequest( + request_msg = contact_center_insights.BulkDeleteConversationsRequest( parent="parent_value", filter="filter_value", ) + assert args[0] == request_msg def test_bulk_delete_conversations_use_cached_wrapped_rpc(): @@ -5675,9 +5694,15 @@ async def test_bulk_delete_conversations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + contact_center_insights.BulkDeleteConversationsRequest(), + {}, + ], +) async def test_bulk_delete_conversations_async( - transport: str = "grpc_asyncio", - request_type=contact_center_insights.BulkDeleteConversationsRequest, + request_type, transport: str = "grpc_asyncio" ): client = ContactCenterInsightsAsyncClient( credentials=async_anonymous_credentials(), @@ -5686,7 +5711,7 @@ async def test_bulk_delete_conversations_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( @@ -5708,11 +5733,6 @@ async def test_bulk_delete_conversations_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_bulk_delete_conversations_async_from_dict(): - await test_bulk_delete_conversations_async(request_type=dict) - - def test_bulk_delete_conversations_field_headers(): client = ContactCenterInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5877,8 +5897,8 @@ async def test_bulk_delete_conversations_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - contact_center_insights.IngestConversationsRequest, - dict, + contact_center_insights.IngestConversationsRequest(), + {}, ], ) def test_ingest_conversations(request_type, transport: str = "grpc"): @@ -5889,7 +5909,7 @@ def test_ingest_conversations(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5934,9 +5954,10 @@ def test_ingest_conversations_non_empty_request_with_auto_populated_field(): client.ingest_conversations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == contact_center_insights.IngestConversationsRequest( + request_msg = contact_center_insights.IngestConversationsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_ingest_conversations_use_cached_wrapped_rpc(): @@ -6031,9 +6052,15 @@ async def test_ingest_conversations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + contact_center_insights.IngestConversationsRequest(), + {}, + ], +) async def test_ingest_conversations_async( - transport: str = "grpc_asyncio", - request_type=contact_center_insights.IngestConversationsRequest, + request_type, transport: str = "grpc_asyncio" ): client = ContactCenterInsightsAsyncClient( credentials=async_anonymous_credentials(), @@ -6042,7 +6069,7 @@ async def test_ingest_conversations_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( @@ -6064,11 +6091,6 @@ async def test_ingest_conversations_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_ingest_conversations_async_from_dict(): - await test_ingest_conversations_async(request_type=dict) - - def test_ingest_conversations_field_headers(): client = ContactCenterInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6223,8 +6245,8 @@ async def test_ingest_conversations_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - contact_center_insights.ExportInsightsDataRequest, - dict, + contact_center_insights.ExportInsightsDataRequest(), + {}, ], ) def test_export_insights_data(request_type, transport: str = "grpc"): @@ -6235,7 +6257,7 @@ def test_export_insights_data(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6282,11 +6304,12 @@ def test_export_insights_data_non_empty_request_with_auto_populated_field(): client.export_insights_data(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == contact_center_insights.ExportInsightsDataRequest( + request_msg = contact_center_insights.ExportInsightsDataRequest( parent="parent_value", filter="filter_value", kms_key="kms_key_value", ) + assert args[0] == request_msg def test_export_insights_data_use_cached_wrapped_rpc(): @@ -6381,9 +6404,15 @@ async def test_export_insights_data_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + contact_center_insights.ExportInsightsDataRequest(), + {}, + ], +) async def test_export_insights_data_async( - transport: str = "grpc_asyncio", - request_type=contact_center_insights.ExportInsightsDataRequest, + request_type, transport: str = "grpc_asyncio" ): client = ContactCenterInsightsAsyncClient( credentials=async_anonymous_credentials(), @@ -6392,7 +6421,7 @@ async def test_export_insights_data_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( @@ -6414,11 +6443,6 @@ async def test_export_insights_data_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_export_insights_data_async_from_dict(): - await test_export_insights_data_async(request_type=dict) - - def test_export_insights_data_field_headers(): client = ContactCenterInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6573,8 +6597,8 @@ async def test_export_insights_data_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - contact_center_insights.CreateIssueModelRequest, - dict, + contact_center_insights.CreateIssueModelRequest(), + {}, ], ) def test_create_issue_model(request_type, transport: str = "grpc"): @@ -6585,7 +6609,7 @@ def test_create_issue_model(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6630,9 +6654,10 @@ def test_create_issue_model_non_empty_request_with_auto_populated_field(): client.create_issue_model(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == contact_center_insights.CreateIssueModelRequest( + request_msg = contact_center_insights.CreateIssueModelRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_issue_model_use_cached_wrapped_rpc(): @@ -6727,10 +6752,14 @@ async def test_create_issue_model_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_issue_model_async( - transport: str = "grpc_asyncio", - request_type=contact_center_insights.CreateIssueModelRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + contact_center_insights.CreateIssueModelRequest(), + {}, + ], +) +async def test_create_issue_model_async(request_type, transport: str = "grpc_asyncio"): client = ContactCenterInsightsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6738,7 +6767,7 @@ async def test_create_issue_model_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( @@ -6760,11 +6789,6 @@ async def test_create_issue_model_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_issue_model_async_from_dict(): - await test_create_issue_model_async(request_type=dict) - - def test_create_issue_model_field_headers(): client = ContactCenterInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6929,8 +6953,8 @@ async def test_create_issue_model_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - contact_center_insights.UpdateIssueModelRequest, - dict, + contact_center_insights.UpdateIssueModelRequest(), + {}, ], ) def test_update_issue_model(request_type, transport: str = "grpc"): @@ -6941,7 +6965,7 @@ def test_update_issue_model(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6997,7 +7021,8 @@ def test_update_issue_model_non_empty_request_with_auto_populated_field(): client.update_issue_model(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == contact_center_insights.UpdateIssueModelRequest() + request_msg = contact_center_insights.UpdateIssueModelRequest() + assert args[0] == request_msg def test_update_issue_model_use_cached_wrapped_rpc(): @@ -7082,10 +7107,14 @@ async def test_update_issue_model_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_issue_model_async( - transport: str = "grpc_asyncio", - request_type=contact_center_insights.UpdateIssueModelRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + contact_center_insights.UpdateIssueModelRequest(), + {}, + ], +) +async def test_update_issue_model_async(request_type, transport: str = "grpc_asyncio"): client = ContactCenterInsightsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7093,7 +7122,7 @@ async def test_update_issue_model_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( @@ -7128,11 +7157,6 @@ async def test_update_issue_model_async( assert response.language_code == "language_code_value" -@pytest.mark.asyncio -async def test_update_issue_model_async_from_dict(): - await test_update_issue_model_async(request_type=dict) - - def test_update_issue_model_field_headers(): client = ContactCenterInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7297,8 +7321,8 @@ async def test_update_issue_model_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - contact_center_insights.GetIssueModelRequest, - dict, + contact_center_insights.GetIssueModelRequest(), + {}, ], ) def test_get_issue_model(request_type, transport: str = "grpc"): @@ -7309,7 +7333,7 @@ def test_get_issue_model(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_issue_model), "__call__") as call: @@ -7363,9 +7387,10 @@ def test_get_issue_model_non_empty_request_with_auto_populated_field(): client.get_issue_model(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == contact_center_insights.GetIssueModelRequest( + request_msg = contact_center_insights.GetIssueModelRequest( name="name_value", ) + assert args[0] == request_msg def test_get_issue_model_use_cached_wrapped_rpc(): @@ -7446,10 +7471,14 @@ async def test_get_issue_model_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_issue_model_async( - transport: str = "grpc_asyncio", - request_type=contact_center_insights.GetIssueModelRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + contact_center_insights.GetIssueModelRequest(), + {}, + ], +) +async def test_get_issue_model_async(request_type, transport: str = "grpc_asyncio"): client = ContactCenterInsightsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7457,7 +7486,7 @@ async def test_get_issue_model_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_issue_model), "__call__") as call: @@ -7490,11 +7519,6 @@ async def test_get_issue_model_async( assert response.language_code == "language_code_value" -@pytest.mark.asyncio -async def test_get_issue_model_async_from_dict(): - await test_get_issue_model_async(request_type=dict) - - def test_get_issue_model_field_headers(): client = ContactCenterInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7641,8 +7665,8 @@ async def test_get_issue_model_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - contact_center_insights.ListIssueModelsRequest, - dict, + contact_center_insights.ListIssueModelsRequest(), + {}, ], ) def test_list_issue_models(request_type, transport: str = "grpc"): @@ -7653,7 +7677,7 @@ def test_list_issue_models(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7698,9 +7722,10 @@ def test_list_issue_models_non_empty_request_with_auto_populated_field(): client.list_issue_models(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == contact_center_insights.ListIssueModelsRequest( + request_msg = contact_center_insights.ListIssueModelsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_list_issue_models_use_cached_wrapped_rpc(): @@ -7783,10 +7808,14 @@ async def test_list_issue_models_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_issue_models_async( - transport: str = "grpc_asyncio", - request_type=contact_center_insights.ListIssueModelsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + contact_center_insights.ListIssueModelsRequest(), + {}, + ], +) +async def test_list_issue_models_async(request_type, transport: str = "grpc_asyncio"): client = ContactCenterInsightsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7794,7 +7823,7 @@ async def test_list_issue_models_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( @@ -7816,11 +7845,6 @@ async def test_list_issue_models_async( assert isinstance(response, contact_center_insights.ListIssueModelsResponse) -@pytest.mark.asyncio -async def test_list_issue_models_async_from_dict(): - await test_list_issue_models_async(request_type=dict) - - def test_list_issue_models_field_headers(): client = ContactCenterInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7975,8 +7999,8 @@ async def test_list_issue_models_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - contact_center_insights.DeleteIssueModelRequest, - dict, + contact_center_insights.DeleteIssueModelRequest(), + {}, ], ) def test_delete_issue_model(request_type, transport: str = "grpc"): @@ -7987,7 +8011,7 @@ def test_delete_issue_model(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8032,9 +8056,10 @@ def test_delete_issue_model_non_empty_request_with_auto_populated_field(): client.delete_issue_model(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == contact_center_insights.DeleteIssueModelRequest( + request_msg = contact_center_insights.DeleteIssueModelRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_issue_model_use_cached_wrapped_rpc(): @@ -8129,10 +8154,14 @@ async def test_delete_issue_model_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_issue_model_async( - transport: str = "grpc_asyncio", - request_type=contact_center_insights.DeleteIssueModelRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + contact_center_insights.DeleteIssueModelRequest(), + {}, + ], +) +async def test_delete_issue_model_async(request_type, transport: str = "grpc_asyncio"): client = ContactCenterInsightsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8140,7 +8169,7 @@ async def test_delete_issue_model_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( @@ -8162,11 +8191,6 @@ async def test_delete_issue_model_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_issue_model_async_from_dict(): - await test_delete_issue_model_async(request_type=dict) - - def test_delete_issue_model_field_headers(): client = ContactCenterInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8321,8 +8345,8 @@ async def test_delete_issue_model_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - contact_center_insights.DeployIssueModelRequest, - dict, + contact_center_insights.DeployIssueModelRequest(), + {}, ], ) def test_deploy_issue_model(request_type, transport: str = "grpc"): @@ -8333,7 +8357,7 @@ def test_deploy_issue_model(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8378,9 +8402,10 @@ def test_deploy_issue_model_non_empty_request_with_auto_populated_field(): client.deploy_issue_model(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == contact_center_insights.DeployIssueModelRequest( + request_msg = contact_center_insights.DeployIssueModelRequest( name="name_value", ) + assert args[0] == request_msg def test_deploy_issue_model_use_cached_wrapped_rpc(): @@ -8475,10 +8500,14 @@ async def test_deploy_issue_model_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_deploy_issue_model_async( - transport: str = "grpc_asyncio", - request_type=contact_center_insights.DeployIssueModelRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + contact_center_insights.DeployIssueModelRequest(), + {}, + ], +) +async def test_deploy_issue_model_async(request_type, transport: str = "grpc_asyncio"): client = ContactCenterInsightsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8486,7 +8515,7 @@ async def test_deploy_issue_model_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( @@ -8508,11 +8537,6 @@ async def test_deploy_issue_model_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_deploy_issue_model_async_from_dict(): - await test_deploy_issue_model_async(request_type=dict) - - def test_deploy_issue_model_field_headers(): client = ContactCenterInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8667,8 +8691,8 @@ async def test_deploy_issue_model_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - contact_center_insights.UndeployIssueModelRequest, - dict, + contact_center_insights.UndeployIssueModelRequest(), + {}, ], ) def test_undeploy_issue_model(request_type, transport: str = "grpc"): @@ -8679,7 +8703,7 @@ def test_undeploy_issue_model(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8724,9 +8748,10 @@ def test_undeploy_issue_model_non_empty_request_with_auto_populated_field(): client.undeploy_issue_model(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == contact_center_insights.UndeployIssueModelRequest( + request_msg = contact_center_insights.UndeployIssueModelRequest( name="name_value", ) + assert args[0] == request_msg def test_undeploy_issue_model_use_cached_wrapped_rpc(): @@ -8821,9 +8846,15 @@ async def test_undeploy_issue_model_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + contact_center_insights.UndeployIssueModelRequest(), + {}, + ], +) async def test_undeploy_issue_model_async( - transport: str = "grpc_asyncio", - request_type=contact_center_insights.UndeployIssueModelRequest, + request_type, transport: str = "grpc_asyncio" ): client = ContactCenterInsightsAsyncClient( credentials=async_anonymous_credentials(), @@ -8832,7 +8863,7 @@ async def test_undeploy_issue_model_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( @@ -8854,11 +8885,6 @@ async def test_undeploy_issue_model_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_undeploy_issue_model_async_from_dict(): - await test_undeploy_issue_model_async(request_type=dict) - - def test_undeploy_issue_model_field_headers(): client = ContactCenterInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9013,8 +9039,8 @@ async def test_undeploy_issue_model_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - contact_center_insights.ExportIssueModelRequest, - dict, + contact_center_insights.ExportIssueModelRequest(), + {}, ], ) def test_export_issue_model(request_type, transport: str = "grpc"): @@ -9025,7 +9051,7 @@ def test_export_issue_model(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9070,9 +9096,10 @@ def test_export_issue_model_non_empty_request_with_auto_populated_field(): client.export_issue_model(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == contact_center_insights.ExportIssueModelRequest( + request_msg = contact_center_insights.ExportIssueModelRequest( name="name_value", ) + assert args[0] == request_msg def test_export_issue_model_use_cached_wrapped_rpc(): @@ -9167,10 +9194,14 @@ async def test_export_issue_model_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_export_issue_model_async( - transport: str = "grpc_asyncio", - request_type=contact_center_insights.ExportIssueModelRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + contact_center_insights.ExportIssueModelRequest(), + {}, + ], +) +async def test_export_issue_model_async(request_type, transport: str = "grpc_asyncio"): client = ContactCenterInsightsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9178,7 +9209,7 @@ async def test_export_issue_model_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( @@ -9200,11 +9231,6 @@ async def test_export_issue_model_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_export_issue_model_async_from_dict(): - await test_export_issue_model_async(request_type=dict) - - def test_export_issue_model_field_headers(): client = ContactCenterInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9359,8 +9385,8 @@ async def test_export_issue_model_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - contact_center_insights.ImportIssueModelRequest, - dict, + contact_center_insights.ImportIssueModelRequest(), + {}, ], ) def test_import_issue_model(request_type, transport: str = "grpc"): @@ -9371,7 +9397,7 @@ def test_import_issue_model(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9416,9 +9442,10 @@ def test_import_issue_model_non_empty_request_with_auto_populated_field(): client.import_issue_model(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == contact_center_insights.ImportIssueModelRequest( + request_msg = contact_center_insights.ImportIssueModelRequest( parent="parent_value", ) + assert args[0] == request_msg def test_import_issue_model_use_cached_wrapped_rpc(): @@ -9513,10 +9540,14 @@ async def test_import_issue_model_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_import_issue_model_async( - transport: str = "grpc_asyncio", - request_type=contact_center_insights.ImportIssueModelRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + contact_center_insights.ImportIssueModelRequest(), + {}, + ], +) +async def test_import_issue_model_async(request_type, transport: str = "grpc_asyncio"): client = ContactCenterInsightsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9524,7 +9555,7 @@ async def test_import_issue_model_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( @@ -9546,11 +9577,6 @@ async def test_import_issue_model_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_import_issue_model_async_from_dict(): - await test_import_issue_model_async(request_type=dict) - - def test_import_issue_model_field_headers(): client = ContactCenterInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9705,8 +9731,8 @@ async def test_import_issue_model_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - contact_center_insights.GetIssueRequest, - dict, + contact_center_insights.GetIssueRequest(), + {}, ], ) def test_get_issue(request_type, transport: str = "grpc"): @@ -9717,7 +9743,7 @@ def test_get_issue(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_issue), "__call__") as call: @@ -9767,9 +9793,10 @@ def test_get_issue_non_empty_request_with_auto_populated_field(): client.get_issue(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == contact_center_insights.GetIssueRequest( + request_msg = contact_center_insights.GetIssueRequest( name="name_value", ) + assert args[0] == request_msg def test_get_issue_use_cached_wrapped_rpc(): @@ -9848,10 +9875,14 @@ async def test_get_issue_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_issue_async( - transport: str = "grpc_asyncio", - request_type=contact_center_insights.GetIssueRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + contact_center_insights.GetIssueRequest(), + {}, + ], +) +async def test_get_issue_async(request_type, transport: str = "grpc_asyncio"): client = ContactCenterInsightsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9859,7 +9890,7 @@ async def test_get_issue_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_issue), "__call__") as call: @@ -9888,11 +9919,6 @@ async def test_get_issue_async( assert response.display_description == "display_description_value" -@pytest.mark.asyncio -async def test_get_issue_async_from_dict(): - await test_get_issue_async(request_type=dict) - - def test_get_issue_field_headers(): client = ContactCenterInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10035,8 +10061,8 @@ async def test_get_issue_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - contact_center_insights.ListIssuesRequest, - dict, + contact_center_insights.ListIssuesRequest(), + {}, ], ) def test_list_issues(request_type, transport: str = "grpc"): @@ -10047,7 +10073,7 @@ def test_list_issues(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_issues), "__call__") as call: @@ -10088,9 +10114,10 @@ def test_list_issues_non_empty_request_with_auto_populated_field(): client.list_issues(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == contact_center_insights.ListIssuesRequest( + request_msg = contact_center_insights.ListIssuesRequest( parent="parent_value", ) + assert args[0] == request_msg def test_list_issues_use_cached_wrapped_rpc(): @@ -10171,10 +10198,14 @@ async def test_list_issues_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_issues_async( - transport: str = "grpc_asyncio", - request_type=contact_center_insights.ListIssuesRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + contact_center_insights.ListIssuesRequest(), + {}, + ], +) +async def test_list_issues_async(request_type, transport: str = "grpc_asyncio"): client = ContactCenterInsightsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10182,7 +10213,7 @@ async def test_list_issues_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_issues), "__call__") as call: @@ -10202,11 +10233,6 @@ async def test_list_issues_async( assert isinstance(response, contact_center_insights.ListIssuesResponse) -@pytest.mark.asyncio -async def test_list_issues_async_from_dict(): - await test_list_issues_async(request_type=dict) - - def test_list_issues_field_headers(): client = ContactCenterInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10353,8 +10379,8 @@ async def test_list_issues_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - contact_center_insights.UpdateIssueRequest, - dict, + contact_center_insights.UpdateIssueRequest(), + {}, ], ) def test_update_issue(request_type, transport: str = "grpc"): @@ -10365,7 +10391,7 @@ def test_update_issue(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_issue), "__call__") as call: @@ -10413,7 +10439,8 @@ def test_update_issue_non_empty_request_with_auto_populated_field(): client.update_issue(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == contact_center_insights.UpdateIssueRequest() + request_msg = contact_center_insights.UpdateIssueRequest() + assert args[0] == request_msg def test_update_issue_use_cached_wrapped_rpc(): @@ -10494,10 +10521,14 @@ async def test_update_issue_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_issue_async( - transport: str = "grpc_asyncio", - request_type=contact_center_insights.UpdateIssueRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + contact_center_insights.UpdateIssueRequest(), + {}, + ], +) +async def test_update_issue_async(request_type, transport: str = "grpc_asyncio"): client = ContactCenterInsightsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10505,7 +10536,7 @@ async def test_update_issue_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_issue), "__call__") as call: @@ -10534,11 +10565,6 @@ async def test_update_issue_async( assert response.display_description == "display_description_value" -@pytest.mark.asyncio -async def test_update_issue_async_from_dict(): - await test_update_issue_async(request_type=dict) - - def test_update_issue_field_headers(): client = ContactCenterInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10691,8 +10717,8 @@ async def test_update_issue_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - contact_center_insights.DeleteIssueRequest, - dict, + contact_center_insights.DeleteIssueRequest(), + {}, ], ) def test_delete_issue(request_type, transport: str = "grpc"): @@ -10703,7 +10729,7 @@ def test_delete_issue(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_issue), "__call__") as call: @@ -10744,9 +10770,10 @@ def test_delete_issue_non_empty_request_with_auto_populated_field(): client.delete_issue(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == contact_center_insights.DeleteIssueRequest( + request_msg = contact_center_insights.DeleteIssueRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_issue_use_cached_wrapped_rpc(): @@ -10827,10 +10854,14 @@ async def test_delete_issue_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_issue_async( - transport: str = "grpc_asyncio", - request_type=contact_center_insights.DeleteIssueRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + contact_center_insights.DeleteIssueRequest(), + {}, + ], +) +async def test_delete_issue_async(request_type, transport: str = "grpc_asyncio"): client = ContactCenterInsightsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10838,7 +10869,7 @@ async def test_delete_issue_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_issue), "__call__") as call: @@ -10856,11 +10887,6 @@ async def test_delete_issue_async( assert response is None -@pytest.mark.asyncio -async def test_delete_issue_async_from_dict(): - await test_delete_issue_async(request_type=dict) - - def test_delete_issue_field_headers(): client = ContactCenterInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11003,8 +11029,8 @@ async def test_delete_issue_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - contact_center_insights.CalculateIssueModelStatsRequest, - dict, + contact_center_insights.CalculateIssueModelStatsRequest(), + {}, ], ) def test_calculate_issue_model_stats(request_type, transport: str = "grpc"): @@ -11015,7 +11041,7 @@ def test_calculate_issue_model_stats(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11062,9 +11088,10 @@ def test_calculate_issue_model_stats_non_empty_request_with_auto_populated_field client.calculate_issue_model_stats(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == contact_center_insights.CalculateIssueModelStatsRequest( + request_msg = contact_center_insights.CalculateIssueModelStatsRequest( issue_model="issue_model_value", ) + assert args[0] == request_msg def test_calculate_issue_model_stats_use_cached_wrapped_rpc(): @@ -11150,9 +11177,15 @@ async def test_calculate_issue_model_stats_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + contact_center_insights.CalculateIssueModelStatsRequest(), + {}, + ], +) async def test_calculate_issue_model_stats_async( - transport: str = "grpc_asyncio", - request_type=contact_center_insights.CalculateIssueModelStatsRequest, + request_type, transport: str = "grpc_asyncio" ): client = ContactCenterInsightsAsyncClient( credentials=async_anonymous_credentials(), @@ -11161,7 +11194,7 @@ async def test_calculate_issue_model_stats_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( @@ -11185,11 +11218,6 @@ async def test_calculate_issue_model_stats_async( ) -@pytest.mark.asyncio -async def test_calculate_issue_model_stats_async_from_dict(): - await test_calculate_issue_model_stats_async(request_type=dict) - - def test_calculate_issue_model_stats_field_headers(): client = ContactCenterInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11344,8 +11372,8 @@ async def test_calculate_issue_model_stats_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - contact_center_insights.CreatePhraseMatcherRequest, - dict, + contact_center_insights.CreatePhraseMatcherRequest(), + {}, ], ) def test_create_phrase_matcher(request_type, transport: str = "grpc"): @@ -11356,7 +11384,7 @@ def test_create_phrase_matcher(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11416,9 +11444,10 @@ def test_create_phrase_matcher_non_empty_request_with_auto_populated_field(): client.create_phrase_matcher(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == contact_center_insights.CreatePhraseMatcherRequest( + request_msg = contact_center_insights.CreatePhraseMatcherRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_phrase_matcher_use_cached_wrapped_rpc(): @@ -11504,9 +11533,15 @@ async def test_create_phrase_matcher_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + contact_center_insights.CreatePhraseMatcherRequest(), + {}, + ], +) async def test_create_phrase_matcher_async( - transport: str = "grpc_asyncio", - request_type=contact_center_insights.CreatePhraseMatcherRequest, + request_type, transport: str = "grpc_asyncio" ): client = ContactCenterInsightsAsyncClient( credentials=async_anonymous_credentials(), @@ -11515,7 +11550,7 @@ async def test_create_phrase_matcher_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( @@ -11552,11 +11587,6 @@ async def test_create_phrase_matcher_async( assert response.role_match == resources.ConversationParticipant.Role.HUMAN_AGENT -@pytest.mark.asyncio -async def test_create_phrase_matcher_async_from_dict(): - await test_create_phrase_matcher_async(request_type=dict) - - def test_create_phrase_matcher_field_headers(): client = ContactCenterInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11721,8 +11751,8 @@ async def test_create_phrase_matcher_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - contact_center_insights.GetPhraseMatcherRequest, - dict, + contact_center_insights.GetPhraseMatcherRequest(), + {}, ], ) def test_get_phrase_matcher(request_type, transport: str = "grpc"): @@ -11733,7 +11763,7 @@ def test_get_phrase_matcher(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11793,9 +11823,10 @@ def test_get_phrase_matcher_non_empty_request_with_auto_populated_field(): client.get_phrase_matcher(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == contact_center_insights.GetPhraseMatcherRequest( + request_msg = contact_center_insights.GetPhraseMatcherRequest( name="name_value", ) + assert args[0] == request_msg def test_get_phrase_matcher_use_cached_wrapped_rpc(): @@ -11880,10 +11911,14 @@ async def test_get_phrase_matcher_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_phrase_matcher_async( - transport: str = "grpc_asyncio", - request_type=contact_center_insights.GetPhraseMatcherRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + contact_center_insights.GetPhraseMatcherRequest(), + {}, + ], +) +async def test_get_phrase_matcher_async(request_type, transport: str = "grpc_asyncio"): client = ContactCenterInsightsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11891,7 +11926,7 @@ async def test_get_phrase_matcher_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( @@ -11928,11 +11963,6 @@ async def test_get_phrase_matcher_async( assert response.role_match == resources.ConversationParticipant.Role.HUMAN_AGENT -@pytest.mark.asyncio -async def test_get_phrase_matcher_async_from_dict(): - await test_get_phrase_matcher_async(request_type=dict) - - def test_get_phrase_matcher_field_headers(): client = ContactCenterInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12087,8 +12117,8 @@ async def test_get_phrase_matcher_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - contact_center_insights.ListPhraseMatchersRequest, - dict, + contact_center_insights.ListPhraseMatchersRequest(), + {}, ], ) def test_list_phrase_matchers(request_type, transport: str = "grpc"): @@ -12099,7 +12129,7 @@ def test_list_phrase_matchers(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -12149,11 +12179,12 @@ def test_list_phrase_matchers_non_empty_request_with_auto_populated_field(): client.list_phrase_matchers(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == contact_center_insights.ListPhraseMatchersRequest( + request_msg = contact_center_insights.ListPhraseMatchersRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_phrase_matchers_use_cached_wrapped_rpc(): @@ -12238,9 +12269,15 @@ async def test_list_phrase_matchers_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + contact_center_insights.ListPhraseMatchersRequest(), + {}, + ], +) async def test_list_phrase_matchers_async( - transport: str = "grpc_asyncio", - request_type=contact_center_insights.ListPhraseMatchersRequest, + request_type, transport: str = "grpc_asyncio" ): client = ContactCenterInsightsAsyncClient( credentials=async_anonymous_credentials(), @@ -12249,7 +12286,7 @@ async def test_list_phrase_matchers_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( @@ -12274,11 +12311,6 @@ async def test_list_phrase_matchers_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_phrase_matchers_async_from_dict(): - await test_list_phrase_matchers_async(request_type=dict) - - def test_list_phrase_matchers_field_headers(): client = ContactCenterInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12631,8 +12663,8 @@ async def test_list_phrase_matchers_async_pages(): @pytest.mark.parametrize( "request_type", [ - contact_center_insights.DeletePhraseMatcherRequest, - dict, + contact_center_insights.DeletePhraseMatcherRequest(), + {}, ], ) def test_delete_phrase_matcher(request_type, transport: str = "grpc"): @@ -12643,7 +12675,7 @@ def test_delete_phrase_matcher(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -12688,9 +12720,10 @@ def test_delete_phrase_matcher_non_empty_request_with_auto_populated_field(): client.delete_phrase_matcher(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == contact_center_insights.DeletePhraseMatcherRequest( + request_msg = contact_center_insights.DeletePhraseMatcherRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_phrase_matcher_use_cached_wrapped_rpc(): @@ -12776,9 +12809,15 @@ async def test_delete_phrase_matcher_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + contact_center_insights.DeletePhraseMatcherRequest(), + {}, + ], +) async def test_delete_phrase_matcher_async( - transport: str = "grpc_asyncio", - request_type=contact_center_insights.DeletePhraseMatcherRequest, + request_type, transport: str = "grpc_asyncio" ): client = ContactCenterInsightsAsyncClient( credentials=async_anonymous_credentials(), @@ -12787,7 +12826,7 @@ async def test_delete_phrase_matcher_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( @@ -12807,11 +12846,6 @@ async def test_delete_phrase_matcher_async( assert response is None -@pytest.mark.asyncio -async def test_delete_phrase_matcher_async_from_dict(): - await test_delete_phrase_matcher_async(request_type=dict) - - def test_delete_phrase_matcher_field_headers(): client = ContactCenterInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12962,8 +12996,8 @@ async def test_delete_phrase_matcher_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - contact_center_insights.UpdatePhraseMatcherRequest, - dict, + contact_center_insights.UpdatePhraseMatcherRequest(), + {}, ], ) def test_update_phrase_matcher(request_type, transport: str = "grpc"): @@ -12974,7 +13008,7 @@ def test_update_phrase_matcher(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -13032,7 +13066,8 @@ def test_update_phrase_matcher_non_empty_request_with_auto_populated_field(): client.update_phrase_matcher(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == contact_center_insights.UpdatePhraseMatcherRequest() + request_msg = contact_center_insights.UpdatePhraseMatcherRequest() + assert args[0] == request_msg def test_update_phrase_matcher_use_cached_wrapped_rpc(): @@ -13118,9 +13153,15 @@ async def test_update_phrase_matcher_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + contact_center_insights.UpdatePhraseMatcherRequest(), + {}, + ], +) async def test_update_phrase_matcher_async( - transport: str = "grpc_asyncio", - request_type=contact_center_insights.UpdatePhraseMatcherRequest, + request_type, transport: str = "grpc_asyncio" ): client = ContactCenterInsightsAsyncClient( credentials=async_anonymous_credentials(), @@ -13129,7 +13170,7 @@ async def test_update_phrase_matcher_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( @@ -13166,11 +13207,6 @@ async def test_update_phrase_matcher_async( assert response.role_match == resources.ConversationParticipant.Role.HUMAN_AGENT -@pytest.mark.asyncio -async def test_update_phrase_matcher_async_from_dict(): - await test_update_phrase_matcher_async(request_type=dict) - - def test_update_phrase_matcher_field_headers(): client = ContactCenterInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13335,8 +13371,8 @@ async def test_update_phrase_matcher_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - contact_center_insights.CalculateStatsRequest, - dict, + contact_center_insights.CalculateStatsRequest(), + {}, ], ) def test_calculate_stats(request_type, transport: str = "grpc"): @@ -13347,7 +13383,7 @@ def test_calculate_stats(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.calculate_stats), "__call__") as call: @@ -13394,10 +13430,11 @@ def test_calculate_stats_non_empty_request_with_auto_populated_field(): client.calculate_stats(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == contact_center_insights.CalculateStatsRequest( + request_msg = contact_center_insights.CalculateStatsRequest( location="location_value", filter="filter_value", ) + assert args[0] == request_msg def test_calculate_stats_use_cached_wrapped_rpc(): @@ -13478,10 +13515,14 @@ async def test_calculate_stats_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_calculate_stats_async( - transport: str = "grpc_asyncio", - request_type=contact_center_insights.CalculateStatsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + contact_center_insights.CalculateStatsRequest(), + {}, + ], +) +async def test_calculate_stats_async(request_type, transport: str = "grpc_asyncio"): client = ContactCenterInsightsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13489,7 +13530,7 @@ async def test_calculate_stats_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.calculate_stats), "__call__") as call: @@ -13514,11 +13555,6 @@ async def test_calculate_stats_async( assert response.conversation_count == 1955 -@pytest.mark.asyncio -async def test_calculate_stats_async_from_dict(): - await test_calculate_stats_async(request_type=dict) - - def test_calculate_stats_field_headers(): client = ContactCenterInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13665,8 +13701,8 @@ async def test_calculate_stats_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - contact_center_insights.GetSettingsRequest, - dict, + contact_center_insights.GetSettingsRequest(), + {}, ], ) def test_get_settings(request_type, transport: str = "grpc"): @@ -13677,7 +13713,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: @@ -13723,9 +13759,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] == contact_center_insights.GetSettingsRequest( + request_msg = contact_center_insights.GetSettingsRequest( name="name_value", ) + assert args[0] == request_msg def test_get_settings_use_cached_wrapped_rpc(): @@ -13806,10 +13843,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=contact_center_insights.GetSettingsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + contact_center_insights.GetSettingsRequest(), + {}, + ], +) +async def test_get_settings_async(request_type, transport: str = "grpc_asyncio"): client = ContactCenterInsightsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13817,7 +13858,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: @@ -13842,11 +13883,6 @@ async def test_get_settings_async( assert response.language_code == "language_code_value" -@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 = ContactCenterInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13989,8 +14025,8 @@ async def test_get_settings_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - contact_center_insights.UpdateSettingsRequest, - dict, + contact_center_insights.UpdateSettingsRequest(), + {}, ], ) def test_update_settings(request_type, transport: str = "grpc"): @@ -14001,7 +14037,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: @@ -14045,7 +14081,8 @@ 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] == contact_center_insights.UpdateSettingsRequest() + request_msg = contact_center_insights.UpdateSettingsRequest() + assert args[0] == request_msg def test_update_settings_use_cached_wrapped_rpc(): @@ -14126,10 +14163,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=contact_center_insights.UpdateSettingsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + contact_center_insights.UpdateSettingsRequest(), + {}, + ], +) +async def test_update_settings_async(request_type, transport: str = "grpc_asyncio"): client = ContactCenterInsightsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14137,7 +14178,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: @@ -14162,11 +14203,6 @@ async def test_update_settings_async( assert response.language_code == "language_code_value" -@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 = ContactCenterInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14319,8 +14355,8 @@ async def test_update_settings_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - contact_center_insights.CreateAnalysisRuleRequest, - dict, + contact_center_insights.CreateAnalysisRuleRequest(), + {}, ], ) def test_create_analysis_rule(request_type, transport: str = "grpc"): @@ -14331,7 +14367,7 @@ def test_create_analysis_rule(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -14387,9 +14423,10 @@ def test_create_analysis_rule_non_empty_request_with_auto_populated_field(): client.create_analysis_rule(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == contact_center_insights.CreateAnalysisRuleRequest( + request_msg = contact_center_insights.CreateAnalysisRuleRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_analysis_rule_use_cached_wrapped_rpc(): @@ -14474,9 +14511,15 @@ async def test_create_analysis_rule_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + contact_center_insights.CreateAnalysisRuleRequest(), + {}, + ], +) async def test_create_analysis_rule_async( - transport: str = "grpc_asyncio", - request_type=contact_center_insights.CreateAnalysisRuleRequest, + request_type, transport: str = "grpc_asyncio" ): client = ContactCenterInsightsAsyncClient( credentials=async_anonymous_credentials(), @@ -14485,7 +14528,7 @@ async def test_create_analysis_rule_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( @@ -14518,11 +14561,6 @@ async def test_create_analysis_rule_async( assert response.active is True -@pytest.mark.asyncio -async def test_create_analysis_rule_async_from_dict(): - await test_create_analysis_rule_async(request_type=dict) - - def test_create_analysis_rule_field_headers(): client = ContactCenterInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14687,8 +14725,8 @@ async def test_create_analysis_rule_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - contact_center_insights.GetAnalysisRuleRequest, - dict, + contact_center_insights.GetAnalysisRuleRequest(), + {}, ], ) def test_get_analysis_rule(request_type, transport: str = "grpc"): @@ -14699,7 +14737,7 @@ def test_get_analysis_rule(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -14755,9 +14793,10 @@ def test_get_analysis_rule_non_empty_request_with_auto_populated_field(): client.get_analysis_rule(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == contact_center_insights.GetAnalysisRuleRequest( + request_msg = contact_center_insights.GetAnalysisRuleRequest( name="name_value", ) + assert args[0] == request_msg def test_get_analysis_rule_use_cached_wrapped_rpc(): @@ -14840,10 +14879,14 @@ async def test_get_analysis_rule_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_analysis_rule_async( - transport: str = "grpc_asyncio", - request_type=contact_center_insights.GetAnalysisRuleRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + contact_center_insights.GetAnalysisRuleRequest(), + {}, + ], +) +async def test_get_analysis_rule_async(request_type, transport: str = "grpc_asyncio"): client = ContactCenterInsightsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14851,7 +14894,7 @@ async def test_get_analysis_rule_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( @@ -14884,11 +14927,6 @@ async def test_get_analysis_rule_async( assert response.active is True -@pytest.mark.asyncio -async def test_get_analysis_rule_async_from_dict(): - await test_get_analysis_rule_async(request_type=dict) - - def test_get_analysis_rule_field_headers(): client = ContactCenterInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15043,8 +15081,8 @@ async def test_get_analysis_rule_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - contact_center_insights.ListAnalysisRulesRequest, - dict, + contact_center_insights.ListAnalysisRulesRequest(), + {}, ], ) def test_list_analysis_rules(request_type, transport: str = "grpc"): @@ -15055,7 +15093,7 @@ def test_list_analysis_rules(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -15104,10 +15142,11 @@ def test_list_analysis_rules_non_empty_request_with_auto_populated_field(): client.list_analysis_rules(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == contact_center_insights.ListAnalysisRulesRequest( + request_msg = contact_center_insights.ListAnalysisRulesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_analysis_rules_use_cached_wrapped_rpc(): @@ -15192,10 +15231,14 @@ async def test_list_analysis_rules_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_analysis_rules_async( - transport: str = "grpc_asyncio", - request_type=contact_center_insights.ListAnalysisRulesRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + contact_center_insights.ListAnalysisRulesRequest(), + {}, + ], +) +async def test_list_analysis_rules_async(request_type, transport: str = "grpc_asyncio"): client = ContactCenterInsightsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -15203,7 +15246,7 @@ async def test_list_analysis_rules_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( @@ -15228,11 +15271,6 @@ async def test_list_analysis_rules_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_analysis_rules_async_from_dict(): - await test_list_analysis_rules_async(request_type=dict) - - def test_list_analysis_rules_field_headers(): client = ContactCenterInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15585,8 +15623,8 @@ async def test_list_analysis_rules_async_pages(): @pytest.mark.parametrize( "request_type", [ - contact_center_insights.UpdateAnalysisRuleRequest, - dict, + contact_center_insights.UpdateAnalysisRuleRequest(), + {}, ], ) def test_update_analysis_rule(request_type, transport: str = "grpc"): @@ -15597,7 +15635,7 @@ def test_update_analysis_rule(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -15651,7 +15689,8 @@ def test_update_analysis_rule_non_empty_request_with_auto_populated_field(): client.update_analysis_rule(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == contact_center_insights.UpdateAnalysisRuleRequest() + request_msg = contact_center_insights.UpdateAnalysisRuleRequest() + assert args[0] == request_msg def test_update_analysis_rule_use_cached_wrapped_rpc(): @@ -15736,9 +15775,15 @@ async def test_update_analysis_rule_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + contact_center_insights.UpdateAnalysisRuleRequest(), + {}, + ], +) async def test_update_analysis_rule_async( - transport: str = "grpc_asyncio", - request_type=contact_center_insights.UpdateAnalysisRuleRequest, + request_type, transport: str = "grpc_asyncio" ): client = ContactCenterInsightsAsyncClient( credentials=async_anonymous_credentials(), @@ -15747,7 +15792,7 @@ async def test_update_analysis_rule_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( @@ -15780,11 +15825,6 @@ async def test_update_analysis_rule_async( assert response.active is True -@pytest.mark.asyncio -async def test_update_analysis_rule_async_from_dict(): - await test_update_analysis_rule_async(request_type=dict) - - def test_update_analysis_rule_field_headers(): client = ContactCenterInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15949,8 +15989,8 @@ async def test_update_analysis_rule_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - contact_center_insights.DeleteAnalysisRuleRequest, - dict, + contact_center_insights.DeleteAnalysisRuleRequest(), + {}, ], ) def test_delete_analysis_rule(request_type, transport: str = "grpc"): @@ -15961,7 +16001,7 @@ def test_delete_analysis_rule(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -16006,9 +16046,10 @@ def test_delete_analysis_rule_non_empty_request_with_auto_populated_field(): client.delete_analysis_rule(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == contact_center_insights.DeleteAnalysisRuleRequest( + request_msg = contact_center_insights.DeleteAnalysisRuleRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_analysis_rule_use_cached_wrapped_rpc(): @@ -16093,9 +16134,15 @@ async def test_delete_analysis_rule_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + contact_center_insights.DeleteAnalysisRuleRequest(), + {}, + ], +) async def test_delete_analysis_rule_async( - transport: str = "grpc_asyncio", - request_type=contact_center_insights.DeleteAnalysisRuleRequest, + request_type, transport: str = "grpc_asyncio" ): client = ContactCenterInsightsAsyncClient( credentials=async_anonymous_credentials(), @@ -16104,7 +16151,7 @@ async def test_delete_analysis_rule_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( @@ -16124,11 +16171,6 @@ async def test_delete_analysis_rule_async( assert response is None -@pytest.mark.asyncio -async def test_delete_analysis_rule_async_from_dict(): - await test_delete_analysis_rule_async(request_type=dict) - - def test_delete_analysis_rule_field_headers(): client = ContactCenterInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16279,8 +16321,8 @@ async def test_delete_analysis_rule_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - contact_center_insights.GetEncryptionSpecRequest, - dict, + contact_center_insights.GetEncryptionSpecRequest(), + {}, ], ) def test_get_encryption_spec(request_type, transport: str = "grpc"): @@ -16291,7 +16333,7 @@ def test_get_encryption_spec(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -16341,9 +16383,10 @@ def test_get_encryption_spec_non_empty_request_with_auto_populated_field(): client.get_encryption_spec(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == contact_center_insights.GetEncryptionSpecRequest( + request_msg = contact_center_insights.GetEncryptionSpecRequest( name="name_value", ) + assert args[0] == request_msg def test_get_encryption_spec_use_cached_wrapped_rpc(): @@ -16428,10 +16471,14 @@ async def test_get_encryption_spec_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_encryption_spec_async( - transport: str = "grpc_asyncio", - request_type=contact_center_insights.GetEncryptionSpecRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + contact_center_insights.GetEncryptionSpecRequest(), + {}, + ], +) +async def test_get_encryption_spec_async(request_type, transport: str = "grpc_asyncio"): client = ContactCenterInsightsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -16439,7 +16486,7 @@ async def test_get_encryption_spec_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( @@ -16466,11 +16513,6 @@ async def test_get_encryption_spec_async( assert response.kms_key == "kms_key_value" -@pytest.mark.asyncio -async def test_get_encryption_spec_async_from_dict(): - await test_get_encryption_spec_async(request_type=dict) - - def test_get_encryption_spec_field_headers(): client = ContactCenterInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16625,8 +16667,8 @@ async def test_get_encryption_spec_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - contact_center_insights.InitializeEncryptionSpecRequest, - dict, + contact_center_insights.InitializeEncryptionSpecRequest(), + {}, ], ) def test_initialize_encryption_spec(request_type, transport: str = "grpc"): @@ -16637,7 +16679,7 @@ def test_initialize_encryption_spec(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -16680,7 +16722,8 @@ def test_initialize_encryption_spec_non_empty_request_with_auto_populated_field( client.initialize_encryption_spec(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == contact_center_insights.InitializeEncryptionSpecRequest() + request_msg = contact_center_insights.InitializeEncryptionSpecRequest() + assert args[0] == request_msg def test_initialize_encryption_spec_use_cached_wrapped_rpc(): @@ -16776,9 +16819,15 @@ async def test_initialize_encryption_spec_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + contact_center_insights.InitializeEncryptionSpecRequest(), + {}, + ], +) async def test_initialize_encryption_spec_async( - transport: str = "grpc_asyncio", - request_type=contact_center_insights.InitializeEncryptionSpecRequest, + request_type, transport: str = "grpc_asyncio" ): client = ContactCenterInsightsAsyncClient( credentials=async_anonymous_credentials(), @@ -16787,7 +16836,7 @@ async def test_initialize_encryption_spec_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( @@ -16809,11 +16858,6 @@ async def test_initialize_encryption_spec_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_initialize_encryption_spec_async_from_dict(): - await test_initialize_encryption_spec_async(request_type=dict) - - def test_initialize_encryption_spec_field_headers(): client = ContactCenterInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16968,8 +17012,8 @@ async def test_initialize_encryption_spec_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - contact_center_insights.CreateViewRequest, - dict, + contact_center_insights.CreateViewRequest(), + {}, ], ) def test_create_view(request_type, transport: str = "grpc"): @@ -16980,7 +17024,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: @@ -17028,9 +17072,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] - assert args[0] == contact_center_insights.CreateViewRequest( + request_msg = contact_center_insights.CreateViewRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_view_use_cached_wrapped_rpc(): @@ -17111,10 +17156,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=contact_center_insights.CreateViewRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + contact_center_insights.CreateViewRequest(), + {}, + ], +) +async def test_create_view_async(request_type, transport: str = "grpc_asyncio"): client = ContactCenterInsightsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -17122,7 +17171,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: @@ -17149,11 +17198,6 @@ async def test_create_view_async( assert response.value == "value_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 = ContactCenterInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17306,8 +17350,8 @@ async def test_create_view_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - contact_center_insights.GetViewRequest, - dict, + contact_center_insights.GetViewRequest(), + {}, ], ) def test_get_view(request_type, transport: str = "grpc"): @@ -17318,7 +17362,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: @@ -17366,9 +17410,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] == contact_center_insights.GetViewRequest( + request_msg = contact_center_insights.GetViewRequest( name="name_value", ) + assert args[0] == request_msg def test_get_view_use_cached_wrapped_rpc(): @@ -17447,9 +17492,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=contact_center_insights.GetViewRequest -): +@pytest.mark.parametrize( + "request_type", + [ + contact_center_insights.GetViewRequest(), + {}, + ], +) +async def test_get_view_async(request_type, transport: str = "grpc_asyncio"): client = ContactCenterInsightsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -17457,7 +17507,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: @@ -17484,11 +17534,6 @@ async def test_get_view_async( assert response.value == "value_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 = ContactCenterInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17631,8 +17676,8 @@ async def test_get_view_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - contact_center_insights.ListViewsRequest, - dict, + contact_center_insights.ListViewsRequest(), + {}, ], ) def test_list_views(request_type, transport: str = "grpc"): @@ -17643,7 +17688,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: @@ -17688,10 +17733,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] == contact_center_insights.ListViewsRequest( + request_msg = contact_center_insights.ListViewsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_views_use_cached_wrapped_rpc(): @@ -17770,10 +17816,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=contact_center_insights.ListViewsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + contact_center_insights.ListViewsRequest(), + {}, + ], +) +async def test_list_views_async(request_type, transport: str = "grpc_asyncio"): client = ContactCenterInsightsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -17781,7 +17831,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: @@ -17804,11 +17854,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 = ContactCenterInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18145,8 +18190,8 @@ async def test_list_views_async_pages(): @pytest.mark.parametrize( "request_type", [ - contact_center_insights.UpdateViewRequest, - dict, + contact_center_insights.UpdateViewRequest(), + {}, ], ) def test_update_view(request_type, transport: str = "grpc"): @@ -18157,7 +18202,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: @@ -18203,7 +18248,8 @@ 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] == contact_center_insights.UpdateViewRequest() + request_msg = contact_center_insights.UpdateViewRequest() + assert args[0] == request_msg def test_update_view_use_cached_wrapped_rpc(): @@ -18284,10 +18330,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=contact_center_insights.UpdateViewRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + contact_center_insights.UpdateViewRequest(), + {}, + ], +) +async def test_update_view_async(request_type, transport: str = "grpc_asyncio"): client = ContactCenterInsightsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -18295,7 +18345,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: @@ -18322,11 +18372,6 @@ async def test_update_view_async( assert response.value == "value_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 = ContactCenterInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18479,8 +18524,8 @@ async def test_update_view_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - contact_center_insights.DeleteViewRequest, - dict, + contact_center_insights.DeleteViewRequest(), + {}, ], ) def test_delete_view(request_type, transport: str = "grpc"): @@ -18491,7 +18536,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: @@ -18532,9 +18577,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] == contact_center_insights.DeleteViewRequest( + request_msg = contact_center_insights.DeleteViewRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_view_use_cached_wrapped_rpc(): @@ -18615,10 +18661,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=contact_center_insights.DeleteViewRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + contact_center_insights.DeleteViewRequest(), + {}, + ], +) +async def test_delete_view_async(request_type, transport: str = "grpc_asyncio"): client = ContactCenterInsightsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -18626,7 +18676,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: @@ -18644,11 +18694,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 = ContactCenterInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18791,8 +18836,8 @@ async def test_delete_view_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - contact_center_insights.QueryMetricsRequest, - dict, + contact_center_insights.QueryMetricsRequest(), + {}, ], ) def test_query_metrics(request_type, transport: str = "grpc"): @@ -18803,7 +18848,7 @@ def test_query_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.query_metrics), "__call__") as call: @@ -18845,10 +18890,11 @@ def test_query_metrics_non_empty_request_with_auto_populated_field(): client.query_metrics(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == contact_center_insights.QueryMetricsRequest( + request_msg = contact_center_insights.QueryMetricsRequest( location="location_value", filter="filter_value", ) + assert args[0] == request_msg def test_query_metrics_use_cached_wrapped_rpc(): @@ -18939,10 +18985,14 @@ async def test_query_metrics_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_query_metrics_async( - transport: str = "grpc_asyncio", - request_type=contact_center_insights.QueryMetricsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + contact_center_insights.QueryMetricsRequest(), + {}, + ], +) +async def test_query_metrics_async(request_type, transport: str = "grpc_asyncio"): client = ContactCenterInsightsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -18950,7 +19000,7 @@ async def test_query_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.query_metrics), "__call__") as call: @@ -18970,11 +19020,6 @@ async def test_query_metrics_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_query_metrics_async_from_dict(): - await test_query_metrics_async(request_type=dict) - - def test_query_metrics_field_headers(): client = ContactCenterInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -19039,8 +19084,8 @@ async def test_query_metrics_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - contact_center_insights.CreateQaQuestionRequest, - dict, + contact_center_insights.CreateQaQuestionRequest(), + {}, ], ) def test_create_qa_question(request_type, transport: str = "grpc"): @@ -19051,7 +19096,7 @@ def test_create_qa_question(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -19110,10 +19155,11 @@ def test_create_qa_question_non_empty_request_with_auto_populated_field(): client.create_qa_question(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == contact_center_insights.CreateQaQuestionRequest( + request_msg = contact_center_insights.CreateQaQuestionRequest( parent="parent_value", qa_question_id="qa_question_id_value", ) + assert args[0] == request_msg def test_create_qa_question_use_cached_wrapped_rpc(): @@ -19198,10 +19244,14 @@ async def test_create_qa_question_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_qa_question_async( - transport: str = "grpc_asyncio", - request_type=contact_center_insights.CreateQaQuestionRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + contact_center_insights.CreateQaQuestionRequest(), + {}, + ], +) +async def test_create_qa_question_async(request_type, transport: str = "grpc_asyncio"): client = ContactCenterInsightsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -19209,7 +19259,7 @@ async def test_create_qa_question_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( @@ -19244,11 +19294,6 @@ async def test_create_qa_question_async( assert response.order == 540 -@pytest.mark.asyncio -async def test_create_qa_question_async_from_dict(): - await test_create_qa_question_async(request_type=dict) - - def test_create_qa_question_field_headers(): client = ContactCenterInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -19423,8 +19468,8 @@ async def test_create_qa_question_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - contact_center_insights.GetQaQuestionRequest, - dict, + contact_center_insights.GetQaQuestionRequest(), + {}, ], ) def test_get_qa_question(request_type, transport: str = "grpc"): @@ -19435,7 +19480,7 @@ def test_get_qa_question(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_qa_question), "__call__") as call: @@ -19489,9 +19534,10 @@ def test_get_qa_question_non_empty_request_with_auto_populated_field(): client.get_qa_question(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == contact_center_insights.GetQaQuestionRequest( + request_msg = contact_center_insights.GetQaQuestionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_qa_question_use_cached_wrapped_rpc(): @@ -19572,10 +19618,14 @@ async def test_get_qa_question_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_qa_question_async( - transport: str = "grpc_asyncio", - request_type=contact_center_insights.GetQaQuestionRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + contact_center_insights.GetQaQuestionRequest(), + {}, + ], +) +async def test_get_qa_question_async(request_type, transport: str = "grpc_asyncio"): client = ContactCenterInsightsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -19583,7 +19633,7 @@ async def test_get_qa_question_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_qa_question), "__call__") as call: @@ -19616,11 +19666,6 @@ async def test_get_qa_question_async( assert response.order == 540 -@pytest.mark.asyncio -async def test_get_qa_question_async_from_dict(): - await test_get_qa_question_async(request_type=dict) - - def test_get_qa_question_field_headers(): client = ContactCenterInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -19767,8 +19812,8 @@ async def test_get_qa_question_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - contact_center_insights.UpdateQaQuestionRequest, - dict, + contact_center_insights.UpdateQaQuestionRequest(), + {}, ], ) def test_update_qa_question(request_type, transport: str = "grpc"): @@ -19779,7 +19824,7 @@ def test_update_qa_question(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -19835,7 +19880,8 @@ def test_update_qa_question_non_empty_request_with_auto_populated_field(): client.update_qa_question(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == contact_center_insights.UpdateQaQuestionRequest() + request_msg = contact_center_insights.UpdateQaQuestionRequest() + assert args[0] == request_msg def test_update_qa_question_use_cached_wrapped_rpc(): @@ -19920,10 +19966,14 @@ async def test_update_qa_question_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_qa_question_async( - transport: str = "grpc_asyncio", - request_type=contact_center_insights.UpdateQaQuestionRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + contact_center_insights.UpdateQaQuestionRequest(), + {}, + ], +) +async def test_update_qa_question_async(request_type, transport: str = "grpc_asyncio"): client = ContactCenterInsightsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -19931,7 +19981,7 @@ async def test_update_qa_question_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( @@ -19966,11 +20016,6 @@ async def test_update_qa_question_async( assert response.order == 540 -@pytest.mark.asyncio -async def test_update_qa_question_async_from_dict(): - await test_update_qa_question_async(request_type=dict) - - def test_update_qa_question_field_headers(): client = ContactCenterInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -20135,8 +20180,8 @@ async def test_update_qa_question_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - contact_center_insights.DeleteQaQuestionRequest, - dict, + contact_center_insights.DeleteQaQuestionRequest(), + {}, ], ) def test_delete_qa_question(request_type, transport: str = "grpc"): @@ -20147,7 +20192,7 @@ def test_delete_qa_question(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -20192,9 +20237,10 @@ def test_delete_qa_question_non_empty_request_with_auto_populated_field(): client.delete_qa_question(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == contact_center_insights.DeleteQaQuestionRequest( + request_msg = contact_center_insights.DeleteQaQuestionRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_qa_question_use_cached_wrapped_rpc(): @@ -20279,10 +20325,14 @@ async def test_delete_qa_question_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_qa_question_async( - transport: str = "grpc_asyncio", - request_type=contact_center_insights.DeleteQaQuestionRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + contact_center_insights.DeleteQaQuestionRequest(), + {}, + ], +) +async def test_delete_qa_question_async(request_type, transport: str = "grpc_asyncio"): client = ContactCenterInsightsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -20290,7 +20340,7 @@ async def test_delete_qa_question_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( @@ -20310,11 +20360,6 @@ async def test_delete_qa_question_async( assert response is None -@pytest.mark.asyncio -async def test_delete_qa_question_async_from_dict(): - await test_delete_qa_question_async(request_type=dict) - - def test_delete_qa_question_field_headers(): client = ContactCenterInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -20465,8 +20510,8 @@ async def test_delete_qa_question_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - contact_center_insights.ListQaQuestionsRequest, - dict, + contact_center_insights.ListQaQuestionsRequest(), + {}, ], ) def test_list_qa_questions(request_type, transport: str = "grpc"): @@ -20477,7 +20522,7 @@ def test_list_qa_questions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -20526,10 +20571,11 @@ def test_list_qa_questions_non_empty_request_with_auto_populated_field(): client.list_qa_questions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == contact_center_insights.ListQaQuestionsRequest( + request_msg = contact_center_insights.ListQaQuestionsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_qa_questions_use_cached_wrapped_rpc(): @@ -20612,10 +20658,14 @@ async def test_list_qa_questions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_qa_questions_async( - transport: str = "grpc_asyncio", - request_type=contact_center_insights.ListQaQuestionsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + contact_center_insights.ListQaQuestionsRequest(), + {}, + ], +) +async def test_list_qa_questions_async(request_type, transport: str = "grpc_asyncio"): client = ContactCenterInsightsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -20623,7 +20673,7 @@ async def test_list_qa_questions_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( @@ -20648,11 +20698,6 @@ async def test_list_qa_questions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_qa_questions_async_from_dict(): - await test_list_qa_questions_async(request_type=dict) - - def test_list_qa_questions_field_headers(): client = ContactCenterInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -21005,8 +21050,8 @@ async def test_list_qa_questions_async_pages(): @pytest.mark.parametrize( "request_type", [ - contact_center_insights.CreateQaScorecardRequest, - dict, + contact_center_insights.CreateQaScorecardRequest(), + {}, ], ) def test_create_qa_scorecard(request_type, transport: str = "grpc"): @@ -21017,7 +21062,7 @@ def test_create_qa_scorecard(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -21070,10 +21115,11 @@ def test_create_qa_scorecard_non_empty_request_with_auto_populated_field(): client.create_qa_scorecard(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == contact_center_insights.CreateQaScorecardRequest( + request_msg = contact_center_insights.CreateQaScorecardRequest( parent="parent_value", qa_scorecard_id="qa_scorecard_id_value", ) + assert args[0] == request_msg def test_create_qa_scorecard_use_cached_wrapped_rpc(): @@ -21158,10 +21204,14 @@ async def test_create_qa_scorecard_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_qa_scorecard_async( - transport: str = "grpc_asyncio", - request_type=contact_center_insights.CreateQaScorecardRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + contact_center_insights.CreateQaScorecardRequest(), + {}, + ], +) +async def test_create_qa_scorecard_async(request_type, transport: str = "grpc_asyncio"): client = ContactCenterInsightsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -21169,7 +21219,7 @@ async def test_create_qa_scorecard_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( @@ -21198,11 +21248,6 @@ async def test_create_qa_scorecard_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_create_qa_scorecard_async_from_dict(): - await test_create_qa_scorecard_async(request_type=dict) - - def test_create_qa_scorecard_field_headers(): client = ContactCenterInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -21377,8 +21422,8 @@ async def test_create_qa_scorecard_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - contact_center_insights.GetQaScorecardRequest, - dict, + contact_center_insights.GetQaScorecardRequest(), + {}, ], ) def test_get_qa_scorecard(request_type, transport: str = "grpc"): @@ -21389,7 +21434,7 @@ def test_get_qa_scorecard(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_qa_scorecard), "__call__") as call: @@ -21437,9 +21482,10 @@ def test_get_qa_scorecard_non_empty_request_with_auto_populated_field(): client.get_qa_scorecard(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == contact_center_insights.GetQaScorecardRequest( + request_msg = contact_center_insights.GetQaScorecardRequest( name="name_value", ) + assert args[0] == request_msg def test_get_qa_scorecard_use_cached_wrapped_rpc(): @@ -21522,10 +21568,14 @@ async def test_get_qa_scorecard_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_qa_scorecard_async( - transport: str = "grpc_asyncio", - request_type=contact_center_insights.GetQaScorecardRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + contact_center_insights.GetQaScorecardRequest(), + {}, + ], +) +async def test_get_qa_scorecard_async(request_type, transport: str = "grpc_asyncio"): client = ContactCenterInsightsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -21533,7 +21583,7 @@ async def test_get_qa_scorecard_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_qa_scorecard), "__call__") as call: @@ -21560,11 +21610,6 @@ async def test_get_qa_scorecard_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_get_qa_scorecard_async_from_dict(): - await test_get_qa_scorecard_async(request_type=dict) - - def test_get_qa_scorecard_field_headers(): client = ContactCenterInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -21711,8 +21756,8 @@ async def test_get_qa_scorecard_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - contact_center_insights.UpdateQaScorecardRequest, - dict, + contact_center_insights.UpdateQaScorecardRequest(), + {}, ], ) def test_update_qa_scorecard(request_type, transport: str = "grpc"): @@ -21723,7 +21768,7 @@ def test_update_qa_scorecard(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -21773,7 +21818,8 @@ def test_update_qa_scorecard_non_empty_request_with_auto_populated_field(): client.update_qa_scorecard(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == contact_center_insights.UpdateQaScorecardRequest() + request_msg = contact_center_insights.UpdateQaScorecardRequest() + assert args[0] == request_msg def test_update_qa_scorecard_use_cached_wrapped_rpc(): @@ -21858,10 +21904,14 @@ async def test_update_qa_scorecard_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_qa_scorecard_async( - transport: str = "grpc_asyncio", - request_type=contact_center_insights.UpdateQaScorecardRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + contact_center_insights.UpdateQaScorecardRequest(), + {}, + ], +) +async def test_update_qa_scorecard_async(request_type, transport: str = "grpc_asyncio"): client = ContactCenterInsightsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -21869,7 +21919,7 @@ async def test_update_qa_scorecard_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( @@ -21898,11 +21948,6 @@ async def test_update_qa_scorecard_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_update_qa_scorecard_async_from_dict(): - await test_update_qa_scorecard_async(request_type=dict) - - def test_update_qa_scorecard_field_headers(): client = ContactCenterInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -22067,8 +22112,8 @@ async def test_update_qa_scorecard_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - contact_center_insights.DeleteQaScorecardRequest, - dict, + contact_center_insights.DeleteQaScorecardRequest(), + {}, ], ) def test_delete_qa_scorecard(request_type, transport: str = "grpc"): @@ -22079,7 +22124,7 @@ def test_delete_qa_scorecard(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -22124,9 +22169,10 @@ def test_delete_qa_scorecard_non_empty_request_with_auto_populated_field(): client.delete_qa_scorecard(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == contact_center_insights.DeleteQaScorecardRequest( + request_msg = contact_center_insights.DeleteQaScorecardRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_qa_scorecard_use_cached_wrapped_rpc(): @@ -22211,10 +22257,14 @@ async def test_delete_qa_scorecard_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_qa_scorecard_async( - transport: str = "grpc_asyncio", - request_type=contact_center_insights.DeleteQaScorecardRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + contact_center_insights.DeleteQaScorecardRequest(), + {}, + ], +) +async def test_delete_qa_scorecard_async(request_type, transport: str = "grpc_asyncio"): client = ContactCenterInsightsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -22222,7 +22272,7 @@ async def test_delete_qa_scorecard_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( @@ -22242,11 +22292,6 @@ async def test_delete_qa_scorecard_async( assert response is None -@pytest.mark.asyncio -async def test_delete_qa_scorecard_async_from_dict(): - await test_delete_qa_scorecard_async(request_type=dict) - - def test_delete_qa_scorecard_field_headers(): client = ContactCenterInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -22397,8 +22442,8 @@ async def test_delete_qa_scorecard_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - contact_center_insights.ListQaScorecardsRequest, - dict, + contact_center_insights.ListQaScorecardsRequest(), + {}, ], ) def test_list_qa_scorecards(request_type, transport: str = "grpc"): @@ -22409,7 +22454,7 @@ def test_list_qa_scorecards(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -22458,10 +22503,11 @@ def test_list_qa_scorecards_non_empty_request_with_auto_populated_field(): client.list_qa_scorecards(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == contact_center_insights.ListQaScorecardsRequest( + request_msg = contact_center_insights.ListQaScorecardsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_qa_scorecards_use_cached_wrapped_rpc(): @@ -22546,10 +22592,14 @@ async def test_list_qa_scorecards_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_qa_scorecards_async( - transport: str = "grpc_asyncio", - request_type=contact_center_insights.ListQaScorecardsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + contact_center_insights.ListQaScorecardsRequest(), + {}, + ], +) +async def test_list_qa_scorecards_async(request_type, transport: str = "grpc_asyncio"): client = ContactCenterInsightsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -22557,7 +22607,7 @@ async def test_list_qa_scorecards_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( @@ -22582,11 +22632,6 @@ async def test_list_qa_scorecards_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_qa_scorecards_async_from_dict(): - await test_list_qa_scorecards_async(request_type=dict) - - def test_list_qa_scorecards_field_headers(): client = ContactCenterInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -22939,8 +22984,8 @@ async def test_list_qa_scorecards_async_pages(): @pytest.mark.parametrize( "request_type", [ - contact_center_insights.CreateQaScorecardRevisionRequest, - dict, + contact_center_insights.CreateQaScorecardRevisionRequest(), + {}, ], ) def test_create_qa_scorecard_revision(request_type, transport: str = "grpc"): @@ -22951,7 +22996,7 @@ def test_create_qa_scorecard_revision(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -23004,10 +23049,11 @@ def test_create_qa_scorecard_revision_non_empty_request_with_auto_populated_fiel client.create_qa_scorecard_revision(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == contact_center_insights.CreateQaScorecardRevisionRequest( + request_msg = contact_center_insights.CreateQaScorecardRevisionRequest( parent="parent_value", qa_scorecard_revision_id="qa_scorecard_revision_id_value", ) + assert args[0] == request_msg def test_create_qa_scorecard_revision_use_cached_wrapped_rpc(): @@ -23093,9 +23139,15 @@ async def test_create_qa_scorecard_revision_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + contact_center_insights.CreateQaScorecardRevisionRequest(), + {}, + ], +) async def test_create_qa_scorecard_revision_async( - transport: str = "grpc_asyncio", - request_type=contact_center_insights.CreateQaScorecardRevisionRequest, + request_type, transport: str = "grpc_asyncio" ): client = ContactCenterInsightsAsyncClient( credentials=async_anonymous_credentials(), @@ -23104,7 +23156,7 @@ async def test_create_qa_scorecard_revision_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( @@ -23133,11 +23185,6 @@ async def test_create_qa_scorecard_revision_async( assert response.state == resources.QaScorecardRevision.State.EDITABLE -@pytest.mark.asyncio -async def test_create_qa_scorecard_revision_async_from_dict(): - await test_create_qa_scorecard_revision_async(request_type=dict) - - def test_create_qa_scorecard_revision_field_headers(): client = ContactCenterInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -23312,8 +23359,8 @@ async def test_create_qa_scorecard_revision_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - contact_center_insights.GetQaScorecardRevisionRequest, - dict, + contact_center_insights.GetQaScorecardRevisionRequest(), + {}, ], ) def test_get_qa_scorecard_revision(request_type, transport: str = "grpc"): @@ -23324,7 +23371,7 @@ def test_get_qa_scorecard_revision(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -23376,9 +23423,10 @@ def test_get_qa_scorecard_revision_non_empty_request_with_auto_populated_field() client.get_qa_scorecard_revision(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == contact_center_insights.GetQaScorecardRevisionRequest( + request_msg = contact_center_insights.GetQaScorecardRevisionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_qa_scorecard_revision_use_cached_wrapped_rpc(): @@ -23464,9 +23512,15 @@ async def test_get_qa_scorecard_revision_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + contact_center_insights.GetQaScorecardRevisionRequest(), + {}, + ], +) async def test_get_qa_scorecard_revision_async( - transport: str = "grpc_asyncio", - request_type=contact_center_insights.GetQaScorecardRevisionRequest, + request_type, transport: str = "grpc_asyncio" ): client = ContactCenterInsightsAsyncClient( credentials=async_anonymous_credentials(), @@ -23475,7 +23529,7 @@ async def test_get_qa_scorecard_revision_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( @@ -23504,11 +23558,6 @@ async def test_get_qa_scorecard_revision_async( assert response.state == resources.QaScorecardRevision.State.EDITABLE -@pytest.mark.asyncio -async def test_get_qa_scorecard_revision_async_from_dict(): - await test_get_qa_scorecard_revision_async(request_type=dict) - - def test_get_qa_scorecard_revision_field_headers(): client = ContactCenterInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -23663,8 +23712,8 @@ async def test_get_qa_scorecard_revision_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - contact_center_insights.TuneQaScorecardRevisionRequest, - dict, + contact_center_insights.TuneQaScorecardRevisionRequest(), + {}, ], ) def test_tune_qa_scorecard_revision(request_type, transport: str = "grpc"): @@ -23675,7 +23724,7 @@ def test_tune_qa_scorecard_revision(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -23721,10 +23770,11 @@ def test_tune_qa_scorecard_revision_non_empty_request_with_auto_populated_field( client.tune_qa_scorecard_revision(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == contact_center_insights.TuneQaScorecardRevisionRequest( + request_msg = contact_center_insights.TuneQaScorecardRevisionRequest( parent="parent_value", filter="filter_value", ) + assert args[0] == request_msg def test_tune_qa_scorecard_revision_use_cached_wrapped_rpc(): @@ -23820,9 +23870,15 @@ async def test_tune_qa_scorecard_revision_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + contact_center_insights.TuneQaScorecardRevisionRequest(), + {}, + ], +) async def test_tune_qa_scorecard_revision_async( - transport: str = "grpc_asyncio", - request_type=contact_center_insights.TuneQaScorecardRevisionRequest, + request_type, transport: str = "grpc_asyncio" ): client = ContactCenterInsightsAsyncClient( credentials=async_anonymous_credentials(), @@ -23831,7 +23887,7 @@ async def test_tune_qa_scorecard_revision_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( @@ -23853,11 +23909,6 @@ async def test_tune_qa_scorecard_revision_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_tune_qa_scorecard_revision_async_from_dict(): - await test_tune_qa_scorecard_revision_async(request_type=dict) - - def test_tune_qa_scorecard_revision_field_headers(): client = ContactCenterInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -24032,8 +24083,8 @@ async def test_tune_qa_scorecard_revision_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - contact_center_insights.DeployQaScorecardRevisionRequest, - dict, + contact_center_insights.DeployQaScorecardRevisionRequest(), + {}, ], ) def test_deploy_qa_scorecard_revision(request_type, transport: str = "grpc"): @@ -24044,7 +24095,7 @@ def test_deploy_qa_scorecard_revision(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -24096,9 +24147,10 @@ def test_deploy_qa_scorecard_revision_non_empty_request_with_auto_populated_fiel client.deploy_qa_scorecard_revision(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == contact_center_insights.DeployQaScorecardRevisionRequest( + request_msg = contact_center_insights.DeployQaScorecardRevisionRequest( name="name_value", ) + assert args[0] == request_msg def test_deploy_qa_scorecard_revision_use_cached_wrapped_rpc(): @@ -24184,9 +24236,15 @@ async def test_deploy_qa_scorecard_revision_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + contact_center_insights.DeployQaScorecardRevisionRequest(), + {}, + ], +) async def test_deploy_qa_scorecard_revision_async( - transport: str = "grpc_asyncio", - request_type=contact_center_insights.DeployQaScorecardRevisionRequest, + request_type, transport: str = "grpc_asyncio" ): client = ContactCenterInsightsAsyncClient( credentials=async_anonymous_credentials(), @@ -24195,7 +24253,7 @@ async def test_deploy_qa_scorecard_revision_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( @@ -24224,11 +24282,6 @@ async def test_deploy_qa_scorecard_revision_async( assert response.state == resources.QaScorecardRevision.State.EDITABLE -@pytest.mark.asyncio -async def test_deploy_qa_scorecard_revision_async_from_dict(): - await test_deploy_qa_scorecard_revision_async(request_type=dict) - - def test_deploy_qa_scorecard_revision_field_headers(): client = ContactCenterInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -24297,8 +24350,8 @@ async def test_deploy_qa_scorecard_revision_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - contact_center_insights.UndeployQaScorecardRevisionRequest, - dict, + contact_center_insights.UndeployQaScorecardRevisionRequest(), + {}, ], ) def test_undeploy_qa_scorecard_revision(request_type, transport: str = "grpc"): @@ -24309,7 +24362,7 @@ def test_undeploy_qa_scorecard_revision(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -24361,9 +24414,10 @@ def test_undeploy_qa_scorecard_revision_non_empty_request_with_auto_populated_fi client.undeploy_qa_scorecard_revision(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == contact_center_insights.UndeployQaScorecardRevisionRequest( + request_msg = contact_center_insights.UndeployQaScorecardRevisionRequest( name="name_value", ) + assert args[0] == request_msg def test_undeploy_qa_scorecard_revision_use_cached_wrapped_rpc(): @@ -24449,9 +24503,15 @@ async def test_undeploy_qa_scorecard_revision_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + contact_center_insights.UndeployQaScorecardRevisionRequest(), + {}, + ], +) async def test_undeploy_qa_scorecard_revision_async( - transport: str = "grpc_asyncio", - request_type=contact_center_insights.UndeployQaScorecardRevisionRequest, + request_type, transport: str = "grpc_asyncio" ): client = ContactCenterInsightsAsyncClient( credentials=async_anonymous_credentials(), @@ -24460,7 +24520,7 @@ async def test_undeploy_qa_scorecard_revision_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( @@ -24489,11 +24549,6 @@ async def test_undeploy_qa_scorecard_revision_async( assert response.state == resources.QaScorecardRevision.State.EDITABLE -@pytest.mark.asyncio -async def test_undeploy_qa_scorecard_revision_async_from_dict(): - await test_undeploy_qa_scorecard_revision_async(request_type=dict) - - def test_undeploy_qa_scorecard_revision_field_headers(): client = ContactCenterInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -24562,8 +24617,8 @@ async def test_undeploy_qa_scorecard_revision_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - contact_center_insights.DeleteQaScorecardRevisionRequest, - dict, + contact_center_insights.DeleteQaScorecardRevisionRequest(), + {}, ], ) def test_delete_qa_scorecard_revision(request_type, transport: str = "grpc"): @@ -24574,7 +24629,7 @@ def test_delete_qa_scorecard_revision(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -24619,9 +24674,10 @@ def test_delete_qa_scorecard_revision_non_empty_request_with_auto_populated_fiel client.delete_qa_scorecard_revision(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == contact_center_insights.DeleteQaScorecardRevisionRequest( + request_msg = contact_center_insights.DeleteQaScorecardRevisionRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_qa_scorecard_revision_use_cached_wrapped_rpc(): @@ -24707,9 +24763,15 @@ async def test_delete_qa_scorecard_revision_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + contact_center_insights.DeleteQaScorecardRevisionRequest(), + {}, + ], +) async def test_delete_qa_scorecard_revision_async( - transport: str = "grpc_asyncio", - request_type=contact_center_insights.DeleteQaScorecardRevisionRequest, + request_type, transport: str = "grpc_asyncio" ): client = ContactCenterInsightsAsyncClient( credentials=async_anonymous_credentials(), @@ -24718,7 +24780,7 @@ async def test_delete_qa_scorecard_revision_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( @@ -24738,11 +24800,6 @@ async def test_delete_qa_scorecard_revision_async( assert response is None -@pytest.mark.asyncio -async def test_delete_qa_scorecard_revision_async_from_dict(): - await test_delete_qa_scorecard_revision_async(request_type=dict) - - def test_delete_qa_scorecard_revision_field_headers(): client = ContactCenterInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -24893,8 +24950,8 @@ async def test_delete_qa_scorecard_revision_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - contact_center_insights.ListQaScorecardRevisionsRequest, - dict, + contact_center_insights.ListQaScorecardRevisionsRequest(), + {}, ], ) def test_list_qa_scorecard_revisions(request_type, transport: str = "grpc"): @@ -24905,7 +24962,7 @@ def test_list_qa_scorecard_revisions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -24955,11 +25012,12 @@ def test_list_qa_scorecard_revisions_non_empty_request_with_auto_populated_field client.list_qa_scorecard_revisions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == contact_center_insights.ListQaScorecardRevisionsRequest( + request_msg = contact_center_insights.ListQaScorecardRevisionsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_qa_scorecard_revisions_use_cached_wrapped_rpc(): @@ -25045,9 +25103,15 @@ async def test_list_qa_scorecard_revisions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + contact_center_insights.ListQaScorecardRevisionsRequest(), + {}, + ], +) async def test_list_qa_scorecard_revisions_async( - transport: str = "grpc_asyncio", - request_type=contact_center_insights.ListQaScorecardRevisionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = ContactCenterInsightsAsyncClient( credentials=async_anonymous_credentials(), @@ -25056,7 +25120,7 @@ async def test_list_qa_scorecard_revisions_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( @@ -25081,11 +25145,6 @@ async def test_list_qa_scorecard_revisions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_qa_scorecard_revisions_async_from_dict(): - await test_list_qa_scorecard_revisions_async(request_type=dict) - - def test_list_qa_scorecard_revisions_field_headers(): client = ContactCenterInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -25440,8 +25499,8 @@ async def test_list_qa_scorecard_revisions_async_pages(): @pytest.mark.parametrize( "request_type", [ - contact_center_insights.CreateFeedbackLabelRequest, - dict, + contact_center_insights.CreateFeedbackLabelRequest(), + {}, ], ) def test_create_feedback_label(request_type, transport: str = "grpc"): @@ -25452,7 +25511,7 @@ def test_create_feedback_label(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -25504,10 +25563,11 @@ def test_create_feedback_label_non_empty_request_with_auto_populated_field(): client.create_feedback_label(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == contact_center_insights.CreateFeedbackLabelRequest( + request_msg = contact_center_insights.CreateFeedbackLabelRequest( parent="parent_value", feedback_label_id="feedback_label_id_value", ) + assert args[0] == request_msg def test_create_feedback_label_use_cached_wrapped_rpc(): @@ -25593,9 +25653,15 @@ async def test_create_feedback_label_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + contact_center_insights.CreateFeedbackLabelRequest(), + {}, + ], +) async def test_create_feedback_label_async( - transport: str = "grpc_asyncio", - request_type=contact_center_insights.CreateFeedbackLabelRequest, + request_type, transport: str = "grpc_asyncio" ): client = ContactCenterInsightsAsyncClient( credentials=async_anonymous_credentials(), @@ -25604,7 +25670,7 @@ async def test_create_feedback_label_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( @@ -25631,11 +25697,6 @@ async def test_create_feedback_label_async( assert response.labeled_resource == "labeled_resource_value" -@pytest.mark.asyncio -async def test_create_feedback_label_async_from_dict(): - await test_create_feedback_label_async(request_type=dict) - - def test_create_feedback_label_field_headers(): client = ContactCenterInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -25810,8 +25871,8 @@ async def test_create_feedback_label_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - contact_center_insights.ListFeedbackLabelsRequest, - dict, + contact_center_insights.ListFeedbackLabelsRequest(), + {}, ], ) def test_list_feedback_labels(request_type, transport: str = "grpc"): @@ -25822,7 +25883,7 @@ def test_list_feedback_labels(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -25872,11 +25933,12 @@ def test_list_feedback_labels_non_empty_request_with_auto_populated_field(): client.list_feedback_labels(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == contact_center_insights.ListFeedbackLabelsRequest( + request_msg = contact_center_insights.ListFeedbackLabelsRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_feedback_labels_use_cached_wrapped_rpc(): @@ -25961,9 +26023,15 @@ async def test_list_feedback_labels_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + contact_center_insights.ListFeedbackLabelsRequest(), + {}, + ], +) async def test_list_feedback_labels_async( - transport: str = "grpc_asyncio", - request_type=contact_center_insights.ListFeedbackLabelsRequest, + request_type, transport: str = "grpc_asyncio" ): client = ContactCenterInsightsAsyncClient( credentials=async_anonymous_credentials(), @@ -25972,7 +26040,7 @@ async def test_list_feedback_labels_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( @@ -25997,11 +26065,6 @@ async def test_list_feedback_labels_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_feedback_labels_async_from_dict(): - await test_list_feedback_labels_async(request_type=dict) - - def test_list_feedback_labels_field_headers(): client = ContactCenterInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -26354,8 +26417,8 @@ async def test_list_feedback_labels_async_pages(): @pytest.mark.parametrize( "request_type", [ - contact_center_insights.GetFeedbackLabelRequest, - dict, + contact_center_insights.GetFeedbackLabelRequest(), + {}, ], ) def test_get_feedback_label(request_type, transport: str = "grpc"): @@ -26366,7 +26429,7 @@ def test_get_feedback_label(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -26417,9 +26480,10 @@ def test_get_feedback_label_non_empty_request_with_auto_populated_field(): client.get_feedback_label(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == contact_center_insights.GetFeedbackLabelRequest( + request_msg = contact_center_insights.GetFeedbackLabelRequest( name="name_value", ) + assert args[0] == request_msg def test_get_feedback_label_use_cached_wrapped_rpc(): @@ -26504,10 +26568,14 @@ async def test_get_feedback_label_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_feedback_label_async( - transport: str = "grpc_asyncio", - request_type=contact_center_insights.GetFeedbackLabelRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + contact_center_insights.GetFeedbackLabelRequest(), + {}, + ], +) +async def test_get_feedback_label_async(request_type, transport: str = "grpc_asyncio"): client = ContactCenterInsightsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -26515,7 +26583,7 @@ async def test_get_feedback_label_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( @@ -26542,11 +26610,6 @@ async def test_get_feedback_label_async( assert response.labeled_resource == "labeled_resource_value" -@pytest.mark.asyncio -async def test_get_feedback_label_async_from_dict(): - await test_get_feedback_label_async(request_type=dict) - - def test_get_feedback_label_field_headers(): client = ContactCenterInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -26701,8 +26764,8 @@ async def test_get_feedback_label_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - contact_center_insights.UpdateFeedbackLabelRequest, - dict, + contact_center_insights.UpdateFeedbackLabelRequest(), + {}, ], ) def test_update_feedback_label(request_type, transport: str = "grpc"): @@ -26713,7 +26776,7 @@ def test_update_feedback_label(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -26762,7 +26825,8 @@ def test_update_feedback_label_non_empty_request_with_auto_populated_field(): client.update_feedback_label(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == contact_center_insights.UpdateFeedbackLabelRequest() + request_msg = contact_center_insights.UpdateFeedbackLabelRequest() + assert args[0] == request_msg def test_update_feedback_label_use_cached_wrapped_rpc(): @@ -26848,9 +26912,15 @@ async def test_update_feedback_label_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + contact_center_insights.UpdateFeedbackLabelRequest(), + {}, + ], +) async def test_update_feedback_label_async( - transport: str = "grpc_asyncio", - request_type=contact_center_insights.UpdateFeedbackLabelRequest, + request_type, transport: str = "grpc_asyncio" ): client = ContactCenterInsightsAsyncClient( credentials=async_anonymous_credentials(), @@ -26859,7 +26929,7 @@ async def test_update_feedback_label_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( @@ -26886,11 +26956,6 @@ async def test_update_feedback_label_async( assert response.labeled_resource == "labeled_resource_value" -@pytest.mark.asyncio -async def test_update_feedback_label_async_from_dict(): - await test_update_feedback_label_async(request_type=dict) - - def test_update_feedback_label_field_headers(): client = ContactCenterInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -27055,8 +27120,8 @@ async def test_update_feedback_label_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - contact_center_insights.DeleteFeedbackLabelRequest, - dict, + contact_center_insights.DeleteFeedbackLabelRequest(), + {}, ], ) def test_delete_feedback_label(request_type, transport: str = "grpc"): @@ -27067,7 +27132,7 @@ def test_delete_feedback_label(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -27112,9 +27177,10 @@ def test_delete_feedback_label_non_empty_request_with_auto_populated_field(): client.delete_feedback_label(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == contact_center_insights.DeleteFeedbackLabelRequest( + request_msg = contact_center_insights.DeleteFeedbackLabelRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_feedback_label_use_cached_wrapped_rpc(): @@ -27200,9 +27266,15 @@ async def test_delete_feedback_label_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + contact_center_insights.DeleteFeedbackLabelRequest(), + {}, + ], +) async def test_delete_feedback_label_async( - transport: str = "grpc_asyncio", - request_type=contact_center_insights.DeleteFeedbackLabelRequest, + request_type, transport: str = "grpc_asyncio" ): client = ContactCenterInsightsAsyncClient( credentials=async_anonymous_credentials(), @@ -27211,7 +27283,7 @@ async def test_delete_feedback_label_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( @@ -27231,11 +27303,6 @@ async def test_delete_feedback_label_async( assert response is None -@pytest.mark.asyncio -async def test_delete_feedback_label_async_from_dict(): - await test_delete_feedback_label_async(request_type=dict) - - def test_delete_feedback_label_field_headers(): client = ContactCenterInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -27386,8 +27453,8 @@ async def test_delete_feedback_label_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - contact_center_insights.ListAllFeedbackLabelsRequest, - dict, + contact_center_insights.ListAllFeedbackLabelsRequest(), + {}, ], ) def test_list_all_feedback_labels(request_type, transport: str = "grpc"): @@ -27398,7 +27465,7 @@ def test_list_all_feedback_labels(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -27448,11 +27515,12 @@ def test_list_all_feedback_labels_non_empty_request_with_auto_populated_field(): client.list_all_feedback_labels(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == contact_center_insights.ListAllFeedbackLabelsRequest( + request_msg = contact_center_insights.ListAllFeedbackLabelsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_all_feedback_labels_use_cached_wrapped_rpc(): @@ -27538,9 +27606,15 @@ async def test_list_all_feedback_labels_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + contact_center_insights.ListAllFeedbackLabelsRequest(), + {}, + ], +) async def test_list_all_feedback_labels_async( - transport: str = "grpc_asyncio", - request_type=contact_center_insights.ListAllFeedbackLabelsRequest, + request_type, transport: str = "grpc_asyncio" ): client = ContactCenterInsightsAsyncClient( credentials=async_anonymous_credentials(), @@ -27549,7 +27623,7 @@ async def test_list_all_feedback_labels_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( @@ -27574,11 +27648,6 @@ async def test_list_all_feedback_labels_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_all_feedback_labels_async_from_dict(): - await test_list_all_feedback_labels_async(request_type=dict) - - def test_list_all_feedback_labels_field_headers(): client = ContactCenterInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -27933,8 +28002,8 @@ async def test_list_all_feedback_labels_async_pages(): @pytest.mark.parametrize( "request_type", [ - contact_center_insights.BulkUploadFeedbackLabelsRequest, - dict, + contact_center_insights.BulkUploadFeedbackLabelsRequest(), + {}, ], ) def test_bulk_upload_feedback_labels(request_type, transport: str = "grpc"): @@ -27945,7 +28014,7 @@ def test_bulk_upload_feedback_labels(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -27990,9 +28059,10 @@ def test_bulk_upload_feedback_labels_non_empty_request_with_auto_populated_field client.bulk_upload_feedback_labels(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == contact_center_insights.BulkUploadFeedbackLabelsRequest( + request_msg = contact_center_insights.BulkUploadFeedbackLabelsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_bulk_upload_feedback_labels_use_cached_wrapped_rpc(): @@ -28088,9 +28158,15 @@ async def test_bulk_upload_feedback_labels_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + contact_center_insights.BulkUploadFeedbackLabelsRequest(), + {}, + ], +) async def test_bulk_upload_feedback_labels_async( - transport: str = "grpc_asyncio", - request_type=contact_center_insights.BulkUploadFeedbackLabelsRequest, + request_type, transport: str = "grpc_asyncio" ): client = ContactCenterInsightsAsyncClient( credentials=async_anonymous_credentials(), @@ -28099,7 +28175,7 @@ async def test_bulk_upload_feedback_labels_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( @@ -28121,11 +28197,6 @@ async def test_bulk_upload_feedback_labels_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_bulk_upload_feedback_labels_async_from_dict(): - await test_bulk_upload_feedback_labels_async(request_type=dict) - - def test_bulk_upload_feedback_labels_field_headers(): client = ContactCenterInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -28280,8 +28351,8 @@ async def test_bulk_upload_feedback_labels_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - contact_center_insights.BulkDownloadFeedbackLabelsRequest, - dict, + contact_center_insights.BulkDownloadFeedbackLabelsRequest(), + {}, ], ) def test_bulk_download_feedback_labels(request_type, transport: str = "grpc"): @@ -28292,7 +28363,7 @@ def test_bulk_download_feedback_labels(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -28339,11 +28410,12 @@ def test_bulk_download_feedback_labels_non_empty_request_with_auto_populated_fie client.bulk_download_feedback_labels(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == contact_center_insights.BulkDownloadFeedbackLabelsRequest( + request_msg = contact_center_insights.BulkDownloadFeedbackLabelsRequest( parent="parent_value", filter="filter_value", conversation_filter="conversation_filter_value", ) + assert args[0] == request_msg def test_bulk_download_feedback_labels_use_cached_wrapped_rpc(): @@ -28439,9 +28511,15 @@ async def test_bulk_download_feedback_labels_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + contact_center_insights.BulkDownloadFeedbackLabelsRequest(), + {}, + ], +) async def test_bulk_download_feedback_labels_async( - transport: str = "grpc_asyncio", - request_type=contact_center_insights.BulkDownloadFeedbackLabelsRequest, + request_type, transport: str = "grpc_asyncio" ): client = ContactCenterInsightsAsyncClient( credentials=async_anonymous_credentials(), @@ -28450,7 +28528,7 @@ async def test_bulk_download_feedback_labels_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( @@ -28472,11 +28550,6 @@ async def test_bulk_download_feedback_labels_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_bulk_download_feedback_labels_async_from_dict(): - await test_bulk_download_feedback_labels_async(request_type=dict) - - def test_bulk_download_feedback_labels_field_headers(): client = ContactCenterInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -43063,7 +43136,6 @@ def test_create_conversation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.CreateConversationRequest() - assert args[0] == request_msg @@ -43086,7 +43158,6 @@ def test_upload_conversation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.UploadConversationRequest() - assert args[0] == request_msg @@ -43109,7 +43180,6 @@ def test_update_conversation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.UpdateConversationRequest() - assert args[0] == request_msg @@ -43130,7 +43200,6 @@ def test_get_conversation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.GetConversationRequest() - assert args[0] == request_msg @@ -43153,7 +43222,6 @@ def test_list_conversations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.ListConversationsRequest() - assert args[0] == request_msg @@ -43176,7 +43244,6 @@ def test_delete_conversation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.DeleteConversationRequest() - assert args[0] == request_msg @@ -43197,7 +43264,6 @@ def test_create_analysis_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.CreateAnalysisRequest() - assert args[0] == request_msg @@ -43218,7 +43284,6 @@ def test_get_analysis_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.GetAnalysisRequest() - assert args[0] == request_msg @@ -43239,7 +43304,6 @@ def test_list_analyses_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.ListAnalysesRequest() - assert args[0] == request_msg @@ -43260,7 +43324,6 @@ def test_delete_analysis_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.DeleteAnalysisRequest() - assert args[0] == request_msg @@ -43283,7 +43346,6 @@ def test_bulk_analyze_conversations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.BulkAnalyzeConversationsRequest() - assert args[0] == request_msg @@ -43306,7 +43368,6 @@ def test_bulk_delete_conversations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.BulkDeleteConversationsRequest() - assert args[0] == request_msg @@ -43329,7 +43390,6 @@ def test_ingest_conversations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.IngestConversationsRequest() - assert args[0] == request_msg @@ -43352,7 +43412,6 @@ def test_export_insights_data_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.ExportInsightsDataRequest() - assert args[0] == request_msg @@ -43375,7 +43434,6 @@ def test_create_issue_model_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.CreateIssueModelRequest() - assert args[0] == request_msg @@ -43398,7 +43456,6 @@ def test_update_issue_model_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.UpdateIssueModelRequest() - assert args[0] == request_msg @@ -43419,7 +43476,6 @@ def test_get_issue_model_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.GetIssueModelRequest() - assert args[0] == request_msg @@ -43442,7 +43498,6 @@ def test_list_issue_models_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.ListIssueModelsRequest() - assert args[0] == request_msg @@ -43465,7 +43520,6 @@ def test_delete_issue_model_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.DeleteIssueModelRequest() - assert args[0] == request_msg @@ -43488,7 +43542,6 @@ def test_deploy_issue_model_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.DeployIssueModelRequest() - assert args[0] == request_msg @@ -43511,7 +43564,6 @@ def test_undeploy_issue_model_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.UndeployIssueModelRequest() - assert args[0] == request_msg @@ -43534,7 +43586,6 @@ def test_export_issue_model_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.ExportIssueModelRequest() - assert args[0] == request_msg @@ -43557,7 +43608,6 @@ def test_import_issue_model_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.ImportIssueModelRequest() - assert args[0] == request_msg @@ -43578,7 +43628,6 @@ def test_get_issue_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.GetIssueRequest() - assert args[0] == request_msg @@ -43599,7 +43648,6 @@ def test_list_issues_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.ListIssuesRequest() - assert args[0] == request_msg @@ -43620,7 +43668,6 @@ def test_update_issue_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.UpdateIssueRequest() - assert args[0] == request_msg @@ -43641,7 +43688,6 @@ def test_delete_issue_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.DeleteIssueRequest() - assert args[0] == request_msg @@ -43664,7 +43710,6 @@ def test_calculate_issue_model_stats_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.CalculateIssueModelStatsRequest() - assert args[0] == request_msg @@ -43687,7 +43732,6 @@ def test_create_phrase_matcher_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.CreatePhraseMatcherRequest() - assert args[0] == request_msg @@ -43710,7 +43754,6 @@ def test_get_phrase_matcher_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.GetPhraseMatcherRequest() - assert args[0] == request_msg @@ -43733,7 +43776,6 @@ def test_list_phrase_matchers_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.ListPhraseMatchersRequest() - assert args[0] == request_msg @@ -43756,7 +43798,6 @@ def test_delete_phrase_matcher_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.DeletePhraseMatcherRequest() - assert args[0] == request_msg @@ -43779,7 +43820,6 @@ def test_update_phrase_matcher_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.UpdatePhraseMatcherRequest() - assert args[0] == request_msg @@ -43800,7 +43840,6 @@ def test_calculate_stats_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.CalculateStatsRequest() - assert args[0] == request_msg @@ -43821,7 +43860,6 @@ def test_get_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.GetSettingsRequest() - assert args[0] == request_msg @@ -43842,7 +43880,6 @@ def test_update_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.UpdateSettingsRequest() - assert args[0] == request_msg @@ -43865,7 +43902,6 @@ def test_create_analysis_rule_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.CreateAnalysisRuleRequest() - assert args[0] == request_msg @@ -43888,7 +43924,6 @@ def test_get_analysis_rule_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.GetAnalysisRuleRequest() - assert args[0] == request_msg @@ -43911,7 +43946,6 @@ def test_list_analysis_rules_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.ListAnalysisRulesRequest() - assert args[0] == request_msg @@ -43934,7 +43968,6 @@ def test_update_analysis_rule_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.UpdateAnalysisRuleRequest() - assert args[0] == request_msg @@ -43957,7 +43990,6 @@ def test_delete_analysis_rule_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.DeleteAnalysisRuleRequest() - assert args[0] == request_msg @@ -43980,7 +44012,6 @@ def test_get_encryption_spec_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.GetEncryptionSpecRequest() - assert args[0] == request_msg @@ -44003,7 +44034,6 @@ def test_initialize_encryption_spec_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.InitializeEncryptionSpecRequest() - assert args[0] == request_msg @@ -44024,7 +44054,6 @@ def test_create_view_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.CreateViewRequest() - assert args[0] == request_msg @@ -44045,7 +44074,6 @@ def test_get_view_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.GetViewRequest() - assert args[0] == request_msg @@ -44066,7 +44094,6 @@ def test_list_views_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.ListViewsRequest() - assert args[0] == request_msg @@ -44087,7 +44114,6 @@ def test_update_view_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.UpdateViewRequest() - assert args[0] == request_msg @@ -44108,7 +44134,6 @@ def test_delete_view_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.DeleteViewRequest() - assert args[0] == request_msg @@ -44129,7 +44154,6 @@ def test_query_metrics_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.QueryMetricsRequest() - assert args[0] == request_msg @@ -44152,7 +44176,6 @@ def test_create_qa_question_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.CreateQaQuestionRequest() - assert args[0] == request_msg @@ -44173,7 +44196,6 @@ def test_get_qa_question_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.GetQaQuestionRequest() - assert args[0] == request_msg @@ -44196,7 +44218,6 @@ def test_update_qa_question_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.UpdateQaQuestionRequest() - assert args[0] == request_msg @@ -44219,7 +44240,6 @@ def test_delete_qa_question_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.DeleteQaQuestionRequest() - assert args[0] == request_msg @@ -44242,7 +44262,6 @@ def test_list_qa_questions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.ListQaQuestionsRequest() - assert args[0] == request_msg @@ -44265,7 +44284,6 @@ def test_create_qa_scorecard_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.CreateQaScorecardRequest() - assert args[0] == request_msg @@ -44286,7 +44304,6 @@ def test_get_qa_scorecard_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.GetQaScorecardRequest() - assert args[0] == request_msg @@ -44309,7 +44326,6 @@ def test_update_qa_scorecard_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.UpdateQaScorecardRequest() - assert args[0] == request_msg @@ -44332,7 +44348,6 @@ def test_delete_qa_scorecard_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.DeleteQaScorecardRequest() - assert args[0] == request_msg @@ -44355,7 +44370,6 @@ def test_list_qa_scorecards_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.ListQaScorecardsRequest() - assert args[0] == request_msg @@ -44378,7 +44392,6 @@ def test_create_qa_scorecard_revision_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.CreateQaScorecardRevisionRequest() - assert args[0] == request_msg @@ -44401,7 +44414,6 @@ def test_get_qa_scorecard_revision_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.GetQaScorecardRevisionRequest() - assert args[0] == request_msg @@ -44424,7 +44436,6 @@ def test_tune_qa_scorecard_revision_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.TuneQaScorecardRevisionRequest() - assert args[0] == request_msg @@ -44447,7 +44458,6 @@ def test_deploy_qa_scorecard_revision_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.DeployQaScorecardRevisionRequest() - assert args[0] == request_msg @@ -44470,7 +44480,6 @@ def test_undeploy_qa_scorecard_revision_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.UndeployQaScorecardRevisionRequest() - assert args[0] == request_msg @@ -44493,7 +44502,6 @@ def test_delete_qa_scorecard_revision_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.DeleteQaScorecardRevisionRequest() - assert args[0] == request_msg @@ -44516,7 +44524,6 @@ def test_list_qa_scorecard_revisions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.ListQaScorecardRevisionsRequest() - assert args[0] == request_msg @@ -44539,7 +44546,6 @@ def test_create_feedback_label_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.CreateFeedbackLabelRequest() - assert args[0] == request_msg @@ -44562,7 +44568,6 @@ def test_list_feedback_labels_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.ListFeedbackLabelsRequest() - assert args[0] == request_msg @@ -44585,7 +44590,6 @@ def test_get_feedback_label_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.GetFeedbackLabelRequest() - assert args[0] == request_msg @@ -44608,7 +44612,6 @@ def test_update_feedback_label_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.UpdateFeedbackLabelRequest() - assert args[0] == request_msg @@ -44631,7 +44634,6 @@ def test_delete_feedback_label_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.DeleteFeedbackLabelRequest() - assert args[0] == request_msg @@ -44654,7 +44656,6 @@ def test_list_all_feedback_labels_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.ListAllFeedbackLabelsRequest() - assert args[0] == request_msg @@ -44677,7 +44678,6 @@ def test_bulk_upload_feedback_labels_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.BulkUploadFeedbackLabelsRequest() - assert args[0] == request_msg @@ -44700,7 +44700,6 @@ def test_bulk_download_feedback_labels_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.BulkDownloadFeedbackLabelsRequest() - assert args[0] == request_msg @@ -44749,7 +44748,6 @@ async def test_create_conversation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.CreateConversationRequest() - assert args[0] == request_msg @@ -44776,7 +44774,6 @@ async def test_upload_conversation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.UploadConversationRequest() - assert args[0] == request_msg @@ -44811,7 +44808,6 @@ async def test_update_conversation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.UpdateConversationRequest() - assert args[0] == request_msg @@ -44844,7 +44840,6 @@ async def test_get_conversation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.GetConversationRequest() - assert args[0] == request_msg @@ -44873,7 +44868,6 @@ async def test_list_conversations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.ListConversationsRequest() - assert args[0] == request_msg @@ -44898,7 +44892,6 @@ async def test_delete_conversation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.DeleteConversationRequest() - assert args[0] == request_msg @@ -44923,7 +44916,6 @@ async def test_create_analysis_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.CreateAnalysisRequest() - assert args[0] == request_msg @@ -44950,7 +44942,6 @@ async def test_get_analysis_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.GetAnalysisRequest() - assert args[0] == request_msg @@ -44977,7 +44968,6 @@ async def test_list_analyses_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.ListAnalysesRequest() - assert args[0] == request_msg @@ -45000,7 +44990,6 @@ async def test_delete_analysis_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.DeleteAnalysisRequest() - assert args[0] == request_msg @@ -45027,7 +45016,6 @@ async def test_bulk_analyze_conversations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.BulkAnalyzeConversationsRequest() - assert args[0] == request_msg @@ -45054,7 +45042,6 @@ async def test_bulk_delete_conversations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.BulkDeleteConversationsRequest() - assert args[0] == request_msg @@ -45081,7 +45068,6 @@ async def test_ingest_conversations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.IngestConversationsRequest() - assert args[0] == request_msg @@ -45108,7 +45094,6 @@ async def test_export_insights_data_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.ExportInsightsDataRequest() - assert args[0] == request_msg @@ -45135,7 +45120,6 @@ async def test_create_issue_model_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.CreateIssueModelRequest() - assert args[0] == request_msg @@ -45169,7 +45153,6 @@ async def test_update_issue_model_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.UpdateIssueModelRequest() - assert args[0] == request_msg @@ -45201,7 +45184,6 @@ async def test_get_issue_model_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.GetIssueModelRequest() - assert args[0] == request_msg @@ -45228,7 +45210,6 @@ async def test_list_issue_models_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.ListIssueModelsRequest() - assert args[0] == request_msg @@ -45255,7 +45236,6 @@ async def test_delete_issue_model_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.DeleteIssueModelRequest() - assert args[0] == request_msg @@ -45282,7 +45262,6 @@ async def test_deploy_issue_model_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.DeployIssueModelRequest() - assert args[0] == request_msg @@ -45309,7 +45288,6 @@ async def test_undeploy_issue_model_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.UndeployIssueModelRequest() - assert args[0] == request_msg @@ -45336,7 +45314,6 @@ async def test_export_issue_model_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.ExportIssueModelRequest() - assert args[0] == request_msg @@ -45363,7 +45340,6 @@ async def test_import_issue_model_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.ImportIssueModelRequest() - assert args[0] == request_msg @@ -45393,7 +45369,6 @@ async def test_get_issue_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.GetIssueRequest() - assert args[0] == request_msg @@ -45418,7 +45393,6 @@ async def test_list_issues_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.ListIssuesRequest() - assert args[0] == request_msg @@ -45448,7 +45422,6 @@ async def test_update_issue_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.UpdateIssueRequest() - assert args[0] == request_msg @@ -45471,7 +45444,6 @@ async def test_delete_issue_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.DeleteIssueRequest() - assert args[0] == request_msg @@ -45498,7 +45470,6 @@ async def test_calculate_issue_model_stats_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.CalculateIssueModelStatsRequest() - assert args[0] == request_msg @@ -45533,7 +45504,6 @@ async def test_create_phrase_matcher_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.CreatePhraseMatcherRequest() - assert args[0] == request_msg @@ -45568,7 +45538,6 @@ async def test_get_phrase_matcher_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.GetPhraseMatcherRequest() - assert args[0] == request_msg @@ -45597,7 +45566,6 @@ async def test_list_phrase_matchers_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.ListPhraseMatchersRequest() - assert args[0] == request_msg @@ -45622,7 +45590,6 @@ async def test_delete_phrase_matcher_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.DeletePhraseMatcherRequest() - assert args[0] == request_msg @@ -45657,7 +45624,6 @@ async def test_update_phrase_matcher_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.UpdatePhraseMatcherRequest() - assert args[0] == request_msg @@ -45685,7 +45651,6 @@ async def test_calculate_stats_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.CalculateStatsRequest() - assert args[0] == request_msg @@ -45713,7 +45678,6 @@ async def test_get_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.GetSettingsRequest() - assert args[0] == request_msg @@ -45741,7 +45705,6 @@ async def test_update_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.UpdateSettingsRequest() - assert args[0] == request_msg @@ -45774,7 +45737,6 @@ async def test_create_analysis_rule_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.CreateAnalysisRuleRequest() - assert args[0] == request_msg @@ -45807,7 +45769,6 @@ async def test_get_analysis_rule_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.GetAnalysisRuleRequest() - assert args[0] == request_msg @@ -45836,7 +45797,6 @@ async def test_list_analysis_rules_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.ListAnalysisRulesRequest() - assert args[0] == request_msg @@ -45869,7 +45829,6 @@ async def test_update_analysis_rule_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.UpdateAnalysisRuleRequest() - assert args[0] == request_msg @@ -45894,7 +45853,6 @@ async def test_delete_analysis_rule_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.DeleteAnalysisRuleRequest() - assert args[0] == request_msg @@ -45924,7 +45882,6 @@ async def test_get_encryption_spec_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.GetEncryptionSpecRequest() - assert args[0] == request_msg @@ -45951,7 +45908,6 @@ async def test_initialize_encryption_spec_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.InitializeEncryptionSpecRequest() - assert args[0] == request_msg @@ -45980,7 +45936,6 @@ async def test_create_view_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.CreateViewRequest() - assert args[0] == request_msg @@ -46009,7 +45964,6 @@ async def test_get_view_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.GetViewRequest() - assert args[0] == request_msg @@ -46036,7 +45990,6 @@ async def test_list_views_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.ListViewsRequest() - assert args[0] == request_msg @@ -46065,7 +46018,6 @@ async def test_update_view_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.UpdateViewRequest() - assert args[0] == request_msg @@ -46088,7 +46040,6 @@ async def test_delete_view_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.DeleteViewRequest() - assert args[0] == request_msg @@ -46113,7 +46064,6 @@ async def test_query_metrics_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.QueryMetricsRequest() - assert args[0] == request_msg @@ -46147,7 +46097,6 @@ async def test_create_qa_question_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.CreateQaQuestionRequest() - assert args[0] == request_msg @@ -46179,7 +46128,6 @@ async def test_get_qa_question_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.GetQaQuestionRequest() - assert args[0] == request_msg @@ -46213,7 +46161,6 @@ async def test_update_qa_question_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.UpdateQaQuestionRequest() - assert args[0] == request_msg @@ -46238,7 +46185,6 @@ async def test_delete_qa_question_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.DeleteQaQuestionRequest() - assert args[0] == request_msg @@ -46267,7 +46213,6 @@ async def test_list_qa_questions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.ListQaQuestionsRequest() - assert args[0] == request_msg @@ -46298,7 +46243,6 @@ async def test_create_qa_scorecard_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.CreateQaScorecardRequest() - assert args[0] == request_msg @@ -46327,7 +46271,6 @@ async def test_get_qa_scorecard_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.GetQaScorecardRequest() - assert args[0] == request_msg @@ -46358,7 +46301,6 @@ async def test_update_qa_scorecard_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.UpdateQaScorecardRequest() - assert args[0] == request_msg @@ -46383,7 +46325,6 @@ async def test_delete_qa_scorecard_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.DeleteQaScorecardRequest() - assert args[0] == request_msg @@ -46412,7 +46353,6 @@ async def test_list_qa_scorecards_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.ListQaScorecardsRequest() - assert args[0] == request_msg @@ -46443,7 +46383,6 @@ async def test_create_qa_scorecard_revision_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.CreateQaScorecardRevisionRequest() - assert args[0] == request_msg @@ -46474,7 +46413,6 @@ async def test_get_qa_scorecard_revision_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.GetQaScorecardRevisionRequest() - assert args[0] == request_msg @@ -46501,7 +46439,6 @@ async def test_tune_qa_scorecard_revision_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.TuneQaScorecardRevisionRequest() - assert args[0] == request_msg @@ -46532,7 +46469,6 @@ async def test_deploy_qa_scorecard_revision_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.DeployQaScorecardRevisionRequest() - assert args[0] == request_msg @@ -46563,7 +46499,6 @@ async def test_undeploy_qa_scorecard_revision_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.UndeployQaScorecardRevisionRequest() - assert args[0] == request_msg @@ -46588,7 +46523,6 @@ async def test_delete_qa_scorecard_revision_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.DeleteQaScorecardRevisionRequest() - assert args[0] == request_msg @@ -46617,7 +46551,6 @@ async def test_list_qa_scorecard_revisions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.ListQaScorecardRevisionsRequest() - assert args[0] == request_msg @@ -46647,7 +46580,6 @@ async def test_create_feedback_label_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.CreateFeedbackLabelRequest() - assert args[0] == request_msg @@ -46676,7 +46608,6 @@ async def test_list_feedback_labels_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.ListFeedbackLabelsRequest() - assert args[0] == request_msg @@ -46706,7 +46637,6 @@ async def test_get_feedback_label_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.GetFeedbackLabelRequest() - assert args[0] == request_msg @@ -46736,7 +46666,6 @@ async def test_update_feedback_label_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.UpdateFeedbackLabelRequest() - assert args[0] == request_msg @@ -46761,7 +46690,6 @@ async def test_delete_feedback_label_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.DeleteFeedbackLabelRequest() - assert args[0] == request_msg @@ -46790,7 +46718,6 @@ async def test_list_all_feedback_labels_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.ListAllFeedbackLabelsRequest() - assert args[0] == request_msg @@ -46817,7 +46744,6 @@ async def test_bulk_upload_feedback_labels_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.BulkUploadFeedbackLabelsRequest() - assert args[0] == request_msg @@ -46844,7 +46770,6 @@ async def test_bulk_download_feedback_labels_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.BulkDownloadFeedbackLabelsRequest() - assert args[0] == request_msg @@ -59303,7 +59228,6 @@ def test_create_conversation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.CreateConversationRequest() - assert args[0] == request_msg @@ -59325,7 +59249,6 @@ def test_upload_conversation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.UploadConversationRequest() - assert args[0] == request_msg @@ -59347,7 +59270,6 @@ def test_update_conversation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.UpdateConversationRequest() - assert args[0] == request_msg @@ -59367,7 +59289,6 @@ def test_get_conversation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.GetConversationRequest() - assert args[0] == request_msg @@ -59389,7 +59310,6 @@ def test_list_conversations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.ListConversationsRequest() - assert args[0] == request_msg @@ -59411,7 +59331,6 @@ def test_delete_conversation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.DeleteConversationRequest() - assert args[0] == request_msg @@ -59431,7 +59350,6 @@ def test_create_analysis_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.CreateAnalysisRequest() - assert args[0] == request_msg @@ -59451,7 +59369,6 @@ def test_get_analysis_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.GetAnalysisRequest() - assert args[0] == request_msg @@ -59471,7 +59388,6 @@ def test_list_analyses_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.ListAnalysesRequest() - assert args[0] == request_msg @@ -59491,7 +59407,6 @@ def test_delete_analysis_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.DeleteAnalysisRequest() - assert args[0] == request_msg @@ -59513,7 +59428,6 @@ def test_bulk_analyze_conversations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.BulkAnalyzeConversationsRequest() - assert args[0] == request_msg @@ -59535,7 +59449,6 @@ def test_bulk_delete_conversations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.BulkDeleteConversationsRequest() - assert args[0] == request_msg @@ -59557,7 +59470,6 @@ def test_ingest_conversations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.IngestConversationsRequest() - assert args[0] == request_msg @@ -59579,7 +59491,6 @@ def test_export_insights_data_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.ExportInsightsDataRequest() - assert args[0] == request_msg @@ -59601,7 +59512,6 @@ def test_create_issue_model_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.CreateIssueModelRequest() - assert args[0] == request_msg @@ -59623,7 +59533,6 @@ def test_update_issue_model_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.UpdateIssueModelRequest() - assert args[0] == request_msg @@ -59643,7 +59552,6 @@ def test_get_issue_model_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.GetIssueModelRequest() - assert args[0] == request_msg @@ -59665,7 +59573,6 @@ def test_list_issue_models_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.ListIssueModelsRequest() - assert args[0] == request_msg @@ -59687,7 +59594,6 @@ def test_delete_issue_model_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.DeleteIssueModelRequest() - assert args[0] == request_msg @@ -59709,7 +59615,6 @@ def test_deploy_issue_model_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.DeployIssueModelRequest() - assert args[0] == request_msg @@ -59731,7 +59636,6 @@ def test_undeploy_issue_model_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.UndeployIssueModelRequest() - assert args[0] == request_msg @@ -59753,7 +59657,6 @@ def test_export_issue_model_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.ExportIssueModelRequest() - assert args[0] == request_msg @@ -59775,7 +59678,6 @@ def test_import_issue_model_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.ImportIssueModelRequest() - assert args[0] == request_msg @@ -59795,7 +59697,6 @@ def test_get_issue_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.GetIssueRequest() - assert args[0] == request_msg @@ -59815,7 +59716,6 @@ def test_list_issues_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.ListIssuesRequest() - assert args[0] == request_msg @@ -59835,7 +59735,6 @@ def test_update_issue_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.UpdateIssueRequest() - assert args[0] == request_msg @@ -59855,7 +59754,6 @@ def test_delete_issue_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.DeleteIssueRequest() - assert args[0] == request_msg @@ -59877,7 +59775,6 @@ def test_calculate_issue_model_stats_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.CalculateIssueModelStatsRequest() - assert args[0] == request_msg @@ -59899,7 +59796,6 @@ def test_create_phrase_matcher_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.CreatePhraseMatcherRequest() - assert args[0] == request_msg @@ -59921,7 +59817,6 @@ def test_get_phrase_matcher_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.GetPhraseMatcherRequest() - assert args[0] == request_msg @@ -59943,7 +59838,6 @@ def test_list_phrase_matchers_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.ListPhraseMatchersRequest() - assert args[0] == request_msg @@ -59965,7 +59859,6 @@ def test_delete_phrase_matcher_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.DeletePhraseMatcherRequest() - assert args[0] == request_msg @@ -59987,7 +59880,6 @@ def test_update_phrase_matcher_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.UpdatePhraseMatcherRequest() - assert args[0] == request_msg @@ -60007,7 +59899,6 @@ def test_calculate_stats_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.CalculateStatsRequest() - assert args[0] == request_msg @@ -60027,7 +59918,6 @@ def test_get_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.GetSettingsRequest() - assert args[0] == request_msg @@ -60047,7 +59937,6 @@ def test_update_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.UpdateSettingsRequest() - assert args[0] == request_msg @@ -60069,7 +59958,6 @@ def test_create_analysis_rule_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.CreateAnalysisRuleRequest() - assert args[0] == request_msg @@ -60091,7 +59979,6 @@ def test_get_analysis_rule_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.GetAnalysisRuleRequest() - assert args[0] == request_msg @@ -60113,7 +60000,6 @@ def test_list_analysis_rules_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.ListAnalysisRulesRequest() - assert args[0] == request_msg @@ -60135,7 +60021,6 @@ def test_update_analysis_rule_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.UpdateAnalysisRuleRequest() - assert args[0] == request_msg @@ -60157,7 +60042,6 @@ def test_delete_analysis_rule_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.DeleteAnalysisRuleRequest() - assert args[0] == request_msg @@ -60179,7 +60063,6 @@ def test_get_encryption_spec_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.GetEncryptionSpecRequest() - assert args[0] == request_msg @@ -60201,7 +60084,6 @@ def test_initialize_encryption_spec_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.InitializeEncryptionSpecRequest() - assert args[0] == request_msg @@ -60221,7 +60103,6 @@ def test_create_view_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.CreateViewRequest() - assert args[0] == request_msg @@ -60241,7 +60122,6 @@ def test_get_view_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.GetViewRequest() - assert args[0] == request_msg @@ -60261,7 +60141,6 @@ def test_list_views_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.ListViewsRequest() - assert args[0] == request_msg @@ -60281,7 +60160,6 @@ def test_update_view_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.UpdateViewRequest() - assert args[0] == request_msg @@ -60301,7 +60179,6 @@ def test_delete_view_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.DeleteViewRequest() - assert args[0] == request_msg @@ -60321,7 +60198,6 @@ def test_query_metrics_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.QueryMetricsRequest() - assert args[0] == request_msg @@ -60343,7 +60219,6 @@ def test_create_qa_question_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.CreateQaQuestionRequest() - assert args[0] == request_msg @@ -60363,7 +60238,6 @@ def test_get_qa_question_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.GetQaQuestionRequest() - assert args[0] == request_msg @@ -60385,7 +60259,6 @@ def test_update_qa_question_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.UpdateQaQuestionRequest() - assert args[0] == request_msg @@ -60407,7 +60280,6 @@ def test_delete_qa_question_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.DeleteQaQuestionRequest() - assert args[0] == request_msg @@ -60429,7 +60301,6 @@ def test_list_qa_questions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.ListQaQuestionsRequest() - assert args[0] == request_msg @@ -60451,7 +60322,6 @@ def test_create_qa_scorecard_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.CreateQaScorecardRequest() - assert args[0] == request_msg @@ -60471,7 +60341,6 @@ def test_get_qa_scorecard_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.GetQaScorecardRequest() - assert args[0] == request_msg @@ -60493,7 +60362,6 @@ def test_update_qa_scorecard_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.UpdateQaScorecardRequest() - assert args[0] == request_msg @@ -60515,7 +60383,6 @@ def test_delete_qa_scorecard_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.DeleteQaScorecardRequest() - assert args[0] == request_msg @@ -60537,7 +60404,6 @@ def test_list_qa_scorecards_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.ListQaScorecardsRequest() - assert args[0] == request_msg @@ -60559,7 +60425,6 @@ def test_create_qa_scorecard_revision_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.CreateQaScorecardRevisionRequest() - assert args[0] == request_msg @@ -60581,7 +60446,6 @@ def test_get_qa_scorecard_revision_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.GetQaScorecardRevisionRequest() - assert args[0] == request_msg @@ -60603,7 +60467,6 @@ def test_tune_qa_scorecard_revision_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.TuneQaScorecardRevisionRequest() - assert args[0] == request_msg @@ -60625,7 +60488,6 @@ def test_deploy_qa_scorecard_revision_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.DeployQaScorecardRevisionRequest() - assert args[0] == request_msg @@ -60647,7 +60509,6 @@ def test_undeploy_qa_scorecard_revision_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.UndeployQaScorecardRevisionRequest() - assert args[0] == request_msg @@ -60669,7 +60530,6 @@ def test_delete_qa_scorecard_revision_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.DeleteQaScorecardRevisionRequest() - assert args[0] == request_msg @@ -60691,7 +60551,6 @@ def test_list_qa_scorecard_revisions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.ListQaScorecardRevisionsRequest() - assert args[0] == request_msg @@ -60713,7 +60572,6 @@ def test_create_feedback_label_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.CreateFeedbackLabelRequest() - assert args[0] == request_msg @@ -60735,7 +60593,6 @@ def test_list_feedback_labels_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.ListFeedbackLabelsRequest() - assert args[0] == request_msg @@ -60757,7 +60614,6 @@ def test_get_feedback_label_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.GetFeedbackLabelRequest() - assert args[0] == request_msg @@ -60779,7 +60635,6 @@ def test_update_feedback_label_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.UpdateFeedbackLabelRequest() - assert args[0] == request_msg @@ -60801,7 +60656,6 @@ def test_delete_feedback_label_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.DeleteFeedbackLabelRequest() - assert args[0] == request_msg @@ -60823,7 +60677,6 @@ def test_list_all_feedback_labels_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.ListAllFeedbackLabelsRequest() - assert args[0] == request_msg @@ -60845,7 +60698,6 @@ def test_bulk_upload_feedback_labels_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.BulkUploadFeedbackLabelsRequest() - assert args[0] == request_msg @@ -60867,7 +60719,6 @@ def test_bulk_download_feedback_labels_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = contact_center_insights.BulkDownloadFeedbackLabelsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-container/noxfile.py b/packages/google-cloud-container/noxfile.py index 2de3fcedc444..c681b455965e 100644 --- a/packages/google-cloud-container/noxfile.py +++ b/packages/google-cloud-container/noxfile.py @@ -47,7 +47,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-container" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-container/setup.py b/packages/google-cloud-container/setup.py index d9a1fc794380..afad62d98b9c 100644 --- a/packages/google-cloud-container/setup.py +++ b/packages/google-cloud-container/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/google-cloud-container/testing/constraints-3.10.txt b/packages/google-cloud-container/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-container/testing/constraints-3.10.txt +++ b/packages/google-cloud-container/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-container/tests/unit/gapic/container_v1/test_cluster_manager.py b/packages/google-cloud-container/tests/unit/gapic/container_v1/test_cluster_manager.py index 78673b98a580..d0952b16b3e1 100644 --- a/packages/google-cloud-container/tests/unit/gapic/container_v1/test_cluster_manager.py +++ b/packages/google-cloud-container/tests/unit/gapic/container_v1/test_cluster_manager.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 @@ -114,6 +115,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" @@ -1321,8 +1337,8 @@ def test_cluster_manager_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - cluster_service.ListClustersRequest, - dict, + cluster_service.ListClustersRequest(), + {}, ], ) def test_list_clusters(request_type, transport: str = "grpc"): @@ -1333,7 +1349,7 @@ def test_list_clusters(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_clusters), "__call__") as call: @@ -1379,11 +1395,12 @@ def test_list_clusters_non_empty_request_with_auto_populated_field(): client.list_clusters(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.ListClustersRequest( + request_msg = cluster_service.ListClustersRequest( project_id="project_id_value", zone="zone_value", parent="parent_value", ) + assert args[0] == request_msg def test_list_clusters_use_cached_wrapped_rpc(): @@ -1464,9 +1481,14 @@ async def test_list_clusters_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_clusters_async( - transport: str = "grpc_asyncio", request_type=cluster_service.ListClustersRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.ListClustersRequest(), + {}, + ], +) +async def test_list_clusters_async(request_type, transport: str = "grpc_asyncio"): client = ClusterManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1474,7 +1496,7 @@ async def test_list_clusters_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_clusters), "__call__") as call: @@ -1497,11 +1519,6 @@ async def test_list_clusters_async( assert response.missing_zones == ["missing_zones_value"] -@pytest.mark.asyncio -async def test_list_clusters_async_from_dict(): - await test_list_clusters_async(request_type=dict) - - def test_list_clusters_field_headers(): client = ClusterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1668,8 +1685,8 @@ async def test_list_clusters_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cluster_service.GetClusterRequest, - dict, + cluster_service.GetClusterRequest(), + {}, ], ) def test_get_cluster(request_type, transport: str = "grpc"): @@ -1680,7 +1697,7 @@ def test_get_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_cluster), "__call__") as call: @@ -1791,12 +1808,13 @@ def test_get_cluster_non_empty_request_with_auto_populated_field(): client.get_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.GetClusterRequest( + request_msg = cluster_service.GetClusterRequest( project_id="project_id_value", zone="zone_value", cluster_id="cluster_id_value", name="name_value", ) + assert args[0] == request_msg def test_get_cluster_use_cached_wrapped_rpc(): @@ -1877,9 +1895,14 @@ async def test_get_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_cluster_async( - transport: str = "grpc_asyncio", request_type=cluster_service.GetClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.GetClusterRequest(), + {}, + ], +) +async def test_get_cluster_async(request_type, transport: str = "grpc_asyncio"): client = ClusterManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1887,7 +1910,7 @@ async def test_get_cluster_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_cluster), "__call__") as call: @@ -1974,11 +1997,6 @@ async def test_get_cluster_async( assert response.satisfies_pzi is True -@pytest.mark.asyncio -async def test_get_cluster_async_from_dict(): - await test_get_cluster_async(request_type=dict) - - def test_get_cluster_field_headers(): client = ClusterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2155,8 +2173,8 @@ async def test_get_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cluster_service.CreateClusterRequest, - dict, + cluster_service.CreateClusterRequest(), + {}, ], ) def test_create_cluster(request_type, transport: str = "grpc"): @@ -2167,7 +2185,7 @@ def test_create_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_cluster), "__call__") as call: @@ -2233,11 +2251,12 @@ def test_create_cluster_non_empty_request_with_auto_populated_field(): client.create_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.CreateClusterRequest( + request_msg = cluster_service.CreateClusterRequest( project_id="project_id_value", zone="zone_value", parent="parent_value", ) + assert args[0] == request_msg def test_create_cluster_use_cached_wrapped_rpc(): @@ -2318,9 +2337,14 @@ async def test_create_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_cluster_async( - transport: str = "grpc_asyncio", request_type=cluster_service.CreateClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.CreateClusterRequest(), + {}, + ], +) +async def test_create_cluster_async(request_type, transport: str = "grpc_asyncio"): client = ClusterManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2328,7 +2352,7 @@ async def test_create_cluster_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_cluster), "__call__") as call: @@ -2371,11 +2395,6 @@ async def test_create_cluster_async( assert response.end_time == "end_time_value" -@pytest.mark.asyncio -async def test_create_cluster_async_from_dict(): - await test_create_cluster_async(request_type=dict) - - def test_create_cluster_field_headers(): client = ClusterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2552,8 +2571,8 @@ async def test_create_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cluster_service.UpdateClusterRequest, - dict, + cluster_service.UpdateClusterRequest(), + {}, ], ) def test_update_cluster(request_type, transport: str = "grpc"): @@ -2564,7 +2583,7 @@ def test_update_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_cluster), "__call__") as call: @@ -2631,12 +2650,13 @@ def test_update_cluster_non_empty_request_with_auto_populated_field(): client.update_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.UpdateClusterRequest( + request_msg = cluster_service.UpdateClusterRequest( project_id="project_id_value", zone="zone_value", cluster_id="cluster_id_value", name="name_value", ) + assert args[0] == request_msg def test_update_cluster_use_cached_wrapped_rpc(): @@ -2717,9 +2737,14 @@ async def test_update_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_cluster_async( - transport: str = "grpc_asyncio", request_type=cluster_service.UpdateClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.UpdateClusterRequest(), + {}, + ], +) +async def test_update_cluster_async(request_type, transport: str = "grpc_asyncio"): client = ClusterManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2727,7 +2752,7 @@ async def test_update_cluster_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_cluster), "__call__") as call: @@ -2770,11 +2795,6 @@ async def test_update_cluster_async( assert response.end_time == "end_time_value" -@pytest.mark.asyncio -async def test_update_cluster_async_from_dict(): - await test_update_cluster_async(request_type=dict) - - def test_update_cluster_field_headers(): client = ClusterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2973,8 +2993,8 @@ async def test_update_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cluster_service.UpdateNodePoolRequest, - dict, + cluster_service.UpdateNodePoolRequest(), + {}, ], ) def test_update_node_pool(request_type, transport: str = "grpc"): @@ -2985,7 +3005,7 @@ def test_update_node_pool(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_node_pool), "__call__") as call: @@ -3058,7 +3078,7 @@ def test_update_node_pool_non_empty_request_with_auto_populated_field(): client.update_node_pool(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.UpdateNodePoolRequest( + request_msg = cluster_service.UpdateNodePoolRequest( project_id="project_id_value", zone="zone_value", cluster_id="cluster_id_value", @@ -3070,6 +3090,7 @@ def test_update_node_pool_non_empty_request_with_auto_populated_field(): machine_type="machine_type_value", disk_type="disk_type_value", ) + assert args[0] == request_msg def test_update_node_pool_use_cached_wrapped_rpc(): @@ -3152,9 +3173,14 @@ async def test_update_node_pool_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_node_pool_async( - transport: str = "grpc_asyncio", request_type=cluster_service.UpdateNodePoolRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.UpdateNodePoolRequest(), + {}, + ], +) +async def test_update_node_pool_async(request_type, transport: str = "grpc_asyncio"): client = ClusterManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3162,7 +3188,7 @@ async def test_update_node_pool_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_node_pool), "__call__") as call: @@ -3205,11 +3231,6 @@ async def test_update_node_pool_async( assert response.end_time == "end_time_value" -@pytest.mark.asyncio -async def test_update_node_pool_async_from_dict(): - await test_update_node_pool_async(request_type=dict) - - def test_update_node_pool_field_headers(): client = ClusterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3274,8 +3295,8 @@ async def test_update_node_pool_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - cluster_service.SetNodePoolAutoscalingRequest, - dict, + cluster_service.SetNodePoolAutoscalingRequest(), + {}, ], ) def test_set_node_pool_autoscaling(request_type, transport: str = "grpc"): @@ -3286,7 +3307,7 @@ def test_set_node_pool_autoscaling(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3358,13 +3379,14 @@ def test_set_node_pool_autoscaling_non_empty_request_with_auto_populated_field() client.set_node_pool_autoscaling(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetNodePoolAutoscalingRequest( + request_msg = cluster_service.SetNodePoolAutoscalingRequest( project_id="project_id_value", zone="zone_value", cluster_id="cluster_id_value", node_pool_id="node_pool_id_value", name="name_value", ) + assert args[0] == request_msg def test_set_node_pool_autoscaling_use_cached_wrapped_rpc(): @@ -3450,9 +3472,15 @@ async def test_set_node_pool_autoscaling_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.SetNodePoolAutoscalingRequest(), + {}, + ], +) async def test_set_node_pool_autoscaling_async( - transport: str = "grpc_asyncio", - request_type=cluster_service.SetNodePoolAutoscalingRequest, + request_type, transport: str = "grpc_asyncio" ): client = ClusterManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -3461,7 +3489,7 @@ async def test_set_node_pool_autoscaling_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( @@ -3506,11 +3534,6 @@ async def test_set_node_pool_autoscaling_async( assert response.end_time == "end_time_value" -@pytest.mark.asyncio -async def test_set_node_pool_autoscaling_async_from_dict(): - await test_set_node_pool_autoscaling_async(request_type=dict) - - def test_set_node_pool_autoscaling_field_headers(): client = ClusterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3579,8 +3602,8 @@ async def test_set_node_pool_autoscaling_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - cluster_service.SetLoggingServiceRequest, - dict, + cluster_service.SetLoggingServiceRequest(), + {}, ], ) def test_set_logging_service(request_type, transport: str = "grpc"): @@ -3591,7 +3614,7 @@ def test_set_logging_service(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3663,13 +3686,14 @@ def test_set_logging_service_non_empty_request_with_auto_populated_field(): client.set_logging_service(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetLoggingServiceRequest( + request_msg = cluster_service.SetLoggingServiceRequest( project_id="project_id_value", zone="zone_value", cluster_id="cluster_id_value", logging_service="logging_service_value", name="name_value", ) + assert args[0] == request_msg def test_set_logging_service_use_cached_wrapped_rpc(): @@ -3754,10 +3778,14 @@ async def test_set_logging_service_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_logging_service_async( - transport: str = "grpc_asyncio", - request_type=cluster_service.SetLoggingServiceRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.SetLoggingServiceRequest(), + {}, + ], +) +async def test_set_logging_service_async(request_type, transport: str = "grpc_asyncio"): client = ClusterManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3765,7 +3793,7 @@ async def test_set_logging_service_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( @@ -3810,11 +3838,6 @@ async def test_set_logging_service_async( assert response.end_time == "end_time_value" -@pytest.mark.asyncio -async def test_set_logging_service_async_from_dict(): - await test_set_logging_service_async(request_type=dict) - - def test_set_logging_service_field_headers(): client = ClusterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4009,8 +4032,8 @@ async def test_set_logging_service_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cluster_service.SetMonitoringServiceRequest, - dict, + cluster_service.SetMonitoringServiceRequest(), + {}, ], ) def test_set_monitoring_service(request_type, transport: str = "grpc"): @@ -4021,7 +4044,7 @@ def test_set_monitoring_service(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4093,13 +4116,14 @@ def test_set_monitoring_service_non_empty_request_with_auto_populated_field(): client.set_monitoring_service(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetMonitoringServiceRequest( + request_msg = cluster_service.SetMonitoringServiceRequest( project_id="project_id_value", zone="zone_value", cluster_id="cluster_id_value", monitoring_service="monitoring_service_value", name="name_value", ) + assert args[0] == request_msg def test_set_monitoring_service_use_cached_wrapped_rpc(): @@ -4185,9 +4209,15 @@ async def test_set_monitoring_service_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.SetMonitoringServiceRequest(), + {}, + ], +) async def test_set_monitoring_service_async( - transport: str = "grpc_asyncio", - request_type=cluster_service.SetMonitoringServiceRequest, + request_type, transport: str = "grpc_asyncio" ): client = ClusterManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -4196,7 +4226,7 @@ async def test_set_monitoring_service_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( @@ -4241,11 +4271,6 @@ async def test_set_monitoring_service_async( assert response.end_time == "end_time_value" -@pytest.mark.asyncio -async def test_set_monitoring_service_async_from_dict(): - await test_set_monitoring_service_async(request_type=dict) - - def test_set_monitoring_service_field_headers(): client = ClusterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4440,8 +4465,8 @@ async def test_set_monitoring_service_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cluster_service.SetAddonsConfigRequest, - dict, + cluster_service.SetAddonsConfigRequest(), + {}, ], ) def test_set_addons_config(request_type, transport: str = "grpc"): @@ -4452,7 +4477,7 @@ def test_set_addons_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( @@ -4523,12 +4548,13 @@ def test_set_addons_config_non_empty_request_with_auto_populated_field(): client.set_addons_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetAddonsConfigRequest( + request_msg = cluster_service.SetAddonsConfigRequest( project_id="project_id_value", zone="zone_value", cluster_id="cluster_id_value", name="name_value", ) + assert args[0] == request_msg def test_set_addons_config_use_cached_wrapped_rpc(): @@ -4611,9 +4637,14 @@ async def test_set_addons_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_addons_config_async( - transport: str = "grpc_asyncio", request_type=cluster_service.SetAddonsConfigRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.SetAddonsConfigRequest(), + {}, + ], +) +async def test_set_addons_config_async(request_type, transport: str = "grpc_asyncio"): client = ClusterManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4621,7 +4652,7 @@ async def test_set_addons_config_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( @@ -4666,11 +4697,6 @@ async def test_set_addons_config_async( assert response.end_time == "end_time_value" -@pytest.mark.asyncio -async def test_set_addons_config_async_from_dict(): - await test_set_addons_config_async(request_type=dict) - - def test_set_addons_config_field_headers(): client = ClusterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4877,8 +4903,8 @@ async def test_set_addons_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cluster_service.SetLocationsRequest, - dict, + cluster_service.SetLocationsRequest(), + {}, ], ) def test_set_locations(request_type, transport: str = "grpc"): @@ -4889,7 +4915,7 @@ def test_set_locations(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.set_locations), "__call__") as call: @@ -4956,12 +4982,13 @@ def test_set_locations_non_empty_request_with_auto_populated_field(): client.set_locations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetLocationsRequest( + request_msg = cluster_service.SetLocationsRequest( project_id="project_id_value", zone="zone_value", cluster_id="cluster_id_value", name="name_value", ) + assert args[0] == request_msg def test_set_locations_use_cached_wrapped_rpc(): @@ -5042,9 +5069,14 @@ async def test_set_locations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_locations_async( - transport: str = "grpc_asyncio", request_type=cluster_service.SetLocationsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.SetLocationsRequest(), + {}, + ], +) +async def test_set_locations_async(request_type, transport: str = "grpc_asyncio"): client = ClusterManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5052,7 +5084,7 @@ async def test_set_locations_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.set_locations), "__call__") as call: @@ -5095,11 +5127,6 @@ async def test_set_locations_async( assert response.end_time == "end_time_value" -@pytest.mark.asyncio -async def test_set_locations_async_from_dict(): - await test_set_locations_async(request_type=dict) - - def test_set_locations_field_headers(): client = ClusterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5286,8 +5313,8 @@ async def test_set_locations_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cluster_service.UpdateMasterRequest, - dict, + cluster_service.UpdateMasterRequest(), + {}, ], ) def test_update_master(request_type, transport: str = "grpc"): @@ -5298,7 +5325,7 @@ def test_update_master(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_master), "__call__") as call: @@ -5366,13 +5393,14 @@ def test_update_master_non_empty_request_with_auto_populated_field(): client.update_master(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.UpdateMasterRequest( + request_msg = cluster_service.UpdateMasterRequest( project_id="project_id_value", zone="zone_value", cluster_id="cluster_id_value", master_version="master_version_value", name="name_value", ) + assert args[0] == request_msg def test_update_master_use_cached_wrapped_rpc(): @@ -5453,9 +5481,14 @@ async def test_update_master_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_master_async( - transport: str = "grpc_asyncio", request_type=cluster_service.UpdateMasterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.UpdateMasterRequest(), + {}, + ], +) +async def test_update_master_async(request_type, transport: str = "grpc_asyncio"): client = ClusterManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5463,7 +5496,7 @@ async def test_update_master_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_master), "__call__") as call: @@ -5506,11 +5539,6 @@ async def test_update_master_async( assert response.end_time == "end_time_value" -@pytest.mark.asyncio -async def test_update_master_async_from_dict(): - await test_update_master_async(request_type=dict) - - def test_update_master_field_headers(): client = ClusterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5697,8 +5725,8 @@ async def test_update_master_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cluster_service.SetMasterAuthRequest, - dict, + cluster_service.SetMasterAuthRequest(), + {}, ], ) def test_set_master_auth(request_type, transport: str = "grpc"): @@ -5709,7 +5737,7 @@ def test_set_master_auth(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.set_master_auth), "__call__") as call: @@ -5776,12 +5804,13 @@ def test_set_master_auth_non_empty_request_with_auto_populated_field(): client.set_master_auth(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetMasterAuthRequest( + request_msg = cluster_service.SetMasterAuthRequest( project_id="project_id_value", zone="zone_value", cluster_id="cluster_id_value", name="name_value", ) + assert args[0] == request_msg def test_set_master_auth_use_cached_wrapped_rpc(): @@ -5862,9 +5891,14 @@ async def test_set_master_auth_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_master_auth_async( - transport: str = "grpc_asyncio", request_type=cluster_service.SetMasterAuthRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.SetMasterAuthRequest(), + {}, + ], +) +async def test_set_master_auth_async(request_type, transport: str = "grpc_asyncio"): client = ClusterManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5872,7 +5906,7 @@ async def test_set_master_auth_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.set_master_auth), "__call__") as call: @@ -5915,11 +5949,6 @@ async def test_set_master_auth_async( assert response.end_time == "end_time_value" -@pytest.mark.asyncio -async def test_set_master_auth_async_from_dict(): - await test_set_master_auth_async(request_type=dict) - - def test_set_master_auth_field_headers(): client = ClusterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5984,8 +6013,8 @@ async def test_set_master_auth_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - cluster_service.DeleteClusterRequest, - dict, + cluster_service.DeleteClusterRequest(), + {}, ], ) def test_delete_cluster(request_type, transport: str = "grpc"): @@ -5996,7 +6025,7 @@ def test_delete_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_cluster), "__call__") as call: @@ -6063,12 +6092,13 @@ def test_delete_cluster_non_empty_request_with_auto_populated_field(): client.delete_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.DeleteClusterRequest( + request_msg = cluster_service.DeleteClusterRequest( project_id="project_id_value", zone="zone_value", cluster_id="cluster_id_value", name="name_value", ) + assert args[0] == request_msg def test_delete_cluster_use_cached_wrapped_rpc(): @@ -6149,9 +6179,14 @@ async def test_delete_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_cluster_async( - transport: str = "grpc_asyncio", request_type=cluster_service.DeleteClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.DeleteClusterRequest(), + {}, + ], +) +async def test_delete_cluster_async(request_type, transport: str = "grpc_asyncio"): client = ClusterManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6159,7 +6194,7 @@ async def test_delete_cluster_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_cluster), "__call__") as call: @@ -6202,11 +6237,6 @@ async def test_delete_cluster_async( assert response.end_time == "end_time_value" -@pytest.mark.asyncio -async def test_delete_cluster_async_from_dict(): - await test_delete_cluster_async(request_type=dict) - - def test_delete_cluster_field_headers(): client = ClusterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6383,8 +6413,8 @@ async def test_delete_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cluster_service.ListOperationsRequest, - dict, + cluster_service.ListOperationsRequest(), + {}, ], ) def test_list_operations(request_type, transport: str = "grpc"): @@ -6395,7 +6425,7 @@ def test_list_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(type(client.transport.list_operations), "__call__") as call: @@ -6441,11 +6471,12 @@ def test_list_operations_non_empty_request_with_auto_populated_field(): client.list_operations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.ListOperationsRequest( + request_msg = cluster_service.ListOperationsRequest( project_id="project_id_value", zone="zone_value", parent="parent_value", ) + assert args[0] == request_msg def test_list_operations_use_cached_wrapped_rpc(): @@ -6526,9 +6557,14 @@ async def test_list_operations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_operations_async( - transport: str = "grpc_asyncio", request_type=cluster_service.ListOperationsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.ListOperationsRequest(), + {}, + ], +) +async def test_list_operations_async(request_type, transport: str = "grpc_asyncio"): client = ClusterManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6536,7 +6572,7 @@ async def test_list_operations_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_operations), "__call__") as call: @@ -6559,11 +6595,6 @@ async def test_list_operations_async( assert response.missing_zones == ["missing_zones_value"] -@pytest.mark.asyncio -async def test_list_operations_async_from_dict(): - await test_list_operations_async(request_type=dict) - - def test_list_operations_field_headers(): client = ClusterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6730,8 +6761,8 @@ async def test_list_operations_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cluster_service.GetOperationRequest, - dict, + cluster_service.GetOperationRequest(), + {}, ], ) def test_get_operation(request_type, transport: str = "grpc"): @@ -6742,7 +6773,7 @@ def test_get_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(type(client.transport.get_operation), "__call__") as call: @@ -6809,12 +6840,13 @@ def test_get_operation_non_empty_request_with_auto_populated_field(): client.get_operation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.GetOperationRequest( + request_msg = cluster_service.GetOperationRequest( project_id="project_id_value", zone="zone_value", operation_id="operation_id_value", name="name_value", ) + assert args[0] == request_msg def test_get_operation_use_cached_wrapped_rpc(): @@ -6895,9 +6927,14 @@ async def test_get_operation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_operation_async( - transport: str = "grpc_asyncio", request_type=cluster_service.GetOperationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.GetOperationRequest(), + {}, + ], +) +async def test_get_operation_async(request_type, transport: str = "grpc_asyncio"): client = ClusterManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6905,7 +6942,7 @@ async def test_get_operation_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_operation), "__call__") as call: @@ -6948,11 +6985,6 @@ async def test_get_operation_async( assert response.end_time == "end_time_value" -@pytest.mark.asyncio -async def test_get_operation_async_from_dict(): - await test_get_operation_async(request_type=dict) - - def test_get_operation_field_headers(): client = ClusterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7129,8 +7161,8 @@ async def test_get_operation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cluster_service.CancelOperationRequest, - dict, + cluster_service.CancelOperationRequest(), + {}, ], ) def test_cancel_operation(request_type, transport: str = "grpc"): @@ -7141,7 +7173,7 @@ def test_cancel_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(type(client.transport.cancel_operation), "__call__") as call: @@ -7185,12 +7217,13 @@ def test_cancel_operation_non_empty_request_with_auto_populated_field(): client.cancel_operation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.CancelOperationRequest( + request_msg = cluster_service.CancelOperationRequest( project_id="project_id_value", zone="zone_value", operation_id="operation_id_value", name="name_value", ) + assert args[0] == request_msg def test_cancel_operation_use_cached_wrapped_rpc(): @@ -7273,9 +7306,14 @@ async def test_cancel_operation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_cancel_operation_async( - transport: str = "grpc_asyncio", request_type=cluster_service.CancelOperationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.CancelOperationRequest(), + {}, + ], +) +async def test_cancel_operation_async(request_type, transport: str = "grpc_asyncio"): client = ClusterManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7283,7 +7321,7 @@ async def test_cancel_operation_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.cancel_operation), "__call__") as call: @@ -7301,11 +7339,6 @@ async def test_cancel_operation_async( assert response is None -@pytest.mark.asyncio -async def test_cancel_operation_async_from_dict(): - await test_cancel_operation_async(request_type=dict) - - def test_cancel_operation_field_headers(): client = ClusterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7478,8 +7511,8 @@ async def test_cancel_operation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cluster_service.GetServerConfigRequest, - dict, + cluster_service.GetServerConfigRequest(), + {}, ], ) def test_get_server_config(request_type, transport: str = "grpc"): @@ -7490,7 +7523,7 @@ def test_get_server_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( @@ -7548,11 +7581,12 @@ def test_get_server_config_non_empty_request_with_auto_populated_field(): client.get_server_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.GetServerConfigRequest( + request_msg = cluster_service.GetServerConfigRequest( project_id="project_id_value", zone="zone_value", name="name_value", ) + assert args[0] == request_msg def test_get_server_config_use_cached_wrapped_rpc(): @@ -7635,9 +7669,14 @@ async def test_get_server_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_server_config_async( - transport: str = "grpc_asyncio", request_type=cluster_service.GetServerConfigRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.GetServerConfigRequest(), + {}, + ], +) +async def test_get_server_config_async(request_type, transport: str = "grpc_asyncio"): client = ClusterManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7645,7 +7684,7 @@ async def test_get_server_config_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( @@ -7678,11 +7717,6 @@ async def test_get_server_config_async( assert response.valid_master_versions == ["valid_master_versions_value"] -@pytest.mark.asyncio -async def test_get_server_config_async_from_dict(): - await test_get_server_config_async(request_type=dict) - - def test_get_server_config_field_headers(): client = ClusterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7857,8 +7891,8 @@ async def test_get_server_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cluster_service.GetJSONWebKeysRequest, - dict, + cluster_service.GetJSONWebKeysRequest(), + {}, ], ) def test_get_json_web_keys(request_type, transport: str = "grpc"): @@ -7869,7 +7903,7 @@ def test_get_json_web_keys(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7914,9 +7948,10 @@ def test_get_json_web_keys_non_empty_request_with_auto_populated_field(): client.get_json_web_keys(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.GetJSONWebKeysRequest( + request_msg = cluster_service.GetJSONWebKeysRequest( parent="parent_value", ) + assert args[0] == request_msg def test_get_json_web_keys_use_cached_wrapped_rpc(): @@ -7999,9 +8034,14 @@ async def test_get_json_web_keys_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_json_web_keys_async( - transport: str = "grpc_asyncio", request_type=cluster_service.GetJSONWebKeysRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.GetJSONWebKeysRequest(), + {}, + ], +) +async def test_get_json_web_keys_async(request_type, transport: str = "grpc_asyncio"): client = ClusterManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8009,7 +8049,7 @@ async def test_get_json_web_keys_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( @@ -8031,11 +8071,6 @@ async def test_get_json_web_keys_async( assert isinstance(response, cluster_service.GetJSONWebKeysResponse) -@pytest.mark.asyncio -async def test_get_json_web_keys_async_from_dict(): - await test_get_json_web_keys_async(request_type=dict) - - def test_get_json_web_keys_field_headers(): client = ClusterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8104,8 +8139,8 @@ async def test_get_json_web_keys_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - cluster_service.ListNodePoolsRequest, - dict, + cluster_service.ListNodePoolsRequest(), + {}, ], ) def test_list_node_pools(request_type, transport: str = "grpc"): @@ -8116,7 +8151,7 @@ def test_list_node_pools(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_node_pools), "__call__") as call: @@ -8160,12 +8195,13 @@ def test_list_node_pools_non_empty_request_with_auto_populated_field(): client.list_node_pools(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.ListNodePoolsRequest( + request_msg = cluster_service.ListNodePoolsRequest( project_id="project_id_value", zone="zone_value", cluster_id="cluster_id_value", parent="parent_value", ) + assert args[0] == request_msg def test_list_node_pools_use_cached_wrapped_rpc(): @@ -8246,9 +8282,14 @@ async def test_list_node_pools_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_node_pools_async( - transport: str = "grpc_asyncio", request_type=cluster_service.ListNodePoolsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.ListNodePoolsRequest(), + {}, + ], +) +async def test_list_node_pools_async(request_type, transport: str = "grpc_asyncio"): client = ClusterManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8256,7 +8297,7 @@ async def test_list_node_pools_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_node_pools), "__call__") as call: @@ -8276,11 +8317,6 @@ async def test_list_node_pools_async( assert isinstance(response, cluster_service.ListNodePoolsResponse) -@pytest.mark.asyncio -async def test_list_node_pools_async_from_dict(): - await test_list_node_pools_async(request_type=dict) - - def test_list_node_pools_field_headers(): client = ClusterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8457,8 +8493,8 @@ async def test_list_node_pools_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cluster_service.GetNodePoolRequest, - dict, + cluster_service.GetNodePoolRequest(), + {}, ], ) def test_get_node_pool(request_type, transport: str = "grpc"): @@ -8469,7 +8505,7 @@ def test_get_node_pool(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_node_pool), "__call__") as call: @@ -8535,13 +8571,14 @@ def test_get_node_pool_non_empty_request_with_auto_populated_field(): client.get_node_pool(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.GetNodePoolRequest( + request_msg = cluster_service.GetNodePoolRequest( project_id="project_id_value", zone="zone_value", cluster_id="cluster_id_value", node_pool_id="node_pool_id_value", name="name_value", ) + assert args[0] == request_msg def test_get_node_pool_use_cached_wrapped_rpc(): @@ -8622,9 +8659,14 @@ async def test_get_node_pool_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_node_pool_async( - transport: str = "grpc_asyncio", request_type=cluster_service.GetNodePoolRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.GetNodePoolRequest(), + {}, + ], +) +async def test_get_node_pool_async(request_type, transport: str = "grpc_asyncio"): client = ClusterManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8632,7 +8674,7 @@ async def test_get_node_pool_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_node_pool), "__call__") as call: @@ -8673,11 +8715,6 @@ async def test_get_node_pool_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_node_pool_async_from_dict(): - await test_get_node_pool_async(request_type=dict) - - def test_get_node_pool_field_headers(): client = ClusterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8864,8 +8901,8 @@ async def test_get_node_pool_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cluster_service.CreateNodePoolRequest, - dict, + cluster_service.CreateNodePoolRequest(), + {}, ], ) def test_create_node_pool(request_type, transport: str = "grpc"): @@ -8876,7 +8913,7 @@ def test_create_node_pool(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_node_pool), "__call__") as call: @@ -8943,12 +8980,13 @@ def test_create_node_pool_non_empty_request_with_auto_populated_field(): client.create_node_pool(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.CreateNodePoolRequest( + request_msg = cluster_service.CreateNodePoolRequest( project_id="project_id_value", zone="zone_value", cluster_id="cluster_id_value", parent="parent_value", ) + assert args[0] == request_msg def test_create_node_pool_use_cached_wrapped_rpc(): @@ -9031,9 +9069,14 @@ async def test_create_node_pool_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_node_pool_async( - transport: str = "grpc_asyncio", request_type=cluster_service.CreateNodePoolRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.CreateNodePoolRequest(), + {}, + ], +) +async def test_create_node_pool_async(request_type, transport: str = "grpc_asyncio"): client = ClusterManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9041,7 +9084,7 @@ async def test_create_node_pool_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_node_pool), "__call__") as call: @@ -9084,11 +9127,6 @@ async def test_create_node_pool_async( assert response.end_time == "end_time_value" -@pytest.mark.asyncio -async def test_create_node_pool_async_from_dict(): - await test_create_node_pool_async(request_type=dict) - - def test_create_node_pool_field_headers(): client = ClusterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9275,8 +9313,8 @@ async def test_create_node_pool_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cluster_service.DeleteNodePoolRequest, - dict, + cluster_service.DeleteNodePoolRequest(), + {}, ], ) def test_delete_node_pool(request_type, transport: str = "grpc"): @@ -9287,7 +9325,7 @@ def test_delete_node_pool(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_node_pool), "__call__") as call: @@ -9355,13 +9393,14 @@ def test_delete_node_pool_non_empty_request_with_auto_populated_field(): client.delete_node_pool(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.DeleteNodePoolRequest( + request_msg = cluster_service.DeleteNodePoolRequest( project_id="project_id_value", zone="zone_value", cluster_id="cluster_id_value", node_pool_id="node_pool_id_value", name="name_value", ) + assert args[0] == request_msg def test_delete_node_pool_use_cached_wrapped_rpc(): @@ -9444,9 +9483,14 @@ async def test_delete_node_pool_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_node_pool_async( - transport: str = "grpc_asyncio", request_type=cluster_service.DeleteNodePoolRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.DeleteNodePoolRequest(), + {}, + ], +) +async def test_delete_node_pool_async(request_type, transport: str = "grpc_asyncio"): client = ClusterManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9454,7 +9498,7 @@ async def test_delete_node_pool_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_node_pool), "__call__") as call: @@ -9497,11 +9541,6 @@ async def test_delete_node_pool_async( assert response.end_time == "end_time_value" -@pytest.mark.asyncio -async def test_delete_node_pool_async_from_dict(): - await test_delete_node_pool_async(request_type=dict) - - def test_delete_node_pool_field_headers(): client = ClusterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9688,8 +9727,8 @@ async def test_delete_node_pool_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cluster_service.CompleteNodePoolUpgradeRequest, - dict, + cluster_service.CompleteNodePoolUpgradeRequest(), + {}, ], ) def test_complete_node_pool_upgrade(request_type, transport: str = "grpc"): @@ -9700,7 +9739,7 @@ def test_complete_node_pool_upgrade(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9745,9 +9784,10 @@ def test_complete_node_pool_upgrade_non_empty_request_with_auto_populated_field( client.complete_node_pool_upgrade(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.CompleteNodePoolUpgradeRequest( + request_msg = cluster_service.CompleteNodePoolUpgradeRequest( name="name_value", ) + assert args[0] == request_msg def test_complete_node_pool_upgrade_use_cached_wrapped_rpc(): @@ -9833,9 +9873,15 @@ async def test_complete_node_pool_upgrade_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.CompleteNodePoolUpgradeRequest(), + {}, + ], +) async def test_complete_node_pool_upgrade_async( - transport: str = "grpc_asyncio", - request_type=cluster_service.CompleteNodePoolUpgradeRequest, + request_type, transport: str = "grpc_asyncio" ): client = ClusterManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -9844,7 +9890,7 @@ async def test_complete_node_pool_upgrade_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( @@ -9864,11 +9910,6 @@ async def test_complete_node_pool_upgrade_async( assert response is None -@pytest.mark.asyncio -async def test_complete_node_pool_upgrade_async_from_dict(): - await test_complete_node_pool_upgrade_async(request_type=dict) - - def test_complete_node_pool_upgrade_field_headers(): client = ClusterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9935,8 +9976,8 @@ async def test_complete_node_pool_upgrade_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - cluster_service.RollbackNodePoolUpgradeRequest, - dict, + cluster_service.RollbackNodePoolUpgradeRequest(), + {}, ], ) def test_rollback_node_pool_upgrade(request_type, transport: str = "grpc"): @@ -9947,7 +9988,7 @@ def test_rollback_node_pool_upgrade(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10019,13 +10060,14 @@ def test_rollback_node_pool_upgrade_non_empty_request_with_auto_populated_field( client.rollback_node_pool_upgrade(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.RollbackNodePoolUpgradeRequest( + request_msg = cluster_service.RollbackNodePoolUpgradeRequest( project_id="project_id_value", zone="zone_value", cluster_id="cluster_id_value", node_pool_id="node_pool_id_value", name="name_value", ) + assert args[0] == request_msg def test_rollback_node_pool_upgrade_use_cached_wrapped_rpc(): @@ -10111,9 +10153,15 @@ async def test_rollback_node_pool_upgrade_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.RollbackNodePoolUpgradeRequest(), + {}, + ], +) async def test_rollback_node_pool_upgrade_async( - transport: str = "grpc_asyncio", - request_type=cluster_service.RollbackNodePoolUpgradeRequest, + request_type, transport: str = "grpc_asyncio" ): client = ClusterManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -10122,7 +10170,7 @@ async def test_rollback_node_pool_upgrade_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( @@ -10167,11 +10215,6 @@ async def test_rollback_node_pool_upgrade_async( assert response.end_time == "end_time_value" -@pytest.mark.asyncio -async def test_rollback_node_pool_upgrade_async_from_dict(): - await test_rollback_node_pool_upgrade_async(request_type=dict) - - def test_rollback_node_pool_upgrade_field_headers(): client = ClusterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10366,8 +10409,8 @@ async def test_rollback_node_pool_upgrade_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cluster_service.SetNodePoolManagementRequest, - dict, + cluster_service.SetNodePoolManagementRequest(), + {}, ], ) def test_set_node_pool_management(request_type, transport: str = "grpc"): @@ -10378,7 +10421,7 @@ def test_set_node_pool_management(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10450,13 +10493,14 @@ def test_set_node_pool_management_non_empty_request_with_auto_populated_field(): client.set_node_pool_management(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetNodePoolManagementRequest( + request_msg = cluster_service.SetNodePoolManagementRequest( project_id="project_id_value", zone="zone_value", cluster_id="cluster_id_value", node_pool_id="node_pool_id_value", name="name_value", ) + assert args[0] == request_msg def test_set_node_pool_management_use_cached_wrapped_rpc(): @@ -10542,9 +10586,15 @@ async def test_set_node_pool_management_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.SetNodePoolManagementRequest(), + {}, + ], +) async def test_set_node_pool_management_async( - transport: str = "grpc_asyncio", - request_type=cluster_service.SetNodePoolManagementRequest, + request_type, transport: str = "grpc_asyncio" ): client = ClusterManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -10553,7 +10603,7 @@ async def test_set_node_pool_management_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( @@ -10598,11 +10648,6 @@ async def test_set_node_pool_management_async( assert response.end_time == "end_time_value" -@pytest.mark.asyncio -async def test_set_node_pool_management_async_from_dict(): - await test_set_node_pool_management_async(request_type=dict) - - def test_set_node_pool_management_field_headers(): client = ClusterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10671,8 +10716,8 @@ async def test_set_node_pool_management_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - cluster_service.SetLabelsRequest, - dict, + cluster_service.SetLabelsRequest(), + {}, ], ) def test_set_labels(request_type, transport: str = "grpc"): @@ -10683,7 +10728,7 @@ def test_set_labels(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.set_labels), "__call__") as call: @@ -10751,13 +10796,14 @@ def test_set_labels_non_empty_request_with_auto_populated_field(): client.set_labels(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetLabelsRequest( + request_msg = cluster_service.SetLabelsRequest( project_id="project_id_value", zone="zone_value", cluster_id="cluster_id_value", label_fingerprint="label_fingerprint_value", name="name_value", ) + assert args[0] == request_msg def test_set_labels_use_cached_wrapped_rpc(): @@ -10836,9 +10882,14 @@ async def test_set_labels_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_set_labels_async( - transport: str = "grpc_asyncio", request_type=cluster_service.SetLabelsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.SetLabelsRequest(), + {}, + ], +) +async def test_set_labels_async(request_type, transport: str = "grpc_asyncio"): client = ClusterManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10846,7 +10897,7 @@ async def test_set_labels_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.set_labels), "__call__") as call: @@ -10889,11 +10940,6 @@ async def test_set_labels_async( assert response.end_time == "end_time_value" -@pytest.mark.asyncio -async def test_set_labels_async_from_dict(): - await test_set_labels_async(request_type=dict) - - def test_set_labels_field_headers(): client = ClusterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10958,8 +11004,8 @@ async def test_set_labels_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - cluster_service.SetLegacyAbacRequest, - dict, + cluster_service.SetLegacyAbacRequest(), + {}, ], ) def test_set_legacy_abac(request_type, transport: str = "grpc"): @@ -10970,7 +11016,7 @@ def test_set_legacy_abac(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.set_legacy_abac), "__call__") as call: @@ -11037,12 +11083,13 @@ def test_set_legacy_abac_non_empty_request_with_auto_populated_field(): client.set_legacy_abac(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetLegacyAbacRequest( + request_msg = cluster_service.SetLegacyAbacRequest( project_id="project_id_value", zone="zone_value", cluster_id="cluster_id_value", name="name_value", ) + assert args[0] == request_msg def test_set_legacy_abac_use_cached_wrapped_rpc(): @@ -11123,9 +11170,14 @@ async def test_set_legacy_abac_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_legacy_abac_async( - transport: str = "grpc_asyncio", request_type=cluster_service.SetLegacyAbacRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.SetLegacyAbacRequest(), + {}, + ], +) +async def test_set_legacy_abac_async(request_type, transport: str = "grpc_asyncio"): client = ClusterManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11133,7 +11185,7 @@ async def test_set_legacy_abac_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.set_legacy_abac), "__call__") as call: @@ -11176,11 +11228,6 @@ async def test_set_legacy_abac_async( assert response.end_time == "end_time_value" -@pytest.mark.asyncio -async def test_set_legacy_abac_async_from_dict(): - await test_set_legacy_abac_async(request_type=dict) - - def test_set_legacy_abac_field_headers(): client = ClusterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11367,8 +11414,8 @@ async def test_set_legacy_abac_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cluster_service.StartIPRotationRequest, - dict, + cluster_service.StartIPRotationRequest(), + {}, ], ) def test_start_ip_rotation(request_type, transport: str = "grpc"): @@ -11379,7 +11426,7 @@ def test_start_ip_rotation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11450,12 +11497,13 @@ def test_start_ip_rotation_non_empty_request_with_auto_populated_field(): client.start_ip_rotation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.StartIPRotationRequest( + request_msg = cluster_service.StartIPRotationRequest( project_id="project_id_value", zone="zone_value", cluster_id="cluster_id_value", name="name_value", ) + assert args[0] == request_msg def test_start_ip_rotation_use_cached_wrapped_rpc(): @@ -11538,9 +11586,14 @@ async def test_start_ip_rotation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_start_ip_rotation_async( - transport: str = "grpc_asyncio", request_type=cluster_service.StartIPRotationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.StartIPRotationRequest(), + {}, + ], +) +async def test_start_ip_rotation_async(request_type, transport: str = "grpc_asyncio"): client = ClusterManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11548,7 +11601,7 @@ async def test_start_ip_rotation_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( @@ -11593,11 +11646,6 @@ async def test_start_ip_rotation_async( assert response.end_time == "end_time_value" -@pytest.mark.asyncio -async def test_start_ip_rotation_async_from_dict(): - await test_start_ip_rotation_async(request_type=dict) - - def test_start_ip_rotation_field_headers(): client = ClusterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11782,8 +11830,8 @@ async def test_start_ip_rotation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cluster_service.CompleteIPRotationRequest, - dict, + cluster_service.CompleteIPRotationRequest(), + {}, ], ) def test_complete_ip_rotation(request_type, transport: str = "grpc"): @@ -11794,7 +11842,7 @@ def test_complete_ip_rotation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11865,12 +11913,13 @@ def test_complete_ip_rotation_non_empty_request_with_auto_populated_field(): client.complete_ip_rotation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.CompleteIPRotationRequest( + request_msg = cluster_service.CompleteIPRotationRequest( project_id="project_id_value", zone="zone_value", cluster_id="cluster_id_value", name="name_value", ) + assert args[0] == request_msg def test_complete_ip_rotation_use_cached_wrapped_rpc(): @@ -11955,9 +12004,15 @@ async def test_complete_ip_rotation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.CompleteIPRotationRequest(), + {}, + ], +) async def test_complete_ip_rotation_async( - transport: str = "grpc_asyncio", - request_type=cluster_service.CompleteIPRotationRequest, + request_type, transport: str = "grpc_asyncio" ): client = ClusterManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -11966,7 +12021,7 @@ async def test_complete_ip_rotation_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( @@ -12011,11 +12066,6 @@ async def test_complete_ip_rotation_async( assert response.end_time == "end_time_value" -@pytest.mark.asyncio -async def test_complete_ip_rotation_async_from_dict(): - await test_complete_ip_rotation_async(request_type=dict) - - def test_complete_ip_rotation_field_headers(): client = ClusterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12200,8 +12250,8 @@ async def test_complete_ip_rotation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cluster_service.SetNodePoolSizeRequest, - dict, + cluster_service.SetNodePoolSizeRequest(), + {}, ], ) def test_set_node_pool_size(request_type, transport: str = "grpc"): @@ -12212,7 +12262,7 @@ def test_set_node_pool_size(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -12284,13 +12334,14 @@ def test_set_node_pool_size_non_empty_request_with_auto_populated_field(): client.set_node_pool_size(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetNodePoolSizeRequest( + request_msg = cluster_service.SetNodePoolSizeRequest( project_id="project_id_value", zone="zone_value", cluster_id="cluster_id_value", node_pool_id="node_pool_id_value", name="name_value", ) + assert args[0] == request_msg def test_set_node_pool_size_use_cached_wrapped_rpc(): @@ -12375,9 +12426,14 @@ async def test_set_node_pool_size_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_node_pool_size_async( - transport: str = "grpc_asyncio", request_type=cluster_service.SetNodePoolSizeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.SetNodePoolSizeRequest(), + {}, + ], +) +async def test_set_node_pool_size_async(request_type, transport: str = "grpc_asyncio"): client = ClusterManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12385,7 +12441,7 @@ async def test_set_node_pool_size_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( @@ -12430,11 +12486,6 @@ async def test_set_node_pool_size_async( assert response.end_time == "end_time_value" -@pytest.mark.asyncio -async def test_set_node_pool_size_async_from_dict(): - await test_set_node_pool_size_async(request_type=dict) - - def test_set_node_pool_size_field_headers(): client = ClusterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12503,8 +12554,8 @@ async def test_set_node_pool_size_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - cluster_service.SetNetworkPolicyRequest, - dict, + cluster_service.SetNetworkPolicyRequest(), + {}, ], ) def test_set_network_policy(request_type, transport: str = "grpc"): @@ -12515,7 +12566,7 @@ def test_set_network_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( @@ -12586,12 +12637,13 @@ def test_set_network_policy_non_empty_request_with_auto_populated_field(): client.set_network_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetNetworkPolicyRequest( + request_msg = cluster_service.SetNetworkPolicyRequest( project_id="project_id_value", zone="zone_value", cluster_id="cluster_id_value", name="name_value", ) + assert args[0] == request_msg def test_set_network_policy_use_cached_wrapped_rpc(): @@ -12676,10 +12728,14 @@ async def test_set_network_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_network_policy_async( - transport: str = "grpc_asyncio", - request_type=cluster_service.SetNetworkPolicyRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.SetNetworkPolicyRequest(), + {}, + ], +) +async def test_set_network_policy_async(request_type, transport: str = "grpc_asyncio"): client = ClusterManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12687,7 +12743,7 @@ async def test_set_network_policy_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( @@ -12732,11 +12788,6 @@ async def test_set_network_policy_async( assert response.end_time == "end_time_value" -@pytest.mark.asyncio -async def test_set_network_policy_async_from_dict(): - await test_set_network_policy_async(request_type=dict) - - def test_set_network_policy_field_headers(): client = ClusterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12943,8 +12994,8 @@ async def test_set_network_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cluster_service.SetMaintenancePolicyRequest, - dict, + cluster_service.SetMaintenancePolicyRequest(), + {}, ], ) def test_set_maintenance_policy(request_type, transport: str = "grpc"): @@ -12955,7 +13006,7 @@ def test_set_maintenance_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( @@ -13026,12 +13077,13 @@ def test_set_maintenance_policy_non_empty_request_with_auto_populated_field(): client.set_maintenance_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetMaintenancePolicyRequest( + request_msg = cluster_service.SetMaintenancePolicyRequest( project_id="project_id_value", zone="zone_value", cluster_id="cluster_id_value", name="name_value", ) + assert args[0] == request_msg def test_set_maintenance_policy_use_cached_wrapped_rpc(): @@ -13117,9 +13169,15 @@ async def test_set_maintenance_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.SetMaintenancePolicyRequest(), + {}, + ], +) async def test_set_maintenance_policy_async( - transport: str = "grpc_asyncio", - request_type=cluster_service.SetMaintenancePolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = ClusterManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -13128,7 +13186,7 @@ async def test_set_maintenance_policy_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( @@ -13173,11 +13231,6 @@ async def test_set_maintenance_policy_async( assert response.end_time == "end_time_value" -@pytest.mark.asyncio -async def test_set_maintenance_policy_async_from_dict(): - await test_set_maintenance_policy_async(request_type=dict) - - def test_set_maintenance_policy_field_headers(): client = ClusterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13408,8 +13461,8 @@ async def test_set_maintenance_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cluster_service.ListUsableSubnetworksRequest, - dict, + cluster_service.ListUsableSubnetworksRequest(), + {}, ], ) def test_list_usable_subnetworks(request_type, transport: str = "grpc"): @@ -13420,7 +13473,7 @@ def test_list_usable_subnetworks(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -13470,11 +13523,12 @@ def test_list_usable_subnetworks_non_empty_request_with_auto_populated_field(): client.list_usable_subnetworks(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.ListUsableSubnetworksRequest( + request_msg = cluster_service.ListUsableSubnetworksRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_usable_subnetworks_use_cached_wrapped_rpc(): @@ -13560,9 +13614,15 @@ async def test_list_usable_subnetworks_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.ListUsableSubnetworksRequest(), + {}, + ], +) async def test_list_usable_subnetworks_async( - transport: str = "grpc_asyncio", - request_type=cluster_service.ListUsableSubnetworksRequest, + request_type, transport: str = "grpc_asyncio" ): client = ClusterManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -13571,7 +13631,7 @@ async def test_list_usable_subnetworks_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( @@ -13596,11 +13656,6 @@ async def test_list_usable_subnetworks_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_usable_subnetworks_async_from_dict(): - await test_list_usable_subnetworks_async(request_type=dict) - - def test_list_usable_subnetworks_field_headers(): client = ClusterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13867,8 +13922,8 @@ async def test_list_usable_subnetworks_async_pages(): @pytest.mark.parametrize( "request_type", [ - cluster_service.CheckAutopilotCompatibilityRequest, - dict, + cluster_service.CheckAutopilotCompatibilityRequest(), + {}, ], ) def test_check_autopilot_compatibility(request_type, transport: str = "grpc"): @@ -13879,7 +13934,7 @@ def test_check_autopilot_compatibility(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -13927,9 +13982,10 @@ def test_check_autopilot_compatibility_non_empty_request_with_auto_populated_fie client.check_autopilot_compatibility(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.CheckAutopilotCompatibilityRequest( + request_msg = cluster_service.CheckAutopilotCompatibilityRequest( name="name_value", ) + assert args[0] == request_msg def test_check_autopilot_compatibility_use_cached_wrapped_rpc(): @@ -14015,9 +14071,15 @@ async def test_check_autopilot_compatibility_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.CheckAutopilotCompatibilityRequest(), + {}, + ], +) async def test_check_autopilot_compatibility_async( - transport: str = "grpc_asyncio", - request_type=cluster_service.CheckAutopilotCompatibilityRequest, + request_type, transport: str = "grpc_asyncio" ): client = ClusterManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -14026,7 +14088,7 @@ async def test_check_autopilot_compatibility_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( @@ -14051,11 +14113,6 @@ async def test_check_autopilot_compatibility_async( assert response.summary == "summary_value" -@pytest.mark.asyncio -async def test_check_autopilot_compatibility_async_from_dict(): - await test_check_autopilot_compatibility_async(request_type=dict) - - def test_check_autopilot_compatibility_field_headers(): client = ClusterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14124,8 +14181,8 @@ async def test_check_autopilot_compatibility_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - cluster_service.FetchClusterUpgradeInfoRequest, - dict, + cluster_service.FetchClusterUpgradeInfoRequest(), + {}, ], ) def test_fetch_cluster_upgrade_info(request_type, transport: str = "grpc"): @@ -14136,7 +14193,7 @@ def test_fetch_cluster_upgrade_info(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -14209,10 +14266,11 @@ def test_fetch_cluster_upgrade_info_non_empty_request_with_auto_populated_field( client.fetch_cluster_upgrade_info(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.FetchClusterUpgradeInfoRequest( + request_msg = cluster_service.FetchClusterUpgradeInfoRequest( name="name_value", version="version_value", ) + assert args[0] == request_msg def test_fetch_cluster_upgrade_info_use_cached_wrapped_rpc(): @@ -14298,9 +14356,15 @@ async def test_fetch_cluster_upgrade_info_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.FetchClusterUpgradeInfoRequest(), + {}, + ], +) async def test_fetch_cluster_upgrade_info_async( - transport: str = "grpc_asyncio", - request_type=cluster_service.FetchClusterUpgradeInfoRequest, + request_type, transport: str = "grpc_asyncio" ): client = ClusterManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -14309,7 +14373,7 @@ async def test_fetch_cluster_upgrade_info_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( @@ -14358,11 +14422,6 @@ async def test_fetch_cluster_upgrade_info_async( ) -@pytest.mark.asyncio -async def test_fetch_cluster_upgrade_info_async_from_dict(): - await test_fetch_cluster_upgrade_info_async(request_type=dict) - - def test_fetch_cluster_upgrade_info_field_headers(): client = ClusterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14517,8 +14576,8 @@ async def test_fetch_cluster_upgrade_info_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cluster_service.FetchNodePoolUpgradeInfoRequest, - dict, + cluster_service.FetchNodePoolUpgradeInfoRequest(), + {}, ], ) def test_fetch_node_pool_upgrade_info(request_type, transport: str = "grpc"): @@ -14529,7 +14588,7 @@ def test_fetch_node_pool_upgrade_info(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -14602,10 +14661,11 @@ def test_fetch_node_pool_upgrade_info_non_empty_request_with_auto_populated_fiel client.fetch_node_pool_upgrade_info(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.FetchNodePoolUpgradeInfoRequest( + request_msg = cluster_service.FetchNodePoolUpgradeInfoRequest( name="name_value", version="version_value", ) + assert args[0] == request_msg def test_fetch_node_pool_upgrade_info_use_cached_wrapped_rpc(): @@ -14691,9 +14751,15 @@ async def test_fetch_node_pool_upgrade_info_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.FetchNodePoolUpgradeInfoRequest(), + {}, + ], +) async def test_fetch_node_pool_upgrade_info_async( - transport: str = "grpc_asyncio", - request_type=cluster_service.FetchNodePoolUpgradeInfoRequest, + request_type, transport: str = "grpc_asyncio" ): client = ClusterManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -14702,7 +14768,7 @@ async def test_fetch_node_pool_upgrade_info_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( @@ -14751,11 +14817,6 @@ async def test_fetch_node_pool_upgrade_info_async( ) -@pytest.mark.asyncio -async def test_fetch_node_pool_upgrade_info_async_from_dict(): - await test_fetch_node_pool_upgrade_info_async(request_type=dict) - - def test_fetch_node_pool_upgrade_info_field_headers(): client = ClusterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -19794,7 +19855,6 @@ def test_list_clusters_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.ListClustersRequest() - assert args[0] == request_msg @@ -19815,7 +19875,6 @@ def test_get_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.GetClusterRequest() - assert args[0] == request_msg @@ -19836,7 +19895,6 @@ def test_create_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.CreateClusterRequest() - assert args[0] == request_msg @@ -19857,7 +19915,6 @@ def test_update_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.UpdateClusterRequest() - assert args[0] == request_msg @@ -19878,7 +19935,6 @@ def test_update_node_pool_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.UpdateNodePoolRequest() - assert args[0] == request_msg @@ -19901,7 +19957,6 @@ def test_set_node_pool_autoscaling_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.SetNodePoolAutoscalingRequest() - assert args[0] == request_msg @@ -19924,7 +19979,6 @@ def test_set_logging_service_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.SetLoggingServiceRequest() - assert args[0] == request_msg @@ -19947,7 +20001,6 @@ def test_set_monitoring_service_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.SetMonitoringServiceRequest() - assert args[0] == request_msg @@ -19970,7 +20023,6 @@ def test_set_addons_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.SetAddonsConfigRequest() - assert args[0] == request_msg @@ -19991,7 +20043,6 @@ def test_set_locations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.SetLocationsRequest() - assert args[0] == request_msg @@ -20012,7 +20063,6 @@ def test_update_master_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.UpdateMasterRequest() - assert args[0] == request_msg @@ -20033,7 +20083,6 @@ def test_set_master_auth_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.SetMasterAuthRequest() - assert args[0] == request_msg @@ -20054,7 +20103,6 @@ def test_delete_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.DeleteClusterRequest() - assert args[0] == request_msg @@ -20075,7 +20123,6 @@ def test_list_operations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.ListOperationsRequest() - assert args[0] == request_msg @@ -20096,7 +20143,6 @@ def test_get_operation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.GetOperationRequest() - assert args[0] == request_msg @@ -20117,7 +20163,6 @@ def test_cancel_operation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.CancelOperationRequest() - assert args[0] == request_msg @@ -20140,7 +20185,6 @@ def test_get_server_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.GetServerConfigRequest() - assert args[0] == request_msg @@ -20163,7 +20207,6 @@ def test_get_json_web_keys_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.GetJSONWebKeysRequest() - assert args[0] == request_msg @@ -20184,7 +20227,6 @@ def test_list_node_pools_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.ListNodePoolsRequest() - assert args[0] == request_msg @@ -20205,7 +20247,6 @@ def test_get_node_pool_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.GetNodePoolRequest() - assert args[0] == request_msg @@ -20226,7 +20267,6 @@ def test_create_node_pool_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.CreateNodePoolRequest() - assert args[0] == request_msg @@ -20247,7 +20287,6 @@ def test_delete_node_pool_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.DeleteNodePoolRequest() - assert args[0] == request_msg @@ -20270,7 +20309,6 @@ def test_complete_node_pool_upgrade_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.CompleteNodePoolUpgradeRequest() - assert args[0] == request_msg @@ -20293,7 +20331,6 @@ def test_rollback_node_pool_upgrade_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.RollbackNodePoolUpgradeRequest() - assert args[0] == request_msg @@ -20316,7 +20353,6 @@ def test_set_node_pool_management_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.SetNodePoolManagementRequest() - assert args[0] == request_msg @@ -20337,7 +20373,6 @@ def test_set_labels_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.SetLabelsRequest() - assert args[0] == request_msg @@ -20358,7 +20393,6 @@ def test_set_legacy_abac_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.SetLegacyAbacRequest() - assert args[0] == request_msg @@ -20381,7 +20415,6 @@ def test_start_ip_rotation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.StartIPRotationRequest() - assert args[0] == request_msg @@ -20404,7 +20437,6 @@ def test_complete_ip_rotation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.CompleteIPRotationRequest() - assert args[0] == request_msg @@ -20427,7 +20459,6 @@ def test_set_node_pool_size_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.SetNodePoolSizeRequest() - assert args[0] == request_msg @@ -20450,7 +20481,6 @@ def test_set_network_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.SetNetworkPolicyRequest() - assert args[0] == request_msg @@ -20473,7 +20503,6 @@ def test_set_maintenance_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.SetMaintenancePolicyRequest() - assert args[0] == request_msg @@ -20496,7 +20525,6 @@ def test_list_usable_subnetworks_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.ListUsableSubnetworksRequest() - assert args[0] == request_msg @@ -20519,7 +20547,6 @@ def test_check_autopilot_compatibility_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.CheckAutopilotCompatibilityRequest() - assert args[0] == request_msg @@ -20542,7 +20569,6 @@ def test_fetch_cluster_upgrade_info_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.FetchClusterUpgradeInfoRequest() - assert args[0] == request_msg @@ -20565,7 +20591,6 @@ def test_fetch_node_pool_upgrade_info_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.FetchNodePoolUpgradeInfoRequest() - assert args[0] == request_msg @@ -20606,7 +20631,6 @@ async def test_list_clusters_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.ListClustersRequest() - assert args[0] == request_msg @@ -20665,7 +20689,6 @@ async def test_get_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.GetClusterRequest() - assert args[0] == request_msg @@ -20702,7 +20725,6 @@ async def test_create_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.CreateClusterRequest() - assert args[0] == request_msg @@ -20739,7 +20761,6 @@ async def test_update_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.UpdateClusterRequest() - assert args[0] == request_msg @@ -20776,7 +20797,6 @@ async def test_update_node_pool_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.UpdateNodePoolRequest() - assert args[0] == request_msg @@ -20815,7 +20835,6 @@ async def test_set_node_pool_autoscaling_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.SetNodePoolAutoscalingRequest() - assert args[0] == request_msg @@ -20854,7 +20873,6 @@ async def test_set_logging_service_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.SetLoggingServiceRequest() - assert args[0] == request_msg @@ -20893,7 +20911,6 @@ async def test_set_monitoring_service_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.SetMonitoringServiceRequest() - assert args[0] == request_msg @@ -20932,7 +20949,6 @@ async def test_set_addons_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.SetAddonsConfigRequest() - assert args[0] == request_msg @@ -20969,7 +20985,6 @@ async def test_set_locations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.SetLocationsRequest() - assert args[0] == request_msg @@ -21006,7 +21021,6 @@ async def test_update_master_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.UpdateMasterRequest() - assert args[0] == request_msg @@ -21043,7 +21057,6 @@ async def test_set_master_auth_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.SetMasterAuthRequest() - assert args[0] == request_msg @@ -21080,7 +21093,6 @@ async def test_delete_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.DeleteClusterRequest() - assert args[0] == request_msg @@ -21107,7 +21119,6 @@ async def test_list_operations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.ListOperationsRequest() - assert args[0] == request_msg @@ -21144,7 +21155,6 @@ async def test_get_operation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.GetOperationRequest() - assert args[0] == request_msg @@ -21167,7 +21177,6 @@ async def test_cancel_operation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.CancelOperationRequest() - assert args[0] == request_msg @@ -21200,7 +21209,6 @@ async def test_get_server_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.GetServerConfigRequest() - assert args[0] == request_msg @@ -21227,7 +21235,6 @@ async def test_get_json_web_keys_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.GetJSONWebKeysRequest() - assert args[0] == request_msg @@ -21252,7 +21259,6 @@ async def test_list_node_pools_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.ListNodePoolsRequest() - assert args[0] == request_msg @@ -21288,7 +21294,6 @@ async def test_get_node_pool_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.GetNodePoolRequest() - assert args[0] == request_msg @@ -21325,7 +21330,6 @@ async def test_create_node_pool_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.CreateNodePoolRequest() - assert args[0] == request_msg @@ -21362,7 +21366,6 @@ async def test_delete_node_pool_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.DeleteNodePoolRequest() - assert args[0] == request_msg @@ -21387,7 +21390,6 @@ async def test_complete_node_pool_upgrade_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.CompleteNodePoolUpgradeRequest() - assert args[0] == request_msg @@ -21426,7 +21428,6 @@ async def test_rollback_node_pool_upgrade_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.RollbackNodePoolUpgradeRequest() - assert args[0] == request_msg @@ -21465,7 +21466,6 @@ async def test_set_node_pool_management_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.SetNodePoolManagementRequest() - assert args[0] == request_msg @@ -21502,7 +21502,6 @@ async def test_set_labels_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.SetLabelsRequest() - assert args[0] == request_msg @@ -21539,7 +21538,6 @@ async def test_set_legacy_abac_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.SetLegacyAbacRequest() - assert args[0] == request_msg @@ -21578,7 +21576,6 @@ async def test_start_ip_rotation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.StartIPRotationRequest() - assert args[0] == request_msg @@ -21617,7 +21614,6 @@ async def test_complete_ip_rotation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.CompleteIPRotationRequest() - assert args[0] == request_msg @@ -21656,7 +21652,6 @@ async def test_set_node_pool_size_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.SetNodePoolSizeRequest() - assert args[0] == request_msg @@ -21695,7 +21690,6 @@ async def test_set_network_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.SetNetworkPolicyRequest() - assert args[0] == request_msg @@ -21734,7 +21728,6 @@ async def test_set_maintenance_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.SetMaintenancePolicyRequest() - assert args[0] == request_msg @@ -21763,7 +21756,6 @@ async def test_list_usable_subnetworks_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.ListUsableSubnetworksRequest() - assert args[0] == request_msg @@ -21792,7 +21784,6 @@ async def test_check_autopilot_compatibility_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.CheckAutopilotCompatibilityRequest() - assert args[0] == request_msg @@ -21830,7 +21821,6 @@ async def test_fetch_cluster_upgrade_info_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.FetchClusterUpgradeInfoRequest() - assert args[0] == request_msg @@ -21868,7 +21858,6 @@ async def test_fetch_node_pool_upgrade_info_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.FetchNodePoolUpgradeInfoRequest() - assert args[0] == request_msg @@ -27237,7 +27226,6 @@ def test_list_clusters_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.ListClustersRequest() - assert args[0] == request_msg @@ -27257,7 +27245,6 @@ def test_get_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.GetClusterRequest() - assert args[0] == request_msg @@ -27277,7 +27264,6 @@ def test_create_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.CreateClusterRequest() - assert args[0] == request_msg @@ -27297,7 +27283,6 @@ def test_update_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.UpdateClusterRequest() - assert args[0] == request_msg @@ -27317,7 +27302,6 @@ def test_update_node_pool_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.UpdateNodePoolRequest() - assert args[0] == request_msg @@ -27339,7 +27323,6 @@ def test_set_node_pool_autoscaling_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.SetNodePoolAutoscalingRequest() - assert args[0] == request_msg @@ -27361,7 +27344,6 @@ def test_set_logging_service_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.SetLoggingServiceRequest() - assert args[0] == request_msg @@ -27383,7 +27365,6 @@ def test_set_monitoring_service_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.SetMonitoringServiceRequest() - assert args[0] == request_msg @@ -27405,7 +27386,6 @@ def test_set_addons_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.SetAddonsConfigRequest() - assert args[0] == request_msg @@ -27425,7 +27405,6 @@ def test_set_locations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.SetLocationsRequest() - assert args[0] == request_msg @@ -27445,7 +27424,6 @@ def test_update_master_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.UpdateMasterRequest() - assert args[0] == request_msg @@ -27465,7 +27443,6 @@ def test_set_master_auth_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.SetMasterAuthRequest() - assert args[0] == request_msg @@ -27485,7 +27462,6 @@ def test_delete_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.DeleteClusterRequest() - assert args[0] == request_msg @@ -27505,7 +27481,6 @@ def test_list_operations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.ListOperationsRequest() - assert args[0] == request_msg @@ -27525,7 +27500,6 @@ def test_get_operation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.GetOperationRequest() - assert args[0] == request_msg @@ -27545,7 +27519,6 @@ def test_cancel_operation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.CancelOperationRequest() - assert args[0] == request_msg @@ -27567,7 +27540,6 @@ def test_get_server_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.GetServerConfigRequest() - assert args[0] == request_msg @@ -27589,7 +27561,6 @@ def test_get_json_web_keys_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.GetJSONWebKeysRequest() - assert args[0] == request_msg @@ -27609,7 +27580,6 @@ def test_list_node_pools_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.ListNodePoolsRequest() - assert args[0] == request_msg @@ -27629,7 +27599,6 @@ def test_get_node_pool_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.GetNodePoolRequest() - assert args[0] == request_msg @@ -27649,7 +27618,6 @@ def test_create_node_pool_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.CreateNodePoolRequest() - assert args[0] == request_msg @@ -27669,7 +27637,6 @@ def test_delete_node_pool_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.DeleteNodePoolRequest() - assert args[0] == request_msg @@ -27691,7 +27658,6 @@ def test_complete_node_pool_upgrade_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.CompleteNodePoolUpgradeRequest() - assert args[0] == request_msg @@ -27713,7 +27679,6 @@ def test_rollback_node_pool_upgrade_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.RollbackNodePoolUpgradeRequest() - assert args[0] == request_msg @@ -27735,7 +27700,6 @@ def test_set_node_pool_management_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.SetNodePoolManagementRequest() - assert args[0] == request_msg @@ -27755,7 +27719,6 @@ def test_set_labels_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.SetLabelsRequest() - assert args[0] == request_msg @@ -27775,7 +27738,6 @@ def test_set_legacy_abac_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.SetLegacyAbacRequest() - assert args[0] == request_msg @@ -27797,7 +27759,6 @@ def test_start_ip_rotation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.StartIPRotationRequest() - assert args[0] == request_msg @@ -27819,7 +27780,6 @@ def test_complete_ip_rotation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.CompleteIPRotationRequest() - assert args[0] == request_msg @@ -27841,7 +27801,6 @@ def test_set_node_pool_size_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.SetNodePoolSizeRequest() - assert args[0] == request_msg @@ -27863,7 +27822,6 @@ def test_set_network_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.SetNetworkPolicyRequest() - assert args[0] == request_msg @@ -27885,7 +27843,6 @@ def test_set_maintenance_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.SetMaintenancePolicyRequest() - assert args[0] == request_msg @@ -27907,7 +27864,6 @@ def test_list_usable_subnetworks_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.ListUsableSubnetworksRequest() - assert args[0] == request_msg @@ -27929,7 +27885,6 @@ def test_check_autopilot_compatibility_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.CheckAutopilotCompatibilityRequest() - assert args[0] == request_msg @@ -27951,7 +27906,6 @@ def test_fetch_cluster_upgrade_info_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.FetchClusterUpgradeInfoRequest() - assert args[0] == request_msg @@ -27973,7 +27927,6 @@ def test_fetch_node_pool_upgrade_info_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.FetchNodePoolUpgradeInfoRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-container/tests/unit/gapic/container_v1beta1/test_cluster_manager.py b/packages/google-cloud-container/tests/unit/gapic/container_v1beta1/test_cluster_manager.py index ff68944be80e..b12b0d51ab50 100644 --- a/packages/google-cloud-container/tests/unit/gapic/container_v1beta1/test_cluster_manager.py +++ b/packages/google-cloud-container/tests/unit/gapic/container_v1beta1/test_cluster_manager.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" @@ -1301,8 +1317,8 @@ def test_cluster_manager_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - cluster_service.ListClustersRequest, - dict, + cluster_service.ListClustersRequest(), + {}, ], ) def test_list_clusters(request_type, transport: str = "grpc"): @@ -1313,7 +1329,7 @@ def test_list_clusters(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_clusters), "__call__") as call: @@ -1359,11 +1375,12 @@ def test_list_clusters_non_empty_request_with_auto_populated_field(): client.list_clusters(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.ListClustersRequest( + request_msg = cluster_service.ListClustersRequest( project_id="project_id_value", zone="zone_value", parent="parent_value", ) + assert args[0] == request_msg def test_list_clusters_use_cached_wrapped_rpc(): @@ -1444,9 +1461,14 @@ async def test_list_clusters_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_clusters_async( - transport: str = "grpc_asyncio", request_type=cluster_service.ListClustersRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.ListClustersRequest(), + {}, + ], +) +async def test_list_clusters_async(request_type, transport: str = "grpc_asyncio"): client = ClusterManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1454,7 +1476,7 @@ async def test_list_clusters_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_clusters), "__call__") as call: @@ -1477,11 +1499,6 @@ async def test_list_clusters_async( assert response.missing_zones == ["missing_zones_value"] -@pytest.mark.asyncio -async def test_list_clusters_async_from_dict(): - await test_list_clusters_async(request_type=dict) - - def test_list_clusters_field_headers(): client = ClusterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1638,8 +1655,8 @@ async def test_list_clusters_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cluster_service.GetClusterRequest, - dict, + cluster_service.GetClusterRequest(), + {}, ], ) def test_get_cluster(request_type, transport: str = "grpc"): @@ -1650,7 +1667,7 @@ def test_get_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_cluster), "__call__") as call: @@ -1767,12 +1784,13 @@ def test_get_cluster_non_empty_request_with_auto_populated_field(): client.get_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.GetClusterRequest( + request_msg = cluster_service.GetClusterRequest( project_id="project_id_value", zone="zone_value", cluster_id="cluster_id_value", name="name_value", ) + assert args[0] == request_msg def test_get_cluster_use_cached_wrapped_rpc(): @@ -1853,9 +1871,14 @@ async def test_get_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_cluster_async( - transport: str = "grpc_asyncio", request_type=cluster_service.GetClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.GetClusterRequest(), + {}, + ], +) +async def test_get_cluster_async(request_type, transport: str = "grpc_asyncio"): client = ClusterManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1863,7 +1886,7 @@ async def test_get_cluster_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_cluster), "__call__") as call: @@ -1956,11 +1979,6 @@ async def test_get_cluster_async( assert response.satisfies_pzi is True -@pytest.mark.asyncio -async def test_get_cluster_async_from_dict(): - await test_get_cluster_async(request_type=dict) - - def test_get_cluster_field_headers(): client = ClusterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2127,8 +2145,8 @@ async def test_get_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cluster_service.CreateClusterRequest, - dict, + cluster_service.CreateClusterRequest(), + {}, ], ) def test_create_cluster(request_type, transport: str = "grpc"): @@ -2139,7 +2157,7 @@ def test_create_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_cluster), "__call__") as call: @@ -2205,11 +2223,12 @@ def test_create_cluster_non_empty_request_with_auto_populated_field(): client.create_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.CreateClusterRequest( + request_msg = cluster_service.CreateClusterRequest( project_id="project_id_value", zone="zone_value", parent="parent_value", ) + assert args[0] == request_msg def test_create_cluster_use_cached_wrapped_rpc(): @@ -2290,9 +2309,14 @@ async def test_create_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_cluster_async( - transport: str = "grpc_asyncio", request_type=cluster_service.CreateClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.CreateClusterRequest(), + {}, + ], +) +async def test_create_cluster_async(request_type, transport: str = "grpc_asyncio"): client = ClusterManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2300,7 +2324,7 @@ async def test_create_cluster_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_cluster), "__call__") as call: @@ -2343,11 +2367,6 @@ async def test_create_cluster_async( assert response.end_time == "end_time_value" -@pytest.mark.asyncio -async def test_create_cluster_async_from_dict(): - await test_create_cluster_async(request_type=dict) - - def test_create_cluster_field_headers(): client = ClusterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2514,8 +2533,8 @@ async def test_create_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cluster_service.UpdateClusterRequest, - dict, + cluster_service.UpdateClusterRequest(), + {}, ], ) def test_update_cluster(request_type, transport: str = "grpc"): @@ -2526,7 +2545,7 @@ def test_update_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_cluster), "__call__") as call: @@ -2593,12 +2612,13 @@ def test_update_cluster_non_empty_request_with_auto_populated_field(): client.update_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.UpdateClusterRequest( + request_msg = cluster_service.UpdateClusterRequest( project_id="project_id_value", zone="zone_value", cluster_id="cluster_id_value", name="name_value", ) + assert args[0] == request_msg def test_update_cluster_use_cached_wrapped_rpc(): @@ -2679,9 +2699,14 @@ async def test_update_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_cluster_async( - transport: str = "grpc_asyncio", request_type=cluster_service.UpdateClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.UpdateClusterRequest(), + {}, + ], +) +async def test_update_cluster_async(request_type, transport: str = "grpc_asyncio"): client = ClusterManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2689,7 +2714,7 @@ async def test_update_cluster_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_cluster), "__call__") as call: @@ -2732,11 +2757,6 @@ async def test_update_cluster_async( assert response.end_time == "end_time_value" -@pytest.mark.asyncio -async def test_update_cluster_async_from_dict(): - await test_update_cluster_async(request_type=dict) - - def test_update_cluster_field_headers(): client = ClusterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2925,8 +2945,8 @@ async def test_update_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cluster_service.UpdateNodePoolRequest, - dict, + cluster_service.UpdateNodePoolRequest(), + {}, ], ) def test_update_node_pool(request_type, transport: str = "grpc"): @@ -2937,7 +2957,7 @@ def test_update_node_pool(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_node_pool), "__call__") as call: @@ -3010,7 +3030,7 @@ def test_update_node_pool_non_empty_request_with_auto_populated_field(): client.update_node_pool(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.UpdateNodePoolRequest( + request_msg = cluster_service.UpdateNodePoolRequest( project_id="project_id_value", zone="zone_value", cluster_id="cluster_id_value", @@ -3022,6 +3042,7 @@ def test_update_node_pool_non_empty_request_with_auto_populated_field(): machine_type="machine_type_value", disk_type="disk_type_value", ) + assert args[0] == request_msg def test_update_node_pool_use_cached_wrapped_rpc(): @@ -3104,9 +3125,14 @@ async def test_update_node_pool_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_node_pool_async( - transport: str = "grpc_asyncio", request_type=cluster_service.UpdateNodePoolRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.UpdateNodePoolRequest(), + {}, + ], +) +async def test_update_node_pool_async(request_type, transport: str = "grpc_asyncio"): client = ClusterManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3114,7 +3140,7 @@ async def test_update_node_pool_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_node_pool), "__call__") as call: @@ -3157,11 +3183,6 @@ async def test_update_node_pool_async( assert response.end_time == "end_time_value" -@pytest.mark.asyncio -async def test_update_node_pool_async_from_dict(): - await test_update_node_pool_async(request_type=dict) - - def test_update_node_pool_field_headers(): client = ClusterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3226,8 +3247,8 @@ async def test_update_node_pool_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - cluster_service.SetNodePoolAutoscalingRequest, - dict, + cluster_service.SetNodePoolAutoscalingRequest(), + {}, ], ) def test_set_node_pool_autoscaling(request_type, transport: str = "grpc"): @@ -3238,7 +3259,7 @@ def test_set_node_pool_autoscaling(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3310,13 +3331,14 @@ def test_set_node_pool_autoscaling_non_empty_request_with_auto_populated_field() client.set_node_pool_autoscaling(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetNodePoolAutoscalingRequest( + request_msg = cluster_service.SetNodePoolAutoscalingRequest( project_id="project_id_value", zone="zone_value", cluster_id="cluster_id_value", node_pool_id="node_pool_id_value", name="name_value", ) + assert args[0] == request_msg def test_set_node_pool_autoscaling_use_cached_wrapped_rpc(): @@ -3402,9 +3424,15 @@ async def test_set_node_pool_autoscaling_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.SetNodePoolAutoscalingRequest(), + {}, + ], +) async def test_set_node_pool_autoscaling_async( - transport: str = "grpc_asyncio", - request_type=cluster_service.SetNodePoolAutoscalingRequest, + request_type, transport: str = "grpc_asyncio" ): client = ClusterManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -3413,7 +3441,7 @@ async def test_set_node_pool_autoscaling_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( @@ -3458,11 +3486,6 @@ async def test_set_node_pool_autoscaling_async( assert response.end_time == "end_time_value" -@pytest.mark.asyncio -async def test_set_node_pool_autoscaling_async_from_dict(): - await test_set_node_pool_autoscaling_async(request_type=dict) - - def test_set_node_pool_autoscaling_field_headers(): client = ClusterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3531,8 +3554,8 @@ async def test_set_node_pool_autoscaling_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - cluster_service.SetLoggingServiceRequest, - dict, + cluster_service.SetLoggingServiceRequest(), + {}, ], ) def test_set_logging_service(request_type, transport: str = "grpc"): @@ -3543,7 +3566,7 @@ def test_set_logging_service(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3615,13 +3638,14 @@ def test_set_logging_service_non_empty_request_with_auto_populated_field(): client.set_logging_service(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetLoggingServiceRequest( + request_msg = cluster_service.SetLoggingServiceRequest( project_id="project_id_value", zone="zone_value", cluster_id="cluster_id_value", logging_service="logging_service_value", name="name_value", ) + assert args[0] == request_msg def test_set_logging_service_use_cached_wrapped_rpc(): @@ -3706,10 +3730,14 @@ async def test_set_logging_service_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_logging_service_async( - transport: str = "grpc_asyncio", - request_type=cluster_service.SetLoggingServiceRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.SetLoggingServiceRequest(), + {}, + ], +) +async def test_set_logging_service_async(request_type, transport: str = "grpc_asyncio"): client = ClusterManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3717,7 +3745,7 @@ async def test_set_logging_service_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( @@ -3762,11 +3790,6 @@ async def test_set_logging_service_async( assert response.end_time == "end_time_value" -@pytest.mark.asyncio -async def test_set_logging_service_async_from_dict(): - await test_set_logging_service_async(request_type=dict) - - def test_set_logging_service_field_headers(): client = ClusterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3951,8 +3974,8 @@ async def test_set_logging_service_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cluster_service.SetMonitoringServiceRequest, - dict, + cluster_service.SetMonitoringServiceRequest(), + {}, ], ) def test_set_monitoring_service(request_type, transport: str = "grpc"): @@ -3963,7 +3986,7 @@ def test_set_monitoring_service(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4035,13 +4058,14 @@ def test_set_monitoring_service_non_empty_request_with_auto_populated_field(): client.set_monitoring_service(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetMonitoringServiceRequest( + request_msg = cluster_service.SetMonitoringServiceRequest( project_id="project_id_value", zone="zone_value", cluster_id="cluster_id_value", monitoring_service="monitoring_service_value", name="name_value", ) + assert args[0] == request_msg def test_set_monitoring_service_use_cached_wrapped_rpc(): @@ -4127,9 +4151,15 @@ async def test_set_monitoring_service_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.SetMonitoringServiceRequest(), + {}, + ], +) async def test_set_monitoring_service_async( - transport: str = "grpc_asyncio", - request_type=cluster_service.SetMonitoringServiceRequest, + request_type, transport: str = "grpc_asyncio" ): client = ClusterManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -4138,7 +4168,7 @@ async def test_set_monitoring_service_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( @@ -4183,11 +4213,6 @@ async def test_set_monitoring_service_async( assert response.end_time == "end_time_value" -@pytest.mark.asyncio -async def test_set_monitoring_service_async_from_dict(): - await test_set_monitoring_service_async(request_type=dict) - - def test_set_monitoring_service_field_headers(): client = ClusterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4372,8 +4397,8 @@ async def test_set_monitoring_service_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cluster_service.SetAddonsConfigRequest, - dict, + cluster_service.SetAddonsConfigRequest(), + {}, ], ) def test_set_addons_config(request_type, transport: str = "grpc"): @@ -4384,7 +4409,7 @@ def test_set_addons_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( @@ -4455,12 +4480,13 @@ def test_set_addons_config_non_empty_request_with_auto_populated_field(): client.set_addons_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetAddonsConfigRequest( + request_msg = cluster_service.SetAddonsConfigRequest( project_id="project_id_value", zone="zone_value", cluster_id="cluster_id_value", name="name_value", ) + assert args[0] == request_msg def test_set_addons_config_use_cached_wrapped_rpc(): @@ -4543,9 +4569,14 @@ async def test_set_addons_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_addons_config_async( - transport: str = "grpc_asyncio", request_type=cluster_service.SetAddonsConfigRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.SetAddonsConfigRequest(), + {}, + ], +) +async def test_set_addons_config_async(request_type, transport: str = "grpc_asyncio"): client = ClusterManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4553,7 +4584,7 @@ async def test_set_addons_config_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( @@ -4598,11 +4629,6 @@ async def test_set_addons_config_async( assert response.end_time == "end_time_value" -@pytest.mark.asyncio -async def test_set_addons_config_async_from_dict(): - await test_set_addons_config_async(request_type=dict) - - def test_set_addons_config_field_headers(): client = ClusterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4799,8 +4825,8 @@ async def test_set_addons_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cluster_service.SetLocationsRequest, - dict, + cluster_service.SetLocationsRequest(), + {}, ], ) def test_set_locations(request_type, transport: str = "grpc"): @@ -4811,7 +4837,7 @@ def test_set_locations(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.set_locations), "__call__") as call: @@ -4878,12 +4904,13 @@ def test_set_locations_non_empty_request_with_auto_populated_field(): client.set_locations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetLocationsRequest( + request_msg = cluster_service.SetLocationsRequest( project_id="project_id_value", zone="zone_value", cluster_id="cluster_id_value", name="name_value", ) + assert args[0] == request_msg def test_set_locations_use_cached_wrapped_rpc(): @@ -4964,9 +4991,14 @@ async def test_set_locations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_locations_async( - transport: str = "grpc_asyncio", request_type=cluster_service.SetLocationsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.SetLocationsRequest(), + {}, + ], +) +async def test_set_locations_async(request_type, transport: str = "grpc_asyncio"): client = ClusterManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4974,7 +5006,7 @@ async def test_set_locations_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.set_locations), "__call__") as call: @@ -5017,11 +5049,6 @@ async def test_set_locations_async( assert response.end_time == "end_time_value" -@pytest.mark.asyncio -async def test_set_locations_async_from_dict(): - await test_set_locations_async(request_type=dict) - - def test_set_locations_field_headers(): client = ClusterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5198,8 +5225,8 @@ async def test_set_locations_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cluster_service.UpdateMasterRequest, - dict, + cluster_service.UpdateMasterRequest(), + {}, ], ) def test_update_master(request_type, transport: str = "grpc"): @@ -5210,7 +5237,7 @@ def test_update_master(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_master), "__call__") as call: @@ -5278,13 +5305,14 @@ def test_update_master_non_empty_request_with_auto_populated_field(): client.update_master(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.UpdateMasterRequest( + request_msg = cluster_service.UpdateMasterRequest( project_id="project_id_value", zone="zone_value", cluster_id="cluster_id_value", master_version="master_version_value", name="name_value", ) + assert args[0] == request_msg def test_update_master_use_cached_wrapped_rpc(): @@ -5365,9 +5393,14 @@ async def test_update_master_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_master_async( - transport: str = "grpc_asyncio", request_type=cluster_service.UpdateMasterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.UpdateMasterRequest(), + {}, + ], +) +async def test_update_master_async(request_type, transport: str = "grpc_asyncio"): client = ClusterManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5375,7 +5408,7 @@ async def test_update_master_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_master), "__call__") as call: @@ -5418,11 +5451,6 @@ async def test_update_master_async( assert response.end_time == "end_time_value" -@pytest.mark.asyncio -async def test_update_master_async_from_dict(): - await test_update_master_async(request_type=dict) - - def test_update_master_field_headers(): client = ClusterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5599,8 +5627,8 @@ async def test_update_master_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cluster_service.SetMasterAuthRequest, - dict, + cluster_service.SetMasterAuthRequest(), + {}, ], ) def test_set_master_auth(request_type, transport: str = "grpc"): @@ -5611,7 +5639,7 @@ def test_set_master_auth(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.set_master_auth), "__call__") as call: @@ -5678,12 +5706,13 @@ def test_set_master_auth_non_empty_request_with_auto_populated_field(): client.set_master_auth(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetMasterAuthRequest( + request_msg = cluster_service.SetMasterAuthRequest( project_id="project_id_value", zone="zone_value", cluster_id="cluster_id_value", name="name_value", ) + assert args[0] == request_msg def test_set_master_auth_use_cached_wrapped_rpc(): @@ -5764,9 +5793,14 @@ async def test_set_master_auth_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_master_auth_async( - transport: str = "grpc_asyncio", request_type=cluster_service.SetMasterAuthRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.SetMasterAuthRequest(), + {}, + ], +) +async def test_set_master_auth_async(request_type, transport: str = "grpc_asyncio"): client = ClusterManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5774,7 +5808,7 @@ async def test_set_master_auth_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.set_master_auth), "__call__") as call: @@ -5817,11 +5851,6 @@ async def test_set_master_auth_async( assert response.end_time == "end_time_value" -@pytest.mark.asyncio -async def test_set_master_auth_async_from_dict(): - await test_set_master_auth_async(request_type=dict) - - def test_set_master_auth_field_headers(): client = ClusterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5886,8 +5915,8 @@ async def test_set_master_auth_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - cluster_service.DeleteClusterRequest, - dict, + cluster_service.DeleteClusterRequest(), + {}, ], ) def test_delete_cluster(request_type, transport: str = "grpc"): @@ -5898,7 +5927,7 @@ def test_delete_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_cluster), "__call__") as call: @@ -5965,12 +5994,13 @@ def test_delete_cluster_non_empty_request_with_auto_populated_field(): client.delete_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.DeleteClusterRequest( + request_msg = cluster_service.DeleteClusterRequest( project_id="project_id_value", zone="zone_value", cluster_id="cluster_id_value", name="name_value", ) + assert args[0] == request_msg def test_delete_cluster_use_cached_wrapped_rpc(): @@ -6051,9 +6081,14 @@ async def test_delete_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_cluster_async( - transport: str = "grpc_asyncio", request_type=cluster_service.DeleteClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.DeleteClusterRequest(), + {}, + ], +) +async def test_delete_cluster_async(request_type, transport: str = "grpc_asyncio"): client = ClusterManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6061,7 +6096,7 @@ async def test_delete_cluster_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_cluster), "__call__") as call: @@ -6104,11 +6139,6 @@ async def test_delete_cluster_async( assert response.end_time == "end_time_value" -@pytest.mark.asyncio -async def test_delete_cluster_async_from_dict(): - await test_delete_cluster_async(request_type=dict) - - def test_delete_cluster_field_headers(): client = ClusterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6275,8 +6305,8 @@ async def test_delete_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cluster_service.ListOperationsRequest, - dict, + cluster_service.ListOperationsRequest(), + {}, ], ) def test_list_operations(request_type, transport: str = "grpc"): @@ -6287,7 +6317,7 @@ def test_list_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(type(client.transport.list_operations), "__call__") as call: @@ -6333,11 +6363,12 @@ def test_list_operations_non_empty_request_with_auto_populated_field(): client.list_operations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.ListOperationsRequest( + request_msg = cluster_service.ListOperationsRequest( project_id="project_id_value", zone="zone_value", parent="parent_value", ) + assert args[0] == request_msg def test_list_operations_use_cached_wrapped_rpc(): @@ -6418,9 +6449,14 @@ async def test_list_operations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_operations_async( - transport: str = "grpc_asyncio", request_type=cluster_service.ListOperationsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.ListOperationsRequest(), + {}, + ], +) +async def test_list_operations_async(request_type, transport: str = "grpc_asyncio"): client = ClusterManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6428,7 +6464,7 @@ async def test_list_operations_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_operations), "__call__") as call: @@ -6451,11 +6487,6 @@ async def test_list_operations_async( assert response.missing_zones == ["missing_zones_value"] -@pytest.mark.asyncio -async def test_list_operations_async_from_dict(): - await test_list_operations_async(request_type=dict) - - def test_list_operations_field_headers(): client = ClusterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6612,8 +6643,8 @@ async def test_list_operations_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cluster_service.GetOperationRequest, - dict, + cluster_service.GetOperationRequest(), + {}, ], ) def test_get_operation(request_type, transport: str = "grpc"): @@ -6624,7 +6655,7 @@ def test_get_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(type(client.transport.get_operation), "__call__") as call: @@ -6691,12 +6722,13 @@ def test_get_operation_non_empty_request_with_auto_populated_field(): client.get_operation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.GetOperationRequest( + request_msg = cluster_service.GetOperationRequest( project_id="project_id_value", zone="zone_value", operation_id="operation_id_value", name="name_value", ) + assert args[0] == request_msg def test_get_operation_use_cached_wrapped_rpc(): @@ -6777,9 +6809,14 @@ async def test_get_operation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_operation_async( - transport: str = "grpc_asyncio", request_type=cluster_service.GetOperationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.GetOperationRequest(), + {}, + ], +) +async def test_get_operation_async(request_type, transport: str = "grpc_asyncio"): client = ClusterManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6787,7 +6824,7 @@ async def test_get_operation_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_operation), "__call__") as call: @@ -6830,11 +6867,6 @@ async def test_get_operation_async( assert response.end_time == "end_time_value" -@pytest.mark.asyncio -async def test_get_operation_async_from_dict(): - await test_get_operation_async(request_type=dict) - - def test_get_operation_field_headers(): client = ClusterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7001,8 +7033,8 @@ async def test_get_operation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cluster_service.CancelOperationRequest, - dict, + cluster_service.CancelOperationRequest(), + {}, ], ) def test_cancel_operation(request_type, transport: str = "grpc"): @@ -7013,7 +7045,7 @@ def test_cancel_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(type(client.transport.cancel_operation), "__call__") as call: @@ -7057,12 +7089,13 @@ def test_cancel_operation_non_empty_request_with_auto_populated_field(): client.cancel_operation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.CancelOperationRequest( + request_msg = cluster_service.CancelOperationRequest( project_id="project_id_value", zone="zone_value", operation_id="operation_id_value", name="name_value", ) + assert args[0] == request_msg def test_cancel_operation_use_cached_wrapped_rpc(): @@ -7145,9 +7178,14 @@ async def test_cancel_operation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_cancel_operation_async( - transport: str = "grpc_asyncio", request_type=cluster_service.CancelOperationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.CancelOperationRequest(), + {}, + ], +) +async def test_cancel_operation_async(request_type, transport: str = "grpc_asyncio"): client = ClusterManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7155,7 +7193,7 @@ async def test_cancel_operation_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.cancel_operation), "__call__") as call: @@ -7173,11 +7211,6 @@ async def test_cancel_operation_async( assert response is None -@pytest.mark.asyncio -async def test_cancel_operation_async_from_dict(): - await test_cancel_operation_async(request_type=dict) - - def test_cancel_operation_field_headers(): client = ClusterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7340,8 +7373,8 @@ async def test_cancel_operation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cluster_service.GetServerConfigRequest, - dict, + cluster_service.GetServerConfigRequest(), + {}, ], ) def test_get_server_config(request_type, transport: str = "grpc"): @@ -7352,7 +7385,7 @@ def test_get_server_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( @@ -7410,11 +7443,12 @@ def test_get_server_config_non_empty_request_with_auto_populated_field(): client.get_server_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.GetServerConfigRequest( + request_msg = cluster_service.GetServerConfigRequest( project_id="project_id_value", zone="zone_value", name="name_value", ) + assert args[0] == request_msg def test_get_server_config_use_cached_wrapped_rpc(): @@ -7497,9 +7531,14 @@ async def test_get_server_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_server_config_async( - transport: str = "grpc_asyncio", request_type=cluster_service.GetServerConfigRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.GetServerConfigRequest(), + {}, + ], +) +async def test_get_server_config_async(request_type, transport: str = "grpc_asyncio"): client = ClusterManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7507,7 +7546,7 @@ async def test_get_server_config_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( @@ -7540,11 +7579,6 @@ async def test_get_server_config_async( assert response.valid_master_versions == ["valid_master_versions_value"] -@pytest.mark.asyncio -async def test_get_server_config_async_from_dict(): - await test_get_server_config_async(request_type=dict) - - def test_get_server_config_field_headers(): client = ClusterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7709,8 +7743,8 @@ async def test_get_server_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cluster_service.GetJSONWebKeysRequest, - dict, + cluster_service.GetJSONWebKeysRequest(), + {}, ], ) def test_get_json_web_keys(request_type, transport: str = "grpc"): @@ -7721,7 +7755,7 @@ def test_get_json_web_keys(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7766,9 +7800,10 @@ def test_get_json_web_keys_non_empty_request_with_auto_populated_field(): client.get_json_web_keys(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.GetJSONWebKeysRequest( + request_msg = cluster_service.GetJSONWebKeysRequest( parent="parent_value", ) + assert args[0] == request_msg def test_get_json_web_keys_use_cached_wrapped_rpc(): @@ -7851,9 +7886,14 @@ async def test_get_json_web_keys_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_json_web_keys_async( - transport: str = "grpc_asyncio", request_type=cluster_service.GetJSONWebKeysRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.GetJSONWebKeysRequest(), + {}, + ], +) +async def test_get_json_web_keys_async(request_type, transport: str = "grpc_asyncio"): client = ClusterManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7861,7 +7901,7 @@ async def test_get_json_web_keys_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( @@ -7883,11 +7923,6 @@ async def test_get_json_web_keys_async( assert isinstance(response, cluster_service.GetJSONWebKeysResponse) -@pytest.mark.asyncio -async def test_get_json_web_keys_async_from_dict(): - await test_get_json_web_keys_async(request_type=dict) - - def test_get_json_web_keys_field_headers(): client = ClusterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7956,8 +7991,8 @@ async def test_get_json_web_keys_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - cluster_service.ListNodePoolsRequest, - dict, + cluster_service.ListNodePoolsRequest(), + {}, ], ) def test_list_node_pools(request_type, transport: str = "grpc"): @@ -7968,7 +8003,7 @@ def test_list_node_pools(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_node_pools), "__call__") as call: @@ -8012,12 +8047,13 @@ def test_list_node_pools_non_empty_request_with_auto_populated_field(): client.list_node_pools(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.ListNodePoolsRequest( + request_msg = cluster_service.ListNodePoolsRequest( project_id="project_id_value", zone="zone_value", cluster_id="cluster_id_value", parent="parent_value", ) + assert args[0] == request_msg def test_list_node_pools_use_cached_wrapped_rpc(): @@ -8098,9 +8134,14 @@ async def test_list_node_pools_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_node_pools_async( - transport: str = "grpc_asyncio", request_type=cluster_service.ListNodePoolsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.ListNodePoolsRequest(), + {}, + ], +) +async def test_list_node_pools_async(request_type, transport: str = "grpc_asyncio"): client = ClusterManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8108,7 +8149,7 @@ async def test_list_node_pools_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_node_pools), "__call__") as call: @@ -8128,11 +8169,6 @@ async def test_list_node_pools_async( assert isinstance(response, cluster_service.ListNodePoolsResponse) -@pytest.mark.asyncio -async def test_list_node_pools_async_from_dict(): - await test_list_node_pools_async(request_type=dict) - - def test_list_node_pools_field_headers(): client = ClusterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8299,8 +8335,8 @@ async def test_list_node_pools_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cluster_service.GetNodePoolRequest, - dict, + cluster_service.GetNodePoolRequest(), + {}, ], ) def test_get_node_pool(request_type, transport: str = "grpc"): @@ -8311,7 +8347,7 @@ def test_get_node_pool(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_node_pool), "__call__") as call: @@ -8377,13 +8413,14 @@ def test_get_node_pool_non_empty_request_with_auto_populated_field(): client.get_node_pool(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.GetNodePoolRequest( + request_msg = cluster_service.GetNodePoolRequest( project_id="project_id_value", zone="zone_value", cluster_id="cluster_id_value", node_pool_id="node_pool_id_value", name="name_value", ) + assert args[0] == request_msg def test_get_node_pool_use_cached_wrapped_rpc(): @@ -8464,9 +8501,14 @@ async def test_get_node_pool_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_node_pool_async( - transport: str = "grpc_asyncio", request_type=cluster_service.GetNodePoolRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.GetNodePoolRequest(), + {}, + ], +) +async def test_get_node_pool_async(request_type, transport: str = "grpc_asyncio"): client = ClusterManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8474,7 +8516,7 @@ async def test_get_node_pool_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_node_pool), "__call__") as call: @@ -8515,11 +8557,6 @@ async def test_get_node_pool_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_node_pool_async_from_dict(): - await test_get_node_pool_async(request_type=dict) - - def test_get_node_pool_field_headers(): client = ClusterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8696,8 +8733,8 @@ async def test_get_node_pool_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cluster_service.CreateNodePoolRequest, - dict, + cluster_service.CreateNodePoolRequest(), + {}, ], ) def test_create_node_pool(request_type, transport: str = "grpc"): @@ -8708,7 +8745,7 @@ def test_create_node_pool(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_node_pool), "__call__") as call: @@ -8775,12 +8812,13 @@ def test_create_node_pool_non_empty_request_with_auto_populated_field(): client.create_node_pool(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.CreateNodePoolRequest( + request_msg = cluster_service.CreateNodePoolRequest( project_id="project_id_value", zone="zone_value", cluster_id="cluster_id_value", parent="parent_value", ) + assert args[0] == request_msg def test_create_node_pool_use_cached_wrapped_rpc(): @@ -8863,9 +8901,14 @@ async def test_create_node_pool_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_node_pool_async( - transport: str = "grpc_asyncio", request_type=cluster_service.CreateNodePoolRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.CreateNodePoolRequest(), + {}, + ], +) +async def test_create_node_pool_async(request_type, transport: str = "grpc_asyncio"): client = ClusterManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8873,7 +8916,7 @@ async def test_create_node_pool_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_node_pool), "__call__") as call: @@ -8916,11 +8959,6 @@ async def test_create_node_pool_async( assert response.end_time == "end_time_value" -@pytest.mark.asyncio -async def test_create_node_pool_async_from_dict(): - await test_create_node_pool_async(request_type=dict) - - def test_create_node_pool_field_headers(): client = ClusterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9097,8 +9135,8 @@ async def test_create_node_pool_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cluster_service.DeleteNodePoolRequest, - dict, + cluster_service.DeleteNodePoolRequest(), + {}, ], ) def test_delete_node_pool(request_type, transport: str = "grpc"): @@ -9109,7 +9147,7 @@ def test_delete_node_pool(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_node_pool), "__call__") as call: @@ -9177,13 +9215,14 @@ def test_delete_node_pool_non_empty_request_with_auto_populated_field(): client.delete_node_pool(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.DeleteNodePoolRequest( + request_msg = cluster_service.DeleteNodePoolRequest( project_id="project_id_value", zone="zone_value", cluster_id="cluster_id_value", node_pool_id="node_pool_id_value", name="name_value", ) + assert args[0] == request_msg def test_delete_node_pool_use_cached_wrapped_rpc(): @@ -9266,9 +9305,14 @@ async def test_delete_node_pool_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_node_pool_async( - transport: str = "grpc_asyncio", request_type=cluster_service.DeleteNodePoolRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.DeleteNodePoolRequest(), + {}, + ], +) +async def test_delete_node_pool_async(request_type, transport: str = "grpc_asyncio"): client = ClusterManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9276,7 +9320,7 @@ async def test_delete_node_pool_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_node_pool), "__call__") as call: @@ -9319,11 +9363,6 @@ async def test_delete_node_pool_async( assert response.end_time == "end_time_value" -@pytest.mark.asyncio -async def test_delete_node_pool_async_from_dict(): - await test_delete_node_pool_async(request_type=dict) - - def test_delete_node_pool_field_headers(): client = ClusterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9500,8 +9539,8 @@ async def test_delete_node_pool_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cluster_service.CompleteNodePoolUpgradeRequest, - dict, + cluster_service.CompleteNodePoolUpgradeRequest(), + {}, ], ) def test_complete_node_pool_upgrade(request_type, transport: str = "grpc"): @@ -9512,7 +9551,7 @@ def test_complete_node_pool_upgrade(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9557,9 +9596,10 @@ def test_complete_node_pool_upgrade_non_empty_request_with_auto_populated_field( client.complete_node_pool_upgrade(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.CompleteNodePoolUpgradeRequest( + request_msg = cluster_service.CompleteNodePoolUpgradeRequest( name="name_value", ) + assert args[0] == request_msg def test_complete_node_pool_upgrade_use_cached_wrapped_rpc(): @@ -9645,9 +9685,15 @@ async def test_complete_node_pool_upgrade_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.CompleteNodePoolUpgradeRequest(), + {}, + ], +) async def test_complete_node_pool_upgrade_async( - transport: str = "grpc_asyncio", - request_type=cluster_service.CompleteNodePoolUpgradeRequest, + request_type, transport: str = "grpc_asyncio" ): client = ClusterManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -9656,7 +9702,7 @@ async def test_complete_node_pool_upgrade_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( @@ -9676,11 +9722,6 @@ async def test_complete_node_pool_upgrade_async( assert response is None -@pytest.mark.asyncio -async def test_complete_node_pool_upgrade_async_from_dict(): - await test_complete_node_pool_upgrade_async(request_type=dict) - - def test_complete_node_pool_upgrade_field_headers(): client = ClusterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9747,8 +9788,8 @@ async def test_complete_node_pool_upgrade_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - cluster_service.RollbackNodePoolUpgradeRequest, - dict, + cluster_service.RollbackNodePoolUpgradeRequest(), + {}, ], ) def test_rollback_node_pool_upgrade(request_type, transport: str = "grpc"): @@ -9759,7 +9800,7 @@ def test_rollback_node_pool_upgrade(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9831,13 +9872,14 @@ def test_rollback_node_pool_upgrade_non_empty_request_with_auto_populated_field( client.rollback_node_pool_upgrade(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.RollbackNodePoolUpgradeRequest( + request_msg = cluster_service.RollbackNodePoolUpgradeRequest( project_id="project_id_value", zone="zone_value", cluster_id="cluster_id_value", node_pool_id="node_pool_id_value", name="name_value", ) + assert args[0] == request_msg def test_rollback_node_pool_upgrade_use_cached_wrapped_rpc(): @@ -9923,9 +9965,15 @@ async def test_rollback_node_pool_upgrade_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.RollbackNodePoolUpgradeRequest(), + {}, + ], +) async def test_rollback_node_pool_upgrade_async( - transport: str = "grpc_asyncio", - request_type=cluster_service.RollbackNodePoolUpgradeRequest, + request_type, transport: str = "grpc_asyncio" ): client = ClusterManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -9934,7 +9982,7 @@ async def test_rollback_node_pool_upgrade_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( @@ -9979,11 +10027,6 @@ async def test_rollback_node_pool_upgrade_async( assert response.end_time == "end_time_value" -@pytest.mark.asyncio -async def test_rollback_node_pool_upgrade_async_from_dict(): - await test_rollback_node_pool_upgrade_async(request_type=dict) - - def test_rollback_node_pool_upgrade_field_headers(): client = ClusterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10168,8 +10211,8 @@ async def test_rollback_node_pool_upgrade_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cluster_service.SetNodePoolManagementRequest, - dict, + cluster_service.SetNodePoolManagementRequest(), + {}, ], ) def test_set_node_pool_management(request_type, transport: str = "grpc"): @@ -10180,7 +10223,7 @@ def test_set_node_pool_management(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10252,13 +10295,14 @@ def test_set_node_pool_management_non_empty_request_with_auto_populated_field(): client.set_node_pool_management(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetNodePoolManagementRequest( + request_msg = cluster_service.SetNodePoolManagementRequest( project_id="project_id_value", zone="zone_value", cluster_id="cluster_id_value", node_pool_id="node_pool_id_value", name="name_value", ) + assert args[0] == request_msg def test_set_node_pool_management_use_cached_wrapped_rpc(): @@ -10344,9 +10388,15 @@ async def test_set_node_pool_management_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.SetNodePoolManagementRequest(), + {}, + ], +) async def test_set_node_pool_management_async( - transport: str = "grpc_asyncio", - request_type=cluster_service.SetNodePoolManagementRequest, + request_type, transport: str = "grpc_asyncio" ): client = ClusterManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -10355,7 +10405,7 @@ async def test_set_node_pool_management_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( @@ -10400,11 +10450,6 @@ async def test_set_node_pool_management_async( assert response.end_time == "end_time_value" -@pytest.mark.asyncio -async def test_set_node_pool_management_async_from_dict(): - await test_set_node_pool_management_async(request_type=dict) - - def test_set_node_pool_management_field_headers(): client = ClusterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10599,8 +10644,8 @@ async def test_set_node_pool_management_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cluster_service.SetLabelsRequest, - dict, + cluster_service.SetLabelsRequest(), + {}, ], ) def test_set_labels(request_type, transport: str = "grpc"): @@ -10611,7 +10656,7 @@ def test_set_labels(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.set_labels), "__call__") as call: @@ -10679,13 +10724,14 @@ def test_set_labels_non_empty_request_with_auto_populated_field(): client.set_labels(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetLabelsRequest( + request_msg = cluster_service.SetLabelsRequest( project_id="project_id_value", zone="zone_value", cluster_id="cluster_id_value", label_fingerprint="label_fingerprint_value", name="name_value", ) + assert args[0] == request_msg def test_set_labels_use_cached_wrapped_rpc(): @@ -10764,9 +10810,14 @@ async def test_set_labels_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_set_labels_async( - transport: str = "grpc_asyncio", request_type=cluster_service.SetLabelsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.SetLabelsRequest(), + {}, + ], +) +async def test_set_labels_async(request_type, transport: str = "grpc_asyncio"): client = ClusterManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10774,7 +10825,7 @@ async def test_set_labels_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.set_labels), "__call__") as call: @@ -10817,11 +10868,6 @@ async def test_set_labels_async( assert response.end_time == "end_time_value" -@pytest.mark.asyncio -async def test_set_labels_async_from_dict(): - await test_set_labels_async(request_type=dict) - - def test_set_labels_field_headers(): client = ClusterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11008,8 +11054,8 @@ async def test_set_labels_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cluster_service.SetLegacyAbacRequest, - dict, + cluster_service.SetLegacyAbacRequest(), + {}, ], ) def test_set_legacy_abac(request_type, transport: str = "grpc"): @@ -11020,7 +11066,7 @@ def test_set_legacy_abac(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.set_legacy_abac), "__call__") as call: @@ -11087,12 +11133,13 @@ def test_set_legacy_abac_non_empty_request_with_auto_populated_field(): client.set_legacy_abac(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetLegacyAbacRequest( + request_msg = cluster_service.SetLegacyAbacRequest( project_id="project_id_value", zone="zone_value", cluster_id="cluster_id_value", name="name_value", ) + assert args[0] == request_msg def test_set_legacy_abac_use_cached_wrapped_rpc(): @@ -11173,9 +11220,14 @@ async def test_set_legacy_abac_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_legacy_abac_async( - transport: str = "grpc_asyncio", request_type=cluster_service.SetLegacyAbacRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.SetLegacyAbacRequest(), + {}, + ], +) +async def test_set_legacy_abac_async(request_type, transport: str = "grpc_asyncio"): client = ClusterManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11183,7 +11235,7 @@ async def test_set_legacy_abac_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.set_legacy_abac), "__call__") as call: @@ -11226,11 +11278,6 @@ async def test_set_legacy_abac_async( assert response.end_time == "end_time_value" -@pytest.mark.asyncio -async def test_set_legacy_abac_async_from_dict(): - await test_set_legacy_abac_async(request_type=dict) - - def test_set_legacy_abac_field_headers(): client = ClusterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11407,8 +11454,8 @@ async def test_set_legacy_abac_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cluster_service.StartIPRotationRequest, - dict, + cluster_service.StartIPRotationRequest(), + {}, ], ) def test_start_ip_rotation(request_type, transport: str = "grpc"): @@ -11419,7 +11466,7 @@ def test_start_ip_rotation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11490,12 +11537,13 @@ def test_start_ip_rotation_non_empty_request_with_auto_populated_field(): client.start_ip_rotation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.StartIPRotationRequest( + request_msg = cluster_service.StartIPRotationRequest( project_id="project_id_value", zone="zone_value", cluster_id="cluster_id_value", name="name_value", ) + assert args[0] == request_msg def test_start_ip_rotation_use_cached_wrapped_rpc(): @@ -11578,9 +11626,14 @@ async def test_start_ip_rotation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_start_ip_rotation_async( - transport: str = "grpc_asyncio", request_type=cluster_service.StartIPRotationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.StartIPRotationRequest(), + {}, + ], +) +async def test_start_ip_rotation_async(request_type, transport: str = "grpc_asyncio"): client = ClusterManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11588,7 +11641,7 @@ async def test_start_ip_rotation_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( @@ -11633,11 +11686,6 @@ async def test_start_ip_rotation_async( assert response.end_time == "end_time_value" -@pytest.mark.asyncio -async def test_start_ip_rotation_async_from_dict(): - await test_start_ip_rotation_async(request_type=dict) - - def test_start_ip_rotation_field_headers(): client = ClusterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11812,8 +11860,8 @@ async def test_start_ip_rotation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cluster_service.CompleteIPRotationRequest, - dict, + cluster_service.CompleteIPRotationRequest(), + {}, ], ) def test_complete_ip_rotation(request_type, transport: str = "grpc"): @@ -11824,7 +11872,7 @@ def test_complete_ip_rotation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11895,12 +11943,13 @@ def test_complete_ip_rotation_non_empty_request_with_auto_populated_field(): client.complete_ip_rotation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.CompleteIPRotationRequest( + request_msg = cluster_service.CompleteIPRotationRequest( project_id="project_id_value", zone="zone_value", cluster_id="cluster_id_value", name="name_value", ) + assert args[0] == request_msg def test_complete_ip_rotation_use_cached_wrapped_rpc(): @@ -11985,9 +12034,15 @@ async def test_complete_ip_rotation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.CompleteIPRotationRequest(), + {}, + ], +) async def test_complete_ip_rotation_async( - transport: str = "grpc_asyncio", - request_type=cluster_service.CompleteIPRotationRequest, + request_type, transport: str = "grpc_asyncio" ): client = ClusterManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -11996,7 +12051,7 @@ async def test_complete_ip_rotation_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( @@ -12041,11 +12096,6 @@ async def test_complete_ip_rotation_async( assert response.end_time == "end_time_value" -@pytest.mark.asyncio -async def test_complete_ip_rotation_async_from_dict(): - await test_complete_ip_rotation_async(request_type=dict) - - def test_complete_ip_rotation_field_headers(): client = ClusterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12220,8 +12270,8 @@ async def test_complete_ip_rotation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cluster_service.SetNodePoolSizeRequest, - dict, + cluster_service.SetNodePoolSizeRequest(), + {}, ], ) def test_set_node_pool_size(request_type, transport: str = "grpc"): @@ -12232,7 +12282,7 @@ def test_set_node_pool_size(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -12304,13 +12354,14 @@ def test_set_node_pool_size_non_empty_request_with_auto_populated_field(): client.set_node_pool_size(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetNodePoolSizeRequest( + request_msg = cluster_service.SetNodePoolSizeRequest( project_id="project_id_value", zone="zone_value", cluster_id="cluster_id_value", node_pool_id="node_pool_id_value", name="name_value", ) + assert args[0] == request_msg def test_set_node_pool_size_use_cached_wrapped_rpc(): @@ -12395,9 +12446,14 @@ async def test_set_node_pool_size_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_node_pool_size_async( - transport: str = "grpc_asyncio", request_type=cluster_service.SetNodePoolSizeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.SetNodePoolSizeRequest(), + {}, + ], +) +async def test_set_node_pool_size_async(request_type, transport: str = "grpc_asyncio"): client = ClusterManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12405,7 +12461,7 @@ async def test_set_node_pool_size_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( @@ -12450,11 +12506,6 @@ async def test_set_node_pool_size_async( assert response.end_time == "end_time_value" -@pytest.mark.asyncio -async def test_set_node_pool_size_async_from_dict(): - await test_set_node_pool_size_async(request_type=dict) - - def test_set_node_pool_size_field_headers(): client = ClusterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12523,8 +12574,8 @@ async def test_set_node_pool_size_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - cluster_service.SetNetworkPolicyRequest, - dict, + cluster_service.SetNetworkPolicyRequest(), + {}, ], ) def test_set_network_policy(request_type, transport: str = "grpc"): @@ -12535,7 +12586,7 @@ def test_set_network_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( @@ -12606,12 +12657,13 @@ def test_set_network_policy_non_empty_request_with_auto_populated_field(): client.set_network_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetNetworkPolicyRequest( + request_msg = cluster_service.SetNetworkPolicyRequest( project_id="project_id_value", zone="zone_value", cluster_id="cluster_id_value", name="name_value", ) + assert args[0] == request_msg def test_set_network_policy_use_cached_wrapped_rpc(): @@ -12696,10 +12748,14 @@ async def test_set_network_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_network_policy_async( - transport: str = "grpc_asyncio", - request_type=cluster_service.SetNetworkPolicyRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.SetNetworkPolicyRequest(), + {}, + ], +) +async def test_set_network_policy_async(request_type, transport: str = "grpc_asyncio"): client = ClusterManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12707,7 +12763,7 @@ async def test_set_network_policy_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( @@ -12752,11 +12808,6 @@ async def test_set_network_policy_async( assert response.end_time == "end_time_value" -@pytest.mark.asyncio -async def test_set_network_policy_async_from_dict(): - await test_set_network_policy_async(request_type=dict) - - def test_set_network_policy_field_headers(): client = ClusterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12953,8 +13004,8 @@ async def test_set_network_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cluster_service.SetMaintenancePolicyRequest, - dict, + cluster_service.SetMaintenancePolicyRequest(), + {}, ], ) def test_set_maintenance_policy(request_type, transport: str = "grpc"): @@ -12965,7 +13016,7 @@ def test_set_maintenance_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( @@ -13036,12 +13087,13 @@ def test_set_maintenance_policy_non_empty_request_with_auto_populated_field(): client.set_maintenance_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.SetMaintenancePolicyRequest( + request_msg = cluster_service.SetMaintenancePolicyRequest( project_id="project_id_value", zone="zone_value", cluster_id="cluster_id_value", name="name_value", ) + assert args[0] == request_msg def test_set_maintenance_policy_use_cached_wrapped_rpc(): @@ -13127,9 +13179,15 @@ async def test_set_maintenance_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.SetMaintenancePolicyRequest(), + {}, + ], +) async def test_set_maintenance_policy_async( - transport: str = "grpc_asyncio", - request_type=cluster_service.SetMaintenancePolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = ClusterManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -13138,7 +13196,7 @@ async def test_set_maintenance_policy_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( @@ -13183,11 +13241,6 @@ async def test_set_maintenance_policy_async( assert response.end_time == "end_time_value" -@pytest.mark.asyncio -async def test_set_maintenance_policy_async_from_dict(): - await test_set_maintenance_policy_async(request_type=dict) - - def test_set_maintenance_policy_field_headers(): client = ClusterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13408,8 +13461,8 @@ async def test_set_maintenance_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cluster_service.ListUsableSubnetworksRequest, - dict, + cluster_service.ListUsableSubnetworksRequest(), + {}, ], ) def test_list_usable_subnetworks(request_type, transport: str = "grpc"): @@ -13420,7 +13473,7 @@ def test_list_usable_subnetworks(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -13470,11 +13523,12 @@ def test_list_usable_subnetworks_non_empty_request_with_auto_populated_field(): client.list_usable_subnetworks(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.ListUsableSubnetworksRequest( + request_msg = cluster_service.ListUsableSubnetworksRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_usable_subnetworks_use_cached_wrapped_rpc(): @@ -13560,9 +13614,15 @@ async def test_list_usable_subnetworks_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.ListUsableSubnetworksRequest(), + {}, + ], +) async def test_list_usable_subnetworks_async( - transport: str = "grpc_asyncio", - request_type=cluster_service.ListUsableSubnetworksRequest, + request_type, transport: str = "grpc_asyncio" ): client = ClusterManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -13571,7 +13631,7 @@ async def test_list_usable_subnetworks_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( @@ -13596,11 +13656,6 @@ async def test_list_usable_subnetworks_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_usable_subnetworks_async_from_dict(): - await test_list_usable_subnetworks_async(request_type=dict) - - def test_list_usable_subnetworks_field_headers(): client = ClusterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13953,8 +14008,8 @@ async def test_list_usable_subnetworks_async_pages(): @pytest.mark.parametrize( "request_type", [ - cluster_service.CheckAutopilotCompatibilityRequest, - dict, + cluster_service.CheckAutopilotCompatibilityRequest(), + {}, ], ) def test_check_autopilot_compatibility(request_type, transport: str = "grpc"): @@ -13965,7 +14020,7 @@ def test_check_autopilot_compatibility(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -14013,9 +14068,10 @@ def test_check_autopilot_compatibility_non_empty_request_with_auto_populated_fie client.check_autopilot_compatibility(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.CheckAutopilotCompatibilityRequest( + request_msg = cluster_service.CheckAutopilotCompatibilityRequest( name="name_value", ) + assert args[0] == request_msg def test_check_autopilot_compatibility_use_cached_wrapped_rpc(): @@ -14101,9 +14157,15 @@ async def test_check_autopilot_compatibility_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.CheckAutopilotCompatibilityRequest(), + {}, + ], +) async def test_check_autopilot_compatibility_async( - transport: str = "grpc_asyncio", - request_type=cluster_service.CheckAutopilotCompatibilityRequest, + request_type, transport: str = "grpc_asyncio" ): client = ClusterManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -14112,7 +14174,7 @@ async def test_check_autopilot_compatibility_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( @@ -14137,11 +14199,6 @@ async def test_check_autopilot_compatibility_async( assert response.summary == "summary_value" -@pytest.mark.asyncio -async def test_check_autopilot_compatibility_async_from_dict(): - await test_check_autopilot_compatibility_async(request_type=dict) - - def test_check_autopilot_compatibility_field_headers(): client = ClusterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14210,8 +14267,8 @@ async def test_check_autopilot_compatibility_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - cluster_service.ListLocationsRequest, - dict, + cluster_service.ListLocationsRequest(), + {}, ], ) def test_list_locations(request_type, transport: str = "grpc"): @@ -14222,7 +14279,7 @@ def test_list_locations(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_locations), "__call__") as call: @@ -14267,9 +14324,10 @@ def test_list_locations_non_empty_request_with_auto_populated_field(): client.list_locations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.ListLocationsRequest( + request_msg = cluster_service.ListLocationsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_list_locations_use_cached_wrapped_rpc(): @@ -14350,9 +14408,14 @@ async def test_list_locations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_locations_async( - transport: str = "grpc_asyncio", request_type=cluster_service.ListLocationsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.ListLocationsRequest(), + {}, + ], +) +async def test_list_locations_async(request_type, transport: str = "grpc_asyncio"): client = ClusterManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14360,7 +14423,7 @@ async def test_list_locations_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_locations), "__call__") as call: @@ -14383,11 +14446,6 @@ async def test_list_locations_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_locations_async_from_dict(): - await test_list_locations_async(request_type=dict) - - def test_list_locations_field_headers(): client = ClusterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14534,8 +14592,8 @@ async def test_list_locations_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cluster_service.FetchClusterUpgradeInfoRequest, - dict, + cluster_service.FetchClusterUpgradeInfoRequest(), + {}, ], ) def test_fetch_cluster_upgrade_info(request_type, transport: str = "grpc"): @@ -14546,7 +14604,7 @@ def test_fetch_cluster_upgrade_info(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -14619,10 +14677,11 @@ def test_fetch_cluster_upgrade_info_non_empty_request_with_auto_populated_field( client.fetch_cluster_upgrade_info(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.FetchClusterUpgradeInfoRequest( + request_msg = cluster_service.FetchClusterUpgradeInfoRequest( name="name_value", version="version_value", ) + assert args[0] == request_msg def test_fetch_cluster_upgrade_info_use_cached_wrapped_rpc(): @@ -14708,9 +14767,15 @@ async def test_fetch_cluster_upgrade_info_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.FetchClusterUpgradeInfoRequest(), + {}, + ], +) async def test_fetch_cluster_upgrade_info_async( - transport: str = "grpc_asyncio", - request_type=cluster_service.FetchClusterUpgradeInfoRequest, + request_type, transport: str = "grpc_asyncio" ): client = ClusterManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -14719,7 +14784,7 @@ async def test_fetch_cluster_upgrade_info_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( @@ -14768,11 +14833,6 @@ async def test_fetch_cluster_upgrade_info_async( ) -@pytest.mark.asyncio -async def test_fetch_cluster_upgrade_info_async_from_dict(): - await test_fetch_cluster_upgrade_info_async(request_type=dict) - - def test_fetch_cluster_upgrade_info_field_headers(): client = ClusterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14927,8 +14987,8 @@ async def test_fetch_cluster_upgrade_info_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cluster_service.FetchNodePoolUpgradeInfoRequest, - dict, + cluster_service.FetchNodePoolUpgradeInfoRequest(), + {}, ], ) def test_fetch_node_pool_upgrade_info(request_type, transport: str = "grpc"): @@ -14939,7 +14999,7 @@ def test_fetch_node_pool_upgrade_info(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -15012,10 +15072,11 @@ def test_fetch_node_pool_upgrade_info_non_empty_request_with_auto_populated_fiel client.fetch_node_pool_upgrade_info(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.FetchNodePoolUpgradeInfoRequest( + request_msg = cluster_service.FetchNodePoolUpgradeInfoRequest( name="name_value", version="version_value", ) + assert args[0] == request_msg def test_fetch_node_pool_upgrade_info_use_cached_wrapped_rpc(): @@ -15101,9 +15162,15 @@ async def test_fetch_node_pool_upgrade_info_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.FetchNodePoolUpgradeInfoRequest(), + {}, + ], +) async def test_fetch_node_pool_upgrade_info_async( - transport: str = "grpc_asyncio", - request_type=cluster_service.FetchNodePoolUpgradeInfoRequest, + request_type, transport: str = "grpc_asyncio" ): client = ClusterManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -15112,7 +15179,7 @@ async def test_fetch_node_pool_upgrade_info_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( @@ -15161,11 +15228,6 @@ async def test_fetch_node_pool_upgrade_info_async( ) -@pytest.mark.asyncio -async def test_fetch_node_pool_upgrade_info_async_from_dict(): - await test_fetch_node_pool_upgrade_info_async(request_type=dict) - - def test_fetch_node_pool_upgrade_info_field_headers(): client = ClusterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15320,8 +15382,8 @@ async def test_fetch_node_pool_upgrade_info_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cluster_service.CompleteControlPlaneUpgradeRequest, - dict, + cluster_service.CompleteControlPlaneUpgradeRequest(), + {}, ], ) def test_complete_control_plane_upgrade(request_type, transport: str = "grpc"): @@ -15332,7 +15394,7 @@ def test_complete_control_plane_upgrade(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -15401,10 +15463,11 @@ def test_complete_control_plane_upgrade_non_empty_request_with_auto_populated_fi client.complete_control_plane_upgrade(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cluster_service.CompleteControlPlaneUpgradeRequest( + request_msg = cluster_service.CompleteControlPlaneUpgradeRequest( name="name_value", version="version_value", ) + assert args[0] == request_msg def test_complete_control_plane_upgrade_use_cached_wrapped_rpc(): @@ -15490,9 +15553,15 @@ async def test_complete_control_plane_upgrade_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.CompleteControlPlaneUpgradeRequest(), + {}, + ], +) async def test_complete_control_plane_upgrade_async( - transport: str = "grpc_asyncio", - request_type=cluster_service.CompleteControlPlaneUpgradeRequest, + request_type, transport: str = "grpc_asyncio" ): client = ClusterManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -15501,7 +15570,7 @@ async def test_complete_control_plane_upgrade_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( @@ -15546,11 +15615,6 @@ async def test_complete_control_plane_upgrade_async( assert response.end_time == "end_time_value" -@pytest.mark.asyncio -async def test_complete_control_plane_upgrade_async_from_dict(): - await test_complete_control_plane_upgrade_async(request_type=dict) - - def test_complete_control_plane_upgrade_field_headers(): client = ClusterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15738,7 +15802,6 @@ def test_list_clusters_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.ListClustersRequest() - assert args[0] == request_msg @@ -15759,7 +15822,6 @@ def test_get_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.GetClusterRequest() - assert args[0] == request_msg @@ -15780,7 +15842,6 @@ def test_create_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.CreateClusterRequest() - assert args[0] == request_msg @@ -15801,7 +15862,6 @@ def test_update_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.UpdateClusterRequest() - assert args[0] == request_msg @@ -15822,7 +15882,6 @@ def test_update_node_pool_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.UpdateNodePoolRequest() - assert args[0] == request_msg @@ -15845,7 +15904,6 @@ def test_set_node_pool_autoscaling_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.SetNodePoolAutoscalingRequest() - assert args[0] == request_msg @@ -15868,7 +15926,6 @@ def test_set_logging_service_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.SetLoggingServiceRequest() - assert args[0] == request_msg @@ -15891,7 +15948,6 @@ def test_set_monitoring_service_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.SetMonitoringServiceRequest() - assert args[0] == request_msg @@ -15914,7 +15970,6 @@ def test_set_addons_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.SetAddonsConfigRequest() - assert args[0] == request_msg @@ -15935,7 +15990,6 @@ def test_set_locations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.SetLocationsRequest() - assert args[0] == request_msg @@ -15956,7 +16010,6 @@ def test_update_master_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.UpdateMasterRequest() - assert args[0] == request_msg @@ -15977,7 +16030,6 @@ def test_set_master_auth_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.SetMasterAuthRequest() - assert args[0] == request_msg @@ -15998,7 +16050,6 @@ def test_delete_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.DeleteClusterRequest() - assert args[0] == request_msg @@ -16019,7 +16070,6 @@ def test_list_operations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.ListOperationsRequest() - assert args[0] == request_msg @@ -16040,7 +16090,6 @@ def test_get_operation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.GetOperationRequest() - assert args[0] == request_msg @@ -16061,7 +16110,6 @@ def test_cancel_operation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.CancelOperationRequest() - assert args[0] == request_msg @@ -16084,7 +16132,6 @@ def test_get_server_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.GetServerConfigRequest() - assert args[0] == request_msg @@ -16107,7 +16154,6 @@ def test_get_json_web_keys_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.GetJSONWebKeysRequest() - assert args[0] == request_msg @@ -16128,7 +16174,6 @@ def test_list_node_pools_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.ListNodePoolsRequest() - assert args[0] == request_msg @@ -16149,7 +16194,6 @@ def test_get_node_pool_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.GetNodePoolRequest() - assert args[0] == request_msg @@ -16170,7 +16214,6 @@ def test_create_node_pool_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.CreateNodePoolRequest() - assert args[0] == request_msg @@ -16191,7 +16234,6 @@ def test_delete_node_pool_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.DeleteNodePoolRequest() - assert args[0] == request_msg @@ -16214,7 +16256,6 @@ def test_complete_node_pool_upgrade_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.CompleteNodePoolUpgradeRequest() - assert args[0] == request_msg @@ -16237,7 +16278,6 @@ def test_rollback_node_pool_upgrade_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.RollbackNodePoolUpgradeRequest() - assert args[0] == request_msg @@ -16260,7 +16300,6 @@ def test_set_node_pool_management_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.SetNodePoolManagementRequest() - assert args[0] == request_msg @@ -16281,7 +16320,6 @@ def test_set_labels_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.SetLabelsRequest() - assert args[0] == request_msg @@ -16302,7 +16340,6 @@ def test_set_legacy_abac_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.SetLegacyAbacRequest() - assert args[0] == request_msg @@ -16325,7 +16362,6 @@ def test_start_ip_rotation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.StartIPRotationRequest() - assert args[0] == request_msg @@ -16348,7 +16384,6 @@ def test_complete_ip_rotation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.CompleteIPRotationRequest() - assert args[0] == request_msg @@ -16371,7 +16406,6 @@ def test_set_node_pool_size_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.SetNodePoolSizeRequest() - assert args[0] == request_msg @@ -16394,7 +16428,6 @@ def test_set_network_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.SetNetworkPolicyRequest() - assert args[0] == request_msg @@ -16417,7 +16450,6 @@ def test_set_maintenance_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.SetMaintenancePolicyRequest() - assert args[0] == request_msg @@ -16440,7 +16472,6 @@ def test_list_usable_subnetworks_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.ListUsableSubnetworksRequest() - assert args[0] == request_msg @@ -16463,7 +16494,6 @@ def test_check_autopilot_compatibility_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.CheckAutopilotCompatibilityRequest() - assert args[0] == request_msg @@ -16484,7 +16514,6 @@ def test_list_locations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.ListLocationsRequest() - assert args[0] == request_msg @@ -16507,7 +16536,6 @@ def test_fetch_cluster_upgrade_info_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.FetchClusterUpgradeInfoRequest() - assert args[0] == request_msg @@ -16530,7 +16558,6 @@ def test_fetch_node_pool_upgrade_info_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.FetchNodePoolUpgradeInfoRequest() - assert args[0] == request_msg @@ -16553,7 +16580,6 @@ def test_complete_control_plane_upgrade_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.CompleteControlPlaneUpgradeRequest() - assert args[0] == request_msg @@ -16594,7 +16620,6 @@ async def test_list_clusters_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.ListClustersRequest() - assert args[0] == request_msg @@ -16656,7 +16681,6 @@ async def test_get_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.GetClusterRequest() - assert args[0] == request_msg @@ -16693,7 +16717,6 @@ async def test_create_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.CreateClusterRequest() - assert args[0] == request_msg @@ -16730,7 +16753,6 @@ async def test_update_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.UpdateClusterRequest() - assert args[0] == request_msg @@ -16767,7 +16789,6 @@ async def test_update_node_pool_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.UpdateNodePoolRequest() - assert args[0] == request_msg @@ -16806,7 +16827,6 @@ async def test_set_node_pool_autoscaling_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.SetNodePoolAutoscalingRequest() - assert args[0] == request_msg @@ -16845,7 +16865,6 @@ async def test_set_logging_service_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.SetLoggingServiceRequest() - assert args[0] == request_msg @@ -16884,7 +16903,6 @@ async def test_set_monitoring_service_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.SetMonitoringServiceRequest() - assert args[0] == request_msg @@ -16923,7 +16941,6 @@ async def test_set_addons_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.SetAddonsConfigRequest() - assert args[0] == request_msg @@ -16960,7 +16977,6 @@ async def test_set_locations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.SetLocationsRequest() - assert args[0] == request_msg @@ -16997,7 +17013,6 @@ async def test_update_master_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.UpdateMasterRequest() - assert args[0] == request_msg @@ -17034,7 +17049,6 @@ async def test_set_master_auth_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.SetMasterAuthRequest() - assert args[0] == request_msg @@ -17071,7 +17085,6 @@ async def test_delete_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.DeleteClusterRequest() - assert args[0] == request_msg @@ -17098,7 +17111,6 @@ async def test_list_operations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.ListOperationsRequest() - assert args[0] == request_msg @@ -17135,7 +17147,6 @@ async def test_get_operation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.GetOperationRequest() - assert args[0] == request_msg @@ -17158,7 +17169,6 @@ async def test_cancel_operation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.CancelOperationRequest() - assert args[0] == request_msg @@ -17191,7 +17201,6 @@ async def test_get_server_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.GetServerConfigRequest() - assert args[0] == request_msg @@ -17218,7 +17227,6 @@ async def test_get_json_web_keys_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.GetJSONWebKeysRequest() - assert args[0] == request_msg @@ -17243,7 +17251,6 @@ async def test_list_node_pools_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.ListNodePoolsRequest() - assert args[0] == request_msg @@ -17279,7 +17286,6 @@ async def test_get_node_pool_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.GetNodePoolRequest() - assert args[0] == request_msg @@ -17316,7 +17322,6 @@ async def test_create_node_pool_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.CreateNodePoolRequest() - assert args[0] == request_msg @@ -17353,7 +17358,6 @@ async def test_delete_node_pool_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.DeleteNodePoolRequest() - assert args[0] == request_msg @@ -17378,7 +17382,6 @@ async def test_complete_node_pool_upgrade_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.CompleteNodePoolUpgradeRequest() - assert args[0] == request_msg @@ -17417,7 +17420,6 @@ async def test_rollback_node_pool_upgrade_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.RollbackNodePoolUpgradeRequest() - assert args[0] == request_msg @@ -17456,7 +17458,6 @@ async def test_set_node_pool_management_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.SetNodePoolManagementRequest() - assert args[0] == request_msg @@ -17493,7 +17494,6 @@ async def test_set_labels_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.SetLabelsRequest() - assert args[0] == request_msg @@ -17530,7 +17530,6 @@ async def test_set_legacy_abac_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.SetLegacyAbacRequest() - assert args[0] == request_msg @@ -17569,7 +17568,6 @@ async def test_start_ip_rotation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.StartIPRotationRequest() - assert args[0] == request_msg @@ -17608,7 +17606,6 @@ async def test_complete_ip_rotation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.CompleteIPRotationRequest() - assert args[0] == request_msg @@ -17647,7 +17644,6 @@ async def test_set_node_pool_size_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.SetNodePoolSizeRequest() - assert args[0] == request_msg @@ -17686,7 +17682,6 @@ async def test_set_network_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.SetNetworkPolicyRequest() - assert args[0] == request_msg @@ -17725,7 +17720,6 @@ async def test_set_maintenance_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.SetMaintenancePolicyRequest() - assert args[0] == request_msg @@ -17754,7 +17748,6 @@ async def test_list_usable_subnetworks_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.ListUsableSubnetworksRequest() - assert args[0] == request_msg @@ -17783,7 +17776,6 @@ async def test_check_autopilot_compatibility_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.CheckAutopilotCompatibilityRequest() - assert args[0] == request_msg @@ -17810,7 +17802,6 @@ async def test_list_locations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.ListLocationsRequest() - assert args[0] == request_msg @@ -17848,7 +17839,6 @@ async def test_fetch_cluster_upgrade_info_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.FetchClusterUpgradeInfoRequest() - assert args[0] == request_msg @@ -17886,7 +17876,6 @@ async def test_fetch_node_pool_upgrade_info_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.FetchNodePoolUpgradeInfoRequest() - assert args[0] == request_msg @@ -17925,7 +17914,6 @@ async def test_complete_control_plane_upgrade_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cluster_service.CompleteControlPlaneUpgradeRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-contentwarehouse/noxfile.py b/packages/google-cloud-contentwarehouse/noxfile.py index c97ae438a3fb..b276ac47b184 100644 --- a/packages/google-cloud-contentwarehouse/noxfile.py +++ b/packages/google-cloud-contentwarehouse/noxfile.py @@ -47,7 +47,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-contentwarehouse" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-contentwarehouse/setup.py b/packages/google-cloud-contentwarehouse/setup.py index ce144d061246..2dfccc30ac23 100644 --- a/packages/google-cloud-contentwarehouse/setup.py +++ b/packages/google-cloud-contentwarehouse/setup.py @@ -45,7 +45,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/google-cloud-contentwarehouse/testing/constraints-3.10.txt b/packages/google-cloud-contentwarehouse/testing/constraints-3.10.txt index 3f8c2c00fe5b..8b0bfae23e7f 100644 --- a/packages/google-cloud-contentwarehouse/testing/constraints-3.10.txt +++ b/packages/google-cloud-contentwarehouse/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-documentai==2.4.1 diff --git a/packages/google-cloud-contentwarehouse/tests/unit/gapic/contentwarehouse_v1/test_document_link_service.py b/packages/google-cloud-contentwarehouse/tests/unit/gapic/contentwarehouse_v1/test_document_link_service.py index 9118d95f93d9..8bd8dea265c9 100644 --- a/packages/google-cloud-contentwarehouse/tests/unit/gapic/contentwarehouse_v1/test_document_link_service.py +++ b/packages/google-cloud-contentwarehouse/tests/unit/gapic/contentwarehouse_v1/test_document_link_service.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 @@ -113,6 +114,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" @@ -1376,8 +1392,8 @@ def test_document_link_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - document_link_service.ListLinkedTargetsRequest, - dict, + document_link_service.ListLinkedTargetsRequest(), + {}, ], ) def test_list_linked_targets(request_type, transport: str = "grpc"): @@ -1388,7 +1404,7 @@ def test_list_linked_targets(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1437,9 +1453,10 @@ def test_list_linked_targets_non_empty_request_with_auto_populated_field(): client.list_linked_targets(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_link_service.ListLinkedTargetsRequest( + request_msg = document_link_service.ListLinkedTargetsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_list_linked_targets_use_cached_wrapped_rpc(): @@ -1524,10 +1541,14 @@ async def test_list_linked_targets_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_linked_targets_async( - transport: str = "grpc_asyncio", - request_type=document_link_service.ListLinkedTargetsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + document_link_service.ListLinkedTargetsRequest(), + {}, + ], +) +async def test_list_linked_targets_async(request_type, transport: str = "grpc_asyncio"): client = DocumentLinkServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1535,7 +1556,7 @@ async def test_list_linked_targets_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( @@ -1560,11 +1581,6 @@ async def test_list_linked_targets_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_linked_targets_async_from_dict(): - await test_list_linked_targets_async(request_type=dict) - - def test_list_linked_targets_field_headers(): client = DocumentLinkServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1719,8 +1735,8 @@ async def test_list_linked_targets_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - document_link_service.ListLinkedSourcesRequest, - dict, + document_link_service.ListLinkedSourcesRequest(), + {}, ], ) def test_list_linked_sources(request_type, transport: str = "grpc"): @@ -1731,7 +1747,7 @@ def test_list_linked_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( @@ -1780,10 +1796,11 @@ def test_list_linked_sources_non_empty_request_with_auto_populated_field(): client.list_linked_sources(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_link_service.ListLinkedSourcesRequest( + request_msg = document_link_service.ListLinkedSourcesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_linked_sources_use_cached_wrapped_rpc(): @@ -1868,10 +1885,14 @@ async def test_list_linked_sources_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_linked_sources_async( - transport: str = "grpc_asyncio", - request_type=document_link_service.ListLinkedSourcesRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + document_link_service.ListLinkedSourcesRequest(), + {}, + ], +) +async def test_list_linked_sources_async(request_type, transport: str = "grpc_asyncio"): client = DocumentLinkServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1879,7 +1900,7 @@ async def test_list_linked_sources_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( @@ -1904,11 +1925,6 @@ async def test_list_linked_sources_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_linked_sources_async_from_dict(): - await test_list_linked_sources_async(request_type=dict) - - def test_list_linked_sources_field_headers(): client = DocumentLinkServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2261,8 +2277,8 @@ async def test_list_linked_sources_async_pages(): @pytest.mark.parametrize( "request_type", [ - document_link_service.CreateDocumentLinkRequest, - dict, + document_link_service.CreateDocumentLinkRequest(), + {}, ], ) def test_create_document_link(request_type, transport: str = "grpc"): @@ -2273,7 +2289,7 @@ def test_create_document_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( @@ -2325,9 +2341,10 @@ def test_create_document_link_non_empty_request_with_auto_populated_field(): client.create_document_link(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_link_service.CreateDocumentLinkRequest( + request_msg = document_link_service.CreateDocumentLinkRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_document_link_use_cached_wrapped_rpc(): @@ -2412,9 +2429,15 @@ async def test_create_document_link_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + document_link_service.CreateDocumentLinkRequest(), + {}, + ], +) async def test_create_document_link_async( - transport: str = "grpc_asyncio", - request_type=document_link_service.CreateDocumentLinkRequest, + request_type, transport: str = "grpc_asyncio" ): client = DocumentLinkServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2423,7 +2446,7 @@ async def test_create_document_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( @@ -2452,11 +2475,6 @@ async def test_create_document_link_async( assert response.state == document_link_service.DocumentLink.State.ACTIVE -@pytest.mark.asyncio -async def test_create_document_link_async_from_dict(): - await test_create_document_link_async(request_type=dict) - - def test_create_document_link_field_headers(): client = DocumentLinkServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2621,8 +2639,8 @@ async def test_create_document_link_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - document_link_service.DeleteDocumentLinkRequest, - dict, + document_link_service.DeleteDocumentLinkRequest(), + {}, ], ) def test_delete_document_link(request_type, transport: str = "grpc"): @@ -2633,7 +2651,7 @@ def test_delete_document_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( @@ -2678,9 +2696,10 @@ def test_delete_document_link_non_empty_request_with_auto_populated_field(): client.delete_document_link(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_link_service.DeleteDocumentLinkRequest( + request_msg = document_link_service.DeleteDocumentLinkRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_document_link_use_cached_wrapped_rpc(): @@ -2765,9 +2784,15 @@ async def test_delete_document_link_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + document_link_service.DeleteDocumentLinkRequest(), + {}, + ], +) async def test_delete_document_link_async( - transport: str = "grpc_asyncio", - request_type=document_link_service.DeleteDocumentLinkRequest, + request_type, transport: str = "grpc_asyncio" ): client = DocumentLinkServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2776,7 +2801,7 @@ async def test_delete_document_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( @@ -2796,11 +2821,6 @@ async def test_delete_document_link_async( assert response is None -@pytest.mark.asyncio -async def test_delete_document_link_async_from_dict(): - await test_delete_document_link_async(request_type=dict) - - def test_delete_document_link_field_headers(): client = DocumentLinkServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3887,7 +3907,6 @@ def test_list_linked_targets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_link_service.ListLinkedTargetsRequest() - assert args[0] == request_msg @@ -3910,7 +3929,6 @@ def test_list_linked_sources_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_link_service.ListLinkedSourcesRequest() - assert args[0] == request_msg @@ -3933,7 +3951,6 @@ def test_create_document_link_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_link_service.CreateDocumentLinkRequest() - assert args[0] == request_msg @@ -3956,7 +3973,6 @@ def test_delete_document_link_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_link_service.DeleteDocumentLinkRequest() - assert args[0] == request_msg @@ -3999,7 +4015,6 @@ async def test_list_linked_targets_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_link_service.ListLinkedTargetsRequest() - assert args[0] == request_msg @@ -4028,7 +4043,6 @@ async def test_list_linked_sources_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_link_service.ListLinkedSourcesRequest() - assert args[0] == request_msg @@ -4059,7 +4073,6 @@ async def test_create_document_link_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_link_service.CreateDocumentLinkRequest() - assert args[0] == request_msg @@ -4084,7 +4097,6 @@ async def test_delete_document_link_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_link_service.DeleteDocumentLinkRequest() - assert args[0] == request_msg @@ -4708,7 +4720,6 @@ def test_list_linked_targets_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_link_service.ListLinkedTargetsRequest() - assert args[0] == request_msg @@ -4730,7 +4741,6 @@ def test_list_linked_sources_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_link_service.ListLinkedSourcesRequest() - assert args[0] == request_msg @@ -4752,7 +4762,6 @@ def test_create_document_link_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_link_service.CreateDocumentLinkRequest() - assert args[0] == request_msg @@ -4774,7 +4783,6 @@ def test_delete_document_link_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_link_service.DeleteDocumentLinkRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-contentwarehouse/tests/unit/gapic/contentwarehouse_v1/test_document_schema_service.py b/packages/google-cloud-contentwarehouse/tests/unit/gapic/contentwarehouse_v1/test_document_schema_service.py index ccbbc4a92fdf..33e68621ad3c 100644 --- a/packages/google-cloud-contentwarehouse/tests/unit/gapic/contentwarehouse_v1/test_document_schema_service.py +++ b/packages/google-cloud-contentwarehouse/tests/unit/gapic/contentwarehouse_v1/test_document_schema_service.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 @@ -115,6 +116,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" @@ -1380,8 +1396,8 @@ def test_document_schema_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - document_schema_service.CreateDocumentSchemaRequest, - dict, + document_schema_service.CreateDocumentSchemaRequest(), + {}, ], ) def test_create_document_schema(request_type, transport: str = "grpc"): @@ -1392,7 +1408,7 @@ def test_create_document_schema(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1446,9 +1462,10 @@ def test_create_document_schema_non_empty_request_with_auto_populated_field(): client.create_document_schema(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_schema_service.CreateDocumentSchemaRequest( + request_msg = document_schema_service.CreateDocumentSchemaRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_document_schema_use_cached_wrapped_rpc(): @@ -1534,9 +1551,15 @@ async def test_create_document_schema_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + document_schema_service.CreateDocumentSchemaRequest(), + {}, + ], +) async def test_create_document_schema_async( - transport: str = "grpc_asyncio", - request_type=document_schema_service.CreateDocumentSchemaRequest, + request_type, transport: str = "grpc_asyncio" ): client = DocumentSchemaServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1545,7 +1568,7 @@ async def test_create_document_schema_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( @@ -1576,11 +1599,6 @@ async def test_create_document_schema_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_create_document_schema_async_from_dict(): - await test_create_document_schema_async(request_type=dict) - - def test_create_document_schema_field_headers(): client = DocumentSchemaServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1745,8 +1763,8 @@ async def test_create_document_schema_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - document_schema_service.UpdateDocumentSchemaRequest, - dict, + document_schema_service.UpdateDocumentSchemaRequest(), + {}, ], ) def test_update_document_schema(request_type, transport: str = "grpc"): @@ -1757,7 +1775,7 @@ def test_update_document_schema(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1811,9 +1829,10 @@ def test_update_document_schema_non_empty_request_with_auto_populated_field(): client.update_document_schema(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_schema_service.UpdateDocumentSchemaRequest( + request_msg = document_schema_service.UpdateDocumentSchemaRequest( name="name_value", ) + assert args[0] == request_msg def test_update_document_schema_use_cached_wrapped_rpc(): @@ -1899,9 +1918,15 @@ async def test_update_document_schema_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + document_schema_service.UpdateDocumentSchemaRequest(), + {}, + ], +) async def test_update_document_schema_async( - transport: str = "grpc_asyncio", - request_type=document_schema_service.UpdateDocumentSchemaRequest, + request_type, transport: str = "grpc_asyncio" ): client = DocumentSchemaServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1910,7 +1935,7 @@ async def test_update_document_schema_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( @@ -1941,11 +1966,6 @@ async def test_update_document_schema_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_update_document_schema_async_from_dict(): - await test_update_document_schema_async(request_type=dict) - - def test_update_document_schema_field_headers(): client = DocumentSchemaServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2110,8 +2130,8 @@ async def test_update_document_schema_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - document_schema_service.GetDocumentSchemaRequest, - dict, + document_schema_service.GetDocumentSchemaRequest(), + {}, ], ) def test_get_document_schema(request_type, transport: str = "grpc"): @@ -2122,7 +2142,7 @@ def test_get_document_schema(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2176,9 +2196,10 @@ def test_get_document_schema_non_empty_request_with_auto_populated_field(): client.get_document_schema(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_schema_service.GetDocumentSchemaRequest( + request_msg = document_schema_service.GetDocumentSchemaRequest( name="name_value", ) + assert args[0] == request_msg def test_get_document_schema_use_cached_wrapped_rpc(): @@ -2263,10 +2284,14 @@ async def test_get_document_schema_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_document_schema_async( - transport: str = "grpc_asyncio", - request_type=document_schema_service.GetDocumentSchemaRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + document_schema_service.GetDocumentSchemaRequest(), + {}, + ], +) +async def test_get_document_schema_async(request_type, transport: str = "grpc_asyncio"): client = DocumentSchemaServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2274,7 +2299,7 @@ async def test_get_document_schema_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( @@ -2305,11 +2330,6 @@ async def test_get_document_schema_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_get_document_schema_async_from_dict(): - await test_get_document_schema_async(request_type=dict) - - def test_get_document_schema_field_headers(): client = DocumentSchemaServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2464,8 +2484,8 @@ async def test_get_document_schema_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - document_schema_service.DeleteDocumentSchemaRequest, - dict, + document_schema_service.DeleteDocumentSchemaRequest(), + {}, ], ) def test_delete_document_schema(request_type, transport: str = "grpc"): @@ -2476,7 +2496,7 @@ def test_delete_document_schema(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2521,9 +2541,10 @@ def test_delete_document_schema_non_empty_request_with_auto_populated_field(): client.delete_document_schema(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_schema_service.DeleteDocumentSchemaRequest( + request_msg = document_schema_service.DeleteDocumentSchemaRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_document_schema_use_cached_wrapped_rpc(): @@ -2609,9 +2630,15 @@ async def test_delete_document_schema_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + document_schema_service.DeleteDocumentSchemaRequest(), + {}, + ], +) async def test_delete_document_schema_async( - transport: str = "grpc_asyncio", - request_type=document_schema_service.DeleteDocumentSchemaRequest, + request_type, transport: str = "grpc_asyncio" ): client = DocumentSchemaServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2620,7 +2647,7 @@ async def test_delete_document_schema_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( @@ -2640,11 +2667,6 @@ async def test_delete_document_schema_async( assert response is None -@pytest.mark.asyncio -async def test_delete_document_schema_async_from_dict(): - await test_delete_document_schema_async(request_type=dict) - - def test_delete_document_schema_field_headers(): client = DocumentSchemaServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2795,8 +2817,8 @@ async def test_delete_document_schema_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - document_schema_service.ListDocumentSchemasRequest, - dict, + document_schema_service.ListDocumentSchemasRequest(), + {}, ], ) def test_list_document_schemas(request_type, transport: str = "grpc"): @@ -2807,7 +2829,7 @@ def test_list_document_schemas(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2856,10 +2878,11 @@ def test_list_document_schemas_non_empty_request_with_auto_populated_field(): client.list_document_schemas(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_schema_service.ListDocumentSchemasRequest( + request_msg = document_schema_service.ListDocumentSchemasRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_document_schemas_use_cached_wrapped_rpc(): @@ -2945,9 +2968,15 @@ async def test_list_document_schemas_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + document_schema_service.ListDocumentSchemasRequest(), + {}, + ], +) async def test_list_document_schemas_async( - transport: str = "grpc_asyncio", - request_type=document_schema_service.ListDocumentSchemasRequest, + request_type, transport: str = "grpc_asyncio" ): client = DocumentSchemaServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2956,7 +2985,7 @@ async def test_list_document_schemas_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( @@ -2981,11 +3010,6 @@ async def test_list_document_schemas_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_document_schemas_async_from_dict(): - await test_list_document_schemas_async(request_type=dict) - - def test_list_document_schemas_field_headers(): client = DocumentSchemaServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4480,7 +4504,6 @@ def test_create_document_schema_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_schema_service.CreateDocumentSchemaRequest() - assert args[0] == request_msg @@ -4503,7 +4526,6 @@ def test_update_document_schema_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_schema_service.UpdateDocumentSchemaRequest() - assert args[0] == request_msg @@ -4526,7 +4548,6 @@ def test_get_document_schema_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_schema_service.GetDocumentSchemaRequest() - assert args[0] == request_msg @@ -4549,7 +4570,6 @@ def test_delete_document_schema_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_schema_service.DeleteDocumentSchemaRequest() - assert args[0] == request_msg @@ -4572,7 +4592,6 @@ def test_list_document_schemas_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_schema_service.ListDocumentSchemasRequest() - assert args[0] == request_msg @@ -4618,7 +4637,6 @@ async def test_create_document_schema_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_schema_service.CreateDocumentSchemaRequest() - assert args[0] == request_msg @@ -4650,7 +4668,6 @@ async def test_update_document_schema_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_schema_service.UpdateDocumentSchemaRequest() - assert args[0] == request_msg @@ -4682,7 +4699,6 @@ async def test_get_document_schema_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_schema_service.GetDocumentSchemaRequest() - assert args[0] == request_msg @@ -4707,7 +4723,6 @@ async def test_delete_document_schema_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_schema_service.DeleteDocumentSchemaRequest() - assert args[0] == request_msg @@ -4736,7 +4751,6 @@ async def test_list_document_schemas_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_schema_service.ListDocumentSchemasRequest() - assert args[0] == request_msg @@ -5624,7 +5638,6 @@ def test_create_document_schema_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_schema_service.CreateDocumentSchemaRequest() - assert args[0] == request_msg @@ -5646,7 +5659,6 @@ def test_update_document_schema_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_schema_service.UpdateDocumentSchemaRequest() - assert args[0] == request_msg @@ -5668,7 +5680,6 @@ def test_get_document_schema_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_schema_service.GetDocumentSchemaRequest() - assert args[0] == request_msg @@ -5690,7 +5701,6 @@ def test_delete_document_schema_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_schema_service.DeleteDocumentSchemaRequest() - assert args[0] == request_msg @@ -5712,7 +5722,6 @@ def test_list_document_schemas_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_schema_service.ListDocumentSchemasRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-contentwarehouse/tests/unit/gapic/contentwarehouse_v1/test_document_service.py b/packages/google-cloud-contentwarehouse/tests/unit/gapic/contentwarehouse_v1/test_document_service.py index 954d8c08e27c..b75f7e470e71 100644 --- a/packages/google-cloud-contentwarehouse/tests/unit/gapic/contentwarehouse_v1/test_document_service.py +++ b/packages/google-cloud-contentwarehouse/tests/unit/gapic/contentwarehouse_v1/test_document_service.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 @@ -133,6 +134,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" @@ -1360,8 +1376,8 @@ def test_document_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - document_service_request.CreateDocumentRequest, - dict, + document_service_request.CreateDocumentRequest(), + {}, ], ) def test_create_document(request_type, transport: str = "grpc"): @@ -1372,7 +1388,7 @@ def test_create_document(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_document), "__call__") as call: @@ -1413,9 +1429,10 @@ def test_create_document_non_empty_request_with_auto_populated_field(): client.create_document(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_service_request.CreateDocumentRequest( + request_msg = document_service_request.CreateDocumentRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_document_use_cached_wrapped_rpc(): @@ -1496,10 +1513,14 @@ async def test_create_document_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_document_async( - transport: str = "grpc_asyncio", - request_type=document_service_request.CreateDocumentRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + document_service_request.CreateDocumentRequest(), + {}, + ], +) +async def test_create_document_async(request_type, transport: str = "grpc_asyncio"): client = DocumentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1507,7 +1528,7 @@ async def test_create_document_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_document), "__call__") as call: @@ -1527,11 +1548,6 @@ async def test_create_document_async( assert isinstance(response, document_service.CreateDocumentResponse) -@pytest.mark.asyncio -async def test_create_document_async_from_dict(): - await test_create_document_async(request_type=dict) - - def test_create_document_field_headers(): client = DocumentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1688,8 +1704,8 @@ async def test_create_document_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - document_service_request.GetDocumentRequest, - dict, + document_service_request.GetDocumentRequest(), + {}, ], ) def test_get_document(request_type, transport: str = "grpc"): @@ -1700,7 +1716,7 @@ def test_get_document(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_document), "__call__") as call: @@ -1779,9 +1795,10 @@ def test_get_document_non_empty_request_with_auto_populated_field(): client.get_document(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_service_request.GetDocumentRequest( + request_msg = document_service_request.GetDocumentRequest( name="name_value", ) + assert args[0] == request_msg def test_get_document_use_cached_wrapped_rpc(): @@ -1862,10 +1879,14 @@ async def test_get_document_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_document_async( - transport: str = "grpc_asyncio", - request_type=document_service_request.GetDocumentRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + document_service_request.GetDocumentRequest(), + {}, + ], +) +async def test_get_document_async(request_type, transport: str = "grpc_asyncio"): client = DocumentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1873,7 +1894,7 @@ async def test_get_document_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_document), "__call__") as call: @@ -1929,11 +1950,6 @@ async def test_get_document_async( assert response.legal_hold is True -@pytest.mark.asyncio -async def test_get_document_async_from_dict(): - await test_get_document_async(request_type=dict) - - def test_get_document_field_headers(): client = DocumentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2080,8 +2096,8 @@ async def test_get_document_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - document_service_request.UpdateDocumentRequest, - dict, + document_service_request.UpdateDocumentRequest(), + {}, ], ) def test_update_document(request_type, transport: str = "grpc"): @@ -2092,7 +2108,7 @@ def test_update_document(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_document), "__call__") as call: @@ -2133,9 +2149,10 @@ def test_update_document_non_empty_request_with_auto_populated_field(): client.update_document(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_service_request.UpdateDocumentRequest( + request_msg = document_service_request.UpdateDocumentRequest( name="name_value", ) + assert args[0] == request_msg def test_update_document_use_cached_wrapped_rpc(): @@ -2216,10 +2233,14 @@ async def test_update_document_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_document_async( - transport: str = "grpc_asyncio", - request_type=document_service_request.UpdateDocumentRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + document_service_request.UpdateDocumentRequest(), + {}, + ], +) +async def test_update_document_async(request_type, transport: str = "grpc_asyncio"): client = DocumentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2227,7 +2248,7 @@ async def test_update_document_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_document), "__call__") as call: @@ -2247,11 +2268,6 @@ async def test_update_document_async( assert isinstance(response, document_service.UpdateDocumentResponse) -@pytest.mark.asyncio -async def test_update_document_async_from_dict(): - await test_update_document_async(request_type=dict) - - def test_update_document_field_headers(): client = DocumentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2408,8 +2424,8 @@ async def test_update_document_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - document_service_request.DeleteDocumentRequest, - dict, + document_service_request.DeleteDocumentRequest(), + {}, ], ) def test_delete_document(request_type, transport: str = "grpc"): @@ -2420,7 +2436,7 @@ def test_delete_document(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_document), "__call__") as call: @@ -2461,9 +2477,10 @@ def test_delete_document_non_empty_request_with_auto_populated_field(): client.delete_document(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_service_request.DeleteDocumentRequest( + request_msg = document_service_request.DeleteDocumentRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_document_use_cached_wrapped_rpc(): @@ -2544,10 +2561,14 @@ async def test_delete_document_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_document_async( - transport: str = "grpc_asyncio", - request_type=document_service_request.DeleteDocumentRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + document_service_request.DeleteDocumentRequest(), + {}, + ], +) +async def test_delete_document_async(request_type, transport: str = "grpc_asyncio"): client = DocumentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2555,7 +2576,7 @@ async def test_delete_document_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_document), "__call__") as call: @@ -2573,11 +2594,6 @@ async def test_delete_document_async( assert response is None -@pytest.mark.asyncio -async def test_delete_document_async_from_dict(): - await test_delete_document_async(request_type=dict) - - def test_delete_document_field_headers(): client = DocumentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2720,8 +2736,8 @@ async def test_delete_document_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - document_service_request.SearchDocumentsRequest, - dict, + document_service_request.SearchDocumentsRequest(), + {}, ], ) def test_search_documents(request_type, transport: str = "grpc"): @@ -2732,7 +2748,7 @@ def test_search_documents(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.search_documents), "__call__") as call: @@ -2782,11 +2798,12 @@ def test_search_documents_non_empty_request_with_auto_populated_field(): client.search_documents(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_service_request.SearchDocumentsRequest( + request_msg = document_service_request.SearchDocumentsRequest( parent="parent_value", page_token="page_token_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_search_documents_use_cached_wrapped_rpc(): @@ -2869,10 +2886,14 @@ async def test_search_documents_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_search_documents_async( - transport: str = "grpc_asyncio", - request_type=document_service_request.SearchDocumentsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + document_service_request.SearchDocumentsRequest(), + {}, + ], +) +async def test_search_documents_async(request_type, transport: str = "grpc_asyncio"): client = DocumentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2880,7 +2901,7 @@ async def test_search_documents_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.search_documents), "__call__") as call: @@ -2907,11 +2928,6 @@ async def test_search_documents_async( assert response.question_answer == "question_answer_value" -@pytest.mark.asyncio -async def test_search_documents_async_from_dict(): - await test_search_documents_async(request_type=dict) - - def test_search_documents_field_headers(): client = DocumentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3254,8 +3270,8 @@ async def test_search_documents_async_pages(): @pytest.mark.parametrize( "request_type", [ - document_service_request.LockDocumentRequest, - dict, + document_service_request.LockDocumentRequest(), + {}, ], ) def test_lock_document(request_type, transport: str = "grpc"): @@ -3266,7 +3282,7 @@ def test_lock_document(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.lock_document), "__call__") as call: @@ -3346,10 +3362,11 @@ def test_lock_document_non_empty_request_with_auto_populated_field(): client.lock_document(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_service_request.LockDocumentRequest( + request_msg = document_service_request.LockDocumentRequest( name="name_value", collection_id="collection_id_value", ) + assert args[0] == request_msg def test_lock_document_use_cached_wrapped_rpc(): @@ -3430,10 +3447,14 @@ async def test_lock_document_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_lock_document_async( - transport: str = "grpc_asyncio", - request_type=document_service_request.LockDocumentRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + document_service_request.LockDocumentRequest(), + {}, + ], +) +async def test_lock_document_async(request_type, transport: str = "grpc_asyncio"): client = DocumentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3441,7 +3462,7 @@ async def test_lock_document_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.lock_document), "__call__") as call: @@ -3497,11 +3518,6 @@ async def test_lock_document_async( assert response.legal_hold is True -@pytest.mark.asyncio -async def test_lock_document_async_from_dict(): - await test_lock_document_async(request_type=dict) - - def test_lock_document_field_headers(): client = DocumentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3648,8 +3664,8 @@ async def test_lock_document_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - document_service_request.FetchAclRequest, - dict, + document_service_request.FetchAclRequest(), + {}, ], ) def test_fetch_acl(request_type, transport: str = "grpc"): @@ -3660,7 +3676,7 @@ def test_fetch_acl(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.fetch_acl), "__call__") as call: @@ -3701,9 +3717,10 @@ def test_fetch_acl_non_empty_request_with_auto_populated_field(): client.fetch_acl(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_service_request.FetchAclRequest( + request_msg = document_service_request.FetchAclRequest( resource="resource_value", ) + assert args[0] == request_msg def test_fetch_acl_use_cached_wrapped_rpc(): @@ -3782,10 +3799,14 @@ async def test_fetch_acl_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_fetch_acl_async( - transport: str = "grpc_asyncio", - request_type=document_service_request.FetchAclRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + document_service_request.FetchAclRequest(), + {}, + ], +) +async def test_fetch_acl_async(request_type, transport: str = "grpc_asyncio"): client = DocumentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3793,7 +3814,7 @@ async def test_fetch_acl_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.fetch_acl), "__call__") as call: @@ -3813,11 +3834,6 @@ async def test_fetch_acl_async( assert isinstance(response, document_service.FetchAclResponse) -@pytest.mark.asyncio -async def test_fetch_acl_async_from_dict(): - await test_fetch_acl_async(request_type=dict) - - def test_fetch_acl_field_headers(): client = DocumentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3964,8 +3980,8 @@ async def test_fetch_acl_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - document_service_request.SetAclRequest, - dict, + document_service_request.SetAclRequest(), + {}, ], ) def test_set_acl(request_type, transport: str = "grpc"): @@ -3976,7 +3992,7 @@ def test_set_acl(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.set_acl), "__call__") as call: @@ -4017,9 +4033,10 @@ def test_set_acl_non_empty_request_with_auto_populated_field(): client.set_acl(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_service_request.SetAclRequest( + request_msg = document_service_request.SetAclRequest( resource="resource_value", ) + assert args[0] == request_msg def test_set_acl_use_cached_wrapped_rpc(): @@ -4098,9 +4115,14 @@ async def test_set_acl_async_use_cached_wrapped_rpc(transport: str = "grpc_async @pytest.mark.asyncio -async def test_set_acl_async( - transport: str = "grpc_asyncio", request_type=document_service_request.SetAclRequest -): +@pytest.mark.parametrize( + "request_type", + [ + document_service_request.SetAclRequest(), + {}, + ], +) +async def test_set_acl_async(request_type, transport: str = "grpc_asyncio"): client = DocumentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4108,7 +4130,7 @@ async def test_set_acl_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.set_acl), "__call__") as call: @@ -4128,11 +4150,6 @@ async def test_set_acl_async( assert isinstance(response, document_service.SetAclResponse) -@pytest.mark.asyncio -async def test_set_acl_async_from_dict(): - await test_set_acl_async(request_type=dict) - - def test_set_acl_field_headers(): client = DocumentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5944,7 +5961,6 @@ def test_create_document_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service_request.CreateDocumentRequest() - assert args[0] == request_msg @@ -5965,7 +5981,6 @@ def test_get_document_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service_request.GetDocumentRequest() - assert args[0] == request_msg @@ -5986,7 +6001,6 @@ def test_update_document_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service_request.UpdateDocumentRequest() - assert args[0] == request_msg @@ -6007,7 +6021,6 @@ def test_delete_document_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service_request.DeleteDocumentRequest() - assert args[0] == request_msg @@ -6028,7 +6041,6 @@ def test_search_documents_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service_request.SearchDocumentsRequest() - assert args[0] == request_msg @@ -6049,7 +6061,6 @@ def test_lock_document_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service_request.LockDocumentRequest() - assert args[0] == request_msg @@ -6070,7 +6081,6 @@ def test_fetch_acl_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service_request.FetchAclRequest() - assert args[0] == request_msg @@ -6091,7 +6101,6 @@ def test_set_acl_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service_request.SetAclRequest() - assert args[0] == request_msg @@ -6130,7 +6139,6 @@ async def test_create_document_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service_request.CreateDocumentRequest() - assert args[0] == request_msg @@ -6171,7 +6179,6 @@ async def test_get_document_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service_request.GetDocumentRequest() - assert args[0] == request_msg @@ -6196,7 +6203,6 @@ async def test_update_document_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service_request.UpdateDocumentRequest() - assert args[0] == request_msg @@ -6219,7 +6225,6 @@ async def test_delete_document_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service_request.DeleteDocumentRequest() - assert args[0] == request_msg @@ -6248,7 +6253,6 @@ async def test_search_documents_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service_request.SearchDocumentsRequest() - assert args[0] == request_msg @@ -6289,7 +6293,6 @@ async def test_lock_document_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service_request.LockDocumentRequest() - assert args[0] == request_msg @@ -6314,7 +6317,6 @@ async def test_fetch_acl_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service_request.FetchAclRequest() - assert args[0] == request_msg @@ -6339,7 +6341,6 @@ async def test_set_acl_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service_request.SetAclRequest() - assert args[0] == request_msg @@ -7539,7 +7540,6 @@ def test_create_document_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service_request.CreateDocumentRequest() - assert args[0] == request_msg @@ -7559,7 +7559,6 @@ def test_get_document_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service_request.GetDocumentRequest() - assert args[0] == request_msg @@ -7579,7 +7578,6 @@ def test_update_document_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service_request.UpdateDocumentRequest() - assert args[0] == request_msg @@ -7599,7 +7597,6 @@ def test_delete_document_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service_request.DeleteDocumentRequest() - assert args[0] == request_msg @@ -7619,7 +7616,6 @@ def test_search_documents_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service_request.SearchDocumentsRequest() - assert args[0] == request_msg @@ -7639,7 +7635,6 @@ def test_lock_document_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service_request.LockDocumentRequest() - assert args[0] == request_msg @@ -7659,7 +7654,6 @@ def test_fetch_acl_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service_request.FetchAclRequest() - assert args[0] == request_msg @@ -7679,7 +7673,6 @@ def test_set_acl_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service_request.SetAclRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-contentwarehouse/tests/unit/gapic/contentwarehouse_v1/test_pipeline_service.py b/packages/google-cloud-contentwarehouse/tests/unit/gapic/contentwarehouse_v1/test_pipeline_service.py index a0efb992eafa..157136f4d60b 100644 --- a/packages/google-cloud-contentwarehouse/tests/unit/gapic/contentwarehouse_v1/test_pipeline_service.py +++ b/packages/google-cloud-contentwarehouse/tests/unit/gapic/contentwarehouse_v1/test_pipeline_service.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 @@ -113,6 +114,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" @@ -1340,8 +1356,8 @@ def test_pipeline_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - pipeline_service.RunPipelineRequest, - dict, + pipeline_service.RunPipelineRequest(), + {}, ], ) def test_run_pipeline(request_type, transport: str = "grpc"): @@ -1352,7 +1368,7 @@ def test_run_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(type(client.transport.run_pipeline), "__call__") as call: @@ -1393,9 +1409,10 @@ def test_run_pipeline_non_empty_request_with_auto_populated_field(): client.run_pipeline(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == pipeline_service.RunPipelineRequest( + request_msg = pipeline_service.RunPipelineRequest( name="name_value", ) + assert args[0] == request_msg def test_run_pipeline_use_cached_wrapped_rpc(): @@ -1486,9 +1503,14 @@ async def test_run_pipeline_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_run_pipeline_async( - transport: str = "grpc_asyncio", request_type=pipeline_service.RunPipelineRequest -): +@pytest.mark.parametrize( + "request_type", + [ + pipeline_service.RunPipelineRequest(), + {}, + ], +) +async def test_run_pipeline_async(request_type, transport: str = "grpc_asyncio"): client = PipelineServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1496,7 +1518,7 @@ async def test_run_pipeline_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.run_pipeline), "__call__") as call: @@ -1516,11 +1538,6 @@ async def test_run_pipeline_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_run_pipeline_async_from_dict(): - await test_run_pipeline_async(request_type=dict) - - def test_run_pipeline_field_headers(): client = PipelineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1964,7 +1981,6 @@ def test_run_pipeline_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pipeline_service.RunPipelineRequest() - assert args[0] == request_msg @@ -2003,7 +2019,6 @@ async def test_run_pipeline_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pipeline_service.RunPipelineRequest() - assert args[0] == request_msg @@ -2225,7 +2240,6 @@ def test_run_pipeline_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pipeline_service.RunPipelineRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-contentwarehouse/tests/unit/gapic/contentwarehouse_v1/test_rule_set_service.py b/packages/google-cloud-contentwarehouse/tests/unit/gapic/contentwarehouse_v1/test_rule_set_service.py index 39b601d06e63..5c1a77697941 100644 --- a/packages/google-cloud-contentwarehouse/tests/unit/gapic/contentwarehouse_v1/test_rule_set_service.py +++ b/packages/google-cloud-contentwarehouse/tests/unit/gapic/contentwarehouse_v1/test_rule_set_service.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 @@ -110,6 +111,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" @@ -1317,8 +1333,8 @@ def test_rule_set_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - ruleset_service_request.CreateRuleSetRequest, - dict, + ruleset_service_request.CreateRuleSetRequest(), + {}, ], ) def test_create_rule_set(request_type, transport: str = "grpc"): @@ -1329,7 +1345,7 @@ def test_create_rule_set(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_rule_set), "__call__") as call: @@ -1377,9 +1393,10 @@ def test_create_rule_set_non_empty_request_with_auto_populated_field(): client.create_rule_set(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == ruleset_service_request.CreateRuleSetRequest( + request_msg = ruleset_service_request.CreateRuleSetRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_rule_set_use_cached_wrapped_rpc(): @@ -1460,10 +1477,14 @@ async def test_create_rule_set_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_rule_set_async( - transport: str = "grpc_asyncio", - request_type=ruleset_service_request.CreateRuleSetRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + ruleset_service_request.CreateRuleSetRequest(), + {}, + ], +) +async def test_create_rule_set_async(request_type, transport: str = "grpc_asyncio"): client = RuleSetServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1471,7 +1492,7 @@ async def test_create_rule_set_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_rule_set), "__call__") as call: @@ -1498,11 +1519,6 @@ async def test_create_rule_set_async( assert response.source == "source_value" -@pytest.mark.asyncio -async def test_create_rule_set_async_from_dict(): - await test_create_rule_set_async(request_type=dict) - - def test_create_rule_set_field_headers(): client = RuleSetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1655,8 +1671,8 @@ async def test_create_rule_set_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - ruleset_service_request.GetRuleSetRequest, - dict, + ruleset_service_request.GetRuleSetRequest(), + {}, ], ) def test_get_rule_set(request_type, transport: str = "grpc"): @@ -1667,7 +1683,7 @@ def test_get_rule_set(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_rule_set), "__call__") as call: @@ -1715,9 +1731,10 @@ def test_get_rule_set_non_empty_request_with_auto_populated_field(): client.get_rule_set(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == ruleset_service_request.GetRuleSetRequest( + request_msg = ruleset_service_request.GetRuleSetRequest( name="name_value", ) + assert args[0] == request_msg def test_get_rule_set_use_cached_wrapped_rpc(): @@ -1798,10 +1815,14 @@ async def test_get_rule_set_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_rule_set_async( - transport: str = "grpc_asyncio", - request_type=ruleset_service_request.GetRuleSetRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + ruleset_service_request.GetRuleSetRequest(), + {}, + ], +) +async def test_get_rule_set_async(request_type, transport: str = "grpc_asyncio"): client = RuleSetServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1809,7 +1830,7 @@ async def test_get_rule_set_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_rule_set), "__call__") as call: @@ -1836,11 +1857,6 @@ async def test_get_rule_set_async( assert response.source == "source_value" -@pytest.mark.asyncio -async def test_get_rule_set_async_from_dict(): - await test_get_rule_set_async(request_type=dict) - - def test_get_rule_set_field_headers(): client = RuleSetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1983,8 +1999,8 @@ async def test_get_rule_set_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - ruleset_service_request.UpdateRuleSetRequest, - dict, + ruleset_service_request.UpdateRuleSetRequest(), + {}, ], ) def test_update_rule_set(request_type, transport: str = "grpc"): @@ -1995,7 +2011,7 @@ def test_update_rule_set(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_rule_set), "__call__") as call: @@ -2043,9 +2059,10 @@ def test_update_rule_set_non_empty_request_with_auto_populated_field(): client.update_rule_set(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == ruleset_service_request.UpdateRuleSetRequest( + request_msg = ruleset_service_request.UpdateRuleSetRequest( name="name_value", ) + assert args[0] == request_msg def test_update_rule_set_use_cached_wrapped_rpc(): @@ -2126,10 +2143,14 @@ async def test_update_rule_set_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_rule_set_async( - transport: str = "grpc_asyncio", - request_type=ruleset_service_request.UpdateRuleSetRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + ruleset_service_request.UpdateRuleSetRequest(), + {}, + ], +) +async def test_update_rule_set_async(request_type, transport: str = "grpc_asyncio"): client = RuleSetServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2137,7 +2158,7 @@ async def test_update_rule_set_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_rule_set), "__call__") as call: @@ -2164,11 +2185,6 @@ async def test_update_rule_set_async( assert response.source == "source_value" -@pytest.mark.asyncio -async def test_update_rule_set_async_from_dict(): - await test_update_rule_set_async(request_type=dict) - - def test_update_rule_set_field_headers(): client = RuleSetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2321,8 +2337,8 @@ async def test_update_rule_set_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - ruleset_service_request.DeleteRuleSetRequest, - dict, + ruleset_service_request.DeleteRuleSetRequest(), + {}, ], ) def test_delete_rule_set(request_type, transport: str = "grpc"): @@ -2333,7 +2349,7 @@ def test_delete_rule_set(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_rule_set), "__call__") as call: @@ -2374,9 +2390,10 @@ def test_delete_rule_set_non_empty_request_with_auto_populated_field(): client.delete_rule_set(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == ruleset_service_request.DeleteRuleSetRequest( + request_msg = ruleset_service_request.DeleteRuleSetRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_rule_set_use_cached_wrapped_rpc(): @@ -2457,10 +2474,14 @@ async def test_delete_rule_set_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_rule_set_async( - transport: str = "grpc_asyncio", - request_type=ruleset_service_request.DeleteRuleSetRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + ruleset_service_request.DeleteRuleSetRequest(), + {}, + ], +) +async def test_delete_rule_set_async(request_type, transport: str = "grpc_asyncio"): client = RuleSetServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2468,7 +2489,7 @@ async def test_delete_rule_set_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_rule_set), "__call__") as call: @@ -2486,11 +2507,6 @@ async def test_delete_rule_set_async( assert response is None -@pytest.mark.asyncio -async def test_delete_rule_set_async_from_dict(): - await test_delete_rule_set_async(request_type=dict) - - def test_delete_rule_set_field_headers(): client = RuleSetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2633,8 +2649,8 @@ async def test_delete_rule_set_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - ruleset_service_request.ListRuleSetsRequest, - dict, + ruleset_service_request.ListRuleSetsRequest(), + {}, ], ) def test_list_rule_sets(request_type, transport: str = "grpc"): @@ -2645,7 +2661,7 @@ def test_list_rule_sets(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_rule_sets), "__call__") as call: @@ -2690,10 +2706,11 @@ def test_list_rule_sets_non_empty_request_with_auto_populated_field(): client.list_rule_sets(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == ruleset_service_request.ListRuleSetsRequest( + request_msg = ruleset_service_request.ListRuleSetsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_rule_sets_use_cached_wrapped_rpc(): @@ -2774,10 +2791,14 @@ async def test_list_rule_sets_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_rule_sets_async( - transport: str = "grpc_asyncio", - request_type=ruleset_service_request.ListRuleSetsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + ruleset_service_request.ListRuleSetsRequest(), + {}, + ], +) +async def test_list_rule_sets_async(request_type, transport: str = "grpc_asyncio"): client = RuleSetServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2785,7 +2806,7 @@ async def test_list_rule_sets_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_rule_sets), "__call__") as call: @@ -2808,11 +2829,6 @@ async def test_list_rule_sets_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_rule_sets_async_from_dict(): - await test_list_rule_sets_async(request_type=dict) - - def test_list_rule_sets_field_headers(): client = RuleSetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4249,7 +4265,6 @@ def test_create_rule_set_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ruleset_service_request.CreateRuleSetRequest() - assert args[0] == request_msg @@ -4270,7 +4285,6 @@ def test_get_rule_set_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ruleset_service_request.GetRuleSetRequest() - assert args[0] == request_msg @@ -4291,7 +4305,6 @@ def test_update_rule_set_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ruleset_service_request.UpdateRuleSetRequest() - assert args[0] == request_msg @@ -4312,7 +4325,6 @@ def test_delete_rule_set_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ruleset_service_request.DeleteRuleSetRequest() - assert args[0] == request_msg @@ -4333,7 +4345,6 @@ def test_list_rule_sets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ruleset_service_request.ListRuleSetsRequest() - assert args[0] == request_msg @@ -4376,7 +4387,6 @@ async def test_create_rule_set_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ruleset_service_request.CreateRuleSetRequest() - assert args[0] == request_msg @@ -4405,7 +4415,6 @@ async def test_get_rule_set_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ruleset_service_request.GetRuleSetRequest() - assert args[0] == request_msg @@ -4434,7 +4443,6 @@ async def test_update_rule_set_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ruleset_service_request.UpdateRuleSetRequest() - assert args[0] == request_msg @@ -4457,7 +4465,6 @@ async def test_delete_rule_set_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ruleset_service_request.DeleteRuleSetRequest() - assert args[0] == request_msg @@ -4484,7 +4491,6 @@ async def test_list_rule_sets_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ruleset_service_request.ListRuleSetsRequest() - assert args[0] == request_msg @@ -5363,7 +5369,6 @@ def test_create_rule_set_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ruleset_service_request.CreateRuleSetRequest() - assert args[0] == request_msg @@ -5383,7 +5388,6 @@ def test_get_rule_set_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ruleset_service_request.GetRuleSetRequest() - assert args[0] == request_msg @@ -5403,7 +5407,6 @@ def test_update_rule_set_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ruleset_service_request.UpdateRuleSetRequest() - assert args[0] == request_msg @@ -5423,7 +5426,6 @@ def test_delete_rule_set_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ruleset_service_request.DeleteRuleSetRequest() - assert args[0] == request_msg @@ -5443,7 +5445,6 @@ def test_list_rule_sets_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ruleset_service_request.ListRuleSetsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-contentwarehouse/tests/unit/gapic/contentwarehouse_v1/test_synonym_set_service.py b/packages/google-cloud-contentwarehouse/tests/unit/gapic/contentwarehouse_v1/test_synonym_set_service.py index dbc2b903d677..7153ded3ae85 100644 --- a/packages/google-cloud-contentwarehouse/tests/unit/gapic/contentwarehouse_v1/test_synonym_set_service.py +++ b/packages/google-cloud-contentwarehouse/tests/unit/gapic/contentwarehouse_v1/test_synonym_set_service.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" @@ -1352,8 +1368,8 @@ def test_synonym_set_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - synonymset_service_request.CreateSynonymSetRequest, - dict, + synonymset_service_request.CreateSynonymSetRequest(), + {}, ], ) def test_create_synonym_set(request_type, transport: str = "grpc"): @@ -1364,7 +1380,7 @@ def test_create_synonym_set(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1414,9 +1430,10 @@ def test_create_synonym_set_non_empty_request_with_auto_populated_field(): client.create_synonym_set(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == synonymset_service_request.CreateSynonymSetRequest( + request_msg = synonymset_service_request.CreateSynonymSetRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_synonym_set_use_cached_wrapped_rpc(): @@ -1501,10 +1518,14 @@ async def test_create_synonym_set_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_synonym_set_async( - transport: str = "grpc_asyncio", - request_type=synonymset_service_request.CreateSynonymSetRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + synonymset_service_request.CreateSynonymSetRequest(), + {}, + ], +) +async def test_create_synonym_set_async(request_type, transport: str = "grpc_asyncio"): client = SynonymSetServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1512,7 +1533,7 @@ async def test_create_synonym_set_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( @@ -1539,11 +1560,6 @@ async def test_create_synonym_set_async( assert response.context == "context_value" -@pytest.mark.asyncio -async def test_create_synonym_set_async_from_dict(): - await test_create_synonym_set_async(request_type=dict) - - def test_create_synonym_set_field_headers(): client = SynonymSetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1708,8 +1724,8 @@ async def test_create_synonym_set_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - synonymset_service_request.GetSynonymSetRequest, - dict, + synonymset_service_request.GetSynonymSetRequest(), + {}, ], ) def test_get_synonym_set(request_type, transport: str = "grpc"): @@ -1720,7 +1736,7 @@ def test_get_synonym_set(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_synonym_set), "__call__") as call: @@ -1766,9 +1782,10 @@ def test_get_synonym_set_non_empty_request_with_auto_populated_field(): client.get_synonym_set(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == synonymset_service_request.GetSynonymSetRequest( + request_msg = synonymset_service_request.GetSynonymSetRequest( name="name_value", ) + assert args[0] == request_msg def test_get_synonym_set_use_cached_wrapped_rpc(): @@ -1849,10 +1866,14 @@ async def test_get_synonym_set_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_synonym_set_async( - transport: str = "grpc_asyncio", - request_type=synonymset_service_request.GetSynonymSetRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + synonymset_service_request.GetSynonymSetRequest(), + {}, + ], +) +async def test_get_synonym_set_async(request_type, transport: str = "grpc_asyncio"): client = SynonymSetServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1860,7 +1881,7 @@ async def test_get_synonym_set_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_synonym_set), "__call__") as call: @@ -1885,11 +1906,6 @@ async def test_get_synonym_set_async( assert response.context == "context_value" -@pytest.mark.asyncio -async def test_get_synonym_set_async_from_dict(): - await test_get_synonym_set_async(request_type=dict) - - def test_get_synonym_set_field_headers(): client = SynonymSetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2036,8 +2052,8 @@ async def test_get_synonym_set_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - synonymset_service_request.UpdateSynonymSetRequest, - dict, + synonymset_service_request.UpdateSynonymSetRequest(), + {}, ], ) def test_update_synonym_set(request_type, transport: str = "grpc"): @@ -2048,7 +2064,7 @@ def test_update_synonym_set(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2098,9 +2114,10 @@ def test_update_synonym_set_non_empty_request_with_auto_populated_field(): client.update_synonym_set(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == synonymset_service_request.UpdateSynonymSetRequest( + request_msg = synonymset_service_request.UpdateSynonymSetRequest( name="name_value", ) + assert args[0] == request_msg def test_update_synonym_set_use_cached_wrapped_rpc(): @@ -2185,10 +2202,14 @@ async def test_update_synonym_set_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_synonym_set_async( - transport: str = "grpc_asyncio", - request_type=synonymset_service_request.UpdateSynonymSetRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + synonymset_service_request.UpdateSynonymSetRequest(), + {}, + ], +) +async def test_update_synonym_set_async(request_type, transport: str = "grpc_asyncio"): client = SynonymSetServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2196,7 +2217,7 @@ async def test_update_synonym_set_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( @@ -2223,11 +2244,6 @@ async def test_update_synonym_set_async( assert response.context == "context_value" -@pytest.mark.asyncio -async def test_update_synonym_set_async_from_dict(): - await test_update_synonym_set_async(request_type=dict) - - def test_update_synonym_set_field_headers(): client = SynonymSetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2392,8 +2408,8 @@ async def test_update_synonym_set_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - synonymset_service_request.DeleteSynonymSetRequest, - dict, + synonymset_service_request.DeleteSynonymSetRequest(), + {}, ], ) def test_delete_synonym_set(request_type, transport: str = "grpc"): @@ -2404,7 +2420,7 @@ def test_delete_synonym_set(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2449,9 +2465,10 @@ def test_delete_synonym_set_non_empty_request_with_auto_populated_field(): client.delete_synonym_set(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == synonymset_service_request.DeleteSynonymSetRequest( + request_msg = synonymset_service_request.DeleteSynonymSetRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_synonym_set_use_cached_wrapped_rpc(): @@ -2536,10 +2553,14 @@ async def test_delete_synonym_set_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_synonym_set_async( - transport: str = "grpc_asyncio", - request_type=synonymset_service_request.DeleteSynonymSetRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + synonymset_service_request.DeleteSynonymSetRequest(), + {}, + ], +) +async def test_delete_synonym_set_async(request_type, transport: str = "grpc_asyncio"): client = SynonymSetServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2547,7 +2568,7 @@ async def test_delete_synonym_set_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( @@ -2567,11 +2588,6 @@ async def test_delete_synonym_set_async( assert response is None -@pytest.mark.asyncio -async def test_delete_synonym_set_async_from_dict(): - await test_delete_synonym_set_async(request_type=dict) - - def test_delete_synonym_set_field_headers(): client = SynonymSetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2722,8 +2738,8 @@ async def test_delete_synonym_set_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - synonymset_service_request.ListSynonymSetsRequest, - dict, + synonymset_service_request.ListSynonymSetsRequest(), + {}, ], ) def test_list_synonym_sets(request_type, transport: str = "grpc"): @@ -2734,7 +2750,7 @@ def test_list_synonym_sets(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2783,10 +2799,11 @@ def test_list_synonym_sets_non_empty_request_with_auto_populated_field(): client.list_synonym_sets(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == synonymset_service_request.ListSynonymSetsRequest( + request_msg = synonymset_service_request.ListSynonymSetsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_synonym_sets_use_cached_wrapped_rpc(): @@ -2869,10 +2886,14 @@ async def test_list_synonym_sets_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_synonym_sets_async( - transport: str = "grpc_asyncio", - request_type=synonymset_service_request.ListSynonymSetsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + synonymset_service_request.ListSynonymSetsRequest(), + {}, + ], +) +async def test_list_synonym_sets_async(request_type, transport: str = "grpc_asyncio"): client = SynonymSetServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2880,7 +2901,7 @@ async def test_list_synonym_sets_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( @@ -2905,11 +2926,6 @@ async def test_list_synonym_sets_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_synonym_sets_async_from_dict(): - await test_list_synonym_sets_async(request_type=dict) - - def test_list_synonym_sets_field_headers(): client = SynonymSetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4394,7 +4410,6 @@ def test_create_synonym_set_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = synonymset_service_request.CreateSynonymSetRequest() - assert args[0] == request_msg @@ -4415,7 +4430,6 @@ def test_get_synonym_set_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = synonymset_service_request.GetSynonymSetRequest() - assert args[0] == request_msg @@ -4438,7 +4452,6 @@ def test_update_synonym_set_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = synonymset_service_request.UpdateSynonymSetRequest() - assert args[0] == request_msg @@ -4461,7 +4474,6 @@ def test_delete_synonym_set_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = synonymset_service_request.DeleteSynonymSetRequest() - assert args[0] == request_msg @@ -4484,7 +4496,6 @@ def test_list_synonym_sets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = synonymset_service_request.ListSynonymSetsRequest() - assert args[0] == request_msg @@ -4528,7 +4539,6 @@ async def test_create_synonym_set_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = synonymset_service_request.CreateSynonymSetRequest() - assert args[0] == request_msg @@ -4556,7 +4566,6 @@ async def test_get_synonym_set_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = synonymset_service_request.GetSynonymSetRequest() - assert args[0] == request_msg @@ -4586,7 +4595,6 @@ async def test_update_synonym_set_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = synonymset_service_request.UpdateSynonymSetRequest() - assert args[0] == request_msg @@ -4611,7 +4619,6 @@ async def test_delete_synonym_set_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = synonymset_service_request.DeleteSynonymSetRequest() - assert args[0] == request_msg @@ -4640,7 +4647,6 @@ async def test_list_synonym_sets_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = synonymset_service_request.ListSynonymSetsRequest() - assert args[0] == request_msg @@ -5534,7 +5540,6 @@ def test_create_synonym_set_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = synonymset_service_request.CreateSynonymSetRequest() - assert args[0] == request_msg @@ -5554,7 +5559,6 @@ def test_get_synonym_set_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = synonymset_service_request.GetSynonymSetRequest() - assert args[0] == request_msg @@ -5576,7 +5580,6 @@ def test_update_synonym_set_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = synonymset_service_request.UpdateSynonymSetRequest() - assert args[0] == request_msg @@ -5598,7 +5601,6 @@ def test_delete_synonym_set_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = synonymset_service_request.DeleteSynonymSetRequest() - assert args[0] == request_msg @@ -5620,7 +5622,6 @@ def test_list_synonym_sets_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = synonymset_service_request.ListSynonymSetsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-data-fusion/noxfile.py b/packages/google-cloud-data-fusion/noxfile.py index e63b9910342d..bd3ea36f0386 100644 --- a/packages/google-cloud-data-fusion/noxfile.py +++ b/packages/google-cloud-data-fusion/noxfile.py @@ -47,7 +47,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-data-fusion" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-data-fusion/setup.py b/packages/google-cloud-data-fusion/setup.py index 1e570518187f..e885b43b28a4 100644 --- a/packages/google-cloud-data-fusion/setup.py +++ b/packages/google-cloud-data-fusion/setup.py @@ -45,7 +45,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/google-cloud-data-fusion/testing/constraints-3.10.txt b/packages/google-cloud-data-fusion/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-data-fusion/testing/constraints-3.10.txt +++ b/packages/google-cloud-data-fusion/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-data-fusion/tests/unit/gapic/data_fusion_v1/test_data_fusion.py b/packages/google-cloud-data-fusion/tests/unit/gapic/data_fusion_v1/test_data_fusion.py index c91cd8c7be64..4f0dd1e091d0 100644 --- a/packages/google-cloud-data-fusion/tests/unit/gapic/data_fusion_v1/test_data_fusion.py +++ b/packages/google-cloud-data-fusion/tests/unit/gapic/data_fusion_v1/test_data_fusion.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 @@ -115,6 +116,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" @@ -1276,8 +1292,8 @@ def test_data_fusion_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - datafusion.ListAvailableVersionsRequest, - dict, + datafusion.ListAvailableVersionsRequest(), + {}, ], ) def test_list_available_versions(request_type, transport: str = "grpc"): @@ -1288,7 +1304,7 @@ def test_list_available_versions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1337,10 +1353,11 @@ def test_list_available_versions_non_empty_request_with_auto_populated_field(): client.list_available_versions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datafusion.ListAvailableVersionsRequest( + request_msg = datafusion.ListAvailableVersionsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_available_versions_use_cached_wrapped_rpc(): @@ -1426,9 +1443,15 @@ async def test_list_available_versions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + datafusion.ListAvailableVersionsRequest(), + {}, + ], +) async def test_list_available_versions_async( - transport: str = "grpc_asyncio", - request_type=datafusion.ListAvailableVersionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataFusionAsyncClient( credentials=async_anonymous_credentials(), @@ -1437,7 +1460,7 @@ async def test_list_available_versions_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( @@ -1462,11 +1485,6 @@ async def test_list_available_versions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_available_versions_async_from_dict(): - await test_list_available_versions_async(request_type=dict) - - def test_list_available_versions_field_headers(): client = DataFusionClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1819,8 +1837,8 @@ async def test_list_available_versions_async_pages(): @pytest.mark.parametrize( "request_type", [ - datafusion.ListInstancesRequest, - dict, + datafusion.ListInstancesRequest(), + {}, ], ) def test_list_instances(request_type, transport: str = "grpc"): @@ -1831,7 +1849,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(type(client.transport.list_instances), "__call__") as call: @@ -1880,12 +1898,13 @@ 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] == datafusion.ListInstancesRequest( + request_msg = datafusion.ListInstancesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_instances_use_cached_wrapped_rpc(): @@ -1966,9 +1985,14 @@ async def test_list_instances_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_instances_async( - transport: str = "grpc_asyncio", request_type=datafusion.ListInstancesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datafusion.ListInstancesRequest(), + {}, + ], +) +async def test_list_instances_async(request_type, transport: str = "grpc_asyncio"): client = DataFusionAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1976,7 +2000,7 @@ async def test_list_instances_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_instances), "__call__") as call: @@ -2001,11 +2025,6 @@ async def test_list_instances_async( 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 = DataFusionClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2260,8 +2279,8 @@ async def test_list_instances_async_pages(): @pytest.mark.parametrize( "request_type", [ - datafusion.GetInstanceRequest, - dict, + datafusion.GetInstanceRequest(), + {}, ], ) def test_get_instance(request_type, transport: str = "grpc"): @@ -2272,7 +2291,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(type(client.transport.get_instance), "__call__") as call: @@ -2356,9 +2375,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] == datafusion.GetInstanceRequest( + request_msg = datafusion.GetInstanceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_instance_use_cached_wrapped_rpc(): @@ -2439,9 +2459,14 @@ async def test_get_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_instance_async( - transport: str = "grpc_asyncio", request_type=datafusion.GetInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datafusion.GetInstanceRequest(), + {}, + ], +) +async def test_get_instance_async(request_type, transport: str = "grpc_asyncio"): client = DataFusionAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2449,7 +2474,7 @@ async def test_get_instance_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_instance), "__call__") as call: @@ -2512,11 +2537,6 @@ async def test_get_instance_async( ] -@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 = DataFusionClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2579,8 +2599,8 @@ async def test_get_instance_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - datafusion.CreateInstanceRequest, - dict, + datafusion.CreateInstanceRequest(), + {}, ], ) def test_create_instance(request_type, transport: str = "grpc"): @@ -2591,7 +2611,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(type(client.transport.create_instance), "__call__") as call: @@ -2633,10 +2653,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] == datafusion.CreateInstanceRequest( + request_msg = datafusion.CreateInstanceRequest( parent="parent_value", instance_id="instance_id_value", ) + assert args[0] == request_msg def test_create_instance_use_cached_wrapped_rpc(): @@ -2727,9 +2748,14 @@ async def test_create_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_instance_async( - transport: str = "grpc_asyncio", request_type=datafusion.CreateInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datafusion.CreateInstanceRequest(), + {}, + ], +) +async def test_create_instance_async(request_type, transport: str = "grpc_asyncio"): client = DataFusionAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2737,7 +2763,7 @@ async def test_create_instance_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_instance), "__call__") as call: @@ -2757,11 +2783,6 @@ async def test_create_instance_async( 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 = DataFusionClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2928,8 +2949,8 @@ async def test_create_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datafusion.DeleteInstanceRequest, - dict, + datafusion.DeleteInstanceRequest(), + {}, ], ) def test_delete_instance(request_type, transport: str = "grpc"): @@ -2940,7 +2961,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(type(client.transport.delete_instance), "__call__") as call: @@ -2981,9 +3002,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] == datafusion.DeleteInstanceRequest( + request_msg = datafusion.DeleteInstanceRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_instance_use_cached_wrapped_rpc(): @@ -3074,9 +3096,14 @@ async def test_delete_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_instance_async( - transport: str = "grpc_asyncio", request_type=datafusion.DeleteInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datafusion.DeleteInstanceRequest(), + {}, + ], +) +async def test_delete_instance_async(request_type, transport: str = "grpc_asyncio"): client = DataFusionAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3084,7 +3111,7 @@ async def test_delete_instance_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_instance), "__call__") as call: @@ -3104,11 +3131,6 @@ async def test_delete_instance_async( 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 = DataFusionClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3255,8 +3277,8 @@ async def test_delete_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datafusion.UpdateInstanceRequest, - dict, + datafusion.UpdateInstanceRequest(), + {}, ], ) def test_update_instance(request_type, transport: str = "grpc"): @@ -3267,7 +3289,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(type(client.transport.update_instance), "__call__") as call: @@ -3306,7 +3328,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] - assert args[0] == datafusion.UpdateInstanceRequest() + request_msg = datafusion.UpdateInstanceRequest() + assert args[0] == request_msg def test_update_instance_use_cached_wrapped_rpc(): @@ -3397,9 +3420,14 @@ async def test_update_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_instance_async( - transport: str = "grpc_asyncio", request_type=datafusion.UpdateInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datafusion.UpdateInstanceRequest(), + {}, + ], +) +async def test_update_instance_async(request_type, transport: str = "grpc_asyncio"): client = DataFusionAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3407,7 +3435,7 @@ async def test_update_instance_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_instance), "__call__") as call: @@ -3427,11 +3455,6 @@ async def test_update_instance_async( 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 = DataFusionClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3588,8 +3611,8 @@ async def test_update_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datafusion.RestartInstanceRequest, - dict, + datafusion.RestartInstanceRequest(), + {}, ], ) def test_restart_instance(request_type, transport: str = "grpc"): @@ -3600,7 +3623,7 @@ def test_restart_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(type(client.transport.restart_instance), "__call__") as call: @@ -3641,9 +3664,10 @@ def test_restart_instance_non_empty_request_with_auto_populated_field(): client.restart_instance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datafusion.RestartInstanceRequest( + request_msg = datafusion.RestartInstanceRequest( name="name_value", ) + assert args[0] == request_msg def test_restart_instance_use_cached_wrapped_rpc(): @@ -3736,9 +3760,14 @@ async def test_restart_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_restart_instance_async( - transport: str = "grpc_asyncio", request_type=datafusion.RestartInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datafusion.RestartInstanceRequest(), + {}, + ], +) +async def test_restart_instance_async(request_type, transport: str = "grpc_asyncio"): client = DataFusionAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3746,7 +3775,7 @@ async def test_restart_instance_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.restart_instance), "__call__") as call: @@ -3766,11 +3795,6 @@ async def test_restart_instance_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_restart_instance_async_from_dict(): - await test_restart_instance_async(request_type=dict) - - def test_restart_instance_field_headers(): client = DataFusionClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5222,7 +5246,6 @@ def test_list_available_versions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datafusion.ListAvailableVersionsRequest() - assert args[0] == request_msg @@ -5243,7 +5266,6 @@ def test_list_instances_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datafusion.ListInstancesRequest() - assert args[0] == request_msg @@ -5264,7 +5286,6 @@ def test_get_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datafusion.GetInstanceRequest() - assert args[0] == request_msg @@ -5285,7 +5306,6 @@ def test_create_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datafusion.CreateInstanceRequest() - assert args[0] == request_msg @@ -5306,7 +5326,6 @@ def test_delete_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datafusion.DeleteInstanceRequest() - assert args[0] == request_msg @@ -5327,7 +5346,6 @@ def test_update_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datafusion.UpdateInstanceRequest() - assert args[0] == request_msg @@ -5348,7 +5366,6 @@ def test_restart_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datafusion.RestartInstanceRequest() - assert args[0] == request_msg @@ -5391,7 +5408,6 @@ async def test_list_available_versions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datafusion.ListAvailableVersionsRequest() - assert args[0] == request_msg @@ -5419,7 +5435,6 @@ async def test_list_instances_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datafusion.ListInstancesRequest() - assert args[0] == request_msg @@ -5465,7 +5480,6 @@ async def test_get_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datafusion.GetInstanceRequest() - assert args[0] == request_msg @@ -5490,7 +5504,6 @@ async def test_create_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datafusion.CreateInstanceRequest() - assert args[0] == request_msg @@ -5515,7 +5528,6 @@ async def test_delete_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datafusion.DeleteInstanceRequest() - assert args[0] == request_msg @@ -5540,7 +5552,6 @@ async def test_update_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datafusion.UpdateInstanceRequest() - assert args[0] == request_msg @@ -5565,7 +5576,6 @@ async def test_restart_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datafusion.RestartInstanceRequest() - assert args[0] == request_msg @@ -6759,7 +6769,6 @@ def test_list_available_versions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datafusion.ListAvailableVersionsRequest() - assert args[0] == request_msg @@ -6779,7 +6788,6 @@ def test_list_instances_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datafusion.ListInstancesRequest() - assert args[0] == request_msg @@ -6799,7 +6807,6 @@ def test_get_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datafusion.GetInstanceRequest() - assert args[0] == request_msg @@ -6819,7 +6826,6 @@ def test_create_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datafusion.CreateInstanceRequest() - assert args[0] == request_msg @@ -6839,7 +6845,6 @@ def test_delete_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datafusion.DeleteInstanceRequest() - assert args[0] == request_msg @@ -6859,7 +6864,6 @@ def test_update_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datafusion.UpdateInstanceRequest() - assert args[0] == request_msg @@ -6879,7 +6883,6 @@ def test_restart_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datafusion.RestartInstanceRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-data-qna/noxfile.py b/packages/google-cloud-data-qna/noxfile.py index 4f62c2b9da35..043ebd79a0bb 100644 --- a/packages/google-cloud-data-qna/noxfile.py +++ b/packages/google-cloud-data-qna/noxfile.py @@ -47,7 +47,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-data-qna" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-data-qna/setup.py b/packages/google-cloud-data-qna/setup.py index 3926df05e6b1..680a0e811f7e 100644 --- a/packages/google-cloud-data-qna/setup.py +++ b/packages/google-cloud-data-qna/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/google-cloud-data-qna/testing/constraints-3.10.txt b/packages/google-cloud-data-qna/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-data-qna/testing/constraints-3.10.txt +++ b/packages/google-cloud-data-qna/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-data-qna/tests/unit/gapic/dataqna_v1alpha/test_auto_suggestion_service.py b/packages/google-cloud-data-qna/tests/unit/gapic/dataqna_v1alpha/test_auto_suggestion_service.py index 6ab507a17e40..1d17ad375472 100644 --- a/packages/google-cloud-data-qna/tests/unit/gapic/dataqna_v1alpha/test_auto_suggestion_service.py +++ b/packages/google-cloud-data-qna/tests/unit/gapic/dataqna_v1alpha/test_auto_suggestion_service.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 @@ -106,6 +107,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" @@ -1371,8 +1387,8 @@ def test_auto_suggestion_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - auto_suggestion_service.SuggestQueriesRequest, - dict, + auto_suggestion_service.SuggestQueriesRequest(), + {}, ], ) def test_suggest_queries(request_type, transport: str = "grpc"): @@ -1383,7 +1399,7 @@ def test_suggest_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(type(client.transport.suggest_queries), "__call__") as call: @@ -1425,10 +1441,11 @@ def test_suggest_queries_non_empty_request_with_auto_populated_field(): client.suggest_queries(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == auto_suggestion_service.SuggestQueriesRequest( + request_msg = auto_suggestion_service.SuggestQueriesRequest( parent="parent_value", query="query_value", ) + assert args[0] == request_msg def test_suggest_queries_use_cached_wrapped_rpc(): @@ -1509,10 +1526,14 @@ async def test_suggest_queries_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_suggest_queries_async( - transport: str = "grpc_asyncio", - request_type=auto_suggestion_service.SuggestQueriesRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + auto_suggestion_service.SuggestQueriesRequest(), + {}, + ], +) +async def test_suggest_queries_async(request_type, transport: str = "grpc_asyncio"): client = AutoSuggestionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1520,7 +1541,7 @@ async def test_suggest_queries_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.suggest_queries), "__call__") as call: @@ -1540,11 +1561,6 @@ async def test_suggest_queries_async( assert isinstance(response, auto_suggestion_service.SuggestQueriesResponse) -@pytest.mark.asyncio -async def test_suggest_queries_async_from_dict(): - await test_suggest_queries_async(request_type=dict) - - def test_suggest_queries_field_headers(): client = AutoSuggestionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1852,7 +1868,6 @@ def test_suggest_queries_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = auto_suggestion_service.SuggestQueriesRequest() - assert args[0] == request_msg @@ -1891,7 +1906,6 @@ async def test_suggest_queries_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = auto_suggestion_service.SuggestQueriesRequest() - assert args[0] == request_msg @@ -2058,7 +2072,6 @@ def test_suggest_queries_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = auto_suggestion_service.SuggestQueriesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-data-qna/tests/unit/gapic/dataqna_v1alpha/test_question_service.py b/packages/google-cloud-data-qna/tests/unit/gapic/dataqna_v1alpha/test_question_service.py index 3c1ef4b9b547..b4726cb10eb1 100644 --- a/packages/google-cloud-data-qna/tests/unit/gapic/dataqna_v1alpha/test_question_service.py +++ b/packages/google-cloud-data-qna/tests/unit/gapic/dataqna_v1alpha/test_question_service.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 @@ -117,6 +118,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" @@ -1344,8 +1360,8 @@ def test_question_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - question_service.GetQuestionRequest, - dict, + question_service.GetQuestionRequest(), + {}, ], ) def test_get_question(request_type, transport: str = "grpc"): @@ -1356,7 +1372,7 @@ def test_get_question(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_question), "__call__") as call: @@ -1408,9 +1424,10 @@ def test_get_question_non_empty_request_with_auto_populated_field(): client.get_question(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == question_service.GetQuestionRequest( + request_msg = question_service.GetQuestionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_question_use_cached_wrapped_rpc(): @@ -1491,9 +1508,14 @@ async def test_get_question_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_question_async( - transport: str = "grpc_asyncio", request_type=question_service.GetQuestionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + question_service.GetQuestionRequest(), + {}, + ], +) +async def test_get_question_async(request_type, transport: str = "grpc_asyncio"): client = QuestionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1501,7 +1523,7 @@ async def test_get_question_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_question), "__call__") as call: @@ -1532,11 +1554,6 @@ async def test_get_question_async( assert response.user_email == "user_email_value" -@pytest.mark.asyncio -async def test_get_question_async_from_dict(): - await test_get_question_async(request_type=dict) - - def test_get_question_field_headers(): client = QuestionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1679,8 +1696,8 @@ async def test_get_question_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - question_service.CreateQuestionRequest, - dict, + question_service.CreateQuestionRequest(), + {}, ], ) def test_create_question(request_type, transport: str = "grpc"): @@ -1691,7 +1708,7 @@ def test_create_question(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_question), "__call__") as call: @@ -1743,9 +1760,10 @@ def test_create_question_non_empty_request_with_auto_populated_field(): client.create_question(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == question_service.CreateQuestionRequest( + request_msg = question_service.CreateQuestionRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_question_use_cached_wrapped_rpc(): @@ -1826,9 +1844,14 @@ async def test_create_question_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_question_async( - transport: str = "grpc_asyncio", request_type=question_service.CreateQuestionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + question_service.CreateQuestionRequest(), + {}, + ], +) +async def test_create_question_async(request_type, transport: str = "grpc_asyncio"): client = QuestionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1836,7 +1859,7 @@ async def test_create_question_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_question), "__call__") as call: @@ -1867,11 +1890,6 @@ async def test_create_question_async( assert response.user_email == "user_email_value" -@pytest.mark.asyncio -async def test_create_question_async_from_dict(): - await test_create_question_async(request_type=dict) - - def test_create_question_field_headers(): client = QuestionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2028,8 +2046,8 @@ async def test_create_question_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - question_service.ExecuteQuestionRequest, - dict, + question_service.ExecuteQuestionRequest(), + {}, ], ) def test_execute_question(request_type, transport: str = "grpc"): @@ -2040,7 +2058,7 @@ def test_execute_question(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.execute_question), "__call__") as call: @@ -2092,9 +2110,10 @@ def test_execute_question_non_empty_request_with_auto_populated_field(): client.execute_question(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == question_service.ExecuteQuestionRequest( + request_msg = question_service.ExecuteQuestionRequest( name="name_value", ) + assert args[0] == request_msg def test_execute_question_use_cached_wrapped_rpc(): @@ -2177,10 +2196,14 @@ async def test_execute_question_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_execute_question_async( - transport: str = "grpc_asyncio", - request_type=question_service.ExecuteQuestionRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + question_service.ExecuteQuestionRequest(), + {}, + ], +) +async def test_execute_question_async(request_type, transport: str = "grpc_asyncio"): client = QuestionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2188,7 +2211,7 @@ async def test_execute_question_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.execute_question), "__call__") as call: @@ -2219,11 +2242,6 @@ async def test_execute_question_async( assert response.user_email == "user_email_value" -@pytest.mark.asyncio -async def test_execute_question_async_from_dict(): - await test_execute_question_async(request_type=dict) - - def test_execute_question_field_headers(): client = QuestionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2376,8 +2394,8 @@ async def test_execute_question_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - question_service.GetUserFeedbackRequest, - dict, + question_service.GetUserFeedbackRequest(), + {}, ], ) def test_get_user_feedback(request_type, transport: str = "grpc"): @@ -2388,7 +2406,7 @@ def test_get_user_feedback(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2440,9 +2458,10 @@ def test_get_user_feedback_non_empty_request_with_auto_populated_field(): client.get_user_feedback(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == question_service.GetUserFeedbackRequest( + request_msg = question_service.GetUserFeedbackRequest( name="name_value", ) + assert args[0] == request_msg def test_get_user_feedback_use_cached_wrapped_rpc(): @@ -2525,10 +2544,14 @@ async def test_get_user_feedback_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_user_feedback_async( - transport: str = "grpc_asyncio", - request_type=question_service.GetUserFeedbackRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + question_service.GetUserFeedbackRequest(), + {}, + ], +) +async def test_get_user_feedback_async(request_type, transport: str = "grpc_asyncio"): client = QuestionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2536,7 +2559,7 @@ async def test_get_user_feedback_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( @@ -2565,11 +2588,6 @@ async def test_get_user_feedback_async( assert response.rating == user_feedback.UserFeedback.UserFeedbackRating.POSITIVE -@pytest.mark.asyncio -async def test_get_user_feedback_async_from_dict(): - await test_get_user_feedback_async(request_type=dict) - - def test_get_user_feedback_field_headers(): client = QuestionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2724,8 +2742,8 @@ async def test_get_user_feedback_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - question_service.UpdateUserFeedbackRequest, - dict, + question_service.UpdateUserFeedbackRequest(), + {}, ], ) def test_update_user_feedback(request_type, transport: str = "grpc"): @@ -2736,7 +2754,7 @@ def test_update_user_feedback(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2786,7 +2804,8 @@ def test_update_user_feedback_non_empty_request_with_auto_populated_field(): client.update_user_feedback(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == question_service.UpdateUserFeedbackRequest() + request_msg = question_service.UpdateUserFeedbackRequest() + assert args[0] == request_msg def test_update_user_feedback_use_cached_wrapped_rpc(): @@ -2871,9 +2890,15 @@ async def test_update_user_feedback_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + question_service.UpdateUserFeedbackRequest(), + {}, + ], +) async def test_update_user_feedback_async( - transport: str = "grpc_asyncio", - request_type=question_service.UpdateUserFeedbackRequest, + request_type, transport: str = "grpc_asyncio" ): client = QuestionServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2882,7 +2907,7 @@ async def test_update_user_feedback_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( @@ -2911,11 +2936,6 @@ async def test_update_user_feedback_async( assert response.rating == gcd_user_feedback.UserFeedback.UserFeedbackRating.POSITIVE -@pytest.mark.asyncio -async def test_update_user_feedback_async_from_dict(): - await test_update_user_feedback_async(request_type=dict) - - def test_update_user_feedback_field_headers(): client = QuestionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4136,7 +4156,6 @@ def test_get_question_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = question_service.GetQuestionRequest() - assert args[0] == request_msg @@ -4157,7 +4176,6 @@ def test_create_question_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = question_service.CreateQuestionRequest() - assert args[0] == request_msg @@ -4178,7 +4196,6 @@ def test_execute_question_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = question_service.ExecuteQuestionRequest() - assert args[0] == request_msg @@ -4201,7 +4218,6 @@ def test_get_user_feedback_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = question_service.GetUserFeedbackRequest() - assert args[0] == request_msg @@ -4224,7 +4240,6 @@ def test_update_user_feedback_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = question_service.UpdateUserFeedbackRequest() - assert args[0] == request_msg @@ -4269,7 +4284,6 @@ async def test_get_question_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = question_service.GetQuestionRequest() - assert args[0] == request_msg @@ -4300,7 +4314,6 @@ async def test_create_question_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = question_service.CreateQuestionRequest() - assert args[0] == request_msg @@ -4331,7 +4344,6 @@ async def test_execute_question_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = question_service.ExecuteQuestionRequest() - assert args[0] == request_msg @@ -4362,7 +4374,6 @@ async def test_get_user_feedback_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = question_service.GetUserFeedbackRequest() - assert args[0] == request_msg @@ -4393,7 +4404,6 @@ async def test_update_user_feedback_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = question_service.UpdateUserFeedbackRequest() - assert args[0] == request_msg @@ -5350,7 +5360,6 @@ def test_get_question_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = question_service.GetQuestionRequest() - assert args[0] == request_msg @@ -5370,7 +5379,6 @@ def test_create_question_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = question_service.CreateQuestionRequest() - assert args[0] == request_msg @@ -5390,7 +5398,6 @@ def test_execute_question_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = question_service.ExecuteQuestionRequest() - assert args[0] == request_msg @@ -5412,7 +5419,6 @@ def test_get_user_feedback_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = question_service.GetUserFeedbackRequest() - assert args[0] == request_msg @@ -5434,7 +5440,6 @@ def test_update_user_feedback_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = question_service.UpdateUserFeedbackRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-databasecenter/noxfile.py b/packages/google-cloud-databasecenter/noxfile.py index 19e4befc6810..003b7dd3c53f 100644 --- a/packages/google-cloud-databasecenter/noxfile.py +++ b/packages/google-cloud-databasecenter/noxfile.py @@ -47,7 +47,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-databasecenter" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-databasecenter/setup.py b/packages/google-cloud-databasecenter/setup.py index cf17b1bbf6ba..1dd5154980d1 100644 --- a/packages/google-cloud-databasecenter/setup.py +++ b/packages/google-cloud-databasecenter/setup.py @@ -45,7 +45,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/google-cloud-databasecenter/testing/constraints-3.10.txt b/packages/google-cloud-databasecenter/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-databasecenter/testing/constraints-3.10.txt +++ b/packages/google-cloud-databasecenter/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-databasecenter/tests/unit/gapic/databasecenter_v1beta/test_database_center.py b/packages/google-cloud-databasecenter/tests/unit/gapic/databasecenter_v1beta/test_database_center.py index dea5279f0212..4856002d0836 100644 --- a/packages/google-cloud-databasecenter/tests/unit/gapic/databasecenter_v1beta/test_database_center.py +++ b/packages/google-cloud-databasecenter/tests/unit/gapic/databasecenter_v1beta/test_database_center.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 @@ -108,6 +109,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" @@ -1311,8 +1327,8 @@ def test_database_center_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - service.QueryProductsRequest, - dict, + service.QueryProductsRequest(), + {}, ], ) def test_query_products(request_type, transport: str = "grpc"): @@ -1323,7 +1339,7 @@ def test_query_products(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.query_products), "__call__") as call: @@ -1370,10 +1386,11 @@ def test_query_products_non_empty_request_with_auto_populated_field(): client.query_products(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.QueryProductsRequest( + request_msg = service.QueryProductsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_query_products_use_cached_wrapped_rpc(): @@ -1454,9 +1471,14 @@ async def test_query_products_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_query_products_async( - transport: str = "grpc_asyncio", request_type=service.QueryProductsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.QueryProductsRequest(), + {}, + ], +) +async def test_query_products_async(request_type, transport: str = "grpc_asyncio"): client = DatabaseCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1464,7 +1486,7 @@ async def test_query_products_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.query_products), "__call__") as call: @@ -1489,11 +1511,6 @@ async def test_query_products_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_query_products_async_from_dict(): - await test_query_products_async(request_type=dict) - - def test_query_products_pager(transport_name: str = "grpc"): client = DatabaseCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1684,8 +1701,8 @@ async def test_query_products_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.AggregateFleetRequest, - dict, + service.AggregateFleetRequest(), + {}, ], ) def test_aggregate_fleet(request_type, transport: str = "grpc"): @@ -1696,7 +1713,7 @@ def test_aggregate_fleet(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.aggregate_fleet), "__call__") as call: @@ -1750,13 +1767,14 @@ def test_aggregate_fleet_non_empty_request_with_auto_populated_field(): client.aggregate_fleet(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.AggregateFleetRequest( + request_msg = service.AggregateFleetRequest( parent="parent_value", filter="filter_value", group_by="group_by_value", order_by="order_by_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_aggregate_fleet_use_cached_wrapped_rpc(): @@ -1837,9 +1855,14 @@ async def test_aggregate_fleet_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_aggregate_fleet_async( - transport: str = "grpc_asyncio", request_type=service.AggregateFleetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.AggregateFleetRequest(), + {}, + ], +) +async def test_aggregate_fleet_async(request_type, transport: str = "grpc_asyncio"): client = DatabaseCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1847,7 +1870,7 @@ async def test_aggregate_fleet_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.aggregate_fleet), "__call__") as call: @@ -1876,11 +1899,6 @@ async def test_aggregate_fleet_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_aggregate_fleet_async_from_dict(): - await test_aggregate_fleet_async(request_type=dict) - - def test_aggregate_fleet_pager(transport_name: str = "grpc"): client = DatabaseCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2071,8 +2089,8 @@ async def test_aggregate_fleet_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.QueryDatabaseResourceGroupsRequest, - dict, + service.QueryDatabaseResourceGroupsRequest(), + {}, ], ) def test_query_database_resource_groups(request_type, transport: str = "grpc"): @@ -2083,7 +2101,7 @@ def test_query_database_resource_groups(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2136,12 +2154,13 @@ def test_query_database_resource_groups_non_empty_request_with_auto_populated_fi client.query_database_resource_groups(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.QueryDatabaseResourceGroupsRequest( + request_msg = service.QueryDatabaseResourceGroupsRequest( parent="parent_value", filter="filter_value", order_by="order_by_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_query_database_resource_groups_use_cached_wrapped_rpc(): @@ -2227,9 +2246,15 @@ async def test_query_database_resource_groups_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.QueryDatabaseResourceGroupsRequest(), + {}, + ], +) async def test_query_database_resource_groups_async( - transport: str = "grpc_asyncio", - request_type=service.QueryDatabaseResourceGroupsRequest, + request_type, transport: str = "grpc_asyncio" ): client = DatabaseCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -2238,7 +2263,7 @@ async def test_query_database_resource_groups_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( @@ -2265,11 +2290,6 @@ async def test_query_database_resource_groups_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_query_database_resource_groups_async_from_dict(): - await test_query_database_resource_groups_async(request_type=dict) - - def test_query_database_resource_groups_pager(transport_name: str = "grpc"): client = DatabaseCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2472,8 +2492,8 @@ async def test_query_database_resource_groups_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.AggregateIssueStatsRequest, - dict, + service.AggregateIssueStatsRequest(), + {}, ], ) def test_aggregate_issue_stats(request_type, transport: str = "grpc"): @@ -2484,7 +2504,7 @@ def test_aggregate_issue_stats(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2537,10 +2557,11 @@ def test_aggregate_issue_stats_non_empty_request_with_auto_populated_field(): client.aggregate_issue_stats(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.AggregateIssueStatsRequest( + request_msg = service.AggregateIssueStatsRequest( parent="parent_value", filter="filter_value", ) + assert args[0] == request_msg def test_aggregate_issue_stats_use_cached_wrapped_rpc(): @@ -2626,8 +2647,15 @@ async def test_aggregate_issue_stats_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.AggregateIssueStatsRequest(), + {}, + ], +) async def test_aggregate_issue_stats_async( - transport: str = "grpc_asyncio", request_type=service.AggregateIssueStatsRequest + request_type, transport: str = "grpc_asyncio" ): client = DatabaseCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -2636,7 +2664,7 @@ async def test_aggregate_issue_stats_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( @@ -2665,16 +2693,11 @@ async def test_aggregate_issue_stats_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_aggregate_issue_stats_async_from_dict(): - await test_aggregate_issue_stats_async(request_type=dict) - - @pytest.mark.parametrize( "request_type", [ - service.AggregateQueryStatsRequest, - dict, + service.AggregateQueryStatsRequest(), + {}, ], ) def test_aggregate_query_stats(request_type, transport: str = "grpc"): @@ -2685,7 +2708,7 @@ def test_aggregate_query_stats(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,12 +2761,13 @@ def test_aggregate_query_stats_non_empty_request_with_auto_populated_field(): client.aggregate_query_stats(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.AggregateQueryStatsRequest( + request_msg = service.AggregateQueryStatsRequest( parent="parent_value", order_by="order_by_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_aggregate_query_stats_use_cached_wrapped_rpc(): @@ -2829,8 +2853,15 @@ async def test_aggregate_query_stats_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.AggregateQueryStatsRequest(), + {}, + ], +) async def test_aggregate_query_stats_async( - transport: str = "grpc_asyncio", request_type=service.AggregateQueryStatsRequest + request_type, transport: str = "grpc_asyncio" ): client = DatabaseCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -2839,7 +2870,7 @@ async def test_aggregate_query_stats_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( @@ -2866,11 +2897,6 @@ async def test_aggregate_query_stats_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_aggregate_query_stats_async_from_dict(): - await test_aggregate_query_stats_async(request_type=dict) - - def test_aggregate_query_stats_field_headers(): client = DatabaseCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3137,8 +3163,8 @@ async def test_aggregate_query_stats_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.QueryIssuesRequest, - dict, + service.QueryIssuesRequest(), + {}, ], ) def test_query_issues(request_type, transport: str = "grpc"): @@ -3149,7 +3175,7 @@ def test_query_issues(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.query_issues), "__call__") as call: @@ -3198,12 +3224,13 @@ def test_query_issues_non_empty_request_with_auto_populated_field(): client.query_issues(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.QueryIssuesRequest( + request_msg = service.QueryIssuesRequest( parent="parent_value", filter="filter_value", order_by="order_by_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_query_issues_use_cached_wrapped_rpc(): @@ -3284,9 +3311,14 @@ async def test_query_issues_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_query_issues_async( - transport: str = "grpc_asyncio", request_type=service.QueryIssuesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.QueryIssuesRequest(), + {}, + ], +) +async def test_query_issues_async(request_type, transport: str = "grpc_asyncio"): client = DatabaseCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3294,7 +3326,7 @@ async def test_query_issues_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.query_issues), "__call__") as call: @@ -3319,11 +3351,6 @@ async def test_query_issues_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_query_issues_async_from_dict(): - await test_query_issues_async(request_type=dict) - - def test_query_issues_flattened(): client = DatabaseCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4880,7 +4907,6 @@ def test_query_products_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.QueryProductsRequest() - assert args[0] == request_msg @@ -4901,7 +4927,6 @@ def test_aggregate_fleet_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.AggregateFleetRequest() - assert args[0] == request_msg @@ -4924,7 +4949,6 @@ def test_query_database_resource_groups_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.QueryDatabaseResourceGroupsRequest() - assert args[0] == request_msg @@ -4947,7 +4971,6 @@ def test_aggregate_issue_stats_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.AggregateIssueStatsRequest() - assert args[0] == request_msg @@ -4970,7 +4993,6 @@ def test_aggregate_query_stats_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.AggregateQueryStatsRequest() - assert args[0] == request_msg @@ -4991,7 +5013,6 @@ def test_query_issues_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.QueryIssuesRequest() - assert args[0] == request_msg @@ -5033,7 +5054,6 @@ async def test_query_products_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.QueryProductsRequest() - assert args[0] == request_msg @@ -5063,7 +5083,6 @@ async def test_aggregate_fleet_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.AggregateFleetRequest() - assert args[0] == request_msg @@ -5093,7 +5112,6 @@ async def test_query_database_resource_groups_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.QueryDatabaseResourceGroupsRequest() - assert args[0] == request_msg @@ -5124,7 +5142,6 @@ async def test_aggregate_issue_stats_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.AggregateIssueStatsRequest() - assert args[0] == request_msg @@ -5154,7 +5171,6 @@ async def test_aggregate_query_stats_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.AggregateQueryStatsRequest() - assert args[0] == request_msg @@ -5182,7 +5198,6 @@ async def test_query_issues_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.QueryIssuesRequest() - assert args[0] == request_msg @@ -6030,7 +6045,6 @@ def test_query_products_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.QueryProductsRequest() - assert args[0] == request_msg @@ -6050,7 +6064,6 @@ def test_aggregate_fleet_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.AggregateFleetRequest() - assert args[0] == request_msg @@ -6072,7 +6085,6 @@ def test_query_database_resource_groups_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.QueryDatabaseResourceGroupsRequest() - assert args[0] == request_msg @@ -6094,7 +6106,6 @@ def test_aggregate_issue_stats_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.AggregateIssueStatsRequest() - assert args[0] == request_msg @@ -6116,7 +6127,6 @@ def test_aggregate_query_stats_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.AggregateQueryStatsRequest() - assert args[0] == request_msg @@ -6136,7 +6146,6 @@ def test_query_issues_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.QueryIssuesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-datacatalog-lineage-configmanagement/noxfile.py b/packages/google-cloud-datacatalog-lineage-configmanagement/noxfile.py index 1738badff0c0..5ba2db6104ad 100644 --- a/packages/google-cloud-datacatalog-lineage-configmanagement/noxfile.py +++ b/packages/google-cloud-datacatalog-lineage-configmanagement/noxfile.py @@ -47,7 +47,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-datacatalog-lineage-configmanagement" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-datacatalog-lineage-configmanagement/setup.py b/packages/google-cloud-datacatalog-lineage-configmanagement/setup.py index ebd8648382f2..383994524bfc 100644 --- a/packages/google-cloud-datacatalog-lineage-configmanagement/setup.py +++ b/packages/google-cloud-datacatalog-lineage-configmanagement/setup.py @@ -48,7 +48,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/google-cloud-datacatalog-lineage-configmanagement/testing/constraints-3.10.txt b/packages/google-cloud-datacatalog-lineage-configmanagement/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-datacatalog-lineage-configmanagement/testing/constraints-3.10.txt +++ b/packages/google-cloud-datacatalog-lineage-configmanagement/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-datacatalog-lineage-configmanagement/tests/unit/gapic/datacatalog_lineage_configmanagement_v1/test_config_management_service.py b/packages/google-cloud-datacatalog-lineage-configmanagement/tests/unit/gapic/datacatalog_lineage_configmanagement_v1/test_config_management_service.py index 9c8cbd382199..206cafa7c736 100644 --- a/packages/google-cloud-datacatalog-lineage-configmanagement/tests/unit/gapic/datacatalog_lineage_configmanagement_v1/test_config_management_service.py +++ b/packages/google-cloud-datacatalog-lineage-configmanagement/tests/unit/gapic/datacatalog_lineage_configmanagement_v1/test_config_management_service.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 @@ -107,6 +108,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" @@ -1376,8 +1392,8 @@ def test_config_management_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - configmanagement.GetConfigRequest, - dict, + configmanagement.GetConfigRequest(), + {}, ], ) def test_get_config(request_type, transport: str = "grpc"): @@ -1388,7 +1404,7 @@ def test_get_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(type(client.transport.get_config), "__call__") as call: @@ -1434,9 +1450,10 @@ def test_get_config_non_empty_request_with_auto_populated_field(): client.get_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == configmanagement.GetConfigRequest( + request_msg = configmanagement.GetConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_config_use_cached_wrapped_rpc(): @@ -1515,9 +1532,14 @@ async def test_get_config_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_config_async( - transport: str = "grpc_asyncio", request_type=configmanagement.GetConfigRequest -): +@pytest.mark.parametrize( + "request_type", + [ + configmanagement.GetConfigRequest(), + {}, + ], +) +async def test_get_config_async(request_type, transport: str = "grpc_asyncio"): client = ConfigManagementServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1525,7 +1547,7 @@ async def test_get_config_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_config), "__call__") as call: @@ -1550,11 +1572,6 @@ async def test_get_config_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_config_async_from_dict(): - await test_get_config_async(request_type=dict) - - def test_get_config_field_headers(): client = ConfigManagementServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1701,8 +1718,8 @@ async def test_get_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - configmanagement.UpdateConfigRequest, - dict, + configmanagement.UpdateConfigRequest(), + {}, ], ) def test_update_config(request_type, transport: str = "grpc"): @@ -1713,7 +1730,7 @@ def test_update_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(type(client.transport.update_config), "__call__") as call: @@ -1757,7 +1774,8 @@ def test_update_config_non_empty_request_with_auto_populated_field(): client.update_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == configmanagement.UpdateConfigRequest() + request_msg = configmanagement.UpdateConfigRequest() + assert args[0] == request_msg def test_update_config_use_cached_wrapped_rpc(): @@ -1838,9 +1856,14 @@ async def test_update_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_config_async( - transport: str = "grpc_asyncio", request_type=configmanagement.UpdateConfigRequest -): +@pytest.mark.parametrize( + "request_type", + [ + configmanagement.UpdateConfigRequest(), + {}, + ], +) +async def test_update_config_async(request_type, transport: str = "grpc_asyncio"): client = ConfigManagementServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1848,7 +1871,7 @@ async def test_update_config_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_config), "__call__") as call: @@ -1873,11 +1896,6 @@ async def test_update_config_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_update_config_async_from_dict(): - await test_update_config_async(request_type=dict) - - def test_update_config_field_headers(): client = ConfigManagementServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2497,7 +2515,6 @@ def test_get_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = configmanagement.GetConfigRequest() - assert args[0] == request_msg @@ -2518,7 +2535,6 @@ def test_update_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = configmanagement.UpdateConfigRequest() - assert args[0] == request_msg @@ -2560,7 +2576,6 @@ async def test_get_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = configmanagement.GetConfigRequest() - assert args[0] == request_msg @@ -2588,7 +2603,6 @@ async def test_update_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = configmanagement.UpdateConfigRequest() - assert args[0] == request_msg @@ -3217,7 +3231,6 @@ def test_get_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = configmanagement.GetConfigRequest() - assert args[0] == request_msg @@ -3237,7 +3250,6 @@ def test_update_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = configmanagement.UpdateConfigRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-datacatalog-lineage/google/cloud/datacatalog_lineage_v1/services/lineage/async_client.py b/packages/google-cloud-datacatalog-lineage/google/cloud/datacatalog_lineage_v1/services/lineage/async_client.py index c9197163556a..490f46886699 100644 --- a/packages/google-cloud-datacatalog-lineage/google/cloud/datacatalog_lineage_v1/services/lineage/async_client.py +++ b/packages/google-cloud-datacatalog-lineage/google/cloud/datacatalog_lineage_v1/services/lineage/async_client.py @@ -421,8 +421,7 @@ async def sample_process_open_lineage_run_event(): gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), ) - 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() @@ -544,8 +543,7 @@ async def sample_create_process(): gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), ) - 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() @@ -672,8 +670,7 @@ async def sample_update_process(): ), ) - 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() @@ -1171,8 +1168,7 @@ async def sample_create_run(): gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), ) - 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() @@ -1797,8 +1793,7 @@ async def sample_create_lineage_event(): gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), ) - 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/google-cloud-datacatalog-lineage/google/cloud/datacatalog_lineage_v1/services/lineage/client.py b/packages/google-cloud-datacatalog-lineage/google/cloud/datacatalog_lineage_v1/services/lineage/client.py index 7674cc0e4ec8..445a1668885c 100644 --- a/packages/google-cloud-datacatalog-lineage/google/cloud/datacatalog_lineage_v1/services/lineage/client.py +++ b/packages/google-cloud-datacatalog-lineage/google/cloud/datacatalog_lineage_v1/services/lineage/client.py @@ -572,6 +572,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 ) -> None: @@ -904,8 +934,7 @@ def sample_process_open_lineage_run_event(): gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), ) - 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() @@ -1024,8 +1053,7 @@ def sample_create_process(): gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), ) - 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() @@ -1149,8 +1177,7 @@ def sample_update_process(): ), ) - 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() @@ -1636,8 +1663,7 @@ def sample_create_run(): gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), ) - 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() @@ -2249,8 +2275,7 @@ def sample_create_lineage_event(): gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), ) - 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/google-cloud-datacatalog-lineage/noxfile.py b/packages/google-cloud-datacatalog-lineage/noxfile.py index 6d4d30618ca7..1cf9b67d7e28 100644 --- a/packages/google-cloud-datacatalog-lineage/noxfile.py +++ b/packages/google-cloud-datacatalog-lineage/noxfile.py @@ -47,7 +47,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-datacatalog-lineage" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-datacatalog-lineage/setup.py b/packages/google-cloud-datacatalog-lineage/setup.py index aef64dce5881..d2326fe061e9 100644 --- a/packages/google-cloud-datacatalog-lineage/setup.py +++ b/packages/google-cloud-datacatalog-lineage/setup.py @@ -45,7 +45,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/google-cloud-datacatalog-lineage/testing/constraints-3.10.txt b/packages/google-cloud-datacatalog-lineage/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-datacatalog-lineage/testing/constraints-3.10.txt +++ b/packages/google-cloud-datacatalog-lineage/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-datacatalog-lineage/tests/unit/gapic/datacatalog_lineage_v1/test_lineage.py b/packages/google-cloud-datacatalog-lineage/tests/unit/gapic/datacatalog_lineage_v1/test_lineage.py index 51edf4fc52c4..db506688ba06 100644 --- a/packages/google-cloud-datacatalog-lineage/tests/unit/gapic/datacatalog_lineage_v1/test_lineage.py +++ b/packages/google-cloud-datacatalog-lineage/tests/unit/gapic/datacatalog_lineage_v1/test_lineage.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 @@ -76,6 +77,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): @@ -118,6 +122,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" @@ -451,6 +470,104 @@ def test__add_cred_info_for_auth_errors_no_get_cred_info(error_code): 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() + LineageClient._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") + LineageClient._setup_request_id(request, "request_id", True) + assert request.request_id == "already_set" + + # Test with non-proto3 optional field empty + request = MockRequest(request_id="") + LineageClient._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") + LineageClient._setup_request_id(request, "request_id", False) + assert request.request_id == "already_set" + + # Test with proto3 optional field not in request (MockProtoRequest) + request = MockProtoRequest() + LineageClient._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") + LineageClient._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() + LineageClient._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 = {} + LineageClient._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"} + LineageClient._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": ""} + LineageClient._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"} + LineageClient._setup_request_id(request, "request_id", False) + assert request["request_id"] == "already_set" + + @pytest.mark.parametrize( "client_class,transport_name", [ @@ -1251,8 +1368,15 @@ def test_lineage_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - lineage.ProcessOpenLineageRunEventRequest, - dict, + # Pure protobuf messages (non-proto-plus) require keyword arguments. + lineage.ProcessOpenLineageRunEventRequest( + **{ + "request_id": "explicit value for autopopulate-able field", + } + ), + { + "request_id": "explicit value for autopopulate-able field", + }, ], ) def test_process_open_lineage_run_event(request_type, transport: str = "grpc"): @@ -1263,11 +1387,7 @@ def test_process_open_lineage_run_event(request_type, transport: str = "grpc"): # Everything is optional in proto3 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( @@ -1320,16 +1440,13 @@ def test_process_open_lineage_run_event_non_empty_request_with_auto_populated_fi client.process_open_lineage_run_event(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] == lineage.ProcessOpenLineageRunEventRequest( + request_msg = lineage.ProcessOpenLineageRunEventRequest( parent="parent_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_process_open_lineage_run_event_use_cached_wrapped_rpc(): @@ -1415,9 +1532,22 @@ async def test_process_open_lineage_run_event_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + # Pure protobuf messages (non-proto-plus) require keyword arguments. + lineage.ProcessOpenLineageRunEventRequest( + **{ + "request_id": "explicit value for autopopulate-able field", + } + ), + { + "request_id": "explicit value for autopopulate-able field", + }, + ], +) async def test_process_open_lineage_run_event_async( - transport: str = "grpc_asyncio", - request_type=lineage.ProcessOpenLineageRunEventRequest, + request_type, transport: str = "grpc_asyncio" ): client = LineageAsyncClient( credentials=async_anonymous_credentials(), @@ -1426,11 +1556,7 @@ async def test_process_open_lineage_run_event_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() - 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( @@ -1460,11 +1586,6 @@ async def test_process_open_lineage_run_event_async( assert response.lineage_events == ["lineage_events_value"] -@pytest.mark.asyncio -async def test_process_open_lineage_run_event_async_from_dict(): - await test_process_open_lineage_run_event_async(request_type=dict) - - def test_process_open_lineage_run_event_field_headers(): client = LineageClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1665,8 +1786,15 @@ async def test_process_open_lineage_run_event_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - lineage.CreateProcessRequest, - dict, + # Pure protobuf messages (non-proto-plus) require keyword arguments. + lineage.CreateProcessRequest( + **{ + "request_id": "explicit value for autopopulate-able field", + } + ), + { + "request_id": "explicit value for autopopulate-able field", + }, ], ) def test_create_process(request_type, transport: str = "grpc"): @@ -1677,11 +1805,7 @@ def test_create_process(request_type, transport: str = "grpc"): # Everything is optional in proto3 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(type(client.transport.create_process), "__call__") as call: @@ -1728,16 +1852,13 @@ def test_create_process_non_empty_request_with_auto_populated_field(): client.create_process(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] == lineage.CreateProcessRequest( + request_msg = lineage.CreateProcessRequest( parent="parent_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_process_use_cached_wrapped_rpc(): @@ -1818,9 +1939,21 @@ async def test_create_process_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_process_async( - transport: str = "grpc_asyncio", request_type=lineage.CreateProcessRequest -): +@pytest.mark.parametrize( + "request_type", + [ + # Pure protobuf messages (non-proto-plus) require keyword arguments. + lineage.CreateProcessRequest( + **{ + "request_id": "explicit value for autopopulate-able field", + } + ), + { + "request_id": "explicit value for autopopulate-able field", + }, + ], +) +async def test_create_process_async(request_type, transport: str = "grpc_asyncio"): client = LineageAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1828,11 +1961,7 @@ async def test_create_process_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() - 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(type(client.transport.create_process), "__call__") as call: @@ -1858,11 +1987,6 @@ async def test_create_process_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_create_process_async_from_dict(): - await test_create_process_async(request_type=dict) - - def test_create_process_field_headers(): client = LineageClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2015,8 +2139,15 @@ async def test_create_process_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - lineage.UpdateProcessRequest, - dict, + # Pure protobuf messages (non-proto-plus) require keyword arguments. + lineage.UpdateProcessRequest( + **{ + "request_id": "explicit value for autopopulate-able field", + } + ), + { + "request_id": "explicit value for autopopulate-able field", + }, ], ) def test_update_process(request_type, transport: str = "grpc"): @@ -2027,11 +2158,7 @@ def test_update_process(request_type, transport: str = "grpc"): # Everything is optional in proto3 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(type(client.transport.update_process), "__call__") as call: @@ -2076,14 +2203,11 @@ def test_update_process_non_empty_request_with_auto_populated_field(): client.update_process(request=request) call.assert_called() _, args, _ = call.mock_calls[0] + request_msg = lineage.UpdateProcessRequest() # 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] == lineage.UpdateProcessRequest() + assert _UUID4_RE.fullmatch(args[0].request_id) + request_msg.request_id = args[0].request_id + assert args[0] == request_msg def test_update_process_use_cached_wrapped_rpc(): @@ -2164,9 +2288,21 @@ async def test_update_process_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_process_async( - transport: str = "grpc_asyncio", request_type=lineage.UpdateProcessRequest -): +@pytest.mark.parametrize( + "request_type", + [ + # Pure protobuf messages (non-proto-plus) require keyword arguments. + lineage.UpdateProcessRequest( + **{ + "request_id": "explicit value for autopopulate-able field", + } + ), + { + "request_id": "explicit value for autopopulate-able field", + }, + ], +) +async def test_update_process_async(request_type, transport: str = "grpc_asyncio"): client = LineageAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2174,11 +2310,7 @@ async def test_update_process_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() - 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(type(client.transport.update_process), "__call__") as call: @@ -2204,11 +2336,6 @@ async def test_update_process_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_update_process_async_from_dict(): - await test_update_process_async(request_type=dict) - - def test_update_process_field_headers(): client = LineageClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2361,8 +2488,8 @@ async def test_update_process_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - lineage.GetProcessRequest, - dict, + lineage.GetProcessRequest(), + {}, ], ) def test_get_process(request_type, transport: str = "grpc"): @@ -2373,7 +2500,7 @@ def test_get_process(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_process), "__call__") as call: @@ -2419,9 +2546,10 @@ def test_get_process_non_empty_request_with_auto_populated_field(): client.get_process(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == lineage.GetProcessRequest( + request_msg = lineage.GetProcessRequest( name="name_value", ) + assert args[0] == request_msg def test_get_process_use_cached_wrapped_rpc(): @@ -2502,9 +2630,14 @@ async def test_get_process_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_process_async( - transport: str = "grpc_asyncio", request_type=lineage.GetProcessRequest -): +@pytest.mark.parametrize( + "request_type", + [ + lineage.GetProcessRequest(), + {}, + ], +) +async def test_get_process_async(request_type, transport: str = "grpc_asyncio"): client = LineageAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2512,7 +2645,7 @@ async def test_get_process_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_process), "__call__") as call: @@ -2537,11 +2670,6 @@ async def test_get_process_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_get_process_async_from_dict(): - await test_get_process_async(request_type=dict) - - def test_get_process_field_headers(): client = LineageClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2684,8 +2812,8 @@ async def test_get_process_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - lineage.ListProcessesRequest, - dict, + lineage.ListProcessesRequest(), + {}, ], ) def test_list_processes(request_type, transport: str = "grpc"): @@ -2696,7 +2824,7 @@ def test_list_processes(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_processes), "__call__") as call: @@ -2741,10 +2869,11 @@ def test_list_processes_non_empty_request_with_auto_populated_field(): client.list_processes(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == lineage.ListProcessesRequest( + request_msg = lineage.ListProcessesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_processes_use_cached_wrapped_rpc(): @@ -2825,9 +2954,14 @@ async def test_list_processes_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_processes_async( - transport: str = "grpc_asyncio", request_type=lineage.ListProcessesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + lineage.ListProcessesRequest(), + {}, + ], +) +async def test_list_processes_async(request_type, transport: str = "grpc_asyncio"): client = LineageAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2835,7 +2969,7 @@ async def test_list_processes_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_processes), "__call__") as call: @@ -2858,11 +2992,6 @@ async def test_list_processes_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_processes_async_from_dict(): - await test_list_processes_async(request_type=dict) - - def test_list_processes_field_headers(): client = LineageClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3199,8 +3328,8 @@ async def test_list_processes_async_pages(): @pytest.mark.parametrize( "request_type", [ - lineage.DeleteProcessRequest, - dict, + lineage.DeleteProcessRequest(), + {}, ], ) def test_delete_process(request_type, transport: str = "grpc"): @@ -3211,7 +3340,7 @@ def test_delete_process(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_process), "__call__") as call: @@ -3252,9 +3381,10 @@ def test_delete_process_non_empty_request_with_auto_populated_field(): client.delete_process(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == lineage.DeleteProcessRequest( + request_msg = lineage.DeleteProcessRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_process_use_cached_wrapped_rpc(): @@ -3345,9 +3475,14 @@ async def test_delete_process_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_process_async( - transport: str = "grpc_asyncio", request_type=lineage.DeleteProcessRequest -): +@pytest.mark.parametrize( + "request_type", + [ + lineage.DeleteProcessRequest(), + {}, + ], +) +async def test_delete_process_async(request_type, transport: str = "grpc_asyncio"): client = LineageAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3355,7 +3490,7 @@ async def test_delete_process_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_process), "__call__") as call: @@ -3375,11 +3510,6 @@ async def test_delete_process_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_process_async_from_dict(): - await test_delete_process_async(request_type=dict) - - def test_delete_process_field_headers(): client = LineageClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3526,8 +3656,15 @@ async def test_delete_process_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - lineage.CreateRunRequest, - dict, + # Pure protobuf messages (non-proto-plus) require keyword arguments. + lineage.CreateRunRequest( + **{ + "request_id": "explicit value for autopopulate-able field", + } + ), + { + "request_id": "explicit value for autopopulate-able field", + }, ], ) def test_create_run(request_type, transport: str = "grpc"): @@ -3538,11 +3675,7 @@ def test_create_run(request_type, transport: str = "grpc"): # Everything is optional in proto3 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(type(client.transport.create_run), "__call__") as call: @@ -3591,16 +3724,13 @@ def test_create_run_non_empty_request_with_auto_populated_field(): client.create_run(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] == lineage.CreateRunRequest( + request_msg = lineage.CreateRunRequest( parent="parent_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_run_use_cached_wrapped_rpc(): @@ -3679,9 +3809,21 @@ async def test_create_run_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_create_run_async( - transport: str = "grpc_asyncio", request_type=lineage.CreateRunRequest -): +@pytest.mark.parametrize( + "request_type", + [ + # Pure protobuf messages (non-proto-plus) require keyword arguments. + lineage.CreateRunRequest( + **{ + "request_id": "explicit value for autopopulate-able field", + } + ), + { + "request_id": "explicit value for autopopulate-able field", + }, + ], +) +async def test_create_run_async(request_type, transport: str = "grpc_asyncio"): client = LineageAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3689,11 +3831,7 @@ async def test_create_run_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() - 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(type(client.transport.create_run), "__call__") as call: @@ -3721,11 +3859,6 @@ async def test_create_run_async( assert response.state == lineage.Run.State.STARTED -@pytest.mark.asyncio -async def test_create_run_async_from_dict(): - await test_create_run_async(request_type=dict) - - def test_create_run_field_headers(): client = LineageClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3878,8 +4011,8 @@ async def test_create_run_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - lineage.UpdateRunRequest, - dict, + lineage.UpdateRunRequest(), + {}, ], ) def test_update_run(request_type, transport: str = "grpc"): @@ -3890,7 +4023,7 @@ def test_update_run(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_run), "__call__") as call: @@ -3936,7 +4069,8 @@ def test_update_run_non_empty_request_with_auto_populated_field(): client.update_run(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == lineage.UpdateRunRequest() + request_msg = lineage.UpdateRunRequest() + assert args[0] == request_msg def test_update_run_use_cached_wrapped_rpc(): @@ -4015,9 +4149,14 @@ async def test_update_run_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_update_run_async( - transport: str = "grpc_asyncio", request_type=lineage.UpdateRunRequest -): +@pytest.mark.parametrize( + "request_type", + [ + lineage.UpdateRunRequest(), + {}, + ], +) +async def test_update_run_async(request_type, transport: str = "grpc_asyncio"): client = LineageAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4025,7 +4164,7 @@ async def test_update_run_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_run), "__call__") as call: @@ -4052,11 +4191,6 @@ async def test_update_run_async( assert response.state == lineage.Run.State.STARTED -@pytest.mark.asyncio -async def test_update_run_async_from_dict(): - await test_update_run_async(request_type=dict) - - def test_update_run_field_headers(): client = LineageClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4209,8 +4343,8 @@ async def test_update_run_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - lineage.GetRunRequest, - dict, + lineage.GetRunRequest(), + {}, ], ) def test_get_run(request_type, transport: str = "grpc"): @@ -4221,7 +4355,7 @@ def test_get_run(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_run), "__call__") as call: @@ -4269,9 +4403,10 @@ def test_get_run_non_empty_request_with_auto_populated_field(): client.get_run(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == lineage.GetRunRequest( + request_msg = lineage.GetRunRequest( name="name_value", ) + assert args[0] == request_msg def test_get_run_use_cached_wrapped_rpc(): @@ -4350,9 +4485,14 @@ async def test_get_run_async_use_cached_wrapped_rpc(transport: str = "grpc_async @pytest.mark.asyncio -async def test_get_run_async( - transport: str = "grpc_asyncio", request_type=lineage.GetRunRequest -): +@pytest.mark.parametrize( + "request_type", + [ + lineage.GetRunRequest(), + {}, + ], +) +async def test_get_run_async(request_type, transport: str = "grpc_asyncio"): client = LineageAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4360,7 +4500,7 @@ async def test_get_run_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_run), "__call__") as call: @@ -4387,11 +4527,6 @@ async def test_get_run_async( assert response.state == lineage.Run.State.STARTED -@pytest.mark.asyncio -async def test_get_run_async_from_dict(): - await test_get_run_async(request_type=dict) - - def test_get_run_field_headers(): client = LineageClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4534,8 +4669,8 @@ async def test_get_run_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - lineage.ListRunsRequest, - dict, + lineage.ListRunsRequest(), + {}, ], ) def test_list_runs(request_type, transport: str = "grpc"): @@ -4546,7 +4681,7 @@ def test_list_runs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_runs), "__call__") as call: @@ -4591,10 +4726,11 @@ def test_list_runs_non_empty_request_with_auto_populated_field(): client.list_runs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == lineage.ListRunsRequest( + request_msg = lineage.ListRunsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_runs_use_cached_wrapped_rpc(): @@ -4673,9 +4809,14 @@ async def test_list_runs_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_list_runs_async( - transport: str = "grpc_asyncio", request_type=lineage.ListRunsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + lineage.ListRunsRequest(), + {}, + ], +) +async def test_list_runs_async(request_type, transport: str = "grpc_asyncio"): client = LineageAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4683,7 +4824,7 @@ async def test_list_runs_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_runs), "__call__") as call: @@ -4706,11 +4847,6 @@ async def test_list_runs_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_runs_async_from_dict(): - await test_list_runs_async(request_type=dict) - - def test_list_runs_field_headers(): client = LineageClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5047,8 +5183,8 @@ async def test_list_runs_async_pages(): @pytest.mark.parametrize( "request_type", [ - lineage.DeleteRunRequest, - dict, + lineage.DeleteRunRequest(), + {}, ], ) def test_delete_run(request_type, transport: str = "grpc"): @@ -5059,7 +5195,7 @@ def test_delete_run(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_run), "__call__") as call: @@ -5100,9 +5236,10 @@ def test_delete_run_non_empty_request_with_auto_populated_field(): client.delete_run(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == lineage.DeleteRunRequest( + request_msg = lineage.DeleteRunRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_run_use_cached_wrapped_rpc(): @@ -5191,9 +5328,14 @@ async def test_delete_run_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_delete_run_async( - transport: str = "grpc_asyncio", request_type=lineage.DeleteRunRequest -): +@pytest.mark.parametrize( + "request_type", + [ + lineage.DeleteRunRequest(), + {}, + ], +) +async def test_delete_run_async(request_type, transport: str = "grpc_asyncio"): client = LineageAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5201,7 +5343,7 @@ async def test_delete_run_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_run), "__call__") as call: @@ -5221,11 +5363,6 @@ async def test_delete_run_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_run_async_from_dict(): - await test_delete_run_async(request_type=dict) - - def test_delete_run_field_headers(): client = LineageClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5372,8 +5509,15 @@ async def test_delete_run_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - lineage.CreateLineageEventRequest, - dict, + # Pure protobuf messages (non-proto-plus) require keyword arguments. + lineage.CreateLineageEventRequest( + **{ + "request_id": "explicit value for autopopulate-able field", + } + ), + { + "request_id": "explicit value for autopopulate-able field", + }, ], ) def test_create_lineage_event(request_type, transport: str = "grpc"): @@ -5384,11 +5528,7 @@ def test_create_lineage_event(request_type, transport: str = "grpc"): # Everything is optional in proto3 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( @@ -5437,16 +5577,13 @@ def test_create_lineage_event_non_empty_request_with_auto_populated_field(): client.create_lineage_event(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] == lineage.CreateLineageEventRequest( + request_msg = lineage.CreateLineageEventRequest( parent="parent_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_lineage_event_use_cached_wrapped_rpc(): @@ -5531,8 +5668,22 @@ async def test_create_lineage_event_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + # Pure protobuf messages (non-proto-plus) require keyword arguments. + lineage.CreateLineageEventRequest( + **{ + "request_id": "explicit value for autopopulate-able field", + } + ), + { + "request_id": "explicit value for autopopulate-able field", + }, + ], +) async def test_create_lineage_event_async( - transport: str = "grpc_asyncio", request_type=lineage.CreateLineageEventRequest + request_type, transport: str = "grpc_asyncio" ): client = LineageAsyncClient( credentials=async_anonymous_credentials(), @@ -5541,11 +5692,7 @@ async def test_create_lineage_event_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() - 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( @@ -5571,11 +5718,6 @@ async def test_create_lineage_event_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_create_lineage_event_async_from_dict(): - await test_create_lineage_event_async(request_type=dict) - - def test_create_lineage_event_field_headers(): client = LineageClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5740,8 +5882,8 @@ async def test_create_lineage_event_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - lineage.GetLineageEventRequest, - dict, + lineage.GetLineageEventRequest(), + {}, ], ) def test_get_lineage_event(request_type, transport: str = "grpc"): @@ -5752,7 +5894,7 @@ def test_get_lineage_event(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5800,9 +5942,10 @@ def test_get_lineage_event_non_empty_request_with_auto_populated_field(): client.get_lineage_event(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == lineage.GetLineageEventRequest( + request_msg = lineage.GetLineageEventRequest( name="name_value", ) + assert args[0] == request_msg def test_get_lineage_event_use_cached_wrapped_rpc(): @@ -5885,9 +6028,14 @@ async def test_get_lineage_event_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_lineage_event_async( - transport: str = "grpc_asyncio", request_type=lineage.GetLineageEventRequest -): +@pytest.mark.parametrize( + "request_type", + [ + lineage.GetLineageEventRequest(), + {}, + ], +) +async def test_get_lineage_event_async(request_type, transport: str = "grpc_asyncio"): client = LineageAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5895,7 +6043,7 @@ async def test_get_lineage_event_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( @@ -5920,11 +6068,6 @@ async def test_get_lineage_event_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_lineage_event_async_from_dict(): - await test_get_lineage_event_async(request_type=dict) - - def test_get_lineage_event_field_headers(): client = LineageClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6079,8 +6222,8 @@ async def test_get_lineage_event_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - lineage.ListLineageEventsRequest, - dict, + lineage.ListLineageEventsRequest(), + {}, ], ) def test_list_lineage_events(request_type, transport: str = "grpc"): @@ -6091,7 +6234,7 @@ def test_list_lineage_events(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6140,10 +6283,11 @@ def test_list_lineage_events_non_empty_request_with_auto_populated_field(): client.list_lineage_events(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == lineage.ListLineageEventsRequest( + request_msg = lineage.ListLineageEventsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_lineage_events_use_cached_wrapped_rpc(): @@ -6228,9 +6372,14 @@ async def test_list_lineage_events_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_lineage_events_async( - transport: str = "grpc_asyncio", request_type=lineage.ListLineageEventsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + lineage.ListLineageEventsRequest(), + {}, + ], +) +async def test_list_lineage_events_async(request_type, transport: str = "grpc_asyncio"): client = LineageAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6238,7 +6387,7 @@ async def test_list_lineage_events_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( @@ -6263,11 +6412,6 @@ async def test_list_lineage_events_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_lineage_events_async_from_dict(): - await test_list_lineage_events_async(request_type=dict) - - def test_list_lineage_events_field_headers(): client = LineageClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6620,8 +6764,8 @@ async def test_list_lineage_events_async_pages(): @pytest.mark.parametrize( "request_type", [ - lineage.DeleteLineageEventRequest, - dict, + lineage.DeleteLineageEventRequest(), + {}, ], ) def test_delete_lineage_event(request_type, transport: str = "grpc"): @@ -6632,7 +6776,7 @@ def test_delete_lineage_event(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6677,9 +6821,10 @@ def test_delete_lineage_event_non_empty_request_with_auto_populated_field(): client.delete_lineage_event(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == lineage.DeleteLineageEventRequest( + request_msg = lineage.DeleteLineageEventRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_lineage_event_use_cached_wrapped_rpc(): @@ -6764,8 +6909,15 @@ async def test_delete_lineage_event_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + lineage.DeleteLineageEventRequest(), + {}, + ], +) async def test_delete_lineage_event_async( - transport: str = "grpc_asyncio", request_type=lineage.DeleteLineageEventRequest + request_type, transport: str = "grpc_asyncio" ): client = LineageAsyncClient( credentials=async_anonymous_credentials(), @@ -6774,7 +6926,7 @@ async def test_delete_lineage_event_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( @@ -6794,11 +6946,6 @@ async def test_delete_lineage_event_async( assert response is None -@pytest.mark.asyncio -async def test_delete_lineage_event_async_from_dict(): - await test_delete_lineage_event_async(request_type=dict) - - def test_delete_lineage_event_field_headers(): client = LineageClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6949,8 +7096,8 @@ async def test_delete_lineage_event_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - lineage.SearchLinksRequest, - dict, + lineage.SearchLinksRequest(), + {}, ], ) def test_search_links(request_type, transport: str = "grpc"): @@ -6961,7 +7108,7 @@ def test_search_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.search_links), "__call__") as call: @@ -7006,10 +7153,11 @@ def test_search_links_non_empty_request_with_auto_populated_field(): client.search_links(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == lineage.SearchLinksRequest( + request_msg = lineage.SearchLinksRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_search_links_use_cached_wrapped_rpc(): @@ -7090,9 +7238,14 @@ async def test_search_links_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_search_links_async( - transport: str = "grpc_asyncio", request_type=lineage.SearchLinksRequest -): +@pytest.mark.parametrize( + "request_type", + [ + lineage.SearchLinksRequest(), + {}, + ], +) +async def test_search_links_async(request_type, transport: str = "grpc_asyncio"): client = LineageAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7100,7 +7253,7 @@ async def test_search_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.search_links), "__call__") as call: @@ -7123,11 +7276,6 @@ async def test_search_links_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_search_links_async_from_dict(): - await test_search_links_async(request_type=dict) - - def test_search_links_field_headers(): client = LineageClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7382,8 +7530,8 @@ async def test_search_links_async_pages(): @pytest.mark.parametrize( "request_type", [ - lineage.BatchSearchLinkProcessesRequest, - dict, + lineage.BatchSearchLinkProcessesRequest(), + {}, ], ) def test_batch_search_link_processes(request_type, transport: str = "grpc"): @@ -7394,7 +7542,7 @@ def test_batch_search_link_processes(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7443,10 +7591,11 @@ def test_batch_search_link_processes_non_empty_request_with_auto_populated_field client.batch_search_link_processes(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == lineage.BatchSearchLinkProcessesRequest( + request_msg = lineage.BatchSearchLinkProcessesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_batch_search_link_processes_use_cached_wrapped_rpc(): @@ -7532,9 +7681,15 @@ async def test_batch_search_link_processes_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + lineage.BatchSearchLinkProcessesRequest(), + {}, + ], +) async def test_batch_search_link_processes_async( - transport: str = "grpc_asyncio", - request_type=lineage.BatchSearchLinkProcessesRequest, + request_type, transport: str = "grpc_asyncio" ): client = LineageAsyncClient( credentials=async_anonymous_credentials(), @@ -7543,7 +7698,7 @@ async def test_batch_search_link_processes_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( @@ -7568,11 +7723,6 @@ async def test_batch_search_link_processes_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_batch_search_link_processes_async_from_dict(): - await test_batch_search_link_processes_async(request_type=dict) - - def test_batch_search_link_processes_field_headers(): client = LineageClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7841,8 +7991,8 @@ async def test_batch_search_link_processes_async_pages(): @pytest.mark.parametrize( "request_type", [ - lineage.SearchLineageStreamingRequest, - dict, + lineage.SearchLineageStreamingRequest(), + {}, ], ) def test_search_lineage_streaming(request_type, transport: str = "grpc"): @@ -7853,7 +8003,7 @@ def test_search_lineage_streaming(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7899,9 +8049,10 @@ def test_search_lineage_streaming_non_empty_request_with_auto_populated_field(): client.search_lineage_streaming(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == lineage.SearchLineageStreamingRequest( + request_msg = lineage.SearchLineageStreamingRequest( parent="parent_value", ) + assert args[0] == request_msg def test_search_lineage_streaming_use_cached_wrapped_rpc(): @@ -7987,8 +8138,15 @@ async def test_search_lineage_streaming_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + lineage.SearchLineageStreamingRequest(), + {}, + ], +) async def test_search_lineage_streaming_async( - transport: str = "grpc_asyncio", request_type=lineage.SearchLineageStreamingRequest + request_type, transport: str = "grpc_asyncio" ): client = LineageAsyncClient( credentials=async_anonymous_credentials(), @@ -7997,7 +8155,7 @@ async def test_search_lineage_streaming_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( @@ -8021,11 +8179,6 @@ async def test_search_lineage_streaming_async( assert isinstance(message, lineage.SearchLineageStreamingResponse) -@pytest.mark.asyncio -async def test_search_lineage_streaming_async_from_dict(): - await test_search_lineage_streaming_async(request_type=dict) - - def test_search_lineage_streaming_field_headers(): client = LineageClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8210,10 +8363,7 @@ def test_process_open_lineage_run_event_rest_required_fields( # 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 @@ -8425,10 +8575,7 @@ def test_create_process_rest_required_fields(request_type=lineage.CreateProcessR # 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 @@ -8626,10 +8773,7 @@ def test_update_process_rest_required_fields(request_type=lineage.UpdateProcessR # 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 @@ -9436,10 +9580,7 @@ def test_create_run_rest_required_fields(request_type=lineage.CreateRunRequest): # 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 @@ -10451,10 +10592,7 @@ def test_create_lineage_event_rest_required_fields( # 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 @@ -11816,15 +11954,10 @@ def test_process_open_lineage_run_event_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 = lineage.ProcessOpenLineageRunEventRequest() - + # 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 @@ -11844,15 +11977,10 @@ def test_create_process_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 = lineage.CreateProcessRequest() - + # 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 @@ -11872,15 +12000,10 @@ def test_update_process_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 = lineage.UpdateProcessRequest() - + # 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 @@ -11901,7 +12024,6 @@ def test_get_process_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lineage.GetProcessRequest() - assert args[0] == request_msg @@ -11922,7 +12044,6 @@ def test_list_processes_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lineage.ListProcessesRequest() - assert args[0] == request_msg @@ -11943,7 +12064,6 @@ def test_delete_process_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lineage.DeleteProcessRequest() - assert args[0] == request_msg @@ -11963,15 +12083,10 @@ def test_create_run_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 = lineage.CreateRunRequest() - + # 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 @@ -11992,7 +12107,6 @@ def test_update_run_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lineage.UpdateRunRequest() - assert args[0] == request_msg @@ -12013,7 +12127,6 @@ def test_get_run_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lineage.GetRunRequest() - assert args[0] == request_msg @@ -12034,7 +12147,6 @@ def test_list_runs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lineage.ListRunsRequest() - assert args[0] == request_msg @@ -12055,7 +12167,6 @@ def test_delete_run_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lineage.DeleteRunRequest() - assert args[0] == request_msg @@ -12077,15 +12188,10 @@ def test_create_lineage_event_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 = lineage.CreateLineageEventRequest() - + # 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 @@ -12108,7 +12214,6 @@ def test_get_lineage_event_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lineage.GetLineageEventRequest() - assert args[0] == request_msg @@ -12131,7 +12236,6 @@ def test_list_lineage_events_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lineage.ListLineageEventsRequest() - assert args[0] == request_msg @@ -12154,7 +12258,6 @@ def test_delete_lineage_event_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lineage.DeleteLineageEventRequest() - assert args[0] == request_msg @@ -12175,7 +12278,6 @@ def test_search_links_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lineage.SearchLinksRequest() - assert args[0] == request_msg @@ -12198,7 +12300,6 @@ def test_batch_search_link_processes_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lineage.BatchSearchLinkProcessesRequest() - assert args[0] == request_msg @@ -12221,7 +12322,6 @@ def test_search_lineage_streaming_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lineage.SearchLineageStreamingRequest() - assert args[0] == request_msg @@ -12265,15 +12365,10 @@ async def test_process_open_lineage_run_event_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 = lineage.ProcessOpenLineageRunEventRequest() - + # 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 @@ -12300,15 +12395,10 @@ async def test_create_process_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 = lineage.CreateProcessRequest() - + # 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 @@ -12335,15 +12425,10 @@ async def test_update_process_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 = lineage.UpdateProcessRequest() - + # 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 @@ -12371,7 +12456,6 @@ async def test_get_process_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lineage.GetProcessRequest() - assert args[0] == request_msg @@ -12398,7 +12482,6 @@ async def test_list_processes_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lineage.ListProcessesRequest() - assert args[0] == request_msg @@ -12423,7 +12506,6 @@ async def test_delete_process_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lineage.DeleteProcessRequest() - assert args[0] == request_msg @@ -12451,15 +12533,10 @@ async def test_create_run_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 = lineage.CreateRunRequest() - + # 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 @@ -12488,7 +12565,6 @@ async def test_update_run_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lineage.UpdateRunRequest() - assert args[0] == request_msg @@ -12517,7 +12593,6 @@ async def test_get_run_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lineage.GetRunRequest() - assert args[0] == request_msg @@ -12544,7 +12619,6 @@ async def test_list_runs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lineage.ListRunsRequest() - assert args[0] == request_msg @@ -12569,7 +12643,6 @@ async def test_delete_run_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lineage.DeleteRunRequest() - assert args[0] == request_msg @@ -12597,15 +12670,10 @@ async def test_create_lineage_event_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 = lineage.CreateLineageEventRequest() - + # 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 @@ -12634,7 +12702,6 @@ async def test_get_lineage_event_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lineage.GetLineageEventRequest() - assert args[0] == request_msg @@ -12663,7 +12730,6 @@ async def test_list_lineage_events_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lineage.ListLineageEventsRequest() - assert args[0] == request_msg @@ -12688,7 +12754,6 @@ async def test_delete_lineage_event_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lineage.DeleteLineageEventRequest() - assert args[0] == request_msg @@ -12715,7 +12780,6 @@ async def test_search_links_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lineage.SearchLinksRequest() - assert args[0] == request_msg @@ -12744,7 +12808,6 @@ async def test_batch_search_link_processes_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lineage.BatchSearchLinkProcessesRequest() - assert args[0] == request_msg @@ -12772,7 +12835,6 @@ async def test_search_lineage_streaming_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lineage.SearchLineageStreamingRequest() - assert args[0] == request_msg @@ -15795,15 +15857,10 @@ def test_process_open_lineage_run_event_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 = lineage.ProcessOpenLineageRunEventRequest() - + # 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 @@ -15822,15 +15879,10 @@ def test_create_process_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 = lineage.CreateProcessRequest() - + # 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 @@ -15849,15 +15901,10 @@ def test_update_process_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 = lineage.UpdateProcessRequest() - + # 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 @@ -15877,7 +15924,6 @@ def test_get_process_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lineage.GetProcessRequest() - assert args[0] == request_msg @@ -15897,7 +15943,6 @@ def test_list_processes_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lineage.ListProcessesRequest() - assert args[0] == request_msg @@ -15917,7 +15962,6 @@ def test_delete_process_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lineage.DeleteProcessRequest() - assert args[0] == request_msg @@ -15936,15 +15980,10 @@ def test_create_run_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 = lineage.CreateRunRequest() - + # 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 @@ -15964,7 +16003,6 @@ def test_update_run_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lineage.UpdateRunRequest() - assert args[0] == request_msg @@ -15984,7 +16022,6 @@ def test_get_run_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lineage.GetRunRequest() - assert args[0] == request_msg @@ -16004,7 +16041,6 @@ def test_list_runs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lineage.ListRunsRequest() - assert args[0] == request_msg @@ -16024,7 +16060,6 @@ def test_delete_run_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lineage.DeleteRunRequest() - assert args[0] == request_msg @@ -16045,15 +16080,10 @@ def test_create_lineage_event_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 = lineage.CreateLineageEventRequest() - + # 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 @@ -16075,7 +16105,6 @@ def test_get_lineage_event_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lineage.GetLineageEventRequest() - assert args[0] == request_msg @@ -16097,7 +16126,6 @@ def test_list_lineage_events_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lineage.ListLineageEventsRequest() - assert args[0] == request_msg @@ -16119,7 +16147,6 @@ def test_delete_lineage_event_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lineage.DeleteLineageEventRequest() - assert args[0] == request_msg @@ -16139,7 +16166,6 @@ def test_search_links_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lineage.SearchLinksRequest() - assert args[0] == request_msg @@ -16161,7 +16187,6 @@ def test_batch_search_link_processes_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lineage.BatchSearchLinkProcessesRequest() - assert args[0] == request_msg @@ -16183,7 +16208,6 @@ def test_search_lineage_streaming_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lineage.SearchLineageStreamingRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-datacatalog/noxfile.py b/packages/google-cloud-datacatalog/noxfile.py index 9560bf619319..f1d0baa07491 100644 --- a/packages/google-cloud-datacatalog/noxfile.py +++ b/packages/google-cloud-datacatalog/noxfile.py @@ -47,7 +47,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-datacatalog" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-datacatalog/setup.py b/packages/google-cloud-datacatalog/setup.py index a3cda9f19e9b..199f4daffb54 100644 --- a/packages/google-cloud-datacatalog/setup.py +++ b/packages/google-cloud-datacatalog/setup.py @@ -45,7 +45,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/google-cloud-datacatalog/testing/constraints-3.10.txt b/packages/google-cloud-datacatalog/testing/constraints-3.10.txt index a92801e1c8e2..b39cd54634f9 100644 --- a/packages/google-cloud-datacatalog/testing/constraints-3.10.txt +++ b/packages/google-cloud-datacatalog/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/google-cloud-datacatalog/tests/unit/gapic/datacatalog_v1/test_data_catalog.py b/packages/google-cloud-datacatalog/tests/unit/gapic/datacatalog_v1/test_data_catalog.py index f3695a12f142..190eff2b284b 100644 --- a/packages/google-cloud-datacatalog/tests/unit/gapic/datacatalog_v1/test_data_catalog.py +++ b/packages/google-cloud-datacatalog/tests/unit/gapic/datacatalog_v1/test_data_catalog.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 @@ -134,6 +135,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" @@ -1282,8 +1298,8 @@ def test_data_catalog_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - datacatalog.SearchCatalogRequest, - dict, + datacatalog.SearchCatalogRequest(), + {}, ], ) def test_search_catalog(request_type, transport: str = "grpc"): @@ -1294,7 +1310,7 @@ def test_search_catalog(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.search_catalog), "__call__") as call: @@ -1344,11 +1360,12 @@ def test_search_catalog_non_empty_request_with_auto_populated_field(): client.search_catalog(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datacatalog.SearchCatalogRequest( + request_msg = datacatalog.SearchCatalogRequest( query="query_value", page_token="page_token_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_search_catalog_use_cached_wrapped_rpc(): @@ -1429,9 +1446,14 @@ async def test_search_catalog_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_search_catalog_async( - transport: str = "grpc_asyncio", request_type=datacatalog.SearchCatalogRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datacatalog.SearchCatalogRequest(), + {}, + ], +) +async def test_search_catalog_async(request_type, transport: str = "grpc_asyncio"): client = DataCatalogAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1439,7 +1461,7 @@ async def test_search_catalog_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.search_catalog), "__call__") as call: @@ -1466,11 +1488,6 @@ async def test_search_catalog_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_search_catalog_async_from_dict(): - await test_search_catalog_async(request_type=dict) - - def test_search_catalog_flattened(): client = DataCatalogClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1765,8 +1782,8 @@ async def test_search_catalog_async_pages(): @pytest.mark.parametrize( "request_type", [ - datacatalog.CreateEntryGroupRequest, - dict, + datacatalog.CreateEntryGroupRequest(), + {}, ], ) def test_create_entry_group(request_type, transport: str = "grpc"): @@ -1777,7 +1794,7 @@ def test_create_entry_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1832,10 +1849,11 @@ def test_create_entry_group_non_empty_request_with_auto_populated_field(): client.create_entry_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datacatalog.CreateEntryGroupRequest( + request_msg = datacatalog.CreateEntryGroupRequest( parent="parent_value", entry_group_id="entry_group_id_value", ) + assert args[0] == request_msg def test_create_entry_group_use_cached_wrapped_rpc(): @@ -1920,9 +1938,14 @@ async def test_create_entry_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_entry_group_async( - transport: str = "grpc_asyncio", request_type=datacatalog.CreateEntryGroupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datacatalog.CreateEntryGroupRequest(), + {}, + ], +) +async def test_create_entry_group_async(request_type, transport: str = "grpc_asyncio"): client = DataCatalogAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1930,7 +1953,7 @@ async def test_create_entry_group_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( @@ -1961,11 +1984,6 @@ async def test_create_entry_group_async( assert response.transferred_to_dataplex is True -@pytest.mark.asyncio -async def test_create_entry_group_async_from_dict(): - await test_create_entry_group_async(request_type=dict) - - def test_create_entry_group_field_headers(): client = DataCatalogClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2140,8 +2158,8 @@ async def test_create_entry_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datacatalog.GetEntryGroupRequest, - dict, + datacatalog.GetEntryGroupRequest(), + {}, ], ) def test_get_entry_group(request_type, transport: str = "grpc"): @@ -2152,7 +2170,7 @@ def test_get_entry_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_entry_group), "__call__") as call: @@ -2202,9 +2220,10 @@ def test_get_entry_group_non_empty_request_with_auto_populated_field(): client.get_entry_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datacatalog.GetEntryGroupRequest( + request_msg = datacatalog.GetEntryGroupRequest( name="name_value", ) + assert args[0] == request_msg def test_get_entry_group_use_cached_wrapped_rpc(): @@ -2285,9 +2304,14 @@ async def test_get_entry_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_entry_group_async( - transport: str = "grpc_asyncio", request_type=datacatalog.GetEntryGroupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datacatalog.GetEntryGroupRequest(), + {}, + ], +) +async def test_get_entry_group_async(request_type, transport: str = "grpc_asyncio"): client = DataCatalogAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2295,7 +2319,7 @@ async def test_get_entry_group_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_entry_group), "__call__") as call: @@ -2324,11 +2348,6 @@ async def test_get_entry_group_async( assert response.transferred_to_dataplex is True -@pytest.mark.asyncio -async def test_get_entry_group_async_from_dict(): - await test_get_entry_group_async(request_type=dict) - - def test_get_entry_group_field_headers(): client = DataCatalogClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2485,8 +2504,8 @@ async def test_get_entry_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datacatalog.UpdateEntryGroupRequest, - dict, + datacatalog.UpdateEntryGroupRequest(), + {}, ], ) def test_update_entry_group(request_type, transport: str = "grpc"): @@ -2497,7 +2516,7 @@ def test_update_entry_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2549,7 +2568,8 @@ def test_update_entry_group_non_empty_request_with_auto_populated_field(): client.update_entry_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datacatalog.UpdateEntryGroupRequest() + request_msg = datacatalog.UpdateEntryGroupRequest() + assert args[0] == request_msg def test_update_entry_group_use_cached_wrapped_rpc(): @@ -2634,9 +2654,14 @@ async def test_update_entry_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_entry_group_async( - transport: str = "grpc_asyncio", request_type=datacatalog.UpdateEntryGroupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datacatalog.UpdateEntryGroupRequest(), + {}, + ], +) +async def test_update_entry_group_async(request_type, transport: str = "grpc_asyncio"): client = DataCatalogAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2644,7 +2669,7 @@ async def test_update_entry_group_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( @@ -2675,11 +2700,6 @@ async def test_update_entry_group_async( assert response.transferred_to_dataplex is True -@pytest.mark.asyncio -async def test_update_entry_group_async_from_dict(): - await test_update_entry_group_async(request_type=dict) - - def test_update_entry_group_field_headers(): client = DataCatalogClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2844,8 +2864,8 @@ async def test_update_entry_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datacatalog.DeleteEntryGroupRequest, - dict, + datacatalog.DeleteEntryGroupRequest(), + {}, ], ) def test_delete_entry_group(request_type, transport: str = "grpc"): @@ -2856,7 +2876,7 @@ def test_delete_entry_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2901,9 +2921,10 @@ def test_delete_entry_group_non_empty_request_with_auto_populated_field(): client.delete_entry_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datacatalog.DeleteEntryGroupRequest( + request_msg = datacatalog.DeleteEntryGroupRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_entry_group_use_cached_wrapped_rpc(): @@ -2988,9 +3009,14 @@ async def test_delete_entry_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_entry_group_async( - transport: str = "grpc_asyncio", request_type=datacatalog.DeleteEntryGroupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datacatalog.DeleteEntryGroupRequest(), + {}, + ], +) +async def test_delete_entry_group_async(request_type, transport: str = "grpc_asyncio"): client = DataCatalogAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2998,7 +3024,7 @@ async def test_delete_entry_group_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( @@ -3018,11 +3044,6 @@ async def test_delete_entry_group_async( assert response is None -@pytest.mark.asyncio -async def test_delete_entry_group_async_from_dict(): - await test_delete_entry_group_async(request_type=dict) - - def test_delete_entry_group_field_headers(): client = DataCatalogClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3173,8 +3194,8 @@ async def test_delete_entry_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datacatalog.ListEntryGroupsRequest, - dict, + datacatalog.ListEntryGroupsRequest(), + {}, ], ) def test_list_entry_groups(request_type, transport: str = "grpc"): @@ -3185,7 +3206,7 @@ def test_list_entry_groups(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3234,10 +3255,11 @@ def test_list_entry_groups_non_empty_request_with_auto_populated_field(): client.list_entry_groups(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datacatalog.ListEntryGroupsRequest( + request_msg = datacatalog.ListEntryGroupsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_entry_groups_use_cached_wrapped_rpc(): @@ -3320,9 +3342,14 @@ async def test_list_entry_groups_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_entry_groups_async( - transport: str = "grpc_asyncio", request_type=datacatalog.ListEntryGroupsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datacatalog.ListEntryGroupsRequest(), + {}, + ], +) +async def test_list_entry_groups_async(request_type, transport: str = "grpc_asyncio"): client = DataCatalogAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3330,7 +3357,7 @@ async def test_list_entry_groups_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( @@ -3355,11 +3382,6 @@ async def test_list_entry_groups_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_entry_groups_async_from_dict(): - await test_list_entry_groups_async(request_type=dict) - - def test_list_entry_groups_field_headers(): client = DataCatalogClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3712,8 +3734,8 @@ async def test_list_entry_groups_async_pages(): @pytest.mark.parametrize( "request_type", [ - datacatalog.CreateEntryRequest, - dict, + datacatalog.CreateEntryRequest(), + {}, ], ) def test_create_entry(request_type, transport: str = "grpc"): @@ -3724,7 +3746,7 @@ def test_create_entry(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_entry), "__call__") as call: @@ -3779,10 +3801,11 @@ def test_create_entry_non_empty_request_with_auto_populated_field(): client.create_entry(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datacatalog.CreateEntryRequest( + request_msg = datacatalog.CreateEntryRequest( parent="parent_value", entry_id="entry_id_value", ) + assert args[0] == request_msg def test_create_entry_use_cached_wrapped_rpc(): @@ -3863,9 +3886,14 @@ async def test_create_entry_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_entry_async( - transport: str = "grpc_asyncio", request_type=datacatalog.CreateEntryRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datacatalog.CreateEntryRequest(), + {}, + ], +) +async def test_create_entry_async(request_type, transport: str = "grpc_asyncio"): client = DataCatalogAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3873,7 +3901,7 @@ async def test_create_entry_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_entry), "__call__") as call: @@ -3904,11 +3932,6 @@ async def test_create_entry_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_create_entry_async_from_dict(): - await test_create_entry_async(request_type=dict) - - def test_create_entry_field_headers(): client = DataCatalogClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4071,8 +4094,8 @@ async def test_create_entry_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datacatalog.UpdateEntryRequest, - dict, + datacatalog.UpdateEntryRequest(), + {}, ], ) def test_update_entry(request_type, transport: str = "grpc"): @@ -4083,7 +4106,7 @@ def test_update_entry(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_entry), "__call__") as call: @@ -4135,7 +4158,8 @@ def test_update_entry_non_empty_request_with_auto_populated_field(): client.update_entry(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datacatalog.UpdateEntryRequest() + request_msg = datacatalog.UpdateEntryRequest() + assert args[0] == request_msg def test_update_entry_use_cached_wrapped_rpc(): @@ -4216,9 +4240,14 @@ async def test_update_entry_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_entry_async( - transport: str = "grpc_asyncio", request_type=datacatalog.UpdateEntryRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datacatalog.UpdateEntryRequest(), + {}, + ], +) +async def test_update_entry_async(request_type, transport: str = "grpc_asyncio"): client = DataCatalogAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4226,7 +4255,7 @@ async def test_update_entry_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_entry), "__call__") as call: @@ -4257,11 +4286,6 @@ async def test_update_entry_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_update_entry_async_from_dict(): - await test_update_entry_async(request_type=dict) - - def test_update_entry_field_headers(): client = DataCatalogClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4414,8 +4438,8 @@ async def test_update_entry_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datacatalog.DeleteEntryRequest, - dict, + datacatalog.DeleteEntryRequest(), + {}, ], ) def test_delete_entry(request_type, transport: str = "grpc"): @@ -4426,7 +4450,7 @@ def test_delete_entry(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_entry), "__call__") as call: @@ -4467,9 +4491,10 @@ def test_delete_entry_non_empty_request_with_auto_populated_field(): client.delete_entry(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datacatalog.DeleteEntryRequest( + request_msg = datacatalog.DeleteEntryRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_entry_use_cached_wrapped_rpc(): @@ -4550,9 +4575,14 @@ async def test_delete_entry_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_entry_async( - transport: str = "grpc_asyncio", request_type=datacatalog.DeleteEntryRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datacatalog.DeleteEntryRequest(), + {}, + ], +) +async def test_delete_entry_async(request_type, transport: str = "grpc_asyncio"): client = DataCatalogAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4560,7 +4590,7 @@ async def test_delete_entry_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_entry), "__call__") as call: @@ -4578,11 +4608,6 @@ async def test_delete_entry_async( assert response is None -@pytest.mark.asyncio -async def test_delete_entry_async_from_dict(): - await test_delete_entry_async(request_type=dict) - - def test_delete_entry_field_headers(): client = DataCatalogClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4725,8 +4750,8 @@ async def test_delete_entry_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datacatalog.GetEntryRequest, - dict, + datacatalog.GetEntryRequest(), + {}, ], ) def test_get_entry(request_type, transport: str = "grpc"): @@ -4737,7 +4762,7 @@ def test_get_entry(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_entry), "__call__") as call: @@ -4791,9 +4816,10 @@ def test_get_entry_non_empty_request_with_auto_populated_field(): client.get_entry(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datacatalog.GetEntryRequest( + request_msg = datacatalog.GetEntryRequest( name="name_value", ) + assert args[0] == request_msg def test_get_entry_use_cached_wrapped_rpc(): @@ -4872,9 +4898,14 @@ async def test_get_entry_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_entry_async( - transport: str = "grpc_asyncio", request_type=datacatalog.GetEntryRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datacatalog.GetEntryRequest(), + {}, + ], +) +async def test_get_entry_async(request_type, transport: str = "grpc_asyncio"): client = DataCatalogAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4882,7 +4913,7 @@ async def test_get_entry_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_entry), "__call__") as call: @@ -4913,11 +4944,6 @@ async def test_get_entry_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_get_entry_async_from_dict(): - await test_get_entry_async(request_type=dict) - - def test_get_entry_field_headers(): client = DataCatalogClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5060,8 +5086,8 @@ async def test_get_entry_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datacatalog.LookupEntryRequest, - dict, + datacatalog.LookupEntryRequest(), + {}, ], ) def test_lookup_entry(request_type, transport: str = "grpc"): @@ -5072,7 +5098,7 @@ def test_lookup_entry(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.lookup_entry), "__call__") as call: @@ -5130,13 +5156,14 @@ def test_lookup_entry_non_empty_request_with_auto_populated_field(): client.lookup_entry(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datacatalog.LookupEntryRequest( + request_msg = datacatalog.LookupEntryRequest( linked_resource="linked_resource_value", sql_resource="sql_resource_value", fully_qualified_name="fully_qualified_name_value", project="project_value", location="location_value", ) + assert args[0] == request_msg def test_lookup_entry_use_cached_wrapped_rpc(): @@ -5217,9 +5244,14 @@ async def test_lookup_entry_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_lookup_entry_async( - transport: str = "grpc_asyncio", request_type=datacatalog.LookupEntryRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datacatalog.LookupEntryRequest(), + {}, + ], +) +async def test_lookup_entry_async(request_type, transport: str = "grpc_asyncio"): client = DataCatalogAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5227,7 +5259,7 @@ async def test_lookup_entry_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.lookup_entry), "__call__") as call: @@ -5258,16 +5290,11 @@ async def test_lookup_entry_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_lookup_entry_async_from_dict(): - await test_lookup_entry_async(request_type=dict) - - @pytest.mark.parametrize( "request_type", [ - datacatalog.ListEntriesRequest, - dict, + datacatalog.ListEntriesRequest(), + {}, ], ) def test_list_entries(request_type, transport: str = "grpc"): @@ -5278,7 +5305,7 @@ def test_list_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_entries), "__call__") as call: @@ -5323,10 +5350,11 @@ def test_list_entries_non_empty_request_with_auto_populated_field(): client.list_entries(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datacatalog.ListEntriesRequest( + request_msg = datacatalog.ListEntriesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_entries_use_cached_wrapped_rpc(): @@ -5407,9 +5435,14 @@ async def test_list_entries_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_entries_async( - transport: str = "grpc_asyncio", request_type=datacatalog.ListEntriesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datacatalog.ListEntriesRequest(), + {}, + ], +) +async def test_list_entries_async(request_type, transport: str = "grpc_asyncio"): client = DataCatalogAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5417,7 +5450,7 @@ async def test_list_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_entries), "__call__") as call: @@ -5440,11 +5473,6 @@ async def test_list_entries_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_entries_async_from_dict(): - await test_list_entries_async(request_type=dict) - - def test_list_entries_field_headers(): client = DataCatalogClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5781,8 +5809,8 @@ async def test_list_entries_async_pages(): @pytest.mark.parametrize( "request_type", [ - datacatalog.ModifyEntryOverviewRequest, - dict, + datacatalog.ModifyEntryOverviewRequest(), + {}, ], ) def test_modify_entry_overview(request_type, transport: str = "grpc"): @@ -5793,7 +5821,7 @@ def test_modify_entry_overview(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,9 +5869,10 @@ def test_modify_entry_overview_non_empty_request_with_auto_populated_field(): client.modify_entry_overview(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datacatalog.ModifyEntryOverviewRequest( + request_msg = datacatalog.ModifyEntryOverviewRequest( name="name_value", ) + assert args[0] == request_msg def test_modify_entry_overview_use_cached_wrapped_rpc(): @@ -5929,8 +5958,15 @@ async def test_modify_entry_overview_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + datacatalog.ModifyEntryOverviewRequest(), + {}, + ], +) async def test_modify_entry_overview_async( - transport: str = "grpc_asyncio", request_type=datacatalog.ModifyEntryOverviewRequest + request_type, transport: str = "grpc_asyncio" ): client = DataCatalogAsyncClient( credentials=async_anonymous_credentials(), @@ -5939,7 +5975,7 @@ async def test_modify_entry_overview_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( @@ -5964,11 +6000,6 @@ async def test_modify_entry_overview_async( assert response.overview == "overview_value" -@pytest.mark.asyncio -async def test_modify_entry_overview_async_from_dict(): - await test_modify_entry_overview_async(request_type=dict) - - def test_modify_entry_overview_field_headers(): client = DataCatalogClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6037,8 +6068,8 @@ async def test_modify_entry_overview_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - datacatalog.ModifyEntryContactsRequest, - dict, + datacatalog.ModifyEntryContactsRequest(), + {}, ], ) def test_modify_entry_contacts(request_type, transport: str = "grpc"): @@ -6049,7 +6080,7 @@ def test_modify_entry_contacts(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6094,9 +6125,10 @@ def test_modify_entry_contacts_non_empty_request_with_auto_populated_field(): client.modify_entry_contacts(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datacatalog.ModifyEntryContactsRequest( + request_msg = datacatalog.ModifyEntryContactsRequest( name="name_value", ) + assert args[0] == request_msg def test_modify_entry_contacts_use_cached_wrapped_rpc(): @@ -6182,8 +6214,15 @@ async def test_modify_entry_contacts_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + datacatalog.ModifyEntryContactsRequest(), + {}, + ], +) async def test_modify_entry_contacts_async( - transport: str = "grpc_asyncio", request_type=datacatalog.ModifyEntryContactsRequest + request_type, transport: str = "grpc_asyncio" ): client = DataCatalogAsyncClient( credentials=async_anonymous_credentials(), @@ -6192,7 +6231,7 @@ async def test_modify_entry_contacts_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( @@ -6214,11 +6253,6 @@ async def test_modify_entry_contacts_async( assert isinstance(response, datacatalog.Contacts) -@pytest.mark.asyncio -async def test_modify_entry_contacts_async_from_dict(): - await test_modify_entry_contacts_async(request_type=dict) - - def test_modify_entry_contacts_field_headers(): client = DataCatalogClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6287,8 +6321,8 @@ async def test_modify_entry_contacts_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - datacatalog.CreateTagTemplateRequest, - dict, + datacatalog.CreateTagTemplateRequest(), + {}, ], ) def test_create_tag_template(request_type, transport: str = "grpc"): @@ -6299,7 +6333,7 @@ def test_create_tag_template(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6357,10 +6391,11 @@ def test_create_tag_template_non_empty_request_with_auto_populated_field(): client.create_tag_template(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datacatalog.CreateTagTemplateRequest( + request_msg = datacatalog.CreateTagTemplateRequest( parent="parent_value", tag_template_id="tag_template_id_value", ) + assert args[0] == request_msg def test_create_tag_template_use_cached_wrapped_rpc(): @@ -6445,9 +6480,14 @@ async def test_create_tag_template_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_tag_template_async( - transport: str = "grpc_asyncio", request_type=datacatalog.CreateTagTemplateRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datacatalog.CreateTagTemplateRequest(), + {}, + ], +) +async def test_create_tag_template_async(request_type, transport: str = "grpc_asyncio"): client = DataCatalogAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6455,7 +6495,7 @@ async def test_create_tag_template_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( @@ -6489,11 +6529,6 @@ async def test_create_tag_template_async( ) -@pytest.mark.asyncio -async def test_create_tag_template_async_from_dict(): - await test_create_tag_template_async(request_type=dict) - - def test_create_tag_template_field_headers(): client = DataCatalogClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6664,8 +6699,8 @@ async def test_create_tag_template_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datacatalog.GetTagTemplateRequest, - dict, + datacatalog.GetTagTemplateRequest(), + {}, ], ) def test_get_tag_template(request_type, transport: str = "grpc"): @@ -6676,7 +6711,7 @@ def test_get_tag_template(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tag_template), "__call__") as call: @@ -6729,9 +6764,10 @@ def test_get_tag_template_non_empty_request_with_auto_populated_field(): client.get_tag_template(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datacatalog.GetTagTemplateRequest( + request_msg = datacatalog.GetTagTemplateRequest( name="name_value", ) + assert args[0] == request_msg def test_get_tag_template_use_cached_wrapped_rpc(): @@ -6814,9 +6850,14 @@ async def test_get_tag_template_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_tag_template_async( - transport: str = "grpc_asyncio", request_type=datacatalog.GetTagTemplateRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datacatalog.GetTagTemplateRequest(), + {}, + ], +) +async def test_get_tag_template_async(request_type, transport: str = "grpc_asyncio"): client = DataCatalogAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6824,7 +6865,7 @@ async def test_get_tag_template_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_tag_template), "__call__") as call: @@ -6856,11 +6897,6 @@ async def test_get_tag_template_async( ) -@pytest.mark.asyncio -async def test_get_tag_template_async_from_dict(): - await test_get_tag_template_async(request_type=dict) - - def test_get_tag_template_field_headers(): client = DataCatalogClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7003,8 +7039,8 @@ async def test_get_tag_template_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datacatalog.UpdateTagTemplateRequest, - dict, + datacatalog.UpdateTagTemplateRequest(), + {}, ], ) def test_update_tag_template(request_type, transport: str = "grpc"): @@ -7015,7 +7051,7 @@ def test_update_tag_template(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7070,7 +7106,8 @@ def test_update_tag_template_non_empty_request_with_auto_populated_field(): client.update_tag_template(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datacatalog.UpdateTagTemplateRequest() + request_msg = datacatalog.UpdateTagTemplateRequest() + assert args[0] == request_msg def test_update_tag_template_use_cached_wrapped_rpc(): @@ -7155,9 +7192,14 @@ async def test_update_tag_template_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_tag_template_async( - transport: str = "grpc_asyncio", request_type=datacatalog.UpdateTagTemplateRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datacatalog.UpdateTagTemplateRequest(), + {}, + ], +) +async def test_update_tag_template_async(request_type, transport: str = "grpc_asyncio"): client = DataCatalogAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7165,7 +7207,7 @@ async def test_update_tag_template_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( @@ -7199,11 +7241,6 @@ async def test_update_tag_template_async( ) -@pytest.mark.asyncio -async def test_update_tag_template_async_from_dict(): - await test_update_tag_template_async(request_type=dict) - - def test_update_tag_template_field_headers(): client = DataCatalogClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7364,8 +7401,8 @@ async def test_update_tag_template_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datacatalog.DeleteTagTemplateRequest, - dict, + datacatalog.DeleteTagTemplateRequest(), + {}, ], ) def test_delete_tag_template(request_type, transport: str = "grpc"): @@ -7376,7 +7413,7 @@ def test_delete_tag_template(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7421,9 +7458,10 @@ def test_delete_tag_template_non_empty_request_with_auto_populated_field(): client.delete_tag_template(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datacatalog.DeleteTagTemplateRequest( + request_msg = datacatalog.DeleteTagTemplateRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_tag_template_use_cached_wrapped_rpc(): @@ -7508,9 +7546,14 @@ async def test_delete_tag_template_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_tag_template_async( - transport: str = "grpc_asyncio", request_type=datacatalog.DeleteTagTemplateRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datacatalog.DeleteTagTemplateRequest(), + {}, + ], +) +async def test_delete_tag_template_async(request_type, transport: str = "grpc_asyncio"): client = DataCatalogAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7518,7 +7561,7 @@ async def test_delete_tag_template_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( @@ -7538,11 +7581,6 @@ async def test_delete_tag_template_async( assert response is None -@pytest.mark.asyncio -async def test_delete_tag_template_async_from_dict(): - await test_delete_tag_template_async(request_type=dict) - - def test_delete_tag_template_field_headers(): client = DataCatalogClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7703,8 +7741,8 @@ async def test_delete_tag_template_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datacatalog.CreateTagTemplateFieldRequest, - dict, + datacatalog.CreateTagTemplateFieldRequest(), + {}, ], ) def test_create_tag_template_field(request_type, transport: str = "grpc"): @@ -7715,7 +7753,7 @@ def test_create_tag_template_field(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,10 +7810,11 @@ def test_create_tag_template_field_non_empty_request_with_auto_populated_field() client.create_tag_template_field(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datacatalog.CreateTagTemplateFieldRequest( + request_msg = datacatalog.CreateTagTemplateFieldRequest( parent="parent_value", tag_template_field_id="tag_template_field_id_value", ) + assert args[0] == request_msg def test_create_tag_template_field_use_cached_wrapped_rpc(): @@ -7861,9 +7900,15 @@ async def test_create_tag_template_field_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + datacatalog.CreateTagTemplateFieldRequest(), + {}, + ], +) async def test_create_tag_template_field_async( - transport: str = "grpc_asyncio", - request_type=datacatalog.CreateTagTemplateFieldRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataCatalogAsyncClient( credentials=async_anonymous_credentials(), @@ -7872,7 +7917,7 @@ async def test_create_tag_template_field_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( @@ -7905,11 +7950,6 @@ async def test_create_tag_template_field_async( assert response.order == 540 -@pytest.mark.asyncio -async def test_create_tag_template_field_async_from_dict(): - await test_create_tag_template_field_async(request_type=dict) - - def test_create_tag_template_field_field_headers(): client = DataCatalogClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8084,8 +8124,8 @@ async def test_create_tag_template_field_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datacatalog.UpdateTagTemplateFieldRequest, - dict, + datacatalog.UpdateTagTemplateFieldRequest(), + {}, ], ) def test_update_tag_template_field(request_type, transport: str = "grpc"): @@ -8096,7 +8136,7 @@ def test_update_tag_template_field(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8152,9 +8192,10 @@ def test_update_tag_template_field_non_empty_request_with_auto_populated_field() client.update_tag_template_field(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datacatalog.UpdateTagTemplateFieldRequest( + request_msg = datacatalog.UpdateTagTemplateFieldRequest( name="name_value", ) + assert args[0] == request_msg def test_update_tag_template_field_use_cached_wrapped_rpc(): @@ -8240,9 +8281,15 @@ async def test_update_tag_template_field_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + datacatalog.UpdateTagTemplateFieldRequest(), + {}, + ], +) async def test_update_tag_template_field_async( - transport: str = "grpc_asyncio", - request_type=datacatalog.UpdateTagTemplateFieldRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataCatalogAsyncClient( credentials=async_anonymous_credentials(), @@ -8251,7 +8298,7 @@ async def test_update_tag_template_field_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( @@ -8284,11 +8331,6 @@ async def test_update_tag_template_field_async( assert response.order == 540 -@pytest.mark.asyncio -async def test_update_tag_template_field_async_from_dict(): - await test_update_tag_template_field_async(request_type=dict) - - def test_update_tag_template_field_field_headers(): client = DataCatalogClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8463,8 +8505,8 @@ async def test_update_tag_template_field_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datacatalog.RenameTagTemplateFieldRequest, - dict, + datacatalog.RenameTagTemplateFieldRequest(), + {}, ], ) def test_rename_tag_template_field(request_type, transport: str = "grpc"): @@ -8475,7 +8517,7 @@ def test_rename_tag_template_field(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8532,10 +8574,11 @@ def test_rename_tag_template_field_non_empty_request_with_auto_populated_field() client.rename_tag_template_field(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datacatalog.RenameTagTemplateFieldRequest( + request_msg = datacatalog.RenameTagTemplateFieldRequest( name="name_value", new_tag_template_field_id="new_tag_template_field_id_value", ) + assert args[0] == request_msg def test_rename_tag_template_field_use_cached_wrapped_rpc(): @@ -8621,9 +8664,15 @@ async def test_rename_tag_template_field_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + datacatalog.RenameTagTemplateFieldRequest(), + {}, + ], +) async def test_rename_tag_template_field_async( - transport: str = "grpc_asyncio", - request_type=datacatalog.RenameTagTemplateFieldRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataCatalogAsyncClient( credentials=async_anonymous_credentials(), @@ -8632,7 +8681,7 @@ async def test_rename_tag_template_field_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( @@ -8665,11 +8714,6 @@ async def test_rename_tag_template_field_async( assert response.order == 540 -@pytest.mark.asyncio -async def test_rename_tag_template_field_async_from_dict(): - await test_rename_tag_template_field_async(request_type=dict) - - def test_rename_tag_template_field_field_headers(): client = DataCatalogClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8834,8 +8878,8 @@ async def test_rename_tag_template_field_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datacatalog.RenameTagTemplateFieldEnumValueRequest, - dict, + datacatalog.RenameTagTemplateFieldEnumValueRequest(), + {}, ], ) def test_rename_tag_template_field_enum_value(request_type, transport: str = "grpc"): @@ -8846,7 +8890,7 @@ def test_rename_tag_template_field_enum_value(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( @@ -8903,10 +8947,11 @@ def test_rename_tag_template_field_enum_value_non_empty_request_with_auto_popula client.rename_tag_template_field_enum_value(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datacatalog.RenameTagTemplateFieldEnumValueRequest( + request_msg = datacatalog.RenameTagTemplateFieldEnumValueRequest( name="name_value", new_enum_value_display_name="new_enum_value_display_name_value", ) + assert args[0] == request_msg def test_rename_tag_template_field_enum_value_use_cached_wrapped_rpc(): @@ -8992,9 +9037,15 @@ async def test_rename_tag_template_field_enum_value_async_use_cached_wrapped_rpc @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + datacatalog.RenameTagTemplateFieldEnumValueRequest(), + {}, + ], +) async def test_rename_tag_template_field_enum_value_async( - transport: str = "grpc_asyncio", - request_type=datacatalog.RenameTagTemplateFieldEnumValueRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataCatalogAsyncClient( credentials=async_anonymous_credentials(), @@ -9003,7 +9054,7 @@ async def test_rename_tag_template_field_enum_value_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( @@ -9036,11 +9087,6 @@ async def test_rename_tag_template_field_enum_value_async( assert response.order == 540 -@pytest.mark.asyncio -async def test_rename_tag_template_field_enum_value_async_from_dict(): - await test_rename_tag_template_field_enum_value_async(request_type=dict) - - def test_rename_tag_template_field_enum_value_field_headers(): client = DataCatalogClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9205,8 +9251,8 @@ async def test_rename_tag_template_field_enum_value_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datacatalog.DeleteTagTemplateFieldRequest, - dict, + datacatalog.DeleteTagTemplateFieldRequest(), + {}, ], ) def test_delete_tag_template_field(request_type, transport: str = "grpc"): @@ -9217,7 +9263,7 @@ def test_delete_tag_template_field(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9262,9 +9308,10 @@ def test_delete_tag_template_field_non_empty_request_with_auto_populated_field() client.delete_tag_template_field(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datacatalog.DeleteTagTemplateFieldRequest( + request_msg = datacatalog.DeleteTagTemplateFieldRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_tag_template_field_use_cached_wrapped_rpc(): @@ -9350,9 +9397,15 @@ async def test_delete_tag_template_field_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + datacatalog.DeleteTagTemplateFieldRequest(), + {}, + ], +) async def test_delete_tag_template_field_async( - transport: str = "grpc_asyncio", - request_type=datacatalog.DeleteTagTemplateFieldRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataCatalogAsyncClient( credentials=async_anonymous_credentials(), @@ -9361,7 +9414,7 @@ async def test_delete_tag_template_field_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( @@ -9381,11 +9434,6 @@ async def test_delete_tag_template_field_async( assert response is None -@pytest.mark.asyncio -async def test_delete_tag_template_field_async_from_dict(): - await test_delete_tag_template_field_async(request_type=dict) - - def test_delete_tag_template_field_field_headers(): client = DataCatalogClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9546,8 +9594,8 @@ async def test_delete_tag_template_field_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datacatalog.CreateTagRequest, - dict, + datacatalog.CreateTagRequest(), + {}, ], ) def test_create_tag(request_type, transport: str = "grpc"): @@ -9558,7 +9606,7 @@ def test_create_tag(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tag), "__call__") as call: @@ -9612,9 +9660,10 @@ def test_create_tag_non_empty_request_with_auto_populated_field(): client.create_tag(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datacatalog.CreateTagRequest( + request_msg = datacatalog.CreateTagRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_tag_use_cached_wrapped_rpc(): @@ -9693,9 +9742,14 @@ async def test_create_tag_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_create_tag_async( - transport: str = "grpc_asyncio", request_type=datacatalog.CreateTagRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datacatalog.CreateTagRequest(), + {}, + ], +) +async def test_create_tag_async(request_type, transport: str = "grpc_asyncio"): client = DataCatalogAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9703,7 +9757,7 @@ async def test_create_tag_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_tag), "__call__") as call: @@ -9735,11 +9789,6 @@ async def test_create_tag_async( ) -@pytest.mark.asyncio -async def test_create_tag_async_from_dict(): - await test_create_tag_async(request_type=dict) - - def test_create_tag_field_headers(): client = DataCatalogClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9892,8 +9941,8 @@ async def test_create_tag_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datacatalog.UpdateTagRequest, - dict, + datacatalog.UpdateTagRequest(), + {}, ], ) def test_update_tag(request_type, transport: str = "grpc"): @@ -9904,7 +9953,7 @@ def test_update_tag(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tag), "__call__") as call: @@ -9956,7 +10005,8 @@ def test_update_tag_non_empty_request_with_auto_populated_field(): client.update_tag(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datacatalog.UpdateTagRequest() + request_msg = datacatalog.UpdateTagRequest() + assert args[0] == request_msg def test_update_tag_use_cached_wrapped_rpc(): @@ -10035,9 +10085,14 @@ async def test_update_tag_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_update_tag_async( - transport: str = "grpc_asyncio", request_type=datacatalog.UpdateTagRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datacatalog.UpdateTagRequest(), + {}, + ], +) +async def test_update_tag_async(request_type, transport: str = "grpc_asyncio"): client = DataCatalogAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10045,7 +10100,7 @@ async def test_update_tag_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_tag), "__call__") as call: @@ -10077,11 +10132,6 @@ async def test_update_tag_async( ) -@pytest.mark.asyncio -async def test_update_tag_async_from_dict(): - await test_update_tag_async(request_type=dict) - - def test_update_tag_field_headers(): client = DataCatalogClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10234,8 +10284,8 @@ async def test_update_tag_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datacatalog.DeleteTagRequest, - dict, + datacatalog.DeleteTagRequest(), + {}, ], ) def test_delete_tag(request_type, transport: str = "grpc"): @@ -10246,7 +10296,7 @@ def test_delete_tag(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tag), "__call__") as call: @@ -10287,9 +10337,10 @@ def test_delete_tag_non_empty_request_with_auto_populated_field(): client.delete_tag(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datacatalog.DeleteTagRequest( + request_msg = datacatalog.DeleteTagRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_tag_use_cached_wrapped_rpc(): @@ -10368,9 +10419,14 @@ async def test_delete_tag_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_delete_tag_async( - transport: str = "grpc_asyncio", request_type=datacatalog.DeleteTagRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datacatalog.DeleteTagRequest(), + {}, + ], +) +async def test_delete_tag_async(request_type, transport: str = "grpc_asyncio"): client = DataCatalogAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10378,7 +10434,7 @@ async def test_delete_tag_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_tag), "__call__") as call: @@ -10396,11 +10452,6 @@ async def test_delete_tag_async( assert response is None -@pytest.mark.asyncio -async def test_delete_tag_async_from_dict(): - await test_delete_tag_async(request_type=dict) - - def test_delete_tag_field_headers(): client = DataCatalogClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10543,8 +10594,8 @@ async def test_delete_tag_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datacatalog.ListTagsRequest, - dict, + datacatalog.ListTagsRequest(), + {}, ], ) def test_list_tags(request_type, transport: str = "grpc"): @@ -10555,7 +10606,7 @@ def test_list_tags(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tags), "__call__") as call: @@ -10600,10 +10651,11 @@ def test_list_tags_non_empty_request_with_auto_populated_field(): client.list_tags(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datacatalog.ListTagsRequest( + request_msg = datacatalog.ListTagsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_tags_use_cached_wrapped_rpc(): @@ -10682,9 +10734,14 @@ async def test_list_tags_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_list_tags_async( - transport: str = "grpc_asyncio", request_type=datacatalog.ListTagsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datacatalog.ListTagsRequest(), + {}, + ], +) +async def test_list_tags_async(request_type, transport: str = "grpc_asyncio"): client = DataCatalogAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10692,7 +10749,7 @@ async def test_list_tags_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_tags), "__call__") as call: @@ -10715,11 +10772,6 @@ async def test_list_tags_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_tags_async_from_dict(): - await test_list_tags_async(request_type=dict) - - def test_list_tags_field_headers(): client = DataCatalogClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11056,8 +11108,8 @@ async def test_list_tags_async_pages(): @pytest.mark.parametrize( "request_type", [ - datacatalog.ReconcileTagsRequest, - dict, + datacatalog.ReconcileTagsRequest(), + {}, ], ) def test_reconcile_tags(request_type, transport: str = "grpc"): @@ -11068,7 +11120,7 @@ def test_reconcile_tags(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.reconcile_tags), "__call__") as call: @@ -11110,10 +11162,11 @@ def test_reconcile_tags_non_empty_request_with_auto_populated_field(): client.reconcile_tags(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datacatalog.ReconcileTagsRequest( + request_msg = datacatalog.ReconcileTagsRequest( parent="parent_value", tag_template="tag_template_value", ) + assert args[0] == request_msg def test_reconcile_tags_use_cached_wrapped_rpc(): @@ -11204,9 +11257,14 @@ async def test_reconcile_tags_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_reconcile_tags_async( - transport: str = "grpc_asyncio", request_type=datacatalog.ReconcileTagsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datacatalog.ReconcileTagsRequest(), + {}, + ], +) +async def test_reconcile_tags_async(request_type, transport: str = "grpc_asyncio"): client = DataCatalogAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11214,7 +11272,7 @@ async def test_reconcile_tags_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.reconcile_tags), "__call__") as call: @@ -11234,11 +11292,6 @@ async def test_reconcile_tags_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_reconcile_tags_async_from_dict(): - await test_reconcile_tags_async(request_type=dict) - - def test_reconcile_tags_field_headers(): client = DataCatalogClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11303,8 +11356,8 @@ async def test_reconcile_tags_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - datacatalog.StarEntryRequest, - dict, + datacatalog.StarEntryRequest(), + {}, ], ) def test_star_entry(request_type, transport: str = "grpc"): @@ -11315,7 +11368,7 @@ def test_star_entry(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.star_entry), "__call__") as call: @@ -11356,9 +11409,10 @@ def test_star_entry_non_empty_request_with_auto_populated_field(): client.star_entry(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datacatalog.StarEntryRequest( + request_msg = datacatalog.StarEntryRequest( name="name_value", ) + assert args[0] == request_msg def test_star_entry_use_cached_wrapped_rpc(): @@ -11437,9 +11491,14 @@ async def test_star_entry_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_star_entry_async( - transport: str = "grpc_asyncio", request_type=datacatalog.StarEntryRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datacatalog.StarEntryRequest(), + {}, + ], +) +async def test_star_entry_async(request_type, transport: str = "grpc_asyncio"): client = DataCatalogAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11447,7 +11506,7 @@ async def test_star_entry_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.star_entry), "__call__") as call: @@ -11467,11 +11526,6 @@ async def test_star_entry_async( assert isinstance(response, datacatalog.StarEntryResponse) -@pytest.mark.asyncio -async def test_star_entry_async_from_dict(): - await test_star_entry_async(request_type=dict) - - def test_star_entry_field_headers(): client = DataCatalogClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11618,8 +11672,8 @@ async def test_star_entry_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datacatalog.UnstarEntryRequest, - dict, + datacatalog.UnstarEntryRequest(), + {}, ], ) def test_unstar_entry(request_type, transport: str = "grpc"): @@ -11630,7 +11684,7 @@ def test_unstar_entry(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.unstar_entry), "__call__") as call: @@ -11671,9 +11725,10 @@ def test_unstar_entry_non_empty_request_with_auto_populated_field(): client.unstar_entry(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datacatalog.UnstarEntryRequest( + request_msg = datacatalog.UnstarEntryRequest( name="name_value", ) + assert args[0] == request_msg def test_unstar_entry_use_cached_wrapped_rpc(): @@ -11754,9 +11809,14 @@ async def test_unstar_entry_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_unstar_entry_async( - transport: str = "grpc_asyncio", request_type=datacatalog.UnstarEntryRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datacatalog.UnstarEntryRequest(), + {}, + ], +) +async def test_unstar_entry_async(request_type, transport: str = "grpc_asyncio"): client = DataCatalogAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11764,7 +11824,7 @@ async def test_unstar_entry_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.unstar_entry), "__call__") as call: @@ -11784,11 +11844,6 @@ async def test_unstar_entry_async( assert isinstance(response, datacatalog.UnstarEntryResponse) -@pytest.mark.asyncio -async def test_unstar_entry_async_from_dict(): - await test_unstar_entry_async(request_type=dict) - - def test_unstar_entry_field_headers(): client = DataCatalogClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11935,8 +11990,8 @@ async def test_unstar_entry_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.SetIamPolicyRequest, - dict, + iam_policy_pb2.SetIamPolicyRequest(), + {}, ], ) def test_set_iam_policy(request_type, transport: str = "grpc"): @@ -11947,7 +12002,7 @@ def test_set_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(type(client.transport.set_iam_policy), "__call__") as call: @@ -11993,9 +12048,10 @@ def test_set_iam_policy_non_empty_request_with_auto_populated_field(): client.set_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.SetIamPolicyRequest( + request_msg = iam_policy_pb2.SetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_set_iam_policy_use_cached_wrapped_rpc(): @@ -12076,9 +12132,14 @@ async def test_set_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.SetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.SetIamPolicyRequest(), + {}, + ], +) +async def test_set_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = DataCatalogAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12086,7 +12147,7 @@ async def test_set_iam_policy_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.set_iam_policy), "__call__") as call: @@ -12111,11 +12172,6 @@ async def test_set_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_set_iam_policy_async_from_dict(): - await test_set_iam_policy_async(request_type=dict) - - def test_set_iam_policy_field_headers(): client = DataCatalogClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12276,8 +12332,8 @@ async def test_set_iam_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.GetIamPolicyRequest, - dict, + iam_policy_pb2.GetIamPolicyRequest(), + {}, ], ) def test_get_iam_policy(request_type, transport: str = "grpc"): @@ -12288,7 +12344,7 @@ def test_get_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(type(client.transport.get_iam_policy), "__call__") as call: @@ -12334,9 +12390,10 @@ def test_get_iam_policy_non_empty_request_with_auto_populated_field(): client.get_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.GetIamPolicyRequest( + request_msg = iam_policy_pb2.GetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_get_iam_policy_use_cached_wrapped_rpc(): @@ -12417,9 +12474,14 @@ async def test_get_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.GetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.GetIamPolicyRequest(), + {}, + ], +) +async def test_get_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = DataCatalogAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12427,7 +12489,7 @@ async def test_get_iam_policy_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_iam_policy), "__call__") as call: @@ -12452,11 +12514,6 @@ async def test_get_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_get_iam_policy_async_from_dict(): - await test_get_iam_policy_async(request_type=dict) - - def test_get_iam_policy_field_headers(): client = DataCatalogClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12616,8 +12673,8 @@ async def test_get_iam_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.TestIamPermissionsRequest, - dict, + iam_policy_pb2.TestIamPermissionsRequest(), + {}, ], ) def test_test_iam_permissions(request_type, transport: str = "grpc"): @@ -12628,7 +12685,7 @@ def test_test_iam_permissions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -12676,9 +12733,10 @@ def test_test_iam_permissions_non_empty_request_with_auto_populated_field(): client.test_iam_permissions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.TestIamPermissionsRequest( + request_msg = iam_policy_pb2.TestIamPermissionsRequest( resource="resource_value", ) + assert args[0] == request_msg def test_test_iam_permissions_use_cached_wrapped_rpc(): @@ -12763,9 +12821,15 @@ async def test_test_iam_permissions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.TestIamPermissionsRequest(), + {}, + ], +) async def test_test_iam_permissions_async( - transport: str = "grpc_asyncio", - request_type=iam_policy_pb2.TestIamPermissionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataCatalogAsyncClient( credentials=async_anonymous_credentials(), @@ -12774,7 +12838,7 @@ async def test_test_iam_permissions_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( @@ -12799,11 +12863,6 @@ async def test_test_iam_permissions_async( assert response.permissions == ["permissions_value"] -@pytest.mark.asyncio -async def test_test_iam_permissions_async_from_dict(): - await test_test_iam_permissions_async(request_type=dict) - - def test_test_iam_permissions_field_headers(): client = DataCatalogClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12891,8 +12950,8 @@ def test_test_iam_permissions_from_dict_foreign(): @pytest.mark.parametrize( "request_type", [ - datacatalog.ImportEntriesRequest, - dict, + datacatalog.ImportEntriesRequest(), + {}, ], ) def test_import_entries(request_type, transport: str = "grpc"): @@ -12903,7 +12962,7 @@ def test_import_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.import_entries), "__call__") as call: @@ -12946,11 +13005,12 @@ def test_import_entries_non_empty_request_with_auto_populated_field(): client.import_entries(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datacatalog.ImportEntriesRequest( + request_msg = datacatalog.ImportEntriesRequest( parent="parent_value", gcs_bucket_path="gcs_bucket_path_value", job_id="job_id_value", ) + assert args[0] == request_msg def test_import_entries_use_cached_wrapped_rpc(): @@ -13041,9 +13101,14 @@ async def test_import_entries_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_import_entries_async( - transport: str = "grpc_asyncio", request_type=datacatalog.ImportEntriesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datacatalog.ImportEntriesRequest(), + {}, + ], +) +async def test_import_entries_async(request_type, transport: str = "grpc_asyncio"): client = DataCatalogAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13051,7 +13116,7 @@ async def test_import_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.import_entries), "__call__") as call: @@ -13071,11 +13136,6 @@ async def test_import_entries_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_import_entries_async_from_dict(): - await test_import_entries_async(request_type=dict) - - def test_import_entries_field_headers(): client = DataCatalogClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13140,8 +13200,8 @@ async def test_import_entries_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - datacatalog.SetConfigRequest, - dict, + datacatalog.SetConfigRequest(), + {}, ], ) def test_set_config(request_type, transport: str = "grpc"): @@ -13152,7 +13212,7 @@ def test_set_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(type(client.transport.set_config), "__call__") as call: @@ -13204,9 +13264,10 @@ def test_set_config_non_empty_request_with_auto_populated_field(): client.set_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datacatalog.SetConfigRequest( + request_msg = datacatalog.SetConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_set_config_use_cached_wrapped_rpc(): @@ -13285,9 +13346,14 @@ async def test_set_config_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_set_config_async( - transport: str = "grpc_asyncio", request_type=datacatalog.SetConfigRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datacatalog.SetConfigRequest(), + {}, + ], +) +async def test_set_config_async(request_type, transport: str = "grpc_asyncio"): client = DataCatalogAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13295,7 +13361,7 @@ async def test_set_config_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.set_config), "__call__") as call: @@ -13326,11 +13392,6 @@ async def test_set_config_async( ) -@pytest.mark.asyncio -async def test_set_config_async_from_dict(): - await test_set_config_async(request_type=dict) - - def test_set_config_field_headers(): client = DataCatalogClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13395,8 +13456,8 @@ async def test_set_config_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - datacatalog.RetrieveConfigRequest, - dict, + datacatalog.RetrieveConfigRequest(), + {}, ], ) def test_retrieve_config(request_type, transport: str = "grpc"): @@ -13407,7 +13468,7 @@ def test_retrieve_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(type(client.transport.retrieve_config), "__call__") as call: @@ -13448,9 +13509,10 @@ def test_retrieve_config_non_empty_request_with_auto_populated_field(): client.retrieve_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datacatalog.RetrieveConfigRequest( + request_msg = datacatalog.RetrieveConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_retrieve_config_use_cached_wrapped_rpc(): @@ -13531,9 +13593,14 @@ async def test_retrieve_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_retrieve_config_async( - transport: str = "grpc_asyncio", request_type=datacatalog.RetrieveConfigRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datacatalog.RetrieveConfigRequest(), + {}, + ], +) +async def test_retrieve_config_async(request_type, transport: str = "grpc_asyncio"): client = DataCatalogAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13541,7 +13608,7 @@ async def test_retrieve_config_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.retrieve_config), "__call__") as call: @@ -13561,11 +13628,6 @@ async def test_retrieve_config_async( assert isinstance(response, datacatalog.OrganizationConfig) -@pytest.mark.asyncio -async def test_retrieve_config_async_from_dict(): - await test_retrieve_config_async(request_type=dict) - - def test_retrieve_config_field_headers(): client = DataCatalogClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13630,8 +13692,8 @@ async def test_retrieve_config_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - datacatalog.RetrieveEffectiveConfigRequest, - dict, + datacatalog.RetrieveEffectiveConfigRequest(), + {}, ], ) def test_retrieve_effective_config(request_type, transport: str = "grpc"): @@ -13642,7 +13704,7 @@ def test_retrieve_effective_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( @@ -13698,9 +13760,10 @@ def test_retrieve_effective_config_non_empty_request_with_auto_populated_field() client.retrieve_effective_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datacatalog.RetrieveEffectiveConfigRequest( + request_msg = datacatalog.RetrieveEffectiveConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_retrieve_effective_config_use_cached_wrapped_rpc(): @@ -13786,9 +13849,15 @@ async def test_retrieve_effective_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + datacatalog.RetrieveEffectiveConfigRequest(), + {}, + ], +) async def test_retrieve_effective_config_async( - transport: str = "grpc_asyncio", - request_type=datacatalog.RetrieveEffectiveConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataCatalogAsyncClient( credentials=async_anonymous_credentials(), @@ -13797,7 +13866,7 @@ async def test_retrieve_effective_config_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( @@ -13830,11 +13899,6 @@ async def test_retrieve_effective_config_async( ) -@pytest.mark.asyncio -async def test_retrieve_effective_config_async_from_dict(): - await test_retrieve_effective_config_async(request_type=dict) - - def test_retrieve_effective_config_field_headers(): client = DataCatalogClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14022,7 +14086,6 @@ def test_search_catalog_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.SearchCatalogRequest() - assert args[0] == request_msg @@ -14045,7 +14108,6 @@ def test_create_entry_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.CreateEntryGroupRequest() - assert args[0] == request_msg @@ -14066,7 +14128,6 @@ def test_get_entry_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.GetEntryGroupRequest() - assert args[0] == request_msg @@ -14089,7 +14150,6 @@ def test_update_entry_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.UpdateEntryGroupRequest() - assert args[0] == request_msg @@ -14112,7 +14172,6 @@ def test_delete_entry_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.DeleteEntryGroupRequest() - assert args[0] == request_msg @@ -14135,7 +14194,6 @@ def test_list_entry_groups_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.ListEntryGroupsRequest() - assert args[0] == request_msg @@ -14156,7 +14214,6 @@ def test_create_entry_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.CreateEntryRequest() - assert args[0] == request_msg @@ -14177,7 +14234,6 @@ def test_update_entry_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.UpdateEntryRequest() - assert args[0] == request_msg @@ -14198,7 +14254,6 @@ def test_delete_entry_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.DeleteEntryRequest() - assert args[0] == request_msg @@ -14219,7 +14274,6 @@ def test_get_entry_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.GetEntryRequest() - assert args[0] == request_msg @@ -14240,7 +14294,6 @@ def test_lookup_entry_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.LookupEntryRequest() - assert args[0] == request_msg @@ -14261,7 +14314,6 @@ def test_list_entries_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.ListEntriesRequest() - assert args[0] == request_msg @@ -14284,7 +14336,6 @@ def test_modify_entry_overview_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.ModifyEntryOverviewRequest() - assert args[0] == request_msg @@ -14307,7 +14358,6 @@ def test_modify_entry_contacts_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.ModifyEntryContactsRequest() - assert args[0] == request_msg @@ -14330,7 +14380,6 @@ def test_create_tag_template_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.CreateTagTemplateRequest() - assert args[0] == request_msg @@ -14351,7 +14400,6 @@ def test_get_tag_template_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.GetTagTemplateRequest() - assert args[0] == request_msg @@ -14374,7 +14422,6 @@ def test_update_tag_template_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.UpdateTagTemplateRequest() - assert args[0] == request_msg @@ -14397,7 +14444,6 @@ def test_delete_tag_template_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.DeleteTagTemplateRequest() - assert args[0] == request_msg @@ -14420,7 +14466,6 @@ def test_create_tag_template_field_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.CreateTagTemplateFieldRequest() - assert args[0] == request_msg @@ -14443,7 +14488,6 @@ def test_update_tag_template_field_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.UpdateTagTemplateFieldRequest() - assert args[0] == request_msg @@ -14466,7 +14510,6 @@ def test_rename_tag_template_field_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.RenameTagTemplateFieldRequest() - assert args[0] == request_msg @@ -14489,7 +14532,6 @@ def test_rename_tag_template_field_enum_value_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.RenameTagTemplateFieldEnumValueRequest() - assert args[0] == request_msg @@ -14512,7 +14554,6 @@ def test_delete_tag_template_field_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.DeleteTagTemplateFieldRequest() - assert args[0] == request_msg @@ -14533,7 +14574,6 @@ def test_create_tag_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.CreateTagRequest() - assert args[0] == request_msg @@ -14554,7 +14594,6 @@ def test_update_tag_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.UpdateTagRequest() - assert args[0] == request_msg @@ -14575,7 +14614,6 @@ def test_delete_tag_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.DeleteTagRequest() - assert args[0] == request_msg @@ -14596,7 +14634,6 @@ def test_list_tags_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.ListTagsRequest() - assert args[0] == request_msg @@ -14617,7 +14654,6 @@ def test_reconcile_tags_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.ReconcileTagsRequest() - assert args[0] == request_msg @@ -14638,7 +14674,6 @@ def test_star_entry_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.StarEntryRequest() - assert args[0] == request_msg @@ -14659,7 +14694,6 @@ def test_unstar_entry_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.UnstarEntryRequest() - assert args[0] == request_msg @@ -14680,7 +14714,6 @@ def test_set_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -14701,7 +14734,6 @@ def test_get_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -14724,7 +14756,6 @@ def test_test_iam_permissions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -14745,7 +14776,6 @@ def test_import_entries_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.ImportEntriesRequest() - assert args[0] == request_msg @@ -14766,7 +14796,6 @@ def test_set_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.SetConfigRequest() - assert args[0] == request_msg @@ -14787,7 +14816,6 @@ def test_retrieve_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.RetrieveConfigRequest() - assert args[0] == request_msg @@ -14810,7 +14838,6 @@ def test_retrieve_effective_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.RetrieveEffectiveConfigRequest() - assert args[0] == request_msg @@ -14853,7 +14880,6 @@ async def test_search_catalog_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.SearchCatalogRequest() - assert args[0] == request_msg @@ -14885,7 +14911,6 @@ async def test_create_entry_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.CreateEntryGroupRequest() - assert args[0] == request_msg @@ -14915,7 +14940,6 @@ async def test_get_entry_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.GetEntryGroupRequest() - assert args[0] == request_msg @@ -14947,7 +14971,6 @@ async def test_update_entry_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.UpdateEntryGroupRequest() - assert args[0] == request_msg @@ -14972,7 +14995,6 @@ async def test_delete_entry_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.DeleteEntryGroupRequest() - assert args[0] == request_msg @@ -15001,7 +15023,6 @@ async def test_list_entry_groups_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.ListEntryGroupsRequest() - assert args[0] == request_msg @@ -15032,7 +15053,6 @@ async def test_create_entry_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.CreateEntryRequest() - assert args[0] == request_msg @@ -15063,7 +15083,6 @@ async def test_update_entry_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.UpdateEntryRequest() - assert args[0] == request_msg @@ -15086,7 +15105,6 @@ async def test_delete_entry_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.DeleteEntryRequest() - assert args[0] == request_msg @@ -15117,7 +15135,6 @@ async def test_get_entry_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.GetEntryRequest() - assert args[0] == request_msg @@ -15148,7 +15165,6 @@ async def test_lookup_entry_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.LookupEntryRequest() - assert args[0] == request_msg @@ -15175,7 +15191,6 @@ async def test_list_entries_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.ListEntriesRequest() - assert args[0] == request_msg @@ -15204,7 +15219,6 @@ async def test_modify_entry_overview_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.ModifyEntryOverviewRequest() - assert args[0] == request_msg @@ -15231,7 +15245,6 @@ async def test_modify_entry_contacts_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.ModifyEntryContactsRequest() - assert args[0] == request_msg @@ -15263,7 +15276,6 @@ async def test_create_tag_template_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.CreateTagTemplateRequest() - assert args[0] == request_msg @@ -15293,7 +15305,6 @@ async def test_get_tag_template_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.GetTagTemplateRequest() - assert args[0] == request_msg @@ -15325,7 +15336,6 @@ async def test_update_tag_template_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.UpdateTagTemplateRequest() - assert args[0] == request_msg @@ -15350,7 +15360,6 @@ async def test_delete_tag_template_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.DeleteTagTemplateRequest() - assert args[0] == request_msg @@ -15383,7 +15392,6 @@ async def test_create_tag_template_field_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.CreateTagTemplateFieldRequest() - assert args[0] == request_msg @@ -15416,7 +15424,6 @@ async def test_update_tag_template_field_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.UpdateTagTemplateFieldRequest() - assert args[0] == request_msg @@ -15449,7 +15456,6 @@ async def test_rename_tag_template_field_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.RenameTagTemplateFieldRequest() - assert args[0] == request_msg @@ -15482,7 +15488,6 @@ async def test_rename_tag_template_field_enum_value_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.RenameTagTemplateFieldEnumValueRequest() - assert args[0] == request_msg @@ -15507,7 +15512,6 @@ async def test_delete_tag_template_field_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.DeleteTagTemplateFieldRequest() - assert args[0] == request_msg @@ -15537,7 +15541,6 @@ async def test_create_tag_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.CreateTagRequest() - assert args[0] == request_msg @@ -15567,7 +15570,6 @@ async def test_update_tag_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.UpdateTagRequest() - assert args[0] == request_msg @@ -15590,7 +15592,6 @@ async def test_delete_tag_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.DeleteTagRequest() - assert args[0] == request_msg @@ -15617,7 +15618,6 @@ async def test_list_tags_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.ListTagsRequest() - assert args[0] == request_msg @@ -15642,7 +15642,6 @@ async def test_reconcile_tags_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.ReconcileTagsRequest() - assert args[0] == request_msg @@ -15667,7 +15666,6 @@ async def test_star_entry_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.StarEntryRequest() - assert args[0] == request_msg @@ -15692,7 +15690,6 @@ async def test_unstar_entry_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.UnstarEntryRequest() - assert args[0] == request_msg @@ -15720,7 +15717,6 @@ async def test_set_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -15748,7 +15744,6 @@ async def test_get_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -15777,7 +15772,6 @@ async def test_test_iam_permissions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -15802,7 +15796,6 @@ async def test_import_entries_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.ImportEntriesRequest() - assert args[0] == request_msg @@ -15830,7 +15823,6 @@ async def test_set_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.SetConfigRequest() - assert args[0] == request_msg @@ -15855,7 +15847,6 @@ async def test_retrieve_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.RetrieveConfigRequest() - assert args[0] == request_msg @@ -15885,7 +15876,6 @@ async def test_retrieve_effective_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.RetrieveEffectiveConfigRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-datacatalog/tests/unit/gapic/datacatalog_v1/test_policy_tag_manager.py b/packages/google-cloud-datacatalog/tests/unit/gapic/datacatalog_v1/test_policy_tag_manager.py index fd6ccd9544f3..694571c37b06 100644 --- a/packages/google-cloud-datacatalog/tests/unit/gapic/datacatalog_v1/test_policy_tag_manager.py +++ b/packages/google-cloud-datacatalog/tests/unit/gapic/datacatalog_v1/test_policy_tag_manager.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 @@ -116,6 +117,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" @@ -1317,8 +1333,8 @@ def test_policy_tag_manager_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - policytagmanager.CreateTaxonomyRequest, - dict, + policytagmanager.CreateTaxonomyRequest(), + {}, ], ) def test_create_taxonomy(request_type, transport: str = "grpc"): @@ -1329,7 +1345,7 @@ def test_create_taxonomy(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_taxonomy), "__call__") as call: @@ -1385,9 +1401,10 @@ def test_create_taxonomy_non_empty_request_with_auto_populated_field(): client.create_taxonomy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == policytagmanager.CreateTaxonomyRequest( + request_msg = policytagmanager.CreateTaxonomyRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_taxonomy_use_cached_wrapped_rpc(): @@ -1468,9 +1485,14 @@ async def test_create_taxonomy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_taxonomy_async( - transport: str = "grpc_asyncio", request_type=policytagmanager.CreateTaxonomyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + policytagmanager.CreateTaxonomyRequest(), + {}, + ], +) +async def test_create_taxonomy_async(request_type, transport: str = "grpc_asyncio"): client = PolicyTagManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1478,7 +1500,7 @@ async def test_create_taxonomy_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_taxonomy), "__call__") as call: @@ -1513,11 +1535,6 @@ async def test_create_taxonomy_async( ] -@pytest.mark.asyncio -async def test_create_taxonomy_async_from_dict(): - await test_create_taxonomy_async(request_type=dict) - - def test_create_taxonomy_field_headers(): client = PolicyTagManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1674,8 +1691,8 @@ async def test_create_taxonomy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - policytagmanager.DeleteTaxonomyRequest, - dict, + policytagmanager.DeleteTaxonomyRequest(), + {}, ], ) def test_delete_taxonomy(request_type, transport: str = "grpc"): @@ -1686,7 +1703,7 @@ def test_delete_taxonomy(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_taxonomy), "__call__") as call: @@ -1727,9 +1744,10 @@ def test_delete_taxonomy_non_empty_request_with_auto_populated_field(): client.delete_taxonomy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == policytagmanager.DeleteTaxonomyRequest( + request_msg = policytagmanager.DeleteTaxonomyRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_taxonomy_use_cached_wrapped_rpc(): @@ -1810,9 +1828,14 @@ async def test_delete_taxonomy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_taxonomy_async( - transport: str = "grpc_asyncio", request_type=policytagmanager.DeleteTaxonomyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + policytagmanager.DeleteTaxonomyRequest(), + {}, + ], +) +async def test_delete_taxonomy_async(request_type, transport: str = "grpc_asyncio"): client = PolicyTagManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1820,7 +1843,7 @@ async def test_delete_taxonomy_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_taxonomy), "__call__") as call: @@ -1838,11 +1861,6 @@ async def test_delete_taxonomy_async( assert response is None -@pytest.mark.asyncio -async def test_delete_taxonomy_async_from_dict(): - await test_delete_taxonomy_async(request_type=dict) - - def test_delete_taxonomy_field_headers(): client = PolicyTagManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1985,8 +2003,8 @@ async def test_delete_taxonomy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - policytagmanager.UpdateTaxonomyRequest, - dict, + policytagmanager.UpdateTaxonomyRequest(), + {}, ], ) def test_update_taxonomy(request_type, transport: str = "grpc"): @@ -1997,7 +2015,7 @@ def test_update_taxonomy(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_taxonomy), "__call__") as call: @@ -2051,7 +2069,8 @@ def test_update_taxonomy_non_empty_request_with_auto_populated_field(): client.update_taxonomy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == policytagmanager.UpdateTaxonomyRequest() + request_msg = policytagmanager.UpdateTaxonomyRequest() + assert args[0] == request_msg def test_update_taxonomy_use_cached_wrapped_rpc(): @@ -2132,9 +2151,14 @@ async def test_update_taxonomy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_taxonomy_async( - transport: str = "grpc_asyncio", request_type=policytagmanager.UpdateTaxonomyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + policytagmanager.UpdateTaxonomyRequest(), + {}, + ], +) +async def test_update_taxonomy_async(request_type, transport: str = "grpc_asyncio"): client = PolicyTagManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2142,7 +2166,7 @@ async def test_update_taxonomy_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_taxonomy), "__call__") as call: @@ -2177,11 +2201,6 @@ async def test_update_taxonomy_async( ] -@pytest.mark.asyncio -async def test_update_taxonomy_async_from_dict(): - await test_update_taxonomy_async(request_type=dict) - - def test_update_taxonomy_field_headers(): client = PolicyTagManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2328,8 +2347,8 @@ async def test_update_taxonomy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - policytagmanager.ListTaxonomiesRequest, - dict, + policytagmanager.ListTaxonomiesRequest(), + {}, ], ) def test_list_taxonomies(request_type, transport: str = "grpc"): @@ -2340,7 +2359,7 @@ def test_list_taxonomies(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_taxonomies), "__call__") as call: @@ -2386,11 +2405,12 @@ def test_list_taxonomies_non_empty_request_with_auto_populated_field(): client.list_taxonomies(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == policytagmanager.ListTaxonomiesRequest( + request_msg = policytagmanager.ListTaxonomiesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_taxonomies_use_cached_wrapped_rpc(): @@ -2471,9 +2491,14 @@ async def test_list_taxonomies_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_taxonomies_async( - transport: str = "grpc_asyncio", request_type=policytagmanager.ListTaxonomiesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + policytagmanager.ListTaxonomiesRequest(), + {}, + ], +) +async def test_list_taxonomies_async(request_type, transport: str = "grpc_asyncio"): client = PolicyTagManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2481,7 +2506,7 @@ async def test_list_taxonomies_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_taxonomies), "__call__") as call: @@ -2504,11 +2529,6 @@ async def test_list_taxonomies_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_taxonomies_async_from_dict(): - await test_list_taxonomies_async(request_type=dict) - - def test_list_taxonomies_field_headers(): client = PolicyTagManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2845,8 +2865,8 @@ async def test_list_taxonomies_async_pages(): @pytest.mark.parametrize( "request_type", [ - policytagmanager.GetTaxonomyRequest, - dict, + policytagmanager.GetTaxonomyRequest(), + {}, ], ) def test_get_taxonomy(request_type, transport: str = "grpc"): @@ -2857,7 +2877,7 @@ def test_get_taxonomy(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_taxonomy), "__call__") as call: @@ -2913,9 +2933,10 @@ def test_get_taxonomy_non_empty_request_with_auto_populated_field(): client.get_taxonomy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == policytagmanager.GetTaxonomyRequest( + request_msg = policytagmanager.GetTaxonomyRequest( name="name_value", ) + assert args[0] == request_msg def test_get_taxonomy_use_cached_wrapped_rpc(): @@ -2996,9 +3017,14 @@ async def test_get_taxonomy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_taxonomy_async( - transport: str = "grpc_asyncio", request_type=policytagmanager.GetTaxonomyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + policytagmanager.GetTaxonomyRequest(), + {}, + ], +) +async def test_get_taxonomy_async(request_type, transport: str = "grpc_asyncio"): client = PolicyTagManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3006,7 +3032,7 @@ async def test_get_taxonomy_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_taxonomy), "__call__") as call: @@ -3041,11 +3067,6 @@ async def test_get_taxonomy_async( ] -@pytest.mark.asyncio -async def test_get_taxonomy_async_from_dict(): - await test_get_taxonomy_async(request_type=dict) - - def test_get_taxonomy_field_headers(): client = PolicyTagManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3192,8 +3213,8 @@ async def test_get_taxonomy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - policytagmanager.CreatePolicyTagRequest, - dict, + policytagmanager.CreatePolicyTagRequest(), + {}, ], ) def test_create_policy_tag(request_type, transport: str = "grpc"): @@ -3204,7 +3225,7 @@ def test_create_policy_tag(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3260,9 +3281,10 @@ def test_create_policy_tag_non_empty_request_with_auto_populated_field(): client.create_policy_tag(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == policytagmanager.CreatePolicyTagRequest( + request_msg = policytagmanager.CreatePolicyTagRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_policy_tag_use_cached_wrapped_rpc(): @@ -3345,10 +3367,14 @@ async def test_create_policy_tag_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_policy_tag_async( - transport: str = "grpc_asyncio", - request_type=policytagmanager.CreatePolicyTagRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + policytagmanager.CreatePolicyTagRequest(), + {}, + ], +) +async def test_create_policy_tag_async(request_type, transport: str = "grpc_asyncio"): client = PolicyTagManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3356,7 +3382,7 @@ async def test_create_policy_tag_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( @@ -3389,11 +3415,6 @@ async def test_create_policy_tag_async( assert response.child_policy_tags == ["child_policy_tags_value"] -@pytest.mark.asyncio -async def test_create_policy_tag_async_from_dict(): - await test_create_policy_tag_async(request_type=dict) - - def test_create_policy_tag_field_headers(): client = PolicyTagManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3558,8 +3579,8 @@ async def test_create_policy_tag_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - policytagmanager.DeletePolicyTagRequest, - dict, + policytagmanager.DeletePolicyTagRequest(), + {}, ], ) def test_delete_policy_tag(request_type, transport: str = "grpc"): @@ -3570,7 +3591,7 @@ def test_delete_policy_tag(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3615,9 +3636,10 @@ def test_delete_policy_tag_non_empty_request_with_auto_populated_field(): client.delete_policy_tag(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == policytagmanager.DeletePolicyTagRequest( + request_msg = policytagmanager.DeletePolicyTagRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_policy_tag_use_cached_wrapped_rpc(): @@ -3700,10 +3722,14 @@ async def test_delete_policy_tag_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_policy_tag_async( - transport: str = "grpc_asyncio", - request_type=policytagmanager.DeletePolicyTagRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + policytagmanager.DeletePolicyTagRequest(), + {}, + ], +) +async def test_delete_policy_tag_async(request_type, transport: str = "grpc_asyncio"): client = PolicyTagManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3711,7 +3737,7 @@ async def test_delete_policy_tag_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( @@ -3731,11 +3757,6 @@ async def test_delete_policy_tag_async( assert response is None -@pytest.mark.asyncio -async def test_delete_policy_tag_async_from_dict(): - await test_delete_policy_tag_async(request_type=dict) - - def test_delete_policy_tag_field_headers(): client = PolicyTagManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3886,8 +3907,8 @@ async def test_delete_policy_tag_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - policytagmanager.UpdatePolicyTagRequest, - dict, + policytagmanager.UpdatePolicyTagRequest(), + {}, ], ) def test_update_policy_tag(request_type, transport: str = "grpc"): @@ -3898,7 +3919,7 @@ def test_update_policy_tag(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3952,7 +3973,8 @@ def test_update_policy_tag_non_empty_request_with_auto_populated_field(): client.update_policy_tag(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == policytagmanager.UpdatePolicyTagRequest() + request_msg = policytagmanager.UpdatePolicyTagRequest() + assert args[0] == request_msg def test_update_policy_tag_use_cached_wrapped_rpc(): @@ -4035,10 +4057,14 @@ async def test_update_policy_tag_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_policy_tag_async( - transport: str = "grpc_asyncio", - request_type=policytagmanager.UpdatePolicyTagRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + policytagmanager.UpdatePolicyTagRequest(), + {}, + ], +) +async def test_update_policy_tag_async(request_type, transport: str = "grpc_asyncio"): client = PolicyTagManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4046,7 +4072,7 @@ async def test_update_policy_tag_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( @@ -4079,11 +4105,6 @@ async def test_update_policy_tag_async( assert response.child_policy_tags == ["child_policy_tags_value"] -@pytest.mark.asyncio -async def test_update_policy_tag_async_from_dict(): - await test_update_policy_tag_async(request_type=dict) - - def test_update_policy_tag_field_headers(): client = PolicyTagManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4238,8 +4259,8 @@ async def test_update_policy_tag_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - policytagmanager.ListPolicyTagsRequest, - dict, + policytagmanager.ListPolicyTagsRequest(), + {}, ], ) def test_list_policy_tags(request_type, transport: str = "grpc"): @@ -4250,7 +4271,7 @@ def test_list_policy_tags(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_policy_tags), "__call__") as call: @@ -4295,10 +4316,11 @@ def test_list_policy_tags_non_empty_request_with_auto_populated_field(): client.list_policy_tags(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == policytagmanager.ListPolicyTagsRequest( + request_msg = policytagmanager.ListPolicyTagsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_policy_tags_use_cached_wrapped_rpc(): @@ -4381,9 +4403,14 @@ async def test_list_policy_tags_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_policy_tags_async( - transport: str = "grpc_asyncio", request_type=policytagmanager.ListPolicyTagsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + policytagmanager.ListPolicyTagsRequest(), + {}, + ], +) +async def test_list_policy_tags_async(request_type, transport: str = "grpc_asyncio"): client = PolicyTagManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4391,7 +4418,7 @@ async def test_list_policy_tags_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_policy_tags), "__call__") as call: @@ -4414,11 +4441,6 @@ async def test_list_policy_tags_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_policy_tags_async_from_dict(): - await test_list_policy_tags_async(request_type=dict) - - def test_list_policy_tags_field_headers(): client = PolicyTagManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4755,8 +4777,8 @@ async def test_list_policy_tags_async_pages(): @pytest.mark.parametrize( "request_type", [ - policytagmanager.GetPolicyTagRequest, - dict, + policytagmanager.GetPolicyTagRequest(), + {}, ], ) def test_get_policy_tag(request_type, transport: str = "grpc"): @@ -4767,7 +4789,7 @@ def test_get_policy_tag(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_policy_tag), "__call__") as call: @@ -4819,9 +4841,10 @@ def test_get_policy_tag_non_empty_request_with_auto_populated_field(): client.get_policy_tag(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == policytagmanager.GetPolicyTagRequest( + request_msg = policytagmanager.GetPolicyTagRequest( name="name_value", ) + assert args[0] == request_msg def test_get_policy_tag_use_cached_wrapped_rpc(): @@ -4902,9 +4925,14 @@ async def test_get_policy_tag_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_policy_tag_async( - transport: str = "grpc_asyncio", request_type=policytagmanager.GetPolicyTagRequest -): +@pytest.mark.parametrize( + "request_type", + [ + policytagmanager.GetPolicyTagRequest(), + {}, + ], +) +async def test_get_policy_tag_async(request_type, transport: str = "grpc_asyncio"): client = PolicyTagManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4912,7 +4940,7 @@ async def test_get_policy_tag_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_policy_tag), "__call__") as call: @@ -4943,11 +4971,6 @@ async def test_get_policy_tag_async( assert response.child_policy_tags == ["child_policy_tags_value"] -@pytest.mark.asyncio -async def test_get_policy_tag_async_from_dict(): - await test_get_policy_tag_async(request_type=dict) - - def test_get_policy_tag_field_headers(): client = PolicyTagManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5094,8 +5117,8 @@ async def test_get_policy_tag_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.GetIamPolicyRequest, - dict, + iam_policy_pb2.GetIamPolicyRequest(), + {}, ], ) def test_get_iam_policy(request_type, transport: str = "grpc"): @@ -5106,7 +5129,7 @@ def test_get_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(type(client.transport.get_iam_policy), "__call__") as call: @@ -5152,9 +5175,10 @@ def test_get_iam_policy_non_empty_request_with_auto_populated_field(): client.get_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.GetIamPolicyRequest( + request_msg = iam_policy_pb2.GetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_get_iam_policy_use_cached_wrapped_rpc(): @@ -5235,9 +5259,14 @@ async def test_get_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.GetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.GetIamPolicyRequest(), + {}, + ], +) +async def test_get_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = PolicyTagManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5245,7 +5274,7 @@ async def test_get_iam_policy_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_iam_policy), "__call__") as call: @@ -5270,11 +5299,6 @@ async def test_get_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_get_iam_policy_async_from_dict(): - await test_get_iam_policy_async(request_type=dict) - - def test_get_iam_policy_field_headers(): client = PolicyTagManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5354,8 +5378,8 @@ def test_get_iam_policy_from_dict_foreign(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.SetIamPolicyRequest, - dict, + iam_policy_pb2.SetIamPolicyRequest(), + {}, ], ) def test_set_iam_policy(request_type, transport: str = "grpc"): @@ -5366,7 +5390,7 @@ def test_set_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(type(client.transport.set_iam_policy), "__call__") as call: @@ -5412,9 +5436,10 @@ def test_set_iam_policy_non_empty_request_with_auto_populated_field(): client.set_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.SetIamPolicyRequest( + request_msg = iam_policy_pb2.SetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_set_iam_policy_use_cached_wrapped_rpc(): @@ -5495,9 +5520,14 @@ async def test_set_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.SetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.SetIamPolicyRequest(), + {}, + ], +) +async def test_set_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = PolicyTagManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5505,7 +5535,7 @@ async def test_set_iam_policy_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.set_iam_policy), "__call__") as call: @@ -5530,11 +5560,6 @@ async def test_set_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_set_iam_policy_async_from_dict(): - await test_set_iam_policy_async(request_type=dict) - - def test_set_iam_policy_field_headers(): client = PolicyTagManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5615,8 +5640,8 @@ def test_set_iam_policy_from_dict_foreign(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.TestIamPermissionsRequest, - dict, + iam_policy_pb2.TestIamPermissionsRequest(), + {}, ], ) def test_test_iam_permissions(request_type, transport: str = "grpc"): @@ -5627,7 +5652,7 @@ def test_test_iam_permissions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5675,9 +5700,10 @@ def test_test_iam_permissions_non_empty_request_with_auto_populated_field(): client.test_iam_permissions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.TestIamPermissionsRequest( + request_msg = iam_policy_pb2.TestIamPermissionsRequest( resource="resource_value", ) + assert args[0] == request_msg def test_test_iam_permissions_use_cached_wrapped_rpc(): @@ -5762,9 +5788,15 @@ async def test_test_iam_permissions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.TestIamPermissionsRequest(), + {}, + ], +) async def test_test_iam_permissions_async( - transport: str = "grpc_asyncio", - request_type=iam_policy_pb2.TestIamPermissionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = PolicyTagManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -5773,7 +5805,7 @@ async def test_test_iam_permissions_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( @@ -5798,11 +5830,6 @@ async def test_test_iam_permissions_async( assert response.permissions == ["permissions_value"] -@pytest.mark.asyncio -async def test_test_iam_permissions_async_from_dict(): - await test_test_iam_permissions_async(request_type=dict) - - def test_test_iam_permissions_field_headers(): client = PolicyTagManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6009,7 +6036,6 @@ def test_create_taxonomy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policytagmanager.CreateTaxonomyRequest() - assert args[0] == request_msg @@ -6030,7 +6056,6 @@ def test_delete_taxonomy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policytagmanager.DeleteTaxonomyRequest() - assert args[0] == request_msg @@ -6051,7 +6076,6 @@ def test_update_taxonomy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policytagmanager.UpdateTaxonomyRequest() - assert args[0] == request_msg @@ -6072,7 +6096,6 @@ def test_list_taxonomies_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policytagmanager.ListTaxonomiesRequest() - assert args[0] == request_msg @@ -6093,7 +6116,6 @@ def test_get_taxonomy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policytagmanager.GetTaxonomyRequest() - assert args[0] == request_msg @@ -6116,7 +6138,6 @@ def test_create_policy_tag_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policytagmanager.CreatePolicyTagRequest() - assert args[0] == request_msg @@ -6139,7 +6160,6 @@ def test_delete_policy_tag_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policytagmanager.DeletePolicyTagRequest() - assert args[0] == request_msg @@ -6162,7 +6182,6 @@ def test_update_policy_tag_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policytagmanager.UpdatePolicyTagRequest() - assert args[0] == request_msg @@ -6183,7 +6202,6 @@ def test_list_policy_tags_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policytagmanager.ListPolicyTagsRequest() - assert args[0] == request_msg @@ -6204,7 +6222,6 @@ def test_get_policy_tag_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policytagmanager.GetPolicyTagRequest() - assert args[0] == request_msg @@ -6225,7 +6242,6 @@ def test_get_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -6246,7 +6262,6 @@ def test_set_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -6269,7 +6284,6 @@ def test_test_iam_permissions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -6316,7 +6330,6 @@ async def test_create_taxonomy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policytagmanager.CreateTaxonomyRequest() - assert args[0] == request_msg @@ -6339,7 +6352,6 @@ async def test_delete_taxonomy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policytagmanager.DeleteTaxonomyRequest() - assert args[0] == request_msg @@ -6372,7 +6384,6 @@ async def test_update_taxonomy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policytagmanager.UpdateTaxonomyRequest() - assert args[0] == request_msg @@ -6399,7 +6410,6 @@ async def test_list_taxonomies_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policytagmanager.ListTaxonomiesRequest() - assert args[0] == request_msg @@ -6432,7 +6442,6 @@ async def test_get_taxonomy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policytagmanager.GetTaxonomyRequest() - assert args[0] == request_msg @@ -6465,7 +6474,6 @@ async def test_create_policy_tag_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policytagmanager.CreatePolicyTagRequest() - assert args[0] == request_msg @@ -6490,7 +6498,6 @@ async def test_delete_policy_tag_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policytagmanager.DeletePolicyTagRequest() - assert args[0] == request_msg @@ -6523,7 +6530,6 @@ async def test_update_policy_tag_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policytagmanager.UpdatePolicyTagRequest() - assert args[0] == request_msg @@ -6550,7 +6556,6 @@ async def test_list_policy_tags_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policytagmanager.ListPolicyTagsRequest() - assert args[0] == request_msg @@ -6581,7 +6586,6 @@ async def test_get_policy_tag_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policytagmanager.GetPolicyTagRequest() - assert args[0] == request_msg @@ -6609,7 +6613,6 @@ async def test_get_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -6637,7 +6640,6 @@ async def test_set_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -6666,7 +6668,6 @@ async def test_test_iam_permissions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-datacatalog/tests/unit/gapic/datacatalog_v1/test_policy_tag_manager_serialization.py b/packages/google-cloud-datacatalog/tests/unit/gapic/datacatalog_v1/test_policy_tag_manager_serialization.py index 8b06e557ec7d..85be24775762 100644 --- a/packages/google-cloud-datacatalog/tests/unit/gapic/datacatalog_v1/test_policy_tag_manager_serialization.py +++ b/packages/google-cloud-datacatalog/tests/unit/gapic/datacatalog_v1/test_policy_tag_manager_serialization.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 @@ -113,6 +114,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" @@ -1394,8 +1410,8 @@ def test_policy_tag_manager_serialization_client_create_channel_credentials_file @pytest.mark.parametrize( "request_type", [ - policytagmanagerserialization.ReplaceTaxonomyRequest, - dict, + policytagmanagerserialization.ReplaceTaxonomyRequest(), + {}, ], ) def test_replace_taxonomy(request_type, transport: str = "grpc"): @@ -1406,7 +1422,7 @@ def test_replace_taxonomy(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.replace_taxonomy), "__call__") as call: @@ -1462,9 +1478,10 @@ def test_replace_taxonomy_non_empty_request_with_auto_populated_field(): client.replace_taxonomy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == policytagmanagerserialization.ReplaceTaxonomyRequest( + request_msg = policytagmanagerserialization.ReplaceTaxonomyRequest( name="name_value", ) + assert args[0] == request_msg def test_replace_taxonomy_use_cached_wrapped_rpc(): @@ -1547,10 +1564,14 @@ async def test_replace_taxonomy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_replace_taxonomy_async( - transport: str = "grpc_asyncio", - request_type=policytagmanagerserialization.ReplaceTaxonomyRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + policytagmanagerserialization.ReplaceTaxonomyRequest(), + {}, + ], +) +async def test_replace_taxonomy_async(request_type, transport: str = "grpc_asyncio"): client = PolicyTagManagerSerializationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1558,7 +1579,7 @@ async def test_replace_taxonomy_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.replace_taxonomy), "__call__") as call: @@ -1593,11 +1614,6 @@ async def test_replace_taxonomy_async( ] -@pytest.mark.asyncio -async def test_replace_taxonomy_async_from_dict(): - await test_replace_taxonomy_async(request_type=dict) - - def test_replace_taxonomy_field_headers(): client = PolicyTagManagerSerializationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1662,8 +1678,8 @@ async def test_replace_taxonomy_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - policytagmanagerserialization.ImportTaxonomiesRequest, - dict, + policytagmanagerserialization.ImportTaxonomiesRequest(), + {}, ], ) def test_import_taxonomies(request_type, transport: str = "grpc"): @@ -1674,7 +1690,7 @@ def test_import_taxonomies(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1719,9 +1735,10 @@ def test_import_taxonomies_non_empty_request_with_auto_populated_field(): client.import_taxonomies(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == policytagmanagerserialization.ImportTaxonomiesRequest( + request_msg = policytagmanagerserialization.ImportTaxonomiesRequest( parent="parent_value", ) + assert args[0] == request_msg def test_import_taxonomies_use_cached_wrapped_rpc(): @@ -1804,10 +1821,14 @@ async def test_import_taxonomies_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_import_taxonomies_async( - transport: str = "grpc_asyncio", - request_type=policytagmanagerserialization.ImportTaxonomiesRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + policytagmanagerserialization.ImportTaxonomiesRequest(), + {}, + ], +) +async def test_import_taxonomies_async(request_type, transport: str = "grpc_asyncio"): client = PolicyTagManagerSerializationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1815,7 +1836,7 @@ async def test_import_taxonomies_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( @@ -1837,11 +1858,6 @@ async def test_import_taxonomies_async( assert isinstance(response, policytagmanagerserialization.ImportTaxonomiesResponse) -@pytest.mark.asyncio -async def test_import_taxonomies_async_from_dict(): - await test_import_taxonomies_async(request_type=dict) - - def test_import_taxonomies_field_headers(): client = PolicyTagManagerSerializationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1910,8 +1926,8 @@ async def test_import_taxonomies_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - policytagmanagerserialization.ExportTaxonomiesRequest, - dict, + policytagmanagerserialization.ExportTaxonomiesRequest(), + {}, ], ) def test_export_taxonomies(request_type, transport: str = "grpc"): @@ -1922,7 +1938,7 @@ def test_export_taxonomies(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1967,9 +1983,10 @@ def test_export_taxonomies_non_empty_request_with_auto_populated_field(): client.export_taxonomies(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == policytagmanagerserialization.ExportTaxonomiesRequest( + request_msg = policytagmanagerserialization.ExportTaxonomiesRequest( parent="parent_value", ) + assert args[0] == request_msg def test_export_taxonomies_use_cached_wrapped_rpc(): @@ -2052,10 +2069,14 @@ async def test_export_taxonomies_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_export_taxonomies_async( - transport: str = "grpc_asyncio", - request_type=policytagmanagerserialization.ExportTaxonomiesRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + policytagmanagerserialization.ExportTaxonomiesRequest(), + {}, + ], +) +async def test_export_taxonomies_async(request_type, transport: str = "grpc_asyncio"): client = PolicyTagManagerSerializationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2063,7 +2084,7 @@ async def test_export_taxonomies_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( @@ -2085,11 +2106,6 @@ async def test_export_taxonomies_async( assert isinstance(response, policytagmanagerserialization.ExportTaxonomiesResponse) -@pytest.mark.asyncio -async def test_export_taxonomies_async_from_dict(): - await test_export_taxonomies_async(request_type=dict) - - def test_export_taxonomies_field_headers(): client = PolicyTagManagerSerializationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2277,7 +2293,6 @@ def test_replace_taxonomy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policytagmanagerserialization.ReplaceTaxonomyRequest() - assert args[0] == request_msg @@ -2300,7 +2315,6 @@ def test_import_taxonomies_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policytagmanagerserialization.ImportTaxonomiesRequest() - assert args[0] == request_msg @@ -2323,7 +2337,6 @@ def test_export_taxonomies_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policytagmanagerserialization.ExportTaxonomiesRequest() - assert args[0] == request_msg @@ -2370,7 +2383,6 @@ async def test_replace_taxonomy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policytagmanagerserialization.ReplaceTaxonomyRequest() - assert args[0] == request_msg @@ -2397,7 +2409,6 @@ async def test_import_taxonomies_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policytagmanagerserialization.ImportTaxonomiesRequest() - assert args[0] == request_msg @@ -2424,7 +2435,6 @@ async def test_export_taxonomies_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policytagmanagerserialization.ExportTaxonomiesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-datacatalog/tests/unit/gapic/datacatalog_v1beta1/test_data_catalog.py b/packages/google-cloud-datacatalog/tests/unit/gapic/datacatalog_v1beta1/test_data_catalog.py index db92d24a58f5..00a5a6d41db3 100644 --- a/packages/google-cloud-datacatalog/tests/unit/gapic/datacatalog_v1beta1/test_data_catalog.py +++ b/packages/google-cloud-datacatalog/tests/unit/gapic/datacatalog_v1beta1/test_data_catalog.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 @@ -126,6 +127,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" @@ -1274,8 +1290,8 @@ def test_data_catalog_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - datacatalog.SearchCatalogRequest, - dict, + datacatalog.SearchCatalogRequest(), + {}, ], ) def test_search_catalog(request_type, transport: str = "grpc"): @@ -1286,7 +1302,7 @@ def test_search_catalog(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.search_catalog), "__call__") as call: @@ -1336,11 +1352,12 @@ def test_search_catalog_non_empty_request_with_auto_populated_field(): client.search_catalog(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datacatalog.SearchCatalogRequest( + request_msg = datacatalog.SearchCatalogRequest( query="query_value", page_token="page_token_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_search_catalog_use_cached_wrapped_rpc(): @@ -1421,9 +1438,14 @@ async def test_search_catalog_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_search_catalog_async( - transport: str = "grpc_asyncio", request_type=datacatalog.SearchCatalogRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datacatalog.SearchCatalogRequest(), + {}, + ], +) +async def test_search_catalog_async(request_type, transport: str = "grpc_asyncio"): client = DataCatalogAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1431,7 +1453,7 @@ async def test_search_catalog_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.search_catalog), "__call__") as call: @@ -1458,11 +1480,6 @@ async def test_search_catalog_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_search_catalog_async_from_dict(): - await test_search_catalog_async(request_type=dict) - - def test_search_catalog_flattened(): client = DataCatalogClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1757,8 +1774,8 @@ async def test_search_catalog_async_pages(): @pytest.mark.parametrize( "request_type", [ - datacatalog.CreateEntryGroupRequest, - dict, + datacatalog.CreateEntryGroupRequest(), + {}, ], ) def test_create_entry_group(request_type, transport: str = "grpc"): @@ -1769,7 +1786,7 @@ def test_create_entry_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1822,10 +1839,11 @@ def test_create_entry_group_non_empty_request_with_auto_populated_field(): client.create_entry_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datacatalog.CreateEntryGroupRequest( + request_msg = datacatalog.CreateEntryGroupRequest( parent="parent_value", entry_group_id="entry_group_id_value", ) + assert args[0] == request_msg def test_create_entry_group_use_cached_wrapped_rpc(): @@ -1910,9 +1928,14 @@ async def test_create_entry_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_entry_group_async( - transport: str = "grpc_asyncio", request_type=datacatalog.CreateEntryGroupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datacatalog.CreateEntryGroupRequest(), + {}, + ], +) +async def test_create_entry_group_async(request_type, transport: str = "grpc_asyncio"): client = DataCatalogAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1920,7 +1943,7 @@ async def test_create_entry_group_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( @@ -1949,11 +1972,6 @@ async def test_create_entry_group_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_create_entry_group_async_from_dict(): - await test_create_entry_group_async(request_type=dict) - - def test_create_entry_group_field_headers(): client = DataCatalogClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2128,8 +2146,8 @@ async def test_create_entry_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datacatalog.UpdateEntryGroupRequest, - dict, + datacatalog.UpdateEntryGroupRequest(), + {}, ], ) def test_update_entry_group(request_type, transport: str = "grpc"): @@ -2140,7 +2158,7 @@ def test_update_entry_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2190,7 +2208,8 @@ def test_update_entry_group_non_empty_request_with_auto_populated_field(): client.update_entry_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datacatalog.UpdateEntryGroupRequest() + request_msg = datacatalog.UpdateEntryGroupRequest() + assert args[0] == request_msg def test_update_entry_group_use_cached_wrapped_rpc(): @@ -2275,9 +2294,14 @@ async def test_update_entry_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_entry_group_async( - transport: str = "grpc_asyncio", request_type=datacatalog.UpdateEntryGroupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datacatalog.UpdateEntryGroupRequest(), + {}, + ], +) +async def test_update_entry_group_async(request_type, transport: str = "grpc_asyncio"): client = DataCatalogAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2285,7 +2309,7 @@ async def test_update_entry_group_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( @@ -2314,11 +2338,6 @@ async def test_update_entry_group_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_update_entry_group_async_from_dict(): - await test_update_entry_group_async(request_type=dict) - - def test_update_entry_group_field_headers(): client = DataCatalogClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2483,8 +2502,8 @@ async def test_update_entry_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datacatalog.GetEntryGroupRequest, - dict, + datacatalog.GetEntryGroupRequest(), + {}, ], ) def test_get_entry_group(request_type, transport: str = "grpc"): @@ -2495,7 +2514,7 @@ def test_get_entry_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_entry_group), "__call__") as call: @@ -2543,9 +2562,10 @@ def test_get_entry_group_non_empty_request_with_auto_populated_field(): client.get_entry_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datacatalog.GetEntryGroupRequest( + request_msg = datacatalog.GetEntryGroupRequest( name="name_value", ) + assert args[0] == request_msg def test_get_entry_group_use_cached_wrapped_rpc(): @@ -2626,9 +2646,14 @@ async def test_get_entry_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_entry_group_async( - transport: str = "grpc_asyncio", request_type=datacatalog.GetEntryGroupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datacatalog.GetEntryGroupRequest(), + {}, + ], +) +async def test_get_entry_group_async(request_type, transport: str = "grpc_asyncio"): client = DataCatalogAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2636,7 +2661,7 @@ async def test_get_entry_group_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_entry_group), "__call__") as call: @@ -2663,11 +2688,6 @@ async def test_get_entry_group_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_get_entry_group_async_from_dict(): - await test_get_entry_group_async(request_type=dict) - - def test_get_entry_group_field_headers(): client = DataCatalogClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2824,8 +2844,8 @@ async def test_get_entry_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datacatalog.DeleteEntryGroupRequest, - dict, + datacatalog.DeleteEntryGroupRequest(), + {}, ], ) def test_delete_entry_group(request_type, transport: str = "grpc"): @@ -2836,7 +2856,7 @@ def test_delete_entry_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2881,9 +2901,10 @@ def test_delete_entry_group_non_empty_request_with_auto_populated_field(): client.delete_entry_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datacatalog.DeleteEntryGroupRequest( + request_msg = datacatalog.DeleteEntryGroupRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_entry_group_use_cached_wrapped_rpc(): @@ -2968,9 +2989,14 @@ async def test_delete_entry_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_entry_group_async( - transport: str = "grpc_asyncio", request_type=datacatalog.DeleteEntryGroupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datacatalog.DeleteEntryGroupRequest(), + {}, + ], +) +async def test_delete_entry_group_async(request_type, transport: str = "grpc_asyncio"): client = DataCatalogAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2978,7 +3004,7 @@ async def test_delete_entry_group_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( @@ -2998,11 +3024,6 @@ async def test_delete_entry_group_async( assert response is None -@pytest.mark.asyncio -async def test_delete_entry_group_async_from_dict(): - await test_delete_entry_group_async(request_type=dict) - - def test_delete_entry_group_field_headers(): client = DataCatalogClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3153,8 +3174,8 @@ async def test_delete_entry_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datacatalog.ListEntryGroupsRequest, - dict, + datacatalog.ListEntryGroupsRequest(), + {}, ], ) def test_list_entry_groups(request_type, transport: str = "grpc"): @@ -3165,7 +3186,7 @@ def test_list_entry_groups(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3214,10 +3235,11 @@ def test_list_entry_groups_non_empty_request_with_auto_populated_field(): client.list_entry_groups(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datacatalog.ListEntryGroupsRequest( + request_msg = datacatalog.ListEntryGroupsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_entry_groups_use_cached_wrapped_rpc(): @@ -3300,9 +3322,14 @@ async def test_list_entry_groups_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_entry_groups_async( - transport: str = "grpc_asyncio", request_type=datacatalog.ListEntryGroupsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datacatalog.ListEntryGroupsRequest(), + {}, + ], +) +async def test_list_entry_groups_async(request_type, transport: str = "grpc_asyncio"): client = DataCatalogAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3310,7 +3337,7 @@ async def test_list_entry_groups_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( @@ -3335,11 +3362,6 @@ async def test_list_entry_groups_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_entry_groups_async_from_dict(): - await test_list_entry_groups_async(request_type=dict) - - def test_list_entry_groups_field_headers(): client = DataCatalogClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3692,8 +3714,8 @@ async def test_list_entry_groups_async_pages(): @pytest.mark.parametrize( "request_type", [ - datacatalog.CreateEntryRequest, - dict, + datacatalog.CreateEntryRequest(), + {}, ], ) def test_create_entry(request_type, transport: str = "grpc"): @@ -3704,7 +3726,7 @@ def test_create_entry(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_entry), "__call__") as call: @@ -3757,10 +3779,11 @@ def test_create_entry_non_empty_request_with_auto_populated_field(): client.create_entry(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datacatalog.CreateEntryRequest( + request_msg = datacatalog.CreateEntryRequest( parent="parent_value", entry_id="entry_id_value", ) + assert args[0] == request_msg def test_create_entry_use_cached_wrapped_rpc(): @@ -3841,9 +3864,14 @@ async def test_create_entry_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_entry_async( - transport: str = "grpc_asyncio", request_type=datacatalog.CreateEntryRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datacatalog.CreateEntryRequest(), + {}, + ], +) +async def test_create_entry_async(request_type, transport: str = "grpc_asyncio"): client = DataCatalogAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3851,7 +3879,7 @@ async def test_create_entry_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_entry), "__call__") as call: @@ -3880,11 +3908,6 @@ async def test_create_entry_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_create_entry_async_from_dict(): - await test_create_entry_async(request_type=dict) - - def test_create_entry_field_headers(): client = DataCatalogClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4047,8 +4070,8 @@ async def test_create_entry_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datacatalog.UpdateEntryRequest, - dict, + datacatalog.UpdateEntryRequest(), + {}, ], ) def test_update_entry(request_type, transport: str = "grpc"): @@ -4059,7 +4082,7 @@ def test_update_entry(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_entry), "__call__") as call: @@ -4109,7 +4132,8 @@ def test_update_entry_non_empty_request_with_auto_populated_field(): client.update_entry(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datacatalog.UpdateEntryRequest() + request_msg = datacatalog.UpdateEntryRequest() + assert args[0] == request_msg def test_update_entry_use_cached_wrapped_rpc(): @@ -4190,9 +4214,14 @@ async def test_update_entry_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_entry_async( - transport: str = "grpc_asyncio", request_type=datacatalog.UpdateEntryRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datacatalog.UpdateEntryRequest(), + {}, + ], +) +async def test_update_entry_async(request_type, transport: str = "grpc_asyncio"): client = DataCatalogAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4200,7 +4229,7 @@ async def test_update_entry_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_entry), "__call__") as call: @@ -4229,11 +4258,6 @@ async def test_update_entry_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_update_entry_async_from_dict(): - await test_update_entry_async(request_type=dict) - - def test_update_entry_field_headers(): client = DataCatalogClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4386,8 +4410,8 @@ async def test_update_entry_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datacatalog.DeleteEntryRequest, - dict, + datacatalog.DeleteEntryRequest(), + {}, ], ) def test_delete_entry(request_type, transport: str = "grpc"): @@ -4398,7 +4422,7 @@ def test_delete_entry(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_entry), "__call__") as call: @@ -4439,9 +4463,10 @@ def test_delete_entry_non_empty_request_with_auto_populated_field(): client.delete_entry(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datacatalog.DeleteEntryRequest( + request_msg = datacatalog.DeleteEntryRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_entry_use_cached_wrapped_rpc(): @@ -4522,9 +4547,14 @@ async def test_delete_entry_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_entry_async( - transport: str = "grpc_asyncio", request_type=datacatalog.DeleteEntryRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datacatalog.DeleteEntryRequest(), + {}, + ], +) +async def test_delete_entry_async(request_type, transport: str = "grpc_asyncio"): client = DataCatalogAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4532,7 +4562,7 @@ async def test_delete_entry_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_entry), "__call__") as call: @@ -4550,11 +4580,6 @@ async def test_delete_entry_async( assert response is None -@pytest.mark.asyncio -async def test_delete_entry_async_from_dict(): - await test_delete_entry_async(request_type=dict) - - def test_delete_entry_field_headers(): client = DataCatalogClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4697,8 +4722,8 @@ async def test_delete_entry_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datacatalog.GetEntryRequest, - dict, + datacatalog.GetEntryRequest(), + {}, ], ) def test_get_entry(request_type, transport: str = "grpc"): @@ -4709,7 +4734,7 @@ def test_get_entry(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_entry), "__call__") as call: @@ -4761,9 +4786,10 @@ def test_get_entry_non_empty_request_with_auto_populated_field(): client.get_entry(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datacatalog.GetEntryRequest( + request_msg = datacatalog.GetEntryRequest( name="name_value", ) + assert args[0] == request_msg def test_get_entry_use_cached_wrapped_rpc(): @@ -4842,9 +4868,14 @@ async def test_get_entry_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_entry_async( - transport: str = "grpc_asyncio", request_type=datacatalog.GetEntryRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datacatalog.GetEntryRequest(), + {}, + ], +) +async def test_get_entry_async(request_type, transport: str = "grpc_asyncio"): client = DataCatalogAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4852,7 +4883,7 @@ async def test_get_entry_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_entry), "__call__") as call: @@ -4881,11 +4912,6 @@ async def test_get_entry_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_get_entry_async_from_dict(): - await test_get_entry_async(request_type=dict) - - def test_get_entry_field_headers(): client = DataCatalogClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5028,8 +5054,8 @@ async def test_get_entry_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datacatalog.LookupEntryRequest, - dict, + datacatalog.LookupEntryRequest(), + {}, ], ) def test_lookup_entry(request_type, transport: str = "grpc"): @@ -5040,7 +5066,7 @@ def test_lookup_entry(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.lookup_entry), "__call__") as call: @@ -5093,10 +5119,11 @@ def test_lookup_entry_non_empty_request_with_auto_populated_field(): client.lookup_entry(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datacatalog.LookupEntryRequest( + request_msg = datacatalog.LookupEntryRequest( linked_resource="linked_resource_value", sql_resource="sql_resource_value", ) + assert args[0] == request_msg def test_lookup_entry_use_cached_wrapped_rpc(): @@ -5177,9 +5204,14 @@ async def test_lookup_entry_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_lookup_entry_async( - transport: str = "grpc_asyncio", request_type=datacatalog.LookupEntryRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datacatalog.LookupEntryRequest(), + {}, + ], +) +async def test_lookup_entry_async(request_type, transport: str = "grpc_asyncio"): client = DataCatalogAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5187,7 +5219,7 @@ async def test_lookup_entry_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.lookup_entry), "__call__") as call: @@ -5216,16 +5248,11 @@ async def test_lookup_entry_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_lookup_entry_async_from_dict(): - await test_lookup_entry_async(request_type=dict) - - @pytest.mark.parametrize( "request_type", [ - datacatalog.ListEntriesRequest, - dict, + datacatalog.ListEntriesRequest(), + {}, ], ) def test_list_entries(request_type, transport: str = "grpc"): @@ -5236,7 +5263,7 @@ def test_list_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_entries), "__call__") as call: @@ -5281,10 +5308,11 @@ def test_list_entries_non_empty_request_with_auto_populated_field(): client.list_entries(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datacatalog.ListEntriesRequest( + request_msg = datacatalog.ListEntriesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_entries_use_cached_wrapped_rpc(): @@ -5365,9 +5393,14 @@ async def test_list_entries_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_entries_async( - transport: str = "grpc_asyncio", request_type=datacatalog.ListEntriesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datacatalog.ListEntriesRequest(), + {}, + ], +) +async def test_list_entries_async(request_type, transport: str = "grpc_asyncio"): client = DataCatalogAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5375,7 +5408,7 @@ async def test_list_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_entries), "__call__") as call: @@ -5398,11 +5431,6 @@ async def test_list_entries_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_entries_async_from_dict(): - await test_list_entries_async(request_type=dict) - - def test_list_entries_field_headers(): client = DataCatalogClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5739,8 +5767,8 @@ async def test_list_entries_async_pages(): @pytest.mark.parametrize( "request_type", [ - datacatalog.CreateTagTemplateRequest, - dict, + datacatalog.CreateTagTemplateRequest(), + {}, ], ) def test_create_tag_template(request_type, transport: str = "grpc"): @@ -5751,7 +5779,7 @@ def test_create_tag_template(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5807,10 +5835,11 @@ def test_create_tag_template_non_empty_request_with_auto_populated_field(): client.create_tag_template(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datacatalog.CreateTagTemplateRequest( + request_msg = datacatalog.CreateTagTemplateRequest( parent="parent_value", tag_template_id="tag_template_id_value", ) + assert args[0] == request_msg def test_create_tag_template_use_cached_wrapped_rpc(): @@ -5895,9 +5924,14 @@ async def test_create_tag_template_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_tag_template_async( - transport: str = "grpc_asyncio", request_type=datacatalog.CreateTagTemplateRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datacatalog.CreateTagTemplateRequest(), + {}, + ], +) +async def test_create_tag_template_async(request_type, transport: str = "grpc_asyncio"): client = DataCatalogAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5905,7 +5939,7 @@ async def test_create_tag_template_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( @@ -5937,11 +5971,6 @@ async def test_create_tag_template_async( ) -@pytest.mark.asyncio -async def test_create_tag_template_async_from_dict(): - await test_create_tag_template_async(request_type=dict) - - def test_create_tag_template_field_headers(): client = DataCatalogClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6112,8 +6141,8 @@ async def test_create_tag_template_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datacatalog.GetTagTemplateRequest, - dict, + datacatalog.GetTagTemplateRequest(), + {}, ], ) def test_get_tag_template(request_type, transport: str = "grpc"): @@ -6124,7 +6153,7 @@ def test_get_tag_template(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tag_template), "__call__") as call: @@ -6175,9 +6204,10 @@ def test_get_tag_template_non_empty_request_with_auto_populated_field(): client.get_tag_template(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datacatalog.GetTagTemplateRequest( + request_msg = datacatalog.GetTagTemplateRequest( name="name_value", ) + assert args[0] == request_msg def test_get_tag_template_use_cached_wrapped_rpc(): @@ -6260,9 +6290,14 @@ async def test_get_tag_template_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_tag_template_async( - transport: str = "grpc_asyncio", request_type=datacatalog.GetTagTemplateRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datacatalog.GetTagTemplateRequest(), + {}, + ], +) +async def test_get_tag_template_async(request_type, transport: str = "grpc_asyncio"): client = DataCatalogAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6270,7 +6305,7 @@ async def test_get_tag_template_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_tag_template), "__call__") as call: @@ -6300,11 +6335,6 @@ async def test_get_tag_template_async( ) -@pytest.mark.asyncio -async def test_get_tag_template_async_from_dict(): - await test_get_tag_template_async(request_type=dict) - - def test_get_tag_template_field_headers(): client = DataCatalogClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6447,8 +6477,8 @@ async def test_get_tag_template_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datacatalog.UpdateTagTemplateRequest, - dict, + datacatalog.UpdateTagTemplateRequest(), + {}, ], ) def test_update_tag_template(request_type, transport: str = "grpc"): @@ -6459,7 +6489,7 @@ def test_update_tag_template(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6512,7 +6542,8 @@ def test_update_tag_template_non_empty_request_with_auto_populated_field(): client.update_tag_template(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datacatalog.UpdateTagTemplateRequest() + request_msg = datacatalog.UpdateTagTemplateRequest() + assert args[0] == request_msg def test_update_tag_template_use_cached_wrapped_rpc(): @@ -6597,9 +6628,14 @@ async def test_update_tag_template_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_tag_template_async( - transport: str = "grpc_asyncio", request_type=datacatalog.UpdateTagTemplateRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datacatalog.UpdateTagTemplateRequest(), + {}, + ], +) +async def test_update_tag_template_async(request_type, transport: str = "grpc_asyncio"): client = DataCatalogAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6607,7 +6643,7 @@ async def test_update_tag_template_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( @@ -6639,11 +6675,6 @@ async def test_update_tag_template_async( ) -@pytest.mark.asyncio -async def test_update_tag_template_async_from_dict(): - await test_update_tag_template_async(request_type=dict) - - def test_update_tag_template_field_headers(): client = DataCatalogClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6804,8 +6835,8 @@ async def test_update_tag_template_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datacatalog.DeleteTagTemplateRequest, - dict, + datacatalog.DeleteTagTemplateRequest(), + {}, ], ) def test_delete_tag_template(request_type, transport: str = "grpc"): @@ -6816,7 +6847,7 @@ def test_delete_tag_template(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6861,9 +6892,10 @@ def test_delete_tag_template_non_empty_request_with_auto_populated_field(): client.delete_tag_template(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datacatalog.DeleteTagTemplateRequest( + request_msg = datacatalog.DeleteTagTemplateRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_tag_template_use_cached_wrapped_rpc(): @@ -6948,9 +6980,14 @@ async def test_delete_tag_template_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_tag_template_async( - transport: str = "grpc_asyncio", request_type=datacatalog.DeleteTagTemplateRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datacatalog.DeleteTagTemplateRequest(), + {}, + ], +) +async def test_delete_tag_template_async(request_type, transport: str = "grpc_asyncio"): client = DataCatalogAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6958,7 +6995,7 @@ async def test_delete_tag_template_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( @@ -6978,11 +7015,6 @@ async def test_delete_tag_template_async( assert response is None -@pytest.mark.asyncio -async def test_delete_tag_template_async_from_dict(): - await test_delete_tag_template_async(request_type=dict) - - def test_delete_tag_template_field_headers(): client = DataCatalogClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7143,8 +7175,8 @@ async def test_delete_tag_template_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datacatalog.CreateTagTemplateFieldRequest, - dict, + datacatalog.CreateTagTemplateFieldRequest(), + {}, ], ) def test_create_tag_template_field(request_type, transport: str = "grpc"): @@ -7155,7 +7187,7 @@ def test_create_tag_template_field(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7212,10 +7244,11 @@ def test_create_tag_template_field_non_empty_request_with_auto_populated_field() client.create_tag_template_field(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datacatalog.CreateTagTemplateFieldRequest( + request_msg = datacatalog.CreateTagTemplateFieldRequest( parent="parent_value", tag_template_field_id="tag_template_field_id_value", ) + assert args[0] == request_msg def test_create_tag_template_field_use_cached_wrapped_rpc(): @@ -7301,9 +7334,15 @@ async def test_create_tag_template_field_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + datacatalog.CreateTagTemplateFieldRequest(), + {}, + ], +) async def test_create_tag_template_field_async( - transport: str = "grpc_asyncio", - request_type=datacatalog.CreateTagTemplateFieldRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataCatalogAsyncClient( credentials=async_anonymous_credentials(), @@ -7312,7 +7351,7 @@ async def test_create_tag_template_field_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( @@ -7345,11 +7384,6 @@ async def test_create_tag_template_field_async( assert response.order == 540 -@pytest.mark.asyncio -async def test_create_tag_template_field_async_from_dict(): - await test_create_tag_template_field_async(request_type=dict) - - def test_create_tag_template_field_field_headers(): client = DataCatalogClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7524,8 +7558,8 @@ async def test_create_tag_template_field_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datacatalog.UpdateTagTemplateFieldRequest, - dict, + datacatalog.UpdateTagTemplateFieldRequest(), + {}, ], ) def test_update_tag_template_field(request_type, transport: str = "grpc"): @@ -7536,7 +7570,7 @@ def test_update_tag_template_field(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7592,9 +7626,10 @@ def test_update_tag_template_field_non_empty_request_with_auto_populated_field() client.update_tag_template_field(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datacatalog.UpdateTagTemplateFieldRequest( + request_msg = datacatalog.UpdateTagTemplateFieldRequest( name="name_value", ) + assert args[0] == request_msg def test_update_tag_template_field_use_cached_wrapped_rpc(): @@ -7680,9 +7715,15 @@ async def test_update_tag_template_field_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + datacatalog.UpdateTagTemplateFieldRequest(), + {}, + ], +) async def test_update_tag_template_field_async( - transport: str = "grpc_asyncio", - request_type=datacatalog.UpdateTagTemplateFieldRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataCatalogAsyncClient( credentials=async_anonymous_credentials(), @@ -7691,7 +7732,7 @@ async def test_update_tag_template_field_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( @@ -7724,11 +7765,6 @@ async def test_update_tag_template_field_async( assert response.order == 540 -@pytest.mark.asyncio -async def test_update_tag_template_field_async_from_dict(): - await test_update_tag_template_field_async(request_type=dict) - - def test_update_tag_template_field_field_headers(): client = DataCatalogClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7903,8 +7939,8 @@ async def test_update_tag_template_field_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datacatalog.RenameTagTemplateFieldRequest, - dict, + datacatalog.RenameTagTemplateFieldRequest(), + {}, ], ) def test_rename_tag_template_field(request_type, transport: str = "grpc"): @@ -7915,7 +7951,7 @@ def test_rename_tag_template_field(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7972,10 +8008,11 @@ def test_rename_tag_template_field_non_empty_request_with_auto_populated_field() client.rename_tag_template_field(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datacatalog.RenameTagTemplateFieldRequest( + request_msg = datacatalog.RenameTagTemplateFieldRequest( name="name_value", new_tag_template_field_id="new_tag_template_field_id_value", ) + assert args[0] == request_msg def test_rename_tag_template_field_use_cached_wrapped_rpc(): @@ -8061,9 +8098,15 @@ async def test_rename_tag_template_field_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + datacatalog.RenameTagTemplateFieldRequest(), + {}, + ], +) async def test_rename_tag_template_field_async( - transport: str = "grpc_asyncio", - request_type=datacatalog.RenameTagTemplateFieldRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataCatalogAsyncClient( credentials=async_anonymous_credentials(), @@ -8072,7 +8115,7 @@ async def test_rename_tag_template_field_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( @@ -8105,11 +8148,6 @@ async def test_rename_tag_template_field_async( assert response.order == 540 -@pytest.mark.asyncio -async def test_rename_tag_template_field_async_from_dict(): - await test_rename_tag_template_field_async(request_type=dict) - - def test_rename_tag_template_field_field_headers(): client = DataCatalogClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8274,8 +8312,8 @@ async def test_rename_tag_template_field_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datacatalog.RenameTagTemplateFieldEnumValueRequest, - dict, + datacatalog.RenameTagTemplateFieldEnumValueRequest(), + {}, ], ) def test_rename_tag_template_field_enum_value(request_type, transport: str = "grpc"): @@ -8286,7 +8324,7 @@ def test_rename_tag_template_field_enum_value(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( @@ -8343,10 +8381,11 @@ def test_rename_tag_template_field_enum_value_non_empty_request_with_auto_popula client.rename_tag_template_field_enum_value(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datacatalog.RenameTagTemplateFieldEnumValueRequest( + request_msg = datacatalog.RenameTagTemplateFieldEnumValueRequest( name="name_value", new_enum_value_display_name="new_enum_value_display_name_value", ) + assert args[0] == request_msg def test_rename_tag_template_field_enum_value_use_cached_wrapped_rpc(): @@ -8432,9 +8471,15 @@ async def test_rename_tag_template_field_enum_value_async_use_cached_wrapped_rpc @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + datacatalog.RenameTagTemplateFieldEnumValueRequest(), + {}, + ], +) async def test_rename_tag_template_field_enum_value_async( - transport: str = "grpc_asyncio", - request_type=datacatalog.RenameTagTemplateFieldEnumValueRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataCatalogAsyncClient( credentials=async_anonymous_credentials(), @@ -8443,7 +8488,7 @@ async def test_rename_tag_template_field_enum_value_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( @@ -8476,11 +8521,6 @@ async def test_rename_tag_template_field_enum_value_async( assert response.order == 540 -@pytest.mark.asyncio -async def test_rename_tag_template_field_enum_value_async_from_dict(): - await test_rename_tag_template_field_enum_value_async(request_type=dict) - - def test_rename_tag_template_field_enum_value_field_headers(): client = DataCatalogClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8645,8 +8685,8 @@ async def test_rename_tag_template_field_enum_value_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datacatalog.DeleteTagTemplateFieldRequest, - dict, + datacatalog.DeleteTagTemplateFieldRequest(), + {}, ], ) def test_delete_tag_template_field(request_type, transport: str = "grpc"): @@ -8657,7 +8697,7 @@ def test_delete_tag_template_field(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8702,9 +8742,10 @@ def test_delete_tag_template_field_non_empty_request_with_auto_populated_field() client.delete_tag_template_field(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datacatalog.DeleteTagTemplateFieldRequest( + request_msg = datacatalog.DeleteTagTemplateFieldRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_tag_template_field_use_cached_wrapped_rpc(): @@ -8790,9 +8831,15 @@ async def test_delete_tag_template_field_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + datacatalog.DeleteTagTemplateFieldRequest(), + {}, + ], +) async def test_delete_tag_template_field_async( - transport: str = "grpc_asyncio", - request_type=datacatalog.DeleteTagTemplateFieldRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataCatalogAsyncClient( credentials=async_anonymous_credentials(), @@ -8801,7 +8848,7 @@ async def test_delete_tag_template_field_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( @@ -8821,11 +8868,6 @@ async def test_delete_tag_template_field_async( assert response is None -@pytest.mark.asyncio -async def test_delete_tag_template_field_async_from_dict(): - await test_delete_tag_template_field_async(request_type=dict) - - def test_delete_tag_template_field_field_headers(): client = DataCatalogClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8986,8 +9028,8 @@ async def test_delete_tag_template_field_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datacatalog.CreateTagRequest, - dict, + datacatalog.CreateTagRequest(), + {}, ], ) def test_create_tag(request_type, transport: str = "grpc"): @@ -8998,7 +9040,7 @@ def test_create_tag(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tag), "__call__") as call: @@ -9047,9 +9089,10 @@ def test_create_tag_non_empty_request_with_auto_populated_field(): client.create_tag(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datacatalog.CreateTagRequest( + request_msg = datacatalog.CreateTagRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_tag_use_cached_wrapped_rpc(): @@ -9128,9 +9171,14 @@ async def test_create_tag_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_create_tag_async( - transport: str = "grpc_asyncio", request_type=datacatalog.CreateTagRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datacatalog.CreateTagRequest(), + {}, + ], +) +async def test_create_tag_async(request_type, transport: str = "grpc_asyncio"): client = DataCatalogAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9138,7 +9186,7 @@ async def test_create_tag_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_tag), "__call__") as call: @@ -9165,11 +9213,6 @@ async def test_create_tag_async( assert response.template_display_name == "template_display_name_value" -@pytest.mark.asyncio -async def test_create_tag_async_from_dict(): - await test_create_tag_async(request_type=dict) - - def test_create_tag_field_headers(): client = DataCatalogClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9322,8 +9365,8 @@ async def test_create_tag_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datacatalog.UpdateTagRequest, - dict, + datacatalog.UpdateTagRequest(), + {}, ], ) def test_update_tag(request_type, transport: str = "grpc"): @@ -9334,7 +9377,7 @@ def test_update_tag(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tag), "__call__") as call: @@ -9381,7 +9424,8 @@ def test_update_tag_non_empty_request_with_auto_populated_field(): client.update_tag(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datacatalog.UpdateTagRequest() + request_msg = datacatalog.UpdateTagRequest() + assert args[0] == request_msg def test_update_tag_use_cached_wrapped_rpc(): @@ -9460,9 +9504,14 @@ async def test_update_tag_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_update_tag_async( - transport: str = "grpc_asyncio", request_type=datacatalog.UpdateTagRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datacatalog.UpdateTagRequest(), + {}, + ], +) +async def test_update_tag_async(request_type, transport: str = "grpc_asyncio"): client = DataCatalogAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9470,7 +9519,7 @@ async def test_update_tag_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_tag), "__call__") as call: @@ -9497,11 +9546,6 @@ async def test_update_tag_async( assert response.template_display_name == "template_display_name_value" -@pytest.mark.asyncio -async def test_update_tag_async_from_dict(): - await test_update_tag_async(request_type=dict) - - def test_update_tag_field_headers(): client = DataCatalogClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9654,8 +9698,8 @@ async def test_update_tag_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datacatalog.DeleteTagRequest, - dict, + datacatalog.DeleteTagRequest(), + {}, ], ) def test_delete_tag(request_type, transport: str = "grpc"): @@ -9666,7 +9710,7 @@ def test_delete_tag(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tag), "__call__") as call: @@ -9707,9 +9751,10 @@ def test_delete_tag_non_empty_request_with_auto_populated_field(): client.delete_tag(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datacatalog.DeleteTagRequest( + request_msg = datacatalog.DeleteTagRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_tag_use_cached_wrapped_rpc(): @@ -9788,9 +9833,14 @@ async def test_delete_tag_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_delete_tag_async( - transport: str = "grpc_asyncio", request_type=datacatalog.DeleteTagRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datacatalog.DeleteTagRequest(), + {}, + ], +) +async def test_delete_tag_async(request_type, transport: str = "grpc_asyncio"): client = DataCatalogAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9798,7 +9848,7 @@ async def test_delete_tag_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_tag), "__call__") as call: @@ -9816,11 +9866,6 @@ async def test_delete_tag_async( assert response is None -@pytest.mark.asyncio -async def test_delete_tag_async_from_dict(): - await test_delete_tag_async(request_type=dict) - - def test_delete_tag_field_headers(): client = DataCatalogClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9963,8 +10008,8 @@ async def test_delete_tag_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datacatalog.ListTagsRequest, - dict, + datacatalog.ListTagsRequest(), + {}, ], ) def test_list_tags(request_type, transport: str = "grpc"): @@ -9975,7 +10020,7 @@ def test_list_tags(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tags), "__call__") as call: @@ -10020,10 +10065,11 @@ def test_list_tags_non_empty_request_with_auto_populated_field(): client.list_tags(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datacatalog.ListTagsRequest( + request_msg = datacatalog.ListTagsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_tags_use_cached_wrapped_rpc(): @@ -10102,9 +10148,14 @@ async def test_list_tags_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_list_tags_async( - transport: str = "grpc_asyncio", request_type=datacatalog.ListTagsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datacatalog.ListTagsRequest(), + {}, + ], +) +async def test_list_tags_async(request_type, transport: str = "grpc_asyncio"): client = DataCatalogAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10112,7 +10163,7 @@ async def test_list_tags_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_tags), "__call__") as call: @@ -10135,11 +10186,6 @@ async def test_list_tags_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_tags_async_from_dict(): - await test_list_tags_async(request_type=dict) - - def test_list_tags_field_headers(): client = DataCatalogClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10476,8 +10522,8 @@ async def test_list_tags_async_pages(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.SetIamPolicyRequest, - dict, + iam_policy_pb2.SetIamPolicyRequest(), + {}, ], ) def test_set_iam_policy(request_type, transport: str = "grpc"): @@ -10488,7 +10534,7 @@ def test_set_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(type(client.transport.set_iam_policy), "__call__") as call: @@ -10534,9 +10580,10 @@ def test_set_iam_policy_non_empty_request_with_auto_populated_field(): client.set_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.SetIamPolicyRequest( + request_msg = iam_policy_pb2.SetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_set_iam_policy_use_cached_wrapped_rpc(): @@ -10617,9 +10664,14 @@ async def test_set_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.SetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.SetIamPolicyRequest(), + {}, + ], +) +async def test_set_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = DataCatalogAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10627,7 +10679,7 @@ async def test_set_iam_policy_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.set_iam_policy), "__call__") as call: @@ -10652,11 +10704,6 @@ async def test_set_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_set_iam_policy_async_from_dict(): - await test_set_iam_policy_async(request_type=dict) - - def test_set_iam_policy_field_headers(): client = DataCatalogClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10817,8 +10864,8 @@ async def test_set_iam_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.GetIamPolicyRequest, - dict, + iam_policy_pb2.GetIamPolicyRequest(), + {}, ], ) def test_get_iam_policy(request_type, transport: str = "grpc"): @@ -10829,7 +10876,7 @@ def test_get_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(type(client.transport.get_iam_policy), "__call__") as call: @@ -10875,9 +10922,10 @@ def test_get_iam_policy_non_empty_request_with_auto_populated_field(): client.get_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.GetIamPolicyRequest( + request_msg = iam_policy_pb2.GetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_get_iam_policy_use_cached_wrapped_rpc(): @@ -10958,9 +11006,14 @@ async def test_get_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.GetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.GetIamPolicyRequest(), + {}, + ], +) +async def test_get_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = DataCatalogAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10968,7 +11021,7 @@ async def test_get_iam_policy_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_iam_policy), "__call__") as call: @@ -10993,11 +11046,6 @@ async def test_get_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_get_iam_policy_async_from_dict(): - await test_get_iam_policy_async(request_type=dict) - - def test_get_iam_policy_field_headers(): client = DataCatalogClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11157,8 +11205,8 @@ async def test_get_iam_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.TestIamPermissionsRequest, - dict, + iam_policy_pb2.TestIamPermissionsRequest(), + {}, ], ) def test_test_iam_permissions(request_type, transport: str = "grpc"): @@ -11169,7 +11217,7 @@ def test_test_iam_permissions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11217,9 +11265,10 @@ def test_test_iam_permissions_non_empty_request_with_auto_populated_field(): client.test_iam_permissions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.TestIamPermissionsRequest( + request_msg = iam_policy_pb2.TestIamPermissionsRequest( resource="resource_value", ) + assert args[0] == request_msg def test_test_iam_permissions_use_cached_wrapped_rpc(): @@ -11304,9 +11353,15 @@ async def test_test_iam_permissions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.TestIamPermissionsRequest(), + {}, + ], +) async def test_test_iam_permissions_async( - transport: str = "grpc_asyncio", - request_type=iam_policy_pb2.TestIamPermissionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataCatalogAsyncClient( credentials=async_anonymous_credentials(), @@ -11315,7 +11370,7 @@ async def test_test_iam_permissions_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( @@ -11340,11 +11395,6 @@ async def test_test_iam_permissions_async( assert response.permissions == ["permissions_value"] -@pytest.mark.asyncio -async def test_test_iam_permissions_async_from_dict(): - await test_test_iam_permissions_async(request_type=dict) - - def test_test_iam_permissions_field_headers(): client = DataCatalogClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11551,7 +11601,6 @@ def test_search_catalog_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.SearchCatalogRequest() - assert args[0] == request_msg @@ -11574,7 +11623,6 @@ def test_create_entry_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.CreateEntryGroupRequest() - assert args[0] == request_msg @@ -11597,7 +11645,6 @@ def test_update_entry_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.UpdateEntryGroupRequest() - assert args[0] == request_msg @@ -11618,7 +11665,6 @@ def test_get_entry_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.GetEntryGroupRequest() - assert args[0] == request_msg @@ -11641,7 +11687,6 @@ def test_delete_entry_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.DeleteEntryGroupRequest() - assert args[0] == request_msg @@ -11664,7 +11709,6 @@ def test_list_entry_groups_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.ListEntryGroupsRequest() - assert args[0] == request_msg @@ -11685,7 +11729,6 @@ def test_create_entry_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.CreateEntryRequest() - assert args[0] == request_msg @@ -11706,7 +11749,6 @@ def test_update_entry_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.UpdateEntryRequest() - assert args[0] == request_msg @@ -11727,7 +11769,6 @@ def test_delete_entry_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.DeleteEntryRequest() - assert args[0] == request_msg @@ -11748,7 +11789,6 @@ def test_get_entry_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.GetEntryRequest() - assert args[0] == request_msg @@ -11769,7 +11809,6 @@ def test_lookup_entry_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.LookupEntryRequest() - assert args[0] == request_msg @@ -11790,7 +11829,6 @@ def test_list_entries_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.ListEntriesRequest() - assert args[0] == request_msg @@ -11813,7 +11851,6 @@ def test_create_tag_template_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.CreateTagTemplateRequest() - assert args[0] == request_msg @@ -11834,7 +11871,6 @@ def test_get_tag_template_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.GetTagTemplateRequest() - assert args[0] == request_msg @@ -11857,7 +11893,6 @@ def test_update_tag_template_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.UpdateTagTemplateRequest() - assert args[0] == request_msg @@ -11880,7 +11915,6 @@ def test_delete_tag_template_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.DeleteTagTemplateRequest() - assert args[0] == request_msg @@ -11903,7 +11937,6 @@ def test_create_tag_template_field_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.CreateTagTemplateFieldRequest() - assert args[0] == request_msg @@ -11926,7 +11959,6 @@ def test_update_tag_template_field_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.UpdateTagTemplateFieldRequest() - assert args[0] == request_msg @@ -11949,7 +11981,6 @@ def test_rename_tag_template_field_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.RenameTagTemplateFieldRequest() - assert args[0] == request_msg @@ -11972,7 +12003,6 @@ def test_rename_tag_template_field_enum_value_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.RenameTagTemplateFieldEnumValueRequest() - assert args[0] == request_msg @@ -11995,7 +12025,6 @@ def test_delete_tag_template_field_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.DeleteTagTemplateFieldRequest() - assert args[0] == request_msg @@ -12016,7 +12045,6 @@ def test_create_tag_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.CreateTagRequest() - assert args[0] == request_msg @@ -12037,7 +12065,6 @@ def test_update_tag_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.UpdateTagRequest() - assert args[0] == request_msg @@ -12058,7 +12085,6 @@ def test_delete_tag_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.DeleteTagRequest() - assert args[0] == request_msg @@ -12079,7 +12105,6 @@ def test_list_tags_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.ListTagsRequest() - assert args[0] == request_msg @@ -12100,7 +12125,6 @@ def test_set_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -12121,7 +12145,6 @@ def test_get_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -12144,7 +12167,6 @@ def test_test_iam_permissions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -12187,7 +12209,6 @@ async def test_search_catalog_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.SearchCatalogRequest() - assert args[0] == request_msg @@ -12218,7 +12239,6 @@ async def test_create_entry_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.CreateEntryGroupRequest() - assert args[0] == request_msg @@ -12249,7 +12269,6 @@ async def test_update_entry_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.UpdateEntryGroupRequest() - assert args[0] == request_msg @@ -12278,7 +12297,6 @@ async def test_get_entry_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.GetEntryGroupRequest() - assert args[0] == request_msg @@ -12303,7 +12321,6 @@ async def test_delete_entry_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.DeleteEntryGroupRequest() - assert args[0] == request_msg @@ -12332,7 +12349,6 @@ async def test_list_entry_groups_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.ListEntryGroupsRequest() - assert args[0] == request_msg @@ -12362,7 +12378,6 @@ async def test_create_entry_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.CreateEntryRequest() - assert args[0] == request_msg @@ -12392,7 +12407,6 @@ async def test_update_entry_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.UpdateEntryRequest() - assert args[0] == request_msg @@ -12415,7 +12429,6 @@ async def test_delete_entry_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.DeleteEntryRequest() - assert args[0] == request_msg @@ -12445,7 +12458,6 @@ async def test_get_entry_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.GetEntryRequest() - assert args[0] == request_msg @@ -12475,7 +12487,6 @@ async def test_lookup_entry_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.LookupEntryRequest() - assert args[0] == request_msg @@ -12502,7 +12513,6 @@ async def test_list_entries_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.ListEntriesRequest() - assert args[0] == request_msg @@ -12533,7 +12543,6 @@ async def test_create_tag_template_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.CreateTagTemplateRequest() - assert args[0] == request_msg @@ -12562,7 +12571,6 @@ async def test_get_tag_template_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.GetTagTemplateRequest() - assert args[0] == request_msg @@ -12593,7 +12601,6 @@ async def test_update_tag_template_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.UpdateTagTemplateRequest() - assert args[0] == request_msg @@ -12618,7 +12625,6 @@ async def test_delete_tag_template_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.DeleteTagTemplateRequest() - assert args[0] == request_msg @@ -12651,7 +12657,6 @@ async def test_create_tag_template_field_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.CreateTagTemplateFieldRequest() - assert args[0] == request_msg @@ -12684,7 +12689,6 @@ async def test_update_tag_template_field_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.UpdateTagTemplateFieldRequest() - assert args[0] == request_msg @@ -12717,7 +12721,6 @@ async def test_rename_tag_template_field_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.RenameTagTemplateFieldRequest() - assert args[0] == request_msg @@ -12750,7 +12753,6 @@ async def test_rename_tag_template_field_enum_value_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.RenameTagTemplateFieldEnumValueRequest() - assert args[0] == request_msg @@ -12775,7 +12777,6 @@ async def test_delete_tag_template_field_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.DeleteTagTemplateFieldRequest() - assert args[0] == request_msg @@ -12804,7 +12805,6 @@ async def test_create_tag_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.CreateTagRequest() - assert args[0] == request_msg @@ -12833,7 +12833,6 @@ async def test_update_tag_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.UpdateTagRequest() - assert args[0] == request_msg @@ -12856,7 +12855,6 @@ async def test_delete_tag_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.DeleteTagRequest() - assert args[0] == request_msg @@ -12883,7 +12881,6 @@ async def test_list_tags_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datacatalog.ListTagsRequest() - assert args[0] == request_msg @@ -12911,7 +12908,6 @@ async def test_set_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -12939,7 +12935,6 @@ async def test_get_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -12968,7 +12963,6 @@ async def test_test_iam_permissions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-datacatalog/tests/unit/gapic/datacatalog_v1beta1/test_policy_tag_manager.py b/packages/google-cloud-datacatalog/tests/unit/gapic/datacatalog_v1beta1/test_policy_tag_manager.py index 45e5c009c644..f010d066e8d3 100644 --- a/packages/google-cloud-datacatalog/tests/unit/gapic/datacatalog_v1beta1/test_policy_tag_manager.py +++ b/packages/google-cloud-datacatalog/tests/unit/gapic/datacatalog_v1beta1/test_policy_tag_manager.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 @@ -116,6 +117,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" @@ -1317,8 +1333,8 @@ def test_policy_tag_manager_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - policytagmanager.CreateTaxonomyRequest, - dict, + policytagmanager.CreateTaxonomyRequest(), + {}, ], ) def test_create_taxonomy(request_type, transport: str = "grpc"): @@ -1329,7 +1345,7 @@ def test_create_taxonomy(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_taxonomy), "__call__") as call: @@ -1385,9 +1401,10 @@ def test_create_taxonomy_non_empty_request_with_auto_populated_field(): client.create_taxonomy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == policytagmanager.CreateTaxonomyRequest( + request_msg = policytagmanager.CreateTaxonomyRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_taxonomy_use_cached_wrapped_rpc(): @@ -1468,9 +1485,14 @@ async def test_create_taxonomy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_taxonomy_async( - transport: str = "grpc_asyncio", request_type=policytagmanager.CreateTaxonomyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + policytagmanager.CreateTaxonomyRequest(), + {}, + ], +) +async def test_create_taxonomy_async(request_type, transport: str = "grpc_asyncio"): client = PolicyTagManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1478,7 +1500,7 @@ async def test_create_taxonomy_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_taxonomy), "__call__") as call: @@ -1513,11 +1535,6 @@ async def test_create_taxonomy_async( ] -@pytest.mark.asyncio -async def test_create_taxonomy_async_from_dict(): - await test_create_taxonomy_async(request_type=dict) - - def test_create_taxonomy_field_headers(): client = PolicyTagManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1674,8 +1691,8 @@ async def test_create_taxonomy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - policytagmanager.DeleteTaxonomyRequest, - dict, + policytagmanager.DeleteTaxonomyRequest(), + {}, ], ) def test_delete_taxonomy(request_type, transport: str = "grpc"): @@ -1686,7 +1703,7 @@ def test_delete_taxonomy(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_taxonomy), "__call__") as call: @@ -1727,9 +1744,10 @@ def test_delete_taxonomy_non_empty_request_with_auto_populated_field(): client.delete_taxonomy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == policytagmanager.DeleteTaxonomyRequest( + request_msg = policytagmanager.DeleteTaxonomyRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_taxonomy_use_cached_wrapped_rpc(): @@ -1810,9 +1828,14 @@ async def test_delete_taxonomy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_taxonomy_async( - transport: str = "grpc_asyncio", request_type=policytagmanager.DeleteTaxonomyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + policytagmanager.DeleteTaxonomyRequest(), + {}, + ], +) +async def test_delete_taxonomy_async(request_type, transport: str = "grpc_asyncio"): client = PolicyTagManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1820,7 +1843,7 @@ async def test_delete_taxonomy_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_taxonomy), "__call__") as call: @@ -1838,11 +1861,6 @@ async def test_delete_taxonomy_async( assert response is None -@pytest.mark.asyncio -async def test_delete_taxonomy_async_from_dict(): - await test_delete_taxonomy_async(request_type=dict) - - def test_delete_taxonomy_field_headers(): client = PolicyTagManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1985,8 +2003,8 @@ async def test_delete_taxonomy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - policytagmanager.UpdateTaxonomyRequest, - dict, + policytagmanager.UpdateTaxonomyRequest(), + {}, ], ) def test_update_taxonomy(request_type, transport: str = "grpc"): @@ -1997,7 +2015,7 @@ def test_update_taxonomy(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_taxonomy), "__call__") as call: @@ -2051,7 +2069,8 @@ def test_update_taxonomy_non_empty_request_with_auto_populated_field(): client.update_taxonomy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == policytagmanager.UpdateTaxonomyRequest() + request_msg = policytagmanager.UpdateTaxonomyRequest() + assert args[0] == request_msg def test_update_taxonomy_use_cached_wrapped_rpc(): @@ -2132,9 +2151,14 @@ async def test_update_taxonomy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_taxonomy_async( - transport: str = "grpc_asyncio", request_type=policytagmanager.UpdateTaxonomyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + policytagmanager.UpdateTaxonomyRequest(), + {}, + ], +) +async def test_update_taxonomy_async(request_type, transport: str = "grpc_asyncio"): client = PolicyTagManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2142,7 +2166,7 @@ async def test_update_taxonomy_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_taxonomy), "__call__") as call: @@ -2177,11 +2201,6 @@ async def test_update_taxonomy_async( ] -@pytest.mark.asyncio -async def test_update_taxonomy_async_from_dict(): - await test_update_taxonomy_async(request_type=dict) - - def test_update_taxonomy_field_headers(): client = PolicyTagManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2328,8 +2347,8 @@ async def test_update_taxonomy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - policytagmanager.ListTaxonomiesRequest, - dict, + policytagmanager.ListTaxonomiesRequest(), + {}, ], ) def test_list_taxonomies(request_type, transport: str = "grpc"): @@ -2340,7 +2359,7 @@ def test_list_taxonomies(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_taxonomies), "__call__") as call: @@ -2386,11 +2405,12 @@ def test_list_taxonomies_non_empty_request_with_auto_populated_field(): client.list_taxonomies(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == policytagmanager.ListTaxonomiesRequest( + request_msg = policytagmanager.ListTaxonomiesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_taxonomies_use_cached_wrapped_rpc(): @@ -2471,9 +2491,14 @@ async def test_list_taxonomies_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_taxonomies_async( - transport: str = "grpc_asyncio", request_type=policytagmanager.ListTaxonomiesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + policytagmanager.ListTaxonomiesRequest(), + {}, + ], +) +async def test_list_taxonomies_async(request_type, transport: str = "grpc_asyncio"): client = PolicyTagManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2481,7 +2506,7 @@ async def test_list_taxonomies_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_taxonomies), "__call__") as call: @@ -2504,11 +2529,6 @@ async def test_list_taxonomies_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_taxonomies_async_from_dict(): - await test_list_taxonomies_async(request_type=dict) - - def test_list_taxonomies_field_headers(): client = PolicyTagManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2845,8 +2865,8 @@ async def test_list_taxonomies_async_pages(): @pytest.mark.parametrize( "request_type", [ - policytagmanager.GetTaxonomyRequest, - dict, + policytagmanager.GetTaxonomyRequest(), + {}, ], ) def test_get_taxonomy(request_type, transport: str = "grpc"): @@ -2857,7 +2877,7 @@ def test_get_taxonomy(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_taxonomy), "__call__") as call: @@ -2913,9 +2933,10 @@ def test_get_taxonomy_non_empty_request_with_auto_populated_field(): client.get_taxonomy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == policytagmanager.GetTaxonomyRequest( + request_msg = policytagmanager.GetTaxonomyRequest( name="name_value", ) + assert args[0] == request_msg def test_get_taxonomy_use_cached_wrapped_rpc(): @@ -2996,9 +3017,14 @@ async def test_get_taxonomy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_taxonomy_async( - transport: str = "grpc_asyncio", request_type=policytagmanager.GetTaxonomyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + policytagmanager.GetTaxonomyRequest(), + {}, + ], +) +async def test_get_taxonomy_async(request_type, transport: str = "grpc_asyncio"): client = PolicyTagManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3006,7 +3032,7 @@ async def test_get_taxonomy_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_taxonomy), "__call__") as call: @@ -3041,11 +3067,6 @@ async def test_get_taxonomy_async( ] -@pytest.mark.asyncio -async def test_get_taxonomy_async_from_dict(): - await test_get_taxonomy_async(request_type=dict) - - def test_get_taxonomy_field_headers(): client = PolicyTagManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3192,8 +3213,8 @@ async def test_get_taxonomy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - policytagmanager.CreatePolicyTagRequest, - dict, + policytagmanager.CreatePolicyTagRequest(), + {}, ], ) def test_create_policy_tag(request_type, transport: str = "grpc"): @@ -3204,7 +3225,7 @@ def test_create_policy_tag(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3260,9 +3281,10 @@ def test_create_policy_tag_non_empty_request_with_auto_populated_field(): client.create_policy_tag(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == policytagmanager.CreatePolicyTagRequest( + request_msg = policytagmanager.CreatePolicyTagRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_policy_tag_use_cached_wrapped_rpc(): @@ -3345,10 +3367,14 @@ async def test_create_policy_tag_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_policy_tag_async( - transport: str = "grpc_asyncio", - request_type=policytagmanager.CreatePolicyTagRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + policytagmanager.CreatePolicyTagRequest(), + {}, + ], +) +async def test_create_policy_tag_async(request_type, transport: str = "grpc_asyncio"): client = PolicyTagManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3356,7 +3382,7 @@ async def test_create_policy_tag_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( @@ -3389,11 +3415,6 @@ async def test_create_policy_tag_async( assert response.child_policy_tags == ["child_policy_tags_value"] -@pytest.mark.asyncio -async def test_create_policy_tag_async_from_dict(): - await test_create_policy_tag_async(request_type=dict) - - def test_create_policy_tag_field_headers(): client = PolicyTagManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3558,8 +3579,8 @@ async def test_create_policy_tag_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - policytagmanager.DeletePolicyTagRequest, - dict, + policytagmanager.DeletePolicyTagRequest(), + {}, ], ) def test_delete_policy_tag(request_type, transport: str = "grpc"): @@ -3570,7 +3591,7 @@ def test_delete_policy_tag(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3615,9 +3636,10 @@ def test_delete_policy_tag_non_empty_request_with_auto_populated_field(): client.delete_policy_tag(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == policytagmanager.DeletePolicyTagRequest( + request_msg = policytagmanager.DeletePolicyTagRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_policy_tag_use_cached_wrapped_rpc(): @@ -3700,10 +3722,14 @@ async def test_delete_policy_tag_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_policy_tag_async( - transport: str = "grpc_asyncio", - request_type=policytagmanager.DeletePolicyTagRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + policytagmanager.DeletePolicyTagRequest(), + {}, + ], +) +async def test_delete_policy_tag_async(request_type, transport: str = "grpc_asyncio"): client = PolicyTagManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3711,7 +3737,7 @@ async def test_delete_policy_tag_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( @@ -3731,11 +3757,6 @@ async def test_delete_policy_tag_async( assert response is None -@pytest.mark.asyncio -async def test_delete_policy_tag_async_from_dict(): - await test_delete_policy_tag_async(request_type=dict) - - def test_delete_policy_tag_field_headers(): client = PolicyTagManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3886,8 +3907,8 @@ async def test_delete_policy_tag_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - policytagmanager.UpdatePolicyTagRequest, - dict, + policytagmanager.UpdatePolicyTagRequest(), + {}, ], ) def test_update_policy_tag(request_type, transport: str = "grpc"): @@ -3898,7 +3919,7 @@ def test_update_policy_tag(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3952,7 +3973,8 @@ def test_update_policy_tag_non_empty_request_with_auto_populated_field(): client.update_policy_tag(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == policytagmanager.UpdatePolicyTagRequest() + request_msg = policytagmanager.UpdatePolicyTagRequest() + assert args[0] == request_msg def test_update_policy_tag_use_cached_wrapped_rpc(): @@ -4035,10 +4057,14 @@ async def test_update_policy_tag_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_policy_tag_async( - transport: str = "grpc_asyncio", - request_type=policytagmanager.UpdatePolicyTagRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + policytagmanager.UpdatePolicyTagRequest(), + {}, + ], +) +async def test_update_policy_tag_async(request_type, transport: str = "grpc_asyncio"): client = PolicyTagManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4046,7 +4072,7 @@ async def test_update_policy_tag_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( @@ -4079,11 +4105,6 @@ async def test_update_policy_tag_async( assert response.child_policy_tags == ["child_policy_tags_value"] -@pytest.mark.asyncio -async def test_update_policy_tag_async_from_dict(): - await test_update_policy_tag_async(request_type=dict) - - def test_update_policy_tag_field_headers(): client = PolicyTagManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4238,8 +4259,8 @@ async def test_update_policy_tag_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - policytagmanager.ListPolicyTagsRequest, - dict, + policytagmanager.ListPolicyTagsRequest(), + {}, ], ) def test_list_policy_tags(request_type, transport: str = "grpc"): @@ -4250,7 +4271,7 @@ def test_list_policy_tags(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_policy_tags), "__call__") as call: @@ -4295,10 +4316,11 @@ def test_list_policy_tags_non_empty_request_with_auto_populated_field(): client.list_policy_tags(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == policytagmanager.ListPolicyTagsRequest( + request_msg = policytagmanager.ListPolicyTagsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_policy_tags_use_cached_wrapped_rpc(): @@ -4381,9 +4403,14 @@ async def test_list_policy_tags_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_policy_tags_async( - transport: str = "grpc_asyncio", request_type=policytagmanager.ListPolicyTagsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + policytagmanager.ListPolicyTagsRequest(), + {}, + ], +) +async def test_list_policy_tags_async(request_type, transport: str = "grpc_asyncio"): client = PolicyTagManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4391,7 +4418,7 @@ async def test_list_policy_tags_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_policy_tags), "__call__") as call: @@ -4414,11 +4441,6 @@ async def test_list_policy_tags_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_policy_tags_async_from_dict(): - await test_list_policy_tags_async(request_type=dict) - - def test_list_policy_tags_field_headers(): client = PolicyTagManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4755,8 +4777,8 @@ async def test_list_policy_tags_async_pages(): @pytest.mark.parametrize( "request_type", [ - policytagmanager.GetPolicyTagRequest, - dict, + policytagmanager.GetPolicyTagRequest(), + {}, ], ) def test_get_policy_tag(request_type, transport: str = "grpc"): @@ -4767,7 +4789,7 @@ def test_get_policy_tag(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_policy_tag), "__call__") as call: @@ -4819,9 +4841,10 @@ def test_get_policy_tag_non_empty_request_with_auto_populated_field(): client.get_policy_tag(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == policytagmanager.GetPolicyTagRequest( + request_msg = policytagmanager.GetPolicyTagRequest( name="name_value", ) + assert args[0] == request_msg def test_get_policy_tag_use_cached_wrapped_rpc(): @@ -4902,9 +4925,14 @@ async def test_get_policy_tag_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_policy_tag_async( - transport: str = "grpc_asyncio", request_type=policytagmanager.GetPolicyTagRequest -): +@pytest.mark.parametrize( + "request_type", + [ + policytagmanager.GetPolicyTagRequest(), + {}, + ], +) +async def test_get_policy_tag_async(request_type, transport: str = "grpc_asyncio"): client = PolicyTagManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4912,7 +4940,7 @@ async def test_get_policy_tag_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_policy_tag), "__call__") as call: @@ -4943,11 +4971,6 @@ async def test_get_policy_tag_async( assert response.child_policy_tags == ["child_policy_tags_value"] -@pytest.mark.asyncio -async def test_get_policy_tag_async_from_dict(): - await test_get_policy_tag_async(request_type=dict) - - def test_get_policy_tag_field_headers(): client = PolicyTagManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5094,8 +5117,8 @@ async def test_get_policy_tag_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.GetIamPolicyRequest, - dict, + iam_policy_pb2.GetIamPolicyRequest(), + {}, ], ) def test_get_iam_policy(request_type, transport: str = "grpc"): @@ -5106,7 +5129,7 @@ def test_get_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(type(client.transport.get_iam_policy), "__call__") as call: @@ -5152,9 +5175,10 @@ def test_get_iam_policy_non_empty_request_with_auto_populated_field(): client.get_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.GetIamPolicyRequest( + request_msg = iam_policy_pb2.GetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_get_iam_policy_use_cached_wrapped_rpc(): @@ -5235,9 +5259,14 @@ async def test_get_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.GetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.GetIamPolicyRequest(), + {}, + ], +) +async def test_get_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = PolicyTagManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5245,7 +5274,7 @@ async def test_get_iam_policy_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_iam_policy), "__call__") as call: @@ -5270,11 +5299,6 @@ async def test_get_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_get_iam_policy_async_from_dict(): - await test_get_iam_policy_async(request_type=dict) - - def test_get_iam_policy_field_headers(): client = PolicyTagManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5354,8 +5378,8 @@ def test_get_iam_policy_from_dict_foreign(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.SetIamPolicyRequest, - dict, + iam_policy_pb2.SetIamPolicyRequest(), + {}, ], ) def test_set_iam_policy(request_type, transport: str = "grpc"): @@ -5366,7 +5390,7 @@ def test_set_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(type(client.transport.set_iam_policy), "__call__") as call: @@ -5412,9 +5436,10 @@ def test_set_iam_policy_non_empty_request_with_auto_populated_field(): client.set_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.SetIamPolicyRequest( + request_msg = iam_policy_pb2.SetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_set_iam_policy_use_cached_wrapped_rpc(): @@ -5495,9 +5520,14 @@ async def test_set_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.SetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.SetIamPolicyRequest(), + {}, + ], +) +async def test_set_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = PolicyTagManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5505,7 +5535,7 @@ async def test_set_iam_policy_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.set_iam_policy), "__call__") as call: @@ -5530,11 +5560,6 @@ async def test_set_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_set_iam_policy_async_from_dict(): - await test_set_iam_policy_async(request_type=dict) - - def test_set_iam_policy_field_headers(): client = PolicyTagManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5615,8 +5640,8 @@ def test_set_iam_policy_from_dict_foreign(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.TestIamPermissionsRequest, - dict, + iam_policy_pb2.TestIamPermissionsRequest(), + {}, ], ) def test_test_iam_permissions(request_type, transport: str = "grpc"): @@ -5627,7 +5652,7 @@ def test_test_iam_permissions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5675,9 +5700,10 @@ def test_test_iam_permissions_non_empty_request_with_auto_populated_field(): client.test_iam_permissions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.TestIamPermissionsRequest( + request_msg = iam_policy_pb2.TestIamPermissionsRequest( resource="resource_value", ) + assert args[0] == request_msg def test_test_iam_permissions_use_cached_wrapped_rpc(): @@ -5762,9 +5788,15 @@ async def test_test_iam_permissions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.TestIamPermissionsRequest(), + {}, + ], +) async def test_test_iam_permissions_async( - transport: str = "grpc_asyncio", - request_type=iam_policy_pb2.TestIamPermissionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = PolicyTagManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -5773,7 +5805,7 @@ async def test_test_iam_permissions_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( @@ -5798,11 +5830,6 @@ async def test_test_iam_permissions_async( assert response.permissions == ["permissions_value"] -@pytest.mark.asyncio -async def test_test_iam_permissions_async_from_dict(): - await test_test_iam_permissions_async(request_type=dict) - - def test_test_iam_permissions_field_headers(): client = PolicyTagManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6009,7 +6036,6 @@ def test_create_taxonomy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policytagmanager.CreateTaxonomyRequest() - assert args[0] == request_msg @@ -6030,7 +6056,6 @@ def test_delete_taxonomy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policytagmanager.DeleteTaxonomyRequest() - assert args[0] == request_msg @@ -6051,7 +6076,6 @@ def test_update_taxonomy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policytagmanager.UpdateTaxonomyRequest() - assert args[0] == request_msg @@ -6072,7 +6096,6 @@ def test_list_taxonomies_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policytagmanager.ListTaxonomiesRequest() - assert args[0] == request_msg @@ -6093,7 +6116,6 @@ def test_get_taxonomy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policytagmanager.GetTaxonomyRequest() - assert args[0] == request_msg @@ -6116,7 +6138,6 @@ def test_create_policy_tag_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policytagmanager.CreatePolicyTagRequest() - assert args[0] == request_msg @@ -6139,7 +6160,6 @@ def test_delete_policy_tag_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policytagmanager.DeletePolicyTagRequest() - assert args[0] == request_msg @@ -6162,7 +6182,6 @@ def test_update_policy_tag_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policytagmanager.UpdatePolicyTagRequest() - assert args[0] == request_msg @@ -6183,7 +6202,6 @@ def test_list_policy_tags_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policytagmanager.ListPolicyTagsRequest() - assert args[0] == request_msg @@ -6204,7 +6222,6 @@ def test_get_policy_tag_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policytagmanager.GetPolicyTagRequest() - assert args[0] == request_msg @@ -6225,7 +6242,6 @@ def test_get_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -6246,7 +6262,6 @@ def test_set_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -6269,7 +6284,6 @@ def test_test_iam_permissions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -6316,7 +6330,6 @@ async def test_create_taxonomy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policytagmanager.CreateTaxonomyRequest() - assert args[0] == request_msg @@ -6339,7 +6352,6 @@ async def test_delete_taxonomy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policytagmanager.DeleteTaxonomyRequest() - assert args[0] == request_msg @@ -6372,7 +6384,6 @@ async def test_update_taxonomy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policytagmanager.UpdateTaxonomyRequest() - assert args[0] == request_msg @@ -6399,7 +6410,6 @@ async def test_list_taxonomies_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policytagmanager.ListTaxonomiesRequest() - assert args[0] == request_msg @@ -6432,7 +6442,6 @@ async def test_get_taxonomy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policytagmanager.GetTaxonomyRequest() - assert args[0] == request_msg @@ -6465,7 +6474,6 @@ async def test_create_policy_tag_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policytagmanager.CreatePolicyTagRequest() - assert args[0] == request_msg @@ -6490,7 +6498,6 @@ async def test_delete_policy_tag_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policytagmanager.DeletePolicyTagRequest() - assert args[0] == request_msg @@ -6523,7 +6530,6 @@ async def test_update_policy_tag_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policytagmanager.UpdatePolicyTagRequest() - assert args[0] == request_msg @@ -6550,7 +6556,6 @@ async def test_list_policy_tags_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policytagmanager.ListPolicyTagsRequest() - assert args[0] == request_msg @@ -6581,7 +6586,6 @@ async def test_get_policy_tag_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policytagmanager.GetPolicyTagRequest() - assert args[0] == request_msg @@ -6609,7 +6613,6 @@ async def test_get_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -6637,7 +6640,6 @@ async def test_set_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -6666,7 +6668,6 @@ async def test_test_iam_permissions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-datacatalog/tests/unit/gapic/datacatalog_v1beta1/test_policy_tag_manager_serialization.py b/packages/google-cloud-datacatalog/tests/unit/gapic/datacatalog_v1beta1/test_policy_tag_manager_serialization.py index 3d1a0b1d538a..0aa286d43e45 100644 --- a/packages/google-cloud-datacatalog/tests/unit/gapic/datacatalog_v1beta1/test_policy_tag_manager_serialization.py +++ b/packages/google-cloud-datacatalog/tests/unit/gapic/datacatalog_v1beta1/test_policy_tag_manager_serialization.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" @@ -1393,8 +1409,8 @@ def test_policy_tag_manager_serialization_client_create_channel_credentials_file @pytest.mark.parametrize( "request_type", [ - policytagmanagerserialization.ImportTaxonomiesRequest, - dict, + policytagmanagerserialization.ImportTaxonomiesRequest(), + {}, ], ) def test_import_taxonomies(request_type, transport: str = "grpc"): @@ -1405,7 +1421,7 @@ def test_import_taxonomies(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1450,9 +1466,10 @@ def test_import_taxonomies_non_empty_request_with_auto_populated_field(): client.import_taxonomies(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == policytagmanagerserialization.ImportTaxonomiesRequest( + request_msg = policytagmanagerserialization.ImportTaxonomiesRequest( parent="parent_value", ) + assert args[0] == request_msg def test_import_taxonomies_use_cached_wrapped_rpc(): @@ -1535,10 +1552,14 @@ async def test_import_taxonomies_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_import_taxonomies_async( - transport: str = "grpc_asyncio", - request_type=policytagmanagerserialization.ImportTaxonomiesRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + policytagmanagerserialization.ImportTaxonomiesRequest(), + {}, + ], +) +async def test_import_taxonomies_async(request_type, transport: str = "grpc_asyncio"): client = PolicyTagManagerSerializationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1546,7 +1567,7 @@ async def test_import_taxonomies_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( @@ -1568,11 +1589,6 @@ async def test_import_taxonomies_async( assert isinstance(response, policytagmanagerserialization.ImportTaxonomiesResponse) -@pytest.mark.asyncio -async def test_import_taxonomies_async_from_dict(): - await test_import_taxonomies_async(request_type=dict) - - def test_import_taxonomies_field_headers(): client = PolicyTagManagerSerializationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1641,8 +1657,8 @@ async def test_import_taxonomies_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - policytagmanagerserialization.ExportTaxonomiesRequest, - dict, + policytagmanagerserialization.ExportTaxonomiesRequest(), + {}, ], ) def test_export_taxonomies(request_type, transport: str = "grpc"): @@ -1653,7 +1669,7 @@ def test_export_taxonomies(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1698,9 +1714,10 @@ def test_export_taxonomies_non_empty_request_with_auto_populated_field(): client.export_taxonomies(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == policytagmanagerserialization.ExportTaxonomiesRequest( + request_msg = policytagmanagerserialization.ExportTaxonomiesRequest( parent="parent_value", ) + assert args[0] == request_msg def test_export_taxonomies_use_cached_wrapped_rpc(): @@ -1783,10 +1800,14 @@ async def test_export_taxonomies_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_export_taxonomies_async( - transport: str = "grpc_asyncio", - request_type=policytagmanagerserialization.ExportTaxonomiesRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + policytagmanagerserialization.ExportTaxonomiesRequest(), + {}, + ], +) +async def test_export_taxonomies_async(request_type, transport: str = "grpc_asyncio"): client = PolicyTagManagerSerializationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1794,7 +1815,7 @@ async def test_export_taxonomies_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( @@ -1816,11 +1837,6 @@ async def test_export_taxonomies_async( assert isinstance(response, policytagmanagerserialization.ExportTaxonomiesResponse) -@pytest.mark.asyncio -async def test_export_taxonomies_async_from_dict(): - await test_export_taxonomies_async(request_type=dict) - - def test_export_taxonomies_field_headers(): client = PolicyTagManagerSerializationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2010,7 +2026,6 @@ def test_import_taxonomies_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policytagmanagerserialization.ImportTaxonomiesRequest() - assert args[0] == request_msg @@ -2033,7 +2048,6 @@ def test_export_taxonomies_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policytagmanagerserialization.ExportTaxonomiesRequest() - assert args[0] == request_msg @@ -2074,7 +2088,6 @@ async def test_import_taxonomies_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policytagmanagerserialization.ImportTaxonomiesRequest() - assert args[0] == request_msg @@ -2101,7 +2114,6 @@ async def test_export_taxonomies_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policytagmanagerserialization.ExportTaxonomiesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dataflow-client/noxfile.py b/packages/google-cloud-dataflow-client/noxfile.py index b93a2b5684d4..eb858582eda7 100644 --- a/packages/google-cloud-dataflow-client/noxfile.py +++ b/packages/google-cloud-dataflow-client/noxfile.py @@ -47,7 +47,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-dataflow-client" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-dataflow-client/setup.py b/packages/google-cloud-dataflow-client/setup.py index 715e0b506801..f64881ee3409 100644 --- a/packages/google-cloud-dataflow-client/setup.py +++ b/packages/google-cloud-dataflow-client/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/google-cloud-dataflow-client/testing/constraints-3.10.txt b/packages/google-cloud-dataflow-client/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-dataflow-client/testing/constraints-3.10.txt +++ b/packages/google-cloud-dataflow-client/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-dataflow-client/tests/unit/gapic/dataflow_v1beta3/test_flex_templates_service.py b/packages/google-cloud-dataflow-client/tests/unit/gapic/dataflow_v1beta3/test_flex_templates_service.py index b9f40208d2f2..c7c5921da6f0 100644 --- a/packages/google-cloud-dataflow-client/tests/unit/gapic/dataflow_v1beta3/test_flex_templates_service.py +++ b/packages/google-cloud-dataflow-client/tests/unit/gapic/dataflow_v1beta3/test_flex_templates_service.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 @@ -106,6 +107,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" @@ -1372,8 +1388,8 @@ def test_flex_templates_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - templates.LaunchFlexTemplateRequest, - dict, + templates.LaunchFlexTemplateRequest(), + {}, ], ) def test_launch_flex_template(request_type, transport: str = "grpc"): @@ -1384,7 +1400,7 @@ def test_launch_flex_template(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1430,10 +1446,11 @@ def test_launch_flex_template_non_empty_request_with_auto_populated_field(): client.launch_flex_template(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == templates.LaunchFlexTemplateRequest( + request_msg = templates.LaunchFlexTemplateRequest( project_id="project_id_value", location="location_value", ) + assert args[0] == request_msg def test_launch_flex_template_use_cached_wrapped_rpc(): @@ -1518,8 +1535,15 @@ async def test_launch_flex_template_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + templates.LaunchFlexTemplateRequest(), + {}, + ], +) async def test_launch_flex_template_async( - transport: str = "grpc_asyncio", request_type=templates.LaunchFlexTemplateRequest + request_type, transport: str = "grpc_asyncio" ): client = FlexTemplatesServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1528,7 +1552,7 @@ async def test_launch_flex_template_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( @@ -1550,11 +1574,6 @@ async def test_launch_flex_template_async( assert isinstance(response, templates.LaunchFlexTemplateResponse) -@pytest.mark.asyncio -async def test_launch_flex_template_async_from_dict(): - await test_launch_flex_template_async(request_type=dict) - - def test_launch_flex_template_field_headers(): client = FlexTemplatesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1787,7 +1806,6 @@ def test_launch_flex_template_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = templates.LaunchFlexTemplateRequest() - assert args[0] == request_msg @@ -1828,7 +1846,6 @@ async def test_launch_flex_template_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = templates.LaunchFlexTemplateRequest() - assert args[0] == request_msg @@ -1997,7 +2014,6 @@ def test_launch_flex_template_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = templates.LaunchFlexTemplateRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dataflow-client/tests/unit/gapic/dataflow_v1beta3/test_jobs_v1_beta3.py b/packages/google-cloud-dataflow-client/tests/unit/gapic/dataflow_v1beta3/test_jobs_v1_beta3.py index 54cc45dde090..85e518d9e50d 100644 --- a/packages/google-cloud-dataflow-client/tests/unit/gapic/dataflow_v1beta3/test_jobs_v1_beta3.py +++ b/packages/google-cloud-dataflow-client/tests/unit/gapic/dataflow_v1beta3/test_jobs_v1_beta3.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" @@ -1280,8 +1296,8 @@ def test_jobs_v1_beta3_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - jobs.CreateJobRequest, - dict, + jobs.CreateJobRequest(), + {}, ], ) def test_create_job(request_type, transport: str = "grpc"): @@ -1292,7 +1308,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() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_job), "__call__") as call: @@ -1368,11 +1384,12 @@ def test_create_job_non_empty_request_with_auto_populated_field(): client.create_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == jobs.CreateJobRequest( + request_msg = jobs.CreateJobRequest( project_id="project_id_value", replace_job_id="replace_job_id_value", location="location_value", ) + assert args[0] == request_msg def test_create_job_use_cached_wrapped_rpc(): @@ -1451,9 +1468,14 @@ async def test_create_job_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_create_job_async( - transport: str = "grpc_asyncio", request_type=jobs.CreateJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + jobs.CreateJobRequest(), + {}, + ], +) +async def test_create_job_async(request_type, transport: str = "grpc_asyncio"): client = JobsV1Beta3AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1461,7 +1483,7 @@ async def test_create_job_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_job), "__call__") as call: @@ -1514,11 +1536,6 @@ async def test_create_job_async( assert response.pausable is True -@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 = JobsV1Beta3Client( credentials=ga_credentials.AnonymousCredentials(), @@ -1583,8 +1600,8 @@ async def test_create_job_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - jobs.GetJobRequest, - dict, + jobs.GetJobRequest(), + {}, ], ) def test_get_job(request_type, transport: str = "grpc"): @@ -1595,7 +1612,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(type(client.transport.get_job), "__call__") as call: @@ -1671,11 +1688,12 @@ 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] == jobs.GetJobRequest( + request_msg = jobs.GetJobRequest( project_id="project_id_value", job_id="job_id_value", location="location_value", ) + assert args[0] == request_msg def test_get_job_use_cached_wrapped_rpc(): @@ -1754,9 +1772,14 @@ async def test_get_job_async_use_cached_wrapped_rpc(transport: str = "grpc_async @pytest.mark.asyncio -async def test_get_job_async( - transport: str = "grpc_asyncio", request_type=jobs.GetJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + jobs.GetJobRequest(), + {}, + ], +) +async def test_get_job_async(request_type, transport: str = "grpc_asyncio"): client = JobsV1Beta3AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1764,7 +1787,7 @@ async def test_get_job_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_job), "__call__") as call: @@ -1817,11 +1840,6 @@ async def test_get_job_async( assert response.pausable 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 = JobsV1Beta3Client( credentials=ga_credentials.AnonymousCredentials(), @@ -1888,8 +1906,8 @@ async def test_get_job_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - jobs.UpdateJobRequest, - dict, + jobs.UpdateJobRequest(), + {}, ], ) def test_update_job(request_type, transport: str = "grpc"): @@ -1900,7 +1918,7 @@ def test_update_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(type(client.transport.update_job), "__call__") as call: @@ -1976,11 +1994,12 @@ def test_update_job_non_empty_request_with_auto_populated_field(): client.update_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == jobs.UpdateJobRequest( + request_msg = jobs.UpdateJobRequest( project_id="project_id_value", job_id="job_id_value", location="location_value", ) + assert args[0] == request_msg def test_update_job_use_cached_wrapped_rpc(): @@ -2059,9 +2078,14 @@ async def test_update_job_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_update_job_async( - transport: str = "grpc_asyncio", request_type=jobs.UpdateJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + jobs.UpdateJobRequest(), + {}, + ], +) +async def test_update_job_async(request_type, transport: str = "grpc_asyncio"): client = JobsV1Beta3AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2069,7 +2093,7 @@ async def test_update_job_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_job), "__call__") as call: @@ -2122,11 +2146,6 @@ async def test_update_job_async( assert response.pausable is True -@pytest.mark.asyncio -async def test_update_job_async_from_dict(): - await test_update_job_async(request_type=dict) - - def test_update_job_field_headers(): client = JobsV1Beta3Client( credentials=ga_credentials.AnonymousCredentials(), @@ -2193,8 +2212,8 @@ async def test_update_job_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - jobs.ListJobsRequest, - dict, + jobs.ListJobsRequest(), + {}, ], ) def test_list_jobs(request_type, transport: str = "grpc"): @@ -2205,7 +2224,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(type(client.transport.list_jobs), "__call__") as call: @@ -2252,12 +2271,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] == jobs.ListJobsRequest( + request_msg = jobs.ListJobsRequest( project_id="project_id_value", page_token="page_token_value", location="location_value", name="name_value", ) + assert args[0] == request_msg def test_list_jobs_use_cached_wrapped_rpc(): @@ -2336,9 +2356,14 @@ async def test_list_jobs_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_list_jobs_async( - transport: str = "grpc_asyncio", request_type=jobs.ListJobsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + jobs.ListJobsRequest(), + {}, + ], +) +async def test_list_jobs_async(request_type, transport: str = "grpc_asyncio"): client = JobsV1Beta3AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2346,7 +2371,7 @@ async def test_list_jobs_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_jobs), "__call__") as call: @@ -2369,11 +2394,6 @@ async def test_list_jobs_async( assert response.next_page_token == "next_page_token_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 = JobsV1Beta3Client( credentials=ga_credentials.AnonymousCredentials(), @@ -2635,8 +2655,8 @@ async def test_list_jobs_async_pages(): @pytest.mark.parametrize( "request_type", [ - jobs.ListJobsRequest, - dict, + jobs.ListJobsRequest(), + {}, ], ) def test_aggregated_list_jobs(request_type, transport: str = "grpc"): @@ -2647,7 +2667,7 @@ def test_aggregated_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( @@ -2698,12 +2718,13 @@ def test_aggregated_list_jobs_non_empty_request_with_auto_populated_field(): client.aggregated_list_jobs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == jobs.ListJobsRequest( + request_msg = jobs.ListJobsRequest( project_id="project_id_value", page_token="page_token_value", location="location_value", name="name_value", ) + assert args[0] == request_msg def test_aggregated_list_jobs_use_cached_wrapped_rpc(): @@ -2788,8 +2809,15 @@ async def test_aggregated_list_jobs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + jobs.ListJobsRequest(), + {}, + ], +) async def test_aggregated_list_jobs_async( - transport: str = "grpc_asyncio", request_type=jobs.ListJobsRequest + request_type, transport: str = "grpc_asyncio" ): client = JobsV1Beta3AsyncClient( credentials=async_anonymous_credentials(), @@ -2798,7 +2826,7 @@ async def test_aggregated_list_jobs_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( @@ -2823,11 +2851,6 @@ async def test_aggregated_list_jobs_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_aggregated_list_jobs_async_from_dict(): - await test_aggregated_list_jobs_async(request_type=dict) - - def test_aggregated_list_jobs_field_headers(): client = JobsV1Beta3Client( credentials=ga_credentials.AnonymousCredentials(), @@ -3094,8 +3117,8 @@ async def test_aggregated_list_jobs_async_pages(): @pytest.mark.parametrize( "request_type", [ - jobs.CheckActiveJobsRequest, - dict, + jobs.CheckActiveJobsRequest(), + {}, ], ) def test_check_active_jobs(request_type, transport: str = "grpc"): @@ -3106,7 +3129,7 @@ def test_check_active_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( @@ -3154,9 +3177,10 @@ def test_check_active_jobs_non_empty_request_with_auto_populated_field(): client.check_active_jobs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == jobs.CheckActiveJobsRequest( + request_msg = jobs.CheckActiveJobsRequest( project_id="project_id_value", ) + assert args[0] == request_msg def test_check_active_jobs_use_cached_wrapped_rpc(): @@ -3239,9 +3263,14 @@ async def test_check_active_jobs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_check_active_jobs_async( - transport: str = "grpc_asyncio", request_type=jobs.CheckActiveJobsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + jobs.CheckActiveJobsRequest(), + {}, + ], +) +async def test_check_active_jobs_async(request_type, transport: str = "grpc_asyncio"): client = JobsV1Beta3AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3249,7 +3278,7 @@ async def test_check_active_jobs_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( @@ -3274,16 +3303,11 @@ async def test_check_active_jobs_async( assert response.active_jobs_exist is True -@pytest.mark.asyncio -async def test_check_active_jobs_async_from_dict(): - await test_check_active_jobs_async(request_type=dict) - - @pytest.mark.parametrize( "request_type", [ - jobs.SnapshotJobRequest, - dict, + jobs.SnapshotJobRequest(), + {}, ], ) def test_snapshot_job(request_type, transport: str = "grpc"): @@ -3294,7 +3318,7 @@ def test_snapshot_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(type(client.transport.snapshot_job), "__call__") as call: @@ -3353,12 +3377,13 @@ def test_snapshot_job_non_empty_request_with_auto_populated_field(): client.snapshot_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == jobs.SnapshotJobRequest( + request_msg = jobs.SnapshotJobRequest( project_id="project_id_value", job_id="job_id_value", location="location_value", description="description_value", ) + assert args[0] == request_msg def test_snapshot_job_use_cached_wrapped_rpc(): @@ -3439,9 +3464,14 @@ async def test_snapshot_job_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_snapshot_job_async( - transport: str = "grpc_asyncio", request_type=jobs.SnapshotJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + jobs.SnapshotJobRequest(), + {}, + ], +) +async def test_snapshot_job_async(request_type, transport: str = "grpc_asyncio"): client = JobsV1Beta3AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3449,7 +3479,7 @@ async def test_snapshot_job_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.snapshot_job), "__call__") as call: @@ -3484,11 +3514,6 @@ async def test_snapshot_job_async( assert response.region == "region_value" -@pytest.mark.asyncio -async def test_snapshot_job_async_from_dict(): - await test_snapshot_job_async(request_type=dict) - - def test_snapshot_job_field_headers(): client = JobsV1Beta3Client( credentials=ga_credentials.AnonymousCredentials(), @@ -4040,7 +4065,6 @@ def test_create_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = jobs.CreateJobRequest() - assert args[0] == request_msg @@ -4061,7 +4085,6 @@ def test_get_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = jobs.GetJobRequest() - assert args[0] == request_msg @@ -4082,7 +4105,6 @@ def test_update_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = jobs.UpdateJobRequest() - assert args[0] == request_msg @@ -4103,7 +4125,6 @@ def test_list_jobs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = jobs.ListJobsRequest() - assert args[0] == request_msg @@ -4126,7 +4147,6 @@ def test_aggregated_list_jobs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = jobs.ListJobsRequest() - assert args[0] == request_msg @@ -4149,7 +4169,6 @@ def test_check_active_jobs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = jobs.CheckActiveJobsRequest() - assert args[0] == request_msg @@ -4170,7 +4189,6 @@ def test_snapshot_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = jobs.SnapshotJobRequest() - assert args[0] == request_msg @@ -4226,7 +4244,6 @@ async def test_create_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = jobs.CreateJobRequest() - assert args[0] == request_msg @@ -4268,7 +4285,6 @@ async def test_get_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = jobs.GetJobRequest() - assert args[0] == request_msg @@ -4310,7 +4326,6 @@ async def test_update_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = jobs.UpdateJobRequest() - assert args[0] == request_msg @@ -4337,7 +4352,6 @@ async def test_list_jobs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = jobs.ListJobsRequest() - assert args[0] == request_msg @@ -4366,7 +4380,6 @@ async def test_aggregated_list_jobs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = jobs.ListJobsRequest() - assert args[0] == request_msg @@ -4395,7 +4408,6 @@ async def test_check_active_jobs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = jobs.CheckActiveJobsRequest() - assert args[0] == request_msg @@ -4428,7 +4440,6 @@ async def test_snapshot_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = jobs.SnapshotJobRequest() - assert args[0] == request_msg @@ -5967,7 +5978,6 @@ def test_create_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = jobs.CreateJobRequest() - assert args[0] == request_msg @@ -5987,7 +5997,6 @@ def test_get_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = jobs.GetJobRequest() - assert args[0] == request_msg @@ -6007,7 +6016,6 @@ def test_update_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = jobs.UpdateJobRequest() - assert args[0] == request_msg @@ -6027,7 +6035,6 @@ def test_list_jobs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = jobs.ListJobsRequest() - assert args[0] == request_msg @@ -6049,7 +6056,6 @@ def test_aggregated_list_jobs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = jobs.ListJobsRequest() - assert args[0] == request_msg @@ -6071,7 +6077,6 @@ def test_check_active_jobs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = jobs.CheckActiveJobsRequest() - assert args[0] == request_msg @@ -6091,7 +6096,6 @@ def test_snapshot_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = jobs.SnapshotJobRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dataflow-client/tests/unit/gapic/dataflow_v1beta3/test_messages_v1_beta3.py b/packages/google-cloud-dataflow-client/tests/unit/gapic/dataflow_v1beta3/test_messages_v1_beta3.py index e8b3008d7d65..b44df5996635 100644 --- a/packages/google-cloud-dataflow-client/tests/unit/gapic/dataflow_v1beta3/test_messages_v1_beta3.py +++ b/packages/google-cloud-dataflow-client/tests/unit/gapic/dataflow_v1beta3/test_messages_v1_beta3.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 @@ -108,6 +109,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" @@ -1338,8 +1354,8 @@ def test_messages_v1_beta3_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - messages.ListJobMessagesRequest, - dict, + messages.ListJobMessagesRequest(), + {}, ], ) def test_list_job_messages(request_type, transport: str = "grpc"): @@ -1350,7 +1366,7 @@ def test_list_job_messages(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1401,12 +1417,13 @@ def test_list_job_messages_non_empty_request_with_auto_populated_field(): client.list_job_messages(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == messages.ListJobMessagesRequest( + request_msg = messages.ListJobMessagesRequest( project_id="project_id_value", job_id="job_id_value", page_token="page_token_value", location="location_value", ) + assert args[0] == request_msg def test_list_job_messages_use_cached_wrapped_rpc(): @@ -1489,9 +1506,14 @@ async def test_list_job_messages_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_job_messages_async( - transport: str = "grpc_asyncio", request_type=messages.ListJobMessagesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + messages.ListJobMessagesRequest(), + {}, + ], +) +async def test_list_job_messages_async(request_type, transport: str = "grpc_asyncio"): client = MessagesV1Beta3AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1499,7 +1521,7 @@ async def test_list_job_messages_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( @@ -1524,11 +1546,6 @@ async def test_list_job_messages_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_job_messages_async_from_dict(): - await test_list_job_messages_async(request_type=dict) - - def test_list_job_messages_field_headers(): client = MessagesV1Beta3Client( credentials=ga_credentials.AnonymousCredentials(), @@ -2030,7 +2047,6 @@ def test_list_job_messages_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = messages.ListJobMessagesRequest() - assert args[0] == request_msg @@ -2073,7 +2089,6 @@ async def test_list_job_messages_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = messages.ListJobMessagesRequest() - assert args[0] == request_msg @@ -2242,7 +2257,6 @@ def test_list_job_messages_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = messages.ListJobMessagesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dataflow-client/tests/unit/gapic/dataflow_v1beta3/test_metrics_v1_beta3.py b/packages/google-cloud-dataflow-client/tests/unit/gapic/dataflow_v1beta3/test_metrics_v1_beta3.py index f3c87bfcaf50..bf5fb618fd96 100644 --- a/packages/google-cloud-dataflow-client/tests/unit/gapic/dataflow_v1beta3/test_metrics_v1_beta3.py +++ b/packages/google-cloud-dataflow-client/tests/unit/gapic/dataflow_v1beta3/test_metrics_v1_beta3.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 @@ -108,6 +109,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" @@ -1318,8 +1334,8 @@ def test_metrics_v1_beta3_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - metrics.GetJobMetricsRequest, - dict, + metrics.GetJobMetricsRequest(), + {}, ], ) def test_get_job_metrics(request_type, transport: str = "grpc"): @@ -1330,7 +1346,7 @@ def test_get_job_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.get_job_metrics), "__call__") as call: @@ -1373,11 +1389,12 @@ def test_get_job_metrics_non_empty_request_with_auto_populated_field(): client.get_job_metrics(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metrics.GetJobMetricsRequest( + request_msg = metrics.GetJobMetricsRequest( project_id="project_id_value", job_id="job_id_value", location="location_value", ) + assert args[0] == request_msg def test_get_job_metrics_use_cached_wrapped_rpc(): @@ -1458,9 +1475,14 @@ async def test_get_job_metrics_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_job_metrics_async( - transport: str = "grpc_asyncio", request_type=metrics.GetJobMetricsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metrics.GetJobMetricsRequest(), + {}, + ], +) +async def test_get_job_metrics_async(request_type, transport: str = "grpc_asyncio"): client = MetricsV1Beta3AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1468,7 +1490,7 @@ async def test_get_job_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.get_job_metrics), "__call__") as call: @@ -1486,11 +1508,6 @@ async def test_get_job_metrics_async( assert isinstance(response, metrics.JobMetrics) -@pytest.mark.asyncio -async def test_get_job_metrics_async_from_dict(): - await test_get_job_metrics_async(request_type=dict) - - def test_get_job_metrics_field_headers(): client = MetricsV1Beta3Client( credentials=ga_credentials.AnonymousCredentials(), @@ -1557,8 +1574,8 @@ async def test_get_job_metrics_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - metrics.GetJobExecutionDetailsRequest, - dict, + metrics.GetJobExecutionDetailsRequest(), + {}, ], ) def test_get_job_execution_details(request_type, transport: str = "grpc"): @@ -1569,7 +1586,7 @@ def test_get_job_execution_details(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1620,12 +1637,13 @@ def test_get_job_execution_details_non_empty_request_with_auto_populated_field() client.get_job_execution_details(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metrics.GetJobExecutionDetailsRequest( + request_msg = metrics.GetJobExecutionDetailsRequest( project_id="project_id_value", job_id="job_id_value", location="location_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_get_job_execution_details_use_cached_wrapped_rpc(): @@ -1711,8 +1729,15 @@ async def test_get_job_execution_details_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + metrics.GetJobExecutionDetailsRequest(), + {}, + ], +) async def test_get_job_execution_details_async( - transport: str = "grpc_asyncio", request_type=metrics.GetJobExecutionDetailsRequest + request_type, transport: str = "grpc_asyncio" ): client = MetricsV1Beta3AsyncClient( credentials=async_anonymous_credentials(), @@ -1721,7 +1746,7 @@ async def test_get_job_execution_details_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( @@ -1746,11 +1771,6 @@ async def test_get_job_execution_details_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_get_job_execution_details_async_from_dict(): - await test_get_job_execution_details_async(request_type=dict) - - def test_get_job_execution_details_field_headers(): client = MetricsV1Beta3Client( credentials=ga_credentials.AnonymousCredentials(), @@ -2029,8 +2049,8 @@ async def test_get_job_execution_details_async_pages(): @pytest.mark.parametrize( "request_type", [ - metrics.GetStageExecutionDetailsRequest, - dict, + metrics.GetStageExecutionDetailsRequest(), + {}, ], ) def test_get_stage_execution_details(request_type, transport: str = "grpc"): @@ -2041,7 +2061,7 @@ def test_get_stage_execution_details(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2093,13 +2113,14 @@ def test_get_stage_execution_details_non_empty_request_with_auto_populated_field client.get_stage_execution_details(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metrics.GetStageExecutionDetailsRequest( + request_msg = metrics.GetStageExecutionDetailsRequest( project_id="project_id_value", job_id="job_id_value", location="location_value", stage_id="stage_id_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_get_stage_execution_details_use_cached_wrapped_rpc(): @@ -2185,9 +2206,15 @@ async def test_get_stage_execution_details_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + metrics.GetStageExecutionDetailsRequest(), + {}, + ], +) async def test_get_stage_execution_details_async( - transport: str = "grpc_asyncio", - request_type=metrics.GetStageExecutionDetailsRequest, + request_type, transport: str = "grpc_asyncio" ): client = MetricsV1Beta3AsyncClient( credentials=async_anonymous_credentials(), @@ -2196,7 +2223,7 @@ async def test_get_stage_execution_details_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( @@ -2221,11 +2248,6 @@ async def test_get_stage_execution_details_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_get_stage_execution_details_async_from_dict(): - await test_get_stage_execution_details_async(request_type=dict) - - def test_get_stage_execution_details_field_headers(): client = MetricsV1Beta3Client( credentials=ga_credentials.AnonymousCredentials(), @@ -2876,7 +2898,6 @@ def test_get_job_metrics_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metrics.GetJobMetricsRequest() - assert args[0] == request_msg @@ -2899,7 +2920,6 @@ def test_get_job_execution_details_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metrics.GetJobExecutionDetailsRequest() - assert args[0] == request_msg @@ -2922,7 +2942,6 @@ def test_get_stage_execution_details_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metrics.GetStageExecutionDetailsRequest() - assert args[0] == request_msg @@ -2959,7 +2978,6 @@ async def test_get_job_metrics_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metrics.GetJobMetricsRequest() - assert args[0] == request_msg @@ -2988,7 +3006,6 @@ async def test_get_job_execution_details_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metrics.GetJobExecutionDetailsRequest() - assert args[0] == request_msg @@ -3017,7 +3034,6 @@ async def test_get_stage_execution_details_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metrics.GetStageExecutionDetailsRequest() - assert args[0] == request_msg @@ -3451,7 +3467,6 @@ def test_get_job_metrics_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metrics.GetJobMetricsRequest() - assert args[0] == request_msg @@ -3473,7 +3488,6 @@ def test_get_job_execution_details_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metrics.GetJobExecutionDetailsRequest() - assert args[0] == request_msg @@ -3495,7 +3509,6 @@ def test_get_stage_execution_details_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metrics.GetStageExecutionDetailsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dataflow-client/tests/unit/gapic/dataflow_v1beta3/test_snapshots_v1_beta3.py b/packages/google-cloud-dataflow-client/tests/unit/gapic/dataflow_v1beta3/test_snapshots_v1_beta3.py index 9f3d60733d05..13b8aac03c1b 100644 --- a/packages/google-cloud-dataflow-client/tests/unit/gapic/dataflow_v1beta3/test_snapshots_v1_beta3.py +++ b/packages/google-cloud-dataflow-client/tests/unit/gapic/dataflow_v1beta3/test_snapshots_v1_beta3.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 @@ -108,6 +109,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" @@ -1344,8 +1360,8 @@ def test_snapshots_v1_beta3_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - snapshots.GetSnapshotRequest, - dict, + snapshots.GetSnapshotRequest(), + {}, ], ) def test_get_snapshot(request_type, transport: str = "grpc"): @@ -1356,7 +1372,7 @@ def test_get_snapshot(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_snapshot), "__call__") as call: @@ -1414,11 +1430,12 @@ def test_get_snapshot_non_empty_request_with_auto_populated_field(): client.get_snapshot(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == snapshots.GetSnapshotRequest( + request_msg = snapshots.GetSnapshotRequest( project_id="project_id_value", snapshot_id="snapshot_id_value", location="location_value", ) + assert args[0] == request_msg def test_get_snapshot_use_cached_wrapped_rpc(): @@ -1499,9 +1516,14 @@ async def test_get_snapshot_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_snapshot_async( - transport: str = "grpc_asyncio", request_type=snapshots.GetSnapshotRequest -): +@pytest.mark.parametrize( + "request_type", + [ + snapshots.GetSnapshotRequest(), + {}, + ], +) +async def test_get_snapshot_async(request_type, transport: str = "grpc_asyncio"): client = SnapshotsV1Beta3AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1509,7 +1531,7 @@ async def test_get_snapshot_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_snapshot), "__call__") as call: @@ -1544,11 +1566,6 @@ async def test_get_snapshot_async( assert response.region == "region_value" -@pytest.mark.asyncio -async def test_get_snapshot_async_from_dict(): - await test_get_snapshot_async(request_type=dict) - - def test_get_snapshot_field_headers(): client = SnapshotsV1Beta3Client( credentials=ga_credentials.AnonymousCredentials(), @@ -1615,8 +1632,8 @@ async def test_get_snapshot_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - snapshots.DeleteSnapshotRequest, - dict, + snapshots.DeleteSnapshotRequest(), + {}, ], ) def test_delete_snapshot(request_type, transport: str = "grpc"): @@ -1627,7 +1644,7 @@ def test_delete_snapshot(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_snapshot), "__call__") as call: @@ -1670,11 +1687,12 @@ def test_delete_snapshot_non_empty_request_with_auto_populated_field(): client.delete_snapshot(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == snapshots.DeleteSnapshotRequest( + request_msg = snapshots.DeleteSnapshotRequest( project_id="project_id_value", snapshot_id="snapshot_id_value", location="location_value", ) + assert args[0] == request_msg def test_delete_snapshot_use_cached_wrapped_rpc(): @@ -1755,9 +1773,14 @@ async def test_delete_snapshot_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_snapshot_async( - transport: str = "grpc_asyncio", request_type=snapshots.DeleteSnapshotRequest -): +@pytest.mark.parametrize( + "request_type", + [ + snapshots.DeleteSnapshotRequest(), + {}, + ], +) +async def test_delete_snapshot_async(request_type, transport: str = "grpc_asyncio"): client = SnapshotsV1Beta3AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1765,7 +1788,7 @@ async def test_delete_snapshot_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_snapshot), "__call__") as call: @@ -1785,11 +1808,6 @@ async def test_delete_snapshot_async( assert isinstance(response, snapshots.DeleteSnapshotResponse) -@pytest.mark.asyncio -async def test_delete_snapshot_async_from_dict(): - await test_delete_snapshot_async(request_type=dict) - - def test_delete_snapshot_field_headers(): client = SnapshotsV1Beta3Client( credentials=ga_credentials.AnonymousCredentials(), @@ -1858,8 +1876,8 @@ async def test_delete_snapshot_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - snapshots.ListSnapshotsRequest, - dict, + snapshots.ListSnapshotsRequest(), + {}, ], ) def test_list_snapshots(request_type, transport: str = "grpc"): @@ -1870,7 +1888,7 @@ def test_list_snapshots(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_snapshots), "__call__") as call: @@ -1913,11 +1931,12 @@ def test_list_snapshots_non_empty_request_with_auto_populated_field(): client.list_snapshots(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == snapshots.ListSnapshotsRequest( + request_msg = snapshots.ListSnapshotsRequest( project_id="project_id_value", job_id="job_id_value", location="location_value", ) + assert args[0] == request_msg def test_list_snapshots_use_cached_wrapped_rpc(): @@ -1998,9 +2017,14 @@ async def test_list_snapshots_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_snapshots_async( - transport: str = "grpc_asyncio", request_type=snapshots.ListSnapshotsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + snapshots.ListSnapshotsRequest(), + {}, + ], +) +async def test_list_snapshots_async(request_type, transport: str = "grpc_asyncio"): client = SnapshotsV1Beta3AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2008,7 +2032,7 @@ async def test_list_snapshots_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_snapshots), "__call__") as call: @@ -2028,11 +2052,6 @@ async def test_list_snapshots_async( assert isinstance(response, snapshots.ListSnapshotsResponse) -@pytest.mark.asyncio -async def test_list_snapshots_async_from_dict(): - await test_list_snapshots_async(request_type=dict) - - def test_list_snapshots_field_headers(): client = SnapshotsV1Beta3Client( credentials=ga_credentials.AnonymousCredentials(), @@ -2329,7 +2348,6 @@ def test_get_snapshot_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = snapshots.GetSnapshotRequest() - assert args[0] == request_msg @@ -2350,7 +2368,6 @@ def test_delete_snapshot_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = snapshots.DeleteSnapshotRequest() - assert args[0] == request_msg @@ -2371,7 +2388,6 @@ def test_list_snapshots_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = snapshots.ListSnapshotsRequest() - assert args[0] == request_msg @@ -2418,7 +2434,6 @@ async def test_get_snapshot_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = snapshots.GetSnapshotRequest() - assert args[0] == request_msg @@ -2443,7 +2458,6 @@ async def test_delete_snapshot_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = snapshots.DeleteSnapshotRequest() - assert args[0] == request_msg @@ -2468,7 +2482,6 @@ async def test_list_snapshots_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = snapshots.ListSnapshotsRequest() - assert args[0] == request_msg @@ -2911,7 +2924,6 @@ def test_get_snapshot_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = snapshots.GetSnapshotRequest() - assert args[0] == request_msg @@ -2931,7 +2943,6 @@ def test_delete_snapshot_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = snapshots.DeleteSnapshotRequest() - assert args[0] == request_msg @@ -2951,7 +2962,6 @@ def test_list_snapshots_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = snapshots.ListSnapshotsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dataflow-client/tests/unit/gapic/dataflow_v1beta3/test_templates_service.py b/packages/google-cloud-dataflow-client/tests/unit/gapic/dataflow_v1beta3/test_templates_service.py index ffc982ae8c98..1e7ccbcce9cd 100644 --- a/packages/google-cloud-dataflow-client/tests/unit/gapic/dataflow_v1beta3/test_templates_service.py +++ b/packages/google-cloud-dataflow-client/tests/unit/gapic/dataflow_v1beta3/test_templates_service.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 @@ -108,6 +109,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" @@ -1344,8 +1360,8 @@ def test_templates_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - templates.CreateJobFromTemplateRequest, - dict, + templates.CreateJobFromTemplateRequest(), + {}, ], ) def test_create_job_from_template(request_type, transport: str = "grpc"): @@ -1356,7 +1372,7 @@ def test_create_job_from_template(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1437,12 +1453,13 @@ def test_create_job_from_template_non_empty_request_with_auto_populated_field(): client.create_job_from_template(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == templates.CreateJobFromTemplateRequest( + request_msg = templates.CreateJobFromTemplateRequest( project_id="project_id_value", job_name="job_name_value", gcs_path="gcs_path_value", location="location_value", ) + assert args[0] == request_msg def test_create_job_from_template_use_cached_wrapped_rpc(): @@ -1528,8 +1545,15 @@ async def test_create_job_from_template_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + templates.CreateJobFromTemplateRequest(), + {}, + ], +) async def test_create_job_from_template_async( - transport: str = "grpc_asyncio", request_type=templates.CreateJobFromTemplateRequest + request_type, transport: str = "grpc_asyncio" ): client = TemplatesServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1538,7 +1562,7 @@ async def test_create_job_from_template_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( @@ -1593,11 +1617,6 @@ async def test_create_job_from_template_async( assert response.pausable is True -@pytest.mark.asyncio -async def test_create_job_from_template_async_from_dict(): - await test_create_job_from_template_async(request_type=dict) - - def test_create_job_from_template_field_headers(): client = TemplatesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1666,8 +1685,8 @@ async def test_create_job_from_template_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - templates.LaunchTemplateRequest, - dict, + templates.LaunchTemplateRequest(), + {}, ], ) def test_launch_template(request_type, transport: str = "grpc"): @@ -1678,7 +1697,7 @@ def test_launch_template(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.launch_template), "__call__") as call: @@ -1721,11 +1740,12 @@ def test_launch_template_non_empty_request_with_auto_populated_field(): client.launch_template(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == templates.LaunchTemplateRequest( + request_msg = templates.LaunchTemplateRequest( project_id="project_id_value", gcs_path="gcs_path_value", location="location_value", ) + assert args[0] == request_msg def test_launch_template_use_cached_wrapped_rpc(): @@ -1806,9 +1826,14 @@ async def test_launch_template_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_launch_template_async( - transport: str = "grpc_asyncio", request_type=templates.LaunchTemplateRequest -): +@pytest.mark.parametrize( + "request_type", + [ + templates.LaunchTemplateRequest(), + {}, + ], +) +async def test_launch_template_async(request_type, transport: str = "grpc_asyncio"): client = TemplatesServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1816,7 +1841,7 @@ async def test_launch_template_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.launch_template), "__call__") as call: @@ -1836,11 +1861,6 @@ async def test_launch_template_async( assert isinstance(response, templates.LaunchTemplateResponse) -@pytest.mark.asyncio -async def test_launch_template_async_from_dict(): - await test_launch_template_async(request_type=dict) - - def test_launch_template_field_headers(): client = TemplatesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1907,8 +1927,8 @@ async def test_launch_template_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - templates.GetTemplateRequest, - dict, + templates.GetTemplateRequest(), + {}, ], ) def test_get_template(request_type, transport: str = "grpc"): @@ -1919,7 +1939,7 @@ def test_get_template(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_template), "__call__") as call: @@ -1965,11 +1985,12 @@ def test_get_template_non_empty_request_with_auto_populated_field(): client.get_template(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == templates.GetTemplateRequest( + request_msg = templates.GetTemplateRequest( project_id="project_id_value", gcs_path="gcs_path_value", location="location_value", ) + assert args[0] == request_msg def test_get_template_use_cached_wrapped_rpc(): @@ -2050,9 +2071,14 @@ async def test_get_template_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_template_async( - transport: str = "grpc_asyncio", request_type=templates.GetTemplateRequest -): +@pytest.mark.parametrize( + "request_type", + [ + templates.GetTemplateRequest(), + {}, + ], +) +async def test_get_template_async(request_type, transport: str = "grpc_asyncio"): client = TemplatesServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2060,7 +2086,7 @@ async def test_get_template_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_template), "__call__") as call: @@ -2083,11 +2109,6 @@ async def test_get_template_async( assert response.template_type == templates.GetTemplateResponse.TemplateType.LEGACY -@pytest.mark.asyncio -async def test_get_template_async_from_dict(): - await test_get_template_async(request_type=dict) - - def test_get_template_field_headers(): client = TemplatesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2389,7 +2410,6 @@ def test_create_job_from_template_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = templates.CreateJobFromTemplateRequest() - assert args[0] == request_msg @@ -2410,7 +2430,6 @@ def test_launch_template_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = templates.LaunchTemplateRequest() - assert args[0] == request_msg @@ -2431,7 +2450,6 @@ def test_get_template_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = templates.GetTemplateRequest() - assert args[0] == request_msg @@ -2489,7 +2507,6 @@ async def test_create_job_from_template_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = templates.CreateJobFromTemplateRequest() - assert args[0] == request_msg @@ -2514,7 +2531,6 @@ async def test_launch_template_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = templates.LaunchTemplateRequest() - assert args[0] == request_msg @@ -2541,7 +2557,6 @@ async def test_get_template_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = templates.GetTemplateRequest() - assert args[0] == request_msg @@ -3095,7 +3110,6 @@ def test_create_job_from_template_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = templates.CreateJobFromTemplateRequest() - assert args[0] == request_msg @@ -3115,7 +3129,6 @@ def test_launch_template_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = templates.LaunchTemplateRequest() - assert args[0] == request_msg @@ -3135,7 +3148,6 @@ def test_get_template_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = templates.GetTemplateRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dataform/noxfile.py b/packages/google-cloud-dataform/noxfile.py index b8326c999ff3..19c4147fe1de 100644 --- a/packages/google-cloud-dataform/noxfile.py +++ b/packages/google-cloud-dataform/noxfile.py @@ -47,7 +47,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-dataform" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-dataform/setup.py b/packages/google-cloud-dataform/setup.py index ca39b0c2e895..3b2562f571fd 100644 --- a/packages/google-cloud-dataform/setup.py +++ b/packages/google-cloud-dataform/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/google-cloud-dataform/testing/constraints-3.10.txt b/packages/google-cloud-dataform/testing/constraints-3.10.txt index a92801e1c8e2..b39cd54634f9 100644 --- a/packages/google-cloud-dataform/testing/constraints-3.10.txt +++ b/packages/google-cloud-dataform/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/google-cloud-dataform/tests/unit/gapic/dataform_v1/test_dataform.py b/packages/google-cloud-dataform/tests/unit/gapic/dataform_v1/test_dataform.py index 38d4ef14abda..81e4f50cb6f7 100644 --- a/packages/google-cloud-dataform/tests/unit/gapic/dataform_v1/test_dataform.py +++ b/packages/google-cloud-dataform/tests/unit/gapic/dataform_v1/test_dataform.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 @@ -128,6 +129,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" @@ -1275,8 +1291,8 @@ def test_dataform_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - dataform.GetTeamFolderRequest, - dict, + dataform.GetTeamFolderRequest(), + {}, ], ) def test_get_team_folder(request_type, transport: str = "grpc"): @@ -1287,7 +1303,7 @@ def test_get_team_folder(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_team_folder), "__call__") as call: @@ -1337,9 +1353,10 @@ def test_get_team_folder_non_empty_request_with_auto_populated_field(): client.get_team_folder(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.GetTeamFolderRequest( + request_msg = dataform.GetTeamFolderRequest( name="name_value", ) + assert args[0] == request_msg def test_get_team_folder_use_cached_wrapped_rpc(): @@ -1420,9 +1437,14 @@ async def test_get_team_folder_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_team_folder_async( - transport: str = "grpc_asyncio", request_type=dataform.GetTeamFolderRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataform.GetTeamFolderRequest(), + {}, + ], +) +async def test_get_team_folder_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1430,7 +1452,7 @@ async def test_get_team_folder_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_team_folder), "__call__") as call: @@ -1459,11 +1481,6 @@ async def test_get_team_folder_async( assert response.creator_iam_principal == "creator_iam_principal_value" -@pytest.mark.asyncio -async def test_get_team_folder_async_from_dict(): - await test_get_team_folder_async(request_type=dict) - - def test_get_team_folder_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1606,8 +1623,8 @@ async def test_get_team_folder_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dataform.CreateTeamFolderRequest, - dict, + dataform.CreateTeamFolderRequest(), + {}, ], ) def test_create_team_folder(request_type, transport: str = "grpc"): @@ -1618,7 +1635,7 @@ def test_create_team_folder(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1672,9 +1689,10 @@ def test_create_team_folder_non_empty_request_with_auto_populated_field(): client.create_team_folder(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.CreateTeamFolderRequest( + request_msg = dataform.CreateTeamFolderRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_team_folder_use_cached_wrapped_rpc(): @@ -1759,9 +1777,14 @@ async def test_create_team_folder_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_team_folder_async( - transport: str = "grpc_asyncio", request_type=dataform.CreateTeamFolderRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataform.CreateTeamFolderRequest(), + {}, + ], +) +async def test_create_team_folder_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1769,7 +1792,7 @@ async def test_create_team_folder_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( @@ -1800,11 +1823,6 @@ async def test_create_team_folder_async( assert response.creator_iam_principal == "creator_iam_principal_value" -@pytest.mark.asyncio -async def test_create_team_folder_async_from_dict(): - await test_create_team_folder_async(request_type=dict) - - def test_create_team_folder_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1965,8 +1983,8 @@ async def test_create_team_folder_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dataform.UpdateTeamFolderRequest, - dict, + dataform.UpdateTeamFolderRequest(), + {}, ], ) def test_update_team_folder(request_type, transport: str = "grpc"): @@ -1977,7 +1995,7 @@ def test_update_team_folder(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2029,7 +2047,8 @@ def test_update_team_folder_non_empty_request_with_auto_populated_field(): client.update_team_folder(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.UpdateTeamFolderRequest() + request_msg = dataform.UpdateTeamFolderRequest() + assert args[0] == request_msg def test_update_team_folder_use_cached_wrapped_rpc(): @@ -2114,9 +2133,14 @@ async def test_update_team_folder_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_team_folder_async( - transport: str = "grpc_asyncio", request_type=dataform.UpdateTeamFolderRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataform.UpdateTeamFolderRequest(), + {}, + ], +) +async def test_update_team_folder_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2124,7 +2148,7 @@ async def test_update_team_folder_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( @@ -2155,11 +2179,6 @@ async def test_update_team_folder_async( assert response.creator_iam_principal == "creator_iam_principal_value" -@pytest.mark.asyncio -async def test_update_team_folder_async_from_dict(): - await test_update_team_folder_async(request_type=dict) - - def test_update_team_folder_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2320,8 +2339,8 @@ async def test_update_team_folder_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dataform.DeleteTeamFolderRequest, - dict, + dataform.DeleteTeamFolderRequest(), + {}, ], ) def test_delete_team_folder(request_type, transport: str = "grpc"): @@ -2332,7 +2351,7 @@ def test_delete_team_folder(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2377,9 +2396,10 @@ def test_delete_team_folder_non_empty_request_with_auto_populated_field(): client.delete_team_folder(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.DeleteTeamFolderRequest( + request_msg = dataform.DeleteTeamFolderRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_team_folder_use_cached_wrapped_rpc(): @@ -2464,9 +2484,14 @@ async def test_delete_team_folder_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_team_folder_async( - transport: str = "grpc_asyncio", request_type=dataform.DeleteTeamFolderRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataform.DeleteTeamFolderRequest(), + {}, + ], +) +async def test_delete_team_folder_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2474,7 +2499,7 @@ async def test_delete_team_folder_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( @@ -2494,11 +2519,6 @@ async def test_delete_team_folder_async( assert response is None -@pytest.mark.asyncio -async def test_delete_team_folder_async_from_dict(): - await test_delete_team_folder_async(request_type=dict) - - def test_delete_team_folder_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2649,8 +2669,8 @@ async def test_delete_team_folder_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dataform.DeleteTeamFolderTreeRequest, - dict, + dataform.DeleteTeamFolderTreeRequest(), + {}, ], ) def test_delete_team_folder_tree(request_type, transport: str = "grpc"): @@ -2661,7 +2681,7 @@ def test_delete_team_folder_tree(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2706,9 +2726,10 @@ def test_delete_team_folder_tree_non_empty_request_with_auto_populated_field(): client.delete_team_folder_tree(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.DeleteTeamFolderTreeRequest( + request_msg = dataform.DeleteTeamFolderTreeRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_team_folder_tree_use_cached_wrapped_rpc(): @@ -2804,8 +2825,15 @@ async def test_delete_team_folder_tree_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dataform.DeleteTeamFolderTreeRequest(), + {}, + ], +) async def test_delete_team_folder_tree_async( - transport: str = "grpc_asyncio", request_type=dataform.DeleteTeamFolderTreeRequest + request_type, transport: str = "grpc_asyncio" ): client = DataformAsyncClient( credentials=async_anonymous_credentials(), @@ -2814,7 +2842,7 @@ async def test_delete_team_folder_tree_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( @@ -2836,11 +2864,6 @@ async def test_delete_team_folder_tree_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_team_folder_tree_async_from_dict(): - await test_delete_team_folder_tree_async(request_type=dict) - - def test_delete_team_folder_tree_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3005,8 +3028,8 @@ async def test_delete_team_folder_tree_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dataform.QueryTeamFolderContentsRequest, - dict, + dataform.QueryTeamFolderContentsRequest(), + {}, ], ) def test_query_team_folder_contents(request_type, transport: str = "grpc"): @@ -3017,7 +3040,7 @@ def test_query_team_folder_contents(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3068,12 +3091,13 @@ def test_query_team_folder_contents_non_empty_request_with_auto_populated_field( client.query_team_folder_contents(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.QueryTeamFolderContentsRequest( + request_msg = dataform.QueryTeamFolderContentsRequest( team_folder="team_folder_value", page_token="page_token_value", order_by="order_by_value", filter="filter_value", ) + assert args[0] == request_msg def test_query_team_folder_contents_use_cached_wrapped_rpc(): @@ -3159,9 +3183,15 @@ async def test_query_team_folder_contents_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dataform.QueryTeamFolderContentsRequest(), + {}, + ], +) async def test_query_team_folder_contents_async( - transport: str = "grpc_asyncio", - request_type=dataform.QueryTeamFolderContentsRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataformAsyncClient( credentials=async_anonymous_credentials(), @@ -3170,7 +3200,7 @@ async def test_query_team_folder_contents_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( @@ -3195,11 +3225,6 @@ async def test_query_team_folder_contents_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_query_team_folder_contents_async_from_dict(): - await test_query_team_folder_contents_async(request_type=dict) - - def test_query_team_folder_contents_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3564,8 +3589,8 @@ async def test_query_team_folder_contents_async_pages(): @pytest.mark.parametrize( "request_type", [ - dataform.SearchTeamFoldersRequest, - dict, + dataform.SearchTeamFoldersRequest(), + {}, ], ) def test_search_team_folders(request_type, transport: str = "grpc"): @@ -3576,7 +3601,7 @@ def test_search_team_folders(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3627,12 +3652,13 @@ def test_search_team_folders_non_empty_request_with_auto_populated_field(): client.search_team_folders(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.SearchTeamFoldersRequest( + request_msg = dataform.SearchTeamFoldersRequest( location="location_value", page_token="page_token_value", order_by="order_by_value", filter="filter_value", ) + assert args[0] == request_msg def test_search_team_folders_use_cached_wrapped_rpc(): @@ -3717,9 +3743,14 @@ async def test_search_team_folders_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_search_team_folders_async( - transport: str = "grpc_asyncio", request_type=dataform.SearchTeamFoldersRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataform.SearchTeamFoldersRequest(), + {}, + ], +) +async def test_search_team_folders_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3727,7 +3758,7 @@ async def test_search_team_folders_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( @@ -3752,11 +3783,6 @@ async def test_search_team_folders_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_search_team_folders_async_from_dict(): - await test_search_team_folders_async(request_type=dict) - - def test_search_team_folders_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4029,8 +4055,8 @@ async def test_search_team_folders_async_pages(): @pytest.mark.parametrize( "request_type", [ - dataform.GetFolderRequest, - dict, + dataform.GetFolderRequest(), + {}, ], ) def test_get_folder(request_type, transport: str = "grpc"): @@ -4041,7 +4067,7 @@ def test_get_folder(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_folder), "__call__") as call: @@ -4095,9 +4121,10 @@ def test_get_folder_non_empty_request_with_auto_populated_field(): client.get_folder(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.GetFolderRequest( + request_msg = dataform.GetFolderRequest( name="name_value", ) + assert args[0] == request_msg def test_get_folder_use_cached_wrapped_rpc(): @@ -4176,9 +4203,14 @@ async def test_get_folder_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_folder_async( - transport: str = "grpc_asyncio", request_type=dataform.GetFolderRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataform.GetFolderRequest(), + {}, + ], +) +async def test_get_folder_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4186,7 +4218,7 @@ async def test_get_folder_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_folder), "__call__") as call: @@ -4219,11 +4251,6 @@ async def test_get_folder_async( assert response.creator_iam_principal == "creator_iam_principal_value" -@pytest.mark.asyncio -async def test_get_folder_async_from_dict(): - await test_get_folder_async(request_type=dict) - - def test_get_folder_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4366,8 +4393,8 @@ async def test_get_folder_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dataform.CreateFolderRequest, - dict, + dataform.CreateFolderRequest(), + {}, ], ) def test_create_folder(request_type, transport: str = "grpc"): @@ -4378,7 +4405,7 @@ def test_create_folder(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_folder), "__call__") as call: @@ -4432,9 +4459,10 @@ def test_create_folder_non_empty_request_with_auto_populated_field(): client.create_folder(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.CreateFolderRequest( + request_msg = dataform.CreateFolderRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_folder_use_cached_wrapped_rpc(): @@ -4515,9 +4543,14 @@ async def test_create_folder_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_folder_async( - transport: str = "grpc_asyncio", request_type=dataform.CreateFolderRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataform.CreateFolderRequest(), + {}, + ], +) +async def test_create_folder_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4525,7 +4558,7 @@ async def test_create_folder_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_folder), "__call__") as call: @@ -4558,11 +4591,6 @@ async def test_create_folder_async( assert response.creator_iam_principal == "creator_iam_principal_value" -@pytest.mark.asyncio -async def test_create_folder_async_from_dict(): - await test_create_folder_async(request_type=dict) - - def test_create_folder_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4715,8 +4743,8 @@ async def test_create_folder_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dataform.UpdateFolderRequest, - dict, + dataform.UpdateFolderRequest(), + {}, ], ) def test_update_folder(request_type, transport: str = "grpc"): @@ -4727,7 +4755,7 @@ def test_update_folder(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_folder), "__call__") as call: @@ -4779,7 +4807,8 @@ def test_update_folder_non_empty_request_with_auto_populated_field(): client.update_folder(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.UpdateFolderRequest() + request_msg = dataform.UpdateFolderRequest() + assert args[0] == request_msg def test_update_folder_use_cached_wrapped_rpc(): @@ -4860,9 +4889,14 @@ async def test_update_folder_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_folder_async( - transport: str = "grpc_asyncio", request_type=dataform.UpdateFolderRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataform.UpdateFolderRequest(), + {}, + ], +) +async def test_update_folder_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4870,7 +4904,7 @@ async def test_update_folder_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_folder), "__call__") as call: @@ -4903,11 +4937,6 @@ async def test_update_folder_async( assert response.creator_iam_principal == "creator_iam_principal_value" -@pytest.mark.asyncio -async def test_update_folder_async_from_dict(): - await test_update_folder_async(request_type=dict) - - def test_update_folder_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5060,8 +5089,8 @@ async def test_update_folder_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dataform.DeleteFolderRequest, - dict, + dataform.DeleteFolderRequest(), + {}, ], ) def test_delete_folder(request_type, transport: str = "grpc"): @@ -5072,7 +5101,7 @@ def test_delete_folder(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_folder), "__call__") as call: @@ -5113,9 +5142,10 @@ def test_delete_folder_non_empty_request_with_auto_populated_field(): client.delete_folder(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.DeleteFolderRequest( + request_msg = dataform.DeleteFolderRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_folder_use_cached_wrapped_rpc(): @@ -5196,9 +5226,14 @@ async def test_delete_folder_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_folder_async( - transport: str = "grpc_asyncio", request_type=dataform.DeleteFolderRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataform.DeleteFolderRequest(), + {}, + ], +) +async def test_delete_folder_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5206,7 +5241,7 @@ async def test_delete_folder_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_folder), "__call__") as call: @@ -5224,11 +5259,6 @@ async def test_delete_folder_async( assert response is None -@pytest.mark.asyncio -async def test_delete_folder_async_from_dict(): - await test_delete_folder_async(request_type=dict) - - def test_delete_folder_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5371,8 +5401,8 @@ async def test_delete_folder_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dataform.DeleteFolderTreeRequest, - dict, + dataform.DeleteFolderTreeRequest(), + {}, ], ) def test_delete_folder_tree(request_type, transport: str = "grpc"): @@ -5383,7 +5413,7 @@ def test_delete_folder_tree(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5428,9 +5458,10 @@ def test_delete_folder_tree_non_empty_request_with_auto_populated_field(): client.delete_folder_tree(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.DeleteFolderTreeRequest( + request_msg = dataform.DeleteFolderTreeRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_folder_tree_use_cached_wrapped_rpc(): @@ -5525,9 +5556,14 @@ async def test_delete_folder_tree_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_folder_tree_async( - transport: str = "grpc_asyncio", request_type=dataform.DeleteFolderTreeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataform.DeleteFolderTreeRequest(), + {}, + ], +) +async def test_delete_folder_tree_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5535,7 +5571,7 @@ async def test_delete_folder_tree_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( @@ -5557,11 +5593,6 @@ async def test_delete_folder_tree_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_folder_tree_async_from_dict(): - await test_delete_folder_tree_async(request_type=dict) - - def test_delete_folder_tree_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5726,8 +5757,8 @@ async def test_delete_folder_tree_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dataform.QueryFolderContentsRequest, - dict, + dataform.QueryFolderContentsRequest(), + {}, ], ) def test_query_folder_contents(request_type, transport: str = "grpc"): @@ -5738,7 +5769,7 @@ def test_query_folder_contents(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5789,12 +5820,13 @@ def test_query_folder_contents_non_empty_request_with_auto_populated_field(): client.query_folder_contents(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.QueryFolderContentsRequest( + request_msg = dataform.QueryFolderContentsRequest( folder="folder_value", page_token="page_token_value", order_by="order_by_value", filter="filter_value", ) + assert args[0] == request_msg def test_query_folder_contents_use_cached_wrapped_rpc(): @@ -5880,8 +5912,15 @@ async def test_query_folder_contents_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dataform.QueryFolderContentsRequest(), + {}, + ], +) async def test_query_folder_contents_async( - transport: str = "grpc_asyncio", request_type=dataform.QueryFolderContentsRequest + request_type, transport: str = "grpc_asyncio" ): client = DataformAsyncClient( credentials=async_anonymous_credentials(), @@ -5890,7 +5929,7 @@ async def test_query_folder_contents_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( @@ -5915,11 +5954,6 @@ async def test_query_folder_contents_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_query_folder_contents_async_from_dict(): - await test_query_folder_contents_async(request_type=dict) - - def test_query_folder_contents_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6278,8 +6312,8 @@ async def test_query_folder_contents_async_pages(): @pytest.mark.parametrize( "request_type", [ - dataform.QueryUserRootContentsRequest, - dict, + dataform.QueryUserRootContentsRequest(), + {}, ], ) def test_query_user_root_contents(request_type, transport: str = "grpc"): @@ -6290,7 +6324,7 @@ def test_query_user_root_contents(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6341,12 +6375,13 @@ def test_query_user_root_contents_non_empty_request_with_auto_populated_field(): client.query_user_root_contents(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.QueryUserRootContentsRequest( + request_msg = dataform.QueryUserRootContentsRequest( location="location_value", page_token="page_token_value", order_by="order_by_value", filter="filter_value", ) + assert args[0] == request_msg def test_query_user_root_contents_use_cached_wrapped_rpc(): @@ -6432,8 +6467,15 @@ async def test_query_user_root_contents_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dataform.QueryUserRootContentsRequest(), + {}, + ], +) async def test_query_user_root_contents_async( - transport: str = "grpc_asyncio", request_type=dataform.QueryUserRootContentsRequest + request_type, transport: str = "grpc_asyncio" ): client = DataformAsyncClient( credentials=async_anonymous_credentials(), @@ -6442,7 +6484,7 @@ async def test_query_user_root_contents_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( @@ -6467,11 +6509,6 @@ async def test_query_user_root_contents_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_query_user_root_contents_async_from_dict(): - await test_query_user_root_contents_async(request_type=dict) - - def test_query_user_root_contents_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6832,8 +6869,8 @@ async def test_query_user_root_contents_async_pages(): @pytest.mark.parametrize( "request_type", [ - dataform.MoveFolderRequest, - dict, + dataform.MoveFolderRequest(), + {}, ], ) def test_move_folder(request_type, transport: str = "grpc"): @@ -6844,7 +6881,7 @@ def test_move_folder(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.move_folder), "__call__") as call: @@ -6886,10 +6923,11 @@ def test_move_folder_non_empty_request_with_auto_populated_field(): client.move_folder(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.MoveFolderRequest( + request_msg = dataform.MoveFolderRequest( name="name_value", destination_containing_folder="destination_containing_folder_value", ) + assert args[0] == request_msg def test_move_folder_use_cached_wrapped_rpc(): @@ -6980,9 +7018,14 @@ async def test_move_folder_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_move_folder_async( - transport: str = "grpc_asyncio", request_type=dataform.MoveFolderRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataform.MoveFolderRequest(), + {}, + ], +) +async def test_move_folder_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6990,7 +7033,7 @@ async def test_move_folder_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.move_folder), "__call__") as call: @@ -7010,11 +7053,6 @@ async def test_move_folder_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_move_folder_async_from_dict(): - await test_move_folder_async(request_type=dict) - - def test_move_folder_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7171,8 +7209,8 @@ async def test_move_folder_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dataform.ListRepositoriesRequest, - dict, + dataform.ListRepositoriesRequest(), + {}, ], ) def test_list_repositories(request_type, transport: str = "grpc"): @@ -7183,7 +7221,7 @@ def test_list_repositories(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7236,12 +7274,13 @@ def test_list_repositories_non_empty_request_with_auto_populated_field(): client.list_repositories(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.ListRepositoriesRequest( + request_msg = dataform.ListRepositoriesRequest( parent="parent_value", page_token="page_token_value", order_by="order_by_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_repositories_use_cached_wrapped_rpc(): @@ -7324,9 +7363,14 @@ async def test_list_repositories_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_repositories_async( - transport: str = "grpc_asyncio", request_type=dataform.ListRepositoriesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataform.ListRepositoriesRequest(), + {}, + ], +) +async def test_list_repositories_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7334,7 +7378,7 @@ async def test_list_repositories_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( @@ -7361,11 +7405,6 @@ async def test_list_repositories_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_repositories_async_from_dict(): - await test_list_repositories_async(request_type=dict) - - def test_list_repositories_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7718,8 +7757,8 @@ async def test_list_repositories_async_pages(): @pytest.mark.parametrize( "request_type", [ - dataform.GetRepositoryRequest, - dict, + dataform.GetRepositoryRequest(), + {}, ], ) def test_get_repository(request_type, transport: str = "grpc"): @@ -7730,7 +7769,7 @@ def test_get_repository(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_repository), "__call__") as call: @@ -7793,9 +7832,10 @@ def test_get_repository_non_empty_request_with_auto_populated_field(): client.get_repository(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.GetRepositoryRequest( + request_msg = dataform.GetRepositoryRequest( name="name_value", ) + assert args[0] == request_msg def test_get_repository_use_cached_wrapped_rpc(): @@ -7876,9 +7916,14 @@ async def test_get_repository_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_repository_async( - transport: str = "grpc_asyncio", request_type=dataform.GetRepositoryRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataform.GetRepositoryRequest(), + {}, + ], +) +async def test_get_repository_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7886,7 +7931,7 @@ async def test_get_repository_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_repository), "__call__") as call: @@ -7928,11 +7973,6 @@ async def test_get_repository_async( assert response.internal_metadata == "internal_metadata_value" -@pytest.mark.asyncio -async def test_get_repository_async_from_dict(): - await test_get_repository_async(request_type=dict) - - def test_get_repository_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8075,8 +8115,8 @@ async def test_get_repository_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dataform.CreateRepositoryRequest, - dict, + dataform.CreateRepositoryRequest(), + {}, ], ) def test_create_repository(request_type, transport: str = "grpc"): @@ -8087,7 +8127,7 @@ def test_create_repository(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8155,10 +8195,11 @@ def test_create_repository_non_empty_request_with_auto_populated_field(): client.create_repository(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.CreateRepositoryRequest( + request_msg = dataform.CreateRepositoryRequest( parent="parent_value", repository_id="repository_id_value", ) + assert args[0] == request_msg def test_create_repository_use_cached_wrapped_rpc(): @@ -8241,9 +8282,14 @@ async def test_create_repository_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_repository_async( - transport: str = "grpc_asyncio", request_type=dataform.CreateRepositoryRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataform.CreateRepositoryRequest(), + {}, + ], +) +async def test_create_repository_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8251,7 +8297,7 @@ async def test_create_repository_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( @@ -8295,11 +8341,6 @@ async def test_create_repository_async( assert response.internal_metadata == "internal_metadata_value" -@pytest.mark.asyncio -async def test_create_repository_async_from_dict(): - await test_create_repository_async(request_type=dict) - - def test_create_repository_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8470,8 +8511,8 @@ async def test_create_repository_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dataform.UpdateRepositoryRequest, - dict, + dataform.UpdateRepositoryRequest(), + {}, ], ) def test_update_repository(request_type, transport: str = "grpc"): @@ -8482,7 +8523,7 @@ def test_update_repository(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8547,7 +8588,8 @@ def test_update_repository_non_empty_request_with_auto_populated_field(): client.update_repository(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.UpdateRepositoryRequest() + request_msg = dataform.UpdateRepositoryRequest() + assert args[0] == request_msg def test_update_repository_use_cached_wrapped_rpc(): @@ -8630,9 +8672,14 @@ async def test_update_repository_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_repository_async( - transport: str = "grpc_asyncio", request_type=dataform.UpdateRepositoryRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataform.UpdateRepositoryRequest(), + {}, + ], +) +async def test_update_repository_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8640,7 +8687,7 @@ async def test_update_repository_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( @@ -8684,11 +8731,6 @@ async def test_update_repository_async( assert response.internal_metadata == "internal_metadata_value" -@pytest.mark.asyncio -async def test_update_repository_async_from_dict(): - await test_update_repository_async(request_type=dict) - - def test_update_repository_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8849,8 +8891,8 @@ async def test_update_repository_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dataform.DeleteRepositoryRequest, - dict, + dataform.DeleteRepositoryRequest(), + {}, ], ) def test_delete_repository(request_type, transport: str = "grpc"): @@ -8861,7 +8903,7 @@ def test_delete_repository(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8906,9 +8948,10 @@ def test_delete_repository_non_empty_request_with_auto_populated_field(): client.delete_repository(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.DeleteRepositoryRequest( + request_msg = dataform.DeleteRepositoryRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_repository_use_cached_wrapped_rpc(): @@ -8991,9 +9034,14 @@ async def test_delete_repository_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_repository_async( - transport: str = "grpc_asyncio", request_type=dataform.DeleteRepositoryRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataform.DeleteRepositoryRequest(), + {}, + ], +) +async def test_delete_repository_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9001,7 +9049,7 @@ async def test_delete_repository_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( @@ -9021,11 +9069,6 @@ async def test_delete_repository_async( assert response is None -@pytest.mark.asyncio -async def test_delete_repository_async_from_dict(): - await test_delete_repository_async(request_type=dict) - - def test_delete_repository_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9176,8 +9219,8 @@ async def test_delete_repository_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dataform.MoveRepositoryRequest, - dict, + dataform.MoveRepositoryRequest(), + {}, ], ) def test_move_repository(request_type, transport: str = "grpc"): @@ -9188,7 +9231,7 @@ def test_move_repository(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.move_repository), "__call__") as call: @@ -9230,10 +9273,11 @@ def test_move_repository_non_empty_request_with_auto_populated_field(): client.move_repository(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.MoveRepositoryRequest( + request_msg = dataform.MoveRepositoryRequest( name="name_value", destination_containing_folder="destination_containing_folder_value", ) + assert args[0] == request_msg def test_move_repository_use_cached_wrapped_rpc(): @@ -9324,9 +9368,14 @@ async def test_move_repository_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_move_repository_async( - transport: str = "grpc_asyncio", request_type=dataform.MoveRepositoryRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataform.MoveRepositoryRequest(), + {}, + ], +) +async def test_move_repository_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9334,7 +9383,7 @@ async def test_move_repository_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.move_repository), "__call__") as call: @@ -9354,11 +9403,6 @@ async def test_move_repository_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_move_repository_async_from_dict(): - await test_move_repository_async(request_type=dict) - - def test_move_repository_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9515,8 +9559,8 @@ async def test_move_repository_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dataform.CommitRepositoryChangesRequest, - dict, + dataform.CommitRepositoryChangesRequest(), + {}, ], ) def test_commit_repository_changes(request_type, transport: str = "grpc"): @@ -9527,7 +9571,7 @@ def test_commit_repository_changes(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9576,10 +9620,11 @@ def test_commit_repository_changes_non_empty_request_with_auto_populated_field() client.commit_repository_changes(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.CommitRepositoryChangesRequest( + request_msg = dataform.CommitRepositoryChangesRequest( name="name_value", required_head_commit_sha="required_head_commit_sha_value", ) + assert args[0] == request_msg def test_commit_repository_changes_use_cached_wrapped_rpc(): @@ -9665,9 +9710,15 @@ async def test_commit_repository_changes_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dataform.CommitRepositoryChangesRequest(), + {}, + ], +) async def test_commit_repository_changes_async( - transport: str = "grpc_asyncio", - request_type=dataform.CommitRepositoryChangesRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataformAsyncClient( credentials=async_anonymous_credentials(), @@ -9676,7 +9727,7 @@ async def test_commit_repository_changes_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( @@ -9701,11 +9752,6 @@ async def test_commit_repository_changes_async( assert response.commit_sha == "commit_sha_value" -@pytest.mark.asyncio -async def test_commit_repository_changes_async_from_dict(): - await test_commit_repository_changes_async(request_type=dict) - - def test_commit_repository_changes_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9774,8 +9820,8 @@ async def test_commit_repository_changes_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - dataform.ReadRepositoryFileRequest, - dict, + dataform.ReadRepositoryFileRequest(), + {}, ], ) def test_read_repository_file(request_type, transport: str = "grpc"): @@ -9786,7 +9832,7 @@ def test_read_repository_file(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9836,11 +9882,12 @@ def test_read_repository_file_non_empty_request_with_auto_populated_field(): client.read_repository_file(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.ReadRepositoryFileRequest( + request_msg = dataform.ReadRepositoryFileRequest( name="name_value", commit_sha="commit_sha_value", path="path_value", ) + assert args[0] == request_msg def test_read_repository_file_use_cached_wrapped_rpc(): @@ -9925,8 +9972,15 @@ async def test_read_repository_file_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dataform.ReadRepositoryFileRequest(), + {}, + ], +) async def test_read_repository_file_async( - transport: str = "grpc_asyncio", request_type=dataform.ReadRepositoryFileRequest + request_type, transport: str = "grpc_asyncio" ): client = DataformAsyncClient( credentials=async_anonymous_credentials(), @@ -9935,7 +9989,7 @@ async def test_read_repository_file_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( @@ -9960,11 +10014,6 @@ async def test_read_repository_file_async( assert response.contents == b"contents_blob" -@pytest.mark.asyncio -async def test_read_repository_file_async_from_dict(): - await test_read_repository_file_async(request_type=dict) - - def test_read_repository_file_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10033,8 +10082,8 @@ async def test_read_repository_file_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - dataform.QueryRepositoryDirectoryContentsRequest, - dict, + dataform.QueryRepositoryDirectoryContentsRequest(), + {}, ], ) def test_query_repository_directory_contents(request_type, transport: str = "grpc"): @@ -10045,7 +10094,7 @@ def test_query_repository_directory_contents(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( @@ -10096,12 +10145,13 @@ def test_query_repository_directory_contents_non_empty_request_with_auto_populat client.query_repository_directory_contents(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.QueryRepositoryDirectoryContentsRequest( + request_msg = dataform.QueryRepositoryDirectoryContentsRequest( name="name_value", commit_sha="commit_sha_value", path="path_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_query_repository_directory_contents_use_cached_wrapped_rpc(): @@ -10187,9 +10237,15 @@ async def test_query_repository_directory_contents_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dataform.QueryRepositoryDirectoryContentsRequest(), + {}, + ], +) async def test_query_repository_directory_contents_async( - transport: str = "grpc_asyncio", - request_type=dataform.QueryRepositoryDirectoryContentsRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataformAsyncClient( credentials=async_anonymous_credentials(), @@ -10198,7 +10254,7 @@ async def test_query_repository_directory_contents_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( @@ -10223,11 +10279,6 @@ async def test_query_repository_directory_contents_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_query_repository_directory_contents_async_from_dict(): - await test_query_repository_directory_contents_async(request_type=dict) - - def test_query_repository_directory_contents_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10498,8 +10549,8 @@ async def test_query_repository_directory_contents_async_pages(): @pytest.mark.parametrize( "request_type", [ - dataform.FetchRepositoryHistoryRequest, - dict, + dataform.FetchRepositoryHistoryRequest(), + {}, ], ) def test_fetch_repository_history(request_type, transport: str = "grpc"): @@ -10510,7 +10561,7 @@ def test_fetch_repository_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( @@ -10559,10 +10610,11 @@ def test_fetch_repository_history_non_empty_request_with_auto_populated_field(): client.fetch_repository_history(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.FetchRepositoryHistoryRequest( + request_msg = dataform.FetchRepositoryHistoryRequest( name="name_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_fetch_repository_history_use_cached_wrapped_rpc(): @@ -10648,8 +10700,15 @@ async def test_fetch_repository_history_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dataform.FetchRepositoryHistoryRequest(), + {}, + ], +) async def test_fetch_repository_history_async( - transport: str = "grpc_asyncio", request_type=dataform.FetchRepositoryHistoryRequest + request_type, transport: str = "grpc_asyncio" ): client = DataformAsyncClient( credentials=async_anonymous_credentials(), @@ -10658,7 +10717,7 @@ async def test_fetch_repository_history_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( @@ -10683,11 +10742,6 @@ async def test_fetch_repository_history_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_fetch_repository_history_async_from_dict(): - await test_fetch_repository_history_async(request_type=dict) - - def test_fetch_repository_history_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10956,8 +11010,8 @@ async def test_fetch_repository_history_async_pages(): @pytest.mark.parametrize( "request_type", [ - dataform.ComputeRepositoryAccessTokenStatusRequest, - dict, + dataform.ComputeRepositoryAccessTokenStatusRequest(), + {}, ], ) def test_compute_repository_access_token_status(request_type, transport: str = "grpc"): @@ -10968,7 +11022,7 @@ def test_compute_repository_access_token_status(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( @@ -11019,9 +11073,10 @@ def test_compute_repository_access_token_status_non_empty_request_with_auto_popu client.compute_repository_access_token_status(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.ComputeRepositoryAccessTokenStatusRequest( + request_msg = dataform.ComputeRepositoryAccessTokenStatusRequest( name="name_value", ) + assert args[0] == request_msg def test_compute_repository_access_token_status_use_cached_wrapped_rpc(): @@ -11107,9 +11162,15 @@ async def test_compute_repository_access_token_status_async_use_cached_wrapped_r @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dataform.ComputeRepositoryAccessTokenStatusRequest(), + {}, + ], +) async def test_compute_repository_access_token_status_async( - transport: str = "grpc_asyncio", - request_type=dataform.ComputeRepositoryAccessTokenStatusRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataformAsyncClient( credentials=async_anonymous_credentials(), @@ -11118,7 +11179,7 @@ async def test_compute_repository_access_token_status_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( @@ -11146,11 +11207,6 @@ async def test_compute_repository_access_token_status_async( ) -@pytest.mark.asyncio -async def test_compute_repository_access_token_status_async_from_dict(): - await test_compute_repository_access_token_status_async(request_type=dict) - - def test_compute_repository_access_token_status_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11219,8 +11275,8 @@ async def test_compute_repository_access_token_status_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - dataform.FetchRemoteBranchesRequest, - dict, + dataform.FetchRemoteBranchesRequest(), + {}, ], ) def test_fetch_remote_branches(request_type, transport: str = "grpc"): @@ -11231,7 +11287,7 @@ def test_fetch_remote_branches(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11279,9 +11335,10 @@ def test_fetch_remote_branches_non_empty_request_with_auto_populated_field(): client.fetch_remote_branches(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.FetchRemoteBranchesRequest( + request_msg = dataform.FetchRemoteBranchesRequest( name="name_value", ) + assert args[0] == request_msg def test_fetch_remote_branches_use_cached_wrapped_rpc(): @@ -11367,8 +11424,15 @@ async def test_fetch_remote_branches_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dataform.FetchRemoteBranchesRequest(), + {}, + ], +) async def test_fetch_remote_branches_async( - transport: str = "grpc_asyncio", request_type=dataform.FetchRemoteBranchesRequest + request_type, transport: str = "grpc_asyncio" ): client = DataformAsyncClient( credentials=async_anonymous_credentials(), @@ -11377,7 +11441,7 @@ async def test_fetch_remote_branches_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( @@ -11402,11 +11466,6 @@ async def test_fetch_remote_branches_async( assert response.branches == ["branches_value"] -@pytest.mark.asyncio -async def test_fetch_remote_branches_async_from_dict(): - await test_fetch_remote_branches_async(request_type=dict) - - def test_fetch_remote_branches_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11475,8 +11534,8 @@ async def test_fetch_remote_branches_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - dataform.ListWorkspacesRequest, - dict, + dataform.ListWorkspacesRequest(), + {}, ], ) def test_list_workspaces(request_type, transport: str = "grpc"): @@ -11487,7 +11546,7 @@ def test_list_workspaces(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_workspaces), "__call__") as call: @@ -11536,12 +11595,13 @@ def test_list_workspaces_non_empty_request_with_auto_populated_field(): client.list_workspaces(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.ListWorkspacesRequest( + request_msg = dataform.ListWorkspacesRequest( parent="parent_value", page_token="page_token_value", order_by="order_by_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_workspaces_use_cached_wrapped_rpc(): @@ -11622,9 +11682,14 @@ async def test_list_workspaces_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_workspaces_async( - transport: str = "grpc_asyncio", request_type=dataform.ListWorkspacesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataform.ListWorkspacesRequest(), + {}, + ], +) +async def test_list_workspaces_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11632,7 +11697,7 @@ async def test_list_workspaces_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_workspaces), "__call__") as call: @@ -11657,11 +11722,6 @@ async def test_list_workspaces_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_workspaces_async_from_dict(): - await test_list_workspaces_async(request_type=dict) - - def test_list_workspaces_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11998,8 +12058,8 @@ async def test_list_workspaces_async_pages(): @pytest.mark.parametrize( "request_type", [ - dataform.GetWorkspaceRequest, - dict, + dataform.GetWorkspaceRequest(), + {}, ], ) def test_get_workspace(request_type, transport: str = "grpc"): @@ -12010,7 +12070,7 @@ def test_get_workspace(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_workspace), "__call__") as call: @@ -12058,9 +12118,10 @@ def test_get_workspace_non_empty_request_with_auto_populated_field(): client.get_workspace(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.GetWorkspaceRequest( + request_msg = dataform.GetWorkspaceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_workspace_use_cached_wrapped_rpc(): @@ -12141,9 +12202,14 @@ async def test_get_workspace_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_workspace_async( - transport: str = "grpc_asyncio", request_type=dataform.GetWorkspaceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataform.GetWorkspaceRequest(), + {}, + ], +) +async def test_get_workspace_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12151,7 +12217,7 @@ async def test_get_workspace_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_workspace), "__call__") as call: @@ -12178,11 +12244,6 @@ async def test_get_workspace_async( assert response.disable_moves is True -@pytest.mark.asyncio -async def test_get_workspace_async_from_dict(): - await test_get_workspace_async(request_type=dict) - - def test_get_workspace_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12325,8 +12386,8 @@ async def test_get_workspace_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dataform.CreateWorkspaceRequest, - dict, + dataform.CreateWorkspaceRequest(), + {}, ], ) def test_create_workspace(request_type, transport: str = "grpc"): @@ -12337,7 +12398,7 @@ def test_create_workspace(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_workspace), "__call__") as call: @@ -12386,10 +12447,11 @@ def test_create_workspace_non_empty_request_with_auto_populated_field(): client.create_workspace(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.CreateWorkspaceRequest( + request_msg = dataform.CreateWorkspaceRequest( parent="parent_value", workspace_id="workspace_id_value", ) + assert args[0] == request_msg def test_create_workspace_use_cached_wrapped_rpc(): @@ -12472,9 +12534,14 @@ async def test_create_workspace_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_workspace_async( - transport: str = "grpc_asyncio", request_type=dataform.CreateWorkspaceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataform.CreateWorkspaceRequest(), + {}, + ], +) +async def test_create_workspace_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12482,7 +12549,7 @@ async def test_create_workspace_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_workspace), "__call__") as call: @@ -12509,11 +12576,6 @@ async def test_create_workspace_async( assert response.disable_moves is True -@pytest.mark.asyncio -async def test_create_workspace_async_from_dict(): - await test_create_workspace_async(request_type=dict) - - def test_create_workspace_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12676,8 +12738,8 @@ async def test_create_workspace_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dataform.DeleteWorkspaceRequest, - dict, + dataform.DeleteWorkspaceRequest(), + {}, ], ) def test_delete_workspace(request_type, transport: str = "grpc"): @@ -12688,7 +12750,7 @@ def test_delete_workspace(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_workspace), "__call__") as call: @@ -12729,9 +12791,10 @@ def test_delete_workspace_non_empty_request_with_auto_populated_field(): client.delete_workspace(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.DeleteWorkspaceRequest( + request_msg = dataform.DeleteWorkspaceRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_workspace_use_cached_wrapped_rpc(): @@ -12814,9 +12877,14 @@ async def test_delete_workspace_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_workspace_async( - transport: str = "grpc_asyncio", request_type=dataform.DeleteWorkspaceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataform.DeleteWorkspaceRequest(), + {}, + ], +) +async def test_delete_workspace_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12824,7 +12892,7 @@ async def test_delete_workspace_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_workspace), "__call__") as call: @@ -12842,11 +12910,6 @@ async def test_delete_workspace_async( assert response is None -@pytest.mark.asyncio -async def test_delete_workspace_async_from_dict(): - await test_delete_workspace_async(request_type=dict) - - def test_delete_workspace_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12989,8 +13052,8 @@ async def test_delete_workspace_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dataform.InstallNpmPackagesRequest, - dict, + dataform.InstallNpmPackagesRequest(), + {}, ], ) def test_install_npm_packages(request_type, transport: str = "grpc"): @@ -13001,7 +13064,7 @@ def test_install_npm_packages(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -13046,9 +13109,10 @@ def test_install_npm_packages_non_empty_request_with_auto_populated_field(): client.install_npm_packages(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.InstallNpmPackagesRequest( + request_msg = dataform.InstallNpmPackagesRequest( workspace="workspace_value", ) + assert args[0] == request_msg def test_install_npm_packages_use_cached_wrapped_rpc(): @@ -13133,8 +13197,15 @@ async def test_install_npm_packages_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dataform.InstallNpmPackagesRequest(), + {}, + ], +) async def test_install_npm_packages_async( - transport: str = "grpc_asyncio", request_type=dataform.InstallNpmPackagesRequest + request_type, transport: str = "grpc_asyncio" ): client = DataformAsyncClient( credentials=async_anonymous_credentials(), @@ -13143,7 +13214,7 @@ async def test_install_npm_packages_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( @@ -13165,11 +13236,6 @@ async def test_install_npm_packages_async( assert isinstance(response, dataform.InstallNpmPackagesResponse) -@pytest.mark.asyncio -async def test_install_npm_packages_async_from_dict(): - await test_install_npm_packages_async(request_type=dict) - - def test_install_npm_packages_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13238,8 +13304,8 @@ async def test_install_npm_packages_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - dataform.PullGitCommitsRequest, - dict, + dataform.PullGitCommitsRequest(), + {}, ], ) def test_pull_git_commits(request_type, transport: str = "grpc"): @@ -13250,7 +13316,7 @@ def test_pull_git_commits(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.pull_git_commits), "__call__") as call: @@ -13292,10 +13358,11 @@ def test_pull_git_commits_non_empty_request_with_auto_populated_field(): client.pull_git_commits(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.PullGitCommitsRequest( + request_msg = dataform.PullGitCommitsRequest( name="name_value", remote_branch="remote_branch_value", ) + assert args[0] == request_msg def test_pull_git_commits_use_cached_wrapped_rpc(): @@ -13378,9 +13445,14 @@ async def test_pull_git_commits_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_pull_git_commits_async( - transport: str = "grpc_asyncio", request_type=dataform.PullGitCommitsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataform.PullGitCommitsRequest(), + {}, + ], +) +async def test_pull_git_commits_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13388,7 +13460,7 @@ async def test_pull_git_commits_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.pull_git_commits), "__call__") as call: @@ -13408,11 +13480,6 @@ async def test_pull_git_commits_async( assert isinstance(response, dataform.PullGitCommitsResponse) -@pytest.mark.asyncio -async def test_pull_git_commits_async_from_dict(): - await test_pull_git_commits_async(request_type=dict) - - def test_pull_git_commits_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13477,8 +13544,8 @@ async def test_pull_git_commits_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - dataform.PushGitCommitsRequest, - dict, + dataform.PushGitCommitsRequest(), + {}, ], ) def test_push_git_commits(request_type, transport: str = "grpc"): @@ -13489,7 +13556,7 @@ def test_push_git_commits(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.push_git_commits), "__call__") as call: @@ -13531,10 +13598,11 @@ def test_push_git_commits_non_empty_request_with_auto_populated_field(): client.push_git_commits(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.PushGitCommitsRequest( + request_msg = dataform.PushGitCommitsRequest( name="name_value", remote_branch="remote_branch_value", ) + assert args[0] == request_msg def test_push_git_commits_use_cached_wrapped_rpc(): @@ -13617,9 +13685,14 @@ async def test_push_git_commits_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_push_git_commits_async( - transport: str = "grpc_asyncio", request_type=dataform.PushGitCommitsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataform.PushGitCommitsRequest(), + {}, + ], +) +async def test_push_git_commits_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13627,7 +13700,7 @@ async def test_push_git_commits_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.push_git_commits), "__call__") as call: @@ -13647,11 +13720,6 @@ async def test_push_git_commits_async( assert isinstance(response, dataform.PushGitCommitsResponse) -@pytest.mark.asyncio -async def test_push_git_commits_async_from_dict(): - await test_push_git_commits_async(request_type=dict) - - def test_push_git_commits_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13716,8 +13784,8 @@ async def test_push_git_commits_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - dataform.FetchFileGitStatusesRequest, - dict, + dataform.FetchFileGitStatusesRequest(), + {}, ], ) def test_fetch_file_git_statuses(request_type, transport: str = "grpc"): @@ -13728,7 +13796,7 @@ def test_fetch_file_git_statuses(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -13773,9 +13841,10 @@ def test_fetch_file_git_statuses_non_empty_request_with_auto_populated_field(): client.fetch_file_git_statuses(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.FetchFileGitStatusesRequest( + request_msg = dataform.FetchFileGitStatusesRequest( name="name_value", ) + assert args[0] == request_msg def test_fetch_file_git_statuses_use_cached_wrapped_rpc(): @@ -13861,8 +13930,15 @@ async def test_fetch_file_git_statuses_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dataform.FetchFileGitStatusesRequest(), + {}, + ], +) async def test_fetch_file_git_statuses_async( - transport: str = "grpc_asyncio", request_type=dataform.FetchFileGitStatusesRequest + request_type, transport: str = "grpc_asyncio" ): client = DataformAsyncClient( credentials=async_anonymous_credentials(), @@ -13871,7 +13947,7 @@ async def test_fetch_file_git_statuses_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( @@ -13893,11 +13969,6 @@ async def test_fetch_file_git_statuses_async( assert isinstance(response, dataform.FetchFileGitStatusesResponse) -@pytest.mark.asyncio -async def test_fetch_file_git_statuses_async_from_dict(): - await test_fetch_file_git_statuses_async(request_type=dict) - - def test_fetch_file_git_statuses_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13966,8 +14037,8 @@ async def test_fetch_file_git_statuses_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - dataform.FetchGitAheadBehindRequest, - dict, + dataform.FetchGitAheadBehindRequest(), + {}, ], ) def test_fetch_git_ahead_behind(request_type, transport: str = "grpc"): @@ -13978,7 +14049,7 @@ def test_fetch_git_ahead_behind(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -14029,10 +14100,11 @@ def test_fetch_git_ahead_behind_non_empty_request_with_auto_populated_field(): client.fetch_git_ahead_behind(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.FetchGitAheadBehindRequest( + request_msg = dataform.FetchGitAheadBehindRequest( name="name_value", remote_branch="remote_branch_value", ) + assert args[0] == request_msg def test_fetch_git_ahead_behind_use_cached_wrapped_rpc(): @@ -14118,8 +14190,15 @@ async def test_fetch_git_ahead_behind_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dataform.FetchGitAheadBehindRequest(), + {}, + ], +) async def test_fetch_git_ahead_behind_async( - transport: str = "grpc_asyncio", request_type=dataform.FetchGitAheadBehindRequest + request_type, transport: str = "grpc_asyncio" ): client = DataformAsyncClient( credentials=async_anonymous_credentials(), @@ -14128,7 +14207,7 @@ async def test_fetch_git_ahead_behind_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( @@ -14155,11 +14234,6 @@ async def test_fetch_git_ahead_behind_async( assert response.commits_behind == 1477 -@pytest.mark.asyncio -async def test_fetch_git_ahead_behind_async_from_dict(): - await test_fetch_git_ahead_behind_async(request_type=dict) - - def test_fetch_git_ahead_behind_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14228,8 +14302,8 @@ async def test_fetch_git_ahead_behind_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - dataform.CommitWorkspaceChangesRequest, - dict, + dataform.CommitWorkspaceChangesRequest(), + {}, ], ) def test_commit_workspace_changes(request_type, transport: str = "grpc"): @@ -14240,7 +14314,7 @@ def test_commit_workspace_changes(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -14286,10 +14360,11 @@ def test_commit_workspace_changes_non_empty_request_with_auto_populated_field(): client.commit_workspace_changes(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.CommitWorkspaceChangesRequest( + request_msg = dataform.CommitWorkspaceChangesRequest( name="name_value", commit_message="commit_message_value", ) + assert args[0] == request_msg def test_commit_workspace_changes_use_cached_wrapped_rpc(): @@ -14375,8 +14450,15 @@ async def test_commit_workspace_changes_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dataform.CommitWorkspaceChangesRequest(), + {}, + ], +) async def test_commit_workspace_changes_async( - transport: str = "grpc_asyncio", request_type=dataform.CommitWorkspaceChangesRequest + request_type, transport: str = "grpc_asyncio" ): client = DataformAsyncClient( credentials=async_anonymous_credentials(), @@ -14385,7 +14467,7 @@ async def test_commit_workspace_changes_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( @@ -14407,11 +14489,6 @@ async def test_commit_workspace_changes_async( assert isinstance(response, dataform.CommitWorkspaceChangesResponse) -@pytest.mark.asyncio -async def test_commit_workspace_changes_async_from_dict(): - await test_commit_workspace_changes_async(request_type=dict) - - def test_commit_workspace_changes_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14480,8 +14557,8 @@ async def test_commit_workspace_changes_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - dataform.ResetWorkspaceChangesRequest, - dict, + dataform.ResetWorkspaceChangesRequest(), + {}, ], ) def test_reset_workspace_changes(request_type, transport: str = "grpc"): @@ -14492,7 +14569,7 @@ def test_reset_workspace_changes(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -14537,9 +14614,10 @@ def test_reset_workspace_changes_non_empty_request_with_auto_populated_field(): client.reset_workspace_changes(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.ResetWorkspaceChangesRequest( + request_msg = dataform.ResetWorkspaceChangesRequest( name="name_value", ) + assert args[0] == request_msg def test_reset_workspace_changes_use_cached_wrapped_rpc(): @@ -14625,8 +14703,15 @@ async def test_reset_workspace_changes_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dataform.ResetWorkspaceChangesRequest(), + {}, + ], +) async def test_reset_workspace_changes_async( - transport: str = "grpc_asyncio", request_type=dataform.ResetWorkspaceChangesRequest + request_type, transport: str = "grpc_asyncio" ): client = DataformAsyncClient( credentials=async_anonymous_credentials(), @@ -14635,7 +14720,7 @@ async def test_reset_workspace_changes_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( @@ -14657,11 +14742,6 @@ async def test_reset_workspace_changes_async( assert isinstance(response, dataform.ResetWorkspaceChangesResponse) -@pytest.mark.asyncio -async def test_reset_workspace_changes_async_from_dict(): - await test_reset_workspace_changes_async(request_type=dict) - - def test_reset_workspace_changes_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14730,8 +14810,8 @@ async def test_reset_workspace_changes_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - dataform.FetchFileDiffRequest, - dict, + dataform.FetchFileDiffRequest(), + {}, ], ) def test_fetch_file_diff(request_type, transport: str = "grpc"): @@ -14742,7 +14822,7 @@ def test_fetch_file_diff(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.fetch_file_diff), "__call__") as call: @@ -14787,10 +14867,11 @@ def test_fetch_file_diff_non_empty_request_with_auto_populated_field(): client.fetch_file_diff(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.FetchFileDiffRequest( + request_msg = dataform.FetchFileDiffRequest( workspace="workspace_value", path="path_value", ) + assert args[0] == request_msg def test_fetch_file_diff_use_cached_wrapped_rpc(): @@ -14871,9 +14952,14 @@ async def test_fetch_file_diff_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_fetch_file_diff_async( - transport: str = "grpc_asyncio", request_type=dataform.FetchFileDiffRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataform.FetchFileDiffRequest(), + {}, + ], +) +async def test_fetch_file_diff_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14881,7 +14967,7 @@ async def test_fetch_file_diff_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.fetch_file_diff), "__call__") as call: @@ -14904,11 +14990,6 @@ async def test_fetch_file_diff_async( assert response.formatted_diff == "formatted_diff_value" -@pytest.mark.asyncio -async def test_fetch_file_diff_async_from_dict(): - await test_fetch_file_diff_async(request_type=dict) - - def test_fetch_file_diff_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14973,8 +15054,8 @@ async def test_fetch_file_diff_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - dataform.QueryDirectoryContentsRequest, - dict, + dataform.QueryDirectoryContentsRequest(), + {}, ], ) def test_query_directory_contents(request_type, transport: str = "grpc"): @@ -14985,7 +15066,7 @@ def test_query_directory_contents(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -15035,11 +15116,12 @@ def test_query_directory_contents_non_empty_request_with_auto_populated_field(): client.query_directory_contents(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.QueryDirectoryContentsRequest( + request_msg = dataform.QueryDirectoryContentsRequest( workspace="workspace_value", path="path_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_query_directory_contents_use_cached_wrapped_rpc(): @@ -15125,8 +15207,15 @@ async def test_query_directory_contents_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dataform.QueryDirectoryContentsRequest(), + {}, + ], +) async def test_query_directory_contents_async( - transport: str = "grpc_asyncio", request_type=dataform.QueryDirectoryContentsRequest + request_type, transport: str = "grpc_asyncio" ): client = DataformAsyncClient( credentials=async_anonymous_credentials(), @@ -15135,7 +15224,7 @@ async def test_query_directory_contents_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( @@ -15160,11 +15249,6 @@ async def test_query_directory_contents_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_query_directory_contents_async_from_dict(): - await test_query_directory_contents_async(request_type=dict) - - def test_query_directory_contents_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15433,8 +15517,8 @@ async def test_query_directory_contents_async_pages(): @pytest.mark.parametrize( "request_type", [ - dataform.SearchFilesRequest, - dict, + dataform.SearchFilesRequest(), + {}, ], ) def test_search_files(request_type, transport: str = "grpc"): @@ -15445,7 +15529,7 @@ def test_search_files(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.search_files), "__call__") as call: @@ -15491,11 +15575,12 @@ def test_search_files_non_empty_request_with_auto_populated_field(): client.search_files(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.SearchFilesRequest( + request_msg = dataform.SearchFilesRequest( workspace="workspace_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_search_files_use_cached_wrapped_rpc(): @@ -15576,9 +15661,14 @@ async def test_search_files_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_search_files_async( - transport: str = "grpc_asyncio", request_type=dataform.SearchFilesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataform.SearchFilesRequest(), + {}, + ], +) +async def test_search_files_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -15586,7 +15676,7 @@ async def test_search_files_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.search_files), "__call__") as call: @@ -15609,11 +15699,6 @@ async def test_search_files_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_search_files_async_from_dict(): - await test_search_files_async(request_type=dict) - - def test_search_files_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15868,8 +15953,8 @@ async def test_search_files_async_pages(): @pytest.mark.parametrize( "request_type", [ - dataform.MakeDirectoryRequest, - dict, + dataform.MakeDirectoryRequest(), + {}, ], ) def test_make_directory(request_type, transport: str = "grpc"): @@ -15880,7 +15965,7 @@ def test_make_directory(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.make_directory), "__call__") as call: @@ -15922,10 +16007,11 @@ def test_make_directory_non_empty_request_with_auto_populated_field(): client.make_directory(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.MakeDirectoryRequest( + request_msg = dataform.MakeDirectoryRequest( workspace="workspace_value", path="path_value", ) + assert args[0] == request_msg def test_make_directory_use_cached_wrapped_rpc(): @@ -16006,9 +16092,14 @@ async def test_make_directory_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_make_directory_async( - transport: str = "grpc_asyncio", request_type=dataform.MakeDirectoryRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataform.MakeDirectoryRequest(), + {}, + ], +) +async def test_make_directory_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -16016,7 +16107,7 @@ async def test_make_directory_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.make_directory), "__call__") as call: @@ -16036,11 +16127,6 @@ async def test_make_directory_async( assert isinstance(response, dataform.MakeDirectoryResponse) -@pytest.mark.asyncio -async def test_make_directory_async_from_dict(): - await test_make_directory_async(request_type=dict) - - def test_make_directory_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16105,8 +16191,8 @@ async def test_make_directory_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - dataform.RemoveDirectoryRequest, - dict, + dataform.RemoveDirectoryRequest(), + {}, ], ) def test_remove_directory(request_type, transport: str = "grpc"): @@ -16117,7 +16203,7 @@ def test_remove_directory(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.remove_directory), "__call__") as call: @@ -16159,10 +16245,11 @@ def test_remove_directory_non_empty_request_with_auto_populated_field(): client.remove_directory(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.RemoveDirectoryRequest( + request_msg = dataform.RemoveDirectoryRequest( workspace="workspace_value", path="path_value", ) + assert args[0] == request_msg def test_remove_directory_use_cached_wrapped_rpc(): @@ -16245,9 +16332,14 @@ async def test_remove_directory_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_remove_directory_async( - transport: str = "grpc_asyncio", request_type=dataform.RemoveDirectoryRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataform.RemoveDirectoryRequest(), + {}, + ], +) +async def test_remove_directory_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -16255,7 +16347,7 @@ async def test_remove_directory_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.remove_directory), "__call__") as call: @@ -16275,11 +16367,6 @@ async def test_remove_directory_async( assert isinstance(response, dataform.RemoveDirectoryResponse) -@pytest.mark.asyncio -async def test_remove_directory_async_from_dict(): - await test_remove_directory_async(request_type=dict) - - def test_remove_directory_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16344,8 +16431,8 @@ async def test_remove_directory_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - dataform.MoveDirectoryRequest, - dict, + dataform.MoveDirectoryRequest(), + {}, ], ) def test_move_directory(request_type, transport: str = "grpc"): @@ -16356,7 +16443,7 @@ def test_move_directory(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.move_directory), "__call__") as call: @@ -16399,11 +16486,12 @@ def test_move_directory_non_empty_request_with_auto_populated_field(): client.move_directory(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.MoveDirectoryRequest( + request_msg = dataform.MoveDirectoryRequest( workspace="workspace_value", path="path_value", new_path="new_path_value", ) + assert args[0] == request_msg def test_move_directory_use_cached_wrapped_rpc(): @@ -16484,9 +16572,14 @@ async def test_move_directory_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_move_directory_async( - transport: str = "grpc_asyncio", request_type=dataform.MoveDirectoryRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataform.MoveDirectoryRequest(), + {}, + ], +) +async def test_move_directory_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -16494,7 +16587,7 @@ async def test_move_directory_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.move_directory), "__call__") as call: @@ -16514,11 +16607,6 @@ async def test_move_directory_async( assert isinstance(response, dataform.MoveDirectoryResponse) -@pytest.mark.asyncio -async def test_move_directory_async_from_dict(): - await test_move_directory_async(request_type=dict) - - def test_move_directory_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16583,8 +16671,8 @@ async def test_move_directory_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - dataform.ReadFileRequest, - dict, + dataform.ReadFileRequest(), + {}, ], ) def test_read_file(request_type, transport: str = "grpc"): @@ -16595,7 +16683,7 @@ def test_read_file(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.read_file), "__call__") as call: @@ -16641,11 +16729,12 @@ def test_read_file_non_empty_request_with_auto_populated_field(): client.read_file(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.ReadFileRequest( + request_msg = dataform.ReadFileRequest( workspace="workspace_value", path="path_value", revision="revision_value", ) + assert args[0] == request_msg def test_read_file_use_cached_wrapped_rpc(): @@ -16724,9 +16813,14 @@ async def test_read_file_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_read_file_async( - transport: str = "grpc_asyncio", request_type=dataform.ReadFileRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataform.ReadFileRequest(), + {}, + ], +) +async def test_read_file_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -16734,7 +16828,7 @@ async def test_read_file_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.read_file), "__call__") as call: @@ -16757,11 +16851,6 @@ async def test_read_file_async( assert response.file_contents == b"file_contents_blob" -@pytest.mark.asyncio -async def test_read_file_async_from_dict(): - await test_read_file_async(request_type=dict) - - def test_read_file_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16826,8 +16915,8 @@ async def test_read_file_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - dataform.RemoveFileRequest, - dict, + dataform.RemoveFileRequest(), + {}, ], ) def test_remove_file(request_type, transport: str = "grpc"): @@ -16838,7 +16927,7 @@ def test_remove_file(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.remove_file), "__call__") as call: @@ -16880,10 +16969,11 @@ def test_remove_file_non_empty_request_with_auto_populated_field(): client.remove_file(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.RemoveFileRequest( + request_msg = dataform.RemoveFileRequest( workspace="workspace_value", path="path_value", ) + assert args[0] == request_msg def test_remove_file_use_cached_wrapped_rpc(): @@ -16964,9 +17054,14 @@ async def test_remove_file_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_remove_file_async( - transport: str = "grpc_asyncio", request_type=dataform.RemoveFileRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataform.RemoveFileRequest(), + {}, + ], +) +async def test_remove_file_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -16974,7 +17069,7 @@ async def test_remove_file_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.remove_file), "__call__") as call: @@ -16994,11 +17089,6 @@ async def test_remove_file_async( assert isinstance(response, dataform.RemoveFileResponse) -@pytest.mark.asyncio -async def test_remove_file_async_from_dict(): - await test_remove_file_async(request_type=dict) - - def test_remove_file_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17063,8 +17153,8 @@ async def test_remove_file_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - dataform.MoveFileRequest, - dict, + dataform.MoveFileRequest(), + {}, ], ) def test_move_file(request_type, transport: str = "grpc"): @@ -17075,7 +17165,7 @@ def test_move_file(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.move_file), "__call__") as call: @@ -17118,11 +17208,12 @@ def test_move_file_non_empty_request_with_auto_populated_field(): client.move_file(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.MoveFileRequest( + request_msg = dataform.MoveFileRequest( workspace="workspace_value", path="path_value", new_path="new_path_value", ) + assert args[0] == request_msg def test_move_file_use_cached_wrapped_rpc(): @@ -17201,9 +17292,14 @@ async def test_move_file_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_move_file_async( - transport: str = "grpc_asyncio", request_type=dataform.MoveFileRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataform.MoveFileRequest(), + {}, + ], +) +async def test_move_file_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -17211,7 +17307,7 @@ async def test_move_file_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.move_file), "__call__") as call: @@ -17231,11 +17327,6 @@ async def test_move_file_async( assert isinstance(response, dataform.MoveFileResponse) -@pytest.mark.asyncio -async def test_move_file_async_from_dict(): - await test_move_file_async(request_type=dict) - - def test_move_file_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17300,8 +17391,8 @@ async def test_move_file_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - dataform.WriteFileRequest, - dict, + dataform.WriteFileRequest(), + {}, ], ) def test_write_file(request_type, transport: str = "grpc"): @@ -17312,7 +17403,7 @@ def test_write_file(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.write_file), "__call__") as call: @@ -17354,10 +17445,11 @@ def test_write_file_non_empty_request_with_auto_populated_field(): client.write_file(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.WriteFileRequest( + request_msg = dataform.WriteFileRequest( workspace="workspace_value", path="path_value", ) + assert args[0] == request_msg def test_write_file_use_cached_wrapped_rpc(): @@ -17436,9 +17528,14 @@ async def test_write_file_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_write_file_async( - transport: str = "grpc_asyncio", request_type=dataform.WriteFileRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataform.WriteFileRequest(), + {}, + ], +) +async def test_write_file_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -17446,7 +17543,7 @@ async def test_write_file_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.write_file), "__call__") as call: @@ -17466,11 +17563,6 @@ async def test_write_file_async( assert isinstance(response, dataform.WriteFileResponse) -@pytest.mark.asyncio -async def test_write_file_async_from_dict(): - await test_write_file_async(request_type=dict) - - def test_write_file_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17535,8 +17627,8 @@ async def test_write_file_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - dataform.ListReleaseConfigsRequest, - dict, + dataform.ListReleaseConfigsRequest(), + {}, ], ) def test_list_release_configs(request_type, transport: str = "grpc"): @@ -17547,7 +17639,7 @@ def test_list_release_configs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -17598,10 +17690,11 @@ def test_list_release_configs_non_empty_request_with_auto_populated_field(): client.list_release_configs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.ListReleaseConfigsRequest( + request_msg = dataform.ListReleaseConfigsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_release_configs_use_cached_wrapped_rpc(): @@ -17686,8 +17779,15 @@ async def test_list_release_configs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dataform.ListReleaseConfigsRequest(), + {}, + ], +) async def test_list_release_configs_async( - transport: str = "grpc_asyncio", request_type=dataform.ListReleaseConfigsRequest + request_type, transport: str = "grpc_asyncio" ): client = DataformAsyncClient( credentials=async_anonymous_credentials(), @@ -17696,7 +17796,7 @@ async def test_list_release_configs_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( @@ -17723,11 +17823,6 @@ async def test_list_release_configs_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_release_configs_async_from_dict(): - await test_list_release_configs_async(request_type=dict) - - def test_list_release_configs_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18080,8 +18175,8 @@ async def test_list_release_configs_async_pages(): @pytest.mark.parametrize( "request_type", [ - dataform.GetReleaseConfigRequest, - dict, + dataform.GetReleaseConfigRequest(), + {}, ], ) def test_get_release_config(request_type, transport: str = "grpc"): @@ -18092,7 +18187,7 @@ def test_get_release_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( @@ -18152,9 +18247,10 @@ def test_get_release_config_non_empty_request_with_auto_populated_field(): client.get_release_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.GetReleaseConfigRequest( + request_msg = dataform.GetReleaseConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_release_config_use_cached_wrapped_rpc(): @@ -18239,9 +18335,14 @@ async def test_get_release_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_release_config_async( - transport: str = "grpc_asyncio", request_type=dataform.GetReleaseConfigRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataform.GetReleaseConfigRequest(), + {}, + ], +) +async def test_get_release_config_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -18249,7 +18350,7 @@ async def test_get_release_config_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( @@ -18286,11 +18387,6 @@ async def test_get_release_config_async( assert response.internal_metadata == "internal_metadata_value" -@pytest.mark.asyncio -async def test_get_release_config_async_from_dict(): - await test_get_release_config_async(request_type=dict) - - def test_get_release_config_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18445,8 +18541,8 @@ async def test_get_release_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dataform.CreateReleaseConfigRequest, - dict, + dataform.CreateReleaseConfigRequest(), + {}, ], ) def test_create_release_config(request_type, transport: str = "grpc"): @@ -18457,7 +18553,7 @@ def test_create_release_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( @@ -18518,10 +18614,11 @@ def test_create_release_config_non_empty_request_with_auto_populated_field(): client.create_release_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.CreateReleaseConfigRequest( + request_msg = dataform.CreateReleaseConfigRequest( parent="parent_value", release_config_id="release_config_id_value", ) + assert args[0] == request_msg def test_create_release_config_use_cached_wrapped_rpc(): @@ -18607,8 +18704,15 @@ async def test_create_release_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dataform.CreateReleaseConfigRequest(), + {}, + ], +) async def test_create_release_config_async( - transport: str = "grpc_asyncio", request_type=dataform.CreateReleaseConfigRequest + request_type, transport: str = "grpc_asyncio" ): client = DataformAsyncClient( credentials=async_anonymous_credentials(), @@ -18617,7 +18721,7 @@ async def test_create_release_config_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( @@ -18654,11 +18758,6 @@ async def test_create_release_config_async( assert response.internal_metadata == "internal_metadata_value" -@pytest.mark.asyncio -async def test_create_release_config_async_from_dict(): - await test_create_release_config_async(request_type=dict) - - def test_create_release_config_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18833,8 +18932,8 @@ async def test_create_release_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dataform.UpdateReleaseConfigRequest, - dict, + dataform.UpdateReleaseConfigRequest(), + {}, ], ) def test_update_release_config(request_type, transport: str = "grpc"): @@ -18845,7 +18944,7 @@ def test_update_release_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( @@ -18903,7 +19002,8 @@ def test_update_release_config_non_empty_request_with_auto_populated_field(): client.update_release_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.UpdateReleaseConfigRequest() + request_msg = dataform.UpdateReleaseConfigRequest() + assert args[0] == request_msg def test_update_release_config_use_cached_wrapped_rpc(): @@ -18989,8 +19089,15 @@ async def test_update_release_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dataform.UpdateReleaseConfigRequest(), + {}, + ], +) async def test_update_release_config_async( - transport: str = "grpc_asyncio", request_type=dataform.UpdateReleaseConfigRequest + request_type, transport: str = "grpc_asyncio" ): client = DataformAsyncClient( credentials=async_anonymous_credentials(), @@ -18999,7 +19106,7 @@ async def test_update_release_config_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( @@ -19036,11 +19143,6 @@ async def test_update_release_config_async( assert response.internal_metadata == "internal_metadata_value" -@pytest.mark.asyncio -async def test_update_release_config_async_from_dict(): - await test_update_release_config_async(request_type=dict) - - def test_update_release_config_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -19205,8 +19307,8 @@ async def test_update_release_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dataform.DeleteReleaseConfigRequest, - dict, + dataform.DeleteReleaseConfigRequest(), + {}, ], ) def test_delete_release_config(request_type, transport: str = "grpc"): @@ -19217,7 +19319,7 @@ def test_delete_release_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( @@ -19262,9 +19364,10 @@ def test_delete_release_config_non_empty_request_with_auto_populated_field(): client.delete_release_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.DeleteReleaseConfigRequest( + request_msg = dataform.DeleteReleaseConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_release_config_use_cached_wrapped_rpc(): @@ -19350,8 +19453,15 @@ async def test_delete_release_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dataform.DeleteReleaseConfigRequest(), + {}, + ], +) async def test_delete_release_config_async( - transport: str = "grpc_asyncio", request_type=dataform.DeleteReleaseConfigRequest + request_type, transport: str = "grpc_asyncio" ): client = DataformAsyncClient( credentials=async_anonymous_credentials(), @@ -19360,7 +19470,7 @@ async def test_delete_release_config_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( @@ -19380,11 +19490,6 @@ async def test_delete_release_config_async( assert response is None -@pytest.mark.asyncio -async def test_delete_release_config_async_from_dict(): - await test_delete_release_config_async(request_type=dict) - - def test_delete_release_config_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -19535,8 +19640,8 @@ async def test_delete_release_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dataform.ListCompilationResultsRequest, - dict, + dataform.ListCompilationResultsRequest(), + {}, ], ) def test_list_compilation_results(request_type, transport: str = "grpc"): @@ -19547,7 +19652,7 @@ def test_list_compilation_results(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -19600,12 +19705,13 @@ def test_list_compilation_results_non_empty_request_with_auto_populated_field(): client.list_compilation_results(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.ListCompilationResultsRequest( + request_msg = dataform.ListCompilationResultsRequest( parent="parent_value", page_token="page_token_value", order_by="order_by_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_compilation_results_use_cached_wrapped_rpc(): @@ -19691,8 +19797,15 @@ async def test_list_compilation_results_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dataform.ListCompilationResultsRequest(), + {}, + ], +) async def test_list_compilation_results_async( - transport: str = "grpc_asyncio", request_type=dataform.ListCompilationResultsRequest + request_type, transport: str = "grpc_asyncio" ): client = DataformAsyncClient( credentials=async_anonymous_credentials(), @@ -19701,7 +19814,7 @@ async def test_list_compilation_results_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( @@ -19728,11 +19841,6 @@ async def test_list_compilation_results_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_compilation_results_async_from_dict(): - await test_list_compilation_results_async(request_type=dict) - - def test_list_compilation_results_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -20087,8 +20195,8 @@ async def test_list_compilation_results_async_pages(): @pytest.mark.parametrize( "request_type", [ - dataform.GetCompilationResultRequest, - dict, + dataform.GetCompilationResultRequest(), + {}, ], ) def test_get_compilation_result(request_type, transport: str = "grpc"): @@ -20099,7 +20207,7 @@ def test_get_compilation_result(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -20154,9 +20262,10 @@ def test_get_compilation_result_non_empty_request_with_auto_populated_field(): client.get_compilation_result(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.GetCompilationResultRequest( + request_msg = dataform.GetCompilationResultRequest( name="name_value", ) + assert args[0] == request_msg def test_get_compilation_result_use_cached_wrapped_rpc(): @@ -20242,8 +20351,15 @@ async def test_get_compilation_result_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dataform.GetCompilationResultRequest(), + {}, + ], +) async def test_get_compilation_result_async( - transport: str = "grpc_asyncio", request_type=dataform.GetCompilationResultRequest + request_type, transport: str = "grpc_asyncio" ): client = DataformAsyncClient( credentials=async_anonymous_credentials(), @@ -20252,7 +20368,7 @@ async def test_get_compilation_result_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( @@ -20283,11 +20399,6 @@ async def test_get_compilation_result_async( assert response.internal_metadata == "internal_metadata_value" -@pytest.mark.asyncio -async def test_get_compilation_result_async_from_dict(): - await test_get_compilation_result_async(request_type=dict) - - def test_get_compilation_result_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -20442,8 +20553,8 @@ async def test_get_compilation_result_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dataform.CreateCompilationResultRequest, - dict, + dataform.CreateCompilationResultRequest(), + {}, ], ) def test_create_compilation_result(request_type, transport: str = "grpc"): @@ -20454,7 +20565,7 @@ def test_create_compilation_result(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -20509,9 +20620,10 @@ def test_create_compilation_result_non_empty_request_with_auto_populated_field() client.create_compilation_result(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.CreateCompilationResultRequest( + request_msg = dataform.CreateCompilationResultRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_compilation_result_use_cached_wrapped_rpc(): @@ -20597,9 +20709,15 @@ async def test_create_compilation_result_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dataform.CreateCompilationResultRequest(), + {}, + ], +) async def test_create_compilation_result_async( - transport: str = "grpc_asyncio", - request_type=dataform.CreateCompilationResultRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataformAsyncClient( credentials=async_anonymous_credentials(), @@ -20608,7 +20726,7 @@ async def test_create_compilation_result_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( @@ -20639,11 +20757,6 @@ async def test_create_compilation_result_async( assert response.internal_metadata == "internal_metadata_value" -@pytest.mark.asyncio -async def test_create_compilation_result_async_from_dict(): - await test_create_compilation_result_async(request_type=dict) - - def test_create_compilation_result_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -20816,8 +20929,8 @@ async def test_create_compilation_result_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dataform.QueryCompilationResultActionsRequest, - dict, + dataform.QueryCompilationResultActionsRequest(), + {}, ], ) def test_query_compilation_result_actions(request_type, transport: str = "grpc"): @@ -20828,7 +20941,7 @@ def test_query_compilation_result_actions(request_type, transport: str = "grpc") # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -20878,11 +20991,12 @@ def test_query_compilation_result_actions_non_empty_request_with_auto_populated_ client.query_compilation_result_actions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.QueryCompilationResultActionsRequest( + request_msg = dataform.QueryCompilationResultActionsRequest( name="name_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_query_compilation_result_actions_use_cached_wrapped_rpc(): @@ -20968,9 +21082,15 @@ async def test_query_compilation_result_actions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dataform.QueryCompilationResultActionsRequest(), + {}, + ], +) async def test_query_compilation_result_actions_async( - transport: str = "grpc_asyncio", - request_type=dataform.QueryCompilationResultActionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataformAsyncClient( credentials=async_anonymous_credentials(), @@ -20979,7 +21099,7 @@ async def test_query_compilation_result_actions_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( @@ -21004,11 +21124,6 @@ async def test_query_compilation_result_actions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_query_compilation_result_actions_async_from_dict(): - await test_query_compilation_result_actions_async(request_type=dict) - - def test_query_compilation_result_actions_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -21279,8 +21394,8 @@ async def test_query_compilation_result_actions_async_pages(): @pytest.mark.parametrize( "request_type", [ - dataform.ListWorkflowConfigsRequest, - dict, + dataform.ListWorkflowConfigsRequest(), + {}, ], ) def test_list_workflow_configs(request_type, transport: str = "grpc"): @@ -21291,7 +21406,7 @@ def test_list_workflow_configs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -21342,10 +21457,11 @@ def test_list_workflow_configs_non_empty_request_with_auto_populated_field(): client.list_workflow_configs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.ListWorkflowConfigsRequest( + request_msg = dataform.ListWorkflowConfigsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_workflow_configs_use_cached_wrapped_rpc(): @@ -21431,8 +21547,15 @@ async def test_list_workflow_configs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dataform.ListWorkflowConfigsRequest(), + {}, + ], +) async def test_list_workflow_configs_async( - transport: str = "grpc_asyncio", request_type=dataform.ListWorkflowConfigsRequest + request_type, transport: str = "grpc_asyncio" ): client = DataformAsyncClient( credentials=async_anonymous_credentials(), @@ -21441,7 +21564,7 @@ async def test_list_workflow_configs_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( @@ -21468,11 +21591,6 @@ async def test_list_workflow_configs_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_workflow_configs_async_from_dict(): - await test_list_workflow_configs_async(request_type=dict) - - def test_list_workflow_configs_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -21825,8 +21943,8 @@ async def test_list_workflow_configs_async_pages(): @pytest.mark.parametrize( "request_type", [ - dataform.GetWorkflowConfigRequest, - dict, + dataform.GetWorkflowConfigRequest(), + {}, ], ) def test_get_workflow_config(request_type, transport: str = "grpc"): @@ -21837,7 +21955,7 @@ def test_get_workflow_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( @@ -21895,9 +22013,10 @@ def test_get_workflow_config_non_empty_request_with_auto_populated_field(): client.get_workflow_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.GetWorkflowConfigRequest( + request_msg = dataform.GetWorkflowConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_workflow_config_use_cached_wrapped_rpc(): @@ -21982,9 +22101,14 @@ async def test_get_workflow_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_workflow_config_async( - transport: str = "grpc_asyncio", request_type=dataform.GetWorkflowConfigRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataform.GetWorkflowConfigRequest(), + {}, + ], +) +async def test_get_workflow_config_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -21992,7 +22116,7 @@ async def test_get_workflow_config_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( @@ -22027,11 +22151,6 @@ async def test_get_workflow_config_async( assert response.internal_metadata == "internal_metadata_value" -@pytest.mark.asyncio -async def test_get_workflow_config_async_from_dict(): - await test_get_workflow_config_async(request_type=dict) - - def test_get_workflow_config_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -22186,8 +22305,8 @@ async def test_get_workflow_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dataform.CreateWorkflowConfigRequest, - dict, + dataform.CreateWorkflowConfigRequest(), + {}, ], ) def test_create_workflow_config(request_type, transport: str = "grpc"): @@ -22198,7 +22317,7 @@ def test_create_workflow_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( @@ -22257,10 +22376,11 @@ def test_create_workflow_config_non_empty_request_with_auto_populated_field(): client.create_workflow_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.CreateWorkflowConfigRequest( + request_msg = dataform.CreateWorkflowConfigRequest( parent="parent_value", workflow_config_id="workflow_config_id_value", ) + assert args[0] == request_msg def test_create_workflow_config_use_cached_wrapped_rpc(): @@ -22346,8 +22466,15 @@ async def test_create_workflow_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dataform.CreateWorkflowConfigRequest(), + {}, + ], +) async def test_create_workflow_config_async( - transport: str = "grpc_asyncio", request_type=dataform.CreateWorkflowConfigRequest + request_type, transport: str = "grpc_asyncio" ): client = DataformAsyncClient( credentials=async_anonymous_credentials(), @@ -22356,7 +22483,7 @@ async def test_create_workflow_config_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( @@ -22391,11 +22518,6 @@ async def test_create_workflow_config_async( assert response.internal_metadata == "internal_metadata_value" -@pytest.mark.asyncio -async def test_create_workflow_config_async_from_dict(): - await test_create_workflow_config_async(request_type=dict) - - def test_create_workflow_config_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -22570,8 +22692,8 @@ async def test_create_workflow_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dataform.UpdateWorkflowConfigRequest, - dict, + dataform.UpdateWorkflowConfigRequest(), + {}, ], ) def test_update_workflow_config(request_type, transport: str = "grpc"): @@ -22582,7 +22704,7 @@ def test_update_workflow_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( @@ -22638,7 +22760,8 @@ def test_update_workflow_config_non_empty_request_with_auto_populated_field(): client.update_workflow_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.UpdateWorkflowConfigRequest() + request_msg = dataform.UpdateWorkflowConfigRequest() + assert args[0] == request_msg def test_update_workflow_config_use_cached_wrapped_rpc(): @@ -22724,8 +22847,15 @@ async def test_update_workflow_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dataform.UpdateWorkflowConfigRequest(), + {}, + ], +) async def test_update_workflow_config_async( - transport: str = "grpc_asyncio", request_type=dataform.UpdateWorkflowConfigRequest + request_type, transport: str = "grpc_asyncio" ): client = DataformAsyncClient( credentials=async_anonymous_credentials(), @@ -22734,7 +22864,7 @@ async def test_update_workflow_config_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( @@ -22769,11 +22899,6 @@ async def test_update_workflow_config_async( assert response.internal_metadata == "internal_metadata_value" -@pytest.mark.asyncio -async def test_update_workflow_config_async_from_dict(): - await test_update_workflow_config_async(request_type=dict) - - def test_update_workflow_config_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -22938,8 +23063,8 @@ async def test_update_workflow_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dataform.DeleteWorkflowConfigRequest, - dict, + dataform.DeleteWorkflowConfigRequest(), + {}, ], ) def test_delete_workflow_config(request_type, transport: str = "grpc"): @@ -22950,7 +23075,7 @@ def test_delete_workflow_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( @@ -22995,9 +23120,10 @@ def test_delete_workflow_config_non_empty_request_with_auto_populated_field(): client.delete_workflow_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.DeleteWorkflowConfigRequest( + request_msg = dataform.DeleteWorkflowConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_workflow_config_use_cached_wrapped_rpc(): @@ -23083,8 +23209,15 @@ async def test_delete_workflow_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dataform.DeleteWorkflowConfigRequest(), + {}, + ], +) async def test_delete_workflow_config_async( - transport: str = "grpc_asyncio", request_type=dataform.DeleteWorkflowConfigRequest + request_type, transport: str = "grpc_asyncio" ): client = DataformAsyncClient( credentials=async_anonymous_credentials(), @@ -23093,7 +23226,7 @@ async def test_delete_workflow_config_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( @@ -23113,11 +23246,6 @@ async def test_delete_workflow_config_async( assert response is None -@pytest.mark.asyncio -async def test_delete_workflow_config_async_from_dict(): - await test_delete_workflow_config_async(request_type=dict) - - def test_delete_workflow_config_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -23268,8 +23396,8 @@ async def test_delete_workflow_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dataform.ListWorkflowInvocationsRequest, - dict, + dataform.ListWorkflowInvocationsRequest(), + {}, ], ) def test_list_workflow_invocations(request_type, transport: str = "grpc"): @@ -23280,7 +23408,7 @@ def test_list_workflow_invocations(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -23333,12 +23461,13 @@ def test_list_workflow_invocations_non_empty_request_with_auto_populated_field() client.list_workflow_invocations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.ListWorkflowInvocationsRequest( + request_msg = dataform.ListWorkflowInvocationsRequest( parent="parent_value", page_token="page_token_value", order_by="order_by_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_workflow_invocations_use_cached_wrapped_rpc(): @@ -23424,9 +23553,15 @@ async def test_list_workflow_invocations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dataform.ListWorkflowInvocationsRequest(), + {}, + ], +) async def test_list_workflow_invocations_async( - transport: str = "grpc_asyncio", - request_type=dataform.ListWorkflowInvocationsRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataformAsyncClient( credentials=async_anonymous_credentials(), @@ -23435,7 +23570,7 @@ async def test_list_workflow_invocations_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( @@ -23462,11 +23597,6 @@ async def test_list_workflow_invocations_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_workflow_invocations_async_from_dict(): - await test_list_workflow_invocations_async(request_type=dict) - - def test_list_workflow_invocations_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -23821,8 +23951,8 @@ async def test_list_workflow_invocations_async_pages(): @pytest.mark.parametrize( "request_type", [ - dataform.GetWorkflowInvocationRequest, - dict, + dataform.GetWorkflowInvocationRequest(), + {}, ], ) def test_get_workflow_invocation(request_type, transport: str = "grpc"): @@ -23833,7 +23963,7 @@ def test_get_workflow_invocation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -23888,9 +24018,10 @@ def test_get_workflow_invocation_non_empty_request_with_auto_populated_field(): client.get_workflow_invocation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.GetWorkflowInvocationRequest( + request_msg = dataform.GetWorkflowInvocationRequest( name="name_value", ) + assert args[0] == request_msg def test_get_workflow_invocation_use_cached_wrapped_rpc(): @@ -23976,8 +24107,15 @@ async def test_get_workflow_invocation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dataform.GetWorkflowInvocationRequest(), + {}, + ], +) async def test_get_workflow_invocation_async( - transport: str = "grpc_asyncio", request_type=dataform.GetWorkflowInvocationRequest + request_type, transport: str = "grpc_asyncio" ): client = DataformAsyncClient( credentials=async_anonymous_credentials(), @@ -23986,7 +24124,7 @@ async def test_get_workflow_invocation_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( @@ -24017,11 +24155,6 @@ async def test_get_workflow_invocation_async( assert response.internal_metadata == "internal_metadata_value" -@pytest.mark.asyncio -async def test_get_workflow_invocation_async_from_dict(): - await test_get_workflow_invocation_async(request_type=dict) - - def test_get_workflow_invocation_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -24176,8 +24309,8 @@ async def test_get_workflow_invocation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dataform.CreateWorkflowInvocationRequest, - dict, + dataform.CreateWorkflowInvocationRequest(), + {}, ], ) def test_create_workflow_invocation(request_type, transport: str = "grpc"): @@ -24188,7 +24321,7 @@ def test_create_workflow_invocation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -24243,9 +24376,10 @@ def test_create_workflow_invocation_non_empty_request_with_auto_populated_field( client.create_workflow_invocation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.CreateWorkflowInvocationRequest( + request_msg = dataform.CreateWorkflowInvocationRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_workflow_invocation_use_cached_wrapped_rpc(): @@ -24331,9 +24465,15 @@ async def test_create_workflow_invocation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dataform.CreateWorkflowInvocationRequest(), + {}, + ], +) async def test_create_workflow_invocation_async( - transport: str = "grpc_asyncio", - request_type=dataform.CreateWorkflowInvocationRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataformAsyncClient( credentials=async_anonymous_credentials(), @@ -24342,7 +24482,7 @@ async def test_create_workflow_invocation_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( @@ -24373,11 +24513,6 @@ async def test_create_workflow_invocation_async( assert response.internal_metadata == "internal_metadata_value" -@pytest.mark.asyncio -async def test_create_workflow_invocation_async_from_dict(): - await test_create_workflow_invocation_async(request_type=dict) - - def test_create_workflow_invocation_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -24554,8 +24689,8 @@ async def test_create_workflow_invocation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dataform.DeleteWorkflowInvocationRequest, - dict, + dataform.DeleteWorkflowInvocationRequest(), + {}, ], ) def test_delete_workflow_invocation(request_type, transport: str = "grpc"): @@ -24566,7 +24701,7 @@ def test_delete_workflow_invocation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -24611,9 +24746,10 @@ def test_delete_workflow_invocation_non_empty_request_with_auto_populated_field( client.delete_workflow_invocation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.DeleteWorkflowInvocationRequest( + request_msg = dataform.DeleteWorkflowInvocationRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_workflow_invocation_use_cached_wrapped_rpc(): @@ -24699,9 +24835,15 @@ async def test_delete_workflow_invocation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dataform.DeleteWorkflowInvocationRequest(), + {}, + ], +) async def test_delete_workflow_invocation_async( - transport: str = "grpc_asyncio", - request_type=dataform.DeleteWorkflowInvocationRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataformAsyncClient( credentials=async_anonymous_credentials(), @@ -24710,7 +24852,7 @@ async def test_delete_workflow_invocation_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( @@ -24730,11 +24872,6 @@ async def test_delete_workflow_invocation_async( assert response is None -@pytest.mark.asyncio -async def test_delete_workflow_invocation_async_from_dict(): - await test_delete_workflow_invocation_async(request_type=dict) - - def test_delete_workflow_invocation_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -24885,8 +25022,8 @@ async def test_delete_workflow_invocation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dataform.CancelWorkflowInvocationRequest, - dict, + dataform.CancelWorkflowInvocationRequest(), + {}, ], ) def test_cancel_workflow_invocation(request_type, transport: str = "grpc"): @@ -24897,7 +25034,7 @@ def test_cancel_workflow_invocation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -24942,9 +25079,10 @@ def test_cancel_workflow_invocation_non_empty_request_with_auto_populated_field( client.cancel_workflow_invocation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.CancelWorkflowInvocationRequest( + request_msg = dataform.CancelWorkflowInvocationRequest( name="name_value", ) + assert args[0] == request_msg def test_cancel_workflow_invocation_use_cached_wrapped_rpc(): @@ -25030,9 +25168,15 @@ async def test_cancel_workflow_invocation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dataform.CancelWorkflowInvocationRequest(), + {}, + ], +) async def test_cancel_workflow_invocation_async( - transport: str = "grpc_asyncio", - request_type=dataform.CancelWorkflowInvocationRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataformAsyncClient( credentials=async_anonymous_credentials(), @@ -25041,7 +25185,7 @@ async def test_cancel_workflow_invocation_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( @@ -25063,11 +25207,6 @@ async def test_cancel_workflow_invocation_async( assert isinstance(response, dataform.CancelWorkflowInvocationResponse) -@pytest.mark.asyncio -async def test_cancel_workflow_invocation_async_from_dict(): - await test_cancel_workflow_invocation_async(request_type=dict) - - def test_cancel_workflow_invocation_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -25136,8 +25275,8 @@ async def test_cancel_workflow_invocation_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - dataform.QueryWorkflowInvocationActionsRequest, - dict, + dataform.QueryWorkflowInvocationActionsRequest(), + {}, ], ) def test_query_workflow_invocation_actions(request_type, transport: str = "grpc"): @@ -25148,7 +25287,7 @@ def test_query_workflow_invocation_actions(request_type, transport: str = "grpc" # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -25197,10 +25336,11 @@ def test_query_workflow_invocation_actions_non_empty_request_with_auto_populated client.query_workflow_invocation_actions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.QueryWorkflowInvocationActionsRequest( + request_msg = dataform.QueryWorkflowInvocationActionsRequest( name="name_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_query_workflow_invocation_actions_use_cached_wrapped_rpc(): @@ -25286,9 +25426,15 @@ async def test_query_workflow_invocation_actions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dataform.QueryWorkflowInvocationActionsRequest(), + {}, + ], +) async def test_query_workflow_invocation_actions_async( - transport: str = "grpc_asyncio", - request_type=dataform.QueryWorkflowInvocationActionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataformAsyncClient( credentials=async_anonymous_credentials(), @@ -25297,7 +25443,7 @@ async def test_query_workflow_invocation_actions_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( @@ -25322,11 +25468,6 @@ async def test_query_workflow_invocation_actions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_query_workflow_invocation_actions_async_from_dict(): - await test_query_workflow_invocation_actions_async(request_type=dict) - - def test_query_workflow_invocation_actions_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -25597,8 +25738,8 @@ async def test_query_workflow_invocation_actions_async_pages(): @pytest.mark.parametrize( "request_type", [ - dataform.GetConfigRequest, - dict, + dataform.GetConfigRequest(), + {}, ], ) def test_get_config(request_type, transport: str = "grpc"): @@ -25609,7 +25750,7 @@ def test_get_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(type(client.transport.get_config), "__call__") as call: @@ -25657,9 +25798,10 @@ def test_get_config_non_empty_request_with_auto_populated_field(): client.get_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.GetConfigRequest( + request_msg = dataform.GetConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_config_use_cached_wrapped_rpc(): @@ -25738,9 +25880,14 @@ async def test_get_config_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_config_async( - transport: str = "grpc_asyncio", request_type=dataform.GetConfigRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataform.GetConfigRequest(), + {}, + ], +) +async def test_get_config_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -25748,7 +25895,7 @@ async def test_get_config_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_config), "__call__") as call: @@ -25775,11 +25922,6 @@ async def test_get_config_async( assert response.internal_metadata == "internal_metadata_value" -@pytest.mark.asyncio -async def test_get_config_async_from_dict(): - await test_get_config_async(request_type=dict) - - def test_get_config_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -25922,8 +26064,8 @@ async def test_get_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dataform.UpdateConfigRequest, - dict, + dataform.UpdateConfigRequest(), + {}, ], ) def test_update_config(request_type, transport: str = "grpc"): @@ -25934,7 +26076,7 @@ def test_update_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(type(client.transport.update_config), "__call__") as call: @@ -25980,7 +26122,8 @@ def test_update_config_non_empty_request_with_auto_populated_field(): client.update_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.UpdateConfigRequest() + request_msg = dataform.UpdateConfigRequest() + assert args[0] == request_msg def test_update_config_use_cached_wrapped_rpc(): @@ -26061,9 +26204,14 @@ async def test_update_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_config_async( - transport: str = "grpc_asyncio", request_type=dataform.UpdateConfigRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataform.UpdateConfigRequest(), + {}, + ], +) +async def test_update_config_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -26071,7 +26219,7 @@ async def test_update_config_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_config), "__call__") as call: @@ -26098,11 +26246,6 @@ async def test_update_config_async( assert response.internal_metadata == "internal_metadata_value" -@pytest.mark.asyncio -async def test_update_config_async_from_dict(): - await test_update_config_async(request_type=dict) - - def test_update_config_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -26255,8 +26398,8 @@ async def test_update_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.GetIamPolicyRequest, - dict, + iam_policy_pb2.GetIamPolicyRequest(), + {}, ], ) def test_get_iam_policy(request_type, transport: str = "grpc"): @@ -26267,7 +26410,7 @@ def test_get_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(type(client.transport.get_iam_policy), "__call__") as call: @@ -26313,9 +26456,10 @@ def test_get_iam_policy_non_empty_request_with_auto_populated_field(): client.get_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.GetIamPolicyRequest( + request_msg = iam_policy_pb2.GetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_get_iam_policy_use_cached_wrapped_rpc(): @@ -26396,9 +26540,14 @@ async def test_get_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.GetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.GetIamPolicyRequest(), + {}, + ], +) +async def test_get_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -26406,7 +26555,7 @@ async def test_get_iam_policy_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_iam_policy), "__call__") as call: @@ -26431,11 +26580,6 @@ async def test_get_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_get_iam_policy_async_from_dict(): - await test_get_iam_policy_async(request_type=dict) - - def test_get_iam_policy_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -26595,8 +26739,8 @@ async def test_get_iam_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.SetIamPolicyRequest, - dict, + iam_policy_pb2.SetIamPolicyRequest(), + {}, ], ) def test_set_iam_policy(request_type, transport: str = "grpc"): @@ -26607,7 +26751,7 @@ def test_set_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(type(client.transport.set_iam_policy), "__call__") as call: @@ -26653,9 +26797,10 @@ def test_set_iam_policy_non_empty_request_with_auto_populated_field(): client.set_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.SetIamPolicyRequest( + request_msg = iam_policy_pb2.SetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_set_iam_policy_use_cached_wrapped_rpc(): @@ -26736,9 +26881,14 @@ async def test_set_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.SetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.SetIamPolicyRequest(), + {}, + ], +) +async def test_set_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -26746,7 +26896,7 @@ async def test_set_iam_policy_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.set_iam_policy), "__call__") as call: @@ -26771,11 +26921,6 @@ async def test_set_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_set_iam_policy_async_from_dict(): - await test_set_iam_policy_async(request_type=dict) - - def test_set_iam_policy_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -26856,8 +27001,8 @@ def test_set_iam_policy_from_dict_foreign(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.TestIamPermissionsRequest, - dict, + iam_policy_pb2.TestIamPermissionsRequest(), + {}, ], ) def test_test_iam_permissions(request_type, transport: str = "grpc"): @@ -26868,7 +27013,7 @@ def test_test_iam_permissions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -26916,9 +27061,10 @@ def test_test_iam_permissions_non_empty_request_with_auto_populated_field(): client.test_iam_permissions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.TestIamPermissionsRequest( + request_msg = iam_policy_pb2.TestIamPermissionsRequest( resource="resource_value", ) + assert args[0] == request_msg def test_test_iam_permissions_use_cached_wrapped_rpc(): @@ -27003,9 +27149,15 @@ async def test_test_iam_permissions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.TestIamPermissionsRequest(), + {}, + ], +) async def test_test_iam_permissions_async( - transport: str = "grpc_asyncio", - request_type=iam_policy_pb2.TestIamPermissionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataformAsyncClient( credentials=async_anonymous_credentials(), @@ -27014,7 +27166,7 @@ async def test_test_iam_permissions_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( @@ -27039,11 +27191,6 @@ async def test_test_iam_permissions_async( assert response.permissions == ["permissions_value"] -@pytest.mark.asyncio -async def test_test_iam_permissions_async_from_dict(): - await test_test_iam_permissions_async(request_type=dict) - - def test_test_iam_permissions_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -40553,7 +40700,6 @@ def test_get_team_folder_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.GetTeamFolderRequest() - assert args[0] == request_msg @@ -40576,7 +40722,6 @@ def test_create_team_folder_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.CreateTeamFolderRequest() - assert args[0] == request_msg @@ -40599,7 +40744,6 @@ def test_update_team_folder_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.UpdateTeamFolderRequest() - assert args[0] == request_msg @@ -40622,7 +40766,6 @@ def test_delete_team_folder_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.DeleteTeamFolderRequest() - assert args[0] == request_msg @@ -40645,7 +40788,6 @@ def test_delete_team_folder_tree_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.DeleteTeamFolderTreeRequest() - assert args[0] == request_msg @@ -40668,7 +40810,6 @@ def test_query_team_folder_contents_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.QueryTeamFolderContentsRequest() - assert args[0] == request_msg @@ -40691,7 +40832,6 @@ def test_search_team_folders_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.SearchTeamFoldersRequest() - assert args[0] == request_msg @@ -40712,7 +40852,6 @@ def test_get_folder_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.GetFolderRequest() - assert args[0] == request_msg @@ -40733,7 +40872,6 @@ def test_create_folder_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.CreateFolderRequest() - assert args[0] == request_msg @@ -40754,7 +40892,6 @@ def test_update_folder_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.UpdateFolderRequest() - assert args[0] == request_msg @@ -40775,7 +40912,6 @@ def test_delete_folder_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.DeleteFolderRequest() - assert args[0] == request_msg @@ -40798,7 +40934,6 @@ def test_delete_folder_tree_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.DeleteFolderTreeRequest() - assert args[0] == request_msg @@ -40821,7 +40956,6 @@ def test_query_folder_contents_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.QueryFolderContentsRequest() - assert args[0] == request_msg @@ -40844,7 +40978,6 @@ def test_query_user_root_contents_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.QueryUserRootContentsRequest() - assert args[0] == request_msg @@ -40865,7 +40998,6 @@ def test_move_folder_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.MoveFolderRequest() - assert args[0] == request_msg @@ -40888,7 +41020,6 @@ def test_list_repositories_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.ListRepositoriesRequest() - assert args[0] == request_msg @@ -40909,7 +41040,6 @@ def test_get_repository_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.GetRepositoryRequest() - assert args[0] == request_msg @@ -40932,7 +41062,6 @@ def test_create_repository_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.CreateRepositoryRequest() - assert args[0] == request_msg @@ -40955,7 +41084,6 @@ def test_update_repository_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.UpdateRepositoryRequest() - assert args[0] == request_msg @@ -40978,7 +41106,6 @@ def test_delete_repository_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.DeleteRepositoryRequest() - assert args[0] == request_msg @@ -40999,7 +41126,6 @@ def test_move_repository_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.MoveRepositoryRequest() - assert args[0] == request_msg @@ -41022,7 +41148,6 @@ def test_commit_repository_changes_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.CommitRepositoryChangesRequest() - assert args[0] == request_msg @@ -41045,7 +41170,6 @@ def test_read_repository_file_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.ReadRepositoryFileRequest() - assert args[0] == request_msg @@ -41068,7 +41192,6 @@ def test_query_repository_directory_contents_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.QueryRepositoryDirectoryContentsRequest() - assert args[0] == request_msg @@ -41091,7 +41214,6 @@ def test_fetch_repository_history_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.FetchRepositoryHistoryRequest() - assert args[0] == request_msg @@ -41114,7 +41236,6 @@ def test_compute_repository_access_token_status_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.ComputeRepositoryAccessTokenStatusRequest() - assert args[0] == request_msg @@ -41137,7 +41258,6 @@ def test_fetch_remote_branches_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.FetchRemoteBranchesRequest() - assert args[0] == request_msg @@ -41158,7 +41278,6 @@ def test_list_workspaces_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.ListWorkspacesRequest() - assert args[0] == request_msg @@ -41179,7 +41298,6 @@ def test_get_workspace_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.GetWorkspaceRequest() - assert args[0] == request_msg @@ -41200,7 +41318,6 @@ def test_create_workspace_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.CreateWorkspaceRequest() - assert args[0] == request_msg @@ -41221,7 +41338,6 @@ def test_delete_workspace_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.DeleteWorkspaceRequest() - assert args[0] == request_msg @@ -41244,7 +41360,6 @@ def test_install_npm_packages_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.InstallNpmPackagesRequest() - assert args[0] == request_msg @@ -41265,7 +41380,6 @@ def test_pull_git_commits_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.PullGitCommitsRequest() - assert args[0] == request_msg @@ -41286,7 +41400,6 @@ def test_push_git_commits_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.PushGitCommitsRequest() - assert args[0] == request_msg @@ -41309,7 +41422,6 @@ def test_fetch_file_git_statuses_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.FetchFileGitStatusesRequest() - assert args[0] == request_msg @@ -41332,7 +41444,6 @@ def test_fetch_git_ahead_behind_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.FetchGitAheadBehindRequest() - assert args[0] == request_msg @@ -41355,7 +41466,6 @@ def test_commit_workspace_changes_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.CommitWorkspaceChangesRequest() - assert args[0] == request_msg @@ -41378,7 +41488,6 @@ def test_reset_workspace_changes_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.ResetWorkspaceChangesRequest() - assert args[0] == request_msg @@ -41399,7 +41508,6 @@ def test_fetch_file_diff_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.FetchFileDiffRequest() - assert args[0] == request_msg @@ -41422,7 +41530,6 @@ def test_query_directory_contents_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.QueryDirectoryContentsRequest() - assert args[0] == request_msg @@ -41443,7 +41550,6 @@ def test_search_files_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.SearchFilesRequest() - assert args[0] == request_msg @@ -41464,7 +41570,6 @@ def test_make_directory_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.MakeDirectoryRequest() - assert args[0] == request_msg @@ -41485,7 +41590,6 @@ def test_remove_directory_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.RemoveDirectoryRequest() - assert args[0] == request_msg @@ -41506,7 +41610,6 @@ def test_move_directory_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.MoveDirectoryRequest() - assert args[0] == request_msg @@ -41527,7 +41630,6 @@ def test_read_file_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.ReadFileRequest() - assert args[0] == request_msg @@ -41548,7 +41650,6 @@ def test_remove_file_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.RemoveFileRequest() - assert args[0] == request_msg @@ -41569,7 +41670,6 @@ def test_move_file_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.MoveFileRequest() - assert args[0] == request_msg @@ -41590,7 +41690,6 @@ def test_write_file_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.WriteFileRequest() - assert args[0] == request_msg @@ -41613,7 +41712,6 @@ def test_list_release_configs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.ListReleaseConfigsRequest() - assert args[0] == request_msg @@ -41636,7 +41734,6 @@ def test_get_release_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.GetReleaseConfigRequest() - assert args[0] == request_msg @@ -41659,7 +41756,6 @@ def test_create_release_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.CreateReleaseConfigRequest() - assert args[0] == request_msg @@ -41682,7 +41778,6 @@ def test_update_release_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.UpdateReleaseConfigRequest() - assert args[0] == request_msg @@ -41705,7 +41800,6 @@ def test_delete_release_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.DeleteReleaseConfigRequest() - assert args[0] == request_msg @@ -41728,7 +41822,6 @@ def test_list_compilation_results_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.ListCompilationResultsRequest() - assert args[0] == request_msg @@ -41751,7 +41844,6 @@ def test_get_compilation_result_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.GetCompilationResultRequest() - assert args[0] == request_msg @@ -41774,7 +41866,6 @@ def test_create_compilation_result_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.CreateCompilationResultRequest() - assert args[0] == request_msg @@ -41797,7 +41888,6 @@ def test_query_compilation_result_actions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.QueryCompilationResultActionsRequest() - assert args[0] == request_msg @@ -41820,7 +41910,6 @@ def test_list_workflow_configs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.ListWorkflowConfigsRequest() - assert args[0] == request_msg @@ -41843,7 +41932,6 @@ def test_get_workflow_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.GetWorkflowConfigRequest() - assert args[0] == request_msg @@ -41866,7 +41954,6 @@ def test_create_workflow_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.CreateWorkflowConfigRequest() - assert args[0] == request_msg @@ -41889,7 +41976,6 @@ def test_update_workflow_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.UpdateWorkflowConfigRequest() - assert args[0] == request_msg @@ -41912,7 +41998,6 @@ def test_delete_workflow_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.DeleteWorkflowConfigRequest() - assert args[0] == request_msg @@ -41935,7 +42020,6 @@ def test_list_workflow_invocations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.ListWorkflowInvocationsRequest() - assert args[0] == request_msg @@ -41958,7 +42042,6 @@ def test_get_workflow_invocation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.GetWorkflowInvocationRequest() - assert args[0] == request_msg @@ -41981,7 +42064,6 @@ def test_create_workflow_invocation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.CreateWorkflowInvocationRequest() - assert args[0] == request_msg @@ -42004,7 +42086,6 @@ def test_delete_workflow_invocation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.DeleteWorkflowInvocationRequest() - assert args[0] == request_msg @@ -42027,7 +42108,6 @@ def test_cancel_workflow_invocation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.CancelWorkflowInvocationRequest() - assert args[0] == request_msg @@ -42050,7 +42130,6 @@ def test_query_workflow_invocation_actions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.QueryWorkflowInvocationActionsRequest() - assert args[0] == request_msg @@ -42071,7 +42150,6 @@ def test_get_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.GetConfigRequest() - assert args[0] == request_msg @@ -42092,7 +42170,6 @@ def test_update_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.UpdateConfigRequest() - assert args[0] == request_msg @@ -42113,7 +42190,6 @@ def test_get_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -42134,7 +42210,6 @@ def test_set_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -42157,7 +42232,6 @@ def test_test_iam_permissions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -42201,7 +42275,6 @@ async def test_get_team_folder_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.GetTeamFolderRequest() - assert args[0] == request_msg @@ -42233,7 +42306,6 @@ async def test_create_team_folder_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.CreateTeamFolderRequest() - assert args[0] == request_msg @@ -42265,7 +42337,6 @@ async def test_update_team_folder_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.UpdateTeamFolderRequest() - assert args[0] == request_msg @@ -42290,7 +42361,6 @@ async def test_delete_team_folder_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.DeleteTeamFolderRequest() - assert args[0] == request_msg @@ -42317,7 +42387,6 @@ async def test_delete_team_folder_tree_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.DeleteTeamFolderTreeRequest() - assert args[0] == request_msg @@ -42346,7 +42415,6 @@ async def test_query_team_folder_contents_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.QueryTeamFolderContentsRequest() - assert args[0] == request_msg @@ -42375,7 +42443,6 @@ async def test_search_team_folders_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.SearchTeamFoldersRequest() - assert args[0] == request_msg @@ -42407,7 +42474,6 @@ async def test_get_folder_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.GetFolderRequest() - assert args[0] == request_msg @@ -42439,7 +42505,6 @@ async def test_create_folder_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.CreateFolderRequest() - assert args[0] == request_msg @@ -42471,7 +42536,6 @@ async def test_update_folder_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.UpdateFolderRequest() - assert args[0] == request_msg @@ -42494,7 +42558,6 @@ async def test_delete_folder_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.DeleteFolderRequest() - assert args[0] == request_msg @@ -42521,7 +42584,6 @@ async def test_delete_folder_tree_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.DeleteFolderTreeRequest() - assert args[0] == request_msg @@ -42550,7 +42612,6 @@ async def test_query_folder_contents_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.QueryFolderContentsRequest() - assert args[0] == request_msg @@ -42579,7 +42640,6 @@ async def test_query_user_root_contents_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.QueryUserRootContentsRequest() - assert args[0] == request_msg @@ -42604,7 +42664,6 @@ async def test_move_folder_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.MoveFolderRequest() - assert args[0] == request_msg @@ -42634,7 +42693,6 @@ async def test_list_repositories_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.ListRepositoriesRequest() - assert args[0] == request_msg @@ -42669,7 +42727,6 @@ async def test_get_repository_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.GetRepositoryRequest() - assert args[0] == request_msg @@ -42706,7 +42763,6 @@ async def test_create_repository_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.CreateRepositoryRequest() - assert args[0] == request_msg @@ -42743,7 +42799,6 @@ async def test_update_repository_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.UpdateRepositoryRequest() - assert args[0] == request_msg @@ -42768,7 +42823,6 @@ async def test_delete_repository_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.DeleteRepositoryRequest() - assert args[0] == request_msg @@ -42793,7 +42847,6 @@ async def test_move_repository_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.MoveRepositoryRequest() - assert args[0] == request_msg @@ -42822,7 +42875,6 @@ async def test_commit_repository_changes_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.CommitRepositoryChangesRequest() - assert args[0] == request_msg @@ -42851,7 +42903,6 @@ async def test_read_repository_file_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.ReadRepositoryFileRequest() - assert args[0] == request_msg @@ -42880,7 +42931,6 @@ async def test_query_repository_directory_contents_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.QueryRepositoryDirectoryContentsRequest() - assert args[0] == request_msg @@ -42909,7 +42959,6 @@ async def test_fetch_repository_history_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.FetchRepositoryHistoryRequest() - assert args[0] == request_msg @@ -42938,7 +42987,6 @@ async def test_compute_repository_access_token_status_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.ComputeRepositoryAccessTokenStatusRequest() - assert args[0] == request_msg @@ -42967,7 +43015,6 @@ async def test_fetch_remote_branches_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.FetchRemoteBranchesRequest() - assert args[0] == request_msg @@ -42995,7 +43042,6 @@ async def test_list_workspaces_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.ListWorkspacesRequest() - assert args[0] == request_msg @@ -43024,7 +43070,6 @@ async def test_get_workspace_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.GetWorkspaceRequest() - assert args[0] == request_msg @@ -43053,7 +43098,6 @@ async def test_create_workspace_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.CreateWorkspaceRequest() - assert args[0] == request_msg @@ -43076,7 +43120,6 @@ async def test_delete_workspace_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.DeleteWorkspaceRequest() - assert args[0] == request_msg @@ -43103,7 +43146,6 @@ async def test_install_npm_packages_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.InstallNpmPackagesRequest() - assert args[0] == request_msg @@ -43128,7 +43170,6 @@ async def test_pull_git_commits_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.PullGitCommitsRequest() - assert args[0] == request_msg @@ -43153,7 +43194,6 @@ async def test_push_git_commits_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.PushGitCommitsRequest() - assert args[0] == request_msg @@ -43180,7 +43220,6 @@ async def test_fetch_file_git_statuses_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.FetchFileGitStatusesRequest() - assert args[0] == request_msg @@ -43210,7 +43249,6 @@ async def test_fetch_git_ahead_behind_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.FetchGitAheadBehindRequest() - assert args[0] == request_msg @@ -43237,7 +43275,6 @@ async def test_commit_workspace_changes_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.CommitWorkspaceChangesRequest() - assert args[0] == request_msg @@ -43264,7 +43301,6 @@ async def test_reset_workspace_changes_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.ResetWorkspaceChangesRequest() - assert args[0] == request_msg @@ -43291,7 +43327,6 @@ async def test_fetch_file_diff_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.FetchFileDiffRequest() - assert args[0] == request_msg @@ -43320,7 +43355,6 @@ async def test_query_directory_contents_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.QueryDirectoryContentsRequest() - assert args[0] == request_msg @@ -43347,7 +43381,6 @@ async def test_search_files_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.SearchFilesRequest() - assert args[0] == request_msg @@ -43372,7 +43405,6 @@ async def test_make_directory_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.MakeDirectoryRequest() - assert args[0] == request_msg @@ -43397,7 +43429,6 @@ async def test_remove_directory_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.RemoveDirectoryRequest() - assert args[0] == request_msg @@ -43422,7 +43453,6 @@ async def test_move_directory_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.MoveDirectoryRequest() - assert args[0] == request_msg @@ -43449,7 +43479,6 @@ async def test_read_file_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.ReadFileRequest() - assert args[0] == request_msg @@ -43474,7 +43503,6 @@ async def test_remove_file_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.RemoveFileRequest() - assert args[0] == request_msg @@ -43499,7 +43527,6 @@ async def test_move_file_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.MoveFileRequest() - assert args[0] == request_msg @@ -43524,7 +43551,6 @@ async def test_write_file_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.WriteFileRequest() - assert args[0] == request_msg @@ -43554,7 +43580,6 @@ async def test_list_release_configs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.ListReleaseConfigsRequest() - assert args[0] == request_msg @@ -43589,7 +43614,6 @@ async def test_get_release_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.GetReleaseConfigRequest() - assert args[0] == request_msg @@ -43624,7 +43648,6 @@ async def test_create_release_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.CreateReleaseConfigRequest() - assert args[0] == request_msg @@ -43659,7 +43682,6 @@ async def test_update_release_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.UpdateReleaseConfigRequest() - assert args[0] == request_msg @@ -43684,7 +43706,6 @@ async def test_delete_release_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.DeleteReleaseConfigRequest() - assert args[0] == request_msg @@ -43714,7 +43735,6 @@ async def test_list_compilation_results_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.ListCompilationResultsRequest() - assert args[0] == request_msg @@ -43746,7 +43766,6 @@ async def test_get_compilation_result_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.GetCompilationResultRequest() - assert args[0] == request_msg @@ -43778,7 +43797,6 @@ async def test_create_compilation_result_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.CreateCompilationResultRequest() - assert args[0] == request_msg @@ -43807,7 +43825,6 @@ async def test_query_compilation_result_actions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.QueryCompilationResultActionsRequest() - assert args[0] == request_msg @@ -43837,7 +43854,6 @@ async def test_list_workflow_configs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.ListWorkflowConfigsRequest() - assert args[0] == request_msg @@ -43871,7 +43887,6 @@ async def test_get_workflow_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.GetWorkflowConfigRequest() - assert args[0] == request_msg @@ -43905,7 +43920,6 @@ async def test_create_workflow_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.CreateWorkflowConfigRequest() - assert args[0] == request_msg @@ -43939,7 +43953,6 @@ async def test_update_workflow_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.UpdateWorkflowConfigRequest() - assert args[0] == request_msg @@ -43964,7 +43977,6 @@ async def test_delete_workflow_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.DeleteWorkflowConfigRequest() - assert args[0] == request_msg @@ -43994,7 +44006,6 @@ async def test_list_workflow_invocations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.ListWorkflowInvocationsRequest() - assert args[0] == request_msg @@ -44026,7 +44037,6 @@ async def test_get_workflow_invocation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.GetWorkflowInvocationRequest() - assert args[0] == request_msg @@ -44058,7 +44068,6 @@ async def test_create_workflow_invocation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.CreateWorkflowInvocationRequest() - assert args[0] == request_msg @@ -44083,7 +44092,6 @@ async def test_delete_workflow_invocation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.DeleteWorkflowInvocationRequest() - assert args[0] == request_msg @@ -44110,7 +44118,6 @@ async def test_cancel_workflow_invocation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.CancelWorkflowInvocationRequest() - assert args[0] == request_msg @@ -44139,7 +44146,6 @@ async def test_query_workflow_invocation_actions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.QueryWorkflowInvocationActionsRequest() - assert args[0] == request_msg @@ -44168,7 +44174,6 @@ async def test_get_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.GetConfigRequest() - assert args[0] == request_msg @@ -44197,7 +44202,6 @@ async def test_update_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.UpdateConfigRequest() - assert args[0] == request_msg @@ -44225,7 +44229,6 @@ async def test_get_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -44253,7 +44256,6 @@ async def test_set_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -44282,7 +44284,6 @@ async def test_test_iam_permissions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -55578,7 +55579,6 @@ def test_get_team_folder_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.GetTeamFolderRequest() - assert args[0] == request_msg @@ -55600,7 +55600,6 @@ def test_create_team_folder_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.CreateTeamFolderRequest() - assert args[0] == request_msg @@ -55622,7 +55621,6 @@ def test_update_team_folder_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.UpdateTeamFolderRequest() - assert args[0] == request_msg @@ -55644,7 +55642,6 @@ def test_delete_team_folder_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.DeleteTeamFolderRequest() - assert args[0] == request_msg @@ -55666,7 +55663,6 @@ def test_delete_team_folder_tree_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.DeleteTeamFolderTreeRequest() - assert args[0] == request_msg @@ -55688,7 +55684,6 @@ def test_query_team_folder_contents_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.QueryTeamFolderContentsRequest() - assert args[0] == request_msg @@ -55710,7 +55705,6 @@ def test_search_team_folders_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.SearchTeamFoldersRequest() - assert args[0] == request_msg @@ -55730,7 +55724,6 @@ def test_get_folder_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.GetFolderRequest() - assert args[0] == request_msg @@ -55750,7 +55743,6 @@ def test_create_folder_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.CreateFolderRequest() - assert args[0] == request_msg @@ -55770,7 +55762,6 @@ def test_update_folder_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.UpdateFolderRequest() - assert args[0] == request_msg @@ -55790,7 +55781,6 @@ def test_delete_folder_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.DeleteFolderRequest() - assert args[0] == request_msg @@ -55812,7 +55802,6 @@ def test_delete_folder_tree_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.DeleteFolderTreeRequest() - assert args[0] == request_msg @@ -55834,7 +55823,6 @@ def test_query_folder_contents_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.QueryFolderContentsRequest() - assert args[0] == request_msg @@ -55856,7 +55844,6 @@ def test_query_user_root_contents_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.QueryUserRootContentsRequest() - assert args[0] == request_msg @@ -55876,7 +55863,6 @@ def test_move_folder_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.MoveFolderRequest() - assert args[0] == request_msg @@ -55898,7 +55884,6 @@ def test_list_repositories_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.ListRepositoriesRequest() - assert args[0] == request_msg @@ -55918,7 +55903,6 @@ def test_get_repository_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.GetRepositoryRequest() - assert args[0] == request_msg @@ -55940,7 +55924,6 @@ def test_create_repository_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.CreateRepositoryRequest() - assert args[0] == request_msg @@ -55962,7 +55945,6 @@ def test_update_repository_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.UpdateRepositoryRequest() - assert args[0] == request_msg @@ -55984,7 +55966,6 @@ def test_delete_repository_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.DeleteRepositoryRequest() - assert args[0] == request_msg @@ -56004,7 +55985,6 @@ def test_move_repository_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.MoveRepositoryRequest() - assert args[0] == request_msg @@ -56026,7 +56006,6 @@ def test_commit_repository_changes_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.CommitRepositoryChangesRequest() - assert args[0] == request_msg @@ -56048,7 +56027,6 @@ def test_read_repository_file_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.ReadRepositoryFileRequest() - assert args[0] == request_msg @@ -56070,7 +56048,6 @@ def test_query_repository_directory_contents_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.QueryRepositoryDirectoryContentsRequest() - assert args[0] == request_msg @@ -56092,7 +56069,6 @@ def test_fetch_repository_history_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.FetchRepositoryHistoryRequest() - assert args[0] == request_msg @@ -56114,7 +56090,6 @@ def test_compute_repository_access_token_status_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.ComputeRepositoryAccessTokenStatusRequest() - assert args[0] == request_msg @@ -56136,7 +56111,6 @@ def test_fetch_remote_branches_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.FetchRemoteBranchesRequest() - assert args[0] == request_msg @@ -56156,7 +56130,6 @@ def test_list_workspaces_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.ListWorkspacesRequest() - assert args[0] == request_msg @@ -56176,7 +56149,6 @@ def test_get_workspace_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.GetWorkspaceRequest() - assert args[0] == request_msg @@ -56196,7 +56168,6 @@ def test_create_workspace_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.CreateWorkspaceRequest() - assert args[0] == request_msg @@ -56216,7 +56187,6 @@ def test_delete_workspace_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.DeleteWorkspaceRequest() - assert args[0] == request_msg @@ -56238,7 +56208,6 @@ def test_install_npm_packages_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.InstallNpmPackagesRequest() - assert args[0] == request_msg @@ -56258,7 +56227,6 @@ def test_pull_git_commits_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.PullGitCommitsRequest() - assert args[0] == request_msg @@ -56278,7 +56246,6 @@ def test_push_git_commits_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.PushGitCommitsRequest() - assert args[0] == request_msg @@ -56300,7 +56267,6 @@ def test_fetch_file_git_statuses_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.FetchFileGitStatusesRequest() - assert args[0] == request_msg @@ -56322,7 +56288,6 @@ def test_fetch_git_ahead_behind_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.FetchGitAheadBehindRequest() - assert args[0] == request_msg @@ -56344,7 +56309,6 @@ def test_commit_workspace_changes_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.CommitWorkspaceChangesRequest() - assert args[0] == request_msg @@ -56366,7 +56330,6 @@ def test_reset_workspace_changes_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.ResetWorkspaceChangesRequest() - assert args[0] == request_msg @@ -56386,7 +56349,6 @@ def test_fetch_file_diff_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.FetchFileDiffRequest() - assert args[0] == request_msg @@ -56408,7 +56370,6 @@ def test_query_directory_contents_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.QueryDirectoryContentsRequest() - assert args[0] == request_msg @@ -56428,7 +56389,6 @@ def test_search_files_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.SearchFilesRequest() - assert args[0] == request_msg @@ -56448,7 +56408,6 @@ def test_make_directory_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.MakeDirectoryRequest() - assert args[0] == request_msg @@ -56468,7 +56427,6 @@ def test_remove_directory_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.RemoveDirectoryRequest() - assert args[0] == request_msg @@ -56488,7 +56446,6 @@ def test_move_directory_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.MoveDirectoryRequest() - assert args[0] == request_msg @@ -56508,7 +56465,6 @@ def test_read_file_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.ReadFileRequest() - assert args[0] == request_msg @@ -56528,7 +56484,6 @@ def test_remove_file_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.RemoveFileRequest() - assert args[0] == request_msg @@ -56548,7 +56503,6 @@ def test_move_file_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.MoveFileRequest() - assert args[0] == request_msg @@ -56568,7 +56522,6 @@ def test_write_file_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.WriteFileRequest() - assert args[0] == request_msg @@ -56590,7 +56543,6 @@ def test_list_release_configs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.ListReleaseConfigsRequest() - assert args[0] == request_msg @@ -56612,7 +56564,6 @@ def test_get_release_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.GetReleaseConfigRequest() - assert args[0] == request_msg @@ -56634,7 +56585,6 @@ def test_create_release_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.CreateReleaseConfigRequest() - assert args[0] == request_msg @@ -56656,7 +56606,6 @@ def test_update_release_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.UpdateReleaseConfigRequest() - assert args[0] == request_msg @@ -56678,7 +56627,6 @@ def test_delete_release_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.DeleteReleaseConfigRequest() - assert args[0] == request_msg @@ -56700,7 +56648,6 @@ def test_list_compilation_results_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.ListCompilationResultsRequest() - assert args[0] == request_msg @@ -56722,7 +56669,6 @@ def test_get_compilation_result_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.GetCompilationResultRequest() - assert args[0] == request_msg @@ -56744,7 +56690,6 @@ def test_create_compilation_result_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.CreateCompilationResultRequest() - assert args[0] == request_msg @@ -56766,7 +56711,6 @@ def test_query_compilation_result_actions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.QueryCompilationResultActionsRequest() - assert args[0] == request_msg @@ -56788,7 +56732,6 @@ def test_list_workflow_configs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.ListWorkflowConfigsRequest() - assert args[0] == request_msg @@ -56810,7 +56753,6 @@ def test_get_workflow_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.GetWorkflowConfigRequest() - assert args[0] == request_msg @@ -56832,7 +56774,6 @@ def test_create_workflow_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.CreateWorkflowConfigRequest() - assert args[0] == request_msg @@ -56854,7 +56795,6 @@ def test_update_workflow_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.UpdateWorkflowConfigRequest() - assert args[0] == request_msg @@ -56876,7 +56816,6 @@ def test_delete_workflow_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.DeleteWorkflowConfigRequest() - assert args[0] == request_msg @@ -56898,7 +56837,6 @@ def test_list_workflow_invocations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.ListWorkflowInvocationsRequest() - assert args[0] == request_msg @@ -56920,7 +56858,6 @@ def test_get_workflow_invocation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.GetWorkflowInvocationRequest() - assert args[0] == request_msg @@ -56942,7 +56879,6 @@ def test_create_workflow_invocation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.CreateWorkflowInvocationRequest() - assert args[0] == request_msg @@ -56964,7 +56900,6 @@ def test_delete_workflow_invocation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.DeleteWorkflowInvocationRequest() - assert args[0] == request_msg @@ -56986,7 +56921,6 @@ def test_cancel_workflow_invocation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.CancelWorkflowInvocationRequest() - assert args[0] == request_msg @@ -57008,7 +56942,6 @@ def test_query_workflow_invocation_actions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.QueryWorkflowInvocationActionsRequest() - assert args[0] == request_msg @@ -57028,7 +56961,6 @@ def test_get_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.GetConfigRequest() - assert args[0] == request_msg @@ -57048,7 +56980,6 @@ def test_update_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.UpdateConfigRequest() - assert args[0] == request_msg @@ -57068,7 +56999,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -57088,7 +57018,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -57110,7 +57039,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dataform/tests/unit/gapic/dataform_v1beta1/test_dataform.py b/packages/google-cloud-dataform/tests/unit/gapic/dataform_v1beta1/test_dataform.py index 12cf2a8681f1..cd9519c1fa14 100644 --- a/packages/google-cloud-dataform/tests/unit/gapic/dataform_v1beta1/test_dataform.py +++ b/packages/google-cloud-dataform/tests/unit/gapic/dataform_v1beta1/test_dataform.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 @@ -128,6 +129,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" @@ -1275,8 +1291,8 @@ def test_dataform_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - dataform.GetTeamFolderRequest, - dict, + dataform.GetTeamFolderRequest(), + {}, ], ) def test_get_team_folder(request_type, transport: str = "grpc"): @@ -1287,7 +1303,7 @@ def test_get_team_folder(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_team_folder), "__call__") as call: @@ -1337,9 +1353,10 @@ def test_get_team_folder_non_empty_request_with_auto_populated_field(): client.get_team_folder(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.GetTeamFolderRequest( + request_msg = dataform.GetTeamFolderRequest( name="name_value", ) + assert args[0] == request_msg def test_get_team_folder_use_cached_wrapped_rpc(): @@ -1420,9 +1437,14 @@ async def test_get_team_folder_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_team_folder_async( - transport: str = "grpc_asyncio", request_type=dataform.GetTeamFolderRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataform.GetTeamFolderRequest(), + {}, + ], +) +async def test_get_team_folder_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1430,7 +1452,7 @@ async def test_get_team_folder_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_team_folder), "__call__") as call: @@ -1459,11 +1481,6 @@ async def test_get_team_folder_async( assert response.creator_iam_principal == "creator_iam_principal_value" -@pytest.mark.asyncio -async def test_get_team_folder_async_from_dict(): - await test_get_team_folder_async(request_type=dict) - - def test_get_team_folder_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1606,8 +1623,8 @@ async def test_get_team_folder_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dataform.CreateTeamFolderRequest, - dict, + dataform.CreateTeamFolderRequest(), + {}, ], ) def test_create_team_folder(request_type, transport: str = "grpc"): @@ -1618,7 +1635,7 @@ def test_create_team_folder(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1673,10 +1690,11 @@ def test_create_team_folder_non_empty_request_with_auto_populated_field(): client.create_team_folder(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.CreateTeamFolderRequest( + request_msg = dataform.CreateTeamFolderRequest( parent="parent_value", team_folder_id="team_folder_id_value", ) + assert args[0] == request_msg def test_create_team_folder_use_cached_wrapped_rpc(): @@ -1761,9 +1779,14 @@ async def test_create_team_folder_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_team_folder_async( - transport: str = "grpc_asyncio", request_type=dataform.CreateTeamFolderRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataform.CreateTeamFolderRequest(), + {}, + ], +) +async def test_create_team_folder_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1771,7 +1794,7 @@ async def test_create_team_folder_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( @@ -1802,11 +1825,6 @@ async def test_create_team_folder_async( assert response.creator_iam_principal == "creator_iam_principal_value" -@pytest.mark.asyncio -async def test_create_team_folder_async_from_dict(): - await test_create_team_folder_async(request_type=dict) - - def test_create_team_folder_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1967,8 +1985,8 @@ async def test_create_team_folder_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dataform.UpdateTeamFolderRequest, - dict, + dataform.UpdateTeamFolderRequest(), + {}, ], ) def test_update_team_folder(request_type, transport: str = "grpc"): @@ -1979,7 +1997,7 @@ def test_update_team_folder(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2031,7 +2049,8 @@ def test_update_team_folder_non_empty_request_with_auto_populated_field(): client.update_team_folder(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.UpdateTeamFolderRequest() + request_msg = dataform.UpdateTeamFolderRequest() + assert args[0] == request_msg def test_update_team_folder_use_cached_wrapped_rpc(): @@ -2116,9 +2135,14 @@ async def test_update_team_folder_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_team_folder_async( - transport: str = "grpc_asyncio", request_type=dataform.UpdateTeamFolderRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataform.UpdateTeamFolderRequest(), + {}, + ], +) +async def test_update_team_folder_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2126,7 +2150,7 @@ async def test_update_team_folder_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( @@ -2157,11 +2181,6 @@ async def test_update_team_folder_async( assert response.creator_iam_principal == "creator_iam_principal_value" -@pytest.mark.asyncio -async def test_update_team_folder_async_from_dict(): - await test_update_team_folder_async(request_type=dict) - - def test_update_team_folder_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2322,8 +2341,8 @@ async def test_update_team_folder_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dataform.DeleteTeamFolderRequest, - dict, + dataform.DeleteTeamFolderRequest(), + {}, ], ) def test_delete_team_folder(request_type, transport: str = "grpc"): @@ -2334,7 +2353,7 @@ def test_delete_team_folder(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2379,9 +2398,10 @@ def test_delete_team_folder_non_empty_request_with_auto_populated_field(): client.delete_team_folder(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.DeleteTeamFolderRequest( + request_msg = dataform.DeleteTeamFolderRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_team_folder_use_cached_wrapped_rpc(): @@ -2466,9 +2486,14 @@ async def test_delete_team_folder_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_team_folder_async( - transport: str = "grpc_asyncio", request_type=dataform.DeleteTeamFolderRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataform.DeleteTeamFolderRequest(), + {}, + ], +) +async def test_delete_team_folder_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2476,7 +2501,7 @@ async def test_delete_team_folder_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( @@ -2496,11 +2521,6 @@ async def test_delete_team_folder_async( assert response is None -@pytest.mark.asyncio -async def test_delete_team_folder_async_from_dict(): - await test_delete_team_folder_async(request_type=dict) - - def test_delete_team_folder_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2651,8 +2671,8 @@ async def test_delete_team_folder_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dataform.QueryTeamFolderContentsRequest, - dict, + dataform.QueryTeamFolderContentsRequest(), + {}, ], ) def test_query_team_folder_contents(request_type, transport: str = "grpc"): @@ -2663,7 +2683,7 @@ def test_query_team_folder_contents(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2714,12 +2734,13 @@ def test_query_team_folder_contents_non_empty_request_with_auto_populated_field( client.query_team_folder_contents(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.QueryTeamFolderContentsRequest( + request_msg = dataform.QueryTeamFolderContentsRequest( team_folder="team_folder_value", page_token="page_token_value", order_by="order_by_value", filter="filter_value", ) + assert args[0] == request_msg def test_query_team_folder_contents_use_cached_wrapped_rpc(): @@ -2805,9 +2826,15 @@ async def test_query_team_folder_contents_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dataform.QueryTeamFolderContentsRequest(), + {}, + ], +) async def test_query_team_folder_contents_async( - transport: str = "grpc_asyncio", - request_type=dataform.QueryTeamFolderContentsRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataformAsyncClient( credentials=async_anonymous_credentials(), @@ -2816,7 +2843,7 @@ async def test_query_team_folder_contents_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( @@ -2841,11 +2868,6 @@ async def test_query_team_folder_contents_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_query_team_folder_contents_async_from_dict(): - await test_query_team_folder_contents_async(request_type=dict) - - def test_query_team_folder_contents_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3210,8 +3232,8 @@ async def test_query_team_folder_contents_async_pages(): @pytest.mark.parametrize( "request_type", [ - dataform.SearchTeamFoldersRequest, - dict, + dataform.SearchTeamFoldersRequest(), + {}, ], ) def test_search_team_folders(request_type, transport: str = "grpc"): @@ -3222,7 +3244,7 @@ def test_search_team_folders(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3273,12 +3295,13 @@ def test_search_team_folders_non_empty_request_with_auto_populated_field(): client.search_team_folders(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.SearchTeamFoldersRequest( + request_msg = dataform.SearchTeamFoldersRequest( location="location_value", page_token="page_token_value", order_by="order_by_value", filter="filter_value", ) + assert args[0] == request_msg def test_search_team_folders_use_cached_wrapped_rpc(): @@ -3363,9 +3386,14 @@ async def test_search_team_folders_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_search_team_folders_async( - transport: str = "grpc_asyncio", request_type=dataform.SearchTeamFoldersRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataform.SearchTeamFoldersRequest(), + {}, + ], +) +async def test_search_team_folders_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3373,7 +3401,7 @@ async def test_search_team_folders_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( @@ -3398,11 +3426,6 @@ async def test_search_team_folders_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_search_team_folders_async_from_dict(): - await test_search_team_folders_async(request_type=dict) - - def test_search_team_folders_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3675,8 +3698,8 @@ async def test_search_team_folders_async_pages(): @pytest.mark.parametrize( "request_type", [ - dataform.GetFolderRequest, - dict, + dataform.GetFolderRequest(), + {}, ], ) def test_get_folder(request_type, transport: str = "grpc"): @@ -3687,7 +3710,7 @@ def test_get_folder(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_folder), "__call__") as call: @@ -3741,9 +3764,10 @@ def test_get_folder_non_empty_request_with_auto_populated_field(): client.get_folder(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.GetFolderRequest( + request_msg = dataform.GetFolderRequest( name="name_value", ) + assert args[0] == request_msg def test_get_folder_use_cached_wrapped_rpc(): @@ -3822,9 +3846,14 @@ async def test_get_folder_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_folder_async( - transport: str = "grpc_asyncio", request_type=dataform.GetFolderRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataform.GetFolderRequest(), + {}, + ], +) +async def test_get_folder_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3832,7 +3861,7 @@ async def test_get_folder_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_folder), "__call__") as call: @@ -3865,11 +3894,6 @@ async def test_get_folder_async( assert response.creator_iam_principal == "creator_iam_principal_value" -@pytest.mark.asyncio -async def test_get_folder_async_from_dict(): - await test_get_folder_async(request_type=dict) - - def test_get_folder_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4012,8 +4036,8 @@ async def test_get_folder_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dataform.CreateFolderRequest, - dict, + dataform.CreateFolderRequest(), + {}, ], ) def test_create_folder(request_type, transport: str = "grpc"): @@ -4024,7 +4048,7 @@ def test_create_folder(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_folder), "__call__") as call: @@ -4079,10 +4103,11 @@ def test_create_folder_non_empty_request_with_auto_populated_field(): client.create_folder(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.CreateFolderRequest( + request_msg = dataform.CreateFolderRequest( parent="parent_value", folder_id="folder_id_value", ) + assert args[0] == request_msg def test_create_folder_use_cached_wrapped_rpc(): @@ -4163,9 +4188,14 @@ async def test_create_folder_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_folder_async( - transport: str = "grpc_asyncio", request_type=dataform.CreateFolderRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataform.CreateFolderRequest(), + {}, + ], +) +async def test_create_folder_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4173,7 +4203,7 @@ async def test_create_folder_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_folder), "__call__") as call: @@ -4206,11 +4236,6 @@ async def test_create_folder_async( assert response.creator_iam_principal == "creator_iam_principal_value" -@pytest.mark.asyncio -async def test_create_folder_async_from_dict(): - await test_create_folder_async(request_type=dict) - - def test_create_folder_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4363,8 +4388,8 @@ async def test_create_folder_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dataform.UpdateFolderRequest, - dict, + dataform.UpdateFolderRequest(), + {}, ], ) def test_update_folder(request_type, transport: str = "grpc"): @@ -4375,7 +4400,7 @@ def test_update_folder(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_folder), "__call__") as call: @@ -4427,7 +4452,8 @@ def test_update_folder_non_empty_request_with_auto_populated_field(): client.update_folder(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.UpdateFolderRequest() + request_msg = dataform.UpdateFolderRequest() + assert args[0] == request_msg def test_update_folder_use_cached_wrapped_rpc(): @@ -4508,9 +4534,14 @@ async def test_update_folder_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_folder_async( - transport: str = "grpc_asyncio", request_type=dataform.UpdateFolderRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataform.UpdateFolderRequest(), + {}, + ], +) +async def test_update_folder_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4518,7 +4549,7 @@ async def test_update_folder_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_folder), "__call__") as call: @@ -4551,11 +4582,6 @@ async def test_update_folder_async( assert response.creator_iam_principal == "creator_iam_principal_value" -@pytest.mark.asyncio -async def test_update_folder_async_from_dict(): - await test_update_folder_async(request_type=dict) - - def test_update_folder_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4708,8 +4734,8 @@ async def test_update_folder_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dataform.DeleteFolderRequest, - dict, + dataform.DeleteFolderRequest(), + {}, ], ) def test_delete_folder(request_type, transport: str = "grpc"): @@ -4720,7 +4746,7 @@ def test_delete_folder(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_folder), "__call__") as call: @@ -4761,9 +4787,10 @@ def test_delete_folder_non_empty_request_with_auto_populated_field(): client.delete_folder(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.DeleteFolderRequest( + request_msg = dataform.DeleteFolderRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_folder_use_cached_wrapped_rpc(): @@ -4844,9 +4871,14 @@ async def test_delete_folder_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_folder_async( - transport: str = "grpc_asyncio", request_type=dataform.DeleteFolderRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataform.DeleteFolderRequest(), + {}, + ], +) +async def test_delete_folder_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4854,7 +4886,7 @@ async def test_delete_folder_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_folder), "__call__") as call: @@ -4872,11 +4904,6 @@ async def test_delete_folder_async( assert response is None -@pytest.mark.asyncio -async def test_delete_folder_async_from_dict(): - await test_delete_folder_async(request_type=dict) - - def test_delete_folder_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5019,8 +5046,8 @@ async def test_delete_folder_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dataform.QueryFolderContentsRequest, - dict, + dataform.QueryFolderContentsRequest(), + {}, ], ) def test_query_folder_contents(request_type, transport: str = "grpc"): @@ -5031,7 +5058,7 @@ def test_query_folder_contents(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5082,12 +5109,13 @@ def test_query_folder_contents_non_empty_request_with_auto_populated_field(): client.query_folder_contents(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.QueryFolderContentsRequest( + request_msg = dataform.QueryFolderContentsRequest( folder="folder_value", page_token="page_token_value", order_by="order_by_value", filter="filter_value", ) + assert args[0] == request_msg def test_query_folder_contents_use_cached_wrapped_rpc(): @@ -5173,8 +5201,15 @@ async def test_query_folder_contents_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dataform.QueryFolderContentsRequest(), + {}, + ], +) async def test_query_folder_contents_async( - transport: str = "grpc_asyncio", request_type=dataform.QueryFolderContentsRequest + request_type, transport: str = "grpc_asyncio" ): client = DataformAsyncClient( credentials=async_anonymous_credentials(), @@ -5183,7 +5218,7 @@ async def test_query_folder_contents_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( @@ -5208,11 +5243,6 @@ async def test_query_folder_contents_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_query_folder_contents_async_from_dict(): - await test_query_folder_contents_async(request_type=dict) - - def test_query_folder_contents_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5571,8 +5601,8 @@ async def test_query_folder_contents_async_pages(): @pytest.mark.parametrize( "request_type", [ - dataform.QueryUserRootContentsRequest, - dict, + dataform.QueryUserRootContentsRequest(), + {}, ], ) def test_query_user_root_contents(request_type, transport: str = "grpc"): @@ -5583,7 +5613,7 @@ def test_query_user_root_contents(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5634,12 +5664,13 @@ def test_query_user_root_contents_non_empty_request_with_auto_populated_field(): client.query_user_root_contents(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.QueryUserRootContentsRequest( + request_msg = dataform.QueryUserRootContentsRequest( location="location_value", page_token="page_token_value", order_by="order_by_value", filter="filter_value", ) + assert args[0] == request_msg def test_query_user_root_contents_use_cached_wrapped_rpc(): @@ -5725,8 +5756,15 @@ async def test_query_user_root_contents_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dataform.QueryUserRootContentsRequest(), + {}, + ], +) async def test_query_user_root_contents_async( - transport: str = "grpc_asyncio", request_type=dataform.QueryUserRootContentsRequest + request_type, transport: str = "grpc_asyncio" ): client = DataformAsyncClient( credentials=async_anonymous_credentials(), @@ -5735,7 +5773,7 @@ async def test_query_user_root_contents_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( @@ -5760,11 +5798,6 @@ async def test_query_user_root_contents_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_query_user_root_contents_async_from_dict(): - await test_query_user_root_contents_async(request_type=dict) - - def test_query_user_root_contents_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6125,8 +6158,8 @@ async def test_query_user_root_contents_async_pages(): @pytest.mark.parametrize( "request_type", [ - dataform.MoveFolderRequest, - dict, + dataform.MoveFolderRequest(), + {}, ], ) def test_move_folder(request_type, transport: str = "grpc"): @@ -6137,7 +6170,7 @@ def test_move_folder(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.move_folder), "__call__") as call: @@ -6179,10 +6212,11 @@ def test_move_folder_non_empty_request_with_auto_populated_field(): client.move_folder(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.MoveFolderRequest( + request_msg = dataform.MoveFolderRequest( name="name_value", destination_containing_folder="destination_containing_folder_value", ) + assert args[0] == request_msg def test_move_folder_use_cached_wrapped_rpc(): @@ -6273,9 +6307,14 @@ async def test_move_folder_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_move_folder_async( - transport: str = "grpc_asyncio", request_type=dataform.MoveFolderRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataform.MoveFolderRequest(), + {}, + ], +) +async def test_move_folder_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6283,7 +6322,7 @@ async def test_move_folder_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.move_folder), "__call__") as call: @@ -6303,11 +6342,6 @@ async def test_move_folder_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_move_folder_async_from_dict(): - await test_move_folder_async(request_type=dict) - - def test_move_folder_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6464,8 +6498,8 @@ async def test_move_folder_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dataform.ListRepositoriesRequest, - dict, + dataform.ListRepositoriesRequest(), + {}, ], ) def test_list_repositories(request_type, transport: str = "grpc"): @@ -6476,7 +6510,7 @@ def test_list_repositories(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6529,12 +6563,13 @@ def test_list_repositories_non_empty_request_with_auto_populated_field(): client.list_repositories(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.ListRepositoriesRequest( + request_msg = dataform.ListRepositoriesRequest( parent="parent_value", page_token="page_token_value", order_by="order_by_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_repositories_use_cached_wrapped_rpc(): @@ -6617,9 +6652,14 @@ async def test_list_repositories_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_repositories_async( - transport: str = "grpc_asyncio", request_type=dataform.ListRepositoriesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataform.ListRepositoriesRequest(), + {}, + ], +) +async def test_list_repositories_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6627,7 +6667,7 @@ async def test_list_repositories_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( @@ -6654,11 +6694,6 @@ async def test_list_repositories_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_repositories_async_from_dict(): - await test_list_repositories_async(request_type=dict) - - def test_list_repositories_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7011,8 +7046,8 @@ async def test_list_repositories_async_pages(): @pytest.mark.parametrize( "request_type", [ - dataform.GetRepositoryRequest, - dict, + dataform.GetRepositoryRequest(), + {}, ], ) def test_get_repository(request_type, transport: str = "grpc"): @@ -7023,7 +7058,7 @@ def test_get_repository(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_repository), "__call__") as call: @@ -7086,9 +7121,10 @@ def test_get_repository_non_empty_request_with_auto_populated_field(): client.get_repository(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.GetRepositoryRequest( + request_msg = dataform.GetRepositoryRequest( name="name_value", ) + assert args[0] == request_msg def test_get_repository_use_cached_wrapped_rpc(): @@ -7169,9 +7205,14 @@ async def test_get_repository_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_repository_async( - transport: str = "grpc_asyncio", request_type=dataform.GetRepositoryRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataform.GetRepositoryRequest(), + {}, + ], +) +async def test_get_repository_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7179,7 +7220,7 @@ async def test_get_repository_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_repository), "__call__") as call: @@ -7221,11 +7262,6 @@ async def test_get_repository_async( assert response.internal_metadata == "internal_metadata_value" -@pytest.mark.asyncio -async def test_get_repository_async_from_dict(): - await test_get_repository_async(request_type=dict) - - def test_get_repository_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7368,8 +7404,8 @@ async def test_get_repository_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dataform.CreateRepositoryRequest, - dict, + dataform.CreateRepositoryRequest(), + {}, ], ) def test_create_repository(request_type, transport: str = "grpc"): @@ -7380,7 +7416,7 @@ def test_create_repository(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7448,10 +7484,11 @@ def test_create_repository_non_empty_request_with_auto_populated_field(): client.create_repository(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.CreateRepositoryRequest( + request_msg = dataform.CreateRepositoryRequest( parent="parent_value", repository_id="repository_id_value", ) + assert args[0] == request_msg def test_create_repository_use_cached_wrapped_rpc(): @@ -7534,9 +7571,14 @@ async def test_create_repository_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_repository_async( - transport: str = "grpc_asyncio", request_type=dataform.CreateRepositoryRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataform.CreateRepositoryRequest(), + {}, + ], +) +async def test_create_repository_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7544,7 +7586,7 @@ async def test_create_repository_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( @@ -7588,11 +7630,6 @@ async def test_create_repository_async( assert response.internal_metadata == "internal_metadata_value" -@pytest.mark.asyncio -async def test_create_repository_async_from_dict(): - await test_create_repository_async(request_type=dict) - - def test_create_repository_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7763,8 +7800,8 @@ async def test_create_repository_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dataform.UpdateRepositoryRequest, - dict, + dataform.UpdateRepositoryRequest(), + {}, ], ) def test_update_repository(request_type, transport: str = "grpc"): @@ -7775,7 +7812,7 @@ def test_update_repository(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7840,7 +7877,8 @@ def test_update_repository_non_empty_request_with_auto_populated_field(): client.update_repository(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.UpdateRepositoryRequest() + request_msg = dataform.UpdateRepositoryRequest() + assert args[0] == request_msg def test_update_repository_use_cached_wrapped_rpc(): @@ -7923,9 +7961,14 @@ async def test_update_repository_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_repository_async( - transport: str = "grpc_asyncio", request_type=dataform.UpdateRepositoryRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataform.UpdateRepositoryRequest(), + {}, + ], +) +async def test_update_repository_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7933,7 +7976,7 @@ async def test_update_repository_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( @@ -7977,11 +8020,6 @@ async def test_update_repository_async( assert response.internal_metadata == "internal_metadata_value" -@pytest.mark.asyncio -async def test_update_repository_async_from_dict(): - await test_update_repository_async(request_type=dict) - - def test_update_repository_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8142,8 +8180,8 @@ async def test_update_repository_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dataform.DeleteRepositoryRequest, - dict, + dataform.DeleteRepositoryRequest(), + {}, ], ) def test_delete_repository(request_type, transport: str = "grpc"): @@ -8154,7 +8192,7 @@ def test_delete_repository(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8199,9 +8237,10 @@ def test_delete_repository_non_empty_request_with_auto_populated_field(): client.delete_repository(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.DeleteRepositoryRequest( + request_msg = dataform.DeleteRepositoryRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_repository_use_cached_wrapped_rpc(): @@ -8284,9 +8323,14 @@ async def test_delete_repository_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_repository_async( - transport: str = "grpc_asyncio", request_type=dataform.DeleteRepositoryRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataform.DeleteRepositoryRequest(), + {}, + ], +) +async def test_delete_repository_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8294,7 +8338,7 @@ async def test_delete_repository_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( @@ -8314,11 +8358,6 @@ async def test_delete_repository_async( assert response is None -@pytest.mark.asyncio -async def test_delete_repository_async_from_dict(): - await test_delete_repository_async(request_type=dict) - - def test_delete_repository_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8469,8 +8508,8 @@ async def test_delete_repository_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dataform.MoveRepositoryRequest, - dict, + dataform.MoveRepositoryRequest(), + {}, ], ) def test_move_repository(request_type, transport: str = "grpc"): @@ -8481,7 +8520,7 @@ def test_move_repository(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.move_repository), "__call__") as call: @@ -8523,10 +8562,11 @@ def test_move_repository_non_empty_request_with_auto_populated_field(): client.move_repository(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.MoveRepositoryRequest( + request_msg = dataform.MoveRepositoryRequest( name="name_value", destination_containing_folder="destination_containing_folder_value", ) + assert args[0] == request_msg def test_move_repository_use_cached_wrapped_rpc(): @@ -8617,9 +8657,14 @@ async def test_move_repository_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_move_repository_async( - transport: str = "grpc_asyncio", request_type=dataform.MoveRepositoryRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataform.MoveRepositoryRequest(), + {}, + ], +) +async def test_move_repository_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8627,7 +8672,7 @@ async def test_move_repository_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.move_repository), "__call__") as call: @@ -8647,11 +8692,6 @@ async def test_move_repository_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_move_repository_async_from_dict(): - await test_move_repository_async(request_type=dict) - - def test_move_repository_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8808,8 +8848,8 @@ async def test_move_repository_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dataform.CommitRepositoryChangesRequest, - dict, + dataform.CommitRepositoryChangesRequest(), + {}, ], ) def test_commit_repository_changes(request_type, transport: str = "grpc"): @@ -8820,7 +8860,7 @@ def test_commit_repository_changes(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8869,10 +8909,11 @@ def test_commit_repository_changes_non_empty_request_with_auto_populated_field() client.commit_repository_changes(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.CommitRepositoryChangesRequest( + request_msg = dataform.CommitRepositoryChangesRequest( name="name_value", required_head_commit_sha="required_head_commit_sha_value", ) + assert args[0] == request_msg def test_commit_repository_changes_use_cached_wrapped_rpc(): @@ -8958,9 +8999,15 @@ async def test_commit_repository_changes_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dataform.CommitRepositoryChangesRequest(), + {}, + ], +) async def test_commit_repository_changes_async( - transport: str = "grpc_asyncio", - request_type=dataform.CommitRepositoryChangesRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataformAsyncClient( credentials=async_anonymous_credentials(), @@ -8969,7 +9016,7 @@ async def test_commit_repository_changes_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( @@ -8994,11 +9041,6 @@ async def test_commit_repository_changes_async( assert response.commit_sha == "commit_sha_value" -@pytest.mark.asyncio -async def test_commit_repository_changes_async_from_dict(): - await test_commit_repository_changes_async(request_type=dict) - - def test_commit_repository_changes_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9067,8 +9109,8 @@ async def test_commit_repository_changes_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - dataform.ReadRepositoryFileRequest, - dict, + dataform.ReadRepositoryFileRequest(), + {}, ], ) def test_read_repository_file(request_type, transport: str = "grpc"): @@ -9079,7 +9121,7 @@ def test_read_repository_file(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9129,11 +9171,12 @@ def test_read_repository_file_non_empty_request_with_auto_populated_field(): client.read_repository_file(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.ReadRepositoryFileRequest( + request_msg = dataform.ReadRepositoryFileRequest( name="name_value", commit_sha="commit_sha_value", path="path_value", ) + assert args[0] == request_msg def test_read_repository_file_use_cached_wrapped_rpc(): @@ -9218,8 +9261,15 @@ async def test_read_repository_file_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dataform.ReadRepositoryFileRequest(), + {}, + ], +) async def test_read_repository_file_async( - transport: str = "grpc_asyncio", request_type=dataform.ReadRepositoryFileRequest + request_type, transport: str = "grpc_asyncio" ): client = DataformAsyncClient( credentials=async_anonymous_credentials(), @@ -9228,7 +9278,7 @@ async def test_read_repository_file_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( @@ -9253,11 +9303,6 @@ async def test_read_repository_file_async( assert response.contents == b"contents_blob" -@pytest.mark.asyncio -async def test_read_repository_file_async_from_dict(): - await test_read_repository_file_async(request_type=dict) - - def test_read_repository_file_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9326,8 +9371,8 @@ async def test_read_repository_file_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - dataform.QueryRepositoryDirectoryContentsRequest, - dict, + dataform.QueryRepositoryDirectoryContentsRequest(), + {}, ], ) def test_query_repository_directory_contents(request_type, transport: str = "grpc"): @@ -9338,7 +9383,7 @@ def test_query_repository_directory_contents(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( @@ -9389,12 +9434,13 @@ def test_query_repository_directory_contents_non_empty_request_with_auto_populat client.query_repository_directory_contents(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.QueryRepositoryDirectoryContentsRequest( + request_msg = dataform.QueryRepositoryDirectoryContentsRequest( name="name_value", commit_sha="commit_sha_value", path="path_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_query_repository_directory_contents_use_cached_wrapped_rpc(): @@ -9480,9 +9526,15 @@ async def test_query_repository_directory_contents_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dataform.QueryRepositoryDirectoryContentsRequest(), + {}, + ], +) async def test_query_repository_directory_contents_async( - transport: str = "grpc_asyncio", - request_type=dataform.QueryRepositoryDirectoryContentsRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataformAsyncClient( credentials=async_anonymous_credentials(), @@ -9491,7 +9543,7 @@ async def test_query_repository_directory_contents_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( @@ -9516,11 +9568,6 @@ async def test_query_repository_directory_contents_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_query_repository_directory_contents_async_from_dict(): - await test_query_repository_directory_contents_async(request_type=dict) - - def test_query_repository_directory_contents_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9791,8 +9838,8 @@ async def test_query_repository_directory_contents_async_pages(): @pytest.mark.parametrize( "request_type", [ - dataform.FetchRepositoryHistoryRequest, - dict, + dataform.FetchRepositoryHistoryRequest(), + {}, ], ) def test_fetch_repository_history(request_type, transport: str = "grpc"): @@ -9803,7 +9850,7 @@ def test_fetch_repository_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( @@ -9852,10 +9899,11 @@ def test_fetch_repository_history_non_empty_request_with_auto_populated_field(): client.fetch_repository_history(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.FetchRepositoryHistoryRequest( + request_msg = dataform.FetchRepositoryHistoryRequest( name="name_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_fetch_repository_history_use_cached_wrapped_rpc(): @@ -9941,8 +9989,15 @@ async def test_fetch_repository_history_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dataform.FetchRepositoryHistoryRequest(), + {}, + ], +) async def test_fetch_repository_history_async( - transport: str = "grpc_asyncio", request_type=dataform.FetchRepositoryHistoryRequest + request_type, transport: str = "grpc_asyncio" ): client = DataformAsyncClient( credentials=async_anonymous_credentials(), @@ -9951,7 +10006,7 @@ async def test_fetch_repository_history_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( @@ -9976,11 +10031,6 @@ async def test_fetch_repository_history_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_fetch_repository_history_async_from_dict(): - await test_fetch_repository_history_async(request_type=dict) - - def test_fetch_repository_history_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10249,8 +10299,8 @@ async def test_fetch_repository_history_async_pages(): @pytest.mark.parametrize( "request_type", [ - dataform.ComputeRepositoryAccessTokenStatusRequest, - dict, + dataform.ComputeRepositoryAccessTokenStatusRequest(), + {}, ], ) def test_compute_repository_access_token_status(request_type, transport: str = "grpc"): @@ -10261,7 +10311,7 @@ def test_compute_repository_access_token_status(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( @@ -10312,9 +10362,10 @@ def test_compute_repository_access_token_status_non_empty_request_with_auto_popu client.compute_repository_access_token_status(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.ComputeRepositoryAccessTokenStatusRequest( + request_msg = dataform.ComputeRepositoryAccessTokenStatusRequest( name="name_value", ) + assert args[0] == request_msg def test_compute_repository_access_token_status_use_cached_wrapped_rpc(): @@ -10400,9 +10451,15 @@ async def test_compute_repository_access_token_status_async_use_cached_wrapped_r @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dataform.ComputeRepositoryAccessTokenStatusRequest(), + {}, + ], +) async def test_compute_repository_access_token_status_async( - transport: str = "grpc_asyncio", - request_type=dataform.ComputeRepositoryAccessTokenStatusRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataformAsyncClient( credentials=async_anonymous_credentials(), @@ -10411,7 +10468,7 @@ async def test_compute_repository_access_token_status_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( @@ -10439,11 +10496,6 @@ async def test_compute_repository_access_token_status_async( ) -@pytest.mark.asyncio -async def test_compute_repository_access_token_status_async_from_dict(): - await test_compute_repository_access_token_status_async(request_type=dict) - - def test_compute_repository_access_token_status_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10512,8 +10564,8 @@ async def test_compute_repository_access_token_status_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - dataform.FetchRemoteBranchesRequest, - dict, + dataform.FetchRemoteBranchesRequest(), + {}, ], ) def test_fetch_remote_branches(request_type, transport: str = "grpc"): @@ -10524,7 +10576,7 @@ def test_fetch_remote_branches(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10572,9 +10624,10 @@ def test_fetch_remote_branches_non_empty_request_with_auto_populated_field(): client.fetch_remote_branches(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.FetchRemoteBranchesRequest( + request_msg = dataform.FetchRemoteBranchesRequest( name="name_value", ) + assert args[0] == request_msg def test_fetch_remote_branches_use_cached_wrapped_rpc(): @@ -10660,8 +10713,15 @@ async def test_fetch_remote_branches_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dataform.FetchRemoteBranchesRequest(), + {}, + ], +) async def test_fetch_remote_branches_async( - transport: str = "grpc_asyncio", request_type=dataform.FetchRemoteBranchesRequest + request_type, transport: str = "grpc_asyncio" ): client = DataformAsyncClient( credentials=async_anonymous_credentials(), @@ -10670,7 +10730,7 @@ async def test_fetch_remote_branches_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( @@ -10695,11 +10755,6 @@ async def test_fetch_remote_branches_async( assert response.branches == ["branches_value"] -@pytest.mark.asyncio -async def test_fetch_remote_branches_async_from_dict(): - await test_fetch_remote_branches_async(request_type=dict) - - def test_fetch_remote_branches_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10768,8 +10823,8 @@ async def test_fetch_remote_branches_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - dataform.ListWorkspacesRequest, - dict, + dataform.ListWorkspacesRequest(), + {}, ], ) def test_list_workspaces(request_type, transport: str = "grpc"): @@ -10780,7 +10835,7 @@ def test_list_workspaces(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_workspaces), "__call__") as call: @@ -10829,12 +10884,13 @@ def test_list_workspaces_non_empty_request_with_auto_populated_field(): client.list_workspaces(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.ListWorkspacesRequest( + request_msg = dataform.ListWorkspacesRequest( parent="parent_value", page_token="page_token_value", order_by="order_by_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_workspaces_use_cached_wrapped_rpc(): @@ -10915,9 +10971,14 @@ async def test_list_workspaces_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_workspaces_async( - transport: str = "grpc_asyncio", request_type=dataform.ListWorkspacesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataform.ListWorkspacesRequest(), + {}, + ], +) +async def test_list_workspaces_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10925,7 +10986,7 @@ async def test_list_workspaces_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_workspaces), "__call__") as call: @@ -10950,11 +11011,6 @@ async def test_list_workspaces_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_workspaces_async_from_dict(): - await test_list_workspaces_async(request_type=dict) - - def test_list_workspaces_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11291,8 +11347,8 @@ async def test_list_workspaces_async_pages(): @pytest.mark.parametrize( "request_type", [ - dataform.GetWorkspaceRequest, - dict, + dataform.GetWorkspaceRequest(), + {}, ], ) def test_get_workspace(request_type, transport: str = "grpc"): @@ -11303,7 +11359,7 @@ def test_get_workspace(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_workspace), "__call__") as call: @@ -11351,9 +11407,10 @@ def test_get_workspace_non_empty_request_with_auto_populated_field(): client.get_workspace(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.GetWorkspaceRequest( + request_msg = dataform.GetWorkspaceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_workspace_use_cached_wrapped_rpc(): @@ -11434,9 +11491,14 @@ async def test_get_workspace_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_workspace_async( - transport: str = "grpc_asyncio", request_type=dataform.GetWorkspaceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataform.GetWorkspaceRequest(), + {}, + ], +) +async def test_get_workspace_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11444,7 +11506,7 @@ async def test_get_workspace_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_workspace), "__call__") as call: @@ -11471,11 +11533,6 @@ async def test_get_workspace_async( assert response.disable_moves is True -@pytest.mark.asyncio -async def test_get_workspace_async_from_dict(): - await test_get_workspace_async(request_type=dict) - - def test_get_workspace_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11618,8 +11675,8 @@ async def test_get_workspace_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dataform.CreateWorkspaceRequest, - dict, + dataform.CreateWorkspaceRequest(), + {}, ], ) def test_create_workspace(request_type, transport: str = "grpc"): @@ -11630,7 +11687,7 @@ def test_create_workspace(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_workspace), "__call__") as call: @@ -11679,10 +11736,11 @@ def test_create_workspace_non_empty_request_with_auto_populated_field(): client.create_workspace(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.CreateWorkspaceRequest( + request_msg = dataform.CreateWorkspaceRequest( parent="parent_value", workspace_id="workspace_id_value", ) + assert args[0] == request_msg def test_create_workspace_use_cached_wrapped_rpc(): @@ -11765,9 +11823,14 @@ async def test_create_workspace_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_workspace_async( - transport: str = "grpc_asyncio", request_type=dataform.CreateWorkspaceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataform.CreateWorkspaceRequest(), + {}, + ], +) +async def test_create_workspace_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11775,7 +11838,7 @@ async def test_create_workspace_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_workspace), "__call__") as call: @@ -11802,11 +11865,6 @@ async def test_create_workspace_async( assert response.disable_moves is True -@pytest.mark.asyncio -async def test_create_workspace_async_from_dict(): - await test_create_workspace_async(request_type=dict) - - def test_create_workspace_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11969,8 +12027,8 @@ async def test_create_workspace_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dataform.DeleteWorkspaceRequest, - dict, + dataform.DeleteWorkspaceRequest(), + {}, ], ) def test_delete_workspace(request_type, transport: str = "grpc"): @@ -11981,7 +12039,7 @@ def test_delete_workspace(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_workspace), "__call__") as call: @@ -12022,9 +12080,10 @@ def test_delete_workspace_non_empty_request_with_auto_populated_field(): client.delete_workspace(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.DeleteWorkspaceRequest( + request_msg = dataform.DeleteWorkspaceRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_workspace_use_cached_wrapped_rpc(): @@ -12107,9 +12166,14 @@ async def test_delete_workspace_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_workspace_async( - transport: str = "grpc_asyncio", request_type=dataform.DeleteWorkspaceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataform.DeleteWorkspaceRequest(), + {}, + ], +) +async def test_delete_workspace_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12117,7 +12181,7 @@ async def test_delete_workspace_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_workspace), "__call__") as call: @@ -12135,11 +12199,6 @@ async def test_delete_workspace_async( assert response is None -@pytest.mark.asyncio -async def test_delete_workspace_async_from_dict(): - await test_delete_workspace_async(request_type=dict) - - def test_delete_workspace_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12282,8 +12341,8 @@ async def test_delete_workspace_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dataform.InstallNpmPackagesRequest, - dict, + dataform.InstallNpmPackagesRequest(), + {}, ], ) def test_install_npm_packages(request_type, transport: str = "grpc"): @@ -12294,7 +12353,7 @@ def test_install_npm_packages(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -12339,9 +12398,10 @@ def test_install_npm_packages_non_empty_request_with_auto_populated_field(): client.install_npm_packages(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.InstallNpmPackagesRequest( + request_msg = dataform.InstallNpmPackagesRequest( workspace="workspace_value", ) + assert args[0] == request_msg def test_install_npm_packages_use_cached_wrapped_rpc(): @@ -12426,8 +12486,15 @@ async def test_install_npm_packages_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dataform.InstallNpmPackagesRequest(), + {}, + ], +) async def test_install_npm_packages_async( - transport: str = "grpc_asyncio", request_type=dataform.InstallNpmPackagesRequest + request_type, transport: str = "grpc_asyncio" ): client = DataformAsyncClient( credentials=async_anonymous_credentials(), @@ -12436,7 +12503,7 @@ async def test_install_npm_packages_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( @@ -12458,11 +12525,6 @@ async def test_install_npm_packages_async( assert isinstance(response, dataform.InstallNpmPackagesResponse) -@pytest.mark.asyncio -async def test_install_npm_packages_async_from_dict(): - await test_install_npm_packages_async(request_type=dict) - - def test_install_npm_packages_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12531,8 +12593,8 @@ async def test_install_npm_packages_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - dataform.PullGitCommitsRequest, - dict, + dataform.PullGitCommitsRequest(), + {}, ], ) def test_pull_git_commits(request_type, transport: str = "grpc"): @@ -12543,7 +12605,7 @@ def test_pull_git_commits(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.pull_git_commits), "__call__") as call: @@ -12585,10 +12647,11 @@ def test_pull_git_commits_non_empty_request_with_auto_populated_field(): client.pull_git_commits(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.PullGitCommitsRequest( + request_msg = dataform.PullGitCommitsRequest( name="name_value", remote_branch="remote_branch_value", ) + assert args[0] == request_msg def test_pull_git_commits_use_cached_wrapped_rpc(): @@ -12671,9 +12734,14 @@ async def test_pull_git_commits_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_pull_git_commits_async( - transport: str = "grpc_asyncio", request_type=dataform.PullGitCommitsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataform.PullGitCommitsRequest(), + {}, + ], +) +async def test_pull_git_commits_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12681,7 +12749,7 @@ async def test_pull_git_commits_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.pull_git_commits), "__call__") as call: @@ -12701,11 +12769,6 @@ async def test_pull_git_commits_async( assert isinstance(response, dataform.PullGitCommitsResponse) -@pytest.mark.asyncio -async def test_pull_git_commits_async_from_dict(): - await test_pull_git_commits_async(request_type=dict) - - def test_pull_git_commits_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12770,8 +12833,8 @@ async def test_pull_git_commits_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - dataform.PushGitCommitsRequest, - dict, + dataform.PushGitCommitsRequest(), + {}, ], ) def test_push_git_commits(request_type, transport: str = "grpc"): @@ -12782,7 +12845,7 @@ def test_push_git_commits(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.push_git_commits), "__call__") as call: @@ -12824,10 +12887,11 @@ def test_push_git_commits_non_empty_request_with_auto_populated_field(): client.push_git_commits(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.PushGitCommitsRequest( + request_msg = dataform.PushGitCommitsRequest( name="name_value", remote_branch="remote_branch_value", ) + assert args[0] == request_msg def test_push_git_commits_use_cached_wrapped_rpc(): @@ -12910,9 +12974,14 @@ async def test_push_git_commits_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_push_git_commits_async( - transport: str = "grpc_asyncio", request_type=dataform.PushGitCommitsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataform.PushGitCommitsRequest(), + {}, + ], +) +async def test_push_git_commits_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12920,7 +12989,7 @@ async def test_push_git_commits_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.push_git_commits), "__call__") as call: @@ -12940,11 +13009,6 @@ async def test_push_git_commits_async( assert isinstance(response, dataform.PushGitCommitsResponse) -@pytest.mark.asyncio -async def test_push_git_commits_async_from_dict(): - await test_push_git_commits_async(request_type=dict) - - def test_push_git_commits_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13009,8 +13073,8 @@ async def test_push_git_commits_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - dataform.FetchFileGitStatusesRequest, - dict, + dataform.FetchFileGitStatusesRequest(), + {}, ], ) def test_fetch_file_git_statuses(request_type, transport: str = "grpc"): @@ -13021,7 +13085,7 @@ def test_fetch_file_git_statuses(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -13066,9 +13130,10 @@ def test_fetch_file_git_statuses_non_empty_request_with_auto_populated_field(): client.fetch_file_git_statuses(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.FetchFileGitStatusesRequest( + request_msg = dataform.FetchFileGitStatusesRequest( name="name_value", ) + assert args[0] == request_msg def test_fetch_file_git_statuses_use_cached_wrapped_rpc(): @@ -13154,8 +13219,15 @@ async def test_fetch_file_git_statuses_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dataform.FetchFileGitStatusesRequest(), + {}, + ], +) async def test_fetch_file_git_statuses_async( - transport: str = "grpc_asyncio", request_type=dataform.FetchFileGitStatusesRequest + request_type, transport: str = "grpc_asyncio" ): client = DataformAsyncClient( credentials=async_anonymous_credentials(), @@ -13164,7 +13236,7 @@ async def test_fetch_file_git_statuses_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( @@ -13186,11 +13258,6 @@ async def test_fetch_file_git_statuses_async( assert isinstance(response, dataform.FetchFileGitStatusesResponse) -@pytest.mark.asyncio -async def test_fetch_file_git_statuses_async_from_dict(): - await test_fetch_file_git_statuses_async(request_type=dict) - - def test_fetch_file_git_statuses_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13259,8 +13326,8 @@ async def test_fetch_file_git_statuses_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - dataform.FetchGitAheadBehindRequest, - dict, + dataform.FetchGitAheadBehindRequest(), + {}, ], ) def test_fetch_git_ahead_behind(request_type, transport: str = "grpc"): @@ -13271,7 +13338,7 @@ def test_fetch_git_ahead_behind(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -13322,10 +13389,11 @@ def test_fetch_git_ahead_behind_non_empty_request_with_auto_populated_field(): client.fetch_git_ahead_behind(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.FetchGitAheadBehindRequest( + request_msg = dataform.FetchGitAheadBehindRequest( name="name_value", remote_branch="remote_branch_value", ) + assert args[0] == request_msg def test_fetch_git_ahead_behind_use_cached_wrapped_rpc(): @@ -13411,8 +13479,15 @@ async def test_fetch_git_ahead_behind_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dataform.FetchGitAheadBehindRequest(), + {}, + ], +) async def test_fetch_git_ahead_behind_async( - transport: str = "grpc_asyncio", request_type=dataform.FetchGitAheadBehindRequest + request_type, transport: str = "grpc_asyncio" ): client = DataformAsyncClient( credentials=async_anonymous_credentials(), @@ -13421,7 +13496,7 @@ async def test_fetch_git_ahead_behind_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( @@ -13448,11 +13523,6 @@ async def test_fetch_git_ahead_behind_async( assert response.commits_behind == 1477 -@pytest.mark.asyncio -async def test_fetch_git_ahead_behind_async_from_dict(): - await test_fetch_git_ahead_behind_async(request_type=dict) - - def test_fetch_git_ahead_behind_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13521,8 +13591,8 @@ async def test_fetch_git_ahead_behind_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - dataform.CommitWorkspaceChangesRequest, - dict, + dataform.CommitWorkspaceChangesRequest(), + {}, ], ) def test_commit_workspace_changes(request_type, transport: str = "grpc"): @@ -13533,7 +13603,7 @@ def test_commit_workspace_changes(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -13579,10 +13649,11 @@ def test_commit_workspace_changes_non_empty_request_with_auto_populated_field(): client.commit_workspace_changes(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.CommitWorkspaceChangesRequest( + request_msg = dataform.CommitWorkspaceChangesRequest( name="name_value", commit_message="commit_message_value", ) + assert args[0] == request_msg def test_commit_workspace_changes_use_cached_wrapped_rpc(): @@ -13668,8 +13739,15 @@ async def test_commit_workspace_changes_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dataform.CommitWorkspaceChangesRequest(), + {}, + ], +) async def test_commit_workspace_changes_async( - transport: str = "grpc_asyncio", request_type=dataform.CommitWorkspaceChangesRequest + request_type, transport: str = "grpc_asyncio" ): client = DataformAsyncClient( credentials=async_anonymous_credentials(), @@ -13678,7 +13756,7 @@ async def test_commit_workspace_changes_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( @@ -13700,11 +13778,6 @@ async def test_commit_workspace_changes_async( assert isinstance(response, dataform.CommitWorkspaceChangesResponse) -@pytest.mark.asyncio -async def test_commit_workspace_changes_async_from_dict(): - await test_commit_workspace_changes_async(request_type=dict) - - def test_commit_workspace_changes_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13773,8 +13846,8 @@ async def test_commit_workspace_changes_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - dataform.ResetWorkspaceChangesRequest, - dict, + dataform.ResetWorkspaceChangesRequest(), + {}, ], ) def test_reset_workspace_changes(request_type, transport: str = "grpc"): @@ -13785,7 +13858,7 @@ def test_reset_workspace_changes(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -13830,9 +13903,10 @@ def test_reset_workspace_changes_non_empty_request_with_auto_populated_field(): client.reset_workspace_changes(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.ResetWorkspaceChangesRequest( + request_msg = dataform.ResetWorkspaceChangesRequest( name="name_value", ) + assert args[0] == request_msg def test_reset_workspace_changes_use_cached_wrapped_rpc(): @@ -13918,8 +13992,15 @@ async def test_reset_workspace_changes_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dataform.ResetWorkspaceChangesRequest(), + {}, + ], +) async def test_reset_workspace_changes_async( - transport: str = "grpc_asyncio", request_type=dataform.ResetWorkspaceChangesRequest + request_type, transport: str = "grpc_asyncio" ): client = DataformAsyncClient( credentials=async_anonymous_credentials(), @@ -13928,7 +14009,7 @@ async def test_reset_workspace_changes_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( @@ -13950,11 +14031,6 @@ async def test_reset_workspace_changes_async( assert isinstance(response, dataform.ResetWorkspaceChangesResponse) -@pytest.mark.asyncio -async def test_reset_workspace_changes_async_from_dict(): - await test_reset_workspace_changes_async(request_type=dict) - - def test_reset_workspace_changes_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14023,8 +14099,8 @@ async def test_reset_workspace_changes_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - dataform.FetchFileDiffRequest, - dict, + dataform.FetchFileDiffRequest(), + {}, ], ) def test_fetch_file_diff(request_type, transport: str = "grpc"): @@ -14035,7 +14111,7 @@ def test_fetch_file_diff(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.fetch_file_diff), "__call__") as call: @@ -14080,10 +14156,11 @@ def test_fetch_file_diff_non_empty_request_with_auto_populated_field(): client.fetch_file_diff(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.FetchFileDiffRequest( + request_msg = dataform.FetchFileDiffRequest( workspace="workspace_value", path="path_value", ) + assert args[0] == request_msg def test_fetch_file_diff_use_cached_wrapped_rpc(): @@ -14164,9 +14241,14 @@ async def test_fetch_file_diff_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_fetch_file_diff_async( - transport: str = "grpc_asyncio", request_type=dataform.FetchFileDiffRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataform.FetchFileDiffRequest(), + {}, + ], +) +async def test_fetch_file_diff_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14174,7 +14256,7 @@ async def test_fetch_file_diff_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.fetch_file_diff), "__call__") as call: @@ -14197,11 +14279,6 @@ async def test_fetch_file_diff_async( assert response.formatted_diff == "formatted_diff_value" -@pytest.mark.asyncio -async def test_fetch_file_diff_async_from_dict(): - await test_fetch_file_diff_async(request_type=dict) - - def test_fetch_file_diff_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14266,8 +14343,8 @@ async def test_fetch_file_diff_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - dataform.QueryDirectoryContentsRequest, - dict, + dataform.QueryDirectoryContentsRequest(), + {}, ], ) def test_query_directory_contents(request_type, transport: str = "grpc"): @@ -14278,7 +14355,7 @@ def test_query_directory_contents(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -14328,11 +14405,12 @@ def test_query_directory_contents_non_empty_request_with_auto_populated_field(): client.query_directory_contents(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.QueryDirectoryContentsRequest( + request_msg = dataform.QueryDirectoryContentsRequest( workspace="workspace_value", path="path_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_query_directory_contents_use_cached_wrapped_rpc(): @@ -14418,8 +14496,15 @@ async def test_query_directory_contents_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dataform.QueryDirectoryContentsRequest(), + {}, + ], +) async def test_query_directory_contents_async( - transport: str = "grpc_asyncio", request_type=dataform.QueryDirectoryContentsRequest + request_type, transport: str = "grpc_asyncio" ): client = DataformAsyncClient( credentials=async_anonymous_credentials(), @@ -14428,7 +14513,7 @@ async def test_query_directory_contents_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( @@ -14453,11 +14538,6 @@ async def test_query_directory_contents_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_query_directory_contents_async_from_dict(): - await test_query_directory_contents_async(request_type=dict) - - def test_query_directory_contents_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14726,8 +14806,8 @@ async def test_query_directory_contents_async_pages(): @pytest.mark.parametrize( "request_type", [ - dataform.SearchFilesRequest, - dict, + dataform.SearchFilesRequest(), + {}, ], ) def test_search_files(request_type, transport: str = "grpc"): @@ -14738,7 +14818,7 @@ def test_search_files(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.search_files), "__call__") as call: @@ -14784,11 +14864,12 @@ def test_search_files_non_empty_request_with_auto_populated_field(): client.search_files(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.SearchFilesRequest( + request_msg = dataform.SearchFilesRequest( workspace="workspace_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_search_files_use_cached_wrapped_rpc(): @@ -14869,9 +14950,14 @@ async def test_search_files_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_search_files_async( - transport: str = "grpc_asyncio", request_type=dataform.SearchFilesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataform.SearchFilesRequest(), + {}, + ], +) +async def test_search_files_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14879,7 +14965,7 @@ async def test_search_files_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.search_files), "__call__") as call: @@ -14902,11 +14988,6 @@ async def test_search_files_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_search_files_async_from_dict(): - await test_search_files_async(request_type=dict) - - def test_search_files_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15161,8 +15242,8 @@ async def test_search_files_async_pages(): @pytest.mark.parametrize( "request_type", [ - dataform.MakeDirectoryRequest, - dict, + dataform.MakeDirectoryRequest(), + {}, ], ) def test_make_directory(request_type, transport: str = "grpc"): @@ -15173,7 +15254,7 @@ def test_make_directory(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.make_directory), "__call__") as call: @@ -15215,10 +15296,11 @@ def test_make_directory_non_empty_request_with_auto_populated_field(): client.make_directory(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.MakeDirectoryRequest( + request_msg = dataform.MakeDirectoryRequest( workspace="workspace_value", path="path_value", ) + assert args[0] == request_msg def test_make_directory_use_cached_wrapped_rpc(): @@ -15299,9 +15381,14 @@ async def test_make_directory_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_make_directory_async( - transport: str = "grpc_asyncio", request_type=dataform.MakeDirectoryRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataform.MakeDirectoryRequest(), + {}, + ], +) +async def test_make_directory_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -15309,7 +15396,7 @@ async def test_make_directory_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.make_directory), "__call__") as call: @@ -15329,11 +15416,6 @@ async def test_make_directory_async( assert isinstance(response, dataform.MakeDirectoryResponse) -@pytest.mark.asyncio -async def test_make_directory_async_from_dict(): - await test_make_directory_async(request_type=dict) - - def test_make_directory_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15398,8 +15480,8 @@ async def test_make_directory_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - dataform.RemoveDirectoryRequest, - dict, + dataform.RemoveDirectoryRequest(), + {}, ], ) def test_remove_directory(request_type, transport: str = "grpc"): @@ -15410,7 +15492,7 @@ def test_remove_directory(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.remove_directory), "__call__") as call: @@ -15452,10 +15534,11 @@ def test_remove_directory_non_empty_request_with_auto_populated_field(): client.remove_directory(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.RemoveDirectoryRequest( + request_msg = dataform.RemoveDirectoryRequest( workspace="workspace_value", path="path_value", ) + assert args[0] == request_msg def test_remove_directory_use_cached_wrapped_rpc(): @@ -15538,9 +15621,14 @@ async def test_remove_directory_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_remove_directory_async( - transport: str = "grpc_asyncio", request_type=dataform.RemoveDirectoryRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataform.RemoveDirectoryRequest(), + {}, + ], +) +async def test_remove_directory_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -15548,7 +15636,7 @@ async def test_remove_directory_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.remove_directory), "__call__") as call: @@ -15568,11 +15656,6 @@ async def test_remove_directory_async( assert isinstance(response, dataform.RemoveDirectoryResponse) -@pytest.mark.asyncio -async def test_remove_directory_async_from_dict(): - await test_remove_directory_async(request_type=dict) - - def test_remove_directory_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15637,8 +15720,8 @@ async def test_remove_directory_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - dataform.MoveDirectoryRequest, - dict, + dataform.MoveDirectoryRequest(), + {}, ], ) def test_move_directory(request_type, transport: str = "grpc"): @@ -15649,7 +15732,7 @@ def test_move_directory(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.move_directory), "__call__") as call: @@ -15692,11 +15775,12 @@ def test_move_directory_non_empty_request_with_auto_populated_field(): client.move_directory(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.MoveDirectoryRequest( + request_msg = dataform.MoveDirectoryRequest( workspace="workspace_value", path="path_value", new_path="new_path_value", ) + assert args[0] == request_msg def test_move_directory_use_cached_wrapped_rpc(): @@ -15777,9 +15861,14 @@ async def test_move_directory_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_move_directory_async( - transport: str = "grpc_asyncio", request_type=dataform.MoveDirectoryRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataform.MoveDirectoryRequest(), + {}, + ], +) +async def test_move_directory_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -15787,7 +15876,7 @@ async def test_move_directory_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.move_directory), "__call__") as call: @@ -15807,11 +15896,6 @@ async def test_move_directory_async( assert isinstance(response, dataform.MoveDirectoryResponse) -@pytest.mark.asyncio -async def test_move_directory_async_from_dict(): - await test_move_directory_async(request_type=dict) - - def test_move_directory_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15876,8 +15960,8 @@ async def test_move_directory_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - dataform.ReadFileRequest, - dict, + dataform.ReadFileRequest(), + {}, ], ) def test_read_file(request_type, transport: str = "grpc"): @@ -15888,7 +15972,7 @@ def test_read_file(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.read_file), "__call__") as call: @@ -15934,11 +16018,12 @@ def test_read_file_non_empty_request_with_auto_populated_field(): client.read_file(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.ReadFileRequest( + request_msg = dataform.ReadFileRequest( workspace="workspace_value", path="path_value", revision="revision_value", ) + assert args[0] == request_msg def test_read_file_use_cached_wrapped_rpc(): @@ -16017,9 +16102,14 @@ async def test_read_file_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_read_file_async( - transport: str = "grpc_asyncio", request_type=dataform.ReadFileRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataform.ReadFileRequest(), + {}, + ], +) +async def test_read_file_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -16027,7 +16117,7 @@ async def test_read_file_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.read_file), "__call__") as call: @@ -16050,11 +16140,6 @@ async def test_read_file_async( assert response.file_contents == b"file_contents_blob" -@pytest.mark.asyncio -async def test_read_file_async_from_dict(): - await test_read_file_async(request_type=dict) - - def test_read_file_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16119,8 +16204,8 @@ async def test_read_file_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - dataform.RemoveFileRequest, - dict, + dataform.RemoveFileRequest(), + {}, ], ) def test_remove_file(request_type, transport: str = "grpc"): @@ -16131,7 +16216,7 @@ def test_remove_file(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.remove_file), "__call__") as call: @@ -16173,10 +16258,11 @@ def test_remove_file_non_empty_request_with_auto_populated_field(): client.remove_file(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.RemoveFileRequest( + request_msg = dataform.RemoveFileRequest( workspace="workspace_value", path="path_value", ) + assert args[0] == request_msg def test_remove_file_use_cached_wrapped_rpc(): @@ -16257,9 +16343,14 @@ async def test_remove_file_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_remove_file_async( - transport: str = "grpc_asyncio", request_type=dataform.RemoveFileRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataform.RemoveFileRequest(), + {}, + ], +) +async def test_remove_file_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -16267,7 +16358,7 @@ async def test_remove_file_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.remove_file), "__call__") as call: @@ -16287,11 +16378,6 @@ async def test_remove_file_async( assert isinstance(response, dataform.RemoveFileResponse) -@pytest.mark.asyncio -async def test_remove_file_async_from_dict(): - await test_remove_file_async(request_type=dict) - - def test_remove_file_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16356,8 +16442,8 @@ async def test_remove_file_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - dataform.MoveFileRequest, - dict, + dataform.MoveFileRequest(), + {}, ], ) def test_move_file(request_type, transport: str = "grpc"): @@ -16368,7 +16454,7 @@ def test_move_file(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.move_file), "__call__") as call: @@ -16411,11 +16497,12 @@ def test_move_file_non_empty_request_with_auto_populated_field(): client.move_file(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.MoveFileRequest( + request_msg = dataform.MoveFileRequest( workspace="workspace_value", path="path_value", new_path="new_path_value", ) + assert args[0] == request_msg def test_move_file_use_cached_wrapped_rpc(): @@ -16494,9 +16581,14 @@ async def test_move_file_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_move_file_async( - transport: str = "grpc_asyncio", request_type=dataform.MoveFileRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataform.MoveFileRequest(), + {}, + ], +) +async def test_move_file_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -16504,7 +16596,7 @@ async def test_move_file_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.move_file), "__call__") as call: @@ -16524,11 +16616,6 @@ async def test_move_file_async( assert isinstance(response, dataform.MoveFileResponse) -@pytest.mark.asyncio -async def test_move_file_async_from_dict(): - await test_move_file_async(request_type=dict) - - def test_move_file_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16593,8 +16680,8 @@ async def test_move_file_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - dataform.WriteFileRequest, - dict, + dataform.WriteFileRequest(), + {}, ], ) def test_write_file(request_type, transport: str = "grpc"): @@ -16605,7 +16692,7 @@ def test_write_file(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.write_file), "__call__") as call: @@ -16647,10 +16734,11 @@ def test_write_file_non_empty_request_with_auto_populated_field(): client.write_file(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.WriteFileRequest( + request_msg = dataform.WriteFileRequest( workspace="workspace_value", path="path_value", ) + assert args[0] == request_msg def test_write_file_use_cached_wrapped_rpc(): @@ -16729,9 +16817,14 @@ async def test_write_file_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_write_file_async( - transport: str = "grpc_asyncio", request_type=dataform.WriteFileRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataform.WriteFileRequest(), + {}, + ], +) +async def test_write_file_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -16739,7 +16832,7 @@ async def test_write_file_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.write_file), "__call__") as call: @@ -16759,11 +16852,6 @@ async def test_write_file_async( assert isinstance(response, dataform.WriteFileResponse) -@pytest.mark.asyncio -async def test_write_file_async_from_dict(): - await test_write_file_async(request_type=dict) - - def test_write_file_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16828,8 +16916,8 @@ async def test_write_file_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - dataform.ListReleaseConfigsRequest, - dict, + dataform.ListReleaseConfigsRequest(), + {}, ], ) def test_list_release_configs(request_type, transport: str = "grpc"): @@ -16840,7 +16928,7 @@ def test_list_release_configs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -16891,10 +16979,11 @@ def test_list_release_configs_non_empty_request_with_auto_populated_field(): client.list_release_configs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.ListReleaseConfigsRequest( + request_msg = dataform.ListReleaseConfigsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_release_configs_use_cached_wrapped_rpc(): @@ -16979,8 +17068,15 @@ async def test_list_release_configs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dataform.ListReleaseConfigsRequest(), + {}, + ], +) async def test_list_release_configs_async( - transport: str = "grpc_asyncio", request_type=dataform.ListReleaseConfigsRequest + request_type, transport: str = "grpc_asyncio" ): client = DataformAsyncClient( credentials=async_anonymous_credentials(), @@ -16989,7 +17085,7 @@ async def test_list_release_configs_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( @@ -17016,11 +17112,6 @@ async def test_list_release_configs_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_release_configs_async_from_dict(): - await test_list_release_configs_async(request_type=dict) - - def test_list_release_configs_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17373,8 +17464,8 @@ async def test_list_release_configs_async_pages(): @pytest.mark.parametrize( "request_type", [ - dataform.GetReleaseConfigRequest, - dict, + dataform.GetReleaseConfigRequest(), + {}, ], ) def test_get_release_config(request_type, transport: str = "grpc"): @@ -17385,7 +17476,7 @@ def test_get_release_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( @@ -17445,9 +17536,10 @@ def test_get_release_config_non_empty_request_with_auto_populated_field(): client.get_release_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.GetReleaseConfigRequest( + request_msg = dataform.GetReleaseConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_release_config_use_cached_wrapped_rpc(): @@ -17532,9 +17624,14 @@ async def test_get_release_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_release_config_async( - transport: str = "grpc_asyncio", request_type=dataform.GetReleaseConfigRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataform.GetReleaseConfigRequest(), + {}, + ], +) +async def test_get_release_config_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -17542,7 +17639,7 @@ async def test_get_release_config_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( @@ -17579,11 +17676,6 @@ async def test_get_release_config_async( assert response.internal_metadata == "internal_metadata_value" -@pytest.mark.asyncio -async def test_get_release_config_async_from_dict(): - await test_get_release_config_async(request_type=dict) - - def test_get_release_config_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17738,8 +17830,8 @@ async def test_get_release_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dataform.CreateReleaseConfigRequest, - dict, + dataform.CreateReleaseConfigRequest(), + {}, ], ) def test_create_release_config(request_type, transport: str = "grpc"): @@ -17750,7 +17842,7 @@ def test_create_release_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( @@ -17811,10 +17903,11 @@ def test_create_release_config_non_empty_request_with_auto_populated_field(): client.create_release_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.CreateReleaseConfigRequest( + request_msg = dataform.CreateReleaseConfigRequest( parent="parent_value", release_config_id="release_config_id_value", ) + assert args[0] == request_msg def test_create_release_config_use_cached_wrapped_rpc(): @@ -17900,8 +17993,15 @@ async def test_create_release_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dataform.CreateReleaseConfigRequest(), + {}, + ], +) async def test_create_release_config_async( - transport: str = "grpc_asyncio", request_type=dataform.CreateReleaseConfigRequest + request_type, transport: str = "grpc_asyncio" ): client = DataformAsyncClient( credentials=async_anonymous_credentials(), @@ -17910,7 +18010,7 @@ async def test_create_release_config_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( @@ -17947,11 +18047,6 @@ async def test_create_release_config_async( assert response.internal_metadata == "internal_metadata_value" -@pytest.mark.asyncio -async def test_create_release_config_async_from_dict(): - await test_create_release_config_async(request_type=dict) - - def test_create_release_config_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18126,8 +18221,8 @@ async def test_create_release_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dataform.UpdateReleaseConfigRequest, - dict, + dataform.UpdateReleaseConfigRequest(), + {}, ], ) def test_update_release_config(request_type, transport: str = "grpc"): @@ -18138,7 +18233,7 @@ def test_update_release_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( @@ -18196,7 +18291,8 @@ def test_update_release_config_non_empty_request_with_auto_populated_field(): client.update_release_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.UpdateReleaseConfigRequest() + request_msg = dataform.UpdateReleaseConfigRequest() + assert args[0] == request_msg def test_update_release_config_use_cached_wrapped_rpc(): @@ -18282,8 +18378,15 @@ async def test_update_release_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dataform.UpdateReleaseConfigRequest(), + {}, + ], +) async def test_update_release_config_async( - transport: str = "grpc_asyncio", request_type=dataform.UpdateReleaseConfigRequest + request_type, transport: str = "grpc_asyncio" ): client = DataformAsyncClient( credentials=async_anonymous_credentials(), @@ -18292,7 +18395,7 @@ async def test_update_release_config_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( @@ -18329,11 +18432,6 @@ async def test_update_release_config_async( assert response.internal_metadata == "internal_metadata_value" -@pytest.mark.asyncio -async def test_update_release_config_async_from_dict(): - await test_update_release_config_async(request_type=dict) - - def test_update_release_config_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18498,8 +18596,8 @@ async def test_update_release_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dataform.DeleteReleaseConfigRequest, - dict, + dataform.DeleteReleaseConfigRequest(), + {}, ], ) def test_delete_release_config(request_type, transport: str = "grpc"): @@ -18510,7 +18608,7 @@ def test_delete_release_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( @@ -18555,9 +18653,10 @@ def test_delete_release_config_non_empty_request_with_auto_populated_field(): client.delete_release_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.DeleteReleaseConfigRequest( + request_msg = dataform.DeleteReleaseConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_release_config_use_cached_wrapped_rpc(): @@ -18643,8 +18742,15 @@ async def test_delete_release_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dataform.DeleteReleaseConfigRequest(), + {}, + ], +) async def test_delete_release_config_async( - transport: str = "grpc_asyncio", request_type=dataform.DeleteReleaseConfigRequest + request_type, transport: str = "grpc_asyncio" ): client = DataformAsyncClient( credentials=async_anonymous_credentials(), @@ -18653,7 +18759,7 @@ async def test_delete_release_config_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( @@ -18673,11 +18779,6 @@ async def test_delete_release_config_async( assert response is None -@pytest.mark.asyncio -async def test_delete_release_config_async_from_dict(): - await test_delete_release_config_async(request_type=dict) - - def test_delete_release_config_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18828,8 +18929,8 @@ async def test_delete_release_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dataform.ListCompilationResultsRequest, - dict, + dataform.ListCompilationResultsRequest(), + {}, ], ) def test_list_compilation_results(request_type, transport: str = "grpc"): @@ -18840,7 +18941,7 @@ def test_list_compilation_results(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -18893,12 +18994,13 @@ def test_list_compilation_results_non_empty_request_with_auto_populated_field(): client.list_compilation_results(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.ListCompilationResultsRequest( + request_msg = dataform.ListCompilationResultsRequest( parent="parent_value", page_token="page_token_value", order_by="order_by_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_compilation_results_use_cached_wrapped_rpc(): @@ -18984,8 +19086,15 @@ async def test_list_compilation_results_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dataform.ListCompilationResultsRequest(), + {}, + ], +) async def test_list_compilation_results_async( - transport: str = "grpc_asyncio", request_type=dataform.ListCompilationResultsRequest + request_type, transport: str = "grpc_asyncio" ): client = DataformAsyncClient( credentials=async_anonymous_credentials(), @@ -18994,7 +19103,7 @@ async def test_list_compilation_results_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( @@ -19021,11 +19130,6 @@ async def test_list_compilation_results_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_compilation_results_async_from_dict(): - await test_list_compilation_results_async(request_type=dict) - - def test_list_compilation_results_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -19380,8 +19484,8 @@ async def test_list_compilation_results_async_pages(): @pytest.mark.parametrize( "request_type", [ - dataform.GetCompilationResultRequest, - dict, + dataform.GetCompilationResultRequest(), + {}, ], ) def test_get_compilation_result(request_type, transport: str = "grpc"): @@ -19392,7 +19496,7 @@ def test_get_compilation_result(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -19447,9 +19551,10 @@ def test_get_compilation_result_non_empty_request_with_auto_populated_field(): client.get_compilation_result(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.GetCompilationResultRequest( + request_msg = dataform.GetCompilationResultRequest( name="name_value", ) + assert args[0] == request_msg def test_get_compilation_result_use_cached_wrapped_rpc(): @@ -19535,8 +19640,15 @@ async def test_get_compilation_result_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dataform.GetCompilationResultRequest(), + {}, + ], +) async def test_get_compilation_result_async( - transport: str = "grpc_asyncio", request_type=dataform.GetCompilationResultRequest + request_type, transport: str = "grpc_asyncio" ): client = DataformAsyncClient( credentials=async_anonymous_credentials(), @@ -19545,7 +19657,7 @@ async def test_get_compilation_result_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( @@ -19576,11 +19688,6 @@ async def test_get_compilation_result_async( assert response.internal_metadata == "internal_metadata_value" -@pytest.mark.asyncio -async def test_get_compilation_result_async_from_dict(): - await test_get_compilation_result_async(request_type=dict) - - def test_get_compilation_result_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -19735,8 +19842,8 @@ async def test_get_compilation_result_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dataform.CreateCompilationResultRequest, - dict, + dataform.CreateCompilationResultRequest(), + {}, ], ) def test_create_compilation_result(request_type, transport: str = "grpc"): @@ -19747,7 +19854,7 @@ def test_create_compilation_result(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -19802,9 +19909,10 @@ def test_create_compilation_result_non_empty_request_with_auto_populated_field() client.create_compilation_result(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.CreateCompilationResultRequest( + request_msg = dataform.CreateCompilationResultRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_compilation_result_use_cached_wrapped_rpc(): @@ -19890,9 +19998,15 @@ async def test_create_compilation_result_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dataform.CreateCompilationResultRequest(), + {}, + ], +) async def test_create_compilation_result_async( - transport: str = "grpc_asyncio", - request_type=dataform.CreateCompilationResultRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataformAsyncClient( credentials=async_anonymous_credentials(), @@ -19901,7 +20015,7 @@ async def test_create_compilation_result_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( @@ -19932,11 +20046,6 @@ async def test_create_compilation_result_async( assert response.internal_metadata == "internal_metadata_value" -@pytest.mark.asyncio -async def test_create_compilation_result_async_from_dict(): - await test_create_compilation_result_async(request_type=dict) - - def test_create_compilation_result_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -20109,8 +20218,8 @@ async def test_create_compilation_result_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dataform.QueryCompilationResultActionsRequest, - dict, + dataform.QueryCompilationResultActionsRequest(), + {}, ], ) def test_query_compilation_result_actions(request_type, transport: str = "grpc"): @@ -20121,7 +20230,7 @@ def test_query_compilation_result_actions(request_type, transport: str = "grpc") # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -20171,11 +20280,12 @@ def test_query_compilation_result_actions_non_empty_request_with_auto_populated_ client.query_compilation_result_actions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.QueryCompilationResultActionsRequest( + request_msg = dataform.QueryCompilationResultActionsRequest( name="name_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_query_compilation_result_actions_use_cached_wrapped_rpc(): @@ -20261,9 +20371,15 @@ async def test_query_compilation_result_actions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dataform.QueryCompilationResultActionsRequest(), + {}, + ], +) async def test_query_compilation_result_actions_async( - transport: str = "grpc_asyncio", - request_type=dataform.QueryCompilationResultActionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataformAsyncClient( credentials=async_anonymous_credentials(), @@ -20272,7 +20388,7 @@ async def test_query_compilation_result_actions_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( @@ -20297,11 +20413,6 @@ async def test_query_compilation_result_actions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_query_compilation_result_actions_async_from_dict(): - await test_query_compilation_result_actions_async(request_type=dict) - - def test_query_compilation_result_actions_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -20572,8 +20683,8 @@ async def test_query_compilation_result_actions_async_pages(): @pytest.mark.parametrize( "request_type", [ - dataform.ListWorkflowConfigsRequest, - dict, + dataform.ListWorkflowConfigsRequest(), + {}, ], ) def test_list_workflow_configs(request_type, transport: str = "grpc"): @@ -20584,7 +20695,7 @@ def test_list_workflow_configs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -20635,10 +20746,11 @@ def test_list_workflow_configs_non_empty_request_with_auto_populated_field(): client.list_workflow_configs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.ListWorkflowConfigsRequest( + request_msg = dataform.ListWorkflowConfigsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_workflow_configs_use_cached_wrapped_rpc(): @@ -20724,8 +20836,15 @@ async def test_list_workflow_configs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dataform.ListWorkflowConfigsRequest(), + {}, + ], +) async def test_list_workflow_configs_async( - transport: str = "grpc_asyncio", request_type=dataform.ListWorkflowConfigsRequest + request_type, transport: str = "grpc_asyncio" ): client = DataformAsyncClient( credentials=async_anonymous_credentials(), @@ -20734,7 +20853,7 @@ async def test_list_workflow_configs_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( @@ -20761,11 +20880,6 @@ async def test_list_workflow_configs_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_workflow_configs_async_from_dict(): - await test_list_workflow_configs_async(request_type=dict) - - def test_list_workflow_configs_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -21118,8 +21232,8 @@ async def test_list_workflow_configs_async_pages(): @pytest.mark.parametrize( "request_type", [ - dataform.GetWorkflowConfigRequest, - dict, + dataform.GetWorkflowConfigRequest(), + {}, ], ) def test_get_workflow_config(request_type, transport: str = "grpc"): @@ -21130,7 +21244,7 @@ def test_get_workflow_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( @@ -21188,9 +21302,10 @@ def test_get_workflow_config_non_empty_request_with_auto_populated_field(): client.get_workflow_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.GetWorkflowConfigRequest( + request_msg = dataform.GetWorkflowConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_workflow_config_use_cached_wrapped_rpc(): @@ -21275,9 +21390,14 @@ async def test_get_workflow_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_workflow_config_async( - transport: str = "grpc_asyncio", request_type=dataform.GetWorkflowConfigRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataform.GetWorkflowConfigRequest(), + {}, + ], +) +async def test_get_workflow_config_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -21285,7 +21405,7 @@ async def test_get_workflow_config_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( @@ -21320,11 +21440,6 @@ async def test_get_workflow_config_async( assert response.internal_metadata == "internal_metadata_value" -@pytest.mark.asyncio -async def test_get_workflow_config_async_from_dict(): - await test_get_workflow_config_async(request_type=dict) - - def test_get_workflow_config_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -21479,8 +21594,8 @@ async def test_get_workflow_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dataform.CreateWorkflowConfigRequest, - dict, + dataform.CreateWorkflowConfigRequest(), + {}, ], ) def test_create_workflow_config(request_type, transport: str = "grpc"): @@ -21491,7 +21606,7 @@ def test_create_workflow_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( @@ -21550,10 +21665,11 @@ def test_create_workflow_config_non_empty_request_with_auto_populated_field(): client.create_workflow_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.CreateWorkflowConfigRequest( + request_msg = dataform.CreateWorkflowConfigRequest( parent="parent_value", workflow_config_id="workflow_config_id_value", ) + assert args[0] == request_msg def test_create_workflow_config_use_cached_wrapped_rpc(): @@ -21639,8 +21755,15 @@ async def test_create_workflow_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dataform.CreateWorkflowConfigRequest(), + {}, + ], +) async def test_create_workflow_config_async( - transport: str = "grpc_asyncio", request_type=dataform.CreateWorkflowConfigRequest + request_type, transport: str = "grpc_asyncio" ): client = DataformAsyncClient( credentials=async_anonymous_credentials(), @@ -21649,7 +21772,7 @@ async def test_create_workflow_config_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( @@ -21684,11 +21807,6 @@ async def test_create_workflow_config_async( assert response.internal_metadata == "internal_metadata_value" -@pytest.mark.asyncio -async def test_create_workflow_config_async_from_dict(): - await test_create_workflow_config_async(request_type=dict) - - def test_create_workflow_config_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -21863,8 +21981,8 @@ async def test_create_workflow_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dataform.UpdateWorkflowConfigRequest, - dict, + dataform.UpdateWorkflowConfigRequest(), + {}, ], ) def test_update_workflow_config(request_type, transport: str = "grpc"): @@ -21875,7 +21993,7 @@ def test_update_workflow_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( @@ -21931,7 +22049,8 @@ def test_update_workflow_config_non_empty_request_with_auto_populated_field(): client.update_workflow_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.UpdateWorkflowConfigRequest() + request_msg = dataform.UpdateWorkflowConfigRequest() + assert args[0] == request_msg def test_update_workflow_config_use_cached_wrapped_rpc(): @@ -22017,8 +22136,15 @@ async def test_update_workflow_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dataform.UpdateWorkflowConfigRequest(), + {}, + ], +) async def test_update_workflow_config_async( - transport: str = "grpc_asyncio", request_type=dataform.UpdateWorkflowConfigRequest + request_type, transport: str = "grpc_asyncio" ): client = DataformAsyncClient( credentials=async_anonymous_credentials(), @@ -22027,7 +22153,7 @@ async def test_update_workflow_config_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( @@ -22062,11 +22188,6 @@ async def test_update_workflow_config_async( assert response.internal_metadata == "internal_metadata_value" -@pytest.mark.asyncio -async def test_update_workflow_config_async_from_dict(): - await test_update_workflow_config_async(request_type=dict) - - def test_update_workflow_config_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -22231,8 +22352,8 @@ async def test_update_workflow_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dataform.DeleteWorkflowConfigRequest, - dict, + dataform.DeleteWorkflowConfigRequest(), + {}, ], ) def test_delete_workflow_config(request_type, transport: str = "grpc"): @@ -22243,7 +22364,7 @@ def test_delete_workflow_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( @@ -22288,9 +22409,10 @@ def test_delete_workflow_config_non_empty_request_with_auto_populated_field(): client.delete_workflow_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.DeleteWorkflowConfigRequest( + request_msg = dataform.DeleteWorkflowConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_workflow_config_use_cached_wrapped_rpc(): @@ -22376,8 +22498,15 @@ async def test_delete_workflow_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dataform.DeleteWorkflowConfigRequest(), + {}, + ], +) async def test_delete_workflow_config_async( - transport: str = "grpc_asyncio", request_type=dataform.DeleteWorkflowConfigRequest + request_type, transport: str = "grpc_asyncio" ): client = DataformAsyncClient( credentials=async_anonymous_credentials(), @@ -22386,7 +22515,7 @@ async def test_delete_workflow_config_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( @@ -22406,11 +22535,6 @@ async def test_delete_workflow_config_async( assert response is None -@pytest.mark.asyncio -async def test_delete_workflow_config_async_from_dict(): - await test_delete_workflow_config_async(request_type=dict) - - def test_delete_workflow_config_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -22561,8 +22685,8 @@ async def test_delete_workflow_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dataform.ListWorkflowInvocationsRequest, - dict, + dataform.ListWorkflowInvocationsRequest(), + {}, ], ) def test_list_workflow_invocations(request_type, transport: str = "grpc"): @@ -22573,7 +22697,7 @@ def test_list_workflow_invocations(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -22626,12 +22750,13 @@ def test_list_workflow_invocations_non_empty_request_with_auto_populated_field() client.list_workflow_invocations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.ListWorkflowInvocationsRequest( + request_msg = dataform.ListWorkflowInvocationsRequest( parent="parent_value", page_token="page_token_value", order_by="order_by_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_workflow_invocations_use_cached_wrapped_rpc(): @@ -22717,9 +22842,15 @@ async def test_list_workflow_invocations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dataform.ListWorkflowInvocationsRequest(), + {}, + ], +) async def test_list_workflow_invocations_async( - transport: str = "grpc_asyncio", - request_type=dataform.ListWorkflowInvocationsRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataformAsyncClient( credentials=async_anonymous_credentials(), @@ -22728,7 +22859,7 @@ async def test_list_workflow_invocations_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( @@ -22755,11 +22886,6 @@ async def test_list_workflow_invocations_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_workflow_invocations_async_from_dict(): - await test_list_workflow_invocations_async(request_type=dict) - - def test_list_workflow_invocations_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -23114,8 +23240,8 @@ async def test_list_workflow_invocations_async_pages(): @pytest.mark.parametrize( "request_type", [ - dataform.GetWorkflowInvocationRequest, - dict, + dataform.GetWorkflowInvocationRequest(), + {}, ], ) def test_get_workflow_invocation(request_type, transport: str = "grpc"): @@ -23126,7 +23252,7 @@ def test_get_workflow_invocation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -23181,9 +23307,10 @@ def test_get_workflow_invocation_non_empty_request_with_auto_populated_field(): client.get_workflow_invocation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.GetWorkflowInvocationRequest( + request_msg = dataform.GetWorkflowInvocationRequest( name="name_value", ) + assert args[0] == request_msg def test_get_workflow_invocation_use_cached_wrapped_rpc(): @@ -23269,8 +23396,15 @@ async def test_get_workflow_invocation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dataform.GetWorkflowInvocationRequest(), + {}, + ], +) async def test_get_workflow_invocation_async( - transport: str = "grpc_asyncio", request_type=dataform.GetWorkflowInvocationRequest + request_type, transport: str = "grpc_asyncio" ): client = DataformAsyncClient( credentials=async_anonymous_credentials(), @@ -23279,7 +23413,7 @@ async def test_get_workflow_invocation_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( @@ -23310,11 +23444,6 @@ async def test_get_workflow_invocation_async( assert response.internal_metadata == "internal_metadata_value" -@pytest.mark.asyncio -async def test_get_workflow_invocation_async_from_dict(): - await test_get_workflow_invocation_async(request_type=dict) - - def test_get_workflow_invocation_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -23469,8 +23598,8 @@ async def test_get_workflow_invocation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dataform.CreateWorkflowInvocationRequest, - dict, + dataform.CreateWorkflowInvocationRequest(), + {}, ], ) def test_create_workflow_invocation(request_type, transport: str = "grpc"): @@ -23481,7 +23610,7 @@ def test_create_workflow_invocation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -23536,9 +23665,10 @@ def test_create_workflow_invocation_non_empty_request_with_auto_populated_field( client.create_workflow_invocation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.CreateWorkflowInvocationRequest( + request_msg = dataform.CreateWorkflowInvocationRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_workflow_invocation_use_cached_wrapped_rpc(): @@ -23624,9 +23754,15 @@ async def test_create_workflow_invocation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dataform.CreateWorkflowInvocationRequest(), + {}, + ], +) async def test_create_workflow_invocation_async( - transport: str = "grpc_asyncio", - request_type=dataform.CreateWorkflowInvocationRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataformAsyncClient( credentials=async_anonymous_credentials(), @@ -23635,7 +23771,7 @@ async def test_create_workflow_invocation_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( @@ -23666,11 +23802,6 @@ async def test_create_workflow_invocation_async( assert response.internal_metadata == "internal_metadata_value" -@pytest.mark.asyncio -async def test_create_workflow_invocation_async_from_dict(): - await test_create_workflow_invocation_async(request_type=dict) - - def test_create_workflow_invocation_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -23847,8 +23978,8 @@ async def test_create_workflow_invocation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dataform.DeleteWorkflowInvocationRequest, - dict, + dataform.DeleteWorkflowInvocationRequest(), + {}, ], ) def test_delete_workflow_invocation(request_type, transport: str = "grpc"): @@ -23859,7 +23990,7 @@ def test_delete_workflow_invocation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -23904,9 +24035,10 @@ def test_delete_workflow_invocation_non_empty_request_with_auto_populated_field( client.delete_workflow_invocation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.DeleteWorkflowInvocationRequest( + request_msg = dataform.DeleteWorkflowInvocationRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_workflow_invocation_use_cached_wrapped_rpc(): @@ -23992,9 +24124,15 @@ async def test_delete_workflow_invocation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dataform.DeleteWorkflowInvocationRequest(), + {}, + ], +) async def test_delete_workflow_invocation_async( - transport: str = "grpc_asyncio", - request_type=dataform.DeleteWorkflowInvocationRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataformAsyncClient( credentials=async_anonymous_credentials(), @@ -24003,7 +24141,7 @@ async def test_delete_workflow_invocation_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( @@ -24023,11 +24161,6 @@ async def test_delete_workflow_invocation_async( assert response is None -@pytest.mark.asyncio -async def test_delete_workflow_invocation_async_from_dict(): - await test_delete_workflow_invocation_async(request_type=dict) - - def test_delete_workflow_invocation_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -24178,8 +24311,8 @@ async def test_delete_workflow_invocation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dataform.CancelWorkflowInvocationRequest, - dict, + dataform.CancelWorkflowInvocationRequest(), + {}, ], ) def test_cancel_workflow_invocation(request_type, transport: str = "grpc"): @@ -24190,7 +24323,7 @@ def test_cancel_workflow_invocation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -24235,9 +24368,10 @@ def test_cancel_workflow_invocation_non_empty_request_with_auto_populated_field( client.cancel_workflow_invocation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.CancelWorkflowInvocationRequest( + request_msg = dataform.CancelWorkflowInvocationRequest( name="name_value", ) + assert args[0] == request_msg def test_cancel_workflow_invocation_use_cached_wrapped_rpc(): @@ -24323,9 +24457,15 @@ async def test_cancel_workflow_invocation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dataform.CancelWorkflowInvocationRequest(), + {}, + ], +) async def test_cancel_workflow_invocation_async( - transport: str = "grpc_asyncio", - request_type=dataform.CancelWorkflowInvocationRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataformAsyncClient( credentials=async_anonymous_credentials(), @@ -24334,7 +24474,7 @@ async def test_cancel_workflow_invocation_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( @@ -24356,11 +24496,6 @@ async def test_cancel_workflow_invocation_async( assert isinstance(response, dataform.CancelWorkflowInvocationResponse) -@pytest.mark.asyncio -async def test_cancel_workflow_invocation_async_from_dict(): - await test_cancel_workflow_invocation_async(request_type=dict) - - def test_cancel_workflow_invocation_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -24429,8 +24564,8 @@ async def test_cancel_workflow_invocation_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - dataform.QueryWorkflowInvocationActionsRequest, - dict, + dataform.QueryWorkflowInvocationActionsRequest(), + {}, ], ) def test_query_workflow_invocation_actions(request_type, transport: str = "grpc"): @@ -24441,7 +24576,7 @@ def test_query_workflow_invocation_actions(request_type, transport: str = "grpc" # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -24490,10 +24625,11 @@ def test_query_workflow_invocation_actions_non_empty_request_with_auto_populated client.query_workflow_invocation_actions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.QueryWorkflowInvocationActionsRequest( + request_msg = dataform.QueryWorkflowInvocationActionsRequest( name="name_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_query_workflow_invocation_actions_use_cached_wrapped_rpc(): @@ -24579,9 +24715,15 @@ async def test_query_workflow_invocation_actions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dataform.QueryWorkflowInvocationActionsRequest(), + {}, + ], +) async def test_query_workflow_invocation_actions_async( - transport: str = "grpc_asyncio", - request_type=dataform.QueryWorkflowInvocationActionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataformAsyncClient( credentials=async_anonymous_credentials(), @@ -24590,7 +24732,7 @@ async def test_query_workflow_invocation_actions_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( @@ -24615,11 +24757,6 @@ async def test_query_workflow_invocation_actions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_query_workflow_invocation_actions_async_from_dict(): - await test_query_workflow_invocation_actions_async(request_type=dict) - - def test_query_workflow_invocation_actions_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -24890,8 +25027,8 @@ async def test_query_workflow_invocation_actions_async_pages(): @pytest.mark.parametrize( "request_type", [ - dataform.GetConfigRequest, - dict, + dataform.GetConfigRequest(), + {}, ], ) def test_get_config(request_type, transport: str = "grpc"): @@ -24902,7 +25039,7 @@ def test_get_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(type(client.transport.get_config), "__call__") as call: @@ -24950,9 +25087,10 @@ def test_get_config_non_empty_request_with_auto_populated_field(): client.get_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.GetConfigRequest( + request_msg = dataform.GetConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_config_use_cached_wrapped_rpc(): @@ -25031,9 +25169,14 @@ async def test_get_config_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_config_async( - transport: str = "grpc_asyncio", request_type=dataform.GetConfigRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataform.GetConfigRequest(), + {}, + ], +) +async def test_get_config_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -25041,7 +25184,7 @@ async def test_get_config_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_config), "__call__") as call: @@ -25068,11 +25211,6 @@ async def test_get_config_async( assert response.internal_metadata == "internal_metadata_value" -@pytest.mark.asyncio -async def test_get_config_async_from_dict(): - await test_get_config_async(request_type=dict) - - def test_get_config_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -25215,8 +25353,8 @@ async def test_get_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dataform.UpdateConfigRequest, - dict, + dataform.UpdateConfigRequest(), + {}, ], ) def test_update_config(request_type, transport: str = "grpc"): @@ -25227,7 +25365,7 @@ def test_update_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(type(client.transport.update_config), "__call__") as call: @@ -25273,7 +25411,8 @@ def test_update_config_non_empty_request_with_auto_populated_field(): client.update_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataform.UpdateConfigRequest() + request_msg = dataform.UpdateConfigRequest() + assert args[0] == request_msg def test_update_config_use_cached_wrapped_rpc(): @@ -25354,9 +25493,14 @@ async def test_update_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_config_async( - transport: str = "grpc_asyncio", request_type=dataform.UpdateConfigRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataform.UpdateConfigRequest(), + {}, + ], +) +async def test_update_config_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -25364,7 +25508,7 @@ async def test_update_config_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_config), "__call__") as call: @@ -25391,11 +25535,6 @@ async def test_update_config_async( assert response.internal_metadata == "internal_metadata_value" -@pytest.mark.asyncio -async def test_update_config_async_from_dict(): - await test_update_config_async(request_type=dict) - - def test_update_config_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -25548,8 +25687,8 @@ async def test_update_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.GetIamPolicyRequest, - dict, + iam_policy_pb2.GetIamPolicyRequest(), + {}, ], ) def test_get_iam_policy(request_type, transport: str = "grpc"): @@ -25560,7 +25699,7 @@ def test_get_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(type(client.transport.get_iam_policy), "__call__") as call: @@ -25606,9 +25745,10 @@ def test_get_iam_policy_non_empty_request_with_auto_populated_field(): client.get_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.GetIamPolicyRequest( + request_msg = iam_policy_pb2.GetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_get_iam_policy_use_cached_wrapped_rpc(): @@ -25689,9 +25829,14 @@ async def test_get_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.GetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.GetIamPolicyRequest(), + {}, + ], +) +async def test_get_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -25699,7 +25844,7 @@ async def test_get_iam_policy_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_iam_policy), "__call__") as call: @@ -25724,11 +25869,6 @@ async def test_get_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_get_iam_policy_async_from_dict(): - await test_get_iam_policy_async(request_type=dict) - - def test_get_iam_policy_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -25888,8 +26028,8 @@ async def test_get_iam_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.SetIamPolicyRequest, - dict, + iam_policy_pb2.SetIamPolicyRequest(), + {}, ], ) def test_set_iam_policy(request_type, transport: str = "grpc"): @@ -25900,7 +26040,7 @@ def test_set_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(type(client.transport.set_iam_policy), "__call__") as call: @@ -25946,9 +26086,10 @@ def test_set_iam_policy_non_empty_request_with_auto_populated_field(): client.set_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.SetIamPolicyRequest( + request_msg = iam_policy_pb2.SetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_set_iam_policy_use_cached_wrapped_rpc(): @@ -26029,9 +26170,14 @@ async def test_set_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.SetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.SetIamPolicyRequest(), + {}, + ], +) +async def test_set_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = DataformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -26039,7 +26185,7 @@ async def test_set_iam_policy_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.set_iam_policy), "__call__") as call: @@ -26064,11 +26210,6 @@ async def test_set_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_set_iam_policy_async_from_dict(): - await test_set_iam_policy_async(request_type=dict) - - def test_set_iam_policy_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -26149,8 +26290,8 @@ def test_set_iam_policy_from_dict_foreign(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.TestIamPermissionsRequest, - dict, + iam_policy_pb2.TestIamPermissionsRequest(), + {}, ], ) def test_test_iam_permissions(request_type, transport: str = "grpc"): @@ -26161,7 +26302,7 @@ def test_test_iam_permissions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -26209,9 +26350,10 @@ def test_test_iam_permissions_non_empty_request_with_auto_populated_field(): client.test_iam_permissions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.TestIamPermissionsRequest( + request_msg = iam_policy_pb2.TestIamPermissionsRequest( resource="resource_value", ) + assert args[0] == request_msg def test_test_iam_permissions_use_cached_wrapped_rpc(): @@ -26296,9 +26438,15 @@ async def test_test_iam_permissions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.TestIamPermissionsRequest(), + {}, + ], +) async def test_test_iam_permissions_async( - transport: str = "grpc_asyncio", - request_type=iam_policy_pb2.TestIamPermissionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataformAsyncClient( credentials=async_anonymous_credentials(), @@ -26307,7 +26455,7 @@ async def test_test_iam_permissions_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( @@ -26332,11 +26480,6 @@ async def test_test_iam_permissions_async( assert response.permissions == ["permissions_value"] -@pytest.mark.asyncio -async def test_test_iam_permissions_async_from_dict(): - await test_test_iam_permissions_async(request_type=dict) - - def test_test_iam_permissions_field_headers(): client = DataformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -39480,7 +39623,6 @@ def test_get_team_folder_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.GetTeamFolderRequest() - assert args[0] == request_msg @@ -39503,7 +39645,6 @@ def test_create_team_folder_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.CreateTeamFolderRequest() - assert args[0] == request_msg @@ -39526,7 +39667,6 @@ def test_update_team_folder_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.UpdateTeamFolderRequest() - assert args[0] == request_msg @@ -39549,7 +39689,6 @@ def test_delete_team_folder_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.DeleteTeamFolderRequest() - assert args[0] == request_msg @@ -39572,7 +39711,6 @@ def test_query_team_folder_contents_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.QueryTeamFolderContentsRequest() - assert args[0] == request_msg @@ -39595,7 +39733,6 @@ def test_search_team_folders_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.SearchTeamFoldersRequest() - assert args[0] == request_msg @@ -39616,7 +39753,6 @@ def test_get_folder_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.GetFolderRequest() - assert args[0] == request_msg @@ -39637,7 +39773,6 @@ def test_create_folder_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.CreateFolderRequest() - assert args[0] == request_msg @@ -39658,7 +39793,6 @@ def test_update_folder_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.UpdateFolderRequest() - assert args[0] == request_msg @@ -39679,7 +39813,6 @@ def test_delete_folder_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.DeleteFolderRequest() - assert args[0] == request_msg @@ -39702,7 +39835,6 @@ def test_query_folder_contents_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.QueryFolderContentsRequest() - assert args[0] == request_msg @@ -39725,7 +39857,6 @@ def test_query_user_root_contents_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.QueryUserRootContentsRequest() - assert args[0] == request_msg @@ -39746,7 +39877,6 @@ def test_move_folder_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.MoveFolderRequest() - assert args[0] == request_msg @@ -39769,7 +39899,6 @@ def test_list_repositories_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.ListRepositoriesRequest() - assert args[0] == request_msg @@ -39790,7 +39919,6 @@ def test_get_repository_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.GetRepositoryRequest() - assert args[0] == request_msg @@ -39813,7 +39941,6 @@ def test_create_repository_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.CreateRepositoryRequest() - assert args[0] == request_msg @@ -39836,7 +39963,6 @@ def test_update_repository_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.UpdateRepositoryRequest() - assert args[0] == request_msg @@ -39859,7 +39985,6 @@ def test_delete_repository_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.DeleteRepositoryRequest() - assert args[0] == request_msg @@ -39880,7 +40005,6 @@ def test_move_repository_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.MoveRepositoryRequest() - assert args[0] == request_msg @@ -39903,7 +40027,6 @@ def test_commit_repository_changes_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.CommitRepositoryChangesRequest() - assert args[0] == request_msg @@ -39926,7 +40049,6 @@ def test_read_repository_file_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.ReadRepositoryFileRequest() - assert args[0] == request_msg @@ -39949,7 +40071,6 @@ def test_query_repository_directory_contents_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.QueryRepositoryDirectoryContentsRequest() - assert args[0] == request_msg @@ -39972,7 +40093,6 @@ def test_fetch_repository_history_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.FetchRepositoryHistoryRequest() - assert args[0] == request_msg @@ -39995,7 +40115,6 @@ def test_compute_repository_access_token_status_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.ComputeRepositoryAccessTokenStatusRequest() - assert args[0] == request_msg @@ -40018,7 +40137,6 @@ def test_fetch_remote_branches_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.FetchRemoteBranchesRequest() - assert args[0] == request_msg @@ -40039,7 +40157,6 @@ def test_list_workspaces_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.ListWorkspacesRequest() - assert args[0] == request_msg @@ -40060,7 +40177,6 @@ def test_get_workspace_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.GetWorkspaceRequest() - assert args[0] == request_msg @@ -40081,7 +40197,6 @@ def test_create_workspace_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.CreateWorkspaceRequest() - assert args[0] == request_msg @@ -40102,7 +40217,6 @@ def test_delete_workspace_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.DeleteWorkspaceRequest() - assert args[0] == request_msg @@ -40125,7 +40239,6 @@ def test_install_npm_packages_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.InstallNpmPackagesRequest() - assert args[0] == request_msg @@ -40146,7 +40259,6 @@ def test_pull_git_commits_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.PullGitCommitsRequest() - assert args[0] == request_msg @@ -40167,7 +40279,6 @@ def test_push_git_commits_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.PushGitCommitsRequest() - assert args[0] == request_msg @@ -40190,7 +40301,6 @@ def test_fetch_file_git_statuses_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.FetchFileGitStatusesRequest() - assert args[0] == request_msg @@ -40213,7 +40323,6 @@ def test_fetch_git_ahead_behind_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.FetchGitAheadBehindRequest() - assert args[0] == request_msg @@ -40236,7 +40345,6 @@ def test_commit_workspace_changes_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.CommitWorkspaceChangesRequest() - assert args[0] == request_msg @@ -40259,7 +40367,6 @@ def test_reset_workspace_changes_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.ResetWorkspaceChangesRequest() - assert args[0] == request_msg @@ -40280,7 +40387,6 @@ def test_fetch_file_diff_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.FetchFileDiffRequest() - assert args[0] == request_msg @@ -40303,7 +40409,6 @@ def test_query_directory_contents_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.QueryDirectoryContentsRequest() - assert args[0] == request_msg @@ -40324,7 +40429,6 @@ def test_search_files_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.SearchFilesRequest() - assert args[0] == request_msg @@ -40345,7 +40449,6 @@ def test_make_directory_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.MakeDirectoryRequest() - assert args[0] == request_msg @@ -40366,7 +40469,6 @@ def test_remove_directory_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.RemoveDirectoryRequest() - assert args[0] == request_msg @@ -40387,7 +40489,6 @@ def test_move_directory_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.MoveDirectoryRequest() - assert args[0] == request_msg @@ -40408,7 +40509,6 @@ def test_read_file_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.ReadFileRequest() - assert args[0] == request_msg @@ -40429,7 +40529,6 @@ def test_remove_file_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.RemoveFileRequest() - assert args[0] == request_msg @@ -40450,7 +40549,6 @@ def test_move_file_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.MoveFileRequest() - assert args[0] == request_msg @@ -40471,7 +40569,6 @@ def test_write_file_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.WriteFileRequest() - assert args[0] == request_msg @@ -40494,7 +40591,6 @@ def test_list_release_configs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.ListReleaseConfigsRequest() - assert args[0] == request_msg @@ -40517,7 +40613,6 @@ def test_get_release_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.GetReleaseConfigRequest() - assert args[0] == request_msg @@ -40540,7 +40635,6 @@ def test_create_release_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.CreateReleaseConfigRequest() - assert args[0] == request_msg @@ -40563,7 +40657,6 @@ def test_update_release_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.UpdateReleaseConfigRequest() - assert args[0] == request_msg @@ -40586,7 +40679,6 @@ def test_delete_release_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.DeleteReleaseConfigRequest() - assert args[0] == request_msg @@ -40609,7 +40701,6 @@ def test_list_compilation_results_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.ListCompilationResultsRequest() - assert args[0] == request_msg @@ -40632,7 +40723,6 @@ def test_get_compilation_result_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.GetCompilationResultRequest() - assert args[0] == request_msg @@ -40655,7 +40745,6 @@ def test_create_compilation_result_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.CreateCompilationResultRequest() - assert args[0] == request_msg @@ -40678,7 +40767,6 @@ def test_query_compilation_result_actions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.QueryCompilationResultActionsRequest() - assert args[0] == request_msg @@ -40701,7 +40789,6 @@ def test_list_workflow_configs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.ListWorkflowConfigsRequest() - assert args[0] == request_msg @@ -40724,7 +40811,6 @@ def test_get_workflow_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.GetWorkflowConfigRequest() - assert args[0] == request_msg @@ -40747,7 +40833,6 @@ def test_create_workflow_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.CreateWorkflowConfigRequest() - assert args[0] == request_msg @@ -40770,7 +40855,6 @@ def test_update_workflow_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.UpdateWorkflowConfigRequest() - assert args[0] == request_msg @@ -40793,7 +40877,6 @@ def test_delete_workflow_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.DeleteWorkflowConfigRequest() - assert args[0] == request_msg @@ -40816,7 +40899,6 @@ def test_list_workflow_invocations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.ListWorkflowInvocationsRequest() - assert args[0] == request_msg @@ -40839,7 +40921,6 @@ def test_get_workflow_invocation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.GetWorkflowInvocationRequest() - assert args[0] == request_msg @@ -40862,7 +40943,6 @@ def test_create_workflow_invocation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.CreateWorkflowInvocationRequest() - assert args[0] == request_msg @@ -40885,7 +40965,6 @@ def test_delete_workflow_invocation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.DeleteWorkflowInvocationRequest() - assert args[0] == request_msg @@ -40908,7 +40987,6 @@ def test_cancel_workflow_invocation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.CancelWorkflowInvocationRequest() - assert args[0] == request_msg @@ -40931,7 +41009,6 @@ def test_query_workflow_invocation_actions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.QueryWorkflowInvocationActionsRequest() - assert args[0] == request_msg @@ -40952,7 +41029,6 @@ def test_get_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.GetConfigRequest() - assert args[0] == request_msg @@ -40973,7 +41049,6 @@ def test_update_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.UpdateConfigRequest() - assert args[0] == request_msg @@ -40994,7 +41069,6 @@ def test_get_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -41015,7 +41089,6 @@ def test_set_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -41038,7 +41111,6 @@ def test_test_iam_permissions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -41082,7 +41154,6 @@ async def test_get_team_folder_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.GetTeamFolderRequest() - assert args[0] == request_msg @@ -41114,7 +41185,6 @@ async def test_create_team_folder_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.CreateTeamFolderRequest() - assert args[0] == request_msg @@ -41146,7 +41216,6 @@ async def test_update_team_folder_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.UpdateTeamFolderRequest() - assert args[0] == request_msg @@ -41171,7 +41240,6 @@ async def test_delete_team_folder_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.DeleteTeamFolderRequest() - assert args[0] == request_msg @@ -41200,7 +41268,6 @@ async def test_query_team_folder_contents_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.QueryTeamFolderContentsRequest() - assert args[0] == request_msg @@ -41229,7 +41296,6 @@ async def test_search_team_folders_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.SearchTeamFoldersRequest() - assert args[0] == request_msg @@ -41261,7 +41327,6 @@ async def test_get_folder_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.GetFolderRequest() - assert args[0] == request_msg @@ -41293,7 +41358,6 @@ async def test_create_folder_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.CreateFolderRequest() - assert args[0] == request_msg @@ -41325,7 +41389,6 @@ async def test_update_folder_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.UpdateFolderRequest() - assert args[0] == request_msg @@ -41348,7 +41411,6 @@ async def test_delete_folder_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.DeleteFolderRequest() - assert args[0] == request_msg @@ -41377,7 +41439,6 @@ async def test_query_folder_contents_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.QueryFolderContentsRequest() - assert args[0] == request_msg @@ -41406,7 +41467,6 @@ async def test_query_user_root_contents_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.QueryUserRootContentsRequest() - assert args[0] == request_msg @@ -41431,7 +41491,6 @@ async def test_move_folder_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.MoveFolderRequest() - assert args[0] == request_msg @@ -41461,7 +41520,6 @@ async def test_list_repositories_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.ListRepositoriesRequest() - assert args[0] == request_msg @@ -41496,7 +41554,6 @@ async def test_get_repository_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.GetRepositoryRequest() - assert args[0] == request_msg @@ -41533,7 +41590,6 @@ async def test_create_repository_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.CreateRepositoryRequest() - assert args[0] == request_msg @@ -41570,7 +41626,6 @@ async def test_update_repository_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.UpdateRepositoryRequest() - assert args[0] == request_msg @@ -41595,7 +41650,6 @@ async def test_delete_repository_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.DeleteRepositoryRequest() - assert args[0] == request_msg @@ -41620,7 +41674,6 @@ async def test_move_repository_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.MoveRepositoryRequest() - assert args[0] == request_msg @@ -41649,7 +41702,6 @@ async def test_commit_repository_changes_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.CommitRepositoryChangesRequest() - assert args[0] == request_msg @@ -41678,7 +41730,6 @@ async def test_read_repository_file_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.ReadRepositoryFileRequest() - assert args[0] == request_msg @@ -41707,7 +41758,6 @@ async def test_query_repository_directory_contents_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.QueryRepositoryDirectoryContentsRequest() - assert args[0] == request_msg @@ -41736,7 +41786,6 @@ async def test_fetch_repository_history_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.FetchRepositoryHistoryRequest() - assert args[0] == request_msg @@ -41765,7 +41814,6 @@ async def test_compute_repository_access_token_status_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.ComputeRepositoryAccessTokenStatusRequest() - assert args[0] == request_msg @@ -41794,7 +41842,6 @@ async def test_fetch_remote_branches_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.FetchRemoteBranchesRequest() - assert args[0] == request_msg @@ -41822,7 +41869,6 @@ async def test_list_workspaces_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.ListWorkspacesRequest() - assert args[0] == request_msg @@ -41851,7 +41897,6 @@ async def test_get_workspace_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.GetWorkspaceRequest() - assert args[0] == request_msg @@ -41880,7 +41925,6 @@ async def test_create_workspace_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.CreateWorkspaceRequest() - assert args[0] == request_msg @@ -41903,7 +41947,6 @@ async def test_delete_workspace_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.DeleteWorkspaceRequest() - assert args[0] == request_msg @@ -41930,7 +41973,6 @@ async def test_install_npm_packages_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.InstallNpmPackagesRequest() - assert args[0] == request_msg @@ -41955,7 +41997,6 @@ async def test_pull_git_commits_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.PullGitCommitsRequest() - assert args[0] == request_msg @@ -41980,7 +42021,6 @@ async def test_push_git_commits_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.PushGitCommitsRequest() - assert args[0] == request_msg @@ -42007,7 +42047,6 @@ async def test_fetch_file_git_statuses_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.FetchFileGitStatusesRequest() - assert args[0] == request_msg @@ -42037,7 +42076,6 @@ async def test_fetch_git_ahead_behind_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.FetchGitAheadBehindRequest() - assert args[0] == request_msg @@ -42064,7 +42102,6 @@ async def test_commit_workspace_changes_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.CommitWorkspaceChangesRequest() - assert args[0] == request_msg @@ -42091,7 +42128,6 @@ async def test_reset_workspace_changes_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.ResetWorkspaceChangesRequest() - assert args[0] == request_msg @@ -42118,7 +42154,6 @@ async def test_fetch_file_diff_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.FetchFileDiffRequest() - assert args[0] == request_msg @@ -42147,7 +42182,6 @@ async def test_query_directory_contents_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.QueryDirectoryContentsRequest() - assert args[0] == request_msg @@ -42174,7 +42208,6 @@ async def test_search_files_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.SearchFilesRequest() - assert args[0] == request_msg @@ -42199,7 +42232,6 @@ async def test_make_directory_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.MakeDirectoryRequest() - assert args[0] == request_msg @@ -42224,7 +42256,6 @@ async def test_remove_directory_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.RemoveDirectoryRequest() - assert args[0] == request_msg @@ -42249,7 +42280,6 @@ async def test_move_directory_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.MoveDirectoryRequest() - assert args[0] == request_msg @@ -42276,7 +42306,6 @@ async def test_read_file_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.ReadFileRequest() - assert args[0] == request_msg @@ -42301,7 +42330,6 @@ async def test_remove_file_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.RemoveFileRequest() - assert args[0] == request_msg @@ -42326,7 +42354,6 @@ async def test_move_file_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.MoveFileRequest() - assert args[0] == request_msg @@ -42351,7 +42378,6 @@ async def test_write_file_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.WriteFileRequest() - assert args[0] == request_msg @@ -42381,7 +42407,6 @@ async def test_list_release_configs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.ListReleaseConfigsRequest() - assert args[0] == request_msg @@ -42416,7 +42441,6 @@ async def test_get_release_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.GetReleaseConfigRequest() - assert args[0] == request_msg @@ -42451,7 +42475,6 @@ async def test_create_release_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.CreateReleaseConfigRequest() - assert args[0] == request_msg @@ -42486,7 +42509,6 @@ async def test_update_release_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.UpdateReleaseConfigRequest() - assert args[0] == request_msg @@ -42511,7 +42533,6 @@ async def test_delete_release_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.DeleteReleaseConfigRequest() - assert args[0] == request_msg @@ -42541,7 +42562,6 @@ async def test_list_compilation_results_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.ListCompilationResultsRequest() - assert args[0] == request_msg @@ -42573,7 +42593,6 @@ async def test_get_compilation_result_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.GetCompilationResultRequest() - assert args[0] == request_msg @@ -42605,7 +42624,6 @@ async def test_create_compilation_result_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.CreateCompilationResultRequest() - assert args[0] == request_msg @@ -42634,7 +42652,6 @@ async def test_query_compilation_result_actions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.QueryCompilationResultActionsRequest() - assert args[0] == request_msg @@ -42664,7 +42681,6 @@ async def test_list_workflow_configs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.ListWorkflowConfigsRequest() - assert args[0] == request_msg @@ -42698,7 +42714,6 @@ async def test_get_workflow_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.GetWorkflowConfigRequest() - assert args[0] == request_msg @@ -42732,7 +42747,6 @@ async def test_create_workflow_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.CreateWorkflowConfigRequest() - assert args[0] == request_msg @@ -42766,7 +42780,6 @@ async def test_update_workflow_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.UpdateWorkflowConfigRequest() - assert args[0] == request_msg @@ -42791,7 +42804,6 @@ async def test_delete_workflow_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.DeleteWorkflowConfigRequest() - assert args[0] == request_msg @@ -42821,7 +42833,6 @@ async def test_list_workflow_invocations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.ListWorkflowInvocationsRequest() - assert args[0] == request_msg @@ -42853,7 +42864,6 @@ async def test_get_workflow_invocation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.GetWorkflowInvocationRequest() - assert args[0] == request_msg @@ -42885,7 +42895,6 @@ async def test_create_workflow_invocation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.CreateWorkflowInvocationRequest() - assert args[0] == request_msg @@ -42910,7 +42919,6 @@ async def test_delete_workflow_invocation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.DeleteWorkflowInvocationRequest() - assert args[0] == request_msg @@ -42937,7 +42945,6 @@ async def test_cancel_workflow_invocation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.CancelWorkflowInvocationRequest() - assert args[0] == request_msg @@ -42966,7 +42973,6 @@ async def test_query_workflow_invocation_actions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.QueryWorkflowInvocationActionsRequest() - assert args[0] == request_msg @@ -42995,7 +43001,6 @@ async def test_get_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.GetConfigRequest() - assert args[0] == request_msg @@ -43024,7 +43029,6 @@ async def test_update_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.UpdateConfigRequest() - assert args[0] == request_msg @@ -43052,7 +43056,6 @@ async def test_get_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -43080,7 +43083,6 @@ async def test_set_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -43109,7 +43111,6 @@ async def test_test_iam_permissions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -54158,7 +54159,6 @@ def test_get_team_folder_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.GetTeamFolderRequest() - assert args[0] == request_msg @@ -54180,7 +54180,6 @@ def test_create_team_folder_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.CreateTeamFolderRequest() - assert args[0] == request_msg @@ -54202,7 +54201,6 @@ def test_update_team_folder_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.UpdateTeamFolderRequest() - assert args[0] == request_msg @@ -54224,7 +54222,6 @@ def test_delete_team_folder_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.DeleteTeamFolderRequest() - assert args[0] == request_msg @@ -54246,7 +54243,6 @@ def test_query_team_folder_contents_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.QueryTeamFolderContentsRequest() - assert args[0] == request_msg @@ -54268,7 +54264,6 @@ def test_search_team_folders_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.SearchTeamFoldersRequest() - assert args[0] == request_msg @@ -54288,7 +54283,6 @@ def test_get_folder_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.GetFolderRequest() - assert args[0] == request_msg @@ -54308,7 +54302,6 @@ def test_create_folder_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.CreateFolderRequest() - assert args[0] == request_msg @@ -54328,7 +54321,6 @@ def test_update_folder_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.UpdateFolderRequest() - assert args[0] == request_msg @@ -54348,7 +54340,6 @@ def test_delete_folder_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.DeleteFolderRequest() - assert args[0] == request_msg @@ -54370,7 +54361,6 @@ def test_query_folder_contents_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.QueryFolderContentsRequest() - assert args[0] == request_msg @@ -54392,7 +54382,6 @@ def test_query_user_root_contents_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.QueryUserRootContentsRequest() - assert args[0] == request_msg @@ -54412,7 +54401,6 @@ def test_move_folder_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.MoveFolderRequest() - assert args[0] == request_msg @@ -54434,7 +54422,6 @@ def test_list_repositories_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.ListRepositoriesRequest() - assert args[0] == request_msg @@ -54454,7 +54441,6 @@ def test_get_repository_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.GetRepositoryRequest() - assert args[0] == request_msg @@ -54476,7 +54462,6 @@ def test_create_repository_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.CreateRepositoryRequest() - assert args[0] == request_msg @@ -54498,7 +54483,6 @@ def test_update_repository_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.UpdateRepositoryRequest() - assert args[0] == request_msg @@ -54520,7 +54504,6 @@ def test_delete_repository_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.DeleteRepositoryRequest() - assert args[0] == request_msg @@ -54540,7 +54523,6 @@ def test_move_repository_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.MoveRepositoryRequest() - assert args[0] == request_msg @@ -54562,7 +54544,6 @@ def test_commit_repository_changes_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.CommitRepositoryChangesRequest() - assert args[0] == request_msg @@ -54584,7 +54565,6 @@ def test_read_repository_file_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.ReadRepositoryFileRequest() - assert args[0] == request_msg @@ -54606,7 +54586,6 @@ def test_query_repository_directory_contents_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.QueryRepositoryDirectoryContentsRequest() - assert args[0] == request_msg @@ -54628,7 +54607,6 @@ def test_fetch_repository_history_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.FetchRepositoryHistoryRequest() - assert args[0] == request_msg @@ -54650,7 +54628,6 @@ def test_compute_repository_access_token_status_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.ComputeRepositoryAccessTokenStatusRequest() - assert args[0] == request_msg @@ -54672,7 +54649,6 @@ def test_fetch_remote_branches_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.FetchRemoteBranchesRequest() - assert args[0] == request_msg @@ -54692,7 +54668,6 @@ def test_list_workspaces_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.ListWorkspacesRequest() - assert args[0] == request_msg @@ -54712,7 +54687,6 @@ def test_get_workspace_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.GetWorkspaceRequest() - assert args[0] == request_msg @@ -54732,7 +54706,6 @@ def test_create_workspace_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.CreateWorkspaceRequest() - assert args[0] == request_msg @@ -54752,7 +54725,6 @@ def test_delete_workspace_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.DeleteWorkspaceRequest() - assert args[0] == request_msg @@ -54774,7 +54746,6 @@ def test_install_npm_packages_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.InstallNpmPackagesRequest() - assert args[0] == request_msg @@ -54794,7 +54765,6 @@ def test_pull_git_commits_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.PullGitCommitsRequest() - assert args[0] == request_msg @@ -54814,7 +54784,6 @@ def test_push_git_commits_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.PushGitCommitsRequest() - assert args[0] == request_msg @@ -54836,7 +54805,6 @@ def test_fetch_file_git_statuses_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.FetchFileGitStatusesRequest() - assert args[0] == request_msg @@ -54858,7 +54826,6 @@ def test_fetch_git_ahead_behind_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.FetchGitAheadBehindRequest() - assert args[0] == request_msg @@ -54880,7 +54847,6 @@ def test_commit_workspace_changes_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.CommitWorkspaceChangesRequest() - assert args[0] == request_msg @@ -54902,7 +54868,6 @@ def test_reset_workspace_changes_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.ResetWorkspaceChangesRequest() - assert args[0] == request_msg @@ -54922,7 +54887,6 @@ def test_fetch_file_diff_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.FetchFileDiffRequest() - assert args[0] == request_msg @@ -54944,7 +54908,6 @@ def test_query_directory_contents_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.QueryDirectoryContentsRequest() - assert args[0] == request_msg @@ -54964,7 +54927,6 @@ def test_search_files_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.SearchFilesRequest() - assert args[0] == request_msg @@ -54984,7 +54946,6 @@ def test_make_directory_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.MakeDirectoryRequest() - assert args[0] == request_msg @@ -55004,7 +54965,6 @@ def test_remove_directory_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.RemoveDirectoryRequest() - assert args[0] == request_msg @@ -55024,7 +54984,6 @@ def test_move_directory_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.MoveDirectoryRequest() - assert args[0] == request_msg @@ -55044,7 +55003,6 @@ def test_read_file_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.ReadFileRequest() - assert args[0] == request_msg @@ -55064,7 +55022,6 @@ def test_remove_file_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.RemoveFileRequest() - assert args[0] == request_msg @@ -55084,7 +55041,6 @@ def test_move_file_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.MoveFileRequest() - assert args[0] == request_msg @@ -55104,7 +55060,6 @@ def test_write_file_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.WriteFileRequest() - assert args[0] == request_msg @@ -55126,7 +55081,6 @@ def test_list_release_configs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.ListReleaseConfigsRequest() - assert args[0] == request_msg @@ -55148,7 +55102,6 @@ def test_get_release_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.GetReleaseConfigRequest() - assert args[0] == request_msg @@ -55170,7 +55123,6 @@ def test_create_release_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.CreateReleaseConfigRequest() - assert args[0] == request_msg @@ -55192,7 +55144,6 @@ def test_update_release_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.UpdateReleaseConfigRequest() - assert args[0] == request_msg @@ -55214,7 +55165,6 @@ def test_delete_release_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.DeleteReleaseConfigRequest() - assert args[0] == request_msg @@ -55236,7 +55186,6 @@ def test_list_compilation_results_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.ListCompilationResultsRequest() - assert args[0] == request_msg @@ -55258,7 +55207,6 @@ def test_get_compilation_result_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.GetCompilationResultRequest() - assert args[0] == request_msg @@ -55280,7 +55228,6 @@ def test_create_compilation_result_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.CreateCompilationResultRequest() - assert args[0] == request_msg @@ -55302,7 +55249,6 @@ def test_query_compilation_result_actions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.QueryCompilationResultActionsRequest() - assert args[0] == request_msg @@ -55324,7 +55270,6 @@ def test_list_workflow_configs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.ListWorkflowConfigsRequest() - assert args[0] == request_msg @@ -55346,7 +55291,6 @@ def test_get_workflow_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.GetWorkflowConfigRequest() - assert args[0] == request_msg @@ -55368,7 +55312,6 @@ def test_create_workflow_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.CreateWorkflowConfigRequest() - assert args[0] == request_msg @@ -55390,7 +55333,6 @@ def test_update_workflow_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.UpdateWorkflowConfigRequest() - assert args[0] == request_msg @@ -55412,7 +55354,6 @@ def test_delete_workflow_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.DeleteWorkflowConfigRequest() - assert args[0] == request_msg @@ -55434,7 +55375,6 @@ def test_list_workflow_invocations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.ListWorkflowInvocationsRequest() - assert args[0] == request_msg @@ -55456,7 +55396,6 @@ def test_get_workflow_invocation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.GetWorkflowInvocationRequest() - assert args[0] == request_msg @@ -55478,7 +55417,6 @@ def test_create_workflow_invocation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.CreateWorkflowInvocationRequest() - assert args[0] == request_msg @@ -55500,7 +55438,6 @@ def test_delete_workflow_invocation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.DeleteWorkflowInvocationRequest() - assert args[0] == request_msg @@ -55522,7 +55459,6 @@ def test_cancel_workflow_invocation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.CancelWorkflowInvocationRequest() - assert args[0] == request_msg @@ -55544,7 +55480,6 @@ def test_query_workflow_invocation_actions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.QueryWorkflowInvocationActionsRequest() - assert args[0] == request_msg @@ -55564,7 +55499,6 @@ def test_get_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.GetConfigRequest() - assert args[0] == request_msg @@ -55584,7 +55518,6 @@ def test_update_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataform.UpdateConfigRequest() - assert args[0] == request_msg @@ -55604,7 +55537,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -55624,7 +55556,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -55646,7 +55577,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-datalabeling/noxfile.py b/packages/google-cloud-datalabeling/noxfile.py index 760a53132e49..e4f28c74368b 100644 --- a/packages/google-cloud-datalabeling/noxfile.py +++ b/packages/google-cloud-datalabeling/noxfile.py @@ -47,7 +47,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-datalabeling" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-datalabeling/setup.py b/packages/google-cloud-datalabeling/setup.py index 595a949215e1..e32ddc444741 100644 --- a/packages/google-cloud-datalabeling/setup.py +++ b/packages/google-cloud-datalabeling/setup.py @@ -45,7 +45,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/google-cloud-datalabeling/testing/constraints-3.10.txt b/packages/google-cloud-datalabeling/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-datalabeling/testing/constraints-3.10.txt +++ b/packages/google-cloud-datalabeling/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-datalabeling/tests/unit/gapic/datalabeling_v1beta1/test_data_labeling_service.py b/packages/google-cloud-datalabeling/tests/unit/gapic/datalabeling_v1beta1/test_data_labeling_service.py index 856675efbd9e..27b75dafad82 100644 --- a/packages/google-cloud-datalabeling/tests/unit/gapic/datalabeling_v1beta1/test_data_labeling_service.py +++ b/packages/google-cloud-datalabeling/tests/unit/gapic/datalabeling_v1beta1/test_data_labeling_service.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 @@ -131,6 +132,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" @@ -1354,8 +1370,8 @@ def test_data_labeling_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - data_labeling_service.CreateDatasetRequest, - dict, + data_labeling_service.CreateDatasetRequest(), + {}, ], ) def test_create_dataset(request_type, transport: str = "grpc"): @@ -1366,7 +1382,7 @@ def test_create_dataset(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_dataset), "__call__") as call: @@ -1418,9 +1434,10 @@ def test_create_dataset_non_empty_request_with_auto_populated_field(): client.create_dataset(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_labeling_service.CreateDatasetRequest( + request_msg = data_labeling_service.CreateDatasetRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_dataset_use_cached_wrapped_rpc(): @@ -1501,10 +1518,14 @@ async def test_create_dataset_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_dataset_async( - transport: str = "grpc_asyncio", - request_type=data_labeling_service.CreateDatasetRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + data_labeling_service.CreateDatasetRequest(), + {}, + ], +) +async def test_create_dataset_async(request_type, transport: str = "grpc_asyncio"): client = DataLabelingServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1512,7 +1533,7 @@ async def test_create_dataset_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_dataset), "__call__") as call: @@ -1543,11 +1564,6 @@ async def test_create_dataset_async( assert response.data_item_count == 1584 -@pytest.mark.asyncio -async def test_create_dataset_async_from_dict(): - await test_create_dataset_async(request_type=dict) - - def test_create_dataset_field_headers(): client = DataLabelingServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1700,8 +1716,8 @@ async def test_create_dataset_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_labeling_service.GetDatasetRequest, - dict, + data_labeling_service.GetDatasetRequest(), + {}, ], ) def test_get_dataset(request_type, transport: str = "grpc"): @@ -1712,7 +1728,7 @@ def test_get_dataset(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_dataset), "__call__") as call: @@ -1764,9 +1780,10 @@ def test_get_dataset_non_empty_request_with_auto_populated_field(): client.get_dataset(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_labeling_service.GetDatasetRequest( + request_msg = data_labeling_service.GetDatasetRequest( name="name_value", ) + assert args[0] == request_msg def test_get_dataset_use_cached_wrapped_rpc(): @@ -1847,10 +1864,14 @@ async def test_get_dataset_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_dataset_async( - transport: str = "grpc_asyncio", - request_type=data_labeling_service.GetDatasetRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + data_labeling_service.GetDatasetRequest(), + {}, + ], +) +async def test_get_dataset_async(request_type, transport: str = "grpc_asyncio"): client = DataLabelingServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1858,7 +1879,7 @@ async def test_get_dataset_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_dataset), "__call__") as call: @@ -1889,11 +1910,6 @@ async def test_get_dataset_async( assert response.data_item_count == 1584 -@pytest.mark.asyncio -async def test_get_dataset_async_from_dict(): - await test_get_dataset_async(request_type=dict) - - def test_get_dataset_field_headers(): client = DataLabelingServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2036,8 +2052,8 @@ async def test_get_dataset_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_labeling_service.ListDatasetsRequest, - dict, + data_labeling_service.ListDatasetsRequest(), + {}, ], ) def test_list_datasets(request_type, transport: str = "grpc"): @@ -2048,7 +2064,7 @@ def test_list_datasets(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_datasets), "__call__") as call: @@ -2094,11 +2110,12 @@ def test_list_datasets_non_empty_request_with_auto_populated_field(): client.list_datasets(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_labeling_service.ListDatasetsRequest( + request_msg = data_labeling_service.ListDatasetsRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_datasets_use_cached_wrapped_rpc(): @@ -2179,10 +2196,14 @@ async def test_list_datasets_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_datasets_async( - transport: str = "grpc_asyncio", - request_type=data_labeling_service.ListDatasetsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + data_labeling_service.ListDatasetsRequest(), + {}, + ], +) +async def test_list_datasets_async(request_type, transport: str = "grpc_asyncio"): client = DataLabelingServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2190,7 +2211,7 @@ async def test_list_datasets_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_datasets), "__call__") as call: @@ -2213,11 +2234,6 @@ async def test_list_datasets_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_datasets_async_from_dict(): - await test_list_datasets_async(request_type=dict) - - def test_list_datasets_field_headers(): client = DataLabelingServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2564,8 +2580,8 @@ async def test_list_datasets_async_pages(): @pytest.mark.parametrize( "request_type", [ - data_labeling_service.DeleteDatasetRequest, - dict, + data_labeling_service.DeleteDatasetRequest(), + {}, ], ) def test_delete_dataset(request_type, transport: str = "grpc"): @@ -2576,7 +2592,7 @@ def test_delete_dataset(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_dataset), "__call__") as call: @@ -2617,9 +2633,10 @@ def test_delete_dataset_non_empty_request_with_auto_populated_field(): client.delete_dataset(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_labeling_service.DeleteDatasetRequest( + request_msg = data_labeling_service.DeleteDatasetRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_dataset_use_cached_wrapped_rpc(): @@ -2700,10 +2717,14 @@ async def test_delete_dataset_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_dataset_async( - transport: str = "grpc_asyncio", - request_type=data_labeling_service.DeleteDatasetRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + data_labeling_service.DeleteDatasetRequest(), + {}, + ], +) +async def test_delete_dataset_async(request_type, transport: str = "grpc_asyncio"): client = DataLabelingServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2711,7 +2732,7 @@ async def test_delete_dataset_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_dataset), "__call__") as call: @@ -2729,11 +2750,6 @@ async def test_delete_dataset_async( assert response is None -@pytest.mark.asyncio -async def test_delete_dataset_async_from_dict(): - await test_delete_dataset_async(request_type=dict) - - def test_delete_dataset_field_headers(): client = DataLabelingServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2876,8 +2892,8 @@ async def test_delete_dataset_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_labeling_service.ImportDataRequest, - dict, + data_labeling_service.ImportDataRequest(), + {}, ], ) def test_import_data(request_type, transport: str = "grpc"): @@ -2888,7 +2904,7 @@ def test_import_data(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.import_data), "__call__") as call: @@ -2930,10 +2946,11 @@ def test_import_data_non_empty_request_with_auto_populated_field(): client.import_data(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_labeling_service.ImportDataRequest( + request_msg = data_labeling_service.ImportDataRequest( name="name_value", user_email_address="user_email_address_value", ) + assert args[0] == request_msg def test_import_data_use_cached_wrapped_rpc(): @@ -3024,10 +3041,14 @@ async def test_import_data_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_import_data_async( - transport: str = "grpc_asyncio", - request_type=data_labeling_service.ImportDataRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + data_labeling_service.ImportDataRequest(), + {}, + ], +) +async def test_import_data_async(request_type, transport: str = "grpc_asyncio"): client = DataLabelingServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3035,7 +3056,7 @@ async def test_import_data_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.import_data), "__call__") as call: @@ -3055,11 +3076,6 @@ async def test_import_data_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_import_data_async_from_dict(): - await test_import_data_async(request_type=dict) - - def test_import_data_field_headers(): client = DataLabelingServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3228,8 +3244,8 @@ async def test_import_data_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_labeling_service.ExportDataRequest, - dict, + data_labeling_service.ExportDataRequest(), + {}, ], ) def test_export_data(request_type, transport: str = "grpc"): @@ -3240,7 +3256,7 @@ def test_export_data(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.export_data), "__call__") as call: @@ -3284,12 +3300,13 @@ def test_export_data_non_empty_request_with_auto_populated_field(): client.export_data(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_labeling_service.ExportDataRequest( + request_msg = data_labeling_service.ExportDataRequest( name="name_value", annotated_dataset="annotated_dataset_value", filter="filter_value", user_email_address="user_email_address_value", ) + assert args[0] == request_msg def test_export_data_use_cached_wrapped_rpc(): @@ -3380,10 +3397,14 @@ async def test_export_data_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_export_data_async( - transport: str = "grpc_asyncio", - request_type=data_labeling_service.ExportDataRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + data_labeling_service.ExportDataRequest(), + {}, + ], +) +async def test_export_data_async(request_type, transport: str = "grpc_asyncio"): client = DataLabelingServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3391,7 +3412,7 @@ async def test_export_data_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.export_data), "__call__") as call: @@ -3411,11 +3432,6 @@ async def test_export_data_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_export_data_async_from_dict(): - await test_export_data_async(request_type=dict) - - def test_export_data_field_headers(): client = DataLabelingServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3604,8 +3620,8 @@ async def test_export_data_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_labeling_service.GetDataItemRequest, - dict, + data_labeling_service.GetDataItemRequest(), + {}, ], ) def test_get_data_item(request_type, transport: str = "grpc"): @@ -3616,7 +3632,7 @@ def test_get_data_item(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_data_item), "__call__") as call: @@ -3660,9 +3676,10 @@ def test_get_data_item_non_empty_request_with_auto_populated_field(): client.get_data_item(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_labeling_service.GetDataItemRequest( + request_msg = data_labeling_service.GetDataItemRequest( name="name_value", ) + assert args[0] == request_msg def test_get_data_item_use_cached_wrapped_rpc(): @@ -3743,10 +3760,14 @@ async def test_get_data_item_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_data_item_async( - transport: str = "grpc_asyncio", - request_type=data_labeling_service.GetDataItemRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + data_labeling_service.GetDataItemRequest(), + {}, + ], +) +async def test_get_data_item_async(request_type, transport: str = "grpc_asyncio"): client = DataLabelingServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3754,7 +3775,7 @@ async def test_get_data_item_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_data_item), "__call__") as call: @@ -3777,11 +3798,6 @@ async def test_get_data_item_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_data_item_async_from_dict(): - await test_get_data_item_async(request_type=dict) - - def test_get_data_item_field_headers(): client = DataLabelingServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3924,8 +3940,8 @@ async def test_get_data_item_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_labeling_service.ListDataItemsRequest, - dict, + data_labeling_service.ListDataItemsRequest(), + {}, ], ) def test_list_data_items(request_type, transport: str = "grpc"): @@ -3936,7 +3952,7 @@ def test_list_data_items(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_data_items), "__call__") as call: @@ -3982,11 +3998,12 @@ def test_list_data_items_non_empty_request_with_auto_populated_field(): client.list_data_items(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_labeling_service.ListDataItemsRequest( + request_msg = data_labeling_service.ListDataItemsRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_data_items_use_cached_wrapped_rpc(): @@ -4067,10 +4084,14 @@ async def test_list_data_items_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_data_items_async( - transport: str = "grpc_asyncio", - request_type=data_labeling_service.ListDataItemsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + data_labeling_service.ListDataItemsRequest(), + {}, + ], +) +async def test_list_data_items_async(request_type, transport: str = "grpc_asyncio"): client = DataLabelingServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4078,7 +4099,7 @@ async def test_list_data_items_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_data_items), "__call__") as call: @@ -4101,11 +4122,6 @@ async def test_list_data_items_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_data_items_async_from_dict(): - await test_list_data_items_async(request_type=dict) - - def test_list_data_items_field_headers(): client = DataLabelingServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4452,8 +4468,8 @@ async def test_list_data_items_async_pages(): @pytest.mark.parametrize( "request_type", [ - data_labeling_service.GetAnnotatedDatasetRequest, - dict, + data_labeling_service.GetAnnotatedDatasetRequest(), + {}, ], ) def test_get_annotated_dataset(request_type, transport: str = "grpc"): @@ -4464,7 +4480,7 @@ def test_get_annotated_dataset(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4529,9 +4545,10 @@ def test_get_annotated_dataset_non_empty_request_with_auto_populated_field(): client.get_annotated_dataset(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_labeling_service.GetAnnotatedDatasetRequest( + request_msg = data_labeling_service.GetAnnotatedDatasetRequest( name="name_value", ) + assert args[0] == request_msg def test_get_annotated_dataset_use_cached_wrapped_rpc(): @@ -4617,9 +4634,15 @@ async def test_get_annotated_dataset_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_labeling_service.GetAnnotatedDatasetRequest(), + {}, + ], +) async def test_get_annotated_dataset_async( - transport: str = "grpc_asyncio", - request_type=data_labeling_service.GetAnnotatedDatasetRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataLabelingServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4628,7 +4651,7 @@ async def test_get_annotated_dataset_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( @@ -4670,11 +4693,6 @@ async def test_get_annotated_dataset_async( assert response.blocking_resources == ["blocking_resources_value"] -@pytest.mark.asyncio -async def test_get_annotated_dataset_async_from_dict(): - await test_get_annotated_dataset_async(request_type=dict) - - def test_get_annotated_dataset_field_headers(): client = DataLabelingServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4829,8 +4847,8 @@ async def test_get_annotated_dataset_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_labeling_service.ListAnnotatedDatasetsRequest, - dict, + data_labeling_service.ListAnnotatedDatasetsRequest(), + {}, ], ) def test_list_annotated_datasets(request_type, transport: str = "grpc"): @@ -4841,7 +4859,7 @@ def test_list_annotated_datasets(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4891,11 +4909,12 @@ def test_list_annotated_datasets_non_empty_request_with_auto_populated_field(): client.list_annotated_datasets(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_labeling_service.ListAnnotatedDatasetsRequest( + request_msg = data_labeling_service.ListAnnotatedDatasetsRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_annotated_datasets_use_cached_wrapped_rpc(): @@ -4981,9 +5000,15 @@ async def test_list_annotated_datasets_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_labeling_service.ListAnnotatedDatasetsRequest(), + {}, + ], +) async def test_list_annotated_datasets_async( - transport: str = "grpc_asyncio", - request_type=data_labeling_service.ListAnnotatedDatasetsRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataLabelingServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4992,7 +5017,7 @@ async def test_list_annotated_datasets_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( @@ -5017,11 +5042,6 @@ async def test_list_annotated_datasets_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_annotated_datasets_async_from_dict(): - await test_list_annotated_datasets_async(request_type=dict) - - def test_list_annotated_datasets_field_headers(): client = DataLabelingServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5384,8 +5404,8 @@ async def test_list_annotated_datasets_async_pages(): @pytest.mark.parametrize( "request_type", [ - data_labeling_service.DeleteAnnotatedDatasetRequest, - dict, + data_labeling_service.DeleteAnnotatedDatasetRequest(), + {}, ], ) def test_delete_annotated_dataset(request_type, transport: str = "grpc"): @@ -5396,7 +5416,7 @@ def test_delete_annotated_dataset(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5441,9 +5461,10 @@ def test_delete_annotated_dataset_non_empty_request_with_auto_populated_field(): client.delete_annotated_dataset(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_labeling_service.DeleteAnnotatedDatasetRequest( + request_msg = data_labeling_service.DeleteAnnotatedDatasetRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_annotated_dataset_use_cached_wrapped_rpc(): @@ -5529,9 +5550,15 @@ async def test_delete_annotated_dataset_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_labeling_service.DeleteAnnotatedDatasetRequest(), + {}, + ], +) async def test_delete_annotated_dataset_async( - transport: str = "grpc_asyncio", - request_type=data_labeling_service.DeleteAnnotatedDatasetRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataLabelingServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5540,7 +5567,7 @@ async def test_delete_annotated_dataset_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( @@ -5560,11 +5587,6 @@ async def test_delete_annotated_dataset_async( assert response is None -@pytest.mark.asyncio -async def test_delete_annotated_dataset_async_from_dict(): - await test_delete_annotated_dataset_async(request_type=dict) - - def test_delete_annotated_dataset_field_headers(): client = DataLabelingServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5631,8 +5653,8 @@ async def test_delete_annotated_dataset_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - data_labeling_service.LabelImageRequest, - dict, + data_labeling_service.LabelImageRequest(), + {}, ], ) def test_label_image(request_type, transport: str = "grpc"): @@ -5643,7 +5665,7 @@ def test_label_image(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.label_image), "__call__") as call: @@ -5684,9 +5706,10 @@ def test_label_image_non_empty_request_with_auto_populated_field(): client.label_image(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_labeling_service.LabelImageRequest( + request_msg = data_labeling_service.LabelImageRequest( parent="parent_value", ) + assert args[0] == request_msg def test_label_image_use_cached_wrapped_rpc(): @@ -5777,10 +5800,14 @@ async def test_label_image_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_label_image_async( - transport: str = "grpc_asyncio", - request_type=data_labeling_service.LabelImageRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + data_labeling_service.LabelImageRequest(), + {}, + ], +) +async def test_label_image_async(request_type, transport: str = "grpc_asyncio"): client = DataLabelingServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5788,7 +5815,7 @@ async def test_label_image_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.label_image), "__call__") as call: @@ -5808,11 +5835,6 @@ async def test_label_image_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_label_image_async_from_dict(): - await test_label_image_async(request_type=dict) - - def test_label_image_field_headers(): client = DataLabelingServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5991,8 +6013,8 @@ async def test_label_image_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_labeling_service.LabelVideoRequest, - dict, + data_labeling_service.LabelVideoRequest(), + {}, ], ) def test_label_video(request_type, transport: str = "grpc"): @@ -6003,7 +6025,7 @@ def test_label_video(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.label_video), "__call__") as call: @@ -6044,9 +6066,10 @@ def test_label_video_non_empty_request_with_auto_populated_field(): client.label_video(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_labeling_service.LabelVideoRequest( + request_msg = data_labeling_service.LabelVideoRequest( parent="parent_value", ) + assert args[0] == request_msg def test_label_video_use_cached_wrapped_rpc(): @@ -6137,10 +6160,14 @@ async def test_label_video_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_label_video_async( - transport: str = "grpc_asyncio", - request_type=data_labeling_service.LabelVideoRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + data_labeling_service.LabelVideoRequest(), + {}, + ], +) +async def test_label_video_async(request_type, transport: str = "grpc_asyncio"): client = DataLabelingServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6148,7 +6175,7 @@ async def test_label_video_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.label_video), "__call__") as call: @@ -6168,11 +6195,6 @@ async def test_label_video_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_label_video_async_from_dict(): - await test_label_video_async(request_type=dict) - - def test_label_video_field_headers(): client = DataLabelingServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6351,8 +6373,8 @@ async def test_label_video_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_labeling_service.LabelTextRequest, - dict, + data_labeling_service.LabelTextRequest(), + {}, ], ) def test_label_text(request_type, transport: str = "grpc"): @@ -6363,7 +6385,7 @@ def test_label_text(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.label_text), "__call__") as call: @@ -6404,9 +6426,10 @@ def test_label_text_non_empty_request_with_auto_populated_field(): client.label_text(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_labeling_service.LabelTextRequest( + request_msg = data_labeling_service.LabelTextRequest( parent="parent_value", ) + assert args[0] == request_msg def test_label_text_use_cached_wrapped_rpc(): @@ -6495,9 +6518,14 @@ async def test_label_text_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_label_text_async( - transport: str = "grpc_asyncio", request_type=data_labeling_service.LabelTextRequest -): +@pytest.mark.parametrize( + "request_type", + [ + data_labeling_service.LabelTextRequest(), + {}, + ], +) +async def test_label_text_async(request_type, transport: str = "grpc_asyncio"): client = DataLabelingServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6505,7 +6533,7 @@ async def test_label_text_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.label_text), "__call__") as call: @@ -6525,11 +6553,6 @@ async def test_label_text_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_label_text_async_from_dict(): - await test_label_text_async(request_type=dict) - - def test_label_text_field_headers(): client = DataLabelingServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6708,8 +6731,8 @@ async def test_label_text_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_labeling_service.GetExampleRequest, - dict, + data_labeling_service.GetExampleRequest(), + {}, ], ) def test_get_example(request_type, transport: str = "grpc"): @@ -6720,7 +6743,7 @@ def test_get_example(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_example), "__call__") as call: @@ -6765,10 +6788,11 @@ def test_get_example_non_empty_request_with_auto_populated_field(): client.get_example(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_labeling_service.GetExampleRequest( + request_msg = data_labeling_service.GetExampleRequest( name="name_value", filter="filter_value", ) + assert args[0] == request_msg def test_get_example_use_cached_wrapped_rpc(): @@ -6849,10 +6873,14 @@ async def test_get_example_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_example_async( - transport: str = "grpc_asyncio", - request_type=data_labeling_service.GetExampleRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + data_labeling_service.GetExampleRequest(), + {}, + ], +) +async def test_get_example_async(request_type, transport: str = "grpc_asyncio"): client = DataLabelingServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6860,7 +6888,7 @@ async def test_get_example_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_example), "__call__") as call: @@ -6883,11 +6911,6 @@ async def test_get_example_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_example_async_from_dict(): - await test_get_example_async(request_type=dict) - - def test_get_example_field_headers(): client = DataLabelingServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7040,8 +7063,8 @@ async def test_get_example_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_labeling_service.ListExamplesRequest, - dict, + data_labeling_service.ListExamplesRequest(), + {}, ], ) def test_list_examples(request_type, transport: str = "grpc"): @@ -7052,7 +7075,7 @@ def test_list_examples(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_examples), "__call__") as call: @@ -7098,11 +7121,12 @@ def test_list_examples_non_empty_request_with_auto_populated_field(): client.list_examples(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_labeling_service.ListExamplesRequest( + request_msg = data_labeling_service.ListExamplesRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_examples_use_cached_wrapped_rpc(): @@ -7183,10 +7207,14 @@ async def test_list_examples_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_examples_async( - transport: str = "grpc_asyncio", - request_type=data_labeling_service.ListExamplesRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + data_labeling_service.ListExamplesRequest(), + {}, + ], +) +async def test_list_examples_async(request_type, transport: str = "grpc_asyncio"): client = DataLabelingServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7194,7 +7222,7 @@ async def test_list_examples_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_examples), "__call__") as call: @@ -7217,11 +7245,6 @@ async def test_list_examples_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_examples_async_from_dict(): - await test_list_examples_async(request_type=dict) - - def test_list_examples_field_headers(): client = DataLabelingServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7568,8 +7591,8 @@ async def test_list_examples_async_pages(): @pytest.mark.parametrize( "request_type", [ - data_labeling_service.CreateAnnotationSpecSetRequest, - dict, + data_labeling_service.CreateAnnotationSpecSetRequest(), + {}, ], ) def test_create_annotation_spec_set(request_type, transport: str = "grpc"): @@ -7580,7 +7603,7 @@ def test_create_annotation_spec_set(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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 +7657,10 @@ def test_create_annotation_spec_set_non_empty_request_with_auto_populated_field( client.create_annotation_spec_set(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_labeling_service.CreateAnnotationSpecSetRequest( + request_msg = data_labeling_service.CreateAnnotationSpecSetRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_annotation_spec_set_use_cached_wrapped_rpc(): @@ -7722,9 +7746,15 @@ async def test_create_annotation_spec_set_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_labeling_service.CreateAnnotationSpecSetRequest(), + {}, + ], +) async def test_create_annotation_spec_set_async( - transport: str = "grpc_asyncio", - request_type=data_labeling_service.CreateAnnotationSpecSetRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataLabelingServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -7733,7 +7763,7 @@ async def test_create_annotation_spec_set_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( @@ -7764,11 +7794,6 @@ async def test_create_annotation_spec_set_async( assert response.blocking_resources == ["blocking_resources_value"] -@pytest.mark.asyncio -async def test_create_annotation_spec_set_async_from_dict(): - await test_create_annotation_spec_set_async(request_type=dict) - - def test_create_annotation_spec_set_field_headers(): client = DataLabelingServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7941,8 +7966,8 @@ async def test_create_annotation_spec_set_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_labeling_service.GetAnnotationSpecSetRequest, - dict, + data_labeling_service.GetAnnotationSpecSetRequest(), + {}, ], ) def test_get_annotation_spec_set(request_type, transport: str = "grpc"): @@ -7953,7 +7978,7 @@ def test_get_annotation_spec_set(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8007,9 +8032,10 @@ def test_get_annotation_spec_set_non_empty_request_with_auto_populated_field(): client.get_annotation_spec_set(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_labeling_service.GetAnnotationSpecSetRequest( + request_msg = data_labeling_service.GetAnnotationSpecSetRequest( name="name_value", ) + assert args[0] == request_msg def test_get_annotation_spec_set_use_cached_wrapped_rpc(): @@ -8095,9 +8121,15 @@ async def test_get_annotation_spec_set_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_labeling_service.GetAnnotationSpecSetRequest(), + {}, + ], +) async def test_get_annotation_spec_set_async( - transport: str = "grpc_asyncio", - request_type=data_labeling_service.GetAnnotationSpecSetRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataLabelingServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -8106,7 +8138,7 @@ async def test_get_annotation_spec_set_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( @@ -8137,11 +8169,6 @@ async def test_get_annotation_spec_set_async( assert response.blocking_resources == ["blocking_resources_value"] -@pytest.mark.asyncio -async def test_get_annotation_spec_set_async_from_dict(): - await test_get_annotation_spec_set_async(request_type=dict) - - def test_get_annotation_spec_set_field_headers(): client = DataLabelingServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8296,8 +8323,8 @@ async def test_get_annotation_spec_set_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_labeling_service.ListAnnotationSpecSetsRequest, - dict, + data_labeling_service.ListAnnotationSpecSetsRequest(), + {}, ], ) def test_list_annotation_spec_sets(request_type, transport: str = "grpc"): @@ -8308,7 +8335,7 @@ def test_list_annotation_spec_sets(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8358,11 +8385,12 @@ def test_list_annotation_spec_sets_non_empty_request_with_auto_populated_field() client.list_annotation_spec_sets(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_labeling_service.ListAnnotationSpecSetsRequest( + request_msg = data_labeling_service.ListAnnotationSpecSetsRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_annotation_spec_sets_use_cached_wrapped_rpc(): @@ -8448,9 +8476,15 @@ async def test_list_annotation_spec_sets_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_labeling_service.ListAnnotationSpecSetsRequest(), + {}, + ], +) async def test_list_annotation_spec_sets_async( - transport: str = "grpc_asyncio", - request_type=data_labeling_service.ListAnnotationSpecSetsRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataLabelingServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -8459,7 +8493,7 @@ async def test_list_annotation_spec_sets_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( @@ -8484,11 +8518,6 @@ async def test_list_annotation_spec_sets_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_annotation_spec_sets_async_from_dict(): - await test_list_annotation_spec_sets_async(request_type=dict) - - def test_list_annotation_spec_sets_field_headers(): client = DataLabelingServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8857,8 +8886,8 @@ async def test_list_annotation_spec_sets_async_pages(): @pytest.mark.parametrize( "request_type", [ - data_labeling_service.DeleteAnnotationSpecSetRequest, - dict, + data_labeling_service.DeleteAnnotationSpecSetRequest(), + {}, ], ) def test_delete_annotation_spec_set(request_type, transport: str = "grpc"): @@ -8869,7 +8898,7 @@ def test_delete_annotation_spec_set(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8914,9 +8943,10 @@ def test_delete_annotation_spec_set_non_empty_request_with_auto_populated_field( client.delete_annotation_spec_set(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_labeling_service.DeleteAnnotationSpecSetRequest( + request_msg = data_labeling_service.DeleteAnnotationSpecSetRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_annotation_spec_set_use_cached_wrapped_rpc(): @@ -9002,9 +9032,15 @@ async def test_delete_annotation_spec_set_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_labeling_service.DeleteAnnotationSpecSetRequest(), + {}, + ], +) async def test_delete_annotation_spec_set_async( - transport: str = "grpc_asyncio", - request_type=data_labeling_service.DeleteAnnotationSpecSetRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataLabelingServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -9013,7 +9049,7 @@ async def test_delete_annotation_spec_set_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( @@ -9033,11 +9069,6 @@ async def test_delete_annotation_spec_set_async( assert response is None -@pytest.mark.asyncio -async def test_delete_annotation_spec_set_async_from_dict(): - await test_delete_annotation_spec_set_async(request_type=dict) - - def test_delete_annotation_spec_set_field_headers(): client = DataLabelingServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9188,8 +9219,8 @@ async def test_delete_annotation_spec_set_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_labeling_service.CreateInstructionRequest, - dict, + data_labeling_service.CreateInstructionRequest(), + {}, ], ) def test_create_instruction(request_type, transport: str = "grpc"): @@ -9200,7 +9231,7 @@ def test_create_instruction(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9245,9 +9276,10 @@ def test_create_instruction_non_empty_request_with_auto_populated_field(): client.create_instruction(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_labeling_service.CreateInstructionRequest( + request_msg = data_labeling_service.CreateInstructionRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_instruction_use_cached_wrapped_rpc(): @@ -9342,10 +9374,14 @@ async def test_create_instruction_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_instruction_async( - transport: str = "grpc_asyncio", - request_type=data_labeling_service.CreateInstructionRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + data_labeling_service.CreateInstructionRequest(), + {}, + ], +) +async def test_create_instruction_async(request_type, transport: str = "grpc_asyncio"): client = DataLabelingServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9353,7 +9389,7 @@ async def test_create_instruction_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( @@ -9375,11 +9411,6 @@ async def test_create_instruction_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_instruction_async_from_dict(): - await test_create_instruction_async(request_type=dict) - - def test_create_instruction_field_headers(): client = DataLabelingServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9544,8 +9575,8 @@ async def test_create_instruction_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_labeling_service.GetInstructionRequest, - dict, + data_labeling_service.GetInstructionRequest(), + {}, ], ) def test_get_instruction(request_type, transport: str = "grpc"): @@ -9556,7 +9587,7 @@ def test_get_instruction(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_instruction), "__call__") as call: @@ -9608,9 +9639,10 @@ def test_get_instruction_non_empty_request_with_auto_populated_field(): client.get_instruction(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_labeling_service.GetInstructionRequest( + request_msg = data_labeling_service.GetInstructionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_instruction_use_cached_wrapped_rpc(): @@ -9691,10 +9723,14 @@ async def test_get_instruction_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_instruction_async( - transport: str = "grpc_asyncio", - request_type=data_labeling_service.GetInstructionRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + data_labeling_service.GetInstructionRequest(), + {}, + ], +) +async def test_get_instruction_async(request_type, transport: str = "grpc_asyncio"): client = DataLabelingServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9702,7 +9738,7 @@ async def test_get_instruction_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_instruction), "__call__") as call: @@ -9733,11 +9769,6 @@ async def test_get_instruction_async( assert response.blocking_resources == ["blocking_resources_value"] -@pytest.mark.asyncio -async def test_get_instruction_async_from_dict(): - await test_get_instruction_async(request_type=dict) - - def test_get_instruction_field_headers(): client = DataLabelingServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9884,8 +9915,8 @@ async def test_get_instruction_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_labeling_service.ListInstructionsRequest, - dict, + data_labeling_service.ListInstructionsRequest(), + {}, ], ) def test_list_instructions(request_type, transport: str = "grpc"): @@ -9896,7 +9927,7 @@ def test_list_instructions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9946,11 +9977,12 @@ def test_list_instructions_non_empty_request_with_auto_populated_field(): client.list_instructions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_labeling_service.ListInstructionsRequest( + request_msg = data_labeling_service.ListInstructionsRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_instructions_use_cached_wrapped_rpc(): @@ -10033,10 +10065,14 @@ async def test_list_instructions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_instructions_async( - transport: str = "grpc_asyncio", - request_type=data_labeling_service.ListInstructionsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + data_labeling_service.ListInstructionsRequest(), + {}, + ], +) +async def test_list_instructions_async(request_type, transport: str = "grpc_asyncio"): client = DataLabelingServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10044,7 +10080,7 @@ async def test_list_instructions_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( @@ -10069,11 +10105,6 @@ async def test_list_instructions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_instructions_async_from_dict(): - await test_list_instructions_async(request_type=dict) - - def test_list_instructions_field_headers(): client = DataLabelingServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10436,8 +10467,8 @@ async def test_list_instructions_async_pages(): @pytest.mark.parametrize( "request_type", [ - data_labeling_service.DeleteInstructionRequest, - dict, + data_labeling_service.DeleteInstructionRequest(), + {}, ], ) def test_delete_instruction(request_type, transport: str = "grpc"): @@ -10448,7 +10479,7 @@ def test_delete_instruction(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10493,9 +10524,10 @@ def test_delete_instruction_non_empty_request_with_auto_populated_field(): client.delete_instruction(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_labeling_service.DeleteInstructionRequest( + request_msg = data_labeling_service.DeleteInstructionRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_instruction_use_cached_wrapped_rpc(): @@ -10580,10 +10612,14 @@ async def test_delete_instruction_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_instruction_async( - transport: str = "grpc_asyncio", - request_type=data_labeling_service.DeleteInstructionRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + data_labeling_service.DeleteInstructionRequest(), + {}, + ], +) +async def test_delete_instruction_async(request_type, transport: str = "grpc_asyncio"): client = DataLabelingServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10591,7 +10627,7 @@ async def test_delete_instruction_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( @@ -10611,11 +10647,6 @@ async def test_delete_instruction_async( assert response is None -@pytest.mark.asyncio -async def test_delete_instruction_async_from_dict(): - await test_delete_instruction_async(request_type=dict) - - def test_delete_instruction_field_headers(): client = DataLabelingServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10766,8 +10797,8 @@ async def test_delete_instruction_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_labeling_service.GetEvaluationRequest, - dict, + data_labeling_service.GetEvaluationRequest(), + {}, ], ) def test_get_evaluation(request_type, transport: str = "grpc"): @@ -10778,7 +10809,7 @@ def test_get_evaluation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_evaluation), "__call__") as call: @@ -10829,9 +10860,10 @@ def test_get_evaluation_non_empty_request_with_auto_populated_field(): client.get_evaluation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_labeling_service.GetEvaluationRequest( + request_msg = data_labeling_service.GetEvaluationRequest( name="name_value", ) + assert args[0] == request_msg def test_get_evaluation_use_cached_wrapped_rpc(): @@ -10912,10 +10944,14 @@ async def test_get_evaluation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_evaluation_async( - transport: str = "grpc_asyncio", - request_type=data_labeling_service.GetEvaluationRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + data_labeling_service.GetEvaluationRequest(), + {}, + ], +) +async def test_get_evaluation_async(request_type, transport: str = "grpc_asyncio"): client = DataLabelingServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10923,7 +10959,7 @@ async def test_get_evaluation_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_evaluation), "__call__") as call: @@ -10953,11 +10989,6 @@ async def test_get_evaluation_async( assert response.evaluated_item_count == 2129 -@pytest.mark.asyncio -async def test_get_evaluation_async_from_dict(): - await test_get_evaluation_async(request_type=dict) - - def test_get_evaluation_field_headers(): client = DataLabelingServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11104,8 +11135,8 @@ async def test_get_evaluation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_labeling_service.SearchEvaluationsRequest, - dict, + data_labeling_service.SearchEvaluationsRequest(), + {}, ], ) def test_search_evaluations(request_type, transport: str = "grpc"): @@ -11116,7 +11147,7 @@ def test_search_evaluations(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11166,11 +11197,12 @@ def test_search_evaluations_non_empty_request_with_auto_populated_field(): client.search_evaluations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_labeling_service.SearchEvaluationsRequest( + request_msg = data_labeling_service.SearchEvaluationsRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_search_evaluations_use_cached_wrapped_rpc(): @@ -11255,10 +11287,14 @@ async def test_search_evaluations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_search_evaluations_async( - transport: str = "grpc_asyncio", - request_type=data_labeling_service.SearchEvaluationsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + data_labeling_service.SearchEvaluationsRequest(), + {}, + ], +) +async def test_search_evaluations_async(request_type, transport: str = "grpc_asyncio"): client = DataLabelingServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11266,7 +11302,7 @@ async def test_search_evaluations_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( @@ -11291,11 +11327,6 @@ async def test_search_evaluations_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_search_evaluations_async_from_dict(): - await test_search_evaluations_async(request_type=dict) - - def test_search_evaluations_field_headers(): client = DataLabelingServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11658,8 +11689,8 @@ async def test_search_evaluations_async_pages(): @pytest.mark.parametrize( "request_type", [ - data_labeling_service.SearchExampleComparisonsRequest, - dict, + data_labeling_service.SearchExampleComparisonsRequest(), + {}, ], ) def test_search_example_comparisons(request_type, transport: str = "grpc"): @@ -11670,7 +11701,7 @@ def test_search_example_comparisons(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11719,10 +11750,11 @@ def test_search_example_comparisons_non_empty_request_with_auto_populated_field( client.search_example_comparisons(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_labeling_service.SearchExampleComparisonsRequest( + request_msg = data_labeling_service.SearchExampleComparisonsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_search_example_comparisons_use_cached_wrapped_rpc(): @@ -11808,9 +11840,15 @@ async def test_search_example_comparisons_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_labeling_service.SearchExampleComparisonsRequest(), + {}, + ], +) async def test_search_example_comparisons_async( - transport: str = "grpc_asyncio", - request_type=data_labeling_service.SearchExampleComparisonsRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataLabelingServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -11819,7 +11857,7 @@ async def test_search_example_comparisons_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( @@ -11844,11 +11882,6 @@ async def test_search_example_comparisons_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_search_example_comparisons_async_from_dict(): - await test_search_example_comparisons_async(request_type=dict) - - def test_search_example_comparisons_field_headers(): client = DataLabelingServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12215,8 +12248,8 @@ async def test_search_example_comparisons_async_pages(): @pytest.mark.parametrize( "request_type", [ - data_labeling_service.CreateEvaluationJobRequest, - dict, + data_labeling_service.CreateEvaluationJobRequest(), + {}, ], ) def test_create_evaluation_job(request_type, transport: str = "grpc"): @@ -12227,7 +12260,7 @@ def test_create_evaluation_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( @@ -12287,9 +12320,10 @@ def test_create_evaluation_job_non_empty_request_with_auto_populated_field(): client.create_evaluation_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_labeling_service.CreateEvaluationJobRequest( + request_msg = data_labeling_service.CreateEvaluationJobRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_evaluation_job_use_cached_wrapped_rpc(): @@ -12375,9 +12409,15 @@ async def test_create_evaluation_job_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_labeling_service.CreateEvaluationJobRequest(), + {}, + ], +) async def test_create_evaluation_job_async( - transport: str = "grpc_asyncio", - request_type=data_labeling_service.CreateEvaluationJobRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataLabelingServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -12386,7 +12426,7 @@ async def test_create_evaluation_job_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( @@ -12423,11 +12463,6 @@ async def test_create_evaluation_job_async( assert response.label_missing_ground_truth is True -@pytest.mark.asyncio -async def test_create_evaluation_job_async_from_dict(): - await test_create_evaluation_job_async(request_type=dict) - - def test_create_evaluation_job_field_headers(): client = DataLabelingServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12592,8 +12627,8 @@ async def test_create_evaluation_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_labeling_service.UpdateEvaluationJobRequest, - dict, + data_labeling_service.UpdateEvaluationJobRequest(), + {}, ], ) def test_update_evaluation_job(request_type, transport: str = "grpc"): @@ -12604,7 +12639,7 @@ def test_update_evaluation_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( @@ -12662,7 +12697,8 @@ def test_update_evaluation_job_non_empty_request_with_auto_populated_field(): client.update_evaluation_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_labeling_service.UpdateEvaluationJobRequest() + request_msg = data_labeling_service.UpdateEvaluationJobRequest() + assert args[0] == request_msg def test_update_evaluation_job_use_cached_wrapped_rpc(): @@ -12748,9 +12784,15 @@ async def test_update_evaluation_job_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_labeling_service.UpdateEvaluationJobRequest(), + {}, + ], +) async def test_update_evaluation_job_async( - transport: str = "grpc_asyncio", - request_type=data_labeling_service.UpdateEvaluationJobRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataLabelingServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -12759,7 +12801,7 @@ async def test_update_evaluation_job_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( @@ -12796,11 +12838,6 @@ async def test_update_evaluation_job_async( assert response.label_missing_ground_truth is True -@pytest.mark.asyncio -async def test_update_evaluation_job_async_from_dict(): - await test_update_evaluation_job_async(request_type=dict) - - def test_update_evaluation_job_field_headers(): client = DataLabelingServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12965,8 +13002,8 @@ async def test_update_evaluation_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_labeling_service.GetEvaluationJobRequest, - dict, + data_labeling_service.GetEvaluationJobRequest(), + {}, ], ) def test_get_evaluation_job(request_type, transport: str = "grpc"): @@ -12977,7 +13014,7 @@ def test_get_evaluation_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( @@ -13037,9 +13074,10 @@ def test_get_evaluation_job_non_empty_request_with_auto_populated_field(): client.get_evaluation_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_labeling_service.GetEvaluationJobRequest( + request_msg = data_labeling_service.GetEvaluationJobRequest( name="name_value", ) + assert args[0] == request_msg def test_get_evaluation_job_use_cached_wrapped_rpc(): @@ -13124,10 +13162,14 @@ async def test_get_evaluation_job_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_evaluation_job_async( - transport: str = "grpc_asyncio", - request_type=data_labeling_service.GetEvaluationJobRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + data_labeling_service.GetEvaluationJobRequest(), + {}, + ], +) +async def test_get_evaluation_job_async(request_type, transport: str = "grpc_asyncio"): client = DataLabelingServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13135,7 +13177,7 @@ async def test_get_evaluation_job_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( @@ -13172,11 +13214,6 @@ async def test_get_evaluation_job_async( assert response.label_missing_ground_truth is True -@pytest.mark.asyncio -async def test_get_evaluation_job_async_from_dict(): - await test_get_evaluation_job_async(request_type=dict) - - def test_get_evaluation_job_field_headers(): client = DataLabelingServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13331,8 +13368,8 @@ async def test_get_evaluation_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_labeling_service.PauseEvaluationJobRequest, - dict, + data_labeling_service.PauseEvaluationJobRequest(), + {}, ], ) def test_pause_evaluation_job(request_type, transport: str = "grpc"): @@ -13343,7 +13380,7 @@ def test_pause_evaluation_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( @@ -13388,9 +13425,10 @@ def test_pause_evaluation_job_non_empty_request_with_auto_populated_field(): client.pause_evaluation_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_labeling_service.PauseEvaluationJobRequest( + request_msg = data_labeling_service.PauseEvaluationJobRequest( name="name_value", ) + assert args[0] == request_msg def test_pause_evaluation_job_use_cached_wrapped_rpc(): @@ -13475,9 +13513,15 @@ async def test_pause_evaluation_job_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_labeling_service.PauseEvaluationJobRequest(), + {}, + ], +) async def test_pause_evaluation_job_async( - transport: str = "grpc_asyncio", - request_type=data_labeling_service.PauseEvaluationJobRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataLabelingServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -13486,7 +13530,7 @@ async def test_pause_evaluation_job_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( @@ -13506,11 +13550,6 @@ async def test_pause_evaluation_job_async( assert response is None -@pytest.mark.asyncio -async def test_pause_evaluation_job_async_from_dict(): - await test_pause_evaluation_job_async(request_type=dict) - - def test_pause_evaluation_job_field_headers(): client = DataLabelingServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13661,8 +13700,8 @@ async def test_pause_evaluation_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_labeling_service.ResumeEvaluationJobRequest, - dict, + data_labeling_service.ResumeEvaluationJobRequest(), + {}, ], ) def test_resume_evaluation_job(request_type, transport: str = "grpc"): @@ -13673,7 +13712,7 @@ def test_resume_evaluation_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( @@ -13718,9 +13757,10 @@ def test_resume_evaluation_job_non_empty_request_with_auto_populated_field(): client.resume_evaluation_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_labeling_service.ResumeEvaluationJobRequest( + request_msg = data_labeling_service.ResumeEvaluationJobRequest( name="name_value", ) + assert args[0] == request_msg def test_resume_evaluation_job_use_cached_wrapped_rpc(): @@ -13806,9 +13846,15 @@ async def test_resume_evaluation_job_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_labeling_service.ResumeEvaluationJobRequest(), + {}, + ], +) async def test_resume_evaluation_job_async( - transport: str = "grpc_asyncio", - request_type=data_labeling_service.ResumeEvaluationJobRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataLabelingServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -13817,7 +13863,7 @@ async def test_resume_evaluation_job_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( @@ -13837,11 +13883,6 @@ async def test_resume_evaluation_job_async( assert response is None -@pytest.mark.asyncio -async def test_resume_evaluation_job_async_from_dict(): - await test_resume_evaluation_job_async(request_type=dict) - - def test_resume_evaluation_job_field_headers(): client = DataLabelingServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13992,8 +14033,8 @@ async def test_resume_evaluation_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_labeling_service.DeleteEvaluationJobRequest, - dict, + data_labeling_service.DeleteEvaluationJobRequest(), + {}, ], ) def test_delete_evaluation_job(request_type, transport: str = "grpc"): @@ -14004,7 +14045,7 @@ def test_delete_evaluation_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( @@ -14049,9 +14090,10 @@ def test_delete_evaluation_job_non_empty_request_with_auto_populated_field(): client.delete_evaluation_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_labeling_service.DeleteEvaluationJobRequest( + request_msg = data_labeling_service.DeleteEvaluationJobRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_evaluation_job_use_cached_wrapped_rpc(): @@ -14137,9 +14179,15 @@ async def test_delete_evaluation_job_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_labeling_service.DeleteEvaluationJobRequest(), + {}, + ], +) async def test_delete_evaluation_job_async( - transport: str = "grpc_asyncio", - request_type=data_labeling_service.DeleteEvaluationJobRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataLabelingServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -14148,7 +14196,7 @@ async def test_delete_evaluation_job_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( @@ -14168,11 +14216,6 @@ async def test_delete_evaluation_job_async( assert response is None -@pytest.mark.asyncio -async def test_delete_evaluation_job_async_from_dict(): - await test_delete_evaluation_job_async(request_type=dict) - - def test_delete_evaluation_job_field_headers(): client = DataLabelingServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14323,8 +14366,8 @@ async def test_delete_evaluation_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_labeling_service.ListEvaluationJobsRequest, - dict, + data_labeling_service.ListEvaluationJobsRequest(), + {}, ], ) def test_list_evaluation_jobs(request_type, transport: str = "grpc"): @@ -14335,7 +14378,7 @@ def test_list_evaluation_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( @@ -14385,11 +14428,12 @@ def test_list_evaluation_jobs_non_empty_request_with_auto_populated_field(): client.list_evaluation_jobs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_labeling_service.ListEvaluationJobsRequest( + request_msg = data_labeling_service.ListEvaluationJobsRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_evaluation_jobs_use_cached_wrapped_rpc(): @@ -14474,9 +14518,15 @@ async def test_list_evaluation_jobs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_labeling_service.ListEvaluationJobsRequest(), + {}, + ], +) async def test_list_evaluation_jobs_async( - transport: str = "grpc_asyncio", - request_type=data_labeling_service.ListEvaluationJobsRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataLabelingServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -14485,7 +14535,7 @@ async def test_list_evaluation_jobs_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( @@ -14510,11 +14560,6 @@ async def test_list_evaluation_jobs_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_evaluation_jobs_async_from_dict(): - await test_list_evaluation_jobs_async(request_type=dict) - - def test_list_evaluation_jobs_field_headers(): client = DataLabelingServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14996,7 +15041,6 @@ def test_create_dataset_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_labeling_service.CreateDatasetRequest() - assert args[0] == request_msg @@ -15017,7 +15061,6 @@ def test_get_dataset_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_labeling_service.GetDatasetRequest() - assert args[0] == request_msg @@ -15038,7 +15081,6 @@ def test_list_datasets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_labeling_service.ListDatasetsRequest() - assert args[0] == request_msg @@ -15059,7 +15101,6 @@ def test_delete_dataset_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_labeling_service.DeleteDatasetRequest() - assert args[0] == request_msg @@ -15080,7 +15121,6 @@ def test_import_data_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_labeling_service.ImportDataRequest() - assert args[0] == request_msg @@ -15101,7 +15141,6 @@ def test_export_data_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_labeling_service.ExportDataRequest() - assert args[0] == request_msg @@ -15122,7 +15161,6 @@ def test_get_data_item_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_labeling_service.GetDataItemRequest() - assert args[0] == request_msg @@ -15143,7 +15181,6 @@ def test_list_data_items_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_labeling_service.ListDataItemsRequest() - assert args[0] == request_msg @@ -15166,7 +15203,6 @@ def test_get_annotated_dataset_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_labeling_service.GetAnnotatedDatasetRequest() - assert args[0] == request_msg @@ -15189,7 +15225,6 @@ def test_list_annotated_datasets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_labeling_service.ListAnnotatedDatasetsRequest() - assert args[0] == request_msg @@ -15212,7 +15247,6 @@ def test_delete_annotated_dataset_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_labeling_service.DeleteAnnotatedDatasetRequest() - assert args[0] == request_msg @@ -15233,7 +15267,6 @@ def test_label_image_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_labeling_service.LabelImageRequest() - assert args[0] == request_msg @@ -15254,7 +15287,6 @@ def test_label_video_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_labeling_service.LabelVideoRequest() - assert args[0] == request_msg @@ -15275,7 +15307,6 @@ def test_label_text_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_labeling_service.LabelTextRequest() - assert args[0] == request_msg @@ -15296,7 +15327,6 @@ def test_get_example_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_labeling_service.GetExampleRequest() - assert args[0] == request_msg @@ -15317,7 +15347,6 @@ def test_list_examples_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_labeling_service.ListExamplesRequest() - assert args[0] == request_msg @@ -15340,7 +15369,6 @@ def test_create_annotation_spec_set_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_labeling_service.CreateAnnotationSpecSetRequest() - assert args[0] == request_msg @@ -15363,7 +15391,6 @@ def test_get_annotation_spec_set_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_labeling_service.GetAnnotationSpecSetRequest() - assert args[0] == request_msg @@ -15386,7 +15413,6 @@ def test_list_annotation_spec_sets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_labeling_service.ListAnnotationSpecSetsRequest() - assert args[0] == request_msg @@ -15409,7 +15435,6 @@ def test_delete_annotation_spec_set_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_labeling_service.DeleteAnnotationSpecSetRequest() - assert args[0] == request_msg @@ -15432,7 +15457,6 @@ def test_create_instruction_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_labeling_service.CreateInstructionRequest() - assert args[0] == request_msg @@ -15453,7 +15477,6 @@ def test_get_instruction_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_labeling_service.GetInstructionRequest() - assert args[0] == request_msg @@ -15476,7 +15499,6 @@ def test_list_instructions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_labeling_service.ListInstructionsRequest() - assert args[0] == request_msg @@ -15499,7 +15521,6 @@ def test_delete_instruction_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_labeling_service.DeleteInstructionRequest() - assert args[0] == request_msg @@ -15520,7 +15541,6 @@ def test_get_evaluation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_labeling_service.GetEvaluationRequest() - assert args[0] == request_msg @@ -15543,7 +15563,6 @@ def test_search_evaluations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_labeling_service.SearchEvaluationsRequest() - assert args[0] == request_msg @@ -15566,7 +15585,6 @@ def test_search_example_comparisons_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_labeling_service.SearchExampleComparisonsRequest() - assert args[0] == request_msg @@ -15589,7 +15607,6 @@ def test_create_evaluation_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_labeling_service.CreateEvaluationJobRequest() - assert args[0] == request_msg @@ -15612,7 +15629,6 @@ def test_update_evaluation_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_labeling_service.UpdateEvaluationJobRequest() - assert args[0] == request_msg @@ -15635,7 +15651,6 @@ def test_get_evaluation_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_labeling_service.GetEvaluationJobRequest() - assert args[0] == request_msg @@ -15658,7 +15673,6 @@ def test_pause_evaluation_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_labeling_service.PauseEvaluationJobRequest() - assert args[0] == request_msg @@ -15681,7 +15695,6 @@ def test_resume_evaluation_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_labeling_service.ResumeEvaluationJobRequest() - assert args[0] == request_msg @@ -15704,7 +15717,6 @@ def test_delete_evaluation_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_labeling_service.DeleteEvaluationJobRequest() - assert args[0] == request_msg @@ -15727,7 +15739,6 @@ def test_list_evaluation_jobs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_labeling_service.ListEvaluationJobsRequest() - assert args[0] == request_msg @@ -15772,7 +15783,6 @@ async def test_create_dataset_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_labeling_service.CreateDatasetRequest() - assert args[0] == request_msg @@ -15803,7 +15813,6 @@ async def test_get_dataset_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_labeling_service.GetDatasetRequest() - assert args[0] == request_msg @@ -15830,7 +15839,6 @@ async def test_list_datasets_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_labeling_service.ListDatasetsRequest() - assert args[0] == request_msg @@ -15853,7 +15861,6 @@ async def test_delete_dataset_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_labeling_service.DeleteDatasetRequest() - assert args[0] == request_msg @@ -15878,7 +15885,6 @@ async def test_import_data_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_labeling_service.ImportDataRequest() - assert args[0] == request_msg @@ -15903,7 +15909,6 @@ async def test_export_data_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_labeling_service.ExportDataRequest() - assert args[0] == request_msg @@ -15930,7 +15935,6 @@ async def test_get_data_item_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_labeling_service.GetDataItemRequest() - assert args[0] == request_msg @@ -15957,7 +15961,6 @@ async def test_list_data_items_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_labeling_service.ListDataItemsRequest() - assert args[0] == request_msg @@ -15993,7 +15996,6 @@ async def test_get_annotated_dataset_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_labeling_service.GetAnnotatedDatasetRequest() - assert args[0] == request_msg @@ -16022,7 +16024,6 @@ async def test_list_annotated_datasets_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_labeling_service.ListAnnotatedDatasetsRequest() - assert args[0] == request_msg @@ -16047,7 +16048,6 @@ async def test_delete_annotated_dataset_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_labeling_service.DeleteAnnotatedDatasetRequest() - assert args[0] == request_msg @@ -16072,7 +16072,6 @@ async def test_label_image_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_labeling_service.LabelImageRequest() - assert args[0] == request_msg @@ -16097,7 +16096,6 @@ async def test_label_video_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_labeling_service.LabelVideoRequest() - assert args[0] == request_msg @@ -16122,7 +16120,6 @@ async def test_label_text_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_labeling_service.LabelTextRequest() - assert args[0] == request_msg @@ -16149,7 +16146,6 @@ async def test_get_example_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_labeling_service.GetExampleRequest() - assert args[0] == request_msg @@ -16176,7 +16172,6 @@ async def test_list_examples_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_labeling_service.ListExamplesRequest() - assert args[0] == request_msg @@ -16208,7 +16203,6 @@ async def test_create_annotation_spec_set_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_labeling_service.CreateAnnotationSpecSetRequest() - assert args[0] == request_msg @@ -16240,7 +16234,6 @@ async def test_get_annotation_spec_set_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_labeling_service.GetAnnotationSpecSetRequest() - assert args[0] == request_msg @@ -16269,7 +16262,6 @@ async def test_list_annotation_spec_sets_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_labeling_service.ListAnnotationSpecSetsRequest() - assert args[0] == request_msg @@ -16294,7 +16286,6 @@ async def test_delete_annotation_spec_set_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_labeling_service.DeleteAnnotationSpecSetRequest() - assert args[0] == request_msg @@ -16321,7 +16312,6 @@ async def test_create_instruction_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_labeling_service.CreateInstructionRequest() - assert args[0] == request_msg @@ -16352,7 +16342,6 @@ async def test_get_instruction_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_labeling_service.GetInstructionRequest() - assert args[0] == request_msg @@ -16381,7 +16370,6 @@ async def test_list_instructions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_labeling_service.ListInstructionsRequest() - assert args[0] == request_msg @@ -16406,7 +16394,6 @@ async def test_delete_instruction_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_labeling_service.DeleteInstructionRequest() - assert args[0] == request_msg @@ -16435,7 +16422,6 @@ async def test_get_evaluation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_labeling_service.GetEvaluationRequest() - assert args[0] == request_msg @@ -16464,7 +16450,6 @@ async def test_search_evaluations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_labeling_service.SearchEvaluationsRequest() - assert args[0] == request_msg @@ -16493,7 +16478,6 @@ async def test_search_example_comparisons_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_labeling_service.SearchExampleComparisonsRequest() - assert args[0] == request_msg @@ -16528,7 +16512,6 @@ async def test_create_evaluation_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_labeling_service.CreateEvaluationJobRequest() - assert args[0] == request_msg @@ -16563,7 +16546,6 @@ async def test_update_evaluation_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_labeling_service.UpdateEvaluationJobRequest() - assert args[0] == request_msg @@ -16598,7 +16580,6 @@ async def test_get_evaluation_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_labeling_service.GetEvaluationJobRequest() - assert args[0] == request_msg @@ -16623,7 +16604,6 @@ async def test_pause_evaluation_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_labeling_service.PauseEvaluationJobRequest() - assert args[0] == request_msg @@ -16648,7 +16628,6 @@ async def test_resume_evaluation_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_labeling_service.ResumeEvaluationJobRequest() - assert args[0] == request_msg @@ -16673,7 +16652,6 @@ async def test_delete_evaluation_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_labeling_service.DeleteEvaluationJobRequest() - assert args[0] == request_msg @@ -16702,7 +16680,6 @@ async def test_list_evaluation_jobs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_labeling_service.ListEvaluationJobsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dataplex/noxfile.py b/packages/google-cloud-dataplex/noxfile.py index dbbf27051eb3..861b281f03a7 100644 --- a/packages/google-cloud-dataplex/noxfile.py +++ b/packages/google-cloud-dataplex/noxfile.py @@ -47,7 +47,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-dataplex" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-dataplex/setup.py b/packages/google-cloud-dataplex/setup.py index 9e90bf1856c8..db1491be3ac3 100644 --- a/packages/google-cloud-dataplex/setup.py +++ b/packages/google-cloud-dataplex/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/google-cloud-dataplex/testing/constraints-3.10.txt b/packages/google-cloud-dataplex/testing/constraints-3.10.txt index a92801e1c8e2..b39cd54634f9 100644 --- a/packages/google-cloud-dataplex/testing/constraints-3.10.txt +++ b/packages/google-cloud-dataplex/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/google-cloud-dataplex/tests/unit/gapic/dataplex_v1/test_business_glossary_service.py b/packages/google-cloud-dataplex/tests/unit/gapic/dataplex_v1/test_business_glossary_service.py index e695d496f383..6edf7d146e89 100644 --- a/packages/google-cloud-dataplex/tests/unit/gapic/dataplex_v1/test_business_glossary_service.py +++ b/packages/google-cloud-dataplex/tests/unit/gapic/dataplex_v1/test_business_glossary_service.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 @@ -121,6 +122,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" @@ -1390,8 +1406,8 @@ def test_business_glossary_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - business_glossary.CreateGlossaryRequest, - dict, + business_glossary.CreateGlossaryRequest(), + {}, ], ) def test_create_glossary(request_type, transport: str = "grpc"): @@ -1402,7 +1418,7 @@ def test_create_glossary(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_glossary), "__call__") as call: @@ -1444,10 +1460,11 @@ def test_create_glossary_non_empty_request_with_auto_populated_field(): client.create_glossary(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == business_glossary.CreateGlossaryRequest( + request_msg = business_glossary.CreateGlossaryRequest( parent="parent_value", glossary_id="glossary_id_value", ) + assert args[0] == request_msg def test_create_glossary_use_cached_wrapped_rpc(): @@ -1538,10 +1555,14 @@ async def test_create_glossary_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_glossary_async( - transport: str = "grpc_asyncio", - request_type=business_glossary.CreateGlossaryRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + business_glossary.CreateGlossaryRequest(), + {}, + ], +) +async def test_create_glossary_async(request_type, transport: str = "grpc_asyncio"): client = BusinessGlossaryServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1549,7 +1570,7 @@ async def test_create_glossary_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_glossary), "__call__") as call: @@ -1569,11 +1590,6 @@ async def test_create_glossary_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_glossary_async_from_dict(): - await test_create_glossary_async(request_type=dict) - - def test_create_glossary_field_headers(): client = BusinessGlossaryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1740,8 +1756,8 @@ async def test_create_glossary_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - business_glossary.UpdateGlossaryRequest, - dict, + business_glossary.UpdateGlossaryRequest(), + {}, ], ) def test_update_glossary(request_type, transport: str = "grpc"): @@ -1752,7 +1768,7 @@ def test_update_glossary(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_glossary), "__call__") as call: @@ -1791,7 +1807,8 @@ def test_update_glossary_non_empty_request_with_auto_populated_field(): client.update_glossary(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == business_glossary.UpdateGlossaryRequest() + request_msg = business_glossary.UpdateGlossaryRequest() + assert args[0] == request_msg def test_update_glossary_use_cached_wrapped_rpc(): @@ -1882,10 +1899,14 @@ async def test_update_glossary_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_glossary_async( - transport: str = "grpc_asyncio", - request_type=business_glossary.UpdateGlossaryRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + business_glossary.UpdateGlossaryRequest(), + {}, + ], +) +async def test_update_glossary_async(request_type, transport: str = "grpc_asyncio"): client = BusinessGlossaryServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1893,7 +1914,7 @@ async def test_update_glossary_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_glossary), "__call__") as call: @@ -1913,11 +1934,6 @@ async def test_update_glossary_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_glossary_async_from_dict(): - await test_update_glossary_async(request_type=dict) - - def test_update_glossary_field_headers(): client = BusinessGlossaryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2074,8 +2090,8 @@ async def test_update_glossary_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - business_glossary.DeleteGlossaryRequest, - dict, + business_glossary.DeleteGlossaryRequest(), + {}, ], ) def test_delete_glossary(request_type, transport: str = "grpc"): @@ -2086,7 +2102,7 @@ def test_delete_glossary(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_glossary), "__call__") as call: @@ -2128,10 +2144,11 @@ def test_delete_glossary_non_empty_request_with_auto_populated_field(): client.delete_glossary(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == business_glossary.DeleteGlossaryRequest( + request_msg = business_glossary.DeleteGlossaryRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_glossary_use_cached_wrapped_rpc(): @@ -2222,10 +2239,14 @@ async def test_delete_glossary_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_glossary_async( - transport: str = "grpc_asyncio", - request_type=business_glossary.DeleteGlossaryRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + business_glossary.DeleteGlossaryRequest(), + {}, + ], +) +async def test_delete_glossary_async(request_type, transport: str = "grpc_asyncio"): client = BusinessGlossaryServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2233,7 +2254,7 @@ async def test_delete_glossary_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_glossary), "__call__") as call: @@ -2253,11 +2274,6 @@ async def test_delete_glossary_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_glossary_async_from_dict(): - await test_delete_glossary_async(request_type=dict) - - def test_delete_glossary_field_headers(): client = BusinessGlossaryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2404,8 +2420,8 @@ async def test_delete_glossary_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - business_glossary.GetGlossaryRequest, - dict, + business_glossary.GetGlossaryRequest(), + {}, ], ) def test_get_glossary(request_type, transport: str = "grpc"): @@ -2416,7 +2432,7 @@ def test_get_glossary(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_glossary), "__call__") as call: @@ -2472,9 +2488,10 @@ def test_get_glossary_non_empty_request_with_auto_populated_field(): client.get_glossary(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == business_glossary.GetGlossaryRequest( + request_msg = business_glossary.GetGlossaryRequest( name="name_value", ) + assert args[0] == request_msg def test_get_glossary_use_cached_wrapped_rpc(): @@ -2555,9 +2572,14 @@ async def test_get_glossary_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_glossary_async( - transport: str = "grpc_asyncio", request_type=business_glossary.GetGlossaryRequest -): +@pytest.mark.parametrize( + "request_type", + [ + business_glossary.GetGlossaryRequest(), + {}, + ], +) +async def test_get_glossary_async(request_type, transport: str = "grpc_asyncio"): client = BusinessGlossaryServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2565,7 +2587,7 @@ async def test_get_glossary_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_glossary), "__call__") as call: @@ -2600,11 +2622,6 @@ async def test_get_glossary_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_glossary_async_from_dict(): - await test_get_glossary_async(request_type=dict) - - def test_get_glossary_field_headers(): client = BusinessGlossaryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2751,8 +2768,8 @@ async def test_get_glossary_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - business_glossary.ListGlossariesRequest, - dict, + business_glossary.ListGlossariesRequest(), + {}, ], ) def test_list_glossaries(request_type, transport: str = "grpc"): @@ -2763,7 +2780,7 @@ def test_list_glossaries(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_glossaries), "__call__") as call: @@ -2812,12 +2829,13 @@ def test_list_glossaries_non_empty_request_with_auto_populated_field(): client.list_glossaries(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == business_glossary.ListGlossariesRequest( + request_msg = business_glossary.ListGlossariesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_glossaries_use_cached_wrapped_rpc(): @@ -2898,10 +2916,14 @@ async def test_list_glossaries_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_glossaries_async( - transport: str = "grpc_asyncio", - request_type=business_glossary.ListGlossariesRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + business_glossary.ListGlossariesRequest(), + {}, + ], +) +async def test_list_glossaries_async(request_type, transport: str = "grpc_asyncio"): client = BusinessGlossaryServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2909,7 +2931,7 @@ async def test_list_glossaries_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_glossaries), "__call__") as call: @@ -2934,11 +2956,6 @@ async def test_list_glossaries_async( assert response.unreachable_locations == ["unreachable_locations_value"] -@pytest.mark.asyncio -async def test_list_glossaries_async_from_dict(): - await test_list_glossaries_async(request_type=dict) - - def test_list_glossaries_field_headers(): client = BusinessGlossaryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3275,8 +3292,8 @@ async def test_list_glossaries_async_pages(): @pytest.mark.parametrize( "request_type", [ - business_glossary.CreateGlossaryCategoryRequest, - dict, + business_glossary.CreateGlossaryCategoryRequest(), + {}, ], ) def test_create_glossary_category(request_type, transport: str = "grpc"): @@ -3287,7 +3304,7 @@ def test_create_glossary_category(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3344,10 +3361,11 @@ def test_create_glossary_category_non_empty_request_with_auto_populated_field(): client.create_glossary_category(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == business_glossary.CreateGlossaryCategoryRequest( + request_msg = business_glossary.CreateGlossaryCategoryRequest( parent="parent_value", category_id="category_id_value", ) + assert args[0] == request_msg def test_create_glossary_category_use_cached_wrapped_rpc(): @@ -3433,9 +3451,15 @@ async def test_create_glossary_category_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + business_glossary.CreateGlossaryCategoryRequest(), + {}, + ], +) async def test_create_glossary_category_async( - transport: str = "grpc_asyncio", - request_type=business_glossary.CreateGlossaryCategoryRequest, + request_type, transport: str = "grpc_asyncio" ): client = BusinessGlossaryServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3444,7 +3468,7 @@ async def test_create_glossary_category_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( @@ -3477,11 +3501,6 @@ async def test_create_glossary_category_async( assert response.parent == "parent_value" -@pytest.mark.asyncio -async def test_create_glossary_category_async_from_dict(): - await test_create_glossary_category_async(request_type=dict) - - def test_create_glossary_category_field_headers(): client = BusinessGlossaryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3656,8 +3675,8 @@ async def test_create_glossary_category_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - business_glossary.UpdateGlossaryCategoryRequest, - dict, + business_glossary.UpdateGlossaryCategoryRequest(), + {}, ], ) def test_update_glossary_category(request_type, transport: str = "grpc"): @@ -3668,7 +3687,7 @@ def test_update_glossary_category(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3722,7 +3741,8 @@ def test_update_glossary_category_non_empty_request_with_auto_populated_field(): client.update_glossary_category(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == business_glossary.UpdateGlossaryCategoryRequest() + request_msg = business_glossary.UpdateGlossaryCategoryRequest() + assert args[0] == request_msg def test_update_glossary_category_use_cached_wrapped_rpc(): @@ -3808,9 +3828,15 @@ async def test_update_glossary_category_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + business_glossary.UpdateGlossaryCategoryRequest(), + {}, + ], +) async def test_update_glossary_category_async( - transport: str = "grpc_asyncio", - request_type=business_glossary.UpdateGlossaryCategoryRequest, + request_type, transport: str = "grpc_asyncio" ): client = BusinessGlossaryServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3819,7 +3845,7 @@ async def test_update_glossary_category_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( @@ -3852,11 +3878,6 @@ async def test_update_glossary_category_async( assert response.parent == "parent_value" -@pytest.mark.asyncio -async def test_update_glossary_category_async_from_dict(): - await test_update_glossary_category_async(request_type=dict) - - def test_update_glossary_category_field_headers(): client = BusinessGlossaryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4021,8 +4042,8 @@ async def test_update_glossary_category_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - business_glossary.DeleteGlossaryCategoryRequest, - dict, + business_glossary.DeleteGlossaryCategoryRequest(), + {}, ], ) def test_delete_glossary_category(request_type, transport: str = "grpc"): @@ -4033,7 +4054,7 @@ def test_delete_glossary_category(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4078,9 +4099,10 @@ def test_delete_glossary_category_non_empty_request_with_auto_populated_field(): client.delete_glossary_category(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == business_glossary.DeleteGlossaryCategoryRequest( + request_msg = business_glossary.DeleteGlossaryCategoryRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_glossary_category_use_cached_wrapped_rpc(): @@ -4166,9 +4188,15 @@ async def test_delete_glossary_category_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + business_glossary.DeleteGlossaryCategoryRequest(), + {}, + ], +) async def test_delete_glossary_category_async( - transport: str = "grpc_asyncio", - request_type=business_glossary.DeleteGlossaryCategoryRequest, + request_type, transport: str = "grpc_asyncio" ): client = BusinessGlossaryServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4177,7 +4205,7 @@ async def test_delete_glossary_category_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( @@ -4197,11 +4225,6 @@ async def test_delete_glossary_category_async( assert response is None -@pytest.mark.asyncio -async def test_delete_glossary_category_async_from_dict(): - await test_delete_glossary_category_async(request_type=dict) - - def test_delete_glossary_category_field_headers(): client = BusinessGlossaryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4352,8 +4375,8 @@ async def test_delete_glossary_category_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - business_glossary.GetGlossaryCategoryRequest, - dict, + business_glossary.GetGlossaryCategoryRequest(), + {}, ], ) def test_get_glossary_category(request_type, transport: str = "grpc"): @@ -4364,7 +4387,7 @@ def test_get_glossary_category(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4420,9 +4443,10 @@ def test_get_glossary_category_non_empty_request_with_auto_populated_field(): client.get_glossary_category(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == business_glossary.GetGlossaryCategoryRequest( + request_msg = business_glossary.GetGlossaryCategoryRequest( name="name_value", ) + assert args[0] == request_msg def test_get_glossary_category_use_cached_wrapped_rpc(): @@ -4508,9 +4532,15 @@ async def test_get_glossary_category_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + business_glossary.GetGlossaryCategoryRequest(), + {}, + ], +) async def test_get_glossary_category_async( - transport: str = "grpc_asyncio", - request_type=business_glossary.GetGlossaryCategoryRequest, + request_type, transport: str = "grpc_asyncio" ): client = BusinessGlossaryServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4519,7 +4549,7 @@ async def test_get_glossary_category_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( @@ -4552,11 +4582,6 @@ async def test_get_glossary_category_async( assert response.parent == "parent_value" -@pytest.mark.asyncio -async def test_get_glossary_category_async_from_dict(): - await test_get_glossary_category_async(request_type=dict) - - def test_get_glossary_category_field_headers(): client = BusinessGlossaryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4711,8 +4736,8 @@ async def test_get_glossary_category_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - business_glossary.ListGlossaryCategoriesRequest, - dict, + business_glossary.ListGlossaryCategoriesRequest(), + {}, ], ) def test_list_glossary_categories(request_type, transport: str = "grpc"): @@ -4723,7 +4748,7 @@ def test_list_glossary_categories(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4776,12 +4801,13 @@ def test_list_glossary_categories_non_empty_request_with_auto_populated_field(): client.list_glossary_categories(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == business_glossary.ListGlossaryCategoriesRequest( + request_msg = business_glossary.ListGlossaryCategoriesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_glossary_categories_use_cached_wrapped_rpc(): @@ -4867,9 +4893,15 @@ async def test_list_glossary_categories_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + business_glossary.ListGlossaryCategoriesRequest(), + {}, + ], +) async def test_list_glossary_categories_async( - transport: str = "grpc_asyncio", - request_type=business_glossary.ListGlossaryCategoriesRequest, + request_type, transport: str = "grpc_asyncio" ): client = BusinessGlossaryServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4878,7 +4910,7 @@ async def test_list_glossary_categories_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( @@ -4905,11 +4937,6 @@ async def test_list_glossary_categories_async( assert response.unreachable_locations == ["unreachable_locations_value"] -@pytest.mark.asyncio -async def test_list_glossary_categories_async_from_dict(): - await test_list_glossary_categories_async(request_type=dict) - - def test_list_glossary_categories_field_headers(): client = BusinessGlossaryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5264,8 +5291,8 @@ async def test_list_glossary_categories_async_pages(): @pytest.mark.parametrize( "request_type", [ - business_glossary.CreateGlossaryTermRequest, - dict, + business_glossary.CreateGlossaryTermRequest(), + {}, ], ) def test_create_glossary_term(request_type, transport: str = "grpc"): @@ -5276,7 +5303,7 @@ def test_create_glossary_term(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5333,10 +5360,11 @@ def test_create_glossary_term_non_empty_request_with_auto_populated_field(): client.create_glossary_term(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == business_glossary.CreateGlossaryTermRequest( + request_msg = business_glossary.CreateGlossaryTermRequest( parent="parent_value", term_id="term_id_value", ) + assert args[0] == request_msg def test_create_glossary_term_use_cached_wrapped_rpc(): @@ -5421,9 +5449,15 @@ async def test_create_glossary_term_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + business_glossary.CreateGlossaryTermRequest(), + {}, + ], +) async def test_create_glossary_term_async( - transport: str = "grpc_asyncio", - request_type=business_glossary.CreateGlossaryTermRequest, + request_type, transport: str = "grpc_asyncio" ): client = BusinessGlossaryServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5432,7 +5466,7 @@ async def test_create_glossary_term_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( @@ -5465,11 +5499,6 @@ async def test_create_glossary_term_async( assert response.parent == "parent_value" -@pytest.mark.asyncio -async def test_create_glossary_term_async_from_dict(): - await test_create_glossary_term_async(request_type=dict) - - def test_create_glossary_term_field_headers(): client = BusinessGlossaryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5644,8 +5673,8 @@ async def test_create_glossary_term_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - business_glossary.UpdateGlossaryTermRequest, - dict, + business_glossary.UpdateGlossaryTermRequest(), + {}, ], ) def test_update_glossary_term(request_type, transport: str = "grpc"): @@ -5656,7 +5685,7 @@ def test_update_glossary_term(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5710,7 +5739,8 @@ def test_update_glossary_term_non_empty_request_with_auto_populated_field(): client.update_glossary_term(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == business_glossary.UpdateGlossaryTermRequest() + request_msg = business_glossary.UpdateGlossaryTermRequest() + assert args[0] == request_msg def test_update_glossary_term_use_cached_wrapped_rpc(): @@ -5795,9 +5825,15 @@ async def test_update_glossary_term_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + business_glossary.UpdateGlossaryTermRequest(), + {}, + ], +) async def test_update_glossary_term_async( - transport: str = "grpc_asyncio", - request_type=business_glossary.UpdateGlossaryTermRequest, + request_type, transport: str = "grpc_asyncio" ): client = BusinessGlossaryServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5806,7 +5842,7 @@ async def test_update_glossary_term_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( @@ -5839,11 +5875,6 @@ async def test_update_glossary_term_async( assert response.parent == "parent_value" -@pytest.mark.asyncio -async def test_update_glossary_term_async_from_dict(): - await test_update_glossary_term_async(request_type=dict) - - def test_update_glossary_term_field_headers(): client = BusinessGlossaryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6008,8 +6039,8 @@ async def test_update_glossary_term_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - business_glossary.DeleteGlossaryTermRequest, - dict, + business_glossary.DeleteGlossaryTermRequest(), + {}, ], ) def test_delete_glossary_term(request_type, transport: str = "grpc"): @@ -6020,7 +6051,7 @@ def test_delete_glossary_term(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6065,9 +6096,10 @@ def test_delete_glossary_term_non_empty_request_with_auto_populated_field(): client.delete_glossary_term(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == business_glossary.DeleteGlossaryTermRequest( + request_msg = business_glossary.DeleteGlossaryTermRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_glossary_term_use_cached_wrapped_rpc(): @@ -6152,9 +6184,15 @@ async def test_delete_glossary_term_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + business_glossary.DeleteGlossaryTermRequest(), + {}, + ], +) async def test_delete_glossary_term_async( - transport: str = "grpc_asyncio", - request_type=business_glossary.DeleteGlossaryTermRequest, + request_type, transport: str = "grpc_asyncio" ): client = BusinessGlossaryServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -6163,7 +6201,7 @@ async def test_delete_glossary_term_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( @@ -6183,11 +6221,6 @@ async def test_delete_glossary_term_async( assert response is None -@pytest.mark.asyncio -async def test_delete_glossary_term_async_from_dict(): - await test_delete_glossary_term_async(request_type=dict) - - def test_delete_glossary_term_field_headers(): client = BusinessGlossaryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6338,8 +6371,8 @@ async def test_delete_glossary_term_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - business_glossary.GetGlossaryTermRequest, - dict, + business_glossary.GetGlossaryTermRequest(), + {}, ], ) def test_get_glossary_term(request_type, transport: str = "grpc"): @@ -6350,7 +6383,7 @@ def test_get_glossary_term(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6406,9 +6439,10 @@ def test_get_glossary_term_non_empty_request_with_auto_populated_field(): client.get_glossary_term(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == business_glossary.GetGlossaryTermRequest( + request_msg = business_glossary.GetGlossaryTermRequest( name="name_value", ) + assert args[0] == request_msg def test_get_glossary_term_use_cached_wrapped_rpc(): @@ -6491,10 +6525,14 @@ async def test_get_glossary_term_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_glossary_term_async( - transport: str = "grpc_asyncio", - request_type=business_glossary.GetGlossaryTermRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + business_glossary.GetGlossaryTermRequest(), + {}, + ], +) +async def test_get_glossary_term_async(request_type, transport: str = "grpc_asyncio"): client = BusinessGlossaryServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6502,7 +6540,7 @@ async def test_get_glossary_term_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( @@ -6535,11 +6573,6 @@ async def test_get_glossary_term_async( assert response.parent == "parent_value" -@pytest.mark.asyncio -async def test_get_glossary_term_async_from_dict(): - await test_get_glossary_term_async(request_type=dict) - - def test_get_glossary_term_field_headers(): client = BusinessGlossaryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6694,8 +6727,8 @@ async def test_get_glossary_term_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - business_glossary.ListGlossaryTermsRequest, - dict, + business_glossary.ListGlossaryTermsRequest(), + {}, ], ) def test_list_glossary_terms(request_type, transport: str = "grpc"): @@ -6706,7 +6739,7 @@ def test_list_glossary_terms(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6759,12 +6792,13 @@ def test_list_glossary_terms_non_empty_request_with_auto_populated_field(): client.list_glossary_terms(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == business_glossary.ListGlossaryTermsRequest( + request_msg = business_glossary.ListGlossaryTermsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_glossary_terms_use_cached_wrapped_rpc(): @@ -6849,10 +6883,14 @@ async def test_list_glossary_terms_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_glossary_terms_async( - transport: str = "grpc_asyncio", - request_type=business_glossary.ListGlossaryTermsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + business_glossary.ListGlossaryTermsRequest(), + {}, + ], +) +async def test_list_glossary_terms_async(request_type, transport: str = "grpc_asyncio"): client = BusinessGlossaryServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6860,7 +6898,7 @@ async def test_list_glossary_terms_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( @@ -6887,11 +6925,6 @@ async def test_list_glossary_terms_async( assert response.unreachable_locations == ["unreachable_locations_value"] -@pytest.mark.asyncio -async def test_list_glossary_terms_async_from_dict(): - await test_list_glossary_terms_async(request_type=dict) - - def test_list_glossary_terms_field_headers(): client = BusinessGlossaryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10478,7 +10511,6 @@ def test_create_glossary_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = business_glossary.CreateGlossaryRequest() - assert args[0] == request_msg @@ -10499,7 +10531,6 @@ def test_update_glossary_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = business_glossary.UpdateGlossaryRequest() - assert args[0] == request_msg @@ -10520,7 +10551,6 @@ def test_delete_glossary_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = business_glossary.DeleteGlossaryRequest() - assert args[0] == request_msg @@ -10541,7 +10571,6 @@ def test_get_glossary_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = business_glossary.GetGlossaryRequest() - assert args[0] == request_msg @@ -10562,7 +10591,6 @@ def test_list_glossaries_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = business_glossary.ListGlossariesRequest() - assert args[0] == request_msg @@ -10585,7 +10613,6 @@ def test_create_glossary_category_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = business_glossary.CreateGlossaryCategoryRequest() - assert args[0] == request_msg @@ -10608,7 +10635,6 @@ def test_update_glossary_category_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = business_glossary.UpdateGlossaryCategoryRequest() - assert args[0] == request_msg @@ -10631,7 +10657,6 @@ def test_delete_glossary_category_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = business_glossary.DeleteGlossaryCategoryRequest() - assert args[0] == request_msg @@ -10654,7 +10679,6 @@ def test_get_glossary_category_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = business_glossary.GetGlossaryCategoryRequest() - assert args[0] == request_msg @@ -10677,7 +10701,6 @@ def test_list_glossary_categories_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = business_glossary.ListGlossaryCategoriesRequest() - assert args[0] == request_msg @@ -10700,7 +10723,6 @@ def test_create_glossary_term_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = business_glossary.CreateGlossaryTermRequest() - assert args[0] == request_msg @@ -10723,7 +10745,6 @@ def test_update_glossary_term_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = business_glossary.UpdateGlossaryTermRequest() - assert args[0] == request_msg @@ -10746,7 +10767,6 @@ def test_delete_glossary_term_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = business_glossary.DeleteGlossaryTermRequest() - assert args[0] == request_msg @@ -10769,7 +10789,6 @@ def test_get_glossary_term_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = business_glossary.GetGlossaryTermRequest() - assert args[0] == request_msg @@ -10792,7 +10811,6 @@ def test_list_glossary_terms_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = business_glossary.ListGlossaryTermsRequest() - assert args[0] == request_msg @@ -10831,7 +10849,6 @@ async def test_create_glossary_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = business_glossary.CreateGlossaryRequest() - assert args[0] == request_msg @@ -10856,7 +10873,6 @@ async def test_update_glossary_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = business_glossary.UpdateGlossaryRequest() - assert args[0] == request_msg @@ -10881,7 +10897,6 @@ async def test_delete_glossary_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = business_glossary.DeleteGlossaryRequest() - assert args[0] == request_msg @@ -10914,7 +10929,6 @@ async def test_get_glossary_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = business_glossary.GetGlossaryRequest() - assert args[0] == request_msg @@ -10942,7 +10956,6 @@ async def test_list_glossaries_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = business_glossary.ListGlossariesRequest() - assert args[0] == request_msg @@ -10975,7 +10988,6 @@ async def test_create_glossary_category_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = business_glossary.CreateGlossaryCategoryRequest() - assert args[0] == request_msg @@ -11008,7 +11020,6 @@ async def test_update_glossary_category_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = business_glossary.UpdateGlossaryCategoryRequest() - assert args[0] == request_msg @@ -11033,7 +11044,6 @@ async def test_delete_glossary_category_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = business_glossary.DeleteGlossaryCategoryRequest() - assert args[0] == request_msg @@ -11066,7 +11076,6 @@ async def test_get_glossary_category_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = business_glossary.GetGlossaryCategoryRequest() - assert args[0] == request_msg @@ -11096,7 +11105,6 @@ async def test_list_glossary_categories_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = business_glossary.ListGlossaryCategoriesRequest() - assert args[0] == request_msg @@ -11129,7 +11137,6 @@ async def test_create_glossary_term_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = business_glossary.CreateGlossaryTermRequest() - assert args[0] == request_msg @@ -11162,7 +11169,6 @@ async def test_update_glossary_term_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = business_glossary.UpdateGlossaryTermRequest() - assert args[0] == request_msg @@ -11187,7 +11193,6 @@ async def test_delete_glossary_term_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = business_glossary.DeleteGlossaryTermRequest() - assert args[0] == request_msg @@ -11220,7 +11225,6 @@ async def test_get_glossary_term_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = business_glossary.GetGlossaryTermRequest() - assert args[0] == request_msg @@ -11250,7 +11254,6 @@ async def test_list_glossary_terms_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = business_glossary.ListGlossaryTermsRequest() - assert args[0] == request_msg @@ -14365,7 +14368,6 @@ def test_create_glossary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = business_glossary.CreateGlossaryRequest() - assert args[0] == request_msg @@ -14385,7 +14387,6 @@ def test_update_glossary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = business_glossary.UpdateGlossaryRequest() - assert args[0] == request_msg @@ -14405,7 +14406,6 @@ def test_delete_glossary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = business_glossary.DeleteGlossaryRequest() - assert args[0] == request_msg @@ -14425,7 +14425,6 @@ def test_get_glossary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = business_glossary.GetGlossaryRequest() - assert args[0] == request_msg @@ -14445,7 +14444,6 @@ def test_list_glossaries_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = business_glossary.ListGlossariesRequest() - assert args[0] == request_msg @@ -14467,7 +14465,6 @@ def test_create_glossary_category_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = business_glossary.CreateGlossaryCategoryRequest() - assert args[0] == request_msg @@ -14489,7 +14486,6 @@ def test_update_glossary_category_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = business_glossary.UpdateGlossaryCategoryRequest() - assert args[0] == request_msg @@ -14511,7 +14507,6 @@ def test_delete_glossary_category_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = business_glossary.DeleteGlossaryCategoryRequest() - assert args[0] == request_msg @@ -14533,7 +14528,6 @@ def test_get_glossary_category_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = business_glossary.GetGlossaryCategoryRequest() - assert args[0] == request_msg @@ -14555,7 +14549,6 @@ def test_list_glossary_categories_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = business_glossary.ListGlossaryCategoriesRequest() - assert args[0] == request_msg @@ -14577,7 +14570,6 @@ def test_create_glossary_term_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = business_glossary.CreateGlossaryTermRequest() - assert args[0] == request_msg @@ -14599,7 +14591,6 @@ def test_update_glossary_term_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = business_glossary.UpdateGlossaryTermRequest() - assert args[0] == request_msg @@ -14621,7 +14612,6 @@ def test_delete_glossary_term_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = business_glossary.DeleteGlossaryTermRequest() - assert args[0] == request_msg @@ -14643,7 +14633,6 @@ def test_get_glossary_term_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = business_glossary.GetGlossaryTermRequest() - assert args[0] == request_msg @@ -14665,7 +14654,6 @@ def test_list_glossary_terms_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = business_glossary.ListGlossaryTermsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dataplex/tests/unit/gapic/dataplex_v1/test_catalog_service.py b/packages/google-cloud-dataplex/tests/unit/gapic/dataplex_v1/test_catalog_service.py index 2440e8135af1..1bf2e8835b44 100644 --- a/packages/google-cloud-dataplex/tests/unit/gapic/dataplex_v1/test_catalog_service.py +++ b/packages/google-cloud-dataplex/tests/unit/gapic/dataplex_v1/test_catalog_service.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 @@ -122,6 +123,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" @@ -1330,8 +1346,8 @@ def test_catalog_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - catalog.CreateEntryTypeRequest, - dict, + catalog.CreateEntryTypeRequest(), + {}, ], ) def test_create_entry_type(request_type, transport: str = "grpc"): @@ -1342,7 +1358,7 @@ def test_create_entry_type(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1388,10 +1404,11 @@ def test_create_entry_type_non_empty_request_with_auto_populated_field(): client.create_entry_type(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog.CreateEntryTypeRequest( + request_msg = catalog.CreateEntryTypeRequest( parent="parent_value", entry_type_id="entry_type_id_value", ) + assert args[0] == request_msg def test_create_entry_type_use_cached_wrapped_rpc(): @@ -1484,9 +1501,14 @@ async def test_create_entry_type_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_entry_type_async( - transport: str = "grpc_asyncio", request_type=catalog.CreateEntryTypeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + catalog.CreateEntryTypeRequest(), + {}, + ], +) +async def test_create_entry_type_async(request_type, transport: str = "grpc_asyncio"): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1494,7 +1516,7 @@ async def test_create_entry_type_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( @@ -1516,11 +1538,6 @@ async def test_create_entry_type_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_entry_type_async_from_dict(): - await test_create_entry_type_async(request_type=dict) - - def test_create_entry_type_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1695,8 +1712,8 @@ async def test_create_entry_type_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - catalog.UpdateEntryTypeRequest, - dict, + catalog.UpdateEntryTypeRequest(), + {}, ], ) def test_update_entry_type(request_type, transport: str = "grpc"): @@ -1707,7 +1724,7 @@ def test_update_entry_type(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1750,7 +1767,8 @@ def test_update_entry_type_non_empty_request_with_auto_populated_field(): client.update_entry_type(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog.UpdateEntryTypeRequest() + request_msg = catalog.UpdateEntryTypeRequest() + assert args[0] == request_msg def test_update_entry_type_use_cached_wrapped_rpc(): @@ -1843,9 +1861,14 @@ async def test_update_entry_type_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_entry_type_async( - transport: str = "grpc_asyncio", request_type=catalog.UpdateEntryTypeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + catalog.UpdateEntryTypeRequest(), + {}, + ], +) +async def test_update_entry_type_async(request_type, transport: str = "grpc_asyncio"): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1853,7 +1876,7 @@ async def test_update_entry_type_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( @@ -1875,11 +1898,6 @@ async def test_update_entry_type_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_entry_type_async_from_dict(): - await test_update_entry_type_async(request_type=dict) - - def test_update_entry_type_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2044,8 +2062,8 @@ async def test_update_entry_type_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - catalog.DeleteEntryTypeRequest, - dict, + catalog.DeleteEntryTypeRequest(), + {}, ], ) def test_delete_entry_type(request_type, transport: str = "grpc"): @@ -2056,7 +2074,7 @@ def test_delete_entry_type(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2102,10 +2120,11 @@ def test_delete_entry_type_non_empty_request_with_auto_populated_field(): client.delete_entry_type(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog.DeleteEntryTypeRequest( + request_msg = catalog.DeleteEntryTypeRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_entry_type_use_cached_wrapped_rpc(): @@ -2198,9 +2217,14 @@ async def test_delete_entry_type_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_entry_type_async( - transport: str = "grpc_asyncio", request_type=catalog.DeleteEntryTypeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + catalog.DeleteEntryTypeRequest(), + {}, + ], +) +async def test_delete_entry_type_async(request_type, transport: str = "grpc_asyncio"): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2208,7 +2232,7 @@ async def test_delete_entry_type_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( @@ -2230,11 +2254,6 @@ async def test_delete_entry_type_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_entry_type_async_from_dict(): - await test_delete_entry_type_async(request_type=dict) - - def test_delete_entry_type_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2389,8 +2408,8 @@ async def test_delete_entry_type_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - catalog.ListEntryTypesRequest, - dict, + catalog.ListEntryTypesRequest(), + {}, ], ) def test_list_entry_types(request_type, transport: str = "grpc"): @@ -2401,7 +2420,7 @@ def test_list_entry_types(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_entry_types), "__call__") as call: @@ -2450,12 +2469,13 @@ def test_list_entry_types_non_empty_request_with_auto_populated_field(): client.list_entry_types(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog.ListEntryTypesRequest( + request_msg = catalog.ListEntryTypesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_entry_types_use_cached_wrapped_rpc(): @@ -2538,9 +2558,14 @@ async def test_list_entry_types_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_entry_types_async( - transport: str = "grpc_asyncio", request_type=catalog.ListEntryTypesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + catalog.ListEntryTypesRequest(), + {}, + ], +) +async def test_list_entry_types_async(request_type, transport: str = "grpc_asyncio"): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2548,7 +2573,7 @@ async def test_list_entry_types_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_entry_types), "__call__") as call: @@ -2573,11 +2598,6 @@ async def test_list_entry_types_async( assert response.unreachable_locations == ["unreachable_locations_value"] -@pytest.mark.asyncio -async def test_list_entry_types_async_from_dict(): - await test_list_entry_types_async(request_type=dict) - - def test_list_entry_types_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2914,8 +2934,8 @@ async def test_list_entry_types_async_pages(): @pytest.mark.parametrize( "request_type", [ - catalog.GetEntryTypeRequest, - dict, + catalog.GetEntryTypeRequest(), + {}, ], ) def test_get_entry_type(request_type, transport: str = "grpc"): @@ -2926,7 +2946,7 @@ def test_get_entry_type(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_entry_type), "__call__") as call: @@ -2984,9 +3004,10 @@ def test_get_entry_type_non_empty_request_with_auto_populated_field(): client.get_entry_type(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog.GetEntryTypeRequest( + request_msg = catalog.GetEntryTypeRequest( name="name_value", ) + assert args[0] == request_msg def test_get_entry_type_use_cached_wrapped_rpc(): @@ -3067,9 +3088,14 @@ async def test_get_entry_type_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_entry_type_async( - transport: str = "grpc_asyncio", request_type=catalog.GetEntryTypeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + catalog.GetEntryTypeRequest(), + {}, + ], +) +async def test_get_entry_type_async(request_type, transport: str = "grpc_asyncio"): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3077,7 +3103,7 @@ async def test_get_entry_type_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_entry_type), "__call__") as call: @@ -3114,11 +3140,6 @@ async def test_get_entry_type_async( assert response.system == "system_value" -@pytest.mark.asyncio -async def test_get_entry_type_async_from_dict(): - await test_get_entry_type_async(request_type=dict) - - def test_get_entry_type_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3261,8 +3282,8 @@ async def test_get_entry_type_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - catalog.CreateAspectTypeRequest, - dict, + catalog.CreateAspectTypeRequest(), + {}, ], ) def test_create_aspect_type(request_type, transport: str = "grpc"): @@ -3273,7 +3294,7 @@ def test_create_aspect_type(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3319,10 +3340,11 @@ def test_create_aspect_type_non_empty_request_with_auto_populated_field(): client.create_aspect_type(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog.CreateAspectTypeRequest( + request_msg = catalog.CreateAspectTypeRequest( parent="parent_value", aspect_type_id="aspect_type_id_value", ) + assert args[0] == request_msg def test_create_aspect_type_use_cached_wrapped_rpc(): @@ -3417,9 +3439,14 @@ async def test_create_aspect_type_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_aspect_type_async( - transport: str = "grpc_asyncio", request_type=catalog.CreateAspectTypeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + catalog.CreateAspectTypeRequest(), + {}, + ], +) +async def test_create_aspect_type_async(request_type, transport: str = "grpc_asyncio"): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3427,7 +3454,7 @@ async def test_create_aspect_type_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( @@ -3449,11 +3476,6 @@ async def test_create_aspect_type_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_aspect_type_async_from_dict(): - await test_create_aspect_type_async(request_type=dict) - - def test_create_aspect_type_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3628,8 +3650,8 @@ async def test_create_aspect_type_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - catalog.UpdateAspectTypeRequest, - dict, + catalog.UpdateAspectTypeRequest(), + {}, ], ) def test_update_aspect_type(request_type, transport: str = "grpc"): @@ -3640,7 +3662,7 @@ def test_update_aspect_type(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3683,7 +3705,8 @@ def test_update_aspect_type_non_empty_request_with_auto_populated_field(): client.update_aspect_type(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog.UpdateAspectTypeRequest() + request_msg = catalog.UpdateAspectTypeRequest() + assert args[0] == request_msg def test_update_aspect_type_use_cached_wrapped_rpc(): @@ -3778,9 +3801,14 @@ async def test_update_aspect_type_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_aspect_type_async( - transport: str = "grpc_asyncio", request_type=catalog.UpdateAspectTypeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + catalog.UpdateAspectTypeRequest(), + {}, + ], +) +async def test_update_aspect_type_async(request_type, transport: str = "grpc_asyncio"): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3788,7 +3816,7 @@ async def test_update_aspect_type_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( @@ -3810,11 +3838,6 @@ async def test_update_aspect_type_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_aspect_type_async_from_dict(): - await test_update_aspect_type_async(request_type=dict) - - def test_update_aspect_type_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3979,8 +4002,8 @@ async def test_update_aspect_type_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - catalog.DeleteAspectTypeRequest, - dict, + catalog.DeleteAspectTypeRequest(), + {}, ], ) def test_delete_aspect_type(request_type, transport: str = "grpc"): @@ -3991,7 +4014,7 @@ def test_delete_aspect_type(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4037,10 +4060,11 @@ def test_delete_aspect_type_non_empty_request_with_auto_populated_field(): client.delete_aspect_type(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog.DeleteAspectTypeRequest( + request_msg = catalog.DeleteAspectTypeRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_aspect_type_use_cached_wrapped_rpc(): @@ -4135,9 +4159,14 @@ async def test_delete_aspect_type_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_aspect_type_async( - transport: str = "grpc_asyncio", request_type=catalog.DeleteAspectTypeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + catalog.DeleteAspectTypeRequest(), + {}, + ], +) +async def test_delete_aspect_type_async(request_type, transport: str = "grpc_asyncio"): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4145,7 +4174,7 @@ async def test_delete_aspect_type_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( @@ -4167,11 +4196,6 @@ async def test_delete_aspect_type_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_aspect_type_async_from_dict(): - await test_delete_aspect_type_async(request_type=dict) - - def test_delete_aspect_type_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4326,8 +4350,8 @@ async def test_delete_aspect_type_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - catalog.ListAspectTypesRequest, - dict, + catalog.ListAspectTypesRequest(), + {}, ], ) def test_list_aspect_types(request_type, transport: str = "grpc"): @@ -4338,7 +4362,7 @@ def test_list_aspect_types(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4391,12 +4415,13 @@ def test_list_aspect_types_non_empty_request_with_auto_populated_field(): client.list_aspect_types(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog.ListAspectTypesRequest( + request_msg = catalog.ListAspectTypesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_aspect_types_use_cached_wrapped_rpc(): @@ -4479,9 +4504,14 @@ async def test_list_aspect_types_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_aspect_types_async( - transport: str = "grpc_asyncio", request_type=catalog.ListAspectTypesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + catalog.ListAspectTypesRequest(), + {}, + ], +) +async def test_list_aspect_types_async(request_type, transport: str = "grpc_asyncio"): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4489,7 +4519,7 @@ async def test_list_aspect_types_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( @@ -4516,11 +4546,6 @@ async def test_list_aspect_types_async( assert response.unreachable_locations == ["unreachable_locations_value"] -@pytest.mark.asyncio -async def test_list_aspect_types_async_from_dict(): - await test_list_aspect_types_async(request_type=dict) - - def test_list_aspect_types_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4873,8 +4898,8 @@ async def test_list_aspect_types_async_pages(): @pytest.mark.parametrize( "request_type", [ - catalog.GetAspectTypeRequest, - dict, + catalog.GetAspectTypeRequest(), + {}, ], ) def test_get_aspect_type(request_type, transport: str = "grpc"): @@ -4885,7 +4910,7 @@ def test_get_aspect_type(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_aspect_type), "__call__") as call: @@ -4944,9 +4969,10 @@ def test_get_aspect_type_non_empty_request_with_auto_populated_field(): client.get_aspect_type(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog.GetAspectTypeRequest( + request_msg = catalog.GetAspectTypeRequest( name="name_value", ) + assert args[0] == request_msg def test_get_aspect_type_use_cached_wrapped_rpc(): @@ -5027,9 +5053,14 @@ async def test_get_aspect_type_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_aspect_type_async( - transport: str = "grpc_asyncio", request_type=catalog.GetAspectTypeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + catalog.GetAspectTypeRequest(), + {}, + ], +) +async def test_get_aspect_type_async(request_type, transport: str = "grpc_asyncio"): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5037,7 +5068,7 @@ async def test_get_aspect_type_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_aspect_type), "__call__") as call: @@ -5075,11 +5106,6 @@ async def test_get_aspect_type_async( assert response.transfer_status == catalog.TransferStatus.TRANSFER_STATUS_MIGRATED -@pytest.mark.asyncio -async def test_get_aspect_type_async_from_dict(): - await test_get_aspect_type_async(request_type=dict) - - def test_get_aspect_type_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5222,8 +5248,8 @@ async def test_get_aspect_type_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - catalog.CreateEntryGroupRequest, - dict, + catalog.CreateEntryGroupRequest(), + {}, ], ) def test_create_entry_group(request_type, transport: str = "grpc"): @@ -5234,7 +5260,7 @@ def test_create_entry_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5280,10 +5306,11 @@ def test_create_entry_group_non_empty_request_with_auto_populated_field(): client.create_entry_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog.CreateEntryGroupRequest( + request_msg = catalog.CreateEntryGroupRequest( parent="parent_value", entry_group_id="entry_group_id_value", ) + assert args[0] == request_msg def test_create_entry_group_use_cached_wrapped_rpc(): @@ -5378,9 +5405,14 @@ async def test_create_entry_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_entry_group_async( - transport: str = "grpc_asyncio", request_type=catalog.CreateEntryGroupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + catalog.CreateEntryGroupRequest(), + {}, + ], +) +async def test_create_entry_group_async(request_type, transport: str = "grpc_asyncio"): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5388,7 +5420,7 @@ async def test_create_entry_group_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( @@ -5410,11 +5442,6 @@ async def test_create_entry_group_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_entry_group_async_from_dict(): - await test_create_entry_group_async(request_type=dict) - - def test_create_entry_group_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5589,8 +5616,8 @@ async def test_create_entry_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - catalog.UpdateEntryGroupRequest, - dict, + catalog.UpdateEntryGroupRequest(), + {}, ], ) def test_update_entry_group(request_type, transport: str = "grpc"): @@ -5601,7 +5628,7 @@ def test_update_entry_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5644,7 +5671,8 @@ def test_update_entry_group_non_empty_request_with_auto_populated_field(): client.update_entry_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog.UpdateEntryGroupRequest() + request_msg = catalog.UpdateEntryGroupRequest() + assert args[0] == request_msg def test_update_entry_group_use_cached_wrapped_rpc(): @@ -5739,9 +5767,14 @@ async def test_update_entry_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_entry_group_async( - transport: str = "grpc_asyncio", request_type=catalog.UpdateEntryGroupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + catalog.UpdateEntryGroupRequest(), + {}, + ], +) +async def test_update_entry_group_async(request_type, transport: str = "grpc_asyncio"): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5749,7 +5782,7 @@ async def test_update_entry_group_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( @@ -5771,11 +5804,6 @@ async def test_update_entry_group_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_entry_group_async_from_dict(): - await test_update_entry_group_async(request_type=dict) - - def test_update_entry_group_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5940,8 +5968,8 @@ async def test_update_entry_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - catalog.DeleteEntryGroupRequest, - dict, + catalog.DeleteEntryGroupRequest(), + {}, ], ) def test_delete_entry_group(request_type, transport: str = "grpc"): @@ -5952,7 +5980,7 @@ def test_delete_entry_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5998,10 +6026,11 @@ def test_delete_entry_group_non_empty_request_with_auto_populated_field(): client.delete_entry_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog.DeleteEntryGroupRequest( + request_msg = catalog.DeleteEntryGroupRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_entry_group_use_cached_wrapped_rpc(): @@ -6096,9 +6125,14 @@ async def test_delete_entry_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_entry_group_async( - transport: str = "grpc_asyncio", request_type=catalog.DeleteEntryGroupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + catalog.DeleteEntryGroupRequest(), + {}, + ], +) +async def test_delete_entry_group_async(request_type, transport: str = "grpc_asyncio"): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6106,7 +6140,7 @@ async def test_delete_entry_group_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( @@ -6128,11 +6162,6 @@ async def test_delete_entry_group_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_entry_group_async_from_dict(): - await test_delete_entry_group_async(request_type=dict) - - def test_delete_entry_group_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6287,8 +6316,8 @@ async def test_delete_entry_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - catalog.ListEntryGroupsRequest, - dict, + catalog.ListEntryGroupsRequest(), + {}, ], ) def test_list_entry_groups(request_type, transport: str = "grpc"): @@ -6299,7 +6328,7 @@ def test_list_entry_groups(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6352,12 +6381,13 @@ def test_list_entry_groups_non_empty_request_with_auto_populated_field(): client.list_entry_groups(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog.ListEntryGroupsRequest( + request_msg = catalog.ListEntryGroupsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_entry_groups_use_cached_wrapped_rpc(): @@ -6440,9 +6470,14 @@ async def test_list_entry_groups_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_entry_groups_async( - transport: str = "grpc_asyncio", request_type=catalog.ListEntryGroupsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + catalog.ListEntryGroupsRequest(), + {}, + ], +) +async def test_list_entry_groups_async(request_type, transport: str = "grpc_asyncio"): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6450,7 +6485,7 @@ async def test_list_entry_groups_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( @@ -6477,11 +6512,6 @@ async def test_list_entry_groups_async( assert response.unreachable_locations == ["unreachable_locations_value"] -@pytest.mark.asyncio -async def test_list_entry_groups_async_from_dict(): - await test_list_entry_groups_async(request_type=dict) - - def test_list_entry_groups_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6834,8 +6864,8 @@ async def test_list_entry_groups_async_pages(): @pytest.mark.parametrize( "request_type", [ - catalog.GetEntryGroupRequest, - dict, + catalog.GetEntryGroupRequest(), + {}, ], ) def test_get_entry_group(request_type, transport: str = "grpc"): @@ -6846,7 +6876,7 @@ def test_get_entry_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_entry_group), "__call__") as call: @@ -6900,9 +6930,10 @@ def test_get_entry_group_non_empty_request_with_auto_populated_field(): client.get_entry_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog.GetEntryGroupRequest( + request_msg = catalog.GetEntryGroupRequest( name="name_value", ) + assert args[0] == request_msg def test_get_entry_group_use_cached_wrapped_rpc(): @@ -6983,9 +7014,14 @@ async def test_get_entry_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_entry_group_async( - transport: str = "grpc_asyncio", request_type=catalog.GetEntryGroupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + catalog.GetEntryGroupRequest(), + {}, + ], +) +async def test_get_entry_group_async(request_type, transport: str = "grpc_asyncio"): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6993,7 +7029,7 @@ async def test_get_entry_group_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_entry_group), "__call__") as call: @@ -7026,11 +7062,6 @@ async def test_get_entry_group_async( assert response.transfer_status == catalog.TransferStatus.TRANSFER_STATUS_MIGRATED -@pytest.mark.asyncio -async def test_get_entry_group_async_from_dict(): - await test_get_entry_group_async(request_type=dict) - - def test_get_entry_group_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7173,8 +7204,8 @@ async def test_get_entry_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - catalog.CreateEntryRequest, - dict, + catalog.CreateEntryRequest(), + {}, ], ) def test_create_entry(request_type, transport: str = "grpc"): @@ -7185,7 +7216,7 @@ def test_create_entry(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_entry), "__call__") as call: @@ -7236,10 +7267,11 @@ def test_create_entry_non_empty_request_with_auto_populated_field(): client.create_entry(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog.CreateEntryRequest( + request_msg = catalog.CreateEntryRequest( parent="parent_value", entry_id="entry_id_value", ) + assert args[0] == request_msg def test_create_entry_use_cached_wrapped_rpc(): @@ -7320,9 +7352,14 @@ async def test_create_entry_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_entry_async( - transport: str = "grpc_asyncio", request_type=catalog.CreateEntryRequest -): +@pytest.mark.parametrize( + "request_type", + [ + catalog.CreateEntryRequest(), + {}, + ], +) +async def test_create_entry_async(request_type, transport: str = "grpc_asyncio"): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7330,7 +7367,7 @@ async def test_create_entry_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_entry), "__call__") as call: @@ -7359,11 +7396,6 @@ async def test_create_entry_async( assert response.fully_qualified_name == "fully_qualified_name_value" -@pytest.mark.asyncio -async def test_create_entry_async_from_dict(): - await test_create_entry_async(request_type=dict) - - def test_create_entry_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7526,8 +7558,8 @@ async def test_create_entry_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - catalog.UpdateEntryRequest, - dict, + catalog.UpdateEntryRequest(), + {}, ], ) def test_update_entry(request_type, transport: str = "grpc"): @@ -7538,7 +7570,7 @@ def test_update_entry(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_entry), "__call__") as call: @@ -7586,7 +7618,8 @@ def test_update_entry_non_empty_request_with_auto_populated_field(): client.update_entry(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog.UpdateEntryRequest() + request_msg = catalog.UpdateEntryRequest() + assert args[0] == request_msg def test_update_entry_use_cached_wrapped_rpc(): @@ -7667,9 +7700,14 @@ async def test_update_entry_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_entry_async( - transport: str = "grpc_asyncio", request_type=catalog.UpdateEntryRequest -): +@pytest.mark.parametrize( + "request_type", + [ + catalog.UpdateEntryRequest(), + {}, + ], +) +async def test_update_entry_async(request_type, transport: str = "grpc_asyncio"): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7677,7 +7715,7 @@ async def test_update_entry_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_entry), "__call__") as call: @@ -7706,11 +7744,6 @@ async def test_update_entry_async( assert response.fully_qualified_name == "fully_qualified_name_value" -@pytest.mark.asyncio -async def test_update_entry_async_from_dict(): - await test_update_entry_async(request_type=dict) - - def test_update_entry_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7863,8 +7896,8 @@ async def test_update_entry_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - catalog.DeleteEntryRequest, - dict, + catalog.DeleteEntryRequest(), + {}, ], ) def test_delete_entry(request_type, transport: str = "grpc"): @@ -7875,7 +7908,7 @@ def test_delete_entry(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_entry), "__call__") as call: @@ -7925,9 +7958,10 @@ def test_delete_entry_non_empty_request_with_auto_populated_field(): client.delete_entry(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog.DeleteEntryRequest( + request_msg = catalog.DeleteEntryRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_entry_use_cached_wrapped_rpc(): @@ -8008,9 +8042,14 @@ async def test_delete_entry_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_entry_async( - transport: str = "grpc_asyncio", request_type=catalog.DeleteEntryRequest -): +@pytest.mark.parametrize( + "request_type", + [ + catalog.DeleteEntryRequest(), + {}, + ], +) +async def test_delete_entry_async(request_type, transport: str = "grpc_asyncio"): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8018,7 +8057,7 @@ async def test_delete_entry_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_entry), "__call__") as call: @@ -8047,11 +8086,6 @@ async def test_delete_entry_async( assert response.fully_qualified_name == "fully_qualified_name_value" -@pytest.mark.asyncio -async def test_delete_entry_async_from_dict(): - await test_delete_entry_async(request_type=dict) - - def test_delete_entry_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8194,8 +8228,8 @@ async def test_delete_entry_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - catalog.ListEntriesRequest, - dict, + catalog.ListEntriesRequest(), + {}, ], ) def test_list_entries(request_type, transport: str = "grpc"): @@ -8206,7 +8240,7 @@ def test_list_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_entries), "__call__") as call: @@ -8252,11 +8286,12 @@ def test_list_entries_non_empty_request_with_auto_populated_field(): client.list_entries(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog.ListEntriesRequest( + request_msg = catalog.ListEntriesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_entries_use_cached_wrapped_rpc(): @@ -8337,9 +8372,14 @@ async def test_list_entries_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_entries_async( - transport: str = "grpc_asyncio", request_type=catalog.ListEntriesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + catalog.ListEntriesRequest(), + {}, + ], +) +async def test_list_entries_async(request_type, transport: str = "grpc_asyncio"): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8347,7 +8387,7 @@ async def test_list_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_entries), "__call__") as call: @@ -8370,11 +8410,6 @@ async def test_list_entries_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_entries_async_from_dict(): - await test_list_entries_async(request_type=dict) - - def test_list_entries_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8711,8 +8746,8 @@ async def test_list_entries_async_pages(): @pytest.mark.parametrize( "request_type", [ - catalog.GetEntryRequest, - dict, + catalog.GetEntryRequest(), + {}, ], ) def test_get_entry(request_type, transport: str = "grpc"): @@ -8723,7 +8758,7 @@ def test_get_entry(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_entry), "__call__") as call: @@ -8773,9 +8808,10 @@ def test_get_entry_non_empty_request_with_auto_populated_field(): client.get_entry(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog.GetEntryRequest( + request_msg = catalog.GetEntryRequest( name="name_value", ) + assert args[0] == request_msg def test_get_entry_use_cached_wrapped_rpc(): @@ -8854,9 +8890,14 @@ async def test_get_entry_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_entry_async( - transport: str = "grpc_asyncio", request_type=catalog.GetEntryRequest -): +@pytest.mark.parametrize( + "request_type", + [ + catalog.GetEntryRequest(), + {}, + ], +) +async def test_get_entry_async(request_type, transport: str = "grpc_asyncio"): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8864,7 +8905,7 @@ async def test_get_entry_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_entry), "__call__") as call: @@ -8893,11 +8934,6 @@ async def test_get_entry_async( assert response.fully_qualified_name == "fully_qualified_name_value" -@pytest.mark.asyncio -async def test_get_entry_async_from_dict(): - await test_get_entry_async(request_type=dict) - - def test_get_entry_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9040,8 +9076,8 @@ async def test_get_entry_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - catalog.LookupEntryRequest, - dict, + catalog.LookupEntryRequest(), + {}, ], ) def test_lookup_entry(request_type, transport: str = "grpc"): @@ -9052,7 +9088,7 @@ def test_lookup_entry(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.lookup_entry), "__call__") as call: @@ -9103,10 +9139,11 @@ def test_lookup_entry_non_empty_request_with_auto_populated_field(): client.lookup_entry(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog.LookupEntryRequest( + request_msg = catalog.LookupEntryRequest( name="name_value", entry="entry_value", ) + assert args[0] == request_msg def test_lookup_entry_use_cached_wrapped_rpc(): @@ -9187,9 +9224,14 @@ async def test_lookup_entry_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_lookup_entry_async( - transport: str = "grpc_asyncio", request_type=catalog.LookupEntryRequest -): +@pytest.mark.parametrize( + "request_type", + [ + catalog.LookupEntryRequest(), + {}, + ], +) +async def test_lookup_entry_async(request_type, transport: str = "grpc_asyncio"): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9197,7 +9239,7 @@ async def test_lookup_entry_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.lookup_entry), "__call__") as call: @@ -9226,11 +9268,6 @@ async def test_lookup_entry_async( assert response.fully_qualified_name == "fully_qualified_name_value" -@pytest.mark.asyncio -async def test_lookup_entry_async_from_dict(): - await test_lookup_entry_async(request_type=dict) - - def test_lookup_entry_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9293,8 +9330,8 @@ async def test_lookup_entry_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - catalog.SearchEntriesRequest, - dict, + catalog.SearchEntriesRequest(), + {}, ], ) def test_search_entries(request_type, transport: str = "grpc"): @@ -9305,7 +9342,7 @@ def test_search_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.search_entries), "__call__") as call: @@ -9357,13 +9394,14 @@ def test_search_entries_non_empty_request_with_auto_populated_field(): client.search_entries(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog.SearchEntriesRequest( + request_msg = catalog.SearchEntriesRequest( name="name_value", query="query_value", page_token="page_token_value", order_by="order_by_value", scope="scope_value", ) + assert args[0] == request_msg def test_search_entries_use_cached_wrapped_rpc(): @@ -9444,9 +9482,14 @@ async def test_search_entries_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_search_entries_async( - transport: str = "grpc_asyncio", request_type=catalog.SearchEntriesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + catalog.SearchEntriesRequest(), + {}, + ], +) +async def test_search_entries_async(request_type, transport: str = "grpc_asyncio"): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9454,7 +9497,7 @@ async def test_search_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.search_entries), "__call__") as call: @@ -9481,11 +9524,6 @@ async def test_search_entries_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_search_entries_async_from_dict(): - await test_search_entries_async(request_type=dict) - - def test_search_entries_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9832,8 +9870,8 @@ async def test_search_entries_async_pages(): @pytest.mark.parametrize( "request_type", [ - catalog.CreateMetadataJobRequest, - dict, + catalog.CreateMetadataJobRequest(), + {}, ], ) def test_create_metadata_job(request_type, transport: str = "grpc"): @@ -9844,7 +9882,7 @@ def test_create_metadata_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( @@ -9890,10 +9928,11 @@ def test_create_metadata_job_non_empty_request_with_auto_populated_field(): client.create_metadata_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog.CreateMetadataJobRequest( + request_msg = catalog.CreateMetadataJobRequest( parent="parent_value", metadata_job_id="metadata_job_id_value", ) + assert args[0] == request_msg def test_create_metadata_job_use_cached_wrapped_rpc(): @@ -9988,9 +10027,14 @@ async def test_create_metadata_job_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_metadata_job_async( - transport: str = "grpc_asyncio", request_type=catalog.CreateMetadataJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + catalog.CreateMetadataJobRequest(), + {}, + ], +) +async def test_create_metadata_job_async(request_type, transport: str = "grpc_asyncio"): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9998,7 +10042,7 @@ async def test_create_metadata_job_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( @@ -10020,11 +10064,6 @@ async def test_create_metadata_job_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_metadata_job_async_from_dict(): - await test_create_metadata_job_async(request_type=dict) - - def test_create_metadata_job_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10199,8 +10238,8 @@ async def test_create_metadata_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - catalog.GetMetadataJobRequest, - dict, + catalog.GetMetadataJobRequest(), + {}, ], ) def test_get_metadata_job(request_type, transport: str = "grpc"): @@ -10211,7 +10250,7 @@ def test_get_metadata_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(type(client.transport.get_metadata_job), "__call__") as call: @@ -10259,9 +10298,10 @@ def test_get_metadata_job_non_empty_request_with_auto_populated_field(): client.get_metadata_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog.GetMetadataJobRequest( + request_msg = catalog.GetMetadataJobRequest( name="name_value", ) + assert args[0] == request_msg def test_get_metadata_job_use_cached_wrapped_rpc(): @@ -10344,9 +10384,14 @@ async def test_get_metadata_job_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_metadata_job_async( - transport: str = "grpc_asyncio", request_type=catalog.GetMetadataJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + catalog.GetMetadataJobRequest(), + {}, + ], +) +async def test_get_metadata_job_async(request_type, transport: str = "grpc_asyncio"): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10354,7 +10399,7 @@ async def test_get_metadata_job_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_metadata_job), "__call__") as call: @@ -10381,11 +10426,6 @@ async def test_get_metadata_job_async( assert response.type_ == catalog.MetadataJob.Type.IMPORT -@pytest.mark.asyncio -async def test_get_metadata_job_async_from_dict(): - await test_get_metadata_job_async(request_type=dict) - - def test_get_metadata_job_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10528,8 +10568,8 @@ async def test_get_metadata_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - catalog.ListMetadataJobsRequest, - dict, + catalog.ListMetadataJobsRequest(), + {}, ], ) def test_list_metadata_jobs(request_type, transport: str = "grpc"): @@ -10540,7 +10580,7 @@ def test_list_metadata_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( @@ -10593,12 +10633,13 @@ def test_list_metadata_jobs_non_empty_request_with_auto_populated_field(): client.list_metadata_jobs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog.ListMetadataJobsRequest( + request_msg = catalog.ListMetadataJobsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_metadata_jobs_use_cached_wrapped_rpc(): @@ -10683,9 +10724,14 @@ async def test_list_metadata_jobs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_metadata_jobs_async( - transport: str = "grpc_asyncio", request_type=catalog.ListMetadataJobsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + catalog.ListMetadataJobsRequest(), + {}, + ], +) +async def test_list_metadata_jobs_async(request_type, transport: str = "grpc_asyncio"): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10693,7 +10739,7 @@ async def test_list_metadata_jobs_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( @@ -10720,11 +10766,6 @@ async def test_list_metadata_jobs_async( assert response.unreachable_locations == ["unreachable_locations_value"] -@pytest.mark.asyncio -async def test_list_metadata_jobs_async_from_dict(): - await test_list_metadata_jobs_async(request_type=dict) - - def test_list_metadata_jobs_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11077,8 +11118,8 @@ async def test_list_metadata_jobs_async_pages(): @pytest.mark.parametrize( "request_type", [ - catalog.CancelMetadataJobRequest, - dict, + catalog.CancelMetadataJobRequest(), + {}, ], ) def test_cancel_metadata_job(request_type, transport: str = "grpc"): @@ -11089,7 +11130,7 @@ def test_cancel_metadata_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( @@ -11134,9 +11175,10 @@ def test_cancel_metadata_job_non_empty_request_with_auto_populated_field(): client.cancel_metadata_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog.CancelMetadataJobRequest( + request_msg = catalog.CancelMetadataJobRequest( name="name_value", ) + assert args[0] == request_msg def test_cancel_metadata_job_use_cached_wrapped_rpc(): @@ -11221,9 +11263,14 @@ async def test_cancel_metadata_job_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_cancel_metadata_job_async( - transport: str = "grpc_asyncio", request_type=catalog.CancelMetadataJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + catalog.CancelMetadataJobRequest(), + {}, + ], +) +async def test_cancel_metadata_job_async(request_type, transport: str = "grpc_asyncio"): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11231,7 +11278,7 @@ async def test_cancel_metadata_job_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( @@ -11251,11 +11298,6 @@ async def test_cancel_metadata_job_async( assert response is None -@pytest.mark.asyncio -async def test_cancel_metadata_job_async_from_dict(): - await test_cancel_metadata_job_async(request_type=dict) - - def test_cancel_metadata_job_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11406,8 +11448,8 @@ async def test_cancel_metadata_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - catalog.CreateEntryLinkRequest, - dict, + catalog.CreateEntryLinkRequest(), + {}, ], ) def test_create_entry_link(request_type, transport: str = "grpc"): @@ -11418,7 +11460,7 @@ def test_create_entry_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( @@ -11469,10 +11511,11 @@ def test_create_entry_link_non_empty_request_with_auto_populated_field(): client.create_entry_link(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog.CreateEntryLinkRequest( + request_msg = catalog.CreateEntryLinkRequest( parent="parent_value", entry_link_id="entry_link_id_value", ) + assert args[0] == request_msg def test_create_entry_link_use_cached_wrapped_rpc(): @@ -11555,9 +11598,14 @@ async def test_create_entry_link_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_entry_link_async( - transport: str = "grpc_asyncio", request_type=catalog.CreateEntryLinkRequest -): +@pytest.mark.parametrize( + "request_type", + [ + catalog.CreateEntryLinkRequest(), + {}, + ], +) +async def test_create_entry_link_async(request_type, transport: str = "grpc_asyncio"): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11565,7 +11613,7 @@ async def test_create_entry_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( @@ -11592,11 +11640,6 @@ async def test_create_entry_link_async( assert response.entry_link_type == "entry_link_type_value" -@pytest.mark.asyncio -async def test_create_entry_link_async_from_dict(): - await test_create_entry_link_async(request_type=dict) - - def test_create_entry_link_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11767,8 +11810,8 @@ async def test_create_entry_link_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - catalog.UpdateEntryLinkRequest, - dict, + catalog.UpdateEntryLinkRequest(), + {}, ], ) def test_update_entry_link(request_type, transport: str = "grpc"): @@ -11779,7 +11822,7 @@ def test_update_entry_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( @@ -11827,7 +11870,8 @@ def test_update_entry_link_non_empty_request_with_auto_populated_field(): client.update_entry_link(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog.UpdateEntryLinkRequest() + request_msg = catalog.UpdateEntryLinkRequest() + assert args[0] == request_msg def test_update_entry_link_use_cached_wrapped_rpc(): @@ -11910,9 +11954,14 @@ async def test_update_entry_link_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_entry_link_async( - transport: str = "grpc_asyncio", request_type=catalog.UpdateEntryLinkRequest -): +@pytest.mark.parametrize( + "request_type", + [ + catalog.UpdateEntryLinkRequest(), + {}, + ], +) +async def test_update_entry_link_async(request_type, transport: str = "grpc_asyncio"): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11920,7 +11969,7 @@ async def test_update_entry_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( @@ -11947,11 +11996,6 @@ async def test_update_entry_link_async( assert response.entry_link_type == "entry_link_type_value" -@pytest.mark.asyncio -async def test_update_entry_link_async_from_dict(): - await test_update_entry_link_async(request_type=dict) - - def test_update_entry_link_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12102,8 +12146,8 @@ async def test_update_entry_link_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - catalog.DeleteEntryLinkRequest, - dict, + catalog.DeleteEntryLinkRequest(), + {}, ], ) def test_delete_entry_link(request_type, transport: str = "grpc"): @@ -12114,7 +12158,7 @@ def test_delete_entry_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( @@ -12164,9 +12208,10 @@ def test_delete_entry_link_non_empty_request_with_auto_populated_field(): client.delete_entry_link(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog.DeleteEntryLinkRequest( + request_msg = catalog.DeleteEntryLinkRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_entry_link_use_cached_wrapped_rpc(): @@ -12249,9 +12294,14 @@ async def test_delete_entry_link_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_entry_link_async( - transport: str = "grpc_asyncio", request_type=catalog.DeleteEntryLinkRequest -): +@pytest.mark.parametrize( + "request_type", + [ + catalog.DeleteEntryLinkRequest(), + {}, + ], +) +async def test_delete_entry_link_async(request_type, transport: str = "grpc_asyncio"): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12259,7 +12309,7 @@ async def test_delete_entry_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( @@ -12286,11 +12336,6 @@ async def test_delete_entry_link_async( assert response.entry_link_type == "entry_link_type_value" -@pytest.mark.asyncio -async def test_delete_entry_link_async_from_dict(): - await test_delete_entry_link_async(request_type=dict) - - def test_delete_entry_link_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12441,8 +12486,8 @@ async def test_delete_entry_link_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - catalog.LookupEntryLinksRequest, - dict, + catalog.LookupEntryLinksRequest(), + {}, ], ) def test_lookup_entry_links(request_type, transport: str = "grpc"): @@ -12453,7 +12498,7 @@ def test_lookup_entry_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( @@ -12503,11 +12548,12 @@ def test_lookup_entry_links_non_empty_request_with_auto_populated_field(): client.lookup_entry_links(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog.LookupEntryLinksRequest( + request_msg = catalog.LookupEntryLinksRequest( name="name_value", entry="entry_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_lookup_entry_links_use_cached_wrapped_rpc(): @@ -12592,9 +12638,14 @@ async def test_lookup_entry_links_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_lookup_entry_links_async( - transport: str = "grpc_asyncio", request_type=catalog.LookupEntryLinksRequest -): +@pytest.mark.parametrize( + "request_type", + [ + catalog.LookupEntryLinksRequest(), + {}, + ], +) +async def test_lookup_entry_links_async(request_type, transport: str = "grpc_asyncio"): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12602,7 +12653,7 @@ async def test_lookup_entry_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( @@ -12627,11 +12678,6 @@ async def test_lookup_entry_links_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_lookup_entry_links_async_from_dict(): - await test_lookup_entry_links_async(request_type=dict) - - def test_lookup_entry_links_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12898,8 +12944,8 @@ async def test_lookup_entry_links_async_pages(): @pytest.mark.parametrize( "request_type", [ - catalog.LookupContextRequest, - dict, + catalog.LookupContextRequest(), + {}, ], ) def test_lookup_context(request_type, transport: str = "grpc"): @@ -12910,7 +12956,7 @@ def test_lookup_context(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.lookup_context), "__call__") as call: @@ -12954,9 +13000,10 @@ def test_lookup_context_non_empty_request_with_auto_populated_field(): client.lookup_context(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog.LookupContextRequest( + request_msg = catalog.LookupContextRequest( name="name_value", ) + assert args[0] == request_msg def test_lookup_context_use_cached_wrapped_rpc(): @@ -13037,9 +13084,14 @@ async def test_lookup_context_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_lookup_context_async( - transport: str = "grpc_asyncio", request_type=catalog.LookupContextRequest -): +@pytest.mark.parametrize( + "request_type", + [ + catalog.LookupContextRequest(), + {}, + ], +) +async def test_lookup_context_async(request_type, transport: str = "grpc_asyncio"): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13047,7 +13099,7 @@ async def test_lookup_context_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.lookup_context), "__call__") as call: @@ -13070,11 +13122,6 @@ async def test_lookup_context_async( assert response.context == "context_value" -@pytest.mark.asyncio -async def test_lookup_context_async_from_dict(): - await test_lookup_context_async(request_type=dict) - - def test_lookup_context_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13139,8 +13186,8 @@ async def test_lookup_context_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - catalog.GetEntryLinkRequest, - dict, + catalog.GetEntryLinkRequest(), + {}, ], ) def test_get_entry_link(request_type, transport: str = "grpc"): @@ -13151,7 +13198,7 @@ def test_get_entry_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_entry_link), "__call__") as call: @@ -13197,9 +13244,10 @@ def test_get_entry_link_non_empty_request_with_auto_populated_field(): client.get_entry_link(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog.GetEntryLinkRequest( + request_msg = catalog.GetEntryLinkRequest( name="name_value", ) + assert args[0] == request_msg def test_get_entry_link_use_cached_wrapped_rpc(): @@ -13280,9 +13328,14 @@ async def test_get_entry_link_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_entry_link_async( - transport: str = "grpc_asyncio", request_type=catalog.GetEntryLinkRequest -): +@pytest.mark.parametrize( + "request_type", + [ + catalog.GetEntryLinkRequest(), + {}, + ], +) +async def test_get_entry_link_async(request_type, transport: str = "grpc_asyncio"): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13290,7 +13343,7 @@ async def test_get_entry_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_entry_link), "__call__") as call: @@ -13315,11 +13368,6 @@ async def test_get_entry_link_async( assert response.entry_link_type == "entry_link_type_value" -@pytest.mark.asyncio -async def test_get_entry_link_async_from_dict(): - await test_get_entry_link_async(request_type=dict) - - def test_get_entry_link_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13462,8 +13510,8 @@ async def test_get_entry_link_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - catalog.CreateMetadataFeedRequest, - dict, + catalog.CreateMetadataFeedRequest(), + {}, ], ) def test_create_metadata_feed(request_type, transport: str = "grpc"): @@ -13474,7 +13522,7 @@ def test_create_metadata_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( @@ -13520,10 +13568,11 @@ def test_create_metadata_feed_non_empty_request_with_auto_populated_field(): client.create_metadata_feed(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog.CreateMetadataFeedRequest( + request_msg = catalog.CreateMetadataFeedRequest( parent="parent_value", metadata_feed_id="metadata_feed_id_value", ) + assert args[0] == request_msg def test_create_metadata_feed_use_cached_wrapped_rpc(): @@ -13618,8 +13667,15 @@ async def test_create_metadata_feed_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + catalog.CreateMetadataFeedRequest(), + {}, + ], +) async def test_create_metadata_feed_async( - transport: str = "grpc_asyncio", request_type=catalog.CreateMetadataFeedRequest + request_type, transport: str = "grpc_asyncio" ): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -13628,7 +13684,7 @@ async def test_create_metadata_feed_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( @@ -13650,11 +13706,6 @@ async def test_create_metadata_feed_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_metadata_feed_async_from_dict(): - await test_create_metadata_feed_async(request_type=dict) - - def test_create_metadata_feed_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13829,8 +13880,8 @@ async def test_create_metadata_feed_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - catalog.GetMetadataFeedRequest, - dict, + catalog.GetMetadataFeedRequest(), + {}, ], ) def test_get_metadata_feed(request_type, transport: str = "grpc"): @@ -13841,7 +13892,7 @@ def test_get_metadata_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( @@ -13892,9 +13943,10 @@ def test_get_metadata_feed_non_empty_request_with_auto_populated_field(): client.get_metadata_feed(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog.GetMetadataFeedRequest( + request_msg = catalog.GetMetadataFeedRequest( name="name_value", ) + assert args[0] == request_msg def test_get_metadata_feed_use_cached_wrapped_rpc(): @@ -13977,9 +14029,14 @@ async def test_get_metadata_feed_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_metadata_feed_async( - transport: str = "grpc_asyncio", request_type=catalog.GetMetadataFeedRequest -): +@pytest.mark.parametrize( + "request_type", + [ + catalog.GetMetadataFeedRequest(), + {}, + ], +) +async def test_get_metadata_feed_async(request_type, transport: str = "grpc_asyncio"): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13987,7 +14044,7 @@ async def test_get_metadata_feed_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( @@ -14014,11 +14071,6 @@ async def test_get_metadata_feed_async( assert response.uid == "uid_value" -@pytest.mark.asyncio -async def test_get_metadata_feed_async_from_dict(): - await test_get_metadata_feed_async(request_type=dict) - - def test_get_metadata_feed_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14173,8 +14225,8 @@ async def test_get_metadata_feed_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - catalog.ListMetadataFeedsRequest, - dict, + catalog.ListMetadataFeedsRequest(), + {}, ], ) def test_list_metadata_feeds(request_type, transport: str = "grpc"): @@ -14185,7 +14237,7 @@ def test_list_metadata_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( @@ -14238,12 +14290,13 @@ def test_list_metadata_feeds_non_empty_request_with_auto_populated_field(): client.list_metadata_feeds(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog.ListMetadataFeedsRequest( + request_msg = catalog.ListMetadataFeedsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_metadata_feeds_use_cached_wrapped_rpc(): @@ -14328,9 +14381,14 @@ async def test_list_metadata_feeds_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_metadata_feeds_async( - transport: str = "grpc_asyncio", request_type=catalog.ListMetadataFeedsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + catalog.ListMetadataFeedsRequest(), + {}, + ], +) +async def test_list_metadata_feeds_async(request_type, transport: str = "grpc_asyncio"): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14338,7 +14396,7 @@ async def test_list_metadata_feeds_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( @@ -14365,11 +14423,6 @@ async def test_list_metadata_feeds_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_metadata_feeds_async_from_dict(): - await test_list_metadata_feeds_async(request_type=dict) - - def test_list_metadata_feeds_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14722,8 +14775,8 @@ async def test_list_metadata_feeds_async_pages(): @pytest.mark.parametrize( "request_type", [ - catalog.DeleteMetadataFeedRequest, - dict, + catalog.DeleteMetadataFeedRequest(), + {}, ], ) def test_delete_metadata_feed(request_type, transport: str = "grpc"): @@ -14734,7 +14787,7 @@ def test_delete_metadata_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( @@ -14779,9 +14832,10 @@ def test_delete_metadata_feed_non_empty_request_with_auto_populated_field(): client.delete_metadata_feed(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog.DeleteMetadataFeedRequest( + request_msg = catalog.DeleteMetadataFeedRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_metadata_feed_use_cached_wrapped_rpc(): @@ -14876,8 +14930,15 @@ async def test_delete_metadata_feed_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + catalog.DeleteMetadataFeedRequest(), + {}, + ], +) async def test_delete_metadata_feed_async( - transport: str = "grpc_asyncio", request_type=catalog.DeleteMetadataFeedRequest + request_type, transport: str = "grpc_asyncio" ): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -14886,7 +14947,7 @@ async def test_delete_metadata_feed_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( @@ -14908,11 +14969,6 @@ async def test_delete_metadata_feed_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_metadata_feed_async_from_dict(): - await test_delete_metadata_feed_async(request_type=dict) - - def test_delete_metadata_feed_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15067,8 +15123,8 @@ async def test_delete_metadata_feed_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - catalog.UpdateMetadataFeedRequest, - dict, + catalog.UpdateMetadataFeedRequest(), + {}, ], ) def test_update_metadata_feed(request_type, transport: str = "grpc"): @@ -15079,7 +15135,7 @@ def test_update_metadata_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( @@ -15122,7 +15178,8 @@ def test_update_metadata_feed_non_empty_request_with_auto_populated_field(): client.update_metadata_feed(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog.UpdateMetadataFeedRequest() + request_msg = catalog.UpdateMetadataFeedRequest() + assert args[0] == request_msg def test_update_metadata_feed_use_cached_wrapped_rpc(): @@ -15217,8 +15274,15 @@ async def test_update_metadata_feed_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + catalog.UpdateMetadataFeedRequest(), + {}, + ], +) async def test_update_metadata_feed_async( - transport: str = "grpc_asyncio", request_type=catalog.UpdateMetadataFeedRequest + request_type, transport: str = "grpc_asyncio" ): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -15227,7 +15291,7 @@ async def test_update_metadata_feed_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( @@ -15249,11 +15313,6 @@ async def test_update_metadata_feed_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_metadata_feed_async_from_dict(): - await test_update_metadata_feed_async(request_type=dict) - - def test_update_metadata_feed_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -23124,7 +23183,6 @@ def test_create_entry_type_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.CreateEntryTypeRequest() - assert args[0] == request_msg @@ -23147,7 +23205,6 @@ def test_update_entry_type_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.UpdateEntryTypeRequest() - assert args[0] == request_msg @@ -23170,7 +23227,6 @@ def test_delete_entry_type_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.DeleteEntryTypeRequest() - assert args[0] == request_msg @@ -23191,7 +23247,6 @@ def test_list_entry_types_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.ListEntryTypesRequest() - assert args[0] == request_msg @@ -23212,7 +23267,6 @@ def test_get_entry_type_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.GetEntryTypeRequest() - assert args[0] == request_msg @@ -23235,7 +23289,6 @@ def test_create_aspect_type_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.CreateAspectTypeRequest() - assert args[0] == request_msg @@ -23258,7 +23311,6 @@ def test_update_aspect_type_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.UpdateAspectTypeRequest() - assert args[0] == request_msg @@ -23281,7 +23333,6 @@ def test_delete_aspect_type_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.DeleteAspectTypeRequest() - assert args[0] == request_msg @@ -23304,7 +23355,6 @@ def test_list_aspect_types_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.ListAspectTypesRequest() - assert args[0] == request_msg @@ -23325,7 +23375,6 @@ def test_get_aspect_type_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.GetAspectTypeRequest() - assert args[0] == request_msg @@ -23348,7 +23397,6 @@ def test_create_entry_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.CreateEntryGroupRequest() - assert args[0] == request_msg @@ -23371,7 +23419,6 @@ def test_update_entry_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.UpdateEntryGroupRequest() - assert args[0] == request_msg @@ -23394,7 +23441,6 @@ def test_delete_entry_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.DeleteEntryGroupRequest() - assert args[0] == request_msg @@ -23417,7 +23463,6 @@ def test_list_entry_groups_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.ListEntryGroupsRequest() - assert args[0] == request_msg @@ -23438,7 +23483,6 @@ def test_get_entry_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.GetEntryGroupRequest() - assert args[0] == request_msg @@ -23459,7 +23503,6 @@ def test_create_entry_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.CreateEntryRequest() - assert args[0] == request_msg @@ -23480,7 +23523,6 @@ def test_update_entry_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.UpdateEntryRequest() - assert args[0] == request_msg @@ -23501,7 +23543,6 @@ def test_delete_entry_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.DeleteEntryRequest() - assert args[0] == request_msg @@ -23522,7 +23563,6 @@ def test_list_entries_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.ListEntriesRequest() - assert args[0] == request_msg @@ -23543,7 +23583,6 @@ def test_get_entry_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.GetEntryRequest() - assert args[0] == request_msg @@ -23564,7 +23603,6 @@ def test_lookup_entry_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.LookupEntryRequest() - assert args[0] == request_msg @@ -23585,7 +23623,6 @@ def test_search_entries_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.SearchEntriesRequest() - assert args[0] == request_msg @@ -23608,7 +23645,6 @@ def test_create_metadata_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.CreateMetadataJobRequest() - assert args[0] == request_msg @@ -23629,7 +23665,6 @@ def test_get_metadata_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.GetMetadataJobRequest() - assert args[0] == request_msg @@ -23652,7 +23687,6 @@ def test_list_metadata_jobs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.ListMetadataJobsRequest() - assert args[0] == request_msg @@ -23675,7 +23709,6 @@ def test_cancel_metadata_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.CancelMetadataJobRequest() - assert args[0] == request_msg @@ -23698,7 +23731,6 @@ def test_create_entry_link_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.CreateEntryLinkRequest() - assert args[0] == request_msg @@ -23721,7 +23753,6 @@ def test_update_entry_link_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.UpdateEntryLinkRequest() - assert args[0] == request_msg @@ -23744,7 +23775,6 @@ def test_delete_entry_link_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.DeleteEntryLinkRequest() - assert args[0] == request_msg @@ -23767,7 +23797,6 @@ def test_lookup_entry_links_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.LookupEntryLinksRequest() - assert args[0] == request_msg @@ -23788,7 +23817,6 @@ def test_lookup_context_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.LookupContextRequest() - assert args[0] == request_msg @@ -23809,7 +23837,6 @@ def test_get_entry_link_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.GetEntryLinkRequest() - assert args[0] == request_msg @@ -23832,7 +23859,6 @@ def test_create_metadata_feed_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.CreateMetadataFeedRequest() - assert args[0] == request_msg @@ -23855,7 +23881,6 @@ def test_get_metadata_feed_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.GetMetadataFeedRequest() - assert args[0] == request_msg @@ -23878,7 +23903,6 @@ def test_list_metadata_feeds_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.ListMetadataFeedsRequest() - assert args[0] == request_msg @@ -23901,7 +23925,6 @@ def test_delete_metadata_feed_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.DeleteMetadataFeedRequest() - assert args[0] == request_msg @@ -23924,7 +23947,6 @@ def test_update_metadata_feed_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.UpdateMetadataFeedRequest() - assert args[0] == request_msg @@ -23965,7 +23987,6 @@ async def test_create_entry_type_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.CreateEntryTypeRequest() - assert args[0] == request_msg @@ -23992,7 +24013,6 @@ async def test_update_entry_type_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.UpdateEntryTypeRequest() - assert args[0] == request_msg @@ -24019,7 +24039,6 @@ async def test_delete_entry_type_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.DeleteEntryTypeRequest() - assert args[0] == request_msg @@ -24047,7 +24066,6 @@ async def test_list_entry_types_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.ListEntryTypesRequest() - assert args[0] == request_msg @@ -24081,7 +24099,6 @@ async def test_get_entry_type_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.GetEntryTypeRequest() - assert args[0] == request_msg @@ -24108,7 +24125,6 @@ async def test_create_aspect_type_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.CreateAspectTypeRequest() - assert args[0] == request_msg @@ -24135,7 +24151,6 @@ async def test_update_aspect_type_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.UpdateAspectTypeRequest() - assert args[0] == request_msg @@ -24162,7 +24177,6 @@ async def test_delete_aspect_type_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.DeleteAspectTypeRequest() - assert args[0] == request_msg @@ -24192,7 +24206,6 @@ async def test_list_aspect_types_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.ListAspectTypesRequest() - assert args[0] == request_msg @@ -24225,7 +24238,6 @@ async def test_get_aspect_type_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.GetAspectTypeRequest() - assert args[0] == request_msg @@ -24252,7 +24264,6 @@ async def test_create_entry_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.CreateEntryGroupRequest() - assert args[0] == request_msg @@ -24279,7 +24290,6 @@ async def test_update_entry_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.UpdateEntryGroupRequest() - assert args[0] == request_msg @@ -24306,7 +24316,6 @@ async def test_delete_entry_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.DeleteEntryGroupRequest() - assert args[0] == request_msg @@ -24336,7 +24345,6 @@ async def test_list_entry_groups_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.ListEntryGroupsRequest() - assert args[0] == request_msg @@ -24368,7 +24376,6 @@ async def test_get_entry_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.GetEntryGroupRequest() - assert args[0] == request_msg @@ -24398,7 +24405,6 @@ async def test_create_entry_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.CreateEntryRequest() - assert args[0] == request_msg @@ -24428,7 +24434,6 @@ async def test_update_entry_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.UpdateEntryRequest() - assert args[0] == request_msg @@ -24458,7 +24463,6 @@ async def test_delete_entry_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.DeleteEntryRequest() - assert args[0] == request_msg @@ -24485,7 +24489,6 @@ async def test_list_entries_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.ListEntriesRequest() - assert args[0] == request_msg @@ -24515,7 +24518,6 @@ async def test_get_entry_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.GetEntryRequest() - assert args[0] == request_msg @@ -24545,7 +24547,6 @@ async def test_lookup_entry_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.LookupEntryRequest() - assert args[0] == request_msg @@ -24574,7 +24575,6 @@ async def test_search_entries_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.SearchEntriesRequest() - assert args[0] == request_msg @@ -24601,7 +24601,6 @@ async def test_create_metadata_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.CreateMetadataJobRequest() - assert args[0] == request_msg @@ -24630,7 +24629,6 @@ async def test_get_metadata_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.GetMetadataJobRequest() - assert args[0] == request_msg @@ -24660,7 +24658,6 @@ async def test_list_metadata_jobs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.ListMetadataJobsRequest() - assert args[0] == request_msg @@ -24685,7 +24682,6 @@ async def test_cancel_metadata_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.CancelMetadataJobRequest() - assert args[0] == request_msg @@ -24715,7 +24711,6 @@ async def test_create_entry_link_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.CreateEntryLinkRequest() - assert args[0] == request_msg @@ -24745,7 +24740,6 @@ async def test_update_entry_link_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.UpdateEntryLinkRequest() - assert args[0] == request_msg @@ -24775,7 +24769,6 @@ async def test_delete_entry_link_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.DeleteEntryLinkRequest() - assert args[0] == request_msg @@ -24804,7 +24797,6 @@ async def test_lookup_entry_links_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.LookupEntryLinksRequest() - assert args[0] == request_msg @@ -24831,7 +24823,6 @@ async def test_lookup_context_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.LookupContextRequest() - assert args[0] == request_msg @@ -24859,7 +24850,6 @@ async def test_get_entry_link_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.GetEntryLinkRequest() - assert args[0] == request_msg @@ -24886,7 +24876,6 @@ async def test_create_metadata_feed_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.CreateMetadataFeedRequest() - assert args[0] == request_msg @@ -24916,7 +24905,6 @@ async def test_get_metadata_feed_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.GetMetadataFeedRequest() - assert args[0] == request_msg @@ -24946,7 +24934,6 @@ async def test_list_metadata_feeds_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.ListMetadataFeedsRequest() - assert args[0] == request_msg @@ -24973,7 +24960,6 @@ async def test_delete_metadata_feed_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.DeleteMetadataFeedRequest() - assert args[0] == request_msg @@ -25000,7 +24986,6 @@ async def test_update_metadata_feed_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.UpdateMetadataFeedRequest() - assert args[0] == request_msg @@ -31603,7 +31588,6 @@ def test_create_entry_type_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.CreateEntryTypeRequest() - assert args[0] == request_msg @@ -31625,7 +31609,6 @@ def test_update_entry_type_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.UpdateEntryTypeRequest() - assert args[0] == request_msg @@ -31647,7 +31630,6 @@ def test_delete_entry_type_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.DeleteEntryTypeRequest() - assert args[0] == request_msg @@ -31667,7 +31649,6 @@ def test_list_entry_types_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.ListEntryTypesRequest() - assert args[0] == request_msg @@ -31687,7 +31668,6 @@ def test_get_entry_type_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.GetEntryTypeRequest() - assert args[0] == request_msg @@ -31709,7 +31689,6 @@ def test_create_aspect_type_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.CreateAspectTypeRequest() - assert args[0] == request_msg @@ -31731,7 +31710,6 @@ def test_update_aspect_type_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.UpdateAspectTypeRequest() - assert args[0] == request_msg @@ -31753,7 +31731,6 @@ def test_delete_aspect_type_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.DeleteAspectTypeRequest() - assert args[0] == request_msg @@ -31775,7 +31752,6 @@ def test_list_aspect_types_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.ListAspectTypesRequest() - assert args[0] == request_msg @@ -31795,7 +31771,6 @@ def test_get_aspect_type_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.GetAspectTypeRequest() - assert args[0] == request_msg @@ -31817,7 +31792,6 @@ def test_create_entry_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.CreateEntryGroupRequest() - assert args[0] == request_msg @@ -31839,7 +31813,6 @@ def test_update_entry_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.UpdateEntryGroupRequest() - assert args[0] == request_msg @@ -31861,7 +31834,6 @@ def test_delete_entry_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.DeleteEntryGroupRequest() - assert args[0] == request_msg @@ -31883,7 +31855,6 @@ def test_list_entry_groups_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.ListEntryGroupsRequest() - assert args[0] == request_msg @@ -31903,7 +31874,6 @@ def test_get_entry_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.GetEntryGroupRequest() - assert args[0] == request_msg @@ -31923,7 +31893,6 @@ def test_create_entry_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.CreateEntryRequest() - assert args[0] == request_msg @@ -31943,7 +31912,6 @@ def test_update_entry_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.UpdateEntryRequest() - assert args[0] == request_msg @@ -31963,7 +31931,6 @@ def test_delete_entry_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.DeleteEntryRequest() - assert args[0] == request_msg @@ -31983,7 +31950,6 @@ def test_list_entries_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.ListEntriesRequest() - assert args[0] == request_msg @@ -32003,7 +31969,6 @@ def test_get_entry_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.GetEntryRequest() - assert args[0] == request_msg @@ -32023,7 +31988,6 @@ def test_lookup_entry_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.LookupEntryRequest() - assert args[0] == request_msg @@ -32043,7 +32007,6 @@ def test_search_entries_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.SearchEntriesRequest() - assert args[0] == request_msg @@ -32065,7 +32028,6 @@ def test_create_metadata_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.CreateMetadataJobRequest() - assert args[0] == request_msg @@ -32085,7 +32047,6 @@ def test_get_metadata_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.GetMetadataJobRequest() - assert args[0] == request_msg @@ -32107,7 +32068,6 @@ def test_list_metadata_jobs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.ListMetadataJobsRequest() - assert args[0] == request_msg @@ -32129,7 +32089,6 @@ def test_cancel_metadata_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.CancelMetadataJobRequest() - assert args[0] == request_msg @@ -32151,7 +32110,6 @@ def test_create_entry_link_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.CreateEntryLinkRequest() - assert args[0] == request_msg @@ -32173,7 +32131,6 @@ def test_update_entry_link_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.UpdateEntryLinkRequest() - assert args[0] == request_msg @@ -32195,7 +32152,6 @@ def test_delete_entry_link_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.DeleteEntryLinkRequest() - assert args[0] == request_msg @@ -32217,7 +32173,6 @@ def test_lookup_entry_links_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.LookupEntryLinksRequest() - assert args[0] == request_msg @@ -32237,7 +32192,6 @@ def test_lookup_context_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.LookupContextRequest() - assert args[0] == request_msg @@ -32257,7 +32211,6 @@ def test_get_entry_link_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.GetEntryLinkRequest() - assert args[0] == request_msg @@ -32279,7 +32232,6 @@ def test_create_metadata_feed_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.CreateMetadataFeedRequest() - assert args[0] == request_msg @@ -32301,7 +32253,6 @@ def test_get_metadata_feed_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.GetMetadataFeedRequest() - assert args[0] == request_msg @@ -32323,7 +32274,6 @@ def test_list_metadata_feeds_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.ListMetadataFeedsRequest() - assert args[0] == request_msg @@ -32345,7 +32295,6 @@ def test_delete_metadata_feed_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.DeleteMetadataFeedRequest() - assert args[0] == request_msg @@ -32367,7 +32316,6 @@ def test_update_metadata_feed_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog.UpdateMetadataFeedRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dataplex/tests/unit/gapic/dataplex_v1/test_cmek_service.py b/packages/google-cloud-dataplex/tests/unit/gapic/dataplex_v1/test_cmek_service.py index 85615b2165cc..c4d4f70c12fa 100644 --- a/packages/google-cloud-dataplex/tests/unit/gapic/dataplex_v1/test_cmek_service.py +++ b/packages/google-cloud-dataplex/tests/unit/gapic/dataplex_v1/test_cmek_service.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 @@ -121,6 +122,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" @@ -1286,8 +1302,8 @@ def test_cmek_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - cmek.CreateEncryptionConfigRequest, - dict, + cmek.CreateEncryptionConfigRequest(), + {}, ], ) def test_create_encryption_config(request_type, transport: str = "grpc"): @@ -1298,7 +1314,7 @@ def test_create_encryption_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( @@ -1344,10 +1360,11 @@ def test_create_encryption_config_non_empty_request_with_auto_populated_field(): client.create_encryption_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cmek.CreateEncryptionConfigRequest( + request_msg = cmek.CreateEncryptionConfigRequest( parent="parent_value", encryption_config_id="encryption_config_id_value", ) + assert args[0] == request_msg def test_create_encryption_config_use_cached_wrapped_rpc(): @@ -1443,8 +1460,15 @@ async def test_create_encryption_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cmek.CreateEncryptionConfigRequest(), + {}, + ], +) async def test_create_encryption_config_async( - transport: str = "grpc_asyncio", request_type=cmek.CreateEncryptionConfigRequest + request_type, transport: str = "grpc_asyncio" ): client = CmekServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1453,7 +1477,7 @@ async def test_create_encryption_config_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( @@ -1475,11 +1499,6 @@ async def test_create_encryption_config_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_encryption_config_async_from_dict(): - await test_create_encryption_config_async(request_type=dict) - - def test_create_encryption_config_field_headers(): client = CmekServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1654,8 +1673,8 @@ async def test_create_encryption_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cmek.UpdateEncryptionConfigRequest, - dict, + cmek.UpdateEncryptionConfigRequest(), + {}, ], ) def test_update_encryption_config(request_type, transport: str = "grpc"): @@ -1666,7 +1685,7 @@ def test_update_encryption_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( @@ -1709,7 +1728,8 @@ def test_update_encryption_config_non_empty_request_with_auto_populated_field(): client.update_encryption_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cmek.UpdateEncryptionConfigRequest() + request_msg = cmek.UpdateEncryptionConfigRequest() + assert args[0] == request_msg def test_update_encryption_config_use_cached_wrapped_rpc(): @@ -1805,8 +1825,15 @@ async def test_update_encryption_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cmek.UpdateEncryptionConfigRequest(), + {}, + ], +) async def test_update_encryption_config_async( - transport: str = "grpc_asyncio", request_type=cmek.UpdateEncryptionConfigRequest + request_type, transport: str = "grpc_asyncio" ): client = CmekServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1815,7 +1842,7 @@ async def test_update_encryption_config_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( @@ -1837,11 +1864,6 @@ async def test_update_encryption_config_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_encryption_config_async_from_dict(): - await test_update_encryption_config_async(request_type=dict) - - def test_update_encryption_config_field_headers(): client = CmekServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2006,8 +2028,8 @@ async def test_update_encryption_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cmek.DeleteEncryptionConfigRequest, - dict, + cmek.DeleteEncryptionConfigRequest(), + {}, ], ) def test_delete_encryption_config(request_type, transport: str = "grpc"): @@ -2018,7 +2040,7 @@ def test_delete_encryption_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( @@ -2064,10 +2086,11 @@ def test_delete_encryption_config_non_empty_request_with_auto_populated_field(): client.delete_encryption_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cmek.DeleteEncryptionConfigRequest( + request_msg = cmek.DeleteEncryptionConfigRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_encryption_config_use_cached_wrapped_rpc(): @@ -2163,8 +2186,15 @@ async def test_delete_encryption_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cmek.DeleteEncryptionConfigRequest(), + {}, + ], +) async def test_delete_encryption_config_async( - transport: str = "grpc_asyncio", request_type=cmek.DeleteEncryptionConfigRequest + request_type, transport: str = "grpc_asyncio" ): client = CmekServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2173,7 +2203,7 @@ async def test_delete_encryption_config_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( @@ -2195,11 +2225,6 @@ async def test_delete_encryption_config_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_encryption_config_async_from_dict(): - await test_delete_encryption_config_async(request_type=dict) - - def test_delete_encryption_config_field_headers(): client = CmekServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2354,8 +2379,8 @@ async def test_delete_encryption_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cmek.ListEncryptionConfigsRequest, - dict, + cmek.ListEncryptionConfigsRequest(), + {}, ], ) def test_list_encryption_configs(request_type, transport: str = "grpc"): @@ -2366,7 +2391,7 @@ def test_list_encryption_configs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2419,12 +2444,13 @@ def test_list_encryption_configs_non_empty_request_with_auto_populated_field(): client.list_encryption_configs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cmek.ListEncryptionConfigsRequest( + request_msg = cmek.ListEncryptionConfigsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_encryption_configs_use_cached_wrapped_rpc(): @@ -2510,8 +2536,15 @@ async def test_list_encryption_configs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cmek.ListEncryptionConfigsRequest(), + {}, + ], +) async def test_list_encryption_configs_async( - transport: str = "grpc_asyncio", request_type=cmek.ListEncryptionConfigsRequest + request_type, transport: str = "grpc_asyncio" ): client = CmekServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2520,7 +2553,7 @@ async def test_list_encryption_configs_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( @@ -2547,11 +2580,6 @@ async def test_list_encryption_configs_async( assert response.unreachable_locations == ["unreachable_locations_value"] -@pytest.mark.asyncio -async def test_list_encryption_configs_async_from_dict(): - await test_list_encryption_configs_async(request_type=dict) - - def test_list_encryption_configs_field_headers(): client = CmekServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2904,8 +2932,8 @@ async def test_list_encryption_configs_async_pages(): @pytest.mark.parametrize( "request_type", [ - cmek.GetEncryptionConfigRequest, - dict, + cmek.GetEncryptionConfigRequest(), + {}, ], ) def test_get_encryption_config(request_type, transport: str = "grpc"): @@ -2916,7 +2944,7 @@ def test_get_encryption_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( @@ -2972,9 +3000,10 @@ def test_get_encryption_config_non_empty_request_with_auto_populated_field(): client.get_encryption_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cmek.GetEncryptionConfigRequest( + request_msg = cmek.GetEncryptionConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_encryption_config_use_cached_wrapped_rpc(): @@ -3060,8 +3089,15 @@ async def test_get_encryption_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cmek.GetEncryptionConfigRequest(), + {}, + ], +) async def test_get_encryption_config_async( - transport: str = "grpc_asyncio", request_type=cmek.GetEncryptionConfigRequest + request_type, transport: str = "grpc_asyncio" ): client = CmekServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3070,7 +3106,7 @@ async def test_get_encryption_config_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( @@ -3103,11 +3139,6 @@ async def test_get_encryption_config_async( assert response.enable_metastore_encryption is True -@pytest.mark.asyncio -async def test_get_encryption_config_async_from_dict(): - await test_get_encryption_config_async(request_type=dict) - - def test_get_encryption_config_field_headers(): client = CmekServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4419,7 +4450,6 @@ def test_create_encryption_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cmek.CreateEncryptionConfigRequest() - assert args[0] == request_msg @@ -4442,7 +4472,6 @@ def test_update_encryption_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cmek.UpdateEncryptionConfigRequest() - assert args[0] == request_msg @@ -4465,7 +4494,6 @@ def test_delete_encryption_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cmek.DeleteEncryptionConfigRequest() - assert args[0] == request_msg @@ -4488,7 +4516,6 @@ def test_list_encryption_configs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cmek.ListEncryptionConfigsRequest() - assert args[0] == request_msg @@ -4511,7 +4538,6 @@ def test_get_encryption_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cmek.GetEncryptionConfigRequest() - assert args[0] == request_msg @@ -4552,7 +4578,6 @@ async def test_create_encryption_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cmek.CreateEncryptionConfigRequest() - assert args[0] == request_msg @@ -4579,7 +4604,6 @@ async def test_update_encryption_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cmek.UpdateEncryptionConfigRequest() - assert args[0] == request_msg @@ -4606,7 +4630,6 @@ async def test_delete_encryption_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cmek.DeleteEncryptionConfigRequest() - assert args[0] == request_msg @@ -4636,7 +4659,6 @@ async def test_list_encryption_configs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cmek.ListEncryptionConfigsRequest() - assert args[0] == request_msg @@ -4669,7 +4691,6 @@ async def test_get_encryption_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cmek.GetEncryptionConfigRequest() - assert args[0] == request_msg @@ -6090,7 +6111,6 @@ def test_create_encryption_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cmek.CreateEncryptionConfigRequest() - assert args[0] == request_msg @@ -6112,7 +6132,6 @@ def test_update_encryption_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cmek.UpdateEncryptionConfigRequest() - assert args[0] == request_msg @@ -6134,7 +6153,6 @@ def test_delete_encryption_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cmek.DeleteEncryptionConfigRequest() - assert args[0] == request_msg @@ -6156,7 +6174,6 @@ def test_list_encryption_configs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cmek.ListEncryptionConfigsRequest() - assert args[0] == request_msg @@ -6178,7 +6195,6 @@ def test_get_encryption_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cmek.GetEncryptionConfigRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dataplex/tests/unit/gapic/dataplex_v1/test_content_service.py b/packages/google-cloud-dataplex/tests/unit/gapic/dataplex_v1/test_content_service.py index 6eaed7996fdc..d209aed5b638 100644 --- a/packages/google-cloud-dataplex/tests/unit/gapic/dataplex_v1/test_content_service.py +++ b/packages/google-cloud-dataplex/tests/unit/gapic/dataplex_v1/test_content_service.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-dataplex/tests/unit/gapic/dataplex_v1/test_data_product_service.py b/packages/google-cloud-dataplex/tests/unit/gapic/dataplex_v1/test_data_product_service.py index 45a73a51fa91..92edc17e2e25 100644 --- a/packages/google-cloud-dataplex/tests/unit/gapic/dataplex_v1/test_data_product_service.py +++ b/packages/google-cloud-dataplex/tests/unit/gapic/dataplex_v1/test_data_product_service.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 @@ -121,6 +122,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" @@ -1366,8 +1382,8 @@ def test_data_product_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - data_products.CreateDataProductRequest, - dict, + data_products.CreateDataProductRequest(), + {}, ], ) def test_create_data_product(request_type, transport: str = "grpc"): @@ -1378,7 +1394,7 @@ def test_create_data_product(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1424,10 +1440,11 @@ def test_create_data_product_non_empty_request_with_auto_populated_field(): client.create_data_product(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_products.CreateDataProductRequest( + request_msg = data_products.CreateDataProductRequest( parent="parent_value", data_product_id="data_product_id_value", ) + assert args[0] == request_msg def test_create_data_product_use_cached_wrapped_rpc(): @@ -1522,9 +1539,14 @@ async def test_create_data_product_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_data_product_async( - transport: str = "grpc_asyncio", request_type=data_products.CreateDataProductRequest -): +@pytest.mark.parametrize( + "request_type", + [ + data_products.CreateDataProductRequest(), + {}, + ], +) +async def test_create_data_product_async(request_type, transport: str = "grpc_asyncio"): client = DataProductServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1532,7 +1554,7 @@ async def test_create_data_product_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( @@ -1554,11 +1576,6 @@ async def test_create_data_product_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_data_product_async_from_dict(): - await test_create_data_product_async(request_type=dict) - - def test_create_data_product_field_headers(): client = DataProductServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1733,8 +1750,8 @@ async def test_create_data_product_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_products.DeleteDataProductRequest, - dict, + data_products.DeleteDataProductRequest(), + {}, ], ) def test_delete_data_product(request_type, transport: str = "grpc"): @@ -1745,7 +1762,7 @@ def test_delete_data_product(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1791,10 +1808,11 @@ def test_delete_data_product_non_empty_request_with_auto_populated_field(): client.delete_data_product(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_products.DeleteDataProductRequest( + request_msg = data_products.DeleteDataProductRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_data_product_use_cached_wrapped_rpc(): @@ -1889,9 +1907,14 @@ async def test_delete_data_product_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_data_product_async( - transport: str = "grpc_asyncio", request_type=data_products.DeleteDataProductRequest -): +@pytest.mark.parametrize( + "request_type", + [ + data_products.DeleteDataProductRequest(), + {}, + ], +) +async def test_delete_data_product_async(request_type, transport: str = "grpc_asyncio"): client = DataProductServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1899,7 +1922,7 @@ async def test_delete_data_product_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( @@ -1921,11 +1944,6 @@ async def test_delete_data_product_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_data_product_async_from_dict(): - await test_delete_data_product_async(request_type=dict) - - def test_delete_data_product_field_headers(): client = DataProductServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2080,8 +2098,8 @@ async def test_delete_data_product_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_products.GetDataProductRequest, - dict, + data_products.GetDataProductRequest(), + {}, ], ) def test_get_data_product(request_type, transport: str = "grpc"): @@ -2092,7 +2110,7 @@ def test_get_data_product(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_data_product), "__call__") as call: @@ -2150,9 +2168,10 @@ def test_get_data_product_non_empty_request_with_auto_populated_field(): client.get_data_product(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_products.GetDataProductRequest( + request_msg = data_products.GetDataProductRequest( name="name_value", ) + assert args[0] == request_msg def test_get_data_product_use_cached_wrapped_rpc(): @@ -2235,9 +2254,14 @@ async def test_get_data_product_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_data_product_async( - transport: str = "grpc_asyncio", request_type=data_products.GetDataProductRequest -): +@pytest.mark.parametrize( + "request_type", + [ + data_products.GetDataProductRequest(), + {}, + ], +) +async def test_get_data_product_async(request_type, transport: str = "grpc_asyncio"): client = DataProductServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2245,7 +2269,7 @@ async def test_get_data_product_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_data_product), "__call__") as call: @@ -2282,11 +2306,6 @@ async def test_get_data_product_async( assert response.asset_count == 1192 -@pytest.mark.asyncio -async def test_get_data_product_async_from_dict(): - await test_get_data_product_async(request_type=dict) - - def test_get_data_product_field_headers(): client = DataProductServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2433,8 +2452,8 @@ async def test_get_data_product_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_products.ListDataProductsRequest, - dict, + data_products.ListDataProductsRequest(), + {}, ], ) def test_list_data_products(request_type, transport: str = "grpc"): @@ -2445,7 +2464,7 @@ def test_list_data_products(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2498,12 +2517,13 @@ def test_list_data_products_non_empty_request_with_auto_populated_field(): client.list_data_products(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_products.ListDataProductsRequest( + request_msg = data_products.ListDataProductsRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_data_products_use_cached_wrapped_rpc(): @@ -2588,9 +2608,14 @@ async def test_list_data_products_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_data_products_async( - transport: str = "grpc_asyncio", request_type=data_products.ListDataProductsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + data_products.ListDataProductsRequest(), + {}, + ], +) +async def test_list_data_products_async(request_type, transport: str = "grpc_asyncio"): client = DataProductServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2598,7 +2623,7 @@ async def test_list_data_products_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( @@ -2625,11 +2650,6 @@ async def test_list_data_products_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_data_products_async_from_dict(): - await test_list_data_products_async(request_type=dict) - - def test_list_data_products_field_headers(): client = DataProductServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2982,8 +3002,8 @@ async def test_list_data_products_async_pages(): @pytest.mark.parametrize( "request_type", [ - data_products.UpdateDataProductRequest, - dict, + data_products.UpdateDataProductRequest(), + {}, ], ) def test_update_data_product(request_type, transport: str = "grpc"): @@ -2994,7 +3014,7 @@ def test_update_data_product(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3037,7 +3057,8 @@ def test_update_data_product_non_empty_request_with_auto_populated_field(): client.update_data_product(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_products.UpdateDataProductRequest() + request_msg = data_products.UpdateDataProductRequest() + assert args[0] == request_msg def test_update_data_product_use_cached_wrapped_rpc(): @@ -3132,9 +3153,14 @@ async def test_update_data_product_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_data_product_async( - transport: str = "grpc_asyncio", request_type=data_products.UpdateDataProductRequest -): +@pytest.mark.parametrize( + "request_type", + [ + data_products.UpdateDataProductRequest(), + {}, + ], +) +async def test_update_data_product_async(request_type, transport: str = "grpc_asyncio"): client = DataProductServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3142,7 +3168,7 @@ async def test_update_data_product_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( @@ -3164,11 +3190,6 @@ async def test_update_data_product_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_data_product_async_from_dict(): - await test_update_data_product_async(request_type=dict) - - def test_update_data_product_field_headers(): client = DataProductServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3333,8 +3354,8 @@ async def test_update_data_product_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_products.CreateDataAssetRequest, - dict, + data_products.CreateDataAssetRequest(), + {}, ], ) def test_create_data_asset(request_type, transport: str = "grpc"): @@ -3345,7 +3366,7 @@ def test_create_data_asset(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3391,10 +3412,11 @@ def test_create_data_asset_non_empty_request_with_auto_populated_field(): client.create_data_asset(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_products.CreateDataAssetRequest( + request_msg = data_products.CreateDataAssetRequest( parent="parent_value", data_asset_id="data_asset_id_value", ) + assert args[0] == request_msg def test_create_data_asset_use_cached_wrapped_rpc(): @@ -3487,9 +3509,14 @@ async def test_create_data_asset_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_data_asset_async( - transport: str = "grpc_asyncio", request_type=data_products.CreateDataAssetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + data_products.CreateDataAssetRequest(), + {}, + ], +) +async def test_create_data_asset_async(request_type, transport: str = "grpc_asyncio"): client = DataProductServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3497,7 +3524,7 @@ async def test_create_data_asset_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( @@ -3519,11 +3546,6 @@ async def test_create_data_asset_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_data_asset_async_from_dict(): - await test_create_data_asset_async(request_type=dict) - - def test_create_data_asset_field_headers(): client = DataProductServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3698,8 +3720,8 @@ async def test_create_data_asset_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_products.UpdateDataAssetRequest, - dict, + data_products.UpdateDataAssetRequest(), + {}, ], ) def test_update_data_asset(request_type, transport: str = "grpc"): @@ -3710,7 +3732,7 @@ def test_update_data_asset(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3753,7 +3775,8 @@ def test_update_data_asset_non_empty_request_with_auto_populated_field(): client.update_data_asset(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_products.UpdateDataAssetRequest() + request_msg = data_products.UpdateDataAssetRequest() + assert args[0] == request_msg def test_update_data_asset_use_cached_wrapped_rpc(): @@ -3846,9 +3869,14 @@ async def test_update_data_asset_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_data_asset_async( - transport: str = "grpc_asyncio", request_type=data_products.UpdateDataAssetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + data_products.UpdateDataAssetRequest(), + {}, + ], +) +async def test_update_data_asset_async(request_type, transport: str = "grpc_asyncio"): client = DataProductServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3856,7 +3884,7 @@ async def test_update_data_asset_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( @@ -3878,11 +3906,6 @@ async def test_update_data_asset_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_data_asset_async_from_dict(): - await test_update_data_asset_async(request_type=dict) - - def test_update_data_asset_field_headers(): client = DataProductServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4047,8 +4070,8 @@ async def test_update_data_asset_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_products.DeleteDataAssetRequest, - dict, + data_products.DeleteDataAssetRequest(), + {}, ], ) def test_delete_data_asset(request_type, transport: str = "grpc"): @@ -4059,7 +4082,7 @@ def test_delete_data_asset(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4105,10 +4128,11 @@ def test_delete_data_asset_non_empty_request_with_auto_populated_field(): client.delete_data_asset(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_products.DeleteDataAssetRequest( + request_msg = data_products.DeleteDataAssetRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_data_asset_use_cached_wrapped_rpc(): @@ -4201,9 +4225,14 @@ async def test_delete_data_asset_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_data_asset_async( - transport: str = "grpc_asyncio", request_type=data_products.DeleteDataAssetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + data_products.DeleteDataAssetRequest(), + {}, + ], +) +async def test_delete_data_asset_async(request_type, transport: str = "grpc_asyncio"): client = DataProductServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4211,7 +4240,7 @@ async def test_delete_data_asset_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( @@ -4233,11 +4262,6 @@ async def test_delete_data_asset_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_data_asset_async_from_dict(): - await test_delete_data_asset_async(request_type=dict) - - def test_delete_data_asset_field_headers(): client = DataProductServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4392,8 +4416,8 @@ async def test_delete_data_asset_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_products.GetDataAssetRequest, - dict, + data_products.GetDataAssetRequest(), + {}, ], ) def test_get_data_asset(request_type, transport: str = "grpc"): @@ -4404,7 +4428,7 @@ def test_get_data_asset(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_data_asset), "__call__") as call: @@ -4454,9 +4478,10 @@ def test_get_data_asset_non_empty_request_with_auto_populated_field(): client.get_data_asset(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_products.GetDataAssetRequest( + request_msg = data_products.GetDataAssetRequest( name="name_value", ) + assert args[0] == request_msg def test_get_data_asset_use_cached_wrapped_rpc(): @@ -4537,9 +4562,14 @@ async def test_get_data_asset_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_data_asset_async( - transport: str = "grpc_asyncio", request_type=data_products.GetDataAssetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + data_products.GetDataAssetRequest(), + {}, + ], +) +async def test_get_data_asset_async(request_type, transport: str = "grpc_asyncio"): client = DataProductServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4547,7 +4577,7 @@ async def test_get_data_asset_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_data_asset), "__call__") as call: @@ -4576,11 +4606,6 @@ async def test_get_data_asset_async( assert response.resource == "resource_value" -@pytest.mark.asyncio -async def test_get_data_asset_async_from_dict(): - await test_get_data_asset_async(request_type=dict) - - def test_get_data_asset_field_headers(): client = DataProductServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4727,8 +4752,8 @@ async def test_get_data_asset_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_products.ListDataAssetsRequest, - dict, + data_products.ListDataAssetsRequest(), + {}, ], ) def test_list_data_assets(request_type, transport: str = "grpc"): @@ -4739,7 +4764,7 @@ def test_list_data_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(type(client.transport.list_data_assets), "__call__") as call: @@ -4786,12 +4811,13 @@ def test_list_data_assets_non_empty_request_with_auto_populated_field(): client.list_data_assets(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_products.ListDataAssetsRequest( + request_msg = data_products.ListDataAssetsRequest( parent="parent_value", filter="filter_value", order_by="order_by_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_data_assets_use_cached_wrapped_rpc(): @@ -4874,9 +4900,14 @@ async def test_list_data_assets_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_data_assets_async( - transport: str = "grpc_asyncio", request_type=data_products.ListDataAssetsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + data_products.ListDataAssetsRequest(), + {}, + ], +) +async def test_list_data_assets_async(request_type, transport: str = "grpc_asyncio"): client = DataProductServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4884,7 +4915,7 @@ async def test_list_data_assets_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_data_assets), "__call__") as call: @@ -4907,11 +4938,6 @@ async def test_list_data_assets_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_data_assets_async_from_dict(): - await test_list_data_assets_async(request_type=dict) - - def test_list_data_assets_field_headers(): client = DataProductServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7462,7 +7488,6 @@ def test_create_data_product_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_products.CreateDataProductRequest() - assert args[0] == request_msg @@ -7485,7 +7510,6 @@ def test_delete_data_product_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_products.DeleteDataProductRequest() - assert args[0] == request_msg @@ -7506,7 +7530,6 @@ def test_get_data_product_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_products.GetDataProductRequest() - assert args[0] == request_msg @@ -7529,7 +7552,6 @@ def test_list_data_products_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_products.ListDataProductsRequest() - assert args[0] == request_msg @@ -7552,7 +7574,6 @@ def test_update_data_product_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_products.UpdateDataProductRequest() - assert args[0] == request_msg @@ -7575,7 +7596,6 @@ def test_create_data_asset_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_products.CreateDataAssetRequest() - assert args[0] == request_msg @@ -7598,7 +7618,6 @@ def test_update_data_asset_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_products.UpdateDataAssetRequest() - assert args[0] == request_msg @@ -7621,7 +7640,6 @@ def test_delete_data_asset_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_products.DeleteDataAssetRequest() - assert args[0] == request_msg @@ -7642,7 +7660,6 @@ def test_get_data_asset_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_products.GetDataAssetRequest() - assert args[0] == request_msg @@ -7663,7 +7680,6 @@ def test_list_data_assets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_products.ListDataAssetsRequest() - assert args[0] == request_msg @@ -7704,7 +7720,6 @@ async def test_create_data_product_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_products.CreateDataProductRequest() - assert args[0] == request_msg @@ -7731,7 +7746,6 @@ async def test_delete_data_product_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_products.DeleteDataProductRequest() - assert args[0] == request_msg @@ -7765,7 +7779,6 @@ async def test_get_data_product_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_products.GetDataProductRequest() - assert args[0] == request_msg @@ -7795,7 +7808,6 @@ async def test_list_data_products_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_products.ListDataProductsRequest() - assert args[0] == request_msg @@ -7822,7 +7834,6 @@ async def test_update_data_product_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_products.UpdateDataProductRequest() - assert args[0] == request_msg @@ -7849,7 +7860,6 @@ async def test_create_data_asset_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_products.CreateDataAssetRequest() - assert args[0] == request_msg @@ -7876,7 +7886,6 @@ async def test_update_data_asset_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_products.UpdateDataAssetRequest() - assert args[0] == request_msg @@ -7903,7 +7912,6 @@ async def test_delete_data_asset_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_products.DeleteDataAssetRequest() - assert args[0] == request_msg @@ -7933,7 +7941,6 @@ async def test_get_data_asset_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_products.GetDataAssetRequest() - assert args[0] == request_msg @@ -7960,7 +7967,6 @@ async def test_list_data_assets_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_products.ListDataAssetsRequest() - assert args[0] == request_msg @@ -10211,7 +10217,6 @@ def test_create_data_product_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_products.CreateDataProductRequest() - assert args[0] == request_msg @@ -10233,7 +10238,6 @@ def test_delete_data_product_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_products.DeleteDataProductRequest() - assert args[0] == request_msg @@ -10253,7 +10257,6 @@ def test_get_data_product_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_products.GetDataProductRequest() - assert args[0] == request_msg @@ -10275,7 +10278,6 @@ def test_list_data_products_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_products.ListDataProductsRequest() - assert args[0] == request_msg @@ -10297,7 +10299,6 @@ def test_update_data_product_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_products.UpdateDataProductRequest() - assert args[0] == request_msg @@ -10319,7 +10320,6 @@ def test_create_data_asset_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_products.CreateDataAssetRequest() - assert args[0] == request_msg @@ -10341,7 +10341,6 @@ def test_update_data_asset_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_products.UpdateDataAssetRequest() - assert args[0] == request_msg @@ -10363,7 +10362,6 @@ def test_delete_data_asset_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_products.DeleteDataAssetRequest() - assert args[0] == request_msg @@ -10383,7 +10381,6 @@ def test_get_data_asset_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_products.GetDataAssetRequest() - assert args[0] == request_msg @@ -10403,7 +10400,6 @@ def test_list_data_assets_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_products.ListDataAssetsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dataplex/tests/unit/gapic/dataplex_v1/test_data_scan_service.py b/packages/google-cloud-dataplex/tests/unit/gapic/dataplex_v1/test_data_scan_service.py index 3dfd36525ad3..ddd6e04143ed 100644 --- a/packages/google-cloud-dataplex/tests/unit/gapic/dataplex_v1/test_data_scan_service.py +++ b/packages/google-cloud-dataplex/tests/unit/gapic/dataplex_v1/test_data_scan_service.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 @@ -132,6 +133,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" @@ -1359,8 +1375,8 @@ def test_data_scan_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - datascans.CreateDataScanRequest, - dict, + datascans.CreateDataScanRequest(), + {}, ], ) def test_create_data_scan(request_type, transport: str = "grpc"): @@ -1371,7 +1387,7 @@ def test_create_data_scan(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_data_scan), "__call__") as call: @@ -1413,10 +1429,11 @@ def test_create_data_scan_non_empty_request_with_auto_populated_field(): client.create_data_scan(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datascans.CreateDataScanRequest( + request_msg = datascans.CreateDataScanRequest( parent="parent_value", data_scan_id="data_scan_id_value", ) + assert args[0] == request_msg def test_create_data_scan_use_cached_wrapped_rpc(): @@ -1509,9 +1526,14 @@ async def test_create_data_scan_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_data_scan_async( - transport: str = "grpc_asyncio", request_type=datascans.CreateDataScanRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datascans.CreateDataScanRequest(), + {}, + ], +) +async def test_create_data_scan_async(request_type, transport: str = "grpc_asyncio"): client = DataScanServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1519,7 +1541,7 @@ async def test_create_data_scan_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_data_scan), "__call__") as call: @@ -1539,11 +1561,6 @@ async def test_create_data_scan_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_data_scan_async_from_dict(): - await test_create_data_scan_async(request_type=dict) - - def test_create_data_scan_field_headers(): client = DataScanServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1710,8 +1727,8 @@ async def test_create_data_scan_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datascans.UpdateDataScanRequest, - dict, + datascans.UpdateDataScanRequest(), + {}, ], ) def test_update_data_scan(request_type, transport: str = "grpc"): @@ -1722,7 +1739,7 @@ def test_update_data_scan(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_data_scan), "__call__") as call: @@ -1761,7 +1778,8 @@ def test_update_data_scan_non_empty_request_with_auto_populated_field(): client.update_data_scan(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datascans.UpdateDataScanRequest() + request_msg = datascans.UpdateDataScanRequest() + assert args[0] == request_msg def test_update_data_scan_use_cached_wrapped_rpc(): @@ -1854,9 +1872,14 @@ async def test_update_data_scan_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_data_scan_async( - transport: str = "grpc_asyncio", request_type=datascans.UpdateDataScanRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datascans.UpdateDataScanRequest(), + {}, + ], +) +async def test_update_data_scan_async(request_type, transport: str = "grpc_asyncio"): client = DataScanServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1864,7 +1887,7 @@ async def test_update_data_scan_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_data_scan), "__call__") as call: @@ -1884,11 +1907,6 @@ async def test_update_data_scan_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_data_scan_async_from_dict(): - await test_update_data_scan_async(request_type=dict) - - def test_update_data_scan_field_headers(): client = DataScanServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2045,8 +2063,8 @@ async def test_update_data_scan_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datascans.DeleteDataScanRequest, - dict, + datascans.DeleteDataScanRequest(), + {}, ], ) def test_delete_data_scan(request_type, transport: str = "grpc"): @@ -2057,7 +2075,7 @@ def test_delete_data_scan(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_data_scan), "__call__") as call: @@ -2098,9 +2116,10 @@ def test_delete_data_scan_non_empty_request_with_auto_populated_field(): client.delete_data_scan(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datascans.DeleteDataScanRequest( + request_msg = datascans.DeleteDataScanRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_data_scan_use_cached_wrapped_rpc(): @@ -2193,9 +2212,14 @@ async def test_delete_data_scan_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_data_scan_async( - transport: str = "grpc_asyncio", request_type=datascans.DeleteDataScanRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datascans.DeleteDataScanRequest(), + {}, + ], +) +async def test_delete_data_scan_async(request_type, transport: str = "grpc_asyncio"): client = DataScanServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2203,7 +2227,7 @@ async def test_delete_data_scan_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_data_scan), "__call__") as call: @@ -2223,11 +2247,6 @@ async def test_delete_data_scan_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_data_scan_async_from_dict(): - await test_delete_data_scan_async(request_type=dict) - - def test_delete_data_scan_field_headers(): client = DataScanServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2374,8 +2393,8 @@ async def test_delete_data_scan_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datascans.GetDataScanRequest, - dict, + datascans.GetDataScanRequest(), + {}, ], ) def test_get_data_scan(request_type, transport: str = "grpc"): @@ -2386,7 +2405,7 @@ def test_get_data_scan(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_data_scan), "__call__") as call: @@ -2440,9 +2459,10 @@ def test_get_data_scan_non_empty_request_with_auto_populated_field(): client.get_data_scan(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datascans.GetDataScanRequest( + request_msg = datascans.GetDataScanRequest( name="name_value", ) + assert args[0] == request_msg def test_get_data_scan_use_cached_wrapped_rpc(): @@ -2523,9 +2543,14 @@ async def test_get_data_scan_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_data_scan_async( - transport: str = "grpc_asyncio", request_type=datascans.GetDataScanRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datascans.GetDataScanRequest(), + {}, + ], +) +async def test_get_data_scan_async(request_type, transport: str = "grpc_asyncio"): client = DataScanServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2533,7 +2558,7 @@ async def test_get_data_scan_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_data_scan), "__call__") as call: @@ -2566,11 +2591,6 @@ async def test_get_data_scan_async( assert response.type_ == datascans.DataScanType.DATA_QUALITY -@pytest.mark.asyncio -async def test_get_data_scan_async_from_dict(): - await test_get_data_scan_async(request_type=dict) - - def test_get_data_scan_field_headers(): client = DataScanServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2713,8 +2733,8 @@ async def test_get_data_scan_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datascans.ListDataScansRequest, - dict, + datascans.ListDataScansRequest(), + {}, ], ) def test_list_data_scans(request_type, transport: str = "grpc"): @@ -2725,7 +2745,7 @@ def test_list_data_scans(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_data_scans), "__call__") as call: @@ -2774,12 +2794,13 @@ def test_list_data_scans_non_empty_request_with_auto_populated_field(): client.list_data_scans(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datascans.ListDataScansRequest( + request_msg = datascans.ListDataScansRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_data_scans_use_cached_wrapped_rpc(): @@ -2860,9 +2881,14 @@ async def test_list_data_scans_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_data_scans_async( - transport: str = "grpc_asyncio", request_type=datascans.ListDataScansRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datascans.ListDataScansRequest(), + {}, + ], +) +async def test_list_data_scans_async(request_type, transport: str = "grpc_asyncio"): client = DataScanServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2870,7 +2896,7 @@ async def test_list_data_scans_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_data_scans), "__call__") as call: @@ -2895,11 +2921,6 @@ async def test_list_data_scans_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_data_scans_async_from_dict(): - await test_list_data_scans_async(request_type=dict) - - def test_list_data_scans_field_headers(): client = DataScanServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3236,8 +3257,8 @@ async def test_list_data_scans_async_pages(): @pytest.mark.parametrize( "request_type", [ - datascans.RunDataScanRequest, - dict, + datascans.RunDataScanRequest(), + {}, ], ) def test_run_data_scan(request_type, transport: str = "grpc"): @@ -3248,7 +3269,7 @@ def test_run_data_scan(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.run_data_scan), "__call__") as call: @@ -3289,9 +3310,10 @@ def test_run_data_scan_non_empty_request_with_auto_populated_field(): client.run_data_scan(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datascans.RunDataScanRequest( + request_msg = datascans.RunDataScanRequest( name="name_value", ) + assert args[0] == request_msg def test_run_data_scan_use_cached_wrapped_rpc(): @@ -3372,9 +3394,14 @@ async def test_run_data_scan_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_run_data_scan_async( - transport: str = "grpc_asyncio", request_type=datascans.RunDataScanRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datascans.RunDataScanRequest(), + {}, + ], +) +async def test_run_data_scan_async(request_type, transport: str = "grpc_asyncio"): client = DataScanServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3382,7 +3409,7 @@ async def test_run_data_scan_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.run_data_scan), "__call__") as call: @@ -3402,11 +3429,6 @@ async def test_run_data_scan_async( assert isinstance(response, datascans.RunDataScanResponse) -@pytest.mark.asyncio -async def test_run_data_scan_async_from_dict(): - await test_run_data_scan_async(request_type=dict) - - def test_run_data_scan_field_headers(): client = DataScanServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3553,8 +3575,8 @@ async def test_run_data_scan_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datascans.GetDataScanJobRequest, - dict, + datascans.GetDataScanJobRequest(), + {}, ], ) def test_get_data_scan_job(request_type, transport: str = "grpc"): @@ -3565,7 +3587,7 @@ def test_get_data_scan_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( @@ -3621,9 +3643,10 @@ def test_get_data_scan_job_non_empty_request_with_auto_populated_field(): client.get_data_scan_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datascans.GetDataScanJobRequest( + request_msg = datascans.GetDataScanJobRequest( name="name_value", ) + assert args[0] == request_msg def test_get_data_scan_job_use_cached_wrapped_rpc(): @@ -3706,9 +3729,14 @@ async def test_get_data_scan_job_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_data_scan_job_async( - transport: str = "grpc_asyncio", request_type=datascans.GetDataScanJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datascans.GetDataScanJobRequest(), + {}, + ], +) +async def test_get_data_scan_job_async(request_type, transport: str = "grpc_asyncio"): client = DataScanServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3716,7 +3744,7 @@ async def test_get_data_scan_job_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( @@ -3749,11 +3777,6 @@ async def test_get_data_scan_job_async( assert response.type_ == datascans.DataScanType.DATA_QUALITY -@pytest.mark.asyncio -async def test_get_data_scan_job_async_from_dict(): - await test_get_data_scan_job_async(request_type=dict) - - def test_get_data_scan_job_field_headers(): client = DataScanServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3908,8 +3931,8 @@ async def test_get_data_scan_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datascans.ListDataScanJobsRequest, - dict, + datascans.ListDataScanJobsRequest(), + {}, ], ) def test_list_data_scan_jobs(request_type, transport: str = "grpc"): @@ -3920,7 +3943,7 @@ def test_list_data_scan_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( @@ -3970,11 +3993,12 @@ def test_list_data_scan_jobs_non_empty_request_with_auto_populated_field(): client.list_data_scan_jobs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datascans.ListDataScanJobsRequest( + request_msg = datascans.ListDataScanJobsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_data_scan_jobs_use_cached_wrapped_rpc(): @@ -4059,9 +4083,14 @@ async def test_list_data_scan_jobs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_data_scan_jobs_async( - transport: str = "grpc_asyncio", request_type=datascans.ListDataScanJobsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datascans.ListDataScanJobsRequest(), + {}, + ], +) +async def test_list_data_scan_jobs_async(request_type, transport: str = "grpc_asyncio"): client = DataScanServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4069,7 +4098,7 @@ async def test_list_data_scan_jobs_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( @@ -4094,11 +4123,6 @@ async def test_list_data_scan_jobs_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_data_scan_jobs_async_from_dict(): - await test_list_data_scan_jobs_async(request_type=dict) - - def test_list_data_scan_jobs_field_headers(): client = DataScanServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4451,8 +4475,8 @@ async def test_list_data_scan_jobs_async_pages(): @pytest.mark.parametrize( "request_type", [ - datascans.GenerateDataQualityRulesRequest, - dict, + datascans.GenerateDataQualityRulesRequest(), + {}, ], ) def test_generate_data_quality_rules(request_type, transport: str = "grpc"): @@ -4463,7 +4487,7 @@ def test_generate_data_quality_rules(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4508,9 +4532,10 @@ def test_generate_data_quality_rules_non_empty_request_with_auto_populated_field client.generate_data_quality_rules(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datascans.GenerateDataQualityRulesRequest( + request_msg = datascans.GenerateDataQualityRulesRequest( name="name_value", ) + assert args[0] == request_msg def test_generate_data_quality_rules_use_cached_wrapped_rpc(): @@ -4596,9 +4621,15 @@ async def test_generate_data_quality_rules_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + datascans.GenerateDataQualityRulesRequest(), + {}, + ], +) async def test_generate_data_quality_rules_async( - transport: str = "grpc_asyncio", - request_type=datascans.GenerateDataQualityRulesRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataScanServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4607,7 +4638,7 @@ async def test_generate_data_quality_rules_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( @@ -4629,11 +4660,6 @@ async def test_generate_data_quality_rules_async( assert isinstance(response, datascans.GenerateDataQualityRulesResponse) -@pytest.mark.asyncio -async def test_generate_data_quality_rules_async_from_dict(): - await test_generate_data_quality_rules_async(request_type=dict) - - def test_generate_data_quality_rules_field_headers(): client = DataScanServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6754,7 +6780,6 @@ def test_create_data_scan_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datascans.CreateDataScanRequest() - assert args[0] == request_msg @@ -6775,7 +6800,6 @@ def test_update_data_scan_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datascans.UpdateDataScanRequest() - assert args[0] == request_msg @@ -6796,7 +6820,6 @@ def test_delete_data_scan_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datascans.DeleteDataScanRequest() - assert args[0] == request_msg @@ -6817,7 +6840,6 @@ def test_get_data_scan_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datascans.GetDataScanRequest() - assert args[0] == request_msg @@ -6838,7 +6860,6 @@ def test_list_data_scans_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datascans.ListDataScansRequest() - assert args[0] == request_msg @@ -6859,7 +6880,6 @@ def test_run_data_scan_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datascans.RunDataScanRequest() - assert args[0] == request_msg @@ -6882,7 +6902,6 @@ def test_get_data_scan_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datascans.GetDataScanJobRequest() - assert args[0] == request_msg @@ -6905,7 +6924,6 @@ def test_list_data_scan_jobs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datascans.ListDataScanJobsRequest() - assert args[0] == request_msg @@ -6928,7 +6946,6 @@ def test_generate_data_quality_rules_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datascans.GenerateDataQualityRulesRequest() - assert args[0] == request_msg @@ -6967,7 +6984,6 @@ async def test_create_data_scan_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datascans.CreateDataScanRequest() - assert args[0] == request_msg @@ -6992,7 +7008,6 @@ async def test_update_data_scan_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datascans.UpdateDataScanRequest() - assert args[0] == request_msg @@ -7017,7 +7032,6 @@ async def test_delete_data_scan_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datascans.DeleteDataScanRequest() - assert args[0] == request_msg @@ -7049,7 +7063,6 @@ async def test_get_data_scan_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datascans.GetDataScanRequest() - assert args[0] == request_msg @@ -7077,7 +7090,6 @@ async def test_list_data_scans_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datascans.ListDataScansRequest() - assert args[0] == request_msg @@ -7102,7 +7114,6 @@ async def test_run_data_scan_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datascans.RunDataScanRequest() - assert args[0] == request_msg @@ -7135,7 +7146,6 @@ async def test_get_data_scan_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datascans.GetDataScanJobRequest() - assert args[0] == request_msg @@ -7164,7 +7174,6 @@ async def test_list_data_scan_jobs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datascans.ListDataScanJobsRequest() - assert args[0] == request_msg @@ -7191,7 +7200,6 @@ async def test_generate_data_quality_rules_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datascans.GenerateDataQualityRulesRequest() - assert args[0] == request_msg @@ -9656,7 +9664,6 @@ def test_create_data_scan_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datascans.CreateDataScanRequest() - assert args[0] == request_msg @@ -9676,7 +9683,6 @@ def test_update_data_scan_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datascans.UpdateDataScanRequest() - assert args[0] == request_msg @@ -9696,7 +9702,6 @@ def test_delete_data_scan_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datascans.DeleteDataScanRequest() - assert args[0] == request_msg @@ -9716,7 +9721,6 @@ def test_get_data_scan_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datascans.GetDataScanRequest() - assert args[0] == request_msg @@ -9736,7 +9740,6 @@ def test_list_data_scans_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datascans.ListDataScansRequest() - assert args[0] == request_msg @@ -9756,7 +9759,6 @@ def test_run_data_scan_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datascans.RunDataScanRequest() - assert args[0] == request_msg @@ -9778,7 +9780,6 @@ def test_get_data_scan_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datascans.GetDataScanJobRequest() - assert args[0] == request_msg @@ -9800,7 +9801,6 @@ def test_list_data_scan_jobs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datascans.ListDataScanJobsRequest() - assert args[0] == request_msg @@ -9822,7 +9822,6 @@ def test_generate_data_quality_rules_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datascans.GenerateDataQualityRulesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dataplex/tests/unit/gapic/dataplex_v1/test_data_taxonomy_service.py b/packages/google-cloud-dataplex/tests/unit/gapic/dataplex_v1/test_data_taxonomy_service.py index 127726384a9c..f2390303d714 100644 --- a/packages/google-cloud-dataplex/tests/unit/gapic/dataplex_v1/test_data_taxonomy_service.py +++ b/packages/google-cloud-dataplex/tests/unit/gapic/dataplex_v1/test_data_taxonomy_service.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 @@ -122,6 +123,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" @@ -1385,8 +1401,8 @@ def test_data_taxonomy_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - gcd_data_taxonomy.CreateDataTaxonomyRequest, - dict, + gcd_data_taxonomy.CreateDataTaxonomyRequest(), + {}, ], ) def test_create_data_taxonomy(request_type, transport: str = "grpc"): @@ -1397,7 +1413,7 @@ def test_create_data_taxonomy(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1443,10 +1459,11 @@ def test_create_data_taxonomy_non_empty_request_with_auto_populated_field(): client.create_data_taxonomy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_data_taxonomy.CreateDataTaxonomyRequest( + request_msg = gcd_data_taxonomy.CreateDataTaxonomyRequest( parent="parent_value", data_taxonomy_id="data_taxonomy_id_value", ) + assert args[0] == request_msg def test_create_data_taxonomy_use_cached_wrapped_rpc(): @@ -1541,9 +1558,15 @@ async def test_create_data_taxonomy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcd_data_taxonomy.CreateDataTaxonomyRequest(), + {}, + ], +) async def test_create_data_taxonomy_async( - transport: str = "grpc_asyncio", - request_type=gcd_data_taxonomy.CreateDataTaxonomyRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataTaxonomyServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1552,7 +1575,7 @@ async def test_create_data_taxonomy_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( @@ -1574,11 +1597,6 @@ async def test_create_data_taxonomy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_data_taxonomy_async_from_dict(): - await test_create_data_taxonomy_async(request_type=dict) - - def test_create_data_taxonomy_field_headers(): client = DataTaxonomyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1753,8 +1771,8 @@ async def test_create_data_taxonomy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcd_data_taxonomy.UpdateDataTaxonomyRequest, - dict, + gcd_data_taxonomy.UpdateDataTaxonomyRequest(), + {}, ], ) def test_update_data_taxonomy(request_type, transport: str = "grpc"): @@ -1765,7 +1783,7 @@ def test_update_data_taxonomy(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1808,7 +1826,8 @@ def test_update_data_taxonomy_non_empty_request_with_auto_populated_field(): client.update_data_taxonomy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_data_taxonomy.UpdateDataTaxonomyRequest() + request_msg = gcd_data_taxonomy.UpdateDataTaxonomyRequest() + assert args[0] == request_msg def test_update_data_taxonomy_use_cached_wrapped_rpc(): @@ -1903,9 +1922,15 @@ async def test_update_data_taxonomy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcd_data_taxonomy.UpdateDataTaxonomyRequest(), + {}, + ], +) async def test_update_data_taxonomy_async( - transport: str = "grpc_asyncio", - request_type=gcd_data_taxonomy.UpdateDataTaxonomyRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataTaxonomyServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1914,7 +1939,7 @@ async def test_update_data_taxonomy_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( @@ -1936,11 +1961,6 @@ async def test_update_data_taxonomy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_data_taxonomy_async_from_dict(): - await test_update_data_taxonomy_async(request_type=dict) - - def test_update_data_taxonomy_field_headers(): client = DataTaxonomyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2105,8 +2125,8 @@ async def test_update_data_taxonomy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_taxonomy.DeleteDataTaxonomyRequest, - dict, + data_taxonomy.DeleteDataTaxonomyRequest(), + {}, ], ) def test_delete_data_taxonomy(request_type, transport: str = "grpc"): @@ -2117,7 +2137,7 @@ def test_delete_data_taxonomy(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2163,10 +2183,11 @@ def test_delete_data_taxonomy_non_empty_request_with_auto_populated_field(): client.delete_data_taxonomy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_taxonomy.DeleteDataTaxonomyRequest( + request_msg = data_taxonomy.DeleteDataTaxonomyRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_data_taxonomy_use_cached_wrapped_rpc(): @@ -2261,9 +2282,15 @@ async def test_delete_data_taxonomy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_taxonomy.DeleteDataTaxonomyRequest(), + {}, + ], +) async def test_delete_data_taxonomy_async( - transport: str = "grpc_asyncio", - request_type=data_taxonomy.DeleteDataTaxonomyRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataTaxonomyServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2272,7 +2299,7 @@ async def test_delete_data_taxonomy_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( @@ -2294,11 +2321,6 @@ async def test_delete_data_taxonomy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_data_taxonomy_async_from_dict(): - await test_delete_data_taxonomy_async(request_type=dict) - - def test_delete_data_taxonomy_field_headers(): client = DataTaxonomyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2453,8 +2475,8 @@ async def test_delete_data_taxonomy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_taxonomy.ListDataTaxonomiesRequest, - dict, + data_taxonomy.ListDataTaxonomiesRequest(), + {}, ], ) def test_list_data_taxonomies(request_type, transport: str = "grpc"): @@ -2465,7 +2487,7 @@ def test_list_data_taxonomies(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2518,12 +2540,13 @@ def test_list_data_taxonomies_non_empty_request_with_auto_populated_field(): client.list_data_taxonomies(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_taxonomy.ListDataTaxonomiesRequest( + request_msg = data_taxonomy.ListDataTaxonomiesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_data_taxonomies_use_cached_wrapped_rpc(): @@ -2608,9 +2631,15 @@ async def test_list_data_taxonomies_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_taxonomy.ListDataTaxonomiesRequest(), + {}, + ], +) async def test_list_data_taxonomies_async( - transport: str = "grpc_asyncio", - request_type=data_taxonomy.ListDataTaxonomiesRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataTaxonomyServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2619,7 +2648,7 @@ async def test_list_data_taxonomies_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( @@ -2646,11 +2675,6 @@ async def test_list_data_taxonomies_async( assert response.unreachable_locations == ["unreachable_locations_value"] -@pytest.mark.asyncio -async def test_list_data_taxonomies_async_from_dict(): - await test_list_data_taxonomies_async(request_type=dict) - - def test_list_data_taxonomies_field_headers(): client = DataTaxonomyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3003,8 +3027,8 @@ async def test_list_data_taxonomies_async_pages(): @pytest.mark.parametrize( "request_type", [ - data_taxonomy.GetDataTaxonomyRequest, - dict, + data_taxonomy.GetDataTaxonomyRequest(), + {}, ], ) def test_get_data_taxonomy(request_type, transport: str = "grpc"): @@ -3015,7 +3039,7 @@ def test_get_data_taxonomy(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3075,9 +3099,10 @@ def test_get_data_taxonomy_non_empty_request_with_auto_populated_field(): client.get_data_taxonomy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_taxonomy.GetDataTaxonomyRequest( + request_msg = data_taxonomy.GetDataTaxonomyRequest( name="name_value", ) + assert args[0] == request_msg def test_get_data_taxonomy_use_cached_wrapped_rpc(): @@ -3160,9 +3185,14 @@ async def test_get_data_taxonomy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_data_taxonomy_async( - transport: str = "grpc_asyncio", request_type=data_taxonomy.GetDataTaxonomyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + data_taxonomy.GetDataTaxonomyRequest(), + {}, + ], +) +async def test_get_data_taxonomy_async(request_type, transport: str = "grpc_asyncio"): client = DataTaxonomyServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3170,7 +3200,7 @@ async def test_get_data_taxonomy_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( @@ -3207,11 +3237,6 @@ async def test_get_data_taxonomy_async( assert response.class_count == 1182 -@pytest.mark.asyncio -async def test_get_data_taxonomy_async_from_dict(): - await test_get_data_taxonomy_async(request_type=dict) - - def test_get_data_taxonomy_field_headers(): client = DataTaxonomyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3366,8 +3391,8 @@ async def test_get_data_taxonomy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_taxonomy.CreateDataAttributeBindingRequest, - dict, + data_taxonomy.CreateDataAttributeBindingRequest(), + {}, ], ) def test_create_data_attribute_binding(request_type, transport: str = "grpc"): @@ -3378,7 +3403,7 @@ def test_create_data_attribute_binding(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3424,10 +3449,11 @@ def test_create_data_attribute_binding_non_empty_request_with_auto_populated_fie client.create_data_attribute_binding(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_taxonomy.CreateDataAttributeBindingRequest( + request_msg = data_taxonomy.CreateDataAttributeBindingRequest( parent="parent_value", data_attribute_binding_id="data_attribute_binding_id_value", ) + assert args[0] == request_msg def test_create_data_attribute_binding_use_cached_wrapped_rpc(): @@ -3523,9 +3549,15 @@ async def test_create_data_attribute_binding_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_taxonomy.CreateDataAttributeBindingRequest(), + {}, + ], +) async def test_create_data_attribute_binding_async( - transport: str = "grpc_asyncio", - request_type=data_taxonomy.CreateDataAttributeBindingRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataTaxonomyServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3534,7 +3566,7 @@ async def test_create_data_attribute_binding_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( @@ -3556,11 +3588,6 @@ async def test_create_data_attribute_binding_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_data_attribute_binding_async_from_dict(): - await test_create_data_attribute_binding_async(request_type=dict) - - def test_create_data_attribute_binding_field_headers(): client = DataTaxonomyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3743,8 +3770,8 @@ async def test_create_data_attribute_binding_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_taxonomy.UpdateDataAttributeBindingRequest, - dict, + data_taxonomy.UpdateDataAttributeBindingRequest(), + {}, ], ) def test_update_data_attribute_binding(request_type, transport: str = "grpc"): @@ -3755,7 +3782,7 @@ def test_update_data_attribute_binding(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3798,7 +3825,8 @@ def test_update_data_attribute_binding_non_empty_request_with_auto_populated_fie client.update_data_attribute_binding(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_taxonomy.UpdateDataAttributeBindingRequest() + request_msg = data_taxonomy.UpdateDataAttributeBindingRequest() + assert args[0] == request_msg def test_update_data_attribute_binding_use_cached_wrapped_rpc(): @@ -3894,9 +3922,15 @@ async def test_update_data_attribute_binding_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_taxonomy.UpdateDataAttributeBindingRequest(), + {}, + ], +) async def test_update_data_attribute_binding_async( - transport: str = "grpc_asyncio", - request_type=data_taxonomy.UpdateDataAttributeBindingRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataTaxonomyServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3905,7 +3939,7 @@ async def test_update_data_attribute_binding_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( @@ -3927,11 +3961,6 @@ async def test_update_data_attribute_binding_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_data_attribute_binding_async_from_dict(): - await test_update_data_attribute_binding_async(request_type=dict) - - def test_update_data_attribute_binding_field_headers(): client = DataTaxonomyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4104,8 +4133,8 @@ async def test_update_data_attribute_binding_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_taxonomy.DeleteDataAttributeBindingRequest, - dict, + data_taxonomy.DeleteDataAttributeBindingRequest(), + {}, ], ) def test_delete_data_attribute_binding(request_type, transport: str = "grpc"): @@ -4116,7 +4145,7 @@ def test_delete_data_attribute_binding(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4162,10 +4191,11 @@ def test_delete_data_attribute_binding_non_empty_request_with_auto_populated_fie client.delete_data_attribute_binding(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_taxonomy.DeleteDataAttributeBindingRequest( + request_msg = data_taxonomy.DeleteDataAttributeBindingRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_data_attribute_binding_use_cached_wrapped_rpc(): @@ -4261,9 +4291,15 @@ async def test_delete_data_attribute_binding_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_taxonomy.DeleteDataAttributeBindingRequest(), + {}, + ], +) async def test_delete_data_attribute_binding_async( - transport: str = "grpc_asyncio", - request_type=data_taxonomy.DeleteDataAttributeBindingRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataTaxonomyServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4272,7 +4308,7 @@ async def test_delete_data_attribute_binding_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( @@ -4294,11 +4330,6 @@ async def test_delete_data_attribute_binding_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_data_attribute_binding_async_from_dict(): - await test_delete_data_attribute_binding_async(request_type=dict) - - def test_delete_data_attribute_binding_field_headers(): client = DataTaxonomyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4453,8 +4484,8 @@ async def test_delete_data_attribute_binding_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_taxonomy.ListDataAttributeBindingsRequest, - dict, + data_taxonomy.ListDataAttributeBindingsRequest(), + {}, ], ) def test_list_data_attribute_bindings(request_type, transport: str = "grpc"): @@ -4465,7 +4496,7 @@ def test_list_data_attribute_bindings(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4518,12 +4549,13 @@ def test_list_data_attribute_bindings_non_empty_request_with_auto_populated_fiel client.list_data_attribute_bindings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_taxonomy.ListDataAttributeBindingsRequest( + request_msg = data_taxonomy.ListDataAttributeBindingsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_data_attribute_bindings_use_cached_wrapped_rpc(): @@ -4609,9 +4641,15 @@ async def test_list_data_attribute_bindings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_taxonomy.ListDataAttributeBindingsRequest(), + {}, + ], +) async def test_list_data_attribute_bindings_async( - transport: str = "grpc_asyncio", - request_type=data_taxonomy.ListDataAttributeBindingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataTaxonomyServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4620,7 +4658,7 @@ async def test_list_data_attribute_bindings_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( @@ -4647,11 +4685,6 @@ async def test_list_data_attribute_bindings_async( assert response.unreachable_locations == ["unreachable_locations_value"] -@pytest.mark.asyncio -async def test_list_data_attribute_bindings_async_from_dict(): - await test_list_data_attribute_bindings_async(request_type=dict) - - def test_list_data_attribute_bindings_field_headers(): client = DataTaxonomyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5008,8 +5041,8 @@ async def test_list_data_attribute_bindings_async_pages(): @pytest.mark.parametrize( "request_type", [ - data_taxonomy.GetDataAttributeBindingRequest, - dict, + data_taxonomy.GetDataAttributeBindingRequest(), + {}, ], ) def test_get_data_attribute_binding(request_type, transport: str = "grpc"): @@ -5020,7 +5053,7 @@ def test_get_data_attribute_binding(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5079,9 +5112,10 @@ def test_get_data_attribute_binding_non_empty_request_with_auto_populated_field( client.get_data_attribute_binding(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_taxonomy.GetDataAttributeBindingRequest( + request_msg = data_taxonomy.GetDataAttributeBindingRequest( name="name_value", ) + assert args[0] == request_msg def test_get_data_attribute_binding_use_cached_wrapped_rpc(): @@ -5167,9 +5201,15 @@ async def test_get_data_attribute_binding_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_taxonomy.GetDataAttributeBindingRequest(), + {}, + ], +) async def test_get_data_attribute_binding_async( - transport: str = "grpc_asyncio", - request_type=data_taxonomy.GetDataAttributeBindingRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataTaxonomyServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5178,7 +5218,7 @@ async def test_get_data_attribute_binding_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( @@ -5213,11 +5253,6 @@ async def test_get_data_attribute_binding_async( assert response.attributes == ["attributes_value"] -@pytest.mark.asyncio -async def test_get_data_attribute_binding_async_from_dict(): - await test_get_data_attribute_binding_async(request_type=dict) - - def test_get_data_attribute_binding_field_headers(): client = DataTaxonomyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5372,8 +5407,8 @@ async def test_get_data_attribute_binding_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_taxonomy.CreateDataAttributeRequest, - dict, + data_taxonomy.CreateDataAttributeRequest(), + {}, ], ) def test_create_data_attribute(request_type, transport: str = "grpc"): @@ -5384,7 +5419,7 @@ def test_create_data_attribute(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5430,10 +5465,11 @@ def test_create_data_attribute_non_empty_request_with_auto_populated_field(): client.create_data_attribute(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_taxonomy.CreateDataAttributeRequest( + request_msg = data_taxonomy.CreateDataAttributeRequest( parent="parent_value", data_attribute_id="data_attribute_id_value", ) + assert args[0] == request_msg def test_create_data_attribute_use_cached_wrapped_rpc(): @@ -5529,9 +5565,15 @@ async def test_create_data_attribute_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_taxonomy.CreateDataAttributeRequest(), + {}, + ], +) async def test_create_data_attribute_async( - transport: str = "grpc_asyncio", - request_type=data_taxonomy.CreateDataAttributeRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataTaxonomyServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5540,7 +5582,7 @@ async def test_create_data_attribute_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( @@ -5562,11 +5604,6 @@ async def test_create_data_attribute_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_data_attribute_async_from_dict(): - await test_create_data_attribute_async(request_type=dict) - - def test_create_data_attribute_field_headers(): client = DataTaxonomyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5741,8 +5778,8 @@ async def test_create_data_attribute_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_taxonomy.UpdateDataAttributeRequest, - dict, + data_taxonomy.UpdateDataAttributeRequest(), + {}, ], ) def test_update_data_attribute(request_type, transport: str = "grpc"): @@ -5753,7 +5790,7 @@ def test_update_data_attribute(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5796,7 +5833,8 @@ def test_update_data_attribute_non_empty_request_with_auto_populated_field(): client.update_data_attribute(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_taxonomy.UpdateDataAttributeRequest() + request_msg = data_taxonomy.UpdateDataAttributeRequest() + assert args[0] == request_msg def test_update_data_attribute_use_cached_wrapped_rpc(): @@ -5892,9 +5930,15 @@ async def test_update_data_attribute_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_taxonomy.UpdateDataAttributeRequest(), + {}, + ], +) async def test_update_data_attribute_async( - transport: str = "grpc_asyncio", - request_type=data_taxonomy.UpdateDataAttributeRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataTaxonomyServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5903,7 +5947,7 @@ async def test_update_data_attribute_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( @@ -5925,11 +5969,6 @@ async def test_update_data_attribute_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_data_attribute_async_from_dict(): - await test_update_data_attribute_async(request_type=dict) - - def test_update_data_attribute_field_headers(): client = DataTaxonomyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6094,8 +6133,8 @@ async def test_update_data_attribute_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_taxonomy.DeleteDataAttributeRequest, - dict, + data_taxonomy.DeleteDataAttributeRequest(), + {}, ], ) def test_delete_data_attribute(request_type, transport: str = "grpc"): @@ -6106,7 +6145,7 @@ def test_delete_data_attribute(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6152,10 +6191,11 @@ def test_delete_data_attribute_non_empty_request_with_auto_populated_field(): client.delete_data_attribute(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_taxonomy.DeleteDataAttributeRequest( + request_msg = data_taxonomy.DeleteDataAttributeRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_data_attribute_use_cached_wrapped_rpc(): @@ -6251,9 +6291,15 @@ async def test_delete_data_attribute_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_taxonomy.DeleteDataAttributeRequest(), + {}, + ], +) async def test_delete_data_attribute_async( - transport: str = "grpc_asyncio", - request_type=data_taxonomy.DeleteDataAttributeRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataTaxonomyServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -6262,7 +6308,7 @@ async def test_delete_data_attribute_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( @@ -6284,11 +6330,6 @@ async def test_delete_data_attribute_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_data_attribute_async_from_dict(): - await test_delete_data_attribute_async(request_type=dict) - - def test_delete_data_attribute_field_headers(): client = DataTaxonomyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6443,8 +6484,8 @@ async def test_delete_data_attribute_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_taxonomy.ListDataAttributesRequest, - dict, + data_taxonomy.ListDataAttributesRequest(), + {}, ], ) def test_list_data_attributes(request_type, transport: str = "grpc"): @@ -6455,7 +6496,7 @@ def test_list_data_attributes(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6508,12 +6549,13 @@ def test_list_data_attributes_non_empty_request_with_auto_populated_field(): client.list_data_attributes(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_taxonomy.ListDataAttributesRequest( + request_msg = data_taxonomy.ListDataAttributesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_data_attributes_use_cached_wrapped_rpc(): @@ -6598,9 +6640,15 @@ async def test_list_data_attributes_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_taxonomy.ListDataAttributesRequest(), + {}, + ], +) async def test_list_data_attributes_async( - transport: str = "grpc_asyncio", - request_type=data_taxonomy.ListDataAttributesRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataTaxonomyServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -6609,7 +6657,7 @@ async def test_list_data_attributes_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( @@ -6636,11 +6684,6 @@ async def test_list_data_attributes_async( assert response.unreachable_locations == ["unreachable_locations_value"] -@pytest.mark.asyncio -async def test_list_data_attributes_async_from_dict(): - await test_list_data_attributes_async(request_type=dict) - - def test_list_data_attributes_field_headers(): client = DataTaxonomyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6993,8 +7036,8 @@ async def test_list_data_attributes_async_pages(): @pytest.mark.parametrize( "request_type", [ - data_taxonomy.GetDataAttributeRequest, - dict, + data_taxonomy.GetDataAttributeRequest(), + {}, ], ) def test_get_data_attribute(request_type, transport: str = "grpc"): @@ -7005,7 +7048,7 @@ def test_get_data_attribute(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7065,9 +7108,10 @@ def test_get_data_attribute_non_empty_request_with_auto_populated_field(): client.get_data_attribute(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_taxonomy.GetDataAttributeRequest( + request_msg = data_taxonomy.GetDataAttributeRequest( name="name_value", ) + assert args[0] == request_msg def test_get_data_attribute_use_cached_wrapped_rpc(): @@ -7152,9 +7196,14 @@ async def test_get_data_attribute_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_data_attribute_async( - transport: str = "grpc_asyncio", request_type=data_taxonomy.GetDataAttributeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + data_taxonomy.GetDataAttributeRequest(), + {}, + ], +) +async def test_get_data_attribute_async(request_type, transport: str = "grpc_asyncio"): client = DataTaxonomyServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7162,7 +7211,7 @@ async def test_get_data_attribute_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( @@ -7199,11 +7248,6 @@ async def test_get_data_attribute_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_data_attribute_async_from_dict(): - await test_get_data_attribute_async(request_type=dict) - - def test_get_data_attribute_field_headers(): client = DataTaxonomyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10702,7 +10746,6 @@ def test_create_data_taxonomy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_data_taxonomy.CreateDataTaxonomyRequest() - assert args[0] == request_msg @@ -10725,7 +10768,6 @@ def test_update_data_taxonomy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_data_taxonomy.UpdateDataTaxonomyRequest() - assert args[0] == request_msg @@ -10748,7 +10790,6 @@ def test_delete_data_taxonomy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_taxonomy.DeleteDataTaxonomyRequest() - assert args[0] == request_msg @@ -10771,7 +10812,6 @@ def test_list_data_taxonomies_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_taxonomy.ListDataTaxonomiesRequest() - assert args[0] == request_msg @@ -10794,7 +10834,6 @@ def test_get_data_taxonomy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_taxonomy.GetDataTaxonomyRequest() - assert args[0] == request_msg @@ -10817,7 +10856,6 @@ def test_create_data_attribute_binding_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_taxonomy.CreateDataAttributeBindingRequest() - assert args[0] == request_msg @@ -10840,7 +10878,6 @@ def test_update_data_attribute_binding_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_taxonomy.UpdateDataAttributeBindingRequest() - assert args[0] == request_msg @@ -10863,7 +10900,6 @@ def test_delete_data_attribute_binding_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_taxonomy.DeleteDataAttributeBindingRequest() - assert args[0] == request_msg @@ -10886,7 +10922,6 @@ def test_list_data_attribute_bindings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_taxonomy.ListDataAttributeBindingsRequest() - assert args[0] == request_msg @@ -10909,7 +10944,6 @@ def test_get_data_attribute_binding_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_taxonomy.GetDataAttributeBindingRequest() - assert args[0] == request_msg @@ -10932,7 +10966,6 @@ def test_create_data_attribute_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_taxonomy.CreateDataAttributeRequest() - assert args[0] == request_msg @@ -10955,7 +10988,6 @@ def test_update_data_attribute_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_taxonomy.UpdateDataAttributeRequest() - assert args[0] == request_msg @@ -10978,7 +11010,6 @@ def test_delete_data_attribute_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_taxonomy.DeleteDataAttributeRequest() - assert args[0] == request_msg @@ -11001,7 +11032,6 @@ def test_list_data_attributes_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_taxonomy.ListDataAttributesRequest() - assert args[0] == request_msg @@ -11024,7 +11054,6 @@ def test_get_data_attribute_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_taxonomy.GetDataAttributeRequest() - assert args[0] == request_msg @@ -11065,7 +11094,6 @@ async def test_create_data_taxonomy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_data_taxonomy.CreateDataTaxonomyRequest() - assert args[0] == request_msg @@ -11092,7 +11120,6 @@ async def test_update_data_taxonomy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_data_taxonomy.UpdateDataTaxonomyRequest() - assert args[0] == request_msg @@ -11119,7 +11146,6 @@ async def test_delete_data_taxonomy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_taxonomy.DeleteDataTaxonomyRequest() - assert args[0] == request_msg @@ -11149,7 +11175,6 @@ async def test_list_data_taxonomies_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_taxonomy.ListDataTaxonomiesRequest() - assert args[0] == request_msg @@ -11184,7 +11209,6 @@ async def test_get_data_taxonomy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_taxonomy.GetDataTaxonomyRequest() - assert args[0] == request_msg @@ -11211,7 +11235,6 @@ async def test_create_data_attribute_binding_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_taxonomy.CreateDataAttributeBindingRequest() - assert args[0] == request_msg @@ -11238,7 +11261,6 @@ async def test_update_data_attribute_binding_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_taxonomy.UpdateDataAttributeBindingRequest() - assert args[0] == request_msg @@ -11265,7 +11287,6 @@ async def test_delete_data_attribute_binding_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_taxonomy.DeleteDataAttributeBindingRequest() - assert args[0] == request_msg @@ -11295,7 +11316,6 @@ async def test_list_data_attribute_bindings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_taxonomy.ListDataAttributeBindingsRequest() - assert args[0] == request_msg @@ -11329,7 +11349,6 @@ async def test_get_data_attribute_binding_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_taxonomy.GetDataAttributeBindingRequest() - assert args[0] == request_msg @@ -11356,7 +11375,6 @@ async def test_create_data_attribute_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_taxonomy.CreateDataAttributeRequest() - assert args[0] == request_msg @@ -11383,7 +11401,6 @@ async def test_update_data_attribute_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_taxonomy.UpdateDataAttributeRequest() - assert args[0] == request_msg @@ -11410,7 +11427,6 @@ async def test_delete_data_attribute_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_taxonomy.DeleteDataAttributeRequest() - assert args[0] == request_msg @@ -11440,7 +11456,6 @@ async def test_list_data_attributes_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_taxonomy.ListDataAttributesRequest() - assert args[0] == request_msg @@ -11475,7 +11490,6 @@ async def test_get_data_attribute_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_taxonomy.GetDataAttributeRequest() - assert args[0] == request_msg @@ -14622,7 +14636,6 @@ def test_create_data_taxonomy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_data_taxonomy.CreateDataTaxonomyRequest() - assert args[0] == request_msg @@ -14644,7 +14657,6 @@ def test_update_data_taxonomy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_data_taxonomy.UpdateDataTaxonomyRequest() - assert args[0] == request_msg @@ -14666,7 +14678,6 @@ def test_delete_data_taxonomy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_taxonomy.DeleteDataTaxonomyRequest() - assert args[0] == request_msg @@ -14688,7 +14699,6 @@ def test_list_data_taxonomies_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_taxonomy.ListDataTaxonomiesRequest() - assert args[0] == request_msg @@ -14710,7 +14720,6 @@ def test_get_data_taxonomy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_taxonomy.GetDataTaxonomyRequest() - assert args[0] == request_msg @@ -14732,7 +14741,6 @@ def test_create_data_attribute_binding_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_taxonomy.CreateDataAttributeBindingRequest() - assert args[0] == request_msg @@ -14754,7 +14762,6 @@ def test_update_data_attribute_binding_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_taxonomy.UpdateDataAttributeBindingRequest() - assert args[0] == request_msg @@ -14776,7 +14783,6 @@ def test_delete_data_attribute_binding_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_taxonomy.DeleteDataAttributeBindingRequest() - assert args[0] == request_msg @@ -14798,7 +14804,6 @@ def test_list_data_attribute_bindings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_taxonomy.ListDataAttributeBindingsRequest() - assert args[0] == request_msg @@ -14820,7 +14825,6 @@ def test_get_data_attribute_binding_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_taxonomy.GetDataAttributeBindingRequest() - assert args[0] == request_msg @@ -14842,7 +14846,6 @@ def test_create_data_attribute_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_taxonomy.CreateDataAttributeRequest() - assert args[0] == request_msg @@ -14864,7 +14867,6 @@ def test_update_data_attribute_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_taxonomy.UpdateDataAttributeRequest() - assert args[0] == request_msg @@ -14886,7 +14888,6 @@ def test_delete_data_attribute_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_taxonomy.DeleteDataAttributeRequest() - assert args[0] == request_msg @@ -14908,7 +14909,6 @@ def test_list_data_attributes_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_taxonomy.ListDataAttributesRequest() - assert args[0] == request_msg @@ -14930,7 +14930,6 @@ def test_get_data_attribute_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_taxonomy.GetDataAttributeRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dataplex/tests/unit/gapic/dataplex_v1/test_dataplex_service.py b/packages/google-cloud-dataplex/tests/unit/gapic/dataplex_v1/test_dataplex_service.py index 777b61c28291..dea7ecc7d9f7 100644 --- a/packages/google-cloud-dataplex/tests/unit/gapic/dataplex_v1/test_dataplex_service.py +++ b/packages/google-cloud-dataplex/tests/unit/gapic/dataplex_v1/test_dataplex_service.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 @@ -122,6 +123,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" @@ -1349,8 +1365,8 @@ def test_dataplex_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - service.CreateLakeRequest, - dict, + service.CreateLakeRequest(), + {}, ], ) def test_create_lake(request_type, transport: str = "grpc"): @@ -1361,7 +1377,7 @@ def test_create_lake(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_lake), "__call__") as call: @@ -1403,10 +1419,11 @@ def test_create_lake_non_empty_request_with_auto_populated_field(): client.create_lake(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateLakeRequest( + request_msg = service.CreateLakeRequest( parent="parent_value", lake_id="lake_id_value", ) + assert args[0] == request_msg def test_create_lake_use_cached_wrapped_rpc(): @@ -1497,9 +1514,14 @@ async def test_create_lake_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_lake_async( - transport: str = "grpc_asyncio", request_type=service.CreateLakeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CreateLakeRequest(), + {}, + ], +) +async def test_create_lake_async(request_type, transport: str = "grpc_asyncio"): client = DataplexServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1507,7 +1529,7 @@ async def test_create_lake_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_lake), "__call__") as call: @@ -1527,11 +1549,6 @@ async def test_create_lake_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_lake_async_from_dict(): - await test_create_lake_async(request_type=dict) - - def test_create_lake_field_headers(): client = DataplexServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1698,8 +1715,8 @@ async def test_create_lake_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdateLakeRequest, - dict, + service.UpdateLakeRequest(), + {}, ], ) def test_update_lake(request_type, transport: str = "grpc"): @@ -1710,7 +1727,7 @@ def test_update_lake(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_lake), "__call__") as call: @@ -1749,7 +1766,8 @@ def test_update_lake_non_empty_request_with_auto_populated_field(): client.update_lake(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateLakeRequest() + request_msg = service.UpdateLakeRequest() + assert args[0] == request_msg def test_update_lake_use_cached_wrapped_rpc(): @@ -1840,9 +1858,14 @@ async def test_update_lake_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_lake_async( - transport: str = "grpc_asyncio", request_type=service.UpdateLakeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateLakeRequest(), + {}, + ], +) +async def test_update_lake_async(request_type, transport: str = "grpc_asyncio"): client = DataplexServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1850,7 +1873,7 @@ async def test_update_lake_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_lake), "__call__") as call: @@ -1870,11 +1893,6 @@ async def test_update_lake_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_lake_async_from_dict(): - await test_update_lake_async(request_type=dict) - - def test_update_lake_field_headers(): client = DataplexServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2031,8 +2049,8 @@ async def test_update_lake_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DeleteLakeRequest, - dict, + service.DeleteLakeRequest(), + {}, ], ) def test_delete_lake(request_type, transport: str = "grpc"): @@ -2043,7 +2061,7 @@ def test_delete_lake(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_lake), "__call__") as call: @@ -2084,9 +2102,10 @@ def test_delete_lake_non_empty_request_with_auto_populated_field(): client.delete_lake(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteLakeRequest( + request_msg = service.DeleteLakeRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_lake_use_cached_wrapped_rpc(): @@ -2177,9 +2196,14 @@ async def test_delete_lake_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_lake_async( - transport: str = "grpc_asyncio", request_type=service.DeleteLakeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteLakeRequest(), + {}, + ], +) +async def test_delete_lake_async(request_type, transport: str = "grpc_asyncio"): client = DataplexServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2187,7 +2211,7 @@ async def test_delete_lake_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_lake), "__call__") as call: @@ -2207,11 +2231,6 @@ async def test_delete_lake_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_lake_async_from_dict(): - await test_delete_lake_async(request_type=dict) - - def test_delete_lake_field_headers(): client = DataplexServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2358,8 +2377,8 @@ async def test_delete_lake_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListLakesRequest, - dict, + service.ListLakesRequest(), + {}, ], ) def test_list_lakes(request_type, transport: str = "grpc"): @@ -2370,7 +2389,7 @@ def test_list_lakes(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_lakes), "__call__") as call: @@ -2419,12 +2438,13 @@ def test_list_lakes_non_empty_request_with_auto_populated_field(): client.list_lakes(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListLakesRequest( + request_msg = service.ListLakesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_lakes_use_cached_wrapped_rpc(): @@ -2503,9 +2523,14 @@ async def test_list_lakes_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_list_lakes_async( - transport: str = "grpc_asyncio", request_type=service.ListLakesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListLakesRequest(), + {}, + ], +) +async def test_list_lakes_async(request_type, transport: str = "grpc_asyncio"): client = DataplexServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2513,7 +2538,7 @@ async def test_list_lakes_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_lakes), "__call__") as call: @@ -2538,11 +2563,6 @@ async def test_list_lakes_async( assert response.unreachable_locations == ["unreachable_locations_value"] -@pytest.mark.asyncio -async def test_list_lakes_async_from_dict(): - await test_list_lakes_async(request_type=dict) - - def test_list_lakes_field_headers(): client = DataplexServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2879,8 +2899,8 @@ async def test_list_lakes_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetLakeRequest, - dict, + service.GetLakeRequest(), + {}, ], ) def test_get_lake(request_type, transport: str = "grpc"): @@ -2891,7 +2911,7 @@ def test_get_lake(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_lake), "__call__") as call: @@ -2945,9 +2965,10 @@ def test_get_lake_non_empty_request_with_auto_populated_field(): client.get_lake(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetLakeRequest( + request_msg = service.GetLakeRequest( name="name_value", ) + assert args[0] == request_msg def test_get_lake_use_cached_wrapped_rpc(): @@ -3026,9 +3047,14 @@ async def test_get_lake_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn @pytest.mark.asyncio -async def test_get_lake_async( - transport: str = "grpc_asyncio", request_type=service.GetLakeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetLakeRequest(), + {}, + ], +) +async def test_get_lake_async(request_type, transport: str = "grpc_asyncio"): client = DataplexServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3036,7 +3062,7 @@ async def test_get_lake_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_lake), "__call__") as call: @@ -3069,11 +3095,6 @@ async def test_get_lake_async( assert response.service_account == "service_account_value" -@pytest.mark.asyncio -async def test_get_lake_async_from_dict(): - await test_get_lake_async(request_type=dict) - - def test_get_lake_field_headers(): client = DataplexServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3216,8 +3237,8 @@ async def test_get_lake_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListLakeActionsRequest, - dict, + service.ListLakeActionsRequest(), + {}, ], ) def test_list_lake_actions(request_type, transport: str = "grpc"): @@ -3228,7 +3249,7 @@ def test_list_lake_actions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3277,10 +3298,11 @@ def test_list_lake_actions_non_empty_request_with_auto_populated_field(): client.list_lake_actions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListLakeActionsRequest( + request_msg = service.ListLakeActionsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_lake_actions_use_cached_wrapped_rpc(): @@ -3363,9 +3385,14 @@ async def test_list_lake_actions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_lake_actions_async( - transport: str = "grpc_asyncio", request_type=service.ListLakeActionsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListLakeActionsRequest(), + {}, + ], +) +async def test_list_lake_actions_async(request_type, transport: str = "grpc_asyncio"): client = DataplexServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3373,7 +3400,7 @@ async def test_list_lake_actions_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( @@ -3398,11 +3425,6 @@ async def test_list_lake_actions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_lake_actions_async_from_dict(): - await test_list_lake_actions_async(request_type=dict) - - def test_list_lake_actions_field_headers(): client = DataplexServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3755,8 +3777,8 @@ async def test_list_lake_actions_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.CreateZoneRequest, - dict, + service.CreateZoneRequest(), + {}, ], ) def test_create_zone(request_type, transport: str = "grpc"): @@ -3767,7 +3789,7 @@ def test_create_zone(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_zone), "__call__") as call: @@ -3809,10 +3831,11 @@ def test_create_zone_non_empty_request_with_auto_populated_field(): client.create_zone(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateZoneRequest( + request_msg = service.CreateZoneRequest( parent="parent_value", zone_id="zone_id_value", ) + assert args[0] == request_msg def test_create_zone_use_cached_wrapped_rpc(): @@ -3903,9 +3926,14 @@ async def test_create_zone_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_zone_async( - transport: str = "grpc_asyncio", request_type=service.CreateZoneRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CreateZoneRequest(), + {}, + ], +) +async def test_create_zone_async(request_type, transport: str = "grpc_asyncio"): client = DataplexServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3913,7 +3941,7 @@ async def test_create_zone_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_zone), "__call__") as call: @@ -3933,11 +3961,6 @@ async def test_create_zone_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_zone_async_from_dict(): - await test_create_zone_async(request_type=dict) - - def test_create_zone_field_headers(): client = DataplexServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4104,8 +4127,8 @@ async def test_create_zone_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdateZoneRequest, - dict, + service.UpdateZoneRequest(), + {}, ], ) def test_update_zone(request_type, transport: str = "grpc"): @@ -4116,7 +4139,7 @@ def test_update_zone(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_zone), "__call__") as call: @@ -4155,7 +4178,8 @@ def test_update_zone_non_empty_request_with_auto_populated_field(): client.update_zone(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateZoneRequest() + request_msg = service.UpdateZoneRequest() + assert args[0] == request_msg def test_update_zone_use_cached_wrapped_rpc(): @@ -4246,9 +4270,14 @@ async def test_update_zone_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_zone_async( - transport: str = "grpc_asyncio", request_type=service.UpdateZoneRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateZoneRequest(), + {}, + ], +) +async def test_update_zone_async(request_type, transport: str = "grpc_asyncio"): client = DataplexServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4256,7 +4285,7 @@ async def test_update_zone_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_zone), "__call__") as call: @@ -4276,11 +4305,6 @@ async def test_update_zone_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_zone_async_from_dict(): - await test_update_zone_async(request_type=dict) - - def test_update_zone_field_headers(): client = DataplexServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4437,8 +4461,8 @@ async def test_update_zone_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DeleteZoneRequest, - dict, + service.DeleteZoneRequest(), + {}, ], ) def test_delete_zone(request_type, transport: str = "grpc"): @@ -4449,7 +4473,7 @@ def test_delete_zone(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_zone), "__call__") as call: @@ -4490,9 +4514,10 @@ def test_delete_zone_non_empty_request_with_auto_populated_field(): client.delete_zone(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteZoneRequest( + request_msg = service.DeleteZoneRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_zone_use_cached_wrapped_rpc(): @@ -4583,9 +4608,14 @@ async def test_delete_zone_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_zone_async( - transport: str = "grpc_asyncio", request_type=service.DeleteZoneRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteZoneRequest(), + {}, + ], +) +async def test_delete_zone_async(request_type, transport: str = "grpc_asyncio"): client = DataplexServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4593,7 +4623,7 @@ async def test_delete_zone_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_zone), "__call__") as call: @@ -4613,11 +4643,6 @@ async def test_delete_zone_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_zone_async_from_dict(): - await test_delete_zone_async(request_type=dict) - - def test_delete_zone_field_headers(): client = DataplexServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4764,8 +4789,8 @@ async def test_delete_zone_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListZonesRequest, - dict, + service.ListZonesRequest(), + {}, ], ) def test_list_zones(request_type, transport: str = "grpc"): @@ -4776,7 +4801,7 @@ def test_list_zones(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_zones), "__call__") as call: @@ -4823,12 +4848,13 @@ def test_list_zones_non_empty_request_with_auto_populated_field(): client.list_zones(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListZonesRequest( + request_msg = service.ListZonesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_zones_use_cached_wrapped_rpc(): @@ -4907,9 +4933,14 @@ async def test_list_zones_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_list_zones_async( - transport: str = "grpc_asyncio", request_type=service.ListZonesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListZonesRequest(), + {}, + ], +) +async def test_list_zones_async(request_type, transport: str = "grpc_asyncio"): client = DataplexServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4917,7 +4948,7 @@ async def test_list_zones_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_zones), "__call__") as call: @@ -4940,11 +4971,6 @@ async def test_list_zones_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_zones_async_from_dict(): - await test_list_zones_async(request_type=dict) - - def test_list_zones_field_headers(): client = DataplexServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5281,8 +5307,8 @@ async def test_list_zones_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetZoneRequest, - dict, + service.GetZoneRequest(), + {}, ], ) def test_get_zone(request_type, transport: str = "grpc"): @@ -5293,7 +5319,7 @@ def test_get_zone(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_zone), "__call__") as call: @@ -5347,9 +5373,10 @@ def test_get_zone_non_empty_request_with_auto_populated_field(): client.get_zone(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetZoneRequest( + request_msg = service.GetZoneRequest( name="name_value", ) + assert args[0] == request_msg def test_get_zone_use_cached_wrapped_rpc(): @@ -5428,9 +5455,14 @@ async def test_get_zone_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn @pytest.mark.asyncio -async def test_get_zone_async( - transport: str = "grpc_asyncio", request_type=service.GetZoneRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetZoneRequest(), + {}, + ], +) +async def test_get_zone_async(request_type, transport: str = "grpc_asyncio"): client = DataplexServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5438,7 +5470,7 @@ async def test_get_zone_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_zone), "__call__") as call: @@ -5471,11 +5503,6 @@ async def test_get_zone_async( assert response.type_ == resources.Zone.Type.RAW -@pytest.mark.asyncio -async def test_get_zone_async_from_dict(): - await test_get_zone_async(request_type=dict) - - def test_get_zone_field_headers(): client = DataplexServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5618,8 +5645,8 @@ async def test_get_zone_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListZoneActionsRequest, - dict, + service.ListZoneActionsRequest(), + {}, ], ) def test_list_zone_actions(request_type, transport: str = "grpc"): @@ -5630,7 +5657,7 @@ def test_list_zone_actions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5679,10 +5706,11 @@ def test_list_zone_actions_non_empty_request_with_auto_populated_field(): client.list_zone_actions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListZoneActionsRequest( + request_msg = service.ListZoneActionsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_zone_actions_use_cached_wrapped_rpc(): @@ -5765,9 +5793,14 @@ async def test_list_zone_actions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_zone_actions_async( - transport: str = "grpc_asyncio", request_type=service.ListZoneActionsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListZoneActionsRequest(), + {}, + ], +) +async def test_list_zone_actions_async(request_type, transport: str = "grpc_asyncio"): client = DataplexServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5775,7 +5808,7 @@ async def test_list_zone_actions_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( @@ -5800,11 +5833,6 @@ async def test_list_zone_actions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_zone_actions_async_from_dict(): - await test_list_zone_actions_async(request_type=dict) - - def test_list_zone_actions_field_headers(): client = DataplexServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6157,8 +6185,8 @@ async def test_list_zone_actions_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.CreateAssetRequest, - dict, + service.CreateAssetRequest(), + {}, ], ) def test_create_asset(request_type, transport: str = "grpc"): @@ -6169,7 +6197,7 @@ def test_create_asset(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_asset), "__call__") as call: @@ -6211,10 +6239,11 @@ def test_create_asset_non_empty_request_with_auto_populated_field(): client.create_asset(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateAssetRequest( + request_msg = service.CreateAssetRequest( parent="parent_value", asset_id="asset_id_value", ) + assert args[0] == request_msg def test_create_asset_use_cached_wrapped_rpc(): @@ -6305,9 +6334,14 @@ async def test_create_asset_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_asset_async( - transport: str = "grpc_asyncio", request_type=service.CreateAssetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CreateAssetRequest(), + {}, + ], +) +async def test_create_asset_async(request_type, transport: str = "grpc_asyncio"): client = DataplexServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6315,7 +6349,7 @@ async def test_create_asset_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_asset), "__call__") as call: @@ -6335,11 +6369,6 @@ async def test_create_asset_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_asset_async_from_dict(): - await test_create_asset_async(request_type=dict) - - def test_create_asset_field_headers(): client = DataplexServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6506,8 +6535,8 @@ async def test_create_asset_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdateAssetRequest, - dict, + service.UpdateAssetRequest(), + {}, ], ) def test_update_asset(request_type, transport: str = "grpc"): @@ -6518,7 +6547,7 @@ def test_update_asset(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_asset), "__call__") as call: @@ -6557,7 +6586,8 @@ def test_update_asset_non_empty_request_with_auto_populated_field(): client.update_asset(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateAssetRequest() + request_msg = service.UpdateAssetRequest() + assert args[0] == request_msg def test_update_asset_use_cached_wrapped_rpc(): @@ -6648,9 +6678,14 @@ async def test_update_asset_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_asset_async( - transport: str = "grpc_asyncio", request_type=service.UpdateAssetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateAssetRequest(), + {}, + ], +) +async def test_update_asset_async(request_type, transport: str = "grpc_asyncio"): client = DataplexServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6658,7 +6693,7 @@ async def test_update_asset_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_asset), "__call__") as call: @@ -6678,11 +6713,6 @@ async def test_update_asset_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_asset_async_from_dict(): - await test_update_asset_async(request_type=dict) - - def test_update_asset_field_headers(): client = DataplexServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6839,8 +6869,8 @@ async def test_update_asset_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DeleteAssetRequest, - dict, + service.DeleteAssetRequest(), + {}, ], ) def test_delete_asset(request_type, transport: str = "grpc"): @@ -6851,7 +6881,7 @@ def test_delete_asset(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_asset), "__call__") as call: @@ -6892,9 +6922,10 @@ def test_delete_asset_non_empty_request_with_auto_populated_field(): client.delete_asset(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteAssetRequest( + request_msg = service.DeleteAssetRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_asset_use_cached_wrapped_rpc(): @@ -6985,9 +7016,14 @@ async def test_delete_asset_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_asset_async( - transport: str = "grpc_asyncio", request_type=service.DeleteAssetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteAssetRequest(), + {}, + ], +) +async def test_delete_asset_async(request_type, transport: str = "grpc_asyncio"): client = DataplexServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6995,7 +7031,7 @@ async def test_delete_asset_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_asset), "__call__") as call: @@ -7015,11 +7051,6 @@ async def test_delete_asset_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_asset_async_from_dict(): - await test_delete_asset_async(request_type=dict) - - def test_delete_asset_field_headers(): client = DataplexServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7166,8 +7197,8 @@ async def test_delete_asset_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListAssetsRequest, - dict, + service.ListAssetsRequest(), + {}, ], ) def test_list_assets(request_type, transport: str = "grpc"): @@ -7178,7 +7209,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(type(client.transport.list_assets), "__call__") as call: @@ -7225,12 +7256,13 @@ 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] == service.ListAssetsRequest( + request_msg = service.ListAssetsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_assets_use_cached_wrapped_rpc(): @@ -7311,9 +7343,14 @@ async def test_list_assets_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_assets_async( - transport: str = "grpc_asyncio", request_type=service.ListAssetsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListAssetsRequest(), + {}, + ], +) +async def test_list_assets_async(request_type, transport: str = "grpc_asyncio"): client = DataplexServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7321,7 +7358,7 @@ async def test_list_assets_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_assets), "__call__") as call: @@ -7344,11 +7381,6 @@ async def test_list_assets_async( 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 = DataplexServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7685,8 +7717,8 @@ async def test_list_assets_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetAssetRequest, - dict, + service.GetAssetRequest(), + {}, ], ) def test_get_asset(request_type, transport: str = "grpc"): @@ -7697,7 +7729,7 @@ def test_get_asset(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_asset), "__call__") as call: @@ -7749,9 +7781,10 @@ def test_get_asset_non_empty_request_with_auto_populated_field(): client.get_asset(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetAssetRequest( + request_msg = service.GetAssetRequest( name="name_value", ) + assert args[0] == request_msg def test_get_asset_use_cached_wrapped_rpc(): @@ -7830,9 +7863,14 @@ async def test_get_asset_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_asset_async( - transport: str = "grpc_asyncio", request_type=service.GetAssetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetAssetRequest(), + {}, + ], +) +async def test_get_asset_async(request_type, transport: str = "grpc_asyncio"): client = DataplexServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7840,7 +7878,7 @@ async def test_get_asset_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_asset), "__call__") as call: @@ -7871,11 +7909,6 @@ async def test_get_asset_async( assert response.state == resources.State.ACTIVE -@pytest.mark.asyncio -async def test_get_asset_async_from_dict(): - await test_get_asset_async(request_type=dict) - - def test_get_asset_field_headers(): client = DataplexServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8018,8 +8051,8 @@ async def test_get_asset_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListAssetActionsRequest, - dict, + service.ListAssetActionsRequest(), + {}, ], ) def test_list_asset_actions(request_type, transport: str = "grpc"): @@ -8030,7 +8063,7 @@ def test_list_asset_actions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8079,10 +8112,11 @@ def test_list_asset_actions_non_empty_request_with_auto_populated_field(): client.list_asset_actions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListAssetActionsRequest( + request_msg = service.ListAssetActionsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_asset_actions_use_cached_wrapped_rpc(): @@ -8167,9 +8201,14 @@ async def test_list_asset_actions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_asset_actions_async( - transport: str = "grpc_asyncio", request_type=service.ListAssetActionsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListAssetActionsRequest(), + {}, + ], +) +async def test_list_asset_actions_async(request_type, transport: str = "grpc_asyncio"): client = DataplexServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8177,7 +8216,7 @@ async def test_list_asset_actions_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( @@ -8202,11 +8241,6 @@ async def test_list_asset_actions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_asset_actions_async_from_dict(): - await test_list_asset_actions_async(request_type=dict) - - def test_list_asset_actions_field_headers(): client = DataplexServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8559,8 +8593,8 @@ async def test_list_asset_actions_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.CreateTaskRequest, - dict, + service.CreateTaskRequest(), + {}, ], ) def test_create_task(request_type, transport: str = "grpc"): @@ -8571,7 +8605,7 @@ def test_create_task(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_task), "__call__") as call: @@ -8613,10 +8647,11 @@ def test_create_task_non_empty_request_with_auto_populated_field(): client.create_task(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateTaskRequest( + request_msg = service.CreateTaskRequest( parent="parent_value", task_id="task_id_value", ) + assert args[0] == request_msg def test_create_task_use_cached_wrapped_rpc(): @@ -8707,9 +8742,14 @@ async def test_create_task_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_task_async( - transport: str = "grpc_asyncio", request_type=service.CreateTaskRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CreateTaskRequest(), + {}, + ], +) +async def test_create_task_async(request_type, transport: str = "grpc_asyncio"): client = DataplexServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8717,7 +8757,7 @@ async def test_create_task_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_task), "__call__") as call: @@ -8737,11 +8777,6 @@ async def test_create_task_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_task_async_from_dict(): - await test_create_task_async(request_type=dict) - - def test_create_task_field_headers(): client = DataplexServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8908,8 +8943,8 @@ async def test_create_task_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdateTaskRequest, - dict, + service.UpdateTaskRequest(), + {}, ], ) def test_update_task(request_type, transport: str = "grpc"): @@ -8920,7 +8955,7 @@ def test_update_task(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_task), "__call__") as call: @@ -8959,7 +8994,8 @@ def test_update_task_non_empty_request_with_auto_populated_field(): client.update_task(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateTaskRequest() + request_msg = service.UpdateTaskRequest() + assert args[0] == request_msg def test_update_task_use_cached_wrapped_rpc(): @@ -9050,9 +9086,14 @@ async def test_update_task_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_task_async( - transport: str = "grpc_asyncio", request_type=service.UpdateTaskRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateTaskRequest(), + {}, + ], +) +async def test_update_task_async(request_type, transport: str = "grpc_asyncio"): client = DataplexServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9060,7 +9101,7 @@ async def test_update_task_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_task), "__call__") as call: @@ -9080,11 +9121,6 @@ async def test_update_task_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_task_async_from_dict(): - await test_update_task_async(request_type=dict) - - def test_update_task_field_headers(): client = DataplexServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9241,8 +9277,8 @@ async def test_update_task_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DeleteTaskRequest, - dict, + service.DeleteTaskRequest(), + {}, ], ) def test_delete_task(request_type, transport: str = "grpc"): @@ -9253,7 +9289,7 @@ def test_delete_task(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_task), "__call__") as call: @@ -9294,9 +9330,10 @@ def test_delete_task_non_empty_request_with_auto_populated_field(): client.delete_task(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteTaskRequest( + request_msg = service.DeleteTaskRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_task_use_cached_wrapped_rpc(): @@ -9387,9 +9424,14 @@ async def test_delete_task_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_task_async( - transport: str = "grpc_asyncio", request_type=service.DeleteTaskRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteTaskRequest(), + {}, + ], +) +async def test_delete_task_async(request_type, transport: str = "grpc_asyncio"): client = DataplexServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9397,7 +9439,7 @@ async def test_delete_task_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_task), "__call__") as call: @@ -9417,11 +9459,6 @@ async def test_delete_task_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_task_async_from_dict(): - await test_delete_task_async(request_type=dict) - - def test_delete_task_field_headers(): client = DataplexServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9568,8 +9605,8 @@ async def test_delete_task_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListTasksRequest, - dict, + service.ListTasksRequest(), + {}, ], ) def test_list_tasks(request_type, transport: str = "grpc"): @@ -9580,7 +9617,7 @@ def test_list_tasks(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tasks), "__call__") as call: @@ -9629,12 +9666,13 @@ def test_list_tasks_non_empty_request_with_auto_populated_field(): client.list_tasks(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListTasksRequest( + request_msg = service.ListTasksRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_tasks_use_cached_wrapped_rpc(): @@ -9713,9 +9751,14 @@ async def test_list_tasks_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_list_tasks_async( - transport: str = "grpc_asyncio", request_type=service.ListTasksRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListTasksRequest(), + {}, + ], +) +async def test_list_tasks_async(request_type, transport: str = "grpc_asyncio"): client = DataplexServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9723,7 +9766,7 @@ async def test_list_tasks_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_tasks), "__call__") as call: @@ -9748,11 +9791,6 @@ async def test_list_tasks_async( assert response.unreachable_locations == ["unreachable_locations_value"] -@pytest.mark.asyncio -async def test_list_tasks_async_from_dict(): - await test_list_tasks_async(request_type=dict) - - def test_list_tasks_field_headers(): client = DataplexServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10089,8 +10127,8 @@ async def test_list_tasks_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetTaskRequest, - dict, + service.GetTaskRequest(), + {}, ], ) def test_get_task(request_type, transport: str = "grpc"): @@ -10101,7 +10139,7 @@ def test_get_task(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_task), "__call__") as call: @@ -10153,9 +10191,10 @@ def test_get_task_non_empty_request_with_auto_populated_field(): client.get_task(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetTaskRequest( + request_msg = service.GetTaskRequest( name="name_value", ) + assert args[0] == request_msg def test_get_task_use_cached_wrapped_rpc(): @@ -10234,9 +10273,14 @@ async def test_get_task_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn @pytest.mark.asyncio -async def test_get_task_async( - transport: str = "grpc_asyncio", request_type=service.GetTaskRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetTaskRequest(), + {}, + ], +) +async def test_get_task_async(request_type, transport: str = "grpc_asyncio"): client = DataplexServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10244,7 +10288,7 @@ async def test_get_task_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_task), "__call__") as call: @@ -10275,11 +10319,6 @@ async def test_get_task_async( assert response.state == resources.State.ACTIVE -@pytest.mark.asyncio -async def test_get_task_async_from_dict(): - await test_get_task_async(request_type=dict) - - def test_get_task_field_headers(): client = DataplexServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10422,8 +10461,8 @@ async def test_get_task_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListJobsRequest, - dict, + service.ListJobsRequest(), + {}, ], ) def test_list_jobs(request_type, transport: str = "grpc"): @@ -10434,7 +10473,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(type(client.transport.list_jobs), "__call__") as call: @@ -10479,10 +10518,11 @@ 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] == service.ListJobsRequest( + request_msg = service.ListJobsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_jobs_use_cached_wrapped_rpc(): @@ -10561,9 +10601,14 @@ async def test_list_jobs_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_list_jobs_async( - transport: str = "grpc_asyncio", request_type=service.ListJobsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListJobsRequest(), + {}, + ], +) +async def test_list_jobs_async(request_type, transport: str = "grpc_asyncio"): client = DataplexServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10571,7 +10616,7 @@ async def test_list_jobs_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_jobs), "__call__") as call: @@ -10594,11 +10639,6 @@ async def test_list_jobs_async( assert response.next_page_token == "next_page_token_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 = DataplexServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10935,8 +10975,8 @@ async def test_list_jobs_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.RunTaskRequest, - dict, + service.RunTaskRequest(), + {}, ], ) def test_run_task(request_type, transport: str = "grpc"): @@ -10947,7 +10987,7 @@ def test_run_task(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.run_task), "__call__") as call: @@ -10988,9 +11028,10 @@ def test_run_task_non_empty_request_with_auto_populated_field(): client.run_task(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.RunTaskRequest( + request_msg = service.RunTaskRequest( name="name_value", ) + assert args[0] == request_msg def test_run_task_use_cached_wrapped_rpc(): @@ -11069,9 +11110,14 @@ async def test_run_task_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn @pytest.mark.asyncio -async def test_run_task_async( - transport: str = "grpc_asyncio", request_type=service.RunTaskRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.RunTaskRequest(), + {}, + ], +) +async def test_run_task_async(request_type, transport: str = "grpc_asyncio"): client = DataplexServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11079,7 +11125,7 @@ async def test_run_task_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.run_task), "__call__") as call: @@ -11099,11 +11145,6 @@ async def test_run_task_async( assert isinstance(response, service.RunTaskResponse) -@pytest.mark.asyncio -async def test_run_task_async_from_dict(): - await test_run_task_async(request_type=dict) - - def test_run_task_field_headers(): client = DataplexServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11250,8 +11291,8 @@ async def test_run_task_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.GetJobRequest, - dict, + service.GetJobRequest(), + {}, ], ) def test_get_job(request_type, transport: str = "grpc"): @@ -11262,7 +11303,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(type(client.transport.get_job), "__call__") as call: @@ -11320,9 +11361,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] == service.GetJobRequest( + request_msg = service.GetJobRequest( name="name_value", ) + assert args[0] == request_msg def test_get_job_use_cached_wrapped_rpc(): @@ -11401,9 +11443,14 @@ async def test_get_job_async_use_cached_wrapped_rpc(transport: str = "grpc_async @pytest.mark.asyncio -async def test_get_job_async( - transport: str = "grpc_asyncio", request_type=service.GetJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetJobRequest(), + {}, + ], +) +async def test_get_job_async(request_type, transport: str = "grpc_asyncio"): client = DataplexServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11411,7 +11458,7 @@ async def test_get_job_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_job), "__call__") as call: @@ -11448,11 +11495,6 @@ async def test_get_job_async( assert response.trigger == tasks.Job.Trigger.TASK_CONFIG -@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 = DataplexServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11595,8 +11637,8 @@ async def test_get_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.CancelJobRequest, - dict, + service.CancelJobRequest(), + {}, ], ) def test_cancel_job(request_type, transport: str = "grpc"): @@ -11607,7 +11649,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() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.cancel_job), "__call__") as call: @@ -11648,9 +11690,10 @@ def test_cancel_job_non_empty_request_with_auto_populated_field(): client.cancel_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CancelJobRequest( + request_msg = service.CancelJobRequest( name="name_value", ) + assert args[0] == request_msg def test_cancel_job_use_cached_wrapped_rpc(): @@ -11729,9 +11772,14 @@ async def test_cancel_job_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_cancel_job_async( - transport: str = "grpc_asyncio", request_type=service.CancelJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CancelJobRequest(), + {}, + ], +) +async def test_cancel_job_async(request_type, transport: str = "grpc_asyncio"): client = DataplexServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11739,7 +11787,7 @@ async def test_cancel_job_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.cancel_job), "__call__") as call: @@ -11757,11 +11805,6 @@ async def test_cancel_job_async( assert response is None -@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 = DataplexServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17672,7 +17715,6 @@ def test_create_lake_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateLakeRequest() - assert args[0] == request_msg @@ -17693,7 +17735,6 @@ def test_update_lake_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateLakeRequest() - assert args[0] == request_msg @@ -17714,7 +17755,6 @@ def test_delete_lake_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteLakeRequest() - assert args[0] == request_msg @@ -17735,7 +17775,6 @@ def test_list_lakes_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListLakesRequest() - assert args[0] == request_msg @@ -17756,7 +17795,6 @@ def test_get_lake_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetLakeRequest() - assert args[0] == request_msg @@ -17779,7 +17817,6 @@ def test_list_lake_actions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListLakeActionsRequest() - assert args[0] == request_msg @@ -17800,7 +17837,6 @@ def test_create_zone_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateZoneRequest() - assert args[0] == request_msg @@ -17821,7 +17857,6 @@ def test_update_zone_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateZoneRequest() - assert args[0] == request_msg @@ -17842,7 +17877,6 @@ def test_delete_zone_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteZoneRequest() - assert args[0] == request_msg @@ -17863,7 +17897,6 @@ def test_list_zones_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListZonesRequest() - assert args[0] == request_msg @@ -17884,7 +17917,6 @@ def test_get_zone_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetZoneRequest() - assert args[0] == request_msg @@ -17907,7 +17939,6 @@ def test_list_zone_actions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListZoneActionsRequest() - assert args[0] == request_msg @@ -17928,7 +17959,6 @@ def test_create_asset_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateAssetRequest() - assert args[0] == request_msg @@ -17949,7 +17979,6 @@ def test_update_asset_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateAssetRequest() - assert args[0] == request_msg @@ -17970,7 +17999,6 @@ def test_delete_asset_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteAssetRequest() - assert args[0] == request_msg @@ -17991,7 +18019,6 @@ def test_list_assets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListAssetsRequest() - assert args[0] == request_msg @@ -18012,7 +18039,6 @@ def test_get_asset_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetAssetRequest() - assert args[0] == request_msg @@ -18035,7 +18061,6 @@ def test_list_asset_actions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListAssetActionsRequest() - assert args[0] == request_msg @@ -18056,7 +18081,6 @@ def test_create_task_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateTaskRequest() - assert args[0] == request_msg @@ -18077,7 +18101,6 @@ def test_update_task_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateTaskRequest() - assert args[0] == request_msg @@ -18098,7 +18121,6 @@ def test_delete_task_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteTaskRequest() - assert args[0] == request_msg @@ -18119,7 +18141,6 @@ def test_list_tasks_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListTasksRequest() - assert args[0] == request_msg @@ -18140,7 +18161,6 @@ def test_get_task_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetTaskRequest() - assert args[0] == request_msg @@ -18161,7 +18181,6 @@ def test_list_jobs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListJobsRequest() - assert args[0] == request_msg @@ -18182,7 +18201,6 @@ def test_run_task_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.RunTaskRequest() - assert args[0] == request_msg @@ -18203,7 +18221,6 @@ def test_get_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetJobRequest() - assert args[0] == request_msg @@ -18224,7 +18241,6 @@ def test_cancel_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CancelJobRequest() - assert args[0] == request_msg @@ -18263,7 +18279,6 @@ async def test_create_lake_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateLakeRequest() - assert args[0] == request_msg @@ -18288,7 +18303,6 @@ async def test_update_lake_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateLakeRequest() - assert args[0] == request_msg @@ -18313,7 +18327,6 @@ async def test_delete_lake_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteLakeRequest() - assert args[0] == request_msg @@ -18341,7 +18354,6 @@ async def test_list_lakes_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListLakesRequest() - assert args[0] == request_msg @@ -18373,7 +18385,6 @@ async def test_get_lake_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetLakeRequest() - assert args[0] == request_msg @@ -18402,7 +18413,6 @@ async def test_list_lake_actions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListLakeActionsRequest() - assert args[0] == request_msg @@ -18427,7 +18437,6 @@ async def test_create_zone_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateZoneRequest() - assert args[0] == request_msg @@ -18452,7 +18461,6 @@ async def test_update_zone_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateZoneRequest() - assert args[0] == request_msg @@ -18477,7 +18485,6 @@ async def test_delete_zone_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteZoneRequest() - assert args[0] == request_msg @@ -18504,7 +18511,6 @@ async def test_list_zones_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListZonesRequest() - assert args[0] == request_msg @@ -18536,7 +18542,6 @@ async def test_get_zone_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetZoneRequest() - assert args[0] == request_msg @@ -18565,7 +18570,6 @@ async def test_list_zone_actions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListZoneActionsRequest() - assert args[0] == request_msg @@ -18590,7 +18594,6 @@ async def test_create_asset_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateAssetRequest() - assert args[0] == request_msg @@ -18615,7 +18618,6 @@ async def test_update_asset_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateAssetRequest() - assert args[0] == request_msg @@ -18640,7 +18642,6 @@ async def test_delete_asset_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteAssetRequest() - assert args[0] == request_msg @@ -18667,7 +18668,6 @@ async def test_list_assets_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListAssetsRequest() - assert args[0] == request_msg @@ -18698,7 +18698,6 @@ async def test_get_asset_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetAssetRequest() - assert args[0] == request_msg @@ -18727,7 +18726,6 @@ async def test_list_asset_actions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListAssetActionsRequest() - assert args[0] == request_msg @@ -18752,7 +18750,6 @@ async def test_create_task_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateTaskRequest() - assert args[0] == request_msg @@ -18777,7 +18774,6 @@ async def test_update_task_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateTaskRequest() - assert args[0] == request_msg @@ -18802,7 +18798,6 @@ async def test_delete_task_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteTaskRequest() - assert args[0] == request_msg @@ -18830,7 +18825,6 @@ async def test_list_tasks_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListTasksRequest() - assert args[0] == request_msg @@ -18861,7 +18855,6 @@ async def test_get_task_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetTaskRequest() - assert args[0] == request_msg @@ -18888,7 +18881,6 @@ async def test_list_jobs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListJobsRequest() - assert args[0] == request_msg @@ -18913,7 +18905,6 @@ async def test_run_task_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.RunTaskRequest() - assert args[0] == request_msg @@ -18947,7 +18938,6 @@ async def test_get_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetJobRequest() - assert args[0] == request_msg @@ -18970,7 +18960,6 @@ async def test_cancel_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CancelJobRequest() - assert args[0] == request_msg @@ -23929,7 +23918,6 @@ def test_create_lake_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateLakeRequest() - assert args[0] == request_msg @@ -23949,7 +23937,6 @@ def test_update_lake_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateLakeRequest() - assert args[0] == request_msg @@ -23969,7 +23956,6 @@ def test_delete_lake_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteLakeRequest() - assert args[0] == request_msg @@ -23989,7 +23975,6 @@ def test_list_lakes_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListLakesRequest() - assert args[0] == request_msg @@ -24009,7 +23994,6 @@ def test_get_lake_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetLakeRequest() - assert args[0] == request_msg @@ -24031,7 +24015,6 @@ def test_list_lake_actions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListLakeActionsRequest() - assert args[0] == request_msg @@ -24051,7 +24034,6 @@ def test_create_zone_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateZoneRequest() - assert args[0] == request_msg @@ -24071,7 +24053,6 @@ def test_update_zone_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateZoneRequest() - assert args[0] == request_msg @@ -24091,7 +24072,6 @@ def test_delete_zone_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteZoneRequest() - assert args[0] == request_msg @@ -24111,7 +24091,6 @@ def test_list_zones_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListZonesRequest() - assert args[0] == request_msg @@ -24131,7 +24110,6 @@ def test_get_zone_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetZoneRequest() - assert args[0] == request_msg @@ -24153,7 +24131,6 @@ def test_list_zone_actions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListZoneActionsRequest() - assert args[0] == request_msg @@ -24173,7 +24150,6 @@ def test_create_asset_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateAssetRequest() - assert args[0] == request_msg @@ -24193,7 +24169,6 @@ def test_update_asset_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateAssetRequest() - assert args[0] == request_msg @@ -24213,7 +24188,6 @@ def test_delete_asset_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteAssetRequest() - assert args[0] == request_msg @@ -24233,7 +24207,6 @@ def test_list_assets_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListAssetsRequest() - assert args[0] == request_msg @@ -24253,7 +24226,6 @@ def test_get_asset_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetAssetRequest() - assert args[0] == request_msg @@ -24275,7 +24247,6 @@ def test_list_asset_actions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListAssetActionsRequest() - assert args[0] == request_msg @@ -24295,7 +24266,6 @@ def test_create_task_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateTaskRequest() - assert args[0] == request_msg @@ -24315,7 +24285,6 @@ def test_update_task_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateTaskRequest() - assert args[0] == request_msg @@ -24335,7 +24304,6 @@ def test_delete_task_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteTaskRequest() - assert args[0] == request_msg @@ -24355,7 +24323,6 @@ def test_list_tasks_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListTasksRequest() - assert args[0] == request_msg @@ -24375,7 +24342,6 @@ def test_get_task_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetTaskRequest() - assert args[0] == request_msg @@ -24395,7 +24361,6 @@ def test_list_jobs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListJobsRequest() - assert args[0] == request_msg @@ -24415,7 +24380,6 @@ def test_run_task_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.RunTaskRequest() - assert args[0] == request_msg @@ -24435,7 +24399,6 @@ def test_get_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetJobRequest() - assert args[0] == request_msg @@ -24455,7 +24418,6 @@ def test_cancel_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CancelJobRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dataplex/tests/unit/gapic/dataplex_v1/test_metadata_service.py b/packages/google-cloud-dataplex/tests/unit/gapic/dataplex_v1/test_metadata_service.py index 5136d17cec0d..fe02b962f1a3 100644 --- a/packages/google-cloud-dataplex/tests/unit/gapic/dataplex_v1/test_metadata_service.py +++ b/packages/google-cloud-dataplex/tests/unit/gapic/dataplex_v1/test_metadata_service.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 @@ -115,6 +116,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" @@ -1342,8 +1358,8 @@ def test_metadata_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - metadata_.CreateEntityRequest, - dict, + metadata_.CreateEntityRequest(), + {}, ], ) def test_create_entity(request_type, transport: str = "grpc"): @@ -1354,7 +1370,7 @@ def test_create_entity(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_entity), "__call__") as call: @@ -1420,9 +1436,10 @@ def test_create_entity_non_empty_request_with_auto_populated_field(): client.create_entity(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metadata_.CreateEntityRequest( + request_msg = metadata_.CreateEntityRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_entity_use_cached_wrapped_rpc(): @@ -1503,9 +1520,14 @@ async def test_create_entity_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_entity_async( - transport: str = "grpc_asyncio", request_type=metadata_.CreateEntityRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metadata_.CreateEntityRequest(), + {}, + ], +) +async def test_create_entity_async(request_type, transport: str = "grpc_asyncio"): client = MetadataServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1513,7 +1535,7 @@ async def test_create_entity_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_entity), "__call__") as call: @@ -1558,11 +1580,6 @@ async def test_create_entity_async( assert response.uid == "uid_value" -@pytest.mark.asyncio -async def test_create_entity_async_from_dict(): - await test_create_entity_async(request_type=dict) - - def test_create_entity_field_headers(): client = MetadataServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1715,8 +1732,8 @@ async def test_create_entity_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metadata_.UpdateEntityRequest, - dict, + metadata_.UpdateEntityRequest(), + {}, ], ) def test_update_entity(request_type, transport: str = "grpc"): @@ -1727,7 +1744,7 @@ def test_update_entity(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_entity), "__call__") as call: @@ -1791,7 +1808,8 @@ def test_update_entity_non_empty_request_with_auto_populated_field(): client.update_entity(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metadata_.UpdateEntityRequest() + request_msg = metadata_.UpdateEntityRequest() + assert args[0] == request_msg def test_update_entity_use_cached_wrapped_rpc(): @@ -1872,9 +1890,14 @@ async def test_update_entity_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_entity_async( - transport: str = "grpc_asyncio", request_type=metadata_.UpdateEntityRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metadata_.UpdateEntityRequest(), + {}, + ], +) +async def test_update_entity_async(request_type, transport: str = "grpc_asyncio"): client = MetadataServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1882,7 +1905,7 @@ async def test_update_entity_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_entity), "__call__") as call: @@ -1927,11 +1950,6 @@ async def test_update_entity_async( assert response.uid == "uid_value" -@pytest.mark.asyncio -async def test_update_entity_async_from_dict(): - await test_update_entity_async(request_type=dict) - - def test_update_entity_field_headers(): client = MetadataServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1994,8 +2012,8 @@ async def test_update_entity_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - metadata_.DeleteEntityRequest, - dict, + metadata_.DeleteEntityRequest(), + {}, ], ) def test_delete_entity(request_type, transport: str = "grpc"): @@ -2006,7 +2024,7 @@ def test_delete_entity(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_entity), "__call__") as call: @@ -2048,10 +2066,11 @@ def test_delete_entity_non_empty_request_with_auto_populated_field(): client.delete_entity(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metadata_.DeleteEntityRequest( + request_msg = metadata_.DeleteEntityRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_entity_use_cached_wrapped_rpc(): @@ -2132,9 +2151,14 @@ async def test_delete_entity_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_entity_async( - transport: str = "grpc_asyncio", request_type=metadata_.DeleteEntityRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metadata_.DeleteEntityRequest(), + {}, + ], +) +async def test_delete_entity_async(request_type, transport: str = "grpc_asyncio"): client = MetadataServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2142,7 +2166,7 @@ async def test_delete_entity_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_entity), "__call__") as call: @@ -2160,11 +2184,6 @@ async def test_delete_entity_async( assert response is None -@pytest.mark.asyncio -async def test_delete_entity_async_from_dict(): - await test_delete_entity_async(request_type=dict) - - def test_delete_entity_field_headers(): client = MetadataServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2307,8 +2326,8 @@ async def test_delete_entity_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metadata_.GetEntityRequest, - dict, + metadata_.GetEntityRequest(), + {}, ], ) def test_get_entity(request_type, transport: str = "grpc"): @@ -2319,7 +2338,7 @@ def test_get_entity(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_entity), "__call__") as call: @@ -2385,9 +2404,10 @@ def test_get_entity_non_empty_request_with_auto_populated_field(): client.get_entity(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metadata_.GetEntityRequest( + request_msg = metadata_.GetEntityRequest( name="name_value", ) + assert args[0] == request_msg def test_get_entity_use_cached_wrapped_rpc(): @@ -2466,9 +2486,14 @@ async def test_get_entity_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_entity_async( - transport: str = "grpc_asyncio", request_type=metadata_.GetEntityRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metadata_.GetEntityRequest(), + {}, + ], +) +async def test_get_entity_async(request_type, transport: str = "grpc_asyncio"): client = MetadataServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2476,7 +2501,7 @@ async def test_get_entity_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_entity), "__call__") as call: @@ -2521,11 +2546,6 @@ async def test_get_entity_async( assert response.uid == "uid_value" -@pytest.mark.asyncio -async def test_get_entity_async_from_dict(): - await test_get_entity_async(request_type=dict) - - def test_get_entity_field_headers(): client = MetadataServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2668,8 +2688,8 @@ async def test_get_entity_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metadata_.ListEntitiesRequest, - dict, + metadata_.ListEntitiesRequest(), + {}, ], ) def test_list_entities(request_type, transport: str = "grpc"): @@ -2680,7 +2700,7 @@ def test_list_entities(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_entities), "__call__") as call: @@ -2726,11 +2746,12 @@ def test_list_entities_non_empty_request_with_auto_populated_field(): client.list_entities(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metadata_.ListEntitiesRequest( + request_msg = metadata_.ListEntitiesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_entities_use_cached_wrapped_rpc(): @@ -2811,9 +2832,14 @@ async def test_list_entities_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_entities_async( - transport: str = "grpc_asyncio", request_type=metadata_.ListEntitiesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metadata_.ListEntitiesRequest(), + {}, + ], +) +async def test_list_entities_async(request_type, transport: str = "grpc_asyncio"): client = MetadataServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2821,7 +2847,7 @@ async def test_list_entities_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_entities), "__call__") as call: @@ -2844,11 +2870,6 @@ async def test_list_entities_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_entities_async_from_dict(): - await test_list_entities_async(request_type=dict) - - def test_list_entities_field_headers(): client = MetadataServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3185,8 +3206,8 @@ async def test_list_entities_async_pages(): @pytest.mark.parametrize( "request_type", [ - metadata_.CreatePartitionRequest, - dict, + metadata_.CreatePartitionRequest(), + {}, ], ) def test_create_partition(request_type, transport: str = "grpc"): @@ -3197,7 +3218,7 @@ def test_create_partition(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_partition), "__call__") as call: @@ -3247,9 +3268,10 @@ def test_create_partition_non_empty_request_with_auto_populated_field(): client.create_partition(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metadata_.CreatePartitionRequest( + request_msg = metadata_.CreatePartitionRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_partition_use_cached_wrapped_rpc(): @@ -3332,9 +3354,14 @@ async def test_create_partition_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_partition_async( - transport: str = "grpc_asyncio", request_type=metadata_.CreatePartitionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metadata_.CreatePartitionRequest(), + {}, + ], +) +async def test_create_partition_async(request_type, transport: str = "grpc_asyncio"): client = MetadataServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3342,7 +3369,7 @@ async def test_create_partition_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_partition), "__call__") as call: @@ -3371,11 +3398,6 @@ async def test_create_partition_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_create_partition_async_from_dict(): - await test_create_partition_async(request_type=dict) - - def test_create_partition_field_headers(): client = MetadataServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3528,8 +3550,8 @@ async def test_create_partition_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metadata_.DeletePartitionRequest, - dict, + metadata_.DeletePartitionRequest(), + {}, ], ) def test_delete_partition(request_type, transport: str = "grpc"): @@ -3540,7 +3562,7 @@ def test_delete_partition(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_partition), "__call__") as call: @@ -3582,10 +3604,11 @@ def test_delete_partition_non_empty_request_with_auto_populated_field(): client.delete_partition(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metadata_.DeletePartitionRequest( + request_msg = metadata_.DeletePartitionRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_partition_use_cached_wrapped_rpc(): @@ -3668,9 +3691,14 @@ async def test_delete_partition_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_partition_async( - transport: str = "grpc_asyncio", request_type=metadata_.DeletePartitionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metadata_.DeletePartitionRequest(), + {}, + ], +) +async def test_delete_partition_async(request_type, transport: str = "grpc_asyncio"): client = MetadataServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3678,7 +3706,7 @@ async def test_delete_partition_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_partition), "__call__") as call: @@ -3696,11 +3724,6 @@ async def test_delete_partition_async( assert response is None -@pytest.mark.asyncio -async def test_delete_partition_async_from_dict(): - await test_delete_partition_async(request_type=dict) - - def test_delete_partition_field_headers(): client = MetadataServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3843,8 +3866,8 @@ async def test_delete_partition_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metadata_.GetPartitionRequest, - dict, + metadata_.GetPartitionRequest(), + {}, ], ) def test_get_partition(request_type, transport: str = "grpc"): @@ -3855,7 +3878,7 @@ def test_get_partition(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_partition), "__call__") as call: @@ -3905,9 +3928,10 @@ def test_get_partition_non_empty_request_with_auto_populated_field(): client.get_partition(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metadata_.GetPartitionRequest( + request_msg = metadata_.GetPartitionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_partition_use_cached_wrapped_rpc(): @@ -3988,9 +4012,14 @@ async def test_get_partition_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_partition_async( - transport: str = "grpc_asyncio", request_type=metadata_.GetPartitionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metadata_.GetPartitionRequest(), + {}, + ], +) +async def test_get_partition_async(request_type, transport: str = "grpc_asyncio"): client = MetadataServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3998,7 +4027,7 @@ async def test_get_partition_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_partition), "__call__") as call: @@ -4027,11 +4056,6 @@ async def test_get_partition_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_partition_async_from_dict(): - await test_get_partition_async(request_type=dict) - - def test_get_partition_field_headers(): client = MetadataServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4174,8 +4198,8 @@ async def test_get_partition_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metadata_.ListPartitionsRequest, - dict, + metadata_.ListPartitionsRequest(), + {}, ], ) def test_list_partitions(request_type, transport: str = "grpc"): @@ -4186,7 +4210,7 @@ def test_list_partitions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_partitions), "__call__") as call: @@ -4232,11 +4256,12 @@ def test_list_partitions_non_empty_request_with_auto_populated_field(): client.list_partitions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metadata_.ListPartitionsRequest( + request_msg = metadata_.ListPartitionsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_partitions_use_cached_wrapped_rpc(): @@ -4317,9 +4342,14 @@ async def test_list_partitions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_partitions_async( - transport: str = "grpc_asyncio", request_type=metadata_.ListPartitionsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metadata_.ListPartitionsRequest(), + {}, + ], +) +async def test_list_partitions_async(request_type, transport: str = "grpc_asyncio"): client = MetadataServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4327,7 +4357,7 @@ async def test_list_partitions_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_partitions), "__call__") as call: @@ -4350,11 +4380,6 @@ async def test_list_partitions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_partitions_async_from_dict(): - await test_list_partitions_async(request_type=dict) - - def test_list_partitions_field_headers(): client = MetadataServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6571,7 +6596,6 @@ def test_create_entity_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metadata_.CreateEntityRequest() - assert args[0] == request_msg @@ -6592,7 +6616,6 @@ def test_update_entity_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metadata_.UpdateEntityRequest() - assert args[0] == request_msg @@ -6613,7 +6636,6 @@ def test_delete_entity_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metadata_.DeleteEntityRequest() - assert args[0] == request_msg @@ -6634,7 +6656,6 @@ def test_get_entity_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metadata_.GetEntityRequest() - assert args[0] == request_msg @@ -6655,7 +6676,6 @@ def test_list_entities_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metadata_.ListEntitiesRequest() - assert args[0] == request_msg @@ -6676,7 +6696,6 @@ def test_create_partition_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metadata_.CreatePartitionRequest() - assert args[0] == request_msg @@ -6697,7 +6716,6 @@ def test_delete_partition_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metadata_.DeletePartitionRequest() - assert args[0] == request_msg @@ -6718,7 +6736,6 @@ def test_get_partition_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metadata_.GetPartitionRequest() - assert args[0] == request_msg @@ -6739,7 +6756,6 @@ def test_list_partitions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metadata_.ListPartitionsRequest() - assert args[0] == request_msg @@ -6791,7 +6807,6 @@ async def test_create_entity_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metadata_.CreateEntityRequest() - assert args[0] == request_msg @@ -6829,7 +6844,6 @@ async def test_update_entity_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metadata_.UpdateEntityRequest() - assert args[0] == request_msg @@ -6852,7 +6866,6 @@ async def test_delete_entity_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metadata_.DeleteEntityRequest() - assert args[0] == request_msg @@ -6890,7 +6903,6 @@ async def test_get_entity_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metadata_.GetEntityRequest() - assert args[0] == request_msg @@ -6917,7 +6929,6 @@ async def test_list_entities_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metadata_.ListEntitiesRequest() - assert args[0] == request_msg @@ -6947,7 +6958,6 @@ async def test_create_partition_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metadata_.CreatePartitionRequest() - assert args[0] == request_msg @@ -6970,7 +6980,6 @@ async def test_delete_partition_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metadata_.DeletePartitionRequest() - assert args[0] == request_msg @@ -7000,7 +7009,6 @@ async def test_get_partition_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metadata_.GetPartitionRequest() - assert args[0] == request_msg @@ -7027,7 +7035,6 @@ async def test_list_partitions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metadata_.ListPartitionsRequest() - assert args[0] == request_msg @@ -9159,7 +9166,6 @@ def test_create_entity_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metadata_.CreateEntityRequest() - assert args[0] == request_msg @@ -9179,7 +9185,6 @@ def test_update_entity_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metadata_.UpdateEntityRequest() - assert args[0] == request_msg @@ -9199,7 +9204,6 @@ def test_delete_entity_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metadata_.DeleteEntityRequest() - assert args[0] == request_msg @@ -9219,7 +9223,6 @@ def test_get_entity_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metadata_.GetEntityRequest() - assert args[0] == request_msg @@ -9239,7 +9242,6 @@ def test_list_entities_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metadata_.ListEntitiesRequest() - assert args[0] == request_msg @@ -9259,7 +9261,6 @@ def test_create_partition_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metadata_.CreatePartitionRequest() - assert args[0] == request_msg @@ -9279,7 +9280,6 @@ def test_delete_partition_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metadata_.DeletePartitionRequest() - assert args[0] == request_msg @@ -9299,7 +9299,6 @@ def test_get_partition_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metadata_.GetPartitionRequest() - assert args[0] == request_msg @@ -9319,7 +9318,6 @@ def test_list_partitions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metadata_.ListPartitionsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dataproc-metastore/noxfile.py b/packages/google-cloud-dataproc-metastore/noxfile.py index bab336c5e2d7..47eff28054f9 100644 --- a/packages/google-cloud-dataproc-metastore/noxfile.py +++ b/packages/google-cloud-dataproc-metastore/noxfile.py @@ -47,7 +47,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-dataproc-metastore" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-dataproc-metastore/setup.py b/packages/google-cloud-dataproc-metastore/setup.py index 0883210051a1..b773b5a98b0d 100644 --- a/packages/google-cloud-dataproc-metastore/setup.py +++ b/packages/google-cloud-dataproc-metastore/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/google-cloud-dataproc-metastore/testing/constraints-3.10.txt b/packages/google-cloud-dataproc-metastore/testing/constraints-3.10.txt index a92801e1c8e2..b39cd54634f9 100644 --- a/packages/google-cloud-dataproc-metastore/testing/constraints-3.10.txt +++ b/packages/google-cloud-dataproc-metastore/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/google-cloud-dataproc-metastore/tests/unit/gapic/metastore_v1/test_dataproc_metastore.py b/packages/google-cloud-dataproc-metastore/tests/unit/gapic/metastore_v1/test_dataproc_metastore.py index 5b49aee00c95..7dacf621bfda 100644 --- a/packages/google-cloud-dataproc-metastore/tests/unit/gapic/metastore_v1/test_dataproc_metastore.py +++ b/packages/google-cloud-dataproc-metastore/tests/unit/gapic/metastore_v1/test_dataproc_metastore.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 @@ -123,6 +124,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" @@ -1364,8 +1380,8 @@ def test_dataproc_metastore_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - metastore.ListServicesRequest, - dict, + metastore.ListServicesRequest(), + {}, ], ) def test_list_services(request_type, transport: str = "grpc"): @@ -1376,7 +1392,7 @@ def test_list_services(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_services), "__call__") as call: @@ -1425,12 +1441,13 @@ def test_list_services_non_empty_request_with_auto_populated_field(): client.list_services(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.ListServicesRequest( + request_msg = metastore.ListServicesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_services_use_cached_wrapped_rpc(): @@ -1511,9 +1528,14 @@ async def test_list_services_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_services_async( - transport: str = "grpc_asyncio", request_type=metastore.ListServicesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.ListServicesRequest(), + {}, + ], +) +async def test_list_services_async(request_type, transport: str = "grpc_asyncio"): client = DataprocMetastoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1521,7 +1543,7 @@ async def test_list_services_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_services), "__call__") as call: @@ -1546,11 +1568,6 @@ async def test_list_services_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_services_async_from_dict(): - await test_list_services_async(request_type=dict) - - def test_list_services_field_headers(): client = DataprocMetastoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1887,8 +1904,8 @@ async def test_list_services_async_pages(): @pytest.mark.parametrize( "request_type", [ - metastore.GetServiceRequest, - dict, + metastore.GetServiceRequest(), + {}, ], ) def test_get_service(request_type, transport: str = "grpc"): @@ -1899,7 +1916,7 @@ def test_get_service(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_service), "__call__") as call: @@ -1963,9 +1980,10 @@ def test_get_service_non_empty_request_with_auto_populated_field(): client.get_service(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.GetServiceRequest( + request_msg = metastore.GetServiceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_service_use_cached_wrapped_rpc(): @@ -2046,9 +2064,14 @@ async def test_get_service_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_service_async( - transport: str = "grpc_asyncio", request_type=metastore.GetServiceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.GetServiceRequest(), + {}, + ], +) +async def test_get_service_async(request_type, transport: str = "grpc_asyncio"): client = DataprocMetastoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2056,7 +2079,7 @@ async def test_get_service_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_service), "__call__") as call: @@ -2099,11 +2122,6 @@ async def test_get_service_async( assert response.database_type == metastore.Service.DatabaseType.MYSQL -@pytest.mark.asyncio -async def test_get_service_async_from_dict(): - await test_get_service_async(request_type=dict) - - def test_get_service_field_headers(): client = DataprocMetastoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2246,8 +2264,8 @@ async def test_get_service_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metastore.CreateServiceRequest, - dict, + metastore.CreateServiceRequest(), + {}, ], ) def test_create_service(request_type, transport: str = "grpc"): @@ -2258,7 +2276,7 @@ def test_create_service(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_service), "__call__") as call: @@ -2301,11 +2319,12 @@ def test_create_service_non_empty_request_with_auto_populated_field(): client.create_service(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.CreateServiceRequest( + request_msg = metastore.CreateServiceRequest( parent="parent_value", service_id="service_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_service_use_cached_wrapped_rpc(): @@ -2396,9 +2415,14 @@ async def test_create_service_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_service_async( - transport: str = "grpc_asyncio", request_type=metastore.CreateServiceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.CreateServiceRequest(), + {}, + ], +) +async def test_create_service_async(request_type, transport: str = "grpc_asyncio"): client = DataprocMetastoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2406,7 +2430,7 @@ async def test_create_service_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_service), "__call__") as call: @@ -2426,11 +2450,6 @@ async def test_create_service_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_service_async_from_dict(): - await test_create_service_async(request_type=dict) - - def test_create_service_field_headers(): client = DataprocMetastoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2617,8 +2636,8 @@ async def test_create_service_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metastore.UpdateServiceRequest, - dict, + metastore.UpdateServiceRequest(), + {}, ], ) def test_update_service(request_type, transport: str = "grpc"): @@ -2629,7 +2648,7 @@ def test_update_service(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_service), "__call__") as call: @@ -2670,9 +2689,10 @@ def test_update_service_non_empty_request_with_auto_populated_field(): client.update_service(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.UpdateServiceRequest( + request_msg = metastore.UpdateServiceRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_service_use_cached_wrapped_rpc(): @@ -2763,9 +2783,14 @@ async def test_update_service_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_service_async( - transport: str = "grpc_asyncio", request_type=metastore.UpdateServiceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.UpdateServiceRequest(), + {}, + ], +) +async def test_update_service_async(request_type, transport: str = "grpc_asyncio"): client = DataprocMetastoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2773,7 +2798,7 @@ async def test_update_service_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_service), "__call__") as call: @@ -2793,11 +2818,6 @@ async def test_update_service_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_service_async_from_dict(): - await test_update_service_async(request_type=dict) - - def test_update_service_field_headers(): client = DataprocMetastoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2974,8 +2994,8 @@ async def test_update_service_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metastore.DeleteServiceRequest, - dict, + metastore.DeleteServiceRequest(), + {}, ], ) def test_delete_service(request_type, transport: str = "grpc"): @@ -2986,7 +3006,7 @@ def test_delete_service(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_service), "__call__") as call: @@ -3028,10 +3048,11 @@ def test_delete_service_non_empty_request_with_auto_populated_field(): client.delete_service(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.DeleteServiceRequest( + request_msg = metastore.DeleteServiceRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_service_use_cached_wrapped_rpc(): @@ -3122,9 +3143,14 @@ async def test_delete_service_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_service_async( - transport: str = "grpc_asyncio", request_type=metastore.DeleteServiceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.DeleteServiceRequest(), + {}, + ], +) +async def test_delete_service_async(request_type, transport: str = "grpc_asyncio"): client = DataprocMetastoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3132,7 +3158,7 @@ async def test_delete_service_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_service), "__call__") as call: @@ -3152,11 +3178,6 @@ async def test_delete_service_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_service_async_from_dict(): - await test_delete_service_async(request_type=dict) - - def test_delete_service_field_headers(): client = DataprocMetastoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3303,8 +3324,8 @@ async def test_delete_service_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metastore.ListMetadataImportsRequest, - dict, + metastore.ListMetadataImportsRequest(), + {}, ], ) def test_list_metadata_imports(request_type, transport: str = "grpc"): @@ -3315,7 +3336,7 @@ def test_list_metadata_imports(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3368,12 +3389,13 @@ def test_list_metadata_imports_non_empty_request_with_auto_populated_field(): client.list_metadata_imports(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.ListMetadataImportsRequest( + request_msg = metastore.ListMetadataImportsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_metadata_imports_use_cached_wrapped_rpc(): @@ -3459,8 +3481,15 @@ async def test_list_metadata_imports_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + metastore.ListMetadataImportsRequest(), + {}, + ], +) async def test_list_metadata_imports_async( - transport: str = "grpc_asyncio", request_type=metastore.ListMetadataImportsRequest + request_type, transport: str = "grpc_asyncio" ): client = DataprocMetastoreAsyncClient( credentials=async_anonymous_credentials(), @@ -3469,7 +3498,7 @@ async def test_list_metadata_imports_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( @@ -3496,11 +3525,6 @@ async def test_list_metadata_imports_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_metadata_imports_async_from_dict(): - await test_list_metadata_imports_async(request_type=dict) - - def test_list_metadata_imports_field_headers(): client = DataprocMetastoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3853,8 +3877,8 @@ async def test_list_metadata_imports_async_pages(): @pytest.mark.parametrize( "request_type", [ - metastore.GetMetadataImportRequest, - dict, + metastore.GetMetadataImportRequest(), + {}, ], ) def test_get_metadata_import(request_type, transport: str = "grpc"): @@ -3865,7 +3889,7 @@ def test_get_metadata_import(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3917,9 +3941,10 @@ def test_get_metadata_import_non_empty_request_with_auto_populated_field(): client.get_metadata_import(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.GetMetadataImportRequest( + request_msg = metastore.GetMetadataImportRequest( name="name_value", ) + assert args[0] == request_msg def test_get_metadata_import_use_cached_wrapped_rpc(): @@ -4004,9 +4029,14 @@ async def test_get_metadata_import_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_metadata_import_async( - transport: str = "grpc_asyncio", request_type=metastore.GetMetadataImportRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.GetMetadataImportRequest(), + {}, + ], +) +async def test_get_metadata_import_async(request_type, transport: str = "grpc_asyncio"): client = DataprocMetastoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4014,7 +4044,7 @@ async def test_get_metadata_import_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( @@ -4043,11 +4073,6 @@ async def test_get_metadata_import_async( assert response.state == metastore.MetadataImport.State.RUNNING -@pytest.mark.asyncio -async def test_get_metadata_import_async_from_dict(): - await test_get_metadata_import_async(request_type=dict) - - def test_get_metadata_import_field_headers(): client = DataprocMetastoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4202,8 +4227,8 @@ async def test_get_metadata_import_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metastore.CreateMetadataImportRequest, - dict, + metastore.CreateMetadataImportRequest(), + {}, ], ) def test_create_metadata_import(request_type, transport: str = "grpc"): @@ -4214,7 +4239,7 @@ def test_create_metadata_import(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4261,11 +4286,12 @@ def test_create_metadata_import_non_empty_request_with_auto_populated_field(): client.create_metadata_import(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.CreateMetadataImportRequest( + request_msg = metastore.CreateMetadataImportRequest( parent="parent_value", metadata_import_id="metadata_import_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_metadata_import_use_cached_wrapped_rpc(): @@ -4361,8 +4387,15 @@ async def test_create_metadata_import_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + metastore.CreateMetadataImportRequest(), + {}, + ], +) async def test_create_metadata_import_async( - transport: str = "grpc_asyncio", request_type=metastore.CreateMetadataImportRequest + request_type, transport: str = "grpc_asyncio" ): client = DataprocMetastoreAsyncClient( credentials=async_anonymous_credentials(), @@ -4371,7 +4404,7 @@ async def test_create_metadata_import_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( @@ -4393,11 +4426,6 @@ async def test_create_metadata_import_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_metadata_import_async_from_dict(): - await test_create_metadata_import_async(request_type=dict) - - def test_create_metadata_import_field_headers(): client = DataprocMetastoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4596,8 +4624,8 @@ async def test_create_metadata_import_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metastore.UpdateMetadataImportRequest, - dict, + metastore.UpdateMetadataImportRequest(), + {}, ], ) def test_update_metadata_import(request_type, transport: str = "grpc"): @@ -4608,7 +4636,7 @@ def test_update_metadata_import(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4653,9 +4681,10 @@ def test_update_metadata_import_non_empty_request_with_auto_populated_field(): client.update_metadata_import(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.UpdateMetadataImportRequest( + request_msg = metastore.UpdateMetadataImportRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_metadata_import_use_cached_wrapped_rpc(): @@ -4751,8 +4780,15 @@ async def test_update_metadata_import_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + metastore.UpdateMetadataImportRequest(), + {}, + ], +) async def test_update_metadata_import_async( - transport: str = "grpc_asyncio", request_type=metastore.UpdateMetadataImportRequest + request_type, transport: str = "grpc_asyncio" ): client = DataprocMetastoreAsyncClient( credentials=async_anonymous_credentials(), @@ -4761,7 +4797,7 @@ async def test_update_metadata_import_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( @@ -4783,11 +4819,6 @@ async def test_update_metadata_import_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_metadata_import_async_from_dict(): - await test_update_metadata_import_async(request_type=dict) - - def test_update_metadata_import_field_headers(): client = DataprocMetastoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4976,8 +5007,8 @@ async def test_update_metadata_import_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metastore.ExportMetadataRequest, - dict, + metastore.ExportMetadataRequest(), + {}, ], ) def test_export_metadata(request_type, transport: str = "grpc"): @@ -4988,7 +5019,7 @@ def test_export_metadata(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.export_metadata), "__call__") as call: @@ -5031,11 +5062,12 @@ def test_export_metadata_non_empty_request_with_auto_populated_field(): client.export_metadata(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.ExportMetadataRequest( + request_msg = metastore.ExportMetadataRequest( destination_gcs_folder="destination_gcs_folder_value", service="service_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_export_metadata_use_cached_wrapped_rpc(): @@ -5126,9 +5158,14 @@ async def test_export_metadata_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_export_metadata_async( - transport: str = "grpc_asyncio", request_type=metastore.ExportMetadataRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.ExportMetadataRequest(), + {}, + ], +) +async def test_export_metadata_async(request_type, transport: str = "grpc_asyncio"): client = DataprocMetastoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5136,7 +5173,7 @@ async def test_export_metadata_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.export_metadata), "__call__") as call: @@ -5156,11 +5193,6 @@ async def test_export_metadata_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_export_metadata_async_from_dict(): - await test_export_metadata_async(request_type=dict) - - def test_export_metadata_field_headers(): client = DataprocMetastoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5225,8 +5257,8 @@ async def test_export_metadata_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - metastore.RestoreServiceRequest, - dict, + metastore.RestoreServiceRequest(), + {}, ], ) def test_restore_service(request_type, transport: str = "grpc"): @@ -5237,7 +5269,7 @@ def test_restore_service(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.restore_service), "__call__") as call: @@ -5280,11 +5312,12 @@ def test_restore_service_non_empty_request_with_auto_populated_field(): client.restore_service(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.RestoreServiceRequest( + request_msg = metastore.RestoreServiceRequest( service="service_value", backup="backup_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_restore_service_use_cached_wrapped_rpc(): @@ -5375,9 +5408,14 @@ async def test_restore_service_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_restore_service_async( - transport: str = "grpc_asyncio", request_type=metastore.RestoreServiceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.RestoreServiceRequest(), + {}, + ], +) +async def test_restore_service_async(request_type, transport: str = "grpc_asyncio"): client = DataprocMetastoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5385,7 +5423,7 @@ async def test_restore_service_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.restore_service), "__call__") as call: @@ -5405,11 +5443,6 @@ async def test_restore_service_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_restore_service_async_from_dict(): - await test_restore_service_async(request_type=dict) - - def test_restore_service_field_headers(): client = DataprocMetastoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5566,8 +5599,8 @@ async def test_restore_service_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metastore.ListBackupsRequest, - dict, + metastore.ListBackupsRequest(), + {}, ], ) def test_list_backups(request_type, transport: str = "grpc"): @@ -5578,7 +5611,7 @@ def test_list_backups(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_backups), "__call__") as call: @@ -5627,12 +5660,13 @@ def test_list_backups_non_empty_request_with_auto_populated_field(): client.list_backups(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.ListBackupsRequest( + request_msg = metastore.ListBackupsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_backups_use_cached_wrapped_rpc(): @@ -5713,9 +5747,14 @@ async def test_list_backups_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_backups_async( - transport: str = "grpc_asyncio", request_type=metastore.ListBackupsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.ListBackupsRequest(), + {}, + ], +) +async def test_list_backups_async(request_type, transport: str = "grpc_asyncio"): client = DataprocMetastoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5723,7 +5762,7 @@ async def test_list_backups_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_backups), "__call__") as call: @@ -5748,11 +5787,6 @@ async def test_list_backups_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_backups_async_from_dict(): - await test_list_backups_async(request_type=dict) - - def test_list_backups_field_headers(): client = DataprocMetastoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6089,8 +6123,8 @@ async def test_list_backups_async_pages(): @pytest.mark.parametrize( "request_type", [ - metastore.GetBackupRequest, - dict, + metastore.GetBackupRequest(), + {}, ], ) def test_get_backup(request_type, transport: str = "grpc"): @@ -6101,7 +6135,7 @@ def test_get_backup(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_backup), "__call__") as call: @@ -6151,9 +6185,10 @@ def test_get_backup_non_empty_request_with_auto_populated_field(): client.get_backup(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.GetBackupRequest( + request_msg = metastore.GetBackupRequest( name="name_value", ) + assert args[0] == request_msg def test_get_backup_use_cached_wrapped_rpc(): @@ -6232,9 +6267,14 @@ async def test_get_backup_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_backup_async( - transport: str = "grpc_asyncio", request_type=metastore.GetBackupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.GetBackupRequest(), + {}, + ], +) +async def test_get_backup_async(request_type, transport: str = "grpc_asyncio"): client = DataprocMetastoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6242,7 +6282,7 @@ async def test_get_backup_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_backup), "__call__") as call: @@ -6271,11 +6311,6 @@ async def test_get_backup_async( assert response.restoring_services == ["restoring_services_value"] -@pytest.mark.asyncio -async def test_get_backup_async_from_dict(): - await test_get_backup_async(request_type=dict) - - def test_get_backup_field_headers(): client = DataprocMetastoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6418,8 +6453,8 @@ async def test_get_backup_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metastore.CreateBackupRequest, - dict, + metastore.CreateBackupRequest(), + {}, ], ) def test_create_backup(request_type, transport: str = "grpc"): @@ -6430,7 +6465,7 @@ def test_create_backup(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_backup), "__call__") as call: @@ -6473,11 +6508,12 @@ def test_create_backup_non_empty_request_with_auto_populated_field(): client.create_backup(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.CreateBackupRequest( + request_msg = metastore.CreateBackupRequest( parent="parent_value", backup_id="backup_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_backup_use_cached_wrapped_rpc(): @@ -6568,9 +6604,14 @@ async def test_create_backup_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_backup_async( - transport: str = "grpc_asyncio", request_type=metastore.CreateBackupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.CreateBackupRequest(), + {}, + ], +) +async def test_create_backup_async(request_type, transport: str = "grpc_asyncio"): client = DataprocMetastoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6578,7 +6619,7 @@ async def test_create_backup_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_backup), "__call__") as call: @@ -6598,11 +6639,6 @@ async def test_create_backup_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_backup_async_from_dict(): - await test_create_backup_async(request_type=dict) - - def test_create_backup_field_headers(): client = DataprocMetastoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6769,8 +6805,8 @@ async def test_create_backup_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metastore.DeleteBackupRequest, - dict, + metastore.DeleteBackupRequest(), + {}, ], ) def test_delete_backup(request_type, transport: str = "grpc"): @@ -6781,7 +6817,7 @@ def test_delete_backup(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_backup), "__call__") as call: @@ -6823,10 +6859,11 @@ def test_delete_backup_non_empty_request_with_auto_populated_field(): client.delete_backup(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.DeleteBackupRequest( + request_msg = metastore.DeleteBackupRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_backup_use_cached_wrapped_rpc(): @@ -6917,9 +6954,14 @@ async def test_delete_backup_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_backup_async( - transport: str = "grpc_asyncio", request_type=metastore.DeleteBackupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.DeleteBackupRequest(), + {}, + ], +) +async def test_delete_backup_async(request_type, transport: str = "grpc_asyncio"): client = DataprocMetastoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6927,7 +6969,7 @@ async def test_delete_backup_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_backup), "__call__") as call: @@ -6947,11 +6989,6 @@ async def test_delete_backup_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_backup_async_from_dict(): - await test_delete_backup_async(request_type=dict) - - def test_delete_backup_field_headers(): client = DataprocMetastoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7098,8 +7135,8 @@ async def test_delete_backup_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metastore.QueryMetadataRequest, - dict, + metastore.QueryMetadataRequest(), + {}, ], ) def test_query_metadata(request_type, transport: str = "grpc"): @@ -7110,7 +7147,7 @@ def test_query_metadata(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.query_metadata), "__call__") as call: @@ -7152,10 +7189,11 @@ def test_query_metadata_non_empty_request_with_auto_populated_field(): client.query_metadata(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.QueryMetadataRequest( + request_msg = metastore.QueryMetadataRequest( service="service_value", query="query_value", ) + assert args[0] == request_msg def test_query_metadata_use_cached_wrapped_rpc(): @@ -7246,9 +7284,14 @@ async def test_query_metadata_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_query_metadata_async( - transport: str = "grpc_asyncio", request_type=metastore.QueryMetadataRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.QueryMetadataRequest(), + {}, + ], +) +async def test_query_metadata_async(request_type, transport: str = "grpc_asyncio"): client = DataprocMetastoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7256,7 +7299,7 @@ async def test_query_metadata_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.query_metadata), "__call__") as call: @@ -7276,11 +7319,6 @@ async def test_query_metadata_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_query_metadata_async_from_dict(): - await test_query_metadata_async(request_type=dict) - - def test_query_metadata_field_headers(): client = DataprocMetastoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7345,8 +7383,8 @@ async def test_query_metadata_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - metastore.MoveTableToDatabaseRequest, - dict, + metastore.MoveTableToDatabaseRequest(), + {}, ], ) def test_move_table_to_database(request_type, transport: str = "grpc"): @@ -7357,7 +7395,7 @@ def test_move_table_to_database(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7405,12 +7443,13 @@ def test_move_table_to_database_non_empty_request_with_auto_populated_field(): client.move_table_to_database(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.MoveTableToDatabaseRequest( + request_msg = metastore.MoveTableToDatabaseRequest( service="service_value", table_name="table_name_value", db_name="db_name_value", destination_db_name="destination_db_name_value", ) + assert args[0] == request_msg def test_move_table_to_database_use_cached_wrapped_rpc(): @@ -7506,8 +7545,15 @@ async def test_move_table_to_database_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + metastore.MoveTableToDatabaseRequest(), + {}, + ], +) async def test_move_table_to_database_async( - transport: str = "grpc_asyncio", request_type=metastore.MoveTableToDatabaseRequest + request_type, transport: str = "grpc_asyncio" ): client = DataprocMetastoreAsyncClient( credentials=async_anonymous_credentials(), @@ -7516,7 +7562,7 @@ async def test_move_table_to_database_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( @@ -7538,11 +7584,6 @@ async def test_move_table_to_database_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_move_table_to_database_async_from_dict(): - await test_move_table_to_database_async(request_type=dict) - - def test_move_table_to_database_field_headers(): client = DataprocMetastoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7611,8 +7652,8 @@ async def test_move_table_to_database_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - metastore.AlterMetadataResourceLocationRequest, - dict, + metastore.AlterMetadataResourceLocationRequest(), + {}, ], ) def test_alter_metadata_resource_location(request_type, transport: str = "grpc"): @@ -7623,7 +7664,7 @@ def test_alter_metadata_resource_location(request_type, transport: str = "grpc") # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7670,11 +7711,12 @@ def test_alter_metadata_resource_location_non_empty_request_with_auto_populated_ client.alter_metadata_resource_location(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.AlterMetadataResourceLocationRequest( + request_msg = metastore.AlterMetadataResourceLocationRequest( service="service_value", resource_name="resource_name_value", location_uri="location_uri_value", ) + assert args[0] == request_msg def test_alter_metadata_resource_location_use_cached_wrapped_rpc(): @@ -7770,9 +7812,15 @@ async def test_alter_metadata_resource_location_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + metastore.AlterMetadataResourceLocationRequest(), + {}, + ], +) async def test_alter_metadata_resource_location_async( - transport: str = "grpc_asyncio", - request_type=metastore.AlterMetadataResourceLocationRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataprocMetastoreAsyncClient( credentials=async_anonymous_credentials(), @@ -7781,7 +7829,7 @@ async def test_alter_metadata_resource_location_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( @@ -7803,11 +7851,6 @@ async def test_alter_metadata_resource_location_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_alter_metadata_resource_location_async_from_dict(): - await test_alter_metadata_resource_location_async(request_type=dict) - - def test_alter_metadata_resource_location_field_headers(): client = DataprocMetastoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11506,7 +11549,6 @@ def test_list_services_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.ListServicesRequest() - assert args[0] == request_msg @@ -11527,7 +11569,6 @@ def test_get_service_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.GetServiceRequest() - assert args[0] == request_msg @@ -11548,7 +11589,6 @@ def test_create_service_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.CreateServiceRequest() - assert args[0] == request_msg @@ -11569,7 +11609,6 @@ def test_update_service_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.UpdateServiceRequest() - assert args[0] == request_msg @@ -11590,7 +11629,6 @@ def test_delete_service_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.DeleteServiceRequest() - assert args[0] == request_msg @@ -11613,7 +11651,6 @@ def test_list_metadata_imports_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.ListMetadataImportsRequest() - assert args[0] == request_msg @@ -11636,7 +11673,6 @@ def test_get_metadata_import_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.GetMetadataImportRequest() - assert args[0] == request_msg @@ -11659,7 +11695,6 @@ def test_create_metadata_import_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.CreateMetadataImportRequest() - assert args[0] == request_msg @@ -11682,7 +11717,6 @@ def test_update_metadata_import_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.UpdateMetadataImportRequest() - assert args[0] == request_msg @@ -11703,7 +11737,6 @@ def test_export_metadata_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.ExportMetadataRequest() - assert args[0] == request_msg @@ -11724,7 +11757,6 @@ def test_restore_service_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.RestoreServiceRequest() - assert args[0] == request_msg @@ -11745,7 +11777,6 @@ def test_list_backups_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.ListBackupsRequest() - assert args[0] == request_msg @@ -11766,7 +11797,6 @@ def test_get_backup_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.GetBackupRequest() - assert args[0] == request_msg @@ -11787,7 +11817,6 @@ def test_create_backup_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.CreateBackupRequest() - assert args[0] == request_msg @@ -11808,7 +11837,6 @@ def test_delete_backup_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.DeleteBackupRequest() - assert args[0] == request_msg @@ -11829,7 +11857,6 @@ def test_query_metadata_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.QueryMetadataRequest() - assert args[0] == request_msg @@ -11852,7 +11879,6 @@ def test_move_table_to_database_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.MoveTableToDatabaseRequest() - assert args[0] == request_msg @@ -11875,7 +11901,6 @@ def test_alter_metadata_resource_location_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.AlterMetadataResourceLocationRequest() - assert args[0] == request_msg @@ -11917,7 +11942,6 @@ async def test_list_services_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.ListServicesRequest() - assert args[0] == request_msg @@ -11954,7 +11978,6 @@ async def test_get_service_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.GetServiceRequest() - assert args[0] == request_msg @@ -11979,7 +12002,6 @@ async def test_create_service_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.CreateServiceRequest() - assert args[0] == request_msg @@ -12004,7 +12026,6 @@ async def test_update_service_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.UpdateServiceRequest() - assert args[0] == request_msg @@ -12029,7 +12050,6 @@ async def test_delete_service_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.DeleteServiceRequest() - assert args[0] == request_msg @@ -12059,7 +12079,6 @@ async def test_list_metadata_imports_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.ListMetadataImportsRequest() - assert args[0] == request_msg @@ -12090,7 +12109,6 @@ async def test_get_metadata_import_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.GetMetadataImportRequest() - assert args[0] == request_msg @@ -12117,7 +12135,6 @@ async def test_create_metadata_import_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.CreateMetadataImportRequest() - assert args[0] == request_msg @@ -12144,7 +12161,6 @@ async def test_update_metadata_import_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.UpdateMetadataImportRequest() - assert args[0] == request_msg @@ -12169,7 +12185,6 @@ async def test_export_metadata_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.ExportMetadataRequest() - assert args[0] == request_msg @@ -12194,7 +12209,6 @@ async def test_restore_service_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.RestoreServiceRequest() - assert args[0] == request_msg @@ -12222,7 +12236,6 @@ async def test_list_backups_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.ListBackupsRequest() - assert args[0] == request_msg @@ -12252,7 +12265,6 @@ async def test_get_backup_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.GetBackupRequest() - assert args[0] == request_msg @@ -12277,7 +12289,6 @@ async def test_create_backup_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.CreateBackupRequest() - assert args[0] == request_msg @@ -12302,7 +12313,6 @@ async def test_delete_backup_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.DeleteBackupRequest() - assert args[0] == request_msg @@ -12327,7 +12337,6 @@ async def test_query_metadata_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.QueryMetadataRequest() - assert args[0] == request_msg @@ -12354,7 +12363,6 @@ async def test_move_table_to_database_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.MoveTableToDatabaseRequest() - assert args[0] == request_msg @@ -12381,7 +12389,6 @@ async def test_alter_metadata_resource_location_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.AlterMetadataResourceLocationRequest() - assert args[0] == request_msg @@ -15859,7 +15866,6 @@ def test_list_services_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.ListServicesRequest() - assert args[0] == request_msg @@ -15879,7 +15885,6 @@ def test_get_service_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.GetServiceRequest() - assert args[0] == request_msg @@ -15899,7 +15904,6 @@ def test_create_service_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.CreateServiceRequest() - assert args[0] == request_msg @@ -15919,7 +15923,6 @@ def test_update_service_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.UpdateServiceRequest() - assert args[0] == request_msg @@ -15939,7 +15942,6 @@ def test_delete_service_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.DeleteServiceRequest() - assert args[0] == request_msg @@ -15961,7 +15963,6 @@ def test_list_metadata_imports_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.ListMetadataImportsRequest() - assert args[0] == request_msg @@ -15983,7 +15984,6 @@ def test_get_metadata_import_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.GetMetadataImportRequest() - assert args[0] == request_msg @@ -16005,7 +16005,6 @@ def test_create_metadata_import_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.CreateMetadataImportRequest() - assert args[0] == request_msg @@ -16027,7 +16026,6 @@ def test_update_metadata_import_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.UpdateMetadataImportRequest() - assert args[0] == request_msg @@ -16047,7 +16045,6 @@ def test_export_metadata_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.ExportMetadataRequest() - assert args[0] == request_msg @@ -16067,7 +16064,6 @@ def test_restore_service_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.RestoreServiceRequest() - assert args[0] == request_msg @@ -16087,7 +16083,6 @@ def test_list_backups_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.ListBackupsRequest() - assert args[0] == request_msg @@ -16107,7 +16102,6 @@ def test_get_backup_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.GetBackupRequest() - assert args[0] == request_msg @@ -16127,7 +16121,6 @@ def test_create_backup_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.CreateBackupRequest() - assert args[0] == request_msg @@ -16147,7 +16140,6 @@ def test_delete_backup_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.DeleteBackupRequest() - assert args[0] == request_msg @@ -16167,7 +16159,6 @@ def test_query_metadata_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.QueryMetadataRequest() - assert args[0] == request_msg @@ -16189,7 +16180,6 @@ def test_move_table_to_database_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.MoveTableToDatabaseRequest() - assert args[0] == request_msg @@ -16211,7 +16201,6 @@ def test_alter_metadata_resource_location_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.AlterMetadataResourceLocationRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dataproc-metastore/tests/unit/gapic/metastore_v1/test_dataproc_metastore_federation.py b/packages/google-cloud-dataproc-metastore/tests/unit/gapic/metastore_v1/test_dataproc_metastore_federation.py index dfb8673e122d..09b2547bd11e 100644 --- a/packages/google-cloud-dataproc-metastore/tests/unit/gapic/metastore_v1/test_dataproc_metastore_federation.py +++ b/packages/google-cloud-dataproc-metastore/tests/unit/gapic/metastore_v1/test_dataproc_metastore_federation.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 @@ -121,6 +122,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" @@ -1427,8 +1443,8 @@ def test_dataproc_metastore_federation_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - metastore_federation.ListFederationsRequest, - dict, + metastore_federation.ListFederationsRequest(), + {}, ], ) def test_list_federations(request_type, transport: str = "grpc"): @@ -1439,7 +1455,7 @@ def test_list_federations(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_federations), "__call__") as call: @@ -1488,12 +1504,13 @@ def test_list_federations_non_empty_request_with_auto_populated_field(): client.list_federations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore_federation.ListFederationsRequest( + request_msg = metastore_federation.ListFederationsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_federations_use_cached_wrapped_rpc(): @@ -1576,10 +1593,14 @@ async def test_list_federations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_federations_async( - transport: str = "grpc_asyncio", - request_type=metastore_federation.ListFederationsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + metastore_federation.ListFederationsRequest(), + {}, + ], +) +async def test_list_federations_async(request_type, transport: str = "grpc_asyncio"): client = DataprocMetastoreFederationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1587,7 +1608,7 @@ async def test_list_federations_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_federations), "__call__") as call: @@ -1612,11 +1633,6 @@ async def test_list_federations_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_federations_async_from_dict(): - await test_list_federations_async(request_type=dict) - - def test_list_federations_field_headers(): client = DataprocMetastoreFederationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1953,8 +1969,8 @@ async def test_list_federations_async_pages(): @pytest.mark.parametrize( "request_type", [ - metastore_federation.GetFederationRequest, - dict, + metastore_federation.GetFederationRequest(), + {}, ], ) def test_get_federation(request_type, transport: str = "grpc"): @@ -1965,7 +1981,7 @@ def test_get_federation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_federation), "__call__") as call: @@ -2019,9 +2035,10 @@ def test_get_federation_non_empty_request_with_auto_populated_field(): client.get_federation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore_federation.GetFederationRequest( + request_msg = metastore_federation.GetFederationRequest( name="name_value", ) + assert args[0] == request_msg def test_get_federation_use_cached_wrapped_rpc(): @@ -2102,10 +2119,14 @@ async def test_get_federation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_federation_async( - transport: str = "grpc_asyncio", - request_type=metastore_federation.GetFederationRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + metastore_federation.GetFederationRequest(), + {}, + ], +) +async def test_get_federation_async(request_type, transport: str = "grpc_asyncio"): client = DataprocMetastoreFederationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2113,7 +2134,7 @@ async def test_get_federation_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_federation), "__call__") as call: @@ -2146,11 +2167,6 @@ async def test_get_federation_async( assert response.uid == "uid_value" -@pytest.mark.asyncio -async def test_get_federation_async_from_dict(): - await test_get_federation_async(request_type=dict) - - def test_get_federation_field_headers(): client = DataprocMetastoreFederationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2297,8 +2313,8 @@ async def test_get_federation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metastore_federation.CreateFederationRequest, - dict, + metastore_federation.CreateFederationRequest(), + {}, ], ) def test_create_federation(request_type, transport: str = "grpc"): @@ -2309,7 +2325,7 @@ def test_create_federation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2356,11 +2372,12 @@ def test_create_federation_non_empty_request_with_auto_populated_field(): client.create_federation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore_federation.CreateFederationRequest( + request_msg = metastore_federation.CreateFederationRequest( parent="parent_value", federation_id="federation_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_federation_use_cached_wrapped_rpc(): @@ -2453,10 +2470,14 @@ async def test_create_federation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_federation_async( - transport: str = "grpc_asyncio", - request_type=metastore_federation.CreateFederationRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + metastore_federation.CreateFederationRequest(), + {}, + ], +) +async def test_create_federation_async(request_type, transport: str = "grpc_asyncio"): client = DataprocMetastoreFederationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2464,7 +2485,7 @@ async def test_create_federation_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( @@ -2486,11 +2507,6 @@ async def test_create_federation_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_federation_async_from_dict(): - await test_create_federation_async(request_type=dict) - - def test_create_federation_field_headers(): client = DataprocMetastoreFederationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2665,8 +2681,8 @@ async def test_create_federation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metastore_federation.UpdateFederationRequest, - dict, + metastore_federation.UpdateFederationRequest(), + {}, ], ) def test_update_federation(request_type, transport: str = "grpc"): @@ -2677,7 +2693,7 @@ def test_update_federation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2722,9 +2738,10 @@ def test_update_federation_non_empty_request_with_auto_populated_field(): client.update_federation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore_federation.UpdateFederationRequest( + request_msg = metastore_federation.UpdateFederationRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_federation_use_cached_wrapped_rpc(): @@ -2817,10 +2834,14 @@ async def test_update_federation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_federation_async( - transport: str = "grpc_asyncio", - request_type=metastore_federation.UpdateFederationRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + metastore_federation.UpdateFederationRequest(), + {}, + ], +) +async def test_update_federation_async(request_type, transport: str = "grpc_asyncio"): client = DataprocMetastoreFederationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2828,7 +2849,7 @@ async def test_update_federation_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( @@ -2850,11 +2871,6 @@ async def test_update_federation_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_federation_async_from_dict(): - await test_update_federation_async(request_type=dict) - - def test_update_federation_field_headers(): client = DataprocMetastoreFederationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3019,8 +3035,8 @@ async def test_update_federation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metastore_federation.DeleteFederationRequest, - dict, + metastore_federation.DeleteFederationRequest(), + {}, ], ) def test_delete_federation(request_type, transport: str = "grpc"): @@ -3031,7 +3047,7 @@ def test_delete_federation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3077,10 +3093,11 @@ def test_delete_federation_non_empty_request_with_auto_populated_field(): client.delete_federation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore_federation.DeleteFederationRequest( + request_msg = metastore_federation.DeleteFederationRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_federation_use_cached_wrapped_rpc(): @@ -3173,10 +3190,14 @@ async def test_delete_federation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_federation_async( - transport: str = "grpc_asyncio", - request_type=metastore_federation.DeleteFederationRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + metastore_federation.DeleteFederationRequest(), + {}, + ], +) +async def test_delete_federation_async(request_type, transport: str = "grpc_asyncio"): client = DataprocMetastoreFederationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3184,7 +3205,7 @@ async def test_delete_federation_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( @@ -3206,11 +3227,6 @@ async def test_delete_federation_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_federation_async_from_dict(): - await test_delete_federation_async(request_type=dict) - - def test_delete_federation_field_headers(): client = DataprocMetastoreFederationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4529,7 +4545,6 @@ def test_list_federations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore_federation.ListFederationsRequest() - assert args[0] == request_msg @@ -4550,7 +4565,6 @@ def test_get_federation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore_federation.GetFederationRequest() - assert args[0] == request_msg @@ -4573,7 +4587,6 @@ def test_create_federation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore_federation.CreateFederationRequest() - assert args[0] == request_msg @@ -4596,7 +4609,6 @@ def test_update_federation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore_federation.UpdateFederationRequest() - assert args[0] == request_msg @@ -4619,7 +4631,6 @@ def test_delete_federation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore_federation.DeleteFederationRequest() - assert args[0] == request_msg @@ -4661,7 +4672,6 @@ async def test_list_federations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore_federation.ListFederationsRequest() - assert args[0] == request_msg @@ -4693,7 +4703,6 @@ async def test_get_federation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore_federation.GetFederationRequest() - assert args[0] == request_msg @@ -4720,7 +4729,6 @@ async def test_create_federation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore_federation.CreateFederationRequest() - assert args[0] == request_msg @@ -4747,7 +4755,6 @@ async def test_update_federation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore_federation.UpdateFederationRequest() - assert args[0] == request_msg @@ -4774,7 +4781,6 @@ async def test_delete_federation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore_federation.DeleteFederationRequest() - assert args[0] == request_msg @@ -6200,7 +6206,6 @@ def test_list_federations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore_federation.ListFederationsRequest() - assert args[0] == request_msg @@ -6220,7 +6225,6 @@ def test_get_federation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore_federation.GetFederationRequest() - assert args[0] == request_msg @@ -6242,7 +6246,6 @@ def test_create_federation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore_federation.CreateFederationRequest() - assert args[0] == request_msg @@ -6264,7 +6267,6 @@ def test_update_federation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore_federation.UpdateFederationRequest() - assert args[0] == request_msg @@ -6286,7 +6288,6 @@ def test_delete_federation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore_federation.DeleteFederationRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dataproc-metastore/tests/unit/gapic/metastore_v1alpha/test_dataproc_metastore.py b/packages/google-cloud-dataproc-metastore/tests/unit/gapic/metastore_v1alpha/test_dataproc_metastore.py index 28d5727169e1..1dedf9343282 100644 --- a/packages/google-cloud-dataproc-metastore/tests/unit/gapic/metastore_v1alpha/test_dataproc_metastore.py +++ b/packages/google-cloud-dataproc-metastore/tests/unit/gapic/metastore_v1alpha/test_dataproc_metastore.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 @@ -123,6 +124,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" @@ -1364,8 +1380,8 @@ def test_dataproc_metastore_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - metastore.ListServicesRequest, - dict, + metastore.ListServicesRequest(), + {}, ], ) def test_list_services(request_type, transport: str = "grpc"): @@ -1376,7 +1392,7 @@ def test_list_services(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_services), "__call__") as call: @@ -1425,12 +1441,13 @@ def test_list_services_non_empty_request_with_auto_populated_field(): client.list_services(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.ListServicesRequest( + request_msg = metastore.ListServicesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_services_use_cached_wrapped_rpc(): @@ -1511,9 +1528,14 @@ async def test_list_services_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_services_async( - transport: str = "grpc_asyncio", request_type=metastore.ListServicesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.ListServicesRequest(), + {}, + ], +) +async def test_list_services_async(request_type, transport: str = "grpc_asyncio"): client = DataprocMetastoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1521,7 +1543,7 @@ async def test_list_services_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_services), "__call__") as call: @@ -1546,11 +1568,6 @@ async def test_list_services_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_services_async_from_dict(): - await test_list_services_async(request_type=dict) - - def test_list_services_field_headers(): client = DataprocMetastoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1887,8 +1904,8 @@ async def test_list_services_async_pages(): @pytest.mark.parametrize( "request_type", [ - metastore.GetServiceRequest, - dict, + metastore.GetServiceRequest(), + {}, ], ) def test_get_service(request_type, transport: str = "grpc"): @@ -1899,7 +1916,7 @@ def test_get_service(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_service), "__call__") as call: @@ -1963,9 +1980,10 @@ def test_get_service_non_empty_request_with_auto_populated_field(): client.get_service(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.GetServiceRequest( + request_msg = metastore.GetServiceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_service_use_cached_wrapped_rpc(): @@ -2046,9 +2064,14 @@ async def test_get_service_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_service_async( - transport: str = "grpc_asyncio", request_type=metastore.GetServiceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.GetServiceRequest(), + {}, + ], +) +async def test_get_service_async(request_type, transport: str = "grpc_asyncio"): client = DataprocMetastoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2056,7 +2079,7 @@ async def test_get_service_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_service), "__call__") as call: @@ -2099,11 +2122,6 @@ async def test_get_service_async( assert response.database_type == metastore.Service.DatabaseType.MYSQL -@pytest.mark.asyncio -async def test_get_service_async_from_dict(): - await test_get_service_async(request_type=dict) - - def test_get_service_field_headers(): client = DataprocMetastoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2246,8 +2264,8 @@ async def test_get_service_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metastore.CreateServiceRequest, - dict, + metastore.CreateServiceRequest(), + {}, ], ) def test_create_service(request_type, transport: str = "grpc"): @@ -2258,7 +2276,7 @@ def test_create_service(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_service), "__call__") as call: @@ -2301,11 +2319,12 @@ def test_create_service_non_empty_request_with_auto_populated_field(): client.create_service(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.CreateServiceRequest( + request_msg = metastore.CreateServiceRequest( parent="parent_value", service_id="service_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_service_use_cached_wrapped_rpc(): @@ -2396,9 +2415,14 @@ async def test_create_service_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_service_async( - transport: str = "grpc_asyncio", request_type=metastore.CreateServiceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.CreateServiceRequest(), + {}, + ], +) +async def test_create_service_async(request_type, transport: str = "grpc_asyncio"): client = DataprocMetastoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2406,7 +2430,7 @@ async def test_create_service_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_service), "__call__") as call: @@ -2426,11 +2450,6 @@ async def test_create_service_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_service_async_from_dict(): - await test_create_service_async(request_type=dict) - - def test_create_service_field_headers(): client = DataprocMetastoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2617,8 +2636,8 @@ async def test_create_service_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metastore.UpdateServiceRequest, - dict, + metastore.UpdateServiceRequest(), + {}, ], ) def test_update_service(request_type, transport: str = "grpc"): @@ -2629,7 +2648,7 @@ def test_update_service(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_service), "__call__") as call: @@ -2670,9 +2689,10 @@ def test_update_service_non_empty_request_with_auto_populated_field(): client.update_service(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.UpdateServiceRequest( + request_msg = metastore.UpdateServiceRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_service_use_cached_wrapped_rpc(): @@ -2763,9 +2783,14 @@ async def test_update_service_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_service_async( - transport: str = "grpc_asyncio", request_type=metastore.UpdateServiceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.UpdateServiceRequest(), + {}, + ], +) +async def test_update_service_async(request_type, transport: str = "grpc_asyncio"): client = DataprocMetastoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2773,7 +2798,7 @@ async def test_update_service_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_service), "__call__") as call: @@ -2793,11 +2818,6 @@ async def test_update_service_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_service_async_from_dict(): - await test_update_service_async(request_type=dict) - - def test_update_service_field_headers(): client = DataprocMetastoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2974,8 +2994,8 @@ async def test_update_service_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metastore.DeleteServiceRequest, - dict, + metastore.DeleteServiceRequest(), + {}, ], ) def test_delete_service(request_type, transport: str = "grpc"): @@ -2986,7 +3006,7 @@ def test_delete_service(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_service), "__call__") as call: @@ -3028,10 +3048,11 @@ def test_delete_service_non_empty_request_with_auto_populated_field(): client.delete_service(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.DeleteServiceRequest( + request_msg = metastore.DeleteServiceRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_service_use_cached_wrapped_rpc(): @@ -3122,9 +3143,14 @@ async def test_delete_service_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_service_async( - transport: str = "grpc_asyncio", request_type=metastore.DeleteServiceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.DeleteServiceRequest(), + {}, + ], +) +async def test_delete_service_async(request_type, transport: str = "grpc_asyncio"): client = DataprocMetastoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3132,7 +3158,7 @@ async def test_delete_service_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_service), "__call__") as call: @@ -3152,11 +3178,6 @@ async def test_delete_service_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_service_async_from_dict(): - await test_delete_service_async(request_type=dict) - - def test_delete_service_field_headers(): client = DataprocMetastoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3303,8 +3324,8 @@ async def test_delete_service_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metastore.ListMetadataImportsRequest, - dict, + metastore.ListMetadataImportsRequest(), + {}, ], ) def test_list_metadata_imports(request_type, transport: str = "grpc"): @@ -3315,7 +3336,7 @@ def test_list_metadata_imports(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3368,12 +3389,13 @@ def test_list_metadata_imports_non_empty_request_with_auto_populated_field(): client.list_metadata_imports(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.ListMetadataImportsRequest( + request_msg = metastore.ListMetadataImportsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_metadata_imports_use_cached_wrapped_rpc(): @@ -3459,8 +3481,15 @@ async def test_list_metadata_imports_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + metastore.ListMetadataImportsRequest(), + {}, + ], +) async def test_list_metadata_imports_async( - transport: str = "grpc_asyncio", request_type=metastore.ListMetadataImportsRequest + request_type, transport: str = "grpc_asyncio" ): client = DataprocMetastoreAsyncClient( credentials=async_anonymous_credentials(), @@ -3469,7 +3498,7 @@ async def test_list_metadata_imports_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( @@ -3496,11 +3525,6 @@ async def test_list_metadata_imports_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_metadata_imports_async_from_dict(): - await test_list_metadata_imports_async(request_type=dict) - - def test_list_metadata_imports_field_headers(): client = DataprocMetastoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3853,8 +3877,8 @@ async def test_list_metadata_imports_async_pages(): @pytest.mark.parametrize( "request_type", [ - metastore.GetMetadataImportRequest, - dict, + metastore.GetMetadataImportRequest(), + {}, ], ) def test_get_metadata_import(request_type, transport: str = "grpc"): @@ -3865,7 +3889,7 @@ def test_get_metadata_import(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3917,9 +3941,10 @@ def test_get_metadata_import_non_empty_request_with_auto_populated_field(): client.get_metadata_import(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.GetMetadataImportRequest( + request_msg = metastore.GetMetadataImportRequest( name="name_value", ) + assert args[0] == request_msg def test_get_metadata_import_use_cached_wrapped_rpc(): @@ -4004,9 +4029,14 @@ async def test_get_metadata_import_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_metadata_import_async( - transport: str = "grpc_asyncio", request_type=metastore.GetMetadataImportRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.GetMetadataImportRequest(), + {}, + ], +) +async def test_get_metadata_import_async(request_type, transport: str = "grpc_asyncio"): client = DataprocMetastoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4014,7 +4044,7 @@ async def test_get_metadata_import_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( @@ -4043,11 +4073,6 @@ async def test_get_metadata_import_async( assert response.state == metastore.MetadataImport.State.RUNNING -@pytest.mark.asyncio -async def test_get_metadata_import_async_from_dict(): - await test_get_metadata_import_async(request_type=dict) - - def test_get_metadata_import_field_headers(): client = DataprocMetastoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4202,8 +4227,8 @@ async def test_get_metadata_import_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metastore.CreateMetadataImportRequest, - dict, + metastore.CreateMetadataImportRequest(), + {}, ], ) def test_create_metadata_import(request_type, transport: str = "grpc"): @@ -4214,7 +4239,7 @@ def test_create_metadata_import(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4261,11 +4286,12 @@ def test_create_metadata_import_non_empty_request_with_auto_populated_field(): client.create_metadata_import(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.CreateMetadataImportRequest( + request_msg = metastore.CreateMetadataImportRequest( parent="parent_value", metadata_import_id="metadata_import_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_metadata_import_use_cached_wrapped_rpc(): @@ -4361,8 +4387,15 @@ async def test_create_metadata_import_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + metastore.CreateMetadataImportRequest(), + {}, + ], +) async def test_create_metadata_import_async( - transport: str = "grpc_asyncio", request_type=metastore.CreateMetadataImportRequest + request_type, transport: str = "grpc_asyncio" ): client = DataprocMetastoreAsyncClient( credentials=async_anonymous_credentials(), @@ -4371,7 +4404,7 @@ async def test_create_metadata_import_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( @@ -4393,11 +4426,6 @@ async def test_create_metadata_import_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_metadata_import_async_from_dict(): - await test_create_metadata_import_async(request_type=dict) - - def test_create_metadata_import_field_headers(): client = DataprocMetastoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4596,8 +4624,8 @@ async def test_create_metadata_import_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metastore.UpdateMetadataImportRequest, - dict, + metastore.UpdateMetadataImportRequest(), + {}, ], ) def test_update_metadata_import(request_type, transport: str = "grpc"): @@ -4608,7 +4636,7 @@ def test_update_metadata_import(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4653,9 +4681,10 @@ def test_update_metadata_import_non_empty_request_with_auto_populated_field(): client.update_metadata_import(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.UpdateMetadataImportRequest( + request_msg = metastore.UpdateMetadataImportRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_metadata_import_use_cached_wrapped_rpc(): @@ -4751,8 +4780,15 @@ async def test_update_metadata_import_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + metastore.UpdateMetadataImportRequest(), + {}, + ], +) async def test_update_metadata_import_async( - transport: str = "grpc_asyncio", request_type=metastore.UpdateMetadataImportRequest + request_type, transport: str = "grpc_asyncio" ): client = DataprocMetastoreAsyncClient( credentials=async_anonymous_credentials(), @@ -4761,7 +4797,7 @@ async def test_update_metadata_import_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( @@ -4783,11 +4819,6 @@ async def test_update_metadata_import_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_metadata_import_async_from_dict(): - await test_update_metadata_import_async(request_type=dict) - - def test_update_metadata_import_field_headers(): client = DataprocMetastoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4976,8 +5007,8 @@ async def test_update_metadata_import_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metastore.ExportMetadataRequest, - dict, + metastore.ExportMetadataRequest(), + {}, ], ) def test_export_metadata(request_type, transport: str = "grpc"): @@ -4988,7 +5019,7 @@ def test_export_metadata(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.export_metadata), "__call__") as call: @@ -5031,11 +5062,12 @@ def test_export_metadata_non_empty_request_with_auto_populated_field(): client.export_metadata(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.ExportMetadataRequest( + request_msg = metastore.ExportMetadataRequest( destination_gcs_folder="destination_gcs_folder_value", service="service_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_export_metadata_use_cached_wrapped_rpc(): @@ -5126,9 +5158,14 @@ async def test_export_metadata_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_export_metadata_async( - transport: str = "grpc_asyncio", request_type=metastore.ExportMetadataRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.ExportMetadataRequest(), + {}, + ], +) +async def test_export_metadata_async(request_type, transport: str = "grpc_asyncio"): client = DataprocMetastoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5136,7 +5173,7 @@ async def test_export_metadata_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.export_metadata), "__call__") as call: @@ -5156,11 +5193,6 @@ async def test_export_metadata_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_export_metadata_async_from_dict(): - await test_export_metadata_async(request_type=dict) - - def test_export_metadata_field_headers(): client = DataprocMetastoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5225,8 +5257,8 @@ async def test_export_metadata_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - metastore.RestoreServiceRequest, - dict, + metastore.RestoreServiceRequest(), + {}, ], ) def test_restore_service(request_type, transport: str = "grpc"): @@ -5237,7 +5269,7 @@ def test_restore_service(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.restore_service), "__call__") as call: @@ -5280,11 +5312,12 @@ def test_restore_service_non_empty_request_with_auto_populated_field(): client.restore_service(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.RestoreServiceRequest( + request_msg = metastore.RestoreServiceRequest( service="service_value", backup="backup_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_restore_service_use_cached_wrapped_rpc(): @@ -5375,9 +5408,14 @@ async def test_restore_service_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_restore_service_async( - transport: str = "grpc_asyncio", request_type=metastore.RestoreServiceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.RestoreServiceRequest(), + {}, + ], +) +async def test_restore_service_async(request_type, transport: str = "grpc_asyncio"): client = DataprocMetastoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5385,7 +5423,7 @@ async def test_restore_service_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.restore_service), "__call__") as call: @@ -5405,11 +5443,6 @@ async def test_restore_service_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_restore_service_async_from_dict(): - await test_restore_service_async(request_type=dict) - - def test_restore_service_field_headers(): client = DataprocMetastoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5566,8 +5599,8 @@ async def test_restore_service_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metastore.ListBackupsRequest, - dict, + metastore.ListBackupsRequest(), + {}, ], ) def test_list_backups(request_type, transport: str = "grpc"): @@ -5578,7 +5611,7 @@ def test_list_backups(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_backups), "__call__") as call: @@ -5627,12 +5660,13 @@ def test_list_backups_non_empty_request_with_auto_populated_field(): client.list_backups(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.ListBackupsRequest( + request_msg = metastore.ListBackupsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_backups_use_cached_wrapped_rpc(): @@ -5713,9 +5747,14 @@ async def test_list_backups_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_backups_async( - transport: str = "grpc_asyncio", request_type=metastore.ListBackupsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.ListBackupsRequest(), + {}, + ], +) +async def test_list_backups_async(request_type, transport: str = "grpc_asyncio"): client = DataprocMetastoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5723,7 +5762,7 @@ async def test_list_backups_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_backups), "__call__") as call: @@ -5748,11 +5787,6 @@ async def test_list_backups_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_backups_async_from_dict(): - await test_list_backups_async(request_type=dict) - - def test_list_backups_field_headers(): client = DataprocMetastoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6089,8 +6123,8 @@ async def test_list_backups_async_pages(): @pytest.mark.parametrize( "request_type", [ - metastore.GetBackupRequest, - dict, + metastore.GetBackupRequest(), + {}, ], ) def test_get_backup(request_type, transport: str = "grpc"): @@ -6101,7 +6135,7 @@ def test_get_backup(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_backup), "__call__") as call: @@ -6151,9 +6185,10 @@ def test_get_backup_non_empty_request_with_auto_populated_field(): client.get_backup(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.GetBackupRequest( + request_msg = metastore.GetBackupRequest( name="name_value", ) + assert args[0] == request_msg def test_get_backup_use_cached_wrapped_rpc(): @@ -6232,9 +6267,14 @@ async def test_get_backup_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_backup_async( - transport: str = "grpc_asyncio", request_type=metastore.GetBackupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.GetBackupRequest(), + {}, + ], +) +async def test_get_backup_async(request_type, transport: str = "grpc_asyncio"): client = DataprocMetastoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6242,7 +6282,7 @@ async def test_get_backup_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_backup), "__call__") as call: @@ -6271,11 +6311,6 @@ async def test_get_backup_async( assert response.restoring_services == ["restoring_services_value"] -@pytest.mark.asyncio -async def test_get_backup_async_from_dict(): - await test_get_backup_async(request_type=dict) - - def test_get_backup_field_headers(): client = DataprocMetastoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6418,8 +6453,8 @@ async def test_get_backup_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metastore.CreateBackupRequest, - dict, + metastore.CreateBackupRequest(), + {}, ], ) def test_create_backup(request_type, transport: str = "grpc"): @@ -6430,7 +6465,7 @@ def test_create_backup(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_backup), "__call__") as call: @@ -6473,11 +6508,12 @@ def test_create_backup_non_empty_request_with_auto_populated_field(): client.create_backup(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.CreateBackupRequest( + request_msg = metastore.CreateBackupRequest( parent="parent_value", backup_id="backup_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_backup_use_cached_wrapped_rpc(): @@ -6568,9 +6604,14 @@ async def test_create_backup_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_backup_async( - transport: str = "grpc_asyncio", request_type=metastore.CreateBackupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.CreateBackupRequest(), + {}, + ], +) +async def test_create_backup_async(request_type, transport: str = "grpc_asyncio"): client = DataprocMetastoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6578,7 +6619,7 @@ async def test_create_backup_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_backup), "__call__") as call: @@ -6598,11 +6639,6 @@ async def test_create_backup_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_backup_async_from_dict(): - await test_create_backup_async(request_type=dict) - - def test_create_backup_field_headers(): client = DataprocMetastoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6769,8 +6805,8 @@ async def test_create_backup_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metastore.DeleteBackupRequest, - dict, + metastore.DeleteBackupRequest(), + {}, ], ) def test_delete_backup(request_type, transport: str = "grpc"): @@ -6781,7 +6817,7 @@ def test_delete_backup(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_backup), "__call__") as call: @@ -6823,10 +6859,11 @@ def test_delete_backup_non_empty_request_with_auto_populated_field(): client.delete_backup(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.DeleteBackupRequest( + request_msg = metastore.DeleteBackupRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_backup_use_cached_wrapped_rpc(): @@ -6917,9 +6954,14 @@ async def test_delete_backup_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_backup_async( - transport: str = "grpc_asyncio", request_type=metastore.DeleteBackupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.DeleteBackupRequest(), + {}, + ], +) +async def test_delete_backup_async(request_type, transport: str = "grpc_asyncio"): client = DataprocMetastoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6927,7 +6969,7 @@ async def test_delete_backup_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_backup), "__call__") as call: @@ -6947,11 +6989,6 @@ async def test_delete_backup_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_backup_async_from_dict(): - await test_delete_backup_async(request_type=dict) - - def test_delete_backup_field_headers(): client = DataprocMetastoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7098,8 +7135,8 @@ async def test_delete_backup_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metastore.RemoveIamPolicyRequest, - dict, + metastore.RemoveIamPolicyRequest(), + {}, ], ) def test_remove_iam_policy(request_type, transport: str = "grpc"): @@ -7110,7 +7147,7 @@ def test_remove_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( @@ -7158,9 +7195,10 @@ def test_remove_iam_policy_non_empty_request_with_auto_populated_field(): client.remove_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.RemoveIamPolicyRequest( + request_msg = metastore.RemoveIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_remove_iam_policy_use_cached_wrapped_rpc(): @@ -7243,9 +7281,14 @@ async def test_remove_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_remove_iam_policy_async( - transport: str = "grpc_asyncio", request_type=metastore.RemoveIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.RemoveIamPolicyRequest(), + {}, + ], +) +async def test_remove_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = DataprocMetastoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7253,7 +7296,7 @@ async def test_remove_iam_policy_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( @@ -7278,11 +7321,6 @@ async def test_remove_iam_policy_async( assert response.success is True -@pytest.mark.asyncio -async def test_remove_iam_policy_async_from_dict(): - await test_remove_iam_policy_async(request_type=dict) - - def test_remove_iam_policy_field_headers(): client = DataprocMetastoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7351,8 +7389,8 @@ async def test_remove_iam_policy_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - metastore.QueryMetadataRequest, - dict, + metastore.QueryMetadataRequest(), + {}, ], ) def test_query_metadata(request_type, transport: str = "grpc"): @@ -7363,7 +7401,7 @@ def test_query_metadata(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.query_metadata), "__call__") as call: @@ -7405,10 +7443,11 @@ def test_query_metadata_non_empty_request_with_auto_populated_field(): client.query_metadata(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.QueryMetadataRequest( + request_msg = metastore.QueryMetadataRequest( service="service_value", query="query_value", ) + assert args[0] == request_msg def test_query_metadata_use_cached_wrapped_rpc(): @@ -7499,9 +7538,14 @@ async def test_query_metadata_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_query_metadata_async( - transport: str = "grpc_asyncio", request_type=metastore.QueryMetadataRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.QueryMetadataRequest(), + {}, + ], +) +async def test_query_metadata_async(request_type, transport: str = "grpc_asyncio"): client = DataprocMetastoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7509,7 +7553,7 @@ async def test_query_metadata_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.query_metadata), "__call__") as call: @@ -7529,11 +7573,6 @@ async def test_query_metadata_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_query_metadata_async_from_dict(): - await test_query_metadata_async(request_type=dict) - - def test_query_metadata_field_headers(): client = DataprocMetastoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7598,8 +7637,8 @@ async def test_query_metadata_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - metastore.MoveTableToDatabaseRequest, - dict, + metastore.MoveTableToDatabaseRequest(), + {}, ], ) def test_move_table_to_database(request_type, transport: str = "grpc"): @@ -7610,7 +7649,7 @@ def test_move_table_to_database(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7658,12 +7697,13 @@ def test_move_table_to_database_non_empty_request_with_auto_populated_field(): client.move_table_to_database(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.MoveTableToDatabaseRequest( + request_msg = metastore.MoveTableToDatabaseRequest( service="service_value", table_name="table_name_value", db_name="db_name_value", destination_db_name="destination_db_name_value", ) + assert args[0] == request_msg def test_move_table_to_database_use_cached_wrapped_rpc(): @@ -7759,8 +7799,15 @@ async def test_move_table_to_database_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + metastore.MoveTableToDatabaseRequest(), + {}, + ], +) async def test_move_table_to_database_async( - transport: str = "grpc_asyncio", request_type=metastore.MoveTableToDatabaseRequest + request_type, transport: str = "grpc_asyncio" ): client = DataprocMetastoreAsyncClient( credentials=async_anonymous_credentials(), @@ -7769,7 +7816,7 @@ async def test_move_table_to_database_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( @@ -7791,11 +7838,6 @@ async def test_move_table_to_database_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_move_table_to_database_async_from_dict(): - await test_move_table_to_database_async(request_type=dict) - - def test_move_table_to_database_field_headers(): client = DataprocMetastoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7864,8 +7906,8 @@ async def test_move_table_to_database_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - metastore.AlterMetadataResourceLocationRequest, - dict, + metastore.AlterMetadataResourceLocationRequest(), + {}, ], ) def test_alter_metadata_resource_location(request_type, transport: str = "grpc"): @@ -7876,7 +7918,7 @@ def test_alter_metadata_resource_location(request_type, transport: str = "grpc") # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7923,11 +7965,12 @@ def test_alter_metadata_resource_location_non_empty_request_with_auto_populated_ client.alter_metadata_resource_location(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.AlterMetadataResourceLocationRequest( + request_msg = metastore.AlterMetadataResourceLocationRequest( service="service_value", resource_name="resource_name_value", location_uri="location_uri_value", ) + assert args[0] == request_msg def test_alter_metadata_resource_location_use_cached_wrapped_rpc(): @@ -8023,9 +8066,15 @@ async def test_alter_metadata_resource_location_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + metastore.AlterMetadataResourceLocationRequest(), + {}, + ], +) async def test_alter_metadata_resource_location_async( - transport: str = "grpc_asyncio", - request_type=metastore.AlterMetadataResourceLocationRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataprocMetastoreAsyncClient( credentials=async_anonymous_credentials(), @@ -8034,7 +8083,7 @@ async def test_alter_metadata_resource_location_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( @@ -8056,11 +8105,6 @@ async def test_alter_metadata_resource_location_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_alter_metadata_resource_location_async_from_dict(): - await test_alter_metadata_resource_location_async(request_type=dict) - - def test_alter_metadata_resource_location_field_headers(): client = DataprocMetastoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11886,7 +11930,6 @@ def test_list_services_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.ListServicesRequest() - assert args[0] == request_msg @@ -11907,7 +11950,6 @@ def test_get_service_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.GetServiceRequest() - assert args[0] == request_msg @@ -11928,7 +11970,6 @@ def test_create_service_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.CreateServiceRequest() - assert args[0] == request_msg @@ -11949,7 +11990,6 @@ def test_update_service_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.UpdateServiceRequest() - assert args[0] == request_msg @@ -11970,7 +12010,6 @@ def test_delete_service_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.DeleteServiceRequest() - assert args[0] == request_msg @@ -11993,7 +12032,6 @@ def test_list_metadata_imports_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.ListMetadataImportsRequest() - assert args[0] == request_msg @@ -12016,7 +12054,6 @@ def test_get_metadata_import_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.GetMetadataImportRequest() - assert args[0] == request_msg @@ -12039,7 +12076,6 @@ def test_create_metadata_import_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.CreateMetadataImportRequest() - assert args[0] == request_msg @@ -12062,7 +12098,6 @@ def test_update_metadata_import_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.UpdateMetadataImportRequest() - assert args[0] == request_msg @@ -12083,7 +12118,6 @@ def test_export_metadata_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.ExportMetadataRequest() - assert args[0] == request_msg @@ -12104,7 +12138,6 @@ def test_restore_service_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.RestoreServiceRequest() - assert args[0] == request_msg @@ -12125,7 +12158,6 @@ def test_list_backups_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.ListBackupsRequest() - assert args[0] == request_msg @@ -12146,7 +12178,6 @@ def test_get_backup_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.GetBackupRequest() - assert args[0] == request_msg @@ -12167,7 +12198,6 @@ def test_create_backup_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.CreateBackupRequest() - assert args[0] == request_msg @@ -12188,7 +12218,6 @@ def test_delete_backup_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.DeleteBackupRequest() - assert args[0] == request_msg @@ -12211,7 +12240,6 @@ def test_remove_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.RemoveIamPolicyRequest() - assert args[0] == request_msg @@ -12232,7 +12260,6 @@ def test_query_metadata_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.QueryMetadataRequest() - assert args[0] == request_msg @@ -12255,7 +12282,6 @@ def test_move_table_to_database_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.MoveTableToDatabaseRequest() - assert args[0] == request_msg @@ -12278,7 +12304,6 @@ def test_alter_metadata_resource_location_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.AlterMetadataResourceLocationRequest() - assert args[0] == request_msg @@ -12320,7 +12345,6 @@ async def test_list_services_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.ListServicesRequest() - assert args[0] == request_msg @@ -12357,7 +12381,6 @@ async def test_get_service_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.GetServiceRequest() - assert args[0] == request_msg @@ -12382,7 +12405,6 @@ async def test_create_service_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.CreateServiceRequest() - assert args[0] == request_msg @@ -12407,7 +12429,6 @@ async def test_update_service_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.UpdateServiceRequest() - assert args[0] == request_msg @@ -12432,7 +12453,6 @@ async def test_delete_service_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.DeleteServiceRequest() - assert args[0] == request_msg @@ -12462,7 +12482,6 @@ async def test_list_metadata_imports_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.ListMetadataImportsRequest() - assert args[0] == request_msg @@ -12493,7 +12512,6 @@ async def test_get_metadata_import_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.GetMetadataImportRequest() - assert args[0] == request_msg @@ -12520,7 +12538,6 @@ async def test_create_metadata_import_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.CreateMetadataImportRequest() - assert args[0] == request_msg @@ -12547,7 +12564,6 @@ async def test_update_metadata_import_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.UpdateMetadataImportRequest() - assert args[0] == request_msg @@ -12572,7 +12588,6 @@ async def test_export_metadata_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.ExportMetadataRequest() - assert args[0] == request_msg @@ -12597,7 +12612,6 @@ async def test_restore_service_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.RestoreServiceRequest() - assert args[0] == request_msg @@ -12625,7 +12639,6 @@ async def test_list_backups_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.ListBackupsRequest() - assert args[0] == request_msg @@ -12655,7 +12668,6 @@ async def test_get_backup_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.GetBackupRequest() - assert args[0] == request_msg @@ -12680,7 +12692,6 @@ async def test_create_backup_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.CreateBackupRequest() - assert args[0] == request_msg @@ -12705,7 +12716,6 @@ async def test_delete_backup_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.DeleteBackupRequest() - assert args[0] == request_msg @@ -12734,7 +12744,6 @@ async def test_remove_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.RemoveIamPolicyRequest() - assert args[0] == request_msg @@ -12759,7 +12768,6 @@ async def test_query_metadata_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.QueryMetadataRequest() - assert args[0] == request_msg @@ -12786,7 +12794,6 @@ async def test_move_table_to_database_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.MoveTableToDatabaseRequest() - assert args[0] == request_msg @@ -12813,7 +12820,6 @@ async def test_alter_metadata_resource_location_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.AlterMetadataResourceLocationRequest() - assert args[0] == request_msg @@ -16443,7 +16449,6 @@ def test_list_services_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.ListServicesRequest() - assert args[0] == request_msg @@ -16463,7 +16468,6 @@ def test_get_service_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.GetServiceRequest() - assert args[0] == request_msg @@ -16483,7 +16487,6 @@ def test_create_service_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.CreateServiceRequest() - assert args[0] == request_msg @@ -16503,7 +16506,6 @@ def test_update_service_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.UpdateServiceRequest() - assert args[0] == request_msg @@ -16523,7 +16525,6 @@ def test_delete_service_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.DeleteServiceRequest() - assert args[0] == request_msg @@ -16545,7 +16546,6 @@ def test_list_metadata_imports_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.ListMetadataImportsRequest() - assert args[0] == request_msg @@ -16567,7 +16567,6 @@ def test_get_metadata_import_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.GetMetadataImportRequest() - assert args[0] == request_msg @@ -16589,7 +16588,6 @@ def test_create_metadata_import_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.CreateMetadataImportRequest() - assert args[0] == request_msg @@ -16611,7 +16609,6 @@ def test_update_metadata_import_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.UpdateMetadataImportRequest() - assert args[0] == request_msg @@ -16631,7 +16628,6 @@ def test_export_metadata_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.ExportMetadataRequest() - assert args[0] == request_msg @@ -16651,7 +16647,6 @@ def test_restore_service_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.RestoreServiceRequest() - assert args[0] == request_msg @@ -16671,7 +16666,6 @@ def test_list_backups_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.ListBackupsRequest() - assert args[0] == request_msg @@ -16691,7 +16685,6 @@ def test_get_backup_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.GetBackupRequest() - assert args[0] == request_msg @@ -16711,7 +16704,6 @@ def test_create_backup_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.CreateBackupRequest() - assert args[0] == request_msg @@ -16731,7 +16723,6 @@ def test_delete_backup_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.DeleteBackupRequest() - assert args[0] == request_msg @@ -16753,7 +16744,6 @@ def test_remove_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.RemoveIamPolicyRequest() - assert args[0] == request_msg @@ -16773,7 +16763,6 @@ def test_query_metadata_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.QueryMetadataRequest() - assert args[0] == request_msg @@ -16795,7 +16784,6 @@ def test_move_table_to_database_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.MoveTableToDatabaseRequest() - assert args[0] == request_msg @@ -16817,7 +16805,6 @@ def test_alter_metadata_resource_location_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.AlterMetadataResourceLocationRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dataproc-metastore/tests/unit/gapic/metastore_v1alpha/test_dataproc_metastore_federation.py b/packages/google-cloud-dataproc-metastore/tests/unit/gapic/metastore_v1alpha/test_dataproc_metastore_federation.py index a280a780e2fe..1d64ff7afe9b 100644 --- a/packages/google-cloud-dataproc-metastore/tests/unit/gapic/metastore_v1alpha/test_dataproc_metastore_federation.py +++ b/packages/google-cloud-dataproc-metastore/tests/unit/gapic/metastore_v1alpha/test_dataproc_metastore_federation.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 @@ -121,6 +122,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" @@ -1427,8 +1443,8 @@ def test_dataproc_metastore_federation_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - metastore_federation.ListFederationsRequest, - dict, + metastore_federation.ListFederationsRequest(), + {}, ], ) def test_list_federations(request_type, transport: str = "grpc"): @@ -1439,7 +1455,7 @@ def test_list_federations(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_federations), "__call__") as call: @@ -1488,12 +1504,13 @@ def test_list_federations_non_empty_request_with_auto_populated_field(): client.list_federations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore_federation.ListFederationsRequest( + request_msg = metastore_federation.ListFederationsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_federations_use_cached_wrapped_rpc(): @@ -1576,10 +1593,14 @@ async def test_list_federations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_federations_async( - transport: str = "grpc_asyncio", - request_type=metastore_federation.ListFederationsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + metastore_federation.ListFederationsRequest(), + {}, + ], +) +async def test_list_federations_async(request_type, transport: str = "grpc_asyncio"): client = DataprocMetastoreFederationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1587,7 +1608,7 @@ async def test_list_federations_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_federations), "__call__") as call: @@ -1612,11 +1633,6 @@ async def test_list_federations_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_federations_async_from_dict(): - await test_list_federations_async(request_type=dict) - - def test_list_federations_field_headers(): client = DataprocMetastoreFederationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1953,8 +1969,8 @@ async def test_list_federations_async_pages(): @pytest.mark.parametrize( "request_type", [ - metastore_federation.GetFederationRequest, - dict, + metastore_federation.GetFederationRequest(), + {}, ], ) def test_get_federation(request_type, transport: str = "grpc"): @@ -1965,7 +1981,7 @@ def test_get_federation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_federation), "__call__") as call: @@ -2019,9 +2035,10 @@ def test_get_federation_non_empty_request_with_auto_populated_field(): client.get_federation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore_federation.GetFederationRequest( + request_msg = metastore_federation.GetFederationRequest( name="name_value", ) + assert args[0] == request_msg def test_get_federation_use_cached_wrapped_rpc(): @@ -2102,10 +2119,14 @@ async def test_get_federation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_federation_async( - transport: str = "grpc_asyncio", - request_type=metastore_federation.GetFederationRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + metastore_federation.GetFederationRequest(), + {}, + ], +) +async def test_get_federation_async(request_type, transport: str = "grpc_asyncio"): client = DataprocMetastoreFederationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2113,7 +2134,7 @@ async def test_get_federation_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_federation), "__call__") as call: @@ -2146,11 +2167,6 @@ async def test_get_federation_async( assert response.uid == "uid_value" -@pytest.mark.asyncio -async def test_get_federation_async_from_dict(): - await test_get_federation_async(request_type=dict) - - def test_get_federation_field_headers(): client = DataprocMetastoreFederationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2297,8 +2313,8 @@ async def test_get_federation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metastore_federation.CreateFederationRequest, - dict, + metastore_federation.CreateFederationRequest(), + {}, ], ) def test_create_federation(request_type, transport: str = "grpc"): @@ -2309,7 +2325,7 @@ def test_create_federation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2356,11 +2372,12 @@ def test_create_federation_non_empty_request_with_auto_populated_field(): client.create_federation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore_federation.CreateFederationRequest( + request_msg = metastore_federation.CreateFederationRequest( parent="parent_value", federation_id="federation_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_federation_use_cached_wrapped_rpc(): @@ -2453,10 +2470,14 @@ async def test_create_federation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_federation_async( - transport: str = "grpc_asyncio", - request_type=metastore_federation.CreateFederationRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + metastore_federation.CreateFederationRequest(), + {}, + ], +) +async def test_create_federation_async(request_type, transport: str = "grpc_asyncio"): client = DataprocMetastoreFederationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2464,7 +2485,7 @@ async def test_create_federation_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( @@ -2486,11 +2507,6 @@ async def test_create_federation_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_federation_async_from_dict(): - await test_create_federation_async(request_type=dict) - - def test_create_federation_field_headers(): client = DataprocMetastoreFederationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2665,8 +2681,8 @@ async def test_create_federation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metastore_federation.UpdateFederationRequest, - dict, + metastore_federation.UpdateFederationRequest(), + {}, ], ) def test_update_federation(request_type, transport: str = "grpc"): @@ -2677,7 +2693,7 @@ def test_update_federation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2722,9 +2738,10 @@ def test_update_federation_non_empty_request_with_auto_populated_field(): client.update_federation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore_federation.UpdateFederationRequest( + request_msg = metastore_federation.UpdateFederationRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_federation_use_cached_wrapped_rpc(): @@ -2817,10 +2834,14 @@ async def test_update_federation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_federation_async( - transport: str = "grpc_asyncio", - request_type=metastore_federation.UpdateFederationRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + metastore_federation.UpdateFederationRequest(), + {}, + ], +) +async def test_update_federation_async(request_type, transport: str = "grpc_asyncio"): client = DataprocMetastoreFederationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2828,7 +2849,7 @@ async def test_update_federation_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( @@ -2850,11 +2871,6 @@ async def test_update_federation_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_federation_async_from_dict(): - await test_update_federation_async(request_type=dict) - - def test_update_federation_field_headers(): client = DataprocMetastoreFederationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3019,8 +3035,8 @@ async def test_update_federation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metastore_federation.DeleteFederationRequest, - dict, + metastore_federation.DeleteFederationRequest(), + {}, ], ) def test_delete_federation(request_type, transport: str = "grpc"): @@ -3031,7 +3047,7 @@ def test_delete_federation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3077,10 +3093,11 @@ def test_delete_federation_non_empty_request_with_auto_populated_field(): client.delete_federation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore_federation.DeleteFederationRequest( + request_msg = metastore_federation.DeleteFederationRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_federation_use_cached_wrapped_rpc(): @@ -3173,10 +3190,14 @@ async def test_delete_federation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_federation_async( - transport: str = "grpc_asyncio", - request_type=metastore_federation.DeleteFederationRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + metastore_federation.DeleteFederationRequest(), + {}, + ], +) +async def test_delete_federation_async(request_type, transport: str = "grpc_asyncio"): client = DataprocMetastoreFederationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3184,7 +3205,7 @@ async def test_delete_federation_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( @@ -3206,11 +3227,6 @@ async def test_delete_federation_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_federation_async_from_dict(): - await test_delete_federation_async(request_type=dict) - - def test_delete_federation_field_headers(): client = DataprocMetastoreFederationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4529,7 +4545,6 @@ def test_list_federations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore_federation.ListFederationsRequest() - assert args[0] == request_msg @@ -4550,7 +4565,6 @@ def test_get_federation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore_federation.GetFederationRequest() - assert args[0] == request_msg @@ -4573,7 +4587,6 @@ def test_create_federation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore_federation.CreateFederationRequest() - assert args[0] == request_msg @@ -4596,7 +4609,6 @@ def test_update_federation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore_federation.UpdateFederationRequest() - assert args[0] == request_msg @@ -4619,7 +4631,6 @@ def test_delete_federation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore_federation.DeleteFederationRequest() - assert args[0] == request_msg @@ -4661,7 +4672,6 @@ async def test_list_federations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore_federation.ListFederationsRequest() - assert args[0] == request_msg @@ -4693,7 +4703,6 @@ async def test_get_federation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore_federation.GetFederationRequest() - assert args[0] == request_msg @@ -4720,7 +4729,6 @@ async def test_create_federation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore_federation.CreateFederationRequest() - assert args[0] == request_msg @@ -4747,7 +4755,6 @@ async def test_update_federation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore_federation.UpdateFederationRequest() - assert args[0] == request_msg @@ -4774,7 +4781,6 @@ async def test_delete_federation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore_federation.DeleteFederationRequest() - assert args[0] == request_msg @@ -6200,7 +6206,6 @@ def test_list_federations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore_federation.ListFederationsRequest() - assert args[0] == request_msg @@ -6220,7 +6225,6 @@ def test_get_federation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore_federation.GetFederationRequest() - assert args[0] == request_msg @@ -6242,7 +6246,6 @@ def test_create_federation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore_federation.CreateFederationRequest() - assert args[0] == request_msg @@ -6264,7 +6267,6 @@ def test_update_federation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore_federation.UpdateFederationRequest() - assert args[0] == request_msg @@ -6286,7 +6288,6 @@ def test_delete_federation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore_federation.DeleteFederationRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dataproc-metastore/tests/unit/gapic/metastore_v1beta/test_dataproc_metastore.py b/packages/google-cloud-dataproc-metastore/tests/unit/gapic/metastore_v1beta/test_dataproc_metastore.py index d5b1a176efee..38785d3cbcb7 100644 --- a/packages/google-cloud-dataproc-metastore/tests/unit/gapic/metastore_v1beta/test_dataproc_metastore.py +++ b/packages/google-cloud-dataproc-metastore/tests/unit/gapic/metastore_v1beta/test_dataproc_metastore.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 @@ -123,6 +124,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" @@ -1364,8 +1380,8 @@ def test_dataproc_metastore_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - metastore.ListServicesRequest, - dict, + metastore.ListServicesRequest(), + {}, ], ) def test_list_services(request_type, transport: str = "grpc"): @@ -1376,7 +1392,7 @@ def test_list_services(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_services), "__call__") as call: @@ -1425,12 +1441,13 @@ def test_list_services_non_empty_request_with_auto_populated_field(): client.list_services(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.ListServicesRequest( + request_msg = metastore.ListServicesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_services_use_cached_wrapped_rpc(): @@ -1511,9 +1528,14 @@ async def test_list_services_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_services_async( - transport: str = "grpc_asyncio", request_type=metastore.ListServicesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.ListServicesRequest(), + {}, + ], +) +async def test_list_services_async(request_type, transport: str = "grpc_asyncio"): client = DataprocMetastoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1521,7 +1543,7 @@ async def test_list_services_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_services), "__call__") as call: @@ -1546,11 +1568,6 @@ async def test_list_services_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_services_async_from_dict(): - await test_list_services_async(request_type=dict) - - def test_list_services_field_headers(): client = DataprocMetastoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1887,8 +1904,8 @@ async def test_list_services_async_pages(): @pytest.mark.parametrize( "request_type", [ - metastore.GetServiceRequest, - dict, + metastore.GetServiceRequest(), + {}, ], ) def test_get_service(request_type, transport: str = "grpc"): @@ -1899,7 +1916,7 @@ def test_get_service(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_service), "__call__") as call: @@ -1963,9 +1980,10 @@ def test_get_service_non_empty_request_with_auto_populated_field(): client.get_service(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.GetServiceRequest( + request_msg = metastore.GetServiceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_service_use_cached_wrapped_rpc(): @@ -2046,9 +2064,14 @@ async def test_get_service_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_service_async( - transport: str = "grpc_asyncio", request_type=metastore.GetServiceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.GetServiceRequest(), + {}, + ], +) +async def test_get_service_async(request_type, transport: str = "grpc_asyncio"): client = DataprocMetastoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2056,7 +2079,7 @@ async def test_get_service_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_service), "__call__") as call: @@ -2099,11 +2122,6 @@ async def test_get_service_async( assert response.database_type == metastore.Service.DatabaseType.MYSQL -@pytest.mark.asyncio -async def test_get_service_async_from_dict(): - await test_get_service_async(request_type=dict) - - def test_get_service_field_headers(): client = DataprocMetastoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2246,8 +2264,8 @@ async def test_get_service_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metastore.CreateServiceRequest, - dict, + metastore.CreateServiceRequest(), + {}, ], ) def test_create_service(request_type, transport: str = "grpc"): @@ -2258,7 +2276,7 @@ def test_create_service(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_service), "__call__") as call: @@ -2301,11 +2319,12 @@ def test_create_service_non_empty_request_with_auto_populated_field(): client.create_service(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.CreateServiceRequest( + request_msg = metastore.CreateServiceRequest( parent="parent_value", service_id="service_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_service_use_cached_wrapped_rpc(): @@ -2396,9 +2415,14 @@ async def test_create_service_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_service_async( - transport: str = "grpc_asyncio", request_type=metastore.CreateServiceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.CreateServiceRequest(), + {}, + ], +) +async def test_create_service_async(request_type, transport: str = "grpc_asyncio"): client = DataprocMetastoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2406,7 +2430,7 @@ async def test_create_service_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_service), "__call__") as call: @@ -2426,11 +2450,6 @@ async def test_create_service_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_service_async_from_dict(): - await test_create_service_async(request_type=dict) - - def test_create_service_field_headers(): client = DataprocMetastoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2617,8 +2636,8 @@ async def test_create_service_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metastore.UpdateServiceRequest, - dict, + metastore.UpdateServiceRequest(), + {}, ], ) def test_update_service(request_type, transport: str = "grpc"): @@ -2629,7 +2648,7 @@ def test_update_service(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_service), "__call__") as call: @@ -2670,9 +2689,10 @@ def test_update_service_non_empty_request_with_auto_populated_field(): client.update_service(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.UpdateServiceRequest( + request_msg = metastore.UpdateServiceRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_service_use_cached_wrapped_rpc(): @@ -2763,9 +2783,14 @@ async def test_update_service_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_service_async( - transport: str = "grpc_asyncio", request_type=metastore.UpdateServiceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.UpdateServiceRequest(), + {}, + ], +) +async def test_update_service_async(request_type, transport: str = "grpc_asyncio"): client = DataprocMetastoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2773,7 +2798,7 @@ async def test_update_service_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_service), "__call__") as call: @@ -2793,11 +2818,6 @@ async def test_update_service_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_service_async_from_dict(): - await test_update_service_async(request_type=dict) - - def test_update_service_field_headers(): client = DataprocMetastoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2974,8 +2994,8 @@ async def test_update_service_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metastore.DeleteServiceRequest, - dict, + metastore.DeleteServiceRequest(), + {}, ], ) def test_delete_service(request_type, transport: str = "grpc"): @@ -2986,7 +3006,7 @@ def test_delete_service(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_service), "__call__") as call: @@ -3028,10 +3048,11 @@ def test_delete_service_non_empty_request_with_auto_populated_field(): client.delete_service(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.DeleteServiceRequest( + request_msg = metastore.DeleteServiceRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_service_use_cached_wrapped_rpc(): @@ -3122,9 +3143,14 @@ async def test_delete_service_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_service_async( - transport: str = "grpc_asyncio", request_type=metastore.DeleteServiceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.DeleteServiceRequest(), + {}, + ], +) +async def test_delete_service_async(request_type, transport: str = "grpc_asyncio"): client = DataprocMetastoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3132,7 +3158,7 @@ async def test_delete_service_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_service), "__call__") as call: @@ -3152,11 +3178,6 @@ async def test_delete_service_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_service_async_from_dict(): - await test_delete_service_async(request_type=dict) - - def test_delete_service_field_headers(): client = DataprocMetastoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3303,8 +3324,8 @@ async def test_delete_service_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metastore.ListMetadataImportsRequest, - dict, + metastore.ListMetadataImportsRequest(), + {}, ], ) def test_list_metadata_imports(request_type, transport: str = "grpc"): @@ -3315,7 +3336,7 @@ def test_list_metadata_imports(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3368,12 +3389,13 @@ def test_list_metadata_imports_non_empty_request_with_auto_populated_field(): client.list_metadata_imports(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.ListMetadataImportsRequest( + request_msg = metastore.ListMetadataImportsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_metadata_imports_use_cached_wrapped_rpc(): @@ -3459,8 +3481,15 @@ async def test_list_metadata_imports_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + metastore.ListMetadataImportsRequest(), + {}, + ], +) async def test_list_metadata_imports_async( - transport: str = "grpc_asyncio", request_type=metastore.ListMetadataImportsRequest + request_type, transport: str = "grpc_asyncio" ): client = DataprocMetastoreAsyncClient( credentials=async_anonymous_credentials(), @@ -3469,7 +3498,7 @@ async def test_list_metadata_imports_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( @@ -3496,11 +3525,6 @@ async def test_list_metadata_imports_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_metadata_imports_async_from_dict(): - await test_list_metadata_imports_async(request_type=dict) - - def test_list_metadata_imports_field_headers(): client = DataprocMetastoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3853,8 +3877,8 @@ async def test_list_metadata_imports_async_pages(): @pytest.mark.parametrize( "request_type", [ - metastore.GetMetadataImportRequest, - dict, + metastore.GetMetadataImportRequest(), + {}, ], ) def test_get_metadata_import(request_type, transport: str = "grpc"): @@ -3865,7 +3889,7 @@ def test_get_metadata_import(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3917,9 +3941,10 @@ def test_get_metadata_import_non_empty_request_with_auto_populated_field(): client.get_metadata_import(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.GetMetadataImportRequest( + request_msg = metastore.GetMetadataImportRequest( name="name_value", ) + assert args[0] == request_msg def test_get_metadata_import_use_cached_wrapped_rpc(): @@ -4004,9 +4029,14 @@ async def test_get_metadata_import_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_metadata_import_async( - transport: str = "grpc_asyncio", request_type=metastore.GetMetadataImportRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.GetMetadataImportRequest(), + {}, + ], +) +async def test_get_metadata_import_async(request_type, transport: str = "grpc_asyncio"): client = DataprocMetastoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4014,7 +4044,7 @@ async def test_get_metadata_import_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( @@ -4043,11 +4073,6 @@ async def test_get_metadata_import_async( assert response.state == metastore.MetadataImport.State.RUNNING -@pytest.mark.asyncio -async def test_get_metadata_import_async_from_dict(): - await test_get_metadata_import_async(request_type=dict) - - def test_get_metadata_import_field_headers(): client = DataprocMetastoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4202,8 +4227,8 @@ async def test_get_metadata_import_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metastore.CreateMetadataImportRequest, - dict, + metastore.CreateMetadataImportRequest(), + {}, ], ) def test_create_metadata_import(request_type, transport: str = "grpc"): @@ -4214,7 +4239,7 @@ def test_create_metadata_import(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4261,11 +4286,12 @@ def test_create_metadata_import_non_empty_request_with_auto_populated_field(): client.create_metadata_import(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.CreateMetadataImportRequest( + request_msg = metastore.CreateMetadataImportRequest( parent="parent_value", metadata_import_id="metadata_import_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_metadata_import_use_cached_wrapped_rpc(): @@ -4361,8 +4387,15 @@ async def test_create_metadata_import_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + metastore.CreateMetadataImportRequest(), + {}, + ], +) async def test_create_metadata_import_async( - transport: str = "grpc_asyncio", request_type=metastore.CreateMetadataImportRequest + request_type, transport: str = "grpc_asyncio" ): client = DataprocMetastoreAsyncClient( credentials=async_anonymous_credentials(), @@ -4371,7 +4404,7 @@ async def test_create_metadata_import_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( @@ -4393,11 +4426,6 @@ async def test_create_metadata_import_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_metadata_import_async_from_dict(): - await test_create_metadata_import_async(request_type=dict) - - def test_create_metadata_import_field_headers(): client = DataprocMetastoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4596,8 +4624,8 @@ async def test_create_metadata_import_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metastore.UpdateMetadataImportRequest, - dict, + metastore.UpdateMetadataImportRequest(), + {}, ], ) def test_update_metadata_import(request_type, transport: str = "grpc"): @@ -4608,7 +4636,7 @@ def test_update_metadata_import(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4653,9 +4681,10 @@ def test_update_metadata_import_non_empty_request_with_auto_populated_field(): client.update_metadata_import(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.UpdateMetadataImportRequest( + request_msg = metastore.UpdateMetadataImportRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_metadata_import_use_cached_wrapped_rpc(): @@ -4751,8 +4780,15 @@ async def test_update_metadata_import_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + metastore.UpdateMetadataImportRequest(), + {}, + ], +) async def test_update_metadata_import_async( - transport: str = "grpc_asyncio", request_type=metastore.UpdateMetadataImportRequest + request_type, transport: str = "grpc_asyncio" ): client = DataprocMetastoreAsyncClient( credentials=async_anonymous_credentials(), @@ -4761,7 +4797,7 @@ async def test_update_metadata_import_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( @@ -4783,11 +4819,6 @@ async def test_update_metadata_import_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_metadata_import_async_from_dict(): - await test_update_metadata_import_async(request_type=dict) - - def test_update_metadata_import_field_headers(): client = DataprocMetastoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4976,8 +5007,8 @@ async def test_update_metadata_import_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metastore.ExportMetadataRequest, - dict, + metastore.ExportMetadataRequest(), + {}, ], ) def test_export_metadata(request_type, transport: str = "grpc"): @@ -4988,7 +5019,7 @@ def test_export_metadata(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.export_metadata), "__call__") as call: @@ -5031,11 +5062,12 @@ def test_export_metadata_non_empty_request_with_auto_populated_field(): client.export_metadata(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.ExportMetadataRequest( + request_msg = metastore.ExportMetadataRequest( destination_gcs_folder="destination_gcs_folder_value", service="service_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_export_metadata_use_cached_wrapped_rpc(): @@ -5126,9 +5158,14 @@ async def test_export_metadata_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_export_metadata_async( - transport: str = "grpc_asyncio", request_type=metastore.ExportMetadataRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.ExportMetadataRequest(), + {}, + ], +) +async def test_export_metadata_async(request_type, transport: str = "grpc_asyncio"): client = DataprocMetastoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5136,7 +5173,7 @@ async def test_export_metadata_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.export_metadata), "__call__") as call: @@ -5156,11 +5193,6 @@ async def test_export_metadata_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_export_metadata_async_from_dict(): - await test_export_metadata_async(request_type=dict) - - def test_export_metadata_field_headers(): client = DataprocMetastoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5225,8 +5257,8 @@ async def test_export_metadata_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - metastore.RestoreServiceRequest, - dict, + metastore.RestoreServiceRequest(), + {}, ], ) def test_restore_service(request_type, transport: str = "grpc"): @@ -5237,7 +5269,7 @@ def test_restore_service(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.restore_service), "__call__") as call: @@ -5280,11 +5312,12 @@ def test_restore_service_non_empty_request_with_auto_populated_field(): client.restore_service(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.RestoreServiceRequest( + request_msg = metastore.RestoreServiceRequest( service="service_value", backup="backup_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_restore_service_use_cached_wrapped_rpc(): @@ -5375,9 +5408,14 @@ async def test_restore_service_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_restore_service_async( - transport: str = "grpc_asyncio", request_type=metastore.RestoreServiceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.RestoreServiceRequest(), + {}, + ], +) +async def test_restore_service_async(request_type, transport: str = "grpc_asyncio"): client = DataprocMetastoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5385,7 +5423,7 @@ async def test_restore_service_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.restore_service), "__call__") as call: @@ -5405,11 +5443,6 @@ async def test_restore_service_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_restore_service_async_from_dict(): - await test_restore_service_async(request_type=dict) - - def test_restore_service_field_headers(): client = DataprocMetastoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5566,8 +5599,8 @@ async def test_restore_service_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metastore.ListBackupsRequest, - dict, + metastore.ListBackupsRequest(), + {}, ], ) def test_list_backups(request_type, transport: str = "grpc"): @@ -5578,7 +5611,7 @@ def test_list_backups(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_backups), "__call__") as call: @@ -5627,12 +5660,13 @@ def test_list_backups_non_empty_request_with_auto_populated_field(): client.list_backups(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.ListBackupsRequest( + request_msg = metastore.ListBackupsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_backups_use_cached_wrapped_rpc(): @@ -5713,9 +5747,14 @@ async def test_list_backups_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_backups_async( - transport: str = "grpc_asyncio", request_type=metastore.ListBackupsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.ListBackupsRequest(), + {}, + ], +) +async def test_list_backups_async(request_type, transport: str = "grpc_asyncio"): client = DataprocMetastoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5723,7 +5762,7 @@ async def test_list_backups_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_backups), "__call__") as call: @@ -5748,11 +5787,6 @@ async def test_list_backups_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_backups_async_from_dict(): - await test_list_backups_async(request_type=dict) - - def test_list_backups_field_headers(): client = DataprocMetastoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6089,8 +6123,8 @@ async def test_list_backups_async_pages(): @pytest.mark.parametrize( "request_type", [ - metastore.GetBackupRequest, - dict, + metastore.GetBackupRequest(), + {}, ], ) def test_get_backup(request_type, transport: str = "grpc"): @@ -6101,7 +6135,7 @@ def test_get_backup(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_backup), "__call__") as call: @@ -6151,9 +6185,10 @@ def test_get_backup_non_empty_request_with_auto_populated_field(): client.get_backup(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.GetBackupRequest( + request_msg = metastore.GetBackupRequest( name="name_value", ) + assert args[0] == request_msg def test_get_backup_use_cached_wrapped_rpc(): @@ -6232,9 +6267,14 @@ async def test_get_backup_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_backup_async( - transport: str = "grpc_asyncio", request_type=metastore.GetBackupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.GetBackupRequest(), + {}, + ], +) +async def test_get_backup_async(request_type, transport: str = "grpc_asyncio"): client = DataprocMetastoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6242,7 +6282,7 @@ async def test_get_backup_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_backup), "__call__") as call: @@ -6271,11 +6311,6 @@ async def test_get_backup_async( assert response.restoring_services == ["restoring_services_value"] -@pytest.mark.asyncio -async def test_get_backup_async_from_dict(): - await test_get_backup_async(request_type=dict) - - def test_get_backup_field_headers(): client = DataprocMetastoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6418,8 +6453,8 @@ async def test_get_backup_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metastore.CreateBackupRequest, - dict, + metastore.CreateBackupRequest(), + {}, ], ) def test_create_backup(request_type, transport: str = "grpc"): @@ -6430,7 +6465,7 @@ def test_create_backup(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_backup), "__call__") as call: @@ -6473,11 +6508,12 @@ def test_create_backup_non_empty_request_with_auto_populated_field(): client.create_backup(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.CreateBackupRequest( + request_msg = metastore.CreateBackupRequest( parent="parent_value", backup_id="backup_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_backup_use_cached_wrapped_rpc(): @@ -6568,9 +6604,14 @@ async def test_create_backup_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_backup_async( - transport: str = "grpc_asyncio", request_type=metastore.CreateBackupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.CreateBackupRequest(), + {}, + ], +) +async def test_create_backup_async(request_type, transport: str = "grpc_asyncio"): client = DataprocMetastoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6578,7 +6619,7 @@ async def test_create_backup_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_backup), "__call__") as call: @@ -6598,11 +6639,6 @@ async def test_create_backup_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_backup_async_from_dict(): - await test_create_backup_async(request_type=dict) - - def test_create_backup_field_headers(): client = DataprocMetastoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6769,8 +6805,8 @@ async def test_create_backup_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metastore.DeleteBackupRequest, - dict, + metastore.DeleteBackupRequest(), + {}, ], ) def test_delete_backup(request_type, transport: str = "grpc"): @@ -6781,7 +6817,7 @@ def test_delete_backup(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_backup), "__call__") as call: @@ -6823,10 +6859,11 @@ def test_delete_backup_non_empty_request_with_auto_populated_field(): client.delete_backup(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.DeleteBackupRequest( + request_msg = metastore.DeleteBackupRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_backup_use_cached_wrapped_rpc(): @@ -6917,9 +6954,14 @@ async def test_delete_backup_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_backup_async( - transport: str = "grpc_asyncio", request_type=metastore.DeleteBackupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.DeleteBackupRequest(), + {}, + ], +) +async def test_delete_backup_async(request_type, transport: str = "grpc_asyncio"): client = DataprocMetastoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6927,7 +6969,7 @@ async def test_delete_backup_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_backup), "__call__") as call: @@ -6947,11 +6989,6 @@ async def test_delete_backup_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_backup_async_from_dict(): - await test_delete_backup_async(request_type=dict) - - def test_delete_backup_field_headers(): client = DataprocMetastoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7098,8 +7135,8 @@ async def test_delete_backup_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metastore.RemoveIamPolicyRequest, - dict, + metastore.RemoveIamPolicyRequest(), + {}, ], ) def test_remove_iam_policy(request_type, transport: str = "grpc"): @@ -7110,7 +7147,7 @@ def test_remove_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( @@ -7158,9 +7195,10 @@ def test_remove_iam_policy_non_empty_request_with_auto_populated_field(): client.remove_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.RemoveIamPolicyRequest( + request_msg = metastore.RemoveIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_remove_iam_policy_use_cached_wrapped_rpc(): @@ -7243,9 +7281,14 @@ async def test_remove_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_remove_iam_policy_async( - transport: str = "grpc_asyncio", request_type=metastore.RemoveIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.RemoveIamPolicyRequest(), + {}, + ], +) +async def test_remove_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = DataprocMetastoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7253,7 +7296,7 @@ async def test_remove_iam_policy_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( @@ -7278,11 +7321,6 @@ async def test_remove_iam_policy_async( assert response.success is True -@pytest.mark.asyncio -async def test_remove_iam_policy_async_from_dict(): - await test_remove_iam_policy_async(request_type=dict) - - def test_remove_iam_policy_field_headers(): client = DataprocMetastoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7351,8 +7389,8 @@ async def test_remove_iam_policy_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - metastore.QueryMetadataRequest, - dict, + metastore.QueryMetadataRequest(), + {}, ], ) def test_query_metadata(request_type, transport: str = "grpc"): @@ -7363,7 +7401,7 @@ def test_query_metadata(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.query_metadata), "__call__") as call: @@ -7405,10 +7443,11 @@ def test_query_metadata_non_empty_request_with_auto_populated_field(): client.query_metadata(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.QueryMetadataRequest( + request_msg = metastore.QueryMetadataRequest( service="service_value", query="query_value", ) + assert args[0] == request_msg def test_query_metadata_use_cached_wrapped_rpc(): @@ -7499,9 +7538,14 @@ async def test_query_metadata_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_query_metadata_async( - transport: str = "grpc_asyncio", request_type=metastore.QueryMetadataRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metastore.QueryMetadataRequest(), + {}, + ], +) +async def test_query_metadata_async(request_type, transport: str = "grpc_asyncio"): client = DataprocMetastoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7509,7 +7553,7 @@ async def test_query_metadata_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.query_metadata), "__call__") as call: @@ -7529,11 +7573,6 @@ async def test_query_metadata_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_query_metadata_async_from_dict(): - await test_query_metadata_async(request_type=dict) - - def test_query_metadata_field_headers(): client = DataprocMetastoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7598,8 +7637,8 @@ async def test_query_metadata_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - metastore.MoveTableToDatabaseRequest, - dict, + metastore.MoveTableToDatabaseRequest(), + {}, ], ) def test_move_table_to_database(request_type, transport: str = "grpc"): @@ -7610,7 +7649,7 @@ def test_move_table_to_database(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7658,12 +7697,13 @@ def test_move_table_to_database_non_empty_request_with_auto_populated_field(): client.move_table_to_database(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.MoveTableToDatabaseRequest( + request_msg = metastore.MoveTableToDatabaseRequest( service="service_value", table_name="table_name_value", db_name="db_name_value", destination_db_name="destination_db_name_value", ) + assert args[0] == request_msg def test_move_table_to_database_use_cached_wrapped_rpc(): @@ -7759,8 +7799,15 @@ async def test_move_table_to_database_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + metastore.MoveTableToDatabaseRequest(), + {}, + ], +) async def test_move_table_to_database_async( - transport: str = "grpc_asyncio", request_type=metastore.MoveTableToDatabaseRequest + request_type, transport: str = "grpc_asyncio" ): client = DataprocMetastoreAsyncClient( credentials=async_anonymous_credentials(), @@ -7769,7 +7816,7 @@ async def test_move_table_to_database_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( @@ -7791,11 +7838,6 @@ async def test_move_table_to_database_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_move_table_to_database_async_from_dict(): - await test_move_table_to_database_async(request_type=dict) - - def test_move_table_to_database_field_headers(): client = DataprocMetastoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7864,8 +7906,8 @@ async def test_move_table_to_database_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - metastore.AlterMetadataResourceLocationRequest, - dict, + metastore.AlterMetadataResourceLocationRequest(), + {}, ], ) def test_alter_metadata_resource_location(request_type, transport: str = "grpc"): @@ -7876,7 +7918,7 @@ def test_alter_metadata_resource_location(request_type, transport: str = "grpc") # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7923,11 +7965,12 @@ def test_alter_metadata_resource_location_non_empty_request_with_auto_populated_ client.alter_metadata_resource_location(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore.AlterMetadataResourceLocationRequest( + request_msg = metastore.AlterMetadataResourceLocationRequest( service="service_value", resource_name="resource_name_value", location_uri="location_uri_value", ) + assert args[0] == request_msg def test_alter_metadata_resource_location_use_cached_wrapped_rpc(): @@ -8023,9 +8066,15 @@ async def test_alter_metadata_resource_location_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + metastore.AlterMetadataResourceLocationRequest(), + {}, + ], +) async def test_alter_metadata_resource_location_async( - transport: str = "grpc_asyncio", - request_type=metastore.AlterMetadataResourceLocationRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataprocMetastoreAsyncClient( credentials=async_anonymous_credentials(), @@ -8034,7 +8083,7 @@ async def test_alter_metadata_resource_location_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( @@ -8056,11 +8105,6 @@ async def test_alter_metadata_resource_location_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_alter_metadata_resource_location_async_from_dict(): - await test_alter_metadata_resource_location_async(request_type=dict) - - def test_alter_metadata_resource_location_field_headers(): client = DataprocMetastoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11886,7 +11930,6 @@ def test_list_services_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.ListServicesRequest() - assert args[0] == request_msg @@ -11907,7 +11950,6 @@ def test_get_service_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.GetServiceRequest() - assert args[0] == request_msg @@ -11928,7 +11970,6 @@ def test_create_service_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.CreateServiceRequest() - assert args[0] == request_msg @@ -11949,7 +11990,6 @@ def test_update_service_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.UpdateServiceRequest() - assert args[0] == request_msg @@ -11970,7 +12010,6 @@ def test_delete_service_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.DeleteServiceRequest() - assert args[0] == request_msg @@ -11993,7 +12032,6 @@ def test_list_metadata_imports_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.ListMetadataImportsRequest() - assert args[0] == request_msg @@ -12016,7 +12054,6 @@ def test_get_metadata_import_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.GetMetadataImportRequest() - assert args[0] == request_msg @@ -12039,7 +12076,6 @@ def test_create_metadata_import_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.CreateMetadataImportRequest() - assert args[0] == request_msg @@ -12062,7 +12098,6 @@ def test_update_metadata_import_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.UpdateMetadataImportRequest() - assert args[0] == request_msg @@ -12083,7 +12118,6 @@ def test_export_metadata_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.ExportMetadataRequest() - assert args[0] == request_msg @@ -12104,7 +12138,6 @@ def test_restore_service_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.RestoreServiceRequest() - assert args[0] == request_msg @@ -12125,7 +12158,6 @@ def test_list_backups_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.ListBackupsRequest() - assert args[0] == request_msg @@ -12146,7 +12178,6 @@ def test_get_backup_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.GetBackupRequest() - assert args[0] == request_msg @@ -12167,7 +12198,6 @@ def test_create_backup_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.CreateBackupRequest() - assert args[0] == request_msg @@ -12188,7 +12218,6 @@ def test_delete_backup_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.DeleteBackupRequest() - assert args[0] == request_msg @@ -12211,7 +12240,6 @@ def test_remove_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.RemoveIamPolicyRequest() - assert args[0] == request_msg @@ -12232,7 +12260,6 @@ def test_query_metadata_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.QueryMetadataRequest() - assert args[0] == request_msg @@ -12255,7 +12282,6 @@ def test_move_table_to_database_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.MoveTableToDatabaseRequest() - assert args[0] == request_msg @@ -12278,7 +12304,6 @@ def test_alter_metadata_resource_location_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.AlterMetadataResourceLocationRequest() - assert args[0] == request_msg @@ -12320,7 +12345,6 @@ async def test_list_services_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.ListServicesRequest() - assert args[0] == request_msg @@ -12357,7 +12381,6 @@ async def test_get_service_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.GetServiceRequest() - assert args[0] == request_msg @@ -12382,7 +12405,6 @@ async def test_create_service_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.CreateServiceRequest() - assert args[0] == request_msg @@ -12407,7 +12429,6 @@ async def test_update_service_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.UpdateServiceRequest() - assert args[0] == request_msg @@ -12432,7 +12453,6 @@ async def test_delete_service_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.DeleteServiceRequest() - assert args[0] == request_msg @@ -12462,7 +12482,6 @@ async def test_list_metadata_imports_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.ListMetadataImportsRequest() - assert args[0] == request_msg @@ -12493,7 +12512,6 @@ async def test_get_metadata_import_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.GetMetadataImportRequest() - assert args[0] == request_msg @@ -12520,7 +12538,6 @@ async def test_create_metadata_import_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.CreateMetadataImportRequest() - assert args[0] == request_msg @@ -12547,7 +12564,6 @@ async def test_update_metadata_import_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.UpdateMetadataImportRequest() - assert args[0] == request_msg @@ -12572,7 +12588,6 @@ async def test_export_metadata_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.ExportMetadataRequest() - assert args[0] == request_msg @@ -12597,7 +12612,6 @@ async def test_restore_service_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.RestoreServiceRequest() - assert args[0] == request_msg @@ -12625,7 +12639,6 @@ async def test_list_backups_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.ListBackupsRequest() - assert args[0] == request_msg @@ -12655,7 +12668,6 @@ async def test_get_backup_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.GetBackupRequest() - assert args[0] == request_msg @@ -12680,7 +12692,6 @@ async def test_create_backup_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.CreateBackupRequest() - assert args[0] == request_msg @@ -12705,7 +12716,6 @@ async def test_delete_backup_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.DeleteBackupRequest() - assert args[0] == request_msg @@ -12734,7 +12744,6 @@ async def test_remove_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.RemoveIamPolicyRequest() - assert args[0] == request_msg @@ -12759,7 +12768,6 @@ async def test_query_metadata_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.QueryMetadataRequest() - assert args[0] == request_msg @@ -12786,7 +12794,6 @@ async def test_move_table_to_database_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.MoveTableToDatabaseRequest() - assert args[0] == request_msg @@ -12813,7 +12820,6 @@ async def test_alter_metadata_resource_location_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.AlterMetadataResourceLocationRequest() - assert args[0] == request_msg @@ -16443,7 +16449,6 @@ def test_list_services_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.ListServicesRequest() - assert args[0] == request_msg @@ -16463,7 +16468,6 @@ def test_get_service_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.GetServiceRequest() - assert args[0] == request_msg @@ -16483,7 +16487,6 @@ def test_create_service_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.CreateServiceRequest() - assert args[0] == request_msg @@ -16503,7 +16506,6 @@ def test_update_service_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.UpdateServiceRequest() - assert args[0] == request_msg @@ -16523,7 +16525,6 @@ def test_delete_service_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.DeleteServiceRequest() - assert args[0] == request_msg @@ -16545,7 +16546,6 @@ def test_list_metadata_imports_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.ListMetadataImportsRequest() - assert args[0] == request_msg @@ -16567,7 +16567,6 @@ def test_get_metadata_import_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.GetMetadataImportRequest() - assert args[0] == request_msg @@ -16589,7 +16588,6 @@ def test_create_metadata_import_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.CreateMetadataImportRequest() - assert args[0] == request_msg @@ -16611,7 +16609,6 @@ def test_update_metadata_import_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.UpdateMetadataImportRequest() - assert args[0] == request_msg @@ -16631,7 +16628,6 @@ def test_export_metadata_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.ExportMetadataRequest() - assert args[0] == request_msg @@ -16651,7 +16647,6 @@ def test_restore_service_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.RestoreServiceRequest() - assert args[0] == request_msg @@ -16671,7 +16666,6 @@ def test_list_backups_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.ListBackupsRequest() - assert args[0] == request_msg @@ -16691,7 +16685,6 @@ def test_get_backup_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.GetBackupRequest() - assert args[0] == request_msg @@ -16711,7 +16704,6 @@ def test_create_backup_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.CreateBackupRequest() - assert args[0] == request_msg @@ -16731,7 +16723,6 @@ def test_delete_backup_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.DeleteBackupRequest() - assert args[0] == request_msg @@ -16753,7 +16744,6 @@ def test_remove_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.RemoveIamPolicyRequest() - assert args[0] == request_msg @@ -16773,7 +16763,6 @@ def test_query_metadata_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.QueryMetadataRequest() - assert args[0] == request_msg @@ -16795,7 +16784,6 @@ def test_move_table_to_database_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.MoveTableToDatabaseRequest() - assert args[0] == request_msg @@ -16817,7 +16805,6 @@ def test_alter_metadata_resource_location_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore.AlterMetadataResourceLocationRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dataproc-metastore/tests/unit/gapic/metastore_v1beta/test_dataproc_metastore_federation.py b/packages/google-cloud-dataproc-metastore/tests/unit/gapic/metastore_v1beta/test_dataproc_metastore_federation.py index cb6fc4870299..0ed91e8b72a2 100644 --- a/packages/google-cloud-dataproc-metastore/tests/unit/gapic/metastore_v1beta/test_dataproc_metastore_federation.py +++ b/packages/google-cloud-dataproc-metastore/tests/unit/gapic/metastore_v1beta/test_dataproc_metastore_federation.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 @@ -121,6 +122,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" @@ -1427,8 +1443,8 @@ def test_dataproc_metastore_federation_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - metastore_federation.ListFederationsRequest, - dict, + metastore_federation.ListFederationsRequest(), + {}, ], ) def test_list_federations(request_type, transport: str = "grpc"): @@ -1439,7 +1455,7 @@ def test_list_federations(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_federations), "__call__") as call: @@ -1488,12 +1504,13 @@ def test_list_federations_non_empty_request_with_auto_populated_field(): client.list_federations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore_federation.ListFederationsRequest( + request_msg = metastore_federation.ListFederationsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_federations_use_cached_wrapped_rpc(): @@ -1576,10 +1593,14 @@ async def test_list_federations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_federations_async( - transport: str = "grpc_asyncio", - request_type=metastore_federation.ListFederationsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + metastore_federation.ListFederationsRequest(), + {}, + ], +) +async def test_list_federations_async(request_type, transport: str = "grpc_asyncio"): client = DataprocMetastoreFederationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1587,7 +1608,7 @@ async def test_list_federations_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_federations), "__call__") as call: @@ -1612,11 +1633,6 @@ async def test_list_federations_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_federations_async_from_dict(): - await test_list_federations_async(request_type=dict) - - def test_list_federations_field_headers(): client = DataprocMetastoreFederationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1953,8 +1969,8 @@ async def test_list_federations_async_pages(): @pytest.mark.parametrize( "request_type", [ - metastore_federation.GetFederationRequest, - dict, + metastore_federation.GetFederationRequest(), + {}, ], ) def test_get_federation(request_type, transport: str = "grpc"): @@ -1965,7 +1981,7 @@ def test_get_federation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_federation), "__call__") as call: @@ -2019,9 +2035,10 @@ def test_get_federation_non_empty_request_with_auto_populated_field(): client.get_federation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore_federation.GetFederationRequest( + request_msg = metastore_federation.GetFederationRequest( name="name_value", ) + assert args[0] == request_msg def test_get_federation_use_cached_wrapped_rpc(): @@ -2102,10 +2119,14 @@ async def test_get_federation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_federation_async( - transport: str = "grpc_asyncio", - request_type=metastore_federation.GetFederationRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + metastore_federation.GetFederationRequest(), + {}, + ], +) +async def test_get_federation_async(request_type, transport: str = "grpc_asyncio"): client = DataprocMetastoreFederationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2113,7 +2134,7 @@ async def test_get_federation_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_federation), "__call__") as call: @@ -2146,11 +2167,6 @@ async def test_get_federation_async( assert response.uid == "uid_value" -@pytest.mark.asyncio -async def test_get_federation_async_from_dict(): - await test_get_federation_async(request_type=dict) - - def test_get_federation_field_headers(): client = DataprocMetastoreFederationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2297,8 +2313,8 @@ async def test_get_federation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metastore_federation.CreateFederationRequest, - dict, + metastore_federation.CreateFederationRequest(), + {}, ], ) def test_create_federation(request_type, transport: str = "grpc"): @@ -2309,7 +2325,7 @@ def test_create_federation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2356,11 +2372,12 @@ def test_create_federation_non_empty_request_with_auto_populated_field(): client.create_federation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore_federation.CreateFederationRequest( + request_msg = metastore_federation.CreateFederationRequest( parent="parent_value", federation_id="federation_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_federation_use_cached_wrapped_rpc(): @@ -2453,10 +2470,14 @@ async def test_create_federation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_federation_async( - transport: str = "grpc_asyncio", - request_type=metastore_federation.CreateFederationRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + metastore_federation.CreateFederationRequest(), + {}, + ], +) +async def test_create_federation_async(request_type, transport: str = "grpc_asyncio"): client = DataprocMetastoreFederationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2464,7 +2485,7 @@ async def test_create_federation_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( @@ -2486,11 +2507,6 @@ async def test_create_federation_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_federation_async_from_dict(): - await test_create_federation_async(request_type=dict) - - def test_create_federation_field_headers(): client = DataprocMetastoreFederationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2665,8 +2681,8 @@ async def test_create_federation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metastore_federation.UpdateFederationRequest, - dict, + metastore_federation.UpdateFederationRequest(), + {}, ], ) def test_update_federation(request_type, transport: str = "grpc"): @@ -2677,7 +2693,7 @@ def test_update_federation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2722,9 +2738,10 @@ def test_update_federation_non_empty_request_with_auto_populated_field(): client.update_federation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore_federation.UpdateFederationRequest( + request_msg = metastore_federation.UpdateFederationRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_federation_use_cached_wrapped_rpc(): @@ -2817,10 +2834,14 @@ async def test_update_federation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_federation_async( - transport: str = "grpc_asyncio", - request_type=metastore_federation.UpdateFederationRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + metastore_federation.UpdateFederationRequest(), + {}, + ], +) +async def test_update_federation_async(request_type, transport: str = "grpc_asyncio"): client = DataprocMetastoreFederationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2828,7 +2849,7 @@ async def test_update_federation_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( @@ -2850,11 +2871,6 @@ async def test_update_federation_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_federation_async_from_dict(): - await test_update_federation_async(request_type=dict) - - def test_update_federation_field_headers(): client = DataprocMetastoreFederationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3019,8 +3035,8 @@ async def test_update_federation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metastore_federation.DeleteFederationRequest, - dict, + metastore_federation.DeleteFederationRequest(), + {}, ], ) def test_delete_federation(request_type, transport: str = "grpc"): @@ -3031,7 +3047,7 @@ def test_delete_federation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3077,10 +3093,11 @@ def test_delete_federation_non_empty_request_with_auto_populated_field(): client.delete_federation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metastore_federation.DeleteFederationRequest( + request_msg = metastore_federation.DeleteFederationRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_federation_use_cached_wrapped_rpc(): @@ -3173,10 +3190,14 @@ async def test_delete_federation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_federation_async( - transport: str = "grpc_asyncio", - request_type=metastore_federation.DeleteFederationRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + metastore_federation.DeleteFederationRequest(), + {}, + ], +) +async def test_delete_federation_async(request_type, transport: str = "grpc_asyncio"): client = DataprocMetastoreFederationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3184,7 +3205,7 @@ async def test_delete_federation_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( @@ -3206,11 +3227,6 @@ async def test_delete_federation_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_federation_async_from_dict(): - await test_delete_federation_async(request_type=dict) - - def test_delete_federation_field_headers(): client = DataprocMetastoreFederationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4529,7 +4545,6 @@ def test_list_federations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore_federation.ListFederationsRequest() - assert args[0] == request_msg @@ -4550,7 +4565,6 @@ def test_get_federation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore_federation.GetFederationRequest() - assert args[0] == request_msg @@ -4573,7 +4587,6 @@ def test_create_federation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore_federation.CreateFederationRequest() - assert args[0] == request_msg @@ -4596,7 +4609,6 @@ def test_update_federation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore_federation.UpdateFederationRequest() - assert args[0] == request_msg @@ -4619,7 +4631,6 @@ def test_delete_federation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore_federation.DeleteFederationRequest() - assert args[0] == request_msg @@ -4661,7 +4672,6 @@ async def test_list_federations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore_federation.ListFederationsRequest() - assert args[0] == request_msg @@ -4693,7 +4703,6 @@ async def test_get_federation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore_federation.GetFederationRequest() - assert args[0] == request_msg @@ -4720,7 +4729,6 @@ async def test_create_federation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore_federation.CreateFederationRequest() - assert args[0] == request_msg @@ -4747,7 +4755,6 @@ async def test_update_federation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore_federation.UpdateFederationRequest() - assert args[0] == request_msg @@ -4774,7 +4781,6 @@ async def test_delete_federation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore_federation.DeleteFederationRequest() - assert args[0] == request_msg @@ -6200,7 +6206,6 @@ def test_list_federations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore_federation.ListFederationsRequest() - assert args[0] == request_msg @@ -6220,7 +6225,6 @@ def test_get_federation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore_federation.GetFederationRequest() - assert args[0] == request_msg @@ -6242,7 +6246,6 @@ def test_create_federation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore_federation.CreateFederationRequest() - assert args[0] == request_msg @@ -6264,7 +6267,6 @@ def test_update_federation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore_federation.UpdateFederationRequest() - assert args[0] == request_msg @@ -6286,7 +6288,6 @@ def test_delete_federation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metastore_federation.DeleteFederationRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dataproc/noxfile.py b/packages/google-cloud-dataproc/noxfile.py index f7d6e20db2e4..4c1c13c5d053 100644 --- a/packages/google-cloud-dataproc/noxfile.py +++ b/packages/google-cloud-dataproc/noxfile.py @@ -47,7 +47,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-dataproc" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-dataproc/setup.py b/packages/google-cloud-dataproc/setup.py index 8ced9418874b..24eddbb83a43 100644 --- a/packages/google-cloud-dataproc/setup.py +++ b/packages/google-cloud-dataproc/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/google-cloud-dataproc/testing/constraints-3.10.txt b/packages/google-cloud-dataproc/testing/constraints-3.10.txt index a92801e1c8e2..b39cd54634f9 100644 --- a/packages/google-cloud-dataproc/testing/constraints-3.10.txt +++ b/packages/google-cloud-dataproc/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/google-cloud-dataproc/tests/unit/gapic/dataproc_v1/test_autoscaling_policy_service.py b/packages/google-cloud-dataproc/tests/unit/gapic/dataproc_v1/test_autoscaling_policy_service.py index ecccad0f2324..0cf4fb922e3b 100644 --- a/packages/google-cloud-dataproc/tests/unit/gapic/dataproc_v1/test_autoscaling_policy_service.py +++ b/packages/google-cloud-dataproc/tests/unit/gapic/dataproc_v1/test_autoscaling_policy_service.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 @@ -114,6 +115,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" @@ -1389,8 +1405,8 @@ def test_autoscaling_policy_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - autoscaling_policies.CreateAutoscalingPolicyRequest, - dict, + autoscaling_policies.CreateAutoscalingPolicyRequest(), + {}, ], ) def test_create_autoscaling_policy(request_type, transport: str = "grpc"): @@ -1401,7 +1417,7 @@ def test_create_autoscaling_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( @@ -1456,9 +1472,10 @@ def test_create_autoscaling_policy_non_empty_request_with_auto_populated_field() client.create_autoscaling_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == autoscaling_policies.CreateAutoscalingPolicyRequest( + request_msg = autoscaling_policies.CreateAutoscalingPolicyRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_autoscaling_policy_use_cached_wrapped_rpc(): @@ -1544,9 +1561,15 @@ async def test_create_autoscaling_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + autoscaling_policies.CreateAutoscalingPolicyRequest(), + {}, + ], +) async def test_create_autoscaling_policy_async( - transport: str = "grpc_asyncio", - request_type=autoscaling_policies.CreateAutoscalingPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = AutoscalingPolicyServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1555,7 +1578,7 @@ async def test_create_autoscaling_policy_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( @@ -1587,11 +1610,6 @@ async def test_create_autoscaling_policy_async( ) -@pytest.mark.asyncio -async def test_create_autoscaling_policy_async_from_dict(): - await test_create_autoscaling_policy_async(request_type=dict) - - def test_create_autoscaling_policy_field_headers(): client = AutoscalingPolicyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1756,8 +1774,8 @@ async def test_create_autoscaling_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - autoscaling_policies.UpdateAutoscalingPolicyRequest, - dict, + autoscaling_policies.UpdateAutoscalingPolicyRequest(), + {}, ], ) def test_update_autoscaling_policy(request_type, transport: str = "grpc"): @@ -1768,7 +1786,7 @@ def test_update_autoscaling_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( @@ -1821,7 +1839,8 @@ def test_update_autoscaling_policy_non_empty_request_with_auto_populated_field() client.update_autoscaling_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == autoscaling_policies.UpdateAutoscalingPolicyRequest() + request_msg = autoscaling_policies.UpdateAutoscalingPolicyRequest() + assert args[0] == request_msg def test_update_autoscaling_policy_use_cached_wrapped_rpc(): @@ -1907,9 +1926,15 @@ async def test_update_autoscaling_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + autoscaling_policies.UpdateAutoscalingPolicyRequest(), + {}, + ], +) async def test_update_autoscaling_policy_async( - transport: str = "grpc_asyncio", - request_type=autoscaling_policies.UpdateAutoscalingPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = AutoscalingPolicyServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1918,7 +1943,7 @@ async def test_update_autoscaling_policy_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( @@ -1950,11 +1975,6 @@ async def test_update_autoscaling_policy_async( ) -@pytest.mark.asyncio -async def test_update_autoscaling_policy_async_from_dict(): - await test_update_autoscaling_policy_async(request_type=dict) - - def test_update_autoscaling_policy_field_headers(): client = AutoscalingPolicyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2109,8 +2129,8 @@ async def test_update_autoscaling_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - autoscaling_policies.GetAutoscalingPolicyRequest, - dict, + autoscaling_policies.GetAutoscalingPolicyRequest(), + {}, ], ) def test_get_autoscaling_policy(request_type, transport: str = "grpc"): @@ -2121,7 +2141,7 @@ def test_get_autoscaling_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( @@ -2176,9 +2196,10 @@ def test_get_autoscaling_policy_non_empty_request_with_auto_populated_field(): client.get_autoscaling_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == autoscaling_policies.GetAutoscalingPolicyRequest( + request_msg = autoscaling_policies.GetAutoscalingPolicyRequest( name="name_value", ) + assert args[0] == request_msg def test_get_autoscaling_policy_use_cached_wrapped_rpc(): @@ -2264,9 +2285,15 @@ async def test_get_autoscaling_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + autoscaling_policies.GetAutoscalingPolicyRequest(), + {}, + ], +) async def test_get_autoscaling_policy_async( - transport: str = "grpc_asyncio", - request_type=autoscaling_policies.GetAutoscalingPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = AutoscalingPolicyServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2275,7 +2302,7 @@ async def test_get_autoscaling_policy_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( @@ -2307,11 +2334,6 @@ async def test_get_autoscaling_policy_async( ) -@pytest.mark.asyncio -async def test_get_autoscaling_policy_async_from_dict(): - await test_get_autoscaling_policy_async(request_type=dict) - - def test_get_autoscaling_policy_field_headers(): client = AutoscalingPolicyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2466,8 +2488,8 @@ async def test_get_autoscaling_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - autoscaling_policies.ListAutoscalingPoliciesRequest, - dict, + autoscaling_policies.ListAutoscalingPoliciesRequest(), + {}, ], ) def test_list_autoscaling_policies(request_type, transport: str = "grpc"): @@ -2478,7 +2500,7 @@ def test_list_autoscaling_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( @@ -2527,10 +2549,11 @@ def test_list_autoscaling_policies_non_empty_request_with_auto_populated_field() client.list_autoscaling_policies(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == autoscaling_policies.ListAutoscalingPoliciesRequest( + request_msg = autoscaling_policies.ListAutoscalingPoliciesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_autoscaling_policies_use_cached_wrapped_rpc(): @@ -2616,9 +2639,15 @@ async def test_list_autoscaling_policies_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + autoscaling_policies.ListAutoscalingPoliciesRequest(), + {}, + ], +) async def test_list_autoscaling_policies_async( - transport: str = "grpc_asyncio", - request_type=autoscaling_policies.ListAutoscalingPoliciesRequest, + request_type, transport: str = "grpc_asyncio" ): client = AutoscalingPolicyServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2627,7 +2656,7 @@ async def test_list_autoscaling_policies_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( @@ -2652,11 +2681,6 @@ async def test_list_autoscaling_policies_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_autoscaling_policies_async_from_dict(): - await test_list_autoscaling_policies_async(request_type=dict) - - def test_list_autoscaling_policies_field_headers(): client = AutoscalingPolicyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3015,8 +3039,8 @@ async def test_list_autoscaling_policies_async_pages(): @pytest.mark.parametrize( "request_type", [ - autoscaling_policies.DeleteAutoscalingPolicyRequest, - dict, + autoscaling_policies.DeleteAutoscalingPolicyRequest(), + {}, ], ) def test_delete_autoscaling_policy(request_type, transport: str = "grpc"): @@ -3027,7 +3051,7 @@ def test_delete_autoscaling_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( @@ -3072,9 +3096,10 @@ def test_delete_autoscaling_policy_non_empty_request_with_auto_populated_field() client.delete_autoscaling_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == autoscaling_policies.DeleteAutoscalingPolicyRequest( + request_msg = autoscaling_policies.DeleteAutoscalingPolicyRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_autoscaling_policy_use_cached_wrapped_rpc(): @@ -3160,9 +3185,15 @@ async def test_delete_autoscaling_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + autoscaling_policies.DeleteAutoscalingPolicyRequest(), + {}, + ], +) async def test_delete_autoscaling_policy_async( - transport: str = "grpc_asyncio", - request_type=autoscaling_policies.DeleteAutoscalingPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = AutoscalingPolicyServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3171,7 +3202,7 @@ async def test_delete_autoscaling_policy_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( @@ -3191,11 +3222,6 @@ async def test_delete_autoscaling_policy_async( assert response is None -@pytest.mark.asyncio -async def test_delete_autoscaling_policy_async_from_dict(): - await test_delete_autoscaling_policy_async(request_type=dict) - - def test_delete_autoscaling_policy_field_headers(): client = AutoscalingPolicyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4478,7 +4504,6 @@ def test_create_autoscaling_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = autoscaling_policies.CreateAutoscalingPolicyRequest() - assert args[0] == request_msg @@ -4501,7 +4526,6 @@ def test_update_autoscaling_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = autoscaling_policies.UpdateAutoscalingPolicyRequest() - assert args[0] == request_msg @@ -4524,7 +4548,6 @@ def test_get_autoscaling_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = autoscaling_policies.GetAutoscalingPolicyRequest() - assert args[0] == request_msg @@ -4547,7 +4570,6 @@ def test_list_autoscaling_policies_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = autoscaling_policies.ListAutoscalingPoliciesRequest() - assert args[0] == request_msg @@ -4570,7 +4592,6 @@ def test_delete_autoscaling_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = autoscaling_policies.DeleteAutoscalingPolicyRequest() - assert args[0] == request_msg @@ -4615,7 +4636,6 @@ async def test_create_autoscaling_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = autoscaling_policies.CreateAutoscalingPolicyRequest() - assert args[0] == request_msg @@ -4646,7 +4666,6 @@ async def test_update_autoscaling_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = autoscaling_policies.UpdateAutoscalingPolicyRequest() - assert args[0] == request_msg @@ -4677,7 +4696,6 @@ async def test_get_autoscaling_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = autoscaling_policies.GetAutoscalingPolicyRequest() - assert args[0] == request_msg @@ -4706,7 +4724,6 @@ async def test_list_autoscaling_policies_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = autoscaling_policies.ListAutoscalingPoliciesRequest() - assert args[0] == request_msg @@ -4731,7 +4748,6 @@ async def test_delete_autoscaling_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = autoscaling_policies.DeleteAutoscalingPolicyRequest() - assert args[0] == request_msg @@ -6084,7 +6100,6 @@ def test_create_autoscaling_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = autoscaling_policies.CreateAutoscalingPolicyRequest() - assert args[0] == request_msg @@ -6106,7 +6121,6 @@ def test_update_autoscaling_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = autoscaling_policies.UpdateAutoscalingPolicyRequest() - assert args[0] == request_msg @@ -6128,7 +6142,6 @@ def test_get_autoscaling_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = autoscaling_policies.GetAutoscalingPolicyRequest() - assert args[0] == request_msg @@ -6150,7 +6163,6 @@ def test_list_autoscaling_policies_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = autoscaling_policies.ListAutoscalingPoliciesRequest() - assert args[0] == request_msg @@ -6172,7 +6184,6 @@ def test_delete_autoscaling_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = autoscaling_policies.DeleteAutoscalingPolicyRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dataproc/tests/unit/gapic/dataproc_v1/test_batch_controller.py b/packages/google-cloud-dataproc/tests/unit/gapic/dataproc_v1/test_batch_controller.py index 8a80e5c42ab4..de8e55f1a687 100644 --- a/packages/google-cloud-dataproc/tests/unit/gapic/dataproc_v1/test_batch_controller.py +++ b/packages/google-cloud-dataproc/tests/unit/gapic/dataproc_v1/test_batch_controller.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 @@ -119,6 +120,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" @@ -1350,8 +1366,8 @@ def test_batch_controller_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - batches.CreateBatchRequest, - dict, + batches.CreateBatchRequest(), + {}, ], ) def test_create_batch(request_type, transport: str = "grpc"): @@ -1362,7 +1378,7 @@ def test_create_batch(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_batch), "__call__") as call: @@ -1405,11 +1421,12 @@ def test_create_batch_non_empty_request_with_auto_populated_field(): client.create_batch(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == batches.CreateBatchRequest( + request_msg = batches.CreateBatchRequest( parent="parent_value", batch_id="batch_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_batch_use_cached_wrapped_rpc(): @@ -1500,9 +1517,14 @@ async def test_create_batch_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_batch_async( - transport: str = "grpc_asyncio", request_type=batches.CreateBatchRequest -): +@pytest.mark.parametrize( + "request_type", + [ + batches.CreateBatchRequest(), + {}, + ], +) +async def test_create_batch_async(request_type, transport: str = "grpc_asyncio"): client = BatchControllerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1510,7 +1532,7 @@ async def test_create_batch_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_batch), "__call__") as call: @@ -1530,11 +1552,6 @@ async def test_create_batch_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_batch_async_from_dict(): - await test_create_batch_async(request_type=dict) - - def test_create_batch_field_headers(): client = BatchControllerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1701,8 +1718,8 @@ async def test_create_batch_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - batches.GetBatchRequest, - dict, + batches.GetBatchRequest(), + {}, ], ) def test_get_batch(request_type, transport: str = "grpc"): @@ -1713,7 +1730,7 @@ def test_get_batch(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_batch), "__call__") as call: @@ -1767,9 +1784,10 @@ def test_get_batch_non_empty_request_with_auto_populated_field(): client.get_batch(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == batches.GetBatchRequest( + request_msg = batches.GetBatchRequest( name="name_value", ) + assert args[0] == request_msg def test_get_batch_use_cached_wrapped_rpc(): @@ -1848,9 +1866,14 @@ async def test_get_batch_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_batch_async( - transport: str = "grpc_asyncio", request_type=batches.GetBatchRequest -): +@pytest.mark.parametrize( + "request_type", + [ + batches.GetBatchRequest(), + {}, + ], +) +async def test_get_batch_async(request_type, transport: str = "grpc_asyncio"): client = BatchControllerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1858,7 +1881,7 @@ async def test_get_batch_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_batch), "__call__") as call: @@ -1891,11 +1914,6 @@ async def test_get_batch_async( assert response.operation == "operation_value" -@pytest.mark.asyncio -async def test_get_batch_async_from_dict(): - await test_get_batch_async(request_type=dict) - - def test_get_batch_field_headers(): client = BatchControllerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2038,8 +2056,8 @@ async def test_get_batch_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - batches.ListBatchesRequest, - dict, + batches.ListBatchesRequest(), + {}, ], ) def test_list_batches(request_type, transport: str = "grpc"): @@ -2050,7 +2068,7 @@ def test_list_batches(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_batches), "__call__") as call: @@ -2099,12 +2117,13 @@ def test_list_batches_non_empty_request_with_auto_populated_field(): client.list_batches(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == batches.ListBatchesRequest( + request_msg = batches.ListBatchesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_batches_use_cached_wrapped_rpc(): @@ -2185,9 +2204,14 @@ async def test_list_batches_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_batches_async( - transport: str = "grpc_asyncio", request_type=batches.ListBatchesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + batches.ListBatchesRequest(), + {}, + ], +) +async def test_list_batches_async(request_type, transport: str = "grpc_asyncio"): client = BatchControllerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2195,7 +2219,7 @@ async def test_list_batches_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_batches), "__call__") as call: @@ -2220,11 +2244,6 @@ async def test_list_batches_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_batches_async_from_dict(): - await test_list_batches_async(request_type=dict) - - def test_list_batches_field_headers(): client = BatchControllerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2561,8 +2580,8 @@ async def test_list_batches_async_pages(): @pytest.mark.parametrize( "request_type", [ - batches.DeleteBatchRequest, - dict, + batches.DeleteBatchRequest(), + {}, ], ) def test_delete_batch(request_type, transport: str = "grpc"): @@ -2573,7 +2592,7 @@ def test_delete_batch(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_batch), "__call__") as call: @@ -2614,9 +2633,10 @@ def test_delete_batch_non_empty_request_with_auto_populated_field(): client.delete_batch(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == batches.DeleteBatchRequest( + request_msg = batches.DeleteBatchRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_batch_use_cached_wrapped_rpc(): @@ -2697,9 +2717,14 @@ async def test_delete_batch_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_batch_async( - transport: str = "grpc_asyncio", request_type=batches.DeleteBatchRequest -): +@pytest.mark.parametrize( + "request_type", + [ + batches.DeleteBatchRequest(), + {}, + ], +) +async def test_delete_batch_async(request_type, transport: str = "grpc_asyncio"): client = BatchControllerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2707,7 +2732,7 @@ async def test_delete_batch_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_batch), "__call__") as call: @@ -2725,11 +2750,6 @@ async def test_delete_batch_async( assert response is None -@pytest.mark.asyncio -async def test_delete_batch_async_from_dict(): - await test_delete_batch_async(request_type=dict) - - def test_delete_batch_field_headers(): client = BatchControllerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3791,7 +3811,6 @@ def test_create_batch_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = batches.CreateBatchRequest() - assert args[0] == request_msg @@ -3812,7 +3831,6 @@ def test_get_batch_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = batches.GetBatchRequest() - assert args[0] == request_msg @@ -3833,7 +3851,6 @@ def test_list_batches_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = batches.ListBatchesRequest() - assert args[0] == request_msg @@ -3854,7 +3871,6 @@ def test_delete_batch_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = batches.DeleteBatchRequest() - assert args[0] == request_msg @@ -3893,7 +3909,6 @@ async def test_create_batch_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = batches.CreateBatchRequest() - assert args[0] == request_msg @@ -3925,7 +3940,6 @@ async def test_get_batch_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = batches.GetBatchRequest() - assert args[0] == request_msg @@ -3953,7 +3967,6 @@ async def test_list_batches_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = batches.ListBatchesRequest() - assert args[0] == request_msg @@ -3976,7 +3989,6 @@ async def test_delete_batch_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = batches.DeleteBatchRequest() - assert args[0] == request_msg @@ -5111,7 +5123,6 @@ def test_create_batch_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = batches.CreateBatchRequest() - assert args[0] == request_msg @@ -5131,7 +5142,6 @@ def test_get_batch_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = batches.GetBatchRequest() - assert args[0] == request_msg @@ -5151,7 +5161,6 @@ def test_list_batches_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = batches.ListBatchesRequest() - assert args[0] == request_msg @@ -5171,7 +5180,6 @@ def test_delete_batch_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = batches.DeleteBatchRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dataproc/tests/unit/gapic/dataproc_v1/test_cluster_controller.py b/packages/google-cloud-dataproc/tests/unit/gapic/dataproc_v1/test_cluster_controller.py index e8d269fad86c..c86e8b888fb4 100644 --- a/packages/google-cloud-dataproc/tests/unit/gapic/dataproc_v1/test_cluster_controller.py +++ b/packages/google-cloud-dataproc/tests/unit/gapic/dataproc_v1/test_cluster_controller.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 @@ -122,6 +123,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" @@ -1363,8 +1379,8 @@ def test_cluster_controller_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - clusters.CreateClusterRequest, - dict, + clusters.CreateClusterRequest(), + {}, ], ) def test_create_cluster(request_type, transport: str = "grpc"): @@ -1375,7 +1391,7 @@ def test_create_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_cluster), "__call__") as call: @@ -1418,11 +1434,12 @@ def test_create_cluster_non_empty_request_with_auto_populated_field(): client.create_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == clusters.CreateClusterRequest( + request_msg = clusters.CreateClusterRequest( project_id="project_id_value", region="region_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_cluster_use_cached_wrapped_rpc(): @@ -1513,9 +1530,14 @@ async def test_create_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_cluster_async( - transport: str = "grpc_asyncio", request_type=clusters.CreateClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + clusters.CreateClusterRequest(), + {}, + ], +) +async def test_create_cluster_async(request_type, transport: str = "grpc_asyncio"): client = ClusterControllerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1523,7 +1545,7 @@ async def test_create_cluster_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_cluster), "__call__") as call: @@ -1543,11 +1565,6 @@ async def test_create_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_cluster_async_from_dict(): - await test_create_cluster_async(request_type=dict) - - def test_create_cluster_field_headers(): client = ClusterControllerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1716,8 +1733,8 @@ async def test_create_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - clusters.UpdateClusterRequest, - dict, + clusters.UpdateClusterRequest(), + {}, ], ) def test_update_cluster(request_type, transport: str = "grpc"): @@ -1728,7 +1745,7 @@ def test_update_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_cluster), "__call__") as call: @@ -1772,12 +1789,13 @@ def test_update_cluster_non_empty_request_with_auto_populated_field(): client.update_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == clusters.UpdateClusterRequest( + request_msg = clusters.UpdateClusterRequest( project_id="project_id_value", region="region_value", cluster_name="cluster_name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_update_cluster_use_cached_wrapped_rpc(): @@ -1868,9 +1886,14 @@ async def test_update_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_cluster_async( - transport: str = "grpc_asyncio", request_type=clusters.UpdateClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + clusters.UpdateClusterRequest(), + {}, + ], +) +async def test_update_cluster_async(request_type, transport: str = "grpc_asyncio"): client = ClusterControllerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1878,7 +1901,7 @@ async def test_update_cluster_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_cluster), "__call__") as call: @@ -1898,11 +1921,6 @@ async def test_update_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_cluster_async_from_dict(): - await test_update_cluster_async(request_type=dict) - - def test_update_cluster_field_headers(): client = ClusterControllerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2093,8 +2111,8 @@ async def test_update_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - clusters.StopClusterRequest, - dict, + clusters.StopClusterRequest(), + {}, ], ) def test_stop_cluster(request_type, transport: str = "grpc"): @@ -2105,7 +2123,7 @@ def test_stop_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.stop_cluster), "__call__") as call: @@ -2150,13 +2168,14 @@ def test_stop_cluster_non_empty_request_with_auto_populated_field(): client.stop_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == clusters.StopClusterRequest( + request_msg = clusters.StopClusterRequest( project_id="project_id_value", region="region_value", cluster_name="cluster_name_value", cluster_uuid="cluster_uuid_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_stop_cluster_use_cached_wrapped_rpc(): @@ -2247,9 +2266,14 @@ async def test_stop_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_stop_cluster_async( - transport: str = "grpc_asyncio", request_type=clusters.StopClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + clusters.StopClusterRequest(), + {}, + ], +) +async def test_stop_cluster_async(request_type, transport: str = "grpc_asyncio"): client = ClusterControllerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2257,7 +2281,7 @@ async def test_stop_cluster_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.stop_cluster), "__call__") as call: @@ -2277,11 +2301,6 @@ async def test_stop_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_stop_cluster_async_from_dict(): - await test_stop_cluster_async(request_type=dict) - - def test_stop_cluster_field_headers(): client = ClusterControllerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2350,8 +2369,8 @@ async def test_stop_cluster_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - clusters.StartClusterRequest, - dict, + clusters.StartClusterRequest(), + {}, ], ) def test_start_cluster(request_type, transport: str = "grpc"): @@ -2362,7 +2381,7 @@ def test_start_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.start_cluster), "__call__") as call: @@ -2407,13 +2426,14 @@ def test_start_cluster_non_empty_request_with_auto_populated_field(): client.start_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == clusters.StartClusterRequest( + request_msg = clusters.StartClusterRequest( project_id="project_id_value", region="region_value", cluster_name="cluster_name_value", cluster_uuid="cluster_uuid_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_start_cluster_use_cached_wrapped_rpc(): @@ -2504,9 +2524,14 @@ async def test_start_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_start_cluster_async( - transport: str = "grpc_asyncio", request_type=clusters.StartClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + clusters.StartClusterRequest(), + {}, + ], +) +async def test_start_cluster_async(request_type, transport: str = "grpc_asyncio"): client = ClusterControllerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2514,7 +2539,7 @@ async def test_start_cluster_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.start_cluster), "__call__") as call: @@ -2534,11 +2559,6 @@ async def test_start_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_start_cluster_async_from_dict(): - await test_start_cluster_async(request_type=dict) - - def test_start_cluster_field_headers(): client = ClusterControllerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2607,8 +2627,8 @@ async def test_start_cluster_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - clusters.DeleteClusterRequest, - dict, + clusters.DeleteClusterRequest(), + {}, ], ) def test_delete_cluster(request_type, transport: str = "grpc"): @@ -2619,7 +2639,7 @@ def test_delete_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_cluster), "__call__") as call: @@ -2664,13 +2684,14 @@ def test_delete_cluster_non_empty_request_with_auto_populated_field(): client.delete_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == clusters.DeleteClusterRequest( + request_msg = clusters.DeleteClusterRequest( project_id="project_id_value", region="region_value", cluster_name="cluster_name_value", cluster_uuid="cluster_uuid_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_cluster_use_cached_wrapped_rpc(): @@ -2761,9 +2782,14 @@ async def test_delete_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_cluster_async( - transport: str = "grpc_asyncio", request_type=clusters.DeleteClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + clusters.DeleteClusterRequest(), + {}, + ], +) +async def test_delete_cluster_async(request_type, transport: str = "grpc_asyncio"): client = ClusterControllerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2771,7 +2797,7 @@ async def test_delete_cluster_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_cluster), "__call__") as call: @@ -2791,11 +2817,6 @@ async def test_delete_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_cluster_async_from_dict(): - await test_delete_cluster_async(request_type=dict) - - def test_delete_cluster_field_headers(): client = ClusterControllerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2966,8 +2987,8 @@ async def test_delete_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - clusters.GetClusterRequest, - dict, + clusters.GetClusterRequest(), + {}, ], ) def test_get_cluster(request_type, transport: str = "grpc"): @@ -2978,7 +2999,7 @@ def test_get_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_cluster), "__call__") as call: @@ -3028,11 +3049,12 @@ def test_get_cluster_non_empty_request_with_auto_populated_field(): client.get_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == clusters.GetClusterRequest( + request_msg = clusters.GetClusterRequest( project_id="project_id_value", region="region_value", cluster_name="cluster_name_value", ) + assert args[0] == request_msg def test_get_cluster_use_cached_wrapped_rpc(): @@ -3113,9 +3135,14 @@ async def test_get_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_cluster_async( - transport: str = "grpc_asyncio", request_type=clusters.GetClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + clusters.GetClusterRequest(), + {}, + ], +) +async def test_get_cluster_async(request_type, transport: str = "grpc_asyncio"): client = ClusterControllerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3123,7 +3150,7 @@ async def test_get_cluster_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_cluster), "__call__") as call: @@ -3150,11 +3177,6 @@ async def test_get_cluster_async( assert response.cluster_uuid == "cluster_uuid_value" -@pytest.mark.asyncio -async def test_get_cluster_async_from_dict(): - await test_get_cluster_async(request_type=dict) - - def test_get_cluster_field_headers(): client = ClusterControllerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3321,8 +3343,8 @@ async def test_get_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - clusters.ListClustersRequest, - dict, + clusters.ListClustersRequest(), + {}, ], ) def test_list_clusters(request_type, transport: str = "grpc"): @@ -3333,7 +3355,7 @@ def test_list_clusters(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_clusters), "__call__") as call: @@ -3380,12 +3402,13 @@ def test_list_clusters_non_empty_request_with_auto_populated_field(): client.list_clusters(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == clusters.ListClustersRequest( + request_msg = clusters.ListClustersRequest( project_id="project_id_value", region="region_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_clusters_use_cached_wrapped_rpc(): @@ -3466,9 +3489,14 @@ async def test_list_clusters_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_clusters_async( - transport: str = "grpc_asyncio", request_type=clusters.ListClustersRequest -): +@pytest.mark.parametrize( + "request_type", + [ + clusters.ListClustersRequest(), + {}, + ], +) +async def test_list_clusters_async(request_type, transport: str = "grpc_asyncio"): client = ClusterControllerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3476,7 +3504,7 @@ async def test_list_clusters_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_clusters), "__call__") as call: @@ -3499,11 +3527,6 @@ async def test_list_clusters_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_clusters_async_from_dict(): - await test_list_clusters_async(request_type=dict) - - def test_list_clusters_field_headers(): client = ClusterControllerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3867,8 +3890,8 @@ async def test_list_clusters_async_pages(): @pytest.mark.parametrize( "request_type", [ - clusters.DiagnoseClusterRequest, - dict, + clusters.DiagnoseClusterRequest(), + {}, ], ) def test_diagnose_cluster(request_type, transport: str = "grpc"): @@ -3879,7 +3902,7 @@ def test_diagnose_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.diagnose_cluster), "__call__") as call: @@ -3923,12 +3946,13 @@ def test_diagnose_cluster_non_empty_request_with_auto_populated_field(): client.diagnose_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == clusters.DiagnoseClusterRequest( + request_msg = clusters.DiagnoseClusterRequest( project_id="project_id_value", region="region_value", cluster_name="cluster_name_value", tarball_gcs_dir="tarball_gcs_dir_value", ) + assert args[0] == request_msg def test_diagnose_cluster_use_cached_wrapped_rpc(): @@ -4021,9 +4045,14 @@ async def test_diagnose_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_diagnose_cluster_async( - transport: str = "grpc_asyncio", request_type=clusters.DiagnoseClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + clusters.DiagnoseClusterRequest(), + {}, + ], +) +async def test_diagnose_cluster_async(request_type, transport: str = "grpc_asyncio"): client = ClusterControllerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4031,7 +4060,7 @@ async def test_diagnose_cluster_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.diagnose_cluster), "__call__") as call: @@ -4051,11 +4080,6 @@ async def test_diagnose_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_diagnose_cluster_async_from_dict(): - await test_diagnose_cluster_async(request_type=dict) - - def test_diagnose_cluster_field_headers(): client = ClusterControllerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5937,7 +5961,6 @@ def test_create_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clusters.CreateClusterRequest() - assert args[0] == request_msg @@ -5958,7 +5981,6 @@ def test_update_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clusters.UpdateClusterRequest() - assert args[0] == request_msg @@ -5979,7 +6001,6 @@ def test_stop_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clusters.StopClusterRequest() - assert args[0] == request_msg @@ -6000,7 +6021,6 @@ def test_start_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clusters.StartClusterRequest() - assert args[0] == request_msg @@ -6021,7 +6041,6 @@ def test_delete_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clusters.DeleteClusterRequest() - assert args[0] == request_msg @@ -6042,7 +6061,6 @@ def test_get_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clusters.GetClusterRequest() - assert args[0] == request_msg @@ -6063,7 +6081,6 @@ def test_list_clusters_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clusters.ListClustersRequest() - assert args[0] == request_msg @@ -6084,7 +6101,6 @@ def test_diagnose_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clusters.DiagnoseClusterRequest() - assert args[0] == request_msg @@ -6123,7 +6139,6 @@ async def test_create_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clusters.CreateClusterRequest() - assert args[0] == request_msg @@ -6148,7 +6163,6 @@ async def test_update_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clusters.UpdateClusterRequest() - assert args[0] == request_msg @@ -6173,7 +6187,6 @@ async def test_stop_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clusters.StopClusterRequest() - assert args[0] == request_msg @@ -6198,7 +6211,6 @@ async def test_start_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clusters.StartClusterRequest() - assert args[0] == request_msg @@ -6223,7 +6235,6 @@ async def test_delete_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clusters.DeleteClusterRequest() - assert args[0] == request_msg @@ -6252,7 +6263,6 @@ async def test_get_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clusters.GetClusterRequest() - assert args[0] == request_msg @@ -6279,7 +6289,6 @@ async def test_list_clusters_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clusters.ListClustersRequest() - assert args[0] == request_msg @@ -6304,7 +6313,6 @@ async def test_diagnose_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clusters.DiagnoseClusterRequest() - assert args[0] == request_msg @@ -8403,7 +8411,6 @@ def test_create_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clusters.CreateClusterRequest() - assert args[0] == request_msg @@ -8423,7 +8430,6 @@ def test_update_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clusters.UpdateClusterRequest() - assert args[0] == request_msg @@ -8443,7 +8449,6 @@ def test_stop_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clusters.StopClusterRequest() - assert args[0] == request_msg @@ -8463,7 +8468,6 @@ def test_start_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clusters.StartClusterRequest() - assert args[0] == request_msg @@ -8483,7 +8487,6 @@ def test_delete_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clusters.DeleteClusterRequest() - assert args[0] == request_msg @@ -8503,7 +8506,6 @@ def test_get_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clusters.GetClusterRequest() - assert args[0] == request_msg @@ -8523,7 +8525,6 @@ def test_list_clusters_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clusters.ListClustersRequest() - assert args[0] == request_msg @@ -8543,7 +8544,6 @@ def test_diagnose_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clusters.DiagnoseClusterRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dataproc/tests/unit/gapic/dataproc_v1/test_job_controller.py b/packages/google-cloud-dataproc/tests/unit/gapic/dataproc_v1/test_job_controller.py index ac04556d38eb..b799a1db0efe 100644 --- a/packages/google-cloud-dataproc/tests/unit/gapic/dataproc_v1/test_job_controller.py +++ b/packages/google-cloud-dataproc/tests/unit/gapic/dataproc_v1/test_job_controller.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 @@ -119,6 +120,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" @@ -1318,8 +1334,8 @@ def test_job_controller_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - jobs.SubmitJobRequest, - dict, + jobs.SubmitJobRequest(), + {}, ], ) def test_submit_job(request_type, transport: str = "grpc"): @@ -1330,7 +1346,7 @@ def test_submit_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(type(client.transport.submit_job), "__call__") as call: @@ -1382,11 +1398,12 @@ def test_submit_job_non_empty_request_with_auto_populated_field(): client.submit_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == jobs.SubmitJobRequest( + request_msg = jobs.SubmitJobRequest( project_id="project_id_value", region="region_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_submit_job_use_cached_wrapped_rpc(): @@ -1465,9 +1482,14 @@ async def test_submit_job_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_submit_job_async( - transport: str = "grpc_asyncio", request_type=jobs.SubmitJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + jobs.SubmitJobRequest(), + {}, + ], +) +async def test_submit_job_async(request_type, transport: str = "grpc_asyncio"): client = JobControllerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1475,7 +1497,7 @@ async def test_submit_job_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.submit_job), "__call__") as call: @@ -1504,11 +1526,6 @@ async def test_submit_job_async( assert response.done is True -@pytest.mark.asyncio -async def test_submit_job_async_from_dict(): - await test_submit_job_async(request_type=dict) - - def test_submit_job_field_headers(): client = JobControllerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1673,8 +1690,8 @@ async def test_submit_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - jobs.SubmitJobRequest, - dict, + jobs.SubmitJobRequest(), + {}, ], ) def test_submit_job_as_operation(request_type, transport: str = "grpc"): @@ -1685,7 +1702,7 @@ def test_submit_job_as_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( @@ -1732,11 +1749,12 @@ def test_submit_job_as_operation_non_empty_request_with_auto_populated_field(): client.submit_job_as_operation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == jobs.SubmitJobRequest( + request_msg = jobs.SubmitJobRequest( project_id="project_id_value", region="region_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_submit_job_as_operation_use_cached_wrapped_rpc(): @@ -1832,8 +1850,15 @@ async def test_submit_job_as_operation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + jobs.SubmitJobRequest(), + {}, + ], +) async def test_submit_job_as_operation_async( - transport: str = "grpc_asyncio", request_type=jobs.SubmitJobRequest + request_type, transport: str = "grpc_asyncio" ): client = JobControllerAsyncClient( credentials=async_anonymous_credentials(), @@ -1842,7 +1867,7 @@ async def test_submit_job_as_operation_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( @@ -1864,11 +1889,6 @@ async def test_submit_job_as_operation_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_submit_job_as_operation_async_from_dict(): - await test_submit_job_as_operation_async(request_type=dict) - - def test_submit_job_as_operation_field_headers(): client = JobControllerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2045,8 +2065,8 @@ async def test_submit_job_as_operation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - jobs.GetJobRequest, - dict, + jobs.GetJobRequest(), + {}, ], ) def test_get_job(request_type, transport: str = "grpc"): @@ -2057,7 +2077,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(type(client.transport.get_job), "__call__") as call: @@ -2109,11 +2129,12 @@ 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] == jobs.GetJobRequest( + request_msg = jobs.GetJobRequest( project_id="project_id_value", region="region_value", job_id="job_id_value", ) + assert args[0] == request_msg def test_get_job_use_cached_wrapped_rpc(): @@ -2192,9 +2213,14 @@ async def test_get_job_async_use_cached_wrapped_rpc(transport: str = "grpc_async @pytest.mark.asyncio -async def test_get_job_async( - transport: str = "grpc_asyncio", request_type=jobs.GetJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + jobs.GetJobRequest(), + {}, + ], +) +async def test_get_job_async(request_type, transport: str = "grpc_asyncio"): client = JobControllerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2202,7 +2228,7 @@ async def test_get_job_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_job), "__call__") as call: @@ -2231,11 +2257,6 @@ async def test_get_job_async( assert response.done 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 = JobControllerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2402,8 +2423,8 @@ async def test_get_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - jobs.ListJobsRequest, - dict, + jobs.ListJobsRequest(), + {}, ], ) def test_list_jobs(request_type, transport: str = "grpc"): @@ -2414,7 +2435,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(type(client.transport.list_jobs), "__call__") as call: @@ -2464,13 +2485,14 @@ 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] == jobs.ListJobsRequest( + request_msg = jobs.ListJobsRequest( project_id="project_id_value", region="region_value", page_token="page_token_value", cluster_name="cluster_name_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_jobs_use_cached_wrapped_rpc(): @@ -2549,9 +2571,14 @@ async def test_list_jobs_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_list_jobs_async( - transport: str = "grpc_asyncio", request_type=jobs.ListJobsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + jobs.ListJobsRequest(), + {}, + ], +) +async def test_list_jobs_async(request_type, transport: str = "grpc_asyncio"): client = JobControllerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2559,7 +2586,7 @@ async def test_list_jobs_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_jobs), "__call__") as call: @@ -2584,11 +2611,6 @@ async def test_list_jobs_async( 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 = JobControllerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2952,8 +2974,8 @@ async def test_list_jobs_async_pages(): @pytest.mark.parametrize( "request_type", [ - jobs.UpdateJobRequest, - dict, + jobs.UpdateJobRequest(), + {}, ], ) def test_update_job(request_type, transport: str = "grpc"): @@ -2964,7 +2986,7 @@ def test_update_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(type(client.transport.update_job), "__call__") as call: @@ -3016,11 +3038,12 @@ def test_update_job_non_empty_request_with_auto_populated_field(): client.update_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == jobs.UpdateJobRequest( + request_msg = jobs.UpdateJobRequest( project_id="project_id_value", region="region_value", job_id="job_id_value", ) + assert args[0] == request_msg def test_update_job_use_cached_wrapped_rpc(): @@ -3099,9 +3122,14 @@ async def test_update_job_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_update_job_async( - transport: str = "grpc_asyncio", request_type=jobs.UpdateJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + jobs.UpdateJobRequest(), + {}, + ], +) +async def test_update_job_async(request_type, transport: str = "grpc_asyncio"): client = JobControllerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3109,7 +3137,7 @@ async def test_update_job_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_job), "__call__") as call: @@ -3138,11 +3166,6 @@ async def test_update_job_async( assert response.done is True -@pytest.mark.asyncio -async def test_update_job_async_from_dict(): - await test_update_job_async(request_type=dict) - - def test_update_job_field_headers(): client = JobControllerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3209,8 +3232,8 @@ async def test_update_job_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - jobs.CancelJobRequest, - dict, + jobs.CancelJobRequest(), + {}, ], ) def test_cancel_job(request_type, transport: str = "grpc"): @@ -3221,7 +3244,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() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.cancel_job), "__call__") as call: @@ -3273,11 +3296,12 @@ def test_cancel_job_non_empty_request_with_auto_populated_field(): client.cancel_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == jobs.CancelJobRequest( + request_msg = jobs.CancelJobRequest( project_id="project_id_value", region="region_value", job_id="job_id_value", ) + assert args[0] == request_msg def test_cancel_job_use_cached_wrapped_rpc(): @@ -3356,9 +3380,14 @@ async def test_cancel_job_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_cancel_job_async( - transport: str = "grpc_asyncio", request_type=jobs.CancelJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + jobs.CancelJobRequest(), + {}, + ], +) +async def test_cancel_job_async(request_type, transport: str = "grpc_asyncio"): client = JobControllerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3366,7 +3395,7 @@ async def test_cancel_job_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.cancel_job), "__call__") as call: @@ -3395,11 +3424,6 @@ async def test_cancel_job_async( assert response.done is True -@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 = JobControllerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3566,8 +3590,8 @@ async def test_cancel_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - jobs.DeleteJobRequest, - dict, + jobs.DeleteJobRequest(), + {}, ], ) def test_delete_job(request_type, transport: str = "grpc"): @@ -3578,7 +3602,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() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_job), "__call__") as call: @@ -3621,11 +3645,12 @@ def test_delete_job_non_empty_request_with_auto_populated_field(): client.delete_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == jobs.DeleteJobRequest( + request_msg = jobs.DeleteJobRequest( project_id="project_id_value", region="region_value", job_id="job_id_value", ) + assert args[0] == request_msg def test_delete_job_use_cached_wrapped_rpc(): @@ -3704,9 +3729,14 @@ async def test_delete_job_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_delete_job_async( - transport: str = "grpc_asyncio", request_type=jobs.DeleteJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + jobs.DeleteJobRequest(), + {}, + ], +) +async def test_delete_job_async(request_type, transport: str = "grpc_asyncio"): client = JobControllerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3714,7 +3744,7 @@ async def test_delete_job_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_job), "__call__") as call: @@ -3732,11 +3762,6 @@ async def test_delete_job_async( 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 = JobControllerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5427,7 +5452,6 @@ def test_submit_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = jobs.SubmitJobRequest() - assert args[0] == request_msg @@ -5450,7 +5474,6 @@ def test_submit_job_as_operation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = jobs.SubmitJobRequest() - assert args[0] == request_msg @@ -5471,7 +5494,6 @@ def test_get_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = jobs.GetJobRequest() - assert args[0] == request_msg @@ -5492,7 +5514,6 @@ def test_list_jobs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = jobs.ListJobsRequest() - assert args[0] == request_msg @@ -5513,7 +5534,6 @@ def test_update_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = jobs.UpdateJobRequest() - assert args[0] == request_msg @@ -5534,7 +5554,6 @@ def test_cancel_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = jobs.CancelJobRequest() - assert args[0] == request_msg @@ -5555,7 +5574,6 @@ def test_delete_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = jobs.DeleteJobRequest() - assert args[0] == request_msg @@ -5599,7 +5617,6 @@ async def test_submit_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = jobs.SubmitJobRequest() - assert args[0] == request_msg @@ -5626,7 +5643,6 @@ async def test_submit_job_as_operation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = jobs.SubmitJobRequest() - assert args[0] == request_msg @@ -5656,7 +5672,6 @@ async def test_get_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = jobs.GetJobRequest() - assert args[0] == request_msg @@ -5684,7 +5699,6 @@ async def test_list_jobs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = jobs.ListJobsRequest() - assert args[0] == request_msg @@ -5714,7 +5728,6 @@ async def test_update_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = jobs.UpdateJobRequest() - assert args[0] == request_msg @@ -5744,7 +5757,6 @@ async def test_cancel_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = jobs.CancelJobRequest() - assert args[0] == request_msg @@ -5767,7 +5779,6 @@ async def test_delete_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = jobs.DeleteJobRequest() - assert args[0] == request_msg @@ -7313,7 +7324,6 @@ def test_submit_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = jobs.SubmitJobRequest() - assert args[0] == request_msg @@ -7335,7 +7345,6 @@ def test_submit_job_as_operation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = jobs.SubmitJobRequest() - assert args[0] == request_msg @@ -7355,7 +7364,6 @@ def test_get_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = jobs.GetJobRequest() - assert args[0] == request_msg @@ -7375,7 +7383,6 @@ def test_list_jobs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = jobs.ListJobsRequest() - assert args[0] == request_msg @@ -7395,7 +7402,6 @@ def test_update_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = jobs.UpdateJobRequest() - assert args[0] == request_msg @@ -7415,7 +7421,6 @@ def test_cancel_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = jobs.CancelJobRequest() - assert args[0] == request_msg @@ -7435,7 +7440,6 @@ def test_delete_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = jobs.DeleteJobRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dataproc/tests/unit/gapic/dataproc_v1/test_node_group_controller.py b/packages/google-cloud-dataproc/tests/unit/gapic/dataproc_v1/test_node_group_controller.py index 83fec655a696..1b2ebd91131f 100644 --- a/packages/google-cloud-dataproc/tests/unit/gapic/dataproc_v1/test_node_group_controller.py +++ b/packages/google-cloud-dataproc/tests/unit/gapic/dataproc_v1/test_node_group_controller.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 @@ -117,6 +118,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" @@ -1380,8 +1396,8 @@ def test_node_group_controller_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - node_groups.CreateNodeGroupRequest, - dict, + node_groups.CreateNodeGroupRequest(), + {}, ], ) def test_create_node_group(request_type, transport: str = "grpc"): @@ -1392,7 +1408,7 @@ def test_create_node_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1439,11 +1455,12 @@ def test_create_node_group_non_empty_request_with_auto_populated_field(): client.create_node_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == node_groups.CreateNodeGroupRequest( + request_msg = node_groups.CreateNodeGroupRequest( parent="parent_value", node_group_id="node_group_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_node_group_use_cached_wrapped_rpc(): @@ -1536,9 +1553,14 @@ async def test_create_node_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_node_group_async( - transport: str = "grpc_asyncio", request_type=node_groups.CreateNodeGroupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + node_groups.CreateNodeGroupRequest(), + {}, + ], +) +async def test_create_node_group_async(request_type, transport: str = "grpc_asyncio"): client = NodeGroupControllerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1546,7 +1568,7 @@ async def test_create_node_group_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( @@ -1568,11 +1590,6 @@ async def test_create_node_group_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_node_group_async_from_dict(): - await test_create_node_group_async(request_type=dict) - - def test_create_node_group_field_headers(): client = NodeGroupControllerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1747,8 +1764,8 @@ async def test_create_node_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - node_groups.ResizeNodeGroupRequest, - dict, + node_groups.ResizeNodeGroupRequest(), + {}, ], ) def test_resize_node_group(request_type, transport: str = "grpc"): @@ -1759,7 +1776,7 @@ def test_resize_node_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1805,10 +1822,11 @@ def test_resize_node_group_non_empty_request_with_auto_populated_field(): client.resize_node_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == node_groups.ResizeNodeGroupRequest( + request_msg = node_groups.ResizeNodeGroupRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_resize_node_group_use_cached_wrapped_rpc(): @@ -1901,9 +1919,14 @@ async def test_resize_node_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_resize_node_group_async( - transport: str = "grpc_asyncio", request_type=node_groups.ResizeNodeGroupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + node_groups.ResizeNodeGroupRequest(), + {}, + ], +) +async def test_resize_node_group_async(request_type, transport: str = "grpc_asyncio"): client = NodeGroupControllerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1911,7 +1934,7 @@ async def test_resize_node_group_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( @@ -1933,11 +1956,6 @@ async def test_resize_node_group_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_resize_node_group_async_from_dict(): - await test_resize_node_group_async(request_type=dict) - - def test_resize_node_group_field_headers(): client = NodeGroupControllerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2102,8 +2120,8 @@ async def test_resize_node_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - node_groups.GetNodeGroupRequest, - dict, + node_groups.GetNodeGroupRequest(), + {}, ], ) def test_get_node_group(request_type, transport: str = "grpc"): @@ -2114,7 +2132,7 @@ def test_get_node_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_node_group), "__call__") as call: @@ -2160,9 +2178,10 @@ def test_get_node_group_non_empty_request_with_auto_populated_field(): client.get_node_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == node_groups.GetNodeGroupRequest( + request_msg = node_groups.GetNodeGroupRequest( name="name_value", ) + assert args[0] == request_msg def test_get_node_group_use_cached_wrapped_rpc(): @@ -2243,9 +2262,14 @@ async def test_get_node_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_node_group_async( - transport: str = "grpc_asyncio", request_type=node_groups.GetNodeGroupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + node_groups.GetNodeGroupRequest(), + {}, + ], +) +async def test_get_node_group_async(request_type, transport: str = "grpc_asyncio"): client = NodeGroupControllerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2253,7 +2277,7 @@ async def test_get_node_group_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_node_group), "__call__") as call: @@ -2278,11 +2302,6 @@ async def test_get_node_group_async( assert response.roles == [clusters.NodeGroup.Role.DRIVER] -@pytest.mark.asyncio -async def test_get_node_group_async_from_dict(): - await test_get_node_group_async(request_type=dict) - - def test_get_node_group_field_headers(): client = NodeGroupControllerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3127,7 +3146,6 @@ def test_create_node_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = node_groups.CreateNodeGroupRequest() - assert args[0] == request_msg @@ -3150,7 +3168,6 @@ def test_resize_node_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = node_groups.ResizeNodeGroupRequest() - assert args[0] == request_msg @@ -3171,7 +3188,6 @@ def test_get_node_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = node_groups.GetNodeGroupRequest() - assert args[0] == request_msg @@ -3212,7 +3228,6 @@ async def test_create_node_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = node_groups.CreateNodeGroupRequest() - assert args[0] == request_msg @@ -3239,7 +3254,6 @@ async def test_resize_node_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = node_groups.ResizeNodeGroupRequest() - assert args[0] == request_msg @@ -3267,7 +3281,6 @@ async def test_get_node_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = node_groups.GetNodeGroupRequest() - assert args[0] == request_msg @@ -4263,7 +4276,6 @@ def test_create_node_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = node_groups.CreateNodeGroupRequest() - assert args[0] == request_msg @@ -4285,7 +4297,6 @@ def test_resize_node_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = node_groups.ResizeNodeGroupRequest() - assert args[0] == request_msg @@ -4305,7 +4316,6 @@ def test_get_node_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = node_groups.GetNodeGroupRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dataproc/tests/unit/gapic/dataproc_v1/test_session_controller.py b/packages/google-cloud-dataproc/tests/unit/gapic/dataproc_v1/test_session_controller.py index a14a69be4126..8d9c10cec56b 100644 --- a/packages/google-cloud-dataproc/tests/unit/gapic/dataproc_v1/test_session_controller.py +++ b/packages/google-cloud-dataproc/tests/unit/gapic/dataproc_v1/test_session_controller.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 @@ -119,6 +120,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" @@ -1364,8 +1380,8 @@ def test_session_controller_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - sessions.CreateSessionRequest, - dict, + sessions.CreateSessionRequest(), + {}, ], ) def test_create_session(request_type, transport: str = "grpc"): @@ -1376,7 +1392,7 @@ def test_create_session(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_session), "__call__") as call: @@ -1419,11 +1435,12 @@ def test_create_session_non_empty_request_with_auto_populated_field(): client.create_session(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == sessions.CreateSessionRequest( + request_msg = sessions.CreateSessionRequest( parent="parent_value", session_id="session_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_session_use_cached_wrapped_rpc(): @@ -1514,9 +1531,14 @@ async def test_create_session_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_session_async( - transport: str = "grpc_asyncio", request_type=sessions.CreateSessionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + sessions.CreateSessionRequest(), + {}, + ], +) +async def test_create_session_async(request_type, transport: str = "grpc_asyncio"): client = SessionControllerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1524,7 +1546,7 @@ async def test_create_session_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_session), "__call__") as call: @@ -1544,11 +1566,6 @@ async def test_create_session_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_session_async_from_dict(): - await test_create_session_async(request_type=dict) - - def test_create_session_field_headers(): client = SessionControllerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1715,8 +1732,8 @@ async def test_create_session_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - sessions.GetSessionRequest, - dict, + sessions.GetSessionRequest(), + {}, ], ) def test_get_session(request_type, transport: str = "grpc"): @@ -1727,7 +1744,7 @@ def test_get_session(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_session), "__call__") as call: @@ -1783,9 +1800,10 @@ def test_get_session_non_empty_request_with_auto_populated_field(): client.get_session(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == sessions.GetSessionRequest( + request_msg = sessions.GetSessionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_session_use_cached_wrapped_rpc(): @@ -1866,9 +1884,14 @@ async def test_get_session_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_session_async( - transport: str = "grpc_asyncio", request_type=sessions.GetSessionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + sessions.GetSessionRequest(), + {}, + ], +) +async def test_get_session_async(request_type, transport: str = "grpc_asyncio"): client = SessionControllerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1876,7 +1899,7 @@ async def test_get_session_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_session), "__call__") as call: @@ -1911,11 +1934,6 @@ async def test_get_session_async( assert response.session_template == "session_template_value" -@pytest.mark.asyncio -async def test_get_session_async_from_dict(): - await test_get_session_async(request_type=dict) - - def test_get_session_field_headers(): client = SessionControllerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2058,8 +2076,8 @@ async def test_get_session_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - sessions.ListSessionsRequest, - dict, + sessions.ListSessionsRequest(), + {}, ], ) def test_list_sessions(request_type, transport: str = "grpc"): @@ -2070,7 +2088,7 @@ def test_list_sessions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_sessions), "__call__") as call: @@ -2116,11 +2134,12 @@ def test_list_sessions_non_empty_request_with_auto_populated_field(): client.list_sessions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == sessions.ListSessionsRequest( + request_msg = sessions.ListSessionsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_sessions_use_cached_wrapped_rpc(): @@ -2201,9 +2220,14 @@ async def test_list_sessions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_sessions_async( - transport: str = "grpc_asyncio", request_type=sessions.ListSessionsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + sessions.ListSessionsRequest(), + {}, + ], +) +async def test_list_sessions_async(request_type, transport: str = "grpc_asyncio"): client = SessionControllerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2211,7 +2235,7 @@ async def test_list_sessions_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_sessions), "__call__") as call: @@ -2234,11 +2258,6 @@ async def test_list_sessions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_sessions_async_from_dict(): - await test_list_sessions_async(request_type=dict) - - def test_list_sessions_field_headers(): client = SessionControllerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2575,8 +2594,8 @@ async def test_list_sessions_async_pages(): @pytest.mark.parametrize( "request_type", [ - sessions.TerminateSessionRequest, - dict, + sessions.TerminateSessionRequest(), + {}, ], ) def test_terminate_session(request_type, transport: str = "grpc"): @@ -2587,7 +2606,7 @@ def test_terminate_session(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2633,10 +2652,11 @@ def test_terminate_session_non_empty_request_with_auto_populated_field(): client.terminate_session(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == sessions.TerminateSessionRequest( + request_msg = sessions.TerminateSessionRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_terminate_session_use_cached_wrapped_rpc(): @@ -2729,9 +2749,14 @@ async def test_terminate_session_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_terminate_session_async( - transport: str = "grpc_asyncio", request_type=sessions.TerminateSessionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + sessions.TerminateSessionRequest(), + {}, + ], +) +async def test_terminate_session_async(request_type, transport: str = "grpc_asyncio"): client = SessionControllerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2739,7 +2764,7 @@ async def test_terminate_session_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( @@ -2761,11 +2786,6 @@ async def test_terminate_session_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_terminate_session_async_from_dict(): - await test_terminate_session_async(request_type=dict) - - def test_terminate_session_field_headers(): client = SessionControllerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2920,8 +2940,8 @@ async def test_terminate_session_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - sessions.DeleteSessionRequest, - dict, + sessions.DeleteSessionRequest(), + {}, ], ) def test_delete_session(request_type, transport: str = "grpc"): @@ -2932,7 +2952,7 @@ def test_delete_session(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_session), "__call__") as call: @@ -2974,10 +2994,11 @@ def test_delete_session_non_empty_request_with_auto_populated_field(): client.delete_session(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == sessions.DeleteSessionRequest( + request_msg = sessions.DeleteSessionRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_session_use_cached_wrapped_rpc(): @@ -3068,9 +3089,14 @@ async def test_delete_session_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_session_async( - transport: str = "grpc_asyncio", request_type=sessions.DeleteSessionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + sessions.DeleteSessionRequest(), + {}, + ], +) +async def test_delete_session_async(request_type, transport: str = "grpc_asyncio"): client = SessionControllerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3078,7 +3104,7 @@ async def test_delete_session_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_session), "__call__") as call: @@ -3098,11 +3124,6 @@ async def test_delete_session_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_session_async_from_dict(): - await test_delete_session_async(request_type=dict) - - def test_delete_session_field_headers(): client = SessionControllerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4370,7 +4391,6 @@ def test_create_session_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sessions.CreateSessionRequest() - assert args[0] == request_msg @@ -4391,7 +4411,6 @@ def test_get_session_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sessions.GetSessionRequest() - assert args[0] == request_msg @@ -4412,7 +4431,6 @@ def test_list_sessions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sessions.ListSessionsRequest() - assert args[0] == request_msg @@ -4435,7 +4453,6 @@ def test_terminate_session_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sessions.TerminateSessionRequest() - assert args[0] == request_msg @@ -4456,7 +4473,6 @@ def test_delete_session_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sessions.DeleteSessionRequest() - assert args[0] == request_msg @@ -4495,7 +4511,6 @@ async def test_create_session_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sessions.CreateSessionRequest() - assert args[0] == request_msg @@ -4528,7 +4543,6 @@ async def test_get_session_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sessions.GetSessionRequest() - assert args[0] == request_msg @@ -4555,7 +4569,6 @@ async def test_list_sessions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sessions.ListSessionsRequest() - assert args[0] == request_msg @@ -4582,7 +4595,6 @@ async def test_terminate_session_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sessions.TerminateSessionRequest() - assert args[0] == request_msg @@ -4607,7 +4619,6 @@ async def test_delete_session_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sessions.DeleteSessionRequest() - assert args[0] == request_msg @@ -5855,7 +5866,6 @@ def test_create_session_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sessions.CreateSessionRequest() - assert args[0] == request_msg @@ -5875,7 +5885,6 @@ def test_get_session_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sessions.GetSessionRequest() - assert args[0] == request_msg @@ -5895,7 +5904,6 @@ def test_list_sessions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sessions.ListSessionsRequest() - assert args[0] == request_msg @@ -5917,7 +5925,6 @@ def test_terminate_session_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sessions.TerminateSessionRequest() - assert args[0] == request_msg @@ -5937,7 +5944,6 @@ def test_delete_session_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sessions.DeleteSessionRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dataproc/tests/unit/gapic/dataproc_v1/test_session_template_controller.py b/packages/google-cloud-dataproc/tests/unit/gapic/dataproc_v1/test_session_template_controller.py index bd3024cbc50a..1e395ff35ba9 100644 --- a/packages/google-cloud-dataproc/tests/unit/gapic/dataproc_v1/test_session_template_controller.py +++ b/packages/google-cloud-dataproc/tests/unit/gapic/dataproc_v1/test_session_template_controller.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 @@ -115,6 +116,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" @@ -1401,8 +1417,8 @@ def test_session_template_controller_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - session_templates.CreateSessionTemplateRequest, - dict, + session_templates.CreateSessionTemplateRequest(), + {}, ], ) def test_create_session_template(request_type, transport: str = "grpc"): @@ -1413,7 +1429,7 @@ def test_create_session_template(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1467,9 +1483,10 @@ def test_create_session_template_non_empty_request_with_auto_populated_field(): client.create_session_template(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == session_templates.CreateSessionTemplateRequest( + request_msg = session_templates.CreateSessionTemplateRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_session_template_use_cached_wrapped_rpc(): @@ -1555,9 +1572,15 @@ async def test_create_session_template_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + session_templates.CreateSessionTemplateRequest(), + {}, + ], +) async def test_create_session_template_async( - transport: str = "grpc_asyncio", - request_type=session_templates.CreateSessionTemplateRequest, + request_type, transport: str = "grpc_asyncio" ): client = SessionTemplateControllerAsyncClient( credentials=async_anonymous_credentials(), @@ -1566,7 +1589,7 @@ async def test_create_session_template_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( @@ -1597,11 +1620,6 @@ async def test_create_session_template_async( assert response.uuid == "uuid_value" -@pytest.mark.asyncio -async def test_create_session_template_async_from_dict(): - await test_create_session_template_async(request_type=dict) - - def test_create_session_template_field_headers(): client = SessionTemplateControllerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1766,8 +1784,8 @@ async def test_create_session_template_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - session_templates.UpdateSessionTemplateRequest, - dict, + session_templates.UpdateSessionTemplateRequest(), + {}, ], ) def test_update_session_template(request_type, transport: str = "grpc"): @@ -1778,7 +1796,7 @@ def test_update_session_template(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1830,7 +1848,8 @@ def test_update_session_template_non_empty_request_with_auto_populated_field(): client.update_session_template(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == session_templates.UpdateSessionTemplateRequest() + request_msg = session_templates.UpdateSessionTemplateRequest() + assert args[0] == request_msg def test_update_session_template_use_cached_wrapped_rpc(): @@ -1916,9 +1935,15 @@ async def test_update_session_template_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + session_templates.UpdateSessionTemplateRequest(), + {}, + ], +) async def test_update_session_template_async( - transport: str = "grpc_asyncio", - request_type=session_templates.UpdateSessionTemplateRequest, + request_type, transport: str = "grpc_asyncio" ): client = SessionTemplateControllerAsyncClient( credentials=async_anonymous_credentials(), @@ -1927,7 +1952,7 @@ async def test_update_session_template_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( @@ -1958,11 +1983,6 @@ async def test_update_session_template_async( assert response.uuid == "uuid_value" -@pytest.mark.asyncio -async def test_update_session_template_async_from_dict(): - await test_update_session_template_async(request_type=dict) - - def test_update_session_template_field_headers(): client = SessionTemplateControllerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2117,8 +2137,8 @@ async def test_update_session_template_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - session_templates.GetSessionTemplateRequest, - dict, + session_templates.GetSessionTemplateRequest(), + {}, ], ) def test_get_session_template(request_type, transport: str = "grpc"): @@ -2129,7 +2149,7 @@ def test_get_session_template(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2183,9 +2203,10 @@ def test_get_session_template_non_empty_request_with_auto_populated_field(): client.get_session_template(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == session_templates.GetSessionTemplateRequest( + request_msg = session_templates.GetSessionTemplateRequest( name="name_value", ) + assert args[0] == request_msg def test_get_session_template_use_cached_wrapped_rpc(): @@ -2270,9 +2291,15 @@ async def test_get_session_template_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + session_templates.GetSessionTemplateRequest(), + {}, + ], +) async def test_get_session_template_async( - transport: str = "grpc_asyncio", - request_type=session_templates.GetSessionTemplateRequest, + request_type, transport: str = "grpc_asyncio" ): client = SessionTemplateControllerAsyncClient( credentials=async_anonymous_credentials(), @@ -2281,7 +2308,7 @@ async def test_get_session_template_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( @@ -2312,11 +2339,6 @@ async def test_get_session_template_async( assert response.uuid == "uuid_value" -@pytest.mark.asyncio -async def test_get_session_template_async_from_dict(): - await test_get_session_template_async(request_type=dict) - - def test_get_session_template_field_headers(): client = SessionTemplateControllerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2471,8 +2493,8 @@ async def test_get_session_template_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - session_templates.ListSessionTemplatesRequest, - dict, + session_templates.ListSessionTemplatesRequest(), + {}, ], ) def test_list_session_templates(request_type, transport: str = "grpc"): @@ -2483,7 +2505,7 @@ def test_list_session_templates(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2533,11 +2555,12 @@ def test_list_session_templates_non_empty_request_with_auto_populated_field(): client.list_session_templates(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == session_templates.ListSessionTemplatesRequest( + request_msg = session_templates.ListSessionTemplatesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_session_templates_use_cached_wrapped_rpc(): @@ -2623,9 +2646,15 @@ async def test_list_session_templates_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + session_templates.ListSessionTemplatesRequest(), + {}, + ], +) async def test_list_session_templates_async( - transport: str = "grpc_asyncio", - request_type=session_templates.ListSessionTemplatesRequest, + request_type, transport: str = "grpc_asyncio" ): client = SessionTemplateControllerAsyncClient( credentials=async_anonymous_credentials(), @@ -2634,7 +2663,7 @@ async def test_list_session_templates_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( @@ -2659,11 +2688,6 @@ async def test_list_session_templates_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_session_templates_async_from_dict(): - await test_list_session_templates_async(request_type=dict) - - def test_list_session_templates_field_headers(): client = SessionTemplateControllerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3016,8 +3040,8 @@ async def test_list_session_templates_async_pages(): @pytest.mark.parametrize( "request_type", [ - session_templates.DeleteSessionTemplateRequest, - dict, + session_templates.DeleteSessionTemplateRequest(), + {}, ], ) def test_delete_session_template(request_type, transport: str = "grpc"): @@ -3028,7 +3052,7 @@ def test_delete_session_template(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3073,9 +3097,10 @@ def test_delete_session_template_non_empty_request_with_auto_populated_field(): client.delete_session_template(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == session_templates.DeleteSessionTemplateRequest( + request_msg = session_templates.DeleteSessionTemplateRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_session_template_use_cached_wrapped_rpc(): @@ -3161,9 +3186,15 @@ async def test_delete_session_template_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + session_templates.DeleteSessionTemplateRequest(), + {}, + ], +) async def test_delete_session_template_async( - transport: str = "grpc_asyncio", - request_type=session_templates.DeleteSessionTemplateRequest, + request_type, transport: str = "grpc_asyncio" ): client = SessionTemplateControllerAsyncClient( credentials=async_anonymous_credentials(), @@ -3172,7 +3203,7 @@ async def test_delete_session_template_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( @@ -3192,11 +3223,6 @@ async def test_delete_session_template_async( assert response is None -@pytest.mark.asyncio -async def test_delete_session_template_async_from_dict(): - await test_delete_session_template_async(request_type=dict) - - def test_delete_session_template_field_headers(): client = SessionTemplateControllerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4475,7 +4501,6 @@ def test_create_session_template_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session_templates.CreateSessionTemplateRequest() - assert args[0] == request_msg @@ -4498,7 +4523,6 @@ def test_update_session_template_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session_templates.UpdateSessionTemplateRequest() - assert args[0] == request_msg @@ -4521,7 +4545,6 @@ def test_get_session_template_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session_templates.GetSessionTemplateRequest() - assert args[0] == request_msg @@ -4544,7 +4567,6 @@ def test_list_session_templates_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session_templates.ListSessionTemplatesRequest() - assert args[0] == request_msg @@ -4567,7 +4589,6 @@ def test_delete_session_template_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session_templates.DeleteSessionTemplateRequest() - assert args[0] == request_msg @@ -4613,7 +4634,6 @@ async def test_create_session_template_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session_templates.CreateSessionTemplateRequest() - assert args[0] == request_msg @@ -4645,7 +4665,6 @@ async def test_update_session_template_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session_templates.UpdateSessionTemplateRequest() - assert args[0] == request_msg @@ -4677,7 +4696,6 @@ async def test_get_session_template_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session_templates.GetSessionTemplateRequest() - assert args[0] == request_msg @@ -4706,7 +4724,6 @@ async def test_list_session_templates_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session_templates.ListSessionTemplatesRequest() - assert args[0] == request_msg @@ -4731,7 +4748,6 @@ async def test_delete_session_template_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session_templates.DeleteSessionTemplateRequest() - assert args[0] == request_msg @@ -6116,7 +6132,6 @@ def test_create_session_template_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session_templates.CreateSessionTemplateRequest() - assert args[0] == request_msg @@ -6138,7 +6153,6 @@ def test_update_session_template_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session_templates.UpdateSessionTemplateRequest() - assert args[0] == request_msg @@ -6160,7 +6174,6 @@ def test_get_session_template_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session_templates.GetSessionTemplateRequest() - assert args[0] == request_msg @@ -6182,7 +6195,6 @@ def test_list_session_templates_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session_templates.ListSessionTemplatesRequest() - assert args[0] == request_msg @@ -6204,7 +6216,6 @@ def test_delete_session_template_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session_templates.DeleteSessionTemplateRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dataproc/tests/unit/gapic/dataproc_v1/test_workflow_template_service.py b/packages/google-cloud-dataproc/tests/unit/gapic/dataproc_v1/test_workflow_template_service.py index 81085ad13557..11a8cfd67cd7 100644 --- a/packages/google-cloud-dataproc/tests/unit/gapic/dataproc_v1/test_workflow_template_service.py +++ b/packages/google-cloud-dataproc/tests/unit/gapic/dataproc_v1/test_workflow_template_service.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 @@ -120,6 +121,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" @@ -1389,8 +1405,8 @@ def test_workflow_template_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - workflow_templates.CreateWorkflowTemplateRequest, - dict, + workflow_templates.CreateWorkflowTemplateRequest(), + {}, ], ) def test_create_workflow_template(request_type, transport: str = "grpc"): @@ -1401,7 +1417,7 @@ def test_create_workflow_template(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1453,9 +1469,10 @@ def test_create_workflow_template_non_empty_request_with_auto_populated_field(): client.create_workflow_template(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == workflow_templates.CreateWorkflowTemplateRequest( + request_msg = workflow_templates.CreateWorkflowTemplateRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_workflow_template_use_cached_wrapped_rpc(): @@ -1541,9 +1558,15 @@ async def test_create_workflow_template_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + workflow_templates.CreateWorkflowTemplateRequest(), + {}, + ], +) async def test_create_workflow_template_async( - transport: str = "grpc_asyncio", - request_type=workflow_templates.CreateWorkflowTemplateRequest, + request_type, transport: str = "grpc_asyncio" ): client = WorkflowTemplateServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1552,7 +1575,7 @@ async def test_create_workflow_template_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( @@ -1581,11 +1604,6 @@ async def test_create_workflow_template_async( assert response.version == 774 -@pytest.mark.asyncio -async def test_create_workflow_template_async_from_dict(): - await test_create_workflow_template_async(request_type=dict) - - def test_create_workflow_template_field_headers(): client = WorkflowTemplateServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1750,8 +1768,8 @@ async def test_create_workflow_template_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - workflow_templates.GetWorkflowTemplateRequest, - dict, + workflow_templates.GetWorkflowTemplateRequest(), + {}, ], ) def test_get_workflow_template(request_type, transport: str = "grpc"): @@ -1762,7 +1780,7 @@ def test_get_workflow_template(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1814,9 +1832,10 @@ def test_get_workflow_template_non_empty_request_with_auto_populated_field(): client.get_workflow_template(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == workflow_templates.GetWorkflowTemplateRequest( + request_msg = workflow_templates.GetWorkflowTemplateRequest( name="name_value", ) + assert args[0] == request_msg def test_get_workflow_template_use_cached_wrapped_rpc(): @@ -1902,9 +1921,15 @@ async def test_get_workflow_template_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + workflow_templates.GetWorkflowTemplateRequest(), + {}, + ], +) async def test_get_workflow_template_async( - transport: str = "grpc_asyncio", - request_type=workflow_templates.GetWorkflowTemplateRequest, + request_type, transport: str = "grpc_asyncio" ): client = WorkflowTemplateServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1913,7 +1938,7 @@ async def test_get_workflow_template_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( @@ -1942,11 +1967,6 @@ async def test_get_workflow_template_async( assert response.version == 774 -@pytest.mark.asyncio -async def test_get_workflow_template_async_from_dict(): - await test_get_workflow_template_async(request_type=dict) - - def test_get_workflow_template_field_headers(): client = WorkflowTemplateServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2101,8 +2121,8 @@ async def test_get_workflow_template_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - workflow_templates.InstantiateWorkflowTemplateRequest, - dict, + workflow_templates.InstantiateWorkflowTemplateRequest(), + {}, ], ) def test_instantiate_workflow_template(request_type, transport: str = "grpc"): @@ -2113,7 +2133,7 @@ def test_instantiate_workflow_template(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2159,10 +2179,11 @@ def test_instantiate_workflow_template_non_empty_request_with_auto_populated_fie client.instantiate_workflow_template(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == workflow_templates.InstantiateWorkflowTemplateRequest( + request_msg = workflow_templates.InstantiateWorkflowTemplateRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_instantiate_workflow_template_use_cached_wrapped_rpc(): @@ -2258,9 +2279,15 @@ async def test_instantiate_workflow_template_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + workflow_templates.InstantiateWorkflowTemplateRequest(), + {}, + ], +) async def test_instantiate_workflow_template_async( - transport: str = "grpc_asyncio", - request_type=workflow_templates.InstantiateWorkflowTemplateRequest, + request_type, transport: str = "grpc_asyncio" ): client = WorkflowTemplateServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2269,7 +2296,7 @@ async def test_instantiate_workflow_template_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( @@ -2291,11 +2318,6 @@ async def test_instantiate_workflow_template_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_instantiate_workflow_template_async_from_dict(): - await test_instantiate_workflow_template_async(request_type=dict) - - def test_instantiate_workflow_template_field_headers(): client = WorkflowTemplateServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2460,8 +2482,8 @@ async def test_instantiate_workflow_template_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - workflow_templates.InstantiateInlineWorkflowTemplateRequest, - dict, + workflow_templates.InstantiateInlineWorkflowTemplateRequest(), + {}, ], ) def test_instantiate_inline_workflow_template(request_type, transport: str = "grpc"): @@ -2472,7 +2494,7 @@ def test_instantiate_inline_workflow_template(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( @@ -2518,10 +2540,11 @@ def test_instantiate_inline_workflow_template_non_empty_request_with_auto_popula client.instantiate_inline_workflow_template(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == workflow_templates.InstantiateInlineWorkflowTemplateRequest( + request_msg = workflow_templates.InstantiateInlineWorkflowTemplateRequest( parent="parent_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_instantiate_inline_workflow_template_use_cached_wrapped_rpc(): @@ -2617,9 +2640,15 @@ async def test_instantiate_inline_workflow_template_async_use_cached_wrapped_rpc @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + workflow_templates.InstantiateInlineWorkflowTemplateRequest(), + {}, + ], +) async def test_instantiate_inline_workflow_template_async( - transport: str = "grpc_asyncio", - request_type=workflow_templates.InstantiateInlineWorkflowTemplateRequest, + request_type, transport: str = "grpc_asyncio" ): client = WorkflowTemplateServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2628,7 +2657,7 @@ async def test_instantiate_inline_workflow_template_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( @@ -2650,11 +2679,6 @@ async def test_instantiate_inline_workflow_template_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_instantiate_inline_workflow_template_async_from_dict(): - await test_instantiate_inline_workflow_template_async(request_type=dict) - - def test_instantiate_inline_workflow_template_field_headers(): client = WorkflowTemplateServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2819,8 +2843,8 @@ async def test_instantiate_inline_workflow_template_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - workflow_templates.UpdateWorkflowTemplateRequest, - dict, + workflow_templates.UpdateWorkflowTemplateRequest(), + {}, ], ) def test_update_workflow_template(request_type, transport: str = "grpc"): @@ -2831,7 +2855,7 @@ def test_update_workflow_template(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2881,7 +2905,8 @@ def test_update_workflow_template_non_empty_request_with_auto_populated_field(): client.update_workflow_template(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == workflow_templates.UpdateWorkflowTemplateRequest() + request_msg = workflow_templates.UpdateWorkflowTemplateRequest() + assert args[0] == request_msg def test_update_workflow_template_use_cached_wrapped_rpc(): @@ -2967,9 +2992,15 @@ async def test_update_workflow_template_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + workflow_templates.UpdateWorkflowTemplateRequest(), + {}, + ], +) async def test_update_workflow_template_async( - transport: str = "grpc_asyncio", - request_type=workflow_templates.UpdateWorkflowTemplateRequest, + request_type, transport: str = "grpc_asyncio" ): client = WorkflowTemplateServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2978,7 +3009,7 @@ async def test_update_workflow_template_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( @@ -3007,11 +3038,6 @@ async def test_update_workflow_template_async( assert response.version == 774 -@pytest.mark.asyncio -async def test_update_workflow_template_async_from_dict(): - await test_update_workflow_template_async(request_type=dict) - - def test_update_workflow_template_field_headers(): client = WorkflowTemplateServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3166,8 +3192,8 @@ async def test_update_workflow_template_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - workflow_templates.ListWorkflowTemplatesRequest, - dict, + workflow_templates.ListWorkflowTemplatesRequest(), + {}, ], ) def test_list_workflow_templates(request_type, transport: str = "grpc"): @@ -3178,7 +3204,7 @@ def test_list_workflow_templates(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3229,10 +3255,11 @@ def test_list_workflow_templates_non_empty_request_with_auto_populated_field(): client.list_workflow_templates(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == workflow_templates.ListWorkflowTemplatesRequest( + request_msg = workflow_templates.ListWorkflowTemplatesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_workflow_templates_use_cached_wrapped_rpc(): @@ -3318,9 +3345,15 @@ async def test_list_workflow_templates_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + workflow_templates.ListWorkflowTemplatesRequest(), + {}, + ], +) async def test_list_workflow_templates_async( - transport: str = "grpc_asyncio", - request_type=workflow_templates.ListWorkflowTemplatesRequest, + request_type, transport: str = "grpc_asyncio" ): client = WorkflowTemplateServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3329,7 +3362,7 @@ async def test_list_workflow_templates_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( @@ -3356,11 +3389,6 @@ async def test_list_workflow_templates_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_workflow_templates_async_from_dict(): - await test_list_workflow_templates_async(request_type=dict) - - def test_list_workflow_templates_field_headers(): client = WorkflowTemplateServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3715,8 +3743,8 @@ async def test_list_workflow_templates_async_pages(): @pytest.mark.parametrize( "request_type", [ - workflow_templates.DeleteWorkflowTemplateRequest, - dict, + workflow_templates.DeleteWorkflowTemplateRequest(), + {}, ], ) def test_delete_workflow_template(request_type, transport: str = "grpc"): @@ -3727,7 +3755,7 @@ def test_delete_workflow_template(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3772,9 +3800,10 @@ def test_delete_workflow_template_non_empty_request_with_auto_populated_field(): client.delete_workflow_template(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == workflow_templates.DeleteWorkflowTemplateRequest( + request_msg = workflow_templates.DeleteWorkflowTemplateRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_workflow_template_use_cached_wrapped_rpc(): @@ -3860,9 +3889,15 @@ async def test_delete_workflow_template_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + workflow_templates.DeleteWorkflowTemplateRequest(), + {}, + ], +) async def test_delete_workflow_template_async( - transport: str = "grpc_asyncio", - request_type=workflow_templates.DeleteWorkflowTemplateRequest, + request_type, transport: str = "grpc_asyncio" ): client = WorkflowTemplateServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3871,7 +3906,7 @@ async def test_delete_workflow_template_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( @@ -3891,11 +3926,6 @@ async def test_delete_workflow_template_async( assert response is None -@pytest.mark.asyncio -async def test_delete_workflow_template_async_from_dict(): - await test_delete_workflow_template_async(request_type=dict) - - def test_delete_workflow_template_field_headers(): client = WorkflowTemplateServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5566,7 +5596,6 @@ def test_create_workflow_template_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workflow_templates.CreateWorkflowTemplateRequest() - assert args[0] == request_msg @@ -5589,7 +5618,6 @@ def test_get_workflow_template_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workflow_templates.GetWorkflowTemplateRequest() - assert args[0] == request_msg @@ -5612,7 +5640,6 @@ def test_instantiate_workflow_template_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workflow_templates.InstantiateWorkflowTemplateRequest() - assert args[0] == request_msg @@ -5635,7 +5662,6 @@ def test_instantiate_inline_workflow_template_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workflow_templates.InstantiateInlineWorkflowTemplateRequest() - assert args[0] == request_msg @@ -5658,7 +5684,6 @@ def test_update_workflow_template_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workflow_templates.UpdateWorkflowTemplateRequest() - assert args[0] == request_msg @@ -5681,7 +5706,6 @@ def test_list_workflow_templates_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workflow_templates.ListWorkflowTemplatesRequest() - assert args[0] == request_msg @@ -5704,7 +5728,6 @@ def test_delete_workflow_template_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workflow_templates.DeleteWorkflowTemplateRequest() - assert args[0] == request_msg @@ -5749,7 +5772,6 @@ async def test_create_workflow_template_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workflow_templates.CreateWorkflowTemplateRequest() - assert args[0] == request_msg @@ -5780,7 +5802,6 @@ async def test_get_workflow_template_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workflow_templates.GetWorkflowTemplateRequest() - assert args[0] == request_msg @@ -5807,7 +5828,6 @@ async def test_instantiate_workflow_template_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workflow_templates.InstantiateWorkflowTemplateRequest() - assert args[0] == request_msg @@ -5834,7 +5854,6 @@ async def test_instantiate_inline_workflow_template_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workflow_templates.InstantiateInlineWorkflowTemplateRequest() - assert args[0] == request_msg @@ -5865,7 +5884,6 @@ async def test_update_workflow_template_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workflow_templates.UpdateWorkflowTemplateRequest() - assert args[0] == request_msg @@ -5895,7 +5913,6 @@ async def test_list_workflow_templates_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workflow_templates.ListWorkflowTemplatesRequest() - assert args[0] == request_msg @@ -5920,7 +5937,6 @@ async def test_delete_workflow_template_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workflow_templates.DeleteWorkflowTemplateRequest() - assert args[0] == request_msg @@ -8480,7 +8496,6 @@ def test_create_workflow_template_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workflow_templates.CreateWorkflowTemplateRequest() - assert args[0] == request_msg @@ -8502,7 +8517,6 @@ def test_get_workflow_template_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workflow_templates.GetWorkflowTemplateRequest() - assert args[0] == request_msg @@ -8524,7 +8538,6 @@ def test_instantiate_workflow_template_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workflow_templates.InstantiateWorkflowTemplateRequest() - assert args[0] == request_msg @@ -8546,7 +8559,6 @@ def test_instantiate_inline_workflow_template_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workflow_templates.InstantiateInlineWorkflowTemplateRequest() - assert args[0] == request_msg @@ -8568,7 +8580,6 @@ def test_update_workflow_template_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workflow_templates.UpdateWorkflowTemplateRequest() - assert args[0] == request_msg @@ -8590,7 +8601,6 @@ def test_list_workflow_templates_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workflow_templates.ListWorkflowTemplatesRequest() - assert args[0] == request_msg @@ -8612,7 +8622,6 @@ def test_delete_workflow_template_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workflow_templates.DeleteWorkflowTemplateRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-datastore/noxfile.py b/packages/google-cloud-datastore/noxfile.py index d6169f33ba4b..af42d740478e 100644 --- a/packages/google-cloud-datastore/noxfile.py +++ b/packages/google-cloud-datastore/noxfile.py @@ -47,7 +47,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-datastore" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -475,14 +480,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -594,14 +591,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-datastore/setup.py b/packages/google-cloud-datastore/setup.py index b420a0c3900b..b0cac8c0ec50 100644 --- a/packages/google-cloud-datastore/setup.py +++ b/packages/google-cloud-datastore/setup.py @@ -44,7 +44,7 @@ # See https://github.com/googleapis/google-cloud-python/issues/12364 "google-auth >= 2.14.1, <3.0.0,!=2.24.0,!=2.25.0", "google-cloud-core >= 2.0.0, <3.0.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-datastore/testing/constraints-3.10.txt b/packages/google-cloud-datastore/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-datastore/testing/constraints-3.10.txt +++ b/packages/google-cloud-datastore/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-datastore/tests/unit/gapic/datastore_admin_v1/test_datastore_admin.py b/packages/google-cloud-datastore/tests/unit/gapic/datastore_admin_v1/test_datastore_admin.py index a83095859670..fa1e1e2e2597 100644 --- a/packages/google-cloud-datastore/tests/unit/gapic/datastore_admin_v1/test_datastore_admin.py +++ b/packages/google-cloud-datastore/tests/unit/gapic/datastore_admin_v1/test_datastore_admin.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 @@ -113,6 +114,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" @@ -1319,8 +1335,8 @@ def test_datastore_admin_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - datastore_admin.ExportEntitiesRequest, - dict, + datastore_admin.ExportEntitiesRequest(), + {}, ], ) def test_export_entities(request_type, transport: str = "grpc"): @@ -1331,7 +1347,7 @@ def test_export_entities(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.export_entities), "__call__") as call: @@ -1373,10 +1389,11 @@ def test_export_entities_non_empty_request_with_auto_populated_field(): client.export_entities(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datastore_admin.ExportEntitiesRequest( + request_msg = datastore_admin.ExportEntitiesRequest( project_id="project_id_value", output_url_prefix="output_url_prefix_value", ) + assert args[0] == request_msg def test_export_entities_use_cached_wrapped_rpc(): @@ -1467,9 +1484,14 @@ async def test_export_entities_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_export_entities_async( - transport: str = "grpc_asyncio", request_type=datastore_admin.ExportEntitiesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datastore_admin.ExportEntitiesRequest(), + {}, + ], +) +async def test_export_entities_async(request_type, transport: str = "grpc_asyncio"): client = DatastoreAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1477,7 +1499,7 @@ async def test_export_entities_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.export_entities), "__call__") as call: @@ -1497,11 +1519,6 @@ async def test_export_entities_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_export_entities_async_from_dict(): - await test_export_entities_async(request_type=dict) - - def test_export_entities_field_headers(): client = DatastoreAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1678,8 +1695,8 @@ async def test_export_entities_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datastore_admin.ImportEntitiesRequest, - dict, + datastore_admin.ImportEntitiesRequest(), + {}, ], ) def test_import_entities(request_type, transport: str = "grpc"): @@ -1690,7 +1707,7 @@ def test_import_entities(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.import_entities), "__call__") as call: @@ -1732,10 +1749,11 @@ def test_import_entities_non_empty_request_with_auto_populated_field(): client.import_entities(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datastore_admin.ImportEntitiesRequest( + request_msg = datastore_admin.ImportEntitiesRequest( project_id="project_id_value", input_url="input_url_value", ) + assert args[0] == request_msg def test_import_entities_use_cached_wrapped_rpc(): @@ -1826,9 +1844,14 @@ async def test_import_entities_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_import_entities_async( - transport: str = "grpc_asyncio", request_type=datastore_admin.ImportEntitiesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datastore_admin.ImportEntitiesRequest(), + {}, + ], +) +async def test_import_entities_async(request_type, transport: str = "grpc_asyncio"): client = DatastoreAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1836,7 +1859,7 @@ async def test_import_entities_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.import_entities), "__call__") as call: @@ -1856,11 +1879,6 @@ async def test_import_entities_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_import_entities_async_from_dict(): - await test_import_entities_async(request_type=dict) - - def test_import_entities_field_headers(): client = DatastoreAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2037,8 +2055,8 @@ async def test_import_entities_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datastore_admin.CreateIndexRequest, - dict, + datastore_admin.CreateIndexRequest(), + {}, ], ) def test_create_index(request_type, transport: str = "grpc"): @@ -2049,7 +2067,7 @@ def test_create_index(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_index), "__call__") as call: @@ -2090,9 +2108,10 @@ def test_create_index_non_empty_request_with_auto_populated_field(): client.create_index(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datastore_admin.CreateIndexRequest( + request_msg = datastore_admin.CreateIndexRequest( project_id="project_id_value", ) + assert args[0] == request_msg def test_create_index_use_cached_wrapped_rpc(): @@ -2183,9 +2202,14 @@ async def test_create_index_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_index_async( - transport: str = "grpc_asyncio", request_type=datastore_admin.CreateIndexRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datastore_admin.CreateIndexRequest(), + {}, + ], +) +async def test_create_index_async(request_type, transport: str = "grpc_asyncio"): client = DatastoreAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2193,7 +2217,7 @@ async def test_create_index_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_index), "__call__") as call: @@ -2213,11 +2237,6 @@ async def test_create_index_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_index_async_from_dict(): - await test_create_index_async(request_type=dict) - - def test_create_index_field_headers(): client = DatastoreAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2282,8 +2301,8 @@ async def test_create_index_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - datastore_admin.DeleteIndexRequest, - dict, + datastore_admin.DeleteIndexRequest(), + {}, ], ) def test_delete_index(request_type, transport: str = "grpc"): @@ -2294,7 +2313,7 @@ def test_delete_index(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_index), "__call__") as call: @@ -2336,10 +2355,11 @@ def test_delete_index_non_empty_request_with_auto_populated_field(): client.delete_index(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datastore_admin.DeleteIndexRequest( + request_msg = datastore_admin.DeleteIndexRequest( project_id="project_id_value", index_id="index_id_value", ) + assert args[0] == request_msg def test_delete_index_use_cached_wrapped_rpc(): @@ -2430,9 +2450,14 @@ async def test_delete_index_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_index_async( - transport: str = "grpc_asyncio", request_type=datastore_admin.DeleteIndexRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datastore_admin.DeleteIndexRequest(), + {}, + ], +) +async def test_delete_index_async(request_type, transport: str = "grpc_asyncio"): client = DatastoreAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2440,7 +2465,7 @@ async def test_delete_index_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_index), "__call__") as call: @@ -2460,11 +2485,6 @@ async def test_delete_index_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_index_async_from_dict(): - await test_delete_index_async(request_type=dict) - - def test_delete_index_field_headers(): client = DatastoreAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2531,8 +2551,8 @@ async def test_delete_index_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - datastore_admin.GetIndexRequest, - dict, + datastore_admin.GetIndexRequest(), + {}, ], ) def test_get_index(request_type, transport: str = "grpc"): @@ -2543,7 +2563,7 @@ def test_get_index(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_index), "__call__") as call: @@ -2596,10 +2616,11 @@ def test_get_index_non_empty_request_with_auto_populated_field(): client.get_index(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datastore_admin.GetIndexRequest( + request_msg = datastore_admin.GetIndexRequest( project_id="project_id_value", index_id="index_id_value", ) + assert args[0] == request_msg def test_get_index_use_cached_wrapped_rpc(): @@ -2678,9 +2699,14 @@ async def test_get_index_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_index_async( - transport: str = "grpc_asyncio", request_type=datastore_admin.GetIndexRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datastore_admin.GetIndexRequest(), + {}, + ], +) +async def test_get_index_async(request_type, transport: str = "grpc_asyncio"): client = DatastoreAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2688,7 +2714,7 @@ async def test_get_index_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_index), "__call__") as call: @@ -2719,11 +2745,6 @@ async def test_get_index_async( assert response.state == index.Index.State.CREATING -@pytest.mark.asyncio -async def test_get_index_async_from_dict(): - await test_get_index_async(request_type=dict) - - def test_get_index_field_headers(): client = DatastoreAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2788,8 +2809,8 @@ async def test_get_index_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - datastore_admin.ListIndexesRequest, - dict, + datastore_admin.ListIndexesRequest(), + {}, ], ) def test_list_indexes(request_type, transport: str = "grpc"): @@ -2800,7 +2821,7 @@ def test_list_indexes(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_indexes), "__call__") as call: @@ -2846,11 +2867,12 @@ def test_list_indexes_non_empty_request_with_auto_populated_field(): client.list_indexes(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datastore_admin.ListIndexesRequest( + request_msg = datastore_admin.ListIndexesRequest( project_id="project_id_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_indexes_use_cached_wrapped_rpc(): @@ -2931,9 +2953,14 @@ async def test_list_indexes_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_indexes_async( - transport: str = "grpc_asyncio", request_type=datastore_admin.ListIndexesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datastore_admin.ListIndexesRequest(), + {}, + ], +) +async def test_list_indexes_async(request_type, transport: str = "grpc_asyncio"): client = DatastoreAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2941,7 +2968,7 @@ async def test_list_indexes_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_indexes), "__call__") as call: @@ -2964,11 +2991,6 @@ async def test_list_indexes_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_indexes_async_from_dict(): - await test_list_indexes_async(request_type=dict) - - def test_list_indexes_field_headers(): client = DatastoreAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3946,7 +3968,6 @@ def test_export_entities_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastore_admin.ExportEntitiesRequest() - assert args[0] == request_msg @@ -3967,7 +3988,6 @@ def test_import_entities_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastore_admin.ImportEntitiesRequest() - assert args[0] == request_msg @@ -3988,7 +4008,6 @@ def test_create_index_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastore_admin.CreateIndexRequest() - assert args[0] == request_msg @@ -4009,7 +4028,6 @@ def test_delete_index_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastore_admin.DeleteIndexRequest() - assert args[0] == request_msg @@ -4030,7 +4048,6 @@ def test_get_index_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastore_admin.GetIndexRequest() - assert args[0] == request_msg @@ -4051,7 +4068,6 @@ def test_list_indexes_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastore_admin.ListIndexesRequest() - assert args[0] == request_msg @@ -4090,7 +4106,6 @@ async def test_export_entities_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastore_admin.ExportEntitiesRequest() - assert args[0] == request_msg @@ -4115,7 +4130,6 @@ async def test_import_entities_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastore_admin.ImportEntitiesRequest() - assert args[0] == request_msg @@ -4140,7 +4154,6 @@ async def test_create_index_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastore_admin.CreateIndexRequest() - assert args[0] == request_msg @@ -4165,7 +4178,6 @@ async def test_delete_index_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastore_admin.DeleteIndexRequest() - assert args[0] == request_msg @@ -4196,7 +4208,6 @@ async def test_get_index_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastore_admin.GetIndexRequest() - assert args[0] == request_msg @@ -4223,7 +4234,6 @@ async def test_list_indexes_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastore_admin.ListIndexesRequest() - assert args[0] == request_msg @@ -5349,7 +5359,6 @@ def test_export_entities_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastore_admin.ExportEntitiesRequest() - assert args[0] == request_msg @@ -5369,7 +5378,6 @@ def test_import_entities_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastore_admin.ImportEntitiesRequest() - assert args[0] == request_msg @@ -5389,7 +5397,6 @@ def test_create_index_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastore_admin.CreateIndexRequest() - assert args[0] == request_msg @@ -5409,7 +5416,6 @@ def test_delete_index_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastore_admin.DeleteIndexRequest() - assert args[0] == request_msg @@ -5429,7 +5435,6 @@ def test_get_index_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastore_admin.GetIndexRequest() - assert args[0] == request_msg @@ -5449,7 +5454,6 @@ def test_list_indexes_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastore_admin.ListIndexesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-datastore/tests/unit/gapic/datastore_v1/test_datastore.py b/packages/google-cloud-datastore/tests/unit/gapic/datastore_v1/test_datastore.py index 40783e037d5d..9fb9e701b814 100644 --- a/packages/google-cloud-datastore/tests/unit/gapic/datastore_v1/test_datastore.py +++ b/packages/google-cloud-datastore/tests/unit/gapic/datastore_v1/test_datastore.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 @@ -117,6 +118,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" @@ -1277,8 +1293,8 @@ def test_datastore_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - datastore.LookupRequest, - dict, + datastore.LookupRequest(), + {}, ], ) def test_lookup(request_type, transport: str = "grpc"): @@ -1289,7 +1305,7 @@ def test_lookup(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.lookup), "__call__") as call: @@ -1334,10 +1350,11 @@ def test_lookup_non_empty_request_with_auto_populated_field(): client.lookup(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datastore.LookupRequest( + request_msg = datastore.LookupRequest( project_id="project_id_value", database_id="database_id_value", ) + assert args[0] == request_msg def test_lookup_use_cached_wrapped_rpc(): @@ -1416,9 +1433,14 @@ async def test_lookup_async_use_cached_wrapped_rpc(transport: str = "grpc_asynci @pytest.mark.asyncio -async def test_lookup_async( - transport: str = "grpc_asyncio", request_type=datastore.LookupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datastore.LookupRequest(), + {}, + ], +) +async def test_lookup_async(request_type, transport: str = "grpc_asyncio"): client = DatastoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1426,7 +1448,7 @@ async def test_lookup_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.lookup), "__call__") as call: @@ -1449,11 +1471,6 @@ async def test_lookup_async( assert response.transaction == b"transaction_blob" -@pytest.mark.asyncio -async def test_lookup_async_from_dict(): - await test_lookup_async(request_type=dict) - - def test_lookup_flattened(): client = DatastoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1591,8 +1608,8 @@ async def test_lookup_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datastore.RunQueryRequest, - dict, + datastore.RunQueryRequest(), + {}, ], ) def test_run_query(request_type, transport: str = "grpc"): @@ -1603,7 +1620,7 @@ def test_run_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(type(client.transport.run_query), "__call__") as call: @@ -1648,10 +1665,11 @@ def test_run_query_non_empty_request_with_auto_populated_field(): client.run_query(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datastore.RunQueryRequest( + request_msg = datastore.RunQueryRequest( project_id="project_id_value", database_id="database_id_value", ) + assert args[0] == request_msg def test_run_query_use_cached_wrapped_rpc(): @@ -1730,9 +1748,14 @@ async def test_run_query_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_run_query_async( - transport: str = "grpc_asyncio", request_type=datastore.RunQueryRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datastore.RunQueryRequest(), + {}, + ], +) +async def test_run_query_async(request_type, transport: str = "grpc_asyncio"): client = DatastoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1740,7 +1763,7 @@ async def test_run_query_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.run_query), "__call__") as call: @@ -1763,16 +1786,11 @@ async def test_run_query_async( assert response.transaction == b"transaction_blob" -@pytest.mark.asyncio -async def test_run_query_async_from_dict(): - await test_run_query_async(request_type=dict) - - @pytest.mark.parametrize( "request_type", [ - datastore.RunAggregationQueryRequest, - dict, + datastore.RunAggregationQueryRequest(), + {}, ], ) def test_run_aggregation_query(request_type, transport: str = "grpc"): @@ -1783,7 +1801,7 @@ def test_run_aggregation_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( @@ -1832,10 +1850,11 @@ def test_run_aggregation_query_non_empty_request_with_auto_populated_field(): client.run_aggregation_query(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datastore.RunAggregationQueryRequest( + request_msg = datastore.RunAggregationQueryRequest( project_id="project_id_value", database_id="database_id_value", ) + assert args[0] == request_msg def test_run_aggregation_query_use_cached_wrapped_rpc(): @@ -1921,8 +1940,15 @@ async def test_run_aggregation_query_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + datastore.RunAggregationQueryRequest(), + {}, + ], +) async def test_run_aggregation_query_async( - transport: str = "grpc_asyncio", request_type=datastore.RunAggregationQueryRequest + request_type, transport: str = "grpc_asyncio" ): client = DatastoreAsyncClient( credentials=async_anonymous_credentials(), @@ -1931,7 +1957,7 @@ async def test_run_aggregation_query_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( @@ -1956,16 +1982,11 @@ async def test_run_aggregation_query_async( assert response.transaction == b"transaction_blob" -@pytest.mark.asyncio -async def test_run_aggregation_query_async_from_dict(): - await test_run_aggregation_query_async(request_type=dict) - - @pytest.mark.parametrize( "request_type", [ - datastore.BeginTransactionRequest, - dict, + datastore.BeginTransactionRequest(), + {}, ], ) def test_begin_transaction(request_type, transport: str = "grpc"): @@ -1976,7 +1997,7 @@ def test_begin_transaction(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2025,10 +2046,11 @@ def test_begin_transaction_non_empty_request_with_auto_populated_field(): client.begin_transaction(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datastore.BeginTransactionRequest( + request_msg = datastore.BeginTransactionRequest( project_id="project_id_value", database_id="database_id_value", ) + assert args[0] == request_msg def test_begin_transaction_use_cached_wrapped_rpc(): @@ -2111,9 +2133,14 @@ async def test_begin_transaction_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_begin_transaction_async( - transport: str = "grpc_asyncio", request_type=datastore.BeginTransactionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datastore.BeginTransactionRequest(), + {}, + ], +) +async def test_begin_transaction_async(request_type, transport: str = "grpc_asyncio"): client = DatastoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2121,7 +2148,7 @@ async def test_begin_transaction_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( @@ -2146,11 +2173,6 @@ async def test_begin_transaction_async( assert response.transaction == b"transaction_blob" -@pytest.mark.asyncio -async def test_begin_transaction_async_from_dict(): - await test_begin_transaction_async(request_type=dict) - - def test_begin_transaction_flattened(): client = DatastoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2240,8 +2262,8 @@ async def test_begin_transaction_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datastore.CommitRequest, - dict, + datastore.CommitRequest(), + {}, ], ) def test_commit(request_type, transport: str = "grpc"): @@ -2252,7 +2274,7 @@ def test_commit(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.commit), "__call__") as call: @@ -2297,10 +2319,11 @@ def test_commit_non_empty_request_with_auto_populated_field(): client.commit(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datastore.CommitRequest( + request_msg = datastore.CommitRequest( project_id="project_id_value", database_id="database_id_value", ) + assert args[0] == request_msg def test_commit_use_cached_wrapped_rpc(): @@ -2379,9 +2402,14 @@ async def test_commit_async_use_cached_wrapped_rpc(transport: str = "grpc_asynci @pytest.mark.asyncio -async def test_commit_async( - transport: str = "grpc_asyncio", request_type=datastore.CommitRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datastore.CommitRequest(), + {}, + ], +) +async def test_commit_async(request_type, transport: str = "grpc_asyncio"): client = DatastoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2389,7 +2417,7 @@ async def test_commit_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.commit), "__call__") as call: @@ -2412,11 +2440,6 @@ async def test_commit_async( assert response.index_updates == 1389 -@pytest.mark.asyncio -async def test_commit_async_from_dict(): - await test_commit_async(request_type=dict) - - def test_commit_flattened(): client = DatastoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2584,8 +2607,8 @@ async def test_commit_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datastore.RollbackRequest, - dict, + datastore.RollbackRequest(), + {}, ], ) def test_rollback(request_type, transport: str = "grpc"): @@ -2596,7 +2619,7 @@ def test_rollback(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.rollback), "__call__") as call: @@ -2638,10 +2661,11 @@ def test_rollback_non_empty_request_with_auto_populated_field(): client.rollback(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datastore.RollbackRequest( + request_msg = datastore.RollbackRequest( project_id="project_id_value", database_id="database_id_value", ) + assert args[0] == request_msg def test_rollback_use_cached_wrapped_rpc(): @@ -2720,9 +2744,14 @@ async def test_rollback_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn @pytest.mark.asyncio -async def test_rollback_async( - transport: str = "grpc_asyncio", request_type=datastore.RollbackRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datastore.RollbackRequest(), + {}, + ], +) +async def test_rollback_async(request_type, transport: str = "grpc_asyncio"): client = DatastoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2730,7 +2759,7 @@ async def test_rollback_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.rollback), "__call__") as call: @@ -2750,11 +2779,6 @@ async def test_rollback_async( assert isinstance(response, datastore.RollbackResponse) -@pytest.mark.asyncio -async def test_rollback_async_from_dict(): - await test_rollback_async(request_type=dict) - - def test_rollback_flattened(): client = DatastoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2850,8 +2874,8 @@ async def test_rollback_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datastore.AllocateIdsRequest, - dict, + datastore.AllocateIdsRequest(), + {}, ], ) def test_allocate_ids(request_type, transport: str = "grpc"): @@ -2862,7 +2886,7 @@ def test_allocate_ids(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.allocate_ids), "__call__") as call: @@ -2904,10 +2928,11 @@ def test_allocate_ids_non_empty_request_with_auto_populated_field(): client.allocate_ids(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datastore.AllocateIdsRequest( + request_msg = datastore.AllocateIdsRequest( project_id="project_id_value", database_id="database_id_value", ) + assert args[0] == request_msg def test_allocate_ids_use_cached_wrapped_rpc(): @@ -2988,9 +3013,14 @@ async def test_allocate_ids_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_allocate_ids_async( - transport: str = "grpc_asyncio", request_type=datastore.AllocateIdsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datastore.AllocateIdsRequest(), + {}, + ], +) +async def test_allocate_ids_async(request_type, transport: str = "grpc_asyncio"): client = DatastoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2998,7 +3028,7 @@ async def test_allocate_ids_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.allocate_ids), "__call__") as call: @@ -3018,11 +3048,6 @@ async def test_allocate_ids_async( assert isinstance(response, datastore.AllocateIdsResponse) -@pytest.mark.asyncio -async def test_allocate_ids_async_from_dict(): - await test_allocate_ids_async(request_type=dict) - - def test_allocate_ids_flattened(): client = DatastoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3138,8 +3163,8 @@ async def test_allocate_ids_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datastore.ReserveIdsRequest, - dict, + datastore.ReserveIdsRequest(), + {}, ], ) def test_reserve_ids(request_type, transport: str = "grpc"): @@ -3150,7 +3175,7 @@ def test_reserve_ids(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.reserve_ids), "__call__") as call: @@ -3192,10 +3217,11 @@ def test_reserve_ids_non_empty_request_with_auto_populated_field(): client.reserve_ids(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datastore.ReserveIdsRequest( + request_msg = datastore.ReserveIdsRequest( project_id="project_id_value", database_id="database_id_value", ) + assert args[0] == request_msg def test_reserve_ids_use_cached_wrapped_rpc(): @@ -3276,9 +3302,14 @@ async def test_reserve_ids_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_reserve_ids_async( - transport: str = "grpc_asyncio", request_type=datastore.ReserveIdsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datastore.ReserveIdsRequest(), + {}, + ], +) +async def test_reserve_ids_async(request_type, transport: str = "grpc_asyncio"): client = DatastoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3286,7 +3317,7 @@ async def test_reserve_ids_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.reserve_ids), "__call__") as call: @@ -3306,11 +3337,6 @@ async def test_reserve_ids_async( assert isinstance(response, datastore.ReserveIdsResponse) -@pytest.mark.asyncio -async def test_reserve_ids_async_from_dict(): - await test_reserve_ids_async(request_type=dict) - - def test_reserve_ids_flattened(): client = DatastoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4945,7 +4971,6 @@ def test_lookup_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastore.LookupRequest() - assert args[0] == request_msg @@ -4966,7 +4991,6 @@ def test_run_query_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastore.RunQueryRequest() - assert args[0] == request_msg @@ -4989,7 +5013,6 @@ def test_run_aggregation_query_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastore.RunAggregationQueryRequest() - assert args[0] == request_msg @@ -5012,7 +5035,6 @@ def test_begin_transaction_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastore.BeginTransactionRequest() - assert args[0] == request_msg @@ -5033,7 +5055,6 @@ def test_commit_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastore.CommitRequest() - assert args[0] == request_msg @@ -5054,7 +5075,6 @@ def test_rollback_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastore.RollbackRequest() - assert args[0] == request_msg @@ -5075,7 +5095,6 @@ def test_allocate_ids_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastore.AllocateIdsRequest() - assert args[0] == request_msg @@ -5096,7 +5115,6 @@ def test_reserve_ids_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastore.ReserveIdsRequest() - assert args[0] == request_msg @@ -5115,7 +5133,6 @@ def test_lookup_routing_parameters_request_1_grpc(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = datastore.LookupRequest(**{"project_id": "sample1"}) - assert args[0] == request_msg expected_headers = {"project_id": "sample1"} @@ -5139,7 +5156,6 @@ def test_lookup_routing_parameters_request_2_grpc(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = datastore.LookupRequest(**{"database_id": "sample1"}) - assert args[0] == request_msg expected_headers = {"database_id": "sample1"} @@ -5163,7 +5179,6 @@ def test_run_query_routing_parameters_request_1_grpc(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = datastore.RunQueryRequest(**{"project_id": "sample1"}) - assert args[0] == request_msg expected_headers = {"project_id": "sample1"} @@ -5187,7 +5202,6 @@ def test_run_query_routing_parameters_request_2_grpc(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = datastore.RunQueryRequest(**{"database_id": "sample1"}) - assert args[0] == request_msg expected_headers = {"database_id": "sample1"} @@ -5213,7 +5227,6 @@ def test_run_aggregation_query_routing_parameters_request_1_grpc(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = datastore.RunAggregationQueryRequest(**{"project_id": "sample1"}) - assert args[0] == request_msg expected_headers = {"project_id": "sample1"} @@ -5239,7 +5252,6 @@ def test_run_aggregation_query_routing_parameters_request_2_grpc(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = datastore.RunAggregationQueryRequest(**{"database_id": "sample1"}) - assert args[0] == request_msg expected_headers = {"database_id": "sample1"} @@ -5265,7 +5277,6 @@ def test_begin_transaction_routing_parameters_request_1_grpc(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = datastore.BeginTransactionRequest(**{"project_id": "sample1"}) - assert args[0] == request_msg expected_headers = {"project_id": "sample1"} @@ -5291,7 +5302,6 @@ def test_begin_transaction_routing_parameters_request_2_grpc(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = datastore.BeginTransactionRequest(**{"database_id": "sample1"}) - assert args[0] == request_msg expected_headers = {"database_id": "sample1"} @@ -5315,7 +5325,6 @@ def test_commit_routing_parameters_request_1_grpc(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = datastore.CommitRequest(**{"project_id": "sample1"}) - assert args[0] == request_msg expected_headers = {"project_id": "sample1"} @@ -5339,7 +5348,6 @@ def test_commit_routing_parameters_request_2_grpc(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = datastore.CommitRequest(**{"database_id": "sample1"}) - assert args[0] == request_msg expected_headers = {"database_id": "sample1"} @@ -5363,7 +5371,6 @@ def test_rollback_routing_parameters_request_1_grpc(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = datastore.RollbackRequest(**{"project_id": "sample1"}) - assert args[0] == request_msg expected_headers = {"project_id": "sample1"} @@ -5387,7 +5394,6 @@ def test_rollback_routing_parameters_request_2_grpc(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = datastore.RollbackRequest(**{"database_id": "sample1"}) - assert args[0] == request_msg expected_headers = {"database_id": "sample1"} @@ -5411,7 +5417,6 @@ def test_allocate_ids_routing_parameters_request_1_grpc(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = datastore.AllocateIdsRequest(**{"project_id": "sample1"}) - assert args[0] == request_msg expected_headers = {"project_id": "sample1"} @@ -5435,7 +5440,6 @@ def test_allocate_ids_routing_parameters_request_2_grpc(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = datastore.AllocateIdsRequest(**{"database_id": "sample1"}) - assert args[0] == request_msg expected_headers = {"database_id": "sample1"} @@ -5459,7 +5463,6 @@ def test_reserve_ids_routing_parameters_request_1_grpc(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = datastore.ReserveIdsRequest(**{"project_id": "sample1"}) - assert args[0] == request_msg expected_headers = {"project_id": "sample1"} @@ -5483,7 +5486,6 @@ def test_reserve_ids_routing_parameters_request_2_grpc(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = datastore.ReserveIdsRequest(**{"database_id": "sample1"}) - assert args[0] == request_msg expected_headers = {"database_id": "sample1"} @@ -5529,7 +5531,6 @@ async def test_lookup_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastore.LookupRequest() - assert args[0] == request_msg @@ -5556,7 +5557,6 @@ async def test_run_query_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastore.RunQueryRequest() - assert args[0] == request_msg @@ -5585,7 +5585,6 @@ async def test_run_aggregation_query_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastore.RunAggregationQueryRequest() - assert args[0] == request_msg @@ -5614,7 +5613,6 @@ async def test_begin_transaction_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastore.BeginTransactionRequest() - assert args[0] == request_msg @@ -5641,7 +5639,6 @@ async def test_commit_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastore.CommitRequest() - assert args[0] == request_msg @@ -5666,7 +5663,6 @@ async def test_rollback_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastore.RollbackRequest() - assert args[0] == request_msg @@ -5691,7 +5687,6 @@ async def test_allocate_ids_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastore.AllocateIdsRequest() - assert args[0] == request_msg @@ -5716,7 +5711,6 @@ async def test_reserve_ids_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastore.ReserveIdsRequest() - assert args[0] == request_msg @@ -5741,7 +5735,6 @@ async def test_lookup_routing_parameters_request_1_grpc_asyncio(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = datastore.LookupRequest(**{"project_id": "sample1"}) - assert args[0] == request_msg expected_headers = {"project_id": "sample1"} @@ -5771,7 +5764,6 @@ async def test_lookup_routing_parameters_request_2_grpc_asyncio(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = datastore.LookupRequest(**{"database_id": "sample1"}) - assert args[0] == request_msg expected_headers = {"database_id": "sample1"} @@ -5801,7 +5793,6 @@ async def test_run_query_routing_parameters_request_1_grpc_asyncio(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = datastore.RunQueryRequest(**{"project_id": "sample1"}) - assert args[0] == request_msg expected_headers = {"project_id": "sample1"} @@ -5831,7 +5822,6 @@ async def test_run_query_routing_parameters_request_2_grpc_asyncio(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = datastore.RunQueryRequest(**{"database_id": "sample1"}) - assert args[0] == request_msg expected_headers = {"database_id": "sample1"} @@ -5863,7 +5853,6 @@ async def test_run_aggregation_query_routing_parameters_request_1_grpc_asyncio() call.assert_called() _, args, kw = call.mock_calls[0] request_msg = datastore.RunAggregationQueryRequest(**{"project_id": "sample1"}) - assert args[0] == request_msg expected_headers = {"project_id": "sample1"} @@ -5895,7 +5884,6 @@ async def test_run_aggregation_query_routing_parameters_request_2_grpc_asyncio() call.assert_called() _, args, kw = call.mock_calls[0] request_msg = datastore.RunAggregationQueryRequest(**{"database_id": "sample1"}) - assert args[0] == request_msg expected_headers = {"database_id": "sample1"} @@ -5927,7 +5915,6 @@ async def test_begin_transaction_routing_parameters_request_1_grpc_asyncio(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = datastore.BeginTransactionRequest(**{"project_id": "sample1"}) - assert args[0] == request_msg expected_headers = {"project_id": "sample1"} @@ -5959,7 +5946,6 @@ async def test_begin_transaction_routing_parameters_request_2_grpc_asyncio(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = datastore.BeginTransactionRequest(**{"database_id": "sample1"}) - assert args[0] == request_msg expected_headers = {"database_id": "sample1"} @@ -5989,7 +5975,6 @@ async def test_commit_routing_parameters_request_1_grpc_asyncio(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = datastore.CommitRequest(**{"project_id": "sample1"}) - assert args[0] == request_msg expected_headers = {"project_id": "sample1"} @@ -6019,7 +6004,6 @@ async def test_commit_routing_parameters_request_2_grpc_asyncio(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = datastore.CommitRequest(**{"database_id": "sample1"}) - assert args[0] == request_msg expected_headers = {"database_id": "sample1"} @@ -6047,7 +6031,6 @@ async def test_rollback_routing_parameters_request_1_grpc_asyncio(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = datastore.RollbackRequest(**{"project_id": "sample1"}) - assert args[0] == request_msg expected_headers = {"project_id": "sample1"} @@ -6075,7 +6058,6 @@ async def test_rollback_routing_parameters_request_2_grpc_asyncio(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = datastore.RollbackRequest(**{"database_id": "sample1"}) - assert args[0] == request_msg expected_headers = {"database_id": "sample1"} @@ -6103,7 +6085,6 @@ async def test_allocate_ids_routing_parameters_request_1_grpc_asyncio(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = datastore.AllocateIdsRequest(**{"project_id": "sample1"}) - assert args[0] == request_msg expected_headers = {"project_id": "sample1"} @@ -6131,7 +6112,6 @@ async def test_allocate_ids_routing_parameters_request_2_grpc_asyncio(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = datastore.AllocateIdsRequest(**{"database_id": "sample1"}) - assert args[0] == request_msg expected_headers = {"database_id": "sample1"} @@ -6159,7 +6139,6 @@ async def test_reserve_ids_routing_parameters_request_1_grpc_asyncio(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = datastore.ReserveIdsRequest(**{"project_id": "sample1"}) - assert args[0] == request_msg expected_headers = {"project_id": "sample1"} @@ -6187,7 +6166,6 @@ async def test_reserve_ids_routing_parameters_request_2_grpc_asyncio(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = datastore.ReserveIdsRequest(**{"database_id": "sample1"}) - assert args[0] == request_msg expected_headers = {"database_id": "sample1"} @@ -7465,7 +7443,6 @@ def test_lookup_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastore.LookupRequest() - assert args[0] == request_msg @@ -7485,7 +7462,6 @@ def test_run_query_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastore.RunQueryRequest() - assert args[0] == request_msg @@ -7507,7 +7483,6 @@ def test_run_aggregation_query_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastore.RunAggregationQueryRequest() - assert args[0] == request_msg @@ -7529,7 +7504,6 @@ def test_begin_transaction_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastore.BeginTransactionRequest() - assert args[0] == request_msg @@ -7549,7 +7523,6 @@ def test_commit_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastore.CommitRequest() - assert args[0] == request_msg @@ -7569,7 +7542,6 @@ def test_rollback_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastore.RollbackRequest() - assert args[0] == request_msg @@ -7589,7 +7561,6 @@ def test_allocate_ids_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastore.AllocateIdsRequest() - assert args[0] == request_msg @@ -7609,7 +7580,6 @@ def test_reserve_ids_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastore.ReserveIdsRequest() - assert args[0] == request_msg @@ -7627,7 +7597,6 @@ def test_lookup_routing_parameters_request_1_rest(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = datastore.LookupRequest(**{"project_id": "sample1"}) - assert args[0] == request_msg expected_headers = {"project_id": "sample1"} @@ -7650,7 +7619,6 @@ def test_lookup_routing_parameters_request_2_rest(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = datastore.LookupRequest(**{"database_id": "sample1"}) - assert args[0] == request_msg expected_headers = {"database_id": "sample1"} @@ -7673,7 +7641,6 @@ def test_run_query_routing_parameters_request_1_rest(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = datastore.RunQueryRequest(**{"project_id": "sample1"}) - assert args[0] == request_msg expected_headers = {"project_id": "sample1"} @@ -7696,7 +7663,6 @@ def test_run_query_routing_parameters_request_2_rest(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = datastore.RunQueryRequest(**{"database_id": "sample1"}) - assert args[0] == request_msg expected_headers = {"database_id": "sample1"} @@ -7721,7 +7687,6 @@ def test_run_aggregation_query_routing_parameters_request_1_rest(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = datastore.RunAggregationQueryRequest(**{"project_id": "sample1"}) - assert args[0] == request_msg expected_headers = {"project_id": "sample1"} @@ -7746,7 +7711,6 @@ def test_run_aggregation_query_routing_parameters_request_2_rest(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = datastore.RunAggregationQueryRequest(**{"database_id": "sample1"}) - assert args[0] == request_msg expected_headers = {"database_id": "sample1"} @@ -7771,7 +7735,6 @@ def test_begin_transaction_routing_parameters_request_1_rest(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = datastore.BeginTransactionRequest(**{"project_id": "sample1"}) - assert args[0] == request_msg expected_headers = {"project_id": "sample1"} @@ -7796,7 +7759,6 @@ def test_begin_transaction_routing_parameters_request_2_rest(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = datastore.BeginTransactionRequest(**{"database_id": "sample1"}) - assert args[0] == request_msg expected_headers = {"database_id": "sample1"} @@ -7819,7 +7781,6 @@ def test_commit_routing_parameters_request_1_rest(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = datastore.CommitRequest(**{"project_id": "sample1"}) - assert args[0] == request_msg expected_headers = {"project_id": "sample1"} @@ -7842,7 +7803,6 @@ def test_commit_routing_parameters_request_2_rest(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = datastore.CommitRequest(**{"database_id": "sample1"}) - assert args[0] == request_msg expected_headers = {"database_id": "sample1"} @@ -7865,7 +7825,6 @@ def test_rollback_routing_parameters_request_1_rest(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = datastore.RollbackRequest(**{"project_id": "sample1"}) - assert args[0] == request_msg expected_headers = {"project_id": "sample1"} @@ -7888,7 +7847,6 @@ def test_rollback_routing_parameters_request_2_rest(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = datastore.RollbackRequest(**{"database_id": "sample1"}) - assert args[0] == request_msg expected_headers = {"database_id": "sample1"} @@ -7911,7 +7869,6 @@ def test_allocate_ids_routing_parameters_request_1_rest(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = datastore.AllocateIdsRequest(**{"project_id": "sample1"}) - assert args[0] == request_msg expected_headers = {"project_id": "sample1"} @@ -7934,7 +7891,6 @@ def test_allocate_ids_routing_parameters_request_2_rest(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = datastore.AllocateIdsRequest(**{"database_id": "sample1"}) - assert args[0] == request_msg expected_headers = {"database_id": "sample1"} @@ -7957,7 +7913,6 @@ def test_reserve_ids_routing_parameters_request_1_rest(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = datastore.ReserveIdsRequest(**{"project_id": "sample1"}) - assert args[0] == request_msg expected_headers = {"project_id": "sample1"} @@ -7980,7 +7935,6 @@ def test_reserve_ids_routing_parameters_request_2_rest(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = datastore.ReserveIdsRequest(**{"database_id": "sample1"}) - assert args[0] == request_msg expected_headers = {"database_id": "sample1"} diff --git a/packages/google-cloud-datastream/noxfile.py b/packages/google-cloud-datastream/noxfile.py index 6e940f662571..2769c61b3d26 100644 --- a/packages/google-cloud-datastream/noxfile.py +++ b/packages/google-cloud-datastream/noxfile.py @@ -47,7 +47,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-datastream" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-datastream/setup.py b/packages/google-cloud-datastream/setup.py index 40d66e506b3c..215e519dc6c5 100644 --- a/packages/google-cloud-datastream/setup.py +++ b/packages/google-cloud-datastream/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/google-cloud-datastream/testing/constraints-3.10.txt b/packages/google-cloud-datastream/testing/constraints-3.10.txt index a92801e1c8e2..b39cd54634f9 100644 --- a/packages/google-cloud-datastream/testing/constraints-3.10.txt +++ b/packages/google-cloud-datastream/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/google-cloud-datastream/tests/unit/gapic/datastream_v1/test_datastream.py b/packages/google-cloud-datastream/tests/unit/gapic/datastream_v1/test_datastream.py index 9abbde1aa4cd..e20c14e0cc2a 100644 --- a/packages/google-cloud-datastream/tests/unit/gapic/datastream_v1/test_datastream.py +++ b/packages/google-cloud-datastream/tests/unit/gapic/datastream_v1/test_datastream.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 @@ -122,6 +123,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" @@ -1283,8 +1299,8 @@ def test_datastream_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - datastream.ListConnectionProfilesRequest, - dict, + datastream.ListConnectionProfilesRequest(), + {}, ], ) def test_list_connection_profiles(request_type, transport: str = "grpc"): @@ -1295,7 +1311,7 @@ def test_list_connection_profiles(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1348,12 +1364,13 @@ def test_list_connection_profiles_non_empty_request_with_auto_populated_field(): client.list_connection_profiles(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datastream.ListConnectionProfilesRequest( + request_msg = datastream.ListConnectionProfilesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_connection_profiles_use_cached_wrapped_rpc(): @@ -1439,9 +1456,15 @@ async def test_list_connection_profiles_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + datastream.ListConnectionProfilesRequest(), + {}, + ], +) async def test_list_connection_profiles_async( - transport: str = "grpc_asyncio", - request_type=datastream.ListConnectionProfilesRequest, + request_type, transport: str = "grpc_asyncio" ): client = DatastreamAsyncClient( credentials=async_anonymous_credentials(), @@ -1450,7 +1473,7 @@ async def test_list_connection_profiles_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( @@ -1477,11 +1500,6 @@ async def test_list_connection_profiles_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_connection_profiles_async_from_dict(): - await test_list_connection_profiles_async(request_type=dict) - - def test_list_connection_profiles_field_headers(): client = DatastreamClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1840,8 +1858,8 @@ async def test_list_connection_profiles_async_pages(): @pytest.mark.parametrize( "request_type", [ - datastream.GetConnectionProfileRequest, - dict, + datastream.GetConnectionProfileRequest(), + {}, ], ) def test_get_connection_profile(request_type, transport: str = "grpc"): @@ -1852,7 +1870,7 @@ def test_get_connection_profile(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1906,9 +1924,10 @@ def test_get_connection_profile_non_empty_request_with_auto_populated_field(): client.get_connection_profile(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datastream.GetConnectionProfileRequest( + request_msg = datastream.GetConnectionProfileRequest( name="name_value", ) + assert args[0] == request_msg def test_get_connection_profile_use_cached_wrapped_rpc(): @@ -1994,8 +2013,15 @@ async def test_get_connection_profile_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + datastream.GetConnectionProfileRequest(), + {}, + ], +) async def test_get_connection_profile_async( - transport: str = "grpc_asyncio", request_type=datastream.GetConnectionProfileRequest + request_type, transport: str = "grpc_asyncio" ): client = DatastreamAsyncClient( credentials=async_anonymous_credentials(), @@ -2004,7 +2030,7 @@ async def test_get_connection_profile_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( @@ -2035,11 +2061,6 @@ async def test_get_connection_profile_async( assert response.satisfies_pzi is True -@pytest.mark.asyncio -async def test_get_connection_profile_async_from_dict(): - await test_get_connection_profile_async(request_type=dict) - - def test_get_connection_profile_field_headers(): client = DatastreamClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2194,8 +2215,8 @@ async def test_get_connection_profile_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datastream.CreateConnectionProfileRequest, - dict, + datastream.CreateConnectionProfileRequest(), + {}, ], ) def test_create_connection_profile(request_type, transport: str = "grpc"): @@ -2206,7 +2227,7 @@ def test_create_connection_profile(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2253,11 +2274,12 @@ def test_create_connection_profile_non_empty_request_with_auto_populated_field() client.create_connection_profile(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datastream.CreateConnectionProfileRequest( + request_msg = datastream.CreateConnectionProfileRequest( parent="parent_value", connection_profile_id="connection_profile_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_connection_profile_use_cached_wrapped_rpc(): @@ -2353,9 +2375,15 @@ async def test_create_connection_profile_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + datastream.CreateConnectionProfileRequest(), + {}, + ], +) async def test_create_connection_profile_async( - transport: str = "grpc_asyncio", - request_type=datastream.CreateConnectionProfileRequest, + request_type, transport: str = "grpc_asyncio" ): client = DatastreamAsyncClient( credentials=async_anonymous_credentials(), @@ -2364,7 +2392,7 @@ async def test_create_connection_profile_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( @@ -2386,11 +2414,6 @@ async def test_create_connection_profile_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_connection_profile_async_from_dict(): - await test_create_connection_profile_async(request_type=dict) - - def test_create_connection_profile_field_headers(): client = DatastreamClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2573,8 +2596,8 @@ async def test_create_connection_profile_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datastream.UpdateConnectionProfileRequest, - dict, + datastream.UpdateConnectionProfileRequest(), + {}, ], ) def test_update_connection_profile(request_type, transport: str = "grpc"): @@ -2585,7 +2608,7 @@ def test_update_connection_profile(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2630,9 +2653,10 @@ def test_update_connection_profile_non_empty_request_with_auto_populated_field() client.update_connection_profile(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datastream.UpdateConnectionProfileRequest( + request_msg = datastream.UpdateConnectionProfileRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_connection_profile_use_cached_wrapped_rpc(): @@ -2728,9 +2752,15 @@ async def test_update_connection_profile_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + datastream.UpdateConnectionProfileRequest(), + {}, + ], +) async def test_update_connection_profile_async( - transport: str = "grpc_asyncio", - request_type=datastream.UpdateConnectionProfileRequest, + request_type, transport: str = "grpc_asyncio" ): client = DatastreamAsyncClient( credentials=async_anonymous_credentials(), @@ -2739,7 +2769,7 @@ async def test_update_connection_profile_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( @@ -2761,11 +2791,6 @@ async def test_update_connection_profile_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_connection_profile_async_from_dict(): - await test_update_connection_profile_async(request_type=dict) - - def test_update_connection_profile_field_headers(): client = DatastreamClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2938,8 +2963,8 @@ async def test_update_connection_profile_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datastream.DeleteConnectionProfileRequest, - dict, + datastream.DeleteConnectionProfileRequest(), + {}, ], ) def test_delete_connection_profile(request_type, transport: str = "grpc"): @@ -2950,7 +2975,7 @@ def test_delete_connection_profile(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2996,10 +3021,11 @@ def test_delete_connection_profile_non_empty_request_with_auto_populated_field() client.delete_connection_profile(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datastream.DeleteConnectionProfileRequest( + request_msg = datastream.DeleteConnectionProfileRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_connection_profile_use_cached_wrapped_rpc(): @@ -3095,9 +3121,15 @@ async def test_delete_connection_profile_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + datastream.DeleteConnectionProfileRequest(), + {}, + ], +) async def test_delete_connection_profile_async( - transport: str = "grpc_asyncio", - request_type=datastream.DeleteConnectionProfileRequest, + request_type, transport: str = "grpc_asyncio" ): client = DatastreamAsyncClient( credentials=async_anonymous_credentials(), @@ -3106,7 +3138,7 @@ async def test_delete_connection_profile_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( @@ -3128,11 +3160,6 @@ async def test_delete_connection_profile_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_connection_profile_async_from_dict(): - await test_delete_connection_profile_async(request_type=dict) - - def test_delete_connection_profile_field_headers(): client = DatastreamClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3287,8 +3314,8 @@ async def test_delete_connection_profile_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datastream.DiscoverConnectionProfileRequest, - dict, + datastream.DiscoverConnectionProfileRequest(), + {}, ], ) def test_discover_connection_profile(request_type, transport: str = "grpc"): @@ -3299,7 +3326,7 @@ def test_discover_connection_profile(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3345,10 +3372,11 @@ def test_discover_connection_profile_non_empty_request_with_auto_populated_field client.discover_connection_profile(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datastream.DiscoverConnectionProfileRequest( + request_msg = datastream.DiscoverConnectionProfileRequest( parent="parent_value", connection_profile_name="connection_profile_name_value", ) + assert args[0] == request_msg def test_discover_connection_profile_use_cached_wrapped_rpc(): @@ -3434,9 +3462,15 @@ async def test_discover_connection_profile_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + datastream.DiscoverConnectionProfileRequest(), + {}, + ], +) async def test_discover_connection_profile_async( - transport: str = "grpc_asyncio", - request_type=datastream.DiscoverConnectionProfileRequest, + request_type, transport: str = "grpc_asyncio" ): client = DatastreamAsyncClient( credentials=async_anonymous_credentials(), @@ -3445,7 +3479,7 @@ async def test_discover_connection_profile_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( @@ -3467,11 +3501,6 @@ async def test_discover_connection_profile_async( assert isinstance(response, datastream.DiscoverConnectionProfileResponse) -@pytest.mark.asyncio -async def test_discover_connection_profile_async_from_dict(): - await test_discover_connection_profile_async(request_type=dict) - - def test_discover_connection_profile_field_headers(): client = DatastreamClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3540,8 +3569,8 @@ async def test_discover_connection_profile_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - datastream.ListStreamsRequest, - dict, + datastream.ListStreamsRequest(), + {}, ], ) def test_list_streams(request_type, transport: str = "grpc"): @@ -3552,7 +3581,7 @@ def test_list_streams(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_streams), "__call__") as call: @@ -3601,12 +3630,13 @@ def test_list_streams_non_empty_request_with_auto_populated_field(): client.list_streams(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datastream.ListStreamsRequest( + request_msg = datastream.ListStreamsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_streams_use_cached_wrapped_rpc(): @@ -3687,9 +3717,14 @@ async def test_list_streams_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_streams_async( - transport: str = "grpc_asyncio", request_type=datastream.ListStreamsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datastream.ListStreamsRequest(), + {}, + ], +) +async def test_list_streams_async(request_type, transport: str = "grpc_asyncio"): client = DatastreamAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3697,7 +3732,7 @@ async def test_list_streams_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_streams), "__call__") as call: @@ -3722,11 +3757,6 @@ async def test_list_streams_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_streams_async_from_dict(): - await test_list_streams_async(request_type=dict) - - def test_list_streams_field_headers(): client = DatastreamClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4063,8 +4093,8 @@ async def test_list_streams_async_pages(): @pytest.mark.parametrize( "request_type", [ - datastream.GetStreamRequest, - dict, + datastream.GetStreamRequest(), + {}, ], ) def test_get_stream(request_type, transport: str = "grpc"): @@ -4075,7 +4105,7 @@ def test_get_stream(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_stream), "__call__") as call: @@ -4132,9 +4162,10 @@ def test_get_stream_non_empty_request_with_auto_populated_field(): client.get_stream(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datastream.GetStreamRequest( + request_msg = datastream.GetStreamRequest( name="name_value", ) + assert args[0] == request_msg def test_get_stream_use_cached_wrapped_rpc(): @@ -4213,9 +4244,14 @@ async def test_get_stream_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_stream_async( - transport: str = "grpc_asyncio", request_type=datastream.GetStreamRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datastream.GetStreamRequest(), + {}, + ], +) +async def test_get_stream_async(request_type, transport: str = "grpc_asyncio"): client = DatastreamAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4223,7 +4259,7 @@ async def test_get_stream_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_stream), "__call__") as call: @@ -4259,11 +4295,6 @@ async def test_get_stream_async( assert response.satisfies_pzi is True -@pytest.mark.asyncio -async def test_get_stream_async_from_dict(): - await test_get_stream_async(request_type=dict) - - def test_get_stream_field_headers(): client = DatastreamClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4410,8 +4441,8 @@ async def test_get_stream_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datastream.CreateStreamRequest, - dict, + datastream.CreateStreamRequest(), + {}, ], ) def test_create_stream(request_type, transport: str = "grpc"): @@ -4422,7 +4453,7 @@ def test_create_stream(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_stream), "__call__") as call: @@ -4465,11 +4496,12 @@ def test_create_stream_non_empty_request_with_auto_populated_field(): client.create_stream(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datastream.CreateStreamRequest( + request_msg = datastream.CreateStreamRequest( parent="parent_value", stream_id="stream_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_stream_use_cached_wrapped_rpc(): @@ -4560,9 +4592,14 @@ async def test_create_stream_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_stream_async( - transport: str = "grpc_asyncio", request_type=datastream.CreateStreamRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datastream.CreateStreamRequest(), + {}, + ], +) +async def test_create_stream_async(request_type, transport: str = "grpc_asyncio"): client = DatastreamAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4570,7 +4607,7 @@ async def test_create_stream_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_stream), "__call__") as call: @@ -4590,11 +4627,6 @@ async def test_create_stream_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_stream_async_from_dict(): - await test_create_stream_async(request_type=dict) - - def test_create_stream_field_headers(): client = DatastreamClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4761,8 +4793,8 @@ async def test_create_stream_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datastream.UpdateStreamRequest, - dict, + datastream.UpdateStreamRequest(), + {}, ], ) def test_update_stream(request_type, transport: str = "grpc"): @@ -4773,7 +4805,7 @@ def test_update_stream(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_stream), "__call__") as call: @@ -4814,9 +4846,10 @@ def test_update_stream_non_empty_request_with_auto_populated_field(): client.update_stream(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datastream.UpdateStreamRequest( + request_msg = datastream.UpdateStreamRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_stream_use_cached_wrapped_rpc(): @@ -4907,9 +4940,14 @@ async def test_update_stream_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_stream_async( - transport: str = "grpc_asyncio", request_type=datastream.UpdateStreamRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datastream.UpdateStreamRequest(), + {}, + ], +) +async def test_update_stream_async(request_type, transport: str = "grpc_asyncio"): client = DatastreamAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4917,7 +4955,7 @@ async def test_update_stream_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_stream), "__call__") as call: @@ -4937,11 +4975,6 @@ async def test_update_stream_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_stream_async_from_dict(): - await test_update_stream_async(request_type=dict) - - def test_update_stream_field_headers(): client = DatastreamClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5098,8 +5131,8 @@ async def test_update_stream_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datastream.DeleteStreamRequest, - dict, + datastream.DeleteStreamRequest(), + {}, ], ) def test_delete_stream(request_type, transport: str = "grpc"): @@ -5110,7 +5143,7 @@ def test_delete_stream(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_stream), "__call__") as call: @@ -5152,10 +5185,11 @@ def test_delete_stream_non_empty_request_with_auto_populated_field(): client.delete_stream(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datastream.DeleteStreamRequest( + request_msg = datastream.DeleteStreamRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_stream_use_cached_wrapped_rpc(): @@ -5246,9 +5280,14 @@ async def test_delete_stream_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_stream_async( - transport: str = "grpc_asyncio", request_type=datastream.DeleteStreamRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datastream.DeleteStreamRequest(), + {}, + ], +) +async def test_delete_stream_async(request_type, transport: str = "grpc_asyncio"): client = DatastreamAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5256,7 +5295,7 @@ async def test_delete_stream_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_stream), "__call__") as call: @@ -5276,11 +5315,6 @@ async def test_delete_stream_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_stream_async_from_dict(): - await test_delete_stream_async(request_type=dict) - - def test_delete_stream_field_headers(): client = DatastreamClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5427,8 +5461,8 @@ async def test_delete_stream_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datastream.RunStreamRequest, - dict, + datastream.RunStreamRequest(), + {}, ], ) def test_run_stream(request_type, transport: str = "grpc"): @@ -5439,7 +5473,7 @@ def test_run_stream(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.run_stream), "__call__") as call: @@ -5480,9 +5514,10 @@ def test_run_stream_non_empty_request_with_auto_populated_field(): client.run_stream(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datastream.RunStreamRequest( + request_msg = datastream.RunStreamRequest( name="name_value", ) + assert args[0] == request_msg def test_run_stream_use_cached_wrapped_rpc(): @@ -5571,9 +5606,14 @@ async def test_run_stream_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_run_stream_async( - transport: str = "grpc_asyncio", request_type=datastream.RunStreamRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datastream.RunStreamRequest(), + {}, + ], +) +async def test_run_stream_async(request_type, transport: str = "grpc_asyncio"): client = DatastreamAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5581,7 +5621,7 @@ async def test_run_stream_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.run_stream), "__call__") as call: @@ -5601,11 +5641,6 @@ async def test_run_stream_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_run_stream_async_from_dict(): - await test_run_stream_async(request_type=dict) - - def test_run_stream_field_headers(): client = DatastreamClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5670,8 +5705,8 @@ async def test_run_stream_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - datastream.GetStreamObjectRequest, - dict, + datastream.GetStreamObjectRequest(), + {}, ], ) def test_get_stream_object(request_type, transport: str = "grpc"): @@ -5682,7 +5717,7 @@ def test_get_stream_object(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5732,9 +5767,10 @@ def test_get_stream_object_non_empty_request_with_auto_populated_field(): client.get_stream_object(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datastream.GetStreamObjectRequest( + request_msg = datastream.GetStreamObjectRequest( name="name_value", ) + assert args[0] == request_msg def test_get_stream_object_use_cached_wrapped_rpc(): @@ -5817,9 +5853,14 @@ async def test_get_stream_object_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_stream_object_async( - transport: str = "grpc_asyncio", request_type=datastream.GetStreamObjectRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datastream.GetStreamObjectRequest(), + {}, + ], +) +async def test_get_stream_object_async(request_type, transport: str = "grpc_asyncio"): client = DatastreamAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5827,7 +5868,7 @@ async def test_get_stream_object_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( @@ -5854,11 +5895,6 @@ async def test_get_stream_object_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_get_stream_object_async_from_dict(): - await test_get_stream_object_async(request_type=dict) - - def test_get_stream_object_field_headers(): client = DatastreamClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6013,8 +6049,8 @@ async def test_get_stream_object_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datastream.LookupStreamObjectRequest, - dict, + datastream.LookupStreamObjectRequest(), + {}, ], ) def test_lookup_stream_object(request_type, transport: str = "grpc"): @@ -6025,7 +6061,7 @@ def test_lookup_stream_object(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6075,9 +6111,10 @@ def test_lookup_stream_object_non_empty_request_with_auto_populated_field(): client.lookup_stream_object(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datastream.LookupStreamObjectRequest( + request_msg = datastream.LookupStreamObjectRequest( parent="parent_value", ) + assert args[0] == request_msg def test_lookup_stream_object_use_cached_wrapped_rpc(): @@ -6162,8 +6199,15 @@ async def test_lookup_stream_object_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + datastream.LookupStreamObjectRequest(), + {}, + ], +) async def test_lookup_stream_object_async( - transport: str = "grpc_asyncio", request_type=datastream.LookupStreamObjectRequest + request_type, transport: str = "grpc_asyncio" ): client = DatastreamAsyncClient( credentials=async_anonymous_credentials(), @@ -6172,7 +6216,7 @@ async def test_lookup_stream_object_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( @@ -6199,11 +6243,6 @@ async def test_lookup_stream_object_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_lookup_stream_object_async_from_dict(): - await test_lookup_stream_object_async(request_type=dict) - - def test_lookup_stream_object_field_headers(): client = DatastreamClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6272,8 +6311,8 @@ async def test_lookup_stream_object_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - datastream.ListStreamObjectsRequest, - dict, + datastream.ListStreamObjectsRequest(), + {}, ], ) def test_list_stream_objects(request_type, transport: str = "grpc"): @@ -6284,7 +6323,7 @@ def test_list_stream_objects(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6333,10 +6372,11 @@ def test_list_stream_objects_non_empty_request_with_auto_populated_field(): client.list_stream_objects(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datastream.ListStreamObjectsRequest( + request_msg = datastream.ListStreamObjectsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_stream_objects_use_cached_wrapped_rpc(): @@ -6421,9 +6461,14 @@ async def test_list_stream_objects_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_stream_objects_async( - transport: str = "grpc_asyncio", request_type=datastream.ListStreamObjectsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datastream.ListStreamObjectsRequest(), + {}, + ], +) +async def test_list_stream_objects_async(request_type, transport: str = "grpc_asyncio"): client = DatastreamAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6431,7 +6476,7 @@ async def test_list_stream_objects_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( @@ -6456,11 +6501,6 @@ async def test_list_stream_objects_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_stream_objects_async_from_dict(): - await test_list_stream_objects_async(request_type=dict) - - def test_list_stream_objects_field_headers(): client = DatastreamClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6813,8 +6853,8 @@ async def test_list_stream_objects_async_pages(): @pytest.mark.parametrize( "request_type", [ - datastream.StartBackfillJobRequest, - dict, + datastream.StartBackfillJobRequest(), + {}, ], ) def test_start_backfill_job(request_type, transport: str = "grpc"): @@ -6825,7 +6865,7 @@ def test_start_backfill_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( @@ -6870,9 +6910,10 @@ def test_start_backfill_job_non_empty_request_with_auto_populated_field(): client.start_backfill_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datastream.StartBackfillJobRequest( + request_msg = datastream.StartBackfillJobRequest( object_="object__value", ) + assert args[0] == request_msg def test_start_backfill_job_use_cached_wrapped_rpc(): @@ -6957,9 +6998,14 @@ async def test_start_backfill_job_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_start_backfill_job_async( - transport: str = "grpc_asyncio", request_type=datastream.StartBackfillJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datastream.StartBackfillJobRequest(), + {}, + ], +) +async def test_start_backfill_job_async(request_type, transport: str = "grpc_asyncio"): client = DatastreamAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6967,7 +7013,7 @@ async def test_start_backfill_job_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( @@ -6989,11 +7035,6 @@ async def test_start_backfill_job_async( assert isinstance(response, datastream.StartBackfillJobResponse) -@pytest.mark.asyncio -async def test_start_backfill_job_async_from_dict(): - await test_start_backfill_job_async(request_type=dict) - - def test_start_backfill_job_field_headers(): client = DatastreamClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7148,8 +7189,8 @@ async def test_start_backfill_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datastream.StopBackfillJobRequest, - dict, + datastream.StopBackfillJobRequest(), + {}, ], ) def test_stop_backfill_job(request_type, transport: str = "grpc"): @@ -7160,7 +7201,7 @@ def test_stop_backfill_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( @@ -7205,9 +7246,10 @@ def test_stop_backfill_job_non_empty_request_with_auto_populated_field(): client.stop_backfill_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datastream.StopBackfillJobRequest( + request_msg = datastream.StopBackfillJobRequest( object_="object__value", ) + assert args[0] == request_msg def test_stop_backfill_job_use_cached_wrapped_rpc(): @@ -7290,9 +7332,14 @@ async def test_stop_backfill_job_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_stop_backfill_job_async( - transport: str = "grpc_asyncio", request_type=datastream.StopBackfillJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datastream.StopBackfillJobRequest(), + {}, + ], +) +async def test_stop_backfill_job_async(request_type, transport: str = "grpc_asyncio"): client = DatastreamAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7300,7 +7347,7 @@ async def test_stop_backfill_job_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( @@ -7322,11 +7369,6 @@ async def test_stop_backfill_job_async( assert isinstance(response, datastream.StopBackfillJobResponse) -@pytest.mark.asyncio -async def test_stop_backfill_job_async_from_dict(): - await test_stop_backfill_job_async(request_type=dict) - - def test_stop_backfill_job_field_headers(): client = DatastreamClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7481,8 +7523,8 @@ async def test_stop_backfill_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datastream.FetchStaticIpsRequest, - dict, + datastream.FetchStaticIpsRequest(), + {}, ], ) def test_fetch_static_ips(request_type, transport: str = "grpc"): @@ -7493,7 +7535,7 @@ def test_fetch_static_ips(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.fetch_static_ips), "__call__") as call: @@ -7540,10 +7582,11 @@ def test_fetch_static_ips_non_empty_request_with_auto_populated_field(): client.fetch_static_ips(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datastream.FetchStaticIpsRequest( + request_msg = datastream.FetchStaticIpsRequest( name="name_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_fetch_static_ips_use_cached_wrapped_rpc(): @@ -7626,9 +7669,14 @@ async def test_fetch_static_ips_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_fetch_static_ips_async( - transport: str = "grpc_asyncio", request_type=datastream.FetchStaticIpsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datastream.FetchStaticIpsRequest(), + {}, + ], +) +async def test_fetch_static_ips_async(request_type, transport: str = "grpc_asyncio"): client = DatastreamAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7636,7 +7684,7 @@ async def test_fetch_static_ips_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.fetch_static_ips), "__call__") as call: @@ -7661,11 +7709,6 @@ async def test_fetch_static_ips_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_fetch_static_ips_async_from_dict(): - await test_fetch_static_ips_async(request_type=dict) - - def test_fetch_static_ips_field_headers(): client = DatastreamClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8002,8 +8045,8 @@ async def test_fetch_static_ips_async_pages(): @pytest.mark.parametrize( "request_type", [ - datastream.CreatePrivateConnectionRequest, - dict, + datastream.CreatePrivateConnectionRequest(), + {}, ], ) def test_create_private_connection(request_type, transport: str = "grpc"): @@ -8014,7 +8057,7 @@ def test_create_private_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( @@ -8061,11 +8104,12 @@ def test_create_private_connection_non_empty_request_with_auto_populated_field() client.create_private_connection(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datastream.CreatePrivateConnectionRequest( + request_msg = datastream.CreatePrivateConnectionRequest( parent="parent_value", private_connection_id="private_connection_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_private_connection_use_cached_wrapped_rpc(): @@ -8161,9 +8205,15 @@ async def test_create_private_connection_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + datastream.CreatePrivateConnectionRequest(), + {}, + ], +) async def test_create_private_connection_async( - transport: str = "grpc_asyncio", - request_type=datastream.CreatePrivateConnectionRequest, + request_type, transport: str = "grpc_asyncio" ): client = DatastreamAsyncClient( credentials=async_anonymous_credentials(), @@ -8172,7 +8222,7 @@ async def test_create_private_connection_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( @@ -8194,11 +8244,6 @@ async def test_create_private_connection_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_private_connection_async_from_dict(): - await test_create_private_connection_async(request_type=dict) - - def test_create_private_connection_field_headers(): client = DatastreamClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8381,8 +8426,8 @@ async def test_create_private_connection_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datastream.GetPrivateConnectionRequest, - dict, + datastream.GetPrivateConnectionRequest(), + {}, ], ) def test_get_private_connection(request_type, transport: str = "grpc"): @@ -8393,7 +8438,7 @@ def test_get_private_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( @@ -8449,9 +8494,10 @@ def test_get_private_connection_non_empty_request_with_auto_populated_field(): client.get_private_connection(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datastream.GetPrivateConnectionRequest( + request_msg = datastream.GetPrivateConnectionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_private_connection_use_cached_wrapped_rpc(): @@ -8537,8 +8583,15 @@ async def test_get_private_connection_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + datastream.GetPrivateConnectionRequest(), + {}, + ], +) async def test_get_private_connection_async( - transport: str = "grpc_asyncio", request_type=datastream.GetPrivateConnectionRequest + request_type, transport: str = "grpc_asyncio" ): client = DatastreamAsyncClient( credentials=async_anonymous_credentials(), @@ -8547,7 +8600,7 @@ async def test_get_private_connection_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( @@ -8580,11 +8633,6 @@ async def test_get_private_connection_async( assert response.satisfies_pzi is True -@pytest.mark.asyncio -async def test_get_private_connection_async_from_dict(): - await test_get_private_connection_async(request_type=dict) - - def test_get_private_connection_field_headers(): client = DatastreamClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8739,8 +8787,8 @@ async def test_get_private_connection_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datastream.ListPrivateConnectionsRequest, - dict, + datastream.ListPrivateConnectionsRequest(), + {}, ], ) def test_list_private_connections(request_type, transport: str = "grpc"): @@ -8751,7 +8799,7 @@ def test_list_private_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( @@ -8804,12 +8852,13 @@ def test_list_private_connections_non_empty_request_with_auto_populated_field(): client.list_private_connections(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datastream.ListPrivateConnectionsRequest( + request_msg = datastream.ListPrivateConnectionsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_private_connections_use_cached_wrapped_rpc(): @@ -8895,9 +8944,15 @@ async def test_list_private_connections_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + datastream.ListPrivateConnectionsRequest(), + {}, + ], +) async def test_list_private_connections_async( - transport: str = "grpc_asyncio", - request_type=datastream.ListPrivateConnectionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = DatastreamAsyncClient( credentials=async_anonymous_credentials(), @@ -8906,7 +8961,7 @@ async def test_list_private_connections_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( @@ -8933,11 +8988,6 @@ async def test_list_private_connections_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_private_connections_async_from_dict(): - await test_list_private_connections_async(request_type=dict) - - def test_list_private_connections_field_headers(): client = DatastreamClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9296,8 +9346,8 @@ async def test_list_private_connections_async_pages(): @pytest.mark.parametrize( "request_type", [ - datastream.DeletePrivateConnectionRequest, - dict, + datastream.DeletePrivateConnectionRequest(), + {}, ], ) def test_delete_private_connection(request_type, transport: str = "grpc"): @@ -9308,7 +9358,7 @@ def test_delete_private_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( @@ -9354,10 +9404,11 @@ def test_delete_private_connection_non_empty_request_with_auto_populated_field() client.delete_private_connection(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datastream.DeletePrivateConnectionRequest( + request_msg = datastream.DeletePrivateConnectionRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_private_connection_use_cached_wrapped_rpc(): @@ -9453,9 +9504,15 @@ async def test_delete_private_connection_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + datastream.DeletePrivateConnectionRequest(), + {}, + ], +) async def test_delete_private_connection_async( - transport: str = "grpc_asyncio", - request_type=datastream.DeletePrivateConnectionRequest, + request_type, transport: str = "grpc_asyncio" ): client = DatastreamAsyncClient( credentials=async_anonymous_credentials(), @@ -9464,7 +9521,7 @@ async def test_delete_private_connection_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( @@ -9486,11 +9543,6 @@ async def test_delete_private_connection_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_private_connection_async_from_dict(): - await test_delete_private_connection_async(request_type=dict) - - def test_delete_private_connection_field_headers(): client = DatastreamClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9645,8 +9697,8 @@ async def test_delete_private_connection_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datastream.CreateRouteRequest, - dict, + datastream.CreateRouteRequest(), + {}, ], ) def test_create_route(request_type, transport: str = "grpc"): @@ -9657,7 +9709,7 @@ def test_create_route(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_route), "__call__") as call: @@ -9700,11 +9752,12 @@ def test_create_route_non_empty_request_with_auto_populated_field(): client.create_route(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datastream.CreateRouteRequest( + request_msg = datastream.CreateRouteRequest( parent="parent_value", route_id="route_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_route_use_cached_wrapped_rpc(): @@ -9795,9 +9848,14 @@ async def test_create_route_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_route_async( - transport: str = "grpc_asyncio", request_type=datastream.CreateRouteRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datastream.CreateRouteRequest(), + {}, + ], +) +async def test_create_route_async(request_type, transport: str = "grpc_asyncio"): client = DatastreamAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9805,7 +9863,7 @@ async def test_create_route_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_route), "__call__") as call: @@ -9825,11 +9883,6 @@ async def test_create_route_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_route_async_from_dict(): - await test_create_route_async(request_type=dict) - - def test_create_route_field_headers(): client = DatastreamClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9996,8 +10049,8 @@ async def test_create_route_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datastream.GetRouteRequest, - dict, + datastream.GetRouteRequest(), + {}, ], ) def test_get_route(request_type, transport: str = "grpc"): @@ -10008,7 +10061,7 @@ def test_get_route(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_route), "__call__") as call: @@ -10058,9 +10111,10 @@ def test_get_route_non_empty_request_with_auto_populated_field(): client.get_route(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datastream.GetRouteRequest( + request_msg = datastream.GetRouteRequest( name="name_value", ) + assert args[0] == request_msg def test_get_route_use_cached_wrapped_rpc(): @@ -10139,9 +10193,14 @@ async def test_get_route_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_route_async( - transport: str = "grpc_asyncio", request_type=datastream.GetRouteRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datastream.GetRouteRequest(), + {}, + ], +) +async def test_get_route_async(request_type, transport: str = "grpc_asyncio"): client = DatastreamAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10149,7 +10208,7 @@ async def test_get_route_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_route), "__call__") as call: @@ -10178,11 +10237,6 @@ async def test_get_route_async( assert response.destination_port == 1734 -@pytest.mark.asyncio -async def test_get_route_async_from_dict(): - await test_get_route_async(request_type=dict) - - def test_get_route_field_headers(): client = DatastreamClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10329,8 +10383,8 @@ async def test_get_route_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datastream.ListRoutesRequest, - dict, + datastream.ListRoutesRequest(), + {}, ], ) def test_list_routes(request_type, transport: str = "grpc"): @@ -10341,7 +10395,7 @@ def test_list_routes(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_routes), "__call__") as call: @@ -10390,12 +10444,13 @@ def test_list_routes_non_empty_request_with_auto_populated_field(): client.list_routes(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datastream.ListRoutesRequest( + request_msg = datastream.ListRoutesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_routes_use_cached_wrapped_rpc(): @@ -10476,9 +10531,14 @@ async def test_list_routes_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_routes_async( - transport: str = "grpc_asyncio", request_type=datastream.ListRoutesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datastream.ListRoutesRequest(), + {}, + ], +) +async def test_list_routes_async(request_type, transport: str = "grpc_asyncio"): client = DatastreamAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10486,7 +10546,7 @@ async def test_list_routes_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_routes), "__call__") as call: @@ -10511,11 +10571,6 @@ async def test_list_routes_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_routes_async_from_dict(): - await test_list_routes_async(request_type=dict) - - def test_list_routes_field_headers(): client = DatastreamClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10852,8 +10907,8 @@ async def test_list_routes_async_pages(): @pytest.mark.parametrize( "request_type", [ - datastream.DeleteRouteRequest, - dict, + datastream.DeleteRouteRequest(), + {}, ], ) def test_delete_route(request_type, transport: str = "grpc"): @@ -10864,7 +10919,7 @@ def test_delete_route(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_route), "__call__") as call: @@ -10906,10 +10961,11 @@ def test_delete_route_non_empty_request_with_auto_populated_field(): client.delete_route(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datastream.DeleteRouteRequest( + request_msg = datastream.DeleteRouteRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_route_use_cached_wrapped_rpc(): @@ -11000,9 +11056,14 @@ async def test_delete_route_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_route_async( - transport: str = "grpc_asyncio", request_type=datastream.DeleteRouteRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datastream.DeleteRouteRequest(), + {}, + ], +) +async def test_delete_route_async(request_type, transport: str = "grpc_asyncio"): client = DatastreamAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11010,7 +11071,7 @@ async def test_delete_route_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_route), "__call__") as call: @@ -11030,11 +11091,6 @@ async def test_delete_route_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_route_async_from_dict(): - await test_delete_route_async(request_type=dict) - - def test_delete_route_field_headers(): client = DatastreamClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16568,7 +16624,6 @@ def test_list_connection_profiles_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.ListConnectionProfilesRequest() - assert args[0] == request_msg @@ -16591,7 +16646,6 @@ def test_get_connection_profile_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.GetConnectionProfileRequest() - assert args[0] == request_msg @@ -16614,7 +16668,6 @@ def test_create_connection_profile_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.CreateConnectionProfileRequest() - assert args[0] == request_msg @@ -16637,7 +16690,6 @@ def test_update_connection_profile_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.UpdateConnectionProfileRequest() - assert args[0] == request_msg @@ -16660,7 +16712,6 @@ def test_delete_connection_profile_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.DeleteConnectionProfileRequest() - assert args[0] == request_msg @@ -16683,7 +16734,6 @@ def test_discover_connection_profile_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.DiscoverConnectionProfileRequest() - assert args[0] == request_msg @@ -16704,7 +16754,6 @@ def test_list_streams_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.ListStreamsRequest() - assert args[0] == request_msg @@ -16725,7 +16774,6 @@ def test_get_stream_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.GetStreamRequest() - assert args[0] == request_msg @@ -16746,7 +16794,6 @@ def test_create_stream_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.CreateStreamRequest() - assert args[0] == request_msg @@ -16767,7 +16814,6 @@ def test_update_stream_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.UpdateStreamRequest() - assert args[0] == request_msg @@ -16788,7 +16834,6 @@ def test_delete_stream_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.DeleteStreamRequest() - assert args[0] == request_msg @@ -16809,7 +16854,6 @@ def test_run_stream_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.RunStreamRequest() - assert args[0] == request_msg @@ -16832,7 +16876,6 @@ def test_get_stream_object_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.GetStreamObjectRequest() - assert args[0] == request_msg @@ -16855,7 +16898,6 @@ def test_lookup_stream_object_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.LookupStreamObjectRequest() - assert args[0] == request_msg @@ -16878,7 +16920,6 @@ def test_list_stream_objects_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.ListStreamObjectsRequest() - assert args[0] == request_msg @@ -16901,7 +16942,6 @@ def test_start_backfill_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.StartBackfillJobRequest() - assert args[0] == request_msg @@ -16924,7 +16964,6 @@ def test_stop_backfill_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.StopBackfillJobRequest() - assert args[0] == request_msg @@ -16945,7 +16984,6 @@ def test_fetch_static_ips_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.FetchStaticIpsRequest() - assert args[0] == request_msg @@ -16968,7 +17006,6 @@ def test_create_private_connection_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.CreatePrivateConnectionRequest() - assert args[0] == request_msg @@ -16991,7 +17028,6 @@ def test_get_private_connection_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.GetPrivateConnectionRequest() - assert args[0] == request_msg @@ -17014,7 +17050,6 @@ def test_list_private_connections_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.ListPrivateConnectionsRequest() - assert args[0] == request_msg @@ -17037,7 +17072,6 @@ def test_delete_private_connection_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.DeletePrivateConnectionRequest() - assert args[0] == request_msg @@ -17058,7 +17092,6 @@ def test_create_route_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.CreateRouteRequest() - assert args[0] == request_msg @@ -17079,7 +17112,6 @@ def test_get_route_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.GetRouteRequest() - assert args[0] == request_msg @@ -17100,7 +17132,6 @@ def test_list_routes_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.ListRoutesRequest() - assert args[0] == request_msg @@ -17121,7 +17152,6 @@ def test_delete_route_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.DeleteRouteRequest() - assert args[0] == request_msg @@ -17165,7 +17195,6 @@ async def test_list_connection_profiles_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.ListConnectionProfilesRequest() - assert args[0] == request_msg @@ -17197,7 +17226,6 @@ async def test_get_connection_profile_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.GetConnectionProfileRequest() - assert args[0] == request_msg @@ -17224,7 +17252,6 @@ async def test_create_connection_profile_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.CreateConnectionProfileRequest() - assert args[0] == request_msg @@ -17251,7 +17278,6 @@ async def test_update_connection_profile_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.UpdateConnectionProfileRequest() - assert args[0] == request_msg @@ -17278,7 +17304,6 @@ async def test_delete_connection_profile_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.DeleteConnectionProfileRequest() - assert args[0] == request_msg @@ -17305,7 +17330,6 @@ async def test_discover_connection_profile_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.DiscoverConnectionProfileRequest() - assert args[0] == request_msg @@ -17333,7 +17357,6 @@ async def test_list_streams_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.ListStreamsRequest() - assert args[0] == request_msg @@ -17365,7 +17388,6 @@ async def test_get_stream_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.GetStreamRequest() - assert args[0] == request_msg @@ -17390,7 +17412,6 @@ async def test_create_stream_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.CreateStreamRequest() - assert args[0] == request_msg @@ -17415,7 +17436,6 @@ async def test_update_stream_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.UpdateStreamRequest() - assert args[0] == request_msg @@ -17440,7 +17460,6 @@ async def test_delete_stream_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.DeleteStreamRequest() - assert args[0] == request_msg @@ -17465,7 +17484,6 @@ async def test_run_stream_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.RunStreamRequest() - assert args[0] == request_msg @@ -17495,7 +17513,6 @@ async def test_get_stream_object_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.GetStreamObjectRequest() - assert args[0] == request_msg @@ -17525,7 +17542,6 @@ async def test_lookup_stream_object_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.LookupStreamObjectRequest() - assert args[0] == request_msg @@ -17554,7 +17570,6 @@ async def test_list_stream_objects_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.ListStreamObjectsRequest() - assert args[0] == request_msg @@ -17581,7 +17596,6 @@ async def test_start_backfill_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.StartBackfillJobRequest() - assert args[0] == request_msg @@ -17608,7 +17622,6 @@ async def test_stop_backfill_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.StopBackfillJobRequest() - assert args[0] == request_msg @@ -17636,7 +17649,6 @@ async def test_fetch_static_ips_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.FetchStaticIpsRequest() - assert args[0] == request_msg @@ -17663,7 +17675,6 @@ async def test_create_private_connection_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.CreatePrivateConnectionRequest() - assert args[0] == request_msg @@ -17696,7 +17707,6 @@ async def test_get_private_connection_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.GetPrivateConnectionRequest() - assert args[0] == request_msg @@ -17726,7 +17736,6 @@ async def test_list_private_connections_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.ListPrivateConnectionsRequest() - assert args[0] == request_msg @@ -17753,7 +17762,6 @@ async def test_delete_private_connection_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.DeletePrivateConnectionRequest() - assert args[0] == request_msg @@ -17778,7 +17786,6 @@ async def test_create_route_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.CreateRouteRequest() - assert args[0] == request_msg @@ -17808,7 +17815,6 @@ async def test_get_route_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.GetRouteRequest() - assert args[0] == request_msg @@ -17836,7 +17842,6 @@ async def test_list_routes_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.ListRoutesRequest() - assert args[0] == request_msg @@ -17861,7 +17866,6 @@ async def test_delete_route_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.DeleteRouteRequest() - assert args[0] == request_msg @@ -22850,7 +22854,6 @@ def test_list_connection_profiles_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.ListConnectionProfilesRequest() - assert args[0] == request_msg @@ -22872,7 +22875,6 @@ def test_get_connection_profile_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.GetConnectionProfileRequest() - assert args[0] == request_msg @@ -22894,7 +22896,6 @@ def test_create_connection_profile_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.CreateConnectionProfileRequest() - assert args[0] == request_msg @@ -22916,7 +22917,6 @@ def test_update_connection_profile_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.UpdateConnectionProfileRequest() - assert args[0] == request_msg @@ -22938,7 +22938,6 @@ def test_delete_connection_profile_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.DeleteConnectionProfileRequest() - assert args[0] == request_msg @@ -22960,7 +22959,6 @@ def test_discover_connection_profile_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.DiscoverConnectionProfileRequest() - assert args[0] == request_msg @@ -22980,7 +22978,6 @@ def test_list_streams_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.ListStreamsRequest() - assert args[0] == request_msg @@ -23000,7 +22997,6 @@ def test_get_stream_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.GetStreamRequest() - assert args[0] == request_msg @@ -23020,7 +23016,6 @@ def test_create_stream_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.CreateStreamRequest() - assert args[0] == request_msg @@ -23040,7 +23035,6 @@ def test_update_stream_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.UpdateStreamRequest() - assert args[0] == request_msg @@ -23060,7 +23054,6 @@ def test_delete_stream_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.DeleteStreamRequest() - assert args[0] == request_msg @@ -23080,7 +23073,6 @@ def test_run_stream_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.RunStreamRequest() - assert args[0] == request_msg @@ -23102,7 +23094,6 @@ def test_get_stream_object_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.GetStreamObjectRequest() - assert args[0] == request_msg @@ -23124,7 +23115,6 @@ def test_lookup_stream_object_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.LookupStreamObjectRequest() - assert args[0] == request_msg @@ -23146,7 +23136,6 @@ def test_list_stream_objects_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.ListStreamObjectsRequest() - assert args[0] == request_msg @@ -23168,7 +23157,6 @@ def test_start_backfill_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.StartBackfillJobRequest() - assert args[0] == request_msg @@ -23190,7 +23178,6 @@ def test_stop_backfill_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.StopBackfillJobRequest() - assert args[0] == request_msg @@ -23210,7 +23197,6 @@ def test_fetch_static_ips_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.FetchStaticIpsRequest() - assert args[0] == request_msg @@ -23232,7 +23218,6 @@ def test_create_private_connection_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.CreatePrivateConnectionRequest() - assert args[0] == request_msg @@ -23254,7 +23239,6 @@ def test_get_private_connection_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.GetPrivateConnectionRequest() - assert args[0] == request_msg @@ -23276,7 +23260,6 @@ def test_list_private_connections_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.ListPrivateConnectionsRequest() - assert args[0] == request_msg @@ -23298,7 +23281,6 @@ def test_delete_private_connection_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.DeletePrivateConnectionRequest() - assert args[0] == request_msg @@ -23318,7 +23300,6 @@ def test_create_route_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.CreateRouteRequest() - assert args[0] == request_msg @@ -23338,7 +23319,6 @@ def test_get_route_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.GetRouteRequest() - assert args[0] == request_msg @@ -23358,7 +23338,6 @@ def test_list_routes_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.ListRoutesRequest() - assert args[0] == request_msg @@ -23378,7 +23357,6 @@ def test_delete_route_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.DeleteRouteRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-datastream/tests/unit/gapic/datastream_v1alpha1/test_datastream.py b/packages/google-cloud-datastream/tests/unit/gapic/datastream_v1alpha1/test_datastream.py index e51e1a30760e..17056e6b9e4f 100644 --- a/packages/google-cloud-datastream/tests/unit/gapic/datastream_v1alpha1/test_datastream.py +++ b/packages/google-cloud-datastream/tests/unit/gapic/datastream_v1alpha1/test_datastream.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 @@ -116,6 +117,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" @@ -1277,8 +1293,8 @@ def test_datastream_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - datastream.ListConnectionProfilesRequest, - dict, + datastream.ListConnectionProfilesRequest(), + {}, ], ) def test_list_connection_profiles(request_type, transport: str = "grpc"): @@ -1289,7 +1305,7 @@ def test_list_connection_profiles(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1342,12 +1358,13 @@ def test_list_connection_profiles_non_empty_request_with_auto_populated_field(): client.list_connection_profiles(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datastream.ListConnectionProfilesRequest( + request_msg = datastream.ListConnectionProfilesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_connection_profiles_use_cached_wrapped_rpc(): @@ -1433,9 +1450,15 @@ async def test_list_connection_profiles_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + datastream.ListConnectionProfilesRequest(), + {}, + ], +) async def test_list_connection_profiles_async( - transport: str = "grpc_asyncio", - request_type=datastream.ListConnectionProfilesRequest, + request_type, transport: str = "grpc_asyncio" ): client = DatastreamAsyncClient( credentials=async_anonymous_credentials(), @@ -1444,7 +1467,7 @@ async def test_list_connection_profiles_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( @@ -1471,11 +1494,6 @@ async def test_list_connection_profiles_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_connection_profiles_async_from_dict(): - await test_list_connection_profiles_async(request_type=dict) - - def test_list_connection_profiles_field_headers(): client = DatastreamClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1834,8 +1852,8 @@ async def test_list_connection_profiles_async_pages(): @pytest.mark.parametrize( "request_type", [ - datastream.GetConnectionProfileRequest, - dict, + datastream.GetConnectionProfileRequest(), + {}, ], ) def test_get_connection_profile(request_type, transport: str = "grpc"): @@ -1846,7 +1864,7 @@ def test_get_connection_profile(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1896,9 +1914,10 @@ def test_get_connection_profile_non_empty_request_with_auto_populated_field(): client.get_connection_profile(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datastream.GetConnectionProfileRequest( + request_msg = datastream.GetConnectionProfileRequest( name="name_value", ) + assert args[0] == request_msg def test_get_connection_profile_use_cached_wrapped_rpc(): @@ -1984,8 +2003,15 @@ async def test_get_connection_profile_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + datastream.GetConnectionProfileRequest(), + {}, + ], +) async def test_get_connection_profile_async( - transport: str = "grpc_asyncio", request_type=datastream.GetConnectionProfileRequest + request_type, transport: str = "grpc_asyncio" ): client = DatastreamAsyncClient( credentials=async_anonymous_credentials(), @@ -1994,7 +2020,7 @@ async def test_get_connection_profile_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( @@ -2021,11 +2047,6 @@ async def test_get_connection_profile_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_get_connection_profile_async_from_dict(): - await test_get_connection_profile_async(request_type=dict) - - def test_get_connection_profile_field_headers(): client = DatastreamClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2180,8 +2201,8 @@ async def test_get_connection_profile_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datastream.CreateConnectionProfileRequest, - dict, + datastream.CreateConnectionProfileRequest(), + {}, ], ) def test_create_connection_profile(request_type, transport: str = "grpc"): @@ -2192,7 +2213,7 @@ def test_create_connection_profile(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2239,11 +2260,12 @@ def test_create_connection_profile_non_empty_request_with_auto_populated_field() client.create_connection_profile(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datastream.CreateConnectionProfileRequest( + request_msg = datastream.CreateConnectionProfileRequest( parent="parent_value", connection_profile_id="connection_profile_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_connection_profile_use_cached_wrapped_rpc(): @@ -2339,9 +2361,15 @@ async def test_create_connection_profile_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + datastream.CreateConnectionProfileRequest(), + {}, + ], +) async def test_create_connection_profile_async( - transport: str = "grpc_asyncio", - request_type=datastream.CreateConnectionProfileRequest, + request_type, transport: str = "grpc_asyncio" ): client = DatastreamAsyncClient( credentials=async_anonymous_credentials(), @@ -2350,7 +2378,7 @@ async def test_create_connection_profile_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( @@ -2372,11 +2400,6 @@ async def test_create_connection_profile_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_connection_profile_async_from_dict(): - await test_create_connection_profile_async(request_type=dict) - - def test_create_connection_profile_field_headers(): client = DatastreamClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2559,8 +2582,8 @@ async def test_create_connection_profile_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datastream.UpdateConnectionProfileRequest, - dict, + datastream.UpdateConnectionProfileRequest(), + {}, ], ) def test_update_connection_profile(request_type, transport: str = "grpc"): @@ -2571,7 +2594,7 @@ def test_update_connection_profile(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2616,9 +2639,10 @@ def test_update_connection_profile_non_empty_request_with_auto_populated_field() client.update_connection_profile(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datastream.UpdateConnectionProfileRequest( + request_msg = datastream.UpdateConnectionProfileRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_connection_profile_use_cached_wrapped_rpc(): @@ -2714,9 +2738,15 @@ async def test_update_connection_profile_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + datastream.UpdateConnectionProfileRequest(), + {}, + ], +) async def test_update_connection_profile_async( - transport: str = "grpc_asyncio", - request_type=datastream.UpdateConnectionProfileRequest, + request_type, transport: str = "grpc_asyncio" ): client = DatastreamAsyncClient( credentials=async_anonymous_credentials(), @@ -2725,7 +2755,7 @@ async def test_update_connection_profile_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( @@ -2747,11 +2777,6 @@ async def test_update_connection_profile_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_connection_profile_async_from_dict(): - await test_update_connection_profile_async(request_type=dict) - - def test_update_connection_profile_field_headers(): client = DatastreamClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2924,8 +2949,8 @@ async def test_update_connection_profile_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datastream.DeleteConnectionProfileRequest, - dict, + datastream.DeleteConnectionProfileRequest(), + {}, ], ) def test_delete_connection_profile(request_type, transport: str = "grpc"): @@ -2936,7 +2961,7 @@ def test_delete_connection_profile(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2982,10 +3007,11 @@ def test_delete_connection_profile_non_empty_request_with_auto_populated_field() client.delete_connection_profile(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datastream.DeleteConnectionProfileRequest( + request_msg = datastream.DeleteConnectionProfileRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_connection_profile_use_cached_wrapped_rpc(): @@ -3081,9 +3107,15 @@ async def test_delete_connection_profile_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + datastream.DeleteConnectionProfileRequest(), + {}, + ], +) async def test_delete_connection_profile_async( - transport: str = "grpc_asyncio", - request_type=datastream.DeleteConnectionProfileRequest, + request_type, transport: str = "grpc_asyncio" ): client = DatastreamAsyncClient( credentials=async_anonymous_credentials(), @@ -3092,7 +3124,7 @@ async def test_delete_connection_profile_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( @@ -3114,11 +3146,6 @@ async def test_delete_connection_profile_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_connection_profile_async_from_dict(): - await test_delete_connection_profile_async(request_type=dict) - - def test_delete_connection_profile_field_headers(): client = DatastreamClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3273,8 +3300,8 @@ async def test_delete_connection_profile_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datastream.DiscoverConnectionProfileRequest, - dict, + datastream.DiscoverConnectionProfileRequest(), + {}, ], ) def test_discover_connection_profile(request_type, transport: str = "grpc"): @@ -3285,7 +3312,7 @@ def test_discover_connection_profile(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3331,10 +3358,11 @@ def test_discover_connection_profile_non_empty_request_with_auto_populated_field client.discover_connection_profile(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datastream.DiscoverConnectionProfileRequest( + request_msg = datastream.DiscoverConnectionProfileRequest( parent="parent_value", connection_profile_name="connection_profile_name_value", ) + assert args[0] == request_msg def test_discover_connection_profile_use_cached_wrapped_rpc(): @@ -3420,9 +3448,15 @@ async def test_discover_connection_profile_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + datastream.DiscoverConnectionProfileRequest(), + {}, + ], +) async def test_discover_connection_profile_async( - transport: str = "grpc_asyncio", - request_type=datastream.DiscoverConnectionProfileRequest, + request_type, transport: str = "grpc_asyncio" ): client = DatastreamAsyncClient( credentials=async_anonymous_credentials(), @@ -3431,7 +3465,7 @@ async def test_discover_connection_profile_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( @@ -3453,11 +3487,6 @@ async def test_discover_connection_profile_async( assert isinstance(response, datastream.DiscoverConnectionProfileResponse) -@pytest.mark.asyncio -async def test_discover_connection_profile_async_from_dict(): - await test_discover_connection_profile_async(request_type=dict) - - def test_discover_connection_profile_field_headers(): client = DatastreamClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3526,8 +3555,8 @@ async def test_discover_connection_profile_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - datastream.ListStreamsRequest, - dict, + datastream.ListStreamsRequest(), + {}, ], ) def test_list_streams(request_type, transport: str = "grpc"): @@ -3538,7 +3567,7 @@ def test_list_streams(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_streams), "__call__") as call: @@ -3587,12 +3616,13 @@ def test_list_streams_non_empty_request_with_auto_populated_field(): client.list_streams(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datastream.ListStreamsRequest( + request_msg = datastream.ListStreamsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_streams_use_cached_wrapped_rpc(): @@ -3673,9 +3703,14 @@ async def test_list_streams_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_streams_async( - transport: str = "grpc_asyncio", request_type=datastream.ListStreamsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datastream.ListStreamsRequest(), + {}, + ], +) +async def test_list_streams_async(request_type, transport: str = "grpc_asyncio"): client = DatastreamAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3683,7 +3718,7 @@ async def test_list_streams_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_streams), "__call__") as call: @@ -3708,11 +3743,6 @@ async def test_list_streams_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_streams_async_from_dict(): - await test_list_streams_async(request_type=dict) - - def test_list_streams_field_headers(): client = DatastreamClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4049,8 +4079,8 @@ async def test_list_streams_async_pages(): @pytest.mark.parametrize( "request_type", [ - datastream.GetStreamRequest, - dict, + datastream.GetStreamRequest(), + {}, ], ) def test_get_stream(request_type, transport: str = "grpc"): @@ -4061,7 +4091,7 @@ def test_get_stream(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_stream), "__call__") as call: @@ -4109,9 +4139,10 @@ def test_get_stream_non_empty_request_with_auto_populated_field(): client.get_stream(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datastream.GetStreamRequest( + request_msg = datastream.GetStreamRequest( name="name_value", ) + assert args[0] == request_msg def test_get_stream_use_cached_wrapped_rpc(): @@ -4190,9 +4221,14 @@ async def test_get_stream_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_stream_async( - transport: str = "grpc_asyncio", request_type=datastream.GetStreamRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datastream.GetStreamRequest(), + {}, + ], +) +async def test_get_stream_async(request_type, transport: str = "grpc_asyncio"): client = DatastreamAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4200,7 +4236,7 @@ async def test_get_stream_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_stream), "__call__") as call: @@ -4227,11 +4263,6 @@ async def test_get_stream_async( assert response.state == datastream_resources.Stream.State.CREATED -@pytest.mark.asyncio -async def test_get_stream_async_from_dict(): - await test_get_stream_async(request_type=dict) - - def test_get_stream_field_headers(): client = DatastreamClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4378,8 +4409,8 @@ async def test_get_stream_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datastream.CreateStreamRequest, - dict, + datastream.CreateStreamRequest(), + {}, ], ) def test_create_stream(request_type, transport: str = "grpc"): @@ -4390,7 +4421,7 @@ def test_create_stream(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_stream), "__call__") as call: @@ -4433,11 +4464,12 @@ def test_create_stream_non_empty_request_with_auto_populated_field(): client.create_stream(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datastream.CreateStreamRequest( + request_msg = datastream.CreateStreamRequest( parent="parent_value", stream_id="stream_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_stream_use_cached_wrapped_rpc(): @@ -4528,9 +4560,14 @@ async def test_create_stream_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_stream_async( - transport: str = "grpc_asyncio", request_type=datastream.CreateStreamRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datastream.CreateStreamRequest(), + {}, + ], +) +async def test_create_stream_async(request_type, transport: str = "grpc_asyncio"): client = DatastreamAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4538,7 +4575,7 @@ async def test_create_stream_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_stream), "__call__") as call: @@ -4558,11 +4595,6 @@ async def test_create_stream_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_stream_async_from_dict(): - await test_create_stream_async(request_type=dict) - - def test_create_stream_field_headers(): client = DatastreamClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4729,8 +4761,8 @@ async def test_create_stream_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datastream.UpdateStreamRequest, - dict, + datastream.UpdateStreamRequest(), + {}, ], ) def test_update_stream(request_type, transport: str = "grpc"): @@ -4741,7 +4773,7 @@ def test_update_stream(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_stream), "__call__") as call: @@ -4782,9 +4814,10 @@ def test_update_stream_non_empty_request_with_auto_populated_field(): client.update_stream(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datastream.UpdateStreamRequest( + request_msg = datastream.UpdateStreamRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_stream_use_cached_wrapped_rpc(): @@ -4875,9 +4908,14 @@ async def test_update_stream_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_stream_async( - transport: str = "grpc_asyncio", request_type=datastream.UpdateStreamRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datastream.UpdateStreamRequest(), + {}, + ], +) +async def test_update_stream_async(request_type, transport: str = "grpc_asyncio"): client = DatastreamAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4885,7 +4923,7 @@ async def test_update_stream_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_stream), "__call__") as call: @@ -4905,11 +4943,6 @@ async def test_update_stream_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_stream_async_from_dict(): - await test_update_stream_async(request_type=dict) - - def test_update_stream_field_headers(): client = DatastreamClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5066,8 +5099,8 @@ async def test_update_stream_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datastream.DeleteStreamRequest, - dict, + datastream.DeleteStreamRequest(), + {}, ], ) def test_delete_stream(request_type, transport: str = "grpc"): @@ -5078,7 +5111,7 @@ def test_delete_stream(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_stream), "__call__") as call: @@ -5120,10 +5153,11 @@ def test_delete_stream_non_empty_request_with_auto_populated_field(): client.delete_stream(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datastream.DeleteStreamRequest( + request_msg = datastream.DeleteStreamRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_stream_use_cached_wrapped_rpc(): @@ -5214,9 +5248,14 @@ async def test_delete_stream_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_stream_async( - transport: str = "grpc_asyncio", request_type=datastream.DeleteStreamRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datastream.DeleteStreamRequest(), + {}, + ], +) +async def test_delete_stream_async(request_type, transport: str = "grpc_asyncio"): client = DatastreamAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5224,7 +5263,7 @@ async def test_delete_stream_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_stream), "__call__") as call: @@ -5244,11 +5283,6 @@ async def test_delete_stream_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_stream_async_from_dict(): - await test_delete_stream_async(request_type=dict) - - def test_delete_stream_field_headers(): client = DatastreamClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5395,8 +5429,8 @@ async def test_delete_stream_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datastream.FetchErrorsRequest, - dict, + datastream.FetchErrorsRequest(), + {}, ], ) def test_fetch_errors(request_type, transport: str = "grpc"): @@ -5407,7 +5441,7 @@ def test_fetch_errors(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.fetch_errors), "__call__") as call: @@ -5448,9 +5482,10 @@ def test_fetch_errors_non_empty_request_with_auto_populated_field(): client.fetch_errors(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datastream.FetchErrorsRequest( + request_msg = datastream.FetchErrorsRequest( stream="stream_value", ) + assert args[0] == request_msg def test_fetch_errors_use_cached_wrapped_rpc(): @@ -5541,9 +5576,14 @@ async def test_fetch_errors_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_fetch_errors_async( - transport: str = "grpc_asyncio", request_type=datastream.FetchErrorsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datastream.FetchErrorsRequest(), + {}, + ], +) +async def test_fetch_errors_async(request_type, transport: str = "grpc_asyncio"): client = DatastreamAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5551,7 +5591,7 @@ async def test_fetch_errors_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.fetch_errors), "__call__") as call: @@ -5571,11 +5611,6 @@ async def test_fetch_errors_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_fetch_errors_async_from_dict(): - await test_fetch_errors_async(request_type=dict) - - def test_fetch_errors_field_headers(): client = DatastreamClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5640,8 +5675,8 @@ async def test_fetch_errors_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - datastream.FetchStaticIpsRequest, - dict, + datastream.FetchStaticIpsRequest(), + {}, ], ) def test_fetch_static_ips(request_type, transport: str = "grpc"): @@ -5652,7 +5687,7 @@ def test_fetch_static_ips(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.fetch_static_ips), "__call__") as call: @@ -5699,10 +5734,11 @@ def test_fetch_static_ips_non_empty_request_with_auto_populated_field(): client.fetch_static_ips(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datastream.FetchStaticIpsRequest( + request_msg = datastream.FetchStaticIpsRequest( name="name_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_fetch_static_ips_use_cached_wrapped_rpc(): @@ -5785,9 +5821,14 @@ async def test_fetch_static_ips_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_fetch_static_ips_async( - transport: str = "grpc_asyncio", request_type=datastream.FetchStaticIpsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datastream.FetchStaticIpsRequest(), + {}, + ], +) +async def test_fetch_static_ips_async(request_type, transport: str = "grpc_asyncio"): client = DatastreamAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5795,7 +5836,7 @@ async def test_fetch_static_ips_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.fetch_static_ips), "__call__") as call: @@ -5820,11 +5861,6 @@ async def test_fetch_static_ips_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_fetch_static_ips_async_from_dict(): - await test_fetch_static_ips_async(request_type=dict) - - def test_fetch_static_ips_field_headers(): client = DatastreamClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6161,8 +6197,8 @@ async def test_fetch_static_ips_async_pages(): @pytest.mark.parametrize( "request_type", [ - datastream.CreatePrivateConnectionRequest, - dict, + datastream.CreatePrivateConnectionRequest(), + {}, ], ) def test_create_private_connection(request_type, transport: str = "grpc"): @@ -6173,7 +6209,7 @@ def test_create_private_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( @@ -6220,11 +6256,12 @@ def test_create_private_connection_non_empty_request_with_auto_populated_field() client.create_private_connection(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datastream.CreatePrivateConnectionRequest( + request_msg = datastream.CreatePrivateConnectionRequest( parent="parent_value", private_connection_id="private_connection_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_private_connection_use_cached_wrapped_rpc(): @@ -6320,9 +6357,15 @@ async def test_create_private_connection_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + datastream.CreatePrivateConnectionRequest(), + {}, + ], +) async def test_create_private_connection_async( - transport: str = "grpc_asyncio", - request_type=datastream.CreatePrivateConnectionRequest, + request_type, transport: str = "grpc_asyncio" ): client = DatastreamAsyncClient( credentials=async_anonymous_credentials(), @@ -6331,7 +6374,7 @@ async def test_create_private_connection_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( @@ -6353,11 +6396,6 @@ async def test_create_private_connection_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_private_connection_async_from_dict(): - await test_create_private_connection_async(request_type=dict) - - def test_create_private_connection_field_headers(): client = DatastreamClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6540,8 +6578,8 @@ async def test_create_private_connection_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datastream.GetPrivateConnectionRequest, - dict, + datastream.GetPrivateConnectionRequest(), + {}, ], ) def test_get_private_connection(request_type, transport: str = "grpc"): @@ -6552,7 +6590,7 @@ def test_get_private_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( @@ -6604,9 +6642,10 @@ def test_get_private_connection_non_empty_request_with_auto_populated_field(): client.get_private_connection(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datastream.GetPrivateConnectionRequest( + request_msg = datastream.GetPrivateConnectionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_private_connection_use_cached_wrapped_rpc(): @@ -6692,8 +6731,15 @@ async def test_get_private_connection_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + datastream.GetPrivateConnectionRequest(), + {}, + ], +) async def test_get_private_connection_async( - transport: str = "grpc_asyncio", request_type=datastream.GetPrivateConnectionRequest + request_type, transport: str = "grpc_asyncio" ): client = DatastreamAsyncClient( credentials=async_anonymous_credentials(), @@ -6702,7 +6748,7 @@ async def test_get_private_connection_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( @@ -6731,11 +6777,6 @@ async def test_get_private_connection_async( assert response.state == datastream_resources.PrivateConnection.State.CREATING -@pytest.mark.asyncio -async def test_get_private_connection_async_from_dict(): - await test_get_private_connection_async(request_type=dict) - - def test_get_private_connection_field_headers(): client = DatastreamClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6890,8 +6931,8 @@ async def test_get_private_connection_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datastream.ListPrivateConnectionsRequest, - dict, + datastream.ListPrivateConnectionsRequest(), + {}, ], ) def test_list_private_connections(request_type, transport: str = "grpc"): @@ -6902,7 +6943,7 @@ def test_list_private_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( @@ -6955,12 +6996,13 @@ def test_list_private_connections_non_empty_request_with_auto_populated_field(): client.list_private_connections(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datastream.ListPrivateConnectionsRequest( + request_msg = datastream.ListPrivateConnectionsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_private_connections_use_cached_wrapped_rpc(): @@ -7046,9 +7088,15 @@ async def test_list_private_connections_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + datastream.ListPrivateConnectionsRequest(), + {}, + ], +) async def test_list_private_connections_async( - transport: str = "grpc_asyncio", - request_type=datastream.ListPrivateConnectionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = DatastreamAsyncClient( credentials=async_anonymous_credentials(), @@ -7057,7 +7105,7 @@ async def test_list_private_connections_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( @@ -7084,11 +7132,6 @@ async def test_list_private_connections_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_private_connections_async_from_dict(): - await test_list_private_connections_async(request_type=dict) - - def test_list_private_connections_field_headers(): client = DatastreamClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7447,8 +7490,8 @@ async def test_list_private_connections_async_pages(): @pytest.mark.parametrize( "request_type", [ - datastream.DeletePrivateConnectionRequest, - dict, + datastream.DeletePrivateConnectionRequest(), + {}, ], ) def test_delete_private_connection(request_type, transport: str = "grpc"): @@ -7459,7 +7502,7 @@ def test_delete_private_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( @@ -7505,10 +7548,11 @@ def test_delete_private_connection_non_empty_request_with_auto_populated_field() client.delete_private_connection(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datastream.DeletePrivateConnectionRequest( + request_msg = datastream.DeletePrivateConnectionRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_private_connection_use_cached_wrapped_rpc(): @@ -7604,9 +7648,15 @@ async def test_delete_private_connection_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + datastream.DeletePrivateConnectionRequest(), + {}, + ], +) async def test_delete_private_connection_async( - transport: str = "grpc_asyncio", - request_type=datastream.DeletePrivateConnectionRequest, + request_type, transport: str = "grpc_asyncio" ): client = DatastreamAsyncClient( credentials=async_anonymous_credentials(), @@ -7615,7 +7665,7 @@ async def test_delete_private_connection_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( @@ -7637,11 +7687,6 @@ async def test_delete_private_connection_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_private_connection_async_from_dict(): - await test_delete_private_connection_async(request_type=dict) - - def test_delete_private_connection_field_headers(): client = DatastreamClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7796,8 +7841,8 @@ async def test_delete_private_connection_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datastream.CreateRouteRequest, - dict, + datastream.CreateRouteRequest(), + {}, ], ) def test_create_route(request_type, transport: str = "grpc"): @@ -7808,7 +7853,7 @@ def test_create_route(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_route), "__call__") as call: @@ -7851,11 +7896,12 @@ def test_create_route_non_empty_request_with_auto_populated_field(): client.create_route(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datastream.CreateRouteRequest( + request_msg = datastream.CreateRouteRequest( parent="parent_value", route_id="route_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_route_use_cached_wrapped_rpc(): @@ -7946,9 +7992,14 @@ async def test_create_route_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_route_async( - transport: str = "grpc_asyncio", request_type=datastream.CreateRouteRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datastream.CreateRouteRequest(), + {}, + ], +) +async def test_create_route_async(request_type, transport: str = "grpc_asyncio"): client = DatastreamAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7956,7 +8007,7 @@ async def test_create_route_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_route), "__call__") as call: @@ -7976,11 +8027,6 @@ async def test_create_route_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_route_async_from_dict(): - await test_create_route_async(request_type=dict) - - def test_create_route_field_headers(): client = DatastreamClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8147,8 +8193,8 @@ async def test_create_route_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datastream.GetRouteRequest, - dict, + datastream.GetRouteRequest(), + {}, ], ) def test_get_route(request_type, transport: str = "grpc"): @@ -8159,7 +8205,7 @@ def test_get_route(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_route), "__call__") as call: @@ -8209,9 +8255,10 @@ def test_get_route_non_empty_request_with_auto_populated_field(): client.get_route(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datastream.GetRouteRequest( + request_msg = datastream.GetRouteRequest( name="name_value", ) + assert args[0] == request_msg def test_get_route_use_cached_wrapped_rpc(): @@ -8290,9 +8337,14 @@ async def test_get_route_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_route_async( - transport: str = "grpc_asyncio", request_type=datastream.GetRouteRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datastream.GetRouteRequest(), + {}, + ], +) +async def test_get_route_async(request_type, transport: str = "grpc_asyncio"): client = DatastreamAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8300,7 +8352,7 @@ async def test_get_route_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_route), "__call__") as call: @@ -8329,11 +8381,6 @@ async def test_get_route_async( assert response.destination_port == 1734 -@pytest.mark.asyncio -async def test_get_route_async_from_dict(): - await test_get_route_async(request_type=dict) - - def test_get_route_field_headers(): client = DatastreamClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8480,8 +8527,8 @@ async def test_get_route_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datastream.ListRoutesRequest, - dict, + datastream.ListRoutesRequest(), + {}, ], ) def test_list_routes(request_type, transport: str = "grpc"): @@ -8492,7 +8539,7 @@ def test_list_routes(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_routes), "__call__") as call: @@ -8541,12 +8588,13 @@ def test_list_routes_non_empty_request_with_auto_populated_field(): client.list_routes(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datastream.ListRoutesRequest( + request_msg = datastream.ListRoutesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_routes_use_cached_wrapped_rpc(): @@ -8627,9 +8675,14 @@ async def test_list_routes_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_routes_async( - transport: str = "grpc_asyncio", request_type=datastream.ListRoutesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datastream.ListRoutesRequest(), + {}, + ], +) +async def test_list_routes_async(request_type, transport: str = "grpc_asyncio"): client = DatastreamAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8637,7 +8690,7 @@ async def test_list_routes_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_routes), "__call__") as call: @@ -8662,11 +8715,6 @@ async def test_list_routes_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_routes_async_from_dict(): - await test_list_routes_async(request_type=dict) - - def test_list_routes_field_headers(): client = DatastreamClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9003,8 +9051,8 @@ async def test_list_routes_async_pages(): @pytest.mark.parametrize( "request_type", [ - datastream.DeleteRouteRequest, - dict, + datastream.DeleteRouteRequest(), + {}, ], ) def test_delete_route(request_type, transport: str = "grpc"): @@ -9015,7 +9063,7 @@ def test_delete_route(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_route), "__call__") as call: @@ -9057,10 +9105,11 @@ def test_delete_route_non_empty_request_with_auto_populated_field(): client.delete_route(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datastream.DeleteRouteRequest( + request_msg = datastream.DeleteRouteRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_route_use_cached_wrapped_rpc(): @@ -9151,9 +9200,14 @@ async def test_delete_route_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_route_async( - transport: str = "grpc_asyncio", request_type=datastream.DeleteRouteRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datastream.DeleteRouteRequest(), + {}, + ], +) +async def test_delete_route_async(request_type, transport: str = "grpc_asyncio"): client = DatastreamAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9161,7 +9215,7 @@ async def test_delete_route_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_route), "__call__") as call: @@ -9181,11 +9235,6 @@ async def test_delete_route_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_route_async_from_dict(): - await test_delete_route_async(request_type=dict) - - def test_delete_route_field_headers(): client = DatastreamClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13684,7 +13733,6 @@ def test_list_connection_profiles_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.ListConnectionProfilesRequest() - assert args[0] == request_msg @@ -13707,7 +13755,6 @@ def test_get_connection_profile_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.GetConnectionProfileRequest() - assert args[0] == request_msg @@ -13730,7 +13777,6 @@ def test_create_connection_profile_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.CreateConnectionProfileRequest() - assert args[0] == request_msg @@ -13753,7 +13799,6 @@ def test_update_connection_profile_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.UpdateConnectionProfileRequest() - assert args[0] == request_msg @@ -13776,7 +13821,6 @@ def test_delete_connection_profile_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.DeleteConnectionProfileRequest() - assert args[0] == request_msg @@ -13799,7 +13843,6 @@ def test_discover_connection_profile_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.DiscoverConnectionProfileRequest() - assert args[0] == request_msg @@ -13820,7 +13863,6 @@ def test_list_streams_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.ListStreamsRequest() - assert args[0] == request_msg @@ -13841,7 +13883,6 @@ def test_get_stream_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.GetStreamRequest() - assert args[0] == request_msg @@ -13862,7 +13903,6 @@ def test_create_stream_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.CreateStreamRequest() - assert args[0] == request_msg @@ -13883,7 +13923,6 @@ def test_update_stream_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.UpdateStreamRequest() - assert args[0] == request_msg @@ -13904,7 +13943,6 @@ def test_delete_stream_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.DeleteStreamRequest() - assert args[0] == request_msg @@ -13925,7 +13963,6 @@ def test_fetch_errors_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.FetchErrorsRequest() - assert args[0] == request_msg @@ -13946,7 +13983,6 @@ def test_fetch_static_ips_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.FetchStaticIpsRequest() - assert args[0] == request_msg @@ -13969,7 +14005,6 @@ def test_create_private_connection_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.CreatePrivateConnectionRequest() - assert args[0] == request_msg @@ -13992,7 +14027,6 @@ def test_get_private_connection_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.GetPrivateConnectionRequest() - assert args[0] == request_msg @@ -14015,7 +14049,6 @@ def test_list_private_connections_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.ListPrivateConnectionsRequest() - assert args[0] == request_msg @@ -14038,7 +14071,6 @@ def test_delete_private_connection_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.DeletePrivateConnectionRequest() - assert args[0] == request_msg @@ -14059,7 +14091,6 @@ def test_create_route_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.CreateRouteRequest() - assert args[0] == request_msg @@ -14080,7 +14111,6 @@ def test_get_route_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.GetRouteRequest() - assert args[0] == request_msg @@ -14101,7 +14131,6 @@ def test_list_routes_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.ListRoutesRequest() - assert args[0] == request_msg @@ -14122,7 +14151,6 @@ def test_delete_route_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.DeleteRouteRequest() - assert args[0] == request_msg @@ -14166,7 +14194,6 @@ async def test_list_connection_profiles_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.ListConnectionProfilesRequest() - assert args[0] == request_msg @@ -14196,7 +14223,6 @@ async def test_get_connection_profile_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.GetConnectionProfileRequest() - assert args[0] == request_msg @@ -14223,7 +14249,6 @@ async def test_create_connection_profile_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.CreateConnectionProfileRequest() - assert args[0] == request_msg @@ -14250,7 +14275,6 @@ async def test_update_connection_profile_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.UpdateConnectionProfileRequest() - assert args[0] == request_msg @@ -14277,7 +14301,6 @@ async def test_delete_connection_profile_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.DeleteConnectionProfileRequest() - assert args[0] == request_msg @@ -14304,7 +14327,6 @@ async def test_discover_connection_profile_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.DiscoverConnectionProfileRequest() - assert args[0] == request_msg @@ -14332,7 +14354,6 @@ async def test_list_streams_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.ListStreamsRequest() - assert args[0] == request_msg @@ -14361,7 +14382,6 @@ async def test_get_stream_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.GetStreamRequest() - assert args[0] == request_msg @@ -14386,7 +14406,6 @@ async def test_create_stream_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.CreateStreamRequest() - assert args[0] == request_msg @@ -14411,7 +14430,6 @@ async def test_update_stream_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.UpdateStreamRequest() - assert args[0] == request_msg @@ -14436,7 +14454,6 @@ async def test_delete_stream_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.DeleteStreamRequest() - assert args[0] == request_msg @@ -14461,7 +14478,6 @@ async def test_fetch_errors_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.FetchErrorsRequest() - assert args[0] == request_msg @@ -14489,7 +14505,6 @@ async def test_fetch_static_ips_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.FetchStaticIpsRequest() - assert args[0] == request_msg @@ -14516,7 +14531,6 @@ async def test_create_private_connection_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.CreatePrivateConnectionRequest() - assert args[0] == request_msg @@ -14547,7 +14561,6 @@ async def test_get_private_connection_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.GetPrivateConnectionRequest() - assert args[0] == request_msg @@ -14577,7 +14590,6 @@ async def test_list_private_connections_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.ListPrivateConnectionsRequest() - assert args[0] == request_msg @@ -14604,7 +14616,6 @@ async def test_delete_private_connection_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.DeletePrivateConnectionRequest() - assert args[0] == request_msg @@ -14629,7 +14640,6 @@ async def test_create_route_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.CreateRouteRequest() - assert args[0] == request_msg @@ -14659,7 +14669,6 @@ async def test_get_route_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.GetRouteRequest() - assert args[0] == request_msg @@ -14687,7 +14696,6 @@ async def test_list_routes_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.ListRoutesRequest() - assert args[0] == request_msg @@ -14712,7 +14720,6 @@ async def test_delete_route_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.DeleteRouteRequest() - assert args[0] == request_msg @@ -18188,7 +18195,6 @@ def test_list_connection_profiles_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.ListConnectionProfilesRequest() - assert args[0] == request_msg @@ -18210,7 +18216,6 @@ def test_get_connection_profile_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.GetConnectionProfileRequest() - assert args[0] == request_msg @@ -18232,7 +18237,6 @@ def test_create_connection_profile_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.CreateConnectionProfileRequest() - assert args[0] == request_msg @@ -18254,7 +18258,6 @@ def test_update_connection_profile_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.UpdateConnectionProfileRequest() - assert args[0] == request_msg @@ -18276,7 +18279,6 @@ def test_delete_connection_profile_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.DeleteConnectionProfileRequest() - assert args[0] == request_msg @@ -18298,7 +18300,6 @@ def test_discover_connection_profile_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.DiscoverConnectionProfileRequest() - assert args[0] == request_msg @@ -18318,7 +18319,6 @@ def test_list_streams_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.ListStreamsRequest() - assert args[0] == request_msg @@ -18338,7 +18338,6 @@ def test_get_stream_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.GetStreamRequest() - assert args[0] == request_msg @@ -18358,7 +18357,6 @@ def test_create_stream_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.CreateStreamRequest() - assert args[0] == request_msg @@ -18378,7 +18376,6 @@ def test_update_stream_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.UpdateStreamRequest() - assert args[0] == request_msg @@ -18398,7 +18395,6 @@ def test_delete_stream_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.DeleteStreamRequest() - assert args[0] == request_msg @@ -18418,7 +18414,6 @@ def test_fetch_errors_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.FetchErrorsRequest() - assert args[0] == request_msg @@ -18438,7 +18433,6 @@ def test_fetch_static_ips_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.FetchStaticIpsRequest() - assert args[0] == request_msg @@ -18460,7 +18454,6 @@ def test_create_private_connection_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.CreatePrivateConnectionRequest() - assert args[0] == request_msg @@ -18482,7 +18475,6 @@ def test_get_private_connection_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.GetPrivateConnectionRequest() - assert args[0] == request_msg @@ -18504,7 +18496,6 @@ def test_list_private_connections_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.ListPrivateConnectionsRequest() - assert args[0] == request_msg @@ -18526,7 +18517,6 @@ def test_delete_private_connection_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.DeletePrivateConnectionRequest() - assert args[0] == request_msg @@ -18546,7 +18536,6 @@ def test_create_route_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.CreateRouteRequest() - assert args[0] == request_msg @@ -18566,7 +18555,6 @@ def test_get_route_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.GetRouteRequest() - assert args[0] == request_msg @@ -18586,7 +18574,6 @@ def test_list_routes_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.ListRoutesRequest() - assert args[0] == request_msg @@ -18606,7 +18593,6 @@ def test_delete_route_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datastream.DeleteRouteRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-deploy/noxfile.py b/packages/google-cloud-deploy/noxfile.py index 96fdf55773c9..8b14ce1ff03a 100644 --- a/packages/google-cloud-deploy/noxfile.py +++ b/packages/google-cloud-deploy/noxfile.py @@ -47,7 +47,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-deploy" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-deploy/setup.py b/packages/google-cloud-deploy/setup.py index 4591580207d1..7637cd7081bf 100644 --- a/packages/google-cloud-deploy/setup.py +++ b/packages/google-cloud-deploy/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/google-cloud-deploy/testing/constraints-3.10.txt b/packages/google-cloud-deploy/testing/constraints-3.10.txt index a92801e1c8e2..b39cd54634f9 100644 --- a/packages/google-cloud-deploy/testing/constraints-3.10.txt +++ b/packages/google-cloud-deploy/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/google-cloud-deploy/tests/unit/gapic/deploy_v1/test_cloud_deploy.py b/packages/google-cloud-deploy/tests/unit/gapic/deploy_v1/test_cloud_deploy.py index 9ca0698ff9bd..7988fadd3c04 100644 --- a/packages/google-cloud-deploy/tests/unit/gapic/deploy_v1/test_cloud_deploy.py +++ b/packages/google-cloud-deploy/tests/unit/gapic/deploy_v1/test_cloud_deploy.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 @@ -125,6 +126,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" @@ -1290,8 +1306,8 @@ def test_cloud_deploy_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - cloud_deploy.ListDeliveryPipelinesRequest, - dict, + cloud_deploy.ListDeliveryPipelinesRequest(), + {}, ], ) def test_list_delivery_pipelines(request_type, transport: str = "grpc"): @@ -1302,7 +1318,7 @@ def test_list_delivery_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( @@ -1355,12 +1371,13 @@ def test_list_delivery_pipelines_non_empty_request_with_auto_populated_field(): client.list_delivery_pipelines(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.ListDeliveryPipelinesRequest( + request_msg = cloud_deploy.ListDeliveryPipelinesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_delivery_pipelines_use_cached_wrapped_rpc(): @@ -1446,9 +1463,15 @@ async def test_list_delivery_pipelines_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloud_deploy.ListDeliveryPipelinesRequest(), + {}, + ], +) async def test_list_delivery_pipelines_async( - transport: str = "grpc_asyncio", - request_type=cloud_deploy.ListDeliveryPipelinesRequest, + request_type, transport: str = "grpc_asyncio" ): client = CloudDeployAsyncClient( credentials=async_anonymous_credentials(), @@ -1457,7 +1480,7 @@ async def test_list_delivery_pipelines_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( @@ -1484,11 +1507,6 @@ async def test_list_delivery_pipelines_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_delivery_pipelines_async_from_dict(): - await test_list_delivery_pipelines_async(request_type=dict) - - def test_list_delivery_pipelines_field_headers(): client = CloudDeployClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1841,8 +1859,8 @@ async def test_list_delivery_pipelines_async_pages(): @pytest.mark.parametrize( "request_type", [ - cloud_deploy.GetDeliveryPipelineRequest, - dict, + cloud_deploy.GetDeliveryPipelineRequest(), + {}, ], ) def test_get_delivery_pipeline(request_type, transport: str = "grpc"): @@ -1853,7 +1871,7 @@ def test_get_delivery_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( @@ -1909,9 +1927,10 @@ def test_get_delivery_pipeline_non_empty_request_with_auto_populated_field(): client.get_delivery_pipeline(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.GetDeliveryPipelineRequest( + request_msg = cloud_deploy.GetDeliveryPipelineRequest( name="name_value", ) + assert args[0] == request_msg def test_get_delivery_pipeline_use_cached_wrapped_rpc(): @@ -1997,9 +2016,15 @@ async def test_get_delivery_pipeline_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloud_deploy.GetDeliveryPipelineRequest(), + {}, + ], +) async def test_get_delivery_pipeline_async( - transport: str = "grpc_asyncio", - request_type=cloud_deploy.GetDeliveryPipelineRequest, + request_type, transport: str = "grpc_asyncio" ): client = CloudDeployAsyncClient( credentials=async_anonymous_credentials(), @@ -2008,7 +2033,7 @@ async def test_get_delivery_pipeline_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( @@ -2041,11 +2066,6 @@ async def test_get_delivery_pipeline_async( assert response.suspended is True -@pytest.mark.asyncio -async def test_get_delivery_pipeline_async_from_dict(): - await test_get_delivery_pipeline_async(request_type=dict) - - def test_get_delivery_pipeline_field_headers(): client = CloudDeployClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2200,8 +2220,8 @@ async def test_get_delivery_pipeline_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_deploy.CreateDeliveryPipelineRequest, - dict, + cloud_deploy.CreateDeliveryPipelineRequest(), + {}, ], ) def test_create_delivery_pipeline(request_type, transport: str = "grpc"): @@ -2212,7 +2232,7 @@ def test_create_delivery_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( @@ -2259,11 +2279,12 @@ def test_create_delivery_pipeline_non_empty_request_with_auto_populated_field(): client.create_delivery_pipeline(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.CreateDeliveryPipelineRequest( + request_msg = cloud_deploy.CreateDeliveryPipelineRequest( parent="parent_value", delivery_pipeline_id="delivery_pipeline_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_delivery_pipeline_use_cached_wrapped_rpc(): @@ -2359,9 +2380,15 @@ async def test_create_delivery_pipeline_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloud_deploy.CreateDeliveryPipelineRequest(), + {}, + ], +) async def test_create_delivery_pipeline_async( - transport: str = "grpc_asyncio", - request_type=cloud_deploy.CreateDeliveryPipelineRequest, + request_type, transport: str = "grpc_asyncio" ): client = CloudDeployAsyncClient( credentials=async_anonymous_credentials(), @@ -2370,7 +2397,7 @@ async def test_create_delivery_pipeline_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( @@ -2392,11 +2419,6 @@ async def test_create_delivery_pipeline_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_delivery_pipeline_async_from_dict(): - await test_create_delivery_pipeline_async(request_type=dict) - - def test_create_delivery_pipeline_field_headers(): client = CloudDeployClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2571,8 +2593,8 @@ async def test_create_delivery_pipeline_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_deploy.UpdateDeliveryPipelineRequest, - dict, + cloud_deploy.UpdateDeliveryPipelineRequest(), + {}, ], ) def test_update_delivery_pipeline(request_type, transport: str = "grpc"): @@ -2583,7 +2605,7 @@ def test_update_delivery_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( @@ -2628,9 +2650,10 @@ def test_update_delivery_pipeline_non_empty_request_with_auto_populated_field(): client.update_delivery_pipeline(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.UpdateDeliveryPipelineRequest( + request_msg = cloud_deploy.UpdateDeliveryPipelineRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_delivery_pipeline_use_cached_wrapped_rpc(): @@ -2726,9 +2749,15 @@ async def test_update_delivery_pipeline_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloud_deploy.UpdateDeliveryPipelineRequest(), + {}, + ], +) async def test_update_delivery_pipeline_async( - transport: str = "grpc_asyncio", - request_type=cloud_deploy.UpdateDeliveryPipelineRequest, + request_type, transport: str = "grpc_asyncio" ): client = CloudDeployAsyncClient( credentials=async_anonymous_credentials(), @@ -2737,7 +2766,7 @@ async def test_update_delivery_pipeline_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( @@ -2759,11 +2788,6 @@ async def test_update_delivery_pipeline_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_delivery_pipeline_async_from_dict(): - await test_update_delivery_pipeline_async(request_type=dict) - - def test_update_delivery_pipeline_field_headers(): client = CloudDeployClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2928,8 +2952,8 @@ async def test_update_delivery_pipeline_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_deploy.DeleteDeliveryPipelineRequest, - dict, + cloud_deploy.DeleteDeliveryPipelineRequest(), + {}, ], ) def test_delete_delivery_pipeline(request_type, transport: str = "grpc"): @@ -2940,7 +2964,7 @@ def test_delete_delivery_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( @@ -2987,11 +3011,12 @@ def test_delete_delivery_pipeline_non_empty_request_with_auto_populated_field(): client.delete_delivery_pipeline(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.DeleteDeliveryPipelineRequest( + request_msg = cloud_deploy.DeleteDeliveryPipelineRequest( name="name_value", request_id="request_id_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_delivery_pipeline_use_cached_wrapped_rpc(): @@ -3087,9 +3112,15 @@ async def test_delete_delivery_pipeline_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloud_deploy.DeleteDeliveryPipelineRequest(), + {}, + ], +) async def test_delete_delivery_pipeline_async( - transport: str = "grpc_asyncio", - request_type=cloud_deploy.DeleteDeliveryPipelineRequest, + request_type, transport: str = "grpc_asyncio" ): client = CloudDeployAsyncClient( credentials=async_anonymous_credentials(), @@ -3098,7 +3129,7 @@ async def test_delete_delivery_pipeline_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( @@ -3120,11 +3151,6 @@ async def test_delete_delivery_pipeline_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_delivery_pipeline_async_from_dict(): - await test_delete_delivery_pipeline_async(request_type=dict) - - def test_delete_delivery_pipeline_field_headers(): client = CloudDeployClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3279,8 +3305,8 @@ async def test_delete_delivery_pipeline_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_deploy.ListTargetsRequest, - dict, + cloud_deploy.ListTargetsRequest(), + {}, ], ) def test_list_targets(request_type, transport: str = "grpc"): @@ -3291,7 +3317,7 @@ def test_list_targets(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_targets), "__call__") as call: @@ -3340,12 +3366,13 @@ def test_list_targets_non_empty_request_with_auto_populated_field(): client.list_targets(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.ListTargetsRequest( + request_msg = cloud_deploy.ListTargetsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_targets_use_cached_wrapped_rpc(): @@ -3426,9 +3453,14 @@ async def test_list_targets_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_targets_async( - transport: str = "grpc_asyncio", request_type=cloud_deploy.ListTargetsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_deploy.ListTargetsRequest(), + {}, + ], +) +async def test_list_targets_async(request_type, transport: str = "grpc_asyncio"): client = CloudDeployAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3436,7 +3468,7 @@ async def test_list_targets_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_targets), "__call__") as call: @@ -3461,11 +3493,6 @@ async def test_list_targets_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_targets_async_from_dict(): - await test_list_targets_async(request_type=dict) - - def test_list_targets_field_headers(): client = CloudDeployClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3802,8 +3829,8 @@ async def test_list_targets_async_pages(): @pytest.mark.parametrize( "request_type", [ - cloud_deploy.RollbackTargetRequest, - dict, + cloud_deploy.RollbackTargetRequest(), + {}, ], ) def test_rollback_target(request_type, transport: str = "grpc"): @@ -3814,7 +3841,7 @@ def test_rollback_target(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.rollback_target), "__call__") as call: @@ -3859,13 +3886,14 @@ def test_rollback_target_non_empty_request_with_auto_populated_field(): client.rollback_target(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.RollbackTargetRequest( + request_msg = cloud_deploy.RollbackTargetRequest( name="name_value", target_id="target_id_value", rollout_id="rollout_id_value", release_id="release_id_value", rollout_to_roll_back="rollout_to_roll_back_value", ) + assert args[0] == request_msg def test_rollback_target_use_cached_wrapped_rpc(): @@ -3946,9 +3974,14 @@ async def test_rollback_target_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_rollback_target_async( - transport: str = "grpc_asyncio", request_type=cloud_deploy.RollbackTargetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_deploy.RollbackTargetRequest(), + {}, + ], +) +async def test_rollback_target_async(request_type, transport: str = "grpc_asyncio"): client = CloudDeployAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3956,7 +3989,7 @@ async def test_rollback_target_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.rollback_target), "__call__") as call: @@ -3976,11 +4009,6 @@ async def test_rollback_target_async( assert isinstance(response, cloud_deploy.RollbackTargetResponse) -@pytest.mark.asyncio -async def test_rollback_target_async_from_dict(): - await test_rollback_target_async(request_type=dict) - - def test_rollback_target_field_headers(): client = CloudDeployClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4147,8 +4175,8 @@ async def test_rollback_target_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_deploy.GetTargetRequest, - dict, + cloud_deploy.GetTargetRequest(), + {}, ], ) def test_get_target(request_type, transport: str = "grpc"): @@ -4159,7 +4187,7 @@ def test_get_target(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_target), "__call__") as call: @@ -4213,9 +4241,10 @@ def test_get_target_non_empty_request_with_auto_populated_field(): client.get_target(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.GetTargetRequest( + request_msg = cloud_deploy.GetTargetRequest( name="name_value", ) + assert args[0] == request_msg def test_get_target_use_cached_wrapped_rpc(): @@ -4294,9 +4323,14 @@ async def test_get_target_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_target_async( - transport: str = "grpc_asyncio", request_type=cloud_deploy.GetTargetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_deploy.GetTargetRequest(), + {}, + ], +) +async def test_get_target_async(request_type, transport: str = "grpc_asyncio"): client = CloudDeployAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4304,7 +4338,7 @@ async def test_get_target_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_target), "__call__") as call: @@ -4337,11 +4371,6 @@ async def test_get_target_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_target_async_from_dict(): - await test_get_target_async(request_type=dict) - - def test_get_target_field_headers(): client = CloudDeployClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4484,8 +4513,8 @@ async def test_get_target_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_deploy.CreateTargetRequest, - dict, + cloud_deploy.CreateTargetRequest(), + {}, ], ) def test_create_target(request_type, transport: str = "grpc"): @@ -4496,7 +4525,7 @@ def test_create_target(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_target), "__call__") as call: @@ -4539,11 +4568,12 @@ def test_create_target_non_empty_request_with_auto_populated_field(): client.create_target(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.CreateTargetRequest( + request_msg = cloud_deploy.CreateTargetRequest( parent="parent_value", target_id="target_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_target_use_cached_wrapped_rpc(): @@ -4634,9 +4664,14 @@ async def test_create_target_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_target_async( - transport: str = "grpc_asyncio", request_type=cloud_deploy.CreateTargetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_deploy.CreateTargetRequest(), + {}, + ], +) +async def test_create_target_async(request_type, transport: str = "grpc_asyncio"): client = CloudDeployAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4644,7 +4679,7 @@ async def test_create_target_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_target), "__call__") as call: @@ -4664,11 +4699,6 @@ async def test_create_target_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_target_async_from_dict(): - await test_create_target_async(request_type=dict) - - def test_create_target_field_headers(): client = CloudDeployClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4835,8 +4865,8 @@ async def test_create_target_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_deploy.UpdateTargetRequest, - dict, + cloud_deploy.UpdateTargetRequest(), + {}, ], ) def test_update_target(request_type, transport: str = "grpc"): @@ -4847,7 +4877,7 @@ def test_update_target(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_target), "__call__") as call: @@ -4888,9 +4918,10 @@ def test_update_target_non_empty_request_with_auto_populated_field(): client.update_target(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.UpdateTargetRequest( + request_msg = cloud_deploy.UpdateTargetRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_target_use_cached_wrapped_rpc(): @@ -4981,9 +5012,14 @@ async def test_update_target_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_target_async( - transport: str = "grpc_asyncio", request_type=cloud_deploy.UpdateTargetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_deploy.UpdateTargetRequest(), + {}, + ], +) +async def test_update_target_async(request_type, transport: str = "grpc_asyncio"): client = CloudDeployAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4991,7 +5027,7 @@ async def test_update_target_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_target), "__call__") as call: @@ -5011,11 +5047,6 @@ async def test_update_target_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_target_async_from_dict(): - await test_update_target_async(request_type=dict) - - def test_update_target_field_headers(): client = CloudDeployClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5172,8 +5203,8 @@ async def test_update_target_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_deploy.DeleteTargetRequest, - dict, + cloud_deploy.DeleteTargetRequest(), + {}, ], ) def test_delete_target(request_type, transport: str = "grpc"): @@ -5184,7 +5215,7 @@ def test_delete_target(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_target), "__call__") as call: @@ -5227,11 +5258,12 @@ def test_delete_target_non_empty_request_with_auto_populated_field(): client.delete_target(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.DeleteTargetRequest( + request_msg = cloud_deploy.DeleteTargetRequest( name="name_value", request_id="request_id_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_target_use_cached_wrapped_rpc(): @@ -5322,9 +5354,14 @@ async def test_delete_target_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_target_async( - transport: str = "grpc_asyncio", request_type=cloud_deploy.DeleteTargetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_deploy.DeleteTargetRequest(), + {}, + ], +) +async def test_delete_target_async(request_type, transport: str = "grpc_asyncio"): client = CloudDeployAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5332,7 +5369,7 @@ async def test_delete_target_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_target), "__call__") as call: @@ -5352,11 +5389,6 @@ async def test_delete_target_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_target_async_from_dict(): - await test_delete_target_async(request_type=dict) - - def test_delete_target_field_headers(): client = CloudDeployClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5503,8 +5535,8 @@ async def test_delete_target_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_deploy.ListCustomTargetTypesRequest, - dict, + cloud_deploy.ListCustomTargetTypesRequest(), + {}, ], ) def test_list_custom_target_types(request_type, transport: str = "grpc"): @@ -5515,7 +5547,7 @@ def test_list_custom_target_types(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5568,12 +5600,13 @@ def test_list_custom_target_types_non_empty_request_with_auto_populated_field(): client.list_custom_target_types(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.ListCustomTargetTypesRequest( + request_msg = cloud_deploy.ListCustomTargetTypesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_custom_target_types_use_cached_wrapped_rpc(): @@ -5659,9 +5692,15 @@ async def test_list_custom_target_types_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloud_deploy.ListCustomTargetTypesRequest(), + {}, + ], +) async def test_list_custom_target_types_async( - transport: str = "grpc_asyncio", - request_type=cloud_deploy.ListCustomTargetTypesRequest, + request_type, transport: str = "grpc_asyncio" ): client = CloudDeployAsyncClient( credentials=async_anonymous_credentials(), @@ -5670,7 +5709,7 @@ async def test_list_custom_target_types_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( @@ -5697,11 +5736,6 @@ async def test_list_custom_target_types_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_custom_target_types_async_from_dict(): - await test_list_custom_target_types_async(request_type=dict) - - def test_list_custom_target_types_field_headers(): client = CloudDeployClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6056,8 +6090,8 @@ async def test_list_custom_target_types_async_pages(): @pytest.mark.parametrize( "request_type", [ - cloud_deploy.GetCustomTargetTypeRequest, - dict, + cloud_deploy.GetCustomTargetTypeRequest(), + {}, ], ) def test_get_custom_target_type(request_type, transport: str = "grpc"): @@ -6068,7 +6102,7 @@ def test_get_custom_target_type(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6124,9 +6158,10 @@ def test_get_custom_target_type_non_empty_request_with_auto_populated_field(): client.get_custom_target_type(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.GetCustomTargetTypeRequest( + request_msg = cloud_deploy.GetCustomTargetTypeRequest( name="name_value", ) + assert args[0] == request_msg def test_get_custom_target_type_use_cached_wrapped_rpc(): @@ -6212,9 +6247,15 @@ async def test_get_custom_target_type_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloud_deploy.GetCustomTargetTypeRequest(), + {}, + ], +) async def test_get_custom_target_type_async( - transport: str = "grpc_asyncio", - request_type=cloud_deploy.GetCustomTargetTypeRequest, + request_type, transport: str = "grpc_asyncio" ): client = CloudDeployAsyncClient( credentials=async_anonymous_credentials(), @@ -6223,7 +6264,7 @@ async def test_get_custom_target_type_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( @@ -6256,11 +6297,6 @@ async def test_get_custom_target_type_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_custom_target_type_async_from_dict(): - await test_get_custom_target_type_async(request_type=dict) - - def test_get_custom_target_type_field_headers(): client = CloudDeployClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6415,8 +6451,8 @@ async def test_get_custom_target_type_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_deploy.CreateCustomTargetTypeRequest, - dict, + cloud_deploy.CreateCustomTargetTypeRequest(), + {}, ], ) def test_create_custom_target_type(request_type, transport: str = "grpc"): @@ -6427,7 +6463,7 @@ def test_create_custom_target_type(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6474,11 +6510,12 @@ def test_create_custom_target_type_non_empty_request_with_auto_populated_field() client.create_custom_target_type(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.CreateCustomTargetTypeRequest( + request_msg = cloud_deploy.CreateCustomTargetTypeRequest( parent="parent_value", custom_target_type_id="custom_target_type_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_custom_target_type_use_cached_wrapped_rpc(): @@ -6574,9 +6611,15 @@ async def test_create_custom_target_type_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloud_deploy.CreateCustomTargetTypeRequest(), + {}, + ], +) async def test_create_custom_target_type_async( - transport: str = "grpc_asyncio", - request_type=cloud_deploy.CreateCustomTargetTypeRequest, + request_type, transport: str = "grpc_asyncio" ): client = CloudDeployAsyncClient( credentials=async_anonymous_credentials(), @@ -6585,7 +6628,7 @@ async def test_create_custom_target_type_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( @@ -6607,11 +6650,6 @@ async def test_create_custom_target_type_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_custom_target_type_async_from_dict(): - await test_create_custom_target_type_async(request_type=dict) - - def test_create_custom_target_type_field_headers(): client = CloudDeployClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6786,8 +6824,8 @@ async def test_create_custom_target_type_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_deploy.UpdateCustomTargetTypeRequest, - dict, + cloud_deploy.UpdateCustomTargetTypeRequest(), + {}, ], ) def test_update_custom_target_type(request_type, transport: str = "grpc"): @@ -6798,7 +6836,7 @@ def test_update_custom_target_type(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6843,9 +6881,10 @@ def test_update_custom_target_type_non_empty_request_with_auto_populated_field() client.update_custom_target_type(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.UpdateCustomTargetTypeRequest( + request_msg = cloud_deploy.UpdateCustomTargetTypeRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_custom_target_type_use_cached_wrapped_rpc(): @@ -6941,9 +6980,15 @@ async def test_update_custom_target_type_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloud_deploy.UpdateCustomTargetTypeRequest(), + {}, + ], +) async def test_update_custom_target_type_async( - transport: str = "grpc_asyncio", - request_type=cloud_deploy.UpdateCustomTargetTypeRequest, + request_type, transport: str = "grpc_asyncio" ): client = CloudDeployAsyncClient( credentials=async_anonymous_credentials(), @@ -6952,7 +6997,7 @@ async def test_update_custom_target_type_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( @@ -6974,11 +7019,6 @@ async def test_update_custom_target_type_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_custom_target_type_async_from_dict(): - await test_update_custom_target_type_async(request_type=dict) - - def test_update_custom_target_type_field_headers(): client = CloudDeployClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7143,8 +7183,8 @@ async def test_update_custom_target_type_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_deploy.DeleteCustomTargetTypeRequest, - dict, + cloud_deploy.DeleteCustomTargetTypeRequest(), + {}, ], ) def test_delete_custom_target_type(request_type, transport: str = "grpc"): @@ -7155,7 +7195,7 @@ def test_delete_custom_target_type(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7202,11 +7242,12 @@ def test_delete_custom_target_type_non_empty_request_with_auto_populated_field() client.delete_custom_target_type(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.DeleteCustomTargetTypeRequest( + request_msg = cloud_deploy.DeleteCustomTargetTypeRequest( name="name_value", request_id="request_id_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_custom_target_type_use_cached_wrapped_rpc(): @@ -7302,9 +7343,15 @@ async def test_delete_custom_target_type_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloud_deploy.DeleteCustomTargetTypeRequest(), + {}, + ], +) async def test_delete_custom_target_type_async( - transport: str = "grpc_asyncio", - request_type=cloud_deploy.DeleteCustomTargetTypeRequest, + request_type, transport: str = "grpc_asyncio" ): client = CloudDeployAsyncClient( credentials=async_anonymous_credentials(), @@ -7313,7 +7360,7 @@ async def test_delete_custom_target_type_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( @@ -7335,11 +7382,6 @@ async def test_delete_custom_target_type_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_custom_target_type_async_from_dict(): - await test_delete_custom_target_type_async(request_type=dict) - - def test_delete_custom_target_type_field_headers(): client = CloudDeployClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7494,8 +7536,8 @@ async def test_delete_custom_target_type_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_deploy.ListReleasesRequest, - dict, + cloud_deploy.ListReleasesRequest(), + {}, ], ) def test_list_releases(request_type, transport: str = "grpc"): @@ -7506,7 +7548,7 @@ def test_list_releases(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_releases), "__call__") as call: @@ -7555,12 +7597,13 @@ def test_list_releases_non_empty_request_with_auto_populated_field(): client.list_releases(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.ListReleasesRequest( + request_msg = cloud_deploy.ListReleasesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_releases_use_cached_wrapped_rpc(): @@ -7641,9 +7684,14 @@ async def test_list_releases_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_releases_async( - transport: str = "grpc_asyncio", request_type=cloud_deploy.ListReleasesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_deploy.ListReleasesRequest(), + {}, + ], +) +async def test_list_releases_async(request_type, transport: str = "grpc_asyncio"): client = CloudDeployAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7651,7 +7699,7 @@ async def test_list_releases_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_releases), "__call__") as call: @@ -7676,11 +7724,6 @@ async def test_list_releases_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_releases_async_from_dict(): - await test_list_releases_async(request_type=dict) - - def test_list_releases_field_headers(): client = CloudDeployClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8017,8 +8060,8 @@ async def test_list_releases_async_pages(): @pytest.mark.parametrize( "request_type", [ - cloud_deploy.GetReleaseRequest, - dict, + cloud_deploy.GetReleaseRequest(), + {}, ], ) def test_get_release(request_type, transport: str = "grpc"): @@ -8029,7 +8072,7 @@ def test_get_release(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_release), "__call__") as call: @@ -8089,9 +8132,10 @@ def test_get_release_non_empty_request_with_auto_populated_field(): client.get_release(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.GetReleaseRequest( + request_msg = cloud_deploy.GetReleaseRequest( name="name_value", ) + assert args[0] == request_msg def test_get_release_use_cached_wrapped_rpc(): @@ -8172,9 +8216,14 @@ async def test_get_release_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_release_async( - transport: str = "grpc_asyncio", request_type=cloud_deploy.GetReleaseRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_deploy.GetReleaseRequest(), + {}, + ], +) +async def test_get_release_async(request_type, transport: str = "grpc_asyncio"): client = CloudDeployAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8182,7 +8231,7 @@ async def test_get_release_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_release), "__call__") as call: @@ -8221,11 +8270,6 @@ async def test_get_release_async( assert response.skaffold_version == "skaffold_version_value" -@pytest.mark.asyncio -async def test_get_release_async_from_dict(): - await test_get_release_async(request_type=dict) - - def test_get_release_field_headers(): client = CloudDeployClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8372,8 +8416,8 @@ async def test_get_release_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_deploy.CreateReleaseRequest, - dict, + cloud_deploy.CreateReleaseRequest(), + {}, ], ) def test_create_release(request_type, transport: str = "grpc"): @@ -8384,7 +8428,7 @@ def test_create_release(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_release), "__call__") as call: @@ -8427,11 +8471,12 @@ def test_create_release_non_empty_request_with_auto_populated_field(): client.create_release(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.CreateReleaseRequest( + request_msg = cloud_deploy.CreateReleaseRequest( parent="parent_value", release_id="release_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_release_use_cached_wrapped_rpc(): @@ -8522,9 +8567,14 @@ async def test_create_release_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_release_async( - transport: str = "grpc_asyncio", request_type=cloud_deploy.CreateReleaseRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_deploy.CreateReleaseRequest(), + {}, + ], +) +async def test_create_release_async(request_type, transport: str = "grpc_asyncio"): client = CloudDeployAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8532,7 +8582,7 @@ async def test_create_release_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_release), "__call__") as call: @@ -8552,11 +8602,6 @@ async def test_create_release_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_release_async_from_dict(): - await test_create_release_async(request_type=dict) - - def test_create_release_field_headers(): client = CloudDeployClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8723,8 +8768,8 @@ async def test_create_release_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_deploy.AbandonReleaseRequest, - dict, + cloud_deploy.AbandonReleaseRequest(), + {}, ], ) def test_abandon_release(request_type, transport: str = "grpc"): @@ -8735,7 +8780,7 @@ def test_abandon_release(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.abandon_release), "__call__") as call: @@ -8776,9 +8821,10 @@ def test_abandon_release_non_empty_request_with_auto_populated_field(): client.abandon_release(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.AbandonReleaseRequest( + request_msg = cloud_deploy.AbandonReleaseRequest( name="name_value", ) + assert args[0] == request_msg def test_abandon_release_use_cached_wrapped_rpc(): @@ -8859,9 +8905,14 @@ async def test_abandon_release_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_abandon_release_async( - transport: str = "grpc_asyncio", request_type=cloud_deploy.AbandonReleaseRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_deploy.AbandonReleaseRequest(), + {}, + ], +) +async def test_abandon_release_async(request_type, transport: str = "grpc_asyncio"): client = CloudDeployAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8869,7 +8920,7 @@ async def test_abandon_release_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.abandon_release), "__call__") as call: @@ -8889,11 +8940,6 @@ async def test_abandon_release_async( assert isinstance(response, cloud_deploy.AbandonReleaseResponse) -@pytest.mark.asyncio -async def test_abandon_release_async_from_dict(): - await test_abandon_release_async(request_type=dict) - - def test_abandon_release_field_headers(): client = CloudDeployClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9040,8 +9086,8 @@ async def test_abandon_release_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_deploy.CreateDeployPolicyRequest, - dict, + cloud_deploy.CreateDeployPolicyRequest(), + {}, ], ) def test_create_deploy_policy(request_type, transport: str = "grpc"): @@ -9052,7 +9098,7 @@ def test_create_deploy_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( @@ -9099,11 +9145,12 @@ def test_create_deploy_policy_non_empty_request_with_auto_populated_field(): client.create_deploy_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.CreateDeployPolicyRequest( + request_msg = cloud_deploy.CreateDeployPolicyRequest( parent="parent_value", deploy_policy_id="deploy_policy_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_deploy_policy_use_cached_wrapped_rpc(): @@ -9198,8 +9245,15 @@ async def test_create_deploy_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloud_deploy.CreateDeployPolicyRequest(), + {}, + ], +) async def test_create_deploy_policy_async( - transport: str = "grpc_asyncio", request_type=cloud_deploy.CreateDeployPolicyRequest + request_type, transport: str = "grpc_asyncio" ): client = CloudDeployAsyncClient( credentials=async_anonymous_credentials(), @@ -9208,7 +9262,7 @@ async def test_create_deploy_policy_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( @@ -9230,11 +9284,6 @@ async def test_create_deploy_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_deploy_policy_async_from_dict(): - await test_create_deploy_policy_async(request_type=dict) - - def test_create_deploy_policy_field_headers(): client = CloudDeployClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9409,8 +9458,8 @@ async def test_create_deploy_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_deploy.UpdateDeployPolicyRequest, - dict, + cloud_deploy.UpdateDeployPolicyRequest(), + {}, ], ) def test_update_deploy_policy(request_type, transport: str = "grpc"): @@ -9421,7 +9470,7 @@ def test_update_deploy_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( @@ -9466,9 +9515,10 @@ def test_update_deploy_policy_non_empty_request_with_auto_populated_field(): client.update_deploy_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.UpdateDeployPolicyRequest( + request_msg = cloud_deploy.UpdateDeployPolicyRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_deploy_policy_use_cached_wrapped_rpc(): @@ -9563,8 +9613,15 @@ async def test_update_deploy_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloud_deploy.UpdateDeployPolicyRequest(), + {}, + ], +) async def test_update_deploy_policy_async( - transport: str = "grpc_asyncio", request_type=cloud_deploy.UpdateDeployPolicyRequest + request_type, transport: str = "grpc_asyncio" ): client = CloudDeployAsyncClient( credentials=async_anonymous_credentials(), @@ -9573,7 +9630,7 @@ async def test_update_deploy_policy_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( @@ -9595,11 +9652,6 @@ async def test_update_deploy_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_deploy_policy_async_from_dict(): - await test_update_deploy_policy_async(request_type=dict) - - def test_update_deploy_policy_field_headers(): client = CloudDeployClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9764,8 +9816,8 @@ async def test_update_deploy_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_deploy.DeleteDeployPolicyRequest, - dict, + cloud_deploy.DeleteDeployPolicyRequest(), + {}, ], ) def test_delete_deploy_policy(request_type, transport: str = "grpc"): @@ -9776,7 +9828,7 @@ def test_delete_deploy_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( @@ -9823,11 +9875,12 @@ def test_delete_deploy_policy_non_empty_request_with_auto_populated_field(): client.delete_deploy_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.DeleteDeployPolicyRequest( + request_msg = cloud_deploy.DeleteDeployPolicyRequest( name="name_value", request_id="request_id_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_deploy_policy_use_cached_wrapped_rpc(): @@ -9922,8 +9975,15 @@ async def test_delete_deploy_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloud_deploy.DeleteDeployPolicyRequest(), + {}, + ], +) async def test_delete_deploy_policy_async( - transport: str = "grpc_asyncio", request_type=cloud_deploy.DeleteDeployPolicyRequest + request_type, transport: str = "grpc_asyncio" ): client = CloudDeployAsyncClient( credentials=async_anonymous_credentials(), @@ -9932,7 +9992,7 @@ async def test_delete_deploy_policy_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( @@ -9954,11 +10014,6 @@ async def test_delete_deploy_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_deploy_policy_async_from_dict(): - await test_delete_deploy_policy_async(request_type=dict) - - def test_delete_deploy_policy_field_headers(): client = CloudDeployClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10113,8 +10168,8 @@ async def test_delete_deploy_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_deploy.ListDeployPoliciesRequest, - dict, + cloud_deploy.ListDeployPoliciesRequest(), + {}, ], ) def test_list_deploy_policies(request_type, transport: str = "grpc"): @@ -10125,7 +10180,7 @@ def test_list_deploy_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( @@ -10178,12 +10233,13 @@ def test_list_deploy_policies_non_empty_request_with_auto_populated_field(): client.list_deploy_policies(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.ListDeployPoliciesRequest( + request_msg = cloud_deploy.ListDeployPoliciesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_deploy_policies_use_cached_wrapped_rpc(): @@ -10268,8 +10324,15 @@ async def test_list_deploy_policies_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloud_deploy.ListDeployPoliciesRequest(), + {}, + ], +) async def test_list_deploy_policies_async( - transport: str = "grpc_asyncio", request_type=cloud_deploy.ListDeployPoliciesRequest + request_type, transport: str = "grpc_asyncio" ): client = CloudDeployAsyncClient( credentials=async_anonymous_credentials(), @@ -10278,7 +10341,7 @@ async def test_list_deploy_policies_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( @@ -10305,11 +10368,6 @@ async def test_list_deploy_policies_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_deploy_policies_async_from_dict(): - await test_list_deploy_policies_async(request_type=dict) - - def test_list_deploy_policies_field_headers(): client = CloudDeployClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10662,8 +10720,8 @@ async def test_list_deploy_policies_async_pages(): @pytest.mark.parametrize( "request_type", [ - cloud_deploy.GetDeployPolicyRequest, - dict, + cloud_deploy.GetDeployPolicyRequest(), + {}, ], ) def test_get_deploy_policy(request_type, transport: str = "grpc"): @@ -10674,7 +10732,7 @@ def test_get_deploy_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( @@ -10730,9 +10788,10 @@ def test_get_deploy_policy_non_empty_request_with_auto_populated_field(): client.get_deploy_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.GetDeployPolicyRequest( + request_msg = cloud_deploy.GetDeployPolicyRequest( name="name_value", ) + assert args[0] == request_msg def test_get_deploy_policy_use_cached_wrapped_rpc(): @@ -10815,9 +10874,14 @@ async def test_get_deploy_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_deploy_policy_async( - transport: str = "grpc_asyncio", request_type=cloud_deploy.GetDeployPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_deploy.GetDeployPolicyRequest(), + {}, + ], +) +async def test_get_deploy_policy_async(request_type, transport: str = "grpc_asyncio"): client = CloudDeployAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10825,7 +10889,7 @@ async def test_get_deploy_policy_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( @@ -10858,11 +10922,6 @@ async def test_get_deploy_policy_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_deploy_policy_async_from_dict(): - await test_get_deploy_policy_async(request_type=dict) - - def test_get_deploy_policy_field_headers(): client = CloudDeployClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11017,8 +11076,8 @@ async def test_get_deploy_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_deploy.ApproveRolloutRequest, - dict, + cloud_deploy.ApproveRolloutRequest(), + {}, ], ) def test_approve_rollout(request_type, transport: str = "grpc"): @@ -11029,7 +11088,7 @@ def test_approve_rollout(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.approve_rollout), "__call__") as call: @@ -11070,9 +11129,10 @@ def test_approve_rollout_non_empty_request_with_auto_populated_field(): client.approve_rollout(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.ApproveRolloutRequest( + request_msg = cloud_deploy.ApproveRolloutRequest( name="name_value", ) + assert args[0] == request_msg def test_approve_rollout_use_cached_wrapped_rpc(): @@ -11153,9 +11213,14 @@ async def test_approve_rollout_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_approve_rollout_async( - transport: str = "grpc_asyncio", request_type=cloud_deploy.ApproveRolloutRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_deploy.ApproveRolloutRequest(), + {}, + ], +) +async def test_approve_rollout_async(request_type, transport: str = "grpc_asyncio"): client = CloudDeployAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11163,7 +11228,7 @@ async def test_approve_rollout_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.approve_rollout), "__call__") as call: @@ -11183,11 +11248,6 @@ async def test_approve_rollout_async( assert isinstance(response, cloud_deploy.ApproveRolloutResponse) -@pytest.mark.asyncio -async def test_approve_rollout_async_from_dict(): - await test_approve_rollout_async(request_type=dict) - - def test_approve_rollout_field_headers(): client = CloudDeployClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11334,8 +11394,8 @@ async def test_approve_rollout_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_deploy.AdvanceRolloutRequest, - dict, + cloud_deploy.AdvanceRolloutRequest(), + {}, ], ) def test_advance_rollout(request_type, transport: str = "grpc"): @@ -11346,7 +11406,7 @@ def test_advance_rollout(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.advance_rollout), "__call__") as call: @@ -11388,10 +11448,11 @@ def test_advance_rollout_non_empty_request_with_auto_populated_field(): client.advance_rollout(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.AdvanceRolloutRequest( + request_msg = cloud_deploy.AdvanceRolloutRequest( name="name_value", phase_id="phase_id_value", ) + assert args[0] == request_msg def test_advance_rollout_use_cached_wrapped_rpc(): @@ -11472,9 +11533,14 @@ async def test_advance_rollout_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_advance_rollout_async( - transport: str = "grpc_asyncio", request_type=cloud_deploy.AdvanceRolloutRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_deploy.AdvanceRolloutRequest(), + {}, + ], +) +async def test_advance_rollout_async(request_type, transport: str = "grpc_asyncio"): client = CloudDeployAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11482,7 +11548,7 @@ async def test_advance_rollout_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.advance_rollout), "__call__") as call: @@ -11502,11 +11568,6 @@ async def test_advance_rollout_async( assert isinstance(response, cloud_deploy.AdvanceRolloutResponse) -@pytest.mark.asyncio -async def test_advance_rollout_async_from_dict(): - await test_advance_rollout_async(request_type=dict) - - def test_advance_rollout_field_headers(): client = CloudDeployClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11663,8 +11724,8 @@ async def test_advance_rollout_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_deploy.CancelRolloutRequest, - dict, + cloud_deploy.CancelRolloutRequest(), + {}, ], ) def test_cancel_rollout(request_type, transport: str = "grpc"): @@ -11675,7 +11736,7 @@ def test_cancel_rollout(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.cancel_rollout), "__call__") as call: @@ -11716,9 +11777,10 @@ def test_cancel_rollout_non_empty_request_with_auto_populated_field(): client.cancel_rollout(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.CancelRolloutRequest( + request_msg = cloud_deploy.CancelRolloutRequest( name="name_value", ) + assert args[0] == request_msg def test_cancel_rollout_use_cached_wrapped_rpc(): @@ -11799,9 +11861,14 @@ async def test_cancel_rollout_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_cancel_rollout_async( - transport: str = "grpc_asyncio", request_type=cloud_deploy.CancelRolloutRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_deploy.CancelRolloutRequest(), + {}, + ], +) +async def test_cancel_rollout_async(request_type, transport: str = "grpc_asyncio"): client = CloudDeployAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11809,7 +11876,7 @@ async def test_cancel_rollout_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.cancel_rollout), "__call__") as call: @@ -11829,11 +11896,6 @@ async def test_cancel_rollout_async( assert isinstance(response, cloud_deploy.CancelRolloutResponse) -@pytest.mark.asyncio -async def test_cancel_rollout_async_from_dict(): - await test_cancel_rollout_async(request_type=dict) - - def test_cancel_rollout_field_headers(): client = CloudDeployClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11980,8 +12042,8 @@ async def test_cancel_rollout_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_deploy.ListRolloutsRequest, - dict, + cloud_deploy.ListRolloutsRequest(), + {}, ], ) def test_list_rollouts(request_type, transport: str = "grpc"): @@ -11992,7 +12054,7 @@ def test_list_rollouts(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_rollouts), "__call__") as call: @@ -12041,12 +12103,13 @@ def test_list_rollouts_non_empty_request_with_auto_populated_field(): client.list_rollouts(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.ListRolloutsRequest( + request_msg = cloud_deploy.ListRolloutsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_rollouts_use_cached_wrapped_rpc(): @@ -12127,9 +12190,14 @@ async def test_list_rollouts_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_rollouts_async( - transport: str = "grpc_asyncio", request_type=cloud_deploy.ListRolloutsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_deploy.ListRolloutsRequest(), + {}, + ], +) +async def test_list_rollouts_async(request_type, transport: str = "grpc_asyncio"): client = CloudDeployAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12137,7 +12205,7 @@ async def test_list_rollouts_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_rollouts), "__call__") as call: @@ -12162,11 +12230,6 @@ async def test_list_rollouts_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_rollouts_async_from_dict(): - await test_list_rollouts_async(request_type=dict) - - def test_list_rollouts_field_headers(): client = CloudDeployClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12503,8 +12566,8 @@ async def test_list_rollouts_async_pages(): @pytest.mark.parametrize( "request_type", [ - cloud_deploy.GetRolloutRequest, - dict, + cloud_deploy.GetRolloutRequest(), + {}, ], ) def test_get_rollout(request_type, transport: str = "grpc"): @@ -12515,7 +12578,7 @@ def test_get_rollout(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_rollout), "__call__") as call: @@ -12588,9 +12651,10 @@ def test_get_rollout_non_empty_request_with_auto_populated_field(): client.get_rollout(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.GetRolloutRequest( + request_msg = cloud_deploy.GetRolloutRequest( name="name_value", ) + assert args[0] == request_msg def test_get_rollout_use_cached_wrapped_rpc(): @@ -12671,9 +12735,14 @@ async def test_get_rollout_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_rollout_async( - transport: str = "grpc_asyncio", request_type=cloud_deploy.GetRolloutRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_deploy.GetRolloutRequest(), + {}, + ], +) +async def test_get_rollout_async(request_type, transport: str = "grpc_asyncio"): client = CloudDeployAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12681,7 +12750,7 @@ async def test_get_rollout_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_rollout), "__call__") as call: @@ -12733,11 +12802,6 @@ async def test_get_rollout_async( assert response.active_repair_automation_run == "active_repair_automation_run_value" -@pytest.mark.asyncio -async def test_get_rollout_async_from_dict(): - await test_get_rollout_async(request_type=dict) - - def test_get_rollout_field_headers(): client = CloudDeployClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12884,8 +12948,8 @@ async def test_get_rollout_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_deploy.CreateRolloutRequest, - dict, + cloud_deploy.CreateRolloutRequest(), + {}, ], ) def test_create_rollout(request_type, transport: str = "grpc"): @@ -12896,7 +12960,7 @@ def test_create_rollout(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_rollout), "__call__") as call: @@ -12940,12 +13004,13 @@ def test_create_rollout_non_empty_request_with_auto_populated_field(): client.create_rollout(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.CreateRolloutRequest( + request_msg = cloud_deploy.CreateRolloutRequest( parent="parent_value", rollout_id="rollout_id_value", request_id="request_id_value", starting_phase_id="starting_phase_id_value", ) + assert args[0] == request_msg def test_create_rollout_use_cached_wrapped_rpc(): @@ -13036,9 +13101,14 @@ async def test_create_rollout_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_rollout_async( - transport: str = "grpc_asyncio", request_type=cloud_deploy.CreateRolloutRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_deploy.CreateRolloutRequest(), + {}, + ], +) +async def test_create_rollout_async(request_type, transport: str = "grpc_asyncio"): client = CloudDeployAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13046,7 +13116,7 @@ async def test_create_rollout_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_rollout), "__call__") as call: @@ -13066,11 +13136,6 @@ async def test_create_rollout_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_rollout_async_from_dict(): - await test_create_rollout_async(request_type=dict) - - def test_create_rollout_field_headers(): client = CloudDeployClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13237,8 +13302,8 @@ async def test_create_rollout_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_deploy.IgnoreJobRequest, - dict, + cloud_deploy.IgnoreJobRequest(), + {}, ], ) def test_ignore_job(request_type, transport: str = "grpc"): @@ -13249,7 +13314,7 @@ def test_ignore_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(type(client.transport.ignore_job), "__call__") as call: @@ -13292,11 +13357,12 @@ def test_ignore_job_non_empty_request_with_auto_populated_field(): client.ignore_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.IgnoreJobRequest( + request_msg = cloud_deploy.IgnoreJobRequest( rollout="rollout_value", phase_id="phase_id_value", job_id="job_id_value", ) + assert args[0] == request_msg def test_ignore_job_use_cached_wrapped_rpc(): @@ -13375,9 +13441,14 @@ async def test_ignore_job_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_ignore_job_async( - transport: str = "grpc_asyncio", request_type=cloud_deploy.IgnoreJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_deploy.IgnoreJobRequest(), + {}, + ], +) +async def test_ignore_job_async(request_type, transport: str = "grpc_asyncio"): client = CloudDeployAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13385,7 +13456,7 @@ async def test_ignore_job_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.ignore_job), "__call__") as call: @@ -13405,11 +13476,6 @@ async def test_ignore_job_async( assert isinstance(response, cloud_deploy.IgnoreJobResponse) -@pytest.mark.asyncio -async def test_ignore_job_async_from_dict(): - await test_ignore_job_async(request_type=dict) - - def test_ignore_job_field_headers(): client = CloudDeployClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13576,8 +13642,8 @@ async def test_ignore_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_deploy.RetryJobRequest, - dict, + cloud_deploy.RetryJobRequest(), + {}, ], ) def test_retry_job(request_type, transport: str = "grpc"): @@ -13588,7 +13654,7 @@ def test_retry_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(type(client.transport.retry_job), "__call__") as call: @@ -13631,11 +13697,12 @@ def test_retry_job_non_empty_request_with_auto_populated_field(): client.retry_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.RetryJobRequest( + request_msg = cloud_deploy.RetryJobRequest( rollout="rollout_value", phase_id="phase_id_value", job_id="job_id_value", ) + assert args[0] == request_msg def test_retry_job_use_cached_wrapped_rpc(): @@ -13714,9 +13781,14 @@ async def test_retry_job_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_retry_job_async( - transport: str = "grpc_asyncio", request_type=cloud_deploy.RetryJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_deploy.RetryJobRequest(), + {}, + ], +) +async def test_retry_job_async(request_type, transport: str = "grpc_asyncio"): client = CloudDeployAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13724,7 +13796,7 @@ async def test_retry_job_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.retry_job), "__call__") as call: @@ -13744,11 +13816,6 @@ async def test_retry_job_async( assert isinstance(response, cloud_deploy.RetryJobResponse) -@pytest.mark.asyncio -async def test_retry_job_async_from_dict(): - await test_retry_job_async(request_type=dict) - - def test_retry_job_field_headers(): client = CloudDeployClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13915,8 +13982,8 @@ async def test_retry_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_deploy.ListJobRunsRequest, - dict, + cloud_deploy.ListJobRunsRequest(), + {}, ], ) def test_list_job_runs(request_type, transport: str = "grpc"): @@ -13927,7 +13994,7 @@ def test_list_job_runs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_job_runs), "__call__") as call: @@ -13976,12 +14043,13 @@ def test_list_job_runs_non_empty_request_with_auto_populated_field(): client.list_job_runs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.ListJobRunsRequest( + request_msg = cloud_deploy.ListJobRunsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_job_runs_use_cached_wrapped_rpc(): @@ -14062,9 +14130,14 @@ async def test_list_job_runs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_job_runs_async( - transport: str = "grpc_asyncio", request_type=cloud_deploy.ListJobRunsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_deploy.ListJobRunsRequest(), + {}, + ], +) +async def test_list_job_runs_async(request_type, transport: str = "grpc_asyncio"): client = CloudDeployAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14072,7 +14145,7 @@ async def test_list_job_runs_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_job_runs), "__call__") as call: @@ -14097,11 +14170,6 @@ async def test_list_job_runs_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_job_runs_async_from_dict(): - await test_list_job_runs_async(request_type=dict) - - def test_list_job_runs_field_headers(): client = CloudDeployClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14438,8 +14506,8 @@ async def test_list_job_runs_async_pages(): @pytest.mark.parametrize( "request_type", [ - cloud_deploy.GetJobRunRequest, - dict, + cloud_deploy.GetJobRunRequest(), + {}, ], ) def test_get_job_run(request_type, transport: str = "grpc"): @@ -14450,7 +14518,7 @@ def test_get_job_run(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_job_run), "__call__") as call: @@ -14504,9 +14572,10 @@ def test_get_job_run_non_empty_request_with_auto_populated_field(): client.get_job_run(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.GetJobRunRequest( + request_msg = cloud_deploy.GetJobRunRequest( name="name_value", ) + assert args[0] == request_msg def test_get_job_run_use_cached_wrapped_rpc(): @@ -14587,9 +14656,14 @@ async def test_get_job_run_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_job_run_async( - transport: str = "grpc_asyncio", request_type=cloud_deploy.GetJobRunRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_deploy.GetJobRunRequest(), + {}, + ], +) +async def test_get_job_run_async(request_type, transport: str = "grpc_asyncio"): client = CloudDeployAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14597,7 +14671,7 @@ async def test_get_job_run_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_job_run), "__call__") as call: @@ -14630,11 +14704,6 @@ async def test_get_job_run_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_job_run_async_from_dict(): - await test_get_job_run_async(request_type=dict) - - def test_get_job_run_field_headers(): client = CloudDeployClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14777,8 +14846,8 @@ async def test_get_job_run_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_deploy.TerminateJobRunRequest, - dict, + cloud_deploy.TerminateJobRunRequest(), + {}, ], ) def test_terminate_job_run(request_type, transport: str = "grpc"): @@ -14789,7 +14858,7 @@ def test_terminate_job_run(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -14834,9 +14903,10 @@ def test_terminate_job_run_non_empty_request_with_auto_populated_field(): client.terminate_job_run(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.TerminateJobRunRequest( + request_msg = cloud_deploy.TerminateJobRunRequest( name="name_value", ) + assert args[0] == request_msg def test_terminate_job_run_use_cached_wrapped_rpc(): @@ -14919,9 +14989,14 @@ async def test_terminate_job_run_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_terminate_job_run_async( - transport: str = "grpc_asyncio", request_type=cloud_deploy.TerminateJobRunRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_deploy.TerminateJobRunRequest(), + {}, + ], +) +async def test_terminate_job_run_async(request_type, transport: str = "grpc_asyncio"): client = CloudDeployAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14929,7 +15004,7 @@ async def test_terminate_job_run_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( @@ -14951,11 +15026,6 @@ async def test_terminate_job_run_async( assert isinstance(response, cloud_deploy.TerminateJobRunResponse) -@pytest.mark.asyncio -async def test_terminate_job_run_async_from_dict(): - await test_terminate_job_run_async(request_type=dict) - - def test_terminate_job_run_field_headers(): client = CloudDeployClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15110,8 +15180,8 @@ async def test_terminate_job_run_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_deploy.GetConfigRequest, - dict, + cloud_deploy.GetConfigRequest(), + {}, ], ) def test_get_config(request_type, transport: str = "grpc"): @@ -15122,7 +15192,7 @@ def test_get_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(type(client.transport.get_config), "__call__") as call: @@ -15168,9 +15238,10 @@ def test_get_config_non_empty_request_with_auto_populated_field(): client.get_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.GetConfigRequest( + request_msg = cloud_deploy.GetConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_config_use_cached_wrapped_rpc(): @@ -15249,9 +15320,14 @@ async def test_get_config_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_config_async( - transport: str = "grpc_asyncio", request_type=cloud_deploy.GetConfigRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_deploy.GetConfigRequest(), + {}, + ], +) +async def test_get_config_async(request_type, transport: str = "grpc_asyncio"): client = CloudDeployAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -15259,7 +15335,7 @@ async def test_get_config_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_config), "__call__") as call: @@ -15284,11 +15360,6 @@ async def test_get_config_async( assert response.default_skaffold_version == "default_skaffold_version_value" -@pytest.mark.asyncio -async def test_get_config_async_from_dict(): - await test_get_config_async(request_type=dict) - - def test_get_config_field_headers(): client = CloudDeployClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15431,8 +15502,8 @@ async def test_get_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_deploy.CreateAutomationRequest, - dict, + cloud_deploy.CreateAutomationRequest(), + {}, ], ) def test_create_automation(request_type, transport: str = "grpc"): @@ -15443,7 +15514,7 @@ def test_create_automation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -15490,11 +15561,12 @@ def test_create_automation_non_empty_request_with_auto_populated_field(): client.create_automation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.CreateAutomationRequest( + request_msg = cloud_deploy.CreateAutomationRequest( parent="parent_value", automation_id="automation_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_automation_use_cached_wrapped_rpc(): @@ -15587,9 +15659,14 @@ async def test_create_automation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_automation_async( - transport: str = "grpc_asyncio", request_type=cloud_deploy.CreateAutomationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_deploy.CreateAutomationRequest(), + {}, + ], +) +async def test_create_automation_async(request_type, transport: str = "grpc_asyncio"): client = CloudDeployAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -15597,7 +15674,7 @@ async def test_create_automation_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( @@ -15619,11 +15696,6 @@ async def test_create_automation_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_automation_async_from_dict(): - await test_create_automation_async(request_type=dict) - - def test_create_automation_field_headers(): client = CloudDeployClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15798,8 +15870,8 @@ async def test_create_automation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_deploy.UpdateAutomationRequest, - dict, + cloud_deploy.UpdateAutomationRequest(), + {}, ], ) def test_update_automation(request_type, transport: str = "grpc"): @@ -15810,7 +15882,7 @@ def test_update_automation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -15855,9 +15927,10 @@ def test_update_automation_non_empty_request_with_auto_populated_field(): client.update_automation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.UpdateAutomationRequest( + request_msg = cloud_deploy.UpdateAutomationRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_automation_use_cached_wrapped_rpc(): @@ -15950,9 +16023,14 @@ async def test_update_automation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_automation_async( - transport: str = "grpc_asyncio", request_type=cloud_deploy.UpdateAutomationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_deploy.UpdateAutomationRequest(), + {}, + ], +) +async def test_update_automation_async(request_type, transport: str = "grpc_asyncio"): client = CloudDeployAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -15960,7 +16038,7 @@ async def test_update_automation_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( @@ -15982,11 +16060,6 @@ async def test_update_automation_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_automation_async_from_dict(): - await test_update_automation_async(request_type=dict) - - def test_update_automation_field_headers(): client = CloudDeployClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16151,8 +16224,8 @@ async def test_update_automation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_deploy.DeleteAutomationRequest, - dict, + cloud_deploy.DeleteAutomationRequest(), + {}, ], ) def test_delete_automation(request_type, transport: str = "grpc"): @@ -16163,7 +16236,7 @@ def test_delete_automation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -16210,11 +16283,12 @@ def test_delete_automation_non_empty_request_with_auto_populated_field(): client.delete_automation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.DeleteAutomationRequest( + request_msg = cloud_deploy.DeleteAutomationRequest( name="name_value", request_id="request_id_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_automation_use_cached_wrapped_rpc(): @@ -16307,9 +16381,14 @@ async def test_delete_automation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_automation_async( - transport: str = "grpc_asyncio", request_type=cloud_deploy.DeleteAutomationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_deploy.DeleteAutomationRequest(), + {}, + ], +) +async def test_delete_automation_async(request_type, transport: str = "grpc_asyncio"): client = CloudDeployAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -16317,7 +16396,7 @@ async def test_delete_automation_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( @@ -16339,11 +16418,6 @@ async def test_delete_automation_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_automation_async_from_dict(): - await test_delete_automation_async(request_type=dict) - - def test_delete_automation_field_headers(): client = CloudDeployClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16498,8 +16572,8 @@ async def test_delete_automation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_deploy.GetAutomationRequest, - dict, + cloud_deploy.GetAutomationRequest(), + {}, ], ) def test_get_automation(request_type, transport: str = "grpc"): @@ -16510,7 +16584,7 @@ def test_get_automation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_automation), "__call__") as call: @@ -16564,9 +16638,10 @@ def test_get_automation_non_empty_request_with_auto_populated_field(): client.get_automation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.GetAutomationRequest( + request_msg = cloud_deploy.GetAutomationRequest( name="name_value", ) + assert args[0] == request_msg def test_get_automation_use_cached_wrapped_rpc(): @@ -16647,9 +16722,14 @@ async def test_get_automation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_automation_async( - transport: str = "grpc_asyncio", request_type=cloud_deploy.GetAutomationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_deploy.GetAutomationRequest(), + {}, + ], +) +async def test_get_automation_async(request_type, transport: str = "grpc_asyncio"): client = CloudDeployAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -16657,7 +16737,7 @@ async def test_get_automation_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_automation), "__call__") as call: @@ -16690,11 +16770,6 @@ async def test_get_automation_async( assert response.service_account == "service_account_value" -@pytest.mark.asyncio -async def test_get_automation_async_from_dict(): - await test_get_automation_async(request_type=dict) - - def test_get_automation_field_headers(): client = CloudDeployClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16841,8 +16916,8 @@ async def test_get_automation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_deploy.ListAutomationsRequest, - dict, + cloud_deploy.ListAutomationsRequest(), + {}, ], ) def test_list_automations(request_type, transport: str = "grpc"): @@ -16853,7 +16928,7 @@ def test_list_automations(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_automations), "__call__") as call: @@ -16902,12 +16977,13 @@ def test_list_automations_non_empty_request_with_auto_populated_field(): client.list_automations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.ListAutomationsRequest( + request_msg = cloud_deploy.ListAutomationsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_automations_use_cached_wrapped_rpc(): @@ -16990,9 +17066,14 @@ async def test_list_automations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_automations_async( - transport: str = "grpc_asyncio", request_type=cloud_deploy.ListAutomationsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_deploy.ListAutomationsRequest(), + {}, + ], +) +async def test_list_automations_async(request_type, transport: str = "grpc_asyncio"): client = CloudDeployAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -17000,7 +17081,7 @@ async def test_list_automations_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_automations), "__call__") as call: @@ -17025,11 +17106,6 @@ async def test_list_automations_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_automations_async_from_dict(): - await test_list_automations_async(request_type=dict) - - def test_list_automations_field_headers(): client = CloudDeployClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17366,8 +17442,8 @@ async def test_list_automations_async_pages(): @pytest.mark.parametrize( "request_type", [ - cloud_deploy.GetAutomationRunRequest, - dict, + cloud_deploy.GetAutomationRunRequest(), + {}, ], ) def test_get_automation_run(request_type, transport: str = "grpc"): @@ -17378,7 +17454,7 @@ def test_get_automation_run(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -17440,9 +17516,10 @@ def test_get_automation_run_non_empty_request_with_auto_populated_field(): client.get_automation_run(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.GetAutomationRunRequest( + request_msg = cloud_deploy.GetAutomationRunRequest( name="name_value", ) + assert args[0] == request_msg def test_get_automation_run_use_cached_wrapped_rpc(): @@ -17527,9 +17604,14 @@ async def test_get_automation_run_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_automation_run_async( - transport: str = "grpc_asyncio", request_type=cloud_deploy.GetAutomationRunRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_deploy.GetAutomationRunRequest(), + {}, + ], +) +async def test_get_automation_run_async(request_type, transport: str = "grpc_asyncio"): client = CloudDeployAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -17537,7 +17619,7 @@ async def test_get_automation_run_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( @@ -17576,11 +17658,6 @@ async def test_get_automation_run_async( assert response.automation_id == "automation_id_value" -@pytest.mark.asyncio -async def test_get_automation_run_async_from_dict(): - await test_get_automation_run_async(request_type=dict) - - def test_get_automation_run_field_headers(): client = CloudDeployClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17735,8 +17812,8 @@ async def test_get_automation_run_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_deploy.ListAutomationRunsRequest, - dict, + cloud_deploy.ListAutomationRunsRequest(), + {}, ], ) def test_list_automation_runs(request_type, transport: str = "grpc"): @@ -17747,7 +17824,7 @@ def test_list_automation_runs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -17800,12 +17877,13 @@ def test_list_automation_runs_non_empty_request_with_auto_populated_field(): client.list_automation_runs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.ListAutomationRunsRequest( + request_msg = cloud_deploy.ListAutomationRunsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_automation_runs_use_cached_wrapped_rpc(): @@ -17890,8 +17968,15 @@ async def test_list_automation_runs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloud_deploy.ListAutomationRunsRequest(), + {}, + ], +) async def test_list_automation_runs_async( - transport: str = "grpc_asyncio", request_type=cloud_deploy.ListAutomationRunsRequest + request_type, transport: str = "grpc_asyncio" ): client = CloudDeployAsyncClient( credentials=async_anonymous_credentials(), @@ -17900,7 +17985,7 @@ async def test_list_automation_runs_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( @@ -17927,11 +18012,6 @@ async def test_list_automation_runs_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_automation_runs_async_from_dict(): - await test_list_automation_runs_async(request_type=dict) - - def test_list_automation_runs_field_headers(): client = CloudDeployClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18284,8 +18364,8 @@ async def test_list_automation_runs_async_pages(): @pytest.mark.parametrize( "request_type", [ - cloud_deploy.CancelAutomationRunRequest, - dict, + cloud_deploy.CancelAutomationRunRequest(), + {}, ], ) def test_cancel_automation_run(request_type, transport: str = "grpc"): @@ -18296,7 +18376,7 @@ def test_cancel_automation_run(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -18341,9 +18421,10 @@ def test_cancel_automation_run_non_empty_request_with_auto_populated_field(): client.cancel_automation_run(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_deploy.CancelAutomationRunRequest( + request_msg = cloud_deploy.CancelAutomationRunRequest( name="name_value", ) + assert args[0] == request_msg def test_cancel_automation_run_use_cached_wrapped_rpc(): @@ -18429,9 +18510,15 @@ async def test_cancel_automation_run_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloud_deploy.CancelAutomationRunRequest(), + {}, + ], +) async def test_cancel_automation_run_async( - transport: str = "grpc_asyncio", - request_type=cloud_deploy.CancelAutomationRunRequest, + request_type, transport: str = "grpc_asyncio" ): client = CloudDeployAsyncClient( credentials=async_anonymous_credentials(), @@ -18440,7 +18527,7 @@ async def test_cancel_automation_run_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( @@ -18462,11 +18549,6 @@ async def test_cancel_automation_run_async( assert isinstance(response, cloud_deploy.CancelAutomationRunResponse) -@pytest.mark.asyncio -async def test_cancel_automation_run_async_from_dict(): - await test_cancel_automation_run_async(request_type=dict) - - def test_cancel_automation_run_field_headers(): client = CloudDeployClient( credentials=ga_credentials.AnonymousCredentials(), @@ -28226,7 +28308,6 @@ def test_list_delivery_pipelines_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.ListDeliveryPipelinesRequest() - assert args[0] == request_msg @@ -28249,7 +28330,6 @@ def test_get_delivery_pipeline_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.GetDeliveryPipelineRequest() - assert args[0] == request_msg @@ -28272,7 +28352,6 @@ def test_create_delivery_pipeline_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.CreateDeliveryPipelineRequest() - assert args[0] == request_msg @@ -28295,7 +28374,6 @@ def test_update_delivery_pipeline_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.UpdateDeliveryPipelineRequest() - assert args[0] == request_msg @@ -28318,7 +28396,6 @@ def test_delete_delivery_pipeline_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.DeleteDeliveryPipelineRequest() - assert args[0] == request_msg @@ -28339,7 +28416,6 @@ def test_list_targets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.ListTargetsRequest() - assert args[0] == request_msg @@ -28360,7 +28436,6 @@ def test_rollback_target_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.RollbackTargetRequest() - assert args[0] == request_msg @@ -28381,7 +28456,6 @@ def test_get_target_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.GetTargetRequest() - assert args[0] == request_msg @@ -28402,7 +28476,6 @@ def test_create_target_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.CreateTargetRequest() - assert args[0] == request_msg @@ -28423,7 +28496,6 @@ def test_update_target_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.UpdateTargetRequest() - assert args[0] == request_msg @@ -28444,7 +28516,6 @@ def test_delete_target_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.DeleteTargetRequest() - assert args[0] == request_msg @@ -28467,7 +28538,6 @@ def test_list_custom_target_types_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.ListCustomTargetTypesRequest() - assert args[0] == request_msg @@ -28490,7 +28560,6 @@ def test_get_custom_target_type_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.GetCustomTargetTypeRequest() - assert args[0] == request_msg @@ -28513,7 +28582,6 @@ def test_create_custom_target_type_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.CreateCustomTargetTypeRequest() - assert args[0] == request_msg @@ -28536,7 +28604,6 @@ def test_update_custom_target_type_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.UpdateCustomTargetTypeRequest() - assert args[0] == request_msg @@ -28559,7 +28626,6 @@ def test_delete_custom_target_type_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.DeleteCustomTargetTypeRequest() - assert args[0] == request_msg @@ -28580,7 +28646,6 @@ def test_list_releases_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.ListReleasesRequest() - assert args[0] == request_msg @@ -28601,7 +28666,6 @@ def test_get_release_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.GetReleaseRequest() - assert args[0] == request_msg @@ -28622,7 +28686,6 @@ def test_create_release_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.CreateReleaseRequest() - assert args[0] == request_msg @@ -28643,7 +28706,6 @@ def test_abandon_release_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.AbandonReleaseRequest() - assert args[0] == request_msg @@ -28666,7 +28728,6 @@ def test_create_deploy_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.CreateDeployPolicyRequest() - assert args[0] == request_msg @@ -28689,7 +28750,6 @@ def test_update_deploy_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.UpdateDeployPolicyRequest() - assert args[0] == request_msg @@ -28712,7 +28772,6 @@ def test_delete_deploy_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.DeleteDeployPolicyRequest() - assert args[0] == request_msg @@ -28735,7 +28794,6 @@ def test_list_deploy_policies_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.ListDeployPoliciesRequest() - assert args[0] == request_msg @@ -28758,7 +28816,6 @@ def test_get_deploy_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.GetDeployPolicyRequest() - assert args[0] == request_msg @@ -28779,7 +28836,6 @@ def test_approve_rollout_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.ApproveRolloutRequest() - assert args[0] == request_msg @@ -28800,7 +28856,6 @@ def test_advance_rollout_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.AdvanceRolloutRequest() - assert args[0] == request_msg @@ -28821,7 +28876,6 @@ def test_cancel_rollout_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.CancelRolloutRequest() - assert args[0] == request_msg @@ -28842,7 +28896,6 @@ def test_list_rollouts_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.ListRolloutsRequest() - assert args[0] == request_msg @@ -28863,7 +28916,6 @@ def test_get_rollout_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.GetRolloutRequest() - assert args[0] == request_msg @@ -28884,7 +28936,6 @@ def test_create_rollout_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.CreateRolloutRequest() - assert args[0] == request_msg @@ -28905,7 +28956,6 @@ def test_ignore_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.IgnoreJobRequest() - assert args[0] == request_msg @@ -28926,7 +28976,6 @@ def test_retry_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.RetryJobRequest() - assert args[0] == request_msg @@ -28947,7 +28996,6 @@ def test_list_job_runs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.ListJobRunsRequest() - assert args[0] == request_msg @@ -28968,7 +29016,6 @@ def test_get_job_run_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.GetJobRunRequest() - assert args[0] == request_msg @@ -28991,7 +29038,6 @@ def test_terminate_job_run_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.TerminateJobRunRequest() - assert args[0] == request_msg @@ -29012,7 +29058,6 @@ def test_get_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.GetConfigRequest() - assert args[0] == request_msg @@ -29035,7 +29080,6 @@ def test_create_automation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.CreateAutomationRequest() - assert args[0] == request_msg @@ -29058,7 +29102,6 @@ def test_update_automation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.UpdateAutomationRequest() - assert args[0] == request_msg @@ -29081,7 +29124,6 @@ def test_delete_automation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.DeleteAutomationRequest() - assert args[0] == request_msg @@ -29102,7 +29144,6 @@ def test_get_automation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.GetAutomationRequest() - assert args[0] == request_msg @@ -29123,7 +29164,6 @@ def test_list_automations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.ListAutomationsRequest() - assert args[0] == request_msg @@ -29146,7 +29186,6 @@ def test_get_automation_run_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.GetAutomationRunRequest() - assert args[0] == request_msg @@ -29169,7 +29208,6 @@ def test_list_automation_runs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.ListAutomationRunsRequest() - assert args[0] == request_msg @@ -29192,7 +29230,6 @@ def test_cancel_automation_run_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.CancelAutomationRunRequest() - assert args[0] == request_msg @@ -29236,7 +29273,6 @@ async def test_list_delivery_pipelines_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.ListDeliveryPipelinesRequest() - assert args[0] == request_msg @@ -29269,7 +29305,6 @@ async def test_get_delivery_pipeline_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.GetDeliveryPipelineRequest() - assert args[0] == request_msg @@ -29296,7 +29331,6 @@ async def test_create_delivery_pipeline_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.CreateDeliveryPipelineRequest() - assert args[0] == request_msg @@ -29323,7 +29357,6 @@ async def test_update_delivery_pipeline_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.UpdateDeliveryPipelineRequest() - assert args[0] == request_msg @@ -29350,7 +29383,6 @@ async def test_delete_delivery_pipeline_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.DeleteDeliveryPipelineRequest() - assert args[0] == request_msg @@ -29378,7 +29410,6 @@ async def test_list_targets_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.ListTargetsRequest() - assert args[0] == request_msg @@ -29403,7 +29434,6 @@ async def test_rollback_target_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.RollbackTargetRequest() - assert args[0] == request_msg @@ -29435,7 +29465,6 @@ async def test_get_target_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.GetTargetRequest() - assert args[0] == request_msg @@ -29460,7 +29489,6 @@ async def test_create_target_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.CreateTargetRequest() - assert args[0] == request_msg @@ -29485,7 +29513,6 @@ async def test_update_target_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.UpdateTargetRequest() - assert args[0] == request_msg @@ -29510,7 +29537,6 @@ async def test_delete_target_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.DeleteTargetRequest() - assert args[0] == request_msg @@ -29540,7 +29566,6 @@ async def test_list_custom_target_types_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.ListCustomTargetTypesRequest() - assert args[0] == request_msg @@ -29573,7 +29598,6 @@ async def test_get_custom_target_type_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.GetCustomTargetTypeRequest() - assert args[0] == request_msg @@ -29600,7 +29624,6 @@ async def test_create_custom_target_type_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.CreateCustomTargetTypeRequest() - assert args[0] == request_msg @@ -29627,7 +29650,6 @@ async def test_update_custom_target_type_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.UpdateCustomTargetTypeRequest() - assert args[0] == request_msg @@ -29654,7 +29676,6 @@ async def test_delete_custom_target_type_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.DeleteCustomTargetTypeRequest() - assert args[0] == request_msg @@ -29682,7 +29703,6 @@ async def test_list_releases_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.ListReleasesRequest() - assert args[0] == request_msg @@ -29717,7 +29737,6 @@ async def test_get_release_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.GetReleaseRequest() - assert args[0] == request_msg @@ -29742,7 +29761,6 @@ async def test_create_release_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.CreateReleaseRequest() - assert args[0] == request_msg @@ -29767,7 +29785,6 @@ async def test_abandon_release_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.AbandonReleaseRequest() - assert args[0] == request_msg @@ -29794,7 +29811,6 @@ async def test_create_deploy_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.CreateDeployPolicyRequest() - assert args[0] == request_msg @@ -29821,7 +29837,6 @@ async def test_update_deploy_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.UpdateDeployPolicyRequest() - assert args[0] == request_msg @@ -29848,7 +29863,6 @@ async def test_delete_deploy_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.DeleteDeployPolicyRequest() - assert args[0] == request_msg @@ -29878,7 +29892,6 @@ async def test_list_deploy_policies_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.ListDeployPoliciesRequest() - assert args[0] == request_msg @@ -29911,7 +29924,6 @@ async def test_get_deploy_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.GetDeployPolicyRequest() - assert args[0] == request_msg @@ -29936,7 +29948,6 @@ async def test_approve_rollout_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.ApproveRolloutRequest() - assert args[0] == request_msg @@ -29961,7 +29972,6 @@ async def test_advance_rollout_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.AdvanceRolloutRequest() - assert args[0] == request_msg @@ -29986,7 +29996,6 @@ async def test_cancel_rollout_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.CancelRolloutRequest() - assert args[0] == request_msg @@ -30014,7 +30023,6 @@ async def test_list_rollouts_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.ListRolloutsRequest() - assert args[0] == request_msg @@ -30054,7 +30062,6 @@ async def test_get_rollout_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.GetRolloutRequest() - assert args[0] == request_msg @@ -30079,7 +30086,6 @@ async def test_create_rollout_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.CreateRolloutRequest() - assert args[0] == request_msg @@ -30104,7 +30110,6 @@ async def test_ignore_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.IgnoreJobRequest() - assert args[0] == request_msg @@ -30129,7 +30134,6 @@ async def test_retry_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.RetryJobRequest() - assert args[0] == request_msg @@ -30157,7 +30161,6 @@ async def test_list_job_runs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.ListJobRunsRequest() - assert args[0] == request_msg @@ -30189,7 +30192,6 @@ async def test_get_job_run_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.GetJobRunRequest() - assert args[0] == request_msg @@ -30216,7 +30218,6 @@ async def test_terminate_job_run_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.TerminateJobRunRequest() - assert args[0] == request_msg @@ -30244,7 +30245,6 @@ async def test_get_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.GetConfigRequest() - assert args[0] == request_msg @@ -30271,7 +30271,6 @@ async def test_create_automation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.CreateAutomationRequest() - assert args[0] == request_msg @@ -30298,7 +30297,6 @@ async def test_update_automation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.UpdateAutomationRequest() - assert args[0] == request_msg @@ -30325,7 +30323,6 @@ async def test_delete_automation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.DeleteAutomationRequest() - assert args[0] == request_msg @@ -30357,7 +30354,6 @@ async def test_get_automation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.GetAutomationRequest() - assert args[0] == request_msg @@ -30385,7 +30381,6 @@ async def test_list_automations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.ListAutomationsRequest() - assert args[0] == request_msg @@ -30421,7 +30416,6 @@ async def test_get_automation_run_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.GetAutomationRunRequest() - assert args[0] == request_msg @@ -30451,7 +30445,6 @@ async def test_list_automation_runs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.ListAutomationRunsRequest() - assert args[0] == request_msg @@ -30478,7 +30471,6 @@ async def test_cancel_automation_run_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.CancelAutomationRunRequest() - assert args[0] == request_msg @@ -38874,7 +38866,6 @@ def test_list_delivery_pipelines_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.ListDeliveryPipelinesRequest() - assert args[0] == request_msg @@ -38896,7 +38887,6 @@ def test_get_delivery_pipeline_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.GetDeliveryPipelineRequest() - assert args[0] == request_msg @@ -38918,7 +38908,6 @@ def test_create_delivery_pipeline_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.CreateDeliveryPipelineRequest() - assert args[0] == request_msg @@ -38940,7 +38929,6 @@ def test_update_delivery_pipeline_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.UpdateDeliveryPipelineRequest() - assert args[0] == request_msg @@ -38962,7 +38950,6 @@ def test_delete_delivery_pipeline_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.DeleteDeliveryPipelineRequest() - assert args[0] == request_msg @@ -38982,7 +38969,6 @@ def test_list_targets_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.ListTargetsRequest() - assert args[0] == request_msg @@ -39002,7 +38988,6 @@ def test_rollback_target_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.RollbackTargetRequest() - assert args[0] == request_msg @@ -39022,7 +39007,6 @@ def test_get_target_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.GetTargetRequest() - assert args[0] == request_msg @@ -39042,7 +39026,6 @@ def test_create_target_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.CreateTargetRequest() - assert args[0] == request_msg @@ -39062,7 +39045,6 @@ def test_update_target_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.UpdateTargetRequest() - assert args[0] == request_msg @@ -39082,7 +39064,6 @@ def test_delete_target_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.DeleteTargetRequest() - assert args[0] == request_msg @@ -39104,7 +39085,6 @@ def test_list_custom_target_types_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.ListCustomTargetTypesRequest() - assert args[0] == request_msg @@ -39126,7 +39106,6 @@ def test_get_custom_target_type_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.GetCustomTargetTypeRequest() - assert args[0] == request_msg @@ -39148,7 +39127,6 @@ def test_create_custom_target_type_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.CreateCustomTargetTypeRequest() - assert args[0] == request_msg @@ -39170,7 +39148,6 @@ def test_update_custom_target_type_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.UpdateCustomTargetTypeRequest() - assert args[0] == request_msg @@ -39192,7 +39169,6 @@ def test_delete_custom_target_type_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.DeleteCustomTargetTypeRequest() - assert args[0] == request_msg @@ -39212,7 +39188,6 @@ def test_list_releases_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.ListReleasesRequest() - assert args[0] == request_msg @@ -39232,7 +39207,6 @@ def test_get_release_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.GetReleaseRequest() - assert args[0] == request_msg @@ -39252,7 +39226,6 @@ def test_create_release_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.CreateReleaseRequest() - assert args[0] == request_msg @@ -39272,7 +39245,6 @@ def test_abandon_release_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.AbandonReleaseRequest() - assert args[0] == request_msg @@ -39294,7 +39266,6 @@ def test_create_deploy_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.CreateDeployPolicyRequest() - assert args[0] == request_msg @@ -39316,7 +39287,6 @@ def test_update_deploy_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.UpdateDeployPolicyRequest() - assert args[0] == request_msg @@ -39338,7 +39308,6 @@ def test_delete_deploy_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.DeleteDeployPolicyRequest() - assert args[0] == request_msg @@ -39360,7 +39329,6 @@ def test_list_deploy_policies_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.ListDeployPoliciesRequest() - assert args[0] == request_msg @@ -39382,7 +39350,6 @@ def test_get_deploy_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.GetDeployPolicyRequest() - assert args[0] == request_msg @@ -39402,7 +39369,6 @@ def test_approve_rollout_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.ApproveRolloutRequest() - assert args[0] == request_msg @@ -39422,7 +39388,6 @@ def test_advance_rollout_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.AdvanceRolloutRequest() - assert args[0] == request_msg @@ -39442,7 +39407,6 @@ def test_cancel_rollout_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.CancelRolloutRequest() - assert args[0] == request_msg @@ -39462,7 +39426,6 @@ def test_list_rollouts_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.ListRolloutsRequest() - assert args[0] == request_msg @@ -39482,7 +39445,6 @@ def test_get_rollout_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.GetRolloutRequest() - assert args[0] == request_msg @@ -39502,7 +39464,6 @@ def test_create_rollout_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.CreateRolloutRequest() - assert args[0] == request_msg @@ -39522,7 +39483,6 @@ def test_ignore_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.IgnoreJobRequest() - assert args[0] == request_msg @@ -39542,7 +39502,6 @@ def test_retry_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.RetryJobRequest() - assert args[0] == request_msg @@ -39562,7 +39521,6 @@ def test_list_job_runs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.ListJobRunsRequest() - assert args[0] == request_msg @@ -39582,7 +39540,6 @@ def test_get_job_run_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.GetJobRunRequest() - assert args[0] == request_msg @@ -39604,7 +39561,6 @@ def test_terminate_job_run_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.TerminateJobRunRequest() - assert args[0] == request_msg @@ -39624,7 +39580,6 @@ def test_get_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.GetConfigRequest() - assert args[0] == request_msg @@ -39646,7 +39601,6 @@ def test_create_automation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.CreateAutomationRequest() - assert args[0] == request_msg @@ -39668,7 +39622,6 @@ def test_update_automation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.UpdateAutomationRequest() - assert args[0] == request_msg @@ -39690,7 +39643,6 @@ def test_delete_automation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.DeleteAutomationRequest() - assert args[0] == request_msg @@ -39710,7 +39662,6 @@ def test_get_automation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.GetAutomationRequest() - assert args[0] == request_msg @@ -39730,7 +39681,6 @@ def test_list_automations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.ListAutomationsRequest() - assert args[0] == request_msg @@ -39752,7 +39702,6 @@ def test_get_automation_run_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.GetAutomationRunRequest() - assert args[0] == request_msg @@ -39774,7 +39723,6 @@ def test_list_automation_runs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.ListAutomationRunsRequest() - assert args[0] == request_msg @@ -39796,7 +39744,6 @@ def test_cancel_automation_run_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_deploy.CancelAutomationRunRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-developerconnect/noxfile.py b/packages/google-cloud-developerconnect/noxfile.py index 2be64ee95f64..e4b4e0709514 100644 --- a/packages/google-cloud-developerconnect/noxfile.py +++ b/packages/google-cloud-developerconnect/noxfile.py @@ -47,7 +47,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-developerconnect" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-developerconnect/setup.py b/packages/google-cloud-developerconnect/setup.py index f7cb6545aafa..aa6aca1f649f 100644 --- a/packages/google-cloud-developerconnect/setup.py +++ b/packages/google-cloud-developerconnect/setup.py @@ -45,7 +45,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/google-cloud-developerconnect/testing/constraints-3.10.txt b/packages/google-cloud-developerconnect/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-developerconnect/testing/constraints-3.10.txt +++ b/packages/google-cloud-developerconnect/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-developerconnect/tests/unit/gapic/developerconnect_v1/test_developer_connect.py b/packages/google-cloud-developerconnect/tests/unit/gapic/developerconnect_v1/test_developer_connect.py index f5d396154c08..0dd26e675a3c 100644 --- a/packages/google-cloud-developerconnect/tests/unit/gapic/developerconnect_v1/test_developer_connect.py +++ b/packages/google-cloud-developerconnect/tests/unit/gapic/developerconnect_v1/test_developer_connect.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 @@ -116,6 +117,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" @@ -1349,8 +1365,8 @@ def test_developer_connect_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - developer_connect.ListConnectionsRequest, - dict, + developer_connect.ListConnectionsRequest(), + {}, ], ) def test_list_connections(request_type, transport: str = "grpc"): @@ -1361,7 +1377,7 @@ def test_list_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(type(client.transport.list_connections), "__call__") as call: @@ -1410,12 +1426,13 @@ def test_list_connections_non_empty_request_with_auto_populated_field(): client.list_connections(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == developer_connect.ListConnectionsRequest( + request_msg = developer_connect.ListConnectionsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_connections_use_cached_wrapped_rpc(): @@ -1498,10 +1515,14 @@ async def test_list_connections_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_connections_async( - transport: str = "grpc_asyncio", - request_type=developer_connect.ListConnectionsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + developer_connect.ListConnectionsRequest(), + {}, + ], +) +async def test_list_connections_async(request_type, transport: str = "grpc_asyncio"): client = DeveloperConnectAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1509,7 +1530,7 @@ async def test_list_connections_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_connections), "__call__") as call: @@ -1534,11 +1555,6 @@ async def test_list_connections_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_connections_async_from_dict(): - await test_list_connections_async(request_type=dict) - - def test_list_connections_field_headers(): client = DeveloperConnectClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1875,8 +1891,8 @@ async def test_list_connections_async_pages(): @pytest.mark.parametrize( "request_type", [ - developer_connect.GetConnectionRequest, - dict, + developer_connect.GetConnectionRequest(), + {}, ], ) def test_get_connection(request_type, transport: str = "grpc"): @@ -1887,7 +1903,7 @@ def test_get_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(type(client.transport.get_connection), "__call__") as call: @@ -1939,9 +1955,10 @@ def test_get_connection_non_empty_request_with_auto_populated_field(): client.get_connection(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == developer_connect.GetConnectionRequest( + request_msg = developer_connect.GetConnectionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_connection_use_cached_wrapped_rpc(): @@ -2022,9 +2039,14 @@ async def test_get_connection_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_connection_async( - transport: str = "grpc_asyncio", request_type=developer_connect.GetConnectionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + developer_connect.GetConnectionRequest(), + {}, + ], +) +async def test_get_connection_async(request_type, transport: str = "grpc_asyncio"): client = DeveloperConnectAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2032,7 +2054,7 @@ async def test_get_connection_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_connection), "__call__") as call: @@ -2063,11 +2085,6 @@ async def test_get_connection_async( assert response.uid == "uid_value" -@pytest.mark.asyncio -async def test_get_connection_async_from_dict(): - await test_get_connection_async(request_type=dict) - - def test_get_connection_field_headers(): client = DeveloperConnectClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2214,8 +2231,8 @@ async def test_get_connection_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - developer_connect.CreateConnectionRequest, - dict, + developer_connect.CreateConnectionRequest(), + {}, ], ) def test_create_connection(request_type, transport: str = "grpc"): @@ -2226,7 +2243,7 @@ def test_create_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( @@ -2272,10 +2289,11 @@ def test_create_connection_non_empty_request_with_auto_populated_field(): client.create_connection(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == developer_connect.CreateConnectionRequest( + request_msg = developer_connect.CreateConnectionRequest( parent="parent_value", connection_id="connection_id_value", ) + assert args[0] == request_msg def test_create_connection_use_cached_wrapped_rpc(): @@ -2368,10 +2386,14 @@ async def test_create_connection_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_connection_async( - transport: str = "grpc_asyncio", - request_type=developer_connect.CreateConnectionRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + developer_connect.CreateConnectionRequest(), + {}, + ], +) +async def test_create_connection_async(request_type, transport: str = "grpc_asyncio"): client = DeveloperConnectAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2379,7 +2401,7 @@ async def test_create_connection_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( @@ -2401,11 +2423,6 @@ async def test_create_connection_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_connection_async_from_dict(): - await test_create_connection_async(request_type=dict) - - def test_create_connection_field_headers(): client = DeveloperConnectClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2604,8 +2621,8 @@ async def test_create_connection_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - developer_connect.UpdateConnectionRequest, - dict, + developer_connect.UpdateConnectionRequest(), + {}, ], ) def test_update_connection(request_type, transport: str = "grpc"): @@ -2616,7 +2633,7 @@ def test_update_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( @@ -2659,7 +2676,8 @@ def test_update_connection_non_empty_request_with_auto_populated_field(): client.update_connection(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == developer_connect.UpdateConnectionRequest() + request_msg = developer_connect.UpdateConnectionRequest() + assert args[0] == request_msg def test_update_connection_use_cached_wrapped_rpc(): @@ -2752,10 +2770,14 @@ async def test_update_connection_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_connection_async( - transport: str = "grpc_asyncio", - request_type=developer_connect.UpdateConnectionRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + developer_connect.UpdateConnectionRequest(), + {}, + ], +) +async def test_update_connection_async(request_type, transport: str = "grpc_asyncio"): client = DeveloperConnectAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2763,7 +2785,7 @@ async def test_update_connection_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( @@ -2785,11 +2807,6 @@ async def test_update_connection_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_connection_async_from_dict(): - await test_update_connection_async(request_type=dict) - - def test_update_connection_field_headers(): client = DeveloperConnectClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2978,8 +2995,8 @@ async def test_update_connection_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - developer_connect.DeleteConnectionRequest, - dict, + developer_connect.DeleteConnectionRequest(), + {}, ], ) def test_delete_connection(request_type, transport: str = "grpc"): @@ -2990,7 +3007,7 @@ def test_delete_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( @@ -3036,10 +3053,11 @@ def test_delete_connection_non_empty_request_with_auto_populated_field(): client.delete_connection(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == developer_connect.DeleteConnectionRequest( + request_msg = developer_connect.DeleteConnectionRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_connection_use_cached_wrapped_rpc(): @@ -3132,10 +3150,14 @@ async def test_delete_connection_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_connection_async( - transport: str = "grpc_asyncio", - request_type=developer_connect.DeleteConnectionRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + developer_connect.DeleteConnectionRequest(), + {}, + ], +) +async def test_delete_connection_async(request_type, transport: str = "grpc_asyncio"): client = DeveloperConnectAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3143,7 +3165,7 @@ async def test_delete_connection_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( @@ -3165,11 +3187,6 @@ async def test_delete_connection_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_connection_async_from_dict(): - await test_delete_connection_async(request_type=dict) - - def test_delete_connection_field_headers(): client = DeveloperConnectClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3324,8 +3341,8 @@ async def test_delete_connection_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - developer_connect.CreateGitRepositoryLinkRequest, - dict, + developer_connect.CreateGitRepositoryLinkRequest(), + {}, ], ) def test_create_git_repository_link(request_type, transport: str = "grpc"): @@ -3336,7 +3353,7 @@ def test_create_git_repository_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( @@ -3382,10 +3399,11 @@ def test_create_git_repository_link_non_empty_request_with_auto_populated_field( client.create_git_repository_link(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == developer_connect.CreateGitRepositoryLinkRequest( + request_msg = developer_connect.CreateGitRepositoryLinkRequest( parent="parent_value", git_repository_link_id="git_repository_link_id_value", ) + assert args[0] == request_msg def test_create_git_repository_link_use_cached_wrapped_rpc(): @@ -3481,9 +3499,15 @@ async def test_create_git_repository_link_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + developer_connect.CreateGitRepositoryLinkRequest(), + {}, + ], +) async def test_create_git_repository_link_async( - transport: str = "grpc_asyncio", - request_type=developer_connect.CreateGitRepositoryLinkRequest, + request_type, transport: str = "grpc_asyncio" ): client = DeveloperConnectAsyncClient( credentials=async_anonymous_credentials(), @@ -3492,7 +3516,7 @@ async def test_create_git_repository_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( @@ -3514,11 +3538,6 @@ async def test_create_git_repository_link_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_git_repository_link_async_from_dict(): - await test_create_git_repository_link_async(request_type=dict) - - def test_create_git_repository_link_field_headers(): client = DeveloperConnectClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3693,8 +3712,8 @@ async def test_create_git_repository_link_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - developer_connect.DeleteGitRepositoryLinkRequest, - dict, + developer_connect.DeleteGitRepositoryLinkRequest(), + {}, ], ) def test_delete_git_repository_link(request_type, transport: str = "grpc"): @@ -3705,7 +3724,7 @@ def test_delete_git_repository_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( @@ -3751,10 +3770,11 @@ def test_delete_git_repository_link_non_empty_request_with_auto_populated_field( client.delete_git_repository_link(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == developer_connect.DeleteGitRepositoryLinkRequest( + request_msg = developer_connect.DeleteGitRepositoryLinkRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_git_repository_link_use_cached_wrapped_rpc(): @@ -3850,9 +3870,15 @@ async def test_delete_git_repository_link_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + developer_connect.DeleteGitRepositoryLinkRequest(), + {}, + ], +) async def test_delete_git_repository_link_async( - transport: str = "grpc_asyncio", - request_type=developer_connect.DeleteGitRepositoryLinkRequest, + request_type, transport: str = "grpc_asyncio" ): client = DeveloperConnectAsyncClient( credentials=async_anonymous_credentials(), @@ -3861,7 +3887,7 @@ async def test_delete_git_repository_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( @@ -3883,11 +3909,6 @@ async def test_delete_git_repository_link_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_git_repository_link_async_from_dict(): - await test_delete_git_repository_link_async(request_type=dict) - - def test_delete_git_repository_link_field_headers(): client = DeveloperConnectClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4042,8 +4063,8 @@ async def test_delete_git_repository_link_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - developer_connect.ListGitRepositoryLinksRequest, - dict, + developer_connect.ListGitRepositoryLinksRequest(), + {}, ], ) def test_list_git_repository_links(request_type, transport: str = "grpc"): @@ -4054,7 +4075,7 @@ def test_list_git_repository_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( @@ -4107,12 +4128,13 @@ def test_list_git_repository_links_non_empty_request_with_auto_populated_field() client.list_git_repository_links(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == developer_connect.ListGitRepositoryLinksRequest( + request_msg = developer_connect.ListGitRepositoryLinksRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_git_repository_links_use_cached_wrapped_rpc(): @@ -4198,9 +4220,15 @@ async def test_list_git_repository_links_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + developer_connect.ListGitRepositoryLinksRequest(), + {}, + ], +) async def test_list_git_repository_links_async( - transport: str = "grpc_asyncio", - request_type=developer_connect.ListGitRepositoryLinksRequest, + request_type, transport: str = "grpc_asyncio" ): client = DeveloperConnectAsyncClient( credentials=async_anonymous_credentials(), @@ -4209,7 +4237,7 @@ async def test_list_git_repository_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( @@ -4236,11 +4264,6 @@ async def test_list_git_repository_links_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_git_repository_links_async_from_dict(): - await test_list_git_repository_links_async(request_type=dict) - - def test_list_git_repository_links_field_headers(): client = DeveloperConnectClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4597,8 +4620,8 @@ async def test_list_git_repository_links_async_pages(): @pytest.mark.parametrize( "request_type", [ - developer_connect.GetGitRepositoryLinkRequest, - dict, + developer_connect.GetGitRepositoryLinkRequest(), + {}, ], ) def test_get_git_repository_link(request_type, transport: str = "grpc"): @@ -4609,7 +4632,7 @@ def test_get_git_repository_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( @@ -4669,9 +4692,10 @@ def test_get_git_repository_link_non_empty_request_with_auto_populated_field(): client.get_git_repository_link(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == developer_connect.GetGitRepositoryLinkRequest( + request_msg = developer_connect.GetGitRepositoryLinkRequest( name="name_value", ) + assert args[0] == request_msg def test_get_git_repository_link_use_cached_wrapped_rpc(): @@ -4757,9 +4781,15 @@ async def test_get_git_repository_link_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + developer_connect.GetGitRepositoryLinkRequest(), + {}, + ], +) async def test_get_git_repository_link_async( - transport: str = "grpc_asyncio", - request_type=developer_connect.GetGitRepositoryLinkRequest, + request_type, transport: str = "grpc_asyncio" ): client = DeveloperConnectAsyncClient( credentials=async_anonymous_credentials(), @@ -4768,7 +4798,7 @@ async def test_get_git_repository_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( @@ -4805,11 +4835,6 @@ async def test_get_git_repository_link_async( assert response.git_proxy_uri == "git_proxy_uri_value" -@pytest.mark.asyncio -async def test_get_git_repository_link_async_from_dict(): - await test_get_git_repository_link_async(request_type=dict) - - def test_get_git_repository_link_field_headers(): client = DeveloperConnectClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4964,8 +4989,8 @@ async def test_get_git_repository_link_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - developer_connect.FetchReadWriteTokenRequest, - dict, + developer_connect.FetchReadWriteTokenRequest(), + {}, ], ) def test_fetch_read_write_token(request_type, transport: str = "grpc"): @@ -4976,7 +5001,7 @@ def test_fetch_read_write_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( @@ -5026,9 +5051,10 @@ def test_fetch_read_write_token_non_empty_request_with_auto_populated_field(): client.fetch_read_write_token(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == developer_connect.FetchReadWriteTokenRequest( + request_msg = developer_connect.FetchReadWriteTokenRequest( git_repository_link="git_repository_link_value", ) + assert args[0] == request_msg def test_fetch_read_write_token_use_cached_wrapped_rpc(): @@ -5114,9 +5140,15 @@ async def test_fetch_read_write_token_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + developer_connect.FetchReadWriteTokenRequest(), + {}, + ], +) async def test_fetch_read_write_token_async( - transport: str = "grpc_asyncio", - request_type=developer_connect.FetchReadWriteTokenRequest, + request_type, transport: str = "grpc_asyncio" ): client = DeveloperConnectAsyncClient( credentials=async_anonymous_credentials(), @@ -5125,7 +5157,7 @@ async def test_fetch_read_write_token_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( @@ -5152,11 +5184,6 @@ async def test_fetch_read_write_token_async( assert response.git_username == "git_username_value" -@pytest.mark.asyncio -async def test_fetch_read_write_token_async_from_dict(): - await test_fetch_read_write_token_async(request_type=dict) - - def test_fetch_read_write_token_field_headers(): client = DeveloperConnectClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5311,8 +5338,8 @@ async def test_fetch_read_write_token_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - developer_connect.FetchReadTokenRequest, - dict, + developer_connect.FetchReadTokenRequest(), + {}, ], ) def test_fetch_read_token(request_type, transport: str = "grpc"): @@ -5323,7 +5350,7 @@ def test_fetch_read_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(type(client.transport.fetch_read_token), "__call__") as call: @@ -5369,9 +5396,10 @@ def test_fetch_read_token_non_empty_request_with_auto_populated_field(): client.fetch_read_token(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == developer_connect.FetchReadTokenRequest( + request_msg = developer_connect.FetchReadTokenRequest( git_repository_link="git_repository_link_value", ) + assert args[0] == request_msg def test_fetch_read_token_use_cached_wrapped_rpc(): @@ -5454,10 +5482,14 @@ async def test_fetch_read_token_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_fetch_read_token_async( - transport: str = "grpc_asyncio", - request_type=developer_connect.FetchReadTokenRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + developer_connect.FetchReadTokenRequest(), + {}, + ], +) +async def test_fetch_read_token_async(request_type, transport: str = "grpc_asyncio"): client = DeveloperConnectAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5465,7 +5497,7 @@ async def test_fetch_read_token_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.fetch_read_token), "__call__") as call: @@ -5490,11 +5522,6 @@ async def test_fetch_read_token_async( assert response.git_username == "git_username_value" -@pytest.mark.asyncio -async def test_fetch_read_token_async_from_dict(): - await test_fetch_read_token_async(request_type=dict) - - def test_fetch_read_token_field_headers(): client = DeveloperConnectClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5641,8 +5668,8 @@ async def test_fetch_read_token_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - developer_connect.FetchLinkableGitRepositoriesRequest, - dict, + developer_connect.FetchLinkableGitRepositoriesRequest(), + {}, ], ) def test_fetch_linkable_git_repositories(request_type, transport: str = "grpc"): @@ -5653,7 +5680,7 @@ def test_fetch_linkable_git_repositories(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5702,10 +5729,11 @@ def test_fetch_linkable_git_repositories_non_empty_request_with_auto_populated_f client.fetch_linkable_git_repositories(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == developer_connect.FetchLinkableGitRepositoriesRequest( + request_msg = developer_connect.FetchLinkableGitRepositoriesRequest( connection="connection_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_fetch_linkable_git_repositories_use_cached_wrapped_rpc(): @@ -5791,9 +5819,15 @@ async def test_fetch_linkable_git_repositories_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + developer_connect.FetchLinkableGitRepositoriesRequest(), + {}, + ], +) async def test_fetch_linkable_git_repositories_async( - transport: str = "grpc_asyncio", - request_type=developer_connect.FetchLinkableGitRepositoriesRequest, + request_type, transport: str = "grpc_asyncio" ): client = DeveloperConnectAsyncClient( credentials=async_anonymous_credentials(), @@ -5802,7 +5836,7 @@ async def test_fetch_linkable_git_repositories_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( @@ -5827,11 +5861,6 @@ async def test_fetch_linkable_git_repositories_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_fetch_linkable_git_repositories_async_from_dict(): - await test_fetch_linkable_git_repositories_async(request_type=dict) - - def test_fetch_linkable_git_repositories_field_headers(): client = DeveloperConnectClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6192,8 +6221,8 @@ async def test_fetch_linkable_git_repositories_async_pages(): @pytest.mark.parametrize( "request_type", [ - developer_connect.FetchGitHubInstallationsRequest, - dict, + developer_connect.FetchGitHubInstallationsRequest(), + {}, ], ) def test_fetch_git_hub_installations(request_type, transport: str = "grpc"): @@ -6204,7 +6233,7 @@ def test_fetch_git_hub_installations(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6249,9 +6278,10 @@ def test_fetch_git_hub_installations_non_empty_request_with_auto_populated_field client.fetch_git_hub_installations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == developer_connect.FetchGitHubInstallationsRequest( + request_msg = developer_connect.FetchGitHubInstallationsRequest( connection="connection_value", ) + assert args[0] == request_msg def test_fetch_git_hub_installations_use_cached_wrapped_rpc(): @@ -6337,9 +6367,15 @@ async def test_fetch_git_hub_installations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + developer_connect.FetchGitHubInstallationsRequest(), + {}, + ], +) async def test_fetch_git_hub_installations_async( - transport: str = "grpc_asyncio", - request_type=developer_connect.FetchGitHubInstallationsRequest, + request_type, transport: str = "grpc_asyncio" ): client = DeveloperConnectAsyncClient( credentials=async_anonymous_credentials(), @@ -6348,7 +6384,7 @@ async def test_fetch_git_hub_installations_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( @@ -6370,11 +6406,6 @@ async def test_fetch_git_hub_installations_async( assert isinstance(response, developer_connect.FetchGitHubInstallationsResponse) -@pytest.mark.asyncio -async def test_fetch_git_hub_installations_async_from_dict(): - await test_fetch_git_hub_installations_async(request_type=dict) - - def test_fetch_git_hub_installations_field_headers(): client = DeveloperConnectClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6529,8 +6560,8 @@ async def test_fetch_git_hub_installations_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - developer_connect.FetchGitRefsRequest, - dict, + developer_connect.FetchGitRefsRequest(), + {}, ], ) def test_fetch_git_refs(request_type, transport: str = "grpc"): @@ -6541,7 +6572,7 @@ def test_fetch_git_refs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.fetch_git_refs), "__call__") as call: @@ -6588,10 +6619,11 @@ def test_fetch_git_refs_non_empty_request_with_auto_populated_field(): client.fetch_git_refs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == developer_connect.FetchGitRefsRequest( + request_msg = developer_connect.FetchGitRefsRequest( git_repository_link="git_repository_link_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_fetch_git_refs_use_cached_wrapped_rpc(): @@ -6672,9 +6704,14 @@ async def test_fetch_git_refs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_fetch_git_refs_async( - transport: str = "grpc_asyncio", request_type=developer_connect.FetchGitRefsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + developer_connect.FetchGitRefsRequest(), + {}, + ], +) +async def test_fetch_git_refs_async(request_type, transport: str = "grpc_asyncio"): client = DeveloperConnectAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6682,7 +6719,7 @@ async def test_fetch_git_refs_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.fetch_git_refs), "__call__") as call: @@ -6707,11 +6744,6 @@ async def test_fetch_git_refs_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_fetch_git_refs_async_from_dict(): - await test_fetch_git_refs_async(request_type=dict) - - def test_fetch_git_refs_field_headers(): client = DeveloperConnectClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7058,8 +7090,8 @@ async def test_fetch_git_refs_async_pages(): @pytest.mark.parametrize( "request_type", [ - developer_connect.ListAccountConnectorsRequest, - dict, + developer_connect.ListAccountConnectorsRequest(), + {}, ], ) def test_list_account_connectors(request_type, transport: str = "grpc"): @@ -7070,7 +7102,7 @@ def test_list_account_connectors(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7123,12 +7155,13 @@ def test_list_account_connectors_non_empty_request_with_auto_populated_field(): client.list_account_connectors(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == developer_connect.ListAccountConnectorsRequest( + request_msg = developer_connect.ListAccountConnectorsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_account_connectors_use_cached_wrapped_rpc(): @@ -7214,9 +7247,15 @@ async def test_list_account_connectors_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + developer_connect.ListAccountConnectorsRequest(), + {}, + ], +) async def test_list_account_connectors_async( - transport: str = "grpc_asyncio", - request_type=developer_connect.ListAccountConnectorsRequest, + request_type, transport: str = "grpc_asyncio" ): client = DeveloperConnectAsyncClient( credentials=async_anonymous_credentials(), @@ -7225,7 +7264,7 @@ async def test_list_account_connectors_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( @@ -7252,11 +7291,6 @@ async def test_list_account_connectors_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_account_connectors_async_from_dict(): - await test_list_account_connectors_async(request_type=dict) - - def test_list_account_connectors_field_headers(): client = DeveloperConnectClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7609,8 +7643,8 @@ async def test_list_account_connectors_async_pages(): @pytest.mark.parametrize( "request_type", [ - developer_connect.GetAccountConnectorRequest, - dict, + developer_connect.GetAccountConnectorRequest(), + {}, ], ) def test_get_account_connector(request_type, transport: str = "grpc"): @@ -7621,7 +7655,7 @@ def test_get_account_connector(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7673,9 +7707,10 @@ def test_get_account_connector_non_empty_request_with_auto_populated_field(): client.get_account_connector(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == developer_connect.GetAccountConnectorRequest( + request_msg = developer_connect.GetAccountConnectorRequest( name="name_value", ) + assert args[0] == request_msg def test_get_account_connector_use_cached_wrapped_rpc(): @@ -7761,9 +7796,15 @@ async def test_get_account_connector_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + developer_connect.GetAccountConnectorRequest(), + {}, + ], +) async def test_get_account_connector_async( - transport: str = "grpc_asyncio", - request_type=developer_connect.GetAccountConnectorRequest, + request_type, transport: str = "grpc_asyncio" ): client = DeveloperConnectAsyncClient( credentials=async_anonymous_credentials(), @@ -7772,7 +7813,7 @@ async def test_get_account_connector_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( @@ -7801,11 +7842,6 @@ async def test_get_account_connector_async( assert response.oauth_start_uri == "oauth_start_uri_value" -@pytest.mark.asyncio -async def test_get_account_connector_async_from_dict(): - await test_get_account_connector_async(request_type=dict) - - def test_get_account_connector_field_headers(): client = DeveloperConnectClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7960,8 +7996,8 @@ async def test_get_account_connector_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - developer_connect.CreateAccountConnectorRequest, - dict, + developer_connect.CreateAccountConnectorRequest(), + {}, ], ) def test_create_account_connector(request_type, transport: str = "grpc"): @@ -7972,7 +8008,7 @@ def test_create_account_connector(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8018,10 +8054,11 @@ def test_create_account_connector_non_empty_request_with_auto_populated_field(): client.create_account_connector(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == developer_connect.CreateAccountConnectorRequest( + request_msg = developer_connect.CreateAccountConnectorRequest( parent="parent_value", account_connector_id="account_connector_id_value", ) + assert args[0] == request_msg def test_create_account_connector_use_cached_wrapped_rpc(): @@ -8117,9 +8154,15 @@ async def test_create_account_connector_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + developer_connect.CreateAccountConnectorRequest(), + {}, + ], +) async def test_create_account_connector_async( - transport: str = "grpc_asyncio", - request_type=developer_connect.CreateAccountConnectorRequest, + request_type, transport: str = "grpc_asyncio" ): client = DeveloperConnectAsyncClient( credentials=async_anonymous_credentials(), @@ -8128,7 +8171,7 @@ async def test_create_account_connector_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( @@ -8150,11 +8193,6 @@ async def test_create_account_connector_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_account_connector_async_from_dict(): - await test_create_account_connector_async(request_type=dict) - - def test_create_account_connector_field_headers(): client = DeveloperConnectClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8353,8 +8391,8 @@ async def test_create_account_connector_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - developer_connect.UpdateAccountConnectorRequest, - dict, + developer_connect.UpdateAccountConnectorRequest(), + {}, ], ) def test_update_account_connector(request_type, transport: str = "grpc"): @@ -8365,7 +8403,7 @@ def test_update_account_connector(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8408,7 +8446,8 @@ def test_update_account_connector_non_empty_request_with_auto_populated_field(): client.update_account_connector(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == developer_connect.UpdateAccountConnectorRequest() + request_msg = developer_connect.UpdateAccountConnectorRequest() + assert args[0] == request_msg def test_update_account_connector_use_cached_wrapped_rpc(): @@ -8504,9 +8543,15 @@ async def test_update_account_connector_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + developer_connect.UpdateAccountConnectorRequest(), + {}, + ], +) async def test_update_account_connector_async( - transport: str = "grpc_asyncio", - request_type=developer_connect.UpdateAccountConnectorRequest, + request_type, transport: str = "grpc_asyncio" ): client = DeveloperConnectAsyncClient( credentials=async_anonymous_credentials(), @@ -8515,7 +8560,7 @@ async def test_update_account_connector_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( @@ -8537,11 +8582,6 @@ async def test_update_account_connector_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_account_connector_async_from_dict(): - await test_update_account_connector_async(request_type=dict) - - def test_update_account_connector_field_headers(): client = DeveloperConnectClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8730,8 +8770,8 @@ async def test_update_account_connector_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - developer_connect.DeleteAccountConnectorRequest, - dict, + developer_connect.DeleteAccountConnectorRequest(), + {}, ], ) def test_delete_account_connector(request_type, transport: str = "grpc"): @@ -8742,7 +8782,7 @@ def test_delete_account_connector(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8788,10 +8828,11 @@ def test_delete_account_connector_non_empty_request_with_auto_populated_field(): client.delete_account_connector(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == developer_connect.DeleteAccountConnectorRequest( + request_msg = developer_connect.DeleteAccountConnectorRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_account_connector_use_cached_wrapped_rpc(): @@ -8887,9 +8928,15 @@ async def test_delete_account_connector_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + developer_connect.DeleteAccountConnectorRequest(), + {}, + ], +) async def test_delete_account_connector_async( - transport: str = "grpc_asyncio", - request_type=developer_connect.DeleteAccountConnectorRequest, + request_type, transport: str = "grpc_asyncio" ): client = DeveloperConnectAsyncClient( credentials=async_anonymous_credentials(), @@ -8898,7 +8945,7 @@ async def test_delete_account_connector_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( @@ -8920,11 +8967,6 @@ async def test_delete_account_connector_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_account_connector_async_from_dict(): - await test_delete_account_connector_async(request_type=dict) - - def test_delete_account_connector_field_headers(): client = DeveloperConnectClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9079,8 +9121,8 @@ async def test_delete_account_connector_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - developer_connect.FetchAccessTokenRequest, - dict, + developer_connect.FetchAccessTokenRequest(), + {}, ], ) def test_fetch_access_token(request_type, transport: str = "grpc"): @@ -9091,7 +9133,7 @@ def test_fetch_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( @@ -9141,9 +9183,10 @@ def test_fetch_access_token_non_empty_request_with_auto_populated_field(): client.fetch_access_token(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == developer_connect.FetchAccessTokenRequest( + request_msg = developer_connect.FetchAccessTokenRequest( account_connector="account_connector_value", ) + assert args[0] == request_msg def test_fetch_access_token_use_cached_wrapped_rpc(): @@ -9228,10 +9271,14 @@ async def test_fetch_access_token_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_fetch_access_token_async( - transport: str = "grpc_asyncio", - request_type=developer_connect.FetchAccessTokenRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + developer_connect.FetchAccessTokenRequest(), + {}, + ], +) +async def test_fetch_access_token_async(request_type, transport: str = "grpc_asyncio"): client = DeveloperConnectAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9239,7 +9286,7 @@ async def test_fetch_access_token_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( @@ -9266,11 +9313,6 @@ async def test_fetch_access_token_async( assert response.scopes == ["scopes_value"] -@pytest.mark.asyncio -async def test_fetch_access_token_async_from_dict(): - await test_fetch_access_token_async(request_type=dict) - - def test_fetch_access_token_field_headers(): client = DeveloperConnectClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9425,8 +9467,8 @@ async def test_fetch_access_token_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - developer_connect.ListUsersRequest, - dict, + developer_connect.ListUsersRequest(), + {}, ], ) def test_list_users(request_type, transport: str = "grpc"): @@ -9437,7 +9479,7 @@ def test_list_users(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_users), "__call__") as call: @@ -9486,12 +9528,13 @@ def test_list_users_non_empty_request_with_auto_populated_field(): client.list_users(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == developer_connect.ListUsersRequest( + request_msg = developer_connect.ListUsersRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_users_use_cached_wrapped_rpc(): @@ -9570,9 +9613,14 @@ async def test_list_users_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_list_users_async( - transport: str = "grpc_asyncio", request_type=developer_connect.ListUsersRequest -): +@pytest.mark.parametrize( + "request_type", + [ + developer_connect.ListUsersRequest(), + {}, + ], +) +async def test_list_users_async(request_type, transport: str = "grpc_asyncio"): client = DeveloperConnectAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9580,7 +9628,7 @@ async def test_list_users_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_users), "__call__") as call: @@ -9605,11 +9653,6 @@ async def test_list_users_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_users_async_from_dict(): - await test_list_users_async(request_type=dict) - - def test_list_users_field_headers(): client = DeveloperConnectClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9946,8 +9989,8 @@ async def test_list_users_async_pages(): @pytest.mark.parametrize( "request_type", [ - developer_connect.DeleteUserRequest, - dict, + developer_connect.DeleteUserRequest(), + {}, ], ) def test_delete_user(request_type, transport: str = "grpc"): @@ -9958,7 +10001,7 @@ def test_delete_user(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_user), "__call__") as call: @@ -10000,10 +10043,11 @@ def test_delete_user_non_empty_request_with_auto_populated_field(): client.delete_user(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == developer_connect.DeleteUserRequest( + request_msg = developer_connect.DeleteUserRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_user_use_cached_wrapped_rpc(): @@ -10094,9 +10138,14 @@ async def test_delete_user_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_user_async( - transport: str = "grpc_asyncio", request_type=developer_connect.DeleteUserRequest -): +@pytest.mark.parametrize( + "request_type", + [ + developer_connect.DeleteUserRequest(), + {}, + ], +) +async def test_delete_user_async(request_type, transport: str = "grpc_asyncio"): client = DeveloperConnectAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10104,7 +10153,7 @@ async def test_delete_user_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_user), "__call__") as call: @@ -10124,11 +10173,6 @@ async def test_delete_user_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_user_async_from_dict(): - await test_delete_user_async(request_type=dict) - - def test_delete_user_field_headers(): client = DeveloperConnectClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10275,8 +10319,8 @@ async def test_delete_user_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - developer_connect.FetchSelfRequest, - dict, + developer_connect.FetchSelfRequest(), + {}, ], ) def test_fetch_self(request_type, transport: str = "grpc"): @@ -10287,7 +10331,7 @@ def test_fetch_self(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.fetch_self), "__call__") as call: @@ -10333,9 +10377,10 @@ def test_fetch_self_non_empty_request_with_auto_populated_field(): client.fetch_self(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == developer_connect.FetchSelfRequest( + request_msg = developer_connect.FetchSelfRequest( name="name_value", ) + assert args[0] == request_msg def test_fetch_self_use_cached_wrapped_rpc(): @@ -10414,9 +10459,14 @@ async def test_fetch_self_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_fetch_self_async( - transport: str = "grpc_asyncio", request_type=developer_connect.FetchSelfRequest -): +@pytest.mark.parametrize( + "request_type", + [ + developer_connect.FetchSelfRequest(), + {}, + ], +) +async def test_fetch_self_async(request_type, transport: str = "grpc_asyncio"): client = DeveloperConnectAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10424,7 +10474,7 @@ async def test_fetch_self_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.fetch_self), "__call__") as call: @@ -10449,11 +10499,6 @@ async def test_fetch_self_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_fetch_self_async_from_dict(): - await test_fetch_self_async(request_type=dict) - - def test_fetch_self_field_headers(): client = DeveloperConnectClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10600,8 +10645,8 @@ async def test_fetch_self_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - developer_connect.DeleteSelfRequest, - dict, + developer_connect.DeleteSelfRequest(), + {}, ], ) def test_delete_self(request_type, transport: str = "grpc"): @@ -10612,7 +10657,7 @@ def test_delete_self(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_self), "__call__") as call: @@ -10653,9 +10698,10 @@ def test_delete_self_non_empty_request_with_auto_populated_field(): client.delete_self(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == developer_connect.DeleteSelfRequest( + request_msg = developer_connect.DeleteSelfRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_self_use_cached_wrapped_rpc(): @@ -10746,9 +10792,14 @@ async def test_delete_self_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_self_async( - transport: str = "grpc_asyncio", request_type=developer_connect.DeleteSelfRequest -): +@pytest.mark.parametrize( + "request_type", + [ + developer_connect.DeleteSelfRequest(), + {}, + ], +) +async def test_delete_self_async(request_type, transport: str = "grpc_asyncio"): client = DeveloperConnectAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10756,7 +10807,7 @@ async def test_delete_self_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_self), "__call__") as call: @@ -10776,11 +10827,6 @@ async def test_delete_self_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_self_async_from_dict(): - await test_delete_self_async(request_type=dict) - - def test_delete_self_field_headers(): client = DeveloperConnectClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10927,8 +10973,8 @@ async def test_delete_self_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - developer_connect.StartOAuthRequest, - dict, + developer_connect.StartOAuthRequest(), + {}, ], ) def test_start_o_auth(request_type, transport: str = "grpc"): @@ -10939,7 +10985,7 @@ def test_start_o_auth(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.start_o_auth), "__call__") as call: @@ -10994,9 +11040,10 @@ def test_start_o_auth_non_empty_request_with_auto_populated_field(): client.start_o_auth(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == developer_connect.StartOAuthRequest( + request_msg = developer_connect.StartOAuthRequest( account_connector="account_connector_value", ) + assert args[0] == request_msg def test_start_o_auth_use_cached_wrapped_rpc(): @@ -11077,9 +11124,14 @@ async def test_start_o_auth_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_start_o_auth_async( - transport: str = "grpc_asyncio", request_type=developer_connect.StartOAuthRequest -): +@pytest.mark.parametrize( + "request_type", + [ + developer_connect.StartOAuthRequest(), + {}, + ], +) +async def test_start_o_auth_async(request_type, transport: str = "grpc_asyncio"): client = DeveloperConnectAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11087,7 +11139,7 @@ async def test_start_o_auth_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.start_o_auth), "__call__") as call: @@ -11120,11 +11172,6 @@ async def test_start_o_auth_async( assert response.auth_uri == "auth_uri_value" -@pytest.mark.asyncio -async def test_start_o_auth_async_from_dict(): - await test_start_o_auth_async(request_type=dict) - - def test_start_o_auth_field_headers(): client = DeveloperConnectClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11271,8 +11318,8 @@ async def test_start_o_auth_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - developer_connect.FinishOAuthRequest, - dict, + developer_connect.FinishOAuthRequest(), + {}, ], ) def test_finish_o_auth(request_type, transport: str = "grpc"): @@ -11283,7 +11330,7 @@ def test_finish_o_auth(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.finish_o_auth), "__call__") as call: @@ -11324,9 +11371,10 @@ def test_finish_o_auth_non_empty_request_with_auto_populated_field(): client.finish_o_auth(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == developer_connect.FinishOAuthRequest( + request_msg = developer_connect.FinishOAuthRequest( account_connector="account_connector_value", ) + assert args[0] == request_msg def test_finish_o_auth_use_cached_wrapped_rpc(): @@ -11407,9 +11455,14 @@ async def test_finish_o_auth_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_finish_o_auth_async( - transport: str = "grpc_asyncio", request_type=developer_connect.FinishOAuthRequest -): +@pytest.mark.parametrize( + "request_type", + [ + developer_connect.FinishOAuthRequest(), + {}, + ], +) +async def test_finish_o_auth_async(request_type, transport: str = "grpc_asyncio"): client = DeveloperConnectAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11417,7 +11470,7 @@ async def test_finish_o_auth_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.finish_o_auth), "__call__") as call: @@ -11437,11 +11490,6 @@ async def test_finish_o_auth_async( assert isinstance(response, developer_connect.FinishOAuthResponse) -@pytest.mark.asyncio -async def test_finish_o_auth_async_from_dict(): - await test_finish_o_auth_async(request_type=dict) - - def test_finish_o_auth_field_headers(): client = DeveloperConnectClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17258,7 +17306,6 @@ def test_list_connections_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.ListConnectionsRequest() - assert args[0] == request_msg @@ -17279,7 +17326,6 @@ def test_get_connection_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.GetConnectionRequest() - assert args[0] == request_msg @@ -17302,7 +17348,6 @@ def test_create_connection_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.CreateConnectionRequest() - assert args[0] == request_msg @@ -17325,7 +17370,6 @@ def test_update_connection_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.UpdateConnectionRequest() - assert args[0] == request_msg @@ -17348,7 +17392,6 @@ def test_delete_connection_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.DeleteConnectionRequest() - assert args[0] == request_msg @@ -17371,7 +17414,6 @@ def test_create_git_repository_link_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.CreateGitRepositoryLinkRequest() - assert args[0] == request_msg @@ -17394,7 +17436,6 @@ def test_delete_git_repository_link_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.DeleteGitRepositoryLinkRequest() - assert args[0] == request_msg @@ -17417,7 +17458,6 @@ def test_list_git_repository_links_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.ListGitRepositoryLinksRequest() - assert args[0] == request_msg @@ -17440,7 +17480,6 @@ def test_get_git_repository_link_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.GetGitRepositoryLinkRequest() - assert args[0] == request_msg @@ -17463,7 +17502,6 @@ def test_fetch_read_write_token_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.FetchReadWriteTokenRequest() - assert args[0] == request_msg @@ -17484,7 +17522,6 @@ def test_fetch_read_token_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.FetchReadTokenRequest() - assert args[0] == request_msg @@ -17507,7 +17544,6 @@ def test_fetch_linkable_git_repositories_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.FetchLinkableGitRepositoriesRequest() - assert args[0] == request_msg @@ -17530,7 +17566,6 @@ def test_fetch_git_hub_installations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.FetchGitHubInstallationsRequest() - assert args[0] == request_msg @@ -17551,7 +17586,6 @@ def test_fetch_git_refs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.FetchGitRefsRequest() - assert args[0] == request_msg @@ -17574,7 +17608,6 @@ def test_list_account_connectors_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.ListAccountConnectorsRequest() - assert args[0] == request_msg @@ -17597,7 +17630,6 @@ def test_get_account_connector_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.GetAccountConnectorRequest() - assert args[0] == request_msg @@ -17620,7 +17652,6 @@ def test_create_account_connector_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.CreateAccountConnectorRequest() - assert args[0] == request_msg @@ -17643,7 +17674,6 @@ def test_update_account_connector_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.UpdateAccountConnectorRequest() - assert args[0] == request_msg @@ -17666,7 +17696,6 @@ def test_delete_account_connector_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.DeleteAccountConnectorRequest() - assert args[0] == request_msg @@ -17689,7 +17718,6 @@ def test_fetch_access_token_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.FetchAccessTokenRequest() - assert args[0] == request_msg @@ -17710,7 +17738,6 @@ def test_list_users_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.ListUsersRequest() - assert args[0] == request_msg @@ -17731,7 +17758,6 @@ def test_delete_user_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.DeleteUserRequest() - assert args[0] == request_msg @@ -17752,7 +17778,6 @@ def test_fetch_self_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.FetchSelfRequest() - assert args[0] == request_msg @@ -17773,7 +17798,6 @@ def test_delete_self_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.DeleteSelfRequest() - assert args[0] == request_msg @@ -17794,7 +17818,6 @@ def test_start_o_auth_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.StartOAuthRequest() - assert args[0] == request_msg @@ -17815,7 +17838,6 @@ def test_finish_o_auth_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.FinishOAuthRequest() - assert args[0] == request_msg @@ -17857,7 +17879,6 @@ async def test_list_connections_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.ListConnectionsRequest() - assert args[0] == request_msg @@ -17888,7 +17909,6 @@ async def test_get_connection_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.GetConnectionRequest() - assert args[0] == request_msg @@ -17915,7 +17935,6 @@ async def test_create_connection_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.CreateConnectionRequest() - assert args[0] == request_msg @@ -17942,7 +17961,6 @@ async def test_update_connection_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.UpdateConnectionRequest() - assert args[0] == request_msg @@ -17969,7 +17987,6 @@ async def test_delete_connection_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.DeleteConnectionRequest() - assert args[0] == request_msg @@ -17996,7 +18013,6 @@ async def test_create_git_repository_link_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.CreateGitRepositoryLinkRequest() - assert args[0] == request_msg @@ -18023,7 +18039,6 @@ async def test_delete_git_repository_link_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.DeleteGitRepositoryLinkRequest() - assert args[0] == request_msg @@ -18053,7 +18068,6 @@ async def test_list_git_repository_links_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.ListGitRepositoryLinksRequest() - assert args[0] == request_msg @@ -18088,7 +18102,6 @@ async def test_get_git_repository_link_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.GetGitRepositoryLinkRequest() - assert args[0] == request_msg @@ -18118,7 +18131,6 @@ async def test_fetch_read_write_token_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.FetchReadWriteTokenRequest() - assert args[0] == request_msg @@ -18146,7 +18158,6 @@ async def test_fetch_read_token_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.FetchReadTokenRequest() - assert args[0] == request_msg @@ -18175,7 +18186,6 @@ async def test_fetch_linkable_git_repositories_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.FetchLinkableGitRepositoriesRequest() - assert args[0] == request_msg @@ -18202,7 +18212,6 @@ async def test_fetch_git_hub_installations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.FetchGitHubInstallationsRequest() - assert args[0] == request_msg @@ -18230,7 +18239,6 @@ async def test_fetch_git_refs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.FetchGitRefsRequest() - assert args[0] == request_msg @@ -18260,7 +18268,6 @@ async def test_list_account_connectors_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.ListAccountConnectorsRequest() - assert args[0] == request_msg @@ -18291,7 +18298,6 @@ async def test_get_account_connector_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.GetAccountConnectorRequest() - assert args[0] == request_msg @@ -18318,7 +18324,6 @@ async def test_create_account_connector_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.CreateAccountConnectorRequest() - assert args[0] == request_msg @@ -18345,7 +18350,6 @@ async def test_update_account_connector_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.UpdateAccountConnectorRequest() - assert args[0] == request_msg @@ -18372,7 +18376,6 @@ async def test_delete_account_connector_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.DeleteAccountConnectorRequest() - assert args[0] == request_msg @@ -18402,7 +18405,6 @@ async def test_fetch_access_token_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.FetchAccessTokenRequest() - assert args[0] == request_msg @@ -18430,7 +18432,6 @@ async def test_list_users_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.ListUsersRequest() - assert args[0] == request_msg @@ -18455,7 +18456,6 @@ async def test_delete_user_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.DeleteUserRequest() - assert args[0] == request_msg @@ -18483,7 +18483,6 @@ async def test_fetch_self_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.FetchSelfRequest() - assert args[0] == request_msg @@ -18508,7 +18507,6 @@ async def test_delete_self_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.DeleteSelfRequest() - assert args[0] == request_msg @@ -18540,7 +18538,6 @@ async def test_start_o_auth_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.StartOAuthRequest() - assert args[0] == request_msg @@ -18565,7 +18562,6 @@ async def test_finish_o_auth_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.FinishOAuthRequest() - assert args[0] == request_msg @@ -23078,7 +23074,6 @@ def test_list_connections_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.ListConnectionsRequest() - assert args[0] == request_msg @@ -23098,7 +23093,6 @@ def test_get_connection_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.GetConnectionRequest() - assert args[0] == request_msg @@ -23120,7 +23114,6 @@ def test_create_connection_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.CreateConnectionRequest() - assert args[0] == request_msg @@ -23142,7 +23135,6 @@ def test_update_connection_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.UpdateConnectionRequest() - assert args[0] == request_msg @@ -23164,7 +23156,6 @@ def test_delete_connection_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.DeleteConnectionRequest() - assert args[0] == request_msg @@ -23186,7 +23177,6 @@ def test_create_git_repository_link_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.CreateGitRepositoryLinkRequest() - assert args[0] == request_msg @@ -23208,7 +23198,6 @@ def test_delete_git_repository_link_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.DeleteGitRepositoryLinkRequest() - assert args[0] == request_msg @@ -23230,7 +23219,6 @@ def test_list_git_repository_links_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.ListGitRepositoryLinksRequest() - assert args[0] == request_msg @@ -23252,7 +23240,6 @@ def test_get_git_repository_link_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.GetGitRepositoryLinkRequest() - assert args[0] == request_msg @@ -23274,7 +23261,6 @@ def test_fetch_read_write_token_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.FetchReadWriteTokenRequest() - assert args[0] == request_msg @@ -23294,7 +23280,6 @@ def test_fetch_read_token_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.FetchReadTokenRequest() - assert args[0] == request_msg @@ -23316,7 +23301,6 @@ def test_fetch_linkable_git_repositories_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.FetchLinkableGitRepositoriesRequest() - assert args[0] == request_msg @@ -23338,7 +23322,6 @@ def test_fetch_git_hub_installations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.FetchGitHubInstallationsRequest() - assert args[0] == request_msg @@ -23358,7 +23341,6 @@ def test_fetch_git_refs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.FetchGitRefsRequest() - assert args[0] == request_msg @@ -23380,7 +23362,6 @@ def test_list_account_connectors_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.ListAccountConnectorsRequest() - assert args[0] == request_msg @@ -23402,7 +23383,6 @@ def test_get_account_connector_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.GetAccountConnectorRequest() - assert args[0] == request_msg @@ -23424,7 +23404,6 @@ def test_create_account_connector_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.CreateAccountConnectorRequest() - assert args[0] == request_msg @@ -23446,7 +23425,6 @@ def test_update_account_connector_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.UpdateAccountConnectorRequest() - assert args[0] == request_msg @@ -23468,7 +23446,6 @@ def test_delete_account_connector_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.DeleteAccountConnectorRequest() - assert args[0] == request_msg @@ -23490,7 +23467,6 @@ def test_fetch_access_token_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.FetchAccessTokenRequest() - assert args[0] == request_msg @@ -23510,7 +23486,6 @@ def test_list_users_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.ListUsersRequest() - assert args[0] == request_msg @@ -23530,7 +23505,6 @@ def test_delete_user_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.DeleteUserRequest() - assert args[0] == request_msg @@ -23550,7 +23524,6 @@ def test_fetch_self_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.FetchSelfRequest() - assert args[0] == request_msg @@ -23570,7 +23543,6 @@ def test_delete_self_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.DeleteSelfRequest() - assert args[0] == request_msg @@ -23590,7 +23562,6 @@ def test_start_o_auth_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.StartOAuthRequest() - assert args[0] == request_msg @@ -23610,7 +23581,6 @@ def test_finish_o_auth_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developer_connect.FinishOAuthRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-developerconnect/tests/unit/gapic/developerconnect_v1/test_insights_config_service.py b/packages/google-cloud-developerconnect/tests/unit/gapic/developerconnect_v1/test_insights_config_service.py index a81ceca45605..c267f432833b 100644 --- a/packages/google-cloud-developerconnect/tests/unit/gapic/developerconnect_v1/test_insights_config_service.py +++ b/packages/google-cloud-developerconnect/tests/unit/gapic/developerconnect_v1/test_insights_config_service.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 @@ -120,6 +121,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" @@ -1385,8 +1401,8 @@ def test_insights_config_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - insights_config.ListInsightsConfigsRequest, - dict, + insights_config.ListInsightsConfigsRequest(), + {}, ], ) def test_list_insights_configs(request_type, transport: str = "grpc"): @@ -1397,7 +1413,7 @@ def test_list_insights_configs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1450,12 +1466,13 @@ def test_list_insights_configs_non_empty_request_with_auto_populated_field(): client.list_insights_configs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == insights_config.ListInsightsConfigsRequest( + request_msg = insights_config.ListInsightsConfigsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_insights_configs_use_cached_wrapped_rpc(): @@ -1541,9 +1558,15 @@ async def test_list_insights_configs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + insights_config.ListInsightsConfigsRequest(), + {}, + ], +) async def test_list_insights_configs_async( - transport: str = "grpc_asyncio", - request_type=insights_config.ListInsightsConfigsRequest, + request_type, transport: str = "grpc_asyncio" ): client = InsightsConfigServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1552,7 +1575,7 @@ async def test_list_insights_configs_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( @@ -1579,11 +1602,6 @@ async def test_list_insights_configs_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_insights_configs_async_from_dict(): - await test_list_insights_configs_async(request_type=dict) - - def test_list_insights_configs_field_headers(): client = InsightsConfigServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1936,8 +1954,8 @@ async def test_list_insights_configs_async_pages(): @pytest.mark.parametrize( "request_type", [ - gcd_insights_config.CreateInsightsConfigRequest, - dict, + gcd_insights_config.CreateInsightsConfigRequest(), + {}, ], ) def test_create_insights_config(request_type, transport: str = "grpc"): @@ -1948,7 +1966,7 @@ def test_create_insights_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( @@ -1994,10 +2012,11 @@ def test_create_insights_config_non_empty_request_with_auto_populated_field(): client.create_insights_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_insights_config.CreateInsightsConfigRequest( + request_msg = gcd_insights_config.CreateInsightsConfigRequest( parent="parent_value", insights_config_id="insights_config_id_value", ) + assert args[0] == request_msg def test_create_insights_config_use_cached_wrapped_rpc(): @@ -2093,9 +2112,15 @@ async def test_create_insights_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcd_insights_config.CreateInsightsConfigRequest(), + {}, + ], +) async def test_create_insights_config_async( - transport: str = "grpc_asyncio", - request_type=gcd_insights_config.CreateInsightsConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = InsightsConfigServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2104,7 +2129,7 @@ async def test_create_insights_config_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( @@ -2126,11 +2151,6 @@ async def test_create_insights_config_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_insights_config_async_from_dict(): - await test_create_insights_config_async(request_type=dict) - - def test_create_insights_config_field_headers(): client = InsightsConfigServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2317,8 +2337,8 @@ async def test_create_insights_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - insights_config.GetInsightsConfigRequest, - dict, + insights_config.GetInsightsConfigRequest(), + {}, ], ) def test_get_insights_config(request_type, transport: str = "grpc"): @@ -2329,7 +2349,7 @@ def test_get_insights_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( @@ -2382,9 +2402,10 @@ def test_get_insights_config_non_empty_request_with_auto_populated_field(): client.get_insights_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == insights_config.GetInsightsConfigRequest( + request_msg = insights_config.GetInsightsConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_insights_config_use_cached_wrapped_rpc(): @@ -2469,10 +2490,14 @@ async def test_get_insights_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_insights_config_async( - transport: str = "grpc_asyncio", - request_type=insights_config.GetInsightsConfigRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + insights_config.GetInsightsConfigRequest(), + {}, + ], +) +async def test_get_insights_config_async(request_type, transport: str = "grpc_asyncio"): client = InsightsConfigServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2480,7 +2505,7 @@ async def test_get_insights_config_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( @@ -2509,11 +2534,6 @@ async def test_get_insights_config_async( assert response.reconciling is True -@pytest.mark.asyncio -async def test_get_insights_config_async_from_dict(): - await test_get_insights_config_async(request_type=dict) - - def test_get_insights_config_field_headers(): client = InsightsConfigServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2668,8 +2688,8 @@ async def test_get_insights_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - insights_config.UpdateInsightsConfigRequest, - dict, + insights_config.UpdateInsightsConfigRequest(), + {}, ], ) def test_update_insights_config(request_type, transport: str = "grpc"): @@ -2680,7 +2700,7 @@ def test_update_insights_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( @@ -2723,7 +2743,8 @@ def test_update_insights_config_non_empty_request_with_auto_populated_field(): client.update_insights_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == insights_config.UpdateInsightsConfigRequest() + request_msg = insights_config.UpdateInsightsConfigRequest() + assert args[0] == request_msg def test_update_insights_config_use_cached_wrapped_rpc(): @@ -2819,9 +2840,15 @@ async def test_update_insights_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + insights_config.UpdateInsightsConfigRequest(), + {}, + ], +) async def test_update_insights_config_async( - transport: str = "grpc_asyncio", - request_type=insights_config.UpdateInsightsConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = InsightsConfigServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2830,7 +2857,7 @@ async def test_update_insights_config_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( @@ -2852,11 +2879,6 @@ async def test_update_insights_config_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_insights_config_async_from_dict(): - await test_update_insights_config_async(request_type=dict) - - def test_update_insights_config_field_headers(): client = InsightsConfigServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2925,8 +2947,8 @@ async def test_update_insights_config_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - insights_config.DeleteInsightsConfigRequest, - dict, + insights_config.DeleteInsightsConfigRequest(), + {}, ], ) def test_delete_insights_config(request_type, transport: str = "grpc"): @@ -2937,7 +2959,7 @@ def test_delete_insights_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( @@ -2983,10 +3005,11 @@ def test_delete_insights_config_non_empty_request_with_auto_populated_field(): client.delete_insights_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == insights_config.DeleteInsightsConfigRequest( + request_msg = insights_config.DeleteInsightsConfigRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_insights_config_use_cached_wrapped_rpc(): @@ -3082,9 +3105,15 @@ async def test_delete_insights_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + insights_config.DeleteInsightsConfigRequest(), + {}, + ], +) async def test_delete_insights_config_async( - transport: str = "grpc_asyncio", - request_type=insights_config.DeleteInsightsConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = InsightsConfigServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3093,7 +3122,7 @@ async def test_delete_insights_config_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( @@ -3115,11 +3144,6 @@ async def test_delete_insights_config_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_insights_config_async_from_dict(): - await test_delete_insights_config_async(request_type=dict) - - def test_delete_insights_config_field_headers(): client = InsightsConfigServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3274,8 +3298,8 @@ async def test_delete_insights_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - insights_config.GetDeploymentEventRequest, - dict, + insights_config.GetDeploymentEventRequest(), + {}, ], ) def test_get_deployment_event(request_type, transport: str = "grpc"): @@ -3286,7 +3310,7 @@ def test_get_deployment_event(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3338,9 +3362,10 @@ def test_get_deployment_event_non_empty_request_with_auto_populated_field(): client.get_deployment_event(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == insights_config.GetDeploymentEventRequest( + request_msg = insights_config.GetDeploymentEventRequest( name="name_value", ) + assert args[0] == request_msg def test_get_deployment_event_use_cached_wrapped_rpc(): @@ -3425,9 +3450,15 @@ async def test_get_deployment_event_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + insights_config.GetDeploymentEventRequest(), + {}, + ], +) async def test_get_deployment_event_async( - transport: str = "grpc_asyncio", - request_type=insights_config.GetDeploymentEventRequest, + request_type, transport: str = "grpc_asyncio" ): client = InsightsConfigServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3436,7 +3467,7 @@ async def test_get_deployment_event_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( @@ -3465,11 +3496,6 @@ async def test_get_deployment_event_async( assert response.state == insights_config.DeploymentEvent.State.STATE_ACTIVE -@pytest.mark.asyncio -async def test_get_deployment_event_async_from_dict(): - await test_get_deployment_event_async(request_type=dict) - - def test_get_deployment_event_field_headers(): client = InsightsConfigServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3624,8 +3650,8 @@ async def test_get_deployment_event_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - insights_config.ListDeploymentEventsRequest, - dict, + insights_config.ListDeploymentEventsRequest(), + {}, ], ) def test_list_deployment_events(request_type, transport: str = "grpc"): @@ -3636,7 +3662,7 @@ def test_list_deployment_events(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3686,11 +3712,12 @@ def test_list_deployment_events_non_empty_request_with_auto_populated_field(): client.list_deployment_events(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == insights_config.ListDeploymentEventsRequest( + request_msg = insights_config.ListDeploymentEventsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_deployment_events_use_cached_wrapped_rpc(): @@ -3776,9 +3803,15 @@ async def test_list_deployment_events_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + insights_config.ListDeploymentEventsRequest(), + {}, + ], +) async def test_list_deployment_events_async( - transport: str = "grpc_asyncio", - request_type=insights_config.ListDeploymentEventsRequest, + request_type, transport: str = "grpc_asyncio" ): client = InsightsConfigServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3787,7 +3820,7 @@ async def test_list_deployment_events_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( @@ -3812,11 +3845,6 @@ async def test_list_deployment_events_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_deployment_events_async_from_dict(): - await test_list_deployment_events_async(request_type=dict) - - def test_list_deployment_events_field_headers(): client = InsightsConfigServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5756,7 +5784,6 @@ def test_list_insights_configs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = insights_config.ListInsightsConfigsRequest() - assert args[0] == request_msg @@ -5779,7 +5806,6 @@ def test_create_insights_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_insights_config.CreateInsightsConfigRequest() - assert args[0] == request_msg @@ -5802,7 +5828,6 @@ def test_get_insights_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = insights_config.GetInsightsConfigRequest() - assert args[0] == request_msg @@ -5825,7 +5850,6 @@ def test_update_insights_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = insights_config.UpdateInsightsConfigRequest() - assert args[0] == request_msg @@ -5848,7 +5872,6 @@ def test_delete_insights_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = insights_config.DeleteInsightsConfigRequest() - assert args[0] == request_msg @@ -5871,7 +5894,6 @@ def test_get_deployment_event_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = insights_config.GetDeploymentEventRequest() - assert args[0] == request_msg @@ -5894,7 +5916,6 @@ def test_list_deployment_events_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = insights_config.ListDeploymentEventsRequest() - assert args[0] == request_msg @@ -5938,7 +5959,6 @@ async def test_list_insights_configs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = insights_config.ListInsightsConfigsRequest() - assert args[0] == request_msg @@ -5965,7 +5985,6 @@ async def test_create_insights_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_insights_config.CreateInsightsConfigRequest() - assert args[0] == request_msg @@ -5996,7 +6015,6 @@ async def test_get_insights_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = insights_config.GetInsightsConfigRequest() - assert args[0] == request_msg @@ -6023,7 +6041,6 @@ async def test_update_insights_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = insights_config.UpdateInsightsConfigRequest() - assert args[0] == request_msg @@ -6050,7 +6067,6 @@ async def test_delete_insights_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = insights_config.DeleteInsightsConfigRequest() - assert args[0] == request_msg @@ -6081,7 +6097,6 @@ async def test_get_deployment_event_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = insights_config.GetDeploymentEventRequest() - assert args[0] == request_msg @@ -6110,7 +6125,6 @@ async def test_list_deployment_events_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = insights_config.ListDeploymentEventsRequest() - assert args[0] == request_msg @@ -7726,7 +7740,6 @@ def test_list_insights_configs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = insights_config.ListInsightsConfigsRequest() - assert args[0] == request_msg @@ -7748,7 +7761,6 @@ def test_create_insights_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_insights_config.CreateInsightsConfigRequest() - assert args[0] == request_msg @@ -7770,7 +7782,6 @@ def test_get_insights_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = insights_config.GetInsightsConfigRequest() - assert args[0] == request_msg @@ -7792,7 +7803,6 @@ def test_update_insights_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = insights_config.UpdateInsightsConfigRequest() - assert args[0] == request_msg @@ -7814,7 +7824,6 @@ def test_delete_insights_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = insights_config.DeleteInsightsConfigRequest() - assert args[0] == request_msg @@ -7836,7 +7845,6 @@ def test_get_deployment_event_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = insights_config.GetDeploymentEventRequest() - assert args[0] == request_msg @@ -7858,7 +7866,6 @@ def test_list_deployment_events_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = insights_config.ListDeploymentEventsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-devicestreaming/noxfile.py b/packages/google-cloud-devicestreaming/noxfile.py index 34c7e98e21ec..35e6971161be 100644 --- a/packages/google-cloud-devicestreaming/noxfile.py +++ b/packages/google-cloud-devicestreaming/noxfile.py @@ -47,7 +47,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-devicestreaming" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-devicestreaming/setup.py b/packages/google-cloud-devicestreaming/setup.py index 4b9f76ecb608..ab00aacd2212 100644 --- a/packages/google-cloud-devicestreaming/setup.py +++ b/packages/google-cloud-devicestreaming/setup.py @@ -45,7 +45,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/google-cloud-devicestreaming/testing/constraints-3.10.txt b/packages/google-cloud-devicestreaming/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-devicestreaming/testing/constraints-3.10.txt +++ b/packages/google-cloud-devicestreaming/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-devicestreaming/tests/unit/gapic/devicestreaming_v1/test_direct_access_service.py b/packages/google-cloud-devicestreaming/tests/unit/gapic/devicestreaming_v1/test_direct_access_service.py index 51ec76b27a63..c043c7186e0d 100644 --- a/packages/google-cloud-devicestreaming/tests/unit/gapic/devicestreaming_v1/test_direct_access_service.py +++ b/packages/google-cloud-devicestreaming/tests/unit/gapic/devicestreaming_v1/test_direct_access_service.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 @@ -110,6 +111,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" @@ -1373,8 +1389,8 @@ def test_direct_access_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - service.CreateDeviceSessionRequest, - dict, + service.CreateDeviceSessionRequest(), + {}, ], ) def test_create_device_session(request_type, transport: str = "grpc"): @@ -1385,7 +1401,7 @@ def test_create_device_session(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1438,10 +1454,11 @@ def test_create_device_session_non_empty_request_with_auto_populated_field(): client.create_device_session(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateDeviceSessionRequest( + request_msg = service.CreateDeviceSessionRequest( parent="parent_value", device_session_id="device_session_id_value", ) + assert args[0] == request_msg def test_create_device_session_use_cached_wrapped_rpc(): @@ -1527,8 +1544,15 @@ async def test_create_device_session_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.CreateDeviceSessionRequest(), + {}, + ], +) async def test_create_device_session_async( - transport: str = "grpc_asyncio", request_type=service.CreateDeviceSessionRequest + request_type, transport: str = "grpc_asyncio" ): client = DirectAccessServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1537,7 +1561,7 @@ async def test_create_device_session_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( @@ -1566,11 +1590,6 @@ async def test_create_device_session_async( assert response.state == service.DeviceSession.SessionState.REQUESTED -@pytest.mark.asyncio -async def test_create_device_session_async_from_dict(): - await test_create_device_session_async(request_type=dict) - - def test_create_device_session_field_headers(): client = DirectAccessServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1745,8 +1764,8 @@ async def test_create_device_session_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListDeviceSessionsRequest, - dict, + service.ListDeviceSessionsRequest(), + {}, ], ) def test_list_device_sessions(request_type, transport: str = "grpc"): @@ -1757,7 +1776,7 @@ def test_list_device_sessions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1807,11 +1826,12 @@ def test_list_device_sessions_non_empty_request_with_auto_populated_field(): client.list_device_sessions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListDeviceSessionsRequest( + request_msg = service.ListDeviceSessionsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_device_sessions_use_cached_wrapped_rpc(): @@ -1896,8 +1916,15 @@ async def test_list_device_sessions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.ListDeviceSessionsRequest(), + {}, + ], +) async def test_list_device_sessions_async( - transport: str = "grpc_asyncio", request_type=service.ListDeviceSessionsRequest + request_type, transport: str = "grpc_asyncio" ): client = DirectAccessServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1906,7 +1933,7 @@ async def test_list_device_sessions_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( @@ -1931,11 +1958,6 @@ async def test_list_device_sessions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_device_sessions_async_from_dict(): - await test_list_device_sessions_async(request_type=dict) - - def test_list_device_sessions_field_headers(): client = DirectAccessServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2288,8 +2310,8 @@ async def test_list_device_sessions_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetDeviceSessionRequest, - dict, + service.GetDeviceSessionRequest(), + {}, ], ) def test_get_device_session(request_type, transport: str = "grpc"): @@ -2300,7 +2322,7 @@ def test_get_device_session(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2352,9 +2374,10 @@ def test_get_device_session_non_empty_request_with_auto_populated_field(): client.get_device_session(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetDeviceSessionRequest( + request_msg = service.GetDeviceSessionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_device_session_use_cached_wrapped_rpc(): @@ -2439,9 +2462,14 @@ async def test_get_device_session_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_device_session_async( - transport: str = "grpc_asyncio", request_type=service.GetDeviceSessionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetDeviceSessionRequest(), + {}, + ], +) +async def test_get_device_session_async(request_type, transport: str = "grpc_asyncio"): client = DirectAccessServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2449,7 +2477,7 @@ async def test_get_device_session_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( @@ -2478,11 +2506,6 @@ async def test_get_device_session_async( assert response.state == service.DeviceSession.SessionState.REQUESTED -@pytest.mark.asyncio -async def test_get_device_session_async_from_dict(): - await test_get_device_session_async(request_type=dict) - - def test_get_device_session_field_headers(): client = DirectAccessServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2637,8 +2660,8 @@ async def test_get_device_session_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.CancelDeviceSessionRequest, - dict, + service.CancelDeviceSessionRequest(), + {}, ], ) def test_cancel_device_session(request_type, transport: str = "grpc"): @@ -2649,7 +2672,7 @@ def test_cancel_device_session(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2694,9 +2717,10 @@ def test_cancel_device_session_non_empty_request_with_auto_populated_field(): client.cancel_device_session(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CancelDeviceSessionRequest( + request_msg = service.CancelDeviceSessionRequest( name="name_value", ) + assert args[0] == request_msg def test_cancel_device_session_use_cached_wrapped_rpc(): @@ -2782,8 +2806,15 @@ async def test_cancel_device_session_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.CancelDeviceSessionRequest(), + {}, + ], +) async def test_cancel_device_session_async( - transport: str = "grpc_asyncio", request_type=service.CancelDeviceSessionRequest + request_type, transport: str = "grpc_asyncio" ): client = DirectAccessServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2792,7 +2823,7 @@ async def test_cancel_device_session_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( @@ -2812,11 +2843,6 @@ async def test_cancel_device_session_async( assert response is None -@pytest.mark.asyncio -async def test_cancel_device_session_async_from_dict(): - await test_cancel_device_session_async(request_type=dict) - - def test_cancel_device_session_field_headers(): client = DirectAccessServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2883,8 +2909,8 @@ async def test_cancel_device_session_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdateDeviceSessionRequest, - dict, + service.UpdateDeviceSessionRequest(), + {}, ], ) def test_update_device_session(request_type, transport: str = "grpc"): @@ -2895,7 +2921,7 @@ def test_update_device_session(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2945,7 +2971,8 @@ def test_update_device_session_non_empty_request_with_auto_populated_field(): client.update_device_session(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateDeviceSessionRequest() + request_msg = service.UpdateDeviceSessionRequest() + assert args[0] == request_msg def test_update_device_session_use_cached_wrapped_rpc(): @@ -3031,8 +3058,15 @@ async def test_update_device_session_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateDeviceSessionRequest(), + {}, + ], +) async def test_update_device_session_async( - transport: str = "grpc_asyncio", request_type=service.UpdateDeviceSessionRequest + request_type, transport: str = "grpc_asyncio" ): client = DirectAccessServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3041,7 +3075,7 @@ async def test_update_device_session_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( @@ -3070,11 +3104,6 @@ async def test_update_device_session_async( assert response.state == service.DeviceSession.SessionState.REQUESTED -@pytest.mark.asyncio -async def test_update_device_session_async_from_dict(): - await test_update_device_session_async(request_type=dict) - - def test_update_device_session_field_headers(): client = DirectAccessServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3239,8 +3268,8 @@ async def test_update_device_session_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - adb_service.AdbMessage, - dict, + adb_service.AdbMessage(), + {}, ], ) def test_adb_connect(request_type, transport: str = "grpc"): @@ -3251,7 +3280,7 @@ def test_adb_connect(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as 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. @@ -3348,9 +3377,14 @@ async def test_adb_connect_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_adb_connect_async( - transport: str = "grpc_asyncio", request_type=adb_service.AdbMessage -): +@pytest.mark.parametrize( + "request_type", + [ + adb_service.AdbMessage(), + {}, + ], +) +async def test_adb_connect_async(request_type, transport: str = "grpc_asyncio"): client = DirectAccessServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3358,7 +3392,7 @@ async def test_adb_connect_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. @@ -3380,11 +3414,6 @@ async def test_adb_connect_async( assert isinstance(message, adb_service.DeviceMessage) -@pytest.mark.asyncio -async def test_adb_connect_async_from_dict(): - await test_adb_connect_async(request_type=dict) - - def test_create_device_session_rest_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, # instead of constructing them on each call @@ -4478,7 +4507,6 @@ def test_create_device_session_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateDeviceSessionRequest() - assert args[0] == request_msg @@ -4501,7 +4529,6 @@ def test_list_device_sessions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListDeviceSessionsRequest() - assert args[0] == request_msg @@ -4524,7 +4551,6 @@ def test_get_device_session_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetDeviceSessionRequest() - assert args[0] == request_msg @@ -4547,7 +4573,6 @@ def test_cancel_device_session_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CancelDeviceSessionRequest() - assert args[0] == request_msg @@ -4570,7 +4595,6 @@ def test_update_device_session_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateDeviceSessionRequest() - assert args[0] == request_msg @@ -4615,7 +4639,6 @@ async def test_create_device_session_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateDeviceSessionRequest() - assert args[0] == request_msg @@ -4644,7 +4667,6 @@ async def test_list_device_sessions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListDeviceSessionsRequest() - assert args[0] == request_msg @@ -4675,7 +4697,6 @@ async def test_get_device_session_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetDeviceSessionRequest() - assert args[0] == request_msg @@ -4700,7 +4721,6 @@ async def test_cancel_device_session_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CancelDeviceSessionRequest() - assert args[0] == request_msg @@ -4731,7 +4751,6 @@ async def test_update_device_session_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateDeviceSessionRequest() - assert args[0] == request_msg @@ -5611,7 +5630,6 @@ def test_create_device_session_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateDeviceSessionRequest() - assert args[0] == request_msg @@ -5633,7 +5651,6 @@ def test_list_device_sessions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListDeviceSessionsRequest() - assert args[0] == request_msg @@ -5655,7 +5672,6 @@ def test_get_device_session_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetDeviceSessionRequest() - assert args[0] == request_msg @@ -5677,7 +5693,6 @@ def test_cancel_device_session_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CancelDeviceSessionRequest() - assert args[0] == request_msg @@ -5699,7 +5714,6 @@ def test_update_device_session_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateDeviceSessionRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow-cx/noxfile.py b/packages/google-cloud-dialogflow-cx/noxfile.py index d5b3361eaf2b..805659bdd66f 100644 --- a/packages/google-cloud-dialogflow-cx/noxfile.py +++ b/packages/google-cloud-dialogflow-cx/noxfile.py @@ -47,7 +47,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-dialogflow-cx" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-dialogflow-cx/setup.py b/packages/google-cloud-dialogflow-cx/setup.py index 4cead842cbf0..5e7bec4a5b56 100644 --- a/packages/google-cloud-dialogflow-cx/setup.py +++ b/packages/google-cloud-dialogflow-cx/setup.py @@ -45,7 +45,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/google-cloud-dialogflow-cx/testing/constraints-3.10.txt b/packages/google-cloud-dialogflow-cx/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-dialogflow-cx/testing/constraints-3.10.txt +++ b/packages/google-cloud-dialogflow-cx/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-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_agents.py b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_agents.py index 9ed3e1a6de15..59189c1538a1 100644 --- a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_agents.py +++ b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_agents.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 @@ -129,6 +130,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" @@ -1264,8 +1280,8 @@ def test_agents_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - agent.ListAgentsRequest, - dict, + agent.ListAgentsRequest(), + {}, ], ) def test_list_agents(request_type, transport: str = "grpc"): @@ -1276,7 +1292,7 @@ def test_list_agents(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_agents), "__call__") as call: @@ -1321,10 +1337,11 @@ def test_list_agents_non_empty_request_with_auto_populated_field(): client.list_agents(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent.ListAgentsRequest( + request_msg = agent.ListAgentsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_agents_use_cached_wrapped_rpc(): @@ -1405,9 +1422,14 @@ async def test_list_agents_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_agents_async( - transport: str = "grpc_asyncio", request_type=agent.ListAgentsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent.ListAgentsRequest(), + {}, + ], +) +async def test_list_agents_async(request_type, transport: str = "grpc_asyncio"): client = AgentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1415,7 +1437,7 @@ async def test_list_agents_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_agents), "__call__") as call: @@ -1438,11 +1460,6 @@ async def test_list_agents_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_agents_async_from_dict(): - await test_list_agents_async(request_type=dict) - - def test_list_agents_field_headers(): client = AgentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1779,8 +1796,8 @@ async def test_list_agents_async_pages(): @pytest.mark.parametrize( "request_type", [ - agent.GetAgentRequest, - dict, + agent.GetAgentRequest(), + {}, ], ) def test_get_agent(request_type, transport: str = "grpc"): @@ -1791,7 +1808,7 @@ def test_get_agent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_agent), "__call__") as call: @@ -1862,9 +1879,10 @@ def test_get_agent_non_empty_request_with_auto_populated_field(): client.get_agent(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent.GetAgentRequest( + request_msg = agent.GetAgentRequest( name="name_value", ) + assert args[0] == request_msg def test_get_agent_use_cached_wrapped_rpc(): @@ -1943,9 +1961,14 @@ async def test_get_agent_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_agent_async( - transport: str = "grpc_asyncio", request_type=agent.GetAgentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent.GetAgentRequest(), + {}, + ], +) +async def test_get_agent_async(request_type, transport: str = "grpc_asyncio"): client = AgentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1953,7 +1976,7 @@ async def test_get_agent_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_agent), "__call__") as call: @@ -2002,11 +2025,6 @@ async def test_get_agent_async( assert response.satisfies_pzi is True -@pytest.mark.asyncio -async def test_get_agent_async_from_dict(): - await test_get_agent_async(request_type=dict) - - def test_get_agent_field_headers(): client = AgentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2149,8 +2167,8 @@ async def test_get_agent_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcdc_agent.CreateAgentRequest, - dict, + gcdc_agent.CreateAgentRequest(), + {}, ], ) def test_create_agent(request_type, transport: str = "grpc"): @@ -2161,7 +2179,7 @@ def test_create_agent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_agent), "__call__") as call: @@ -2232,9 +2250,10 @@ def test_create_agent_non_empty_request_with_auto_populated_field(): client.create_agent(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcdc_agent.CreateAgentRequest( + request_msg = gcdc_agent.CreateAgentRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_agent_use_cached_wrapped_rpc(): @@ -2315,9 +2334,14 @@ async def test_create_agent_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_agent_async( - transport: str = "grpc_asyncio", request_type=gcdc_agent.CreateAgentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcdc_agent.CreateAgentRequest(), + {}, + ], +) +async def test_create_agent_async(request_type, transport: str = "grpc_asyncio"): client = AgentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2325,7 +2349,7 @@ async def test_create_agent_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_agent), "__call__") as call: @@ -2374,11 +2398,6 @@ async def test_create_agent_async( assert response.satisfies_pzi is True -@pytest.mark.asyncio -async def test_create_agent_async_from_dict(): - await test_create_agent_async(request_type=dict) - - def test_create_agent_field_headers(): client = AgentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2531,8 +2550,8 @@ async def test_create_agent_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcdc_agent.UpdateAgentRequest, - dict, + gcdc_agent.UpdateAgentRequest(), + {}, ], ) def test_update_agent(request_type, transport: str = "grpc"): @@ -2543,7 +2562,7 @@ def test_update_agent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_agent), "__call__") as call: @@ -2612,7 +2631,8 @@ def test_update_agent_non_empty_request_with_auto_populated_field(): client.update_agent(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcdc_agent.UpdateAgentRequest() + request_msg = gcdc_agent.UpdateAgentRequest() + assert args[0] == request_msg def test_update_agent_use_cached_wrapped_rpc(): @@ -2693,9 +2713,14 @@ async def test_update_agent_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_agent_async( - transport: str = "grpc_asyncio", request_type=gcdc_agent.UpdateAgentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcdc_agent.UpdateAgentRequest(), + {}, + ], +) +async def test_update_agent_async(request_type, transport: str = "grpc_asyncio"): client = AgentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2703,7 +2728,7 @@ async def test_update_agent_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_agent), "__call__") as call: @@ -2752,11 +2777,6 @@ async def test_update_agent_async( assert response.satisfies_pzi is True -@pytest.mark.asyncio -async def test_update_agent_async_from_dict(): - await test_update_agent_async(request_type=dict) - - def test_update_agent_field_headers(): client = AgentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2909,8 +2929,8 @@ async def test_update_agent_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent.DeleteAgentRequest, - dict, + agent.DeleteAgentRequest(), + {}, ], ) def test_delete_agent(request_type, transport: str = "grpc"): @@ -2921,7 +2941,7 @@ def test_delete_agent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_agent), "__call__") as call: @@ -2962,9 +2982,10 @@ def test_delete_agent_non_empty_request_with_auto_populated_field(): client.delete_agent(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent.DeleteAgentRequest( + request_msg = agent.DeleteAgentRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_agent_use_cached_wrapped_rpc(): @@ -3045,9 +3066,14 @@ async def test_delete_agent_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_agent_async( - transport: str = "grpc_asyncio", request_type=agent.DeleteAgentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent.DeleteAgentRequest(), + {}, + ], +) +async def test_delete_agent_async(request_type, transport: str = "grpc_asyncio"): client = AgentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3055,7 +3081,7 @@ async def test_delete_agent_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_agent), "__call__") as call: @@ -3073,11 +3099,6 @@ async def test_delete_agent_async( assert response is None -@pytest.mark.asyncio -async def test_delete_agent_async_from_dict(): - await test_delete_agent_async(request_type=dict) - - def test_delete_agent_field_headers(): client = AgentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3220,8 +3241,8 @@ async def test_delete_agent_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent.ExportAgentRequest, - dict, + agent.ExportAgentRequest(), + {}, ], ) def test_export_agent(request_type, transport: str = "grpc"): @@ -3232,7 +3253,7 @@ def test_export_agent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.export_agent), "__call__") as call: @@ -3275,11 +3296,12 @@ def test_export_agent_non_empty_request_with_auto_populated_field(): client.export_agent(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent.ExportAgentRequest( + request_msg = agent.ExportAgentRequest( name="name_value", agent_uri="agent_uri_value", environment="environment_value", ) + assert args[0] == request_msg def test_export_agent_use_cached_wrapped_rpc(): @@ -3370,9 +3392,14 @@ async def test_export_agent_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_export_agent_async( - transport: str = "grpc_asyncio", request_type=agent.ExportAgentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent.ExportAgentRequest(), + {}, + ], +) +async def test_export_agent_async(request_type, transport: str = "grpc_asyncio"): client = AgentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3380,7 +3407,7 @@ async def test_export_agent_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.export_agent), "__call__") as call: @@ -3400,11 +3427,6 @@ async def test_export_agent_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_export_agent_async_from_dict(): - await test_export_agent_async(request_type=dict) - - def test_export_agent_field_headers(): client = AgentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3469,8 +3491,8 @@ async def test_export_agent_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - agent.RestoreAgentRequest, - dict, + agent.RestoreAgentRequest(), + {}, ], ) def test_restore_agent(request_type, transport: str = "grpc"): @@ -3481,7 +3503,7 @@ def test_restore_agent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.restore_agent), "__call__") as call: @@ -3523,10 +3545,11 @@ def test_restore_agent_non_empty_request_with_auto_populated_field(): client.restore_agent(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent.RestoreAgentRequest( + request_msg = agent.RestoreAgentRequest( name="name_value", agent_uri="agent_uri_value", ) + assert args[0] == request_msg def test_restore_agent_use_cached_wrapped_rpc(): @@ -3617,9 +3640,14 @@ async def test_restore_agent_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_restore_agent_async( - transport: str = "grpc_asyncio", request_type=agent.RestoreAgentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent.RestoreAgentRequest(), + {}, + ], +) +async def test_restore_agent_async(request_type, transport: str = "grpc_asyncio"): client = AgentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3627,7 +3655,7 @@ async def test_restore_agent_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.restore_agent), "__call__") as call: @@ -3647,11 +3675,6 @@ async def test_restore_agent_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_restore_agent_async_from_dict(): - await test_restore_agent_async(request_type=dict) - - def test_restore_agent_field_headers(): client = AgentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3716,8 +3739,8 @@ async def test_restore_agent_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - agent.ValidateAgentRequest, - dict, + agent.ValidateAgentRequest(), + {}, ], ) def test_validate_agent(request_type, transport: str = "grpc"): @@ -3728,7 +3751,7 @@ def test_validate_agent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.validate_agent), "__call__") as call: @@ -3773,10 +3796,11 @@ def test_validate_agent_non_empty_request_with_auto_populated_field(): client.validate_agent(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent.ValidateAgentRequest( + request_msg = agent.ValidateAgentRequest( name="name_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_validate_agent_use_cached_wrapped_rpc(): @@ -3857,9 +3881,14 @@ async def test_validate_agent_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_validate_agent_async( - transport: str = "grpc_asyncio", request_type=agent.ValidateAgentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent.ValidateAgentRequest(), + {}, + ], +) +async def test_validate_agent_async(request_type, transport: str = "grpc_asyncio"): client = AgentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3867,7 +3896,7 @@ async def test_validate_agent_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.validate_agent), "__call__") as call: @@ -3890,11 +3919,6 @@ async def test_validate_agent_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_validate_agent_async_from_dict(): - await test_validate_agent_async(request_type=dict) - - def test_validate_agent_field_headers(): client = AgentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3959,8 +3983,8 @@ async def test_validate_agent_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - agent.GetAgentValidationResultRequest, - dict, + agent.GetAgentValidationResultRequest(), + {}, ], ) def test_get_agent_validation_result(request_type, transport: str = "grpc"): @@ -3971,7 +3995,7 @@ def test_get_agent_validation_result(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4020,10 +4044,11 @@ def test_get_agent_validation_result_non_empty_request_with_auto_populated_field client.get_agent_validation_result(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent.GetAgentValidationResultRequest( + request_msg = agent.GetAgentValidationResultRequest( name="name_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_get_agent_validation_result_use_cached_wrapped_rpc(): @@ -4109,8 +4134,15 @@ async def test_get_agent_validation_result_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + agent.GetAgentValidationResultRequest(), + {}, + ], +) async def test_get_agent_validation_result_async( - transport: str = "grpc_asyncio", request_type=agent.GetAgentValidationResultRequest + request_type, transport: str = "grpc_asyncio" ): client = AgentsAsyncClient( credentials=async_anonymous_credentials(), @@ -4119,7 +4151,7 @@ async def test_get_agent_validation_result_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( @@ -4144,11 +4176,6 @@ async def test_get_agent_validation_result_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_agent_validation_result_async_from_dict(): - await test_get_agent_validation_result_async(request_type=dict) - - def test_get_agent_validation_result_field_headers(): client = AgentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4303,8 +4330,8 @@ async def test_get_agent_validation_result_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent.GetGenerativeSettingsRequest, - dict, + agent.GetGenerativeSettingsRequest(), + {}, ], ) def test_get_generative_settings(request_type, transport: str = "grpc"): @@ -4315,7 +4342,7 @@ def test_get_generative_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( @@ -4366,10 +4393,11 @@ def test_get_generative_settings_non_empty_request_with_auto_populated_field(): client.get_generative_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent.GetGenerativeSettingsRequest( + request_msg = agent.GetGenerativeSettingsRequest( name="name_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_get_generative_settings_use_cached_wrapped_rpc(): @@ -4455,8 +4483,15 @@ async def test_get_generative_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + agent.GetGenerativeSettingsRequest(), + {}, + ], +) async def test_get_generative_settings_async( - transport: str = "grpc_asyncio", request_type=agent.GetGenerativeSettingsRequest + request_type, transport: str = "grpc_asyncio" ): client = AgentsAsyncClient( credentials=async_anonymous_credentials(), @@ -4465,7 +4500,7 @@ async def test_get_generative_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( @@ -4492,11 +4527,6 @@ async def test_get_generative_settings_async( assert response.language_code == "language_code_value" -@pytest.mark.asyncio -async def test_get_generative_settings_async_from_dict(): - await test_get_generative_settings_async(request_type=dict) - - def test_get_generative_settings_field_headers(): client = AgentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4661,8 +4691,8 @@ async def test_get_generative_settings_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent.UpdateGenerativeSettingsRequest, - dict, + agent.UpdateGenerativeSettingsRequest(), + {}, ], ) def test_update_generative_settings(request_type, transport: str = "grpc"): @@ -4673,7 +4703,7 @@ def test_update_generative_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( @@ -4721,7 +4751,8 @@ def test_update_generative_settings_non_empty_request_with_auto_populated_field( client.update_generative_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent.UpdateGenerativeSettingsRequest() + request_msg = agent.UpdateGenerativeSettingsRequest() + assert args[0] == request_msg def test_update_generative_settings_use_cached_wrapped_rpc(): @@ -4807,8 +4838,15 @@ async def test_update_generative_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + agent.UpdateGenerativeSettingsRequest(), + {}, + ], +) async def test_update_generative_settings_async( - transport: str = "grpc_asyncio", request_type=agent.UpdateGenerativeSettingsRequest + request_type, transport: str = "grpc_asyncio" ): client = AgentsAsyncClient( credentials=async_anonymous_credentials(), @@ -4817,7 +4855,7 @@ async def test_update_generative_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( @@ -4844,11 +4882,6 @@ async def test_update_generative_settings_async( assert response.language_code == "language_code_value" -@pytest.mark.asyncio -async def test_update_generative_settings_async_from_dict(): - await test_update_generative_settings_async(request_type=dict) - - def test_update_generative_settings_field_headers(): client = AgentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7048,7 +7081,6 @@ def test_list_agents_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.ListAgentsRequest() - assert args[0] == request_msg @@ -7069,7 +7101,6 @@ def test_get_agent_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.GetAgentRequest() - assert args[0] == request_msg @@ -7090,7 +7121,6 @@ def test_create_agent_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_agent.CreateAgentRequest() - assert args[0] == request_msg @@ -7111,7 +7141,6 @@ def test_update_agent_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_agent.UpdateAgentRequest() - assert args[0] == request_msg @@ -7132,7 +7161,6 @@ def test_delete_agent_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.DeleteAgentRequest() - assert args[0] == request_msg @@ -7153,7 +7181,6 @@ def test_export_agent_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.ExportAgentRequest() - assert args[0] == request_msg @@ -7174,7 +7201,6 @@ def test_restore_agent_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.RestoreAgentRequest() - assert args[0] == request_msg @@ -7195,7 +7221,6 @@ def test_validate_agent_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.ValidateAgentRequest() - assert args[0] == request_msg @@ -7218,7 +7243,6 @@ def test_get_agent_validation_result_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.GetAgentValidationResultRequest() - assert args[0] == request_msg @@ -7241,7 +7265,6 @@ def test_get_generative_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.GetGenerativeSettingsRequest() - assert args[0] == request_msg @@ -7264,7 +7287,6 @@ def test_update_generative_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.UpdateGenerativeSettingsRequest() - assert args[0] == request_msg @@ -7305,7 +7327,6 @@ async def test_list_agents_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.ListAgentsRequest() - assert args[0] == request_msg @@ -7345,7 +7366,6 @@ async def test_get_agent_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.GetAgentRequest() - assert args[0] == request_msg @@ -7385,7 +7405,6 @@ async def test_create_agent_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_agent.CreateAgentRequest() - assert args[0] == request_msg @@ -7425,7 +7444,6 @@ async def test_update_agent_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_agent.UpdateAgentRequest() - assert args[0] == request_msg @@ -7448,7 +7466,6 @@ async def test_delete_agent_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.DeleteAgentRequest() - assert args[0] == request_msg @@ -7473,7 +7490,6 @@ async def test_export_agent_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.ExportAgentRequest() - assert args[0] == request_msg @@ -7498,7 +7514,6 @@ async def test_restore_agent_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.RestoreAgentRequest() - assert args[0] == request_msg @@ -7525,7 +7540,6 @@ async def test_validate_agent_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.ValidateAgentRequest() - assert args[0] == request_msg @@ -7554,7 +7568,6 @@ async def test_get_agent_validation_result_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.GetAgentValidationResultRequest() - assert args[0] == request_msg @@ -7584,7 +7597,6 @@ async def test_get_generative_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.GetGenerativeSettingsRequest() - assert args[0] == request_msg @@ -7614,7 +7626,6 @@ async def test_update_generative_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.UpdateGenerativeSettingsRequest() - assert args[0] == request_msg @@ -9767,7 +9778,6 @@ def test_list_agents_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.ListAgentsRequest() - assert args[0] == request_msg @@ -9787,7 +9797,6 @@ def test_get_agent_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.GetAgentRequest() - assert args[0] == request_msg @@ -9807,7 +9816,6 @@ def test_create_agent_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_agent.CreateAgentRequest() - assert args[0] == request_msg @@ -9827,7 +9835,6 @@ def test_update_agent_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_agent.UpdateAgentRequest() - assert args[0] == request_msg @@ -9847,7 +9854,6 @@ def test_delete_agent_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.DeleteAgentRequest() - assert args[0] == request_msg @@ -9867,7 +9873,6 @@ def test_export_agent_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.ExportAgentRequest() - assert args[0] == request_msg @@ -9887,7 +9892,6 @@ def test_restore_agent_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.RestoreAgentRequest() - assert args[0] == request_msg @@ -9907,7 +9911,6 @@ def test_validate_agent_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.ValidateAgentRequest() - assert args[0] == request_msg @@ -9929,7 +9932,6 @@ def test_get_agent_validation_result_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.GetAgentValidationResultRequest() - assert args[0] == request_msg @@ -9951,7 +9953,6 @@ def test_get_generative_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.GetGenerativeSettingsRequest() - assert args[0] == request_msg @@ -9973,7 +9974,6 @@ def test_update_generative_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.UpdateGenerativeSettingsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_changelogs.py b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_changelogs.py index 8d73d32225a5..abdde626eae6 100644 --- a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_changelogs.py +++ b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_changelogs.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 @@ -110,6 +111,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" @@ -1274,8 +1290,8 @@ def test_changelogs_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - changelog.ListChangelogsRequest, - dict, + changelog.ListChangelogsRequest(), + {}, ], ) def test_list_changelogs(request_type, transport: str = "grpc"): @@ -1286,7 +1302,7 @@ def test_list_changelogs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_changelogs), "__call__") as call: @@ -1332,11 +1348,12 @@ def test_list_changelogs_non_empty_request_with_auto_populated_field(): client.list_changelogs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == changelog.ListChangelogsRequest( + request_msg = changelog.ListChangelogsRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_changelogs_use_cached_wrapped_rpc(): @@ -1417,9 +1434,14 @@ async def test_list_changelogs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_changelogs_async( - transport: str = "grpc_asyncio", request_type=changelog.ListChangelogsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + changelog.ListChangelogsRequest(), + {}, + ], +) +async def test_list_changelogs_async(request_type, transport: str = "grpc_asyncio"): client = ChangelogsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1427,7 +1449,7 @@ async def test_list_changelogs_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_changelogs), "__call__") as call: @@ -1450,11 +1472,6 @@ async def test_list_changelogs_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_changelogs_async_from_dict(): - await test_list_changelogs_async(request_type=dict) - - def test_list_changelogs_field_headers(): client = ChangelogsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1791,8 +1808,8 @@ async def test_list_changelogs_async_pages(): @pytest.mark.parametrize( "request_type", [ - changelog.GetChangelogRequest, - dict, + changelog.GetChangelogRequest(), + {}, ], ) def test_get_changelog(request_type, transport: str = "grpc"): @@ -1803,7 +1820,7 @@ def test_get_changelog(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_changelog), "__call__") as call: @@ -1859,9 +1876,10 @@ def test_get_changelog_non_empty_request_with_auto_populated_field(): client.get_changelog(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == changelog.GetChangelogRequest( + request_msg = changelog.GetChangelogRequest( name="name_value", ) + assert args[0] == request_msg def test_get_changelog_use_cached_wrapped_rpc(): @@ -1942,9 +1960,14 @@ async def test_get_changelog_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_changelog_async( - transport: str = "grpc_asyncio", request_type=changelog.GetChangelogRequest -): +@pytest.mark.parametrize( + "request_type", + [ + changelog.GetChangelogRequest(), + {}, + ], +) +async def test_get_changelog_async(request_type, transport: str = "grpc_asyncio"): client = ChangelogsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1952,7 +1975,7 @@ async def test_get_changelog_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_changelog), "__call__") as call: @@ -1987,11 +2010,6 @@ async def test_get_changelog_async( assert response.language_code == "language_code_value" -@pytest.mark.asyncio -async def test_get_changelog_async_from_dict(): - await test_get_changelog_async(request_type=dict) - - def test_get_changelog_field_headers(): client = ChangelogsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2688,7 +2706,6 @@ def test_list_changelogs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = changelog.ListChangelogsRequest() - assert args[0] == request_msg @@ -2709,7 +2726,6 @@ def test_get_changelog_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = changelog.GetChangelogRequest() - assert args[0] == request_msg @@ -2750,7 +2766,6 @@ async def test_list_changelogs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = changelog.ListChangelogsRequest() - assert args[0] == request_msg @@ -2783,7 +2798,6 @@ async def test_get_changelog_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = changelog.GetChangelogRequest() - assert args[0] == request_msg @@ -3398,7 +3412,6 @@ def test_list_changelogs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = changelog.ListChangelogsRequest() - assert args[0] == request_msg @@ -3418,7 +3431,6 @@ def test_get_changelog_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = changelog.GetChangelogRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_deployments.py b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_deployments.py index 211985b07cca..fa711d950569 100644 --- a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_deployments.py +++ b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_deployments.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 @@ -110,6 +111,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" @@ -1278,8 +1294,8 @@ def test_deployments_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - deployment.ListDeploymentsRequest, - dict, + deployment.ListDeploymentsRequest(), + {}, ], ) def test_list_deployments(request_type, transport: str = "grpc"): @@ -1290,7 +1306,7 @@ def test_list_deployments(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_deployments), "__call__") as call: @@ -1335,10 +1351,11 @@ def test_list_deployments_non_empty_request_with_auto_populated_field(): client.list_deployments(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == deployment.ListDeploymentsRequest( + request_msg = deployment.ListDeploymentsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_deployments_use_cached_wrapped_rpc(): @@ -1421,9 +1438,14 @@ async def test_list_deployments_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_deployments_async( - transport: str = "grpc_asyncio", request_type=deployment.ListDeploymentsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + deployment.ListDeploymentsRequest(), + {}, + ], +) +async def test_list_deployments_async(request_type, transport: str = "grpc_asyncio"): client = DeploymentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1431,7 +1453,7 @@ async def test_list_deployments_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_deployments), "__call__") as call: @@ -1454,11 +1476,6 @@ async def test_list_deployments_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_deployments_async_from_dict(): - await test_list_deployments_async(request_type=dict) - - def test_list_deployments_field_headers(): client = DeploymentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1795,8 +1812,8 @@ async def test_list_deployments_async_pages(): @pytest.mark.parametrize( "request_type", [ - deployment.GetDeploymentRequest, - dict, + deployment.GetDeploymentRequest(), + {}, ], ) def test_get_deployment(request_type, transport: str = "grpc"): @@ -1807,7 +1824,7 @@ def test_get_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_deployment), "__call__") as call: @@ -1855,9 +1872,10 @@ def test_get_deployment_non_empty_request_with_auto_populated_field(): client.get_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == deployment.GetDeploymentRequest( + request_msg = deployment.GetDeploymentRequest( name="name_value", ) + assert args[0] == request_msg def test_get_deployment_use_cached_wrapped_rpc(): @@ -1938,9 +1956,14 @@ async def test_get_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_deployment_async( - transport: str = "grpc_asyncio", request_type=deployment.GetDeploymentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + deployment.GetDeploymentRequest(), + {}, + ], +) +async def test_get_deployment_async(request_type, transport: str = "grpc_asyncio"): client = DeploymentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1948,7 +1971,7 @@ async def test_get_deployment_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_deployment), "__call__") as call: @@ -1975,11 +1998,6 @@ async def test_get_deployment_async( assert response.state == deployment.Deployment.State.RUNNING -@pytest.mark.asyncio -async def test_get_deployment_async_from_dict(): - await test_get_deployment_async(request_type=dict) - - def test_get_deployment_field_headers(): client = DeploymentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2688,7 +2706,6 @@ def test_list_deployments_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployment.ListDeploymentsRequest() - assert args[0] == request_msg @@ -2709,7 +2726,6 @@ def test_get_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployment.GetDeploymentRequest() - assert args[0] == request_msg @@ -2750,7 +2766,6 @@ async def test_list_deployments_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployment.ListDeploymentsRequest() - assert args[0] == request_msg @@ -2779,7 +2794,6 @@ async def test_get_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployment.GetDeploymentRequest() - assert args[0] == request_msg @@ -3394,7 +3408,6 @@ def test_list_deployments_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployment.ListDeploymentsRequest() - assert args[0] == request_msg @@ -3414,7 +3427,6 @@ def test_get_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployment.GetDeploymentRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_entity_types.py b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_entity_types.py index 13f1653cbb19..f22ea524469d 100644 --- a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_entity_types.py +++ b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_entity_types.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 @@ -115,6 +116,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" @@ -1283,8 +1299,8 @@ def test_entity_types_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - entity_type.GetEntityTypeRequest, - dict, + entity_type.GetEntityTypeRequest(), + {}, ], ) def test_get_entity_type(request_type, transport: str = "grpc"): @@ -1295,7 +1311,7 @@ def test_get_entity_type(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_entity_type), "__call__") as call: @@ -1353,10 +1369,11 @@ def test_get_entity_type_non_empty_request_with_auto_populated_field(): client.get_entity_type(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == entity_type.GetEntityTypeRequest( + request_msg = entity_type.GetEntityTypeRequest( name="name_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_get_entity_type_use_cached_wrapped_rpc(): @@ -1437,9 +1454,14 @@ async def test_get_entity_type_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_entity_type_async( - transport: str = "grpc_asyncio", request_type=entity_type.GetEntityTypeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + entity_type.GetEntityTypeRequest(), + {}, + ], +) +async def test_get_entity_type_async(request_type, transport: str = "grpc_asyncio"): client = EntityTypesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1447,7 +1469,7 @@ async def test_get_entity_type_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_entity_type), "__call__") as call: @@ -1483,11 +1505,6 @@ async def test_get_entity_type_async( assert response.redact is True -@pytest.mark.asyncio -async def test_get_entity_type_async_from_dict(): - await test_get_entity_type_async(request_type=dict) - - def test_get_entity_type_field_headers(): client = EntityTypesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1634,8 +1651,8 @@ async def test_get_entity_type_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcdc_entity_type.CreateEntityTypeRequest, - dict, + gcdc_entity_type.CreateEntityTypeRequest(), + {}, ], ) def test_create_entity_type(request_type, transport: str = "grpc"): @@ -1646,7 +1663,7 @@ def test_create_entity_type(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1708,10 +1725,11 @@ def test_create_entity_type_non_empty_request_with_auto_populated_field(): client.create_entity_type(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcdc_entity_type.CreateEntityTypeRequest( + request_msg = gcdc_entity_type.CreateEntityTypeRequest( parent="parent_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_create_entity_type_use_cached_wrapped_rpc(): @@ -1796,10 +1814,14 @@ async def test_create_entity_type_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_entity_type_async( - transport: str = "grpc_asyncio", - request_type=gcdc_entity_type.CreateEntityTypeRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + gcdc_entity_type.CreateEntityTypeRequest(), + {}, + ], +) +async def test_create_entity_type_async(request_type, transport: str = "grpc_asyncio"): client = EntityTypesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1807,7 +1829,7 @@ async def test_create_entity_type_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( @@ -1845,11 +1867,6 @@ async def test_create_entity_type_async( assert response.redact is True -@pytest.mark.asyncio -async def test_create_entity_type_async_from_dict(): - await test_create_entity_type_async(request_type=dict) - - def test_create_entity_type_field_headers(): client = EntityTypesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2014,8 +2031,8 @@ async def test_create_entity_type_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcdc_entity_type.UpdateEntityTypeRequest, - dict, + gcdc_entity_type.UpdateEntityTypeRequest(), + {}, ], ) def test_update_entity_type(request_type, transport: str = "grpc"): @@ -2026,7 +2043,7 @@ def test_update_entity_type(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2087,9 +2104,10 @@ def test_update_entity_type_non_empty_request_with_auto_populated_field(): client.update_entity_type(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcdc_entity_type.UpdateEntityTypeRequest( + request_msg = gcdc_entity_type.UpdateEntityTypeRequest( language_code="language_code_value", ) + assert args[0] == request_msg def test_update_entity_type_use_cached_wrapped_rpc(): @@ -2174,10 +2192,14 @@ async def test_update_entity_type_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_entity_type_async( - transport: str = "grpc_asyncio", - request_type=gcdc_entity_type.UpdateEntityTypeRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + gcdc_entity_type.UpdateEntityTypeRequest(), + {}, + ], +) +async def test_update_entity_type_async(request_type, transport: str = "grpc_asyncio"): client = EntityTypesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2185,7 +2207,7 @@ async def test_update_entity_type_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( @@ -2223,11 +2245,6 @@ async def test_update_entity_type_async( assert response.redact is True -@pytest.mark.asyncio -async def test_update_entity_type_async_from_dict(): - await test_update_entity_type_async(request_type=dict) - - def test_update_entity_type_field_headers(): client = EntityTypesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2392,8 +2409,8 @@ async def test_update_entity_type_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - entity_type.DeleteEntityTypeRequest, - dict, + entity_type.DeleteEntityTypeRequest(), + {}, ], ) def test_delete_entity_type(request_type, transport: str = "grpc"): @@ -2404,7 +2421,7 @@ def test_delete_entity_type(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2449,9 +2466,10 @@ def test_delete_entity_type_non_empty_request_with_auto_populated_field(): client.delete_entity_type(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == entity_type.DeleteEntityTypeRequest( + request_msg = entity_type.DeleteEntityTypeRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_entity_type_use_cached_wrapped_rpc(): @@ -2536,9 +2554,14 @@ async def test_delete_entity_type_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_entity_type_async( - transport: str = "grpc_asyncio", request_type=entity_type.DeleteEntityTypeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + entity_type.DeleteEntityTypeRequest(), + {}, + ], +) +async def test_delete_entity_type_async(request_type, transport: str = "grpc_asyncio"): client = EntityTypesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2546,7 +2569,7 @@ async def test_delete_entity_type_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( @@ -2566,11 +2589,6 @@ async def test_delete_entity_type_async( assert response is None -@pytest.mark.asyncio -async def test_delete_entity_type_async_from_dict(): - await test_delete_entity_type_async(request_type=dict) - - def test_delete_entity_type_field_headers(): client = EntityTypesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2721,8 +2739,8 @@ async def test_delete_entity_type_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - entity_type.ListEntityTypesRequest, - dict, + entity_type.ListEntityTypesRequest(), + {}, ], ) def test_list_entity_types(request_type, transport: str = "grpc"): @@ -2733,7 +2751,7 @@ def test_list_entity_types(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2783,11 +2801,12 @@ def test_list_entity_types_non_empty_request_with_auto_populated_field(): client.list_entity_types(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == entity_type.ListEntityTypesRequest( + request_msg = entity_type.ListEntityTypesRequest( parent="parent_value", language_code="language_code_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_entity_types_use_cached_wrapped_rpc(): @@ -2870,9 +2889,14 @@ async def test_list_entity_types_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_entity_types_async( - transport: str = "grpc_asyncio", request_type=entity_type.ListEntityTypesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + entity_type.ListEntityTypesRequest(), + {}, + ], +) +async def test_list_entity_types_async(request_type, transport: str = "grpc_asyncio"): client = EntityTypesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2880,7 +2904,7 @@ async def test_list_entity_types_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( @@ -2905,11 +2929,6 @@ async def test_list_entity_types_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_entity_types_async_from_dict(): - await test_list_entity_types_async(request_type=dict) - - def test_list_entity_types_field_headers(): client = EntityTypesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3262,8 +3281,8 @@ async def test_list_entity_types_async_pages(): @pytest.mark.parametrize( "request_type", [ - entity_type.ExportEntityTypesRequest, - dict, + entity_type.ExportEntityTypesRequest(), + {}, ], ) def test_export_entity_types(request_type, transport: str = "grpc"): @@ -3274,7 +3293,7 @@ def test_export_entity_types(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3321,11 +3340,12 @@ def test_export_entity_types_non_empty_request_with_auto_populated_field(): client.export_entity_types(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == entity_type.ExportEntityTypesRequest( + request_msg = entity_type.ExportEntityTypesRequest( parent="parent_value", entity_types_uri="entity_types_uri_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_export_entity_types_use_cached_wrapped_rpc(): @@ -3420,9 +3440,14 @@ async def test_export_entity_types_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_export_entity_types_async( - transport: str = "grpc_asyncio", request_type=entity_type.ExportEntityTypesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + entity_type.ExportEntityTypesRequest(), + {}, + ], +) +async def test_export_entity_types_async(request_type, transport: str = "grpc_asyncio"): client = EntityTypesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3430,7 +3455,7 @@ async def test_export_entity_types_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( @@ -3452,11 +3477,6 @@ async def test_export_entity_types_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_export_entity_types_async_from_dict(): - await test_export_entity_types_async(request_type=dict) - - def test_export_entity_types_field_headers(): client = EntityTypesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3525,8 +3545,8 @@ async def test_export_entity_types_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - entity_type.ImportEntityTypesRequest, - dict, + entity_type.ImportEntityTypesRequest(), + {}, ], ) def test_import_entity_types(request_type, transport: str = "grpc"): @@ -3537,7 +3557,7 @@ def test_import_entity_types(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3584,11 +3604,12 @@ def test_import_entity_types_non_empty_request_with_auto_populated_field(): client.import_entity_types(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == entity_type.ImportEntityTypesRequest( + request_msg = entity_type.ImportEntityTypesRequest( parent="parent_value", entity_types_uri="entity_types_uri_value", target_entity_type="target_entity_type_value", ) + assert args[0] == request_msg def test_import_entity_types_use_cached_wrapped_rpc(): @@ -3683,9 +3704,14 @@ async def test_import_entity_types_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_import_entity_types_async( - transport: str = "grpc_asyncio", request_type=entity_type.ImportEntityTypesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + entity_type.ImportEntityTypesRequest(), + {}, + ], +) +async def test_import_entity_types_async(request_type, transport: str = "grpc_asyncio"): client = EntityTypesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3693,7 +3719,7 @@ async def test_import_entity_types_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( @@ -3715,11 +3741,6 @@ async def test_import_entity_types_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_import_entity_types_async_from_dict(): - await test_import_entity_types_async(request_type=dict) - - def test_import_entity_types_field_headers(): client = EntityTypesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5197,7 +5218,6 @@ def test_get_entity_type_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.GetEntityTypeRequest() - assert args[0] == request_msg @@ -5220,7 +5240,6 @@ def test_create_entity_type_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_entity_type.CreateEntityTypeRequest() - assert args[0] == request_msg @@ -5243,7 +5262,6 @@ def test_update_entity_type_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_entity_type.UpdateEntityTypeRequest() - assert args[0] == request_msg @@ -5266,7 +5284,6 @@ def test_delete_entity_type_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.DeleteEntityTypeRequest() - assert args[0] == request_msg @@ -5289,7 +5306,6 @@ def test_list_entity_types_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.ListEntityTypesRequest() - assert args[0] == request_msg @@ -5312,7 +5328,6 @@ def test_export_entity_types_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.ExportEntityTypesRequest() - assert args[0] == request_msg @@ -5335,7 +5350,6 @@ def test_import_entity_types_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.ImportEntityTypesRequest() - assert args[0] == request_msg @@ -5381,7 +5395,6 @@ async def test_get_entity_type_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.GetEntityTypeRequest() - assert args[0] == request_msg @@ -5415,7 +5428,6 @@ async def test_create_entity_type_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_entity_type.CreateEntityTypeRequest() - assert args[0] == request_msg @@ -5449,7 +5461,6 @@ async def test_update_entity_type_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_entity_type.UpdateEntityTypeRequest() - assert args[0] == request_msg @@ -5474,7 +5485,6 @@ async def test_delete_entity_type_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.DeleteEntityTypeRequest() - assert args[0] == request_msg @@ -5503,7 +5513,6 @@ async def test_list_entity_types_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.ListEntityTypesRequest() - assert args[0] == request_msg @@ -5530,7 +5539,6 @@ async def test_export_entity_types_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.ExportEntityTypesRequest() - assert args[0] == request_msg @@ -5557,7 +5565,6 @@ async def test_import_entity_types_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.ImportEntityTypesRequest() - assert args[0] == request_msg @@ -7007,7 +7014,6 @@ def test_get_entity_type_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.GetEntityTypeRequest() - assert args[0] == request_msg @@ -7029,7 +7035,6 @@ def test_create_entity_type_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_entity_type.CreateEntityTypeRequest() - assert args[0] == request_msg @@ -7051,7 +7056,6 @@ def test_update_entity_type_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_entity_type.UpdateEntityTypeRequest() - assert args[0] == request_msg @@ -7073,7 +7077,6 @@ def test_delete_entity_type_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.DeleteEntityTypeRequest() - assert args[0] == request_msg @@ -7095,7 +7098,6 @@ def test_list_entity_types_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.ListEntityTypesRequest() - assert args[0] == request_msg @@ -7117,7 +7119,6 @@ def test_export_entity_types_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.ExportEntityTypesRequest() - assert args[0] == request_msg @@ -7139,7 +7140,6 @@ def test_import_entity_types_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.ImportEntityTypesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_environments.py b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_environments.py index 67857ea3443e..f3ef0978756e 100644 --- a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_environments.py +++ b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_environments.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 @@ -118,6 +119,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" @@ -1301,8 +1317,8 @@ def test_environments_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - environment.ListEnvironmentsRequest, - dict, + environment.ListEnvironmentsRequest(), + {}, ], ) def test_list_environments(request_type, transport: str = "grpc"): @@ -1313,7 +1329,7 @@ def test_list_environments(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1362,10 +1378,11 @@ def test_list_environments_non_empty_request_with_auto_populated_field(): client.list_environments(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environment.ListEnvironmentsRequest( + request_msg = environment.ListEnvironmentsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_environments_use_cached_wrapped_rpc(): @@ -1448,9 +1465,14 @@ async def test_list_environments_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_environments_async( - transport: str = "grpc_asyncio", request_type=environment.ListEnvironmentsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + environment.ListEnvironmentsRequest(), + {}, + ], +) +async def test_list_environments_async(request_type, transport: str = "grpc_asyncio"): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1458,7 +1480,7 @@ async def test_list_environments_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( @@ -1483,11 +1505,6 @@ async def test_list_environments_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_environments_async_from_dict(): - await test_list_environments_async(request_type=dict) - - def test_list_environments_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1840,8 +1857,8 @@ async def test_list_environments_async_pages(): @pytest.mark.parametrize( "request_type", [ - environment.GetEnvironmentRequest, - dict, + environment.GetEnvironmentRequest(), + {}, ], ) def test_get_environment(request_type, transport: str = "grpc"): @@ -1852,7 +1869,7 @@ def test_get_environment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_environment), "__call__") as call: @@ -1900,9 +1917,10 @@ def test_get_environment_non_empty_request_with_auto_populated_field(): client.get_environment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environment.GetEnvironmentRequest( + request_msg = environment.GetEnvironmentRequest( name="name_value", ) + assert args[0] == request_msg def test_get_environment_use_cached_wrapped_rpc(): @@ -1983,9 +2001,14 @@ async def test_get_environment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_environment_async( - transport: str = "grpc_asyncio", request_type=environment.GetEnvironmentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + environment.GetEnvironmentRequest(), + {}, + ], +) +async def test_get_environment_async(request_type, transport: str = "grpc_asyncio"): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1993,7 +2016,7 @@ async def test_get_environment_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_environment), "__call__") as call: @@ -2020,11 +2043,6 @@ async def test_get_environment_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_get_environment_async_from_dict(): - await test_get_environment_async(request_type=dict) - - def test_get_environment_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2171,8 +2189,8 @@ async def test_get_environment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcdc_environment.CreateEnvironmentRequest, - dict, + gcdc_environment.CreateEnvironmentRequest(), + {}, ], ) def test_create_environment(request_type, transport: str = "grpc"): @@ -2183,7 +2201,7 @@ def test_create_environment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2228,9 +2246,10 @@ def test_create_environment_non_empty_request_with_auto_populated_field(): client.create_environment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcdc_environment.CreateEnvironmentRequest( + request_msg = gcdc_environment.CreateEnvironmentRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_environment_use_cached_wrapped_rpc(): @@ -2325,10 +2344,14 @@ async def test_create_environment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_environment_async( - transport: str = "grpc_asyncio", - request_type=gcdc_environment.CreateEnvironmentRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + gcdc_environment.CreateEnvironmentRequest(), + {}, + ], +) +async def test_create_environment_async(request_type, transport: str = "grpc_asyncio"): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2336,7 +2359,7 @@ async def test_create_environment_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( @@ -2358,11 +2381,6 @@ async def test_create_environment_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_environment_async_from_dict(): - await test_create_environment_async(request_type=dict) - - def test_create_environment_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2527,8 +2545,8 @@ async def test_create_environment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcdc_environment.UpdateEnvironmentRequest, - dict, + gcdc_environment.UpdateEnvironmentRequest(), + {}, ], ) def test_update_environment(request_type, transport: str = "grpc"): @@ -2539,7 +2557,7 @@ def test_update_environment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2582,7 +2600,8 @@ def test_update_environment_non_empty_request_with_auto_populated_field(): client.update_environment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcdc_environment.UpdateEnvironmentRequest() + request_msg = gcdc_environment.UpdateEnvironmentRequest() + assert args[0] == request_msg def test_update_environment_use_cached_wrapped_rpc(): @@ -2677,10 +2696,14 @@ async def test_update_environment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_environment_async( - transport: str = "grpc_asyncio", - request_type=gcdc_environment.UpdateEnvironmentRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + gcdc_environment.UpdateEnvironmentRequest(), + {}, + ], +) +async def test_update_environment_async(request_type, transport: str = "grpc_asyncio"): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2688,7 +2711,7 @@ async def test_update_environment_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( @@ -2710,11 +2733,6 @@ async def test_update_environment_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_environment_async_from_dict(): - await test_update_environment_async(request_type=dict) - - def test_update_environment_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2879,8 +2897,8 @@ async def test_update_environment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - environment.DeleteEnvironmentRequest, - dict, + environment.DeleteEnvironmentRequest(), + {}, ], ) def test_delete_environment(request_type, transport: str = "grpc"): @@ -2891,7 +2909,7 @@ def test_delete_environment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2936,9 +2954,10 @@ def test_delete_environment_non_empty_request_with_auto_populated_field(): client.delete_environment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environment.DeleteEnvironmentRequest( + request_msg = environment.DeleteEnvironmentRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_environment_use_cached_wrapped_rpc(): @@ -3023,9 +3042,14 @@ async def test_delete_environment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_environment_async( - transport: str = "grpc_asyncio", request_type=environment.DeleteEnvironmentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + environment.DeleteEnvironmentRequest(), + {}, + ], +) +async def test_delete_environment_async(request_type, transport: str = "grpc_asyncio"): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3033,7 +3057,7 @@ async def test_delete_environment_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( @@ -3053,11 +3077,6 @@ async def test_delete_environment_async( assert response is None -@pytest.mark.asyncio -async def test_delete_environment_async_from_dict(): - await test_delete_environment_async(request_type=dict) - - def test_delete_environment_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3208,8 +3227,8 @@ async def test_delete_environment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - environment.LookupEnvironmentHistoryRequest, - dict, + environment.LookupEnvironmentHistoryRequest(), + {}, ], ) def test_lookup_environment_history(request_type, transport: str = "grpc"): @@ -3220,7 +3239,7 @@ def test_lookup_environment_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( @@ -3269,10 +3288,11 @@ def test_lookup_environment_history_non_empty_request_with_auto_populated_field( client.lookup_environment_history(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environment.LookupEnvironmentHistoryRequest( + request_msg = environment.LookupEnvironmentHistoryRequest( name="name_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_lookup_environment_history_use_cached_wrapped_rpc(): @@ -3358,9 +3378,15 @@ async def test_lookup_environment_history_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + environment.LookupEnvironmentHistoryRequest(), + {}, + ], +) async def test_lookup_environment_history_async( - transport: str = "grpc_asyncio", - request_type=environment.LookupEnvironmentHistoryRequest, + request_type, transport: str = "grpc_asyncio" ): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), @@ -3369,7 +3395,7 @@ async def test_lookup_environment_history_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( @@ -3394,11 +3420,6 @@ async def test_lookup_environment_history_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_lookup_environment_history_async_from_dict(): - await test_lookup_environment_history_async(request_type=dict) - - def test_lookup_environment_history_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3753,8 +3774,8 @@ async def test_lookup_environment_history_async_pages(): @pytest.mark.parametrize( "request_type", [ - environment.RunContinuousTestRequest, - dict, + environment.RunContinuousTestRequest(), + {}, ], ) def test_run_continuous_test(request_type, transport: str = "grpc"): @@ -3765,7 +3786,7 @@ def test_run_continuous_test(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,9 +3831,10 @@ def test_run_continuous_test_non_empty_request_with_auto_populated_field(): client.run_continuous_test(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environment.RunContinuousTestRequest( + request_msg = environment.RunContinuousTestRequest( environment="environment_value", ) + assert args[0] == request_msg def test_run_continuous_test_use_cached_wrapped_rpc(): @@ -3907,9 +3929,14 @@ async def test_run_continuous_test_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_run_continuous_test_async( - transport: str = "grpc_asyncio", request_type=environment.RunContinuousTestRequest -): +@pytest.mark.parametrize( + "request_type", + [ + environment.RunContinuousTestRequest(), + {}, + ], +) +async def test_run_continuous_test_async(request_type, transport: str = "grpc_asyncio"): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3917,7 +3944,7 @@ async def test_run_continuous_test_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( @@ -3939,11 +3966,6 @@ async def test_run_continuous_test_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_run_continuous_test_async_from_dict(): - await test_run_continuous_test_async(request_type=dict) - - def test_run_continuous_test_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4012,8 +4034,8 @@ async def test_run_continuous_test_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - environment.ListContinuousTestResultsRequest, - dict, + environment.ListContinuousTestResultsRequest(), + {}, ], ) def test_list_continuous_test_results(request_type, transport: str = "grpc"): @@ -4024,7 +4046,7 @@ def test_list_continuous_test_results(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4073,10 +4095,11 @@ def test_list_continuous_test_results_non_empty_request_with_auto_populated_fiel client.list_continuous_test_results(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environment.ListContinuousTestResultsRequest( + request_msg = environment.ListContinuousTestResultsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_continuous_test_results_use_cached_wrapped_rpc(): @@ -4162,9 +4185,15 @@ async def test_list_continuous_test_results_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + environment.ListContinuousTestResultsRequest(), + {}, + ], +) async def test_list_continuous_test_results_async( - transport: str = "grpc_asyncio", - request_type=environment.ListContinuousTestResultsRequest, + request_type, transport: str = "grpc_asyncio" ): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), @@ -4173,7 +4202,7 @@ async def test_list_continuous_test_results_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( @@ -4198,11 +4227,6 @@ async def test_list_continuous_test_results_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_continuous_test_results_async_from_dict(): - await test_list_continuous_test_results_async(request_type=dict) - - def test_list_continuous_test_results_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4559,8 +4583,8 @@ async def test_list_continuous_test_results_async_pages(): @pytest.mark.parametrize( "request_type", [ - environment.DeployFlowRequest, - dict, + environment.DeployFlowRequest(), + {}, ], ) def test_deploy_flow(request_type, transport: str = "grpc"): @@ -4571,7 +4595,7 @@ def test_deploy_flow(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.deploy_flow), "__call__") as call: @@ -4613,10 +4637,11 @@ def test_deploy_flow_non_empty_request_with_auto_populated_field(): client.deploy_flow(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environment.DeployFlowRequest( + request_msg = environment.DeployFlowRequest( environment="environment_value", flow_version="flow_version_value", ) + assert args[0] == request_msg def test_deploy_flow_use_cached_wrapped_rpc(): @@ -4707,9 +4732,14 @@ async def test_deploy_flow_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_deploy_flow_async( - transport: str = "grpc_asyncio", request_type=environment.DeployFlowRequest -): +@pytest.mark.parametrize( + "request_type", + [ + environment.DeployFlowRequest(), + {}, + ], +) +async def test_deploy_flow_async(request_type, transport: str = "grpc_asyncio"): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4717,7 +4747,7 @@ async def test_deploy_flow_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.deploy_flow), "__call__") as call: @@ -4737,11 +4767,6 @@ async def test_deploy_flow_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_deploy_flow_async_from_dict(): - await test_deploy_flow_async(request_type=dict) - - def test_deploy_flow_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6720,7 +6745,6 @@ def test_list_environments_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.ListEnvironmentsRequest() - assert args[0] == request_msg @@ -6741,7 +6765,6 @@ def test_get_environment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.GetEnvironmentRequest() - assert args[0] == request_msg @@ -6764,7 +6787,6 @@ def test_create_environment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_environment.CreateEnvironmentRequest() - assert args[0] == request_msg @@ -6787,7 +6809,6 @@ def test_update_environment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_environment.UpdateEnvironmentRequest() - assert args[0] == request_msg @@ -6810,7 +6831,6 @@ def test_delete_environment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.DeleteEnvironmentRequest() - assert args[0] == request_msg @@ -6833,7 +6853,6 @@ def test_lookup_environment_history_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.LookupEnvironmentHistoryRequest() - assert args[0] == request_msg @@ -6856,7 +6875,6 @@ def test_run_continuous_test_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.RunContinuousTestRequest() - assert args[0] == request_msg @@ -6879,7 +6897,6 @@ def test_list_continuous_test_results_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.ListContinuousTestResultsRequest() - assert args[0] == request_msg @@ -6900,7 +6917,6 @@ def test_deploy_flow_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.DeployFlowRequest() - assert args[0] == request_msg @@ -6943,7 +6959,6 @@ async def test_list_environments_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.ListEnvironmentsRequest() - assert args[0] == request_msg @@ -6972,7 +6987,6 @@ async def test_get_environment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.GetEnvironmentRequest() - assert args[0] == request_msg @@ -6999,7 +7013,6 @@ async def test_create_environment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_environment.CreateEnvironmentRequest() - assert args[0] == request_msg @@ -7026,7 +7039,6 @@ async def test_update_environment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_environment.UpdateEnvironmentRequest() - assert args[0] == request_msg @@ -7051,7 +7063,6 @@ async def test_delete_environment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.DeleteEnvironmentRequest() - assert args[0] == request_msg @@ -7080,7 +7091,6 @@ async def test_lookup_environment_history_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.LookupEnvironmentHistoryRequest() - assert args[0] == request_msg @@ -7107,7 +7117,6 @@ async def test_run_continuous_test_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.RunContinuousTestRequest() - assert args[0] == request_msg @@ -7136,7 +7145,6 @@ async def test_list_continuous_test_results_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.ListContinuousTestResultsRequest() - assert args[0] == request_msg @@ -7161,7 +7169,6 @@ async def test_deploy_flow_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.DeployFlowRequest() - assert args[0] == request_msg @@ -8929,7 +8936,6 @@ def test_list_environments_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.ListEnvironmentsRequest() - assert args[0] == request_msg @@ -8949,7 +8955,6 @@ def test_get_environment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.GetEnvironmentRequest() - assert args[0] == request_msg @@ -8971,7 +8976,6 @@ def test_create_environment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_environment.CreateEnvironmentRequest() - assert args[0] == request_msg @@ -8993,7 +8997,6 @@ def test_update_environment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_environment.UpdateEnvironmentRequest() - assert args[0] == request_msg @@ -9015,7 +9018,6 @@ def test_delete_environment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.DeleteEnvironmentRequest() - assert args[0] == request_msg @@ -9037,7 +9039,6 @@ def test_lookup_environment_history_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.LookupEnvironmentHistoryRequest() - assert args[0] == request_msg @@ -9059,7 +9060,6 @@ def test_run_continuous_test_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.RunContinuousTestRequest() - assert args[0] == request_msg @@ -9081,7 +9081,6 @@ def test_list_continuous_test_results_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.ListContinuousTestResultsRequest() - assert args[0] == request_msg @@ -9101,7 +9100,6 @@ def test_deploy_flow_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.DeployFlowRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_examples.py b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_examples.py index 8ac234714d99..4a5e8019f14d 100644 --- a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_examples.py +++ b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_examples.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 @@ -113,6 +114,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" @@ -1260,8 +1276,8 @@ def test_examples_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - gcdc_example.CreateExampleRequest, - dict, + gcdc_example.CreateExampleRequest(), + {}, ], ) def test_create_example(request_type, transport: str = "grpc"): @@ -1272,7 +1288,7 @@ def test_create_example(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_example), "__call__") as call: @@ -1326,9 +1342,10 @@ def test_create_example_non_empty_request_with_auto_populated_field(): client.create_example(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcdc_example.CreateExampleRequest( + request_msg = gcdc_example.CreateExampleRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_example_use_cached_wrapped_rpc(): @@ -1409,9 +1426,14 @@ async def test_create_example_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_example_async( - transport: str = "grpc_asyncio", request_type=gcdc_example.CreateExampleRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcdc_example.CreateExampleRequest(), + {}, + ], +) +async def test_create_example_async(request_type, transport: str = "grpc_asyncio"): client = ExamplesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1419,7 +1441,7 @@ async def test_create_example_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_example), "__call__") as call: @@ -1452,11 +1474,6 @@ async def test_create_example_async( assert response.language_code == "language_code_value" -@pytest.mark.asyncio -async def test_create_example_async_from_dict(): - await test_create_example_async(request_type=dict) - - def test_create_example_field_headers(): client = ExamplesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1613,8 +1630,8 @@ async def test_create_example_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - example.DeleteExampleRequest, - dict, + example.DeleteExampleRequest(), + {}, ], ) def test_delete_example(request_type, transport: str = "grpc"): @@ -1625,7 +1642,7 @@ def test_delete_example(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_example), "__call__") as call: @@ -1666,9 +1683,10 @@ def test_delete_example_non_empty_request_with_auto_populated_field(): client.delete_example(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == example.DeleteExampleRequest( + request_msg = example.DeleteExampleRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_example_use_cached_wrapped_rpc(): @@ -1749,9 +1767,14 @@ async def test_delete_example_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_example_async( - transport: str = "grpc_asyncio", request_type=example.DeleteExampleRequest -): +@pytest.mark.parametrize( + "request_type", + [ + example.DeleteExampleRequest(), + {}, + ], +) +async def test_delete_example_async(request_type, transport: str = "grpc_asyncio"): client = ExamplesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1759,7 +1782,7 @@ async def test_delete_example_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_example), "__call__") as call: @@ -1777,11 +1800,6 @@ async def test_delete_example_async( assert response is None -@pytest.mark.asyncio -async def test_delete_example_async_from_dict(): - await test_delete_example_async(request_type=dict) - - def test_delete_example_field_headers(): client = ExamplesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1924,8 +1942,8 @@ async def test_delete_example_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - example.ListExamplesRequest, - dict, + example.ListExamplesRequest(), + {}, ], ) def test_list_examples(request_type, transport: str = "grpc"): @@ -1936,7 +1954,7 @@ def test_list_examples(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_examples), "__call__") as call: @@ -1982,11 +2000,12 @@ def test_list_examples_non_empty_request_with_auto_populated_field(): client.list_examples(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == example.ListExamplesRequest( + request_msg = example.ListExamplesRequest( parent="parent_value", page_token="page_token_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_list_examples_use_cached_wrapped_rpc(): @@ -2067,9 +2086,14 @@ async def test_list_examples_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_examples_async( - transport: str = "grpc_asyncio", request_type=example.ListExamplesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + example.ListExamplesRequest(), + {}, + ], +) +async def test_list_examples_async(request_type, transport: str = "grpc_asyncio"): client = ExamplesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2077,7 +2101,7 @@ async def test_list_examples_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_examples), "__call__") as call: @@ -2100,11 +2124,6 @@ async def test_list_examples_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_examples_async_from_dict(): - await test_list_examples_async(request_type=dict) - - def test_list_examples_field_headers(): client = ExamplesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2441,8 +2460,8 @@ async def test_list_examples_async_pages(): @pytest.mark.parametrize( "request_type", [ - example.GetExampleRequest, - dict, + example.GetExampleRequest(), + {}, ], ) def test_get_example(request_type, transport: str = "grpc"): @@ -2453,7 +2472,7 @@ def test_get_example(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_example), "__call__") as call: @@ -2507,9 +2526,10 @@ def test_get_example_non_empty_request_with_auto_populated_field(): client.get_example(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == example.GetExampleRequest( + request_msg = example.GetExampleRequest( name="name_value", ) + assert args[0] == request_msg def test_get_example_use_cached_wrapped_rpc(): @@ -2590,9 +2610,14 @@ async def test_get_example_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_example_async( - transport: str = "grpc_asyncio", request_type=example.GetExampleRequest -): +@pytest.mark.parametrize( + "request_type", + [ + example.GetExampleRequest(), + {}, + ], +) +async def test_get_example_async(request_type, transport: str = "grpc_asyncio"): client = ExamplesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2600,7 +2625,7 @@ async def test_get_example_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_example), "__call__") as call: @@ -2633,11 +2658,6 @@ async def test_get_example_async( assert response.language_code == "language_code_value" -@pytest.mark.asyncio -async def test_get_example_async_from_dict(): - await test_get_example_async(request_type=dict) - - def test_get_example_field_headers(): client = ExamplesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2780,8 +2800,8 @@ async def test_get_example_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcdc_example.UpdateExampleRequest, - dict, + gcdc_example.UpdateExampleRequest(), + {}, ], ) def test_update_example(request_type, transport: str = "grpc"): @@ -2792,7 +2812,7 @@ def test_update_example(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_example), "__call__") as call: @@ -2844,7 +2864,8 @@ def test_update_example_non_empty_request_with_auto_populated_field(): client.update_example(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcdc_example.UpdateExampleRequest() + request_msg = gcdc_example.UpdateExampleRequest() + assert args[0] == request_msg def test_update_example_use_cached_wrapped_rpc(): @@ -2925,9 +2946,14 @@ async def test_update_example_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_example_async( - transport: str = "grpc_asyncio", request_type=gcdc_example.UpdateExampleRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcdc_example.UpdateExampleRequest(), + {}, + ], +) +async def test_update_example_async(request_type, transport: str = "grpc_asyncio"): client = ExamplesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2935,7 +2961,7 @@ async def test_update_example_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_example), "__call__") as call: @@ -2968,11 +2994,6 @@ async def test_update_example_async( assert response.language_code == "language_code_value" -@pytest.mark.asyncio -async def test_update_example_async_from_dict(): - await test_update_example_async(request_type=dict) - - def test_update_example_field_headers(): client = ExamplesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4231,7 +4252,6 @@ def test_create_example_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_example.CreateExampleRequest() - assert args[0] == request_msg @@ -4252,7 +4272,6 @@ def test_delete_example_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = example.DeleteExampleRequest() - assert args[0] == request_msg @@ -4273,7 +4292,6 @@ def test_list_examples_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = example.ListExamplesRequest() - assert args[0] == request_msg @@ -4294,7 +4312,6 @@ def test_get_example_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = example.GetExampleRequest() - assert args[0] == request_msg @@ -4315,7 +4332,6 @@ def test_update_example_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_example.UpdateExampleRequest() - assert args[0] == request_msg @@ -4361,7 +4377,6 @@ async def test_create_example_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_example.CreateExampleRequest() - assert args[0] == request_msg @@ -4384,7 +4399,6 @@ async def test_delete_example_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = example.DeleteExampleRequest() - assert args[0] == request_msg @@ -4411,7 +4425,6 @@ async def test_list_examples_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = example.ListExamplesRequest() - assert args[0] == request_msg @@ -4443,7 +4456,6 @@ async def test_get_example_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = example.GetExampleRequest() - assert args[0] == request_msg @@ -4475,7 +4487,6 @@ async def test_update_example_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_example.UpdateExampleRequest() - assert args[0] == request_msg @@ -5708,7 +5719,6 @@ def test_create_example_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_example.CreateExampleRequest() - assert args[0] == request_msg @@ -5728,7 +5738,6 @@ def test_delete_example_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = example.DeleteExampleRequest() - assert args[0] == request_msg @@ -5748,7 +5757,6 @@ def test_list_examples_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = example.ListExamplesRequest() - assert args[0] == request_msg @@ -5768,7 +5776,6 @@ def test_get_example_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = example.GetExampleRequest() - assert args[0] == request_msg @@ -5788,7 +5795,6 @@ def test_update_example_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_example.UpdateExampleRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_experiments.py b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_experiments.py index eb271d83e804..6428ad864aa7 100644 --- a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_experiments.py +++ b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_experiments.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 @@ -113,6 +114,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" @@ -1281,8 +1297,8 @@ def test_experiments_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - experiment.ListExperimentsRequest, - dict, + experiment.ListExperimentsRequest(), + {}, ], ) def test_list_experiments(request_type, transport: str = "grpc"): @@ -1293,7 +1309,7 @@ def test_list_experiments(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_experiments), "__call__") as call: @@ -1338,10 +1354,11 @@ def test_list_experiments_non_empty_request_with_auto_populated_field(): client.list_experiments(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == experiment.ListExperimentsRequest( + request_msg = experiment.ListExperimentsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_experiments_use_cached_wrapped_rpc(): @@ -1424,9 +1441,14 @@ async def test_list_experiments_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_experiments_async( - transport: str = "grpc_asyncio", request_type=experiment.ListExperimentsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + experiment.ListExperimentsRequest(), + {}, + ], +) +async def test_list_experiments_async(request_type, transport: str = "grpc_asyncio"): client = ExperimentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1434,7 +1456,7 @@ async def test_list_experiments_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_experiments), "__call__") as call: @@ -1457,11 +1479,6 @@ async def test_list_experiments_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_experiments_async_from_dict(): - await test_list_experiments_async(request_type=dict) - - def test_list_experiments_field_headers(): client = ExperimentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1798,8 +1815,8 @@ async def test_list_experiments_async_pages(): @pytest.mark.parametrize( "request_type", [ - experiment.GetExperimentRequest, - dict, + experiment.GetExperimentRequest(), + {}, ], ) def test_get_experiment(request_type, transport: str = "grpc"): @@ -1810,7 +1827,7 @@ def test_get_experiment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_experiment), "__call__") as call: @@ -1862,9 +1879,10 @@ def test_get_experiment_non_empty_request_with_auto_populated_field(): client.get_experiment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == experiment.GetExperimentRequest( + request_msg = experiment.GetExperimentRequest( name="name_value", ) + assert args[0] == request_msg def test_get_experiment_use_cached_wrapped_rpc(): @@ -1945,9 +1963,14 @@ async def test_get_experiment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_experiment_async( - transport: str = "grpc_asyncio", request_type=experiment.GetExperimentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + experiment.GetExperimentRequest(), + {}, + ], +) +async def test_get_experiment_async(request_type, transport: str = "grpc_asyncio"): client = ExperimentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1955,7 +1978,7 @@ async def test_get_experiment_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_experiment), "__call__") as call: @@ -1986,11 +2009,6 @@ async def test_get_experiment_async( assert response.rollout_failure_reason == "rollout_failure_reason_value" -@pytest.mark.asyncio -async def test_get_experiment_async_from_dict(): - await test_get_experiment_async(request_type=dict) - - def test_get_experiment_field_headers(): client = ExperimentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2137,8 +2155,8 @@ async def test_get_experiment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcdc_experiment.CreateExperimentRequest, - dict, + gcdc_experiment.CreateExperimentRequest(), + {}, ], ) def test_create_experiment(request_type, transport: str = "grpc"): @@ -2149,7 +2167,7 @@ def test_create_experiment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2205,9 +2223,10 @@ def test_create_experiment_non_empty_request_with_auto_populated_field(): client.create_experiment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcdc_experiment.CreateExperimentRequest( + request_msg = gcdc_experiment.CreateExperimentRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_experiment_use_cached_wrapped_rpc(): @@ -2290,10 +2309,14 @@ async def test_create_experiment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_experiment_async( - transport: str = "grpc_asyncio", - request_type=gcdc_experiment.CreateExperimentRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + gcdc_experiment.CreateExperimentRequest(), + {}, + ], +) +async def test_create_experiment_async(request_type, transport: str = "grpc_asyncio"): client = ExperimentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2301,7 +2324,7 @@ async def test_create_experiment_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( @@ -2334,11 +2357,6 @@ async def test_create_experiment_async( assert response.rollout_failure_reason == "rollout_failure_reason_value" -@pytest.mark.asyncio -async def test_create_experiment_async_from_dict(): - await test_create_experiment_async(request_type=dict) - - def test_create_experiment_field_headers(): client = ExperimentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2503,8 +2521,8 @@ async def test_create_experiment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcdc_experiment.UpdateExperimentRequest, - dict, + gcdc_experiment.UpdateExperimentRequest(), + {}, ], ) def test_update_experiment(request_type, transport: str = "grpc"): @@ -2515,7 +2533,7 @@ def test_update_experiment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2569,7 +2587,8 @@ def test_update_experiment_non_empty_request_with_auto_populated_field(): client.update_experiment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcdc_experiment.UpdateExperimentRequest() + request_msg = gcdc_experiment.UpdateExperimentRequest() + assert args[0] == request_msg def test_update_experiment_use_cached_wrapped_rpc(): @@ -2652,10 +2671,14 @@ async def test_update_experiment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_experiment_async( - transport: str = "grpc_asyncio", - request_type=gcdc_experiment.UpdateExperimentRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + gcdc_experiment.UpdateExperimentRequest(), + {}, + ], +) +async def test_update_experiment_async(request_type, transport: str = "grpc_asyncio"): client = ExperimentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2663,7 +2686,7 @@ async def test_update_experiment_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( @@ -2696,11 +2719,6 @@ async def test_update_experiment_async( assert response.rollout_failure_reason == "rollout_failure_reason_value" -@pytest.mark.asyncio -async def test_update_experiment_async_from_dict(): - await test_update_experiment_async(request_type=dict) - - def test_update_experiment_field_headers(): client = ExperimentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2865,8 +2883,8 @@ async def test_update_experiment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - experiment.DeleteExperimentRequest, - dict, + experiment.DeleteExperimentRequest(), + {}, ], ) def test_delete_experiment(request_type, transport: str = "grpc"): @@ -2877,7 +2895,7 @@ def test_delete_experiment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2922,9 +2940,10 @@ def test_delete_experiment_non_empty_request_with_auto_populated_field(): client.delete_experiment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == experiment.DeleteExperimentRequest( + request_msg = experiment.DeleteExperimentRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_experiment_use_cached_wrapped_rpc(): @@ -3007,9 +3026,14 @@ async def test_delete_experiment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_experiment_async( - transport: str = "grpc_asyncio", request_type=experiment.DeleteExperimentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + experiment.DeleteExperimentRequest(), + {}, + ], +) +async def test_delete_experiment_async(request_type, transport: str = "grpc_asyncio"): client = ExperimentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3017,7 +3041,7 @@ async def test_delete_experiment_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( @@ -3037,11 +3061,6 @@ async def test_delete_experiment_async( assert response is None -@pytest.mark.asyncio -async def test_delete_experiment_async_from_dict(): - await test_delete_experiment_async(request_type=dict) - - def test_delete_experiment_field_headers(): client = ExperimentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3192,8 +3211,8 @@ async def test_delete_experiment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - experiment.StartExperimentRequest, - dict, + experiment.StartExperimentRequest(), + {}, ], ) def test_start_experiment(request_type, transport: str = "grpc"): @@ -3204,7 +3223,7 @@ def test_start_experiment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.start_experiment), "__call__") as call: @@ -3256,9 +3275,10 @@ def test_start_experiment_non_empty_request_with_auto_populated_field(): client.start_experiment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == experiment.StartExperimentRequest( + request_msg = experiment.StartExperimentRequest( name="name_value", ) + assert args[0] == request_msg def test_start_experiment_use_cached_wrapped_rpc(): @@ -3341,9 +3361,14 @@ async def test_start_experiment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_start_experiment_async( - transport: str = "grpc_asyncio", request_type=experiment.StartExperimentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + experiment.StartExperimentRequest(), + {}, + ], +) +async def test_start_experiment_async(request_type, transport: str = "grpc_asyncio"): client = ExperimentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3351,7 +3376,7 @@ async def test_start_experiment_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.start_experiment), "__call__") as call: @@ -3382,11 +3407,6 @@ async def test_start_experiment_async( assert response.rollout_failure_reason == "rollout_failure_reason_value" -@pytest.mark.asyncio -async def test_start_experiment_async_from_dict(): - await test_start_experiment_async(request_type=dict) - - def test_start_experiment_field_headers(): client = ExperimentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3533,8 +3553,8 @@ async def test_start_experiment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - experiment.StopExperimentRequest, - dict, + experiment.StopExperimentRequest(), + {}, ], ) def test_stop_experiment(request_type, transport: str = "grpc"): @@ -3545,7 +3565,7 @@ def test_stop_experiment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.stop_experiment), "__call__") as call: @@ -3597,9 +3617,10 @@ def test_stop_experiment_non_empty_request_with_auto_populated_field(): client.stop_experiment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == experiment.StopExperimentRequest( + request_msg = experiment.StopExperimentRequest( name="name_value", ) + assert args[0] == request_msg def test_stop_experiment_use_cached_wrapped_rpc(): @@ -3680,9 +3701,14 @@ async def test_stop_experiment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_stop_experiment_async( - transport: str = "grpc_asyncio", request_type=experiment.StopExperimentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + experiment.StopExperimentRequest(), + {}, + ], +) +async def test_stop_experiment_async(request_type, transport: str = "grpc_asyncio"): client = ExperimentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3690,7 +3716,7 @@ async def test_stop_experiment_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.stop_experiment), "__call__") as call: @@ -3721,11 +3747,6 @@ async def test_stop_experiment_async( assert response.rollout_failure_reason == "rollout_failure_reason_value" -@pytest.mark.asyncio -async def test_stop_experiment_async_from_dict(): - await test_stop_experiment_async(request_type=dict) - - def test_stop_experiment_field_headers(): client = ExperimentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5360,7 +5381,6 @@ def test_list_experiments_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = experiment.ListExperimentsRequest() - assert args[0] == request_msg @@ -5381,7 +5401,6 @@ def test_get_experiment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = experiment.GetExperimentRequest() - assert args[0] == request_msg @@ -5404,7 +5423,6 @@ def test_create_experiment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_experiment.CreateExperimentRequest() - assert args[0] == request_msg @@ -5427,7 +5445,6 @@ def test_update_experiment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_experiment.UpdateExperimentRequest() - assert args[0] == request_msg @@ -5450,7 +5467,6 @@ def test_delete_experiment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = experiment.DeleteExperimentRequest() - assert args[0] == request_msg @@ -5471,7 +5487,6 @@ def test_start_experiment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = experiment.StartExperimentRequest() - assert args[0] == request_msg @@ -5492,7 +5507,6 @@ def test_stop_experiment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = experiment.StopExperimentRequest() - assert args[0] == request_msg @@ -5533,7 +5547,6 @@ async def test_list_experiments_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = experiment.ListExperimentsRequest() - assert args[0] == request_msg @@ -5564,7 +5577,6 @@ async def test_get_experiment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = experiment.GetExperimentRequest() - assert args[0] == request_msg @@ -5597,7 +5609,6 @@ async def test_create_experiment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_experiment.CreateExperimentRequest() - assert args[0] == request_msg @@ -5630,7 +5641,6 @@ async def test_update_experiment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_experiment.UpdateExperimentRequest() - assert args[0] == request_msg @@ -5655,7 +5665,6 @@ async def test_delete_experiment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = experiment.DeleteExperimentRequest() - assert args[0] == request_msg @@ -5686,7 +5695,6 @@ async def test_start_experiment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = experiment.StartExperimentRequest() - assert args[0] == request_msg @@ -5717,7 +5725,6 @@ async def test_stop_experiment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = experiment.StopExperimentRequest() - assert args[0] == request_msg @@ -7286,7 +7293,6 @@ def test_list_experiments_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = experiment.ListExperimentsRequest() - assert args[0] == request_msg @@ -7306,7 +7312,6 @@ def test_get_experiment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = experiment.GetExperimentRequest() - assert args[0] == request_msg @@ -7328,7 +7333,6 @@ def test_create_experiment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_experiment.CreateExperimentRequest() - assert args[0] == request_msg @@ -7350,7 +7354,6 @@ def test_update_experiment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_experiment.UpdateExperimentRequest() - assert args[0] == request_msg @@ -7372,7 +7375,6 @@ def test_delete_experiment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = experiment.DeleteExperimentRequest() - assert args[0] == request_msg @@ -7392,7 +7394,6 @@ def test_start_experiment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = experiment.StartExperimentRequest() - assert args[0] == request_msg @@ -7412,7 +7413,6 @@ def test_stop_experiment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = experiment.StopExperimentRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_flows.py b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_flows.py index 3be37bb50cc3..01ac04da7cd0 100644 --- a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_flows.py +++ b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_flows.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 @@ -131,6 +132,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" @@ -1262,8 +1278,8 @@ def test_flows_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - gcdc_flow.CreateFlowRequest, - dict, + gcdc_flow.CreateFlowRequest(), + {}, ], ) def test_create_flow(request_type, transport: str = "grpc"): @@ -1274,7 +1290,7 @@ def test_create_flow(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_flow), "__call__") as call: @@ -1327,10 +1343,11 @@ def test_create_flow_non_empty_request_with_auto_populated_field(): client.create_flow(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcdc_flow.CreateFlowRequest( + request_msg = gcdc_flow.CreateFlowRequest( parent="parent_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_create_flow_use_cached_wrapped_rpc(): @@ -1411,9 +1428,14 @@ async def test_create_flow_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_flow_async( - transport: str = "grpc_asyncio", request_type=gcdc_flow.CreateFlowRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcdc_flow.CreateFlowRequest(), + {}, + ], +) +async def test_create_flow_async(request_type, transport: str = "grpc_asyncio"): client = FlowsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1421,7 +1443,7 @@ async def test_create_flow_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_flow), "__call__") as call: @@ -1452,11 +1474,6 @@ async def test_create_flow_async( assert response.locked is True -@pytest.mark.asyncio -async def test_create_flow_async_from_dict(): - await test_create_flow_async(request_type=dict) - - def test_create_flow_field_headers(): client = FlowsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1609,8 +1626,8 @@ async def test_create_flow_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - flow.DeleteFlowRequest, - dict, + flow.DeleteFlowRequest(), + {}, ], ) def test_delete_flow(request_type, transport: str = "grpc"): @@ -1621,7 +1638,7 @@ def test_delete_flow(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_flow), "__call__") as call: @@ -1662,9 +1679,10 @@ def test_delete_flow_non_empty_request_with_auto_populated_field(): client.delete_flow(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == flow.DeleteFlowRequest( + request_msg = flow.DeleteFlowRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_flow_use_cached_wrapped_rpc(): @@ -1745,9 +1763,14 @@ async def test_delete_flow_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_flow_async( - transport: str = "grpc_asyncio", request_type=flow.DeleteFlowRequest -): +@pytest.mark.parametrize( + "request_type", + [ + flow.DeleteFlowRequest(), + {}, + ], +) +async def test_delete_flow_async(request_type, transport: str = "grpc_asyncio"): client = FlowsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1755,7 +1778,7 @@ async def test_delete_flow_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_flow), "__call__") as call: @@ -1773,11 +1796,6 @@ async def test_delete_flow_async( assert response is None -@pytest.mark.asyncio -async def test_delete_flow_async_from_dict(): - await test_delete_flow_async(request_type=dict) - - def test_delete_flow_field_headers(): client = FlowsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1920,8 +1938,8 @@ async def test_delete_flow_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - flow.ListFlowsRequest, - dict, + flow.ListFlowsRequest(), + {}, ], ) def test_list_flows(request_type, transport: str = "grpc"): @@ -1932,7 +1950,7 @@ def test_list_flows(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_flows), "__call__") as call: @@ -1978,11 +1996,12 @@ def test_list_flows_non_empty_request_with_auto_populated_field(): client.list_flows(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == flow.ListFlowsRequest( + request_msg = flow.ListFlowsRequest( parent="parent_value", page_token="page_token_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_list_flows_use_cached_wrapped_rpc(): @@ -2061,9 +2080,14 @@ async def test_list_flows_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_list_flows_async( - transport: str = "grpc_asyncio", request_type=flow.ListFlowsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + flow.ListFlowsRequest(), + {}, + ], +) +async def test_list_flows_async(request_type, transport: str = "grpc_asyncio"): client = FlowsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2071,7 +2095,7 @@ async def test_list_flows_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_flows), "__call__") as call: @@ -2094,11 +2118,6 @@ async def test_list_flows_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_flows_async_from_dict(): - await test_list_flows_async(request_type=dict) - - def test_list_flows_field_headers(): client = FlowsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2435,8 +2454,8 @@ async def test_list_flows_async_pages(): @pytest.mark.parametrize( "request_type", [ - flow.GetFlowRequest, - dict, + flow.GetFlowRequest(), + {}, ], ) def test_get_flow(request_type, transport: str = "grpc"): @@ -2447,7 +2466,7 @@ def test_get_flow(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_flow), "__call__") as call: @@ -2500,10 +2519,11 @@ def test_get_flow_non_empty_request_with_auto_populated_field(): client.get_flow(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == flow.GetFlowRequest( + request_msg = flow.GetFlowRequest( name="name_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_get_flow_use_cached_wrapped_rpc(): @@ -2582,9 +2602,14 @@ async def test_get_flow_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn @pytest.mark.asyncio -async def test_get_flow_async( - transport: str = "grpc_asyncio", request_type=flow.GetFlowRequest -): +@pytest.mark.parametrize( + "request_type", + [ + flow.GetFlowRequest(), + {}, + ], +) +async def test_get_flow_async(request_type, transport: str = "grpc_asyncio"): client = FlowsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2592,7 +2617,7 @@ async def test_get_flow_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_flow), "__call__") as call: @@ -2623,11 +2648,6 @@ async def test_get_flow_async( assert response.locked is True -@pytest.mark.asyncio -async def test_get_flow_async_from_dict(): - await test_get_flow_async(request_type=dict) - - def test_get_flow_field_headers(): client = FlowsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2770,8 +2790,8 @@ async def test_get_flow_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcdc_flow.UpdateFlowRequest, - dict, + gcdc_flow.UpdateFlowRequest(), + {}, ], ) def test_update_flow(request_type, transport: str = "grpc"): @@ -2782,7 +2802,7 @@ def test_update_flow(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_flow), "__call__") as call: @@ -2834,9 +2854,10 @@ def test_update_flow_non_empty_request_with_auto_populated_field(): client.update_flow(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcdc_flow.UpdateFlowRequest( + request_msg = gcdc_flow.UpdateFlowRequest( language_code="language_code_value", ) + assert args[0] == request_msg def test_update_flow_use_cached_wrapped_rpc(): @@ -2917,9 +2938,14 @@ async def test_update_flow_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_flow_async( - transport: str = "grpc_asyncio", request_type=gcdc_flow.UpdateFlowRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcdc_flow.UpdateFlowRequest(), + {}, + ], +) +async def test_update_flow_async(request_type, transport: str = "grpc_asyncio"): client = FlowsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2927,7 +2953,7 @@ async def test_update_flow_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_flow), "__call__") as call: @@ -2958,11 +2984,6 @@ async def test_update_flow_async( assert response.locked is True -@pytest.mark.asyncio -async def test_update_flow_async_from_dict(): - await test_update_flow_async(request_type=dict) - - def test_update_flow_field_headers(): client = FlowsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3115,8 +3136,8 @@ async def test_update_flow_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - flow.TrainFlowRequest, - dict, + flow.TrainFlowRequest(), + {}, ], ) def test_train_flow(request_type, transport: str = "grpc"): @@ -3127,7 +3148,7 @@ def test_train_flow(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.train_flow), "__call__") as call: @@ -3168,9 +3189,10 @@ def test_train_flow_non_empty_request_with_auto_populated_field(): client.train_flow(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == flow.TrainFlowRequest( + request_msg = flow.TrainFlowRequest( name="name_value", ) + assert args[0] == request_msg def test_train_flow_use_cached_wrapped_rpc(): @@ -3259,9 +3281,14 @@ async def test_train_flow_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_train_flow_async( - transport: str = "grpc_asyncio", request_type=flow.TrainFlowRequest -): +@pytest.mark.parametrize( + "request_type", + [ + flow.TrainFlowRequest(), + {}, + ], +) +async def test_train_flow_async(request_type, transport: str = "grpc_asyncio"): client = FlowsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3269,7 +3296,7 @@ async def test_train_flow_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.train_flow), "__call__") as call: @@ -3289,11 +3316,6 @@ async def test_train_flow_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_train_flow_async_from_dict(): - await test_train_flow_async(request_type=dict) - - def test_train_flow_field_headers(): client = FlowsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3440,8 +3462,8 @@ async def test_train_flow_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - flow.ValidateFlowRequest, - dict, + flow.ValidateFlowRequest(), + {}, ], ) def test_validate_flow(request_type, transport: str = "grpc"): @@ -3452,7 +3474,7 @@ def test_validate_flow(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.validate_flow), "__call__") as call: @@ -3497,10 +3519,11 @@ def test_validate_flow_non_empty_request_with_auto_populated_field(): client.validate_flow(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == flow.ValidateFlowRequest( + request_msg = flow.ValidateFlowRequest( name="name_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_validate_flow_use_cached_wrapped_rpc(): @@ -3581,9 +3604,14 @@ async def test_validate_flow_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_validate_flow_async( - transport: str = "grpc_asyncio", request_type=flow.ValidateFlowRequest -): +@pytest.mark.parametrize( + "request_type", + [ + flow.ValidateFlowRequest(), + {}, + ], +) +async def test_validate_flow_async(request_type, transport: str = "grpc_asyncio"): client = FlowsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3591,7 +3619,7 @@ async def test_validate_flow_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.validate_flow), "__call__") as call: @@ -3614,11 +3642,6 @@ async def test_validate_flow_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_validate_flow_async_from_dict(): - await test_validate_flow_async(request_type=dict) - - def test_validate_flow_field_headers(): client = FlowsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3683,8 +3706,8 @@ async def test_validate_flow_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - flow.GetFlowValidationResultRequest, - dict, + flow.GetFlowValidationResultRequest(), + {}, ], ) def test_get_flow_validation_result(request_type, transport: str = "grpc"): @@ -3695,7 +3718,7 @@ def test_get_flow_validation_result(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3744,10 +3767,11 @@ def test_get_flow_validation_result_non_empty_request_with_auto_populated_field( client.get_flow_validation_result(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == flow.GetFlowValidationResultRequest( + request_msg = flow.GetFlowValidationResultRequest( name="name_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_get_flow_validation_result_use_cached_wrapped_rpc(): @@ -3833,8 +3857,15 @@ async def test_get_flow_validation_result_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + flow.GetFlowValidationResultRequest(), + {}, + ], +) async def test_get_flow_validation_result_async( - transport: str = "grpc_asyncio", request_type=flow.GetFlowValidationResultRequest + request_type, transport: str = "grpc_asyncio" ): client = FlowsAsyncClient( credentials=async_anonymous_credentials(), @@ -3843,7 +3874,7 @@ async def test_get_flow_validation_result_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( @@ -3868,11 +3899,6 @@ async def test_get_flow_validation_result_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_flow_validation_result_async_from_dict(): - await test_get_flow_validation_result_async(request_type=dict) - - def test_get_flow_validation_result_field_headers(): client = FlowsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4027,8 +4053,8 @@ async def test_get_flow_validation_result_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - flow.ImportFlowRequest, - dict, + flow.ImportFlowRequest(), + {}, ], ) def test_import_flow(request_type, transport: str = "grpc"): @@ -4039,7 +4065,7 @@ def test_import_flow(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.import_flow), "__call__") as call: @@ -4081,10 +4107,11 @@ def test_import_flow_non_empty_request_with_auto_populated_field(): client.import_flow(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == flow.ImportFlowRequest( + request_msg = flow.ImportFlowRequest( parent="parent_value", flow_uri="flow_uri_value", ) + assert args[0] == request_msg def test_import_flow_use_cached_wrapped_rpc(): @@ -4175,9 +4202,14 @@ async def test_import_flow_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_import_flow_async( - transport: str = "grpc_asyncio", request_type=flow.ImportFlowRequest -): +@pytest.mark.parametrize( + "request_type", + [ + flow.ImportFlowRequest(), + {}, + ], +) +async def test_import_flow_async(request_type, transport: str = "grpc_asyncio"): client = FlowsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4185,7 +4217,7 @@ async def test_import_flow_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.import_flow), "__call__") as call: @@ -4205,11 +4237,6 @@ async def test_import_flow_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_import_flow_async_from_dict(): - await test_import_flow_async(request_type=dict) - - def test_import_flow_field_headers(): client = FlowsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4274,8 +4301,8 @@ async def test_import_flow_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - flow.ExportFlowRequest, - dict, + flow.ExportFlowRequest(), + {}, ], ) def test_export_flow(request_type, transport: str = "grpc"): @@ -4286,7 +4313,7 @@ def test_export_flow(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.export_flow), "__call__") as call: @@ -4328,10 +4355,11 @@ def test_export_flow_non_empty_request_with_auto_populated_field(): client.export_flow(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == flow.ExportFlowRequest( + request_msg = flow.ExportFlowRequest( name="name_value", flow_uri="flow_uri_value", ) + assert args[0] == request_msg def test_export_flow_use_cached_wrapped_rpc(): @@ -4422,9 +4450,14 @@ async def test_export_flow_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_export_flow_async( - transport: str = "grpc_asyncio", request_type=flow.ExportFlowRequest -): +@pytest.mark.parametrize( + "request_type", + [ + flow.ExportFlowRequest(), + {}, + ], +) +async def test_export_flow_async(request_type, transport: str = "grpc_asyncio"): client = FlowsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4432,7 +4465,7 @@ async def test_export_flow_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.export_flow), "__call__") as call: @@ -4452,11 +4485,6 @@ async def test_export_flow_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_export_flow_async_from_dict(): - await test_export_flow_async(request_type=dict) - - def test_export_flow_field_headers(): client = FlowsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6356,7 +6384,6 @@ def test_create_flow_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_flow.CreateFlowRequest() - assert args[0] == request_msg @@ -6377,7 +6404,6 @@ def test_delete_flow_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = flow.DeleteFlowRequest() - assert args[0] == request_msg @@ -6398,7 +6424,6 @@ def test_list_flows_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = flow.ListFlowsRequest() - assert args[0] == request_msg @@ -6419,7 +6444,6 @@ def test_get_flow_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = flow.GetFlowRequest() - assert args[0] == request_msg @@ -6440,7 +6464,6 @@ def test_update_flow_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_flow.UpdateFlowRequest() - assert args[0] == request_msg @@ -6461,7 +6484,6 @@ def test_train_flow_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = flow.TrainFlowRequest() - assert args[0] == request_msg @@ -6482,7 +6504,6 @@ def test_validate_flow_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = flow.ValidateFlowRequest() - assert args[0] == request_msg @@ -6505,7 +6526,6 @@ def test_get_flow_validation_result_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = flow.GetFlowValidationResultRequest() - assert args[0] == request_msg @@ -6526,7 +6546,6 @@ def test_import_flow_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = flow.ImportFlowRequest() - assert args[0] == request_msg @@ -6547,7 +6566,6 @@ def test_export_flow_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = flow.ExportFlowRequest() - assert args[0] == request_msg @@ -6592,7 +6610,6 @@ async def test_create_flow_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_flow.CreateFlowRequest() - assert args[0] == request_msg @@ -6615,7 +6632,6 @@ async def test_delete_flow_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = flow.DeleteFlowRequest() - assert args[0] == request_msg @@ -6642,7 +6658,6 @@ async def test_list_flows_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = flow.ListFlowsRequest() - assert args[0] == request_msg @@ -6673,7 +6688,6 @@ async def test_get_flow_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = flow.GetFlowRequest() - assert args[0] == request_msg @@ -6704,7 +6718,6 @@ async def test_update_flow_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_flow.UpdateFlowRequest() - assert args[0] == request_msg @@ -6729,7 +6742,6 @@ async def test_train_flow_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = flow.TrainFlowRequest() - assert args[0] == request_msg @@ -6756,7 +6768,6 @@ async def test_validate_flow_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = flow.ValidateFlowRequest() - assert args[0] == request_msg @@ -6785,7 +6796,6 @@ async def test_get_flow_validation_result_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = flow.GetFlowValidationResultRequest() - assert args[0] == request_msg @@ -6810,7 +6820,6 @@ async def test_import_flow_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = flow.ImportFlowRequest() - assert args[0] == request_msg @@ -6835,7 +6844,6 @@ async def test_export_flow_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = flow.ExportFlowRequest() - assert args[0] == request_msg @@ -8888,7 +8896,6 @@ def test_create_flow_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_flow.CreateFlowRequest() - assert args[0] == request_msg @@ -8908,7 +8915,6 @@ def test_delete_flow_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = flow.DeleteFlowRequest() - assert args[0] == request_msg @@ -8928,7 +8934,6 @@ def test_list_flows_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = flow.ListFlowsRequest() - assert args[0] == request_msg @@ -8948,7 +8953,6 @@ def test_get_flow_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = flow.GetFlowRequest() - assert args[0] == request_msg @@ -8968,7 +8972,6 @@ def test_update_flow_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_flow.UpdateFlowRequest() - assert args[0] == request_msg @@ -8988,7 +8991,6 @@ def test_train_flow_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = flow.TrainFlowRequest() - assert args[0] == request_msg @@ -9008,7 +9010,6 @@ def test_validate_flow_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = flow.ValidateFlowRequest() - assert args[0] == request_msg @@ -9030,7 +9031,6 @@ def test_get_flow_validation_result_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = flow.GetFlowValidationResultRequest() - assert args[0] == request_msg @@ -9050,7 +9050,6 @@ def test_import_flow_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = flow.ImportFlowRequest() - assert args[0] == request_msg @@ -9070,7 +9069,6 @@ def test_export_flow_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = flow.ExportFlowRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_generators.py b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_generators.py index 4dd4a09f69b7..4f5f1ef3795a 100644 --- a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_generators.py +++ b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_generators.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" @@ -1275,8 +1291,8 @@ def test_generators_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - generator.ListGeneratorsRequest, - dict, + generator.ListGeneratorsRequest(), + {}, ], ) def test_list_generators(request_type, transport: str = "grpc"): @@ -1287,7 +1303,7 @@ def test_list_generators(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_generators), "__call__") as call: @@ -1333,11 +1349,12 @@ def test_list_generators_non_empty_request_with_auto_populated_field(): client.list_generators(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == generator.ListGeneratorsRequest( + request_msg = generator.ListGeneratorsRequest( parent="parent_value", language_code="language_code_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_generators_use_cached_wrapped_rpc(): @@ -1418,9 +1435,14 @@ async def test_list_generators_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_generators_async( - transport: str = "grpc_asyncio", request_type=generator.ListGeneratorsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + generator.ListGeneratorsRequest(), + {}, + ], +) +async def test_list_generators_async(request_type, transport: str = "grpc_asyncio"): client = GeneratorsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1428,7 +1450,7 @@ async def test_list_generators_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_generators), "__call__") as call: @@ -1451,11 +1473,6 @@ async def test_list_generators_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_generators_async_from_dict(): - await test_list_generators_async(request_type=dict) - - def test_list_generators_field_headers(): client = GeneratorsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1792,8 +1809,8 @@ async def test_list_generators_async_pages(): @pytest.mark.parametrize( "request_type", [ - generator.GetGeneratorRequest, - dict, + generator.GetGeneratorRequest(), + {}, ], ) def test_get_generator(request_type, transport: str = "grpc"): @@ -1804,7 +1821,7 @@ def test_get_generator(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_generator), "__call__") as call: @@ -1851,10 +1868,11 @@ def test_get_generator_non_empty_request_with_auto_populated_field(): client.get_generator(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == generator.GetGeneratorRequest( + request_msg = generator.GetGeneratorRequest( name="name_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_get_generator_use_cached_wrapped_rpc(): @@ -1935,9 +1953,14 @@ async def test_get_generator_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_generator_async( - transport: str = "grpc_asyncio", request_type=generator.GetGeneratorRequest -): +@pytest.mark.parametrize( + "request_type", + [ + generator.GetGeneratorRequest(), + {}, + ], +) +async def test_get_generator_async(request_type, transport: str = "grpc_asyncio"): client = GeneratorsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1945,7 +1968,7 @@ async def test_get_generator_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_generator), "__call__") as call: @@ -1970,11 +1993,6 @@ async def test_get_generator_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_get_generator_async_from_dict(): - await test_get_generator_async(request_type=dict) - - def test_get_generator_field_headers(): client = GeneratorsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2117,8 +2135,8 @@ async def test_get_generator_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcdc_generator.CreateGeneratorRequest, - dict, + gcdc_generator.CreateGeneratorRequest(), + {}, ], ) def test_create_generator(request_type, transport: str = "grpc"): @@ -2129,7 +2147,7 @@ def test_create_generator(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_generator), "__call__") as call: @@ -2176,10 +2194,11 @@ def test_create_generator_non_empty_request_with_auto_populated_field(): client.create_generator(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcdc_generator.CreateGeneratorRequest( + request_msg = gcdc_generator.CreateGeneratorRequest( parent="parent_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_create_generator_use_cached_wrapped_rpc(): @@ -2262,9 +2281,14 @@ async def test_create_generator_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_generator_async( - transport: str = "grpc_asyncio", request_type=gcdc_generator.CreateGeneratorRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcdc_generator.CreateGeneratorRequest(), + {}, + ], +) +async def test_create_generator_async(request_type, transport: str = "grpc_asyncio"): client = GeneratorsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2272,7 +2296,7 @@ async def test_create_generator_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_generator), "__call__") as call: @@ -2297,11 +2321,6 @@ async def test_create_generator_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_create_generator_async_from_dict(): - await test_create_generator_async(request_type=dict) - - def test_create_generator_field_headers(): client = GeneratorsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2458,8 +2477,8 @@ async def test_create_generator_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcdc_generator.UpdateGeneratorRequest, - dict, + gcdc_generator.UpdateGeneratorRequest(), + {}, ], ) def test_update_generator(request_type, transport: str = "grpc"): @@ -2470,7 +2489,7 @@ def test_update_generator(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_generator), "__call__") as call: @@ -2516,9 +2535,10 @@ def test_update_generator_non_empty_request_with_auto_populated_field(): client.update_generator(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcdc_generator.UpdateGeneratorRequest( + request_msg = gcdc_generator.UpdateGeneratorRequest( language_code="language_code_value", ) + assert args[0] == request_msg def test_update_generator_use_cached_wrapped_rpc(): @@ -2601,9 +2621,14 @@ async def test_update_generator_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_generator_async( - transport: str = "grpc_asyncio", request_type=gcdc_generator.UpdateGeneratorRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcdc_generator.UpdateGeneratorRequest(), + {}, + ], +) +async def test_update_generator_async(request_type, transport: str = "grpc_asyncio"): client = GeneratorsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2611,7 +2636,7 @@ async def test_update_generator_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_generator), "__call__") as call: @@ -2636,11 +2661,6 @@ async def test_update_generator_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_update_generator_async_from_dict(): - await test_update_generator_async(request_type=dict) - - def test_update_generator_field_headers(): client = GeneratorsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2797,8 +2817,8 @@ async def test_update_generator_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - generator.DeleteGeneratorRequest, - dict, + generator.DeleteGeneratorRequest(), + {}, ], ) def test_delete_generator(request_type, transport: str = "grpc"): @@ -2809,7 +2829,7 @@ def test_delete_generator(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_generator), "__call__") as call: @@ -2850,9 +2870,10 @@ def test_delete_generator_non_empty_request_with_auto_populated_field(): client.delete_generator(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == generator.DeleteGeneratorRequest( + request_msg = generator.DeleteGeneratorRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_generator_use_cached_wrapped_rpc(): @@ -2935,9 +2956,14 @@ async def test_delete_generator_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_generator_async( - transport: str = "grpc_asyncio", request_type=generator.DeleteGeneratorRequest -): +@pytest.mark.parametrize( + "request_type", + [ + generator.DeleteGeneratorRequest(), + {}, + ], +) +async def test_delete_generator_async(request_type, transport: str = "grpc_asyncio"): client = GeneratorsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2945,7 +2971,7 @@ async def test_delete_generator_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_generator), "__call__") as call: @@ -2963,11 +2989,6 @@ async def test_delete_generator_async( assert response is None -@pytest.mark.asyncio -async def test_delete_generator_async_from_dict(): - await test_delete_generator_async(request_type=dict) - - def test_delete_generator_field_headers(): client = GeneratorsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4235,7 +4256,6 @@ def test_list_generators_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generator.ListGeneratorsRequest() - assert args[0] == request_msg @@ -4256,7 +4276,6 @@ def test_get_generator_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generator.GetGeneratorRequest() - assert args[0] == request_msg @@ -4277,7 +4296,6 @@ def test_create_generator_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_generator.CreateGeneratorRequest() - assert args[0] == request_msg @@ -4298,7 +4316,6 @@ def test_update_generator_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_generator.UpdateGeneratorRequest() - assert args[0] == request_msg @@ -4319,7 +4336,6 @@ def test_delete_generator_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generator.DeleteGeneratorRequest() - assert args[0] == request_msg @@ -4360,7 +4376,6 @@ async def test_list_generators_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generator.ListGeneratorsRequest() - assert args[0] == request_msg @@ -4388,7 +4403,6 @@ async def test_get_generator_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generator.GetGeneratorRequest() - assert args[0] == request_msg @@ -4416,7 +4430,6 @@ async def test_create_generator_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_generator.CreateGeneratorRequest() - assert args[0] == request_msg @@ -4444,7 +4457,6 @@ async def test_update_generator_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_generator.UpdateGeneratorRequest() - assert args[0] == request_msg @@ -4467,7 +4479,6 @@ async def test_delete_generator_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generator.DeleteGeneratorRequest() - assert args[0] == request_msg @@ -5624,7 +5635,6 @@ def test_list_generators_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generator.ListGeneratorsRequest() - assert args[0] == request_msg @@ -5644,7 +5654,6 @@ def test_get_generator_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generator.GetGeneratorRequest() - assert args[0] == request_msg @@ -5664,7 +5673,6 @@ def test_create_generator_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_generator.CreateGeneratorRequest() - assert args[0] == request_msg @@ -5684,7 +5692,6 @@ def test_update_generator_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_generator.UpdateGeneratorRequest() - assert args[0] == request_msg @@ -5704,7 +5711,6 @@ def test_delete_generator_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generator.DeleteGeneratorRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_intents.py b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_intents.py index 1760607e3f97..5250d6d4a28a 100644 --- a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_intents.py +++ b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_intents.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 @@ -115,6 +116,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" @@ -1251,8 +1267,8 @@ def test_intents_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - intent.ListIntentsRequest, - dict, + intent.ListIntentsRequest(), + {}, ], ) def test_list_intents(request_type, transport: str = "grpc"): @@ -1263,7 +1279,7 @@ def test_list_intents(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_intents), "__call__") as call: @@ -1309,11 +1325,12 @@ def test_list_intents_non_empty_request_with_auto_populated_field(): client.list_intents(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == intent.ListIntentsRequest( + request_msg = intent.ListIntentsRequest( parent="parent_value", language_code="language_code_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_intents_use_cached_wrapped_rpc(): @@ -1394,9 +1411,14 @@ async def test_list_intents_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_intents_async( - transport: str = "grpc_asyncio", request_type=intent.ListIntentsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + intent.ListIntentsRequest(), + {}, + ], +) +async def test_list_intents_async(request_type, transport: str = "grpc_asyncio"): client = IntentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1404,7 +1426,7 @@ async def test_list_intents_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_intents), "__call__") as call: @@ -1427,11 +1449,6 @@ async def test_list_intents_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_intents_async_from_dict(): - await test_list_intents_async(request_type=dict) - - def test_list_intents_field_headers(): client = IntentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1768,8 +1785,8 @@ async def test_list_intents_async_pages(): @pytest.mark.parametrize( "request_type", [ - intent.GetIntentRequest, - dict, + intent.GetIntentRequest(), + {}, ], ) def test_get_intent(request_type, transport: str = "grpc"): @@ -1780,7 +1797,7 @@ def test_get_intent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_intent), "__call__") as call: @@ -1835,10 +1852,11 @@ def test_get_intent_non_empty_request_with_auto_populated_field(): client.get_intent(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == intent.GetIntentRequest( + request_msg = intent.GetIntentRequest( name="name_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_get_intent_use_cached_wrapped_rpc(): @@ -1917,9 +1935,14 @@ async def test_get_intent_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_intent_async( - transport: str = "grpc_asyncio", request_type=intent.GetIntentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + intent.GetIntentRequest(), + {}, + ], +) +async def test_get_intent_async(request_type, transport: str = "grpc_asyncio"): client = IntentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1927,7 +1950,7 @@ async def test_get_intent_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_intent), "__call__") as call: @@ -1960,11 +1983,6 @@ async def test_get_intent_async( assert response.dtmf_pattern == "dtmf_pattern_value" -@pytest.mark.asyncio -async def test_get_intent_async_from_dict(): - await test_get_intent_async(request_type=dict) - - def test_get_intent_field_headers(): client = IntentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2107,8 +2125,8 @@ async def test_get_intent_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcdc_intent.CreateIntentRequest, - dict, + gcdc_intent.CreateIntentRequest(), + {}, ], ) def test_create_intent(request_type, transport: str = "grpc"): @@ -2119,7 +2137,7 @@ def test_create_intent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_intent), "__call__") as call: @@ -2174,10 +2192,11 @@ def test_create_intent_non_empty_request_with_auto_populated_field(): client.create_intent(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcdc_intent.CreateIntentRequest( + request_msg = gcdc_intent.CreateIntentRequest( parent="parent_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_create_intent_use_cached_wrapped_rpc(): @@ -2258,9 +2277,14 @@ async def test_create_intent_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_intent_async( - transport: str = "grpc_asyncio", request_type=gcdc_intent.CreateIntentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcdc_intent.CreateIntentRequest(), + {}, + ], +) +async def test_create_intent_async(request_type, transport: str = "grpc_asyncio"): client = IntentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2268,7 +2292,7 @@ async def test_create_intent_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_intent), "__call__") as call: @@ -2301,11 +2325,6 @@ async def test_create_intent_async( assert response.dtmf_pattern == "dtmf_pattern_value" -@pytest.mark.asyncio -async def test_create_intent_async_from_dict(): - await test_create_intent_async(request_type=dict) - - def test_create_intent_field_headers(): client = IntentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2458,8 +2477,8 @@ async def test_create_intent_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcdc_intent.UpdateIntentRequest, - dict, + gcdc_intent.UpdateIntentRequest(), + {}, ], ) def test_update_intent(request_type, transport: str = "grpc"): @@ -2470,7 +2489,7 @@ def test_update_intent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_intent), "__call__") as call: @@ -2524,9 +2543,10 @@ def test_update_intent_non_empty_request_with_auto_populated_field(): client.update_intent(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcdc_intent.UpdateIntentRequest( + request_msg = gcdc_intent.UpdateIntentRequest( language_code="language_code_value", ) + assert args[0] == request_msg def test_update_intent_use_cached_wrapped_rpc(): @@ -2607,9 +2627,14 @@ async def test_update_intent_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_intent_async( - transport: str = "grpc_asyncio", request_type=gcdc_intent.UpdateIntentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcdc_intent.UpdateIntentRequest(), + {}, + ], +) +async def test_update_intent_async(request_type, transport: str = "grpc_asyncio"): client = IntentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2617,7 +2642,7 @@ async def test_update_intent_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_intent), "__call__") as call: @@ -2650,11 +2675,6 @@ async def test_update_intent_async( assert response.dtmf_pattern == "dtmf_pattern_value" -@pytest.mark.asyncio -async def test_update_intent_async_from_dict(): - await test_update_intent_async(request_type=dict) - - def test_update_intent_field_headers(): client = IntentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2807,8 +2827,8 @@ async def test_update_intent_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - intent.DeleteIntentRequest, - dict, + intent.DeleteIntentRequest(), + {}, ], ) def test_delete_intent(request_type, transport: str = "grpc"): @@ -2819,7 +2839,7 @@ def test_delete_intent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_intent), "__call__") as call: @@ -2860,9 +2880,10 @@ def test_delete_intent_non_empty_request_with_auto_populated_field(): client.delete_intent(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == intent.DeleteIntentRequest( + request_msg = intent.DeleteIntentRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_intent_use_cached_wrapped_rpc(): @@ -2943,9 +2964,14 @@ async def test_delete_intent_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_intent_async( - transport: str = "grpc_asyncio", request_type=intent.DeleteIntentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + intent.DeleteIntentRequest(), + {}, + ], +) +async def test_delete_intent_async(request_type, transport: str = "grpc_asyncio"): client = IntentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2953,7 +2979,7 @@ async def test_delete_intent_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_intent), "__call__") as call: @@ -2971,11 +2997,6 @@ async def test_delete_intent_async( assert response is None -@pytest.mark.asyncio -async def test_delete_intent_async_from_dict(): - await test_delete_intent_async(request_type=dict) - - def test_delete_intent_field_headers(): client = IntentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3118,8 +3139,8 @@ async def test_delete_intent_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - intent.ImportIntentsRequest, - dict, + intent.ImportIntentsRequest(), + {}, ], ) def test_import_intents(request_type, transport: str = "grpc"): @@ -3130,7 +3151,7 @@ def test_import_intents(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.import_intents), "__call__") as call: @@ -3172,10 +3193,11 @@ def test_import_intents_non_empty_request_with_auto_populated_field(): client.import_intents(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == intent.ImportIntentsRequest( + request_msg = intent.ImportIntentsRequest( parent="parent_value", intents_uri="intents_uri_value", ) + assert args[0] == request_msg def test_import_intents_use_cached_wrapped_rpc(): @@ -3266,9 +3288,14 @@ async def test_import_intents_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_import_intents_async( - transport: str = "grpc_asyncio", request_type=intent.ImportIntentsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + intent.ImportIntentsRequest(), + {}, + ], +) +async def test_import_intents_async(request_type, transport: str = "grpc_asyncio"): client = IntentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3276,7 +3303,7 @@ async def test_import_intents_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.import_intents), "__call__") as call: @@ -3296,11 +3323,6 @@ async def test_import_intents_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_import_intents_async_from_dict(): - await test_import_intents_async(request_type=dict) - - def test_import_intents_field_headers(): client = IntentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3365,8 +3387,8 @@ async def test_import_intents_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - intent.ExportIntentsRequest, - dict, + intent.ExportIntentsRequest(), + {}, ], ) def test_export_intents(request_type, transport: str = "grpc"): @@ -3377,7 +3399,7 @@ def test_export_intents(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.export_intents), "__call__") as call: @@ -3419,10 +3441,11 @@ def test_export_intents_non_empty_request_with_auto_populated_field(): client.export_intents(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == intent.ExportIntentsRequest( + request_msg = intent.ExportIntentsRequest( parent="parent_value", intents_uri="intents_uri_value", ) + assert args[0] == request_msg def test_export_intents_use_cached_wrapped_rpc(): @@ -3513,9 +3536,14 @@ async def test_export_intents_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_export_intents_async( - transport: str = "grpc_asyncio", request_type=intent.ExportIntentsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + intent.ExportIntentsRequest(), + {}, + ], +) +async def test_export_intents_async(request_type, transport: str = "grpc_asyncio"): client = IntentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3523,7 +3551,7 @@ async def test_export_intents_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.export_intents), "__call__") as call: @@ -3543,11 +3571,6 @@ async def test_export_intents_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_export_intents_async_from_dict(): - await test_export_intents_async(request_type=dict) - - def test_export_intents_field_headers(): client = IntentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4979,7 +5002,6 @@ def test_list_intents_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intent.ListIntentsRequest() - assert args[0] == request_msg @@ -5000,7 +5022,6 @@ def test_get_intent_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intent.GetIntentRequest() - assert args[0] == request_msg @@ -5021,7 +5042,6 @@ def test_create_intent_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_intent.CreateIntentRequest() - assert args[0] == request_msg @@ -5042,7 +5062,6 @@ def test_update_intent_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_intent.UpdateIntentRequest() - assert args[0] == request_msg @@ -5063,7 +5082,6 @@ def test_delete_intent_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intent.DeleteIntentRequest() - assert args[0] == request_msg @@ -5084,7 +5102,6 @@ def test_import_intents_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intent.ImportIntentsRequest() - assert args[0] == request_msg @@ -5105,7 +5122,6 @@ def test_export_intents_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intent.ExportIntentsRequest() - assert args[0] == request_msg @@ -5146,7 +5162,6 @@ async def test_list_intents_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intent.ListIntentsRequest() - assert args[0] == request_msg @@ -5178,7 +5193,6 @@ async def test_get_intent_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intent.GetIntentRequest() - assert args[0] == request_msg @@ -5210,7 +5224,6 @@ async def test_create_intent_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_intent.CreateIntentRequest() - assert args[0] == request_msg @@ -5242,7 +5255,6 @@ async def test_update_intent_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_intent.UpdateIntentRequest() - assert args[0] == request_msg @@ -5265,7 +5277,6 @@ async def test_delete_intent_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intent.DeleteIntentRequest() - assert args[0] == request_msg @@ -5290,7 +5301,6 @@ async def test_import_intents_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intent.ImportIntentsRequest() - assert args[0] == request_msg @@ -5315,7 +5325,6 @@ async def test_export_intents_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intent.ExportIntentsRequest() - assert args[0] == request_msg @@ -6722,7 +6731,6 @@ def test_list_intents_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intent.ListIntentsRequest() - assert args[0] == request_msg @@ -6742,7 +6750,6 @@ def test_get_intent_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intent.GetIntentRequest() - assert args[0] == request_msg @@ -6762,7 +6769,6 @@ def test_create_intent_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_intent.CreateIntentRequest() - assert args[0] == request_msg @@ -6782,7 +6788,6 @@ def test_update_intent_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_intent.UpdateIntentRequest() - assert args[0] == request_msg @@ -6802,7 +6807,6 @@ def test_delete_intent_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intent.DeleteIntentRequest() - assert args[0] == request_msg @@ -6822,7 +6826,6 @@ def test_import_intents_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intent.ImportIntentsRequest() - assert args[0] == request_msg @@ -6842,7 +6845,6 @@ def test_export_intents_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intent.ExportIntentsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_pages.py b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_pages.py index cc6a632406b1..51594d014308 100644 --- a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_pages.py +++ b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_pages.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 @@ -121,6 +122,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" @@ -1252,8 +1268,8 @@ def test_pages_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - page.ListPagesRequest, - dict, + page.ListPagesRequest(), + {}, ], ) def test_list_pages(request_type, transport: str = "grpc"): @@ -1264,7 +1280,7 @@ def test_list_pages(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_pages), "__call__") as call: @@ -1310,11 +1326,12 @@ def test_list_pages_non_empty_request_with_auto_populated_field(): client.list_pages(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == page.ListPagesRequest( + request_msg = page.ListPagesRequest( parent="parent_value", language_code="language_code_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_pages_use_cached_wrapped_rpc(): @@ -1393,9 +1410,14 @@ async def test_list_pages_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_list_pages_async( - transport: str = "grpc_asyncio", request_type=page.ListPagesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + page.ListPagesRequest(), + {}, + ], +) +async def test_list_pages_async(request_type, transport: str = "grpc_asyncio"): client = PagesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1403,7 +1425,7 @@ async def test_list_pages_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_pages), "__call__") as call: @@ -1426,11 +1448,6 @@ async def test_list_pages_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_pages_async_from_dict(): - await test_list_pages_async(request_type=dict) - - def test_list_pages_field_headers(): client = PagesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1767,8 +1784,8 @@ async def test_list_pages_async_pages(): @pytest.mark.parametrize( "request_type", [ - page.GetPageRequest, - dict, + page.GetPageRequest(), + {}, ], ) def test_get_page(request_type, transport: str = "grpc"): @@ -1779,7 +1796,7 @@ def test_get_page(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_page), "__call__") as call: @@ -1830,10 +1847,11 @@ def test_get_page_non_empty_request_with_auto_populated_field(): client.get_page(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == page.GetPageRequest( + request_msg = page.GetPageRequest( name="name_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_get_page_use_cached_wrapped_rpc(): @@ -1912,9 +1930,14 @@ async def test_get_page_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn @pytest.mark.asyncio -async def test_get_page_async( - transport: str = "grpc_asyncio", request_type=page.GetPageRequest -): +@pytest.mark.parametrize( + "request_type", + [ + page.GetPageRequest(), + {}, + ], +) +async def test_get_page_async(request_type, transport: str = "grpc_asyncio"): client = PagesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1922,7 +1945,7 @@ async def test_get_page_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_page), "__call__") as call: @@ -1951,11 +1974,6 @@ async def test_get_page_async( assert response.transition_route_groups == ["transition_route_groups_value"] -@pytest.mark.asyncio -async def test_get_page_async_from_dict(): - await test_get_page_async(request_type=dict) - - def test_get_page_field_headers(): client = PagesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2098,8 +2116,8 @@ async def test_get_page_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcdc_page.CreatePageRequest, - dict, + gcdc_page.CreatePageRequest(), + {}, ], ) def test_create_page(request_type, transport: str = "grpc"): @@ -2110,7 +2128,7 @@ def test_create_page(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_page), "__call__") as call: @@ -2161,10 +2179,11 @@ def test_create_page_non_empty_request_with_auto_populated_field(): client.create_page(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcdc_page.CreatePageRequest( + request_msg = gcdc_page.CreatePageRequest( parent="parent_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_create_page_use_cached_wrapped_rpc(): @@ -2245,9 +2264,14 @@ async def test_create_page_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_page_async( - transport: str = "grpc_asyncio", request_type=gcdc_page.CreatePageRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcdc_page.CreatePageRequest(), + {}, + ], +) +async def test_create_page_async(request_type, transport: str = "grpc_asyncio"): client = PagesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2255,7 +2279,7 @@ async def test_create_page_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_page), "__call__") as call: @@ -2284,11 +2308,6 @@ async def test_create_page_async( assert response.transition_route_groups == ["transition_route_groups_value"] -@pytest.mark.asyncio -async def test_create_page_async_from_dict(): - await test_create_page_async(request_type=dict) - - def test_create_page_field_headers(): client = PagesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2441,8 +2460,8 @@ async def test_create_page_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcdc_page.UpdatePageRequest, - dict, + gcdc_page.UpdatePageRequest(), + {}, ], ) def test_update_page(request_type, transport: str = "grpc"): @@ -2453,7 +2472,7 @@ def test_update_page(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_page), "__call__") as call: @@ -2503,9 +2522,10 @@ def test_update_page_non_empty_request_with_auto_populated_field(): client.update_page(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcdc_page.UpdatePageRequest( + request_msg = gcdc_page.UpdatePageRequest( language_code="language_code_value", ) + assert args[0] == request_msg def test_update_page_use_cached_wrapped_rpc(): @@ -2586,9 +2606,14 @@ async def test_update_page_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_page_async( - transport: str = "grpc_asyncio", request_type=gcdc_page.UpdatePageRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcdc_page.UpdatePageRequest(), + {}, + ], +) +async def test_update_page_async(request_type, transport: str = "grpc_asyncio"): client = PagesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2596,7 +2621,7 @@ async def test_update_page_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_page), "__call__") as call: @@ -2625,11 +2650,6 @@ async def test_update_page_async( assert response.transition_route_groups == ["transition_route_groups_value"] -@pytest.mark.asyncio -async def test_update_page_async_from_dict(): - await test_update_page_async(request_type=dict) - - def test_update_page_field_headers(): client = PagesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2782,8 +2802,8 @@ async def test_update_page_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - page.DeletePageRequest, - dict, + page.DeletePageRequest(), + {}, ], ) def test_delete_page(request_type, transport: str = "grpc"): @@ -2794,7 +2814,7 @@ def test_delete_page(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_page), "__call__") as call: @@ -2835,9 +2855,10 @@ def test_delete_page_non_empty_request_with_auto_populated_field(): client.delete_page(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == page.DeletePageRequest( + request_msg = page.DeletePageRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_page_use_cached_wrapped_rpc(): @@ -2918,9 +2939,14 @@ async def test_delete_page_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_page_async( - transport: str = "grpc_asyncio", request_type=page.DeletePageRequest -): +@pytest.mark.parametrize( + "request_type", + [ + page.DeletePageRequest(), + {}, + ], +) +async def test_delete_page_async(request_type, transport: str = "grpc_asyncio"): client = PagesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2928,7 +2954,7 @@ async def test_delete_page_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_page), "__call__") as call: @@ -2946,11 +2972,6 @@ async def test_delete_page_async( assert response is None -@pytest.mark.asyncio -async def test_delete_page_async_from_dict(): - await test_delete_page_async(request_type=dict) - - def test_delete_page_field_headers(): client = PagesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4210,7 +4231,6 @@ def test_list_pages_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = page.ListPagesRequest() - assert args[0] == request_msg @@ -4231,7 +4251,6 @@ def test_get_page_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = page.GetPageRequest() - assert args[0] == request_msg @@ -4252,7 +4271,6 @@ def test_create_page_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_page.CreatePageRequest() - assert args[0] == request_msg @@ -4273,7 +4291,6 @@ def test_update_page_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_page.UpdatePageRequest() - assert args[0] == request_msg @@ -4294,7 +4311,6 @@ def test_delete_page_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = page.DeletePageRequest() - assert args[0] == request_msg @@ -4335,7 +4351,6 @@ async def test_list_pages_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = page.ListPagesRequest() - assert args[0] == request_msg @@ -4365,7 +4380,6 @@ async def test_get_page_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = page.GetPageRequest() - assert args[0] == request_msg @@ -4395,7 +4409,6 @@ async def test_create_page_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_page.CreatePageRequest() - assert args[0] == request_msg @@ -4425,7 +4438,6 @@ async def test_update_page_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_page.UpdatePageRequest() - assert args[0] == request_msg @@ -4448,7 +4460,6 @@ async def test_delete_page_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = page.DeletePageRequest() - assert args[0] == request_msg @@ -5863,7 +5874,6 @@ def test_list_pages_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = page.ListPagesRequest() - assert args[0] == request_msg @@ -5883,7 +5893,6 @@ def test_get_page_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = page.GetPageRequest() - assert args[0] == request_msg @@ -5903,7 +5912,6 @@ def test_create_page_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_page.CreatePageRequest() - assert args[0] == request_msg @@ -5923,7 +5931,6 @@ def test_update_page_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_page.UpdatePageRequest() - assert args[0] == request_msg @@ -5943,7 +5950,6 @@ def test_delete_page_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = page.DeletePageRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_playbooks.py b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_playbooks.py index d9224515b633..d37ab88050b1 100644 --- a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_playbooks.py +++ b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_playbooks.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 @@ -131,6 +132,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" @@ -1291,8 +1307,8 @@ def test_playbooks_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - gcdc_playbook.CreatePlaybookRequest, - dict, + gcdc_playbook.CreatePlaybookRequest(), + {}, ], ) def test_create_playbook(request_type, transport: str = "grpc"): @@ -1303,7 +1319,7 @@ def test_create_playbook(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_playbook), "__call__") as call: @@ -1363,9 +1379,10 @@ def test_create_playbook_non_empty_request_with_auto_populated_field(): client.create_playbook(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcdc_playbook.CreatePlaybookRequest( + request_msg = gcdc_playbook.CreatePlaybookRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_playbook_use_cached_wrapped_rpc(): @@ -1446,9 +1463,14 @@ async def test_create_playbook_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_playbook_async( - transport: str = "grpc_asyncio", request_type=gcdc_playbook.CreatePlaybookRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcdc_playbook.CreatePlaybookRequest(), + {}, + ], +) +async def test_create_playbook_async(request_type, transport: str = "grpc_asyncio"): client = PlaybooksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1456,7 +1478,7 @@ async def test_create_playbook_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_playbook), "__call__") as call: @@ -1495,11 +1517,6 @@ async def test_create_playbook_async( assert response.playbook_type == gcdc_playbook.Playbook.PlaybookType.TASK -@pytest.mark.asyncio -async def test_create_playbook_async_from_dict(): - await test_create_playbook_async(request_type=dict) - - def test_create_playbook_field_headers(): client = PlaybooksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1656,8 +1673,8 @@ async def test_create_playbook_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - playbook.DeletePlaybookRequest, - dict, + playbook.DeletePlaybookRequest(), + {}, ], ) def test_delete_playbook(request_type, transport: str = "grpc"): @@ -1668,7 +1685,7 @@ def test_delete_playbook(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_playbook), "__call__") as call: @@ -1709,9 +1726,10 @@ def test_delete_playbook_non_empty_request_with_auto_populated_field(): client.delete_playbook(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == playbook.DeletePlaybookRequest( + request_msg = playbook.DeletePlaybookRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_playbook_use_cached_wrapped_rpc(): @@ -1792,9 +1810,14 @@ async def test_delete_playbook_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_playbook_async( - transport: str = "grpc_asyncio", request_type=playbook.DeletePlaybookRequest -): +@pytest.mark.parametrize( + "request_type", + [ + playbook.DeletePlaybookRequest(), + {}, + ], +) +async def test_delete_playbook_async(request_type, transport: str = "grpc_asyncio"): client = PlaybooksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1802,7 +1825,7 @@ async def test_delete_playbook_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_playbook), "__call__") as call: @@ -1820,11 +1843,6 @@ async def test_delete_playbook_async( assert response is None -@pytest.mark.asyncio -async def test_delete_playbook_async_from_dict(): - await test_delete_playbook_async(request_type=dict) - - def test_delete_playbook_field_headers(): client = PlaybooksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1967,8 +1985,8 @@ async def test_delete_playbook_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - playbook.ListPlaybooksRequest, - dict, + playbook.ListPlaybooksRequest(), + {}, ], ) def test_list_playbooks(request_type, transport: str = "grpc"): @@ -1979,7 +1997,7 @@ def test_list_playbooks(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_playbooks), "__call__") as call: @@ -2024,10 +2042,11 @@ def test_list_playbooks_non_empty_request_with_auto_populated_field(): client.list_playbooks(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == playbook.ListPlaybooksRequest( + request_msg = playbook.ListPlaybooksRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_playbooks_use_cached_wrapped_rpc(): @@ -2108,9 +2127,14 @@ async def test_list_playbooks_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_playbooks_async( - transport: str = "grpc_asyncio", request_type=playbook.ListPlaybooksRequest -): +@pytest.mark.parametrize( + "request_type", + [ + playbook.ListPlaybooksRequest(), + {}, + ], +) +async def test_list_playbooks_async(request_type, transport: str = "grpc_asyncio"): client = PlaybooksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2118,7 +2142,7 @@ async def test_list_playbooks_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_playbooks), "__call__") as call: @@ -2141,11 +2165,6 @@ async def test_list_playbooks_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_playbooks_async_from_dict(): - await test_list_playbooks_async(request_type=dict) - - def test_list_playbooks_field_headers(): client = PlaybooksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2482,8 +2501,8 @@ async def test_list_playbooks_async_pages(): @pytest.mark.parametrize( "request_type", [ - playbook.GetPlaybookRequest, - dict, + playbook.GetPlaybookRequest(), + {}, ], ) def test_get_playbook(request_type, transport: str = "grpc"): @@ -2494,7 +2513,7 @@ def test_get_playbook(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_playbook), "__call__") as call: @@ -2554,9 +2573,10 @@ def test_get_playbook_non_empty_request_with_auto_populated_field(): client.get_playbook(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == playbook.GetPlaybookRequest( + request_msg = playbook.GetPlaybookRequest( name="name_value", ) + assert args[0] == request_msg def test_get_playbook_use_cached_wrapped_rpc(): @@ -2637,9 +2657,14 @@ async def test_get_playbook_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_playbook_async( - transport: str = "grpc_asyncio", request_type=playbook.GetPlaybookRequest -): +@pytest.mark.parametrize( + "request_type", + [ + playbook.GetPlaybookRequest(), + {}, + ], +) +async def test_get_playbook_async(request_type, transport: str = "grpc_asyncio"): client = PlaybooksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2647,7 +2672,7 @@ async def test_get_playbook_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_playbook), "__call__") as call: @@ -2686,11 +2711,6 @@ async def test_get_playbook_async( assert response.playbook_type == playbook.Playbook.PlaybookType.TASK -@pytest.mark.asyncio -async def test_get_playbook_async_from_dict(): - await test_get_playbook_async(request_type=dict) - - def test_get_playbook_field_headers(): client = PlaybooksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2833,8 +2853,8 @@ async def test_get_playbook_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - playbook.ExportPlaybookRequest, - dict, + playbook.ExportPlaybookRequest(), + {}, ], ) def test_export_playbook(request_type, transport: str = "grpc"): @@ -2845,7 +2865,7 @@ def test_export_playbook(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.export_playbook), "__call__") as call: @@ -2887,10 +2907,11 @@ def test_export_playbook_non_empty_request_with_auto_populated_field(): client.export_playbook(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == playbook.ExportPlaybookRequest( + request_msg = playbook.ExportPlaybookRequest( name="name_value", playbook_uri="playbook_uri_value", ) + assert args[0] == request_msg def test_export_playbook_use_cached_wrapped_rpc(): @@ -2981,9 +3002,14 @@ async def test_export_playbook_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_export_playbook_async( - transport: str = "grpc_asyncio", request_type=playbook.ExportPlaybookRequest -): +@pytest.mark.parametrize( + "request_type", + [ + playbook.ExportPlaybookRequest(), + {}, + ], +) +async def test_export_playbook_async(request_type, transport: str = "grpc_asyncio"): client = PlaybooksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2991,7 +3017,7 @@ async def test_export_playbook_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.export_playbook), "__call__") as call: @@ -3011,11 +3037,6 @@ async def test_export_playbook_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_export_playbook_async_from_dict(): - await test_export_playbook_async(request_type=dict) - - def test_export_playbook_field_headers(): client = PlaybooksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3080,8 +3101,8 @@ async def test_export_playbook_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - playbook.ImportPlaybookRequest, - dict, + playbook.ImportPlaybookRequest(), + {}, ], ) def test_import_playbook(request_type, transport: str = "grpc"): @@ -3092,7 +3113,7 @@ def test_import_playbook(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.import_playbook), "__call__") as call: @@ -3134,10 +3155,11 @@ def test_import_playbook_non_empty_request_with_auto_populated_field(): client.import_playbook(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == playbook.ImportPlaybookRequest( + request_msg = playbook.ImportPlaybookRequest( parent="parent_value", playbook_uri="playbook_uri_value", ) + assert args[0] == request_msg def test_import_playbook_use_cached_wrapped_rpc(): @@ -3228,9 +3250,14 @@ async def test_import_playbook_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_import_playbook_async( - transport: str = "grpc_asyncio", request_type=playbook.ImportPlaybookRequest -): +@pytest.mark.parametrize( + "request_type", + [ + playbook.ImportPlaybookRequest(), + {}, + ], +) +async def test_import_playbook_async(request_type, transport: str = "grpc_asyncio"): client = PlaybooksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3238,7 +3265,7 @@ async def test_import_playbook_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.import_playbook), "__call__") as call: @@ -3258,11 +3285,6 @@ async def test_import_playbook_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_import_playbook_async_from_dict(): - await test_import_playbook_async(request_type=dict) - - def test_import_playbook_field_headers(): client = PlaybooksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3327,8 +3349,8 @@ async def test_import_playbook_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - gcdc_playbook.UpdatePlaybookRequest, - dict, + gcdc_playbook.UpdatePlaybookRequest(), + {}, ], ) def test_update_playbook(request_type, transport: str = "grpc"): @@ -3339,7 +3361,7 @@ def test_update_playbook(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_playbook), "__call__") as call: @@ -3397,7 +3419,8 @@ def test_update_playbook_non_empty_request_with_auto_populated_field(): client.update_playbook(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcdc_playbook.UpdatePlaybookRequest() + request_msg = gcdc_playbook.UpdatePlaybookRequest() + assert args[0] == request_msg def test_update_playbook_use_cached_wrapped_rpc(): @@ -3478,9 +3501,14 @@ async def test_update_playbook_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_playbook_async( - transport: str = "grpc_asyncio", request_type=gcdc_playbook.UpdatePlaybookRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcdc_playbook.UpdatePlaybookRequest(), + {}, + ], +) +async def test_update_playbook_async(request_type, transport: str = "grpc_asyncio"): client = PlaybooksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3488,7 +3516,7 @@ async def test_update_playbook_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_playbook), "__call__") as call: @@ -3527,11 +3555,6 @@ async def test_update_playbook_async( assert response.playbook_type == gcdc_playbook.Playbook.PlaybookType.TASK -@pytest.mark.asyncio -async def test_update_playbook_async_from_dict(): - await test_update_playbook_async(request_type=dict) - - def test_update_playbook_field_headers(): client = PlaybooksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3688,8 +3711,8 @@ async def test_update_playbook_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - playbook.CreatePlaybookVersionRequest, - dict, + playbook.CreatePlaybookVersionRequest(), + {}, ], ) def test_create_playbook_version(request_type, transport: str = "grpc"): @@ -3700,7 +3723,7 @@ def test_create_playbook_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3750,9 +3773,10 @@ def test_create_playbook_version_non_empty_request_with_auto_populated_field(): client.create_playbook_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == playbook.CreatePlaybookVersionRequest( + request_msg = playbook.CreatePlaybookVersionRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_playbook_version_use_cached_wrapped_rpc(): @@ -3838,8 +3862,15 @@ async def test_create_playbook_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + playbook.CreatePlaybookVersionRequest(), + {}, + ], +) async def test_create_playbook_version_async( - transport: str = "grpc_asyncio", request_type=playbook.CreatePlaybookVersionRequest + request_type, transport: str = "grpc_asyncio" ): client = PlaybooksAsyncClient( credentials=async_anonymous_credentials(), @@ -3848,7 +3879,7 @@ async def test_create_playbook_version_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( @@ -3875,11 +3906,6 @@ async def test_create_playbook_version_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_create_playbook_version_async_from_dict(): - await test_create_playbook_version_async(request_type=dict) - - def test_create_playbook_version_field_headers(): client = PlaybooksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4044,8 +4070,8 @@ async def test_create_playbook_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - playbook.GetPlaybookVersionRequest, - dict, + playbook.GetPlaybookVersionRequest(), + {}, ], ) def test_get_playbook_version(request_type, transport: str = "grpc"): @@ -4056,7 +4082,7 @@ def test_get_playbook_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4106,9 +4132,10 @@ def test_get_playbook_version_non_empty_request_with_auto_populated_field(): client.get_playbook_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == playbook.GetPlaybookVersionRequest( + request_msg = playbook.GetPlaybookVersionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_playbook_version_use_cached_wrapped_rpc(): @@ -4193,8 +4220,15 @@ async def test_get_playbook_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + playbook.GetPlaybookVersionRequest(), + {}, + ], +) async def test_get_playbook_version_async( - transport: str = "grpc_asyncio", request_type=playbook.GetPlaybookVersionRequest + request_type, transport: str = "grpc_asyncio" ): client = PlaybooksAsyncClient( credentials=async_anonymous_credentials(), @@ -4203,7 +4237,7 @@ async def test_get_playbook_version_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( @@ -4230,11 +4264,6 @@ async def test_get_playbook_version_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_get_playbook_version_async_from_dict(): - await test_get_playbook_version_async(request_type=dict) - - def test_get_playbook_version_field_headers(): client = PlaybooksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4389,8 +4418,8 @@ async def test_get_playbook_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - playbook.RestorePlaybookVersionRequest, - dict, + playbook.RestorePlaybookVersionRequest(), + {}, ], ) def test_restore_playbook_version(request_type, transport: str = "grpc"): @@ -4401,7 +4430,7 @@ def test_restore_playbook_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4446,9 +4475,10 @@ def test_restore_playbook_version_non_empty_request_with_auto_populated_field(): client.restore_playbook_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == playbook.RestorePlaybookVersionRequest( + request_msg = playbook.RestorePlaybookVersionRequest( name="name_value", ) + assert args[0] == request_msg def test_restore_playbook_version_use_cached_wrapped_rpc(): @@ -4534,8 +4564,15 @@ async def test_restore_playbook_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + playbook.RestorePlaybookVersionRequest(), + {}, + ], +) async def test_restore_playbook_version_async( - transport: str = "grpc_asyncio", request_type=playbook.RestorePlaybookVersionRequest + request_type, transport: str = "grpc_asyncio" ): client = PlaybooksAsyncClient( credentials=async_anonymous_credentials(), @@ -4544,7 +4581,7 @@ async def test_restore_playbook_version_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( @@ -4566,11 +4603,6 @@ async def test_restore_playbook_version_async( assert isinstance(response, playbook.RestorePlaybookVersionResponse) -@pytest.mark.asyncio -async def test_restore_playbook_version_async_from_dict(): - await test_restore_playbook_version_async(request_type=dict) - - def test_restore_playbook_version_field_headers(): client = PlaybooksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4725,8 +4757,8 @@ async def test_restore_playbook_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - playbook.ListPlaybookVersionsRequest, - dict, + playbook.ListPlaybookVersionsRequest(), + {}, ], ) def test_list_playbook_versions(request_type, transport: str = "grpc"): @@ -4737,7 +4769,7 @@ def test_list_playbook_versions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4786,10 +4818,11 @@ def test_list_playbook_versions_non_empty_request_with_auto_populated_field(): client.list_playbook_versions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == playbook.ListPlaybookVersionsRequest( + request_msg = playbook.ListPlaybookVersionsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_playbook_versions_use_cached_wrapped_rpc(): @@ -4875,8 +4908,15 @@ async def test_list_playbook_versions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + playbook.ListPlaybookVersionsRequest(), + {}, + ], +) async def test_list_playbook_versions_async( - transport: str = "grpc_asyncio", request_type=playbook.ListPlaybookVersionsRequest + request_type, transport: str = "grpc_asyncio" ): client = PlaybooksAsyncClient( credentials=async_anonymous_credentials(), @@ -4885,7 +4925,7 @@ async def test_list_playbook_versions_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( @@ -4910,11 +4950,6 @@ async def test_list_playbook_versions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_playbook_versions_async_from_dict(): - await test_list_playbook_versions_async(request_type=dict) - - def test_list_playbook_versions_field_headers(): client = PlaybooksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5267,8 +5302,8 @@ async def test_list_playbook_versions_async_pages(): @pytest.mark.parametrize( "request_type", [ - playbook.DeletePlaybookVersionRequest, - dict, + playbook.DeletePlaybookVersionRequest(), + {}, ], ) def test_delete_playbook_version(request_type, transport: str = "grpc"): @@ -5279,7 +5314,7 @@ def test_delete_playbook_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5324,9 +5359,10 @@ def test_delete_playbook_version_non_empty_request_with_auto_populated_field(): client.delete_playbook_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == playbook.DeletePlaybookVersionRequest( + request_msg = playbook.DeletePlaybookVersionRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_playbook_version_use_cached_wrapped_rpc(): @@ -5412,8 +5448,15 @@ async def test_delete_playbook_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + playbook.DeletePlaybookVersionRequest(), + {}, + ], +) async def test_delete_playbook_version_async( - transport: str = "grpc_asyncio", request_type=playbook.DeletePlaybookVersionRequest + request_type, transport: str = "grpc_asyncio" ): client = PlaybooksAsyncClient( credentials=async_anonymous_credentials(), @@ -5422,7 +5465,7 @@ async def test_delete_playbook_version_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( @@ -5442,11 +5485,6 @@ async def test_delete_playbook_version_async( assert response is None -@pytest.mark.asyncio -async def test_delete_playbook_version_async_from_dict(): - await test_delete_playbook_version_async(request_type=dict) - - def test_delete_playbook_version_field_headers(): client = PlaybooksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7950,7 +7988,6 @@ def test_create_playbook_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_playbook.CreatePlaybookRequest() - assert args[0] == request_msg @@ -7971,7 +8008,6 @@ def test_delete_playbook_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = playbook.DeletePlaybookRequest() - assert args[0] == request_msg @@ -7992,7 +8028,6 @@ def test_list_playbooks_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = playbook.ListPlaybooksRequest() - assert args[0] == request_msg @@ -8013,7 +8048,6 @@ def test_get_playbook_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = playbook.GetPlaybookRequest() - assert args[0] == request_msg @@ -8034,7 +8068,6 @@ def test_export_playbook_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = playbook.ExportPlaybookRequest() - assert args[0] == request_msg @@ -8055,7 +8088,6 @@ def test_import_playbook_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = playbook.ImportPlaybookRequest() - assert args[0] == request_msg @@ -8076,7 +8108,6 @@ def test_update_playbook_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_playbook.UpdatePlaybookRequest() - assert args[0] == request_msg @@ -8099,7 +8130,6 @@ def test_create_playbook_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = playbook.CreatePlaybookVersionRequest() - assert args[0] == request_msg @@ -8122,7 +8152,6 @@ def test_get_playbook_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = playbook.GetPlaybookVersionRequest() - assert args[0] == request_msg @@ -8145,7 +8174,6 @@ def test_restore_playbook_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = playbook.RestorePlaybookVersionRequest() - assert args[0] == request_msg @@ -8168,7 +8196,6 @@ def test_list_playbook_versions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = playbook.ListPlaybookVersionsRequest() - assert args[0] == request_msg @@ -8191,7 +8218,6 @@ def test_delete_playbook_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = playbook.DeletePlaybookVersionRequest() - assert args[0] == request_msg @@ -8240,7 +8266,6 @@ async def test_create_playbook_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_playbook.CreatePlaybookRequest() - assert args[0] == request_msg @@ -8263,7 +8288,6 @@ async def test_delete_playbook_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = playbook.DeletePlaybookRequest() - assert args[0] == request_msg @@ -8290,7 +8314,6 @@ async def test_list_playbooks_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = playbook.ListPlaybooksRequest() - assert args[0] == request_msg @@ -8325,7 +8348,6 @@ async def test_get_playbook_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = playbook.GetPlaybookRequest() - assert args[0] == request_msg @@ -8350,7 +8372,6 @@ async def test_export_playbook_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = playbook.ExportPlaybookRequest() - assert args[0] == request_msg @@ -8375,7 +8396,6 @@ async def test_import_playbook_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = playbook.ImportPlaybookRequest() - assert args[0] == request_msg @@ -8410,7 +8430,6 @@ async def test_update_playbook_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_playbook.UpdatePlaybookRequest() - assert args[0] == request_msg @@ -8440,7 +8459,6 @@ async def test_create_playbook_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = playbook.CreatePlaybookVersionRequest() - assert args[0] == request_msg @@ -8470,7 +8488,6 @@ async def test_get_playbook_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = playbook.GetPlaybookVersionRequest() - assert args[0] == request_msg @@ -8497,7 +8514,6 @@ async def test_restore_playbook_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = playbook.RestorePlaybookVersionRequest() - assert args[0] == request_msg @@ -8526,7 +8542,6 @@ async def test_list_playbook_versions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = playbook.ListPlaybookVersionsRequest() - assert args[0] == request_msg @@ -8551,7 +8566,6 @@ async def test_delete_playbook_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = playbook.DeletePlaybookVersionRequest() - assert args[0] == request_msg @@ -11179,7 +11193,6 @@ def test_create_playbook_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_playbook.CreatePlaybookRequest() - assert args[0] == request_msg @@ -11199,7 +11212,6 @@ def test_delete_playbook_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = playbook.DeletePlaybookRequest() - assert args[0] == request_msg @@ -11219,7 +11231,6 @@ def test_list_playbooks_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = playbook.ListPlaybooksRequest() - assert args[0] == request_msg @@ -11239,7 +11250,6 @@ def test_get_playbook_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = playbook.GetPlaybookRequest() - assert args[0] == request_msg @@ -11259,7 +11269,6 @@ def test_export_playbook_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = playbook.ExportPlaybookRequest() - assert args[0] == request_msg @@ -11279,7 +11288,6 @@ def test_import_playbook_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = playbook.ImportPlaybookRequest() - assert args[0] == request_msg @@ -11299,7 +11307,6 @@ def test_update_playbook_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_playbook.UpdatePlaybookRequest() - assert args[0] == request_msg @@ -11321,7 +11328,6 @@ def test_create_playbook_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = playbook.CreatePlaybookVersionRequest() - assert args[0] == request_msg @@ -11343,7 +11349,6 @@ def test_get_playbook_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = playbook.GetPlaybookVersionRequest() - assert args[0] == request_msg @@ -11365,7 +11370,6 @@ def test_restore_playbook_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = playbook.RestorePlaybookVersionRequest() - assert args[0] == request_msg @@ -11387,7 +11391,6 @@ def test_list_playbook_versions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = playbook.ListPlaybookVersionsRequest() - assert args[0] == request_msg @@ -11409,7 +11412,6 @@ def test_delete_playbook_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = playbook.DeletePlaybookVersionRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_security_settings_service.py b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_security_settings_service.py index 8c823a5bc5fd..8644fcd74b45 100644 --- a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_security_settings_service.py +++ b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_security_settings_service.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 @@ -113,6 +114,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" @@ -1385,8 +1401,8 @@ def test_security_settings_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - gcdc_security_settings.CreateSecuritySettingsRequest, - dict, + gcdc_security_settings.CreateSecuritySettingsRequest(), + {}, ], ) def test_create_security_settings(request_type, transport: str = "grpc"): @@ -1397,7 +1413,7 @@ def test_create_security_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( @@ -1468,9 +1484,10 @@ def test_create_security_settings_non_empty_request_with_auto_populated_field(): client.create_security_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcdc_security_settings.CreateSecuritySettingsRequest( + request_msg = gcdc_security_settings.CreateSecuritySettingsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_security_settings_use_cached_wrapped_rpc(): @@ -1556,9 +1573,15 @@ async def test_create_security_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcdc_security_settings.CreateSecuritySettingsRequest(), + {}, + ], +) async def test_create_security_settings_async( - transport: str = "grpc_asyncio", - request_type=gcdc_security_settings.CreateSecuritySettingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecuritySettingsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1567,7 +1590,7 @@ async def test_create_security_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( @@ -1614,11 +1637,6 @@ async def test_create_security_settings_async( ] -@pytest.mark.asyncio -async def test_create_security_settings_async_from_dict(): - await test_create_security_settings_async(request_type=dict) - - def test_create_security_settings_field_headers(): client = SecuritySettingsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1791,8 +1809,8 @@ async def test_create_security_settings_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - security_settings.GetSecuritySettingsRequest, - dict, + security_settings.GetSecuritySettingsRequest(), + {}, ], ) def test_get_security_settings(request_type, transport: str = "grpc"): @@ -1803,7 +1821,7 @@ def test_get_security_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( @@ -1874,9 +1892,10 @@ def test_get_security_settings_non_empty_request_with_auto_populated_field(): client.get_security_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == security_settings.GetSecuritySettingsRequest( + request_msg = security_settings.GetSecuritySettingsRequest( name="name_value", ) + assert args[0] == request_msg def test_get_security_settings_use_cached_wrapped_rpc(): @@ -1962,9 +1981,15 @@ async def test_get_security_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + security_settings.GetSecuritySettingsRequest(), + {}, + ], +) async def test_get_security_settings_async( - transport: str = "grpc_asyncio", - request_type=security_settings.GetSecuritySettingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecuritySettingsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1973,7 +1998,7 @@ async def test_get_security_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( @@ -2020,11 +2045,6 @@ async def test_get_security_settings_async( ] -@pytest.mark.asyncio -async def test_get_security_settings_async_from_dict(): - await test_get_security_settings_async(request_type=dict) - - def test_get_security_settings_field_headers(): client = SecuritySettingsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2179,8 +2199,8 @@ async def test_get_security_settings_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcdc_security_settings.UpdateSecuritySettingsRequest, - dict, + gcdc_security_settings.UpdateSecuritySettingsRequest(), + {}, ], ) def test_update_security_settings(request_type, transport: str = "grpc"): @@ -2191,7 +2211,7 @@ def test_update_security_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( @@ -2260,7 +2280,8 @@ def test_update_security_settings_non_empty_request_with_auto_populated_field(): client.update_security_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcdc_security_settings.UpdateSecuritySettingsRequest() + request_msg = gcdc_security_settings.UpdateSecuritySettingsRequest() + assert args[0] == request_msg def test_update_security_settings_use_cached_wrapped_rpc(): @@ -2346,9 +2367,15 @@ async def test_update_security_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcdc_security_settings.UpdateSecuritySettingsRequest(), + {}, + ], +) async def test_update_security_settings_async( - transport: str = "grpc_asyncio", - request_type=gcdc_security_settings.UpdateSecuritySettingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecuritySettingsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2357,7 +2384,7 @@ async def test_update_security_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( @@ -2404,11 +2431,6 @@ async def test_update_security_settings_async( ] -@pytest.mark.asyncio -async def test_update_security_settings_async_from_dict(): - await test_update_security_settings_async(request_type=dict) - - def test_update_security_settings_field_headers(): client = SecuritySettingsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2581,8 +2603,8 @@ async def test_update_security_settings_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - security_settings.ListSecuritySettingsRequest, - dict, + security_settings.ListSecuritySettingsRequest(), + {}, ], ) def test_list_security_settings(request_type, transport: str = "grpc"): @@ -2593,7 +2615,7 @@ def test_list_security_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( @@ -2642,10 +2664,11 @@ def test_list_security_settings_non_empty_request_with_auto_populated_field(): client.list_security_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == security_settings.ListSecuritySettingsRequest( + request_msg = security_settings.ListSecuritySettingsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_security_settings_use_cached_wrapped_rpc(): @@ -2731,9 +2754,15 @@ async def test_list_security_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + security_settings.ListSecuritySettingsRequest(), + {}, + ], +) async def test_list_security_settings_async( - transport: str = "grpc_asyncio", - request_type=security_settings.ListSecuritySettingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecuritySettingsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2742,7 +2771,7 @@ async def test_list_security_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( @@ -2767,11 +2796,6 @@ async def test_list_security_settings_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_security_settings_async_from_dict(): - await test_list_security_settings_async(request_type=dict) - - def test_list_security_settings_field_headers(): client = SecuritySettingsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3124,8 +3148,8 @@ async def test_list_security_settings_async_pages(): @pytest.mark.parametrize( "request_type", [ - security_settings.DeleteSecuritySettingsRequest, - dict, + security_settings.DeleteSecuritySettingsRequest(), + {}, ], ) def test_delete_security_settings(request_type, transport: str = "grpc"): @@ -3136,7 +3160,7 @@ def test_delete_security_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( @@ -3181,9 +3205,10 @@ def test_delete_security_settings_non_empty_request_with_auto_populated_field(): client.delete_security_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == security_settings.DeleteSecuritySettingsRequest( + request_msg = security_settings.DeleteSecuritySettingsRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_security_settings_use_cached_wrapped_rpc(): @@ -3269,9 +3294,15 @@ async def test_delete_security_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + security_settings.DeleteSecuritySettingsRequest(), + {}, + ], +) async def test_delete_security_settings_async( - transport: str = "grpc_asyncio", - request_type=security_settings.DeleteSecuritySettingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecuritySettingsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3280,7 +3311,7 @@ async def test_delete_security_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( @@ -3300,11 +3331,6 @@ async def test_delete_security_settings_async( assert response is None -@pytest.mark.asyncio -async def test_delete_security_settings_async_from_dict(): - await test_delete_security_settings_async(request_type=dict) - - def test_delete_security_settings_field_headers(): client = SecuritySettingsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4602,7 +4628,6 @@ def test_create_security_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_security_settings.CreateSecuritySettingsRequest() - assert args[0] == request_msg @@ -4625,7 +4650,6 @@ def test_get_security_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_settings.GetSecuritySettingsRequest() - assert args[0] == request_msg @@ -4648,7 +4672,6 @@ def test_update_security_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_security_settings.UpdateSecuritySettingsRequest() - assert args[0] == request_msg @@ -4671,7 +4694,6 @@ def test_list_security_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_settings.ListSecuritySettingsRequest() - assert args[0] == request_msg @@ -4694,7 +4716,6 @@ def test_delete_security_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_settings.DeleteSecuritySettingsRequest() - assert args[0] == request_msg @@ -4745,7 +4766,6 @@ async def test_create_security_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_security_settings.CreateSecuritySettingsRequest() - assert args[0] == request_msg @@ -4782,7 +4802,6 @@ async def test_get_security_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_settings.GetSecuritySettingsRequest() - assert args[0] == request_msg @@ -4819,7 +4838,6 @@ async def test_update_security_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_security_settings.UpdateSecuritySettingsRequest() - assert args[0] == request_msg @@ -4848,7 +4866,6 @@ async def test_list_security_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_settings.ListSecuritySettingsRequest() - assert args[0] == request_msg @@ -4873,7 +4890,6 @@ async def test_delete_security_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_settings.DeleteSecuritySettingsRequest() - assert args[0] == request_msg @@ -6139,7 +6155,6 @@ def test_create_security_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_security_settings.CreateSecuritySettingsRequest() - assert args[0] == request_msg @@ -6161,7 +6176,6 @@ def test_get_security_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_settings.GetSecuritySettingsRequest() - assert args[0] == request_msg @@ -6183,7 +6197,6 @@ def test_update_security_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_security_settings.UpdateSecuritySettingsRequest() - assert args[0] == request_msg @@ -6205,7 +6218,6 @@ def test_list_security_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_settings.ListSecuritySettingsRequest() - assert args[0] == request_msg @@ -6227,7 +6239,6 @@ def test_delete_security_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_settings.DeleteSecuritySettingsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_session_entity_types.py b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_session_entity_types.py index d180a5d51283..1dac62e2c33d 100644 --- a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_session_entity_types.py +++ b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_session_entity_types.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 @@ -113,6 +114,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" @@ -1361,8 +1377,8 @@ def test_session_entity_types_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - session_entity_type.ListSessionEntityTypesRequest, - dict, + session_entity_type.ListSessionEntityTypesRequest(), + {}, ], ) def test_list_session_entity_types(request_type, transport: str = "grpc"): @@ -1373,7 +1389,7 @@ def test_list_session_entity_types(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1422,10 +1438,11 @@ def test_list_session_entity_types_non_empty_request_with_auto_populated_field() client.list_session_entity_types(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == session_entity_type.ListSessionEntityTypesRequest( + request_msg = session_entity_type.ListSessionEntityTypesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_session_entity_types_use_cached_wrapped_rpc(): @@ -1511,9 +1528,15 @@ async def test_list_session_entity_types_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + session_entity_type.ListSessionEntityTypesRequest(), + {}, + ], +) async def test_list_session_entity_types_async( - transport: str = "grpc_asyncio", - request_type=session_entity_type.ListSessionEntityTypesRequest, + request_type, transport: str = "grpc_asyncio" ): client = SessionEntityTypesAsyncClient( credentials=async_anonymous_credentials(), @@ -1522,7 +1545,7 @@ async def test_list_session_entity_types_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( @@ -1547,11 +1570,6 @@ async def test_list_session_entity_types_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_session_entity_types_async_from_dict(): - await test_list_session_entity_types_async(request_type=dict) - - def test_list_session_entity_types_field_headers(): client = SessionEntityTypesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1910,8 +1928,8 @@ async def test_list_session_entity_types_async_pages(): @pytest.mark.parametrize( "request_type", [ - session_entity_type.GetSessionEntityTypeRequest, - dict, + session_entity_type.GetSessionEntityTypeRequest(), + {}, ], ) def test_get_session_entity_type(request_type, transport: str = "grpc"): @@ -1922,7 +1940,7 @@ def test_get_session_entity_type(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,9 +1993,10 @@ def test_get_session_entity_type_non_empty_request_with_auto_populated_field(): client.get_session_entity_type(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == session_entity_type.GetSessionEntityTypeRequest( + request_msg = session_entity_type.GetSessionEntityTypeRequest( name="name_value", ) + assert args[0] == request_msg def test_get_session_entity_type_use_cached_wrapped_rpc(): @@ -2063,9 +2082,15 @@ async def test_get_session_entity_type_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + session_entity_type.GetSessionEntityTypeRequest(), + {}, + ], +) async def test_get_session_entity_type_async( - transport: str = "grpc_asyncio", - request_type=session_entity_type.GetSessionEntityTypeRequest, + request_type, transport: str = "grpc_asyncio" ): client = SessionEntityTypesAsyncClient( credentials=async_anonymous_credentials(), @@ -2074,7 +2099,7 @@ async def test_get_session_entity_type_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( @@ -2104,11 +2129,6 @@ async def test_get_session_entity_type_async( ) -@pytest.mark.asyncio -async def test_get_session_entity_type_async_from_dict(): - await test_get_session_entity_type_async(request_type=dict) - - def test_get_session_entity_type_field_headers(): client = SessionEntityTypesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2263,8 +2283,8 @@ async def test_get_session_entity_type_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcdc_session_entity_type.CreateSessionEntityTypeRequest, - dict, + gcdc_session_entity_type.CreateSessionEntityTypeRequest(), + {}, ], ) def test_create_session_entity_type(request_type, transport: str = "grpc"): @@ -2275,7 +2295,7 @@ def test_create_session_entity_type(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,9 +2348,10 @@ def test_create_session_entity_type_non_empty_request_with_auto_populated_field( client.create_session_entity_type(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcdc_session_entity_type.CreateSessionEntityTypeRequest( + request_msg = gcdc_session_entity_type.CreateSessionEntityTypeRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_session_entity_type_use_cached_wrapped_rpc(): @@ -2416,9 +2437,15 @@ async def test_create_session_entity_type_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcdc_session_entity_type.CreateSessionEntityTypeRequest(), + {}, + ], +) async def test_create_session_entity_type_async( - transport: str = "grpc_asyncio", - request_type=gcdc_session_entity_type.CreateSessionEntityTypeRequest, + request_type, transport: str = "grpc_asyncio" ): client = SessionEntityTypesAsyncClient( credentials=async_anonymous_credentials(), @@ -2427,7 +2454,7 @@ async def test_create_session_entity_type_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( @@ -2457,11 +2484,6 @@ async def test_create_session_entity_type_async( ) -@pytest.mark.asyncio -async def test_create_session_entity_type_async_from_dict(): - await test_create_session_entity_type_async(request_type=dict) - - def test_create_session_entity_type_field_headers(): client = SessionEntityTypesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2634,8 +2656,8 @@ async def test_create_session_entity_type_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcdc_session_entity_type.UpdateSessionEntityTypeRequest, - dict, + gcdc_session_entity_type.UpdateSessionEntityTypeRequest(), + {}, ], ) def test_update_session_entity_type(request_type, transport: str = "grpc"): @@ -2646,7 +2668,7 @@ def test_update_session_entity_type(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2697,7 +2719,8 @@ def test_update_session_entity_type_non_empty_request_with_auto_populated_field( client.update_session_entity_type(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcdc_session_entity_type.UpdateSessionEntityTypeRequest() + request_msg = gcdc_session_entity_type.UpdateSessionEntityTypeRequest() + assert args[0] == request_msg def test_update_session_entity_type_use_cached_wrapped_rpc(): @@ -2783,9 +2806,15 @@ async def test_update_session_entity_type_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcdc_session_entity_type.UpdateSessionEntityTypeRequest(), + {}, + ], +) async def test_update_session_entity_type_async( - transport: str = "grpc_asyncio", - request_type=gcdc_session_entity_type.UpdateSessionEntityTypeRequest, + request_type, transport: str = "grpc_asyncio" ): client = SessionEntityTypesAsyncClient( credentials=async_anonymous_credentials(), @@ -2794,7 +2823,7 @@ async def test_update_session_entity_type_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( @@ -2824,11 +2853,6 @@ async def test_update_session_entity_type_async( ) -@pytest.mark.asyncio -async def test_update_session_entity_type_async_from_dict(): - await test_update_session_entity_type_async(request_type=dict) - - def test_update_session_entity_type_field_headers(): client = SessionEntityTypesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3001,8 +3025,8 @@ async def test_update_session_entity_type_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - session_entity_type.DeleteSessionEntityTypeRequest, - dict, + session_entity_type.DeleteSessionEntityTypeRequest(), + {}, ], ) def test_delete_session_entity_type(request_type, transport: str = "grpc"): @@ -3013,7 +3037,7 @@ def test_delete_session_entity_type(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3058,9 +3082,10 @@ def test_delete_session_entity_type_non_empty_request_with_auto_populated_field( client.delete_session_entity_type(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == session_entity_type.DeleteSessionEntityTypeRequest( + request_msg = session_entity_type.DeleteSessionEntityTypeRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_session_entity_type_use_cached_wrapped_rpc(): @@ -3146,9 +3171,15 @@ async def test_delete_session_entity_type_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + session_entity_type.DeleteSessionEntityTypeRequest(), + {}, + ], +) async def test_delete_session_entity_type_async( - transport: str = "grpc_asyncio", - request_type=session_entity_type.DeleteSessionEntityTypeRequest, + request_type, transport: str = "grpc_asyncio" ): client = SessionEntityTypesAsyncClient( credentials=async_anonymous_credentials(), @@ -3157,7 +3188,7 @@ async def test_delete_session_entity_type_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( @@ -3177,11 +3208,6 @@ async def test_delete_session_entity_type_async( assert response is None -@pytest.mark.asyncio -async def test_delete_session_entity_type_async_from_dict(): - await test_delete_session_entity_type_async(request_type=dict) - - def test_delete_session_entity_type_field_headers(): client = SessionEntityTypesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4482,7 +4508,6 @@ def test_list_session_entity_types_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session_entity_type.ListSessionEntityTypesRequest() - assert args[0] == request_msg @@ -4505,7 +4530,6 @@ def test_get_session_entity_type_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session_entity_type.GetSessionEntityTypeRequest() - assert args[0] == request_msg @@ -4528,7 +4552,6 @@ def test_create_session_entity_type_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_session_entity_type.CreateSessionEntityTypeRequest() - assert args[0] == request_msg @@ -4551,7 +4574,6 @@ def test_update_session_entity_type_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_session_entity_type.UpdateSessionEntityTypeRequest() - assert args[0] == request_msg @@ -4574,7 +4596,6 @@ def test_delete_session_entity_type_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session_entity_type.DeleteSessionEntityTypeRequest() - assert args[0] == request_msg @@ -4617,7 +4638,6 @@ async def test_list_session_entity_types_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session_entity_type.ListSessionEntityTypesRequest() - assert args[0] == request_msg @@ -4647,7 +4667,6 @@ async def test_get_session_entity_type_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session_entity_type.GetSessionEntityTypeRequest() - assert args[0] == request_msg @@ -4677,7 +4696,6 @@ async def test_create_session_entity_type_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_session_entity_type.CreateSessionEntityTypeRequest() - assert args[0] == request_msg @@ -4707,7 +4725,6 @@ async def test_update_session_entity_type_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_session_entity_type.UpdateSessionEntityTypeRequest() - assert args[0] == request_msg @@ -4732,7 +4749,6 @@ async def test_delete_session_entity_type_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session_entity_type.DeleteSessionEntityTypeRequest() - assert args[0] == request_msg @@ -5931,7 +5947,6 @@ def test_list_session_entity_types_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session_entity_type.ListSessionEntityTypesRequest() - assert args[0] == request_msg @@ -5953,7 +5968,6 @@ def test_get_session_entity_type_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session_entity_type.GetSessionEntityTypeRequest() - assert args[0] == request_msg @@ -5975,7 +5989,6 @@ def test_create_session_entity_type_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_session_entity_type.CreateSessionEntityTypeRequest() - assert args[0] == request_msg @@ -5997,7 +6010,6 @@ def test_update_session_entity_type_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_session_entity_type.UpdateSessionEntityTypeRequest() - assert args[0] == request_msg @@ -6019,7 +6031,6 @@ def test_delete_session_entity_type_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session_entity_type.DeleteSessionEntityTypeRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_sessions.py b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_sessions.py index ac3b89afc301..887c84edf519 100644 --- a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_sessions.py +++ b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_sessions.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 @@ -121,6 +122,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" @@ -1268,8 +1284,8 @@ def test_sessions_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - session.DetectIntentRequest, - dict, + session.DetectIntentRequest(), + {}, ], ) def test_detect_intent(request_type, transport: str = "grpc"): @@ -1280,7 +1296,7 @@ def test_detect_intent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.detect_intent), "__call__") as call: @@ -1330,9 +1346,10 @@ def test_detect_intent_non_empty_request_with_auto_populated_field(): client.detect_intent(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == session.DetectIntentRequest( + request_msg = session.DetectIntentRequest( session="session_value", ) + assert args[0] == request_msg def test_detect_intent_use_cached_wrapped_rpc(): @@ -1413,9 +1430,14 @@ async def test_detect_intent_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_detect_intent_async( - transport: str = "grpc_asyncio", request_type=session.DetectIntentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + session.DetectIntentRequest(), + {}, + ], +) +async def test_detect_intent_async(request_type, transport: str = "grpc_asyncio"): client = SessionsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1423,7 +1445,7 @@ async def test_detect_intent_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.detect_intent), "__call__") as call: @@ -1452,11 +1474,6 @@ async def test_detect_intent_async( assert response.allow_cancellation is True -@pytest.mark.asyncio -async def test_detect_intent_async_from_dict(): - await test_detect_intent_async(request_type=dict) - - def test_detect_intent_field_headers(): client = SessionsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1521,8 +1538,8 @@ async def test_detect_intent_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - session.DetectIntentRequest, - dict, + session.DetectIntentRequest(), + {}, ], ) def test_server_streaming_detect_intent(request_type, transport: str = "grpc"): @@ -1533,7 +1550,7 @@ def test_server_streaming_detect_intent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1579,9 +1596,10 @@ def test_server_streaming_detect_intent_non_empty_request_with_auto_populated_fi client.server_streaming_detect_intent(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == session.DetectIntentRequest( + request_msg = session.DetectIntentRequest( session="session_value", ) + assert args[0] == request_msg def test_server_streaming_detect_intent_use_cached_wrapped_rpc(): @@ -1667,8 +1685,15 @@ async def test_server_streaming_detect_intent_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + session.DetectIntentRequest(), + {}, + ], +) async def test_server_streaming_detect_intent_async( - transport: str = "grpc_asyncio", request_type=session.DetectIntentRequest + request_type, transport: str = "grpc_asyncio" ): client = SessionsAsyncClient( credentials=async_anonymous_credentials(), @@ -1677,7 +1702,7 @@ async def test_server_streaming_detect_intent_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( @@ -1701,11 +1726,6 @@ async def test_server_streaming_detect_intent_async( assert isinstance(message, session.DetectIntentResponse) -@pytest.mark.asyncio -async def test_server_streaming_detect_intent_async_from_dict(): - await test_server_streaming_detect_intent_async(request_type=dict) - - def test_server_streaming_detect_intent_field_headers(): client = SessionsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1775,8 +1795,8 @@ async def test_server_streaming_detect_intent_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - session.StreamingDetectIntentRequest, - dict, + session.StreamingDetectIntentRequest(), + {}, ], ) def test_streaming_detect_intent(request_type, transport: str = "grpc"): @@ -1787,7 +1807,7 @@ def test_streaming_detect_intent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as 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. @@ -1891,8 +1911,15 @@ async def test_streaming_detect_intent_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + session.StreamingDetectIntentRequest(), + {}, + ], +) async def test_streaming_detect_intent_async( - transport: str = "grpc_asyncio", request_type=session.StreamingDetectIntentRequest + request_type, transport: str = "grpc_asyncio" ): client = SessionsAsyncClient( credentials=async_anonymous_credentials(), @@ -1901,7 +1928,7 @@ async def test_streaming_detect_intent_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. @@ -1925,16 +1952,11 @@ async def test_streaming_detect_intent_async( assert isinstance(message, session.StreamingDetectIntentResponse) -@pytest.mark.asyncio -async def test_streaming_detect_intent_async_from_dict(): - await test_streaming_detect_intent_async(request_type=dict) - - @pytest.mark.parametrize( "request_type", [ - session.MatchIntentRequest, - dict, + session.MatchIntentRequest(), + {}, ], ) def test_match_intent(request_type, transport: str = "grpc"): @@ -1945,7 +1967,7 @@ def test_match_intent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.match_intent), "__call__") as call: @@ -1988,9 +2010,10 @@ def test_match_intent_non_empty_request_with_auto_populated_field(): client.match_intent(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == session.MatchIntentRequest( + request_msg = session.MatchIntentRequest( session="session_value", ) + assert args[0] == request_msg def test_match_intent_use_cached_wrapped_rpc(): @@ -2071,9 +2094,14 @@ async def test_match_intent_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_match_intent_async( - transport: str = "grpc_asyncio", request_type=session.MatchIntentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + session.MatchIntentRequest(), + {}, + ], +) +async def test_match_intent_async(request_type, transport: str = "grpc_asyncio"): client = SessionsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2081,7 +2109,7 @@ async def test_match_intent_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.match_intent), "__call__") as call: @@ -2101,11 +2129,6 @@ async def test_match_intent_async( assert isinstance(response, session.MatchIntentResponse) -@pytest.mark.asyncio -async def test_match_intent_async_from_dict(): - await test_match_intent_async(request_type=dict) - - def test_match_intent_field_headers(): client = SessionsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2170,8 +2193,8 @@ async def test_match_intent_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - session.FulfillIntentRequest, - dict, + session.FulfillIntentRequest(), + {}, ], ) def test_fulfill_intent(request_type, transport: str = "grpc"): @@ -2182,7 +2205,7 @@ def test_fulfill_intent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.fulfill_intent), "__call__") as call: @@ -2226,7 +2249,8 @@ def test_fulfill_intent_non_empty_request_with_auto_populated_field(): client.fulfill_intent(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == session.FulfillIntentRequest() + request_msg = session.FulfillIntentRequest() + assert args[0] == request_msg def test_fulfill_intent_use_cached_wrapped_rpc(): @@ -2307,9 +2331,14 @@ async def test_fulfill_intent_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_fulfill_intent_async( - transport: str = "grpc_asyncio", request_type=session.FulfillIntentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + session.FulfillIntentRequest(), + {}, + ], +) +async def test_fulfill_intent_async(request_type, transport: str = "grpc_asyncio"): client = SessionsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2317,7 +2346,7 @@ async def test_fulfill_intent_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.fulfill_intent), "__call__") as call: @@ -2342,11 +2371,6 @@ async def test_fulfill_intent_async( assert response.output_audio == b"output_audio_blob" -@pytest.mark.asyncio -async def test_fulfill_intent_async_from_dict(): - await test_fulfill_intent_async(request_type=dict) - - def test_fulfill_intent_field_headers(): client = SessionsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2411,8 +2435,8 @@ async def test_fulfill_intent_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - session.SubmitAnswerFeedbackRequest, - dict, + session.SubmitAnswerFeedbackRequest(), + {}, ], ) def test_submit_answer_feedback(request_type, transport: str = "grpc"): @@ -2423,7 +2447,7 @@ def test_submit_answer_feedback(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2474,10 +2498,11 @@ def test_submit_answer_feedback_non_empty_request_with_auto_populated_field(): client.submit_answer_feedback(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == session.SubmitAnswerFeedbackRequest( + request_msg = session.SubmitAnswerFeedbackRequest( session="session_value", response_id="response_id_value", ) + assert args[0] == request_msg def test_submit_answer_feedback_use_cached_wrapped_rpc(): @@ -2563,8 +2588,15 @@ async def test_submit_answer_feedback_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + session.SubmitAnswerFeedbackRequest(), + {}, + ], +) async def test_submit_answer_feedback_async( - transport: str = "grpc_asyncio", request_type=session.SubmitAnswerFeedbackRequest + request_type, transport: str = "grpc_asyncio" ): client = SessionsAsyncClient( credentials=async_anonymous_credentials(), @@ -2573,7 +2605,7 @@ async def test_submit_answer_feedback_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( @@ -2600,11 +2632,6 @@ async def test_submit_answer_feedback_async( assert response.custom_rating == "custom_rating_value" -@pytest.mark.asyncio -async def test_submit_answer_feedback_async_from_dict(): - await test_submit_answer_feedback_async(request_type=dict) - - def test_submit_answer_feedback_field_headers(): client = SessionsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3385,7 +3412,6 @@ def test_detect_intent_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session.DetectIntentRequest() - assert args[0] == request_msg @@ -3408,7 +3434,6 @@ def test_server_streaming_detect_intent_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session.DetectIntentRequest() - assert args[0] == request_msg @@ -3429,7 +3454,6 @@ def test_match_intent_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session.MatchIntentRequest() - assert args[0] == request_msg @@ -3450,7 +3474,6 @@ def test_fulfill_intent_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session.FulfillIntentRequest() - assert args[0] == request_msg @@ -3473,7 +3496,6 @@ def test_submit_answer_feedback_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session.SubmitAnswerFeedbackRequest() - assert args[0] == request_msg @@ -3517,7 +3539,6 @@ async def test_detect_intent_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session.DetectIntentRequest() - assert args[0] == request_msg @@ -3545,7 +3566,6 @@ async def test_server_streaming_detect_intent_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session.DetectIntentRequest() - assert args[0] == request_msg @@ -3570,7 +3590,6 @@ async def test_match_intent_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session.MatchIntentRequest() - assert args[0] == request_msg @@ -3598,7 +3617,6 @@ async def test_fulfill_intent_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session.FulfillIntentRequest() - assert args[0] == request_msg @@ -3628,7 +3646,6 @@ async def test_submit_answer_feedback_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session.SubmitAnswerFeedbackRequest() - assert args[0] == request_msg @@ -4662,7 +4679,6 @@ def test_detect_intent_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session.DetectIntentRequest() - assert args[0] == request_msg @@ -4684,7 +4700,6 @@ def test_server_streaming_detect_intent_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session.DetectIntentRequest() - assert args[0] == request_msg @@ -4704,7 +4719,6 @@ def test_match_intent_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session.MatchIntentRequest() - assert args[0] == request_msg @@ -4724,7 +4738,6 @@ def test_fulfill_intent_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session.FulfillIntentRequest() - assert args[0] == request_msg @@ -4746,7 +4759,6 @@ def test_submit_answer_feedback_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session.SubmitAnswerFeedbackRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_test_cases.py b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_test_cases.py index 03335799d70e..b55f917f25b6 100644 --- a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_test_cases.py +++ b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_test_cases.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 @@ -132,6 +133,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" @@ -1294,8 +1310,8 @@ def test_test_cases_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - test_case.ListTestCasesRequest, - dict, + test_case.ListTestCasesRequest(), + {}, ], ) def test_list_test_cases(request_type, transport: str = "grpc"): @@ -1306,7 +1322,7 @@ def test_list_test_cases(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_test_cases), "__call__") as call: @@ -1351,10 +1367,11 @@ def test_list_test_cases_non_empty_request_with_auto_populated_field(): client.list_test_cases(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == test_case.ListTestCasesRequest( + request_msg = test_case.ListTestCasesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_test_cases_use_cached_wrapped_rpc(): @@ -1435,9 +1452,14 @@ async def test_list_test_cases_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_test_cases_async( - transport: str = "grpc_asyncio", request_type=test_case.ListTestCasesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + test_case.ListTestCasesRequest(), + {}, + ], +) +async def test_list_test_cases_async(request_type, transport: str = "grpc_asyncio"): client = TestCasesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1445,7 +1467,7 @@ async def test_list_test_cases_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_test_cases), "__call__") as call: @@ -1468,11 +1490,6 @@ async def test_list_test_cases_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_test_cases_async_from_dict(): - await test_list_test_cases_async(request_type=dict) - - def test_list_test_cases_field_headers(): client = TestCasesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1809,8 +1826,8 @@ async def test_list_test_cases_async_pages(): @pytest.mark.parametrize( "request_type", [ - test_case.BatchDeleteTestCasesRequest, - dict, + test_case.BatchDeleteTestCasesRequest(), + {}, ], ) def test_batch_delete_test_cases(request_type, transport: str = "grpc"): @@ -1821,7 +1838,7 @@ def test_batch_delete_test_cases(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1866,9 +1883,10 @@ def test_batch_delete_test_cases_non_empty_request_with_auto_populated_field(): client.batch_delete_test_cases(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == test_case.BatchDeleteTestCasesRequest( + request_msg = test_case.BatchDeleteTestCasesRequest( parent="parent_value", ) + assert args[0] == request_msg def test_batch_delete_test_cases_use_cached_wrapped_rpc(): @@ -1954,8 +1972,15 @@ async def test_batch_delete_test_cases_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + test_case.BatchDeleteTestCasesRequest(), + {}, + ], +) async def test_batch_delete_test_cases_async( - transport: str = "grpc_asyncio", request_type=test_case.BatchDeleteTestCasesRequest + request_type, transport: str = "grpc_asyncio" ): client = TestCasesAsyncClient( credentials=async_anonymous_credentials(), @@ -1964,7 +1989,7 @@ async def test_batch_delete_test_cases_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( @@ -1984,11 +2009,6 @@ async def test_batch_delete_test_cases_async( assert response is None -@pytest.mark.asyncio -async def test_batch_delete_test_cases_async_from_dict(): - await test_batch_delete_test_cases_async(request_type=dict) - - def test_batch_delete_test_cases_field_headers(): client = TestCasesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2139,8 +2159,8 @@ async def test_batch_delete_test_cases_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - test_case.GetTestCaseRequest, - dict, + test_case.GetTestCaseRequest(), + {}, ], ) def test_get_test_case(request_type, transport: str = "grpc"): @@ -2151,7 +2171,7 @@ def test_get_test_case(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_test_case), "__call__") as call: @@ -2201,9 +2221,10 @@ def test_get_test_case_non_empty_request_with_auto_populated_field(): client.get_test_case(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == test_case.GetTestCaseRequest( + request_msg = test_case.GetTestCaseRequest( name="name_value", ) + assert args[0] == request_msg def test_get_test_case_use_cached_wrapped_rpc(): @@ -2284,9 +2305,14 @@ async def test_get_test_case_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_test_case_async( - transport: str = "grpc_asyncio", request_type=test_case.GetTestCaseRequest -): +@pytest.mark.parametrize( + "request_type", + [ + test_case.GetTestCaseRequest(), + {}, + ], +) +async def test_get_test_case_async(request_type, transport: str = "grpc_asyncio"): client = TestCasesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2294,7 +2320,7 @@ async def test_get_test_case_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_test_case), "__call__") as call: @@ -2323,11 +2349,6 @@ async def test_get_test_case_async( assert response.notes == "notes_value" -@pytest.mark.asyncio -async def test_get_test_case_async_from_dict(): - await test_get_test_case_async(request_type=dict) - - def test_get_test_case_field_headers(): client = TestCasesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2470,8 +2491,8 @@ async def test_get_test_case_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcdc_test_case.CreateTestCaseRequest, - dict, + gcdc_test_case.CreateTestCaseRequest(), + {}, ], ) def test_create_test_case(request_type, transport: str = "grpc"): @@ -2482,7 +2503,7 @@ def test_create_test_case(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_test_case), "__call__") as call: @@ -2532,9 +2553,10 @@ def test_create_test_case_non_empty_request_with_auto_populated_field(): client.create_test_case(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcdc_test_case.CreateTestCaseRequest( + request_msg = gcdc_test_case.CreateTestCaseRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_test_case_use_cached_wrapped_rpc(): @@ -2617,9 +2639,14 @@ async def test_create_test_case_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_test_case_async( - transport: str = "grpc_asyncio", request_type=gcdc_test_case.CreateTestCaseRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcdc_test_case.CreateTestCaseRequest(), + {}, + ], +) +async def test_create_test_case_async(request_type, transport: str = "grpc_asyncio"): client = TestCasesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2627,7 +2654,7 @@ async def test_create_test_case_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_test_case), "__call__") as call: @@ -2656,11 +2683,6 @@ async def test_create_test_case_async( assert response.notes == "notes_value" -@pytest.mark.asyncio -async def test_create_test_case_async_from_dict(): - await test_create_test_case_async(request_type=dict) - - def test_create_test_case_field_headers(): client = TestCasesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2817,8 +2839,8 @@ async def test_create_test_case_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcdc_test_case.UpdateTestCaseRequest, - dict, + gcdc_test_case.UpdateTestCaseRequest(), + {}, ], ) def test_update_test_case(request_type, transport: str = "grpc"): @@ -2829,7 +2851,7 @@ def test_update_test_case(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_test_case), "__call__") as call: @@ -2877,7 +2899,8 @@ def test_update_test_case_non_empty_request_with_auto_populated_field(): client.update_test_case(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcdc_test_case.UpdateTestCaseRequest() + request_msg = gcdc_test_case.UpdateTestCaseRequest() + assert args[0] == request_msg def test_update_test_case_use_cached_wrapped_rpc(): @@ -2960,9 +2983,14 @@ async def test_update_test_case_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_test_case_async( - transport: str = "grpc_asyncio", request_type=gcdc_test_case.UpdateTestCaseRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcdc_test_case.UpdateTestCaseRequest(), + {}, + ], +) +async def test_update_test_case_async(request_type, transport: str = "grpc_asyncio"): client = TestCasesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2970,7 +2998,7 @@ async def test_update_test_case_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_test_case), "__call__") as call: @@ -2999,11 +3027,6 @@ async def test_update_test_case_async( assert response.notes == "notes_value" -@pytest.mark.asyncio -async def test_update_test_case_async_from_dict(): - await test_update_test_case_async(request_type=dict) - - def test_update_test_case_field_headers(): client = TestCasesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3160,8 +3183,8 @@ async def test_update_test_case_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - test_case.RunTestCaseRequest, - dict, + test_case.RunTestCaseRequest(), + {}, ], ) def test_run_test_case(request_type, transport: str = "grpc"): @@ -3172,7 +3195,7 @@ def test_run_test_case(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.run_test_case), "__call__") as call: @@ -3214,10 +3237,11 @@ def test_run_test_case_non_empty_request_with_auto_populated_field(): client.run_test_case(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == test_case.RunTestCaseRequest( + request_msg = test_case.RunTestCaseRequest( name="name_value", environment="environment_value", ) + assert args[0] == request_msg def test_run_test_case_use_cached_wrapped_rpc(): @@ -3308,9 +3332,14 @@ async def test_run_test_case_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_run_test_case_async( - transport: str = "grpc_asyncio", request_type=test_case.RunTestCaseRequest -): +@pytest.mark.parametrize( + "request_type", + [ + test_case.RunTestCaseRequest(), + {}, + ], +) +async def test_run_test_case_async(request_type, transport: str = "grpc_asyncio"): client = TestCasesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3318,7 +3347,7 @@ async def test_run_test_case_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.run_test_case), "__call__") as call: @@ -3338,11 +3367,6 @@ async def test_run_test_case_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_run_test_case_async_from_dict(): - await test_run_test_case_async(request_type=dict) - - def test_run_test_case_field_headers(): client = TestCasesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3407,8 +3431,8 @@ async def test_run_test_case_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - test_case.BatchRunTestCasesRequest, - dict, + test_case.BatchRunTestCasesRequest(), + {}, ], ) def test_batch_run_test_cases(request_type, transport: str = "grpc"): @@ -3419,7 +3443,7 @@ def test_batch_run_test_cases(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3465,10 +3489,11 @@ def test_batch_run_test_cases_non_empty_request_with_auto_populated_field(): client.batch_run_test_cases(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == test_case.BatchRunTestCasesRequest( + request_msg = test_case.BatchRunTestCasesRequest( parent="parent_value", environment="environment_value", ) + assert args[0] == request_msg def test_batch_run_test_cases_use_cached_wrapped_rpc(): @@ -3563,8 +3588,15 @@ async def test_batch_run_test_cases_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + test_case.BatchRunTestCasesRequest(), + {}, + ], +) async def test_batch_run_test_cases_async( - transport: str = "grpc_asyncio", request_type=test_case.BatchRunTestCasesRequest + request_type, transport: str = "grpc_asyncio" ): client = TestCasesAsyncClient( credentials=async_anonymous_credentials(), @@ -3573,7 +3605,7 @@ async def test_batch_run_test_cases_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( @@ -3595,11 +3627,6 @@ async def test_batch_run_test_cases_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_batch_run_test_cases_async_from_dict(): - await test_batch_run_test_cases_async(request_type=dict) - - def test_batch_run_test_cases_field_headers(): client = TestCasesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3668,8 +3695,8 @@ async def test_batch_run_test_cases_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - test_case.CalculateCoverageRequest, - dict, + test_case.CalculateCoverageRequest(), + {}, ], ) def test_calculate_coverage(request_type, transport: str = "grpc"): @@ -3680,7 +3707,7 @@ def test_calculate_coverage(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3728,9 +3755,10 @@ def test_calculate_coverage_non_empty_request_with_auto_populated_field(): client.calculate_coverage(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == test_case.CalculateCoverageRequest( + request_msg = test_case.CalculateCoverageRequest( agent="agent_value", ) + assert args[0] == request_msg def test_calculate_coverage_use_cached_wrapped_rpc(): @@ -3815,9 +3843,14 @@ async def test_calculate_coverage_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_calculate_coverage_async( - transport: str = "grpc_asyncio", request_type=test_case.CalculateCoverageRequest -): +@pytest.mark.parametrize( + "request_type", + [ + test_case.CalculateCoverageRequest(), + {}, + ], +) +async def test_calculate_coverage_async(request_type, transport: str = "grpc_asyncio"): client = TestCasesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3825,7 +3858,7 @@ async def test_calculate_coverage_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( @@ -3850,11 +3883,6 @@ async def test_calculate_coverage_async( assert response.agent == "agent_value" -@pytest.mark.asyncio -async def test_calculate_coverage_async_from_dict(): - await test_calculate_coverage_async(request_type=dict) - - def test_calculate_coverage_field_headers(): client = TestCasesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3923,8 +3951,8 @@ async def test_calculate_coverage_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - test_case.ImportTestCasesRequest, - dict, + test_case.ImportTestCasesRequest(), + {}, ], ) def test_import_test_cases(request_type, transport: str = "grpc"): @@ -3935,7 +3963,7 @@ def test_import_test_cases(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3981,10 +4009,11 @@ def test_import_test_cases_non_empty_request_with_auto_populated_field(): client.import_test_cases(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == test_case.ImportTestCasesRequest( + request_msg = test_case.ImportTestCasesRequest( parent="parent_value", gcs_uri="gcs_uri_value", ) + assert args[0] == request_msg def test_import_test_cases_use_cached_wrapped_rpc(): @@ -4077,9 +4106,14 @@ async def test_import_test_cases_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_import_test_cases_async( - transport: str = "grpc_asyncio", request_type=test_case.ImportTestCasesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + test_case.ImportTestCasesRequest(), + {}, + ], +) +async def test_import_test_cases_async(request_type, transport: str = "grpc_asyncio"): client = TestCasesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4087,7 +4121,7 @@ async def test_import_test_cases_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( @@ -4109,11 +4143,6 @@ async def test_import_test_cases_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_import_test_cases_async_from_dict(): - await test_import_test_cases_async(request_type=dict) - - def test_import_test_cases_field_headers(): client = TestCasesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4182,8 +4211,8 @@ async def test_import_test_cases_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - test_case.ExportTestCasesRequest, - dict, + test_case.ExportTestCasesRequest(), + {}, ], ) def test_export_test_cases(request_type, transport: str = "grpc"): @@ -4194,7 +4223,7 @@ def test_export_test_cases(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4241,11 +4270,12 @@ def test_export_test_cases_non_empty_request_with_auto_populated_field(): client.export_test_cases(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == test_case.ExportTestCasesRequest( + request_msg = test_case.ExportTestCasesRequest( parent="parent_value", gcs_uri="gcs_uri_value", filter="filter_value", ) + assert args[0] == request_msg def test_export_test_cases_use_cached_wrapped_rpc(): @@ -4338,9 +4368,14 @@ async def test_export_test_cases_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_export_test_cases_async( - transport: str = "grpc_asyncio", request_type=test_case.ExportTestCasesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + test_case.ExportTestCasesRequest(), + {}, + ], +) +async def test_export_test_cases_async(request_type, transport: str = "grpc_asyncio"): client = TestCasesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4348,7 +4383,7 @@ async def test_export_test_cases_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( @@ -4370,11 +4405,6 @@ async def test_export_test_cases_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_export_test_cases_async_from_dict(): - await test_export_test_cases_async(request_type=dict) - - def test_export_test_cases_field_headers(): client = TestCasesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4443,8 +4473,8 @@ async def test_export_test_cases_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - test_case.ListTestCaseResultsRequest, - dict, + test_case.ListTestCaseResultsRequest(), + {}, ], ) def test_list_test_case_results(request_type, transport: str = "grpc"): @@ -4455,7 +4485,7 @@ def test_list_test_case_results(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4505,11 +4535,12 @@ def test_list_test_case_results_non_empty_request_with_auto_populated_field(): client.list_test_case_results(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == test_case.ListTestCaseResultsRequest( + request_msg = test_case.ListTestCaseResultsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_test_case_results_use_cached_wrapped_rpc(): @@ -4595,8 +4626,15 @@ async def test_list_test_case_results_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + test_case.ListTestCaseResultsRequest(), + {}, + ], +) async def test_list_test_case_results_async( - transport: str = "grpc_asyncio", request_type=test_case.ListTestCaseResultsRequest + request_type, transport: str = "grpc_asyncio" ): client = TestCasesAsyncClient( credentials=async_anonymous_credentials(), @@ -4605,7 +4643,7 @@ async def test_list_test_case_results_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( @@ -4630,11 +4668,6 @@ async def test_list_test_case_results_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_test_case_results_async_from_dict(): - await test_list_test_case_results_async(request_type=dict) - - def test_list_test_case_results_field_headers(): client = TestCasesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4987,8 +5020,8 @@ async def test_list_test_case_results_async_pages(): @pytest.mark.parametrize( "request_type", [ - test_case.GetTestCaseResultRequest, - dict, + test_case.GetTestCaseResultRequest(), + {}, ], ) def test_get_test_case_result(request_type, transport: str = "grpc"): @@ -4999,7 +5032,7 @@ def test_get_test_case_result(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5051,9 +5084,10 @@ def test_get_test_case_result_non_empty_request_with_auto_populated_field(): client.get_test_case_result(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == test_case.GetTestCaseResultRequest( + request_msg = test_case.GetTestCaseResultRequest( name="name_value", ) + assert args[0] == request_msg def test_get_test_case_result_use_cached_wrapped_rpc(): @@ -5138,8 +5172,15 @@ async def test_get_test_case_result_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + test_case.GetTestCaseResultRequest(), + {}, + ], +) async def test_get_test_case_result_async( - transport: str = "grpc_asyncio", request_type=test_case.GetTestCaseResultRequest + request_type, transport: str = "grpc_asyncio" ): client = TestCasesAsyncClient( credentials=async_anonymous_credentials(), @@ -5148,7 +5189,7 @@ async def test_get_test_case_result_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( @@ -5177,11 +5218,6 @@ async def test_get_test_case_result_async( assert response.test_result == test_case.TestResult.PASSED -@pytest.mark.asyncio -async def test_get_test_case_result_async_from_dict(): - await test_get_test_case_result_async(request_type=dict) - - def test_get_test_case_result_field_headers(): client = TestCasesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7555,7 +7591,6 @@ def test_list_test_cases_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = test_case.ListTestCasesRequest() - assert args[0] == request_msg @@ -7578,7 +7613,6 @@ def test_batch_delete_test_cases_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = test_case.BatchDeleteTestCasesRequest() - assert args[0] == request_msg @@ -7599,7 +7633,6 @@ def test_get_test_case_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = test_case.GetTestCaseRequest() - assert args[0] == request_msg @@ -7620,7 +7653,6 @@ def test_create_test_case_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_test_case.CreateTestCaseRequest() - assert args[0] == request_msg @@ -7641,7 +7673,6 @@ def test_update_test_case_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_test_case.UpdateTestCaseRequest() - assert args[0] == request_msg @@ -7662,7 +7693,6 @@ def test_run_test_case_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = test_case.RunTestCaseRequest() - assert args[0] == request_msg @@ -7685,7 +7715,6 @@ def test_batch_run_test_cases_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = test_case.BatchRunTestCasesRequest() - assert args[0] == request_msg @@ -7708,7 +7737,6 @@ def test_calculate_coverage_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = test_case.CalculateCoverageRequest() - assert args[0] == request_msg @@ -7731,7 +7759,6 @@ def test_import_test_cases_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = test_case.ImportTestCasesRequest() - assert args[0] == request_msg @@ -7754,7 +7781,6 @@ def test_export_test_cases_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = test_case.ExportTestCasesRequest() - assert args[0] == request_msg @@ -7777,7 +7803,6 @@ def test_list_test_case_results_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = test_case.ListTestCaseResultsRequest() - assert args[0] == request_msg @@ -7800,7 +7825,6 @@ def test_get_test_case_result_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = test_case.GetTestCaseResultRequest() - assert args[0] == request_msg @@ -7841,7 +7865,6 @@ async def test_list_test_cases_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = test_case.ListTestCasesRequest() - assert args[0] == request_msg @@ -7866,7 +7889,6 @@ async def test_batch_delete_test_cases_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = test_case.BatchDeleteTestCasesRequest() - assert args[0] == request_msg @@ -7896,7 +7918,6 @@ async def test_get_test_case_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = test_case.GetTestCaseRequest() - assert args[0] == request_msg @@ -7926,7 +7947,6 @@ async def test_create_test_case_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_test_case.CreateTestCaseRequest() - assert args[0] == request_msg @@ -7956,7 +7976,6 @@ async def test_update_test_case_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_test_case.UpdateTestCaseRequest() - assert args[0] == request_msg @@ -7981,7 +8000,6 @@ async def test_run_test_case_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = test_case.RunTestCaseRequest() - assert args[0] == request_msg @@ -8008,7 +8026,6 @@ async def test_batch_run_test_cases_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = test_case.BatchRunTestCasesRequest() - assert args[0] == request_msg @@ -8037,7 +8054,6 @@ async def test_calculate_coverage_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = test_case.CalculateCoverageRequest() - assert args[0] == request_msg @@ -8064,7 +8080,6 @@ async def test_import_test_cases_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = test_case.ImportTestCasesRequest() - assert args[0] == request_msg @@ -8091,7 +8106,6 @@ async def test_export_test_cases_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = test_case.ExportTestCasesRequest() - assert args[0] == request_msg @@ -8120,7 +8134,6 @@ async def test_list_test_case_results_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = test_case.ListTestCaseResultsRequest() - assert args[0] == request_msg @@ -8151,7 +8164,6 @@ async def test_get_test_case_result_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = test_case.GetTestCaseResultRequest() - assert args[0] == request_msg @@ -10725,7 +10737,6 @@ def test_list_test_cases_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = test_case.ListTestCasesRequest() - assert args[0] == request_msg @@ -10747,7 +10758,6 @@ def test_batch_delete_test_cases_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = test_case.BatchDeleteTestCasesRequest() - assert args[0] == request_msg @@ -10767,7 +10777,6 @@ def test_get_test_case_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = test_case.GetTestCaseRequest() - assert args[0] == request_msg @@ -10787,7 +10796,6 @@ def test_create_test_case_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_test_case.CreateTestCaseRequest() - assert args[0] == request_msg @@ -10807,7 +10815,6 @@ def test_update_test_case_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_test_case.UpdateTestCaseRequest() - assert args[0] == request_msg @@ -10827,7 +10834,6 @@ def test_run_test_case_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = test_case.RunTestCaseRequest() - assert args[0] == request_msg @@ -10849,7 +10855,6 @@ def test_batch_run_test_cases_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = test_case.BatchRunTestCasesRequest() - assert args[0] == request_msg @@ -10871,7 +10876,6 @@ def test_calculate_coverage_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = test_case.CalculateCoverageRequest() - assert args[0] == request_msg @@ -10893,7 +10897,6 @@ def test_import_test_cases_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = test_case.ImportTestCasesRequest() - assert args[0] == request_msg @@ -10915,7 +10918,6 @@ def test_export_test_cases_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = test_case.ExportTestCasesRequest() - assert args[0] == request_msg @@ -10937,7 +10939,6 @@ def test_list_test_case_results_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = test_case.ListTestCaseResultsRequest() - assert args[0] == request_msg @@ -10959,7 +10960,6 @@ def test_get_test_case_result_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = test_case.GetTestCaseResultRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_tools.py b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_tools.py index 14e6f942660f..3d48c0606ef6 100644 --- a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_tools.py +++ b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_tools.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 @@ -113,6 +114,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" @@ -1244,8 +1260,8 @@ def test_tools_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - gcdc_tool.CreateToolRequest, - dict, + gcdc_tool.CreateToolRequest(), + {}, ], ) def test_create_tool(request_type, transport: str = "grpc"): @@ -1256,7 +1272,7 @@ def test_create_tool(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tool), "__call__") as call: @@ -1306,9 +1322,10 @@ def test_create_tool_non_empty_request_with_auto_populated_field(): client.create_tool(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcdc_tool.CreateToolRequest( + request_msg = gcdc_tool.CreateToolRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_tool_use_cached_wrapped_rpc(): @@ -1389,9 +1406,14 @@ async def test_create_tool_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_tool_async( - transport: str = "grpc_asyncio", request_type=gcdc_tool.CreateToolRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcdc_tool.CreateToolRequest(), + {}, + ], +) +async def test_create_tool_async(request_type, transport: str = "grpc_asyncio"): client = ToolsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1399,7 +1421,7 @@ async def test_create_tool_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_tool), "__call__") as call: @@ -1428,11 +1450,6 @@ async def test_create_tool_async( assert response.tool_type == gcdc_tool.Tool.ToolType.CUSTOMIZED_TOOL -@pytest.mark.asyncio -async def test_create_tool_async_from_dict(): - await test_create_tool_async(request_type=dict) - - def test_create_tool_field_headers(): client = ToolsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1585,8 +1602,8 @@ async def test_create_tool_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - tool.ListToolsRequest, - dict, + tool.ListToolsRequest(), + {}, ], ) def test_list_tools(request_type, transport: str = "grpc"): @@ -1597,7 +1614,7 @@ def test_list_tools(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tools), "__call__") as call: @@ -1642,10 +1659,11 @@ def test_list_tools_non_empty_request_with_auto_populated_field(): client.list_tools(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tool.ListToolsRequest( + request_msg = tool.ListToolsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_tools_use_cached_wrapped_rpc(): @@ -1724,9 +1742,14 @@ async def test_list_tools_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_list_tools_async( - transport: str = "grpc_asyncio", request_type=tool.ListToolsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tool.ListToolsRequest(), + {}, + ], +) +async def test_list_tools_async(request_type, transport: str = "grpc_asyncio"): client = ToolsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1734,7 +1757,7 @@ async def test_list_tools_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_tools), "__call__") as call: @@ -1757,11 +1780,6 @@ async def test_list_tools_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_tools_async_from_dict(): - await test_list_tools_async(request_type=dict) - - def test_list_tools_field_headers(): client = ToolsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2098,8 +2116,8 @@ async def test_list_tools_async_pages(): @pytest.mark.parametrize( "request_type", [ - tool.GetToolRequest, - dict, + tool.GetToolRequest(), + {}, ], ) def test_get_tool(request_type, transport: str = "grpc"): @@ -2110,7 +2128,7 @@ def test_get_tool(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tool), "__call__") as call: @@ -2160,9 +2178,10 @@ def test_get_tool_non_empty_request_with_auto_populated_field(): client.get_tool(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tool.GetToolRequest( + request_msg = tool.GetToolRequest( name="name_value", ) + assert args[0] == request_msg def test_get_tool_use_cached_wrapped_rpc(): @@ -2241,9 +2260,14 @@ async def test_get_tool_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn @pytest.mark.asyncio -async def test_get_tool_async( - transport: str = "grpc_asyncio", request_type=tool.GetToolRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tool.GetToolRequest(), + {}, + ], +) +async def test_get_tool_async(request_type, transport: str = "grpc_asyncio"): client = ToolsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2251,7 +2275,7 @@ async def test_get_tool_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_tool), "__call__") as call: @@ -2280,11 +2304,6 @@ async def test_get_tool_async( assert response.tool_type == tool.Tool.ToolType.CUSTOMIZED_TOOL -@pytest.mark.asyncio -async def test_get_tool_async_from_dict(): - await test_get_tool_async(request_type=dict) - - def test_get_tool_field_headers(): client = ToolsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2427,8 +2446,8 @@ async def test_get_tool_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcdc_tool.UpdateToolRequest, - dict, + gcdc_tool.UpdateToolRequest(), + {}, ], ) def test_update_tool(request_type, transport: str = "grpc"): @@ -2439,7 +2458,7 @@ def test_update_tool(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tool), "__call__") as call: @@ -2487,7 +2506,8 @@ def test_update_tool_non_empty_request_with_auto_populated_field(): client.update_tool(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcdc_tool.UpdateToolRequest() + request_msg = gcdc_tool.UpdateToolRequest() + assert args[0] == request_msg def test_update_tool_use_cached_wrapped_rpc(): @@ -2568,9 +2588,14 @@ async def test_update_tool_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_tool_async( - transport: str = "grpc_asyncio", request_type=gcdc_tool.UpdateToolRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcdc_tool.UpdateToolRequest(), + {}, + ], +) +async def test_update_tool_async(request_type, transport: str = "grpc_asyncio"): client = ToolsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2578,7 +2603,7 @@ async def test_update_tool_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_tool), "__call__") as call: @@ -2607,11 +2632,6 @@ async def test_update_tool_async( assert response.tool_type == gcdc_tool.Tool.ToolType.CUSTOMIZED_TOOL -@pytest.mark.asyncio -async def test_update_tool_async_from_dict(): - await test_update_tool_async(request_type=dict) - - def test_update_tool_field_headers(): client = ToolsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2764,8 +2784,8 @@ async def test_update_tool_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - tool.DeleteToolRequest, - dict, + tool.DeleteToolRequest(), + {}, ], ) def test_delete_tool(request_type, transport: str = "grpc"): @@ -2776,7 +2796,7 @@ def test_delete_tool(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tool), "__call__") as call: @@ -2817,9 +2837,10 @@ def test_delete_tool_non_empty_request_with_auto_populated_field(): client.delete_tool(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tool.DeleteToolRequest( + request_msg = tool.DeleteToolRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_tool_use_cached_wrapped_rpc(): @@ -2900,9 +2921,14 @@ async def test_delete_tool_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_tool_async( - transport: str = "grpc_asyncio", request_type=tool.DeleteToolRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tool.DeleteToolRequest(), + {}, + ], +) +async def test_delete_tool_async(request_type, transport: str = "grpc_asyncio"): client = ToolsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2910,7 +2936,7 @@ async def test_delete_tool_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_tool), "__call__") as call: @@ -2928,11 +2954,6 @@ async def test_delete_tool_async( assert response is None -@pytest.mark.asyncio -async def test_delete_tool_async_from_dict(): - await test_delete_tool_async(request_type=dict) - - def test_delete_tool_field_headers(): client = ToolsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3075,8 +3096,8 @@ async def test_delete_tool_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - tool.ListToolVersionsRequest, - dict, + tool.ListToolVersionsRequest(), + {}, ], ) def test_list_tool_versions(request_type, transport: str = "grpc"): @@ -3087,7 +3108,7 @@ def test_list_tool_versions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3136,10 +3157,11 @@ def test_list_tool_versions_non_empty_request_with_auto_populated_field(): client.list_tool_versions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tool.ListToolVersionsRequest( + request_msg = tool.ListToolVersionsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_tool_versions_use_cached_wrapped_rpc(): @@ -3224,9 +3246,14 @@ async def test_list_tool_versions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_tool_versions_async( - transport: str = "grpc_asyncio", request_type=tool.ListToolVersionsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tool.ListToolVersionsRequest(), + {}, + ], +) +async def test_list_tool_versions_async(request_type, transport: str = "grpc_asyncio"): client = ToolsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3234,7 +3261,7 @@ async def test_list_tool_versions_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( @@ -3259,11 +3286,6 @@ async def test_list_tool_versions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_tool_versions_async_from_dict(): - await test_list_tool_versions_async(request_type=dict) - - def test_list_tool_versions_field_headers(): client = ToolsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3616,8 +3638,8 @@ async def test_list_tool_versions_async_pages(): @pytest.mark.parametrize( "request_type", [ - tool.CreateToolVersionRequest, - dict, + tool.CreateToolVersionRequest(), + {}, ], ) def test_create_tool_version(request_type, transport: str = "grpc"): @@ -3628,7 +3650,7 @@ def test_create_tool_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3678,9 +3700,10 @@ def test_create_tool_version_non_empty_request_with_auto_populated_field(): client.create_tool_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tool.CreateToolVersionRequest( + request_msg = tool.CreateToolVersionRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_tool_version_use_cached_wrapped_rpc(): @@ -3765,9 +3788,14 @@ async def test_create_tool_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_tool_version_async( - transport: str = "grpc_asyncio", request_type=tool.CreateToolVersionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tool.CreateToolVersionRequest(), + {}, + ], +) +async def test_create_tool_version_async(request_type, transport: str = "grpc_asyncio"): client = ToolsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3775,7 +3803,7 @@ async def test_create_tool_version_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( @@ -3802,11 +3830,6 @@ async def test_create_tool_version_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_create_tool_version_async_from_dict(): - await test_create_tool_version_async(request_type=dict) - - def test_create_tool_version_field_headers(): client = ToolsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3967,8 +3990,8 @@ async def test_create_tool_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - tool.GetToolVersionRequest, - dict, + tool.GetToolVersionRequest(), + {}, ], ) def test_get_tool_version(request_type, transport: str = "grpc"): @@ -3979,7 +4002,7 @@ def test_get_tool_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tool_version), "__call__") as call: @@ -4025,9 +4048,10 @@ def test_get_tool_version_non_empty_request_with_auto_populated_field(): client.get_tool_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tool.GetToolVersionRequest( + request_msg = tool.GetToolVersionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_tool_version_use_cached_wrapped_rpc(): @@ -4110,9 +4134,14 @@ async def test_get_tool_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_tool_version_async( - transport: str = "grpc_asyncio", request_type=tool.GetToolVersionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tool.GetToolVersionRequest(), + {}, + ], +) +async def test_get_tool_version_async(request_type, transport: str = "grpc_asyncio"): client = ToolsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4120,7 +4149,7 @@ async def test_get_tool_version_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_tool_version), "__call__") as call: @@ -4145,11 +4174,6 @@ async def test_get_tool_version_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_get_tool_version_async_from_dict(): - await test_get_tool_version_async(request_type=dict) - - def test_get_tool_version_field_headers(): client = ToolsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4292,8 +4316,8 @@ async def test_get_tool_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - tool.DeleteToolVersionRequest, - dict, + tool.DeleteToolVersionRequest(), + {}, ], ) def test_delete_tool_version(request_type, transport: str = "grpc"): @@ -4304,7 +4328,7 @@ def test_delete_tool_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4349,9 +4373,10 @@ def test_delete_tool_version_non_empty_request_with_auto_populated_field(): client.delete_tool_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tool.DeleteToolVersionRequest( + request_msg = tool.DeleteToolVersionRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_tool_version_use_cached_wrapped_rpc(): @@ -4436,9 +4461,14 @@ async def test_delete_tool_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_tool_version_async( - transport: str = "grpc_asyncio", request_type=tool.DeleteToolVersionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tool.DeleteToolVersionRequest(), + {}, + ], +) +async def test_delete_tool_version_async(request_type, transport: str = "grpc_asyncio"): client = ToolsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4446,7 +4476,7 @@ async def test_delete_tool_version_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( @@ -4466,11 +4496,6 @@ async def test_delete_tool_version_async( assert response is None -@pytest.mark.asyncio -async def test_delete_tool_version_async_from_dict(): - await test_delete_tool_version_async(request_type=dict) - - def test_delete_tool_version_field_headers(): client = ToolsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4621,8 +4646,8 @@ async def test_delete_tool_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - tool.RestoreToolVersionRequest, - dict, + tool.RestoreToolVersionRequest(), + {}, ], ) def test_restore_tool_version(request_type, transport: str = "grpc"): @@ -4633,7 +4658,7 @@ def test_restore_tool_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4678,9 +4703,10 @@ def test_restore_tool_version_non_empty_request_with_auto_populated_field(): client.restore_tool_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tool.RestoreToolVersionRequest( + request_msg = tool.RestoreToolVersionRequest( name="name_value", ) + assert args[0] == request_msg def test_restore_tool_version_use_cached_wrapped_rpc(): @@ -4765,8 +4791,15 @@ async def test_restore_tool_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + tool.RestoreToolVersionRequest(), + {}, + ], +) async def test_restore_tool_version_async( - transport: str = "grpc_asyncio", request_type=tool.RestoreToolVersionRequest + request_type, transport: str = "grpc_asyncio" ): client = ToolsAsyncClient( credentials=async_anonymous_credentials(), @@ -4775,7 +4808,7 @@ async def test_restore_tool_version_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( @@ -4797,11 +4830,6 @@ async def test_restore_tool_version_async( assert isinstance(response, tool.RestoreToolVersionResponse) -@pytest.mark.asyncio -async def test_restore_tool_version_async_from_dict(): - await test_restore_tool_version_async(request_type=dict) - - def test_restore_tool_version_field_headers(): client = ToolsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7051,7 +7079,6 @@ def test_create_tool_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_tool.CreateToolRequest() - assert args[0] == request_msg @@ -7072,7 +7099,6 @@ def test_list_tools_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool.ListToolsRequest() - assert args[0] == request_msg @@ -7093,7 +7119,6 @@ def test_get_tool_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool.GetToolRequest() - assert args[0] == request_msg @@ -7114,7 +7139,6 @@ def test_update_tool_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_tool.UpdateToolRequest() - assert args[0] == request_msg @@ -7135,7 +7159,6 @@ def test_delete_tool_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool.DeleteToolRequest() - assert args[0] == request_msg @@ -7158,7 +7181,6 @@ def test_list_tool_versions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool.ListToolVersionsRequest() - assert args[0] == request_msg @@ -7181,7 +7203,6 @@ def test_create_tool_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool.CreateToolVersionRequest() - assert args[0] == request_msg @@ -7202,7 +7223,6 @@ def test_get_tool_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool.GetToolVersionRequest() - assert args[0] == request_msg @@ -7225,7 +7245,6 @@ def test_delete_tool_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool.DeleteToolVersionRequest() - assert args[0] == request_msg @@ -7248,7 +7267,6 @@ def test_restore_tool_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool.RestoreToolVersionRequest() - assert args[0] == request_msg @@ -7292,7 +7310,6 @@ async def test_create_tool_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_tool.CreateToolRequest() - assert args[0] == request_msg @@ -7319,7 +7336,6 @@ async def test_list_tools_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool.ListToolsRequest() - assert args[0] == request_msg @@ -7349,7 +7365,6 @@ async def test_get_tool_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool.GetToolRequest() - assert args[0] == request_msg @@ -7379,7 +7394,6 @@ async def test_update_tool_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_tool.UpdateToolRequest() - assert args[0] == request_msg @@ -7402,7 +7416,6 @@ async def test_delete_tool_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool.DeleteToolRequest() - assert args[0] == request_msg @@ -7431,7 +7444,6 @@ async def test_list_tool_versions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool.ListToolVersionsRequest() - assert args[0] == request_msg @@ -7461,7 +7473,6 @@ async def test_create_tool_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool.CreateToolVersionRequest() - assert args[0] == request_msg @@ -7489,7 +7500,6 @@ async def test_get_tool_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool.GetToolVersionRequest() - assert args[0] == request_msg @@ -7514,7 +7524,6 @@ async def test_delete_tool_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool.DeleteToolVersionRequest() - assert args[0] == request_msg @@ -7541,7 +7550,6 @@ async def test_restore_tool_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool.RestoreToolVersionRequest() - assert args[0] == request_msg @@ -9488,7 +9496,6 @@ def test_create_tool_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_tool.CreateToolRequest() - assert args[0] == request_msg @@ -9508,7 +9515,6 @@ def test_list_tools_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool.ListToolsRequest() - assert args[0] == request_msg @@ -9528,7 +9534,6 @@ def test_get_tool_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool.GetToolRequest() - assert args[0] == request_msg @@ -9548,7 +9553,6 @@ def test_update_tool_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_tool.UpdateToolRequest() - assert args[0] == request_msg @@ -9568,7 +9572,6 @@ def test_delete_tool_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool.DeleteToolRequest() - assert args[0] == request_msg @@ -9590,7 +9593,6 @@ def test_list_tool_versions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool.ListToolVersionsRequest() - assert args[0] == request_msg @@ -9612,7 +9614,6 @@ def test_create_tool_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool.CreateToolVersionRequest() - assert args[0] == request_msg @@ -9632,7 +9633,6 @@ def test_get_tool_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool.GetToolVersionRequest() - assert args[0] == request_msg @@ -9654,7 +9654,6 @@ def test_delete_tool_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool.DeleteToolVersionRequest() - assert args[0] == request_msg @@ -9676,7 +9675,6 @@ def test_restore_tool_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool.RestoreToolVersionRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_transition_route_groups.py b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_transition_route_groups.py index 2a980e59c323..fe4f74236698 100644 --- a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_transition_route_groups.py +++ b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_transition_route_groups.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 @@ -123,6 +124,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" @@ -1391,8 +1407,8 @@ def test_transition_route_groups_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - transition_route_group.ListTransitionRouteGroupsRequest, - dict, + transition_route_group.ListTransitionRouteGroupsRequest(), + {}, ], ) def test_list_transition_route_groups(request_type, transport: str = "grpc"): @@ -1403,7 +1419,7 @@ def test_list_transition_route_groups(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1453,11 +1469,12 @@ def test_list_transition_route_groups_non_empty_request_with_auto_populated_fiel client.list_transition_route_groups(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == transition_route_group.ListTransitionRouteGroupsRequest( + request_msg = transition_route_group.ListTransitionRouteGroupsRequest( parent="parent_value", page_token="page_token_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_list_transition_route_groups_use_cached_wrapped_rpc(): @@ -1543,9 +1560,15 @@ async def test_list_transition_route_groups_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + transition_route_group.ListTransitionRouteGroupsRequest(), + {}, + ], +) async def test_list_transition_route_groups_async( - transport: str = "grpc_asyncio", - request_type=transition_route_group.ListTransitionRouteGroupsRequest, + request_type, transport: str = "grpc_asyncio" ): client = TransitionRouteGroupsAsyncClient( credentials=async_anonymous_credentials(), @@ -1554,7 +1577,7 @@ async def test_list_transition_route_groups_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( @@ -1579,11 +1602,6 @@ async def test_list_transition_route_groups_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_transition_route_groups_async_from_dict(): - await test_list_transition_route_groups_async(request_type=dict) - - def test_list_transition_route_groups_field_headers(): client = TransitionRouteGroupsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1945,8 +1963,8 @@ async def test_list_transition_route_groups_async_pages(): @pytest.mark.parametrize( "request_type", [ - transition_route_group.GetTransitionRouteGroupRequest, - dict, + transition_route_group.GetTransitionRouteGroupRequest(), + {}, ], ) def test_get_transition_route_group(request_type, transport: str = "grpc"): @@ -1957,7 +1975,7 @@ def test_get_transition_route_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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 +2026,11 @@ def test_get_transition_route_group_non_empty_request_with_auto_populated_field( client.get_transition_route_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == transition_route_group.GetTransitionRouteGroupRequest( + request_msg = transition_route_group.GetTransitionRouteGroupRequest( name="name_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_get_transition_route_group_use_cached_wrapped_rpc(): @@ -2097,9 +2116,15 @@ async def test_get_transition_route_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + transition_route_group.GetTransitionRouteGroupRequest(), + {}, + ], +) async def test_get_transition_route_group_async( - transport: str = "grpc_asyncio", - request_type=transition_route_group.GetTransitionRouteGroupRequest, + request_type, transport: str = "grpc_asyncio" ): client = TransitionRouteGroupsAsyncClient( credentials=async_anonymous_credentials(), @@ -2108,7 +2133,7 @@ async def test_get_transition_route_group_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( @@ -2135,11 +2160,6 @@ async def test_get_transition_route_group_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_get_transition_route_group_async_from_dict(): - await test_get_transition_route_group_async(request_type=dict) - - def test_get_transition_route_group_field_headers(): client = TransitionRouteGroupsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2294,8 +2314,8 @@ async def test_get_transition_route_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcdc_transition_route_group.CreateTransitionRouteGroupRequest, - dict, + gcdc_transition_route_group.CreateTransitionRouteGroupRequest(), + {}, ], ) def test_create_transition_route_group(request_type, transport: str = "grpc"): @@ -2306,7 +2326,7 @@ def test_create_transition_route_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2357,10 +2377,11 @@ def test_create_transition_route_group_non_empty_request_with_auto_populated_fie client.create_transition_route_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcdc_transition_route_group.CreateTransitionRouteGroupRequest( + request_msg = gcdc_transition_route_group.CreateTransitionRouteGroupRequest( parent="parent_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_create_transition_route_group_use_cached_wrapped_rpc(): @@ -2446,9 +2467,15 @@ async def test_create_transition_route_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcdc_transition_route_group.CreateTransitionRouteGroupRequest(), + {}, + ], +) async def test_create_transition_route_group_async( - transport: str = "grpc_asyncio", - request_type=gcdc_transition_route_group.CreateTransitionRouteGroupRequest, + request_type, transport: str = "grpc_asyncio" ): client = TransitionRouteGroupsAsyncClient( credentials=async_anonymous_credentials(), @@ -2457,7 +2484,7 @@ async def test_create_transition_route_group_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( @@ -2484,11 +2511,6 @@ async def test_create_transition_route_group_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_create_transition_route_group_async_from_dict(): - await test_create_transition_route_group_async(request_type=dict) - - def test_create_transition_route_group_field_headers(): client = TransitionRouteGroupsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2661,8 +2683,8 @@ async def test_create_transition_route_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcdc_transition_route_group.UpdateTransitionRouteGroupRequest, - dict, + gcdc_transition_route_group.UpdateTransitionRouteGroupRequest(), + {}, ], ) def test_update_transition_route_group(request_type, transport: str = "grpc"): @@ -2673,7 +2695,7 @@ def test_update_transition_route_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2723,9 +2745,10 @@ def test_update_transition_route_group_non_empty_request_with_auto_populated_fie client.update_transition_route_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcdc_transition_route_group.UpdateTransitionRouteGroupRequest( + request_msg = gcdc_transition_route_group.UpdateTransitionRouteGroupRequest( language_code="language_code_value", ) + assert args[0] == request_msg def test_update_transition_route_group_use_cached_wrapped_rpc(): @@ -2811,9 +2834,15 @@ async def test_update_transition_route_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcdc_transition_route_group.UpdateTransitionRouteGroupRequest(), + {}, + ], +) async def test_update_transition_route_group_async( - transport: str = "grpc_asyncio", - request_type=gcdc_transition_route_group.UpdateTransitionRouteGroupRequest, + request_type, transport: str = "grpc_asyncio" ): client = TransitionRouteGroupsAsyncClient( credentials=async_anonymous_credentials(), @@ -2822,7 +2851,7 @@ async def test_update_transition_route_group_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( @@ -2849,11 +2878,6 @@ async def test_update_transition_route_group_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_update_transition_route_group_async_from_dict(): - await test_update_transition_route_group_async(request_type=dict) - - def test_update_transition_route_group_field_headers(): client = TransitionRouteGroupsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3026,8 +3050,8 @@ async def test_update_transition_route_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - transition_route_group.DeleteTransitionRouteGroupRequest, - dict, + transition_route_group.DeleteTransitionRouteGroupRequest(), + {}, ], ) def test_delete_transition_route_group(request_type, transport: str = "grpc"): @@ -3038,7 +3062,7 @@ def test_delete_transition_route_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3083,9 +3107,10 @@ def test_delete_transition_route_group_non_empty_request_with_auto_populated_fie client.delete_transition_route_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == transition_route_group.DeleteTransitionRouteGroupRequest( + request_msg = transition_route_group.DeleteTransitionRouteGroupRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_transition_route_group_use_cached_wrapped_rpc(): @@ -3171,9 +3196,15 @@ async def test_delete_transition_route_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + transition_route_group.DeleteTransitionRouteGroupRequest(), + {}, + ], +) async def test_delete_transition_route_group_async( - transport: str = "grpc_asyncio", - request_type=transition_route_group.DeleteTransitionRouteGroupRequest, + request_type, transport: str = "grpc_asyncio" ): client = TransitionRouteGroupsAsyncClient( credentials=async_anonymous_credentials(), @@ -3182,7 +3213,7 @@ async def test_delete_transition_route_group_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( @@ -3202,11 +3233,6 @@ async def test_delete_transition_route_group_async( assert response is None -@pytest.mark.asyncio -async def test_delete_transition_route_group_async_from_dict(): - await test_delete_transition_route_group_async(request_type=dict) - - def test_delete_transition_route_group_field_headers(): client = TransitionRouteGroupsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4538,7 +4564,6 @@ def test_list_transition_route_groups_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transition_route_group.ListTransitionRouteGroupsRequest() - assert args[0] == request_msg @@ -4561,7 +4586,6 @@ def test_get_transition_route_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transition_route_group.GetTransitionRouteGroupRequest() - assert args[0] == request_msg @@ -4584,7 +4608,6 @@ def test_create_transition_route_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_transition_route_group.CreateTransitionRouteGroupRequest() - assert args[0] == request_msg @@ -4607,7 +4630,6 @@ def test_update_transition_route_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_transition_route_group.UpdateTransitionRouteGroupRequest() - assert args[0] == request_msg @@ -4630,7 +4652,6 @@ def test_delete_transition_route_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transition_route_group.DeleteTransitionRouteGroupRequest() - assert args[0] == request_msg @@ -4673,7 +4694,6 @@ async def test_list_transition_route_groups_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transition_route_group.ListTransitionRouteGroupsRequest() - assert args[0] == request_msg @@ -4703,7 +4723,6 @@ async def test_get_transition_route_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transition_route_group.GetTransitionRouteGroupRequest() - assert args[0] == request_msg @@ -4733,7 +4752,6 @@ async def test_create_transition_route_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_transition_route_group.CreateTransitionRouteGroupRequest() - assert args[0] == request_msg @@ -4763,7 +4781,6 @@ async def test_update_transition_route_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_transition_route_group.UpdateTransitionRouteGroupRequest() - assert args[0] == request_msg @@ -4788,7 +4805,6 @@ async def test_delete_transition_route_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transition_route_group.DeleteTransitionRouteGroupRequest() - assert args[0] == request_msg @@ -6202,7 +6218,6 @@ def test_list_transition_route_groups_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transition_route_group.ListTransitionRouteGroupsRequest() - assert args[0] == request_msg @@ -6224,7 +6239,6 @@ def test_get_transition_route_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transition_route_group.GetTransitionRouteGroupRequest() - assert args[0] == request_msg @@ -6246,7 +6260,6 @@ def test_create_transition_route_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_transition_route_group.CreateTransitionRouteGroupRequest() - assert args[0] == request_msg @@ -6268,7 +6281,6 @@ def test_update_transition_route_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_transition_route_group.UpdateTransitionRouteGroupRequest() - assert args[0] == request_msg @@ -6290,7 +6302,6 @@ def test_delete_transition_route_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transition_route_group.DeleteTransitionRouteGroupRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_versions.py b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_versions.py index e2ab5b48be96..144b93a91ba7 100644 --- a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_versions.py +++ b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_versions.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 @@ -118,6 +119,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" @@ -1265,8 +1281,8 @@ def test_versions_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - version.ListVersionsRequest, - dict, + version.ListVersionsRequest(), + {}, ], ) def test_list_versions(request_type, transport: str = "grpc"): @@ -1277,7 +1293,7 @@ def test_list_versions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_versions), "__call__") as call: @@ -1322,10 +1338,11 @@ def test_list_versions_non_empty_request_with_auto_populated_field(): client.list_versions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == version.ListVersionsRequest( + request_msg = version.ListVersionsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_versions_use_cached_wrapped_rpc(): @@ -1406,9 +1423,14 @@ async def test_list_versions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_versions_async( - transport: str = "grpc_asyncio", request_type=version.ListVersionsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + version.ListVersionsRequest(), + {}, + ], +) +async def test_list_versions_async(request_type, transport: str = "grpc_asyncio"): client = VersionsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1416,7 +1438,7 @@ async def test_list_versions_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_versions), "__call__") as call: @@ -1439,11 +1461,6 @@ async def test_list_versions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_versions_async_from_dict(): - await test_list_versions_async(request_type=dict) - - def test_list_versions_field_headers(): client = VersionsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1780,8 +1797,8 @@ async def test_list_versions_async_pages(): @pytest.mark.parametrize( "request_type", [ - version.GetVersionRequest, - dict, + version.GetVersionRequest(), + {}, ], ) def test_get_version(request_type, transport: str = "grpc"): @@ -1792,7 +1809,7 @@ def test_get_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_version), "__call__") as call: @@ -1842,9 +1859,10 @@ def test_get_version_non_empty_request_with_auto_populated_field(): client.get_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == version.GetVersionRequest( + request_msg = version.GetVersionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_version_use_cached_wrapped_rpc(): @@ -1925,9 +1943,14 @@ async def test_get_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_version_async( - transport: str = "grpc_asyncio", request_type=version.GetVersionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + version.GetVersionRequest(), + {}, + ], +) +async def test_get_version_async(request_type, transport: str = "grpc_asyncio"): client = VersionsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1935,7 +1958,7 @@ async def test_get_version_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_version), "__call__") as call: @@ -1964,11 +1987,6 @@ async def test_get_version_async( assert response.state == version.Version.State.RUNNING -@pytest.mark.asyncio -async def test_get_version_async_from_dict(): - await test_get_version_async(request_type=dict) - - def test_get_version_field_headers(): client = VersionsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2111,8 +2129,8 @@ async def test_get_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcdc_version.CreateVersionRequest, - dict, + gcdc_version.CreateVersionRequest(), + {}, ], ) def test_create_version(request_type, transport: str = "grpc"): @@ -2123,7 +2141,7 @@ def test_create_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_version), "__call__") as call: @@ -2164,9 +2182,10 @@ def test_create_version_non_empty_request_with_auto_populated_field(): client.create_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcdc_version.CreateVersionRequest( + request_msg = gcdc_version.CreateVersionRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_version_use_cached_wrapped_rpc(): @@ -2257,9 +2276,14 @@ async def test_create_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_version_async( - transport: str = "grpc_asyncio", request_type=gcdc_version.CreateVersionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcdc_version.CreateVersionRequest(), + {}, + ], +) +async def test_create_version_async(request_type, transport: str = "grpc_asyncio"): client = VersionsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2267,7 +2291,7 @@ async def test_create_version_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_version), "__call__") as call: @@ -2287,11 +2311,6 @@ async def test_create_version_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_version_async_from_dict(): - await test_create_version_async(request_type=dict) - - def test_create_version_field_headers(): client = VersionsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2448,8 +2467,8 @@ async def test_create_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcdc_version.UpdateVersionRequest, - dict, + gcdc_version.UpdateVersionRequest(), + {}, ], ) def test_update_version(request_type, transport: str = "grpc"): @@ -2460,7 +2479,7 @@ def test_update_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_version), "__call__") as call: @@ -2508,7 +2527,8 @@ def test_update_version_non_empty_request_with_auto_populated_field(): client.update_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcdc_version.UpdateVersionRequest() + request_msg = gcdc_version.UpdateVersionRequest() + assert args[0] == request_msg def test_update_version_use_cached_wrapped_rpc(): @@ -2589,9 +2609,14 @@ async def test_update_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_version_async( - transport: str = "grpc_asyncio", request_type=gcdc_version.UpdateVersionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcdc_version.UpdateVersionRequest(), + {}, + ], +) +async def test_update_version_async(request_type, transport: str = "grpc_asyncio"): client = VersionsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2599,7 +2624,7 @@ async def test_update_version_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_version), "__call__") as call: @@ -2628,11 +2653,6 @@ async def test_update_version_async( assert response.state == gcdc_version.Version.State.RUNNING -@pytest.mark.asyncio -async def test_update_version_async_from_dict(): - await test_update_version_async(request_type=dict) - - def test_update_version_field_headers(): client = VersionsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2789,8 +2809,8 @@ async def test_update_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - version.DeleteVersionRequest, - dict, + version.DeleteVersionRequest(), + {}, ], ) def test_delete_version(request_type, transport: str = "grpc"): @@ -2801,7 +2821,7 @@ def test_delete_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_version), "__call__") as call: @@ -2842,9 +2862,10 @@ def test_delete_version_non_empty_request_with_auto_populated_field(): client.delete_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == version.DeleteVersionRequest( + request_msg = version.DeleteVersionRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_version_use_cached_wrapped_rpc(): @@ -2925,9 +2946,14 @@ async def test_delete_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_version_async( - transport: str = "grpc_asyncio", request_type=version.DeleteVersionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + version.DeleteVersionRequest(), + {}, + ], +) +async def test_delete_version_async(request_type, transport: str = "grpc_asyncio"): client = VersionsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2935,7 +2961,7 @@ async def test_delete_version_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_version), "__call__") as call: @@ -2953,11 +2979,6 @@ async def test_delete_version_async( assert response is None -@pytest.mark.asyncio -async def test_delete_version_async_from_dict(): - await test_delete_version_async(request_type=dict) - - def test_delete_version_field_headers(): client = VersionsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3100,8 +3121,8 @@ async def test_delete_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - version.LoadVersionRequest, - dict, + version.LoadVersionRequest(), + {}, ], ) def test_load_version(request_type, transport: str = "grpc"): @@ -3112,7 +3133,7 @@ def test_load_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.load_version), "__call__") as call: @@ -3153,9 +3174,10 @@ def test_load_version_non_empty_request_with_auto_populated_field(): client.load_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == version.LoadVersionRequest( + request_msg = version.LoadVersionRequest( name="name_value", ) + assert args[0] == request_msg def test_load_version_use_cached_wrapped_rpc(): @@ -3246,9 +3268,14 @@ async def test_load_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_load_version_async( - transport: str = "grpc_asyncio", request_type=version.LoadVersionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + version.LoadVersionRequest(), + {}, + ], +) +async def test_load_version_async(request_type, transport: str = "grpc_asyncio"): client = VersionsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3256,7 +3283,7 @@ async def test_load_version_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.load_version), "__call__") as call: @@ -3276,11 +3303,6 @@ async def test_load_version_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_load_version_async_from_dict(): - await test_load_version_async(request_type=dict) - - def test_load_version_field_headers(): client = VersionsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3427,8 +3449,8 @@ async def test_load_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - version.CompareVersionsRequest, - dict, + version.CompareVersionsRequest(), + {}, ], ) def test_compare_versions(request_type, transport: str = "grpc"): @@ -3439,7 +3461,7 @@ def test_compare_versions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.compare_versions), "__call__") as call: @@ -3487,11 +3509,12 @@ def test_compare_versions_non_empty_request_with_auto_populated_field(): client.compare_versions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == version.CompareVersionsRequest( + request_msg = version.CompareVersionsRequest( base_version="base_version_value", target_version="target_version_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_compare_versions_use_cached_wrapped_rpc(): @@ -3574,9 +3597,14 @@ async def test_compare_versions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_compare_versions_async( - transport: str = "grpc_asyncio", request_type=version.CompareVersionsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + version.CompareVersionsRequest(), + {}, + ], +) +async def test_compare_versions_async(request_type, transport: str = "grpc_asyncio"): client = VersionsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3584,7 +3612,7 @@ async def test_compare_versions_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.compare_versions), "__call__") as call: @@ -3609,11 +3637,6 @@ async def test_compare_versions_async( assert response.target_version_content_json == "target_version_content_json_value" -@pytest.mark.asyncio -async def test_compare_versions_async_from_dict(): - await test_compare_versions_async(request_type=dict) - - def test_compare_versions_field_headers(): client = VersionsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5240,7 +5263,6 @@ def test_list_versions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = version.ListVersionsRequest() - assert args[0] == request_msg @@ -5261,7 +5283,6 @@ def test_get_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = version.GetVersionRequest() - assert args[0] == request_msg @@ -5282,7 +5303,6 @@ def test_create_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_version.CreateVersionRequest() - assert args[0] == request_msg @@ -5303,7 +5323,6 @@ def test_update_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_version.UpdateVersionRequest() - assert args[0] == request_msg @@ -5324,7 +5343,6 @@ def test_delete_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = version.DeleteVersionRequest() - assert args[0] == request_msg @@ -5345,7 +5363,6 @@ def test_load_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = version.LoadVersionRequest() - assert args[0] == request_msg @@ -5366,7 +5383,6 @@ def test_compare_versions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = version.CompareVersionsRequest() - assert args[0] == request_msg @@ -5407,7 +5423,6 @@ async def test_list_versions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = version.ListVersionsRequest() - assert args[0] == request_msg @@ -5437,7 +5452,6 @@ async def test_get_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = version.GetVersionRequest() - assert args[0] == request_msg @@ -5462,7 +5476,6 @@ async def test_create_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_version.CreateVersionRequest() - assert args[0] == request_msg @@ -5492,7 +5505,6 @@ async def test_update_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_version.UpdateVersionRequest() - assert args[0] == request_msg @@ -5515,7 +5527,6 @@ async def test_delete_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = version.DeleteVersionRequest() - assert args[0] == request_msg @@ -5540,7 +5551,6 @@ async def test_load_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = version.LoadVersionRequest() - assert args[0] == request_msg @@ -5568,7 +5578,6 @@ async def test_compare_versions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = version.CompareVersionsRequest() - assert args[0] == request_msg @@ -6963,7 +6972,6 @@ def test_list_versions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = version.ListVersionsRequest() - assert args[0] == request_msg @@ -6983,7 +6991,6 @@ def test_get_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = version.GetVersionRequest() - assert args[0] == request_msg @@ -7003,7 +7010,6 @@ def test_create_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_version.CreateVersionRequest() - assert args[0] == request_msg @@ -7023,7 +7029,6 @@ def test_update_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_version.UpdateVersionRequest() - assert args[0] == request_msg @@ -7043,7 +7048,6 @@ def test_delete_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = version.DeleteVersionRequest() - assert args[0] == request_msg @@ -7063,7 +7067,6 @@ def test_load_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = version.LoadVersionRequest() - assert args[0] == request_msg @@ -7083,7 +7086,6 @@ def test_compare_versions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = version.CompareVersionsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_webhooks.py b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_webhooks.py index 8ddfda473301..66cb11ca0578 100644 --- a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_webhooks.py +++ b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3/test_webhooks.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" @@ -1259,8 +1275,8 @@ def test_webhooks_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - webhook.ListWebhooksRequest, - dict, + webhook.ListWebhooksRequest(), + {}, ], ) def test_list_webhooks(request_type, transport: str = "grpc"): @@ -1271,7 +1287,7 @@ def test_list_webhooks(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_webhooks), "__call__") as call: @@ -1316,10 +1332,11 @@ def test_list_webhooks_non_empty_request_with_auto_populated_field(): client.list_webhooks(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == webhook.ListWebhooksRequest( + request_msg = webhook.ListWebhooksRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_webhooks_use_cached_wrapped_rpc(): @@ -1400,9 +1417,14 @@ async def test_list_webhooks_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_webhooks_async( - transport: str = "grpc_asyncio", request_type=webhook.ListWebhooksRequest -): +@pytest.mark.parametrize( + "request_type", + [ + webhook.ListWebhooksRequest(), + {}, + ], +) +async def test_list_webhooks_async(request_type, transport: str = "grpc_asyncio"): client = WebhooksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1410,7 +1432,7 @@ async def test_list_webhooks_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_webhooks), "__call__") as call: @@ -1433,11 +1455,6 @@ async def test_list_webhooks_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_webhooks_async_from_dict(): - await test_list_webhooks_async(request_type=dict) - - def test_list_webhooks_field_headers(): client = WebhooksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1774,8 +1791,8 @@ async def test_list_webhooks_async_pages(): @pytest.mark.parametrize( "request_type", [ - webhook.GetWebhookRequest, - dict, + webhook.GetWebhookRequest(), + {}, ], ) def test_get_webhook(request_type, transport: str = "grpc"): @@ -1786,7 +1803,7 @@ def test_get_webhook(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_webhook), "__call__") as call: @@ -1834,9 +1851,10 @@ def test_get_webhook_non_empty_request_with_auto_populated_field(): client.get_webhook(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == webhook.GetWebhookRequest( + request_msg = webhook.GetWebhookRequest( name="name_value", ) + assert args[0] == request_msg def test_get_webhook_use_cached_wrapped_rpc(): @@ -1917,9 +1935,14 @@ async def test_get_webhook_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_webhook_async( - transport: str = "grpc_asyncio", request_type=webhook.GetWebhookRequest -): +@pytest.mark.parametrize( + "request_type", + [ + webhook.GetWebhookRequest(), + {}, + ], +) +async def test_get_webhook_async(request_type, transport: str = "grpc_asyncio"): client = WebhooksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1927,7 +1950,7 @@ async def test_get_webhook_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_webhook), "__call__") as call: @@ -1954,11 +1977,6 @@ async def test_get_webhook_async( assert response.disabled is True -@pytest.mark.asyncio -async def test_get_webhook_async_from_dict(): - await test_get_webhook_async(request_type=dict) - - def test_get_webhook_field_headers(): client = WebhooksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2101,8 +2119,8 @@ async def test_get_webhook_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcdc_webhook.CreateWebhookRequest, - dict, + gcdc_webhook.CreateWebhookRequest(), + {}, ], ) def test_create_webhook(request_type, transport: str = "grpc"): @@ -2113,7 +2131,7 @@ def test_create_webhook(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_webhook), "__call__") as call: @@ -2161,9 +2179,10 @@ def test_create_webhook_non_empty_request_with_auto_populated_field(): client.create_webhook(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcdc_webhook.CreateWebhookRequest( + request_msg = gcdc_webhook.CreateWebhookRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_webhook_use_cached_wrapped_rpc(): @@ -2244,9 +2263,14 @@ async def test_create_webhook_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_webhook_async( - transport: str = "grpc_asyncio", request_type=gcdc_webhook.CreateWebhookRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcdc_webhook.CreateWebhookRequest(), + {}, + ], +) +async def test_create_webhook_async(request_type, transport: str = "grpc_asyncio"): client = WebhooksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2254,7 +2278,7 @@ async def test_create_webhook_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_webhook), "__call__") as call: @@ -2281,11 +2305,6 @@ async def test_create_webhook_async( assert response.disabled is True -@pytest.mark.asyncio -async def test_create_webhook_async_from_dict(): - await test_create_webhook_async(request_type=dict) - - def test_create_webhook_field_headers(): client = WebhooksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2442,8 +2461,8 @@ async def test_create_webhook_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcdc_webhook.UpdateWebhookRequest, - dict, + gcdc_webhook.UpdateWebhookRequest(), + {}, ], ) def test_update_webhook(request_type, transport: str = "grpc"): @@ -2454,7 +2473,7 @@ def test_update_webhook(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_webhook), "__call__") as call: @@ -2500,7 +2519,8 @@ def test_update_webhook_non_empty_request_with_auto_populated_field(): client.update_webhook(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcdc_webhook.UpdateWebhookRequest() + request_msg = gcdc_webhook.UpdateWebhookRequest() + assert args[0] == request_msg def test_update_webhook_use_cached_wrapped_rpc(): @@ -2581,9 +2601,14 @@ async def test_update_webhook_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_webhook_async( - transport: str = "grpc_asyncio", request_type=gcdc_webhook.UpdateWebhookRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcdc_webhook.UpdateWebhookRequest(), + {}, + ], +) +async def test_update_webhook_async(request_type, transport: str = "grpc_asyncio"): client = WebhooksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2591,7 +2616,7 @@ async def test_update_webhook_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_webhook), "__call__") as call: @@ -2618,11 +2643,6 @@ async def test_update_webhook_async( assert response.disabled is True -@pytest.mark.asyncio -async def test_update_webhook_async_from_dict(): - await test_update_webhook_async(request_type=dict) - - def test_update_webhook_field_headers(): client = WebhooksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2779,8 +2799,8 @@ async def test_update_webhook_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - webhook.DeleteWebhookRequest, - dict, + webhook.DeleteWebhookRequest(), + {}, ], ) def test_delete_webhook(request_type, transport: str = "grpc"): @@ -2791,7 +2811,7 @@ def test_delete_webhook(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_webhook), "__call__") as call: @@ -2832,9 +2852,10 @@ def test_delete_webhook_non_empty_request_with_auto_populated_field(): client.delete_webhook(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == webhook.DeleteWebhookRequest( + request_msg = webhook.DeleteWebhookRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_webhook_use_cached_wrapped_rpc(): @@ -2915,9 +2936,14 @@ async def test_delete_webhook_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_webhook_async( - transport: str = "grpc_asyncio", request_type=webhook.DeleteWebhookRequest -): +@pytest.mark.parametrize( + "request_type", + [ + webhook.DeleteWebhookRequest(), + {}, + ], +) +async def test_delete_webhook_async(request_type, transport: str = "grpc_asyncio"): client = WebhooksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2925,7 +2951,7 @@ async def test_delete_webhook_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_webhook), "__call__") as call: @@ -2943,11 +2969,6 @@ async def test_delete_webhook_async( assert response is None -@pytest.mark.asyncio -async def test_delete_webhook_async_from_dict(): - await test_delete_webhook_async(request_type=dict) - - def test_delete_webhook_field_headers(): client = WebhooksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4186,7 +4207,6 @@ def test_list_webhooks_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = webhook.ListWebhooksRequest() - assert args[0] == request_msg @@ -4207,7 +4227,6 @@ def test_get_webhook_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = webhook.GetWebhookRequest() - assert args[0] == request_msg @@ -4228,7 +4247,6 @@ def test_create_webhook_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_webhook.CreateWebhookRequest() - assert args[0] == request_msg @@ -4249,7 +4267,6 @@ def test_update_webhook_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_webhook.UpdateWebhookRequest() - assert args[0] == request_msg @@ -4270,7 +4287,6 @@ def test_delete_webhook_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = webhook.DeleteWebhookRequest() - assert args[0] == request_msg @@ -4311,7 +4327,6 @@ async def test_list_webhooks_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = webhook.ListWebhooksRequest() - assert args[0] == request_msg @@ -4340,7 +4355,6 @@ async def test_get_webhook_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = webhook.GetWebhookRequest() - assert args[0] == request_msg @@ -4369,7 +4383,6 @@ async def test_create_webhook_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_webhook.CreateWebhookRequest() - assert args[0] == request_msg @@ -4398,7 +4411,6 @@ async def test_update_webhook_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_webhook.UpdateWebhookRequest() - assert args[0] == request_msg @@ -4421,7 +4433,6 @@ async def test_delete_webhook_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = webhook.DeleteWebhookRequest() - assert args[0] == request_msg @@ -5592,7 +5603,6 @@ def test_list_webhooks_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = webhook.ListWebhooksRequest() - assert args[0] == request_msg @@ -5612,7 +5622,6 @@ def test_get_webhook_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = webhook.GetWebhookRequest() - assert args[0] == request_msg @@ -5632,7 +5641,6 @@ def test_create_webhook_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_webhook.CreateWebhookRequest() - assert args[0] == request_msg @@ -5652,7 +5660,6 @@ def test_update_webhook_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_webhook.UpdateWebhookRequest() - assert args[0] == request_msg @@ -5672,7 +5679,6 @@ def test_delete_webhook_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = webhook.DeleteWebhookRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_agents.py b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_agents.py index 60a20a9111be..705e8b6d87db 100644 --- a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_agents.py +++ b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_agents.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 @@ -130,6 +131,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" @@ -1265,8 +1281,8 @@ def test_agents_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - agent.ListAgentsRequest, - dict, + agent.ListAgentsRequest(), + {}, ], ) def test_list_agents(request_type, transport: str = "grpc"): @@ -1277,7 +1293,7 @@ def test_list_agents(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_agents), "__call__") as call: @@ -1322,10 +1338,11 @@ def test_list_agents_non_empty_request_with_auto_populated_field(): client.list_agents(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent.ListAgentsRequest( + request_msg = agent.ListAgentsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_agents_use_cached_wrapped_rpc(): @@ -1406,9 +1423,14 @@ async def test_list_agents_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_agents_async( - transport: str = "grpc_asyncio", request_type=agent.ListAgentsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent.ListAgentsRequest(), + {}, + ], +) +async def test_list_agents_async(request_type, transport: str = "grpc_asyncio"): client = AgentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1416,7 +1438,7 @@ async def test_list_agents_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_agents), "__call__") as call: @@ -1439,11 +1461,6 @@ async def test_list_agents_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_agents_async_from_dict(): - await test_list_agents_async(request_type=dict) - - def test_list_agents_field_headers(): client = AgentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1780,8 +1797,8 @@ async def test_list_agents_async_pages(): @pytest.mark.parametrize( "request_type", [ - agent.GetAgentRequest, - dict, + agent.GetAgentRequest(), + {}, ], ) def test_get_agent(request_type, transport: str = "grpc"): @@ -1792,7 +1809,7 @@ def test_get_agent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_agent), "__call__") as call: @@ -1863,9 +1880,10 @@ def test_get_agent_non_empty_request_with_auto_populated_field(): client.get_agent(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent.GetAgentRequest( + request_msg = agent.GetAgentRequest( name="name_value", ) + assert args[0] == request_msg def test_get_agent_use_cached_wrapped_rpc(): @@ -1944,9 +1962,14 @@ async def test_get_agent_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_agent_async( - transport: str = "grpc_asyncio", request_type=agent.GetAgentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent.GetAgentRequest(), + {}, + ], +) +async def test_get_agent_async(request_type, transport: str = "grpc_asyncio"): client = AgentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1954,7 +1977,7 @@ async def test_get_agent_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_agent), "__call__") as call: @@ -2003,11 +2026,6 @@ async def test_get_agent_async( assert response.satisfies_pzi is True -@pytest.mark.asyncio -async def test_get_agent_async_from_dict(): - await test_get_agent_async(request_type=dict) - - def test_get_agent_field_headers(): client = AgentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2150,8 +2168,8 @@ async def test_get_agent_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcdc_agent.CreateAgentRequest, - dict, + gcdc_agent.CreateAgentRequest(), + {}, ], ) def test_create_agent(request_type, transport: str = "grpc"): @@ -2162,7 +2180,7 @@ def test_create_agent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_agent), "__call__") as call: @@ -2233,9 +2251,10 @@ def test_create_agent_non_empty_request_with_auto_populated_field(): client.create_agent(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcdc_agent.CreateAgentRequest( + request_msg = gcdc_agent.CreateAgentRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_agent_use_cached_wrapped_rpc(): @@ -2316,9 +2335,14 @@ async def test_create_agent_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_agent_async( - transport: str = "grpc_asyncio", request_type=gcdc_agent.CreateAgentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcdc_agent.CreateAgentRequest(), + {}, + ], +) +async def test_create_agent_async(request_type, transport: str = "grpc_asyncio"): client = AgentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2326,7 +2350,7 @@ async def test_create_agent_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_agent), "__call__") as call: @@ -2375,11 +2399,6 @@ async def test_create_agent_async( assert response.satisfies_pzi is True -@pytest.mark.asyncio -async def test_create_agent_async_from_dict(): - await test_create_agent_async(request_type=dict) - - def test_create_agent_field_headers(): client = AgentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2532,8 +2551,8 @@ async def test_create_agent_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcdc_agent.UpdateAgentRequest, - dict, + gcdc_agent.UpdateAgentRequest(), + {}, ], ) def test_update_agent(request_type, transport: str = "grpc"): @@ -2544,7 +2563,7 @@ def test_update_agent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_agent), "__call__") as call: @@ -2613,7 +2632,8 @@ def test_update_agent_non_empty_request_with_auto_populated_field(): client.update_agent(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcdc_agent.UpdateAgentRequest() + request_msg = gcdc_agent.UpdateAgentRequest() + assert args[0] == request_msg def test_update_agent_use_cached_wrapped_rpc(): @@ -2694,9 +2714,14 @@ async def test_update_agent_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_agent_async( - transport: str = "grpc_asyncio", request_type=gcdc_agent.UpdateAgentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcdc_agent.UpdateAgentRequest(), + {}, + ], +) +async def test_update_agent_async(request_type, transport: str = "grpc_asyncio"): client = AgentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2704,7 +2729,7 @@ async def test_update_agent_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_agent), "__call__") as call: @@ -2753,11 +2778,6 @@ async def test_update_agent_async( assert response.satisfies_pzi is True -@pytest.mark.asyncio -async def test_update_agent_async_from_dict(): - await test_update_agent_async(request_type=dict) - - def test_update_agent_field_headers(): client = AgentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2910,8 +2930,8 @@ async def test_update_agent_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent.DeleteAgentRequest, - dict, + agent.DeleteAgentRequest(), + {}, ], ) def test_delete_agent(request_type, transport: str = "grpc"): @@ -2922,7 +2942,7 @@ def test_delete_agent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_agent), "__call__") as call: @@ -2963,9 +2983,10 @@ def test_delete_agent_non_empty_request_with_auto_populated_field(): client.delete_agent(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent.DeleteAgentRequest( + request_msg = agent.DeleteAgentRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_agent_use_cached_wrapped_rpc(): @@ -3046,9 +3067,14 @@ async def test_delete_agent_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_agent_async( - transport: str = "grpc_asyncio", request_type=agent.DeleteAgentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent.DeleteAgentRequest(), + {}, + ], +) +async def test_delete_agent_async(request_type, transport: str = "grpc_asyncio"): client = AgentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3056,7 +3082,7 @@ async def test_delete_agent_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_agent), "__call__") as call: @@ -3074,11 +3100,6 @@ async def test_delete_agent_async( assert response is None -@pytest.mark.asyncio -async def test_delete_agent_async_from_dict(): - await test_delete_agent_async(request_type=dict) - - def test_delete_agent_field_headers(): client = AgentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3221,8 +3242,8 @@ async def test_delete_agent_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent.ExportAgentRequest, - dict, + agent.ExportAgentRequest(), + {}, ], ) def test_export_agent(request_type, transport: str = "grpc"): @@ -3233,7 +3254,7 @@ def test_export_agent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.export_agent), "__call__") as call: @@ -3276,11 +3297,12 @@ def test_export_agent_non_empty_request_with_auto_populated_field(): client.export_agent(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent.ExportAgentRequest( + request_msg = agent.ExportAgentRequest( name="name_value", agent_uri="agent_uri_value", environment="environment_value", ) + assert args[0] == request_msg def test_export_agent_use_cached_wrapped_rpc(): @@ -3371,9 +3393,14 @@ async def test_export_agent_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_export_agent_async( - transport: str = "grpc_asyncio", request_type=agent.ExportAgentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent.ExportAgentRequest(), + {}, + ], +) +async def test_export_agent_async(request_type, transport: str = "grpc_asyncio"): client = AgentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3381,7 +3408,7 @@ async def test_export_agent_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.export_agent), "__call__") as call: @@ -3401,11 +3428,6 @@ async def test_export_agent_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_export_agent_async_from_dict(): - await test_export_agent_async(request_type=dict) - - def test_export_agent_field_headers(): client = AgentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3470,8 +3492,8 @@ async def test_export_agent_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - agent.RestoreAgentRequest, - dict, + agent.RestoreAgentRequest(), + {}, ], ) def test_restore_agent(request_type, transport: str = "grpc"): @@ -3482,7 +3504,7 @@ def test_restore_agent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.restore_agent), "__call__") as call: @@ -3524,10 +3546,11 @@ def test_restore_agent_non_empty_request_with_auto_populated_field(): client.restore_agent(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent.RestoreAgentRequest( + request_msg = agent.RestoreAgentRequest( name="name_value", agent_uri="agent_uri_value", ) + assert args[0] == request_msg def test_restore_agent_use_cached_wrapped_rpc(): @@ -3618,9 +3641,14 @@ async def test_restore_agent_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_restore_agent_async( - transport: str = "grpc_asyncio", request_type=agent.RestoreAgentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent.RestoreAgentRequest(), + {}, + ], +) +async def test_restore_agent_async(request_type, transport: str = "grpc_asyncio"): client = AgentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3628,7 +3656,7 @@ async def test_restore_agent_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.restore_agent), "__call__") as call: @@ -3648,11 +3676,6 @@ async def test_restore_agent_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_restore_agent_async_from_dict(): - await test_restore_agent_async(request_type=dict) - - def test_restore_agent_field_headers(): client = AgentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3717,8 +3740,8 @@ async def test_restore_agent_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - agent.ValidateAgentRequest, - dict, + agent.ValidateAgentRequest(), + {}, ], ) def test_validate_agent(request_type, transport: str = "grpc"): @@ -3729,7 +3752,7 @@ def test_validate_agent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.validate_agent), "__call__") as call: @@ -3774,10 +3797,11 @@ def test_validate_agent_non_empty_request_with_auto_populated_field(): client.validate_agent(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent.ValidateAgentRequest( + request_msg = agent.ValidateAgentRequest( name="name_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_validate_agent_use_cached_wrapped_rpc(): @@ -3858,9 +3882,14 @@ async def test_validate_agent_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_validate_agent_async( - transport: str = "grpc_asyncio", request_type=agent.ValidateAgentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent.ValidateAgentRequest(), + {}, + ], +) +async def test_validate_agent_async(request_type, transport: str = "grpc_asyncio"): client = AgentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3868,7 +3897,7 @@ async def test_validate_agent_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.validate_agent), "__call__") as call: @@ -3891,11 +3920,6 @@ async def test_validate_agent_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_validate_agent_async_from_dict(): - await test_validate_agent_async(request_type=dict) - - def test_validate_agent_field_headers(): client = AgentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3960,8 +3984,8 @@ async def test_validate_agent_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - agent.GetAgentValidationResultRequest, - dict, + agent.GetAgentValidationResultRequest(), + {}, ], ) def test_get_agent_validation_result(request_type, transport: str = "grpc"): @@ -3972,7 +3996,7 @@ def test_get_agent_validation_result(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4021,10 +4045,11 @@ def test_get_agent_validation_result_non_empty_request_with_auto_populated_field client.get_agent_validation_result(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent.GetAgentValidationResultRequest( + request_msg = agent.GetAgentValidationResultRequest( name="name_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_get_agent_validation_result_use_cached_wrapped_rpc(): @@ -4110,8 +4135,15 @@ async def test_get_agent_validation_result_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + agent.GetAgentValidationResultRequest(), + {}, + ], +) async def test_get_agent_validation_result_async( - transport: str = "grpc_asyncio", request_type=agent.GetAgentValidationResultRequest + request_type, transport: str = "grpc_asyncio" ): client = AgentsAsyncClient( credentials=async_anonymous_credentials(), @@ -4120,7 +4152,7 @@ async def test_get_agent_validation_result_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( @@ -4145,11 +4177,6 @@ async def test_get_agent_validation_result_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_agent_validation_result_async_from_dict(): - await test_get_agent_validation_result_async(request_type=dict) - - def test_get_agent_validation_result_field_headers(): client = AgentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4304,8 +4331,8 @@ async def test_get_agent_validation_result_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent.GetGenerativeSettingsRequest, - dict, + agent.GetGenerativeSettingsRequest(), + {}, ], ) def test_get_generative_settings(request_type, transport: str = "grpc"): @@ -4316,7 +4343,7 @@ def test_get_generative_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( @@ -4367,10 +4394,11 @@ def test_get_generative_settings_non_empty_request_with_auto_populated_field(): client.get_generative_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent.GetGenerativeSettingsRequest( + request_msg = agent.GetGenerativeSettingsRequest( name="name_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_get_generative_settings_use_cached_wrapped_rpc(): @@ -4456,8 +4484,15 @@ async def test_get_generative_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + agent.GetGenerativeSettingsRequest(), + {}, + ], +) async def test_get_generative_settings_async( - transport: str = "grpc_asyncio", request_type=agent.GetGenerativeSettingsRequest + request_type, transport: str = "grpc_asyncio" ): client = AgentsAsyncClient( credentials=async_anonymous_credentials(), @@ -4466,7 +4501,7 @@ async def test_get_generative_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( @@ -4493,11 +4528,6 @@ async def test_get_generative_settings_async( assert response.language_code == "language_code_value" -@pytest.mark.asyncio -async def test_get_generative_settings_async_from_dict(): - await test_get_generative_settings_async(request_type=dict) - - def test_get_generative_settings_field_headers(): client = AgentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4662,8 +4692,8 @@ async def test_get_generative_settings_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent.UpdateGenerativeSettingsRequest, - dict, + agent.UpdateGenerativeSettingsRequest(), + {}, ], ) def test_update_generative_settings(request_type, transport: str = "grpc"): @@ -4674,7 +4704,7 @@ def test_update_generative_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( @@ -4722,7 +4752,8 @@ def test_update_generative_settings_non_empty_request_with_auto_populated_field( client.update_generative_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent.UpdateGenerativeSettingsRequest() + request_msg = agent.UpdateGenerativeSettingsRequest() + assert args[0] == request_msg def test_update_generative_settings_use_cached_wrapped_rpc(): @@ -4808,8 +4839,15 @@ async def test_update_generative_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + agent.UpdateGenerativeSettingsRequest(), + {}, + ], +) async def test_update_generative_settings_async( - transport: str = "grpc_asyncio", request_type=agent.UpdateGenerativeSettingsRequest + request_type, transport: str = "grpc_asyncio" ): client = AgentsAsyncClient( credentials=async_anonymous_credentials(), @@ -4818,7 +4856,7 @@ async def test_update_generative_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( @@ -4845,11 +4883,6 @@ async def test_update_generative_settings_async( assert response.language_code == "language_code_value" -@pytest.mark.asyncio -async def test_update_generative_settings_async_from_dict(): - await test_update_generative_settings_async(request_type=dict) - - def test_update_generative_settings_field_headers(): client = AgentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7053,7 +7086,6 @@ def test_list_agents_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.ListAgentsRequest() - assert args[0] == request_msg @@ -7074,7 +7106,6 @@ def test_get_agent_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.GetAgentRequest() - assert args[0] == request_msg @@ -7095,7 +7126,6 @@ def test_create_agent_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_agent.CreateAgentRequest() - assert args[0] == request_msg @@ -7116,7 +7146,6 @@ def test_update_agent_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_agent.UpdateAgentRequest() - assert args[0] == request_msg @@ -7137,7 +7166,6 @@ def test_delete_agent_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.DeleteAgentRequest() - assert args[0] == request_msg @@ -7158,7 +7186,6 @@ def test_export_agent_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.ExportAgentRequest() - assert args[0] == request_msg @@ -7179,7 +7206,6 @@ def test_restore_agent_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.RestoreAgentRequest() - assert args[0] == request_msg @@ -7200,7 +7226,6 @@ def test_validate_agent_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.ValidateAgentRequest() - assert args[0] == request_msg @@ -7223,7 +7248,6 @@ def test_get_agent_validation_result_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.GetAgentValidationResultRequest() - assert args[0] == request_msg @@ -7246,7 +7270,6 @@ def test_get_generative_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.GetGenerativeSettingsRequest() - assert args[0] == request_msg @@ -7269,7 +7292,6 @@ def test_update_generative_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.UpdateGenerativeSettingsRequest() - assert args[0] == request_msg @@ -7310,7 +7332,6 @@ async def test_list_agents_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.ListAgentsRequest() - assert args[0] == request_msg @@ -7350,7 +7371,6 @@ async def test_get_agent_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.GetAgentRequest() - assert args[0] == request_msg @@ -7390,7 +7410,6 @@ async def test_create_agent_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_agent.CreateAgentRequest() - assert args[0] == request_msg @@ -7430,7 +7449,6 @@ async def test_update_agent_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_agent.UpdateAgentRequest() - assert args[0] == request_msg @@ -7453,7 +7471,6 @@ async def test_delete_agent_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.DeleteAgentRequest() - assert args[0] == request_msg @@ -7478,7 +7495,6 @@ async def test_export_agent_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.ExportAgentRequest() - assert args[0] == request_msg @@ -7503,7 +7519,6 @@ async def test_restore_agent_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.RestoreAgentRequest() - assert args[0] == request_msg @@ -7530,7 +7545,6 @@ async def test_validate_agent_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.ValidateAgentRequest() - assert args[0] == request_msg @@ -7559,7 +7573,6 @@ async def test_get_agent_validation_result_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.GetAgentValidationResultRequest() - assert args[0] == request_msg @@ -7589,7 +7602,6 @@ async def test_get_generative_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.GetGenerativeSettingsRequest() - assert args[0] == request_msg @@ -7619,7 +7631,6 @@ async def test_update_generative_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.UpdateGenerativeSettingsRequest() - assert args[0] == request_msg @@ -9799,7 +9810,6 @@ def test_list_agents_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.ListAgentsRequest() - assert args[0] == request_msg @@ -9819,7 +9829,6 @@ def test_get_agent_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.GetAgentRequest() - assert args[0] == request_msg @@ -9839,7 +9848,6 @@ def test_create_agent_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_agent.CreateAgentRequest() - assert args[0] == request_msg @@ -9859,7 +9867,6 @@ def test_update_agent_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_agent.UpdateAgentRequest() - assert args[0] == request_msg @@ -9879,7 +9886,6 @@ def test_delete_agent_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.DeleteAgentRequest() - assert args[0] == request_msg @@ -9899,7 +9905,6 @@ def test_export_agent_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.ExportAgentRequest() - assert args[0] == request_msg @@ -9919,7 +9924,6 @@ def test_restore_agent_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.RestoreAgentRequest() - assert args[0] == request_msg @@ -9939,7 +9943,6 @@ def test_validate_agent_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.ValidateAgentRequest() - assert args[0] == request_msg @@ -9961,7 +9964,6 @@ def test_get_agent_validation_result_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.GetAgentValidationResultRequest() - assert args[0] == request_msg @@ -9983,7 +9985,6 @@ def test_get_generative_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.GetGenerativeSettingsRequest() - assert args[0] == request_msg @@ -10005,7 +10006,6 @@ def test_update_generative_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.UpdateGenerativeSettingsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_changelogs.py b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_changelogs.py index 9fe2f0ca54c5..17ddab1cb253 100644 --- a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_changelogs.py +++ b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_changelogs.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 @@ -110,6 +111,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" @@ -1274,8 +1290,8 @@ def test_changelogs_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - changelog.ListChangelogsRequest, - dict, + changelog.ListChangelogsRequest(), + {}, ], ) def test_list_changelogs(request_type, transport: str = "grpc"): @@ -1286,7 +1302,7 @@ def test_list_changelogs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_changelogs), "__call__") as call: @@ -1332,11 +1348,12 @@ def test_list_changelogs_non_empty_request_with_auto_populated_field(): client.list_changelogs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == changelog.ListChangelogsRequest( + request_msg = changelog.ListChangelogsRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_changelogs_use_cached_wrapped_rpc(): @@ -1417,9 +1434,14 @@ async def test_list_changelogs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_changelogs_async( - transport: str = "grpc_asyncio", request_type=changelog.ListChangelogsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + changelog.ListChangelogsRequest(), + {}, + ], +) +async def test_list_changelogs_async(request_type, transport: str = "grpc_asyncio"): client = ChangelogsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1427,7 +1449,7 @@ async def test_list_changelogs_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_changelogs), "__call__") as call: @@ -1450,11 +1472,6 @@ async def test_list_changelogs_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_changelogs_async_from_dict(): - await test_list_changelogs_async(request_type=dict) - - def test_list_changelogs_field_headers(): client = ChangelogsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1791,8 +1808,8 @@ async def test_list_changelogs_async_pages(): @pytest.mark.parametrize( "request_type", [ - changelog.GetChangelogRequest, - dict, + changelog.GetChangelogRequest(), + {}, ], ) def test_get_changelog(request_type, transport: str = "grpc"): @@ -1803,7 +1820,7 @@ def test_get_changelog(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_changelog), "__call__") as call: @@ -1859,9 +1876,10 @@ def test_get_changelog_non_empty_request_with_auto_populated_field(): client.get_changelog(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == changelog.GetChangelogRequest( + request_msg = changelog.GetChangelogRequest( name="name_value", ) + assert args[0] == request_msg def test_get_changelog_use_cached_wrapped_rpc(): @@ -1942,9 +1960,14 @@ async def test_get_changelog_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_changelog_async( - transport: str = "grpc_asyncio", request_type=changelog.GetChangelogRequest -): +@pytest.mark.parametrize( + "request_type", + [ + changelog.GetChangelogRequest(), + {}, + ], +) +async def test_get_changelog_async(request_type, transport: str = "grpc_asyncio"): client = ChangelogsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1952,7 +1975,7 @@ async def test_get_changelog_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_changelog), "__call__") as call: @@ -1987,11 +2010,6 @@ async def test_get_changelog_async( assert response.language_code == "language_code_value" -@pytest.mark.asyncio -async def test_get_changelog_async_from_dict(): - await test_get_changelog_async(request_type=dict) - - def test_get_changelog_field_headers(): client = ChangelogsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2688,7 +2706,6 @@ def test_list_changelogs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = changelog.ListChangelogsRequest() - assert args[0] == request_msg @@ -2709,7 +2726,6 @@ def test_get_changelog_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = changelog.GetChangelogRequest() - assert args[0] == request_msg @@ -2750,7 +2766,6 @@ async def test_list_changelogs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = changelog.ListChangelogsRequest() - assert args[0] == request_msg @@ -2783,7 +2798,6 @@ async def test_get_changelog_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = changelog.GetChangelogRequest() - assert args[0] == request_msg @@ -3398,7 +3412,6 @@ def test_list_changelogs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = changelog.ListChangelogsRequest() - assert args[0] == request_msg @@ -3418,7 +3431,6 @@ def test_get_changelog_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = changelog.GetChangelogRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_conversation_history.py b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_conversation_history.py index 3d42831f9070..cd549e2bee90 100644 --- a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_conversation_history.py +++ b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_conversation_history.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 @@ -117,6 +118,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" @@ -1383,8 +1399,8 @@ def test_conversation_history_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - conversation_history.ListConversationsRequest, - dict, + conversation_history.ListConversationsRequest(), + {}, ], ) def test_list_conversations(request_type, transport: str = "grpc"): @@ -1395,7 +1411,7 @@ def test_list_conversations(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1445,11 +1461,12 @@ def test_list_conversations_non_empty_request_with_auto_populated_field(): client.list_conversations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversation_history.ListConversationsRequest( + request_msg = conversation_history.ListConversationsRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_conversations_use_cached_wrapped_rpc(): @@ -1534,10 +1551,14 @@ async def test_list_conversations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_conversations_async( - transport: str = "grpc_asyncio", - request_type=conversation_history.ListConversationsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + conversation_history.ListConversationsRequest(), + {}, + ], +) +async def test_list_conversations_async(request_type, transport: str = "grpc_asyncio"): client = ConversationHistoryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1545,7 +1566,7 @@ async def test_list_conversations_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( @@ -1570,11 +1591,6 @@ async def test_list_conversations_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_conversations_async_from_dict(): - await test_list_conversations_async(request_type=dict) - - def test_list_conversations_field_headers(): client = ConversationHistoryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1927,8 +1943,8 @@ async def test_list_conversations_async_pages(): @pytest.mark.parametrize( "request_type", [ - conversation_history.GetConversationRequest, - dict, + conversation_history.GetConversationRequest(), + {}, ], ) def test_get_conversation(request_type, transport: str = "grpc"): @@ -1939,7 +1955,7 @@ def test_get_conversation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_conversation), "__call__") as call: @@ -1987,9 +2003,10 @@ def test_get_conversation_non_empty_request_with_auto_populated_field(): client.get_conversation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversation_history.GetConversationRequest( + request_msg = conversation_history.GetConversationRequest( name="name_value", ) + assert args[0] == request_msg def test_get_conversation_use_cached_wrapped_rpc(): @@ -2072,10 +2089,14 @@ async def test_get_conversation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_conversation_async( - transport: str = "grpc_asyncio", - request_type=conversation_history.GetConversationRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + conversation_history.GetConversationRequest(), + {}, + ], +) +async def test_get_conversation_async(request_type, transport: str = "grpc_asyncio"): client = ConversationHistoryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2083,7 +2104,7 @@ async def test_get_conversation_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_conversation), "__call__") as call: @@ -2110,11 +2131,6 @@ async def test_get_conversation_async( assert response.language_code == "language_code_value" -@pytest.mark.asyncio -async def test_get_conversation_async_from_dict(): - await test_get_conversation_async(request_type=dict) - - def test_get_conversation_field_headers(): client = ConversationHistoryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2261,8 +2277,8 @@ async def test_get_conversation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversation_history.DeleteConversationRequest, - dict, + conversation_history.DeleteConversationRequest(), + {}, ], ) def test_delete_conversation(request_type, transport: str = "grpc"): @@ -2273,7 +2289,7 @@ def test_delete_conversation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2318,9 +2334,10 @@ def test_delete_conversation_non_empty_request_with_auto_populated_field(): client.delete_conversation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversation_history.DeleteConversationRequest( + request_msg = conversation_history.DeleteConversationRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_conversation_use_cached_wrapped_rpc(): @@ -2405,10 +2422,14 @@ async def test_delete_conversation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_conversation_async( - transport: str = "grpc_asyncio", - request_type=conversation_history.DeleteConversationRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + conversation_history.DeleteConversationRequest(), + {}, + ], +) +async def test_delete_conversation_async(request_type, transport: str = "grpc_asyncio"): client = ConversationHistoryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2416,7 +2437,7 @@ async def test_delete_conversation_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( @@ -2436,11 +2457,6 @@ async def test_delete_conversation_async( assert response is None -@pytest.mark.asyncio -async def test_delete_conversation_async_from_dict(): - await test_delete_conversation_async(request_type=dict) - - def test_delete_conversation_field_headers(): client = ConversationHistoryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3338,7 +3354,6 @@ def test_list_conversations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation_history.ListConversationsRequest() - assert args[0] == request_msg @@ -3359,7 +3374,6 @@ def test_get_conversation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation_history.GetConversationRequest() - assert args[0] == request_msg @@ -3382,7 +3396,6 @@ def test_delete_conversation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation_history.DeleteConversationRequest() - assert args[0] == request_msg @@ -3425,7 +3438,6 @@ async def test_list_conversations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation_history.ListConversationsRequest() - assert args[0] == request_msg @@ -3454,7 +3466,6 @@ async def test_get_conversation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation_history.GetConversationRequest() - assert args[0] == request_msg @@ -3479,7 +3490,6 @@ async def test_delete_conversation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation_history.DeleteConversationRequest() - assert args[0] == request_msg @@ -4215,7 +4225,6 @@ def test_list_conversations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation_history.ListConversationsRequest() - assert args[0] == request_msg @@ -4235,7 +4244,6 @@ def test_get_conversation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation_history.GetConversationRequest() - assert args[0] == request_msg @@ -4257,7 +4265,6 @@ def test_delete_conversation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation_history.DeleteConversationRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_deployments.py b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_deployments.py index 12968c8aed91..f8ec1d518ef4 100644 --- a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_deployments.py +++ b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_deployments.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 @@ -110,6 +111,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" @@ -1278,8 +1294,8 @@ def test_deployments_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - deployment.ListDeploymentsRequest, - dict, + deployment.ListDeploymentsRequest(), + {}, ], ) def test_list_deployments(request_type, transport: str = "grpc"): @@ -1290,7 +1306,7 @@ def test_list_deployments(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_deployments), "__call__") as call: @@ -1335,10 +1351,11 @@ def test_list_deployments_non_empty_request_with_auto_populated_field(): client.list_deployments(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == deployment.ListDeploymentsRequest( + request_msg = deployment.ListDeploymentsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_deployments_use_cached_wrapped_rpc(): @@ -1421,9 +1438,14 @@ async def test_list_deployments_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_deployments_async( - transport: str = "grpc_asyncio", request_type=deployment.ListDeploymentsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + deployment.ListDeploymentsRequest(), + {}, + ], +) +async def test_list_deployments_async(request_type, transport: str = "grpc_asyncio"): client = DeploymentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1431,7 +1453,7 @@ async def test_list_deployments_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_deployments), "__call__") as call: @@ -1454,11 +1476,6 @@ async def test_list_deployments_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_deployments_async_from_dict(): - await test_list_deployments_async(request_type=dict) - - def test_list_deployments_field_headers(): client = DeploymentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1795,8 +1812,8 @@ async def test_list_deployments_async_pages(): @pytest.mark.parametrize( "request_type", [ - deployment.GetDeploymentRequest, - dict, + deployment.GetDeploymentRequest(), + {}, ], ) def test_get_deployment(request_type, transport: str = "grpc"): @@ -1807,7 +1824,7 @@ def test_get_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_deployment), "__call__") as call: @@ -1855,9 +1872,10 @@ def test_get_deployment_non_empty_request_with_auto_populated_field(): client.get_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == deployment.GetDeploymentRequest( + request_msg = deployment.GetDeploymentRequest( name="name_value", ) + assert args[0] == request_msg def test_get_deployment_use_cached_wrapped_rpc(): @@ -1938,9 +1956,14 @@ async def test_get_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_deployment_async( - transport: str = "grpc_asyncio", request_type=deployment.GetDeploymentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + deployment.GetDeploymentRequest(), + {}, + ], +) +async def test_get_deployment_async(request_type, transport: str = "grpc_asyncio"): client = DeploymentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1948,7 +1971,7 @@ async def test_get_deployment_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_deployment), "__call__") as call: @@ -1975,11 +1998,6 @@ async def test_get_deployment_async( assert response.state == deployment.Deployment.State.RUNNING -@pytest.mark.asyncio -async def test_get_deployment_async_from_dict(): - await test_get_deployment_async(request_type=dict) - - def test_get_deployment_field_headers(): client = DeploymentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2688,7 +2706,6 @@ def test_list_deployments_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployment.ListDeploymentsRequest() - assert args[0] == request_msg @@ -2709,7 +2726,6 @@ def test_get_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployment.GetDeploymentRequest() - assert args[0] == request_msg @@ -2750,7 +2766,6 @@ async def test_list_deployments_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployment.ListDeploymentsRequest() - assert args[0] == request_msg @@ -2779,7 +2794,6 @@ async def test_get_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployment.GetDeploymentRequest() - assert args[0] == request_msg @@ -3394,7 +3408,6 @@ def test_list_deployments_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployment.ListDeploymentsRequest() - assert args[0] == request_msg @@ -3414,7 +3427,6 @@ def test_get_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployment.GetDeploymentRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_entity_types.py b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_entity_types.py index 755b80c0146e..8fc9bc1c4bcb 100644 --- a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_entity_types.py +++ b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_entity_types.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 @@ -115,6 +116,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" @@ -1283,8 +1299,8 @@ def test_entity_types_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - entity_type.GetEntityTypeRequest, - dict, + entity_type.GetEntityTypeRequest(), + {}, ], ) def test_get_entity_type(request_type, transport: str = "grpc"): @@ -1295,7 +1311,7 @@ def test_get_entity_type(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_entity_type), "__call__") as call: @@ -1353,10 +1369,11 @@ def test_get_entity_type_non_empty_request_with_auto_populated_field(): client.get_entity_type(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == entity_type.GetEntityTypeRequest( + request_msg = entity_type.GetEntityTypeRequest( name="name_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_get_entity_type_use_cached_wrapped_rpc(): @@ -1437,9 +1454,14 @@ async def test_get_entity_type_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_entity_type_async( - transport: str = "grpc_asyncio", request_type=entity_type.GetEntityTypeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + entity_type.GetEntityTypeRequest(), + {}, + ], +) +async def test_get_entity_type_async(request_type, transport: str = "grpc_asyncio"): client = EntityTypesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1447,7 +1469,7 @@ async def test_get_entity_type_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_entity_type), "__call__") as call: @@ -1483,11 +1505,6 @@ async def test_get_entity_type_async( assert response.redact is True -@pytest.mark.asyncio -async def test_get_entity_type_async_from_dict(): - await test_get_entity_type_async(request_type=dict) - - def test_get_entity_type_field_headers(): client = EntityTypesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1634,8 +1651,8 @@ async def test_get_entity_type_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcdc_entity_type.CreateEntityTypeRequest, - dict, + gcdc_entity_type.CreateEntityTypeRequest(), + {}, ], ) def test_create_entity_type(request_type, transport: str = "grpc"): @@ -1646,7 +1663,7 @@ def test_create_entity_type(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1708,10 +1725,11 @@ def test_create_entity_type_non_empty_request_with_auto_populated_field(): client.create_entity_type(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcdc_entity_type.CreateEntityTypeRequest( + request_msg = gcdc_entity_type.CreateEntityTypeRequest( parent="parent_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_create_entity_type_use_cached_wrapped_rpc(): @@ -1796,10 +1814,14 @@ async def test_create_entity_type_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_entity_type_async( - transport: str = "grpc_asyncio", - request_type=gcdc_entity_type.CreateEntityTypeRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + gcdc_entity_type.CreateEntityTypeRequest(), + {}, + ], +) +async def test_create_entity_type_async(request_type, transport: str = "grpc_asyncio"): client = EntityTypesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1807,7 +1829,7 @@ async def test_create_entity_type_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( @@ -1845,11 +1867,6 @@ async def test_create_entity_type_async( assert response.redact is True -@pytest.mark.asyncio -async def test_create_entity_type_async_from_dict(): - await test_create_entity_type_async(request_type=dict) - - def test_create_entity_type_field_headers(): client = EntityTypesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2014,8 +2031,8 @@ async def test_create_entity_type_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcdc_entity_type.UpdateEntityTypeRequest, - dict, + gcdc_entity_type.UpdateEntityTypeRequest(), + {}, ], ) def test_update_entity_type(request_type, transport: str = "grpc"): @@ -2026,7 +2043,7 @@ def test_update_entity_type(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2087,9 +2104,10 @@ def test_update_entity_type_non_empty_request_with_auto_populated_field(): client.update_entity_type(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcdc_entity_type.UpdateEntityTypeRequest( + request_msg = gcdc_entity_type.UpdateEntityTypeRequest( language_code="language_code_value", ) + assert args[0] == request_msg def test_update_entity_type_use_cached_wrapped_rpc(): @@ -2174,10 +2192,14 @@ async def test_update_entity_type_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_entity_type_async( - transport: str = "grpc_asyncio", - request_type=gcdc_entity_type.UpdateEntityTypeRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + gcdc_entity_type.UpdateEntityTypeRequest(), + {}, + ], +) +async def test_update_entity_type_async(request_type, transport: str = "grpc_asyncio"): client = EntityTypesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2185,7 +2207,7 @@ async def test_update_entity_type_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( @@ -2223,11 +2245,6 @@ async def test_update_entity_type_async( assert response.redact is True -@pytest.mark.asyncio -async def test_update_entity_type_async_from_dict(): - await test_update_entity_type_async(request_type=dict) - - def test_update_entity_type_field_headers(): client = EntityTypesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2392,8 +2409,8 @@ async def test_update_entity_type_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - entity_type.DeleteEntityTypeRequest, - dict, + entity_type.DeleteEntityTypeRequest(), + {}, ], ) def test_delete_entity_type(request_type, transport: str = "grpc"): @@ -2404,7 +2421,7 @@ def test_delete_entity_type(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2449,9 +2466,10 @@ def test_delete_entity_type_non_empty_request_with_auto_populated_field(): client.delete_entity_type(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == entity_type.DeleteEntityTypeRequest( + request_msg = entity_type.DeleteEntityTypeRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_entity_type_use_cached_wrapped_rpc(): @@ -2536,9 +2554,14 @@ async def test_delete_entity_type_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_entity_type_async( - transport: str = "grpc_asyncio", request_type=entity_type.DeleteEntityTypeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + entity_type.DeleteEntityTypeRequest(), + {}, + ], +) +async def test_delete_entity_type_async(request_type, transport: str = "grpc_asyncio"): client = EntityTypesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2546,7 +2569,7 @@ async def test_delete_entity_type_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( @@ -2566,11 +2589,6 @@ async def test_delete_entity_type_async( assert response is None -@pytest.mark.asyncio -async def test_delete_entity_type_async_from_dict(): - await test_delete_entity_type_async(request_type=dict) - - def test_delete_entity_type_field_headers(): client = EntityTypesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2721,8 +2739,8 @@ async def test_delete_entity_type_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - entity_type.ListEntityTypesRequest, - dict, + entity_type.ListEntityTypesRequest(), + {}, ], ) def test_list_entity_types(request_type, transport: str = "grpc"): @@ -2733,7 +2751,7 @@ def test_list_entity_types(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2783,11 +2801,12 @@ def test_list_entity_types_non_empty_request_with_auto_populated_field(): client.list_entity_types(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == entity_type.ListEntityTypesRequest( + request_msg = entity_type.ListEntityTypesRequest( parent="parent_value", language_code="language_code_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_entity_types_use_cached_wrapped_rpc(): @@ -2870,9 +2889,14 @@ async def test_list_entity_types_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_entity_types_async( - transport: str = "grpc_asyncio", request_type=entity_type.ListEntityTypesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + entity_type.ListEntityTypesRequest(), + {}, + ], +) +async def test_list_entity_types_async(request_type, transport: str = "grpc_asyncio"): client = EntityTypesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2880,7 +2904,7 @@ async def test_list_entity_types_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( @@ -2905,11 +2929,6 @@ async def test_list_entity_types_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_entity_types_async_from_dict(): - await test_list_entity_types_async(request_type=dict) - - def test_list_entity_types_field_headers(): client = EntityTypesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3262,8 +3281,8 @@ async def test_list_entity_types_async_pages(): @pytest.mark.parametrize( "request_type", [ - entity_type.ExportEntityTypesRequest, - dict, + entity_type.ExportEntityTypesRequest(), + {}, ], ) def test_export_entity_types(request_type, transport: str = "grpc"): @@ -3274,7 +3293,7 @@ def test_export_entity_types(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3321,11 +3340,12 @@ def test_export_entity_types_non_empty_request_with_auto_populated_field(): client.export_entity_types(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == entity_type.ExportEntityTypesRequest( + request_msg = entity_type.ExportEntityTypesRequest( parent="parent_value", entity_types_uri="entity_types_uri_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_export_entity_types_use_cached_wrapped_rpc(): @@ -3420,9 +3440,14 @@ async def test_export_entity_types_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_export_entity_types_async( - transport: str = "grpc_asyncio", request_type=entity_type.ExportEntityTypesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + entity_type.ExportEntityTypesRequest(), + {}, + ], +) +async def test_export_entity_types_async(request_type, transport: str = "grpc_asyncio"): client = EntityTypesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3430,7 +3455,7 @@ async def test_export_entity_types_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( @@ -3452,11 +3477,6 @@ async def test_export_entity_types_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_export_entity_types_async_from_dict(): - await test_export_entity_types_async(request_type=dict) - - def test_export_entity_types_field_headers(): client = EntityTypesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3525,8 +3545,8 @@ async def test_export_entity_types_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - entity_type.ImportEntityTypesRequest, - dict, + entity_type.ImportEntityTypesRequest(), + {}, ], ) def test_import_entity_types(request_type, transport: str = "grpc"): @@ -3537,7 +3557,7 @@ def test_import_entity_types(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3584,11 +3604,12 @@ def test_import_entity_types_non_empty_request_with_auto_populated_field(): client.import_entity_types(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == entity_type.ImportEntityTypesRequest( + request_msg = entity_type.ImportEntityTypesRequest( parent="parent_value", entity_types_uri="entity_types_uri_value", target_entity_type="target_entity_type_value", ) + assert args[0] == request_msg def test_import_entity_types_use_cached_wrapped_rpc(): @@ -3683,9 +3704,14 @@ async def test_import_entity_types_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_import_entity_types_async( - transport: str = "grpc_asyncio", request_type=entity_type.ImportEntityTypesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + entity_type.ImportEntityTypesRequest(), + {}, + ], +) +async def test_import_entity_types_async(request_type, transport: str = "grpc_asyncio"): client = EntityTypesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3693,7 +3719,7 @@ async def test_import_entity_types_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( @@ -3715,11 +3741,6 @@ async def test_import_entity_types_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_import_entity_types_async_from_dict(): - await test_import_entity_types_async(request_type=dict) - - def test_import_entity_types_field_headers(): client = EntityTypesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5197,7 +5218,6 @@ def test_get_entity_type_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.GetEntityTypeRequest() - assert args[0] == request_msg @@ -5220,7 +5240,6 @@ def test_create_entity_type_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_entity_type.CreateEntityTypeRequest() - assert args[0] == request_msg @@ -5243,7 +5262,6 @@ def test_update_entity_type_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_entity_type.UpdateEntityTypeRequest() - assert args[0] == request_msg @@ -5266,7 +5284,6 @@ def test_delete_entity_type_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.DeleteEntityTypeRequest() - assert args[0] == request_msg @@ -5289,7 +5306,6 @@ def test_list_entity_types_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.ListEntityTypesRequest() - assert args[0] == request_msg @@ -5312,7 +5328,6 @@ def test_export_entity_types_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.ExportEntityTypesRequest() - assert args[0] == request_msg @@ -5335,7 +5350,6 @@ def test_import_entity_types_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.ImportEntityTypesRequest() - assert args[0] == request_msg @@ -5381,7 +5395,6 @@ async def test_get_entity_type_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.GetEntityTypeRequest() - assert args[0] == request_msg @@ -5415,7 +5428,6 @@ async def test_create_entity_type_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_entity_type.CreateEntityTypeRequest() - assert args[0] == request_msg @@ -5449,7 +5461,6 @@ async def test_update_entity_type_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_entity_type.UpdateEntityTypeRequest() - assert args[0] == request_msg @@ -5474,7 +5485,6 @@ async def test_delete_entity_type_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.DeleteEntityTypeRequest() - assert args[0] == request_msg @@ -5503,7 +5513,6 @@ async def test_list_entity_types_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.ListEntityTypesRequest() - assert args[0] == request_msg @@ -5530,7 +5539,6 @@ async def test_export_entity_types_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.ExportEntityTypesRequest() - assert args[0] == request_msg @@ -5557,7 +5565,6 @@ async def test_import_entity_types_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.ImportEntityTypesRequest() - assert args[0] == request_msg @@ -7007,7 +7014,6 @@ def test_get_entity_type_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.GetEntityTypeRequest() - assert args[0] == request_msg @@ -7029,7 +7035,6 @@ def test_create_entity_type_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_entity_type.CreateEntityTypeRequest() - assert args[0] == request_msg @@ -7051,7 +7056,6 @@ def test_update_entity_type_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_entity_type.UpdateEntityTypeRequest() - assert args[0] == request_msg @@ -7073,7 +7077,6 @@ def test_delete_entity_type_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.DeleteEntityTypeRequest() - assert args[0] == request_msg @@ -7095,7 +7098,6 @@ def test_list_entity_types_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.ListEntityTypesRequest() - assert args[0] == request_msg @@ -7117,7 +7119,6 @@ def test_export_entity_types_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.ExportEntityTypesRequest() - assert args[0] == request_msg @@ -7139,7 +7140,6 @@ def test_import_entity_types_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.ImportEntityTypesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_environments.py b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_environments.py index de5d0255f183..cc5877519508 100644 --- a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_environments.py +++ b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_environments.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 @@ -118,6 +119,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" @@ -1301,8 +1317,8 @@ def test_environments_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - environment.ListEnvironmentsRequest, - dict, + environment.ListEnvironmentsRequest(), + {}, ], ) def test_list_environments(request_type, transport: str = "grpc"): @@ -1313,7 +1329,7 @@ def test_list_environments(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1362,10 +1378,11 @@ def test_list_environments_non_empty_request_with_auto_populated_field(): client.list_environments(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environment.ListEnvironmentsRequest( + request_msg = environment.ListEnvironmentsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_environments_use_cached_wrapped_rpc(): @@ -1448,9 +1465,14 @@ async def test_list_environments_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_environments_async( - transport: str = "grpc_asyncio", request_type=environment.ListEnvironmentsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + environment.ListEnvironmentsRequest(), + {}, + ], +) +async def test_list_environments_async(request_type, transport: str = "grpc_asyncio"): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1458,7 +1480,7 @@ async def test_list_environments_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( @@ -1483,11 +1505,6 @@ async def test_list_environments_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_environments_async_from_dict(): - await test_list_environments_async(request_type=dict) - - def test_list_environments_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1840,8 +1857,8 @@ async def test_list_environments_async_pages(): @pytest.mark.parametrize( "request_type", [ - environment.GetEnvironmentRequest, - dict, + environment.GetEnvironmentRequest(), + {}, ], ) def test_get_environment(request_type, transport: str = "grpc"): @@ -1852,7 +1869,7 @@ def test_get_environment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_environment), "__call__") as call: @@ -1900,9 +1917,10 @@ def test_get_environment_non_empty_request_with_auto_populated_field(): client.get_environment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environment.GetEnvironmentRequest( + request_msg = environment.GetEnvironmentRequest( name="name_value", ) + assert args[0] == request_msg def test_get_environment_use_cached_wrapped_rpc(): @@ -1983,9 +2001,14 @@ async def test_get_environment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_environment_async( - transport: str = "grpc_asyncio", request_type=environment.GetEnvironmentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + environment.GetEnvironmentRequest(), + {}, + ], +) +async def test_get_environment_async(request_type, transport: str = "grpc_asyncio"): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1993,7 +2016,7 @@ async def test_get_environment_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_environment), "__call__") as call: @@ -2020,11 +2043,6 @@ async def test_get_environment_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_get_environment_async_from_dict(): - await test_get_environment_async(request_type=dict) - - def test_get_environment_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2171,8 +2189,8 @@ async def test_get_environment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcdc_environment.CreateEnvironmentRequest, - dict, + gcdc_environment.CreateEnvironmentRequest(), + {}, ], ) def test_create_environment(request_type, transport: str = "grpc"): @@ -2183,7 +2201,7 @@ def test_create_environment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2228,9 +2246,10 @@ def test_create_environment_non_empty_request_with_auto_populated_field(): client.create_environment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcdc_environment.CreateEnvironmentRequest( + request_msg = gcdc_environment.CreateEnvironmentRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_environment_use_cached_wrapped_rpc(): @@ -2325,10 +2344,14 @@ async def test_create_environment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_environment_async( - transport: str = "grpc_asyncio", - request_type=gcdc_environment.CreateEnvironmentRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + gcdc_environment.CreateEnvironmentRequest(), + {}, + ], +) +async def test_create_environment_async(request_type, transport: str = "grpc_asyncio"): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2336,7 +2359,7 @@ async def test_create_environment_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( @@ -2358,11 +2381,6 @@ async def test_create_environment_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_environment_async_from_dict(): - await test_create_environment_async(request_type=dict) - - def test_create_environment_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2527,8 +2545,8 @@ async def test_create_environment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcdc_environment.UpdateEnvironmentRequest, - dict, + gcdc_environment.UpdateEnvironmentRequest(), + {}, ], ) def test_update_environment(request_type, transport: str = "grpc"): @@ -2539,7 +2557,7 @@ def test_update_environment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2582,7 +2600,8 @@ def test_update_environment_non_empty_request_with_auto_populated_field(): client.update_environment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcdc_environment.UpdateEnvironmentRequest() + request_msg = gcdc_environment.UpdateEnvironmentRequest() + assert args[0] == request_msg def test_update_environment_use_cached_wrapped_rpc(): @@ -2677,10 +2696,14 @@ async def test_update_environment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_environment_async( - transport: str = "grpc_asyncio", - request_type=gcdc_environment.UpdateEnvironmentRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + gcdc_environment.UpdateEnvironmentRequest(), + {}, + ], +) +async def test_update_environment_async(request_type, transport: str = "grpc_asyncio"): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2688,7 +2711,7 @@ async def test_update_environment_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( @@ -2710,11 +2733,6 @@ async def test_update_environment_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_environment_async_from_dict(): - await test_update_environment_async(request_type=dict) - - def test_update_environment_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2879,8 +2897,8 @@ async def test_update_environment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - environment.DeleteEnvironmentRequest, - dict, + environment.DeleteEnvironmentRequest(), + {}, ], ) def test_delete_environment(request_type, transport: str = "grpc"): @@ -2891,7 +2909,7 @@ def test_delete_environment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2936,9 +2954,10 @@ def test_delete_environment_non_empty_request_with_auto_populated_field(): client.delete_environment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environment.DeleteEnvironmentRequest( + request_msg = environment.DeleteEnvironmentRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_environment_use_cached_wrapped_rpc(): @@ -3023,9 +3042,14 @@ async def test_delete_environment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_environment_async( - transport: str = "grpc_asyncio", request_type=environment.DeleteEnvironmentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + environment.DeleteEnvironmentRequest(), + {}, + ], +) +async def test_delete_environment_async(request_type, transport: str = "grpc_asyncio"): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3033,7 +3057,7 @@ async def test_delete_environment_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( @@ -3053,11 +3077,6 @@ async def test_delete_environment_async( assert response is None -@pytest.mark.asyncio -async def test_delete_environment_async_from_dict(): - await test_delete_environment_async(request_type=dict) - - def test_delete_environment_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3208,8 +3227,8 @@ async def test_delete_environment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - environment.LookupEnvironmentHistoryRequest, - dict, + environment.LookupEnvironmentHistoryRequest(), + {}, ], ) def test_lookup_environment_history(request_type, transport: str = "grpc"): @@ -3220,7 +3239,7 @@ def test_lookup_environment_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( @@ -3269,10 +3288,11 @@ def test_lookup_environment_history_non_empty_request_with_auto_populated_field( client.lookup_environment_history(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environment.LookupEnvironmentHistoryRequest( + request_msg = environment.LookupEnvironmentHistoryRequest( name="name_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_lookup_environment_history_use_cached_wrapped_rpc(): @@ -3358,9 +3378,15 @@ async def test_lookup_environment_history_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + environment.LookupEnvironmentHistoryRequest(), + {}, + ], +) async def test_lookup_environment_history_async( - transport: str = "grpc_asyncio", - request_type=environment.LookupEnvironmentHistoryRequest, + request_type, transport: str = "grpc_asyncio" ): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), @@ -3369,7 +3395,7 @@ async def test_lookup_environment_history_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( @@ -3394,11 +3420,6 @@ async def test_lookup_environment_history_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_lookup_environment_history_async_from_dict(): - await test_lookup_environment_history_async(request_type=dict) - - def test_lookup_environment_history_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3753,8 +3774,8 @@ async def test_lookup_environment_history_async_pages(): @pytest.mark.parametrize( "request_type", [ - environment.RunContinuousTestRequest, - dict, + environment.RunContinuousTestRequest(), + {}, ], ) def test_run_continuous_test(request_type, transport: str = "grpc"): @@ -3765,7 +3786,7 @@ def test_run_continuous_test(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,9 +3831,10 @@ def test_run_continuous_test_non_empty_request_with_auto_populated_field(): client.run_continuous_test(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environment.RunContinuousTestRequest( + request_msg = environment.RunContinuousTestRequest( environment="environment_value", ) + assert args[0] == request_msg def test_run_continuous_test_use_cached_wrapped_rpc(): @@ -3907,9 +3929,14 @@ async def test_run_continuous_test_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_run_continuous_test_async( - transport: str = "grpc_asyncio", request_type=environment.RunContinuousTestRequest -): +@pytest.mark.parametrize( + "request_type", + [ + environment.RunContinuousTestRequest(), + {}, + ], +) +async def test_run_continuous_test_async(request_type, transport: str = "grpc_asyncio"): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3917,7 +3944,7 @@ async def test_run_continuous_test_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( @@ -3939,11 +3966,6 @@ async def test_run_continuous_test_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_run_continuous_test_async_from_dict(): - await test_run_continuous_test_async(request_type=dict) - - def test_run_continuous_test_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4012,8 +4034,8 @@ async def test_run_continuous_test_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - environment.ListContinuousTestResultsRequest, - dict, + environment.ListContinuousTestResultsRequest(), + {}, ], ) def test_list_continuous_test_results(request_type, transport: str = "grpc"): @@ -4024,7 +4046,7 @@ def test_list_continuous_test_results(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4073,10 +4095,11 @@ def test_list_continuous_test_results_non_empty_request_with_auto_populated_fiel client.list_continuous_test_results(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environment.ListContinuousTestResultsRequest( + request_msg = environment.ListContinuousTestResultsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_continuous_test_results_use_cached_wrapped_rpc(): @@ -4162,9 +4185,15 @@ async def test_list_continuous_test_results_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + environment.ListContinuousTestResultsRequest(), + {}, + ], +) async def test_list_continuous_test_results_async( - transport: str = "grpc_asyncio", - request_type=environment.ListContinuousTestResultsRequest, + request_type, transport: str = "grpc_asyncio" ): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), @@ -4173,7 +4202,7 @@ async def test_list_continuous_test_results_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( @@ -4198,11 +4227,6 @@ async def test_list_continuous_test_results_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_continuous_test_results_async_from_dict(): - await test_list_continuous_test_results_async(request_type=dict) - - def test_list_continuous_test_results_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4559,8 +4583,8 @@ async def test_list_continuous_test_results_async_pages(): @pytest.mark.parametrize( "request_type", [ - environment.DeployFlowRequest, - dict, + environment.DeployFlowRequest(), + {}, ], ) def test_deploy_flow(request_type, transport: str = "grpc"): @@ -4571,7 +4595,7 @@ def test_deploy_flow(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.deploy_flow), "__call__") as call: @@ -4613,10 +4637,11 @@ def test_deploy_flow_non_empty_request_with_auto_populated_field(): client.deploy_flow(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environment.DeployFlowRequest( + request_msg = environment.DeployFlowRequest( environment="environment_value", flow_version="flow_version_value", ) + assert args[0] == request_msg def test_deploy_flow_use_cached_wrapped_rpc(): @@ -4707,9 +4732,14 @@ async def test_deploy_flow_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_deploy_flow_async( - transport: str = "grpc_asyncio", request_type=environment.DeployFlowRequest -): +@pytest.mark.parametrize( + "request_type", + [ + environment.DeployFlowRequest(), + {}, + ], +) +async def test_deploy_flow_async(request_type, transport: str = "grpc_asyncio"): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4717,7 +4747,7 @@ async def test_deploy_flow_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.deploy_flow), "__call__") as call: @@ -4737,11 +4767,6 @@ async def test_deploy_flow_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_deploy_flow_async_from_dict(): - await test_deploy_flow_async(request_type=dict) - - def test_deploy_flow_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6720,7 +6745,6 @@ def test_list_environments_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.ListEnvironmentsRequest() - assert args[0] == request_msg @@ -6741,7 +6765,6 @@ def test_get_environment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.GetEnvironmentRequest() - assert args[0] == request_msg @@ -6764,7 +6787,6 @@ def test_create_environment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_environment.CreateEnvironmentRequest() - assert args[0] == request_msg @@ -6787,7 +6809,6 @@ def test_update_environment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_environment.UpdateEnvironmentRequest() - assert args[0] == request_msg @@ -6810,7 +6831,6 @@ def test_delete_environment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.DeleteEnvironmentRequest() - assert args[0] == request_msg @@ -6833,7 +6853,6 @@ def test_lookup_environment_history_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.LookupEnvironmentHistoryRequest() - assert args[0] == request_msg @@ -6856,7 +6875,6 @@ def test_run_continuous_test_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.RunContinuousTestRequest() - assert args[0] == request_msg @@ -6879,7 +6897,6 @@ def test_list_continuous_test_results_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.ListContinuousTestResultsRequest() - assert args[0] == request_msg @@ -6900,7 +6917,6 @@ def test_deploy_flow_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.DeployFlowRequest() - assert args[0] == request_msg @@ -6943,7 +6959,6 @@ async def test_list_environments_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.ListEnvironmentsRequest() - assert args[0] == request_msg @@ -6972,7 +6987,6 @@ async def test_get_environment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.GetEnvironmentRequest() - assert args[0] == request_msg @@ -6999,7 +7013,6 @@ async def test_create_environment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_environment.CreateEnvironmentRequest() - assert args[0] == request_msg @@ -7026,7 +7039,6 @@ async def test_update_environment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_environment.UpdateEnvironmentRequest() - assert args[0] == request_msg @@ -7051,7 +7063,6 @@ async def test_delete_environment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.DeleteEnvironmentRequest() - assert args[0] == request_msg @@ -7080,7 +7091,6 @@ async def test_lookup_environment_history_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.LookupEnvironmentHistoryRequest() - assert args[0] == request_msg @@ -7107,7 +7117,6 @@ async def test_run_continuous_test_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.RunContinuousTestRequest() - assert args[0] == request_msg @@ -7136,7 +7145,6 @@ async def test_list_continuous_test_results_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.ListContinuousTestResultsRequest() - assert args[0] == request_msg @@ -7161,7 +7169,6 @@ async def test_deploy_flow_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.DeployFlowRequest() - assert args[0] == request_msg @@ -8929,7 +8936,6 @@ def test_list_environments_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.ListEnvironmentsRequest() - assert args[0] == request_msg @@ -8949,7 +8955,6 @@ def test_get_environment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.GetEnvironmentRequest() - assert args[0] == request_msg @@ -8971,7 +8976,6 @@ def test_create_environment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_environment.CreateEnvironmentRequest() - assert args[0] == request_msg @@ -8993,7 +8997,6 @@ def test_update_environment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_environment.UpdateEnvironmentRequest() - assert args[0] == request_msg @@ -9015,7 +9018,6 @@ def test_delete_environment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.DeleteEnvironmentRequest() - assert args[0] == request_msg @@ -9037,7 +9039,6 @@ def test_lookup_environment_history_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.LookupEnvironmentHistoryRequest() - assert args[0] == request_msg @@ -9059,7 +9060,6 @@ def test_run_continuous_test_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.RunContinuousTestRequest() - assert args[0] == request_msg @@ -9081,7 +9081,6 @@ def test_list_continuous_test_results_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.ListContinuousTestResultsRequest() - assert args[0] == request_msg @@ -9101,7 +9100,6 @@ def test_deploy_flow_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.DeployFlowRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_examples.py b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_examples.py index 6ce4fca002a6..9aab6a8028c0 100644 --- a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_examples.py +++ b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_examples.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 @@ -117,6 +118,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" @@ -1264,8 +1280,8 @@ def test_examples_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - gcdc_example.CreateExampleRequest, - dict, + gcdc_example.CreateExampleRequest(), + {}, ], ) def test_create_example(request_type, transport: str = "grpc"): @@ -1276,7 +1292,7 @@ def test_create_example(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_example), "__call__") as call: @@ -1330,9 +1346,10 @@ def test_create_example_non_empty_request_with_auto_populated_field(): client.create_example(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcdc_example.CreateExampleRequest( + request_msg = gcdc_example.CreateExampleRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_example_use_cached_wrapped_rpc(): @@ -1413,9 +1430,14 @@ async def test_create_example_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_example_async( - transport: str = "grpc_asyncio", request_type=gcdc_example.CreateExampleRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcdc_example.CreateExampleRequest(), + {}, + ], +) +async def test_create_example_async(request_type, transport: str = "grpc_asyncio"): client = ExamplesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1423,7 +1445,7 @@ async def test_create_example_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_example), "__call__") as call: @@ -1456,11 +1478,6 @@ async def test_create_example_async( assert response.language_code == "language_code_value" -@pytest.mark.asyncio -async def test_create_example_async_from_dict(): - await test_create_example_async(request_type=dict) - - def test_create_example_field_headers(): client = ExamplesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1617,8 +1634,8 @@ async def test_create_example_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - example.DeleteExampleRequest, - dict, + example.DeleteExampleRequest(), + {}, ], ) def test_delete_example(request_type, transport: str = "grpc"): @@ -1629,7 +1646,7 @@ def test_delete_example(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_example), "__call__") as call: @@ -1670,9 +1687,10 @@ def test_delete_example_non_empty_request_with_auto_populated_field(): client.delete_example(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == example.DeleteExampleRequest( + request_msg = example.DeleteExampleRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_example_use_cached_wrapped_rpc(): @@ -1753,9 +1771,14 @@ async def test_delete_example_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_example_async( - transport: str = "grpc_asyncio", request_type=example.DeleteExampleRequest -): +@pytest.mark.parametrize( + "request_type", + [ + example.DeleteExampleRequest(), + {}, + ], +) +async def test_delete_example_async(request_type, transport: str = "grpc_asyncio"): client = ExamplesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1763,7 +1786,7 @@ async def test_delete_example_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_example), "__call__") as call: @@ -1781,11 +1804,6 @@ async def test_delete_example_async( assert response is None -@pytest.mark.asyncio -async def test_delete_example_async_from_dict(): - await test_delete_example_async(request_type=dict) - - def test_delete_example_field_headers(): client = ExamplesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1928,8 +1946,8 @@ async def test_delete_example_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - example.ListExamplesRequest, - dict, + example.ListExamplesRequest(), + {}, ], ) def test_list_examples(request_type, transport: str = "grpc"): @@ -1940,7 +1958,7 @@ def test_list_examples(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_examples), "__call__") as call: @@ -1986,11 +2004,12 @@ def test_list_examples_non_empty_request_with_auto_populated_field(): client.list_examples(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == example.ListExamplesRequest( + request_msg = example.ListExamplesRequest( parent="parent_value", page_token="page_token_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_list_examples_use_cached_wrapped_rpc(): @@ -2071,9 +2090,14 @@ async def test_list_examples_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_examples_async( - transport: str = "grpc_asyncio", request_type=example.ListExamplesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + example.ListExamplesRequest(), + {}, + ], +) +async def test_list_examples_async(request_type, transport: str = "grpc_asyncio"): client = ExamplesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2081,7 +2105,7 @@ async def test_list_examples_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_examples), "__call__") as call: @@ -2104,11 +2128,6 @@ async def test_list_examples_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_examples_async_from_dict(): - await test_list_examples_async(request_type=dict) - - def test_list_examples_field_headers(): client = ExamplesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2445,8 +2464,8 @@ async def test_list_examples_async_pages(): @pytest.mark.parametrize( "request_type", [ - example.GetExampleRequest, - dict, + example.GetExampleRequest(), + {}, ], ) def test_get_example(request_type, transport: str = "grpc"): @@ -2457,7 +2476,7 @@ def test_get_example(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_example), "__call__") as call: @@ -2511,9 +2530,10 @@ def test_get_example_non_empty_request_with_auto_populated_field(): client.get_example(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == example.GetExampleRequest( + request_msg = example.GetExampleRequest( name="name_value", ) + assert args[0] == request_msg def test_get_example_use_cached_wrapped_rpc(): @@ -2594,9 +2614,14 @@ async def test_get_example_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_example_async( - transport: str = "grpc_asyncio", request_type=example.GetExampleRequest -): +@pytest.mark.parametrize( + "request_type", + [ + example.GetExampleRequest(), + {}, + ], +) +async def test_get_example_async(request_type, transport: str = "grpc_asyncio"): client = ExamplesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2604,7 +2629,7 @@ async def test_get_example_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_example), "__call__") as call: @@ -2637,11 +2662,6 @@ async def test_get_example_async( assert response.language_code == "language_code_value" -@pytest.mark.asyncio -async def test_get_example_async_from_dict(): - await test_get_example_async(request_type=dict) - - def test_get_example_field_headers(): client = ExamplesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2784,8 +2804,8 @@ async def test_get_example_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcdc_example.UpdateExampleRequest, - dict, + gcdc_example.UpdateExampleRequest(), + {}, ], ) def test_update_example(request_type, transport: str = "grpc"): @@ -2796,7 +2816,7 @@ def test_update_example(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_example), "__call__") as call: @@ -2848,7 +2868,8 @@ def test_update_example_non_empty_request_with_auto_populated_field(): client.update_example(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcdc_example.UpdateExampleRequest() + request_msg = gcdc_example.UpdateExampleRequest() + assert args[0] == request_msg def test_update_example_use_cached_wrapped_rpc(): @@ -2929,9 +2950,14 @@ async def test_update_example_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_example_async( - transport: str = "grpc_asyncio", request_type=gcdc_example.UpdateExampleRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcdc_example.UpdateExampleRequest(), + {}, + ], +) +async def test_update_example_async(request_type, transport: str = "grpc_asyncio"): client = ExamplesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2939,7 +2965,7 @@ async def test_update_example_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_example), "__call__") as call: @@ -2972,11 +2998,6 @@ async def test_update_example_async( assert response.language_code == "language_code_value" -@pytest.mark.asyncio -async def test_update_example_async_from_dict(): - await test_update_example_async(request_type=dict) - - def test_update_example_field_headers(): client = ExamplesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4235,7 +4256,6 @@ def test_create_example_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_example.CreateExampleRequest() - assert args[0] == request_msg @@ -4256,7 +4276,6 @@ def test_delete_example_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = example.DeleteExampleRequest() - assert args[0] == request_msg @@ -4277,7 +4296,6 @@ def test_list_examples_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = example.ListExamplesRequest() - assert args[0] == request_msg @@ -4298,7 +4316,6 @@ def test_get_example_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = example.GetExampleRequest() - assert args[0] == request_msg @@ -4319,7 +4336,6 @@ def test_update_example_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_example.UpdateExampleRequest() - assert args[0] == request_msg @@ -4365,7 +4381,6 @@ async def test_create_example_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_example.CreateExampleRequest() - assert args[0] == request_msg @@ -4388,7 +4403,6 @@ async def test_delete_example_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = example.DeleteExampleRequest() - assert args[0] == request_msg @@ -4415,7 +4429,6 @@ async def test_list_examples_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = example.ListExamplesRequest() - assert args[0] == request_msg @@ -4447,7 +4460,6 @@ async def test_get_example_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = example.GetExampleRequest() - assert args[0] == request_msg @@ -4479,7 +4491,6 @@ async def test_update_example_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_example.UpdateExampleRequest() - assert args[0] == request_msg @@ -5960,7 +5971,6 @@ def test_create_example_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_example.CreateExampleRequest() - assert args[0] == request_msg @@ -5980,7 +5990,6 @@ def test_delete_example_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = example.DeleteExampleRequest() - assert args[0] == request_msg @@ -6000,7 +6009,6 @@ def test_list_examples_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = example.ListExamplesRequest() - assert args[0] == request_msg @@ -6020,7 +6028,6 @@ def test_get_example_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = example.GetExampleRequest() - assert args[0] == request_msg @@ -6040,7 +6047,6 @@ def test_update_example_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_example.UpdateExampleRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_experiments.py b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_experiments.py index 886c0c09bc09..4fdc6e6e85e2 100644 --- a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_experiments.py +++ b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_experiments.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 @@ -113,6 +114,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" @@ -1281,8 +1297,8 @@ def test_experiments_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - experiment.ListExperimentsRequest, - dict, + experiment.ListExperimentsRequest(), + {}, ], ) def test_list_experiments(request_type, transport: str = "grpc"): @@ -1293,7 +1309,7 @@ def test_list_experiments(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_experiments), "__call__") as call: @@ -1338,10 +1354,11 @@ def test_list_experiments_non_empty_request_with_auto_populated_field(): client.list_experiments(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == experiment.ListExperimentsRequest( + request_msg = experiment.ListExperimentsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_experiments_use_cached_wrapped_rpc(): @@ -1424,9 +1441,14 @@ async def test_list_experiments_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_experiments_async( - transport: str = "grpc_asyncio", request_type=experiment.ListExperimentsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + experiment.ListExperimentsRequest(), + {}, + ], +) +async def test_list_experiments_async(request_type, transport: str = "grpc_asyncio"): client = ExperimentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1434,7 +1456,7 @@ async def test_list_experiments_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_experiments), "__call__") as call: @@ -1457,11 +1479,6 @@ async def test_list_experiments_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_experiments_async_from_dict(): - await test_list_experiments_async(request_type=dict) - - def test_list_experiments_field_headers(): client = ExperimentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1798,8 +1815,8 @@ async def test_list_experiments_async_pages(): @pytest.mark.parametrize( "request_type", [ - experiment.GetExperimentRequest, - dict, + experiment.GetExperimentRequest(), + {}, ], ) def test_get_experiment(request_type, transport: str = "grpc"): @@ -1810,7 +1827,7 @@ def test_get_experiment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_experiment), "__call__") as call: @@ -1862,9 +1879,10 @@ def test_get_experiment_non_empty_request_with_auto_populated_field(): client.get_experiment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == experiment.GetExperimentRequest( + request_msg = experiment.GetExperimentRequest( name="name_value", ) + assert args[0] == request_msg def test_get_experiment_use_cached_wrapped_rpc(): @@ -1945,9 +1963,14 @@ async def test_get_experiment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_experiment_async( - transport: str = "grpc_asyncio", request_type=experiment.GetExperimentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + experiment.GetExperimentRequest(), + {}, + ], +) +async def test_get_experiment_async(request_type, transport: str = "grpc_asyncio"): client = ExperimentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1955,7 +1978,7 @@ async def test_get_experiment_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_experiment), "__call__") as call: @@ -1986,11 +2009,6 @@ async def test_get_experiment_async( assert response.rollout_failure_reason == "rollout_failure_reason_value" -@pytest.mark.asyncio -async def test_get_experiment_async_from_dict(): - await test_get_experiment_async(request_type=dict) - - def test_get_experiment_field_headers(): client = ExperimentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2137,8 +2155,8 @@ async def test_get_experiment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcdc_experiment.CreateExperimentRequest, - dict, + gcdc_experiment.CreateExperimentRequest(), + {}, ], ) def test_create_experiment(request_type, transport: str = "grpc"): @@ -2149,7 +2167,7 @@ def test_create_experiment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2205,9 +2223,10 @@ def test_create_experiment_non_empty_request_with_auto_populated_field(): client.create_experiment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcdc_experiment.CreateExperimentRequest( + request_msg = gcdc_experiment.CreateExperimentRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_experiment_use_cached_wrapped_rpc(): @@ -2290,10 +2309,14 @@ async def test_create_experiment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_experiment_async( - transport: str = "grpc_asyncio", - request_type=gcdc_experiment.CreateExperimentRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + gcdc_experiment.CreateExperimentRequest(), + {}, + ], +) +async def test_create_experiment_async(request_type, transport: str = "grpc_asyncio"): client = ExperimentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2301,7 +2324,7 @@ async def test_create_experiment_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( @@ -2334,11 +2357,6 @@ async def test_create_experiment_async( assert response.rollout_failure_reason == "rollout_failure_reason_value" -@pytest.mark.asyncio -async def test_create_experiment_async_from_dict(): - await test_create_experiment_async(request_type=dict) - - def test_create_experiment_field_headers(): client = ExperimentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2503,8 +2521,8 @@ async def test_create_experiment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcdc_experiment.UpdateExperimentRequest, - dict, + gcdc_experiment.UpdateExperimentRequest(), + {}, ], ) def test_update_experiment(request_type, transport: str = "grpc"): @@ -2515,7 +2533,7 @@ def test_update_experiment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2569,7 +2587,8 @@ def test_update_experiment_non_empty_request_with_auto_populated_field(): client.update_experiment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcdc_experiment.UpdateExperimentRequest() + request_msg = gcdc_experiment.UpdateExperimentRequest() + assert args[0] == request_msg def test_update_experiment_use_cached_wrapped_rpc(): @@ -2652,10 +2671,14 @@ async def test_update_experiment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_experiment_async( - transport: str = "grpc_asyncio", - request_type=gcdc_experiment.UpdateExperimentRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + gcdc_experiment.UpdateExperimentRequest(), + {}, + ], +) +async def test_update_experiment_async(request_type, transport: str = "grpc_asyncio"): client = ExperimentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2663,7 +2686,7 @@ async def test_update_experiment_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( @@ -2696,11 +2719,6 @@ async def test_update_experiment_async( assert response.rollout_failure_reason == "rollout_failure_reason_value" -@pytest.mark.asyncio -async def test_update_experiment_async_from_dict(): - await test_update_experiment_async(request_type=dict) - - def test_update_experiment_field_headers(): client = ExperimentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2865,8 +2883,8 @@ async def test_update_experiment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - experiment.DeleteExperimentRequest, - dict, + experiment.DeleteExperimentRequest(), + {}, ], ) def test_delete_experiment(request_type, transport: str = "grpc"): @@ -2877,7 +2895,7 @@ def test_delete_experiment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2922,9 +2940,10 @@ def test_delete_experiment_non_empty_request_with_auto_populated_field(): client.delete_experiment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == experiment.DeleteExperimentRequest( + request_msg = experiment.DeleteExperimentRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_experiment_use_cached_wrapped_rpc(): @@ -3007,9 +3026,14 @@ async def test_delete_experiment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_experiment_async( - transport: str = "grpc_asyncio", request_type=experiment.DeleteExperimentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + experiment.DeleteExperimentRequest(), + {}, + ], +) +async def test_delete_experiment_async(request_type, transport: str = "grpc_asyncio"): client = ExperimentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3017,7 +3041,7 @@ async def test_delete_experiment_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( @@ -3037,11 +3061,6 @@ async def test_delete_experiment_async( assert response is None -@pytest.mark.asyncio -async def test_delete_experiment_async_from_dict(): - await test_delete_experiment_async(request_type=dict) - - def test_delete_experiment_field_headers(): client = ExperimentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3192,8 +3211,8 @@ async def test_delete_experiment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - experiment.StartExperimentRequest, - dict, + experiment.StartExperimentRequest(), + {}, ], ) def test_start_experiment(request_type, transport: str = "grpc"): @@ -3204,7 +3223,7 @@ def test_start_experiment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.start_experiment), "__call__") as call: @@ -3256,9 +3275,10 @@ def test_start_experiment_non_empty_request_with_auto_populated_field(): client.start_experiment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == experiment.StartExperimentRequest( + request_msg = experiment.StartExperimentRequest( name="name_value", ) + assert args[0] == request_msg def test_start_experiment_use_cached_wrapped_rpc(): @@ -3341,9 +3361,14 @@ async def test_start_experiment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_start_experiment_async( - transport: str = "grpc_asyncio", request_type=experiment.StartExperimentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + experiment.StartExperimentRequest(), + {}, + ], +) +async def test_start_experiment_async(request_type, transport: str = "grpc_asyncio"): client = ExperimentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3351,7 +3376,7 @@ async def test_start_experiment_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.start_experiment), "__call__") as call: @@ -3382,11 +3407,6 @@ async def test_start_experiment_async( assert response.rollout_failure_reason == "rollout_failure_reason_value" -@pytest.mark.asyncio -async def test_start_experiment_async_from_dict(): - await test_start_experiment_async(request_type=dict) - - def test_start_experiment_field_headers(): client = ExperimentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3533,8 +3553,8 @@ async def test_start_experiment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - experiment.StopExperimentRequest, - dict, + experiment.StopExperimentRequest(), + {}, ], ) def test_stop_experiment(request_type, transport: str = "grpc"): @@ -3545,7 +3565,7 @@ def test_stop_experiment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.stop_experiment), "__call__") as call: @@ -3597,9 +3617,10 @@ def test_stop_experiment_non_empty_request_with_auto_populated_field(): client.stop_experiment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == experiment.StopExperimentRequest( + request_msg = experiment.StopExperimentRequest( name="name_value", ) + assert args[0] == request_msg def test_stop_experiment_use_cached_wrapped_rpc(): @@ -3680,9 +3701,14 @@ async def test_stop_experiment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_stop_experiment_async( - transport: str = "grpc_asyncio", request_type=experiment.StopExperimentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + experiment.StopExperimentRequest(), + {}, + ], +) +async def test_stop_experiment_async(request_type, transport: str = "grpc_asyncio"): client = ExperimentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3690,7 +3716,7 @@ async def test_stop_experiment_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.stop_experiment), "__call__") as call: @@ -3721,11 +3747,6 @@ async def test_stop_experiment_async( assert response.rollout_failure_reason == "rollout_failure_reason_value" -@pytest.mark.asyncio -async def test_stop_experiment_async_from_dict(): - await test_stop_experiment_async(request_type=dict) - - def test_stop_experiment_field_headers(): client = ExperimentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5360,7 +5381,6 @@ def test_list_experiments_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = experiment.ListExperimentsRequest() - assert args[0] == request_msg @@ -5381,7 +5401,6 @@ def test_get_experiment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = experiment.GetExperimentRequest() - assert args[0] == request_msg @@ -5404,7 +5423,6 @@ def test_create_experiment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_experiment.CreateExperimentRequest() - assert args[0] == request_msg @@ -5427,7 +5445,6 @@ def test_update_experiment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_experiment.UpdateExperimentRequest() - assert args[0] == request_msg @@ -5450,7 +5467,6 @@ def test_delete_experiment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = experiment.DeleteExperimentRequest() - assert args[0] == request_msg @@ -5471,7 +5487,6 @@ def test_start_experiment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = experiment.StartExperimentRequest() - assert args[0] == request_msg @@ -5492,7 +5507,6 @@ def test_stop_experiment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = experiment.StopExperimentRequest() - assert args[0] == request_msg @@ -5533,7 +5547,6 @@ async def test_list_experiments_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = experiment.ListExperimentsRequest() - assert args[0] == request_msg @@ -5564,7 +5577,6 @@ async def test_get_experiment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = experiment.GetExperimentRequest() - assert args[0] == request_msg @@ -5597,7 +5609,6 @@ async def test_create_experiment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_experiment.CreateExperimentRequest() - assert args[0] == request_msg @@ -5630,7 +5641,6 @@ async def test_update_experiment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_experiment.UpdateExperimentRequest() - assert args[0] == request_msg @@ -5655,7 +5665,6 @@ async def test_delete_experiment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = experiment.DeleteExperimentRequest() - assert args[0] == request_msg @@ -5686,7 +5695,6 @@ async def test_start_experiment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = experiment.StartExperimentRequest() - assert args[0] == request_msg @@ -5717,7 +5725,6 @@ async def test_stop_experiment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = experiment.StopExperimentRequest() - assert args[0] == request_msg @@ -7286,7 +7293,6 @@ def test_list_experiments_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = experiment.ListExperimentsRequest() - assert args[0] == request_msg @@ -7306,7 +7312,6 @@ def test_get_experiment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = experiment.GetExperimentRequest() - assert args[0] == request_msg @@ -7328,7 +7333,6 @@ def test_create_experiment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_experiment.CreateExperimentRequest() - assert args[0] == request_msg @@ -7350,7 +7354,6 @@ def test_update_experiment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_experiment.UpdateExperimentRequest() - assert args[0] == request_msg @@ -7372,7 +7375,6 @@ def test_delete_experiment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = experiment.DeleteExperimentRequest() - assert args[0] == request_msg @@ -7392,7 +7394,6 @@ def test_start_experiment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = experiment.StartExperimentRequest() - assert args[0] == request_msg @@ -7412,7 +7413,6 @@ def test_stop_experiment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = experiment.StopExperimentRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_flows.py b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_flows.py index bfc4c52f33ff..1c00d5d427ba 100644 --- a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_flows.py +++ b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_flows.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 @@ -131,6 +132,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" @@ -1262,8 +1278,8 @@ def test_flows_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - gcdc_flow.CreateFlowRequest, - dict, + gcdc_flow.CreateFlowRequest(), + {}, ], ) def test_create_flow(request_type, transport: str = "grpc"): @@ -1274,7 +1290,7 @@ def test_create_flow(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_flow), "__call__") as call: @@ -1327,10 +1343,11 @@ def test_create_flow_non_empty_request_with_auto_populated_field(): client.create_flow(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcdc_flow.CreateFlowRequest( + request_msg = gcdc_flow.CreateFlowRequest( parent="parent_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_create_flow_use_cached_wrapped_rpc(): @@ -1411,9 +1428,14 @@ async def test_create_flow_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_flow_async( - transport: str = "grpc_asyncio", request_type=gcdc_flow.CreateFlowRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcdc_flow.CreateFlowRequest(), + {}, + ], +) +async def test_create_flow_async(request_type, transport: str = "grpc_asyncio"): client = FlowsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1421,7 +1443,7 @@ async def test_create_flow_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_flow), "__call__") as call: @@ -1452,11 +1474,6 @@ async def test_create_flow_async( assert response.locked is True -@pytest.mark.asyncio -async def test_create_flow_async_from_dict(): - await test_create_flow_async(request_type=dict) - - def test_create_flow_field_headers(): client = FlowsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1609,8 +1626,8 @@ async def test_create_flow_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - flow.DeleteFlowRequest, - dict, + flow.DeleteFlowRequest(), + {}, ], ) def test_delete_flow(request_type, transport: str = "grpc"): @@ -1621,7 +1638,7 @@ def test_delete_flow(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_flow), "__call__") as call: @@ -1662,9 +1679,10 @@ def test_delete_flow_non_empty_request_with_auto_populated_field(): client.delete_flow(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == flow.DeleteFlowRequest( + request_msg = flow.DeleteFlowRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_flow_use_cached_wrapped_rpc(): @@ -1745,9 +1763,14 @@ async def test_delete_flow_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_flow_async( - transport: str = "grpc_asyncio", request_type=flow.DeleteFlowRequest -): +@pytest.mark.parametrize( + "request_type", + [ + flow.DeleteFlowRequest(), + {}, + ], +) +async def test_delete_flow_async(request_type, transport: str = "grpc_asyncio"): client = FlowsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1755,7 +1778,7 @@ async def test_delete_flow_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_flow), "__call__") as call: @@ -1773,11 +1796,6 @@ async def test_delete_flow_async( assert response is None -@pytest.mark.asyncio -async def test_delete_flow_async_from_dict(): - await test_delete_flow_async(request_type=dict) - - def test_delete_flow_field_headers(): client = FlowsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1920,8 +1938,8 @@ async def test_delete_flow_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - flow.ListFlowsRequest, - dict, + flow.ListFlowsRequest(), + {}, ], ) def test_list_flows(request_type, transport: str = "grpc"): @@ -1932,7 +1950,7 @@ def test_list_flows(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_flows), "__call__") as call: @@ -1978,11 +1996,12 @@ def test_list_flows_non_empty_request_with_auto_populated_field(): client.list_flows(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == flow.ListFlowsRequest( + request_msg = flow.ListFlowsRequest( parent="parent_value", page_token="page_token_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_list_flows_use_cached_wrapped_rpc(): @@ -2061,9 +2080,14 @@ async def test_list_flows_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_list_flows_async( - transport: str = "grpc_asyncio", request_type=flow.ListFlowsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + flow.ListFlowsRequest(), + {}, + ], +) +async def test_list_flows_async(request_type, transport: str = "grpc_asyncio"): client = FlowsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2071,7 +2095,7 @@ async def test_list_flows_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_flows), "__call__") as call: @@ -2094,11 +2118,6 @@ async def test_list_flows_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_flows_async_from_dict(): - await test_list_flows_async(request_type=dict) - - def test_list_flows_field_headers(): client = FlowsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2435,8 +2454,8 @@ async def test_list_flows_async_pages(): @pytest.mark.parametrize( "request_type", [ - flow.GetFlowRequest, - dict, + flow.GetFlowRequest(), + {}, ], ) def test_get_flow(request_type, transport: str = "grpc"): @@ -2447,7 +2466,7 @@ def test_get_flow(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_flow), "__call__") as call: @@ -2500,10 +2519,11 @@ def test_get_flow_non_empty_request_with_auto_populated_field(): client.get_flow(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == flow.GetFlowRequest( + request_msg = flow.GetFlowRequest( name="name_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_get_flow_use_cached_wrapped_rpc(): @@ -2582,9 +2602,14 @@ async def test_get_flow_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn @pytest.mark.asyncio -async def test_get_flow_async( - transport: str = "grpc_asyncio", request_type=flow.GetFlowRequest -): +@pytest.mark.parametrize( + "request_type", + [ + flow.GetFlowRequest(), + {}, + ], +) +async def test_get_flow_async(request_type, transport: str = "grpc_asyncio"): client = FlowsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2592,7 +2617,7 @@ async def test_get_flow_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_flow), "__call__") as call: @@ -2623,11 +2648,6 @@ async def test_get_flow_async( assert response.locked is True -@pytest.mark.asyncio -async def test_get_flow_async_from_dict(): - await test_get_flow_async(request_type=dict) - - def test_get_flow_field_headers(): client = FlowsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2770,8 +2790,8 @@ async def test_get_flow_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcdc_flow.UpdateFlowRequest, - dict, + gcdc_flow.UpdateFlowRequest(), + {}, ], ) def test_update_flow(request_type, transport: str = "grpc"): @@ -2782,7 +2802,7 @@ def test_update_flow(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_flow), "__call__") as call: @@ -2834,9 +2854,10 @@ def test_update_flow_non_empty_request_with_auto_populated_field(): client.update_flow(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcdc_flow.UpdateFlowRequest( + request_msg = gcdc_flow.UpdateFlowRequest( language_code="language_code_value", ) + assert args[0] == request_msg def test_update_flow_use_cached_wrapped_rpc(): @@ -2917,9 +2938,14 @@ async def test_update_flow_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_flow_async( - transport: str = "grpc_asyncio", request_type=gcdc_flow.UpdateFlowRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcdc_flow.UpdateFlowRequest(), + {}, + ], +) +async def test_update_flow_async(request_type, transport: str = "grpc_asyncio"): client = FlowsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2927,7 +2953,7 @@ async def test_update_flow_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_flow), "__call__") as call: @@ -2958,11 +2984,6 @@ async def test_update_flow_async( assert response.locked is True -@pytest.mark.asyncio -async def test_update_flow_async_from_dict(): - await test_update_flow_async(request_type=dict) - - def test_update_flow_field_headers(): client = FlowsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3115,8 +3136,8 @@ async def test_update_flow_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - flow.TrainFlowRequest, - dict, + flow.TrainFlowRequest(), + {}, ], ) def test_train_flow(request_type, transport: str = "grpc"): @@ -3127,7 +3148,7 @@ def test_train_flow(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.train_flow), "__call__") as call: @@ -3168,9 +3189,10 @@ def test_train_flow_non_empty_request_with_auto_populated_field(): client.train_flow(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == flow.TrainFlowRequest( + request_msg = flow.TrainFlowRequest( name="name_value", ) + assert args[0] == request_msg def test_train_flow_use_cached_wrapped_rpc(): @@ -3259,9 +3281,14 @@ async def test_train_flow_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_train_flow_async( - transport: str = "grpc_asyncio", request_type=flow.TrainFlowRequest -): +@pytest.mark.parametrize( + "request_type", + [ + flow.TrainFlowRequest(), + {}, + ], +) +async def test_train_flow_async(request_type, transport: str = "grpc_asyncio"): client = FlowsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3269,7 +3296,7 @@ async def test_train_flow_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.train_flow), "__call__") as call: @@ -3289,11 +3316,6 @@ async def test_train_flow_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_train_flow_async_from_dict(): - await test_train_flow_async(request_type=dict) - - def test_train_flow_field_headers(): client = FlowsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3440,8 +3462,8 @@ async def test_train_flow_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - flow.ValidateFlowRequest, - dict, + flow.ValidateFlowRequest(), + {}, ], ) def test_validate_flow(request_type, transport: str = "grpc"): @@ -3452,7 +3474,7 @@ def test_validate_flow(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.validate_flow), "__call__") as call: @@ -3497,10 +3519,11 @@ def test_validate_flow_non_empty_request_with_auto_populated_field(): client.validate_flow(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == flow.ValidateFlowRequest( + request_msg = flow.ValidateFlowRequest( name="name_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_validate_flow_use_cached_wrapped_rpc(): @@ -3581,9 +3604,14 @@ async def test_validate_flow_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_validate_flow_async( - transport: str = "grpc_asyncio", request_type=flow.ValidateFlowRequest -): +@pytest.mark.parametrize( + "request_type", + [ + flow.ValidateFlowRequest(), + {}, + ], +) +async def test_validate_flow_async(request_type, transport: str = "grpc_asyncio"): client = FlowsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3591,7 +3619,7 @@ async def test_validate_flow_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.validate_flow), "__call__") as call: @@ -3614,11 +3642,6 @@ async def test_validate_flow_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_validate_flow_async_from_dict(): - await test_validate_flow_async(request_type=dict) - - def test_validate_flow_field_headers(): client = FlowsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3683,8 +3706,8 @@ async def test_validate_flow_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - flow.GetFlowValidationResultRequest, - dict, + flow.GetFlowValidationResultRequest(), + {}, ], ) def test_get_flow_validation_result(request_type, transport: str = "grpc"): @@ -3695,7 +3718,7 @@ def test_get_flow_validation_result(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3744,10 +3767,11 @@ def test_get_flow_validation_result_non_empty_request_with_auto_populated_field( client.get_flow_validation_result(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == flow.GetFlowValidationResultRequest( + request_msg = flow.GetFlowValidationResultRequest( name="name_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_get_flow_validation_result_use_cached_wrapped_rpc(): @@ -3833,8 +3857,15 @@ async def test_get_flow_validation_result_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + flow.GetFlowValidationResultRequest(), + {}, + ], +) async def test_get_flow_validation_result_async( - transport: str = "grpc_asyncio", request_type=flow.GetFlowValidationResultRequest + request_type, transport: str = "grpc_asyncio" ): client = FlowsAsyncClient( credentials=async_anonymous_credentials(), @@ -3843,7 +3874,7 @@ async def test_get_flow_validation_result_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( @@ -3868,11 +3899,6 @@ async def test_get_flow_validation_result_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_flow_validation_result_async_from_dict(): - await test_get_flow_validation_result_async(request_type=dict) - - def test_get_flow_validation_result_field_headers(): client = FlowsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4027,8 +4053,8 @@ async def test_get_flow_validation_result_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - flow.ImportFlowRequest, - dict, + flow.ImportFlowRequest(), + {}, ], ) def test_import_flow(request_type, transport: str = "grpc"): @@ -4039,7 +4065,7 @@ def test_import_flow(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.import_flow), "__call__") as call: @@ -4081,10 +4107,11 @@ def test_import_flow_non_empty_request_with_auto_populated_field(): client.import_flow(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == flow.ImportFlowRequest( + request_msg = flow.ImportFlowRequest( parent="parent_value", flow_uri="flow_uri_value", ) + assert args[0] == request_msg def test_import_flow_use_cached_wrapped_rpc(): @@ -4175,9 +4202,14 @@ async def test_import_flow_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_import_flow_async( - transport: str = "grpc_asyncio", request_type=flow.ImportFlowRequest -): +@pytest.mark.parametrize( + "request_type", + [ + flow.ImportFlowRequest(), + {}, + ], +) +async def test_import_flow_async(request_type, transport: str = "grpc_asyncio"): client = FlowsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4185,7 +4217,7 @@ async def test_import_flow_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.import_flow), "__call__") as call: @@ -4205,11 +4237,6 @@ async def test_import_flow_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_import_flow_async_from_dict(): - await test_import_flow_async(request_type=dict) - - def test_import_flow_field_headers(): client = FlowsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4274,8 +4301,8 @@ async def test_import_flow_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - flow.ExportFlowRequest, - dict, + flow.ExportFlowRequest(), + {}, ], ) def test_export_flow(request_type, transport: str = "grpc"): @@ -4286,7 +4313,7 @@ def test_export_flow(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.export_flow), "__call__") as call: @@ -4328,10 +4355,11 @@ def test_export_flow_non_empty_request_with_auto_populated_field(): client.export_flow(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == flow.ExportFlowRequest( + request_msg = flow.ExportFlowRequest( name="name_value", flow_uri="flow_uri_value", ) + assert args[0] == request_msg def test_export_flow_use_cached_wrapped_rpc(): @@ -4422,9 +4450,14 @@ async def test_export_flow_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_export_flow_async( - transport: str = "grpc_asyncio", request_type=flow.ExportFlowRequest -): +@pytest.mark.parametrize( + "request_type", + [ + flow.ExportFlowRequest(), + {}, + ], +) +async def test_export_flow_async(request_type, transport: str = "grpc_asyncio"): client = FlowsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4432,7 +4465,7 @@ async def test_export_flow_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.export_flow), "__call__") as call: @@ -4452,11 +4485,6 @@ async def test_export_flow_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_export_flow_async_from_dict(): - await test_export_flow_async(request_type=dict) - - def test_export_flow_field_headers(): client = FlowsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6356,7 +6384,6 @@ def test_create_flow_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_flow.CreateFlowRequest() - assert args[0] == request_msg @@ -6377,7 +6404,6 @@ def test_delete_flow_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = flow.DeleteFlowRequest() - assert args[0] == request_msg @@ -6398,7 +6424,6 @@ def test_list_flows_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = flow.ListFlowsRequest() - assert args[0] == request_msg @@ -6419,7 +6444,6 @@ def test_get_flow_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = flow.GetFlowRequest() - assert args[0] == request_msg @@ -6440,7 +6464,6 @@ def test_update_flow_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_flow.UpdateFlowRequest() - assert args[0] == request_msg @@ -6461,7 +6484,6 @@ def test_train_flow_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = flow.TrainFlowRequest() - assert args[0] == request_msg @@ -6482,7 +6504,6 @@ def test_validate_flow_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = flow.ValidateFlowRequest() - assert args[0] == request_msg @@ -6505,7 +6526,6 @@ def test_get_flow_validation_result_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = flow.GetFlowValidationResultRequest() - assert args[0] == request_msg @@ -6526,7 +6546,6 @@ def test_import_flow_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = flow.ImportFlowRequest() - assert args[0] == request_msg @@ -6547,7 +6566,6 @@ def test_export_flow_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = flow.ExportFlowRequest() - assert args[0] == request_msg @@ -6592,7 +6610,6 @@ async def test_create_flow_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_flow.CreateFlowRequest() - assert args[0] == request_msg @@ -6615,7 +6632,6 @@ async def test_delete_flow_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = flow.DeleteFlowRequest() - assert args[0] == request_msg @@ -6642,7 +6658,6 @@ async def test_list_flows_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = flow.ListFlowsRequest() - assert args[0] == request_msg @@ -6673,7 +6688,6 @@ async def test_get_flow_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = flow.GetFlowRequest() - assert args[0] == request_msg @@ -6704,7 +6718,6 @@ async def test_update_flow_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_flow.UpdateFlowRequest() - assert args[0] == request_msg @@ -6729,7 +6742,6 @@ async def test_train_flow_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = flow.TrainFlowRequest() - assert args[0] == request_msg @@ -6756,7 +6768,6 @@ async def test_validate_flow_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = flow.ValidateFlowRequest() - assert args[0] == request_msg @@ -6785,7 +6796,6 @@ async def test_get_flow_validation_result_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = flow.GetFlowValidationResultRequest() - assert args[0] == request_msg @@ -6810,7 +6820,6 @@ async def test_import_flow_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = flow.ImportFlowRequest() - assert args[0] == request_msg @@ -6835,7 +6844,6 @@ async def test_export_flow_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = flow.ExportFlowRequest() - assert args[0] == request_msg @@ -8886,7 +8894,6 @@ def test_create_flow_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_flow.CreateFlowRequest() - assert args[0] == request_msg @@ -8906,7 +8913,6 @@ def test_delete_flow_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = flow.DeleteFlowRequest() - assert args[0] == request_msg @@ -8926,7 +8932,6 @@ def test_list_flows_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = flow.ListFlowsRequest() - assert args[0] == request_msg @@ -8946,7 +8951,6 @@ def test_get_flow_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = flow.GetFlowRequest() - assert args[0] == request_msg @@ -8966,7 +8970,6 @@ def test_update_flow_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_flow.UpdateFlowRequest() - assert args[0] == request_msg @@ -8986,7 +8989,6 @@ def test_train_flow_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = flow.TrainFlowRequest() - assert args[0] == request_msg @@ -9006,7 +9008,6 @@ def test_validate_flow_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = flow.ValidateFlowRequest() - assert args[0] == request_msg @@ -9028,7 +9029,6 @@ def test_get_flow_validation_result_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = flow.GetFlowValidationResultRequest() - assert args[0] == request_msg @@ -9048,7 +9048,6 @@ def test_import_flow_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = flow.ImportFlowRequest() - assert args[0] == request_msg @@ -9068,7 +9067,6 @@ def test_export_flow_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = flow.ExportFlowRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_generators.py b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_generators.py index ab1c20e4ac61..f8c9ff733832 100644 --- a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_generators.py +++ b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_generators.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" @@ -1275,8 +1291,8 @@ def test_generators_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - generator.ListGeneratorsRequest, - dict, + generator.ListGeneratorsRequest(), + {}, ], ) def test_list_generators(request_type, transport: str = "grpc"): @@ -1287,7 +1303,7 @@ def test_list_generators(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_generators), "__call__") as call: @@ -1333,11 +1349,12 @@ def test_list_generators_non_empty_request_with_auto_populated_field(): client.list_generators(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == generator.ListGeneratorsRequest( + request_msg = generator.ListGeneratorsRequest( parent="parent_value", language_code="language_code_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_generators_use_cached_wrapped_rpc(): @@ -1418,9 +1435,14 @@ async def test_list_generators_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_generators_async( - transport: str = "grpc_asyncio", request_type=generator.ListGeneratorsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + generator.ListGeneratorsRequest(), + {}, + ], +) +async def test_list_generators_async(request_type, transport: str = "grpc_asyncio"): client = GeneratorsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1428,7 +1450,7 @@ async def test_list_generators_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_generators), "__call__") as call: @@ -1451,11 +1473,6 @@ async def test_list_generators_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_generators_async_from_dict(): - await test_list_generators_async(request_type=dict) - - def test_list_generators_field_headers(): client = GeneratorsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1792,8 +1809,8 @@ async def test_list_generators_async_pages(): @pytest.mark.parametrize( "request_type", [ - generator.GetGeneratorRequest, - dict, + generator.GetGeneratorRequest(), + {}, ], ) def test_get_generator(request_type, transport: str = "grpc"): @@ -1804,7 +1821,7 @@ def test_get_generator(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_generator), "__call__") as call: @@ -1851,10 +1868,11 @@ def test_get_generator_non_empty_request_with_auto_populated_field(): client.get_generator(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == generator.GetGeneratorRequest( + request_msg = generator.GetGeneratorRequest( name="name_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_get_generator_use_cached_wrapped_rpc(): @@ -1935,9 +1953,14 @@ async def test_get_generator_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_generator_async( - transport: str = "grpc_asyncio", request_type=generator.GetGeneratorRequest -): +@pytest.mark.parametrize( + "request_type", + [ + generator.GetGeneratorRequest(), + {}, + ], +) +async def test_get_generator_async(request_type, transport: str = "grpc_asyncio"): client = GeneratorsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1945,7 +1968,7 @@ async def test_get_generator_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_generator), "__call__") as call: @@ -1970,11 +1993,6 @@ async def test_get_generator_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_get_generator_async_from_dict(): - await test_get_generator_async(request_type=dict) - - def test_get_generator_field_headers(): client = GeneratorsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2117,8 +2135,8 @@ async def test_get_generator_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcdc_generator.CreateGeneratorRequest, - dict, + gcdc_generator.CreateGeneratorRequest(), + {}, ], ) def test_create_generator(request_type, transport: str = "grpc"): @@ -2129,7 +2147,7 @@ def test_create_generator(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_generator), "__call__") as call: @@ -2176,10 +2194,11 @@ def test_create_generator_non_empty_request_with_auto_populated_field(): client.create_generator(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcdc_generator.CreateGeneratorRequest( + request_msg = gcdc_generator.CreateGeneratorRequest( parent="parent_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_create_generator_use_cached_wrapped_rpc(): @@ -2262,9 +2281,14 @@ async def test_create_generator_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_generator_async( - transport: str = "grpc_asyncio", request_type=gcdc_generator.CreateGeneratorRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcdc_generator.CreateGeneratorRequest(), + {}, + ], +) +async def test_create_generator_async(request_type, transport: str = "grpc_asyncio"): client = GeneratorsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2272,7 +2296,7 @@ async def test_create_generator_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_generator), "__call__") as call: @@ -2297,11 +2321,6 @@ async def test_create_generator_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_create_generator_async_from_dict(): - await test_create_generator_async(request_type=dict) - - def test_create_generator_field_headers(): client = GeneratorsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2458,8 +2477,8 @@ async def test_create_generator_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcdc_generator.UpdateGeneratorRequest, - dict, + gcdc_generator.UpdateGeneratorRequest(), + {}, ], ) def test_update_generator(request_type, transport: str = "grpc"): @@ -2470,7 +2489,7 @@ def test_update_generator(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_generator), "__call__") as call: @@ -2516,9 +2535,10 @@ def test_update_generator_non_empty_request_with_auto_populated_field(): client.update_generator(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcdc_generator.UpdateGeneratorRequest( + request_msg = gcdc_generator.UpdateGeneratorRequest( language_code="language_code_value", ) + assert args[0] == request_msg def test_update_generator_use_cached_wrapped_rpc(): @@ -2601,9 +2621,14 @@ async def test_update_generator_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_generator_async( - transport: str = "grpc_asyncio", request_type=gcdc_generator.UpdateGeneratorRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcdc_generator.UpdateGeneratorRequest(), + {}, + ], +) +async def test_update_generator_async(request_type, transport: str = "grpc_asyncio"): client = GeneratorsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2611,7 +2636,7 @@ async def test_update_generator_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_generator), "__call__") as call: @@ -2636,11 +2661,6 @@ async def test_update_generator_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_update_generator_async_from_dict(): - await test_update_generator_async(request_type=dict) - - def test_update_generator_field_headers(): client = GeneratorsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2797,8 +2817,8 @@ async def test_update_generator_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - generator.DeleteGeneratorRequest, - dict, + generator.DeleteGeneratorRequest(), + {}, ], ) def test_delete_generator(request_type, transport: str = "grpc"): @@ -2809,7 +2829,7 @@ def test_delete_generator(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_generator), "__call__") as call: @@ -2850,9 +2870,10 @@ def test_delete_generator_non_empty_request_with_auto_populated_field(): client.delete_generator(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == generator.DeleteGeneratorRequest( + request_msg = generator.DeleteGeneratorRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_generator_use_cached_wrapped_rpc(): @@ -2935,9 +2956,14 @@ async def test_delete_generator_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_generator_async( - transport: str = "grpc_asyncio", request_type=generator.DeleteGeneratorRequest -): +@pytest.mark.parametrize( + "request_type", + [ + generator.DeleteGeneratorRequest(), + {}, + ], +) +async def test_delete_generator_async(request_type, transport: str = "grpc_asyncio"): client = GeneratorsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2945,7 +2971,7 @@ async def test_delete_generator_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_generator), "__call__") as call: @@ -2963,11 +2989,6 @@ async def test_delete_generator_async( assert response is None -@pytest.mark.asyncio -async def test_delete_generator_async_from_dict(): - await test_delete_generator_async(request_type=dict) - - def test_delete_generator_field_headers(): client = GeneratorsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4235,7 +4256,6 @@ def test_list_generators_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generator.ListGeneratorsRequest() - assert args[0] == request_msg @@ -4256,7 +4276,6 @@ def test_get_generator_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generator.GetGeneratorRequest() - assert args[0] == request_msg @@ -4277,7 +4296,6 @@ def test_create_generator_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_generator.CreateGeneratorRequest() - assert args[0] == request_msg @@ -4298,7 +4316,6 @@ def test_update_generator_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_generator.UpdateGeneratorRequest() - assert args[0] == request_msg @@ -4319,7 +4336,6 @@ def test_delete_generator_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generator.DeleteGeneratorRequest() - assert args[0] == request_msg @@ -4360,7 +4376,6 @@ async def test_list_generators_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generator.ListGeneratorsRequest() - assert args[0] == request_msg @@ -4388,7 +4403,6 @@ async def test_get_generator_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generator.GetGeneratorRequest() - assert args[0] == request_msg @@ -4416,7 +4430,6 @@ async def test_create_generator_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_generator.CreateGeneratorRequest() - assert args[0] == request_msg @@ -4444,7 +4457,6 @@ async def test_update_generator_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_generator.UpdateGeneratorRequest() - assert args[0] == request_msg @@ -4467,7 +4479,6 @@ async def test_delete_generator_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generator.DeleteGeneratorRequest() - assert args[0] == request_msg @@ -5634,7 +5645,6 @@ def test_list_generators_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generator.ListGeneratorsRequest() - assert args[0] == request_msg @@ -5654,7 +5664,6 @@ def test_get_generator_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generator.GetGeneratorRequest() - assert args[0] == request_msg @@ -5674,7 +5683,6 @@ def test_create_generator_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_generator.CreateGeneratorRequest() - assert args[0] == request_msg @@ -5694,7 +5702,6 @@ def test_update_generator_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_generator.UpdateGeneratorRequest() - assert args[0] == request_msg @@ -5714,7 +5721,6 @@ def test_delete_generator_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generator.DeleteGeneratorRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_intents.py b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_intents.py index e8c7a617b1ce..40e1c21ec234 100644 --- a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_intents.py +++ b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_intents.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 @@ -115,6 +116,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" @@ -1251,8 +1267,8 @@ def test_intents_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - intent.ListIntentsRequest, - dict, + intent.ListIntentsRequest(), + {}, ], ) def test_list_intents(request_type, transport: str = "grpc"): @@ -1263,7 +1279,7 @@ def test_list_intents(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_intents), "__call__") as call: @@ -1309,11 +1325,12 @@ def test_list_intents_non_empty_request_with_auto_populated_field(): client.list_intents(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == intent.ListIntentsRequest( + request_msg = intent.ListIntentsRequest( parent="parent_value", language_code="language_code_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_intents_use_cached_wrapped_rpc(): @@ -1394,9 +1411,14 @@ async def test_list_intents_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_intents_async( - transport: str = "grpc_asyncio", request_type=intent.ListIntentsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + intent.ListIntentsRequest(), + {}, + ], +) +async def test_list_intents_async(request_type, transport: str = "grpc_asyncio"): client = IntentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1404,7 +1426,7 @@ async def test_list_intents_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_intents), "__call__") as call: @@ -1427,11 +1449,6 @@ async def test_list_intents_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_intents_async_from_dict(): - await test_list_intents_async(request_type=dict) - - def test_list_intents_field_headers(): client = IntentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1768,8 +1785,8 @@ async def test_list_intents_async_pages(): @pytest.mark.parametrize( "request_type", [ - intent.GetIntentRequest, - dict, + intent.GetIntentRequest(), + {}, ], ) def test_get_intent(request_type, transport: str = "grpc"): @@ -1780,7 +1797,7 @@ def test_get_intent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_intent), "__call__") as call: @@ -1835,10 +1852,11 @@ def test_get_intent_non_empty_request_with_auto_populated_field(): client.get_intent(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == intent.GetIntentRequest( + request_msg = intent.GetIntentRequest( name="name_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_get_intent_use_cached_wrapped_rpc(): @@ -1917,9 +1935,14 @@ async def test_get_intent_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_intent_async( - transport: str = "grpc_asyncio", request_type=intent.GetIntentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + intent.GetIntentRequest(), + {}, + ], +) +async def test_get_intent_async(request_type, transport: str = "grpc_asyncio"): client = IntentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1927,7 +1950,7 @@ async def test_get_intent_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_intent), "__call__") as call: @@ -1960,11 +1983,6 @@ async def test_get_intent_async( assert response.dtmf_pattern == "dtmf_pattern_value" -@pytest.mark.asyncio -async def test_get_intent_async_from_dict(): - await test_get_intent_async(request_type=dict) - - def test_get_intent_field_headers(): client = IntentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2107,8 +2125,8 @@ async def test_get_intent_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcdc_intent.CreateIntentRequest, - dict, + gcdc_intent.CreateIntentRequest(), + {}, ], ) def test_create_intent(request_type, transport: str = "grpc"): @@ -2119,7 +2137,7 @@ def test_create_intent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_intent), "__call__") as call: @@ -2174,10 +2192,11 @@ def test_create_intent_non_empty_request_with_auto_populated_field(): client.create_intent(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcdc_intent.CreateIntentRequest( + request_msg = gcdc_intent.CreateIntentRequest( parent="parent_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_create_intent_use_cached_wrapped_rpc(): @@ -2258,9 +2277,14 @@ async def test_create_intent_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_intent_async( - transport: str = "grpc_asyncio", request_type=gcdc_intent.CreateIntentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcdc_intent.CreateIntentRequest(), + {}, + ], +) +async def test_create_intent_async(request_type, transport: str = "grpc_asyncio"): client = IntentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2268,7 +2292,7 @@ async def test_create_intent_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_intent), "__call__") as call: @@ -2301,11 +2325,6 @@ async def test_create_intent_async( assert response.dtmf_pattern == "dtmf_pattern_value" -@pytest.mark.asyncio -async def test_create_intent_async_from_dict(): - await test_create_intent_async(request_type=dict) - - def test_create_intent_field_headers(): client = IntentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2458,8 +2477,8 @@ async def test_create_intent_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcdc_intent.UpdateIntentRequest, - dict, + gcdc_intent.UpdateIntentRequest(), + {}, ], ) def test_update_intent(request_type, transport: str = "grpc"): @@ -2470,7 +2489,7 @@ def test_update_intent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_intent), "__call__") as call: @@ -2524,9 +2543,10 @@ def test_update_intent_non_empty_request_with_auto_populated_field(): client.update_intent(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcdc_intent.UpdateIntentRequest( + request_msg = gcdc_intent.UpdateIntentRequest( language_code="language_code_value", ) + assert args[0] == request_msg def test_update_intent_use_cached_wrapped_rpc(): @@ -2607,9 +2627,14 @@ async def test_update_intent_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_intent_async( - transport: str = "grpc_asyncio", request_type=gcdc_intent.UpdateIntentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcdc_intent.UpdateIntentRequest(), + {}, + ], +) +async def test_update_intent_async(request_type, transport: str = "grpc_asyncio"): client = IntentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2617,7 +2642,7 @@ async def test_update_intent_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_intent), "__call__") as call: @@ -2650,11 +2675,6 @@ async def test_update_intent_async( assert response.dtmf_pattern == "dtmf_pattern_value" -@pytest.mark.asyncio -async def test_update_intent_async_from_dict(): - await test_update_intent_async(request_type=dict) - - def test_update_intent_field_headers(): client = IntentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2807,8 +2827,8 @@ async def test_update_intent_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - intent.DeleteIntentRequest, - dict, + intent.DeleteIntentRequest(), + {}, ], ) def test_delete_intent(request_type, transport: str = "grpc"): @@ -2819,7 +2839,7 @@ def test_delete_intent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_intent), "__call__") as call: @@ -2860,9 +2880,10 @@ def test_delete_intent_non_empty_request_with_auto_populated_field(): client.delete_intent(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == intent.DeleteIntentRequest( + request_msg = intent.DeleteIntentRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_intent_use_cached_wrapped_rpc(): @@ -2943,9 +2964,14 @@ async def test_delete_intent_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_intent_async( - transport: str = "grpc_asyncio", request_type=intent.DeleteIntentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + intent.DeleteIntentRequest(), + {}, + ], +) +async def test_delete_intent_async(request_type, transport: str = "grpc_asyncio"): client = IntentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2953,7 +2979,7 @@ async def test_delete_intent_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_intent), "__call__") as call: @@ -2971,11 +2997,6 @@ async def test_delete_intent_async( assert response is None -@pytest.mark.asyncio -async def test_delete_intent_async_from_dict(): - await test_delete_intent_async(request_type=dict) - - def test_delete_intent_field_headers(): client = IntentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3118,8 +3139,8 @@ async def test_delete_intent_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - intent.ImportIntentsRequest, - dict, + intent.ImportIntentsRequest(), + {}, ], ) def test_import_intents(request_type, transport: str = "grpc"): @@ -3130,7 +3151,7 @@ def test_import_intents(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.import_intents), "__call__") as call: @@ -3172,10 +3193,11 @@ def test_import_intents_non_empty_request_with_auto_populated_field(): client.import_intents(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == intent.ImportIntentsRequest( + request_msg = intent.ImportIntentsRequest( parent="parent_value", intents_uri="intents_uri_value", ) + assert args[0] == request_msg def test_import_intents_use_cached_wrapped_rpc(): @@ -3266,9 +3288,14 @@ async def test_import_intents_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_import_intents_async( - transport: str = "grpc_asyncio", request_type=intent.ImportIntentsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + intent.ImportIntentsRequest(), + {}, + ], +) +async def test_import_intents_async(request_type, transport: str = "grpc_asyncio"): client = IntentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3276,7 +3303,7 @@ async def test_import_intents_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.import_intents), "__call__") as call: @@ -3296,11 +3323,6 @@ async def test_import_intents_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_import_intents_async_from_dict(): - await test_import_intents_async(request_type=dict) - - def test_import_intents_field_headers(): client = IntentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3365,8 +3387,8 @@ async def test_import_intents_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - intent.ExportIntentsRequest, - dict, + intent.ExportIntentsRequest(), + {}, ], ) def test_export_intents(request_type, transport: str = "grpc"): @@ -3377,7 +3399,7 @@ def test_export_intents(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.export_intents), "__call__") as call: @@ -3419,10 +3441,11 @@ def test_export_intents_non_empty_request_with_auto_populated_field(): client.export_intents(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == intent.ExportIntentsRequest( + request_msg = intent.ExportIntentsRequest( parent="parent_value", intents_uri="intents_uri_value", ) + assert args[0] == request_msg def test_export_intents_use_cached_wrapped_rpc(): @@ -3513,9 +3536,14 @@ async def test_export_intents_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_export_intents_async( - transport: str = "grpc_asyncio", request_type=intent.ExportIntentsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + intent.ExportIntentsRequest(), + {}, + ], +) +async def test_export_intents_async(request_type, transport: str = "grpc_asyncio"): client = IntentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3523,7 +3551,7 @@ async def test_export_intents_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.export_intents), "__call__") as call: @@ -3543,11 +3571,6 @@ async def test_export_intents_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_export_intents_async_from_dict(): - await test_export_intents_async(request_type=dict) - - def test_export_intents_field_headers(): client = IntentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4979,7 +5002,6 @@ def test_list_intents_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intent.ListIntentsRequest() - assert args[0] == request_msg @@ -5000,7 +5022,6 @@ def test_get_intent_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intent.GetIntentRequest() - assert args[0] == request_msg @@ -5021,7 +5042,6 @@ def test_create_intent_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_intent.CreateIntentRequest() - assert args[0] == request_msg @@ -5042,7 +5062,6 @@ def test_update_intent_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_intent.UpdateIntentRequest() - assert args[0] == request_msg @@ -5063,7 +5082,6 @@ def test_delete_intent_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intent.DeleteIntentRequest() - assert args[0] == request_msg @@ -5084,7 +5102,6 @@ def test_import_intents_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intent.ImportIntentsRequest() - assert args[0] == request_msg @@ -5105,7 +5122,6 @@ def test_export_intents_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intent.ExportIntentsRequest() - assert args[0] == request_msg @@ -5146,7 +5162,6 @@ async def test_list_intents_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intent.ListIntentsRequest() - assert args[0] == request_msg @@ -5178,7 +5193,6 @@ async def test_get_intent_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intent.GetIntentRequest() - assert args[0] == request_msg @@ -5210,7 +5224,6 @@ async def test_create_intent_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_intent.CreateIntentRequest() - assert args[0] == request_msg @@ -5242,7 +5255,6 @@ async def test_update_intent_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_intent.UpdateIntentRequest() - assert args[0] == request_msg @@ -5265,7 +5277,6 @@ async def test_delete_intent_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intent.DeleteIntentRequest() - assert args[0] == request_msg @@ -5290,7 +5301,6 @@ async def test_import_intents_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intent.ImportIntentsRequest() - assert args[0] == request_msg @@ -5315,7 +5325,6 @@ async def test_export_intents_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intent.ExportIntentsRequest() - assert args[0] == request_msg @@ -6722,7 +6731,6 @@ def test_list_intents_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intent.ListIntentsRequest() - assert args[0] == request_msg @@ -6742,7 +6750,6 @@ def test_get_intent_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intent.GetIntentRequest() - assert args[0] == request_msg @@ -6762,7 +6769,6 @@ def test_create_intent_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_intent.CreateIntentRequest() - assert args[0] == request_msg @@ -6782,7 +6788,6 @@ def test_update_intent_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_intent.UpdateIntentRequest() - assert args[0] == request_msg @@ -6802,7 +6807,6 @@ def test_delete_intent_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intent.DeleteIntentRequest() - assert args[0] == request_msg @@ -6822,7 +6826,6 @@ def test_import_intents_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intent.ImportIntentsRequest() - assert args[0] == request_msg @@ -6842,7 +6845,6 @@ def test_export_intents_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intent.ExportIntentsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_pages.py b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_pages.py index 4ddc040058f8..c4350c0ab602 100644 --- a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_pages.py +++ b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_pages.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 @@ -121,6 +122,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" @@ -1252,8 +1268,8 @@ def test_pages_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - page.ListPagesRequest, - dict, + page.ListPagesRequest(), + {}, ], ) def test_list_pages(request_type, transport: str = "grpc"): @@ -1264,7 +1280,7 @@ def test_list_pages(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_pages), "__call__") as call: @@ -1310,11 +1326,12 @@ def test_list_pages_non_empty_request_with_auto_populated_field(): client.list_pages(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == page.ListPagesRequest( + request_msg = page.ListPagesRequest( parent="parent_value", language_code="language_code_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_pages_use_cached_wrapped_rpc(): @@ -1393,9 +1410,14 @@ async def test_list_pages_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_list_pages_async( - transport: str = "grpc_asyncio", request_type=page.ListPagesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + page.ListPagesRequest(), + {}, + ], +) +async def test_list_pages_async(request_type, transport: str = "grpc_asyncio"): client = PagesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1403,7 +1425,7 @@ async def test_list_pages_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_pages), "__call__") as call: @@ -1426,11 +1448,6 @@ async def test_list_pages_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_pages_async_from_dict(): - await test_list_pages_async(request_type=dict) - - def test_list_pages_field_headers(): client = PagesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1767,8 +1784,8 @@ async def test_list_pages_async_pages(): @pytest.mark.parametrize( "request_type", [ - page.GetPageRequest, - dict, + page.GetPageRequest(), + {}, ], ) def test_get_page(request_type, transport: str = "grpc"): @@ -1779,7 +1796,7 @@ def test_get_page(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_page), "__call__") as call: @@ -1830,10 +1847,11 @@ def test_get_page_non_empty_request_with_auto_populated_field(): client.get_page(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == page.GetPageRequest( + request_msg = page.GetPageRequest( name="name_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_get_page_use_cached_wrapped_rpc(): @@ -1912,9 +1930,14 @@ async def test_get_page_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn @pytest.mark.asyncio -async def test_get_page_async( - transport: str = "grpc_asyncio", request_type=page.GetPageRequest -): +@pytest.mark.parametrize( + "request_type", + [ + page.GetPageRequest(), + {}, + ], +) +async def test_get_page_async(request_type, transport: str = "grpc_asyncio"): client = PagesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1922,7 +1945,7 @@ async def test_get_page_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_page), "__call__") as call: @@ -1951,11 +1974,6 @@ async def test_get_page_async( assert response.transition_route_groups == ["transition_route_groups_value"] -@pytest.mark.asyncio -async def test_get_page_async_from_dict(): - await test_get_page_async(request_type=dict) - - def test_get_page_field_headers(): client = PagesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2098,8 +2116,8 @@ async def test_get_page_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcdc_page.CreatePageRequest, - dict, + gcdc_page.CreatePageRequest(), + {}, ], ) def test_create_page(request_type, transport: str = "grpc"): @@ -2110,7 +2128,7 @@ def test_create_page(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_page), "__call__") as call: @@ -2161,10 +2179,11 @@ def test_create_page_non_empty_request_with_auto_populated_field(): client.create_page(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcdc_page.CreatePageRequest( + request_msg = gcdc_page.CreatePageRequest( parent="parent_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_create_page_use_cached_wrapped_rpc(): @@ -2245,9 +2264,14 @@ async def test_create_page_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_page_async( - transport: str = "grpc_asyncio", request_type=gcdc_page.CreatePageRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcdc_page.CreatePageRequest(), + {}, + ], +) +async def test_create_page_async(request_type, transport: str = "grpc_asyncio"): client = PagesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2255,7 +2279,7 @@ async def test_create_page_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_page), "__call__") as call: @@ -2284,11 +2308,6 @@ async def test_create_page_async( assert response.transition_route_groups == ["transition_route_groups_value"] -@pytest.mark.asyncio -async def test_create_page_async_from_dict(): - await test_create_page_async(request_type=dict) - - def test_create_page_field_headers(): client = PagesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2441,8 +2460,8 @@ async def test_create_page_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcdc_page.UpdatePageRequest, - dict, + gcdc_page.UpdatePageRequest(), + {}, ], ) def test_update_page(request_type, transport: str = "grpc"): @@ -2453,7 +2472,7 @@ def test_update_page(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_page), "__call__") as call: @@ -2503,9 +2522,10 @@ def test_update_page_non_empty_request_with_auto_populated_field(): client.update_page(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcdc_page.UpdatePageRequest( + request_msg = gcdc_page.UpdatePageRequest( language_code="language_code_value", ) + assert args[0] == request_msg def test_update_page_use_cached_wrapped_rpc(): @@ -2586,9 +2606,14 @@ async def test_update_page_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_page_async( - transport: str = "grpc_asyncio", request_type=gcdc_page.UpdatePageRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcdc_page.UpdatePageRequest(), + {}, + ], +) +async def test_update_page_async(request_type, transport: str = "grpc_asyncio"): client = PagesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2596,7 +2621,7 @@ async def test_update_page_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_page), "__call__") as call: @@ -2625,11 +2650,6 @@ async def test_update_page_async( assert response.transition_route_groups == ["transition_route_groups_value"] -@pytest.mark.asyncio -async def test_update_page_async_from_dict(): - await test_update_page_async(request_type=dict) - - def test_update_page_field_headers(): client = PagesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2782,8 +2802,8 @@ async def test_update_page_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - page.DeletePageRequest, - dict, + page.DeletePageRequest(), + {}, ], ) def test_delete_page(request_type, transport: str = "grpc"): @@ -2794,7 +2814,7 @@ def test_delete_page(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_page), "__call__") as call: @@ -2835,9 +2855,10 @@ def test_delete_page_non_empty_request_with_auto_populated_field(): client.delete_page(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == page.DeletePageRequest( + request_msg = page.DeletePageRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_page_use_cached_wrapped_rpc(): @@ -2918,9 +2939,14 @@ async def test_delete_page_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_page_async( - transport: str = "grpc_asyncio", request_type=page.DeletePageRequest -): +@pytest.mark.parametrize( + "request_type", + [ + page.DeletePageRequest(), + {}, + ], +) +async def test_delete_page_async(request_type, transport: str = "grpc_asyncio"): client = PagesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2928,7 +2954,7 @@ async def test_delete_page_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_page), "__call__") as call: @@ -2946,11 +2972,6 @@ async def test_delete_page_async( assert response is None -@pytest.mark.asyncio -async def test_delete_page_async_from_dict(): - await test_delete_page_async(request_type=dict) - - def test_delete_page_field_headers(): client = PagesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4210,7 +4231,6 @@ def test_list_pages_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = page.ListPagesRequest() - assert args[0] == request_msg @@ -4231,7 +4251,6 @@ def test_get_page_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = page.GetPageRequest() - assert args[0] == request_msg @@ -4252,7 +4271,6 @@ def test_create_page_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_page.CreatePageRequest() - assert args[0] == request_msg @@ -4273,7 +4291,6 @@ def test_update_page_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_page.UpdatePageRequest() - assert args[0] == request_msg @@ -4294,7 +4311,6 @@ def test_delete_page_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = page.DeletePageRequest() - assert args[0] == request_msg @@ -4335,7 +4351,6 @@ async def test_list_pages_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = page.ListPagesRequest() - assert args[0] == request_msg @@ -4365,7 +4380,6 @@ async def test_get_page_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = page.GetPageRequest() - assert args[0] == request_msg @@ -4395,7 +4409,6 @@ async def test_create_page_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_page.CreatePageRequest() - assert args[0] == request_msg @@ -4425,7 +4438,6 @@ async def test_update_page_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_page.UpdatePageRequest() - assert args[0] == request_msg @@ -4448,7 +4460,6 @@ async def test_delete_page_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = page.DeletePageRequest() - assert args[0] == request_msg @@ -5861,7 +5872,6 @@ def test_list_pages_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = page.ListPagesRequest() - assert args[0] == request_msg @@ -5881,7 +5891,6 @@ def test_get_page_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = page.GetPageRequest() - assert args[0] == request_msg @@ -5901,7 +5910,6 @@ def test_create_page_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_page.CreatePageRequest() - assert args[0] == request_msg @@ -5921,7 +5929,6 @@ def test_update_page_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_page.UpdatePageRequest() - assert args[0] == request_msg @@ -5941,7 +5948,6 @@ def test_delete_page_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = page.DeletePageRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_playbooks.py b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_playbooks.py index a3539f700e94..229d22499bba 100644 --- a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_playbooks.py +++ b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_playbooks.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 @@ -132,6 +133,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" @@ -1292,8 +1308,8 @@ def test_playbooks_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - gcdc_playbook.CreatePlaybookRequest, - dict, + gcdc_playbook.CreatePlaybookRequest(), + {}, ], ) def test_create_playbook(request_type, transport: str = "grpc"): @@ -1304,7 +1320,7 @@ def test_create_playbook(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_playbook), "__call__") as call: @@ -1364,9 +1380,10 @@ def test_create_playbook_non_empty_request_with_auto_populated_field(): client.create_playbook(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcdc_playbook.CreatePlaybookRequest( + request_msg = gcdc_playbook.CreatePlaybookRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_playbook_use_cached_wrapped_rpc(): @@ -1447,9 +1464,14 @@ async def test_create_playbook_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_playbook_async( - transport: str = "grpc_asyncio", request_type=gcdc_playbook.CreatePlaybookRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcdc_playbook.CreatePlaybookRequest(), + {}, + ], +) +async def test_create_playbook_async(request_type, transport: str = "grpc_asyncio"): client = PlaybooksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1457,7 +1479,7 @@ async def test_create_playbook_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_playbook), "__call__") as call: @@ -1496,11 +1518,6 @@ async def test_create_playbook_async( assert response.playbook_type == gcdc_playbook.Playbook.PlaybookType.TASK -@pytest.mark.asyncio -async def test_create_playbook_async_from_dict(): - await test_create_playbook_async(request_type=dict) - - def test_create_playbook_field_headers(): client = PlaybooksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1657,8 +1674,8 @@ async def test_create_playbook_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - playbook.DeletePlaybookRequest, - dict, + playbook.DeletePlaybookRequest(), + {}, ], ) def test_delete_playbook(request_type, transport: str = "grpc"): @@ -1669,7 +1686,7 @@ def test_delete_playbook(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_playbook), "__call__") as call: @@ -1710,9 +1727,10 @@ def test_delete_playbook_non_empty_request_with_auto_populated_field(): client.delete_playbook(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == playbook.DeletePlaybookRequest( + request_msg = playbook.DeletePlaybookRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_playbook_use_cached_wrapped_rpc(): @@ -1793,9 +1811,14 @@ async def test_delete_playbook_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_playbook_async( - transport: str = "grpc_asyncio", request_type=playbook.DeletePlaybookRequest -): +@pytest.mark.parametrize( + "request_type", + [ + playbook.DeletePlaybookRequest(), + {}, + ], +) +async def test_delete_playbook_async(request_type, transport: str = "grpc_asyncio"): client = PlaybooksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1803,7 +1826,7 @@ async def test_delete_playbook_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_playbook), "__call__") as call: @@ -1821,11 +1844,6 @@ async def test_delete_playbook_async( assert response is None -@pytest.mark.asyncio -async def test_delete_playbook_async_from_dict(): - await test_delete_playbook_async(request_type=dict) - - def test_delete_playbook_field_headers(): client = PlaybooksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1968,8 +1986,8 @@ async def test_delete_playbook_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - playbook.ListPlaybooksRequest, - dict, + playbook.ListPlaybooksRequest(), + {}, ], ) def test_list_playbooks(request_type, transport: str = "grpc"): @@ -1980,7 +1998,7 @@ def test_list_playbooks(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_playbooks), "__call__") as call: @@ -2025,10 +2043,11 @@ def test_list_playbooks_non_empty_request_with_auto_populated_field(): client.list_playbooks(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == playbook.ListPlaybooksRequest( + request_msg = playbook.ListPlaybooksRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_playbooks_use_cached_wrapped_rpc(): @@ -2109,9 +2128,14 @@ async def test_list_playbooks_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_playbooks_async( - transport: str = "grpc_asyncio", request_type=playbook.ListPlaybooksRequest -): +@pytest.mark.parametrize( + "request_type", + [ + playbook.ListPlaybooksRequest(), + {}, + ], +) +async def test_list_playbooks_async(request_type, transport: str = "grpc_asyncio"): client = PlaybooksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2119,7 +2143,7 @@ async def test_list_playbooks_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_playbooks), "__call__") as call: @@ -2142,11 +2166,6 @@ async def test_list_playbooks_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_playbooks_async_from_dict(): - await test_list_playbooks_async(request_type=dict) - - def test_list_playbooks_field_headers(): client = PlaybooksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2483,8 +2502,8 @@ async def test_list_playbooks_async_pages(): @pytest.mark.parametrize( "request_type", [ - playbook.GetPlaybookRequest, - dict, + playbook.GetPlaybookRequest(), + {}, ], ) def test_get_playbook(request_type, transport: str = "grpc"): @@ -2495,7 +2514,7 @@ def test_get_playbook(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_playbook), "__call__") as call: @@ -2555,9 +2574,10 @@ def test_get_playbook_non_empty_request_with_auto_populated_field(): client.get_playbook(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == playbook.GetPlaybookRequest( + request_msg = playbook.GetPlaybookRequest( name="name_value", ) + assert args[0] == request_msg def test_get_playbook_use_cached_wrapped_rpc(): @@ -2638,9 +2658,14 @@ async def test_get_playbook_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_playbook_async( - transport: str = "grpc_asyncio", request_type=playbook.GetPlaybookRequest -): +@pytest.mark.parametrize( + "request_type", + [ + playbook.GetPlaybookRequest(), + {}, + ], +) +async def test_get_playbook_async(request_type, transport: str = "grpc_asyncio"): client = PlaybooksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2648,7 +2673,7 @@ async def test_get_playbook_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_playbook), "__call__") as call: @@ -2687,11 +2712,6 @@ async def test_get_playbook_async( assert response.playbook_type == playbook.Playbook.PlaybookType.TASK -@pytest.mark.asyncio -async def test_get_playbook_async_from_dict(): - await test_get_playbook_async(request_type=dict) - - def test_get_playbook_field_headers(): client = PlaybooksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2834,8 +2854,8 @@ async def test_get_playbook_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - playbook.ExportPlaybookRequest, - dict, + playbook.ExportPlaybookRequest(), + {}, ], ) def test_export_playbook(request_type, transport: str = "grpc"): @@ -2846,7 +2866,7 @@ def test_export_playbook(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.export_playbook), "__call__") as call: @@ -2888,10 +2908,11 @@ def test_export_playbook_non_empty_request_with_auto_populated_field(): client.export_playbook(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == playbook.ExportPlaybookRequest( + request_msg = playbook.ExportPlaybookRequest( name="name_value", playbook_uri="playbook_uri_value", ) + assert args[0] == request_msg def test_export_playbook_use_cached_wrapped_rpc(): @@ -2982,9 +3003,14 @@ async def test_export_playbook_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_export_playbook_async( - transport: str = "grpc_asyncio", request_type=playbook.ExportPlaybookRequest -): +@pytest.mark.parametrize( + "request_type", + [ + playbook.ExportPlaybookRequest(), + {}, + ], +) +async def test_export_playbook_async(request_type, transport: str = "grpc_asyncio"): client = PlaybooksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2992,7 +3018,7 @@ async def test_export_playbook_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.export_playbook), "__call__") as call: @@ -3012,11 +3038,6 @@ async def test_export_playbook_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_export_playbook_async_from_dict(): - await test_export_playbook_async(request_type=dict) - - def test_export_playbook_field_headers(): client = PlaybooksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3081,8 +3102,8 @@ async def test_export_playbook_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - playbook.ImportPlaybookRequest, - dict, + playbook.ImportPlaybookRequest(), + {}, ], ) def test_import_playbook(request_type, transport: str = "grpc"): @@ -3093,7 +3114,7 @@ def test_import_playbook(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.import_playbook), "__call__") as call: @@ -3135,10 +3156,11 @@ def test_import_playbook_non_empty_request_with_auto_populated_field(): client.import_playbook(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == playbook.ImportPlaybookRequest( + request_msg = playbook.ImportPlaybookRequest( parent="parent_value", playbook_uri="playbook_uri_value", ) + assert args[0] == request_msg def test_import_playbook_use_cached_wrapped_rpc(): @@ -3229,9 +3251,14 @@ async def test_import_playbook_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_import_playbook_async( - transport: str = "grpc_asyncio", request_type=playbook.ImportPlaybookRequest -): +@pytest.mark.parametrize( + "request_type", + [ + playbook.ImportPlaybookRequest(), + {}, + ], +) +async def test_import_playbook_async(request_type, transport: str = "grpc_asyncio"): client = PlaybooksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3239,7 +3266,7 @@ async def test_import_playbook_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.import_playbook), "__call__") as call: @@ -3259,11 +3286,6 @@ async def test_import_playbook_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_import_playbook_async_from_dict(): - await test_import_playbook_async(request_type=dict) - - def test_import_playbook_field_headers(): client = PlaybooksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3328,8 +3350,8 @@ async def test_import_playbook_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - gcdc_playbook.UpdatePlaybookRequest, - dict, + gcdc_playbook.UpdatePlaybookRequest(), + {}, ], ) def test_update_playbook(request_type, transport: str = "grpc"): @@ -3340,7 +3362,7 @@ def test_update_playbook(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_playbook), "__call__") as call: @@ -3398,7 +3420,8 @@ def test_update_playbook_non_empty_request_with_auto_populated_field(): client.update_playbook(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcdc_playbook.UpdatePlaybookRequest() + request_msg = gcdc_playbook.UpdatePlaybookRequest() + assert args[0] == request_msg def test_update_playbook_use_cached_wrapped_rpc(): @@ -3479,9 +3502,14 @@ async def test_update_playbook_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_playbook_async( - transport: str = "grpc_asyncio", request_type=gcdc_playbook.UpdatePlaybookRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcdc_playbook.UpdatePlaybookRequest(), + {}, + ], +) +async def test_update_playbook_async(request_type, transport: str = "grpc_asyncio"): client = PlaybooksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3489,7 +3517,7 @@ async def test_update_playbook_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_playbook), "__call__") as call: @@ -3528,11 +3556,6 @@ async def test_update_playbook_async( assert response.playbook_type == gcdc_playbook.Playbook.PlaybookType.TASK -@pytest.mark.asyncio -async def test_update_playbook_async_from_dict(): - await test_update_playbook_async(request_type=dict) - - def test_update_playbook_field_headers(): client = PlaybooksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3689,8 +3712,8 @@ async def test_update_playbook_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - playbook.CreatePlaybookVersionRequest, - dict, + playbook.CreatePlaybookVersionRequest(), + {}, ], ) def test_create_playbook_version(request_type, transport: str = "grpc"): @@ -3701,7 +3724,7 @@ def test_create_playbook_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,9 +3774,10 @@ def test_create_playbook_version_non_empty_request_with_auto_populated_field(): client.create_playbook_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == playbook.CreatePlaybookVersionRequest( + request_msg = playbook.CreatePlaybookVersionRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_playbook_version_use_cached_wrapped_rpc(): @@ -3839,8 +3863,15 @@ async def test_create_playbook_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + playbook.CreatePlaybookVersionRequest(), + {}, + ], +) async def test_create_playbook_version_async( - transport: str = "grpc_asyncio", request_type=playbook.CreatePlaybookVersionRequest + request_type, transport: str = "grpc_asyncio" ): client = PlaybooksAsyncClient( credentials=async_anonymous_credentials(), @@ -3849,7 +3880,7 @@ async def test_create_playbook_version_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( @@ -3876,11 +3907,6 @@ async def test_create_playbook_version_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_create_playbook_version_async_from_dict(): - await test_create_playbook_version_async(request_type=dict) - - def test_create_playbook_version_field_headers(): client = PlaybooksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4045,8 +4071,8 @@ async def test_create_playbook_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - playbook.GetPlaybookVersionRequest, - dict, + playbook.GetPlaybookVersionRequest(), + {}, ], ) def test_get_playbook_version(request_type, transport: str = "grpc"): @@ -4057,7 +4083,7 @@ def test_get_playbook_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4107,9 +4133,10 @@ def test_get_playbook_version_non_empty_request_with_auto_populated_field(): client.get_playbook_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == playbook.GetPlaybookVersionRequest( + request_msg = playbook.GetPlaybookVersionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_playbook_version_use_cached_wrapped_rpc(): @@ -4194,8 +4221,15 @@ async def test_get_playbook_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + playbook.GetPlaybookVersionRequest(), + {}, + ], +) async def test_get_playbook_version_async( - transport: str = "grpc_asyncio", request_type=playbook.GetPlaybookVersionRequest + request_type, transport: str = "grpc_asyncio" ): client = PlaybooksAsyncClient( credentials=async_anonymous_credentials(), @@ -4204,7 +4238,7 @@ async def test_get_playbook_version_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( @@ -4231,11 +4265,6 @@ async def test_get_playbook_version_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_get_playbook_version_async_from_dict(): - await test_get_playbook_version_async(request_type=dict) - - def test_get_playbook_version_field_headers(): client = PlaybooksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4390,8 +4419,8 @@ async def test_get_playbook_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - playbook.RestorePlaybookVersionRequest, - dict, + playbook.RestorePlaybookVersionRequest(), + {}, ], ) def test_restore_playbook_version(request_type, transport: str = "grpc"): @@ -4402,7 +4431,7 @@ def test_restore_playbook_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4447,9 +4476,10 @@ def test_restore_playbook_version_non_empty_request_with_auto_populated_field(): client.restore_playbook_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == playbook.RestorePlaybookVersionRequest( + request_msg = playbook.RestorePlaybookVersionRequest( name="name_value", ) + assert args[0] == request_msg def test_restore_playbook_version_use_cached_wrapped_rpc(): @@ -4535,8 +4565,15 @@ async def test_restore_playbook_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + playbook.RestorePlaybookVersionRequest(), + {}, + ], +) async def test_restore_playbook_version_async( - transport: str = "grpc_asyncio", request_type=playbook.RestorePlaybookVersionRequest + request_type, transport: str = "grpc_asyncio" ): client = PlaybooksAsyncClient( credentials=async_anonymous_credentials(), @@ -4545,7 +4582,7 @@ async def test_restore_playbook_version_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( @@ -4567,11 +4604,6 @@ async def test_restore_playbook_version_async( assert isinstance(response, playbook.RestorePlaybookVersionResponse) -@pytest.mark.asyncio -async def test_restore_playbook_version_async_from_dict(): - await test_restore_playbook_version_async(request_type=dict) - - def test_restore_playbook_version_field_headers(): client = PlaybooksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4726,8 +4758,8 @@ async def test_restore_playbook_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - playbook.ListPlaybookVersionsRequest, - dict, + playbook.ListPlaybookVersionsRequest(), + {}, ], ) def test_list_playbook_versions(request_type, transport: str = "grpc"): @@ -4738,7 +4770,7 @@ def test_list_playbook_versions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4787,10 +4819,11 @@ def test_list_playbook_versions_non_empty_request_with_auto_populated_field(): client.list_playbook_versions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == playbook.ListPlaybookVersionsRequest( + request_msg = playbook.ListPlaybookVersionsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_playbook_versions_use_cached_wrapped_rpc(): @@ -4876,8 +4909,15 @@ async def test_list_playbook_versions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + playbook.ListPlaybookVersionsRequest(), + {}, + ], +) async def test_list_playbook_versions_async( - transport: str = "grpc_asyncio", request_type=playbook.ListPlaybookVersionsRequest + request_type, transport: str = "grpc_asyncio" ): client = PlaybooksAsyncClient( credentials=async_anonymous_credentials(), @@ -4886,7 +4926,7 @@ async def test_list_playbook_versions_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( @@ -4911,11 +4951,6 @@ async def test_list_playbook_versions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_playbook_versions_async_from_dict(): - await test_list_playbook_versions_async(request_type=dict) - - def test_list_playbook_versions_field_headers(): client = PlaybooksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5268,8 +5303,8 @@ async def test_list_playbook_versions_async_pages(): @pytest.mark.parametrize( "request_type", [ - playbook.DeletePlaybookVersionRequest, - dict, + playbook.DeletePlaybookVersionRequest(), + {}, ], ) def test_delete_playbook_version(request_type, transport: str = "grpc"): @@ -5280,7 +5315,7 @@ def test_delete_playbook_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5325,9 +5360,10 @@ def test_delete_playbook_version_non_empty_request_with_auto_populated_field(): client.delete_playbook_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == playbook.DeletePlaybookVersionRequest( + request_msg = playbook.DeletePlaybookVersionRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_playbook_version_use_cached_wrapped_rpc(): @@ -5413,8 +5449,15 @@ async def test_delete_playbook_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + playbook.DeletePlaybookVersionRequest(), + {}, + ], +) async def test_delete_playbook_version_async( - transport: str = "grpc_asyncio", request_type=playbook.DeletePlaybookVersionRequest + request_type, transport: str = "grpc_asyncio" ): client = PlaybooksAsyncClient( credentials=async_anonymous_credentials(), @@ -5423,7 +5466,7 @@ async def test_delete_playbook_version_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( @@ -5443,11 +5486,6 @@ async def test_delete_playbook_version_async( assert response is None -@pytest.mark.asyncio -async def test_delete_playbook_version_async_from_dict(): - await test_delete_playbook_version_async(request_type=dict) - - def test_delete_playbook_version_field_headers(): client = PlaybooksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7951,7 +7989,6 @@ def test_create_playbook_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_playbook.CreatePlaybookRequest() - assert args[0] == request_msg @@ -7972,7 +8009,6 @@ def test_delete_playbook_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = playbook.DeletePlaybookRequest() - assert args[0] == request_msg @@ -7993,7 +8029,6 @@ def test_list_playbooks_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = playbook.ListPlaybooksRequest() - assert args[0] == request_msg @@ -8014,7 +8049,6 @@ def test_get_playbook_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = playbook.GetPlaybookRequest() - assert args[0] == request_msg @@ -8035,7 +8069,6 @@ def test_export_playbook_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = playbook.ExportPlaybookRequest() - assert args[0] == request_msg @@ -8056,7 +8089,6 @@ def test_import_playbook_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = playbook.ImportPlaybookRequest() - assert args[0] == request_msg @@ -8077,7 +8109,6 @@ def test_update_playbook_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_playbook.UpdatePlaybookRequest() - assert args[0] == request_msg @@ -8100,7 +8131,6 @@ def test_create_playbook_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = playbook.CreatePlaybookVersionRequest() - assert args[0] == request_msg @@ -8123,7 +8153,6 @@ def test_get_playbook_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = playbook.GetPlaybookVersionRequest() - assert args[0] == request_msg @@ -8146,7 +8175,6 @@ def test_restore_playbook_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = playbook.RestorePlaybookVersionRequest() - assert args[0] == request_msg @@ -8169,7 +8197,6 @@ def test_list_playbook_versions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = playbook.ListPlaybookVersionsRequest() - assert args[0] == request_msg @@ -8192,7 +8219,6 @@ def test_delete_playbook_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = playbook.DeletePlaybookVersionRequest() - assert args[0] == request_msg @@ -8241,7 +8267,6 @@ async def test_create_playbook_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_playbook.CreatePlaybookRequest() - assert args[0] == request_msg @@ -8264,7 +8289,6 @@ async def test_delete_playbook_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = playbook.DeletePlaybookRequest() - assert args[0] == request_msg @@ -8291,7 +8315,6 @@ async def test_list_playbooks_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = playbook.ListPlaybooksRequest() - assert args[0] == request_msg @@ -8326,7 +8349,6 @@ async def test_get_playbook_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = playbook.GetPlaybookRequest() - assert args[0] == request_msg @@ -8351,7 +8373,6 @@ async def test_export_playbook_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = playbook.ExportPlaybookRequest() - assert args[0] == request_msg @@ -8376,7 +8397,6 @@ async def test_import_playbook_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = playbook.ImportPlaybookRequest() - assert args[0] == request_msg @@ -8411,7 +8431,6 @@ async def test_update_playbook_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_playbook.UpdatePlaybookRequest() - assert args[0] == request_msg @@ -8441,7 +8460,6 @@ async def test_create_playbook_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = playbook.CreatePlaybookVersionRequest() - assert args[0] == request_msg @@ -8471,7 +8489,6 @@ async def test_get_playbook_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = playbook.GetPlaybookVersionRequest() - assert args[0] == request_msg @@ -8498,7 +8515,6 @@ async def test_restore_playbook_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = playbook.RestorePlaybookVersionRequest() - assert args[0] == request_msg @@ -8527,7 +8543,6 @@ async def test_list_playbook_versions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = playbook.ListPlaybookVersionsRequest() - assert args[0] == request_msg @@ -8552,7 +8567,6 @@ async def test_delete_playbook_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = playbook.DeletePlaybookVersionRequest() - assert args[0] == request_msg @@ -11317,7 +11331,6 @@ def test_create_playbook_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_playbook.CreatePlaybookRequest() - assert args[0] == request_msg @@ -11337,7 +11350,6 @@ def test_delete_playbook_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = playbook.DeletePlaybookRequest() - assert args[0] == request_msg @@ -11357,7 +11369,6 @@ def test_list_playbooks_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = playbook.ListPlaybooksRequest() - assert args[0] == request_msg @@ -11377,7 +11388,6 @@ def test_get_playbook_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = playbook.GetPlaybookRequest() - assert args[0] == request_msg @@ -11397,7 +11407,6 @@ def test_export_playbook_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = playbook.ExportPlaybookRequest() - assert args[0] == request_msg @@ -11417,7 +11426,6 @@ def test_import_playbook_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = playbook.ImportPlaybookRequest() - assert args[0] == request_msg @@ -11437,7 +11445,6 @@ def test_update_playbook_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_playbook.UpdatePlaybookRequest() - assert args[0] == request_msg @@ -11459,7 +11466,6 @@ def test_create_playbook_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = playbook.CreatePlaybookVersionRequest() - assert args[0] == request_msg @@ -11481,7 +11487,6 @@ def test_get_playbook_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = playbook.GetPlaybookVersionRequest() - assert args[0] == request_msg @@ -11503,7 +11508,6 @@ def test_restore_playbook_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = playbook.RestorePlaybookVersionRequest() - assert args[0] == request_msg @@ -11525,7 +11529,6 @@ def test_list_playbook_versions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = playbook.ListPlaybookVersionsRequest() - assert args[0] == request_msg @@ -11547,7 +11550,6 @@ def test_delete_playbook_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = playbook.DeletePlaybookVersionRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_security_settings_service.py b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_security_settings_service.py index e45e10a4e357..b33f7efb1909 100644 --- a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_security_settings_service.py +++ b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_security_settings_service.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 @@ -113,6 +114,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" @@ -1385,8 +1401,8 @@ def test_security_settings_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - gcdc_security_settings.CreateSecuritySettingsRequest, - dict, + gcdc_security_settings.CreateSecuritySettingsRequest(), + {}, ], ) def test_create_security_settings(request_type, transport: str = "grpc"): @@ -1397,7 +1413,7 @@ def test_create_security_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( @@ -1468,9 +1484,10 @@ def test_create_security_settings_non_empty_request_with_auto_populated_field(): client.create_security_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcdc_security_settings.CreateSecuritySettingsRequest( + request_msg = gcdc_security_settings.CreateSecuritySettingsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_security_settings_use_cached_wrapped_rpc(): @@ -1556,9 +1573,15 @@ async def test_create_security_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcdc_security_settings.CreateSecuritySettingsRequest(), + {}, + ], +) async def test_create_security_settings_async( - transport: str = "grpc_asyncio", - request_type=gcdc_security_settings.CreateSecuritySettingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecuritySettingsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1567,7 +1590,7 @@ async def test_create_security_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( @@ -1614,11 +1637,6 @@ async def test_create_security_settings_async( ] -@pytest.mark.asyncio -async def test_create_security_settings_async_from_dict(): - await test_create_security_settings_async(request_type=dict) - - def test_create_security_settings_field_headers(): client = SecuritySettingsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1791,8 +1809,8 @@ async def test_create_security_settings_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - security_settings.GetSecuritySettingsRequest, - dict, + security_settings.GetSecuritySettingsRequest(), + {}, ], ) def test_get_security_settings(request_type, transport: str = "grpc"): @@ -1803,7 +1821,7 @@ def test_get_security_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( @@ -1874,9 +1892,10 @@ def test_get_security_settings_non_empty_request_with_auto_populated_field(): client.get_security_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == security_settings.GetSecuritySettingsRequest( + request_msg = security_settings.GetSecuritySettingsRequest( name="name_value", ) + assert args[0] == request_msg def test_get_security_settings_use_cached_wrapped_rpc(): @@ -1962,9 +1981,15 @@ async def test_get_security_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + security_settings.GetSecuritySettingsRequest(), + {}, + ], +) async def test_get_security_settings_async( - transport: str = "grpc_asyncio", - request_type=security_settings.GetSecuritySettingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecuritySettingsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1973,7 +1998,7 @@ async def test_get_security_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( @@ -2020,11 +2045,6 @@ async def test_get_security_settings_async( ] -@pytest.mark.asyncio -async def test_get_security_settings_async_from_dict(): - await test_get_security_settings_async(request_type=dict) - - def test_get_security_settings_field_headers(): client = SecuritySettingsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2179,8 +2199,8 @@ async def test_get_security_settings_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcdc_security_settings.UpdateSecuritySettingsRequest, - dict, + gcdc_security_settings.UpdateSecuritySettingsRequest(), + {}, ], ) def test_update_security_settings(request_type, transport: str = "grpc"): @@ -2191,7 +2211,7 @@ def test_update_security_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( @@ -2260,7 +2280,8 @@ def test_update_security_settings_non_empty_request_with_auto_populated_field(): client.update_security_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcdc_security_settings.UpdateSecuritySettingsRequest() + request_msg = gcdc_security_settings.UpdateSecuritySettingsRequest() + assert args[0] == request_msg def test_update_security_settings_use_cached_wrapped_rpc(): @@ -2346,9 +2367,15 @@ async def test_update_security_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcdc_security_settings.UpdateSecuritySettingsRequest(), + {}, + ], +) async def test_update_security_settings_async( - transport: str = "grpc_asyncio", - request_type=gcdc_security_settings.UpdateSecuritySettingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecuritySettingsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2357,7 +2384,7 @@ async def test_update_security_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( @@ -2404,11 +2431,6 @@ async def test_update_security_settings_async( ] -@pytest.mark.asyncio -async def test_update_security_settings_async_from_dict(): - await test_update_security_settings_async(request_type=dict) - - def test_update_security_settings_field_headers(): client = SecuritySettingsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2581,8 +2603,8 @@ async def test_update_security_settings_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - security_settings.ListSecuritySettingsRequest, - dict, + security_settings.ListSecuritySettingsRequest(), + {}, ], ) def test_list_security_settings(request_type, transport: str = "grpc"): @@ -2593,7 +2615,7 @@ def test_list_security_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( @@ -2642,10 +2664,11 @@ def test_list_security_settings_non_empty_request_with_auto_populated_field(): client.list_security_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == security_settings.ListSecuritySettingsRequest( + request_msg = security_settings.ListSecuritySettingsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_security_settings_use_cached_wrapped_rpc(): @@ -2731,9 +2754,15 @@ async def test_list_security_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + security_settings.ListSecuritySettingsRequest(), + {}, + ], +) async def test_list_security_settings_async( - transport: str = "grpc_asyncio", - request_type=security_settings.ListSecuritySettingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecuritySettingsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2742,7 +2771,7 @@ async def test_list_security_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( @@ -2767,11 +2796,6 @@ async def test_list_security_settings_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_security_settings_async_from_dict(): - await test_list_security_settings_async(request_type=dict) - - def test_list_security_settings_field_headers(): client = SecuritySettingsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3124,8 +3148,8 @@ async def test_list_security_settings_async_pages(): @pytest.mark.parametrize( "request_type", [ - security_settings.DeleteSecuritySettingsRequest, - dict, + security_settings.DeleteSecuritySettingsRequest(), + {}, ], ) def test_delete_security_settings(request_type, transport: str = "grpc"): @@ -3136,7 +3160,7 @@ def test_delete_security_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( @@ -3181,9 +3205,10 @@ def test_delete_security_settings_non_empty_request_with_auto_populated_field(): client.delete_security_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == security_settings.DeleteSecuritySettingsRequest( + request_msg = security_settings.DeleteSecuritySettingsRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_security_settings_use_cached_wrapped_rpc(): @@ -3269,9 +3294,15 @@ async def test_delete_security_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + security_settings.DeleteSecuritySettingsRequest(), + {}, + ], +) async def test_delete_security_settings_async( - transport: str = "grpc_asyncio", - request_type=security_settings.DeleteSecuritySettingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecuritySettingsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3280,7 +3311,7 @@ async def test_delete_security_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( @@ -3300,11 +3331,6 @@ async def test_delete_security_settings_async( assert response is None -@pytest.mark.asyncio -async def test_delete_security_settings_async_from_dict(): - await test_delete_security_settings_async(request_type=dict) - - def test_delete_security_settings_field_headers(): client = SecuritySettingsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4602,7 +4628,6 @@ def test_create_security_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_security_settings.CreateSecuritySettingsRequest() - assert args[0] == request_msg @@ -4625,7 +4650,6 @@ def test_get_security_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_settings.GetSecuritySettingsRequest() - assert args[0] == request_msg @@ -4648,7 +4672,6 @@ def test_update_security_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_security_settings.UpdateSecuritySettingsRequest() - assert args[0] == request_msg @@ -4671,7 +4694,6 @@ def test_list_security_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_settings.ListSecuritySettingsRequest() - assert args[0] == request_msg @@ -4694,7 +4716,6 @@ def test_delete_security_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_settings.DeleteSecuritySettingsRequest() - assert args[0] == request_msg @@ -4745,7 +4766,6 @@ async def test_create_security_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_security_settings.CreateSecuritySettingsRequest() - assert args[0] == request_msg @@ -4782,7 +4802,6 @@ async def test_get_security_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_settings.GetSecuritySettingsRequest() - assert args[0] == request_msg @@ -4819,7 +4838,6 @@ async def test_update_security_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_security_settings.UpdateSecuritySettingsRequest() - assert args[0] == request_msg @@ -4848,7 +4866,6 @@ async def test_list_security_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_settings.ListSecuritySettingsRequest() - assert args[0] == request_msg @@ -4873,7 +4890,6 @@ async def test_delete_security_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_settings.DeleteSecuritySettingsRequest() - assert args[0] == request_msg @@ -6139,7 +6155,6 @@ def test_create_security_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_security_settings.CreateSecuritySettingsRequest() - assert args[0] == request_msg @@ -6161,7 +6176,6 @@ def test_get_security_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_settings.GetSecuritySettingsRequest() - assert args[0] == request_msg @@ -6183,7 +6197,6 @@ def test_update_security_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_security_settings.UpdateSecuritySettingsRequest() - assert args[0] == request_msg @@ -6205,7 +6218,6 @@ def test_list_security_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_settings.ListSecuritySettingsRequest() - assert args[0] == request_msg @@ -6227,7 +6239,6 @@ def test_delete_security_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_settings.DeleteSecuritySettingsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_session_entity_types.py b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_session_entity_types.py index bb9487ed7d7d..1ca5ecf89069 100644 --- a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_session_entity_types.py +++ b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_session_entity_types.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 @@ -113,6 +114,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" @@ -1361,8 +1377,8 @@ def test_session_entity_types_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - session_entity_type.ListSessionEntityTypesRequest, - dict, + session_entity_type.ListSessionEntityTypesRequest(), + {}, ], ) def test_list_session_entity_types(request_type, transport: str = "grpc"): @@ -1373,7 +1389,7 @@ def test_list_session_entity_types(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1422,10 +1438,11 @@ def test_list_session_entity_types_non_empty_request_with_auto_populated_field() client.list_session_entity_types(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == session_entity_type.ListSessionEntityTypesRequest( + request_msg = session_entity_type.ListSessionEntityTypesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_session_entity_types_use_cached_wrapped_rpc(): @@ -1511,9 +1528,15 @@ async def test_list_session_entity_types_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + session_entity_type.ListSessionEntityTypesRequest(), + {}, + ], +) async def test_list_session_entity_types_async( - transport: str = "grpc_asyncio", - request_type=session_entity_type.ListSessionEntityTypesRequest, + request_type, transport: str = "grpc_asyncio" ): client = SessionEntityTypesAsyncClient( credentials=async_anonymous_credentials(), @@ -1522,7 +1545,7 @@ async def test_list_session_entity_types_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( @@ -1547,11 +1570,6 @@ async def test_list_session_entity_types_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_session_entity_types_async_from_dict(): - await test_list_session_entity_types_async(request_type=dict) - - def test_list_session_entity_types_field_headers(): client = SessionEntityTypesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1910,8 +1928,8 @@ async def test_list_session_entity_types_async_pages(): @pytest.mark.parametrize( "request_type", [ - session_entity_type.GetSessionEntityTypeRequest, - dict, + session_entity_type.GetSessionEntityTypeRequest(), + {}, ], ) def test_get_session_entity_type(request_type, transport: str = "grpc"): @@ -1922,7 +1940,7 @@ def test_get_session_entity_type(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,9 +1993,10 @@ def test_get_session_entity_type_non_empty_request_with_auto_populated_field(): client.get_session_entity_type(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == session_entity_type.GetSessionEntityTypeRequest( + request_msg = session_entity_type.GetSessionEntityTypeRequest( name="name_value", ) + assert args[0] == request_msg def test_get_session_entity_type_use_cached_wrapped_rpc(): @@ -2063,9 +2082,15 @@ async def test_get_session_entity_type_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + session_entity_type.GetSessionEntityTypeRequest(), + {}, + ], +) async def test_get_session_entity_type_async( - transport: str = "grpc_asyncio", - request_type=session_entity_type.GetSessionEntityTypeRequest, + request_type, transport: str = "grpc_asyncio" ): client = SessionEntityTypesAsyncClient( credentials=async_anonymous_credentials(), @@ -2074,7 +2099,7 @@ async def test_get_session_entity_type_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( @@ -2104,11 +2129,6 @@ async def test_get_session_entity_type_async( ) -@pytest.mark.asyncio -async def test_get_session_entity_type_async_from_dict(): - await test_get_session_entity_type_async(request_type=dict) - - def test_get_session_entity_type_field_headers(): client = SessionEntityTypesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2263,8 +2283,8 @@ async def test_get_session_entity_type_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcdc_session_entity_type.CreateSessionEntityTypeRequest, - dict, + gcdc_session_entity_type.CreateSessionEntityTypeRequest(), + {}, ], ) def test_create_session_entity_type(request_type, transport: str = "grpc"): @@ -2275,7 +2295,7 @@ def test_create_session_entity_type(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,9 +2348,10 @@ def test_create_session_entity_type_non_empty_request_with_auto_populated_field( client.create_session_entity_type(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcdc_session_entity_type.CreateSessionEntityTypeRequest( + request_msg = gcdc_session_entity_type.CreateSessionEntityTypeRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_session_entity_type_use_cached_wrapped_rpc(): @@ -2416,9 +2437,15 @@ async def test_create_session_entity_type_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcdc_session_entity_type.CreateSessionEntityTypeRequest(), + {}, + ], +) async def test_create_session_entity_type_async( - transport: str = "grpc_asyncio", - request_type=gcdc_session_entity_type.CreateSessionEntityTypeRequest, + request_type, transport: str = "grpc_asyncio" ): client = SessionEntityTypesAsyncClient( credentials=async_anonymous_credentials(), @@ -2427,7 +2454,7 @@ async def test_create_session_entity_type_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( @@ -2457,11 +2484,6 @@ async def test_create_session_entity_type_async( ) -@pytest.mark.asyncio -async def test_create_session_entity_type_async_from_dict(): - await test_create_session_entity_type_async(request_type=dict) - - def test_create_session_entity_type_field_headers(): client = SessionEntityTypesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2634,8 +2656,8 @@ async def test_create_session_entity_type_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcdc_session_entity_type.UpdateSessionEntityTypeRequest, - dict, + gcdc_session_entity_type.UpdateSessionEntityTypeRequest(), + {}, ], ) def test_update_session_entity_type(request_type, transport: str = "grpc"): @@ -2646,7 +2668,7 @@ def test_update_session_entity_type(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2697,7 +2719,8 @@ def test_update_session_entity_type_non_empty_request_with_auto_populated_field( client.update_session_entity_type(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcdc_session_entity_type.UpdateSessionEntityTypeRequest() + request_msg = gcdc_session_entity_type.UpdateSessionEntityTypeRequest() + assert args[0] == request_msg def test_update_session_entity_type_use_cached_wrapped_rpc(): @@ -2783,9 +2806,15 @@ async def test_update_session_entity_type_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcdc_session_entity_type.UpdateSessionEntityTypeRequest(), + {}, + ], +) async def test_update_session_entity_type_async( - transport: str = "grpc_asyncio", - request_type=gcdc_session_entity_type.UpdateSessionEntityTypeRequest, + request_type, transport: str = "grpc_asyncio" ): client = SessionEntityTypesAsyncClient( credentials=async_anonymous_credentials(), @@ -2794,7 +2823,7 @@ async def test_update_session_entity_type_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( @@ -2824,11 +2853,6 @@ async def test_update_session_entity_type_async( ) -@pytest.mark.asyncio -async def test_update_session_entity_type_async_from_dict(): - await test_update_session_entity_type_async(request_type=dict) - - def test_update_session_entity_type_field_headers(): client = SessionEntityTypesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3001,8 +3025,8 @@ async def test_update_session_entity_type_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - session_entity_type.DeleteSessionEntityTypeRequest, - dict, + session_entity_type.DeleteSessionEntityTypeRequest(), + {}, ], ) def test_delete_session_entity_type(request_type, transport: str = "grpc"): @@ -3013,7 +3037,7 @@ def test_delete_session_entity_type(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3058,9 +3082,10 @@ def test_delete_session_entity_type_non_empty_request_with_auto_populated_field( client.delete_session_entity_type(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == session_entity_type.DeleteSessionEntityTypeRequest( + request_msg = session_entity_type.DeleteSessionEntityTypeRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_session_entity_type_use_cached_wrapped_rpc(): @@ -3146,9 +3171,15 @@ async def test_delete_session_entity_type_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + session_entity_type.DeleteSessionEntityTypeRequest(), + {}, + ], +) async def test_delete_session_entity_type_async( - transport: str = "grpc_asyncio", - request_type=session_entity_type.DeleteSessionEntityTypeRequest, + request_type, transport: str = "grpc_asyncio" ): client = SessionEntityTypesAsyncClient( credentials=async_anonymous_credentials(), @@ -3157,7 +3188,7 @@ async def test_delete_session_entity_type_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( @@ -3177,11 +3208,6 @@ async def test_delete_session_entity_type_async( assert response is None -@pytest.mark.asyncio -async def test_delete_session_entity_type_async_from_dict(): - await test_delete_session_entity_type_async(request_type=dict) - - def test_delete_session_entity_type_field_headers(): client = SessionEntityTypesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4482,7 +4508,6 @@ def test_list_session_entity_types_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session_entity_type.ListSessionEntityTypesRequest() - assert args[0] == request_msg @@ -4505,7 +4530,6 @@ def test_get_session_entity_type_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session_entity_type.GetSessionEntityTypeRequest() - assert args[0] == request_msg @@ -4528,7 +4552,6 @@ def test_create_session_entity_type_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_session_entity_type.CreateSessionEntityTypeRequest() - assert args[0] == request_msg @@ -4551,7 +4574,6 @@ def test_update_session_entity_type_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_session_entity_type.UpdateSessionEntityTypeRequest() - assert args[0] == request_msg @@ -4574,7 +4596,6 @@ def test_delete_session_entity_type_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session_entity_type.DeleteSessionEntityTypeRequest() - assert args[0] == request_msg @@ -4617,7 +4638,6 @@ async def test_list_session_entity_types_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session_entity_type.ListSessionEntityTypesRequest() - assert args[0] == request_msg @@ -4647,7 +4667,6 @@ async def test_get_session_entity_type_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session_entity_type.GetSessionEntityTypeRequest() - assert args[0] == request_msg @@ -4677,7 +4696,6 @@ async def test_create_session_entity_type_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_session_entity_type.CreateSessionEntityTypeRequest() - assert args[0] == request_msg @@ -4707,7 +4725,6 @@ async def test_update_session_entity_type_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_session_entity_type.UpdateSessionEntityTypeRequest() - assert args[0] == request_msg @@ -4732,7 +4749,6 @@ async def test_delete_session_entity_type_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session_entity_type.DeleteSessionEntityTypeRequest() - assert args[0] == request_msg @@ -5931,7 +5947,6 @@ def test_list_session_entity_types_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session_entity_type.ListSessionEntityTypesRequest() - assert args[0] == request_msg @@ -5953,7 +5968,6 @@ def test_get_session_entity_type_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session_entity_type.GetSessionEntityTypeRequest() - assert args[0] == request_msg @@ -5975,7 +5989,6 @@ def test_create_session_entity_type_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_session_entity_type.CreateSessionEntityTypeRequest() - assert args[0] == request_msg @@ -5997,7 +6010,6 @@ def test_update_session_entity_type_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_session_entity_type.UpdateSessionEntityTypeRequest() - assert args[0] == request_msg @@ -6019,7 +6031,6 @@ def test_delete_session_entity_type_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session_entity_type.DeleteSessionEntityTypeRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_sessions.py b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_sessions.py index 60720c3faff2..968843eeda5a 100644 --- a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_sessions.py +++ b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_sessions.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 @@ -121,6 +122,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" @@ -1268,8 +1284,8 @@ def test_sessions_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - session.DetectIntentRequest, - dict, + session.DetectIntentRequest(), + {}, ], ) def test_detect_intent(request_type, transport: str = "grpc"): @@ -1280,7 +1296,7 @@ def test_detect_intent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.detect_intent), "__call__") as call: @@ -1330,9 +1346,10 @@ def test_detect_intent_non_empty_request_with_auto_populated_field(): client.detect_intent(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == session.DetectIntentRequest( + request_msg = session.DetectIntentRequest( session="session_value", ) + assert args[0] == request_msg def test_detect_intent_use_cached_wrapped_rpc(): @@ -1413,9 +1430,14 @@ async def test_detect_intent_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_detect_intent_async( - transport: str = "grpc_asyncio", request_type=session.DetectIntentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + session.DetectIntentRequest(), + {}, + ], +) +async def test_detect_intent_async(request_type, transport: str = "grpc_asyncio"): client = SessionsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1423,7 +1445,7 @@ async def test_detect_intent_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.detect_intent), "__call__") as call: @@ -1452,11 +1474,6 @@ async def test_detect_intent_async( assert response.allow_cancellation is True -@pytest.mark.asyncio -async def test_detect_intent_async_from_dict(): - await test_detect_intent_async(request_type=dict) - - def test_detect_intent_field_headers(): client = SessionsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1521,8 +1538,8 @@ async def test_detect_intent_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - session.DetectIntentRequest, - dict, + session.DetectIntentRequest(), + {}, ], ) def test_server_streaming_detect_intent(request_type, transport: str = "grpc"): @@ -1533,7 +1550,7 @@ def test_server_streaming_detect_intent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1579,9 +1596,10 @@ def test_server_streaming_detect_intent_non_empty_request_with_auto_populated_fi client.server_streaming_detect_intent(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == session.DetectIntentRequest( + request_msg = session.DetectIntentRequest( session="session_value", ) + assert args[0] == request_msg def test_server_streaming_detect_intent_use_cached_wrapped_rpc(): @@ -1667,8 +1685,15 @@ async def test_server_streaming_detect_intent_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + session.DetectIntentRequest(), + {}, + ], +) async def test_server_streaming_detect_intent_async( - transport: str = "grpc_asyncio", request_type=session.DetectIntentRequest + request_type, transport: str = "grpc_asyncio" ): client = SessionsAsyncClient( credentials=async_anonymous_credentials(), @@ -1677,7 +1702,7 @@ async def test_server_streaming_detect_intent_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( @@ -1701,11 +1726,6 @@ async def test_server_streaming_detect_intent_async( assert isinstance(message, session.DetectIntentResponse) -@pytest.mark.asyncio -async def test_server_streaming_detect_intent_async_from_dict(): - await test_server_streaming_detect_intent_async(request_type=dict) - - def test_server_streaming_detect_intent_field_headers(): client = SessionsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1775,8 +1795,8 @@ async def test_server_streaming_detect_intent_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - session.StreamingDetectIntentRequest, - dict, + session.StreamingDetectIntentRequest(), + {}, ], ) def test_streaming_detect_intent(request_type, transport: str = "grpc"): @@ -1787,7 +1807,7 @@ def test_streaming_detect_intent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as 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. @@ -1891,8 +1911,15 @@ async def test_streaming_detect_intent_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + session.StreamingDetectIntentRequest(), + {}, + ], +) async def test_streaming_detect_intent_async( - transport: str = "grpc_asyncio", request_type=session.StreamingDetectIntentRequest + request_type, transport: str = "grpc_asyncio" ): client = SessionsAsyncClient( credentials=async_anonymous_credentials(), @@ -1901,7 +1928,7 @@ async def test_streaming_detect_intent_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. @@ -1925,16 +1952,11 @@ async def test_streaming_detect_intent_async( assert isinstance(message, session.StreamingDetectIntentResponse) -@pytest.mark.asyncio -async def test_streaming_detect_intent_async_from_dict(): - await test_streaming_detect_intent_async(request_type=dict) - - @pytest.mark.parametrize( "request_type", [ - session.MatchIntentRequest, - dict, + session.MatchIntentRequest(), + {}, ], ) def test_match_intent(request_type, transport: str = "grpc"): @@ -1945,7 +1967,7 @@ def test_match_intent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.match_intent), "__call__") as call: @@ -1988,9 +2010,10 @@ def test_match_intent_non_empty_request_with_auto_populated_field(): client.match_intent(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == session.MatchIntentRequest( + request_msg = session.MatchIntentRequest( session="session_value", ) + assert args[0] == request_msg def test_match_intent_use_cached_wrapped_rpc(): @@ -2071,9 +2094,14 @@ async def test_match_intent_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_match_intent_async( - transport: str = "grpc_asyncio", request_type=session.MatchIntentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + session.MatchIntentRequest(), + {}, + ], +) +async def test_match_intent_async(request_type, transport: str = "grpc_asyncio"): client = SessionsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2081,7 +2109,7 @@ async def test_match_intent_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.match_intent), "__call__") as call: @@ -2101,11 +2129,6 @@ async def test_match_intent_async( assert isinstance(response, session.MatchIntentResponse) -@pytest.mark.asyncio -async def test_match_intent_async_from_dict(): - await test_match_intent_async(request_type=dict) - - def test_match_intent_field_headers(): client = SessionsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2170,8 +2193,8 @@ async def test_match_intent_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - session.FulfillIntentRequest, - dict, + session.FulfillIntentRequest(), + {}, ], ) def test_fulfill_intent(request_type, transport: str = "grpc"): @@ -2182,7 +2205,7 @@ def test_fulfill_intent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.fulfill_intent), "__call__") as call: @@ -2226,7 +2249,8 @@ def test_fulfill_intent_non_empty_request_with_auto_populated_field(): client.fulfill_intent(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == session.FulfillIntentRequest() + request_msg = session.FulfillIntentRequest() + assert args[0] == request_msg def test_fulfill_intent_use_cached_wrapped_rpc(): @@ -2307,9 +2331,14 @@ async def test_fulfill_intent_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_fulfill_intent_async( - transport: str = "grpc_asyncio", request_type=session.FulfillIntentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + session.FulfillIntentRequest(), + {}, + ], +) +async def test_fulfill_intent_async(request_type, transport: str = "grpc_asyncio"): client = SessionsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2317,7 +2346,7 @@ async def test_fulfill_intent_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.fulfill_intent), "__call__") as call: @@ -2342,11 +2371,6 @@ async def test_fulfill_intent_async( assert response.output_audio == b"output_audio_blob" -@pytest.mark.asyncio -async def test_fulfill_intent_async_from_dict(): - await test_fulfill_intent_async(request_type=dict) - - def test_fulfill_intent_field_headers(): client = SessionsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2411,8 +2435,8 @@ async def test_fulfill_intent_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - session.SubmitAnswerFeedbackRequest, - dict, + session.SubmitAnswerFeedbackRequest(), + {}, ], ) def test_submit_answer_feedback(request_type, transport: str = "grpc"): @@ -2423,7 +2447,7 @@ def test_submit_answer_feedback(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2474,10 +2498,11 @@ def test_submit_answer_feedback_non_empty_request_with_auto_populated_field(): client.submit_answer_feedback(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == session.SubmitAnswerFeedbackRequest( + request_msg = session.SubmitAnswerFeedbackRequest( session="session_value", response_id="response_id_value", ) + assert args[0] == request_msg def test_submit_answer_feedback_use_cached_wrapped_rpc(): @@ -2563,8 +2588,15 @@ async def test_submit_answer_feedback_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + session.SubmitAnswerFeedbackRequest(), + {}, + ], +) async def test_submit_answer_feedback_async( - transport: str = "grpc_asyncio", request_type=session.SubmitAnswerFeedbackRequest + request_type, transport: str = "grpc_asyncio" ): client = SessionsAsyncClient( credentials=async_anonymous_credentials(), @@ -2573,7 +2605,7 @@ async def test_submit_answer_feedback_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( @@ -2600,11 +2632,6 @@ async def test_submit_answer_feedback_async( assert response.custom_rating == "custom_rating_value" -@pytest.mark.asyncio -async def test_submit_answer_feedback_async_from_dict(): - await test_submit_answer_feedback_async(request_type=dict) - - def test_submit_answer_feedback_field_headers(): client = SessionsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3385,7 +3412,6 @@ def test_detect_intent_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session.DetectIntentRequest() - assert args[0] == request_msg @@ -3408,7 +3434,6 @@ def test_server_streaming_detect_intent_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session.DetectIntentRequest() - assert args[0] == request_msg @@ -3429,7 +3454,6 @@ def test_match_intent_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session.MatchIntentRequest() - assert args[0] == request_msg @@ -3450,7 +3474,6 @@ def test_fulfill_intent_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session.FulfillIntentRequest() - assert args[0] == request_msg @@ -3473,7 +3496,6 @@ def test_submit_answer_feedback_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session.SubmitAnswerFeedbackRequest() - assert args[0] == request_msg @@ -3517,7 +3539,6 @@ async def test_detect_intent_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session.DetectIntentRequest() - assert args[0] == request_msg @@ -3545,7 +3566,6 @@ async def test_server_streaming_detect_intent_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session.DetectIntentRequest() - assert args[0] == request_msg @@ -3570,7 +3590,6 @@ async def test_match_intent_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session.MatchIntentRequest() - assert args[0] == request_msg @@ -3598,7 +3617,6 @@ async def test_fulfill_intent_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session.FulfillIntentRequest() - assert args[0] == request_msg @@ -3628,7 +3646,6 @@ async def test_submit_answer_feedback_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session.SubmitAnswerFeedbackRequest() - assert args[0] == request_msg @@ -4662,7 +4679,6 @@ def test_detect_intent_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session.DetectIntentRequest() - assert args[0] == request_msg @@ -4684,7 +4700,6 @@ def test_server_streaming_detect_intent_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session.DetectIntentRequest() - assert args[0] == request_msg @@ -4704,7 +4719,6 @@ def test_match_intent_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session.MatchIntentRequest() - assert args[0] == request_msg @@ -4724,7 +4738,6 @@ def test_fulfill_intent_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session.FulfillIntentRequest() - assert args[0] == request_msg @@ -4746,7 +4759,6 @@ def test_submit_answer_feedback_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session.SubmitAnswerFeedbackRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_test_cases.py b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_test_cases.py index da77679a1e53..0bd5a2a0c768 100644 --- a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_test_cases.py +++ b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_test_cases.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 @@ -132,6 +133,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" @@ -1294,8 +1310,8 @@ def test_test_cases_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - test_case.ListTestCasesRequest, - dict, + test_case.ListTestCasesRequest(), + {}, ], ) def test_list_test_cases(request_type, transport: str = "grpc"): @@ -1306,7 +1322,7 @@ def test_list_test_cases(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_test_cases), "__call__") as call: @@ -1351,10 +1367,11 @@ def test_list_test_cases_non_empty_request_with_auto_populated_field(): client.list_test_cases(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == test_case.ListTestCasesRequest( + request_msg = test_case.ListTestCasesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_test_cases_use_cached_wrapped_rpc(): @@ -1435,9 +1452,14 @@ async def test_list_test_cases_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_test_cases_async( - transport: str = "grpc_asyncio", request_type=test_case.ListTestCasesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + test_case.ListTestCasesRequest(), + {}, + ], +) +async def test_list_test_cases_async(request_type, transport: str = "grpc_asyncio"): client = TestCasesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1445,7 +1467,7 @@ async def test_list_test_cases_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_test_cases), "__call__") as call: @@ -1468,11 +1490,6 @@ async def test_list_test_cases_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_test_cases_async_from_dict(): - await test_list_test_cases_async(request_type=dict) - - def test_list_test_cases_field_headers(): client = TestCasesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1809,8 +1826,8 @@ async def test_list_test_cases_async_pages(): @pytest.mark.parametrize( "request_type", [ - test_case.BatchDeleteTestCasesRequest, - dict, + test_case.BatchDeleteTestCasesRequest(), + {}, ], ) def test_batch_delete_test_cases(request_type, transport: str = "grpc"): @@ -1821,7 +1838,7 @@ def test_batch_delete_test_cases(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1866,9 +1883,10 @@ def test_batch_delete_test_cases_non_empty_request_with_auto_populated_field(): client.batch_delete_test_cases(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == test_case.BatchDeleteTestCasesRequest( + request_msg = test_case.BatchDeleteTestCasesRequest( parent="parent_value", ) + assert args[0] == request_msg def test_batch_delete_test_cases_use_cached_wrapped_rpc(): @@ -1954,8 +1972,15 @@ async def test_batch_delete_test_cases_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + test_case.BatchDeleteTestCasesRequest(), + {}, + ], +) async def test_batch_delete_test_cases_async( - transport: str = "grpc_asyncio", request_type=test_case.BatchDeleteTestCasesRequest + request_type, transport: str = "grpc_asyncio" ): client = TestCasesAsyncClient( credentials=async_anonymous_credentials(), @@ -1964,7 +1989,7 @@ async def test_batch_delete_test_cases_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( @@ -1984,11 +2009,6 @@ async def test_batch_delete_test_cases_async( assert response is None -@pytest.mark.asyncio -async def test_batch_delete_test_cases_async_from_dict(): - await test_batch_delete_test_cases_async(request_type=dict) - - def test_batch_delete_test_cases_field_headers(): client = TestCasesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2139,8 +2159,8 @@ async def test_batch_delete_test_cases_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - test_case.GetTestCaseRequest, - dict, + test_case.GetTestCaseRequest(), + {}, ], ) def test_get_test_case(request_type, transport: str = "grpc"): @@ -2151,7 +2171,7 @@ def test_get_test_case(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_test_case), "__call__") as call: @@ -2201,9 +2221,10 @@ def test_get_test_case_non_empty_request_with_auto_populated_field(): client.get_test_case(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == test_case.GetTestCaseRequest( + request_msg = test_case.GetTestCaseRequest( name="name_value", ) + assert args[0] == request_msg def test_get_test_case_use_cached_wrapped_rpc(): @@ -2284,9 +2305,14 @@ async def test_get_test_case_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_test_case_async( - transport: str = "grpc_asyncio", request_type=test_case.GetTestCaseRequest -): +@pytest.mark.parametrize( + "request_type", + [ + test_case.GetTestCaseRequest(), + {}, + ], +) +async def test_get_test_case_async(request_type, transport: str = "grpc_asyncio"): client = TestCasesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2294,7 +2320,7 @@ async def test_get_test_case_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_test_case), "__call__") as call: @@ -2323,11 +2349,6 @@ async def test_get_test_case_async( assert response.notes == "notes_value" -@pytest.mark.asyncio -async def test_get_test_case_async_from_dict(): - await test_get_test_case_async(request_type=dict) - - def test_get_test_case_field_headers(): client = TestCasesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2470,8 +2491,8 @@ async def test_get_test_case_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcdc_test_case.CreateTestCaseRequest, - dict, + gcdc_test_case.CreateTestCaseRequest(), + {}, ], ) def test_create_test_case(request_type, transport: str = "grpc"): @@ -2482,7 +2503,7 @@ def test_create_test_case(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_test_case), "__call__") as call: @@ -2532,9 +2553,10 @@ def test_create_test_case_non_empty_request_with_auto_populated_field(): client.create_test_case(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcdc_test_case.CreateTestCaseRequest( + request_msg = gcdc_test_case.CreateTestCaseRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_test_case_use_cached_wrapped_rpc(): @@ -2617,9 +2639,14 @@ async def test_create_test_case_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_test_case_async( - transport: str = "grpc_asyncio", request_type=gcdc_test_case.CreateTestCaseRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcdc_test_case.CreateTestCaseRequest(), + {}, + ], +) +async def test_create_test_case_async(request_type, transport: str = "grpc_asyncio"): client = TestCasesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2627,7 +2654,7 @@ async def test_create_test_case_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_test_case), "__call__") as call: @@ -2656,11 +2683,6 @@ async def test_create_test_case_async( assert response.notes == "notes_value" -@pytest.mark.asyncio -async def test_create_test_case_async_from_dict(): - await test_create_test_case_async(request_type=dict) - - def test_create_test_case_field_headers(): client = TestCasesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2817,8 +2839,8 @@ async def test_create_test_case_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcdc_test_case.UpdateTestCaseRequest, - dict, + gcdc_test_case.UpdateTestCaseRequest(), + {}, ], ) def test_update_test_case(request_type, transport: str = "grpc"): @@ -2829,7 +2851,7 @@ def test_update_test_case(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_test_case), "__call__") as call: @@ -2877,7 +2899,8 @@ def test_update_test_case_non_empty_request_with_auto_populated_field(): client.update_test_case(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcdc_test_case.UpdateTestCaseRequest() + request_msg = gcdc_test_case.UpdateTestCaseRequest() + assert args[0] == request_msg def test_update_test_case_use_cached_wrapped_rpc(): @@ -2960,9 +2983,14 @@ async def test_update_test_case_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_test_case_async( - transport: str = "grpc_asyncio", request_type=gcdc_test_case.UpdateTestCaseRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcdc_test_case.UpdateTestCaseRequest(), + {}, + ], +) +async def test_update_test_case_async(request_type, transport: str = "grpc_asyncio"): client = TestCasesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2970,7 +2998,7 @@ async def test_update_test_case_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_test_case), "__call__") as call: @@ -2999,11 +3027,6 @@ async def test_update_test_case_async( assert response.notes == "notes_value" -@pytest.mark.asyncio -async def test_update_test_case_async_from_dict(): - await test_update_test_case_async(request_type=dict) - - def test_update_test_case_field_headers(): client = TestCasesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3160,8 +3183,8 @@ async def test_update_test_case_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - test_case.RunTestCaseRequest, - dict, + test_case.RunTestCaseRequest(), + {}, ], ) def test_run_test_case(request_type, transport: str = "grpc"): @@ -3172,7 +3195,7 @@ def test_run_test_case(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.run_test_case), "__call__") as call: @@ -3214,10 +3237,11 @@ def test_run_test_case_non_empty_request_with_auto_populated_field(): client.run_test_case(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == test_case.RunTestCaseRequest( + request_msg = test_case.RunTestCaseRequest( name="name_value", environment="environment_value", ) + assert args[0] == request_msg def test_run_test_case_use_cached_wrapped_rpc(): @@ -3308,9 +3332,14 @@ async def test_run_test_case_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_run_test_case_async( - transport: str = "grpc_asyncio", request_type=test_case.RunTestCaseRequest -): +@pytest.mark.parametrize( + "request_type", + [ + test_case.RunTestCaseRequest(), + {}, + ], +) +async def test_run_test_case_async(request_type, transport: str = "grpc_asyncio"): client = TestCasesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3318,7 +3347,7 @@ async def test_run_test_case_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.run_test_case), "__call__") as call: @@ -3338,11 +3367,6 @@ async def test_run_test_case_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_run_test_case_async_from_dict(): - await test_run_test_case_async(request_type=dict) - - def test_run_test_case_field_headers(): client = TestCasesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3407,8 +3431,8 @@ async def test_run_test_case_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - test_case.BatchRunTestCasesRequest, - dict, + test_case.BatchRunTestCasesRequest(), + {}, ], ) def test_batch_run_test_cases(request_type, transport: str = "grpc"): @@ -3419,7 +3443,7 @@ def test_batch_run_test_cases(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3465,10 +3489,11 @@ def test_batch_run_test_cases_non_empty_request_with_auto_populated_field(): client.batch_run_test_cases(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == test_case.BatchRunTestCasesRequest( + request_msg = test_case.BatchRunTestCasesRequest( parent="parent_value", environment="environment_value", ) + assert args[0] == request_msg def test_batch_run_test_cases_use_cached_wrapped_rpc(): @@ -3563,8 +3588,15 @@ async def test_batch_run_test_cases_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + test_case.BatchRunTestCasesRequest(), + {}, + ], +) async def test_batch_run_test_cases_async( - transport: str = "grpc_asyncio", request_type=test_case.BatchRunTestCasesRequest + request_type, transport: str = "grpc_asyncio" ): client = TestCasesAsyncClient( credentials=async_anonymous_credentials(), @@ -3573,7 +3605,7 @@ async def test_batch_run_test_cases_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( @@ -3595,11 +3627,6 @@ async def test_batch_run_test_cases_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_batch_run_test_cases_async_from_dict(): - await test_batch_run_test_cases_async(request_type=dict) - - def test_batch_run_test_cases_field_headers(): client = TestCasesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3668,8 +3695,8 @@ async def test_batch_run_test_cases_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - test_case.CalculateCoverageRequest, - dict, + test_case.CalculateCoverageRequest(), + {}, ], ) def test_calculate_coverage(request_type, transport: str = "grpc"): @@ -3680,7 +3707,7 @@ def test_calculate_coverage(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3728,9 +3755,10 @@ def test_calculate_coverage_non_empty_request_with_auto_populated_field(): client.calculate_coverage(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == test_case.CalculateCoverageRequest( + request_msg = test_case.CalculateCoverageRequest( agent="agent_value", ) + assert args[0] == request_msg def test_calculate_coverage_use_cached_wrapped_rpc(): @@ -3815,9 +3843,14 @@ async def test_calculate_coverage_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_calculate_coverage_async( - transport: str = "grpc_asyncio", request_type=test_case.CalculateCoverageRequest -): +@pytest.mark.parametrize( + "request_type", + [ + test_case.CalculateCoverageRequest(), + {}, + ], +) +async def test_calculate_coverage_async(request_type, transport: str = "grpc_asyncio"): client = TestCasesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3825,7 +3858,7 @@ async def test_calculate_coverage_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( @@ -3850,11 +3883,6 @@ async def test_calculate_coverage_async( assert response.agent == "agent_value" -@pytest.mark.asyncio -async def test_calculate_coverage_async_from_dict(): - await test_calculate_coverage_async(request_type=dict) - - def test_calculate_coverage_field_headers(): client = TestCasesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3923,8 +3951,8 @@ async def test_calculate_coverage_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - test_case.ImportTestCasesRequest, - dict, + test_case.ImportTestCasesRequest(), + {}, ], ) def test_import_test_cases(request_type, transport: str = "grpc"): @@ -3935,7 +3963,7 @@ def test_import_test_cases(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3981,10 +4009,11 @@ def test_import_test_cases_non_empty_request_with_auto_populated_field(): client.import_test_cases(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == test_case.ImportTestCasesRequest( + request_msg = test_case.ImportTestCasesRequest( parent="parent_value", gcs_uri="gcs_uri_value", ) + assert args[0] == request_msg def test_import_test_cases_use_cached_wrapped_rpc(): @@ -4077,9 +4106,14 @@ async def test_import_test_cases_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_import_test_cases_async( - transport: str = "grpc_asyncio", request_type=test_case.ImportTestCasesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + test_case.ImportTestCasesRequest(), + {}, + ], +) +async def test_import_test_cases_async(request_type, transport: str = "grpc_asyncio"): client = TestCasesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4087,7 +4121,7 @@ async def test_import_test_cases_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( @@ -4109,11 +4143,6 @@ async def test_import_test_cases_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_import_test_cases_async_from_dict(): - await test_import_test_cases_async(request_type=dict) - - def test_import_test_cases_field_headers(): client = TestCasesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4182,8 +4211,8 @@ async def test_import_test_cases_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - test_case.ExportTestCasesRequest, - dict, + test_case.ExportTestCasesRequest(), + {}, ], ) def test_export_test_cases(request_type, transport: str = "grpc"): @@ -4194,7 +4223,7 @@ def test_export_test_cases(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4241,11 +4270,12 @@ def test_export_test_cases_non_empty_request_with_auto_populated_field(): client.export_test_cases(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == test_case.ExportTestCasesRequest( + request_msg = test_case.ExportTestCasesRequest( parent="parent_value", gcs_uri="gcs_uri_value", filter="filter_value", ) + assert args[0] == request_msg def test_export_test_cases_use_cached_wrapped_rpc(): @@ -4338,9 +4368,14 @@ async def test_export_test_cases_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_export_test_cases_async( - transport: str = "grpc_asyncio", request_type=test_case.ExportTestCasesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + test_case.ExportTestCasesRequest(), + {}, + ], +) +async def test_export_test_cases_async(request_type, transport: str = "grpc_asyncio"): client = TestCasesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4348,7 +4383,7 @@ async def test_export_test_cases_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( @@ -4370,11 +4405,6 @@ async def test_export_test_cases_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_export_test_cases_async_from_dict(): - await test_export_test_cases_async(request_type=dict) - - def test_export_test_cases_field_headers(): client = TestCasesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4443,8 +4473,8 @@ async def test_export_test_cases_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - test_case.ListTestCaseResultsRequest, - dict, + test_case.ListTestCaseResultsRequest(), + {}, ], ) def test_list_test_case_results(request_type, transport: str = "grpc"): @@ -4455,7 +4485,7 @@ def test_list_test_case_results(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4505,11 +4535,12 @@ def test_list_test_case_results_non_empty_request_with_auto_populated_field(): client.list_test_case_results(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == test_case.ListTestCaseResultsRequest( + request_msg = test_case.ListTestCaseResultsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_test_case_results_use_cached_wrapped_rpc(): @@ -4595,8 +4626,15 @@ async def test_list_test_case_results_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + test_case.ListTestCaseResultsRequest(), + {}, + ], +) async def test_list_test_case_results_async( - transport: str = "grpc_asyncio", request_type=test_case.ListTestCaseResultsRequest + request_type, transport: str = "grpc_asyncio" ): client = TestCasesAsyncClient( credentials=async_anonymous_credentials(), @@ -4605,7 +4643,7 @@ async def test_list_test_case_results_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( @@ -4630,11 +4668,6 @@ async def test_list_test_case_results_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_test_case_results_async_from_dict(): - await test_list_test_case_results_async(request_type=dict) - - def test_list_test_case_results_field_headers(): client = TestCasesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4987,8 +5020,8 @@ async def test_list_test_case_results_async_pages(): @pytest.mark.parametrize( "request_type", [ - test_case.GetTestCaseResultRequest, - dict, + test_case.GetTestCaseResultRequest(), + {}, ], ) def test_get_test_case_result(request_type, transport: str = "grpc"): @@ -4999,7 +5032,7 @@ def test_get_test_case_result(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5051,9 +5084,10 @@ def test_get_test_case_result_non_empty_request_with_auto_populated_field(): client.get_test_case_result(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == test_case.GetTestCaseResultRequest( + request_msg = test_case.GetTestCaseResultRequest( name="name_value", ) + assert args[0] == request_msg def test_get_test_case_result_use_cached_wrapped_rpc(): @@ -5138,8 +5172,15 @@ async def test_get_test_case_result_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + test_case.GetTestCaseResultRequest(), + {}, + ], +) async def test_get_test_case_result_async( - transport: str = "grpc_asyncio", request_type=test_case.GetTestCaseResultRequest + request_type, transport: str = "grpc_asyncio" ): client = TestCasesAsyncClient( credentials=async_anonymous_credentials(), @@ -5148,7 +5189,7 @@ async def test_get_test_case_result_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( @@ -5177,11 +5218,6 @@ async def test_get_test_case_result_async( assert response.test_result == test_case.TestResult.PASSED -@pytest.mark.asyncio -async def test_get_test_case_result_async_from_dict(): - await test_get_test_case_result_async(request_type=dict) - - def test_get_test_case_result_field_headers(): client = TestCasesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7555,7 +7591,6 @@ def test_list_test_cases_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = test_case.ListTestCasesRequest() - assert args[0] == request_msg @@ -7578,7 +7613,6 @@ def test_batch_delete_test_cases_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = test_case.BatchDeleteTestCasesRequest() - assert args[0] == request_msg @@ -7599,7 +7633,6 @@ def test_get_test_case_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = test_case.GetTestCaseRequest() - assert args[0] == request_msg @@ -7620,7 +7653,6 @@ def test_create_test_case_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_test_case.CreateTestCaseRequest() - assert args[0] == request_msg @@ -7641,7 +7673,6 @@ def test_update_test_case_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_test_case.UpdateTestCaseRequest() - assert args[0] == request_msg @@ -7662,7 +7693,6 @@ def test_run_test_case_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = test_case.RunTestCaseRequest() - assert args[0] == request_msg @@ -7685,7 +7715,6 @@ def test_batch_run_test_cases_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = test_case.BatchRunTestCasesRequest() - assert args[0] == request_msg @@ -7708,7 +7737,6 @@ def test_calculate_coverage_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = test_case.CalculateCoverageRequest() - assert args[0] == request_msg @@ -7731,7 +7759,6 @@ def test_import_test_cases_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = test_case.ImportTestCasesRequest() - assert args[0] == request_msg @@ -7754,7 +7781,6 @@ def test_export_test_cases_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = test_case.ExportTestCasesRequest() - assert args[0] == request_msg @@ -7777,7 +7803,6 @@ def test_list_test_case_results_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = test_case.ListTestCaseResultsRequest() - assert args[0] == request_msg @@ -7800,7 +7825,6 @@ def test_get_test_case_result_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = test_case.GetTestCaseResultRequest() - assert args[0] == request_msg @@ -7841,7 +7865,6 @@ async def test_list_test_cases_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = test_case.ListTestCasesRequest() - assert args[0] == request_msg @@ -7866,7 +7889,6 @@ async def test_batch_delete_test_cases_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = test_case.BatchDeleteTestCasesRequest() - assert args[0] == request_msg @@ -7896,7 +7918,6 @@ async def test_get_test_case_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = test_case.GetTestCaseRequest() - assert args[0] == request_msg @@ -7926,7 +7947,6 @@ async def test_create_test_case_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_test_case.CreateTestCaseRequest() - assert args[0] == request_msg @@ -7956,7 +7976,6 @@ async def test_update_test_case_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_test_case.UpdateTestCaseRequest() - assert args[0] == request_msg @@ -7981,7 +8000,6 @@ async def test_run_test_case_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = test_case.RunTestCaseRequest() - assert args[0] == request_msg @@ -8008,7 +8026,6 @@ async def test_batch_run_test_cases_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = test_case.BatchRunTestCasesRequest() - assert args[0] == request_msg @@ -8037,7 +8054,6 @@ async def test_calculate_coverage_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = test_case.CalculateCoverageRequest() - assert args[0] == request_msg @@ -8064,7 +8080,6 @@ async def test_import_test_cases_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = test_case.ImportTestCasesRequest() - assert args[0] == request_msg @@ -8091,7 +8106,6 @@ async def test_export_test_cases_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = test_case.ExportTestCasesRequest() - assert args[0] == request_msg @@ -8120,7 +8134,6 @@ async def test_list_test_case_results_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = test_case.ListTestCaseResultsRequest() - assert args[0] == request_msg @@ -8151,7 +8164,6 @@ async def test_get_test_case_result_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = test_case.GetTestCaseResultRequest() - assert args[0] == request_msg @@ -10723,7 +10735,6 @@ def test_list_test_cases_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = test_case.ListTestCasesRequest() - assert args[0] == request_msg @@ -10745,7 +10756,6 @@ def test_batch_delete_test_cases_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = test_case.BatchDeleteTestCasesRequest() - assert args[0] == request_msg @@ -10765,7 +10775,6 @@ def test_get_test_case_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = test_case.GetTestCaseRequest() - assert args[0] == request_msg @@ -10785,7 +10794,6 @@ def test_create_test_case_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_test_case.CreateTestCaseRequest() - assert args[0] == request_msg @@ -10805,7 +10813,6 @@ def test_update_test_case_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_test_case.UpdateTestCaseRequest() - assert args[0] == request_msg @@ -10825,7 +10832,6 @@ def test_run_test_case_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = test_case.RunTestCaseRequest() - assert args[0] == request_msg @@ -10847,7 +10853,6 @@ def test_batch_run_test_cases_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = test_case.BatchRunTestCasesRequest() - assert args[0] == request_msg @@ -10869,7 +10874,6 @@ def test_calculate_coverage_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = test_case.CalculateCoverageRequest() - assert args[0] == request_msg @@ -10891,7 +10895,6 @@ def test_import_test_cases_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = test_case.ImportTestCasesRequest() - assert args[0] == request_msg @@ -10913,7 +10916,6 @@ def test_export_test_cases_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = test_case.ExportTestCasesRequest() - assert args[0] == request_msg @@ -10935,7 +10937,6 @@ def test_list_test_case_results_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = test_case.ListTestCaseResultsRequest() - assert args[0] == request_msg @@ -10957,7 +10958,6 @@ def test_get_test_case_result_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = test_case.GetTestCaseResultRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_tools.py b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_tools.py index fb20b7684d2f..aafebcb2ad7a 100644 --- a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_tools.py +++ b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_tools.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 @@ -117,6 +118,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" @@ -1248,8 +1264,8 @@ def test_tools_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - gcdc_tool.CreateToolRequest, - dict, + gcdc_tool.CreateToolRequest(), + {}, ], ) def test_create_tool(request_type, transport: str = "grpc"): @@ -1260,7 +1276,7 @@ def test_create_tool(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tool), "__call__") as call: @@ -1310,9 +1326,10 @@ def test_create_tool_non_empty_request_with_auto_populated_field(): client.create_tool(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcdc_tool.CreateToolRequest( + request_msg = gcdc_tool.CreateToolRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_tool_use_cached_wrapped_rpc(): @@ -1393,9 +1410,14 @@ async def test_create_tool_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_tool_async( - transport: str = "grpc_asyncio", request_type=gcdc_tool.CreateToolRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcdc_tool.CreateToolRequest(), + {}, + ], +) +async def test_create_tool_async(request_type, transport: str = "grpc_asyncio"): client = ToolsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1403,7 +1425,7 @@ async def test_create_tool_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_tool), "__call__") as call: @@ -1432,11 +1454,6 @@ async def test_create_tool_async( assert response.tool_type == gcdc_tool.Tool.ToolType.CUSTOMIZED_TOOL -@pytest.mark.asyncio -async def test_create_tool_async_from_dict(): - await test_create_tool_async(request_type=dict) - - def test_create_tool_field_headers(): client = ToolsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1589,8 +1606,8 @@ async def test_create_tool_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - tool.ListToolsRequest, - dict, + tool.ListToolsRequest(), + {}, ], ) def test_list_tools(request_type, transport: str = "grpc"): @@ -1601,7 +1618,7 @@ def test_list_tools(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tools), "__call__") as call: @@ -1646,10 +1663,11 @@ def test_list_tools_non_empty_request_with_auto_populated_field(): client.list_tools(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tool.ListToolsRequest( + request_msg = tool.ListToolsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_tools_use_cached_wrapped_rpc(): @@ -1728,9 +1746,14 @@ async def test_list_tools_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_list_tools_async( - transport: str = "grpc_asyncio", request_type=tool.ListToolsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tool.ListToolsRequest(), + {}, + ], +) +async def test_list_tools_async(request_type, transport: str = "grpc_asyncio"): client = ToolsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1738,7 +1761,7 @@ async def test_list_tools_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_tools), "__call__") as call: @@ -1761,11 +1784,6 @@ async def test_list_tools_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_tools_async_from_dict(): - await test_list_tools_async(request_type=dict) - - def test_list_tools_field_headers(): client = ToolsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2102,8 +2120,8 @@ async def test_list_tools_async_pages(): @pytest.mark.parametrize( "request_type", [ - tool.ExportToolsRequest, - dict, + tool.ExportToolsRequest(), + {}, ], ) def test_export_tools(request_type, transport: str = "grpc"): @@ -2114,7 +2132,7 @@ def test_export_tools(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.export_tools), "__call__") as call: @@ -2156,10 +2174,11 @@ def test_export_tools_non_empty_request_with_auto_populated_field(): client.export_tools(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tool.ExportToolsRequest( + request_msg = tool.ExportToolsRequest( parent="parent_value", tools_uri="tools_uri_value", ) + assert args[0] == request_msg def test_export_tools_use_cached_wrapped_rpc(): @@ -2250,9 +2269,14 @@ async def test_export_tools_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_export_tools_async( - transport: str = "grpc_asyncio", request_type=tool.ExportToolsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tool.ExportToolsRequest(), + {}, + ], +) +async def test_export_tools_async(request_type, transport: str = "grpc_asyncio"): client = ToolsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2260,7 +2284,7 @@ async def test_export_tools_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.export_tools), "__call__") as call: @@ -2280,11 +2304,6 @@ async def test_export_tools_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_export_tools_async_from_dict(): - await test_export_tools_async(request_type=dict) - - def test_export_tools_field_headers(): client = ToolsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2349,8 +2368,8 @@ async def test_export_tools_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - tool.GetToolRequest, - dict, + tool.GetToolRequest(), + {}, ], ) def test_get_tool(request_type, transport: str = "grpc"): @@ -2361,7 +2380,7 @@ def test_get_tool(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tool), "__call__") as call: @@ -2411,9 +2430,10 @@ def test_get_tool_non_empty_request_with_auto_populated_field(): client.get_tool(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tool.GetToolRequest( + request_msg = tool.GetToolRequest( name="name_value", ) + assert args[0] == request_msg def test_get_tool_use_cached_wrapped_rpc(): @@ -2492,9 +2512,14 @@ async def test_get_tool_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn @pytest.mark.asyncio -async def test_get_tool_async( - transport: str = "grpc_asyncio", request_type=tool.GetToolRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tool.GetToolRequest(), + {}, + ], +) +async def test_get_tool_async(request_type, transport: str = "grpc_asyncio"): client = ToolsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2502,7 +2527,7 @@ async def test_get_tool_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_tool), "__call__") as call: @@ -2531,11 +2556,6 @@ async def test_get_tool_async( assert response.tool_type == tool.Tool.ToolType.CUSTOMIZED_TOOL -@pytest.mark.asyncio -async def test_get_tool_async_from_dict(): - await test_get_tool_async(request_type=dict) - - def test_get_tool_field_headers(): client = ToolsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2678,8 +2698,8 @@ async def test_get_tool_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcdc_tool.UpdateToolRequest, - dict, + gcdc_tool.UpdateToolRequest(), + {}, ], ) def test_update_tool(request_type, transport: str = "grpc"): @@ -2690,7 +2710,7 @@ def test_update_tool(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tool), "__call__") as call: @@ -2738,7 +2758,8 @@ def test_update_tool_non_empty_request_with_auto_populated_field(): client.update_tool(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcdc_tool.UpdateToolRequest() + request_msg = gcdc_tool.UpdateToolRequest() + assert args[0] == request_msg def test_update_tool_use_cached_wrapped_rpc(): @@ -2819,9 +2840,14 @@ async def test_update_tool_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_tool_async( - transport: str = "grpc_asyncio", request_type=gcdc_tool.UpdateToolRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcdc_tool.UpdateToolRequest(), + {}, + ], +) +async def test_update_tool_async(request_type, transport: str = "grpc_asyncio"): client = ToolsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2829,7 +2855,7 @@ async def test_update_tool_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_tool), "__call__") as call: @@ -2858,11 +2884,6 @@ async def test_update_tool_async( assert response.tool_type == gcdc_tool.Tool.ToolType.CUSTOMIZED_TOOL -@pytest.mark.asyncio -async def test_update_tool_async_from_dict(): - await test_update_tool_async(request_type=dict) - - def test_update_tool_field_headers(): client = ToolsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3015,8 +3036,8 @@ async def test_update_tool_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - tool.DeleteToolRequest, - dict, + tool.DeleteToolRequest(), + {}, ], ) def test_delete_tool(request_type, transport: str = "grpc"): @@ -3027,7 +3048,7 @@ def test_delete_tool(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tool), "__call__") as call: @@ -3068,9 +3089,10 @@ def test_delete_tool_non_empty_request_with_auto_populated_field(): client.delete_tool(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tool.DeleteToolRequest( + request_msg = tool.DeleteToolRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_tool_use_cached_wrapped_rpc(): @@ -3151,9 +3173,14 @@ async def test_delete_tool_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_tool_async( - transport: str = "grpc_asyncio", request_type=tool.DeleteToolRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tool.DeleteToolRequest(), + {}, + ], +) +async def test_delete_tool_async(request_type, transport: str = "grpc_asyncio"): client = ToolsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3161,7 +3188,7 @@ async def test_delete_tool_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_tool), "__call__") as call: @@ -3179,11 +3206,6 @@ async def test_delete_tool_async( assert response is None -@pytest.mark.asyncio -async def test_delete_tool_async_from_dict(): - await test_delete_tool_async(request_type=dict) - - def test_delete_tool_field_headers(): client = ToolsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3326,8 +3348,8 @@ async def test_delete_tool_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - tool.ListToolVersionsRequest, - dict, + tool.ListToolVersionsRequest(), + {}, ], ) def test_list_tool_versions(request_type, transport: str = "grpc"): @@ -3338,7 +3360,7 @@ def test_list_tool_versions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3387,10 +3409,11 @@ def test_list_tool_versions_non_empty_request_with_auto_populated_field(): client.list_tool_versions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tool.ListToolVersionsRequest( + request_msg = tool.ListToolVersionsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_tool_versions_use_cached_wrapped_rpc(): @@ -3475,9 +3498,14 @@ async def test_list_tool_versions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_tool_versions_async( - transport: str = "grpc_asyncio", request_type=tool.ListToolVersionsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tool.ListToolVersionsRequest(), + {}, + ], +) +async def test_list_tool_versions_async(request_type, transport: str = "grpc_asyncio"): client = ToolsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3485,7 +3513,7 @@ async def test_list_tool_versions_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( @@ -3510,11 +3538,6 @@ async def test_list_tool_versions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_tool_versions_async_from_dict(): - await test_list_tool_versions_async(request_type=dict) - - def test_list_tool_versions_field_headers(): client = ToolsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3867,8 +3890,8 @@ async def test_list_tool_versions_async_pages(): @pytest.mark.parametrize( "request_type", [ - tool.CreateToolVersionRequest, - dict, + tool.CreateToolVersionRequest(), + {}, ], ) def test_create_tool_version(request_type, transport: str = "grpc"): @@ -3879,7 +3902,7 @@ def test_create_tool_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3929,9 +3952,10 @@ def test_create_tool_version_non_empty_request_with_auto_populated_field(): client.create_tool_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tool.CreateToolVersionRequest( + request_msg = tool.CreateToolVersionRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_tool_version_use_cached_wrapped_rpc(): @@ -4016,9 +4040,14 @@ async def test_create_tool_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_tool_version_async( - transport: str = "grpc_asyncio", request_type=tool.CreateToolVersionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tool.CreateToolVersionRequest(), + {}, + ], +) +async def test_create_tool_version_async(request_type, transport: str = "grpc_asyncio"): client = ToolsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4026,7 +4055,7 @@ async def test_create_tool_version_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( @@ -4053,11 +4082,6 @@ async def test_create_tool_version_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_create_tool_version_async_from_dict(): - await test_create_tool_version_async(request_type=dict) - - def test_create_tool_version_field_headers(): client = ToolsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4218,8 +4242,8 @@ async def test_create_tool_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - tool.GetToolVersionRequest, - dict, + tool.GetToolVersionRequest(), + {}, ], ) def test_get_tool_version(request_type, transport: str = "grpc"): @@ -4230,7 +4254,7 @@ def test_get_tool_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tool_version), "__call__") as call: @@ -4276,9 +4300,10 @@ def test_get_tool_version_non_empty_request_with_auto_populated_field(): client.get_tool_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tool.GetToolVersionRequest( + request_msg = tool.GetToolVersionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_tool_version_use_cached_wrapped_rpc(): @@ -4361,9 +4386,14 @@ async def test_get_tool_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_tool_version_async( - transport: str = "grpc_asyncio", request_type=tool.GetToolVersionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tool.GetToolVersionRequest(), + {}, + ], +) +async def test_get_tool_version_async(request_type, transport: str = "grpc_asyncio"): client = ToolsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4371,7 +4401,7 @@ async def test_get_tool_version_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_tool_version), "__call__") as call: @@ -4396,11 +4426,6 @@ async def test_get_tool_version_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_get_tool_version_async_from_dict(): - await test_get_tool_version_async(request_type=dict) - - def test_get_tool_version_field_headers(): client = ToolsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4543,8 +4568,8 @@ async def test_get_tool_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - tool.DeleteToolVersionRequest, - dict, + tool.DeleteToolVersionRequest(), + {}, ], ) def test_delete_tool_version(request_type, transport: str = "grpc"): @@ -4555,7 +4580,7 @@ def test_delete_tool_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4600,9 +4625,10 @@ def test_delete_tool_version_non_empty_request_with_auto_populated_field(): client.delete_tool_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tool.DeleteToolVersionRequest( + request_msg = tool.DeleteToolVersionRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_tool_version_use_cached_wrapped_rpc(): @@ -4687,9 +4713,14 @@ async def test_delete_tool_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_tool_version_async( - transport: str = "grpc_asyncio", request_type=tool.DeleteToolVersionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tool.DeleteToolVersionRequest(), + {}, + ], +) +async def test_delete_tool_version_async(request_type, transport: str = "grpc_asyncio"): client = ToolsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4697,7 +4728,7 @@ async def test_delete_tool_version_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( @@ -4717,11 +4748,6 @@ async def test_delete_tool_version_async( assert response is None -@pytest.mark.asyncio -async def test_delete_tool_version_async_from_dict(): - await test_delete_tool_version_async(request_type=dict) - - def test_delete_tool_version_field_headers(): client = ToolsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4872,8 +4898,8 @@ async def test_delete_tool_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - tool.RestoreToolVersionRequest, - dict, + tool.RestoreToolVersionRequest(), + {}, ], ) def test_restore_tool_version(request_type, transport: str = "grpc"): @@ -4884,7 +4910,7 @@ def test_restore_tool_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4929,9 +4955,10 @@ def test_restore_tool_version_non_empty_request_with_auto_populated_field(): client.restore_tool_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tool.RestoreToolVersionRequest( + request_msg = tool.RestoreToolVersionRequest( name="name_value", ) + assert args[0] == request_msg def test_restore_tool_version_use_cached_wrapped_rpc(): @@ -5016,8 +5043,15 @@ async def test_restore_tool_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + tool.RestoreToolVersionRequest(), + {}, + ], +) async def test_restore_tool_version_async( - transport: str = "grpc_asyncio", request_type=tool.RestoreToolVersionRequest + request_type, transport: str = "grpc_asyncio" ): client = ToolsAsyncClient( credentials=async_anonymous_credentials(), @@ -5026,7 +5060,7 @@ async def test_restore_tool_version_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( @@ -5048,11 +5082,6 @@ async def test_restore_tool_version_async( assert isinstance(response, tool.RestoreToolVersionResponse) -@pytest.mark.asyncio -async def test_restore_tool_version_async_from_dict(): - await test_restore_tool_version_async(request_type=dict) - - def test_restore_tool_version_field_headers(): client = ToolsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7434,7 +7463,6 @@ def test_create_tool_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_tool.CreateToolRequest() - assert args[0] == request_msg @@ -7455,7 +7483,6 @@ def test_list_tools_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool.ListToolsRequest() - assert args[0] == request_msg @@ -7476,7 +7503,6 @@ def test_export_tools_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool.ExportToolsRequest() - assert args[0] == request_msg @@ -7497,7 +7523,6 @@ def test_get_tool_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool.GetToolRequest() - assert args[0] == request_msg @@ -7518,7 +7543,6 @@ def test_update_tool_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_tool.UpdateToolRequest() - assert args[0] == request_msg @@ -7539,7 +7563,6 @@ def test_delete_tool_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool.DeleteToolRequest() - assert args[0] == request_msg @@ -7562,7 +7585,6 @@ def test_list_tool_versions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool.ListToolVersionsRequest() - assert args[0] == request_msg @@ -7585,7 +7607,6 @@ def test_create_tool_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool.CreateToolVersionRequest() - assert args[0] == request_msg @@ -7606,7 +7627,6 @@ def test_get_tool_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool.GetToolVersionRequest() - assert args[0] == request_msg @@ -7629,7 +7649,6 @@ def test_delete_tool_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool.DeleteToolVersionRequest() - assert args[0] == request_msg @@ -7652,7 +7671,6 @@ def test_restore_tool_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool.RestoreToolVersionRequest() - assert args[0] == request_msg @@ -7696,7 +7714,6 @@ async def test_create_tool_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_tool.CreateToolRequest() - assert args[0] == request_msg @@ -7723,7 +7740,6 @@ async def test_list_tools_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool.ListToolsRequest() - assert args[0] == request_msg @@ -7748,7 +7764,6 @@ async def test_export_tools_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool.ExportToolsRequest() - assert args[0] == request_msg @@ -7778,7 +7793,6 @@ async def test_get_tool_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool.GetToolRequest() - assert args[0] == request_msg @@ -7808,7 +7822,6 @@ async def test_update_tool_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_tool.UpdateToolRequest() - assert args[0] == request_msg @@ -7831,7 +7844,6 @@ async def test_delete_tool_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool.DeleteToolRequest() - assert args[0] == request_msg @@ -7860,7 +7872,6 @@ async def test_list_tool_versions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool.ListToolVersionsRequest() - assert args[0] == request_msg @@ -7890,7 +7901,6 @@ async def test_create_tool_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool.CreateToolVersionRequest() - assert args[0] == request_msg @@ -7918,7 +7928,6 @@ async def test_get_tool_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool.GetToolVersionRequest() - assert args[0] == request_msg @@ -7943,7 +7952,6 @@ async def test_delete_tool_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool.DeleteToolVersionRequest() - assert args[0] == request_msg @@ -7970,7 +7978,6 @@ async def test_restore_tool_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool.RestoreToolVersionRequest() - assert args[0] == request_msg @@ -10104,7 +10111,6 @@ def test_create_tool_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_tool.CreateToolRequest() - assert args[0] == request_msg @@ -10124,7 +10130,6 @@ def test_list_tools_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool.ListToolsRequest() - assert args[0] == request_msg @@ -10144,7 +10149,6 @@ def test_export_tools_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool.ExportToolsRequest() - assert args[0] == request_msg @@ -10164,7 +10168,6 @@ def test_get_tool_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool.GetToolRequest() - assert args[0] == request_msg @@ -10184,7 +10187,6 @@ def test_update_tool_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_tool.UpdateToolRequest() - assert args[0] == request_msg @@ -10204,7 +10206,6 @@ def test_delete_tool_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool.DeleteToolRequest() - assert args[0] == request_msg @@ -10226,7 +10227,6 @@ def test_list_tool_versions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool.ListToolVersionsRequest() - assert args[0] == request_msg @@ -10248,7 +10248,6 @@ def test_create_tool_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool.CreateToolVersionRequest() - assert args[0] == request_msg @@ -10268,7 +10267,6 @@ def test_get_tool_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool.GetToolVersionRequest() - assert args[0] == request_msg @@ -10290,7 +10288,6 @@ def test_delete_tool_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool.DeleteToolVersionRequest() - assert args[0] == request_msg @@ -10312,7 +10309,6 @@ def test_restore_tool_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool.RestoreToolVersionRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_transition_route_groups.py b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_transition_route_groups.py index 6df430141ef3..0a86e9e42857 100644 --- a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_transition_route_groups.py +++ b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_transition_route_groups.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 @@ -123,6 +124,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" @@ -1391,8 +1407,8 @@ def test_transition_route_groups_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - transition_route_group.ListTransitionRouteGroupsRequest, - dict, + transition_route_group.ListTransitionRouteGroupsRequest(), + {}, ], ) def test_list_transition_route_groups(request_type, transport: str = "grpc"): @@ -1403,7 +1419,7 @@ def test_list_transition_route_groups(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1453,11 +1469,12 @@ def test_list_transition_route_groups_non_empty_request_with_auto_populated_fiel client.list_transition_route_groups(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == transition_route_group.ListTransitionRouteGroupsRequest( + request_msg = transition_route_group.ListTransitionRouteGroupsRequest( parent="parent_value", page_token="page_token_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_list_transition_route_groups_use_cached_wrapped_rpc(): @@ -1543,9 +1560,15 @@ async def test_list_transition_route_groups_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + transition_route_group.ListTransitionRouteGroupsRequest(), + {}, + ], +) async def test_list_transition_route_groups_async( - transport: str = "grpc_asyncio", - request_type=transition_route_group.ListTransitionRouteGroupsRequest, + request_type, transport: str = "grpc_asyncio" ): client = TransitionRouteGroupsAsyncClient( credentials=async_anonymous_credentials(), @@ -1554,7 +1577,7 @@ async def test_list_transition_route_groups_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( @@ -1579,11 +1602,6 @@ async def test_list_transition_route_groups_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_transition_route_groups_async_from_dict(): - await test_list_transition_route_groups_async(request_type=dict) - - def test_list_transition_route_groups_field_headers(): client = TransitionRouteGroupsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1945,8 +1963,8 @@ async def test_list_transition_route_groups_async_pages(): @pytest.mark.parametrize( "request_type", [ - transition_route_group.GetTransitionRouteGroupRequest, - dict, + transition_route_group.GetTransitionRouteGroupRequest(), + {}, ], ) def test_get_transition_route_group(request_type, transport: str = "grpc"): @@ -1957,7 +1975,7 @@ def test_get_transition_route_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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 +2026,11 @@ def test_get_transition_route_group_non_empty_request_with_auto_populated_field( client.get_transition_route_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == transition_route_group.GetTransitionRouteGroupRequest( + request_msg = transition_route_group.GetTransitionRouteGroupRequest( name="name_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_get_transition_route_group_use_cached_wrapped_rpc(): @@ -2097,9 +2116,15 @@ async def test_get_transition_route_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + transition_route_group.GetTransitionRouteGroupRequest(), + {}, + ], +) async def test_get_transition_route_group_async( - transport: str = "grpc_asyncio", - request_type=transition_route_group.GetTransitionRouteGroupRequest, + request_type, transport: str = "grpc_asyncio" ): client = TransitionRouteGroupsAsyncClient( credentials=async_anonymous_credentials(), @@ -2108,7 +2133,7 @@ async def test_get_transition_route_group_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( @@ -2135,11 +2160,6 @@ async def test_get_transition_route_group_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_get_transition_route_group_async_from_dict(): - await test_get_transition_route_group_async(request_type=dict) - - def test_get_transition_route_group_field_headers(): client = TransitionRouteGroupsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2294,8 +2314,8 @@ async def test_get_transition_route_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcdc_transition_route_group.CreateTransitionRouteGroupRequest, - dict, + gcdc_transition_route_group.CreateTransitionRouteGroupRequest(), + {}, ], ) def test_create_transition_route_group(request_type, transport: str = "grpc"): @@ -2306,7 +2326,7 @@ def test_create_transition_route_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2357,10 +2377,11 @@ def test_create_transition_route_group_non_empty_request_with_auto_populated_fie client.create_transition_route_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcdc_transition_route_group.CreateTransitionRouteGroupRequest( + request_msg = gcdc_transition_route_group.CreateTransitionRouteGroupRequest( parent="parent_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_create_transition_route_group_use_cached_wrapped_rpc(): @@ -2446,9 +2467,15 @@ async def test_create_transition_route_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcdc_transition_route_group.CreateTransitionRouteGroupRequest(), + {}, + ], +) async def test_create_transition_route_group_async( - transport: str = "grpc_asyncio", - request_type=gcdc_transition_route_group.CreateTransitionRouteGroupRequest, + request_type, transport: str = "grpc_asyncio" ): client = TransitionRouteGroupsAsyncClient( credentials=async_anonymous_credentials(), @@ -2457,7 +2484,7 @@ async def test_create_transition_route_group_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( @@ -2484,11 +2511,6 @@ async def test_create_transition_route_group_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_create_transition_route_group_async_from_dict(): - await test_create_transition_route_group_async(request_type=dict) - - def test_create_transition_route_group_field_headers(): client = TransitionRouteGroupsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2661,8 +2683,8 @@ async def test_create_transition_route_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcdc_transition_route_group.UpdateTransitionRouteGroupRequest, - dict, + gcdc_transition_route_group.UpdateTransitionRouteGroupRequest(), + {}, ], ) def test_update_transition_route_group(request_type, transport: str = "grpc"): @@ -2673,7 +2695,7 @@ def test_update_transition_route_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2723,9 +2745,10 @@ def test_update_transition_route_group_non_empty_request_with_auto_populated_fie client.update_transition_route_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcdc_transition_route_group.UpdateTransitionRouteGroupRequest( + request_msg = gcdc_transition_route_group.UpdateTransitionRouteGroupRequest( language_code="language_code_value", ) + assert args[0] == request_msg def test_update_transition_route_group_use_cached_wrapped_rpc(): @@ -2811,9 +2834,15 @@ async def test_update_transition_route_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcdc_transition_route_group.UpdateTransitionRouteGroupRequest(), + {}, + ], +) async def test_update_transition_route_group_async( - transport: str = "grpc_asyncio", - request_type=gcdc_transition_route_group.UpdateTransitionRouteGroupRequest, + request_type, transport: str = "grpc_asyncio" ): client = TransitionRouteGroupsAsyncClient( credentials=async_anonymous_credentials(), @@ -2822,7 +2851,7 @@ async def test_update_transition_route_group_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( @@ -2849,11 +2878,6 @@ async def test_update_transition_route_group_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_update_transition_route_group_async_from_dict(): - await test_update_transition_route_group_async(request_type=dict) - - def test_update_transition_route_group_field_headers(): client = TransitionRouteGroupsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3026,8 +3050,8 @@ async def test_update_transition_route_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - transition_route_group.DeleteTransitionRouteGroupRequest, - dict, + transition_route_group.DeleteTransitionRouteGroupRequest(), + {}, ], ) def test_delete_transition_route_group(request_type, transport: str = "grpc"): @@ -3038,7 +3062,7 @@ def test_delete_transition_route_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3083,9 +3107,10 @@ def test_delete_transition_route_group_non_empty_request_with_auto_populated_fie client.delete_transition_route_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == transition_route_group.DeleteTransitionRouteGroupRequest( + request_msg = transition_route_group.DeleteTransitionRouteGroupRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_transition_route_group_use_cached_wrapped_rpc(): @@ -3171,9 +3196,15 @@ async def test_delete_transition_route_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + transition_route_group.DeleteTransitionRouteGroupRequest(), + {}, + ], +) async def test_delete_transition_route_group_async( - transport: str = "grpc_asyncio", - request_type=transition_route_group.DeleteTransitionRouteGroupRequest, + request_type, transport: str = "grpc_asyncio" ): client = TransitionRouteGroupsAsyncClient( credentials=async_anonymous_credentials(), @@ -3182,7 +3213,7 @@ async def test_delete_transition_route_group_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( @@ -3202,11 +3233,6 @@ async def test_delete_transition_route_group_async( assert response is None -@pytest.mark.asyncio -async def test_delete_transition_route_group_async_from_dict(): - await test_delete_transition_route_group_async(request_type=dict) - - def test_delete_transition_route_group_field_headers(): client = TransitionRouteGroupsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4538,7 +4564,6 @@ def test_list_transition_route_groups_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transition_route_group.ListTransitionRouteGroupsRequest() - assert args[0] == request_msg @@ -4561,7 +4586,6 @@ def test_get_transition_route_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transition_route_group.GetTransitionRouteGroupRequest() - assert args[0] == request_msg @@ -4584,7 +4608,6 @@ def test_create_transition_route_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_transition_route_group.CreateTransitionRouteGroupRequest() - assert args[0] == request_msg @@ -4607,7 +4630,6 @@ def test_update_transition_route_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_transition_route_group.UpdateTransitionRouteGroupRequest() - assert args[0] == request_msg @@ -4630,7 +4652,6 @@ def test_delete_transition_route_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transition_route_group.DeleteTransitionRouteGroupRequest() - assert args[0] == request_msg @@ -4673,7 +4694,6 @@ async def test_list_transition_route_groups_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transition_route_group.ListTransitionRouteGroupsRequest() - assert args[0] == request_msg @@ -4703,7 +4723,6 @@ async def test_get_transition_route_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transition_route_group.GetTransitionRouteGroupRequest() - assert args[0] == request_msg @@ -4733,7 +4752,6 @@ async def test_create_transition_route_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_transition_route_group.CreateTransitionRouteGroupRequest() - assert args[0] == request_msg @@ -4763,7 +4781,6 @@ async def test_update_transition_route_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_transition_route_group.UpdateTransitionRouteGroupRequest() - assert args[0] == request_msg @@ -4788,7 +4805,6 @@ async def test_delete_transition_route_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transition_route_group.DeleteTransitionRouteGroupRequest() - assert args[0] == request_msg @@ -6200,7 +6216,6 @@ def test_list_transition_route_groups_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transition_route_group.ListTransitionRouteGroupsRequest() - assert args[0] == request_msg @@ -6222,7 +6237,6 @@ def test_get_transition_route_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transition_route_group.GetTransitionRouteGroupRequest() - assert args[0] == request_msg @@ -6244,7 +6258,6 @@ def test_create_transition_route_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_transition_route_group.CreateTransitionRouteGroupRequest() - assert args[0] == request_msg @@ -6266,7 +6279,6 @@ def test_update_transition_route_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_transition_route_group.UpdateTransitionRouteGroupRequest() - assert args[0] == request_msg @@ -6288,7 +6300,6 @@ def test_delete_transition_route_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transition_route_group.DeleteTransitionRouteGroupRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_versions.py b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_versions.py index dba65299cd52..3911f1848d9d 100644 --- a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_versions.py +++ b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_versions.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 @@ -118,6 +119,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" @@ -1265,8 +1281,8 @@ def test_versions_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - version.ListVersionsRequest, - dict, + version.ListVersionsRequest(), + {}, ], ) def test_list_versions(request_type, transport: str = "grpc"): @@ -1277,7 +1293,7 @@ def test_list_versions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_versions), "__call__") as call: @@ -1322,10 +1338,11 @@ def test_list_versions_non_empty_request_with_auto_populated_field(): client.list_versions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == version.ListVersionsRequest( + request_msg = version.ListVersionsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_versions_use_cached_wrapped_rpc(): @@ -1406,9 +1423,14 @@ async def test_list_versions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_versions_async( - transport: str = "grpc_asyncio", request_type=version.ListVersionsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + version.ListVersionsRequest(), + {}, + ], +) +async def test_list_versions_async(request_type, transport: str = "grpc_asyncio"): client = VersionsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1416,7 +1438,7 @@ async def test_list_versions_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_versions), "__call__") as call: @@ -1439,11 +1461,6 @@ async def test_list_versions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_versions_async_from_dict(): - await test_list_versions_async(request_type=dict) - - def test_list_versions_field_headers(): client = VersionsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1780,8 +1797,8 @@ async def test_list_versions_async_pages(): @pytest.mark.parametrize( "request_type", [ - version.GetVersionRequest, - dict, + version.GetVersionRequest(), + {}, ], ) def test_get_version(request_type, transport: str = "grpc"): @@ -1792,7 +1809,7 @@ def test_get_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_version), "__call__") as call: @@ -1842,9 +1859,10 @@ def test_get_version_non_empty_request_with_auto_populated_field(): client.get_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == version.GetVersionRequest( + request_msg = version.GetVersionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_version_use_cached_wrapped_rpc(): @@ -1925,9 +1943,14 @@ async def test_get_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_version_async( - transport: str = "grpc_asyncio", request_type=version.GetVersionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + version.GetVersionRequest(), + {}, + ], +) +async def test_get_version_async(request_type, transport: str = "grpc_asyncio"): client = VersionsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1935,7 +1958,7 @@ async def test_get_version_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_version), "__call__") as call: @@ -1964,11 +1987,6 @@ async def test_get_version_async( assert response.state == version.Version.State.RUNNING -@pytest.mark.asyncio -async def test_get_version_async_from_dict(): - await test_get_version_async(request_type=dict) - - def test_get_version_field_headers(): client = VersionsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2111,8 +2129,8 @@ async def test_get_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcdc_version.CreateVersionRequest, - dict, + gcdc_version.CreateVersionRequest(), + {}, ], ) def test_create_version(request_type, transport: str = "grpc"): @@ -2123,7 +2141,7 @@ def test_create_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_version), "__call__") as call: @@ -2164,9 +2182,10 @@ def test_create_version_non_empty_request_with_auto_populated_field(): client.create_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcdc_version.CreateVersionRequest( + request_msg = gcdc_version.CreateVersionRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_version_use_cached_wrapped_rpc(): @@ -2257,9 +2276,14 @@ async def test_create_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_version_async( - transport: str = "grpc_asyncio", request_type=gcdc_version.CreateVersionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcdc_version.CreateVersionRequest(), + {}, + ], +) +async def test_create_version_async(request_type, transport: str = "grpc_asyncio"): client = VersionsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2267,7 +2291,7 @@ async def test_create_version_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_version), "__call__") as call: @@ -2287,11 +2311,6 @@ async def test_create_version_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_version_async_from_dict(): - await test_create_version_async(request_type=dict) - - def test_create_version_field_headers(): client = VersionsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2448,8 +2467,8 @@ async def test_create_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcdc_version.UpdateVersionRequest, - dict, + gcdc_version.UpdateVersionRequest(), + {}, ], ) def test_update_version(request_type, transport: str = "grpc"): @@ -2460,7 +2479,7 @@ def test_update_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_version), "__call__") as call: @@ -2508,7 +2527,8 @@ def test_update_version_non_empty_request_with_auto_populated_field(): client.update_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcdc_version.UpdateVersionRequest() + request_msg = gcdc_version.UpdateVersionRequest() + assert args[0] == request_msg def test_update_version_use_cached_wrapped_rpc(): @@ -2589,9 +2609,14 @@ async def test_update_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_version_async( - transport: str = "grpc_asyncio", request_type=gcdc_version.UpdateVersionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcdc_version.UpdateVersionRequest(), + {}, + ], +) +async def test_update_version_async(request_type, transport: str = "grpc_asyncio"): client = VersionsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2599,7 +2624,7 @@ async def test_update_version_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_version), "__call__") as call: @@ -2628,11 +2653,6 @@ async def test_update_version_async( assert response.state == gcdc_version.Version.State.RUNNING -@pytest.mark.asyncio -async def test_update_version_async_from_dict(): - await test_update_version_async(request_type=dict) - - def test_update_version_field_headers(): client = VersionsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2789,8 +2809,8 @@ async def test_update_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - version.DeleteVersionRequest, - dict, + version.DeleteVersionRequest(), + {}, ], ) def test_delete_version(request_type, transport: str = "grpc"): @@ -2801,7 +2821,7 @@ def test_delete_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_version), "__call__") as call: @@ -2842,9 +2862,10 @@ def test_delete_version_non_empty_request_with_auto_populated_field(): client.delete_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == version.DeleteVersionRequest( + request_msg = version.DeleteVersionRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_version_use_cached_wrapped_rpc(): @@ -2925,9 +2946,14 @@ async def test_delete_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_version_async( - transport: str = "grpc_asyncio", request_type=version.DeleteVersionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + version.DeleteVersionRequest(), + {}, + ], +) +async def test_delete_version_async(request_type, transport: str = "grpc_asyncio"): client = VersionsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2935,7 +2961,7 @@ async def test_delete_version_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_version), "__call__") as call: @@ -2953,11 +2979,6 @@ async def test_delete_version_async( assert response is None -@pytest.mark.asyncio -async def test_delete_version_async_from_dict(): - await test_delete_version_async(request_type=dict) - - def test_delete_version_field_headers(): client = VersionsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3100,8 +3121,8 @@ async def test_delete_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - version.LoadVersionRequest, - dict, + version.LoadVersionRequest(), + {}, ], ) def test_load_version(request_type, transport: str = "grpc"): @@ -3112,7 +3133,7 @@ def test_load_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.load_version), "__call__") as call: @@ -3153,9 +3174,10 @@ def test_load_version_non_empty_request_with_auto_populated_field(): client.load_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == version.LoadVersionRequest( + request_msg = version.LoadVersionRequest( name="name_value", ) + assert args[0] == request_msg def test_load_version_use_cached_wrapped_rpc(): @@ -3246,9 +3268,14 @@ async def test_load_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_load_version_async( - transport: str = "grpc_asyncio", request_type=version.LoadVersionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + version.LoadVersionRequest(), + {}, + ], +) +async def test_load_version_async(request_type, transport: str = "grpc_asyncio"): client = VersionsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3256,7 +3283,7 @@ async def test_load_version_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.load_version), "__call__") as call: @@ -3276,11 +3303,6 @@ async def test_load_version_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_load_version_async_from_dict(): - await test_load_version_async(request_type=dict) - - def test_load_version_field_headers(): client = VersionsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3427,8 +3449,8 @@ async def test_load_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - version.CompareVersionsRequest, - dict, + version.CompareVersionsRequest(), + {}, ], ) def test_compare_versions(request_type, transport: str = "grpc"): @@ -3439,7 +3461,7 @@ def test_compare_versions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.compare_versions), "__call__") as call: @@ -3487,11 +3509,12 @@ def test_compare_versions_non_empty_request_with_auto_populated_field(): client.compare_versions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == version.CompareVersionsRequest( + request_msg = version.CompareVersionsRequest( base_version="base_version_value", target_version="target_version_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_compare_versions_use_cached_wrapped_rpc(): @@ -3574,9 +3597,14 @@ async def test_compare_versions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_compare_versions_async( - transport: str = "grpc_asyncio", request_type=version.CompareVersionsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + version.CompareVersionsRequest(), + {}, + ], +) +async def test_compare_versions_async(request_type, transport: str = "grpc_asyncio"): client = VersionsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3584,7 +3612,7 @@ async def test_compare_versions_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.compare_versions), "__call__") as call: @@ -3609,11 +3637,6 @@ async def test_compare_versions_async( assert response.target_version_content_json == "target_version_content_json_value" -@pytest.mark.asyncio -async def test_compare_versions_async_from_dict(): - await test_compare_versions_async(request_type=dict) - - def test_compare_versions_field_headers(): client = VersionsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5240,7 +5263,6 @@ def test_list_versions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = version.ListVersionsRequest() - assert args[0] == request_msg @@ -5261,7 +5283,6 @@ def test_get_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = version.GetVersionRequest() - assert args[0] == request_msg @@ -5282,7 +5303,6 @@ def test_create_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_version.CreateVersionRequest() - assert args[0] == request_msg @@ -5303,7 +5323,6 @@ def test_update_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_version.UpdateVersionRequest() - assert args[0] == request_msg @@ -5324,7 +5343,6 @@ def test_delete_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = version.DeleteVersionRequest() - assert args[0] == request_msg @@ -5345,7 +5363,6 @@ def test_load_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = version.LoadVersionRequest() - assert args[0] == request_msg @@ -5366,7 +5383,6 @@ def test_compare_versions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = version.CompareVersionsRequest() - assert args[0] == request_msg @@ -5407,7 +5423,6 @@ async def test_list_versions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = version.ListVersionsRequest() - assert args[0] == request_msg @@ -5437,7 +5452,6 @@ async def test_get_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = version.GetVersionRequest() - assert args[0] == request_msg @@ -5462,7 +5476,6 @@ async def test_create_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_version.CreateVersionRequest() - assert args[0] == request_msg @@ -5492,7 +5505,6 @@ async def test_update_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_version.UpdateVersionRequest() - assert args[0] == request_msg @@ -5515,7 +5527,6 @@ async def test_delete_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = version.DeleteVersionRequest() - assert args[0] == request_msg @@ -5540,7 +5551,6 @@ async def test_load_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = version.LoadVersionRequest() - assert args[0] == request_msg @@ -5568,7 +5578,6 @@ async def test_compare_versions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = version.CompareVersionsRequest() - assert args[0] == request_msg @@ -6963,7 +6972,6 @@ def test_list_versions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = version.ListVersionsRequest() - assert args[0] == request_msg @@ -6983,7 +6991,6 @@ def test_get_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = version.GetVersionRequest() - assert args[0] == request_msg @@ -7003,7 +7010,6 @@ def test_create_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_version.CreateVersionRequest() - assert args[0] == request_msg @@ -7023,7 +7029,6 @@ def test_update_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_version.UpdateVersionRequest() - assert args[0] == request_msg @@ -7043,7 +7048,6 @@ def test_delete_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = version.DeleteVersionRequest() - assert args[0] == request_msg @@ -7063,7 +7067,6 @@ def test_load_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = version.LoadVersionRequest() - assert args[0] == request_msg @@ -7083,7 +7086,6 @@ def test_compare_versions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = version.CompareVersionsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_webhooks.py b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_webhooks.py index f05de91497db..31cb694cfdd5 100644 --- a/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_webhooks.py +++ b/packages/google-cloud-dialogflow-cx/tests/unit/gapic/dialogflowcx_v3beta1/test_webhooks.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" @@ -1259,8 +1275,8 @@ def test_webhooks_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - webhook.ListWebhooksRequest, - dict, + webhook.ListWebhooksRequest(), + {}, ], ) def test_list_webhooks(request_type, transport: str = "grpc"): @@ -1271,7 +1287,7 @@ def test_list_webhooks(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_webhooks), "__call__") as call: @@ -1316,10 +1332,11 @@ def test_list_webhooks_non_empty_request_with_auto_populated_field(): client.list_webhooks(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == webhook.ListWebhooksRequest( + request_msg = webhook.ListWebhooksRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_webhooks_use_cached_wrapped_rpc(): @@ -1400,9 +1417,14 @@ async def test_list_webhooks_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_webhooks_async( - transport: str = "grpc_asyncio", request_type=webhook.ListWebhooksRequest -): +@pytest.mark.parametrize( + "request_type", + [ + webhook.ListWebhooksRequest(), + {}, + ], +) +async def test_list_webhooks_async(request_type, transport: str = "grpc_asyncio"): client = WebhooksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1410,7 +1432,7 @@ async def test_list_webhooks_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_webhooks), "__call__") as call: @@ -1433,11 +1455,6 @@ async def test_list_webhooks_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_webhooks_async_from_dict(): - await test_list_webhooks_async(request_type=dict) - - def test_list_webhooks_field_headers(): client = WebhooksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1774,8 +1791,8 @@ async def test_list_webhooks_async_pages(): @pytest.mark.parametrize( "request_type", [ - webhook.GetWebhookRequest, - dict, + webhook.GetWebhookRequest(), + {}, ], ) def test_get_webhook(request_type, transport: str = "grpc"): @@ -1786,7 +1803,7 @@ def test_get_webhook(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_webhook), "__call__") as call: @@ -1834,9 +1851,10 @@ def test_get_webhook_non_empty_request_with_auto_populated_field(): client.get_webhook(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == webhook.GetWebhookRequest( + request_msg = webhook.GetWebhookRequest( name="name_value", ) + assert args[0] == request_msg def test_get_webhook_use_cached_wrapped_rpc(): @@ -1917,9 +1935,14 @@ async def test_get_webhook_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_webhook_async( - transport: str = "grpc_asyncio", request_type=webhook.GetWebhookRequest -): +@pytest.mark.parametrize( + "request_type", + [ + webhook.GetWebhookRequest(), + {}, + ], +) +async def test_get_webhook_async(request_type, transport: str = "grpc_asyncio"): client = WebhooksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1927,7 +1950,7 @@ async def test_get_webhook_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_webhook), "__call__") as call: @@ -1954,11 +1977,6 @@ async def test_get_webhook_async( assert response.disabled is True -@pytest.mark.asyncio -async def test_get_webhook_async_from_dict(): - await test_get_webhook_async(request_type=dict) - - def test_get_webhook_field_headers(): client = WebhooksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2101,8 +2119,8 @@ async def test_get_webhook_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcdc_webhook.CreateWebhookRequest, - dict, + gcdc_webhook.CreateWebhookRequest(), + {}, ], ) def test_create_webhook(request_type, transport: str = "grpc"): @@ -2113,7 +2131,7 @@ def test_create_webhook(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_webhook), "__call__") as call: @@ -2161,9 +2179,10 @@ def test_create_webhook_non_empty_request_with_auto_populated_field(): client.create_webhook(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcdc_webhook.CreateWebhookRequest( + request_msg = gcdc_webhook.CreateWebhookRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_webhook_use_cached_wrapped_rpc(): @@ -2244,9 +2263,14 @@ async def test_create_webhook_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_webhook_async( - transport: str = "grpc_asyncio", request_type=gcdc_webhook.CreateWebhookRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcdc_webhook.CreateWebhookRequest(), + {}, + ], +) +async def test_create_webhook_async(request_type, transport: str = "grpc_asyncio"): client = WebhooksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2254,7 +2278,7 @@ async def test_create_webhook_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_webhook), "__call__") as call: @@ -2281,11 +2305,6 @@ async def test_create_webhook_async( assert response.disabled is True -@pytest.mark.asyncio -async def test_create_webhook_async_from_dict(): - await test_create_webhook_async(request_type=dict) - - def test_create_webhook_field_headers(): client = WebhooksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2442,8 +2461,8 @@ async def test_create_webhook_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcdc_webhook.UpdateWebhookRequest, - dict, + gcdc_webhook.UpdateWebhookRequest(), + {}, ], ) def test_update_webhook(request_type, transport: str = "grpc"): @@ -2454,7 +2473,7 @@ def test_update_webhook(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_webhook), "__call__") as call: @@ -2500,7 +2519,8 @@ def test_update_webhook_non_empty_request_with_auto_populated_field(): client.update_webhook(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcdc_webhook.UpdateWebhookRequest() + request_msg = gcdc_webhook.UpdateWebhookRequest() + assert args[0] == request_msg def test_update_webhook_use_cached_wrapped_rpc(): @@ -2581,9 +2601,14 @@ async def test_update_webhook_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_webhook_async( - transport: str = "grpc_asyncio", request_type=gcdc_webhook.UpdateWebhookRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcdc_webhook.UpdateWebhookRequest(), + {}, + ], +) +async def test_update_webhook_async(request_type, transport: str = "grpc_asyncio"): client = WebhooksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2591,7 +2616,7 @@ async def test_update_webhook_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_webhook), "__call__") as call: @@ -2618,11 +2643,6 @@ async def test_update_webhook_async( assert response.disabled is True -@pytest.mark.asyncio -async def test_update_webhook_async_from_dict(): - await test_update_webhook_async(request_type=dict) - - def test_update_webhook_field_headers(): client = WebhooksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2779,8 +2799,8 @@ async def test_update_webhook_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - webhook.DeleteWebhookRequest, - dict, + webhook.DeleteWebhookRequest(), + {}, ], ) def test_delete_webhook(request_type, transport: str = "grpc"): @@ -2791,7 +2811,7 @@ def test_delete_webhook(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_webhook), "__call__") as call: @@ -2832,9 +2852,10 @@ def test_delete_webhook_non_empty_request_with_auto_populated_field(): client.delete_webhook(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == webhook.DeleteWebhookRequest( + request_msg = webhook.DeleteWebhookRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_webhook_use_cached_wrapped_rpc(): @@ -2915,9 +2936,14 @@ async def test_delete_webhook_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_webhook_async( - transport: str = "grpc_asyncio", request_type=webhook.DeleteWebhookRequest -): +@pytest.mark.parametrize( + "request_type", + [ + webhook.DeleteWebhookRequest(), + {}, + ], +) +async def test_delete_webhook_async(request_type, transport: str = "grpc_asyncio"): client = WebhooksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2925,7 +2951,7 @@ async def test_delete_webhook_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_webhook), "__call__") as call: @@ -2943,11 +2969,6 @@ async def test_delete_webhook_async( assert response is None -@pytest.mark.asyncio -async def test_delete_webhook_async_from_dict(): - await test_delete_webhook_async(request_type=dict) - - def test_delete_webhook_field_headers(): client = WebhooksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4186,7 +4207,6 @@ def test_list_webhooks_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = webhook.ListWebhooksRequest() - assert args[0] == request_msg @@ -4207,7 +4227,6 @@ def test_get_webhook_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = webhook.GetWebhookRequest() - assert args[0] == request_msg @@ -4228,7 +4247,6 @@ def test_create_webhook_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_webhook.CreateWebhookRequest() - assert args[0] == request_msg @@ -4249,7 +4267,6 @@ def test_update_webhook_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_webhook.UpdateWebhookRequest() - assert args[0] == request_msg @@ -4270,7 +4287,6 @@ def test_delete_webhook_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = webhook.DeleteWebhookRequest() - assert args[0] == request_msg @@ -4311,7 +4327,6 @@ async def test_list_webhooks_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = webhook.ListWebhooksRequest() - assert args[0] == request_msg @@ -4340,7 +4355,6 @@ async def test_get_webhook_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = webhook.GetWebhookRequest() - assert args[0] == request_msg @@ -4369,7 +4383,6 @@ async def test_create_webhook_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_webhook.CreateWebhookRequest() - assert args[0] == request_msg @@ -4398,7 +4411,6 @@ async def test_update_webhook_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_webhook.UpdateWebhookRequest() - assert args[0] == request_msg @@ -4421,7 +4433,6 @@ async def test_delete_webhook_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = webhook.DeleteWebhookRequest() - assert args[0] == request_msg @@ -5592,7 +5603,6 @@ def test_list_webhooks_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = webhook.ListWebhooksRequest() - assert args[0] == request_msg @@ -5612,7 +5622,6 @@ def test_get_webhook_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = webhook.GetWebhookRequest() - assert args[0] == request_msg @@ -5632,7 +5641,6 @@ def test_create_webhook_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_webhook.CreateWebhookRequest() - assert args[0] == request_msg @@ -5652,7 +5660,6 @@ def test_update_webhook_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcdc_webhook.UpdateWebhookRequest() - assert args[0] == request_msg @@ -5672,7 +5679,6 @@ def test_delete_webhook_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = webhook.DeleteWebhookRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow/noxfile.py b/packages/google-cloud-dialogflow/noxfile.py index 0d18a99b3042..16dd69716f10 100644 --- a/packages/google-cloud-dialogflow/noxfile.py +++ b/packages/google-cloud-dialogflow/noxfile.py @@ -47,7 +47,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-dialogflow" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-dialogflow/setup.py b/packages/google-cloud-dialogflow/setup.py index 373428077f86..2dc803c41467 100644 --- a/packages/google-cloud-dialogflow/setup.py +++ b/packages/google-cloud-dialogflow/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/google-cloud-dialogflow/testing/constraints-3.10.txt b/packages/google-cloud-dialogflow/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-dialogflow/testing/constraints-3.10.txt +++ b/packages/google-cloud-dialogflow/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-dialogflow/tests/unit/gapic/dialogflow_v2/test_agents.py b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_agents.py index d72fb7f3a634..243b2f1a9ac3 100644 --- a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_agents.py +++ b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_agents.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 @@ -117,6 +118,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" @@ -1252,8 +1268,8 @@ def test_agents_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - agent.GetAgentRequest, - dict, + agent.GetAgentRequest(), + {}, ], ) def test_get_agent(request_type, transport: str = "grpc"): @@ -1264,7 +1280,7 @@ def test_get_agent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_agent), "__call__") as call: @@ -1332,9 +1348,10 @@ def test_get_agent_non_empty_request_with_auto_populated_field(): client.get_agent(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent.GetAgentRequest( + request_msg = agent.GetAgentRequest( parent="parent_value", ) + assert args[0] == request_msg def test_get_agent_use_cached_wrapped_rpc(): @@ -1413,9 +1430,14 @@ async def test_get_agent_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_agent_async( - transport: str = "grpc_asyncio", request_type=agent.GetAgentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent.GetAgentRequest(), + {}, + ], +) +async def test_get_agent_async(request_type, transport: str = "grpc_asyncio"): client = AgentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1423,7 +1445,7 @@ async def test_get_agent_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_agent), "__call__") as call: @@ -1470,11 +1492,6 @@ async def test_get_agent_async( assert response.tier == agent.Agent.Tier.TIER_STANDARD -@pytest.mark.asyncio -async def test_get_agent_async_from_dict(): - await test_get_agent_async(request_type=dict) - - def test_get_agent_field_headers(): client = AgentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1617,8 +1634,8 @@ async def test_get_agent_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcd_agent.SetAgentRequest, - dict, + gcd_agent.SetAgentRequest(), + {}, ], ) def test_set_agent(request_type, transport: str = "grpc"): @@ -1629,7 +1646,7 @@ def test_set_agent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.set_agent), "__call__") as call: @@ -1695,7 +1712,8 @@ def test_set_agent_non_empty_request_with_auto_populated_field(): client.set_agent(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_agent.SetAgentRequest() + request_msg = gcd_agent.SetAgentRequest() + assert args[0] == request_msg def test_set_agent_use_cached_wrapped_rpc(): @@ -1774,9 +1792,14 @@ async def test_set_agent_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_set_agent_async( - transport: str = "grpc_asyncio", request_type=gcd_agent.SetAgentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcd_agent.SetAgentRequest(), + {}, + ], +) +async def test_set_agent_async(request_type, transport: str = "grpc_asyncio"): client = AgentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1784,7 +1807,7 @@ async def test_set_agent_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.set_agent), "__call__") as call: @@ -1831,11 +1854,6 @@ async def test_set_agent_async( assert response.tier == gcd_agent.Agent.Tier.TIER_STANDARD -@pytest.mark.asyncio -async def test_set_agent_async_from_dict(): - await test_set_agent_async(request_type=dict) - - def test_set_agent_field_headers(): client = AgentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1978,8 +1996,8 @@ async def test_set_agent_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent.DeleteAgentRequest, - dict, + agent.DeleteAgentRequest(), + {}, ], ) def test_delete_agent(request_type, transport: str = "grpc"): @@ -1990,7 +2008,7 @@ def test_delete_agent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_agent), "__call__") as call: @@ -2031,9 +2049,10 @@ def test_delete_agent_non_empty_request_with_auto_populated_field(): client.delete_agent(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent.DeleteAgentRequest( + request_msg = agent.DeleteAgentRequest( parent="parent_value", ) + assert args[0] == request_msg def test_delete_agent_use_cached_wrapped_rpc(): @@ -2114,9 +2133,14 @@ async def test_delete_agent_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_agent_async( - transport: str = "grpc_asyncio", request_type=agent.DeleteAgentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent.DeleteAgentRequest(), + {}, + ], +) +async def test_delete_agent_async(request_type, transport: str = "grpc_asyncio"): client = AgentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2124,7 +2148,7 @@ async def test_delete_agent_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_agent), "__call__") as call: @@ -2142,11 +2166,6 @@ async def test_delete_agent_async( assert response is None -@pytest.mark.asyncio -async def test_delete_agent_async_from_dict(): - await test_delete_agent_async(request_type=dict) - - def test_delete_agent_field_headers(): client = AgentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2289,8 +2308,8 @@ async def test_delete_agent_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent.SearchAgentsRequest, - dict, + agent.SearchAgentsRequest(), + {}, ], ) def test_search_agents(request_type, transport: str = "grpc"): @@ -2301,7 +2320,7 @@ def test_search_agents(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.search_agents), "__call__") as call: @@ -2346,10 +2365,11 @@ def test_search_agents_non_empty_request_with_auto_populated_field(): client.search_agents(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent.SearchAgentsRequest( + request_msg = agent.SearchAgentsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_search_agents_use_cached_wrapped_rpc(): @@ -2430,9 +2450,14 @@ async def test_search_agents_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_search_agents_async( - transport: str = "grpc_asyncio", request_type=agent.SearchAgentsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent.SearchAgentsRequest(), + {}, + ], +) +async def test_search_agents_async(request_type, transport: str = "grpc_asyncio"): client = AgentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2440,7 +2465,7 @@ async def test_search_agents_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.search_agents), "__call__") as call: @@ -2463,11 +2488,6 @@ async def test_search_agents_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_search_agents_async_from_dict(): - await test_search_agents_async(request_type=dict) - - def test_search_agents_field_headers(): client = AgentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2804,8 +2824,8 @@ async def test_search_agents_async_pages(): @pytest.mark.parametrize( "request_type", [ - agent.TrainAgentRequest, - dict, + agent.TrainAgentRequest(), + {}, ], ) def test_train_agent(request_type, transport: str = "grpc"): @@ -2816,7 +2836,7 @@ def test_train_agent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.train_agent), "__call__") as call: @@ -2857,9 +2877,10 @@ def test_train_agent_non_empty_request_with_auto_populated_field(): client.train_agent(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent.TrainAgentRequest( + request_msg = agent.TrainAgentRequest( parent="parent_value", ) + assert args[0] == request_msg def test_train_agent_use_cached_wrapped_rpc(): @@ -2950,9 +2971,14 @@ async def test_train_agent_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_train_agent_async( - transport: str = "grpc_asyncio", request_type=agent.TrainAgentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent.TrainAgentRequest(), + {}, + ], +) +async def test_train_agent_async(request_type, transport: str = "grpc_asyncio"): client = AgentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2960,7 +2986,7 @@ async def test_train_agent_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.train_agent), "__call__") as call: @@ -2980,11 +3006,6 @@ async def test_train_agent_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_train_agent_async_from_dict(): - await test_train_agent_async(request_type=dict) - - def test_train_agent_field_headers(): client = AgentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3131,8 +3152,8 @@ async def test_train_agent_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent.ExportAgentRequest, - dict, + agent.ExportAgentRequest(), + {}, ], ) def test_export_agent(request_type, transport: str = "grpc"): @@ -3143,7 +3164,7 @@ def test_export_agent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.export_agent), "__call__") as call: @@ -3185,10 +3206,11 @@ def test_export_agent_non_empty_request_with_auto_populated_field(): client.export_agent(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent.ExportAgentRequest( + request_msg = agent.ExportAgentRequest( parent="parent_value", agent_uri="agent_uri_value", ) + assert args[0] == request_msg def test_export_agent_use_cached_wrapped_rpc(): @@ -3279,9 +3301,14 @@ async def test_export_agent_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_export_agent_async( - transport: str = "grpc_asyncio", request_type=agent.ExportAgentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent.ExportAgentRequest(), + {}, + ], +) +async def test_export_agent_async(request_type, transport: str = "grpc_asyncio"): client = AgentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3289,7 +3316,7 @@ async def test_export_agent_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.export_agent), "__call__") as call: @@ -3309,11 +3336,6 @@ async def test_export_agent_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_export_agent_async_from_dict(): - await test_export_agent_async(request_type=dict) - - def test_export_agent_field_headers(): client = AgentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3460,8 +3482,8 @@ async def test_export_agent_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent.ImportAgentRequest, - dict, + agent.ImportAgentRequest(), + {}, ], ) def test_import_agent(request_type, transport: str = "grpc"): @@ -3472,7 +3494,7 @@ def test_import_agent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.import_agent), "__call__") as call: @@ -3514,10 +3536,11 @@ def test_import_agent_non_empty_request_with_auto_populated_field(): client.import_agent(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent.ImportAgentRequest( + request_msg = agent.ImportAgentRequest( parent="parent_value", agent_uri="agent_uri_value", ) + assert args[0] == request_msg def test_import_agent_use_cached_wrapped_rpc(): @@ -3608,9 +3631,14 @@ async def test_import_agent_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_import_agent_async( - transport: str = "grpc_asyncio", request_type=agent.ImportAgentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent.ImportAgentRequest(), + {}, + ], +) +async def test_import_agent_async(request_type, transport: str = "grpc_asyncio"): client = AgentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3618,7 +3646,7 @@ async def test_import_agent_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.import_agent), "__call__") as call: @@ -3638,11 +3666,6 @@ async def test_import_agent_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_import_agent_async_from_dict(): - await test_import_agent_async(request_type=dict) - - def test_import_agent_field_headers(): client = AgentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3707,8 +3730,8 @@ async def test_import_agent_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - agent.RestoreAgentRequest, - dict, + agent.RestoreAgentRequest(), + {}, ], ) def test_restore_agent(request_type, transport: str = "grpc"): @@ -3719,7 +3742,7 @@ def test_restore_agent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.restore_agent), "__call__") as call: @@ -3761,10 +3784,11 @@ def test_restore_agent_non_empty_request_with_auto_populated_field(): client.restore_agent(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent.RestoreAgentRequest( + request_msg = agent.RestoreAgentRequest( parent="parent_value", agent_uri="agent_uri_value", ) + assert args[0] == request_msg def test_restore_agent_use_cached_wrapped_rpc(): @@ -3855,9 +3879,14 @@ async def test_restore_agent_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_restore_agent_async( - transport: str = "grpc_asyncio", request_type=agent.RestoreAgentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent.RestoreAgentRequest(), + {}, + ], +) +async def test_restore_agent_async(request_type, transport: str = "grpc_asyncio"): client = AgentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3865,7 +3894,7 @@ async def test_restore_agent_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.restore_agent), "__call__") as call: @@ -3885,11 +3914,6 @@ async def test_restore_agent_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_restore_agent_async_from_dict(): - await test_restore_agent_async(request_type=dict) - - def test_restore_agent_field_headers(): client = AgentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3954,8 +3978,8 @@ async def test_restore_agent_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - agent.GetValidationResultRequest, - dict, + agent.GetValidationResultRequest(), + {}, ], ) def test_get_validation_result(request_type, transport: str = "grpc"): @@ -3966,7 +3990,7 @@ def test_get_validation_result(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4012,10 +4036,11 @@ def test_get_validation_result_non_empty_request_with_auto_populated_field(): client.get_validation_result(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent.GetValidationResultRequest( + request_msg = agent.GetValidationResultRequest( parent="parent_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_get_validation_result_use_cached_wrapped_rpc(): @@ -4101,8 +4126,15 @@ async def test_get_validation_result_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + agent.GetValidationResultRequest(), + {}, + ], +) async def test_get_validation_result_async( - transport: str = "grpc_asyncio", request_type=agent.GetValidationResultRequest + request_type, transport: str = "grpc_asyncio" ): client = AgentsAsyncClient( credentials=async_anonymous_credentials(), @@ -4111,7 +4143,7 @@ async def test_get_validation_result_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( @@ -4133,11 +4165,6 @@ async def test_get_validation_result_async( assert isinstance(response, validation_result.ValidationResult) -@pytest.mark.asyncio -async def test_get_validation_result_async_from_dict(): - await test_get_validation_result_async(request_type=dict) - - def test_get_validation_result_field_headers(): client = AgentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5818,7 +5845,6 @@ def test_get_agent_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.GetAgentRequest() - assert args[0] == request_msg @@ -5839,7 +5865,6 @@ def test_set_agent_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_agent.SetAgentRequest() - assert args[0] == request_msg @@ -5860,7 +5885,6 @@ def test_delete_agent_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.DeleteAgentRequest() - assert args[0] == request_msg @@ -5881,7 +5905,6 @@ def test_search_agents_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.SearchAgentsRequest() - assert args[0] == request_msg @@ -5902,7 +5925,6 @@ def test_train_agent_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.TrainAgentRequest() - assert args[0] == request_msg @@ -5923,7 +5945,6 @@ def test_export_agent_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.ExportAgentRequest() - assert args[0] == request_msg @@ -5944,7 +5965,6 @@ def test_import_agent_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.ImportAgentRequest() - assert args[0] == request_msg @@ -5965,7 +5985,6 @@ def test_restore_agent_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.RestoreAgentRequest() - assert args[0] == request_msg @@ -5988,7 +6007,6 @@ def test_get_validation_result_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.GetValidationResultRequest() - assert args[0] == request_msg @@ -6040,7 +6058,6 @@ async def test_get_agent_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.GetAgentRequest() - assert args[0] == request_msg @@ -6078,7 +6095,6 @@ async def test_set_agent_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_agent.SetAgentRequest() - assert args[0] == request_msg @@ -6101,7 +6117,6 @@ async def test_delete_agent_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.DeleteAgentRequest() - assert args[0] == request_msg @@ -6128,7 +6143,6 @@ async def test_search_agents_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.SearchAgentsRequest() - assert args[0] == request_msg @@ -6153,7 +6167,6 @@ async def test_train_agent_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.TrainAgentRequest() - assert args[0] == request_msg @@ -6178,7 +6191,6 @@ async def test_export_agent_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.ExportAgentRequest() - assert args[0] == request_msg @@ -6203,7 +6215,6 @@ async def test_import_agent_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.ImportAgentRequest() - assert args[0] == request_msg @@ -6228,7 +6239,6 @@ async def test_restore_agent_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.RestoreAgentRequest() - assert args[0] == request_msg @@ -6255,7 +6265,6 @@ async def test_get_validation_result_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.GetValidationResultRequest() - assert args[0] == request_msg @@ -7787,7 +7796,6 @@ def test_get_agent_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.GetAgentRequest() - assert args[0] == request_msg @@ -7807,7 +7815,6 @@ def test_set_agent_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_agent.SetAgentRequest() - assert args[0] == request_msg @@ -7827,7 +7834,6 @@ def test_delete_agent_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.DeleteAgentRequest() - assert args[0] == request_msg @@ -7847,7 +7853,6 @@ def test_search_agents_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.SearchAgentsRequest() - assert args[0] == request_msg @@ -7867,7 +7872,6 @@ def test_train_agent_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.TrainAgentRequest() - assert args[0] == request_msg @@ -7887,7 +7891,6 @@ def test_export_agent_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.ExportAgentRequest() - assert args[0] == request_msg @@ -7907,7 +7910,6 @@ def test_import_agent_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.ImportAgentRequest() - assert args[0] == request_msg @@ -7927,7 +7929,6 @@ def test_restore_agent_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.RestoreAgentRequest() - assert args[0] == request_msg @@ -7949,7 +7950,6 @@ def test_get_validation_result_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.GetValidationResultRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_answer_records.py b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_answer_records.py index ff10b75b5cf1..2dc67c97b6be 100644 --- a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_answer_records.py +++ b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_answer_records.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 @@ -122,6 +123,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" @@ -1324,8 +1340,8 @@ def test_answer_records_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - answer_record.ListAnswerRecordsRequest, - dict, + answer_record.ListAnswerRecordsRequest(), + {}, ], ) def test_list_answer_records(request_type, transport: str = "grpc"): @@ -1336,7 +1352,7 @@ def test_list_answer_records(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1386,11 +1402,12 @@ def test_list_answer_records_non_empty_request_with_auto_populated_field(): client.list_answer_records(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == answer_record.ListAnswerRecordsRequest( + request_msg = answer_record.ListAnswerRecordsRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_answer_records_use_cached_wrapped_rpc(): @@ -1475,9 +1492,14 @@ async def test_list_answer_records_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_answer_records_async( - transport: str = "grpc_asyncio", request_type=answer_record.ListAnswerRecordsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + answer_record.ListAnswerRecordsRequest(), + {}, + ], +) +async def test_list_answer_records_async(request_type, transport: str = "grpc_asyncio"): client = AnswerRecordsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1485,7 +1507,7 @@ async def test_list_answer_records_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( @@ -1510,11 +1532,6 @@ async def test_list_answer_records_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_answer_records_async_from_dict(): - await test_list_answer_records_async(request_type=dict) - - def test_list_answer_records_field_headers(): client = AnswerRecordsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1867,8 +1884,8 @@ async def test_list_answer_records_async_pages(): @pytest.mark.parametrize( "request_type", [ - gcd_answer_record.UpdateAnswerRecordRequest, - dict, + gcd_answer_record.UpdateAnswerRecordRequest(), + {}, ], ) def test_update_answer_record(request_type, transport: str = "grpc"): @@ -1879,7 +1896,7 @@ def test_update_answer_record(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1925,7 +1942,8 @@ def test_update_answer_record_non_empty_request_with_auto_populated_field(): client.update_answer_record(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_answer_record.UpdateAnswerRecordRequest() + request_msg = gcd_answer_record.UpdateAnswerRecordRequest() + assert args[0] == request_msg def test_update_answer_record_use_cached_wrapped_rpc(): @@ -2010,9 +2028,15 @@ async def test_update_answer_record_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcd_answer_record.UpdateAnswerRecordRequest(), + {}, + ], +) async def test_update_answer_record_async( - transport: str = "grpc_asyncio", - request_type=gcd_answer_record.UpdateAnswerRecordRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnswerRecordsAsyncClient( credentials=async_anonymous_credentials(), @@ -2021,7 +2045,7 @@ async def test_update_answer_record_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( @@ -2046,11 +2070,6 @@ async def test_update_answer_record_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_update_answer_record_async_from_dict(): - await test_update_answer_record_async(request_type=dict) - - def test_update_answer_record_field_headers(): client = AnswerRecordsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2789,7 +2808,6 @@ def test_list_answer_records_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = answer_record.ListAnswerRecordsRequest() - assert args[0] == request_msg @@ -2812,7 +2830,6 @@ def test_update_answer_record_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_answer_record.UpdateAnswerRecordRequest() - assert args[0] == request_msg @@ -2855,7 +2872,6 @@ async def test_list_answer_records_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = answer_record.ListAnswerRecordsRequest() - assert args[0] == request_msg @@ -2884,7 +2900,6 @@ async def test_update_answer_record_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_answer_record.UpdateAnswerRecordRequest() - assert args[0] == request_msg @@ -3906,7 +3921,6 @@ def test_list_answer_records_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = answer_record.ListAnswerRecordsRequest() - assert args[0] == request_msg @@ -3928,7 +3942,6 @@ def test_update_answer_record_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_answer_record.UpdateAnswerRecordRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_contexts.py b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_contexts.py index c2b72140d9ca..de3115aa9c1b 100644 --- a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_contexts.py +++ b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_contexts.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" @@ -1259,8 +1275,8 @@ def test_contexts_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - context.ListContextsRequest, - dict, + context.ListContextsRequest(), + {}, ], ) def test_list_contexts(request_type, transport: str = "grpc"): @@ -1271,7 +1287,7 @@ def test_list_contexts(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_contexts), "__call__") as call: @@ -1316,10 +1332,11 @@ def test_list_contexts_non_empty_request_with_auto_populated_field(): client.list_contexts(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == context.ListContextsRequest( + request_msg = context.ListContextsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_contexts_use_cached_wrapped_rpc(): @@ -1400,9 +1417,14 @@ async def test_list_contexts_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_contexts_async( - transport: str = "grpc_asyncio", request_type=context.ListContextsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + context.ListContextsRequest(), + {}, + ], +) +async def test_list_contexts_async(request_type, transport: str = "grpc_asyncio"): client = ContextsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1410,7 +1432,7 @@ async def test_list_contexts_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_contexts), "__call__") as call: @@ -1433,11 +1455,6 @@ async def test_list_contexts_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_contexts_async_from_dict(): - await test_list_contexts_async(request_type=dict) - - def test_list_contexts_field_headers(): client = ContextsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1774,8 +1791,8 @@ async def test_list_contexts_async_pages(): @pytest.mark.parametrize( "request_type", [ - context.GetContextRequest, - dict, + context.GetContextRequest(), + {}, ], ) def test_get_context(request_type, transport: str = "grpc"): @@ -1786,7 +1803,7 @@ def test_get_context(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_context), "__call__") as call: @@ -1832,9 +1849,10 @@ def test_get_context_non_empty_request_with_auto_populated_field(): client.get_context(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == context.GetContextRequest( + request_msg = context.GetContextRequest( name="name_value", ) + assert args[0] == request_msg def test_get_context_use_cached_wrapped_rpc(): @@ -1915,9 +1933,14 @@ async def test_get_context_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_context_async( - transport: str = "grpc_asyncio", request_type=context.GetContextRequest -): +@pytest.mark.parametrize( + "request_type", + [ + context.GetContextRequest(), + {}, + ], +) +async def test_get_context_async(request_type, transport: str = "grpc_asyncio"): client = ContextsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1925,7 +1948,7 @@ async def test_get_context_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_context), "__call__") as call: @@ -1950,11 +1973,6 @@ async def test_get_context_async( assert response.lifespan_count == 1498 -@pytest.mark.asyncio -async def test_get_context_async_from_dict(): - await test_get_context_async(request_type=dict) - - def test_get_context_field_headers(): client = ContextsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2097,8 +2115,8 @@ async def test_get_context_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcd_context.CreateContextRequest, - dict, + gcd_context.CreateContextRequest(), + {}, ], ) def test_create_context(request_type, transport: str = "grpc"): @@ -2109,7 +2127,7 @@ def test_create_context(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_context), "__call__") as call: @@ -2155,9 +2173,10 @@ def test_create_context_non_empty_request_with_auto_populated_field(): client.create_context(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_context.CreateContextRequest( + request_msg = gcd_context.CreateContextRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_context_use_cached_wrapped_rpc(): @@ -2238,9 +2257,14 @@ async def test_create_context_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_context_async( - transport: str = "grpc_asyncio", request_type=gcd_context.CreateContextRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcd_context.CreateContextRequest(), + {}, + ], +) +async def test_create_context_async(request_type, transport: str = "grpc_asyncio"): client = ContextsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2248,7 +2272,7 @@ async def test_create_context_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_context), "__call__") as call: @@ -2273,11 +2297,6 @@ async def test_create_context_async( assert response.lifespan_count == 1498 -@pytest.mark.asyncio -async def test_create_context_async_from_dict(): - await test_create_context_async(request_type=dict) - - def test_create_context_field_headers(): client = ContextsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2430,8 +2449,8 @@ async def test_create_context_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcd_context.UpdateContextRequest, - dict, + gcd_context.UpdateContextRequest(), + {}, ], ) def test_update_context(request_type, transport: str = "grpc"): @@ -2442,7 +2461,7 @@ def test_update_context(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_context), "__call__") as call: @@ -2486,7 +2505,8 @@ def test_update_context_non_empty_request_with_auto_populated_field(): client.update_context(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_context.UpdateContextRequest() + request_msg = gcd_context.UpdateContextRequest() + assert args[0] == request_msg def test_update_context_use_cached_wrapped_rpc(): @@ -2567,9 +2587,14 @@ async def test_update_context_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_context_async( - transport: str = "grpc_asyncio", request_type=gcd_context.UpdateContextRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcd_context.UpdateContextRequest(), + {}, + ], +) +async def test_update_context_async(request_type, transport: str = "grpc_asyncio"): client = ContextsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2577,7 +2602,7 @@ async def test_update_context_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_context), "__call__") as call: @@ -2602,11 +2627,6 @@ async def test_update_context_async( assert response.lifespan_count == 1498 -@pytest.mark.asyncio -async def test_update_context_async_from_dict(): - await test_update_context_async(request_type=dict) - - def test_update_context_field_headers(): client = ContextsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2759,8 +2779,8 @@ async def test_update_context_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - context.DeleteContextRequest, - dict, + context.DeleteContextRequest(), + {}, ], ) def test_delete_context(request_type, transport: str = "grpc"): @@ -2771,7 +2791,7 @@ def test_delete_context(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_context), "__call__") as call: @@ -2812,9 +2832,10 @@ def test_delete_context_non_empty_request_with_auto_populated_field(): client.delete_context(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == context.DeleteContextRequest( + request_msg = context.DeleteContextRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_context_use_cached_wrapped_rpc(): @@ -2895,9 +2916,14 @@ async def test_delete_context_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_context_async( - transport: str = "grpc_asyncio", request_type=context.DeleteContextRequest -): +@pytest.mark.parametrize( + "request_type", + [ + context.DeleteContextRequest(), + {}, + ], +) +async def test_delete_context_async(request_type, transport: str = "grpc_asyncio"): client = ContextsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2905,7 +2931,7 @@ async def test_delete_context_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_context), "__call__") as call: @@ -2923,11 +2949,6 @@ async def test_delete_context_async( assert response is None -@pytest.mark.asyncio -async def test_delete_context_async_from_dict(): - await test_delete_context_async(request_type=dict) - - def test_delete_context_field_headers(): client = ContextsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3070,8 +3091,8 @@ async def test_delete_context_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - context.DeleteAllContextsRequest, - dict, + context.DeleteAllContextsRequest(), + {}, ], ) def test_delete_all_contexts(request_type, transport: str = "grpc"): @@ -3082,7 +3103,7 @@ def test_delete_all_contexts(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3127,9 +3148,10 @@ def test_delete_all_contexts_non_empty_request_with_auto_populated_field(): client.delete_all_contexts(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == context.DeleteAllContextsRequest( + request_msg = context.DeleteAllContextsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_delete_all_contexts_use_cached_wrapped_rpc(): @@ -3214,9 +3236,14 @@ async def test_delete_all_contexts_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_all_contexts_async( - transport: str = "grpc_asyncio", request_type=context.DeleteAllContextsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + context.DeleteAllContextsRequest(), + {}, + ], +) +async def test_delete_all_contexts_async(request_type, transport: str = "grpc_asyncio"): client = ContextsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3224,7 +3251,7 @@ async def test_delete_all_contexts_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( @@ -3244,11 +3271,6 @@ async def test_delete_all_contexts_async( assert response is None -@pytest.mark.asyncio -async def test_delete_all_contexts_async_from_dict(): - await test_delete_all_contexts_async(request_type=dict) - - def test_delete_all_contexts_field_headers(): client = ContextsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4670,7 +4692,6 @@ def test_list_contexts_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = context.ListContextsRequest() - assert args[0] == request_msg @@ -4691,7 +4712,6 @@ def test_get_context_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = context.GetContextRequest() - assert args[0] == request_msg @@ -4712,7 +4732,6 @@ def test_create_context_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_context.CreateContextRequest() - assert args[0] == request_msg @@ -4733,7 +4752,6 @@ def test_update_context_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_context.UpdateContextRequest() - assert args[0] == request_msg @@ -4754,7 +4772,6 @@ def test_delete_context_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = context.DeleteContextRequest() - assert args[0] == request_msg @@ -4777,7 +4794,6 @@ def test_delete_all_contexts_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = context.DeleteAllContextsRequest() - assert args[0] == request_msg @@ -4818,7 +4834,6 @@ async def test_list_contexts_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = context.ListContextsRequest() - assert args[0] == request_msg @@ -4846,7 +4861,6 @@ async def test_get_context_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = context.GetContextRequest() - assert args[0] == request_msg @@ -4874,7 +4888,6 @@ async def test_create_context_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_context.CreateContextRequest() - assert args[0] == request_msg @@ -4902,7 +4915,6 @@ async def test_update_context_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_context.UpdateContextRequest() - assert args[0] == request_msg @@ -4925,7 +4937,6 @@ async def test_delete_context_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = context.DeleteContextRequest() - assert args[0] == request_msg @@ -4950,7 +4961,6 @@ async def test_delete_all_contexts_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = context.DeleteAllContextsRequest() - assert args[0] == request_msg @@ -6159,7 +6169,6 @@ def test_list_contexts_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = context.ListContextsRequest() - assert args[0] == request_msg @@ -6179,7 +6188,6 @@ def test_get_context_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = context.GetContextRequest() - assert args[0] == request_msg @@ -6199,7 +6207,6 @@ def test_create_context_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_context.CreateContextRequest() - assert args[0] == request_msg @@ -6219,7 +6226,6 @@ def test_update_context_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_context.UpdateContextRequest() - assert args[0] == request_msg @@ -6239,7 +6245,6 @@ def test_delete_context_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = context.DeleteContextRequest() - assert args[0] == request_msg @@ -6261,7 +6266,6 @@ def test_delete_all_contexts_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = context.DeleteAllContextsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_conversation_datasets.py b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_conversation_datasets.py index 32fbcf0f376a..540991ab15b8 100644 --- a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_conversation_datasets.py +++ b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_conversation_datasets.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 @@ -118,6 +119,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" @@ -1384,8 +1400,8 @@ def test_conversation_datasets_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - gcd_conversation_dataset.CreateConversationDatasetRequest, - dict, + gcd_conversation_dataset.CreateConversationDatasetRequest(), + {}, ], ) def test_create_conversation_dataset(request_type, transport: str = "grpc"): @@ -1396,7 +1412,7 @@ def test_create_conversation_dataset(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1441,9 +1457,10 @@ def test_create_conversation_dataset_non_empty_request_with_auto_populated_field client.create_conversation_dataset(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_conversation_dataset.CreateConversationDatasetRequest( + request_msg = gcd_conversation_dataset.CreateConversationDatasetRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_conversation_dataset_use_cached_wrapped_rpc(): @@ -1539,9 +1556,15 @@ async def test_create_conversation_dataset_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcd_conversation_dataset.CreateConversationDatasetRequest(), + {}, + ], +) async def test_create_conversation_dataset_async( - transport: str = "grpc_asyncio", - request_type=gcd_conversation_dataset.CreateConversationDatasetRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConversationDatasetsAsyncClient( credentials=async_anonymous_credentials(), @@ -1550,7 +1573,7 @@ async def test_create_conversation_dataset_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( @@ -1572,11 +1595,6 @@ async def test_create_conversation_dataset_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_conversation_dataset_async_from_dict(): - await test_create_conversation_dataset_async(request_type=dict) - - def test_create_conversation_dataset_field_headers(): client = ConversationDatasetsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1749,8 +1767,8 @@ async def test_create_conversation_dataset_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversation_dataset.GetConversationDatasetRequest, - dict, + conversation_dataset.GetConversationDatasetRequest(), + {}, ], ) def test_get_conversation_dataset(request_type, transport: str = "grpc"): @@ -1761,7 +1779,7 @@ def test_get_conversation_dataset(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1819,9 +1837,10 @@ def test_get_conversation_dataset_non_empty_request_with_auto_populated_field(): client.get_conversation_dataset(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversation_dataset.GetConversationDatasetRequest( + request_msg = conversation_dataset.GetConversationDatasetRequest( name="name_value", ) + assert args[0] == request_msg def test_get_conversation_dataset_use_cached_wrapped_rpc(): @@ -1907,9 +1926,15 @@ async def test_get_conversation_dataset_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + conversation_dataset.GetConversationDatasetRequest(), + {}, + ], +) async def test_get_conversation_dataset_async( - transport: str = "grpc_asyncio", - request_type=conversation_dataset.GetConversationDatasetRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConversationDatasetsAsyncClient( credentials=async_anonymous_credentials(), @@ -1918,7 +1943,7 @@ async def test_get_conversation_dataset_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( @@ -1953,11 +1978,6 @@ async def test_get_conversation_dataset_async( assert response.satisfies_pzs is True -@pytest.mark.asyncio -async def test_get_conversation_dataset_async_from_dict(): - await test_get_conversation_dataset_async(request_type=dict) - - def test_get_conversation_dataset_field_headers(): client = ConversationDatasetsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2112,8 +2132,8 @@ async def test_get_conversation_dataset_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversation_dataset.ListConversationDatasetsRequest, - dict, + conversation_dataset.ListConversationDatasetsRequest(), + {}, ], ) def test_list_conversation_datasets(request_type, transport: str = "grpc"): @@ -2124,7 +2144,7 @@ def test_list_conversation_datasets(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2173,10 +2193,11 @@ def test_list_conversation_datasets_non_empty_request_with_auto_populated_field( client.list_conversation_datasets(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversation_dataset.ListConversationDatasetsRequest( + request_msg = conversation_dataset.ListConversationDatasetsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_conversation_datasets_use_cached_wrapped_rpc(): @@ -2262,9 +2283,15 @@ async def test_list_conversation_datasets_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + conversation_dataset.ListConversationDatasetsRequest(), + {}, + ], +) async def test_list_conversation_datasets_async( - transport: str = "grpc_asyncio", - request_type=conversation_dataset.ListConversationDatasetsRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConversationDatasetsAsyncClient( credentials=async_anonymous_credentials(), @@ -2273,7 +2300,7 @@ async def test_list_conversation_datasets_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( @@ -2298,11 +2325,6 @@ async def test_list_conversation_datasets_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_conversation_datasets_async_from_dict(): - await test_list_conversation_datasets_async(request_type=dict) - - def test_list_conversation_datasets_field_headers(): client = ConversationDatasetsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2661,8 +2683,8 @@ async def test_list_conversation_datasets_async_pages(): @pytest.mark.parametrize( "request_type", [ - conversation_dataset.DeleteConversationDatasetRequest, - dict, + conversation_dataset.DeleteConversationDatasetRequest(), + {}, ], ) def test_delete_conversation_dataset(request_type, transport: str = "grpc"): @@ -2673,7 +2695,7 @@ def test_delete_conversation_dataset(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2718,9 +2740,10 @@ def test_delete_conversation_dataset_non_empty_request_with_auto_populated_field client.delete_conversation_dataset(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversation_dataset.DeleteConversationDatasetRequest( + request_msg = conversation_dataset.DeleteConversationDatasetRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_conversation_dataset_use_cached_wrapped_rpc(): @@ -2816,9 +2839,15 @@ async def test_delete_conversation_dataset_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + conversation_dataset.DeleteConversationDatasetRequest(), + {}, + ], +) async def test_delete_conversation_dataset_async( - transport: str = "grpc_asyncio", - request_type=conversation_dataset.DeleteConversationDatasetRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConversationDatasetsAsyncClient( credentials=async_anonymous_credentials(), @@ -2827,7 +2856,7 @@ async def test_delete_conversation_dataset_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( @@ -2849,11 +2878,6 @@ async def test_delete_conversation_dataset_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_conversation_dataset_async_from_dict(): - await test_delete_conversation_dataset_async(request_type=dict) - - def test_delete_conversation_dataset_field_headers(): client = ConversationDatasetsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3008,8 +3032,8 @@ async def test_delete_conversation_dataset_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversation_dataset.ImportConversationDataRequest, - dict, + conversation_dataset.ImportConversationDataRequest(), + {}, ], ) def test_import_conversation_data(request_type, transport: str = "grpc"): @@ -3020,7 +3044,7 @@ def test_import_conversation_data(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3065,9 +3089,10 @@ def test_import_conversation_data_non_empty_request_with_auto_populated_field(): client.import_conversation_data(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversation_dataset.ImportConversationDataRequest( + request_msg = conversation_dataset.ImportConversationDataRequest( name="name_value", ) + assert args[0] == request_msg def test_import_conversation_data_use_cached_wrapped_rpc(): @@ -3163,9 +3188,15 @@ async def test_import_conversation_data_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + conversation_dataset.ImportConversationDataRequest(), + {}, + ], +) async def test_import_conversation_data_async( - transport: str = "grpc_asyncio", - request_type=conversation_dataset.ImportConversationDataRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConversationDatasetsAsyncClient( credentials=async_anonymous_credentials(), @@ -3174,7 +3205,7 @@ async def test_import_conversation_data_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( @@ -3196,11 +3227,6 @@ async def test_import_conversation_data_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_import_conversation_data_async_from_dict(): - await test_import_conversation_data_async(request_type=dict) - - def test_import_conversation_data_field_headers(): client = ConversationDatasetsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4356,7 +4382,6 @@ def test_create_conversation_dataset_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_conversation_dataset.CreateConversationDatasetRequest() - assert args[0] == request_msg @@ -4379,7 +4404,6 @@ def test_get_conversation_dataset_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation_dataset.GetConversationDatasetRequest() - assert args[0] == request_msg @@ -4402,7 +4426,6 @@ def test_list_conversation_datasets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation_dataset.ListConversationDatasetsRequest() - assert args[0] == request_msg @@ -4425,7 +4448,6 @@ def test_delete_conversation_dataset_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation_dataset.DeleteConversationDatasetRequest() - assert args[0] == request_msg @@ -4448,7 +4470,6 @@ def test_import_conversation_data_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation_dataset.ImportConversationDataRequest() - assert args[0] == request_msg @@ -4489,7 +4510,6 @@ async def test_create_conversation_dataset_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_conversation_dataset.CreateConversationDatasetRequest() - assert args[0] == request_msg @@ -4523,7 +4543,6 @@ async def test_get_conversation_dataset_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation_dataset.GetConversationDatasetRequest() - assert args[0] == request_msg @@ -4552,7 +4571,6 @@ async def test_list_conversation_datasets_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation_dataset.ListConversationDatasetsRequest() - assert args[0] == request_msg @@ -4579,7 +4597,6 @@ async def test_delete_conversation_dataset_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation_dataset.DeleteConversationDatasetRequest() - assert args[0] == request_msg @@ -4606,7 +4623,6 @@ async def test_import_conversation_data_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation_dataset.ImportConversationDataRequest() - assert args[0] == request_msg @@ -5709,7 +5725,6 @@ def test_create_conversation_dataset_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_conversation_dataset.CreateConversationDatasetRequest() - assert args[0] == request_msg @@ -5731,7 +5746,6 @@ def test_get_conversation_dataset_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation_dataset.GetConversationDatasetRequest() - assert args[0] == request_msg @@ -5753,7 +5767,6 @@ def test_list_conversation_datasets_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation_dataset.ListConversationDatasetsRequest() - assert args[0] == request_msg @@ -5775,7 +5788,6 @@ def test_delete_conversation_dataset_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation_dataset.DeleteConversationDatasetRequest() - assert args[0] == request_msg @@ -5797,7 +5809,6 @@ def test_import_conversation_data_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation_dataset.ImportConversationDataRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_conversation_models.py b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_conversation_models.py index ac9cd12e89a8..50ba64bb7bdd 100644 --- a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_conversation_models.py +++ b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_conversation_models.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 @@ -118,6 +119,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" @@ -1366,8 +1382,8 @@ def test_conversation_models_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - gcd_conversation_model.CreateConversationModelRequest, - dict, + gcd_conversation_model.CreateConversationModelRequest(), + {}, ], ) def test_create_conversation_model(request_type, transport: str = "grpc"): @@ -1378,7 +1394,7 @@ def test_create_conversation_model(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1423,9 +1439,10 @@ def test_create_conversation_model_non_empty_request_with_auto_populated_field() client.create_conversation_model(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_conversation_model.CreateConversationModelRequest( + request_msg = gcd_conversation_model.CreateConversationModelRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_conversation_model_use_cached_wrapped_rpc(): @@ -1521,9 +1538,15 @@ async def test_create_conversation_model_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcd_conversation_model.CreateConversationModelRequest(), + {}, + ], +) async def test_create_conversation_model_async( - transport: str = "grpc_asyncio", - request_type=gcd_conversation_model.CreateConversationModelRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConversationModelsAsyncClient( credentials=async_anonymous_credentials(), @@ -1532,7 +1555,7 @@ async def test_create_conversation_model_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( @@ -1554,11 +1577,6 @@ async def test_create_conversation_model_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_conversation_model_async_from_dict(): - await test_create_conversation_model_async(request_type=dict) - - def test_create_conversation_model_field_headers(): client = ConversationModelsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1731,8 +1749,8 @@ async def test_create_conversation_model_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversation_model.GetConversationModelRequest, - dict, + conversation_model.GetConversationModelRequest(), + {}, ], ) def test_get_conversation_model(request_type, transport: str = "grpc"): @@ -1743,7 +1761,7 @@ def test_get_conversation_model(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1801,9 +1819,10 @@ def test_get_conversation_model_non_empty_request_with_auto_populated_field(): client.get_conversation_model(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversation_model.GetConversationModelRequest( + request_msg = conversation_model.GetConversationModelRequest( name="name_value", ) + assert args[0] == request_msg def test_get_conversation_model_use_cached_wrapped_rpc(): @@ -1889,9 +1908,15 @@ async def test_get_conversation_model_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + conversation_model.GetConversationModelRequest(), + {}, + ], +) async def test_get_conversation_model_async( - transport: str = "grpc_asyncio", - request_type=conversation_model.GetConversationModelRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConversationModelsAsyncClient( credentials=async_anonymous_credentials(), @@ -1900,7 +1925,7 @@ async def test_get_conversation_model_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( @@ -1935,11 +1960,6 @@ async def test_get_conversation_model_async( assert response.satisfies_pzi is True -@pytest.mark.asyncio -async def test_get_conversation_model_async_from_dict(): - await test_get_conversation_model_async(request_type=dict) - - def test_get_conversation_model_field_headers(): client = ConversationModelsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2094,8 +2114,8 @@ async def test_get_conversation_model_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversation_model.ListConversationModelsRequest, - dict, + conversation_model.ListConversationModelsRequest(), + {}, ], ) def test_list_conversation_models(request_type, transport: str = "grpc"): @@ -2106,7 +2126,7 @@ def test_list_conversation_models(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2155,10 +2175,11 @@ def test_list_conversation_models_non_empty_request_with_auto_populated_field(): client.list_conversation_models(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversation_model.ListConversationModelsRequest( + request_msg = conversation_model.ListConversationModelsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_conversation_models_use_cached_wrapped_rpc(): @@ -2244,9 +2265,15 @@ async def test_list_conversation_models_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + conversation_model.ListConversationModelsRequest(), + {}, + ], +) async def test_list_conversation_models_async( - transport: str = "grpc_asyncio", - request_type=conversation_model.ListConversationModelsRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConversationModelsAsyncClient( credentials=async_anonymous_credentials(), @@ -2255,7 +2282,7 @@ async def test_list_conversation_models_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( @@ -2280,11 +2307,6 @@ async def test_list_conversation_models_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_conversation_models_async_from_dict(): - await test_list_conversation_models_async(request_type=dict) - - def test_list_conversation_models_field_headers(): client = ConversationModelsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2641,8 +2663,8 @@ async def test_list_conversation_models_async_pages(): @pytest.mark.parametrize( "request_type", [ - conversation_model.DeleteConversationModelRequest, - dict, + conversation_model.DeleteConversationModelRequest(), + {}, ], ) def test_delete_conversation_model(request_type, transport: str = "grpc"): @@ -2653,7 +2675,7 @@ def test_delete_conversation_model(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2698,9 +2720,10 @@ def test_delete_conversation_model_non_empty_request_with_auto_populated_field() client.delete_conversation_model(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversation_model.DeleteConversationModelRequest( + request_msg = conversation_model.DeleteConversationModelRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_conversation_model_use_cached_wrapped_rpc(): @@ -2796,9 +2819,15 @@ async def test_delete_conversation_model_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + conversation_model.DeleteConversationModelRequest(), + {}, + ], +) async def test_delete_conversation_model_async( - transport: str = "grpc_asyncio", - request_type=conversation_model.DeleteConversationModelRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConversationModelsAsyncClient( credentials=async_anonymous_credentials(), @@ -2807,7 +2836,7 @@ async def test_delete_conversation_model_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( @@ -2829,11 +2858,6 @@ async def test_delete_conversation_model_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_conversation_model_async_from_dict(): - await test_delete_conversation_model_async(request_type=dict) - - def test_delete_conversation_model_field_headers(): client = ConversationModelsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2988,8 +3012,8 @@ async def test_delete_conversation_model_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversation_model.DeployConversationModelRequest, - dict, + conversation_model.DeployConversationModelRequest(), + {}, ], ) def test_deploy_conversation_model(request_type, transport: str = "grpc"): @@ -3000,7 +3024,7 @@ def test_deploy_conversation_model(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3045,9 +3069,10 @@ def test_deploy_conversation_model_non_empty_request_with_auto_populated_field() client.deploy_conversation_model(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversation_model.DeployConversationModelRequest( + request_msg = conversation_model.DeployConversationModelRequest( name="name_value", ) + assert args[0] == request_msg def test_deploy_conversation_model_use_cached_wrapped_rpc(): @@ -3143,9 +3168,15 @@ async def test_deploy_conversation_model_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + conversation_model.DeployConversationModelRequest(), + {}, + ], +) async def test_deploy_conversation_model_async( - transport: str = "grpc_asyncio", - request_type=conversation_model.DeployConversationModelRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConversationModelsAsyncClient( credentials=async_anonymous_credentials(), @@ -3154,7 +3185,7 @@ async def test_deploy_conversation_model_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( @@ -3176,11 +3207,6 @@ async def test_deploy_conversation_model_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_deploy_conversation_model_async_from_dict(): - await test_deploy_conversation_model_async(request_type=dict) - - def test_deploy_conversation_model_field_headers(): client = ConversationModelsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3249,8 +3275,8 @@ async def test_deploy_conversation_model_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - conversation_model.UndeployConversationModelRequest, - dict, + conversation_model.UndeployConversationModelRequest(), + {}, ], ) def test_undeploy_conversation_model(request_type, transport: str = "grpc"): @@ -3261,7 +3287,7 @@ def test_undeploy_conversation_model(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3306,9 +3332,10 @@ def test_undeploy_conversation_model_non_empty_request_with_auto_populated_field client.undeploy_conversation_model(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversation_model.UndeployConversationModelRequest( + request_msg = conversation_model.UndeployConversationModelRequest( name="name_value", ) + assert args[0] == request_msg def test_undeploy_conversation_model_use_cached_wrapped_rpc(): @@ -3404,9 +3431,15 @@ async def test_undeploy_conversation_model_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + conversation_model.UndeployConversationModelRequest(), + {}, + ], +) async def test_undeploy_conversation_model_async( - transport: str = "grpc_asyncio", - request_type=conversation_model.UndeployConversationModelRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConversationModelsAsyncClient( credentials=async_anonymous_credentials(), @@ -3415,7 +3448,7 @@ async def test_undeploy_conversation_model_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( @@ -3437,11 +3470,6 @@ async def test_undeploy_conversation_model_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_undeploy_conversation_model_async_from_dict(): - await test_undeploy_conversation_model_async(request_type=dict) - - def test_undeploy_conversation_model_field_headers(): client = ConversationModelsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3510,8 +3538,8 @@ async def test_undeploy_conversation_model_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - conversation_model.GetConversationModelEvaluationRequest, - dict, + conversation_model.GetConversationModelEvaluationRequest(), + {}, ], ) def test_get_conversation_model_evaluation(request_type, transport: str = "grpc"): @@ -3522,7 +3550,7 @@ def test_get_conversation_model_evaluation(request_type, transport: str = "grpc" # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3574,9 +3602,10 @@ def test_get_conversation_model_evaluation_non_empty_request_with_auto_populated client.get_conversation_model_evaluation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversation_model.GetConversationModelEvaluationRequest( + request_msg = conversation_model.GetConversationModelEvaluationRequest( name="name_value", ) + assert args[0] == request_msg def test_get_conversation_model_evaluation_use_cached_wrapped_rpc(): @@ -3662,9 +3691,15 @@ async def test_get_conversation_model_evaluation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + conversation_model.GetConversationModelEvaluationRequest(), + {}, + ], +) async def test_get_conversation_model_evaluation_async( - transport: str = "grpc_asyncio", - request_type=conversation_model.GetConversationModelEvaluationRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConversationModelsAsyncClient( credentials=async_anonymous_credentials(), @@ -3673,7 +3708,7 @@ async def test_get_conversation_model_evaluation_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( @@ -3702,11 +3737,6 @@ async def test_get_conversation_model_evaluation_async( assert response.raw_human_eval_template_csv == "raw_human_eval_template_csv_value" -@pytest.mark.asyncio -async def test_get_conversation_model_evaluation_async_from_dict(): - await test_get_conversation_model_evaluation_async(request_type=dict) - - def test_get_conversation_model_evaluation_field_headers(): client = ConversationModelsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3861,8 +3891,8 @@ async def test_get_conversation_model_evaluation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversation_model.ListConversationModelEvaluationsRequest, - dict, + conversation_model.ListConversationModelEvaluationsRequest(), + {}, ], ) def test_list_conversation_model_evaluations(request_type, transport: str = "grpc"): @@ -3873,7 +3903,7 @@ def test_list_conversation_model_evaluations(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( @@ -3922,10 +3952,11 @@ def test_list_conversation_model_evaluations_non_empty_request_with_auto_populat client.list_conversation_model_evaluations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversation_model.ListConversationModelEvaluationsRequest( + request_msg = conversation_model.ListConversationModelEvaluationsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_conversation_model_evaluations_use_cached_wrapped_rpc(): @@ -4011,9 +4042,15 @@ async def test_list_conversation_model_evaluations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + conversation_model.ListConversationModelEvaluationsRequest(), + {}, + ], +) async def test_list_conversation_model_evaluations_async( - transport: str = "grpc_asyncio", - request_type=conversation_model.ListConversationModelEvaluationsRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConversationModelsAsyncClient( credentials=async_anonymous_credentials(), @@ -4022,7 +4059,7 @@ async def test_list_conversation_model_evaluations_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( @@ -4047,11 +4084,6 @@ async def test_list_conversation_model_evaluations_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_conversation_model_evaluations_async_from_dict(): - await test_list_conversation_model_evaluations_async(request_type=dict) - - def test_list_conversation_model_evaluations_field_headers(): client = ConversationModelsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4420,8 +4452,8 @@ async def test_list_conversation_model_evaluations_async_pages(): @pytest.mark.parametrize( "request_type", [ - conversation_model.CreateConversationModelEvaluationRequest, - dict, + conversation_model.CreateConversationModelEvaluationRequest(), + {}, ], ) def test_create_conversation_model_evaluation(request_type, transport: str = "grpc"): @@ -4432,7 +4464,7 @@ def test_create_conversation_model_evaluation(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( @@ -4477,9 +4509,10 @@ def test_create_conversation_model_evaluation_non_empty_request_with_auto_popula client.create_conversation_model_evaluation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversation_model.CreateConversationModelEvaluationRequest( + request_msg = conversation_model.CreateConversationModelEvaluationRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_conversation_model_evaluation_use_cached_wrapped_rpc(): @@ -4575,9 +4608,15 @@ async def test_create_conversation_model_evaluation_async_use_cached_wrapped_rpc @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + conversation_model.CreateConversationModelEvaluationRequest(), + {}, + ], +) async def test_create_conversation_model_evaluation_async( - transport: str = "grpc_asyncio", - request_type=conversation_model.CreateConversationModelEvaluationRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConversationModelsAsyncClient( credentials=async_anonymous_credentials(), @@ -4586,7 +4625,7 @@ async def test_create_conversation_model_evaluation_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( @@ -4608,11 +4647,6 @@ async def test_create_conversation_model_evaluation_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_conversation_model_evaluation_async_from_dict(): - await test_create_conversation_model_evaluation_async(request_type=dict) - - def test_create_conversation_model_evaluation_field_headers(): client = ConversationModelsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6643,7 +6677,6 @@ def test_create_conversation_model_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_conversation_model.CreateConversationModelRequest() - assert args[0] == request_msg @@ -6666,7 +6699,6 @@ def test_get_conversation_model_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation_model.GetConversationModelRequest() - assert args[0] == request_msg @@ -6689,7 +6721,6 @@ def test_list_conversation_models_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation_model.ListConversationModelsRequest() - assert args[0] == request_msg @@ -6712,7 +6743,6 @@ def test_delete_conversation_model_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation_model.DeleteConversationModelRequest() - assert args[0] == request_msg @@ -6735,7 +6765,6 @@ def test_deploy_conversation_model_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation_model.DeployConversationModelRequest() - assert args[0] == request_msg @@ -6758,7 +6787,6 @@ def test_undeploy_conversation_model_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation_model.UndeployConversationModelRequest() - assert args[0] == request_msg @@ -6781,7 +6809,6 @@ def test_get_conversation_model_evaluation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation_model.GetConversationModelEvaluationRequest() - assert args[0] == request_msg @@ -6806,7 +6833,6 @@ def test_list_conversation_model_evaluations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation_model.ListConversationModelEvaluationsRequest() - assert args[0] == request_msg @@ -6829,7 +6855,6 @@ def test_create_conversation_model_evaluation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation_model.CreateConversationModelEvaluationRequest() - assert args[0] == request_msg @@ -6870,7 +6895,6 @@ async def test_create_conversation_model_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_conversation_model.CreateConversationModelRequest() - assert args[0] == request_msg @@ -6904,7 +6928,6 @@ async def test_get_conversation_model_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation_model.GetConversationModelRequest() - assert args[0] == request_msg @@ -6933,7 +6956,6 @@ async def test_list_conversation_models_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation_model.ListConversationModelsRequest() - assert args[0] == request_msg @@ -6960,7 +6982,6 @@ async def test_delete_conversation_model_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation_model.DeleteConversationModelRequest() - assert args[0] == request_msg @@ -6987,7 +7008,6 @@ async def test_deploy_conversation_model_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation_model.DeployConversationModelRequest() - assert args[0] == request_msg @@ -7014,7 +7034,6 @@ async def test_undeploy_conversation_model_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation_model.UndeployConversationModelRequest() - assert args[0] == request_msg @@ -7045,7 +7064,6 @@ async def test_get_conversation_model_evaluation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation_model.GetConversationModelEvaluationRequest() - assert args[0] == request_msg @@ -7074,7 +7092,6 @@ async def test_list_conversation_model_evaluations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation_model.ListConversationModelEvaluationsRequest() - assert args[0] == request_msg @@ -7101,7 +7118,6 @@ async def test_create_conversation_model_evaluation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation_model.CreateConversationModelEvaluationRequest() - assert args[0] == request_msg @@ -8746,7 +8762,6 @@ def test_create_conversation_model_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_conversation_model.CreateConversationModelRequest() - assert args[0] == request_msg @@ -8768,7 +8783,6 @@ def test_get_conversation_model_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation_model.GetConversationModelRequest() - assert args[0] == request_msg @@ -8790,7 +8804,6 @@ def test_list_conversation_models_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation_model.ListConversationModelsRequest() - assert args[0] == request_msg @@ -8812,7 +8825,6 @@ def test_delete_conversation_model_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation_model.DeleteConversationModelRequest() - assert args[0] == request_msg @@ -8834,7 +8846,6 @@ def test_deploy_conversation_model_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation_model.DeployConversationModelRequest() - assert args[0] == request_msg @@ -8856,7 +8867,6 @@ def test_undeploy_conversation_model_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation_model.UndeployConversationModelRequest() - assert args[0] == request_msg @@ -8878,7 +8888,6 @@ def test_get_conversation_model_evaluation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation_model.GetConversationModelEvaluationRequest() - assert args[0] == request_msg @@ -8900,7 +8909,6 @@ def test_list_conversation_model_evaluations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation_model.ListConversationModelEvaluationsRequest() - assert args[0] == request_msg @@ -8922,7 +8930,6 @@ def test_create_conversation_model_evaluation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation_model.CreateConversationModelEvaluationRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_conversation_profiles.py b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_conversation_profiles.py index 516f1595f502..8fcb9d5ff37e 100644 --- a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_conversation_profiles.py +++ b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_conversation_profiles.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 @@ -124,6 +125,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" @@ -1390,8 +1406,8 @@ def test_conversation_profiles_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - conversation_profile.ListConversationProfilesRequest, - dict, + conversation_profile.ListConversationProfilesRequest(), + {}, ], ) def test_list_conversation_profiles(request_type, transport: str = "grpc"): @@ -1402,7 +1418,7 @@ def test_list_conversation_profiles(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1451,10 +1467,11 @@ def test_list_conversation_profiles_non_empty_request_with_auto_populated_field( client.list_conversation_profiles(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversation_profile.ListConversationProfilesRequest( + request_msg = conversation_profile.ListConversationProfilesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_conversation_profiles_use_cached_wrapped_rpc(): @@ -1540,9 +1557,15 @@ async def test_list_conversation_profiles_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + conversation_profile.ListConversationProfilesRequest(), + {}, + ], +) async def test_list_conversation_profiles_async( - transport: str = "grpc_asyncio", - request_type=conversation_profile.ListConversationProfilesRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConversationProfilesAsyncClient( credentials=async_anonymous_credentials(), @@ -1551,7 +1574,7 @@ async def test_list_conversation_profiles_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( @@ -1576,11 +1599,6 @@ async def test_list_conversation_profiles_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_conversation_profiles_async_from_dict(): - await test_list_conversation_profiles_async(request_type=dict) - - def test_list_conversation_profiles_field_headers(): client = ConversationProfilesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1939,8 +1957,8 @@ async def test_list_conversation_profiles_async_pages(): @pytest.mark.parametrize( "request_type", [ - conversation_profile.GetConversationProfileRequest, - dict, + conversation_profile.GetConversationProfileRequest(), + {}, ], ) def test_get_conversation_profile(request_type, transport: str = "grpc"): @@ -1951,7 +1969,7 @@ def test_get_conversation_profile(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2007,9 +2025,10 @@ def test_get_conversation_profile_non_empty_request_with_auto_populated_field(): client.get_conversation_profile(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversation_profile.GetConversationProfileRequest( + request_msg = conversation_profile.GetConversationProfileRequest( name="name_value", ) + assert args[0] == request_msg def test_get_conversation_profile_use_cached_wrapped_rpc(): @@ -2095,9 +2114,15 @@ async def test_get_conversation_profile_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + conversation_profile.GetConversationProfileRequest(), + {}, + ], +) async def test_get_conversation_profile_async( - transport: str = "grpc_asyncio", - request_type=conversation_profile.GetConversationProfileRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConversationProfilesAsyncClient( credentials=async_anonymous_credentials(), @@ -2106,7 +2131,7 @@ async def test_get_conversation_profile_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( @@ -2139,11 +2164,6 @@ async def test_get_conversation_profile_async( assert response.security_settings == "security_settings_value" -@pytest.mark.asyncio -async def test_get_conversation_profile_async_from_dict(): - await test_get_conversation_profile_async(request_type=dict) - - def test_get_conversation_profile_field_headers(): client = ConversationProfilesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2298,8 +2318,8 @@ async def test_get_conversation_profile_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcd_conversation_profile.CreateConversationProfileRequest, - dict, + gcd_conversation_profile.CreateConversationProfileRequest(), + {}, ], ) def test_create_conversation_profile(request_type, transport: str = "grpc"): @@ -2310,7 +2330,7 @@ def test_create_conversation_profile(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2366,9 +2386,10 @@ def test_create_conversation_profile_non_empty_request_with_auto_populated_field client.create_conversation_profile(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_conversation_profile.CreateConversationProfileRequest( + request_msg = gcd_conversation_profile.CreateConversationProfileRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_conversation_profile_use_cached_wrapped_rpc(): @@ -2454,9 +2475,15 @@ async def test_create_conversation_profile_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcd_conversation_profile.CreateConversationProfileRequest(), + {}, + ], +) async def test_create_conversation_profile_async( - transport: str = "grpc_asyncio", - request_type=gcd_conversation_profile.CreateConversationProfileRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConversationProfilesAsyncClient( credentials=async_anonymous_credentials(), @@ -2465,7 +2492,7 @@ async def test_create_conversation_profile_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( @@ -2498,11 +2525,6 @@ async def test_create_conversation_profile_async( assert response.security_settings == "security_settings_value" -@pytest.mark.asyncio -async def test_create_conversation_profile_async_from_dict(): - await test_create_conversation_profile_async(request_type=dict) - - def test_create_conversation_profile_field_headers(): client = ConversationProfilesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2675,8 +2697,8 @@ async def test_create_conversation_profile_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcd_conversation_profile.UpdateConversationProfileRequest, - dict, + gcd_conversation_profile.UpdateConversationProfileRequest(), + {}, ], ) def test_update_conversation_profile(request_type, transport: str = "grpc"): @@ -2687,7 +2709,7 @@ def test_update_conversation_profile(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2741,7 +2763,8 @@ def test_update_conversation_profile_non_empty_request_with_auto_populated_field client.update_conversation_profile(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_conversation_profile.UpdateConversationProfileRequest() + request_msg = gcd_conversation_profile.UpdateConversationProfileRequest() + assert args[0] == request_msg def test_update_conversation_profile_use_cached_wrapped_rpc(): @@ -2827,9 +2850,15 @@ async def test_update_conversation_profile_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcd_conversation_profile.UpdateConversationProfileRequest(), + {}, + ], +) async def test_update_conversation_profile_async( - transport: str = "grpc_asyncio", - request_type=gcd_conversation_profile.UpdateConversationProfileRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConversationProfilesAsyncClient( credentials=async_anonymous_credentials(), @@ -2838,7 +2867,7 @@ async def test_update_conversation_profile_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( @@ -2871,11 +2900,6 @@ async def test_update_conversation_profile_async( assert response.security_settings == "security_settings_value" -@pytest.mark.asyncio -async def test_update_conversation_profile_async_from_dict(): - await test_update_conversation_profile_async(request_type=dict) - - def test_update_conversation_profile_field_headers(): client = ConversationProfilesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3048,8 +3072,8 @@ async def test_update_conversation_profile_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversation_profile.DeleteConversationProfileRequest, - dict, + conversation_profile.DeleteConversationProfileRequest(), + {}, ], ) def test_delete_conversation_profile(request_type, transport: str = "grpc"): @@ -3060,7 +3084,7 @@ def test_delete_conversation_profile(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3105,9 +3129,10 @@ def test_delete_conversation_profile_non_empty_request_with_auto_populated_field client.delete_conversation_profile(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversation_profile.DeleteConversationProfileRequest( + request_msg = conversation_profile.DeleteConversationProfileRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_conversation_profile_use_cached_wrapped_rpc(): @@ -3193,9 +3218,15 @@ async def test_delete_conversation_profile_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + conversation_profile.DeleteConversationProfileRequest(), + {}, + ], +) async def test_delete_conversation_profile_async( - transport: str = "grpc_asyncio", - request_type=conversation_profile.DeleteConversationProfileRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConversationProfilesAsyncClient( credentials=async_anonymous_credentials(), @@ -3204,7 +3235,7 @@ async def test_delete_conversation_profile_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( @@ -3224,11 +3255,6 @@ async def test_delete_conversation_profile_async( assert response is None -@pytest.mark.asyncio -async def test_delete_conversation_profile_async_from_dict(): - await test_delete_conversation_profile_async(request_type=dict) - - def test_delete_conversation_profile_field_headers(): client = ConversationProfilesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3379,8 +3405,8 @@ async def test_delete_conversation_profile_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcd_conversation_profile.SetSuggestionFeatureConfigRequest, - dict, + gcd_conversation_profile.SetSuggestionFeatureConfigRequest(), + {}, ], ) def test_set_suggestion_feature_config(request_type, transport: str = "grpc"): @@ -3391,7 +3417,7 @@ def test_set_suggestion_feature_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( @@ -3436,9 +3462,10 @@ def test_set_suggestion_feature_config_non_empty_request_with_auto_populated_fie client.set_suggestion_feature_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_conversation_profile.SetSuggestionFeatureConfigRequest( + request_msg = gcd_conversation_profile.SetSuggestionFeatureConfigRequest( conversation_profile="conversation_profile_value", ) + assert args[0] == request_msg def test_set_suggestion_feature_config_use_cached_wrapped_rpc(): @@ -3534,9 +3561,15 @@ async def test_set_suggestion_feature_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcd_conversation_profile.SetSuggestionFeatureConfigRequest(), + {}, + ], +) async def test_set_suggestion_feature_config_async( - transport: str = "grpc_asyncio", - request_type=gcd_conversation_profile.SetSuggestionFeatureConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConversationProfilesAsyncClient( credentials=async_anonymous_credentials(), @@ -3545,7 +3578,7 @@ async def test_set_suggestion_feature_config_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( @@ -3567,11 +3600,6 @@ async def test_set_suggestion_feature_config_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_set_suggestion_feature_config_async_from_dict(): - await test_set_suggestion_feature_config_async(request_type=dict) - - def test_set_suggestion_feature_config_field_headers(): client = ConversationProfilesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3770,8 +3798,8 @@ async def test_set_suggestion_feature_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcd_conversation_profile.ClearSuggestionFeatureConfigRequest, - dict, + gcd_conversation_profile.ClearSuggestionFeatureConfigRequest(), + {}, ], ) def test_clear_suggestion_feature_config(request_type, transport: str = "grpc"): @@ -3782,7 +3810,7 @@ def test_clear_suggestion_feature_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( @@ -3827,9 +3855,10 @@ def test_clear_suggestion_feature_config_non_empty_request_with_auto_populated_f client.clear_suggestion_feature_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_conversation_profile.ClearSuggestionFeatureConfigRequest( + request_msg = gcd_conversation_profile.ClearSuggestionFeatureConfigRequest( conversation_profile="conversation_profile_value", ) + assert args[0] == request_msg def test_clear_suggestion_feature_config_use_cached_wrapped_rpc(): @@ -3925,9 +3954,15 @@ async def test_clear_suggestion_feature_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcd_conversation_profile.ClearSuggestionFeatureConfigRequest(), + {}, + ], +) async def test_clear_suggestion_feature_config_async( - transport: str = "grpc_asyncio", - request_type=gcd_conversation_profile.ClearSuggestionFeatureConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConversationProfilesAsyncClient( credentials=async_anonymous_credentials(), @@ -3936,7 +3971,7 @@ async def test_clear_suggestion_feature_config_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( @@ -3958,11 +3993,6 @@ async def test_clear_suggestion_feature_config_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_clear_suggestion_feature_config_async_from_dict(): - await test_clear_suggestion_feature_config_async(request_type=dict) - - def test_clear_suggestion_feature_config_field_headers(): client = ConversationProfilesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5689,7 +5719,6 @@ def test_list_conversation_profiles_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation_profile.ListConversationProfilesRequest() - assert args[0] == request_msg @@ -5712,7 +5741,6 @@ def test_get_conversation_profile_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation_profile.GetConversationProfileRequest() - assert args[0] == request_msg @@ -5735,7 +5763,6 @@ def test_create_conversation_profile_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_conversation_profile.CreateConversationProfileRequest() - assert args[0] == request_msg @@ -5758,7 +5785,6 @@ def test_update_conversation_profile_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_conversation_profile.UpdateConversationProfileRequest() - assert args[0] == request_msg @@ -5781,7 +5807,6 @@ def test_delete_conversation_profile_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation_profile.DeleteConversationProfileRequest() - assert args[0] == request_msg @@ -5804,7 +5829,6 @@ def test_set_suggestion_feature_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_conversation_profile.SetSuggestionFeatureConfigRequest() - assert args[0] == request_msg @@ -5827,7 +5851,6 @@ def test_clear_suggestion_feature_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_conversation_profile.ClearSuggestionFeatureConfigRequest() - assert args[0] == request_msg @@ -5870,7 +5893,6 @@ async def test_list_conversation_profiles_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation_profile.ListConversationProfilesRequest() - assert args[0] == request_msg @@ -5903,7 +5925,6 @@ async def test_get_conversation_profile_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation_profile.GetConversationProfileRequest() - assert args[0] == request_msg @@ -5936,7 +5957,6 @@ async def test_create_conversation_profile_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_conversation_profile.CreateConversationProfileRequest() - assert args[0] == request_msg @@ -5969,7 +5989,6 @@ async def test_update_conversation_profile_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_conversation_profile.UpdateConversationProfileRequest() - assert args[0] == request_msg @@ -5994,7 +6013,6 @@ async def test_delete_conversation_profile_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation_profile.DeleteConversationProfileRequest() - assert args[0] == request_msg @@ -6021,7 +6039,6 @@ async def test_set_suggestion_feature_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_conversation_profile.SetSuggestionFeatureConfigRequest() - assert args[0] == request_msg @@ -6048,7 +6065,6 @@ async def test_clear_suggestion_feature_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_conversation_profile.ClearSuggestionFeatureConfigRequest() - assert args[0] == request_msg @@ -7734,7 +7750,6 @@ def test_list_conversation_profiles_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation_profile.ListConversationProfilesRequest() - assert args[0] == request_msg @@ -7756,7 +7771,6 @@ def test_get_conversation_profile_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation_profile.GetConversationProfileRequest() - assert args[0] == request_msg @@ -7778,7 +7792,6 @@ def test_create_conversation_profile_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_conversation_profile.CreateConversationProfileRequest() - assert args[0] == request_msg @@ -7800,7 +7813,6 @@ def test_update_conversation_profile_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_conversation_profile.UpdateConversationProfileRequest() - assert args[0] == request_msg @@ -7822,7 +7834,6 @@ def test_delete_conversation_profile_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation_profile.DeleteConversationProfileRequest() - assert args[0] == request_msg @@ -7844,7 +7855,6 @@ def test_set_suggestion_feature_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_conversation_profile.SetSuggestionFeatureConfigRequest() - assert args[0] == request_msg @@ -7866,7 +7876,6 @@ def test_clear_suggestion_feature_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_conversation_profile.ClearSuggestionFeatureConfigRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_conversations.py b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_conversations.py index 098437111a1a..b310d6344eec 100644 --- a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_conversations.py +++ b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_conversations.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 @@ -126,6 +127,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" @@ -1328,8 +1344,8 @@ def test_conversations_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - gcd_conversation.CreateConversationRequest, - dict, + gcd_conversation.CreateConversationRequest(), + {}, ], ) def test_create_conversation(request_type, transport: str = "grpc"): @@ -1340,7 +1356,7 @@ def test_create_conversation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1401,10 +1417,11 @@ def test_create_conversation_non_empty_request_with_auto_populated_field(): client.create_conversation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_conversation.CreateConversationRequest( + request_msg = gcd_conversation.CreateConversationRequest( parent="parent_value", conversation_id="conversation_id_value", ) + assert args[0] == request_msg def test_create_conversation_use_cached_wrapped_rpc(): @@ -1489,10 +1506,14 @@ async def test_create_conversation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_conversation_async( - transport: str = "grpc_asyncio", - request_type=gcd_conversation.CreateConversationRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + gcd_conversation.CreateConversationRequest(), + {}, + ], +) +async def test_create_conversation_async(request_type, transport: str = "grpc_asyncio"): client = ConversationsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1500,7 +1521,7 @@ async def test_create_conversation_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( @@ -1537,11 +1558,6 @@ async def test_create_conversation_async( ) -@pytest.mark.asyncio -async def test_create_conversation_async_from_dict(): - await test_create_conversation_async(request_type=dict) - - def test_create_conversation_field_headers(): client = ConversationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1706,8 +1722,8 @@ async def test_create_conversation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversation.ListConversationsRequest, - dict, + conversation.ListConversationsRequest(), + {}, ], ) def test_list_conversations(request_type, transport: str = "grpc"): @@ -1718,7 +1734,7 @@ def test_list_conversations(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1768,11 +1784,12 @@ def test_list_conversations_non_empty_request_with_auto_populated_field(): client.list_conversations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversation.ListConversationsRequest( + request_msg = conversation.ListConversationsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_conversations_use_cached_wrapped_rpc(): @@ -1857,9 +1874,14 @@ async def test_list_conversations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_conversations_async( - transport: str = "grpc_asyncio", request_type=conversation.ListConversationsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + conversation.ListConversationsRequest(), + {}, + ], +) +async def test_list_conversations_async(request_type, transport: str = "grpc_asyncio"): client = ConversationsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1867,7 +1889,7 @@ async def test_list_conversations_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( @@ -1892,11 +1914,6 @@ async def test_list_conversations_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_conversations_async_from_dict(): - await test_list_conversations_async(request_type=dict) - - def test_list_conversations_field_headers(): client = ConversationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2249,8 +2266,8 @@ async def test_list_conversations_async_pages(): @pytest.mark.parametrize( "request_type", [ - conversation.GetConversationRequest, - dict, + conversation.GetConversationRequest(), + {}, ], ) def test_get_conversation(request_type, transport: str = "grpc"): @@ -2261,7 +2278,7 @@ def test_get_conversation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_conversation), "__call__") as call: @@ -2316,9 +2333,10 @@ def test_get_conversation_non_empty_request_with_auto_populated_field(): client.get_conversation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversation.GetConversationRequest( + request_msg = conversation.GetConversationRequest( name="name_value", ) + assert args[0] == request_msg def test_get_conversation_use_cached_wrapped_rpc(): @@ -2401,9 +2419,14 @@ async def test_get_conversation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_conversation_async( - transport: str = "grpc_asyncio", request_type=conversation.GetConversationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + conversation.GetConversationRequest(), + {}, + ], +) +async def test_get_conversation_async(request_type, transport: str = "grpc_asyncio"): client = ConversationsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2411,7 +2434,7 @@ async def test_get_conversation_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_conversation), "__call__") as call: @@ -2445,11 +2468,6 @@ async def test_get_conversation_async( ) -@pytest.mark.asyncio -async def test_get_conversation_async_from_dict(): - await test_get_conversation_async(request_type=dict) - - def test_get_conversation_field_headers(): client = ConversationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2596,8 +2614,8 @@ async def test_get_conversation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversation.CompleteConversationRequest, - dict, + conversation.CompleteConversationRequest(), + {}, ], ) def test_complete_conversation(request_type, transport: str = "grpc"): @@ -2608,7 +2626,7 @@ def test_complete_conversation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2667,9 +2685,10 @@ def test_complete_conversation_non_empty_request_with_auto_populated_field(): client.complete_conversation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversation.CompleteConversationRequest( + request_msg = conversation.CompleteConversationRequest( name="name_value", ) + assert args[0] == request_msg def test_complete_conversation_use_cached_wrapped_rpc(): @@ -2755,9 +2774,15 @@ async def test_complete_conversation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + conversation.CompleteConversationRequest(), + {}, + ], +) async def test_complete_conversation_async( - transport: str = "grpc_asyncio", - request_type=conversation.CompleteConversationRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConversationsAsyncClient( credentials=async_anonymous_credentials(), @@ -2766,7 +2791,7 @@ async def test_complete_conversation_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( @@ -2802,11 +2827,6 @@ async def test_complete_conversation_async( ) -@pytest.mark.asyncio -async def test_complete_conversation_async_from_dict(): - await test_complete_conversation_async(request_type=dict) - - def test_complete_conversation_field_headers(): client = ConversationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2961,8 +2981,8 @@ async def test_complete_conversation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcd_conversation.IngestContextReferencesRequest, - dict, + gcd_conversation.IngestContextReferencesRequest(), + {}, ], ) def test_ingest_context_references(request_type, transport: str = "grpc"): @@ -2973,7 +2993,7 @@ def test_ingest_context_references(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3018,9 +3038,10 @@ def test_ingest_context_references_non_empty_request_with_auto_populated_field() client.ingest_context_references(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_conversation.IngestContextReferencesRequest( + request_msg = gcd_conversation.IngestContextReferencesRequest( conversation="conversation_value", ) + assert args[0] == request_msg def test_ingest_context_references_use_cached_wrapped_rpc(): @@ -3106,9 +3127,15 @@ async def test_ingest_context_references_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcd_conversation.IngestContextReferencesRequest(), + {}, + ], +) async def test_ingest_context_references_async( - transport: str = "grpc_asyncio", - request_type=gcd_conversation.IngestContextReferencesRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConversationsAsyncClient( credentials=async_anonymous_credentials(), @@ -3117,7 +3144,7 @@ async def test_ingest_context_references_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( @@ -3139,11 +3166,6 @@ async def test_ingest_context_references_async( assert isinstance(response, gcd_conversation.IngestContextReferencesResponse) -@pytest.mark.asyncio -async def test_ingest_context_references_async_from_dict(): - await test_ingest_context_references_async(request_type=dict) - - def test_ingest_context_references_field_headers(): client = ConversationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3356,8 +3378,8 @@ async def test_ingest_context_references_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversation.ListMessagesRequest, - dict, + conversation.ListMessagesRequest(), + {}, ], ) def test_list_messages(request_type, transport: str = "grpc"): @@ -3368,7 +3390,7 @@ def test_list_messages(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_messages), "__call__") as call: @@ -3414,11 +3436,12 @@ def test_list_messages_non_empty_request_with_auto_populated_field(): client.list_messages(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversation.ListMessagesRequest( + request_msg = conversation.ListMessagesRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_messages_use_cached_wrapped_rpc(): @@ -3499,9 +3522,14 @@ async def test_list_messages_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_messages_async( - transport: str = "grpc_asyncio", request_type=conversation.ListMessagesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + conversation.ListMessagesRequest(), + {}, + ], +) +async def test_list_messages_async(request_type, transport: str = "grpc_asyncio"): client = ConversationsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3509,7 +3537,7 @@ async def test_list_messages_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_messages), "__call__") as call: @@ -3532,11 +3560,6 @@ async def test_list_messages_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_messages_async_from_dict(): - await test_list_messages_async(request_type=dict) - - def test_list_messages_field_headers(): client = ConversationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3873,8 +3896,8 @@ async def test_list_messages_async_pages(): @pytest.mark.parametrize( "request_type", [ - gcd_conversation.SuggestConversationSummaryRequest, - dict, + gcd_conversation.SuggestConversationSummaryRequest(), + {}, ], ) def test_suggest_conversation_summary(request_type, transport: str = "grpc"): @@ -3885,7 +3908,7 @@ def test_suggest_conversation_summary(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3936,10 +3959,11 @@ def test_suggest_conversation_summary_non_empty_request_with_auto_populated_fiel client.suggest_conversation_summary(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_conversation.SuggestConversationSummaryRequest( + request_msg = gcd_conversation.SuggestConversationSummaryRequest( conversation="conversation_value", latest_message="latest_message_value", ) + assert args[0] == request_msg def test_suggest_conversation_summary_use_cached_wrapped_rpc(): @@ -4025,9 +4049,15 @@ async def test_suggest_conversation_summary_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcd_conversation.SuggestConversationSummaryRequest(), + {}, + ], +) async def test_suggest_conversation_summary_async( - transport: str = "grpc_asyncio", - request_type=gcd_conversation.SuggestConversationSummaryRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConversationsAsyncClient( credentials=async_anonymous_credentials(), @@ -4036,7 +4066,7 @@ async def test_suggest_conversation_summary_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( @@ -4063,11 +4093,6 @@ async def test_suggest_conversation_summary_async( assert response.context_size == 1311 -@pytest.mark.asyncio -async def test_suggest_conversation_summary_async_from_dict(): - await test_suggest_conversation_summary_async(request_type=dict) - - def test_suggest_conversation_summary_field_headers(): client = ConversationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4222,8 +4247,8 @@ async def test_suggest_conversation_summary_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversation.GenerateStatelessSummaryRequest, - dict, + conversation.GenerateStatelessSummaryRequest(), + {}, ], ) def test_generate_stateless_summary(request_type, transport: str = "grpc"): @@ -4234,7 +4259,7 @@ def test_generate_stateless_summary(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4284,9 +4309,10 @@ def test_generate_stateless_summary_non_empty_request_with_auto_populated_field( client.generate_stateless_summary(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversation.GenerateStatelessSummaryRequest( + request_msg = conversation.GenerateStatelessSummaryRequest( latest_message="latest_message_value", ) + assert args[0] == request_msg def test_generate_stateless_summary_use_cached_wrapped_rpc(): @@ -4372,9 +4398,15 @@ async def test_generate_stateless_summary_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + conversation.GenerateStatelessSummaryRequest(), + {}, + ], +) async def test_generate_stateless_summary_async( - transport: str = "grpc_asyncio", - request_type=conversation.GenerateStatelessSummaryRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConversationsAsyncClient( credentials=async_anonymous_credentials(), @@ -4383,7 +4415,7 @@ async def test_generate_stateless_summary_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( @@ -4410,11 +4442,6 @@ async def test_generate_stateless_summary_async( assert response.context_size == 1311 -@pytest.mark.asyncio -async def test_generate_stateless_summary_async_from_dict(): - await test_generate_stateless_summary_async(request_type=dict) - - def test_generate_stateless_summary_field_headers(): client = ConversationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4483,8 +4510,8 @@ async def test_generate_stateless_summary_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - conversation.GenerateStatelessSuggestionRequest, - dict, + conversation.GenerateStatelessSuggestionRequest(), + {}, ], ) def test_generate_stateless_suggestion(request_type, transport: str = "grpc"): @@ -4495,7 +4522,7 @@ def test_generate_stateless_suggestion(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4542,11 +4569,12 @@ def test_generate_stateless_suggestion_non_empty_request_with_auto_populated_fie client.generate_stateless_suggestion(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversation.GenerateStatelessSuggestionRequest( + request_msg = conversation.GenerateStatelessSuggestionRequest( parent="parent_value", generator_name="generator_name_value", security_settings="security_settings_value", ) + assert args[0] == request_msg def test_generate_stateless_suggestion_use_cached_wrapped_rpc(): @@ -4632,9 +4660,15 @@ async def test_generate_stateless_suggestion_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + conversation.GenerateStatelessSuggestionRequest(), + {}, + ], +) async def test_generate_stateless_suggestion_async( - transport: str = "grpc_asyncio", - request_type=conversation.GenerateStatelessSuggestionRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConversationsAsyncClient( credentials=async_anonymous_credentials(), @@ -4643,7 +4677,7 @@ async def test_generate_stateless_suggestion_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( @@ -4665,11 +4699,6 @@ async def test_generate_stateless_suggestion_async( assert isinstance(response, conversation.GenerateStatelessSuggestionResponse) -@pytest.mark.asyncio -async def test_generate_stateless_suggestion_async_from_dict(): - await test_generate_stateless_suggestion_async(request_type=dict) - - def test_generate_stateless_suggestion_field_headers(): client = ConversationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4738,8 +4767,8 @@ async def test_generate_stateless_suggestion_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - conversation.SearchKnowledgeRequest, - dict, + conversation.SearchKnowledgeRequest(), + {}, ], ) def test_search_knowledge(request_type, transport: str = "grpc"): @@ -4750,7 +4779,7 @@ def test_search_knowledge(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.search_knowledge), "__call__") as call: @@ -4798,13 +4827,14 @@ def test_search_knowledge_non_empty_request_with_auto_populated_field(): client.search_knowledge(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversation.SearchKnowledgeRequest( + request_msg = conversation.SearchKnowledgeRequest( parent="parent_value", conversation_profile="conversation_profile_value", session_id="session_id_value", conversation="conversation_value", latest_message="latest_message_value", ) + assert args[0] == request_msg def test_search_knowledge_use_cached_wrapped_rpc(): @@ -4887,9 +4917,14 @@ async def test_search_knowledge_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_search_knowledge_async( - transport: str = "grpc_asyncio", request_type=conversation.SearchKnowledgeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + conversation.SearchKnowledgeRequest(), + {}, + ], +) +async def test_search_knowledge_async(request_type, transport: str = "grpc_asyncio"): client = ConversationsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4897,7 +4932,7 @@ async def test_search_knowledge_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.search_knowledge), "__call__") as call: @@ -4920,11 +4955,6 @@ async def test_search_knowledge_async( assert response.rewritten_query == "rewritten_query_value" -@pytest.mark.asyncio -async def test_search_knowledge_async_from_dict(): - await test_search_knowledge_async(request_type=dict) - - def test_search_knowledge_field_headers(): client = ConversationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4989,8 +5019,8 @@ async def test_search_knowledge_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - gcd_conversation.GenerateSuggestionsRequest, - dict, + gcd_conversation.GenerateSuggestionsRequest(), + {}, ], ) def test_generate_suggestions(request_type, transport: str = "grpc"): @@ -5001,7 +5031,7 @@ def test_generate_suggestions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5050,10 +5080,11 @@ def test_generate_suggestions_non_empty_request_with_auto_populated_field(): client.generate_suggestions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_conversation.GenerateSuggestionsRequest( + request_msg = gcd_conversation.GenerateSuggestionsRequest( conversation="conversation_value", latest_message="latest_message_value", ) + assert args[0] == request_msg def test_generate_suggestions_use_cached_wrapped_rpc(): @@ -5138,9 +5169,15 @@ async def test_generate_suggestions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcd_conversation.GenerateSuggestionsRequest(), + {}, + ], +) async def test_generate_suggestions_async( - transport: str = "grpc_asyncio", - request_type=gcd_conversation.GenerateSuggestionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConversationsAsyncClient( credentials=async_anonymous_credentials(), @@ -5149,7 +5186,7 @@ async def test_generate_suggestions_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( @@ -5174,11 +5211,6 @@ async def test_generate_suggestions_async( assert response.latest_message == "latest_message_value" -@pytest.mark.asyncio -async def test_generate_suggestions_async_from_dict(): - await test_generate_suggestions_async(request_type=dict) - - def test_generate_suggestions_field_headers(): client = ConversationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7512,7 +7544,6 @@ def test_create_conversation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_conversation.CreateConversationRequest() - assert args[0] == request_msg @@ -7535,7 +7566,6 @@ def test_list_conversations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation.ListConversationsRequest() - assert args[0] == request_msg @@ -7556,7 +7586,6 @@ def test_get_conversation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation.GetConversationRequest() - assert args[0] == request_msg @@ -7579,7 +7608,6 @@ def test_complete_conversation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation.CompleteConversationRequest() - assert args[0] == request_msg @@ -7602,7 +7630,6 @@ def test_ingest_context_references_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_conversation.IngestContextReferencesRequest() - assert args[0] == request_msg @@ -7623,7 +7650,6 @@ def test_list_messages_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation.ListMessagesRequest() - assert args[0] == request_msg @@ -7646,7 +7672,6 @@ def test_suggest_conversation_summary_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_conversation.SuggestConversationSummaryRequest() - assert args[0] == request_msg @@ -7669,7 +7694,6 @@ def test_generate_stateless_summary_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation.GenerateStatelessSummaryRequest() - assert args[0] == request_msg @@ -7692,7 +7716,6 @@ def test_generate_stateless_suggestion_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation.GenerateStatelessSuggestionRequest() - assert args[0] == request_msg @@ -7713,7 +7736,6 @@ def test_search_knowledge_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation.SearchKnowledgeRequest() - assert args[0] == request_msg @@ -7736,7 +7758,6 @@ def test_generate_suggestions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_conversation.GenerateSuggestionsRequest() - assert args[0] == request_msg @@ -7782,7 +7803,6 @@ async def test_create_conversation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_conversation.CreateConversationRequest() - assert args[0] == request_msg @@ -7811,7 +7831,6 @@ async def test_list_conversations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation.ListConversationsRequest() - assert args[0] == request_msg @@ -7841,7 +7860,6 @@ async def test_get_conversation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation.GetConversationRequest() - assert args[0] == request_msg @@ -7873,7 +7891,6 @@ async def test_complete_conversation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation.CompleteConversationRequest() - assert args[0] == request_msg @@ -7900,7 +7917,6 @@ async def test_ingest_context_references_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_conversation.IngestContextReferencesRequest() - assert args[0] == request_msg @@ -7927,7 +7943,6 @@ async def test_list_messages_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation.ListMessagesRequest() - assert args[0] == request_msg @@ -7957,7 +7972,6 @@ async def test_suggest_conversation_summary_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_conversation.SuggestConversationSummaryRequest() - assert args[0] == request_msg @@ -7987,7 +8001,6 @@ async def test_generate_stateless_summary_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation.GenerateStatelessSummaryRequest() - assert args[0] == request_msg @@ -8014,7 +8027,6 @@ async def test_generate_stateless_suggestion_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation.GenerateStatelessSuggestionRequest() - assert args[0] == request_msg @@ -8041,7 +8053,6 @@ async def test_search_knowledge_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation.SearchKnowledgeRequest() - assert args[0] == request_msg @@ -8070,7 +8081,6 @@ async def test_generate_suggestions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_conversation.GenerateSuggestionsRequest() - assert args[0] == request_msg @@ -10141,7 +10151,6 @@ def test_create_conversation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_conversation.CreateConversationRequest() - assert args[0] == request_msg @@ -10163,7 +10172,6 @@ def test_list_conversations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation.ListConversationsRequest() - assert args[0] == request_msg @@ -10183,7 +10191,6 @@ def test_get_conversation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation.GetConversationRequest() - assert args[0] == request_msg @@ -10205,7 +10212,6 @@ def test_complete_conversation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation.CompleteConversationRequest() - assert args[0] == request_msg @@ -10227,7 +10233,6 @@ def test_ingest_context_references_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_conversation.IngestContextReferencesRequest() - assert args[0] == request_msg @@ -10247,7 +10252,6 @@ def test_list_messages_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation.ListMessagesRequest() - assert args[0] == request_msg @@ -10269,7 +10273,6 @@ def test_suggest_conversation_summary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_conversation.SuggestConversationSummaryRequest() - assert args[0] == request_msg @@ -10291,7 +10294,6 @@ def test_generate_stateless_summary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation.GenerateStatelessSummaryRequest() - assert args[0] == request_msg @@ -10313,7 +10315,6 @@ def test_generate_stateless_suggestion_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation.GenerateStatelessSuggestionRequest() - assert args[0] == request_msg @@ -10333,7 +10334,6 @@ def test_search_knowledge_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation.SearchKnowledgeRequest() - assert args[0] == request_msg @@ -10355,7 +10355,6 @@ def test_generate_suggestions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_conversation.GenerateSuggestionsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_documents.py b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_documents.py index 363922f6a9c8..a637f582dac7 100644 --- a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_documents.py +++ b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_documents.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 @@ -119,6 +120,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" @@ -1279,8 +1295,8 @@ def test_documents_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - document.ListDocumentsRequest, - dict, + document.ListDocumentsRequest(), + {}, ], ) def test_list_documents(request_type, transport: str = "grpc"): @@ -1291,7 +1307,7 @@ def test_list_documents(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_documents), "__call__") as call: @@ -1337,11 +1353,12 @@ def test_list_documents_non_empty_request_with_auto_populated_field(): client.list_documents(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document.ListDocumentsRequest( + request_msg = document.ListDocumentsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_documents_use_cached_wrapped_rpc(): @@ -1422,9 +1439,14 @@ async def test_list_documents_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_documents_async( - transport: str = "grpc_asyncio", request_type=document.ListDocumentsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + document.ListDocumentsRequest(), + {}, + ], +) +async def test_list_documents_async(request_type, transport: str = "grpc_asyncio"): client = DocumentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1432,7 +1454,7 @@ async def test_list_documents_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_documents), "__call__") as call: @@ -1455,11 +1477,6 @@ async def test_list_documents_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_documents_async_from_dict(): - await test_list_documents_async(request_type=dict) - - def test_list_documents_field_headers(): client = DocumentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1796,8 +1813,8 @@ async def test_list_documents_async_pages(): @pytest.mark.parametrize( "request_type", [ - document.GetDocumentRequest, - dict, + document.GetDocumentRequest(), + {}, ], ) def test_get_document(request_type, transport: str = "grpc"): @@ -1808,7 +1825,7 @@ def test_get_document(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_document), "__call__") as call: @@ -1863,9 +1880,10 @@ def test_get_document_non_empty_request_with_auto_populated_field(): client.get_document(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document.GetDocumentRequest( + request_msg = document.GetDocumentRequest( name="name_value", ) + assert args[0] == request_msg def test_get_document_use_cached_wrapped_rpc(): @@ -1946,9 +1964,14 @@ async def test_get_document_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_document_async( - transport: str = "grpc_asyncio", request_type=document.GetDocumentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + document.GetDocumentRequest(), + {}, + ], +) +async def test_get_document_async(request_type, transport: str = "grpc_asyncio"): client = DocumentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1956,7 +1979,7 @@ async def test_get_document_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_document), "__call__") as call: @@ -1989,11 +2012,6 @@ async def test_get_document_async( assert response.state == document.Document.State.CREATING -@pytest.mark.asyncio -async def test_get_document_async_from_dict(): - await test_get_document_async(request_type=dict) - - def test_get_document_field_headers(): client = DocumentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2136,8 +2154,8 @@ async def test_get_document_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcd_document.CreateDocumentRequest, - dict, + gcd_document.CreateDocumentRequest(), + {}, ], ) def test_create_document(request_type, transport: str = "grpc"): @@ -2148,7 +2166,7 @@ def test_create_document(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_document), "__call__") as call: @@ -2189,9 +2207,10 @@ def test_create_document_non_empty_request_with_auto_populated_field(): client.create_document(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_document.CreateDocumentRequest( + request_msg = gcd_document.CreateDocumentRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_document_use_cached_wrapped_rpc(): @@ -2282,9 +2301,14 @@ async def test_create_document_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_document_async( - transport: str = "grpc_asyncio", request_type=gcd_document.CreateDocumentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcd_document.CreateDocumentRequest(), + {}, + ], +) +async def test_create_document_async(request_type, transport: str = "grpc_asyncio"): client = DocumentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2292,7 +2316,7 @@ async def test_create_document_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_document), "__call__") as call: @@ -2312,11 +2336,6 @@ async def test_create_document_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_document_async_from_dict(): - await test_create_document_async(request_type=dict) - - def test_create_document_field_headers(): client = DocumentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2473,8 +2492,8 @@ async def test_create_document_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - document.ImportDocumentsRequest, - dict, + document.ImportDocumentsRequest(), + {}, ], ) def test_import_documents(request_type, transport: str = "grpc"): @@ -2485,7 +2504,7 @@ def test_import_documents(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.import_documents), "__call__") as call: @@ -2526,9 +2545,10 @@ def test_import_documents_non_empty_request_with_auto_populated_field(): client.import_documents(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document.ImportDocumentsRequest( + request_msg = document.ImportDocumentsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_import_documents_use_cached_wrapped_rpc(): @@ -2621,9 +2641,14 @@ async def test_import_documents_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_import_documents_async( - transport: str = "grpc_asyncio", request_type=document.ImportDocumentsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + document.ImportDocumentsRequest(), + {}, + ], +) +async def test_import_documents_async(request_type, transport: str = "grpc_asyncio"): client = DocumentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2631,7 +2656,7 @@ async def test_import_documents_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.import_documents), "__call__") as call: @@ -2651,11 +2676,6 @@ async def test_import_documents_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_import_documents_async_from_dict(): - await test_import_documents_async(request_type=dict) - - def test_import_documents_field_headers(): client = DocumentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2720,8 +2740,8 @@ async def test_import_documents_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - document.DeleteDocumentRequest, - dict, + document.DeleteDocumentRequest(), + {}, ], ) def test_delete_document(request_type, transport: str = "grpc"): @@ -2732,7 +2752,7 @@ def test_delete_document(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_document), "__call__") as call: @@ -2773,9 +2793,10 @@ def test_delete_document_non_empty_request_with_auto_populated_field(): client.delete_document(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document.DeleteDocumentRequest( + request_msg = document.DeleteDocumentRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_document_use_cached_wrapped_rpc(): @@ -2866,9 +2887,14 @@ async def test_delete_document_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_document_async( - transport: str = "grpc_asyncio", request_type=document.DeleteDocumentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + document.DeleteDocumentRequest(), + {}, + ], +) +async def test_delete_document_async(request_type, transport: str = "grpc_asyncio"): client = DocumentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2876,7 +2902,7 @@ async def test_delete_document_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_document), "__call__") as call: @@ -2896,11 +2922,6 @@ async def test_delete_document_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_document_async_from_dict(): - await test_delete_document_async(request_type=dict) - - def test_delete_document_field_headers(): client = DocumentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3047,8 +3068,8 @@ async def test_delete_document_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcd_document.UpdateDocumentRequest, - dict, + gcd_document.UpdateDocumentRequest(), + {}, ], ) def test_update_document(request_type, transport: str = "grpc"): @@ -3059,7 +3080,7 @@ def test_update_document(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_document), "__call__") as call: @@ -3098,7 +3119,8 @@ def test_update_document_non_empty_request_with_auto_populated_field(): client.update_document(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_document.UpdateDocumentRequest() + request_msg = gcd_document.UpdateDocumentRequest() + assert args[0] == request_msg def test_update_document_use_cached_wrapped_rpc(): @@ -3189,9 +3211,14 @@ async def test_update_document_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_document_async( - transport: str = "grpc_asyncio", request_type=gcd_document.UpdateDocumentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcd_document.UpdateDocumentRequest(), + {}, + ], +) +async def test_update_document_async(request_type, transport: str = "grpc_asyncio"): client = DocumentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3199,7 +3226,7 @@ async def test_update_document_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_document), "__call__") as call: @@ -3219,11 +3246,6 @@ async def test_update_document_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_document_async_from_dict(): - await test_update_document_async(request_type=dict) - - def test_update_document_field_headers(): client = DocumentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3380,8 +3402,8 @@ async def test_update_document_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - document.ReloadDocumentRequest, - dict, + document.ReloadDocumentRequest(), + {}, ], ) def test_reload_document(request_type, transport: str = "grpc"): @@ -3392,7 +3414,7 @@ def test_reload_document(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.reload_document), "__call__") as call: @@ -3434,10 +3456,11 @@ def test_reload_document_non_empty_request_with_auto_populated_field(): client.reload_document(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document.ReloadDocumentRequest( + request_msg = document.ReloadDocumentRequest( name="name_value", content_uri="content_uri_value", ) + assert args[0] == request_msg def test_reload_document_use_cached_wrapped_rpc(): @@ -3528,9 +3551,14 @@ async def test_reload_document_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_reload_document_async( - transport: str = "grpc_asyncio", request_type=document.ReloadDocumentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + document.ReloadDocumentRequest(), + {}, + ], +) +async def test_reload_document_async(request_type, transport: str = "grpc_asyncio"): client = DocumentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3538,7 +3566,7 @@ async def test_reload_document_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.reload_document), "__call__") as call: @@ -3558,11 +3586,6 @@ async def test_reload_document_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_reload_document_async_from_dict(): - await test_reload_document_async(request_type=dict) - - def test_reload_document_field_headers(): client = DocumentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3715,8 +3738,8 @@ async def test_reload_document_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - document.ExportDocumentRequest, - dict, + document.ExportDocumentRequest(), + {}, ], ) def test_export_document(request_type, transport: str = "grpc"): @@ -3727,7 +3750,7 @@ def test_export_document(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.export_document), "__call__") as call: @@ -3768,9 +3791,10 @@ def test_export_document_non_empty_request_with_auto_populated_field(): client.export_document(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document.ExportDocumentRequest( + request_msg = document.ExportDocumentRequest( name="name_value", ) + assert args[0] == request_msg def test_export_document_use_cached_wrapped_rpc(): @@ -3861,9 +3885,14 @@ async def test_export_document_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_export_document_async( - transport: str = "grpc_asyncio", request_type=document.ExportDocumentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + document.ExportDocumentRequest(), + {}, + ], +) +async def test_export_document_async(request_type, transport: str = "grpc_asyncio"): client = DocumentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3871,7 +3900,7 @@ async def test_export_document_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.export_document), "__call__") as call: @@ -3891,11 +3920,6 @@ async def test_export_document_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_export_document_async_from_dict(): - await test_export_document_async(request_type=dict) - - def test_export_document_field_headers(): client = DocumentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5497,7 +5521,6 @@ def test_list_documents_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document.ListDocumentsRequest() - assert args[0] == request_msg @@ -5518,7 +5541,6 @@ def test_get_document_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document.GetDocumentRequest() - assert args[0] == request_msg @@ -5539,7 +5561,6 @@ def test_create_document_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_document.CreateDocumentRequest() - assert args[0] == request_msg @@ -5560,7 +5581,6 @@ def test_import_documents_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document.ImportDocumentsRequest() - assert args[0] == request_msg @@ -5581,7 +5601,6 @@ def test_delete_document_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document.DeleteDocumentRequest() - assert args[0] == request_msg @@ -5602,7 +5621,6 @@ def test_update_document_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_document.UpdateDocumentRequest() - assert args[0] == request_msg @@ -5623,7 +5641,6 @@ def test_reload_document_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document.ReloadDocumentRequest() - assert args[0] == request_msg @@ -5644,7 +5661,6 @@ def test_export_document_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document.ExportDocumentRequest() - assert args[0] == request_msg @@ -5685,7 +5701,6 @@ async def test_list_documents_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document.ListDocumentsRequest() - assert args[0] == request_msg @@ -5717,7 +5732,6 @@ async def test_get_document_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document.GetDocumentRequest() - assert args[0] == request_msg @@ -5742,7 +5756,6 @@ async def test_create_document_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_document.CreateDocumentRequest() - assert args[0] == request_msg @@ -5767,7 +5780,6 @@ async def test_import_documents_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document.ImportDocumentsRequest() - assert args[0] == request_msg @@ -5792,7 +5804,6 @@ async def test_delete_document_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document.DeleteDocumentRequest() - assert args[0] == request_msg @@ -5817,7 +5828,6 @@ async def test_update_document_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_document.UpdateDocumentRequest() - assert args[0] == request_msg @@ -5842,7 +5852,6 @@ async def test_reload_document_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document.ReloadDocumentRequest() - assert args[0] == request_msg @@ -5867,7 +5876,6 @@ async def test_export_document_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document.ExportDocumentRequest() - assert args[0] == request_msg @@ -7387,7 +7395,6 @@ def test_list_documents_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document.ListDocumentsRequest() - assert args[0] == request_msg @@ -7407,7 +7414,6 @@ def test_get_document_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document.GetDocumentRequest() - assert args[0] == request_msg @@ -7427,7 +7433,6 @@ def test_create_document_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_document.CreateDocumentRequest() - assert args[0] == request_msg @@ -7447,7 +7452,6 @@ def test_import_documents_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document.ImportDocumentsRequest() - assert args[0] == request_msg @@ -7467,7 +7471,6 @@ def test_delete_document_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document.DeleteDocumentRequest() - assert args[0] == request_msg @@ -7487,7 +7490,6 @@ def test_update_document_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_document.UpdateDocumentRequest() - assert args[0] == request_msg @@ -7507,7 +7509,6 @@ def test_reload_document_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document.ReloadDocumentRequest() - assert args[0] == request_msg @@ -7527,7 +7528,6 @@ def test_export_document_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document.ExportDocumentRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_encryption_spec_service.py b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_encryption_spec_service.py index 865dc6172db1..22548831bf14 100644 --- a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_encryption_spec_service.py +++ b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_encryption_spec_service.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 @@ -113,6 +114,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" @@ -1381,8 +1397,8 @@ def test_encryption_spec_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - encryption_spec.GetEncryptionSpecRequest, - dict, + encryption_spec.GetEncryptionSpecRequest(), + {}, ], ) def test_get_encryption_spec(request_type, transport: str = "grpc"): @@ -1393,7 +1409,7 @@ def test_get_encryption_spec(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1443,9 +1459,10 @@ def test_get_encryption_spec_non_empty_request_with_auto_populated_field(): client.get_encryption_spec(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == encryption_spec.GetEncryptionSpecRequest( + request_msg = encryption_spec.GetEncryptionSpecRequest( name="name_value", ) + assert args[0] == request_msg def test_get_encryption_spec_use_cached_wrapped_rpc(): @@ -1530,10 +1547,14 @@ async def test_get_encryption_spec_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_encryption_spec_async( - transport: str = "grpc_asyncio", - request_type=encryption_spec.GetEncryptionSpecRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + encryption_spec.GetEncryptionSpecRequest(), + {}, + ], +) +async def test_get_encryption_spec_async(request_type, transport: str = "grpc_asyncio"): client = EncryptionSpecServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1541,7 +1562,7 @@ async def test_get_encryption_spec_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( @@ -1568,11 +1589,6 @@ async def test_get_encryption_spec_async( assert response.kms_key == "kms_key_value" -@pytest.mark.asyncio -async def test_get_encryption_spec_async_from_dict(): - await test_get_encryption_spec_async(request_type=dict) - - def test_get_encryption_spec_field_headers(): client = EncryptionSpecServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1727,8 +1743,8 @@ async def test_get_encryption_spec_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcd_encryption_spec.InitializeEncryptionSpecRequest, - dict, + gcd_encryption_spec.InitializeEncryptionSpecRequest(), + {}, ], ) def test_initialize_encryption_spec(request_type, transport: str = "grpc"): @@ -1739,7 +1755,7 @@ def test_initialize_encryption_spec(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1782,7 +1798,8 @@ def test_initialize_encryption_spec_non_empty_request_with_auto_populated_field( client.initialize_encryption_spec(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_encryption_spec.InitializeEncryptionSpecRequest() + request_msg = gcd_encryption_spec.InitializeEncryptionSpecRequest() + assert args[0] == request_msg def test_initialize_encryption_spec_use_cached_wrapped_rpc(): @@ -1878,9 +1895,15 @@ async def test_initialize_encryption_spec_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcd_encryption_spec.InitializeEncryptionSpecRequest(), + {}, + ], +) async def test_initialize_encryption_spec_async( - transport: str = "grpc_asyncio", - request_type=gcd_encryption_spec.InitializeEncryptionSpecRequest, + request_type, transport: str = "grpc_asyncio" ): client = EncryptionSpecServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1889,7 +1912,7 @@ async def test_initialize_encryption_spec_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( @@ -1911,11 +1934,6 @@ async def test_initialize_encryption_spec_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_initialize_encryption_spec_async_from_dict(): - await test_initialize_encryption_spec_async(request_type=dict) - - def test_initialize_encryption_spec_field_headers(): client = EncryptionSpecServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2556,7 +2574,6 @@ def test_get_encryption_spec_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = encryption_spec.GetEncryptionSpecRequest() - assert args[0] == request_msg @@ -2579,7 +2596,6 @@ def test_initialize_encryption_spec_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_encryption_spec.InitializeEncryptionSpecRequest() - assert args[0] == request_msg @@ -2623,7 +2639,6 @@ async def test_get_encryption_spec_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = encryption_spec.GetEncryptionSpecRequest() - assert args[0] == request_msg @@ -2650,7 +2665,6 @@ async def test_initialize_encryption_spec_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_encryption_spec.InitializeEncryptionSpecRequest() - assert args[0] == request_msg @@ -3262,7 +3276,6 @@ def test_get_encryption_spec_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = encryption_spec.GetEncryptionSpecRequest() - assert args[0] == request_msg @@ -3284,7 +3297,6 @@ def test_initialize_encryption_spec_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_encryption_spec.InitializeEncryptionSpecRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_entity_types.py b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_entity_types.py index 4fd98be14c6e..5751ade4a20d 100644 --- a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_entity_types.py +++ b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_entity_types.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 @@ -117,6 +118,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" @@ -1285,8 +1301,8 @@ def test_entity_types_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - entity_type.ListEntityTypesRequest, - dict, + entity_type.ListEntityTypesRequest(), + {}, ], ) def test_list_entity_types(request_type, transport: str = "grpc"): @@ -1297,7 +1313,7 @@ def test_list_entity_types(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1347,11 +1363,12 @@ def test_list_entity_types_non_empty_request_with_auto_populated_field(): client.list_entity_types(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == entity_type.ListEntityTypesRequest( + request_msg = entity_type.ListEntityTypesRequest( parent="parent_value", language_code="language_code_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_entity_types_use_cached_wrapped_rpc(): @@ -1434,9 +1451,14 @@ async def test_list_entity_types_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_entity_types_async( - transport: str = "grpc_asyncio", request_type=entity_type.ListEntityTypesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + entity_type.ListEntityTypesRequest(), + {}, + ], +) +async def test_list_entity_types_async(request_type, transport: str = "grpc_asyncio"): client = EntityTypesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1444,7 +1466,7 @@ async def test_list_entity_types_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( @@ -1469,11 +1491,6 @@ async def test_list_entity_types_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_entity_types_async_from_dict(): - await test_list_entity_types_async(request_type=dict) - - def test_list_entity_types_field_headers(): client = EntityTypesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1836,8 +1853,8 @@ async def test_list_entity_types_async_pages(): @pytest.mark.parametrize( "request_type", [ - entity_type.GetEntityTypeRequest, - dict, + entity_type.GetEntityTypeRequest(), + {}, ], ) def test_get_entity_type(request_type, transport: str = "grpc"): @@ -1848,7 +1865,7 @@ def test_get_entity_type(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_entity_type), "__call__") as call: @@ -1904,10 +1921,11 @@ def test_get_entity_type_non_empty_request_with_auto_populated_field(): client.get_entity_type(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == entity_type.GetEntityTypeRequest( + request_msg = entity_type.GetEntityTypeRequest( name="name_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_get_entity_type_use_cached_wrapped_rpc(): @@ -1988,9 +2006,14 @@ async def test_get_entity_type_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_entity_type_async( - transport: str = "grpc_asyncio", request_type=entity_type.GetEntityTypeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + entity_type.GetEntityTypeRequest(), + {}, + ], +) +async def test_get_entity_type_async(request_type, transport: str = "grpc_asyncio"): client = EntityTypesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1998,7 +2021,7 @@ async def test_get_entity_type_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_entity_type), "__call__") as call: @@ -2032,11 +2055,6 @@ async def test_get_entity_type_async( assert response.enable_fuzzy_extraction is True -@pytest.mark.asyncio -async def test_get_entity_type_async_from_dict(): - await test_get_entity_type_async(request_type=dict) - - def test_get_entity_type_field_headers(): client = EntityTypesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2193,8 +2211,8 @@ async def test_get_entity_type_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcd_entity_type.CreateEntityTypeRequest, - dict, + gcd_entity_type.CreateEntityTypeRequest(), + {}, ], ) def test_create_entity_type(request_type, transport: str = "grpc"): @@ -2205,7 +2223,7 @@ def test_create_entity_type(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2265,10 +2283,11 @@ def test_create_entity_type_non_empty_request_with_auto_populated_field(): client.create_entity_type(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_entity_type.CreateEntityTypeRequest( + request_msg = gcd_entity_type.CreateEntityTypeRequest( parent="parent_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_create_entity_type_use_cached_wrapped_rpc(): @@ -2353,10 +2372,14 @@ async def test_create_entity_type_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_entity_type_async( - transport: str = "grpc_asyncio", - request_type=gcd_entity_type.CreateEntityTypeRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + gcd_entity_type.CreateEntityTypeRequest(), + {}, + ], +) +async def test_create_entity_type_async(request_type, transport: str = "grpc_asyncio"): client = EntityTypesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2364,7 +2387,7 @@ async def test_create_entity_type_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( @@ -2400,11 +2423,6 @@ async def test_create_entity_type_async( assert response.enable_fuzzy_extraction is True -@pytest.mark.asyncio -async def test_create_entity_type_async_from_dict(): - await test_create_entity_type_async(request_type=dict) - - def test_create_entity_type_field_headers(): client = EntityTypesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2579,8 +2597,8 @@ async def test_create_entity_type_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcd_entity_type.UpdateEntityTypeRequest, - dict, + gcd_entity_type.UpdateEntityTypeRequest(), + {}, ], ) def test_update_entity_type(request_type, transport: str = "grpc"): @@ -2591,7 +2609,7 @@ def test_update_entity_type(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2650,9 +2668,10 @@ def test_update_entity_type_non_empty_request_with_auto_populated_field(): client.update_entity_type(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_entity_type.UpdateEntityTypeRequest( + request_msg = gcd_entity_type.UpdateEntityTypeRequest( language_code="language_code_value", ) + assert args[0] == request_msg def test_update_entity_type_use_cached_wrapped_rpc(): @@ -2737,10 +2756,14 @@ async def test_update_entity_type_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_entity_type_async( - transport: str = "grpc_asyncio", - request_type=gcd_entity_type.UpdateEntityTypeRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + gcd_entity_type.UpdateEntityTypeRequest(), + {}, + ], +) +async def test_update_entity_type_async(request_type, transport: str = "grpc_asyncio"): client = EntityTypesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2748,7 +2771,7 @@ async def test_update_entity_type_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( @@ -2784,11 +2807,6 @@ async def test_update_entity_type_async( assert response.enable_fuzzy_extraction is True -@pytest.mark.asyncio -async def test_update_entity_type_async_from_dict(): - await test_update_entity_type_async(request_type=dict) - - def test_update_entity_type_field_headers(): client = EntityTypesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2953,8 +2971,8 @@ async def test_update_entity_type_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - entity_type.DeleteEntityTypeRequest, - dict, + entity_type.DeleteEntityTypeRequest(), + {}, ], ) def test_delete_entity_type(request_type, transport: str = "grpc"): @@ -2965,7 +2983,7 @@ def test_delete_entity_type(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3010,9 +3028,10 @@ def test_delete_entity_type_non_empty_request_with_auto_populated_field(): client.delete_entity_type(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == entity_type.DeleteEntityTypeRequest( + request_msg = entity_type.DeleteEntityTypeRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_entity_type_use_cached_wrapped_rpc(): @@ -3097,9 +3116,14 @@ async def test_delete_entity_type_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_entity_type_async( - transport: str = "grpc_asyncio", request_type=entity_type.DeleteEntityTypeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + entity_type.DeleteEntityTypeRequest(), + {}, + ], +) +async def test_delete_entity_type_async(request_type, transport: str = "grpc_asyncio"): client = EntityTypesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3107,7 +3131,7 @@ async def test_delete_entity_type_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( @@ -3127,11 +3151,6 @@ async def test_delete_entity_type_async( assert response is None -@pytest.mark.asyncio -async def test_delete_entity_type_async_from_dict(): - await test_delete_entity_type_async(request_type=dict) - - def test_delete_entity_type_field_headers(): client = EntityTypesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3282,8 +3301,8 @@ async def test_delete_entity_type_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - entity_type.BatchUpdateEntityTypesRequest, - dict, + entity_type.BatchUpdateEntityTypesRequest(), + {}, ], ) def test_batch_update_entity_types(request_type, transport: str = "grpc"): @@ -3294,7 +3313,7 @@ def test_batch_update_entity_types(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3341,11 +3360,12 @@ def test_batch_update_entity_types_non_empty_request_with_auto_populated_field() client.batch_update_entity_types(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == entity_type.BatchUpdateEntityTypesRequest( + request_msg = entity_type.BatchUpdateEntityTypesRequest( parent="parent_value", entity_type_batch_uri="entity_type_batch_uri_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_batch_update_entity_types_use_cached_wrapped_rpc(): @@ -3441,9 +3461,15 @@ async def test_batch_update_entity_types_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + entity_type.BatchUpdateEntityTypesRequest(), + {}, + ], +) async def test_batch_update_entity_types_async( - transport: str = "grpc_asyncio", - request_type=entity_type.BatchUpdateEntityTypesRequest, + request_type, transport: str = "grpc_asyncio" ): client = EntityTypesAsyncClient( credentials=async_anonymous_credentials(), @@ -3452,7 +3478,7 @@ async def test_batch_update_entity_types_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( @@ -3474,11 +3500,6 @@ async def test_batch_update_entity_types_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_batch_update_entity_types_async_from_dict(): - await test_batch_update_entity_types_async(request_type=dict) - - def test_batch_update_entity_types_field_headers(): client = EntityTypesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3547,8 +3568,8 @@ async def test_batch_update_entity_types_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - entity_type.BatchDeleteEntityTypesRequest, - dict, + entity_type.BatchDeleteEntityTypesRequest(), + {}, ], ) def test_batch_delete_entity_types(request_type, transport: str = "grpc"): @@ -3559,7 +3580,7 @@ def test_batch_delete_entity_types(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3604,9 +3625,10 @@ def test_batch_delete_entity_types_non_empty_request_with_auto_populated_field() client.batch_delete_entity_types(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == entity_type.BatchDeleteEntityTypesRequest( + request_msg = entity_type.BatchDeleteEntityTypesRequest( parent="parent_value", ) + assert args[0] == request_msg def test_batch_delete_entity_types_use_cached_wrapped_rpc(): @@ -3702,9 +3724,15 @@ async def test_batch_delete_entity_types_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + entity_type.BatchDeleteEntityTypesRequest(), + {}, + ], +) async def test_batch_delete_entity_types_async( - transport: str = "grpc_asyncio", - request_type=entity_type.BatchDeleteEntityTypesRequest, + request_type, transport: str = "grpc_asyncio" ): client = EntityTypesAsyncClient( credentials=async_anonymous_credentials(), @@ -3713,7 +3741,7 @@ async def test_batch_delete_entity_types_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( @@ -3735,11 +3763,6 @@ async def test_batch_delete_entity_types_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_batch_delete_entity_types_async_from_dict(): - await test_batch_delete_entity_types_async(request_type=dict) - - def test_batch_delete_entity_types_field_headers(): client = EntityTypesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3904,8 +3927,8 @@ async def test_batch_delete_entity_types_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - entity_type.BatchCreateEntitiesRequest, - dict, + entity_type.BatchCreateEntitiesRequest(), + {}, ], ) def test_batch_create_entities(request_type, transport: str = "grpc"): @@ -3916,7 +3939,7 @@ def test_batch_create_entities(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3962,10 +3985,11 @@ def test_batch_create_entities_non_empty_request_with_auto_populated_field(): client.batch_create_entities(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == entity_type.BatchCreateEntitiesRequest( + request_msg = entity_type.BatchCreateEntitiesRequest( parent="parent_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_batch_create_entities_use_cached_wrapped_rpc(): @@ -4061,8 +4085,15 @@ async def test_batch_create_entities_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + entity_type.BatchCreateEntitiesRequest(), + {}, + ], +) async def test_batch_create_entities_async( - transport: str = "grpc_asyncio", request_type=entity_type.BatchCreateEntitiesRequest + request_type, transport: str = "grpc_asyncio" ): client = EntityTypesAsyncClient( credentials=async_anonymous_credentials(), @@ -4071,7 +4102,7 @@ async def test_batch_create_entities_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( @@ -4093,11 +4124,6 @@ async def test_batch_create_entities_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_batch_create_entities_async_from_dict(): - await test_batch_create_entities_async(request_type=dict) - - def test_batch_create_entities_field_headers(): client = EntityTypesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4272,8 +4298,8 @@ async def test_batch_create_entities_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - entity_type.BatchUpdateEntitiesRequest, - dict, + entity_type.BatchUpdateEntitiesRequest(), + {}, ], ) def test_batch_update_entities(request_type, transport: str = "grpc"): @@ -4284,7 +4310,7 @@ def test_batch_update_entities(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4330,10 +4356,11 @@ def test_batch_update_entities_non_empty_request_with_auto_populated_field(): client.batch_update_entities(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == entity_type.BatchUpdateEntitiesRequest( + request_msg = entity_type.BatchUpdateEntitiesRequest( parent="parent_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_batch_update_entities_use_cached_wrapped_rpc(): @@ -4429,8 +4456,15 @@ async def test_batch_update_entities_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + entity_type.BatchUpdateEntitiesRequest(), + {}, + ], +) async def test_batch_update_entities_async( - transport: str = "grpc_asyncio", request_type=entity_type.BatchUpdateEntitiesRequest + request_type, transport: str = "grpc_asyncio" ): client = EntityTypesAsyncClient( credentials=async_anonymous_credentials(), @@ -4439,7 +4473,7 @@ async def test_batch_update_entities_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( @@ -4461,11 +4495,6 @@ async def test_batch_update_entities_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_batch_update_entities_async_from_dict(): - await test_batch_update_entities_async(request_type=dict) - - def test_batch_update_entities_field_headers(): client = EntityTypesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4640,8 +4669,8 @@ async def test_batch_update_entities_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - entity_type.BatchDeleteEntitiesRequest, - dict, + entity_type.BatchDeleteEntitiesRequest(), + {}, ], ) def test_batch_delete_entities(request_type, transport: str = "grpc"): @@ -4652,7 +4681,7 @@ def test_batch_delete_entities(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4698,10 +4727,11 @@ def test_batch_delete_entities_non_empty_request_with_auto_populated_field(): client.batch_delete_entities(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == entity_type.BatchDeleteEntitiesRequest( + request_msg = entity_type.BatchDeleteEntitiesRequest( parent="parent_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_batch_delete_entities_use_cached_wrapped_rpc(): @@ -4797,8 +4827,15 @@ async def test_batch_delete_entities_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + entity_type.BatchDeleteEntitiesRequest(), + {}, + ], +) async def test_batch_delete_entities_async( - transport: str = "grpc_asyncio", request_type=entity_type.BatchDeleteEntitiesRequest + request_type, transport: str = "grpc_asyncio" ): client = EntityTypesAsyncClient( credentials=async_anonymous_credentials(), @@ -4807,7 +4844,7 @@ async def test_batch_delete_entities_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( @@ -4829,11 +4866,6 @@ async def test_batch_delete_entities_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_batch_delete_entities_async_from_dict(): - await test_batch_delete_entities_async(request_type=dict) - - def test_batch_delete_entities_field_headers(): client = EntityTypesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7054,7 +7086,6 @@ def test_list_entity_types_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.ListEntityTypesRequest() - assert args[0] == request_msg @@ -7075,7 +7106,6 @@ def test_get_entity_type_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.GetEntityTypeRequest() - assert args[0] == request_msg @@ -7098,7 +7128,6 @@ def test_create_entity_type_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_entity_type.CreateEntityTypeRequest() - assert args[0] == request_msg @@ -7121,7 +7150,6 @@ def test_update_entity_type_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_entity_type.UpdateEntityTypeRequest() - assert args[0] == request_msg @@ -7144,7 +7172,6 @@ def test_delete_entity_type_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.DeleteEntityTypeRequest() - assert args[0] == request_msg @@ -7167,7 +7194,6 @@ def test_batch_update_entity_types_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.BatchUpdateEntityTypesRequest() - assert args[0] == request_msg @@ -7190,7 +7216,6 @@ def test_batch_delete_entity_types_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.BatchDeleteEntityTypesRequest() - assert args[0] == request_msg @@ -7213,7 +7238,6 @@ def test_batch_create_entities_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.BatchCreateEntitiesRequest() - assert args[0] == request_msg @@ -7236,7 +7260,6 @@ def test_batch_update_entities_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.BatchUpdateEntitiesRequest() - assert args[0] == request_msg @@ -7259,7 +7282,6 @@ def test_batch_delete_entities_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.BatchDeleteEntitiesRequest() - assert args[0] == request_msg @@ -7302,7 +7324,6 @@ async def test_list_entity_types_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.ListEntityTypesRequest() - assert args[0] == request_msg @@ -7333,7 +7354,6 @@ async def test_get_entity_type_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.GetEntityTypeRequest() - assert args[0] == request_msg @@ -7366,7 +7386,6 @@ async def test_create_entity_type_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_entity_type.CreateEntityTypeRequest() - assert args[0] == request_msg @@ -7399,7 +7418,6 @@ async def test_update_entity_type_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_entity_type.UpdateEntityTypeRequest() - assert args[0] == request_msg @@ -7424,7 +7442,6 @@ async def test_delete_entity_type_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.DeleteEntityTypeRequest() - assert args[0] == request_msg @@ -7451,7 +7468,6 @@ async def test_batch_update_entity_types_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.BatchUpdateEntityTypesRequest() - assert args[0] == request_msg @@ -7478,7 +7494,6 @@ async def test_batch_delete_entity_types_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.BatchDeleteEntityTypesRequest() - assert args[0] == request_msg @@ -7505,7 +7520,6 @@ async def test_batch_create_entities_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.BatchCreateEntitiesRequest() - assert args[0] == request_msg @@ -7532,7 +7546,6 @@ async def test_batch_update_entities_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.BatchUpdateEntitiesRequest() - assert args[0] == request_msg @@ -7559,7 +7572,6 @@ async def test_batch_delete_entities_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.BatchDeleteEntitiesRequest() - assert args[0] == request_msg @@ -9363,7 +9375,6 @@ def test_list_entity_types_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.ListEntityTypesRequest() - assert args[0] == request_msg @@ -9383,7 +9394,6 @@ def test_get_entity_type_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.GetEntityTypeRequest() - assert args[0] == request_msg @@ -9405,7 +9415,6 @@ def test_create_entity_type_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_entity_type.CreateEntityTypeRequest() - assert args[0] == request_msg @@ -9427,7 +9436,6 @@ def test_update_entity_type_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_entity_type.UpdateEntityTypeRequest() - assert args[0] == request_msg @@ -9449,7 +9457,6 @@ def test_delete_entity_type_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.DeleteEntityTypeRequest() - assert args[0] == request_msg @@ -9471,7 +9478,6 @@ def test_batch_update_entity_types_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.BatchUpdateEntityTypesRequest() - assert args[0] == request_msg @@ -9493,7 +9499,6 @@ def test_batch_delete_entity_types_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.BatchDeleteEntityTypesRequest() - assert args[0] == request_msg @@ -9515,7 +9520,6 @@ def test_batch_create_entities_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.BatchCreateEntitiesRequest() - assert args[0] == request_msg @@ -9537,7 +9541,6 @@ def test_batch_update_entities_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.BatchUpdateEntitiesRequest() - assert args[0] == request_msg @@ -9559,7 +9562,6 @@ def test_batch_delete_entities_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.BatchDeleteEntitiesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_environments.py b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_environments.py index 0d172bb8f8d9..77616e2d64c8 100644 --- a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_environments.py +++ b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_environments.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" @@ -1294,8 +1310,8 @@ def test_environments_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - environment.ListEnvironmentsRequest, - dict, + environment.ListEnvironmentsRequest(), + {}, ], ) def test_list_environments(request_type, transport: str = "grpc"): @@ -1306,7 +1322,7 @@ def test_list_environments(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1355,10 +1371,11 @@ def test_list_environments_non_empty_request_with_auto_populated_field(): client.list_environments(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environment.ListEnvironmentsRequest( + request_msg = environment.ListEnvironmentsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_environments_use_cached_wrapped_rpc(): @@ -1441,9 +1458,14 @@ async def test_list_environments_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_environments_async( - transport: str = "grpc_asyncio", request_type=environment.ListEnvironmentsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + environment.ListEnvironmentsRequest(), + {}, + ], +) +async def test_list_environments_async(request_type, transport: str = "grpc_asyncio"): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1451,7 +1473,7 @@ async def test_list_environments_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( @@ -1476,11 +1498,6 @@ async def test_list_environments_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_environments_async_from_dict(): - await test_list_environments_async(request_type=dict) - - def test_list_environments_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1833,8 +1850,8 @@ async def test_list_environments_async_pages(): @pytest.mark.parametrize( "request_type", [ - environment.GetEnvironmentRequest, - dict, + environment.GetEnvironmentRequest(), + {}, ], ) def test_get_environment(request_type, transport: str = "grpc"): @@ -1845,7 +1862,7 @@ def test_get_environment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_environment), "__call__") as call: @@ -1895,9 +1912,10 @@ def test_get_environment_non_empty_request_with_auto_populated_field(): client.get_environment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environment.GetEnvironmentRequest( + request_msg = environment.GetEnvironmentRequest( name="name_value", ) + assert args[0] == request_msg def test_get_environment_use_cached_wrapped_rpc(): @@ -1978,9 +1996,14 @@ async def test_get_environment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_environment_async( - transport: str = "grpc_asyncio", request_type=environment.GetEnvironmentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + environment.GetEnvironmentRequest(), + {}, + ], +) +async def test_get_environment_async(request_type, transport: str = "grpc_asyncio"): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1988,7 +2011,7 @@ async def test_get_environment_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_environment), "__call__") as call: @@ -2017,11 +2040,6 @@ async def test_get_environment_async( assert response.state == environment.Environment.State.STOPPED -@pytest.mark.asyncio -async def test_get_environment_async_from_dict(): - await test_get_environment_async(request_type=dict) - - def test_get_environment_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2086,8 +2104,8 @@ async def test_get_environment_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - environment.CreateEnvironmentRequest, - dict, + environment.CreateEnvironmentRequest(), + {}, ], ) def test_create_environment(request_type, transport: str = "grpc"): @@ -2098,7 +2116,7 @@ def test_create_environment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2153,10 +2171,11 @@ def test_create_environment_non_empty_request_with_auto_populated_field(): client.create_environment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environment.CreateEnvironmentRequest( + request_msg = environment.CreateEnvironmentRequest( parent="parent_value", environment_id="environment_id_value", ) + assert args[0] == request_msg def test_create_environment_use_cached_wrapped_rpc(): @@ -2241,9 +2260,14 @@ async def test_create_environment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_environment_async( - transport: str = "grpc_asyncio", request_type=environment.CreateEnvironmentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + environment.CreateEnvironmentRequest(), + {}, + ], +) +async def test_create_environment_async(request_type, transport: str = "grpc_asyncio"): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2251,7 +2275,7 @@ async def test_create_environment_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( @@ -2282,11 +2306,6 @@ async def test_create_environment_async( assert response.state == environment.Environment.State.STOPPED -@pytest.mark.asyncio -async def test_create_environment_async_from_dict(): - await test_create_environment_async(request_type=dict) - - def test_create_environment_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2355,8 +2374,8 @@ async def test_create_environment_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - environment.UpdateEnvironmentRequest, - dict, + environment.UpdateEnvironmentRequest(), + {}, ], ) def test_update_environment(request_type, transport: str = "grpc"): @@ -2367,7 +2386,7 @@ def test_update_environment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2419,7 +2438,8 @@ def test_update_environment_non_empty_request_with_auto_populated_field(): client.update_environment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environment.UpdateEnvironmentRequest() + request_msg = environment.UpdateEnvironmentRequest() + assert args[0] == request_msg def test_update_environment_use_cached_wrapped_rpc(): @@ -2504,9 +2524,14 @@ async def test_update_environment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_environment_async( - transport: str = "grpc_asyncio", request_type=environment.UpdateEnvironmentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + environment.UpdateEnvironmentRequest(), + {}, + ], +) +async def test_update_environment_async(request_type, transport: str = "grpc_asyncio"): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2514,7 +2539,7 @@ async def test_update_environment_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( @@ -2545,11 +2570,6 @@ async def test_update_environment_async( assert response.state == environment.Environment.State.STOPPED -@pytest.mark.asyncio -async def test_update_environment_async_from_dict(): - await test_update_environment_async(request_type=dict) - - def test_update_environment_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2618,8 +2638,8 @@ async def test_update_environment_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - environment.DeleteEnvironmentRequest, - dict, + environment.DeleteEnvironmentRequest(), + {}, ], ) def test_delete_environment(request_type, transport: str = "grpc"): @@ -2630,7 +2650,7 @@ def test_delete_environment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2675,9 +2695,10 @@ def test_delete_environment_non_empty_request_with_auto_populated_field(): client.delete_environment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environment.DeleteEnvironmentRequest( + request_msg = environment.DeleteEnvironmentRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_environment_use_cached_wrapped_rpc(): @@ -2762,9 +2783,14 @@ async def test_delete_environment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_environment_async( - transport: str = "grpc_asyncio", request_type=environment.DeleteEnvironmentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + environment.DeleteEnvironmentRequest(), + {}, + ], +) +async def test_delete_environment_async(request_type, transport: str = "grpc_asyncio"): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2772,7 +2798,7 @@ async def test_delete_environment_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( @@ -2792,11 +2818,6 @@ async def test_delete_environment_async( assert response is None -@pytest.mark.asyncio -async def test_delete_environment_async_from_dict(): - await test_delete_environment_async(request_type=dict) - - def test_delete_environment_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2863,8 +2884,8 @@ async def test_delete_environment_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - environment.GetEnvironmentHistoryRequest, - dict, + environment.GetEnvironmentHistoryRequest(), + {}, ], ) def test_get_environment_history(request_type, transport: str = "grpc"): @@ -2875,7 +2896,7 @@ def test_get_environment_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( @@ -2926,10 +2947,11 @@ def test_get_environment_history_non_empty_request_with_auto_populated_field(): client.get_environment_history(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environment.GetEnvironmentHistoryRequest( + request_msg = environment.GetEnvironmentHistoryRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_get_environment_history_use_cached_wrapped_rpc(): @@ -3015,9 +3037,15 @@ async def test_get_environment_history_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + environment.GetEnvironmentHistoryRequest(), + {}, + ], +) async def test_get_environment_history_async( - transport: str = "grpc_asyncio", - request_type=environment.GetEnvironmentHistoryRequest, + request_type, transport: str = "grpc_asyncio" ): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), @@ -3026,7 +3054,7 @@ async def test_get_environment_history_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( @@ -3053,11 +3081,6 @@ async def test_get_environment_history_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_get_environment_history_async_from_dict(): - await test_get_environment_history_async(request_type=dict) - - def test_get_environment_history_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4436,7 +4459,6 @@ def test_list_environments_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.ListEnvironmentsRequest() - assert args[0] == request_msg @@ -4457,7 +4479,6 @@ def test_get_environment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.GetEnvironmentRequest() - assert args[0] == request_msg @@ -4480,7 +4501,6 @@ def test_create_environment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.CreateEnvironmentRequest() - assert args[0] == request_msg @@ -4503,7 +4523,6 @@ def test_update_environment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.UpdateEnvironmentRequest() - assert args[0] == request_msg @@ -4526,7 +4545,6 @@ def test_delete_environment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.DeleteEnvironmentRequest() - assert args[0] == request_msg @@ -4549,7 +4567,6 @@ def test_get_environment_history_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.GetEnvironmentHistoryRequest() - assert args[0] == request_msg @@ -4592,7 +4609,6 @@ async def test_list_environments_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.ListEnvironmentsRequest() - assert args[0] == request_msg @@ -4622,7 +4638,6 @@ async def test_get_environment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.GetEnvironmentRequest() - assert args[0] == request_msg @@ -4654,7 +4669,6 @@ async def test_create_environment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.CreateEnvironmentRequest() - assert args[0] == request_msg @@ -4686,7 +4700,6 @@ async def test_update_environment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.UpdateEnvironmentRequest() - assert args[0] == request_msg @@ -4711,7 +4724,6 @@ async def test_delete_environment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.DeleteEnvironmentRequest() - assert args[0] == request_msg @@ -4741,7 +4753,6 @@ async def test_get_environment_history_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.GetEnvironmentHistoryRequest() - assert args[0] == request_msg @@ -6067,7 +6078,6 @@ def test_list_environments_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.ListEnvironmentsRequest() - assert args[0] == request_msg @@ -6087,7 +6097,6 @@ def test_get_environment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.GetEnvironmentRequest() - assert args[0] == request_msg @@ -6109,7 +6118,6 @@ def test_create_environment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.CreateEnvironmentRequest() - assert args[0] == request_msg @@ -6131,7 +6139,6 @@ def test_update_environment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.UpdateEnvironmentRequest() - assert args[0] == request_msg @@ -6153,7 +6160,6 @@ def test_delete_environment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.DeleteEnvironmentRequest() - assert args[0] == request_msg @@ -6175,7 +6181,6 @@ def test_get_environment_history_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.GetEnvironmentHistoryRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_fulfillments.py b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_fulfillments.py index 6b43f62361a6..00ae535fce8d 100644 --- a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_fulfillments.py +++ b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_fulfillments.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 @@ -110,6 +111,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" @@ -1293,8 +1309,8 @@ def test_fulfillments_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - fulfillment.GetFulfillmentRequest, - dict, + fulfillment.GetFulfillmentRequest(), + {}, ], ) def test_get_fulfillment(request_type, transport: str = "grpc"): @@ -1305,7 +1321,7 @@ def test_get_fulfillment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_fulfillment), "__call__") as call: @@ -1353,9 +1369,10 @@ def test_get_fulfillment_non_empty_request_with_auto_populated_field(): client.get_fulfillment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == fulfillment.GetFulfillmentRequest( + request_msg = fulfillment.GetFulfillmentRequest( name="name_value", ) + assert args[0] == request_msg def test_get_fulfillment_use_cached_wrapped_rpc(): @@ -1436,9 +1453,14 @@ async def test_get_fulfillment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_fulfillment_async( - transport: str = "grpc_asyncio", request_type=fulfillment.GetFulfillmentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + fulfillment.GetFulfillmentRequest(), + {}, + ], +) +async def test_get_fulfillment_async(request_type, transport: str = "grpc_asyncio"): client = FulfillmentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1446,7 +1468,7 @@ async def test_get_fulfillment_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_fulfillment), "__call__") as call: @@ -1473,11 +1495,6 @@ async def test_get_fulfillment_async( assert response.enabled is True -@pytest.mark.asyncio -async def test_get_fulfillment_async_from_dict(): - await test_get_fulfillment_async(request_type=dict) - - def test_get_fulfillment_field_headers(): client = FulfillmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1624,8 +1641,8 @@ async def test_get_fulfillment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcd_fulfillment.UpdateFulfillmentRequest, - dict, + gcd_fulfillment.UpdateFulfillmentRequest(), + {}, ], ) def test_update_fulfillment(request_type, transport: str = "grpc"): @@ -1636,7 +1653,7 @@ def test_update_fulfillment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1686,7 +1703,8 @@ def test_update_fulfillment_non_empty_request_with_auto_populated_field(): client.update_fulfillment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_fulfillment.UpdateFulfillmentRequest() + request_msg = gcd_fulfillment.UpdateFulfillmentRequest() + assert args[0] == request_msg def test_update_fulfillment_use_cached_wrapped_rpc(): @@ -1771,10 +1789,14 @@ async def test_update_fulfillment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_fulfillment_async( - transport: str = "grpc_asyncio", - request_type=gcd_fulfillment.UpdateFulfillmentRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + gcd_fulfillment.UpdateFulfillmentRequest(), + {}, + ], +) +async def test_update_fulfillment_async(request_type, transport: str = "grpc_asyncio"): client = FulfillmentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1782,7 +1804,7 @@ async def test_update_fulfillment_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( @@ -1811,11 +1833,6 @@ async def test_update_fulfillment_async( assert response.enabled is True -@pytest.mark.asyncio -async def test_update_fulfillment_async_from_dict(): - await test_update_fulfillment_async(request_type=dict) - - def test_update_fulfillment_field_headers(): client = FulfillmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2467,7 +2484,6 @@ def test_get_fulfillment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = fulfillment.GetFulfillmentRequest() - assert args[0] == request_msg @@ -2490,7 +2506,6 @@ def test_update_fulfillment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_fulfillment.UpdateFulfillmentRequest() - assert args[0] == request_msg @@ -2533,7 +2548,6 @@ async def test_get_fulfillment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = fulfillment.GetFulfillmentRequest() - assert args[0] == request_msg @@ -2564,7 +2578,6 @@ async def test_update_fulfillment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_fulfillment.UpdateFulfillmentRequest() - assert args[0] == request_msg @@ -3258,7 +3271,6 @@ def test_get_fulfillment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = fulfillment.GetFulfillmentRequest() - assert args[0] == request_msg @@ -3280,7 +3292,6 @@ def test_update_fulfillment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_fulfillment.UpdateFulfillmentRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_generator_evaluations.py b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_generator_evaluations.py index 085e681ba67c..7acad967389f 100644 --- a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_generator_evaluations.py +++ b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_generator_evaluations.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 @@ -130,6 +131,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" @@ -1396,8 +1412,8 @@ def test_generator_evaluations_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - gcd_generator_evaluation.CreateGeneratorEvaluationRequest, - dict, + gcd_generator_evaluation.CreateGeneratorEvaluationRequest(), + {}, ], ) def test_create_generator_evaluation(request_type, transport: str = "grpc"): @@ -1408,7 +1424,7 @@ def test_create_generator_evaluation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1453,9 +1469,10 @@ def test_create_generator_evaluation_non_empty_request_with_auto_populated_field client.create_generator_evaluation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_generator_evaluation.CreateGeneratorEvaluationRequest( + request_msg = gcd_generator_evaluation.CreateGeneratorEvaluationRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_generator_evaluation_use_cached_wrapped_rpc(): @@ -1551,9 +1568,15 @@ async def test_create_generator_evaluation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcd_generator_evaluation.CreateGeneratorEvaluationRequest(), + {}, + ], +) async def test_create_generator_evaluation_async( - transport: str = "grpc_asyncio", - request_type=gcd_generator_evaluation.CreateGeneratorEvaluationRequest, + request_type, transport: str = "grpc_asyncio" ): client = GeneratorEvaluationsAsyncClient( credentials=async_anonymous_credentials(), @@ -1562,7 +1585,7 @@ async def test_create_generator_evaluation_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( @@ -1584,11 +1607,6 @@ async def test_create_generator_evaluation_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_generator_evaluation_async_from_dict(): - await test_create_generator_evaluation_async(request_type=dict) - - def test_create_generator_evaluation_field_headers(): client = GeneratorEvaluationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1761,8 +1779,8 @@ async def test_create_generator_evaluation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - generator_evaluation.GetGeneratorEvaluationRequest, - dict, + generator_evaluation.GetGeneratorEvaluationRequest(), + {}, ], ) def test_get_generator_evaluation(request_type, transport: str = "grpc"): @@ -1773,7 +1791,7 @@ def test_get_generator_evaluation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1827,9 +1845,10 @@ def test_get_generator_evaluation_non_empty_request_with_auto_populated_field(): client.get_generator_evaluation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == generator_evaluation.GetGeneratorEvaluationRequest( + request_msg = generator_evaluation.GetGeneratorEvaluationRequest( name="name_value", ) + assert args[0] == request_msg def test_get_generator_evaluation_use_cached_wrapped_rpc(): @@ -1915,9 +1934,15 @@ async def test_get_generator_evaluation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + generator_evaluation.GetGeneratorEvaluationRequest(), + {}, + ], +) async def test_get_generator_evaluation_async( - transport: str = "grpc_asyncio", - request_type=generator_evaluation.GetGeneratorEvaluationRequest, + request_type, transport: str = "grpc_asyncio" ): client = GeneratorEvaluationsAsyncClient( credentials=async_anonymous_credentials(), @@ -1926,7 +1951,7 @@ async def test_get_generator_evaluation_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( @@ -1957,11 +1982,6 @@ async def test_get_generator_evaluation_async( assert response.satisfies_pzi is True -@pytest.mark.asyncio -async def test_get_generator_evaluation_async_from_dict(): - await test_get_generator_evaluation_async(request_type=dict) - - def test_get_generator_evaluation_field_headers(): client = GeneratorEvaluationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2116,8 +2136,8 @@ async def test_get_generator_evaluation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - generator_evaluation.ListGeneratorEvaluationsRequest, - dict, + generator_evaluation.ListGeneratorEvaluationsRequest(), + {}, ], ) def test_list_generator_evaluations(request_type, transport: str = "grpc"): @@ -2128,7 +2148,7 @@ def test_list_generator_evaluations(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2177,10 +2197,11 @@ def test_list_generator_evaluations_non_empty_request_with_auto_populated_field( client.list_generator_evaluations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == generator_evaluation.ListGeneratorEvaluationsRequest( + request_msg = generator_evaluation.ListGeneratorEvaluationsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_generator_evaluations_use_cached_wrapped_rpc(): @@ -2266,9 +2287,15 @@ async def test_list_generator_evaluations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + generator_evaluation.ListGeneratorEvaluationsRequest(), + {}, + ], +) async def test_list_generator_evaluations_async( - transport: str = "grpc_asyncio", - request_type=generator_evaluation.ListGeneratorEvaluationsRequest, + request_type, transport: str = "grpc_asyncio" ): client = GeneratorEvaluationsAsyncClient( credentials=async_anonymous_credentials(), @@ -2277,7 +2304,7 @@ async def test_list_generator_evaluations_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( @@ -2302,11 +2329,6 @@ async def test_list_generator_evaluations_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_generator_evaluations_async_from_dict(): - await test_list_generator_evaluations_async(request_type=dict) - - def test_list_generator_evaluations_field_headers(): client = GeneratorEvaluationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2665,8 +2687,8 @@ async def test_list_generator_evaluations_async_pages(): @pytest.mark.parametrize( "request_type", [ - generator_evaluation.DeleteGeneratorEvaluationRequest, - dict, + generator_evaluation.DeleteGeneratorEvaluationRequest(), + {}, ], ) def test_delete_generator_evaluation(request_type, transport: str = "grpc"): @@ -2677,7 +2699,7 @@ def test_delete_generator_evaluation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2722,9 +2744,10 @@ def test_delete_generator_evaluation_non_empty_request_with_auto_populated_field client.delete_generator_evaluation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == generator_evaluation.DeleteGeneratorEvaluationRequest( + request_msg = generator_evaluation.DeleteGeneratorEvaluationRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_generator_evaluation_use_cached_wrapped_rpc(): @@ -2810,9 +2833,15 @@ async def test_delete_generator_evaluation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + generator_evaluation.DeleteGeneratorEvaluationRequest(), + {}, + ], +) async def test_delete_generator_evaluation_async( - transport: str = "grpc_asyncio", - request_type=generator_evaluation.DeleteGeneratorEvaluationRequest, + request_type, transport: str = "grpc_asyncio" ): client = GeneratorEvaluationsAsyncClient( credentials=async_anonymous_credentials(), @@ -2821,7 +2850,7 @@ async def test_delete_generator_evaluation_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( @@ -2841,11 +2870,6 @@ async def test_delete_generator_evaluation_async( assert response is None -@pytest.mark.asyncio -async def test_delete_generator_evaluation_async_from_dict(): - await test_delete_generator_evaluation_async(request_type=dict) - - def test_delete_generator_evaluation_field_headers(): client = GeneratorEvaluationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3954,7 +3978,6 @@ def test_create_generator_evaluation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_generator_evaluation.CreateGeneratorEvaluationRequest() - assert args[0] == request_msg @@ -3977,7 +4000,6 @@ def test_get_generator_evaluation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generator_evaluation.GetGeneratorEvaluationRequest() - assert args[0] == request_msg @@ -4000,7 +4022,6 @@ def test_list_generator_evaluations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generator_evaluation.ListGeneratorEvaluationsRequest() - assert args[0] == request_msg @@ -4023,7 +4044,6 @@ def test_delete_generator_evaluation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generator_evaluation.DeleteGeneratorEvaluationRequest() - assert args[0] == request_msg @@ -4064,7 +4084,6 @@ async def test_create_generator_evaluation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_generator_evaluation.CreateGeneratorEvaluationRequest() - assert args[0] == request_msg @@ -4096,7 +4115,6 @@ async def test_get_generator_evaluation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generator_evaluation.GetGeneratorEvaluationRequest() - assert args[0] == request_msg @@ -4125,7 +4143,6 @@ async def test_list_generator_evaluations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generator_evaluation.ListGeneratorEvaluationsRequest() - assert args[0] == request_msg @@ -4150,7 +4167,6 @@ async def test_delete_generator_evaluation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generator_evaluation.DeleteGeneratorEvaluationRequest() - assert args[0] == request_msg @@ -5351,7 +5367,6 @@ def test_create_generator_evaluation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_generator_evaluation.CreateGeneratorEvaluationRequest() - assert args[0] == request_msg @@ -5373,7 +5388,6 @@ def test_get_generator_evaluation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generator_evaluation.GetGeneratorEvaluationRequest() - assert args[0] == request_msg @@ -5395,7 +5409,6 @@ def test_list_generator_evaluations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generator_evaluation.ListGeneratorEvaluationsRequest() - assert args[0] == request_msg @@ -5417,7 +5430,6 @@ def test_delete_generator_evaluation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generator_evaluation.DeleteGeneratorEvaluationRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_generators.py b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_generators.py index c9e75f20d530..cea141ce8c18 100644 --- a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_generators.py +++ b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_generators.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 @@ -121,6 +122,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" @@ -1285,8 +1301,8 @@ def test_generators_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - gcd_generator.CreateGeneratorRequest, - dict, + gcd_generator.CreateGeneratorRequest(), + {}, ], ) def test_create_generator(request_type, transport: str = "grpc"): @@ -1297,7 +1313,7 @@ def test_create_generator(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_generator), "__call__") as call: @@ -1349,10 +1365,11 @@ def test_create_generator_non_empty_request_with_auto_populated_field(): client.create_generator(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_generator.CreateGeneratorRequest( + request_msg = gcd_generator.CreateGeneratorRequest( parent="parent_value", generator_id="generator_id_value", ) + assert args[0] == request_msg def test_create_generator_use_cached_wrapped_rpc(): @@ -1435,9 +1452,14 @@ async def test_create_generator_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_generator_async( - transport: str = "grpc_asyncio", request_type=gcd_generator.CreateGeneratorRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcd_generator.CreateGeneratorRequest(), + {}, + ], +) +async def test_create_generator_async(request_type, transport: str = "grpc_asyncio"): client = GeneratorsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1445,7 +1467,7 @@ async def test_create_generator_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_generator), "__call__") as call: @@ -1474,11 +1496,6 @@ async def test_create_generator_async( assert response.tools == ["tools_value"] -@pytest.mark.asyncio -async def test_create_generator_async_from_dict(): - await test_create_generator_async(request_type=dict) - - def test_create_generator_field_headers(): client = GeneratorsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1645,8 +1662,8 @@ async def test_create_generator_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - generator.GetGeneratorRequest, - dict, + generator.GetGeneratorRequest(), + {}, ], ) def test_get_generator(request_type, transport: str = "grpc"): @@ -1657,7 +1674,7 @@ def test_get_generator(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_generator), "__call__") as call: @@ -1708,9 +1725,10 @@ def test_get_generator_non_empty_request_with_auto_populated_field(): client.get_generator(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == generator.GetGeneratorRequest( + request_msg = generator.GetGeneratorRequest( name="name_value", ) + assert args[0] == request_msg def test_get_generator_use_cached_wrapped_rpc(): @@ -1791,9 +1809,14 @@ async def test_get_generator_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_generator_async( - transport: str = "grpc_asyncio", request_type=generator.GetGeneratorRequest -): +@pytest.mark.parametrize( + "request_type", + [ + generator.GetGeneratorRequest(), + {}, + ], +) +async def test_get_generator_async(request_type, transport: str = "grpc_asyncio"): client = GeneratorsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1801,7 +1824,7 @@ async def test_get_generator_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_generator), "__call__") as call: @@ -1830,11 +1853,6 @@ async def test_get_generator_async( assert response.tools == ["tools_value"] -@pytest.mark.asyncio -async def test_get_generator_async_from_dict(): - await test_get_generator_async(request_type=dict) - - def test_get_generator_field_headers(): client = GeneratorsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1977,8 +1995,8 @@ async def test_get_generator_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - generator.ListGeneratorsRequest, - dict, + generator.ListGeneratorsRequest(), + {}, ], ) def test_list_generators(request_type, transport: str = "grpc"): @@ -1989,7 +2007,7 @@ def test_list_generators(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_generators), "__call__") as call: @@ -2034,10 +2052,11 @@ def test_list_generators_non_empty_request_with_auto_populated_field(): client.list_generators(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == generator.ListGeneratorsRequest( + request_msg = generator.ListGeneratorsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_generators_use_cached_wrapped_rpc(): @@ -2118,9 +2137,14 @@ async def test_list_generators_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_generators_async( - transport: str = "grpc_asyncio", request_type=generator.ListGeneratorsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + generator.ListGeneratorsRequest(), + {}, + ], +) +async def test_list_generators_async(request_type, transport: str = "grpc_asyncio"): client = GeneratorsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2128,7 +2152,7 @@ async def test_list_generators_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_generators), "__call__") as call: @@ -2151,11 +2175,6 @@ async def test_list_generators_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_generators_async_from_dict(): - await test_list_generators_async(request_type=dict) - - def test_list_generators_field_headers(): client = GeneratorsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2492,8 +2511,8 @@ async def test_list_generators_async_pages(): @pytest.mark.parametrize( "request_type", [ - generator.DeleteGeneratorRequest, - dict, + generator.DeleteGeneratorRequest(), + {}, ], ) def test_delete_generator(request_type, transport: str = "grpc"): @@ -2504,7 +2523,7 @@ def test_delete_generator(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_generator), "__call__") as call: @@ -2545,9 +2564,10 @@ def test_delete_generator_non_empty_request_with_auto_populated_field(): client.delete_generator(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == generator.DeleteGeneratorRequest( + request_msg = generator.DeleteGeneratorRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_generator_use_cached_wrapped_rpc(): @@ -2630,9 +2650,14 @@ async def test_delete_generator_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_generator_async( - transport: str = "grpc_asyncio", request_type=generator.DeleteGeneratorRequest -): +@pytest.mark.parametrize( + "request_type", + [ + generator.DeleteGeneratorRequest(), + {}, + ], +) +async def test_delete_generator_async(request_type, transport: str = "grpc_asyncio"): client = GeneratorsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2640,7 +2665,7 @@ async def test_delete_generator_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_generator), "__call__") as call: @@ -2658,11 +2683,6 @@ async def test_delete_generator_async( assert response is None -@pytest.mark.asyncio -async def test_delete_generator_async_from_dict(): - await test_delete_generator_async(request_type=dict) - - def test_delete_generator_field_headers(): client = GeneratorsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2805,8 +2825,8 @@ async def test_delete_generator_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcd_generator.UpdateGeneratorRequest, - dict, + gcd_generator.UpdateGeneratorRequest(), + {}, ], ) def test_update_generator(request_type, transport: str = "grpc"): @@ -2817,7 +2837,7 @@ def test_update_generator(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_generator), "__call__") as call: @@ -2866,7 +2886,8 @@ def test_update_generator_non_empty_request_with_auto_populated_field(): client.update_generator(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_generator.UpdateGeneratorRequest() + request_msg = gcd_generator.UpdateGeneratorRequest() + assert args[0] == request_msg def test_update_generator_use_cached_wrapped_rpc(): @@ -2949,9 +2970,14 @@ async def test_update_generator_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_generator_async( - transport: str = "grpc_asyncio", request_type=gcd_generator.UpdateGeneratorRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcd_generator.UpdateGeneratorRequest(), + {}, + ], +) +async def test_update_generator_async(request_type, transport: str = "grpc_asyncio"): client = GeneratorsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2959,7 +2985,7 @@ async def test_update_generator_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_generator), "__call__") as call: @@ -2988,11 +3014,6 @@ async def test_update_generator_async( assert response.tools == ["tools_value"] -@pytest.mark.asyncio -async def test_update_generator_async_from_dict(): - await test_update_generator_async(request_type=dict) - - def test_update_generator_field_headers(): client = GeneratorsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4253,7 +4274,6 @@ def test_create_generator_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_generator.CreateGeneratorRequest() - assert args[0] == request_msg @@ -4274,7 +4294,6 @@ def test_get_generator_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generator.GetGeneratorRequest() - assert args[0] == request_msg @@ -4295,7 +4314,6 @@ def test_list_generators_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generator.ListGeneratorsRequest() - assert args[0] == request_msg @@ -4316,7 +4334,6 @@ def test_delete_generator_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generator.DeleteGeneratorRequest() - assert args[0] == request_msg @@ -4337,7 +4354,6 @@ def test_update_generator_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_generator.UpdateGeneratorRequest() - assert args[0] == request_msg @@ -4381,7 +4397,6 @@ async def test_create_generator_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_generator.CreateGeneratorRequest() - assert args[0] == request_msg @@ -4411,7 +4426,6 @@ async def test_get_generator_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generator.GetGeneratorRequest() - assert args[0] == request_msg @@ -4438,7 +4452,6 @@ async def test_list_generators_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generator.ListGeneratorsRequest() - assert args[0] == request_msg @@ -4461,7 +4474,6 @@ async def test_delete_generator_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generator.DeleteGeneratorRequest() - assert args[0] == request_msg @@ -4491,7 +4503,6 @@ async def test_update_generator_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_generator.UpdateGeneratorRequest() - assert args[0] == request_msg @@ -5901,7 +5912,6 @@ def test_create_generator_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_generator.CreateGeneratorRequest() - assert args[0] == request_msg @@ -5921,7 +5931,6 @@ def test_get_generator_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generator.GetGeneratorRequest() - assert args[0] == request_msg @@ -5941,7 +5950,6 @@ def test_list_generators_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generator.ListGeneratorsRequest() - assert args[0] == request_msg @@ -5961,7 +5969,6 @@ def test_delete_generator_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generator.DeleteGeneratorRequest() - assert args[0] == request_msg @@ -5981,7 +5988,6 @@ def test_update_generator_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_generator.UpdateGeneratorRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_intents.py b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_intents.py index fdec5364c24b..81932926eb14 100644 --- a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_intents.py +++ b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_intents.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 @@ -117,6 +118,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" @@ -1253,8 +1269,8 @@ def test_intents_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - intent.ListIntentsRequest, - dict, + intent.ListIntentsRequest(), + {}, ], ) def test_list_intents(request_type, transport: str = "grpc"): @@ -1265,7 +1281,7 @@ def test_list_intents(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_intents), "__call__") as call: @@ -1311,11 +1327,12 @@ def test_list_intents_non_empty_request_with_auto_populated_field(): client.list_intents(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == intent.ListIntentsRequest( + request_msg = intent.ListIntentsRequest( parent="parent_value", language_code="language_code_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_intents_use_cached_wrapped_rpc(): @@ -1396,9 +1413,14 @@ async def test_list_intents_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_intents_async( - transport: str = "grpc_asyncio", request_type=intent.ListIntentsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + intent.ListIntentsRequest(), + {}, + ], +) +async def test_list_intents_async(request_type, transport: str = "grpc_asyncio"): client = IntentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1406,7 +1428,7 @@ async def test_list_intents_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_intents), "__call__") as call: @@ -1429,11 +1451,6 @@ async def test_list_intents_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_intents_async_from_dict(): - await test_list_intents_async(request_type=dict) - - def test_list_intents_field_headers(): client = IntentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1780,8 +1797,8 @@ async def test_list_intents_async_pages(): @pytest.mark.parametrize( "request_type", [ - intent.GetIntentRequest, - dict, + intent.GetIntentRequest(), + {}, ], ) def test_get_intent(request_type, transport: str = "grpc"): @@ -1792,7 +1809,7 @@ def test_get_intent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_intent), "__call__") as call: @@ -1867,10 +1884,11 @@ def test_get_intent_non_empty_request_with_auto_populated_field(): client.get_intent(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == intent.GetIntentRequest( + request_msg = intent.GetIntentRequest( name="name_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_get_intent_use_cached_wrapped_rpc(): @@ -1949,9 +1967,14 @@ async def test_get_intent_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_intent_async( - transport: str = "grpc_asyncio", request_type=intent.GetIntentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + intent.GetIntentRequest(), + {}, + ], +) +async def test_get_intent_async(request_type, transport: str = "grpc_asyncio"): client = IntentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1959,7 +1982,7 @@ async def test_get_intent_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_intent), "__call__") as call: @@ -2012,11 +2035,6 @@ async def test_get_intent_async( assert response.parent_followup_intent_name == "parent_followup_intent_name_value" -@pytest.mark.asyncio -async def test_get_intent_async_from_dict(): - await test_get_intent_async(request_type=dict) - - def test_get_intent_field_headers(): client = IntentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2169,8 +2187,8 @@ async def test_get_intent_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcd_intent.CreateIntentRequest, - dict, + gcd_intent.CreateIntentRequest(), + {}, ], ) def test_create_intent(request_type, transport: str = "grpc"): @@ -2181,7 +2199,7 @@ def test_create_intent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_intent), "__call__") as call: @@ -2258,10 +2276,11 @@ def test_create_intent_non_empty_request_with_auto_populated_field(): client.create_intent(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_intent.CreateIntentRequest( + request_msg = gcd_intent.CreateIntentRequest( parent="parent_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_create_intent_use_cached_wrapped_rpc(): @@ -2342,9 +2361,14 @@ async def test_create_intent_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_intent_async( - transport: str = "grpc_asyncio", request_type=gcd_intent.CreateIntentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcd_intent.CreateIntentRequest(), + {}, + ], +) +async def test_create_intent_async(request_type, transport: str = "grpc_asyncio"): client = IntentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2352,7 +2376,7 @@ async def test_create_intent_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_intent), "__call__") as call: @@ -2409,11 +2433,6 @@ async def test_create_intent_async( assert response.parent_followup_intent_name == "parent_followup_intent_name_value" -@pytest.mark.asyncio -async def test_create_intent_async_from_dict(): - await test_create_intent_async(request_type=dict) - - def test_create_intent_field_headers(): client = IntentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2576,8 +2595,8 @@ async def test_create_intent_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcd_intent.UpdateIntentRequest, - dict, + gcd_intent.UpdateIntentRequest(), + {}, ], ) def test_update_intent(request_type, transport: str = "grpc"): @@ -2588,7 +2607,7 @@ def test_update_intent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_intent), "__call__") as call: @@ -2664,9 +2683,10 @@ def test_update_intent_non_empty_request_with_auto_populated_field(): client.update_intent(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_intent.UpdateIntentRequest( + request_msg = gcd_intent.UpdateIntentRequest( language_code="language_code_value", ) + assert args[0] == request_msg def test_update_intent_use_cached_wrapped_rpc(): @@ -2747,9 +2767,14 @@ async def test_update_intent_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_intent_async( - transport: str = "grpc_asyncio", request_type=gcd_intent.UpdateIntentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcd_intent.UpdateIntentRequest(), + {}, + ], +) +async def test_update_intent_async(request_type, transport: str = "grpc_asyncio"): client = IntentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2757,7 +2782,7 @@ async def test_update_intent_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_intent), "__call__") as call: @@ -2814,11 +2839,6 @@ async def test_update_intent_async( assert response.parent_followup_intent_name == "parent_followup_intent_name_value" -@pytest.mark.asyncio -async def test_update_intent_async_from_dict(): - await test_update_intent_async(request_type=dict) - - def test_update_intent_field_headers(): client = IntentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2981,8 +3001,8 @@ async def test_update_intent_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - intent.DeleteIntentRequest, - dict, + intent.DeleteIntentRequest(), + {}, ], ) def test_delete_intent(request_type, transport: str = "grpc"): @@ -2993,7 +3013,7 @@ def test_delete_intent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_intent), "__call__") as call: @@ -3034,9 +3054,10 @@ def test_delete_intent_non_empty_request_with_auto_populated_field(): client.delete_intent(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == intent.DeleteIntentRequest( + request_msg = intent.DeleteIntentRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_intent_use_cached_wrapped_rpc(): @@ -3117,9 +3138,14 @@ async def test_delete_intent_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_intent_async( - transport: str = "grpc_asyncio", request_type=intent.DeleteIntentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + intent.DeleteIntentRequest(), + {}, + ], +) +async def test_delete_intent_async(request_type, transport: str = "grpc_asyncio"): client = IntentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3127,7 +3153,7 @@ async def test_delete_intent_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_intent), "__call__") as call: @@ -3145,11 +3171,6 @@ async def test_delete_intent_async( assert response is None -@pytest.mark.asyncio -async def test_delete_intent_async_from_dict(): - await test_delete_intent_async(request_type=dict) - - def test_delete_intent_field_headers(): client = IntentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3292,8 +3313,8 @@ async def test_delete_intent_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - intent.BatchUpdateIntentsRequest, - dict, + intent.BatchUpdateIntentsRequest(), + {}, ], ) def test_batch_update_intents(request_type, transport: str = "grpc"): @@ -3304,7 +3325,7 @@ def test_batch_update_intents(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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 +3372,12 @@ def test_batch_update_intents_non_empty_request_with_auto_populated_field(): client.batch_update_intents(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == intent.BatchUpdateIntentsRequest( + request_msg = intent.BatchUpdateIntentsRequest( parent="parent_value", intent_batch_uri="intent_batch_uri_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_batch_update_intents_use_cached_wrapped_rpc(): @@ -3450,8 +3472,15 @@ async def test_batch_update_intents_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + intent.BatchUpdateIntentsRequest(), + {}, + ], +) async def test_batch_update_intents_async( - transport: str = "grpc_asyncio", request_type=intent.BatchUpdateIntentsRequest + request_type, transport: str = "grpc_asyncio" ): client = IntentsAsyncClient( credentials=async_anonymous_credentials(), @@ -3460,7 +3489,7 @@ async def test_batch_update_intents_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( @@ -3482,11 +3511,6 @@ async def test_batch_update_intents_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_batch_update_intents_async_from_dict(): - await test_batch_update_intents_async(request_type=dict) - - def test_batch_update_intents_field_headers(): client = IntentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3663,8 +3687,8 @@ async def test_batch_update_intents_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - intent.BatchDeleteIntentsRequest, - dict, + intent.BatchDeleteIntentsRequest(), + {}, ], ) def test_batch_delete_intents(request_type, transport: str = "grpc"): @@ -3675,7 +3699,7 @@ def test_batch_delete_intents(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3720,9 +3744,10 @@ def test_batch_delete_intents_non_empty_request_with_auto_populated_field(): client.batch_delete_intents(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == intent.BatchDeleteIntentsRequest( + request_msg = intent.BatchDeleteIntentsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_batch_delete_intents_use_cached_wrapped_rpc(): @@ -3817,8 +3842,15 @@ async def test_batch_delete_intents_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + intent.BatchDeleteIntentsRequest(), + {}, + ], +) async def test_batch_delete_intents_async( - transport: str = "grpc_asyncio", request_type=intent.BatchDeleteIntentsRequest + request_type, transport: str = "grpc_asyncio" ): client = IntentsAsyncClient( credentials=async_anonymous_credentials(), @@ -3827,7 +3859,7 @@ async def test_batch_delete_intents_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( @@ -3849,11 +3881,6 @@ async def test_batch_delete_intents_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_batch_delete_intents_async_from_dict(): - await test_batch_delete_intents_async(request_type=dict) - - def test_batch_delete_intents_field_headers(): client = IntentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5527,7 +5554,6 @@ def test_list_intents_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intent.ListIntentsRequest() - assert args[0] == request_msg @@ -5548,7 +5574,6 @@ def test_get_intent_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intent.GetIntentRequest() - assert args[0] == request_msg @@ -5569,7 +5594,6 @@ def test_create_intent_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_intent.CreateIntentRequest() - assert args[0] == request_msg @@ -5590,7 +5614,6 @@ def test_update_intent_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_intent.UpdateIntentRequest() - assert args[0] == request_msg @@ -5611,7 +5634,6 @@ def test_delete_intent_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intent.DeleteIntentRequest() - assert args[0] == request_msg @@ -5634,7 +5656,6 @@ def test_batch_update_intents_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intent.BatchUpdateIntentsRequest() - assert args[0] == request_msg @@ -5657,7 +5678,6 @@ def test_batch_delete_intents_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intent.BatchDeleteIntentsRequest() - assert args[0] == request_msg @@ -5698,7 +5718,6 @@ async def test_list_intents_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intent.ListIntentsRequest() - assert args[0] == request_msg @@ -5739,7 +5758,6 @@ async def test_get_intent_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intent.GetIntentRequest() - assert args[0] == request_msg @@ -5782,7 +5800,6 @@ async def test_create_intent_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_intent.CreateIntentRequest() - assert args[0] == request_msg @@ -5825,7 +5842,6 @@ async def test_update_intent_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_intent.UpdateIntentRequest() - assert args[0] == request_msg @@ -5848,7 +5864,6 @@ async def test_delete_intent_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intent.DeleteIntentRequest() - assert args[0] == request_msg @@ -5875,7 +5890,6 @@ async def test_batch_update_intents_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intent.BatchUpdateIntentsRequest() - assert args[0] == request_msg @@ -5902,7 +5916,6 @@ async def test_batch_delete_intents_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intent.BatchDeleteIntentsRequest() - assert args[0] == request_msg @@ -7641,7 +7654,6 @@ def test_list_intents_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intent.ListIntentsRequest() - assert args[0] == request_msg @@ -7661,7 +7673,6 @@ def test_get_intent_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intent.GetIntentRequest() - assert args[0] == request_msg @@ -7681,7 +7692,6 @@ def test_create_intent_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_intent.CreateIntentRequest() - assert args[0] == request_msg @@ -7701,7 +7711,6 @@ def test_update_intent_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_intent.UpdateIntentRequest() - assert args[0] == request_msg @@ -7721,7 +7730,6 @@ def test_delete_intent_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intent.DeleteIntentRequest() - assert args[0] == request_msg @@ -7743,7 +7751,6 @@ def test_batch_update_intents_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intent.BatchUpdateIntentsRequest() - assert args[0] == request_msg @@ -7765,7 +7772,6 @@ def test_batch_delete_intents_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intent.BatchDeleteIntentsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_knowledge_bases.py b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_knowledge_bases.py index da769437e29a..075bf2fc57c8 100644 --- a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_knowledge_bases.py +++ b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_knowledge_bases.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" @@ -1317,8 +1333,8 @@ def test_knowledge_bases_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - knowledge_base.ListKnowledgeBasesRequest, - dict, + knowledge_base.ListKnowledgeBasesRequest(), + {}, ], ) def test_list_knowledge_bases(request_type, transport: str = "grpc"): @@ -1329,7 +1345,7 @@ def test_list_knowledge_bases(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1379,11 +1395,12 @@ def test_list_knowledge_bases_non_empty_request_with_auto_populated_field(): client.list_knowledge_bases(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == knowledge_base.ListKnowledgeBasesRequest( + request_msg = knowledge_base.ListKnowledgeBasesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_knowledge_bases_use_cached_wrapped_rpc(): @@ -1468,9 +1485,15 @@ async def test_list_knowledge_bases_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + knowledge_base.ListKnowledgeBasesRequest(), + {}, + ], +) async def test_list_knowledge_bases_async( - transport: str = "grpc_asyncio", - request_type=knowledge_base.ListKnowledgeBasesRequest, + request_type, transport: str = "grpc_asyncio" ): client = KnowledgeBasesAsyncClient( credentials=async_anonymous_credentials(), @@ -1479,7 +1502,7 @@ async def test_list_knowledge_bases_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( @@ -1504,11 +1527,6 @@ async def test_list_knowledge_bases_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_knowledge_bases_async_from_dict(): - await test_list_knowledge_bases_async(request_type=dict) - - def test_list_knowledge_bases_field_headers(): client = KnowledgeBasesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1861,8 +1879,8 @@ async def test_list_knowledge_bases_async_pages(): @pytest.mark.parametrize( "request_type", [ - knowledge_base.GetKnowledgeBaseRequest, - dict, + knowledge_base.GetKnowledgeBaseRequest(), + {}, ], ) def test_get_knowledge_base(request_type, transport: str = "grpc"): @@ -1873,7 +1891,7 @@ def test_get_knowledge_base(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1925,9 +1943,10 @@ def test_get_knowledge_base_non_empty_request_with_auto_populated_field(): client.get_knowledge_base(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == knowledge_base.GetKnowledgeBaseRequest( + request_msg = knowledge_base.GetKnowledgeBaseRequest( name="name_value", ) + assert args[0] == request_msg def test_get_knowledge_base_use_cached_wrapped_rpc(): @@ -2012,9 +2031,14 @@ async def test_get_knowledge_base_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_knowledge_base_async( - transport: str = "grpc_asyncio", request_type=knowledge_base.GetKnowledgeBaseRequest -): +@pytest.mark.parametrize( + "request_type", + [ + knowledge_base.GetKnowledgeBaseRequest(), + {}, + ], +) +async def test_get_knowledge_base_async(request_type, transport: str = "grpc_asyncio"): client = KnowledgeBasesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2022,7 +2046,7 @@ async def test_get_knowledge_base_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( @@ -2051,11 +2075,6 @@ async def test_get_knowledge_base_async( assert response.language_code == "language_code_value" -@pytest.mark.asyncio -async def test_get_knowledge_base_async_from_dict(): - await test_get_knowledge_base_async(request_type=dict) - - def test_get_knowledge_base_field_headers(): client = KnowledgeBasesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2210,8 +2229,8 @@ async def test_get_knowledge_base_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcd_knowledge_base.CreateKnowledgeBaseRequest, - dict, + gcd_knowledge_base.CreateKnowledgeBaseRequest(), + {}, ], ) def test_create_knowledge_base(request_type, transport: str = "grpc"): @@ -2222,7 +2241,7 @@ def test_create_knowledge_base(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2274,9 +2293,10 @@ def test_create_knowledge_base_non_empty_request_with_auto_populated_field(): client.create_knowledge_base(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_knowledge_base.CreateKnowledgeBaseRequest( + request_msg = gcd_knowledge_base.CreateKnowledgeBaseRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_knowledge_base_use_cached_wrapped_rpc(): @@ -2362,9 +2382,15 @@ async def test_create_knowledge_base_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcd_knowledge_base.CreateKnowledgeBaseRequest(), + {}, + ], +) async def test_create_knowledge_base_async( - transport: str = "grpc_asyncio", - request_type=gcd_knowledge_base.CreateKnowledgeBaseRequest, + request_type, transport: str = "grpc_asyncio" ): client = KnowledgeBasesAsyncClient( credentials=async_anonymous_credentials(), @@ -2373,7 +2399,7 @@ async def test_create_knowledge_base_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 +2428,6 @@ async def test_create_knowledge_base_async( assert response.language_code == "language_code_value" -@pytest.mark.asyncio -async def test_create_knowledge_base_async_from_dict(): - await test_create_knowledge_base_async(request_type=dict) - - def test_create_knowledge_base_field_headers(): client = KnowledgeBasesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2571,8 +2592,8 @@ async def test_create_knowledge_base_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - knowledge_base.DeleteKnowledgeBaseRequest, - dict, + knowledge_base.DeleteKnowledgeBaseRequest(), + {}, ], ) def test_delete_knowledge_base(request_type, transport: str = "grpc"): @@ -2583,7 +2604,7 @@ def test_delete_knowledge_base(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2628,9 +2649,10 @@ def test_delete_knowledge_base_non_empty_request_with_auto_populated_field(): client.delete_knowledge_base(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == knowledge_base.DeleteKnowledgeBaseRequest( + request_msg = knowledge_base.DeleteKnowledgeBaseRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_knowledge_base_use_cached_wrapped_rpc(): @@ -2716,9 +2738,15 @@ async def test_delete_knowledge_base_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + knowledge_base.DeleteKnowledgeBaseRequest(), + {}, + ], +) async def test_delete_knowledge_base_async( - transport: str = "grpc_asyncio", - request_type=knowledge_base.DeleteKnowledgeBaseRequest, + request_type, transport: str = "grpc_asyncio" ): client = KnowledgeBasesAsyncClient( credentials=async_anonymous_credentials(), @@ -2727,7 +2755,7 @@ async def test_delete_knowledge_base_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( @@ -2747,11 +2775,6 @@ async def test_delete_knowledge_base_async( assert response is None -@pytest.mark.asyncio -async def test_delete_knowledge_base_async_from_dict(): - await test_delete_knowledge_base_async(request_type=dict) - - def test_delete_knowledge_base_field_headers(): client = KnowledgeBasesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2902,8 +2925,8 @@ async def test_delete_knowledge_base_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcd_knowledge_base.UpdateKnowledgeBaseRequest, - dict, + gcd_knowledge_base.UpdateKnowledgeBaseRequest(), + {}, ], ) def test_update_knowledge_base(request_type, transport: str = "grpc"): @@ -2914,7 +2937,7 @@ def test_update_knowledge_base(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2964,7 +2987,8 @@ def test_update_knowledge_base_non_empty_request_with_auto_populated_field(): client.update_knowledge_base(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_knowledge_base.UpdateKnowledgeBaseRequest() + request_msg = gcd_knowledge_base.UpdateKnowledgeBaseRequest() + assert args[0] == request_msg def test_update_knowledge_base_use_cached_wrapped_rpc(): @@ -3050,9 +3074,15 @@ async def test_update_knowledge_base_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcd_knowledge_base.UpdateKnowledgeBaseRequest(), + {}, + ], +) async def test_update_knowledge_base_async( - transport: str = "grpc_asyncio", - request_type=gcd_knowledge_base.UpdateKnowledgeBaseRequest, + request_type, transport: str = "grpc_asyncio" ): client = KnowledgeBasesAsyncClient( credentials=async_anonymous_credentials(), @@ -3061,7 +3091,7 @@ async def test_update_knowledge_base_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( @@ -3090,11 +3120,6 @@ async def test_update_knowledge_base_async( assert response.language_code == "language_code_value" -@pytest.mark.asyncio -async def test_update_knowledge_base_async_from_dict(): - await test_update_knowledge_base_async(request_type=dict) - - def test_update_knowledge_base_field_headers(): client = KnowledgeBasesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4376,7 +4401,6 @@ def test_list_knowledge_bases_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = knowledge_base.ListKnowledgeBasesRequest() - assert args[0] == request_msg @@ -4399,7 +4423,6 @@ def test_get_knowledge_base_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = knowledge_base.GetKnowledgeBaseRequest() - assert args[0] == request_msg @@ -4422,7 +4445,6 @@ def test_create_knowledge_base_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_knowledge_base.CreateKnowledgeBaseRequest() - assert args[0] == request_msg @@ -4445,7 +4467,6 @@ def test_delete_knowledge_base_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = knowledge_base.DeleteKnowledgeBaseRequest() - assert args[0] == request_msg @@ -4468,7 +4489,6 @@ def test_update_knowledge_base_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_knowledge_base.UpdateKnowledgeBaseRequest() - assert args[0] == request_msg @@ -4511,7 +4531,6 @@ async def test_list_knowledge_bases_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = knowledge_base.ListKnowledgeBasesRequest() - assert args[0] == request_msg @@ -4542,7 +4561,6 @@ async def test_get_knowledge_base_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = knowledge_base.GetKnowledgeBaseRequest() - assert args[0] == request_msg @@ -4573,7 +4591,6 @@ async def test_create_knowledge_base_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_knowledge_base.CreateKnowledgeBaseRequest() - assert args[0] == request_msg @@ -4598,7 +4615,6 @@ async def test_delete_knowledge_base_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = knowledge_base.DeleteKnowledgeBaseRequest() - assert args[0] == request_msg @@ -4629,7 +4645,6 @@ async def test_update_knowledge_base_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_knowledge_base.UpdateKnowledgeBaseRequest() - assert args[0] == request_msg @@ -5783,7 +5798,6 @@ def test_list_knowledge_bases_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = knowledge_base.ListKnowledgeBasesRequest() - assert args[0] == request_msg @@ -5805,7 +5819,6 @@ def test_get_knowledge_base_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = knowledge_base.GetKnowledgeBaseRequest() - assert args[0] == request_msg @@ -5827,7 +5840,6 @@ def test_create_knowledge_base_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_knowledge_base.CreateKnowledgeBaseRequest() - assert args[0] == request_msg @@ -5849,7 +5861,6 @@ def test_delete_knowledge_base_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = knowledge_base.DeleteKnowledgeBaseRequest() - assert args[0] == request_msg @@ -5871,7 +5882,6 @@ def test_update_knowledge_base_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_knowledge_base.UpdateKnowledgeBaseRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_participants.py b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_participants.py index 9dbe14a9d3c2..216525b1e69f 100644 --- a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_participants.py +++ b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_participants.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 @@ -121,6 +122,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" @@ -1304,8 +1320,8 @@ def test_participants_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - gcd_participant.CreateParticipantRequest, - dict, + gcd_participant.CreateParticipantRequest(), + {}, ], ) def test_create_participant(request_type, transport: str = "grpc"): @@ -1316,7 +1332,7 @@ def test_create_participant(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1375,9 +1391,10 @@ def test_create_participant_non_empty_request_with_auto_populated_field(): client.create_participant(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_participant.CreateParticipantRequest( + request_msg = gcd_participant.CreateParticipantRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_participant_use_cached_wrapped_rpc(): @@ -1462,10 +1479,14 @@ async def test_create_participant_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_participant_async( - transport: str = "grpc_asyncio", - request_type=gcd_participant.CreateParticipantRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + gcd_participant.CreateParticipantRequest(), + {}, + ], +) +async def test_create_participant_async(request_type, transport: str = "grpc_asyncio"): client = ParticipantsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1473,7 +1494,7 @@ async def test_create_participant_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( @@ -1509,11 +1530,6 @@ async def test_create_participant_async( ) -@pytest.mark.asyncio -async def test_create_participant_async_from_dict(): - await test_create_participant_async(request_type=dict) - - def test_create_participant_field_headers(): client = ParticipantsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1678,8 +1694,8 @@ async def test_create_participant_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - participant.GetParticipantRequest, - dict, + participant.GetParticipantRequest(), + {}, ], ) def test_get_participant(request_type, transport: str = "grpc"): @@ -1690,7 +1706,7 @@ def test_get_participant(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_participant), "__call__") as call: @@ -1745,9 +1761,10 @@ def test_get_participant_non_empty_request_with_auto_populated_field(): client.get_participant(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == participant.GetParticipantRequest( + request_msg = participant.GetParticipantRequest( name="name_value", ) + assert args[0] == request_msg def test_get_participant_use_cached_wrapped_rpc(): @@ -1828,9 +1845,14 @@ async def test_get_participant_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_participant_async( - transport: str = "grpc_asyncio", request_type=participant.GetParticipantRequest -): +@pytest.mark.parametrize( + "request_type", + [ + participant.GetParticipantRequest(), + {}, + ], +) +async def test_get_participant_async(request_type, transport: str = "grpc_asyncio"): client = ParticipantsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1838,7 +1860,7 @@ async def test_get_participant_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_participant), "__call__") as call: @@ -1872,11 +1894,6 @@ async def test_get_participant_async( ) -@pytest.mark.asyncio -async def test_get_participant_async_from_dict(): - await test_get_participant_async(request_type=dict) - - def test_get_participant_field_headers(): client = ParticipantsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2023,8 +2040,8 @@ async def test_get_participant_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - participant.ListParticipantsRequest, - dict, + participant.ListParticipantsRequest(), + {}, ], ) def test_list_participants(request_type, transport: str = "grpc"): @@ -2035,7 +2052,7 @@ def test_list_participants(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2084,10 +2101,11 @@ def test_list_participants_non_empty_request_with_auto_populated_field(): client.list_participants(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == participant.ListParticipantsRequest( + request_msg = participant.ListParticipantsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_participants_use_cached_wrapped_rpc(): @@ -2170,9 +2188,14 @@ async def test_list_participants_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_participants_async( - transport: str = "grpc_asyncio", request_type=participant.ListParticipantsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + participant.ListParticipantsRequest(), + {}, + ], +) +async def test_list_participants_async(request_type, transport: str = "grpc_asyncio"): client = ParticipantsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2180,7 +2203,7 @@ async def test_list_participants_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( @@ -2205,11 +2228,6 @@ async def test_list_participants_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_participants_async_from_dict(): - await test_list_participants_async(request_type=dict) - - def test_list_participants_field_headers(): client = ParticipantsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2562,8 +2580,8 @@ async def test_list_participants_async_pages(): @pytest.mark.parametrize( "request_type", [ - gcd_participant.UpdateParticipantRequest, - dict, + gcd_participant.UpdateParticipantRequest(), + {}, ], ) def test_update_participant(request_type, transport: str = "grpc"): @@ -2574,7 +2592,7 @@ def test_update_participant(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2631,7 +2649,8 @@ def test_update_participant_non_empty_request_with_auto_populated_field(): client.update_participant(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_participant.UpdateParticipantRequest() + request_msg = gcd_participant.UpdateParticipantRequest() + assert args[0] == request_msg def test_update_participant_use_cached_wrapped_rpc(): @@ -2716,10 +2735,14 @@ async def test_update_participant_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_participant_async( - transport: str = "grpc_asyncio", - request_type=gcd_participant.UpdateParticipantRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + gcd_participant.UpdateParticipantRequest(), + {}, + ], +) +async def test_update_participant_async(request_type, transport: str = "grpc_asyncio"): client = ParticipantsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2727,7 +2750,7 @@ async def test_update_participant_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( @@ -2763,11 +2786,6 @@ async def test_update_participant_async( ) -@pytest.mark.asyncio -async def test_update_participant_async_from_dict(): - await test_update_participant_async(request_type=dict) - - def test_update_participant_field_headers(): client = ParticipantsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2932,8 +2950,8 @@ async def test_update_participant_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcd_participant.AnalyzeContentRequest, - dict, + gcd_participant.AnalyzeContentRequest(), + {}, ], ) def test_analyze_content(request_type, transport: str = "grpc"): @@ -2944,7 +2962,7 @@ def test_analyze_content(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.analyze_content), "__call__") as call: @@ -2989,10 +3007,11 @@ def test_analyze_content_non_empty_request_with_auto_populated_field(): client.analyze_content(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_participant.AnalyzeContentRequest( + request_msg = gcd_participant.AnalyzeContentRequest( participant="participant_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_analyze_content_use_cached_wrapped_rpc(): @@ -3073,9 +3092,14 @@ async def test_analyze_content_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_analyze_content_async( - transport: str = "grpc_asyncio", request_type=gcd_participant.AnalyzeContentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcd_participant.AnalyzeContentRequest(), + {}, + ], +) +async def test_analyze_content_async(request_type, transport: str = "grpc_asyncio"): client = ParticipantsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3083,7 +3107,7 @@ async def test_analyze_content_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.analyze_content), "__call__") as call: @@ -3106,11 +3130,6 @@ async def test_analyze_content_async( assert response.reply_text == "reply_text_value" -@pytest.mark.asyncio -async def test_analyze_content_async_from_dict(): - await test_analyze_content_async(request_type=dict) - - def test_analyze_content_field_headers(): client = ParticipantsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3295,8 +3314,8 @@ async def test_analyze_content_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - participant.StreamingAnalyzeContentRequest, - dict, + participant.StreamingAnalyzeContentRequest(), + {}, ], ) def test_streaming_analyze_content(request_type, transport: str = "grpc"): @@ -3307,7 +3326,7 @@ def test_streaming_analyze_content(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as 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. @@ -3411,9 +3430,15 @@ async def test_streaming_analyze_content_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + participant.StreamingAnalyzeContentRequest(), + {}, + ], +) async def test_streaming_analyze_content_async( - transport: str = "grpc_asyncio", - request_type=participant.StreamingAnalyzeContentRequest, + request_type, transport: str = "grpc_asyncio" ): client = ParticipantsAsyncClient( credentials=async_anonymous_credentials(), @@ -3422,7 +3447,7 @@ async def test_streaming_analyze_content_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. @@ -3446,16 +3471,11 @@ async def test_streaming_analyze_content_async( assert isinstance(message, participant.StreamingAnalyzeContentResponse) -@pytest.mark.asyncio -async def test_streaming_analyze_content_async_from_dict(): - await test_streaming_analyze_content_async(request_type=dict) - - @pytest.mark.parametrize( "request_type", [ - participant.SuggestArticlesRequest, - dict, + participant.SuggestArticlesRequest(), + {}, ], ) def test_suggest_articles(request_type, transport: str = "grpc"): @@ -3466,7 +3486,7 @@ def test_suggest_articles(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.suggest_articles), "__call__") as call: @@ -3513,10 +3533,11 @@ def test_suggest_articles_non_empty_request_with_auto_populated_field(): client.suggest_articles(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == participant.SuggestArticlesRequest( + request_msg = participant.SuggestArticlesRequest( parent="parent_value", latest_message="latest_message_value", ) + assert args[0] == request_msg def test_suggest_articles_use_cached_wrapped_rpc(): @@ -3599,9 +3620,14 @@ async def test_suggest_articles_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_suggest_articles_async( - transport: str = "grpc_asyncio", request_type=participant.SuggestArticlesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + participant.SuggestArticlesRequest(), + {}, + ], +) +async def test_suggest_articles_async(request_type, transport: str = "grpc_asyncio"): client = ParticipantsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3609,7 +3635,7 @@ async def test_suggest_articles_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.suggest_articles), "__call__") as call: @@ -3634,11 +3660,6 @@ async def test_suggest_articles_async( assert response.context_size == 1311 -@pytest.mark.asyncio -async def test_suggest_articles_async_from_dict(): - await test_suggest_articles_async(request_type=dict) - - def test_suggest_articles_field_headers(): client = ParticipantsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3785,8 +3806,8 @@ async def test_suggest_articles_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - participant.SuggestFaqAnswersRequest, - dict, + participant.SuggestFaqAnswersRequest(), + {}, ], ) def test_suggest_faq_answers(request_type, transport: str = "grpc"): @@ -3797,7 +3818,7 @@ def test_suggest_faq_answers(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3848,10 +3869,11 @@ def test_suggest_faq_answers_non_empty_request_with_auto_populated_field(): client.suggest_faq_answers(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == participant.SuggestFaqAnswersRequest( + request_msg = participant.SuggestFaqAnswersRequest( parent="parent_value", latest_message="latest_message_value", ) + assert args[0] == request_msg def test_suggest_faq_answers_use_cached_wrapped_rpc(): @@ -3936,9 +3958,14 @@ async def test_suggest_faq_answers_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_suggest_faq_answers_async( - transport: str = "grpc_asyncio", request_type=participant.SuggestFaqAnswersRequest -): +@pytest.mark.parametrize( + "request_type", + [ + participant.SuggestFaqAnswersRequest(), + {}, + ], +) +async def test_suggest_faq_answers_async(request_type, transport: str = "grpc_asyncio"): client = ParticipantsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3946,7 +3973,7 @@ async def test_suggest_faq_answers_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( @@ -3973,11 +4000,6 @@ async def test_suggest_faq_answers_async( assert response.context_size == 1311 -@pytest.mark.asyncio -async def test_suggest_faq_answers_async_from_dict(): - await test_suggest_faq_answers_async(request_type=dict) - - def test_suggest_faq_answers_field_headers(): client = ParticipantsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4132,8 +4154,8 @@ async def test_suggest_faq_answers_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - participant.SuggestSmartRepliesRequest, - dict, + participant.SuggestSmartRepliesRequest(), + {}, ], ) def test_suggest_smart_replies(request_type, transport: str = "grpc"): @@ -4144,7 +4166,7 @@ def test_suggest_smart_replies(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4195,10 +4217,11 @@ def test_suggest_smart_replies_non_empty_request_with_auto_populated_field(): client.suggest_smart_replies(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == participant.SuggestSmartRepliesRequest( + request_msg = participant.SuggestSmartRepliesRequest( parent="parent_value", latest_message="latest_message_value", ) + assert args[0] == request_msg def test_suggest_smart_replies_use_cached_wrapped_rpc(): @@ -4284,8 +4307,15 @@ async def test_suggest_smart_replies_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + participant.SuggestSmartRepliesRequest(), + {}, + ], +) async def test_suggest_smart_replies_async( - transport: str = "grpc_asyncio", request_type=participant.SuggestSmartRepliesRequest + request_type, transport: str = "grpc_asyncio" ): client = ParticipantsAsyncClient( credentials=async_anonymous_credentials(), @@ -4294,7 +4324,7 @@ async def test_suggest_smart_replies_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( @@ -4321,11 +4351,6 @@ async def test_suggest_smart_replies_async( assert response.context_size == 1311 -@pytest.mark.asyncio -async def test_suggest_smart_replies_async_from_dict(): - await test_suggest_smart_replies_async(request_type=dict) - - def test_suggest_smart_replies_field_headers(): client = ParticipantsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4480,8 +4505,8 @@ async def test_suggest_smart_replies_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - participant.SuggestKnowledgeAssistRequest, - dict, + participant.SuggestKnowledgeAssistRequest(), + {}, ], ) def test_suggest_knowledge_assist(request_type, transport: str = "grpc"): @@ -4492,7 +4517,7 @@ def test_suggest_knowledge_assist(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4544,11 +4569,12 @@ def test_suggest_knowledge_assist_non_empty_request_with_auto_populated_field(): client.suggest_knowledge_assist(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == participant.SuggestKnowledgeAssistRequest( + request_msg = participant.SuggestKnowledgeAssistRequest( parent="parent_value", latest_message="latest_message_value", previous_suggested_query="previous_suggested_query_value", ) + assert args[0] == request_msg def test_suggest_knowledge_assist_use_cached_wrapped_rpc(): @@ -4634,9 +4660,15 @@ async def test_suggest_knowledge_assist_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + participant.SuggestKnowledgeAssistRequest(), + {}, + ], +) async def test_suggest_knowledge_assist_async( - transport: str = "grpc_asyncio", - request_type=participant.SuggestKnowledgeAssistRequest, + request_type, transport: str = "grpc_asyncio" ): client = ParticipantsAsyncClient( credentials=async_anonymous_credentials(), @@ -4645,7 +4677,7 @@ async def test_suggest_knowledge_assist_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( @@ -4672,11 +4704,6 @@ async def test_suggest_knowledge_assist_async( assert response.context_size == 1311 -@pytest.mark.asyncio -async def test_suggest_knowledge_assist_async_from_dict(): - await test_suggest_knowledge_assist_async(request_type=dict) - - def test_suggest_knowledge_assist_field_headers(): client = ParticipantsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6584,7 +6611,6 @@ def test_create_participant_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_participant.CreateParticipantRequest() - assert args[0] == request_msg @@ -6605,7 +6631,6 @@ def test_get_participant_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = participant.GetParticipantRequest() - assert args[0] == request_msg @@ -6628,7 +6653,6 @@ def test_list_participants_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = participant.ListParticipantsRequest() - assert args[0] == request_msg @@ -6651,7 +6675,6 @@ def test_update_participant_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_participant.UpdateParticipantRequest() - assert args[0] == request_msg @@ -6672,7 +6695,6 @@ def test_analyze_content_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_participant.AnalyzeContentRequest() - assert args[0] == request_msg @@ -6693,7 +6715,6 @@ def test_suggest_articles_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = participant.SuggestArticlesRequest() - assert args[0] == request_msg @@ -6716,7 +6737,6 @@ def test_suggest_faq_answers_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = participant.SuggestFaqAnswersRequest() - assert args[0] == request_msg @@ -6739,7 +6759,6 @@ def test_suggest_smart_replies_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = participant.SuggestSmartRepliesRequest() - assert args[0] == request_msg @@ -6762,7 +6781,6 @@ def test_suggest_knowledge_assist_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = participant.SuggestKnowledgeAssistRequest() - assert args[0] == request_msg @@ -6809,7 +6827,6 @@ async def test_create_participant_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_participant.CreateParticipantRequest() - assert args[0] == request_msg @@ -6840,7 +6857,6 @@ async def test_get_participant_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = participant.GetParticipantRequest() - assert args[0] == request_msg @@ -6869,7 +6885,6 @@ async def test_list_participants_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = participant.ListParticipantsRequest() - assert args[0] == request_msg @@ -6902,7 +6917,6 @@ async def test_update_participant_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_participant.UpdateParticipantRequest() - assert args[0] == request_msg @@ -6929,7 +6943,6 @@ async def test_analyze_content_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_participant.AnalyzeContentRequest() - assert args[0] == request_msg @@ -6957,7 +6970,6 @@ async def test_suggest_articles_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = participant.SuggestArticlesRequest() - assert args[0] == request_msg @@ -6987,7 +6999,6 @@ async def test_suggest_faq_answers_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = participant.SuggestFaqAnswersRequest() - assert args[0] == request_msg @@ -7017,7 +7028,6 @@ async def test_suggest_smart_replies_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = participant.SuggestSmartRepliesRequest() - assert args[0] == request_msg @@ -7047,7 +7057,6 @@ async def test_suggest_knowledge_assist_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = participant.SuggestKnowledgeAssistRequest() - assert args[0] == request_msg @@ -8838,7 +8847,6 @@ def test_create_participant_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_participant.CreateParticipantRequest() - assert args[0] == request_msg @@ -8858,7 +8866,6 @@ def test_get_participant_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = participant.GetParticipantRequest() - assert args[0] == request_msg @@ -8880,7 +8887,6 @@ def test_list_participants_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = participant.ListParticipantsRequest() - assert args[0] == request_msg @@ -8902,7 +8908,6 @@ def test_update_participant_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_participant.UpdateParticipantRequest() - assert args[0] == request_msg @@ -8922,7 +8927,6 @@ def test_analyze_content_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_participant.AnalyzeContentRequest() - assert args[0] == request_msg @@ -8942,7 +8946,6 @@ def test_suggest_articles_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = participant.SuggestArticlesRequest() - assert args[0] == request_msg @@ -8964,7 +8967,6 @@ def test_suggest_faq_answers_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = participant.SuggestFaqAnswersRequest() - assert args[0] == request_msg @@ -8986,7 +8988,6 @@ def test_suggest_smart_replies_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = participant.SuggestSmartRepliesRequest() - assert args[0] == request_msg @@ -9008,7 +9009,6 @@ def test_suggest_knowledge_assist_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = participant.SuggestKnowledgeAssistRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_session_entity_types.py b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_session_entity_types.py index 6e6aec3c0308..3f9cde6fe556 100644 --- a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_session_entity_types.py +++ b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_session_entity_types.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 @@ -113,6 +114,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" @@ -1361,8 +1377,8 @@ def test_session_entity_types_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - session_entity_type.ListSessionEntityTypesRequest, - dict, + session_entity_type.ListSessionEntityTypesRequest(), + {}, ], ) def test_list_session_entity_types(request_type, transport: str = "grpc"): @@ -1373,7 +1389,7 @@ def test_list_session_entity_types(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1422,10 +1438,11 @@ def test_list_session_entity_types_non_empty_request_with_auto_populated_field() client.list_session_entity_types(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == session_entity_type.ListSessionEntityTypesRequest( + request_msg = session_entity_type.ListSessionEntityTypesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_session_entity_types_use_cached_wrapped_rpc(): @@ -1511,9 +1528,15 @@ async def test_list_session_entity_types_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + session_entity_type.ListSessionEntityTypesRequest(), + {}, + ], +) async def test_list_session_entity_types_async( - transport: str = "grpc_asyncio", - request_type=session_entity_type.ListSessionEntityTypesRequest, + request_type, transport: str = "grpc_asyncio" ): client = SessionEntityTypesAsyncClient( credentials=async_anonymous_credentials(), @@ -1522,7 +1545,7 @@ async def test_list_session_entity_types_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( @@ -1547,11 +1570,6 @@ async def test_list_session_entity_types_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_session_entity_types_async_from_dict(): - await test_list_session_entity_types_async(request_type=dict) - - def test_list_session_entity_types_field_headers(): client = SessionEntityTypesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1910,8 +1928,8 @@ async def test_list_session_entity_types_async_pages(): @pytest.mark.parametrize( "request_type", [ - session_entity_type.GetSessionEntityTypeRequest, - dict, + session_entity_type.GetSessionEntityTypeRequest(), + {}, ], ) def test_get_session_entity_type(request_type, transport: str = "grpc"): @@ -1922,7 +1940,7 @@ def test_get_session_entity_type(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,9 +1993,10 @@ def test_get_session_entity_type_non_empty_request_with_auto_populated_field(): client.get_session_entity_type(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == session_entity_type.GetSessionEntityTypeRequest( + request_msg = session_entity_type.GetSessionEntityTypeRequest( name="name_value", ) + assert args[0] == request_msg def test_get_session_entity_type_use_cached_wrapped_rpc(): @@ -2063,9 +2082,15 @@ async def test_get_session_entity_type_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + session_entity_type.GetSessionEntityTypeRequest(), + {}, + ], +) async def test_get_session_entity_type_async( - transport: str = "grpc_asyncio", - request_type=session_entity_type.GetSessionEntityTypeRequest, + request_type, transport: str = "grpc_asyncio" ): client = SessionEntityTypesAsyncClient( credentials=async_anonymous_credentials(), @@ -2074,7 +2099,7 @@ async def test_get_session_entity_type_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( @@ -2104,11 +2129,6 @@ async def test_get_session_entity_type_async( ) -@pytest.mark.asyncio -async def test_get_session_entity_type_async_from_dict(): - await test_get_session_entity_type_async(request_type=dict) - - def test_get_session_entity_type_field_headers(): client = SessionEntityTypesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2263,8 +2283,8 @@ async def test_get_session_entity_type_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcd_session_entity_type.CreateSessionEntityTypeRequest, - dict, + gcd_session_entity_type.CreateSessionEntityTypeRequest(), + {}, ], ) def test_create_session_entity_type(request_type, transport: str = "grpc"): @@ -2275,7 +2295,7 @@ def test_create_session_entity_type(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,9 +2348,10 @@ def test_create_session_entity_type_non_empty_request_with_auto_populated_field( client.create_session_entity_type(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_session_entity_type.CreateSessionEntityTypeRequest( + request_msg = gcd_session_entity_type.CreateSessionEntityTypeRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_session_entity_type_use_cached_wrapped_rpc(): @@ -2416,9 +2437,15 @@ async def test_create_session_entity_type_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcd_session_entity_type.CreateSessionEntityTypeRequest(), + {}, + ], +) async def test_create_session_entity_type_async( - transport: str = "grpc_asyncio", - request_type=gcd_session_entity_type.CreateSessionEntityTypeRequest, + request_type, transport: str = "grpc_asyncio" ): client = SessionEntityTypesAsyncClient( credentials=async_anonymous_credentials(), @@ -2427,7 +2454,7 @@ async def test_create_session_entity_type_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( @@ -2457,11 +2484,6 @@ async def test_create_session_entity_type_async( ) -@pytest.mark.asyncio -async def test_create_session_entity_type_async_from_dict(): - await test_create_session_entity_type_async(request_type=dict) - - def test_create_session_entity_type_field_headers(): client = SessionEntityTypesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2634,8 +2656,8 @@ async def test_create_session_entity_type_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcd_session_entity_type.UpdateSessionEntityTypeRequest, - dict, + gcd_session_entity_type.UpdateSessionEntityTypeRequest(), + {}, ], ) def test_update_session_entity_type(request_type, transport: str = "grpc"): @@ -2646,7 +2668,7 @@ def test_update_session_entity_type(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2697,7 +2719,8 @@ def test_update_session_entity_type_non_empty_request_with_auto_populated_field( client.update_session_entity_type(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_session_entity_type.UpdateSessionEntityTypeRequest() + request_msg = gcd_session_entity_type.UpdateSessionEntityTypeRequest() + assert args[0] == request_msg def test_update_session_entity_type_use_cached_wrapped_rpc(): @@ -2783,9 +2806,15 @@ async def test_update_session_entity_type_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcd_session_entity_type.UpdateSessionEntityTypeRequest(), + {}, + ], +) async def test_update_session_entity_type_async( - transport: str = "grpc_asyncio", - request_type=gcd_session_entity_type.UpdateSessionEntityTypeRequest, + request_type, transport: str = "grpc_asyncio" ): client = SessionEntityTypesAsyncClient( credentials=async_anonymous_credentials(), @@ -2794,7 +2823,7 @@ async def test_update_session_entity_type_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( @@ -2824,11 +2853,6 @@ async def test_update_session_entity_type_async( ) -@pytest.mark.asyncio -async def test_update_session_entity_type_async_from_dict(): - await test_update_session_entity_type_async(request_type=dict) - - def test_update_session_entity_type_field_headers(): client = SessionEntityTypesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3001,8 +3025,8 @@ async def test_update_session_entity_type_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - session_entity_type.DeleteSessionEntityTypeRequest, - dict, + session_entity_type.DeleteSessionEntityTypeRequest(), + {}, ], ) def test_delete_session_entity_type(request_type, transport: str = "grpc"): @@ -3013,7 +3037,7 @@ def test_delete_session_entity_type(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3058,9 +3082,10 @@ def test_delete_session_entity_type_non_empty_request_with_auto_populated_field( client.delete_session_entity_type(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == session_entity_type.DeleteSessionEntityTypeRequest( + request_msg = session_entity_type.DeleteSessionEntityTypeRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_session_entity_type_use_cached_wrapped_rpc(): @@ -3146,9 +3171,15 @@ async def test_delete_session_entity_type_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + session_entity_type.DeleteSessionEntityTypeRequest(), + {}, + ], +) async def test_delete_session_entity_type_async( - transport: str = "grpc_asyncio", - request_type=session_entity_type.DeleteSessionEntityTypeRequest, + request_type, transport: str = "grpc_asyncio" ): client = SessionEntityTypesAsyncClient( credentials=async_anonymous_credentials(), @@ -3157,7 +3188,7 @@ async def test_delete_session_entity_type_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( @@ -3177,11 +3208,6 @@ async def test_delete_session_entity_type_async( assert response is None -@pytest.mark.asyncio -async def test_delete_session_entity_type_async_from_dict(): - await test_delete_session_entity_type_async(request_type=dict) - - def test_delete_session_entity_type_field_headers(): client = SessionEntityTypesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4476,7 +4502,6 @@ def test_list_session_entity_types_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session_entity_type.ListSessionEntityTypesRequest() - assert args[0] == request_msg @@ -4499,7 +4524,6 @@ def test_get_session_entity_type_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session_entity_type.GetSessionEntityTypeRequest() - assert args[0] == request_msg @@ -4522,7 +4546,6 @@ def test_create_session_entity_type_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_session_entity_type.CreateSessionEntityTypeRequest() - assert args[0] == request_msg @@ -4545,7 +4568,6 @@ def test_update_session_entity_type_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_session_entity_type.UpdateSessionEntityTypeRequest() - assert args[0] == request_msg @@ -4568,7 +4590,6 @@ def test_delete_session_entity_type_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session_entity_type.DeleteSessionEntityTypeRequest() - assert args[0] == request_msg @@ -4611,7 +4632,6 @@ async def test_list_session_entity_types_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session_entity_type.ListSessionEntityTypesRequest() - assert args[0] == request_msg @@ -4641,7 +4661,6 @@ async def test_get_session_entity_type_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session_entity_type.GetSessionEntityTypeRequest() - assert args[0] == request_msg @@ -4671,7 +4690,6 @@ async def test_create_session_entity_type_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_session_entity_type.CreateSessionEntityTypeRequest() - assert args[0] == request_msg @@ -4701,7 +4719,6 @@ async def test_update_session_entity_type_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_session_entity_type.UpdateSessionEntityTypeRequest() - assert args[0] == request_msg @@ -4726,7 +4743,6 @@ async def test_delete_session_entity_type_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session_entity_type.DeleteSessionEntityTypeRequest() - assert args[0] == request_msg @@ -5917,7 +5933,6 @@ def test_list_session_entity_types_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session_entity_type.ListSessionEntityTypesRequest() - assert args[0] == request_msg @@ -5939,7 +5954,6 @@ def test_get_session_entity_type_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session_entity_type.GetSessionEntityTypeRequest() - assert args[0] == request_msg @@ -5961,7 +5975,6 @@ def test_create_session_entity_type_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_session_entity_type.CreateSessionEntityTypeRequest() - assert args[0] == request_msg @@ -5983,7 +5996,6 @@ def test_update_session_entity_type_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_session_entity_type.UpdateSessionEntityTypeRequest() - assert args[0] == request_msg @@ -6005,7 +6017,6 @@ def test_delete_session_entity_type_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session_entity_type.DeleteSessionEntityTypeRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_sessions.py b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_sessions.py index edc1a4d81878..c1d856a2c0e8 100644 --- a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_sessions.py +++ b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_sessions.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 @@ -119,6 +120,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" @@ -1266,8 +1282,8 @@ def test_sessions_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - gcd_session.DetectIntentRequest, - dict, + gcd_session.DetectIntentRequest(), + {}, ], ) def test_detect_intent(request_type, transport: str = "grpc"): @@ -1278,7 +1294,7 @@ def test_detect_intent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.detect_intent), "__call__") as call: @@ -1324,9 +1340,10 @@ def test_detect_intent_non_empty_request_with_auto_populated_field(): client.detect_intent(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_session.DetectIntentRequest( + request_msg = gcd_session.DetectIntentRequest( session="session_value", ) + assert args[0] == request_msg def test_detect_intent_use_cached_wrapped_rpc(): @@ -1407,9 +1424,14 @@ async def test_detect_intent_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_detect_intent_async( - transport: str = "grpc_asyncio", request_type=gcd_session.DetectIntentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcd_session.DetectIntentRequest(), + {}, + ], +) +async def test_detect_intent_async(request_type, transport: str = "grpc_asyncio"): client = SessionsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1417,7 +1439,7 @@ async def test_detect_intent_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.detect_intent), "__call__") as call: @@ -1442,11 +1464,6 @@ async def test_detect_intent_async( assert response.output_audio == b"output_audio_blob" -@pytest.mark.asyncio -async def test_detect_intent_async_from_dict(): - await test_detect_intent_async(request_type=dict) - - def test_detect_intent_field_headers(): client = SessionsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1627,8 +1644,8 @@ async def test_detect_intent_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - session.StreamingDetectIntentRequest, - dict, + session.StreamingDetectIntentRequest(), + {}, ], ) def test_streaming_detect_intent(request_type, transport: str = "grpc"): @@ -1639,7 +1656,7 @@ def test_streaming_detect_intent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as 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. @@ -1743,8 +1760,15 @@ async def test_streaming_detect_intent_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + session.StreamingDetectIntentRequest(), + {}, + ], +) async def test_streaming_detect_intent_async( - transport: str = "grpc_asyncio", request_type=session.StreamingDetectIntentRequest + request_type, transport: str = "grpc_asyncio" ): client = SessionsAsyncClient( credentials=async_anonymous_credentials(), @@ -1753,7 +1777,7 @@ async def test_streaming_detect_intent_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. @@ -1777,11 +1801,6 @@ async def test_streaming_detect_intent_async( assert isinstance(message, session.StreamingDetectIntentResponse) -@pytest.mark.asyncio -async def test_streaming_detect_intent_async_from_dict(): - await test_streaming_detect_intent_async(request_type=dict) - - def test_detect_intent_rest_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, # instead of constructing them on each call @@ -2126,7 +2145,6 @@ def test_detect_intent_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_session.DetectIntentRequest() - assert args[0] == request_msg @@ -2168,7 +2186,6 @@ async def test_detect_intent_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_session.DetectIntentRequest() - assert args[0] == request_msg @@ -2653,7 +2670,6 @@ def test_detect_intent_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_session.DetectIntentRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_sip_trunks.py b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_sip_trunks.py index 9a684fee8ee9..0d3f9e7043c5 100644 --- a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_sip_trunks.py +++ b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_sip_trunks.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" @@ -1274,8 +1290,8 @@ def test_sip_trunks_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - gcd_sip_trunk.CreateSipTrunkRequest, - dict, + gcd_sip_trunk.CreateSipTrunkRequest(), + {}, ], ) def test_create_sip_trunk(request_type, transport: str = "grpc"): @@ -1286,7 +1302,7 @@ def test_create_sip_trunk(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_sip_trunk), "__call__") as call: @@ -1334,9 +1350,10 @@ def test_create_sip_trunk_non_empty_request_with_auto_populated_field(): client.create_sip_trunk(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_sip_trunk.CreateSipTrunkRequest( + request_msg = gcd_sip_trunk.CreateSipTrunkRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_sip_trunk_use_cached_wrapped_rpc(): @@ -1419,9 +1436,14 @@ async def test_create_sip_trunk_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_sip_trunk_async( - transport: str = "grpc_asyncio", request_type=gcd_sip_trunk.CreateSipTrunkRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcd_sip_trunk.CreateSipTrunkRequest(), + {}, + ], +) +async def test_create_sip_trunk_async(request_type, transport: str = "grpc_asyncio"): client = SipTrunksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1429,7 +1451,7 @@ async def test_create_sip_trunk_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_sip_trunk), "__call__") as call: @@ -1456,11 +1478,6 @@ async def test_create_sip_trunk_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_create_sip_trunk_async_from_dict(): - await test_create_sip_trunk_async(request_type=dict) - - def test_create_sip_trunk_field_headers(): client = SipTrunksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1617,8 +1634,8 @@ async def test_create_sip_trunk_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - sip_trunk.DeleteSipTrunkRequest, - dict, + sip_trunk.DeleteSipTrunkRequest(), + {}, ], ) def test_delete_sip_trunk(request_type, transport: str = "grpc"): @@ -1629,7 +1646,7 @@ def test_delete_sip_trunk(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_sip_trunk), "__call__") as call: @@ -1670,9 +1687,10 @@ def test_delete_sip_trunk_non_empty_request_with_auto_populated_field(): client.delete_sip_trunk(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == sip_trunk.DeleteSipTrunkRequest( + request_msg = sip_trunk.DeleteSipTrunkRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_sip_trunk_use_cached_wrapped_rpc(): @@ -1755,9 +1773,14 @@ async def test_delete_sip_trunk_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_sip_trunk_async( - transport: str = "grpc_asyncio", request_type=sip_trunk.DeleteSipTrunkRequest -): +@pytest.mark.parametrize( + "request_type", + [ + sip_trunk.DeleteSipTrunkRequest(), + {}, + ], +) +async def test_delete_sip_trunk_async(request_type, transport: str = "grpc_asyncio"): client = SipTrunksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1765,7 +1788,7 @@ async def test_delete_sip_trunk_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_sip_trunk), "__call__") as call: @@ -1783,11 +1806,6 @@ async def test_delete_sip_trunk_async( assert response is None -@pytest.mark.asyncio -async def test_delete_sip_trunk_async_from_dict(): - await test_delete_sip_trunk_async(request_type=dict) - - def test_delete_sip_trunk_field_headers(): client = SipTrunksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1930,8 +1948,8 @@ async def test_delete_sip_trunk_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - sip_trunk.ListSipTrunksRequest, - dict, + sip_trunk.ListSipTrunksRequest(), + {}, ], ) def test_list_sip_trunks(request_type, transport: str = "grpc"): @@ -1942,7 +1960,7 @@ def test_list_sip_trunks(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_sip_trunks), "__call__") as call: @@ -1987,10 +2005,11 @@ def test_list_sip_trunks_non_empty_request_with_auto_populated_field(): client.list_sip_trunks(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == sip_trunk.ListSipTrunksRequest( + request_msg = sip_trunk.ListSipTrunksRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_sip_trunks_use_cached_wrapped_rpc(): @@ -2071,9 +2090,14 @@ async def test_list_sip_trunks_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_sip_trunks_async( - transport: str = "grpc_asyncio", request_type=sip_trunk.ListSipTrunksRequest -): +@pytest.mark.parametrize( + "request_type", + [ + sip_trunk.ListSipTrunksRequest(), + {}, + ], +) +async def test_list_sip_trunks_async(request_type, transport: str = "grpc_asyncio"): client = SipTrunksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2081,7 +2105,7 @@ async def test_list_sip_trunks_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_sip_trunks), "__call__") as call: @@ -2104,11 +2128,6 @@ async def test_list_sip_trunks_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_sip_trunks_async_from_dict(): - await test_list_sip_trunks_async(request_type=dict) - - def test_list_sip_trunks_field_headers(): client = SipTrunksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2445,8 +2464,8 @@ async def test_list_sip_trunks_async_pages(): @pytest.mark.parametrize( "request_type", [ - sip_trunk.GetSipTrunkRequest, - dict, + sip_trunk.GetSipTrunkRequest(), + {}, ], ) def test_get_sip_trunk(request_type, transport: str = "grpc"): @@ -2457,7 +2476,7 @@ def test_get_sip_trunk(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_sip_trunk), "__call__") as call: @@ -2505,9 +2524,10 @@ def test_get_sip_trunk_non_empty_request_with_auto_populated_field(): client.get_sip_trunk(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == sip_trunk.GetSipTrunkRequest( + request_msg = sip_trunk.GetSipTrunkRequest( name="name_value", ) + assert args[0] == request_msg def test_get_sip_trunk_use_cached_wrapped_rpc(): @@ -2588,9 +2608,14 @@ async def test_get_sip_trunk_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_sip_trunk_async( - transport: str = "grpc_asyncio", request_type=sip_trunk.GetSipTrunkRequest -): +@pytest.mark.parametrize( + "request_type", + [ + sip_trunk.GetSipTrunkRequest(), + {}, + ], +) +async def test_get_sip_trunk_async(request_type, transport: str = "grpc_asyncio"): client = SipTrunksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2598,7 +2623,7 @@ async def test_get_sip_trunk_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_sip_trunk), "__call__") as call: @@ -2625,11 +2650,6 @@ async def test_get_sip_trunk_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_get_sip_trunk_async_from_dict(): - await test_get_sip_trunk_async(request_type=dict) - - def test_get_sip_trunk_field_headers(): client = SipTrunksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2772,8 +2792,8 @@ async def test_get_sip_trunk_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcd_sip_trunk.UpdateSipTrunkRequest, - dict, + gcd_sip_trunk.UpdateSipTrunkRequest(), + {}, ], ) def test_update_sip_trunk(request_type, transport: str = "grpc"): @@ -2784,7 +2804,7 @@ def test_update_sip_trunk(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_sip_trunk), "__call__") as call: @@ -2830,7 +2850,8 @@ def test_update_sip_trunk_non_empty_request_with_auto_populated_field(): client.update_sip_trunk(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_sip_trunk.UpdateSipTrunkRequest() + request_msg = gcd_sip_trunk.UpdateSipTrunkRequest() + assert args[0] == request_msg def test_update_sip_trunk_use_cached_wrapped_rpc(): @@ -2913,9 +2934,14 @@ async def test_update_sip_trunk_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_sip_trunk_async( - transport: str = "grpc_asyncio", request_type=gcd_sip_trunk.UpdateSipTrunkRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcd_sip_trunk.UpdateSipTrunkRequest(), + {}, + ], +) +async def test_update_sip_trunk_async(request_type, transport: str = "grpc_asyncio"): client = SipTrunksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2923,7 +2949,7 @@ async def test_update_sip_trunk_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_sip_trunk), "__call__") as call: @@ -2950,11 +2976,6 @@ async def test_update_sip_trunk_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_update_sip_trunk_async_from_dict(): - await test_update_sip_trunk_async(request_type=dict) - - def test_update_sip_trunk_field_headers(): client = SipTrunksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4211,7 +4232,6 @@ def test_create_sip_trunk_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_sip_trunk.CreateSipTrunkRequest() - assert args[0] == request_msg @@ -4232,7 +4252,6 @@ def test_delete_sip_trunk_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sip_trunk.DeleteSipTrunkRequest() - assert args[0] == request_msg @@ -4253,7 +4272,6 @@ def test_list_sip_trunks_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sip_trunk.ListSipTrunksRequest() - assert args[0] == request_msg @@ -4274,7 +4292,6 @@ def test_get_sip_trunk_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sip_trunk.GetSipTrunkRequest() - assert args[0] == request_msg @@ -4295,7 +4312,6 @@ def test_update_sip_trunk_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_sip_trunk.UpdateSipTrunkRequest() - assert args[0] == request_msg @@ -4338,7 +4354,6 @@ async def test_create_sip_trunk_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_sip_trunk.CreateSipTrunkRequest() - assert args[0] == request_msg @@ -4361,7 +4376,6 @@ async def test_delete_sip_trunk_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sip_trunk.DeleteSipTrunkRequest() - assert args[0] == request_msg @@ -4388,7 +4402,6 @@ async def test_list_sip_trunks_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sip_trunk.ListSipTrunksRequest() - assert args[0] == request_msg @@ -4417,7 +4430,6 @@ async def test_get_sip_trunk_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sip_trunk.GetSipTrunkRequest() - assert args[0] == request_msg @@ -4446,7 +4458,6 @@ async def test_update_sip_trunk_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_sip_trunk.UpdateSipTrunkRequest() - assert args[0] == request_msg @@ -5585,7 +5596,6 @@ def test_create_sip_trunk_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_sip_trunk.CreateSipTrunkRequest() - assert args[0] == request_msg @@ -5605,7 +5615,6 @@ def test_delete_sip_trunk_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sip_trunk.DeleteSipTrunkRequest() - assert args[0] == request_msg @@ -5625,7 +5634,6 @@ def test_list_sip_trunks_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sip_trunk.ListSipTrunksRequest() - assert args[0] == request_msg @@ -5645,7 +5653,6 @@ def test_get_sip_trunk_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sip_trunk.GetSipTrunkRequest() - assert args[0] == request_msg @@ -5665,7 +5672,6 @@ def test_update_sip_trunk_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_sip_trunk.UpdateSipTrunkRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_tools.py b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_tools.py index 7a71af51706a..51379b9c9b47 100644 --- a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_tools.py +++ b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_tools.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 @@ -113,6 +114,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" @@ -1244,8 +1260,8 @@ def test_tools_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - gcd_tool.CreateToolRequest, - dict, + gcd_tool.CreateToolRequest(), + {}, ], ) def test_create_tool(request_type, transport: str = "grpc"): @@ -1256,7 +1272,7 @@ def test_create_tool(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tool), "__call__") as call: @@ -1311,10 +1327,11 @@ def test_create_tool_non_empty_request_with_auto_populated_field(): client.create_tool(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_tool.CreateToolRequest( + request_msg = gcd_tool.CreateToolRequest( parent="parent_value", tool_id="tool_id_value", ) + assert args[0] == request_msg def test_create_tool_use_cached_wrapped_rpc(): @@ -1395,9 +1412,14 @@ async def test_create_tool_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_tool_async( - transport: str = "grpc_asyncio", request_type=gcd_tool.CreateToolRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcd_tool.CreateToolRequest(), + {}, + ], +) +async def test_create_tool_async(request_type, transport: str = "grpc_asyncio"): client = ToolsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1405,7 +1427,7 @@ async def test_create_tool_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_tool), "__call__") as call: @@ -1438,11 +1460,6 @@ async def test_create_tool_async( assert response.satisfies_pzi is True -@pytest.mark.asyncio -async def test_create_tool_async_from_dict(): - await test_create_tool_async(request_type=dict) - - def test_create_tool_field_headers(): client = ToolsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1605,8 +1622,8 @@ async def test_create_tool_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - tool.GetToolRequest, - dict, + tool.GetToolRequest(), + {}, ], ) def test_get_tool(request_type, transport: str = "grpc"): @@ -1617,7 +1634,7 @@ def test_get_tool(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tool), "__call__") as call: @@ -1671,9 +1688,10 @@ def test_get_tool_non_empty_request_with_auto_populated_field(): client.get_tool(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tool.GetToolRequest( + request_msg = tool.GetToolRequest( name="name_value", ) + assert args[0] == request_msg def test_get_tool_use_cached_wrapped_rpc(): @@ -1752,9 +1770,14 @@ async def test_get_tool_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn @pytest.mark.asyncio -async def test_get_tool_async( - transport: str = "grpc_asyncio", request_type=tool.GetToolRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tool.GetToolRequest(), + {}, + ], +) +async def test_get_tool_async(request_type, transport: str = "grpc_asyncio"): client = ToolsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1762,7 +1785,7 @@ async def test_get_tool_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_tool), "__call__") as call: @@ -1795,11 +1818,6 @@ async def test_get_tool_async( assert response.satisfies_pzi is True -@pytest.mark.asyncio -async def test_get_tool_async_from_dict(): - await test_get_tool_async(request_type=dict) - - def test_get_tool_field_headers(): client = ToolsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1942,8 +1960,8 @@ async def test_get_tool_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - tool.ListToolsRequest, - dict, + tool.ListToolsRequest(), + {}, ], ) def test_list_tools(request_type, transport: str = "grpc"): @@ -1954,7 +1972,7 @@ def test_list_tools(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tools), "__call__") as call: @@ -1999,10 +2017,11 @@ def test_list_tools_non_empty_request_with_auto_populated_field(): client.list_tools(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tool.ListToolsRequest( + request_msg = tool.ListToolsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_tools_use_cached_wrapped_rpc(): @@ -2081,9 +2100,14 @@ async def test_list_tools_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_list_tools_async( - transport: str = "grpc_asyncio", request_type=tool.ListToolsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tool.ListToolsRequest(), + {}, + ], +) +async def test_list_tools_async(request_type, transport: str = "grpc_asyncio"): client = ToolsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2091,7 +2115,7 @@ async def test_list_tools_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_tools), "__call__") as call: @@ -2114,11 +2138,6 @@ async def test_list_tools_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_tools_async_from_dict(): - await test_list_tools_async(request_type=dict) - - def test_list_tools_field_headers(): client = ToolsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2455,8 +2474,8 @@ async def test_list_tools_async_pages(): @pytest.mark.parametrize( "request_type", [ - tool.DeleteToolRequest, - dict, + tool.DeleteToolRequest(), + {}, ], ) def test_delete_tool(request_type, transport: str = "grpc"): @@ -2467,7 +2486,7 @@ def test_delete_tool(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tool), "__call__") as call: @@ -2508,9 +2527,10 @@ def test_delete_tool_non_empty_request_with_auto_populated_field(): client.delete_tool(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tool.DeleteToolRequest( + request_msg = tool.DeleteToolRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_tool_use_cached_wrapped_rpc(): @@ -2591,9 +2611,14 @@ async def test_delete_tool_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_tool_async( - transport: str = "grpc_asyncio", request_type=tool.DeleteToolRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tool.DeleteToolRequest(), + {}, + ], +) +async def test_delete_tool_async(request_type, transport: str = "grpc_asyncio"): client = ToolsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2601,7 +2626,7 @@ async def test_delete_tool_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_tool), "__call__") as call: @@ -2619,11 +2644,6 @@ async def test_delete_tool_async( assert response is None -@pytest.mark.asyncio -async def test_delete_tool_async_from_dict(): - await test_delete_tool_async(request_type=dict) - - def test_delete_tool_field_headers(): client = ToolsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2766,8 +2786,8 @@ async def test_delete_tool_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcd_tool.UpdateToolRequest, - dict, + gcd_tool.UpdateToolRequest(), + {}, ], ) def test_update_tool(request_type, transport: str = "grpc"): @@ -2778,7 +2798,7 @@ def test_update_tool(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tool), "__call__") as call: @@ -2830,7 +2850,8 @@ def test_update_tool_non_empty_request_with_auto_populated_field(): client.update_tool(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_tool.UpdateToolRequest() + request_msg = gcd_tool.UpdateToolRequest() + assert args[0] == request_msg def test_update_tool_use_cached_wrapped_rpc(): @@ -2911,9 +2932,14 @@ async def test_update_tool_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_tool_async( - transport: str = "grpc_asyncio", request_type=gcd_tool.UpdateToolRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcd_tool.UpdateToolRequest(), + {}, + ], +) +async def test_update_tool_async(request_type, transport: str = "grpc_asyncio"): client = ToolsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2921,7 +2947,7 @@ async def test_update_tool_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_tool), "__call__") as call: @@ -2954,11 +2980,6 @@ async def test_update_tool_async( assert response.satisfies_pzi is True -@pytest.mark.asyncio -async def test_update_tool_async_from_dict(): - await test_update_tool_async(request_type=dict) - - def test_update_tool_field_headers(): client = ToolsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4194,7 +4215,6 @@ def test_create_tool_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_tool.CreateToolRequest() - assert args[0] == request_msg @@ -4215,7 +4235,6 @@ def test_get_tool_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool.GetToolRequest() - assert args[0] == request_msg @@ -4236,7 +4255,6 @@ def test_list_tools_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool.ListToolsRequest() - assert args[0] == request_msg @@ -4257,7 +4275,6 @@ def test_delete_tool_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool.DeleteToolRequest() - assert args[0] == request_msg @@ -4278,7 +4295,6 @@ def test_update_tool_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_tool.UpdateToolRequest() - assert args[0] == request_msg @@ -4324,7 +4340,6 @@ async def test_create_tool_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_tool.CreateToolRequest() - assert args[0] == request_msg @@ -4356,7 +4371,6 @@ async def test_get_tool_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool.GetToolRequest() - assert args[0] == request_msg @@ -4383,7 +4397,6 @@ async def test_list_tools_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool.ListToolsRequest() - assert args[0] == request_msg @@ -4406,7 +4419,6 @@ async def test_delete_tool_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool.DeleteToolRequest() - assert args[0] == request_msg @@ -4438,7 +4450,6 @@ async def test_update_tool_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_tool.UpdateToolRequest() - assert args[0] == request_msg @@ -5653,7 +5664,6 @@ def test_create_tool_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_tool.CreateToolRequest() - assert args[0] == request_msg @@ -5673,7 +5683,6 @@ def test_get_tool_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool.GetToolRequest() - assert args[0] == request_msg @@ -5693,7 +5702,6 @@ def test_list_tools_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool.ListToolsRequest() - assert args[0] == request_msg @@ -5713,7 +5721,6 @@ def test_delete_tool_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool.DeleteToolRequest() - assert args[0] == request_msg @@ -5733,7 +5740,6 @@ def test_update_tool_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_tool.UpdateToolRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_versions.py b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_versions.py index eb00be0cc936..458355e19462 100644 --- a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_versions.py +++ b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_versions.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" @@ -1259,8 +1275,8 @@ def test_versions_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - version.ListVersionsRequest, - dict, + version.ListVersionsRequest(), + {}, ], ) def test_list_versions(request_type, transport: str = "grpc"): @@ -1271,7 +1287,7 @@ def test_list_versions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_versions), "__call__") as call: @@ -1316,10 +1332,11 @@ def test_list_versions_non_empty_request_with_auto_populated_field(): client.list_versions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == version.ListVersionsRequest( + request_msg = version.ListVersionsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_versions_use_cached_wrapped_rpc(): @@ -1400,9 +1417,14 @@ async def test_list_versions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_versions_async( - transport: str = "grpc_asyncio", request_type=version.ListVersionsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + version.ListVersionsRequest(), + {}, + ], +) +async def test_list_versions_async(request_type, transport: str = "grpc_asyncio"): client = VersionsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1410,7 +1432,7 @@ async def test_list_versions_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_versions), "__call__") as call: @@ -1433,11 +1455,6 @@ async def test_list_versions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_versions_async_from_dict(): - await test_list_versions_async(request_type=dict) - - def test_list_versions_field_headers(): client = VersionsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1774,8 +1791,8 @@ async def test_list_versions_async_pages(): @pytest.mark.parametrize( "request_type", [ - version.GetVersionRequest, - dict, + version.GetVersionRequest(), + {}, ], ) def test_get_version(request_type, transport: str = "grpc"): @@ -1786,7 +1803,7 @@ def test_get_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_version), "__call__") as call: @@ -1836,9 +1853,10 @@ def test_get_version_non_empty_request_with_auto_populated_field(): client.get_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == version.GetVersionRequest( + request_msg = version.GetVersionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_version_use_cached_wrapped_rpc(): @@ -1919,9 +1937,14 @@ async def test_get_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_version_async( - transport: str = "grpc_asyncio", request_type=version.GetVersionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + version.GetVersionRequest(), + {}, + ], +) +async def test_get_version_async(request_type, transport: str = "grpc_asyncio"): client = VersionsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1929,7 +1952,7 @@ async def test_get_version_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_version), "__call__") as call: @@ -1958,11 +1981,6 @@ async def test_get_version_async( assert response.status == version.Version.VersionStatus.IN_PROGRESS -@pytest.mark.asyncio -async def test_get_version_async_from_dict(): - await test_get_version_async(request_type=dict) - - def test_get_version_field_headers(): client = VersionsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2105,8 +2123,8 @@ async def test_get_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcd_version.CreateVersionRequest, - dict, + gcd_version.CreateVersionRequest(), + {}, ], ) def test_create_version(request_type, transport: str = "grpc"): @@ -2117,7 +2135,7 @@ def test_create_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_version), "__call__") as call: @@ -2167,9 +2185,10 @@ def test_create_version_non_empty_request_with_auto_populated_field(): client.create_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_version.CreateVersionRequest( + request_msg = gcd_version.CreateVersionRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_version_use_cached_wrapped_rpc(): @@ -2250,9 +2269,14 @@ async def test_create_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_version_async( - transport: str = "grpc_asyncio", request_type=gcd_version.CreateVersionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcd_version.CreateVersionRequest(), + {}, + ], +) +async def test_create_version_async(request_type, transport: str = "grpc_asyncio"): client = VersionsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2260,7 +2284,7 @@ async def test_create_version_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_version), "__call__") as call: @@ -2289,11 +2313,6 @@ async def test_create_version_async( assert response.status == gcd_version.Version.VersionStatus.IN_PROGRESS -@pytest.mark.asyncio -async def test_create_version_async_from_dict(): - await test_create_version_async(request_type=dict) - - def test_create_version_field_headers(): client = VersionsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2446,8 +2465,8 @@ async def test_create_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcd_version.UpdateVersionRequest, - dict, + gcd_version.UpdateVersionRequest(), + {}, ], ) def test_update_version(request_type, transport: str = "grpc"): @@ -2458,7 +2477,7 @@ def test_update_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_version), "__call__") as call: @@ -2506,7 +2525,8 @@ def test_update_version_non_empty_request_with_auto_populated_field(): client.update_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_version.UpdateVersionRequest() + request_msg = gcd_version.UpdateVersionRequest() + assert args[0] == request_msg def test_update_version_use_cached_wrapped_rpc(): @@ -2587,9 +2607,14 @@ async def test_update_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_version_async( - transport: str = "grpc_asyncio", request_type=gcd_version.UpdateVersionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcd_version.UpdateVersionRequest(), + {}, + ], +) +async def test_update_version_async(request_type, transport: str = "grpc_asyncio"): client = VersionsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2597,7 +2622,7 @@ async def test_update_version_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_version), "__call__") as call: @@ -2626,11 +2651,6 @@ async def test_update_version_async( assert response.status == gcd_version.Version.VersionStatus.IN_PROGRESS -@pytest.mark.asyncio -async def test_update_version_async_from_dict(): - await test_update_version_async(request_type=dict) - - def test_update_version_field_headers(): client = VersionsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2783,8 +2803,8 @@ async def test_update_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - version.DeleteVersionRequest, - dict, + version.DeleteVersionRequest(), + {}, ], ) def test_delete_version(request_type, transport: str = "grpc"): @@ -2795,7 +2815,7 @@ def test_delete_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_version), "__call__") as call: @@ -2836,9 +2856,10 @@ def test_delete_version_non_empty_request_with_auto_populated_field(): client.delete_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == version.DeleteVersionRequest( + request_msg = version.DeleteVersionRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_version_use_cached_wrapped_rpc(): @@ -2919,9 +2940,14 @@ async def test_delete_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_version_async( - transport: str = "grpc_asyncio", request_type=version.DeleteVersionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + version.DeleteVersionRequest(), + {}, + ], +) +async def test_delete_version_async(request_type, transport: str = "grpc_asyncio"): client = VersionsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2929,7 +2955,7 @@ async def test_delete_version_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_version), "__call__") as call: @@ -2947,11 +2973,6 @@ async def test_delete_version_async( assert response is None -@pytest.mark.asyncio -async def test_delete_version_async_from_dict(): - await test_delete_version_async(request_type=dict) - - def test_delete_version_field_headers(): client = VersionsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4181,7 +4202,6 @@ def test_list_versions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = version.ListVersionsRequest() - assert args[0] == request_msg @@ -4202,7 +4222,6 @@ def test_get_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = version.GetVersionRequest() - assert args[0] == request_msg @@ -4223,7 +4242,6 @@ def test_create_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_version.CreateVersionRequest() - assert args[0] == request_msg @@ -4244,7 +4262,6 @@ def test_update_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_version.UpdateVersionRequest() - assert args[0] == request_msg @@ -4265,7 +4282,6 @@ def test_delete_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = version.DeleteVersionRequest() - assert args[0] == request_msg @@ -4306,7 +4322,6 @@ async def test_list_versions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = version.ListVersionsRequest() - assert args[0] == request_msg @@ -4336,7 +4351,6 @@ async def test_get_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = version.GetVersionRequest() - assert args[0] == request_msg @@ -4366,7 +4380,6 @@ async def test_create_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_version.CreateVersionRequest() - assert args[0] == request_msg @@ -4396,7 +4409,6 @@ async def test_update_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_version.UpdateVersionRequest() - assert args[0] == request_msg @@ -4419,7 +4431,6 @@ async def test_delete_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = version.DeleteVersionRequest() - assert args[0] == request_msg @@ -5532,7 +5543,6 @@ def test_list_versions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = version.ListVersionsRequest() - assert args[0] == request_msg @@ -5552,7 +5562,6 @@ def test_get_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = version.GetVersionRequest() - assert args[0] == request_msg @@ -5572,7 +5581,6 @@ def test_create_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_version.CreateVersionRequest() - assert args[0] == request_msg @@ -5592,7 +5600,6 @@ def test_update_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_version.UpdateVersionRequest() - assert args[0] == request_msg @@ -5612,7 +5619,6 @@ def test_delete_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = version.DeleteVersionRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_agents.py b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_agents.py index 4cc536109433..8e68923779cc 100644 --- a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_agents.py +++ b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_agents.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 @@ -117,6 +118,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" @@ -1252,8 +1268,8 @@ def test_agents_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - agent.GetAgentRequest, - dict, + agent.GetAgentRequest(), + {}, ], ) def test_get_agent(request_type, transport: str = "grpc"): @@ -1264,7 +1280,7 @@ def test_get_agent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_agent), "__call__") as call: @@ -1332,9 +1348,10 @@ def test_get_agent_non_empty_request_with_auto_populated_field(): client.get_agent(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent.GetAgentRequest( + request_msg = agent.GetAgentRequest( parent="parent_value", ) + assert args[0] == request_msg def test_get_agent_use_cached_wrapped_rpc(): @@ -1413,9 +1430,14 @@ async def test_get_agent_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_agent_async( - transport: str = "grpc_asyncio", request_type=agent.GetAgentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent.GetAgentRequest(), + {}, + ], +) +async def test_get_agent_async(request_type, transport: str = "grpc_asyncio"): client = AgentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1423,7 +1445,7 @@ async def test_get_agent_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_agent), "__call__") as call: @@ -1470,11 +1492,6 @@ async def test_get_agent_async( assert response.tier == agent.Agent.Tier.TIER_STANDARD -@pytest.mark.asyncio -async def test_get_agent_async_from_dict(): - await test_get_agent_async(request_type=dict) - - def test_get_agent_field_headers(): client = AgentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1617,8 +1634,8 @@ async def test_get_agent_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcd_agent.SetAgentRequest, - dict, + gcd_agent.SetAgentRequest(), + {}, ], ) def test_set_agent(request_type, transport: str = "grpc"): @@ -1629,7 +1646,7 @@ def test_set_agent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.set_agent), "__call__") as call: @@ -1695,7 +1712,8 @@ def test_set_agent_non_empty_request_with_auto_populated_field(): client.set_agent(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_agent.SetAgentRequest() + request_msg = gcd_agent.SetAgentRequest() + assert args[0] == request_msg def test_set_agent_use_cached_wrapped_rpc(): @@ -1774,9 +1792,14 @@ async def test_set_agent_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_set_agent_async( - transport: str = "grpc_asyncio", request_type=gcd_agent.SetAgentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcd_agent.SetAgentRequest(), + {}, + ], +) +async def test_set_agent_async(request_type, transport: str = "grpc_asyncio"): client = AgentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1784,7 +1807,7 @@ async def test_set_agent_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.set_agent), "__call__") as call: @@ -1831,11 +1854,6 @@ async def test_set_agent_async( assert response.tier == gcd_agent.Agent.Tier.TIER_STANDARD -@pytest.mark.asyncio -async def test_set_agent_async_from_dict(): - await test_set_agent_async(request_type=dict) - - def test_set_agent_field_headers(): client = AgentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1978,8 +1996,8 @@ async def test_set_agent_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent.DeleteAgentRequest, - dict, + agent.DeleteAgentRequest(), + {}, ], ) def test_delete_agent(request_type, transport: str = "grpc"): @@ -1990,7 +2008,7 @@ def test_delete_agent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_agent), "__call__") as call: @@ -2031,9 +2049,10 @@ def test_delete_agent_non_empty_request_with_auto_populated_field(): client.delete_agent(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent.DeleteAgentRequest( + request_msg = agent.DeleteAgentRequest( parent="parent_value", ) + assert args[0] == request_msg def test_delete_agent_use_cached_wrapped_rpc(): @@ -2114,9 +2133,14 @@ async def test_delete_agent_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_agent_async( - transport: str = "grpc_asyncio", request_type=agent.DeleteAgentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent.DeleteAgentRequest(), + {}, + ], +) +async def test_delete_agent_async(request_type, transport: str = "grpc_asyncio"): client = AgentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2124,7 +2148,7 @@ async def test_delete_agent_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_agent), "__call__") as call: @@ -2142,11 +2166,6 @@ async def test_delete_agent_async( assert response is None -@pytest.mark.asyncio -async def test_delete_agent_async_from_dict(): - await test_delete_agent_async(request_type=dict) - - def test_delete_agent_field_headers(): client = AgentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2289,8 +2308,8 @@ async def test_delete_agent_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent.SearchAgentsRequest, - dict, + agent.SearchAgentsRequest(), + {}, ], ) def test_search_agents(request_type, transport: str = "grpc"): @@ -2301,7 +2320,7 @@ def test_search_agents(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.search_agents), "__call__") as call: @@ -2346,10 +2365,11 @@ def test_search_agents_non_empty_request_with_auto_populated_field(): client.search_agents(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent.SearchAgentsRequest( + request_msg = agent.SearchAgentsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_search_agents_use_cached_wrapped_rpc(): @@ -2430,9 +2450,14 @@ async def test_search_agents_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_search_agents_async( - transport: str = "grpc_asyncio", request_type=agent.SearchAgentsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent.SearchAgentsRequest(), + {}, + ], +) +async def test_search_agents_async(request_type, transport: str = "grpc_asyncio"): client = AgentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2440,7 +2465,7 @@ async def test_search_agents_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.search_agents), "__call__") as call: @@ -2463,11 +2488,6 @@ async def test_search_agents_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_search_agents_async_from_dict(): - await test_search_agents_async(request_type=dict) - - def test_search_agents_field_headers(): client = AgentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2804,8 +2824,8 @@ async def test_search_agents_async_pages(): @pytest.mark.parametrize( "request_type", [ - agent.TrainAgentRequest, - dict, + agent.TrainAgentRequest(), + {}, ], ) def test_train_agent(request_type, transport: str = "grpc"): @@ -2816,7 +2836,7 @@ def test_train_agent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.train_agent), "__call__") as call: @@ -2857,9 +2877,10 @@ def test_train_agent_non_empty_request_with_auto_populated_field(): client.train_agent(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent.TrainAgentRequest( + request_msg = agent.TrainAgentRequest( parent="parent_value", ) + assert args[0] == request_msg def test_train_agent_use_cached_wrapped_rpc(): @@ -2950,9 +2971,14 @@ async def test_train_agent_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_train_agent_async( - transport: str = "grpc_asyncio", request_type=agent.TrainAgentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent.TrainAgentRequest(), + {}, + ], +) +async def test_train_agent_async(request_type, transport: str = "grpc_asyncio"): client = AgentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2960,7 +2986,7 @@ async def test_train_agent_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.train_agent), "__call__") as call: @@ -2980,11 +3006,6 @@ async def test_train_agent_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_train_agent_async_from_dict(): - await test_train_agent_async(request_type=dict) - - def test_train_agent_field_headers(): client = AgentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3131,8 +3152,8 @@ async def test_train_agent_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent.ExportAgentRequest, - dict, + agent.ExportAgentRequest(), + {}, ], ) def test_export_agent(request_type, transport: str = "grpc"): @@ -3143,7 +3164,7 @@ def test_export_agent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.export_agent), "__call__") as call: @@ -3185,10 +3206,11 @@ def test_export_agent_non_empty_request_with_auto_populated_field(): client.export_agent(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent.ExportAgentRequest( + request_msg = agent.ExportAgentRequest( parent="parent_value", agent_uri="agent_uri_value", ) + assert args[0] == request_msg def test_export_agent_use_cached_wrapped_rpc(): @@ -3279,9 +3301,14 @@ async def test_export_agent_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_export_agent_async( - transport: str = "grpc_asyncio", request_type=agent.ExportAgentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent.ExportAgentRequest(), + {}, + ], +) +async def test_export_agent_async(request_type, transport: str = "grpc_asyncio"): client = AgentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3289,7 +3316,7 @@ async def test_export_agent_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.export_agent), "__call__") as call: @@ -3309,11 +3336,6 @@ async def test_export_agent_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_export_agent_async_from_dict(): - await test_export_agent_async(request_type=dict) - - def test_export_agent_field_headers(): client = AgentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3460,8 +3482,8 @@ async def test_export_agent_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - agent.ImportAgentRequest, - dict, + agent.ImportAgentRequest(), + {}, ], ) def test_import_agent(request_type, transport: str = "grpc"): @@ -3472,7 +3494,7 @@ def test_import_agent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.import_agent), "__call__") as call: @@ -3514,10 +3536,11 @@ def test_import_agent_non_empty_request_with_auto_populated_field(): client.import_agent(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent.ImportAgentRequest( + request_msg = agent.ImportAgentRequest( parent="parent_value", agent_uri="agent_uri_value", ) + assert args[0] == request_msg def test_import_agent_use_cached_wrapped_rpc(): @@ -3608,9 +3631,14 @@ async def test_import_agent_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_import_agent_async( - transport: str = "grpc_asyncio", request_type=agent.ImportAgentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent.ImportAgentRequest(), + {}, + ], +) +async def test_import_agent_async(request_type, transport: str = "grpc_asyncio"): client = AgentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3618,7 +3646,7 @@ async def test_import_agent_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.import_agent), "__call__") as call: @@ -3638,11 +3666,6 @@ async def test_import_agent_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_import_agent_async_from_dict(): - await test_import_agent_async(request_type=dict) - - def test_import_agent_field_headers(): client = AgentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3707,8 +3730,8 @@ async def test_import_agent_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - agent.RestoreAgentRequest, - dict, + agent.RestoreAgentRequest(), + {}, ], ) def test_restore_agent(request_type, transport: str = "grpc"): @@ -3719,7 +3742,7 @@ def test_restore_agent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.restore_agent), "__call__") as call: @@ -3761,10 +3784,11 @@ def test_restore_agent_non_empty_request_with_auto_populated_field(): client.restore_agent(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent.RestoreAgentRequest( + request_msg = agent.RestoreAgentRequest( parent="parent_value", agent_uri="agent_uri_value", ) + assert args[0] == request_msg def test_restore_agent_use_cached_wrapped_rpc(): @@ -3855,9 +3879,14 @@ async def test_restore_agent_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_restore_agent_async( - transport: str = "grpc_asyncio", request_type=agent.RestoreAgentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + agent.RestoreAgentRequest(), + {}, + ], +) +async def test_restore_agent_async(request_type, transport: str = "grpc_asyncio"): client = AgentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3865,7 +3894,7 @@ async def test_restore_agent_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.restore_agent), "__call__") as call: @@ -3885,11 +3914,6 @@ async def test_restore_agent_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_restore_agent_async_from_dict(): - await test_restore_agent_async(request_type=dict) - - def test_restore_agent_field_headers(): client = AgentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3954,8 +3978,8 @@ async def test_restore_agent_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - agent.GetValidationResultRequest, - dict, + agent.GetValidationResultRequest(), + {}, ], ) def test_get_validation_result(request_type, transport: str = "grpc"): @@ -3966,7 +3990,7 @@ def test_get_validation_result(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4012,10 +4036,11 @@ def test_get_validation_result_non_empty_request_with_auto_populated_field(): client.get_validation_result(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == agent.GetValidationResultRequest( + request_msg = agent.GetValidationResultRequest( parent="parent_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_get_validation_result_use_cached_wrapped_rpc(): @@ -4101,8 +4126,15 @@ async def test_get_validation_result_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + agent.GetValidationResultRequest(), + {}, + ], +) async def test_get_validation_result_async( - transport: str = "grpc_asyncio", request_type=agent.GetValidationResultRequest + request_type, transport: str = "grpc_asyncio" ): client = AgentsAsyncClient( credentials=async_anonymous_credentials(), @@ -4111,7 +4143,7 @@ async def test_get_validation_result_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( @@ -4133,11 +4165,6 @@ async def test_get_validation_result_async( assert isinstance(response, validation_result.ValidationResult) -@pytest.mark.asyncio -async def test_get_validation_result_async_from_dict(): - await test_get_validation_result_async(request_type=dict) - - def test_get_validation_result_field_headers(): client = AgentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5810,7 +5837,6 @@ def test_get_agent_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.GetAgentRequest() - assert args[0] == request_msg @@ -5831,7 +5857,6 @@ def test_set_agent_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_agent.SetAgentRequest() - assert args[0] == request_msg @@ -5852,7 +5877,6 @@ def test_delete_agent_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.DeleteAgentRequest() - assert args[0] == request_msg @@ -5873,7 +5897,6 @@ def test_search_agents_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.SearchAgentsRequest() - assert args[0] == request_msg @@ -5894,7 +5917,6 @@ def test_train_agent_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.TrainAgentRequest() - assert args[0] == request_msg @@ -5915,7 +5937,6 @@ def test_export_agent_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.ExportAgentRequest() - assert args[0] == request_msg @@ -5936,7 +5957,6 @@ def test_import_agent_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.ImportAgentRequest() - assert args[0] == request_msg @@ -5957,7 +5977,6 @@ def test_restore_agent_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.RestoreAgentRequest() - assert args[0] == request_msg @@ -5980,7 +5999,6 @@ def test_get_validation_result_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.GetValidationResultRequest() - assert args[0] == request_msg @@ -6032,7 +6050,6 @@ async def test_get_agent_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.GetAgentRequest() - assert args[0] == request_msg @@ -6070,7 +6087,6 @@ async def test_set_agent_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_agent.SetAgentRequest() - assert args[0] == request_msg @@ -6093,7 +6109,6 @@ async def test_delete_agent_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.DeleteAgentRequest() - assert args[0] == request_msg @@ -6120,7 +6135,6 @@ async def test_search_agents_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.SearchAgentsRequest() - assert args[0] == request_msg @@ -6145,7 +6159,6 @@ async def test_train_agent_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.TrainAgentRequest() - assert args[0] == request_msg @@ -6170,7 +6183,6 @@ async def test_export_agent_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.ExportAgentRequest() - assert args[0] == request_msg @@ -6195,7 +6207,6 @@ async def test_import_agent_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.ImportAgentRequest() - assert args[0] == request_msg @@ -6220,7 +6231,6 @@ async def test_restore_agent_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.RestoreAgentRequest() - assert args[0] == request_msg @@ -6247,7 +6257,6 @@ async def test_get_validation_result_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.GetValidationResultRequest() - assert args[0] == request_msg @@ -7779,7 +7788,6 @@ def test_get_agent_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.GetAgentRequest() - assert args[0] == request_msg @@ -7799,7 +7807,6 @@ def test_set_agent_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_agent.SetAgentRequest() - assert args[0] == request_msg @@ -7819,7 +7826,6 @@ def test_delete_agent_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.DeleteAgentRequest() - assert args[0] == request_msg @@ -7839,7 +7845,6 @@ def test_search_agents_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.SearchAgentsRequest() - assert args[0] == request_msg @@ -7859,7 +7864,6 @@ def test_train_agent_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.TrainAgentRequest() - assert args[0] == request_msg @@ -7879,7 +7883,6 @@ def test_export_agent_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.ExportAgentRequest() - assert args[0] == request_msg @@ -7899,7 +7902,6 @@ def test_import_agent_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.ImportAgentRequest() - assert args[0] == request_msg @@ -7919,7 +7921,6 @@ def test_restore_agent_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.RestoreAgentRequest() - assert args[0] == request_msg @@ -7941,7 +7942,6 @@ def test_get_validation_result_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = agent.GetValidationResultRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_answer_records.py b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_answer_records.py index 6b60b646fda4..102a56062557 100644 --- a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_answer_records.py +++ b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_answer_records.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 @@ -122,6 +123,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" @@ -1324,8 +1340,8 @@ def test_answer_records_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - answer_record.GetAnswerRecordRequest, - dict, + answer_record.GetAnswerRecordRequest(), + {}, ], ) def test_get_answer_record(request_type, transport: str = "grpc"): @@ -1336,7 +1352,7 @@ def test_get_answer_record(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1384,9 +1400,10 @@ def test_get_answer_record_non_empty_request_with_auto_populated_field(): client.get_answer_record(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == answer_record.GetAnswerRecordRequest( + request_msg = answer_record.GetAnswerRecordRequest( name="name_value", ) + assert args[0] == request_msg def test_get_answer_record_use_cached_wrapped_rpc(): @@ -1469,9 +1486,14 @@ async def test_get_answer_record_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_answer_record_async( - transport: str = "grpc_asyncio", request_type=answer_record.GetAnswerRecordRequest -): +@pytest.mark.parametrize( + "request_type", + [ + answer_record.GetAnswerRecordRequest(), + {}, + ], +) +async def test_get_answer_record_async(request_type, transport: str = "grpc_asyncio"): client = AnswerRecordsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1479,7 +1501,7 @@ async def test_get_answer_record_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( @@ -1504,11 +1526,6 @@ async def test_get_answer_record_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_answer_record_async_from_dict(): - await test_get_answer_record_async(request_type=dict) - - def test_get_answer_record_field_headers(): client = AnswerRecordsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1577,8 +1594,8 @@ async def test_get_answer_record_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - answer_record.ListAnswerRecordsRequest, - dict, + answer_record.ListAnswerRecordsRequest(), + {}, ], ) def test_list_answer_records(request_type, transport: str = "grpc"): @@ -1589,7 +1606,7 @@ def test_list_answer_records(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1639,11 +1656,12 @@ def test_list_answer_records_non_empty_request_with_auto_populated_field(): client.list_answer_records(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == answer_record.ListAnswerRecordsRequest( + request_msg = answer_record.ListAnswerRecordsRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_answer_records_use_cached_wrapped_rpc(): @@ -1728,9 +1746,14 @@ async def test_list_answer_records_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_answer_records_async( - transport: str = "grpc_asyncio", request_type=answer_record.ListAnswerRecordsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + answer_record.ListAnswerRecordsRequest(), + {}, + ], +) +async def test_list_answer_records_async(request_type, transport: str = "grpc_asyncio"): client = AnswerRecordsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1738,7 +1761,7 @@ async def test_list_answer_records_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( @@ -1763,11 +1786,6 @@ async def test_list_answer_records_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_answer_records_async_from_dict(): - await test_list_answer_records_async(request_type=dict) - - def test_list_answer_records_field_headers(): client = AnswerRecordsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2120,8 +2138,8 @@ async def test_list_answer_records_async_pages(): @pytest.mark.parametrize( "request_type", [ - gcd_answer_record.UpdateAnswerRecordRequest, - dict, + gcd_answer_record.UpdateAnswerRecordRequest(), + {}, ], ) def test_update_answer_record(request_type, transport: str = "grpc"): @@ -2132,7 +2150,7 @@ def test_update_answer_record(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2178,7 +2196,8 @@ def test_update_answer_record_non_empty_request_with_auto_populated_field(): client.update_answer_record(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_answer_record.UpdateAnswerRecordRequest() + request_msg = gcd_answer_record.UpdateAnswerRecordRequest() + assert args[0] == request_msg def test_update_answer_record_use_cached_wrapped_rpc(): @@ -2263,9 +2282,15 @@ async def test_update_answer_record_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcd_answer_record.UpdateAnswerRecordRequest(), + {}, + ], +) async def test_update_answer_record_async( - transport: str = "grpc_asyncio", - request_type=gcd_answer_record.UpdateAnswerRecordRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnswerRecordsAsyncClient( credentials=async_anonymous_credentials(), @@ -2274,7 +2299,7 @@ async def test_update_answer_record_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 +2324,6 @@ async def test_update_answer_record_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_update_answer_record_async_from_dict(): - await test_update_answer_record_async(request_type=dict) - - def test_update_answer_record_field_headers(): client = AnswerRecordsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2972,7 +2992,6 @@ def test_get_answer_record_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = answer_record.GetAnswerRecordRequest() - assert args[0] == request_msg @@ -2995,7 +3014,6 @@ def test_list_answer_records_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = answer_record.ListAnswerRecordsRequest() - assert args[0] == request_msg @@ -3018,7 +3036,6 @@ def test_update_answer_record_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_answer_record.UpdateAnswerRecordRequest() - assert args[0] == request_msg @@ -3061,7 +3078,6 @@ async def test_get_answer_record_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = answer_record.GetAnswerRecordRequest() - assert args[0] == request_msg @@ -3090,7 +3106,6 @@ async def test_list_answer_records_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = answer_record.ListAnswerRecordsRequest() - assert args[0] == request_msg @@ -3119,7 +3134,6 @@ async def test_update_answer_record_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_answer_record.UpdateAnswerRecordRequest() - assert args[0] == request_msg @@ -4329,7 +4343,6 @@ def test_get_answer_record_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = answer_record.GetAnswerRecordRequest() - assert args[0] == request_msg @@ -4351,7 +4364,6 @@ def test_list_answer_records_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = answer_record.ListAnswerRecordsRequest() - assert args[0] == request_msg @@ -4373,7 +4385,6 @@ def test_update_answer_record_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_answer_record.UpdateAnswerRecordRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_contexts.py b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_contexts.py index 480b11f4625c..36b46ae6d834 100644 --- a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_contexts.py +++ b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_contexts.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" @@ -1259,8 +1275,8 @@ def test_contexts_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - context.ListContextsRequest, - dict, + context.ListContextsRequest(), + {}, ], ) def test_list_contexts(request_type, transport: str = "grpc"): @@ -1271,7 +1287,7 @@ def test_list_contexts(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_contexts), "__call__") as call: @@ -1316,10 +1332,11 @@ def test_list_contexts_non_empty_request_with_auto_populated_field(): client.list_contexts(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == context.ListContextsRequest( + request_msg = context.ListContextsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_contexts_use_cached_wrapped_rpc(): @@ -1400,9 +1417,14 @@ async def test_list_contexts_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_contexts_async( - transport: str = "grpc_asyncio", request_type=context.ListContextsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + context.ListContextsRequest(), + {}, + ], +) +async def test_list_contexts_async(request_type, transport: str = "grpc_asyncio"): client = ContextsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1410,7 +1432,7 @@ async def test_list_contexts_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_contexts), "__call__") as call: @@ -1433,11 +1455,6 @@ async def test_list_contexts_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_contexts_async_from_dict(): - await test_list_contexts_async(request_type=dict) - - def test_list_contexts_field_headers(): client = ContextsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1774,8 +1791,8 @@ async def test_list_contexts_async_pages(): @pytest.mark.parametrize( "request_type", [ - context.GetContextRequest, - dict, + context.GetContextRequest(), + {}, ], ) def test_get_context(request_type, transport: str = "grpc"): @@ -1786,7 +1803,7 @@ def test_get_context(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_context), "__call__") as call: @@ -1832,9 +1849,10 @@ def test_get_context_non_empty_request_with_auto_populated_field(): client.get_context(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == context.GetContextRequest( + request_msg = context.GetContextRequest( name="name_value", ) + assert args[0] == request_msg def test_get_context_use_cached_wrapped_rpc(): @@ -1915,9 +1933,14 @@ async def test_get_context_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_context_async( - transport: str = "grpc_asyncio", request_type=context.GetContextRequest -): +@pytest.mark.parametrize( + "request_type", + [ + context.GetContextRequest(), + {}, + ], +) +async def test_get_context_async(request_type, transport: str = "grpc_asyncio"): client = ContextsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1925,7 +1948,7 @@ async def test_get_context_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_context), "__call__") as call: @@ -1950,11 +1973,6 @@ async def test_get_context_async( assert response.lifespan_count == 1498 -@pytest.mark.asyncio -async def test_get_context_async_from_dict(): - await test_get_context_async(request_type=dict) - - def test_get_context_field_headers(): client = ContextsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2097,8 +2115,8 @@ async def test_get_context_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcd_context.CreateContextRequest, - dict, + gcd_context.CreateContextRequest(), + {}, ], ) def test_create_context(request_type, transport: str = "grpc"): @@ -2109,7 +2127,7 @@ def test_create_context(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_context), "__call__") as call: @@ -2155,9 +2173,10 @@ def test_create_context_non_empty_request_with_auto_populated_field(): client.create_context(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_context.CreateContextRequest( + request_msg = gcd_context.CreateContextRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_context_use_cached_wrapped_rpc(): @@ -2238,9 +2257,14 @@ async def test_create_context_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_context_async( - transport: str = "grpc_asyncio", request_type=gcd_context.CreateContextRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcd_context.CreateContextRequest(), + {}, + ], +) +async def test_create_context_async(request_type, transport: str = "grpc_asyncio"): client = ContextsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2248,7 +2272,7 @@ async def test_create_context_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_context), "__call__") as call: @@ -2273,11 +2297,6 @@ async def test_create_context_async( assert response.lifespan_count == 1498 -@pytest.mark.asyncio -async def test_create_context_async_from_dict(): - await test_create_context_async(request_type=dict) - - def test_create_context_field_headers(): client = ContextsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2430,8 +2449,8 @@ async def test_create_context_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcd_context.UpdateContextRequest, - dict, + gcd_context.UpdateContextRequest(), + {}, ], ) def test_update_context(request_type, transport: str = "grpc"): @@ -2442,7 +2461,7 @@ def test_update_context(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_context), "__call__") as call: @@ -2486,7 +2505,8 @@ def test_update_context_non_empty_request_with_auto_populated_field(): client.update_context(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_context.UpdateContextRequest() + request_msg = gcd_context.UpdateContextRequest() + assert args[0] == request_msg def test_update_context_use_cached_wrapped_rpc(): @@ -2567,9 +2587,14 @@ async def test_update_context_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_context_async( - transport: str = "grpc_asyncio", request_type=gcd_context.UpdateContextRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcd_context.UpdateContextRequest(), + {}, + ], +) +async def test_update_context_async(request_type, transport: str = "grpc_asyncio"): client = ContextsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2577,7 +2602,7 @@ async def test_update_context_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_context), "__call__") as call: @@ -2602,11 +2627,6 @@ async def test_update_context_async( assert response.lifespan_count == 1498 -@pytest.mark.asyncio -async def test_update_context_async_from_dict(): - await test_update_context_async(request_type=dict) - - def test_update_context_field_headers(): client = ContextsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2759,8 +2779,8 @@ async def test_update_context_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - context.DeleteContextRequest, - dict, + context.DeleteContextRequest(), + {}, ], ) def test_delete_context(request_type, transport: str = "grpc"): @@ -2771,7 +2791,7 @@ def test_delete_context(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_context), "__call__") as call: @@ -2812,9 +2832,10 @@ def test_delete_context_non_empty_request_with_auto_populated_field(): client.delete_context(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == context.DeleteContextRequest( + request_msg = context.DeleteContextRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_context_use_cached_wrapped_rpc(): @@ -2895,9 +2916,14 @@ async def test_delete_context_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_context_async( - transport: str = "grpc_asyncio", request_type=context.DeleteContextRequest -): +@pytest.mark.parametrize( + "request_type", + [ + context.DeleteContextRequest(), + {}, + ], +) +async def test_delete_context_async(request_type, transport: str = "grpc_asyncio"): client = ContextsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2905,7 +2931,7 @@ async def test_delete_context_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_context), "__call__") as call: @@ -2923,11 +2949,6 @@ async def test_delete_context_async( assert response is None -@pytest.mark.asyncio -async def test_delete_context_async_from_dict(): - await test_delete_context_async(request_type=dict) - - def test_delete_context_field_headers(): client = ContextsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3070,8 +3091,8 @@ async def test_delete_context_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - context.DeleteAllContextsRequest, - dict, + context.DeleteAllContextsRequest(), + {}, ], ) def test_delete_all_contexts(request_type, transport: str = "grpc"): @@ -3082,7 +3103,7 @@ def test_delete_all_contexts(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3127,9 +3148,10 @@ def test_delete_all_contexts_non_empty_request_with_auto_populated_field(): client.delete_all_contexts(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == context.DeleteAllContextsRequest( + request_msg = context.DeleteAllContextsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_delete_all_contexts_use_cached_wrapped_rpc(): @@ -3214,9 +3236,14 @@ async def test_delete_all_contexts_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_all_contexts_async( - transport: str = "grpc_asyncio", request_type=context.DeleteAllContextsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + context.DeleteAllContextsRequest(), + {}, + ], +) +async def test_delete_all_contexts_async(request_type, transport: str = "grpc_asyncio"): client = ContextsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3224,7 +3251,7 @@ async def test_delete_all_contexts_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( @@ -3244,11 +3271,6 @@ async def test_delete_all_contexts_async( assert response is None -@pytest.mark.asyncio -async def test_delete_all_contexts_async_from_dict(): - await test_delete_all_contexts_async(request_type=dict) - - def test_delete_all_contexts_field_headers(): client = ContextsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4670,7 +4692,6 @@ def test_list_contexts_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = context.ListContextsRequest() - assert args[0] == request_msg @@ -4691,7 +4712,6 @@ def test_get_context_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = context.GetContextRequest() - assert args[0] == request_msg @@ -4712,7 +4732,6 @@ def test_create_context_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_context.CreateContextRequest() - assert args[0] == request_msg @@ -4733,7 +4752,6 @@ def test_update_context_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_context.UpdateContextRequest() - assert args[0] == request_msg @@ -4754,7 +4772,6 @@ def test_delete_context_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = context.DeleteContextRequest() - assert args[0] == request_msg @@ -4777,7 +4794,6 @@ def test_delete_all_contexts_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = context.DeleteAllContextsRequest() - assert args[0] == request_msg @@ -4818,7 +4834,6 @@ async def test_list_contexts_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = context.ListContextsRequest() - assert args[0] == request_msg @@ -4846,7 +4861,6 @@ async def test_get_context_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = context.GetContextRequest() - assert args[0] == request_msg @@ -4874,7 +4888,6 @@ async def test_create_context_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_context.CreateContextRequest() - assert args[0] == request_msg @@ -4902,7 +4915,6 @@ async def test_update_context_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_context.UpdateContextRequest() - assert args[0] == request_msg @@ -4925,7 +4937,6 @@ async def test_delete_context_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = context.DeleteContextRequest() - assert args[0] == request_msg @@ -4950,7 +4961,6 @@ async def test_delete_all_contexts_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = context.DeleteAllContextsRequest() - assert args[0] == request_msg @@ -6159,7 +6169,6 @@ def test_list_contexts_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = context.ListContextsRequest() - assert args[0] == request_msg @@ -6179,7 +6188,6 @@ def test_get_context_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = context.GetContextRequest() - assert args[0] == request_msg @@ -6199,7 +6207,6 @@ def test_create_context_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_context.CreateContextRequest() - assert args[0] == request_msg @@ -6219,7 +6226,6 @@ def test_update_context_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_context.UpdateContextRequest() - assert args[0] == request_msg @@ -6239,7 +6245,6 @@ def test_delete_context_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = context.DeleteContextRequest() - assert args[0] == request_msg @@ -6261,7 +6266,6 @@ def test_delete_all_contexts_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = context.DeleteAllContextsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_conversation_profiles.py b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_conversation_profiles.py index a07a40d6aca2..b29df5e84d29 100644 --- a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_conversation_profiles.py +++ b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_conversation_profiles.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 @@ -124,6 +125,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" @@ -1390,8 +1406,8 @@ def test_conversation_profiles_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - conversation_profile.ListConversationProfilesRequest, - dict, + conversation_profile.ListConversationProfilesRequest(), + {}, ], ) def test_list_conversation_profiles(request_type, transport: str = "grpc"): @@ -1402,7 +1418,7 @@ def test_list_conversation_profiles(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1451,10 +1467,11 @@ def test_list_conversation_profiles_non_empty_request_with_auto_populated_field( client.list_conversation_profiles(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversation_profile.ListConversationProfilesRequest( + request_msg = conversation_profile.ListConversationProfilesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_conversation_profiles_use_cached_wrapped_rpc(): @@ -1540,9 +1557,15 @@ async def test_list_conversation_profiles_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + conversation_profile.ListConversationProfilesRequest(), + {}, + ], +) async def test_list_conversation_profiles_async( - transport: str = "grpc_asyncio", - request_type=conversation_profile.ListConversationProfilesRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConversationProfilesAsyncClient( credentials=async_anonymous_credentials(), @@ -1551,7 +1574,7 @@ async def test_list_conversation_profiles_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( @@ -1576,11 +1599,6 @@ async def test_list_conversation_profiles_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_conversation_profiles_async_from_dict(): - await test_list_conversation_profiles_async(request_type=dict) - - def test_list_conversation_profiles_field_headers(): client = ConversationProfilesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1939,8 +1957,8 @@ async def test_list_conversation_profiles_async_pages(): @pytest.mark.parametrize( "request_type", [ - conversation_profile.GetConversationProfileRequest, - dict, + conversation_profile.GetConversationProfileRequest(), + {}, ], ) def test_get_conversation_profile(request_type, transport: str = "grpc"): @@ -1951,7 +1969,7 @@ def test_get_conversation_profile(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,9 +2027,10 @@ def test_get_conversation_profile_non_empty_request_with_auto_populated_field(): client.get_conversation_profile(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversation_profile.GetConversationProfileRequest( + request_msg = conversation_profile.GetConversationProfileRequest( name="name_value", ) + assert args[0] == request_msg def test_get_conversation_profile_use_cached_wrapped_rpc(): @@ -2097,9 +2116,15 @@ async def test_get_conversation_profile_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + conversation_profile.GetConversationProfileRequest(), + {}, + ], +) async def test_get_conversation_profile_async( - transport: str = "grpc_asyncio", - request_type=conversation_profile.GetConversationProfileRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConversationProfilesAsyncClient( credentials=async_anonymous_credentials(), @@ -2108,7 +2133,7 @@ async def test_get_conversation_profile_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( @@ -2143,11 +2168,6 @@ async def test_get_conversation_profile_async( assert response.security_settings == "security_settings_value" -@pytest.mark.asyncio -async def test_get_conversation_profile_async_from_dict(): - await test_get_conversation_profile_async(request_type=dict) - - def test_get_conversation_profile_field_headers(): client = ConversationProfilesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2302,8 +2322,8 @@ async def test_get_conversation_profile_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcd_conversation_profile.CreateConversationProfileRequest, - dict, + gcd_conversation_profile.CreateConversationProfileRequest(), + {}, ], ) def test_create_conversation_profile(request_type, transport: str = "grpc"): @@ -2314,7 +2334,7 @@ def test_create_conversation_profile(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2372,9 +2392,10 @@ def test_create_conversation_profile_non_empty_request_with_auto_populated_field client.create_conversation_profile(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_conversation_profile.CreateConversationProfileRequest( + request_msg = gcd_conversation_profile.CreateConversationProfileRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_conversation_profile_use_cached_wrapped_rpc(): @@ -2460,9 +2481,15 @@ async def test_create_conversation_profile_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcd_conversation_profile.CreateConversationProfileRequest(), + {}, + ], +) async def test_create_conversation_profile_async( - transport: str = "grpc_asyncio", - request_type=gcd_conversation_profile.CreateConversationProfileRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConversationProfilesAsyncClient( credentials=async_anonymous_credentials(), @@ -2471,7 +2498,7 @@ async def test_create_conversation_profile_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( @@ -2506,11 +2533,6 @@ async def test_create_conversation_profile_async( assert response.security_settings == "security_settings_value" -@pytest.mark.asyncio -async def test_create_conversation_profile_async_from_dict(): - await test_create_conversation_profile_async(request_type=dict) - - def test_create_conversation_profile_field_headers(): client = ConversationProfilesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2683,8 +2705,8 @@ async def test_create_conversation_profile_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcd_conversation_profile.UpdateConversationProfileRequest, - dict, + gcd_conversation_profile.UpdateConversationProfileRequest(), + {}, ], ) def test_update_conversation_profile(request_type, transport: str = "grpc"): @@ -2695,7 +2717,7 @@ def test_update_conversation_profile(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2751,7 +2773,8 @@ def test_update_conversation_profile_non_empty_request_with_auto_populated_field client.update_conversation_profile(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_conversation_profile.UpdateConversationProfileRequest() + request_msg = gcd_conversation_profile.UpdateConversationProfileRequest() + assert args[0] == request_msg def test_update_conversation_profile_use_cached_wrapped_rpc(): @@ -2837,9 +2860,15 @@ async def test_update_conversation_profile_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcd_conversation_profile.UpdateConversationProfileRequest(), + {}, + ], +) async def test_update_conversation_profile_async( - transport: str = "grpc_asyncio", - request_type=gcd_conversation_profile.UpdateConversationProfileRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConversationProfilesAsyncClient( credentials=async_anonymous_credentials(), @@ -2848,7 +2877,7 @@ async def test_update_conversation_profile_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( @@ -2883,11 +2912,6 @@ async def test_update_conversation_profile_async( assert response.security_settings == "security_settings_value" -@pytest.mark.asyncio -async def test_update_conversation_profile_async_from_dict(): - await test_update_conversation_profile_async(request_type=dict) - - def test_update_conversation_profile_field_headers(): client = ConversationProfilesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3060,8 +3084,8 @@ async def test_update_conversation_profile_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversation_profile.DeleteConversationProfileRequest, - dict, + conversation_profile.DeleteConversationProfileRequest(), + {}, ], ) def test_delete_conversation_profile(request_type, transport: str = "grpc"): @@ -3072,7 +3096,7 @@ def test_delete_conversation_profile(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3117,9 +3141,10 @@ def test_delete_conversation_profile_non_empty_request_with_auto_populated_field client.delete_conversation_profile(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversation_profile.DeleteConversationProfileRequest( + request_msg = conversation_profile.DeleteConversationProfileRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_conversation_profile_use_cached_wrapped_rpc(): @@ -3205,9 +3230,15 @@ async def test_delete_conversation_profile_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + conversation_profile.DeleteConversationProfileRequest(), + {}, + ], +) async def test_delete_conversation_profile_async( - transport: str = "grpc_asyncio", - request_type=conversation_profile.DeleteConversationProfileRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConversationProfilesAsyncClient( credentials=async_anonymous_credentials(), @@ -3216,7 +3247,7 @@ async def test_delete_conversation_profile_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( @@ -3236,11 +3267,6 @@ async def test_delete_conversation_profile_async( assert response is None -@pytest.mark.asyncio -async def test_delete_conversation_profile_async_from_dict(): - await test_delete_conversation_profile_async(request_type=dict) - - def test_delete_conversation_profile_field_headers(): client = ConversationProfilesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3391,8 +3417,8 @@ async def test_delete_conversation_profile_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcd_conversation_profile.SetSuggestionFeatureConfigRequest, - dict, + gcd_conversation_profile.SetSuggestionFeatureConfigRequest(), + {}, ], ) def test_set_suggestion_feature_config(request_type, transport: str = "grpc"): @@ -3403,7 +3429,7 @@ def test_set_suggestion_feature_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( @@ -3448,9 +3474,10 @@ def test_set_suggestion_feature_config_non_empty_request_with_auto_populated_fie client.set_suggestion_feature_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_conversation_profile.SetSuggestionFeatureConfigRequest( + request_msg = gcd_conversation_profile.SetSuggestionFeatureConfigRequest( conversation_profile="conversation_profile_value", ) + assert args[0] == request_msg def test_set_suggestion_feature_config_use_cached_wrapped_rpc(): @@ -3546,9 +3573,15 @@ async def test_set_suggestion_feature_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcd_conversation_profile.SetSuggestionFeatureConfigRequest(), + {}, + ], +) async def test_set_suggestion_feature_config_async( - transport: str = "grpc_asyncio", - request_type=gcd_conversation_profile.SetSuggestionFeatureConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConversationProfilesAsyncClient( credentials=async_anonymous_credentials(), @@ -3557,7 +3590,7 @@ async def test_set_suggestion_feature_config_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( @@ -3579,11 +3612,6 @@ async def test_set_suggestion_feature_config_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_set_suggestion_feature_config_async_from_dict(): - await test_set_suggestion_feature_config_async(request_type=dict) - - def test_set_suggestion_feature_config_field_headers(): client = ConversationProfilesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3786,8 +3814,8 @@ async def test_set_suggestion_feature_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcd_conversation_profile.ClearSuggestionFeatureConfigRequest, - dict, + gcd_conversation_profile.ClearSuggestionFeatureConfigRequest(), + {}, ], ) def test_clear_suggestion_feature_config(request_type, transport: str = "grpc"): @@ -3798,7 +3826,7 @@ def test_clear_suggestion_feature_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( @@ -3843,9 +3871,10 @@ def test_clear_suggestion_feature_config_non_empty_request_with_auto_populated_f client.clear_suggestion_feature_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_conversation_profile.ClearSuggestionFeatureConfigRequest( + request_msg = gcd_conversation_profile.ClearSuggestionFeatureConfigRequest( conversation_profile="conversation_profile_value", ) + assert args[0] == request_msg def test_clear_suggestion_feature_config_use_cached_wrapped_rpc(): @@ -3941,9 +3970,15 @@ async def test_clear_suggestion_feature_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcd_conversation_profile.ClearSuggestionFeatureConfigRequest(), + {}, + ], +) async def test_clear_suggestion_feature_config_async( - transport: str = "grpc_asyncio", - request_type=gcd_conversation_profile.ClearSuggestionFeatureConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConversationProfilesAsyncClient( credentials=async_anonymous_credentials(), @@ -3952,7 +3987,7 @@ async def test_clear_suggestion_feature_config_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( @@ -3974,11 +4009,6 @@ async def test_clear_suggestion_feature_config_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_clear_suggestion_feature_config_async_from_dict(): - await test_clear_suggestion_feature_config_async(request_type=dict) - - def test_clear_suggestion_feature_config_field_headers(): client = ConversationProfilesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5709,7 +5739,6 @@ def test_list_conversation_profiles_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation_profile.ListConversationProfilesRequest() - assert args[0] == request_msg @@ -5732,7 +5761,6 @@ def test_get_conversation_profile_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation_profile.GetConversationProfileRequest() - assert args[0] == request_msg @@ -5755,7 +5783,6 @@ def test_create_conversation_profile_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_conversation_profile.CreateConversationProfileRequest() - assert args[0] == request_msg @@ -5778,7 +5805,6 @@ def test_update_conversation_profile_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_conversation_profile.UpdateConversationProfileRequest() - assert args[0] == request_msg @@ -5801,7 +5827,6 @@ def test_delete_conversation_profile_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation_profile.DeleteConversationProfileRequest() - assert args[0] == request_msg @@ -5824,7 +5849,6 @@ def test_set_suggestion_feature_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_conversation_profile.SetSuggestionFeatureConfigRequest() - assert args[0] == request_msg @@ -5847,7 +5871,6 @@ def test_clear_suggestion_feature_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_conversation_profile.ClearSuggestionFeatureConfigRequest() - assert args[0] == request_msg @@ -5890,7 +5913,6 @@ async def test_list_conversation_profiles_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation_profile.ListConversationProfilesRequest() - assert args[0] == request_msg @@ -5924,7 +5946,6 @@ async def test_get_conversation_profile_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation_profile.GetConversationProfileRequest() - assert args[0] == request_msg @@ -5958,7 +5979,6 @@ async def test_create_conversation_profile_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_conversation_profile.CreateConversationProfileRequest() - assert args[0] == request_msg @@ -5992,7 +6012,6 @@ async def test_update_conversation_profile_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_conversation_profile.UpdateConversationProfileRequest() - assert args[0] == request_msg @@ -6017,7 +6036,6 @@ async def test_delete_conversation_profile_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation_profile.DeleteConversationProfileRequest() - assert args[0] == request_msg @@ -6044,7 +6062,6 @@ async def test_set_suggestion_feature_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_conversation_profile.SetSuggestionFeatureConfigRequest() - assert args[0] == request_msg @@ -6071,7 +6088,6 @@ async def test_clear_suggestion_feature_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_conversation_profile.ClearSuggestionFeatureConfigRequest() - assert args[0] == request_msg @@ -7765,7 +7781,6 @@ def test_list_conversation_profiles_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation_profile.ListConversationProfilesRequest() - assert args[0] == request_msg @@ -7787,7 +7802,6 @@ def test_get_conversation_profile_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation_profile.GetConversationProfileRequest() - assert args[0] == request_msg @@ -7809,7 +7823,6 @@ def test_create_conversation_profile_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_conversation_profile.CreateConversationProfileRequest() - assert args[0] == request_msg @@ -7831,7 +7844,6 @@ def test_update_conversation_profile_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_conversation_profile.UpdateConversationProfileRequest() - assert args[0] == request_msg @@ -7853,7 +7865,6 @@ def test_delete_conversation_profile_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation_profile.DeleteConversationProfileRequest() - assert args[0] == request_msg @@ -7875,7 +7886,6 @@ def test_set_suggestion_feature_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_conversation_profile.SetSuggestionFeatureConfigRequest() - assert args[0] == request_msg @@ -7897,7 +7907,6 @@ def test_clear_suggestion_feature_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_conversation_profile.ClearSuggestionFeatureConfigRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_conversations.py b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_conversations.py index ed1c4e15844e..ffb3f09588bb 100644 --- a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_conversations.py +++ b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_conversations.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 @@ -126,6 +127,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" @@ -1328,8 +1344,8 @@ def test_conversations_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - gcd_conversation.CreateConversationRequest, - dict, + gcd_conversation.CreateConversationRequest(), + {}, ], ) def test_create_conversation(request_type, transport: str = "grpc"): @@ -1340,7 +1356,7 @@ def test_create_conversation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1401,10 +1417,11 @@ def test_create_conversation_non_empty_request_with_auto_populated_field(): client.create_conversation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_conversation.CreateConversationRequest( + request_msg = gcd_conversation.CreateConversationRequest( parent="parent_value", conversation_id="conversation_id_value", ) + assert args[0] == request_msg def test_create_conversation_use_cached_wrapped_rpc(): @@ -1489,10 +1506,14 @@ async def test_create_conversation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_conversation_async( - transport: str = "grpc_asyncio", - request_type=gcd_conversation.CreateConversationRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + gcd_conversation.CreateConversationRequest(), + {}, + ], +) +async def test_create_conversation_async(request_type, transport: str = "grpc_asyncio"): client = ConversationsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1500,7 +1521,7 @@ async def test_create_conversation_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( @@ -1537,11 +1558,6 @@ async def test_create_conversation_async( ) -@pytest.mark.asyncio -async def test_create_conversation_async_from_dict(): - await test_create_conversation_async(request_type=dict) - - def test_create_conversation_field_headers(): client = ConversationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1706,8 +1722,8 @@ async def test_create_conversation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversation.ListConversationsRequest, - dict, + conversation.ListConversationsRequest(), + {}, ], ) def test_list_conversations(request_type, transport: str = "grpc"): @@ -1718,7 +1734,7 @@ def test_list_conversations(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1768,11 +1784,12 @@ def test_list_conversations_non_empty_request_with_auto_populated_field(): client.list_conversations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversation.ListConversationsRequest( + request_msg = conversation.ListConversationsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_conversations_use_cached_wrapped_rpc(): @@ -1857,9 +1874,14 @@ async def test_list_conversations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_conversations_async( - transport: str = "grpc_asyncio", request_type=conversation.ListConversationsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + conversation.ListConversationsRequest(), + {}, + ], +) +async def test_list_conversations_async(request_type, transport: str = "grpc_asyncio"): client = ConversationsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1867,7 +1889,7 @@ async def test_list_conversations_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( @@ -1892,11 +1914,6 @@ async def test_list_conversations_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_conversations_async_from_dict(): - await test_list_conversations_async(request_type=dict) - - def test_list_conversations_field_headers(): client = ConversationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2249,8 +2266,8 @@ async def test_list_conversations_async_pages(): @pytest.mark.parametrize( "request_type", [ - conversation.GetConversationRequest, - dict, + conversation.GetConversationRequest(), + {}, ], ) def test_get_conversation(request_type, transport: str = "grpc"): @@ -2261,7 +2278,7 @@ def test_get_conversation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_conversation), "__call__") as call: @@ -2316,9 +2333,10 @@ def test_get_conversation_non_empty_request_with_auto_populated_field(): client.get_conversation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversation.GetConversationRequest( + request_msg = conversation.GetConversationRequest( name="name_value", ) + assert args[0] == request_msg def test_get_conversation_use_cached_wrapped_rpc(): @@ -2401,9 +2419,14 @@ async def test_get_conversation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_conversation_async( - transport: str = "grpc_asyncio", request_type=conversation.GetConversationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + conversation.GetConversationRequest(), + {}, + ], +) +async def test_get_conversation_async(request_type, transport: str = "grpc_asyncio"): client = ConversationsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2411,7 +2434,7 @@ async def test_get_conversation_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_conversation), "__call__") as call: @@ -2445,11 +2468,6 @@ async def test_get_conversation_async( ) -@pytest.mark.asyncio -async def test_get_conversation_async_from_dict(): - await test_get_conversation_async(request_type=dict) - - def test_get_conversation_field_headers(): client = ConversationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2596,8 +2614,8 @@ async def test_get_conversation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversation.CompleteConversationRequest, - dict, + conversation.CompleteConversationRequest(), + {}, ], ) def test_complete_conversation(request_type, transport: str = "grpc"): @@ -2608,7 +2626,7 @@ def test_complete_conversation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2667,9 +2685,10 @@ def test_complete_conversation_non_empty_request_with_auto_populated_field(): client.complete_conversation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversation.CompleteConversationRequest( + request_msg = conversation.CompleteConversationRequest( name="name_value", ) + assert args[0] == request_msg def test_complete_conversation_use_cached_wrapped_rpc(): @@ -2755,9 +2774,15 @@ async def test_complete_conversation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + conversation.CompleteConversationRequest(), + {}, + ], +) async def test_complete_conversation_async( - transport: str = "grpc_asyncio", - request_type=conversation.CompleteConversationRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConversationsAsyncClient( credentials=async_anonymous_credentials(), @@ -2766,7 +2791,7 @@ async def test_complete_conversation_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( @@ -2802,11 +2827,6 @@ async def test_complete_conversation_async( ) -@pytest.mark.asyncio -async def test_complete_conversation_async_from_dict(): - await test_complete_conversation_async(request_type=dict) - - def test_complete_conversation_field_headers(): client = ConversationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2961,8 +2981,8 @@ async def test_complete_conversation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcd_conversation.IngestContextReferencesRequest, - dict, + gcd_conversation.IngestContextReferencesRequest(), + {}, ], ) def test_ingest_context_references(request_type, transport: str = "grpc"): @@ -2973,7 +2993,7 @@ def test_ingest_context_references(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3018,9 +3038,10 @@ def test_ingest_context_references_non_empty_request_with_auto_populated_field() client.ingest_context_references(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_conversation.IngestContextReferencesRequest( + request_msg = gcd_conversation.IngestContextReferencesRequest( conversation="conversation_value", ) + assert args[0] == request_msg def test_ingest_context_references_use_cached_wrapped_rpc(): @@ -3106,9 +3127,15 @@ async def test_ingest_context_references_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcd_conversation.IngestContextReferencesRequest(), + {}, + ], +) async def test_ingest_context_references_async( - transport: str = "grpc_asyncio", - request_type=gcd_conversation.IngestContextReferencesRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConversationsAsyncClient( credentials=async_anonymous_credentials(), @@ -3117,7 +3144,7 @@ async def test_ingest_context_references_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( @@ -3139,11 +3166,6 @@ async def test_ingest_context_references_async( assert isinstance(response, gcd_conversation.IngestContextReferencesResponse) -@pytest.mark.asyncio -async def test_ingest_context_references_async_from_dict(): - await test_ingest_context_references_async(request_type=dict) - - def test_ingest_context_references_field_headers(): client = ConversationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3356,8 +3378,8 @@ async def test_ingest_context_references_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversation.BatchCreateMessagesRequest, - dict, + conversation.BatchCreateMessagesRequest(), + {}, ], ) def test_batch_create_messages(request_type, transport: str = "grpc"): @@ -3368,7 +3390,7 @@ def test_batch_create_messages(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3413,9 +3435,10 @@ def test_batch_create_messages_non_empty_request_with_auto_populated_field(): client.batch_create_messages(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversation.BatchCreateMessagesRequest( + request_msg = conversation.BatchCreateMessagesRequest( parent="parent_value", ) + assert args[0] == request_msg def test_batch_create_messages_use_cached_wrapped_rpc(): @@ -3501,9 +3524,15 @@ async def test_batch_create_messages_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + conversation.BatchCreateMessagesRequest(), + {}, + ], +) async def test_batch_create_messages_async( - transport: str = "grpc_asyncio", - request_type=conversation.BatchCreateMessagesRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConversationsAsyncClient( credentials=async_anonymous_credentials(), @@ -3512,7 +3541,7 @@ async def test_batch_create_messages_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( @@ -3534,11 +3563,6 @@ async def test_batch_create_messages_async( assert isinstance(response, conversation.BatchCreateMessagesResponse) -@pytest.mark.asyncio -async def test_batch_create_messages_async_from_dict(): - await test_batch_create_messages_async(request_type=dict) - - def test_batch_create_messages_field_headers(): client = ConversationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3703,8 +3727,8 @@ async def test_batch_create_messages_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversation.ListMessagesRequest, - dict, + conversation.ListMessagesRequest(), + {}, ], ) def test_list_messages(request_type, transport: str = "grpc"): @@ -3715,7 +3739,7 @@ def test_list_messages(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_messages), "__call__") as call: @@ -3761,11 +3785,12 @@ def test_list_messages_non_empty_request_with_auto_populated_field(): client.list_messages(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversation.ListMessagesRequest( + request_msg = conversation.ListMessagesRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_messages_use_cached_wrapped_rpc(): @@ -3846,9 +3871,14 @@ async def test_list_messages_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_messages_async( - transport: str = "grpc_asyncio", request_type=conversation.ListMessagesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + conversation.ListMessagesRequest(), + {}, + ], +) +async def test_list_messages_async(request_type, transport: str = "grpc_asyncio"): client = ConversationsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3856,7 +3886,7 @@ async def test_list_messages_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_messages), "__call__") as call: @@ -3879,11 +3909,6 @@ async def test_list_messages_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_messages_async_from_dict(): - await test_list_messages_async(request_type=dict) - - def test_list_messages_field_headers(): client = ConversationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4220,8 +4245,8 @@ async def test_list_messages_async_pages(): @pytest.mark.parametrize( "request_type", [ - gcd_conversation.SuggestConversationSummaryRequest, - dict, + gcd_conversation.SuggestConversationSummaryRequest(), + {}, ], ) def test_suggest_conversation_summary(request_type, transport: str = "grpc"): @@ -4232,7 +4257,7 @@ def test_suggest_conversation_summary(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4283,10 +4308,11 @@ def test_suggest_conversation_summary_non_empty_request_with_auto_populated_fiel client.suggest_conversation_summary(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_conversation.SuggestConversationSummaryRequest( + request_msg = gcd_conversation.SuggestConversationSummaryRequest( conversation="conversation_value", latest_message="latest_message_value", ) + assert args[0] == request_msg def test_suggest_conversation_summary_use_cached_wrapped_rpc(): @@ -4372,9 +4398,15 @@ async def test_suggest_conversation_summary_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcd_conversation.SuggestConversationSummaryRequest(), + {}, + ], +) async def test_suggest_conversation_summary_async( - transport: str = "grpc_asyncio", - request_type=gcd_conversation.SuggestConversationSummaryRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConversationsAsyncClient( credentials=async_anonymous_credentials(), @@ -4383,7 +4415,7 @@ async def test_suggest_conversation_summary_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( @@ -4410,11 +4442,6 @@ async def test_suggest_conversation_summary_async( assert response.context_size == 1311 -@pytest.mark.asyncio -async def test_suggest_conversation_summary_async_from_dict(): - await test_suggest_conversation_summary_async(request_type=dict) - - def test_suggest_conversation_summary_field_headers(): client = ConversationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4569,8 +4596,8 @@ async def test_suggest_conversation_summary_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversation.GenerateStatelessSummaryRequest, - dict, + conversation.GenerateStatelessSummaryRequest(), + {}, ], ) def test_generate_stateless_summary(request_type, transport: str = "grpc"): @@ -4581,7 +4608,7 @@ def test_generate_stateless_summary(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4631,9 +4658,10 @@ def test_generate_stateless_summary_non_empty_request_with_auto_populated_field( client.generate_stateless_summary(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversation.GenerateStatelessSummaryRequest( + request_msg = conversation.GenerateStatelessSummaryRequest( latest_message="latest_message_value", ) + assert args[0] == request_msg def test_generate_stateless_summary_use_cached_wrapped_rpc(): @@ -4719,9 +4747,15 @@ async def test_generate_stateless_summary_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + conversation.GenerateStatelessSummaryRequest(), + {}, + ], +) async def test_generate_stateless_summary_async( - transport: str = "grpc_asyncio", - request_type=conversation.GenerateStatelessSummaryRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConversationsAsyncClient( credentials=async_anonymous_credentials(), @@ -4730,7 +4764,7 @@ async def test_generate_stateless_summary_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( @@ -4757,11 +4791,6 @@ async def test_generate_stateless_summary_async( assert response.context_size == 1311 -@pytest.mark.asyncio -async def test_generate_stateless_summary_async_from_dict(): - await test_generate_stateless_summary_async(request_type=dict) - - def test_generate_stateless_summary_field_headers(): client = ConversationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4830,8 +4859,8 @@ async def test_generate_stateless_summary_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - conversation.GenerateStatelessSuggestionRequest, - dict, + conversation.GenerateStatelessSuggestionRequest(), + {}, ], ) def test_generate_stateless_suggestion(request_type, transport: str = "grpc"): @@ -4842,7 +4871,7 @@ def test_generate_stateless_suggestion(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4889,11 +4918,12 @@ def test_generate_stateless_suggestion_non_empty_request_with_auto_populated_fie client.generate_stateless_suggestion(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversation.GenerateStatelessSuggestionRequest( + request_msg = conversation.GenerateStatelessSuggestionRequest( parent="parent_value", generator_name="generator_name_value", security_settings="security_settings_value", ) + assert args[0] == request_msg def test_generate_stateless_suggestion_use_cached_wrapped_rpc(): @@ -4979,9 +5009,15 @@ async def test_generate_stateless_suggestion_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + conversation.GenerateStatelessSuggestionRequest(), + {}, + ], +) async def test_generate_stateless_suggestion_async( - transport: str = "grpc_asyncio", - request_type=conversation.GenerateStatelessSuggestionRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConversationsAsyncClient( credentials=async_anonymous_credentials(), @@ -4990,7 +5026,7 @@ async def test_generate_stateless_suggestion_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( @@ -5012,11 +5048,6 @@ async def test_generate_stateless_suggestion_async( assert isinstance(response, conversation.GenerateStatelessSuggestionResponse) -@pytest.mark.asyncio -async def test_generate_stateless_suggestion_async_from_dict(): - await test_generate_stateless_suggestion_async(request_type=dict) - - def test_generate_stateless_suggestion_field_headers(): client = ConversationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5085,8 +5116,8 @@ async def test_generate_stateless_suggestion_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - conversation.SearchKnowledgeRequest, - dict, + conversation.SearchKnowledgeRequest(), + {}, ], ) def test_search_knowledge(request_type, transport: str = "grpc"): @@ -5097,7 +5128,7 @@ def test_search_knowledge(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.search_knowledge), "__call__") as call: @@ -5145,13 +5176,14 @@ def test_search_knowledge_non_empty_request_with_auto_populated_field(): client.search_knowledge(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversation.SearchKnowledgeRequest( + request_msg = conversation.SearchKnowledgeRequest( parent="parent_value", conversation_profile="conversation_profile_value", session_id="session_id_value", conversation="conversation_value", latest_message="latest_message_value", ) + assert args[0] == request_msg def test_search_knowledge_use_cached_wrapped_rpc(): @@ -5234,9 +5266,14 @@ async def test_search_knowledge_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_search_knowledge_async( - transport: str = "grpc_asyncio", request_type=conversation.SearchKnowledgeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + conversation.SearchKnowledgeRequest(), + {}, + ], +) +async def test_search_knowledge_async(request_type, transport: str = "grpc_asyncio"): client = ConversationsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5244,7 +5281,7 @@ async def test_search_knowledge_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.search_knowledge), "__call__") as call: @@ -5267,11 +5304,6 @@ async def test_search_knowledge_async( assert response.rewritten_query == "rewritten_query_value" -@pytest.mark.asyncio -async def test_search_knowledge_async_from_dict(): - await test_search_knowledge_async(request_type=dict) - - def test_search_knowledge_field_headers(): client = ConversationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5336,8 +5368,8 @@ async def test_search_knowledge_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - gcd_conversation.GenerateSuggestionsRequest, - dict, + gcd_conversation.GenerateSuggestionsRequest(), + {}, ], ) def test_generate_suggestions(request_type, transport: str = "grpc"): @@ -5348,7 +5380,7 @@ def test_generate_suggestions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5397,10 +5429,11 @@ def test_generate_suggestions_non_empty_request_with_auto_populated_field(): client.generate_suggestions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_conversation.GenerateSuggestionsRequest( + request_msg = gcd_conversation.GenerateSuggestionsRequest( conversation="conversation_value", latest_message="latest_message_value", ) + assert args[0] == request_msg def test_generate_suggestions_use_cached_wrapped_rpc(): @@ -5485,9 +5518,15 @@ async def test_generate_suggestions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcd_conversation.GenerateSuggestionsRequest(), + {}, + ], +) async def test_generate_suggestions_async( - transport: str = "grpc_asyncio", - request_type=gcd_conversation.GenerateSuggestionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConversationsAsyncClient( credentials=async_anonymous_credentials(), @@ -5496,7 +5535,7 @@ async def test_generate_suggestions_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( @@ -5521,11 +5560,6 @@ async def test_generate_suggestions_async( assert response.latest_message == "latest_message_value" -@pytest.mark.asyncio -async def test_generate_suggestions_async_from_dict(): - await test_generate_suggestions_async(request_type=dict) - - def test_generate_suggestions_field_headers(): client = ConversationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8057,7 +8091,6 @@ def test_create_conversation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_conversation.CreateConversationRequest() - assert args[0] == request_msg @@ -8080,7 +8113,6 @@ def test_list_conversations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation.ListConversationsRequest() - assert args[0] == request_msg @@ -8101,7 +8133,6 @@ def test_get_conversation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation.GetConversationRequest() - assert args[0] == request_msg @@ -8124,7 +8155,6 @@ def test_complete_conversation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation.CompleteConversationRequest() - assert args[0] == request_msg @@ -8147,7 +8177,6 @@ def test_ingest_context_references_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_conversation.IngestContextReferencesRequest() - assert args[0] == request_msg @@ -8170,7 +8199,6 @@ def test_batch_create_messages_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation.BatchCreateMessagesRequest() - assert args[0] == request_msg @@ -8191,7 +8219,6 @@ def test_list_messages_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation.ListMessagesRequest() - assert args[0] == request_msg @@ -8214,7 +8241,6 @@ def test_suggest_conversation_summary_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_conversation.SuggestConversationSummaryRequest() - assert args[0] == request_msg @@ -8237,7 +8263,6 @@ def test_generate_stateless_summary_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation.GenerateStatelessSummaryRequest() - assert args[0] == request_msg @@ -8260,7 +8285,6 @@ def test_generate_stateless_suggestion_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation.GenerateStatelessSuggestionRequest() - assert args[0] == request_msg @@ -8281,7 +8305,6 @@ def test_search_knowledge_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation.SearchKnowledgeRequest() - assert args[0] == request_msg @@ -8304,7 +8327,6 @@ def test_generate_suggestions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_conversation.GenerateSuggestionsRequest() - assert args[0] == request_msg @@ -8350,7 +8372,6 @@ async def test_create_conversation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_conversation.CreateConversationRequest() - assert args[0] == request_msg @@ -8379,7 +8400,6 @@ async def test_list_conversations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation.ListConversationsRequest() - assert args[0] == request_msg @@ -8409,7 +8429,6 @@ async def test_get_conversation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation.GetConversationRequest() - assert args[0] == request_msg @@ -8441,7 +8460,6 @@ async def test_complete_conversation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation.CompleteConversationRequest() - assert args[0] == request_msg @@ -8468,7 +8486,6 @@ async def test_ingest_context_references_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_conversation.IngestContextReferencesRequest() - assert args[0] == request_msg @@ -8495,7 +8512,6 @@ async def test_batch_create_messages_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation.BatchCreateMessagesRequest() - assert args[0] == request_msg @@ -8522,7 +8538,6 @@ async def test_list_messages_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation.ListMessagesRequest() - assert args[0] == request_msg @@ -8552,7 +8567,6 @@ async def test_suggest_conversation_summary_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_conversation.SuggestConversationSummaryRequest() - assert args[0] == request_msg @@ -8582,7 +8596,6 @@ async def test_generate_stateless_summary_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation.GenerateStatelessSummaryRequest() - assert args[0] == request_msg @@ -8609,7 +8622,6 @@ async def test_generate_stateless_suggestion_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation.GenerateStatelessSuggestionRequest() - assert args[0] == request_msg @@ -8636,7 +8648,6 @@ async def test_search_knowledge_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation.SearchKnowledgeRequest() - assert args[0] == request_msg @@ -8665,7 +8676,6 @@ async def test_generate_suggestions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_conversation.GenerateSuggestionsRequest() - assert args[0] == request_msg @@ -10870,7 +10880,6 @@ def test_create_conversation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_conversation.CreateConversationRequest() - assert args[0] == request_msg @@ -10892,7 +10901,6 @@ def test_list_conversations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation.ListConversationsRequest() - assert args[0] == request_msg @@ -10912,7 +10920,6 @@ def test_get_conversation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation.GetConversationRequest() - assert args[0] == request_msg @@ -10934,7 +10941,6 @@ def test_complete_conversation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation.CompleteConversationRequest() - assert args[0] == request_msg @@ -10956,7 +10962,6 @@ def test_ingest_context_references_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_conversation.IngestContextReferencesRequest() - assert args[0] == request_msg @@ -10978,7 +10983,6 @@ def test_batch_create_messages_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation.BatchCreateMessagesRequest() - assert args[0] == request_msg @@ -10998,7 +11002,6 @@ def test_list_messages_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation.ListMessagesRequest() - assert args[0] == request_msg @@ -11020,7 +11023,6 @@ def test_suggest_conversation_summary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_conversation.SuggestConversationSummaryRequest() - assert args[0] == request_msg @@ -11042,7 +11044,6 @@ def test_generate_stateless_summary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation.GenerateStatelessSummaryRequest() - assert args[0] == request_msg @@ -11064,7 +11065,6 @@ def test_generate_stateless_suggestion_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation.GenerateStatelessSuggestionRequest() - assert args[0] == request_msg @@ -11084,7 +11084,6 @@ def test_search_knowledge_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation.SearchKnowledgeRequest() - assert args[0] == request_msg @@ -11106,7 +11105,6 @@ def test_generate_suggestions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_conversation.GenerateSuggestionsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_documents.py b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_documents.py index d04f9e501738..1b6307675005 100644 --- a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_documents.py +++ b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_documents.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 @@ -119,6 +120,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" @@ -1279,8 +1295,8 @@ def test_documents_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - document.ListDocumentsRequest, - dict, + document.ListDocumentsRequest(), + {}, ], ) def test_list_documents(request_type, transport: str = "grpc"): @@ -1291,7 +1307,7 @@ def test_list_documents(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_documents), "__call__") as call: @@ -1337,11 +1353,12 @@ def test_list_documents_non_empty_request_with_auto_populated_field(): client.list_documents(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document.ListDocumentsRequest( + request_msg = document.ListDocumentsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_documents_use_cached_wrapped_rpc(): @@ -1422,9 +1439,14 @@ async def test_list_documents_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_documents_async( - transport: str = "grpc_asyncio", request_type=document.ListDocumentsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + document.ListDocumentsRequest(), + {}, + ], +) +async def test_list_documents_async(request_type, transport: str = "grpc_asyncio"): client = DocumentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1432,7 +1454,7 @@ async def test_list_documents_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_documents), "__call__") as call: @@ -1455,11 +1477,6 @@ async def test_list_documents_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_documents_async_from_dict(): - await test_list_documents_async(request_type=dict) - - def test_list_documents_field_headers(): client = DocumentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1796,8 +1813,8 @@ async def test_list_documents_async_pages(): @pytest.mark.parametrize( "request_type", [ - document.GetDocumentRequest, - dict, + document.GetDocumentRequest(), + {}, ], ) def test_get_document(request_type, transport: str = "grpc"): @@ -1808,7 +1825,7 @@ def test_get_document(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_document), "__call__") as call: @@ -1863,9 +1880,10 @@ def test_get_document_non_empty_request_with_auto_populated_field(): client.get_document(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document.GetDocumentRequest( + request_msg = document.GetDocumentRequest( name="name_value", ) + assert args[0] == request_msg def test_get_document_use_cached_wrapped_rpc(): @@ -1946,9 +1964,14 @@ async def test_get_document_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_document_async( - transport: str = "grpc_asyncio", request_type=document.GetDocumentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + document.GetDocumentRequest(), + {}, + ], +) +async def test_get_document_async(request_type, transport: str = "grpc_asyncio"): client = DocumentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1956,7 +1979,7 @@ async def test_get_document_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_document), "__call__") as call: @@ -1989,11 +2012,6 @@ async def test_get_document_async( assert response.state == document.Document.State.CREATING -@pytest.mark.asyncio -async def test_get_document_async_from_dict(): - await test_get_document_async(request_type=dict) - - def test_get_document_field_headers(): client = DocumentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2136,8 +2154,8 @@ async def test_get_document_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcd_document.CreateDocumentRequest, - dict, + gcd_document.CreateDocumentRequest(), + {}, ], ) def test_create_document(request_type, transport: str = "grpc"): @@ -2148,7 +2166,7 @@ def test_create_document(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_document), "__call__") as call: @@ -2189,9 +2207,10 @@ def test_create_document_non_empty_request_with_auto_populated_field(): client.create_document(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_document.CreateDocumentRequest( + request_msg = gcd_document.CreateDocumentRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_document_use_cached_wrapped_rpc(): @@ -2282,9 +2301,14 @@ async def test_create_document_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_document_async( - transport: str = "grpc_asyncio", request_type=gcd_document.CreateDocumentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcd_document.CreateDocumentRequest(), + {}, + ], +) +async def test_create_document_async(request_type, transport: str = "grpc_asyncio"): client = DocumentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2292,7 +2316,7 @@ async def test_create_document_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_document), "__call__") as call: @@ -2312,11 +2336,6 @@ async def test_create_document_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_document_async_from_dict(): - await test_create_document_async(request_type=dict) - - def test_create_document_field_headers(): client = DocumentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2473,8 +2492,8 @@ async def test_create_document_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - document.ImportDocumentsRequest, - dict, + document.ImportDocumentsRequest(), + {}, ], ) def test_import_documents(request_type, transport: str = "grpc"): @@ -2485,7 +2504,7 @@ def test_import_documents(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.import_documents), "__call__") as call: @@ -2526,9 +2545,10 @@ def test_import_documents_non_empty_request_with_auto_populated_field(): client.import_documents(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document.ImportDocumentsRequest( + request_msg = document.ImportDocumentsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_import_documents_use_cached_wrapped_rpc(): @@ -2621,9 +2641,14 @@ async def test_import_documents_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_import_documents_async( - transport: str = "grpc_asyncio", request_type=document.ImportDocumentsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + document.ImportDocumentsRequest(), + {}, + ], +) +async def test_import_documents_async(request_type, transport: str = "grpc_asyncio"): client = DocumentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2631,7 +2656,7 @@ async def test_import_documents_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.import_documents), "__call__") as call: @@ -2651,11 +2676,6 @@ async def test_import_documents_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_import_documents_async_from_dict(): - await test_import_documents_async(request_type=dict) - - def test_import_documents_field_headers(): client = DocumentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2720,8 +2740,8 @@ async def test_import_documents_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - document.DeleteDocumentRequest, - dict, + document.DeleteDocumentRequest(), + {}, ], ) def test_delete_document(request_type, transport: str = "grpc"): @@ -2732,7 +2752,7 @@ def test_delete_document(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_document), "__call__") as call: @@ -2773,9 +2793,10 @@ def test_delete_document_non_empty_request_with_auto_populated_field(): client.delete_document(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document.DeleteDocumentRequest( + request_msg = document.DeleteDocumentRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_document_use_cached_wrapped_rpc(): @@ -2866,9 +2887,14 @@ async def test_delete_document_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_document_async( - transport: str = "grpc_asyncio", request_type=document.DeleteDocumentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + document.DeleteDocumentRequest(), + {}, + ], +) +async def test_delete_document_async(request_type, transport: str = "grpc_asyncio"): client = DocumentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2876,7 +2902,7 @@ async def test_delete_document_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_document), "__call__") as call: @@ -2896,11 +2922,6 @@ async def test_delete_document_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_document_async_from_dict(): - await test_delete_document_async(request_type=dict) - - def test_delete_document_field_headers(): client = DocumentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3047,8 +3068,8 @@ async def test_delete_document_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcd_document.UpdateDocumentRequest, - dict, + gcd_document.UpdateDocumentRequest(), + {}, ], ) def test_update_document(request_type, transport: str = "grpc"): @@ -3059,7 +3080,7 @@ def test_update_document(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_document), "__call__") as call: @@ -3098,7 +3119,8 @@ def test_update_document_non_empty_request_with_auto_populated_field(): client.update_document(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_document.UpdateDocumentRequest() + request_msg = gcd_document.UpdateDocumentRequest() + assert args[0] == request_msg def test_update_document_use_cached_wrapped_rpc(): @@ -3189,9 +3211,14 @@ async def test_update_document_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_document_async( - transport: str = "grpc_asyncio", request_type=gcd_document.UpdateDocumentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcd_document.UpdateDocumentRequest(), + {}, + ], +) +async def test_update_document_async(request_type, transport: str = "grpc_asyncio"): client = DocumentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3199,7 +3226,7 @@ async def test_update_document_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_document), "__call__") as call: @@ -3219,11 +3246,6 @@ async def test_update_document_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_document_async_from_dict(): - await test_update_document_async(request_type=dict) - - def test_update_document_field_headers(): client = DocumentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3380,8 +3402,8 @@ async def test_update_document_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - document.ReloadDocumentRequest, - dict, + document.ReloadDocumentRequest(), + {}, ], ) def test_reload_document(request_type, transport: str = "grpc"): @@ -3392,7 +3414,7 @@ def test_reload_document(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.reload_document), "__call__") as call: @@ -3433,9 +3455,10 @@ def test_reload_document_non_empty_request_with_auto_populated_field(): client.reload_document(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document.ReloadDocumentRequest( + request_msg = document.ReloadDocumentRequest( name="name_value", ) + assert args[0] == request_msg def test_reload_document_use_cached_wrapped_rpc(): @@ -3526,9 +3549,14 @@ async def test_reload_document_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_reload_document_async( - transport: str = "grpc_asyncio", request_type=document.ReloadDocumentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + document.ReloadDocumentRequest(), + {}, + ], +) +async def test_reload_document_async(request_type, transport: str = "grpc_asyncio"): client = DocumentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3536,7 +3564,7 @@ async def test_reload_document_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.reload_document), "__call__") as call: @@ -3556,11 +3584,6 @@ async def test_reload_document_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_reload_document_async_from_dict(): - await test_reload_document_async(request_type=dict) - - def test_reload_document_field_headers(): client = DocumentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5130,7 +5153,6 @@ def test_list_documents_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document.ListDocumentsRequest() - assert args[0] == request_msg @@ -5151,7 +5173,6 @@ def test_get_document_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document.GetDocumentRequest() - assert args[0] == request_msg @@ -5172,7 +5193,6 @@ def test_create_document_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_document.CreateDocumentRequest() - assert args[0] == request_msg @@ -5193,7 +5213,6 @@ def test_import_documents_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document.ImportDocumentsRequest() - assert args[0] == request_msg @@ -5214,7 +5233,6 @@ def test_delete_document_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document.DeleteDocumentRequest() - assert args[0] == request_msg @@ -5235,7 +5253,6 @@ def test_update_document_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_document.UpdateDocumentRequest() - assert args[0] == request_msg @@ -5256,7 +5273,6 @@ def test_reload_document_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document.ReloadDocumentRequest() - assert args[0] == request_msg @@ -5297,7 +5313,6 @@ async def test_list_documents_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document.ListDocumentsRequest() - assert args[0] == request_msg @@ -5329,7 +5344,6 @@ async def test_get_document_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document.GetDocumentRequest() - assert args[0] == request_msg @@ -5354,7 +5368,6 @@ async def test_create_document_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_document.CreateDocumentRequest() - assert args[0] == request_msg @@ -5379,7 +5392,6 @@ async def test_import_documents_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document.ImportDocumentsRequest() - assert args[0] == request_msg @@ -5404,7 +5416,6 @@ async def test_delete_document_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document.DeleteDocumentRequest() - assert args[0] == request_msg @@ -5429,7 +5440,6 @@ async def test_update_document_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_document.UpdateDocumentRequest() - assert args[0] == request_msg @@ -5454,7 +5464,6 @@ async def test_reload_document_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document.ReloadDocumentRequest() - assert args[0] == request_msg @@ -6857,7 +6866,6 @@ def test_list_documents_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document.ListDocumentsRequest() - assert args[0] == request_msg @@ -6877,7 +6885,6 @@ def test_get_document_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document.GetDocumentRequest() - assert args[0] == request_msg @@ -6897,7 +6904,6 @@ def test_create_document_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_document.CreateDocumentRequest() - assert args[0] == request_msg @@ -6917,7 +6923,6 @@ def test_import_documents_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document.ImportDocumentsRequest() - assert args[0] == request_msg @@ -6937,7 +6942,6 @@ def test_delete_document_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document.DeleteDocumentRequest() - assert args[0] == request_msg @@ -6957,7 +6961,6 @@ def test_update_document_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_document.UpdateDocumentRequest() - assert args[0] == request_msg @@ -6977,7 +6980,6 @@ def test_reload_document_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document.ReloadDocumentRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_encryption_spec_service.py b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_encryption_spec_service.py index fa515cfe33d7..89988a3f14ee 100644 --- a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_encryption_spec_service.py +++ b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_encryption_spec_service.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 @@ -113,6 +114,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" @@ -1381,8 +1397,8 @@ def test_encryption_spec_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - encryption_spec.GetEncryptionSpecRequest, - dict, + encryption_spec.GetEncryptionSpecRequest(), + {}, ], ) def test_get_encryption_spec(request_type, transport: str = "grpc"): @@ -1393,7 +1409,7 @@ def test_get_encryption_spec(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1443,9 +1459,10 @@ def test_get_encryption_spec_non_empty_request_with_auto_populated_field(): client.get_encryption_spec(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == encryption_spec.GetEncryptionSpecRequest( + request_msg = encryption_spec.GetEncryptionSpecRequest( name="name_value", ) + assert args[0] == request_msg def test_get_encryption_spec_use_cached_wrapped_rpc(): @@ -1530,10 +1547,14 @@ async def test_get_encryption_spec_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_encryption_spec_async( - transport: str = "grpc_asyncio", - request_type=encryption_spec.GetEncryptionSpecRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + encryption_spec.GetEncryptionSpecRequest(), + {}, + ], +) +async def test_get_encryption_spec_async(request_type, transport: str = "grpc_asyncio"): client = EncryptionSpecServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1541,7 +1562,7 @@ async def test_get_encryption_spec_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( @@ -1568,11 +1589,6 @@ async def test_get_encryption_spec_async( assert response.kms_key == "kms_key_value" -@pytest.mark.asyncio -async def test_get_encryption_spec_async_from_dict(): - await test_get_encryption_spec_async(request_type=dict) - - def test_get_encryption_spec_field_headers(): client = EncryptionSpecServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1727,8 +1743,8 @@ async def test_get_encryption_spec_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcd_encryption_spec.InitializeEncryptionSpecRequest, - dict, + gcd_encryption_spec.InitializeEncryptionSpecRequest(), + {}, ], ) def test_initialize_encryption_spec(request_type, transport: str = "grpc"): @@ -1739,7 +1755,7 @@ def test_initialize_encryption_spec(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1782,7 +1798,8 @@ def test_initialize_encryption_spec_non_empty_request_with_auto_populated_field( client.initialize_encryption_spec(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_encryption_spec.InitializeEncryptionSpecRequest() + request_msg = gcd_encryption_spec.InitializeEncryptionSpecRequest() + assert args[0] == request_msg def test_initialize_encryption_spec_use_cached_wrapped_rpc(): @@ -1878,9 +1895,15 @@ async def test_initialize_encryption_spec_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcd_encryption_spec.InitializeEncryptionSpecRequest(), + {}, + ], +) async def test_initialize_encryption_spec_async( - transport: str = "grpc_asyncio", - request_type=gcd_encryption_spec.InitializeEncryptionSpecRequest, + request_type, transport: str = "grpc_asyncio" ): client = EncryptionSpecServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1889,7 +1912,7 @@ async def test_initialize_encryption_spec_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( @@ -1911,11 +1934,6 @@ async def test_initialize_encryption_spec_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_initialize_encryption_spec_async_from_dict(): - await test_initialize_encryption_spec_async(request_type=dict) - - def test_initialize_encryption_spec_field_headers(): client = EncryptionSpecServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2556,7 +2574,6 @@ def test_get_encryption_spec_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = encryption_spec.GetEncryptionSpecRequest() - assert args[0] == request_msg @@ -2579,7 +2596,6 @@ def test_initialize_encryption_spec_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_encryption_spec.InitializeEncryptionSpecRequest() - assert args[0] == request_msg @@ -2623,7 +2639,6 @@ async def test_get_encryption_spec_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = encryption_spec.GetEncryptionSpecRequest() - assert args[0] == request_msg @@ -2650,7 +2665,6 @@ async def test_initialize_encryption_spec_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_encryption_spec.InitializeEncryptionSpecRequest() - assert args[0] == request_msg @@ -3262,7 +3276,6 @@ def test_get_encryption_spec_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = encryption_spec.GetEncryptionSpecRequest() - assert args[0] == request_msg @@ -3284,7 +3297,6 @@ def test_initialize_encryption_spec_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_encryption_spec.InitializeEncryptionSpecRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_entity_types.py b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_entity_types.py index 2f56ca40aa27..e6c237b0b277 100644 --- a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_entity_types.py +++ b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_entity_types.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 @@ -117,6 +118,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" @@ -1285,8 +1301,8 @@ def test_entity_types_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - entity_type.ListEntityTypesRequest, - dict, + entity_type.ListEntityTypesRequest(), + {}, ], ) def test_list_entity_types(request_type, transport: str = "grpc"): @@ -1297,7 +1313,7 @@ def test_list_entity_types(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1347,11 +1363,12 @@ def test_list_entity_types_non_empty_request_with_auto_populated_field(): client.list_entity_types(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == entity_type.ListEntityTypesRequest( + request_msg = entity_type.ListEntityTypesRequest( parent="parent_value", language_code="language_code_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_entity_types_use_cached_wrapped_rpc(): @@ -1434,9 +1451,14 @@ async def test_list_entity_types_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_entity_types_async( - transport: str = "grpc_asyncio", request_type=entity_type.ListEntityTypesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + entity_type.ListEntityTypesRequest(), + {}, + ], +) +async def test_list_entity_types_async(request_type, transport: str = "grpc_asyncio"): client = EntityTypesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1444,7 +1466,7 @@ async def test_list_entity_types_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( @@ -1469,11 +1491,6 @@ async def test_list_entity_types_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_entity_types_async_from_dict(): - await test_list_entity_types_async(request_type=dict) - - def test_list_entity_types_field_headers(): client = EntityTypesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1836,8 +1853,8 @@ async def test_list_entity_types_async_pages(): @pytest.mark.parametrize( "request_type", [ - entity_type.GetEntityTypeRequest, - dict, + entity_type.GetEntityTypeRequest(), + {}, ], ) def test_get_entity_type(request_type, transport: str = "grpc"): @@ -1848,7 +1865,7 @@ def test_get_entity_type(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_entity_type), "__call__") as call: @@ -1904,10 +1921,11 @@ def test_get_entity_type_non_empty_request_with_auto_populated_field(): client.get_entity_type(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == entity_type.GetEntityTypeRequest( + request_msg = entity_type.GetEntityTypeRequest( name="name_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_get_entity_type_use_cached_wrapped_rpc(): @@ -1988,9 +2006,14 @@ async def test_get_entity_type_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_entity_type_async( - transport: str = "grpc_asyncio", request_type=entity_type.GetEntityTypeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + entity_type.GetEntityTypeRequest(), + {}, + ], +) +async def test_get_entity_type_async(request_type, transport: str = "grpc_asyncio"): client = EntityTypesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1998,7 +2021,7 @@ async def test_get_entity_type_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_entity_type), "__call__") as call: @@ -2032,11 +2055,6 @@ async def test_get_entity_type_async( assert response.enable_fuzzy_extraction is True -@pytest.mark.asyncio -async def test_get_entity_type_async_from_dict(): - await test_get_entity_type_async(request_type=dict) - - def test_get_entity_type_field_headers(): client = EntityTypesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2193,8 +2211,8 @@ async def test_get_entity_type_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcd_entity_type.CreateEntityTypeRequest, - dict, + gcd_entity_type.CreateEntityTypeRequest(), + {}, ], ) def test_create_entity_type(request_type, transport: str = "grpc"): @@ -2205,7 +2223,7 @@ def test_create_entity_type(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2265,10 +2283,11 @@ def test_create_entity_type_non_empty_request_with_auto_populated_field(): client.create_entity_type(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_entity_type.CreateEntityTypeRequest( + request_msg = gcd_entity_type.CreateEntityTypeRequest( parent="parent_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_create_entity_type_use_cached_wrapped_rpc(): @@ -2353,10 +2372,14 @@ async def test_create_entity_type_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_entity_type_async( - transport: str = "grpc_asyncio", - request_type=gcd_entity_type.CreateEntityTypeRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + gcd_entity_type.CreateEntityTypeRequest(), + {}, + ], +) +async def test_create_entity_type_async(request_type, transport: str = "grpc_asyncio"): client = EntityTypesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2364,7 +2387,7 @@ async def test_create_entity_type_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( @@ -2400,11 +2423,6 @@ async def test_create_entity_type_async( assert response.enable_fuzzy_extraction is True -@pytest.mark.asyncio -async def test_create_entity_type_async_from_dict(): - await test_create_entity_type_async(request_type=dict) - - def test_create_entity_type_field_headers(): client = EntityTypesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2579,8 +2597,8 @@ async def test_create_entity_type_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcd_entity_type.UpdateEntityTypeRequest, - dict, + gcd_entity_type.UpdateEntityTypeRequest(), + {}, ], ) def test_update_entity_type(request_type, transport: str = "grpc"): @@ -2591,7 +2609,7 @@ def test_update_entity_type(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2650,9 +2668,10 @@ def test_update_entity_type_non_empty_request_with_auto_populated_field(): client.update_entity_type(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_entity_type.UpdateEntityTypeRequest( + request_msg = gcd_entity_type.UpdateEntityTypeRequest( language_code="language_code_value", ) + assert args[0] == request_msg def test_update_entity_type_use_cached_wrapped_rpc(): @@ -2737,10 +2756,14 @@ async def test_update_entity_type_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_entity_type_async( - transport: str = "grpc_asyncio", - request_type=gcd_entity_type.UpdateEntityTypeRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + gcd_entity_type.UpdateEntityTypeRequest(), + {}, + ], +) +async def test_update_entity_type_async(request_type, transport: str = "grpc_asyncio"): client = EntityTypesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2748,7 +2771,7 @@ async def test_update_entity_type_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( @@ -2784,11 +2807,6 @@ async def test_update_entity_type_async( assert response.enable_fuzzy_extraction is True -@pytest.mark.asyncio -async def test_update_entity_type_async_from_dict(): - await test_update_entity_type_async(request_type=dict) - - def test_update_entity_type_field_headers(): client = EntityTypesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2963,8 +2981,8 @@ async def test_update_entity_type_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - entity_type.DeleteEntityTypeRequest, - dict, + entity_type.DeleteEntityTypeRequest(), + {}, ], ) def test_delete_entity_type(request_type, transport: str = "grpc"): @@ -2975,7 +2993,7 @@ def test_delete_entity_type(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3020,9 +3038,10 @@ def test_delete_entity_type_non_empty_request_with_auto_populated_field(): client.delete_entity_type(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == entity_type.DeleteEntityTypeRequest( + request_msg = entity_type.DeleteEntityTypeRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_entity_type_use_cached_wrapped_rpc(): @@ -3107,9 +3126,14 @@ async def test_delete_entity_type_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_entity_type_async( - transport: str = "grpc_asyncio", request_type=entity_type.DeleteEntityTypeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + entity_type.DeleteEntityTypeRequest(), + {}, + ], +) +async def test_delete_entity_type_async(request_type, transport: str = "grpc_asyncio"): client = EntityTypesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3117,7 +3141,7 @@ async def test_delete_entity_type_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( @@ -3137,11 +3161,6 @@ async def test_delete_entity_type_async( assert response is None -@pytest.mark.asyncio -async def test_delete_entity_type_async_from_dict(): - await test_delete_entity_type_async(request_type=dict) - - def test_delete_entity_type_field_headers(): client = EntityTypesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3292,8 +3311,8 @@ async def test_delete_entity_type_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - entity_type.BatchUpdateEntityTypesRequest, - dict, + entity_type.BatchUpdateEntityTypesRequest(), + {}, ], ) def test_batch_update_entity_types(request_type, transport: str = "grpc"): @@ -3304,7 +3323,7 @@ def test_batch_update_entity_types(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,12 @@ def test_batch_update_entity_types_non_empty_request_with_auto_populated_field() client.batch_update_entity_types(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == entity_type.BatchUpdateEntityTypesRequest( + request_msg = entity_type.BatchUpdateEntityTypesRequest( parent="parent_value", entity_type_batch_uri="entity_type_batch_uri_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_batch_update_entity_types_use_cached_wrapped_rpc(): @@ -3451,9 +3471,15 @@ async def test_batch_update_entity_types_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + entity_type.BatchUpdateEntityTypesRequest(), + {}, + ], +) async def test_batch_update_entity_types_async( - transport: str = "grpc_asyncio", - request_type=entity_type.BatchUpdateEntityTypesRequest, + request_type, transport: str = "grpc_asyncio" ): client = EntityTypesAsyncClient( credentials=async_anonymous_credentials(), @@ -3462,7 +3488,7 @@ async def test_batch_update_entity_types_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( @@ -3484,11 +3510,6 @@ async def test_batch_update_entity_types_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_batch_update_entity_types_async_from_dict(): - await test_batch_update_entity_types_async(request_type=dict) - - def test_batch_update_entity_types_field_headers(): client = EntityTypesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3557,8 +3578,8 @@ async def test_batch_update_entity_types_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - entity_type.BatchDeleteEntityTypesRequest, - dict, + entity_type.BatchDeleteEntityTypesRequest(), + {}, ], ) def test_batch_delete_entity_types(request_type, transport: str = "grpc"): @@ -3569,7 +3590,7 @@ def test_batch_delete_entity_types(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3614,9 +3635,10 @@ def test_batch_delete_entity_types_non_empty_request_with_auto_populated_field() client.batch_delete_entity_types(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == entity_type.BatchDeleteEntityTypesRequest( + request_msg = entity_type.BatchDeleteEntityTypesRequest( parent="parent_value", ) + assert args[0] == request_msg def test_batch_delete_entity_types_use_cached_wrapped_rpc(): @@ -3712,9 +3734,15 @@ async def test_batch_delete_entity_types_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + entity_type.BatchDeleteEntityTypesRequest(), + {}, + ], +) async def test_batch_delete_entity_types_async( - transport: str = "grpc_asyncio", - request_type=entity_type.BatchDeleteEntityTypesRequest, + request_type, transport: str = "grpc_asyncio" ): client = EntityTypesAsyncClient( credentials=async_anonymous_credentials(), @@ -3723,7 +3751,7 @@ async def test_batch_delete_entity_types_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( @@ -3745,11 +3773,6 @@ async def test_batch_delete_entity_types_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_batch_delete_entity_types_async_from_dict(): - await test_batch_delete_entity_types_async(request_type=dict) - - def test_batch_delete_entity_types_field_headers(): client = EntityTypesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3914,8 +3937,8 @@ async def test_batch_delete_entity_types_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - entity_type.BatchCreateEntitiesRequest, - dict, + entity_type.BatchCreateEntitiesRequest(), + {}, ], ) def test_batch_create_entities(request_type, transport: str = "grpc"): @@ -3926,7 +3949,7 @@ def test_batch_create_entities(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3972,10 +3995,11 @@ def test_batch_create_entities_non_empty_request_with_auto_populated_field(): client.batch_create_entities(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == entity_type.BatchCreateEntitiesRequest( + request_msg = entity_type.BatchCreateEntitiesRequest( parent="parent_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_batch_create_entities_use_cached_wrapped_rpc(): @@ -4071,8 +4095,15 @@ async def test_batch_create_entities_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + entity_type.BatchCreateEntitiesRequest(), + {}, + ], +) async def test_batch_create_entities_async( - transport: str = "grpc_asyncio", request_type=entity_type.BatchCreateEntitiesRequest + request_type, transport: str = "grpc_asyncio" ): client = EntityTypesAsyncClient( credentials=async_anonymous_credentials(), @@ -4081,7 +4112,7 @@ async def test_batch_create_entities_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( @@ -4103,11 +4134,6 @@ async def test_batch_create_entities_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_batch_create_entities_async_from_dict(): - await test_batch_create_entities_async(request_type=dict) - - def test_batch_create_entities_field_headers(): client = EntityTypesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4282,8 +4308,8 @@ async def test_batch_create_entities_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - entity_type.BatchUpdateEntitiesRequest, - dict, + entity_type.BatchUpdateEntitiesRequest(), + {}, ], ) def test_batch_update_entities(request_type, transport: str = "grpc"): @@ -4294,7 +4320,7 @@ def test_batch_update_entities(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4340,10 +4366,11 @@ def test_batch_update_entities_non_empty_request_with_auto_populated_field(): client.batch_update_entities(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == entity_type.BatchUpdateEntitiesRequest( + request_msg = entity_type.BatchUpdateEntitiesRequest( parent="parent_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_batch_update_entities_use_cached_wrapped_rpc(): @@ -4439,8 +4466,15 @@ async def test_batch_update_entities_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + entity_type.BatchUpdateEntitiesRequest(), + {}, + ], +) async def test_batch_update_entities_async( - transport: str = "grpc_asyncio", request_type=entity_type.BatchUpdateEntitiesRequest + request_type, transport: str = "grpc_asyncio" ): client = EntityTypesAsyncClient( credentials=async_anonymous_credentials(), @@ -4449,7 +4483,7 @@ async def test_batch_update_entities_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( @@ -4471,11 +4505,6 @@ async def test_batch_update_entities_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_batch_update_entities_async_from_dict(): - await test_batch_update_entities_async(request_type=dict) - - def test_batch_update_entities_field_headers(): client = EntityTypesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4650,8 +4679,8 @@ async def test_batch_update_entities_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - entity_type.BatchDeleteEntitiesRequest, - dict, + entity_type.BatchDeleteEntitiesRequest(), + {}, ], ) def test_batch_delete_entities(request_type, transport: str = "grpc"): @@ -4662,7 +4691,7 @@ def test_batch_delete_entities(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4708,10 +4737,11 @@ def test_batch_delete_entities_non_empty_request_with_auto_populated_field(): client.batch_delete_entities(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == entity_type.BatchDeleteEntitiesRequest( + request_msg = entity_type.BatchDeleteEntitiesRequest( parent="parent_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_batch_delete_entities_use_cached_wrapped_rpc(): @@ -4807,8 +4837,15 @@ async def test_batch_delete_entities_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + entity_type.BatchDeleteEntitiesRequest(), + {}, + ], +) async def test_batch_delete_entities_async( - transport: str = "grpc_asyncio", request_type=entity_type.BatchDeleteEntitiesRequest + request_type, transport: str = "grpc_asyncio" ): client = EntityTypesAsyncClient( credentials=async_anonymous_credentials(), @@ -4817,7 +4854,7 @@ async def test_batch_delete_entities_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( @@ -4839,11 +4876,6 @@ async def test_batch_delete_entities_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_batch_delete_entities_async_from_dict(): - await test_batch_delete_entities_async(request_type=dict) - - def test_batch_delete_entities_field_headers(): client = EntityTypesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7066,7 +7098,6 @@ def test_list_entity_types_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.ListEntityTypesRequest() - assert args[0] == request_msg @@ -7087,7 +7118,6 @@ def test_get_entity_type_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.GetEntityTypeRequest() - assert args[0] == request_msg @@ -7110,7 +7140,6 @@ def test_create_entity_type_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_entity_type.CreateEntityTypeRequest() - assert args[0] == request_msg @@ -7133,7 +7162,6 @@ def test_update_entity_type_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_entity_type.UpdateEntityTypeRequest() - assert args[0] == request_msg @@ -7156,7 +7184,6 @@ def test_delete_entity_type_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.DeleteEntityTypeRequest() - assert args[0] == request_msg @@ -7179,7 +7206,6 @@ def test_batch_update_entity_types_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.BatchUpdateEntityTypesRequest() - assert args[0] == request_msg @@ -7202,7 +7228,6 @@ def test_batch_delete_entity_types_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.BatchDeleteEntityTypesRequest() - assert args[0] == request_msg @@ -7225,7 +7250,6 @@ def test_batch_create_entities_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.BatchCreateEntitiesRequest() - assert args[0] == request_msg @@ -7248,7 +7272,6 @@ def test_batch_update_entities_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.BatchUpdateEntitiesRequest() - assert args[0] == request_msg @@ -7271,7 +7294,6 @@ def test_batch_delete_entities_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.BatchDeleteEntitiesRequest() - assert args[0] == request_msg @@ -7314,7 +7336,6 @@ async def test_list_entity_types_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.ListEntityTypesRequest() - assert args[0] == request_msg @@ -7345,7 +7366,6 @@ async def test_get_entity_type_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.GetEntityTypeRequest() - assert args[0] == request_msg @@ -7378,7 +7398,6 @@ async def test_create_entity_type_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_entity_type.CreateEntityTypeRequest() - assert args[0] == request_msg @@ -7411,7 +7430,6 @@ async def test_update_entity_type_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_entity_type.UpdateEntityTypeRequest() - assert args[0] == request_msg @@ -7436,7 +7454,6 @@ async def test_delete_entity_type_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.DeleteEntityTypeRequest() - assert args[0] == request_msg @@ -7463,7 +7480,6 @@ async def test_batch_update_entity_types_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.BatchUpdateEntityTypesRequest() - assert args[0] == request_msg @@ -7490,7 +7506,6 @@ async def test_batch_delete_entity_types_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.BatchDeleteEntityTypesRequest() - assert args[0] == request_msg @@ -7517,7 +7532,6 @@ async def test_batch_create_entities_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.BatchCreateEntitiesRequest() - assert args[0] == request_msg @@ -7544,7 +7558,6 @@ async def test_batch_update_entities_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.BatchUpdateEntitiesRequest() - assert args[0] == request_msg @@ -7571,7 +7584,6 @@ async def test_batch_delete_entities_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.BatchDeleteEntitiesRequest() - assert args[0] == request_msg @@ -9375,7 +9387,6 @@ def test_list_entity_types_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.ListEntityTypesRequest() - assert args[0] == request_msg @@ -9395,7 +9406,6 @@ def test_get_entity_type_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.GetEntityTypeRequest() - assert args[0] == request_msg @@ -9417,7 +9427,6 @@ def test_create_entity_type_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_entity_type.CreateEntityTypeRequest() - assert args[0] == request_msg @@ -9439,7 +9448,6 @@ def test_update_entity_type_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_entity_type.UpdateEntityTypeRequest() - assert args[0] == request_msg @@ -9461,7 +9469,6 @@ def test_delete_entity_type_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.DeleteEntityTypeRequest() - assert args[0] == request_msg @@ -9483,7 +9490,6 @@ def test_batch_update_entity_types_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.BatchUpdateEntityTypesRequest() - assert args[0] == request_msg @@ -9505,7 +9511,6 @@ def test_batch_delete_entity_types_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.BatchDeleteEntityTypesRequest() - assert args[0] == request_msg @@ -9527,7 +9532,6 @@ def test_batch_create_entities_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.BatchCreateEntitiesRequest() - assert args[0] == request_msg @@ -9549,7 +9553,6 @@ def test_batch_update_entities_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.BatchUpdateEntitiesRequest() - assert args[0] == request_msg @@ -9571,7 +9574,6 @@ def test_batch_delete_entities_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = entity_type.BatchDeleteEntitiesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_environments.py b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_environments.py index c3d9c2911b6e..e17ccccf5431 100644 --- a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_environments.py +++ b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_environments.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" @@ -1294,8 +1310,8 @@ def test_environments_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - environment.ListEnvironmentsRequest, - dict, + environment.ListEnvironmentsRequest(), + {}, ], ) def test_list_environments(request_type, transport: str = "grpc"): @@ -1306,7 +1322,7 @@ def test_list_environments(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1355,10 +1371,11 @@ def test_list_environments_non_empty_request_with_auto_populated_field(): client.list_environments(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environment.ListEnvironmentsRequest( + request_msg = environment.ListEnvironmentsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_environments_use_cached_wrapped_rpc(): @@ -1441,9 +1458,14 @@ async def test_list_environments_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_environments_async( - transport: str = "grpc_asyncio", request_type=environment.ListEnvironmentsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + environment.ListEnvironmentsRequest(), + {}, + ], +) +async def test_list_environments_async(request_type, transport: str = "grpc_asyncio"): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1451,7 +1473,7 @@ async def test_list_environments_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( @@ -1476,11 +1498,6 @@ async def test_list_environments_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_environments_async_from_dict(): - await test_list_environments_async(request_type=dict) - - def test_list_environments_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1833,8 +1850,8 @@ async def test_list_environments_async_pages(): @pytest.mark.parametrize( "request_type", [ - environment.GetEnvironmentRequest, - dict, + environment.GetEnvironmentRequest(), + {}, ], ) def test_get_environment(request_type, transport: str = "grpc"): @@ -1845,7 +1862,7 @@ def test_get_environment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_environment), "__call__") as call: @@ -1895,9 +1912,10 @@ def test_get_environment_non_empty_request_with_auto_populated_field(): client.get_environment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environment.GetEnvironmentRequest( + request_msg = environment.GetEnvironmentRequest( name="name_value", ) + assert args[0] == request_msg def test_get_environment_use_cached_wrapped_rpc(): @@ -1978,9 +1996,14 @@ async def test_get_environment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_environment_async( - transport: str = "grpc_asyncio", request_type=environment.GetEnvironmentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + environment.GetEnvironmentRequest(), + {}, + ], +) +async def test_get_environment_async(request_type, transport: str = "grpc_asyncio"): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1988,7 +2011,7 @@ async def test_get_environment_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_environment), "__call__") as call: @@ -2017,11 +2040,6 @@ async def test_get_environment_async( assert response.state == environment.Environment.State.STOPPED -@pytest.mark.asyncio -async def test_get_environment_async_from_dict(): - await test_get_environment_async(request_type=dict) - - def test_get_environment_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2086,8 +2104,8 @@ async def test_get_environment_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - environment.CreateEnvironmentRequest, - dict, + environment.CreateEnvironmentRequest(), + {}, ], ) def test_create_environment(request_type, transport: str = "grpc"): @@ -2098,7 +2116,7 @@ def test_create_environment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2153,10 +2171,11 @@ def test_create_environment_non_empty_request_with_auto_populated_field(): client.create_environment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environment.CreateEnvironmentRequest( + request_msg = environment.CreateEnvironmentRequest( parent="parent_value", environment_id="environment_id_value", ) + assert args[0] == request_msg def test_create_environment_use_cached_wrapped_rpc(): @@ -2241,9 +2260,14 @@ async def test_create_environment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_environment_async( - transport: str = "grpc_asyncio", request_type=environment.CreateEnvironmentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + environment.CreateEnvironmentRequest(), + {}, + ], +) +async def test_create_environment_async(request_type, transport: str = "grpc_asyncio"): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2251,7 +2275,7 @@ async def test_create_environment_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( @@ -2282,11 +2306,6 @@ async def test_create_environment_async( assert response.state == environment.Environment.State.STOPPED -@pytest.mark.asyncio -async def test_create_environment_async_from_dict(): - await test_create_environment_async(request_type=dict) - - def test_create_environment_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2355,8 +2374,8 @@ async def test_create_environment_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - environment.UpdateEnvironmentRequest, - dict, + environment.UpdateEnvironmentRequest(), + {}, ], ) def test_update_environment(request_type, transport: str = "grpc"): @@ -2367,7 +2386,7 @@ def test_update_environment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2419,7 +2438,8 @@ def test_update_environment_non_empty_request_with_auto_populated_field(): client.update_environment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environment.UpdateEnvironmentRequest() + request_msg = environment.UpdateEnvironmentRequest() + assert args[0] == request_msg def test_update_environment_use_cached_wrapped_rpc(): @@ -2504,9 +2524,14 @@ async def test_update_environment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_environment_async( - transport: str = "grpc_asyncio", request_type=environment.UpdateEnvironmentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + environment.UpdateEnvironmentRequest(), + {}, + ], +) +async def test_update_environment_async(request_type, transport: str = "grpc_asyncio"): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2514,7 +2539,7 @@ async def test_update_environment_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( @@ -2545,11 +2570,6 @@ async def test_update_environment_async( assert response.state == environment.Environment.State.STOPPED -@pytest.mark.asyncio -async def test_update_environment_async_from_dict(): - await test_update_environment_async(request_type=dict) - - def test_update_environment_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2618,8 +2638,8 @@ async def test_update_environment_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - environment.DeleteEnvironmentRequest, - dict, + environment.DeleteEnvironmentRequest(), + {}, ], ) def test_delete_environment(request_type, transport: str = "grpc"): @@ -2630,7 +2650,7 @@ def test_delete_environment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2675,9 +2695,10 @@ def test_delete_environment_non_empty_request_with_auto_populated_field(): client.delete_environment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environment.DeleteEnvironmentRequest( + request_msg = environment.DeleteEnvironmentRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_environment_use_cached_wrapped_rpc(): @@ -2762,9 +2783,14 @@ async def test_delete_environment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_environment_async( - transport: str = "grpc_asyncio", request_type=environment.DeleteEnvironmentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + environment.DeleteEnvironmentRequest(), + {}, + ], +) +async def test_delete_environment_async(request_type, transport: str = "grpc_asyncio"): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2772,7 +2798,7 @@ async def test_delete_environment_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( @@ -2792,11 +2818,6 @@ async def test_delete_environment_async( assert response is None -@pytest.mark.asyncio -async def test_delete_environment_async_from_dict(): - await test_delete_environment_async(request_type=dict) - - def test_delete_environment_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2863,8 +2884,8 @@ async def test_delete_environment_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - environment.GetEnvironmentHistoryRequest, - dict, + environment.GetEnvironmentHistoryRequest(), + {}, ], ) def test_get_environment_history(request_type, transport: str = "grpc"): @@ -2875,7 +2896,7 @@ def test_get_environment_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( @@ -2926,10 +2947,11 @@ def test_get_environment_history_non_empty_request_with_auto_populated_field(): client.get_environment_history(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environment.GetEnvironmentHistoryRequest( + request_msg = environment.GetEnvironmentHistoryRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_get_environment_history_use_cached_wrapped_rpc(): @@ -3015,9 +3037,15 @@ async def test_get_environment_history_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + environment.GetEnvironmentHistoryRequest(), + {}, + ], +) async def test_get_environment_history_async( - transport: str = "grpc_asyncio", - request_type=environment.GetEnvironmentHistoryRequest, + request_type, transport: str = "grpc_asyncio" ): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), @@ -3026,7 +3054,7 @@ async def test_get_environment_history_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( @@ -3053,11 +3081,6 @@ async def test_get_environment_history_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_get_environment_history_async_from_dict(): - await test_get_environment_history_async(request_type=dict) - - def test_get_environment_history_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4437,7 +4460,6 @@ def test_list_environments_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.ListEnvironmentsRequest() - assert args[0] == request_msg @@ -4458,7 +4480,6 @@ def test_get_environment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.GetEnvironmentRequest() - assert args[0] == request_msg @@ -4481,7 +4502,6 @@ def test_create_environment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.CreateEnvironmentRequest() - assert args[0] == request_msg @@ -4504,7 +4524,6 @@ def test_update_environment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.UpdateEnvironmentRequest() - assert args[0] == request_msg @@ -4527,7 +4546,6 @@ def test_delete_environment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.DeleteEnvironmentRequest() - assert args[0] == request_msg @@ -4550,7 +4568,6 @@ def test_get_environment_history_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.GetEnvironmentHistoryRequest() - assert args[0] == request_msg @@ -4593,7 +4610,6 @@ async def test_list_environments_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.ListEnvironmentsRequest() - assert args[0] == request_msg @@ -4623,7 +4639,6 @@ async def test_get_environment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.GetEnvironmentRequest() - assert args[0] == request_msg @@ -4655,7 +4670,6 @@ async def test_create_environment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.CreateEnvironmentRequest() - assert args[0] == request_msg @@ -4687,7 +4701,6 @@ async def test_update_environment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.UpdateEnvironmentRequest() - assert args[0] == request_msg @@ -4712,7 +4725,6 @@ async def test_delete_environment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.DeleteEnvironmentRequest() - assert args[0] == request_msg @@ -4742,7 +4754,6 @@ async def test_get_environment_history_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.GetEnvironmentHistoryRequest() - assert args[0] == request_msg @@ -6068,7 +6079,6 @@ def test_list_environments_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.ListEnvironmentsRequest() - assert args[0] == request_msg @@ -6088,7 +6098,6 @@ def test_get_environment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.GetEnvironmentRequest() - assert args[0] == request_msg @@ -6110,7 +6119,6 @@ def test_create_environment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.CreateEnvironmentRequest() - assert args[0] == request_msg @@ -6132,7 +6140,6 @@ def test_update_environment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.UpdateEnvironmentRequest() - assert args[0] == request_msg @@ -6154,7 +6161,6 @@ def test_delete_environment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.DeleteEnvironmentRequest() - assert args[0] == request_msg @@ -6176,7 +6182,6 @@ def test_get_environment_history_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environment.GetEnvironmentHistoryRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_fulfillments.py b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_fulfillments.py index 7f748885b403..5fc0e23cec60 100644 --- a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_fulfillments.py +++ b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_fulfillments.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 @@ -110,6 +111,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" @@ -1293,8 +1309,8 @@ def test_fulfillments_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - fulfillment.GetFulfillmentRequest, - dict, + fulfillment.GetFulfillmentRequest(), + {}, ], ) def test_get_fulfillment(request_type, transport: str = "grpc"): @@ -1305,7 +1321,7 @@ def test_get_fulfillment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_fulfillment), "__call__") as call: @@ -1353,9 +1369,10 @@ def test_get_fulfillment_non_empty_request_with_auto_populated_field(): client.get_fulfillment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == fulfillment.GetFulfillmentRequest( + request_msg = fulfillment.GetFulfillmentRequest( name="name_value", ) + assert args[0] == request_msg def test_get_fulfillment_use_cached_wrapped_rpc(): @@ -1436,9 +1453,14 @@ async def test_get_fulfillment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_fulfillment_async( - transport: str = "grpc_asyncio", request_type=fulfillment.GetFulfillmentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + fulfillment.GetFulfillmentRequest(), + {}, + ], +) +async def test_get_fulfillment_async(request_type, transport: str = "grpc_asyncio"): client = FulfillmentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1446,7 +1468,7 @@ async def test_get_fulfillment_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_fulfillment), "__call__") as call: @@ -1473,11 +1495,6 @@ async def test_get_fulfillment_async( assert response.enabled is True -@pytest.mark.asyncio -async def test_get_fulfillment_async_from_dict(): - await test_get_fulfillment_async(request_type=dict) - - def test_get_fulfillment_field_headers(): client = FulfillmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1624,8 +1641,8 @@ async def test_get_fulfillment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcd_fulfillment.UpdateFulfillmentRequest, - dict, + gcd_fulfillment.UpdateFulfillmentRequest(), + {}, ], ) def test_update_fulfillment(request_type, transport: str = "grpc"): @@ -1636,7 +1653,7 @@ def test_update_fulfillment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1686,7 +1703,8 @@ def test_update_fulfillment_non_empty_request_with_auto_populated_field(): client.update_fulfillment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_fulfillment.UpdateFulfillmentRequest() + request_msg = gcd_fulfillment.UpdateFulfillmentRequest() + assert args[0] == request_msg def test_update_fulfillment_use_cached_wrapped_rpc(): @@ -1771,10 +1789,14 @@ async def test_update_fulfillment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_fulfillment_async( - transport: str = "grpc_asyncio", - request_type=gcd_fulfillment.UpdateFulfillmentRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + gcd_fulfillment.UpdateFulfillmentRequest(), + {}, + ], +) +async def test_update_fulfillment_async(request_type, transport: str = "grpc_asyncio"): client = FulfillmentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1782,7 +1804,7 @@ async def test_update_fulfillment_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( @@ -1811,11 +1833,6 @@ async def test_update_fulfillment_async( assert response.enabled is True -@pytest.mark.asyncio -async def test_update_fulfillment_async_from_dict(): - await test_update_fulfillment_async(request_type=dict) - - def test_update_fulfillment_field_headers(): client = FulfillmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2467,7 +2484,6 @@ def test_get_fulfillment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = fulfillment.GetFulfillmentRequest() - assert args[0] == request_msg @@ -2490,7 +2506,6 @@ def test_update_fulfillment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_fulfillment.UpdateFulfillmentRequest() - assert args[0] == request_msg @@ -2533,7 +2548,6 @@ async def test_get_fulfillment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = fulfillment.GetFulfillmentRequest() - assert args[0] == request_msg @@ -2564,7 +2578,6 @@ async def test_update_fulfillment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_fulfillment.UpdateFulfillmentRequest() - assert args[0] == request_msg @@ -3258,7 +3271,6 @@ def test_get_fulfillment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = fulfillment.GetFulfillmentRequest() - assert args[0] == request_msg @@ -3280,7 +3292,6 @@ def test_update_fulfillment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_fulfillment.UpdateFulfillmentRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_generator_evaluations.py b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_generator_evaluations.py index 3881430c36bb..da302d150b96 100644 --- a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_generator_evaluations.py +++ b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_generator_evaluations.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 @@ -130,6 +131,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" @@ -1396,8 +1412,8 @@ def test_generator_evaluations_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - gcd_generator_evaluation.CreateGeneratorEvaluationRequest, - dict, + gcd_generator_evaluation.CreateGeneratorEvaluationRequest(), + {}, ], ) def test_create_generator_evaluation(request_type, transport: str = "grpc"): @@ -1408,7 +1424,7 @@ def test_create_generator_evaluation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1453,9 +1469,10 @@ def test_create_generator_evaluation_non_empty_request_with_auto_populated_field client.create_generator_evaluation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_generator_evaluation.CreateGeneratorEvaluationRequest( + request_msg = gcd_generator_evaluation.CreateGeneratorEvaluationRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_generator_evaluation_use_cached_wrapped_rpc(): @@ -1551,9 +1568,15 @@ async def test_create_generator_evaluation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcd_generator_evaluation.CreateGeneratorEvaluationRequest(), + {}, + ], +) async def test_create_generator_evaluation_async( - transport: str = "grpc_asyncio", - request_type=gcd_generator_evaluation.CreateGeneratorEvaluationRequest, + request_type, transport: str = "grpc_asyncio" ): client = GeneratorEvaluationsAsyncClient( credentials=async_anonymous_credentials(), @@ -1562,7 +1585,7 @@ async def test_create_generator_evaluation_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( @@ -1584,11 +1607,6 @@ async def test_create_generator_evaluation_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_generator_evaluation_async_from_dict(): - await test_create_generator_evaluation_async(request_type=dict) - - def test_create_generator_evaluation_field_headers(): client = GeneratorEvaluationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1761,8 +1779,8 @@ async def test_create_generator_evaluation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - generator_evaluation.GetGeneratorEvaluationRequest, - dict, + generator_evaluation.GetGeneratorEvaluationRequest(), + {}, ], ) def test_get_generator_evaluation(request_type, transport: str = "grpc"): @@ -1773,7 +1791,7 @@ def test_get_generator_evaluation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1827,9 +1845,10 @@ def test_get_generator_evaluation_non_empty_request_with_auto_populated_field(): client.get_generator_evaluation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == generator_evaluation.GetGeneratorEvaluationRequest( + request_msg = generator_evaluation.GetGeneratorEvaluationRequest( name="name_value", ) + assert args[0] == request_msg def test_get_generator_evaluation_use_cached_wrapped_rpc(): @@ -1915,9 +1934,15 @@ async def test_get_generator_evaluation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + generator_evaluation.GetGeneratorEvaluationRequest(), + {}, + ], +) async def test_get_generator_evaluation_async( - transport: str = "grpc_asyncio", - request_type=generator_evaluation.GetGeneratorEvaluationRequest, + request_type, transport: str = "grpc_asyncio" ): client = GeneratorEvaluationsAsyncClient( credentials=async_anonymous_credentials(), @@ -1926,7 +1951,7 @@ async def test_get_generator_evaluation_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( @@ -1957,11 +1982,6 @@ async def test_get_generator_evaluation_async( assert response.satisfies_pzi is True -@pytest.mark.asyncio -async def test_get_generator_evaluation_async_from_dict(): - await test_get_generator_evaluation_async(request_type=dict) - - def test_get_generator_evaluation_field_headers(): client = GeneratorEvaluationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2116,8 +2136,8 @@ async def test_get_generator_evaluation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - generator_evaluation.ListGeneratorEvaluationsRequest, - dict, + generator_evaluation.ListGeneratorEvaluationsRequest(), + {}, ], ) def test_list_generator_evaluations(request_type, transport: str = "grpc"): @@ -2128,7 +2148,7 @@ def test_list_generator_evaluations(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2177,10 +2197,11 @@ def test_list_generator_evaluations_non_empty_request_with_auto_populated_field( client.list_generator_evaluations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == generator_evaluation.ListGeneratorEvaluationsRequest( + request_msg = generator_evaluation.ListGeneratorEvaluationsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_generator_evaluations_use_cached_wrapped_rpc(): @@ -2266,9 +2287,15 @@ async def test_list_generator_evaluations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + generator_evaluation.ListGeneratorEvaluationsRequest(), + {}, + ], +) async def test_list_generator_evaluations_async( - transport: str = "grpc_asyncio", - request_type=generator_evaluation.ListGeneratorEvaluationsRequest, + request_type, transport: str = "grpc_asyncio" ): client = GeneratorEvaluationsAsyncClient( credentials=async_anonymous_credentials(), @@ -2277,7 +2304,7 @@ async def test_list_generator_evaluations_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( @@ -2302,11 +2329,6 @@ async def test_list_generator_evaluations_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_generator_evaluations_async_from_dict(): - await test_list_generator_evaluations_async(request_type=dict) - - def test_list_generator_evaluations_field_headers(): client = GeneratorEvaluationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2665,8 +2687,8 @@ async def test_list_generator_evaluations_async_pages(): @pytest.mark.parametrize( "request_type", [ - generator_evaluation.DeleteGeneratorEvaluationRequest, - dict, + generator_evaluation.DeleteGeneratorEvaluationRequest(), + {}, ], ) def test_delete_generator_evaluation(request_type, transport: str = "grpc"): @@ -2677,7 +2699,7 @@ def test_delete_generator_evaluation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2722,9 +2744,10 @@ def test_delete_generator_evaluation_non_empty_request_with_auto_populated_field client.delete_generator_evaluation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == generator_evaluation.DeleteGeneratorEvaluationRequest( + request_msg = generator_evaluation.DeleteGeneratorEvaluationRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_generator_evaluation_use_cached_wrapped_rpc(): @@ -2810,9 +2833,15 @@ async def test_delete_generator_evaluation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + generator_evaluation.DeleteGeneratorEvaluationRequest(), + {}, + ], +) async def test_delete_generator_evaluation_async( - transport: str = "grpc_asyncio", - request_type=generator_evaluation.DeleteGeneratorEvaluationRequest, + request_type, transport: str = "grpc_asyncio" ): client = GeneratorEvaluationsAsyncClient( credentials=async_anonymous_credentials(), @@ -2821,7 +2850,7 @@ async def test_delete_generator_evaluation_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( @@ -2841,11 +2870,6 @@ async def test_delete_generator_evaluation_async( assert response is None -@pytest.mark.asyncio -async def test_delete_generator_evaluation_async_from_dict(): - await test_delete_generator_evaluation_async(request_type=dict) - - def test_delete_generator_evaluation_field_headers(): client = GeneratorEvaluationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3954,7 +3978,6 @@ def test_create_generator_evaluation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_generator_evaluation.CreateGeneratorEvaluationRequest() - assert args[0] == request_msg @@ -3977,7 +4000,6 @@ def test_get_generator_evaluation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generator_evaluation.GetGeneratorEvaluationRequest() - assert args[0] == request_msg @@ -4000,7 +4022,6 @@ def test_list_generator_evaluations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generator_evaluation.ListGeneratorEvaluationsRequest() - assert args[0] == request_msg @@ -4023,7 +4044,6 @@ def test_delete_generator_evaluation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generator_evaluation.DeleteGeneratorEvaluationRequest() - assert args[0] == request_msg @@ -4064,7 +4084,6 @@ async def test_create_generator_evaluation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_generator_evaluation.CreateGeneratorEvaluationRequest() - assert args[0] == request_msg @@ -4096,7 +4115,6 @@ async def test_get_generator_evaluation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generator_evaluation.GetGeneratorEvaluationRequest() - assert args[0] == request_msg @@ -4125,7 +4143,6 @@ async def test_list_generator_evaluations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generator_evaluation.ListGeneratorEvaluationsRequest() - assert args[0] == request_msg @@ -4150,7 +4167,6 @@ async def test_delete_generator_evaluation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generator_evaluation.DeleteGeneratorEvaluationRequest() - assert args[0] == request_msg @@ -5351,7 +5367,6 @@ def test_create_generator_evaluation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_generator_evaluation.CreateGeneratorEvaluationRequest() - assert args[0] == request_msg @@ -5373,7 +5388,6 @@ def test_get_generator_evaluation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generator_evaluation.GetGeneratorEvaluationRequest() - assert args[0] == request_msg @@ -5395,7 +5409,6 @@ def test_list_generator_evaluations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generator_evaluation.ListGeneratorEvaluationsRequest() - assert args[0] == request_msg @@ -5417,7 +5430,6 @@ def test_delete_generator_evaluation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generator_evaluation.DeleteGeneratorEvaluationRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_generators.py b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_generators.py index 527499c088df..7a52a6dd9119 100644 --- a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_generators.py +++ b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_generators.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 @@ -121,6 +122,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" @@ -1285,8 +1301,8 @@ def test_generators_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - gcd_generator.CreateGeneratorRequest, - dict, + gcd_generator.CreateGeneratorRequest(), + {}, ], ) def test_create_generator(request_type, transport: str = "grpc"): @@ -1297,7 +1313,7 @@ def test_create_generator(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_generator), "__call__") as call: @@ -1349,10 +1365,11 @@ def test_create_generator_non_empty_request_with_auto_populated_field(): client.create_generator(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_generator.CreateGeneratorRequest( + request_msg = gcd_generator.CreateGeneratorRequest( parent="parent_value", generator_id="generator_id_value", ) + assert args[0] == request_msg def test_create_generator_use_cached_wrapped_rpc(): @@ -1435,9 +1452,14 @@ async def test_create_generator_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_generator_async( - transport: str = "grpc_asyncio", request_type=gcd_generator.CreateGeneratorRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcd_generator.CreateGeneratorRequest(), + {}, + ], +) +async def test_create_generator_async(request_type, transport: str = "grpc_asyncio"): client = GeneratorsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1445,7 +1467,7 @@ async def test_create_generator_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_generator), "__call__") as call: @@ -1474,11 +1496,6 @@ async def test_create_generator_async( assert response.tools == ["tools_value"] -@pytest.mark.asyncio -async def test_create_generator_async_from_dict(): - await test_create_generator_async(request_type=dict) - - def test_create_generator_field_headers(): client = GeneratorsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1645,8 +1662,8 @@ async def test_create_generator_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - generator.GetGeneratorRequest, - dict, + generator.GetGeneratorRequest(), + {}, ], ) def test_get_generator(request_type, transport: str = "grpc"): @@ -1657,7 +1674,7 @@ def test_get_generator(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_generator), "__call__") as call: @@ -1708,9 +1725,10 @@ def test_get_generator_non_empty_request_with_auto_populated_field(): client.get_generator(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == generator.GetGeneratorRequest( + request_msg = generator.GetGeneratorRequest( name="name_value", ) + assert args[0] == request_msg def test_get_generator_use_cached_wrapped_rpc(): @@ -1791,9 +1809,14 @@ async def test_get_generator_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_generator_async( - transport: str = "grpc_asyncio", request_type=generator.GetGeneratorRequest -): +@pytest.mark.parametrize( + "request_type", + [ + generator.GetGeneratorRequest(), + {}, + ], +) +async def test_get_generator_async(request_type, transport: str = "grpc_asyncio"): client = GeneratorsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1801,7 +1824,7 @@ async def test_get_generator_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_generator), "__call__") as call: @@ -1830,11 +1853,6 @@ async def test_get_generator_async( assert response.tools == ["tools_value"] -@pytest.mark.asyncio -async def test_get_generator_async_from_dict(): - await test_get_generator_async(request_type=dict) - - def test_get_generator_field_headers(): client = GeneratorsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1977,8 +1995,8 @@ async def test_get_generator_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - generator.ListGeneratorsRequest, - dict, + generator.ListGeneratorsRequest(), + {}, ], ) def test_list_generators(request_type, transport: str = "grpc"): @@ -1989,7 +2007,7 @@ def test_list_generators(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_generators), "__call__") as call: @@ -2034,10 +2052,11 @@ def test_list_generators_non_empty_request_with_auto_populated_field(): client.list_generators(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == generator.ListGeneratorsRequest( + request_msg = generator.ListGeneratorsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_generators_use_cached_wrapped_rpc(): @@ -2118,9 +2137,14 @@ async def test_list_generators_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_generators_async( - transport: str = "grpc_asyncio", request_type=generator.ListGeneratorsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + generator.ListGeneratorsRequest(), + {}, + ], +) +async def test_list_generators_async(request_type, transport: str = "grpc_asyncio"): client = GeneratorsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2128,7 +2152,7 @@ async def test_list_generators_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_generators), "__call__") as call: @@ -2151,11 +2175,6 @@ async def test_list_generators_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_generators_async_from_dict(): - await test_list_generators_async(request_type=dict) - - def test_list_generators_field_headers(): client = GeneratorsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2492,8 +2511,8 @@ async def test_list_generators_async_pages(): @pytest.mark.parametrize( "request_type", [ - generator.DeleteGeneratorRequest, - dict, + generator.DeleteGeneratorRequest(), + {}, ], ) def test_delete_generator(request_type, transport: str = "grpc"): @@ -2504,7 +2523,7 @@ def test_delete_generator(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_generator), "__call__") as call: @@ -2545,9 +2564,10 @@ def test_delete_generator_non_empty_request_with_auto_populated_field(): client.delete_generator(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == generator.DeleteGeneratorRequest( + request_msg = generator.DeleteGeneratorRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_generator_use_cached_wrapped_rpc(): @@ -2630,9 +2650,14 @@ async def test_delete_generator_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_generator_async( - transport: str = "grpc_asyncio", request_type=generator.DeleteGeneratorRequest -): +@pytest.mark.parametrize( + "request_type", + [ + generator.DeleteGeneratorRequest(), + {}, + ], +) +async def test_delete_generator_async(request_type, transport: str = "grpc_asyncio"): client = GeneratorsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2640,7 +2665,7 @@ async def test_delete_generator_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_generator), "__call__") as call: @@ -2658,11 +2683,6 @@ async def test_delete_generator_async( assert response is None -@pytest.mark.asyncio -async def test_delete_generator_async_from_dict(): - await test_delete_generator_async(request_type=dict) - - def test_delete_generator_field_headers(): client = GeneratorsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2805,8 +2825,8 @@ async def test_delete_generator_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcd_generator.UpdateGeneratorRequest, - dict, + gcd_generator.UpdateGeneratorRequest(), + {}, ], ) def test_update_generator(request_type, transport: str = "grpc"): @@ -2817,7 +2837,7 @@ def test_update_generator(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_generator), "__call__") as call: @@ -2866,7 +2886,8 @@ def test_update_generator_non_empty_request_with_auto_populated_field(): client.update_generator(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_generator.UpdateGeneratorRequest() + request_msg = gcd_generator.UpdateGeneratorRequest() + assert args[0] == request_msg def test_update_generator_use_cached_wrapped_rpc(): @@ -2949,9 +2970,14 @@ async def test_update_generator_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_generator_async( - transport: str = "grpc_asyncio", request_type=gcd_generator.UpdateGeneratorRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcd_generator.UpdateGeneratorRequest(), + {}, + ], +) +async def test_update_generator_async(request_type, transport: str = "grpc_asyncio"): client = GeneratorsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2959,7 +2985,7 @@ async def test_update_generator_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_generator), "__call__") as call: @@ -2988,11 +3014,6 @@ async def test_update_generator_async( assert response.tools == ["tools_value"] -@pytest.mark.asyncio -async def test_update_generator_async_from_dict(): - await test_update_generator_async(request_type=dict) - - def test_update_generator_field_headers(): client = GeneratorsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4257,7 +4278,6 @@ def test_create_generator_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_generator.CreateGeneratorRequest() - assert args[0] == request_msg @@ -4278,7 +4298,6 @@ def test_get_generator_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generator.GetGeneratorRequest() - assert args[0] == request_msg @@ -4299,7 +4318,6 @@ def test_list_generators_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generator.ListGeneratorsRequest() - assert args[0] == request_msg @@ -4320,7 +4338,6 @@ def test_delete_generator_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generator.DeleteGeneratorRequest() - assert args[0] == request_msg @@ -4341,7 +4358,6 @@ def test_update_generator_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_generator.UpdateGeneratorRequest() - assert args[0] == request_msg @@ -4385,7 +4401,6 @@ async def test_create_generator_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_generator.CreateGeneratorRequest() - assert args[0] == request_msg @@ -4415,7 +4430,6 @@ async def test_get_generator_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generator.GetGeneratorRequest() - assert args[0] == request_msg @@ -4442,7 +4456,6 @@ async def test_list_generators_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generator.ListGeneratorsRequest() - assert args[0] == request_msg @@ -4465,7 +4478,6 @@ async def test_delete_generator_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generator.DeleteGeneratorRequest() - assert args[0] == request_msg @@ -4495,7 +4507,6 @@ async def test_update_generator_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_generator.UpdateGeneratorRequest() - assert args[0] == request_msg @@ -5905,7 +5916,6 @@ def test_create_generator_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_generator.CreateGeneratorRequest() - assert args[0] == request_msg @@ -5925,7 +5935,6 @@ def test_get_generator_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generator.GetGeneratorRequest() - assert args[0] == request_msg @@ -5945,7 +5954,6 @@ def test_list_generators_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generator.ListGeneratorsRequest() - assert args[0] == request_msg @@ -5965,7 +5973,6 @@ def test_delete_generator_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generator.DeleteGeneratorRequest() - assert args[0] == request_msg @@ -5985,7 +5992,6 @@ def test_update_generator_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_generator.UpdateGeneratorRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_intents.py b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_intents.py index 75b625aac064..00f178af9d0d 100644 --- a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_intents.py +++ b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_intents.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 @@ -117,6 +118,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" @@ -1253,8 +1269,8 @@ def test_intents_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - intent.ListIntentsRequest, - dict, + intent.ListIntentsRequest(), + {}, ], ) def test_list_intents(request_type, transport: str = "grpc"): @@ -1265,7 +1281,7 @@ def test_list_intents(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_intents), "__call__") as call: @@ -1311,11 +1327,12 @@ def test_list_intents_non_empty_request_with_auto_populated_field(): client.list_intents(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == intent.ListIntentsRequest( + request_msg = intent.ListIntentsRequest( parent="parent_value", language_code="language_code_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_intents_use_cached_wrapped_rpc(): @@ -1396,9 +1413,14 @@ async def test_list_intents_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_intents_async( - transport: str = "grpc_asyncio", request_type=intent.ListIntentsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + intent.ListIntentsRequest(), + {}, + ], +) +async def test_list_intents_async(request_type, transport: str = "grpc_asyncio"): client = IntentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1406,7 +1428,7 @@ async def test_list_intents_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_intents), "__call__") as call: @@ -1429,11 +1451,6 @@ async def test_list_intents_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_intents_async_from_dict(): - await test_list_intents_async(request_type=dict) - - def test_list_intents_field_headers(): client = IntentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1780,8 +1797,8 @@ async def test_list_intents_async_pages(): @pytest.mark.parametrize( "request_type", [ - intent.GetIntentRequest, - dict, + intent.GetIntentRequest(), + {}, ], ) def test_get_intent(request_type, transport: str = "grpc"): @@ -1792,7 +1809,7 @@ def test_get_intent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_intent), "__call__") as call: @@ -1869,10 +1886,11 @@ def test_get_intent_non_empty_request_with_auto_populated_field(): client.get_intent(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == intent.GetIntentRequest( + request_msg = intent.GetIntentRequest( name="name_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_get_intent_use_cached_wrapped_rpc(): @@ -1951,9 +1969,14 @@ async def test_get_intent_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_intent_async( - transport: str = "grpc_asyncio", request_type=intent.GetIntentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + intent.GetIntentRequest(), + {}, + ], +) +async def test_get_intent_async(request_type, transport: str = "grpc_asyncio"): client = IntentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1961,7 +1984,7 @@ async def test_get_intent_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_intent), "__call__") as call: @@ -2016,11 +2039,6 @@ async def test_get_intent_async( assert response.parent_followup_intent_name == "parent_followup_intent_name_value" -@pytest.mark.asyncio -async def test_get_intent_async_from_dict(): - await test_get_intent_async(request_type=dict) - - def test_get_intent_field_headers(): client = IntentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2173,8 +2191,8 @@ async def test_get_intent_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcd_intent.CreateIntentRequest, - dict, + gcd_intent.CreateIntentRequest(), + {}, ], ) def test_create_intent(request_type, transport: str = "grpc"): @@ -2185,7 +2203,7 @@ def test_create_intent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_intent), "__call__") as call: @@ -2264,10 +2282,11 @@ def test_create_intent_non_empty_request_with_auto_populated_field(): client.create_intent(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_intent.CreateIntentRequest( + request_msg = gcd_intent.CreateIntentRequest( parent="parent_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_create_intent_use_cached_wrapped_rpc(): @@ -2348,9 +2367,14 @@ async def test_create_intent_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_intent_async( - transport: str = "grpc_asyncio", request_type=gcd_intent.CreateIntentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcd_intent.CreateIntentRequest(), + {}, + ], +) +async def test_create_intent_async(request_type, transport: str = "grpc_asyncio"): client = IntentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2358,7 +2382,7 @@ async def test_create_intent_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_intent), "__call__") as call: @@ -2417,11 +2441,6 @@ async def test_create_intent_async( assert response.parent_followup_intent_name == "parent_followup_intent_name_value" -@pytest.mark.asyncio -async def test_create_intent_async_from_dict(): - await test_create_intent_async(request_type=dict) - - def test_create_intent_field_headers(): client = IntentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2584,8 +2603,8 @@ async def test_create_intent_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcd_intent.UpdateIntentRequest, - dict, + gcd_intent.UpdateIntentRequest(), + {}, ], ) def test_update_intent(request_type, transport: str = "grpc"): @@ -2596,7 +2615,7 @@ def test_update_intent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_intent), "__call__") as call: @@ -2674,9 +2693,10 @@ def test_update_intent_non_empty_request_with_auto_populated_field(): client.update_intent(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_intent.UpdateIntentRequest( + request_msg = gcd_intent.UpdateIntentRequest( language_code="language_code_value", ) + assert args[0] == request_msg def test_update_intent_use_cached_wrapped_rpc(): @@ -2757,9 +2777,14 @@ async def test_update_intent_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_intent_async( - transport: str = "grpc_asyncio", request_type=gcd_intent.UpdateIntentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcd_intent.UpdateIntentRequest(), + {}, + ], +) +async def test_update_intent_async(request_type, transport: str = "grpc_asyncio"): client = IntentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2767,7 +2792,7 @@ async def test_update_intent_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_intent), "__call__") as call: @@ -2826,11 +2851,6 @@ async def test_update_intent_async( assert response.parent_followup_intent_name == "parent_followup_intent_name_value" -@pytest.mark.asyncio -async def test_update_intent_async_from_dict(): - await test_update_intent_async(request_type=dict) - - def test_update_intent_field_headers(): client = IntentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2993,8 +3013,8 @@ async def test_update_intent_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - intent.DeleteIntentRequest, - dict, + intent.DeleteIntentRequest(), + {}, ], ) def test_delete_intent(request_type, transport: str = "grpc"): @@ -3005,7 +3025,7 @@ def test_delete_intent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_intent), "__call__") as call: @@ -3046,9 +3066,10 @@ def test_delete_intent_non_empty_request_with_auto_populated_field(): client.delete_intent(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == intent.DeleteIntentRequest( + request_msg = intent.DeleteIntentRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_intent_use_cached_wrapped_rpc(): @@ -3129,9 +3150,14 @@ async def test_delete_intent_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_intent_async( - transport: str = "grpc_asyncio", request_type=intent.DeleteIntentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + intent.DeleteIntentRequest(), + {}, + ], +) +async def test_delete_intent_async(request_type, transport: str = "grpc_asyncio"): client = IntentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3139,7 +3165,7 @@ async def test_delete_intent_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_intent), "__call__") as call: @@ -3157,11 +3183,6 @@ async def test_delete_intent_async( assert response is None -@pytest.mark.asyncio -async def test_delete_intent_async_from_dict(): - await test_delete_intent_async(request_type=dict) - - def test_delete_intent_field_headers(): client = IntentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3304,8 +3325,8 @@ async def test_delete_intent_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - intent.BatchUpdateIntentsRequest, - dict, + intent.BatchUpdateIntentsRequest(), + {}, ], ) def test_batch_update_intents(request_type, transport: str = "grpc"): @@ -3316,7 +3337,7 @@ def test_batch_update_intents(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3363,11 +3384,12 @@ def test_batch_update_intents_non_empty_request_with_auto_populated_field(): client.batch_update_intents(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == intent.BatchUpdateIntentsRequest( + request_msg = intent.BatchUpdateIntentsRequest( parent="parent_value", intent_batch_uri="intent_batch_uri_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_batch_update_intents_use_cached_wrapped_rpc(): @@ -3462,8 +3484,15 @@ async def test_batch_update_intents_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + intent.BatchUpdateIntentsRequest(), + {}, + ], +) async def test_batch_update_intents_async( - transport: str = "grpc_asyncio", request_type=intent.BatchUpdateIntentsRequest + request_type, transport: str = "grpc_asyncio" ): client = IntentsAsyncClient( credentials=async_anonymous_credentials(), @@ -3472,7 +3501,7 @@ async def test_batch_update_intents_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( @@ -3494,11 +3523,6 @@ async def test_batch_update_intents_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_batch_update_intents_async_from_dict(): - await test_batch_update_intents_async(request_type=dict) - - def test_batch_update_intents_field_headers(): client = IntentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3675,8 +3699,8 @@ async def test_batch_update_intents_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - intent.BatchDeleteIntentsRequest, - dict, + intent.BatchDeleteIntentsRequest(), + {}, ], ) def test_batch_delete_intents(request_type, transport: str = "grpc"): @@ -3687,7 +3711,7 @@ def test_batch_delete_intents(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3732,9 +3756,10 @@ def test_batch_delete_intents_non_empty_request_with_auto_populated_field(): client.batch_delete_intents(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == intent.BatchDeleteIntentsRequest( + request_msg = intent.BatchDeleteIntentsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_batch_delete_intents_use_cached_wrapped_rpc(): @@ -3829,8 +3854,15 @@ async def test_batch_delete_intents_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + intent.BatchDeleteIntentsRequest(), + {}, + ], +) async def test_batch_delete_intents_async( - transport: str = "grpc_asyncio", request_type=intent.BatchDeleteIntentsRequest + request_type, transport: str = "grpc_asyncio" ): client = IntentsAsyncClient( credentials=async_anonymous_credentials(), @@ -3839,7 +3871,7 @@ async def test_batch_delete_intents_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( @@ -3861,11 +3893,6 @@ async def test_batch_delete_intents_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_batch_delete_intents_async_from_dict(): - await test_batch_delete_intents_async(request_type=dict) - - def test_batch_delete_intents_field_headers(): client = IntentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5544,7 +5571,6 @@ def test_list_intents_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intent.ListIntentsRequest() - assert args[0] == request_msg @@ -5565,7 +5591,6 @@ def test_get_intent_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intent.GetIntentRequest() - assert args[0] == request_msg @@ -5586,7 +5611,6 @@ def test_create_intent_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_intent.CreateIntentRequest() - assert args[0] == request_msg @@ -5607,7 +5631,6 @@ def test_update_intent_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_intent.UpdateIntentRequest() - assert args[0] == request_msg @@ -5628,7 +5651,6 @@ def test_delete_intent_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intent.DeleteIntentRequest() - assert args[0] == request_msg @@ -5651,7 +5673,6 @@ def test_batch_update_intents_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intent.BatchUpdateIntentsRequest() - assert args[0] == request_msg @@ -5674,7 +5695,6 @@ def test_batch_delete_intents_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intent.BatchDeleteIntentsRequest() - assert args[0] == request_msg @@ -5715,7 +5735,6 @@ async def test_list_intents_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intent.ListIntentsRequest() - assert args[0] == request_msg @@ -5757,7 +5776,6 @@ async def test_get_intent_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intent.GetIntentRequest() - assert args[0] == request_msg @@ -5801,7 +5819,6 @@ async def test_create_intent_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_intent.CreateIntentRequest() - assert args[0] == request_msg @@ -5845,7 +5862,6 @@ async def test_update_intent_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_intent.UpdateIntentRequest() - assert args[0] == request_msg @@ -5868,7 +5884,6 @@ async def test_delete_intent_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intent.DeleteIntentRequest() - assert args[0] == request_msg @@ -5895,7 +5910,6 @@ async def test_batch_update_intents_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intent.BatchUpdateIntentsRequest() - assert args[0] == request_msg @@ -5922,7 +5936,6 @@ async def test_batch_delete_intents_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intent.BatchDeleteIntentsRequest() - assert args[0] == request_msg @@ -7747,7 +7760,6 @@ def test_list_intents_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intent.ListIntentsRequest() - assert args[0] == request_msg @@ -7767,7 +7779,6 @@ def test_get_intent_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intent.GetIntentRequest() - assert args[0] == request_msg @@ -7787,7 +7798,6 @@ def test_create_intent_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_intent.CreateIntentRequest() - assert args[0] == request_msg @@ -7807,7 +7817,6 @@ def test_update_intent_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_intent.UpdateIntentRequest() - assert args[0] == request_msg @@ -7827,7 +7836,6 @@ def test_delete_intent_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intent.DeleteIntentRequest() - assert args[0] == request_msg @@ -7849,7 +7857,6 @@ def test_batch_update_intents_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intent.BatchUpdateIntentsRequest() - assert args[0] == request_msg @@ -7871,7 +7878,6 @@ def test_batch_delete_intents_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intent.BatchDeleteIntentsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_knowledge_bases.py b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_knowledge_bases.py index 0f82e37e1d9e..f5732b93ab42 100644 --- a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_knowledge_bases.py +++ b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_knowledge_bases.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" @@ -1317,8 +1333,8 @@ def test_knowledge_bases_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - knowledge_base.ListKnowledgeBasesRequest, - dict, + knowledge_base.ListKnowledgeBasesRequest(), + {}, ], ) def test_list_knowledge_bases(request_type, transport: str = "grpc"): @@ -1329,7 +1345,7 @@ def test_list_knowledge_bases(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1379,11 +1395,12 @@ def test_list_knowledge_bases_non_empty_request_with_auto_populated_field(): client.list_knowledge_bases(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == knowledge_base.ListKnowledgeBasesRequest( + request_msg = knowledge_base.ListKnowledgeBasesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_knowledge_bases_use_cached_wrapped_rpc(): @@ -1468,9 +1485,15 @@ async def test_list_knowledge_bases_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + knowledge_base.ListKnowledgeBasesRequest(), + {}, + ], +) async def test_list_knowledge_bases_async( - transport: str = "grpc_asyncio", - request_type=knowledge_base.ListKnowledgeBasesRequest, + request_type, transport: str = "grpc_asyncio" ): client = KnowledgeBasesAsyncClient( credentials=async_anonymous_credentials(), @@ -1479,7 +1502,7 @@ async def test_list_knowledge_bases_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( @@ -1504,11 +1527,6 @@ async def test_list_knowledge_bases_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_knowledge_bases_async_from_dict(): - await test_list_knowledge_bases_async(request_type=dict) - - def test_list_knowledge_bases_field_headers(): client = KnowledgeBasesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1861,8 +1879,8 @@ async def test_list_knowledge_bases_async_pages(): @pytest.mark.parametrize( "request_type", [ - knowledge_base.GetKnowledgeBaseRequest, - dict, + knowledge_base.GetKnowledgeBaseRequest(), + {}, ], ) def test_get_knowledge_base(request_type, transport: str = "grpc"): @@ -1873,7 +1891,7 @@ def test_get_knowledge_base(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1925,9 +1943,10 @@ def test_get_knowledge_base_non_empty_request_with_auto_populated_field(): client.get_knowledge_base(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == knowledge_base.GetKnowledgeBaseRequest( + request_msg = knowledge_base.GetKnowledgeBaseRequest( name="name_value", ) + assert args[0] == request_msg def test_get_knowledge_base_use_cached_wrapped_rpc(): @@ -2012,9 +2031,14 @@ async def test_get_knowledge_base_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_knowledge_base_async( - transport: str = "grpc_asyncio", request_type=knowledge_base.GetKnowledgeBaseRequest -): +@pytest.mark.parametrize( + "request_type", + [ + knowledge_base.GetKnowledgeBaseRequest(), + {}, + ], +) +async def test_get_knowledge_base_async(request_type, transport: str = "grpc_asyncio"): client = KnowledgeBasesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2022,7 +2046,7 @@ async def test_get_knowledge_base_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( @@ -2051,11 +2075,6 @@ async def test_get_knowledge_base_async( assert response.language_code == "language_code_value" -@pytest.mark.asyncio -async def test_get_knowledge_base_async_from_dict(): - await test_get_knowledge_base_async(request_type=dict) - - def test_get_knowledge_base_field_headers(): client = KnowledgeBasesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2210,8 +2229,8 @@ async def test_get_knowledge_base_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcd_knowledge_base.CreateKnowledgeBaseRequest, - dict, + gcd_knowledge_base.CreateKnowledgeBaseRequest(), + {}, ], ) def test_create_knowledge_base(request_type, transport: str = "grpc"): @@ -2222,7 +2241,7 @@ def test_create_knowledge_base(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2274,9 +2293,10 @@ def test_create_knowledge_base_non_empty_request_with_auto_populated_field(): client.create_knowledge_base(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_knowledge_base.CreateKnowledgeBaseRequest( + request_msg = gcd_knowledge_base.CreateKnowledgeBaseRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_knowledge_base_use_cached_wrapped_rpc(): @@ -2362,9 +2382,15 @@ async def test_create_knowledge_base_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcd_knowledge_base.CreateKnowledgeBaseRequest(), + {}, + ], +) async def test_create_knowledge_base_async( - transport: str = "grpc_asyncio", - request_type=gcd_knowledge_base.CreateKnowledgeBaseRequest, + request_type, transport: str = "grpc_asyncio" ): client = KnowledgeBasesAsyncClient( credentials=async_anonymous_credentials(), @@ -2373,7 +2399,7 @@ async def test_create_knowledge_base_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 +2428,6 @@ async def test_create_knowledge_base_async( assert response.language_code == "language_code_value" -@pytest.mark.asyncio -async def test_create_knowledge_base_async_from_dict(): - await test_create_knowledge_base_async(request_type=dict) - - def test_create_knowledge_base_field_headers(): client = KnowledgeBasesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2571,8 +2592,8 @@ async def test_create_knowledge_base_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - knowledge_base.DeleteKnowledgeBaseRequest, - dict, + knowledge_base.DeleteKnowledgeBaseRequest(), + {}, ], ) def test_delete_knowledge_base(request_type, transport: str = "grpc"): @@ -2583,7 +2604,7 @@ def test_delete_knowledge_base(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2628,9 +2649,10 @@ def test_delete_knowledge_base_non_empty_request_with_auto_populated_field(): client.delete_knowledge_base(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == knowledge_base.DeleteKnowledgeBaseRequest( + request_msg = knowledge_base.DeleteKnowledgeBaseRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_knowledge_base_use_cached_wrapped_rpc(): @@ -2716,9 +2738,15 @@ async def test_delete_knowledge_base_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + knowledge_base.DeleteKnowledgeBaseRequest(), + {}, + ], +) async def test_delete_knowledge_base_async( - transport: str = "grpc_asyncio", - request_type=knowledge_base.DeleteKnowledgeBaseRequest, + request_type, transport: str = "grpc_asyncio" ): client = KnowledgeBasesAsyncClient( credentials=async_anonymous_credentials(), @@ -2727,7 +2755,7 @@ async def test_delete_knowledge_base_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( @@ -2747,11 +2775,6 @@ async def test_delete_knowledge_base_async( assert response is None -@pytest.mark.asyncio -async def test_delete_knowledge_base_async_from_dict(): - await test_delete_knowledge_base_async(request_type=dict) - - def test_delete_knowledge_base_field_headers(): client = KnowledgeBasesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2902,8 +2925,8 @@ async def test_delete_knowledge_base_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcd_knowledge_base.UpdateKnowledgeBaseRequest, - dict, + gcd_knowledge_base.UpdateKnowledgeBaseRequest(), + {}, ], ) def test_update_knowledge_base(request_type, transport: str = "grpc"): @@ -2914,7 +2937,7 @@ def test_update_knowledge_base(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2964,7 +2987,8 @@ def test_update_knowledge_base_non_empty_request_with_auto_populated_field(): client.update_knowledge_base(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_knowledge_base.UpdateKnowledgeBaseRequest() + request_msg = gcd_knowledge_base.UpdateKnowledgeBaseRequest() + assert args[0] == request_msg def test_update_knowledge_base_use_cached_wrapped_rpc(): @@ -3050,9 +3074,15 @@ async def test_update_knowledge_base_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcd_knowledge_base.UpdateKnowledgeBaseRequest(), + {}, + ], +) async def test_update_knowledge_base_async( - transport: str = "grpc_asyncio", - request_type=gcd_knowledge_base.UpdateKnowledgeBaseRequest, + request_type, transport: str = "grpc_asyncio" ): client = KnowledgeBasesAsyncClient( credentials=async_anonymous_credentials(), @@ -3061,7 +3091,7 @@ async def test_update_knowledge_base_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( @@ -3090,11 +3120,6 @@ async def test_update_knowledge_base_async( assert response.language_code == "language_code_value" -@pytest.mark.asyncio -async def test_update_knowledge_base_async_from_dict(): - await test_update_knowledge_base_async(request_type=dict) - - def test_update_knowledge_base_field_headers(): client = KnowledgeBasesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4380,7 +4405,6 @@ def test_list_knowledge_bases_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = knowledge_base.ListKnowledgeBasesRequest() - assert args[0] == request_msg @@ -4403,7 +4427,6 @@ def test_get_knowledge_base_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = knowledge_base.GetKnowledgeBaseRequest() - assert args[0] == request_msg @@ -4426,7 +4449,6 @@ def test_create_knowledge_base_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_knowledge_base.CreateKnowledgeBaseRequest() - assert args[0] == request_msg @@ -4449,7 +4471,6 @@ def test_delete_knowledge_base_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = knowledge_base.DeleteKnowledgeBaseRequest() - assert args[0] == request_msg @@ -4472,7 +4493,6 @@ def test_update_knowledge_base_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_knowledge_base.UpdateKnowledgeBaseRequest() - assert args[0] == request_msg @@ -4515,7 +4535,6 @@ async def test_list_knowledge_bases_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = knowledge_base.ListKnowledgeBasesRequest() - assert args[0] == request_msg @@ -4546,7 +4565,6 @@ async def test_get_knowledge_base_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = knowledge_base.GetKnowledgeBaseRequest() - assert args[0] == request_msg @@ -4577,7 +4595,6 @@ async def test_create_knowledge_base_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_knowledge_base.CreateKnowledgeBaseRequest() - assert args[0] == request_msg @@ -4602,7 +4619,6 @@ async def test_delete_knowledge_base_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = knowledge_base.DeleteKnowledgeBaseRequest() - assert args[0] == request_msg @@ -4633,7 +4649,6 @@ async def test_update_knowledge_base_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_knowledge_base.UpdateKnowledgeBaseRequest() - assert args[0] == request_msg @@ -5787,7 +5802,6 @@ def test_list_knowledge_bases_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = knowledge_base.ListKnowledgeBasesRequest() - assert args[0] == request_msg @@ -5809,7 +5823,6 @@ def test_get_knowledge_base_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = knowledge_base.GetKnowledgeBaseRequest() - assert args[0] == request_msg @@ -5831,7 +5844,6 @@ def test_create_knowledge_base_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_knowledge_base.CreateKnowledgeBaseRequest() - assert args[0] == request_msg @@ -5853,7 +5865,6 @@ def test_delete_knowledge_base_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = knowledge_base.DeleteKnowledgeBaseRequest() - assert args[0] == request_msg @@ -5875,7 +5886,6 @@ def test_update_knowledge_base_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_knowledge_base.UpdateKnowledgeBaseRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_participants.py b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_participants.py index d9a875e6585b..c9943bc2d655 100644 --- a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_participants.py +++ b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_participants.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 @@ -123,6 +124,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" @@ -1306,8 +1322,8 @@ def test_participants_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - gcd_participant.CreateParticipantRequest, - dict, + gcd_participant.CreateParticipantRequest(), + {}, ], ) def test_create_participant(request_type, transport: str = "grpc"): @@ -1318,7 +1334,7 @@ def test_create_participant(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1375,9 +1391,10 @@ def test_create_participant_non_empty_request_with_auto_populated_field(): client.create_participant(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_participant.CreateParticipantRequest( + request_msg = gcd_participant.CreateParticipantRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_participant_use_cached_wrapped_rpc(): @@ -1462,10 +1479,14 @@ async def test_create_participant_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_participant_async( - transport: str = "grpc_asyncio", - request_type=gcd_participant.CreateParticipantRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + gcd_participant.CreateParticipantRequest(), + {}, + ], +) +async def test_create_participant_async(request_type, transport: str = "grpc_asyncio"): client = ParticipantsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1473,7 +1494,7 @@ async def test_create_participant_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( @@ -1507,11 +1528,6 @@ async def test_create_participant_async( ) -@pytest.mark.asyncio -async def test_create_participant_async_from_dict(): - await test_create_participant_async(request_type=dict) - - def test_create_participant_field_headers(): client = ParticipantsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1676,8 +1692,8 @@ async def test_create_participant_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - participant.GetParticipantRequest, - dict, + participant.GetParticipantRequest(), + {}, ], ) def test_get_participant(request_type, transport: str = "grpc"): @@ -1688,7 +1704,7 @@ def test_get_participant(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_participant), "__call__") as call: @@ -1741,9 +1757,10 @@ def test_get_participant_non_empty_request_with_auto_populated_field(): client.get_participant(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == participant.GetParticipantRequest( + request_msg = participant.GetParticipantRequest( name="name_value", ) + assert args[0] == request_msg def test_get_participant_use_cached_wrapped_rpc(): @@ -1824,9 +1841,14 @@ async def test_get_participant_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_participant_async( - transport: str = "grpc_asyncio", request_type=participant.GetParticipantRequest -): +@pytest.mark.parametrize( + "request_type", + [ + participant.GetParticipantRequest(), + {}, + ], +) +async def test_get_participant_async(request_type, transport: str = "grpc_asyncio"): client = ParticipantsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1834,7 +1856,7 @@ async def test_get_participant_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_participant), "__call__") as call: @@ -1866,11 +1888,6 @@ async def test_get_participant_async( ) -@pytest.mark.asyncio -async def test_get_participant_async_from_dict(): - await test_get_participant_async(request_type=dict) - - def test_get_participant_field_headers(): client = ParticipantsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2017,8 +2034,8 @@ async def test_get_participant_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - participant.ListParticipantsRequest, - dict, + participant.ListParticipantsRequest(), + {}, ], ) def test_list_participants(request_type, transport: str = "grpc"): @@ -2029,7 +2046,7 @@ def test_list_participants(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2078,10 +2095,11 @@ def test_list_participants_non_empty_request_with_auto_populated_field(): client.list_participants(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == participant.ListParticipantsRequest( + request_msg = participant.ListParticipantsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_participants_use_cached_wrapped_rpc(): @@ -2164,9 +2182,14 @@ async def test_list_participants_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_participants_async( - transport: str = "grpc_asyncio", request_type=participant.ListParticipantsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + participant.ListParticipantsRequest(), + {}, + ], +) +async def test_list_participants_async(request_type, transport: str = "grpc_asyncio"): client = ParticipantsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2174,7 +2197,7 @@ async def test_list_participants_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( @@ -2199,11 +2222,6 @@ async def test_list_participants_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_participants_async_from_dict(): - await test_list_participants_async(request_type=dict) - - def test_list_participants_field_headers(): client = ParticipantsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2556,8 +2574,8 @@ async def test_list_participants_async_pages(): @pytest.mark.parametrize( "request_type", [ - gcd_participant.UpdateParticipantRequest, - dict, + gcd_participant.UpdateParticipantRequest(), + {}, ], ) def test_update_participant(request_type, transport: str = "grpc"): @@ -2568,7 +2586,7 @@ def test_update_participant(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,7 +2641,8 @@ def test_update_participant_non_empty_request_with_auto_populated_field(): client.update_participant(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_participant.UpdateParticipantRequest() + request_msg = gcd_participant.UpdateParticipantRequest() + assert args[0] == request_msg def test_update_participant_use_cached_wrapped_rpc(): @@ -2708,10 +2727,14 @@ async def test_update_participant_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_participant_async( - transport: str = "grpc_asyncio", - request_type=gcd_participant.UpdateParticipantRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + gcd_participant.UpdateParticipantRequest(), + {}, + ], +) +async def test_update_participant_async(request_type, transport: str = "grpc_asyncio"): client = ParticipantsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2719,7 +2742,7 @@ async def test_update_participant_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( @@ -2753,11 +2776,6 @@ async def test_update_participant_async( ) -@pytest.mark.asyncio -async def test_update_participant_async_from_dict(): - await test_update_participant_async(request_type=dict) - - def test_update_participant_field_headers(): client = ParticipantsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2922,8 +2940,8 @@ async def test_update_participant_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcd_participant.AnalyzeContentRequest, - dict, + gcd_participant.AnalyzeContentRequest(), + {}, ], ) def test_analyze_content(request_type, transport: str = "grpc"): @@ -2934,7 +2952,7 @@ def test_analyze_content(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.analyze_content), "__call__") as call: @@ -2980,11 +2998,12 @@ def test_analyze_content_non_empty_request_with_auto_populated_field(): client.analyze_content(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_participant.AnalyzeContentRequest( + request_msg = gcd_participant.AnalyzeContentRequest( participant="participant_value", cx_current_page="cx_current_page_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_analyze_content_use_cached_wrapped_rpc(): @@ -3065,9 +3084,14 @@ async def test_analyze_content_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_analyze_content_async( - transport: str = "grpc_asyncio", request_type=gcd_participant.AnalyzeContentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcd_participant.AnalyzeContentRequest(), + {}, + ], +) +async def test_analyze_content_async(request_type, transport: str = "grpc_asyncio"): client = ParticipantsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3075,7 +3099,7 @@ async def test_analyze_content_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.analyze_content), "__call__") as call: @@ -3098,11 +3122,6 @@ async def test_analyze_content_async( assert response.reply_text == "reply_text_value" -@pytest.mark.asyncio -async def test_analyze_content_async_from_dict(): - await test_analyze_content_async(request_type=dict) - - def test_analyze_content_field_headers(): client = ParticipantsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3279,8 +3298,8 @@ async def test_analyze_content_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - participant.StreamingAnalyzeContentRequest, - dict, + participant.StreamingAnalyzeContentRequest(), + {}, ], ) def test_streaming_analyze_content(request_type, transport: str = "grpc"): @@ -3291,7 +3310,7 @@ def test_streaming_analyze_content(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as 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. @@ -3395,9 +3414,15 @@ async def test_streaming_analyze_content_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + participant.StreamingAnalyzeContentRequest(), + {}, + ], +) async def test_streaming_analyze_content_async( - transport: str = "grpc_asyncio", - request_type=participant.StreamingAnalyzeContentRequest, + request_type, transport: str = "grpc_asyncio" ): client = ParticipantsAsyncClient( credentials=async_anonymous_credentials(), @@ -3406,7 +3431,7 @@ async def test_streaming_analyze_content_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. @@ -3430,16 +3455,11 @@ async def test_streaming_analyze_content_async( assert isinstance(message, participant.StreamingAnalyzeContentResponse) -@pytest.mark.asyncio -async def test_streaming_analyze_content_async_from_dict(): - await test_streaming_analyze_content_async(request_type=dict) - - @pytest.mark.parametrize( "request_type", [ - participant.BidiStreamingAnalyzeContentRequest, - dict, + participant.BidiStreamingAnalyzeContentRequest(), + {}, ], ) def test_bidi_streaming_analyze_content(request_type, transport: str = "grpc"): @@ -3450,7 +3470,7 @@ def test_bidi_streaming_analyze_content(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as 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. @@ -3554,9 +3574,15 @@ async def test_bidi_streaming_analyze_content_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + participant.BidiStreamingAnalyzeContentRequest(), + {}, + ], +) async def test_bidi_streaming_analyze_content_async( - transport: str = "grpc_asyncio", - request_type=participant.BidiStreamingAnalyzeContentRequest, + request_type, transport: str = "grpc_asyncio" ): client = ParticipantsAsyncClient( credentials=async_anonymous_credentials(), @@ -3565,7 +3591,7 @@ async def test_bidi_streaming_analyze_content_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. @@ -3589,16 +3615,11 @@ async def test_bidi_streaming_analyze_content_async( assert isinstance(message, participant.BidiStreamingAnalyzeContentResponse) -@pytest.mark.asyncio -async def test_bidi_streaming_analyze_content_async_from_dict(): - await test_bidi_streaming_analyze_content_async(request_type=dict) - - @pytest.mark.parametrize( "request_type", [ - participant.SuggestArticlesRequest, - dict, + participant.SuggestArticlesRequest(), + {}, ], ) def test_suggest_articles(request_type, transport: str = "grpc"): @@ -3609,7 +3630,7 @@ def test_suggest_articles(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.suggest_articles), "__call__") as call: @@ -3656,10 +3677,11 @@ def test_suggest_articles_non_empty_request_with_auto_populated_field(): client.suggest_articles(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == participant.SuggestArticlesRequest( + request_msg = participant.SuggestArticlesRequest( parent="parent_value", latest_message="latest_message_value", ) + assert args[0] == request_msg def test_suggest_articles_use_cached_wrapped_rpc(): @@ -3742,9 +3764,14 @@ async def test_suggest_articles_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_suggest_articles_async( - transport: str = "grpc_asyncio", request_type=participant.SuggestArticlesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + participant.SuggestArticlesRequest(), + {}, + ], +) +async def test_suggest_articles_async(request_type, transport: str = "grpc_asyncio"): client = ParticipantsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3752,7 +3779,7 @@ async def test_suggest_articles_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.suggest_articles), "__call__") as call: @@ -3777,11 +3804,6 @@ async def test_suggest_articles_async( assert response.context_size == 1311 -@pytest.mark.asyncio -async def test_suggest_articles_async_from_dict(): - await test_suggest_articles_async(request_type=dict) - - def test_suggest_articles_field_headers(): client = ParticipantsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3928,8 +3950,8 @@ async def test_suggest_articles_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - participant.SuggestFaqAnswersRequest, - dict, + participant.SuggestFaqAnswersRequest(), + {}, ], ) def test_suggest_faq_answers(request_type, transport: str = "grpc"): @@ -3940,7 +3962,7 @@ def test_suggest_faq_answers(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3991,10 +4013,11 @@ def test_suggest_faq_answers_non_empty_request_with_auto_populated_field(): client.suggest_faq_answers(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == participant.SuggestFaqAnswersRequest( + request_msg = participant.SuggestFaqAnswersRequest( parent="parent_value", latest_message="latest_message_value", ) + assert args[0] == request_msg def test_suggest_faq_answers_use_cached_wrapped_rpc(): @@ -4079,9 +4102,14 @@ async def test_suggest_faq_answers_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_suggest_faq_answers_async( - transport: str = "grpc_asyncio", request_type=participant.SuggestFaqAnswersRequest -): +@pytest.mark.parametrize( + "request_type", + [ + participant.SuggestFaqAnswersRequest(), + {}, + ], +) +async def test_suggest_faq_answers_async(request_type, transport: str = "grpc_asyncio"): client = ParticipantsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4089,7 +4117,7 @@ async def test_suggest_faq_answers_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( @@ -4116,11 +4144,6 @@ async def test_suggest_faq_answers_async( assert response.context_size == 1311 -@pytest.mark.asyncio -async def test_suggest_faq_answers_async_from_dict(): - await test_suggest_faq_answers_async(request_type=dict) - - def test_suggest_faq_answers_field_headers(): client = ParticipantsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4275,8 +4298,8 @@ async def test_suggest_faq_answers_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - participant.SuggestSmartRepliesRequest, - dict, + participant.SuggestSmartRepliesRequest(), + {}, ], ) def test_suggest_smart_replies(request_type, transport: str = "grpc"): @@ -4287,7 +4310,7 @@ def test_suggest_smart_replies(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4338,10 +4361,11 @@ def test_suggest_smart_replies_non_empty_request_with_auto_populated_field(): client.suggest_smart_replies(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == participant.SuggestSmartRepliesRequest( + request_msg = participant.SuggestSmartRepliesRequest( parent="parent_value", latest_message="latest_message_value", ) + assert args[0] == request_msg def test_suggest_smart_replies_use_cached_wrapped_rpc(): @@ -4427,8 +4451,15 @@ async def test_suggest_smart_replies_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + participant.SuggestSmartRepliesRequest(), + {}, + ], +) async def test_suggest_smart_replies_async( - transport: str = "grpc_asyncio", request_type=participant.SuggestSmartRepliesRequest + request_type, transport: str = "grpc_asyncio" ): client = ParticipantsAsyncClient( credentials=async_anonymous_credentials(), @@ -4437,7 +4468,7 @@ async def test_suggest_smart_replies_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( @@ -4464,11 +4495,6 @@ async def test_suggest_smart_replies_async( assert response.context_size == 1311 -@pytest.mark.asyncio -async def test_suggest_smart_replies_async_from_dict(): - await test_suggest_smart_replies_async(request_type=dict) - - def test_suggest_smart_replies_field_headers(): client = ParticipantsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4623,8 +4649,8 @@ async def test_suggest_smart_replies_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - participant.SuggestKnowledgeAssistRequest, - dict, + participant.SuggestKnowledgeAssistRequest(), + {}, ], ) def test_suggest_knowledge_assist(request_type, transport: str = "grpc"): @@ -4635,7 +4661,7 @@ def test_suggest_knowledge_assist(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4687,11 +4713,12 @@ def test_suggest_knowledge_assist_non_empty_request_with_auto_populated_field(): client.suggest_knowledge_assist(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == participant.SuggestKnowledgeAssistRequest( + request_msg = participant.SuggestKnowledgeAssistRequest( parent="parent_value", latest_message="latest_message_value", previous_suggested_query="previous_suggested_query_value", ) + assert args[0] == request_msg def test_suggest_knowledge_assist_use_cached_wrapped_rpc(): @@ -4777,9 +4804,15 @@ async def test_suggest_knowledge_assist_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + participant.SuggestKnowledgeAssistRequest(), + {}, + ], +) async def test_suggest_knowledge_assist_async( - transport: str = "grpc_asyncio", - request_type=participant.SuggestKnowledgeAssistRequest, + request_type, transport: str = "grpc_asyncio" ): client = ParticipantsAsyncClient( credentials=async_anonymous_credentials(), @@ -4788,7 +4821,7 @@ async def test_suggest_knowledge_assist_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( @@ -4815,11 +4848,6 @@ async def test_suggest_knowledge_assist_async( assert response.context_size == 1311 -@pytest.mark.asyncio -async def test_suggest_knowledge_assist_async_from_dict(): - await test_suggest_knowledge_assist_async(request_type=dict) - - def test_suggest_knowledge_assist_field_headers(): client = ParticipantsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4888,8 +4916,8 @@ async def test_suggest_knowledge_assist_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - participant.ListSuggestionsRequest, - dict, + participant.ListSuggestionsRequest(), + {}, ], ) def test_list_suggestions(request_type, transport: str = "grpc"): @@ -4900,7 +4928,7 @@ def test_list_suggestions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_suggestions), "__call__") as call: @@ -4946,11 +4974,12 @@ def test_list_suggestions_non_empty_request_with_auto_populated_field(): client.list_suggestions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == participant.ListSuggestionsRequest( + request_msg = participant.ListSuggestionsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_suggestions_use_cached_wrapped_rpc(): @@ -5033,9 +5062,14 @@ async def test_list_suggestions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_suggestions_async( - transport: str = "grpc_asyncio", request_type=participant.ListSuggestionsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + participant.ListSuggestionsRequest(), + {}, + ], +) +async def test_list_suggestions_async(request_type, transport: str = "grpc_asyncio"): client = ParticipantsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5043,7 +5077,7 @@ async def test_list_suggestions_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_suggestions), "__call__") as call: @@ -5066,11 +5100,6 @@ async def test_list_suggestions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_suggestions_async_from_dict(): - await test_list_suggestions_async(request_type=dict) - - def test_list_suggestions_field_headers(): client = ParticipantsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5325,8 +5354,8 @@ async def test_list_suggestions_async_pages(): @pytest.mark.parametrize( "request_type", [ - participant.CompileSuggestionRequest, - dict, + participant.CompileSuggestionRequest(), + {}, ], ) def test_compile_suggestion(request_type, transport: str = "grpc"): @@ -5337,7 +5366,7 @@ def test_compile_suggestion(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5388,10 +5417,11 @@ def test_compile_suggestion_non_empty_request_with_auto_populated_field(): client.compile_suggestion(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == participant.CompileSuggestionRequest( + request_msg = participant.CompileSuggestionRequest( parent="parent_value", latest_message="latest_message_value", ) + assert args[0] == request_msg def test_compile_suggestion_use_cached_wrapped_rpc(): @@ -5476,9 +5506,14 @@ async def test_compile_suggestion_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_compile_suggestion_async( - transport: str = "grpc_asyncio", request_type=participant.CompileSuggestionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + participant.CompileSuggestionRequest(), + {}, + ], +) +async def test_compile_suggestion_async(request_type, transport: str = "grpc_asyncio"): client = ParticipantsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5486,7 +5521,7 @@ async def test_compile_suggestion_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( @@ -5513,11 +5548,6 @@ async def test_compile_suggestion_async( assert response.context_size == 1311 -@pytest.mark.asyncio -async def test_compile_suggestion_async_from_dict(): - await test_compile_suggestion_async(request_type=dict) - - def test_compile_suggestion_field_headers(): client = ParticipantsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7593,7 +7623,6 @@ def test_create_participant_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_participant.CreateParticipantRequest() - assert args[0] == request_msg @@ -7614,7 +7643,6 @@ def test_get_participant_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = participant.GetParticipantRequest() - assert args[0] == request_msg @@ -7637,7 +7665,6 @@ def test_list_participants_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = participant.ListParticipantsRequest() - assert args[0] == request_msg @@ -7660,7 +7687,6 @@ def test_update_participant_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_participant.UpdateParticipantRequest() - assert args[0] == request_msg @@ -7681,7 +7707,6 @@ def test_analyze_content_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_participant.AnalyzeContentRequest() - assert args[0] == request_msg @@ -7702,7 +7727,6 @@ def test_suggest_articles_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = participant.SuggestArticlesRequest() - assert args[0] == request_msg @@ -7725,7 +7749,6 @@ def test_suggest_faq_answers_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = participant.SuggestFaqAnswersRequest() - assert args[0] == request_msg @@ -7748,7 +7771,6 @@ def test_suggest_smart_replies_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = participant.SuggestSmartRepliesRequest() - assert args[0] == request_msg @@ -7771,7 +7793,6 @@ def test_suggest_knowledge_assist_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = participant.SuggestKnowledgeAssistRequest() - assert args[0] == request_msg @@ -7792,7 +7813,6 @@ def test_list_suggestions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = participant.ListSuggestionsRequest() - assert args[0] == request_msg @@ -7815,7 +7835,6 @@ def test_compile_suggestion_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = participant.CompileSuggestionRequest() - assert args[0] == request_msg @@ -7861,7 +7880,6 @@ async def test_create_participant_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_participant.CreateParticipantRequest() - assert args[0] == request_msg @@ -7891,7 +7909,6 @@ async def test_get_participant_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = participant.GetParticipantRequest() - assert args[0] == request_msg @@ -7920,7 +7937,6 @@ async def test_list_participants_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = participant.ListParticipantsRequest() - assert args[0] == request_msg @@ -7952,7 +7968,6 @@ async def test_update_participant_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_participant.UpdateParticipantRequest() - assert args[0] == request_msg @@ -7979,7 +7994,6 @@ async def test_analyze_content_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_participant.AnalyzeContentRequest() - assert args[0] == request_msg @@ -8007,7 +8021,6 @@ async def test_suggest_articles_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = participant.SuggestArticlesRequest() - assert args[0] == request_msg @@ -8037,7 +8050,6 @@ async def test_suggest_faq_answers_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = participant.SuggestFaqAnswersRequest() - assert args[0] == request_msg @@ -8067,7 +8079,6 @@ async def test_suggest_smart_replies_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = participant.SuggestSmartRepliesRequest() - assert args[0] == request_msg @@ -8097,7 +8108,6 @@ async def test_suggest_knowledge_assist_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = participant.SuggestKnowledgeAssistRequest() - assert args[0] == request_msg @@ -8124,7 +8134,6 @@ async def test_list_suggestions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = participant.ListSuggestionsRequest() - assert args[0] == request_msg @@ -8154,7 +8163,6 @@ async def test_compile_suggestion_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = participant.CompileSuggestionRequest() - assert args[0] == request_msg @@ -10232,7 +10240,6 @@ def test_create_participant_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_participant.CreateParticipantRequest() - assert args[0] == request_msg @@ -10252,7 +10259,6 @@ def test_get_participant_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = participant.GetParticipantRequest() - assert args[0] == request_msg @@ -10274,7 +10280,6 @@ def test_list_participants_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = participant.ListParticipantsRequest() - assert args[0] == request_msg @@ -10296,7 +10301,6 @@ def test_update_participant_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_participant.UpdateParticipantRequest() - assert args[0] == request_msg @@ -10316,7 +10320,6 @@ def test_analyze_content_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_participant.AnalyzeContentRequest() - assert args[0] == request_msg @@ -10336,7 +10339,6 @@ def test_suggest_articles_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = participant.SuggestArticlesRequest() - assert args[0] == request_msg @@ -10358,7 +10360,6 @@ def test_suggest_faq_answers_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = participant.SuggestFaqAnswersRequest() - assert args[0] == request_msg @@ -10380,7 +10381,6 @@ def test_suggest_smart_replies_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = participant.SuggestSmartRepliesRequest() - assert args[0] == request_msg @@ -10402,7 +10402,6 @@ def test_suggest_knowledge_assist_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = participant.SuggestKnowledgeAssistRequest() - assert args[0] == request_msg @@ -10422,7 +10421,6 @@ def test_list_suggestions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = participant.ListSuggestionsRequest() - assert args[0] == request_msg @@ -10444,7 +10442,6 @@ def test_compile_suggestion_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = participant.CompileSuggestionRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_phone_numbers.py b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_phone_numbers.py index 7f6e13124d74..71a2e5a418d1 100644 --- a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_phone_numbers.py +++ b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_phone_numbers.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" @@ -1295,8 +1311,8 @@ def test_phone_numbers_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - phone_number.ListPhoneNumbersRequest, - dict, + phone_number.ListPhoneNumbersRequest(), + {}, ], ) def test_list_phone_numbers(request_type, transport: str = "grpc"): @@ -1307,7 +1323,7 @@ def test_list_phone_numbers(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1356,10 +1372,11 @@ def test_list_phone_numbers_non_empty_request_with_auto_populated_field(): client.list_phone_numbers(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == phone_number.ListPhoneNumbersRequest( + request_msg = phone_number.ListPhoneNumbersRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_phone_numbers_use_cached_wrapped_rpc(): @@ -1444,9 +1461,14 @@ async def test_list_phone_numbers_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_phone_numbers_async( - transport: str = "grpc_asyncio", request_type=phone_number.ListPhoneNumbersRequest -): +@pytest.mark.parametrize( + "request_type", + [ + phone_number.ListPhoneNumbersRequest(), + {}, + ], +) +async def test_list_phone_numbers_async(request_type, transport: str = "grpc_asyncio"): client = PhoneNumbersAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1454,7 +1476,7 @@ async def test_list_phone_numbers_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( @@ -1479,11 +1501,6 @@ async def test_list_phone_numbers_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_phone_numbers_async_from_dict(): - await test_list_phone_numbers_async(request_type=dict) - - def test_list_phone_numbers_field_headers(): client = PhoneNumbersClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1836,8 +1853,8 @@ async def test_list_phone_numbers_async_pages(): @pytest.mark.parametrize( "request_type", [ - gcd_phone_number.UpdatePhoneNumberRequest, - dict, + gcd_phone_number.UpdatePhoneNumberRequest(), + {}, ], ) def test_update_phone_number(request_type, transport: str = "grpc"): @@ -1848,7 +1865,7 @@ def test_update_phone_number(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1902,7 +1919,8 @@ def test_update_phone_number_non_empty_request_with_auto_populated_field(): client.update_phone_number(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_phone_number.UpdatePhoneNumberRequest() + request_msg = gcd_phone_number.UpdatePhoneNumberRequest() + assert args[0] == request_msg def test_update_phone_number_use_cached_wrapped_rpc(): @@ -1987,10 +2005,14 @@ async def test_update_phone_number_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_phone_number_async( - transport: str = "grpc_asyncio", - request_type=gcd_phone_number.UpdatePhoneNumberRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + gcd_phone_number.UpdatePhoneNumberRequest(), + {}, + ], +) +async def test_update_phone_number_async(request_type, transport: str = "grpc_asyncio"): client = PhoneNumbersAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1998,7 +2020,7 @@ async def test_update_phone_number_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( @@ -2031,11 +2053,6 @@ async def test_update_phone_number_async( ) -@pytest.mark.asyncio -async def test_update_phone_number_async_from_dict(): - await test_update_phone_number_async(request_type=dict) - - def test_update_phone_number_field_headers(): client = PhoneNumbersClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2200,8 +2217,8 @@ async def test_update_phone_number_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - phone_number.DeletePhoneNumberRequest, - dict, + phone_number.DeletePhoneNumberRequest(), + {}, ], ) def test_delete_phone_number(request_type, transport: str = "grpc"): @@ -2212,7 +2229,7 @@ def test_delete_phone_number(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2266,9 +2283,10 @@ def test_delete_phone_number_non_empty_request_with_auto_populated_field(): client.delete_phone_number(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == phone_number.DeletePhoneNumberRequest( + request_msg = phone_number.DeletePhoneNumberRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_phone_number_use_cached_wrapped_rpc(): @@ -2353,9 +2371,14 @@ async def test_delete_phone_number_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_phone_number_async( - transport: str = "grpc_asyncio", request_type=phone_number.DeletePhoneNumberRequest -): +@pytest.mark.parametrize( + "request_type", + [ + phone_number.DeletePhoneNumberRequest(), + {}, + ], +) +async def test_delete_phone_number_async(request_type, transport: str = "grpc_asyncio"): client = PhoneNumbersAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2363,7 +2386,7 @@ async def test_delete_phone_number_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( @@ -2394,11 +2417,6 @@ async def test_delete_phone_number_async( assert response.lifecycle_state == phone_number.PhoneNumber.LifecycleState.ACTIVE -@pytest.mark.asyncio -async def test_delete_phone_number_async_from_dict(): - await test_delete_phone_number_async(request_type=dict) - - def test_delete_phone_number_field_headers(): client = PhoneNumbersClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2553,8 +2571,8 @@ async def test_delete_phone_number_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - phone_number.UndeletePhoneNumberRequest, - dict, + phone_number.UndeletePhoneNumberRequest(), + {}, ], ) def test_undelete_phone_number(request_type, transport: str = "grpc"): @@ -2565,7 +2583,7 @@ def test_undelete_phone_number(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,9 +2637,10 @@ def test_undelete_phone_number_non_empty_request_with_auto_populated_field(): client.undelete_phone_number(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == phone_number.UndeletePhoneNumberRequest( + request_msg = phone_number.UndeletePhoneNumberRequest( name="name_value", ) + assert args[0] == request_msg def test_undelete_phone_number_use_cached_wrapped_rpc(): @@ -2707,9 +2726,15 @@ async def test_undelete_phone_number_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + phone_number.UndeletePhoneNumberRequest(), + {}, + ], +) async def test_undelete_phone_number_async( - transport: str = "grpc_asyncio", - request_type=phone_number.UndeletePhoneNumberRequest, + request_type, transport: str = "grpc_asyncio" ): client = PhoneNumbersAsyncClient( credentials=async_anonymous_credentials(), @@ -2718,7 +2743,7 @@ async def test_undelete_phone_number_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( @@ -2749,11 +2774,6 @@ async def test_undelete_phone_number_async( assert response.lifecycle_state == phone_number.PhoneNumber.LifecycleState.ACTIVE -@pytest.mark.asyncio -async def test_undelete_phone_number_async_from_dict(): - await test_undelete_phone_number_async(request_type=dict) - - def test_undelete_phone_number_field_headers(): client = PhoneNumbersClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3840,7 +3860,6 @@ def test_list_phone_numbers_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = phone_number.ListPhoneNumbersRequest() - assert args[0] == request_msg @@ -3863,7 +3882,6 @@ def test_update_phone_number_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_phone_number.UpdatePhoneNumberRequest() - assert args[0] == request_msg @@ -3886,7 +3904,6 @@ def test_delete_phone_number_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = phone_number.DeletePhoneNumberRequest() - assert args[0] == request_msg @@ -3909,7 +3926,6 @@ def test_undelete_phone_number_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = phone_number.UndeletePhoneNumberRequest() - assert args[0] == request_msg @@ -3952,7 +3968,6 @@ async def test_list_phone_numbers_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = phone_number.ListPhoneNumbersRequest() - assert args[0] == request_msg @@ -3984,7 +3999,6 @@ async def test_update_phone_number_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_phone_number.UpdatePhoneNumberRequest() - assert args[0] == request_msg @@ -4016,7 +4030,6 @@ async def test_delete_phone_number_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = phone_number.DeletePhoneNumberRequest() - assert args[0] == request_msg @@ -4048,7 +4061,6 @@ async def test_undelete_phone_number_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = phone_number.UndeletePhoneNumberRequest() - assert args[0] == request_msg @@ -5022,7 +5034,6 @@ def test_list_phone_numbers_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = phone_number.ListPhoneNumbersRequest() - assert args[0] == request_msg @@ -5044,7 +5055,6 @@ def test_update_phone_number_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_phone_number.UpdatePhoneNumberRequest() - assert args[0] == request_msg @@ -5066,7 +5076,6 @@ def test_delete_phone_number_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = phone_number.DeletePhoneNumberRequest() - assert args[0] == request_msg @@ -5088,7 +5097,6 @@ def test_undelete_phone_number_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = phone_number.UndeletePhoneNumberRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_session_entity_types.py b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_session_entity_types.py index af63285a50aa..2173a1fa23e0 100644 --- a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_session_entity_types.py +++ b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_session_entity_types.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 @@ -113,6 +114,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" @@ -1361,8 +1377,8 @@ def test_session_entity_types_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - session_entity_type.ListSessionEntityTypesRequest, - dict, + session_entity_type.ListSessionEntityTypesRequest(), + {}, ], ) def test_list_session_entity_types(request_type, transport: str = "grpc"): @@ -1373,7 +1389,7 @@ def test_list_session_entity_types(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1422,10 +1438,11 @@ def test_list_session_entity_types_non_empty_request_with_auto_populated_field() client.list_session_entity_types(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == session_entity_type.ListSessionEntityTypesRequest( + request_msg = session_entity_type.ListSessionEntityTypesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_session_entity_types_use_cached_wrapped_rpc(): @@ -1511,9 +1528,15 @@ async def test_list_session_entity_types_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + session_entity_type.ListSessionEntityTypesRequest(), + {}, + ], +) async def test_list_session_entity_types_async( - transport: str = "grpc_asyncio", - request_type=session_entity_type.ListSessionEntityTypesRequest, + request_type, transport: str = "grpc_asyncio" ): client = SessionEntityTypesAsyncClient( credentials=async_anonymous_credentials(), @@ -1522,7 +1545,7 @@ async def test_list_session_entity_types_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( @@ -1547,11 +1570,6 @@ async def test_list_session_entity_types_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_session_entity_types_async_from_dict(): - await test_list_session_entity_types_async(request_type=dict) - - def test_list_session_entity_types_field_headers(): client = SessionEntityTypesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1910,8 +1928,8 @@ async def test_list_session_entity_types_async_pages(): @pytest.mark.parametrize( "request_type", [ - session_entity_type.GetSessionEntityTypeRequest, - dict, + session_entity_type.GetSessionEntityTypeRequest(), + {}, ], ) def test_get_session_entity_type(request_type, transport: str = "grpc"): @@ -1922,7 +1940,7 @@ def test_get_session_entity_type(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,9 +1993,10 @@ def test_get_session_entity_type_non_empty_request_with_auto_populated_field(): client.get_session_entity_type(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == session_entity_type.GetSessionEntityTypeRequest( + request_msg = session_entity_type.GetSessionEntityTypeRequest( name="name_value", ) + assert args[0] == request_msg def test_get_session_entity_type_use_cached_wrapped_rpc(): @@ -2063,9 +2082,15 @@ async def test_get_session_entity_type_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + session_entity_type.GetSessionEntityTypeRequest(), + {}, + ], +) async def test_get_session_entity_type_async( - transport: str = "grpc_asyncio", - request_type=session_entity_type.GetSessionEntityTypeRequest, + request_type, transport: str = "grpc_asyncio" ): client = SessionEntityTypesAsyncClient( credentials=async_anonymous_credentials(), @@ -2074,7 +2099,7 @@ async def test_get_session_entity_type_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( @@ -2104,11 +2129,6 @@ async def test_get_session_entity_type_async( ) -@pytest.mark.asyncio -async def test_get_session_entity_type_async_from_dict(): - await test_get_session_entity_type_async(request_type=dict) - - def test_get_session_entity_type_field_headers(): client = SessionEntityTypesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2263,8 +2283,8 @@ async def test_get_session_entity_type_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcd_session_entity_type.CreateSessionEntityTypeRequest, - dict, + gcd_session_entity_type.CreateSessionEntityTypeRequest(), + {}, ], ) def test_create_session_entity_type(request_type, transport: str = "grpc"): @@ -2275,7 +2295,7 @@ def test_create_session_entity_type(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,9 +2348,10 @@ def test_create_session_entity_type_non_empty_request_with_auto_populated_field( client.create_session_entity_type(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_session_entity_type.CreateSessionEntityTypeRequest( + request_msg = gcd_session_entity_type.CreateSessionEntityTypeRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_session_entity_type_use_cached_wrapped_rpc(): @@ -2416,9 +2437,15 @@ async def test_create_session_entity_type_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcd_session_entity_type.CreateSessionEntityTypeRequest(), + {}, + ], +) async def test_create_session_entity_type_async( - transport: str = "grpc_asyncio", - request_type=gcd_session_entity_type.CreateSessionEntityTypeRequest, + request_type, transport: str = "grpc_asyncio" ): client = SessionEntityTypesAsyncClient( credentials=async_anonymous_credentials(), @@ -2427,7 +2454,7 @@ async def test_create_session_entity_type_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( @@ -2457,11 +2484,6 @@ async def test_create_session_entity_type_async( ) -@pytest.mark.asyncio -async def test_create_session_entity_type_async_from_dict(): - await test_create_session_entity_type_async(request_type=dict) - - def test_create_session_entity_type_field_headers(): client = SessionEntityTypesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2634,8 +2656,8 @@ async def test_create_session_entity_type_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcd_session_entity_type.UpdateSessionEntityTypeRequest, - dict, + gcd_session_entity_type.UpdateSessionEntityTypeRequest(), + {}, ], ) def test_update_session_entity_type(request_type, transport: str = "grpc"): @@ -2646,7 +2668,7 @@ def test_update_session_entity_type(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2697,7 +2719,8 @@ def test_update_session_entity_type_non_empty_request_with_auto_populated_field( client.update_session_entity_type(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_session_entity_type.UpdateSessionEntityTypeRequest() + request_msg = gcd_session_entity_type.UpdateSessionEntityTypeRequest() + assert args[0] == request_msg def test_update_session_entity_type_use_cached_wrapped_rpc(): @@ -2783,9 +2806,15 @@ async def test_update_session_entity_type_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcd_session_entity_type.UpdateSessionEntityTypeRequest(), + {}, + ], +) async def test_update_session_entity_type_async( - transport: str = "grpc_asyncio", - request_type=gcd_session_entity_type.UpdateSessionEntityTypeRequest, + request_type, transport: str = "grpc_asyncio" ): client = SessionEntityTypesAsyncClient( credentials=async_anonymous_credentials(), @@ -2794,7 +2823,7 @@ async def test_update_session_entity_type_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( @@ -2824,11 +2853,6 @@ async def test_update_session_entity_type_async( ) -@pytest.mark.asyncio -async def test_update_session_entity_type_async_from_dict(): - await test_update_session_entity_type_async(request_type=dict) - - def test_update_session_entity_type_field_headers(): client = SessionEntityTypesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3001,8 +3025,8 @@ async def test_update_session_entity_type_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - session_entity_type.DeleteSessionEntityTypeRequest, - dict, + session_entity_type.DeleteSessionEntityTypeRequest(), + {}, ], ) def test_delete_session_entity_type(request_type, transport: str = "grpc"): @@ -3013,7 +3037,7 @@ def test_delete_session_entity_type(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3058,9 +3082,10 @@ def test_delete_session_entity_type_non_empty_request_with_auto_populated_field( client.delete_session_entity_type(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == session_entity_type.DeleteSessionEntityTypeRequest( + request_msg = session_entity_type.DeleteSessionEntityTypeRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_session_entity_type_use_cached_wrapped_rpc(): @@ -3146,9 +3171,15 @@ async def test_delete_session_entity_type_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + session_entity_type.DeleteSessionEntityTypeRequest(), + {}, + ], +) async def test_delete_session_entity_type_async( - transport: str = "grpc_asyncio", - request_type=session_entity_type.DeleteSessionEntityTypeRequest, + request_type, transport: str = "grpc_asyncio" ): client = SessionEntityTypesAsyncClient( credentials=async_anonymous_credentials(), @@ -3157,7 +3188,7 @@ async def test_delete_session_entity_type_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( @@ -3177,11 +3208,6 @@ async def test_delete_session_entity_type_async( assert response is None -@pytest.mark.asyncio -async def test_delete_session_entity_type_async_from_dict(): - await test_delete_session_entity_type_async(request_type=dict) - - def test_delete_session_entity_type_field_headers(): client = SessionEntityTypesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4476,7 +4502,6 @@ def test_list_session_entity_types_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session_entity_type.ListSessionEntityTypesRequest() - assert args[0] == request_msg @@ -4499,7 +4524,6 @@ def test_get_session_entity_type_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session_entity_type.GetSessionEntityTypeRequest() - assert args[0] == request_msg @@ -4522,7 +4546,6 @@ def test_create_session_entity_type_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_session_entity_type.CreateSessionEntityTypeRequest() - assert args[0] == request_msg @@ -4545,7 +4568,6 @@ def test_update_session_entity_type_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_session_entity_type.UpdateSessionEntityTypeRequest() - assert args[0] == request_msg @@ -4568,7 +4590,6 @@ def test_delete_session_entity_type_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session_entity_type.DeleteSessionEntityTypeRequest() - assert args[0] == request_msg @@ -4611,7 +4632,6 @@ async def test_list_session_entity_types_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session_entity_type.ListSessionEntityTypesRequest() - assert args[0] == request_msg @@ -4641,7 +4661,6 @@ async def test_get_session_entity_type_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session_entity_type.GetSessionEntityTypeRequest() - assert args[0] == request_msg @@ -4671,7 +4690,6 @@ async def test_create_session_entity_type_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_session_entity_type.CreateSessionEntityTypeRequest() - assert args[0] == request_msg @@ -4701,7 +4719,6 @@ async def test_update_session_entity_type_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_session_entity_type.UpdateSessionEntityTypeRequest() - assert args[0] == request_msg @@ -4726,7 +4743,6 @@ async def test_delete_session_entity_type_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session_entity_type.DeleteSessionEntityTypeRequest() - assert args[0] == request_msg @@ -5917,7 +5933,6 @@ def test_list_session_entity_types_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session_entity_type.ListSessionEntityTypesRequest() - assert args[0] == request_msg @@ -5939,7 +5954,6 @@ def test_get_session_entity_type_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session_entity_type.GetSessionEntityTypeRequest() - assert args[0] == request_msg @@ -5961,7 +5975,6 @@ def test_create_session_entity_type_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_session_entity_type.CreateSessionEntityTypeRequest() - assert args[0] == request_msg @@ -5983,7 +5996,6 @@ def test_update_session_entity_type_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_session_entity_type.UpdateSessionEntityTypeRequest() - assert args[0] == request_msg @@ -6005,7 +6017,6 @@ def test_delete_session_entity_type_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session_entity_type.DeleteSessionEntityTypeRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_sessions.py b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_sessions.py index ea8cb16aa338..fba194a23e13 100644 --- a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_sessions.py +++ b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_sessions.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 @@ -121,6 +122,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" @@ -1268,8 +1284,8 @@ def test_sessions_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - gcd_session.DetectIntentRequest, - dict, + gcd_session.DetectIntentRequest(), + {}, ], ) def test_detect_intent(request_type, transport: str = "grpc"): @@ -1280,7 +1296,7 @@ def test_detect_intent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.detect_intent), "__call__") as call: @@ -1326,9 +1342,10 @@ def test_detect_intent_non_empty_request_with_auto_populated_field(): client.detect_intent(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_session.DetectIntentRequest( + request_msg = gcd_session.DetectIntentRequest( session="session_value", ) + assert args[0] == request_msg def test_detect_intent_use_cached_wrapped_rpc(): @@ -1409,9 +1426,14 @@ async def test_detect_intent_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_detect_intent_async( - transport: str = "grpc_asyncio", request_type=gcd_session.DetectIntentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcd_session.DetectIntentRequest(), + {}, + ], +) +async def test_detect_intent_async(request_type, transport: str = "grpc_asyncio"): client = SessionsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1419,7 +1441,7 @@ async def test_detect_intent_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.detect_intent), "__call__") as call: @@ -1444,11 +1466,6 @@ async def test_detect_intent_async( assert response.output_audio == b"output_audio_blob" -@pytest.mark.asyncio -async def test_detect_intent_async_from_dict(): - await test_detect_intent_async(request_type=dict) - - def test_detect_intent_field_headers(): client = SessionsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1629,8 +1646,8 @@ async def test_detect_intent_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - session.StreamingDetectIntentRequest, - dict, + session.StreamingDetectIntentRequest(), + {}, ], ) def test_streaming_detect_intent(request_type, transport: str = "grpc"): @@ -1641,7 +1658,7 @@ def test_streaming_detect_intent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as 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. @@ -1745,8 +1762,15 @@ async def test_streaming_detect_intent_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + session.StreamingDetectIntentRequest(), + {}, + ], +) async def test_streaming_detect_intent_async( - transport: str = "grpc_asyncio", request_type=session.StreamingDetectIntentRequest + request_type, transport: str = "grpc_asyncio" ): client = SessionsAsyncClient( credentials=async_anonymous_credentials(), @@ -1755,7 +1779,7 @@ async def test_streaming_detect_intent_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. @@ -1779,11 +1803,6 @@ async def test_streaming_detect_intent_async( assert isinstance(message, session.StreamingDetectIntentResponse) -@pytest.mark.asyncio -async def test_streaming_detect_intent_async_from_dict(): - await test_streaming_detect_intent_async(request_type=dict) - - def test_detect_intent_rest_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, # instead of constructing them on each call @@ -2128,7 +2147,6 @@ def test_detect_intent_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_session.DetectIntentRequest() - assert args[0] == request_msg @@ -2170,7 +2188,6 @@ async def test_detect_intent_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_session.DetectIntentRequest() - assert args[0] == request_msg @@ -2655,7 +2672,6 @@ def test_detect_intent_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_session.DetectIntentRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_sip_trunks.py b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_sip_trunks.py index 4f1fc9612a21..48de0b5b0da7 100644 --- a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_sip_trunks.py +++ b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_sip_trunks.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" @@ -1274,8 +1290,8 @@ def test_sip_trunks_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - gcd_sip_trunk.CreateSipTrunkRequest, - dict, + gcd_sip_trunk.CreateSipTrunkRequest(), + {}, ], ) def test_create_sip_trunk(request_type, transport: str = "grpc"): @@ -1286,7 +1302,7 @@ def test_create_sip_trunk(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_sip_trunk), "__call__") as call: @@ -1334,9 +1350,10 @@ def test_create_sip_trunk_non_empty_request_with_auto_populated_field(): client.create_sip_trunk(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_sip_trunk.CreateSipTrunkRequest( + request_msg = gcd_sip_trunk.CreateSipTrunkRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_sip_trunk_use_cached_wrapped_rpc(): @@ -1419,9 +1436,14 @@ async def test_create_sip_trunk_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_sip_trunk_async( - transport: str = "grpc_asyncio", request_type=gcd_sip_trunk.CreateSipTrunkRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcd_sip_trunk.CreateSipTrunkRequest(), + {}, + ], +) +async def test_create_sip_trunk_async(request_type, transport: str = "grpc_asyncio"): client = SipTrunksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1429,7 +1451,7 @@ async def test_create_sip_trunk_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_sip_trunk), "__call__") as call: @@ -1456,11 +1478,6 @@ async def test_create_sip_trunk_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_create_sip_trunk_async_from_dict(): - await test_create_sip_trunk_async(request_type=dict) - - def test_create_sip_trunk_field_headers(): client = SipTrunksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1617,8 +1634,8 @@ async def test_create_sip_trunk_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - sip_trunk.DeleteSipTrunkRequest, - dict, + sip_trunk.DeleteSipTrunkRequest(), + {}, ], ) def test_delete_sip_trunk(request_type, transport: str = "grpc"): @@ -1629,7 +1646,7 @@ def test_delete_sip_trunk(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_sip_trunk), "__call__") as call: @@ -1670,9 +1687,10 @@ def test_delete_sip_trunk_non_empty_request_with_auto_populated_field(): client.delete_sip_trunk(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == sip_trunk.DeleteSipTrunkRequest( + request_msg = sip_trunk.DeleteSipTrunkRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_sip_trunk_use_cached_wrapped_rpc(): @@ -1755,9 +1773,14 @@ async def test_delete_sip_trunk_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_sip_trunk_async( - transport: str = "grpc_asyncio", request_type=sip_trunk.DeleteSipTrunkRequest -): +@pytest.mark.parametrize( + "request_type", + [ + sip_trunk.DeleteSipTrunkRequest(), + {}, + ], +) +async def test_delete_sip_trunk_async(request_type, transport: str = "grpc_asyncio"): client = SipTrunksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1765,7 +1788,7 @@ async def test_delete_sip_trunk_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_sip_trunk), "__call__") as call: @@ -1783,11 +1806,6 @@ async def test_delete_sip_trunk_async( assert response is None -@pytest.mark.asyncio -async def test_delete_sip_trunk_async_from_dict(): - await test_delete_sip_trunk_async(request_type=dict) - - def test_delete_sip_trunk_field_headers(): client = SipTrunksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1930,8 +1948,8 @@ async def test_delete_sip_trunk_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - sip_trunk.ListSipTrunksRequest, - dict, + sip_trunk.ListSipTrunksRequest(), + {}, ], ) def test_list_sip_trunks(request_type, transport: str = "grpc"): @@ -1942,7 +1960,7 @@ def test_list_sip_trunks(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_sip_trunks), "__call__") as call: @@ -1987,10 +2005,11 @@ def test_list_sip_trunks_non_empty_request_with_auto_populated_field(): client.list_sip_trunks(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == sip_trunk.ListSipTrunksRequest( + request_msg = sip_trunk.ListSipTrunksRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_sip_trunks_use_cached_wrapped_rpc(): @@ -2071,9 +2090,14 @@ async def test_list_sip_trunks_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_sip_trunks_async( - transport: str = "grpc_asyncio", request_type=sip_trunk.ListSipTrunksRequest -): +@pytest.mark.parametrize( + "request_type", + [ + sip_trunk.ListSipTrunksRequest(), + {}, + ], +) +async def test_list_sip_trunks_async(request_type, transport: str = "grpc_asyncio"): client = SipTrunksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2081,7 +2105,7 @@ async def test_list_sip_trunks_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_sip_trunks), "__call__") as call: @@ -2104,11 +2128,6 @@ async def test_list_sip_trunks_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_sip_trunks_async_from_dict(): - await test_list_sip_trunks_async(request_type=dict) - - def test_list_sip_trunks_field_headers(): client = SipTrunksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2445,8 +2464,8 @@ async def test_list_sip_trunks_async_pages(): @pytest.mark.parametrize( "request_type", [ - sip_trunk.GetSipTrunkRequest, - dict, + sip_trunk.GetSipTrunkRequest(), + {}, ], ) def test_get_sip_trunk(request_type, transport: str = "grpc"): @@ -2457,7 +2476,7 @@ def test_get_sip_trunk(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_sip_trunk), "__call__") as call: @@ -2505,9 +2524,10 @@ def test_get_sip_trunk_non_empty_request_with_auto_populated_field(): client.get_sip_trunk(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == sip_trunk.GetSipTrunkRequest( + request_msg = sip_trunk.GetSipTrunkRequest( name="name_value", ) + assert args[0] == request_msg def test_get_sip_trunk_use_cached_wrapped_rpc(): @@ -2588,9 +2608,14 @@ async def test_get_sip_trunk_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_sip_trunk_async( - transport: str = "grpc_asyncio", request_type=sip_trunk.GetSipTrunkRequest -): +@pytest.mark.parametrize( + "request_type", + [ + sip_trunk.GetSipTrunkRequest(), + {}, + ], +) +async def test_get_sip_trunk_async(request_type, transport: str = "grpc_asyncio"): client = SipTrunksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2598,7 +2623,7 @@ async def test_get_sip_trunk_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_sip_trunk), "__call__") as call: @@ -2625,11 +2650,6 @@ async def test_get_sip_trunk_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_get_sip_trunk_async_from_dict(): - await test_get_sip_trunk_async(request_type=dict) - - def test_get_sip_trunk_field_headers(): client = SipTrunksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2772,8 +2792,8 @@ async def test_get_sip_trunk_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcd_sip_trunk.UpdateSipTrunkRequest, - dict, + gcd_sip_trunk.UpdateSipTrunkRequest(), + {}, ], ) def test_update_sip_trunk(request_type, transport: str = "grpc"): @@ -2784,7 +2804,7 @@ def test_update_sip_trunk(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_sip_trunk), "__call__") as call: @@ -2830,7 +2850,8 @@ def test_update_sip_trunk_non_empty_request_with_auto_populated_field(): client.update_sip_trunk(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_sip_trunk.UpdateSipTrunkRequest() + request_msg = gcd_sip_trunk.UpdateSipTrunkRequest() + assert args[0] == request_msg def test_update_sip_trunk_use_cached_wrapped_rpc(): @@ -2913,9 +2934,14 @@ async def test_update_sip_trunk_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_sip_trunk_async( - transport: str = "grpc_asyncio", request_type=gcd_sip_trunk.UpdateSipTrunkRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcd_sip_trunk.UpdateSipTrunkRequest(), + {}, + ], +) +async def test_update_sip_trunk_async(request_type, transport: str = "grpc_asyncio"): client = SipTrunksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2923,7 +2949,7 @@ async def test_update_sip_trunk_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_sip_trunk), "__call__") as call: @@ -2950,11 +2976,6 @@ async def test_update_sip_trunk_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_update_sip_trunk_async_from_dict(): - await test_update_sip_trunk_async(request_type=dict) - - def test_update_sip_trunk_field_headers(): client = SipTrunksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4215,7 +4236,6 @@ def test_create_sip_trunk_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_sip_trunk.CreateSipTrunkRequest() - assert args[0] == request_msg @@ -4236,7 +4256,6 @@ def test_delete_sip_trunk_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sip_trunk.DeleteSipTrunkRequest() - assert args[0] == request_msg @@ -4257,7 +4276,6 @@ def test_list_sip_trunks_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sip_trunk.ListSipTrunksRequest() - assert args[0] == request_msg @@ -4278,7 +4296,6 @@ def test_get_sip_trunk_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sip_trunk.GetSipTrunkRequest() - assert args[0] == request_msg @@ -4299,7 +4316,6 @@ def test_update_sip_trunk_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_sip_trunk.UpdateSipTrunkRequest() - assert args[0] == request_msg @@ -4342,7 +4358,6 @@ async def test_create_sip_trunk_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_sip_trunk.CreateSipTrunkRequest() - assert args[0] == request_msg @@ -4365,7 +4380,6 @@ async def test_delete_sip_trunk_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sip_trunk.DeleteSipTrunkRequest() - assert args[0] == request_msg @@ -4392,7 +4406,6 @@ async def test_list_sip_trunks_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sip_trunk.ListSipTrunksRequest() - assert args[0] == request_msg @@ -4421,7 +4434,6 @@ async def test_get_sip_trunk_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sip_trunk.GetSipTrunkRequest() - assert args[0] == request_msg @@ -4450,7 +4462,6 @@ async def test_update_sip_trunk_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_sip_trunk.UpdateSipTrunkRequest() - assert args[0] == request_msg @@ -5589,7 +5600,6 @@ def test_create_sip_trunk_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_sip_trunk.CreateSipTrunkRequest() - assert args[0] == request_msg @@ -5609,7 +5619,6 @@ def test_delete_sip_trunk_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sip_trunk.DeleteSipTrunkRequest() - assert args[0] == request_msg @@ -5629,7 +5638,6 @@ def test_list_sip_trunks_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sip_trunk.ListSipTrunksRequest() - assert args[0] == request_msg @@ -5649,7 +5657,6 @@ def test_get_sip_trunk_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sip_trunk.GetSipTrunkRequest() - assert args[0] == request_msg @@ -5669,7 +5676,6 @@ def test_update_sip_trunk_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_sip_trunk.UpdateSipTrunkRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_tools.py b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_tools.py index bdad5074c41d..604ebcca23d1 100644 --- a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_tools.py +++ b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_tools.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 @@ -113,6 +114,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" @@ -1244,8 +1260,8 @@ def test_tools_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - gcd_tool.CreateToolRequest, - dict, + gcd_tool.CreateToolRequest(), + {}, ], ) def test_create_tool(request_type, transport: str = "grpc"): @@ -1256,7 +1272,7 @@ def test_create_tool(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tool), "__call__") as call: @@ -1311,10 +1327,11 @@ def test_create_tool_non_empty_request_with_auto_populated_field(): client.create_tool(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_tool.CreateToolRequest( + request_msg = gcd_tool.CreateToolRequest( parent="parent_value", tool_id="tool_id_value", ) + assert args[0] == request_msg def test_create_tool_use_cached_wrapped_rpc(): @@ -1395,9 +1412,14 @@ async def test_create_tool_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_tool_async( - transport: str = "grpc_asyncio", request_type=gcd_tool.CreateToolRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcd_tool.CreateToolRequest(), + {}, + ], +) +async def test_create_tool_async(request_type, transport: str = "grpc_asyncio"): client = ToolsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1405,7 +1427,7 @@ async def test_create_tool_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_tool), "__call__") as call: @@ -1438,11 +1460,6 @@ async def test_create_tool_async( assert response.satisfies_pzi is True -@pytest.mark.asyncio -async def test_create_tool_async_from_dict(): - await test_create_tool_async(request_type=dict) - - def test_create_tool_field_headers(): client = ToolsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1605,8 +1622,8 @@ async def test_create_tool_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - tool.GetToolRequest, - dict, + tool.GetToolRequest(), + {}, ], ) def test_get_tool(request_type, transport: str = "grpc"): @@ -1617,7 +1634,7 @@ def test_get_tool(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tool), "__call__") as call: @@ -1671,9 +1688,10 @@ def test_get_tool_non_empty_request_with_auto_populated_field(): client.get_tool(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tool.GetToolRequest( + request_msg = tool.GetToolRequest( name="name_value", ) + assert args[0] == request_msg def test_get_tool_use_cached_wrapped_rpc(): @@ -1752,9 +1770,14 @@ async def test_get_tool_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn @pytest.mark.asyncio -async def test_get_tool_async( - transport: str = "grpc_asyncio", request_type=tool.GetToolRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tool.GetToolRequest(), + {}, + ], +) +async def test_get_tool_async(request_type, transport: str = "grpc_asyncio"): client = ToolsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1762,7 +1785,7 @@ async def test_get_tool_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_tool), "__call__") as call: @@ -1795,11 +1818,6 @@ async def test_get_tool_async( assert response.satisfies_pzi is True -@pytest.mark.asyncio -async def test_get_tool_async_from_dict(): - await test_get_tool_async(request_type=dict) - - def test_get_tool_field_headers(): client = ToolsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1942,8 +1960,8 @@ async def test_get_tool_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - tool.ListToolsRequest, - dict, + tool.ListToolsRequest(), + {}, ], ) def test_list_tools(request_type, transport: str = "grpc"): @@ -1954,7 +1972,7 @@ def test_list_tools(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tools), "__call__") as call: @@ -1999,10 +2017,11 @@ def test_list_tools_non_empty_request_with_auto_populated_field(): client.list_tools(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tool.ListToolsRequest( + request_msg = tool.ListToolsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_tools_use_cached_wrapped_rpc(): @@ -2081,9 +2100,14 @@ async def test_list_tools_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_list_tools_async( - transport: str = "grpc_asyncio", request_type=tool.ListToolsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tool.ListToolsRequest(), + {}, + ], +) +async def test_list_tools_async(request_type, transport: str = "grpc_asyncio"): client = ToolsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2091,7 +2115,7 @@ async def test_list_tools_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_tools), "__call__") as call: @@ -2114,11 +2138,6 @@ async def test_list_tools_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_tools_async_from_dict(): - await test_list_tools_async(request_type=dict) - - def test_list_tools_field_headers(): client = ToolsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2455,8 +2474,8 @@ async def test_list_tools_async_pages(): @pytest.mark.parametrize( "request_type", [ - tool.DeleteToolRequest, - dict, + tool.DeleteToolRequest(), + {}, ], ) def test_delete_tool(request_type, transport: str = "grpc"): @@ -2467,7 +2486,7 @@ def test_delete_tool(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tool), "__call__") as call: @@ -2508,9 +2527,10 @@ def test_delete_tool_non_empty_request_with_auto_populated_field(): client.delete_tool(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tool.DeleteToolRequest( + request_msg = tool.DeleteToolRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_tool_use_cached_wrapped_rpc(): @@ -2591,9 +2611,14 @@ async def test_delete_tool_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_tool_async( - transport: str = "grpc_asyncio", request_type=tool.DeleteToolRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tool.DeleteToolRequest(), + {}, + ], +) +async def test_delete_tool_async(request_type, transport: str = "grpc_asyncio"): client = ToolsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2601,7 +2626,7 @@ async def test_delete_tool_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_tool), "__call__") as call: @@ -2619,11 +2644,6 @@ async def test_delete_tool_async( assert response is None -@pytest.mark.asyncio -async def test_delete_tool_async_from_dict(): - await test_delete_tool_async(request_type=dict) - - def test_delete_tool_field_headers(): client = ToolsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2766,8 +2786,8 @@ async def test_delete_tool_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcd_tool.UpdateToolRequest, - dict, + gcd_tool.UpdateToolRequest(), + {}, ], ) def test_update_tool(request_type, transport: str = "grpc"): @@ -2778,7 +2798,7 @@ def test_update_tool(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tool), "__call__") as call: @@ -2830,7 +2850,8 @@ def test_update_tool_non_empty_request_with_auto_populated_field(): client.update_tool(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_tool.UpdateToolRequest() + request_msg = gcd_tool.UpdateToolRequest() + assert args[0] == request_msg def test_update_tool_use_cached_wrapped_rpc(): @@ -2911,9 +2932,14 @@ async def test_update_tool_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_tool_async( - transport: str = "grpc_asyncio", request_type=gcd_tool.UpdateToolRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcd_tool.UpdateToolRequest(), + {}, + ], +) +async def test_update_tool_async(request_type, transport: str = "grpc_asyncio"): client = ToolsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2921,7 +2947,7 @@ async def test_update_tool_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_tool), "__call__") as call: @@ -2954,11 +2980,6 @@ async def test_update_tool_async( assert response.satisfies_pzi is True -@pytest.mark.asyncio -async def test_update_tool_async_from_dict(): - await test_update_tool_async(request_type=dict) - - def test_update_tool_field_headers(): client = ToolsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4195,7 +4216,6 @@ def test_create_tool_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_tool.CreateToolRequest() - assert args[0] == request_msg @@ -4216,7 +4236,6 @@ def test_get_tool_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool.GetToolRequest() - assert args[0] == request_msg @@ -4237,7 +4256,6 @@ def test_list_tools_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool.ListToolsRequest() - assert args[0] == request_msg @@ -4258,7 +4276,6 @@ def test_delete_tool_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool.DeleteToolRequest() - assert args[0] == request_msg @@ -4279,7 +4296,6 @@ def test_update_tool_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_tool.UpdateToolRequest() - assert args[0] == request_msg @@ -4325,7 +4341,6 @@ async def test_create_tool_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_tool.CreateToolRequest() - assert args[0] == request_msg @@ -4357,7 +4372,6 @@ async def test_get_tool_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool.GetToolRequest() - assert args[0] == request_msg @@ -4384,7 +4398,6 @@ async def test_list_tools_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool.ListToolsRequest() - assert args[0] == request_msg @@ -4407,7 +4420,6 @@ async def test_delete_tool_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool.DeleteToolRequest() - assert args[0] == request_msg @@ -4439,7 +4451,6 @@ async def test_update_tool_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_tool.UpdateToolRequest() - assert args[0] == request_msg @@ -5654,7 +5665,6 @@ def test_create_tool_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_tool.CreateToolRequest() - assert args[0] == request_msg @@ -5674,7 +5684,6 @@ def test_get_tool_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool.GetToolRequest() - assert args[0] == request_msg @@ -5694,7 +5703,6 @@ def test_list_tools_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool.ListToolsRequest() - assert args[0] == request_msg @@ -5714,7 +5722,6 @@ def test_delete_tool_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tool.DeleteToolRequest() - assert args[0] == request_msg @@ -5734,7 +5741,6 @@ def test_update_tool_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_tool.UpdateToolRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_versions.py b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_versions.py index fb07e6815889..231199e77426 100644 --- a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_versions.py +++ b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_versions.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" @@ -1259,8 +1275,8 @@ def test_versions_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - version.ListVersionsRequest, - dict, + version.ListVersionsRequest(), + {}, ], ) def test_list_versions(request_type, transport: str = "grpc"): @@ -1271,7 +1287,7 @@ def test_list_versions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_versions), "__call__") as call: @@ -1316,10 +1332,11 @@ def test_list_versions_non_empty_request_with_auto_populated_field(): client.list_versions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == version.ListVersionsRequest( + request_msg = version.ListVersionsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_versions_use_cached_wrapped_rpc(): @@ -1400,9 +1417,14 @@ async def test_list_versions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_versions_async( - transport: str = "grpc_asyncio", request_type=version.ListVersionsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + version.ListVersionsRequest(), + {}, + ], +) +async def test_list_versions_async(request_type, transport: str = "grpc_asyncio"): client = VersionsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1410,7 +1432,7 @@ async def test_list_versions_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_versions), "__call__") as call: @@ -1433,11 +1455,6 @@ async def test_list_versions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_versions_async_from_dict(): - await test_list_versions_async(request_type=dict) - - def test_list_versions_field_headers(): client = VersionsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1774,8 +1791,8 @@ async def test_list_versions_async_pages(): @pytest.mark.parametrize( "request_type", [ - version.GetVersionRequest, - dict, + version.GetVersionRequest(), + {}, ], ) def test_get_version(request_type, transport: str = "grpc"): @@ -1786,7 +1803,7 @@ def test_get_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_version), "__call__") as call: @@ -1836,9 +1853,10 @@ def test_get_version_non_empty_request_with_auto_populated_field(): client.get_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == version.GetVersionRequest( + request_msg = version.GetVersionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_version_use_cached_wrapped_rpc(): @@ -1919,9 +1937,14 @@ async def test_get_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_version_async( - transport: str = "grpc_asyncio", request_type=version.GetVersionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + version.GetVersionRequest(), + {}, + ], +) +async def test_get_version_async(request_type, transport: str = "grpc_asyncio"): client = VersionsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1929,7 +1952,7 @@ async def test_get_version_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_version), "__call__") as call: @@ -1958,11 +1981,6 @@ async def test_get_version_async( assert response.status == version.Version.VersionStatus.IN_PROGRESS -@pytest.mark.asyncio -async def test_get_version_async_from_dict(): - await test_get_version_async(request_type=dict) - - def test_get_version_field_headers(): client = VersionsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2105,8 +2123,8 @@ async def test_get_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcd_version.CreateVersionRequest, - dict, + gcd_version.CreateVersionRequest(), + {}, ], ) def test_create_version(request_type, transport: str = "grpc"): @@ -2117,7 +2135,7 @@ def test_create_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_version), "__call__") as call: @@ -2167,9 +2185,10 @@ def test_create_version_non_empty_request_with_auto_populated_field(): client.create_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_version.CreateVersionRequest( + request_msg = gcd_version.CreateVersionRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_version_use_cached_wrapped_rpc(): @@ -2250,9 +2269,14 @@ async def test_create_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_version_async( - transport: str = "grpc_asyncio", request_type=gcd_version.CreateVersionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcd_version.CreateVersionRequest(), + {}, + ], +) +async def test_create_version_async(request_type, transport: str = "grpc_asyncio"): client = VersionsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2260,7 +2284,7 @@ async def test_create_version_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_version), "__call__") as call: @@ -2289,11 +2313,6 @@ async def test_create_version_async( assert response.status == gcd_version.Version.VersionStatus.IN_PROGRESS -@pytest.mark.asyncio -async def test_create_version_async_from_dict(): - await test_create_version_async(request_type=dict) - - def test_create_version_field_headers(): client = VersionsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2446,8 +2465,8 @@ async def test_create_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcd_version.UpdateVersionRequest, - dict, + gcd_version.UpdateVersionRequest(), + {}, ], ) def test_update_version(request_type, transport: str = "grpc"): @@ -2458,7 +2477,7 @@ def test_update_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_version), "__call__") as call: @@ -2506,7 +2525,8 @@ def test_update_version_non_empty_request_with_auto_populated_field(): client.update_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcd_version.UpdateVersionRequest() + request_msg = gcd_version.UpdateVersionRequest() + assert args[0] == request_msg def test_update_version_use_cached_wrapped_rpc(): @@ -2587,9 +2607,14 @@ async def test_update_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_version_async( - transport: str = "grpc_asyncio", request_type=gcd_version.UpdateVersionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcd_version.UpdateVersionRequest(), + {}, + ], +) +async def test_update_version_async(request_type, transport: str = "grpc_asyncio"): client = VersionsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2597,7 +2622,7 @@ async def test_update_version_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_version), "__call__") as call: @@ -2626,11 +2651,6 @@ async def test_update_version_async( assert response.status == gcd_version.Version.VersionStatus.IN_PROGRESS -@pytest.mark.asyncio -async def test_update_version_async_from_dict(): - await test_update_version_async(request_type=dict) - - def test_update_version_field_headers(): client = VersionsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2783,8 +2803,8 @@ async def test_update_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - version.DeleteVersionRequest, - dict, + version.DeleteVersionRequest(), + {}, ], ) def test_delete_version(request_type, transport: str = "grpc"): @@ -2795,7 +2815,7 @@ def test_delete_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_version), "__call__") as call: @@ -2836,9 +2856,10 @@ def test_delete_version_non_empty_request_with_auto_populated_field(): client.delete_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == version.DeleteVersionRequest( + request_msg = version.DeleteVersionRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_version_use_cached_wrapped_rpc(): @@ -2919,9 +2940,14 @@ async def test_delete_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_version_async( - transport: str = "grpc_asyncio", request_type=version.DeleteVersionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + version.DeleteVersionRequest(), + {}, + ], +) +async def test_delete_version_async(request_type, transport: str = "grpc_asyncio"): client = VersionsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2929,7 +2955,7 @@ async def test_delete_version_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_version), "__call__") as call: @@ -2947,11 +2973,6 @@ async def test_delete_version_async( assert response is None -@pytest.mark.asyncio -async def test_delete_version_async_from_dict(): - await test_delete_version_async(request_type=dict) - - def test_delete_version_field_headers(): client = VersionsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4186,7 +4207,6 @@ def test_list_versions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = version.ListVersionsRequest() - assert args[0] == request_msg @@ -4207,7 +4227,6 @@ def test_get_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = version.GetVersionRequest() - assert args[0] == request_msg @@ -4228,7 +4247,6 @@ def test_create_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_version.CreateVersionRequest() - assert args[0] == request_msg @@ -4249,7 +4267,6 @@ def test_update_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_version.UpdateVersionRequest() - assert args[0] == request_msg @@ -4270,7 +4287,6 @@ def test_delete_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = version.DeleteVersionRequest() - assert args[0] == request_msg @@ -4311,7 +4327,6 @@ async def test_list_versions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = version.ListVersionsRequest() - assert args[0] == request_msg @@ -4341,7 +4356,6 @@ async def test_get_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = version.GetVersionRequest() - assert args[0] == request_msg @@ -4371,7 +4385,6 @@ async def test_create_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_version.CreateVersionRequest() - assert args[0] == request_msg @@ -4401,7 +4414,6 @@ async def test_update_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_version.UpdateVersionRequest() - assert args[0] == request_msg @@ -4424,7 +4436,6 @@ async def test_delete_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = version.DeleteVersionRequest() - assert args[0] == request_msg @@ -5537,7 +5548,6 @@ def test_list_versions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = version.ListVersionsRequest() - assert args[0] == request_msg @@ -5557,7 +5567,6 @@ def test_get_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = version.GetVersionRequest() - assert args[0] == request_msg @@ -5577,7 +5586,6 @@ def test_create_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_version.CreateVersionRequest() - assert args[0] == request_msg @@ -5597,7 +5605,6 @@ def test_update_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcd_version.UpdateVersionRequest() - assert args[0] == request_msg @@ -5617,7 +5624,6 @@ def test_delete_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = version.DeleteVersionRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-discoveryengine/noxfile.py b/packages/google-cloud-discoveryengine/noxfile.py index fdecf082d25a..762d1dda8f95 100644 --- a/packages/google-cloud-discoveryengine/noxfile.py +++ b/packages/google-cloud-discoveryengine/noxfile.py @@ -47,7 +47,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-discoveryengine" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-discoveryengine/setup.py b/packages/google-cloud-discoveryengine/setup.py index b3e8331923d1..d63cebc67086 100644 --- a/packages/google-cloud-discoveryengine/setup.py +++ b/packages/google-cloud-discoveryengine/setup.py @@ -45,7 +45,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/google-cloud-discoveryengine/testing/constraints-3.10.txt b/packages/google-cloud-discoveryengine/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-discoveryengine/testing/constraints-3.10.txt +++ b/packages/google-cloud-discoveryengine/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-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_assistant_service.py b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_assistant_service.py index b9f55f010564..9f35eccec856 100644 --- a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_assistant_service.py +++ b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_assistant_service.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 @@ -113,6 +114,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" @@ -1346,8 +1362,8 @@ def test_assistant_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - assistant_service.StreamAssistRequest, - dict, + assistant_service.StreamAssistRequest(), + {}, ], ) def test_stream_assist(request_type, transport: str = "grpc"): @@ -1358,7 +1374,7 @@ def test_stream_assist(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.stream_assist), "__call__") as call: @@ -1401,10 +1417,11 @@ def test_stream_assist_non_empty_request_with_auto_populated_field(): client.stream_assist(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == assistant_service.StreamAssistRequest( + request_msg = assistant_service.StreamAssistRequest( name="name_value", session="session_value", ) + assert args[0] == request_msg def test_stream_assist_use_cached_wrapped_rpc(): @@ -1485,9 +1502,14 @@ async def test_stream_assist_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_stream_assist_async( - transport: str = "grpc_asyncio", request_type=assistant_service.StreamAssistRequest -): +@pytest.mark.parametrize( + "request_type", + [ + assistant_service.StreamAssistRequest(), + {}, + ], +) +async def test_stream_assist_async(request_type, transport: str = "grpc_asyncio"): client = AssistantServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1495,7 +1517,7 @@ async def test_stream_assist_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.stream_assist), "__call__") as call: @@ -1517,11 +1539,6 @@ async def test_stream_assist_async( assert isinstance(message, assistant_service.StreamAssistResponse) -@pytest.mark.asyncio -async def test_stream_assist_async_from_dict(): - await test_stream_assist_async(request_type=dict) - - def test_stream_assist_field_headers(): client = AssistantServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1831,7 +1848,6 @@ def test_stream_assist_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = assistant_service.StreamAssistRequest() - assert args[0] == request_msg @@ -1871,7 +1887,6 @@ async def test_stream_assist_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = assistant_service.StreamAssistRequest() - assert args[0] == request_msg @@ -2236,7 +2251,6 @@ def test_stream_assist_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = assistant_service.StreamAssistRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_cmek_config_service.py b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_cmek_config_service.py index bf5b12b23583..3a4a1d059924 100644 --- a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_cmek_config_service.py +++ b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_cmek_config_service.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 @@ -113,6 +114,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" @@ -1354,8 +1370,8 @@ def test_cmek_config_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - cmek_config_service.UpdateCmekConfigRequest, - dict, + cmek_config_service.UpdateCmekConfigRequest(), + {}, ], ) def test_update_cmek_config(request_type, transport: str = "grpc"): @@ -1366,7 +1382,7 @@ def test_update_cmek_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( @@ -1409,7 +1425,8 @@ def test_update_cmek_config_non_empty_request_with_auto_populated_field(): client.update_cmek_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cmek_config_service.UpdateCmekConfigRequest() + request_msg = cmek_config_service.UpdateCmekConfigRequest() + assert args[0] == request_msg def test_update_cmek_config_use_cached_wrapped_rpc(): @@ -1504,10 +1521,14 @@ async def test_update_cmek_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_cmek_config_async( - transport: str = "grpc_asyncio", - request_type=cmek_config_service.UpdateCmekConfigRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + cmek_config_service.UpdateCmekConfigRequest(), + {}, + ], +) +async def test_update_cmek_config_async(request_type, transport: str = "grpc_asyncio"): client = CmekConfigServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1515,7 +1536,7 @@ async def test_update_cmek_config_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( @@ -1537,11 +1558,6 @@ async def test_update_cmek_config_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_cmek_config_async_from_dict(): - await test_update_cmek_config_async(request_type=dict) - - def test_update_cmek_config_field_headers(): client = CmekConfigServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1696,8 +1712,8 @@ async def test_update_cmek_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cmek_config_service.GetCmekConfigRequest, - dict, + cmek_config_service.GetCmekConfigRequest(), + {}, ], ) def test_get_cmek_config(request_type, transport: str = "grpc"): @@ -1708,7 +1724,7 @@ def test_get_cmek_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(type(client.transport.get_cmek_config), "__call__") as call: @@ -1767,9 +1783,10 @@ def test_get_cmek_config_non_empty_request_with_auto_populated_field(): client.get_cmek_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cmek_config_service.GetCmekConfigRequest( + request_msg = cmek_config_service.GetCmekConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_cmek_config_use_cached_wrapped_rpc(): @@ -1850,10 +1867,14 @@ async def test_get_cmek_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_cmek_config_async( - transport: str = "grpc_asyncio", - request_type=cmek_config_service.GetCmekConfigRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + cmek_config_service.GetCmekConfigRequest(), + {}, + ], +) +async def test_get_cmek_config_async(request_type, transport: str = "grpc_asyncio"): client = CmekConfigServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1861,7 +1882,7 @@ async def test_get_cmek_config_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_cmek_config), "__call__") as call: @@ -1899,11 +1920,6 @@ async def test_get_cmek_config_async( ) -@pytest.mark.asyncio -async def test_get_cmek_config_async_from_dict(): - await test_get_cmek_config_async(request_type=dict) - - def test_get_cmek_config_field_headers(): client = CmekConfigServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2050,8 +2066,8 @@ async def test_get_cmek_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cmek_config_service.ListCmekConfigsRequest, - dict, + cmek_config_service.ListCmekConfigsRequest(), + {}, ], ) def test_list_cmek_configs(request_type, transport: str = "grpc"): @@ -2062,7 +2078,7 @@ def test_list_cmek_configs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2107,9 +2123,10 @@ def test_list_cmek_configs_non_empty_request_with_auto_populated_field(): client.list_cmek_configs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cmek_config_service.ListCmekConfigsRequest( + request_msg = cmek_config_service.ListCmekConfigsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_list_cmek_configs_use_cached_wrapped_rpc(): @@ -2192,10 +2209,14 @@ async def test_list_cmek_configs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_cmek_configs_async( - transport: str = "grpc_asyncio", - request_type=cmek_config_service.ListCmekConfigsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + cmek_config_service.ListCmekConfigsRequest(), + {}, + ], +) +async def test_list_cmek_configs_async(request_type, transport: str = "grpc_asyncio"): client = CmekConfigServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2203,7 +2224,7 @@ async def test_list_cmek_configs_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( @@ -2225,11 +2246,6 @@ async def test_list_cmek_configs_async( assert isinstance(response, cmek_config_service.ListCmekConfigsResponse) -@pytest.mark.asyncio -async def test_list_cmek_configs_async_from_dict(): - await test_list_cmek_configs_async(request_type=dict) - - def test_list_cmek_configs_field_headers(): client = CmekConfigServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2384,8 +2400,8 @@ async def test_list_cmek_configs_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cmek_config_service.DeleteCmekConfigRequest, - dict, + cmek_config_service.DeleteCmekConfigRequest(), + {}, ], ) def test_delete_cmek_config(request_type, transport: str = "grpc"): @@ -2396,7 +2412,7 @@ def test_delete_cmek_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( @@ -2441,9 +2457,10 @@ def test_delete_cmek_config_non_empty_request_with_auto_populated_field(): client.delete_cmek_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cmek_config_service.DeleteCmekConfigRequest( + request_msg = cmek_config_service.DeleteCmekConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_cmek_config_use_cached_wrapped_rpc(): @@ -2538,10 +2555,14 @@ async def test_delete_cmek_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_cmek_config_async( - transport: str = "grpc_asyncio", - request_type=cmek_config_service.DeleteCmekConfigRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + cmek_config_service.DeleteCmekConfigRequest(), + {}, + ], +) +async def test_delete_cmek_config_async(request_type, transport: str = "grpc_asyncio"): client = CmekConfigServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2549,7 +2570,7 @@ async def test_delete_cmek_config_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( @@ -2571,11 +2592,6 @@ async def test_delete_cmek_config_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_cmek_config_async_from_dict(): - await test_delete_cmek_config_async(request_type=dict) - - def test_delete_cmek_config_field_headers(): client = CmekConfigServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3573,7 +3589,6 @@ def test_update_cmek_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cmek_config_service.UpdateCmekConfigRequest() - assert args[0] == request_msg @@ -3594,7 +3609,6 @@ def test_get_cmek_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cmek_config_service.GetCmekConfigRequest() - assert args[0] == request_msg @@ -3617,7 +3631,6 @@ def test_list_cmek_configs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cmek_config_service.ListCmekConfigsRequest() - assert args[0] == request_msg @@ -3640,7 +3653,6 @@ def test_delete_cmek_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cmek_config_service.DeleteCmekConfigRequest() - assert args[0] == request_msg @@ -3681,7 +3693,6 @@ async def test_update_cmek_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cmek_config_service.UpdateCmekConfigRequest() - assert args[0] == request_msg @@ -3714,7 +3725,6 @@ async def test_get_cmek_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cmek_config_service.GetCmekConfigRequest() - assert args[0] == request_msg @@ -3741,7 +3751,6 @@ async def test_list_cmek_configs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cmek_config_service.ListCmekConfigsRequest() - assert args[0] == request_msg @@ -3768,7 +3777,6 @@ async def test_delete_cmek_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cmek_config_service.DeleteCmekConfigRequest() - assert args[0] == request_msg @@ -4601,7 +4609,6 @@ def test_update_cmek_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cmek_config_service.UpdateCmekConfigRequest() - assert args[0] == request_msg @@ -4621,7 +4628,6 @@ def test_get_cmek_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cmek_config_service.GetCmekConfigRequest() - assert args[0] == request_msg @@ -4643,7 +4649,6 @@ def test_list_cmek_configs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cmek_config_service.ListCmekConfigsRequest() - assert args[0] == request_msg @@ -4665,7 +4670,6 @@ def test_delete_cmek_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cmek_config_service.DeleteCmekConfigRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_completion_service.py b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_completion_service.py index c249463f28e2..4cf9397a7afe 100644 --- a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_completion_service.py +++ b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_completion_service.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 @@ -118,6 +119,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" @@ -1359,8 +1375,8 @@ def test_completion_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - completion_service.CompleteQueryRequest, - dict, + completion_service.CompleteQueryRequest(), + {}, ], ) def test_complete_query(request_type, transport: str = "grpc"): @@ -1371,7 +1387,7 @@ def test_complete_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(type(client.transport.complete_query), "__call__") as call: @@ -1418,12 +1434,13 @@ def test_complete_query_non_empty_request_with_auto_populated_field(): client.complete_query(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == completion_service.CompleteQueryRequest( + request_msg = completion_service.CompleteQueryRequest( data_store="data_store_value", query="query_value", query_model="query_model_value", user_pseudo_id="user_pseudo_id_value", ) + assert args[0] == request_msg def test_complete_query_use_cached_wrapped_rpc(): @@ -1504,10 +1521,14 @@ async def test_complete_query_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_complete_query_async( - transport: str = "grpc_asyncio", - request_type=completion_service.CompleteQueryRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + completion_service.CompleteQueryRequest(), + {}, + ], +) +async def test_complete_query_async(request_type, transport: str = "grpc_asyncio"): client = CompletionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1515,7 +1536,7 @@ async def test_complete_query_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.complete_query), "__call__") as call: @@ -1538,11 +1559,6 @@ async def test_complete_query_async( assert response.tail_match_triggered is True -@pytest.mark.asyncio -async def test_complete_query_async_from_dict(): - await test_complete_query_async(request_type=dict) - - def test_complete_query_field_headers(): client = CompletionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1607,8 +1623,8 @@ async def test_complete_query_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - import_config.ImportSuggestionDenyListEntriesRequest, - dict, + import_config.ImportSuggestionDenyListEntriesRequest(), + {}, ], ) def test_import_suggestion_deny_list_entries(request_type, transport: str = "grpc"): @@ -1619,7 +1635,7 @@ def test_import_suggestion_deny_list_entries(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( @@ -1664,9 +1680,10 @@ def test_import_suggestion_deny_list_entries_non_empty_request_with_auto_populat client.import_suggestion_deny_list_entries(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == import_config.ImportSuggestionDenyListEntriesRequest( + request_msg = import_config.ImportSuggestionDenyListEntriesRequest( parent="parent_value", ) + assert args[0] == request_msg def test_import_suggestion_deny_list_entries_use_cached_wrapped_rpc(): @@ -1762,9 +1779,15 @@ async def test_import_suggestion_deny_list_entries_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + import_config.ImportSuggestionDenyListEntriesRequest(), + {}, + ], +) async def test_import_suggestion_deny_list_entries_async( - transport: str = "grpc_asyncio", - request_type=import_config.ImportSuggestionDenyListEntriesRequest, + request_type, transport: str = "grpc_asyncio" ): client = CompletionServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1773,7 +1796,7 @@ async def test_import_suggestion_deny_list_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( @@ -1795,11 +1818,6 @@ async def test_import_suggestion_deny_list_entries_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_import_suggestion_deny_list_entries_async_from_dict(): - await test_import_suggestion_deny_list_entries_async(request_type=dict) - - def test_import_suggestion_deny_list_entries_field_headers(): client = CompletionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1868,8 +1886,8 @@ async def test_import_suggestion_deny_list_entries_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - purge_config.PurgeSuggestionDenyListEntriesRequest, - dict, + purge_config.PurgeSuggestionDenyListEntriesRequest(), + {}, ], ) def test_purge_suggestion_deny_list_entries(request_type, transport: str = "grpc"): @@ -1880,7 +1898,7 @@ def test_purge_suggestion_deny_list_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( @@ -1925,9 +1943,10 @@ def test_purge_suggestion_deny_list_entries_non_empty_request_with_auto_populate client.purge_suggestion_deny_list_entries(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == purge_config.PurgeSuggestionDenyListEntriesRequest( + request_msg = purge_config.PurgeSuggestionDenyListEntriesRequest( parent="parent_value", ) + assert args[0] == request_msg def test_purge_suggestion_deny_list_entries_use_cached_wrapped_rpc(): @@ -2023,9 +2042,15 @@ async def test_purge_suggestion_deny_list_entries_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + purge_config.PurgeSuggestionDenyListEntriesRequest(), + {}, + ], +) async def test_purge_suggestion_deny_list_entries_async( - transport: str = "grpc_asyncio", - request_type=purge_config.PurgeSuggestionDenyListEntriesRequest, + request_type, transport: str = "grpc_asyncio" ): client = CompletionServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2034,7 +2059,7 @@ async def test_purge_suggestion_deny_list_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( @@ -2056,11 +2081,6 @@ async def test_purge_suggestion_deny_list_entries_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_purge_suggestion_deny_list_entries_async_from_dict(): - await test_purge_suggestion_deny_list_entries_async(request_type=dict) - - def test_purge_suggestion_deny_list_entries_field_headers(): client = CompletionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2129,8 +2149,8 @@ async def test_purge_suggestion_deny_list_entries_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - import_config.ImportCompletionSuggestionsRequest, - dict, + import_config.ImportCompletionSuggestionsRequest(), + {}, ], ) def test_import_completion_suggestions(request_type, transport: str = "grpc"): @@ -2141,7 +2161,7 @@ def test_import_completion_suggestions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2186,9 +2206,10 @@ def test_import_completion_suggestions_non_empty_request_with_auto_populated_fie client.import_completion_suggestions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == import_config.ImportCompletionSuggestionsRequest( + request_msg = import_config.ImportCompletionSuggestionsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_import_completion_suggestions_use_cached_wrapped_rpc(): @@ -2284,9 +2305,15 @@ async def test_import_completion_suggestions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + import_config.ImportCompletionSuggestionsRequest(), + {}, + ], +) async def test_import_completion_suggestions_async( - transport: str = "grpc_asyncio", - request_type=import_config.ImportCompletionSuggestionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = CompletionServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2295,7 +2322,7 @@ async def test_import_completion_suggestions_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( @@ -2317,11 +2344,6 @@ async def test_import_completion_suggestions_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_import_completion_suggestions_async_from_dict(): - await test_import_completion_suggestions_async(request_type=dict) - - def test_import_completion_suggestions_field_headers(): client = CompletionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2390,8 +2412,8 @@ async def test_import_completion_suggestions_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - purge_config.PurgeCompletionSuggestionsRequest, - dict, + purge_config.PurgeCompletionSuggestionsRequest(), + {}, ], ) def test_purge_completion_suggestions(request_type, transport: str = "grpc"): @@ -2402,7 +2424,7 @@ def test_purge_completion_suggestions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2447,9 +2469,10 @@ def test_purge_completion_suggestions_non_empty_request_with_auto_populated_fiel client.purge_completion_suggestions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == purge_config.PurgeCompletionSuggestionsRequest( + request_msg = purge_config.PurgeCompletionSuggestionsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_purge_completion_suggestions_use_cached_wrapped_rpc(): @@ -2545,9 +2568,15 @@ async def test_purge_completion_suggestions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + purge_config.PurgeCompletionSuggestionsRequest(), + {}, + ], +) async def test_purge_completion_suggestions_async( - transport: str = "grpc_asyncio", - request_type=purge_config.PurgeCompletionSuggestionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = CompletionServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2556,7 +2585,7 @@ async def test_purge_completion_suggestions_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( @@ -2578,11 +2607,6 @@ async def test_purge_completion_suggestions_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_purge_completion_suggestions_async_from_dict(): - await test_purge_completion_suggestions_async(request_type=dict) - - def test_purge_completion_suggestions_field_headers(): client = CompletionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3442,7 +3466,6 @@ def test_complete_query_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = completion_service.CompleteQueryRequest() - assert args[0] == request_msg @@ -3465,7 +3488,6 @@ def test_import_suggestion_deny_list_entries_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_config.ImportSuggestionDenyListEntriesRequest() - assert args[0] == request_msg @@ -3488,7 +3510,6 @@ def test_purge_suggestion_deny_list_entries_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = purge_config.PurgeSuggestionDenyListEntriesRequest() - assert args[0] == request_msg @@ -3511,7 +3532,6 @@ def test_import_completion_suggestions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_config.ImportCompletionSuggestionsRequest() - assert args[0] == request_msg @@ -3534,7 +3554,6 @@ def test_purge_completion_suggestions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = purge_config.PurgeCompletionSuggestionsRequest() - assert args[0] == request_msg @@ -3575,7 +3594,6 @@ async def test_complete_query_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = completion_service.CompleteQueryRequest() - assert args[0] == request_msg @@ -3602,7 +3620,6 @@ async def test_import_suggestion_deny_list_entries_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_config.ImportSuggestionDenyListEntriesRequest() - assert args[0] == request_msg @@ -3629,7 +3646,6 @@ async def test_purge_suggestion_deny_list_entries_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = purge_config.PurgeSuggestionDenyListEntriesRequest() - assert args[0] == request_msg @@ -3656,7 +3672,6 @@ async def test_import_completion_suggestions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_config.ImportCompletionSuggestionsRequest() - assert args[0] == request_msg @@ -3683,7 +3698,6 @@ async def test_purge_completion_suggestions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = purge_config.PurgeCompletionSuggestionsRequest() - assert args[0] == request_msg @@ -4572,7 +4586,6 @@ def test_complete_query_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = completion_service.CompleteQueryRequest() - assert args[0] == request_msg @@ -4594,7 +4607,6 @@ def test_import_suggestion_deny_list_entries_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_config.ImportSuggestionDenyListEntriesRequest() - assert args[0] == request_msg @@ -4616,7 +4628,6 @@ def test_purge_suggestion_deny_list_entries_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = purge_config.PurgeSuggestionDenyListEntriesRequest() - assert args[0] == request_msg @@ -4638,7 +4649,6 @@ def test_import_completion_suggestions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_config.ImportCompletionSuggestionsRequest() - assert args[0] == request_msg @@ -4660,7 +4670,6 @@ def test_purge_completion_suggestions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = purge_config.PurgeCompletionSuggestionsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_control_service.py b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_control_service.py index 4b9eee59c897..2147d34bf14c 100644 --- a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_control_service.py +++ b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_control_service.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" @@ -1315,8 +1331,8 @@ def test_control_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - control_service.CreateControlRequest, - dict, + control_service.CreateControlRequest(), + {}, ], ) def test_create_control(request_type, transport: str = "grpc"): @@ -1327,7 +1343,7 @@ def test_create_control(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_control), "__call__") as call: @@ -1382,10 +1398,11 @@ def test_create_control_non_empty_request_with_auto_populated_field(): client.create_control(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == control_service.CreateControlRequest( + request_msg = control_service.CreateControlRequest( parent="parent_value", control_id="control_id_value", ) + assert args[0] == request_msg def test_create_control_use_cached_wrapped_rpc(): @@ -1466,9 +1483,14 @@ async def test_create_control_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_control_async( - transport: str = "grpc_asyncio", request_type=control_service.CreateControlRequest -): +@pytest.mark.parametrize( + "request_type", + [ + control_service.CreateControlRequest(), + {}, + ], +) +async def test_create_control_async(request_type, transport: str = "grpc_asyncio"): client = ControlServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1476,7 +1498,7 @@ async def test_create_control_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_control), "__call__") as call: @@ -1509,11 +1531,6 @@ async def test_create_control_async( assert response.use_cases == [common.SearchUseCase.SEARCH_USE_CASE_SEARCH] -@pytest.mark.asyncio -async def test_create_control_async_from_dict(): - await test_create_control_async(request_type=dict) - - def test_create_control_field_headers(): client = ControlServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1688,8 +1705,8 @@ async def test_create_control_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - control_service.DeleteControlRequest, - dict, + control_service.DeleteControlRequest(), + {}, ], ) def test_delete_control(request_type, transport: str = "grpc"): @@ -1700,7 +1717,7 @@ def test_delete_control(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_control), "__call__") as call: @@ -1741,9 +1758,10 @@ def test_delete_control_non_empty_request_with_auto_populated_field(): client.delete_control(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == control_service.DeleteControlRequest( + request_msg = control_service.DeleteControlRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_control_use_cached_wrapped_rpc(): @@ -1824,9 +1842,14 @@ async def test_delete_control_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_control_async( - transport: str = "grpc_asyncio", request_type=control_service.DeleteControlRequest -): +@pytest.mark.parametrize( + "request_type", + [ + control_service.DeleteControlRequest(), + {}, + ], +) +async def test_delete_control_async(request_type, transport: str = "grpc_asyncio"): client = ControlServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1834,7 +1857,7 @@ async def test_delete_control_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_control), "__call__") as call: @@ -1852,11 +1875,6 @@ async def test_delete_control_async( assert response is None -@pytest.mark.asyncio -async def test_delete_control_async_from_dict(): - await test_delete_control_async(request_type=dict) - - def test_delete_control_field_headers(): client = ControlServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1999,8 +2017,8 @@ async def test_delete_control_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - control_service.UpdateControlRequest, - dict, + control_service.UpdateControlRequest(), + {}, ], ) def test_update_control(request_type, transport: str = "grpc"): @@ -2011,7 +2029,7 @@ def test_update_control(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_control), "__call__") as call: @@ -2063,7 +2081,8 @@ def test_update_control_non_empty_request_with_auto_populated_field(): client.update_control(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == control_service.UpdateControlRequest() + request_msg = control_service.UpdateControlRequest() + assert args[0] == request_msg def test_update_control_use_cached_wrapped_rpc(): @@ -2144,9 +2163,14 @@ async def test_update_control_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_control_async( - transport: str = "grpc_asyncio", request_type=control_service.UpdateControlRequest -): +@pytest.mark.parametrize( + "request_type", + [ + control_service.UpdateControlRequest(), + {}, + ], +) +async def test_update_control_async(request_type, transport: str = "grpc_asyncio"): client = ControlServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2154,7 +2178,7 @@ async def test_update_control_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_control), "__call__") as call: @@ -2187,11 +2211,6 @@ async def test_update_control_async( assert response.use_cases == [common.SearchUseCase.SEARCH_USE_CASE_SEARCH] -@pytest.mark.asyncio -async def test_update_control_async_from_dict(): - await test_update_control_async(request_type=dict) - - def test_update_control_field_headers(): client = ControlServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2356,8 +2375,8 @@ async def test_update_control_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - control_service.GetControlRequest, - dict, + control_service.GetControlRequest(), + {}, ], ) def test_get_control(request_type, transport: str = "grpc"): @@ -2368,7 +2387,7 @@ def test_get_control(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_control), "__call__") as call: @@ -2422,9 +2441,10 @@ def test_get_control_non_empty_request_with_auto_populated_field(): client.get_control(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == control_service.GetControlRequest( + request_msg = control_service.GetControlRequest( name="name_value", ) + assert args[0] == request_msg def test_get_control_use_cached_wrapped_rpc(): @@ -2505,9 +2525,14 @@ async def test_get_control_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_control_async( - transport: str = "grpc_asyncio", request_type=control_service.GetControlRequest -): +@pytest.mark.parametrize( + "request_type", + [ + control_service.GetControlRequest(), + {}, + ], +) +async def test_get_control_async(request_type, transport: str = "grpc_asyncio"): client = ControlServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2515,7 +2540,7 @@ async def test_get_control_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_control), "__call__") as call: @@ -2548,11 +2573,6 @@ async def test_get_control_async( assert response.use_cases == [common.SearchUseCase.SEARCH_USE_CASE_SEARCH] -@pytest.mark.asyncio -async def test_get_control_async_from_dict(): - await test_get_control_async(request_type=dict) - - def test_get_control_field_headers(): client = ControlServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2695,8 +2715,8 @@ async def test_get_control_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - control_service.ListControlsRequest, - dict, + control_service.ListControlsRequest(), + {}, ], ) def test_list_controls(request_type, transport: str = "grpc"): @@ -2707,7 +2727,7 @@ def test_list_controls(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_controls), "__call__") as call: @@ -2753,11 +2773,12 @@ def test_list_controls_non_empty_request_with_auto_populated_field(): client.list_controls(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == control_service.ListControlsRequest( + request_msg = control_service.ListControlsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_controls_use_cached_wrapped_rpc(): @@ -2838,9 +2859,14 @@ async def test_list_controls_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_controls_async( - transport: str = "grpc_asyncio", request_type=control_service.ListControlsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + control_service.ListControlsRequest(), + {}, + ], +) +async def test_list_controls_async(request_type, transport: str = "grpc_asyncio"): client = ControlServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2848,7 +2874,7 @@ async def test_list_controls_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_controls), "__call__") as call: @@ -2871,11 +2897,6 @@ async def test_list_controls_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_controls_async_from_dict(): - await test_list_controls_async(request_type=dict) - - def test_list_controls_field_headers(): client = ControlServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4348,7 +4369,6 @@ def test_create_control_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.CreateControlRequest() - assert args[0] == request_msg @@ -4369,7 +4389,6 @@ def test_delete_control_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.DeleteControlRequest() - assert args[0] == request_msg @@ -4390,7 +4409,6 @@ def test_update_control_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.UpdateControlRequest() - assert args[0] == request_msg @@ -4411,7 +4429,6 @@ def test_get_control_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.GetControlRequest() - assert args[0] == request_msg @@ -4432,7 +4449,6 @@ def test_list_controls_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.ListControlsRequest() - assert args[0] == request_msg @@ -4477,7 +4493,6 @@ async def test_create_control_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.CreateControlRequest() - assert args[0] == request_msg @@ -4500,7 +4515,6 @@ async def test_delete_control_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.DeleteControlRequest() - assert args[0] == request_msg @@ -4531,7 +4545,6 @@ async def test_update_control_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.UpdateControlRequest() - assert args[0] == request_msg @@ -4562,7 +4575,6 @@ async def test_get_control_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.GetControlRequest() - assert args[0] == request_msg @@ -4589,7 +4601,6 @@ async def test_list_controls_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.ListControlsRequest() - assert args[0] == request_msg @@ -5719,7 +5730,6 @@ def test_create_control_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.CreateControlRequest() - assert args[0] == request_msg @@ -5739,7 +5749,6 @@ def test_delete_control_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.DeleteControlRequest() - assert args[0] == request_msg @@ -5759,7 +5768,6 @@ def test_update_control_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.UpdateControlRequest() - assert args[0] == request_msg @@ -5779,7 +5787,6 @@ def test_get_control_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.GetControlRequest() - assert args[0] == request_msg @@ -5799,7 +5806,6 @@ def test_list_controls_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.ListControlsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_conversational_search_service.py b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_conversational_search_service.py index f6cc78aa0d24..23589adeb77b 100644 --- a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_conversational_search_service.py +++ b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_conversational_search_service.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 @@ -122,6 +123,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" @@ -1428,8 +1444,8 @@ def test_conversational_search_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - conversational_search_service.ConverseConversationRequest, - dict, + conversational_search_service.ConverseConversationRequest(), + {}, ], ) def test_converse_conversation(request_type, transport: str = "grpc"): @@ -1440,7 +1456,7 @@ def test_converse_conversation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1489,11 +1505,12 @@ def test_converse_conversation_non_empty_request_with_auto_populated_field(): client.converse_conversation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversational_search_service.ConverseConversationRequest( + request_msg = conversational_search_service.ConverseConversationRequest( name="name_value", serving_config="serving_config_value", filter="filter_value", ) + assert args[0] == request_msg def test_converse_conversation_use_cached_wrapped_rpc(): @@ -1579,9 +1596,15 @@ async def test_converse_conversation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + conversational_search_service.ConverseConversationRequest(), + {}, + ], +) async def test_converse_conversation_async( - transport: str = "grpc_asyncio", - request_type=conversational_search_service.ConverseConversationRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConversationalSearchServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1590,7 +1613,7 @@ async def test_converse_conversation_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( @@ -1614,11 +1637,6 @@ async def test_converse_conversation_async( ) -@pytest.mark.asyncio -async def test_converse_conversation_async_from_dict(): - await test_converse_conversation_async(request_type=dict) - - def test_converse_conversation_field_headers(): client = ConversationalSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1783,8 +1801,8 @@ async def test_converse_conversation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversational_search_service.CreateConversationRequest, - dict, + conversational_search_service.CreateConversationRequest(), + {}, ], ) def test_create_conversation(request_type, transport: str = "grpc"): @@ -1795,7 +1813,7 @@ def test_create_conversation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1847,9 +1865,10 @@ def test_create_conversation_non_empty_request_with_auto_populated_field(): client.create_conversation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversational_search_service.CreateConversationRequest( + request_msg = conversational_search_service.CreateConversationRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_conversation_use_cached_wrapped_rpc(): @@ -1934,10 +1953,14 @@ async def test_create_conversation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_conversation_async( - transport: str = "grpc_asyncio", - request_type=conversational_search_service.CreateConversationRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + conversational_search_service.CreateConversationRequest(), + {}, + ], +) +async def test_create_conversation_async(request_type, transport: str = "grpc_asyncio"): client = ConversationalSearchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1945,7 +1968,7 @@ async def test_create_conversation_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( @@ -1974,11 +1997,6 @@ async def test_create_conversation_async( assert response.user_pseudo_id == "user_pseudo_id_value" -@pytest.mark.asyncio -async def test_create_conversation_async_from_dict(): - await test_create_conversation_async(request_type=dict) - - def test_create_conversation_field_headers(): client = ConversationalSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2143,8 +2161,8 @@ async def test_create_conversation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversational_search_service.DeleteConversationRequest, - dict, + conversational_search_service.DeleteConversationRequest(), + {}, ], ) def test_delete_conversation(request_type, transport: str = "grpc"): @@ -2155,7 +2173,7 @@ def test_delete_conversation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2200,9 +2218,10 @@ def test_delete_conversation_non_empty_request_with_auto_populated_field(): client.delete_conversation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversational_search_service.DeleteConversationRequest( + request_msg = conversational_search_service.DeleteConversationRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_conversation_use_cached_wrapped_rpc(): @@ -2287,10 +2306,14 @@ async def test_delete_conversation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_conversation_async( - transport: str = "grpc_asyncio", - request_type=conversational_search_service.DeleteConversationRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + conversational_search_service.DeleteConversationRequest(), + {}, + ], +) +async def test_delete_conversation_async(request_type, transport: str = "grpc_asyncio"): client = ConversationalSearchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2298,7 +2321,7 @@ async def test_delete_conversation_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( @@ -2318,11 +2341,6 @@ async def test_delete_conversation_async( assert response is None -@pytest.mark.asyncio -async def test_delete_conversation_async_from_dict(): - await test_delete_conversation_async(request_type=dict) - - def test_delete_conversation_field_headers(): client = ConversationalSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2473,8 +2491,8 @@ async def test_delete_conversation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversational_search_service.UpdateConversationRequest, - dict, + conversational_search_service.UpdateConversationRequest(), + {}, ], ) def test_update_conversation(request_type, transport: str = "grpc"): @@ -2485,7 +2503,7 @@ def test_update_conversation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2535,7 +2553,8 @@ def test_update_conversation_non_empty_request_with_auto_populated_field(): client.update_conversation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversational_search_service.UpdateConversationRequest() + request_msg = conversational_search_service.UpdateConversationRequest() + assert args[0] == request_msg def test_update_conversation_use_cached_wrapped_rpc(): @@ -2620,10 +2639,14 @@ async def test_update_conversation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_conversation_async( - transport: str = "grpc_asyncio", - request_type=conversational_search_service.UpdateConversationRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + conversational_search_service.UpdateConversationRequest(), + {}, + ], +) +async def test_update_conversation_async(request_type, transport: str = "grpc_asyncio"): client = ConversationalSearchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2631,7 +2654,7 @@ async def test_update_conversation_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( @@ -2660,11 +2683,6 @@ async def test_update_conversation_async( assert response.user_pseudo_id == "user_pseudo_id_value" -@pytest.mark.asyncio -async def test_update_conversation_async_from_dict(): - await test_update_conversation_async(request_type=dict) - - def test_update_conversation_field_headers(): client = ConversationalSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2829,8 +2847,8 @@ async def test_update_conversation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversational_search_service.GetConversationRequest, - dict, + conversational_search_service.GetConversationRequest(), + {}, ], ) def test_get_conversation(request_type, transport: str = "grpc"): @@ -2841,7 +2859,7 @@ def test_get_conversation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_conversation), "__call__") as call: @@ -2889,9 +2907,10 @@ def test_get_conversation_non_empty_request_with_auto_populated_field(): client.get_conversation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversational_search_service.GetConversationRequest( + request_msg = conversational_search_service.GetConversationRequest( name="name_value", ) + assert args[0] == request_msg def test_get_conversation_use_cached_wrapped_rpc(): @@ -2974,10 +2993,14 @@ async def test_get_conversation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_conversation_async( - transport: str = "grpc_asyncio", - request_type=conversational_search_service.GetConversationRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + conversational_search_service.GetConversationRequest(), + {}, + ], +) +async def test_get_conversation_async(request_type, transport: str = "grpc_asyncio"): client = ConversationalSearchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2985,7 +3008,7 @@ async def test_get_conversation_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_conversation), "__call__") as call: @@ -3012,11 +3035,6 @@ async def test_get_conversation_async( assert response.user_pseudo_id == "user_pseudo_id_value" -@pytest.mark.asyncio -async def test_get_conversation_async_from_dict(): - await test_get_conversation_async(request_type=dict) - - def test_get_conversation_field_headers(): client = ConversationalSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3163,8 +3181,8 @@ async def test_get_conversation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversational_search_service.ListConversationsRequest, - dict, + conversational_search_service.ListConversationsRequest(), + {}, ], ) def test_list_conversations(request_type, transport: str = "grpc"): @@ -3175,7 +3193,7 @@ def test_list_conversations(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3226,12 +3244,13 @@ def test_list_conversations_non_empty_request_with_auto_populated_field(): client.list_conversations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversational_search_service.ListConversationsRequest( + request_msg = conversational_search_service.ListConversationsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_conversations_use_cached_wrapped_rpc(): @@ -3316,10 +3335,14 @@ async def test_list_conversations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_conversations_async( - transport: str = "grpc_asyncio", - request_type=conversational_search_service.ListConversationsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + conversational_search_service.ListConversationsRequest(), + {}, + ], +) +async def test_list_conversations_async(request_type, transport: str = "grpc_asyncio"): client = ConversationalSearchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3327,7 +3350,7 @@ async def test_list_conversations_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( @@ -3352,11 +3375,6 @@ async def test_list_conversations_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_conversations_async_from_dict(): - await test_list_conversations_async(request_type=dict) - - def test_list_conversations_field_headers(): client = ConversationalSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3709,8 +3727,8 @@ async def test_list_conversations_async_pages(): @pytest.mark.parametrize( "request_type", [ - conversational_search_service.AnswerQueryRequest, - dict, + conversational_search_service.AnswerQueryRequest(), + {}, ], ) def test_answer_query(request_type, transport: str = "grpc"): @@ -3721,7 +3739,7 @@ def test_answer_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(type(client.transport.answer_query), "__call__") as call: @@ -3767,11 +3785,12 @@ def test_answer_query_non_empty_request_with_auto_populated_field(): client.answer_query(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversational_search_service.AnswerQueryRequest( + request_msg = conversational_search_service.AnswerQueryRequest( serving_config="serving_config_value", session="session_value", user_pseudo_id="user_pseudo_id_value", ) + assert args[0] == request_msg def test_answer_query_use_cached_wrapped_rpc(): @@ -3852,10 +3871,14 @@ async def test_answer_query_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_answer_query_async( - transport: str = "grpc_asyncio", - request_type=conversational_search_service.AnswerQueryRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + conversational_search_service.AnswerQueryRequest(), + {}, + ], +) +async def test_answer_query_async(request_type, transport: str = "grpc_asyncio"): client = ConversationalSearchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3863,7 +3886,7 @@ async def test_answer_query_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.answer_query), "__call__") as call: @@ -3886,11 +3909,6 @@ async def test_answer_query_async( assert response.answer_query_token == "answer_query_token_value" -@pytest.mark.asyncio -async def test_answer_query_async_from_dict(): - await test_answer_query_async(request_type=dict) - - def test_answer_query_field_headers(): client = ConversationalSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3955,8 +3973,8 @@ async def test_answer_query_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - conversational_search_service.AnswerQueryRequest, - dict, + conversational_search_service.AnswerQueryRequest(), + {}, ], ) def test_stream_answer_query(request_type, transport: str = "grpc"): @@ -3967,7 +3985,7 @@ def test_stream_answer_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( @@ -4015,11 +4033,12 @@ def test_stream_answer_query_non_empty_request_with_auto_populated_field(): client.stream_answer_query(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversational_search_service.AnswerQueryRequest( + request_msg = conversational_search_service.AnswerQueryRequest( serving_config="serving_config_value", session="session_value", user_pseudo_id="user_pseudo_id_value", ) + assert args[0] == request_msg def test_stream_answer_query_use_cached_wrapped_rpc(): @@ -4104,10 +4123,14 @@ async def test_stream_answer_query_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_stream_answer_query_async( - transport: str = "grpc_asyncio", - request_type=conversational_search_service.AnswerQueryRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + conversational_search_service.AnswerQueryRequest(), + {}, + ], +) +async def test_stream_answer_query_async(request_type, transport: str = "grpc_asyncio"): client = ConversationalSearchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4115,7 +4138,7 @@ async def test_stream_answer_query_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( @@ -4139,11 +4162,6 @@ async def test_stream_answer_query_async( assert isinstance(message, conversational_search_service.AnswerQueryResponse) -@pytest.mark.asyncio -async def test_stream_answer_query_async_from_dict(): - await test_stream_answer_query_async(request_type=dict) - - def test_stream_answer_query_field_headers(): client = ConversationalSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4213,8 +4231,8 @@ async def test_stream_answer_query_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - conversational_search_service.GetAnswerRequest, - dict, + conversational_search_service.GetAnswerRequest(), + {}, ], ) def test_get_answer(request_type, transport: str = "grpc"): @@ -4225,7 +4243,7 @@ def test_get_answer(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_answer), "__call__") as call: @@ -4283,9 +4301,10 @@ def test_get_answer_non_empty_request_with_auto_populated_field(): client.get_answer(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversational_search_service.GetAnswerRequest( + request_msg = conversational_search_service.GetAnswerRequest( name="name_value", ) + assert args[0] == request_msg def test_get_answer_use_cached_wrapped_rpc(): @@ -4364,10 +4383,14 @@ async def test_get_answer_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_answer_async( - transport: str = "grpc_asyncio", - request_type=conversational_search_service.GetAnswerRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + conversational_search_service.GetAnswerRequest(), + {}, + ], +) +async def test_get_answer_async(request_type, transport: str = "grpc_asyncio"): client = ConversationalSearchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4375,7 +4398,7 @@ async def test_get_answer_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_answer), "__call__") as call: @@ -4412,11 +4435,6 @@ async def test_get_answer_async( ] -@pytest.mark.asyncio -async def test_get_answer_async_from_dict(): - await test_get_answer_async(request_type=dict) - - def test_get_answer_field_headers(): client = ConversationalSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4559,8 +4577,8 @@ async def test_get_answer_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversational_search_service.CreateSessionRequest, - dict, + conversational_search_service.CreateSessionRequest(), + {}, ], ) def test_create_session(request_type, transport: str = "grpc"): @@ -4571,7 +4589,7 @@ def test_create_session(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_session), "__call__") as call: @@ -4625,9 +4643,10 @@ def test_create_session_non_empty_request_with_auto_populated_field(): client.create_session(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversational_search_service.CreateSessionRequest( + request_msg = conversational_search_service.CreateSessionRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_session_use_cached_wrapped_rpc(): @@ -4708,10 +4727,14 @@ async def test_create_session_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_session_async( - transport: str = "grpc_asyncio", - request_type=conversational_search_service.CreateSessionRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + conversational_search_service.CreateSessionRequest(), + {}, + ], +) +async def test_create_session_async(request_type, transport: str = "grpc_asyncio"): client = ConversationalSearchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4719,7 +4742,7 @@ async def test_create_session_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_session), "__call__") as call: @@ -4752,11 +4775,6 @@ async def test_create_session_async( assert response.is_pinned is True -@pytest.mark.asyncio -async def test_create_session_async_from_dict(): - await test_create_session_async(request_type=dict) - - def test_create_session_field_headers(): client = ConversationalSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4909,8 +4927,8 @@ async def test_create_session_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversational_search_service.DeleteSessionRequest, - dict, + conversational_search_service.DeleteSessionRequest(), + {}, ], ) def test_delete_session(request_type, transport: str = "grpc"): @@ -4921,7 +4939,7 @@ def test_delete_session(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_session), "__call__") as call: @@ -4962,9 +4980,10 @@ def test_delete_session_non_empty_request_with_auto_populated_field(): client.delete_session(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversational_search_service.DeleteSessionRequest( + request_msg = conversational_search_service.DeleteSessionRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_session_use_cached_wrapped_rpc(): @@ -5045,10 +5064,14 @@ async def test_delete_session_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_session_async( - transport: str = "grpc_asyncio", - request_type=conversational_search_service.DeleteSessionRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + conversational_search_service.DeleteSessionRequest(), + {}, + ], +) +async def test_delete_session_async(request_type, transport: str = "grpc_asyncio"): client = ConversationalSearchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5056,7 +5079,7 @@ async def test_delete_session_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_session), "__call__") as call: @@ -5074,11 +5097,6 @@ async def test_delete_session_async( assert response is None -@pytest.mark.asyncio -async def test_delete_session_async_from_dict(): - await test_delete_session_async(request_type=dict) - - def test_delete_session_field_headers(): client = ConversationalSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5221,8 +5239,8 @@ async def test_delete_session_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversational_search_service.UpdateSessionRequest, - dict, + conversational_search_service.UpdateSessionRequest(), + {}, ], ) def test_update_session(request_type, transport: str = "grpc"): @@ -5233,7 +5251,7 @@ def test_update_session(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_session), "__call__") as call: @@ -5285,7 +5303,8 @@ def test_update_session_non_empty_request_with_auto_populated_field(): client.update_session(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversational_search_service.UpdateSessionRequest() + request_msg = conversational_search_service.UpdateSessionRequest() + assert args[0] == request_msg def test_update_session_use_cached_wrapped_rpc(): @@ -5366,10 +5385,14 @@ async def test_update_session_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_session_async( - transport: str = "grpc_asyncio", - request_type=conversational_search_service.UpdateSessionRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + conversational_search_service.UpdateSessionRequest(), + {}, + ], +) +async def test_update_session_async(request_type, transport: str = "grpc_asyncio"): client = ConversationalSearchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5377,7 +5400,7 @@ async def test_update_session_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_session), "__call__") as call: @@ -5410,11 +5433,6 @@ async def test_update_session_async( assert response.is_pinned is True -@pytest.mark.asyncio -async def test_update_session_async_from_dict(): - await test_update_session_async(request_type=dict) - - def test_update_session_field_headers(): client = ConversationalSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5567,8 +5585,8 @@ async def test_update_session_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversational_search_service.GetSessionRequest, - dict, + conversational_search_service.GetSessionRequest(), + {}, ], ) def test_get_session(request_type, transport: str = "grpc"): @@ -5579,7 +5597,7 @@ def test_get_session(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_session), "__call__") as call: @@ -5633,9 +5651,10 @@ def test_get_session_non_empty_request_with_auto_populated_field(): client.get_session(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversational_search_service.GetSessionRequest( + request_msg = conversational_search_service.GetSessionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_session_use_cached_wrapped_rpc(): @@ -5716,10 +5735,14 @@ async def test_get_session_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_session_async( - transport: str = "grpc_asyncio", - request_type=conversational_search_service.GetSessionRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + conversational_search_service.GetSessionRequest(), + {}, + ], +) +async def test_get_session_async(request_type, transport: str = "grpc_asyncio"): client = ConversationalSearchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5727,7 +5750,7 @@ async def test_get_session_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_session), "__call__") as call: @@ -5760,11 +5783,6 @@ async def test_get_session_async( assert response.is_pinned is True -@pytest.mark.asyncio -async def test_get_session_async_from_dict(): - await test_get_session_async(request_type=dict) - - def test_get_session_field_headers(): client = ConversationalSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5907,8 +5925,8 @@ async def test_get_session_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversational_search_service.ListSessionsRequest, - dict, + conversational_search_service.ListSessionsRequest(), + {}, ], ) def test_list_sessions(request_type, transport: str = "grpc"): @@ -5919,7 +5937,7 @@ def test_list_sessions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_sessions), "__call__") as call: @@ -5966,12 +5984,13 @@ def test_list_sessions_non_empty_request_with_auto_populated_field(): client.list_sessions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversational_search_service.ListSessionsRequest( + request_msg = conversational_search_service.ListSessionsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_sessions_use_cached_wrapped_rpc(): @@ -6052,10 +6071,14 @@ async def test_list_sessions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_sessions_async( - transport: str = "grpc_asyncio", - request_type=conversational_search_service.ListSessionsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + conversational_search_service.ListSessionsRequest(), + {}, + ], +) +async def test_list_sessions_async(request_type, transport: str = "grpc_asyncio"): client = ConversationalSearchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6063,7 +6086,7 @@ async def test_list_sessions_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_sessions), "__call__") as call: @@ -6086,11 +6109,6 @@ async def test_list_sessions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_sessions_async_from_dict(): - await test_list_sessions_async(request_type=dict) - - def test_list_sessions_field_headers(): client = ConversationalSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9214,7 +9232,6 @@ def test_converse_conversation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.ConverseConversationRequest() - assert args[0] == request_msg @@ -9237,7 +9254,6 @@ def test_create_conversation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.CreateConversationRequest() - assert args[0] == request_msg @@ -9260,7 +9276,6 @@ def test_delete_conversation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.DeleteConversationRequest() - assert args[0] == request_msg @@ -9283,7 +9298,6 @@ def test_update_conversation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.UpdateConversationRequest() - assert args[0] == request_msg @@ -9304,7 +9318,6 @@ def test_get_conversation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.GetConversationRequest() - assert args[0] == request_msg @@ -9327,7 +9340,6 @@ def test_list_conversations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.ListConversationsRequest() - assert args[0] == request_msg @@ -9348,7 +9360,6 @@ def test_answer_query_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.AnswerQueryRequest() - assert args[0] == request_msg @@ -9371,7 +9382,6 @@ def test_stream_answer_query_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.AnswerQueryRequest() - assert args[0] == request_msg @@ -9392,7 +9402,6 @@ def test_get_answer_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.GetAnswerRequest() - assert args[0] == request_msg @@ -9413,7 +9422,6 @@ def test_create_session_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.CreateSessionRequest() - assert args[0] == request_msg @@ -9434,7 +9442,6 @@ def test_delete_session_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.DeleteSessionRequest() - assert args[0] == request_msg @@ -9455,7 +9462,6 @@ def test_update_session_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.UpdateSessionRequest() - assert args[0] == request_msg @@ -9476,7 +9482,6 @@ def test_get_session_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.GetSessionRequest() - assert args[0] == request_msg @@ -9497,7 +9502,6 @@ def test_list_sessions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.ListSessionsRequest() - assert args[0] == request_msg @@ -9538,7 +9542,6 @@ async def test_converse_conversation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.ConverseConversationRequest() - assert args[0] == request_msg @@ -9569,7 +9572,6 @@ async def test_create_conversation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.CreateConversationRequest() - assert args[0] == request_msg @@ -9594,7 +9596,6 @@ async def test_delete_conversation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.DeleteConversationRequest() - assert args[0] == request_msg @@ -9625,7 +9626,6 @@ async def test_update_conversation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.UpdateConversationRequest() - assert args[0] == request_msg @@ -9654,7 +9654,6 @@ async def test_get_conversation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.GetConversationRequest() - assert args[0] == request_msg @@ -9683,7 +9682,6 @@ async def test_list_conversations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.ListConversationsRequest() - assert args[0] == request_msg @@ -9710,7 +9708,6 @@ async def test_answer_query_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.AnswerQueryRequest() - assert args[0] == request_msg @@ -9738,7 +9735,6 @@ async def test_stream_answer_query_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.AnswerQueryRequest() - assert args[0] == request_msg @@ -9772,7 +9768,6 @@ async def test_get_answer_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.GetAnswerRequest() - assert args[0] == request_msg @@ -9804,7 +9799,6 @@ async def test_create_session_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.CreateSessionRequest() - assert args[0] == request_msg @@ -9827,7 +9821,6 @@ async def test_delete_session_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.DeleteSessionRequest() - assert args[0] == request_msg @@ -9859,7 +9852,6 @@ async def test_update_session_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.UpdateSessionRequest() - assert args[0] == request_msg @@ -9891,7 +9883,6 @@ async def test_get_session_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.GetSessionRequest() - assert args[0] == request_msg @@ -9918,7 +9909,6 @@ async def test_list_sessions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.ListSessionsRequest() - assert args[0] == request_msg @@ -12846,7 +12836,6 @@ def test_converse_conversation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.ConverseConversationRequest() - assert args[0] == request_msg @@ -12868,7 +12857,6 @@ def test_create_conversation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.CreateConversationRequest() - assert args[0] == request_msg @@ -12890,7 +12878,6 @@ def test_delete_conversation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.DeleteConversationRequest() - assert args[0] == request_msg @@ -12912,7 +12899,6 @@ def test_update_conversation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.UpdateConversationRequest() - assert args[0] == request_msg @@ -12932,7 +12918,6 @@ def test_get_conversation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.GetConversationRequest() - assert args[0] == request_msg @@ -12954,7 +12939,6 @@ def test_list_conversations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.ListConversationsRequest() - assert args[0] == request_msg @@ -12974,7 +12958,6 @@ def test_answer_query_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.AnswerQueryRequest() - assert args[0] == request_msg @@ -12996,7 +12979,6 @@ def test_stream_answer_query_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.AnswerQueryRequest() - assert args[0] == request_msg @@ -13016,7 +12998,6 @@ def test_get_answer_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.GetAnswerRequest() - assert args[0] == request_msg @@ -13036,7 +13017,6 @@ def test_create_session_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.CreateSessionRequest() - assert args[0] == request_msg @@ -13056,7 +13036,6 @@ def test_delete_session_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.DeleteSessionRequest() - assert args[0] == request_msg @@ -13076,7 +13055,6 @@ def test_update_session_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.UpdateSessionRequest() - assert args[0] == request_msg @@ -13096,7 +13074,6 @@ def test_get_session_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.GetSessionRequest() - assert args[0] == request_msg @@ -13116,7 +13093,6 @@ def test_list_sessions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.ListSessionsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_data_store_service.py b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_data_store_service.py index 09bdcad04bd6..8a4f5862ea82 100644 --- a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_data_store_service.py +++ b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_data_store_service.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 @@ -125,6 +126,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" @@ -1358,8 +1374,8 @@ def test_data_store_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - data_store_service.CreateDataStoreRequest, - dict, + data_store_service.CreateDataStoreRequest(), + {}, ], ) def test_create_data_store(request_type, transport: str = "grpc"): @@ -1370,7 +1386,7 @@ def test_create_data_store(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1417,11 +1433,12 @@ def test_create_data_store_non_empty_request_with_auto_populated_field(): client.create_data_store(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_store_service.CreateDataStoreRequest( + request_msg = data_store_service.CreateDataStoreRequest( cmek_config_name="cmek_config_name_value", parent="parent_value", data_store_id="data_store_id_value", ) + assert args[0] == request_msg def test_create_data_store_use_cached_wrapped_rpc(): @@ -1514,10 +1531,14 @@ async def test_create_data_store_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_data_store_async( - transport: str = "grpc_asyncio", - request_type=data_store_service.CreateDataStoreRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + data_store_service.CreateDataStoreRequest(), + {}, + ], +) +async def test_create_data_store_async(request_type, transport: str = "grpc_asyncio"): client = DataStoreServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1525,7 +1546,7 @@ async def test_create_data_store_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( @@ -1547,11 +1568,6 @@ async def test_create_data_store_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_data_store_async_from_dict(): - await test_create_data_store_async(request_type=dict) - - def test_create_data_store_field_headers(): client = DataStoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1726,8 +1742,8 @@ async def test_create_data_store_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_store_service.GetDataStoreRequest, - dict, + data_store_service.GetDataStoreRequest(), + {}, ], ) def test_get_data_store(request_type, transport: str = "grpc"): @@ -1738,7 +1754,7 @@ def test_get_data_store(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_data_store), "__call__") as call: @@ -1798,9 +1814,10 @@ def test_get_data_store_non_empty_request_with_auto_populated_field(): client.get_data_store(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_store_service.GetDataStoreRequest( + request_msg = data_store_service.GetDataStoreRequest( name="name_value", ) + assert args[0] == request_msg def test_get_data_store_use_cached_wrapped_rpc(): @@ -1881,9 +1898,14 @@ async def test_get_data_store_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_data_store_async( - transport: str = "grpc_asyncio", request_type=data_store_service.GetDataStoreRequest -): +@pytest.mark.parametrize( + "request_type", + [ + data_store_service.GetDataStoreRequest(), + {}, + ], +) +async def test_get_data_store_async(request_type, transport: str = "grpc_asyncio"): client = DataStoreServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1891,7 +1913,7 @@ async def test_get_data_store_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_data_store), "__call__") as call: @@ -1930,11 +1952,6 @@ async def test_get_data_store_async( assert response.identity_mapping_store == "identity_mapping_store_value" -@pytest.mark.asyncio -async def test_get_data_store_async_from_dict(): - await test_get_data_store_async(request_type=dict) - - def test_get_data_store_field_headers(): client = DataStoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2081,8 +2098,8 @@ async def test_get_data_store_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_store_service.ListDataStoresRequest, - dict, + data_store_service.ListDataStoresRequest(), + {}, ], ) def test_list_data_stores(request_type, transport: str = "grpc"): @@ -2093,7 +2110,7 @@ def test_list_data_stores(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_data_stores), "__call__") as call: @@ -2139,11 +2156,12 @@ def test_list_data_stores_non_empty_request_with_auto_populated_field(): client.list_data_stores(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_store_service.ListDataStoresRequest( + request_msg = data_store_service.ListDataStoresRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_data_stores_use_cached_wrapped_rpc(): @@ -2226,10 +2244,14 @@ async def test_list_data_stores_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_data_stores_async( - transport: str = "grpc_asyncio", - request_type=data_store_service.ListDataStoresRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + data_store_service.ListDataStoresRequest(), + {}, + ], +) +async def test_list_data_stores_async(request_type, transport: str = "grpc_asyncio"): client = DataStoreServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2237,7 +2259,7 @@ async def test_list_data_stores_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_data_stores), "__call__") as call: @@ -2260,11 +2282,6 @@ async def test_list_data_stores_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_data_stores_async_from_dict(): - await test_list_data_stores_async(request_type=dict) - - def test_list_data_stores_field_headers(): client = DataStoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2601,8 +2618,8 @@ async def test_list_data_stores_async_pages(): @pytest.mark.parametrize( "request_type", [ - data_store_service.DeleteDataStoreRequest, - dict, + data_store_service.DeleteDataStoreRequest(), + {}, ], ) def test_delete_data_store(request_type, transport: str = "grpc"): @@ -2613,7 +2630,7 @@ def test_delete_data_store(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2658,9 +2675,10 @@ def test_delete_data_store_non_empty_request_with_auto_populated_field(): client.delete_data_store(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_store_service.DeleteDataStoreRequest( + request_msg = data_store_service.DeleteDataStoreRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_data_store_use_cached_wrapped_rpc(): @@ -2753,10 +2771,14 @@ async def test_delete_data_store_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_data_store_async( - transport: str = "grpc_asyncio", - request_type=data_store_service.DeleteDataStoreRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + data_store_service.DeleteDataStoreRequest(), + {}, + ], +) +async def test_delete_data_store_async(request_type, transport: str = "grpc_asyncio"): client = DataStoreServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2764,7 +2786,7 @@ async def test_delete_data_store_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( @@ -2786,11 +2808,6 @@ async def test_delete_data_store_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_data_store_async_from_dict(): - await test_delete_data_store_async(request_type=dict) - - def test_delete_data_store_field_headers(): client = DataStoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2945,8 +2962,8 @@ async def test_delete_data_store_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_store_service.UpdateDataStoreRequest, - dict, + data_store_service.UpdateDataStoreRequest(), + {}, ], ) def test_update_data_store(request_type, transport: str = "grpc"): @@ -2957,7 +2974,7 @@ def test_update_data_store(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3019,7 +3036,8 @@ def test_update_data_store_non_empty_request_with_auto_populated_field(): client.update_data_store(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_store_service.UpdateDataStoreRequest() + request_msg = data_store_service.UpdateDataStoreRequest() + assert args[0] == request_msg def test_update_data_store_use_cached_wrapped_rpc(): @@ -3102,10 +3120,14 @@ async def test_update_data_store_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_data_store_async( - transport: str = "grpc_asyncio", - request_type=data_store_service.UpdateDataStoreRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + data_store_service.UpdateDataStoreRequest(), + {}, + ], +) +async def test_update_data_store_async(request_type, transport: str = "grpc_asyncio"): client = DataStoreServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3113,7 +3135,7 @@ async def test_update_data_store_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( @@ -3154,11 +3176,6 @@ async def test_update_data_store_async( assert response.identity_mapping_store == "identity_mapping_store_value" -@pytest.mark.asyncio -async def test_update_data_store_async_from_dict(): - await test_update_data_store_async(request_type=dict) - - def test_update_data_store_field_headers(): client = DataStoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4470,7 +4487,6 @@ def test_create_data_store_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_store_service.CreateDataStoreRequest() - assert args[0] == request_msg @@ -4491,7 +4507,6 @@ def test_get_data_store_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_store_service.GetDataStoreRequest() - assert args[0] == request_msg @@ -4512,7 +4527,6 @@ def test_list_data_stores_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_store_service.ListDataStoresRequest() - assert args[0] == request_msg @@ -4535,7 +4549,6 @@ def test_delete_data_store_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_store_service.DeleteDataStoreRequest() - assert args[0] == request_msg @@ -4558,7 +4571,6 @@ def test_update_data_store_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_store_service.UpdateDataStoreRequest() - assert args[0] == request_msg @@ -4599,7 +4611,6 @@ async def test_create_data_store_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_store_service.CreateDataStoreRequest() - assert args[0] == request_msg @@ -4634,7 +4645,6 @@ async def test_get_data_store_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_store_service.GetDataStoreRequest() - assert args[0] == request_msg @@ -4661,7 +4671,6 @@ async def test_list_data_stores_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_store_service.ListDataStoresRequest() - assert args[0] == request_msg @@ -4688,7 +4697,6 @@ async def test_delete_data_store_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_store_service.DeleteDataStoreRequest() - assert args[0] == request_msg @@ -4725,7 +4733,6 @@ async def test_update_data_store_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_store_service.UpdateDataStoreRequest() - assert args[0] == request_msg @@ -5948,7 +5955,6 @@ def test_create_data_store_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_store_service.CreateDataStoreRequest() - assert args[0] == request_msg @@ -5968,7 +5974,6 @@ def test_get_data_store_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_store_service.GetDataStoreRequest() - assert args[0] == request_msg @@ -5988,7 +5993,6 @@ def test_list_data_stores_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_store_service.ListDataStoresRequest() - assert args[0] == request_msg @@ -6010,7 +6014,6 @@ def test_delete_data_store_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_store_service.DeleteDataStoreRequest() - assert args[0] == request_msg @@ -6032,7 +6035,6 @@ def test_update_data_store_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_store_service.UpdateDataStoreRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_document_service.py b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_document_service.py index a7d4dddeceb8..f0e703d9863d 100644 --- a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_document_service.py +++ b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_document_service.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 @@ -126,6 +127,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" @@ -1353,8 +1369,8 @@ def test_document_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - document_service.GetDocumentRequest, - dict, + document_service.GetDocumentRequest(), + {}, ], ) def test_get_document(request_type, transport: str = "grpc"): @@ -1365,7 +1381,7 @@ def test_get_document(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_document), "__call__") as call: @@ -1416,9 +1432,10 @@ def test_get_document_non_empty_request_with_auto_populated_field(): client.get_document(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_service.GetDocumentRequest( + request_msg = document_service.GetDocumentRequest( name="name_value", ) + assert args[0] == request_msg def test_get_document_use_cached_wrapped_rpc(): @@ -1499,9 +1516,14 @@ async def test_get_document_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_document_async( - transport: str = "grpc_asyncio", request_type=document_service.GetDocumentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + document_service.GetDocumentRequest(), + {}, + ], +) +async def test_get_document_async(request_type, transport: str = "grpc_asyncio"): client = DocumentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1509,7 +1531,7 @@ async def test_get_document_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_document), "__call__") as call: @@ -1538,11 +1560,6 @@ async def test_get_document_async( assert response.parent_document_id == "parent_document_id_value" -@pytest.mark.asyncio -async def test_get_document_async_from_dict(): - await test_get_document_async(request_type=dict) - - def test_get_document_field_headers(): client = DocumentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1685,8 +1702,8 @@ async def test_get_document_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - document_service.ListDocumentsRequest, - dict, + document_service.ListDocumentsRequest(), + {}, ], ) def test_list_documents(request_type, transport: str = "grpc"): @@ -1697,7 +1714,7 @@ def test_list_documents(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_documents), "__call__") as call: @@ -1742,10 +1759,11 @@ def test_list_documents_non_empty_request_with_auto_populated_field(): client.list_documents(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_service.ListDocumentsRequest( + request_msg = document_service.ListDocumentsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_documents_use_cached_wrapped_rpc(): @@ -1826,9 +1844,14 @@ async def test_list_documents_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_documents_async( - transport: str = "grpc_asyncio", request_type=document_service.ListDocumentsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + document_service.ListDocumentsRequest(), + {}, + ], +) +async def test_list_documents_async(request_type, transport: str = "grpc_asyncio"): client = DocumentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1836,7 +1859,7 @@ async def test_list_documents_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_documents), "__call__") as call: @@ -1859,11 +1882,6 @@ async def test_list_documents_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_documents_async_from_dict(): - await test_list_documents_async(request_type=dict) - - def test_list_documents_field_headers(): client = DocumentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2200,8 +2218,8 @@ async def test_list_documents_async_pages(): @pytest.mark.parametrize( "request_type", [ - document_service.CreateDocumentRequest, - dict, + document_service.CreateDocumentRequest(), + {}, ], ) def test_create_document(request_type, transport: str = "grpc"): @@ -2212,7 +2230,7 @@ def test_create_document(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_document), "__call__") as call: @@ -2264,10 +2282,11 @@ def test_create_document_non_empty_request_with_auto_populated_field(): client.create_document(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_service.CreateDocumentRequest( + request_msg = document_service.CreateDocumentRequest( parent="parent_value", document_id="document_id_value", ) + assert args[0] == request_msg def test_create_document_use_cached_wrapped_rpc(): @@ -2348,9 +2367,14 @@ async def test_create_document_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_document_async( - transport: str = "grpc_asyncio", request_type=document_service.CreateDocumentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + document_service.CreateDocumentRequest(), + {}, + ], +) +async def test_create_document_async(request_type, transport: str = "grpc_asyncio"): client = DocumentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2358,7 +2382,7 @@ async def test_create_document_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_document), "__call__") as call: @@ -2387,11 +2411,6 @@ async def test_create_document_async( assert response.parent_document_id == "parent_document_id_value" -@pytest.mark.asyncio -async def test_create_document_async_from_dict(): - await test_create_document_async(request_type=dict) - - def test_create_document_field_headers(): client = DocumentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2606,8 +2625,8 @@ async def test_create_document_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - document_service.UpdateDocumentRequest, - dict, + document_service.UpdateDocumentRequest(), + {}, ], ) def test_update_document(request_type, transport: str = "grpc"): @@ -2618,7 +2637,7 @@ def test_update_document(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_document), "__call__") as call: @@ -2667,7 +2686,8 @@ def test_update_document_non_empty_request_with_auto_populated_field(): client.update_document(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_service.UpdateDocumentRequest() + request_msg = document_service.UpdateDocumentRequest() + assert args[0] == request_msg def test_update_document_use_cached_wrapped_rpc(): @@ -2748,9 +2768,14 @@ async def test_update_document_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_document_async( - transport: str = "grpc_asyncio", request_type=document_service.UpdateDocumentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + document_service.UpdateDocumentRequest(), + {}, + ], +) +async def test_update_document_async(request_type, transport: str = "grpc_asyncio"): client = DocumentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2758,7 +2783,7 @@ async def test_update_document_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_document), "__call__") as call: @@ -2787,11 +2812,6 @@ async def test_update_document_async( assert response.parent_document_id == "parent_document_id_value" -@pytest.mark.asyncio -async def test_update_document_async_from_dict(): - await test_update_document_async(request_type=dict) - - def test_update_document_field_headers(): client = DocumentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2996,8 +3016,8 @@ async def test_update_document_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - document_service.DeleteDocumentRequest, - dict, + document_service.DeleteDocumentRequest(), + {}, ], ) def test_delete_document(request_type, transport: str = "grpc"): @@ -3008,7 +3028,7 @@ def test_delete_document(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_document), "__call__") as call: @@ -3049,9 +3069,10 @@ def test_delete_document_non_empty_request_with_auto_populated_field(): client.delete_document(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_service.DeleteDocumentRequest( + request_msg = document_service.DeleteDocumentRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_document_use_cached_wrapped_rpc(): @@ -3132,9 +3153,14 @@ async def test_delete_document_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_document_async( - transport: str = "grpc_asyncio", request_type=document_service.DeleteDocumentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + document_service.DeleteDocumentRequest(), + {}, + ], +) +async def test_delete_document_async(request_type, transport: str = "grpc_asyncio"): client = DocumentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3142,7 +3168,7 @@ async def test_delete_document_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_document), "__call__") as call: @@ -3160,11 +3186,6 @@ async def test_delete_document_async( assert response is None -@pytest.mark.asyncio -async def test_delete_document_async_from_dict(): - await test_delete_document_async(request_type=dict) - - def test_delete_document_field_headers(): client = DocumentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3307,8 +3328,8 @@ async def test_delete_document_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - import_config.ImportDocumentsRequest, - dict, + import_config.ImportDocumentsRequest(), + {}, ], ) def test_import_documents(request_type, transport: str = "grpc"): @@ -3319,7 +3340,7 @@ def test_import_documents(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.import_documents), "__call__") as call: @@ -3361,10 +3382,11 @@ def test_import_documents_non_empty_request_with_auto_populated_field(): client.import_documents(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == import_config.ImportDocumentsRequest( + request_msg = import_config.ImportDocumentsRequest( parent="parent_value", id_field="id_field_value", ) + assert args[0] == request_msg def test_import_documents_use_cached_wrapped_rpc(): @@ -3457,9 +3479,14 @@ async def test_import_documents_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_import_documents_async( - transport: str = "grpc_asyncio", request_type=import_config.ImportDocumentsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + import_config.ImportDocumentsRequest(), + {}, + ], +) +async def test_import_documents_async(request_type, transport: str = "grpc_asyncio"): client = DocumentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3467,7 +3494,7 @@ async def test_import_documents_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.import_documents), "__call__") as call: @@ -3487,11 +3514,6 @@ async def test_import_documents_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_import_documents_async_from_dict(): - await test_import_documents_async(request_type=dict) - - def test_import_documents_field_headers(): client = DocumentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3556,8 +3578,8 @@ async def test_import_documents_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - purge_config.PurgeDocumentsRequest, - dict, + purge_config.PurgeDocumentsRequest(), + {}, ], ) def test_purge_documents(request_type, transport: str = "grpc"): @@ -3568,7 +3590,7 @@ def test_purge_documents(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.purge_documents), "__call__") as call: @@ -3610,10 +3632,11 @@ def test_purge_documents_non_empty_request_with_auto_populated_field(): client.purge_documents(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == purge_config.PurgeDocumentsRequest( + request_msg = purge_config.PurgeDocumentsRequest( parent="parent_value", filter="filter_value", ) + assert args[0] == request_msg def test_purge_documents_use_cached_wrapped_rpc(): @@ -3704,9 +3727,14 @@ async def test_purge_documents_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_purge_documents_async( - transport: str = "grpc_asyncio", request_type=purge_config.PurgeDocumentsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + purge_config.PurgeDocumentsRequest(), + {}, + ], +) +async def test_purge_documents_async(request_type, transport: str = "grpc_asyncio"): client = DocumentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3714,7 +3742,7 @@ async def test_purge_documents_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.purge_documents), "__call__") as call: @@ -3734,11 +3762,6 @@ async def test_purge_documents_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_purge_documents_async_from_dict(): - await test_purge_documents_async(request_type=dict) - - def test_purge_documents_field_headers(): client = DocumentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3803,8 +3826,8 @@ async def test_purge_documents_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - document_service.BatchGetDocumentsMetadataRequest, - dict, + document_service.BatchGetDocumentsMetadataRequest(), + {}, ], ) def test_batch_get_documents_metadata(request_type, transport: str = "grpc"): @@ -3815,7 +3838,7 @@ def test_batch_get_documents_metadata(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3860,9 +3883,10 @@ def test_batch_get_documents_metadata_non_empty_request_with_auto_populated_fiel client.batch_get_documents_metadata(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_service.BatchGetDocumentsMetadataRequest( + request_msg = document_service.BatchGetDocumentsMetadataRequest( parent="parent_value", ) + assert args[0] == request_msg def test_batch_get_documents_metadata_use_cached_wrapped_rpc(): @@ -3948,9 +3972,15 @@ async def test_batch_get_documents_metadata_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + document_service.BatchGetDocumentsMetadataRequest(), + {}, + ], +) async def test_batch_get_documents_metadata_async( - transport: str = "grpc_asyncio", - request_type=document_service.BatchGetDocumentsMetadataRequest, + request_type, transport: str = "grpc_asyncio" ): client = DocumentServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3959,7 +3989,7 @@ async def test_batch_get_documents_metadata_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( @@ -3981,11 +4011,6 @@ async def test_batch_get_documents_metadata_async( assert isinstance(response, document_service.BatchGetDocumentsMetadataResponse) -@pytest.mark.asyncio -async def test_batch_get_documents_metadata_async_from_dict(): - await test_batch_get_documents_metadata_async(request_type=dict) - - def test_batch_get_documents_metadata_field_headers(): client = DocumentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5768,7 +5793,6 @@ def test_get_document_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.GetDocumentRequest() - assert args[0] == request_msg @@ -5789,7 +5813,6 @@ def test_list_documents_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.ListDocumentsRequest() - assert args[0] == request_msg @@ -5810,7 +5833,6 @@ def test_create_document_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.CreateDocumentRequest() - assert args[0] == request_msg @@ -5831,7 +5853,6 @@ def test_update_document_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.UpdateDocumentRequest() - assert args[0] == request_msg @@ -5852,7 +5873,6 @@ def test_delete_document_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.DeleteDocumentRequest() - assert args[0] == request_msg @@ -5873,7 +5893,6 @@ def test_import_documents_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_config.ImportDocumentsRequest() - assert args[0] == request_msg @@ -5894,7 +5913,6 @@ def test_purge_documents_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = purge_config.PurgeDocumentsRequest() - assert args[0] == request_msg @@ -5917,7 +5935,6 @@ def test_batch_get_documents_metadata_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.BatchGetDocumentsMetadataRequest() - assert args[0] == request_msg @@ -5961,7 +5978,6 @@ async def test_get_document_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.GetDocumentRequest() - assert args[0] == request_msg @@ -5988,7 +6004,6 @@ async def test_list_documents_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.ListDocumentsRequest() - assert args[0] == request_msg @@ -6018,7 +6033,6 @@ async def test_create_document_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.CreateDocumentRequest() - assert args[0] == request_msg @@ -6048,7 +6062,6 @@ async def test_update_document_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.UpdateDocumentRequest() - assert args[0] == request_msg @@ -6071,7 +6084,6 @@ async def test_delete_document_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.DeleteDocumentRequest() - assert args[0] == request_msg @@ -6096,7 +6108,6 @@ async def test_import_documents_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_config.ImportDocumentsRequest() - assert args[0] == request_msg @@ -6121,7 +6132,6 @@ async def test_purge_documents_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = purge_config.PurgeDocumentsRequest() - assert args[0] == request_msg @@ -6148,7 +6158,6 @@ async def test_batch_get_documents_metadata_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.BatchGetDocumentsMetadataRequest() - assert args[0] == request_msg @@ -7677,7 +7686,6 @@ def test_get_document_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.GetDocumentRequest() - assert args[0] == request_msg @@ -7697,7 +7705,6 @@ def test_list_documents_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.ListDocumentsRequest() - assert args[0] == request_msg @@ -7717,7 +7724,6 @@ def test_create_document_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.CreateDocumentRequest() - assert args[0] == request_msg @@ -7737,7 +7743,6 @@ def test_update_document_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.UpdateDocumentRequest() - assert args[0] == request_msg @@ -7757,7 +7762,6 @@ def test_delete_document_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.DeleteDocumentRequest() - assert args[0] == request_msg @@ -7777,7 +7781,6 @@ def test_import_documents_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_config.ImportDocumentsRequest() - assert args[0] == request_msg @@ -7797,7 +7800,6 @@ def test_purge_documents_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = purge_config.PurgeDocumentsRequest() - assert args[0] == request_msg @@ -7819,7 +7821,6 @@ def test_batch_get_documents_metadata_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.BatchGetDocumentsMetadataRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_engine_service.py b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_engine_service.py index 74649f3c707c..6b65acc9140a 100644 --- a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_engine_service.py +++ b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_engine_service.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 @@ -117,6 +118,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" @@ -1316,8 +1332,8 @@ def test_engine_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - engine_service.CreateEngineRequest, - dict, + engine_service.CreateEngineRequest(), + {}, ], ) def test_create_engine(request_type, transport: str = "grpc"): @@ -1328,7 +1344,7 @@ def test_create_engine(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_engine), "__call__") as call: @@ -1370,10 +1386,11 @@ def test_create_engine_non_empty_request_with_auto_populated_field(): client.create_engine(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == engine_service.CreateEngineRequest( + request_msg = engine_service.CreateEngineRequest( parent="parent_value", engine_id="engine_id_value", ) + assert args[0] == request_msg def test_create_engine_use_cached_wrapped_rpc(): @@ -1464,9 +1481,14 @@ async def test_create_engine_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_engine_async( - transport: str = "grpc_asyncio", request_type=engine_service.CreateEngineRequest -): +@pytest.mark.parametrize( + "request_type", + [ + engine_service.CreateEngineRequest(), + {}, + ], +) +async def test_create_engine_async(request_type, transport: str = "grpc_asyncio"): client = EngineServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1474,7 +1496,7 @@ async def test_create_engine_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_engine), "__call__") as call: @@ -1494,11 +1516,6 @@ async def test_create_engine_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_engine_async_from_dict(): - await test_create_engine_async(request_type=dict) - - def test_create_engine_field_headers(): client = EngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1701,8 +1718,8 @@ async def test_create_engine_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - engine_service.DeleteEngineRequest, - dict, + engine_service.DeleteEngineRequest(), + {}, ], ) def test_delete_engine(request_type, transport: str = "grpc"): @@ -1713,7 +1730,7 @@ def test_delete_engine(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_engine), "__call__") as call: @@ -1754,9 +1771,10 @@ def test_delete_engine_non_empty_request_with_auto_populated_field(): client.delete_engine(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == engine_service.DeleteEngineRequest( + request_msg = engine_service.DeleteEngineRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_engine_use_cached_wrapped_rpc(): @@ -1847,9 +1865,14 @@ async def test_delete_engine_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_engine_async( - transport: str = "grpc_asyncio", request_type=engine_service.DeleteEngineRequest -): +@pytest.mark.parametrize( + "request_type", + [ + engine_service.DeleteEngineRequest(), + {}, + ], +) +async def test_delete_engine_async(request_type, transport: str = "grpc_asyncio"): client = EngineServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1857,7 +1880,7 @@ async def test_delete_engine_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_engine), "__call__") as call: @@ -1877,11 +1900,6 @@ async def test_delete_engine_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_engine_async_from_dict(): - await test_delete_engine_async(request_type=dict) - - def test_delete_engine_field_headers(): client = EngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2028,8 +2046,8 @@ async def test_delete_engine_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - engine_service.UpdateEngineRequest, - dict, + engine_service.UpdateEngineRequest(), + {}, ], ) def test_update_engine(request_type, transport: str = "grpc"): @@ -2040,7 +2058,7 @@ def test_update_engine(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_engine), "__call__") as call: @@ -2092,7 +2110,8 @@ def test_update_engine_non_empty_request_with_auto_populated_field(): client.update_engine(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == engine_service.UpdateEngineRequest() + request_msg = engine_service.UpdateEngineRequest() + assert args[0] == request_msg def test_update_engine_use_cached_wrapped_rpc(): @@ -2173,9 +2192,14 @@ async def test_update_engine_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_engine_async( - transport: str = "grpc_asyncio", request_type=engine_service.UpdateEngineRequest -): +@pytest.mark.parametrize( + "request_type", + [ + engine_service.UpdateEngineRequest(), + {}, + ], +) +async def test_update_engine_async(request_type, transport: str = "grpc_asyncio"): client = EngineServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2183,7 +2207,7 @@ async def test_update_engine_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_engine), "__call__") as call: @@ -2216,11 +2240,6 @@ async def test_update_engine_async( assert response.disable_analytics is True -@pytest.mark.asyncio -async def test_update_engine_async_from_dict(): - await test_update_engine_async(request_type=dict) - - def test_update_engine_field_headers(): client = EngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2409,8 +2428,8 @@ async def test_update_engine_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - engine_service.GetEngineRequest, - dict, + engine_service.GetEngineRequest(), + {}, ], ) def test_get_engine(request_type, transport: str = "grpc"): @@ -2421,7 +2440,7 @@ def test_get_engine(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_engine), "__call__") as call: @@ -2475,9 +2494,10 @@ def test_get_engine_non_empty_request_with_auto_populated_field(): client.get_engine(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == engine_service.GetEngineRequest( + request_msg = engine_service.GetEngineRequest( name="name_value", ) + assert args[0] == request_msg def test_get_engine_use_cached_wrapped_rpc(): @@ -2556,9 +2576,14 @@ async def test_get_engine_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_engine_async( - transport: str = "grpc_asyncio", request_type=engine_service.GetEngineRequest -): +@pytest.mark.parametrize( + "request_type", + [ + engine_service.GetEngineRequest(), + {}, + ], +) +async def test_get_engine_async(request_type, transport: str = "grpc_asyncio"): client = EngineServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2566,7 +2591,7 @@ async def test_get_engine_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_engine), "__call__") as call: @@ -2599,11 +2624,6 @@ async def test_get_engine_async( assert response.disable_analytics is True -@pytest.mark.asyncio -async def test_get_engine_async_from_dict(): - await test_get_engine_async(request_type=dict) - - def test_get_engine_field_headers(): client = EngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2746,8 +2766,8 @@ async def test_get_engine_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - engine_service.ListEnginesRequest, - dict, + engine_service.ListEnginesRequest(), + {}, ], ) def test_list_engines(request_type, transport: str = "grpc"): @@ -2758,7 +2778,7 @@ def test_list_engines(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_engines), "__call__") as call: @@ -2804,11 +2824,12 @@ def test_list_engines_non_empty_request_with_auto_populated_field(): client.list_engines(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == engine_service.ListEnginesRequest( + request_msg = engine_service.ListEnginesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_engines_use_cached_wrapped_rpc(): @@ -2889,9 +2910,14 @@ async def test_list_engines_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_engines_async( - transport: str = "grpc_asyncio", request_type=engine_service.ListEnginesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + engine_service.ListEnginesRequest(), + {}, + ], +) +async def test_list_engines_async(request_type, transport: str = "grpc_asyncio"): client = EngineServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2899,7 +2925,7 @@ async def test_list_engines_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_engines), "__call__") as call: @@ -2922,11 +2948,6 @@ async def test_list_engines_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_engines_async_from_dict(): - await test_list_engines_async(request_type=dict) - - def test_list_engines_field_headers(): client = EngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4416,7 +4437,6 @@ def test_create_engine_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_service.CreateEngineRequest() - assert args[0] == request_msg @@ -4437,7 +4457,6 @@ def test_delete_engine_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_service.DeleteEngineRequest() - assert args[0] == request_msg @@ -4458,7 +4477,6 @@ def test_update_engine_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_service.UpdateEngineRequest() - assert args[0] == request_msg @@ -4479,7 +4497,6 @@ def test_get_engine_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_service.GetEngineRequest() - assert args[0] == request_msg @@ -4500,7 +4517,6 @@ def test_list_engines_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_service.ListEnginesRequest() - assert args[0] == request_msg @@ -4539,7 +4555,6 @@ async def test_create_engine_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_service.CreateEngineRequest() - assert args[0] == request_msg @@ -4564,7 +4579,6 @@ async def test_delete_engine_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_service.DeleteEngineRequest() - assert args[0] == request_msg @@ -4596,7 +4610,6 @@ async def test_update_engine_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_service.UpdateEngineRequest() - assert args[0] == request_msg @@ -4628,7 +4641,6 @@ async def test_get_engine_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_service.GetEngineRequest() - assert args[0] == request_msg @@ -4655,7 +4667,6 @@ async def test_list_engines_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_service.ListEnginesRequest() - assert args[0] == request_msg @@ -5760,7 +5771,6 @@ def test_create_engine_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_service.CreateEngineRequest() - assert args[0] == request_msg @@ -5780,7 +5790,6 @@ def test_delete_engine_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_service.DeleteEngineRequest() - assert args[0] == request_msg @@ -5800,7 +5809,6 @@ def test_update_engine_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_service.UpdateEngineRequest() - assert args[0] == request_msg @@ -5820,7 +5828,6 @@ def test_get_engine_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_service.GetEngineRequest() - assert args[0] == request_msg @@ -5840,7 +5847,6 @@ def test_list_engines_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_service.ListEnginesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_grounded_generation_service.py b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_grounded_generation_service.py index d3eff0e8e533..fa27bae61c15 100644 --- a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_grounded_generation_service.py +++ b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_grounded_generation_service.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 @@ -108,6 +109,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" @@ -1390,8 +1406,8 @@ def test_grounded_generation_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - grounded_generation_service.GenerateGroundedContentRequest, - dict, + grounded_generation_service.GenerateGroundedContentRequest(), + {}, ], ) def test_stream_generate_grounded_content(request_type, transport: str = "grpc"): @@ -1402,7 +1418,7 @@ def test_stream_generate_grounded_content(request_type, transport: str = "grpc") # Everything is optional in proto3 as far as 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. @@ -1510,9 +1526,15 @@ async def test_stream_generate_grounded_content_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + grounded_generation_service.GenerateGroundedContentRequest(), + {}, + ], +) async def test_stream_generate_grounded_content_async( - transport: str = "grpc_asyncio", - request_type=grounded_generation_service.GenerateGroundedContentRequest, + request_type, transport: str = "grpc_asyncio" ): client = GroundedGenerationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1521,7 +1543,7 @@ async def test_stream_generate_grounded_content_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. @@ -1547,16 +1569,11 @@ async def test_stream_generate_grounded_content_async( ) -@pytest.mark.asyncio -async def test_stream_generate_grounded_content_async_from_dict(): - await test_stream_generate_grounded_content_async(request_type=dict) - - @pytest.mark.parametrize( "request_type", [ - grounded_generation_service.GenerateGroundedContentRequest, - dict, + grounded_generation_service.GenerateGroundedContentRequest(), + {}, ], ) def test_generate_grounded_content(request_type, transport: str = "grpc"): @@ -1567,7 +1584,7 @@ def test_generate_grounded_content(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1616,9 +1633,10 @@ def test_generate_grounded_content_non_empty_request_with_auto_populated_field() client.generate_grounded_content(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == grounded_generation_service.GenerateGroundedContentRequest( + request_msg = grounded_generation_service.GenerateGroundedContentRequest( location="location_value", ) + assert args[0] == request_msg def test_generate_grounded_content_use_cached_wrapped_rpc(): @@ -1704,9 +1722,15 @@ async def test_generate_grounded_content_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + grounded_generation_service.GenerateGroundedContentRequest(), + {}, + ], +) async def test_generate_grounded_content_async( - transport: str = "grpc_asyncio", - request_type=grounded_generation_service.GenerateGroundedContentRequest, + request_type, transport: str = "grpc_asyncio" ): client = GroundedGenerationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1715,7 +1739,7 @@ async def test_generate_grounded_content_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( @@ -1739,11 +1763,6 @@ async def test_generate_grounded_content_async( ) -@pytest.mark.asyncio -async def test_generate_grounded_content_async_from_dict(): - await test_generate_grounded_content_async(request_type=dict) - - def test_generate_grounded_content_field_headers(): client = GroundedGenerationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1814,8 +1833,8 @@ async def test_generate_grounded_content_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - grounded_generation_service.CheckGroundingRequest, - dict, + grounded_generation_service.CheckGroundingRequest(), + {}, ], ) def test_check_grounding(request_type, transport: str = "grpc"): @@ -1826,7 +1845,7 @@ def test_check_grounding(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.check_grounding), "__call__") as call: @@ -1871,10 +1890,11 @@ def test_check_grounding_non_empty_request_with_auto_populated_field(): client.check_grounding(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == grounded_generation_service.CheckGroundingRequest( + request_msg = grounded_generation_service.CheckGroundingRequest( grounding_config="grounding_config_value", answer_candidate="answer_candidate_value", ) + assert args[0] == request_msg def test_check_grounding_use_cached_wrapped_rpc(): @@ -1955,10 +1975,14 @@ async def test_check_grounding_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_check_grounding_async( - transport: str = "grpc_asyncio", - request_type=grounded_generation_service.CheckGroundingRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + grounded_generation_service.CheckGroundingRequest(), + {}, + ], +) +async def test_check_grounding_async(request_type, transport: str = "grpc_asyncio"): client = GroundedGenerationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1966,7 +1990,7 @@ async def test_check_grounding_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.check_grounding), "__call__") as call: @@ -1989,11 +2013,6 @@ async def test_check_grounding_async( assert math.isclose(response.support_score, 0.1432, rel_tol=1e-6) -@pytest.mark.asyncio -async def test_check_grounding_async_from_dict(): - await test_check_grounding_async(request_type=dict) - - def test_check_grounding_field_headers(): client = GroundedGenerationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2446,7 +2465,6 @@ def test_generate_grounded_content_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = grounded_generation_service.GenerateGroundedContentRequest() - assert args[0] == request_msg @@ -2467,7 +2485,6 @@ def test_check_grounding_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = grounded_generation_service.CheckGroundingRequest() - assert args[0] == request_msg @@ -2508,7 +2525,6 @@ async def test_generate_grounded_content_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = grounded_generation_service.GenerateGroundedContentRequest() - assert args[0] == request_msg @@ -2535,7 +2551,6 @@ async def test_check_grounding_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = grounded_generation_service.CheckGroundingRequest() - assert args[0] == request_msg @@ -3056,7 +3071,6 @@ def test_generate_grounded_content_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = grounded_generation_service.GenerateGroundedContentRequest() - assert args[0] == request_msg @@ -3076,7 +3090,6 @@ def test_check_grounding_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = grounded_generation_service.CheckGroundingRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_identity_mapping_store_service.py b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_identity_mapping_store_service.py index a536ad869f03..440eb45137f1 100644 --- a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_identity_mapping_store_service.py +++ b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_identity_mapping_store_service.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 @@ -121,6 +122,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" @@ -1427,8 +1443,8 @@ def test_identity_mapping_store_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - identity_mapping_store_service.CreateIdentityMappingStoreRequest, - dict, + identity_mapping_store_service.CreateIdentityMappingStoreRequest(), + {}, ], ) def test_create_identity_mapping_store(request_type, transport: str = "grpc"): @@ -1439,7 +1455,7 @@ def test_create_identity_mapping_store(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1491,13 +1507,12 @@ def test_create_identity_mapping_store_non_empty_request_with_auto_populated_fie client.create_identity_mapping_store(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == identity_mapping_store_service.CreateIdentityMappingStoreRequest( + request_msg = identity_mapping_store_service.CreateIdentityMappingStoreRequest( cmek_config_name="cmek_config_name_value", parent="parent_value", identity_mapping_store_id="identity_mapping_store_id_value", ) + assert args[0] == request_msg def test_create_identity_mapping_store_use_cached_wrapped_rpc(): @@ -1583,9 +1598,15 @@ async def test_create_identity_mapping_store_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + identity_mapping_store_service.CreateIdentityMappingStoreRequest(), + {}, + ], +) async def test_create_identity_mapping_store_async( - transport: str = "grpc_asyncio", - request_type=identity_mapping_store_service.CreateIdentityMappingStoreRequest, + request_type, transport: str = "grpc_asyncio" ): client = IdentityMappingStoreServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1594,7 +1615,7 @@ async def test_create_identity_mapping_store_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( @@ -1621,11 +1642,6 @@ async def test_create_identity_mapping_store_async( assert response.kms_key_name == "kms_key_name_value" -@pytest.mark.asyncio -async def test_create_identity_mapping_store_async_from_dict(): - await test_create_identity_mapping_store_async(request_type=dict) - - def test_create_identity_mapping_store_field_headers(): client = IdentityMappingStoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1808,8 +1824,8 @@ async def test_create_identity_mapping_store_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - identity_mapping_store_service.GetIdentityMappingStoreRequest, - dict, + identity_mapping_store_service.GetIdentityMappingStoreRequest(), + {}, ], ) def test_get_identity_mapping_store(request_type, transport: str = "grpc"): @@ -1820,7 +1836,7 @@ def test_get_identity_mapping_store(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1870,9 +1886,10 @@ def test_get_identity_mapping_store_non_empty_request_with_auto_populated_field( client.get_identity_mapping_store(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == identity_mapping_store_service.GetIdentityMappingStoreRequest( + request_msg = identity_mapping_store_service.GetIdentityMappingStoreRequest( name="name_value", ) + assert args[0] == request_msg def test_get_identity_mapping_store_use_cached_wrapped_rpc(): @@ -1958,9 +1975,15 @@ async def test_get_identity_mapping_store_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + identity_mapping_store_service.GetIdentityMappingStoreRequest(), + {}, + ], +) async def test_get_identity_mapping_store_async( - transport: str = "grpc_asyncio", - request_type=identity_mapping_store_service.GetIdentityMappingStoreRequest, + request_type, transport: str = "grpc_asyncio" ): client = IdentityMappingStoreServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1969,7 +1992,7 @@ async def test_get_identity_mapping_store_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( @@ -1996,11 +2019,6 @@ async def test_get_identity_mapping_store_async( assert response.kms_key_name == "kms_key_name_value" -@pytest.mark.asyncio -async def test_get_identity_mapping_store_async_from_dict(): - await test_get_identity_mapping_store_async(request_type=dict) - - def test_get_identity_mapping_store_field_headers(): client = IdentityMappingStoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2155,8 +2173,8 @@ async def test_get_identity_mapping_store_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - identity_mapping_store_service.DeleteIdentityMappingStoreRequest, - dict, + identity_mapping_store_service.DeleteIdentityMappingStoreRequest(), + {}, ], ) def test_delete_identity_mapping_store(request_type, transport: str = "grpc"): @@ -2167,7 +2185,7 @@ def test_delete_identity_mapping_store(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2212,11 +2230,10 @@ def test_delete_identity_mapping_store_non_empty_request_with_auto_populated_fie client.delete_identity_mapping_store(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == identity_mapping_store_service.DeleteIdentityMappingStoreRequest( + request_msg = identity_mapping_store_service.DeleteIdentityMappingStoreRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_identity_mapping_store_use_cached_wrapped_rpc(): @@ -2312,9 +2329,15 @@ async def test_delete_identity_mapping_store_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + identity_mapping_store_service.DeleteIdentityMappingStoreRequest(), + {}, + ], +) async def test_delete_identity_mapping_store_async( - transport: str = "grpc_asyncio", - request_type=identity_mapping_store_service.DeleteIdentityMappingStoreRequest, + request_type, transport: str = "grpc_asyncio" ): client = IdentityMappingStoreServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2323,7 +2346,7 @@ async def test_delete_identity_mapping_store_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( @@ -2345,11 +2368,6 @@ async def test_delete_identity_mapping_store_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_identity_mapping_store_async_from_dict(): - await test_delete_identity_mapping_store_async(request_type=dict) - - def test_delete_identity_mapping_store_field_headers(): client = IdentityMappingStoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2504,8 +2522,8 @@ async def test_delete_identity_mapping_store_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - identity_mapping_store_service.ImportIdentityMappingsRequest, - dict, + identity_mapping_store_service.ImportIdentityMappingsRequest(), + {}, ], ) def test_import_identity_mappings(request_type, transport: str = "grpc"): @@ -2516,7 +2534,7 @@ def test_import_identity_mappings(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2561,9 +2579,10 @@ def test_import_identity_mappings_non_empty_request_with_auto_populated_field(): client.import_identity_mappings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == identity_mapping_store_service.ImportIdentityMappingsRequest( + request_msg = identity_mapping_store_service.ImportIdentityMappingsRequest( identity_mapping_store="identity_mapping_store_value", ) + assert args[0] == request_msg def test_import_identity_mappings_use_cached_wrapped_rpc(): @@ -2659,9 +2678,15 @@ async def test_import_identity_mappings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + identity_mapping_store_service.ImportIdentityMappingsRequest(), + {}, + ], +) async def test_import_identity_mappings_async( - transport: str = "grpc_asyncio", - request_type=identity_mapping_store_service.ImportIdentityMappingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = IdentityMappingStoreServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2670,7 +2695,7 @@ async def test_import_identity_mappings_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( @@ -2692,11 +2717,6 @@ async def test_import_identity_mappings_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_import_identity_mappings_async_from_dict(): - await test_import_identity_mappings_async(request_type=dict) - - def test_import_identity_mappings_field_headers(): client = IdentityMappingStoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2765,8 +2785,8 @@ async def test_import_identity_mappings_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - identity_mapping_store_service.PurgeIdentityMappingsRequest, - dict, + identity_mapping_store_service.PurgeIdentityMappingsRequest(), + {}, ], ) def test_purge_identity_mappings(request_type, transport: str = "grpc"): @@ -2777,7 +2797,7 @@ def test_purge_identity_mappings(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2823,10 +2843,11 @@ def test_purge_identity_mappings_non_empty_request_with_auto_populated_field(): client.purge_identity_mappings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == identity_mapping_store_service.PurgeIdentityMappingsRequest( + request_msg = identity_mapping_store_service.PurgeIdentityMappingsRequest( identity_mapping_store="identity_mapping_store_value", filter="filter_value", ) + assert args[0] == request_msg def test_purge_identity_mappings_use_cached_wrapped_rpc(): @@ -2922,9 +2943,15 @@ async def test_purge_identity_mappings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + identity_mapping_store_service.PurgeIdentityMappingsRequest(), + {}, + ], +) async def test_purge_identity_mappings_async( - transport: str = "grpc_asyncio", - request_type=identity_mapping_store_service.PurgeIdentityMappingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = IdentityMappingStoreServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2933,7 +2960,7 @@ async def test_purge_identity_mappings_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( @@ -2955,11 +2982,6 @@ async def test_purge_identity_mappings_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_purge_identity_mappings_async_from_dict(): - await test_purge_identity_mappings_async(request_type=dict) - - def test_purge_identity_mappings_field_headers(): client = IdentityMappingStoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3028,8 +3050,8 @@ async def test_purge_identity_mappings_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - identity_mapping_store_service.ListIdentityMappingsRequest, - dict, + identity_mapping_store_service.ListIdentityMappingsRequest(), + {}, ], ) def test_list_identity_mappings(request_type, transport: str = "grpc"): @@ -3040,7 +3062,7 @@ def test_list_identity_mappings(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3089,10 +3111,11 @@ def test_list_identity_mappings_non_empty_request_with_auto_populated_field(): client.list_identity_mappings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == identity_mapping_store_service.ListIdentityMappingsRequest( + request_msg = identity_mapping_store_service.ListIdentityMappingsRequest( identity_mapping_store="identity_mapping_store_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_identity_mappings_use_cached_wrapped_rpc(): @@ -3178,9 +3201,15 @@ async def test_list_identity_mappings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + identity_mapping_store_service.ListIdentityMappingsRequest(), + {}, + ], +) async def test_list_identity_mappings_async( - transport: str = "grpc_asyncio", - request_type=identity_mapping_store_service.ListIdentityMappingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = IdentityMappingStoreServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3189,7 +3218,7 @@ async def test_list_identity_mappings_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( @@ -3214,11 +3243,6 @@ async def test_list_identity_mappings_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_identity_mappings_async_from_dict(): - await test_list_identity_mappings_async(request_type=dict) - - def test_list_identity_mappings_field_headers(): client = IdentityMappingStoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3492,8 +3516,8 @@ async def test_list_identity_mappings_async_pages(): @pytest.mark.parametrize( "request_type", [ - identity_mapping_store_service.ListIdentityMappingStoresRequest, - dict, + identity_mapping_store_service.ListIdentityMappingStoresRequest(), + {}, ], ) def test_list_identity_mapping_stores(request_type, transport: str = "grpc"): @@ -3504,7 +3528,7 @@ def test_list_identity_mapping_stores(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3555,12 +3579,11 @@ def test_list_identity_mapping_stores_non_empty_request_with_auto_populated_fiel client.list_identity_mapping_stores(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == identity_mapping_store_service.ListIdentityMappingStoresRequest( + request_msg = identity_mapping_store_service.ListIdentityMappingStoresRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_identity_mapping_stores_use_cached_wrapped_rpc(): @@ -3646,9 +3669,15 @@ async def test_list_identity_mapping_stores_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + identity_mapping_store_service.ListIdentityMappingStoresRequest(), + {}, + ], +) async def test_list_identity_mapping_stores_async( - transport: str = "grpc_asyncio", - request_type=identity_mapping_store_service.ListIdentityMappingStoresRequest, + request_type, transport: str = "grpc_asyncio" ): client = IdentityMappingStoreServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3657,7 +3686,7 @@ async def test_list_identity_mapping_stores_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( @@ -3682,11 +3711,6 @@ async def test_list_identity_mapping_stores_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_identity_mapping_stores_async_from_dict(): - await test_list_identity_mapping_stores_async(request_type=dict) - - def test_list_identity_mapping_stores_field_headers(): client = IdentityMappingStoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5524,7 +5548,6 @@ def test_create_identity_mapping_store_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = identity_mapping_store_service.CreateIdentityMappingStoreRequest() - assert args[0] == request_msg @@ -5547,7 +5570,6 @@ def test_get_identity_mapping_store_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = identity_mapping_store_service.GetIdentityMappingStoreRequest() - assert args[0] == request_msg @@ -5570,7 +5592,6 @@ def test_delete_identity_mapping_store_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = identity_mapping_store_service.DeleteIdentityMappingStoreRequest() - assert args[0] == request_msg @@ -5593,7 +5614,6 @@ def test_import_identity_mappings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = identity_mapping_store_service.ImportIdentityMappingsRequest() - assert args[0] == request_msg @@ -5616,7 +5636,6 @@ def test_purge_identity_mappings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = identity_mapping_store_service.PurgeIdentityMappingsRequest() - assert args[0] == request_msg @@ -5641,7 +5660,6 @@ def test_list_identity_mappings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = identity_mapping_store_service.ListIdentityMappingsRequest() - assert args[0] == request_msg @@ -5666,7 +5684,6 @@ def test_list_identity_mapping_stores_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = identity_mapping_store_service.ListIdentityMappingStoresRequest() - assert args[0] == request_msg @@ -5710,7 +5727,6 @@ async def test_create_identity_mapping_store_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = identity_mapping_store_service.CreateIdentityMappingStoreRequest() - assert args[0] == request_msg @@ -5740,7 +5756,6 @@ async def test_get_identity_mapping_store_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = identity_mapping_store_service.GetIdentityMappingStoreRequest() - assert args[0] == request_msg @@ -5767,7 +5782,6 @@ async def test_delete_identity_mapping_store_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = identity_mapping_store_service.DeleteIdentityMappingStoreRequest() - assert args[0] == request_msg @@ -5794,7 +5808,6 @@ async def test_import_identity_mappings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = identity_mapping_store_service.ImportIdentityMappingsRequest() - assert args[0] == request_msg @@ -5821,7 +5834,6 @@ async def test_purge_identity_mappings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = identity_mapping_store_service.PurgeIdentityMappingsRequest() - assert args[0] == request_msg @@ -5850,7 +5862,6 @@ async def test_list_identity_mappings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = identity_mapping_store_service.ListIdentityMappingsRequest() - assert args[0] == request_msg @@ -5879,7 +5890,6 @@ async def test_list_identity_mapping_stores_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = identity_mapping_store_service.ListIdentityMappingStoresRequest() - assert args[0] == request_msg @@ -7167,7 +7177,6 @@ def test_create_identity_mapping_store_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = identity_mapping_store_service.CreateIdentityMappingStoreRequest() - assert args[0] == request_msg @@ -7189,7 +7198,6 @@ def test_get_identity_mapping_store_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = identity_mapping_store_service.GetIdentityMappingStoreRequest() - assert args[0] == request_msg @@ -7211,7 +7219,6 @@ def test_delete_identity_mapping_store_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = identity_mapping_store_service.DeleteIdentityMappingStoreRequest() - assert args[0] == request_msg @@ -7233,7 +7240,6 @@ def test_import_identity_mappings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = identity_mapping_store_service.ImportIdentityMappingsRequest() - assert args[0] == request_msg @@ -7255,7 +7261,6 @@ def test_purge_identity_mappings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = identity_mapping_store_service.PurgeIdentityMappingsRequest() - assert args[0] == request_msg @@ -7277,7 +7282,6 @@ def test_list_identity_mappings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = identity_mapping_store_service.ListIdentityMappingsRequest() - assert args[0] == request_msg @@ -7299,7 +7303,6 @@ def test_list_identity_mapping_stores_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = identity_mapping_store_service.ListIdentityMappingStoresRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_project_service.py b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_project_service.py index 701d7e5e5a33..6bc026216afd 100644 --- a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_project_service.py +++ b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_project_service.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" @@ -1315,8 +1331,8 @@ def test_project_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - project_service.ProvisionProjectRequest, - dict, + project_service.ProvisionProjectRequest(), + {}, ], ) def test_provision_project(request_type, transport: str = "grpc"): @@ -1327,7 +1343,7 @@ def test_provision_project(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1373,10 +1389,11 @@ def test_provision_project_non_empty_request_with_auto_populated_field(): client.provision_project(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == project_service.ProvisionProjectRequest( + request_msg = project_service.ProvisionProjectRequest( name="name_value", data_use_terms_version="data_use_terms_version_value", ) + assert args[0] == request_msg def test_provision_project_use_cached_wrapped_rpc(): @@ -1469,10 +1486,14 @@ async def test_provision_project_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_provision_project_async( - transport: str = "grpc_asyncio", - request_type=project_service.ProvisionProjectRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + project_service.ProvisionProjectRequest(), + {}, + ], +) +async def test_provision_project_async(request_type, transport: str = "grpc_asyncio"): client = ProjectServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1480,7 +1501,7 @@ async def test_provision_project_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( @@ -1502,11 +1523,6 @@ async def test_provision_project_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_provision_project_async_from_dict(): - await test_provision_project_async(request_type=dict) - - def test_provision_project_field_headers(): client = ProjectServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1978,7 +1994,6 @@ def test_provision_project_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = project_service.ProvisionProjectRequest() - assert args[0] == request_msg @@ -2019,7 +2034,6 @@ async def test_provision_project_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = project_service.ProvisionProjectRequest() - assert args[0] == request_msg @@ -2368,7 +2382,6 @@ def test_provision_project_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = project_service.ProvisionProjectRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_rank_service.py b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_rank_service.py index d68d21739c91..299554f83623 100644 --- a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_rank_service.py +++ b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_rank_service.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 @@ -108,6 +109,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" @@ -1273,8 +1289,8 @@ def test_rank_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - rank_service.RankRequest, - dict, + rank_service.RankRequest(), + {}, ], ) def test_rank(request_type, transport: str = "grpc"): @@ -1285,7 +1301,7 @@ def test_rank(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.rank), "__call__") as call: @@ -1328,11 +1344,12 @@ def test_rank_non_empty_request_with_auto_populated_field(): client.rank(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == rank_service.RankRequest( + request_msg = rank_service.RankRequest( ranking_config="ranking_config_value", model="model_value", query="query_value", ) + assert args[0] == request_msg def test_rank_use_cached_wrapped_rpc(): @@ -1410,9 +1427,14 @@ async def test_rank_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio" @pytest.mark.asyncio -async def test_rank_async( - transport: str = "grpc_asyncio", request_type=rank_service.RankRequest -): +@pytest.mark.parametrize( + "request_type", + [ + rank_service.RankRequest(), + {}, + ], +) +async def test_rank_async(request_type, transport: str = "grpc_asyncio"): client = RankServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1420,7 +1442,7 @@ async def test_rank_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.rank), "__call__") as call: @@ -1440,11 +1462,6 @@ async def test_rank_async( assert isinstance(response, rank_service.RankResponse) -@pytest.mark.asyncio -async def test_rank_async_from_dict(): - await test_rank_async(request_type=dict) - - def test_rank_field_headers(): client = RankServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1756,7 +1773,6 @@ def test_rank_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rank_service.RankRequest() - assert args[0] == request_msg @@ -1795,7 +1811,6 @@ async def test_rank_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rank_service.RankRequest() - assert args[0] == request_msg @@ -2139,7 +2154,6 @@ def test_rank_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rank_service.RankRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_recommendation_service.py b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_recommendation_service.py index 7c732e587ca8..c6dcb65ffc63 100644 --- a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_recommendation_service.py +++ b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_recommendation_service.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 @@ -115,6 +116,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" @@ -1380,8 +1396,8 @@ def test_recommendation_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - recommendation_service.RecommendRequest, - dict, + recommendation_service.RecommendRequest(), + {}, ], ) def test_recommend(request_type, transport: str = "grpc"): @@ -1392,7 +1408,7 @@ def test_recommend(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.recommend), "__call__") as call: @@ -1441,10 +1457,11 @@ def test_recommend_non_empty_request_with_auto_populated_field(): client.recommend(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == recommendation_service.RecommendRequest( + request_msg = recommendation_service.RecommendRequest( serving_config="serving_config_value", filter="filter_value", ) + assert args[0] == request_msg def test_recommend_use_cached_wrapped_rpc(): @@ -1523,10 +1540,14 @@ async def test_recommend_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_recommend_async( - transport: str = "grpc_asyncio", - request_type=recommendation_service.RecommendRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + recommendation_service.RecommendRequest(), + {}, + ], +) +async def test_recommend_async(request_type, transport: str = "grpc_asyncio"): client = RecommendationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1534,7 +1555,7 @@ async def test_recommend_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.recommend), "__call__") as call: @@ -1561,11 +1582,6 @@ async def test_recommend_async( assert response.validate_only is True -@pytest.mark.asyncio -async def test_recommend_async_from_dict(): - await test_recommend_async(request_type=dict) - - def test_recommend_field_headers(): client = RecommendationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1879,7 +1895,6 @@ def test_recommend_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommendation_service.RecommendRequest() - assert args[0] == request_msg @@ -1922,7 +1937,6 @@ async def test_recommend_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommendation_service.RecommendRequest() - assert args[0] == request_msg @@ -2287,7 +2301,6 @@ def test_recommend_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommendation_service.RecommendRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_schema_service.py b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_schema_service.py index 0f14884c0459..f500b4a442a6 100644 --- a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_schema_service.py +++ b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_schema_service.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 @@ -116,6 +117,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" @@ -1315,8 +1331,8 @@ def test_schema_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - schema_service.GetSchemaRequest, - dict, + schema_service.GetSchemaRequest(), + {}, ], ) def test_get_schema(request_type, transport: str = "grpc"): @@ -1327,7 +1343,7 @@ def test_get_schema(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_schema), "__call__") as call: @@ -1372,9 +1388,10 @@ def test_get_schema_non_empty_request_with_auto_populated_field(): client.get_schema(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == schema_service.GetSchemaRequest( + request_msg = schema_service.GetSchemaRequest( name="name_value", ) + assert args[0] == request_msg def test_get_schema_use_cached_wrapped_rpc(): @@ -1453,9 +1470,14 @@ async def test_get_schema_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_schema_async( - transport: str = "grpc_asyncio", request_type=schema_service.GetSchemaRequest -): +@pytest.mark.parametrize( + "request_type", + [ + schema_service.GetSchemaRequest(), + {}, + ], +) +async def test_get_schema_async(request_type, transport: str = "grpc_asyncio"): client = SchemaServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1463,7 +1485,7 @@ async def test_get_schema_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_schema), "__call__") as call: @@ -1486,11 +1508,6 @@ async def test_get_schema_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_schema_async_from_dict(): - await test_get_schema_async(request_type=dict) - - def test_get_schema_field_headers(): client = SchemaServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1633,8 +1650,8 @@ async def test_get_schema_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - schema_service.ListSchemasRequest, - dict, + schema_service.ListSchemasRequest(), + {}, ], ) def test_list_schemas(request_type, transport: str = "grpc"): @@ -1645,7 +1662,7 @@ def test_list_schemas(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_schemas), "__call__") as call: @@ -1690,10 +1707,11 @@ def test_list_schemas_non_empty_request_with_auto_populated_field(): client.list_schemas(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == schema_service.ListSchemasRequest( + request_msg = schema_service.ListSchemasRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_schemas_use_cached_wrapped_rpc(): @@ -1774,9 +1792,14 @@ async def test_list_schemas_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_schemas_async( - transport: str = "grpc_asyncio", request_type=schema_service.ListSchemasRequest -): +@pytest.mark.parametrize( + "request_type", + [ + schema_service.ListSchemasRequest(), + {}, + ], +) +async def test_list_schemas_async(request_type, transport: str = "grpc_asyncio"): client = SchemaServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1784,7 +1807,7 @@ async def test_list_schemas_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_schemas), "__call__") as call: @@ -1807,11 +1830,6 @@ async def test_list_schemas_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_schemas_async_from_dict(): - await test_list_schemas_async(request_type=dict) - - def test_list_schemas_field_headers(): client = SchemaServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2148,8 +2166,8 @@ async def test_list_schemas_async_pages(): @pytest.mark.parametrize( "request_type", [ - schema_service.CreateSchemaRequest, - dict, + schema_service.CreateSchemaRequest(), + {}, ], ) def test_create_schema(request_type, transport: str = "grpc"): @@ -2160,7 +2178,7 @@ def test_create_schema(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_schema), "__call__") as call: @@ -2202,10 +2220,11 @@ def test_create_schema_non_empty_request_with_auto_populated_field(): client.create_schema(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == schema_service.CreateSchemaRequest( + request_msg = schema_service.CreateSchemaRequest( parent="parent_value", schema_id="schema_id_value", ) + assert args[0] == request_msg def test_create_schema_use_cached_wrapped_rpc(): @@ -2296,9 +2315,14 @@ async def test_create_schema_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_schema_async( - transport: str = "grpc_asyncio", request_type=schema_service.CreateSchemaRequest -): +@pytest.mark.parametrize( + "request_type", + [ + schema_service.CreateSchemaRequest(), + {}, + ], +) +async def test_create_schema_async(request_type, transport: str = "grpc_asyncio"): client = SchemaServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2306,7 +2330,7 @@ async def test_create_schema_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_schema), "__call__") as call: @@ -2326,11 +2350,6 @@ async def test_create_schema_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_schema_async_from_dict(): - await test_create_schema_async(request_type=dict) - - def test_create_schema_field_headers(): client = SchemaServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2545,8 +2564,8 @@ async def test_create_schema_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - schema_service.UpdateSchemaRequest, - dict, + schema_service.UpdateSchemaRequest(), + {}, ], ) def test_update_schema(request_type, transport: str = "grpc"): @@ -2557,7 +2576,7 @@ def test_update_schema(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_schema), "__call__") as call: @@ -2596,7 +2615,8 @@ def test_update_schema_non_empty_request_with_auto_populated_field(): client.update_schema(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == schema_service.UpdateSchemaRequest() + request_msg = schema_service.UpdateSchemaRequest() + assert args[0] == request_msg def test_update_schema_use_cached_wrapped_rpc(): @@ -2687,9 +2707,14 @@ async def test_update_schema_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_schema_async( - transport: str = "grpc_asyncio", request_type=schema_service.UpdateSchemaRequest -): +@pytest.mark.parametrize( + "request_type", + [ + schema_service.UpdateSchemaRequest(), + {}, + ], +) +async def test_update_schema_async(request_type, transport: str = "grpc_asyncio"): client = SchemaServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2697,7 +2722,7 @@ async def test_update_schema_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_schema), "__call__") as call: @@ -2717,11 +2742,6 @@ async def test_update_schema_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_schema_async_from_dict(): - await test_update_schema_async(request_type=dict) - - def test_update_schema_field_headers(): client = SchemaServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2786,8 +2806,8 @@ async def test_update_schema_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - schema_service.DeleteSchemaRequest, - dict, + schema_service.DeleteSchemaRequest(), + {}, ], ) def test_delete_schema(request_type, transport: str = "grpc"): @@ -2798,7 +2818,7 @@ def test_delete_schema(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_schema), "__call__") as call: @@ -2839,9 +2859,10 @@ def test_delete_schema_non_empty_request_with_auto_populated_field(): client.delete_schema(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == schema_service.DeleteSchemaRequest( + request_msg = schema_service.DeleteSchemaRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_schema_use_cached_wrapped_rpc(): @@ -2932,9 +2953,14 @@ async def test_delete_schema_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_schema_async( - transport: str = "grpc_asyncio", request_type=schema_service.DeleteSchemaRequest -): +@pytest.mark.parametrize( + "request_type", + [ + schema_service.DeleteSchemaRequest(), + {}, + ], +) +async def test_delete_schema_async(request_type, transport: str = "grpc_asyncio"): client = SchemaServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2942,7 +2968,7 @@ async def test_delete_schema_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_schema), "__call__") as call: @@ -2962,11 +2988,6 @@ async def test_delete_schema_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_schema_async_from_dict(): - await test_delete_schema_async(request_type=dict) - - def test_delete_schema_field_headers(): client = SchemaServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4193,7 +4214,6 @@ def test_get_schema_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_service.GetSchemaRequest() - assert args[0] == request_msg @@ -4214,7 +4234,6 @@ def test_list_schemas_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_service.ListSchemasRequest() - assert args[0] == request_msg @@ -4235,7 +4254,6 @@ def test_create_schema_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_service.CreateSchemaRequest() - assert args[0] == request_msg @@ -4256,7 +4274,6 @@ def test_update_schema_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_service.UpdateSchemaRequest() - assert args[0] == request_msg @@ -4277,7 +4294,6 @@ def test_delete_schema_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_service.DeleteSchemaRequest() - assert args[0] == request_msg @@ -4318,7 +4334,6 @@ async def test_get_schema_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_service.GetSchemaRequest() - assert args[0] == request_msg @@ -4345,7 +4360,6 @@ async def test_list_schemas_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_service.ListSchemasRequest() - assert args[0] == request_msg @@ -4370,7 +4384,6 @@ async def test_create_schema_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_service.CreateSchemaRequest() - assert args[0] == request_msg @@ -4395,7 +4408,6 @@ async def test_update_schema_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_service.UpdateSchemaRequest() - assert args[0] == request_msg @@ -4420,7 +4432,6 @@ async def test_delete_schema_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_service.DeleteSchemaRequest() - assert args[0] == request_msg @@ -5435,7 +5446,6 @@ def test_get_schema_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_service.GetSchemaRequest() - assert args[0] == request_msg @@ -5455,7 +5465,6 @@ def test_list_schemas_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_service.ListSchemasRequest() - assert args[0] == request_msg @@ -5475,7 +5484,6 @@ def test_create_schema_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_service.CreateSchemaRequest() - assert args[0] == request_msg @@ -5495,7 +5503,6 @@ def test_update_schema_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_service.UpdateSchemaRequest() - assert args[0] == request_msg @@ -5515,7 +5522,6 @@ def test_delete_schema_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_service.DeleteSchemaRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_search_service.py b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_search_service.py index 0dccafd796d4..de2118f98d9e 100644 --- a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_search_service.py +++ b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_search_service.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 @@ -110,6 +111,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" @@ -1309,8 +1325,8 @@ def test_search_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - search_service.SearchRequest, - dict, + search_service.SearchRequest(), + {}, ], ) def test_search(request_type, transport: str = "grpc"): @@ -1321,7 +1337,7 @@ def test_search(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.search), "__call__") as call: @@ -1387,7 +1403,7 @@ def test_search_non_empty_request_with_auto_populated_field(): client.search(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == search_service.SearchRequest( + request_msg = search_service.SearchRequest( serving_config="serving_config_value", branch="branch_value", query="query_value", @@ -1400,6 +1416,7 @@ def test_search_non_empty_request_with_auto_populated_field(): ranking_expression="ranking_expression_value", session="session_value", ) + assert args[0] == request_msg def test_search_use_cached_wrapped_rpc(): @@ -1478,9 +1495,14 @@ async def test_search_async_use_cached_wrapped_rpc(transport: str = "grpc_asynci @pytest.mark.asyncio -async def test_search_async( - transport: str = "grpc_asyncio", request_type=search_service.SearchRequest -): +@pytest.mark.parametrize( + "request_type", + [ + search_service.SearchRequest(), + {}, + ], +) +async def test_search_async(request_type, transport: str = "grpc_asyncio"): client = SearchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1488,7 +1510,7 @@ async def test_search_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.search), "__call__") as call: @@ -1523,11 +1545,6 @@ async def test_search_async( ) -@pytest.mark.asyncio -async def test_search_async_from_dict(): - await test_search_async(request_type=dict) - - def test_search_field_headers(): client = SearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1786,8 +1803,8 @@ async def test_search_async_pages(): @pytest.mark.parametrize( "request_type", [ - search_service.SearchRequest, - dict, + search_service.SearchRequest(), + {}, ], ) def test_search_lite(request_type, transport: str = "grpc"): @@ -1798,7 +1815,7 @@ def test_search_lite(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.search_lite), "__call__") as call: @@ -1864,7 +1881,7 @@ def test_search_lite_non_empty_request_with_auto_populated_field(): client.search_lite(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == search_service.SearchRequest( + request_msg = search_service.SearchRequest( serving_config="serving_config_value", branch="branch_value", query="query_value", @@ -1877,6 +1894,7 @@ def test_search_lite_non_empty_request_with_auto_populated_field(): ranking_expression="ranking_expression_value", session="session_value", ) + assert args[0] == request_msg def test_search_lite_use_cached_wrapped_rpc(): @@ -1957,9 +1975,14 @@ async def test_search_lite_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_search_lite_async( - transport: str = "grpc_asyncio", request_type=search_service.SearchRequest -): +@pytest.mark.parametrize( + "request_type", + [ + search_service.SearchRequest(), + {}, + ], +) +async def test_search_lite_async(request_type, transport: str = "grpc_asyncio"): client = SearchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1967,7 +1990,7 @@ async def test_search_lite_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.search_lite), "__call__") as call: @@ -2002,11 +2025,6 @@ async def test_search_lite_async( ) -@pytest.mark.asyncio -async def test_search_lite_async_from_dict(): - await test_search_lite_async(request_type=dict) - - def test_search_lite_field_headers(): client = SearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2753,7 +2771,6 @@ def test_search_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = search_service.SearchRequest() - assert args[0] == request_msg @@ -2774,7 +2791,6 @@ def test_search_lite_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = search_service.SearchRequest() - assert args[0] == request_msg @@ -2820,7 +2836,6 @@ async def test_search_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = search_service.SearchRequest() - assert args[0] == request_msg @@ -2852,7 +2867,6 @@ async def test_search_lite_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = search_service.SearchRequest() - assert args[0] == request_msg @@ -3359,7 +3373,6 @@ def test_search_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = search_service.SearchRequest() - assert args[0] == request_msg @@ -3379,7 +3392,6 @@ def test_search_lite_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = search_service.SearchRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_search_tuning_service.py b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_search_tuning_service.py index 5096cfdc7cab..ba72b3f3d537 100644 --- a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_search_tuning_service.py +++ b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_search_tuning_service.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 @@ -116,6 +117,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" @@ -1379,8 +1395,8 @@ def test_search_tuning_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - search_tuning_service.TrainCustomModelRequest, - dict, + search_tuning_service.TrainCustomModelRequest(), + {}, ], ) def test_train_custom_model(request_type, transport: str = "grpc"): @@ -1391,7 +1407,7 @@ def test_train_custom_model(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1438,11 +1454,12 @@ def test_train_custom_model_non_empty_request_with_auto_populated_field(): client.train_custom_model(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == search_tuning_service.TrainCustomModelRequest( + request_msg = search_tuning_service.TrainCustomModelRequest( data_store="data_store_value", model_type="model_type_value", model_id="model_id_value", ) + assert args[0] == request_msg def test_train_custom_model_use_cached_wrapped_rpc(): @@ -1537,10 +1554,14 @@ async def test_train_custom_model_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_train_custom_model_async( - transport: str = "grpc_asyncio", - request_type=search_tuning_service.TrainCustomModelRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + search_tuning_service.TrainCustomModelRequest(), + {}, + ], +) +async def test_train_custom_model_async(request_type, transport: str = "grpc_asyncio"): client = SearchTuningServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1548,7 +1569,7 @@ async def test_train_custom_model_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( @@ -1570,11 +1591,6 @@ async def test_train_custom_model_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_train_custom_model_async_from_dict(): - await test_train_custom_model_async(request_type=dict) - - def test_train_custom_model_field_headers(): client = SearchTuningServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1643,8 +1659,8 @@ async def test_train_custom_model_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - search_tuning_service.ListCustomModelsRequest, - dict, + search_tuning_service.ListCustomModelsRequest(), + {}, ], ) def test_list_custom_models(request_type, transport: str = "grpc"): @@ -1655,7 +1671,7 @@ def test_list_custom_models(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1700,9 +1716,10 @@ def test_list_custom_models_non_empty_request_with_auto_populated_field(): client.list_custom_models(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == search_tuning_service.ListCustomModelsRequest( + request_msg = search_tuning_service.ListCustomModelsRequest( data_store="data_store_value", ) + assert args[0] == request_msg def test_list_custom_models_use_cached_wrapped_rpc(): @@ -1787,10 +1804,14 @@ async def test_list_custom_models_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_custom_models_async( - transport: str = "grpc_asyncio", - request_type=search_tuning_service.ListCustomModelsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + search_tuning_service.ListCustomModelsRequest(), + {}, + ], +) +async def test_list_custom_models_async(request_type, transport: str = "grpc_asyncio"): client = SearchTuningServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1798,7 +1819,7 @@ async def test_list_custom_models_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( @@ -1820,11 +1841,6 @@ async def test_list_custom_models_async( assert isinstance(response, search_tuning_service.ListCustomModelsResponse) -@pytest.mark.asyncio -async def test_list_custom_models_async_from_dict(): - await test_list_custom_models_async(request_type=dict) - - def test_list_custom_models_field_headers(): client = SearchTuningServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2267,7 +2283,6 @@ def test_train_custom_model_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = search_tuning_service.TrainCustomModelRequest() - assert args[0] == request_msg @@ -2290,7 +2305,6 @@ def test_list_custom_models_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = search_tuning_service.ListCustomModelsRequest() - assert args[0] == request_msg @@ -2331,7 +2345,6 @@ async def test_train_custom_model_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = search_tuning_service.TrainCustomModelRequest() - assert args[0] == request_msg @@ -2358,7 +2371,6 @@ async def test_list_custom_models_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = search_tuning_service.ListCustomModelsRequest() - assert args[0] == request_msg @@ -2848,7 +2860,6 @@ def test_train_custom_model_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = search_tuning_service.TrainCustomModelRequest() - assert args[0] == request_msg @@ -2870,7 +2881,6 @@ def test_list_custom_models_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = search_tuning_service.ListCustomModelsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_serving_config_service.py b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_serving_config_service.py index f97c4f369ff7..1c632b22ce04 100644 --- a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_serving_config_service.py +++ b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_serving_config_service.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 @@ -115,6 +116,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" @@ -1378,8 +1394,8 @@ def test_serving_config_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - serving_config_service.UpdateServingConfigRequest, - dict, + serving_config_service.UpdateServingConfigRequest(), + {}, ], ) def test_update_serving_config(request_type, transport: str = "grpc"): @@ -1390,7 +1406,7 @@ def test_update_serving_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( @@ -1464,7 +1480,8 @@ def test_update_serving_config_non_empty_request_with_auto_populated_field(): client.update_serving_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == serving_config_service.UpdateServingConfigRequest() + request_msg = serving_config_service.UpdateServingConfigRequest() + assert args[0] == request_msg def test_update_serving_config_use_cached_wrapped_rpc(): @@ -1550,9 +1567,15 @@ async def test_update_serving_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + serving_config_service.UpdateServingConfigRequest(), + {}, + ], +) async def test_update_serving_config_async( - transport: str = "grpc_asyncio", - request_type=serving_config_service.UpdateServingConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = ServingConfigServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1561,7 +1584,7 @@ async def test_update_serving_config_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( @@ -1614,11 +1637,6 @@ async def test_update_serving_config_async( assert response.promote_control_ids == ["promote_control_ids_value"] -@pytest.mark.asyncio -async def test_update_serving_config_async_from_dict(): - await test_update_serving_config_async(request_type=dict) - - def test_update_serving_config_field_headers(): client = ServingConfigServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2124,7 +2142,6 @@ def test_update_serving_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.UpdateServingConfigRequest() - assert args[0] == request_msg @@ -2181,7 +2198,6 @@ async def test_update_serving_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.UpdateServingConfigRequest() - assert args[0] == request_msg @@ -2722,7 +2738,6 @@ def test_update_serving_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.UpdateServingConfigRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_session_service.py b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_session_service.py index d8d4372e5327..349a2e3a759b 100644 --- a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_session_service.py +++ b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_session_service.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 @@ -119,6 +120,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" @@ -1322,8 +1338,8 @@ def test_session_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - conversational_search_service.CreateSessionRequest, - dict, + conversational_search_service.CreateSessionRequest(), + {}, ], ) def test_create_session(request_type, transport: str = "grpc"): @@ -1334,7 +1350,7 @@ def test_create_session(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_session), "__call__") as call: @@ -1388,9 +1404,10 @@ def test_create_session_non_empty_request_with_auto_populated_field(): client.create_session(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversational_search_service.CreateSessionRequest( + request_msg = conversational_search_service.CreateSessionRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_session_use_cached_wrapped_rpc(): @@ -1471,10 +1488,14 @@ async def test_create_session_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_session_async( - transport: str = "grpc_asyncio", - request_type=conversational_search_service.CreateSessionRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + conversational_search_service.CreateSessionRequest(), + {}, + ], +) +async def test_create_session_async(request_type, transport: str = "grpc_asyncio"): client = SessionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1482,7 +1503,7 @@ async def test_create_session_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_session), "__call__") as call: @@ -1515,11 +1536,6 @@ async def test_create_session_async( assert response.is_pinned is True -@pytest.mark.asyncio -async def test_create_session_async_from_dict(): - await test_create_session_async(request_type=dict) - - def test_create_session_field_headers(): client = SessionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1672,8 +1688,8 @@ async def test_create_session_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversational_search_service.DeleteSessionRequest, - dict, + conversational_search_service.DeleteSessionRequest(), + {}, ], ) def test_delete_session(request_type, transport: str = "grpc"): @@ -1684,7 +1700,7 @@ def test_delete_session(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_session), "__call__") as call: @@ -1725,9 +1741,10 @@ def test_delete_session_non_empty_request_with_auto_populated_field(): client.delete_session(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversational_search_service.DeleteSessionRequest( + request_msg = conversational_search_service.DeleteSessionRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_session_use_cached_wrapped_rpc(): @@ -1808,10 +1825,14 @@ async def test_delete_session_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_session_async( - transport: str = "grpc_asyncio", - request_type=conversational_search_service.DeleteSessionRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + conversational_search_service.DeleteSessionRequest(), + {}, + ], +) +async def test_delete_session_async(request_type, transport: str = "grpc_asyncio"): client = SessionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1819,7 +1840,7 @@ async def test_delete_session_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_session), "__call__") as call: @@ -1837,11 +1858,6 @@ async def test_delete_session_async( assert response is None -@pytest.mark.asyncio -async def test_delete_session_async_from_dict(): - await test_delete_session_async(request_type=dict) - - def test_delete_session_field_headers(): client = SessionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1984,8 +2000,8 @@ async def test_delete_session_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversational_search_service.UpdateSessionRequest, - dict, + conversational_search_service.UpdateSessionRequest(), + {}, ], ) def test_update_session(request_type, transport: str = "grpc"): @@ -1996,7 +2012,7 @@ def test_update_session(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_session), "__call__") as call: @@ -2048,7 +2064,8 @@ def test_update_session_non_empty_request_with_auto_populated_field(): client.update_session(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversational_search_service.UpdateSessionRequest() + request_msg = conversational_search_service.UpdateSessionRequest() + assert args[0] == request_msg def test_update_session_use_cached_wrapped_rpc(): @@ -2129,10 +2146,14 @@ async def test_update_session_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_session_async( - transport: str = "grpc_asyncio", - request_type=conversational_search_service.UpdateSessionRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + conversational_search_service.UpdateSessionRequest(), + {}, + ], +) +async def test_update_session_async(request_type, transport: str = "grpc_asyncio"): client = SessionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2140,7 +2161,7 @@ async def test_update_session_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_session), "__call__") as call: @@ -2173,11 +2194,6 @@ async def test_update_session_async( assert response.is_pinned is True -@pytest.mark.asyncio -async def test_update_session_async_from_dict(): - await test_update_session_async(request_type=dict) - - def test_update_session_field_headers(): client = SessionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2330,8 +2346,8 @@ async def test_update_session_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversational_search_service.GetSessionRequest, - dict, + conversational_search_service.GetSessionRequest(), + {}, ], ) def test_get_session(request_type, transport: str = "grpc"): @@ -2342,7 +2358,7 @@ def test_get_session(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_session), "__call__") as call: @@ -2396,9 +2412,10 @@ def test_get_session_non_empty_request_with_auto_populated_field(): client.get_session(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversational_search_service.GetSessionRequest( + request_msg = conversational_search_service.GetSessionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_session_use_cached_wrapped_rpc(): @@ -2479,10 +2496,14 @@ async def test_get_session_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_session_async( - transport: str = "grpc_asyncio", - request_type=conversational_search_service.GetSessionRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + conversational_search_service.GetSessionRequest(), + {}, + ], +) +async def test_get_session_async(request_type, transport: str = "grpc_asyncio"): client = SessionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2490,7 +2511,7 @@ async def test_get_session_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_session), "__call__") as call: @@ -2523,11 +2544,6 @@ async def test_get_session_async( assert response.is_pinned is True -@pytest.mark.asyncio -async def test_get_session_async_from_dict(): - await test_get_session_async(request_type=dict) - - def test_get_session_field_headers(): client = SessionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2670,8 +2686,8 @@ async def test_get_session_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversational_search_service.ListSessionsRequest, - dict, + conversational_search_service.ListSessionsRequest(), + {}, ], ) def test_list_sessions(request_type, transport: str = "grpc"): @@ -2682,7 +2698,7 @@ def test_list_sessions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_sessions), "__call__") as call: @@ -2729,12 +2745,13 @@ def test_list_sessions_non_empty_request_with_auto_populated_field(): client.list_sessions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversational_search_service.ListSessionsRequest( + request_msg = conversational_search_service.ListSessionsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_sessions_use_cached_wrapped_rpc(): @@ -2815,10 +2832,14 @@ async def test_list_sessions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_sessions_async( - transport: str = "grpc_asyncio", - request_type=conversational_search_service.ListSessionsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + conversational_search_service.ListSessionsRequest(), + {}, + ], +) +async def test_list_sessions_async(request_type, transport: str = "grpc_asyncio"): client = SessionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2826,7 +2847,7 @@ async def test_list_sessions_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_sessions), "__call__") as call: @@ -2849,11 +2870,6 @@ async def test_list_sessions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_sessions_async_from_dict(): - await test_list_sessions_async(request_type=dict) - - def test_list_sessions_field_headers(): client = SessionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4309,7 +4325,6 @@ def test_create_session_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.CreateSessionRequest() - assert args[0] == request_msg @@ -4330,7 +4345,6 @@ def test_delete_session_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.DeleteSessionRequest() - assert args[0] == request_msg @@ -4351,7 +4365,6 @@ def test_update_session_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.UpdateSessionRequest() - assert args[0] == request_msg @@ -4372,7 +4385,6 @@ def test_get_session_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.GetSessionRequest() - assert args[0] == request_msg @@ -4393,7 +4405,6 @@ def test_list_sessions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.ListSessionsRequest() - assert args[0] == request_msg @@ -4439,7 +4450,6 @@ async def test_create_session_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.CreateSessionRequest() - assert args[0] == request_msg @@ -4462,7 +4472,6 @@ async def test_delete_session_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.DeleteSessionRequest() - assert args[0] == request_msg @@ -4494,7 +4503,6 @@ async def test_update_session_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.UpdateSessionRequest() - assert args[0] == request_msg @@ -4526,7 +4534,6 @@ async def test_get_session_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.GetSessionRequest() - assert args[0] == request_msg @@ -4553,7 +4560,6 @@ async def test_list_sessions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.ListSessionsRequest() - assert args[0] == request_msg @@ -5959,7 +5965,6 @@ def test_create_session_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.CreateSessionRequest() - assert args[0] == request_msg @@ -5979,7 +5984,6 @@ def test_delete_session_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.DeleteSessionRequest() - assert args[0] == request_msg @@ -5999,7 +6003,6 @@ def test_update_session_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.UpdateSessionRequest() - assert args[0] == request_msg @@ -6019,7 +6022,6 @@ def test_get_session_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.GetSessionRequest() - assert args[0] == request_msg @@ -6039,7 +6041,6 @@ def test_list_sessions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.ListSessionsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_site_search_engine_service.py b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_site_search_engine_service.py index 3622cfe8f9a8..8fb2c58349d9 100644 --- a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_site_search_engine_service.py +++ b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_site_search_engine_service.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 @@ -118,6 +119,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" @@ -1387,8 +1403,8 @@ def test_site_search_engine_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - site_search_engine_service.GetSiteSearchEngineRequest, - dict, + site_search_engine_service.GetSiteSearchEngineRequest(), + {}, ], ) def test_get_site_search_engine(request_type, transport: str = "grpc"): @@ -1399,7 +1415,7 @@ def test_get_site_search_engine(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1447,9 +1463,10 @@ def test_get_site_search_engine_non_empty_request_with_auto_populated_field(): client.get_site_search_engine(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == site_search_engine_service.GetSiteSearchEngineRequest( + request_msg = site_search_engine_service.GetSiteSearchEngineRequest( name="name_value", ) + assert args[0] == request_msg def test_get_site_search_engine_use_cached_wrapped_rpc(): @@ -1535,9 +1552,15 @@ async def test_get_site_search_engine_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + site_search_engine_service.GetSiteSearchEngineRequest(), + {}, + ], +) async def test_get_site_search_engine_async( - transport: str = "grpc_asyncio", - request_type=site_search_engine_service.GetSiteSearchEngineRequest, + request_type, transport: str = "grpc_asyncio" ): client = SiteSearchEngineServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1546,7 +1569,7 @@ async def test_get_site_search_engine_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( @@ -1571,11 +1594,6 @@ async def test_get_site_search_engine_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_site_search_engine_async_from_dict(): - await test_get_site_search_engine_async(request_type=dict) - - def test_get_site_search_engine_field_headers(): client = SiteSearchEngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1730,8 +1748,8 @@ async def test_get_site_search_engine_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - site_search_engine_service.CreateTargetSiteRequest, - dict, + site_search_engine_service.CreateTargetSiteRequest(), + {}, ], ) def test_create_target_site(request_type, transport: str = "grpc"): @@ -1742,7 +1760,7 @@ def test_create_target_site(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1787,9 +1805,10 @@ def test_create_target_site_non_empty_request_with_auto_populated_field(): client.create_target_site(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == site_search_engine_service.CreateTargetSiteRequest( + request_msg = site_search_engine_service.CreateTargetSiteRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_target_site_use_cached_wrapped_rpc(): @@ -1884,10 +1903,14 @@ async def test_create_target_site_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_target_site_async( - transport: str = "grpc_asyncio", - request_type=site_search_engine_service.CreateTargetSiteRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + site_search_engine_service.CreateTargetSiteRequest(), + {}, + ], +) +async def test_create_target_site_async(request_type, transport: str = "grpc_asyncio"): client = SiteSearchEngineServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1895,7 +1918,7 @@ async def test_create_target_site_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( @@ -1917,11 +1940,6 @@ async def test_create_target_site_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_target_site_async_from_dict(): - await test_create_target_site_async(request_type=dict) - - def test_create_target_site_field_headers(): client = SiteSearchEngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2086,8 +2104,8 @@ async def test_create_target_site_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - site_search_engine_service.BatchCreateTargetSitesRequest, - dict, + site_search_engine_service.BatchCreateTargetSitesRequest(), + {}, ], ) def test_batch_create_target_sites(request_type, transport: str = "grpc"): @@ -2098,7 +2116,7 @@ def test_batch_create_target_sites(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2143,9 +2161,10 @@ def test_batch_create_target_sites_non_empty_request_with_auto_populated_field() client.batch_create_target_sites(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == site_search_engine_service.BatchCreateTargetSitesRequest( + request_msg = site_search_engine_service.BatchCreateTargetSitesRequest( parent="parent_value", ) + assert args[0] == request_msg def test_batch_create_target_sites_use_cached_wrapped_rpc(): @@ -2241,9 +2260,15 @@ async def test_batch_create_target_sites_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + site_search_engine_service.BatchCreateTargetSitesRequest(), + {}, + ], +) async def test_batch_create_target_sites_async( - transport: str = "grpc_asyncio", - request_type=site_search_engine_service.BatchCreateTargetSitesRequest, + request_type, transport: str = "grpc_asyncio" ): client = SiteSearchEngineServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2252,7 +2277,7 @@ async def test_batch_create_target_sites_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( @@ -2274,11 +2299,6 @@ async def test_batch_create_target_sites_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_batch_create_target_sites_async_from_dict(): - await test_batch_create_target_sites_async(request_type=dict) - - def test_batch_create_target_sites_field_headers(): client = SiteSearchEngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2347,8 +2367,8 @@ async def test_batch_create_target_sites_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - site_search_engine_service.GetTargetSiteRequest, - dict, + site_search_engine_service.GetTargetSiteRequest(), + {}, ], ) def test_get_target_site(request_type, transport: str = "grpc"): @@ -2359,7 +2379,7 @@ def test_get_target_site(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_target_site), "__call__") as call: @@ -2417,9 +2437,10 @@ def test_get_target_site_non_empty_request_with_auto_populated_field(): client.get_target_site(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == site_search_engine_service.GetTargetSiteRequest( + request_msg = site_search_engine_service.GetTargetSiteRequest( name="name_value", ) + assert args[0] == request_msg def test_get_target_site_use_cached_wrapped_rpc(): @@ -2500,10 +2521,14 @@ async def test_get_target_site_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_target_site_async( - transport: str = "grpc_asyncio", - request_type=site_search_engine_service.GetTargetSiteRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + site_search_engine_service.GetTargetSiteRequest(), + {}, + ], +) +async def test_get_target_site_async(request_type, transport: str = "grpc_asyncio"): client = SiteSearchEngineServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2511,7 +2536,7 @@ async def test_get_target_site_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_target_site), "__call__") as call: @@ -2548,11 +2573,6 @@ async def test_get_target_site_async( ) -@pytest.mark.asyncio -async def test_get_target_site_async_from_dict(): - await test_get_target_site_async(request_type=dict) - - def test_get_target_site_field_headers(): client = SiteSearchEngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2699,8 +2719,8 @@ async def test_get_target_site_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - site_search_engine_service.UpdateTargetSiteRequest, - dict, + site_search_engine_service.UpdateTargetSiteRequest(), + {}, ], ) def test_update_target_site(request_type, transport: str = "grpc"): @@ -2711,7 +2731,7 @@ def test_update_target_site(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2754,7 +2774,8 @@ def test_update_target_site_non_empty_request_with_auto_populated_field(): client.update_target_site(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == site_search_engine_service.UpdateTargetSiteRequest() + request_msg = site_search_engine_service.UpdateTargetSiteRequest() + assert args[0] == request_msg def test_update_target_site_use_cached_wrapped_rpc(): @@ -2849,10 +2870,14 @@ async def test_update_target_site_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_target_site_async( - transport: str = "grpc_asyncio", - request_type=site_search_engine_service.UpdateTargetSiteRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + site_search_engine_service.UpdateTargetSiteRequest(), + {}, + ], +) +async def test_update_target_site_async(request_type, transport: str = "grpc_asyncio"): client = SiteSearchEngineServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2860,7 +2885,7 @@ async def test_update_target_site_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( @@ -2882,11 +2907,6 @@ async def test_update_target_site_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_target_site_async_from_dict(): - await test_update_target_site_async(request_type=dict) - - def test_update_target_site_field_headers(): client = SiteSearchEngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3041,8 +3061,8 @@ async def test_update_target_site_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - site_search_engine_service.DeleteTargetSiteRequest, - dict, + site_search_engine_service.DeleteTargetSiteRequest(), + {}, ], ) def test_delete_target_site(request_type, transport: str = "grpc"): @@ -3053,7 +3073,7 @@ def test_delete_target_site(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3098,9 +3118,10 @@ def test_delete_target_site_non_empty_request_with_auto_populated_field(): client.delete_target_site(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == site_search_engine_service.DeleteTargetSiteRequest( + request_msg = site_search_engine_service.DeleteTargetSiteRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_target_site_use_cached_wrapped_rpc(): @@ -3195,10 +3216,14 @@ async def test_delete_target_site_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_target_site_async( - transport: str = "grpc_asyncio", - request_type=site_search_engine_service.DeleteTargetSiteRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + site_search_engine_service.DeleteTargetSiteRequest(), + {}, + ], +) +async def test_delete_target_site_async(request_type, transport: str = "grpc_asyncio"): client = SiteSearchEngineServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3206,7 +3231,7 @@ async def test_delete_target_site_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( @@ -3228,11 +3253,6 @@ async def test_delete_target_site_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_target_site_async_from_dict(): - await test_delete_target_site_async(request_type=dict) - - def test_delete_target_site_field_headers(): client = SiteSearchEngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3387,8 +3407,8 @@ async def test_delete_target_site_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - site_search_engine_service.ListTargetSitesRequest, - dict, + site_search_engine_service.ListTargetSitesRequest(), + {}, ], ) def test_list_target_sites(request_type, transport: str = "grpc"): @@ -3399,7 +3419,7 @@ def test_list_target_sites(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3450,10 +3470,11 @@ def test_list_target_sites_non_empty_request_with_auto_populated_field(): client.list_target_sites(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == site_search_engine_service.ListTargetSitesRequest( + request_msg = site_search_engine_service.ListTargetSitesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_target_sites_use_cached_wrapped_rpc(): @@ -3536,10 +3557,14 @@ async def test_list_target_sites_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_target_sites_async( - transport: str = "grpc_asyncio", - request_type=site_search_engine_service.ListTargetSitesRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + site_search_engine_service.ListTargetSitesRequest(), + {}, + ], +) +async def test_list_target_sites_async(request_type, transport: str = "grpc_asyncio"): client = SiteSearchEngineServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3547,7 +3572,7 @@ async def test_list_target_sites_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( @@ -3574,11 +3599,6 @@ async def test_list_target_sites_async( assert response.total_size == 1086 -@pytest.mark.asyncio -async def test_list_target_sites_async_from_dict(): - await test_list_target_sites_async(request_type=dict) - - def test_list_target_sites_field_headers(): client = SiteSearchEngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3931,8 +3951,8 @@ async def test_list_target_sites_async_pages(): @pytest.mark.parametrize( "request_type", [ - site_search_engine_service.CreateSitemapRequest, - dict, + site_search_engine_service.CreateSitemapRequest(), + {}, ], ) def test_create_sitemap(request_type, transport: str = "grpc"): @@ -3943,7 +3963,7 @@ def test_create_sitemap(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_sitemap), "__call__") as call: @@ -3984,9 +4004,10 @@ def test_create_sitemap_non_empty_request_with_auto_populated_field(): client.create_sitemap(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == site_search_engine_service.CreateSitemapRequest( + request_msg = site_search_engine_service.CreateSitemapRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_sitemap_use_cached_wrapped_rpc(): @@ -4077,10 +4098,14 @@ async def test_create_sitemap_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_sitemap_async( - transport: str = "grpc_asyncio", - request_type=site_search_engine_service.CreateSitemapRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + site_search_engine_service.CreateSitemapRequest(), + {}, + ], +) +async def test_create_sitemap_async(request_type, transport: str = "grpc_asyncio"): client = SiteSearchEngineServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4088,7 +4113,7 @@ async def test_create_sitemap_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_sitemap), "__call__") as call: @@ -4108,11 +4133,6 @@ async def test_create_sitemap_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_sitemap_async_from_dict(): - await test_create_sitemap_async(request_type=dict) - - def test_create_sitemap_field_headers(): client = SiteSearchEngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4269,8 +4289,8 @@ async def test_create_sitemap_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - site_search_engine_service.DeleteSitemapRequest, - dict, + site_search_engine_service.DeleteSitemapRequest(), + {}, ], ) def test_delete_sitemap(request_type, transport: str = "grpc"): @@ -4281,7 +4301,7 @@ def test_delete_sitemap(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_sitemap), "__call__") as call: @@ -4322,9 +4342,10 @@ def test_delete_sitemap_non_empty_request_with_auto_populated_field(): client.delete_sitemap(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == site_search_engine_service.DeleteSitemapRequest( + request_msg = site_search_engine_service.DeleteSitemapRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_sitemap_use_cached_wrapped_rpc(): @@ -4415,10 +4436,14 @@ async def test_delete_sitemap_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_sitemap_async( - transport: str = "grpc_asyncio", - request_type=site_search_engine_service.DeleteSitemapRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + site_search_engine_service.DeleteSitemapRequest(), + {}, + ], +) +async def test_delete_sitemap_async(request_type, transport: str = "grpc_asyncio"): client = SiteSearchEngineServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4426,7 +4451,7 @@ async def test_delete_sitemap_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_sitemap), "__call__") as call: @@ -4446,11 +4471,6 @@ async def test_delete_sitemap_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_sitemap_async_from_dict(): - await test_delete_sitemap_async(request_type=dict) - - def test_delete_sitemap_field_headers(): client = SiteSearchEngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4597,8 +4617,8 @@ async def test_delete_sitemap_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - site_search_engine_service.FetchSitemapsRequest, - dict, + site_search_engine_service.FetchSitemapsRequest(), + {}, ], ) def test_fetch_sitemaps(request_type, transport: str = "grpc"): @@ -4609,7 +4629,7 @@ def test_fetch_sitemaps(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.fetch_sitemaps), "__call__") as call: @@ -4650,9 +4670,10 @@ def test_fetch_sitemaps_non_empty_request_with_auto_populated_field(): client.fetch_sitemaps(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == site_search_engine_service.FetchSitemapsRequest( + request_msg = site_search_engine_service.FetchSitemapsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_fetch_sitemaps_use_cached_wrapped_rpc(): @@ -4733,10 +4754,14 @@ async def test_fetch_sitemaps_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_fetch_sitemaps_async( - transport: str = "grpc_asyncio", - request_type=site_search_engine_service.FetchSitemapsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + site_search_engine_service.FetchSitemapsRequest(), + {}, + ], +) +async def test_fetch_sitemaps_async(request_type, transport: str = "grpc_asyncio"): client = SiteSearchEngineServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4744,7 +4769,7 @@ async def test_fetch_sitemaps_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.fetch_sitemaps), "__call__") as call: @@ -4764,11 +4789,6 @@ async def test_fetch_sitemaps_async( assert isinstance(response, site_search_engine_service.FetchSitemapsResponse) -@pytest.mark.asyncio -async def test_fetch_sitemaps_async_from_dict(): - await test_fetch_sitemaps_async(request_type=dict) - - def test_fetch_sitemaps_field_headers(): client = SiteSearchEngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4915,8 +4935,8 @@ async def test_fetch_sitemaps_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - site_search_engine_service.EnableAdvancedSiteSearchRequest, - dict, + site_search_engine_service.EnableAdvancedSiteSearchRequest(), + {}, ], ) def test_enable_advanced_site_search(request_type, transport: str = "grpc"): @@ -4927,7 +4947,7 @@ def test_enable_advanced_site_search(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4972,9 +4992,10 @@ def test_enable_advanced_site_search_non_empty_request_with_auto_populated_field client.enable_advanced_site_search(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == site_search_engine_service.EnableAdvancedSiteSearchRequest( + request_msg = site_search_engine_service.EnableAdvancedSiteSearchRequest( site_search_engine="site_search_engine_value", ) + assert args[0] == request_msg def test_enable_advanced_site_search_use_cached_wrapped_rpc(): @@ -5070,9 +5091,15 @@ async def test_enable_advanced_site_search_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + site_search_engine_service.EnableAdvancedSiteSearchRequest(), + {}, + ], +) async def test_enable_advanced_site_search_async( - transport: str = "grpc_asyncio", - request_type=site_search_engine_service.EnableAdvancedSiteSearchRequest, + request_type, transport: str = "grpc_asyncio" ): client = SiteSearchEngineServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5081,7 +5108,7 @@ async def test_enable_advanced_site_search_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( @@ -5103,11 +5130,6 @@ async def test_enable_advanced_site_search_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_enable_advanced_site_search_async_from_dict(): - await test_enable_advanced_site_search_async(request_type=dict) - - def test_enable_advanced_site_search_field_headers(): client = SiteSearchEngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5176,8 +5198,8 @@ async def test_enable_advanced_site_search_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - site_search_engine_service.DisableAdvancedSiteSearchRequest, - dict, + site_search_engine_service.DisableAdvancedSiteSearchRequest(), + {}, ], ) def test_disable_advanced_site_search(request_type, transport: str = "grpc"): @@ -5188,7 +5210,7 @@ def test_disable_advanced_site_search(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5233,9 +5255,10 @@ def test_disable_advanced_site_search_non_empty_request_with_auto_populated_fiel client.disable_advanced_site_search(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == site_search_engine_service.DisableAdvancedSiteSearchRequest( + request_msg = site_search_engine_service.DisableAdvancedSiteSearchRequest( site_search_engine="site_search_engine_value", ) + assert args[0] == request_msg def test_disable_advanced_site_search_use_cached_wrapped_rpc(): @@ -5331,9 +5354,15 @@ async def test_disable_advanced_site_search_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + site_search_engine_service.DisableAdvancedSiteSearchRequest(), + {}, + ], +) async def test_disable_advanced_site_search_async( - transport: str = "grpc_asyncio", - request_type=site_search_engine_service.DisableAdvancedSiteSearchRequest, + request_type, transport: str = "grpc_asyncio" ): client = SiteSearchEngineServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5342,7 +5371,7 @@ async def test_disable_advanced_site_search_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( @@ -5364,11 +5393,6 @@ async def test_disable_advanced_site_search_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_disable_advanced_site_search_async_from_dict(): - await test_disable_advanced_site_search_async(request_type=dict) - - def test_disable_advanced_site_search_field_headers(): client = SiteSearchEngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5437,8 +5461,8 @@ async def test_disable_advanced_site_search_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - site_search_engine_service.RecrawlUrisRequest, - dict, + site_search_engine_service.RecrawlUrisRequest(), + {}, ], ) def test_recrawl_uris(request_type, transport: str = "grpc"): @@ -5449,7 +5473,7 @@ def test_recrawl_uris(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.recrawl_uris), "__call__") as call: @@ -5491,10 +5515,11 @@ def test_recrawl_uris_non_empty_request_with_auto_populated_field(): client.recrawl_uris(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == site_search_engine_service.RecrawlUrisRequest( + request_msg = site_search_engine_service.RecrawlUrisRequest( site_search_engine="site_search_engine_value", site_credential="site_credential_value", ) + assert args[0] == request_msg def test_recrawl_uris_use_cached_wrapped_rpc(): @@ -5585,10 +5610,14 @@ async def test_recrawl_uris_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_recrawl_uris_async( - transport: str = "grpc_asyncio", - request_type=site_search_engine_service.RecrawlUrisRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + site_search_engine_service.RecrawlUrisRequest(), + {}, + ], +) +async def test_recrawl_uris_async(request_type, transport: str = "grpc_asyncio"): client = SiteSearchEngineServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5596,7 +5625,7 @@ async def test_recrawl_uris_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.recrawl_uris), "__call__") as call: @@ -5616,11 +5645,6 @@ async def test_recrawl_uris_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_recrawl_uris_async_from_dict(): - await test_recrawl_uris_async(request_type=dict) - - def test_recrawl_uris_field_headers(): client = SiteSearchEngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5685,8 +5709,8 @@ async def test_recrawl_uris_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - site_search_engine_service.BatchVerifyTargetSitesRequest, - dict, + site_search_engine_service.BatchVerifyTargetSitesRequest(), + {}, ], ) def test_batch_verify_target_sites(request_type, transport: str = "grpc"): @@ -5697,7 +5721,7 @@ def test_batch_verify_target_sites(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5742,9 +5766,10 @@ def test_batch_verify_target_sites_non_empty_request_with_auto_populated_field() client.batch_verify_target_sites(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == site_search_engine_service.BatchVerifyTargetSitesRequest( + request_msg = site_search_engine_service.BatchVerifyTargetSitesRequest( parent="parent_value", ) + assert args[0] == request_msg def test_batch_verify_target_sites_use_cached_wrapped_rpc(): @@ -5840,9 +5865,15 @@ async def test_batch_verify_target_sites_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + site_search_engine_service.BatchVerifyTargetSitesRequest(), + {}, + ], +) async def test_batch_verify_target_sites_async( - transport: str = "grpc_asyncio", - request_type=site_search_engine_service.BatchVerifyTargetSitesRequest, + request_type, transport: str = "grpc_asyncio" ): client = SiteSearchEngineServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5851,7 +5882,7 @@ async def test_batch_verify_target_sites_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( @@ -5873,11 +5904,6 @@ async def test_batch_verify_target_sites_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_batch_verify_target_sites_async_from_dict(): - await test_batch_verify_target_sites_async(request_type=dict) - - def test_batch_verify_target_sites_field_headers(): client = SiteSearchEngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5946,8 +5972,8 @@ async def test_batch_verify_target_sites_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - site_search_engine_service.FetchDomainVerificationStatusRequest, - dict, + site_search_engine_service.FetchDomainVerificationStatusRequest(), + {}, ], ) def test_fetch_domain_verification_status(request_type, transport: str = "grpc"): @@ -5958,7 +5984,7 @@ def test_fetch_domain_verification_status(request_type, transport: str = "grpc") # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6011,12 +6037,11 @@ def test_fetch_domain_verification_status_non_empty_request_with_auto_populated_ client.fetch_domain_verification_status(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == site_search_engine_service.FetchDomainVerificationStatusRequest( + request_msg = site_search_engine_service.FetchDomainVerificationStatusRequest( site_search_engine="site_search_engine_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_fetch_domain_verification_status_use_cached_wrapped_rpc(): @@ -6102,9 +6127,15 @@ async def test_fetch_domain_verification_status_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + site_search_engine_service.FetchDomainVerificationStatusRequest(), + {}, + ], +) async def test_fetch_domain_verification_status_async( - transport: str = "grpc_asyncio", - request_type=site_search_engine_service.FetchDomainVerificationStatusRequest, + request_type, transport: str = "grpc_asyncio" ): client = SiteSearchEngineServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -6113,7 +6144,7 @@ async def test_fetch_domain_verification_status_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( @@ -6140,11 +6171,6 @@ async def test_fetch_domain_verification_status_async( assert response.total_size == 1086 -@pytest.mark.asyncio -async def test_fetch_domain_verification_status_async_from_dict(): - await test_fetch_domain_verification_status_async(request_type=dict) - - def test_fetch_domain_verification_status_field_headers(): client = SiteSearchEngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9146,7 +9172,6 @@ def test_get_site_search_engine_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.GetSiteSearchEngineRequest() - assert args[0] == request_msg @@ -9169,7 +9194,6 @@ def test_create_target_site_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.CreateTargetSiteRequest() - assert args[0] == request_msg @@ -9192,7 +9216,6 @@ def test_batch_create_target_sites_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.BatchCreateTargetSitesRequest() - assert args[0] == request_msg @@ -9213,7 +9236,6 @@ def test_get_target_site_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.GetTargetSiteRequest() - assert args[0] == request_msg @@ -9236,7 +9258,6 @@ def test_update_target_site_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.UpdateTargetSiteRequest() - assert args[0] == request_msg @@ -9259,7 +9280,6 @@ def test_delete_target_site_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.DeleteTargetSiteRequest() - assert args[0] == request_msg @@ -9282,7 +9302,6 @@ def test_list_target_sites_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.ListTargetSitesRequest() - assert args[0] == request_msg @@ -9303,7 +9322,6 @@ def test_create_sitemap_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.CreateSitemapRequest() - assert args[0] == request_msg @@ -9324,7 +9342,6 @@ def test_delete_sitemap_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.DeleteSitemapRequest() - assert args[0] == request_msg @@ -9345,7 +9362,6 @@ def test_fetch_sitemaps_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.FetchSitemapsRequest() - assert args[0] == request_msg @@ -9368,7 +9384,6 @@ def test_enable_advanced_site_search_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.EnableAdvancedSiteSearchRequest() - assert args[0] == request_msg @@ -9391,7 +9406,6 @@ def test_disable_advanced_site_search_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.DisableAdvancedSiteSearchRequest() - assert args[0] == request_msg @@ -9412,7 +9426,6 @@ def test_recrawl_uris_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.RecrawlUrisRequest() - assert args[0] == request_msg @@ -9435,7 +9448,6 @@ def test_batch_verify_target_sites_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.BatchVerifyTargetSitesRequest() - assert args[0] == request_msg @@ -9460,7 +9472,6 @@ def test_fetch_domain_verification_status_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.FetchDomainVerificationStatusRequest() - assert args[0] == request_msg @@ -9503,7 +9514,6 @@ async def test_get_site_search_engine_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.GetSiteSearchEngineRequest() - assert args[0] == request_msg @@ -9530,7 +9540,6 @@ async def test_create_target_site_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.CreateTargetSiteRequest() - assert args[0] == request_msg @@ -9557,7 +9566,6 @@ async def test_batch_create_target_sites_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.BatchCreateTargetSitesRequest() - assert args[0] == request_msg @@ -9590,7 +9598,6 @@ async def test_get_target_site_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.GetTargetSiteRequest() - assert args[0] == request_msg @@ -9617,7 +9624,6 @@ async def test_update_target_site_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.UpdateTargetSiteRequest() - assert args[0] == request_msg @@ -9644,7 +9650,6 @@ async def test_delete_target_site_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.DeleteTargetSiteRequest() - assert args[0] == request_msg @@ -9674,7 +9679,6 @@ async def test_list_target_sites_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.ListTargetSitesRequest() - assert args[0] == request_msg @@ -9699,7 +9703,6 @@ async def test_create_sitemap_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.CreateSitemapRequest() - assert args[0] == request_msg @@ -9724,7 +9727,6 @@ async def test_delete_sitemap_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.DeleteSitemapRequest() - assert args[0] == request_msg @@ -9749,7 +9751,6 @@ async def test_fetch_sitemaps_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.FetchSitemapsRequest() - assert args[0] == request_msg @@ -9776,7 +9777,6 @@ async def test_enable_advanced_site_search_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.EnableAdvancedSiteSearchRequest() - assert args[0] == request_msg @@ -9803,7 +9803,6 @@ async def test_disable_advanced_site_search_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.DisableAdvancedSiteSearchRequest() - assert args[0] == request_msg @@ -9828,7 +9827,6 @@ async def test_recrawl_uris_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.RecrawlUrisRequest() - assert args[0] == request_msg @@ -9855,7 +9853,6 @@ async def test_batch_verify_target_sites_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.BatchVerifyTargetSitesRequest() - assert args[0] == request_msg @@ -9885,7 +9882,6 @@ async def test_fetch_domain_verification_status_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.FetchDomainVerificationStatusRequest() - assert args[0] == request_msg @@ -12386,7 +12382,6 @@ def test_get_site_search_engine_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.GetSiteSearchEngineRequest() - assert args[0] == request_msg @@ -12408,7 +12403,6 @@ def test_create_target_site_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.CreateTargetSiteRequest() - assert args[0] == request_msg @@ -12430,7 +12424,6 @@ def test_batch_create_target_sites_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.BatchCreateTargetSitesRequest() - assert args[0] == request_msg @@ -12450,7 +12443,6 @@ def test_get_target_site_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.GetTargetSiteRequest() - assert args[0] == request_msg @@ -12472,7 +12464,6 @@ def test_update_target_site_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.UpdateTargetSiteRequest() - assert args[0] == request_msg @@ -12494,7 +12485,6 @@ def test_delete_target_site_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.DeleteTargetSiteRequest() - assert args[0] == request_msg @@ -12516,7 +12506,6 @@ def test_list_target_sites_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.ListTargetSitesRequest() - assert args[0] == request_msg @@ -12536,7 +12525,6 @@ def test_create_sitemap_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.CreateSitemapRequest() - assert args[0] == request_msg @@ -12556,7 +12544,6 @@ def test_delete_sitemap_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.DeleteSitemapRequest() - assert args[0] == request_msg @@ -12576,7 +12563,6 @@ def test_fetch_sitemaps_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.FetchSitemapsRequest() - assert args[0] == request_msg @@ -12598,7 +12584,6 @@ def test_enable_advanced_site_search_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.EnableAdvancedSiteSearchRequest() - assert args[0] == request_msg @@ -12620,7 +12605,6 @@ def test_disable_advanced_site_search_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.DisableAdvancedSiteSearchRequest() - assert args[0] == request_msg @@ -12640,7 +12624,6 @@ def test_recrawl_uris_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.RecrawlUrisRequest() - assert args[0] == request_msg @@ -12662,7 +12645,6 @@ def test_batch_verify_target_sites_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.BatchVerifyTargetSitesRequest() - assert args[0] == request_msg @@ -12684,7 +12666,6 @@ def test_fetch_domain_verification_status_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.FetchDomainVerificationStatusRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_user_event_service.py b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_user_event_service.py index 68d4ea8df471..9558305d6a45 100644 --- a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_user_event_service.py +++ b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_user_event_service.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 @@ -123,6 +124,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" @@ -1356,8 +1372,8 @@ def test_user_event_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - user_event_service.WriteUserEventRequest, - dict, + user_event_service.WriteUserEventRequest(), + {}, ], ) def test_write_user_event(request_type, transport: str = "grpc"): @@ -1368,7 +1384,7 @@ def test_write_user_event(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.write_user_event), "__call__") as call: @@ -1432,9 +1448,10 @@ def test_write_user_event_non_empty_request_with_auto_populated_field(): client.write_user_event(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == user_event_service.WriteUserEventRequest( + request_msg = user_event_service.WriteUserEventRequest( parent="parent_value", ) + assert args[0] == request_msg def test_write_user_event_use_cached_wrapped_rpc(): @@ -1517,10 +1534,14 @@ async def test_write_user_event_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_write_user_event_async( - transport: str = "grpc_asyncio", - request_type=user_event_service.WriteUserEventRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + user_event_service.WriteUserEventRequest(), + {}, + ], +) +async def test_write_user_event_async(request_type, transport: str = "grpc_asyncio"): client = UserEventServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1528,7 +1549,7 @@ async def test_write_user_event_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.write_user_event), "__call__") as call: @@ -1571,11 +1592,6 @@ async def test_write_user_event_async( assert response.promotion_ids == ["promotion_ids_value"] -@pytest.mark.asyncio -async def test_write_user_event_async_from_dict(): - await test_write_user_event_async(request_type=dict) - - def test_write_user_event_field_headers(): client = UserEventServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1640,8 +1656,8 @@ async def test_write_user_event_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - user_event_service.CollectUserEventRequest, - dict, + user_event_service.CollectUserEventRequest(), + {}, ], ) def test_collect_user_event(request_type, transport: str = "grpc"): @@ -1652,7 +1668,7 @@ def test_collect_user_event(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1704,11 +1720,12 @@ def test_collect_user_event_non_empty_request_with_auto_populated_field(): client.collect_user_event(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == user_event_service.CollectUserEventRequest( + request_msg = user_event_service.CollectUserEventRequest( parent="parent_value", user_event="user_event_value", uri="uri_value", ) + assert args[0] == request_msg def test_collect_user_event_use_cached_wrapped_rpc(): @@ -1793,10 +1810,14 @@ async def test_collect_user_event_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_collect_user_event_async( - transport: str = "grpc_asyncio", - request_type=user_event_service.CollectUserEventRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + user_event_service.CollectUserEventRequest(), + {}, + ], +) +async def test_collect_user_event_async(request_type, transport: str = "grpc_asyncio"): client = UserEventServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1804,7 +1825,7 @@ async def test_collect_user_event_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( @@ -1831,11 +1852,6 @@ async def test_collect_user_event_async( assert response.data == b"data_blob" -@pytest.mark.asyncio -async def test_collect_user_event_async_from_dict(): - await test_collect_user_event_async(request_type=dict) - - def test_collect_user_event_field_headers(): client = UserEventServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1904,8 +1920,8 @@ async def test_collect_user_event_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - purge_config.PurgeUserEventsRequest, - dict, + purge_config.PurgeUserEventsRequest(), + {}, ], ) def test_purge_user_events(request_type, transport: str = "grpc"): @@ -1916,7 +1932,7 @@ def test_purge_user_events(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1962,10 +1978,11 @@ def test_purge_user_events_non_empty_request_with_auto_populated_field(): client.purge_user_events(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == purge_config.PurgeUserEventsRequest( + request_msg = purge_config.PurgeUserEventsRequest( parent="parent_value", filter="filter_value", ) + assert args[0] == request_msg def test_purge_user_events_use_cached_wrapped_rpc(): @@ -2058,9 +2075,14 @@ async def test_purge_user_events_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_purge_user_events_async( - transport: str = "grpc_asyncio", request_type=purge_config.PurgeUserEventsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + purge_config.PurgeUserEventsRequest(), + {}, + ], +) +async def test_purge_user_events_async(request_type, transport: str = "grpc_asyncio"): client = UserEventServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2068,7 +2090,7 @@ async def test_purge_user_events_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( @@ -2090,11 +2112,6 @@ async def test_purge_user_events_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_purge_user_events_async_from_dict(): - await test_purge_user_events_async(request_type=dict) - - def test_purge_user_events_field_headers(): client = UserEventServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2163,8 +2180,8 @@ async def test_purge_user_events_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - import_config.ImportUserEventsRequest, - dict, + import_config.ImportUserEventsRequest(), + {}, ], ) def test_import_user_events(request_type, transport: str = "grpc"): @@ -2175,7 +2192,7 @@ def test_import_user_events(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2220,9 +2237,10 @@ def test_import_user_events_non_empty_request_with_auto_populated_field(): client.import_user_events(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == import_config.ImportUserEventsRequest( + request_msg = import_config.ImportUserEventsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_import_user_events_use_cached_wrapped_rpc(): @@ -2317,9 +2335,14 @@ async def test_import_user_events_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_import_user_events_async( - transport: str = "grpc_asyncio", request_type=import_config.ImportUserEventsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + import_config.ImportUserEventsRequest(), + {}, + ], +) +async def test_import_user_events_async(request_type, transport: str = "grpc_asyncio"): client = UserEventServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2327,7 +2350,7 @@ async def test_import_user_events_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( @@ -2349,11 +2372,6 @@ async def test_import_user_events_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_import_user_events_async_from_dict(): - await test_import_user_events_async(request_type=dict) - - def test_import_user_events_field_headers(): client = UserEventServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3094,7 +3112,6 @@ def test_write_user_event_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_event_service.WriteUserEventRequest() - assert args[0] == request_msg @@ -3117,7 +3134,6 @@ def test_collect_user_event_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_event_service.CollectUserEventRequest() - assert args[0] == request_msg @@ -3140,7 +3156,6 @@ def test_purge_user_events_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = purge_config.PurgeUserEventsRequest() - assert args[0] == request_msg @@ -3163,7 +3178,6 @@ def test_import_user_events_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_config.ImportUserEventsRequest() - assert args[0] == request_msg @@ -3214,7 +3228,6 @@ async def test_write_user_event_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_event_service.WriteUserEventRequest() - assert args[0] == request_msg @@ -3244,7 +3257,6 @@ async def test_collect_user_event_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_event_service.CollectUserEventRequest() - assert args[0] == request_msg @@ -3271,7 +3283,6 @@ async def test_purge_user_events_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = purge_config.PurgeUserEventsRequest() - assert args[0] == request_msg @@ -3298,7 +3309,6 @@ async def test_import_user_events_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_config.ImportUserEventsRequest() - assert args[0] == request_msg @@ -4185,7 +4195,6 @@ def test_write_user_event_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_event_service.WriteUserEventRequest() - assert args[0] == request_msg @@ -4207,7 +4216,6 @@ def test_collect_user_event_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_event_service.CollectUserEventRequest() - assert args[0] == request_msg @@ -4229,7 +4237,6 @@ def test_purge_user_events_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = purge_config.PurgeUserEventsRequest() - assert args[0] == request_msg @@ -4251,7 +4258,6 @@ def test_import_user_events_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_config.ImportUserEventsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_user_license_service.py b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_user_license_service.py index 1b3622f6ae20..cdd062bd566b 100644 --- a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_user_license_service.py +++ b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1/test_user_license_service.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 @@ -115,6 +116,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" @@ -1360,8 +1376,8 @@ def test_user_license_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - user_license_service.ListUserLicensesRequest, - dict, + user_license_service.ListUserLicensesRequest(), + {}, ], ) def test_list_user_licenses(request_type, transport: str = "grpc"): @@ -1372,7 +1388,7 @@ def test_list_user_licenses(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1422,11 +1438,12 @@ def test_list_user_licenses_non_empty_request_with_auto_populated_field(): client.list_user_licenses(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == user_license_service.ListUserLicensesRequest( + request_msg = user_license_service.ListUserLicensesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_user_licenses_use_cached_wrapped_rpc(): @@ -1511,10 +1528,14 @@ async def test_list_user_licenses_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_user_licenses_async( - transport: str = "grpc_asyncio", - request_type=user_license_service.ListUserLicensesRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + user_license_service.ListUserLicensesRequest(), + {}, + ], +) +async def test_list_user_licenses_async(request_type, transport: str = "grpc_asyncio"): client = UserLicenseServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1522,7 +1543,7 @@ async def test_list_user_licenses_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( @@ -1547,11 +1568,6 @@ async def test_list_user_licenses_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_user_licenses_async_from_dict(): - await test_list_user_licenses_async(request_type=dict) - - def test_list_user_licenses_field_headers(): client = UserLicenseServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1904,8 +1920,8 @@ async def test_list_user_licenses_async_pages(): @pytest.mark.parametrize( "request_type", [ - user_license_service.BatchUpdateUserLicensesRequest, - dict, + user_license_service.BatchUpdateUserLicensesRequest(), + {}, ], ) def test_batch_update_user_licenses(request_type, transport: str = "grpc"): @@ -1916,7 +1932,7 @@ def test_batch_update_user_licenses(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1961,9 +1977,10 @@ def test_batch_update_user_licenses_non_empty_request_with_auto_populated_field( client.batch_update_user_licenses(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == user_license_service.BatchUpdateUserLicensesRequest( + request_msg = user_license_service.BatchUpdateUserLicensesRequest( parent="parent_value", ) + assert args[0] == request_msg def test_batch_update_user_licenses_use_cached_wrapped_rpc(): @@ -2059,9 +2076,15 @@ async def test_batch_update_user_licenses_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + user_license_service.BatchUpdateUserLicensesRequest(), + {}, + ], +) async def test_batch_update_user_licenses_async( - transport: str = "grpc_asyncio", - request_type=user_license_service.BatchUpdateUserLicensesRequest, + request_type, transport: str = "grpc_asyncio" ): client = UserLicenseServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2070,7 +2093,7 @@ async def test_batch_update_user_licenses_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( @@ -2092,11 +2115,6 @@ async def test_batch_update_user_licenses_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_batch_update_user_licenses_async_from_dict(): - await test_batch_update_user_licenses_async(request_type=dict) - - def test_batch_update_user_licenses_field_headers(): client = UserLicenseServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2682,7 +2700,6 @@ def test_list_user_licenses_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_license_service.ListUserLicensesRequest() - assert args[0] == request_msg @@ -2705,7 +2722,6 @@ def test_batch_update_user_licenses_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_license_service.BatchUpdateUserLicensesRequest() - assert args[0] == request_msg @@ -2748,7 +2764,6 @@ async def test_list_user_licenses_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_license_service.ListUserLicensesRequest() - assert args[0] == request_msg @@ -2775,7 +2790,6 @@ async def test_batch_update_user_licenses_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_license_service.BatchUpdateUserLicensesRequest() - assert args[0] == request_msg @@ -3262,7 +3276,6 @@ def test_list_user_licenses_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_license_service.ListUserLicensesRequest() - assert args[0] == request_msg @@ -3284,7 +3297,6 @@ def test_batch_update_user_licenses_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_license_service.BatchUpdateUserLicensesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_acl_config_service.py b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_acl_config_service.py index 3ecf922f46e2..6b3a84d67e24 100644 --- a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_acl_config_service.py +++ b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_acl_config_service.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" @@ -1345,8 +1361,8 @@ def test_acl_config_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - acl_config_service.UpdateAclConfigRequest, - dict, + acl_config_service.UpdateAclConfigRequest(), + {}, ], ) def test_update_acl_config(request_type, transport: str = "grpc"): @@ -1357,7 +1373,7 @@ def test_update_acl_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( @@ -1403,7 +1419,8 @@ def test_update_acl_config_non_empty_request_with_auto_populated_field(): client.update_acl_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == acl_config_service.UpdateAclConfigRequest() + request_msg = acl_config_service.UpdateAclConfigRequest() + assert args[0] == request_msg def test_update_acl_config_use_cached_wrapped_rpc(): @@ -1486,10 +1503,14 @@ async def test_update_acl_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_acl_config_async( - transport: str = "grpc_asyncio", - request_type=acl_config_service.UpdateAclConfigRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + acl_config_service.UpdateAclConfigRequest(), + {}, + ], +) +async def test_update_acl_config_async(request_type, transport: str = "grpc_asyncio"): client = AclConfigServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1497,7 +1518,7 @@ async def test_update_acl_config_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( @@ -1522,11 +1543,6 @@ async def test_update_acl_config_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_update_acl_config_async_from_dict(): - await test_update_acl_config_async(request_type=dict) - - def test_update_acl_config_field_headers(): client = AclConfigServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1595,8 +1611,8 @@ async def test_update_acl_config_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - acl_config_service.GetAclConfigRequest, - dict, + acl_config_service.GetAclConfigRequest(), + {}, ], ) def test_get_acl_config(request_type, transport: str = "grpc"): @@ -1607,7 +1623,7 @@ def test_get_acl_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(type(client.transport.get_acl_config), "__call__") as call: @@ -1651,9 +1667,10 @@ def test_get_acl_config_non_empty_request_with_auto_populated_field(): client.get_acl_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == acl_config_service.GetAclConfigRequest( + request_msg = acl_config_service.GetAclConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_acl_config_use_cached_wrapped_rpc(): @@ -1734,9 +1751,14 @@ async def test_get_acl_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_acl_config_async( - transport: str = "grpc_asyncio", request_type=acl_config_service.GetAclConfigRequest -): +@pytest.mark.parametrize( + "request_type", + [ + acl_config_service.GetAclConfigRequest(), + {}, + ], +) +async def test_get_acl_config_async(request_type, transport: str = "grpc_asyncio"): client = AclConfigServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1744,7 +1766,7 @@ async def test_get_acl_config_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_acl_config), "__call__") as call: @@ -1767,11 +1789,6 @@ async def test_get_acl_config_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_acl_config_async_from_dict(): - await test_get_acl_config_async(request_type=dict) - - def test_get_acl_config_field_headers(): client = AclConfigServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2336,7 +2353,6 @@ def test_update_acl_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = acl_config_service.UpdateAclConfigRequest() - assert args[0] == request_msg @@ -2357,7 +2373,6 @@ def test_get_acl_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = acl_config_service.GetAclConfigRequest() - assert args[0] == request_msg @@ -2400,7 +2415,6 @@ async def test_update_acl_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = acl_config_service.UpdateAclConfigRequest() - assert args[0] == request_msg @@ -2427,7 +2441,6 @@ async def test_get_acl_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = acl_config_service.GetAclConfigRequest() - assert args[0] == request_msg @@ -3007,7 +3020,6 @@ def test_update_acl_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = acl_config_service.UpdateAclConfigRequest() - assert args[0] == request_msg @@ -3027,7 +3039,6 @@ def test_get_acl_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = acl_config_service.GetAclConfigRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_chunk_service.py b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_chunk_service.py index e66c6eef1286..10e38103b35c 100644 --- a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_chunk_service.py +++ b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_chunk_service.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 @@ -110,6 +111,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" @@ -1290,8 +1306,8 @@ def test_chunk_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - chunk_service.GetChunkRequest, - dict, + chunk_service.GetChunkRequest(), + {}, ], ) def test_get_chunk(request_type, transport: str = "grpc"): @@ -1302,7 +1318,7 @@ def test_get_chunk(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_chunk), "__call__") as call: @@ -1352,9 +1368,10 @@ def test_get_chunk_non_empty_request_with_auto_populated_field(): client.get_chunk(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == chunk_service.GetChunkRequest( + request_msg = chunk_service.GetChunkRequest( name="name_value", ) + assert args[0] == request_msg def test_get_chunk_use_cached_wrapped_rpc(): @@ -1433,9 +1450,14 @@ async def test_get_chunk_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_chunk_async( - transport: str = "grpc_asyncio", request_type=chunk_service.GetChunkRequest -): +@pytest.mark.parametrize( + "request_type", + [ + chunk_service.GetChunkRequest(), + {}, + ], +) +async def test_get_chunk_async(request_type, transport: str = "grpc_asyncio"): client = ChunkServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1443,7 +1465,7 @@ async def test_get_chunk_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_chunk), "__call__") as call: @@ -1472,11 +1494,6 @@ async def test_get_chunk_async( assert math.isclose(response.relevance_score, 0.1584, rel_tol=1e-6) -@pytest.mark.asyncio -async def test_get_chunk_async_from_dict(): - await test_get_chunk_async(request_type=dict) - - def test_get_chunk_field_headers(): client = ChunkServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1619,8 +1636,8 @@ async def test_get_chunk_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - chunk_service.ListChunksRequest, - dict, + chunk_service.ListChunksRequest(), + {}, ], ) def test_list_chunks(request_type, transport: str = "grpc"): @@ -1631,7 +1648,7 @@ def test_list_chunks(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_chunks), "__call__") as call: @@ -1676,10 +1693,11 @@ def test_list_chunks_non_empty_request_with_auto_populated_field(): client.list_chunks(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == chunk_service.ListChunksRequest( + request_msg = chunk_service.ListChunksRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_chunks_use_cached_wrapped_rpc(): @@ -1760,9 +1778,14 @@ async def test_list_chunks_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_chunks_async( - transport: str = "grpc_asyncio", request_type=chunk_service.ListChunksRequest -): +@pytest.mark.parametrize( + "request_type", + [ + chunk_service.ListChunksRequest(), + {}, + ], +) +async def test_list_chunks_async(request_type, transport: str = "grpc_asyncio"): client = ChunkServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1770,7 +1793,7 @@ async def test_list_chunks_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_chunks), "__call__") as call: @@ -1793,11 +1816,6 @@ async def test_list_chunks_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_chunks_async_from_dict(): - await test_list_chunks_async(request_type=dict) - - def test_list_chunks_field_headers(): client = ChunkServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2688,7 +2706,6 @@ def test_get_chunk_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = chunk_service.GetChunkRequest() - assert args[0] == request_msg @@ -2709,7 +2726,6 @@ def test_list_chunks_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = chunk_service.ListChunksRequest() - assert args[0] == request_msg @@ -2753,7 +2769,6 @@ async def test_get_chunk_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = chunk_service.GetChunkRequest() - assert args[0] == request_msg @@ -2780,7 +2795,6 @@ async def test_list_chunks_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = chunk_service.ListChunksRequest() - assert args[0] == request_msg @@ -3288,7 +3302,6 @@ def test_get_chunk_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = chunk_service.GetChunkRequest() - assert args[0] == request_msg @@ -3308,7 +3321,6 @@ def test_list_chunks_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = chunk_service.ListChunksRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_completion_service.py b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_completion_service.py index 2163dca4e018..dc270254a47b 100644 --- a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_completion_service.py +++ b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_completion_service.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 @@ -118,6 +119,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" @@ -1359,8 +1375,8 @@ def test_completion_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - completion_service.CompleteQueryRequest, - dict, + completion_service.CompleteQueryRequest(), + {}, ], ) def test_complete_query(request_type, transport: str = "grpc"): @@ -1371,7 +1387,7 @@ def test_complete_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(type(client.transport.complete_query), "__call__") as call: @@ -1418,12 +1434,13 @@ def test_complete_query_non_empty_request_with_auto_populated_field(): client.complete_query(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == completion_service.CompleteQueryRequest( + request_msg = completion_service.CompleteQueryRequest( data_store="data_store_value", query="query_value", query_model="query_model_value", user_pseudo_id="user_pseudo_id_value", ) + assert args[0] == request_msg def test_complete_query_use_cached_wrapped_rpc(): @@ -1504,10 +1521,14 @@ async def test_complete_query_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_complete_query_async( - transport: str = "grpc_asyncio", - request_type=completion_service.CompleteQueryRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + completion_service.CompleteQueryRequest(), + {}, + ], +) +async def test_complete_query_async(request_type, transport: str = "grpc_asyncio"): client = CompletionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1515,7 +1536,7 @@ async def test_complete_query_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.complete_query), "__call__") as call: @@ -1538,11 +1559,6 @@ async def test_complete_query_async( assert response.tail_match_triggered is True -@pytest.mark.asyncio -async def test_complete_query_async_from_dict(): - await test_complete_query_async(request_type=dict) - - def test_complete_query_field_headers(): client = CompletionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1607,8 +1623,8 @@ async def test_complete_query_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - import_config.ImportSuggestionDenyListEntriesRequest, - dict, + import_config.ImportSuggestionDenyListEntriesRequest(), + {}, ], ) def test_import_suggestion_deny_list_entries(request_type, transport: str = "grpc"): @@ -1619,7 +1635,7 @@ def test_import_suggestion_deny_list_entries(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( @@ -1664,9 +1680,10 @@ def test_import_suggestion_deny_list_entries_non_empty_request_with_auto_populat client.import_suggestion_deny_list_entries(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == import_config.ImportSuggestionDenyListEntriesRequest( + request_msg = import_config.ImportSuggestionDenyListEntriesRequest( parent="parent_value", ) + assert args[0] == request_msg def test_import_suggestion_deny_list_entries_use_cached_wrapped_rpc(): @@ -1762,9 +1779,15 @@ async def test_import_suggestion_deny_list_entries_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + import_config.ImportSuggestionDenyListEntriesRequest(), + {}, + ], +) async def test_import_suggestion_deny_list_entries_async( - transport: str = "grpc_asyncio", - request_type=import_config.ImportSuggestionDenyListEntriesRequest, + request_type, transport: str = "grpc_asyncio" ): client = CompletionServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1773,7 +1796,7 @@ async def test_import_suggestion_deny_list_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( @@ -1795,11 +1818,6 @@ async def test_import_suggestion_deny_list_entries_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_import_suggestion_deny_list_entries_async_from_dict(): - await test_import_suggestion_deny_list_entries_async(request_type=dict) - - def test_import_suggestion_deny_list_entries_field_headers(): client = CompletionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1868,8 +1886,8 @@ async def test_import_suggestion_deny_list_entries_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - purge_config.PurgeSuggestionDenyListEntriesRequest, - dict, + purge_config.PurgeSuggestionDenyListEntriesRequest(), + {}, ], ) def test_purge_suggestion_deny_list_entries(request_type, transport: str = "grpc"): @@ -1880,7 +1898,7 @@ def test_purge_suggestion_deny_list_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( @@ -1925,9 +1943,10 @@ def test_purge_suggestion_deny_list_entries_non_empty_request_with_auto_populate client.purge_suggestion_deny_list_entries(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == purge_config.PurgeSuggestionDenyListEntriesRequest( + request_msg = purge_config.PurgeSuggestionDenyListEntriesRequest( parent="parent_value", ) + assert args[0] == request_msg def test_purge_suggestion_deny_list_entries_use_cached_wrapped_rpc(): @@ -2023,9 +2042,15 @@ async def test_purge_suggestion_deny_list_entries_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + purge_config.PurgeSuggestionDenyListEntriesRequest(), + {}, + ], +) async def test_purge_suggestion_deny_list_entries_async( - transport: str = "grpc_asyncio", - request_type=purge_config.PurgeSuggestionDenyListEntriesRequest, + request_type, transport: str = "grpc_asyncio" ): client = CompletionServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2034,7 +2059,7 @@ async def test_purge_suggestion_deny_list_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( @@ -2056,11 +2081,6 @@ async def test_purge_suggestion_deny_list_entries_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_purge_suggestion_deny_list_entries_async_from_dict(): - await test_purge_suggestion_deny_list_entries_async(request_type=dict) - - def test_purge_suggestion_deny_list_entries_field_headers(): client = CompletionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2129,8 +2149,8 @@ async def test_purge_suggestion_deny_list_entries_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - import_config.ImportCompletionSuggestionsRequest, - dict, + import_config.ImportCompletionSuggestionsRequest(), + {}, ], ) def test_import_completion_suggestions(request_type, transport: str = "grpc"): @@ -2141,7 +2161,7 @@ def test_import_completion_suggestions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2186,9 +2206,10 @@ def test_import_completion_suggestions_non_empty_request_with_auto_populated_fie client.import_completion_suggestions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == import_config.ImportCompletionSuggestionsRequest( + request_msg = import_config.ImportCompletionSuggestionsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_import_completion_suggestions_use_cached_wrapped_rpc(): @@ -2284,9 +2305,15 @@ async def test_import_completion_suggestions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + import_config.ImportCompletionSuggestionsRequest(), + {}, + ], +) async def test_import_completion_suggestions_async( - transport: str = "grpc_asyncio", - request_type=import_config.ImportCompletionSuggestionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = CompletionServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2295,7 +2322,7 @@ async def test_import_completion_suggestions_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( @@ -2317,11 +2344,6 @@ async def test_import_completion_suggestions_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_import_completion_suggestions_async_from_dict(): - await test_import_completion_suggestions_async(request_type=dict) - - def test_import_completion_suggestions_field_headers(): client = CompletionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2390,8 +2412,8 @@ async def test_import_completion_suggestions_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - purge_config.PurgeCompletionSuggestionsRequest, - dict, + purge_config.PurgeCompletionSuggestionsRequest(), + {}, ], ) def test_purge_completion_suggestions(request_type, transport: str = "grpc"): @@ -2402,7 +2424,7 @@ def test_purge_completion_suggestions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2447,9 +2469,10 @@ def test_purge_completion_suggestions_non_empty_request_with_auto_populated_fiel client.purge_completion_suggestions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == purge_config.PurgeCompletionSuggestionsRequest( + request_msg = purge_config.PurgeCompletionSuggestionsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_purge_completion_suggestions_use_cached_wrapped_rpc(): @@ -2545,9 +2568,15 @@ async def test_purge_completion_suggestions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + purge_config.PurgeCompletionSuggestionsRequest(), + {}, + ], +) async def test_purge_completion_suggestions_async( - transport: str = "grpc_asyncio", - request_type=purge_config.PurgeCompletionSuggestionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = CompletionServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2556,7 +2585,7 @@ async def test_purge_completion_suggestions_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( @@ -2578,11 +2607,6 @@ async def test_purge_completion_suggestions_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_purge_completion_suggestions_async_from_dict(): - await test_purge_completion_suggestions_async(request_type=dict) - - def test_purge_completion_suggestions_field_headers(): client = CompletionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3442,7 +3466,6 @@ def test_complete_query_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = completion_service.CompleteQueryRequest() - assert args[0] == request_msg @@ -3465,7 +3488,6 @@ def test_import_suggestion_deny_list_entries_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_config.ImportSuggestionDenyListEntriesRequest() - assert args[0] == request_msg @@ -3488,7 +3510,6 @@ def test_purge_suggestion_deny_list_entries_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = purge_config.PurgeSuggestionDenyListEntriesRequest() - assert args[0] == request_msg @@ -3511,7 +3532,6 @@ def test_import_completion_suggestions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_config.ImportCompletionSuggestionsRequest() - assert args[0] == request_msg @@ -3534,7 +3554,6 @@ def test_purge_completion_suggestions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = purge_config.PurgeCompletionSuggestionsRequest() - assert args[0] == request_msg @@ -3575,7 +3594,6 @@ async def test_complete_query_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = completion_service.CompleteQueryRequest() - assert args[0] == request_msg @@ -3602,7 +3620,6 @@ async def test_import_suggestion_deny_list_entries_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_config.ImportSuggestionDenyListEntriesRequest() - assert args[0] == request_msg @@ -3629,7 +3646,6 @@ async def test_purge_suggestion_deny_list_entries_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = purge_config.PurgeSuggestionDenyListEntriesRequest() - assert args[0] == request_msg @@ -3656,7 +3672,6 @@ async def test_import_completion_suggestions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_config.ImportCompletionSuggestionsRequest() - assert args[0] == request_msg @@ -3683,7 +3698,6 @@ async def test_purge_completion_suggestions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = purge_config.PurgeCompletionSuggestionsRequest() - assert args[0] == request_msg @@ -4589,7 +4603,6 @@ def test_complete_query_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = completion_service.CompleteQueryRequest() - assert args[0] == request_msg @@ -4611,7 +4624,6 @@ def test_import_suggestion_deny_list_entries_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_config.ImportSuggestionDenyListEntriesRequest() - assert args[0] == request_msg @@ -4633,7 +4645,6 @@ def test_purge_suggestion_deny_list_entries_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = purge_config.PurgeSuggestionDenyListEntriesRequest() - assert args[0] == request_msg @@ -4655,7 +4666,6 @@ def test_import_completion_suggestions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_config.ImportCompletionSuggestionsRequest() - assert args[0] == request_msg @@ -4677,7 +4687,6 @@ def test_purge_completion_suggestions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = purge_config.PurgeCompletionSuggestionsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_control_service.py b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_control_service.py index d26d104c69dd..287e1940284a 100644 --- a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_control_service.py +++ b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_control_service.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" @@ -1315,8 +1331,8 @@ def test_control_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - control_service.CreateControlRequest, - dict, + control_service.CreateControlRequest(), + {}, ], ) def test_create_control(request_type, transport: str = "grpc"): @@ -1327,7 +1343,7 @@ def test_create_control(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_control), "__call__") as call: @@ -1382,10 +1398,11 @@ def test_create_control_non_empty_request_with_auto_populated_field(): client.create_control(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == control_service.CreateControlRequest( + request_msg = control_service.CreateControlRequest( parent="parent_value", control_id="control_id_value", ) + assert args[0] == request_msg def test_create_control_use_cached_wrapped_rpc(): @@ -1466,9 +1483,14 @@ async def test_create_control_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_control_async( - transport: str = "grpc_asyncio", request_type=control_service.CreateControlRequest -): +@pytest.mark.parametrize( + "request_type", + [ + control_service.CreateControlRequest(), + {}, + ], +) +async def test_create_control_async(request_type, transport: str = "grpc_asyncio"): client = ControlServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1476,7 +1498,7 @@ async def test_create_control_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_control), "__call__") as call: @@ -1509,11 +1531,6 @@ async def test_create_control_async( assert response.use_cases == [common.SearchUseCase.SEARCH_USE_CASE_SEARCH] -@pytest.mark.asyncio -async def test_create_control_async_from_dict(): - await test_create_control_async(request_type=dict) - - def test_create_control_field_headers(): client = ControlServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1688,8 +1705,8 @@ async def test_create_control_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - control_service.DeleteControlRequest, - dict, + control_service.DeleteControlRequest(), + {}, ], ) def test_delete_control(request_type, transport: str = "grpc"): @@ -1700,7 +1717,7 @@ def test_delete_control(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_control), "__call__") as call: @@ -1741,9 +1758,10 @@ def test_delete_control_non_empty_request_with_auto_populated_field(): client.delete_control(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == control_service.DeleteControlRequest( + request_msg = control_service.DeleteControlRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_control_use_cached_wrapped_rpc(): @@ -1824,9 +1842,14 @@ async def test_delete_control_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_control_async( - transport: str = "grpc_asyncio", request_type=control_service.DeleteControlRequest -): +@pytest.mark.parametrize( + "request_type", + [ + control_service.DeleteControlRequest(), + {}, + ], +) +async def test_delete_control_async(request_type, transport: str = "grpc_asyncio"): client = ControlServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1834,7 +1857,7 @@ async def test_delete_control_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_control), "__call__") as call: @@ -1852,11 +1875,6 @@ async def test_delete_control_async( assert response is None -@pytest.mark.asyncio -async def test_delete_control_async_from_dict(): - await test_delete_control_async(request_type=dict) - - def test_delete_control_field_headers(): client = ControlServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1999,8 +2017,8 @@ async def test_delete_control_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - control_service.UpdateControlRequest, - dict, + control_service.UpdateControlRequest(), + {}, ], ) def test_update_control(request_type, transport: str = "grpc"): @@ -2011,7 +2029,7 @@ def test_update_control(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_control), "__call__") as call: @@ -2063,7 +2081,8 @@ def test_update_control_non_empty_request_with_auto_populated_field(): client.update_control(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == control_service.UpdateControlRequest() + request_msg = control_service.UpdateControlRequest() + assert args[0] == request_msg def test_update_control_use_cached_wrapped_rpc(): @@ -2144,9 +2163,14 @@ async def test_update_control_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_control_async( - transport: str = "grpc_asyncio", request_type=control_service.UpdateControlRequest -): +@pytest.mark.parametrize( + "request_type", + [ + control_service.UpdateControlRequest(), + {}, + ], +) +async def test_update_control_async(request_type, transport: str = "grpc_asyncio"): client = ControlServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2154,7 +2178,7 @@ async def test_update_control_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_control), "__call__") as call: @@ -2187,11 +2211,6 @@ async def test_update_control_async( assert response.use_cases == [common.SearchUseCase.SEARCH_USE_CASE_SEARCH] -@pytest.mark.asyncio -async def test_update_control_async_from_dict(): - await test_update_control_async(request_type=dict) - - def test_update_control_field_headers(): client = ControlServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2356,8 +2375,8 @@ async def test_update_control_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - control_service.GetControlRequest, - dict, + control_service.GetControlRequest(), + {}, ], ) def test_get_control(request_type, transport: str = "grpc"): @@ -2368,7 +2387,7 @@ def test_get_control(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_control), "__call__") as call: @@ -2422,9 +2441,10 @@ def test_get_control_non_empty_request_with_auto_populated_field(): client.get_control(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == control_service.GetControlRequest( + request_msg = control_service.GetControlRequest( name="name_value", ) + assert args[0] == request_msg def test_get_control_use_cached_wrapped_rpc(): @@ -2505,9 +2525,14 @@ async def test_get_control_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_control_async( - transport: str = "grpc_asyncio", request_type=control_service.GetControlRequest -): +@pytest.mark.parametrize( + "request_type", + [ + control_service.GetControlRequest(), + {}, + ], +) +async def test_get_control_async(request_type, transport: str = "grpc_asyncio"): client = ControlServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2515,7 +2540,7 @@ async def test_get_control_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_control), "__call__") as call: @@ -2548,11 +2573,6 @@ async def test_get_control_async( assert response.use_cases == [common.SearchUseCase.SEARCH_USE_CASE_SEARCH] -@pytest.mark.asyncio -async def test_get_control_async_from_dict(): - await test_get_control_async(request_type=dict) - - def test_get_control_field_headers(): client = ControlServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2695,8 +2715,8 @@ async def test_get_control_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - control_service.ListControlsRequest, - dict, + control_service.ListControlsRequest(), + {}, ], ) def test_list_controls(request_type, transport: str = "grpc"): @@ -2707,7 +2727,7 @@ def test_list_controls(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_controls), "__call__") as call: @@ -2753,11 +2773,12 @@ def test_list_controls_non_empty_request_with_auto_populated_field(): client.list_controls(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == control_service.ListControlsRequest( + request_msg = control_service.ListControlsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_controls_use_cached_wrapped_rpc(): @@ -2838,9 +2859,14 @@ async def test_list_controls_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_controls_async( - transport: str = "grpc_asyncio", request_type=control_service.ListControlsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + control_service.ListControlsRequest(), + {}, + ], +) +async def test_list_controls_async(request_type, transport: str = "grpc_asyncio"): client = ControlServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2848,7 +2874,7 @@ async def test_list_controls_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_controls), "__call__") as call: @@ -2871,11 +2897,6 @@ async def test_list_controls_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_controls_async_from_dict(): - await test_list_controls_async(request_type=dict) - - def test_list_controls_field_headers(): client = ControlServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4348,7 +4369,6 @@ def test_create_control_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.CreateControlRequest() - assert args[0] == request_msg @@ -4369,7 +4389,6 @@ def test_delete_control_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.DeleteControlRequest() - assert args[0] == request_msg @@ -4390,7 +4409,6 @@ def test_update_control_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.UpdateControlRequest() - assert args[0] == request_msg @@ -4411,7 +4429,6 @@ def test_get_control_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.GetControlRequest() - assert args[0] == request_msg @@ -4432,7 +4449,6 @@ def test_list_controls_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.ListControlsRequest() - assert args[0] == request_msg @@ -4477,7 +4493,6 @@ async def test_create_control_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.CreateControlRequest() - assert args[0] == request_msg @@ -4500,7 +4515,6 @@ async def test_delete_control_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.DeleteControlRequest() - assert args[0] == request_msg @@ -4531,7 +4545,6 @@ async def test_update_control_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.UpdateControlRequest() - assert args[0] == request_msg @@ -4562,7 +4575,6 @@ async def test_get_control_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.GetControlRequest() - assert args[0] == request_msg @@ -4589,7 +4601,6 @@ async def test_list_controls_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.ListControlsRequest() - assert args[0] == request_msg @@ -5694,7 +5705,6 @@ def test_create_control_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.CreateControlRequest() - assert args[0] == request_msg @@ -5714,7 +5724,6 @@ def test_delete_control_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.DeleteControlRequest() - assert args[0] == request_msg @@ -5734,7 +5743,6 @@ def test_update_control_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.UpdateControlRequest() - assert args[0] == request_msg @@ -5754,7 +5762,6 @@ def test_get_control_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.GetControlRequest() - assert args[0] == request_msg @@ -5774,7 +5781,6 @@ def test_list_controls_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.ListControlsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_conversational_search_service.py b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_conversational_search_service.py index 85849c76054f..8e81ade1ec1f 100644 --- a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_conversational_search_service.py +++ b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_conversational_search_service.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 @@ -121,6 +122,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" @@ -1427,8 +1443,8 @@ def test_conversational_search_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - conversational_search_service.ConverseConversationRequest, - dict, + conversational_search_service.ConverseConversationRequest(), + {}, ], ) def test_converse_conversation(request_type, transport: str = "grpc"): @@ -1439,7 +1455,7 @@ def test_converse_conversation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1491,11 +1507,12 @@ def test_converse_conversation_non_empty_request_with_auto_populated_field(): client.converse_conversation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversational_search_service.ConverseConversationRequest( + request_msg = conversational_search_service.ConverseConversationRequest( name="name_value", serving_config="serving_config_value", filter="filter_value", ) + assert args[0] == request_msg def test_converse_conversation_use_cached_wrapped_rpc(): @@ -1581,9 +1598,15 @@ async def test_converse_conversation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + conversational_search_service.ConverseConversationRequest(), + {}, + ], +) async def test_converse_conversation_async( - transport: str = "grpc_asyncio", - request_type=conversational_search_service.ConverseConversationRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConversationalSearchServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1592,7 +1615,7 @@ async def test_converse_conversation_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( @@ -1619,11 +1642,6 @@ async def test_converse_conversation_async( assert response.related_questions == ["related_questions_value"] -@pytest.mark.asyncio -async def test_converse_conversation_async_from_dict(): - await test_converse_conversation_async(request_type=dict) - - def test_converse_conversation_field_headers(): client = ConversationalSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1788,8 +1806,8 @@ async def test_converse_conversation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversational_search_service.CreateConversationRequest, - dict, + conversational_search_service.CreateConversationRequest(), + {}, ], ) def test_create_conversation(request_type, transport: str = "grpc"): @@ -1800,7 +1818,7 @@ def test_create_conversation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1852,9 +1870,10 @@ def test_create_conversation_non_empty_request_with_auto_populated_field(): client.create_conversation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversational_search_service.CreateConversationRequest( + request_msg = conversational_search_service.CreateConversationRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_conversation_use_cached_wrapped_rpc(): @@ -1939,10 +1958,14 @@ async def test_create_conversation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_conversation_async( - transport: str = "grpc_asyncio", - request_type=conversational_search_service.CreateConversationRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + conversational_search_service.CreateConversationRequest(), + {}, + ], +) +async def test_create_conversation_async(request_type, transport: str = "grpc_asyncio"): client = ConversationalSearchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1950,7 +1973,7 @@ async def test_create_conversation_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( @@ -1979,11 +2002,6 @@ async def test_create_conversation_async( assert response.user_pseudo_id == "user_pseudo_id_value" -@pytest.mark.asyncio -async def test_create_conversation_async_from_dict(): - await test_create_conversation_async(request_type=dict) - - def test_create_conversation_field_headers(): client = ConversationalSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2148,8 +2166,8 @@ async def test_create_conversation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversational_search_service.DeleteConversationRequest, - dict, + conversational_search_service.DeleteConversationRequest(), + {}, ], ) def test_delete_conversation(request_type, transport: str = "grpc"): @@ -2160,7 +2178,7 @@ def test_delete_conversation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2205,9 +2223,10 @@ def test_delete_conversation_non_empty_request_with_auto_populated_field(): client.delete_conversation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversational_search_service.DeleteConversationRequest( + request_msg = conversational_search_service.DeleteConversationRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_conversation_use_cached_wrapped_rpc(): @@ -2292,10 +2311,14 @@ async def test_delete_conversation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_conversation_async( - transport: str = "grpc_asyncio", - request_type=conversational_search_service.DeleteConversationRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + conversational_search_service.DeleteConversationRequest(), + {}, + ], +) +async def test_delete_conversation_async(request_type, transport: str = "grpc_asyncio"): client = ConversationalSearchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2303,7 +2326,7 @@ async def test_delete_conversation_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( @@ -2323,11 +2346,6 @@ async def test_delete_conversation_async( assert response is None -@pytest.mark.asyncio -async def test_delete_conversation_async_from_dict(): - await test_delete_conversation_async(request_type=dict) - - def test_delete_conversation_field_headers(): client = ConversationalSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2478,8 +2496,8 @@ async def test_delete_conversation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversational_search_service.UpdateConversationRequest, - dict, + conversational_search_service.UpdateConversationRequest(), + {}, ], ) def test_update_conversation(request_type, transport: str = "grpc"): @@ -2490,7 +2508,7 @@ def test_update_conversation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2540,7 +2558,8 @@ def test_update_conversation_non_empty_request_with_auto_populated_field(): client.update_conversation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversational_search_service.UpdateConversationRequest() + request_msg = conversational_search_service.UpdateConversationRequest() + assert args[0] == request_msg def test_update_conversation_use_cached_wrapped_rpc(): @@ -2625,10 +2644,14 @@ async def test_update_conversation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_conversation_async( - transport: str = "grpc_asyncio", - request_type=conversational_search_service.UpdateConversationRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + conversational_search_service.UpdateConversationRequest(), + {}, + ], +) +async def test_update_conversation_async(request_type, transport: str = "grpc_asyncio"): client = ConversationalSearchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2636,7 +2659,7 @@ async def test_update_conversation_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( @@ -2665,11 +2688,6 @@ async def test_update_conversation_async( assert response.user_pseudo_id == "user_pseudo_id_value" -@pytest.mark.asyncio -async def test_update_conversation_async_from_dict(): - await test_update_conversation_async(request_type=dict) - - def test_update_conversation_field_headers(): client = ConversationalSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2834,8 +2852,8 @@ async def test_update_conversation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversational_search_service.GetConversationRequest, - dict, + conversational_search_service.GetConversationRequest(), + {}, ], ) def test_get_conversation(request_type, transport: str = "grpc"): @@ -2846,7 +2864,7 @@ def test_get_conversation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_conversation), "__call__") as call: @@ -2894,9 +2912,10 @@ def test_get_conversation_non_empty_request_with_auto_populated_field(): client.get_conversation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversational_search_service.GetConversationRequest( + request_msg = conversational_search_service.GetConversationRequest( name="name_value", ) + assert args[0] == request_msg def test_get_conversation_use_cached_wrapped_rpc(): @@ -2979,10 +2998,14 @@ async def test_get_conversation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_conversation_async( - transport: str = "grpc_asyncio", - request_type=conversational_search_service.GetConversationRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + conversational_search_service.GetConversationRequest(), + {}, + ], +) +async def test_get_conversation_async(request_type, transport: str = "grpc_asyncio"): client = ConversationalSearchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2990,7 +3013,7 @@ async def test_get_conversation_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_conversation), "__call__") as call: @@ -3017,11 +3040,6 @@ async def test_get_conversation_async( assert response.user_pseudo_id == "user_pseudo_id_value" -@pytest.mark.asyncio -async def test_get_conversation_async_from_dict(): - await test_get_conversation_async(request_type=dict) - - def test_get_conversation_field_headers(): client = ConversationalSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3168,8 +3186,8 @@ async def test_get_conversation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversational_search_service.ListConversationsRequest, - dict, + conversational_search_service.ListConversationsRequest(), + {}, ], ) def test_list_conversations(request_type, transport: str = "grpc"): @@ -3180,7 +3198,7 @@ def test_list_conversations(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3231,12 +3249,13 @@ def test_list_conversations_non_empty_request_with_auto_populated_field(): client.list_conversations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversational_search_service.ListConversationsRequest( + request_msg = conversational_search_service.ListConversationsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_conversations_use_cached_wrapped_rpc(): @@ -3321,10 +3340,14 @@ async def test_list_conversations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_conversations_async( - transport: str = "grpc_asyncio", - request_type=conversational_search_service.ListConversationsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + conversational_search_service.ListConversationsRequest(), + {}, + ], +) +async def test_list_conversations_async(request_type, transport: str = "grpc_asyncio"): client = ConversationalSearchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3332,7 +3355,7 @@ async def test_list_conversations_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( @@ -3357,11 +3380,6 @@ async def test_list_conversations_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_conversations_async_from_dict(): - await test_list_conversations_async(request_type=dict) - - def test_list_conversations_field_headers(): client = ConversationalSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3714,8 +3732,8 @@ async def test_list_conversations_async_pages(): @pytest.mark.parametrize( "request_type", [ - conversational_search_service.AnswerQueryRequest, - dict, + conversational_search_service.AnswerQueryRequest(), + {}, ], ) def test_answer_query(request_type, transport: str = "grpc"): @@ -3726,7 +3744,7 @@ def test_answer_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(type(client.transport.answer_query), "__call__") as call: @@ -3772,11 +3790,12 @@ def test_answer_query_non_empty_request_with_auto_populated_field(): client.answer_query(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversational_search_service.AnswerQueryRequest( + request_msg = conversational_search_service.AnswerQueryRequest( serving_config="serving_config_value", session="session_value", user_pseudo_id="user_pseudo_id_value", ) + assert args[0] == request_msg def test_answer_query_use_cached_wrapped_rpc(): @@ -3857,10 +3876,14 @@ async def test_answer_query_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_answer_query_async( - transport: str = "grpc_asyncio", - request_type=conversational_search_service.AnswerQueryRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + conversational_search_service.AnswerQueryRequest(), + {}, + ], +) +async def test_answer_query_async(request_type, transport: str = "grpc_asyncio"): client = ConversationalSearchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3868,7 +3891,7 @@ async def test_answer_query_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.answer_query), "__call__") as call: @@ -3891,11 +3914,6 @@ async def test_answer_query_async( assert response.answer_query_token == "answer_query_token_value" -@pytest.mark.asyncio -async def test_answer_query_async_from_dict(): - await test_answer_query_async(request_type=dict) - - def test_answer_query_field_headers(): client = ConversationalSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3960,8 +3978,8 @@ async def test_answer_query_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - conversational_search_service.GetAnswerRequest, - dict, + conversational_search_service.GetAnswerRequest(), + {}, ], ) def test_get_answer(request_type, transport: str = "grpc"): @@ -3972,7 +3990,7 @@ def test_get_answer(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_answer), "__call__") as call: @@ -4028,9 +4046,10 @@ def test_get_answer_non_empty_request_with_auto_populated_field(): client.get_answer(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversational_search_service.GetAnswerRequest( + request_msg = conversational_search_service.GetAnswerRequest( name="name_value", ) + assert args[0] == request_msg def test_get_answer_use_cached_wrapped_rpc(): @@ -4109,10 +4128,14 @@ async def test_get_answer_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_answer_async( - transport: str = "grpc_asyncio", - request_type=conversational_search_service.GetAnswerRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + conversational_search_service.GetAnswerRequest(), + {}, + ], +) +async def test_get_answer_async(request_type, transport: str = "grpc_asyncio"): client = ConversationalSearchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4120,7 +4143,7 @@ async def test_get_answer_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_answer), "__call__") as call: @@ -4155,11 +4178,6 @@ async def test_get_answer_async( ] -@pytest.mark.asyncio -async def test_get_answer_async_from_dict(): - await test_get_answer_async(request_type=dict) - - def test_get_answer_field_headers(): client = ConversationalSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4302,8 +4320,8 @@ async def test_get_answer_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversational_search_service.CreateSessionRequest, - dict, + conversational_search_service.CreateSessionRequest(), + {}, ], ) def test_create_session(request_type, transport: str = "grpc"): @@ -4314,7 +4332,7 @@ def test_create_session(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_session), "__call__") as call: @@ -4366,9 +4384,10 @@ def test_create_session_non_empty_request_with_auto_populated_field(): client.create_session(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversational_search_service.CreateSessionRequest( + request_msg = conversational_search_service.CreateSessionRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_session_use_cached_wrapped_rpc(): @@ -4449,10 +4468,14 @@ async def test_create_session_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_session_async( - transport: str = "grpc_asyncio", - request_type=conversational_search_service.CreateSessionRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + conversational_search_service.CreateSessionRequest(), + {}, + ], +) +async def test_create_session_async(request_type, transport: str = "grpc_asyncio"): client = ConversationalSearchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4460,7 +4483,7 @@ async def test_create_session_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_session), "__call__") as call: @@ -4491,11 +4514,6 @@ async def test_create_session_async( assert response.is_pinned is True -@pytest.mark.asyncio -async def test_create_session_async_from_dict(): - await test_create_session_async(request_type=dict) - - def test_create_session_field_headers(): client = ConversationalSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4648,8 +4666,8 @@ async def test_create_session_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversational_search_service.DeleteSessionRequest, - dict, + conversational_search_service.DeleteSessionRequest(), + {}, ], ) def test_delete_session(request_type, transport: str = "grpc"): @@ -4660,7 +4678,7 @@ def test_delete_session(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_session), "__call__") as call: @@ -4701,9 +4719,10 @@ def test_delete_session_non_empty_request_with_auto_populated_field(): client.delete_session(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversational_search_service.DeleteSessionRequest( + request_msg = conversational_search_service.DeleteSessionRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_session_use_cached_wrapped_rpc(): @@ -4784,10 +4803,14 @@ async def test_delete_session_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_session_async( - transport: str = "grpc_asyncio", - request_type=conversational_search_service.DeleteSessionRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + conversational_search_service.DeleteSessionRequest(), + {}, + ], +) +async def test_delete_session_async(request_type, transport: str = "grpc_asyncio"): client = ConversationalSearchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4795,7 +4818,7 @@ async def test_delete_session_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_session), "__call__") as call: @@ -4813,11 +4836,6 @@ async def test_delete_session_async( assert response is None -@pytest.mark.asyncio -async def test_delete_session_async_from_dict(): - await test_delete_session_async(request_type=dict) - - def test_delete_session_field_headers(): client = ConversationalSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4960,8 +4978,8 @@ async def test_delete_session_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversational_search_service.UpdateSessionRequest, - dict, + conversational_search_service.UpdateSessionRequest(), + {}, ], ) def test_update_session(request_type, transport: str = "grpc"): @@ -4972,7 +4990,7 @@ def test_update_session(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_session), "__call__") as call: @@ -5022,7 +5040,8 @@ def test_update_session_non_empty_request_with_auto_populated_field(): client.update_session(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversational_search_service.UpdateSessionRequest() + request_msg = conversational_search_service.UpdateSessionRequest() + assert args[0] == request_msg def test_update_session_use_cached_wrapped_rpc(): @@ -5103,10 +5122,14 @@ async def test_update_session_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_session_async( - transport: str = "grpc_asyncio", - request_type=conversational_search_service.UpdateSessionRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + conversational_search_service.UpdateSessionRequest(), + {}, + ], +) +async def test_update_session_async(request_type, transport: str = "grpc_asyncio"): client = ConversationalSearchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5114,7 +5137,7 @@ async def test_update_session_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_session), "__call__") as call: @@ -5145,11 +5168,6 @@ async def test_update_session_async( assert response.is_pinned is True -@pytest.mark.asyncio -async def test_update_session_async_from_dict(): - await test_update_session_async(request_type=dict) - - def test_update_session_field_headers(): client = ConversationalSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5302,8 +5320,8 @@ async def test_update_session_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversational_search_service.GetSessionRequest, - dict, + conversational_search_service.GetSessionRequest(), + {}, ], ) def test_get_session(request_type, transport: str = "grpc"): @@ -5314,7 +5332,7 @@ def test_get_session(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_session), "__call__") as call: @@ -5366,9 +5384,10 @@ def test_get_session_non_empty_request_with_auto_populated_field(): client.get_session(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversational_search_service.GetSessionRequest( + request_msg = conversational_search_service.GetSessionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_session_use_cached_wrapped_rpc(): @@ -5449,10 +5468,14 @@ async def test_get_session_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_session_async( - transport: str = "grpc_asyncio", - request_type=conversational_search_service.GetSessionRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + conversational_search_service.GetSessionRequest(), + {}, + ], +) +async def test_get_session_async(request_type, transport: str = "grpc_asyncio"): client = ConversationalSearchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5460,7 +5483,7 @@ async def test_get_session_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_session), "__call__") as call: @@ -5491,11 +5514,6 @@ async def test_get_session_async( assert response.is_pinned is True -@pytest.mark.asyncio -async def test_get_session_async_from_dict(): - await test_get_session_async(request_type=dict) - - def test_get_session_field_headers(): client = ConversationalSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5638,8 +5656,8 @@ async def test_get_session_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversational_search_service.ListSessionsRequest, - dict, + conversational_search_service.ListSessionsRequest(), + {}, ], ) def test_list_sessions(request_type, transport: str = "grpc"): @@ -5650,7 +5668,7 @@ def test_list_sessions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_sessions), "__call__") as call: @@ -5697,12 +5715,13 @@ def test_list_sessions_non_empty_request_with_auto_populated_field(): client.list_sessions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversational_search_service.ListSessionsRequest( + request_msg = conversational_search_service.ListSessionsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_sessions_use_cached_wrapped_rpc(): @@ -5783,10 +5802,14 @@ async def test_list_sessions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_sessions_async( - transport: str = "grpc_asyncio", - request_type=conversational_search_service.ListSessionsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + conversational_search_service.ListSessionsRequest(), + {}, + ], +) +async def test_list_sessions_async(request_type, transport: str = "grpc_asyncio"): client = ConversationalSearchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5794,7 +5817,7 @@ async def test_list_sessions_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_sessions), "__call__") as call: @@ -5817,11 +5840,6 @@ async def test_list_sessions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_sessions_async_from_dict(): - await test_list_sessions_async(request_type=dict) - - def test_list_sessions_field_headers(): client = ConversationalSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8807,7 +8825,6 @@ def test_converse_conversation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.ConverseConversationRequest() - assert args[0] == request_msg @@ -8830,7 +8847,6 @@ def test_create_conversation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.CreateConversationRequest() - assert args[0] == request_msg @@ -8853,7 +8869,6 @@ def test_delete_conversation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.DeleteConversationRequest() - assert args[0] == request_msg @@ -8876,7 +8891,6 @@ def test_update_conversation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.UpdateConversationRequest() - assert args[0] == request_msg @@ -8897,7 +8911,6 @@ def test_get_conversation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.GetConversationRequest() - assert args[0] == request_msg @@ -8920,7 +8933,6 @@ def test_list_conversations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.ListConversationsRequest() - assert args[0] == request_msg @@ -8941,7 +8953,6 @@ def test_answer_query_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.AnswerQueryRequest() - assert args[0] == request_msg @@ -8962,7 +8973,6 @@ def test_get_answer_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.GetAnswerRequest() - assert args[0] == request_msg @@ -8983,7 +8993,6 @@ def test_create_session_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.CreateSessionRequest() - assert args[0] == request_msg @@ -9004,7 +9013,6 @@ def test_delete_session_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.DeleteSessionRequest() - assert args[0] == request_msg @@ -9025,7 +9033,6 @@ def test_update_session_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.UpdateSessionRequest() - assert args[0] == request_msg @@ -9046,7 +9053,6 @@ def test_get_session_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.GetSessionRequest() - assert args[0] == request_msg @@ -9067,7 +9073,6 @@ def test_list_sessions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.ListSessionsRequest() - assert args[0] == request_msg @@ -9110,7 +9115,6 @@ async def test_converse_conversation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.ConverseConversationRequest() - assert args[0] == request_msg @@ -9141,7 +9145,6 @@ async def test_create_conversation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.CreateConversationRequest() - assert args[0] == request_msg @@ -9166,7 +9169,6 @@ async def test_delete_conversation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.DeleteConversationRequest() - assert args[0] == request_msg @@ -9197,7 +9199,6 @@ async def test_update_conversation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.UpdateConversationRequest() - assert args[0] == request_msg @@ -9226,7 +9227,6 @@ async def test_get_conversation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.GetConversationRequest() - assert args[0] == request_msg @@ -9255,7 +9255,6 @@ async def test_list_conversations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.ListConversationsRequest() - assert args[0] == request_msg @@ -9282,7 +9281,6 @@ async def test_answer_query_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.AnswerQueryRequest() - assert args[0] == request_msg @@ -9315,7 +9313,6 @@ async def test_get_answer_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.GetAnswerRequest() - assert args[0] == request_msg @@ -9346,7 +9343,6 @@ async def test_create_session_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.CreateSessionRequest() - assert args[0] == request_msg @@ -9369,7 +9365,6 @@ async def test_delete_session_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.DeleteSessionRequest() - assert args[0] == request_msg @@ -9400,7 +9395,6 @@ async def test_update_session_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.UpdateSessionRequest() - assert args[0] == request_msg @@ -9431,7 +9425,6 @@ async def test_get_session_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.GetSessionRequest() - assert args[0] == request_msg @@ -9458,7 +9451,6 @@ async def test_list_sessions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.ListSessionsRequest() - assert args[0] == request_msg @@ -12118,7 +12110,6 @@ def test_converse_conversation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.ConverseConversationRequest() - assert args[0] == request_msg @@ -12140,7 +12131,6 @@ def test_create_conversation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.CreateConversationRequest() - assert args[0] == request_msg @@ -12162,7 +12152,6 @@ def test_delete_conversation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.DeleteConversationRequest() - assert args[0] == request_msg @@ -12184,7 +12173,6 @@ def test_update_conversation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.UpdateConversationRequest() - assert args[0] == request_msg @@ -12204,7 +12192,6 @@ def test_get_conversation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.GetConversationRequest() - assert args[0] == request_msg @@ -12226,7 +12213,6 @@ def test_list_conversations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.ListConversationsRequest() - assert args[0] == request_msg @@ -12246,7 +12232,6 @@ def test_answer_query_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.AnswerQueryRequest() - assert args[0] == request_msg @@ -12266,7 +12251,6 @@ def test_get_answer_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.GetAnswerRequest() - assert args[0] == request_msg @@ -12286,7 +12270,6 @@ def test_create_session_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.CreateSessionRequest() - assert args[0] == request_msg @@ -12306,7 +12289,6 @@ def test_delete_session_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.DeleteSessionRequest() - assert args[0] == request_msg @@ -12326,7 +12308,6 @@ def test_update_session_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.UpdateSessionRequest() - assert args[0] == request_msg @@ -12346,7 +12327,6 @@ def test_get_session_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.GetSessionRequest() - assert args[0] == request_msg @@ -12366,7 +12346,6 @@ def test_list_sessions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.ListSessionsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_data_store_service.py b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_data_store_service.py index 914049a20aca..d6b100b4f097 100644 --- a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_data_store_service.py +++ b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_data_store_service.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 @@ -127,6 +128,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" @@ -1360,8 +1376,8 @@ def test_data_store_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - data_store_service.CreateDataStoreRequest, - dict, + data_store_service.CreateDataStoreRequest(), + {}, ], ) def test_create_data_store(request_type, transport: str = "grpc"): @@ -1372,7 +1388,7 @@ def test_create_data_store(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1418,10 +1434,11 @@ def test_create_data_store_non_empty_request_with_auto_populated_field(): client.create_data_store(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_store_service.CreateDataStoreRequest( + request_msg = data_store_service.CreateDataStoreRequest( parent="parent_value", data_store_id="data_store_id_value", ) + assert args[0] == request_msg def test_create_data_store_use_cached_wrapped_rpc(): @@ -1514,10 +1531,14 @@ async def test_create_data_store_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_data_store_async( - transport: str = "grpc_asyncio", - request_type=data_store_service.CreateDataStoreRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + data_store_service.CreateDataStoreRequest(), + {}, + ], +) +async def test_create_data_store_async(request_type, transport: str = "grpc_asyncio"): client = DataStoreServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1525,7 +1546,7 @@ async def test_create_data_store_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( @@ -1547,11 +1568,6 @@ async def test_create_data_store_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_data_store_async_from_dict(): - await test_create_data_store_async(request_type=dict) - - def test_create_data_store_field_headers(): client = DataStoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1726,8 +1742,8 @@ async def test_create_data_store_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_store_service.GetDataStoreRequest, - dict, + data_store_service.GetDataStoreRequest(), + {}, ], ) def test_get_data_store(request_type, transport: str = "grpc"): @@ -1738,7 +1754,7 @@ def test_get_data_store(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_data_store), "__call__") as call: @@ -1794,9 +1810,10 @@ def test_get_data_store_non_empty_request_with_auto_populated_field(): client.get_data_store(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_store_service.GetDataStoreRequest( + request_msg = data_store_service.GetDataStoreRequest( name="name_value", ) + assert args[0] == request_msg def test_get_data_store_use_cached_wrapped_rpc(): @@ -1877,9 +1894,14 @@ async def test_get_data_store_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_data_store_async( - transport: str = "grpc_asyncio", request_type=data_store_service.GetDataStoreRequest -): +@pytest.mark.parametrize( + "request_type", + [ + data_store_service.GetDataStoreRequest(), + {}, + ], +) +async def test_get_data_store_async(request_type, transport: str = "grpc_asyncio"): client = DataStoreServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1887,7 +1909,7 @@ async def test_get_data_store_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_data_store), "__call__") as call: @@ -1922,11 +1944,6 @@ async def test_get_data_store_async( assert response.acl_enabled is True -@pytest.mark.asyncio -async def test_get_data_store_async_from_dict(): - await test_get_data_store_async(request_type=dict) - - def test_get_data_store_field_headers(): client = DataStoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2073,8 +2090,8 @@ async def test_get_data_store_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_store_service.ListDataStoresRequest, - dict, + data_store_service.ListDataStoresRequest(), + {}, ], ) def test_list_data_stores(request_type, transport: str = "grpc"): @@ -2085,7 +2102,7 @@ def test_list_data_stores(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_data_stores), "__call__") as call: @@ -2131,11 +2148,12 @@ def test_list_data_stores_non_empty_request_with_auto_populated_field(): client.list_data_stores(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_store_service.ListDataStoresRequest( + request_msg = data_store_service.ListDataStoresRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_data_stores_use_cached_wrapped_rpc(): @@ -2218,10 +2236,14 @@ async def test_list_data_stores_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_data_stores_async( - transport: str = "grpc_asyncio", - request_type=data_store_service.ListDataStoresRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + data_store_service.ListDataStoresRequest(), + {}, + ], +) +async def test_list_data_stores_async(request_type, transport: str = "grpc_asyncio"): client = DataStoreServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2229,7 +2251,7 @@ async def test_list_data_stores_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_data_stores), "__call__") as call: @@ -2252,11 +2274,6 @@ async def test_list_data_stores_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_data_stores_async_from_dict(): - await test_list_data_stores_async(request_type=dict) - - def test_list_data_stores_field_headers(): client = DataStoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2593,8 +2610,8 @@ async def test_list_data_stores_async_pages(): @pytest.mark.parametrize( "request_type", [ - data_store_service.DeleteDataStoreRequest, - dict, + data_store_service.DeleteDataStoreRequest(), + {}, ], ) def test_delete_data_store(request_type, transport: str = "grpc"): @@ -2605,7 +2622,7 @@ def test_delete_data_store(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2650,9 +2667,10 @@ def test_delete_data_store_non_empty_request_with_auto_populated_field(): client.delete_data_store(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_store_service.DeleteDataStoreRequest( + request_msg = data_store_service.DeleteDataStoreRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_data_store_use_cached_wrapped_rpc(): @@ -2745,10 +2763,14 @@ async def test_delete_data_store_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_data_store_async( - transport: str = "grpc_asyncio", - request_type=data_store_service.DeleteDataStoreRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + data_store_service.DeleteDataStoreRequest(), + {}, + ], +) +async def test_delete_data_store_async(request_type, transport: str = "grpc_asyncio"): client = DataStoreServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2756,7 +2778,7 @@ async def test_delete_data_store_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( @@ -2778,11 +2800,6 @@ async def test_delete_data_store_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_data_store_async_from_dict(): - await test_delete_data_store_async(request_type=dict) - - def test_delete_data_store_field_headers(): client = DataStoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2937,8 +2954,8 @@ async def test_delete_data_store_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_store_service.UpdateDataStoreRequest, - dict, + data_store_service.UpdateDataStoreRequest(), + {}, ], ) def test_update_data_store(request_type, transport: str = "grpc"): @@ -2949,7 +2966,7 @@ def test_update_data_store(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3007,7 +3024,8 @@ def test_update_data_store_non_empty_request_with_auto_populated_field(): client.update_data_store(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_store_service.UpdateDataStoreRequest() + request_msg = data_store_service.UpdateDataStoreRequest() + assert args[0] == request_msg def test_update_data_store_use_cached_wrapped_rpc(): @@ -3090,10 +3108,14 @@ async def test_update_data_store_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_data_store_async( - transport: str = "grpc_asyncio", - request_type=data_store_service.UpdateDataStoreRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + data_store_service.UpdateDataStoreRequest(), + {}, + ], +) +async def test_update_data_store_async(request_type, transport: str = "grpc_asyncio"): client = DataStoreServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3101,7 +3123,7 @@ async def test_update_data_store_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( @@ -3138,11 +3160,6 @@ async def test_update_data_store_async( assert response.acl_enabled is True -@pytest.mark.asyncio -async def test_update_data_store_async_from_dict(): - await test_update_data_store_async(request_type=dict) - - def test_update_data_store_field_headers(): client = DataStoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3307,8 +3324,8 @@ async def test_update_data_store_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_store_service.GetDocumentProcessingConfigRequest, - dict, + data_store_service.GetDocumentProcessingConfigRequest(), + {}, ], ) def test_get_document_processing_config(request_type, transport: str = "grpc"): @@ -3319,7 +3336,7 @@ def test_get_document_processing_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( @@ -3367,9 +3384,10 @@ def test_get_document_processing_config_non_empty_request_with_auto_populated_fi client.get_document_processing_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_store_service.GetDocumentProcessingConfigRequest( + request_msg = data_store_service.GetDocumentProcessingConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_document_processing_config_use_cached_wrapped_rpc(): @@ -3455,9 +3473,15 @@ async def test_get_document_processing_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_store_service.GetDocumentProcessingConfigRequest(), + {}, + ], +) async def test_get_document_processing_config_async( - transport: str = "grpc_asyncio", - request_type=data_store_service.GetDocumentProcessingConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataStoreServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3466,7 +3490,7 @@ async def test_get_document_processing_config_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( @@ -3491,11 +3515,6 @@ async def test_get_document_processing_config_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_document_processing_config_async_from_dict(): - await test_get_document_processing_config_async(request_type=dict) - - def test_get_document_processing_config_field_headers(): client = DataStoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3650,8 +3669,8 @@ async def test_get_document_processing_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_store_service.UpdateDocumentProcessingConfigRequest, - dict, + data_store_service.UpdateDocumentProcessingConfigRequest(), + {}, ], ) def test_update_document_processing_config(request_type, transport: str = "grpc"): @@ -3662,7 +3681,7 @@ def test_update_document_processing_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( @@ -3708,7 +3727,8 @@ def test_update_document_processing_config_non_empty_request_with_auto_populated client.update_document_processing_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_store_service.UpdateDocumentProcessingConfigRequest() + request_msg = data_store_service.UpdateDocumentProcessingConfigRequest() + assert args[0] == request_msg def test_update_document_processing_config_use_cached_wrapped_rpc(): @@ -3794,9 +3814,15 @@ async def test_update_document_processing_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_store_service.UpdateDocumentProcessingConfigRequest(), + {}, + ], +) async def test_update_document_processing_config_async( - transport: str = "grpc_asyncio", - request_type=data_store_service.UpdateDocumentProcessingConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataStoreServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3805,7 +3831,7 @@ async def test_update_document_processing_config_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( @@ -3830,11 +3856,6 @@ async def test_update_document_processing_config_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_update_document_processing_config_async_from_dict(): - await test_update_document_processing_config_async(request_type=dict) - - def test_update_document_processing_config_field_headers(): client = DataStoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5550,7 +5571,6 @@ def test_create_data_store_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_store_service.CreateDataStoreRequest() - assert args[0] == request_msg @@ -5571,7 +5591,6 @@ def test_get_data_store_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_store_service.GetDataStoreRequest() - assert args[0] == request_msg @@ -5592,7 +5611,6 @@ def test_list_data_stores_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_store_service.ListDataStoresRequest() - assert args[0] == request_msg @@ -5615,7 +5633,6 @@ def test_delete_data_store_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_store_service.DeleteDataStoreRequest() - assert args[0] == request_msg @@ -5638,7 +5655,6 @@ def test_update_data_store_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_store_service.UpdateDataStoreRequest() - assert args[0] == request_msg @@ -5661,7 +5677,6 @@ def test_get_document_processing_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_store_service.GetDocumentProcessingConfigRequest() - assert args[0] == request_msg @@ -5684,7 +5699,6 @@ def test_update_document_processing_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_store_service.UpdateDocumentProcessingConfigRequest() - assert args[0] == request_msg @@ -5725,7 +5739,6 @@ async def test_create_data_store_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_store_service.CreateDataStoreRequest() - assert args[0] == request_msg @@ -5758,7 +5771,6 @@ async def test_get_data_store_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_store_service.GetDataStoreRequest() - assert args[0] == request_msg @@ -5785,7 +5797,6 @@ async def test_list_data_stores_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_store_service.ListDataStoresRequest() - assert args[0] == request_msg @@ -5812,7 +5823,6 @@ async def test_delete_data_store_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_store_service.DeleteDataStoreRequest() - assert args[0] == request_msg @@ -5847,7 +5857,6 @@ async def test_update_data_store_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_store_service.UpdateDataStoreRequest() - assert args[0] == request_msg @@ -5876,7 +5885,6 @@ async def test_get_document_processing_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_store_service.GetDocumentProcessingConfigRequest() - assert args[0] == request_msg @@ -5905,7 +5913,6 @@ async def test_update_document_processing_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_store_service.UpdateDocumentProcessingConfigRequest() - assert args[0] == request_msg @@ -7479,7 +7486,6 @@ def test_create_data_store_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_store_service.CreateDataStoreRequest() - assert args[0] == request_msg @@ -7499,7 +7505,6 @@ def test_get_data_store_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_store_service.GetDataStoreRequest() - assert args[0] == request_msg @@ -7519,7 +7524,6 @@ def test_list_data_stores_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_store_service.ListDataStoresRequest() - assert args[0] == request_msg @@ -7541,7 +7545,6 @@ def test_delete_data_store_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_store_service.DeleteDataStoreRequest() - assert args[0] == request_msg @@ -7563,7 +7566,6 @@ def test_update_data_store_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_store_service.UpdateDataStoreRequest() - assert args[0] == request_msg @@ -7585,7 +7587,6 @@ def test_get_document_processing_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_store_service.GetDocumentProcessingConfigRequest() - assert args[0] == request_msg @@ -7607,7 +7608,6 @@ def test_update_document_processing_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_store_service.UpdateDocumentProcessingConfigRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_document_service.py b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_document_service.py index eba9d300c72b..d182a9a2be6a 100644 --- a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_document_service.py +++ b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_document_service.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 @@ -126,6 +127,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" @@ -1353,8 +1369,8 @@ def test_document_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - document_service.GetDocumentRequest, - dict, + document_service.GetDocumentRequest(), + {}, ], ) def test_get_document(request_type, transport: str = "grpc"): @@ -1365,7 +1381,7 @@ def test_get_document(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_document), "__call__") as call: @@ -1416,9 +1432,10 @@ def test_get_document_non_empty_request_with_auto_populated_field(): client.get_document(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_service.GetDocumentRequest( + request_msg = document_service.GetDocumentRequest( name="name_value", ) + assert args[0] == request_msg def test_get_document_use_cached_wrapped_rpc(): @@ -1499,9 +1516,14 @@ async def test_get_document_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_document_async( - transport: str = "grpc_asyncio", request_type=document_service.GetDocumentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + document_service.GetDocumentRequest(), + {}, + ], +) +async def test_get_document_async(request_type, transport: str = "grpc_asyncio"): client = DocumentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1509,7 +1531,7 @@ async def test_get_document_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_document), "__call__") as call: @@ -1538,11 +1560,6 @@ async def test_get_document_async( assert response.parent_document_id == "parent_document_id_value" -@pytest.mark.asyncio -async def test_get_document_async_from_dict(): - await test_get_document_async(request_type=dict) - - def test_get_document_field_headers(): client = DocumentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1685,8 +1702,8 @@ async def test_get_document_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - document_service.ListDocumentsRequest, - dict, + document_service.ListDocumentsRequest(), + {}, ], ) def test_list_documents(request_type, transport: str = "grpc"): @@ -1697,7 +1714,7 @@ def test_list_documents(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_documents), "__call__") as call: @@ -1742,10 +1759,11 @@ def test_list_documents_non_empty_request_with_auto_populated_field(): client.list_documents(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_service.ListDocumentsRequest( + request_msg = document_service.ListDocumentsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_documents_use_cached_wrapped_rpc(): @@ -1826,9 +1844,14 @@ async def test_list_documents_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_documents_async( - transport: str = "grpc_asyncio", request_type=document_service.ListDocumentsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + document_service.ListDocumentsRequest(), + {}, + ], +) +async def test_list_documents_async(request_type, transport: str = "grpc_asyncio"): client = DocumentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1836,7 +1859,7 @@ async def test_list_documents_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_documents), "__call__") as call: @@ -1859,11 +1882,6 @@ async def test_list_documents_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_documents_async_from_dict(): - await test_list_documents_async(request_type=dict) - - def test_list_documents_field_headers(): client = DocumentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2200,8 +2218,8 @@ async def test_list_documents_async_pages(): @pytest.mark.parametrize( "request_type", [ - document_service.CreateDocumentRequest, - dict, + document_service.CreateDocumentRequest(), + {}, ], ) def test_create_document(request_type, transport: str = "grpc"): @@ -2212,7 +2230,7 @@ def test_create_document(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_document), "__call__") as call: @@ -2264,10 +2282,11 @@ def test_create_document_non_empty_request_with_auto_populated_field(): client.create_document(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_service.CreateDocumentRequest( + request_msg = document_service.CreateDocumentRequest( parent="parent_value", document_id="document_id_value", ) + assert args[0] == request_msg def test_create_document_use_cached_wrapped_rpc(): @@ -2348,9 +2367,14 @@ async def test_create_document_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_document_async( - transport: str = "grpc_asyncio", request_type=document_service.CreateDocumentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + document_service.CreateDocumentRequest(), + {}, + ], +) +async def test_create_document_async(request_type, transport: str = "grpc_asyncio"): client = DocumentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2358,7 +2382,7 @@ async def test_create_document_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_document), "__call__") as call: @@ -2387,11 +2411,6 @@ async def test_create_document_async( assert response.parent_document_id == "parent_document_id_value" -@pytest.mark.asyncio -async def test_create_document_async_from_dict(): - await test_create_document_async(request_type=dict) - - def test_create_document_field_headers(): client = DocumentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2606,8 +2625,8 @@ async def test_create_document_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - document_service.UpdateDocumentRequest, - dict, + document_service.UpdateDocumentRequest(), + {}, ], ) def test_update_document(request_type, transport: str = "grpc"): @@ -2618,7 +2637,7 @@ def test_update_document(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_document), "__call__") as call: @@ -2667,7 +2686,8 @@ def test_update_document_non_empty_request_with_auto_populated_field(): client.update_document(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_service.UpdateDocumentRequest() + request_msg = document_service.UpdateDocumentRequest() + assert args[0] == request_msg def test_update_document_use_cached_wrapped_rpc(): @@ -2748,9 +2768,14 @@ async def test_update_document_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_document_async( - transport: str = "grpc_asyncio", request_type=document_service.UpdateDocumentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + document_service.UpdateDocumentRequest(), + {}, + ], +) +async def test_update_document_async(request_type, transport: str = "grpc_asyncio"): client = DocumentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2758,7 +2783,7 @@ async def test_update_document_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_document), "__call__") as call: @@ -2787,11 +2812,6 @@ async def test_update_document_async( assert response.parent_document_id == "parent_document_id_value" -@pytest.mark.asyncio -async def test_update_document_async_from_dict(): - await test_update_document_async(request_type=dict) - - def test_update_document_field_headers(): client = DocumentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2996,8 +3016,8 @@ async def test_update_document_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - document_service.DeleteDocumentRequest, - dict, + document_service.DeleteDocumentRequest(), + {}, ], ) def test_delete_document(request_type, transport: str = "grpc"): @@ -3008,7 +3028,7 @@ def test_delete_document(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_document), "__call__") as call: @@ -3049,9 +3069,10 @@ def test_delete_document_non_empty_request_with_auto_populated_field(): client.delete_document(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_service.DeleteDocumentRequest( + request_msg = document_service.DeleteDocumentRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_document_use_cached_wrapped_rpc(): @@ -3132,9 +3153,14 @@ async def test_delete_document_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_document_async( - transport: str = "grpc_asyncio", request_type=document_service.DeleteDocumentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + document_service.DeleteDocumentRequest(), + {}, + ], +) +async def test_delete_document_async(request_type, transport: str = "grpc_asyncio"): client = DocumentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3142,7 +3168,7 @@ async def test_delete_document_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_document), "__call__") as call: @@ -3160,11 +3186,6 @@ async def test_delete_document_async( assert response is None -@pytest.mark.asyncio -async def test_delete_document_async_from_dict(): - await test_delete_document_async(request_type=dict) - - def test_delete_document_field_headers(): client = DocumentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3307,8 +3328,8 @@ async def test_delete_document_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - import_config.ImportDocumentsRequest, - dict, + import_config.ImportDocumentsRequest(), + {}, ], ) def test_import_documents(request_type, transport: str = "grpc"): @@ -3319,7 +3340,7 @@ def test_import_documents(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.import_documents), "__call__") as call: @@ -3361,10 +3382,11 @@ def test_import_documents_non_empty_request_with_auto_populated_field(): client.import_documents(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == import_config.ImportDocumentsRequest( + request_msg = import_config.ImportDocumentsRequest( parent="parent_value", id_field="id_field_value", ) + assert args[0] == request_msg def test_import_documents_use_cached_wrapped_rpc(): @@ -3457,9 +3479,14 @@ async def test_import_documents_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_import_documents_async( - transport: str = "grpc_asyncio", request_type=import_config.ImportDocumentsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + import_config.ImportDocumentsRequest(), + {}, + ], +) +async def test_import_documents_async(request_type, transport: str = "grpc_asyncio"): client = DocumentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3467,7 +3494,7 @@ async def test_import_documents_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.import_documents), "__call__") as call: @@ -3487,11 +3514,6 @@ async def test_import_documents_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_import_documents_async_from_dict(): - await test_import_documents_async(request_type=dict) - - def test_import_documents_field_headers(): client = DocumentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3556,8 +3578,8 @@ async def test_import_documents_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - purge_config.PurgeDocumentsRequest, - dict, + purge_config.PurgeDocumentsRequest(), + {}, ], ) def test_purge_documents(request_type, transport: str = "grpc"): @@ -3568,7 +3590,7 @@ def test_purge_documents(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.purge_documents), "__call__") as call: @@ -3610,10 +3632,11 @@ def test_purge_documents_non_empty_request_with_auto_populated_field(): client.purge_documents(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == purge_config.PurgeDocumentsRequest( + request_msg = purge_config.PurgeDocumentsRequest( parent="parent_value", filter="filter_value", ) + assert args[0] == request_msg def test_purge_documents_use_cached_wrapped_rpc(): @@ -3704,9 +3727,14 @@ async def test_purge_documents_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_purge_documents_async( - transport: str = "grpc_asyncio", request_type=purge_config.PurgeDocumentsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + purge_config.PurgeDocumentsRequest(), + {}, + ], +) +async def test_purge_documents_async(request_type, transport: str = "grpc_asyncio"): client = DocumentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3714,7 +3742,7 @@ async def test_purge_documents_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.purge_documents), "__call__") as call: @@ -3734,11 +3762,6 @@ async def test_purge_documents_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_purge_documents_async_from_dict(): - await test_purge_documents_async(request_type=dict) - - def test_purge_documents_field_headers(): client = DocumentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3803,8 +3826,8 @@ async def test_purge_documents_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - document_service.GetProcessedDocumentRequest, - dict, + document_service.GetProcessedDocumentRequest(), + {}, ], ) def test_get_processed_document(request_type, transport: str = "grpc"): @@ -3815,7 +3838,7 @@ def test_get_processed_document(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3864,9 +3887,10 @@ def test_get_processed_document_non_empty_request_with_auto_populated_field(): client.get_processed_document(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_service.GetProcessedDocumentRequest( + request_msg = document_service.GetProcessedDocumentRequest( name="name_value", ) + assert args[0] == request_msg def test_get_processed_document_use_cached_wrapped_rpc(): @@ -3952,9 +3976,15 @@ async def test_get_processed_document_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + document_service.GetProcessedDocumentRequest(), + {}, + ], +) async def test_get_processed_document_async( - transport: str = "grpc_asyncio", - request_type=document_service.GetProcessedDocumentRequest, + request_type, transport: str = "grpc_asyncio" ): client = DocumentServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3963,7 +3993,7 @@ async def test_get_processed_document_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( @@ -3988,11 +4018,6 @@ async def test_get_processed_document_async( assert response.document == "document_value" -@pytest.mark.asyncio -async def test_get_processed_document_async_from_dict(): - await test_get_processed_document_async(request_type=dict) - - def test_get_processed_document_field_headers(): client = DocumentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4147,8 +4172,8 @@ async def test_get_processed_document_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - document_service.BatchGetDocumentsMetadataRequest, - dict, + document_service.BatchGetDocumentsMetadataRequest(), + {}, ], ) def test_batch_get_documents_metadata(request_type, transport: str = "grpc"): @@ -4159,7 +4184,7 @@ def test_batch_get_documents_metadata(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,9 +4229,10 @@ def test_batch_get_documents_metadata_non_empty_request_with_auto_populated_fiel client.batch_get_documents_metadata(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_service.BatchGetDocumentsMetadataRequest( + request_msg = document_service.BatchGetDocumentsMetadataRequest( parent="parent_value", ) + assert args[0] == request_msg def test_batch_get_documents_metadata_use_cached_wrapped_rpc(): @@ -4292,9 +4318,15 @@ async def test_batch_get_documents_metadata_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + document_service.BatchGetDocumentsMetadataRequest(), + {}, + ], +) async def test_batch_get_documents_metadata_async( - transport: str = "grpc_asyncio", - request_type=document_service.BatchGetDocumentsMetadataRequest, + request_type, transport: str = "grpc_asyncio" ): client = DocumentServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4303,7 +4335,7 @@ async def test_batch_get_documents_metadata_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( @@ -4325,11 +4357,6 @@ async def test_batch_get_documents_metadata_async( assert isinstance(response, document_service.BatchGetDocumentsMetadataResponse) -@pytest.mark.asyncio -async def test_batch_get_documents_metadata_async_from_dict(): - await test_batch_get_documents_metadata_async(request_type=dict) - - def test_batch_get_documents_metadata_field_headers(): client = DocumentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6317,7 +6344,6 @@ def test_get_document_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.GetDocumentRequest() - assert args[0] == request_msg @@ -6338,7 +6364,6 @@ def test_list_documents_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.ListDocumentsRequest() - assert args[0] == request_msg @@ -6359,7 +6384,6 @@ def test_create_document_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.CreateDocumentRequest() - assert args[0] == request_msg @@ -6380,7 +6404,6 @@ def test_update_document_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.UpdateDocumentRequest() - assert args[0] == request_msg @@ -6401,7 +6424,6 @@ def test_delete_document_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.DeleteDocumentRequest() - assert args[0] == request_msg @@ -6422,7 +6444,6 @@ def test_import_documents_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_config.ImportDocumentsRequest() - assert args[0] == request_msg @@ -6443,7 +6464,6 @@ def test_purge_documents_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = purge_config.PurgeDocumentsRequest() - assert args[0] == request_msg @@ -6466,7 +6486,6 @@ def test_get_processed_document_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.GetProcessedDocumentRequest() - assert args[0] == request_msg @@ -6489,7 +6508,6 @@ def test_batch_get_documents_metadata_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.BatchGetDocumentsMetadataRequest() - assert args[0] == request_msg @@ -6533,7 +6551,6 @@ async def test_get_document_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.GetDocumentRequest() - assert args[0] == request_msg @@ -6560,7 +6577,6 @@ async def test_list_documents_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.ListDocumentsRequest() - assert args[0] == request_msg @@ -6590,7 +6606,6 @@ async def test_create_document_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.CreateDocumentRequest() - assert args[0] == request_msg @@ -6620,7 +6635,6 @@ async def test_update_document_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.UpdateDocumentRequest() - assert args[0] == request_msg @@ -6643,7 +6657,6 @@ async def test_delete_document_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.DeleteDocumentRequest() - assert args[0] == request_msg @@ -6668,7 +6681,6 @@ async def test_import_documents_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_config.ImportDocumentsRequest() - assert args[0] == request_msg @@ -6693,7 +6705,6 @@ async def test_purge_documents_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = purge_config.PurgeDocumentsRequest() - assert args[0] == request_msg @@ -6722,7 +6733,6 @@ async def test_get_processed_document_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.GetProcessedDocumentRequest() - assert args[0] == request_msg @@ -6749,7 +6759,6 @@ async def test_batch_get_documents_metadata_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.BatchGetDocumentsMetadataRequest() - assert args[0] == request_msg @@ -8421,7 +8430,6 @@ def test_get_document_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.GetDocumentRequest() - assert args[0] == request_msg @@ -8441,7 +8449,6 @@ def test_list_documents_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.ListDocumentsRequest() - assert args[0] == request_msg @@ -8461,7 +8468,6 @@ def test_create_document_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.CreateDocumentRequest() - assert args[0] == request_msg @@ -8481,7 +8487,6 @@ def test_update_document_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.UpdateDocumentRequest() - assert args[0] == request_msg @@ -8501,7 +8506,6 @@ def test_delete_document_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.DeleteDocumentRequest() - assert args[0] == request_msg @@ -8521,7 +8525,6 @@ def test_import_documents_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_config.ImportDocumentsRequest() - assert args[0] == request_msg @@ -8541,7 +8544,6 @@ def test_purge_documents_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = purge_config.PurgeDocumentsRequest() - assert args[0] == request_msg @@ -8563,7 +8565,6 @@ def test_get_processed_document_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.GetProcessedDocumentRequest() - assert args[0] == request_msg @@ -8585,7 +8586,6 @@ def test_batch_get_documents_metadata_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.BatchGetDocumentsMetadataRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_engine_service.py b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_engine_service.py index f28c6a213342..36b08e070e0e 100644 --- a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_engine_service.py +++ b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_engine_service.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 @@ -117,6 +118,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" @@ -1316,8 +1332,8 @@ def test_engine_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - engine_service.CreateEngineRequest, - dict, + engine_service.CreateEngineRequest(), + {}, ], ) def test_create_engine(request_type, transport: str = "grpc"): @@ -1328,7 +1344,7 @@ def test_create_engine(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_engine), "__call__") as call: @@ -1370,10 +1386,11 @@ def test_create_engine_non_empty_request_with_auto_populated_field(): client.create_engine(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == engine_service.CreateEngineRequest( + request_msg = engine_service.CreateEngineRequest( parent="parent_value", engine_id="engine_id_value", ) + assert args[0] == request_msg def test_create_engine_use_cached_wrapped_rpc(): @@ -1464,9 +1481,14 @@ async def test_create_engine_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_engine_async( - transport: str = "grpc_asyncio", request_type=engine_service.CreateEngineRequest -): +@pytest.mark.parametrize( + "request_type", + [ + engine_service.CreateEngineRequest(), + {}, + ], +) +async def test_create_engine_async(request_type, transport: str = "grpc_asyncio"): client = EngineServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1474,7 +1496,7 @@ async def test_create_engine_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_engine), "__call__") as call: @@ -1494,11 +1516,6 @@ async def test_create_engine_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_engine_async_from_dict(): - await test_create_engine_async(request_type=dict) - - def test_create_engine_field_headers(): client = EngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1665,8 +1682,8 @@ async def test_create_engine_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - engine_service.DeleteEngineRequest, - dict, + engine_service.DeleteEngineRequest(), + {}, ], ) def test_delete_engine(request_type, transport: str = "grpc"): @@ -1677,7 +1694,7 @@ def test_delete_engine(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_engine), "__call__") as call: @@ -1718,9 +1735,10 @@ def test_delete_engine_non_empty_request_with_auto_populated_field(): client.delete_engine(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == engine_service.DeleteEngineRequest( + request_msg = engine_service.DeleteEngineRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_engine_use_cached_wrapped_rpc(): @@ -1811,9 +1829,14 @@ async def test_delete_engine_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_engine_async( - transport: str = "grpc_asyncio", request_type=engine_service.DeleteEngineRequest -): +@pytest.mark.parametrize( + "request_type", + [ + engine_service.DeleteEngineRequest(), + {}, + ], +) +async def test_delete_engine_async(request_type, transport: str = "grpc_asyncio"): client = EngineServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1821,7 +1844,7 @@ async def test_delete_engine_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_engine), "__call__") as call: @@ -1841,11 +1864,6 @@ async def test_delete_engine_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_engine_async_from_dict(): - await test_delete_engine_async(request_type=dict) - - def test_delete_engine_field_headers(): client = EngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1992,8 +2010,8 @@ async def test_delete_engine_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - engine_service.UpdateEngineRequest, - dict, + engine_service.UpdateEngineRequest(), + {}, ], ) def test_update_engine(request_type, transport: str = "grpc"): @@ -2004,7 +2022,7 @@ def test_update_engine(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_engine), "__call__") as call: @@ -2054,7 +2072,8 @@ def test_update_engine_non_empty_request_with_auto_populated_field(): client.update_engine(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == engine_service.UpdateEngineRequest() + request_msg = engine_service.UpdateEngineRequest() + assert args[0] == request_msg def test_update_engine_use_cached_wrapped_rpc(): @@ -2135,9 +2154,14 @@ async def test_update_engine_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_engine_async( - transport: str = "grpc_asyncio", request_type=engine_service.UpdateEngineRequest -): +@pytest.mark.parametrize( + "request_type", + [ + engine_service.UpdateEngineRequest(), + {}, + ], +) +async def test_update_engine_async(request_type, transport: str = "grpc_asyncio"): client = EngineServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2145,7 +2169,7 @@ async def test_update_engine_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_engine), "__call__") as call: @@ -2176,11 +2200,6 @@ async def test_update_engine_async( assert response.industry_vertical == common.IndustryVertical.GENERIC -@pytest.mark.asyncio -async def test_update_engine_async_from_dict(): - await test_update_engine_async(request_type=dict) - - def test_update_engine_field_headers(): client = EngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2333,8 +2352,8 @@ async def test_update_engine_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - engine_service.GetEngineRequest, - dict, + engine_service.GetEngineRequest(), + {}, ], ) def test_get_engine(request_type, transport: str = "grpc"): @@ -2345,7 +2364,7 @@ def test_get_engine(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_engine), "__call__") as call: @@ -2397,9 +2416,10 @@ def test_get_engine_non_empty_request_with_auto_populated_field(): client.get_engine(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == engine_service.GetEngineRequest( + request_msg = engine_service.GetEngineRequest( name="name_value", ) + assert args[0] == request_msg def test_get_engine_use_cached_wrapped_rpc(): @@ -2478,9 +2498,14 @@ async def test_get_engine_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_engine_async( - transport: str = "grpc_asyncio", request_type=engine_service.GetEngineRequest -): +@pytest.mark.parametrize( + "request_type", + [ + engine_service.GetEngineRequest(), + {}, + ], +) +async def test_get_engine_async(request_type, transport: str = "grpc_asyncio"): client = EngineServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2488,7 +2513,7 @@ async def test_get_engine_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_engine), "__call__") as call: @@ -2519,11 +2544,6 @@ async def test_get_engine_async( assert response.industry_vertical == common.IndustryVertical.GENERIC -@pytest.mark.asyncio -async def test_get_engine_async_from_dict(): - await test_get_engine_async(request_type=dict) - - def test_get_engine_field_headers(): client = EngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2666,8 +2686,8 @@ async def test_get_engine_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - engine_service.ListEnginesRequest, - dict, + engine_service.ListEnginesRequest(), + {}, ], ) def test_list_engines(request_type, transport: str = "grpc"): @@ -2678,7 +2698,7 @@ def test_list_engines(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_engines), "__call__") as call: @@ -2724,11 +2744,12 @@ def test_list_engines_non_empty_request_with_auto_populated_field(): client.list_engines(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == engine_service.ListEnginesRequest( + request_msg = engine_service.ListEnginesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_engines_use_cached_wrapped_rpc(): @@ -2809,9 +2830,14 @@ async def test_list_engines_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_engines_async( - transport: str = "grpc_asyncio", request_type=engine_service.ListEnginesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + engine_service.ListEnginesRequest(), + {}, + ], +) +async def test_list_engines_async(request_type, transport: str = "grpc_asyncio"): client = EngineServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2819,7 +2845,7 @@ async def test_list_engines_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_engines), "__call__") as call: @@ -2842,11 +2868,6 @@ async def test_list_engines_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_engines_async_from_dict(): - await test_list_engines_async(request_type=dict) - - def test_list_engines_field_headers(): client = EngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3183,8 +3204,8 @@ async def test_list_engines_async_pages(): @pytest.mark.parametrize( "request_type", [ - engine_service.PauseEngineRequest, - dict, + engine_service.PauseEngineRequest(), + {}, ], ) def test_pause_engine(request_type, transport: str = "grpc"): @@ -3195,7 +3216,7 @@ def test_pause_engine(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.pause_engine), "__call__") as call: @@ -3247,9 +3268,10 @@ def test_pause_engine_non_empty_request_with_auto_populated_field(): client.pause_engine(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == engine_service.PauseEngineRequest( + request_msg = engine_service.PauseEngineRequest( name="name_value", ) + assert args[0] == request_msg def test_pause_engine_use_cached_wrapped_rpc(): @@ -3330,9 +3352,14 @@ async def test_pause_engine_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_pause_engine_async( - transport: str = "grpc_asyncio", request_type=engine_service.PauseEngineRequest -): +@pytest.mark.parametrize( + "request_type", + [ + engine_service.PauseEngineRequest(), + {}, + ], +) +async def test_pause_engine_async(request_type, transport: str = "grpc_asyncio"): client = EngineServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3340,7 +3367,7 @@ async def test_pause_engine_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.pause_engine), "__call__") as call: @@ -3371,11 +3398,6 @@ async def test_pause_engine_async( assert response.industry_vertical == common.IndustryVertical.GENERIC -@pytest.mark.asyncio -async def test_pause_engine_async_from_dict(): - await test_pause_engine_async(request_type=dict) - - def test_pause_engine_field_headers(): client = EngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3518,8 +3540,8 @@ async def test_pause_engine_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - engine_service.ResumeEngineRequest, - dict, + engine_service.ResumeEngineRequest(), + {}, ], ) def test_resume_engine(request_type, transport: str = "grpc"): @@ -3530,7 +3552,7 @@ def test_resume_engine(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.resume_engine), "__call__") as call: @@ -3582,9 +3604,10 @@ def test_resume_engine_non_empty_request_with_auto_populated_field(): client.resume_engine(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == engine_service.ResumeEngineRequest( + request_msg = engine_service.ResumeEngineRequest( name="name_value", ) + assert args[0] == request_msg def test_resume_engine_use_cached_wrapped_rpc(): @@ -3665,9 +3688,14 @@ async def test_resume_engine_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_resume_engine_async( - transport: str = "grpc_asyncio", request_type=engine_service.ResumeEngineRequest -): +@pytest.mark.parametrize( + "request_type", + [ + engine_service.ResumeEngineRequest(), + {}, + ], +) +async def test_resume_engine_async(request_type, transport: str = "grpc_asyncio"): client = EngineServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3675,7 +3703,7 @@ async def test_resume_engine_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.resume_engine), "__call__") as call: @@ -3706,11 +3734,6 @@ async def test_resume_engine_async( assert response.industry_vertical == common.IndustryVertical.GENERIC -@pytest.mark.asyncio -async def test_resume_engine_async_from_dict(): - await test_resume_engine_async(request_type=dict) - - def test_resume_engine_field_headers(): client = EngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3853,8 +3876,8 @@ async def test_resume_engine_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - engine_service.TuneEngineRequest, - dict, + engine_service.TuneEngineRequest(), + {}, ], ) def test_tune_engine(request_type, transport: str = "grpc"): @@ -3865,7 +3888,7 @@ def test_tune_engine(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.tune_engine), "__call__") as call: @@ -3906,9 +3929,10 @@ def test_tune_engine_non_empty_request_with_auto_populated_field(): client.tune_engine(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == engine_service.TuneEngineRequest( + request_msg = engine_service.TuneEngineRequest( name="name_value", ) + assert args[0] == request_msg def test_tune_engine_use_cached_wrapped_rpc(): @@ -3999,9 +4023,14 @@ async def test_tune_engine_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_tune_engine_async( - transport: str = "grpc_asyncio", request_type=engine_service.TuneEngineRequest -): +@pytest.mark.parametrize( + "request_type", + [ + engine_service.TuneEngineRequest(), + {}, + ], +) +async def test_tune_engine_async(request_type, transport: str = "grpc_asyncio"): client = EngineServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4009,7 +4038,7 @@ async def test_tune_engine_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.tune_engine), "__call__") as call: @@ -4029,11 +4058,6 @@ async def test_tune_engine_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_tune_engine_async_from_dict(): - await test_tune_engine_async(request_type=dict) - - def test_tune_engine_field_headers(): client = EngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5851,7 +5875,6 @@ def test_create_engine_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_service.CreateEngineRequest() - assert args[0] == request_msg @@ -5872,7 +5895,6 @@ def test_delete_engine_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_service.DeleteEngineRequest() - assert args[0] == request_msg @@ -5893,7 +5915,6 @@ def test_update_engine_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_service.UpdateEngineRequest() - assert args[0] == request_msg @@ -5914,7 +5935,6 @@ def test_get_engine_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_service.GetEngineRequest() - assert args[0] == request_msg @@ -5935,7 +5955,6 @@ def test_list_engines_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_service.ListEnginesRequest() - assert args[0] == request_msg @@ -5956,7 +5975,6 @@ def test_pause_engine_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_service.PauseEngineRequest() - assert args[0] == request_msg @@ -5977,7 +5995,6 @@ def test_resume_engine_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_service.ResumeEngineRequest() - assert args[0] == request_msg @@ -5998,7 +6015,6 @@ def test_tune_engine_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_service.TuneEngineRequest() - assert args[0] == request_msg @@ -6037,7 +6053,6 @@ async def test_create_engine_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_service.CreateEngineRequest() - assert args[0] == request_msg @@ -6062,7 +6077,6 @@ async def test_delete_engine_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_service.DeleteEngineRequest() - assert args[0] == request_msg @@ -6093,7 +6107,6 @@ async def test_update_engine_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_service.UpdateEngineRequest() - assert args[0] == request_msg @@ -6124,7 +6137,6 @@ async def test_get_engine_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_service.GetEngineRequest() - assert args[0] == request_msg @@ -6151,7 +6163,6 @@ async def test_list_engines_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_service.ListEnginesRequest() - assert args[0] == request_msg @@ -6182,7 +6193,6 @@ async def test_pause_engine_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_service.PauseEngineRequest() - assert args[0] == request_msg @@ -6213,7 +6223,6 @@ async def test_resume_engine_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_service.ResumeEngineRequest() - assert args[0] == request_msg @@ -6238,7 +6247,6 @@ async def test_tune_engine_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_service.TuneEngineRequest() - assert args[0] == request_msg @@ -7763,7 +7771,6 @@ def test_create_engine_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_service.CreateEngineRequest() - assert args[0] == request_msg @@ -7783,7 +7790,6 @@ def test_delete_engine_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_service.DeleteEngineRequest() - assert args[0] == request_msg @@ -7803,7 +7809,6 @@ def test_update_engine_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_service.UpdateEngineRequest() - assert args[0] == request_msg @@ -7823,7 +7828,6 @@ def test_get_engine_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_service.GetEngineRequest() - assert args[0] == request_msg @@ -7843,7 +7847,6 @@ def test_list_engines_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_service.ListEnginesRequest() - assert args[0] == request_msg @@ -7863,7 +7866,6 @@ def test_pause_engine_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_service.PauseEngineRequest() - assert args[0] == request_msg @@ -7883,7 +7885,6 @@ def test_resume_engine_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_service.ResumeEngineRequest() - assert args[0] == request_msg @@ -7903,7 +7904,6 @@ def test_tune_engine_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_service.TuneEngineRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_estimate_billing_service.py b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_estimate_billing_service.py index 3f17f7df912f..a298574935a5 100644 --- a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_estimate_billing_service.py +++ b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_estimate_billing_service.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 @@ -116,6 +117,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" @@ -1385,8 +1401,8 @@ def test_estimate_billing_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - estimate_billing_service.EstimateDataSizeRequest, - dict, + estimate_billing_service.EstimateDataSizeRequest(), + {}, ], ) def test_estimate_data_size(request_type, transport: str = "grpc"): @@ -1397,7 +1413,7 @@ def test_estimate_data_size(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1442,9 +1458,10 @@ def test_estimate_data_size_non_empty_request_with_auto_populated_field(): client.estimate_data_size(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == estimate_billing_service.EstimateDataSizeRequest( + request_msg = estimate_billing_service.EstimateDataSizeRequest( location="location_value", ) + assert args[0] == request_msg def test_estimate_data_size_use_cached_wrapped_rpc(): @@ -1539,10 +1556,14 @@ async def test_estimate_data_size_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_estimate_data_size_async( - transport: str = "grpc_asyncio", - request_type=estimate_billing_service.EstimateDataSizeRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + estimate_billing_service.EstimateDataSizeRequest(), + {}, + ], +) +async def test_estimate_data_size_async(request_type, transport: str = "grpc_asyncio"): client = EstimateBillingServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1550,7 +1571,7 @@ async def test_estimate_data_size_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( @@ -1572,11 +1593,6 @@ async def test_estimate_data_size_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_estimate_data_size_async_from_dict(): - await test_estimate_data_size_async(request_type=dict) - - def test_estimate_data_size_field_headers(): client = EstimateBillingServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1893,7 +1909,6 @@ def test_estimate_data_size_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = estimate_billing_service.EstimateDataSizeRequest() - assert args[0] == request_msg @@ -1934,7 +1949,6 @@ async def test_estimate_data_size_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = estimate_billing_service.EstimateDataSizeRequest() - assert args[0] == request_msg @@ -2300,7 +2314,6 @@ def test_estimate_data_size_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = estimate_billing_service.EstimateDataSizeRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_evaluation_service.py b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_evaluation_service.py index d685c3f792f9..65a8095d966e 100644 --- a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_evaluation_service.py +++ b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_evaluation_service.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 @@ -123,6 +124,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" @@ -1364,8 +1380,8 @@ def test_evaluation_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - evaluation_service.GetEvaluationRequest, - dict, + evaluation_service.GetEvaluationRequest(), + {}, ], ) def test_get_evaluation(request_type, transport: str = "grpc"): @@ -1376,7 +1392,7 @@ def test_get_evaluation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_evaluation), "__call__") as call: @@ -1422,9 +1438,10 @@ def test_get_evaluation_non_empty_request_with_auto_populated_field(): client.get_evaluation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == evaluation_service.GetEvaluationRequest( + request_msg = evaluation_service.GetEvaluationRequest( name="name_value", ) + assert args[0] == request_msg def test_get_evaluation_use_cached_wrapped_rpc(): @@ -1505,10 +1522,14 @@ async def test_get_evaluation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_evaluation_async( - transport: str = "grpc_asyncio", - request_type=evaluation_service.GetEvaluationRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + evaluation_service.GetEvaluationRequest(), + {}, + ], +) +async def test_get_evaluation_async(request_type, transport: str = "grpc_asyncio"): client = EvaluationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1516,7 +1537,7 @@ async def test_get_evaluation_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_evaluation), "__call__") as call: @@ -1541,11 +1562,6 @@ async def test_get_evaluation_async( assert response.state == evaluation.Evaluation.State.PENDING -@pytest.mark.asyncio -async def test_get_evaluation_async_from_dict(): - await test_get_evaluation_async(request_type=dict) - - def test_get_evaluation_field_headers(): client = EvaluationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1692,8 +1708,8 @@ async def test_get_evaluation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - evaluation_service.ListEvaluationsRequest, - dict, + evaluation_service.ListEvaluationsRequest(), + {}, ], ) def test_list_evaluations(request_type, transport: str = "grpc"): @@ -1704,7 +1720,7 @@ def test_list_evaluations(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_evaluations), "__call__") as call: @@ -1749,10 +1765,11 @@ def test_list_evaluations_non_empty_request_with_auto_populated_field(): client.list_evaluations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == evaluation_service.ListEvaluationsRequest( + request_msg = evaluation_service.ListEvaluationsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_evaluations_use_cached_wrapped_rpc(): @@ -1835,10 +1852,14 @@ async def test_list_evaluations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_evaluations_async( - transport: str = "grpc_asyncio", - request_type=evaluation_service.ListEvaluationsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + evaluation_service.ListEvaluationsRequest(), + {}, + ], +) +async def test_list_evaluations_async(request_type, transport: str = "grpc_asyncio"): client = EvaluationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1846,7 +1867,7 @@ async def test_list_evaluations_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_evaluations), "__call__") as call: @@ -1869,11 +1890,6 @@ async def test_list_evaluations_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_evaluations_async_from_dict(): - await test_list_evaluations_async(request_type=dict) - - def test_list_evaluations_field_headers(): client = EvaluationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2210,8 +2226,8 @@ async def test_list_evaluations_async_pages(): @pytest.mark.parametrize( "request_type", [ - evaluation_service.CreateEvaluationRequest, - dict, + evaluation_service.CreateEvaluationRequest(), + {}, ], ) def test_create_evaluation(request_type, transport: str = "grpc"): @@ -2222,7 +2238,7 @@ def test_create_evaluation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,9 +2283,10 @@ def test_create_evaluation_non_empty_request_with_auto_populated_field(): client.create_evaluation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == evaluation_service.CreateEvaluationRequest( + request_msg = evaluation_service.CreateEvaluationRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_evaluation_use_cached_wrapped_rpc(): @@ -2362,10 +2379,14 @@ async def test_create_evaluation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_evaluation_async( - transport: str = "grpc_asyncio", - request_type=evaluation_service.CreateEvaluationRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + evaluation_service.CreateEvaluationRequest(), + {}, + ], +) +async def test_create_evaluation_async(request_type, transport: str = "grpc_asyncio"): client = EvaluationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2373,7 +2394,7 @@ async def test_create_evaluation_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( @@ -2395,11 +2416,6 @@ async def test_create_evaluation_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_evaluation_async_from_dict(): - await test_create_evaluation_async(request_type=dict) - - def test_create_evaluation_field_headers(): client = EvaluationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2564,8 +2580,8 @@ async def test_create_evaluation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - evaluation_service.ListEvaluationResultsRequest, - dict, + evaluation_service.ListEvaluationResultsRequest(), + {}, ], ) def test_list_evaluation_results(request_type, transport: str = "grpc"): @@ -2576,7 +2592,7 @@ def test_list_evaluation_results(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2625,10 +2641,11 @@ def test_list_evaluation_results_non_empty_request_with_auto_populated_field(): client.list_evaluation_results(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == evaluation_service.ListEvaluationResultsRequest( + request_msg = evaluation_service.ListEvaluationResultsRequest( evaluation="evaluation_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_evaluation_results_use_cached_wrapped_rpc(): @@ -2714,9 +2731,15 @@ async def test_list_evaluation_results_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + evaluation_service.ListEvaluationResultsRequest(), + {}, + ], +) async def test_list_evaluation_results_async( - transport: str = "grpc_asyncio", - request_type=evaluation_service.ListEvaluationResultsRequest, + request_type, transport: str = "grpc_asyncio" ): client = EvaluationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2725,7 +2748,7 @@ async def test_list_evaluation_results_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( @@ -2750,11 +2773,6 @@ async def test_list_evaluation_results_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_evaluation_results_async_from_dict(): - await test_list_evaluation_results_async(request_type=dict) - - def test_list_evaluation_results_field_headers(): client = EvaluationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4138,7 +4156,6 @@ def test_get_evaluation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.GetEvaluationRequest() - assert args[0] == request_msg @@ -4159,7 +4176,6 @@ def test_list_evaluations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.ListEvaluationsRequest() - assert args[0] == request_msg @@ -4182,7 +4198,6 @@ def test_create_evaluation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.CreateEvaluationRequest() - assert args[0] == request_msg @@ -4205,7 +4220,6 @@ def test_list_evaluation_results_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.ListEvaluationResultsRequest() - assert args[0] == request_msg @@ -4247,7 +4261,6 @@ async def test_get_evaluation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.GetEvaluationRequest() - assert args[0] == request_msg @@ -4274,7 +4287,6 @@ async def test_list_evaluations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.ListEvaluationsRequest() - assert args[0] == request_msg @@ -4301,7 +4313,6 @@ async def test_create_evaluation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.CreateEvaluationRequest() - assert args[0] == request_msg @@ -4330,7 +4341,6 @@ async def test_list_evaluation_results_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.ListEvaluationResultsRequest() - assert args[0] == request_msg @@ -5330,7 +5340,6 @@ def test_get_evaluation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.GetEvaluationRequest() - assert args[0] == request_msg @@ -5350,7 +5359,6 @@ def test_list_evaluations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.ListEvaluationsRequest() - assert args[0] == request_msg @@ -5372,7 +5380,6 @@ def test_create_evaluation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.CreateEvaluationRequest() - assert args[0] == request_msg @@ -5394,7 +5401,6 @@ def test_list_evaluation_results_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.ListEvaluationResultsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_grounded_generation_service.py b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_grounded_generation_service.py index 10452e0a8811..deb59c146df5 100644 --- a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_grounded_generation_service.py +++ b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_grounded_generation_service.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" @@ -1393,8 +1409,8 @@ def test_grounded_generation_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - grounded_generation_service.CheckGroundingRequest, - dict, + grounded_generation_service.CheckGroundingRequest(), + {}, ], ) def test_check_grounding(request_type, transport: str = "grpc"): @@ -1405,7 +1421,7 @@ def test_check_grounding(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.check_grounding), "__call__") as call: @@ -1450,10 +1466,11 @@ def test_check_grounding_non_empty_request_with_auto_populated_field(): client.check_grounding(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == grounded_generation_service.CheckGroundingRequest( + request_msg = grounded_generation_service.CheckGroundingRequest( grounding_config="grounding_config_value", answer_candidate="answer_candidate_value", ) + assert args[0] == request_msg def test_check_grounding_use_cached_wrapped_rpc(): @@ -1534,10 +1551,14 @@ async def test_check_grounding_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_check_grounding_async( - transport: str = "grpc_asyncio", - request_type=grounded_generation_service.CheckGroundingRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + grounded_generation_service.CheckGroundingRequest(), + {}, + ], +) +async def test_check_grounding_async(request_type, transport: str = "grpc_asyncio"): client = GroundedGenerationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1545,7 +1566,7 @@ async def test_check_grounding_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.check_grounding), "__call__") as call: @@ -1568,11 +1589,6 @@ async def test_check_grounding_async( assert math.isclose(response.support_score, 0.1432, rel_tol=1e-6) -@pytest.mark.asyncio -async def test_check_grounding_async_from_dict(): - await test_check_grounding_async(request_type=dict) - - def test_check_grounding_field_headers(): client = GroundedGenerationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1880,7 +1896,6 @@ def test_check_grounding_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = grounded_generation_service.CheckGroundingRequest() - assert args[0] == request_msg @@ -1921,7 +1936,6 @@ async def test_check_grounding_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = grounded_generation_service.CheckGroundingRequest() - assert args[0] == request_msg @@ -2301,7 +2315,6 @@ def test_check_grounding_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = grounded_generation_service.CheckGroundingRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_project_service.py b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_project_service.py index 894541ad0660..9f71da526b4c 100644 --- a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_project_service.py +++ b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_project_service.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 @@ -114,6 +115,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" @@ -1317,8 +1333,8 @@ def test_project_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - project_service.GetProjectRequest, - dict, + project_service.GetProjectRequest(), + {}, ], ) def test_get_project(request_type, transport: str = "grpc"): @@ -1329,7 +1345,7 @@ def test_get_project(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_project), "__call__") as call: @@ -1373,9 +1389,10 @@ def test_get_project_non_empty_request_with_auto_populated_field(): client.get_project(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == project_service.GetProjectRequest( + request_msg = project_service.GetProjectRequest( name="name_value", ) + assert args[0] == request_msg def test_get_project_use_cached_wrapped_rpc(): @@ -1456,9 +1473,14 @@ async def test_get_project_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_project_async( - transport: str = "grpc_asyncio", request_type=project_service.GetProjectRequest -): +@pytest.mark.parametrize( + "request_type", + [ + project_service.GetProjectRequest(), + {}, + ], +) +async def test_get_project_async(request_type, transport: str = "grpc_asyncio"): client = ProjectServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1466,7 +1488,7 @@ async def test_get_project_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_project), "__call__") as call: @@ -1489,11 +1511,6 @@ async def test_get_project_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_project_async_from_dict(): - await test_get_project_async(request_type=dict) - - def test_get_project_field_headers(): client = ProjectServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1636,8 +1653,8 @@ async def test_get_project_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - project_service.ProvisionProjectRequest, - dict, + project_service.ProvisionProjectRequest(), + {}, ], ) def test_provision_project(request_type, transport: str = "grpc"): @@ -1648,7 +1665,7 @@ def test_provision_project(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1694,10 +1711,11 @@ def test_provision_project_non_empty_request_with_auto_populated_field(): client.provision_project(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == project_service.ProvisionProjectRequest( + request_msg = project_service.ProvisionProjectRequest( name="name_value", data_use_terms_version="data_use_terms_version_value", ) + assert args[0] == request_msg def test_provision_project_use_cached_wrapped_rpc(): @@ -1790,10 +1808,14 @@ async def test_provision_project_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_provision_project_async( - transport: str = "grpc_asyncio", - request_type=project_service.ProvisionProjectRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + project_service.ProvisionProjectRequest(), + {}, + ], +) +async def test_provision_project_async(request_type, transport: str = "grpc_asyncio"): client = ProjectServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1801,7 +1823,7 @@ async def test_provision_project_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( @@ -1823,11 +1845,6 @@ async def test_provision_project_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_provision_project_async_from_dict(): - await test_provision_project_async(request_type=dict) - - def test_provision_project_field_headers(): client = ProjectServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1982,8 +1999,8 @@ async def test_provision_project_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - project_service.ReportConsentChangeRequest, - dict, + project_service.ReportConsentChangeRequest(), + {}, ], ) def test_report_consent_change(request_type, transport: str = "grpc"): @@ -1994,7 +2011,7 @@ def test_report_consent_change(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2044,11 +2061,12 @@ def test_report_consent_change_non_empty_request_with_auto_populated_field(): client.report_consent_change(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == project_service.ReportConsentChangeRequest( + request_msg = project_service.ReportConsentChangeRequest( project="project_value", service_term_id="service_term_id_value", service_term_version="service_term_version_value", ) + assert args[0] == request_msg def test_report_consent_change_use_cached_wrapped_rpc(): @@ -2134,9 +2152,15 @@ async def test_report_consent_change_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + project_service.ReportConsentChangeRequest(), + {}, + ], +) async def test_report_consent_change_async( - transport: str = "grpc_asyncio", - request_type=project_service.ReportConsentChangeRequest, + request_type, transport: str = "grpc_asyncio" ): client = ProjectServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2145,7 +2169,7 @@ async def test_report_consent_change_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( @@ -2170,11 +2194,6 @@ async def test_report_consent_change_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_report_consent_change_async_from_dict(): - await test_report_consent_change_async(request_type=dict) - - def test_report_consent_change_field_headers(): client = ProjectServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3054,7 +3073,6 @@ def test_get_project_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = project_service.GetProjectRequest() - assert args[0] == request_msg @@ -3077,7 +3095,6 @@ def test_provision_project_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = project_service.ProvisionProjectRequest() - assert args[0] == request_msg @@ -3100,7 +3117,6 @@ def test_report_consent_change_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = project_service.ReportConsentChangeRequest() - assert args[0] == request_msg @@ -3141,7 +3157,6 @@ async def test_get_project_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = project_service.GetProjectRequest() - assert args[0] == request_msg @@ -3168,7 +3183,6 @@ async def test_provision_project_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = project_service.ProvisionProjectRequest() - assert args[0] == request_msg @@ -3197,7 +3211,6 @@ async def test_report_consent_change_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = project_service.ReportConsentChangeRequest() - assert args[0] == request_msg @@ -3820,7 +3833,6 @@ def test_get_project_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = project_service.GetProjectRequest() - assert args[0] == request_msg @@ -3842,7 +3854,6 @@ def test_provision_project_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = project_service.ProvisionProjectRequest() - assert args[0] == request_msg @@ -3864,7 +3875,6 @@ def test_report_consent_change_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = project_service.ReportConsentChangeRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_rank_service.py b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_rank_service.py index 02972bfcc4d5..9b72ea517e6c 100644 --- a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_rank_service.py +++ b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_rank_service.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 @@ -108,6 +109,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" @@ -1273,8 +1289,8 @@ def test_rank_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - rank_service.RankRequest, - dict, + rank_service.RankRequest(), + {}, ], ) def test_rank(request_type, transport: str = "grpc"): @@ -1285,7 +1301,7 @@ def test_rank(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.rank), "__call__") as call: @@ -1328,11 +1344,12 @@ def test_rank_non_empty_request_with_auto_populated_field(): client.rank(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == rank_service.RankRequest( + request_msg = rank_service.RankRequest( ranking_config="ranking_config_value", model="model_value", query="query_value", ) + assert args[0] == request_msg def test_rank_use_cached_wrapped_rpc(): @@ -1410,9 +1427,14 @@ async def test_rank_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio" @pytest.mark.asyncio -async def test_rank_async( - transport: str = "grpc_asyncio", request_type=rank_service.RankRequest -): +@pytest.mark.parametrize( + "request_type", + [ + rank_service.RankRequest(), + {}, + ], +) +async def test_rank_async(request_type, transport: str = "grpc_asyncio"): client = RankServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1420,7 +1442,7 @@ async def test_rank_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.rank), "__call__") as call: @@ -1440,11 +1462,6 @@ async def test_rank_async( assert isinstance(response, rank_service.RankResponse) -@pytest.mark.asyncio -async def test_rank_async_from_dict(): - await test_rank_async(request_type=dict) - - def test_rank_field_headers(): client = RankServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1756,7 +1773,6 @@ def test_rank_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rank_service.RankRequest() - assert args[0] == request_msg @@ -1795,7 +1811,6 @@ async def test_rank_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rank_service.RankRequest() - assert args[0] == request_msg @@ -2156,7 +2171,6 @@ def test_rank_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rank_service.RankRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_recommendation_service.py b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_recommendation_service.py index 89fb2d317960..9d0d05df4378 100644 --- a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_recommendation_service.py +++ b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_recommendation_service.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 @@ -115,6 +116,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" @@ -1380,8 +1396,8 @@ def test_recommendation_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - recommendation_service.RecommendRequest, - dict, + recommendation_service.RecommendRequest(), + {}, ], ) def test_recommend(request_type, transport: str = "grpc"): @@ -1392,7 +1408,7 @@ def test_recommend(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.recommend), "__call__") as call: @@ -1441,10 +1457,11 @@ def test_recommend_non_empty_request_with_auto_populated_field(): client.recommend(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == recommendation_service.RecommendRequest( + request_msg = recommendation_service.RecommendRequest( serving_config="serving_config_value", filter="filter_value", ) + assert args[0] == request_msg def test_recommend_use_cached_wrapped_rpc(): @@ -1523,10 +1540,14 @@ async def test_recommend_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_recommend_async( - transport: str = "grpc_asyncio", - request_type=recommendation_service.RecommendRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + recommendation_service.RecommendRequest(), + {}, + ], +) +async def test_recommend_async(request_type, transport: str = "grpc_asyncio"): client = RecommendationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1534,7 +1555,7 @@ async def test_recommend_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.recommend), "__call__") as call: @@ -1561,11 +1582,6 @@ async def test_recommend_async( assert response.validate_only is True -@pytest.mark.asyncio -async def test_recommend_async_from_dict(): - await test_recommend_async(request_type=dict) - - def test_recommend_field_headers(): client = RecommendationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1879,7 +1895,6 @@ def test_recommend_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommendation_service.RecommendRequest() - assert args[0] == request_msg @@ -1922,7 +1937,6 @@ async def test_recommend_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommendation_service.RecommendRequest() - assert args[0] == request_msg @@ -2304,7 +2318,6 @@ def test_recommend_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommendation_service.RecommendRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_sample_query_service.py b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_sample_query_service.py index a541592415a3..68a859454d68 100644 --- a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_sample_query_service.py +++ b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_sample_query_service.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 @@ -121,6 +122,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" @@ -1366,8 +1382,8 @@ def test_sample_query_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - sample_query_service.GetSampleQueryRequest, - dict, + sample_query_service.GetSampleQueryRequest(), + {}, ], ) def test_get_sample_query(request_type, transport: str = "grpc"): @@ -1378,7 +1394,7 @@ def test_get_sample_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(type(client.transport.get_sample_query), "__call__") as call: @@ -1422,9 +1438,10 @@ def test_get_sample_query_non_empty_request_with_auto_populated_field(): client.get_sample_query(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == sample_query_service.GetSampleQueryRequest( + request_msg = sample_query_service.GetSampleQueryRequest( name="name_value", ) + assert args[0] == request_msg def test_get_sample_query_use_cached_wrapped_rpc(): @@ -1507,10 +1524,14 @@ async def test_get_sample_query_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_sample_query_async( - transport: str = "grpc_asyncio", - request_type=sample_query_service.GetSampleQueryRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + sample_query_service.GetSampleQueryRequest(), + {}, + ], +) +async def test_get_sample_query_async(request_type, transport: str = "grpc_asyncio"): client = SampleQueryServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1518,7 +1539,7 @@ async def test_get_sample_query_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_sample_query), "__call__") as call: @@ -1541,11 +1562,6 @@ async def test_get_sample_query_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_sample_query_async_from_dict(): - await test_get_sample_query_async(request_type=dict) - - def test_get_sample_query_field_headers(): client = SampleQueryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1692,8 +1708,8 @@ async def test_get_sample_query_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - sample_query_service.ListSampleQueriesRequest, - dict, + sample_query_service.ListSampleQueriesRequest(), + {}, ], ) def test_list_sample_queries(request_type, transport: str = "grpc"): @@ -1704,7 +1720,7 @@ def test_list_sample_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( @@ -1753,10 +1769,11 @@ def test_list_sample_queries_non_empty_request_with_auto_populated_field(): client.list_sample_queries(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == sample_query_service.ListSampleQueriesRequest( + request_msg = sample_query_service.ListSampleQueriesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_sample_queries_use_cached_wrapped_rpc(): @@ -1841,10 +1858,14 @@ async def test_list_sample_queries_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_sample_queries_async( - transport: str = "grpc_asyncio", - request_type=sample_query_service.ListSampleQueriesRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + sample_query_service.ListSampleQueriesRequest(), + {}, + ], +) +async def test_list_sample_queries_async(request_type, transport: str = "grpc_asyncio"): client = SampleQueryServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1852,7 +1873,7 @@ async def test_list_sample_queries_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( @@ -1877,11 +1898,6 @@ async def test_list_sample_queries_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_sample_queries_async_from_dict(): - await test_list_sample_queries_async(request_type=dict) - - def test_list_sample_queries_field_headers(): client = SampleQueryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2234,8 +2250,8 @@ async def test_list_sample_queries_async_pages(): @pytest.mark.parametrize( "request_type", [ - sample_query_service.CreateSampleQueryRequest, - dict, + sample_query_service.CreateSampleQueryRequest(), + {}, ], ) def test_create_sample_query(request_type, transport: str = "grpc"): @@ -2246,7 +2262,7 @@ def test_create_sample_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( @@ -2295,10 +2311,11 @@ def test_create_sample_query_non_empty_request_with_auto_populated_field(): client.create_sample_query(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == sample_query_service.CreateSampleQueryRequest( + request_msg = sample_query_service.CreateSampleQueryRequest( parent="parent_value", sample_query_id="sample_query_id_value", ) + assert args[0] == request_msg def test_create_sample_query_use_cached_wrapped_rpc(): @@ -2383,10 +2400,14 @@ async def test_create_sample_query_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_sample_query_async( - transport: str = "grpc_asyncio", - request_type=sample_query_service.CreateSampleQueryRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + sample_query_service.CreateSampleQueryRequest(), + {}, + ], +) +async def test_create_sample_query_async(request_type, transport: str = "grpc_asyncio"): client = SampleQueryServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2394,7 +2415,7 @@ async def test_create_sample_query_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( @@ -2419,11 +2440,6 @@ async def test_create_sample_query_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_create_sample_query_async_from_dict(): - await test_create_sample_query_async(request_type=dict) - - def test_create_sample_query_field_headers(): client = SampleQueryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2610,8 +2626,8 @@ async def test_create_sample_query_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - sample_query_service.UpdateSampleQueryRequest, - dict, + sample_query_service.UpdateSampleQueryRequest(), + {}, ], ) def test_update_sample_query(request_type, transport: str = "grpc"): @@ -2622,7 +2638,7 @@ def test_update_sample_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( @@ -2668,7 +2684,8 @@ def test_update_sample_query_non_empty_request_with_auto_populated_field(): client.update_sample_query(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == sample_query_service.UpdateSampleQueryRequest() + request_msg = sample_query_service.UpdateSampleQueryRequest() + assert args[0] == request_msg def test_update_sample_query_use_cached_wrapped_rpc(): @@ -2753,10 +2770,14 @@ async def test_update_sample_query_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_sample_query_async( - transport: str = "grpc_asyncio", - request_type=sample_query_service.UpdateSampleQueryRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + sample_query_service.UpdateSampleQueryRequest(), + {}, + ], +) +async def test_update_sample_query_async(request_type, transport: str = "grpc_asyncio"): client = SampleQueryServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2764,7 +2785,7 @@ async def test_update_sample_query_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( @@ -2789,11 +2810,6 @@ async def test_update_sample_query_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_update_sample_query_async_from_dict(): - await test_update_sample_query_async(request_type=dict) - - def test_update_sample_query_field_headers(): client = SampleQueryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2970,8 +2986,8 @@ async def test_update_sample_query_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - sample_query_service.DeleteSampleQueryRequest, - dict, + sample_query_service.DeleteSampleQueryRequest(), + {}, ], ) def test_delete_sample_query(request_type, transport: str = "grpc"): @@ -2982,7 +2998,7 @@ def test_delete_sample_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( @@ -3027,9 +3043,10 @@ def test_delete_sample_query_non_empty_request_with_auto_populated_field(): client.delete_sample_query(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == sample_query_service.DeleteSampleQueryRequest( + request_msg = sample_query_service.DeleteSampleQueryRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_sample_query_use_cached_wrapped_rpc(): @@ -3114,10 +3131,14 @@ async def test_delete_sample_query_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_sample_query_async( - transport: str = "grpc_asyncio", - request_type=sample_query_service.DeleteSampleQueryRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + sample_query_service.DeleteSampleQueryRequest(), + {}, + ], +) +async def test_delete_sample_query_async(request_type, transport: str = "grpc_asyncio"): client = SampleQueryServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3125,7 +3146,7 @@ async def test_delete_sample_query_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( @@ -3145,11 +3166,6 @@ async def test_delete_sample_query_async( assert response is None -@pytest.mark.asyncio -async def test_delete_sample_query_async_from_dict(): - await test_delete_sample_query_async(request_type=dict) - - def test_delete_sample_query_field_headers(): client = SampleQueryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3300,8 +3316,8 @@ async def test_delete_sample_query_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - import_config.ImportSampleQueriesRequest, - dict, + import_config.ImportSampleQueriesRequest(), + {}, ], ) def test_import_sample_queries(request_type, transport: str = "grpc"): @@ -3312,7 +3328,7 @@ def test_import_sample_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( @@ -3357,9 +3373,10 @@ def test_import_sample_queries_non_empty_request_with_auto_populated_field(): client.import_sample_queries(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == import_config.ImportSampleQueriesRequest( + request_msg = import_config.ImportSampleQueriesRequest( parent="parent_value", ) + assert args[0] == request_msg def test_import_sample_queries_use_cached_wrapped_rpc(): @@ -3455,9 +3472,15 @@ async def test_import_sample_queries_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + import_config.ImportSampleQueriesRequest(), + {}, + ], +) async def test_import_sample_queries_async( - transport: str = "grpc_asyncio", - request_type=import_config.ImportSampleQueriesRequest, + request_type, transport: str = "grpc_asyncio" ): client = SampleQueryServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3466,7 +3489,7 @@ async def test_import_sample_queries_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( @@ -3488,11 +3511,6 @@ async def test_import_sample_queries_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_import_sample_queries_async_from_dict(): - await test_import_sample_queries_async(request_type=dict) - - def test_import_sample_queries_field_headers(): client = SampleQueryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4842,7 +4860,6 @@ def test_get_sample_query_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sample_query_service.GetSampleQueryRequest() - assert args[0] == request_msg @@ -4865,7 +4882,6 @@ def test_list_sample_queries_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sample_query_service.ListSampleQueriesRequest() - assert args[0] == request_msg @@ -4888,7 +4904,6 @@ def test_create_sample_query_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sample_query_service.CreateSampleQueryRequest() - assert args[0] == request_msg @@ -4911,7 +4926,6 @@ def test_update_sample_query_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sample_query_service.UpdateSampleQueryRequest() - assert args[0] == request_msg @@ -4934,7 +4948,6 @@ def test_delete_sample_query_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sample_query_service.DeleteSampleQueryRequest() - assert args[0] == request_msg @@ -4957,7 +4970,6 @@ def test_import_sample_queries_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_config.ImportSampleQueriesRequest() - assert args[0] == request_msg @@ -4998,7 +5010,6 @@ async def test_get_sample_query_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sample_query_service.GetSampleQueryRequest() - assert args[0] == request_msg @@ -5027,7 +5038,6 @@ async def test_list_sample_queries_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sample_query_service.ListSampleQueriesRequest() - assert args[0] == request_msg @@ -5056,7 +5066,6 @@ async def test_create_sample_query_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sample_query_service.CreateSampleQueryRequest() - assert args[0] == request_msg @@ -5085,7 +5094,6 @@ async def test_update_sample_query_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sample_query_service.UpdateSampleQueryRequest() - assert args[0] == request_msg @@ -5110,7 +5118,6 @@ async def test_delete_sample_query_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sample_query_service.DeleteSampleQueryRequest() - assert args[0] == request_msg @@ -5137,7 +5144,6 @@ async def test_import_sample_queries_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_config.ImportSampleQueriesRequest() - assert args[0] == request_msg @@ -6330,7 +6336,6 @@ def test_get_sample_query_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sample_query_service.GetSampleQueryRequest() - assert args[0] == request_msg @@ -6352,7 +6357,6 @@ def test_list_sample_queries_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sample_query_service.ListSampleQueriesRequest() - assert args[0] == request_msg @@ -6374,7 +6378,6 @@ def test_create_sample_query_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sample_query_service.CreateSampleQueryRequest() - assert args[0] == request_msg @@ -6396,7 +6399,6 @@ def test_update_sample_query_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sample_query_service.UpdateSampleQueryRequest() - assert args[0] == request_msg @@ -6418,7 +6420,6 @@ def test_delete_sample_query_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sample_query_service.DeleteSampleQueryRequest() - assert args[0] == request_msg @@ -6440,7 +6441,6 @@ def test_import_sample_queries_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_config.ImportSampleQueriesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_sample_query_set_service.py b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_sample_query_set_service.py index d55f8858deca..dc610a9fd038 100644 --- a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_sample_query_set_service.py +++ b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_sample_query_set_service.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 @@ -117,6 +118,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" @@ -1384,8 +1400,8 @@ def test_sample_query_set_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - sample_query_set_service.GetSampleQuerySetRequest, - dict, + sample_query_set_service.GetSampleQuerySetRequest(), + {}, ], ) def test_get_sample_query_set(request_type, transport: str = "grpc"): @@ -1396,7 +1412,7 @@ def test_get_sample_query_set(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1448,9 +1464,10 @@ def test_get_sample_query_set_non_empty_request_with_auto_populated_field(): client.get_sample_query_set(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == sample_query_set_service.GetSampleQuerySetRequest( + request_msg = sample_query_set_service.GetSampleQuerySetRequest( name="name_value", ) + assert args[0] == request_msg def test_get_sample_query_set_use_cached_wrapped_rpc(): @@ -1535,9 +1552,15 @@ async def test_get_sample_query_set_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + sample_query_set_service.GetSampleQuerySetRequest(), + {}, + ], +) async def test_get_sample_query_set_async( - transport: str = "grpc_asyncio", - request_type=sample_query_set_service.GetSampleQuerySetRequest, + request_type, transport: str = "grpc_asyncio" ): client = SampleQuerySetServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1546,7 +1569,7 @@ async def test_get_sample_query_set_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( @@ -1575,11 +1598,6 @@ async def test_get_sample_query_set_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_get_sample_query_set_async_from_dict(): - await test_get_sample_query_set_async(request_type=dict) - - def test_get_sample_query_set_field_headers(): client = SampleQuerySetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1734,8 +1752,8 @@ async def test_get_sample_query_set_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - sample_query_set_service.ListSampleQuerySetsRequest, - dict, + sample_query_set_service.ListSampleQuerySetsRequest(), + {}, ], ) def test_list_sample_query_sets(request_type, transport: str = "grpc"): @@ -1746,7 +1764,7 @@ def test_list_sample_query_sets(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1795,10 +1813,11 @@ def test_list_sample_query_sets_non_empty_request_with_auto_populated_field(): client.list_sample_query_sets(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == sample_query_set_service.ListSampleQuerySetsRequest( + request_msg = sample_query_set_service.ListSampleQuerySetsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_sample_query_sets_use_cached_wrapped_rpc(): @@ -1884,9 +1903,15 @@ async def test_list_sample_query_sets_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + sample_query_set_service.ListSampleQuerySetsRequest(), + {}, + ], +) async def test_list_sample_query_sets_async( - transport: str = "grpc_asyncio", - request_type=sample_query_set_service.ListSampleQuerySetsRequest, + request_type, transport: str = "grpc_asyncio" ): client = SampleQuerySetServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1895,7 +1920,7 @@ async def test_list_sample_query_sets_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( @@ -1920,11 +1945,6 @@ async def test_list_sample_query_sets_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_sample_query_sets_async_from_dict(): - await test_list_sample_query_sets_async(request_type=dict) - - def test_list_sample_query_sets_field_headers(): client = SampleQuerySetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2277,8 +2297,8 @@ async def test_list_sample_query_sets_async_pages(): @pytest.mark.parametrize( "request_type", [ - sample_query_set_service.CreateSampleQuerySetRequest, - dict, + sample_query_set_service.CreateSampleQuerySetRequest(), + {}, ], ) def test_create_sample_query_set(request_type, transport: str = "grpc"): @@ -2289,7 +2309,7 @@ def test_create_sample_query_set(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2342,10 +2362,11 @@ def test_create_sample_query_set_non_empty_request_with_auto_populated_field(): client.create_sample_query_set(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == sample_query_set_service.CreateSampleQuerySetRequest( + request_msg = sample_query_set_service.CreateSampleQuerySetRequest( parent="parent_value", sample_query_set_id="sample_query_set_id_value", ) + assert args[0] == request_msg def test_create_sample_query_set_use_cached_wrapped_rpc(): @@ -2431,9 +2452,15 @@ async def test_create_sample_query_set_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + sample_query_set_service.CreateSampleQuerySetRequest(), + {}, + ], +) async def test_create_sample_query_set_async( - transport: str = "grpc_asyncio", - request_type=sample_query_set_service.CreateSampleQuerySetRequest, + request_type, transport: str = "grpc_asyncio" ): client = SampleQuerySetServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2442,7 +2469,7 @@ async def test_create_sample_query_set_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( @@ -2471,11 +2498,6 @@ async def test_create_sample_query_set_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_create_sample_query_set_async_from_dict(): - await test_create_sample_query_set_async(request_type=dict) - - def test_create_sample_query_set_field_headers(): client = SampleQuerySetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2650,8 +2672,8 @@ async def test_create_sample_query_set_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - sample_query_set_service.UpdateSampleQuerySetRequest, - dict, + sample_query_set_service.UpdateSampleQuerySetRequest(), + {}, ], ) def test_update_sample_query_set(request_type, transport: str = "grpc"): @@ -2662,7 +2684,7 @@ def test_update_sample_query_set(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2712,7 +2734,8 @@ def test_update_sample_query_set_non_empty_request_with_auto_populated_field(): client.update_sample_query_set(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == sample_query_set_service.UpdateSampleQuerySetRequest() + request_msg = sample_query_set_service.UpdateSampleQuerySetRequest() + assert args[0] == request_msg def test_update_sample_query_set_use_cached_wrapped_rpc(): @@ -2798,9 +2821,15 @@ async def test_update_sample_query_set_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + sample_query_set_service.UpdateSampleQuerySetRequest(), + {}, + ], +) async def test_update_sample_query_set_async( - transport: str = "grpc_asyncio", - request_type=sample_query_set_service.UpdateSampleQuerySetRequest, + request_type, transport: str = "grpc_asyncio" ): client = SampleQuerySetServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2809,7 +2838,7 @@ async def test_update_sample_query_set_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( @@ -2838,11 +2867,6 @@ async def test_update_sample_query_set_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_update_sample_query_set_async_from_dict(): - await test_update_sample_query_set_async(request_type=dict) - - def test_update_sample_query_set_field_headers(): client = SampleQuerySetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3007,8 +3031,8 @@ async def test_update_sample_query_set_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - sample_query_set_service.DeleteSampleQuerySetRequest, - dict, + sample_query_set_service.DeleteSampleQuerySetRequest(), + {}, ], ) def test_delete_sample_query_set(request_type, transport: str = "grpc"): @@ -3019,7 +3043,7 @@ def test_delete_sample_query_set(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3064,9 +3088,10 @@ def test_delete_sample_query_set_non_empty_request_with_auto_populated_field(): client.delete_sample_query_set(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == sample_query_set_service.DeleteSampleQuerySetRequest( + request_msg = sample_query_set_service.DeleteSampleQuerySetRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_sample_query_set_use_cached_wrapped_rpc(): @@ -3152,9 +3177,15 @@ async def test_delete_sample_query_set_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + sample_query_set_service.DeleteSampleQuerySetRequest(), + {}, + ], +) async def test_delete_sample_query_set_async( - transport: str = "grpc_asyncio", - request_type=sample_query_set_service.DeleteSampleQuerySetRequest, + request_type, transport: str = "grpc_asyncio" ): client = SampleQuerySetServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3163,7 +3194,7 @@ async def test_delete_sample_query_set_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( @@ -3183,11 +3214,6 @@ async def test_delete_sample_query_set_async( assert response is None -@pytest.mark.asyncio -async def test_delete_sample_query_set_async_from_dict(): - await test_delete_sample_query_set_async(request_type=dict) - - def test_delete_sample_query_set_field_headers(): client = SampleQuerySetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4489,7 +4515,6 @@ def test_get_sample_query_set_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sample_query_set_service.GetSampleQuerySetRequest() - assert args[0] == request_msg @@ -4512,7 +4537,6 @@ def test_list_sample_query_sets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sample_query_set_service.ListSampleQuerySetsRequest() - assert args[0] == request_msg @@ -4535,7 +4559,6 @@ def test_create_sample_query_set_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sample_query_set_service.CreateSampleQuerySetRequest() - assert args[0] == request_msg @@ -4558,7 +4581,6 @@ def test_update_sample_query_set_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sample_query_set_service.UpdateSampleQuerySetRequest() - assert args[0] == request_msg @@ -4581,7 +4603,6 @@ def test_delete_sample_query_set_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sample_query_set_service.DeleteSampleQuerySetRequest() - assert args[0] == request_msg @@ -4626,7 +4647,6 @@ async def test_get_sample_query_set_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sample_query_set_service.GetSampleQuerySetRequest() - assert args[0] == request_msg @@ -4655,7 +4675,6 @@ async def test_list_sample_query_sets_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sample_query_set_service.ListSampleQuerySetsRequest() - assert args[0] == request_msg @@ -4686,7 +4705,6 @@ async def test_create_sample_query_set_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sample_query_set_service.CreateSampleQuerySetRequest() - assert args[0] == request_msg @@ -4717,7 +4735,6 @@ async def test_update_sample_query_set_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sample_query_set_service.UpdateSampleQuerySetRequest() - assert args[0] == request_msg @@ -4742,7 +4759,6 @@ async def test_delete_sample_query_set_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sample_query_set_service.DeleteSampleQuerySetRequest() - assert args[0] == request_msg @@ -5820,7 +5836,6 @@ def test_get_sample_query_set_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sample_query_set_service.GetSampleQuerySetRequest() - assert args[0] == request_msg @@ -5842,7 +5857,6 @@ def test_list_sample_query_sets_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sample_query_set_service.ListSampleQuerySetsRequest() - assert args[0] == request_msg @@ -5864,7 +5878,6 @@ def test_create_sample_query_set_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sample_query_set_service.CreateSampleQuerySetRequest() - assert args[0] == request_msg @@ -5886,7 +5899,6 @@ def test_update_sample_query_set_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sample_query_set_service.UpdateSampleQuerySetRequest() - assert args[0] == request_msg @@ -5908,7 +5920,6 @@ def test_delete_sample_query_set_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sample_query_set_service.DeleteSampleQuerySetRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_schema_service.py b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_schema_service.py index 2012bc9428a0..bd27f8de9ce5 100644 --- a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_schema_service.py +++ b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_schema_service.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 @@ -116,6 +117,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" @@ -1315,8 +1331,8 @@ def test_schema_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - schema_service.GetSchemaRequest, - dict, + schema_service.GetSchemaRequest(), + {}, ], ) def test_get_schema(request_type, transport: str = "grpc"): @@ -1327,7 +1343,7 @@ def test_get_schema(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_schema), "__call__") as call: @@ -1372,9 +1388,10 @@ def test_get_schema_non_empty_request_with_auto_populated_field(): client.get_schema(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == schema_service.GetSchemaRequest( + request_msg = schema_service.GetSchemaRequest( name="name_value", ) + assert args[0] == request_msg def test_get_schema_use_cached_wrapped_rpc(): @@ -1453,9 +1470,14 @@ async def test_get_schema_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_schema_async( - transport: str = "grpc_asyncio", request_type=schema_service.GetSchemaRequest -): +@pytest.mark.parametrize( + "request_type", + [ + schema_service.GetSchemaRequest(), + {}, + ], +) +async def test_get_schema_async(request_type, transport: str = "grpc_asyncio"): client = SchemaServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1463,7 +1485,7 @@ async def test_get_schema_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_schema), "__call__") as call: @@ -1486,11 +1508,6 @@ async def test_get_schema_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_schema_async_from_dict(): - await test_get_schema_async(request_type=dict) - - def test_get_schema_field_headers(): client = SchemaServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1633,8 +1650,8 @@ async def test_get_schema_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - schema_service.ListSchemasRequest, - dict, + schema_service.ListSchemasRequest(), + {}, ], ) def test_list_schemas(request_type, transport: str = "grpc"): @@ -1645,7 +1662,7 @@ def test_list_schemas(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_schemas), "__call__") as call: @@ -1690,10 +1707,11 @@ def test_list_schemas_non_empty_request_with_auto_populated_field(): client.list_schemas(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == schema_service.ListSchemasRequest( + request_msg = schema_service.ListSchemasRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_schemas_use_cached_wrapped_rpc(): @@ -1774,9 +1792,14 @@ async def test_list_schemas_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_schemas_async( - transport: str = "grpc_asyncio", request_type=schema_service.ListSchemasRequest -): +@pytest.mark.parametrize( + "request_type", + [ + schema_service.ListSchemasRequest(), + {}, + ], +) +async def test_list_schemas_async(request_type, transport: str = "grpc_asyncio"): client = SchemaServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1784,7 +1807,7 @@ async def test_list_schemas_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_schemas), "__call__") as call: @@ -1807,11 +1830,6 @@ async def test_list_schemas_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_schemas_async_from_dict(): - await test_list_schemas_async(request_type=dict) - - def test_list_schemas_field_headers(): client = SchemaServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2148,8 +2166,8 @@ async def test_list_schemas_async_pages(): @pytest.mark.parametrize( "request_type", [ - schema_service.CreateSchemaRequest, - dict, + schema_service.CreateSchemaRequest(), + {}, ], ) def test_create_schema(request_type, transport: str = "grpc"): @@ -2160,7 +2178,7 @@ def test_create_schema(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_schema), "__call__") as call: @@ -2202,10 +2220,11 @@ def test_create_schema_non_empty_request_with_auto_populated_field(): client.create_schema(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == schema_service.CreateSchemaRequest( + request_msg = schema_service.CreateSchemaRequest( parent="parent_value", schema_id="schema_id_value", ) + assert args[0] == request_msg def test_create_schema_use_cached_wrapped_rpc(): @@ -2296,9 +2315,14 @@ async def test_create_schema_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_schema_async( - transport: str = "grpc_asyncio", request_type=schema_service.CreateSchemaRequest -): +@pytest.mark.parametrize( + "request_type", + [ + schema_service.CreateSchemaRequest(), + {}, + ], +) +async def test_create_schema_async(request_type, transport: str = "grpc_asyncio"): client = SchemaServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2306,7 +2330,7 @@ async def test_create_schema_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_schema), "__call__") as call: @@ -2326,11 +2350,6 @@ async def test_create_schema_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_schema_async_from_dict(): - await test_create_schema_async(request_type=dict) - - def test_create_schema_field_headers(): client = SchemaServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2545,8 +2564,8 @@ async def test_create_schema_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - schema_service.UpdateSchemaRequest, - dict, + schema_service.UpdateSchemaRequest(), + {}, ], ) def test_update_schema(request_type, transport: str = "grpc"): @@ -2557,7 +2576,7 @@ def test_update_schema(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_schema), "__call__") as call: @@ -2596,7 +2615,8 @@ def test_update_schema_non_empty_request_with_auto_populated_field(): client.update_schema(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == schema_service.UpdateSchemaRequest() + request_msg = schema_service.UpdateSchemaRequest() + assert args[0] == request_msg def test_update_schema_use_cached_wrapped_rpc(): @@ -2687,9 +2707,14 @@ async def test_update_schema_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_schema_async( - transport: str = "grpc_asyncio", request_type=schema_service.UpdateSchemaRequest -): +@pytest.mark.parametrize( + "request_type", + [ + schema_service.UpdateSchemaRequest(), + {}, + ], +) +async def test_update_schema_async(request_type, transport: str = "grpc_asyncio"): client = SchemaServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2697,7 +2722,7 @@ async def test_update_schema_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_schema), "__call__") as call: @@ -2717,11 +2742,6 @@ async def test_update_schema_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_schema_async_from_dict(): - await test_update_schema_async(request_type=dict) - - def test_update_schema_field_headers(): client = SchemaServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2786,8 +2806,8 @@ async def test_update_schema_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - schema_service.DeleteSchemaRequest, - dict, + schema_service.DeleteSchemaRequest(), + {}, ], ) def test_delete_schema(request_type, transport: str = "grpc"): @@ -2798,7 +2818,7 @@ def test_delete_schema(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_schema), "__call__") as call: @@ -2839,9 +2859,10 @@ def test_delete_schema_non_empty_request_with_auto_populated_field(): client.delete_schema(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == schema_service.DeleteSchemaRequest( + request_msg = schema_service.DeleteSchemaRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_schema_use_cached_wrapped_rpc(): @@ -2932,9 +2953,14 @@ async def test_delete_schema_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_schema_async( - transport: str = "grpc_asyncio", request_type=schema_service.DeleteSchemaRequest -): +@pytest.mark.parametrize( + "request_type", + [ + schema_service.DeleteSchemaRequest(), + {}, + ], +) +async def test_delete_schema_async(request_type, transport: str = "grpc_asyncio"): client = SchemaServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2942,7 +2968,7 @@ async def test_delete_schema_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_schema), "__call__") as call: @@ -2962,11 +2988,6 @@ async def test_delete_schema_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_schema_async_from_dict(): - await test_delete_schema_async(request_type=dict) - - def test_delete_schema_field_headers(): client = SchemaServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4193,7 +4214,6 @@ def test_get_schema_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_service.GetSchemaRequest() - assert args[0] == request_msg @@ -4214,7 +4234,6 @@ def test_list_schemas_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_service.ListSchemasRequest() - assert args[0] == request_msg @@ -4235,7 +4254,6 @@ def test_create_schema_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_service.CreateSchemaRequest() - assert args[0] == request_msg @@ -4256,7 +4274,6 @@ def test_update_schema_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_service.UpdateSchemaRequest() - assert args[0] == request_msg @@ -4277,7 +4294,6 @@ def test_delete_schema_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_service.DeleteSchemaRequest() - assert args[0] == request_msg @@ -4318,7 +4334,6 @@ async def test_get_schema_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_service.GetSchemaRequest() - assert args[0] == request_msg @@ -4345,7 +4360,6 @@ async def test_list_schemas_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_service.ListSchemasRequest() - assert args[0] == request_msg @@ -4370,7 +4384,6 @@ async def test_create_schema_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_service.CreateSchemaRequest() - assert args[0] == request_msg @@ -4395,7 +4408,6 @@ async def test_update_schema_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_service.UpdateSchemaRequest() - assert args[0] == request_msg @@ -4420,7 +4432,6 @@ async def test_delete_schema_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_service.DeleteSchemaRequest() - assert args[0] == request_msg @@ -5488,7 +5499,6 @@ def test_get_schema_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_service.GetSchemaRequest() - assert args[0] == request_msg @@ -5508,7 +5518,6 @@ def test_list_schemas_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_service.ListSchemasRequest() - assert args[0] == request_msg @@ -5528,7 +5537,6 @@ def test_create_schema_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_service.CreateSchemaRequest() - assert args[0] == request_msg @@ -5548,7 +5556,6 @@ def test_update_schema_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_service.UpdateSchemaRequest() - assert args[0] == request_msg @@ -5568,7 +5575,6 @@ def test_delete_schema_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_service.DeleteSchemaRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_search_service.py b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_search_service.py index b2bd3a8e75e5..2e4b4249d802 100644 --- a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_search_service.py +++ b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_search_service.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 @@ -110,6 +111,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" @@ -1309,8 +1325,8 @@ def test_search_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - search_service.SearchRequest, - dict, + search_service.SearchRequest(), + {}, ], ) def test_search(request_type, transport: str = "grpc"): @@ -1321,7 +1337,7 @@ def test_search(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.search), "__call__") as call: @@ -1386,7 +1402,7 @@ def test_search_non_empty_request_with_auto_populated_field(): client.search(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == search_service.SearchRequest( + request_msg = search_service.SearchRequest( serving_config="serving_config_value", branch="branch_value", query="query_value", @@ -1400,6 +1416,7 @@ def test_search_non_empty_request_with_auto_populated_field(): ranking_expression="ranking_expression_value", session="session_value", ) + assert args[0] == request_msg def test_search_use_cached_wrapped_rpc(): @@ -1478,9 +1495,14 @@ async def test_search_async_use_cached_wrapped_rpc(transport: str = "grpc_asynci @pytest.mark.asyncio -async def test_search_async( - transport: str = "grpc_asyncio", request_type=search_service.SearchRequest -): +@pytest.mark.parametrize( + "request_type", + [ + search_service.SearchRequest(), + {}, + ], +) +async def test_search_async(request_type, transport: str = "grpc_asyncio"): client = SearchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1488,7 +1510,7 @@ async def test_search_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.search), "__call__") as call: @@ -1521,11 +1543,6 @@ async def test_search_async( assert response.applied_controls == ["applied_controls_value"] -@pytest.mark.asyncio -async def test_search_async_from_dict(): - await test_search_async(request_type=dict) - - def test_search_field_headers(): client = SearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2088,7 +2105,6 @@ def test_search_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = search_service.SearchRequest() - assert args[0] == request_msg @@ -2134,7 +2150,6 @@ async def test_search_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = search_service.SearchRequest() - assert args[0] == request_msg @@ -2512,7 +2527,6 @@ def test_search_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = search_service.SearchRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_search_tuning_service.py b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_search_tuning_service.py index 7cbab23a0932..be97ee9d1670 100644 --- a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_search_tuning_service.py +++ b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_search_tuning_service.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 @@ -116,6 +117,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" @@ -1379,8 +1395,8 @@ def test_search_tuning_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - search_tuning_service.TrainCustomModelRequest, - dict, + search_tuning_service.TrainCustomModelRequest(), + {}, ], ) def test_train_custom_model(request_type, transport: str = "grpc"): @@ -1391,7 +1407,7 @@ def test_train_custom_model(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1438,11 +1454,12 @@ def test_train_custom_model_non_empty_request_with_auto_populated_field(): client.train_custom_model(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == search_tuning_service.TrainCustomModelRequest( + request_msg = search_tuning_service.TrainCustomModelRequest( data_store="data_store_value", model_type="model_type_value", model_id="model_id_value", ) + assert args[0] == request_msg def test_train_custom_model_use_cached_wrapped_rpc(): @@ -1537,10 +1554,14 @@ async def test_train_custom_model_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_train_custom_model_async( - transport: str = "grpc_asyncio", - request_type=search_tuning_service.TrainCustomModelRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + search_tuning_service.TrainCustomModelRequest(), + {}, + ], +) +async def test_train_custom_model_async(request_type, transport: str = "grpc_asyncio"): client = SearchTuningServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1548,7 +1569,7 @@ async def test_train_custom_model_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( @@ -1570,11 +1591,6 @@ async def test_train_custom_model_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_train_custom_model_async_from_dict(): - await test_train_custom_model_async(request_type=dict) - - def test_train_custom_model_field_headers(): client = SearchTuningServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1643,8 +1659,8 @@ async def test_train_custom_model_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - search_tuning_service.ListCustomModelsRequest, - dict, + search_tuning_service.ListCustomModelsRequest(), + {}, ], ) def test_list_custom_models(request_type, transport: str = "grpc"): @@ -1655,7 +1671,7 @@ def test_list_custom_models(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1700,9 +1716,10 @@ def test_list_custom_models_non_empty_request_with_auto_populated_field(): client.list_custom_models(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == search_tuning_service.ListCustomModelsRequest( + request_msg = search_tuning_service.ListCustomModelsRequest( data_store="data_store_value", ) + assert args[0] == request_msg def test_list_custom_models_use_cached_wrapped_rpc(): @@ -1787,10 +1804,14 @@ async def test_list_custom_models_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_custom_models_async( - transport: str = "grpc_asyncio", - request_type=search_tuning_service.ListCustomModelsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + search_tuning_service.ListCustomModelsRequest(), + {}, + ], +) +async def test_list_custom_models_async(request_type, transport: str = "grpc_asyncio"): client = SearchTuningServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1798,7 +1819,7 @@ async def test_list_custom_models_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( @@ -1820,11 +1841,6 @@ async def test_list_custom_models_async( assert isinstance(response, search_tuning_service.ListCustomModelsResponse) -@pytest.mark.asyncio -async def test_list_custom_models_async_from_dict(): - await test_list_custom_models_async(request_type=dict) - - def test_list_custom_models_field_headers(): client = SearchTuningServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2267,7 +2283,6 @@ def test_train_custom_model_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = search_tuning_service.TrainCustomModelRequest() - assert args[0] == request_msg @@ -2290,7 +2305,6 @@ def test_list_custom_models_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = search_tuning_service.ListCustomModelsRequest() - assert args[0] == request_msg @@ -2331,7 +2345,6 @@ async def test_train_custom_model_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = search_tuning_service.TrainCustomModelRequest() - assert args[0] == request_msg @@ -2358,7 +2371,6 @@ async def test_list_custom_models_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = search_tuning_service.ListCustomModelsRequest() - assert args[0] == request_msg @@ -2865,7 +2877,6 @@ def test_train_custom_model_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = search_tuning_service.TrainCustomModelRequest() - assert args[0] == request_msg @@ -2887,7 +2898,6 @@ def test_list_custom_models_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = search_tuning_service.ListCustomModelsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_serving_config_service.py b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_serving_config_service.py index 87ddfc18c4f2..142d7bdfdc83 100644 --- a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_serving_config_service.py +++ b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_serving_config_service.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 @@ -119,6 +120,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" @@ -1382,8 +1398,8 @@ def test_serving_config_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - serving_config_service.UpdateServingConfigRequest, - dict, + serving_config_service.UpdateServingConfigRequest(), + {}, ], ) def test_update_serving_config(request_type, transport: str = "grpc"): @@ -1394,7 +1410,7 @@ def test_update_serving_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( @@ -1466,7 +1482,8 @@ def test_update_serving_config_non_empty_request_with_auto_populated_field(): client.update_serving_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == serving_config_service.UpdateServingConfigRequest() + request_msg = serving_config_service.UpdateServingConfigRequest() + assert args[0] == request_msg def test_update_serving_config_use_cached_wrapped_rpc(): @@ -1552,9 +1569,15 @@ async def test_update_serving_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + serving_config_service.UpdateServingConfigRequest(), + {}, + ], +) async def test_update_serving_config_async( - transport: str = "grpc_asyncio", - request_type=serving_config_service.UpdateServingConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = ServingConfigServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1563,7 +1586,7 @@ async def test_update_serving_config_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( @@ -1614,11 +1637,6 @@ async def test_update_serving_config_async( assert response.ignore_control_ids == ["ignore_control_ids_value"] -@pytest.mark.asyncio -async def test_update_serving_config_async_from_dict(): - await test_update_serving_config_async(request_type=dict) - - def test_update_serving_config_field_headers(): client = ServingConfigServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1807,8 +1825,8 @@ async def test_update_serving_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - serving_config_service.GetServingConfigRequest, - dict, + serving_config_service.GetServingConfigRequest(), + {}, ], ) def test_get_serving_config(request_type, transport: str = "grpc"): @@ -1819,7 +1837,7 @@ def test_get_serving_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( @@ -1893,9 +1911,10 @@ def test_get_serving_config_non_empty_request_with_auto_populated_field(): client.get_serving_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == serving_config_service.GetServingConfigRequest( + request_msg = serving_config_service.GetServingConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_serving_config_use_cached_wrapped_rpc(): @@ -1980,10 +1999,14 @@ async def test_get_serving_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_serving_config_async( - transport: str = "grpc_asyncio", - request_type=serving_config_service.GetServingConfigRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + serving_config_service.GetServingConfigRequest(), + {}, + ], +) +async def test_get_serving_config_async(request_type, transport: str = "grpc_asyncio"): client = ServingConfigServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1991,7 +2014,7 @@ async def test_get_serving_config_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( @@ -2042,11 +2065,6 @@ async def test_get_serving_config_async( assert response.ignore_control_ids == ["ignore_control_ids_value"] -@pytest.mark.asyncio -async def test_get_serving_config_async_from_dict(): - await test_get_serving_config_async(request_type=dict) - - def test_get_serving_config_field_headers(): client = ServingConfigServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2201,8 +2219,8 @@ async def test_get_serving_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - serving_config_service.ListServingConfigsRequest, - dict, + serving_config_service.ListServingConfigsRequest(), + {}, ], ) def test_list_serving_configs(request_type, transport: str = "grpc"): @@ -2213,7 +2231,7 @@ def test_list_serving_configs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2262,10 +2280,11 @@ def test_list_serving_configs_non_empty_request_with_auto_populated_field(): client.list_serving_configs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == serving_config_service.ListServingConfigsRequest( + request_msg = serving_config_service.ListServingConfigsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_serving_configs_use_cached_wrapped_rpc(): @@ -2350,9 +2369,15 @@ async def test_list_serving_configs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + serving_config_service.ListServingConfigsRequest(), + {}, + ], +) async def test_list_serving_configs_async( - transport: str = "grpc_asyncio", - request_type=serving_config_service.ListServingConfigsRequest, + request_type, transport: str = "grpc_asyncio" ): client = ServingConfigServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2361,7 +2386,7 @@ async def test_list_serving_configs_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( @@ -2386,11 +2411,6 @@ async def test_list_serving_configs_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_serving_configs_async_from_dict(): - await test_list_serving_configs_async(request_type=dict) - - def test_list_serving_configs_field_headers(): client = ServingConfigServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3513,7 +3533,6 @@ def test_update_serving_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.UpdateServingConfigRequest() - assert args[0] == request_msg @@ -3536,7 +3555,6 @@ def test_get_serving_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.GetServingConfigRequest() - assert args[0] == request_msg @@ -3559,7 +3577,6 @@ def test_list_serving_configs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.ListServingConfigsRequest() - assert args[0] == request_msg @@ -3615,7 +3632,6 @@ async def test_update_serving_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.UpdateServingConfigRequest() - assert args[0] == request_msg @@ -3657,7 +3673,6 @@ async def test_get_serving_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.GetServingConfigRequest() - assert args[0] == request_msg @@ -3686,7 +3701,6 @@ async def test_list_serving_configs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.ListServingConfigsRequest() - assert args[0] == request_msg @@ -4544,7 +4558,6 @@ def test_update_serving_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.UpdateServingConfigRequest() - assert args[0] == request_msg @@ -4566,7 +4579,6 @@ def test_get_serving_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.GetServingConfigRequest() - assert args[0] == request_msg @@ -4588,7 +4600,6 @@ def test_list_serving_configs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.ListServingConfigsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_session_service.py b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_session_service.py index e46755298ac6..fde53908a370 100644 --- a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_session_service.py +++ b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_session_service.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 @@ -118,6 +119,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" @@ -1321,8 +1337,8 @@ def test_session_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - conversational_search_service.CreateSessionRequest, - dict, + conversational_search_service.CreateSessionRequest(), + {}, ], ) def test_create_session(request_type, transport: str = "grpc"): @@ -1333,7 +1349,7 @@ def test_create_session(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_session), "__call__") as call: @@ -1385,9 +1401,10 @@ def test_create_session_non_empty_request_with_auto_populated_field(): client.create_session(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversational_search_service.CreateSessionRequest( + request_msg = conversational_search_service.CreateSessionRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_session_use_cached_wrapped_rpc(): @@ -1468,10 +1485,14 @@ async def test_create_session_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_session_async( - transport: str = "grpc_asyncio", - request_type=conversational_search_service.CreateSessionRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + conversational_search_service.CreateSessionRequest(), + {}, + ], +) +async def test_create_session_async(request_type, transport: str = "grpc_asyncio"): client = SessionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1479,7 +1500,7 @@ async def test_create_session_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_session), "__call__") as call: @@ -1510,11 +1531,6 @@ async def test_create_session_async( assert response.is_pinned is True -@pytest.mark.asyncio -async def test_create_session_async_from_dict(): - await test_create_session_async(request_type=dict) - - def test_create_session_field_headers(): client = SessionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1667,8 +1683,8 @@ async def test_create_session_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversational_search_service.DeleteSessionRequest, - dict, + conversational_search_service.DeleteSessionRequest(), + {}, ], ) def test_delete_session(request_type, transport: str = "grpc"): @@ -1679,7 +1695,7 @@ def test_delete_session(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_session), "__call__") as call: @@ -1720,9 +1736,10 @@ def test_delete_session_non_empty_request_with_auto_populated_field(): client.delete_session(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversational_search_service.DeleteSessionRequest( + request_msg = conversational_search_service.DeleteSessionRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_session_use_cached_wrapped_rpc(): @@ -1803,10 +1820,14 @@ async def test_delete_session_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_session_async( - transport: str = "grpc_asyncio", - request_type=conversational_search_service.DeleteSessionRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + conversational_search_service.DeleteSessionRequest(), + {}, + ], +) +async def test_delete_session_async(request_type, transport: str = "grpc_asyncio"): client = SessionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1814,7 +1835,7 @@ async def test_delete_session_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_session), "__call__") as call: @@ -1832,11 +1853,6 @@ async def test_delete_session_async( assert response is None -@pytest.mark.asyncio -async def test_delete_session_async_from_dict(): - await test_delete_session_async(request_type=dict) - - def test_delete_session_field_headers(): client = SessionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1979,8 +1995,8 @@ async def test_delete_session_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversational_search_service.UpdateSessionRequest, - dict, + conversational_search_service.UpdateSessionRequest(), + {}, ], ) def test_update_session(request_type, transport: str = "grpc"): @@ -1991,7 +2007,7 @@ def test_update_session(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_session), "__call__") as call: @@ -2041,7 +2057,8 @@ def test_update_session_non_empty_request_with_auto_populated_field(): client.update_session(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversational_search_service.UpdateSessionRequest() + request_msg = conversational_search_service.UpdateSessionRequest() + assert args[0] == request_msg def test_update_session_use_cached_wrapped_rpc(): @@ -2122,10 +2139,14 @@ async def test_update_session_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_session_async( - transport: str = "grpc_asyncio", - request_type=conversational_search_service.UpdateSessionRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + conversational_search_service.UpdateSessionRequest(), + {}, + ], +) +async def test_update_session_async(request_type, transport: str = "grpc_asyncio"): client = SessionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2133,7 +2154,7 @@ async def test_update_session_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_session), "__call__") as call: @@ -2164,11 +2185,6 @@ async def test_update_session_async( assert response.is_pinned is True -@pytest.mark.asyncio -async def test_update_session_async_from_dict(): - await test_update_session_async(request_type=dict) - - def test_update_session_field_headers(): client = SessionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2321,8 +2337,8 @@ async def test_update_session_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversational_search_service.GetSessionRequest, - dict, + conversational_search_service.GetSessionRequest(), + {}, ], ) def test_get_session(request_type, transport: str = "grpc"): @@ -2333,7 +2349,7 @@ def test_get_session(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_session), "__call__") as call: @@ -2385,9 +2401,10 @@ def test_get_session_non_empty_request_with_auto_populated_field(): client.get_session(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversational_search_service.GetSessionRequest( + request_msg = conversational_search_service.GetSessionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_session_use_cached_wrapped_rpc(): @@ -2468,10 +2485,14 @@ async def test_get_session_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_session_async( - transport: str = "grpc_asyncio", - request_type=conversational_search_service.GetSessionRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + conversational_search_service.GetSessionRequest(), + {}, + ], +) +async def test_get_session_async(request_type, transport: str = "grpc_asyncio"): client = SessionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2479,7 +2500,7 @@ async def test_get_session_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_session), "__call__") as call: @@ -2510,11 +2531,6 @@ async def test_get_session_async( assert response.is_pinned is True -@pytest.mark.asyncio -async def test_get_session_async_from_dict(): - await test_get_session_async(request_type=dict) - - def test_get_session_field_headers(): client = SessionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2657,8 +2673,8 @@ async def test_get_session_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversational_search_service.ListSessionsRequest, - dict, + conversational_search_service.ListSessionsRequest(), + {}, ], ) def test_list_sessions(request_type, transport: str = "grpc"): @@ -2669,7 +2685,7 @@ def test_list_sessions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_sessions), "__call__") as call: @@ -2716,12 +2732,13 @@ def test_list_sessions_non_empty_request_with_auto_populated_field(): client.list_sessions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversational_search_service.ListSessionsRequest( + request_msg = conversational_search_service.ListSessionsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_sessions_use_cached_wrapped_rpc(): @@ -2802,10 +2819,14 @@ async def test_list_sessions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_sessions_async( - transport: str = "grpc_asyncio", - request_type=conversational_search_service.ListSessionsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + conversational_search_service.ListSessionsRequest(), + {}, + ], +) +async def test_list_sessions_async(request_type, transport: str = "grpc_asyncio"): client = SessionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2813,7 +2834,7 @@ async def test_list_sessions_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_sessions), "__call__") as call: @@ -2836,11 +2857,6 @@ async def test_list_sessions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_sessions_async_from_dict(): - await test_list_sessions_async(request_type=dict) - - def test_list_sessions_field_headers(): client = SessionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3177,8 +3193,8 @@ async def test_list_sessions_async_pages(): @pytest.mark.parametrize( "request_type", [ - session_service.ListFilesRequest, - dict, + session_service.ListFilesRequest(), + {}, ], ) def test_list_files(request_type, transport: str = "grpc"): @@ -3189,7 +3205,7 @@ def test_list_files(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_files), "__call__") as call: @@ -3235,11 +3251,12 @@ def test_list_files_non_empty_request_with_auto_populated_field(): client.list_files(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == session_service.ListFilesRequest( + request_msg = session_service.ListFilesRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_files_use_cached_wrapped_rpc(): @@ -3318,9 +3335,14 @@ async def test_list_files_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_list_files_async( - transport: str = "grpc_asyncio", request_type=session_service.ListFilesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + session_service.ListFilesRequest(), + {}, + ], +) +async def test_list_files_async(request_type, transport: str = "grpc_asyncio"): client = SessionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3328,7 +3350,7 @@ async def test_list_files_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_files), "__call__") as call: @@ -3351,11 +3373,6 @@ async def test_list_files_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_files_async_from_dict(): - await test_list_files_async(request_type=dict) - - def test_list_files_field_headers(): client = SessionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5069,7 +5086,6 @@ def test_create_session_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.CreateSessionRequest() - assert args[0] == request_msg @@ -5090,7 +5106,6 @@ def test_delete_session_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.DeleteSessionRequest() - assert args[0] == request_msg @@ -5111,7 +5126,6 @@ def test_update_session_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.UpdateSessionRequest() - assert args[0] == request_msg @@ -5132,7 +5146,6 @@ def test_get_session_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.GetSessionRequest() - assert args[0] == request_msg @@ -5153,7 +5166,6 @@ def test_list_sessions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.ListSessionsRequest() - assert args[0] == request_msg @@ -5174,7 +5186,6 @@ def test_list_files_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session_service.ListFilesRequest() - assert args[0] == request_msg @@ -5219,7 +5230,6 @@ async def test_create_session_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.CreateSessionRequest() - assert args[0] == request_msg @@ -5242,7 +5252,6 @@ async def test_delete_session_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.DeleteSessionRequest() - assert args[0] == request_msg @@ -5273,7 +5282,6 @@ async def test_update_session_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.UpdateSessionRequest() - assert args[0] == request_msg @@ -5304,7 +5312,6 @@ async def test_get_session_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.GetSessionRequest() - assert args[0] == request_msg @@ -5331,7 +5338,6 @@ async def test_list_sessions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.ListSessionsRequest() - assert args[0] == request_msg @@ -5358,7 +5364,6 @@ async def test_list_files_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session_service.ListFilesRequest() - assert args[0] == request_msg @@ -6759,7 +6764,6 @@ def test_create_session_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.CreateSessionRequest() - assert args[0] == request_msg @@ -6779,7 +6783,6 @@ def test_delete_session_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.DeleteSessionRequest() - assert args[0] == request_msg @@ -6799,7 +6802,6 @@ def test_update_session_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.UpdateSessionRequest() - assert args[0] == request_msg @@ -6819,7 +6821,6 @@ def test_get_session_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.GetSessionRequest() - assert args[0] == request_msg @@ -6839,7 +6840,6 @@ def test_list_sessions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.ListSessionsRequest() - assert args[0] == request_msg @@ -6859,7 +6859,6 @@ def test_list_files_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = session_service.ListFilesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_site_search_engine_service.py b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_site_search_engine_service.py index 0e6cd6e59bfd..c1c80a648d64 100644 --- a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_site_search_engine_service.py +++ b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_site_search_engine_service.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 @@ -119,6 +120,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" @@ -1388,8 +1404,8 @@ def test_site_search_engine_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - site_search_engine_service.GetSiteSearchEngineRequest, - dict, + site_search_engine_service.GetSiteSearchEngineRequest(), + {}, ], ) def test_get_site_search_engine(request_type, transport: str = "grpc"): @@ -1400,7 +1416,7 @@ def test_get_site_search_engine(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1448,9 +1464,10 @@ def test_get_site_search_engine_non_empty_request_with_auto_populated_field(): client.get_site_search_engine(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == site_search_engine_service.GetSiteSearchEngineRequest( + request_msg = site_search_engine_service.GetSiteSearchEngineRequest( name="name_value", ) + assert args[0] == request_msg def test_get_site_search_engine_use_cached_wrapped_rpc(): @@ -1536,9 +1553,15 @@ async def test_get_site_search_engine_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + site_search_engine_service.GetSiteSearchEngineRequest(), + {}, + ], +) async def test_get_site_search_engine_async( - transport: str = "grpc_asyncio", - request_type=site_search_engine_service.GetSiteSearchEngineRequest, + request_type, transport: str = "grpc_asyncio" ): client = SiteSearchEngineServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1547,7 +1570,7 @@ async def test_get_site_search_engine_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( @@ -1572,11 +1595,6 @@ async def test_get_site_search_engine_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_site_search_engine_async_from_dict(): - await test_get_site_search_engine_async(request_type=dict) - - def test_get_site_search_engine_field_headers(): client = SiteSearchEngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1731,8 +1749,8 @@ async def test_get_site_search_engine_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - site_search_engine_service.CreateTargetSiteRequest, - dict, + site_search_engine_service.CreateTargetSiteRequest(), + {}, ], ) def test_create_target_site(request_type, transport: str = "grpc"): @@ -1743,7 +1761,7 @@ def test_create_target_site(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1788,9 +1806,10 @@ def test_create_target_site_non_empty_request_with_auto_populated_field(): client.create_target_site(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == site_search_engine_service.CreateTargetSiteRequest( + request_msg = site_search_engine_service.CreateTargetSiteRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_target_site_use_cached_wrapped_rpc(): @@ -1885,10 +1904,14 @@ async def test_create_target_site_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_target_site_async( - transport: str = "grpc_asyncio", - request_type=site_search_engine_service.CreateTargetSiteRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + site_search_engine_service.CreateTargetSiteRequest(), + {}, + ], +) +async def test_create_target_site_async(request_type, transport: str = "grpc_asyncio"): client = SiteSearchEngineServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1896,7 +1919,7 @@ async def test_create_target_site_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( @@ -1918,11 +1941,6 @@ async def test_create_target_site_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_target_site_async_from_dict(): - await test_create_target_site_async(request_type=dict) - - def test_create_target_site_field_headers(): client = SiteSearchEngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2087,8 +2105,8 @@ async def test_create_target_site_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - site_search_engine_service.BatchCreateTargetSitesRequest, - dict, + site_search_engine_service.BatchCreateTargetSitesRequest(), + {}, ], ) def test_batch_create_target_sites(request_type, transport: str = "grpc"): @@ -2099,7 +2117,7 @@ def test_batch_create_target_sites(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,9 +2162,10 @@ def test_batch_create_target_sites_non_empty_request_with_auto_populated_field() client.batch_create_target_sites(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == site_search_engine_service.BatchCreateTargetSitesRequest( + request_msg = site_search_engine_service.BatchCreateTargetSitesRequest( parent="parent_value", ) + assert args[0] == request_msg def test_batch_create_target_sites_use_cached_wrapped_rpc(): @@ -2242,9 +2261,15 @@ async def test_batch_create_target_sites_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + site_search_engine_service.BatchCreateTargetSitesRequest(), + {}, + ], +) async def test_batch_create_target_sites_async( - transport: str = "grpc_asyncio", - request_type=site_search_engine_service.BatchCreateTargetSitesRequest, + request_type, transport: str = "grpc_asyncio" ): client = SiteSearchEngineServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2253,7 +2278,7 @@ async def test_batch_create_target_sites_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( @@ -2275,11 +2300,6 @@ async def test_batch_create_target_sites_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_batch_create_target_sites_async_from_dict(): - await test_batch_create_target_sites_async(request_type=dict) - - def test_batch_create_target_sites_field_headers(): client = SiteSearchEngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2348,8 +2368,8 @@ async def test_batch_create_target_sites_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - site_search_engine_service.GetTargetSiteRequest, - dict, + site_search_engine_service.GetTargetSiteRequest(), + {}, ], ) def test_get_target_site(request_type, transport: str = "grpc"): @@ -2360,7 +2380,7 @@ def test_get_target_site(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_target_site), "__call__") as call: @@ -2418,9 +2438,10 @@ def test_get_target_site_non_empty_request_with_auto_populated_field(): client.get_target_site(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == site_search_engine_service.GetTargetSiteRequest( + request_msg = site_search_engine_service.GetTargetSiteRequest( name="name_value", ) + assert args[0] == request_msg def test_get_target_site_use_cached_wrapped_rpc(): @@ -2501,10 +2522,14 @@ async def test_get_target_site_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_target_site_async( - transport: str = "grpc_asyncio", - request_type=site_search_engine_service.GetTargetSiteRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + site_search_engine_service.GetTargetSiteRequest(), + {}, + ], +) +async def test_get_target_site_async(request_type, transport: str = "grpc_asyncio"): client = SiteSearchEngineServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2512,7 +2537,7 @@ async def test_get_target_site_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_target_site), "__call__") as call: @@ -2549,11 +2574,6 @@ async def test_get_target_site_async( ) -@pytest.mark.asyncio -async def test_get_target_site_async_from_dict(): - await test_get_target_site_async(request_type=dict) - - def test_get_target_site_field_headers(): client = SiteSearchEngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2700,8 +2720,8 @@ async def test_get_target_site_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - site_search_engine_service.UpdateTargetSiteRequest, - dict, + site_search_engine_service.UpdateTargetSiteRequest(), + {}, ], ) def test_update_target_site(request_type, transport: str = "grpc"): @@ -2712,7 +2732,7 @@ def test_update_target_site(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2755,7 +2775,8 @@ def test_update_target_site_non_empty_request_with_auto_populated_field(): client.update_target_site(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == site_search_engine_service.UpdateTargetSiteRequest() + request_msg = site_search_engine_service.UpdateTargetSiteRequest() + assert args[0] == request_msg def test_update_target_site_use_cached_wrapped_rpc(): @@ -2850,10 +2871,14 @@ async def test_update_target_site_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_target_site_async( - transport: str = "grpc_asyncio", - request_type=site_search_engine_service.UpdateTargetSiteRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + site_search_engine_service.UpdateTargetSiteRequest(), + {}, + ], +) +async def test_update_target_site_async(request_type, transport: str = "grpc_asyncio"): client = SiteSearchEngineServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2861,7 +2886,7 @@ async def test_update_target_site_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( @@ -2883,11 +2908,6 @@ async def test_update_target_site_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_target_site_async_from_dict(): - await test_update_target_site_async(request_type=dict) - - def test_update_target_site_field_headers(): client = SiteSearchEngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3042,8 +3062,8 @@ async def test_update_target_site_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - site_search_engine_service.DeleteTargetSiteRequest, - dict, + site_search_engine_service.DeleteTargetSiteRequest(), + {}, ], ) def test_delete_target_site(request_type, transport: str = "grpc"): @@ -3054,7 +3074,7 @@ def test_delete_target_site(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3099,9 +3119,10 @@ def test_delete_target_site_non_empty_request_with_auto_populated_field(): client.delete_target_site(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == site_search_engine_service.DeleteTargetSiteRequest( + request_msg = site_search_engine_service.DeleteTargetSiteRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_target_site_use_cached_wrapped_rpc(): @@ -3196,10 +3217,14 @@ async def test_delete_target_site_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_target_site_async( - transport: str = "grpc_asyncio", - request_type=site_search_engine_service.DeleteTargetSiteRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + site_search_engine_service.DeleteTargetSiteRequest(), + {}, + ], +) +async def test_delete_target_site_async(request_type, transport: str = "grpc_asyncio"): client = SiteSearchEngineServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3207,7 +3232,7 @@ async def test_delete_target_site_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( @@ -3229,11 +3254,6 @@ async def test_delete_target_site_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_target_site_async_from_dict(): - await test_delete_target_site_async(request_type=dict) - - def test_delete_target_site_field_headers(): client = SiteSearchEngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3388,8 +3408,8 @@ async def test_delete_target_site_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - site_search_engine_service.ListTargetSitesRequest, - dict, + site_search_engine_service.ListTargetSitesRequest(), + {}, ], ) def test_list_target_sites(request_type, transport: str = "grpc"): @@ -3400,7 +3420,7 @@ def test_list_target_sites(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3451,10 +3471,11 @@ def test_list_target_sites_non_empty_request_with_auto_populated_field(): client.list_target_sites(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == site_search_engine_service.ListTargetSitesRequest( + request_msg = site_search_engine_service.ListTargetSitesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_target_sites_use_cached_wrapped_rpc(): @@ -3537,10 +3558,14 @@ async def test_list_target_sites_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_target_sites_async( - transport: str = "grpc_asyncio", - request_type=site_search_engine_service.ListTargetSitesRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + site_search_engine_service.ListTargetSitesRequest(), + {}, + ], +) +async def test_list_target_sites_async(request_type, transport: str = "grpc_asyncio"): client = SiteSearchEngineServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3548,7 +3573,7 @@ async def test_list_target_sites_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( @@ -3575,11 +3600,6 @@ async def test_list_target_sites_async( assert response.total_size == 1086 -@pytest.mark.asyncio -async def test_list_target_sites_async_from_dict(): - await test_list_target_sites_async(request_type=dict) - - def test_list_target_sites_field_headers(): client = SiteSearchEngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3932,8 +3952,8 @@ async def test_list_target_sites_async_pages(): @pytest.mark.parametrize( "request_type", [ - site_search_engine_service.EnableAdvancedSiteSearchRequest, - dict, + site_search_engine_service.EnableAdvancedSiteSearchRequest(), + {}, ], ) def test_enable_advanced_site_search(request_type, transport: str = "grpc"): @@ -3944,7 +3964,7 @@ def test_enable_advanced_site_search(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3989,9 +4009,10 @@ def test_enable_advanced_site_search_non_empty_request_with_auto_populated_field client.enable_advanced_site_search(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == site_search_engine_service.EnableAdvancedSiteSearchRequest( + request_msg = site_search_engine_service.EnableAdvancedSiteSearchRequest( site_search_engine="site_search_engine_value", ) + assert args[0] == request_msg def test_enable_advanced_site_search_use_cached_wrapped_rpc(): @@ -4087,9 +4108,15 @@ async def test_enable_advanced_site_search_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + site_search_engine_service.EnableAdvancedSiteSearchRequest(), + {}, + ], +) async def test_enable_advanced_site_search_async( - transport: str = "grpc_asyncio", - request_type=site_search_engine_service.EnableAdvancedSiteSearchRequest, + request_type, transport: str = "grpc_asyncio" ): client = SiteSearchEngineServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4098,7 +4125,7 @@ async def test_enable_advanced_site_search_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( @@ -4120,11 +4147,6 @@ async def test_enable_advanced_site_search_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_enable_advanced_site_search_async_from_dict(): - await test_enable_advanced_site_search_async(request_type=dict) - - def test_enable_advanced_site_search_field_headers(): client = SiteSearchEngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4193,8 +4215,8 @@ async def test_enable_advanced_site_search_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - site_search_engine_service.DisableAdvancedSiteSearchRequest, - dict, + site_search_engine_service.DisableAdvancedSiteSearchRequest(), + {}, ], ) def test_disable_advanced_site_search(request_type, transport: str = "grpc"): @@ -4205,7 +4227,7 @@ def test_disable_advanced_site_search(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4250,9 +4272,10 @@ def test_disable_advanced_site_search_non_empty_request_with_auto_populated_fiel client.disable_advanced_site_search(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == site_search_engine_service.DisableAdvancedSiteSearchRequest( + request_msg = site_search_engine_service.DisableAdvancedSiteSearchRequest( site_search_engine="site_search_engine_value", ) + assert args[0] == request_msg def test_disable_advanced_site_search_use_cached_wrapped_rpc(): @@ -4348,9 +4371,15 @@ async def test_disable_advanced_site_search_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + site_search_engine_service.DisableAdvancedSiteSearchRequest(), + {}, + ], +) async def test_disable_advanced_site_search_async( - transport: str = "grpc_asyncio", - request_type=site_search_engine_service.DisableAdvancedSiteSearchRequest, + request_type, transport: str = "grpc_asyncio" ): client = SiteSearchEngineServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4359,7 +4388,7 @@ async def test_disable_advanced_site_search_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( @@ -4381,11 +4410,6 @@ async def test_disable_advanced_site_search_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_disable_advanced_site_search_async_from_dict(): - await test_disable_advanced_site_search_async(request_type=dict) - - def test_disable_advanced_site_search_field_headers(): client = SiteSearchEngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4454,8 +4478,8 @@ async def test_disable_advanced_site_search_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - site_search_engine_service.RecrawlUrisRequest, - dict, + site_search_engine_service.RecrawlUrisRequest(), + {}, ], ) def test_recrawl_uris(request_type, transport: str = "grpc"): @@ -4466,7 +4490,7 @@ def test_recrawl_uris(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.recrawl_uris), "__call__") as call: @@ -4507,9 +4531,10 @@ def test_recrawl_uris_non_empty_request_with_auto_populated_field(): client.recrawl_uris(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == site_search_engine_service.RecrawlUrisRequest( + request_msg = site_search_engine_service.RecrawlUrisRequest( site_search_engine="site_search_engine_value", ) + assert args[0] == request_msg def test_recrawl_uris_use_cached_wrapped_rpc(): @@ -4600,10 +4625,14 @@ async def test_recrawl_uris_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_recrawl_uris_async( - transport: str = "grpc_asyncio", - request_type=site_search_engine_service.RecrawlUrisRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + site_search_engine_service.RecrawlUrisRequest(), + {}, + ], +) +async def test_recrawl_uris_async(request_type, transport: str = "grpc_asyncio"): client = SiteSearchEngineServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4611,7 +4640,7 @@ async def test_recrawl_uris_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.recrawl_uris), "__call__") as call: @@ -4631,11 +4660,6 @@ async def test_recrawl_uris_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_recrawl_uris_async_from_dict(): - await test_recrawl_uris_async(request_type=dict) - - def test_recrawl_uris_field_headers(): client = SiteSearchEngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4700,8 +4724,8 @@ async def test_recrawl_uris_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - site_search_engine_service.BatchVerifyTargetSitesRequest, - dict, + site_search_engine_service.BatchVerifyTargetSitesRequest(), + {}, ], ) def test_batch_verify_target_sites(request_type, transport: str = "grpc"): @@ -4712,7 +4736,7 @@ def test_batch_verify_target_sites(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4757,9 +4781,10 @@ def test_batch_verify_target_sites_non_empty_request_with_auto_populated_field() client.batch_verify_target_sites(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == site_search_engine_service.BatchVerifyTargetSitesRequest( + request_msg = site_search_engine_service.BatchVerifyTargetSitesRequest( parent="parent_value", ) + assert args[0] == request_msg def test_batch_verify_target_sites_use_cached_wrapped_rpc(): @@ -4855,9 +4880,15 @@ async def test_batch_verify_target_sites_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + site_search_engine_service.BatchVerifyTargetSitesRequest(), + {}, + ], +) async def test_batch_verify_target_sites_async( - transport: str = "grpc_asyncio", - request_type=site_search_engine_service.BatchVerifyTargetSitesRequest, + request_type, transport: str = "grpc_asyncio" ): client = SiteSearchEngineServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4866,7 +4897,7 @@ async def test_batch_verify_target_sites_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( @@ -4888,11 +4919,6 @@ async def test_batch_verify_target_sites_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_batch_verify_target_sites_async_from_dict(): - await test_batch_verify_target_sites_async(request_type=dict) - - def test_batch_verify_target_sites_field_headers(): client = SiteSearchEngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4961,8 +4987,8 @@ async def test_batch_verify_target_sites_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - site_search_engine_service.FetchDomainVerificationStatusRequest, - dict, + site_search_engine_service.FetchDomainVerificationStatusRequest(), + {}, ], ) def test_fetch_domain_verification_status(request_type, transport: str = "grpc"): @@ -4973,7 +4999,7 @@ def test_fetch_domain_verification_status(request_type, transport: str = "grpc") # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5026,12 +5052,11 @@ def test_fetch_domain_verification_status_non_empty_request_with_auto_populated_ client.fetch_domain_verification_status(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == site_search_engine_service.FetchDomainVerificationStatusRequest( + request_msg = site_search_engine_service.FetchDomainVerificationStatusRequest( site_search_engine="site_search_engine_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_fetch_domain_verification_status_use_cached_wrapped_rpc(): @@ -5117,9 +5142,15 @@ async def test_fetch_domain_verification_status_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + site_search_engine_service.FetchDomainVerificationStatusRequest(), + {}, + ], +) async def test_fetch_domain_verification_status_async( - transport: str = "grpc_asyncio", - request_type=site_search_engine_service.FetchDomainVerificationStatusRequest, + request_type, transport: str = "grpc_asyncio" ): client = SiteSearchEngineServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5128,7 +5159,7 @@ async def test_fetch_domain_verification_status_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( @@ -5155,11 +5186,6 @@ async def test_fetch_domain_verification_status_async( assert response.total_size == 1086 -@pytest.mark.asyncio -async def test_fetch_domain_verification_status_async_from_dict(): - await test_fetch_domain_verification_status_async(request_type=dict) - - def test_fetch_domain_verification_status_field_headers(): client = SiteSearchEngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5432,8 +5458,8 @@ async def test_fetch_domain_verification_status_async_pages(): @pytest.mark.parametrize( "request_type", [ - site_search_engine_service.SetUriPatternDocumentDataRequest, - dict, + site_search_engine_service.SetUriPatternDocumentDataRequest(), + {}, ], ) def test_set_uri_pattern_document_data(request_type, transport: str = "grpc"): @@ -5444,7 +5470,7 @@ def test_set_uri_pattern_document_data(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5489,9 +5515,10 @@ def test_set_uri_pattern_document_data_non_empty_request_with_auto_populated_fie client.set_uri_pattern_document_data(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == site_search_engine_service.SetUriPatternDocumentDataRequest( + request_msg = site_search_engine_service.SetUriPatternDocumentDataRequest( site_search_engine="site_search_engine_value", ) + assert args[0] == request_msg def test_set_uri_pattern_document_data_use_cached_wrapped_rpc(): @@ -5587,9 +5614,15 @@ async def test_set_uri_pattern_document_data_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + site_search_engine_service.SetUriPatternDocumentDataRequest(), + {}, + ], +) async def test_set_uri_pattern_document_data_async( - transport: str = "grpc_asyncio", - request_type=site_search_engine_service.SetUriPatternDocumentDataRequest, + request_type, transport: str = "grpc_asyncio" ): client = SiteSearchEngineServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5598,7 +5631,7 @@ async def test_set_uri_pattern_document_data_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( @@ -5620,11 +5653,6 @@ async def test_set_uri_pattern_document_data_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_set_uri_pattern_document_data_async_from_dict(): - await test_set_uri_pattern_document_data_async(request_type=dict) - - def test_set_uri_pattern_document_data_field_headers(): client = SiteSearchEngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5693,8 +5721,8 @@ async def test_set_uri_pattern_document_data_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - site_search_engine_service.GetUriPatternDocumentDataRequest, - dict, + site_search_engine_service.GetUriPatternDocumentDataRequest(), + {}, ], ) def test_get_uri_pattern_document_data(request_type, transport: str = "grpc"): @@ -5705,7 +5733,7 @@ def test_get_uri_pattern_document_data(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5754,9 +5782,10 @@ def test_get_uri_pattern_document_data_non_empty_request_with_auto_populated_fie client.get_uri_pattern_document_data(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == site_search_engine_service.GetUriPatternDocumentDataRequest( + request_msg = site_search_engine_service.GetUriPatternDocumentDataRequest( site_search_engine="site_search_engine_value", ) + assert args[0] == request_msg def test_get_uri_pattern_document_data_use_cached_wrapped_rpc(): @@ -5842,9 +5871,15 @@ async def test_get_uri_pattern_document_data_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + site_search_engine_service.GetUriPatternDocumentDataRequest(), + {}, + ], +) async def test_get_uri_pattern_document_data_async( - transport: str = "grpc_asyncio", - request_type=site_search_engine_service.GetUriPatternDocumentDataRequest, + request_type, transport: str = "grpc_asyncio" ): client = SiteSearchEngineServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5853,7 +5888,7 @@ async def test_get_uri_pattern_document_data_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( @@ -5877,11 +5912,6 @@ async def test_get_uri_pattern_document_data_async( ) -@pytest.mark.asyncio -async def test_get_uri_pattern_document_data_async_from_dict(): - await test_get_uri_pattern_document_data_async(request_type=dict) - - def test_get_uri_pattern_document_data_field_headers(): client = SiteSearchEngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8388,7 +8418,6 @@ def test_get_site_search_engine_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.GetSiteSearchEngineRequest() - assert args[0] == request_msg @@ -8411,7 +8440,6 @@ def test_create_target_site_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.CreateTargetSiteRequest() - assert args[0] == request_msg @@ -8434,7 +8462,6 @@ def test_batch_create_target_sites_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.BatchCreateTargetSitesRequest() - assert args[0] == request_msg @@ -8455,7 +8482,6 @@ def test_get_target_site_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.GetTargetSiteRequest() - assert args[0] == request_msg @@ -8478,7 +8504,6 @@ def test_update_target_site_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.UpdateTargetSiteRequest() - assert args[0] == request_msg @@ -8501,7 +8526,6 @@ def test_delete_target_site_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.DeleteTargetSiteRequest() - assert args[0] == request_msg @@ -8524,7 +8548,6 @@ def test_list_target_sites_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.ListTargetSitesRequest() - assert args[0] == request_msg @@ -8547,7 +8570,6 @@ def test_enable_advanced_site_search_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.EnableAdvancedSiteSearchRequest() - assert args[0] == request_msg @@ -8570,7 +8592,6 @@ def test_disable_advanced_site_search_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.DisableAdvancedSiteSearchRequest() - assert args[0] == request_msg @@ -8591,7 +8612,6 @@ def test_recrawl_uris_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.RecrawlUrisRequest() - assert args[0] == request_msg @@ -8614,7 +8634,6 @@ def test_batch_verify_target_sites_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.BatchVerifyTargetSitesRequest() - assert args[0] == request_msg @@ -8639,7 +8658,6 @@ def test_fetch_domain_verification_status_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.FetchDomainVerificationStatusRequest() - assert args[0] == request_msg @@ -8662,7 +8680,6 @@ def test_set_uri_pattern_document_data_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.SetUriPatternDocumentDataRequest() - assert args[0] == request_msg @@ -8687,7 +8704,6 @@ def test_get_uri_pattern_document_data_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.GetUriPatternDocumentDataRequest() - assert args[0] == request_msg @@ -8730,7 +8746,6 @@ async def test_get_site_search_engine_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.GetSiteSearchEngineRequest() - assert args[0] == request_msg @@ -8757,7 +8772,6 @@ async def test_create_target_site_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.CreateTargetSiteRequest() - assert args[0] == request_msg @@ -8784,7 +8798,6 @@ async def test_batch_create_target_sites_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.BatchCreateTargetSitesRequest() - assert args[0] == request_msg @@ -8817,7 +8830,6 @@ async def test_get_target_site_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.GetTargetSiteRequest() - assert args[0] == request_msg @@ -8844,7 +8856,6 @@ async def test_update_target_site_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.UpdateTargetSiteRequest() - assert args[0] == request_msg @@ -8871,7 +8882,6 @@ async def test_delete_target_site_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.DeleteTargetSiteRequest() - assert args[0] == request_msg @@ -8901,7 +8911,6 @@ async def test_list_target_sites_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.ListTargetSitesRequest() - assert args[0] == request_msg @@ -8928,7 +8937,6 @@ async def test_enable_advanced_site_search_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.EnableAdvancedSiteSearchRequest() - assert args[0] == request_msg @@ -8955,7 +8963,6 @@ async def test_disable_advanced_site_search_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.DisableAdvancedSiteSearchRequest() - assert args[0] == request_msg @@ -8980,7 +8987,6 @@ async def test_recrawl_uris_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.RecrawlUrisRequest() - assert args[0] == request_msg @@ -9007,7 +9013,6 @@ async def test_batch_verify_target_sites_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.BatchVerifyTargetSitesRequest() - assert args[0] == request_msg @@ -9037,7 +9042,6 @@ async def test_fetch_domain_verification_status_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.FetchDomainVerificationStatusRequest() - assert args[0] == request_msg @@ -9064,7 +9068,6 @@ async def test_set_uri_pattern_document_data_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.SetUriPatternDocumentDataRequest() - assert args[0] == request_msg @@ -9091,7 +9094,6 @@ async def test_get_uri_pattern_document_data_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.GetUriPatternDocumentDataRequest() - assert args[0] == request_msg @@ -11419,7 +11421,6 @@ def test_get_site_search_engine_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.GetSiteSearchEngineRequest() - assert args[0] == request_msg @@ -11441,7 +11442,6 @@ def test_create_target_site_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.CreateTargetSiteRequest() - assert args[0] == request_msg @@ -11463,7 +11463,6 @@ def test_batch_create_target_sites_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.BatchCreateTargetSitesRequest() - assert args[0] == request_msg @@ -11483,7 +11482,6 @@ def test_get_target_site_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.GetTargetSiteRequest() - assert args[0] == request_msg @@ -11505,7 +11503,6 @@ def test_update_target_site_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.UpdateTargetSiteRequest() - assert args[0] == request_msg @@ -11527,7 +11524,6 @@ def test_delete_target_site_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.DeleteTargetSiteRequest() - assert args[0] == request_msg @@ -11549,7 +11545,6 @@ def test_list_target_sites_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.ListTargetSitesRequest() - assert args[0] == request_msg @@ -11571,7 +11566,6 @@ def test_enable_advanced_site_search_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.EnableAdvancedSiteSearchRequest() - assert args[0] == request_msg @@ -11593,7 +11587,6 @@ def test_disable_advanced_site_search_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.DisableAdvancedSiteSearchRequest() - assert args[0] == request_msg @@ -11613,7 +11606,6 @@ def test_recrawl_uris_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.RecrawlUrisRequest() - assert args[0] == request_msg @@ -11635,7 +11627,6 @@ def test_batch_verify_target_sites_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.BatchVerifyTargetSitesRequest() - assert args[0] == request_msg @@ -11657,7 +11648,6 @@ def test_fetch_domain_verification_status_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.FetchDomainVerificationStatusRequest() - assert args[0] == request_msg @@ -11679,7 +11669,6 @@ def test_set_uri_pattern_document_data_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.SetUriPatternDocumentDataRequest() - assert args[0] == request_msg @@ -11701,7 +11690,6 @@ def test_get_uri_pattern_document_data_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.GetUriPatternDocumentDataRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_user_event_service.py b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_user_event_service.py index 133a32e0bee5..3e12f8b61909 100644 --- a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_user_event_service.py +++ b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1alpha/test_user_event_service.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 @@ -123,6 +124,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" @@ -1356,8 +1372,8 @@ def test_user_event_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - user_event_service.WriteUserEventRequest, - dict, + user_event_service.WriteUserEventRequest(), + {}, ], ) def test_write_user_event(request_type, transport: str = "grpc"): @@ -1368,7 +1384,7 @@ def test_write_user_event(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.write_user_event), "__call__") as call: @@ -1430,9 +1446,10 @@ def test_write_user_event_non_empty_request_with_auto_populated_field(): client.write_user_event(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == user_event_service.WriteUserEventRequest( + request_msg = user_event_service.WriteUserEventRequest( parent="parent_value", ) + assert args[0] == request_msg def test_write_user_event_use_cached_wrapped_rpc(): @@ -1515,10 +1532,14 @@ async def test_write_user_event_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_write_user_event_async( - transport: str = "grpc_asyncio", - request_type=user_event_service.WriteUserEventRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + user_event_service.WriteUserEventRequest(), + {}, + ], +) +async def test_write_user_event_async(request_type, transport: str = "grpc_asyncio"): client = UserEventServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1526,7 +1547,7 @@ async def test_write_user_event_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.write_user_event), "__call__") as call: @@ -1567,11 +1588,6 @@ async def test_write_user_event_async( assert response.promotion_ids == ["promotion_ids_value"] -@pytest.mark.asyncio -async def test_write_user_event_async_from_dict(): - await test_write_user_event_async(request_type=dict) - - def test_write_user_event_field_headers(): client = UserEventServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1636,8 +1652,8 @@ async def test_write_user_event_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - user_event_service.CollectUserEventRequest, - dict, + user_event_service.CollectUserEventRequest(), + {}, ], ) def test_collect_user_event(request_type, transport: str = "grpc"): @@ -1648,7 +1664,7 @@ def test_collect_user_event(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1700,11 +1716,12 @@ def test_collect_user_event_non_empty_request_with_auto_populated_field(): client.collect_user_event(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == user_event_service.CollectUserEventRequest( + request_msg = user_event_service.CollectUserEventRequest( parent="parent_value", user_event="user_event_value", uri="uri_value", ) + assert args[0] == request_msg def test_collect_user_event_use_cached_wrapped_rpc(): @@ -1789,10 +1806,14 @@ async def test_collect_user_event_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_collect_user_event_async( - transport: str = "grpc_asyncio", - request_type=user_event_service.CollectUserEventRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + user_event_service.CollectUserEventRequest(), + {}, + ], +) +async def test_collect_user_event_async(request_type, transport: str = "grpc_asyncio"): client = UserEventServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1800,7 +1821,7 @@ async def test_collect_user_event_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( @@ -1827,11 +1848,6 @@ async def test_collect_user_event_async( assert response.data == b"data_blob" -@pytest.mark.asyncio -async def test_collect_user_event_async_from_dict(): - await test_collect_user_event_async(request_type=dict) - - def test_collect_user_event_field_headers(): client = UserEventServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1900,8 +1916,8 @@ async def test_collect_user_event_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - purge_config.PurgeUserEventsRequest, - dict, + purge_config.PurgeUserEventsRequest(), + {}, ], ) def test_purge_user_events(request_type, transport: str = "grpc"): @@ -1912,7 +1928,7 @@ def test_purge_user_events(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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 +1974,11 @@ def test_purge_user_events_non_empty_request_with_auto_populated_field(): client.purge_user_events(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == purge_config.PurgeUserEventsRequest( + request_msg = purge_config.PurgeUserEventsRequest( parent="parent_value", filter="filter_value", ) + assert args[0] == request_msg def test_purge_user_events_use_cached_wrapped_rpc(): @@ -2054,9 +2071,14 @@ async def test_purge_user_events_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_purge_user_events_async( - transport: str = "grpc_asyncio", request_type=purge_config.PurgeUserEventsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + purge_config.PurgeUserEventsRequest(), + {}, + ], +) +async def test_purge_user_events_async(request_type, transport: str = "grpc_asyncio"): client = UserEventServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2064,7 +2086,7 @@ async def test_purge_user_events_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( @@ -2086,11 +2108,6 @@ async def test_purge_user_events_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_purge_user_events_async_from_dict(): - await test_purge_user_events_async(request_type=dict) - - def test_purge_user_events_field_headers(): client = UserEventServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2159,8 +2176,8 @@ async def test_purge_user_events_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - import_config.ImportUserEventsRequest, - dict, + import_config.ImportUserEventsRequest(), + {}, ], ) def test_import_user_events(request_type, transport: str = "grpc"): @@ -2171,7 +2188,7 @@ def test_import_user_events(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2216,9 +2233,10 @@ def test_import_user_events_non_empty_request_with_auto_populated_field(): client.import_user_events(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == import_config.ImportUserEventsRequest( + request_msg = import_config.ImportUserEventsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_import_user_events_use_cached_wrapped_rpc(): @@ -2313,9 +2331,14 @@ async def test_import_user_events_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_import_user_events_async( - transport: str = "grpc_asyncio", request_type=import_config.ImportUserEventsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + import_config.ImportUserEventsRequest(), + {}, + ], +) +async def test_import_user_events_async(request_type, transport: str = "grpc_asyncio"): client = UserEventServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2323,7 +2346,7 @@ async def test_import_user_events_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( @@ -2345,11 +2368,6 @@ async def test_import_user_events_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_import_user_events_async_from_dict(): - await test_import_user_events_async(request_type=dict) - - def test_import_user_events_field_headers(): client = UserEventServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3090,7 +3108,6 @@ def test_write_user_event_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_event_service.WriteUserEventRequest() - assert args[0] == request_msg @@ -3113,7 +3130,6 @@ def test_collect_user_event_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_event_service.CollectUserEventRequest() - assert args[0] == request_msg @@ -3136,7 +3152,6 @@ def test_purge_user_events_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = purge_config.PurgeUserEventsRequest() - assert args[0] == request_msg @@ -3159,7 +3174,6 @@ def test_import_user_events_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_config.ImportUserEventsRequest() - assert args[0] == request_msg @@ -3209,7 +3223,6 @@ async def test_write_user_event_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_event_service.WriteUserEventRequest() - assert args[0] == request_msg @@ -3239,7 +3252,6 @@ async def test_collect_user_event_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_event_service.CollectUserEventRequest() - assert args[0] == request_msg @@ -3266,7 +3278,6 @@ async def test_purge_user_events_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = purge_config.PurgeUserEventsRequest() - assert args[0] == request_msg @@ -3293,7 +3304,6 @@ async def test_import_user_events_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_config.ImportUserEventsRequest() - assert args[0] == request_msg @@ -4187,7 +4197,6 @@ def test_write_user_event_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_event_service.WriteUserEventRequest() - assert args[0] == request_msg @@ -4209,7 +4218,6 @@ def test_collect_user_event_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_event_service.CollectUserEventRequest() - assert args[0] == request_msg @@ -4231,7 +4239,6 @@ def test_purge_user_events_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = purge_config.PurgeUserEventsRequest() - assert args[0] == request_msg @@ -4253,7 +4260,6 @@ def test_import_user_events_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_config.ImportUserEventsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_completion_service.py b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_completion_service.py index c56a03a4f926..ca370ae60758 100644 --- a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_completion_service.py +++ b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_completion_service.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 @@ -119,6 +120,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" @@ -1360,8 +1376,8 @@ def test_completion_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - completion_service.CompleteQueryRequest, - dict, + completion_service.CompleteQueryRequest(), + {}, ], ) def test_complete_query(request_type, transport: str = "grpc"): @@ -1372,7 +1388,7 @@ def test_complete_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(type(client.transport.complete_query), "__call__") as call: @@ -1419,12 +1435,13 @@ def test_complete_query_non_empty_request_with_auto_populated_field(): client.complete_query(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == completion_service.CompleteQueryRequest( + request_msg = completion_service.CompleteQueryRequest( data_store="data_store_value", query="query_value", query_model="query_model_value", user_pseudo_id="user_pseudo_id_value", ) + assert args[0] == request_msg def test_complete_query_use_cached_wrapped_rpc(): @@ -1505,10 +1522,14 @@ async def test_complete_query_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_complete_query_async( - transport: str = "grpc_asyncio", - request_type=completion_service.CompleteQueryRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + completion_service.CompleteQueryRequest(), + {}, + ], +) +async def test_complete_query_async(request_type, transport: str = "grpc_asyncio"): client = CompletionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1516,7 +1537,7 @@ async def test_complete_query_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.complete_query), "__call__") as call: @@ -1539,11 +1560,6 @@ async def test_complete_query_async( assert response.tail_match_triggered is True -@pytest.mark.asyncio -async def test_complete_query_async_from_dict(): - await test_complete_query_async(request_type=dict) - - def test_complete_query_field_headers(): client = CompletionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1608,8 +1624,8 @@ async def test_complete_query_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - completion_service.AdvancedCompleteQueryRequest, - dict, + completion_service.AdvancedCompleteQueryRequest(), + {}, ], ) def test_advanced_complete_query(request_type, transport: str = "grpc"): @@ -1620,7 +1636,7 @@ def test_advanced_complete_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( @@ -1671,12 +1687,13 @@ def test_advanced_complete_query_non_empty_request_with_auto_populated_field(): client.advanced_complete_query(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == completion_service.AdvancedCompleteQueryRequest( + request_msg = completion_service.AdvancedCompleteQueryRequest( completion_config="completion_config_value", query="query_value", query_model="query_model_value", user_pseudo_id="user_pseudo_id_value", ) + assert args[0] == request_msg def test_advanced_complete_query_use_cached_wrapped_rpc(): @@ -1762,9 +1779,15 @@ async def test_advanced_complete_query_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + completion_service.AdvancedCompleteQueryRequest(), + {}, + ], +) async def test_advanced_complete_query_async( - transport: str = "grpc_asyncio", - request_type=completion_service.AdvancedCompleteQueryRequest, + request_type, transport: str = "grpc_asyncio" ): client = CompletionServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1773,7 +1796,7 @@ async def test_advanced_complete_query_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( @@ -1798,11 +1821,6 @@ async def test_advanced_complete_query_async( assert response.tail_match_triggered is True -@pytest.mark.asyncio -async def test_advanced_complete_query_async_from_dict(): - await test_advanced_complete_query_async(request_type=dict) - - def test_advanced_complete_query_field_headers(): client = CompletionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1871,8 +1889,8 @@ async def test_advanced_complete_query_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - import_config.ImportSuggestionDenyListEntriesRequest, - dict, + import_config.ImportSuggestionDenyListEntriesRequest(), + {}, ], ) def test_import_suggestion_deny_list_entries(request_type, transport: str = "grpc"): @@ -1883,7 +1901,7 @@ def test_import_suggestion_deny_list_entries(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( @@ -1928,9 +1946,10 @@ def test_import_suggestion_deny_list_entries_non_empty_request_with_auto_populat client.import_suggestion_deny_list_entries(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == import_config.ImportSuggestionDenyListEntriesRequest( + request_msg = import_config.ImportSuggestionDenyListEntriesRequest( parent="parent_value", ) + assert args[0] == request_msg def test_import_suggestion_deny_list_entries_use_cached_wrapped_rpc(): @@ -2026,9 +2045,15 @@ async def test_import_suggestion_deny_list_entries_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + import_config.ImportSuggestionDenyListEntriesRequest(), + {}, + ], +) async def test_import_suggestion_deny_list_entries_async( - transport: str = "grpc_asyncio", - request_type=import_config.ImportSuggestionDenyListEntriesRequest, + request_type, transport: str = "grpc_asyncio" ): client = CompletionServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2037,7 +2062,7 @@ async def test_import_suggestion_deny_list_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( @@ -2059,11 +2084,6 @@ async def test_import_suggestion_deny_list_entries_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_import_suggestion_deny_list_entries_async_from_dict(): - await test_import_suggestion_deny_list_entries_async(request_type=dict) - - def test_import_suggestion_deny_list_entries_field_headers(): client = CompletionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2132,8 +2152,8 @@ async def test_import_suggestion_deny_list_entries_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - purge_config.PurgeSuggestionDenyListEntriesRequest, - dict, + purge_config.PurgeSuggestionDenyListEntriesRequest(), + {}, ], ) def test_purge_suggestion_deny_list_entries(request_type, transport: str = "grpc"): @@ -2144,7 +2164,7 @@ def test_purge_suggestion_deny_list_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( @@ -2189,9 +2209,10 @@ def test_purge_suggestion_deny_list_entries_non_empty_request_with_auto_populate client.purge_suggestion_deny_list_entries(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == purge_config.PurgeSuggestionDenyListEntriesRequest( + request_msg = purge_config.PurgeSuggestionDenyListEntriesRequest( parent="parent_value", ) + assert args[0] == request_msg def test_purge_suggestion_deny_list_entries_use_cached_wrapped_rpc(): @@ -2287,9 +2308,15 @@ async def test_purge_suggestion_deny_list_entries_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + purge_config.PurgeSuggestionDenyListEntriesRequest(), + {}, + ], +) async def test_purge_suggestion_deny_list_entries_async( - transport: str = "grpc_asyncio", - request_type=purge_config.PurgeSuggestionDenyListEntriesRequest, + request_type, transport: str = "grpc_asyncio" ): client = CompletionServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2298,7 +2325,7 @@ async def test_purge_suggestion_deny_list_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( @@ -2320,11 +2347,6 @@ async def test_purge_suggestion_deny_list_entries_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_purge_suggestion_deny_list_entries_async_from_dict(): - await test_purge_suggestion_deny_list_entries_async(request_type=dict) - - def test_purge_suggestion_deny_list_entries_field_headers(): client = CompletionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2393,8 +2415,8 @@ async def test_purge_suggestion_deny_list_entries_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - import_config.ImportCompletionSuggestionsRequest, - dict, + import_config.ImportCompletionSuggestionsRequest(), + {}, ], ) def test_import_completion_suggestions(request_type, transport: str = "grpc"): @@ -2405,7 +2427,7 @@ def test_import_completion_suggestions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2450,9 +2472,10 @@ def test_import_completion_suggestions_non_empty_request_with_auto_populated_fie client.import_completion_suggestions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == import_config.ImportCompletionSuggestionsRequest( + request_msg = import_config.ImportCompletionSuggestionsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_import_completion_suggestions_use_cached_wrapped_rpc(): @@ -2548,9 +2571,15 @@ async def test_import_completion_suggestions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + import_config.ImportCompletionSuggestionsRequest(), + {}, + ], +) async def test_import_completion_suggestions_async( - transport: str = "grpc_asyncio", - request_type=import_config.ImportCompletionSuggestionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = CompletionServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2559,7 +2588,7 @@ async def test_import_completion_suggestions_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( @@ -2581,11 +2610,6 @@ async def test_import_completion_suggestions_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_import_completion_suggestions_async_from_dict(): - await test_import_completion_suggestions_async(request_type=dict) - - def test_import_completion_suggestions_field_headers(): client = CompletionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2654,8 +2678,8 @@ async def test_import_completion_suggestions_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - purge_config.PurgeCompletionSuggestionsRequest, - dict, + purge_config.PurgeCompletionSuggestionsRequest(), + {}, ], ) def test_purge_completion_suggestions(request_type, transport: str = "grpc"): @@ -2666,7 +2690,7 @@ def test_purge_completion_suggestions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2711,9 +2735,10 @@ def test_purge_completion_suggestions_non_empty_request_with_auto_populated_fiel client.purge_completion_suggestions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == purge_config.PurgeCompletionSuggestionsRequest( + request_msg = purge_config.PurgeCompletionSuggestionsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_purge_completion_suggestions_use_cached_wrapped_rpc(): @@ -2809,9 +2834,15 @@ async def test_purge_completion_suggestions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + purge_config.PurgeCompletionSuggestionsRequest(), + {}, + ], +) async def test_purge_completion_suggestions_async( - transport: str = "grpc_asyncio", - request_type=purge_config.PurgeCompletionSuggestionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = CompletionServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2820,7 +2851,7 @@ async def test_purge_completion_suggestions_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( @@ -2842,11 +2873,6 @@ async def test_purge_completion_suggestions_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_purge_completion_suggestions_async_from_dict(): - await test_purge_completion_suggestions_async(request_type=dict) - - def test_purge_completion_suggestions_field_headers(): client = CompletionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3846,7 +3872,6 @@ def test_complete_query_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = completion_service.CompleteQueryRequest() - assert args[0] == request_msg @@ -3869,7 +3894,6 @@ def test_advanced_complete_query_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = completion_service.AdvancedCompleteQueryRequest() - assert args[0] == request_msg @@ -3892,7 +3916,6 @@ def test_import_suggestion_deny_list_entries_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_config.ImportSuggestionDenyListEntriesRequest() - assert args[0] == request_msg @@ -3915,7 +3938,6 @@ def test_purge_suggestion_deny_list_entries_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = purge_config.PurgeSuggestionDenyListEntriesRequest() - assert args[0] == request_msg @@ -3938,7 +3960,6 @@ def test_import_completion_suggestions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_config.ImportCompletionSuggestionsRequest() - assert args[0] == request_msg @@ -3961,7 +3982,6 @@ def test_purge_completion_suggestions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = purge_config.PurgeCompletionSuggestionsRequest() - assert args[0] == request_msg @@ -4002,7 +4022,6 @@ async def test_complete_query_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = completion_service.CompleteQueryRequest() - assert args[0] == request_msg @@ -4031,7 +4050,6 @@ async def test_advanced_complete_query_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = completion_service.AdvancedCompleteQueryRequest() - assert args[0] == request_msg @@ -4058,7 +4076,6 @@ async def test_import_suggestion_deny_list_entries_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_config.ImportSuggestionDenyListEntriesRequest() - assert args[0] == request_msg @@ -4085,7 +4102,6 @@ async def test_purge_suggestion_deny_list_entries_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = purge_config.PurgeSuggestionDenyListEntriesRequest() - assert args[0] == request_msg @@ -4112,7 +4128,6 @@ async def test_import_completion_suggestions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_config.ImportCompletionSuggestionsRequest() - assert args[0] == request_msg @@ -4139,7 +4154,6 @@ async def test_purge_completion_suggestions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = purge_config.PurgeCompletionSuggestionsRequest() - assert args[0] == request_msg @@ -5185,7 +5199,6 @@ def test_complete_query_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = completion_service.CompleteQueryRequest() - assert args[0] == request_msg @@ -5207,7 +5220,6 @@ def test_advanced_complete_query_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = completion_service.AdvancedCompleteQueryRequest() - assert args[0] == request_msg @@ -5229,7 +5241,6 @@ def test_import_suggestion_deny_list_entries_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_config.ImportSuggestionDenyListEntriesRequest() - assert args[0] == request_msg @@ -5251,7 +5262,6 @@ def test_purge_suggestion_deny_list_entries_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = purge_config.PurgeSuggestionDenyListEntriesRequest() - assert args[0] == request_msg @@ -5273,7 +5283,6 @@ def test_import_completion_suggestions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_config.ImportCompletionSuggestionsRequest() - assert args[0] == request_msg @@ -5295,7 +5304,6 @@ def test_purge_completion_suggestions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = purge_config.PurgeCompletionSuggestionsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_control_service.py b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_control_service.py index cf684fa32aaf..fb497444238b 100644 --- a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_control_service.py +++ b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_control_service.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" @@ -1315,8 +1331,8 @@ def test_control_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - control_service.CreateControlRequest, - dict, + control_service.CreateControlRequest(), + {}, ], ) def test_create_control(request_type, transport: str = "grpc"): @@ -1327,7 +1343,7 @@ def test_create_control(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_control), "__call__") as call: @@ -1382,10 +1398,11 @@ def test_create_control_non_empty_request_with_auto_populated_field(): client.create_control(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == control_service.CreateControlRequest( + request_msg = control_service.CreateControlRequest( parent="parent_value", control_id="control_id_value", ) + assert args[0] == request_msg def test_create_control_use_cached_wrapped_rpc(): @@ -1466,9 +1483,14 @@ async def test_create_control_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_control_async( - transport: str = "grpc_asyncio", request_type=control_service.CreateControlRequest -): +@pytest.mark.parametrize( + "request_type", + [ + control_service.CreateControlRequest(), + {}, + ], +) +async def test_create_control_async(request_type, transport: str = "grpc_asyncio"): client = ControlServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1476,7 +1498,7 @@ async def test_create_control_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_control), "__call__") as call: @@ -1509,11 +1531,6 @@ async def test_create_control_async( assert response.use_cases == [common.SearchUseCase.SEARCH_USE_CASE_SEARCH] -@pytest.mark.asyncio -async def test_create_control_async_from_dict(): - await test_create_control_async(request_type=dict) - - def test_create_control_field_headers(): client = ControlServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1688,8 +1705,8 @@ async def test_create_control_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - control_service.DeleteControlRequest, - dict, + control_service.DeleteControlRequest(), + {}, ], ) def test_delete_control(request_type, transport: str = "grpc"): @@ -1700,7 +1717,7 @@ def test_delete_control(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_control), "__call__") as call: @@ -1741,9 +1758,10 @@ def test_delete_control_non_empty_request_with_auto_populated_field(): client.delete_control(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == control_service.DeleteControlRequest( + request_msg = control_service.DeleteControlRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_control_use_cached_wrapped_rpc(): @@ -1824,9 +1842,14 @@ async def test_delete_control_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_control_async( - transport: str = "grpc_asyncio", request_type=control_service.DeleteControlRequest -): +@pytest.mark.parametrize( + "request_type", + [ + control_service.DeleteControlRequest(), + {}, + ], +) +async def test_delete_control_async(request_type, transport: str = "grpc_asyncio"): client = ControlServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1834,7 +1857,7 @@ async def test_delete_control_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_control), "__call__") as call: @@ -1852,11 +1875,6 @@ async def test_delete_control_async( assert response is None -@pytest.mark.asyncio -async def test_delete_control_async_from_dict(): - await test_delete_control_async(request_type=dict) - - def test_delete_control_field_headers(): client = ControlServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1999,8 +2017,8 @@ async def test_delete_control_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - control_service.UpdateControlRequest, - dict, + control_service.UpdateControlRequest(), + {}, ], ) def test_update_control(request_type, transport: str = "grpc"): @@ -2011,7 +2029,7 @@ def test_update_control(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_control), "__call__") as call: @@ -2063,7 +2081,8 @@ def test_update_control_non_empty_request_with_auto_populated_field(): client.update_control(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == control_service.UpdateControlRequest() + request_msg = control_service.UpdateControlRequest() + assert args[0] == request_msg def test_update_control_use_cached_wrapped_rpc(): @@ -2144,9 +2163,14 @@ async def test_update_control_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_control_async( - transport: str = "grpc_asyncio", request_type=control_service.UpdateControlRequest -): +@pytest.mark.parametrize( + "request_type", + [ + control_service.UpdateControlRequest(), + {}, + ], +) +async def test_update_control_async(request_type, transport: str = "grpc_asyncio"): client = ControlServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2154,7 +2178,7 @@ async def test_update_control_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_control), "__call__") as call: @@ -2187,11 +2211,6 @@ async def test_update_control_async( assert response.use_cases == [common.SearchUseCase.SEARCH_USE_CASE_SEARCH] -@pytest.mark.asyncio -async def test_update_control_async_from_dict(): - await test_update_control_async(request_type=dict) - - def test_update_control_field_headers(): client = ControlServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2356,8 +2375,8 @@ async def test_update_control_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - control_service.GetControlRequest, - dict, + control_service.GetControlRequest(), + {}, ], ) def test_get_control(request_type, transport: str = "grpc"): @@ -2368,7 +2387,7 @@ def test_get_control(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_control), "__call__") as call: @@ -2422,9 +2441,10 @@ def test_get_control_non_empty_request_with_auto_populated_field(): client.get_control(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == control_service.GetControlRequest( + request_msg = control_service.GetControlRequest( name="name_value", ) + assert args[0] == request_msg def test_get_control_use_cached_wrapped_rpc(): @@ -2505,9 +2525,14 @@ async def test_get_control_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_control_async( - transport: str = "grpc_asyncio", request_type=control_service.GetControlRequest -): +@pytest.mark.parametrize( + "request_type", + [ + control_service.GetControlRequest(), + {}, + ], +) +async def test_get_control_async(request_type, transport: str = "grpc_asyncio"): client = ControlServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2515,7 +2540,7 @@ async def test_get_control_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_control), "__call__") as call: @@ -2548,11 +2573,6 @@ async def test_get_control_async( assert response.use_cases == [common.SearchUseCase.SEARCH_USE_CASE_SEARCH] -@pytest.mark.asyncio -async def test_get_control_async_from_dict(): - await test_get_control_async(request_type=dict) - - def test_get_control_field_headers(): client = ControlServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2695,8 +2715,8 @@ async def test_get_control_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - control_service.ListControlsRequest, - dict, + control_service.ListControlsRequest(), + {}, ], ) def test_list_controls(request_type, transport: str = "grpc"): @@ -2707,7 +2727,7 @@ def test_list_controls(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_controls), "__call__") as call: @@ -2753,11 +2773,12 @@ def test_list_controls_non_empty_request_with_auto_populated_field(): client.list_controls(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == control_service.ListControlsRequest( + request_msg = control_service.ListControlsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_controls_use_cached_wrapped_rpc(): @@ -2838,9 +2859,14 @@ async def test_list_controls_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_controls_async( - transport: str = "grpc_asyncio", request_type=control_service.ListControlsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + control_service.ListControlsRequest(), + {}, + ], +) +async def test_list_controls_async(request_type, transport: str = "grpc_asyncio"): client = ControlServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2848,7 +2874,7 @@ async def test_list_controls_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_controls), "__call__") as call: @@ -2871,11 +2897,6 @@ async def test_list_controls_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_controls_async_from_dict(): - await test_list_controls_async(request_type=dict) - - def test_list_controls_field_headers(): client = ControlServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4348,7 +4369,6 @@ def test_create_control_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.CreateControlRequest() - assert args[0] == request_msg @@ -4369,7 +4389,6 @@ def test_delete_control_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.DeleteControlRequest() - assert args[0] == request_msg @@ -4390,7 +4409,6 @@ def test_update_control_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.UpdateControlRequest() - assert args[0] == request_msg @@ -4411,7 +4429,6 @@ def test_get_control_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.GetControlRequest() - assert args[0] == request_msg @@ -4432,7 +4449,6 @@ def test_list_controls_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.ListControlsRequest() - assert args[0] == request_msg @@ -4477,7 +4493,6 @@ async def test_create_control_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.CreateControlRequest() - assert args[0] == request_msg @@ -4500,7 +4515,6 @@ async def test_delete_control_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.DeleteControlRequest() - assert args[0] == request_msg @@ -4531,7 +4545,6 @@ async def test_update_control_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.UpdateControlRequest() - assert args[0] == request_msg @@ -4562,7 +4575,6 @@ async def test_get_control_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.GetControlRequest() - assert args[0] == request_msg @@ -4589,7 +4601,6 @@ async def test_list_controls_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.ListControlsRequest() - assert args[0] == request_msg @@ -5696,7 +5707,6 @@ def test_create_control_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.CreateControlRequest() - assert args[0] == request_msg @@ -5716,7 +5726,6 @@ def test_delete_control_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.DeleteControlRequest() - assert args[0] == request_msg @@ -5736,7 +5745,6 @@ def test_update_control_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.UpdateControlRequest() - assert args[0] == request_msg @@ -5756,7 +5764,6 @@ def test_get_control_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.GetControlRequest() - assert args[0] == request_msg @@ -5776,7 +5783,6 @@ def test_list_controls_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.ListControlsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_conversational_search_service.py b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_conversational_search_service.py index 3065fc2a94ef..59cb3fee7fa8 100644 --- a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_conversational_search_service.py +++ b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_conversational_search_service.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 @@ -120,6 +121,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" @@ -1426,8 +1442,8 @@ def test_conversational_search_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - conversational_search_service.ConverseConversationRequest, - dict, + conversational_search_service.ConverseConversationRequest(), + {}, ], ) def test_converse_conversation(request_type, transport: str = "grpc"): @@ -1438,7 +1454,7 @@ def test_converse_conversation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1490,11 +1506,12 @@ def test_converse_conversation_non_empty_request_with_auto_populated_field(): client.converse_conversation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversational_search_service.ConverseConversationRequest( + request_msg = conversational_search_service.ConverseConversationRequest( name="name_value", serving_config="serving_config_value", filter="filter_value", ) + assert args[0] == request_msg def test_converse_conversation_use_cached_wrapped_rpc(): @@ -1580,9 +1597,15 @@ async def test_converse_conversation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + conversational_search_service.ConverseConversationRequest(), + {}, + ], +) async def test_converse_conversation_async( - transport: str = "grpc_asyncio", - request_type=conversational_search_service.ConverseConversationRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConversationalSearchServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1591,7 +1614,7 @@ async def test_converse_conversation_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( @@ -1618,11 +1641,6 @@ async def test_converse_conversation_async( assert response.related_questions == ["related_questions_value"] -@pytest.mark.asyncio -async def test_converse_conversation_async_from_dict(): - await test_converse_conversation_async(request_type=dict) - - def test_converse_conversation_field_headers(): client = ConversationalSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1787,8 +1805,8 @@ async def test_converse_conversation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversational_search_service.CreateConversationRequest, - dict, + conversational_search_service.CreateConversationRequest(), + {}, ], ) def test_create_conversation(request_type, transport: str = "grpc"): @@ -1799,7 +1817,7 @@ def test_create_conversation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1851,9 +1869,10 @@ def test_create_conversation_non_empty_request_with_auto_populated_field(): client.create_conversation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversational_search_service.CreateConversationRequest( + request_msg = conversational_search_service.CreateConversationRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_conversation_use_cached_wrapped_rpc(): @@ -1938,10 +1957,14 @@ async def test_create_conversation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_conversation_async( - transport: str = "grpc_asyncio", - request_type=conversational_search_service.CreateConversationRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + conversational_search_service.CreateConversationRequest(), + {}, + ], +) +async def test_create_conversation_async(request_type, transport: str = "grpc_asyncio"): client = ConversationalSearchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1949,7 +1972,7 @@ async def test_create_conversation_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( @@ -1978,11 +2001,6 @@ async def test_create_conversation_async( assert response.user_pseudo_id == "user_pseudo_id_value" -@pytest.mark.asyncio -async def test_create_conversation_async_from_dict(): - await test_create_conversation_async(request_type=dict) - - def test_create_conversation_field_headers(): client = ConversationalSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2147,8 +2165,8 @@ async def test_create_conversation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversational_search_service.DeleteConversationRequest, - dict, + conversational_search_service.DeleteConversationRequest(), + {}, ], ) def test_delete_conversation(request_type, transport: str = "grpc"): @@ -2159,7 +2177,7 @@ def test_delete_conversation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2204,9 +2222,10 @@ def test_delete_conversation_non_empty_request_with_auto_populated_field(): client.delete_conversation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversational_search_service.DeleteConversationRequest( + request_msg = conversational_search_service.DeleteConversationRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_conversation_use_cached_wrapped_rpc(): @@ -2291,10 +2310,14 @@ async def test_delete_conversation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_conversation_async( - transport: str = "grpc_asyncio", - request_type=conversational_search_service.DeleteConversationRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + conversational_search_service.DeleteConversationRequest(), + {}, + ], +) +async def test_delete_conversation_async(request_type, transport: str = "grpc_asyncio"): client = ConversationalSearchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2302,7 +2325,7 @@ async def test_delete_conversation_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( @@ -2322,11 +2345,6 @@ async def test_delete_conversation_async( assert response is None -@pytest.mark.asyncio -async def test_delete_conversation_async_from_dict(): - await test_delete_conversation_async(request_type=dict) - - def test_delete_conversation_field_headers(): client = ConversationalSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2477,8 +2495,8 @@ async def test_delete_conversation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversational_search_service.UpdateConversationRequest, - dict, + conversational_search_service.UpdateConversationRequest(), + {}, ], ) def test_update_conversation(request_type, transport: str = "grpc"): @@ -2489,7 +2507,7 @@ def test_update_conversation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2539,7 +2557,8 @@ def test_update_conversation_non_empty_request_with_auto_populated_field(): client.update_conversation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversational_search_service.UpdateConversationRequest() + request_msg = conversational_search_service.UpdateConversationRequest() + assert args[0] == request_msg def test_update_conversation_use_cached_wrapped_rpc(): @@ -2624,10 +2643,14 @@ async def test_update_conversation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_conversation_async( - transport: str = "grpc_asyncio", - request_type=conversational_search_service.UpdateConversationRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + conversational_search_service.UpdateConversationRequest(), + {}, + ], +) +async def test_update_conversation_async(request_type, transport: str = "grpc_asyncio"): client = ConversationalSearchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2635,7 +2658,7 @@ async def test_update_conversation_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( @@ -2664,11 +2687,6 @@ async def test_update_conversation_async( assert response.user_pseudo_id == "user_pseudo_id_value" -@pytest.mark.asyncio -async def test_update_conversation_async_from_dict(): - await test_update_conversation_async(request_type=dict) - - def test_update_conversation_field_headers(): client = ConversationalSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2833,8 +2851,8 @@ async def test_update_conversation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversational_search_service.GetConversationRequest, - dict, + conversational_search_service.GetConversationRequest(), + {}, ], ) def test_get_conversation(request_type, transport: str = "grpc"): @@ -2845,7 +2863,7 @@ def test_get_conversation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_conversation), "__call__") as call: @@ -2893,9 +2911,10 @@ def test_get_conversation_non_empty_request_with_auto_populated_field(): client.get_conversation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversational_search_service.GetConversationRequest( + request_msg = conversational_search_service.GetConversationRequest( name="name_value", ) + assert args[0] == request_msg def test_get_conversation_use_cached_wrapped_rpc(): @@ -2978,10 +2997,14 @@ async def test_get_conversation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_conversation_async( - transport: str = "grpc_asyncio", - request_type=conversational_search_service.GetConversationRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + conversational_search_service.GetConversationRequest(), + {}, + ], +) +async def test_get_conversation_async(request_type, transport: str = "grpc_asyncio"): client = ConversationalSearchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2989,7 +3012,7 @@ async def test_get_conversation_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_conversation), "__call__") as call: @@ -3016,11 +3039,6 @@ async def test_get_conversation_async( assert response.user_pseudo_id == "user_pseudo_id_value" -@pytest.mark.asyncio -async def test_get_conversation_async_from_dict(): - await test_get_conversation_async(request_type=dict) - - def test_get_conversation_field_headers(): client = ConversationalSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3167,8 +3185,8 @@ async def test_get_conversation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversational_search_service.ListConversationsRequest, - dict, + conversational_search_service.ListConversationsRequest(), + {}, ], ) def test_list_conversations(request_type, transport: str = "grpc"): @@ -3179,7 +3197,7 @@ def test_list_conversations(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3230,12 +3248,13 @@ def test_list_conversations_non_empty_request_with_auto_populated_field(): client.list_conversations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversational_search_service.ListConversationsRequest( + request_msg = conversational_search_service.ListConversationsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_conversations_use_cached_wrapped_rpc(): @@ -3320,10 +3339,14 @@ async def test_list_conversations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_conversations_async( - transport: str = "grpc_asyncio", - request_type=conversational_search_service.ListConversationsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + conversational_search_service.ListConversationsRequest(), + {}, + ], +) +async def test_list_conversations_async(request_type, transport: str = "grpc_asyncio"): client = ConversationalSearchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3331,7 +3354,7 @@ async def test_list_conversations_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( @@ -3356,11 +3379,6 @@ async def test_list_conversations_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_conversations_async_from_dict(): - await test_list_conversations_async(request_type=dict) - - def test_list_conversations_field_headers(): client = ConversationalSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3713,8 +3731,8 @@ async def test_list_conversations_async_pages(): @pytest.mark.parametrize( "request_type", [ - conversational_search_service.AnswerQueryRequest, - dict, + conversational_search_service.AnswerQueryRequest(), + {}, ], ) def test_answer_query(request_type, transport: str = "grpc"): @@ -3725,7 +3743,7 @@ def test_answer_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(type(client.transport.answer_query), "__call__") as call: @@ -3771,11 +3789,12 @@ def test_answer_query_non_empty_request_with_auto_populated_field(): client.answer_query(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversational_search_service.AnswerQueryRequest( + request_msg = conversational_search_service.AnswerQueryRequest( serving_config="serving_config_value", session="session_value", user_pseudo_id="user_pseudo_id_value", ) + assert args[0] == request_msg def test_answer_query_use_cached_wrapped_rpc(): @@ -3856,10 +3875,14 @@ async def test_answer_query_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_answer_query_async( - transport: str = "grpc_asyncio", - request_type=conversational_search_service.AnswerQueryRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + conversational_search_service.AnswerQueryRequest(), + {}, + ], +) +async def test_answer_query_async(request_type, transport: str = "grpc_asyncio"): client = ConversationalSearchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3867,7 +3890,7 @@ async def test_answer_query_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.answer_query), "__call__") as call: @@ -3890,11 +3913,6 @@ async def test_answer_query_async( assert response.answer_query_token == "answer_query_token_value" -@pytest.mark.asyncio -async def test_answer_query_async_from_dict(): - await test_answer_query_async(request_type=dict) - - def test_answer_query_field_headers(): client = ConversationalSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3959,8 +3977,8 @@ async def test_answer_query_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - conversational_search_service.GetAnswerRequest, - dict, + conversational_search_service.GetAnswerRequest(), + {}, ], ) def test_get_answer(request_type, transport: str = "grpc"): @@ -3971,7 +3989,7 @@ def test_get_answer(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_answer), "__call__") as call: @@ -4027,9 +4045,10 @@ def test_get_answer_non_empty_request_with_auto_populated_field(): client.get_answer(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversational_search_service.GetAnswerRequest( + request_msg = conversational_search_service.GetAnswerRequest( name="name_value", ) + assert args[0] == request_msg def test_get_answer_use_cached_wrapped_rpc(): @@ -4108,10 +4127,14 @@ async def test_get_answer_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_answer_async( - transport: str = "grpc_asyncio", - request_type=conversational_search_service.GetAnswerRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + conversational_search_service.GetAnswerRequest(), + {}, + ], +) +async def test_get_answer_async(request_type, transport: str = "grpc_asyncio"): client = ConversationalSearchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4119,7 +4142,7 @@ async def test_get_answer_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_answer), "__call__") as call: @@ -4154,11 +4177,6 @@ async def test_get_answer_async( ] -@pytest.mark.asyncio -async def test_get_answer_async_from_dict(): - await test_get_answer_async(request_type=dict) - - def test_get_answer_field_headers(): client = ConversationalSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4301,8 +4319,8 @@ async def test_get_answer_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversational_search_service.CreateSessionRequest, - dict, + conversational_search_service.CreateSessionRequest(), + {}, ], ) def test_create_session(request_type, transport: str = "grpc"): @@ -4313,7 +4331,7 @@ def test_create_session(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_session), "__call__") as call: @@ -4365,9 +4383,10 @@ def test_create_session_non_empty_request_with_auto_populated_field(): client.create_session(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversational_search_service.CreateSessionRequest( + request_msg = conversational_search_service.CreateSessionRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_session_use_cached_wrapped_rpc(): @@ -4448,10 +4467,14 @@ async def test_create_session_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_session_async( - transport: str = "grpc_asyncio", - request_type=conversational_search_service.CreateSessionRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + conversational_search_service.CreateSessionRequest(), + {}, + ], +) +async def test_create_session_async(request_type, transport: str = "grpc_asyncio"): client = ConversationalSearchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4459,7 +4482,7 @@ async def test_create_session_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_session), "__call__") as call: @@ -4490,11 +4513,6 @@ async def test_create_session_async( assert response.is_pinned is True -@pytest.mark.asyncio -async def test_create_session_async_from_dict(): - await test_create_session_async(request_type=dict) - - def test_create_session_field_headers(): client = ConversationalSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4647,8 +4665,8 @@ async def test_create_session_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversational_search_service.DeleteSessionRequest, - dict, + conversational_search_service.DeleteSessionRequest(), + {}, ], ) def test_delete_session(request_type, transport: str = "grpc"): @@ -4659,7 +4677,7 @@ def test_delete_session(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_session), "__call__") as call: @@ -4700,9 +4718,10 @@ def test_delete_session_non_empty_request_with_auto_populated_field(): client.delete_session(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversational_search_service.DeleteSessionRequest( + request_msg = conversational_search_service.DeleteSessionRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_session_use_cached_wrapped_rpc(): @@ -4783,10 +4802,14 @@ async def test_delete_session_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_session_async( - transport: str = "grpc_asyncio", - request_type=conversational_search_service.DeleteSessionRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + conversational_search_service.DeleteSessionRequest(), + {}, + ], +) +async def test_delete_session_async(request_type, transport: str = "grpc_asyncio"): client = ConversationalSearchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4794,7 +4817,7 @@ async def test_delete_session_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_session), "__call__") as call: @@ -4812,11 +4835,6 @@ async def test_delete_session_async( assert response is None -@pytest.mark.asyncio -async def test_delete_session_async_from_dict(): - await test_delete_session_async(request_type=dict) - - def test_delete_session_field_headers(): client = ConversationalSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4959,8 +4977,8 @@ async def test_delete_session_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversational_search_service.UpdateSessionRequest, - dict, + conversational_search_service.UpdateSessionRequest(), + {}, ], ) def test_update_session(request_type, transport: str = "grpc"): @@ -4971,7 +4989,7 @@ def test_update_session(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_session), "__call__") as call: @@ -5021,7 +5039,8 @@ def test_update_session_non_empty_request_with_auto_populated_field(): client.update_session(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversational_search_service.UpdateSessionRequest() + request_msg = conversational_search_service.UpdateSessionRequest() + assert args[0] == request_msg def test_update_session_use_cached_wrapped_rpc(): @@ -5102,10 +5121,14 @@ async def test_update_session_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_session_async( - transport: str = "grpc_asyncio", - request_type=conversational_search_service.UpdateSessionRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + conversational_search_service.UpdateSessionRequest(), + {}, + ], +) +async def test_update_session_async(request_type, transport: str = "grpc_asyncio"): client = ConversationalSearchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5113,7 +5136,7 @@ async def test_update_session_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_session), "__call__") as call: @@ -5144,11 +5167,6 @@ async def test_update_session_async( assert response.is_pinned is True -@pytest.mark.asyncio -async def test_update_session_async_from_dict(): - await test_update_session_async(request_type=dict) - - def test_update_session_field_headers(): client = ConversationalSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5301,8 +5319,8 @@ async def test_update_session_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversational_search_service.GetSessionRequest, - dict, + conversational_search_service.GetSessionRequest(), + {}, ], ) def test_get_session(request_type, transport: str = "grpc"): @@ -5313,7 +5331,7 @@ def test_get_session(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_session), "__call__") as call: @@ -5365,9 +5383,10 @@ def test_get_session_non_empty_request_with_auto_populated_field(): client.get_session(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversational_search_service.GetSessionRequest( + request_msg = conversational_search_service.GetSessionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_session_use_cached_wrapped_rpc(): @@ -5448,10 +5467,14 @@ async def test_get_session_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_session_async( - transport: str = "grpc_asyncio", - request_type=conversational_search_service.GetSessionRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + conversational_search_service.GetSessionRequest(), + {}, + ], +) +async def test_get_session_async(request_type, transport: str = "grpc_asyncio"): client = ConversationalSearchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5459,7 +5482,7 @@ async def test_get_session_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_session), "__call__") as call: @@ -5490,11 +5513,6 @@ async def test_get_session_async( assert response.is_pinned is True -@pytest.mark.asyncio -async def test_get_session_async_from_dict(): - await test_get_session_async(request_type=dict) - - def test_get_session_field_headers(): client = ConversationalSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5637,8 +5655,8 @@ async def test_get_session_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversational_search_service.ListSessionsRequest, - dict, + conversational_search_service.ListSessionsRequest(), + {}, ], ) def test_list_sessions(request_type, transport: str = "grpc"): @@ -5649,7 +5667,7 @@ def test_list_sessions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_sessions), "__call__") as call: @@ -5696,12 +5714,13 @@ def test_list_sessions_non_empty_request_with_auto_populated_field(): client.list_sessions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversational_search_service.ListSessionsRequest( + request_msg = conversational_search_service.ListSessionsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_sessions_use_cached_wrapped_rpc(): @@ -5782,10 +5801,14 @@ async def test_list_sessions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_sessions_async( - transport: str = "grpc_asyncio", - request_type=conversational_search_service.ListSessionsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + conversational_search_service.ListSessionsRequest(), + {}, + ], +) +async def test_list_sessions_async(request_type, transport: str = "grpc_asyncio"): client = ConversationalSearchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5793,7 +5816,7 @@ async def test_list_sessions_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_sessions), "__call__") as call: @@ -5816,11 +5839,6 @@ async def test_list_sessions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_sessions_async_from_dict(): - await test_list_sessions_async(request_type=dict) - - def test_list_sessions_field_headers(): client = ConversationalSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8806,7 +8824,6 @@ def test_converse_conversation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.ConverseConversationRequest() - assert args[0] == request_msg @@ -8829,7 +8846,6 @@ def test_create_conversation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.CreateConversationRequest() - assert args[0] == request_msg @@ -8852,7 +8868,6 @@ def test_delete_conversation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.DeleteConversationRequest() - assert args[0] == request_msg @@ -8875,7 +8890,6 @@ def test_update_conversation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.UpdateConversationRequest() - assert args[0] == request_msg @@ -8896,7 +8910,6 @@ def test_get_conversation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.GetConversationRequest() - assert args[0] == request_msg @@ -8919,7 +8932,6 @@ def test_list_conversations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.ListConversationsRequest() - assert args[0] == request_msg @@ -8940,7 +8952,6 @@ def test_answer_query_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.AnswerQueryRequest() - assert args[0] == request_msg @@ -8961,7 +8972,6 @@ def test_get_answer_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.GetAnswerRequest() - assert args[0] == request_msg @@ -8982,7 +8992,6 @@ def test_create_session_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.CreateSessionRequest() - assert args[0] == request_msg @@ -9003,7 +9012,6 @@ def test_delete_session_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.DeleteSessionRequest() - assert args[0] == request_msg @@ -9024,7 +9032,6 @@ def test_update_session_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.UpdateSessionRequest() - assert args[0] == request_msg @@ -9045,7 +9052,6 @@ def test_get_session_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.GetSessionRequest() - assert args[0] == request_msg @@ -9066,7 +9072,6 @@ def test_list_sessions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.ListSessionsRequest() - assert args[0] == request_msg @@ -9109,7 +9114,6 @@ async def test_converse_conversation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.ConverseConversationRequest() - assert args[0] == request_msg @@ -9140,7 +9144,6 @@ async def test_create_conversation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.CreateConversationRequest() - assert args[0] == request_msg @@ -9165,7 +9168,6 @@ async def test_delete_conversation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.DeleteConversationRequest() - assert args[0] == request_msg @@ -9196,7 +9198,6 @@ async def test_update_conversation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.UpdateConversationRequest() - assert args[0] == request_msg @@ -9225,7 +9226,6 @@ async def test_get_conversation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.GetConversationRequest() - assert args[0] == request_msg @@ -9254,7 +9254,6 @@ async def test_list_conversations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.ListConversationsRequest() - assert args[0] == request_msg @@ -9281,7 +9280,6 @@ async def test_answer_query_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.AnswerQueryRequest() - assert args[0] == request_msg @@ -9314,7 +9312,6 @@ async def test_get_answer_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.GetAnswerRequest() - assert args[0] == request_msg @@ -9345,7 +9342,6 @@ async def test_create_session_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.CreateSessionRequest() - assert args[0] == request_msg @@ -9368,7 +9364,6 @@ async def test_delete_session_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.DeleteSessionRequest() - assert args[0] == request_msg @@ -9399,7 +9394,6 @@ async def test_update_session_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.UpdateSessionRequest() - assert args[0] == request_msg @@ -9430,7 +9424,6 @@ async def test_get_session_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.GetSessionRequest() - assert args[0] == request_msg @@ -9457,7 +9450,6 @@ async def test_list_sessions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.ListSessionsRequest() - assert args[0] == request_msg @@ -12117,7 +12109,6 @@ def test_converse_conversation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.ConverseConversationRequest() - assert args[0] == request_msg @@ -12139,7 +12130,6 @@ def test_create_conversation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.CreateConversationRequest() - assert args[0] == request_msg @@ -12161,7 +12151,6 @@ def test_delete_conversation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.DeleteConversationRequest() - assert args[0] == request_msg @@ -12183,7 +12172,6 @@ def test_update_conversation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.UpdateConversationRequest() - assert args[0] == request_msg @@ -12203,7 +12191,6 @@ def test_get_conversation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.GetConversationRequest() - assert args[0] == request_msg @@ -12225,7 +12212,6 @@ def test_list_conversations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.ListConversationsRequest() - assert args[0] == request_msg @@ -12245,7 +12231,6 @@ def test_answer_query_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.AnswerQueryRequest() - assert args[0] == request_msg @@ -12265,7 +12250,6 @@ def test_get_answer_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.GetAnswerRequest() - assert args[0] == request_msg @@ -12285,7 +12269,6 @@ def test_create_session_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.CreateSessionRequest() - assert args[0] == request_msg @@ -12305,7 +12288,6 @@ def test_delete_session_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.DeleteSessionRequest() - assert args[0] == request_msg @@ -12325,7 +12307,6 @@ def test_update_session_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.UpdateSessionRequest() - assert args[0] == request_msg @@ -12345,7 +12326,6 @@ def test_get_session_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.GetSessionRequest() - assert args[0] == request_msg @@ -12365,7 +12345,6 @@ def test_list_sessions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.ListSessionsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_data_store_service.py b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_data_store_service.py index 3b20b3fab93e..6505df52af3b 100644 --- a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_data_store_service.py +++ b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_data_store_service.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 @@ -124,6 +125,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" @@ -1357,8 +1373,8 @@ def test_data_store_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - data_store_service.CreateDataStoreRequest, - dict, + data_store_service.CreateDataStoreRequest(), + {}, ], ) def test_create_data_store(request_type, transport: str = "grpc"): @@ -1369,7 +1385,7 @@ def test_create_data_store(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1415,10 +1431,11 @@ def test_create_data_store_non_empty_request_with_auto_populated_field(): client.create_data_store(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_store_service.CreateDataStoreRequest( + request_msg = data_store_service.CreateDataStoreRequest( parent="parent_value", data_store_id="data_store_id_value", ) + assert args[0] == request_msg def test_create_data_store_use_cached_wrapped_rpc(): @@ -1511,10 +1528,14 @@ async def test_create_data_store_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_data_store_async( - transport: str = "grpc_asyncio", - request_type=data_store_service.CreateDataStoreRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + data_store_service.CreateDataStoreRequest(), + {}, + ], +) +async def test_create_data_store_async(request_type, transport: str = "grpc_asyncio"): client = DataStoreServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1522,7 +1543,7 @@ async def test_create_data_store_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( @@ -1544,11 +1565,6 @@ async def test_create_data_store_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_data_store_async_from_dict(): - await test_create_data_store_async(request_type=dict) - - def test_create_data_store_field_headers(): client = DataStoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1723,8 +1739,8 @@ async def test_create_data_store_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_store_service.GetDataStoreRequest, - dict, + data_store_service.GetDataStoreRequest(), + {}, ], ) def test_get_data_store(request_type, transport: str = "grpc"): @@ -1735,7 +1751,7 @@ def test_get_data_store(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_data_store), "__call__") as call: @@ -1789,9 +1805,10 @@ def test_get_data_store_non_empty_request_with_auto_populated_field(): client.get_data_store(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_store_service.GetDataStoreRequest( + request_msg = data_store_service.GetDataStoreRequest( name="name_value", ) + assert args[0] == request_msg def test_get_data_store_use_cached_wrapped_rpc(): @@ -1872,9 +1889,14 @@ async def test_get_data_store_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_data_store_async( - transport: str = "grpc_asyncio", request_type=data_store_service.GetDataStoreRequest -): +@pytest.mark.parametrize( + "request_type", + [ + data_store_service.GetDataStoreRequest(), + {}, + ], +) +async def test_get_data_store_async(request_type, transport: str = "grpc_asyncio"): client = DataStoreServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1882,7 +1904,7 @@ async def test_get_data_store_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_data_store), "__call__") as call: @@ -1915,11 +1937,6 @@ async def test_get_data_store_async( assert response.content_config == data_store.DataStore.ContentConfig.NO_CONTENT -@pytest.mark.asyncio -async def test_get_data_store_async_from_dict(): - await test_get_data_store_async(request_type=dict) - - def test_get_data_store_field_headers(): client = DataStoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2066,8 +2083,8 @@ async def test_get_data_store_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_store_service.ListDataStoresRequest, - dict, + data_store_service.ListDataStoresRequest(), + {}, ], ) def test_list_data_stores(request_type, transport: str = "grpc"): @@ -2078,7 +2095,7 @@ def test_list_data_stores(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_data_stores), "__call__") as call: @@ -2124,11 +2141,12 @@ def test_list_data_stores_non_empty_request_with_auto_populated_field(): client.list_data_stores(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_store_service.ListDataStoresRequest( + request_msg = data_store_service.ListDataStoresRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_data_stores_use_cached_wrapped_rpc(): @@ -2211,10 +2229,14 @@ async def test_list_data_stores_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_data_stores_async( - transport: str = "grpc_asyncio", - request_type=data_store_service.ListDataStoresRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + data_store_service.ListDataStoresRequest(), + {}, + ], +) +async def test_list_data_stores_async(request_type, transport: str = "grpc_asyncio"): client = DataStoreServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2222,7 +2244,7 @@ async def test_list_data_stores_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_data_stores), "__call__") as call: @@ -2245,11 +2267,6 @@ async def test_list_data_stores_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_data_stores_async_from_dict(): - await test_list_data_stores_async(request_type=dict) - - def test_list_data_stores_field_headers(): client = DataStoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2586,8 +2603,8 @@ async def test_list_data_stores_async_pages(): @pytest.mark.parametrize( "request_type", [ - data_store_service.DeleteDataStoreRequest, - dict, + data_store_service.DeleteDataStoreRequest(), + {}, ], ) def test_delete_data_store(request_type, transport: str = "grpc"): @@ -2598,7 +2615,7 @@ def test_delete_data_store(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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 +2660,10 @@ def test_delete_data_store_non_empty_request_with_auto_populated_field(): client.delete_data_store(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_store_service.DeleteDataStoreRequest( + request_msg = data_store_service.DeleteDataStoreRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_data_store_use_cached_wrapped_rpc(): @@ -2738,10 +2756,14 @@ async def test_delete_data_store_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_data_store_async( - transport: str = "grpc_asyncio", - request_type=data_store_service.DeleteDataStoreRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + data_store_service.DeleteDataStoreRequest(), + {}, + ], +) +async def test_delete_data_store_async(request_type, transport: str = "grpc_asyncio"): client = DataStoreServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2749,7 +2771,7 @@ async def test_delete_data_store_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( @@ -2771,11 +2793,6 @@ async def test_delete_data_store_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_data_store_async_from_dict(): - await test_delete_data_store_async(request_type=dict) - - def test_delete_data_store_field_headers(): client = DataStoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2930,8 +2947,8 @@ async def test_delete_data_store_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_store_service.UpdateDataStoreRequest, - dict, + data_store_service.UpdateDataStoreRequest(), + {}, ], ) def test_update_data_store(request_type, transport: str = "grpc"): @@ -2942,7 +2959,7 @@ def test_update_data_store(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2998,7 +3015,8 @@ def test_update_data_store_non_empty_request_with_auto_populated_field(): client.update_data_store(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_store_service.UpdateDataStoreRequest() + request_msg = data_store_service.UpdateDataStoreRequest() + assert args[0] == request_msg def test_update_data_store_use_cached_wrapped_rpc(): @@ -3081,10 +3099,14 @@ async def test_update_data_store_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_data_store_async( - transport: str = "grpc_asyncio", - request_type=data_store_service.UpdateDataStoreRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + data_store_service.UpdateDataStoreRequest(), + {}, + ], +) +async def test_update_data_store_async(request_type, transport: str = "grpc_asyncio"): client = DataStoreServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3092,7 +3114,7 @@ async def test_update_data_store_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( @@ -3127,11 +3149,6 @@ async def test_update_data_store_async( assert response.content_config == gcd_data_store.DataStore.ContentConfig.NO_CONTENT -@pytest.mark.asyncio -async def test_update_data_store_async_from_dict(): - await test_update_data_store_async(request_type=dict) - - def test_update_data_store_field_headers(): client = DataStoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4443,7 +4460,6 @@ def test_create_data_store_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_store_service.CreateDataStoreRequest() - assert args[0] == request_msg @@ -4464,7 +4480,6 @@ def test_get_data_store_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_store_service.GetDataStoreRequest() - assert args[0] == request_msg @@ -4485,7 +4500,6 @@ def test_list_data_stores_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_store_service.ListDataStoresRequest() - assert args[0] == request_msg @@ -4508,7 +4522,6 @@ def test_delete_data_store_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_store_service.DeleteDataStoreRequest() - assert args[0] == request_msg @@ -4531,7 +4544,6 @@ def test_update_data_store_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_store_service.UpdateDataStoreRequest() - assert args[0] == request_msg @@ -4572,7 +4584,6 @@ async def test_create_data_store_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_store_service.CreateDataStoreRequest() - assert args[0] == request_msg @@ -4604,7 +4615,6 @@ async def test_get_data_store_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_store_service.GetDataStoreRequest() - assert args[0] == request_msg @@ -4631,7 +4641,6 @@ async def test_list_data_stores_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_store_service.ListDataStoresRequest() - assert args[0] == request_msg @@ -4658,7 +4667,6 @@ async def test_delete_data_store_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_store_service.DeleteDataStoreRequest() - assert args[0] == request_msg @@ -4692,7 +4700,6 @@ async def test_update_data_store_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_store_service.UpdateDataStoreRequest() - assert args[0] == request_msg @@ -5854,7 +5861,6 @@ def test_create_data_store_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_store_service.CreateDataStoreRequest() - assert args[0] == request_msg @@ -5874,7 +5880,6 @@ def test_get_data_store_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_store_service.GetDataStoreRequest() - assert args[0] == request_msg @@ -5894,7 +5899,6 @@ def test_list_data_stores_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_store_service.ListDataStoresRequest() - assert args[0] == request_msg @@ -5916,7 +5920,6 @@ def test_delete_data_store_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_store_service.DeleteDataStoreRequest() - assert args[0] == request_msg @@ -5938,7 +5941,6 @@ def test_update_data_store_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_store_service.UpdateDataStoreRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_document_service.py b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_document_service.py index 60b4982d3842..229e8d258569 100644 --- a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_document_service.py +++ b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_document_service.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 @@ -125,6 +126,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" @@ -1352,8 +1368,8 @@ def test_document_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - document_service.GetDocumentRequest, - dict, + document_service.GetDocumentRequest(), + {}, ], ) def test_get_document(request_type, transport: str = "grpc"): @@ -1364,7 +1380,7 @@ def test_get_document(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_document), "__call__") as call: @@ -1415,9 +1431,10 @@ def test_get_document_non_empty_request_with_auto_populated_field(): client.get_document(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_service.GetDocumentRequest( + request_msg = document_service.GetDocumentRequest( name="name_value", ) + assert args[0] == request_msg def test_get_document_use_cached_wrapped_rpc(): @@ -1498,9 +1515,14 @@ async def test_get_document_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_document_async( - transport: str = "grpc_asyncio", request_type=document_service.GetDocumentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + document_service.GetDocumentRequest(), + {}, + ], +) +async def test_get_document_async(request_type, transport: str = "grpc_asyncio"): client = DocumentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1508,7 +1530,7 @@ async def test_get_document_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_document), "__call__") as call: @@ -1537,11 +1559,6 @@ async def test_get_document_async( assert response.parent_document_id == "parent_document_id_value" -@pytest.mark.asyncio -async def test_get_document_async_from_dict(): - await test_get_document_async(request_type=dict) - - def test_get_document_field_headers(): client = DocumentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1684,8 +1701,8 @@ async def test_get_document_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - document_service.ListDocumentsRequest, - dict, + document_service.ListDocumentsRequest(), + {}, ], ) def test_list_documents(request_type, transport: str = "grpc"): @@ -1696,7 +1713,7 @@ def test_list_documents(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_documents), "__call__") as call: @@ -1741,10 +1758,11 @@ def test_list_documents_non_empty_request_with_auto_populated_field(): client.list_documents(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_service.ListDocumentsRequest( + request_msg = document_service.ListDocumentsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_documents_use_cached_wrapped_rpc(): @@ -1825,9 +1843,14 @@ async def test_list_documents_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_documents_async( - transport: str = "grpc_asyncio", request_type=document_service.ListDocumentsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + document_service.ListDocumentsRequest(), + {}, + ], +) +async def test_list_documents_async(request_type, transport: str = "grpc_asyncio"): client = DocumentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1835,7 +1858,7 @@ async def test_list_documents_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_documents), "__call__") as call: @@ -1858,11 +1881,6 @@ async def test_list_documents_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_documents_async_from_dict(): - await test_list_documents_async(request_type=dict) - - def test_list_documents_field_headers(): client = DocumentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2199,8 +2217,8 @@ async def test_list_documents_async_pages(): @pytest.mark.parametrize( "request_type", [ - document_service.CreateDocumentRequest, - dict, + document_service.CreateDocumentRequest(), + {}, ], ) def test_create_document(request_type, transport: str = "grpc"): @@ -2211,7 +2229,7 @@ def test_create_document(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_document), "__call__") as call: @@ -2263,10 +2281,11 @@ def test_create_document_non_empty_request_with_auto_populated_field(): client.create_document(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_service.CreateDocumentRequest( + request_msg = document_service.CreateDocumentRequest( parent="parent_value", document_id="document_id_value", ) + assert args[0] == request_msg def test_create_document_use_cached_wrapped_rpc(): @@ -2347,9 +2366,14 @@ async def test_create_document_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_document_async( - transport: str = "grpc_asyncio", request_type=document_service.CreateDocumentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + document_service.CreateDocumentRequest(), + {}, + ], +) +async def test_create_document_async(request_type, transport: str = "grpc_asyncio"): client = DocumentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2357,7 +2381,7 @@ async def test_create_document_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_document), "__call__") as call: @@ -2386,11 +2410,6 @@ async def test_create_document_async( assert response.parent_document_id == "parent_document_id_value" -@pytest.mark.asyncio -async def test_create_document_async_from_dict(): - await test_create_document_async(request_type=dict) - - def test_create_document_field_headers(): client = DocumentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2605,8 +2624,8 @@ async def test_create_document_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - document_service.UpdateDocumentRequest, - dict, + document_service.UpdateDocumentRequest(), + {}, ], ) def test_update_document(request_type, transport: str = "grpc"): @@ -2617,7 +2636,7 @@ def test_update_document(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_document), "__call__") as call: @@ -2666,7 +2685,8 @@ def test_update_document_non_empty_request_with_auto_populated_field(): client.update_document(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_service.UpdateDocumentRequest() + request_msg = document_service.UpdateDocumentRequest() + assert args[0] == request_msg def test_update_document_use_cached_wrapped_rpc(): @@ -2747,9 +2767,14 @@ async def test_update_document_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_document_async( - transport: str = "grpc_asyncio", request_type=document_service.UpdateDocumentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + document_service.UpdateDocumentRequest(), + {}, + ], +) +async def test_update_document_async(request_type, transport: str = "grpc_asyncio"): client = DocumentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2757,7 +2782,7 @@ async def test_update_document_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_document), "__call__") as call: @@ -2786,11 +2811,6 @@ async def test_update_document_async( assert response.parent_document_id == "parent_document_id_value" -@pytest.mark.asyncio -async def test_update_document_async_from_dict(): - await test_update_document_async(request_type=dict) - - def test_update_document_field_headers(): client = DocumentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2995,8 +3015,8 @@ async def test_update_document_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - document_service.DeleteDocumentRequest, - dict, + document_service.DeleteDocumentRequest(), + {}, ], ) def test_delete_document(request_type, transport: str = "grpc"): @@ -3007,7 +3027,7 @@ def test_delete_document(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_document), "__call__") as call: @@ -3048,9 +3068,10 @@ def test_delete_document_non_empty_request_with_auto_populated_field(): client.delete_document(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_service.DeleteDocumentRequest( + request_msg = document_service.DeleteDocumentRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_document_use_cached_wrapped_rpc(): @@ -3131,9 +3152,14 @@ async def test_delete_document_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_document_async( - transport: str = "grpc_asyncio", request_type=document_service.DeleteDocumentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + document_service.DeleteDocumentRequest(), + {}, + ], +) +async def test_delete_document_async(request_type, transport: str = "grpc_asyncio"): client = DocumentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3141,7 +3167,7 @@ async def test_delete_document_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_document), "__call__") as call: @@ -3159,11 +3185,6 @@ async def test_delete_document_async( assert response is None -@pytest.mark.asyncio -async def test_delete_document_async_from_dict(): - await test_delete_document_async(request_type=dict) - - def test_delete_document_field_headers(): client = DocumentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3306,8 +3327,8 @@ async def test_delete_document_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - import_config.ImportDocumentsRequest, - dict, + import_config.ImportDocumentsRequest(), + {}, ], ) def test_import_documents(request_type, transport: str = "grpc"): @@ -3318,7 +3339,7 @@ def test_import_documents(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.import_documents), "__call__") as call: @@ -3360,10 +3381,11 @@ def test_import_documents_non_empty_request_with_auto_populated_field(): client.import_documents(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == import_config.ImportDocumentsRequest( + request_msg = import_config.ImportDocumentsRequest( parent="parent_value", id_field="id_field_value", ) + assert args[0] == request_msg def test_import_documents_use_cached_wrapped_rpc(): @@ -3456,9 +3478,14 @@ async def test_import_documents_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_import_documents_async( - transport: str = "grpc_asyncio", request_type=import_config.ImportDocumentsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + import_config.ImportDocumentsRequest(), + {}, + ], +) +async def test_import_documents_async(request_type, transport: str = "grpc_asyncio"): client = DocumentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3466,7 +3493,7 @@ async def test_import_documents_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.import_documents), "__call__") as call: @@ -3486,11 +3513,6 @@ async def test_import_documents_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_import_documents_async_from_dict(): - await test_import_documents_async(request_type=dict) - - def test_import_documents_field_headers(): client = DocumentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3555,8 +3577,8 @@ async def test_import_documents_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - purge_config.PurgeDocumentsRequest, - dict, + purge_config.PurgeDocumentsRequest(), + {}, ], ) def test_purge_documents(request_type, transport: str = "grpc"): @@ -3567,7 +3589,7 @@ def test_purge_documents(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.purge_documents), "__call__") as call: @@ -3609,10 +3631,11 @@ def test_purge_documents_non_empty_request_with_auto_populated_field(): client.purge_documents(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == purge_config.PurgeDocumentsRequest( + request_msg = purge_config.PurgeDocumentsRequest( parent="parent_value", filter="filter_value", ) + assert args[0] == request_msg def test_purge_documents_use_cached_wrapped_rpc(): @@ -3703,9 +3726,14 @@ async def test_purge_documents_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_purge_documents_async( - transport: str = "grpc_asyncio", request_type=purge_config.PurgeDocumentsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + purge_config.PurgeDocumentsRequest(), + {}, + ], +) +async def test_purge_documents_async(request_type, transport: str = "grpc_asyncio"): client = DocumentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3713,7 +3741,7 @@ async def test_purge_documents_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.purge_documents), "__call__") as call: @@ -3733,11 +3761,6 @@ async def test_purge_documents_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_purge_documents_async_from_dict(): - await test_purge_documents_async(request_type=dict) - - def test_purge_documents_field_headers(): client = DocumentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3802,8 +3825,8 @@ async def test_purge_documents_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - document_service.BatchGetDocumentsMetadataRequest, - dict, + document_service.BatchGetDocumentsMetadataRequest(), + {}, ], ) def test_batch_get_documents_metadata(request_type, transport: str = "grpc"): @@ -3814,7 +3837,7 @@ def test_batch_get_documents_metadata(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3859,9 +3882,10 @@ def test_batch_get_documents_metadata_non_empty_request_with_auto_populated_fiel client.batch_get_documents_metadata(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_service.BatchGetDocumentsMetadataRequest( + request_msg = document_service.BatchGetDocumentsMetadataRequest( parent="parent_value", ) + assert args[0] == request_msg def test_batch_get_documents_metadata_use_cached_wrapped_rpc(): @@ -3947,9 +3971,15 @@ async def test_batch_get_documents_metadata_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + document_service.BatchGetDocumentsMetadataRequest(), + {}, + ], +) async def test_batch_get_documents_metadata_async( - transport: str = "grpc_asyncio", - request_type=document_service.BatchGetDocumentsMetadataRequest, + request_type, transport: str = "grpc_asyncio" ): client = DocumentServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3958,7 +3988,7 @@ async def test_batch_get_documents_metadata_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( @@ -3980,11 +4010,6 @@ async def test_batch_get_documents_metadata_async( assert isinstance(response, document_service.BatchGetDocumentsMetadataResponse) -@pytest.mark.asyncio -async def test_batch_get_documents_metadata_async_from_dict(): - await test_batch_get_documents_metadata_async(request_type=dict) - - def test_batch_get_documents_metadata_field_headers(): client = DocumentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5767,7 +5792,6 @@ def test_get_document_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.GetDocumentRequest() - assert args[0] == request_msg @@ -5788,7 +5812,6 @@ def test_list_documents_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.ListDocumentsRequest() - assert args[0] == request_msg @@ -5809,7 +5832,6 @@ def test_create_document_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.CreateDocumentRequest() - assert args[0] == request_msg @@ -5830,7 +5852,6 @@ def test_update_document_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.UpdateDocumentRequest() - assert args[0] == request_msg @@ -5851,7 +5872,6 @@ def test_delete_document_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.DeleteDocumentRequest() - assert args[0] == request_msg @@ -5872,7 +5892,6 @@ def test_import_documents_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_config.ImportDocumentsRequest() - assert args[0] == request_msg @@ -5893,7 +5912,6 @@ def test_purge_documents_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = purge_config.PurgeDocumentsRequest() - assert args[0] == request_msg @@ -5916,7 +5934,6 @@ def test_batch_get_documents_metadata_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.BatchGetDocumentsMetadataRequest() - assert args[0] == request_msg @@ -5960,7 +5977,6 @@ async def test_get_document_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.GetDocumentRequest() - assert args[0] == request_msg @@ -5987,7 +6003,6 @@ async def test_list_documents_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.ListDocumentsRequest() - assert args[0] == request_msg @@ -6017,7 +6032,6 @@ async def test_create_document_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.CreateDocumentRequest() - assert args[0] == request_msg @@ -6047,7 +6061,6 @@ async def test_update_document_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.UpdateDocumentRequest() - assert args[0] == request_msg @@ -6070,7 +6083,6 @@ async def test_delete_document_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.DeleteDocumentRequest() - assert args[0] == request_msg @@ -6095,7 +6107,6 @@ async def test_import_documents_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_config.ImportDocumentsRequest() - assert args[0] == request_msg @@ -6120,7 +6131,6 @@ async def test_purge_documents_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = purge_config.PurgeDocumentsRequest() - assert args[0] == request_msg @@ -6147,7 +6157,6 @@ async def test_batch_get_documents_metadata_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.BatchGetDocumentsMetadataRequest() - assert args[0] == request_msg @@ -7663,7 +7672,6 @@ def test_get_document_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.GetDocumentRequest() - assert args[0] == request_msg @@ -7683,7 +7691,6 @@ def test_list_documents_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.ListDocumentsRequest() - assert args[0] == request_msg @@ -7703,7 +7710,6 @@ def test_create_document_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.CreateDocumentRequest() - assert args[0] == request_msg @@ -7723,7 +7729,6 @@ def test_update_document_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.UpdateDocumentRequest() - assert args[0] == request_msg @@ -7743,7 +7748,6 @@ def test_delete_document_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.DeleteDocumentRequest() - assert args[0] == request_msg @@ -7763,7 +7767,6 @@ def test_import_documents_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_config.ImportDocumentsRequest() - assert args[0] == request_msg @@ -7783,7 +7786,6 @@ def test_purge_documents_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = purge_config.PurgeDocumentsRequest() - assert args[0] == request_msg @@ -7805,7 +7807,6 @@ def test_batch_get_documents_metadata_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.BatchGetDocumentsMetadataRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_engine_service.py b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_engine_service.py index a7a00a20aa30..9031d17e7dba 100644 --- a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_engine_service.py +++ b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_engine_service.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 @@ -117,6 +118,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" @@ -1316,8 +1332,8 @@ def test_engine_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - engine_service.CreateEngineRequest, - dict, + engine_service.CreateEngineRequest(), + {}, ], ) def test_create_engine(request_type, transport: str = "grpc"): @@ -1328,7 +1344,7 @@ def test_create_engine(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_engine), "__call__") as call: @@ -1370,10 +1386,11 @@ def test_create_engine_non_empty_request_with_auto_populated_field(): client.create_engine(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == engine_service.CreateEngineRequest( + request_msg = engine_service.CreateEngineRequest( parent="parent_value", engine_id="engine_id_value", ) + assert args[0] == request_msg def test_create_engine_use_cached_wrapped_rpc(): @@ -1464,9 +1481,14 @@ async def test_create_engine_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_engine_async( - transport: str = "grpc_asyncio", request_type=engine_service.CreateEngineRequest -): +@pytest.mark.parametrize( + "request_type", + [ + engine_service.CreateEngineRequest(), + {}, + ], +) +async def test_create_engine_async(request_type, transport: str = "grpc_asyncio"): client = EngineServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1474,7 +1496,7 @@ async def test_create_engine_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_engine), "__call__") as call: @@ -1494,11 +1516,6 @@ async def test_create_engine_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_engine_async_from_dict(): - await test_create_engine_async(request_type=dict) - - def test_create_engine_field_headers(): client = EngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1701,8 +1718,8 @@ async def test_create_engine_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - engine_service.DeleteEngineRequest, - dict, + engine_service.DeleteEngineRequest(), + {}, ], ) def test_delete_engine(request_type, transport: str = "grpc"): @@ -1713,7 +1730,7 @@ def test_delete_engine(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_engine), "__call__") as call: @@ -1754,9 +1771,10 @@ def test_delete_engine_non_empty_request_with_auto_populated_field(): client.delete_engine(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == engine_service.DeleteEngineRequest( + request_msg = engine_service.DeleteEngineRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_engine_use_cached_wrapped_rpc(): @@ -1847,9 +1865,14 @@ async def test_delete_engine_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_engine_async( - transport: str = "grpc_asyncio", request_type=engine_service.DeleteEngineRequest -): +@pytest.mark.parametrize( + "request_type", + [ + engine_service.DeleteEngineRequest(), + {}, + ], +) +async def test_delete_engine_async(request_type, transport: str = "grpc_asyncio"): client = EngineServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1857,7 +1880,7 @@ async def test_delete_engine_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_engine), "__call__") as call: @@ -1877,11 +1900,6 @@ async def test_delete_engine_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_engine_async_from_dict(): - await test_delete_engine_async(request_type=dict) - - def test_delete_engine_field_headers(): client = EngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2028,8 +2046,8 @@ async def test_delete_engine_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - engine_service.UpdateEngineRequest, - dict, + engine_service.UpdateEngineRequest(), + {}, ], ) def test_update_engine(request_type, transport: str = "grpc"): @@ -2040,7 +2058,7 @@ def test_update_engine(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_engine), "__call__") as call: @@ -2092,7 +2110,8 @@ def test_update_engine_non_empty_request_with_auto_populated_field(): client.update_engine(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == engine_service.UpdateEngineRequest() + request_msg = engine_service.UpdateEngineRequest() + assert args[0] == request_msg def test_update_engine_use_cached_wrapped_rpc(): @@ -2173,9 +2192,14 @@ async def test_update_engine_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_engine_async( - transport: str = "grpc_asyncio", request_type=engine_service.UpdateEngineRequest -): +@pytest.mark.parametrize( + "request_type", + [ + engine_service.UpdateEngineRequest(), + {}, + ], +) +async def test_update_engine_async(request_type, transport: str = "grpc_asyncio"): client = EngineServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2183,7 +2207,7 @@ async def test_update_engine_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_engine), "__call__") as call: @@ -2216,11 +2240,6 @@ async def test_update_engine_async( assert response.disable_analytics is True -@pytest.mark.asyncio -async def test_update_engine_async_from_dict(): - await test_update_engine_async(request_type=dict) - - def test_update_engine_field_headers(): client = EngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2409,8 +2428,8 @@ async def test_update_engine_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - engine_service.GetEngineRequest, - dict, + engine_service.GetEngineRequest(), + {}, ], ) def test_get_engine(request_type, transport: str = "grpc"): @@ -2421,7 +2440,7 @@ def test_get_engine(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_engine), "__call__") as call: @@ -2475,9 +2494,10 @@ def test_get_engine_non_empty_request_with_auto_populated_field(): client.get_engine(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == engine_service.GetEngineRequest( + request_msg = engine_service.GetEngineRequest( name="name_value", ) + assert args[0] == request_msg def test_get_engine_use_cached_wrapped_rpc(): @@ -2556,9 +2576,14 @@ async def test_get_engine_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_engine_async( - transport: str = "grpc_asyncio", request_type=engine_service.GetEngineRequest -): +@pytest.mark.parametrize( + "request_type", + [ + engine_service.GetEngineRequest(), + {}, + ], +) +async def test_get_engine_async(request_type, transport: str = "grpc_asyncio"): client = EngineServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2566,7 +2591,7 @@ async def test_get_engine_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_engine), "__call__") as call: @@ -2599,11 +2624,6 @@ async def test_get_engine_async( assert response.disable_analytics is True -@pytest.mark.asyncio -async def test_get_engine_async_from_dict(): - await test_get_engine_async(request_type=dict) - - def test_get_engine_field_headers(): client = EngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2746,8 +2766,8 @@ async def test_get_engine_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - engine_service.ListEnginesRequest, - dict, + engine_service.ListEnginesRequest(), + {}, ], ) def test_list_engines(request_type, transport: str = "grpc"): @@ -2758,7 +2778,7 @@ def test_list_engines(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_engines), "__call__") as call: @@ -2804,11 +2824,12 @@ def test_list_engines_non_empty_request_with_auto_populated_field(): client.list_engines(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == engine_service.ListEnginesRequest( + request_msg = engine_service.ListEnginesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_engines_use_cached_wrapped_rpc(): @@ -2889,9 +2910,14 @@ async def test_list_engines_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_engines_async( - transport: str = "grpc_asyncio", request_type=engine_service.ListEnginesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + engine_service.ListEnginesRequest(), + {}, + ], +) +async def test_list_engines_async(request_type, transport: str = "grpc_asyncio"): client = EngineServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2899,7 +2925,7 @@ async def test_list_engines_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_engines), "__call__") as call: @@ -2922,11 +2948,6 @@ async def test_list_engines_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_engines_async_from_dict(): - await test_list_engines_async(request_type=dict) - - def test_list_engines_field_headers(): client = EngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3263,8 +3284,8 @@ async def test_list_engines_async_pages(): @pytest.mark.parametrize( "request_type", [ - engine_service.PauseEngineRequest, - dict, + engine_service.PauseEngineRequest(), + {}, ], ) def test_pause_engine(request_type, transport: str = "grpc"): @@ -3275,7 +3296,7 @@ def test_pause_engine(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.pause_engine), "__call__") as call: @@ -3329,9 +3350,10 @@ def test_pause_engine_non_empty_request_with_auto_populated_field(): client.pause_engine(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == engine_service.PauseEngineRequest( + request_msg = engine_service.PauseEngineRequest( name="name_value", ) + assert args[0] == request_msg def test_pause_engine_use_cached_wrapped_rpc(): @@ -3412,9 +3434,14 @@ async def test_pause_engine_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_pause_engine_async( - transport: str = "grpc_asyncio", request_type=engine_service.PauseEngineRequest -): +@pytest.mark.parametrize( + "request_type", + [ + engine_service.PauseEngineRequest(), + {}, + ], +) +async def test_pause_engine_async(request_type, transport: str = "grpc_asyncio"): client = EngineServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3422,7 +3449,7 @@ async def test_pause_engine_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.pause_engine), "__call__") as call: @@ -3455,11 +3482,6 @@ async def test_pause_engine_async( assert response.disable_analytics is True -@pytest.mark.asyncio -async def test_pause_engine_async_from_dict(): - await test_pause_engine_async(request_type=dict) - - def test_pause_engine_field_headers(): client = EngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3602,8 +3624,8 @@ async def test_pause_engine_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - engine_service.ResumeEngineRequest, - dict, + engine_service.ResumeEngineRequest(), + {}, ], ) def test_resume_engine(request_type, transport: str = "grpc"): @@ -3614,7 +3636,7 @@ def test_resume_engine(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.resume_engine), "__call__") as call: @@ -3668,9 +3690,10 @@ def test_resume_engine_non_empty_request_with_auto_populated_field(): client.resume_engine(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == engine_service.ResumeEngineRequest( + request_msg = engine_service.ResumeEngineRequest( name="name_value", ) + assert args[0] == request_msg def test_resume_engine_use_cached_wrapped_rpc(): @@ -3751,9 +3774,14 @@ async def test_resume_engine_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_resume_engine_async( - transport: str = "grpc_asyncio", request_type=engine_service.ResumeEngineRequest -): +@pytest.mark.parametrize( + "request_type", + [ + engine_service.ResumeEngineRequest(), + {}, + ], +) +async def test_resume_engine_async(request_type, transport: str = "grpc_asyncio"): client = EngineServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3761,7 +3789,7 @@ async def test_resume_engine_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.resume_engine), "__call__") as call: @@ -3794,11 +3822,6 @@ async def test_resume_engine_async( assert response.disable_analytics is True -@pytest.mark.asyncio -async def test_resume_engine_async_from_dict(): - await test_resume_engine_async(request_type=dict) - - def test_resume_engine_field_headers(): client = EngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3941,8 +3964,8 @@ async def test_resume_engine_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - engine_service.TuneEngineRequest, - dict, + engine_service.TuneEngineRequest(), + {}, ], ) def test_tune_engine(request_type, transport: str = "grpc"): @@ -3953,7 +3976,7 @@ def test_tune_engine(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.tune_engine), "__call__") as call: @@ -3994,9 +4017,10 @@ def test_tune_engine_non_empty_request_with_auto_populated_field(): client.tune_engine(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == engine_service.TuneEngineRequest( + request_msg = engine_service.TuneEngineRequest( name="name_value", ) + assert args[0] == request_msg def test_tune_engine_use_cached_wrapped_rpc(): @@ -4087,9 +4111,14 @@ async def test_tune_engine_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_tune_engine_async( - transport: str = "grpc_asyncio", request_type=engine_service.TuneEngineRequest -): +@pytest.mark.parametrize( + "request_type", + [ + engine_service.TuneEngineRequest(), + {}, + ], +) +async def test_tune_engine_async(request_type, transport: str = "grpc_asyncio"): client = EngineServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4097,7 +4126,7 @@ async def test_tune_engine_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.tune_engine), "__call__") as call: @@ -4117,11 +4146,6 @@ async def test_tune_engine_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_tune_engine_async_from_dict(): - await test_tune_engine_async(request_type=dict) - - def test_tune_engine_field_headers(): client = EngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5963,7 +5987,6 @@ def test_create_engine_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_service.CreateEngineRequest() - assert args[0] == request_msg @@ -5984,7 +6007,6 @@ def test_delete_engine_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_service.DeleteEngineRequest() - assert args[0] == request_msg @@ -6005,7 +6027,6 @@ def test_update_engine_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_service.UpdateEngineRequest() - assert args[0] == request_msg @@ -6026,7 +6047,6 @@ def test_get_engine_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_service.GetEngineRequest() - assert args[0] == request_msg @@ -6047,7 +6067,6 @@ def test_list_engines_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_service.ListEnginesRequest() - assert args[0] == request_msg @@ -6068,7 +6087,6 @@ def test_pause_engine_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_service.PauseEngineRequest() - assert args[0] == request_msg @@ -6089,7 +6107,6 @@ def test_resume_engine_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_service.ResumeEngineRequest() - assert args[0] == request_msg @@ -6110,7 +6127,6 @@ def test_tune_engine_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_service.TuneEngineRequest() - assert args[0] == request_msg @@ -6149,7 +6165,6 @@ async def test_create_engine_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_service.CreateEngineRequest() - assert args[0] == request_msg @@ -6174,7 +6189,6 @@ async def test_delete_engine_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_service.DeleteEngineRequest() - assert args[0] == request_msg @@ -6206,7 +6220,6 @@ async def test_update_engine_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_service.UpdateEngineRequest() - assert args[0] == request_msg @@ -6238,7 +6251,6 @@ async def test_get_engine_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_service.GetEngineRequest() - assert args[0] == request_msg @@ -6265,7 +6277,6 @@ async def test_list_engines_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_service.ListEnginesRequest() - assert args[0] == request_msg @@ -6297,7 +6308,6 @@ async def test_pause_engine_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_service.PauseEngineRequest() - assert args[0] == request_msg @@ -6329,7 +6339,6 @@ async def test_resume_engine_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_service.ResumeEngineRequest() - assert args[0] == request_msg @@ -6354,7 +6363,6 @@ async def test_tune_engine_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_service.TuneEngineRequest() - assert args[0] == request_msg @@ -7857,7 +7865,6 @@ def test_create_engine_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_service.CreateEngineRequest() - assert args[0] == request_msg @@ -7877,7 +7884,6 @@ def test_delete_engine_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_service.DeleteEngineRequest() - assert args[0] == request_msg @@ -7897,7 +7903,6 @@ def test_update_engine_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_service.UpdateEngineRequest() - assert args[0] == request_msg @@ -7917,7 +7922,6 @@ def test_get_engine_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_service.GetEngineRequest() - assert args[0] == request_msg @@ -7937,7 +7941,6 @@ def test_list_engines_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_service.ListEnginesRequest() - assert args[0] == request_msg @@ -7957,7 +7960,6 @@ def test_pause_engine_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_service.PauseEngineRequest() - assert args[0] == request_msg @@ -7977,7 +7979,6 @@ def test_resume_engine_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_service.ResumeEngineRequest() - assert args[0] == request_msg @@ -7997,7 +7998,6 @@ def test_tune_engine_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_service.TuneEngineRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_evaluation_service.py b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_evaluation_service.py index e08ea04faeb1..0a62d75e20df 100644 --- a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_evaluation_service.py +++ b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_evaluation_service.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 @@ -123,6 +124,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" @@ -1364,8 +1380,8 @@ def test_evaluation_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - evaluation_service.GetEvaluationRequest, - dict, + evaluation_service.GetEvaluationRequest(), + {}, ], ) def test_get_evaluation(request_type, transport: str = "grpc"): @@ -1376,7 +1392,7 @@ def test_get_evaluation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_evaluation), "__call__") as call: @@ -1422,9 +1438,10 @@ def test_get_evaluation_non_empty_request_with_auto_populated_field(): client.get_evaluation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == evaluation_service.GetEvaluationRequest( + request_msg = evaluation_service.GetEvaluationRequest( name="name_value", ) + assert args[0] == request_msg def test_get_evaluation_use_cached_wrapped_rpc(): @@ -1505,10 +1522,14 @@ async def test_get_evaluation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_evaluation_async( - transport: str = "grpc_asyncio", - request_type=evaluation_service.GetEvaluationRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + evaluation_service.GetEvaluationRequest(), + {}, + ], +) +async def test_get_evaluation_async(request_type, transport: str = "grpc_asyncio"): client = EvaluationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1516,7 +1537,7 @@ async def test_get_evaluation_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_evaluation), "__call__") as call: @@ -1541,11 +1562,6 @@ async def test_get_evaluation_async( assert response.state == evaluation.Evaluation.State.PENDING -@pytest.mark.asyncio -async def test_get_evaluation_async_from_dict(): - await test_get_evaluation_async(request_type=dict) - - def test_get_evaluation_field_headers(): client = EvaluationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1692,8 +1708,8 @@ async def test_get_evaluation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - evaluation_service.ListEvaluationsRequest, - dict, + evaluation_service.ListEvaluationsRequest(), + {}, ], ) def test_list_evaluations(request_type, transport: str = "grpc"): @@ -1704,7 +1720,7 @@ def test_list_evaluations(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_evaluations), "__call__") as call: @@ -1749,10 +1765,11 @@ def test_list_evaluations_non_empty_request_with_auto_populated_field(): client.list_evaluations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == evaluation_service.ListEvaluationsRequest( + request_msg = evaluation_service.ListEvaluationsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_evaluations_use_cached_wrapped_rpc(): @@ -1835,10 +1852,14 @@ async def test_list_evaluations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_evaluations_async( - transport: str = "grpc_asyncio", - request_type=evaluation_service.ListEvaluationsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + evaluation_service.ListEvaluationsRequest(), + {}, + ], +) +async def test_list_evaluations_async(request_type, transport: str = "grpc_asyncio"): client = EvaluationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1846,7 +1867,7 @@ async def test_list_evaluations_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_evaluations), "__call__") as call: @@ -1869,11 +1890,6 @@ async def test_list_evaluations_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_evaluations_async_from_dict(): - await test_list_evaluations_async(request_type=dict) - - def test_list_evaluations_field_headers(): client = EvaluationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2210,8 +2226,8 @@ async def test_list_evaluations_async_pages(): @pytest.mark.parametrize( "request_type", [ - evaluation_service.CreateEvaluationRequest, - dict, + evaluation_service.CreateEvaluationRequest(), + {}, ], ) def test_create_evaluation(request_type, transport: str = "grpc"): @@ -2222,7 +2238,7 @@ def test_create_evaluation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,9 +2283,10 @@ def test_create_evaluation_non_empty_request_with_auto_populated_field(): client.create_evaluation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == evaluation_service.CreateEvaluationRequest( + request_msg = evaluation_service.CreateEvaluationRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_evaluation_use_cached_wrapped_rpc(): @@ -2362,10 +2379,14 @@ async def test_create_evaluation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_evaluation_async( - transport: str = "grpc_asyncio", - request_type=evaluation_service.CreateEvaluationRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + evaluation_service.CreateEvaluationRequest(), + {}, + ], +) +async def test_create_evaluation_async(request_type, transport: str = "grpc_asyncio"): client = EvaluationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2373,7 +2394,7 @@ async def test_create_evaluation_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( @@ -2395,11 +2416,6 @@ async def test_create_evaluation_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_evaluation_async_from_dict(): - await test_create_evaluation_async(request_type=dict) - - def test_create_evaluation_field_headers(): client = EvaluationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2564,8 +2580,8 @@ async def test_create_evaluation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - evaluation_service.ListEvaluationResultsRequest, - dict, + evaluation_service.ListEvaluationResultsRequest(), + {}, ], ) def test_list_evaluation_results(request_type, transport: str = "grpc"): @@ -2576,7 +2592,7 @@ def test_list_evaluation_results(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2625,10 +2641,11 @@ def test_list_evaluation_results_non_empty_request_with_auto_populated_field(): client.list_evaluation_results(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == evaluation_service.ListEvaluationResultsRequest( + request_msg = evaluation_service.ListEvaluationResultsRequest( evaluation="evaluation_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_evaluation_results_use_cached_wrapped_rpc(): @@ -2714,9 +2731,15 @@ async def test_list_evaluation_results_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + evaluation_service.ListEvaluationResultsRequest(), + {}, + ], +) async def test_list_evaluation_results_async( - transport: str = "grpc_asyncio", - request_type=evaluation_service.ListEvaluationResultsRequest, + request_type, transport: str = "grpc_asyncio" ): client = EvaluationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2725,7 +2748,7 @@ async def test_list_evaluation_results_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( @@ -2750,11 +2773,6 @@ async def test_list_evaluation_results_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_evaluation_results_async_from_dict(): - await test_list_evaluation_results_async(request_type=dict) - - def test_list_evaluation_results_field_headers(): client = EvaluationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4138,7 +4156,6 @@ def test_get_evaluation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.GetEvaluationRequest() - assert args[0] == request_msg @@ -4159,7 +4176,6 @@ def test_list_evaluations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.ListEvaluationsRequest() - assert args[0] == request_msg @@ -4182,7 +4198,6 @@ def test_create_evaluation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.CreateEvaluationRequest() - assert args[0] == request_msg @@ -4205,7 +4220,6 @@ def test_list_evaluation_results_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.ListEvaluationResultsRequest() - assert args[0] == request_msg @@ -4247,7 +4261,6 @@ async def test_get_evaluation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.GetEvaluationRequest() - assert args[0] == request_msg @@ -4274,7 +4287,6 @@ async def test_list_evaluations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.ListEvaluationsRequest() - assert args[0] == request_msg @@ -4301,7 +4313,6 @@ async def test_create_evaluation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.CreateEvaluationRequest() - assert args[0] == request_msg @@ -4330,7 +4341,6 @@ async def test_list_evaluation_results_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.ListEvaluationResultsRequest() - assert args[0] == request_msg @@ -5338,7 +5348,6 @@ def test_get_evaluation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.GetEvaluationRequest() - assert args[0] == request_msg @@ -5358,7 +5367,6 @@ def test_list_evaluations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.ListEvaluationsRequest() - assert args[0] == request_msg @@ -5380,7 +5388,6 @@ def test_create_evaluation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.CreateEvaluationRequest() - assert args[0] == request_msg @@ -5402,7 +5409,6 @@ def test_list_evaluation_results_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = evaluation_service.ListEvaluationResultsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_grounded_generation_service.py b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_grounded_generation_service.py index 69ff92343617..1bfced230c62 100644 --- a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_grounded_generation_service.py +++ b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_grounded_generation_service.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" @@ -1393,8 +1409,8 @@ def test_grounded_generation_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - grounded_generation_service.GenerateGroundedContentRequest, - dict, + grounded_generation_service.GenerateGroundedContentRequest(), + {}, ], ) def test_stream_generate_grounded_content(request_type, transport: str = "grpc"): @@ -1405,7 +1421,7 @@ def test_stream_generate_grounded_content(request_type, transport: str = "grpc") # Everything is optional in proto3 as far as 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. @@ -1513,9 +1529,15 @@ async def test_stream_generate_grounded_content_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + grounded_generation_service.GenerateGroundedContentRequest(), + {}, + ], +) async def test_stream_generate_grounded_content_async( - transport: str = "grpc_asyncio", - request_type=grounded_generation_service.GenerateGroundedContentRequest, + request_type, transport: str = "grpc_asyncio" ): client = GroundedGenerationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1524,7 +1546,7 @@ async def test_stream_generate_grounded_content_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. @@ -1550,16 +1572,11 @@ async def test_stream_generate_grounded_content_async( ) -@pytest.mark.asyncio -async def test_stream_generate_grounded_content_async_from_dict(): - await test_stream_generate_grounded_content_async(request_type=dict) - - @pytest.mark.parametrize( "request_type", [ - grounded_generation_service.GenerateGroundedContentRequest, - dict, + grounded_generation_service.GenerateGroundedContentRequest(), + {}, ], ) def test_generate_grounded_content(request_type, transport: str = "grpc"): @@ -1570,7 +1587,7 @@ def test_generate_grounded_content(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1619,9 +1636,10 @@ def test_generate_grounded_content_non_empty_request_with_auto_populated_field() client.generate_grounded_content(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == grounded_generation_service.GenerateGroundedContentRequest( + request_msg = grounded_generation_service.GenerateGroundedContentRequest( location="location_value", ) + assert args[0] == request_msg def test_generate_grounded_content_use_cached_wrapped_rpc(): @@ -1707,9 +1725,15 @@ async def test_generate_grounded_content_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + grounded_generation_service.GenerateGroundedContentRequest(), + {}, + ], +) async def test_generate_grounded_content_async( - transport: str = "grpc_asyncio", - request_type=grounded_generation_service.GenerateGroundedContentRequest, + request_type, transport: str = "grpc_asyncio" ): client = GroundedGenerationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1718,7 +1742,7 @@ async def test_generate_grounded_content_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( @@ -1742,11 +1766,6 @@ async def test_generate_grounded_content_async( ) -@pytest.mark.asyncio -async def test_generate_grounded_content_async_from_dict(): - await test_generate_grounded_content_async(request_type=dict) - - def test_generate_grounded_content_field_headers(): client = GroundedGenerationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1817,8 +1836,8 @@ async def test_generate_grounded_content_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - grounded_generation_service.CheckGroundingRequest, - dict, + grounded_generation_service.CheckGroundingRequest(), + {}, ], ) def test_check_grounding(request_type, transport: str = "grpc"): @@ -1829,7 +1848,7 @@ def test_check_grounding(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.check_grounding), "__call__") as call: @@ -1874,10 +1893,11 @@ def test_check_grounding_non_empty_request_with_auto_populated_field(): client.check_grounding(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == grounded_generation_service.CheckGroundingRequest( + request_msg = grounded_generation_service.CheckGroundingRequest( grounding_config="grounding_config_value", answer_candidate="answer_candidate_value", ) + assert args[0] == request_msg def test_check_grounding_use_cached_wrapped_rpc(): @@ -1958,10 +1978,14 @@ async def test_check_grounding_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_check_grounding_async( - transport: str = "grpc_asyncio", - request_type=grounded_generation_service.CheckGroundingRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + grounded_generation_service.CheckGroundingRequest(), + {}, + ], +) +async def test_check_grounding_async(request_type, transport: str = "grpc_asyncio"): client = GroundedGenerationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1969,7 +1993,7 @@ async def test_check_grounding_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.check_grounding), "__call__") as call: @@ -1992,11 +2016,6 @@ async def test_check_grounding_async( assert math.isclose(response.support_score, 0.1432, rel_tol=1e-6) -@pytest.mark.asyncio -async def test_check_grounding_async_from_dict(): - await test_check_grounding_async(request_type=dict) - - def test_check_grounding_field_headers(): client = GroundedGenerationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2449,7 +2468,6 @@ def test_generate_grounded_content_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = grounded_generation_service.GenerateGroundedContentRequest() - assert args[0] == request_msg @@ -2470,7 +2488,6 @@ def test_check_grounding_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = grounded_generation_service.CheckGroundingRequest() - assert args[0] == request_msg @@ -2511,7 +2528,6 @@ async def test_generate_grounded_content_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = grounded_generation_service.GenerateGroundedContentRequest() - assert args[0] == request_msg @@ -2538,7 +2554,6 @@ async def test_check_grounding_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = grounded_generation_service.CheckGroundingRequest() - assert args[0] == request_msg @@ -3076,7 +3091,6 @@ def test_generate_grounded_content_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = grounded_generation_service.GenerateGroundedContentRequest() - assert args[0] == request_msg @@ -3096,7 +3110,6 @@ def test_check_grounding_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = grounded_generation_service.CheckGroundingRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_project_service.py b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_project_service.py index 9db461966e9d..d64b9430ce92 100644 --- a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_project_service.py +++ b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_project_service.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" @@ -1315,8 +1331,8 @@ def test_project_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - project_service.ProvisionProjectRequest, - dict, + project_service.ProvisionProjectRequest(), + {}, ], ) def test_provision_project(request_type, transport: str = "grpc"): @@ -1327,7 +1343,7 @@ def test_provision_project(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1373,10 +1389,11 @@ def test_provision_project_non_empty_request_with_auto_populated_field(): client.provision_project(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == project_service.ProvisionProjectRequest( + request_msg = project_service.ProvisionProjectRequest( name="name_value", data_use_terms_version="data_use_terms_version_value", ) + assert args[0] == request_msg def test_provision_project_use_cached_wrapped_rpc(): @@ -1469,10 +1486,14 @@ async def test_provision_project_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_provision_project_async( - transport: str = "grpc_asyncio", - request_type=project_service.ProvisionProjectRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + project_service.ProvisionProjectRequest(), + {}, + ], +) +async def test_provision_project_async(request_type, transport: str = "grpc_asyncio"): client = ProjectServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1480,7 +1501,7 @@ async def test_provision_project_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( @@ -1502,11 +1523,6 @@ async def test_provision_project_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_provision_project_async_from_dict(): - await test_provision_project_async(request_type=dict) - - def test_provision_project_field_headers(): client = ProjectServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1978,7 +1994,6 @@ def test_provision_project_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = project_service.ProvisionProjectRequest() - assert args[0] == request_msg @@ -2019,7 +2034,6 @@ async def test_provision_project_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = project_service.ProvisionProjectRequest() - assert args[0] == request_msg @@ -2385,7 +2399,6 @@ def test_provision_project_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = project_service.ProvisionProjectRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_rank_service.py b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_rank_service.py index 008d8f941c48..9815df8977d4 100644 --- a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_rank_service.py +++ b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_rank_service.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 @@ -108,6 +109,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" @@ -1273,8 +1289,8 @@ def test_rank_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - rank_service.RankRequest, - dict, + rank_service.RankRequest(), + {}, ], ) def test_rank(request_type, transport: str = "grpc"): @@ -1285,7 +1301,7 @@ def test_rank(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.rank), "__call__") as call: @@ -1328,11 +1344,12 @@ def test_rank_non_empty_request_with_auto_populated_field(): client.rank(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == rank_service.RankRequest( + request_msg = rank_service.RankRequest( ranking_config="ranking_config_value", model="model_value", query="query_value", ) + assert args[0] == request_msg def test_rank_use_cached_wrapped_rpc(): @@ -1410,9 +1427,14 @@ async def test_rank_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio" @pytest.mark.asyncio -async def test_rank_async( - transport: str = "grpc_asyncio", request_type=rank_service.RankRequest -): +@pytest.mark.parametrize( + "request_type", + [ + rank_service.RankRequest(), + {}, + ], +) +async def test_rank_async(request_type, transport: str = "grpc_asyncio"): client = RankServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1420,7 +1442,7 @@ async def test_rank_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.rank), "__call__") as call: @@ -1440,11 +1462,6 @@ async def test_rank_async( assert isinstance(response, rank_service.RankResponse) -@pytest.mark.asyncio -async def test_rank_async_from_dict(): - await test_rank_async(request_type=dict) - - def test_rank_field_headers(): client = RankServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1756,7 +1773,6 @@ def test_rank_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rank_service.RankRequest() - assert args[0] == request_msg @@ -1795,7 +1811,6 @@ async def test_rank_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rank_service.RankRequest() - assert args[0] == request_msg @@ -2156,7 +2171,6 @@ def test_rank_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rank_service.RankRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_recommendation_service.py b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_recommendation_service.py index 78399f55041c..c9e9f4fa622c 100644 --- a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_recommendation_service.py +++ b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_recommendation_service.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 @@ -115,6 +116,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" @@ -1380,8 +1396,8 @@ def test_recommendation_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - recommendation_service.RecommendRequest, - dict, + recommendation_service.RecommendRequest(), + {}, ], ) def test_recommend(request_type, transport: str = "grpc"): @@ -1392,7 +1408,7 @@ def test_recommend(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.recommend), "__call__") as call: @@ -1441,10 +1457,11 @@ def test_recommend_non_empty_request_with_auto_populated_field(): client.recommend(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == recommendation_service.RecommendRequest( + request_msg = recommendation_service.RecommendRequest( serving_config="serving_config_value", filter="filter_value", ) + assert args[0] == request_msg def test_recommend_use_cached_wrapped_rpc(): @@ -1523,10 +1540,14 @@ async def test_recommend_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_recommend_async( - transport: str = "grpc_asyncio", - request_type=recommendation_service.RecommendRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + recommendation_service.RecommendRequest(), + {}, + ], +) +async def test_recommend_async(request_type, transport: str = "grpc_asyncio"): client = RecommendationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1534,7 +1555,7 @@ async def test_recommend_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.recommend), "__call__") as call: @@ -1561,11 +1582,6 @@ async def test_recommend_async( assert response.validate_only is True -@pytest.mark.asyncio -async def test_recommend_async_from_dict(): - await test_recommend_async(request_type=dict) - - def test_recommend_field_headers(): client = RecommendationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1879,7 +1895,6 @@ def test_recommend_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommendation_service.RecommendRequest() - assert args[0] == request_msg @@ -1922,7 +1937,6 @@ async def test_recommend_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommendation_service.RecommendRequest() - assert args[0] == request_msg @@ -2304,7 +2318,6 @@ def test_recommend_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommendation_service.RecommendRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_sample_query_service.py b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_sample_query_service.py index 5a0ddcb01c2e..8fbff15aa290 100644 --- a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_sample_query_service.py +++ b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_sample_query_service.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 @@ -121,6 +122,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" @@ -1366,8 +1382,8 @@ def test_sample_query_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - sample_query_service.GetSampleQueryRequest, - dict, + sample_query_service.GetSampleQueryRequest(), + {}, ], ) def test_get_sample_query(request_type, transport: str = "grpc"): @@ -1378,7 +1394,7 @@ def test_get_sample_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(type(client.transport.get_sample_query), "__call__") as call: @@ -1422,9 +1438,10 @@ def test_get_sample_query_non_empty_request_with_auto_populated_field(): client.get_sample_query(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == sample_query_service.GetSampleQueryRequest( + request_msg = sample_query_service.GetSampleQueryRequest( name="name_value", ) + assert args[0] == request_msg def test_get_sample_query_use_cached_wrapped_rpc(): @@ -1507,10 +1524,14 @@ async def test_get_sample_query_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_sample_query_async( - transport: str = "grpc_asyncio", - request_type=sample_query_service.GetSampleQueryRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + sample_query_service.GetSampleQueryRequest(), + {}, + ], +) +async def test_get_sample_query_async(request_type, transport: str = "grpc_asyncio"): client = SampleQueryServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1518,7 +1539,7 @@ async def test_get_sample_query_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_sample_query), "__call__") as call: @@ -1541,11 +1562,6 @@ async def test_get_sample_query_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_sample_query_async_from_dict(): - await test_get_sample_query_async(request_type=dict) - - def test_get_sample_query_field_headers(): client = SampleQueryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1692,8 +1708,8 @@ async def test_get_sample_query_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - sample_query_service.ListSampleQueriesRequest, - dict, + sample_query_service.ListSampleQueriesRequest(), + {}, ], ) def test_list_sample_queries(request_type, transport: str = "grpc"): @@ -1704,7 +1720,7 @@ def test_list_sample_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( @@ -1753,10 +1769,11 @@ def test_list_sample_queries_non_empty_request_with_auto_populated_field(): client.list_sample_queries(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == sample_query_service.ListSampleQueriesRequest( + request_msg = sample_query_service.ListSampleQueriesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_sample_queries_use_cached_wrapped_rpc(): @@ -1841,10 +1858,14 @@ async def test_list_sample_queries_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_sample_queries_async( - transport: str = "grpc_asyncio", - request_type=sample_query_service.ListSampleQueriesRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + sample_query_service.ListSampleQueriesRequest(), + {}, + ], +) +async def test_list_sample_queries_async(request_type, transport: str = "grpc_asyncio"): client = SampleQueryServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1852,7 +1873,7 @@ async def test_list_sample_queries_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( @@ -1877,11 +1898,6 @@ async def test_list_sample_queries_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_sample_queries_async_from_dict(): - await test_list_sample_queries_async(request_type=dict) - - def test_list_sample_queries_field_headers(): client = SampleQueryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2234,8 +2250,8 @@ async def test_list_sample_queries_async_pages(): @pytest.mark.parametrize( "request_type", [ - sample_query_service.CreateSampleQueryRequest, - dict, + sample_query_service.CreateSampleQueryRequest(), + {}, ], ) def test_create_sample_query(request_type, transport: str = "grpc"): @@ -2246,7 +2262,7 @@ def test_create_sample_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( @@ -2295,10 +2311,11 @@ def test_create_sample_query_non_empty_request_with_auto_populated_field(): client.create_sample_query(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == sample_query_service.CreateSampleQueryRequest( + request_msg = sample_query_service.CreateSampleQueryRequest( parent="parent_value", sample_query_id="sample_query_id_value", ) + assert args[0] == request_msg def test_create_sample_query_use_cached_wrapped_rpc(): @@ -2383,10 +2400,14 @@ async def test_create_sample_query_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_sample_query_async( - transport: str = "grpc_asyncio", - request_type=sample_query_service.CreateSampleQueryRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + sample_query_service.CreateSampleQueryRequest(), + {}, + ], +) +async def test_create_sample_query_async(request_type, transport: str = "grpc_asyncio"): client = SampleQueryServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2394,7 +2415,7 @@ async def test_create_sample_query_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( @@ -2419,11 +2440,6 @@ async def test_create_sample_query_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_create_sample_query_async_from_dict(): - await test_create_sample_query_async(request_type=dict) - - def test_create_sample_query_field_headers(): client = SampleQueryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2610,8 +2626,8 @@ async def test_create_sample_query_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - sample_query_service.UpdateSampleQueryRequest, - dict, + sample_query_service.UpdateSampleQueryRequest(), + {}, ], ) def test_update_sample_query(request_type, transport: str = "grpc"): @@ -2622,7 +2638,7 @@ def test_update_sample_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( @@ -2668,7 +2684,8 @@ def test_update_sample_query_non_empty_request_with_auto_populated_field(): client.update_sample_query(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == sample_query_service.UpdateSampleQueryRequest() + request_msg = sample_query_service.UpdateSampleQueryRequest() + assert args[0] == request_msg def test_update_sample_query_use_cached_wrapped_rpc(): @@ -2753,10 +2770,14 @@ async def test_update_sample_query_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_sample_query_async( - transport: str = "grpc_asyncio", - request_type=sample_query_service.UpdateSampleQueryRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + sample_query_service.UpdateSampleQueryRequest(), + {}, + ], +) +async def test_update_sample_query_async(request_type, transport: str = "grpc_asyncio"): client = SampleQueryServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2764,7 +2785,7 @@ async def test_update_sample_query_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( @@ -2789,11 +2810,6 @@ async def test_update_sample_query_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_update_sample_query_async_from_dict(): - await test_update_sample_query_async(request_type=dict) - - def test_update_sample_query_field_headers(): client = SampleQueryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2970,8 +2986,8 @@ async def test_update_sample_query_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - sample_query_service.DeleteSampleQueryRequest, - dict, + sample_query_service.DeleteSampleQueryRequest(), + {}, ], ) def test_delete_sample_query(request_type, transport: str = "grpc"): @@ -2982,7 +2998,7 @@ def test_delete_sample_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( @@ -3027,9 +3043,10 @@ def test_delete_sample_query_non_empty_request_with_auto_populated_field(): client.delete_sample_query(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == sample_query_service.DeleteSampleQueryRequest( + request_msg = sample_query_service.DeleteSampleQueryRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_sample_query_use_cached_wrapped_rpc(): @@ -3114,10 +3131,14 @@ async def test_delete_sample_query_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_sample_query_async( - transport: str = "grpc_asyncio", - request_type=sample_query_service.DeleteSampleQueryRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + sample_query_service.DeleteSampleQueryRequest(), + {}, + ], +) +async def test_delete_sample_query_async(request_type, transport: str = "grpc_asyncio"): client = SampleQueryServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3125,7 +3146,7 @@ async def test_delete_sample_query_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( @@ -3145,11 +3166,6 @@ async def test_delete_sample_query_async( assert response is None -@pytest.mark.asyncio -async def test_delete_sample_query_async_from_dict(): - await test_delete_sample_query_async(request_type=dict) - - def test_delete_sample_query_field_headers(): client = SampleQueryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3300,8 +3316,8 @@ async def test_delete_sample_query_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - import_config.ImportSampleQueriesRequest, - dict, + import_config.ImportSampleQueriesRequest(), + {}, ], ) def test_import_sample_queries(request_type, transport: str = "grpc"): @@ -3312,7 +3328,7 @@ def test_import_sample_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( @@ -3357,9 +3373,10 @@ def test_import_sample_queries_non_empty_request_with_auto_populated_field(): client.import_sample_queries(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == import_config.ImportSampleQueriesRequest( + request_msg = import_config.ImportSampleQueriesRequest( parent="parent_value", ) + assert args[0] == request_msg def test_import_sample_queries_use_cached_wrapped_rpc(): @@ -3455,9 +3472,15 @@ async def test_import_sample_queries_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + import_config.ImportSampleQueriesRequest(), + {}, + ], +) async def test_import_sample_queries_async( - transport: str = "grpc_asyncio", - request_type=import_config.ImportSampleQueriesRequest, + request_type, transport: str = "grpc_asyncio" ): client = SampleQueryServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3466,7 +3489,7 @@ async def test_import_sample_queries_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( @@ -3488,11 +3511,6 @@ async def test_import_sample_queries_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_import_sample_queries_async_from_dict(): - await test_import_sample_queries_async(request_type=dict) - - def test_import_sample_queries_field_headers(): client = SampleQueryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4842,7 +4860,6 @@ def test_get_sample_query_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sample_query_service.GetSampleQueryRequest() - assert args[0] == request_msg @@ -4865,7 +4882,6 @@ def test_list_sample_queries_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sample_query_service.ListSampleQueriesRequest() - assert args[0] == request_msg @@ -4888,7 +4904,6 @@ def test_create_sample_query_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sample_query_service.CreateSampleQueryRequest() - assert args[0] == request_msg @@ -4911,7 +4926,6 @@ def test_update_sample_query_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sample_query_service.UpdateSampleQueryRequest() - assert args[0] == request_msg @@ -4934,7 +4948,6 @@ def test_delete_sample_query_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sample_query_service.DeleteSampleQueryRequest() - assert args[0] == request_msg @@ -4957,7 +4970,6 @@ def test_import_sample_queries_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_config.ImportSampleQueriesRequest() - assert args[0] == request_msg @@ -4998,7 +5010,6 @@ async def test_get_sample_query_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sample_query_service.GetSampleQueryRequest() - assert args[0] == request_msg @@ -5027,7 +5038,6 @@ async def test_list_sample_queries_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sample_query_service.ListSampleQueriesRequest() - assert args[0] == request_msg @@ -5056,7 +5066,6 @@ async def test_create_sample_query_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sample_query_service.CreateSampleQueryRequest() - assert args[0] == request_msg @@ -5085,7 +5094,6 @@ async def test_update_sample_query_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sample_query_service.UpdateSampleQueryRequest() - assert args[0] == request_msg @@ -5110,7 +5118,6 @@ async def test_delete_sample_query_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sample_query_service.DeleteSampleQueryRequest() - assert args[0] == request_msg @@ -5137,7 +5144,6 @@ async def test_import_sample_queries_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_config.ImportSampleQueriesRequest() - assert args[0] == request_msg @@ -6330,7 +6336,6 @@ def test_get_sample_query_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sample_query_service.GetSampleQueryRequest() - assert args[0] == request_msg @@ -6352,7 +6357,6 @@ def test_list_sample_queries_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sample_query_service.ListSampleQueriesRequest() - assert args[0] == request_msg @@ -6374,7 +6378,6 @@ def test_create_sample_query_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sample_query_service.CreateSampleQueryRequest() - assert args[0] == request_msg @@ -6396,7 +6399,6 @@ def test_update_sample_query_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sample_query_service.UpdateSampleQueryRequest() - assert args[0] == request_msg @@ -6418,7 +6420,6 @@ def test_delete_sample_query_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sample_query_service.DeleteSampleQueryRequest() - assert args[0] == request_msg @@ -6440,7 +6441,6 @@ def test_import_sample_queries_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_config.ImportSampleQueriesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_sample_query_set_service.py b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_sample_query_set_service.py index bfb88fa17243..38bbd17a6966 100644 --- a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_sample_query_set_service.py +++ b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_sample_query_set_service.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 @@ -117,6 +118,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" @@ -1384,8 +1400,8 @@ def test_sample_query_set_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - sample_query_set_service.GetSampleQuerySetRequest, - dict, + sample_query_set_service.GetSampleQuerySetRequest(), + {}, ], ) def test_get_sample_query_set(request_type, transport: str = "grpc"): @@ -1396,7 +1412,7 @@ def test_get_sample_query_set(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1448,9 +1464,10 @@ def test_get_sample_query_set_non_empty_request_with_auto_populated_field(): client.get_sample_query_set(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == sample_query_set_service.GetSampleQuerySetRequest( + request_msg = sample_query_set_service.GetSampleQuerySetRequest( name="name_value", ) + assert args[0] == request_msg def test_get_sample_query_set_use_cached_wrapped_rpc(): @@ -1535,9 +1552,15 @@ async def test_get_sample_query_set_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + sample_query_set_service.GetSampleQuerySetRequest(), + {}, + ], +) async def test_get_sample_query_set_async( - transport: str = "grpc_asyncio", - request_type=sample_query_set_service.GetSampleQuerySetRequest, + request_type, transport: str = "grpc_asyncio" ): client = SampleQuerySetServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1546,7 +1569,7 @@ async def test_get_sample_query_set_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( @@ -1575,11 +1598,6 @@ async def test_get_sample_query_set_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_get_sample_query_set_async_from_dict(): - await test_get_sample_query_set_async(request_type=dict) - - def test_get_sample_query_set_field_headers(): client = SampleQuerySetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1734,8 +1752,8 @@ async def test_get_sample_query_set_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - sample_query_set_service.ListSampleQuerySetsRequest, - dict, + sample_query_set_service.ListSampleQuerySetsRequest(), + {}, ], ) def test_list_sample_query_sets(request_type, transport: str = "grpc"): @@ -1746,7 +1764,7 @@ def test_list_sample_query_sets(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1795,10 +1813,11 @@ def test_list_sample_query_sets_non_empty_request_with_auto_populated_field(): client.list_sample_query_sets(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == sample_query_set_service.ListSampleQuerySetsRequest( + request_msg = sample_query_set_service.ListSampleQuerySetsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_sample_query_sets_use_cached_wrapped_rpc(): @@ -1884,9 +1903,15 @@ async def test_list_sample_query_sets_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + sample_query_set_service.ListSampleQuerySetsRequest(), + {}, + ], +) async def test_list_sample_query_sets_async( - transport: str = "grpc_asyncio", - request_type=sample_query_set_service.ListSampleQuerySetsRequest, + request_type, transport: str = "grpc_asyncio" ): client = SampleQuerySetServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1895,7 +1920,7 @@ async def test_list_sample_query_sets_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( @@ -1920,11 +1945,6 @@ async def test_list_sample_query_sets_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_sample_query_sets_async_from_dict(): - await test_list_sample_query_sets_async(request_type=dict) - - def test_list_sample_query_sets_field_headers(): client = SampleQuerySetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2277,8 +2297,8 @@ async def test_list_sample_query_sets_async_pages(): @pytest.mark.parametrize( "request_type", [ - sample_query_set_service.CreateSampleQuerySetRequest, - dict, + sample_query_set_service.CreateSampleQuerySetRequest(), + {}, ], ) def test_create_sample_query_set(request_type, transport: str = "grpc"): @@ -2289,7 +2309,7 @@ def test_create_sample_query_set(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2342,10 +2362,11 @@ def test_create_sample_query_set_non_empty_request_with_auto_populated_field(): client.create_sample_query_set(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == sample_query_set_service.CreateSampleQuerySetRequest( + request_msg = sample_query_set_service.CreateSampleQuerySetRequest( parent="parent_value", sample_query_set_id="sample_query_set_id_value", ) + assert args[0] == request_msg def test_create_sample_query_set_use_cached_wrapped_rpc(): @@ -2431,9 +2452,15 @@ async def test_create_sample_query_set_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + sample_query_set_service.CreateSampleQuerySetRequest(), + {}, + ], +) async def test_create_sample_query_set_async( - transport: str = "grpc_asyncio", - request_type=sample_query_set_service.CreateSampleQuerySetRequest, + request_type, transport: str = "grpc_asyncio" ): client = SampleQuerySetServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2442,7 +2469,7 @@ async def test_create_sample_query_set_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( @@ -2471,11 +2498,6 @@ async def test_create_sample_query_set_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_create_sample_query_set_async_from_dict(): - await test_create_sample_query_set_async(request_type=dict) - - def test_create_sample_query_set_field_headers(): client = SampleQuerySetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2650,8 +2672,8 @@ async def test_create_sample_query_set_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - sample_query_set_service.UpdateSampleQuerySetRequest, - dict, + sample_query_set_service.UpdateSampleQuerySetRequest(), + {}, ], ) def test_update_sample_query_set(request_type, transport: str = "grpc"): @@ -2662,7 +2684,7 @@ def test_update_sample_query_set(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2712,7 +2734,8 @@ def test_update_sample_query_set_non_empty_request_with_auto_populated_field(): client.update_sample_query_set(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == sample_query_set_service.UpdateSampleQuerySetRequest() + request_msg = sample_query_set_service.UpdateSampleQuerySetRequest() + assert args[0] == request_msg def test_update_sample_query_set_use_cached_wrapped_rpc(): @@ -2798,9 +2821,15 @@ async def test_update_sample_query_set_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + sample_query_set_service.UpdateSampleQuerySetRequest(), + {}, + ], +) async def test_update_sample_query_set_async( - transport: str = "grpc_asyncio", - request_type=sample_query_set_service.UpdateSampleQuerySetRequest, + request_type, transport: str = "grpc_asyncio" ): client = SampleQuerySetServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2809,7 +2838,7 @@ async def test_update_sample_query_set_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( @@ -2838,11 +2867,6 @@ async def test_update_sample_query_set_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_update_sample_query_set_async_from_dict(): - await test_update_sample_query_set_async(request_type=dict) - - def test_update_sample_query_set_field_headers(): client = SampleQuerySetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3007,8 +3031,8 @@ async def test_update_sample_query_set_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - sample_query_set_service.DeleteSampleQuerySetRequest, - dict, + sample_query_set_service.DeleteSampleQuerySetRequest(), + {}, ], ) def test_delete_sample_query_set(request_type, transport: str = "grpc"): @@ -3019,7 +3043,7 @@ def test_delete_sample_query_set(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3064,9 +3088,10 @@ def test_delete_sample_query_set_non_empty_request_with_auto_populated_field(): client.delete_sample_query_set(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == sample_query_set_service.DeleteSampleQuerySetRequest( + request_msg = sample_query_set_service.DeleteSampleQuerySetRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_sample_query_set_use_cached_wrapped_rpc(): @@ -3152,9 +3177,15 @@ async def test_delete_sample_query_set_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + sample_query_set_service.DeleteSampleQuerySetRequest(), + {}, + ], +) async def test_delete_sample_query_set_async( - transport: str = "grpc_asyncio", - request_type=sample_query_set_service.DeleteSampleQuerySetRequest, + request_type, transport: str = "grpc_asyncio" ): client = SampleQuerySetServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3163,7 +3194,7 @@ async def test_delete_sample_query_set_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( @@ -3183,11 +3214,6 @@ async def test_delete_sample_query_set_async( assert response is None -@pytest.mark.asyncio -async def test_delete_sample_query_set_async_from_dict(): - await test_delete_sample_query_set_async(request_type=dict) - - def test_delete_sample_query_set_field_headers(): client = SampleQuerySetServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4489,7 +4515,6 @@ def test_get_sample_query_set_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sample_query_set_service.GetSampleQuerySetRequest() - assert args[0] == request_msg @@ -4512,7 +4537,6 @@ def test_list_sample_query_sets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sample_query_set_service.ListSampleQuerySetsRequest() - assert args[0] == request_msg @@ -4535,7 +4559,6 @@ def test_create_sample_query_set_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sample_query_set_service.CreateSampleQuerySetRequest() - assert args[0] == request_msg @@ -4558,7 +4581,6 @@ def test_update_sample_query_set_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sample_query_set_service.UpdateSampleQuerySetRequest() - assert args[0] == request_msg @@ -4581,7 +4603,6 @@ def test_delete_sample_query_set_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sample_query_set_service.DeleteSampleQuerySetRequest() - assert args[0] == request_msg @@ -4626,7 +4647,6 @@ async def test_get_sample_query_set_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sample_query_set_service.GetSampleQuerySetRequest() - assert args[0] == request_msg @@ -4655,7 +4675,6 @@ async def test_list_sample_query_sets_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sample_query_set_service.ListSampleQuerySetsRequest() - assert args[0] == request_msg @@ -4686,7 +4705,6 @@ async def test_create_sample_query_set_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sample_query_set_service.CreateSampleQuerySetRequest() - assert args[0] == request_msg @@ -4717,7 +4735,6 @@ async def test_update_sample_query_set_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sample_query_set_service.UpdateSampleQuerySetRequest() - assert args[0] == request_msg @@ -4742,7 +4759,6 @@ async def test_delete_sample_query_set_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sample_query_set_service.DeleteSampleQuerySetRequest() - assert args[0] == request_msg @@ -5820,7 +5836,6 @@ def test_get_sample_query_set_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sample_query_set_service.GetSampleQuerySetRequest() - assert args[0] == request_msg @@ -5842,7 +5857,6 @@ def test_list_sample_query_sets_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sample_query_set_service.ListSampleQuerySetsRequest() - assert args[0] == request_msg @@ -5864,7 +5878,6 @@ def test_create_sample_query_set_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sample_query_set_service.CreateSampleQuerySetRequest() - assert args[0] == request_msg @@ -5886,7 +5899,6 @@ def test_update_sample_query_set_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sample_query_set_service.UpdateSampleQuerySetRequest() - assert args[0] == request_msg @@ -5908,7 +5920,6 @@ def test_delete_sample_query_set_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sample_query_set_service.DeleteSampleQuerySetRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_schema_service.py b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_schema_service.py index ef499b4a6fd1..bfd49ed82854 100644 --- a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_schema_service.py +++ b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_schema_service.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 @@ -116,6 +117,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" @@ -1315,8 +1331,8 @@ def test_schema_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - schema_service.GetSchemaRequest, - dict, + schema_service.GetSchemaRequest(), + {}, ], ) def test_get_schema(request_type, transport: str = "grpc"): @@ -1327,7 +1343,7 @@ def test_get_schema(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_schema), "__call__") as call: @@ -1372,9 +1388,10 @@ def test_get_schema_non_empty_request_with_auto_populated_field(): client.get_schema(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == schema_service.GetSchemaRequest( + request_msg = schema_service.GetSchemaRequest( name="name_value", ) + assert args[0] == request_msg def test_get_schema_use_cached_wrapped_rpc(): @@ -1453,9 +1470,14 @@ async def test_get_schema_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_schema_async( - transport: str = "grpc_asyncio", request_type=schema_service.GetSchemaRequest -): +@pytest.mark.parametrize( + "request_type", + [ + schema_service.GetSchemaRequest(), + {}, + ], +) +async def test_get_schema_async(request_type, transport: str = "grpc_asyncio"): client = SchemaServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1463,7 +1485,7 @@ async def test_get_schema_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_schema), "__call__") as call: @@ -1486,11 +1508,6 @@ async def test_get_schema_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_schema_async_from_dict(): - await test_get_schema_async(request_type=dict) - - def test_get_schema_field_headers(): client = SchemaServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1633,8 +1650,8 @@ async def test_get_schema_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - schema_service.ListSchemasRequest, - dict, + schema_service.ListSchemasRequest(), + {}, ], ) def test_list_schemas(request_type, transport: str = "grpc"): @@ -1645,7 +1662,7 @@ def test_list_schemas(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_schemas), "__call__") as call: @@ -1690,10 +1707,11 @@ def test_list_schemas_non_empty_request_with_auto_populated_field(): client.list_schemas(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == schema_service.ListSchemasRequest( + request_msg = schema_service.ListSchemasRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_schemas_use_cached_wrapped_rpc(): @@ -1774,9 +1792,14 @@ async def test_list_schemas_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_schemas_async( - transport: str = "grpc_asyncio", request_type=schema_service.ListSchemasRequest -): +@pytest.mark.parametrize( + "request_type", + [ + schema_service.ListSchemasRequest(), + {}, + ], +) +async def test_list_schemas_async(request_type, transport: str = "grpc_asyncio"): client = SchemaServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1784,7 +1807,7 @@ async def test_list_schemas_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_schemas), "__call__") as call: @@ -1807,11 +1830,6 @@ async def test_list_schemas_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_schemas_async_from_dict(): - await test_list_schemas_async(request_type=dict) - - def test_list_schemas_field_headers(): client = SchemaServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2148,8 +2166,8 @@ async def test_list_schemas_async_pages(): @pytest.mark.parametrize( "request_type", [ - schema_service.CreateSchemaRequest, - dict, + schema_service.CreateSchemaRequest(), + {}, ], ) def test_create_schema(request_type, transport: str = "grpc"): @@ -2160,7 +2178,7 @@ def test_create_schema(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_schema), "__call__") as call: @@ -2202,10 +2220,11 @@ def test_create_schema_non_empty_request_with_auto_populated_field(): client.create_schema(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == schema_service.CreateSchemaRequest( + request_msg = schema_service.CreateSchemaRequest( parent="parent_value", schema_id="schema_id_value", ) + assert args[0] == request_msg def test_create_schema_use_cached_wrapped_rpc(): @@ -2296,9 +2315,14 @@ async def test_create_schema_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_schema_async( - transport: str = "grpc_asyncio", request_type=schema_service.CreateSchemaRequest -): +@pytest.mark.parametrize( + "request_type", + [ + schema_service.CreateSchemaRequest(), + {}, + ], +) +async def test_create_schema_async(request_type, transport: str = "grpc_asyncio"): client = SchemaServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2306,7 +2330,7 @@ async def test_create_schema_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_schema), "__call__") as call: @@ -2326,11 +2350,6 @@ async def test_create_schema_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_schema_async_from_dict(): - await test_create_schema_async(request_type=dict) - - def test_create_schema_field_headers(): client = SchemaServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2545,8 +2564,8 @@ async def test_create_schema_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - schema_service.UpdateSchemaRequest, - dict, + schema_service.UpdateSchemaRequest(), + {}, ], ) def test_update_schema(request_type, transport: str = "grpc"): @@ -2557,7 +2576,7 @@ def test_update_schema(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_schema), "__call__") as call: @@ -2596,7 +2615,8 @@ def test_update_schema_non_empty_request_with_auto_populated_field(): client.update_schema(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == schema_service.UpdateSchemaRequest() + request_msg = schema_service.UpdateSchemaRequest() + assert args[0] == request_msg def test_update_schema_use_cached_wrapped_rpc(): @@ -2687,9 +2707,14 @@ async def test_update_schema_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_schema_async( - transport: str = "grpc_asyncio", request_type=schema_service.UpdateSchemaRequest -): +@pytest.mark.parametrize( + "request_type", + [ + schema_service.UpdateSchemaRequest(), + {}, + ], +) +async def test_update_schema_async(request_type, transport: str = "grpc_asyncio"): client = SchemaServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2697,7 +2722,7 @@ async def test_update_schema_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_schema), "__call__") as call: @@ -2717,11 +2742,6 @@ async def test_update_schema_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_schema_async_from_dict(): - await test_update_schema_async(request_type=dict) - - def test_update_schema_field_headers(): client = SchemaServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2786,8 +2806,8 @@ async def test_update_schema_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - schema_service.DeleteSchemaRequest, - dict, + schema_service.DeleteSchemaRequest(), + {}, ], ) def test_delete_schema(request_type, transport: str = "grpc"): @@ -2798,7 +2818,7 @@ def test_delete_schema(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_schema), "__call__") as call: @@ -2839,9 +2859,10 @@ def test_delete_schema_non_empty_request_with_auto_populated_field(): client.delete_schema(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == schema_service.DeleteSchemaRequest( + request_msg = schema_service.DeleteSchemaRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_schema_use_cached_wrapped_rpc(): @@ -2932,9 +2953,14 @@ async def test_delete_schema_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_schema_async( - transport: str = "grpc_asyncio", request_type=schema_service.DeleteSchemaRequest -): +@pytest.mark.parametrize( + "request_type", + [ + schema_service.DeleteSchemaRequest(), + {}, + ], +) +async def test_delete_schema_async(request_type, transport: str = "grpc_asyncio"): client = SchemaServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2942,7 +2968,7 @@ async def test_delete_schema_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_schema), "__call__") as call: @@ -2962,11 +2988,6 @@ async def test_delete_schema_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_schema_async_from_dict(): - await test_delete_schema_async(request_type=dict) - - def test_delete_schema_field_headers(): client = SchemaServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4193,7 +4214,6 @@ def test_get_schema_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_service.GetSchemaRequest() - assert args[0] == request_msg @@ -4214,7 +4234,6 @@ def test_list_schemas_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_service.ListSchemasRequest() - assert args[0] == request_msg @@ -4235,7 +4254,6 @@ def test_create_schema_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_service.CreateSchemaRequest() - assert args[0] == request_msg @@ -4256,7 +4274,6 @@ def test_update_schema_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_service.UpdateSchemaRequest() - assert args[0] == request_msg @@ -4277,7 +4294,6 @@ def test_delete_schema_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_service.DeleteSchemaRequest() - assert args[0] == request_msg @@ -4318,7 +4334,6 @@ async def test_get_schema_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_service.GetSchemaRequest() - assert args[0] == request_msg @@ -4345,7 +4360,6 @@ async def test_list_schemas_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_service.ListSchemasRequest() - assert args[0] == request_msg @@ -4370,7 +4384,6 @@ async def test_create_schema_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_service.CreateSchemaRequest() - assert args[0] == request_msg @@ -4395,7 +4408,6 @@ async def test_update_schema_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_service.UpdateSchemaRequest() - assert args[0] == request_msg @@ -4420,7 +4432,6 @@ async def test_delete_schema_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_service.DeleteSchemaRequest() - assert args[0] == request_msg @@ -5452,7 +5463,6 @@ def test_get_schema_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_service.GetSchemaRequest() - assert args[0] == request_msg @@ -5472,7 +5482,6 @@ def test_list_schemas_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_service.ListSchemasRequest() - assert args[0] == request_msg @@ -5492,7 +5501,6 @@ def test_create_schema_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_service.CreateSchemaRequest() - assert args[0] == request_msg @@ -5512,7 +5520,6 @@ def test_update_schema_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_service.UpdateSchemaRequest() - assert args[0] == request_msg @@ -5532,7 +5539,6 @@ def test_delete_schema_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_service.DeleteSchemaRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_search_service.py b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_search_service.py index d8d1cd5e879a..7577a0133b43 100644 --- a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_search_service.py +++ b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_search_service.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 @@ -110,6 +111,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" @@ -1309,8 +1325,8 @@ def test_search_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - search_service.SearchRequest, - dict, + search_service.SearchRequest(), + {}, ], ) def test_search(request_type, transport: str = "grpc"): @@ -1321,7 +1337,7 @@ def test_search(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.search), "__call__") as call: @@ -1386,7 +1402,7 @@ def test_search_non_empty_request_with_auto_populated_field(): client.search(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == search_service.SearchRequest( + request_msg = search_service.SearchRequest( serving_config="serving_config_value", branch="branch_value", query="query_value", @@ -1400,6 +1416,7 @@ def test_search_non_empty_request_with_auto_populated_field(): ranking_expression="ranking_expression_value", session="session_value", ) + assert args[0] == request_msg def test_search_use_cached_wrapped_rpc(): @@ -1478,9 +1495,14 @@ async def test_search_async_use_cached_wrapped_rpc(transport: str = "grpc_asynci @pytest.mark.asyncio -async def test_search_async( - transport: str = "grpc_asyncio", request_type=search_service.SearchRequest -): +@pytest.mark.parametrize( + "request_type", + [ + search_service.SearchRequest(), + {}, + ], +) +async def test_search_async(request_type, transport: str = "grpc_asyncio"): client = SearchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1488,7 +1510,7 @@ async def test_search_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.search), "__call__") as call: @@ -1521,11 +1543,6 @@ async def test_search_async( assert response.applied_controls == ["applied_controls_value"] -@pytest.mark.asyncio -async def test_search_async_from_dict(): - await test_search_async(request_type=dict) - - def test_search_field_headers(): client = SearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1784,8 +1801,8 @@ async def test_search_async_pages(): @pytest.mark.parametrize( "request_type", [ - search_service.SearchRequest, - dict, + search_service.SearchRequest(), + {}, ], ) def test_search_lite(request_type, transport: str = "grpc"): @@ -1796,7 +1813,7 @@ def test_search_lite(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.search_lite), "__call__") as call: @@ -1861,7 +1878,7 @@ def test_search_lite_non_empty_request_with_auto_populated_field(): client.search_lite(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == search_service.SearchRequest( + request_msg = search_service.SearchRequest( serving_config="serving_config_value", branch="branch_value", query="query_value", @@ -1875,6 +1892,7 @@ def test_search_lite_non_empty_request_with_auto_populated_field(): ranking_expression="ranking_expression_value", session="session_value", ) + assert args[0] == request_msg def test_search_lite_use_cached_wrapped_rpc(): @@ -1955,9 +1973,14 @@ async def test_search_lite_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_search_lite_async( - transport: str = "grpc_asyncio", request_type=search_service.SearchRequest -): +@pytest.mark.parametrize( + "request_type", + [ + search_service.SearchRequest(), + {}, + ], +) +async def test_search_lite_async(request_type, transport: str = "grpc_asyncio"): client = SearchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1965,7 +1988,7 @@ async def test_search_lite_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.search_lite), "__call__") as call: @@ -1998,11 +2021,6 @@ async def test_search_lite_async( assert response.applied_controls == ["applied_controls_value"] -@pytest.mark.asyncio -async def test_search_lite_async_from_dict(): - await test_search_lite_async(request_type=dict) - - def test_search_lite_field_headers(): client = SearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2749,7 +2767,6 @@ def test_search_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = search_service.SearchRequest() - assert args[0] == request_msg @@ -2770,7 +2787,6 @@ def test_search_lite_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = search_service.SearchRequest() - assert args[0] == request_msg @@ -2816,7 +2832,6 @@ async def test_search_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = search_service.SearchRequest() - assert args[0] == request_msg @@ -2848,7 +2863,6 @@ async def test_search_lite_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = search_service.SearchRequest() - assert args[0] == request_msg @@ -3368,7 +3382,6 @@ def test_search_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = search_service.SearchRequest() - assert args[0] == request_msg @@ -3388,7 +3401,6 @@ def test_search_lite_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = search_service.SearchRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_search_tuning_service.py b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_search_tuning_service.py index fa65a073a509..4fb6529eea89 100644 --- a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_search_tuning_service.py +++ b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_search_tuning_service.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 @@ -116,6 +117,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" @@ -1379,8 +1395,8 @@ def test_search_tuning_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - search_tuning_service.TrainCustomModelRequest, - dict, + search_tuning_service.TrainCustomModelRequest(), + {}, ], ) def test_train_custom_model(request_type, transport: str = "grpc"): @@ -1391,7 +1407,7 @@ def test_train_custom_model(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1438,11 +1454,12 @@ def test_train_custom_model_non_empty_request_with_auto_populated_field(): client.train_custom_model(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == search_tuning_service.TrainCustomModelRequest( + request_msg = search_tuning_service.TrainCustomModelRequest( data_store="data_store_value", model_type="model_type_value", model_id="model_id_value", ) + assert args[0] == request_msg def test_train_custom_model_use_cached_wrapped_rpc(): @@ -1537,10 +1554,14 @@ async def test_train_custom_model_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_train_custom_model_async( - transport: str = "grpc_asyncio", - request_type=search_tuning_service.TrainCustomModelRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + search_tuning_service.TrainCustomModelRequest(), + {}, + ], +) +async def test_train_custom_model_async(request_type, transport: str = "grpc_asyncio"): client = SearchTuningServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1548,7 +1569,7 @@ async def test_train_custom_model_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( @@ -1570,11 +1591,6 @@ async def test_train_custom_model_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_train_custom_model_async_from_dict(): - await test_train_custom_model_async(request_type=dict) - - def test_train_custom_model_field_headers(): client = SearchTuningServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1643,8 +1659,8 @@ async def test_train_custom_model_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - search_tuning_service.ListCustomModelsRequest, - dict, + search_tuning_service.ListCustomModelsRequest(), + {}, ], ) def test_list_custom_models(request_type, transport: str = "grpc"): @@ -1655,7 +1671,7 @@ def test_list_custom_models(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1700,9 +1716,10 @@ def test_list_custom_models_non_empty_request_with_auto_populated_field(): client.list_custom_models(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == search_tuning_service.ListCustomModelsRequest( + request_msg = search_tuning_service.ListCustomModelsRequest( data_store="data_store_value", ) + assert args[0] == request_msg def test_list_custom_models_use_cached_wrapped_rpc(): @@ -1787,10 +1804,14 @@ async def test_list_custom_models_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_custom_models_async( - transport: str = "grpc_asyncio", - request_type=search_tuning_service.ListCustomModelsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + search_tuning_service.ListCustomModelsRequest(), + {}, + ], +) +async def test_list_custom_models_async(request_type, transport: str = "grpc_asyncio"): client = SearchTuningServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1798,7 +1819,7 @@ async def test_list_custom_models_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( @@ -1820,11 +1841,6 @@ async def test_list_custom_models_async( assert isinstance(response, search_tuning_service.ListCustomModelsResponse) -@pytest.mark.asyncio -async def test_list_custom_models_async_from_dict(): - await test_list_custom_models_async(request_type=dict) - - def test_list_custom_models_field_headers(): client = SearchTuningServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2267,7 +2283,6 @@ def test_train_custom_model_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = search_tuning_service.TrainCustomModelRequest() - assert args[0] == request_msg @@ -2290,7 +2305,6 @@ def test_list_custom_models_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = search_tuning_service.ListCustomModelsRequest() - assert args[0] == request_msg @@ -2331,7 +2345,6 @@ async def test_train_custom_model_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = search_tuning_service.TrainCustomModelRequest() - assert args[0] == request_msg @@ -2358,7 +2371,6 @@ async def test_list_custom_models_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = search_tuning_service.ListCustomModelsRequest() - assert args[0] == request_msg @@ -2865,7 +2877,6 @@ def test_train_custom_model_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = search_tuning_service.TrainCustomModelRequest() - assert args[0] == request_msg @@ -2887,7 +2898,6 @@ def test_list_custom_models_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = search_tuning_service.ListCustomModelsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_serving_config_service.py b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_serving_config_service.py index 74d4c5c9056b..d7d11290e047 100644 --- a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_serving_config_service.py +++ b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_serving_config_service.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 @@ -119,6 +120,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" @@ -1382,8 +1398,8 @@ def test_serving_config_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - serving_config_service.UpdateServingConfigRequest, - dict, + serving_config_service.UpdateServingConfigRequest(), + {}, ], ) def test_update_serving_config(request_type, transport: str = "grpc"): @@ -1394,7 +1410,7 @@ def test_update_serving_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( @@ -1466,7 +1482,8 @@ def test_update_serving_config_non_empty_request_with_auto_populated_field(): client.update_serving_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == serving_config_service.UpdateServingConfigRequest() + request_msg = serving_config_service.UpdateServingConfigRequest() + assert args[0] == request_msg def test_update_serving_config_use_cached_wrapped_rpc(): @@ -1552,9 +1569,15 @@ async def test_update_serving_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + serving_config_service.UpdateServingConfigRequest(), + {}, + ], +) async def test_update_serving_config_async( - transport: str = "grpc_asyncio", - request_type=serving_config_service.UpdateServingConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = ServingConfigServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1563,7 +1586,7 @@ async def test_update_serving_config_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( @@ -1614,11 +1637,6 @@ async def test_update_serving_config_async( assert response.ignore_control_ids == ["ignore_control_ids_value"] -@pytest.mark.asyncio -async def test_update_serving_config_async_from_dict(): - await test_update_serving_config_async(request_type=dict) - - def test_update_serving_config_field_headers(): client = ServingConfigServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1807,8 +1825,8 @@ async def test_update_serving_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - serving_config_service.GetServingConfigRequest, - dict, + serving_config_service.GetServingConfigRequest(), + {}, ], ) def test_get_serving_config(request_type, transport: str = "grpc"): @@ -1819,7 +1837,7 @@ def test_get_serving_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( @@ -1893,9 +1911,10 @@ def test_get_serving_config_non_empty_request_with_auto_populated_field(): client.get_serving_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == serving_config_service.GetServingConfigRequest( + request_msg = serving_config_service.GetServingConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_serving_config_use_cached_wrapped_rpc(): @@ -1980,10 +1999,14 @@ async def test_get_serving_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_serving_config_async( - transport: str = "grpc_asyncio", - request_type=serving_config_service.GetServingConfigRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + serving_config_service.GetServingConfigRequest(), + {}, + ], +) +async def test_get_serving_config_async(request_type, transport: str = "grpc_asyncio"): client = ServingConfigServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1991,7 +2014,7 @@ async def test_get_serving_config_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( @@ -2042,11 +2065,6 @@ async def test_get_serving_config_async( assert response.ignore_control_ids == ["ignore_control_ids_value"] -@pytest.mark.asyncio -async def test_get_serving_config_async_from_dict(): - await test_get_serving_config_async(request_type=dict) - - def test_get_serving_config_field_headers(): client = ServingConfigServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2201,8 +2219,8 @@ async def test_get_serving_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - serving_config_service.ListServingConfigsRequest, - dict, + serving_config_service.ListServingConfigsRequest(), + {}, ], ) def test_list_serving_configs(request_type, transport: str = "grpc"): @@ -2213,7 +2231,7 @@ def test_list_serving_configs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2262,10 +2280,11 @@ def test_list_serving_configs_non_empty_request_with_auto_populated_field(): client.list_serving_configs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == serving_config_service.ListServingConfigsRequest( + request_msg = serving_config_service.ListServingConfigsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_serving_configs_use_cached_wrapped_rpc(): @@ -2350,9 +2369,15 @@ async def test_list_serving_configs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + serving_config_service.ListServingConfigsRequest(), + {}, + ], +) async def test_list_serving_configs_async( - transport: str = "grpc_asyncio", - request_type=serving_config_service.ListServingConfigsRequest, + request_type, transport: str = "grpc_asyncio" ): client = ServingConfigServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2361,7 +2386,7 @@ async def test_list_serving_configs_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( @@ -2386,11 +2411,6 @@ async def test_list_serving_configs_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_serving_configs_async_from_dict(): - await test_list_serving_configs_async(request_type=dict) - - def test_list_serving_configs_field_headers(): client = ServingConfigServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3513,7 +3533,6 @@ def test_update_serving_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.UpdateServingConfigRequest() - assert args[0] == request_msg @@ -3536,7 +3555,6 @@ def test_get_serving_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.GetServingConfigRequest() - assert args[0] == request_msg @@ -3559,7 +3577,6 @@ def test_list_serving_configs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.ListServingConfigsRequest() - assert args[0] == request_msg @@ -3615,7 +3632,6 @@ async def test_update_serving_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.UpdateServingConfigRequest() - assert args[0] == request_msg @@ -3657,7 +3673,6 @@ async def test_get_serving_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.GetServingConfigRequest() - assert args[0] == request_msg @@ -3686,7 +3701,6 @@ async def test_list_serving_configs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.ListServingConfigsRequest() - assert args[0] == request_msg @@ -4541,7 +4555,6 @@ def test_update_serving_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.UpdateServingConfigRequest() - assert args[0] == request_msg @@ -4563,7 +4576,6 @@ def test_get_serving_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.GetServingConfigRequest() - assert args[0] == request_msg @@ -4585,7 +4597,6 @@ def test_list_serving_configs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.ListServingConfigsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_session_service.py b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_session_service.py index 757a7d035710..a40adf313373 100644 --- a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_session_service.py +++ b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_session_service.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 @@ -117,6 +118,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" @@ -1320,8 +1336,8 @@ def test_session_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - conversational_search_service.CreateSessionRequest, - dict, + conversational_search_service.CreateSessionRequest(), + {}, ], ) def test_create_session(request_type, transport: str = "grpc"): @@ -1332,7 +1348,7 @@ def test_create_session(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_session), "__call__") as call: @@ -1384,9 +1400,10 @@ def test_create_session_non_empty_request_with_auto_populated_field(): client.create_session(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversational_search_service.CreateSessionRequest( + request_msg = conversational_search_service.CreateSessionRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_session_use_cached_wrapped_rpc(): @@ -1467,10 +1484,14 @@ async def test_create_session_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_session_async( - transport: str = "grpc_asyncio", - request_type=conversational_search_service.CreateSessionRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + conversational_search_service.CreateSessionRequest(), + {}, + ], +) +async def test_create_session_async(request_type, transport: str = "grpc_asyncio"): client = SessionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1478,7 +1499,7 @@ async def test_create_session_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_session), "__call__") as call: @@ -1509,11 +1530,6 @@ async def test_create_session_async( assert response.is_pinned is True -@pytest.mark.asyncio -async def test_create_session_async_from_dict(): - await test_create_session_async(request_type=dict) - - def test_create_session_field_headers(): client = SessionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1666,8 +1682,8 @@ async def test_create_session_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversational_search_service.DeleteSessionRequest, - dict, + conversational_search_service.DeleteSessionRequest(), + {}, ], ) def test_delete_session(request_type, transport: str = "grpc"): @@ -1678,7 +1694,7 @@ def test_delete_session(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_session), "__call__") as call: @@ -1719,9 +1735,10 @@ def test_delete_session_non_empty_request_with_auto_populated_field(): client.delete_session(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversational_search_service.DeleteSessionRequest( + request_msg = conversational_search_service.DeleteSessionRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_session_use_cached_wrapped_rpc(): @@ -1802,10 +1819,14 @@ async def test_delete_session_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_session_async( - transport: str = "grpc_asyncio", - request_type=conversational_search_service.DeleteSessionRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + conversational_search_service.DeleteSessionRequest(), + {}, + ], +) +async def test_delete_session_async(request_type, transport: str = "grpc_asyncio"): client = SessionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1813,7 +1834,7 @@ async def test_delete_session_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_session), "__call__") as call: @@ -1831,11 +1852,6 @@ async def test_delete_session_async( assert response is None -@pytest.mark.asyncio -async def test_delete_session_async_from_dict(): - await test_delete_session_async(request_type=dict) - - def test_delete_session_field_headers(): client = SessionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1978,8 +1994,8 @@ async def test_delete_session_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversational_search_service.UpdateSessionRequest, - dict, + conversational_search_service.UpdateSessionRequest(), + {}, ], ) def test_update_session(request_type, transport: str = "grpc"): @@ -1990,7 +2006,7 @@ def test_update_session(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_session), "__call__") as call: @@ -2040,7 +2056,8 @@ def test_update_session_non_empty_request_with_auto_populated_field(): client.update_session(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversational_search_service.UpdateSessionRequest() + request_msg = conversational_search_service.UpdateSessionRequest() + assert args[0] == request_msg def test_update_session_use_cached_wrapped_rpc(): @@ -2121,10 +2138,14 @@ async def test_update_session_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_session_async( - transport: str = "grpc_asyncio", - request_type=conversational_search_service.UpdateSessionRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + conversational_search_service.UpdateSessionRequest(), + {}, + ], +) +async def test_update_session_async(request_type, transport: str = "grpc_asyncio"): client = SessionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2132,7 +2153,7 @@ async def test_update_session_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_session), "__call__") as call: @@ -2163,11 +2184,6 @@ async def test_update_session_async( assert response.is_pinned is True -@pytest.mark.asyncio -async def test_update_session_async_from_dict(): - await test_update_session_async(request_type=dict) - - def test_update_session_field_headers(): client = SessionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2320,8 +2336,8 @@ async def test_update_session_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversational_search_service.GetSessionRequest, - dict, + conversational_search_service.GetSessionRequest(), + {}, ], ) def test_get_session(request_type, transport: str = "grpc"): @@ -2332,7 +2348,7 @@ def test_get_session(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_session), "__call__") as call: @@ -2384,9 +2400,10 @@ def test_get_session_non_empty_request_with_auto_populated_field(): client.get_session(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversational_search_service.GetSessionRequest( + request_msg = conversational_search_service.GetSessionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_session_use_cached_wrapped_rpc(): @@ -2467,10 +2484,14 @@ async def test_get_session_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_session_async( - transport: str = "grpc_asyncio", - request_type=conversational_search_service.GetSessionRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + conversational_search_service.GetSessionRequest(), + {}, + ], +) +async def test_get_session_async(request_type, transport: str = "grpc_asyncio"): client = SessionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2478,7 +2499,7 @@ async def test_get_session_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_session), "__call__") as call: @@ -2509,11 +2530,6 @@ async def test_get_session_async( assert response.is_pinned is True -@pytest.mark.asyncio -async def test_get_session_async_from_dict(): - await test_get_session_async(request_type=dict) - - def test_get_session_field_headers(): client = SessionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2656,8 +2672,8 @@ async def test_get_session_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversational_search_service.ListSessionsRequest, - dict, + conversational_search_service.ListSessionsRequest(), + {}, ], ) def test_list_sessions(request_type, transport: str = "grpc"): @@ -2668,7 +2684,7 @@ def test_list_sessions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_sessions), "__call__") as call: @@ -2715,12 +2731,13 @@ def test_list_sessions_non_empty_request_with_auto_populated_field(): client.list_sessions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversational_search_service.ListSessionsRequest( + request_msg = conversational_search_service.ListSessionsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_sessions_use_cached_wrapped_rpc(): @@ -2801,10 +2818,14 @@ async def test_list_sessions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_sessions_async( - transport: str = "grpc_asyncio", - request_type=conversational_search_service.ListSessionsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + conversational_search_service.ListSessionsRequest(), + {}, + ], +) +async def test_list_sessions_async(request_type, transport: str = "grpc_asyncio"): client = SessionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2812,7 +2833,7 @@ async def test_list_sessions_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_sessions), "__call__") as call: @@ -2835,11 +2856,6 @@ async def test_list_sessions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_sessions_async_from_dict(): - await test_list_sessions_async(request_type=dict) - - def test_list_sessions_field_headers(): client = SessionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4295,7 +4311,6 @@ def test_create_session_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.CreateSessionRequest() - assert args[0] == request_msg @@ -4316,7 +4331,6 @@ def test_delete_session_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.DeleteSessionRequest() - assert args[0] == request_msg @@ -4337,7 +4351,6 @@ def test_update_session_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.UpdateSessionRequest() - assert args[0] == request_msg @@ -4358,7 +4371,6 @@ def test_get_session_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.GetSessionRequest() - assert args[0] == request_msg @@ -4379,7 +4391,6 @@ def test_list_sessions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.ListSessionsRequest() - assert args[0] == request_msg @@ -4424,7 +4435,6 @@ async def test_create_session_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.CreateSessionRequest() - assert args[0] == request_msg @@ -4447,7 +4457,6 @@ async def test_delete_session_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.DeleteSessionRequest() - assert args[0] == request_msg @@ -4478,7 +4487,6 @@ async def test_update_session_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.UpdateSessionRequest() - assert args[0] == request_msg @@ -4509,7 +4517,6 @@ async def test_get_session_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.GetSessionRequest() - assert args[0] == request_msg @@ -4536,7 +4543,6 @@ async def test_list_sessions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.ListSessionsRequest() - assert args[0] == request_msg @@ -5803,7 +5809,6 @@ def test_create_session_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.CreateSessionRequest() - assert args[0] == request_msg @@ -5823,7 +5828,6 @@ def test_delete_session_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.DeleteSessionRequest() - assert args[0] == request_msg @@ -5843,7 +5847,6 @@ def test_update_session_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.UpdateSessionRequest() - assert args[0] == request_msg @@ -5863,7 +5866,6 @@ def test_get_session_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.GetSessionRequest() - assert args[0] == request_msg @@ -5883,7 +5885,6 @@ def test_list_sessions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.ListSessionsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_site_search_engine_service.py b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_site_search_engine_service.py index 9b3cbc8f2425..9f0e13e9b98f 100644 --- a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_site_search_engine_service.py +++ b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_site_search_engine_service.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 @@ -118,6 +119,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" @@ -1387,8 +1403,8 @@ def test_site_search_engine_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - site_search_engine_service.GetSiteSearchEngineRequest, - dict, + site_search_engine_service.GetSiteSearchEngineRequest(), + {}, ], ) def test_get_site_search_engine(request_type, transport: str = "grpc"): @@ -1399,7 +1415,7 @@ def test_get_site_search_engine(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1447,9 +1463,10 @@ def test_get_site_search_engine_non_empty_request_with_auto_populated_field(): client.get_site_search_engine(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == site_search_engine_service.GetSiteSearchEngineRequest( + request_msg = site_search_engine_service.GetSiteSearchEngineRequest( name="name_value", ) + assert args[0] == request_msg def test_get_site_search_engine_use_cached_wrapped_rpc(): @@ -1535,9 +1552,15 @@ async def test_get_site_search_engine_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + site_search_engine_service.GetSiteSearchEngineRequest(), + {}, + ], +) async def test_get_site_search_engine_async( - transport: str = "grpc_asyncio", - request_type=site_search_engine_service.GetSiteSearchEngineRequest, + request_type, transport: str = "grpc_asyncio" ): client = SiteSearchEngineServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1546,7 +1569,7 @@ async def test_get_site_search_engine_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( @@ -1571,11 +1594,6 @@ async def test_get_site_search_engine_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_site_search_engine_async_from_dict(): - await test_get_site_search_engine_async(request_type=dict) - - def test_get_site_search_engine_field_headers(): client = SiteSearchEngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1730,8 +1748,8 @@ async def test_get_site_search_engine_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - site_search_engine_service.CreateTargetSiteRequest, - dict, + site_search_engine_service.CreateTargetSiteRequest(), + {}, ], ) def test_create_target_site(request_type, transport: str = "grpc"): @@ -1742,7 +1760,7 @@ def test_create_target_site(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1787,9 +1805,10 @@ def test_create_target_site_non_empty_request_with_auto_populated_field(): client.create_target_site(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == site_search_engine_service.CreateTargetSiteRequest( + request_msg = site_search_engine_service.CreateTargetSiteRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_target_site_use_cached_wrapped_rpc(): @@ -1884,10 +1903,14 @@ async def test_create_target_site_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_target_site_async( - transport: str = "grpc_asyncio", - request_type=site_search_engine_service.CreateTargetSiteRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + site_search_engine_service.CreateTargetSiteRequest(), + {}, + ], +) +async def test_create_target_site_async(request_type, transport: str = "grpc_asyncio"): client = SiteSearchEngineServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1895,7 +1918,7 @@ async def test_create_target_site_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( @@ -1917,11 +1940,6 @@ async def test_create_target_site_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_target_site_async_from_dict(): - await test_create_target_site_async(request_type=dict) - - def test_create_target_site_field_headers(): client = SiteSearchEngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2086,8 +2104,8 @@ async def test_create_target_site_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - site_search_engine_service.BatchCreateTargetSitesRequest, - dict, + site_search_engine_service.BatchCreateTargetSitesRequest(), + {}, ], ) def test_batch_create_target_sites(request_type, transport: str = "grpc"): @@ -2098,7 +2116,7 @@ def test_batch_create_target_sites(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2143,9 +2161,10 @@ def test_batch_create_target_sites_non_empty_request_with_auto_populated_field() client.batch_create_target_sites(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == site_search_engine_service.BatchCreateTargetSitesRequest( + request_msg = site_search_engine_service.BatchCreateTargetSitesRequest( parent="parent_value", ) + assert args[0] == request_msg def test_batch_create_target_sites_use_cached_wrapped_rpc(): @@ -2241,9 +2260,15 @@ async def test_batch_create_target_sites_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + site_search_engine_service.BatchCreateTargetSitesRequest(), + {}, + ], +) async def test_batch_create_target_sites_async( - transport: str = "grpc_asyncio", - request_type=site_search_engine_service.BatchCreateTargetSitesRequest, + request_type, transport: str = "grpc_asyncio" ): client = SiteSearchEngineServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2252,7 +2277,7 @@ async def test_batch_create_target_sites_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( @@ -2274,11 +2299,6 @@ async def test_batch_create_target_sites_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_batch_create_target_sites_async_from_dict(): - await test_batch_create_target_sites_async(request_type=dict) - - def test_batch_create_target_sites_field_headers(): client = SiteSearchEngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2347,8 +2367,8 @@ async def test_batch_create_target_sites_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - site_search_engine_service.GetTargetSiteRequest, - dict, + site_search_engine_service.GetTargetSiteRequest(), + {}, ], ) def test_get_target_site(request_type, transport: str = "grpc"): @@ -2359,7 +2379,7 @@ def test_get_target_site(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_target_site), "__call__") as call: @@ -2417,9 +2437,10 @@ def test_get_target_site_non_empty_request_with_auto_populated_field(): client.get_target_site(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == site_search_engine_service.GetTargetSiteRequest( + request_msg = site_search_engine_service.GetTargetSiteRequest( name="name_value", ) + assert args[0] == request_msg def test_get_target_site_use_cached_wrapped_rpc(): @@ -2500,10 +2521,14 @@ async def test_get_target_site_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_target_site_async( - transport: str = "grpc_asyncio", - request_type=site_search_engine_service.GetTargetSiteRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + site_search_engine_service.GetTargetSiteRequest(), + {}, + ], +) +async def test_get_target_site_async(request_type, transport: str = "grpc_asyncio"): client = SiteSearchEngineServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2511,7 +2536,7 @@ async def test_get_target_site_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_target_site), "__call__") as call: @@ -2548,11 +2573,6 @@ async def test_get_target_site_async( ) -@pytest.mark.asyncio -async def test_get_target_site_async_from_dict(): - await test_get_target_site_async(request_type=dict) - - def test_get_target_site_field_headers(): client = SiteSearchEngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2699,8 +2719,8 @@ async def test_get_target_site_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - site_search_engine_service.UpdateTargetSiteRequest, - dict, + site_search_engine_service.UpdateTargetSiteRequest(), + {}, ], ) def test_update_target_site(request_type, transport: str = "grpc"): @@ -2711,7 +2731,7 @@ def test_update_target_site(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2754,7 +2774,8 @@ def test_update_target_site_non_empty_request_with_auto_populated_field(): client.update_target_site(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == site_search_engine_service.UpdateTargetSiteRequest() + request_msg = site_search_engine_service.UpdateTargetSiteRequest() + assert args[0] == request_msg def test_update_target_site_use_cached_wrapped_rpc(): @@ -2849,10 +2870,14 @@ async def test_update_target_site_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_target_site_async( - transport: str = "grpc_asyncio", - request_type=site_search_engine_service.UpdateTargetSiteRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + site_search_engine_service.UpdateTargetSiteRequest(), + {}, + ], +) +async def test_update_target_site_async(request_type, transport: str = "grpc_asyncio"): client = SiteSearchEngineServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2860,7 +2885,7 @@ async def test_update_target_site_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( @@ -2882,11 +2907,6 @@ async def test_update_target_site_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_target_site_async_from_dict(): - await test_update_target_site_async(request_type=dict) - - def test_update_target_site_field_headers(): client = SiteSearchEngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3041,8 +3061,8 @@ async def test_update_target_site_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - site_search_engine_service.DeleteTargetSiteRequest, - dict, + site_search_engine_service.DeleteTargetSiteRequest(), + {}, ], ) def test_delete_target_site(request_type, transport: str = "grpc"): @@ -3053,7 +3073,7 @@ def test_delete_target_site(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3098,9 +3118,10 @@ def test_delete_target_site_non_empty_request_with_auto_populated_field(): client.delete_target_site(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == site_search_engine_service.DeleteTargetSiteRequest( + request_msg = site_search_engine_service.DeleteTargetSiteRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_target_site_use_cached_wrapped_rpc(): @@ -3195,10 +3216,14 @@ async def test_delete_target_site_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_target_site_async( - transport: str = "grpc_asyncio", - request_type=site_search_engine_service.DeleteTargetSiteRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + site_search_engine_service.DeleteTargetSiteRequest(), + {}, + ], +) +async def test_delete_target_site_async(request_type, transport: str = "grpc_asyncio"): client = SiteSearchEngineServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3206,7 +3231,7 @@ async def test_delete_target_site_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( @@ -3228,11 +3253,6 @@ async def test_delete_target_site_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_target_site_async_from_dict(): - await test_delete_target_site_async(request_type=dict) - - def test_delete_target_site_field_headers(): client = SiteSearchEngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3387,8 +3407,8 @@ async def test_delete_target_site_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - site_search_engine_service.ListTargetSitesRequest, - dict, + site_search_engine_service.ListTargetSitesRequest(), + {}, ], ) def test_list_target_sites(request_type, transport: str = "grpc"): @@ -3399,7 +3419,7 @@ def test_list_target_sites(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3450,10 +3470,11 @@ def test_list_target_sites_non_empty_request_with_auto_populated_field(): client.list_target_sites(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == site_search_engine_service.ListTargetSitesRequest( + request_msg = site_search_engine_service.ListTargetSitesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_target_sites_use_cached_wrapped_rpc(): @@ -3536,10 +3557,14 @@ async def test_list_target_sites_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_target_sites_async( - transport: str = "grpc_asyncio", - request_type=site_search_engine_service.ListTargetSitesRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + site_search_engine_service.ListTargetSitesRequest(), + {}, + ], +) +async def test_list_target_sites_async(request_type, transport: str = "grpc_asyncio"): client = SiteSearchEngineServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3547,7 +3572,7 @@ async def test_list_target_sites_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( @@ -3574,11 +3599,6 @@ async def test_list_target_sites_async( assert response.total_size == 1086 -@pytest.mark.asyncio -async def test_list_target_sites_async_from_dict(): - await test_list_target_sites_async(request_type=dict) - - def test_list_target_sites_field_headers(): client = SiteSearchEngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3931,8 +3951,8 @@ async def test_list_target_sites_async_pages(): @pytest.mark.parametrize( "request_type", [ - site_search_engine_service.CreateSitemapRequest, - dict, + site_search_engine_service.CreateSitemapRequest(), + {}, ], ) def test_create_sitemap(request_type, transport: str = "grpc"): @@ -3943,7 +3963,7 @@ def test_create_sitemap(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_sitemap), "__call__") as call: @@ -3984,9 +4004,10 @@ def test_create_sitemap_non_empty_request_with_auto_populated_field(): client.create_sitemap(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == site_search_engine_service.CreateSitemapRequest( + request_msg = site_search_engine_service.CreateSitemapRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_sitemap_use_cached_wrapped_rpc(): @@ -4077,10 +4098,14 @@ async def test_create_sitemap_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_sitemap_async( - transport: str = "grpc_asyncio", - request_type=site_search_engine_service.CreateSitemapRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + site_search_engine_service.CreateSitemapRequest(), + {}, + ], +) +async def test_create_sitemap_async(request_type, transport: str = "grpc_asyncio"): client = SiteSearchEngineServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4088,7 +4113,7 @@ async def test_create_sitemap_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_sitemap), "__call__") as call: @@ -4108,11 +4133,6 @@ async def test_create_sitemap_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_sitemap_async_from_dict(): - await test_create_sitemap_async(request_type=dict) - - def test_create_sitemap_field_headers(): client = SiteSearchEngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4269,8 +4289,8 @@ async def test_create_sitemap_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - site_search_engine_service.DeleteSitemapRequest, - dict, + site_search_engine_service.DeleteSitemapRequest(), + {}, ], ) def test_delete_sitemap(request_type, transport: str = "grpc"): @@ -4281,7 +4301,7 @@ def test_delete_sitemap(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_sitemap), "__call__") as call: @@ -4322,9 +4342,10 @@ def test_delete_sitemap_non_empty_request_with_auto_populated_field(): client.delete_sitemap(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == site_search_engine_service.DeleteSitemapRequest( + request_msg = site_search_engine_service.DeleteSitemapRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_sitemap_use_cached_wrapped_rpc(): @@ -4415,10 +4436,14 @@ async def test_delete_sitemap_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_sitemap_async( - transport: str = "grpc_asyncio", - request_type=site_search_engine_service.DeleteSitemapRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + site_search_engine_service.DeleteSitemapRequest(), + {}, + ], +) +async def test_delete_sitemap_async(request_type, transport: str = "grpc_asyncio"): client = SiteSearchEngineServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4426,7 +4451,7 @@ async def test_delete_sitemap_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_sitemap), "__call__") as call: @@ -4446,11 +4471,6 @@ async def test_delete_sitemap_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_sitemap_async_from_dict(): - await test_delete_sitemap_async(request_type=dict) - - def test_delete_sitemap_field_headers(): client = SiteSearchEngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4597,8 +4617,8 @@ async def test_delete_sitemap_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - site_search_engine_service.FetchSitemapsRequest, - dict, + site_search_engine_service.FetchSitemapsRequest(), + {}, ], ) def test_fetch_sitemaps(request_type, transport: str = "grpc"): @@ -4609,7 +4629,7 @@ def test_fetch_sitemaps(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.fetch_sitemaps), "__call__") as call: @@ -4650,9 +4670,10 @@ def test_fetch_sitemaps_non_empty_request_with_auto_populated_field(): client.fetch_sitemaps(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == site_search_engine_service.FetchSitemapsRequest( + request_msg = site_search_engine_service.FetchSitemapsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_fetch_sitemaps_use_cached_wrapped_rpc(): @@ -4733,10 +4754,14 @@ async def test_fetch_sitemaps_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_fetch_sitemaps_async( - transport: str = "grpc_asyncio", - request_type=site_search_engine_service.FetchSitemapsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + site_search_engine_service.FetchSitemapsRequest(), + {}, + ], +) +async def test_fetch_sitemaps_async(request_type, transport: str = "grpc_asyncio"): client = SiteSearchEngineServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4744,7 +4769,7 @@ async def test_fetch_sitemaps_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.fetch_sitemaps), "__call__") as call: @@ -4764,11 +4789,6 @@ async def test_fetch_sitemaps_async( assert isinstance(response, site_search_engine_service.FetchSitemapsResponse) -@pytest.mark.asyncio -async def test_fetch_sitemaps_async_from_dict(): - await test_fetch_sitemaps_async(request_type=dict) - - def test_fetch_sitemaps_field_headers(): client = SiteSearchEngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4915,8 +4935,8 @@ async def test_fetch_sitemaps_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - site_search_engine_service.EnableAdvancedSiteSearchRequest, - dict, + site_search_engine_service.EnableAdvancedSiteSearchRequest(), + {}, ], ) def test_enable_advanced_site_search(request_type, transport: str = "grpc"): @@ -4927,7 +4947,7 @@ def test_enable_advanced_site_search(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4972,9 +4992,10 @@ def test_enable_advanced_site_search_non_empty_request_with_auto_populated_field client.enable_advanced_site_search(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == site_search_engine_service.EnableAdvancedSiteSearchRequest( + request_msg = site_search_engine_service.EnableAdvancedSiteSearchRequest( site_search_engine="site_search_engine_value", ) + assert args[0] == request_msg def test_enable_advanced_site_search_use_cached_wrapped_rpc(): @@ -5070,9 +5091,15 @@ async def test_enable_advanced_site_search_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + site_search_engine_service.EnableAdvancedSiteSearchRequest(), + {}, + ], +) async def test_enable_advanced_site_search_async( - transport: str = "grpc_asyncio", - request_type=site_search_engine_service.EnableAdvancedSiteSearchRequest, + request_type, transport: str = "grpc_asyncio" ): client = SiteSearchEngineServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5081,7 +5108,7 @@ async def test_enable_advanced_site_search_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( @@ -5103,11 +5130,6 @@ async def test_enable_advanced_site_search_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_enable_advanced_site_search_async_from_dict(): - await test_enable_advanced_site_search_async(request_type=dict) - - def test_enable_advanced_site_search_field_headers(): client = SiteSearchEngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5176,8 +5198,8 @@ async def test_enable_advanced_site_search_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - site_search_engine_service.DisableAdvancedSiteSearchRequest, - dict, + site_search_engine_service.DisableAdvancedSiteSearchRequest(), + {}, ], ) def test_disable_advanced_site_search(request_type, transport: str = "grpc"): @@ -5188,7 +5210,7 @@ def test_disable_advanced_site_search(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5233,9 +5255,10 @@ def test_disable_advanced_site_search_non_empty_request_with_auto_populated_fiel client.disable_advanced_site_search(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == site_search_engine_service.DisableAdvancedSiteSearchRequest( + request_msg = site_search_engine_service.DisableAdvancedSiteSearchRequest( site_search_engine="site_search_engine_value", ) + assert args[0] == request_msg def test_disable_advanced_site_search_use_cached_wrapped_rpc(): @@ -5331,9 +5354,15 @@ async def test_disable_advanced_site_search_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + site_search_engine_service.DisableAdvancedSiteSearchRequest(), + {}, + ], +) async def test_disable_advanced_site_search_async( - transport: str = "grpc_asyncio", - request_type=site_search_engine_service.DisableAdvancedSiteSearchRequest, + request_type, transport: str = "grpc_asyncio" ): client = SiteSearchEngineServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5342,7 +5371,7 @@ async def test_disable_advanced_site_search_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( @@ -5364,11 +5393,6 @@ async def test_disable_advanced_site_search_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_disable_advanced_site_search_async_from_dict(): - await test_disable_advanced_site_search_async(request_type=dict) - - def test_disable_advanced_site_search_field_headers(): client = SiteSearchEngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5437,8 +5461,8 @@ async def test_disable_advanced_site_search_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - site_search_engine_service.RecrawlUrisRequest, - dict, + site_search_engine_service.RecrawlUrisRequest(), + {}, ], ) def test_recrawl_uris(request_type, transport: str = "grpc"): @@ -5449,7 +5473,7 @@ def test_recrawl_uris(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.recrawl_uris), "__call__") as call: @@ -5491,10 +5515,11 @@ def test_recrawl_uris_non_empty_request_with_auto_populated_field(): client.recrawl_uris(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == site_search_engine_service.RecrawlUrisRequest( + request_msg = site_search_engine_service.RecrawlUrisRequest( site_search_engine="site_search_engine_value", site_credential="site_credential_value", ) + assert args[0] == request_msg def test_recrawl_uris_use_cached_wrapped_rpc(): @@ -5585,10 +5610,14 @@ async def test_recrawl_uris_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_recrawl_uris_async( - transport: str = "grpc_asyncio", - request_type=site_search_engine_service.RecrawlUrisRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + site_search_engine_service.RecrawlUrisRequest(), + {}, + ], +) +async def test_recrawl_uris_async(request_type, transport: str = "grpc_asyncio"): client = SiteSearchEngineServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5596,7 +5625,7 @@ async def test_recrawl_uris_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.recrawl_uris), "__call__") as call: @@ -5616,11 +5645,6 @@ async def test_recrawl_uris_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_recrawl_uris_async_from_dict(): - await test_recrawl_uris_async(request_type=dict) - - def test_recrawl_uris_field_headers(): client = SiteSearchEngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5685,8 +5709,8 @@ async def test_recrawl_uris_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - site_search_engine_service.BatchVerifyTargetSitesRequest, - dict, + site_search_engine_service.BatchVerifyTargetSitesRequest(), + {}, ], ) def test_batch_verify_target_sites(request_type, transport: str = "grpc"): @@ -5697,7 +5721,7 @@ def test_batch_verify_target_sites(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5742,9 +5766,10 @@ def test_batch_verify_target_sites_non_empty_request_with_auto_populated_field() client.batch_verify_target_sites(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == site_search_engine_service.BatchVerifyTargetSitesRequest( + request_msg = site_search_engine_service.BatchVerifyTargetSitesRequest( parent="parent_value", ) + assert args[0] == request_msg def test_batch_verify_target_sites_use_cached_wrapped_rpc(): @@ -5840,9 +5865,15 @@ async def test_batch_verify_target_sites_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + site_search_engine_service.BatchVerifyTargetSitesRequest(), + {}, + ], +) async def test_batch_verify_target_sites_async( - transport: str = "grpc_asyncio", - request_type=site_search_engine_service.BatchVerifyTargetSitesRequest, + request_type, transport: str = "grpc_asyncio" ): client = SiteSearchEngineServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5851,7 +5882,7 @@ async def test_batch_verify_target_sites_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( @@ -5873,11 +5904,6 @@ async def test_batch_verify_target_sites_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_batch_verify_target_sites_async_from_dict(): - await test_batch_verify_target_sites_async(request_type=dict) - - def test_batch_verify_target_sites_field_headers(): client = SiteSearchEngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5946,8 +5972,8 @@ async def test_batch_verify_target_sites_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - site_search_engine_service.FetchDomainVerificationStatusRequest, - dict, + site_search_engine_service.FetchDomainVerificationStatusRequest(), + {}, ], ) def test_fetch_domain_verification_status(request_type, transport: str = "grpc"): @@ -5958,7 +5984,7 @@ def test_fetch_domain_verification_status(request_type, transport: str = "grpc") # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6011,12 +6037,11 @@ def test_fetch_domain_verification_status_non_empty_request_with_auto_populated_ client.fetch_domain_verification_status(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == site_search_engine_service.FetchDomainVerificationStatusRequest( + request_msg = site_search_engine_service.FetchDomainVerificationStatusRequest( site_search_engine="site_search_engine_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_fetch_domain_verification_status_use_cached_wrapped_rpc(): @@ -6102,9 +6127,15 @@ async def test_fetch_domain_verification_status_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + site_search_engine_service.FetchDomainVerificationStatusRequest(), + {}, + ], +) async def test_fetch_domain_verification_status_async( - transport: str = "grpc_asyncio", - request_type=site_search_engine_service.FetchDomainVerificationStatusRequest, + request_type, transport: str = "grpc_asyncio" ): client = SiteSearchEngineServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -6113,7 +6144,7 @@ async def test_fetch_domain_verification_status_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( @@ -6140,11 +6171,6 @@ async def test_fetch_domain_verification_status_async( assert response.total_size == 1086 -@pytest.mark.asyncio -async def test_fetch_domain_verification_status_async_from_dict(): - await test_fetch_domain_verification_status_async(request_type=dict) - - def test_fetch_domain_verification_status_field_headers(): client = SiteSearchEngineServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9146,7 +9172,6 @@ def test_get_site_search_engine_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.GetSiteSearchEngineRequest() - assert args[0] == request_msg @@ -9169,7 +9194,6 @@ def test_create_target_site_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.CreateTargetSiteRequest() - assert args[0] == request_msg @@ -9192,7 +9216,6 @@ def test_batch_create_target_sites_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.BatchCreateTargetSitesRequest() - assert args[0] == request_msg @@ -9213,7 +9236,6 @@ def test_get_target_site_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.GetTargetSiteRequest() - assert args[0] == request_msg @@ -9236,7 +9258,6 @@ def test_update_target_site_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.UpdateTargetSiteRequest() - assert args[0] == request_msg @@ -9259,7 +9280,6 @@ def test_delete_target_site_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.DeleteTargetSiteRequest() - assert args[0] == request_msg @@ -9282,7 +9302,6 @@ def test_list_target_sites_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.ListTargetSitesRequest() - assert args[0] == request_msg @@ -9303,7 +9322,6 @@ def test_create_sitemap_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.CreateSitemapRequest() - assert args[0] == request_msg @@ -9324,7 +9342,6 @@ def test_delete_sitemap_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.DeleteSitemapRequest() - assert args[0] == request_msg @@ -9345,7 +9362,6 @@ def test_fetch_sitemaps_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.FetchSitemapsRequest() - assert args[0] == request_msg @@ -9368,7 +9384,6 @@ def test_enable_advanced_site_search_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.EnableAdvancedSiteSearchRequest() - assert args[0] == request_msg @@ -9391,7 +9406,6 @@ def test_disable_advanced_site_search_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.DisableAdvancedSiteSearchRequest() - assert args[0] == request_msg @@ -9412,7 +9426,6 @@ def test_recrawl_uris_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.RecrawlUrisRequest() - assert args[0] == request_msg @@ -9435,7 +9448,6 @@ def test_batch_verify_target_sites_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.BatchVerifyTargetSitesRequest() - assert args[0] == request_msg @@ -9460,7 +9472,6 @@ def test_fetch_domain_verification_status_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.FetchDomainVerificationStatusRequest() - assert args[0] == request_msg @@ -9503,7 +9514,6 @@ async def test_get_site_search_engine_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.GetSiteSearchEngineRequest() - assert args[0] == request_msg @@ -9530,7 +9540,6 @@ async def test_create_target_site_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.CreateTargetSiteRequest() - assert args[0] == request_msg @@ -9557,7 +9566,6 @@ async def test_batch_create_target_sites_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.BatchCreateTargetSitesRequest() - assert args[0] == request_msg @@ -9590,7 +9598,6 @@ async def test_get_target_site_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.GetTargetSiteRequest() - assert args[0] == request_msg @@ -9617,7 +9624,6 @@ async def test_update_target_site_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.UpdateTargetSiteRequest() - assert args[0] == request_msg @@ -9644,7 +9650,6 @@ async def test_delete_target_site_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.DeleteTargetSiteRequest() - assert args[0] == request_msg @@ -9674,7 +9679,6 @@ async def test_list_target_sites_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.ListTargetSitesRequest() - assert args[0] == request_msg @@ -9699,7 +9703,6 @@ async def test_create_sitemap_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.CreateSitemapRequest() - assert args[0] == request_msg @@ -9724,7 +9727,6 @@ async def test_delete_sitemap_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.DeleteSitemapRequest() - assert args[0] == request_msg @@ -9749,7 +9751,6 @@ async def test_fetch_sitemaps_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.FetchSitemapsRequest() - assert args[0] == request_msg @@ -9776,7 +9777,6 @@ async def test_enable_advanced_site_search_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.EnableAdvancedSiteSearchRequest() - assert args[0] == request_msg @@ -9803,7 +9803,6 @@ async def test_disable_advanced_site_search_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.DisableAdvancedSiteSearchRequest() - assert args[0] == request_msg @@ -9828,7 +9827,6 @@ async def test_recrawl_uris_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.RecrawlUrisRequest() - assert args[0] == request_msg @@ -9855,7 +9853,6 @@ async def test_batch_verify_target_sites_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.BatchVerifyTargetSitesRequest() - assert args[0] == request_msg @@ -9885,7 +9882,6 @@ async def test_fetch_domain_verification_status_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.FetchDomainVerificationStatusRequest() - assert args[0] == request_msg @@ -12403,7 +12399,6 @@ def test_get_site_search_engine_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.GetSiteSearchEngineRequest() - assert args[0] == request_msg @@ -12425,7 +12420,6 @@ def test_create_target_site_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.CreateTargetSiteRequest() - assert args[0] == request_msg @@ -12447,7 +12441,6 @@ def test_batch_create_target_sites_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.BatchCreateTargetSitesRequest() - assert args[0] == request_msg @@ -12467,7 +12460,6 @@ def test_get_target_site_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.GetTargetSiteRequest() - assert args[0] == request_msg @@ -12489,7 +12481,6 @@ def test_update_target_site_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.UpdateTargetSiteRequest() - assert args[0] == request_msg @@ -12511,7 +12502,6 @@ def test_delete_target_site_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.DeleteTargetSiteRequest() - assert args[0] == request_msg @@ -12533,7 +12523,6 @@ def test_list_target_sites_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.ListTargetSitesRequest() - assert args[0] == request_msg @@ -12553,7 +12542,6 @@ def test_create_sitemap_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.CreateSitemapRequest() - assert args[0] == request_msg @@ -12573,7 +12561,6 @@ def test_delete_sitemap_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.DeleteSitemapRequest() - assert args[0] == request_msg @@ -12593,7 +12580,6 @@ def test_fetch_sitemaps_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.FetchSitemapsRequest() - assert args[0] == request_msg @@ -12615,7 +12601,6 @@ def test_enable_advanced_site_search_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.EnableAdvancedSiteSearchRequest() - assert args[0] == request_msg @@ -12637,7 +12622,6 @@ def test_disable_advanced_site_search_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.DisableAdvancedSiteSearchRequest() - assert args[0] == request_msg @@ -12657,7 +12641,6 @@ def test_recrawl_uris_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.RecrawlUrisRequest() - assert args[0] == request_msg @@ -12679,7 +12662,6 @@ def test_batch_verify_target_sites_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.BatchVerifyTargetSitesRequest() - assert args[0] == request_msg @@ -12701,7 +12683,6 @@ def test_fetch_domain_verification_status_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = site_search_engine_service.FetchDomainVerificationStatusRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_user_event_service.py b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_user_event_service.py index 4b788c7dae67..9f2095b27b6a 100644 --- a/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_user_event_service.py +++ b/packages/google-cloud-discoveryengine/tests/unit/gapic/discoveryengine_v1beta/test_user_event_service.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 @@ -123,6 +124,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" @@ -1356,8 +1372,8 @@ def test_user_event_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - user_event_service.WriteUserEventRequest, - dict, + user_event_service.WriteUserEventRequest(), + {}, ], ) def test_write_user_event(request_type, transport: str = "grpc"): @@ -1368,7 +1384,7 @@ def test_write_user_event(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.write_user_event), "__call__") as call: @@ -1430,9 +1446,10 @@ def test_write_user_event_non_empty_request_with_auto_populated_field(): client.write_user_event(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == user_event_service.WriteUserEventRequest( + request_msg = user_event_service.WriteUserEventRequest( parent="parent_value", ) + assert args[0] == request_msg def test_write_user_event_use_cached_wrapped_rpc(): @@ -1515,10 +1532,14 @@ async def test_write_user_event_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_write_user_event_async( - transport: str = "grpc_asyncio", - request_type=user_event_service.WriteUserEventRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + user_event_service.WriteUserEventRequest(), + {}, + ], +) +async def test_write_user_event_async(request_type, transport: str = "grpc_asyncio"): client = UserEventServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1526,7 +1547,7 @@ async def test_write_user_event_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.write_user_event), "__call__") as call: @@ -1567,11 +1588,6 @@ async def test_write_user_event_async( assert response.promotion_ids == ["promotion_ids_value"] -@pytest.mark.asyncio -async def test_write_user_event_async_from_dict(): - await test_write_user_event_async(request_type=dict) - - def test_write_user_event_field_headers(): client = UserEventServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1636,8 +1652,8 @@ async def test_write_user_event_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - user_event_service.CollectUserEventRequest, - dict, + user_event_service.CollectUserEventRequest(), + {}, ], ) def test_collect_user_event(request_type, transport: str = "grpc"): @@ -1648,7 +1664,7 @@ def test_collect_user_event(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1700,11 +1716,12 @@ def test_collect_user_event_non_empty_request_with_auto_populated_field(): client.collect_user_event(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == user_event_service.CollectUserEventRequest( + request_msg = user_event_service.CollectUserEventRequest( parent="parent_value", user_event="user_event_value", uri="uri_value", ) + assert args[0] == request_msg def test_collect_user_event_use_cached_wrapped_rpc(): @@ -1789,10 +1806,14 @@ async def test_collect_user_event_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_collect_user_event_async( - transport: str = "grpc_asyncio", - request_type=user_event_service.CollectUserEventRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + user_event_service.CollectUserEventRequest(), + {}, + ], +) +async def test_collect_user_event_async(request_type, transport: str = "grpc_asyncio"): client = UserEventServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1800,7 +1821,7 @@ async def test_collect_user_event_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( @@ -1827,11 +1848,6 @@ async def test_collect_user_event_async( assert response.data == b"data_blob" -@pytest.mark.asyncio -async def test_collect_user_event_async_from_dict(): - await test_collect_user_event_async(request_type=dict) - - def test_collect_user_event_field_headers(): client = UserEventServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1900,8 +1916,8 @@ async def test_collect_user_event_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - purge_config.PurgeUserEventsRequest, - dict, + purge_config.PurgeUserEventsRequest(), + {}, ], ) def test_purge_user_events(request_type, transport: str = "grpc"): @@ -1912,7 +1928,7 @@ def test_purge_user_events(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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 +1974,11 @@ def test_purge_user_events_non_empty_request_with_auto_populated_field(): client.purge_user_events(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == purge_config.PurgeUserEventsRequest( + request_msg = purge_config.PurgeUserEventsRequest( parent="parent_value", filter="filter_value", ) + assert args[0] == request_msg def test_purge_user_events_use_cached_wrapped_rpc(): @@ -2054,9 +2071,14 @@ async def test_purge_user_events_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_purge_user_events_async( - transport: str = "grpc_asyncio", request_type=purge_config.PurgeUserEventsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + purge_config.PurgeUserEventsRequest(), + {}, + ], +) +async def test_purge_user_events_async(request_type, transport: str = "grpc_asyncio"): client = UserEventServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2064,7 +2086,7 @@ async def test_purge_user_events_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( @@ -2086,11 +2108,6 @@ async def test_purge_user_events_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_purge_user_events_async_from_dict(): - await test_purge_user_events_async(request_type=dict) - - def test_purge_user_events_field_headers(): client = UserEventServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2159,8 +2176,8 @@ async def test_purge_user_events_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - import_config.ImportUserEventsRequest, - dict, + import_config.ImportUserEventsRequest(), + {}, ], ) def test_import_user_events(request_type, transport: str = "grpc"): @@ -2171,7 +2188,7 @@ def test_import_user_events(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2216,9 +2233,10 @@ def test_import_user_events_non_empty_request_with_auto_populated_field(): client.import_user_events(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == import_config.ImportUserEventsRequest( + request_msg = import_config.ImportUserEventsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_import_user_events_use_cached_wrapped_rpc(): @@ -2313,9 +2331,14 @@ async def test_import_user_events_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_import_user_events_async( - transport: str = "grpc_asyncio", request_type=import_config.ImportUserEventsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + import_config.ImportUserEventsRequest(), + {}, + ], +) +async def test_import_user_events_async(request_type, transport: str = "grpc_asyncio"): client = UserEventServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2323,7 +2346,7 @@ async def test_import_user_events_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( @@ -2345,11 +2368,6 @@ async def test_import_user_events_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_import_user_events_async_from_dict(): - await test_import_user_events_async(request_type=dict) - - def test_import_user_events_field_headers(): client = UserEventServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3090,7 +3108,6 @@ def test_write_user_event_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_event_service.WriteUserEventRequest() - assert args[0] == request_msg @@ -3113,7 +3130,6 @@ def test_collect_user_event_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_event_service.CollectUserEventRequest() - assert args[0] == request_msg @@ -3136,7 +3152,6 @@ def test_purge_user_events_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = purge_config.PurgeUserEventsRequest() - assert args[0] == request_msg @@ -3159,7 +3174,6 @@ def test_import_user_events_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_config.ImportUserEventsRequest() - assert args[0] == request_msg @@ -3209,7 +3223,6 @@ async def test_write_user_event_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_event_service.WriteUserEventRequest() - assert args[0] == request_msg @@ -3239,7 +3252,6 @@ async def test_collect_user_event_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_event_service.CollectUserEventRequest() - assert args[0] == request_msg @@ -3266,7 +3278,6 @@ async def test_purge_user_events_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = purge_config.PurgeUserEventsRequest() - assert args[0] == request_msg @@ -3293,7 +3304,6 @@ async def test_import_user_events_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_config.ImportUserEventsRequest() - assert args[0] == request_msg @@ -4189,7 +4199,6 @@ def test_write_user_event_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_event_service.WriteUserEventRequest() - assert args[0] == request_msg @@ -4211,7 +4220,6 @@ def test_collect_user_event_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_event_service.CollectUserEventRequest() - assert args[0] == request_msg @@ -4233,7 +4241,6 @@ def test_purge_user_events_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = purge_config.PurgeUserEventsRequest() - assert args[0] == request_msg @@ -4255,7 +4262,6 @@ def test_import_user_events_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_config.ImportUserEventsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dlp/noxfile.py b/packages/google-cloud-dlp/noxfile.py index f2102f32b479..08977f0c92b7 100644 --- a/packages/google-cloud-dlp/noxfile.py +++ b/packages/google-cloud-dlp/noxfile.py @@ -47,7 +47,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-dlp" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-dlp/setup.py b/packages/google-cloud-dlp/setup.py index a3638654d530..7f7d1bd82cad 100644 --- a/packages/google-cloud-dlp/setup.py +++ b/packages/google-cloud-dlp/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/google-cloud-dlp/testing/constraints-3.10.txt b/packages/google-cloud-dlp/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-dlp/testing/constraints-3.10.txt +++ b/packages/google-cloud-dlp/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-dlp/tests/unit/gapic/dlp_v2/test_dlp_service.py b/packages/google-cloud-dlp/tests/unit/gapic/dlp_v2/test_dlp_service.py index f1c61277cec0..8bc8fa6ad34c 100644 --- a/packages/google-cloud-dlp/tests/unit/gapic/dlp_v2/test_dlp_service.py +++ b/packages/google-cloud-dlp/tests/unit/gapic/dlp_v2/test_dlp_service.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 @@ -117,6 +118,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" @@ -1278,8 +1294,8 @@ def test_dlp_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - dlp.InspectContentRequest, - dict, + dlp.InspectContentRequest(), + {}, ], ) def test_inspect_content(request_type, transport: str = "grpc"): @@ -1290,7 +1306,7 @@ def test_inspect_content(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.inspect_content), "__call__") as call: @@ -1333,11 +1349,12 @@ def test_inspect_content_non_empty_request_with_auto_populated_field(): client.inspect_content(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dlp.InspectContentRequest( + request_msg = dlp.InspectContentRequest( parent="parent_value", inspect_template_name="inspect_template_name_value", location_id="location_id_value", ) + assert args[0] == request_msg def test_inspect_content_use_cached_wrapped_rpc(): @@ -1418,9 +1435,14 @@ async def test_inspect_content_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_inspect_content_async( - transport: str = "grpc_asyncio", request_type=dlp.InspectContentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dlp.InspectContentRequest(), + {}, + ], +) +async def test_inspect_content_async(request_type, transport: str = "grpc_asyncio"): client = DlpServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1428,7 +1450,7 @@ async def test_inspect_content_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.inspect_content), "__call__") as call: @@ -1448,11 +1470,6 @@ async def test_inspect_content_async( assert isinstance(response, dlp.InspectContentResponse) -@pytest.mark.asyncio -async def test_inspect_content_async_from_dict(): - await test_inspect_content_async(request_type=dict) - - def test_inspect_content_field_headers(): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1517,8 +1534,8 @@ async def test_inspect_content_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - dlp.RedactImageRequest, - dict, + dlp.RedactImageRequest(), + {}, ], ) def test_redact_image(request_type, transport: str = "grpc"): @@ -1529,7 +1546,7 @@ def test_redact_image(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.redact_image), "__call__") as call: @@ -1578,12 +1595,13 @@ def test_redact_image_non_empty_request_with_auto_populated_field(): client.redact_image(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dlp.RedactImageRequest( + request_msg = dlp.RedactImageRequest( parent="parent_value", location_id="location_id_value", inspect_template="inspect_template_value", deidentify_template="deidentify_template_value", ) + assert args[0] == request_msg def test_redact_image_use_cached_wrapped_rpc(): @@ -1664,9 +1682,14 @@ async def test_redact_image_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_redact_image_async( - transport: str = "grpc_asyncio", request_type=dlp.RedactImageRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dlp.RedactImageRequest(), + {}, + ], +) +async def test_redact_image_async(request_type, transport: str = "grpc_asyncio"): client = DlpServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1674,7 +1697,7 @@ async def test_redact_image_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.redact_image), "__call__") as call: @@ -1699,11 +1722,6 @@ async def test_redact_image_async( assert response.extracted_text == "extracted_text_value" -@pytest.mark.asyncio -async def test_redact_image_async_from_dict(): - await test_redact_image_async(request_type=dict) - - def test_redact_image_field_headers(): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1768,8 +1786,8 @@ async def test_redact_image_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - dlp.DeidentifyContentRequest, - dict, + dlp.DeidentifyContentRequest(), + {}, ], ) def test_deidentify_content(request_type, transport: str = "grpc"): @@ -1780,7 +1798,7 @@ def test_deidentify_content(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1828,12 +1846,13 @@ def test_deidentify_content_non_empty_request_with_auto_populated_field(): client.deidentify_content(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dlp.DeidentifyContentRequest( + request_msg = dlp.DeidentifyContentRequest( parent="parent_value", inspect_template_name="inspect_template_name_value", deidentify_template_name="deidentify_template_name_value", location_id="location_id_value", ) + assert args[0] == request_msg def test_deidentify_content_use_cached_wrapped_rpc(): @@ -1918,9 +1937,14 @@ async def test_deidentify_content_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_deidentify_content_async( - transport: str = "grpc_asyncio", request_type=dlp.DeidentifyContentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dlp.DeidentifyContentRequest(), + {}, + ], +) +async def test_deidentify_content_async(request_type, transport: str = "grpc_asyncio"): client = DlpServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1928,7 +1952,7 @@ async def test_deidentify_content_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( @@ -1950,11 +1974,6 @@ async def test_deidentify_content_async( assert isinstance(response, dlp.DeidentifyContentResponse) -@pytest.mark.asyncio -async def test_deidentify_content_async_from_dict(): - await test_deidentify_content_async(request_type=dict) - - def test_deidentify_content_field_headers(): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2023,8 +2042,8 @@ async def test_deidentify_content_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - dlp.ReidentifyContentRequest, - dict, + dlp.ReidentifyContentRequest(), + {}, ], ) def test_reidentify_content(request_type, transport: str = "grpc"): @@ -2035,7 +2054,7 @@ def test_reidentify_content(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2083,12 +2102,13 @@ def test_reidentify_content_non_empty_request_with_auto_populated_field(): client.reidentify_content(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dlp.ReidentifyContentRequest( + request_msg = dlp.ReidentifyContentRequest( parent="parent_value", inspect_template_name="inspect_template_name_value", reidentify_template_name="reidentify_template_name_value", location_id="location_id_value", ) + assert args[0] == request_msg def test_reidentify_content_use_cached_wrapped_rpc(): @@ -2173,9 +2193,14 @@ async def test_reidentify_content_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_reidentify_content_async( - transport: str = "grpc_asyncio", request_type=dlp.ReidentifyContentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dlp.ReidentifyContentRequest(), + {}, + ], +) +async def test_reidentify_content_async(request_type, transport: str = "grpc_asyncio"): client = DlpServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2183,7 +2208,7 @@ async def test_reidentify_content_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( @@ -2205,11 +2230,6 @@ async def test_reidentify_content_async( assert isinstance(response, dlp.ReidentifyContentResponse) -@pytest.mark.asyncio -async def test_reidentify_content_async_from_dict(): - await test_reidentify_content_async(request_type=dict) - - def test_reidentify_content_field_headers(): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2278,8 +2298,8 @@ async def test_reidentify_content_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - dlp.ListInfoTypesRequest, - dict, + dlp.ListInfoTypesRequest(), + {}, ], ) def test_list_info_types(request_type, transport: str = "grpc"): @@ -2290,7 +2310,7 @@ def test_list_info_types(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_info_types), "__call__") as call: @@ -2334,12 +2354,13 @@ def test_list_info_types_non_empty_request_with_auto_populated_field(): client.list_info_types(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dlp.ListInfoTypesRequest( + request_msg = dlp.ListInfoTypesRequest( parent="parent_value", language_code="language_code_value", filter="filter_value", location_id="location_id_value", ) + assert args[0] == request_msg def test_list_info_types_use_cached_wrapped_rpc(): @@ -2420,9 +2441,14 @@ async def test_list_info_types_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_info_types_async( - transport: str = "grpc_asyncio", request_type=dlp.ListInfoTypesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dlp.ListInfoTypesRequest(), + {}, + ], +) +async def test_list_info_types_async(request_type, transport: str = "grpc_asyncio"): client = DlpServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2430,7 +2456,7 @@ async def test_list_info_types_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_info_types), "__call__") as call: @@ -2450,11 +2476,6 @@ async def test_list_info_types_async( assert isinstance(response, dlp.ListInfoTypesResponse) -@pytest.mark.asyncio -async def test_list_info_types_async_from_dict(): - await test_list_info_types_async(request_type=dict) - - def test_list_info_types_flattened(): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2540,8 +2561,8 @@ async def test_list_info_types_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dlp.CreateInspectTemplateRequest, - dict, + dlp.CreateInspectTemplateRequest(), + {}, ], ) def test_create_inspect_template(request_type, transport: str = "grpc"): @@ -2552,7 +2573,7 @@ def test_create_inspect_template(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,11 +2627,12 @@ def test_create_inspect_template_non_empty_request_with_auto_populated_field(): client.create_inspect_template(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dlp.CreateInspectTemplateRequest( + request_msg = dlp.CreateInspectTemplateRequest( parent="parent_value", template_id="template_id_value", location_id="location_id_value", ) + assert args[0] == request_msg def test_create_inspect_template_use_cached_wrapped_rpc(): @@ -2696,8 +2718,15 @@ async def test_create_inspect_template_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dlp.CreateInspectTemplateRequest(), + {}, + ], +) async def test_create_inspect_template_async( - transport: str = "grpc_asyncio", request_type=dlp.CreateInspectTemplateRequest + request_type, transport: str = "grpc_asyncio" ): client = DlpServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2706,7 +2735,7 @@ async def test_create_inspect_template_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( @@ -2735,11 +2764,6 @@ async def test_create_inspect_template_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_create_inspect_template_async_from_dict(): - await test_create_inspect_template_async(request_type=dict) - - def test_create_inspect_template_field_headers(): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2900,8 +2924,8 @@ async def test_create_inspect_template_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dlp.UpdateInspectTemplateRequest, - dict, + dlp.UpdateInspectTemplateRequest(), + {}, ], ) def test_update_inspect_template(request_type, transport: str = "grpc"): @@ -2912,7 +2936,7 @@ def test_update_inspect_template(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2964,9 +2988,10 @@ def test_update_inspect_template_non_empty_request_with_auto_populated_field(): client.update_inspect_template(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dlp.UpdateInspectTemplateRequest( + request_msg = dlp.UpdateInspectTemplateRequest( name="name_value", ) + assert args[0] == request_msg def test_update_inspect_template_use_cached_wrapped_rpc(): @@ -3052,8 +3077,15 @@ async def test_update_inspect_template_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dlp.UpdateInspectTemplateRequest(), + {}, + ], +) async def test_update_inspect_template_async( - transport: str = "grpc_asyncio", request_type=dlp.UpdateInspectTemplateRequest + request_type, transport: str = "grpc_asyncio" ): client = DlpServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3062,7 +3094,7 @@ async def test_update_inspect_template_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( @@ -3091,11 +3123,6 @@ async def test_update_inspect_template_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_update_inspect_template_async_from_dict(): - await test_update_inspect_template_async(request_type=dict) - - def test_update_inspect_template_field_headers(): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3266,8 +3293,8 @@ async def test_update_inspect_template_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dlp.GetInspectTemplateRequest, - dict, + dlp.GetInspectTemplateRequest(), + {}, ], ) def test_get_inspect_template(request_type, transport: str = "grpc"): @@ -3278,7 +3305,7 @@ def test_get_inspect_template(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3330,9 +3357,10 @@ def test_get_inspect_template_non_empty_request_with_auto_populated_field(): client.get_inspect_template(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dlp.GetInspectTemplateRequest( + request_msg = dlp.GetInspectTemplateRequest( name="name_value", ) + assert args[0] == request_msg def test_get_inspect_template_use_cached_wrapped_rpc(): @@ -3417,8 +3445,15 @@ async def test_get_inspect_template_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dlp.GetInspectTemplateRequest(), + {}, + ], +) async def test_get_inspect_template_async( - transport: str = "grpc_asyncio", request_type=dlp.GetInspectTemplateRequest + request_type, transport: str = "grpc_asyncio" ): client = DlpServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3427,7 +3462,7 @@ async def test_get_inspect_template_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( @@ -3456,11 +3491,6 @@ async def test_get_inspect_template_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_get_inspect_template_async_from_dict(): - await test_get_inspect_template_async(request_type=dict) - - def test_get_inspect_template_field_headers(): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3611,8 +3641,8 @@ async def test_get_inspect_template_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dlp.ListInspectTemplatesRequest, - dict, + dlp.ListInspectTemplatesRequest(), + {}, ], ) def test_list_inspect_templates(request_type, transport: str = "grpc"): @@ -3623,7 +3653,7 @@ def test_list_inspect_templates(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3674,12 +3704,13 @@ def test_list_inspect_templates_non_empty_request_with_auto_populated_field(): client.list_inspect_templates(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dlp.ListInspectTemplatesRequest( + request_msg = dlp.ListInspectTemplatesRequest( parent="parent_value", page_token="page_token_value", order_by="order_by_value", location_id="location_id_value", ) + assert args[0] == request_msg def test_list_inspect_templates_use_cached_wrapped_rpc(): @@ -3765,8 +3796,15 @@ async def test_list_inspect_templates_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dlp.ListInspectTemplatesRequest(), + {}, + ], +) async def test_list_inspect_templates_async( - transport: str = "grpc_asyncio", request_type=dlp.ListInspectTemplatesRequest + request_type, transport: str = "grpc_asyncio" ): client = DlpServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3775,7 +3813,7 @@ async def test_list_inspect_templates_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( @@ -3800,11 +3838,6 @@ async def test_list_inspect_templates_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_inspect_templates_async_from_dict(): - await test_list_inspect_templates_async(request_type=dict) - - def test_list_inspect_templates_field_headers(): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4157,8 +4190,8 @@ async def test_list_inspect_templates_async_pages(): @pytest.mark.parametrize( "request_type", [ - dlp.DeleteInspectTemplateRequest, - dict, + dlp.DeleteInspectTemplateRequest(), + {}, ], ) def test_delete_inspect_template(request_type, transport: str = "grpc"): @@ -4169,7 +4202,7 @@ def test_delete_inspect_template(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4214,9 +4247,10 @@ def test_delete_inspect_template_non_empty_request_with_auto_populated_field(): client.delete_inspect_template(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dlp.DeleteInspectTemplateRequest( + request_msg = dlp.DeleteInspectTemplateRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_inspect_template_use_cached_wrapped_rpc(): @@ -4302,8 +4336,15 @@ async def test_delete_inspect_template_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dlp.DeleteInspectTemplateRequest(), + {}, + ], +) async def test_delete_inspect_template_async( - transport: str = "grpc_asyncio", request_type=dlp.DeleteInspectTemplateRequest + request_type, transport: str = "grpc_asyncio" ): client = DlpServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4312,7 +4353,7 @@ async def test_delete_inspect_template_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( @@ -4332,11 +4373,6 @@ async def test_delete_inspect_template_async( assert response is None -@pytest.mark.asyncio -async def test_delete_inspect_template_async_from_dict(): - await test_delete_inspect_template_async(request_type=dict) - - def test_delete_inspect_template_field_headers(): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4487,8 +4523,8 @@ async def test_delete_inspect_template_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dlp.CreateDeidentifyTemplateRequest, - dict, + dlp.CreateDeidentifyTemplateRequest(), + {}, ], ) def test_create_deidentify_template(request_type, transport: str = "grpc"): @@ -4499,7 +4535,7 @@ def test_create_deidentify_template(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4553,11 +4589,12 @@ def test_create_deidentify_template_non_empty_request_with_auto_populated_field( client.create_deidentify_template(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dlp.CreateDeidentifyTemplateRequest( + request_msg = dlp.CreateDeidentifyTemplateRequest( parent="parent_value", template_id="template_id_value", location_id="location_id_value", ) + assert args[0] == request_msg def test_create_deidentify_template_use_cached_wrapped_rpc(): @@ -4643,8 +4680,15 @@ async def test_create_deidentify_template_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dlp.CreateDeidentifyTemplateRequest(), + {}, + ], +) async def test_create_deidentify_template_async( - transport: str = "grpc_asyncio", request_type=dlp.CreateDeidentifyTemplateRequest + request_type, transport: str = "grpc_asyncio" ): client = DlpServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4653,7 +4697,7 @@ async def test_create_deidentify_template_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( @@ -4682,11 +4726,6 @@ async def test_create_deidentify_template_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_create_deidentify_template_async_from_dict(): - await test_create_deidentify_template_async(request_type=dict) - - def test_create_deidentify_template_field_headers(): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4851,8 +4890,8 @@ async def test_create_deidentify_template_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dlp.UpdateDeidentifyTemplateRequest, - dict, + dlp.UpdateDeidentifyTemplateRequest(), + {}, ], ) def test_update_deidentify_template(request_type, transport: str = "grpc"): @@ -4863,7 +4902,7 @@ def test_update_deidentify_template(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4915,9 +4954,10 @@ def test_update_deidentify_template_non_empty_request_with_auto_populated_field( client.update_deidentify_template(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dlp.UpdateDeidentifyTemplateRequest( + request_msg = dlp.UpdateDeidentifyTemplateRequest( name="name_value", ) + assert args[0] == request_msg def test_update_deidentify_template_use_cached_wrapped_rpc(): @@ -5003,8 +5043,15 @@ async def test_update_deidentify_template_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dlp.UpdateDeidentifyTemplateRequest(), + {}, + ], +) async def test_update_deidentify_template_async( - transport: str = "grpc_asyncio", request_type=dlp.UpdateDeidentifyTemplateRequest + request_type, transport: str = "grpc_asyncio" ): client = DlpServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5013,7 +5060,7 @@ async def test_update_deidentify_template_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( @@ -5042,11 +5089,6 @@ async def test_update_deidentify_template_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_update_deidentify_template_async_from_dict(): - await test_update_deidentify_template_async(request_type=dict) - - def test_update_deidentify_template_field_headers(): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5221,8 +5263,8 @@ async def test_update_deidentify_template_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dlp.GetDeidentifyTemplateRequest, - dict, + dlp.GetDeidentifyTemplateRequest(), + {}, ], ) def test_get_deidentify_template(request_type, transport: str = "grpc"): @@ -5233,7 +5275,7 @@ def test_get_deidentify_template(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5285,9 +5327,10 @@ def test_get_deidentify_template_non_empty_request_with_auto_populated_field(): client.get_deidentify_template(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dlp.GetDeidentifyTemplateRequest( + request_msg = dlp.GetDeidentifyTemplateRequest( name="name_value", ) + assert args[0] == request_msg def test_get_deidentify_template_use_cached_wrapped_rpc(): @@ -5373,8 +5416,15 @@ async def test_get_deidentify_template_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dlp.GetDeidentifyTemplateRequest(), + {}, + ], +) async def test_get_deidentify_template_async( - transport: str = "grpc_asyncio", request_type=dlp.GetDeidentifyTemplateRequest + request_type, transport: str = "grpc_asyncio" ): client = DlpServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5383,7 +5433,7 @@ async def test_get_deidentify_template_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( @@ -5412,11 +5462,6 @@ async def test_get_deidentify_template_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_get_deidentify_template_async_from_dict(): - await test_get_deidentify_template_async(request_type=dict) - - def test_get_deidentify_template_field_headers(): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5571,8 +5616,8 @@ async def test_get_deidentify_template_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dlp.ListDeidentifyTemplatesRequest, - dict, + dlp.ListDeidentifyTemplatesRequest(), + {}, ], ) def test_list_deidentify_templates(request_type, transport: str = "grpc"): @@ -5583,7 +5628,7 @@ def test_list_deidentify_templates(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5634,12 +5679,13 @@ def test_list_deidentify_templates_non_empty_request_with_auto_populated_field() client.list_deidentify_templates(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dlp.ListDeidentifyTemplatesRequest( + request_msg = dlp.ListDeidentifyTemplatesRequest( parent="parent_value", page_token="page_token_value", order_by="order_by_value", location_id="location_id_value", ) + assert args[0] == request_msg def test_list_deidentify_templates_use_cached_wrapped_rpc(): @@ -5725,8 +5771,15 @@ async def test_list_deidentify_templates_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dlp.ListDeidentifyTemplatesRequest(), + {}, + ], +) async def test_list_deidentify_templates_async( - transport: str = "grpc_asyncio", request_type=dlp.ListDeidentifyTemplatesRequest + request_type, transport: str = "grpc_asyncio" ): client = DlpServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5735,7 +5788,7 @@ async def test_list_deidentify_templates_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( @@ -5760,11 +5813,6 @@ async def test_list_deidentify_templates_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_deidentify_templates_async_from_dict(): - await test_list_deidentify_templates_async(request_type=dict) - - def test_list_deidentify_templates_field_headers(): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6119,8 +6167,8 @@ async def test_list_deidentify_templates_async_pages(): @pytest.mark.parametrize( "request_type", [ - dlp.DeleteDeidentifyTemplateRequest, - dict, + dlp.DeleteDeidentifyTemplateRequest(), + {}, ], ) def test_delete_deidentify_template(request_type, transport: str = "grpc"): @@ -6131,7 +6179,7 @@ def test_delete_deidentify_template(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6176,9 +6224,10 @@ def test_delete_deidentify_template_non_empty_request_with_auto_populated_field( client.delete_deidentify_template(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dlp.DeleteDeidentifyTemplateRequest( + request_msg = dlp.DeleteDeidentifyTemplateRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_deidentify_template_use_cached_wrapped_rpc(): @@ -6264,8 +6313,15 @@ async def test_delete_deidentify_template_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dlp.DeleteDeidentifyTemplateRequest(), + {}, + ], +) async def test_delete_deidentify_template_async( - transport: str = "grpc_asyncio", request_type=dlp.DeleteDeidentifyTemplateRequest + request_type, transport: str = "grpc_asyncio" ): client = DlpServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -6274,7 +6330,7 @@ async def test_delete_deidentify_template_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( @@ -6294,11 +6350,6 @@ async def test_delete_deidentify_template_async( assert response is None -@pytest.mark.asyncio -async def test_delete_deidentify_template_async_from_dict(): - await test_delete_deidentify_template_async(request_type=dict) - - def test_delete_deidentify_template_field_headers(): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6449,8 +6500,8 @@ async def test_delete_deidentify_template_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dlp.CreateJobTriggerRequest, - dict, + dlp.CreateJobTriggerRequest(), + {}, ], ) def test_create_job_trigger(request_type, transport: str = "grpc"): @@ -6461,7 +6512,7 @@ def test_create_job_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( @@ -6517,11 +6568,12 @@ def test_create_job_trigger_non_empty_request_with_auto_populated_field(): client.create_job_trigger(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dlp.CreateJobTriggerRequest( + request_msg = dlp.CreateJobTriggerRequest( parent="parent_value", trigger_id="trigger_id_value", location_id="location_id_value", ) + assert args[0] == request_msg def test_create_job_trigger_use_cached_wrapped_rpc(): @@ -6606,9 +6658,14 @@ async def test_create_job_trigger_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_job_trigger_async( - transport: str = "grpc_asyncio", request_type=dlp.CreateJobTriggerRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dlp.CreateJobTriggerRequest(), + {}, + ], +) +async def test_create_job_trigger_async(request_type, transport: str = "grpc_asyncio"): client = DlpServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6616,7 +6673,7 @@ async def test_create_job_trigger_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( @@ -6647,11 +6704,6 @@ async def test_create_job_trigger_async( assert response.status == dlp.JobTrigger.Status.HEALTHY -@pytest.mark.asyncio -async def test_create_job_trigger_async_from_dict(): - await test_create_job_trigger_async(request_type=dict) - - def test_create_job_trigger_field_headers(): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6812,8 +6864,8 @@ async def test_create_job_trigger_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dlp.UpdateJobTriggerRequest, - dict, + dlp.UpdateJobTriggerRequest(), + {}, ], ) def test_update_job_trigger(request_type, transport: str = "grpc"): @@ -6824,7 +6876,7 @@ def test_update_job_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( @@ -6878,9 +6930,10 @@ def test_update_job_trigger_non_empty_request_with_auto_populated_field(): client.update_job_trigger(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dlp.UpdateJobTriggerRequest( + request_msg = dlp.UpdateJobTriggerRequest( name="name_value", ) + assert args[0] == request_msg def test_update_job_trigger_use_cached_wrapped_rpc(): @@ -6965,9 +7018,14 @@ async def test_update_job_trigger_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_job_trigger_async( - transport: str = "grpc_asyncio", request_type=dlp.UpdateJobTriggerRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dlp.UpdateJobTriggerRequest(), + {}, + ], +) +async def test_update_job_trigger_async(request_type, transport: str = "grpc_asyncio"): client = DlpServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6975,7 +7033,7 @@ async def test_update_job_trigger_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( @@ -7006,11 +7064,6 @@ async def test_update_job_trigger_async( assert response.status == dlp.JobTrigger.Status.HEALTHY -@pytest.mark.asyncio -async def test_update_job_trigger_async_from_dict(): - await test_update_job_trigger_async(request_type=dict) - - def test_update_job_trigger_field_headers(): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7181,8 +7234,8 @@ async def test_update_job_trigger_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dlp.HybridInspectJobTriggerRequest, - dict, + dlp.HybridInspectJobTriggerRequest(), + {}, ], ) def test_hybrid_inspect_job_trigger(request_type, transport: str = "grpc"): @@ -7193,7 +7246,7 @@ def test_hybrid_inspect_job_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( @@ -7238,9 +7291,10 @@ def test_hybrid_inspect_job_trigger_non_empty_request_with_auto_populated_field( client.hybrid_inspect_job_trigger(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dlp.HybridInspectJobTriggerRequest( + request_msg = dlp.HybridInspectJobTriggerRequest( name="name_value", ) + assert args[0] == request_msg def test_hybrid_inspect_job_trigger_use_cached_wrapped_rpc(): @@ -7326,8 +7380,15 @@ async def test_hybrid_inspect_job_trigger_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dlp.HybridInspectJobTriggerRequest(), + {}, + ], +) async def test_hybrid_inspect_job_trigger_async( - transport: str = "grpc_asyncio", request_type=dlp.HybridInspectJobTriggerRequest + request_type, transport: str = "grpc_asyncio" ): client = DlpServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -7336,7 +7397,7 @@ async def test_hybrid_inspect_job_trigger_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( @@ -7358,11 +7419,6 @@ async def test_hybrid_inspect_job_trigger_async( assert isinstance(response, dlp.HybridInspectResponse) -@pytest.mark.asyncio -async def test_hybrid_inspect_job_trigger_async_from_dict(): - await test_hybrid_inspect_job_trigger_async(request_type=dict) - - def test_hybrid_inspect_job_trigger_field_headers(): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7517,8 +7573,8 @@ async def test_hybrid_inspect_job_trigger_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dlp.GetJobTriggerRequest, - dict, + dlp.GetJobTriggerRequest(), + {}, ], ) def test_get_job_trigger(request_type, transport: str = "grpc"): @@ -7529,7 +7585,7 @@ def test_get_job_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(type(client.transport.get_job_trigger), "__call__") as call: @@ -7579,9 +7635,10 @@ def test_get_job_trigger_non_empty_request_with_auto_populated_field(): client.get_job_trigger(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dlp.GetJobTriggerRequest( + request_msg = dlp.GetJobTriggerRequest( name="name_value", ) + assert args[0] == request_msg def test_get_job_trigger_use_cached_wrapped_rpc(): @@ -7662,9 +7719,14 @@ async def test_get_job_trigger_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_job_trigger_async( - transport: str = "grpc_asyncio", request_type=dlp.GetJobTriggerRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dlp.GetJobTriggerRequest(), + {}, + ], +) +async def test_get_job_trigger_async(request_type, transport: str = "grpc_asyncio"): client = DlpServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7672,7 +7734,7 @@ async def test_get_job_trigger_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_job_trigger), "__call__") as call: @@ -7701,11 +7763,6 @@ async def test_get_job_trigger_async( assert response.status == dlp.JobTrigger.Status.HEALTHY -@pytest.mark.asyncio -async def test_get_job_trigger_async_from_dict(): - await test_get_job_trigger_async(request_type=dict) - - def test_get_job_trigger_field_headers(): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7848,8 +7905,8 @@ async def test_get_job_trigger_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dlp.ListJobTriggersRequest, - dict, + dlp.ListJobTriggersRequest(), + {}, ], ) def test_list_job_triggers(request_type, transport: str = "grpc"): @@ -7860,7 +7917,7 @@ def test_list_job_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( @@ -7912,13 +7969,14 @@ def test_list_job_triggers_non_empty_request_with_auto_populated_field(): client.list_job_triggers(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dlp.ListJobTriggersRequest( + request_msg = dlp.ListJobTriggersRequest( parent="parent_value", page_token="page_token_value", order_by="order_by_value", filter="filter_value", location_id="location_id_value", ) + assert args[0] == request_msg def test_list_job_triggers_use_cached_wrapped_rpc(): @@ -8001,9 +8059,14 @@ async def test_list_job_triggers_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_job_triggers_async( - transport: str = "grpc_asyncio", request_type=dlp.ListJobTriggersRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dlp.ListJobTriggersRequest(), + {}, + ], +) +async def test_list_job_triggers_async(request_type, transport: str = "grpc_asyncio"): client = DlpServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8011,7 +8074,7 @@ async def test_list_job_triggers_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( @@ -8036,11 +8099,6 @@ async def test_list_job_triggers_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_job_triggers_async_from_dict(): - await test_list_job_triggers_async(request_type=dict) - - def test_list_job_triggers_field_headers(): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8393,8 +8451,8 @@ async def test_list_job_triggers_async_pages(): @pytest.mark.parametrize( "request_type", [ - dlp.DeleteJobTriggerRequest, - dict, + dlp.DeleteJobTriggerRequest(), + {}, ], ) def test_delete_job_trigger(request_type, transport: str = "grpc"): @@ -8405,7 +8463,7 @@ def test_delete_job_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( @@ -8450,9 +8508,10 @@ def test_delete_job_trigger_non_empty_request_with_auto_populated_field(): client.delete_job_trigger(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dlp.DeleteJobTriggerRequest( + request_msg = dlp.DeleteJobTriggerRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_job_trigger_use_cached_wrapped_rpc(): @@ -8537,9 +8596,14 @@ async def test_delete_job_trigger_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_job_trigger_async( - transport: str = "grpc_asyncio", request_type=dlp.DeleteJobTriggerRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dlp.DeleteJobTriggerRequest(), + {}, + ], +) +async def test_delete_job_trigger_async(request_type, transport: str = "grpc_asyncio"): client = DlpServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8547,7 +8611,7 @@ async def test_delete_job_trigger_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( @@ -8567,11 +8631,6 @@ async def test_delete_job_trigger_async( assert response is None -@pytest.mark.asyncio -async def test_delete_job_trigger_async_from_dict(): - await test_delete_job_trigger_async(request_type=dict) - - def test_delete_job_trigger_field_headers(): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8722,8 +8781,8 @@ async def test_delete_job_trigger_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dlp.ActivateJobTriggerRequest, - dict, + dlp.ActivateJobTriggerRequest(), + {}, ], ) def test_activate_job_trigger(request_type, transport: str = "grpc"): @@ -8734,7 +8793,7 @@ def test_activate_job_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( @@ -8788,9 +8847,10 @@ def test_activate_job_trigger_non_empty_request_with_auto_populated_field(): client.activate_job_trigger(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dlp.ActivateJobTriggerRequest( + request_msg = dlp.ActivateJobTriggerRequest( name="name_value", ) + assert args[0] == request_msg def test_activate_job_trigger_use_cached_wrapped_rpc(): @@ -8875,8 +8935,15 @@ async def test_activate_job_trigger_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dlp.ActivateJobTriggerRequest(), + {}, + ], +) async def test_activate_job_trigger_async( - transport: str = "grpc_asyncio", request_type=dlp.ActivateJobTriggerRequest + request_type, transport: str = "grpc_asyncio" ): client = DlpServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -8885,7 +8952,7 @@ async def test_activate_job_trigger_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( @@ -8916,11 +8983,6 @@ async def test_activate_job_trigger_async( assert response.job_trigger_name == "job_trigger_name_value" -@pytest.mark.asyncio -async def test_activate_job_trigger_async_from_dict(): - await test_activate_job_trigger_async(request_type=dict) - - def test_activate_job_trigger_field_headers(): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8987,8 +9049,8 @@ async def test_activate_job_trigger_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - dlp.CreateDiscoveryConfigRequest, - dict, + dlp.CreateDiscoveryConfigRequest(), + {}, ], ) def test_create_discovery_config(request_type, transport: str = "grpc"): @@ -8999,7 +9061,7 @@ def test_create_discovery_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( @@ -9054,10 +9116,11 @@ def test_create_discovery_config_non_empty_request_with_auto_populated_field(): client.create_discovery_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dlp.CreateDiscoveryConfigRequest( + request_msg = dlp.CreateDiscoveryConfigRequest( parent="parent_value", config_id="config_id_value", ) + assert args[0] == request_msg def test_create_discovery_config_use_cached_wrapped_rpc(): @@ -9143,8 +9206,15 @@ async def test_create_discovery_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dlp.CreateDiscoveryConfigRequest(), + {}, + ], +) async def test_create_discovery_config_async( - transport: str = "grpc_asyncio", request_type=dlp.CreateDiscoveryConfigRequest + request_type, transport: str = "grpc_asyncio" ): client = DlpServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -9153,7 +9223,7 @@ async def test_create_discovery_config_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( @@ -9184,11 +9254,6 @@ async def test_create_discovery_config_async( assert response.status == dlp.DiscoveryConfig.Status.RUNNING -@pytest.mark.asyncio -async def test_create_discovery_config_async_from_dict(): - await test_create_discovery_config_async(request_type=dict) - - def test_create_discovery_config_field_headers(): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9349,8 +9414,8 @@ async def test_create_discovery_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dlp.UpdateDiscoveryConfigRequest, - dict, + dlp.UpdateDiscoveryConfigRequest(), + {}, ], ) def test_update_discovery_config(request_type, transport: str = "grpc"): @@ -9361,7 +9426,7 @@ def test_update_discovery_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( @@ -9415,9 +9480,10 @@ def test_update_discovery_config_non_empty_request_with_auto_populated_field(): client.update_discovery_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dlp.UpdateDiscoveryConfigRequest( + request_msg = dlp.UpdateDiscoveryConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_update_discovery_config_use_cached_wrapped_rpc(): @@ -9503,8 +9569,15 @@ async def test_update_discovery_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dlp.UpdateDiscoveryConfigRequest(), + {}, + ], +) async def test_update_discovery_config_async( - transport: str = "grpc_asyncio", request_type=dlp.UpdateDiscoveryConfigRequest + request_type, transport: str = "grpc_asyncio" ): client = DlpServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -9513,7 +9586,7 @@ async def test_update_discovery_config_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( @@ -9544,11 +9617,6 @@ async def test_update_discovery_config_async( assert response.status == dlp.DiscoveryConfig.Status.RUNNING -@pytest.mark.asyncio -async def test_update_discovery_config_async_from_dict(): - await test_update_discovery_config_async(request_type=dict) - - def test_update_discovery_config_field_headers(): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9719,8 +9787,8 @@ async def test_update_discovery_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dlp.GetDiscoveryConfigRequest, - dict, + dlp.GetDiscoveryConfigRequest(), + {}, ], ) def test_get_discovery_config(request_type, transport: str = "grpc"): @@ -9731,7 +9799,7 @@ def test_get_discovery_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( @@ -9785,9 +9853,10 @@ def test_get_discovery_config_non_empty_request_with_auto_populated_field(): client.get_discovery_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dlp.GetDiscoveryConfigRequest( + request_msg = dlp.GetDiscoveryConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_discovery_config_use_cached_wrapped_rpc(): @@ -9872,8 +9941,15 @@ async def test_get_discovery_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dlp.GetDiscoveryConfigRequest(), + {}, + ], +) async def test_get_discovery_config_async( - transport: str = "grpc_asyncio", request_type=dlp.GetDiscoveryConfigRequest + request_type, transport: str = "grpc_asyncio" ): client = DlpServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -9882,7 +9958,7 @@ async def test_get_discovery_config_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( @@ -9913,11 +9989,6 @@ async def test_get_discovery_config_async( assert response.status == dlp.DiscoveryConfig.Status.RUNNING -@pytest.mark.asyncio -async def test_get_discovery_config_async_from_dict(): - await test_get_discovery_config_async(request_type=dict) - - def test_get_discovery_config_field_headers(): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10068,8 +10139,8 @@ async def test_get_discovery_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dlp.ListDiscoveryConfigsRequest, - dict, + dlp.ListDiscoveryConfigsRequest(), + {}, ], ) def test_list_discovery_configs(request_type, transport: str = "grpc"): @@ -10080,7 +10151,7 @@ def test_list_discovery_configs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10130,11 +10201,12 @@ def test_list_discovery_configs_non_empty_request_with_auto_populated_field(): client.list_discovery_configs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dlp.ListDiscoveryConfigsRequest( + request_msg = dlp.ListDiscoveryConfigsRequest( parent="parent_value", page_token="page_token_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_discovery_configs_use_cached_wrapped_rpc(): @@ -10220,8 +10292,15 @@ async def test_list_discovery_configs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dlp.ListDiscoveryConfigsRequest(), + {}, + ], +) async def test_list_discovery_configs_async( - transport: str = "grpc_asyncio", request_type=dlp.ListDiscoveryConfigsRequest + request_type, transport: str = "grpc_asyncio" ): client = DlpServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -10230,7 +10309,7 @@ async def test_list_discovery_configs_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( @@ -10255,11 +10334,6 @@ async def test_list_discovery_configs_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_discovery_configs_async_from_dict(): - await test_list_discovery_configs_async(request_type=dict) - - def test_list_discovery_configs_field_headers(): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10612,8 +10686,8 @@ async def test_list_discovery_configs_async_pages(): @pytest.mark.parametrize( "request_type", [ - dlp.DeleteDiscoveryConfigRequest, - dict, + dlp.DeleteDiscoveryConfigRequest(), + {}, ], ) def test_delete_discovery_config(request_type, transport: str = "grpc"): @@ -10624,7 +10698,7 @@ def test_delete_discovery_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( @@ -10669,9 +10743,10 @@ def test_delete_discovery_config_non_empty_request_with_auto_populated_field(): client.delete_discovery_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dlp.DeleteDiscoveryConfigRequest( + request_msg = dlp.DeleteDiscoveryConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_discovery_config_use_cached_wrapped_rpc(): @@ -10757,8 +10832,15 @@ async def test_delete_discovery_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dlp.DeleteDiscoveryConfigRequest(), + {}, + ], +) async def test_delete_discovery_config_async( - transport: str = "grpc_asyncio", request_type=dlp.DeleteDiscoveryConfigRequest + request_type, transport: str = "grpc_asyncio" ): client = DlpServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -10767,7 +10849,7 @@ async def test_delete_discovery_config_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( @@ -10787,11 +10869,6 @@ async def test_delete_discovery_config_async( assert response is None -@pytest.mark.asyncio -async def test_delete_discovery_config_async_from_dict(): - await test_delete_discovery_config_async(request_type=dict) - - def test_delete_discovery_config_field_headers(): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10942,8 +11019,8 @@ async def test_delete_discovery_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dlp.CreateDlpJobRequest, - dict, + dlp.CreateDlpJobRequest(), + {}, ], ) def test_create_dlp_job(request_type, transport: str = "grpc"): @@ -10954,7 +11031,7 @@ def test_create_dlp_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(type(client.transport.create_dlp_job), "__call__") as call: @@ -11006,11 +11083,12 @@ def test_create_dlp_job_non_empty_request_with_auto_populated_field(): client.create_dlp_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dlp.CreateDlpJobRequest( + request_msg = dlp.CreateDlpJobRequest( parent="parent_value", job_id="job_id_value", location_id="location_id_value", ) + assert args[0] == request_msg def test_create_dlp_job_use_cached_wrapped_rpc(): @@ -11091,9 +11169,14 @@ async def test_create_dlp_job_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_dlp_job_async( - transport: str = "grpc_asyncio", request_type=dlp.CreateDlpJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dlp.CreateDlpJobRequest(), + {}, + ], +) +async def test_create_dlp_job_async(request_type, transport: str = "grpc_asyncio"): client = DlpServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11101,7 +11184,7 @@ async def test_create_dlp_job_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_dlp_job), "__call__") as call: @@ -11130,11 +11213,6 @@ async def test_create_dlp_job_async( assert response.job_trigger_name == "job_trigger_name_value" -@pytest.mark.asyncio -async def test_create_dlp_job_async_from_dict(): - await test_create_dlp_job_async(request_type=dict) - - def test_create_dlp_job_field_headers(): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11347,8 +11425,8 @@ async def test_create_dlp_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dlp.ListDlpJobsRequest, - dict, + dlp.ListDlpJobsRequest(), + {}, ], ) def test_list_dlp_jobs(request_type, transport: str = "grpc"): @@ -11359,7 +11437,7 @@ def test_list_dlp_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(type(client.transport.list_dlp_jobs), "__call__") as call: @@ -11407,13 +11485,14 @@ def test_list_dlp_jobs_non_empty_request_with_auto_populated_field(): client.list_dlp_jobs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dlp.ListDlpJobsRequest( + request_msg = dlp.ListDlpJobsRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", order_by="order_by_value", location_id="location_id_value", ) + assert args[0] == request_msg def test_list_dlp_jobs_use_cached_wrapped_rpc(): @@ -11494,9 +11573,14 @@ async def test_list_dlp_jobs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_dlp_jobs_async( - transport: str = "grpc_asyncio", request_type=dlp.ListDlpJobsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dlp.ListDlpJobsRequest(), + {}, + ], +) +async def test_list_dlp_jobs_async(request_type, transport: str = "grpc_asyncio"): client = DlpServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11504,7 +11588,7 @@ async def test_list_dlp_jobs_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_dlp_jobs), "__call__") as call: @@ -11527,11 +11611,6 @@ async def test_list_dlp_jobs_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_dlp_jobs_async_from_dict(): - await test_list_dlp_jobs_async(request_type=dict) - - def test_list_dlp_jobs_field_headers(): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11868,8 +11947,8 @@ async def test_list_dlp_jobs_async_pages(): @pytest.mark.parametrize( "request_type", [ - dlp.GetDlpJobRequest, - dict, + dlp.GetDlpJobRequest(), + {}, ], ) def test_get_dlp_job(request_type, transport: str = "grpc"): @@ -11880,7 +11959,7 @@ def test_get_dlp_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(type(client.transport.get_dlp_job), "__call__") as call: @@ -11930,9 +12009,10 @@ def test_get_dlp_job_non_empty_request_with_auto_populated_field(): client.get_dlp_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dlp.GetDlpJobRequest( + request_msg = dlp.GetDlpJobRequest( name="name_value", ) + assert args[0] == request_msg def test_get_dlp_job_use_cached_wrapped_rpc(): @@ -12013,9 +12093,14 @@ async def test_get_dlp_job_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_dlp_job_async( - transport: str = "grpc_asyncio", request_type=dlp.GetDlpJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dlp.GetDlpJobRequest(), + {}, + ], +) +async def test_get_dlp_job_async(request_type, transport: str = "grpc_asyncio"): client = DlpServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12023,7 +12108,7 @@ async def test_get_dlp_job_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_dlp_job), "__call__") as call: @@ -12052,11 +12137,6 @@ async def test_get_dlp_job_async( assert response.job_trigger_name == "job_trigger_name_value" -@pytest.mark.asyncio -async def test_get_dlp_job_async_from_dict(): - await test_get_dlp_job_async(request_type=dict) - - def test_get_dlp_job_field_headers(): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12199,8 +12279,8 @@ async def test_get_dlp_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dlp.DeleteDlpJobRequest, - dict, + dlp.DeleteDlpJobRequest(), + {}, ], ) def test_delete_dlp_job(request_type, transport: str = "grpc"): @@ -12211,7 +12291,7 @@ def test_delete_dlp_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(type(client.transport.delete_dlp_job), "__call__") as call: @@ -12252,9 +12332,10 @@ def test_delete_dlp_job_non_empty_request_with_auto_populated_field(): client.delete_dlp_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dlp.DeleteDlpJobRequest( + request_msg = dlp.DeleteDlpJobRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_dlp_job_use_cached_wrapped_rpc(): @@ -12335,9 +12416,14 @@ async def test_delete_dlp_job_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_dlp_job_async( - transport: str = "grpc_asyncio", request_type=dlp.DeleteDlpJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dlp.DeleteDlpJobRequest(), + {}, + ], +) +async def test_delete_dlp_job_async(request_type, transport: str = "grpc_asyncio"): client = DlpServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12345,7 +12431,7 @@ async def test_delete_dlp_job_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_dlp_job), "__call__") as call: @@ -12363,11 +12449,6 @@ async def test_delete_dlp_job_async( assert response is None -@pytest.mark.asyncio -async def test_delete_dlp_job_async_from_dict(): - await test_delete_dlp_job_async(request_type=dict) - - def test_delete_dlp_job_field_headers(): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12510,8 +12591,8 @@ async def test_delete_dlp_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dlp.CancelDlpJobRequest, - dict, + dlp.CancelDlpJobRequest(), + {}, ], ) def test_cancel_dlp_job(request_type, transport: str = "grpc"): @@ -12522,7 +12603,7 @@ def test_cancel_dlp_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(type(client.transport.cancel_dlp_job), "__call__") as call: @@ -12563,9 +12644,10 @@ def test_cancel_dlp_job_non_empty_request_with_auto_populated_field(): client.cancel_dlp_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dlp.CancelDlpJobRequest( + request_msg = dlp.CancelDlpJobRequest( name="name_value", ) + assert args[0] == request_msg def test_cancel_dlp_job_use_cached_wrapped_rpc(): @@ -12646,9 +12728,14 @@ async def test_cancel_dlp_job_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_cancel_dlp_job_async( - transport: str = "grpc_asyncio", request_type=dlp.CancelDlpJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dlp.CancelDlpJobRequest(), + {}, + ], +) +async def test_cancel_dlp_job_async(request_type, transport: str = "grpc_asyncio"): client = DlpServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12656,7 +12743,7 @@ async def test_cancel_dlp_job_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.cancel_dlp_job), "__call__") as call: @@ -12674,11 +12761,6 @@ async def test_cancel_dlp_job_async( assert response is None -@pytest.mark.asyncio -async def test_cancel_dlp_job_async_from_dict(): - await test_cancel_dlp_job_async(request_type=dict) - - def test_cancel_dlp_job_field_headers(): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12741,8 +12823,8 @@ async def test_cancel_dlp_job_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - dlp.CreateStoredInfoTypeRequest, - dict, + dlp.CreateStoredInfoTypeRequest(), + {}, ], ) def test_create_stored_info_type(request_type, transport: str = "grpc"): @@ -12753,7 +12835,7 @@ def test_create_stored_info_type(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -12803,11 +12885,12 @@ def test_create_stored_info_type_non_empty_request_with_auto_populated_field(): client.create_stored_info_type(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dlp.CreateStoredInfoTypeRequest( + request_msg = dlp.CreateStoredInfoTypeRequest( parent="parent_value", stored_info_type_id="stored_info_type_id_value", location_id="location_id_value", ) + assert args[0] == request_msg def test_create_stored_info_type_use_cached_wrapped_rpc(): @@ -12893,8 +12976,15 @@ async def test_create_stored_info_type_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dlp.CreateStoredInfoTypeRequest(), + {}, + ], +) async def test_create_stored_info_type_async( - transport: str = "grpc_asyncio", request_type=dlp.CreateStoredInfoTypeRequest + request_type, transport: str = "grpc_asyncio" ): client = DlpServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -12903,7 +12993,7 @@ async def test_create_stored_info_type_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( @@ -12928,11 +13018,6 @@ async def test_create_stored_info_type_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_create_stored_info_type_async_from_dict(): - await test_create_stored_info_type_async(request_type=dict) - - def test_create_stored_info_type_field_headers(): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13093,8 +13178,8 @@ async def test_create_stored_info_type_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dlp.UpdateStoredInfoTypeRequest, - dict, + dlp.UpdateStoredInfoTypeRequest(), + {}, ], ) def test_update_stored_info_type(request_type, transport: str = "grpc"): @@ -13105,7 +13190,7 @@ def test_update_stored_info_type(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -13153,9 +13238,10 @@ def test_update_stored_info_type_non_empty_request_with_auto_populated_field(): client.update_stored_info_type(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dlp.UpdateStoredInfoTypeRequest( + request_msg = dlp.UpdateStoredInfoTypeRequest( name="name_value", ) + assert args[0] == request_msg def test_update_stored_info_type_use_cached_wrapped_rpc(): @@ -13241,8 +13327,15 @@ async def test_update_stored_info_type_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dlp.UpdateStoredInfoTypeRequest(), + {}, + ], +) async def test_update_stored_info_type_async( - transport: str = "grpc_asyncio", request_type=dlp.UpdateStoredInfoTypeRequest + request_type, transport: str = "grpc_asyncio" ): client = DlpServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -13251,7 +13344,7 @@ async def test_update_stored_info_type_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( @@ -13276,11 +13369,6 @@ async def test_update_stored_info_type_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_update_stored_info_type_async_from_dict(): - await test_update_stored_info_type_async(request_type=dict) - - def test_update_stored_info_type_field_headers(): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13451,8 +13539,8 @@ async def test_update_stored_info_type_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dlp.GetStoredInfoTypeRequest, - dict, + dlp.GetStoredInfoTypeRequest(), + {}, ], ) def test_get_stored_info_type(request_type, transport: str = "grpc"): @@ -13463,7 +13551,7 @@ def test_get_stored_info_type(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -13511,9 +13599,10 @@ def test_get_stored_info_type_non_empty_request_with_auto_populated_field(): client.get_stored_info_type(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dlp.GetStoredInfoTypeRequest( + request_msg = dlp.GetStoredInfoTypeRequest( name="name_value", ) + assert args[0] == request_msg def test_get_stored_info_type_use_cached_wrapped_rpc(): @@ -13598,8 +13687,15 @@ async def test_get_stored_info_type_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dlp.GetStoredInfoTypeRequest(), + {}, + ], +) async def test_get_stored_info_type_async( - transport: str = "grpc_asyncio", request_type=dlp.GetStoredInfoTypeRequest + request_type, transport: str = "grpc_asyncio" ): client = DlpServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -13608,7 +13704,7 @@ async def test_get_stored_info_type_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( @@ -13633,11 +13729,6 @@ async def test_get_stored_info_type_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_stored_info_type_async_from_dict(): - await test_get_stored_info_type_async(request_type=dict) - - def test_get_stored_info_type_field_headers(): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13788,8 +13879,8 @@ async def test_get_stored_info_type_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dlp.ListStoredInfoTypesRequest, - dict, + dlp.ListStoredInfoTypesRequest(), + {}, ], ) def test_list_stored_info_types(request_type, transport: str = "grpc"): @@ -13800,7 +13891,7 @@ def test_list_stored_info_types(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -13851,12 +13942,13 @@ def test_list_stored_info_types_non_empty_request_with_auto_populated_field(): client.list_stored_info_types(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dlp.ListStoredInfoTypesRequest( + request_msg = dlp.ListStoredInfoTypesRequest( parent="parent_value", page_token="page_token_value", order_by="order_by_value", location_id="location_id_value", ) + assert args[0] == request_msg def test_list_stored_info_types_use_cached_wrapped_rpc(): @@ -13942,8 +14034,15 @@ async def test_list_stored_info_types_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dlp.ListStoredInfoTypesRequest(), + {}, + ], +) async def test_list_stored_info_types_async( - transport: str = "grpc_asyncio", request_type=dlp.ListStoredInfoTypesRequest + request_type, transport: str = "grpc_asyncio" ): client = DlpServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -13952,7 +14051,7 @@ async def test_list_stored_info_types_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( @@ -13977,11 +14076,6 @@ async def test_list_stored_info_types_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_stored_info_types_async_from_dict(): - await test_list_stored_info_types_async(request_type=dict) - - def test_list_stored_info_types_field_headers(): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14334,8 +14428,8 @@ async def test_list_stored_info_types_async_pages(): @pytest.mark.parametrize( "request_type", [ - dlp.DeleteStoredInfoTypeRequest, - dict, + dlp.DeleteStoredInfoTypeRequest(), + {}, ], ) def test_delete_stored_info_type(request_type, transport: str = "grpc"): @@ -14346,7 +14440,7 @@ def test_delete_stored_info_type(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -14391,9 +14485,10 @@ def test_delete_stored_info_type_non_empty_request_with_auto_populated_field(): client.delete_stored_info_type(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dlp.DeleteStoredInfoTypeRequest( + request_msg = dlp.DeleteStoredInfoTypeRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_stored_info_type_use_cached_wrapped_rpc(): @@ -14479,8 +14574,15 @@ async def test_delete_stored_info_type_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dlp.DeleteStoredInfoTypeRequest(), + {}, + ], +) async def test_delete_stored_info_type_async( - transport: str = "grpc_asyncio", request_type=dlp.DeleteStoredInfoTypeRequest + request_type, transport: str = "grpc_asyncio" ): client = DlpServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -14489,7 +14591,7 @@ async def test_delete_stored_info_type_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( @@ -14509,11 +14611,6 @@ async def test_delete_stored_info_type_async( assert response is None -@pytest.mark.asyncio -async def test_delete_stored_info_type_async_from_dict(): - await test_delete_stored_info_type_async(request_type=dict) - - def test_delete_stored_info_type_field_headers(): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14664,8 +14761,8 @@ async def test_delete_stored_info_type_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dlp.ListProjectDataProfilesRequest, - dict, + dlp.ListProjectDataProfilesRequest(), + {}, ], ) def test_list_project_data_profiles(request_type, transport: str = "grpc"): @@ -14676,7 +14773,7 @@ def test_list_project_data_profiles(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -14727,12 +14824,13 @@ def test_list_project_data_profiles_non_empty_request_with_auto_populated_field( client.list_project_data_profiles(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dlp.ListProjectDataProfilesRequest( + request_msg = dlp.ListProjectDataProfilesRequest( parent="parent_value", page_token="page_token_value", order_by="order_by_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_project_data_profiles_use_cached_wrapped_rpc(): @@ -14818,8 +14916,15 @@ async def test_list_project_data_profiles_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dlp.ListProjectDataProfilesRequest(), + {}, + ], +) async def test_list_project_data_profiles_async( - transport: str = "grpc_asyncio", request_type=dlp.ListProjectDataProfilesRequest + request_type, transport: str = "grpc_asyncio" ): client = DlpServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -14828,7 +14933,7 @@ async def test_list_project_data_profiles_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( @@ -14853,11 +14958,6 @@ async def test_list_project_data_profiles_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_project_data_profiles_async_from_dict(): - await test_list_project_data_profiles_async(request_type=dict) - - def test_list_project_data_profiles_field_headers(): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15212,8 +15312,8 @@ async def test_list_project_data_profiles_async_pages(): @pytest.mark.parametrize( "request_type", [ - dlp.ListTableDataProfilesRequest, - dict, + dlp.ListTableDataProfilesRequest(), + {}, ], ) def test_list_table_data_profiles(request_type, transport: str = "grpc"): @@ -15224,7 +15324,7 @@ def test_list_table_data_profiles(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -15275,12 +15375,13 @@ def test_list_table_data_profiles_non_empty_request_with_auto_populated_field(): client.list_table_data_profiles(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dlp.ListTableDataProfilesRequest( + request_msg = dlp.ListTableDataProfilesRequest( parent="parent_value", page_token="page_token_value", order_by="order_by_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_table_data_profiles_use_cached_wrapped_rpc(): @@ -15366,8 +15467,15 @@ async def test_list_table_data_profiles_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dlp.ListTableDataProfilesRequest(), + {}, + ], +) async def test_list_table_data_profiles_async( - transport: str = "grpc_asyncio", request_type=dlp.ListTableDataProfilesRequest + request_type, transport: str = "grpc_asyncio" ): client = DlpServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -15376,7 +15484,7 @@ async def test_list_table_data_profiles_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( @@ -15401,11 +15509,6 @@ async def test_list_table_data_profiles_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_table_data_profiles_async_from_dict(): - await test_list_table_data_profiles_async(request_type=dict) - - def test_list_table_data_profiles_field_headers(): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15760,8 +15863,8 @@ async def test_list_table_data_profiles_async_pages(): @pytest.mark.parametrize( "request_type", [ - dlp.ListColumnDataProfilesRequest, - dict, + dlp.ListColumnDataProfilesRequest(), + {}, ], ) def test_list_column_data_profiles(request_type, transport: str = "grpc"): @@ -15772,7 +15875,7 @@ def test_list_column_data_profiles(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -15823,12 +15926,13 @@ def test_list_column_data_profiles_non_empty_request_with_auto_populated_field() client.list_column_data_profiles(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dlp.ListColumnDataProfilesRequest( + request_msg = dlp.ListColumnDataProfilesRequest( parent="parent_value", page_token="page_token_value", order_by="order_by_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_column_data_profiles_use_cached_wrapped_rpc(): @@ -15914,8 +16018,15 @@ async def test_list_column_data_profiles_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dlp.ListColumnDataProfilesRequest(), + {}, + ], +) async def test_list_column_data_profiles_async( - transport: str = "grpc_asyncio", request_type=dlp.ListColumnDataProfilesRequest + request_type, transport: str = "grpc_asyncio" ): client = DlpServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -15924,7 +16035,7 @@ async def test_list_column_data_profiles_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( @@ -15949,11 +16060,6 @@ async def test_list_column_data_profiles_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_column_data_profiles_async_from_dict(): - await test_list_column_data_profiles_async(request_type=dict) - - def test_list_column_data_profiles_field_headers(): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16308,8 +16414,8 @@ async def test_list_column_data_profiles_async_pages(): @pytest.mark.parametrize( "request_type", [ - dlp.GetProjectDataProfileRequest, - dict, + dlp.GetProjectDataProfileRequest(), + {}, ], ) def test_get_project_data_profile(request_type, transport: str = "grpc"): @@ -16320,7 +16426,7 @@ def test_get_project_data_profile(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -16374,9 +16480,10 @@ def test_get_project_data_profile_non_empty_request_with_auto_populated_field(): client.get_project_data_profile(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dlp.GetProjectDataProfileRequest( + request_msg = dlp.GetProjectDataProfileRequest( name="name_value", ) + assert args[0] == request_msg def test_get_project_data_profile_use_cached_wrapped_rpc(): @@ -16462,8 +16569,15 @@ async def test_get_project_data_profile_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dlp.GetProjectDataProfileRequest(), + {}, + ], +) async def test_get_project_data_profile_async( - transport: str = "grpc_asyncio", request_type=dlp.GetProjectDataProfileRequest + request_type, transport: str = "grpc_asyncio" ): client = DlpServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -16472,7 +16586,7 @@ async def test_get_project_data_profile_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( @@ -16503,11 +16617,6 @@ async def test_get_project_data_profile_async( assert response.file_store_data_profile_count == 3069 -@pytest.mark.asyncio -async def test_get_project_data_profile_async_from_dict(): - await test_get_project_data_profile_async(request_type=dict) - - def test_get_project_data_profile_field_headers(): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16662,8 +16771,8 @@ async def test_get_project_data_profile_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dlp.ListFileStoreDataProfilesRequest, - dict, + dlp.ListFileStoreDataProfilesRequest(), + {}, ], ) def test_list_file_store_data_profiles(request_type, transport: str = "grpc"): @@ -16674,7 +16783,7 @@ def test_list_file_store_data_profiles(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -16725,12 +16834,13 @@ def test_list_file_store_data_profiles_non_empty_request_with_auto_populated_fie client.list_file_store_data_profiles(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dlp.ListFileStoreDataProfilesRequest( + request_msg = dlp.ListFileStoreDataProfilesRequest( parent="parent_value", page_token="page_token_value", order_by="order_by_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_file_store_data_profiles_use_cached_wrapped_rpc(): @@ -16816,8 +16926,15 @@ async def test_list_file_store_data_profiles_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dlp.ListFileStoreDataProfilesRequest(), + {}, + ], +) async def test_list_file_store_data_profiles_async( - transport: str = "grpc_asyncio", request_type=dlp.ListFileStoreDataProfilesRequest + request_type, transport: str = "grpc_asyncio" ): client = DlpServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -16826,7 +16943,7 @@ async def test_list_file_store_data_profiles_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( @@ -16851,11 +16968,6 @@ async def test_list_file_store_data_profiles_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_file_store_data_profiles_async_from_dict(): - await test_list_file_store_data_profiles_async(request_type=dict) - - def test_list_file_store_data_profiles_field_headers(): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17212,8 +17324,8 @@ async def test_list_file_store_data_profiles_async_pages(): @pytest.mark.parametrize( "request_type", [ - dlp.GetFileStoreDataProfileRequest, - dict, + dlp.GetFileStoreDataProfileRequest(), + {}, ], ) def test_get_file_store_data_profile(request_type, transport: str = "grpc"): @@ -17224,7 +17336,7 @@ def test_get_file_store_data_profile(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -17295,9 +17407,10 @@ def test_get_file_store_data_profile_non_empty_request_with_auto_populated_field client.get_file_store_data_profile(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dlp.GetFileStoreDataProfileRequest( + request_msg = dlp.GetFileStoreDataProfileRequest( name="name_value", ) + assert args[0] == request_msg def test_get_file_store_data_profile_use_cached_wrapped_rpc(): @@ -17383,8 +17496,15 @@ async def test_get_file_store_data_profile_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dlp.GetFileStoreDataProfileRequest(), + {}, + ], +) async def test_get_file_store_data_profile_async( - transport: str = "grpc_asyncio", request_type=dlp.GetFileStoreDataProfileRequest + request_type, transport: str = "grpc_asyncio" ): client = DlpServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -17393,7 +17513,7 @@ async def test_get_file_store_data_profile_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( @@ -17441,11 +17561,6 @@ async def test_get_file_store_data_profile_async( assert response.file_store_is_empty is True -@pytest.mark.asyncio -async def test_get_file_store_data_profile_async_from_dict(): - await test_get_file_store_data_profile_async(request_type=dict) - - def test_get_file_store_data_profile_field_headers(): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17600,8 +17715,8 @@ async def test_get_file_store_data_profile_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dlp.DeleteFileStoreDataProfileRequest, - dict, + dlp.DeleteFileStoreDataProfileRequest(), + {}, ], ) def test_delete_file_store_data_profile(request_type, transport: str = "grpc"): @@ -17612,7 +17727,7 @@ def test_delete_file_store_data_profile(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -17657,9 +17772,10 @@ def test_delete_file_store_data_profile_non_empty_request_with_auto_populated_fi client.delete_file_store_data_profile(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dlp.DeleteFileStoreDataProfileRequest( + request_msg = dlp.DeleteFileStoreDataProfileRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_file_store_data_profile_use_cached_wrapped_rpc(): @@ -17745,8 +17861,15 @@ async def test_delete_file_store_data_profile_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dlp.DeleteFileStoreDataProfileRequest(), + {}, + ], +) async def test_delete_file_store_data_profile_async( - transport: str = "grpc_asyncio", request_type=dlp.DeleteFileStoreDataProfileRequest + request_type, transport: str = "grpc_asyncio" ): client = DlpServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -17755,7 +17878,7 @@ async def test_delete_file_store_data_profile_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( @@ -17775,11 +17898,6 @@ async def test_delete_file_store_data_profile_async( assert response is None -@pytest.mark.asyncio -async def test_delete_file_store_data_profile_async_from_dict(): - await test_delete_file_store_data_profile_async(request_type=dict) - - def test_delete_file_store_data_profile_field_headers(): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17930,8 +18048,8 @@ async def test_delete_file_store_data_profile_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dlp.GetTableDataProfileRequest, - dict, + dlp.GetTableDataProfileRequest(), + {}, ], ) def test_get_table_data_profile(request_type, transport: str = "grpc"): @@ -17942,7 +18060,7 @@ def test_get_table_data_profile(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -18019,9 +18137,10 @@ def test_get_table_data_profile_non_empty_request_with_auto_populated_field(): client.get_table_data_profile(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dlp.GetTableDataProfileRequest( + request_msg = dlp.GetTableDataProfileRequest( name="name_value", ) + assert args[0] == request_msg def test_get_table_data_profile_use_cached_wrapped_rpc(): @@ -18107,8 +18226,15 @@ async def test_get_table_data_profile_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dlp.GetTableDataProfileRequest(), + {}, + ], +) async def test_get_table_data_profile_async( - transport: str = "grpc_asyncio", request_type=dlp.GetTableDataProfileRequest + request_type, transport: str = "grpc_asyncio" ): client = DlpServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -18117,7 +18243,7 @@ async def test_get_table_data_profile_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( @@ -18171,11 +18297,6 @@ async def test_get_table_data_profile_async( ) -@pytest.mark.asyncio -async def test_get_table_data_profile_async_from_dict(): - await test_get_table_data_profile_async(request_type=dict) - - def test_get_table_data_profile_field_headers(): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18330,8 +18451,8 @@ async def test_get_table_data_profile_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dlp.GetColumnDataProfileRequest, - dict, + dlp.GetColumnDataProfileRequest(), + {}, ], ) def test_get_column_data_profile(request_type, transport: str = "grpc"): @@ -18342,7 +18463,7 @@ def test_get_column_data_profile(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -18425,9 +18546,10 @@ def test_get_column_data_profile_non_empty_request_with_auto_populated_field(): client.get_column_data_profile(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dlp.GetColumnDataProfileRequest( + request_msg = dlp.GetColumnDataProfileRequest( name="name_value", ) + assert args[0] == request_msg def test_get_column_data_profile_use_cached_wrapped_rpc(): @@ -18513,8 +18635,15 @@ async def test_get_column_data_profile_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dlp.GetColumnDataProfileRequest(), + {}, + ], +) async def test_get_column_data_profile_async( - transport: str = "grpc_asyncio", request_type=dlp.GetColumnDataProfileRequest + request_type, transport: str = "grpc_asyncio" ): client = DlpServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -18523,7 +18652,7 @@ async def test_get_column_data_profile_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( @@ -18583,11 +18712,6 @@ async def test_get_column_data_profile_async( ) -@pytest.mark.asyncio -async def test_get_column_data_profile_async_from_dict(): - await test_get_column_data_profile_async(request_type=dict) - - def test_get_column_data_profile_field_headers(): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18742,8 +18866,8 @@ async def test_get_column_data_profile_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dlp.DeleteTableDataProfileRequest, - dict, + dlp.DeleteTableDataProfileRequest(), + {}, ], ) def test_delete_table_data_profile(request_type, transport: str = "grpc"): @@ -18754,7 +18878,7 @@ def test_delete_table_data_profile(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -18799,9 +18923,10 @@ def test_delete_table_data_profile_non_empty_request_with_auto_populated_field() client.delete_table_data_profile(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dlp.DeleteTableDataProfileRequest( + request_msg = dlp.DeleteTableDataProfileRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_table_data_profile_use_cached_wrapped_rpc(): @@ -18887,8 +19012,15 @@ async def test_delete_table_data_profile_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dlp.DeleteTableDataProfileRequest(), + {}, + ], +) async def test_delete_table_data_profile_async( - transport: str = "grpc_asyncio", request_type=dlp.DeleteTableDataProfileRequest + request_type, transport: str = "grpc_asyncio" ): client = DlpServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -18897,7 +19029,7 @@ async def test_delete_table_data_profile_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( @@ -18917,11 +19049,6 @@ async def test_delete_table_data_profile_async( assert response is None -@pytest.mark.asyncio -async def test_delete_table_data_profile_async_from_dict(): - await test_delete_table_data_profile_async(request_type=dict) - - def test_delete_table_data_profile_field_headers(): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -19072,8 +19199,8 @@ async def test_delete_table_data_profile_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dlp.HybridInspectDlpJobRequest, - dict, + dlp.HybridInspectDlpJobRequest(), + {}, ], ) def test_hybrid_inspect_dlp_job(request_type, transport: str = "grpc"): @@ -19084,7 +19211,7 @@ def test_hybrid_inspect_dlp_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( @@ -19129,9 +19256,10 @@ def test_hybrid_inspect_dlp_job_non_empty_request_with_auto_populated_field(): client.hybrid_inspect_dlp_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dlp.HybridInspectDlpJobRequest( + request_msg = dlp.HybridInspectDlpJobRequest( name="name_value", ) + assert args[0] == request_msg def test_hybrid_inspect_dlp_job_use_cached_wrapped_rpc(): @@ -19217,8 +19345,15 @@ async def test_hybrid_inspect_dlp_job_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dlp.HybridInspectDlpJobRequest(), + {}, + ], +) async def test_hybrid_inspect_dlp_job_async( - transport: str = "grpc_asyncio", request_type=dlp.HybridInspectDlpJobRequest + request_type, transport: str = "grpc_asyncio" ): client = DlpServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -19227,7 +19362,7 @@ async def test_hybrid_inspect_dlp_job_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( @@ -19249,11 +19384,6 @@ async def test_hybrid_inspect_dlp_job_async( assert isinstance(response, dlp.HybridInspectResponse) -@pytest.mark.asyncio -async def test_hybrid_inspect_dlp_job_async_from_dict(): - await test_hybrid_inspect_dlp_job_async(request_type=dict) - - def test_hybrid_inspect_dlp_job_field_headers(): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -19408,8 +19538,8 @@ async def test_hybrid_inspect_dlp_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dlp.FinishDlpJobRequest, - dict, + dlp.FinishDlpJobRequest(), + {}, ], ) def test_finish_dlp_job(request_type, transport: str = "grpc"): @@ -19420,7 +19550,7 @@ def test_finish_dlp_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(type(client.transport.finish_dlp_job), "__call__") as call: @@ -19461,9 +19591,10 @@ def test_finish_dlp_job_non_empty_request_with_auto_populated_field(): client.finish_dlp_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dlp.FinishDlpJobRequest( + request_msg = dlp.FinishDlpJobRequest( name="name_value", ) + assert args[0] == request_msg def test_finish_dlp_job_use_cached_wrapped_rpc(): @@ -19544,9 +19675,14 @@ async def test_finish_dlp_job_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_finish_dlp_job_async( - transport: str = "grpc_asyncio", request_type=dlp.FinishDlpJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dlp.FinishDlpJobRequest(), + {}, + ], +) +async def test_finish_dlp_job_async(request_type, transport: str = "grpc_asyncio"): client = DlpServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -19554,7 +19690,7 @@ async def test_finish_dlp_job_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.finish_dlp_job), "__call__") as call: @@ -19572,11 +19708,6 @@ async def test_finish_dlp_job_async( assert response is None -@pytest.mark.asyncio -async def test_finish_dlp_job_async_from_dict(): - await test_finish_dlp_job_async(request_type=dict) - - def test_finish_dlp_job_field_headers(): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -19639,8 +19770,8 @@ async def test_finish_dlp_job_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - dlp.CreateConnectionRequest, - dict, + dlp.CreateConnectionRequest(), + {}, ], ) def test_create_connection(request_type, transport: str = "grpc"): @@ -19651,7 +19782,7 @@ def test_create_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( @@ -19701,9 +19832,10 @@ def test_create_connection_non_empty_request_with_auto_populated_field(): client.create_connection(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dlp.CreateConnectionRequest( + request_msg = dlp.CreateConnectionRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_connection_use_cached_wrapped_rpc(): @@ -19786,9 +19918,14 @@ async def test_create_connection_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_connection_async( - transport: str = "grpc_asyncio", request_type=dlp.CreateConnectionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dlp.CreateConnectionRequest(), + {}, + ], +) +async def test_create_connection_async(request_type, transport: str = "grpc_asyncio"): client = DlpServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -19796,7 +19933,7 @@ async def test_create_connection_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( @@ -19823,11 +19960,6 @@ async def test_create_connection_async( assert response.state == dlp.ConnectionState.MISSING_CREDENTIALS -@pytest.mark.asyncio -async def test_create_connection_async_from_dict(): - await test_create_connection_async(request_type=dict) - - def test_create_connection_field_headers(): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -19988,8 +20120,8 @@ async def test_create_connection_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dlp.GetConnectionRequest, - dict, + dlp.GetConnectionRequest(), + {}, ], ) def test_get_connection(request_type, transport: str = "grpc"): @@ -20000,7 +20132,7 @@ def test_get_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(type(client.transport.get_connection), "__call__") as call: @@ -20046,9 +20178,10 @@ def test_get_connection_non_empty_request_with_auto_populated_field(): client.get_connection(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dlp.GetConnectionRequest( + request_msg = dlp.GetConnectionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_connection_use_cached_wrapped_rpc(): @@ -20129,9 +20262,14 @@ async def test_get_connection_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_connection_async( - transport: str = "grpc_asyncio", request_type=dlp.GetConnectionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dlp.GetConnectionRequest(), + {}, + ], +) +async def test_get_connection_async(request_type, transport: str = "grpc_asyncio"): client = DlpServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -20139,7 +20277,7 @@ async def test_get_connection_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_connection), "__call__") as call: @@ -20164,11 +20302,6 @@ async def test_get_connection_async( assert response.state == dlp.ConnectionState.MISSING_CREDENTIALS -@pytest.mark.asyncio -async def test_get_connection_async_from_dict(): - await test_get_connection_async(request_type=dict) - - def test_get_connection_field_headers(): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -20311,8 +20444,8 @@ async def test_get_connection_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dlp.ListConnectionsRequest, - dict, + dlp.ListConnectionsRequest(), + {}, ], ) def test_list_connections(request_type, transport: str = "grpc"): @@ -20323,7 +20456,7 @@ def test_list_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(type(client.transport.list_connections), "__call__") as call: @@ -20369,11 +20502,12 @@ def test_list_connections_non_empty_request_with_auto_populated_field(): client.list_connections(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dlp.ListConnectionsRequest( + request_msg = dlp.ListConnectionsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_connections_use_cached_wrapped_rpc(): @@ -20456,9 +20590,14 @@ async def test_list_connections_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_connections_async( - transport: str = "grpc_asyncio", request_type=dlp.ListConnectionsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dlp.ListConnectionsRequest(), + {}, + ], +) +async def test_list_connections_async(request_type, transport: str = "grpc_asyncio"): client = DlpServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -20466,7 +20605,7 @@ async def test_list_connections_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_connections), "__call__") as call: @@ -20489,11 +20628,6 @@ async def test_list_connections_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_connections_async_from_dict(): - await test_list_connections_async(request_type=dict) - - def test_list_connections_field_headers(): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -20830,8 +20964,8 @@ async def test_list_connections_async_pages(): @pytest.mark.parametrize( "request_type", [ - dlp.SearchConnectionsRequest, - dict, + dlp.SearchConnectionsRequest(), + {}, ], ) def test_search_connections(request_type, transport: str = "grpc"): @@ -20842,7 +20976,7 @@ def test_search_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( @@ -20892,11 +21026,12 @@ def test_search_connections_non_empty_request_with_auto_populated_field(): client.search_connections(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dlp.SearchConnectionsRequest( + request_msg = dlp.SearchConnectionsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_search_connections_use_cached_wrapped_rpc(): @@ -20981,9 +21116,14 @@ async def test_search_connections_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_search_connections_async( - transport: str = "grpc_asyncio", request_type=dlp.SearchConnectionsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dlp.SearchConnectionsRequest(), + {}, + ], +) +async def test_search_connections_async(request_type, transport: str = "grpc_asyncio"): client = DlpServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -20991,7 +21131,7 @@ async def test_search_connections_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( @@ -21016,11 +21156,6 @@ async def test_search_connections_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_search_connections_async_from_dict(): - await test_search_connections_async(request_type=dict) - - def test_search_connections_field_headers(): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -21373,8 +21508,8 @@ async def test_search_connections_async_pages(): @pytest.mark.parametrize( "request_type", [ - dlp.DeleteConnectionRequest, - dict, + dlp.DeleteConnectionRequest(), + {}, ], ) def test_delete_connection(request_type, transport: str = "grpc"): @@ -21385,7 +21520,7 @@ def test_delete_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( @@ -21430,9 +21565,10 @@ def test_delete_connection_non_empty_request_with_auto_populated_field(): client.delete_connection(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dlp.DeleteConnectionRequest( + request_msg = dlp.DeleteConnectionRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_connection_use_cached_wrapped_rpc(): @@ -21515,9 +21651,14 @@ async def test_delete_connection_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_connection_async( - transport: str = "grpc_asyncio", request_type=dlp.DeleteConnectionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dlp.DeleteConnectionRequest(), + {}, + ], +) +async def test_delete_connection_async(request_type, transport: str = "grpc_asyncio"): client = DlpServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -21525,7 +21666,7 @@ async def test_delete_connection_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( @@ -21545,11 +21686,6 @@ async def test_delete_connection_async( assert response is None -@pytest.mark.asyncio -async def test_delete_connection_async_from_dict(): - await test_delete_connection_async(request_type=dict) - - def test_delete_connection_field_headers(): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -21700,8 +21836,8 @@ async def test_delete_connection_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dlp.UpdateConnectionRequest, - dict, + dlp.UpdateConnectionRequest(), + {}, ], ) def test_update_connection(request_type, transport: str = "grpc"): @@ -21712,7 +21848,7 @@ def test_update_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( @@ -21762,9 +21898,10 @@ def test_update_connection_non_empty_request_with_auto_populated_field(): client.update_connection(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dlp.UpdateConnectionRequest( + request_msg = dlp.UpdateConnectionRequest( name="name_value", ) + assert args[0] == request_msg def test_update_connection_use_cached_wrapped_rpc(): @@ -21847,9 +21984,14 @@ async def test_update_connection_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_connection_async( - transport: str = "grpc_asyncio", request_type=dlp.UpdateConnectionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dlp.UpdateConnectionRequest(), + {}, + ], +) +async def test_update_connection_async(request_type, transport: str = "grpc_asyncio"): client = DlpServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -21857,7 +21999,7 @@ async def test_update_connection_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( @@ -21884,11 +22026,6 @@ async def test_update_connection_async( assert response.state == dlp.ConnectionState.MISSING_CREDENTIALS -@pytest.mark.asyncio -async def test_update_connection_async_from_dict(): - await test_update_connection_async(request_type=dict) - - def test_update_connection_field_headers(): client = DlpServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -32443,7 +32580,6 @@ def test_inspect_content_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.InspectContentRequest() - assert args[0] == request_msg @@ -32464,7 +32600,6 @@ def test_redact_image_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.RedactImageRequest() - assert args[0] == request_msg @@ -32487,7 +32622,6 @@ def test_deidentify_content_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.DeidentifyContentRequest() - assert args[0] == request_msg @@ -32510,7 +32644,6 @@ def test_reidentify_content_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.ReidentifyContentRequest() - assert args[0] == request_msg @@ -32531,7 +32664,6 @@ def test_list_info_types_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.ListInfoTypesRequest() - assert args[0] == request_msg @@ -32554,7 +32686,6 @@ def test_create_inspect_template_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.CreateInspectTemplateRequest() - assert args[0] == request_msg @@ -32577,7 +32708,6 @@ def test_update_inspect_template_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.UpdateInspectTemplateRequest() - assert args[0] == request_msg @@ -32600,7 +32730,6 @@ def test_get_inspect_template_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.GetInspectTemplateRequest() - assert args[0] == request_msg @@ -32623,7 +32752,6 @@ def test_list_inspect_templates_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.ListInspectTemplatesRequest() - assert args[0] == request_msg @@ -32646,7 +32774,6 @@ def test_delete_inspect_template_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.DeleteInspectTemplateRequest() - assert args[0] == request_msg @@ -32669,7 +32796,6 @@ def test_create_deidentify_template_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.CreateDeidentifyTemplateRequest() - assert args[0] == request_msg @@ -32692,7 +32818,6 @@ def test_update_deidentify_template_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.UpdateDeidentifyTemplateRequest() - assert args[0] == request_msg @@ -32715,7 +32840,6 @@ def test_get_deidentify_template_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.GetDeidentifyTemplateRequest() - assert args[0] == request_msg @@ -32738,7 +32862,6 @@ def test_list_deidentify_templates_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.ListDeidentifyTemplatesRequest() - assert args[0] == request_msg @@ -32761,7 +32884,6 @@ def test_delete_deidentify_template_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.DeleteDeidentifyTemplateRequest() - assert args[0] == request_msg @@ -32784,7 +32906,6 @@ def test_create_job_trigger_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.CreateJobTriggerRequest() - assert args[0] == request_msg @@ -32807,7 +32928,6 @@ def test_update_job_trigger_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.UpdateJobTriggerRequest() - assert args[0] == request_msg @@ -32830,7 +32950,6 @@ def test_hybrid_inspect_job_trigger_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.HybridInspectJobTriggerRequest() - assert args[0] == request_msg @@ -32851,7 +32970,6 @@ def test_get_job_trigger_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.GetJobTriggerRequest() - assert args[0] == request_msg @@ -32874,7 +32992,6 @@ def test_list_job_triggers_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.ListJobTriggersRequest() - assert args[0] == request_msg @@ -32897,7 +33014,6 @@ def test_delete_job_trigger_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.DeleteJobTriggerRequest() - assert args[0] == request_msg @@ -32920,7 +33036,6 @@ def test_activate_job_trigger_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.ActivateJobTriggerRequest() - assert args[0] == request_msg @@ -32943,7 +33058,6 @@ def test_create_discovery_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.CreateDiscoveryConfigRequest() - assert args[0] == request_msg @@ -32966,7 +33080,6 @@ def test_update_discovery_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.UpdateDiscoveryConfigRequest() - assert args[0] == request_msg @@ -32989,7 +33102,6 @@ def test_get_discovery_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.GetDiscoveryConfigRequest() - assert args[0] == request_msg @@ -33012,7 +33124,6 @@ def test_list_discovery_configs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.ListDiscoveryConfigsRequest() - assert args[0] == request_msg @@ -33035,7 +33146,6 @@ def test_delete_discovery_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.DeleteDiscoveryConfigRequest() - assert args[0] == request_msg @@ -33056,7 +33166,6 @@ def test_create_dlp_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.CreateDlpJobRequest() - assert args[0] == request_msg @@ -33077,7 +33186,6 @@ def test_list_dlp_jobs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.ListDlpJobsRequest() - assert args[0] == request_msg @@ -33098,7 +33206,6 @@ def test_get_dlp_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.GetDlpJobRequest() - assert args[0] == request_msg @@ -33119,7 +33226,6 @@ def test_delete_dlp_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.DeleteDlpJobRequest() - assert args[0] == request_msg @@ -33140,7 +33246,6 @@ def test_cancel_dlp_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.CancelDlpJobRequest() - assert args[0] == request_msg @@ -33163,7 +33268,6 @@ def test_create_stored_info_type_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.CreateStoredInfoTypeRequest() - assert args[0] == request_msg @@ -33186,7 +33290,6 @@ def test_update_stored_info_type_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.UpdateStoredInfoTypeRequest() - assert args[0] == request_msg @@ -33209,7 +33312,6 @@ def test_get_stored_info_type_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.GetStoredInfoTypeRequest() - assert args[0] == request_msg @@ -33232,7 +33334,6 @@ def test_list_stored_info_types_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.ListStoredInfoTypesRequest() - assert args[0] == request_msg @@ -33255,7 +33356,6 @@ def test_delete_stored_info_type_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.DeleteStoredInfoTypeRequest() - assert args[0] == request_msg @@ -33278,7 +33378,6 @@ def test_list_project_data_profiles_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.ListProjectDataProfilesRequest() - assert args[0] == request_msg @@ -33301,7 +33400,6 @@ def test_list_table_data_profiles_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.ListTableDataProfilesRequest() - assert args[0] == request_msg @@ -33324,7 +33422,6 @@ def test_list_column_data_profiles_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.ListColumnDataProfilesRequest() - assert args[0] == request_msg @@ -33347,7 +33444,6 @@ def test_get_project_data_profile_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.GetProjectDataProfileRequest() - assert args[0] == request_msg @@ -33370,7 +33466,6 @@ def test_list_file_store_data_profiles_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.ListFileStoreDataProfilesRequest() - assert args[0] == request_msg @@ -33393,7 +33488,6 @@ def test_get_file_store_data_profile_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.GetFileStoreDataProfileRequest() - assert args[0] == request_msg @@ -33416,7 +33510,6 @@ def test_delete_file_store_data_profile_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.DeleteFileStoreDataProfileRequest() - assert args[0] == request_msg @@ -33439,7 +33532,6 @@ def test_get_table_data_profile_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.GetTableDataProfileRequest() - assert args[0] == request_msg @@ -33462,7 +33554,6 @@ def test_get_column_data_profile_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.GetColumnDataProfileRequest() - assert args[0] == request_msg @@ -33485,7 +33576,6 @@ def test_delete_table_data_profile_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.DeleteTableDataProfileRequest() - assert args[0] == request_msg @@ -33508,7 +33598,6 @@ def test_hybrid_inspect_dlp_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.HybridInspectDlpJobRequest() - assert args[0] == request_msg @@ -33529,7 +33618,6 @@ def test_finish_dlp_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.FinishDlpJobRequest() - assert args[0] == request_msg @@ -33552,7 +33640,6 @@ def test_create_connection_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.CreateConnectionRequest() - assert args[0] == request_msg @@ -33573,7 +33660,6 @@ def test_get_connection_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.GetConnectionRequest() - assert args[0] == request_msg @@ -33594,7 +33680,6 @@ def test_list_connections_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.ListConnectionsRequest() - assert args[0] == request_msg @@ -33617,7 +33702,6 @@ def test_search_connections_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.SearchConnectionsRequest() - assert args[0] == request_msg @@ -33640,7 +33724,6 @@ def test_delete_connection_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.DeleteConnectionRequest() - assert args[0] == request_msg @@ -33663,7 +33746,6 @@ def test_update_connection_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.UpdateConnectionRequest() - assert args[0] == request_msg @@ -33702,7 +33784,6 @@ async def test_inspect_content_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.InspectContentRequest() - assert args[0] == request_msg @@ -33730,7 +33811,6 @@ async def test_redact_image_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.RedactImageRequest() - assert args[0] == request_msg @@ -33757,7 +33837,6 @@ async def test_deidentify_content_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.DeidentifyContentRequest() - assert args[0] == request_msg @@ -33784,7 +33863,6 @@ async def test_reidentify_content_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.ReidentifyContentRequest() - assert args[0] == request_msg @@ -33809,7 +33887,6 @@ async def test_list_info_types_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.ListInfoTypesRequest() - assert args[0] == request_msg @@ -33840,7 +33917,6 @@ async def test_create_inspect_template_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.CreateInspectTemplateRequest() - assert args[0] == request_msg @@ -33871,7 +33947,6 @@ async def test_update_inspect_template_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.UpdateInspectTemplateRequest() - assert args[0] == request_msg @@ -33902,7 +33977,6 @@ async def test_get_inspect_template_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.GetInspectTemplateRequest() - assert args[0] == request_msg @@ -33931,7 +34005,6 @@ async def test_list_inspect_templates_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.ListInspectTemplatesRequest() - assert args[0] == request_msg @@ -33956,7 +34029,6 @@ async def test_delete_inspect_template_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.DeleteInspectTemplateRequest() - assert args[0] == request_msg @@ -33987,7 +34059,6 @@ async def test_create_deidentify_template_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.CreateDeidentifyTemplateRequest() - assert args[0] == request_msg @@ -34018,7 +34089,6 @@ async def test_update_deidentify_template_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.UpdateDeidentifyTemplateRequest() - assert args[0] == request_msg @@ -34049,7 +34119,6 @@ async def test_get_deidentify_template_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.GetDeidentifyTemplateRequest() - assert args[0] == request_msg @@ -34078,7 +34147,6 @@ async def test_list_deidentify_templates_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.ListDeidentifyTemplatesRequest() - assert args[0] == request_msg @@ -34103,7 +34171,6 @@ async def test_delete_deidentify_template_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.DeleteDeidentifyTemplateRequest() - assert args[0] == request_msg @@ -34135,7 +34202,6 @@ async def test_create_job_trigger_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.CreateJobTriggerRequest() - assert args[0] == request_msg @@ -34167,7 +34233,6 @@ async def test_update_job_trigger_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.UpdateJobTriggerRequest() - assert args[0] == request_msg @@ -34194,7 +34259,6 @@ async def test_hybrid_inspect_job_trigger_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.HybridInspectJobTriggerRequest() - assert args[0] == request_msg @@ -34224,7 +34288,6 @@ async def test_get_job_trigger_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.GetJobTriggerRequest() - assert args[0] == request_msg @@ -34253,7 +34316,6 @@ async def test_list_job_triggers_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.ListJobTriggersRequest() - assert args[0] == request_msg @@ -34278,7 +34340,6 @@ async def test_delete_job_trigger_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.DeleteJobTriggerRequest() - assert args[0] == request_msg @@ -34310,7 +34371,6 @@ async def test_activate_job_trigger_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.ActivateJobTriggerRequest() - assert args[0] == request_msg @@ -34342,7 +34402,6 @@ async def test_create_discovery_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.CreateDiscoveryConfigRequest() - assert args[0] == request_msg @@ -34374,7 +34433,6 @@ async def test_update_discovery_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.UpdateDiscoveryConfigRequest() - assert args[0] == request_msg @@ -34406,7 +34464,6 @@ async def test_get_discovery_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.GetDiscoveryConfigRequest() - assert args[0] == request_msg @@ -34435,7 +34492,6 @@ async def test_list_discovery_configs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.ListDiscoveryConfigsRequest() - assert args[0] == request_msg @@ -34460,7 +34516,6 @@ async def test_delete_discovery_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.DeleteDiscoveryConfigRequest() - assert args[0] == request_msg @@ -34490,7 +34545,6 @@ async def test_create_dlp_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.CreateDlpJobRequest() - assert args[0] == request_msg @@ -34517,7 +34571,6 @@ async def test_list_dlp_jobs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.ListDlpJobsRequest() - assert args[0] == request_msg @@ -34547,7 +34600,6 @@ async def test_get_dlp_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.GetDlpJobRequest() - assert args[0] == request_msg @@ -34570,7 +34622,6 @@ async def test_delete_dlp_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.DeleteDlpJobRequest() - assert args[0] == request_msg @@ -34593,7 +34644,6 @@ async def test_cancel_dlp_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.CancelDlpJobRequest() - assert args[0] == request_msg @@ -34622,7 +34672,6 @@ async def test_create_stored_info_type_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.CreateStoredInfoTypeRequest() - assert args[0] == request_msg @@ -34651,7 +34700,6 @@ async def test_update_stored_info_type_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.UpdateStoredInfoTypeRequest() - assert args[0] == request_msg @@ -34680,7 +34728,6 @@ async def test_get_stored_info_type_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.GetStoredInfoTypeRequest() - assert args[0] == request_msg @@ -34709,7 +34756,6 @@ async def test_list_stored_info_types_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.ListStoredInfoTypesRequest() - assert args[0] == request_msg @@ -34734,7 +34780,6 @@ async def test_delete_stored_info_type_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.DeleteStoredInfoTypeRequest() - assert args[0] == request_msg @@ -34763,7 +34808,6 @@ async def test_list_project_data_profiles_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.ListProjectDataProfilesRequest() - assert args[0] == request_msg @@ -34792,7 +34836,6 @@ async def test_list_table_data_profiles_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.ListTableDataProfilesRequest() - assert args[0] == request_msg @@ -34821,7 +34864,6 @@ async def test_list_column_data_profiles_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.ListColumnDataProfilesRequest() - assert args[0] == request_msg @@ -34853,7 +34895,6 @@ async def test_get_project_data_profile_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.GetProjectDataProfileRequest() - assert args[0] == request_msg @@ -34882,7 +34923,6 @@ async def test_list_file_store_data_profiles_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.ListFileStoreDataProfilesRequest() - assert args[0] == request_msg @@ -34921,7 +34961,6 @@ async def test_get_file_store_data_profile_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.GetFileStoreDataProfileRequest() - assert args[0] == request_msg @@ -34946,7 +34985,6 @@ async def test_delete_file_store_data_profile_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.DeleteFileStoreDataProfileRequest() - assert args[0] == request_msg @@ -34988,7 +35026,6 @@ async def test_get_table_data_profile_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.GetTableDataProfileRequest() - assert args[0] == request_msg @@ -35030,7 +35067,6 @@ async def test_get_column_data_profile_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.GetColumnDataProfileRequest() - assert args[0] == request_msg @@ -35055,7 +35091,6 @@ async def test_delete_table_data_profile_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.DeleteTableDataProfileRequest() - assert args[0] == request_msg @@ -35082,7 +35117,6 @@ async def test_hybrid_inspect_dlp_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.HybridInspectDlpJobRequest() - assert args[0] == request_msg @@ -35105,7 +35139,6 @@ async def test_finish_dlp_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.FinishDlpJobRequest() - assert args[0] == request_msg @@ -35135,7 +35168,6 @@ async def test_create_connection_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.CreateConnectionRequest() - assert args[0] == request_msg @@ -35163,7 +35195,6 @@ async def test_get_connection_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.GetConnectionRequest() - assert args[0] == request_msg @@ -35190,7 +35221,6 @@ async def test_list_connections_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.ListConnectionsRequest() - assert args[0] == request_msg @@ -35219,7 +35249,6 @@ async def test_search_connections_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.SearchConnectionsRequest() - assert args[0] == request_msg @@ -35244,7 +35273,6 @@ async def test_delete_connection_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.DeleteConnectionRequest() - assert args[0] == request_msg @@ -35274,7 +35302,6 @@ async def test_update_connection_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.UpdateConnectionRequest() - assert args[0] == request_msg @@ -42412,7 +42439,6 @@ def test_inspect_content_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.InspectContentRequest() - assert args[0] == request_msg @@ -42432,7 +42458,6 @@ def test_redact_image_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.RedactImageRequest() - assert args[0] == request_msg @@ -42454,7 +42479,6 @@ def test_deidentify_content_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.DeidentifyContentRequest() - assert args[0] == request_msg @@ -42476,7 +42500,6 @@ def test_reidentify_content_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.ReidentifyContentRequest() - assert args[0] == request_msg @@ -42496,7 +42519,6 @@ def test_list_info_types_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.ListInfoTypesRequest() - assert args[0] == request_msg @@ -42518,7 +42540,6 @@ def test_create_inspect_template_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.CreateInspectTemplateRequest() - assert args[0] == request_msg @@ -42540,7 +42561,6 @@ def test_update_inspect_template_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.UpdateInspectTemplateRequest() - assert args[0] == request_msg @@ -42562,7 +42582,6 @@ def test_get_inspect_template_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.GetInspectTemplateRequest() - assert args[0] == request_msg @@ -42584,7 +42603,6 @@ def test_list_inspect_templates_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.ListInspectTemplatesRequest() - assert args[0] == request_msg @@ -42606,7 +42624,6 @@ def test_delete_inspect_template_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.DeleteInspectTemplateRequest() - assert args[0] == request_msg @@ -42628,7 +42645,6 @@ def test_create_deidentify_template_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.CreateDeidentifyTemplateRequest() - assert args[0] == request_msg @@ -42650,7 +42666,6 @@ def test_update_deidentify_template_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.UpdateDeidentifyTemplateRequest() - assert args[0] == request_msg @@ -42672,7 +42687,6 @@ def test_get_deidentify_template_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.GetDeidentifyTemplateRequest() - assert args[0] == request_msg @@ -42694,7 +42708,6 @@ def test_list_deidentify_templates_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.ListDeidentifyTemplatesRequest() - assert args[0] == request_msg @@ -42716,7 +42729,6 @@ def test_delete_deidentify_template_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.DeleteDeidentifyTemplateRequest() - assert args[0] == request_msg @@ -42738,7 +42750,6 @@ def test_create_job_trigger_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.CreateJobTriggerRequest() - assert args[0] == request_msg @@ -42760,7 +42771,6 @@ def test_update_job_trigger_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.UpdateJobTriggerRequest() - assert args[0] == request_msg @@ -42782,7 +42792,6 @@ def test_hybrid_inspect_job_trigger_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.HybridInspectJobTriggerRequest() - assert args[0] == request_msg @@ -42802,7 +42811,6 @@ def test_get_job_trigger_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.GetJobTriggerRequest() - assert args[0] == request_msg @@ -42824,7 +42832,6 @@ def test_list_job_triggers_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.ListJobTriggersRequest() - assert args[0] == request_msg @@ -42846,7 +42853,6 @@ def test_delete_job_trigger_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.DeleteJobTriggerRequest() - assert args[0] == request_msg @@ -42868,7 +42874,6 @@ def test_activate_job_trigger_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.ActivateJobTriggerRequest() - assert args[0] == request_msg @@ -42890,7 +42895,6 @@ def test_create_discovery_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.CreateDiscoveryConfigRequest() - assert args[0] == request_msg @@ -42912,7 +42916,6 @@ def test_update_discovery_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.UpdateDiscoveryConfigRequest() - assert args[0] == request_msg @@ -42934,7 +42937,6 @@ def test_get_discovery_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.GetDiscoveryConfigRequest() - assert args[0] == request_msg @@ -42956,7 +42958,6 @@ def test_list_discovery_configs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.ListDiscoveryConfigsRequest() - assert args[0] == request_msg @@ -42978,7 +42979,6 @@ def test_delete_discovery_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.DeleteDiscoveryConfigRequest() - assert args[0] == request_msg @@ -42998,7 +42998,6 @@ def test_create_dlp_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.CreateDlpJobRequest() - assert args[0] == request_msg @@ -43018,7 +43017,6 @@ def test_list_dlp_jobs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.ListDlpJobsRequest() - assert args[0] == request_msg @@ -43038,7 +43036,6 @@ def test_get_dlp_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.GetDlpJobRequest() - assert args[0] == request_msg @@ -43058,7 +43055,6 @@ def test_delete_dlp_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.DeleteDlpJobRequest() - assert args[0] == request_msg @@ -43078,7 +43074,6 @@ def test_cancel_dlp_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.CancelDlpJobRequest() - assert args[0] == request_msg @@ -43100,7 +43095,6 @@ def test_create_stored_info_type_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.CreateStoredInfoTypeRequest() - assert args[0] == request_msg @@ -43122,7 +43116,6 @@ def test_update_stored_info_type_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.UpdateStoredInfoTypeRequest() - assert args[0] == request_msg @@ -43144,7 +43137,6 @@ def test_get_stored_info_type_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.GetStoredInfoTypeRequest() - assert args[0] == request_msg @@ -43166,7 +43158,6 @@ def test_list_stored_info_types_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.ListStoredInfoTypesRequest() - assert args[0] == request_msg @@ -43188,7 +43179,6 @@ def test_delete_stored_info_type_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.DeleteStoredInfoTypeRequest() - assert args[0] == request_msg @@ -43210,7 +43200,6 @@ def test_list_project_data_profiles_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.ListProjectDataProfilesRequest() - assert args[0] == request_msg @@ -43232,7 +43221,6 @@ def test_list_table_data_profiles_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.ListTableDataProfilesRequest() - assert args[0] == request_msg @@ -43254,7 +43242,6 @@ def test_list_column_data_profiles_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.ListColumnDataProfilesRequest() - assert args[0] == request_msg @@ -43276,7 +43263,6 @@ def test_get_project_data_profile_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.GetProjectDataProfileRequest() - assert args[0] == request_msg @@ -43298,7 +43284,6 @@ def test_list_file_store_data_profiles_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.ListFileStoreDataProfilesRequest() - assert args[0] == request_msg @@ -43320,7 +43305,6 @@ def test_get_file_store_data_profile_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.GetFileStoreDataProfileRequest() - assert args[0] == request_msg @@ -43342,7 +43326,6 @@ def test_delete_file_store_data_profile_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.DeleteFileStoreDataProfileRequest() - assert args[0] == request_msg @@ -43364,7 +43347,6 @@ def test_get_table_data_profile_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.GetTableDataProfileRequest() - assert args[0] == request_msg @@ -43386,7 +43368,6 @@ def test_get_column_data_profile_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.GetColumnDataProfileRequest() - assert args[0] == request_msg @@ -43408,7 +43389,6 @@ def test_delete_table_data_profile_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.DeleteTableDataProfileRequest() - assert args[0] == request_msg @@ -43430,7 +43410,6 @@ def test_hybrid_inspect_dlp_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.HybridInspectDlpJobRequest() - assert args[0] == request_msg @@ -43450,7 +43429,6 @@ def test_finish_dlp_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.FinishDlpJobRequest() - assert args[0] == request_msg @@ -43472,7 +43450,6 @@ def test_create_connection_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.CreateConnectionRequest() - assert args[0] == request_msg @@ -43492,7 +43469,6 @@ def test_get_connection_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.GetConnectionRequest() - assert args[0] == request_msg @@ -43512,7 +43488,6 @@ def test_list_connections_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.ListConnectionsRequest() - assert args[0] == request_msg @@ -43534,7 +43509,6 @@ def test_search_connections_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.SearchConnectionsRequest() - assert args[0] == request_msg @@ -43556,7 +43530,6 @@ def test_delete_connection_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.DeleteConnectionRequest() - assert args[0] == request_msg @@ -43578,7 +43551,6 @@ def test_update_connection_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dlp.UpdateConnectionRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-dms/noxfile.py b/packages/google-cloud-dms/noxfile.py index 5e50eab9cc23..e7c9e6377709 100644 --- a/packages/google-cloud-dms/noxfile.py +++ b/packages/google-cloud-dms/noxfile.py @@ -47,7 +47,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-dms" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-dms/setup.py b/packages/google-cloud-dms/setup.py index 46ee26a9dc0e..a6792bcd5ca5 100644 --- a/packages/google-cloud-dms/setup.py +++ b/packages/google-cloud-dms/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/google-cloud-dms/testing/constraints-3.10.txt b/packages/google-cloud-dms/testing/constraints-3.10.txt index a92801e1c8e2..b39cd54634f9 100644 --- a/packages/google-cloud-dms/testing/constraints-3.10.txt +++ b/packages/google-cloud-dms/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/google-cloud-dms/tests/unit/gapic/clouddms_v1/test_data_migration_service.py b/packages/google-cloud-dms/tests/unit/gapic/clouddms_v1/test_data_migration_service.py index 103abcf8b414..22b06d2d7a0f 100644 --- a/packages/google-cloud-dms/tests/unit/gapic/clouddms_v1/test_data_migration_service.py +++ b/packages/google-cloud-dms/tests/unit/gapic/clouddms_v1/test_data_migration_service.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 @@ -127,6 +128,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" @@ -1350,8 +1366,8 @@ def test_data_migration_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - clouddms.ListMigrationJobsRequest, - dict, + clouddms.ListMigrationJobsRequest(), + {}, ], ) def test_list_migration_jobs(request_type, transport: str = "grpc"): @@ -1362,7 +1378,7 @@ def test_list_migration_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( @@ -1415,12 +1431,13 @@ def test_list_migration_jobs_non_empty_request_with_auto_populated_field(): client.list_migration_jobs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == clouddms.ListMigrationJobsRequest( + request_msg = clouddms.ListMigrationJobsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_migration_jobs_use_cached_wrapped_rpc(): @@ -1505,9 +1522,14 @@ async def test_list_migration_jobs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_migration_jobs_async( - transport: str = "grpc_asyncio", request_type=clouddms.ListMigrationJobsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + clouddms.ListMigrationJobsRequest(), + {}, + ], +) +async def test_list_migration_jobs_async(request_type, transport: str = "grpc_asyncio"): client = DataMigrationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1515,7 +1537,7 @@ async def test_list_migration_jobs_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( @@ -1542,11 +1564,6 @@ async def test_list_migration_jobs_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_migration_jobs_async_from_dict(): - await test_list_migration_jobs_async(request_type=dict) - - def test_list_migration_jobs_field_headers(): client = DataMigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1899,8 +1916,8 @@ async def test_list_migration_jobs_async_pages(): @pytest.mark.parametrize( "request_type", [ - clouddms.GetMigrationJobRequest, - dict, + clouddms.GetMigrationJobRequest(), + {}, ], ) def test_get_migration_job(request_type, transport: str = "grpc"): @@ -1911,7 +1928,7 @@ def test_get_migration_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( @@ -1977,9 +1994,10 @@ def test_get_migration_job_non_empty_request_with_auto_populated_field(): client.get_migration_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == clouddms.GetMigrationJobRequest( + request_msg = clouddms.GetMigrationJobRequest( name="name_value", ) + assert args[0] == request_msg def test_get_migration_job_use_cached_wrapped_rpc(): @@ -2062,9 +2080,14 @@ async def test_get_migration_job_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_migration_job_async( - transport: str = "grpc_asyncio", request_type=clouddms.GetMigrationJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + clouddms.GetMigrationJobRequest(), + {}, + ], +) +async def test_get_migration_job_async(request_type, transport: str = "grpc_asyncio"): client = DataMigrationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2072,7 +2095,7 @@ async def test_get_migration_job_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( @@ -2115,11 +2138,6 @@ async def test_get_migration_job_async( assert response.cmek_key_name == "cmek_key_name_value" -@pytest.mark.asyncio -async def test_get_migration_job_async_from_dict(): - await test_get_migration_job_async(request_type=dict) - - def test_get_migration_job_field_headers(): client = DataMigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2274,8 +2292,8 @@ async def test_get_migration_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - clouddms.CreateMigrationJobRequest, - dict, + clouddms.CreateMigrationJobRequest(), + {}, ], ) def test_create_migration_job(request_type, transport: str = "grpc"): @@ -2286,7 +2304,7 @@ def test_create_migration_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( @@ -2333,11 +2351,12 @@ def test_create_migration_job_non_empty_request_with_auto_populated_field(): client.create_migration_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == clouddms.CreateMigrationJobRequest( + request_msg = clouddms.CreateMigrationJobRequest( parent="parent_value", migration_job_id="migration_job_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_migration_job_use_cached_wrapped_rpc(): @@ -2432,8 +2451,15 @@ async def test_create_migration_job_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + clouddms.CreateMigrationJobRequest(), + {}, + ], +) async def test_create_migration_job_async( - transport: str = "grpc_asyncio", request_type=clouddms.CreateMigrationJobRequest + request_type, transport: str = "grpc_asyncio" ): client = DataMigrationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2442,7 +2468,7 @@ async def test_create_migration_job_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( @@ -2464,11 +2490,6 @@ async def test_create_migration_job_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_migration_job_async_from_dict(): - await test_create_migration_job_async(request_type=dict) - - def test_create_migration_job_field_headers(): client = DataMigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2643,8 +2664,8 @@ async def test_create_migration_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - clouddms.UpdateMigrationJobRequest, - dict, + clouddms.UpdateMigrationJobRequest(), + {}, ], ) def test_update_migration_job(request_type, transport: str = "grpc"): @@ -2655,7 +2676,7 @@ def test_update_migration_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( @@ -2700,9 +2721,10 @@ def test_update_migration_job_non_empty_request_with_auto_populated_field(): client.update_migration_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == clouddms.UpdateMigrationJobRequest( + request_msg = clouddms.UpdateMigrationJobRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_migration_job_use_cached_wrapped_rpc(): @@ -2797,8 +2819,15 @@ async def test_update_migration_job_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + clouddms.UpdateMigrationJobRequest(), + {}, + ], +) async def test_update_migration_job_async( - transport: str = "grpc_asyncio", request_type=clouddms.UpdateMigrationJobRequest + request_type, transport: str = "grpc_asyncio" ): client = DataMigrationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2807,7 +2836,7 @@ async def test_update_migration_job_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( @@ -2829,11 +2858,6 @@ async def test_update_migration_job_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_migration_job_async_from_dict(): - await test_update_migration_job_async(request_type=dict) - - def test_update_migration_job_field_headers(): client = DataMigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2998,8 +3022,8 @@ async def test_update_migration_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - clouddms.DeleteMigrationJobRequest, - dict, + clouddms.DeleteMigrationJobRequest(), + {}, ], ) def test_delete_migration_job(request_type, transport: str = "grpc"): @@ -3010,7 +3034,7 @@ def test_delete_migration_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( @@ -3056,10 +3080,11 @@ def test_delete_migration_job_non_empty_request_with_auto_populated_field(): client.delete_migration_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == clouddms.DeleteMigrationJobRequest( + request_msg = clouddms.DeleteMigrationJobRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_migration_job_use_cached_wrapped_rpc(): @@ -3154,8 +3179,15 @@ async def test_delete_migration_job_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + clouddms.DeleteMigrationJobRequest(), + {}, + ], +) async def test_delete_migration_job_async( - transport: str = "grpc_asyncio", request_type=clouddms.DeleteMigrationJobRequest + request_type, transport: str = "grpc_asyncio" ): client = DataMigrationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3164,7 +3196,7 @@ async def test_delete_migration_job_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( @@ -3186,11 +3218,6 @@ async def test_delete_migration_job_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_migration_job_async_from_dict(): - await test_delete_migration_job_async(request_type=dict) - - def test_delete_migration_job_field_headers(): client = DataMigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3345,8 +3372,8 @@ async def test_delete_migration_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - clouddms.StartMigrationJobRequest, - dict, + clouddms.StartMigrationJobRequest(), + {}, ], ) def test_start_migration_job(request_type, transport: str = "grpc"): @@ -3357,7 +3384,7 @@ def test_start_migration_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( @@ -3402,9 +3429,10 @@ def test_start_migration_job_non_empty_request_with_auto_populated_field(): client.start_migration_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == clouddms.StartMigrationJobRequest( + request_msg = clouddms.StartMigrationJobRequest( name="name_value", ) + assert args[0] == request_msg def test_start_migration_job_use_cached_wrapped_rpc(): @@ -3499,9 +3527,14 @@ async def test_start_migration_job_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_start_migration_job_async( - transport: str = "grpc_asyncio", request_type=clouddms.StartMigrationJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + clouddms.StartMigrationJobRequest(), + {}, + ], +) +async def test_start_migration_job_async(request_type, transport: str = "grpc_asyncio"): client = DataMigrationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3509,7 +3542,7 @@ async def test_start_migration_job_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( @@ -3531,11 +3564,6 @@ async def test_start_migration_job_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_start_migration_job_async_from_dict(): - await test_start_migration_job_async(request_type=dict) - - def test_start_migration_job_field_headers(): client = DataMigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3604,8 +3632,8 @@ async def test_start_migration_job_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - clouddms.StopMigrationJobRequest, - dict, + clouddms.StopMigrationJobRequest(), + {}, ], ) def test_stop_migration_job(request_type, transport: str = "grpc"): @@ -3616,7 +3644,7 @@ def test_stop_migration_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( @@ -3661,9 +3689,10 @@ def test_stop_migration_job_non_empty_request_with_auto_populated_field(): client.stop_migration_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == clouddms.StopMigrationJobRequest( + request_msg = clouddms.StopMigrationJobRequest( name="name_value", ) + assert args[0] == request_msg def test_stop_migration_job_use_cached_wrapped_rpc(): @@ -3758,9 +3787,14 @@ async def test_stop_migration_job_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_stop_migration_job_async( - transport: str = "grpc_asyncio", request_type=clouddms.StopMigrationJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + clouddms.StopMigrationJobRequest(), + {}, + ], +) +async def test_stop_migration_job_async(request_type, transport: str = "grpc_asyncio"): client = DataMigrationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3768,7 +3802,7 @@ async def test_stop_migration_job_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( @@ -3790,11 +3824,6 @@ async def test_stop_migration_job_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_stop_migration_job_async_from_dict(): - await test_stop_migration_job_async(request_type=dict) - - def test_stop_migration_job_field_headers(): client = DataMigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3863,8 +3892,8 @@ async def test_stop_migration_job_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - clouddms.ResumeMigrationJobRequest, - dict, + clouddms.ResumeMigrationJobRequest(), + {}, ], ) def test_resume_migration_job(request_type, transport: str = "grpc"): @@ -3875,7 +3904,7 @@ def test_resume_migration_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( @@ -3920,9 +3949,10 @@ def test_resume_migration_job_non_empty_request_with_auto_populated_field(): client.resume_migration_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == clouddms.ResumeMigrationJobRequest( + request_msg = clouddms.ResumeMigrationJobRequest( name="name_value", ) + assert args[0] == request_msg def test_resume_migration_job_use_cached_wrapped_rpc(): @@ -4017,8 +4047,15 @@ async def test_resume_migration_job_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + clouddms.ResumeMigrationJobRequest(), + {}, + ], +) async def test_resume_migration_job_async( - transport: str = "grpc_asyncio", request_type=clouddms.ResumeMigrationJobRequest + request_type, transport: str = "grpc_asyncio" ): client = DataMigrationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4027,7 +4064,7 @@ async def test_resume_migration_job_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( @@ -4049,11 +4086,6 @@ async def test_resume_migration_job_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_resume_migration_job_async_from_dict(): - await test_resume_migration_job_async(request_type=dict) - - def test_resume_migration_job_field_headers(): client = DataMigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4122,8 +4154,8 @@ async def test_resume_migration_job_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - clouddms.PromoteMigrationJobRequest, - dict, + clouddms.PromoteMigrationJobRequest(), + {}, ], ) def test_promote_migration_job(request_type, transport: str = "grpc"): @@ -4134,7 +4166,7 @@ def test_promote_migration_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( @@ -4179,9 +4211,10 @@ def test_promote_migration_job_non_empty_request_with_auto_populated_field(): client.promote_migration_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == clouddms.PromoteMigrationJobRequest( + request_msg = clouddms.PromoteMigrationJobRequest( name="name_value", ) + assert args[0] == request_msg def test_promote_migration_job_use_cached_wrapped_rpc(): @@ -4277,8 +4310,15 @@ async def test_promote_migration_job_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + clouddms.PromoteMigrationJobRequest(), + {}, + ], +) async def test_promote_migration_job_async( - transport: str = "grpc_asyncio", request_type=clouddms.PromoteMigrationJobRequest + request_type, transport: str = "grpc_asyncio" ): client = DataMigrationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4287,7 +4327,7 @@ async def test_promote_migration_job_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( @@ -4309,11 +4349,6 @@ async def test_promote_migration_job_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_promote_migration_job_async_from_dict(): - await test_promote_migration_job_async(request_type=dict) - - def test_promote_migration_job_field_headers(): client = DataMigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4382,8 +4417,8 @@ async def test_promote_migration_job_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - clouddms.VerifyMigrationJobRequest, - dict, + clouddms.VerifyMigrationJobRequest(), + {}, ], ) def test_verify_migration_job(request_type, transport: str = "grpc"): @@ -4394,7 +4429,7 @@ def test_verify_migration_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( @@ -4439,9 +4474,10 @@ def test_verify_migration_job_non_empty_request_with_auto_populated_field(): client.verify_migration_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == clouddms.VerifyMigrationJobRequest( + request_msg = clouddms.VerifyMigrationJobRequest( name="name_value", ) + assert args[0] == request_msg def test_verify_migration_job_use_cached_wrapped_rpc(): @@ -4536,8 +4572,15 @@ async def test_verify_migration_job_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + clouddms.VerifyMigrationJobRequest(), + {}, + ], +) async def test_verify_migration_job_async( - transport: str = "grpc_asyncio", request_type=clouddms.VerifyMigrationJobRequest + request_type, transport: str = "grpc_asyncio" ): client = DataMigrationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4546,7 +4589,7 @@ async def test_verify_migration_job_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( @@ -4568,11 +4611,6 @@ async def test_verify_migration_job_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_verify_migration_job_async_from_dict(): - await test_verify_migration_job_async(request_type=dict) - - def test_verify_migration_job_field_headers(): client = DataMigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4641,8 +4679,8 @@ async def test_verify_migration_job_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - clouddms.RestartMigrationJobRequest, - dict, + clouddms.RestartMigrationJobRequest(), + {}, ], ) def test_restart_migration_job(request_type, transport: str = "grpc"): @@ -4653,7 +4691,7 @@ def test_restart_migration_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( @@ -4698,9 +4736,10 @@ def test_restart_migration_job_non_empty_request_with_auto_populated_field(): client.restart_migration_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == clouddms.RestartMigrationJobRequest( + request_msg = clouddms.RestartMigrationJobRequest( name="name_value", ) + assert args[0] == request_msg def test_restart_migration_job_use_cached_wrapped_rpc(): @@ -4796,8 +4835,15 @@ async def test_restart_migration_job_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + clouddms.RestartMigrationJobRequest(), + {}, + ], +) async def test_restart_migration_job_async( - transport: str = "grpc_asyncio", request_type=clouddms.RestartMigrationJobRequest + request_type, transport: str = "grpc_asyncio" ): client = DataMigrationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4806,7 +4852,7 @@ async def test_restart_migration_job_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( @@ -4828,11 +4874,6 @@ async def test_restart_migration_job_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_restart_migration_job_async_from_dict(): - await test_restart_migration_job_async(request_type=dict) - - def test_restart_migration_job_field_headers(): client = DataMigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4901,8 +4942,8 @@ async def test_restart_migration_job_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - clouddms.GenerateSshScriptRequest, - dict, + clouddms.GenerateSshScriptRequest(), + {}, ], ) def test_generate_ssh_script(request_type, transport: str = "grpc"): @@ -4913,7 +4954,7 @@ def test_generate_ssh_script(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4962,10 +5003,11 @@ def test_generate_ssh_script_non_empty_request_with_auto_populated_field(): client.generate_ssh_script(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == clouddms.GenerateSshScriptRequest( + request_msg = clouddms.GenerateSshScriptRequest( migration_job="migration_job_value", vm="vm_value", ) + assert args[0] == request_msg def test_generate_ssh_script_use_cached_wrapped_rpc(): @@ -5050,9 +5092,14 @@ async def test_generate_ssh_script_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_generate_ssh_script_async( - transport: str = "grpc_asyncio", request_type=clouddms.GenerateSshScriptRequest -): +@pytest.mark.parametrize( + "request_type", + [ + clouddms.GenerateSshScriptRequest(), + {}, + ], +) +async def test_generate_ssh_script_async(request_type, transport: str = "grpc_asyncio"): client = DataMigrationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5060,7 +5107,7 @@ async def test_generate_ssh_script_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( @@ -5085,11 +5132,6 @@ async def test_generate_ssh_script_async( assert response.script == "script_value" -@pytest.mark.asyncio -async def test_generate_ssh_script_async_from_dict(): - await test_generate_ssh_script_async(request_type=dict) - - def test_generate_ssh_script_field_headers(): client = DataMigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5156,8 +5198,8 @@ async def test_generate_ssh_script_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - clouddms.GenerateTcpProxyScriptRequest, - dict, + clouddms.GenerateTcpProxyScriptRequest(), + {}, ], ) def test_generate_tcp_proxy_script(request_type, transport: str = "grpc"): @@ -5168,7 +5210,7 @@ def test_generate_tcp_proxy_script(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5220,13 +5262,14 @@ def test_generate_tcp_proxy_script_non_empty_request_with_auto_populated_field() client.generate_tcp_proxy_script(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == clouddms.GenerateTcpProxyScriptRequest( + request_msg = clouddms.GenerateTcpProxyScriptRequest( migration_job="migration_job_value", vm_name="vm_name_value", vm_machine_type="vm_machine_type_value", vm_zone="vm_zone_value", vm_subnet="vm_subnet_value", ) + assert args[0] == request_msg def test_generate_tcp_proxy_script_use_cached_wrapped_rpc(): @@ -5312,8 +5355,15 @@ async def test_generate_tcp_proxy_script_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + clouddms.GenerateTcpProxyScriptRequest(), + {}, + ], +) async def test_generate_tcp_proxy_script_async( - transport: str = "grpc_asyncio", request_type=clouddms.GenerateTcpProxyScriptRequest + request_type, transport: str = "grpc_asyncio" ): client = DataMigrationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5322,7 +5372,7 @@ async def test_generate_tcp_proxy_script_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( @@ -5347,11 +5397,6 @@ async def test_generate_tcp_proxy_script_async( assert response.script == "script_value" -@pytest.mark.asyncio -async def test_generate_tcp_proxy_script_async_from_dict(): - await test_generate_tcp_proxy_script_async(request_type=dict) - - def test_generate_tcp_proxy_script_field_headers(): client = DataMigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5420,8 +5465,8 @@ async def test_generate_tcp_proxy_script_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - clouddms.ListConnectionProfilesRequest, - dict, + clouddms.ListConnectionProfilesRequest(), + {}, ], ) def test_list_connection_profiles(request_type, transport: str = "grpc"): @@ -5432,7 +5477,7 @@ def test_list_connection_profiles(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5485,12 +5530,13 @@ def test_list_connection_profiles_non_empty_request_with_auto_populated_field(): client.list_connection_profiles(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == clouddms.ListConnectionProfilesRequest( + request_msg = clouddms.ListConnectionProfilesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_connection_profiles_use_cached_wrapped_rpc(): @@ -5576,8 +5622,15 @@ async def test_list_connection_profiles_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + clouddms.ListConnectionProfilesRequest(), + {}, + ], +) async def test_list_connection_profiles_async( - transport: str = "grpc_asyncio", request_type=clouddms.ListConnectionProfilesRequest + request_type, transport: str = "grpc_asyncio" ): client = DataMigrationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5586,7 +5639,7 @@ async def test_list_connection_profiles_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( @@ -5613,11 +5666,6 @@ async def test_list_connection_profiles_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_connection_profiles_async_from_dict(): - await test_list_connection_profiles_async(request_type=dict) - - def test_list_connection_profiles_field_headers(): client = DataMigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5974,8 +6022,8 @@ async def test_list_connection_profiles_async_pages(): @pytest.mark.parametrize( "request_type", [ - clouddms.GetConnectionProfileRequest, - dict, + clouddms.GetConnectionProfileRequest(), + {}, ], ) def test_get_connection_profile(request_type, transport: str = "grpc"): @@ -5986,7 +6034,7 @@ def test_get_connection_profile(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6040,9 +6088,10 @@ def test_get_connection_profile_non_empty_request_with_auto_populated_field(): client.get_connection_profile(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == clouddms.GetConnectionProfileRequest( + request_msg = clouddms.GetConnectionProfileRequest( name="name_value", ) + assert args[0] == request_msg def test_get_connection_profile_use_cached_wrapped_rpc(): @@ -6128,8 +6177,15 @@ async def test_get_connection_profile_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + clouddms.GetConnectionProfileRequest(), + {}, + ], +) async def test_get_connection_profile_async( - transport: str = "grpc_asyncio", request_type=clouddms.GetConnectionProfileRequest + request_type, transport: str = "grpc_asyncio" ): client = DataMigrationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -6138,7 +6194,7 @@ async def test_get_connection_profile_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( @@ -6169,11 +6225,6 @@ async def test_get_connection_profile_async( assert response.provider == clouddms_resources.DatabaseProvider.CLOUDSQL -@pytest.mark.asyncio -async def test_get_connection_profile_async_from_dict(): - await test_get_connection_profile_async(request_type=dict) - - def test_get_connection_profile_field_headers(): client = DataMigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6328,8 +6379,8 @@ async def test_get_connection_profile_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - clouddms.CreateConnectionProfileRequest, - dict, + clouddms.CreateConnectionProfileRequest(), + {}, ], ) def test_create_connection_profile(request_type, transport: str = "grpc"): @@ -6340,7 +6391,7 @@ def test_create_connection_profile(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6387,11 +6438,12 @@ def test_create_connection_profile_non_empty_request_with_auto_populated_field() client.create_connection_profile(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == clouddms.CreateConnectionProfileRequest( + request_msg = clouddms.CreateConnectionProfileRequest( parent="parent_value", connection_profile_id="connection_profile_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_connection_profile_use_cached_wrapped_rpc(): @@ -6487,9 +6539,15 @@ async def test_create_connection_profile_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + clouddms.CreateConnectionProfileRequest(), + {}, + ], +) async def test_create_connection_profile_async( - transport: str = "grpc_asyncio", - request_type=clouddms.CreateConnectionProfileRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataMigrationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -6498,7 +6556,7 @@ async def test_create_connection_profile_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( @@ -6520,11 +6578,6 @@ async def test_create_connection_profile_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_connection_profile_async_from_dict(): - await test_create_connection_profile_async(request_type=dict) - - def test_create_connection_profile_field_headers(): client = DataMigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6699,8 +6752,8 @@ async def test_create_connection_profile_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - clouddms.UpdateConnectionProfileRequest, - dict, + clouddms.UpdateConnectionProfileRequest(), + {}, ], ) def test_update_connection_profile(request_type, transport: str = "grpc"): @@ -6711,7 +6764,7 @@ def test_update_connection_profile(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6756,9 +6809,10 @@ def test_update_connection_profile_non_empty_request_with_auto_populated_field() client.update_connection_profile(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == clouddms.UpdateConnectionProfileRequest( + request_msg = clouddms.UpdateConnectionProfileRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_connection_profile_use_cached_wrapped_rpc(): @@ -6854,9 +6908,15 @@ async def test_update_connection_profile_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + clouddms.UpdateConnectionProfileRequest(), + {}, + ], +) async def test_update_connection_profile_async( - transport: str = "grpc_asyncio", - request_type=clouddms.UpdateConnectionProfileRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataMigrationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -6865,7 +6925,7 @@ async def test_update_connection_profile_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( @@ -6887,11 +6947,6 @@ async def test_update_connection_profile_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_connection_profile_async_from_dict(): - await test_update_connection_profile_async(request_type=dict) - - def test_update_connection_profile_field_headers(): client = DataMigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7056,8 +7111,8 @@ async def test_update_connection_profile_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - clouddms.DeleteConnectionProfileRequest, - dict, + clouddms.DeleteConnectionProfileRequest(), + {}, ], ) def test_delete_connection_profile(request_type, transport: str = "grpc"): @@ -7068,7 +7123,7 @@ def test_delete_connection_profile(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7114,10 +7169,11 @@ def test_delete_connection_profile_non_empty_request_with_auto_populated_field() client.delete_connection_profile(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == clouddms.DeleteConnectionProfileRequest( + request_msg = clouddms.DeleteConnectionProfileRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_connection_profile_use_cached_wrapped_rpc(): @@ -7213,9 +7269,15 @@ async def test_delete_connection_profile_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + clouddms.DeleteConnectionProfileRequest(), + {}, + ], +) async def test_delete_connection_profile_async( - transport: str = "grpc_asyncio", - request_type=clouddms.DeleteConnectionProfileRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataMigrationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -7224,7 +7286,7 @@ async def test_delete_connection_profile_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( @@ -7246,11 +7308,6 @@ async def test_delete_connection_profile_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_connection_profile_async_from_dict(): - await test_delete_connection_profile_async(request_type=dict) - - def test_delete_connection_profile_field_headers(): client = DataMigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7405,8 +7462,8 @@ async def test_delete_connection_profile_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - clouddms.CreatePrivateConnectionRequest, - dict, + clouddms.CreatePrivateConnectionRequest(), + {}, ], ) def test_create_private_connection(request_type, transport: str = "grpc"): @@ -7417,7 +7474,7 @@ def test_create_private_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( @@ -7464,11 +7521,12 @@ def test_create_private_connection_non_empty_request_with_auto_populated_field() client.create_private_connection(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == clouddms.CreatePrivateConnectionRequest( + request_msg = clouddms.CreatePrivateConnectionRequest( parent="parent_value", private_connection_id="private_connection_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_private_connection_use_cached_wrapped_rpc(): @@ -7564,9 +7622,15 @@ async def test_create_private_connection_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + clouddms.CreatePrivateConnectionRequest(), + {}, + ], +) async def test_create_private_connection_async( - transport: str = "grpc_asyncio", - request_type=clouddms.CreatePrivateConnectionRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataMigrationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -7575,7 +7639,7 @@ async def test_create_private_connection_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( @@ -7597,11 +7661,6 @@ async def test_create_private_connection_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_private_connection_async_from_dict(): - await test_create_private_connection_async(request_type=dict) - - def test_create_private_connection_field_headers(): client = DataMigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7776,8 +7835,8 @@ async def test_create_private_connection_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - clouddms.GetPrivateConnectionRequest, - dict, + clouddms.GetPrivateConnectionRequest(), + {}, ], ) def test_get_private_connection(request_type, transport: str = "grpc"): @@ -7788,7 +7847,7 @@ def test_get_private_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( @@ -7840,9 +7899,10 @@ def test_get_private_connection_non_empty_request_with_auto_populated_field(): client.get_private_connection(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == clouddms.GetPrivateConnectionRequest( + request_msg = clouddms.GetPrivateConnectionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_private_connection_use_cached_wrapped_rpc(): @@ -7928,8 +7988,15 @@ async def test_get_private_connection_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + clouddms.GetPrivateConnectionRequest(), + {}, + ], +) async def test_get_private_connection_async( - transport: str = "grpc_asyncio", request_type=clouddms.GetPrivateConnectionRequest + request_type, transport: str = "grpc_asyncio" ): client = DataMigrationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -7938,7 +8005,7 @@ async def test_get_private_connection_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( @@ -7967,11 +8034,6 @@ async def test_get_private_connection_async( assert response.state == clouddms_resources.PrivateConnection.State.CREATING -@pytest.mark.asyncio -async def test_get_private_connection_async_from_dict(): - await test_get_private_connection_async(request_type=dict) - - def test_get_private_connection_field_headers(): client = DataMigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8126,8 +8188,8 @@ async def test_get_private_connection_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - clouddms.ListPrivateConnectionsRequest, - dict, + clouddms.ListPrivateConnectionsRequest(), + {}, ], ) def test_list_private_connections(request_type, transport: str = "grpc"): @@ -8138,7 +8200,7 @@ def test_list_private_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( @@ -8191,12 +8253,13 @@ def test_list_private_connections_non_empty_request_with_auto_populated_field(): client.list_private_connections(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == clouddms.ListPrivateConnectionsRequest( + request_msg = clouddms.ListPrivateConnectionsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_private_connections_use_cached_wrapped_rpc(): @@ -8282,8 +8345,15 @@ async def test_list_private_connections_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + clouddms.ListPrivateConnectionsRequest(), + {}, + ], +) async def test_list_private_connections_async( - transport: str = "grpc_asyncio", request_type=clouddms.ListPrivateConnectionsRequest + request_type, transport: str = "grpc_asyncio" ): client = DataMigrationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -8292,7 +8362,7 @@ async def test_list_private_connections_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( @@ -8319,11 +8389,6 @@ async def test_list_private_connections_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_private_connections_async_from_dict(): - await test_list_private_connections_async(request_type=dict) - - def test_list_private_connections_field_headers(): client = DataMigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8680,8 +8745,8 @@ async def test_list_private_connections_async_pages(): @pytest.mark.parametrize( "request_type", [ - clouddms.DeletePrivateConnectionRequest, - dict, + clouddms.DeletePrivateConnectionRequest(), + {}, ], ) def test_delete_private_connection(request_type, transport: str = "grpc"): @@ -8692,7 +8757,7 @@ def test_delete_private_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( @@ -8738,10 +8803,11 @@ def test_delete_private_connection_non_empty_request_with_auto_populated_field() client.delete_private_connection(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == clouddms.DeletePrivateConnectionRequest( + request_msg = clouddms.DeletePrivateConnectionRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_private_connection_use_cached_wrapped_rpc(): @@ -8837,9 +8903,15 @@ async def test_delete_private_connection_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + clouddms.DeletePrivateConnectionRequest(), + {}, + ], +) async def test_delete_private_connection_async( - transport: str = "grpc_asyncio", - request_type=clouddms.DeletePrivateConnectionRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataMigrationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -8848,7 +8920,7 @@ async def test_delete_private_connection_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( @@ -8870,11 +8942,6 @@ async def test_delete_private_connection_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_private_connection_async_from_dict(): - await test_delete_private_connection_async(request_type=dict) - - def test_delete_private_connection_field_headers(): client = DataMigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9029,8 +9096,8 @@ async def test_delete_private_connection_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - clouddms.GetConversionWorkspaceRequest, - dict, + clouddms.GetConversionWorkspaceRequest(), + {}, ], ) def test_get_conversion_workspace(request_type, transport: str = "grpc"): @@ -9041,7 +9108,7 @@ def test_get_conversion_workspace(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9095,9 +9162,10 @@ def test_get_conversion_workspace_non_empty_request_with_auto_populated_field(): client.get_conversion_workspace(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == clouddms.GetConversionWorkspaceRequest( + request_msg = clouddms.GetConversionWorkspaceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_conversion_workspace_use_cached_wrapped_rpc(): @@ -9183,8 +9251,15 @@ async def test_get_conversion_workspace_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + clouddms.GetConversionWorkspaceRequest(), + {}, + ], +) async def test_get_conversion_workspace_async( - transport: str = "grpc_asyncio", request_type=clouddms.GetConversionWorkspaceRequest + request_type, transport: str = "grpc_asyncio" ): client = DataMigrationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -9193,7 +9268,7 @@ async def test_get_conversion_workspace_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( @@ -9224,11 +9299,6 @@ async def test_get_conversion_workspace_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_get_conversion_workspace_async_from_dict(): - await test_get_conversion_workspace_async(request_type=dict) - - def test_get_conversion_workspace_field_headers(): client = DataMigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9383,8 +9453,8 @@ async def test_get_conversion_workspace_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - clouddms.ListConversionWorkspacesRequest, - dict, + clouddms.ListConversionWorkspacesRequest(), + {}, ], ) def test_list_conversion_workspaces(request_type, transport: str = "grpc"): @@ -9395,7 +9465,7 @@ def test_list_conversion_workspaces(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9447,11 +9517,12 @@ def test_list_conversion_workspaces_non_empty_request_with_auto_populated_field( client.list_conversion_workspaces(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == clouddms.ListConversionWorkspacesRequest( + request_msg = clouddms.ListConversionWorkspacesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_conversion_workspaces_use_cached_wrapped_rpc(): @@ -9537,9 +9608,15 @@ async def test_list_conversion_workspaces_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + clouddms.ListConversionWorkspacesRequest(), + {}, + ], +) async def test_list_conversion_workspaces_async( - transport: str = "grpc_asyncio", - request_type=clouddms.ListConversionWorkspacesRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataMigrationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -9548,7 +9625,7 @@ async def test_list_conversion_workspaces_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( @@ -9575,11 +9652,6 @@ async def test_list_conversion_workspaces_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_conversion_workspaces_async_from_dict(): - await test_list_conversion_workspaces_async(request_type=dict) - - def test_list_conversion_workspaces_field_headers(): client = DataMigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9940,8 +10012,8 @@ async def test_list_conversion_workspaces_async_pages(): @pytest.mark.parametrize( "request_type", [ - clouddms.CreateConversionWorkspaceRequest, - dict, + clouddms.CreateConversionWorkspaceRequest(), + {}, ], ) def test_create_conversion_workspace(request_type, transport: str = "grpc"): @@ -9952,7 +10024,7 @@ def test_create_conversion_workspace(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9999,11 +10071,12 @@ def test_create_conversion_workspace_non_empty_request_with_auto_populated_field client.create_conversion_workspace(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == clouddms.CreateConversionWorkspaceRequest( + request_msg = clouddms.CreateConversionWorkspaceRequest( parent="parent_value", conversion_workspace_id="conversion_workspace_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_conversion_workspace_use_cached_wrapped_rpc(): @@ -10099,9 +10172,15 @@ async def test_create_conversion_workspace_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + clouddms.CreateConversionWorkspaceRequest(), + {}, + ], +) async def test_create_conversion_workspace_async( - transport: str = "grpc_asyncio", - request_type=clouddms.CreateConversionWorkspaceRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataMigrationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -10110,7 +10189,7 @@ async def test_create_conversion_workspace_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( @@ -10132,11 +10211,6 @@ async def test_create_conversion_workspace_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_conversion_workspace_async_from_dict(): - await test_create_conversion_workspace_async(request_type=dict) - - def test_create_conversion_workspace_field_headers(): client = DataMigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10319,8 +10393,8 @@ async def test_create_conversion_workspace_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - clouddms.UpdateConversionWorkspaceRequest, - dict, + clouddms.UpdateConversionWorkspaceRequest(), + {}, ], ) def test_update_conversion_workspace(request_type, transport: str = "grpc"): @@ -10331,7 +10405,7 @@ def test_update_conversion_workspace(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10376,9 +10450,10 @@ def test_update_conversion_workspace_non_empty_request_with_auto_populated_field client.update_conversion_workspace(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == clouddms.UpdateConversionWorkspaceRequest( + request_msg = clouddms.UpdateConversionWorkspaceRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_conversion_workspace_use_cached_wrapped_rpc(): @@ -10474,9 +10549,15 @@ async def test_update_conversion_workspace_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + clouddms.UpdateConversionWorkspaceRequest(), + {}, + ], +) async def test_update_conversion_workspace_async( - transport: str = "grpc_asyncio", - request_type=clouddms.UpdateConversionWorkspaceRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataMigrationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -10485,7 +10566,7 @@ async def test_update_conversion_workspace_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( @@ -10507,11 +10588,6 @@ async def test_update_conversion_workspace_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_conversion_workspace_async_from_dict(): - await test_update_conversion_workspace_async(request_type=dict) - - def test_update_conversion_workspace_field_headers(): client = DataMigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10684,8 +10760,8 @@ async def test_update_conversion_workspace_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - clouddms.DeleteConversionWorkspaceRequest, - dict, + clouddms.DeleteConversionWorkspaceRequest(), + {}, ], ) def test_delete_conversion_workspace(request_type, transport: str = "grpc"): @@ -10696,7 +10772,7 @@ def test_delete_conversion_workspace(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10742,10 +10818,11 @@ def test_delete_conversion_workspace_non_empty_request_with_auto_populated_field client.delete_conversion_workspace(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == clouddms.DeleteConversionWorkspaceRequest( + request_msg = clouddms.DeleteConversionWorkspaceRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_conversion_workspace_use_cached_wrapped_rpc(): @@ -10841,9 +10918,15 @@ async def test_delete_conversion_workspace_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + clouddms.DeleteConversionWorkspaceRequest(), + {}, + ], +) async def test_delete_conversion_workspace_async( - transport: str = "grpc_asyncio", - request_type=clouddms.DeleteConversionWorkspaceRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataMigrationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -10852,7 +10935,7 @@ async def test_delete_conversion_workspace_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( @@ -10874,11 +10957,6 @@ async def test_delete_conversion_workspace_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_conversion_workspace_async_from_dict(): - await test_delete_conversion_workspace_async(request_type=dict) - - def test_delete_conversion_workspace_field_headers(): client = DataMigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11033,8 +11111,8 @@ async def test_delete_conversion_workspace_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - clouddms.CreateMappingRuleRequest, - dict, + clouddms.CreateMappingRuleRequest(), + {}, ], ) def test_create_mapping_rule(request_type, transport: str = "grpc"): @@ -11045,7 +11123,7 @@ def test_create_mapping_rule(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11108,11 +11186,12 @@ def test_create_mapping_rule_non_empty_request_with_auto_populated_field(): client.create_mapping_rule(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == clouddms.CreateMappingRuleRequest( + request_msg = clouddms.CreateMappingRuleRequest( parent="parent_value", mapping_rule_id="mapping_rule_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_mapping_rule_use_cached_wrapped_rpc(): @@ -11197,9 +11276,14 @@ async def test_create_mapping_rule_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_mapping_rule_async( - transport: str = "grpc_asyncio", request_type=clouddms.CreateMappingRuleRequest -): +@pytest.mark.parametrize( + "request_type", + [ + clouddms.CreateMappingRuleRequest(), + {}, + ], +) +async def test_create_mapping_rule_async(request_type, transport: str = "grpc_asyncio"): client = DataMigrationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11207,7 +11291,7 @@ async def test_create_mapping_rule_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( @@ -11245,11 +11329,6 @@ async def test_create_mapping_rule_async( assert response.revision_id == "revision_id_value" -@pytest.mark.asyncio -async def test_create_mapping_rule_async_from_dict(): - await test_create_mapping_rule_async(request_type=dict) - - def test_create_mapping_rule_field_headers(): client = DataMigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11424,8 +11503,8 @@ async def test_create_mapping_rule_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - clouddms.DeleteMappingRuleRequest, - dict, + clouddms.DeleteMappingRuleRequest(), + {}, ], ) def test_delete_mapping_rule(request_type, transport: str = "grpc"): @@ -11436,7 +11515,7 @@ def test_delete_mapping_rule(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11482,10 +11561,11 @@ def test_delete_mapping_rule_non_empty_request_with_auto_populated_field(): client.delete_mapping_rule(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == clouddms.DeleteMappingRuleRequest( + request_msg = clouddms.DeleteMappingRuleRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_mapping_rule_use_cached_wrapped_rpc(): @@ -11570,9 +11650,14 @@ async def test_delete_mapping_rule_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_mapping_rule_async( - transport: str = "grpc_asyncio", request_type=clouddms.DeleteMappingRuleRequest -): +@pytest.mark.parametrize( + "request_type", + [ + clouddms.DeleteMappingRuleRequest(), + {}, + ], +) +async def test_delete_mapping_rule_async(request_type, transport: str = "grpc_asyncio"): client = DataMigrationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11580,7 +11665,7 @@ async def test_delete_mapping_rule_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( @@ -11600,11 +11685,6 @@ async def test_delete_mapping_rule_async( assert response is None -@pytest.mark.asyncio -async def test_delete_mapping_rule_async_from_dict(): - await test_delete_mapping_rule_async(request_type=dict) - - def test_delete_mapping_rule_field_headers(): client = DataMigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11755,8 +11835,8 @@ async def test_delete_mapping_rule_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - clouddms.ListMappingRulesRequest, - dict, + clouddms.ListMappingRulesRequest(), + {}, ], ) def test_list_mapping_rules(request_type, transport: str = "grpc"): @@ -11767,7 +11847,7 @@ def test_list_mapping_rules(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11816,10 +11896,11 @@ def test_list_mapping_rules_non_empty_request_with_auto_populated_field(): client.list_mapping_rules(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == clouddms.ListMappingRulesRequest( + request_msg = clouddms.ListMappingRulesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_mapping_rules_use_cached_wrapped_rpc(): @@ -11904,9 +11985,14 @@ async def test_list_mapping_rules_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_mapping_rules_async( - transport: str = "grpc_asyncio", request_type=clouddms.ListMappingRulesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + clouddms.ListMappingRulesRequest(), + {}, + ], +) +async def test_list_mapping_rules_async(request_type, transport: str = "grpc_asyncio"): client = DataMigrationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11914,7 +12000,7 @@ async def test_list_mapping_rules_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( @@ -11939,11 +12025,6 @@ async def test_list_mapping_rules_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_mapping_rules_async_from_dict(): - await test_list_mapping_rules_async(request_type=dict) - - def test_list_mapping_rules_field_headers(): client = DataMigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12300,8 +12381,8 @@ async def test_list_mapping_rules_async_pages(): @pytest.mark.parametrize( "request_type", [ - clouddms.GetMappingRuleRequest, - dict, + clouddms.GetMappingRuleRequest(), + {}, ], ) def test_get_mapping_rule(request_type, transport: str = "grpc"): @@ -12312,7 +12393,7 @@ def test_get_mapping_rule(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_mapping_rule), "__call__") as call: @@ -12369,9 +12450,10 @@ def test_get_mapping_rule_non_empty_request_with_auto_populated_field(): client.get_mapping_rule(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == clouddms.GetMappingRuleRequest( + request_msg = clouddms.GetMappingRuleRequest( name="name_value", ) + assert args[0] == request_msg def test_get_mapping_rule_use_cached_wrapped_rpc(): @@ -12454,9 +12536,14 @@ async def test_get_mapping_rule_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_mapping_rule_async( - transport: str = "grpc_asyncio", request_type=clouddms.GetMappingRuleRequest -): +@pytest.mark.parametrize( + "request_type", + [ + clouddms.GetMappingRuleRequest(), + {}, + ], +) +async def test_get_mapping_rule_async(request_type, transport: str = "grpc_asyncio"): client = DataMigrationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12464,7 +12551,7 @@ async def test_get_mapping_rule_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_mapping_rule), "__call__") as call: @@ -12500,11 +12587,6 @@ async def test_get_mapping_rule_async( assert response.revision_id == "revision_id_value" -@pytest.mark.asyncio -async def test_get_mapping_rule_async_from_dict(): - await test_get_mapping_rule_async(request_type=dict) - - def test_get_mapping_rule_field_headers(): client = DataMigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12651,8 +12733,8 @@ async def test_get_mapping_rule_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - clouddms.SeedConversionWorkspaceRequest, - dict, + clouddms.SeedConversionWorkspaceRequest(), + {}, ], ) def test_seed_conversion_workspace(request_type, transport: str = "grpc"): @@ -12663,7 +12745,7 @@ def test_seed_conversion_workspace(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -12710,11 +12792,12 @@ def test_seed_conversion_workspace_non_empty_request_with_auto_populated_field() client.seed_conversion_workspace(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == clouddms.SeedConversionWorkspaceRequest( + request_msg = clouddms.SeedConversionWorkspaceRequest( name="name_value", source_connection_profile="source_connection_profile_value", destination_connection_profile="destination_connection_profile_value", ) + assert args[0] == request_msg def test_seed_conversion_workspace_use_cached_wrapped_rpc(): @@ -12810,9 +12893,15 @@ async def test_seed_conversion_workspace_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + clouddms.SeedConversionWorkspaceRequest(), + {}, + ], +) async def test_seed_conversion_workspace_async( - transport: str = "grpc_asyncio", - request_type=clouddms.SeedConversionWorkspaceRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataMigrationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -12821,7 +12910,7 @@ async def test_seed_conversion_workspace_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( @@ -12843,11 +12932,6 @@ async def test_seed_conversion_workspace_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_seed_conversion_workspace_async_from_dict(): - await test_seed_conversion_workspace_async(request_type=dict) - - def test_seed_conversion_workspace_field_headers(): client = DataMigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12916,8 +13000,8 @@ async def test_seed_conversion_workspace_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - clouddms.ImportMappingRulesRequest, - dict, + clouddms.ImportMappingRulesRequest(), + {}, ], ) def test_import_mapping_rules(request_type, transport: str = "grpc"): @@ -12928,7 +13012,7 @@ def test_import_mapping_rules(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -12973,9 +13057,10 @@ def test_import_mapping_rules_non_empty_request_with_auto_populated_field(): client.import_mapping_rules(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == clouddms.ImportMappingRulesRequest( + request_msg = clouddms.ImportMappingRulesRequest( parent="parent_value", ) + assert args[0] == request_msg def test_import_mapping_rules_use_cached_wrapped_rpc(): @@ -13070,8 +13155,15 @@ async def test_import_mapping_rules_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + clouddms.ImportMappingRulesRequest(), + {}, + ], +) async def test_import_mapping_rules_async( - transport: str = "grpc_asyncio", request_type=clouddms.ImportMappingRulesRequest + request_type, transport: str = "grpc_asyncio" ): client = DataMigrationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -13080,7 +13172,7 @@ async def test_import_mapping_rules_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( @@ -13102,11 +13194,6 @@ async def test_import_mapping_rules_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_import_mapping_rules_async_from_dict(): - await test_import_mapping_rules_async(request_type=dict) - - def test_import_mapping_rules_field_headers(): client = DataMigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13175,8 +13262,8 @@ async def test_import_mapping_rules_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - clouddms.ConvertConversionWorkspaceRequest, - dict, + clouddms.ConvertConversionWorkspaceRequest(), + {}, ], ) def test_convert_conversion_workspace(request_type, transport: str = "grpc"): @@ -13187,7 +13274,7 @@ def test_convert_conversion_workspace(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -13233,10 +13320,11 @@ def test_convert_conversion_workspace_non_empty_request_with_auto_populated_fiel client.convert_conversion_workspace(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == clouddms.ConvertConversionWorkspaceRequest( + request_msg = clouddms.ConvertConversionWorkspaceRequest( name="name_value", filter="filter_value", ) + assert args[0] == request_msg def test_convert_conversion_workspace_use_cached_wrapped_rpc(): @@ -13332,9 +13420,15 @@ async def test_convert_conversion_workspace_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + clouddms.ConvertConversionWorkspaceRequest(), + {}, + ], +) async def test_convert_conversion_workspace_async( - transport: str = "grpc_asyncio", - request_type=clouddms.ConvertConversionWorkspaceRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataMigrationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -13343,7 +13437,7 @@ async def test_convert_conversion_workspace_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( @@ -13365,11 +13459,6 @@ async def test_convert_conversion_workspace_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_convert_conversion_workspace_async_from_dict(): - await test_convert_conversion_workspace_async(request_type=dict) - - def test_convert_conversion_workspace_field_headers(): client = DataMigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13438,8 +13527,8 @@ async def test_convert_conversion_workspace_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - clouddms.CommitConversionWorkspaceRequest, - dict, + clouddms.CommitConversionWorkspaceRequest(), + {}, ], ) def test_commit_conversion_workspace(request_type, transport: str = "grpc"): @@ -13450,7 +13539,7 @@ def test_commit_conversion_workspace(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -13496,10 +13585,11 @@ def test_commit_conversion_workspace_non_empty_request_with_auto_populated_field client.commit_conversion_workspace(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == clouddms.CommitConversionWorkspaceRequest( + request_msg = clouddms.CommitConversionWorkspaceRequest( name="name_value", commit_name="commit_name_value", ) + assert args[0] == request_msg def test_commit_conversion_workspace_use_cached_wrapped_rpc(): @@ -13595,9 +13685,15 @@ async def test_commit_conversion_workspace_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + clouddms.CommitConversionWorkspaceRequest(), + {}, + ], +) async def test_commit_conversion_workspace_async( - transport: str = "grpc_asyncio", - request_type=clouddms.CommitConversionWorkspaceRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataMigrationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -13606,7 +13702,7 @@ async def test_commit_conversion_workspace_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( @@ -13628,11 +13724,6 @@ async def test_commit_conversion_workspace_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_commit_conversion_workspace_async_from_dict(): - await test_commit_conversion_workspace_async(request_type=dict) - - def test_commit_conversion_workspace_field_headers(): client = DataMigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13701,8 +13792,8 @@ async def test_commit_conversion_workspace_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - clouddms.RollbackConversionWorkspaceRequest, - dict, + clouddms.RollbackConversionWorkspaceRequest(), + {}, ], ) def test_rollback_conversion_workspace(request_type, transport: str = "grpc"): @@ -13713,7 +13804,7 @@ def test_rollback_conversion_workspace(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -13758,9 +13849,10 @@ def test_rollback_conversion_workspace_non_empty_request_with_auto_populated_fie client.rollback_conversion_workspace(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == clouddms.RollbackConversionWorkspaceRequest( + request_msg = clouddms.RollbackConversionWorkspaceRequest( name="name_value", ) + assert args[0] == request_msg def test_rollback_conversion_workspace_use_cached_wrapped_rpc(): @@ -13856,9 +13948,15 @@ async def test_rollback_conversion_workspace_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + clouddms.RollbackConversionWorkspaceRequest(), + {}, + ], +) async def test_rollback_conversion_workspace_async( - transport: str = "grpc_asyncio", - request_type=clouddms.RollbackConversionWorkspaceRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataMigrationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -13867,7 +13965,7 @@ async def test_rollback_conversion_workspace_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( @@ -13889,11 +13987,6 @@ async def test_rollback_conversion_workspace_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_rollback_conversion_workspace_async_from_dict(): - await test_rollback_conversion_workspace_async(request_type=dict) - - def test_rollback_conversion_workspace_field_headers(): client = DataMigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13962,8 +14055,8 @@ async def test_rollback_conversion_workspace_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - clouddms.ApplyConversionWorkspaceRequest, - dict, + clouddms.ApplyConversionWorkspaceRequest(), + {}, ], ) def test_apply_conversion_workspace(request_type, transport: str = "grpc"): @@ -13974,7 +14067,7 @@ def test_apply_conversion_workspace(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -14021,11 +14114,12 @@ def test_apply_conversion_workspace_non_empty_request_with_auto_populated_field( client.apply_conversion_workspace(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == clouddms.ApplyConversionWorkspaceRequest( + request_msg = clouddms.ApplyConversionWorkspaceRequest( name="name_value", filter="filter_value", connection_profile="connection_profile_value", ) + assert args[0] == request_msg def test_apply_conversion_workspace_use_cached_wrapped_rpc(): @@ -14121,9 +14215,15 @@ async def test_apply_conversion_workspace_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + clouddms.ApplyConversionWorkspaceRequest(), + {}, + ], +) async def test_apply_conversion_workspace_async( - transport: str = "grpc_asyncio", - request_type=clouddms.ApplyConversionWorkspaceRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataMigrationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -14132,7 +14232,7 @@ async def test_apply_conversion_workspace_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( @@ -14154,11 +14254,6 @@ async def test_apply_conversion_workspace_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_apply_conversion_workspace_async_from_dict(): - await test_apply_conversion_workspace_async(request_type=dict) - - def test_apply_conversion_workspace_field_headers(): client = DataMigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14227,8 +14322,8 @@ async def test_apply_conversion_workspace_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - clouddms.DescribeDatabaseEntitiesRequest, - dict, + clouddms.DescribeDatabaseEntitiesRequest(), + {}, ], ) def test_describe_database_entities(request_type, transport: str = "grpc"): @@ -14239,7 +14334,7 @@ def test_describe_database_entities(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -14290,12 +14385,13 @@ def test_describe_database_entities_non_empty_request_with_auto_populated_field( client.describe_database_entities(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == clouddms.DescribeDatabaseEntitiesRequest( + request_msg = clouddms.DescribeDatabaseEntitiesRequest( conversion_workspace="conversion_workspace_value", page_token="page_token_value", commit_id="commit_id_value", filter="filter_value", ) + assert args[0] == request_msg def test_describe_database_entities_use_cached_wrapped_rpc(): @@ -14381,9 +14477,15 @@ async def test_describe_database_entities_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + clouddms.DescribeDatabaseEntitiesRequest(), + {}, + ], +) async def test_describe_database_entities_async( - transport: str = "grpc_asyncio", - request_type=clouddms.DescribeDatabaseEntitiesRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataMigrationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -14392,7 +14494,7 @@ async def test_describe_database_entities_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( @@ -14417,11 +14519,6 @@ async def test_describe_database_entities_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_describe_database_entities_async_from_dict(): - await test_describe_database_entities_async(request_type=dict) - - def test_describe_database_entities_field_headers(): client = DataMigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14695,8 +14792,8 @@ async def test_describe_database_entities_async_pages(): @pytest.mark.parametrize( "request_type", [ - clouddms.SearchBackgroundJobsRequest, - dict, + clouddms.SearchBackgroundJobsRequest(), + {}, ], ) def test_search_background_jobs(request_type, transport: str = "grpc"): @@ -14707,7 +14804,7 @@ def test_search_background_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( @@ -14752,9 +14849,10 @@ def test_search_background_jobs_non_empty_request_with_auto_populated_field(): client.search_background_jobs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == clouddms.SearchBackgroundJobsRequest( + request_msg = clouddms.SearchBackgroundJobsRequest( conversion_workspace="conversion_workspace_value", ) + assert args[0] == request_msg def test_search_background_jobs_use_cached_wrapped_rpc(): @@ -14840,8 +14938,15 @@ async def test_search_background_jobs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + clouddms.SearchBackgroundJobsRequest(), + {}, + ], +) async def test_search_background_jobs_async( - transport: str = "grpc_asyncio", request_type=clouddms.SearchBackgroundJobsRequest + request_type, transport: str = "grpc_asyncio" ): client = DataMigrationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -14850,7 +14955,7 @@ async def test_search_background_jobs_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( @@ -14872,11 +14977,6 @@ async def test_search_background_jobs_async( assert isinstance(response, clouddms.SearchBackgroundJobsResponse) -@pytest.mark.asyncio -async def test_search_background_jobs_async_from_dict(): - await test_search_background_jobs_async(request_type=dict) - - def test_search_background_jobs_field_headers(): client = DataMigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14945,8 +15045,8 @@ async def test_search_background_jobs_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - clouddms.DescribeConversionWorkspaceRevisionsRequest, - dict, + clouddms.DescribeConversionWorkspaceRevisionsRequest(), + {}, ], ) def test_describe_conversion_workspace_revisions(request_type, transport: str = "grpc"): @@ -14957,7 +15057,7 @@ def test_describe_conversion_workspace_revisions(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( @@ -15003,10 +15103,11 @@ def test_describe_conversion_workspace_revisions_non_empty_request_with_auto_pop client.describe_conversion_workspace_revisions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == clouddms.DescribeConversionWorkspaceRevisionsRequest( + request_msg = clouddms.DescribeConversionWorkspaceRevisionsRequest( conversion_workspace="conversion_workspace_value", commit_id="commit_id_value", ) + assert args[0] == request_msg def test_describe_conversion_workspace_revisions_use_cached_wrapped_rpc(): @@ -15092,9 +15193,15 @@ async def test_describe_conversion_workspace_revisions_async_use_cached_wrapped_ @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + clouddms.DescribeConversionWorkspaceRevisionsRequest(), + {}, + ], +) async def test_describe_conversion_workspace_revisions_async( - transport: str = "grpc_asyncio", - request_type=clouddms.DescribeConversionWorkspaceRevisionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataMigrationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -15103,7 +15210,7 @@ async def test_describe_conversion_workspace_revisions_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( @@ -15125,11 +15232,6 @@ async def test_describe_conversion_workspace_revisions_async( assert isinstance(response, clouddms.DescribeConversionWorkspaceRevisionsResponse) -@pytest.mark.asyncio -async def test_describe_conversion_workspace_revisions_async_from_dict(): - await test_describe_conversion_workspace_revisions_async(request_type=dict) - - def test_describe_conversion_workspace_revisions_field_headers(): client = DataMigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15198,8 +15300,8 @@ async def test_describe_conversion_workspace_revisions_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - clouddms.FetchStaticIpsRequest, - dict, + clouddms.FetchStaticIpsRequest(), + {}, ], ) def test_fetch_static_ips(request_type, transport: str = "grpc"): @@ -15210,7 +15312,7 @@ def test_fetch_static_ips(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.fetch_static_ips), "__call__") as call: @@ -15257,10 +15359,11 @@ def test_fetch_static_ips_non_empty_request_with_auto_populated_field(): client.fetch_static_ips(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == clouddms.FetchStaticIpsRequest( + request_msg = clouddms.FetchStaticIpsRequest( name="name_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_fetch_static_ips_use_cached_wrapped_rpc(): @@ -15343,9 +15446,14 @@ async def test_fetch_static_ips_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_fetch_static_ips_async( - transport: str = "grpc_asyncio", request_type=clouddms.FetchStaticIpsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + clouddms.FetchStaticIpsRequest(), + {}, + ], +) +async def test_fetch_static_ips_async(request_type, transport: str = "grpc_asyncio"): client = DataMigrationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -15353,7 +15461,7 @@ async def test_fetch_static_ips_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.fetch_static_ips), "__call__") as call: @@ -15378,11 +15486,6 @@ async def test_fetch_static_ips_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_fetch_static_ips_async_from_dict(): - await test_fetch_static_ips_async(request_type=dict) - - def test_fetch_static_ips_field_headers(): client = DataMigrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15840,7 +15943,6 @@ def test_list_migration_jobs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.ListMigrationJobsRequest() - assert args[0] == request_msg @@ -15863,7 +15965,6 @@ def test_get_migration_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.GetMigrationJobRequest() - assert args[0] == request_msg @@ -15886,7 +15987,6 @@ def test_create_migration_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.CreateMigrationJobRequest() - assert args[0] == request_msg @@ -15909,7 +16009,6 @@ def test_update_migration_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.UpdateMigrationJobRequest() - assert args[0] == request_msg @@ -15932,7 +16031,6 @@ def test_delete_migration_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.DeleteMigrationJobRequest() - assert args[0] == request_msg @@ -15955,7 +16053,6 @@ def test_start_migration_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.StartMigrationJobRequest() - assert args[0] == request_msg @@ -15978,7 +16075,6 @@ def test_stop_migration_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.StopMigrationJobRequest() - assert args[0] == request_msg @@ -16001,7 +16097,6 @@ def test_resume_migration_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.ResumeMigrationJobRequest() - assert args[0] == request_msg @@ -16024,7 +16119,6 @@ def test_promote_migration_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.PromoteMigrationJobRequest() - assert args[0] == request_msg @@ -16047,7 +16141,6 @@ def test_verify_migration_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.VerifyMigrationJobRequest() - assert args[0] == request_msg @@ -16070,7 +16163,6 @@ def test_restart_migration_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.RestartMigrationJobRequest() - assert args[0] == request_msg @@ -16093,7 +16185,6 @@ def test_generate_ssh_script_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.GenerateSshScriptRequest() - assert args[0] == request_msg @@ -16116,7 +16207,6 @@ def test_generate_tcp_proxy_script_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.GenerateTcpProxyScriptRequest() - assert args[0] == request_msg @@ -16139,7 +16229,6 @@ def test_list_connection_profiles_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.ListConnectionProfilesRequest() - assert args[0] == request_msg @@ -16162,7 +16251,6 @@ def test_get_connection_profile_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.GetConnectionProfileRequest() - assert args[0] == request_msg @@ -16185,7 +16273,6 @@ def test_create_connection_profile_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.CreateConnectionProfileRequest() - assert args[0] == request_msg @@ -16208,7 +16295,6 @@ def test_update_connection_profile_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.UpdateConnectionProfileRequest() - assert args[0] == request_msg @@ -16231,7 +16317,6 @@ def test_delete_connection_profile_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.DeleteConnectionProfileRequest() - assert args[0] == request_msg @@ -16254,7 +16339,6 @@ def test_create_private_connection_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.CreatePrivateConnectionRequest() - assert args[0] == request_msg @@ -16277,7 +16361,6 @@ def test_get_private_connection_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.GetPrivateConnectionRequest() - assert args[0] == request_msg @@ -16300,7 +16383,6 @@ def test_list_private_connections_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.ListPrivateConnectionsRequest() - assert args[0] == request_msg @@ -16323,7 +16405,6 @@ def test_delete_private_connection_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.DeletePrivateConnectionRequest() - assert args[0] == request_msg @@ -16346,7 +16427,6 @@ def test_get_conversion_workspace_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.GetConversionWorkspaceRequest() - assert args[0] == request_msg @@ -16369,7 +16449,6 @@ def test_list_conversion_workspaces_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.ListConversionWorkspacesRequest() - assert args[0] == request_msg @@ -16392,7 +16471,6 @@ def test_create_conversion_workspace_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.CreateConversionWorkspaceRequest() - assert args[0] == request_msg @@ -16415,7 +16493,6 @@ def test_update_conversion_workspace_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.UpdateConversionWorkspaceRequest() - assert args[0] == request_msg @@ -16438,7 +16515,6 @@ def test_delete_conversion_workspace_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.DeleteConversionWorkspaceRequest() - assert args[0] == request_msg @@ -16461,7 +16537,6 @@ def test_create_mapping_rule_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.CreateMappingRuleRequest() - assert args[0] == request_msg @@ -16484,7 +16559,6 @@ def test_delete_mapping_rule_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.DeleteMappingRuleRequest() - assert args[0] == request_msg @@ -16507,7 +16581,6 @@ def test_list_mapping_rules_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.ListMappingRulesRequest() - assert args[0] == request_msg @@ -16528,7 +16601,6 @@ def test_get_mapping_rule_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.GetMappingRuleRequest() - assert args[0] == request_msg @@ -16551,7 +16623,6 @@ def test_seed_conversion_workspace_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.SeedConversionWorkspaceRequest() - assert args[0] == request_msg @@ -16574,7 +16645,6 @@ def test_import_mapping_rules_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.ImportMappingRulesRequest() - assert args[0] == request_msg @@ -16597,7 +16667,6 @@ def test_convert_conversion_workspace_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.ConvertConversionWorkspaceRequest() - assert args[0] == request_msg @@ -16620,7 +16689,6 @@ def test_commit_conversion_workspace_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.CommitConversionWorkspaceRequest() - assert args[0] == request_msg @@ -16643,7 +16711,6 @@ def test_rollback_conversion_workspace_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.RollbackConversionWorkspaceRequest() - assert args[0] == request_msg @@ -16666,7 +16733,6 @@ def test_apply_conversion_workspace_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.ApplyConversionWorkspaceRequest() - assert args[0] == request_msg @@ -16689,7 +16755,6 @@ def test_describe_database_entities_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.DescribeDatabaseEntitiesRequest() - assert args[0] == request_msg @@ -16712,7 +16777,6 @@ def test_search_background_jobs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.SearchBackgroundJobsRequest() - assert args[0] == request_msg @@ -16735,7 +16799,6 @@ def test_describe_conversion_workspace_revisions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.DescribeConversionWorkspaceRevisionsRequest() - assert args[0] == request_msg @@ -16756,7 +16819,6 @@ def test_fetch_static_ips_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.FetchStaticIpsRequest() - assert args[0] == request_msg @@ -16800,7 +16862,6 @@ async def test_list_migration_jobs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.ListMigrationJobsRequest() - assert args[0] == request_msg @@ -16838,7 +16899,6 @@ async def test_get_migration_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.GetMigrationJobRequest() - assert args[0] == request_msg @@ -16865,7 +16925,6 @@ async def test_create_migration_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.CreateMigrationJobRequest() - assert args[0] == request_msg @@ -16892,7 +16951,6 @@ async def test_update_migration_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.UpdateMigrationJobRequest() - assert args[0] == request_msg @@ -16919,7 +16977,6 @@ async def test_delete_migration_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.DeleteMigrationJobRequest() - assert args[0] == request_msg @@ -16946,7 +17003,6 @@ async def test_start_migration_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.StartMigrationJobRequest() - assert args[0] == request_msg @@ -16973,7 +17029,6 @@ async def test_stop_migration_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.StopMigrationJobRequest() - assert args[0] == request_msg @@ -17000,7 +17055,6 @@ async def test_resume_migration_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.ResumeMigrationJobRequest() - assert args[0] == request_msg @@ -17027,7 +17081,6 @@ async def test_promote_migration_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.PromoteMigrationJobRequest() - assert args[0] == request_msg @@ -17054,7 +17107,6 @@ async def test_verify_migration_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.VerifyMigrationJobRequest() - assert args[0] == request_msg @@ -17081,7 +17133,6 @@ async def test_restart_migration_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.RestartMigrationJobRequest() - assert args[0] == request_msg @@ -17110,7 +17161,6 @@ async def test_generate_ssh_script_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.GenerateSshScriptRequest() - assert args[0] == request_msg @@ -17139,7 +17189,6 @@ async def test_generate_tcp_proxy_script_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.GenerateTcpProxyScriptRequest() - assert args[0] == request_msg @@ -17169,7 +17218,6 @@ async def test_list_connection_profiles_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.ListConnectionProfilesRequest() - assert args[0] == request_msg @@ -17201,7 +17249,6 @@ async def test_get_connection_profile_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.GetConnectionProfileRequest() - assert args[0] == request_msg @@ -17228,7 +17275,6 @@ async def test_create_connection_profile_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.CreateConnectionProfileRequest() - assert args[0] == request_msg @@ -17255,7 +17301,6 @@ async def test_update_connection_profile_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.UpdateConnectionProfileRequest() - assert args[0] == request_msg @@ -17282,7 +17327,6 @@ async def test_delete_connection_profile_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.DeleteConnectionProfileRequest() - assert args[0] == request_msg @@ -17309,7 +17353,6 @@ async def test_create_private_connection_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.CreatePrivateConnectionRequest() - assert args[0] == request_msg @@ -17340,7 +17383,6 @@ async def test_get_private_connection_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.GetPrivateConnectionRequest() - assert args[0] == request_msg @@ -17370,7 +17412,6 @@ async def test_list_private_connections_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.ListPrivateConnectionsRequest() - assert args[0] == request_msg @@ -17397,7 +17438,6 @@ async def test_delete_private_connection_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.DeletePrivateConnectionRequest() - assert args[0] == request_msg @@ -17429,7 +17469,6 @@ async def test_get_conversion_workspace_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.GetConversionWorkspaceRequest() - assert args[0] == request_msg @@ -17459,7 +17498,6 @@ async def test_list_conversion_workspaces_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.ListConversionWorkspacesRequest() - assert args[0] == request_msg @@ -17486,7 +17524,6 @@ async def test_create_conversion_workspace_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.CreateConversionWorkspaceRequest() - assert args[0] == request_msg @@ -17513,7 +17550,6 @@ async def test_update_conversion_workspace_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.UpdateConversionWorkspaceRequest() - assert args[0] == request_msg @@ -17540,7 +17576,6 @@ async def test_delete_conversion_workspace_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.DeleteConversionWorkspaceRequest() - assert args[0] == request_msg @@ -17574,7 +17609,6 @@ async def test_create_mapping_rule_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.CreateMappingRuleRequest() - assert args[0] == request_msg @@ -17599,7 +17633,6 @@ async def test_delete_mapping_rule_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.DeleteMappingRuleRequest() - assert args[0] == request_msg @@ -17628,7 +17661,6 @@ async def test_list_mapping_rules_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.ListMappingRulesRequest() - assert args[0] == request_msg @@ -17660,7 +17692,6 @@ async def test_get_mapping_rule_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.GetMappingRuleRequest() - assert args[0] == request_msg @@ -17687,7 +17718,6 @@ async def test_seed_conversion_workspace_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.SeedConversionWorkspaceRequest() - assert args[0] == request_msg @@ -17714,7 +17744,6 @@ async def test_import_mapping_rules_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.ImportMappingRulesRequest() - assert args[0] == request_msg @@ -17741,7 +17770,6 @@ async def test_convert_conversion_workspace_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.ConvertConversionWorkspaceRequest() - assert args[0] == request_msg @@ -17768,7 +17796,6 @@ async def test_commit_conversion_workspace_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.CommitConversionWorkspaceRequest() - assert args[0] == request_msg @@ -17795,7 +17822,6 @@ async def test_rollback_conversion_workspace_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.RollbackConversionWorkspaceRequest() - assert args[0] == request_msg @@ -17822,7 +17848,6 @@ async def test_apply_conversion_workspace_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.ApplyConversionWorkspaceRequest() - assert args[0] == request_msg @@ -17851,7 +17876,6 @@ async def test_describe_database_entities_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.DescribeDatabaseEntitiesRequest() - assert args[0] == request_msg @@ -17878,7 +17902,6 @@ async def test_search_background_jobs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.SearchBackgroundJobsRequest() - assert args[0] == request_msg @@ -17905,7 +17928,6 @@ async def test_describe_conversion_workspace_revisions_empty_call_grpc_asyncio() call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.DescribeConversionWorkspaceRevisionsRequest() - assert args[0] == request_msg @@ -17933,7 +17955,6 @@ async def test_fetch_static_ips_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = clouddms.FetchStaticIpsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-documentai/noxfile.py b/packages/google-cloud-documentai/noxfile.py index f54bccf0917f..8dcff8465a6c 100644 --- a/packages/google-cloud-documentai/noxfile.py +++ b/packages/google-cloud-documentai/noxfile.py @@ -47,7 +47,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-documentai" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-documentai/setup.py b/packages/google-cloud-documentai/setup.py index 8c1e32275032..acb38ef0ea31 100644 --- a/packages/google-cloud-documentai/setup.py +++ b/packages/google-cloud-documentai/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/google-cloud-documentai/testing/constraints-3.10.txt b/packages/google-cloud-documentai/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-documentai/testing/constraints-3.10.txt +++ b/packages/google-cloud-documentai/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-documentai/tests/unit/gapic/documentai_v1/test_document_processor_service.py b/packages/google-cloud-documentai/tests/unit/gapic/documentai_v1/test_document_processor_service.py index 0e3afc0513a3..93d16a420d35 100644 --- a/packages/google-cloud-documentai/tests/unit/gapic/documentai_v1/test_document_processor_service.py +++ b/packages/google-cloud-documentai/tests/unit/gapic/documentai_v1/test_document_processor_service.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 @@ -137,6 +138,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" @@ -1412,8 +1428,8 @@ def test_document_processor_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - document_processor_service.ProcessRequest, - dict, + document_processor_service.ProcessRequest(), + {}, ], ) def test_process_document(request_type, transport: str = "grpc"): @@ -1424,7 +1440,7 @@ def test_process_document(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.process_document), "__call__") as call: @@ -1465,9 +1481,10 @@ def test_process_document_non_empty_request_with_auto_populated_field(): client.process_document(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_processor_service.ProcessRequest( + request_msg = document_processor_service.ProcessRequest( name="name_value", ) + assert args[0] == request_msg def test_process_document_use_cached_wrapped_rpc(): @@ -1550,10 +1567,14 @@ async def test_process_document_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_process_document_async( - transport: str = "grpc_asyncio", - request_type=document_processor_service.ProcessRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + document_processor_service.ProcessRequest(), + {}, + ], +) +async def test_process_document_async(request_type, transport: str = "grpc_asyncio"): client = DocumentProcessorServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1561,7 +1582,7 @@ async def test_process_document_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.process_document), "__call__") as call: @@ -1581,11 +1602,6 @@ async def test_process_document_async( assert isinstance(response, document_processor_service.ProcessResponse) -@pytest.mark.asyncio -async def test_process_document_async_from_dict(): - await test_process_document_async(request_type=dict) - - def test_process_document_field_headers(): client = DocumentProcessorServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1732,8 +1748,8 @@ async def test_process_document_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - document_processor_service.BatchProcessRequest, - dict, + document_processor_service.BatchProcessRequest(), + {}, ], ) def test_batch_process_documents(request_type, transport: str = "grpc"): @@ -1744,7 +1760,7 @@ def test_batch_process_documents(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1789,9 +1805,10 @@ def test_batch_process_documents_non_empty_request_with_auto_populated_field(): client.batch_process_documents(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_processor_service.BatchProcessRequest( + request_msg = document_processor_service.BatchProcessRequest( name="name_value", ) + assert args[0] == request_msg def test_batch_process_documents_use_cached_wrapped_rpc(): @@ -1887,9 +1904,15 @@ async def test_batch_process_documents_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + document_processor_service.BatchProcessRequest(), + {}, + ], +) async def test_batch_process_documents_async( - transport: str = "grpc_asyncio", - request_type=document_processor_service.BatchProcessRequest, + request_type, transport: str = "grpc_asyncio" ): client = DocumentProcessorServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1898,7 +1921,7 @@ async def test_batch_process_documents_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( @@ -1920,11 +1943,6 @@ async def test_batch_process_documents_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_batch_process_documents_async_from_dict(): - await test_batch_process_documents_async(request_type=dict) - - def test_batch_process_documents_field_headers(): client = DocumentProcessorServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2079,8 +2097,8 @@ async def test_batch_process_documents_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - document_processor_service.FetchProcessorTypesRequest, - dict, + document_processor_service.FetchProcessorTypesRequest(), + {}, ], ) def test_fetch_processor_types(request_type, transport: str = "grpc"): @@ -2091,7 +2109,7 @@ def test_fetch_processor_types(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2136,9 +2154,10 @@ def test_fetch_processor_types_non_empty_request_with_auto_populated_field(): client.fetch_processor_types(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_processor_service.FetchProcessorTypesRequest( + request_msg = document_processor_service.FetchProcessorTypesRequest( parent="parent_value", ) + assert args[0] == request_msg def test_fetch_processor_types_use_cached_wrapped_rpc(): @@ -2224,9 +2243,15 @@ async def test_fetch_processor_types_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + document_processor_service.FetchProcessorTypesRequest(), + {}, + ], +) async def test_fetch_processor_types_async( - transport: str = "grpc_asyncio", - request_type=document_processor_service.FetchProcessorTypesRequest, + request_type, transport: str = "grpc_asyncio" ): client = DocumentProcessorServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2235,7 +2260,7 @@ async def test_fetch_processor_types_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( @@ -2257,11 +2282,6 @@ async def test_fetch_processor_types_async( assert isinstance(response, document_processor_service.FetchProcessorTypesResponse) -@pytest.mark.asyncio -async def test_fetch_processor_types_async_from_dict(): - await test_fetch_processor_types_async(request_type=dict) - - def test_fetch_processor_types_field_headers(): client = DocumentProcessorServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2416,8 +2436,8 @@ async def test_fetch_processor_types_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - document_processor_service.ListProcessorTypesRequest, - dict, + document_processor_service.ListProcessorTypesRequest(), + {}, ], ) def test_list_processor_types(request_type, transport: str = "grpc"): @@ -2428,7 +2448,7 @@ def test_list_processor_types(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,10 +2497,11 @@ def test_list_processor_types_non_empty_request_with_auto_populated_field(): client.list_processor_types(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_processor_service.ListProcessorTypesRequest( + request_msg = document_processor_service.ListProcessorTypesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_processor_types_use_cached_wrapped_rpc(): @@ -2565,9 +2586,15 @@ async def test_list_processor_types_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + document_processor_service.ListProcessorTypesRequest(), + {}, + ], +) async def test_list_processor_types_async( - transport: str = "grpc_asyncio", - request_type=document_processor_service.ListProcessorTypesRequest, + request_type, transport: str = "grpc_asyncio" ): client = DocumentProcessorServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2576,7 +2603,7 @@ async def test_list_processor_types_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 +2628,6 @@ async def test_list_processor_types_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_processor_types_async_from_dict(): - await test_list_processor_types_async(request_type=dict) - - def test_list_processor_types_field_headers(): client = DocumentProcessorServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2958,8 +2980,8 @@ async def test_list_processor_types_async_pages(): @pytest.mark.parametrize( "request_type", [ - document_processor_service.GetProcessorTypeRequest, - dict, + document_processor_service.GetProcessorTypeRequest(), + {}, ], ) def test_get_processor_type(request_type, transport: str = "grpc"): @@ -2970,7 +2992,7 @@ def test_get_processor_type(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3028,9 +3050,10 @@ def test_get_processor_type_non_empty_request_with_auto_populated_field(): client.get_processor_type(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_processor_service.GetProcessorTypeRequest( + request_msg = document_processor_service.GetProcessorTypeRequest( name="name_value", ) + assert args[0] == request_msg def test_get_processor_type_use_cached_wrapped_rpc(): @@ -3115,10 +3138,14 @@ async def test_get_processor_type_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_processor_type_async( - transport: str = "grpc_asyncio", - request_type=document_processor_service.GetProcessorTypeRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + document_processor_service.GetProcessorTypeRequest(), + {}, + ], +) +async def test_get_processor_type_async(request_type, transport: str = "grpc_asyncio"): client = DocumentProcessorServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3126,7 +3153,7 @@ async def test_get_processor_type_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( @@ -3161,11 +3188,6 @@ async def test_get_processor_type_async( assert response.sample_document_uris == ["sample_document_uris_value"] -@pytest.mark.asyncio -async def test_get_processor_type_async_from_dict(): - await test_get_processor_type_async(request_type=dict) - - def test_get_processor_type_field_headers(): client = DocumentProcessorServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3320,8 +3342,8 @@ async def test_get_processor_type_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - document_processor_service.ListProcessorsRequest, - dict, + document_processor_service.ListProcessorsRequest(), + {}, ], ) def test_list_processors(request_type, transport: str = "grpc"): @@ -3332,7 +3354,7 @@ def test_list_processors(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_processors), "__call__") as call: @@ -3377,10 +3399,11 @@ def test_list_processors_non_empty_request_with_auto_populated_field(): client.list_processors(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_processor_service.ListProcessorsRequest( + request_msg = document_processor_service.ListProcessorsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_processors_use_cached_wrapped_rpc(): @@ -3461,10 +3484,14 @@ async def test_list_processors_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_processors_async( - transport: str = "grpc_asyncio", - request_type=document_processor_service.ListProcessorsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + document_processor_service.ListProcessorsRequest(), + {}, + ], +) +async def test_list_processors_async(request_type, transport: str = "grpc_asyncio"): client = DocumentProcessorServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3472,7 +3499,7 @@ async def test_list_processors_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_processors), "__call__") as call: @@ -3495,11 +3522,6 @@ async def test_list_processors_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_processors_async_from_dict(): - await test_list_processors_async(request_type=dict) - - def test_list_processors_field_headers(): client = DocumentProcessorServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3836,8 +3858,8 @@ async def test_list_processors_async_pages(): @pytest.mark.parametrize( "request_type", [ - document_processor_service.GetProcessorRequest, - dict, + document_processor_service.GetProcessorRequest(), + {}, ], ) def test_get_processor(request_type, transport: str = "grpc"): @@ -3848,7 +3870,7 @@ def test_get_processor(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_processor), "__call__") as call: @@ -3908,9 +3930,10 @@ def test_get_processor_non_empty_request_with_auto_populated_field(): client.get_processor(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_processor_service.GetProcessorRequest( + request_msg = document_processor_service.GetProcessorRequest( name="name_value", ) + assert args[0] == request_msg def test_get_processor_use_cached_wrapped_rpc(): @@ -3991,10 +4014,14 @@ async def test_get_processor_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_processor_async( - transport: str = "grpc_asyncio", - request_type=document_processor_service.GetProcessorRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + document_processor_service.GetProcessorRequest(), + {}, + ], +) +async def test_get_processor_async(request_type, transport: str = "grpc_asyncio"): client = DocumentProcessorServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4002,7 +4029,7 @@ async def test_get_processor_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_processor), "__call__") as call: @@ -4041,11 +4068,6 @@ async def test_get_processor_async( assert response.satisfies_pzi is True -@pytest.mark.asyncio -async def test_get_processor_async_from_dict(): - await test_get_processor_async(request_type=dict) - - def test_get_processor_field_headers(): client = DocumentProcessorServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4188,8 +4210,8 @@ async def test_get_processor_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - document_processor_service.TrainProcessorVersionRequest, - dict, + document_processor_service.TrainProcessorVersionRequest(), + {}, ], ) def test_train_processor_version(request_type, transport: str = "grpc"): @@ -4200,7 +4222,7 @@ def test_train_processor_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4246,10 +4268,11 @@ def test_train_processor_version_non_empty_request_with_auto_populated_field(): client.train_processor_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_processor_service.TrainProcessorVersionRequest( + request_msg = document_processor_service.TrainProcessorVersionRequest( parent="parent_value", base_processor_version="base_processor_version_value", ) + assert args[0] == request_msg def test_train_processor_version_use_cached_wrapped_rpc(): @@ -4345,9 +4368,15 @@ async def test_train_processor_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + document_processor_service.TrainProcessorVersionRequest(), + {}, + ], +) async def test_train_processor_version_async( - transport: str = "grpc_asyncio", - request_type=document_processor_service.TrainProcessorVersionRequest, + request_type, transport: str = "grpc_asyncio" ): client = DocumentProcessorServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4356,7 +4385,7 @@ async def test_train_processor_version_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( @@ -4378,11 +4407,6 @@ async def test_train_processor_version_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_train_processor_version_async_from_dict(): - await test_train_processor_version_async(request_type=dict) - - def test_train_processor_version_field_headers(): client = DocumentProcessorServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4547,8 +4571,8 @@ async def test_train_processor_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - document_processor_service.GetProcessorVersionRequest, - dict, + document_processor_service.GetProcessorVersionRequest(), + {}, ], ) def test_get_processor_version(request_type, transport: str = "grpc"): @@ -4559,7 +4583,7 @@ def test_get_processor_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4626,9 +4650,10 @@ def test_get_processor_version_non_empty_request_with_auto_populated_field(): client.get_processor_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_processor_service.GetProcessorVersionRequest( + request_msg = document_processor_service.GetProcessorVersionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_processor_version_use_cached_wrapped_rpc(): @@ -4714,9 +4739,15 @@ async def test_get_processor_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + document_processor_service.GetProcessorVersionRequest(), + {}, + ], +) async def test_get_processor_version_async( - transport: str = "grpc_asyncio", - request_type=document_processor_service.GetProcessorVersionRequest, + request_type, transport: str = "grpc_asyncio" ): client = DocumentProcessorServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4725,7 +4756,7 @@ async def test_get_processor_version_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( @@ -4769,11 +4800,6 @@ async def test_get_processor_version_async( assert response.satisfies_pzi is True -@pytest.mark.asyncio -async def test_get_processor_version_async_from_dict(): - await test_get_processor_version_async(request_type=dict) - - def test_get_processor_version_field_headers(): client = DocumentProcessorServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4928,8 +4954,8 @@ async def test_get_processor_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - document_processor_service.ListProcessorVersionsRequest, - dict, + document_processor_service.ListProcessorVersionsRequest(), + {}, ], ) def test_list_processor_versions(request_type, transport: str = "grpc"): @@ -4940,7 +4966,7 @@ def test_list_processor_versions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4989,10 +5015,11 @@ def test_list_processor_versions_non_empty_request_with_auto_populated_field(): client.list_processor_versions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_processor_service.ListProcessorVersionsRequest( + request_msg = document_processor_service.ListProcessorVersionsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_processor_versions_use_cached_wrapped_rpc(): @@ -5078,9 +5105,15 @@ async def test_list_processor_versions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + document_processor_service.ListProcessorVersionsRequest(), + {}, + ], +) async def test_list_processor_versions_async( - transport: str = "grpc_asyncio", - request_type=document_processor_service.ListProcessorVersionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = DocumentProcessorServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5089,7 +5122,7 @@ async def test_list_processor_versions_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( @@ -5114,11 +5147,6 @@ async def test_list_processor_versions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_processor_versions_async_from_dict(): - await test_list_processor_versions_async(request_type=dict) - - def test_list_processor_versions_field_headers(): client = DocumentProcessorServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5471,8 +5499,8 @@ async def test_list_processor_versions_async_pages(): @pytest.mark.parametrize( "request_type", [ - document_processor_service.DeleteProcessorVersionRequest, - dict, + document_processor_service.DeleteProcessorVersionRequest(), + {}, ], ) def test_delete_processor_version(request_type, transport: str = "grpc"): @@ -5483,7 +5511,7 @@ def test_delete_processor_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5528,9 +5556,10 @@ def test_delete_processor_version_non_empty_request_with_auto_populated_field(): client.delete_processor_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_processor_service.DeleteProcessorVersionRequest( + request_msg = document_processor_service.DeleteProcessorVersionRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_processor_version_use_cached_wrapped_rpc(): @@ -5626,9 +5655,15 @@ async def test_delete_processor_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + document_processor_service.DeleteProcessorVersionRequest(), + {}, + ], +) async def test_delete_processor_version_async( - transport: str = "grpc_asyncio", - request_type=document_processor_service.DeleteProcessorVersionRequest, + request_type, transport: str = "grpc_asyncio" ): client = DocumentProcessorServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5637,7 +5672,7 @@ async def test_delete_processor_version_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( @@ -5659,11 +5694,6 @@ async def test_delete_processor_version_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_processor_version_async_from_dict(): - await test_delete_processor_version_async(request_type=dict) - - def test_delete_processor_version_field_headers(): client = DocumentProcessorServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5818,8 +5848,8 @@ async def test_delete_processor_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - document_processor_service.DeployProcessorVersionRequest, - dict, + document_processor_service.DeployProcessorVersionRequest(), + {}, ], ) def test_deploy_processor_version(request_type, transport: str = "grpc"): @@ -5830,7 +5860,7 @@ def test_deploy_processor_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5875,9 +5905,10 @@ def test_deploy_processor_version_non_empty_request_with_auto_populated_field(): client.deploy_processor_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_processor_service.DeployProcessorVersionRequest( + request_msg = document_processor_service.DeployProcessorVersionRequest( name="name_value", ) + assert args[0] == request_msg def test_deploy_processor_version_use_cached_wrapped_rpc(): @@ -5973,9 +6004,15 @@ async def test_deploy_processor_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + document_processor_service.DeployProcessorVersionRequest(), + {}, + ], +) async def test_deploy_processor_version_async( - transport: str = "grpc_asyncio", - request_type=document_processor_service.DeployProcessorVersionRequest, + request_type, transport: str = "grpc_asyncio" ): client = DocumentProcessorServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5984,7 +6021,7 @@ async def test_deploy_processor_version_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( @@ -6006,11 +6043,6 @@ async def test_deploy_processor_version_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_deploy_processor_version_async_from_dict(): - await test_deploy_processor_version_async(request_type=dict) - - def test_deploy_processor_version_field_headers(): client = DocumentProcessorServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6165,8 +6197,8 @@ async def test_deploy_processor_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - document_processor_service.UndeployProcessorVersionRequest, - dict, + document_processor_service.UndeployProcessorVersionRequest(), + {}, ], ) def test_undeploy_processor_version(request_type, transport: str = "grpc"): @@ -6177,7 +6209,7 @@ def test_undeploy_processor_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6222,9 +6254,10 @@ def test_undeploy_processor_version_non_empty_request_with_auto_populated_field( client.undeploy_processor_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_processor_service.UndeployProcessorVersionRequest( + request_msg = document_processor_service.UndeployProcessorVersionRequest( name="name_value", ) + assert args[0] == request_msg def test_undeploy_processor_version_use_cached_wrapped_rpc(): @@ -6320,9 +6353,15 @@ async def test_undeploy_processor_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + document_processor_service.UndeployProcessorVersionRequest(), + {}, + ], +) async def test_undeploy_processor_version_async( - transport: str = "grpc_asyncio", - request_type=document_processor_service.UndeployProcessorVersionRequest, + request_type, transport: str = "grpc_asyncio" ): client = DocumentProcessorServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -6331,7 +6370,7 @@ async def test_undeploy_processor_version_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( @@ -6353,11 +6392,6 @@ async def test_undeploy_processor_version_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_undeploy_processor_version_async_from_dict(): - await test_undeploy_processor_version_async(request_type=dict) - - def test_undeploy_processor_version_field_headers(): client = DocumentProcessorServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6512,8 +6546,8 @@ async def test_undeploy_processor_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - document_processor_service.CreateProcessorRequest, - dict, + document_processor_service.CreateProcessorRequest(), + {}, ], ) def test_create_processor(request_type, transport: str = "grpc"): @@ -6524,7 +6558,7 @@ def test_create_processor(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_processor), "__call__") as call: @@ -6584,9 +6618,10 @@ def test_create_processor_non_empty_request_with_auto_populated_field(): client.create_processor(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_processor_service.CreateProcessorRequest( + request_msg = document_processor_service.CreateProcessorRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_processor_use_cached_wrapped_rpc(): @@ -6669,10 +6704,14 @@ async def test_create_processor_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_processor_async( - transport: str = "grpc_asyncio", - request_type=document_processor_service.CreateProcessorRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + document_processor_service.CreateProcessorRequest(), + {}, + ], +) +async def test_create_processor_async(request_type, transport: str = "grpc_asyncio"): client = DocumentProcessorServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6680,7 +6719,7 @@ async def test_create_processor_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_processor), "__call__") as call: @@ -6719,11 +6758,6 @@ async def test_create_processor_async( assert response.satisfies_pzi is True -@pytest.mark.asyncio -async def test_create_processor_async_from_dict(): - await test_create_processor_async(request_type=dict) - - def test_create_processor_field_headers(): client = DocumentProcessorServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6880,8 +6914,8 @@ async def test_create_processor_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - document_processor_service.DeleteProcessorRequest, - dict, + document_processor_service.DeleteProcessorRequest(), + {}, ], ) def test_delete_processor(request_type, transport: str = "grpc"): @@ -6892,7 +6926,7 @@ def test_delete_processor(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_processor), "__call__") as call: @@ -6933,9 +6967,10 @@ def test_delete_processor_non_empty_request_with_auto_populated_field(): client.delete_processor(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_processor_service.DeleteProcessorRequest( + request_msg = document_processor_service.DeleteProcessorRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_processor_use_cached_wrapped_rpc(): @@ -7028,10 +7063,14 @@ async def test_delete_processor_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_processor_async( - transport: str = "grpc_asyncio", - request_type=document_processor_service.DeleteProcessorRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + document_processor_service.DeleteProcessorRequest(), + {}, + ], +) +async def test_delete_processor_async(request_type, transport: str = "grpc_asyncio"): client = DocumentProcessorServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7039,7 +7078,7 @@ async def test_delete_processor_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_processor), "__call__") as call: @@ -7059,11 +7098,6 @@ async def test_delete_processor_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_processor_async_from_dict(): - await test_delete_processor_async(request_type=dict) - - def test_delete_processor_field_headers(): client = DocumentProcessorServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7210,8 +7244,8 @@ async def test_delete_processor_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - document_processor_service.EnableProcessorRequest, - dict, + document_processor_service.EnableProcessorRequest(), + {}, ], ) def test_enable_processor(request_type, transport: str = "grpc"): @@ -7222,7 +7256,7 @@ def test_enable_processor(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.enable_processor), "__call__") as call: @@ -7263,9 +7297,10 @@ def test_enable_processor_non_empty_request_with_auto_populated_field(): client.enable_processor(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_processor_service.EnableProcessorRequest( + request_msg = document_processor_service.EnableProcessorRequest( name="name_value", ) + assert args[0] == request_msg def test_enable_processor_use_cached_wrapped_rpc(): @@ -7358,10 +7393,14 @@ async def test_enable_processor_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_enable_processor_async( - transport: str = "grpc_asyncio", - request_type=document_processor_service.EnableProcessorRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + document_processor_service.EnableProcessorRequest(), + {}, + ], +) +async def test_enable_processor_async(request_type, transport: str = "grpc_asyncio"): client = DocumentProcessorServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7369,7 +7408,7 @@ async def test_enable_processor_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.enable_processor), "__call__") as call: @@ -7389,11 +7428,6 @@ async def test_enable_processor_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_enable_processor_async_from_dict(): - await test_enable_processor_async(request_type=dict) - - def test_enable_processor_field_headers(): client = DocumentProcessorServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7458,8 +7492,8 @@ async def test_enable_processor_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - document_processor_service.DisableProcessorRequest, - dict, + document_processor_service.DisableProcessorRequest(), + {}, ], ) def test_disable_processor(request_type, transport: str = "grpc"): @@ -7470,7 +7504,7 @@ def test_disable_processor(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7515,9 +7549,10 @@ def test_disable_processor_non_empty_request_with_auto_populated_field(): client.disable_processor(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_processor_service.DisableProcessorRequest( + request_msg = document_processor_service.DisableProcessorRequest( name="name_value", ) + assert args[0] == request_msg def test_disable_processor_use_cached_wrapped_rpc(): @@ -7610,10 +7645,14 @@ async def test_disable_processor_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_disable_processor_async( - transport: str = "grpc_asyncio", - request_type=document_processor_service.DisableProcessorRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + document_processor_service.DisableProcessorRequest(), + {}, + ], +) +async def test_disable_processor_async(request_type, transport: str = "grpc_asyncio"): client = DocumentProcessorServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7621,7 +7660,7 @@ async def test_disable_processor_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( @@ -7643,11 +7682,6 @@ async def test_disable_processor_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_disable_processor_async_from_dict(): - await test_disable_processor_async(request_type=dict) - - def test_disable_processor_field_headers(): client = DocumentProcessorServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7716,8 +7750,8 @@ async def test_disable_processor_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - document_processor_service.SetDefaultProcessorVersionRequest, - dict, + document_processor_service.SetDefaultProcessorVersionRequest(), + {}, ], ) def test_set_default_processor_version(request_type, transport: str = "grpc"): @@ -7728,7 +7762,7 @@ def test_set_default_processor_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7774,10 +7808,11 @@ def test_set_default_processor_version_non_empty_request_with_auto_populated_fie client.set_default_processor_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_processor_service.SetDefaultProcessorVersionRequest( + request_msg = document_processor_service.SetDefaultProcessorVersionRequest( processor="processor_value", default_processor_version="default_processor_version_value", ) + assert args[0] == request_msg def test_set_default_processor_version_use_cached_wrapped_rpc(): @@ -7873,9 +7908,15 @@ async def test_set_default_processor_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + document_processor_service.SetDefaultProcessorVersionRequest(), + {}, + ], +) async def test_set_default_processor_version_async( - transport: str = "grpc_asyncio", - request_type=document_processor_service.SetDefaultProcessorVersionRequest, + request_type, transport: str = "grpc_asyncio" ): client = DocumentProcessorServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -7884,7 +7925,7 @@ async def test_set_default_processor_version_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( @@ -7906,11 +7947,6 @@ async def test_set_default_processor_version_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_set_default_processor_version_async_from_dict(): - await test_set_default_processor_version_async(request_type=dict) - - def test_set_default_processor_version_field_headers(): client = DocumentProcessorServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7979,8 +8015,8 @@ async def test_set_default_processor_version_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - document_processor_service.ReviewDocumentRequest, - dict, + document_processor_service.ReviewDocumentRequest(), + {}, ], ) def test_review_document(request_type, transport: str = "grpc"): @@ -7991,7 +8027,7 @@ def test_review_document(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.review_document), "__call__") as call: @@ -8032,9 +8068,10 @@ def test_review_document_non_empty_request_with_auto_populated_field(): client.review_document(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_processor_service.ReviewDocumentRequest( + request_msg = document_processor_service.ReviewDocumentRequest( human_review_config="human_review_config_value", ) + assert args[0] == request_msg def test_review_document_use_cached_wrapped_rpc(): @@ -8125,10 +8162,14 @@ async def test_review_document_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_review_document_async( - transport: str = "grpc_asyncio", - request_type=document_processor_service.ReviewDocumentRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + document_processor_service.ReviewDocumentRequest(), + {}, + ], +) +async def test_review_document_async(request_type, transport: str = "grpc_asyncio"): client = DocumentProcessorServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8136,7 +8177,7 @@ async def test_review_document_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.review_document), "__call__") as call: @@ -8156,11 +8197,6 @@ async def test_review_document_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_review_document_async_from_dict(): - await test_review_document_async(request_type=dict) - - def test_review_document_field_headers(): client = DocumentProcessorServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8307,8 +8343,8 @@ async def test_review_document_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - document_processor_service.EvaluateProcessorVersionRequest, - dict, + document_processor_service.EvaluateProcessorVersionRequest(), + {}, ], ) def test_evaluate_processor_version(request_type, transport: str = "grpc"): @@ -8319,7 +8355,7 @@ def test_evaluate_processor_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8364,9 +8400,10 @@ def test_evaluate_processor_version_non_empty_request_with_auto_populated_field( client.evaluate_processor_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_processor_service.EvaluateProcessorVersionRequest( + request_msg = document_processor_service.EvaluateProcessorVersionRequest( processor_version="processor_version_value", ) + assert args[0] == request_msg def test_evaluate_processor_version_use_cached_wrapped_rpc(): @@ -8462,9 +8499,15 @@ async def test_evaluate_processor_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + document_processor_service.EvaluateProcessorVersionRequest(), + {}, + ], +) async def test_evaluate_processor_version_async( - transport: str = "grpc_asyncio", - request_type=document_processor_service.EvaluateProcessorVersionRequest, + request_type, transport: str = "grpc_asyncio" ): client = DocumentProcessorServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -8473,7 +8516,7 @@ async def test_evaluate_processor_version_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( @@ -8495,11 +8538,6 @@ async def test_evaluate_processor_version_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_evaluate_processor_version_async_from_dict(): - await test_evaluate_processor_version_async(request_type=dict) - - def test_evaluate_processor_version_field_headers(): client = DocumentProcessorServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8654,8 +8692,8 @@ async def test_evaluate_processor_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - document_processor_service.GetEvaluationRequest, - dict, + document_processor_service.GetEvaluationRequest(), + {}, ], ) def test_get_evaluation(request_type, transport: str = "grpc"): @@ -8666,7 +8704,7 @@ def test_get_evaluation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_evaluation), "__call__") as call: @@ -8714,9 +8752,10 @@ def test_get_evaluation_non_empty_request_with_auto_populated_field(): client.get_evaluation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_processor_service.GetEvaluationRequest( + request_msg = document_processor_service.GetEvaluationRequest( name="name_value", ) + assert args[0] == request_msg def test_get_evaluation_use_cached_wrapped_rpc(): @@ -8797,10 +8836,14 @@ async def test_get_evaluation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_evaluation_async( - transport: str = "grpc_asyncio", - request_type=document_processor_service.GetEvaluationRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + document_processor_service.GetEvaluationRequest(), + {}, + ], +) +async def test_get_evaluation_async(request_type, transport: str = "grpc_asyncio"): client = DocumentProcessorServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8808,7 +8851,7 @@ async def test_get_evaluation_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_evaluation), "__call__") as call: @@ -8835,11 +8878,6 @@ async def test_get_evaluation_async( assert response.kms_key_version_name == "kms_key_version_name_value" -@pytest.mark.asyncio -async def test_get_evaluation_async_from_dict(): - await test_get_evaluation_async(request_type=dict) - - def test_get_evaluation_field_headers(): client = DocumentProcessorServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8986,8 +9024,8 @@ async def test_get_evaluation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - document_processor_service.ListEvaluationsRequest, - dict, + document_processor_service.ListEvaluationsRequest(), + {}, ], ) def test_list_evaluations(request_type, transport: str = "grpc"): @@ -8998,7 +9036,7 @@ def test_list_evaluations(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_evaluations), "__call__") as call: @@ -9043,10 +9081,11 @@ def test_list_evaluations_non_empty_request_with_auto_populated_field(): client.list_evaluations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_processor_service.ListEvaluationsRequest( + request_msg = document_processor_service.ListEvaluationsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_evaluations_use_cached_wrapped_rpc(): @@ -9129,10 +9168,14 @@ async def test_list_evaluations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_evaluations_async( - transport: str = "grpc_asyncio", - request_type=document_processor_service.ListEvaluationsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + document_processor_service.ListEvaluationsRequest(), + {}, + ], +) +async def test_list_evaluations_async(request_type, transport: str = "grpc_asyncio"): client = DocumentProcessorServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9140,7 +9183,7 @@ async def test_list_evaluations_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_evaluations), "__call__") as call: @@ -9163,11 +9206,6 @@ async def test_list_evaluations_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_evaluations_async_from_dict(): - await test_list_evaluations_async(request_type=dict) - - def test_list_evaluations_field_headers(): client = DocumentProcessorServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13845,7 +13883,6 @@ def test_process_document_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.ProcessRequest() - assert args[0] == request_msg @@ -13868,7 +13905,6 @@ def test_batch_process_documents_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.BatchProcessRequest() - assert args[0] == request_msg @@ -13891,7 +13927,6 @@ def test_fetch_processor_types_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.FetchProcessorTypesRequest() - assert args[0] == request_msg @@ -13914,7 +13949,6 @@ def test_list_processor_types_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.ListProcessorTypesRequest() - assert args[0] == request_msg @@ -13937,7 +13971,6 @@ def test_get_processor_type_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.GetProcessorTypeRequest() - assert args[0] == request_msg @@ -13958,7 +13991,6 @@ def test_list_processors_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.ListProcessorsRequest() - assert args[0] == request_msg @@ -13979,7 +14011,6 @@ def test_get_processor_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.GetProcessorRequest() - assert args[0] == request_msg @@ -14002,7 +14033,6 @@ def test_train_processor_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.TrainProcessorVersionRequest() - assert args[0] == request_msg @@ -14025,7 +14055,6 @@ def test_get_processor_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.GetProcessorVersionRequest() - assert args[0] == request_msg @@ -14048,7 +14077,6 @@ def test_list_processor_versions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.ListProcessorVersionsRequest() - assert args[0] == request_msg @@ -14071,7 +14099,6 @@ def test_delete_processor_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.DeleteProcessorVersionRequest() - assert args[0] == request_msg @@ -14094,7 +14121,6 @@ def test_deploy_processor_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.DeployProcessorVersionRequest() - assert args[0] == request_msg @@ -14117,7 +14143,6 @@ def test_undeploy_processor_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.UndeployProcessorVersionRequest() - assert args[0] == request_msg @@ -14138,7 +14163,6 @@ def test_create_processor_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.CreateProcessorRequest() - assert args[0] == request_msg @@ -14159,7 +14183,6 @@ def test_delete_processor_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.DeleteProcessorRequest() - assert args[0] == request_msg @@ -14180,7 +14203,6 @@ def test_enable_processor_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.EnableProcessorRequest() - assert args[0] == request_msg @@ -14203,7 +14225,6 @@ def test_disable_processor_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.DisableProcessorRequest() - assert args[0] == request_msg @@ -14226,7 +14247,6 @@ def test_set_default_processor_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.SetDefaultProcessorVersionRequest() - assert args[0] == request_msg @@ -14247,7 +14267,6 @@ def test_review_document_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.ReviewDocumentRequest() - assert args[0] == request_msg @@ -14270,7 +14289,6 @@ def test_evaluate_processor_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.EvaluateProcessorVersionRequest() - assert args[0] == request_msg @@ -14291,7 +14309,6 @@ def test_get_evaluation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.GetEvaluationRequest() - assert args[0] == request_msg @@ -14312,7 +14329,6 @@ def test_list_evaluations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.ListEvaluationsRequest() - assert args[0] == request_msg @@ -14351,7 +14367,6 @@ async def test_process_document_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.ProcessRequest() - assert args[0] == request_msg @@ -14378,7 +14393,6 @@ async def test_batch_process_documents_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.BatchProcessRequest() - assert args[0] == request_msg @@ -14405,7 +14419,6 @@ async def test_fetch_processor_types_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.FetchProcessorTypesRequest() - assert args[0] == request_msg @@ -14434,7 +14447,6 @@ async def test_list_processor_types_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.ListProcessorTypesRequest() - assert args[0] == request_msg @@ -14468,7 +14480,6 @@ async def test_get_processor_type_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.GetProcessorTypeRequest() - assert args[0] == request_msg @@ -14495,7 +14506,6 @@ async def test_list_processors_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.ListProcessorsRequest() - assert args[0] == request_msg @@ -14530,7 +14540,6 @@ async def test_get_processor_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.GetProcessorRequest() - assert args[0] == request_msg @@ -14557,7 +14566,6 @@ async def test_train_processor_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.TrainProcessorVersionRequest() - assert args[0] == request_msg @@ -14594,7 +14602,6 @@ async def test_get_processor_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.GetProcessorVersionRequest() - assert args[0] == request_msg @@ -14623,7 +14630,6 @@ async def test_list_processor_versions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.ListProcessorVersionsRequest() - assert args[0] == request_msg @@ -14650,7 +14656,6 @@ async def test_delete_processor_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.DeleteProcessorVersionRequest() - assert args[0] == request_msg @@ -14677,7 +14682,6 @@ async def test_deploy_processor_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.DeployProcessorVersionRequest() - assert args[0] == request_msg @@ -14704,7 +14708,6 @@ async def test_undeploy_processor_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.UndeployProcessorVersionRequest() - assert args[0] == request_msg @@ -14739,7 +14742,6 @@ async def test_create_processor_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.CreateProcessorRequest() - assert args[0] == request_msg @@ -14764,7 +14766,6 @@ async def test_delete_processor_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.DeleteProcessorRequest() - assert args[0] == request_msg @@ -14789,7 +14790,6 @@ async def test_enable_processor_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.EnableProcessorRequest() - assert args[0] == request_msg @@ -14816,7 +14816,6 @@ async def test_disable_processor_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.DisableProcessorRequest() - assert args[0] == request_msg @@ -14843,7 +14842,6 @@ async def test_set_default_processor_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.SetDefaultProcessorVersionRequest() - assert args[0] == request_msg @@ -14868,7 +14866,6 @@ async def test_review_document_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.ReviewDocumentRequest() - assert args[0] == request_msg @@ -14895,7 +14892,6 @@ async def test_evaluate_processor_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.EvaluateProcessorVersionRequest() - assert args[0] == request_msg @@ -14924,7 +14920,6 @@ async def test_get_evaluation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.GetEvaluationRequest() - assert args[0] == request_msg @@ -14951,7 +14946,6 @@ async def test_list_evaluations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.ListEvaluationsRequest() - assert args[0] == request_msg @@ -18367,7 +18361,6 @@ def test_process_document_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.ProcessRequest() - assert args[0] == request_msg @@ -18389,7 +18382,6 @@ def test_batch_process_documents_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.BatchProcessRequest() - assert args[0] == request_msg @@ -18411,7 +18403,6 @@ def test_fetch_processor_types_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.FetchProcessorTypesRequest() - assert args[0] == request_msg @@ -18433,7 +18424,6 @@ def test_list_processor_types_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.ListProcessorTypesRequest() - assert args[0] == request_msg @@ -18455,7 +18445,6 @@ def test_get_processor_type_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.GetProcessorTypeRequest() - assert args[0] == request_msg @@ -18475,7 +18464,6 @@ def test_list_processors_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.ListProcessorsRequest() - assert args[0] == request_msg @@ -18495,7 +18483,6 @@ def test_get_processor_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.GetProcessorRequest() - assert args[0] == request_msg @@ -18517,7 +18504,6 @@ def test_train_processor_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.TrainProcessorVersionRequest() - assert args[0] == request_msg @@ -18539,7 +18525,6 @@ def test_get_processor_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.GetProcessorVersionRequest() - assert args[0] == request_msg @@ -18561,7 +18546,6 @@ def test_list_processor_versions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.ListProcessorVersionsRequest() - assert args[0] == request_msg @@ -18583,7 +18567,6 @@ def test_delete_processor_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.DeleteProcessorVersionRequest() - assert args[0] == request_msg @@ -18605,7 +18588,6 @@ def test_deploy_processor_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.DeployProcessorVersionRequest() - assert args[0] == request_msg @@ -18627,7 +18609,6 @@ def test_undeploy_processor_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.UndeployProcessorVersionRequest() - assert args[0] == request_msg @@ -18647,7 +18628,6 @@ def test_create_processor_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.CreateProcessorRequest() - assert args[0] == request_msg @@ -18667,7 +18647,6 @@ def test_delete_processor_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.DeleteProcessorRequest() - assert args[0] == request_msg @@ -18687,7 +18666,6 @@ def test_enable_processor_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.EnableProcessorRequest() - assert args[0] == request_msg @@ -18709,7 +18687,6 @@ def test_disable_processor_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.DisableProcessorRequest() - assert args[0] == request_msg @@ -18731,7 +18708,6 @@ def test_set_default_processor_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.SetDefaultProcessorVersionRequest() - assert args[0] == request_msg @@ -18751,7 +18727,6 @@ def test_review_document_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.ReviewDocumentRequest() - assert args[0] == request_msg @@ -18773,7 +18748,6 @@ def test_evaluate_processor_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.EvaluateProcessorVersionRequest() - assert args[0] == request_msg @@ -18793,7 +18767,6 @@ def test_get_evaluation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.GetEvaluationRequest() - assert args[0] == request_msg @@ -18813,7 +18786,6 @@ def test_list_evaluations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.ListEvaluationsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-documentai/tests/unit/gapic/documentai_v1beta3/test_document_processor_service.py b/packages/google-cloud-documentai/tests/unit/gapic/documentai_v1beta3/test_document_processor_service.py index f2b2a631f994..1efdff74efd9 100644 --- a/packages/google-cloud-documentai/tests/unit/gapic/documentai_v1beta3/test_document_processor_service.py +++ b/packages/google-cloud-documentai/tests/unit/gapic/documentai_v1beta3/test_document_processor_service.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 @@ -137,6 +138,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" @@ -1412,8 +1428,8 @@ def test_document_processor_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - document_processor_service.ProcessRequest, - dict, + document_processor_service.ProcessRequest(), + {}, ], ) def test_process_document(request_type, transport: str = "grpc"): @@ -1424,7 +1440,7 @@ def test_process_document(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.process_document), "__call__") as call: @@ -1468,9 +1484,10 @@ def test_process_document_non_empty_request_with_auto_populated_field(): client.process_document(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_processor_service.ProcessRequest( + request_msg = document_processor_service.ProcessRequest( name="name_value", ) + assert args[0] == request_msg def test_process_document_use_cached_wrapped_rpc(): @@ -1553,10 +1570,14 @@ async def test_process_document_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_process_document_async( - transport: str = "grpc_asyncio", - request_type=document_processor_service.ProcessRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + document_processor_service.ProcessRequest(), + {}, + ], +) +async def test_process_document_async(request_type, transport: str = "grpc_asyncio"): client = DocumentProcessorServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1564,7 +1585,7 @@ async def test_process_document_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.process_document), "__call__") as call: @@ -1587,11 +1608,6 @@ async def test_process_document_async( assert response.human_review_operation == "human_review_operation_value" -@pytest.mark.asyncio -async def test_process_document_async_from_dict(): - await test_process_document_async(request_type=dict) - - def test_process_document_field_headers(): client = DocumentProcessorServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1738,8 +1754,8 @@ async def test_process_document_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - document_processor_service.BatchProcessRequest, - dict, + document_processor_service.BatchProcessRequest(), + {}, ], ) def test_batch_process_documents(request_type, transport: str = "grpc"): @@ -1750,7 +1766,7 @@ def test_batch_process_documents(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1795,9 +1811,10 @@ def test_batch_process_documents_non_empty_request_with_auto_populated_field(): client.batch_process_documents(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_processor_service.BatchProcessRequest( + request_msg = document_processor_service.BatchProcessRequest( name="name_value", ) + assert args[0] == request_msg def test_batch_process_documents_use_cached_wrapped_rpc(): @@ -1893,9 +1910,15 @@ async def test_batch_process_documents_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + document_processor_service.BatchProcessRequest(), + {}, + ], +) async def test_batch_process_documents_async( - transport: str = "grpc_asyncio", - request_type=document_processor_service.BatchProcessRequest, + request_type, transport: str = "grpc_asyncio" ): client = DocumentProcessorServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1904,7 +1927,7 @@ async def test_batch_process_documents_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( @@ -1926,11 +1949,6 @@ async def test_batch_process_documents_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_batch_process_documents_async_from_dict(): - await test_batch_process_documents_async(request_type=dict) - - def test_batch_process_documents_field_headers(): client = DocumentProcessorServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2085,8 +2103,8 @@ async def test_batch_process_documents_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - document_processor_service.FetchProcessorTypesRequest, - dict, + document_processor_service.FetchProcessorTypesRequest(), + {}, ], ) def test_fetch_processor_types(request_type, transport: str = "grpc"): @@ -2097,7 +2115,7 @@ def test_fetch_processor_types(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2142,9 +2160,10 @@ def test_fetch_processor_types_non_empty_request_with_auto_populated_field(): client.fetch_processor_types(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_processor_service.FetchProcessorTypesRequest( + request_msg = document_processor_service.FetchProcessorTypesRequest( parent="parent_value", ) + assert args[0] == request_msg def test_fetch_processor_types_use_cached_wrapped_rpc(): @@ -2230,9 +2249,15 @@ async def test_fetch_processor_types_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + document_processor_service.FetchProcessorTypesRequest(), + {}, + ], +) async def test_fetch_processor_types_async( - transport: str = "grpc_asyncio", - request_type=document_processor_service.FetchProcessorTypesRequest, + request_type, transport: str = "grpc_asyncio" ): client = DocumentProcessorServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2241,7 +2266,7 @@ async def test_fetch_processor_types_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( @@ -2263,11 +2288,6 @@ async def test_fetch_processor_types_async( assert isinstance(response, document_processor_service.FetchProcessorTypesResponse) -@pytest.mark.asyncio -async def test_fetch_processor_types_async_from_dict(): - await test_fetch_processor_types_async(request_type=dict) - - def test_fetch_processor_types_field_headers(): client = DocumentProcessorServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2422,8 +2442,8 @@ async def test_fetch_processor_types_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - document_processor_service.ListProcessorTypesRequest, - dict, + document_processor_service.ListProcessorTypesRequest(), + {}, ], ) def test_list_processor_types(request_type, transport: str = "grpc"): @@ -2434,7 +2454,7 @@ def test_list_processor_types(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2483,10 +2503,11 @@ def test_list_processor_types_non_empty_request_with_auto_populated_field(): client.list_processor_types(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_processor_service.ListProcessorTypesRequest( + request_msg = document_processor_service.ListProcessorTypesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_processor_types_use_cached_wrapped_rpc(): @@ -2571,9 +2592,15 @@ async def test_list_processor_types_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + document_processor_service.ListProcessorTypesRequest(), + {}, + ], +) async def test_list_processor_types_async( - transport: str = "grpc_asyncio", - request_type=document_processor_service.ListProcessorTypesRequest, + request_type, transport: str = "grpc_asyncio" ): client = DocumentProcessorServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2582,7 +2609,7 @@ async def test_list_processor_types_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( @@ -2607,11 +2634,6 @@ async def test_list_processor_types_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_processor_types_async_from_dict(): - await test_list_processor_types_async(request_type=dict) - - def test_list_processor_types_field_headers(): client = DocumentProcessorServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2964,8 +2986,8 @@ async def test_list_processor_types_async_pages(): @pytest.mark.parametrize( "request_type", [ - document_processor_service.GetProcessorTypeRequest, - dict, + document_processor_service.GetProcessorTypeRequest(), + {}, ], ) def test_get_processor_type(request_type, transport: str = "grpc"): @@ -2976,7 +2998,7 @@ def test_get_processor_type(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,9 +3056,10 @@ def test_get_processor_type_non_empty_request_with_auto_populated_field(): client.get_processor_type(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_processor_service.GetProcessorTypeRequest( + request_msg = document_processor_service.GetProcessorTypeRequest( name="name_value", ) + assert args[0] == request_msg def test_get_processor_type_use_cached_wrapped_rpc(): @@ -3121,10 +3144,14 @@ async def test_get_processor_type_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_processor_type_async( - transport: str = "grpc_asyncio", - request_type=document_processor_service.GetProcessorTypeRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + document_processor_service.GetProcessorTypeRequest(), + {}, + ], +) +async def test_get_processor_type_async(request_type, transport: str = "grpc_asyncio"): client = DocumentProcessorServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3132,7 +3159,7 @@ async def test_get_processor_type_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( @@ -3167,11 +3194,6 @@ async def test_get_processor_type_async( assert response.sample_document_uris == ["sample_document_uris_value"] -@pytest.mark.asyncio -async def test_get_processor_type_async_from_dict(): - await test_get_processor_type_async(request_type=dict) - - def test_get_processor_type_field_headers(): client = DocumentProcessorServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3326,8 +3348,8 @@ async def test_get_processor_type_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - document_processor_service.ListProcessorsRequest, - dict, + document_processor_service.ListProcessorsRequest(), + {}, ], ) def test_list_processors(request_type, transport: str = "grpc"): @@ -3338,7 +3360,7 @@ def test_list_processors(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_processors), "__call__") as call: @@ -3383,10 +3405,11 @@ def test_list_processors_non_empty_request_with_auto_populated_field(): client.list_processors(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_processor_service.ListProcessorsRequest( + request_msg = document_processor_service.ListProcessorsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_processors_use_cached_wrapped_rpc(): @@ -3467,10 +3490,14 @@ async def test_list_processors_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_processors_async( - transport: str = "grpc_asyncio", - request_type=document_processor_service.ListProcessorsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + document_processor_service.ListProcessorsRequest(), + {}, + ], +) +async def test_list_processors_async(request_type, transport: str = "grpc_asyncio"): client = DocumentProcessorServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3478,7 +3505,7 @@ async def test_list_processors_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_processors), "__call__") as call: @@ -3501,11 +3528,6 @@ async def test_list_processors_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_processors_async_from_dict(): - await test_list_processors_async(request_type=dict) - - def test_list_processors_field_headers(): client = DocumentProcessorServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3842,8 +3864,8 @@ async def test_list_processors_async_pages(): @pytest.mark.parametrize( "request_type", [ - document_processor_service.GetProcessorRequest, - dict, + document_processor_service.GetProcessorRequest(), + {}, ], ) def test_get_processor(request_type, transport: str = "grpc"): @@ -3854,7 +3876,7 @@ def test_get_processor(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_processor), "__call__") as call: @@ -3914,9 +3936,10 @@ def test_get_processor_non_empty_request_with_auto_populated_field(): client.get_processor(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_processor_service.GetProcessorRequest( + request_msg = document_processor_service.GetProcessorRequest( name="name_value", ) + assert args[0] == request_msg def test_get_processor_use_cached_wrapped_rpc(): @@ -3997,10 +4020,14 @@ async def test_get_processor_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_processor_async( - transport: str = "grpc_asyncio", - request_type=document_processor_service.GetProcessorRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + document_processor_service.GetProcessorRequest(), + {}, + ], +) +async def test_get_processor_async(request_type, transport: str = "grpc_asyncio"): client = DocumentProcessorServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4008,7 +4035,7 @@ async def test_get_processor_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_processor), "__call__") as call: @@ -4047,11 +4074,6 @@ async def test_get_processor_async( assert response.satisfies_pzi is True -@pytest.mark.asyncio -async def test_get_processor_async_from_dict(): - await test_get_processor_async(request_type=dict) - - def test_get_processor_field_headers(): client = DocumentProcessorServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4194,8 +4216,8 @@ async def test_get_processor_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - document_processor_service.TrainProcessorVersionRequest, - dict, + document_processor_service.TrainProcessorVersionRequest(), + {}, ], ) def test_train_processor_version(request_type, transport: str = "grpc"): @@ -4206,7 +4228,7 @@ def test_train_processor_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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 +4274,11 @@ def test_train_processor_version_non_empty_request_with_auto_populated_field(): client.train_processor_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_processor_service.TrainProcessorVersionRequest( + request_msg = document_processor_service.TrainProcessorVersionRequest( parent="parent_value", base_processor_version="base_processor_version_value", ) + assert args[0] == request_msg def test_train_processor_version_use_cached_wrapped_rpc(): @@ -4351,9 +4374,15 @@ async def test_train_processor_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + document_processor_service.TrainProcessorVersionRequest(), + {}, + ], +) async def test_train_processor_version_async( - transport: str = "grpc_asyncio", - request_type=document_processor_service.TrainProcessorVersionRequest, + request_type, transport: str = "grpc_asyncio" ): client = DocumentProcessorServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4362,7 +4391,7 @@ async def test_train_processor_version_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( @@ -4384,11 +4413,6 @@ async def test_train_processor_version_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_train_processor_version_async_from_dict(): - await test_train_processor_version_async(request_type=dict) - - def test_train_processor_version_field_headers(): client = DocumentProcessorServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4553,8 +4577,8 @@ async def test_train_processor_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - document_processor_service.GetProcessorVersionRequest, - dict, + document_processor_service.GetProcessorVersionRequest(), + {}, ], ) def test_get_processor_version(request_type, transport: str = "grpc"): @@ -4565,7 +4589,7 @@ def test_get_processor_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4632,9 +4656,10 @@ def test_get_processor_version_non_empty_request_with_auto_populated_field(): client.get_processor_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_processor_service.GetProcessorVersionRequest( + request_msg = document_processor_service.GetProcessorVersionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_processor_version_use_cached_wrapped_rpc(): @@ -4720,9 +4745,15 @@ async def test_get_processor_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + document_processor_service.GetProcessorVersionRequest(), + {}, + ], +) async def test_get_processor_version_async( - transport: str = "grpc_asyncio", - request_type=document_processor_service.GetProcessorVersionRequest, + request_type, transport: str = "grpc_asyncio" ): client = DocumentProcessorServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4731,7 +4762,7 @@ async def test_get_processor_version_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( @@ -4775,11 +4806,6 @@ async def test_get_processor_version_async( assert response.satisfies_pzi is True -@pytest.mark.asyncio -async def test_get_processor_version_async_from_dict(): - await test_get_processor_version_async(request_type=dict) - - def test_get_processor_version_field_headers(): client = DocumentProcessorServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4934,8 +4960,8 @@ async def test_get_processor_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - document_processor_service.ListProcessorVersionsRequest, - dict, + document_processor_service.ListProcessorVersionsRequest(), + {}, ], ) def test_list_processor_versions(request_type, transport: str = "grpc"): @@ -4946,7 +4972,7 @@ def test_list_processor_versions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4995,10 +5021,11 @@ def test_list_processor_versions_non_empty_request_with_auto_populated_field(): client.list_processor_versions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_processor_service.ListProcessorVersionsRequest( + request_msg = document_processor_service.ListProcessorVersionsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_processor_versions_use_cached_wrapped_rpc(): @@ -5084,9 +5111,15 @@ async def test_list_processor_versions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + document_processor_service.ListProcessorVersionsRequest(), + {}, + ], +) async def test_list_processor_versions_async( - transport: str = "grpc_asyncio", - request_type=document_processor_service.ListProcessorVersionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = DocumentProcessorServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5095,7 +5128,7 @@ async def test_list_processor_versions_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( @@ -5120,11 +5153,6 @@ async def test_list_processor_versions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_processor_versions_async_from_dict(): - await test_list_processor_versions_async(request_type=dict) - - def test_list_processor_versions_field_headers(): client = DocumentProcessorServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5477,8 +5505,8 @@ async def test_list_processor_versions_async_pages(): @pytest.mark.parametrize( "request_type", [ - document_processor_service.DeleteProcessorVersionRequest, - dict, + document_processor_service.DeleteProcessorVersionRequest(), + {}, ], ) def test_delete_processor_version(request_type, transport: str = "grpc"): @@ -5489,7 +5517,7 @@ def test_delete_processor_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5534,9 +5562,10 @@ def test_delete_processor_version_non_empty_request_with_auto_populated_field(): client.delete_processor_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_processor_service.DeleteProcessorVersionRequest( + request_msg = document_processor_service.DeleteProcessorVersionRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_processor_version_use_cached_wrapped_rpc(): @@ -5632,9 +5661,15 @@ async def test_delete_processor_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + document_processor_service.DeleteProcessorVersionRequest(), + {}, + ], +) async def test_delete_processor_version_async( - transport: str = "grpc_asyncio", - request_type=document_processor_service.DeleteProcessorVersionRequest, + request_type, transport: str = "grpc_asyncio" ): client = DocumentProcessorServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5643,7 +5678,7 @@ async def test_delete_processor_version_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( @@ -5665,11 +5700,6 @@ async def test_delete_processor_version_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_processor_version_async_from_dict(): - await test_delete_processor_version_async(request_type=dict) - - def test_delete_processor_version_field_headers(): client = DocumentProcessorServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5824,8 +5854,8 @@ async def test_delete_processor_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - document_processor_service.DeployProcessorVersionRequest, - dict, + document_processor_service.DeployProcessorVersionRequest(), + {}, ], ) def test_deploy_processor_version(request_type, transport: str = "grpc"): @@ -5836,7 +5866,7 @@ def test_deploy_processor_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5881,9 +5911,10 @@ def test_deploy_processor_version_non_empty_request_with_auto_populated_field(): client.deploy_processor_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_processor_service.DeployProcessorVersionRequest( + request_msg = document_processor_service.DeployProcessorVersionRequest( name="name_value", ) + assert args[0] == request_msg def test_deploy_processor_version_use_cached_wrapped_rpc(): @@ -5979,9 +6010,15 @@ async def test_deploy_processor_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + document_processor_service.DeployProcessorVersionRequest(), + {}, + ], +) async def test_deploy_processor_version_async( - transport: str = "grpc_asyncio", - request_type=document_processor_service.DeployProcessorVersionRequest, + request_type, transport: str = "grpc_asyncio" ): client = DocumentProcessorServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5990,7 +6027,7 @@ async def test_deploy_processor_version_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( @@ -6012,11 +6049,6 @@ async def test_deploy_processor_version_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_deploy_processor_version_async_from_dict(): - await test_deploy_processor_version_async(request_type=dict) - - def test_deploy_processor_version_field_headers(): client = DocumentProcessorServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6171,8 +6203,8 @@ async def test_deploy_processor_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - document_processor_service.UndeployProcessorVersionRequest, - dict, + document_processor_service.UndeployProcessorVersionRequest(), + {}, ], ) def test_undeploy_processor_version(request_type, transport: str = "grpc"): @@ -6183,7 +6215,7 @@ def test_undeploy_processor_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6228,9 +6260,10 @@ def test_undeploy_processor_version_non_empty_request_with_auto_populated_field( client.undeploy_processor_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_processor_service.UndeployProcessorVersionRequest( + request_msg = document_processor_service.UndeployProcessorVersionRequest( name="name_value", ) + assert args[0] == request_msg def test_undeploy_processor_version_use_cached_wrapped_rpc(): @@ -6326,9 +6359,15 @@ async def test_undeploy_processor_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + document_processor_service.UndeployProcessorVersionRequest(), + {}, + ], +) async def test_undeploy_processor_version_async( - transport: str = "grpc_asyncio", - request_type=document_processor_service.UndeployProcessorVersionRequest, + request_type, transport: str = "grpc_asyncio" ): client = DocumentProcessorServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -6337,7 +6376,7 @@ async def test_undeploy_processor_version_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( @@ -6359,11 +6398,6 @@ async def test_undeploy_processor_version_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_undeploy_processor_version_async_from_dict(): - await test_undeploy_processor_version_async(request_type=dict) - - def test_undeploy_processor_version_field_headers(): client = DocumentProcessorServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6518,8 +6552,8 @@ async def test_undeploy_processor_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - document_processor_service.CreateProcessorRequest, - dict, + document_processor_service.CreateProcessorRequest(), + {}, ], ) def test_create_processor(request_type, transport: str = "grpc"): @@ -6530,7 +6564,7 @@ def test_create_processor(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_processor), "__call__") as call: @@ -6590,9 +6624,10 @@ def test_create_processor_non_empty_request_with_auto_populated_field(): client.create_processor(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_processor_service.CreateProcessorRequest( + request_msg = document_processor_service.CreateProcessorRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_processor_use_cached_wrapped_rpc(): @@ -6675,10 +6710,14 @@ async def test_create_processor_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_processor_async( - transport: str = "grpc_asyncio", - request_type=document_processor_service.CreateProcessorRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + document_processor_service.CreateProcessorRequest(), + {}, + ], +) +async def test_create_processor_async(request_type, transport: str = "grpc_asyncio"): client = DocumentProcessorServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6686,7 +6725,7 @@ async def test_create_processor_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_processor), "__call__") as call: @@ -6725,11 +6764,6 @@ async def test_create_processor_async( assert response.satisfies_pzi is True -@pytest.mark.asyncio -async def test_create_processor_async_from_dict(): - await test_create_processor_async(request_type=dict) - - def test_create_processor_field_headers(): client = DocumentProcessorServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6886,8 +6920,8 @@ async def test_create_processor_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - document_processor_service.DeleteProcessorRequest, - dict, + document_processor_service.DeleteProcessorRequest(), + {}, ], ) def test_delete_processor(request_type, transport: str = "grpc"): @@ -6898,7 +6932,7 @@ def test_delete_processor(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_processor), "__call__") as call: @@ -6939,9 +6973,10 @@ def test_delete_processor_non_empty_request_with_auto_populated_field(): client.delete_processor(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_processor_service.DeleteProcessorRequest( + request_msg = document_processor_service.DeleteProcessorRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_processor_use_cached_wrapped_rpc(): @@ -7034,10 +7069,14 @@ async def test_delete_processor_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_processor_async( - transport: str = "grpc_asyncio", - request_type=document_processor_service.DeleteProcessorRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + document_processor_service.DeleteProcessorRequest(), + {}, + ], +) +async def test_delete_processor_async(request_type, transport: str = "grpc_asyncio"): client = DocumentProcessorServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7045,7 +7084,7 @@ async def test_delete_processor_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_processor), "__call__") as call: @@ -7065,11 +7104,6 @@ async def test_delete_processor_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_processor_async_from_dict(): - await test_delete_processor_async(request_type=dict) - - def test_delete_processor_field_headers(): client = DocumentProcessorServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7216,8 +7250,8 @@ async def test_delete_processor_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - document_processor_service.EnableProcessorRequest, - dict, + document_processor_service.EnableProcessorRequest(), + {}, ], ) def test_enable_processor(request_type, transport: str = "grpc"): @@ -7228,7 +7262,7 @@ def test_enable_processor(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.enable_processor), "__call__") as call: @@ -7269,9 +7303,10 @@ def test_enable_processor_non_empty_request_with_auto_populated_field(): client.enable_processor(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_processor_service.EnableProcessorRequest( + request_msg = document_processor_service.EnableProcessorRequest( name="name_value", ) + assert args[0] == request_msg def test_enable_processor_use_cached_wrapped_rpc(): @@ -7364,10 +7399,14 @@ async def test_enable_processor_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_enable_processor_async( - transport: str = "grpc_asyncio", - request_type=document_processor_service.EnableProcessorRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + document_processor_service.EnableProcessorRequest(), + {}, + ], +) +async def test_enable_processor_async(request_type, transport: str = "grpc_asyncio"): client = DocumentProcessorServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7375,7 +7414,7 @@ async def test_enable_processor_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.enable_processor), "__call__") as call: @@ -7395,11 +7434,6 @@ async def test_enable_processor_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_enable_processor_async_from_dict(): - await test_enable_processor_async(request_type=dict) - - def test_enable_processor_field_headers(): client = DocumentProcessorServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7464,8 +7498,8 @@ async def test_enable_processor_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - document_processor_service.DisableProcessorRequest, - dict, + document_processor_service.DisableProcessorRequest(), + {}, ], ) def test_disable_processor(request_type, transport: str = "grpc"): @@ -7476,7 +7510,7 @@ def test_disable_processor(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7521,9 +7555,10 @@ def test_disable_processor_non_empty_request_with_auto_populated_field(): client.disable_processor(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_processor_service.DisableProcessorRequest( + request_msg = document_processor_service.DisableProcessorRequest( name="name_value", ) + assert args[0] == request_msg def test_disable_processor_use_cached_wrapped_rpc(): @@ -7616,10 +7651,14 @@ async def test_disable_processor_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_disable_processor_async( - transport: str = "grpc_asyncio", - request_type=document_processor_service.DisableProcessorRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + document_processor_service.DisableProcessorRequest(), + {}, + ], +) +async def test_disable_processor_async(request_type, transport: str = "grpc_asyncio"): client = DocumentProcessorServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7627,7 +7666,7 @@ async def test_disable_processor_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( @@ -7649,11 +7688,6 @@ async def test_disable_processor_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_disable_processor_async_from_dict(): - await test_disable_processor_async(request_type=dict) - - def test_disable_processor_field_headers(): client = DocumentProcessorServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7722,8 +7756,8 @@ async def test_disable_processor_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - document_processor_service.SetDefaultProcessorVersionRequest, - dict, + document_processor_service.SetDefaultProcessorVersionRequest(), + {}, ], ) def test_set_default_processor_version(request_type, transport: str = "grpc"): @@ -7734,7 +7768,7 @@ def test_set_default_processor_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7780,10 +7814,11 @@ def test_set_default_processor_version_non_empty_request_with_auto_populated_fie client.set_default_processor_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_processor_service.SetDefaultProcessorVersionRequest( + request_msg = document_processor_service.SetDefaultProcessorVersionRequest( processor="processor_value", default_processor_version="default_processor_version_value", ) + assert args[0] == request_msg def test_set_default_processor_version_use_cached_wrapped_rpc(): @@ -7879,9 +7914,15 @@ async def test_set_default_processor_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + document_processor_service.SetDefaultProcessorVersionRequest(), + {}, + ], +) async def test_set_default_processor_version_async( - transport: str = "grpc_asyncio", - request_type=document_processor_service.SetDefaultProcessorVersionRequest, + request_type, transport: str = "grpc_asyncio" ): client = DocumentProcessorServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -7890,7 +7931,7 @@ async def test_set_default_processor_version_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( @@ -7912,11 +7953,6 @@ async def test_set_default_processor_version_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_set_default_processor_version_async_from_dict(): - await test_set_default_processor_version_async(request_type=dict) - - def test_set_default_processor_version_field_headers(): client = DocumentProcessorServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7985,8 +8021,8 @@ async def test_set_default_processor_version_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - document_processor_service.ReviewDocumentRequest, - dict, + document_processor_service.ReviewDocumentRequest(), + {}, ], ) def test_review_document(request_type, transport: str = "grpc"): @@ -7997,7 +8033,7 @@ def test_review_document(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.review_document), "__call__") as call: @@ -8038,9 +8074,10 @@ def test_review_document_non_empty_request_with_auto_populated_field(): client.review_document(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_processor_service.ReviewDocumentRequest( + request_msg = document_processor_service.ReviewDocumentRequest( human_review_config="human_review_config_value", ) + assert args[0] == request_msg def test_review_document_use_cached_wrapped_rpc(): @@ -8131,10 +8168,14 @@ async def test_review_document_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_review_document_async( - transport: str = "grpc_asyncio", - request_type=document_processor_service.ReviewDocumentRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + document_processor_service.ReviewDocumentRequest(), + {}, + ], +) +async def test_review_document_async(request_type, transport: str = "grpc_asyncio"): client = DocumentProcessorServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8142,7 +8183,7 @@ async def test_review_document_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.review_document), "__call__") as call: @@ -8162,11 +8203,6 @@ async def test_review_document_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_review_document_async_from_dict(): - await test_review_document_async(request_type=dict) - - def test_review_document_field_headers(): client = DocumentProcessorServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8313,8 +8349,8 @@ async def test_review_document_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - document_processor_service.EvaluateProcessorVersionRequest, - dict, + document_processor_service.EvaluateProcessorVersionRequest(), + {}, ], ) def test_evaluate_processor_version(request_type, transport: str = "grpc"): @@ -8325,7 +8361,7 @@ def test_evaluate_processor_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8370,9 +8406,10 @@ def test_evaluate_processor_version_non_empty_request_with_auto_populated_field( client.evaluate_processor_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_processor_service.EvaluateProcessorVersionRequest( + request_msg = document_processor_service.EvaluateProcessorVersionRequest( processor_version="processor_version_value", ) + assert args[0] == request_msg def test_evaluate_processor_version_use_cached_wrapped_rpc(): @@ -8468,9 +8505,15 @@ async def test_evaluate_processor_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + document_processor_service.EvaluateProcessorVersionRequest(), + {}, + ], +) async def test_evaluate_processor_version_async( - transport: str = "grpc_asyncio", - request_type=document_processor_service.EvaluateProcessorVersionRequest, + request_type, transport: str = "grpc_asyncio" ): client = DocumentProcessorServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -8479,7 +8522,7 @@ async def test_evaluate_processor_version_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( @@ -8501,11 +8544,6 @@ async def test_evaluate_processor_version_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_evaluate_processor_version_async_from_dict(): - await test_evaluate_processor_version_async(request_type=dict) - - def test_evaluate_processor_version_field_headers(): client = DocumentProcessorServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8660,8 +8698,8 @@ async def test_evaluate_processor_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - document_processor_service.GetEvaluationRequest, - dict, + document_processor_service.GetEvaluationRequest(), + {}, ], ) def test_get_evaluation(request_type, transport: str = "grpc"): @@ -8672,7 +8710,7 @@ def test_get_evaluation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_evaluation), "__call__") as call: @@ -8720,9 +8758,10 @@ def test_get_evaluation_non_empty_request_with_auto_populated_field(): client.get_evaluation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_processor_service.GetEvaluationRequest( + request_msg = document_processor_service.GetEvaluationRequest( name="name_value", ) + assert args[0] == request_msg def test_get_evaluation_use_cached_wrapped_rpc(): @@ -8803,10 +8842,14 @@ async def test_get_evaluation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_evaluation_async( - transport: str = "grpc_asyncio", - request_type=document_processor_service.GetEvaluationRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + document_processor_service.GetEvaluationRequest(), + {}, + ], +) +async def test_get_evaluation_async(request_type, transport: str = "grpc_asyncio"): client = DocumentProcessorServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8814,7 +8857,7 @@ async def test_get_evaluation_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_evaluation), "__call__") as call: @@ -8841,11 +8884,6 @@ async def test_get_evaluation_async( assert response.kms_key_version_name == "kms_key_version_name_value" -@pytest.mark.asyncio -async def test_get_evaluation_async_from_dict(): - await test_get_evaluation_async(request_type=dict) - - def test_get_evaluation_field_headers(): client = DocumentProcessorServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8992,8 +9030,8 @@ async def test_get_evaluation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - document_processor_service.ListEvaluationsRequest, - dict, + document_processor_service.ListEvaluationsRequest(), + {}, ], ) def test_list_evaluations(request_type, transport: str = "grpc"): @@ -9004,7 +9042,7 @@ def test_list_evaluations(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_evaluations), "__call__") as call: @@ -9049,10 +9087,11 @@ def test_list_evaluations_non_empty_request_with_auto_populated_field(): client.list_evaluations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_processor_service.ListEvaluationsRequest( + request_msg = document_processor_service.ListEvaluationsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_evaluations_use_cached_wrapped_rpc(): @@ -9135,10 +9174,14 @@ async def test_list_evaluations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_evaluations_async( - transport: str = "grpc_asyncio", - request_type=document_processor_service.ListEvaluationsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + document_processor_service.ListEvaluationsRequest(), + {}, + ], +) +async def test_list_evaluations_async(request_type, transport: str = "grpc_asyncio"): client = DocumentProcessorServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9146,7 +9189,7 @@ async def test_list_evaluations_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_evaluations), "__call__") as call: @@ -9169,11 +9212,6 @@ async def test_list_evaluations_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_evaluations_async_from_dict(): - await test_list_evaluations_async(request_type=dict) - - def test_list_evaluations_field_headers(): client = DocumentProcessorServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9510,8 +9548,8 @@ async def test_list_evaluations_async_pages(): @pytest.mark.parametrize( "request_type", [ - document_processor_service.ImportProcessorVersionRequest, - dict, + document_processor_service.ImportProcessorVersionRequest(), + {}, ], ) def test_import_processor_version(request_type, transport: str = "grpc"): @@ -9522,7 +9560,7 @@ def test_import_processor_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9568,10 +9606,11 @@ def test_import_processor_version_non_empty_request_with_auto_populated_field(): client.import_processor_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_processor_service.ImportProcessorVersionRequest( + request_msg = document_processor_service.ImportProcessorVersionRequest( processor_version_source="processor_version_source_value", parent="parent_value", ) + assert args[0] == request_msg def test_import_processor_version_use_cached_wrapped_rpc(): @@ -9667,9 +9706,15 @@ async def test_import_processor_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + document_processor_service.ImportProcessorVersionRequest(), + {}, + ], +) async def test_import_processor_version_async( - transport: str = "grpc_asyncio", - request_type=document_processor_service.ImportProcessorVersionRequest, + request_type, transport: str = "grpc_asyncio" ): client = DocumentProcessorServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -9678,7 +9723,7 @@ async def test_import_processor_version_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( @@ -9700,11 +9745,6 @@ async def test_import_processor_version_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_import_processor_version_async_from_dict(): - await test_import_processor_version_async(request_type=dict) - - def test_import_processor_version_field_headers(): client = DocumentProcessorServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14389,7 +14429,6 @@ def test_process_document_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.ProcessRequest() - assert args[0] == request_msg @@ -14412,7 +14451,6 @@ def test_batch_process_documents_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.BatchProcessRequest() - assert args[0] == request_msg @@ -14435,7 +14473,6 @@ def test_fetch_processor_types_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.FetchProcessorTypesRequest() - assert args[0] == request_msg @@ -14458,7 +14495,6 @@ def test_list_processor_types_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.ListProcessorTypesRequest() - assert args[0] == request_msg @@ -14481,7 +14517,6 @@ def test_get_processor_type_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.GetProcessorTypeRequest() - assert args[0] == request_msg @@ -14502,7 +14537,6 @@ def test_list_processors_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.ListProcessorsRequest() - assert args[0] == request_msg @@ -14523,7 +14557,6 @@ def test_get_processor_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.GetProcessorRequest() - assert args[0] == request_msg @@ -14546,7 +14579,6 @@ def test_train_processor_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.TrainProcessorVersionRequest() - assert args[0] == request_msg @@ -14569,7 +14601,6 @@ def test_get_processor_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.GetProcessorVersionRequest() - assert args[0] == request_msg @@ -14592,7 +14623,6 @@ def test_list_processor_versions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.ListProcessorVersionsRequest() - assert args[0] == request_msg @@ -14615,7 +14645,6 @@ def test_delete_processor_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.DeleteProcessorVersionRequest() - assert args[0] == request_msg @@ -14638,7 +14667,6 @@ def test_deploy_processor_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.DeployProcessorVersionRequest() - assert args[0] == request_msg @@ -14661,7 +14689,6 @@ def test_undeploy_processor_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.UndeployProcessorVersionRequest() - assert args[0] == request_msg @@ -14682,7 +14709,6 @@ def test_create_processor_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.CreateProcessorRequest() - assert args[0] == request_msg @@ -14703,7 +14729,6 @@ def test_delete_processor_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.DeleteProcessorRequest() - assert args[0] == request_msg @@ -14724,7 +14749,6 @@ def test_enable_processor_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.EnableProcessorRequest() - assert args[0] == request_msg @@ -14747,7 +14771,6 @@ def test_disable_processor_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.DisableProcessorRequest() - assert args[0] == request_msg @@ -14770,7 +14793,6 @@ def test_set_default_processor_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.SetDefaultProcessorVersionRequest() - assert args[0] == request_msg @@ -14791,7 +14813,6 @@ def test_review_document_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.ReviewDocumentRequest() - assert args[0] == request_msg @@ -14814,7 +14835,6 @@ def test_evaluate_processor_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.EvaluateProcessorVersionRequest() - assert args[0] == request_msg @@ -14835,7 +14855,6 @@ def test_get_evaluation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.GetEvaluationRequest() - assert args[0] == request_msg @@ -14856,7 +14875,6 @@ def test_list_evaluations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.ListEvaluationsRequest() - assert args[0] == request_msg @@ -14879,7 +14897,6 @@ def test_import_processor_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.ImportProcessorVersionRequest() - assert args[0] == request_msg @@ -14920,7 +14937,6 @@ async def test_process_document_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.ProcessRequest() - assert args[0] == request_msg @@ -14947,7 +14963,6 @@ async def test_batch_process_documents_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.BatchProcessRequest() - assert args[0] == request_msg @@ -14974,7 +14989,6 @@ async def test_fetch_processor_types_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.FetchProcessorTypesRequest() - assert args[0] == request_msg @@ -15003,7 +15017,6 @@ async def test_list_processor_types_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.ListProcessorTypesRequest() - assert args[0] == request_msg @@ -15037,7 +15050,6 @@ async def test_get_processor_type_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.GetProcessorTypeRequest() - assert args[0] == request_msg @@ -15064,7 +15076,6 @@ async def test_list_processors_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.ListProcessorsRequest() - assert args[0] == request_msg @@ -15099,7 +15110,6 @@ async def test_get_processor_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.GetProcessorRequest() - assert args[0] == request_msg @@ -15126,7 +15136,6 @@ async def test_train_processor_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.TrainProcessorVersionRequest() - assert args[0] == request_msg @@ -15163,7 +15172,6 @@ async def test_get_processor_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.GetProcessorVersionRequest() - assert args[0] == request_msg @@ -15192,7 +15200,6 @@ async def test_list_processor_versions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.ListProcessorVersionsRequest() - assert args[0] == request_msg @@ -15219,7 +15226,6 @@ async def test_delete_processor_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.DeleteProcessorVersionRequest() - assert args[0] == request_msg @@ -15246,7 +15252,6 @@ async def test_deploy_processor_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.DeployProcessorVersionRequest() - assert args[0] == request_msg @@ -15273,7 +15278,6 @@ async def test_undeploy_processor_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.UndeployProcessorVersionRequest() - assert args[0] == request_msg @@ -15308,7 +15312,6 @@ async def test_create_processor_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.CreateProcessorRequest() - assert args[0] == request_msg @@ -15333,7 +15336,6 @@ async def test_delete_processor_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.DeleteProcessorRequest() - assert args[0] == request_msg @@ -15358,7 +15360,6 @@ async def test_enable_processor_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.EnableProcessorRequest() - assert args[0] == request_msg @@ -15385,7 +15386,6 @@ async def test_disable_processor_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.DisableProcessorRequest() - assert args[0] == request_msg @@ -15412,7 +15412,6 @@ async def test_set_default_processor_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.SetDefaultProcessorVersionRequest() - assert args[0] == request_msg @@ -15437,7 +15436,6 @@ async def test_review_document_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.ReviewDocumentRequest() - assert args[0] == request_msg @@ -15464,7 +15462,6 @@ async def test_evaluate_processor_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.EvaluateProcessorVersionRequest() - assert args[0] == request_msg @@ -15493,7 +15490,6 @@ async def test_get_evaluation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.GetEvaluationRequest() - assert args[0] == request_msg @@ -15520,7 +15516,6 @@ async def test_list_evaluations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.ListEvaluationsRequest() - assert args[0] == request_msg @@ -15547,7 +15542,6 @@ async def test_import_processor_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.ImportProcessorVersionRequest() - assert args[0] == request_msg @@ -19094,7 +19088,6 @@ def test_process_document_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.ProcessRequest() - assert args[0] == request_msg @@ -19116,7 +19109,6 @@ def test_batch_process_documents_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.BatchProcessRequest() - assert args[0] == request_msg @@ -19138,7 +19130,6 @@ def test_fetch_processor_types_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.FetchProcessorTypesRequest() - assert args[0] == request_msg @@ -19160,7 +19151,6 @@ def test_list_processor_types_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.ListProcessorTypesRequest() - assert args[0] == request_msg @@ -19182,7 +19172,6 @@ def test_get_processor_type_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.GetProcessorTypeRequest() - assert args[0] == request_msg @@ -19202,7 +19191,6 @@ def test_list_processors_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.ListProcessorsRequest() - assert args[0] == request_msg @@ -19222,7 +19210,6 @@ def test_get_processor_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.GetProcessorRequest() - assert args[0] == request_msg @@ -19244,7 +19231,6 @@ def test_train_processor_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.TrainProcessorVersionRequest() - assert args[0] == request_msg @@ -19266,7 +19252,6 @@ def test_get_processor_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.GetProcessorVersionRequest() - assert args[0] == request_msg @@ -19288,7 +19273,6 @@ def test_list_processor_versions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.ListProcessorVersionsRequest() - assert args[0] == request_msg @@ -19310,7 +19294,6 @@ def test_delete_processor_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.DeleteProcessorVersionRequest() - assert args[0] == request_msg @@ -19332,7 +19315,6 @@ def test_deploy_processor_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.DeployProcessorVersionRequest() - assert args[0] == request_msg @@ -19354,7 +19336,6 @@ def test_undeploy_processor_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.UndeployProcessorVersionRequest() - assert args[0] == request_msg @@ -19374,7 +19355,6 @@ def test_create_processor_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.CreateProcessorRequest() - assert args[0] == request_msg @@ -19394,7 +19374,6 @@ def test_delete_processor_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.DeleteProcessorRequest() - assert args[0] == request_msg @@ -19414,7 +19393,6 @@ def test_enable_processor_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.EnableProcessorRequest() - assert args[0] == request_msg @@ -19436,7 +19414,6 @@ def test_disable_processor_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.DisableProcessorRequest() - assert args[0] == request_msg @@ -19458,7 +19435,6 @@ def test_set_default_processor_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.SetDefaultProcessorVersionRequest() - assert args[0] == request_msg @@ -19478,7 +19454,6 @@ def test_review_document_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.ReviewDocumentRequest() - assert args[0] == request_msg @@ -19500,7 +19475,6 @@ def test_evaluate_processor_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.EvaluateProcessorVersionRequest() - assert args[0] == request_msg @@ -19520,7 +19494,6 @@ def test_get_evaluation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.GetEvaluationRequest() - assert args[0] == request_msg @@ -19540,7 +19513,6 @@ def test_list_evaluations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.ListEvaluationsRequest() - assert args[0] == request_msg @@ -19562,7 +19534,6 @@ def test_import_processor_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_processor_service.ImportProcessorVersionRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-documentai/tests/unit/gapic/documentai_v1beta3/test_document_service.py b/packages/google-cloud-documentai/tests/unit/gapic/documentai_v1beta3/test_document_service.py index 6907c73a9c7f..7276e1d2429b 100644 --- a/packages/google-cloud-documentai/tests/unit/gapic/documentai_v1beta3/test_document_service.py +++ b/packages/google-cloud-documentai/tests/unit/gapic/documentai_v1beta3/test_document_service.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 @@ -121,6 +122,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" @@ -1348,8 +1364,8 @@ def test_document_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - document_service.UpdateDatasetRequest, - dict, + document_service.UpdateDatasetRequest(), + {}, ], ) def test_update_dataset(request_type, transport: str = "grpc"): @@ -1360,7 +1376,7 @@ def test_update_dataset(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_dataset), "__call__") as call: @@ -1399,7 +1415,8 @@ def test_update_dataset_non_empty_request_with_auto_populated_field(): client.update_dataset(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_service.UpdateDatasetRequest() + request_msg = document_service.UpdateDatasetRequest() + assert args[0] == request_msg def test_update_dataset_use_cached_wrapped_rpc(): @@ -1490,9 +1507,14 @@ async def test_update_dataset_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_dataset_async( - transport: str = "grpc_asyncio", request_type=document_service.UpdateDatasetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + document_service.UpdateDatasetRequest(), + {}, + ], +) +async def test_update_dataset_async(request_type, transport: str = "grpc_asyncio"): client = DocumentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1500,7 +1522,7 @@ async def test_update_dataset_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_dataset), "__call__") as call: @@ -1520,11 +1542,6 @@ async def test_update_dataset_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_dataset_async_from_dict(): - await test_update_dataset_async(request_type=dict) - - def test_update_dataset_field_headers(): client = DocumentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1713,8 +1730,8 @@ async def test_update_dataset_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - document_service.ImportDocumentsRequest, - dict, + document_service.ImportDocumentsRequest(), + {}, ], ) def test_import_documents(request_type, transport: str = "grpc"): @@ -1725,7 +1742,7 @@ def test_import_documents(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.import_documents), "__call__") as call: @@ -1766,9 +1783,10 @@ def test_import_documents_non_empty_request_with_auto_populated_field(): client.import_documents(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_service.ImportDocumentsRequest( + request_msg = document_service.ImportDocumentsRequest( dataset="dataset_value", ) + assert args[0] == request_msg def test_import_documents_use_cached_wrapped_rpc(): @@ -1861,10 +1879,14 @@ async def test_import_documents_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_import_documents_async( - transport: str = "grpc_asyncio", - request_type=document_service.ImportDocumentsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + document_service.ImportDocumentsRequest(), + {}, + ], +) +async def test_import_documents_async(request_type, transport: str = "grpc_asyncio"): client = DocumentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1872,7 +1894,7 @@ async def test_import_documents_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.import_documents), "__call__") as call: @@ -1892,11 +1914,6 @@ async def test_import_documents_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_import_documents_async_from_dict(): - await test_import_documents_async(request_type=dict) - - def test_import_documents_field_headers(): client = DocumentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2043,8 +2060,8 @@ async def test_import_documents_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - document_service.GetDocumentRequest, - dict, + document_service.GetDocumentRequest(), + {}, ], ) def test_get_document(request_type, transport: str = "grpc"): @@ -2055,7 +2072,7 @@ def test_get_document(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_document), "__call__") as call: @@ -2096,9 +2113,10 @@ def test_get_document_non_empty_request_with_auto_populated_field(): client.get_document(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_service.GetDocumentRequest( + request_msg = document_service.GetDocumentRequest( dataset="dataset_value", ) + assert args[0] == request_msg def test_get_document_use_cached_wrapped_rpc(): @@ -2179,9 +2197,14 @@ async def test_get_document_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_document_async( - transport: str = "grpc_asyncio", request_type=document_service.GetDocumentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + document_service.GetDocumentRequest(), + {}, + ], +) +async def test_get_document_async(request_type, transport: str = "grpc_asyncio"): client = DocumentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2189,7 +2212,7 @@ async def test_get_document_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_document), "__call__") as call: @@ -2209,11 +2232,6 @@ async def test_get_document_async( assert isinstance(response, document_service.GetDocumentResponse) -@pytest.mark.asyncio -async def test_get_document_async_from_dict(): - await test_get_document_async(request_type=dict) - - def test_get_document_field_headers(): client = DocumentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2360,8 +2378,8 @@ async def test_get_document_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - document_service.ListDocumentsRequest, - dict, + document_service.ListDocumentsRequest(), + {}, ], ) def test_list_documents(request_type, transport: str = "grpc"): @@ -2372,7 +2390,7 @@ def test_list_documents(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_documents), "__call__") as call: @@ -2420,11 +2438,12 @@ def test_list_documents_non_empty_request_with_auto_populated_field(): client.list_documents(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_service.ListDocumentsRequest( + request_msg = document_service.ListDocumentsRequest( dataset="dataset_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_documents_use_cached_wrapped_rpc(): @@ -2505,9 +2524,14 @@ async def test_list_documents_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_documents_async( - transport: str = "grpc_asyncio", request_type=document_service.ListDocumentsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + document_service.ListDocumentsRequest(), + {}, + ], +) +async def test_list_documents_async(request_type, transport: str = "grpc_asyncio"): client = DocumentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2515,7 +2539,7 @@ async def test_list_documents_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_documents), "__call__") as call: @@ -2540,11 +2564,6 @@ async def test_list_documents_async( assert response.total_size == 1086 -@pytest.mark.asyncio -async def test_list_documents_async_from_dict(): - await test_list_documents_async(request_type=dict) - - def test_list_documents_field_headers(): client = DocumentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2881,8 +2900,8 @@ async def test_list_documents_async_pages(): @pytest.mark.parametrize( "request_type", [ - document_service.BatchDeleteDocumentsRequest, - dict, + document_service.BatchDeleteDocumentsRequest(), + {}, ], ) def test_batch_delete_documents(request_type, transport: str = "grpc"): @@ -2893,7 +2912,7 @@ def test_batch_delete_documents(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2938,9 +2957,10 @@ def test_batch_delete_documents_non_empty_request_with_auto_populated_field(): client.batch_delete_documents(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_service.BatchDeleteDocumentsRequest( + request_msg = document_service.BatchDeleteDocumentsRequest( dataset="dataset_value", ) + assert args[0] == request_msg def test_batch_delete_documents_use_cached_wrapped_rpc(): @@ -3036,9 +3056,15 @@ async def test_batch_delete_documents_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + document_service.BatchDeleteDocumentsRequest(), + {}, + ], +) async def test_batch_delete_documents_async( - transport: str = "grpc_asyncio", - request_type=document_service.BatchDeleteDocumentsRequest, + request_type, transport: str = "grpc_asyncio" ): client = DocumentServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3047,7 +3073,7 @@ async def test_batch_delete_documents_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( @@ -3069,11 +3095,6 @@ async def test_batch_delete_documents_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_batch_delete_documents_async_from_dict(): - await test_batch_delete_documents_async(request_type=dict) - - def test_batch_delete_documents_field_headers(): client = DocumentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3228,8 +3249,8 @@ async def test_batch_delete_documents_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - document_service.GetDatasetSchemaRequest, - dict, + document_service.GetDatasetSchemaRequest(), + {}, ], ) def test_get_dataset_schema(request_type, transport: str = "grpc"): @@ -3240,7 +3261,7 @@ def test_get_dataset_schema(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3292,9 +3313,10 @@ def test_get_dataset_schema_non_empty_request_with_auto_populated_field(): client.get_dataset_schema(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_service.GetDatasetSchemaRequest( + request_msg = document_service.GetDatasetSchemaRequest( name="name_value", ) + assert args[0] == request_msg def test_get_dataset_schema_use_cached_wrapped_rpc(): @@ -3379,10 +3401,14 @@ async def test_get_dataset_schema_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_dataset_schema_async( - transport: str = "grpc_asyncio", - request_type=document_service.GetDatasetSchemaRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + document_service.GetDatasetSchemaRequest(), + {}, + ], +) +async def test_get_dataset_schema_async(request_type, transport: str = "grpc_asyncio"): client = DocumentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3390,7 +3416,7 @@ async def test_get_dataset_schema_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( @@ -3419,11 +3445,6 @@ async def test_get_dataset_schema_async( assert response.satisfies_pzi is True -@pytest.mark.asyncio -async def test_get_dataset_schema_async_from_dict(): - await test_get_dataset_schema_async(request_type=dict) - - def test_get_dataset_schema_field_headers(): client = DocumentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3578,8 +3599,8 @@ async def test_get_dataset_schema_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - document_service.UpdateDatasetSchemaRequest, - dict, + document_service.UpdateDatasetSchemaRequest(), + {}, ], ) def test_update_dataset_schema(request_type, transport: str = "grpc"): @@ -3590,7 +3611,7 @@ def test_update_dataset_schema(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3640,7 +3661,8 @@ def test_update_dataset_schema_non_empty_request_with_auto_populated_field(): client.update_dataset_schema(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == document_service.UpdateDatasetSchemaRequest() + request_msg = document_service.UpdateDatasetSchemaRequest() + assert args[0] == request_msg def test_update_dataset_schema_use_cached_wrapped_rpc(): @@ -3726,9 +3748,15 @@ async def test_update_dataset_schema_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + document_service.UpdateDatasetSchemaRequest(), + {}, + ], +) async def test_update_dataset_schema_async( - transport: str = "grpc_asyncio", - request_type=document_service.UpdateDatasetSchemaRequest, + request_type, transport: str = "grpc_asyncio" ): client = DocumentServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3737,7 +3765,7 @@ async def test_update_dataset_schema_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( @@ -3766,11 +3794,6 @@ async def test_update_dataset_schema_async( assert response.satisfies_pzi is True -@pytest.mark.asyncio -async def test_update_dataset_schema_async_from_dict(): - await test_update_dataset_schema_async(request_type=dict) - - def test_update_dataset_schema_field_headers(): client = DocumentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5452,7 +5475,6 @@ def test_update_dataset_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.UpdateDatasetRequest() - assert args[0] == request_msg @@ -5473,7 +5495,6 @@ def test_import_documents_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.ImportDocumentsRequest() - assert args[0] == request_msg @@ -5494,7 +5515,6 @@ def test_get_document_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.GetDocumentRequest() - assert args[0] == request_msg @@ -5515,7 +5535,6 @@ def test_list_documents_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.ListDocumentsRequest() - assert args[0] == request_msg @@ -5538,7 +5557,6 @@ def test_batch_delete_documents_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.BatchDeleteDocumentsRequest() - assert args[0] == request_msg @@ -5561,7 +5579,6 @@ def test_get_dataset_schema_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.GetDatasetSchemaRequest() - assert args[0] == request_msg @@ -5584,7 +5601,6 @@ def test_update_dataset_schema_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.UpdateDatasetSchemaRequest() - assert args[0] == request_msg @@ -5623,7 +5639,6 @@ async def test_update_dataset_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.UpdateDatasetRequest() - assert args[0] == request_msg @@ -5648,7 +5663,6 @@ async def test_import_documents_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.ImportDocumentsRequest() - assert args[0] == request_msg @@ -5673,7 +5687,6 @@ async def test_get_document_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.GetDocumentRequest() - assert args[0] == request_msg @@ -5701,7 +5714,6 @@ async def test_list_documents_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.ListDocumentsRequest() - assert args[0] == request_msg @@ -5728,7 +5740,6 @@ async def test_batch_delete_documents_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.BatchDeleteDocumentsRequest() - assert args[0] == request_msg @@ -5759,7 +5770,6 @@ async def test_get_dataset_schema_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.GetDatasetSchemaRequest() - assert args[0] == request_msg @@ -5790,7 +5800,6 @@ async def test_update_dataset_schema_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.UpdateDatasetSchemaRequest() - assert args[0] == request_msg @@ -7281,7 +7290,6 @@ def test_update_dataset_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.UpdateDatasetRequest() - assert args[0] == request_msg @@ -7301,7 +7309,6 @@ def test_import_documents_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.ImportDocumentsRequest() - assert args[0] == request_msg @@ -7321,7 +7328,6 @@ def test_get_document_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.GetDocumentRequest() - assert args[0] == request_msg @@ -7341,7 +7347,6 @@ def test_list_documents_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.ListDocumentsRequest() - assert args[0] == request_msg @@ -7363,7 +7368,6 @@ def test_batch_delete_documents_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.BatchDeleteDocumentsRequest() - assert args[0] == request_msg @@ -7385,7 +7389,6 @@ def test_get_dataset_schema_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.GetDatasetSchemaRequest() - assert args[0] == request_msg @@ -7407,7 +7410,6 @@ def test_update_dataset_schema_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = document_service.UpdateDatasetSchemaRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-domains/noxfile.py b/packages/google-cloud-domains/noxfile.py index c4978525da33..e1810b6976dd 100644 --- a/packages/google-cloud-domains/noxfile.py +++ b/packages/google-cloud-domains/noxfile.py @@ -47,7 +47,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-domains" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-domains/setup.py b/packages/google-cloud-domains/setup.py index c9b5dd5ce20d..897e10ebaedb 100644 --- a/packages/google-cloud-domains/setup.py +++ b/packages/google-cloud-domains/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/google-cloud-domains/testing/constraints-3.10.txt b/packages/google-cloud-domains/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-domains/testing/constraints-3.10.txt +++ b/packages/google-cloud-domains/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-domains/tests/unit/gapic/domains_v1/test_domains.py b/packages/google-cloud-domains/tests/unit/gapic/domains_v1/test_domains.py index a10c7b0519fb..87c9d28afee5 100644 --- a/packages/google-cloud-domains/tests/unit/gapic/domains_v1/test_domains.py +++ b/packages/google-cloud-domains/tests/unit/gapic/domains_v1/test_domains.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 @@ -117,6 +118,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" @@ -1250,8 +1266,8 @@ def test_domains_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - domains.SearchDomainsRequest, - dict, + domains.SearchDomainsRequest(), + {}, ], ) def test_search_domains(request_type, transport: str = "grpc"): @@ -1262,7 +1278,7 @@ def test_search_domains(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.search_domains), "__call__") as call: @@ -1304,10 +1320,11 @@ def test_search_domains_non_empty_request_with_auto_populated_field(): client.search_domains(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == domains.SearchDomainsRequest( + request_msg = domains.SearchDomainsRequest( query="query_value", location="location_value", ) + assert args[0] == request_msg def test_search_domains_use_cached_wrapped_rpc(): @@ -1388,9 +1405,14 @@ async def test_search_domains_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_search_domains_async( - transport: str = "grpc_asyncio", request_type=domains.SearchDomainsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + domains.SearchDomainsRequest(), + {}, + ], +) +async def test_search_domains_async(request_type, transport: str = "grpc_asyncio"): client = DomainsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1398,7 +1420,7 @@ async def test_search_domains_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.search_domains), "__call__") as call: @@ -1418,11 +1440,6 @@ async def test_search_domains_async( assert isinstance(response, domains.SearchDomainsResponse) -@pytest.mark.asyncio -async def test_search_domains_async_from_dict(): - await test_search_domains_async(request_type=dict) - - def test_search_domains_field_headers(): client = DomainsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1579,8 +1596,8 @@ async def test_search_domains_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - domains.RetrieveRegisterParametersRequest, - dict, + domains.RetrieveRegisterParametersRequest(), + {}, ], ) def test_retrieve_register_parameters(request_type, transport: str = "grpc"): @@ -1591,7 +1608,7 @@ def test_retrieve_register_parameters(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1637,10 +1654,11 @@ def test_retrieve_register_parameters_non_empty_request_with_auto_populated_fiel client.retrieve_register_parameters(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == domains.RetrieveRegisterParametersRequest( + request_msg = domains.RetrieveRegisterParametersRequest( domain_name="domain_name_value", location="location_value", ) + assert args[0] == request_msg def test_retrieve_register_parameters_use_cached_wrapped_rpc(): @@ -1726,9 +1744,15 @@ async def test_retrieve_register_parameters_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + domains.RetrieveRegisterParametersRequest(), + {}, + ], +) async def test_retrieve_register_parameters_async( - transport: str = "grpc_asyncio", - request_type=domains.RetrieveRegisterParametersRequest, + request_type, transport: str = "grpc_asyncio" ): client = DomainsAsyncClient( credentials=async_anonymous_credentials(), @@ -1737,7 +1761,7 @@ async def test_retrieve_register_parameters_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( @@ -1759,11 +1783,6 @@ async def test_retrieve_register_parameters_async( assert isinstance(response, domains.RetrieveRegisterParametersResponse) -@pytest.mark.asyncio -async def test_retrieve_register_parameters_async_from_dict(): - await test_retrieve_register_parameters_async(request_type=dict) - - def test_retrieve_register_parameters_field_headers(): client = DomainsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1928,8 +1947,8 @@ async def test_retrieve_register_parameters_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - domains.RegisterDomainRequest, - dict, + domains.RegisterDomainRequest(), + {}, ], ) def test_register_domain(request_type, transport: str = "grpc"): @@ -1940,7 +1959,7 @@ def test_register_domain(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.register_domain), "__call__") as call: @@ -1981,9 +2000,10 @@ def test_register_domain_non_empty_request_with_auto_populated_field(): client.register_domain(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == domains.RegisterDomainRequest( + request_msg = domains.RegisterDomainRequest( parent="parent_value", ) + assert args[0] == request_msg def test_register_domain_use_cached_wrapped_rpc(): @@ -2074,9 +2094,14 @@ async def test_register_domain_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_register_domain_async( - transport: str = "grpc_asyncio", request_type=domains.RegisterDomainRequest -): +@pytest.mark.parametrize( + "request_type", + [ + domains.RegisterDomainRequest(), + {}, + ], +) +async def test_register_domain_async(request_type, transport: str = "grpc_asyncio"): client = DomainsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2084,7 +2109,7 @@ async def test_register_domain_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.register_domain), "__call__") as call: @@ -2104,11 +2129,6 @@ async def test_register_domain_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_register_domain_async_from_dict(): - await test_register_domain_async(request_type=dict) - - def test_register_domain_field_headers(): client = DomainsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2275,8 +2295,8 @@ async def test_register_domain_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - domains.RetrieveTransferParametersRequest, - dict, + domains.RetrieveTransferParametersRequest(), + {}, ], ) def test_retrieve_transfer_parameters(request_type, transport: str = "grpc"): @@ -2287,7 +2307,7 @@ def test_retrieve_transfer_parameters(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2333,10 +2353,11 @@ def test_retrieve_transfer_parameters_non_empty_request_with_auto_populated_fiel client.retrieve_transfer_parameters(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == domains.RetrieveTransferParametersRequest( + request_msg = domains.RetrieveTransferParametersRequest( domain_name="domain_name_value", location="location_value", ) + assert args[0] == request_msg def test_retrieve_transfer_parameters_use_cached_wrapped_rpc(): @@ -2422,9 +2443,15 @@ async def test_retrieve_transfer_parameters_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + domains.RetrieveTransferParametersRequest(), + {}, + ], +) async def test_retrieve_transfer_parameters_async( - transport: str = "grpc_asyncio", - request_type=domains.RetrieveTransferParametersRequest, + request_type, transport: str = "grpc_asyncio" ): client = DomainsAsyncClient( credentials=async_anonymous_credentials(), @@ -2433,7 +2460,7 @@ async def test_retrieve_transfer_parameters_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( @@ -2455,11 +2482,6 @@ async def test_retrieve_transfer_parameters_async( assert isinstance(response, domains.RetrieveTransferParametersResponse) -@pytest.mark.asyncio -async def test_retrieve_transfer_parameters_async_from_dict(): - await test_retrieve_transfer_parameters_async(request_type=dict) - - def test_retrieve_transfer_parameters_field_headers(): client = DomainsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2624,8 +2646,8 @@ async def test_retrieve_transfer_parameters_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - domains.TransferDomainRequest, - dict, + domains.TransferDomainRequest(), + {}, ], ) def test_transfer_domain(request_type, transport: str = "grpc"): @@ -2636,7 +2658,7 @@ def test_transfer_domain(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.transfer_domain), "__call__") as call: @@ -2677,9 +2699,10 @@ def test_transfer_domain_non_empty_request_with_auto_populated_field(): client.transfer_domain(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == domains.TransferDomainRequest( + request_msg = domains.TransferDomainRequest( parent="parent_value", ) + assert args[0] == request_msg def test_transfer_domain_use_cached_wrapped_rpc(): @@ -2770,9 +2793,14 @@ async def test_transfer_domain_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_transfer_domain_async( - transport: str = "grpc_asyncio", request_type=domains.TransferDomainRequest -): +@pytest.mark.parametrize( + "request_type", + [ + domains.TransferDomainRequest(), + {}, + ], +) +async def test_transfer_domain_async(request_type, transport: str = "grpc_asyncio"): client = DomainsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2780,7 +2808,7 @@ async def test_transfer_domain_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.transfer_domain), "__call__") as call: @@ -2800,11 +2828,6 @@ async def test_transfer_domain_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_transfer_domain_async_from_dict(): - await test_transfer_domain_async(request_type=dict) - - def test_transfer_domain_field_headers(): client = DomainsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2981,8 +3004,8 @@ async def test_transfer_domain_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - domains.ListRegistrationsRequest, - dict, + domains.ListRegistrationsRequest(), + {}, ], ) def test_list_registrations(request_type, transport: str = "grpc"): @@ -2993,7 +3016,7 @@ def test_list_registrations(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3043,11 +3066,12 @@ def test_list_registrations_non_empty_request_with_auto_populated_field(): client.list_registrations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == domains.ListRegistrationsRequest( + request_msg = domains.ListRegistrationsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_registrations_use_cached_wrapped_rpc(): @@ -3132,9 +3156,14 @@ async def test_list_registrations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_registrations_async( - transport: str = "grpc_asyncio", request_type=domains.ListRegistrationsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + domains.ListRegistrationsRequest(), + {}, + ], +) +async def test_list_registrations_async(request_type, transport: str = "grpc_asyncio"): client = DomainsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3142,7 +3171,7 @@ async def test_list_registrations_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( @@ -3167,11 +3196,6 @@ async def test_list_registrations_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_registrations_async_from_dict(): - await test_list_registrations_async(request_type=dict) - - def test_list_registrations_field_headers(): client = DomainsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3524,8 +3548,8 @@ async def test_list_registrations_async_pages(): @pytest.mark.parametrize( "request_type", [ - domains.GetRegistrationRequest, - dict, + domains.GetRegistrationRequest(), + {}, ], ) def test_get_registration(request_type, transport: str = "grpc"): @@ -3536,7 +3560,7 @@ def test_get_registration(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_registration), "__call__") as call: @@ -3588,9 +3612,10 @@ def test_get_registration_non_empty_request_with_auto_populated_field(): client.get_registration(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == domains.GetRegistrationRequest( + request_msg = domains.GetRegistrationRequest( name="name_value", ) + assert args[0] == request_msg def test_get_registration_use_cached_wrapped_rpc(): @@ -3673,9 +3698,14 @@ async def test_get_registration_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_registration_async( - transport: str = "grpc_asyncio", request_type=domains.GetRegistrationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + domains.GetRegistrationRequest(), + {}, + ], +) +async def test_get_registration_async(request_type, transport: str = "grpc_asyncio"): client = DomainsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3683,7 +3713,7 @@ async def test_get_registration_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_registration), "__call__") as call: @@ -3714,11 +3744,6 @@ async def test_get_registration_async( assert response.supported_privacy == [domains.ContactPrivacy.PUBLIC_CONTACT_DATA] -@pytest.mark.asyncio -async def test_get_registration_async_from_dict(): - await test_get_registration_async(request_type=dict) - - def test_get_registration_field_headers(): client = DomainsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3865,8 +3890,8 @@ async def test_get_registration_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - domains.UpdateRegistrationRequest, - dict, + domains.UpdateRegistrationRequest(), + {}, ], ) def test_update_registration(request_type, transport: str = "grpc"): @@ -3877,7 +3902,7 @@ def test_update_registration(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3920,7 +3945,8 @@ def test_update_registration_non_empty_request_with_auto_populated_field(): client.update_registration(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == domains.UpdateRegistrationRequest() + request_msg = domains.UpdateRegistrationRequest() + assert args[0] == request_msg def test_update_registration_use_cached_wrapped_rpc(): @@ -4015,9 +4041,14 @@ async def test_update_registration_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_registration_async( - transport: str = "grpc_asyncio", request_type=domains.UpdateRegistrationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + domains.UpdateRegistrationRequest(), + {}, + ], +) +async def test_update_registration_async(request_type, transport: str = "grpc_asyncio"): client = DomainsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4025,7 +4056,7 @@ async def test_update_registration_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( @@ -4047,11 +4078,6 @@ async def test_update_registration_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_registration_async_from_dict(): - await test_update_registration_async(request_type=dict) - - def test_update_registration_field_headers(): client = DomainsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4216,8 +4242,8 @@ async def test_update_registration_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - domains.ConfigureManagementSettingsRequest, - dict, + domains.ConfigureManagementSettingsRequest(), + {}, ], ) def test_configure_management_settings(request_type, transport: str = "grpc"): @@ -4228,7 +4254,7 @@ def test_configure_management_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( @@ -4273,9 +4299,10 @@ def test_configure_management_settings_non_empty_request_with_auto_populated_fie client.configure_management_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == domains.ConfigureManagementSettingsRequest( + request_msg = domains.ConfigureManagementSettingsRequest( registration="registration_value", ) + assert args[0] == request_msg def test_configure_management_settings_use_cached_wrapped_rpc(): @@ -4371,9 +4398,15 @@ async def test_configure_management_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + domains.ConfigureManagementSettingsRequest(), + {}, + ], +) async def test_configure_management_settings_async( - transport: str = "grpc_asyncio", - request_type=domains.ConfigureManagementSettingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = DomainsAsyncClient( credentials=async_anonymous_credentials(), @@ -4382,7 +4415,7 @@ async def test_configure_management_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( @@ -4404,11 +4437,6 @@ async def test_configure_management_settings_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_configure_management_settings_async_from_dict(): - await test_configure_management_settings_async(request_type=dict) - - def test_configure_management_settings_field_headers(): client = DomainsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4595,8 +4623,8 @@ async def test_configure_management_settings_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - domains.ConfigureDnsSettingsRequest, - dict, + domains.ConfigureDnsSettingsRequest(), + {}, ], ) def test_configure_dns_settings(request_type, transport: str = "grpc"): @@ -4607,7 +4635,7 @@ def test_configure_dns_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( @@ -4652,9 +4680,10 @@ def test_configure_dns_settings_non_empty_request_with_auto_populated_field(): client.configure_dns_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == domains.ConfigureDnsSettingsRequest( + request_msg = domains.ConfigureDnsSettingsRequest( registration="registration_value", ) + assert args[0] == request_msg def test_configure_dns_settings_use_cached_wrapped_rpc(): @@ -4750,8 +4779,15 @@ async def test_configure_dns_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + domains.ConfigureDnsSettingsRequest(), + {}, + ], +) async def test_configure_dns_settings_async( - transport: str = "grpc_asyncio", request_type=domains.ConfigureDnsSettingsRequest + request_type, transport: str = "grpc_asyncio" ): client = DomainsAsyncClient( credentials=async_anonymous_credentials(), @@ -4760,7 +4796,7 @@ async def test_configure_dns_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( @@ -4782,11 +4818,6 @@ async def test_configure_dns_settings_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_configure_dns_settings_async_from_dict(): - await test_configure_dns_settings_async(request_type=dict) - - def test_configure_dns_settings_field_headers(): client = DomainsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4985,8 +5016,8 @@ async def test_configure_dns_settings_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - domains.ConfigureContactSettingsRequest, - dict, + domains.ConfigureContactSettingsRequest(), + {}, ], ) def test_configure_contact_settings(request_type, transport: str = "grpc"): @@ -4997,7 +5028,7 @@ def test_configure_contact_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( @@ -5042,9 +5073,10 @@ def test_configure_contact_settings_non_empty_request_with_auto_populated_field( client.configure_contact_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == domains.ConfigureContactSettingsRequest( + request_msg = domains.ConfigureContactSettingsRequest( registration="registration_value", ) + assert args[0] == request_msg def test_configure_contact_settings_use_cached_wrapped_rpc(): @@ -5140,9 +5172,15 @@ async def test_configure_contact_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + domains.ConfigureContactSettingsRequest(), + {}, + ], +) async def test_configure_contact_settings_async( - transport: str = "grpc_asyncio", - request_type=domains.ConfigureContactSettingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = DomainsAsyncClient( credentials=async_anonymous_credentials(), @@ -5151,7 +5189,7 @@ async def test_configure_contact_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( @@ -5173,11 +5211,6 @@ async def test_configure_contact_settings_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_configure_contact_settings_async_from_dict(): - await test_configure_contact_settings_async(request_type=dict) - - def test_configure_contact_settings_field_headers(): client = DomainsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5364,8 +5397,8 @@ async def test_configure_contact_settings_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - domains.ExportRegistrationRequest, - dict, + domains.ExportRegistrationRequest(), + {}, ], ) def test_export_registration(request_type, transport: str = "grpc"): @@ -5376,7 +5409,7 @@ def test_export_registration(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5421,9 +5454,10 @@ def test_export_registration_non_empty_request_with_auto_populated_field(): client.export_registration(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == domains.ExportRegistrationRequest( + request_msg = domains.ExportRegistrationRequest( name="name_value", ) + assert args[0] == request_msg def test_export_registration_use_cached_wrapped_rpc(): @@ -5518,9 +5552,14 @@ async def test_export_registration_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_export_registration_async( - transport: str = "grpc_asyncio", request_type=domains.ExportRegistrationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + domains.ExportRegistrationRequest(), + {}, + ], +) +async def test_export_registration_async(request_type, transport: str = "grpc_asyncio"): client = DomainsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5528,7 +5567,7 @@ async def test_export_registration_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( @@ -5550,11 +5589,6 @@ async def test_export_registration_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_export_registration_async_from_dict(): - await test_export_registration_async(request_type=dict) - - def test_export_registration_field_headers(): client = DomainsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5709,8 +5743,8 @@ async def test_export_registration_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - domains.DeleteRegistrationRequest, - dict, + domains.DeleteRegistrationRequest(), + {}, ], ) def test_delete_registration(request_type, transport: str = "grpc"): @@ -5721,7 +5755,7 @@ def test_delete_registration(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5766,9 +5800,10 @@ def test_delete_registration_non_empty_request_with_auto_populated_field(): client.delete_registration(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == domains.DeleteRegistrationRequest( + request_msg = domains.DeleteRegistrationRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_registration_use_cached_wrapped_rpc(): @@ -5863,9 +5898,14 @@ async def test_delete_registration_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_registration_async( - transport: str = "grpc_asyncio", request_type=domains.DeleteRegistrationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + domains.DeleteRegistrationRequest(), + {}, + ], +) +async def test_delete_registration_async(request_type, transport: str = "grpc_asyncio"): client = DomainsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5873,7 +5913,7 @@ async def test_delete_registration_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( @@ -5895,11 +5935,6 @@ async def test_delete_registration_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_registration_async_from_dict(): - await test_delete_registration_async(request_type=dict) - - def test_delete_registration_field_headers(): client = DomainsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6054,8 +6089,8 @@ async def test_delete_registration_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - domains.RetrieveAuthorizationCodeRequest, - dict, + domains.RetrieveAuthorizationCodeRequest(), + {}, ], ) def test_retrieve_authorization_code(request_type, transport: str = "grpc"): @@ -6066,7 +6101,7 @@ def test_retrieve_authorization_code(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6114,9 +6149,10 @@ def test_retrieve_authorization_code_non_empty_request_with_auto_populated_field client.retrieve_authorization_code(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == domains.RetrieveAuthorizationCodeRequest( + request_msg = domains.RetrieveAuthorizationCodeRequest( registration="registration_value", ) + assert args[0] == request_msg def test_retrieve_authorization_code_use_cached_wrapped_rpc(): @@ -6202,9 +6238,15 @@ async def test_retrieve_authorization_code_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + domains.RetrieveAuthorizationCodeRequest(), + {}, + ], +) async def test_retrieve_authorization_code_async( - transport: str = "grpc_asyncio", - request_type=domains.RetrieveAuthorizationCodeRequest, + request_type, transport: str = "grpc_asyncio" ): client = DomainsAsyncClient( credentials=async_anonymous_credentials(), @@ -6213,7 +6255,7 @@ async def test_retrieve_authorization_code_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( @@ -6238,11 +6280,6 @@ async def test_retrieve_authorization_code_async( assert response.code == "code_value" -@pytest.mark.asyncio -async def test_retrieve_authorization_code_async_from_dict(): - await test_retrieve_authorization_code_async(request_type=dict) - - def test_retrieve_authorization_code_field_headers(): client = DomainsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6397,8 +6434,8 @@ async def test_retrieve_authorization_code_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - domains.ResetAuthorizationCodeRequest, - dict, + domains.ResetAuthorizationCodeRequest(), + {}, ], ) def test_reset_authorization_code(request_type, transport: str = "grpc"): @@ -6409,7 +6446,7 @@ def test_reset_authorization_code(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6457,9 +6494,10 @@ def test_reset_authorization_code_non_empty_request_with_auto_populated_field(): client.reset_authorization_code(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == domains.ResetAuthorizationCodeRequest( + request_msg = domains.ResetAuthorizationCodeRequest( registration="registration_value", ) + assert args[0] == request_msg def test_reset_authorization_code_use_cached_wrapped_rpc(): @@ -6545,8 +6583,15 @@ async def test_reset_authorization_code_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + domains.ResetAuthorizationCodeRequest(), + {}, + ], +) async def test_reset_authorization_code_async( - transport: str = "grpc_asyncio", request_type=domains.ResetAuthorizationCodeRequest + request_type, transport: str = "grpc_asyncio" ): client = DomainsAsyncClient( credentials=async_anonymous_credentials(), @@ -6555,7 +6600,7 @@ async def test_reset_authorization_code_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( @@ -6580,11 +6625,6 @@ async def test_reset_authorization_code_async( assert response.code == "code_value" -@pytest.mark.asyncio -async def test_reset_authorization_code_async_from_dict(): - await test_reset_authorization_code_async(request_type=dict) - - def test_reset_authorization_code_field_headers(): client = DomainsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9834,7 +9874,6 @@ def test_search_domains_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.SearchDomainsRequest() - assert args[0] == request_msg @@ -9857,7 +9896,6 @@ def test_retrieve_register_parameters_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.RetrieveRegisterParametersRequest() - assert args[0] == request_msg @@ -9878,7 +9916,6 @@ def test_register_domain_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.RegisterDomainRequest() - assert args[0] == request_msg @@ -9901,7 +9938,6 @@ def test_retrieve_transfer_parameters_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.RetrieveTransferParametersRequest() - assert args[0] == request_msg @@ -9922,7 +9958,6 @@ def test_transfer_domain_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.TransferDomainRequest() - assert args[0] == request_msg @@ -9945,7 +9980,6 @@ def test_list_registrations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.ListRegistrationsRequest() - assert args[0] == request_msg @@ -9966,7 +10000,6 @@ def test_get_registration_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.GetRegistrationRequest() - assert args[0] == request_msg @@ -9989,7 +10022,6 @@ def test_update_registration_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.UpdateRegistrationRequest() - assert args[0] == request_msg @@ -10012,7 +10044,6 @@ def test_configure_management_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.ConfigureManagementSettingsRequest() - assert args[0] == request_msg @@ -10035,7 +10066,6 @@ def test_configure_dns_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.ConfigureDnsSettingsRequest() - assert args[0] == request_msg @@ -10058,7 +10088,6 @@ def test_configure_contact_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.ConfigureContactSettingsRequest() - assert args[0] == request_msg @@ -10081,7 +10110,6 @@ def test_export_registration_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.ExportRegistrationRequest() - assert args[0] == request_msg @@ -10104,7 +10132,6 @@ def test_delete_registration_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.DeleteRegistrationRequest() - assert args[0] == request_msg @@ -10127,7 +10154,6 @@ def test_retrieve_authorization_code_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.RetrieveAuthorizationCodeRequest() - assert args[0] == request_msg @@ -10150,7 +10176,6 @@ def test_reset_authorization_code_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.ResetAuthorizationCodeRequest() - assert args[0] == request_msg @@ -10189,7 +10214,6 @@ async def test_search_domains_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.SearchDomainsRequest() - assert args[0] == request_msg @@ -10216,7 +10240,6 @@ async def test_retrieve_register_parameters_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.RetrieveRegisterParametersRequest() - assert args[0] == request_msg @@ -10241,7 +10264,6 @@ async def test_register_domain_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.RegisterDomainRequest() - assert args[0] == request_msg @@ -10268,7 +10290,6 @@ async def test_retrieve_transfer_parameters_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.RetrieveTransferParametersRequest() - assert args[0] == request_msg @@ -10293,7 +10314,6 @@ async def test_transfer_domain_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.TransferDomainRequest() - assert args[0] == request_msg @@ -10322,7 +10342,6 @@ async def test_list_registrations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.ListRegistrationsRequest() - assert args[0] == request_msg @@ -10353,7 +10372,6 @@ async def test_get_registration_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.GetRegistrationRequest() - assert args[0] == request_msg @@ -10380,7 +10398,6 @@ async def test_update_registration_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.UpdateRegistrationRequest() - assert args[0] == request_msg @@ -10407,7 +10424,6 @@ async def test_configure_management_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.ConfigureManagementSettingsRequest() - assert args[0] == request_msg @@ -10434,7 +10450,6 @@ async def test_configure_dns_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.ConfigureDnsSettingsRequest() - assert args[0] == request_msg @@ -10461,7 +10476,6 @@ async def test_configure_contact_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.ConfigureContactSettingsRequest() - assert args[0] == request_msg @@ -10488,7 +10502,6 @@ async def test_export_registration_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.ExportRegistrationRequest() - assert args[0] == request_msg @@ -10515,7 +10528,6 @@ async def test_delete_registration_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.DeleteRegistrationRequest() - assert args[0] == request_msg @@ -10544,7 +10556,6 @@ async def test_retrieve_authorization_code_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.RetrieveAuthorizationCodeRequest() - assert args[0] == request_msg @@ -10573,7 +10584,6 @@ async def test_reset_authorization_code_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.ResetAuthorizationCodeRequest() - assert args[0] == request_msg @@ -12652,7 +12662,6 @@ def test_search_domains_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.SearchDomainsRequest() - assert args[0] == request_msg @@ -12674,7 +12683,6 @@ def test_retrieve_register_parameters_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.RetrieveRegisterParametersRequest() - assert args[0] == request_msg @@ -12694,7 +12702,6 @@ def test_register_domain_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.RegisterDomainRequest() - assert args[0] == request_msg @@ -12716,7 +12723,6 @@ def test_retrieve_transfer_parameters_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.RetrieveTransferParametersRequest() - assert args[0] == request_msg @@ -12736,7 +12742,6 @@ def test_transfer_domain_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.TransferDomainRequest() - assert args[0] == request_msg @@ -12758,7 +12763,6 @@ def test_list_registrations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.ListRegistrationsRequest() - assert args[0] == request_msg @@ -12778,7 +12782,6 @@ def test_get_registration_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.GetRegistrationRequest() - assert args[0] == request_msg @@ -12800,7 +12803,6 @@ def test_update_registration_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.UpdateRegistrationRequest() - assert args[0] == request_msg @@ -12822,7 +12824,6 @@ def test_configure_management_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.ConfigureManagementSettingsRequest() - assert args[0] == request_msg @@ -12844,7 +12845,6 @@ def test_configure_dns_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.ConfigureDnsSettingsRequest() - assert args[0] == request_msg @@ -12866,7 +12866,6 @@ def test_configure_contact_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.ConfigureContactSettingsRequest() - assert args[0] == request_msg @@ -12888,7 +12887,6 @@ def test_export_registration_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.ExportRegistrationRequest() - assert args[0] == request_msg @@ -12910,7 +12908,6 @@ def test_delete_registration_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.DeleteRegistrationRequest() - assert args[0] == request_msg @@ -12932,7 +12929,6 @@ def test_retrieve_authorization_code_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.RetrieveAuthorizationCodeRequest() - assert args[0] == request_msg @@ -12954,7 +12950,6 @@ def test_reset_authorization_code_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.ResetAuthorizationCodeRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-domains/tests/unit/gapic/domains_v1beta1/test_domains.py b/packages/google-cloud-domains/tests/unit/gapic/domains_v1beta1/test_domains.py index 8b497abbe65d..4c70e34ab972 100644 --- a/packages/google-cloud-domains/tests/unit/gapic/domains_v1beta1/test_domains.py +++ b/packages/google-cloud-domains/tests/unit/gapic/domains_v1beta1/test_domains.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 @@ -117,6 +118,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" @@ -1250,8 +1266,8 @@ def test_domains_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - domains.SearchDomainsRequest, - dict, + domains.SearchDomainsRequest(), + {}, ], ) def test_search_domains(request_type, transport: str = "grpc"): @@ -1262,7 +1278,7 @@ def test_search_domains(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.search_domains), "__call__") as call: @@ -1304,10 +1320,11 @@ def test_search_domains_non_empty_request_with_auto_populated_field(): client.search_domains(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == domains.SearchDomainsRequest( + request_msg = domains.SearchDomainsRequest( query="query_value", location="location_value", ) + assert args[0] == request_msg def test_search_domains_use_cached_wrapped_rpc(): @@ -1388,9 +1405,14 @@ async def test_search_domains_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_search_domains_async( - transport: str = "grpc_asyncio", request_type=domains.SearchDomainsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + domains.SearchDomainsRequest(), + {}, + ], +) +async def test_search_domains_async(request_type, transport: str = "grpc_asyncio"): client = DomainsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1398,7 +1420,7 @@ async def test_search_domains_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.search_domains), "__call__") as call: @@ -1418,11 +1440,6 @@ async def test_search_domains_async( assert isinstance(response, domains.SearchDomainsResponse) -@pytest.mark.asyncio -async def test_search_domains_async_from_dict(): - await test_search_domains_async(request_type=dict) - - def test_search_domains_field_headers(): client = DomainsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1579,8 +1596,8 @@ async def test_search_domains_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - domains.RetrieveRegisterParametersRequest, - dict, + domains.RetrieveRegisterParametersRequest(), + {}, ], ) def test_retrieve_register_parameters(request_type, transport: str = "grpc"): @@ -1591,7 +1608,7 @@ def test_retrieve_register_parameters(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1637,10 +1654,11 @@ def test_retrieve_register_parameters_non_empty_request_with_auto_populated_fiel client.retrieve_register_parameters(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == domains.RetrieveRegisterParametersRequest( + request_msg = domains.RetrieveRegisterParametersRequest( domain_name="domain_name_value", location="location_value", ) + assert args[0] == request_msg def test_retrieve_register_parameters_use_cached_wrapped_rpc(): @@ -1726,9 +1744,15 @@ async def test_retrieve_register_parameters_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + domains.RetrieveRegisterParametersRequest(), + {}, + ], +) async def test_retrieve_register_parameters_async( - transport: str = "grpc_asyncio", - request_type=domains.RetrieveRegisterParametersRequest, + request_type, transport: str = "grpc_asyncio" ): client = DomainsAsyncClient( credentials=async_anonymous_credentials(), @@ -1737,7 +1761,7 @@ async def test_retrieve_register_parameters_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( @@ -1759,11 +1783,6 @@ async def test_retrieve_register_parameters_async( assert isinstance(response, domains.RetrieveRegisterParametersResponse) -@pytest.mark.asyncio -async def test_retrieve_register_parameters_async_from_dict(): - await test_retrieve_register_parameters_async(request_type=dict) - - def test_retrieve_register_parameters_field_headers(): client = DomainsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1928,8 +1947,8 @@ async def test_retrieve_register_parameters_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - domains.RegisterDomainRequest, - dict, + domains.RegisterDomainRequest(), + {}, ], ) def test_register_domain(request_type, transport: str = "grpc"): @@ -1940,7 +1959,7 @@ def test_register_domain(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.register_domain), "__call__") as call: @@ -1981,9 +2000,10 @@ def test_register_domain_non_empty_request_with_auto_populated_field(): client.register_domain(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == domains.RegisterDomainRequest( + request_msg = domains.RegisterDomainRequest( parent="parent_value", ) + assert args[0] == request_msg def test_register_domain_use_cached_wrapped_rpc(): @@ -2074,9 +2094,14 @@ async def test_register_domain_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_register_domain_async( - transport: str = "grpc_asyncio", request_type=domains.RegisterDomainRequest -): +@pytest.mark.parametrize( + "request_type", + [ + domains.RegisterDomainRequest(), + {}, + ], +) +async def test_register_domain_async(request_type, transport: str = "grpc_asyncio"): client = DomainsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2084,7 +2109,7 @@ async def test_register_domain_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.register_domain), "__call__") as call: @@ -2104,11 +2129,6 @@ async def test_register_domain_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_register_domain_async_from_dict(): - await test_register_domain_async(request_type=dict) - - def test_register_domain_field_headers(): client = DomainsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2275,8 +2295,8 @@ async def test_register_domain_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - domains.RetrieveTransferParametersRequest, - dict, + domains.RetrieveTransferParametersRequest(), + {}, ], ) def test_retrieve_transfer_parameters(request_type, transport: str = "grpc"): @@ -2287,7 +2307,7 @@ def test_retrieve_transfer_parameters(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2333,10 +2353,11 @@ def test_retrieve_transfer_parameters_non_empty_request_with_auto_populated_fiel client.retrieve_transfer_parameters(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == domains.RetrieveTransferParametersRequest( + request_msg = domains.RetrieveTransferParametersRequest( domain_name="domain_name_value", location="location_value", ) + assert args[0] == request_msg def test_retrieve_transfer_parameters_use_cached_wrapped_rpc(): @@ -2422,9 +2443,15 @@ async def test_retrieve_transfer_parameters_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + domains.RetrieveTransferParametersRequest(), + {}, + ], +) async def test_retrieve_transfer_parameters_async( - transport: str = "grpc_asyncio", - request_type=domains.RetrieveTransferParametersRequest, + request_type, transport: str = "grpc_asyncio" ): client = DomainsAsyncClient( credentials=async_anonymous_credentials(), @@ -2433,7 +2460,7 @@ async def test_retrieve_transfer_parameters_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( @@ -2455,11 +2482,6 @@ async def test_retrieve_transfer_parameters_async( assert isinstance(response, domains.RetrieveTransferParametersResponse) -@pytest.mark.asyncio -async def test_retrieve_transfer_parameters_async_from_dict(): - await test_retrieve_transfer_parameters_async(request_type=dict) - - def test_retrieve_transfer_parameters_field_headers(): client = DomainsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2624,8 +2646,8 @@ async def test_retrieve_transfer_parameters_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - domains.TransferDomainRequest, - dict, + domains.TransferDomainRequest(), + {}, ], ) def test_transfer_domain(request_type, transport: str = "grpc"): @@ -2636,7 +2658,7 @@ def test_transfer_domain(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.transfer_domain), "__call__") as call: @@ -2677,9 +2699,10 @@ def test_transfer_domain_non_empty_request_with_auto_populated_field(): client.transfer_domain(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == domains.TransferDomainRequest( + request_msg = domains.TransferDomainRequest( parent="parent_value", ) + assert args[0] == request_msg def test_transfer_domain_use_cached_wrapped_rpc(): @@ -2770,9 +2793,14 @@ async def test_transfer_domain_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_transfer_domain_async( - transport: str = "grpc_asyncio", request_type=domains.TransferDomainRequest -): +@pytest.mark.parametrize( + "request_type", + [ + domains.TransferDomainRequest(), + {}, + ], +) +async def test_transfer_domain_async(request_type, transport: str = "grpc_asyncio"): client = DomainsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2780,7 +2808,7 @@ async def test_transfer_domain_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.transfer_domain), "__call__") as call: @@ -2800,11 +2828,6 @@ async def test_transfer_domain_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_transfer_domain_async_from_dict(): - await test_transfer_domain_async(request_type=dict) - - def test_transfer_domain_field_headers(): client = DomainsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2981,8 +3004,8 @@ async def test_transfer_domain_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - domains.ListRegistrationsRequest, - dict, + domains.ListRegistrationsRequest(), + {}, ], ) def test_list_registrations(request_type, transport: str = "grpc"): @@ -2993,7 +3016,7 @@ def test_list_registrations(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3043,11 +3066,12 @@ def test_list_registrations_non_empty_request_with_auto_populated_field(): client.list_registrations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == domains.ListRegistrationsRequest( + request_msg = domains.ListRegistrationsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_registrations_use_cached_wrapped_rpc(): @@ -3132,9 +3156,14 @@ async def test_list_registrations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_registrations_async( - transport: str = "grpc_asyncio", request_type=domains.ListRegistrationsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + domains.ListRegistrationsRequest(), + {}, + ], +) +async def test_list_registrations_async(request_type, transport: str = "grpc_asyncio"): client = DomainsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3142,7 +3171,7 @@ async def test_list_registrations_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( @@ -3167,11 +3196,6 @@ async def test_list_registrations_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_registrations_async_from_dict(): - await test_list_registrations_async(request_type=dict) - - def test_list_registrations_field_headers(): client = DomainsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3524,8 +3548,8 @@ async def test_list_registrations_async_pages(): @pytest.mark.parametrize( "request_type", [ - domains.GetRegistrationRequest, - dict, + domains.GetRegistrationRequest(), + {}, ], ) def test_get_registration(request_type, transport: str = "grpc"): @@ -3536,7 +3560,7 @@ def test_get_registration(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_registration), "__call__") as call: @@ -3588,9 +3612,10 @@ def test_get_registration_non_empty_request_with_auto_populated_field(): client.get_registration(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == domains.GetRegistrationRequest( + request_msg = domains.GetRegistrationRequest( name="name_value", ) + assert args[0] == request_msg def test_get_registration_use_cached_wrapped_rpc(): @@ -3673,9 +3698,14 @@ async def test_get_registration_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_registration_async( - transport: str = "grpc_asyncio", request_type=domains.GetRegistrationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + domains.GetRegistrationRequest(), + {}, + ], +) +async def test_get_registration_async(request_type, transport: str = "grpc_asyncio"): client = DomainsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3683,7 +3713,7 @@ async def test_get_registration_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_registration), "__call__") as call: @@ -3714,11 +3744,6 @@ async def test_get_registration_async( assert response.supported_privacy == [domains.ContactPrivacy.PUBLIC_CONTACT_DATA] -@pytest.mark.asyncio -async def test_get_registration_async_from_dict(): - await test_get_registration_async(request_type=dict) - - def test_get_registration_field_headers(): client = DomainsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3865,8 +3890,8 @@ async def test_get_registration_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - domains.UpdateRegistrationRequest, - dict, + domains.UpdateRegistrationRequest(), + {}, ], ) def test_update_registration(request_type, transport: str = "grpc"): @@ -3877,7 +3902,7 @@ def test_update_registration(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3920,7 +3945,8 @@ def test_update_registration_non_empty_request_with_auto_populated_field(): client.update_registration(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == domains.UpdateRegistrationRequest() + request_msg = domains.UpdateRegistrationRequest() + assert args[0] == request_msg def test_update_registration_use_cached_wrapped_rpc(): @@ -4015,9 +4041,14 @@ async def test_update_registration_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_registration_async( - transport: str = "grpc_asyncio", request_type=domains.UpdateRegistrationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + domains.UpdateRegistrationRequest(), + {}, + ], +) +async def test_update_registration_async(request_type, transport: str = "grpc_asyncio"): client = DomainsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4025,7 +4056,7 @@ async def test_update_registration_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( @@ -4047,11 +4078,6 @@ async def test_update_registration_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_registration_async_from_dict(): - await test_update_registration_async(request_type=dict) - - def test_update_registration_field_headers(): client = DomainsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4216,8 +4242,8 @@ async def test_update_registration_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - domains.ConfigureManagementSettingsRequest, - dict, + domains.ConfigureManagementSettingsRequest(), + {}, ], ) def test_configure_management_settings(request_type, transport: str = "grpc"): @@ -4228,7 +4254,7 @@ def test_configure_management_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( @@ -4273,9 +4299,10 @@ def test_configure_management_settings_non_empty_request_with_auto_populated_fie client.configure_management_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == domains.ConfigureManagementSettingsRequest( + request_msg = domains.ConfigureManagementSettingsRequest( registration="registration_value", ) + assert args[0] == request_msg def test_configure_management_settings_use_cached_wrapped_rpc(): @@ -4371,9 +4398,15 @@ async def test_configure_management_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + domains.ConfigureManagementSettingsRequest(), + {}, + ], +) async def test_configure_management_settings_async( - transport: str = "grpc_asyncio", - request_type=domains.ConfigureManagementSettingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = DomainsAsyncClient( credentials=async_anonymous_credentials(), @@ -4382,7 +4415,7 @@ async def test_configure_management_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( @@ -4404,11 +4437,6 @@ async def test_configure_management_settings_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_configure_management_settings_async_from_dict(): - await test_configure_management_settings_async(request_type=dict) - - def test_configure_management_settings_field_headers(): client = DomainsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4595,8 +4623,8 @@ async def test_configure_management_settings_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - domains.ConfigureDnsSettingsRequest, - dict, + domains.ConfigureDnsSettingsRequest(), + {}, ], ) def test_configure_dns_settings(request_type, transport: str = "grpc"): @@ -4607,7 +4635,7 @@ def test_configure_dns_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( @@ -4652,9 +4680,10 @@ def test_configure_dns_settings_non_empty_request_with_auto_populated_field(): client.configure_dns_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == domains.ConfigureDnsSettingsRequest( + request_msg = domains.ConfigureDnsSettingsRequest( registration="registration_value", ) + assert args[0] == request_msg def test_configure_dns_settings_use_cached_wrapped_rpc(): @@ -4750,8 +4779,15 @@ async def test_configure_dns_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + domains.ConfigureDnsSettingsRequest(), + {}, + ], +) async def test_configure_dns_settings_async( - transport: str = "grpc_asyncio", request_type=domains.ConfigureDnsSettingsRequest + request_type, transport: str = "grpc_asyncio" ): client = DomainsAsyncClient( credentials=async_anonymous_credentials(), @@ -4760,7 +4796,7 @@ async def test_configure_dns_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( @@ -4782,11 +4818,6 @@ async def test_configure_dns_settings_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_configure_dns_settings_async_from_dict(): - await test_configure_dns_settings_async(request_type=dict) - - def test_configure_dns_settings_field_headers(): client = DomainsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4985,8 +5016,8 @@ async def test_configure_dns_settings_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - domains.ConfigureContactSettingsRequest, - dict, + domains.ConfigureContactSettingsRequest(), + {}, ], ) def test_configure_contact_settings(request_type, transport: str = "grpc"): @@ -4997,7 +5028,7 @@ def test_configure_contact_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( @@ -5042,9 +5073,10 @@ def test_configure_contact_settings_non_empty_request_with_auto_populated_field( client.configure_contact_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == domains.ConfigureContactSettingsRequest( + request_msg = domains.ConfigureContactSettingsRequest( registration="registration_value", ) + assert args[0] == request_msg def test_configure_contact_settings_use_cached_wrapped_rpc(): @@ -5140,9 +5172,15 @@ async def test_configure_contact_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + domains.ConfigureContactSettingsRequest(), + {}, + ], +) async def test_configure_contact_settings_async( - transport: str = "grpc_asyncio", - request_type=domains.ConfigureContactSettingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = DomainsAsyncClient( credentials=async_anonymous_credentials(), @@ -5151,7 +5189,7 @@ async def test_configure_contact_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( @@ -5173,11 +5211,6 @@ async def test_configure_contact_settings_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_configure_contact_settings_async_from_dict(): - await test_configure_contact_settings_async(request_type=dict) - - def test_configure_contact_settings_field_headers(): client = DomainsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5364,8 +5397,8 @@ async def test_configure_contact_settings_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - domains.ExportRegistrationRequest, - dict, + domains.ExportRegistrationRequest(), + {}, ], ) def test_export_registration(request_type, transport: str = "grpc"): @@ -5376,7 +5409,7 @@ def test_export_registration(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5421,9 +5454,10 @@ def test_export_registration_non_empty_request_with_auto_populated_field(): client.export_registration(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == domains.ExportRegistrationRequest( + request_msg = domains.ExportRegistrationRequest( name="name_value", ) + assert args[0] == request_msg def test_export_registration_use_cached_wrapped_rpc(): @@ -5518,9 +5552,14 @@ async def test_export_registration_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_export_registration_async( - transport: str = "grpc_asyncio", request_type=domains.ExportRegistrationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + domains.ExportRegistrationRequest(), + {}, + ], +) +async def test_export_registration_async(request_type, transport: str = "grpc_asyncio"): client = DomainsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5528,7 +5567,7 @@ async def test_export_registration_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( @@ -5550,11 +5589,6 @@ async def test_export_registration_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_export_registration_async_from_dict(): - await test_export_registration_async(request_type=dict) - - def test_export_registration_field_headers(): client = DomainsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5709,8 +5743,8 @@ async def test_export_registration_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - domains.DeleteRegistrationRequest, - dict, + domains.DeleteRegistrationRequest(), + {}, ], ) def test_delete_registration(request_type, transport: str = "grpc"): @@ -5721,7 +5755,7 @@ def test_delete_registration(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5766,9 +5800,10 @@ def test_delete_registration_non_empty_request_with_auto_populated_field(): client.delete_registration(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == domains.DeleteRegistrationRequest( + request_msg = domains.DeleteRegistrationRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_registration_use_cached_wrapped_rpc(): @@ -5863,9 +5898,14 @@ async def test_delete_registration_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_registration_async( - transport: str = "grpc_asyncio", request_type=domains.DeleteRegistrationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + domains.DeleteRegistrationRequest(), + {}, + ], +) +async def test_delete_registration_async(request_type, transport: str = "grpc_asyncio"): client = DomainsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5873,7 +5913,7 @@ async def test_delete_registration_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( @@ -5895,11 +5935,6 @@ async def test_delete_registration_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_registration_async_from_dict(): - await test_delete_registration_async(request_type=dict) - - def test_delete_registration_field_headers(): client = DomainsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6054,8 +6089,8 @@ async def test_delete_registration_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - domains.RetrieveAuthorizationCodeRequest, - dict, + domains.RetrieveAuthorizationCodeRequest(), + {}, ], ) def test_retrieve_authorization_code(request_type, transport: str = "grpc"): @@ -6066,7 +6101,7 @@ def test_retrieve_authorization_code(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6114,9 +6149,10 @@ def test_retrieve_authorization_code_non_empty_request_with_auto_populated_field client.retrieve_authorization_code(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == domains.RetrieveAuthorizationCodeRequest( + request_msg = domains.RetrieveAuthorizationCodeRequest( registration="registration_value", ) + assert args[0] == request_msg def test_retrieve_authorization_code_use_cached_wrapped_rpc(): @@ -6202,9 +6238,15 @@ async def test_retrieve_authorization_code_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + domains.RetrieveAuthorizationCodeRequest(), + {}, + ], +) async def test_retrieve_authorization_code_async( - transport: str = "grpc_asyncio", - request_type=domains.RetrieveAuthorizationCodeRequest, + request_type, transport: str = "grpc_asyncio" ): client = DomainsAsyncClient( credentials=async_anonymous_credentials(), @@ -6213,7 +6255,7 @@ async def test_retrieve_authorization_code_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( @@ -6238,11 +6280,6 @@ async def test_retrieve_authorization_code_async( assert response.code == "code_value" -@pytest.mark.asyncio -async def test_retrieve_authorization_code_async_from_dict(): - await test_retrieve_authorization_code_async(request_type=dict) - - def test_retrieve_authorization_code_field_headers(): client = DomainsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6397,8 +6434,8 @@ async def test_retrieve_authorization_code_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - domains.ResetAuthorizationCodeRequest, - dict, + domains.ResetAuthorizationCodeRequest(), + {}, ], ) def test_reset_authorization_code(request_type, transport: str = "grpc"): @@ -6409,7 +6446,7 @@ def test_reset_authorization_code(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6457,9 +6494,10 @@ def test_reset_authorization_code_non_empty_request_with_auto_populated_field(): client.reset_authorization_code(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == domains.ResetAuthorizationCodeRequest( + request_msg = domains.ResetAuthorizationCodeRequest( registration="registration_value", ) + assert args[0] == request_msg def test_reset_authorization_code_use_cached_wrapped_rpc(): @@ -6545,8 +6583,15 @@ async def test_reset_authorization_code_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + domains.ResetAuthorizationCodeRequest(), + {}, + ], +) async def test_reset_authorization_code_async( - transport: str = "grpc_asyncio", request_type=domains.ResetAuthorizationCodeRequest + request_type, transport: str = "grpc_asyncio" ): client = DomainsAsyncClient( credentials=async_anonymous_credentials(), @@ -6555,7 +6600,7 @@ async def test_reset_authorization_code_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( @@ -6580,11 +6625,6 @@ async def test_reset_authorization_code_async( assert response.code == "code_value" -@pytest.mark.asyncio -async def test_reset_authorization_code_async_from_dict(): - await test_reset_authorization_code_async(request_type=dict) - - def test_reset_authorization_code_field_headers(): client = DomainsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9834,7 +9874,6 @@ def test_search_domains_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.SearchDomainsRequest() - assert args[0] == request_msg @@ -9857,7 +9896,6 @@ def test_retrieve_register_parameters_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.RetrieveRegisterParametersRequest() - assert args[0] == request_msg @@ -9878,7 +9916,6 @@ def test_register_domain_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.RegisterDomainRequest() - assert args[0] == request_msg @@ -9901,7 +9938,6 @@ def test_retrieve_transfer_parameters_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.RetrieveTransferParametersRequest() - assert args[0] == request_msg @@ -9922,7 +9958,6 @@ def test_transfer_domain_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.TransferDomainRequest() - assert args[0] == request_msg @@ -9945,7 +9980,6 @@ def test_list_registrations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.ListRegistrationsRequest() - assert args[0] == request_msg @@ -9966,7 +10000,6 @@ def test_get_registration_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.GetRegistrationRequest() - assert args[0] == request_msg @@ -9989,7 +10022,6 @@ def test_update_registration_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.UpdateRegistrationRequest() - assert args[0] == request_msg @@ -10012,7 +10044,6 @@ def test_configure_management_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.ConfigureManagementSettingsRequest() - assert args[0] == request_msg @@ -10035,7 +10066,6 @@ def test_configure_dns_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.ConfigureDnsSettingsRequest() - assert args[0] == request_msg @@ -10058,7 +10088,6 @@ def test_configure_contact_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.ConfigureContactSettingsRequest() - assert args[0] == request_msg @@ -10081,7 +10110,6 @@ def test_export_registration_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.ExportRegistrationRequest() - assert args[0] == request_msg @@ -10104,7 +10132,6 @@ def test_delete_registration_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.DeleteRegistrationRequest() - assert args[0] == request_msg @@ -10127,7 +10154,6 @@ def test_retrieve_authorization_code_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.RetrieveAuthorizationCodeRequest() - assert args[0] == request_msg @@ -10150,7 +10176,6 @@ def test_reset_authorization_code_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.ResetAuthorizationCodeRequest() - assert args[0] == request_msg @@ -10189,7 +10214,6 @@ async def test_search_domains_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.SearchDomainsRequest() - assert args[0] == request_msg @@ -10216,7 +10240,6 @@ async def test_retrieve_register_parameters_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.RetrieveRegisterParametersRequest() - assert args[0] == request_msg @@ -10241,7 +10264,6 @@ async def test_register_domain_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.RegisterDomainRequest() - assert args[0] == request_msg @@ -10268,7 +10290,6 @@ async def test_retrieve_transfer_parameters_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.RetrieveTransferParametersRequest() - assert args[0] == request_msg @@ -10293,7 +10314,6 @@ async def test_transfer_domain_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.TransferDomainRequest() - assert args[0] == request_msg @@ -10322,7 +10342,6 @@ async def test_list_registrations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.ListRegistrationsRequest() - assert args[0] == request_msg @@ -10353,7 +10372,6 @@ async def test_get_registration_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.GetRegistrationRequest() - assert args[0] == request_msg @@ -10380,7 +10398,6 @@ async def test_update_registration_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.UpdateRegistrationRequest() - assert args[0] == request_msg @@ -10407,7 +10424,6 @@ async def test_configure_management_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.ConfigureManagementSettingsRequest() - assert args[0] == request_msg @@ -10434,7 +10450,6 @@ async def test_configure_dns_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.ConfigureDnsSettingsRequest() - assert args[0] == request_msg @@ -10461,7 +10476,6 @@ async def test_configure_contact_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.ConfigureContactSettingsRequest() - assert args[0] == request_msg @@ -10488,7 +10502,6 @@ async def test_export_registration_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.ExportRegistrationRequest() - assert args[0] == request_msg @@ -10515,7 +10528,6 @@ async def test_delete_registration_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.DeleteRegistrationRequest() - assert args[0] == request_msg @@ -10544,7 +10556,6 @@ async def test_retrieve_authorization_code_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.RetrieveAuthorizationCodeRequest() - assert args[0] == request_msg @@ -10573,7 +10584,6 @@ async def test_reset_authorization_code_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.ResetAuthorizationCodeRequest() - assert args[0] == request_msg @@ -12652,7 +12662,6 @@ def test_search_domains_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.SearchDomainsRequest() - assert args[0] == request_msg @@ -12674,7 +12683,6 @@ def test_retrieve_register_parameters_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.RetrieveRegisterParametersRequest() - assert args[0] == request_msg @@ -12694,7 +12702,6 @@ def test_register_domain_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.RegisterDomainRequest() - assert args[0] == request_msg @@ -12716,7 +12723,6 @@ def test_retrieve_transfer_parameters_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.RetrieveTransferParametersRequest() - assert args[0] == request_msg @@ -12736,7 +12742,6 @@ def test_transfer_domain_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.TransferDomainRequest() - assert args[0] == request_msg @@ -12758,7 +12763,6 @@ def test_list_registrations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.ListRegistrationsRequest() - assert args[0] == request_msg @@ -12778,7 +12782,6 @@ def test_get_registration_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.GetRegistrationRequest() - assert args[0] == request_msg @@ -12800,7 +12803,6 @@ def test_update_registration_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.UpdateRegistrationRequest() - assert args[0] == request_msg @@ -12822,7 +12824,6 @@ def test_configure_management_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.ConfigureManagementSettingsRequest() - assert args[0] == request_msg @@ -12844,7 +12845,6 @@ def test_configure_dns_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.ConfigureDnsSettingsRequest() - assert args[0] == request_msg @@ -12866,7 +12866,6 @@ def test_configure_contact_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.ConfigureContactSettingsRequest() - assert args[0] == request_msg @@ -12888,7 +12887,6 @@ def test_export_registration_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.ExportRegistrationRequest() - assert args[0] == request_msg @@ -12910,7 +12908,6 @@ def test_delete_registration_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.DeleteRegistrationRequest() - assert args[0] == request_msg @@ -12932,7 +12929,6 @@ def test_retrieve_authorization_code_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.RetrieveAuthorizationCodeRequest() - assert args[0] == request_msg @@ -12954,7 +12950,6 @@ def test_reset_authorization_code_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = domains.ResetAuthorizationCodeRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-edgecontainer/noxfile.py b/packages/google-cloud-edgecontainer/noxfile.py index 7f610a28fa39..43042ab41c58 100644 --- a/packages/google-cloud-edgecontainer/noxfile.py +++ b/packages/google-cloud-edgecontainer/noxfile.py @@ -47,7 +47,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-edgecontainer" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-edgecontainer/setup.py b/packages/google-cloud-edgecontainer/setup.py index ec3453f3baf6..cb72ce7e68de 100644 --- a/packages/google-cloud-edgecontainer/setup.py +++ b/packages/google-cloud-edgecontainer/setup.py @@ -45,7 +45,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/google-cloud-edgecontainer/testing/constraints-3.10.txt b/packages/google-cloud-edgecontainer/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-edgecontainer/testing/constraints-3.10.txt +++ b/packages/google-cloud-edgecontainer/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-edgecontainer/tests/unit/gapic/edgecontainer_v1/test_edge_container.py b/packages/google-cloud-edgecontainer/tests/unit/gapic/edgecontainer_v1/test_edge_container.py index f6e3f8056528..7ee77586ae7a 100644 --- a/packages/google-cloud-edgecontainer/tests/unit/gapic/edgecontainer_v1/test_edge_container.py +++ b/packages/google-cloud-edgecontainer/tests/unit/gapic/edgecontainer_v1/test_edge_container.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 @@ -119,6 +120,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" @@ -1318,8 +1334,8 @@ def test_edge_container_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - service.ListClustersRequest, - dict, + service.ListClustersRequest(), + {}, ], ) def test_list_clusters(request_type, transport: str = "grpc"): @@ -1330,7 +1346,7 @@ def test_list_clusters(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_clusters), "__call__") as call: @@ -1379,12 +1395,13 @@ def test_list_clusters_non_empty_request_with_auto_populated_field(): client.list_clusters(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListClustersRequest( + request_msg = service.ListClustersRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_clusters_use_cached_wrapped_rpc(): @@ -1465,9 +1482,14 @@ async def test_list_clusters_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_clusters_async( - transport: str = "grpc_asyncio", request_type=service.ListClustersRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListClustersRequest(), + {}, + ], +) +async def test_list_clusters_async(request_type, transport: str = "grpc_asyncio"): client = EdgeContainerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1475,7 +1497,7 @@ async def test_list_clusters_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_clusters), "__call__") as call: @@ -1500,11 +1522,6 @@ async def test_list_clusters_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_clusters_async_from_dict(): - await test_list_clusters_async(request_type=dict) - - def test_list_clusters_field_headers(): client = EdgeContainerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1841,8 +1858,8 @@ async def test_list_clusters_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetClusterRequest, - dict, + service.GetClusterRequest(), + {}, ], ) def test_get_cluster(request_type, transport: str = "grpc"): @@ -1853,7 +1870,7 @@ def test_get_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_cluster), "__call__") as call: @@ -1927,9 +1944,10 @@ def test_get_cluster_non_empty_request_with_auto_populated_field(): client.get_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetClusterRequest( + request_msg = service.GetClusterRequest( name="name_value", ) + assert args[0] == request_msg def test_get_cluster_use_cached_wrapped_rpc(): @@ -2010,9 +2028,14 @@ async def test_get_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_cluster_async( - transport: str = "grpc_asyncio", request_type=service.GetClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetClusterRequest(), + {}, + ], +) +async def test_get_cluster_async(request_type, transport: str = "grpc_asyncio"): client = EdgeContainerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2020,7 +2043,7 @@ async def test_get_cluster_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_cluster), "__call__") as call: @@ -2073,11 +2096,6 @@ async def test_get_cluster_async( ] -@pytest.mark.asyncio -async def test_get_cluster_async_from_dict(): - await test_get_cluster_async(request_type=dict) - - def test_get_cluster_field_headers(): client = EdgeContainerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2220,8 +2238,8 @@ async def test_get_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.CreateClusterRequest, - dict, + service.CreateClusterRequest(), + {}, ], ) def test_create_cluster(request_type, transport: str = "grpc"): @@ -2232,7 +2250,7 @@ def test_create_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_cluster), "__call__") as call: @@ -2275,11 +2293,12 @@ def test_create_cluster_non_empty_request_with_auto_populated_field(): client.create_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateClusterRequest( + request_msg = service.CreateClusterRequest( parent="parent_value", cluster_id="cluster_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_cluster_use_cached_wrapped_rpc(): @@ -2370,9 +2389,14 @@ async def test_create_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_cluster_async( - transport: str = "grpc_asyncio", request_type=service.CreateClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CreateClusterRequest(), + {}, + ], +) +async def test_create_cluster_async(request_type, transport: str = "grpc_asyncio"): client = EdgeContainerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2380,7 +2404,7 @@ async def test_create_cluster_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_cluster), "__call__") as call: @@ -2400,11 +2424,6 @@ async def test_create_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_cluster_async_from_dict(): - await test_create_cluster_async(request_type=dict) - - def test_create_cluster_field_headers(): client = EdgeContainerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2571,8 +2590,8 @@ async def test_create_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdateClusterRequest, - dict, + service.UpdateClusterRequest(), + {}, ], ) def test_update_cluster(request_type, transport: str = "grpc"): @@ -2583,7 +2602,7 @@ def test_update_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_cluster), "__call__") as call: @@ -2624,9 +2643,10 @@ def test_update_cluster_non_empty_request_with_auto_populated_field(): client.update_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateClusterRequest( + request_msg = service.UpdateClusterRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_cluster_use_cached_wrapped_rpc(): @@ -2717,9 +2737,14 @@ async def test_update_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_cluster_async( - transport: str = "grpc_asyncio", request_type=service.UpdateClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateClusterRequest(), + {}, + ], +) +async def test_update_cluster_async(request_type, transport: str = "grpc_asyncio"): client = EdgeContainerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2727,7 +2752,7 @@ async def test_update_cluster_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_cluster), "__call__") as call: @@ -2747,11 +2772,6 @@ async def test_update_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_cluster_async_from_dict(): - await test_update_cluster_async(request_type=dict) - - def test_update_cluster_field_headers(): client = EdgeContainerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2908,8 +2928,8 @@ async def test_update_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.UpgradeClusterRequest, - dict, + service.UpgradeClusterRequest(), + {}, ], ) def test_upgrade_cluster(request_type, transport: str = "grpc"): @@ -2920,7 +2940,7 @@ def test_upgrade_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.upgrade_cluster), "__call__") as call: @@ -2963,11 +2983,12 @@ def test_upgrade_cluster_non_empty_request_with_auto_populated_field(): client.upgrade_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpgradeClusterRequest( + request_msg = service.UpgradeClusterRequest( name="name_value", target_version="target_version_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_upgrade_cluster_use_cached_wrapped_rpc(): @@ -3058,9 +3079,14 @@ async def test_upgrade_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_upgrade_cluster_async( - transport: str = "grpc_asyncio", request_type=service.UpgradeClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.UpgradeClusterRequest(), + {}, + ], +) +async def test_upgrade_cluster_async(request_type, transport: str = "grpc_asyncio"): client = EdgeContainerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3068,7 +3094,7 @@ async def test_upgrade_cluster_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.upgrade_cluster), "__call__") as call: @@ -3088,11 +3114,6 @@ async def test_upgrade_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_upgrade_cluster_async_from_dict(): - await test_upgrade_cluster_async(request_type=dict) - - def test_upgrade_cluster_field_headers(): client = EdgeContainerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3259,8 +3280,8 @@ async def test_upgrade_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DeleteClusterRequest, - dict, + service.DeleteClusterRequest(), + {}, ], ) def test_delete_cluster(request_type, transport: str = "grpc"): @@ -3271,7 +3292,7 @@ def test_delete_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_cluster), "__call__") as call: @@ -3313,10 +3334,11 @@ def test_delete_cluster_non_empty_request_with_auto_populated_field(): client.delete_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteClusterRequest( + request_msg = service.DeleteClusterRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_cluster_use_cached_wrapped_rpc(): @@ -3407,9 +3429,14 @@ async def test_delete_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_cluster_async( - transport: str = "grpc_asyncio", request_type=service.DeleteClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteClusterRequest(), + {}, + ], +) +async def test_delete_cluster_async(request_type, transport: str = "grpc_asyncio"): client = EdgeContainerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3417,7 +3444,7 @@ async def test_delete_cluster_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_cluster), "__call__") as call: @@ -3437,11 +3464,6 @@ async def test_delete_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_cluster_async_from_dict(): - await test_delete_cluster_async(request_type=dict) - - def test_delete_cluster_field_headers(): client = EdgeContainerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3588,8 +3610,8 @@ async def test_delete_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.GenerateAccessTokenRequest, - dict, + service.GenerateAccessTokenRequest(), + {}, ], ) def test_generate_access_token(request_type, transport: str = "grpc"): @@ -3600,7 +3622,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( @@ -3648,9 +3670,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] == service.GenerateAccessTokenRequest( + request_msg = service.GenerateAccessTokenRequest( cluster="cluster_value", ) + assert args[0] == request_msg def test_generate_access_token_use_cached_wrapped_rpc(): @@ -3736,8 +3759,15 @@ async def test_generate_access_token_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.GenerateAccessTokenRequest(), + {}, + ], +) async def test_generate_access_token_async( - transport: str = "grpc_asyncio", request_type=service.GenerateAccessTokenRequest + request_type, transport: str = "grpc_asyncio" ): client = EdgeContainerAsyncClient( credentials=async_anonymous_credentials(), @@ -3746,7 +3776,7 @@ async def test_generate_access_token_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( @@ -3771,11 +3801,6 @@ async def test_generate_access_token_async( 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 = EdgeContainerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3930,8 +3955,8 @@ async def test_generate_access_token_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.GenerateOfflineCredentialRequest, - dict, + service.GenerateOfflineCredentialRequest(), + {}, ], ) def test_generate_offline_credential(request_type, transport: str = "grpc"): @@ -3942,7 +3967,7 @@ def test_generate_offline_credential(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3994,9 +4019,10 @@ def test_generate_offline_credential_non_empty_request_with_auto_populated_field client.generate_offline_credential(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GenerateOfflineCredentialRequest( + request_msg = service.GenerateOfflineCredentialRequest( cluster="cluster_value", ) + assert args[0] == request_msg def test_generate_offline_credential_use_cached_wrapped_rpc(): @@ -4082,9 +4108,15 @@ async def test_generate_offline_credential_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.GenerateOfflineCredentialRequest(), + {}, + ], +) async def test_generate_offline_credential_async( - transport: str = "grpc_asyncio", - request_type=service.GenerateOfflineCredentialRequest, + request_type, transport: str = "grpc_asyncio" ): client = EdgeContainerAsyncClient( credentials=async_anonymous_credentials(), @@ -4093,7 +4125,7 @@ async def test_generate_offline_credential_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( @@ -4122,11 +4154,6 @@ async def test_generate_offline_credential_async( assert response.user_id == "user_id_value" -@pytest.mark.asyncio -async def test_generate_offline_credential_async_from_dict(): - await test_generate_offline_credential_async(request_type=dict) - - def test_generate_offline_credential_field_headers(): client = EdgeContainerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4281,8 +4308,8 @@ async def test_generate_offline_credential_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListNodePoolsRequest, - dict, + service.ListNodePoolsRequest(), + {}, ], ) def test_list_node_pools(request_type, transport: str = "grpc"): @@ -4293,7 +4320,7 @@ def test_list_node_pools(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_node_pools), "__call__") as call: @@ -4342,12 +4369,13 @@ def test_list_node_pools_non_empty_request_with_auto_populated_field(): client.list_node_pools(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListNodePoolsRequest( + request_msg = service.ListNodePoolsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_node_pools_use_cached_wrapped_rpc(): @@ -4428,9 +4456,14 @@ async def test_list_node_pools_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_node_pools_async( - transport: str = "grpc_asyncio", request_type=service.ListNodePoolsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListNodePoolsRequest(), + {}, + ], +) +async def test_list_node_pools_async(request_type, transport: str = "grpc_asyncio"): client = EdgeContainerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4438,7 +4471,7 @@ async def test_list_node_pools_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_node_pools), "__call__") as call: @@ -4463,11 +4496,6 @@ async def test_list_node_pools_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_node_pools_async_from_dict(): - await test_list_node_pools_async(request_type=dict) - - def test_list_node_pools_field_headers(): client = EdgeContainerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4804,8 +4832,8 @@ async def test_list_node_pools_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetNodePoolRequest, - dict, + service.GetNodePoolRequest(), + {}, ], ) def test_get_node_pool(request_type, transport: str = "grpc"): @@ -4816,7 +4844,7 @@ def test_get_node_pool(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_node_pool), "__call__") as call: @@ -4868,9 +4896,10 @@ def test_get_node_pool_non_empty_request_with_auto_populated_field(): client.get_node_pool(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetNodePoolRequest( + request_msg = service.GetNodePoolRequest( name="name_value", ) + assert args[0] == request_msg def test_get_node_pool_use_cached_wrapped_rpc(): @@ -4951,9 +4980,14 @@ async def test_get_node_pool_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_node_pool_async( - transport: str = "grpc_asyncio", request_type=service.GetNodePoolRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetNodePoolRequest(), + {}, + ], +) +async def test_get_node_pool_async(request_type, transport: str = "grpc_asyncio"): client = EdgeContainerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4961,7 +4995,7 @@ async def test_get_node_pool_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_node_pool), "__call__") as call: @@ -4992,11 +5026,6 @@ async def test_get_node_pool_async( assert response.node_version == "node_version_value" -@pytest.mark.asyncio -async def test_get_node_pool_async_from_dict(): - await test_get_node_pool_async(request_type=dict) - - def test_get_node_pool_field_headers(): client = EdgeContainerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5139,8 +5168,8 @@ async def test_get_node_pool_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.CreateNodePoolRequest, - dict, + service.CreateNodePoolRequest(), + {}, ], ) def test_create_node_pool(request_type, transport: str = "grpc"): @@ -5151,7 +5180,7 @@ def test_create_node_pool(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_node_pool), "__call__") as call: @@ -5194,11 +5223,12 @@ def test_create_node_pool_non_empty_request_with_auto_populated_field(): client.create_node_pool(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateNodePoolRequest( + request_msg = service.CreateNodePoolRequest( parent="parent_value", node_pool_id="node_pool_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_node_pool_use_cached_wrapped_rpc(): @@ -5291,9 +5321,14 @@ async def test_create_node_pool_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_node_pool_async( - transport: str = "grpc_asyncio", request_type=service.CreateNodePoolRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CreateNodePoolRequest(), + {}, + ], +) +async def test_create_node_pool_async(request_type, transport: str = "grpc_asyncio"): client = EdgeContainerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5301,7 +5336,7 @@ async def test_create_node_pool_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_node_pool), "__call__") as call: @@ -5321,11 +5356,6 @@ async def test_create_node_pool_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_node_pool_async_from_dict(): - await test_create_node_pool_async(request_type=dict) - - def test_create_node_pool_field_headers(): client = EdgeContainerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5492,8 +5522,8 @@ async def test_create_node_pool_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdateNodePoolRequest, - dict, + service.UpdateNodePoolRequest(), + {}, ], ) def test_update_node_pool(request_type, transport: str = "grpc"): @@ -5504,7 +5534,7 @@ def test_update_node_pool(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_node_pool), "__call__") as call: @@ -5545,9 +5575,10 @@ def test_update_node_pool_non_empty_request_with_auto_populated_field(): client.update_node_pool(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateNodePoolRequest( + request_msg = service.UpdateNodePoolRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_node_pool_use_cached_wrapped_rpc(): @@ -5640,9 +5671,14 @@ async def test_update_node_pool_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_node_pool_async( - transport: str = "grpc_asyncio", request_type=service.UpdateNodePoolRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateNodePoolRequest(), + {}, + ], +) +async def test_update_node_pool_async(request_type, transport: str = "grpc_asyncio"): client = EdgeContainerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5650,7 +5686,7 @@ async def test_update_node_pool_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_node_pool), "__call__") as call: @@ -5670,11 +5706,6 @@ async def test_update_node_pool_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_node_pool_async_from_dict(): - await test_update_node_pool_async(request_type=dict) - - def test_update_node_pool_field_headers(): client = EdgeContainerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5831,8 +5862,8 @@ async def test_update_node_pool_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DeleteNodePoolRequest, - dict, + service.DeleteNodePoolRequest(), + {}, ], ) def test_delete_node_pool(request_type, transport: str = "grpc"): @@ -5843,7 +5874,7 @@ def test_delete_node_pool(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_node_pool), "__call__") as call: @@ -5885,10 +5916,11 @@ def test_delete_node_pool_non_empty_request_with_auto_populated_field(): client.delete_node_pool(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteNodePoolRequest( + request_msg = service.DeleteNodePoolRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_node_pool_use_cached_wrapped_rpc(): @@ -5981,9 +6013,14 @@ async def test_delete_node_pool_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_node_pool_async( - transport: str = "grpc_asyncio", request_type=service.DeleteNodePoolRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteNodePoolRequest(), + {}, + ], +) +async def test_delete_node_pool_async(request_type, transport: str = "grpc_asyncio"): client = EdgeContainerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5991,7 +6028,7 @@ async def test_delete_node_pool_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_node_pool), "__call__") as call: @@ -6011,11 +6048,6 @@ async def test_delete_node_pool_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_node_pool_async_from_dict(): - await test_delete_node_pool_async(request_type=dict) - - def test_delete_node_pool_field_headers(): client = EdgeContainerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6162,8 +6194,8 @@ async def test_delete_node_pool_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListMachinesRequest, - dict, + service.ListMachinesRequest(), + {}, ], ) def test_list_machines(request_type, transport: str = "grpc"): @@ -6174,7 +6206,7 @@ def test_list_machines(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_machines), "__call__") as call: @@ -6223,12 +6255,13 @@ def test_list_machines_non_empty_request_with_auto_populated_field(): client.list_machines(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListMachinesRequest( + request_msg = service.ListMachinesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_machines_use_cached_wrapped_rpc(): @@ -6309,9 +6342,14 @@ async def test_list_machines_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_machines_async( - transport: str = "grpc_asyncio", request_type=service.ListMachinesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListMachinesRequest(), + {}, + ], +) +async def test_list_machines_async(request_type, transport: str = "grpc_asyncio"): client = EdgeContainerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6319,7 +6357,7 @@ async def test_list_machines_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_machines), "__call__") as call: @@ -6344,11 +6382,6 @@ async def test_list_machines_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_machines_async_from_dict(): - await test_list_machines_async(request_type=dict) - - def test_list_machines_field_headers(): client = EdgeContainerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6685,8 +6718,8 @@ async def test_list_machines_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetMachineRequest, - dict, + service.GetMachineRequest(), + {}, ], ) def test_get_machine(request_type, transport: str = "grpc"): @@ -6697,7 +6730,7 @@ def test_get_machine(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_machine), "__call__") as call: @@ -6749,9 +6782,10 @@ def test_get_machine_non_empty_request_with_auto_populated_field(): client.get_machine(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetMachineRequest( + request_msg = service.GetMachineRequest( name="name_value", ) + assert args[0] == request_msg def test_get_machine_use_cached_wrapped_rpc(): @@ -6832,9 +6866,14 @@ async def test_get_machine_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_machine_async( - transport: str = "grpc_asyncio", request_type=service.GetMachineRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetMachineRequest(), + {}, + ], +) +async def test_get_machine_async(request_type, transport: str = "grpc_asyncio"): client = EdgeContainerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6842,7 +6881,7 @@ async def test_get_machine_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_machine), "__call__") as call: @@ -6873,11 +6912,6 @@ async def test_get_machine_async( assert response.disabled is True -@pytest.mark.asyncio -async def test_get_machine_async_from_dict(): - await test_get_machine_async(request_type=dict) - - def test_get_machine_field_headers(): client = EdgeContainerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7020,8 +7054,8 @@ async def test_get_machine_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListVpnConnectionsRequest, - dict, + service.ListVpnConnectionsRequest(), + {}, ], ) def test_list_vpn_connections(request_type, transport: str = "grpc"): @@ -7032,7 +7066,7 @@ def test_list_vpn_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( @@ -7085,12 +7119,13 @@ def test_list_vpn_connections_non_empty_request_with_auto_populated_field(): client.list_vpn_connections(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListVpnConnectionsRequest( + request_msg = service.ListVpnConnectionsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_vpn_connections_use_cached_wrapped_rpc(): @@ -7175,8 +7210,15 @@ async def test_list_vpn_connections_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.ListVpnConnectionsRequest(), + {}, + ], +) async def test_list_vpn_connections_async( - transport: str = "grpc_asyncio", request_type=service.ListVpnConnectionsRequest + request_type, transport: str = "grpc_asyncio" ): client = EdgeContainerAsyncClient( credentials=async_anonymous_credentials(), @@ -7185,7 +7227,7 @@ async def test_list_vpn_connections_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( @@ -7212,11 +7254,6 @@ async def test_list_vpn_connections_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_vpn_connections_async_from_dict(): - await test_list_vpn_connections_async(request_type=dict) - - def test_list_vpn_connections_field_headers(): client = EdgeContainerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7569,8 +7606,8 @@ async def test_list_vpn_connections_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetVpnConnectionRequest, - dict, + service.GetVpnConnectionRequest(), + {}, ], ) def test_get_vpn_connection(request_type, transport: str = "grpc"): @@ -7581,7 +7618,7 @@ def test_get_vpn_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( @@ -7641,9 +7678,10 @@ def test_get_vpn_connection_non_empty_request_with_auto_populated_field(): client.get_vpn_connection(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetVpnConnectionRequest( + request_msg = service.GetVpnConnectionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_vpn_connection_use_cached_wrapped_rpc(): @@ -7728,9 +7766,14 @@ async def test_get_vpn_connection_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_vpn_connection_async( - transport: str = "grpc_asyncio", request_type=service.GetVpnConnectionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetVpnConnectionRequest(), + {}, + ], +) +async def test_get_vpn_connection_async(request_type, transport: str = "grpc_asyncio"): client = EdgeContainerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7738,7 +7781,7 @@ async def test_get_vpn_connection_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( @@ -7775,11 +7818,6 @@ async def test_get_vpn_connection_async( assert response.router == "router_value" -@pytest.mark.asyncio -async def test_get_vpn_connection_async_from_dict(): - await test_get_vpn_connection_async(request_type=dict) - - def test_get_vpn_connection_field_headers(): client = EdgeContainerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7934,8 +7972,8 @@ async def test_get_vpn_connection_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.CreateVpnConnectionRequest, - dict, + service.CreateVpnConnectionRequest(), + {}, ], ) def test_create_vpn_connection(request_type, transport: str = "grpc"): @@ -7946,7 +7984,7 @@ def test_create_vpn_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( @@ -7993,11 +8031,12 @@ def test_create_vpn_connection_non_empty_request_with_auto_populated_field(): client.create_vpn_connection(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateVpnConnectionRequest( + request_msg = service.CreateVpnConnectionRequest( parent="parent_value", vpn_connection_id="vpn_connection_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_vpn_connection_use_cached_wrapped_rpc(): @@ -8093,8 +8132,15 @@ async def test_create_vpn_connection_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.CreateVpnConnectionRequest(), + {}, + ], +) async def test_create_vpn_connection_async( - transport: str = "grpc_asyncio", request_type=service.CreateVpnConnectionRequest + request_type, transport: str = "grpc_asyncio" ): client = EdgeContainerAsyncClient( credentials=async_anonymous_credentials(), @@ -8103,7 +8149,7 @@ async def test_create_vpn_connection_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( @@ -8125,11 +8171,6 @@ async def test_create_vpn_connection_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_vpn_connection_async_from_dict(): - await test_create_vpn_connection_async(request_type=dict) - - def test_create_vpn_connection_field_headers(): client = EdgeContainerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8304,8 +8345,8 @@ async def test_create_vpn_connection_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DeleteVpnConnectionRequest, - dict, + service.DeleteVpnConnectionRequest(), + {}, ], ) def test_delete_vpn_connection(request_type, transport: str = "grpc"): @@ -8316,7 +8357,7 @@ def test_delete_vpn_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( @@ -8362,10 +8403,11 @@ def test_delete_vpn_connection_non_empty_request_with_auto_populated_field(): client.delete_vpn_connection(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteVpnConnectionRequest( + request_msg = service.DeleteVpnConnectionRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_vpn_connection_use_cached_wrapped_rpc(): @@ -8461,8 +8503,15 @@ async def test_delete_vpn_connection_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteVpnConnectionRequest(), + {}, + ], +) async def test_delete_vpn_connection_async( - transport: str = "grpc_asyncio", request_type=service.DeleteVpnConnectionRequest + request_type, transport: str = "grpc_asyncio" ): client = EdgeContainerAsyncClient( credentials=async_anonymous_credentials(), @@ -8471,7 +8520,7 @@ async def test_delete_vpn_connection_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( @@ -8493,11 +8542,6 @@ async def test_delete_vpn_connection_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_vpn_connection_async_from_dict(): - await test_delete_vpn_connection_async(request_type=dict) - - def test_delete_vpn_connection_field_headers(): client = EdgeContainerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8652,8 +8696,8 @@ async def test_delete_vpn_connection_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.GetServerConfigRequest, - dict, + service.GetServerConfigRequest(), + {}, ], ) def test_get_server_config(request_type, transport: str = "grpc"): @@ -8664,7 +8708,7 @@ def test_get_server_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( @@ -8712,9 +8756,10 @@ def test_get_server_config_non_empty_request_with_auto_populated_field(): client.get_server_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetServerConfigRequest( + request_msg = service.GetServerConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_server_config_use_cached_wrapped_rpc(): @@ -8797,9 +8842,14 @@ async def test_get_server_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_server_config_async( - transport: str = "grpc_asyncio", request_type=service.GetServerConfigRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetServerConfigRequest(), + {}, + ], +) +async def test_get_server_config_async(request_type, transport: str = "grpc_asyncio"): client = EdgeContainerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8807,7 +8857,7 @@ async def test_get_server_config_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( @@ -8832,11 +8882,6 @@ async def test_get_server_config_async( assert response.default_version == "default_version_value" -@pytest.mark.asyncio -async def test_get_server_config_async_from_dict(): - await test_get_server_config_async(request_type=dict) - - def test_get_server_config_field_headers(): client = EdgeContainerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13005,7 +13050,6 @@ def test_list_clusters_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListClustersRequest() - assert args[0] == request_msg @@ -13026,7 +13070,6 @@ def test_get_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetClusterRequest() - assert args[0] == request_msg @@ -13047,7 +13090,6 @@ def test_create_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateClusterRequest() - assert args[0] == request_msg @@ -13068,7 +13110,6 @@ def test_update_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateClusterRequest() - assert args[0] == request_msg @@ -13089,7 +13130,6 @@ def test_upgrade_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpgradeClusterRequest() - assert args[0] == request_msg @@ -13110,7 +13150,6 @@ def test_delete_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteClusterRequest() - assert args[0] == request_msg @@ -13133,7 +13172,6 @@ def test_generate_access_token_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GenerateAccessTokenRequest() - assert args[0] == request_msg @@ -13156,7 +13194,6 @@ def test_generate_offline_credential_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GenerateOfflineCredentialRequest() - assert args[0] == request_msg @@ -13177,7 +13214,6 @@ def test_list_node_pools_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListNodePoolsRequest() - assert args[0] == request_msg @@ -13198,7 +13234,6 @@ def test_get_node_pool_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetNodePoolRequest() - assert args[0] == request_msg @@ -13219,7 +13254,6 @@ def test_create_node_pool_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateNodePoolRequest() - assert args[0] == request_msg @@ -13240,7 +13274,6 @@ def test_update_node_pool_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateNodePoolRequest() - assert args[0] == request_msg @@ -13261,7 +13294,6 @@ def test_delete_node_pool_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteNodePoolRequest() - assert args[0] == request_msg @@ -13282,7 +13314,6 @@ def test_list_machines_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListMachinesRequest() - assert args[0] == request_msg @@ -13303,7 +13334,6 @@ def test_get_machine_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetMachineRequest() - assert args[0] == request_msg @@ -13326,7 +13356,6 @@ def test_list_vpn_connections_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListVpnConnectionsRequest() - assert args[0] == request_msg @@ -13349,7 +13378,6 @@ def test_get_vpn_connection_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetVpnConnectionRequest() - assert args[0] == request_msg @@ -13372,7 +13400,6 @@ def test_create_vpn_connection_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateVpnConnectionRequest() - assert args[0] == request_msg @@ -13395,7 +13422,6 @@ def test_delete_vpn_connection_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteVpnConnectionRequest() - assert args[0] == request_msg @@ -13418,7 +13444,6 @@ def test_get_server_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetServerConfigRequest() - assert args[0] == request_msg @@ -13460,7 +13485,6 @@ async def test_list_clusters_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListClustersRequest() - assert args[0] == request_msg @@ -13502,7 +13526,6 @@ async def test_get_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetClusterRequest() - assert args[0] == request_msg @@ -13527,7 +13550,6 @@ async def test_create_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateClusterRequest() - assert args[0] == request_msg @@ -13552,7 +13574,6 @@ async def test_update_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateClusterRequest() - assert args[0] == request_msg @@ -13577,7 +13598,6 @@ async def test_upgrade_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpgradeClusterRequest() - assert args[0] == request_msg @@ -13602,7 +13622,6 @@ async def test_delete_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteClusterRequest() - assert args[0] == request_msg @@ -13631,7 +13650,6 @@ async def test_generate_access_token_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GenerateAccessTokenRequest() - assert args[0] == request_msg @@ -13662,7 +13680,6 @@ async def test_generate_offline_credential_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GenerateOfflineCredentialRequest() - assert args[0] == request_msg @@ -13690,7 +13707,6 @@ async def test_list_node_pools_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListNodePoolsRequest() - assert args[0] == request_msg @@ -13721,7 +13737,6 @@ async def test_get_node_pool_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetNodePoolRequest() - assert args[0] == request_msg @@ -13746,7 +13761,6 @@ async def test_create_node_pool_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateNodePoolRequest() - assert args[0] == request_msg @@ -13771,7 +13785,6 @@ async def test_update_node_pool_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateNodePoolRequest() - assert args[0] == request_msg @@ -13796,7 +13809,6 @@ async def test_delete_node_pool_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteNodePoolRequest() - assert args[0] == request_msg @@ -13824,7 +13836,6 @@ async def test_list_machines_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListMachinesRequest() - assert args[0] == request_msg @@ -13855,7 +13866,6 @@ async def test_get_machine_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetMachineRequest() - assert args[0] == request_msg @@ -13885,7 +13895,6 @@ async def test_list_vpn_connections_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListVpnConnectionsRequest() - assert args[0] == request_msg @@ -13920,7 +13929,6 @@ async def test_get_vpn_connection_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetVpnConnectionRequest() - assert args[0] == request_msg @@ -13947,7 +13955,6 @@ async def test_create_vpn_connection_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateVpnConnectionRequest() - assert args[0] == request_msg @@ -13974,7 +13981,6 @@ async def test_delete_vpn_connection_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteVpnConnectionRequest() - assert args[0] == request_msg @@ -14003,7 +14009,6 @@ async def test_get_server_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetServerConfigRequest() - assert args[0] == request_msg @@ -17629,7 +17634,6 @@ def test_list_clusters_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListClustersRequest() - assert args[0] == request_msg @@ -17649,7 +17653,6 @@ def test_get_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetClusterRequest() - assert args[0] == request_msg @@ -17669,7 +17672,6 @@ def test_create_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateClusterRequest() - assert args[0] == request_msg @@ -17689,7 +17691,6 @@ def test_update_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateClusterRequest() - assert args[0] == request_msg @@ -17709,7 +17710,6 @@ def test_upgrade_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpgradeClusterRequest() - assert args[0] == request_msg @@ -17729,7 +17729,6 @@ def test_delete_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteClusterRequest() - assert args[0] == request_msg @@ -17751,7 +17750,6 @@ def test_generate_access_token_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GenerateAccessTokenRequest() - assert args[0] == request_msg @@ -17773,7 +17771,6 @@ def test_generate_offline_credential_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GenerateOfflineCredentialRequest() - assert args[0] == request_msg @@ -17793,7 +17790,6 @@ def test_list_node_pools_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListNodePoolsRequest() - assert args[0] == request_msg @@ -17813,7 +17809,6 @@ def test_get_node_pool_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetNodePoolRequest() - assert args[0] == request_msg @@ -17833,7 +17828,6 @@ def test_create_node_pool_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateNodePoolRequest() - assert args[0] == request_msg @@ -17853,7 +17847,6 @@ def test_update_node_pool_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateNodePoolRequest() - assert args[0] == request_msg @@ -17873,7 +17866,6 @@ def test_delete_node_pool_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteNodePoolRequest() - assert args[0] == request_msg @@ -17893,7 +17885,6 @@ def test_list_machines_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListMachinesRequest() - assert args[0] == request_msg @@ -17913,7 +17904,6 @@ def test_get_machine_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetMachineRequest() - assert args[0] == request_msg @@ -17935,7 +17925,6 @@ def test_list_vpn_connections_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListVpnConnectionsRequest() - assert args[0] == request_msg @@ -17957,7 +17946,6 @@ def test_get_vpn_connection_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetVpnConnectionRequest() - assert args[0] == request_msg @@ -17979,7 +17967,6 @@ def test_create_vpn_connection_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateVpnConnectionRequest() - assert args[0] == request_msg @@ -18001,7 +17988,6 @@ def test_delete_vpn_connection_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteVpnConnectionRequest() - assert args[0] == request_msg @@ -18023,7 +18009,6 @@ def test_get_server_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetServerConfigRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-edgenetwork/noxfile.py b/packages/google-cloud-edgenetwork/noxfile.py index a47cefc0c73d..52259b092b2c 100644 --- a/packages/google-cloud-edgenetwork/noxfile.py +++ b/packages/google-cloud-edgenetwork/noxfile.py @@ -47,7 +47,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-edgenetwork" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-edgenetwork/setup.py b/packages/google-cloud-edgenetwork/setup.py index 37c95d17a4b9..85e448469a8c 100644 --- a/packages/google-cloud-edgenetwork/setup.py +++ b/packages/google-cloud-edgenetwork/setup.py @@ -45,7 +45,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/google-cloud-edgenetwork/testing/constraints-3.10.txt b/packages/google-cloud-edgenetwork/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-edgenetwork/testing/constraints-3.10.txt +++ b/packages/google-cloud-edgenetwork/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-edgenetwork/tests/unit/gapic/edgenetwork_v1/test_edge_network.py b/packages/google-cloud-edgenetwork/tests/unit/gapic/edgenetwork_v1/test_edge_network.py index b1a71517a129..0651212f78b6 100644 --- a/packages/google-cloud-edgenetwork/tests/unit/gapic/edgenetwork_v1/test_edge_network.py +++ b/packages/google-cloud-edgenetwork/tests/unit/gapic/edgenetwork_v1/test_edge_network.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 @@ -116,6 +117,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" @@ -1281,8 +1297,8 @@ def test_edge_network_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - service.InitializeZoneRequest, - dict, + service.InitializeZoneRequest(), + {}, ], ) def test_initialize_zone(request_type, transport: str = "grpc"): @@ -1293,7 +1309,7 @@ def test_initialize_zone(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.initialize_zone), "__call__") as call: @@ -1334,9 +1350,10 @@ def test_initialize_zone_non_empty_request_with_auto_populated_field(): client.initialize_zone(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.InitializeZoneRequest( + request_msg = service.InitializeZoneRequest( name="name_value", ) + assert args[0] == request_msg def test_initialize_zone_use_cached_wrapped_rpc(): @@ -1417,9 +1434,14 @@ async def test_initialize_zone_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_initialize_zone_async( - transport: str = "grpc_asyncio", request_type=service.InitializeZoneRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.InitializeZoneRequest(), + {}, + ], +) +async def test_initialize_zone_async(request_type, transport: str = "grpc_asyncio"): client = EdgeNetworkAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1427,7 +1449,7 @@ async def test_initialize_zone_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.initialize_zone), "__call__") as call: @@ -1447,11 +1469,6 @@ async def test_initialize_zone_async( assert isinstance(response, service.InitializeZoneResponse) -@pytest.mark.asyncio -async def test_initialize_zone_async_from_dict(): - await test_initialize_zone_async(request_type=dict) - - def test_initialize_zone_field_headers(): client = EdgeNetworkClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1598,8 +1615,8 @@ async def test_initialize_zone_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListZonesRequest, - dict, + service.ListZonesRequest(), + {}, ], ) def test_list_zones(request_type, transport: str = "grpc"): @@ -1610,7 +1627,7 @@ def test_list_zones(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_zones), "__call__") as call: @@ -1659,12 +1676,13 @@ def test_list_zones_non_empty_request_with_auto_populated_field(): client.list_zones(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListZonesRequest( + request_msg = service.ListZonesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_zones_use_cached_wrapped_rpc(): @@ -1743,9 +1761,14 @@ async def test_list_zones_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_list_zones_async( - transport: str = "grpc_asyncio", request_type=service.ListZonesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListZonesRequest(), + {}, + ], +) +async def test_list_zones_async(request_type, transport: str = "grpc_asyncio"): client = EdgeNetworkAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1753,7 +1776,7 @@ async def test_list_zones_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_zones), "__call__") as call: @@ -1778,11 +1801,6 @@ async def test_list_zones_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_zones_async_from_dict(): - await test_list_zones_async(request_type=dict) - - def test_list_zones_field_headers(): client = EdgeNetworkClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2119,8 +2137,8 @@ async def test_list_zones_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetZoneRequest, - dict, + service.GetZoneRequest(), + {}, ], ) def test_get_zone(request_type, transport: str = "grpc"): @@ -2131,7 +2149,7 @@ def test_get_zone(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_zone), "__call__") as call: @@ -2177,9 +2195,10 @@ def test_get_zone_non_empty_request_with_auto_populated_field(): client.get_zone(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetZoneRequest( + request_msg = service.GetZoneRequest( name="name_value", ) + assert args[0] == request_msg def test_get_zone_use_cached_wrapped_rpc(): @@ -2258,9 +2277,14 @@ async def test_get_zone_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn @pytest.mark.asyncio -async def test_get_zone_async( - transport: str = "grpc_asyncio", request_type=service.GetZoneRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetZoneRequest(), + {}, + ], +) +async def test_get_zone_async(request_type, transport: str = "grpc_asyncio"): client = EdgeNetworkAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2268,7 +2292,7 @@ async def test_get_zone_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_zone), "__call__") as call: @@ -2293,11 +2317,6 @@ async def test_get_zone_async( assert response.layout_name == "layout_name_value" -@pytest.mark.asyncio -async def test_get_zone_async_from_dict(): - await test_get_zone_async(request_type=dict) - - def test_get_zone_field_headers(): client = EdgeNetworkClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2440,8 +2459,8 @@ async def test_get_zone_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListNetworksRequest, - dict, + service.ListNetworksRequest(), + {}, ], ) def test_list_networks(request_type, transport: str = "grpc"): @@ -2452,7 +2471,7 @@ def test_list_networks(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_networks), "__call__") as call: @@ -2501,12 +2520,13 @@ def test_list_networks_non_empty_request_with_auto_populated_field(): client.list_networks(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListNetworksRequest( + request_msg = service.ListNetworksRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_networks_use_cached_wrapped_rpc(): @@ -2587,9 +2607,14 @@ async def test_list_networks_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_networks_async( - transport: str = "grpc_asyncio", request_type=service.ListNetworksRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListNetworksRequest(), + {}, + ], +) +async def test_list_networks_async(request_type, transport: str = "grpc_asyncio"): client = EdgeNetworkAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2597,7 +2622,7 @@ async def test_list_networks_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_networks), "__call__") as call: @@ -2622,11 +2647,6 @@ async def test_list_networks_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_networks_async_from_dict(): - await test_list_networks_async(request_type=dict) - - def test_list_networks_field_headers(): client = EdgeNetworkClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2963,8 +2983,8 @@ async def test_list_networks_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetNetworkRequest, - dict, + service.GetNetworkRequest(), + {}, ], ) def test_get_network(request_type, transport: str = "grpc"): @@ -2975,7 +2995,7 @@ def test_get_network(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_network), "__call__") as call: @@ -3023,9 +3043,10 @@ def test_get_network_non_empty_request_with_auto_populated_field(): client.get_network(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetNetworkRequest( + request_msg = service.GetNetworkRequest( name="name_value", ) + assert args[0] == request_msg def test_get_network_use_cached_wrapped_rpc(): @@ -3106,9 +3127,14 @@ async def test_get_network_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_network_async( - transport: str = "grpc_asyncio", request_type=service.GetNetworkRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetNetworkRequest(), + {}, + ], +) +async def test_get_network_async(request_type, transport: str = "grpc_asyncio"): client = EdgeNetworkAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3116,7 +3142,7 @@ async def test_get_network_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_network), "__call__") as call: @@ -3143,11 +3169,6 @@ async def test_get_network_async( assert response.mtu == 342 -@pytest.mark.asyncio -async def test_get_network_async_from_dict(): - await test_get_network_async(request_type=dict) - - def test_get_network_field_headers(): client = EdgeNetworkClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3290,8 +3311,8 @@ async def test_get_network_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DiagnoseNetworkRequest, - dict, + service.DiagnoseNetworkRequest(), + {}, ], ) def test_diagnose_network(request_type, transport: str = "grpc"): @@ -3302,7 +3323,7 @@ def test_diagnose_network(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.diagnose_network), "__call__") as call: @@ -3343,9 +3364,10 @@ def test_diagnose_network_non_empty_request_with_auto_populated_field(): client.diagnose_network(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DiagnoseNetworkRequest( + request_msg = service.DiagnoseNetworkRequest( name="name_value", ) + assert args[0] == request_msg def test_diagnose_network_use_cached_wrapped_rpc(): @@ -3428,9 +3450,14 @@ async def test_diagnose_network_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_diagnose_network_async( - transport: str = "grpc_asyncio", request_type=service.DiagnoseNetworkRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.DiagnoseNetworkRequest(), + {}, + ], +) +async def test_diagnose_network_async(request_type, transport: str = "grpc_asyncio"): client = EdgeNetworkAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3438,7 +3465,7 @@ async def test_diagnose_network_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.diagnose_network), "__call__") as call: @@ -3458,11 +3485,6 @@ async def test_diagnose_network_async( assert isinstance(response, service.DiagnoseNetworkResponse) -@pytest.mark.asyncio -async def test_diagnose_network_async_from_dict(): - await test_diagnose_network_async(request_type=dict) - - def test_diagnose_network_field_headers(): client = EdgeNetworkClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3609,8 +3631,8 @@ async def test_diagnose_network_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.CreateNetworkRequest, - dict, + service.CreateNetworkRequest(), + {}, ], ) def test_create_network(request_type, transport: str = "grpc"): @@ -3621,7 +3643,7 @@ def test_create_network(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_network), "__call__") as call: @@ -3664,11 +3686,12 @@ def test_create_network_non_empty_request_with_auto_populated_field(): client.create_network(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateNetworkRequest( + request_msg = service.CreateNetworkRequest( parent="parent_value", network_id="network_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_network_use_cached_wrapped_rpc(): @@ -3759,9 +3782,14 @@ async def test_create_network_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_network_async( - transport: str = "grpc_asyncio", request_type=service.CreateNetworkRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CreateNetworkRequest(), + {}, + ], +) +async def test_create_network_async(request_type, transport: str = "grpc_asyncio"): client = EdgeNetworkAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3769,7 +3797,7 @@ async def test_create_network_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_network), "__call__") as call: @@ -3789,11 +3817,6 @@ async def test_create_network_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_network_async_from_dict(): - await test_create_network_async(request_type=dict) - - def test_create_network_field_headers(): client = EdgeNetworkClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3960,8 +3983,8 @@ async def test_create_network_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DeleteNetworkRequest, - dict, + service.DeleteNetworkRequest(), + {}, ], ) def test_delete_network(request_type, transport: str = "grpc"): @@ -3972,7 +3995,7 @@ def test_delete_network(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_network), "__call__") as call: @@ -4014,10 +4037,11 @@ def test_delete_network_non_empty_request_with_auto_populated_field(): client.delete_network(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteNetworkRequest( + request_msg = service.DeleteNetworkRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_network_use_cached_wrapped_rpc(): @@ -4108,9 +4132,14 @@ async def test_delete_network_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_network_async( - transport: str = "grpc_asyncio", request_type=service.DeleteNetworkRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteNetworkRequest(), + {}, + ], +) +async def test_delete_network_async(request_type, transport: str = "grpc_asyncio"): client = EdgeNetworkAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4118,7 +4147,7 @@ async def test_delete_network_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_network), "__call__") as call: @@ -4138,11 +4167,6 @@ async def test_delete_network_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_network_async_from_dict(): - await test_delete_network_async(request_type=dict) - - def test_delete_network_field_headers(): client = EdgeNetworkClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4289,8 +4313,8 @@ async def test_delete_network_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListSubnetsRequest, - dict, + service.ListSubnetsRequest(), + {}, ], ) def test_list_subnets(request_type, transport: str = "grpc"): @@ -4301,7 +4325,7 @@ def test_list_subnets(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_subnets), "__call__") as call: @@ -4350,12 +4374,13 @@ def test_list_subnets_non_empty_request_with_auto_populated_field(): client.list_subnets(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListSubnetsRequest( + request_msg = service.ListSubnetsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_subnets_use_cached_wrapped_rpc(): @@ -4436,9 +4461,14 @@ async def test_list_subnets_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_subnets_async( - transport: str = "grpc_asyncio", request_type=service.ListSubnetsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListSubnetsRequest(), + {}, + ], +) +async def test_list_subnets_async(request_type, transport: str = "grpc_asyncio"): client = EdgeNetworkAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4446,7 +4476,7 @@ async def test_list_subnets_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_subnets), "__call__") as call: @@ -4471,11 +4501,6 @@ async def test_list_subnets_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_subnets_async_from_dict(): - await test_list_subnets_async(request_type=dict) - - def test_list_subnets_field_headers(): client = EdgeNetworkClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4812,8 +4837,8 @@ async def test_list_subnets_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetSubnetRequest, - dict, + service.GetSubnetRequest(), + {}, ], ) def test_get_subnet(request_type, transport: str = "grpc"): @@ -4824,7 +4849,7 @@ def test_get_subnet(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_subnet), "__call__") as call: @@ -4882,9 +4907,10 @@ def test_get_subnet_non_empty_request_with_auto_populated_field(): client.get_subnet(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetSubnetRequest( + request_msg = service.GetSubnetRequest( name="name_value", ) + assert args[0] == request_msg def test_get_subnet_use_cached_wrapped_rpc(): @@ -4963,9 +4989,14 @@ async def test_get_subnet_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_subnet_async( - transport: str = "grpc_asyncio", request_type=service.GetSubnetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetSubnetRequest(), + {}, + ], +) +async def test_get_subnet_async(request_type, transport: str = "grpc_asyncio"): client = EdgeNetworkAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4973,7 +5004,7 @@ async def test_get_subnet_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_subnet), "__call__") as call: @@ -5010,11 +5041,6 @@ async def test_get_subnet_async( assert response.state == resources.ResourceState.STATE_PENDING -@pytest.mark.asyncio -async def test_get_subnet_async_from_dict(): - await test_get_subnet_async(request_type=dict) - - def test_get_subnet_field_headers(): client = EdgeNetworkClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5157,8 +5183,8 @@ async def test_get_subnet_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.CreateSubnetRequest, - dict, + service.CreateSubnetRequest(), + {}, ], ) def test_create_subnet(request_type, transport: str = "grpc"): @@ -5169,7 +5195,7 @@ def test_create_subnet(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_subnet), "__call__") as call: @@ -5212,11 +5238,12 @@ def test_create_subnet_non_empty_request_with_auto_populated_field(): client.create_subnet(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateSubnetRequest( + request_msg = service.CreateSubnetRequest( parent="parent_value", subnet_id="subnet_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_subnet_use_cached_wrapped_rpc(): @@ -5307,9 +5334,14 @@ async def test_create_subnet_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_subnet_async( - transport: str = "grpc_asyncio", request_type=service.CreateSubnetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CreateSubnetRequest(), + {}, + ], +) +async def test_create_subnet_async(request_type, transport: str = "grpc_asyncio"): client = EdgeNetworkAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5317,7 +5349,7 @@ async def test_create_subnet_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_subnet), "__call__") as call: @@ -5337,11 +5369,6 @@ async def test_create_subnet_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_subnet_async_from_dict(): - await test_create_subnet_async(request_type=dict) - - def test_create_subnet_field_headers(): client = EdgeNetworkClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5508,8 +5535,8 @@ async def test_create_subnet_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdateSubnetRequest, - dict, + service.UpdateSubnetRequest(), + {}, ], ) def test_update_subnet(request_type, transport: str = "grpc"): @@ -5520,7 +5547,7 @@ def test_update_subnet(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_subnet), "__call__") as call: @@ -5561,9 +5588,10 @@ def test_update_subnet_non_empty_request_with_auto_populated_field(): client.update_subnet(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateSubnetRequest( + request_msg = service.UpdateSubnetRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_subnet_use_cached_wrapped_rpc(): @@ -5654,9 +5682,14 @@ async def test_update_subnet_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_subnet_async( - transport: str = "grpc_asyncio", request_type=service.UpdateSubnetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateSubnetRequest(), + {}, + ], +) +async def test_update_subnet_async(request_type, transport: str = "grpc_asyncio"): client = EdgeNetworkAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5664,7 +5697,7 @@ async def test_update_subnet_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_subnet), "__call__") as call: @@ -5684,11 +5717,6 @@ async def test_update_subnet_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_subnet_async_from_dict(): - await test_update_subnet_async(request_type=dict) - - def test_update_subnet_field_headers(): client = EdgeNetworkClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5845,8 +5873,8 @@ async def test_update_subnet_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DeleteSubnetRequest, - dict, + service.DeleteSubnetRequest(), + {}, ], ) def test_delete_subnet(request_type, transport: str = "grpc"): @@ -5857,7 +5885,7 @@ def test_delete_subnet(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_subnet), "__call__") as call: @@ -5899,10 +5927,11 @@ def test_delete_subnet_non_empty_request_with_auto_populated_field(): client.delete_subnet(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteSubnetRequest( + request_msg = service.DeleteSubnetRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_subnet_use_cached_wrapped_rpc(): @@ -5993,9 +6022,14 @@ async def test_delete_subnet_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_subnet_async( - transport: str = "grpc_asyncio", request_type=service.DeleteSubnetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteSubnetRequest(), + {}, + ], +) +async def test_delete_subnet_async(request_type, transport: str = "grpc_asyncio"): client = EdgeNetworkAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6003,7 +6037,7 @@ async def test_delete_subnet_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_subnet), "__call__") as call: @@ -6023,11 +6057,6 @@ async def test_delete_subnet_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_subnet_async_from_dict(): - await test_delete_subnet_async(request_type=dict) - - def test_delete_subnet_field_headers(): client = EdgeNetworkClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6174,8 +6203,8 @@ async def test_delete_subnet_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListInterconnectsRequest, - dict, + service.ListInterconnectsRequest(), + {}, ], ) def test_list_interconnects(request_type, transport: str = "grpc"): @@ -6186,7 +6215,7 @@ def test_list_interconnects(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6239,12 +6268,13 @@ def test_list_interconnects_non_empty_request_with_auto_populated_field(): client.list_interconnects(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListInterconnectsRequest( + request_msg = service.ListInterconnectsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_interconnects_use_cached_wrapped_rpc(): @@ -6329,9 +6359,14 @@ async def test_list_interconnects_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_interconnects_async( - transport: str = "grpc_asyncio", request_type=service.ListInterconnectsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListInterconnectsRequest(), + {}, + ], +) +async def test_list_interconnects_async(request_type, transport: str = "grpc_asyncio"): client = EdgeNetworkAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6339,7 +6374,7 @@ async def test_list_interconnects_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( @@ -6366,11 +6401,6 @@ async def test_list_interconnects_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_interconnects_async_from_dict(): - await test_list_interconnects_async(request_type=dict) - - def test_list_interconnects_field_headers(): client = EdgeNetworkClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6723,8 +6753,8 @@ async def test_list_interconnects_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetInterconnectRequest, - dict, + service.GetInterconnectRequest(), + {}, ], ) def test_get_interconnect(request_type, transport: str = "grpc"): @@ -6735,7 +6765,7 @@ def test_get_interconnect(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_interconnect), "__call__") as call: @@ -6796,9 +6826,10 @@ def test_get_interconnect_non_empty_request_with_auto_populated_field(): client.get_interconnect(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetInterconnectRequest( + request_msg = service.GetInterconnectRequest( name="name_value", ) + assert args[0] == request_msg def test_get_interconnect_use_cached_wrapped_rpc(): @@ -6881,9 +6912,14 @@ async def test_get_interconnect_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_interconnect_async( - transport: str = "grpc_asyncio", request_type=service.GetInterconnectRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetInterconnectRequest(), + {}, + ], +) +async def test_get_interconnect_async(request_type, transport: str = "grpc_asyncio"): client = EdgeNetworkAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6891,7 +6927,7 @@ async def test_get_interconnect_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_interconnect), "__call__") as call: @@ -6931,11 +6967,6 @@ async def test_get_interconnect_async( ) -@pytest.mark.asyncio -async def test_get_interconnect_async_from_dict(): - await test_get_interconnect_async(request_type=dict) - - def test_get_interconnect_field_headers(): client = EdgeNetworkClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7082,8 +7113,8 @@ async def test_get_interconnect_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DiagnoseInterconnectRequest, - dict, + service.DiagnoseInterconnectRequest(), + {}, ], ) def test_diagnose_interconnect(request_type, transport: str = "grpc"): @@ -7094,7 +7125,7 @@ def test_diagnose_interconnect(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7139,9 +7170,10 @@ def test_diagnose_interconnect_non_empty_request_with_auto_populated_field(): client.diagnose_interconnect(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DiagnoseInterconnectRequest( + request_msg = service.DiagnoseInterconnectRequest( name="name_value", ) + assert args[0] == request_msg def test_diagnose_interconnect_use_cached_wrapped_rpc(): @@ -7227,8 +7259,15 @@ async def test_diagnose_interconnect_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.DiagnoseInterconnectRequest(), + {}, + ], +) async def test_diagnose_interconnect_async( - transport: str = "grpc_asyncio", request_type=service.DiagnoseInterconnectRequest + request_type, transport: str = "grpc_asyncio" ): client = EdgeNetworkAsyncClient( credentials=async_anonymous_credentials(), @@ -7237,7 +7276,7 @@ async def test_diagnose_interconnect_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( @@ -7259,11 +7298,6 @@ async def test_diagnose_interconnect_async( assert isinstance(response, service.DiagnoseInterconnectResponse) -@pytest.mark.asyncio -async def test_diagnose_interconnect_async_from_dict(): - await test_diagnose_interconnect_async(request_type=dict) - - def test_diagnose_interconnect_field_headers(): client = EdgeNetworkClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7418,8 +7452,8 @@ async def test_diagnose_interconnect_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListInterconnectAttachmentsRequest, - dict, + service.ListInterconnectAttachmentsRequest(), + {}, ], ) def test_list_interconnect_attachments(request_type, transport: str = "grpc"): @@ -7430,7 +7464,7 @@ def test_list_interconnect_attachments(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7483,12 +7517,13 @@ def test_list_interconnect_attachments_non_empty_request_with_auto_populated_fie client.list_interconnect_attachments(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListInterconnectAttachmentsRequest( + request_msg = service.ListInterconnectAttachmentsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_interconnect_attachments_use_cached_wrapped_rpc(): @@ -7574,9 +7609,15 @@ async def test_list_interconnect_attachments_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.ListInterconnectAttachmentsRequest(), + {}, + ], +) async def test_list_interconnect_attachments_async( - transport: str = "grpc_asyncio", - request_type=service.ListInterconnectAttachmentsRequest, + request_type, transport: str = "grpc_asyncio" ): client = EdgeNetworkAsyncClient( credentials=async_anonymous_credentials(), @@ -7585,7 +7626,7 @@ async def test_list_interconnect_attachments_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( @@ -7612,11 +7653,6 @@ async def test_list_interconnect_attachments_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_interconnect_attachments_async_from_dict(): - await test_list_interconnect_attachments_async(request_type=dict) - - def test_list_interconnect_attachments_field_headers(): client = EdgeNetworkClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7973,8 +8009,8 @@ async def test_list_interconnect_attachments_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetInterconnectAttachmentRequest, - dict, + service.GetInterconnectAttachmentRequest(), + {}, ], ) def test_get_interconnect_attachment(request_type, transport: str = "grpc"): @@ -7985,7 +8021,7 @@ def test_get_interconnect_attachment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,9 +8086,10 @@ def test_get_interconnect_attachment_non_empty_request_with_auto_populated_field client.get_interconnect_attachment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetInterconnectAttachmentRequest( + request_msg = service.GetInterconnectAttachmentRequest( name="name_value", ) + assert args[0] == request_msg def test_get_interconnect_attachment_use_cached_wrapped_rpc(): @@ -8138,9 +8175,15 @@ async def test_get_interconnect_attachment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.GetInterconnectAttachmentRequest(), + {}, + ], +) async def test_get_interconnect_attachment_async( - transport: str = "grpc_asyncio", - request_type=service.GetInterconnectAttachmentRequest, + request_type, transport: str = "grpc_asyncio" ): client = EdgeNetworkAsyncClient( credentials=async_anonymous_credentials(), @@ -8149,7 +8192,7 @@ async def test_get_interconnect_attachment_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( @@ -8191,11 +8234,6 @@ async def test_get_interconnect_attachment_async( ) -@pytest.mark.asyncio -async def test_get_interconnect_attachment_async_from_dict(): - await test_get_interconnect_attachment_async(request_type=dict) - - def test_get_interconnect_attachment_field_headers(): client = EdgeNetworkClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8350,8 +8388,8 @@ async def test_get_interconnect_attachment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.CreateInterconnectAttachmentRequest, - dict, + service.CreateInterconnectAttachmentRequest(), + {}, ], ) def test_create_interconnect_attachment(request_type, transport: str = "grpc"): @@ -8362,7 +8400,7 @@ def test_create_interconnect_attachment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8409,11 +8447,12 @@ def test_create_interconnect_attachment_non_empty_request_with_auto_populated_fi client.create_interconnect_attachment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateInterconnectAttachmentRequest( + request_msg = service.CreateInterconnectAttachmentRequest( parent="parent_value", interconnect_attachment_id="interconnect_attachment_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_interconnect_attachment_use_cached_wrapped_rpc(): @@ -8509,9 +8548,15 @@ async def test_create_interconnect_attachment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.CreateInterconnectAttachmentRequest(), + {}, + ], +) async def test_create_interconnect_attachment_async( - transport: str = "grpc_asyncio", - request_type=service.CreateInterconnectAttachmentRequest, + request_type, transport: str = "grpc_asyncio" ): client = EdgeNetworkAsyncClient( credentials=async_anonymous_credentials(), @@ -8520,7 +8565,7 @@ async def test_create_interconnect_attachment_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( @@ -8542,11 +8587,6 @@ async def test_create_interconnect_attachment_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_interconnect_attachment_async_from_dict(): - await test_create_interconnect_attachment_async(request_type=dict) - - def test_create_interconnect_attachment_field_headers(): client = EdgeNetworkClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8721,8 +8761,8 @@ async def test_create_interconnect_attachment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DeleteInterconnectAttachmentRequest, - dict, + service.DeleteInterconnectAttachmentRequest(), + {}, ], ) def test_delete_interconnect_attachment(request_type, transport: str = "grpc"): @@ -8733,7 +8773,7 @@ def test_delete_interconnect_attachment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,10 +8819,11 @@ def test_delete_interconnect_attachment_non_empty_request_with_auto_populated_fi client.delete_interconnect_attachment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteInterconnectAttachmentRequest( + request_msg = service.DeleteInterconnectAttachmentRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_interconnect_attachment_use_cached_wrapped_rpc(): @@ -8878,9 +8919,15 @@ async def test_delete_interconnect_attachment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteInterconnectAttachmentRequest(), + {}, + ], +) async def test_delete_interconnect_attachment_async( - transport: str = "grpc_asyncio", - request_type=service.DeleteInterconnectAttachmentRequest, + request_type, transport: str = "grpc_asyncio" ): client = EdgeNetworkAsyncClient( credentials=async_anonymous_credentials(), @@ -8889,7 +8936,7 @@ async def test_delete_interconnect_attachment_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( @@ -8911,11 +8958,6 @@ async def test_delete_interconnect_attachment_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_interconnect_attachment_async_from_dict(): - await test_delete_interconnect_attachment_async(request_type=dict) - - def test_delete_interconnect_attachment_field_headers(): client = EdgeNetworkClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9070,8 +9112,8 @@ async def test_delete_interconnect_attachment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListRoutersRequest, - dict, + service.ListRoutersRequest(), + {}, ], ) def test_list_routers(request_type, transport: str = "grpc"): @@ -9082,7 +9124,7 @@ def test_list_routers(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_routers), "__call__") as call: @@ -9131,12 +9173,13 @@ def test_list_routers_non_empty_request_with_auto_populated_field(): client.list_routers(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListRoutersRequest( + request_msg = service.ListRoutersRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_routers_use_cached_wrapped_rpc(): @@ -9217,9 +9260,14 @@ async def test_list_routers_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_routers_async( - transport: str = "grpc_asyncio", request_type=service.ListRoutersRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListRoutersRequest(), + {}, + ], +) +async def test_list_routers_async(request_type, transport: str = "grpc_asyncio"): client = EdgeNetworkAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9227,7 +9275,7 @@ async def test_list_routers_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_routers), "__call__") as call: @@ -9252,11 +9300,6 @@ async def test_list_routers_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_routers_async_from_dict(): - await test_list_routers_async(request_type=dict) - - def test_list_routers_field_headers(): client = EdgeNetworkClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9593,8 +9636,8 @@ async def test_list_routers_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetRouterRequest, - dict, + service.GetRouterRequest(), + {}, ], ) def test_get_router(request_type, transport: str = "grpc"): @@ -9605,7 +9648,7 @@ def test_get_router(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_router), "__call__") as call: @@ -9657,9 +9700,10 @@ def test_get_router_non_empty_request_with_auto_populated_field(): client.get_router(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetRouterRequest( + request_msg = service.GetRouterRequest( name="name_value", ) + assert args[0] == request_msg def test_get_router_use_cached_wrapped_rpc(): @@ -9738,9 +9782,14 @@ async def test_get_router_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_router_async( - transport: str = "grpc_asyncio", request_type=service.GetRouterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetRouterRequest(), + {}, + ], +) +async def test_get_router_async(request_type, transport: str = "grpc_asyncio"): client = EdgeNetworkAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9748,7 +9797,7 @@ async def test_get_router_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_router), "__call__") as call: @@ -9779,11 +9828,6 @@ async def test_get_router_async( assert response.route_advertisements == ["route_advertisements_value"] -@pytest.mark.asyncio -async def test_get_router_async_from_dict(): - await test_get_router_async(request_type=dict) - - def test_get_router_field_headers(): client = EdgeNetworkClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9926,8 +9970,8 @@ async def test_get_router_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DiagnoseRouterRequest, - dict, + service.DiagnoseRouterRequest(), + {}, ], ) def test_diagnose_router(request_type, transport: str = "grpc"): @@ -9938,7 +9982,7 @@ def test_diagnose_router(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.diagnose_router), "__call__") as call: @@ -9979,9 +10023,10 @@ def test_diagnose_router_non_empty_request_with_auto_populated_field(): client.diagnose_router(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DiagnoseRouterRequest( + request_msg = service.DiagnoseRouterRequest( name="name_value", ) + assert args[0] == request_msg def test_diagnose_router_use_cached_wrapped_rpc(): @@ -10062,9 +10107,14 @@ async def test_diagnose_router_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_diagnose_router_async( - transport: str = "grpc_asyncio", request_type=service.DiagnoseRouterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.DiagnoseRouterRequest(), + {}, + ], +) +async def test_diagnose_router_async(request_type, transport: str = "grpc_asyncio"): client = EdgeNetworkAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10072,7 +10122,7 @@ async def test_diagnose_router_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.diagnose_router), "__call__") as call: @@ -10092,11 +10142,6 @@ async def test_diagnose_router_async( assert isinstance(response, service.DiagnoseRouterResponse) -@pytest.mark.asyncio -async def test_diagnose_router_async_from_dict(): - await test_diagnose_router_async(request_type=dict) - - def test_diagnose_router_field_headers(): client = EdgeNetworkClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10243,8 +10288,8 @@ async def test_diagnose_router_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.CreateRouterRequest, - dict, + service.CreateRouterRequest(), + {}, ], ) def test_create_router(request_type, transport: str = "grpc"): @@ -10255,7 +10300,7 @@ def test_create_router(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_router), "__call__") as call: @@ -10298,11 +10343,12 @@ def test_create_router_non_empty_request_with_auto_populated_field(): client.create_router(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateRouterRequest( + request_msg = service.CreateRouterRequest( parent="parent_value", router_id="router_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_router_use_cached_wrapped_rpc(): @@ -10393,9 +10439,14 @@ async def test_create_router_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_router_async( - transport: str = "grpc_asyncio", request_type=service.CreateRouterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CreateRouterRequest(), + {}, + ], +) +async def test_create_router_async(request_type, transport: str = "grpc_asyncio"): client = EdgeNetworkAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10403,7 +10454,7 @@ async def test_create_router_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_router), "__call__") as call: @@ -10423,11 +10474,6 @@ async def test_create_router_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_router_async_from_dict(): - await test_create_router_async(request_type=dict) - - def test_create_router_field_headers(): client = EdgeNetworkClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10594,8 +10640,8 @@ async def test_create_router_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdateRouterRequest, - dict, + service.UpdateRouterRequest(), + {}, ], ) def test_update_router(request_type, transport: str = "grpc"): @@ -10606,7 +10652,7 @@ def test_update_router(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_router), "__call__") as call: @@ -10647,9 +10693,10 @@ def test_update_router_non_empty_request_with_auto_populated_field(): client.update_router(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateRouterRequest( + request_msg = service.UpdateRouterRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_router_use_cached_wrapped_rpc(): @@ -10740,9 +10787,14 @@ async def test_update_router_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_router_async( - transport: str = "grpc_asyncio", request_type=service.UpdateRouterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateRouterRequest(), + {}, + ], +) +async def test_update_router_async(request_type, transport: str = "grpc_asyncio"): client = EdgeNetworkAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10750,7 +10802,7 @@ async def test_update_router_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_router), "__call__") as call: @@ -10770,11 +10822,6 @@ async def test_update_router_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_router_async_from_dict(): - await test_update_router_async(request_type=dict) - - def test_update_router_field_headers(): client = EdgeNetworkClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10931,8 +10978,8 @@ async def test_update_router_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DeleteRouterRequest, - dict, + service.DeleteRouterRequest(), + {}, ], ) def test_delete_router(request_type, transport: str = "grpc"): @@ -10943,7 +10990,7 @@ def test_delete_router(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_router), "__call__") as call: @@ -10985,10 +11032,11 @@ def test_delete_router_non_empty_request_with_auto_populated_field(): client.delete_router(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteRouterRequest( + request_msg = service.DeleteRouterRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_router_use_cached_wrapped_rpc(): @@ -11079,9 +11127,14 @@ async def test_delete_router_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_router_async( - transport: str = "grpc_asyncio", request_type=service.DeleteRouterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteRouterRequest(), + {}, + ], +) +async def test_delete_router_async(request_type, transport: str = "grpc_asyncio"): client = EdgeNetworkAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11089,7 +11142,7 @@ async def test_delete_router_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_router), "__call__") as call: @@ -11109,11 +11162,6 @@ async def test_delete_router_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_router_async_from_dict(): - await test_delete_router_async(request_type=dict) - - def test_delete_router_field_headers(): client = EdgeNetworkClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16724,7 +16772,6 @@ def test_initialize_zone_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.InitializeZoneRequest() - assert args[0] == request_msg @@ -16745,7 +16792,6 @@ def test_list_zones_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListZonesRequest() - assert args[0] == request_msg @@ -16766,7 +16812,6 @@ def test_get_zone_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetZoneRequest() - assert args[0] == request_msg @@ -16787,7 +16832,6 @@ def test_list_networks_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListNetworksRequest() - assert args[0] == request_msg @@ -16808,7 +16852,6 @@ def test_get_network_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetNetworkRequest() - assert args[0] == request_msg @@ -16829,7 +16872,6 @@ def test_diagnose_network_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DiagnoseNetworkRequest() - assert args[0] == request_msg @@ -16850,7 +16892,6 @@ def test_create_network_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateNetworkRequest() - assert args[0] == request_msg @@ -16871,7 +16912,6 @@ def test_delete_network_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteNetworkRequest() - assert args[0] == request_msg @@ -16892,7 +16932,6 @@ def test_list_subnets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListSubnetsRequest() - assert args[0] == request_msg @@ -16913,7 +16952,6 @@ def test_get_subnet_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetSubnetRequest() - assert args[0] == request_msg @@ -16934,7 +16972,6 @@ def test_create_subnet_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateSubnetRequest() - assert args[0] == request_msg @@ -16955,7 +16992,6 @@ def test_update_subnet_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateSubnetRequest() - assert args[0] == request_msg @@ -16976,7 +17012,6 @@ def test_delete_subnet_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteSubnetRequest() - assert args[0] == request_msg @@ -16999,7 +17034,6 @@ def test_list_interconnects_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListInterconnectsRequest() - assert args[0] == request_msg @@ -17020,7 +17054,6 @@ def test_get_interconnect_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetInterconnectRequest() - assert args[0] == request_msg @@ -17043,7 +17076,6 @@ def test_diagnose_interconnect_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DiagnoseInterconnectRequest() - assert args[0] == request_msg @@ -17066,7 +17098,6 @@ def test_list_interconnect_attachments_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListInterconnectAttachmentsRequest() - assert args[0] == request_msg @@ -17089,7 +17120,6 @@ def test_get_interconnect_attachment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetInterconnectAttachmentRequest() - assert args[0] == request_msg @@ -17112,7 +17142,6 @@ def test_create_interconnect_attachment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateInterconnectAttachmentRequest() - assert args[0] == request_msg @@ -17135,7 +17164,6 @@ def test_delete_interconnect_attachment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteInterconnectAttachmentRequest() - assert args[0] == request_msg @@ -17156,7 +17184,6 @@ def test_list_routers_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListRoutersRequest() - assert args[0] == request_msg @@ -17177,7 +17204,6 @@ def test_get_router_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetRouterRequest() - assert args[0] == request_msg @@ -17198,7 +17224,6 @@ def test_diagnose_router_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DiagnoseRouterRequest() - assert args[0] == request_msg @@ -17219,7 +17244,6 @@ def test_create_router_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateRouterRequest() - assert args[0] == request_msg @@ -17240,7 +17264,6 @@ def test_update_router_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateRouterRequest() - assert args[0] == request_msg @@ -17261,7 +17284,6 @@ def test_delete_router_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteRouterRequest() - assert args[0] == request_msg @@ -17300,7 +17322,6 @@ async def test_initialize_zone_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.InitializeZoneRequest() - assert args[0] == request_msg @@ -17328,7 +17349,6 @@ async def test_list_zones_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListZonesRequest() - assert args[0] == request_msg @@ -17356,7 +17376,6 @@ async def test_get_zone_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetZoneRequest() - assert args[0] == request_msg @@ -17384,7 +17403,6 @@ async def test_list_networks_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListNetworksRequest() - assert args[0] == request_msg @@ -17413,7 +17431,6 @@ async def test_get_network_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetNetworkRequest() - assert args[0] == request_msg @@ -17438,7 +17455,6 @@ async def test_diagnose_network_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DiagnoseNetworkRequest() - assert args[0] == request_msg @@ -17463,7 +17479,6 @@ async def test_create_network_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateNetworkRequest() - assert args[0] == request_msg @@ -17488,7 +17503,6 @@ async def test_delete_network_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteNetworkRequest() - assert args[0] == request_msg @@ -17516,7 +17530,6 @@ async def test_list_subnets_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListSubnetsRequest() - assert args[0] == request_msg @@ -17550,7 +17563,6 @@ async def test_get_subnet_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetSubnetRequest() - assert args[0] == request_msg @@ -17575,7 +17587,6 @@ async def test_create_subnet_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateSubnetRequest() - assert args[0] == request_msg @@ -17600,7 +17611,6 @@ async def test_update_subnet_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateSubnetRequest() - assert args[0] == request_msg @@ -17625,7 +17635,6 @@ async def test_delete_subnet_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteSubnetRequest() - assert args[0] == request_msg @@ -17655,7 +17664,6 @@ async def test_list_interconnects_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListInterconnectsRequest() - assert args[0] == request_msg @@ -17688,7 +17696,6 @@ async def test_get_interconnect_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetInterconnectRequest() - assert args[0] == request_msg @@ -17715,7 +17722,6 @@ async def test_diagnose_interconnect_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DiagnoseInterconnectRequest() - assert args[0] == request_msg @@ -17745,7 +17751,6 @@ async def test_list_interconnect_attachments_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListInterconnectAttachmentsRequest() - assert args[0] == request_msg @@ -17781,7 +17786,6 @@ async def test_get_interconnect_attachment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetInterconnectAttachmentRequest() - assert args[0] == request_msg @@ -17808,7 +17812,6 @@ async def test_create_interconnect_attachment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateInterconnectAttachmentRequest() - assert args[0] == request_msg @@ -17835,7 +17838,6 @@ async def test_delete_interconnect_attachment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteInterconnectAttachmentRequest() - assert args[0] == request_msg @@ -17863,7 +17865,6 @@ async def test_list_routers_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListRoutersRequest() - assert args[0] == request_msg @@ -17894,7 +17895,6 @@ async def test_get_router_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetRouterRequest() - assert args[0] == request_msg @@ -17919,7 +17919,6 @@ async def test_diagnose_router_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DiagnoseRouterRequest() - assert args[0] == request_msg @@ -17944,7 +17943,6 @@ async def test_create_router_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateRouterRequest() - assert args[0] == request_msg @@ -17969,7 +17967,6 @@ async def test_update_router_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateRouterRequest() - assert args[0] == request_msg @@ -17994,7 +17991,6 @@ async def test_delete_router_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteRouterRequest() - assert args[0] == request_msg @@ -22339,7 +22335,6 @@ def test_initialize_zone_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.InitializeZoneRequest() - assert args[0] == request_msg @@ -22359,7 +22354,6 @@ def test_list_zones_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListZonesRequest() - assert args[0] == request_msg @@ -22379,7 +22373,6 @@ def test_get_zone_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetZoneRequest() - assert args[0] == request_msg @@ -22399,7 +22392,6 @@ def test_list_networks_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListNetworksRequest() - assert args[0] == request_msg @@ -22419,7 +22411,6 @@ def test_get_network_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetNetworkRequest() - assert args[0] == request_msg @@ -22439,7 +22430,6 @@ def test_diagnose_network_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DiagnoseNetworkRequest() - assert args[0] == request_msg @@ -22459,7 +22449,6 @@ def test_create_network_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateNetworkRequest() - assert args[0] == request_msg @@ -22479,7 +22468,6 @@ def test_delete_network_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteNetworkRequest() - assert args[0] == request_msg @@ -22499,7 +22487,6 @@ def test_list_subnets_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListSubnetsRequest() - assert args[0] == request_msg @@ -22519,7 +22506,6 @@ def test_get_subnet_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetSubnetRequest() - assert args[0] == request_msg @@ -22539,7 +22525,6 @@ def test_create_subnet_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateSubnetRequest() - assert args[0] == request_msg @@ -22559,7 +22544,6 @@ def test_update_subnet_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateSubnetRequest() - assert args[0] == request_msg @@ -22579,7 +22563,6 @@ def test_delete_subnet_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteSubnetRequest() - assert args[0] == request_msg @@ -22601,7 +22584,6 @@ def test_list_interconnects_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListInterconnectsRequest() - assert args[0] == request_msg @@ -22621,7 +22603,6 @@ def test_get_interconnect_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetInterconnectRequest() - assert args[0] == request_msg @@ -22643,7 +22624,6 @@ def test_diagnose_interconnect_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DiagnoseInterconnectRequest() - assert args[0] == request_msg @@ -22665,7 +22645,6 @@ def test_list_interconnect_attachments_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListInterconnectAttachmentsRequest() - assert args[0] == request_msg @@ -22687,7 +22666,6 @@ def test_get_interconnect_attachment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetInterconnectAttachmentRequest() - assert args[0] == request_msg @@ -22709,7 +22687,6 @@ def test_create_interconnect_attachment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateInterconnectAttachmentRequest() - assert args[0] == request_msg @@ -22731,7 +22708,6 @@ def test_delete_interconnect_attachment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteInterconnectAttachmentRequest() - assert args[0] == request_msg @@ -22751,7 +22727,6 @@ def test_list_routers_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListRoutersRequest() - assert args[0] == request_msg @@ -22771,7 +22746,6 @@ def test_get_router_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetRouterRequest() - assert args[0] == request_msg @@ -22791,7 +22765,6 @@ def test_diagnose_router_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DiagnoseRouterRequest() - assert args[0] == request_msg @@ -22811,7 +22784,6 @@ def test_create_router_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateRouterRequest() - assert args[0] == request_msg @@ -22831,7 +22803,6 @@ def test_update_router_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateRouterRequest() - assert args[0] == request_msg @@ -22851,7 +22822,6 @@ def test_delete_router_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteRouterRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-enterpriseknowledgegraph/noxfile.py b/packages/google-cloud-enterpriseknowledgegraph/noxfile.py index fd3c8358e65b..d8171fa7ea3a 100644 --- a/packages/google-cloud-enterpriseknowledgegraph/noxfile.py +++ b/packages/google-cloud-enterpriseknowledgegraph/noxfile.py @@ -47,7 +47,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-enterpriseknowledgegraph" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-enterpriseknowledgegraph/setup.py b/packages/google-cloud-enterpriseknowledgegraph/setup.py index b942bd7a438c..fff6bc032467 100644 --- a/packages/google-cloud-enterpriseknowledgegraph/setup.py +++ b/packages/google-cloud-enterpriseknowledgegraph/setup.py @@ -45,7 +45,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/google-cloud-enterpriseknowledgegraph/testing/constraints-3.10.txt b/packages/google-cloud-enterpriseknowledgegraph/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-enterpriseknowledgegraph/testing/constraints-3.10.txt +++ b/packages/google-cloud-enterpriseknowledgegraph/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-enterpriseknowledgegraph/tests/unit/gapic/enterpriseknowledgegraph_v1/test_enterprise_knowledge_graph_service.py b/packages/google-cloud-enterpriseknowledgegraph/tests/unit/gapic/enterpriseknowledgegraph_v1/test_enterprise_knowledge_graph_service.py index 081c43b78386..9e1ff07b6aee 100644 --- a/packages/google-cloud-enterpriseknowledgegraph/tests/unit/gapic/enterpriseknowledgegraph_v1/test_enterprise_knowledge_graph_service.py +++ b/packages/google-cloud-enterpriseknowledgegraph/tests/unit/gapic/enterpriseknowledgegraph_v1/test_enterprise_knowledge_graph_service.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 @@ -113,6 +114,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" @@ -1450,8 +1466,8 @@ def test_enterprise_knowledge_graph_service_client_create_channel_credentials_fi @pytest.mark.parametrize( "request_type", [ - service.CreateEntityReconciliationJobRequest, - dict, + service.CreateEntityReconciliationJobRequest(), + {}, ], ) def test_create_entity_reconciliation_job(request_type, transport: str = "grpc"): @@ -1462,7 +1478,7 @@ def test_create_entity_reconciliation_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( @@ -1512,9 +1528,10 @@ def test_create_entity_reconciliation_job_non_empty_request_with_auto_populated_ client.create_entity_reconciliation_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateEntityReconciliationJobRequest( + request_msg = service.CreateEntityReconciliationJobRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_entity_reconciliation_job_use_cached_wrapped_rpc(): @@ -1600,9 +1617,15 @@ async def test_create_entity_reconciliation_job_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.CreateEntityReconciliationJobRequest(), + {}, + ], +) async def test_create_entity_reconciliation_job_async( - transport: str = "grpc_asyncio", - request_type=service.CreateEntityReconciliationJobRequest, + request_type, transport: str = "grpc_asyncio" ): client = EnterpriseKnowledgeGraphServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1611,7 +1634,7 @@ async def test_create_entity_reconciliation_job_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( @@ -1638,11 +1661,6 @@ async def test_create_entity_reconciliation_job_async( assert response.state == job_state.JobState.JOB_STATE_PENDING -@pytest.mark.asyncio -async def test_create_entity_reconciliation_job_async_from_dict(): - await test_create_entity_reconciliation_job_async(request_type=dict) - - def test_create_entity_reconciliation_job_field_headers(): client = EnterpriseKnowledgeGraphServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1815,8 +1833,8 @@ async def test_create_entity_reconciliation_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.GetEntityReconciliationJobRequest, - dict, + service.GetEntityReconciliationJobRequest(), + {}, ], ) def test_get_entity_reconciliation_job(request_type, transport: str = "grpc"): @@ -1827,7 +1845,7 @@ def test_get_entity_reconciliation_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( @@ -1877,9 +1895,10 @@ def test_get_entity_reconciliation_job_non_empty_request_with_auto_populated_fie client.get_entity_reconciliation_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetEntityReconciliationJobRequest( + request_msg = service.GetEntityReconciliationJobRequest( name="name_value", ) + assert args[0] == request_msg def test_get_entity_reconciliation_job_use_cached_wrapped_rpc(): @@ -1965,9 +1984,15 @@ async def test_get_entity_reconciliation_job_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.GetEntityReconciliationJobRequest(), + {}, + ], +) async def test_get_entity_reconciliation_job_async( - transport: str = "grpc_asyncio", - request_type=service.GetEntityReconciliationJobRequest, + request_type, transport: str = "grpc_asyncio" ): client = EnterpriseKnowledgeGraphServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1976,7 +2001,7 @@ async def test_get_entity_reconciliation_job_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( @@ -2003,11 +2028,6 @@ async def test_get_entity_reconciliation_job_async( assert response.state == job_state.JobState.JOB_STATE_PENDING -@pytest.mark.asyncio -async def test_get_entity_reconciliation_job_async_from_dict(): - await test_get_entity_reconciliation_job_async(request_type=dict) - - def test_get_entity_reconciliation_job_field_headers(): client = EnterpriseKnowledgeGraphServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2162,8 +2182,8 @@ async def test_get_entity_reconciliation_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListEntityReconciliationJobsRequest, - dict, + service.ListEntityReconciliationJobsRequest(), + {}, ], ) def test_list_entity_reconciliation_jobs(request_type, transport: str = "grpc"): @@ -2174,7 +2194,7 @@ def test_list_entity_reconciliation_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( @@ -2224,11 +2244,12 @@ def test_list_entity_reconciliation_jobs_non_empty_request_with_auto_populated_f client.list_entity_reconciliation_jobs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListEntityReconciliationJobsRequest( + request_msg = service.ListEntityReconciliationJobsRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_entity_reconciliation_jobs_use_cached_wrapped_rpc(): @@ -2314,9 +2335,15 @@ async def test_list_entity_reconciliation_jobs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.ListEntityReconciliationJobsRequest(), + {}, + ], +) async def test_list_entity_reconciliation_jobs_async( - transport: str = "grpc_asyncio", - request_type=service.ListEntityReconciliationJobsRequest, + request_type, transport: str = "grpc_asyncio" ): client = EnterpriseKnowledgeGraphServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2325,7 +2352,7 @@ async def test_list_entity_reconciliation_jobs_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( @@ -2350,11 +2377,6 @@ async def test_list_entity_reconciliation_jobs_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_entity_reconciliation_jobs_async_from_dict(): - await test_list_entity_reconciliation_jobs_async(request_type=dict) - - def test_list_entity_reconciliation_jobs_field_headers(): client = EnterpriseKnowledgeGraphServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2711,8 +2733,8 @@ async def test_list_entity_reconciliation_jobs_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.CancelEntityReconciliationJobRequest, - dict, + service.CancelEntityReconciliationJobRequest(), + {}, ], ) def test_cancel_entity_reconciliation_job(request_type, transport: str = "grpc"): @@ -2723,7 +2745,7 @@ def test_cancel_entity_reconciliation_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( @@ -2768,9 +2790,10 @@ def test_cancel_entity_reconciliation_job_non_empty_request_with_auto_populated_ client.cancel_entity_reconciliation_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CancelEntityReconciliationJobRequest( + request_msg = service.CancelEntityReconciliationJobRequest( name="name_value", ) + assert args[0] == request_msg def test_cancel_entity_reconciliation_job_use_cached_wrapped_rpc(): @@ -2856,9 +2879,15 @@ async def test_cancel_entity_reconciliation_job_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.CancelEntityReconciliationJobRequest(), + {}, + ], +) async def test_cancel_entity_reconciliation_job_async( - transport: str = "grpc_asyncio", - request_type=service.CancelEntityReconciliationJobRequest, + request_type, transport: str = "grpc_asyncio" ): client = EnterpriseKnowledgeGraphServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2867,7 +2896,7 @@ async def test_cancel_entity_reconciliation_job_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( @@ -2887,11 +2916,6 @@ async def test_cancel_entity_reconciliation_job_async( assert response is None -@pytest.mark.asyncio -async def test_cancel_entity_reconciliation_job_async_from_dict(): - await test_cancel_entity_reconciliation_job_async(request_type=dict) - - def test_cancel_entity_reconciliation_job_field_headers(): client = EnterpriseKnowledgeGraphServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3042,8 +3066,8 @@ async def test_cancel_entity_reconciliation_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DeleteEntityReconciliationJobRequest, - dict, + service.DeleteEntityReconciliationJobRequest(), + {}, ], ) def test_delete_entity_reconciliation_job(request_type, transport: str = "grpc"): @@ -3054,7 +3078,7 @@ def test_delete_entity_reconciliation_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( @@ -3099,9 +3123,10 @@ def test_delete_entity_reconciliation_job_non_empty_request_with_auto_populated_ client.delete_entity_reconciliation_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteEntityReconciliationJobRequest( + request_msg = service.DeleteEntityReconciliationJobRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_entity_reconciliation_job_use_cached_wrapped_rpc(): @@ -3187,9 +3212,15 @@ async def test_delete_entity_reconciliation_job_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteEntityReconciliationJobRequest(), + {}, + ], +) async def test_delete_entity_reconciliation_job_async( - transport: str = "grpc_asyncio", - request_type=service.DeleteEntityReconciliationJobRequest, + request_type, transport: str = "grpc_asyncio" ): client = EnterpriseKnowledgeGraphServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3198,7 +3229,7 @@ async def test_delete_entity_reconciliation_job_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( @@ -3218,11 +3249,6 @@ async def test_delete_entity_reconciliation_job_async( assert response is None -@pytest.mark.asyncio -async def test_delete_entity_reconciliation_job_async_from_dict(): - await test_delete_entity_reconciliation_job_async(request_type=dict) - - def test_delete_entity_reconciliation_job_field_headers(): client = EnterpriseKnowledgeGraphServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3373,8 +3399,8 @@ async def test_delete_entity_reconciliation_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.LookupRequest, - dict, + service.LookupRequest(), + {}, ], ) def test_lookup(request_type, transport: str = "grpc"): @@ -3385,7 +3411,7 @@ def test_lookup(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.lookup), "__call__") as call: @@ -3426,9 +3452,10 @@ def test_lookup_non_empty_request_with_auto_populated_field(): client.lookup(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.LookupRequest( + request_msg = service.LookupRequest( parent="parent_value", ) + assert args[0] == request_msg def test_lookup_use_cached_wrapped_rpc(): @@ -3507,9 +3534,14 @@ async def test_lookup_async_use_cached_wrapped_rpc(transport: str = "grpc_asynci @pytest.mark.asyncio -async def test_lookup_async( - transport: str = "grpc_asyncio", request_type=service.LookupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.LookupRequest(), + {}, + ], +) +async def test_lookup_async(request_type, transport: str = "grpc_asyncio"): client = EnterpriseKnowledgeGraphServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3517,7 +3549,7 @@ async def test_lookup_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.lookup), "__call__") as call: @@ -3537,11 +3569,6 @@ async def test_lookup_async( assert isinstance(response, service.LookupResponse) -@pytest.mark.asyncio -async def test_lookup_async_from_dict(): - await test_lookup_async(request_type=dict) - - def test_lookup_field_headers(): client = EnterpriseKnowledgeGraphServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3698,8 +3725,8 @@ async def test_lookup_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.SearchRequest, - dict, + service.SearchRequest(), + {}, ], ) def test_search(request_type, transport: str = "grpc"): @@ -3710,7 +3737,7 @@ def test_search(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.search), "__call__") as call: @@ -3752,10 +3779,11 @@ def test_search_non_empty_request_with_auto_populated_field(): client.search(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.SearchRequest( + request_msg = service.SearchRequest( parent="parent_value", query="query_value", ) + assert args[0] == request_msg def test_search_use_cached_wrapped_rpc(): @@ -3834,9 +3862,14 @@ async def test_search_async_use_cached_wrapped_rpc(transport: str = "grpc_asynci @pytest.mark.asyncio -async def test_search_async( - transport: str = "grpc_asyncio", request_type=service.SearchRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.SearchRequest(), + {}, + ], +) +async def test_search_async(request_type, transport: str = "grpc_asyncio"): client = EnterpriseKnowledgeGraphServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3844,7 +3877,7 @@ async def test_search_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.search), "__call__") as call: @@ -3864,11 +3897,6 @@ async def test_search_async( assert isinstance(response, service.SearchResponse) -@pytest.mark.asyncio -async def test_search_async_from_dict(): - await test_search_async(request_type=dict) - - def test_search_field_headers(): client = EnterpriseKnowledgeGraphServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4025,8 +4053,8 @@ async def test_search_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.LookupPublicKgRequest, - dict, + service.LookupPublicKgRequest(), + {}, ], ) def test_lookup_public_kg(request_type, transport: str = "grpc"): @@ -4037,7 +4065,7 @@ def test_lookup_public_kg(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.lookup_public_kg), "__call__") as call: @@ -4078,9 +4106,10 @@ def test_lookup_public_kg_non_empty_request_with_auto_populated_field(): client.lookup_public_kg(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.LookupPublicKgRequest( + request_msg = service.LookupPublicKgRequest( parent="parent_value", ) + assert args[0] == request_msg def test_lookup_public_kg_use_cached_wrapped_rpc(): @@ -4163,9 +4192,14 @@ async def test_lookup_public_kg_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_lookup_public_kg_async( - transport: str = "grpc_asyncio", request_type=service.LookupPublicKgRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.LookupPublicKgRequest(), + {}, + ], +) +async def test_lookup_public_kg_async(request_type, transport: str = "grpc_asyncio"): client = EnterpriseKnowledgeGraphServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4173,7 +4207,7 @@ async def test_lookup_public_kg_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.lookup_public_kg), "__call__") as call: @@ -4193,11 +4227,6 @@ async def test_lookup_public_kg_async( assert isinstance(response, service.LookupPublicKgResponse) -@pytest.mark.asyncio -async def test_lookup_public_kg_async_from_dict(): - await test_lookup_public_kg_async(request_type=dict) - - def test_lookup_public_kg_field_headers(): client = EnterpriseKnowledgeGraphServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4354,8 +4383,8 @@ async def test_lookup_public_kg_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.SearchPublicKgRequest, - dict, + service.SearchPublicKgRequest(), + {}, ], ) def test_search_public_kg(request_type, transport: str = "grpc"): @@ -4366,7 +4395,7 @@ def test_search_public_kg(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.search_public_kg), "__call__") as call: @@ -4408,10 +4437,11 @@ def test_search_public_kg_non_empty_request_with_auto_populated_field(): client.search_public_kg(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.SearchPublicKgRequest( + request_msg = service.SearchPublicKgRequest( parent="parent_value", query="query_value", ) + assert args[0] == request_msg def test_search_public_kg_use_cached_wrapped_rpc(): @@ -4494,9 +4524,14 @@ async def test_search_public_kg_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_search_public_kg_async( - transport: str = "grpc_asyncio", request_type=service.SearchPublicKgRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.SearchPublicKgRequest(), + {}, + ], +) +async def test_search_public_kg_async(request_type, transport: str = "grpc_asyncio"): client = EnterpriseKnowledgeGraphServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4504,7 +4539,7 @@ async def test_search_public_kg_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.search_public_kg), "__call__") as call: @@ -4524,11 +4559,6 @@ async def test_search_public_kg_async( assert isinstance(response, service.SearchPublicKgResponse) -@pytest.mark.asyncio -async def test_search_public_kg_async_from_dict(): - await test_search_public_kg_async(request_type=dict) - - def test_search_public_kg_field_headers(): client = EnterpriseKnowledgeGraphServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6686,7 +6716,6 @@ def test_create_entity_reconciliation_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateEntityReconciliationJobRequest() - assert args[0] == request_msg @@ -6709,7 +6738,6 @@ def test_get_entity_reconciliation_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetEntityReconciliationJobRequest() - assert args[0] == request_msg @@ -6732,7 +6760,6 @@ def test_list_entity_reconciliation_jobs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListEntityReconciliationJobsRequest() - assert args[0] == request_msg @@ -6755,7 +6782,6 @@ def test_cancel_entity_reconciliation_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CancelEntityReconciliationJobRequest() - assert args[0] == request_msg @@ -6778,7 +6804,6 @@ def test_delete_entity_reconciliation_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteEntityReconciliationJobRequest() - assert args[0] == request_msg @@ -6799,7 +6824,6 @@ def test_lookup_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.LookupRequest() - assert args[0] == request_msg @@ -6820,7 +6844,6 @@ def test_search_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.SearchRequest() - assert args[0] == request_msg @@ -6841,7 +6864,6 @@ def test_lookup_public_kg_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.LookupPublicKgRequest() - assert args[0] == request_msg @@ -6862,7 +6884,6 @@ def test_search_public_kg_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.SearchPublicKgRequest() - assert args[0] == request_msg @@ -6906,7 +6927,6 @@ async def test_create_entity_reconciliation_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateEntityReconciliationJobRequest() - assert args[0] == request_msg @@ -6936,7 +6956,6 @@ async def test_get_entity_reconciliation_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetEntityReconciliationJobRequest() - assert args[0] == request_msg @@ -6965,7 +6984,6 @@ async def test_list_entity_reconciliation_jobs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListEntityReconciliationJobsRequest() - assert args[0] == request_msg @@ -6990,7 +7008,6 @@ async def test_cancel_entity_reconciliation_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CancelEntityReconciliationJobRequest() - assert args[0] == request_msg @@ -7015,7 +7032,6 @@ async def test_delete_entity_reconciliation_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteEntityReconciliationJobRequest() - assert args[0] == request_msg @@ -7040,7 +7056,6 @@ async def test_lookup_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.LookupRequest() - assert args[0] == request_msg @@ -7065,7 +7080,6 @@ async def test_search_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.SearchRequest() - assert args[0] == request_msg @@ -7090,7 +7104,6 @@ async def test_lookup_public_kg_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.LookupPublicKgRequest() - assert args[0] == request_msg @@ -7115,7 +7128,6 @@ async def test_search_public_kg_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.SearchPublicKgRequest() - assert args[0] == request_msg @@ -8408,7 +8420,6 @@ def test_create_entity_reconciliation_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateEntityReconciliationJobRequest() - assert args[0] == request_msg @@ -8430,7 +8441,6 @@ def test_get_entity_reconciliation_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetEntityReconciliationJobRequest() - assert args[0] == request_msg @@ -8452,7 +8462,6 @@ def test_list_entity_reconciliation_jobs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListEntityReconciliationJobsRequest() - assert args[0] == request_msg @@ -8474,7 +8483,6 @@ def test_cancel_entity_reconciliation_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CancelEntityReconciliationJobRequest() - assert args[0] == request_msg @@ -8496,7 +8504,6 @@ def test_delete_entity_reconciliation_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteEntityReconciliationJobRequest() - assert args[0] == request_msg @@ -8516,7 +8523,6 @@ def test_lookup_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.LookupRequest() - assert args[0] == request_msg @@ -8536,7 +8542,6 @@ def test_search_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.SearchRequest() - assert args[0] == request_msg @@ -8556,7 +8561,6 @@ def test_lookup_public_kg_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.LookupPublicKgRequest() - assert args[0] == request_msg @@ -8576,7 +8580,6 @@ def test_search_public_kg_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.SearchPublicKgRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-error-reporting/noxfile.py b/packages/google-cloud-error-reporting/noxfile.py index 1838d1eaf7bf..e13108291d94 100644 --- a/packages/google-cloud-error-reporting/noxfile.py +++ b/packages/google-cloud-error-reporting/noxfile.py @@ -47,7 +47,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-error-reporting" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -468,14 +473,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -587,14 +584,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-error-reporting/setup.py b/packages/google-cloud-error-reporting/setup.py index 53e7d39aca33..58594b2a336c 100644 --- a/packages/google-cloud-error-reporting/setup.py +++ b/packages/google-cloud-error-reporting/setup.py @@ -46,7 +46,7 @@ # See https://github.com/googleapis/google-cloud-python/issues/12364 "google-auth >= 2.14.1, <3.0.0,!=2.24.0,!=2.25.0", "google-cloud-logging>=3.9.0, <4.0.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-error-reporting/testing/constraints-3.10.txt b/packages/google-cloud-error-reporting/testing/constraints-3.10.txt index c5bc2f4088e4..76cd237011f5 100644 --- a/packages/google-cloud-error-reporting/testing/constraints-3.10.txt +++ b/packages/google-cloud-error-reporting/testing/constraints-3.10.txt @@ -7,6 +7,6 @@ google-api-core==2.17.1 google-auth==2.14.1 google-cloud-logging==3.9.0 -grpcio==1.44.0 +grpcio==1.59.0 proto-plus==1.22.3 protobuf==4.25.8 diff --git a/packages/google-cloud-error-reporting/tests/unit/gapic/errorreporting_v1beta1/test_error_group_service.py b/packages/google-cloud-error-reporting/tests/unit/gapic/errorreporting_v1beta1/test_error_group_service.py index 80c65f31d6fb..20ab64a12ee8 100644 --- a/packages/google-cloud-error-reporting/tests/unit/gapic/errorreporting_v1beta1/test_error_group_service.py +++ b/packages/google-cloud-error-reporting/tests/unit/gapic/errorreporting_v1beta1/test_error_group_service.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 @@ -106,6 +107,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" @@ -1347,8 +1363,8 @@ def test_error_group_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - error_group_service.GetGroupRequest, - dict, + error_group_service.GetGroupRequest(), + {}, ], ) def test_get_group(request_type, transport: str = "grpc"): @@ -1359,7 +1375,7 @@ def test_get_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_group), "__call__") as call: @@ -1407,9 +1423,10 @@ def test_get_group_non_empty_request_with_auto_populated_field(): client.get_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == error_group_service.GetGroupRequest( + request_msg = error_group_service.GetGroupRequest( group_name="group_name_value", ) + assert args[0] == request_msg def test_get_group_use_cached_wrapped_rpc(): @@ -1488,9 +1505,14 @@ async def test_get_group_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_group_async( - transport: str = "grpc_asyncio", request_type=error_group_service.GetGroupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + error_group_service.GetGroupRequest(), + {}, + ], +) +async def test_get_group_async(request_type, transport: str = "grpc_asyncio"): client = ErrorGroupServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1498,7 +1520,7 @@ async def test_get_group_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_group), "__call__") as call: @@ -1525,11 +1547,6 @@ async def test_get_group_async( assert response.resolution_status == common.ResolutionStatus.OPEN -@pytest.mark.asyncio -async def test_get_group_async_from_dict(): - await test_get_group_async(request_type=dict) - - def test_get_group_field_headers(): client = ErrorGroupServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1672,8 +1689,8 @@ async def test_get_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - error_group_service.UpdateGroupRequest, - dict, + error_group_service.UpdateGroupRequest(), + {}, ], ) def test_update_group(request_type, transport: str = "grpc"): @@ -1684,7 +1701,7 @@ def test_update_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_group), "__call__") as call: @@ -1730,7 +1747,8 @@ def test_update_group_non_empty_request_with_auto_populated_field(): client.update_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == error_group_service.UpdateGroupRequest() + request_msg = error_group_service.UpdateGroupRequest() + assert args[0] == request_msg def test_update_group_use_cached_wrapped_rpc(): @@ -1811,9 +1829,14 @@ async def test_update_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_group_async( - transport: str = "grpc_asyncio", request_type=error_group_service.UpdateGroupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + error_group_service.UpdateGroupRequest(), + {}, + ], +) +async def test_update_group_async(request_type, transport: str = "grpc_asyncio"): client = ErrorGroupServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1821,7 +1844,7 @@ async def test_update_group_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_group), "__call__") as call: @@ -1848,11 +1871,6 @@ async def test_update_group_async( assert response.resolution_status == common.ResolutionStatus.OPEN -@pytest.mark.asyncio -async def test_update_group_async_from_dict(): - await test_update_group_async(request_type=dict) - - def test_update_group_field_headers(): client = ErrorGroupServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2465,7 +2483,6 @@ def test_get_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = error_group_service.GetGroupRequest() - assert args[0] == request_msg @@ -2486,7 +2503,6 @@ def test_update_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = error_group_service.UpdateGroupRequest() - assert args[0] == request_msg @@ -2529,7 +2545,6 @@ async def test_get_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = error_group_service.GetGroupRequest() - assert args[0] == request_msg @@ -2558,7 +2573,6 @@ async def test_update_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = error_group_service.UpdateGroupRequest() - assert args[0] == request_msg @@ -2932,7 +2946,6 @@ def test_get_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = error_group_service.GetGroupRequest() - assert args[0] == request_msg @@ -2952,7 +2965,6 @@ def test_update_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = error_group_service.UpdateGroupRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-error-reporting/tests/unit/gapic/errorreporting_v1beta1/test_error_stats_service.py b/packages/google-cloud-error-reporting/tests/unit/gapic/errorreporting_v1beta1/test_error_stats_service.py index a684eb5d9d34..8fc73119c1a4 100644 --- a/packages/google-cloud-error-reporting/tests/unit/gapic/errorreporting_v1beta1/test_error_stats_service.py +++ b/packages/google-cloud-error-reporting/tests/unit/gapic/errorreporting_v1beta1/test_error_stats_service.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 @@ -109,6 +110,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" @@ -1350,8 +1366,8 @@ def test_error_stats_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - error_stats_service.ListGroupStatsRequest, - dict, + error_stats_service.ListGroupStatsRequest(), + {}, ], ) def test_list_group_stats(request_type, transport: str = "grpc"): @@ -1362,7 +1378,7 @@ def test_list_group_stats(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_group_stats), "__call__") as call: @@ -1407,10 +1423,11 @@ def test_list_group_stats_non_empty_request_with_auto_populated_field(): client.list_group_stats(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == error_stats_service.ListGroupStatsRequest( + request_msg = error_stats_service.ListGroupStatsRequest( project_name="project_name_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_group_stats_use_cached_wrapped_rpc(): @@ -1493,10 +1510,14 @@ async def test_list_group_stats_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_group_stats_async( - transport: str = "grpc_asyncio", - request_type=error_stats_service.ListGroupStatsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + error_stats_service.ListGroupStatsRequest(), + {}, + ], +) +async def test_list_group_stats_async(request_type, transport: str = "grpc_asyncio"): client = ErrorStatsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1504,7 +1525,7 @@ async def test_list_group_stats_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_group_stats), "__call__") as call: @@ -1527,11 +1548,6 @@ async def test_list_group_stats_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_group_stats_async_from_dict(): - await test_list_group_stats_async(request_type=dict) - - def test_list_group_stats_field_headers(): client = ErrorStatsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1892,8 +1908,8 @@ async def test_list_group_stats_async_pages(): @pytest.mark.parametrize( "request_type", [ - error_stats_service.ListEventsRequest, - dict, + error_stats_service.ListEventsRequest(), + {}, ], ) def test_list_events(request_type, transport: str = "grpc"): @@ -1904,7 +1920,7 @@ def test_list_events(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_events), "__call__") as call: @@ -1950,11 +1966,12 @@ def test_list_events_non_empty_request_with_auto_populated_field(): client.list_events(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == error_stats_service.ListEventsRequest( + request_msg = error_stats_service.ListEventsRequest( project_name="project_name_value", group_id="group_id_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_events_use_cached_wrapped_rpc(): @@ -2035,9 +2052,14 @@ async def test_list_events_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_events_async( - transport: str = "grpc_asyncio", request_type=error_stats_service.ListEventsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + error_stats_service.ListEventsRequest(), + {}, + ], +) +async def test_list_events_async(request_type, transport: str = "grpc_asyncio"): client = ErrorStatsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2045,7 +2067,7 @@ async def test_list_events_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_events), "__call__") as call: @@ -2068,11 +2090,6 @@ async def test_list_events_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_events_async_from_dict(): - await test_list_events_async(request_type=dict) - - def test_list_events_field_headers(): client = ErrorStatsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2419,8 +2436,8 @@ async def test_list_events_async_pages(): @pytest.mark.parametrize( "request_type", [ - error_stats_service.DeleteEventsRequest, - dict, + error_stats_service.DeleteEventsRequest(), + {}, ], ) def test_delete_events(request_type, transport: str = "grpc"): @@ -2431,7 +2448,7 @@ def test_delete_events(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_events), "__call__") as call: @@ -2472,9 +2489,10 @@ def test_delete_events_non_empty_request_with_auto_populated_field(): client.delete_events(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == error_stats_service.DeleteEventsRequest( + request_msg = error_stats_service.DeleteEventsRequest( project_name="project_name_value", ) + assert args[0] == request_msg def test_delete_events_use_cached_wrapped_rpc(): @@ -2555,10 +2573,14 @@ async def test_delete_events_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_events_async( - transport: str = "grpc_asyncio", - request_type=error_stats_service.DeleteEventsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + error_stats_service.DeleteEventsRequest(), + {}, + ], +) +async def test_delete_events_async(request_type, transport: str = "grpc_asyncio"): client = ErrorStatsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2566,7 +2588,7 @@ async def test_delete_events_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_events), "__call__") as call: @@ -2586,11 +2608,6 @@ async def test_delete_events_async( assert isinstance(response, error_stats_service.DeleteEventsResponse) -@pytest.mark.asyncio -async def test_delete_events_async_from_dict(): - await test_delete_events_async(request_type=dict) - - def test_delete_events_field_headers(): client = ErrorStatsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3592,7 +3609,6 @@ def test_list_group_stats_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = error_stats_service.ListGroupStatsRequest() - assert args[0] == request_msg @@ -3613,7 +3629,6 @@ def test_list_events_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = error_stats_service.ListEventsRequest() - assert args[0] == request_msg @@ -3634,7 +3649,6 @@ def test_delete_events_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = error_stats_service.DeleteEventsRequest() - assert args[0] == request_msg @@ -3675,7 +3689,6 @@ async def test_list_group_stats_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = error_stats_service.ListGroupStatsRequest() - assert args[0] == request_msg @@ -3702,7 +3715,6 @@ async def test_list_events_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = error_stats_service.ListEventsRequest() - assert args[0] == request_msg @@ -3727,7 +3739,6 @@ async def test_delete_events_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = error_stats_service.DeleteEventsRequest() - assert args[0] == request_msg @@ -4166,7 +4177,6 @@ def test_list_group_stats_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = error_stats_service.ListGroupStatsRequest() - assert args[0] == request_msg @@ -4186,7 +4196,6 @@ def test_list_events_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = error_stats_service.ListEventsRequest() - assert args[0] == request_msg @@ -4206,7 +4215,6 @@ def test_delete_events_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = error_stats_service.DeleteEventsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-error-reporting/tests/unit/gapic/errorreporting_v1beta1/test_report_errors_service.py b/packages/google-cloud-error-reporting/tests/unit/gapic/errorreporting_v1beta1/test_report_errors_service.py index 3d152aba09f9..645e71f8d2f7 100644 --- a/packages/google-cloud-error-reporting/tests/unit/gapic/errorreporting_v1beta1/test_report_errors_service.py +++ b/packages/google-cloud-error-reporting/tests/unit/gapic/errorreporting_v1beta1/test_report_errors_service.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 @@ -107,6 +108,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" @@ -1370,8 +1386,8 @@ def test_report_errors_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - report_errors_service.ReportErrorEventRequest, - dict, + report_errors_service.ReportErrorEventRequest(), + {}, ], ) def test_report_error_event(request_type, transport: str = "grpc"): @@ -1382,7 +1398,7 @@ def test_report_error_event(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1427,9 +1443,10 @@ def test_report_error_event_non_empty_request_with_auto_populated_field(): client.report_error_event(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == report_errors_service.ReportErrorEventRequest( + request_msg = report_errors_service.ReportErrorEventRequest( project_name="project_name_value", ) + assert args[0] == request_msg def test_report_error_event_use_cached_wrapped_rpc(): @@ -1514,10 +1531,14 @@ async def test_report_error_event_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_report_error_event_async( - transport: str = "grpc_asyncio", - request_type=report_errors_service.ReportErrorEventRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + report_errors_service.ReportErrorEventRequest(), + {}, + ], +) +async def test_report_error_event_async(request_type, transport: str = "grpc_asyncio"): client = ReportErrorsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1525,7 +1546,7 @@ async def test_report_error_event_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( @@ -1547,11 +1568,6 @@ async def test_report_error_event_async( assert isinstance(response, report_errors_service.ReportErrorEventResponse) -@pytest.mark.asyncio -async def test_report_error_event_async_from_dict(): - await test_report_error_event_async(request_type=dict) - - def test_report_error_event_field_headers(): client = ReportErrorsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2049,7 +2065,6 @@ def test_report_error_event_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = report_errors_service.ReportErrorEventRequest() - assert args[0] == request_msg @@ -2090,7 +2105,6 @@ async def test_report_error_event_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = report_errors_service.ReportErrorEventRequest() - assert args[0] == request_msg @@ -2351,7 +2365,6 @@ def test_report_error_event_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = report_errors_service.ReportErrorEventRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-essential-contacts/noxfile.py b/packages/google-cloud-essential-contacts/noxfile.py index da32eb8bb2f1..4da6f982d14b 100644 --- a/packages/google-cloud-essential-contacts/noxfile.py +++ b/packages/google-cloud-essential-contacts/noxfile.py @@ -47,7 +47,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-essential-contacts" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-essential-contacts/setup.py b/packages/google-cloud-essential-contacts/setup.py index 409134a456a0..731fc7517951 100644 --- a/packages/google-cloud-essential-contacts/setup.py +++ b/packages/google-cloud-essential-contacts/setup.py @@ -45,7 +45,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/google-cloud-essential-contacts/testing/constraints-3.10.txt b/packages/google-cloud-essential-contacts/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-essential-contacts/testing/constraints-3.10.txt +++ b/packages/google-cloud-essential-contacts/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-essential-contacts/tests/unit/gapic/essential_contacts_v1/test_essential_contacts_service.py b/packages/google-cloud-essential-contacts/tests/unit/gapic/essential_contacts_v1/test_essential_contacts_service.py index 5f2d41e8a1f5..c28ec66cdc76 100644 --- a/packages/google-cloud-essential-contacts/tests/unit/gapic/essential_contacts_v1/test_essential_contacts_service.py +++ b/packages/google-cloud-essential-contacts/tests/unit/gapic/essential_contacts_v1/test_essential_contacts_service.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 @@ -109,6 +110,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" @@ -1384,8 +1400,8 @@ def test_essential_contacts_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - service.CreateContactRequest, - dict, + service.CreateContactRequest(), + {}, ], ) def test_create_contact(request_type, transport: str = "grpc"): @@ -1396,7 +1412,7 @@ def test_create_contact(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_contact), "__call__") as call: @@ -1450,9 +1466,10 @@ def test_create_contact_non_empty_request_with_auto_populated_field(): client.create_contact(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateContactRequest( + request_msg = service.CreateContactRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_contact_use_cached_wrapped_rpc(): @@ -1533,9 +1550,14 @@ async def test_create_contact_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_contact_async( - transport: str = "grpc_asyncio", request_type=service.CreateContactRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CreateContactRequest(), + {}, + ], +) +async def test_create_contact_async(request_type, transport: str = "grpc_asyncio"): client = EssentialContactsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1543,7 +1565,7 @@ async def test_create_contact_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_contact), "__call__") as call: @@ -1576,11 +1598,6 @@ async def test_create_contact_async( assert response.validation_state == enums.ValidationState.VALID -@pytest.mark.asyncio -async def test_create_contact_async_from_dict(): - await test_create_contact_async(request_type=dict) - - def test_create_contact_field_headers(): client = EssentialContactsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1733,8 +1750,8 @@ async def test_create_contact_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdateContactRequest, - dict, + service.UpdateContactRequest(), + {}, ], ) def test_update_contact(request_type, transport: str = "grpc"): @@ -1745,7 +1762,7 @@ def test_update_contact(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_contact), "__call__") as call: @@ -1797,7 +1814,8 @@ def test_update_contact_non_empty_request_with_auto_populated_field(): client.update_contact(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateContactRequest() + request_msg = service.UpdateContactRequest() + assert args[0] == request_msg def test_update_contact_use_cached_wrapped_rpc(): @@ -1878,9 +1896,14 @@ async def test_update_contact_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_contact_async( - transport: str = "grpc_asyncio", request_type=service.UpdateContactRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateContactRequest(), + {}, + ], +) +async def test_update_contact_async(request_type, transport: str = "grpc_asyncio"): client = EssentialContactsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1888,7 +1911,7 @@ async def test_update_contact_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_contact), "__call__") as call: @@ -1921,11 +1944,6 @@ async def test_update_contact_async( assert response.validation_state == enums.ValidationState.VALID -@pytest.mark.asyncio -async def test_update_contact_async_from_dict(): - await test_update_contact_async(request_type=dict) - - def test_update_contact_field_headers(): client = EssentialContactsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2078,8 +2096,8 @@ async def test_update_contact_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListContactsRequest, - dict, + service.ListContactsRequest(), + {}, ], ) def test_list_contacts(request_type, transport: str = "grpc"): @@ -2090,7 +2108,7 @@ def test_list_contacts(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_contacts), "__call__") as call: @@ -2135,10 +2153,11 @@ def test_list_contacts_non_empty_request_with_auto_populated_field(): client.list_contacts(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListContactsRequest( + request_msg = service.ListContactsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_contacts_use_cached_wrapped_rpc(): @@ -2219,9 +2238,14 @@ async def test_list_contacts_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_contacts_async( - transport: str = "grpc_asyncio", request_type=service.ListContactsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListContactsRequest(), + {}, + ], +) +async def test_list_contacts_async(request_type, transport: str = "grpc_asyncio"): client = EssentialContactsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2229,7 +2253,7 @@ async def test_list_contacts_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_contacts), "__call__") as call: @@ -2252,11 +2276,6 @@ async def test_list_contacts_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_contacts_async_from_dict(): - await test_list_contacts_async(request_type=dict) - - def test_list_contacts_field_headers(): client = EssentialContactsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2593,8 +2612,8 @@ async def test_list_contacts_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetContactRequest, - dict, + service.GetContactRequest(), + {}, ], ) def test_get_contact(request_type, transport: str = "grpc"): @@ -2605,7 +2624,7 @@ def test_get_contact(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_contact), "__call__") as call: @@ -2659,9 +2678,10 @@ def test_get_contact_non_empty_request_with_auto_populated_field(): client.get_contact(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetContactRequest( + request_msg = service.GetContactRequest( name="name_value", ) + assert args[0] == request_msg def test_get_contact_use_cached_wrapped_rpc(): @@ -2742,9 +2762,14 @@ async def test_get_contact_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_contact_async( - transport: str = "grpc_asyncio", request_type=service.GetContactRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetContactRequest(), + {}, + ], +) +async def test_get_contact_async(request_type, transport: str = "grpc_asyncio"): client = EssentialContactsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2752,7 +2777,7 @@ async def test_get_contact_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_contact), "__call__") as call: @@ -2785,11 +2810,6 @@ async def test_get_contact_async( assert response.validation_state == enums.ValidationState.VALID -@pytest.mark.asyncio -async def test_get_contact_async_from_dict(): - await test_get_contact_async(request_type=dict) - - def test_get_contact_field_headers(): client = EssentialContactsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2932,8 +2952,8 @@ async def test_get_contact_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DeleteContactRequest, - dict, + service.DeleteContactRequest(), + {}, ], ) def test_delete_contact(request_type, transport: str = "grpc"): @@ -2944,7 +2964,7 @@ def test_delete_contact(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_contact), "__call__") as call: @@ -2985,9 +3005,10 @@ def test_delete_contact_non_empty_request_with_auto_populated_field(): client.delete_contact(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteContactRequest( + request_msg = service.DeleteContactRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_contact_use_cached_wrapped_rpc(): @@ -3068,9 +3089,14 @@ async def test_delete_contact_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_contact_async( - transport: str = "grpc_asyncio", request_type=service.DeleteContactRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteContactRequest(), + {}, + ], +) +async def test_delete_contact_async(request_type, transport: str = "grpc_asyncio"): client = EssentialContactsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3078,7 +3104,7 @@ async def test_delete_contact_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_contact), "__call__") as call: @@ -3096,11 +3122,6 @@ async def test_delete_contact_async( assert response is None -@pytest.mark.asyncio -async def test_delete_contact_async_from_dict(): - await test_delete_contact_async(request_type=dict) - - def test_delete_contact_field_headers(): client = EssentialContactsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3243,8 +3264,8 @@ async def test_delete_contact_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ComputeContactsRequest, - dict, + service.ComputeContactsRequest(), + {}, ], ) def test_compute_contacts(request_type, transport: str = "grpc"): @@ -3255,7 +3276,7 @@ def test_compute_contacts(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.compute_contacts), "__call__") as call: @@ -3300,10 +3321,11 @@ def test_compute_contacts_non_empty_request_with_auto_populated_field(): client.compute_contacts(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ComputeContactsRequest( + request_msg = service.ComputeContactsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_compute_contacts_use_cached_wrapped_rpc(): @@ -3386,9 +3408,14 @@ async def test_compute_contacts_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_compute_contacts_async( - transport: str = "grpc_asyncio", request_type=service.ComputeContactsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ComputeContactsRequest(), + {}, + ], +) +async def test_compute_contacts_async(request_type, transport: str = "grpc_asyncio"): client = EssentialContactsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3396,7 +3423,7 @@ async def test_compute_contacts_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.compute_contacts), "__call__") as call: @@ -3419,11 +3446,6 @@ async def test_compute_contacts_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_compute_contacts_async_from_dict(): - await test_compute_contacts_async(request_type=dict) - - def test_compute_contacts_field_headers(): client = EssentialContactsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3678,8 +3700,8 @@ async def test_compute_contacts_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.SendTestMessageRequest, - dict, + service.SendTestMessageRequest(), + {}, ], ) def test_send_test_message(request_type, transport: str = "grpc"): @@ -3690,7 +3712,7 @@ def test_send_test_message(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3735,9 +3757,10 @@ def test_send_test_message_non_empty_request_with_auto_populated_field(): client.send_test_message(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.SendTestMessageRequest( + request_msg = service.SendTestMessageRequest( resource="resource_value", ) + assert args[0] == request_msg def test_send_test_message_use_cached_wrapped_rpc(): @@ -3820,9 +3843,14 @@ async def test_send_test_message_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_send_test_message_async( - transport: str = "grpc_asyncio", request_type=service.SendTestMessageRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.SendTestMessageRequest(), + {}, + ], +) +async def test_send_test_message_async(request_type, transport: str = "grpc_asyncio"): client = EssentialContactsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3830,7 +3858,7 @@ async def test_send_test_message_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( @@ -3850,11 +3878,6 @@ async def test_send_test_message_async( assert response is None -@pytest.mark.asyncio -async def test_send_test_message_async_from_dict(): - await test_send_test_message_async(request_type=dict) - - def test_send_test_message_field_headers(): client = EssentialContactsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5327,7 +5350,6 @@ def test_create_contact_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateContactRequest() - assert args[0] == request_msg @@ -5348,7 +5370,6 @@ def test_update_contact_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateContactRequest() - assert args[0] == request_msg @@ -5369,7 +5390,6 @@ def test_list_contacts_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListContactsRequest() - assert args[0] == request_msg @@ -5390,7 +5410,6 @@ def test_get_contact_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetContactRequest() - assert args[0] == request_msg @@ -5411,7 +5430,6 @@ def test_delete_contact_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteContactRequest() - assert args[0] == request_msg @@ -5432,7 +5450,6 @@ def test_compute_contacts_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ComputeContactsRequest() - assert args[0] == request_msg @@ -5455,7 +5472,6 @@ def test_send_test_message_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.SendTestMessageRequest() - assert args[0] == request_msg @@ -5500,7 +5516,6 @@ async def test_create_contact_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateContactRequest() - assert args[0] == request_msg @@ -5531,7 +5546,6 @@ async def test_update_contact_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateContactRequest() - assert args[0] == request_msg @@ -5558,7 +5572,6 @@ async def test_list_contacts_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListContactsRequest() - assert args[0] == request_msg @@ -5589,7 +5602,6 @@ async def test_get_contact_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetContactRequest() - assert args[0] == request_msg @@ -5612,7 +5624,6 @@ async def test_delete_contact_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteContactRequest() - assert args[0] == request_msg @@ -5639,7 +5650,6 @@ async def test_compute_contacts_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ComputeContactsRequest() - assert args[0] == request_msg @@ -5664,7 +5674,6 @@ async def test_send_test_message_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.SendTestMessageRequest() - assert args[0] == request_msg @@ -6731,7 +6740,6 @@ def test_create_contact_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateContactRequest() - assert args[0] == request_msg @@ -6751,7 +6759,6 @@ def test_update_contact_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateContactRequest() - assert args[0] == request_msg @@ -6771,7 +6778,6 @@ def test_list_contacts_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListContactsRequest() - assert args[0] == request_msg @@ -6791,7 +6797,6 @@ def test_get_contact_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetContactRequest() - assert args[0] == request_msg @@ -6811,7 +6816,6 @@ def test_delete_contact_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteContactRequest() - assert args[0] == request_msg @@ -6831,7 +6835,6 @@ def test_compute_contacts_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ComputeContactsRequest() - assert args[0] == request_msg @@ -6853,7 +6856,6 @@ def test_send_test_message_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.SendTestMessageRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-eventarc-publishing/noxfile.py b/packages/google-cloud-eventarc-publishing/noxfile.py index 1c892d093fc4..4ab114200c08 100644 --- a/packages/google-cloud-eventarc-publishing/noxfile.py +++ b/packages/google-cloud-eventarc-publishing/noxfile.py @@ -47,7 +47,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-publishing" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-eventarc-publishing/setup.py b/packages/google-cloud-eventarc-publishing/setup.py index 5c6bccc69cf9..c99abf91b14d 100644 --- a/packages/google-cloud-eventarc-publishing/setup.py +++ b/packages/google-cloud-eventarc-publishing/setup.py @@ -45,7 +45,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/google-cloud-eventarc-publishing/testing/constraints-3.10.txt b/packages/google-cloud-eventarc-publishing/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-eventarc-publishing/testing/constraints-3.10.txt +++ b/packages/google-cloud-eventarc-publishing/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-eventarc-publishing/tests/unit/gapic/eventarc_publishing_v1/test_publisher.py b/packages/google-cloud-eventarc-publishing/tests/unit/gapic/eventarc_publishing_v1/test_publisher.py index cdafd5dc027a..ac35260ea820 100644 --- a/packages/google-cloud-eventarc-publishing/tests/unit/gapic/eventarc_publishing_v1/test_publisher.py +++ b/packages/google-cloud-eventarc-publishing/tests/unit/gapic/eventarc_publishing_v1/test_publisher.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 @@ -108,6 +109,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" @@ -1265,8 +1281,8 @@ def test_publisher_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - publisher.PublishChannelConnectionEventsRequest, - dict, + publisher.PublishChannelConnectionEventsRequest(), + {}, ], ) def test_publish_channel_connection_events(request_type, transport: str = "grpc"): @@ -1277,7 +1293,7 @@ def test_publish_channel_connection_events(request_type, transport: str = "grpc" # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1322,9 +1338,10 @@ def test_publish_channel_connection_events_non_empty_request_with_auto_populated client.publish_channel_connection_events(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == publisher.PublishChannelConnectionEventsRequest( + request_msg = publisher.PublishChannelConnectionEventsRequest( channel_connection="channel_connection_value", ) + assert args[0] == request_msg def test_publish_channel_connection_events_use_cached_wrapped_rpc(): @@ -1410,9 +1427,15 @@ async def test_publish_channel_connection_events_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + publisher.PublishChannelConnectionEventsRequest(), + {}, + ], +) async def test_publish_channel_connection_events_async( - transport: str = "grpc_asyncio", - request_type=publisher.PublishChannelConnectionEventsRequest, + request_type, transport: str = "grpc_asyncio" ): client = PublisherAsyncClient( credentials=async_anonymous_credentials(), @@ -1421,7 +1444,7 @@ async def test_publish_channel_connection_events_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( @@ -1443,11 +1466,6 @@ async def test_publish_channel_connection_events_async( assert isinstance(response, publisher.PublishChannelConnectionEventsResponse) -@pytest.mark.asyncio -async def test_publish_channel_connection_events_async_from_dict(): - await test_publish_channel_connection_events_async(request_type=dict) - - def test_publish_channel_connection_events_field_headers(): client = PublisherClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1516,8 +1534,8 @@ async def test_publish_channel_connection_events_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - publisher.PublishEventsRequest, - dict, + publisher.PublishEventsRequest(), + {}, ], ) def test_publish_events(request_type, transport: str = "grpc"): @@ -1528,7 +1546,7 @@ def test_publish_events(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.publish_events), "__call__") as call: @@ -1569,9 +1587,10 @@ def test_publish_events_non_empty_request_with_auto_populated_field(): client.publish_events(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == publisher.PublishEventsRequest( + request_msg = publisher.PublishEventsRequest( channel="channel_value", ) + assert args[0] == request_msg def test_publish_events_use_cached_wrapped_rpc(): @@ -1652,9 +1671,14 @@ async def test_publish_events_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_publish_events_async( - transport: str = "grpc_asyncio", request_type=publisher.PublishEventsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + publisher.PublishEventsRequest(), + {}, + ], +) +async def test_publish_events_async(request_type, transport: str = "grpc_asyncio"): client = PublisherAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1662,7 +1686,7 @@ async def test_publish_events_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.publish_events), "__call__") as call: @@ -1682,11 +1706,6 @@ async def test_publish_events_async( assert isinstance(response, publisher.PublishEventsResponse) -@pytest.mark.asyncio -async def test_publish_events_async_from_dict(): - await test_publish_events_async(request_type=dict) - - def test_publish_events_field_headers(): client = PublisherClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1751,8 +1770,8 @@ async def test_publish_events_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - publisher.PublishRequest, - dict, + publisher.PublishRequest(), + {}, ], ) def test_publish(request_type, transport: str = "grpc"): @@ -1763,7 +1782,7 @@ def test_publish(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.publish), "__call__") as call: @@ -1805,10 +1824,11 @@ def test_publish_non_empty_request_with_auto_populated_field(): client.publish(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == publisher.PublishRequest( + request_msg = publisher.PublishRequest( message_bus="message_bus_value", json_message="json_message_value", ) + assert args[0] == request_msg def test_publish_use_cached_wrapped_rpc(): @@ -1887,9 +1907,14 @@ async def test_publish_async_use_cached_wrapped_rpc(transport: str = "grpc_async @pytest.mark.asyncio -async def test_publish_async( - transport: str = "grpc_asyncio", request_type=publisher.PublishRequest -): +@pytest.mark.parametrize( + "request_type", + [ + publisher.PublishRequest(), + {}, + ], +) +async def test_publish_async(request_type, transport: str = "grpc_asyncio"): client = PublisherAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1897,7 +1922,7 @@ async def test_publish_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.publish), "__call__") as call: @@ -1917,11 +1942,6 @@ async def test_publish_async( assert isinstance(response, publisher.PublishResponse) -@pytest.mark.asyncio -async def test_publish_async_from_dict(): - await test_publish_async(request_type=dict) - - def test_publish_field_headers(): client = PublisherClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2304,7 +2324,6 @@ def test_publish_channel_connection_events_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = publisher.PublishChannelConnectionEventsRequest() - assert args[0] == request_msg @@ -2325,7 +2344,6 @@ def test_publish_events_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = publisher.PublishEventsRequest() - assert args[0] == request_msg @@ -2346,7 +2364,6 @@ def test_publish_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = publisher.PublishRequest() - assert args[0] == request_msg @@ -2387,7 +2404,6 @@ async def test_publish_channel_connection_events_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = publisher.PublishChannelConnectionEventsRequest() - assert args[0] == request_msg @@ -2412,7 +2428,6 @@ async def test_publish_events_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = publisher.PublishEventsRequest() - assert args[0] == request_msg @@ -2437,7 +2452,6 @@ async def test_publish_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = publisher.PublishRequest() - assert args[0] == request_msg @@ -2853,7 +2867,6 @@ def test_publish_channel_connection_events_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = publisher.PublishChannelConnectionEventsRequest() - assert args[0] == request_msg @@ -2873,7 +2886,6 @@ def test_publish_events_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = publisher.PublishEventsRequest() - assert args[0] == request_msg @@ -2893,7 +2905,6 @@ def test_publish_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = publisher.PublishRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-eventarc/noxfile.py b/packages/google-cloud-eventarc/noxfile.py index 660c77441658..6d8722a224dc 100644 --- a/packages/google-cloud-eventarc/noxfile.py +++ b/packages/google-cloud-eventarc/noxfile.py @@ -47,7 +47,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 = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-eventarc/setup.py b/packages/google-cloud-eventarc/setup.py index d5406a8900bb..9c47a7ec37ff 100644 --- a/packages/google-cloud-eventarc/setup.py +++ b/packages/google-cloud-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/google-cloud-eventarc/testing/constraints-3.10.txt b/packages/google-cloud-eventarc/testing/constraints-3.10.txt index a92801e1c8e2..b39cd54634f9 100644 --- a/packages/google-cloud-eventarc/testing/constraints-3.10.txt +++ b/packages/google-cloud-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/google-cloud-eventarc/tests/unit/gapic/eventarc_v1/test_eventarc.py b/packages/google-cloud-eventarc/tests/unit/gapic/eventarc_v1/test_eventarc.py index 38a1df161b77..5941fd81d448 100644 --- a/packages/google-cloud-eventarc/tests/unit/gapic/eventarc_v1/test_eventarc.py +++ b/packages/google-cloud-eventarc/tests/unit/gapic/eventarc_v1/test_eventarc.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 @@ -145,6 +146,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" @@ -1289,8 +1305,8 @@ def test_eventarc_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - eventarc.GetTriggerRequest, - dict, + eventarc.GetTriggerRequest(), + {}, ], ) def test_get_trigger(request_type, transport: str = "grpc"): @@ -1301,7 +1317,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(type(client.transport.get_trigger), "__call__") as call: @@ -1357,9 +1373,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(): @@ -1440,9 +1457,14 @@ async def test_get_trigger_async_use_cached_wrapped_rpc( @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, @@ -1450,7 +1472,7 @@ async def test_get_trigger_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_trigger), "__call__") as call: @@ -1485,11 +1507,6 @@ async def test_get_trigger_async( 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(), @@ -1632,8 +1649,8 @@ 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"): @@ -1644,7 +1661,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(type(client.transport.list_triggers), "__call__") as call: @@ -1693,12 +1710,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(): @@ -1779,9 +1797,14 @@ async def test_list_triggers_async_use_cached_wrapped_rpc( @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, @@ -1789,7 +1812,7 @@ async def test_list_triggers_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_triggers), "__call__") as call: @@ -1814,11 +1837,6 @@ async def test_list_triggers_async( 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(), @@ -2155,8 +2173,8 @@ async def test_list_triggers_async_pages(): @pytest.mark.parametrize( "request_type", [ - eventarc.CreateTriggerRequest, - dict, + eventarc.CreateTriggerRequest(), + {}, ], ) def test_create_trigger(request_type, transport: str = "grpc"): @@ -2167,7 +2185,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(type(client.transport.create_trigger), "__call__") as call: @@ -2209,10 +2227,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(): @@ -2303,9 +2322,14 @@ async def test_create_trigger_async_use_cached_wrapped_rpc( @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, @@ -2313,7 +2337,7 @@ async def test_create_trigger_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_trigger), "__call__") as call: @@ -2333,11 +2357,6 @@ async def test_create_trigger_async( 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(), @@ -2504,8 +2523,8 @@ 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"): @@ -2516,7 +2535,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(type(client.transport.update_trigger), "__call__") as call: @@ -2555,7 +2574,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] - assert args[0] == eventarc.UpdateTriggerRequest() + request_msg = eventarc.UpdateTriggerRequest() + assert args[0] == request_msg def test_update_trigger_use_cached_wrapped_rpc(): @@ -2646,9 +2666,14 @@ async def test_update_trigger_async_use_cached_wrapped_rpc( @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, @@ -2656,7 +2681,7 @@ async def test_update_trigger_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_trigger), "__call__") as call: @@ -2676,11 +2701,6 @@ async def test_update_trigger_async( 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(), @@ -2847,8 +2867,8 @@ 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"): @@ -2859,7 +2879,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(type(client.transport.delete_trigger), "__call__") as call: @@ -2901,10 +2921,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(): @@ -2995,9 +3016,14 @@ async def test_delete_trigger_async_use_cached_wrapped_rpc( @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, @@ -3005,7 +3031,7 @@ async def test_delete_trigger_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_trigger), "__call__") as call: @@ -3025,11 +3051,6 @@ async def test_delete_trigger_async( 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(), @@ -3186,8 +3207,8 @@ 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"): @@ -3198,7 +3219,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(type(client.transport.get_channel), "__call__") as call: @@ -3255,9 +3276,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(): @@ -3338,9 +3360,14 @@ async def test_get_channel_async_use_cached_wrapped_rpc( @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, @@ -3348,7 +3375,7 @@ async def test_get_channel_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_channel), "__call__") as call: @@ -3383,11 +3410,6 @@ async def test_get_channel_async( 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(), @@ -3530,8 +3552,8 @@ 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"): @@ -3542,7 +3564,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(type(client.transport.list_channels), "__call__") as call: @@ -3590,11 +3612,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(): @@ -3675,9 +3698,14 @@ async def test_list_channels_async_use_cached_wrapped_rpc( @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, @@ -3685,7 +3713,7 @@ async def test_list_channels_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_channels), "__call__") as call: @@ -3710,11 +3738,6 @@ async def test_list_channels_async( 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(), @@ -4051,8 +4074,8 @@ async def test_list_channels_async_pages(): @pytest.mark.parametrize( "request_type", [ - eventarc.CreateChannelRequest, - dict, + eventarc.CreateChannelRequest(), + {}, ], ) def test_create_channel(request_type, transport: str = "grpc"): @@ -4063,7 +4086,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(type(client.transport.create_channel_), "__call__") as call: @@ -4105,10 +4128,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(): @@ -4199,9 +4223,14 @@ async def test_create_channel_async_use_cached_wrapped_rpc( @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, @@ -4209,7 +4238,7 @@ async def test_create_channel_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_channel_), "__call__") as call: @@ -4229,11 +4258,6 @@ async def test_create_channel_async( 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(), @@ -4400,8 +4424,8 @@ 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"): @@ -4412,7 +4436,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(type(client.transport.update_channel), "__call__") as call: @@ -4451,7 +4475,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] - assert args[0] == eventarc.UpdateChannelRequest() + request_msg = eventarc.UpdateChannelRequest() + assert args[0] == request_msg def test_update_channel_use_cached_wrapped_rpc(): @@ -4542,9 +4567,14 @@ async def test_update_channel_async_use_cached_wrapped_rpc( @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, @@ -4552,7 +4582,7 @@ async def test_update_channel_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_channel), "__call__") as call: @@ -4572,11 +4602,6 @@ async def test_update_channel_async( 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(), @@ -4733,8 +4758,8 @@ 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"): @@ -4745,7 +4770,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(type(client.transport.delete_channel), "__call__") as call: @@ -4786,9 +4811,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(): @@ -4879,9 +4905,14 @@ async def test_delete_channel_async_use_cached_wrapped_rpc( @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, @@ -4889,7 +4920,7 @@ async def test_delete_channel_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_channel), "__call__") as call: @@ -4909,11 +4940,6 @@ async def test_delete_channel_async( 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(), @@ -5060,8 +5086,8 @@ 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"): @@ -5072,7 +5098,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(type(client.transport.get_provider), "__call__") as call: @@ -5118,9 +5144,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(): @@ -5201,9 +5228,14 @@ async def test_get_provider_async_use_cached_wrapped_rpc( @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, @@ -5211,7 +5243,7 @@ async def test_get_provider_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_provider), "__call__") as call: @@ -5236,11 +5268,6 @@ async def test_get_provider_async( 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(), @@ -5383,8 +5410,8 @@ 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"): @@ -5395,7 +5422,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(type(client.transport.list_providers), "__call__") as call: @@ -5444,12 +5471,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(): @@ -5530,9 +5558,14 @@ async def test_list_providers_async_use_cached_wrapped_rpc( @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, @@ -5540,7 +5573,7 @@ async def test_list_providers_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_providers), "__call__") as call: @@ -5565,11 +5598,6 @@ async def test_list_providers_async( 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(), @@ -5906,8 +5934,8 @@ async def test_list_providers_async_pages(): @pytest.mark.parametrize( "request_type", [ - eventarc.GetChannelConnectionRequest, - dict, + eventarc.GetChannelConnectionRequest(), + {}, ], ) def test_get_channel_connection(request_type, transport: str = "grpc"): @@ -5918,7 +5946,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( @@ -5972,9 +6000,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(): @@ -6060,8 +6089,15 @@ async def test_get_channel_connection_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + eventarc.GetChannelConnectionRequest(), + {}, + ], +) async def test_get_channel_connection_async( - transport: str = "grpc_asyncio", request_type=eventarc.GetChannelConnectionRequest + request_type, transport: str = "grpc_asyncio" ): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), @@ -6070,7 +6106,7 @@ async def test_get_channel_connection_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( @@ -6101,11 +6137,6 @@ async def test_get_channel_connection_async( 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(), @@ -6260,8 +6291,8 @@ 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"): @@ -6272,7 +6303,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( @@ -6323,10 +6354,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(): @@ -6412,8 +6444,15 @@ async def test_list_channel_connections_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + eventarc.ListChannelConnectionsRequest(), + {}, + ], +) async def test_list_channel_connections_async( - transport: str = "grpc_asyncio", request_type=eventarc.ListChannelConnectionsRequest + request_type, transport: str = "grpc_asyncio" ): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), @@ -6422,7 +6461,7 @@ async def test_list_channel_connections_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( @@ -6449,11 +6488,6 @@ async def test_list_channel_connections_async( 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(), @@ -6810,8 +6844,8 @@ async def test_list_channel_connections_async_pages(): @pytest.mark.parametrize( "request_type", [ - eventarc.CreateChannelConnectionRequest, - dict, + eventarc.CreateChannelConnectionRequest(), + {}, ], ) def test_create_channel_connection(request_type, transport: str = "grpc"): @@ -6822,7 +6856,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( @@ -6868,10 +6902,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(): @@ -6967,9 +7002,15 @@ async def test_create_channel_connection_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + eventarc.CreateChannelConnectionRequest(), + {}, + ], +) async def test_create_channel_connection_async( - transport: str = "grpc_asyncio", - request_type=eventarc.CreateChannelConnectionRequest, + request_type, transport: str = "grpc_asyncio" ): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), @@ -6978,7 +7019,7 @@ async def test_create_channel_connection_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( @@ -7000,11 +7041,6 @@ async def test_create_channel_connection_async( 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(), @@ -7187,8 +7223,8 @@ 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"): @@ -7199,7 +7235,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( @@ -7244,9 +7280,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(): @@ -7342,9 +7379,15 @@ async def test_delete_channel_connection_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + eventarc.DeleteChannelConnectionRequest(), + {}, + ], +) async def test_delete_channel_connection_async( - transport: str = "grpc_asyncio", - request_type=eventarc.DeleteChannelConnectionRequest, + request_type, transport: str = "grpc_asyncio" ): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), @@ -7353,7 +7396,7 @@ async def test_delete_channel_connection_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( @@ -7375,11 +7418,6 @@ async def test_delete_channel_connection_async( 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(), @@ -7534,8 +7572,8 @@ 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"): @@ -7546,7 +7584,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( @@ -7596,9 +7634,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(): @@ -7684,8 +7723,15 @@ async def test_get_google_channel_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + eventarc.GetGoogleChannelConfigRequest(), + {}, + ], +) async def test_get_google_channel_config_async( - transport: str = "grpc_asyncio", request_type=eventarc.GetGoogleChannelConfigRequest + request_type, transport: str = "grpc_asyncio" ): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), @@ -7694,7 +7740,7 @@ async def test_get_google_channel_config_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( @@ -7721,11 +7767,6 @@ async def test_get_google_channel_config_async( 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(), @@ -7880,8 +7921,8 @@ 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"): @@ -7892,7 +7933,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( @@ -7940,7 +7981,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] - assert args[0] == eventarc.UpdateGoogleChannelConfigRequest() + request_msg = eventarc.UpdateGoogleChannelConfigRequest() + assert args[0] == request_msg def test_update_google_channel_config_use_cached_wrapped_rpc(): @@ -8026,9 +8068,15 @@ async def test_update_google_channel_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + eventarc.UpdateGoogleChannelConfigRequest(), + {}, + ], +) async def test_update_google_channel_config_async( - transport: str = "grpc_asyncio", - request_type=eventarc.UpdateGoogleChannelConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), @@ -8037,7 +8085,7 @@ async def test_update_google_channel_config_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( @@ -8064,11 +8112,6 @@ async def test_update_google_channel_config_async( 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(), @@ -8241,8 +8284,8 @@ 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"): @@ -8253,7 +8296,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(type(client.transport.get_message_bus), "__call__") as call: @@ -8305,9 +8348,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(): @@ -8388,9 +8432,14 @@ async def test_get_message_bus_async_use_cached_wrapped_rpc( @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, @@ -8398,7 +8447,7 @@ async def test_get_message_bus_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_message_bus), "__call__") as call: @@ -8429,11 +8478,6 @@ async def test_get_message_bus_async( 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(), @@ -8580,8 +8624,8 @@ 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"): @@ -8592,7 +8636,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( @@ -8645,12 +8689,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(): @@ -8735,9 +8780,14 @@ async def test_list_message_buses_async_use_cached_wrapped_rpc( @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, @@ -8745,7 +8795,7 @@ async def test_list_message_buses_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( @@ -8772,11 +8822,6 @@ async def test_list_message_buses_async( 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(), @@ -9129,8 +9174,8 @@ async def test_list_message_buses_async_pages(): @pytest.mark.parametrize( "request_type", [ - eventarc.ListMessageBusEnrollmentsRequest, - dict, + eventarc.ListMessageBusEnrollmentsRequest(), + {}, ], ) def test_list_message_bus_enrollments(request_type, transport: str = "grpc"): @@ -9141,7 +9186,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( @@ -9194,10 +9239,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(): @@ -9283,9 +9329,15 @@ async def test_list_message_bus_enrollments_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + eventarc.ListMessageBusEnrollmentsRequest(), + {}, + ], +) async def test_list_message_bus_enrollments_async( - transport: str = "grpc_asyncio", - request_type=eventarc.ListMessageBusEnrollmentsRequest, + request_type, transport: str = "grpc_asyncio" ): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), @@ -9294,7 +9346,7 @@ async def test_list_message_bus_enrollments_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( @@ -9323,11 +9375,6 @@ async def test_list_message_bus_enrollments_async( 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(), @@ -9684,8 +9731,8 @@ async def test_list_message_bus_enrollments_async_pages(): @pytest.mark.parametrize( "request_type", [ - eventarc.CreateMessageBusRequest, - dict, + eventarc.CreateMessageBusRequest(), + {}, ], ) def test_create_message_bus(request_type, transport: str = "grpc"): @@ -9696,7 +9743,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( @@ -9742,10 +9789,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(): @@ -9840,9 +9888,14 @@ async def test_create_message_bus_async_use_cached_wrapped_rpc( @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, @@ -9850,7 +9903,7 @@ async def test_create_message_bus_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( @@ -9872,11 +9925,6 @@ async def test_create_message_bus_async( 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(), @@ -10051,8 +10099,8 @@ 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"): @@ -10063,7 +10111,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( @@ -10106,7 +10154,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] - assert args[0] == eventarc.UpdateMessageBusRequest() + request_msg = eventarc.UpdateMessageBusRequest() + assert args[0] == request_msg def test_update_message_bus_use_cached_wrapped_rpc(): @@ -10201,9 +10250,14 @@ async def test_update_message_bus_async_use_cached_wrapped_rpc( @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, @@ -10211,7 +10265,7 @@ async def test_update_message_bus_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( @@ -10233,11 +10287,6 @@ async def test_update_message_bus_async( 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(), @@ -10402,8 +10451,8 @@ 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"): @@ -10414,7 +10463,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( @@ -10460,10 +10509,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(): @@ -10558,9 +10608,14 @@ async def test_delete_message_bus_async_use_cached_wrapped_rpc( @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, @@ -10568,7 +10623,7 @@ async def test_delete_message_bus_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( @@ -10590,11 +10645,6 @@ async def test_delete_message_bus_async( 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(), @@ -10759,8 +10809,8 @@ 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"): @@ -10771,7 +10821,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(type(client.transport.get_enrollment), "__call__") as call: @@ -10827,9 +10877,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(): @@ -10910,9 +10961,14 @@ async def test_get_enrollment_async_use_cached_wrapped_rpc( @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, @@ -10920,7 +10976,7 @@ async def test_get_enrollment_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_enrollment), "__call__") as call: @@ -10955,11 +11011,6 @@ async def test_get_enrollment_async( 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(), @@ -11106,8 +11157,8 @@ 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"): @@ -11118,7 +11169,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(type(client.transport.list_enrollments), "__call__") as call: @@ -11167,12 +11218,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(): @@ -11255,9 +11307,14 @@ async def test_list_enrollments_async_use_cached_wrapped_rpc( @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, @@ -11265,7 +11322,7 @@ async def test_list_enrollments_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_enrollments), "__call__") as call: @@ -11290,11 +11347,6 @@ async def test_list_enrollments_async( 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(), @@ -11631,8 +11683,8 @@ async def test_list_enrollments_async_pages(): @pytest.mark.parametrize( "request_type", [ - eventarc.CreateEnrollmentRequest, - dict, + eventarc.CreateEnrollmentRequest(), + {}, ], ) def test_create_enrollment(request_type, transport: str = "grpc"): @@ -11643,7 +11695,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( @@ -11689,10 +11741,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(): @@ -11785,9 +11838,14 @@ async def test_create_enrollment_async_use_cached_wrapped_rpc( @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, @@ -11795,7 +11853,7 @@ async def test_create_enrollment_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( @@ -11817,11 +11875,6 @@ async def test_create_enrollment_async( 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(), @@ -11996,8 +12049,8 @@ 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"): @@ -12008,7 +12061,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( @@ -12051,7 +12104,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] - assert args[0] == eventarc.UpdateEnrollmentRequest() + request_msg = eventarc.UpdateEnrollmentRequest() + assert args[0] == request_msg def test_update_enrollment_use_cached_wrapped_rpc(): @@ -12144,9 +12198,14 @@ async def test_update_enrollment_async_use_cached_wrapped_rpc( @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, @@ -12154,7 +12213,7 @@ async def test_update_enrollment_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( @@ -12176,11 +12235,6 @@ async def test_update_enrollment_async( 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(), @@ -12345,8 +12399,8 @@ 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"): @@ -12357,7 +12411,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( @@ -12403,10 +12457,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(): @@ -12499,9 +12554,14 @@ async def test_delete_enrollment_async_use_cached_wrapped_rpc( @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, @@ -12509,7 +12569,7 @@ async def test_delete_enrollment_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( @@ -12531,11 +12591,6 @@ async def test_delete_enrollment_async( 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(), @@ -12700,8 +12755,8 @@ 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"): @@ -12712,7 +12767,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(type(client.transport.get_pipeline), "__call__") as call: @@ -12766,9 +12821,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(): @@ -12849,9 +12905,14 @@ async def test_get_pipeline_async_use_cached_wrapped_rpc( @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, @@ -12859,7 +12920,7 @@ async def test_get_pipeline_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_pipeline), "__call__") as call: @@ -12892,11 +12953,6 @@ async def test_get_pipeline_async( 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(), @@ -13039,8 +13095,8 @@ 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"): @@ -13051,7 +13107,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(type(client.transport.list_pipelines), "__call__") as call: @@ -13100,12 +13156,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(): @@ -13186,9 +13243,14 @@ async def test_list_pipelines_async_use_cached_wrapped_rpc( @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, @@ -13196,7 +13258,7 @@ async def test_list_pipelines_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_pipelines), "__call__") as call: @@ -13221,11 +13283,6 @@ async def test_list_pipelines_async( 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(), @@ -13562,8 +13619,8 @@ async def test_list_pipelines_async_pages(): @pytest.mark.parametrize( "request_type", [ - eventarc.CreatePipelineRequest, - dict, + eventarc.CreatePipelineRequest(), + {}, ], ) def test_create_pipeline(request_type, transport: str = "grpc"): @@ -13574,7 +13631,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(type(client.transport.create_pipeline), "__call__") as call: @@ -13616,10 +13673,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(): @@ -13710,9 +13768,14 @@ async def test_create_pipeline_async_use_cached_wrapped_rpc( @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, @@ -13720,7 +13783,7 @@ async def test_create_pipeline_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_pipeline), "__call__") as call: @@ -13740,11 +13803,6 @@ async def test_create_pipeline_async( 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(), @@ -13911,8 +13969,8 @@ 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"): @@ -13923,7 +13981,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(type(client.transport.update_pipeline), "__call__") as call: @@ -13962,7 +14020,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] - assert args[0] == eventarc.UpdatePipelineRequest() + request_msg = eventarc.UpdatePipelineRequest() + assert args[0] == request_msg def test_update_pipeline_use_cached_wrapped_rpc(): @@ -14053,9 +14112,14 @@ async def test_update_pipeline_async_use_cached_wrapped_rpc( @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, @@ -14063,7 +14127,7 @@ async def test_update_pipeline_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_pipeline), "__call__") as call: @@ -14083,11 +14147,6 @@ async def test_update_pipeline_async( 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(), @@ -14244,8 +14303,8 @@ 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"): @@ -14256,7 +14315,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(type(client.transport.delete_pipeline), "__call__") as call: @@ -14298,10 +14357,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(): @@ -14392,9 +14452,14 @@ async def test_delete_pipeline_async_use_cached_wrapped_rpc( @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, @@ -14402,7 +14467,7 @@ async def test_delete_pipeline_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_pipeline), "__call__") as call: @@ -14422,11 +14487,6 @@ async def test_delete_pipeline_async( 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(), @@ -14583,8 +14643,8 @@ 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"): @@ -14595,7 +14655,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( @@ -14653,9 +14713,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(): @@ -14741,8 +14802,15 @@ async def test_get_google_api_source_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + eventarc.GetGoogleApiSourceRequest(), + {}, + ], +) async def test_get_google_api_source_async( - transport: str = "grpc_asyncio", request_type=eventarc.GetGoogleApiSourceRequest + request_type, transport: str = "grpc_asyncio" ): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), @@ -14751,7 +14819,7 @@ async def test_get_google_api_source_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( @@ -14786,11 +14854,6 @@ async def test_get_google_api_source_async( 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(), @@ -14945,8 +15008,8 @@ 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"): @@ -14957,7 +15020,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( @@ -15010,12 +15073,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(): @@ -15101,8 +15165,15 @@ async def test_list_google_api_sources_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + eventarc.ListGoogleApiSourcesRequest(), + {}, + ], +) async def test_list_google_api_sources_async( - transport: str = "grpc_asyncio", request_type=eventarc.ListGoogleApiSourcesRequest + request_type, transport: str = "grpc_asyncio" ): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), @@ -15111,7 +15182,7 @@ async def test_list_google_api_sources_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( @@ -15138,11 +15209,6 @@ async def test_list_google_api_sources_async( 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(), @@ -15495,8 +15561,8 @@ async def test_list_google_api_sources_async_pages(): @pytest.mark.parametrize( "request_type", [ - eventarc.CreateGoogleApiSourceRequest, - dict, + eventarc.CreateGoogleApiSourceRequest(), + {}, ], ) def test_create_google_api_source(request_type, transport: str = "grpc"): @@ -15507,7 +15573,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( @@ -15553,10 +15619,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(): @@ -15652,8 +15719,15 @@ async def test_create_google_api_source_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + eventarc.CreateGoogleApiSourceRequest(), + {}, + ], +) async def test_create_google_api_source_async( - transport: str = "grpc_asyncio", request_type=eventarc.CreateGoogleApiSourceRequest + request_type, transport: str = "grpc_asyncio" ): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), @@ -15662,7 +15736,7 @@ async def test_create_google_api_source_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( @@ -15684,11 +15758,6 @@ async def test_create_google_api_source_async( 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(), @@ -15863,8 +15932,8 @@ 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"): @@ -15875,7 +15944,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( @@ -15918,7 +15987,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] - assert args[0] == eventarc.UpdateGoogleApiSourceRequest() + request_msg = eventarc.UpdateGoogleApiSourceRequest() + assert args[0] == request_msg def test_update_google_api_source_use_cached_wrapped_rpc(): @@ -16014,8 +16084,15 @@ async def test_update_google_api_source_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + eventarc.UpdateGoogleApiSourceRequest(), + {}, + ], +) async def test_update_google_api_source_async( - transport: str = "grpc_asyncio", request_type=eventarc.UpdateGoogleApiSourceRequest + request_type, transport: str = "grpc_asyncio" ): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), @@ -16024,7 +16101,7 @@ async def test_update_google_api_source_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( @@ -16046,11 +16123,6 @@ async def test_update_google_api_source_async( 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(), @@ -16215,8 +16287,8 @@ 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"): @@ -16227,7 +16299,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( @@ -16273,10 +16345,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(): @@ -16372,8 +16445,15 @@ async def test_delete_google_api_source_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + eventarc.DeleteGoogleApiSourceRequest(), + {}, + ], +) async def test_delete_google_api_source_async( - transport: str = "grpc_asyncio", request_type=eventarc.DeleteGoogleApiSourceRequest + request_type, transport: str = "grpc_asyncio" ): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), @@ -16382,7 +16462,7 @@ async def test_delete_google_api_source_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( @@ -16404,11 +16484,6 @@ async def test_delete_google_api_source_async( 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(), @@ -24718,7 +24793,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 @@ -24739,7 +24813,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 @@ -24760,7 +24833,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 @@ -24781,7 +24853,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 @@ -24802,7 +24873,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 @@ -24823,7 +24893,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 @@ -24844,7 +24913,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 @@ -24865,7 +24933,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 @@ -24886,7 +24953,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 @@ -24907,7 +24973,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 @@ -24928,7 +24993,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 @@ -24949,7 +25013,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 @@ -24972,7 +25035,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 @@ -24995,7 +25057,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 @@ -25018,7 +25079,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 @@ -25041,7 +25101,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 @@ -25064,7 +25123,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 @@ -25087,7 +25145,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 @@ -25108,7 +25165,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 @@ -25131,7 +25187,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 @@ -25154,7 +25209,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 @@ -25177,7 +25231,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 @@ -25200,7 +25253,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 @@ -25223,7 +25275,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 @@ -25244,7 +25295,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 @@ -25265,7 +25315,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 @@ -25288,7 +25337,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 @@ -25311,7 +25359,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 @@ -25334,7 +25381,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 @@ -25355,7 +25401,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 @@ -25376,7 +25421,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 @@ -25397,7 +25441,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 @@ -25418,7 +25461,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 @@ -25439,7 +25481,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 @@ -25462,7 +25503,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 @@ -25485,7 +25525,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 @@ -25508,7 +25547,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 @@ -25531,7 +25569,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 @@ -25554,7 +25591,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 @@ -25601,7 +25637,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 @@ -25629,7 +25664,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 @@ -25654,7 +25688,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 @@ -25679,7 +25712,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 @@ -25704,7 +25736,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 @@ -25737,7 +25768,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 @@ -25765,7 +25795,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 @@ -25790,7 +25819,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 @@ -25815,7 +25843,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 @@ -25840,7 +25867,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 @@ -25868,7 +25894,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 @@ -25896,7 +25921,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 @@ -25928,7 +25952,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 @@ -25958,7 +25981,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 @@ -25985,7 +26007,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 @@ -26012,7 +26033,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 @@ -26042,7 +26062,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 @@ -26072,7 +26091,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 @@ -26103,7 +26121,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 @@ -26133,7 +26150,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 @@ -26164,7 +26180,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 @@ -26191,7 +26206,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 @@ -26218,7 +26232,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 @@ -26245,7 +26258,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 @@ -26278,7 +26290,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 @@ -26306,7 +26317,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 @@ -26333,7 +26343,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 @@ -26360,7 +26369,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 @@ -26387,7 +26395,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 @@ -26419,7 +26426,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 @@ -26447,7 +26453,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 @@ -26472,7 +26477,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 @@ -26497,7 +26501,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 @@ -26522,7 +26525,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 @@ -26556,7 +26558,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 @@ -26586,7 +26587,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 @@ -26613,7 +26613,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 @@ -26640,7 +26639,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 @@ -26667,7 +26665,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 @@ -33540,7 +33537,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 @@ -33560,7 +33556,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 @@ -33580,7 +33575,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 @@ -33600,7 +33594,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 @@ -33620,7 +33613,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 @@ -33640,7 +33632,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 @@ -33660,7 +33651,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 @@ -33680,7 +33670,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 @@ -33700,7 +33689,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 @@ -33720,7 +33708,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 @@ -33740,7 +33727,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 @@ -33760,7 +33746,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 @@ -33782,7 +33767,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 @@ -33804,7 +33788,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 @@ -33826,7 +33809,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 @@ -33848,7 +33830,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 @@ -33870,7 +33851,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 @@ -33892,7 +33872,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 @@ -33912,7 +33891,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 @@ -33934,7 +33912,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 @@ -33956,7 +33933,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 @@ -33978,7 +33954,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 @@ -34000,7 +33975,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 @@ -34022,7 +33996,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 @@ -34042,7 +34015,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 @@ -34062,7 +34034,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 @@ -34084,7 +34055,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 @@ -34106,7 +34076,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 @@ -34128,7 +34097,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 @@ -34148,7 +34116,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 @@ -34168,7 +34135,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 @@ -34188,7 +34154,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 @@ -34208,7 +34173,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 @@ -34228,7 +34192,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 @@ -34250,7 +34213,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 @@ -34272,7 +34234,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 @@ -34294,7 +34255,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 @@ -34316,7 +34276,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 @@ -34338,7 +34297,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/google-cloud-filestore/noxfile.py b/packages/google-cloud-filestore/noxfile.py index 73847d959fad..dcb7a07707a3 100644 --- a/packages/google-cloud-filestore/noxfile.py +++ b/packages/google-cloud-filestore/noxfile.py @@ -47,7 +47,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-filestore" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-filestore/setup.py b/packages/google-cloud-filestore/setup.py index 7735ff3cdbbf..37dc387b12a4 100644 --- a/packages/google-cloud-filestore/setup.py +++ b/packages/google-cloud-filestore/setup.py @@ -44,7 +44,7 @@ # See https://github.com/googleapis/google-cloud-python/issues/12364 "google-auth >= 2.14.1, <3.0.0,!=2.24.0,!=2.25.0", "google-cloud-common >= 1.0.0, <2.0.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-filestore/testing/constraints-3.10.txt b/packages/google-cloud-filestore/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-filestore/testing/constraints-3.10.txt +++ b/packages/google-cloud-filestore/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-filestore/tests/unit/gapic/filestore_v1/test_cloud_filestore_manager.py b/packages/google-cloud-filestore/tests/unit/gapic/filestore_v1/test_cloud_filestore_manager.py index 5b75ebe29f59..0953485aef1d 100644 --- a/packages/google-cloud-filestore/tests/unit/gapic/filestore_v1/test_cloud_filestore_manager.py +++ b/packages/google-cloud-filestore/tests/unit/gapic/filestore_v1/test_cloud_filestore_manager.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 @@ -118,6 +119,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" @@ -1383,8 +1399,8 @@ def test_cloud_filestore_manager_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - cloud_filestore_service.ListInstancesRequest, - dict, + cloud_filestore_service.ListInstancesRequest(), + {}, ], ) def test_list_instances(request_type, transport: str = "grpc"): @@ -1395,7 +1411,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(type(client.transport.list_instances), "__call__") as call: @@ -1444,12 +1460,13 @@ 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_filestore_service.ListInstancesRequest( + request_msg = cloud_filestore_service.ListInstancesRequest( parent="parent_value", page_token="page_token_value", order_by="order_by_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_instances_use_cached_wrapped_rpc(): @@ -1530,10 +1547,14 @@ async def test_list_instances_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_instances_async( - transport: str = "grpc_asyncio", - request_type=cloud_filestore_service.ListInstancesRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_filestore_service.ListInstancesRequest(), + {}, + ], +) +async def test_list_instances_async(request_type, transport: str = "grpc_asyncio"): client = CloudFilestoreManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1541,7 +1562,7 @@ async def test_list_instances_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_instances), "__call__") as call: @@ -1566,11 +1587,6 @@ async def test_list_instances_async( 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 = CloudFilestoreManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1907,8 +1923,8 @@ async def test_list_instances_async_pages(): @pytest.mark.parametrize( "request_type", [ - cloud_filestore_service.GetInstanceRequest, - dict, + cloud_filestore_service.GetInstanceRequest(), + {}, ], ) def test_get_instance(request_type, transport: str = "grpc"): @@ -1919,7 +1935,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(type(client.transport.get_instance), "__call__") as call: @@ -1991,9 +2007,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_filestore_service.GetInstanceRequest( + request_msg = cloud_filestore_service.GetInstanceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_instance_use_cached_wrapped_rpc(): @@ -2074,10 +2091,14 @@ async def test_get_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_instance_async( - transport: str = "grpc_asyncio", - request_type=cloud_filestore_service.GetInstanceRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_filestore_service.GetInstanceRequest(), + {}, + ], +) +async def test_get_instance_async(request_type, transport: str = "grpc_asyncio"): client = CloudFilestoreManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2085,7 +2106,7 @@ async def test_get_instance_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_instance), "__call__") as call: @@ -2136,11 +2157,6 @@ async def test_get_instance_async( assert response.deletion_protection_reason == "deletion_protection_reason_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 = CloudFilestoreManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2287,8 +2303,8 @@ async def test_get_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_filestore_service.CreateInstanceRequest, - dict, + cloud_filestore_service.CreateInstanceRequest(), + {}, ], ) def test_create_instance(request_type, transport: str = "grpc"): @@ -2299,7 +2315,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(type(client.transport.create_instance), "__call__") as call: @@ -2341,10 +2357,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_filestore_service.CreateInstanceRequest( + request_msg = cloud_filestore_service.CreateInstanceRequest( parent="parent_value", instance_id="instance_id_value", ) + assert args[0] == request_msg def test_create_instance_use_cached_wrapped_rpc(): @@ -2435,10 +2452,14 @@ async def test_create_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_instance_async( - transport: str = "grpc_asyncio", - request_type=cloud_filestore_service.CreateInstanceRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_filestore_service.CreateInstanceRequest(), + {}, + ], +) +async def test_create_instance_async(request_type, transport: str = "grpc_asyncio"): client = CloudFilestoreManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2446,7 +2467,7 @@ async def test_create_instance_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_instance), "__call__") as call: @@ -2466,11 +2487,6 @@ async def test_create_instance_async( 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 = CloudFilestoreManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2637,8 +2653,8 @@ async def test_create_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_filestore_service.UpdateInstanceRequest, - dict, + cloud_filestore_service.UpdateInstanceRequest(), + {}, ], ) def test_update_instance(request_type, transport: str = "grpc"): @@ -2649,7 +2665,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(type(client.transport.update_instance), "__call__") as call: @@ -2688,7 +2704,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] - assert args[0] == cloud_filestore_service.UpdateInstanceRequest() + request_msg = cloud_filestore_service.UpdateInstanceRequest() + assert args[0] == request_msg def test_update_instance_use_cached_wrapped_rpc(): @@ -2779,10 +2796,14 @@ async def test_update_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_instance_async( - transport: str = "grpc_asyncio", - request_type=cloud_filestore_service.UpdateInstanceRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_filestore_service.UpdateInstanceRequest(), + {}, + ], +) +async def test_update_instance_async(request_type, transport: str = "grpc_asyncio"): client = CloudFilestoreManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2790,7 +2811,7 @@ async def test_update_instance_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_instance), "__call__") as call: @@ -2810,11 +2831,6 @@ async def test_update_instance_async( 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 = CloudFilestoreManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2971,8 +2987,8 @@ async def test_update_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_filestore_service.RestoreInstanceRequest, - dict, + cloud_filestore_service.RestoreInstanceRequest(), + {}, ], ) def test_restore_instance(request_type, transport: str = "grpc"): @@ -2983,7 +2999,7 @@ def test_restore_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(type(client.transport.restore_instance), "__call__") as call: @@ -3026,11 +3042,12 @@ def test_restore_instance_non_empty_request_with_auto_populated_field(): client.restore_instance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_filestore_service.RestoreInstanceRequest( + request_msg = cloud_filestore_service.RestoreInstanceRequest( name="name_value", file_share="file_share_value", source_backup="source_backup_value", ) + assert args[0] == request_msg def test_restore_instance_use_cached_wrapped_rpc(): @@ -3123,10 +3140,14 @@ async def test_restore_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_restore_instance_async( - transport: str = "grpc_asyncio", - request_type=cloud_filestore_service.RestoreInstanceRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_filestore_service.RestoreInstanceRequest(), + {}, + ], +) +async def test_restore_instance_async(request_type, transport: str = "grpc_asyncio"): client = CloudFilestoreManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3134,7 +3155,7 @@ async def test_restore_instance_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.restore_instance), "__call__") as call: @@ -3154,11 +3175,6 @@ async def test_restore_instance_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_restore_instance_async_from_dict(): - await test_restore_instance_async(request_type=dict) - - def test_restore_instance_field_headers(): client = CloudFilestoreManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3223,8 +3239,8 @@ async def test_restore_instance_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - cloud_filestore_service.RevertInstanceRequest, - dict, + cloud_filestore_service.RevertInstanceRequest(), + {}, ], ) def test_revert_instance(request_type, transport: str = "grpc"): @@ -3235,7 +3251,7 @@ def test_revert_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(type(client.transport.revert_instance), "__call__") as call: @@ -3277,10 +3293,11 @@ def test_revert_instance_non_empty_request_with_auto_populated_field(): client.revert_instance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_filestore_service.RevertInstanceRequest( + request_msg = cloud_filestore_service.RevertInstanceRequest( name="name_value", target_snapshot_id="target_snapshot_id_value", ) + assert args[0] == request_msg def test_revert_instance_use_cached_wrapped_rpc(): @@ -3371,10 +3388,14 @@ async def test_revert_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_revert_instance_async( - transport: str = "grpc_asyncio", - request_type=cloud_filestore_service.RevertInstanceRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_filestore_service.RevertInstanceRequest(), + {}, + ], +) +async def test_revert_instance_async(request_type, transport: str = "grpc_asyncio"): client = CloudFilestoreManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3382,7 +3403,7 @@ async def test_revert_instance_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.revert_instance), "__call__") as call: @@ -3402,11 +3423,6 @@ async def test_revert_instance_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_revert_instance_async_from_dict(): - await test_revert_instance_async(request_type=dict) - - def test_revert_instance_field_headers(): client = CloudFilestoreManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3471,8 +3487,8 @@ async def test_revert_instance_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - cloud_filestore_service.DeleteInstanceRequest, - dict, + cloud_filestore_service.DeleteInstanceRequest(), + {}, ], ) def test_delete_instance(request_type, transport: str = "grpc"): @@ -3483,7 +3499,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(type(client.transport.delete_instance), "__call__") as call: @@ -3524,9 +3540,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_filestore_service.DeleteInstanceRequest( + request_msg = cloud_filestore_service.DeleteInstanceRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_instance_use_cached_wrapped_rpc(): @@ -3617,10 +3634,14 @@ async def test_delete_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_instance_async( - transport: str = "grpc_asyncio", - request_type=cloud_filestore_service.DeleteInstanceRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_filestore_service.DeleteInstanceRequest(), + {}, + ], +) +async def test_delete_instance_async(request_type, transport: str = "grpc_asyncio"): client = CloudFilestoreManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3628,7 +3649,7 @@ async def test_delete_instance_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_instance), "__call__") as call: @@ -3648,11 +3669,6 @@ async def test_delete_instance_async( 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 = CloudFilestoreManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3799,8 +3815,8 @@ async def test_delete_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_filestore_service.ListSnapshotsRequest, - dict, + cloud_filestore_service.ListSnapshotsRequest(), + {}, ], ) def test_list_snapshots(request_type, transport: str = "grpc"): @@ -3811,7 +3827,7 @@ def test_list_snapshots(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_snapshots), "__call__") as call: @@ -3860,12 +3876,13 @@ def test_list_snapshots_non_empty_request_with_auto_populated_field(): client.list_snapshots(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_filestore_service.ListSnapshotsRequest( + request_msg = cloud_filestore_service.ListSnapshotsRequest( parent="parent_value", page_token="page_token_value", order_by="order_by_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_snapshots_use_cached_wrapped_rpc(): @@ -3946,10 +3963,14 @@ async def test_list_snapshots_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_snapshots_async( - transport: str = "grpc_asyncio", - request_type=cloud_filestore_service.ListSnapshotsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_filestore_service.ListSnapshotsRequest(), + {}, + ], +) +async def test_list_snapshots_async(request_type, transport: str = "grpc_asyncio"): client = CloudFilestoreManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3957,7 +3978,7 @@ async def test_list_snapshots_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_snapshots), "__call__") as call: @@ -3982,11 +4003,6 @@ async def test_list_snapshots_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_snapshots_async_from_dict(): - await test_list_snapshots_async(request_type=dict) - - def test_list_snapshots_field_headers(): client = CloudFilestoreManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4323,8 +4339,8 @@ async def test_list_snapshots_async_pages(): @pytest.mark.parametrize( "request_type", [ - cloud_filestore_service.GetSnapshotRequest, - dict, + cloud_filestore_service.GetSnapshotRequest(), + {}, ], ) def test_get_snapshot(request_type, transport: str = "grpc"): @@ -4335,7 +4351,7 @@ def test_get_snapshot(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_snapshot), "__call__") as call: @@ -4385,9 +4401,10 @@ def test_get_snapshot_non_empty_request_with_auto_populated_field(): client.get_snapshot(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_filestore_service.GetSnapshotRequest( + request_msg = cloud_filestore_service.GetSnapshotRequest( name="name_value", ) + assert args[0] == request_msg def test_get_snapshot_use_cached_wrapped_rpc(): @@ -4468,10 +4485,14 @@ async def test_get_snapshot_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_snapshot_async( - transport: str = "grpc_asyncio", - request_type=cloud_filestore_service.GetSnapshotRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_filestore_service.GetSnapshotRequest(), + {}, + ], +) +async def test_get_snapshot_async(request_type, transport: str = "grpc_asyncio"): client = CloudFilestoreManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4479,7 +4500,7 @@ async def test_get_snapshot_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_snapshot), "__call__") as call: @@ -4508,11 +4529,6 @@ async def test_get_snapshot_async( assert response.filesystem_used_bytes == 2267 -@pytest.mark.asyncio -async def test_get_snapshot_async_from_dict(): - await test_get_snapshot_async(request_type=dict) - - def test_get_snapshot_field_headers(): client = CloudFilestoreManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4659,8 +4675,8 @@ async def test_get_snapshot_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_filestore_service.CreateSnapshotRequest, - dict, + cloud_filestore_service.CreateSnapshotRequest(), + {}, ], ) def test_create_snapshot(request_type, transport: str = "grpc"): @@ -4671,7 +4687,7 @@ def test_create_snapshot(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_snapshot), "__call__") as call: @@ -4713,10 +4729,11 @@ def test_create_snapshot_non_empty_request_with_auto_populated_field(): client.create_snapshot(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_filestore_service.CreateSnapshotRequest( + request_msg = cloud_filestore_service.CreateSnapshotRequest( parent="parent_value", snapshot_id="snapshot_id_value", ) + assert args[0] == request_msg def test_create_snapshot_use_cached_wrapped_rpc(): @@ -4807,10 +4824,14 @@ async def test_create_snapshot_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_snapshot_async( - transport: str = "grpc_asyncio", - request_type=cloud_filestore_service.CreateSnapshotRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_filestore_service.CreateSnapshotRequest(), + {}, + ], +) +async def test_create_snapshot_async(request_type, transport: str = "grpc_asyncio"): client = CloudFilestoreManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4818,7 +4839,7 @@ async def test_create_snapshot_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_snapshot), "__call__") as call: @@ -4838,11 +4859,6 @@ async def test_create_snapshot_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_snapshot_async_from_dict(): - await test_create_snapshot_async(request_type=dict) - - def test_create_snapshot_field_headers(): client = CloudFilestoreManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5009,8 +5025,8 @@ async def test_create_snapshot_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_filestore_service.DeleteSnapshotRequest, - dict, + cloud_filestore_service.DeleteSnapshotRequest(), + {}, ], ) def test_delete_snapshot(request_type, transport: str = "grpc"): @@ -5021,7 +5037,7 @@ def test_delete_snapshot(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_snapshot), "__call__") as call: @@ -5062,9 +5078,10 @@ def test_delete_snapshot_non_empty_request_with_auto_populated_field(): client.delete_snapshot(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_filestore_service.DeleteSnapshotRequest( + request_msg = cloud_filestore_service.DeleteSnapshotRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_snapshot_use_cached_wrapped_rpc(): @@ -5155,10 +5172,14 @@ async def test_delete_snapshot_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_snapshot_async( - transport: str = "grpc_asyncio", - request_type=cloud_filestore_service.DeleteSnapshotRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_filestore_service.DeleteSnapshotRequest(), + {}, + ], +) +async def test_delete_snapshot_async(request_type, transport: str = "grpc_asyncio"): client = CloudFilestoreManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5166,7 +5187,7 @@ async def test_delete_snapshot_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_snapshot), "__call__") as call: @@ -5186,11 +5207,6 @@ async def test_delete_snapshot_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_snapshot_async_from_dict(): - await test_delete_snapshot_async(request_type=dict) - - def test_delete_snapshot_field_headers(): client = CloudFilestoreManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5337,8 +5353,8 @@ async def test_delete_snapshot_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_filestore_service.UpdateSnapshotRequest, - dict, + cloud_filestore_service.UpdateSnapshotRequest(), + {}, ], ) def test_update_snapshot(request_type, transport: str = "grpc"): @@ -5349,7 +5365,7 @@ def test_update_snapshot(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_snapshot), "__call__") as call: @@ -5388,7 +5404,8 @@ def test_update_snapshot_non_empty_request_with_auto_populated_field(): client.update_snapshot(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_filestore_service.UpdateSnapshotRequest() + request_msg = cloud_filestore_service.UpdateSnapshotRequest() + assert args[0] == request_msg def test_update_snapshot_use_cached_wrapped_rpc(): @@ -5479,10 +5496,14 @@ async def test_update_snapshot_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_snapshot_async( - transport: str = "grpc_asyncio", - request_type=cloud_filestore_service.UpdateSnapshotRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_filestore_service.UpdateSnapshotRequest(), + {}, + ], +) +async def test_update_snapshot_async(request_type, transport: str = "grpc_asyncio"): client = CloudFilestoreManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5490,7 +5511,7 @@ async def test_update_snapshot_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_snapshot), "__call__") as call: @@ -5510,11 +5531,6 @@ async def test_update_snapshot_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_snapshot_async_from_dict(): - await test_update_snapshot_async(request_type=dict) - - def test_update_snapshot_field_headers(): client = CloudFilestoreManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5671,8 +5687,8 @@ async def test_update_snapshot_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_filestore_service.ListBackupsRequest, - dict, + cloud_filestore_service.ListBackupsRequest(), + {}, ], ) def test_list_backups(request_type, transport: str = "grpc"): @@ -5683,7 +5699,7 @@ def test_list_backups(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_backups), "__call__") as call: @@ -5732,12 +5748,13 @@ def test_list_backups_non_empty_request_with_auto_populated_field(): client.list_backups(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_filestore_service.ListBackupsRequest( + request_msg = cloud_filestore_service.ListBackupsRequest( parent="parent_value", page_token="page_token_value", order_by="order_by_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_backups_use_cached_wrapped_rpc(): @@ -5818,10 +5835,14 @@ async def test_list_backups_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_backups_async( - transport: str = "grpc_asyncio", - request_type=cloud_filestore_service.ListBackupsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_filestore_service.ListBackupsRequest(), + {}, + ], +) +async def test_list_backups_async(request_type, transport: str = "grpc_asyncio"): client = CloudFilestoreManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5829,7 +5850,7 @@ async def test_list_backups_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_backups), "__call__") as call: @@ -5854,11 +5875,6 @@ async def test_list_backups_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_backups_async_from_dict(): - await test_list_backups_async(request_type=dict) - - def test_list_backups_field_headers(): client = CloudFilestoreManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6195,8 +6211,8 @@ async def test_list_backups_async_pages(): @pytest.mark.parametrize( "request_type", [ - cloud_filestore_service.GetBackupRequest, - dict, + cloud_filestore_service.GetBackupRequest(), + {}, ], ) def test_get_backup(request_type, transport: str = "grpc"): @@ -6207,7 +6223,7 @@ def test_get_backup(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_backup), "__call__") as call: @@ -6278,9 +6294,10 @@ def test_get_backup_non_empty_request_with_auto_populated_field(): client.get_backup(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_filestore_service.GetBackupRequest( + request_msg = cloud_filestore_service.GetBackupRequest( name="name_value", ) + assert args[0] == request_msg def test_get_backup_use_cached_wrapped_rpc(): @@ -6359,10 +6376,14 @@ async def test_get_backup_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_backup_async( - transport: str = "grpc_asyncio", - request_type=cloud_filestore_service.GetBackupRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_filestore_service.GetBackupRequest(), + {}, + ], +) +async def test_get_backup_async(request_type, transport: str = "grpc_asyncio"): client = CloudFilestoreManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6370,7 +6391,7 @@ async def test_get_backup_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_backup), "__call__") as call: @@ -6420,11 +6441,6 @@ async def test_get_backup_async( ) -@pytest.mark.asyncio -async def test_get_backup_async_from_dict(): - await test_get_backup_async(request_type=dict) - - def test_get_backup_field_headers(): client = CloudFilestoreManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6571,8 +6587,8 @@ async def test_get_backup_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_filestore_service.CreateBackupRequest, - dict, + cloud_filestore_service.CreateBackupRequest(), + {}, ], ) def test_create_backup(request_type, transport: str = "grpc"): @@ -6583,7 +6599,7 @@ def test_create_backup(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_backup), "__call__") as call: @@ -6625,10 +6641,11 @@ def test_create_backup_non_empty_request_with_auto_populated_field(): client.create_backup(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_filestore_service.CreateBackupRequest( + request_msg = cloud_filestore_service.CreateBackupRequest( parent="parent_value", backup_id="backup_id_value", ) + assert args[0] == request_msg def test_create_backup_use_cached_wrapped_rpc(): @@ -6719,10 +6736,14 @@ async def test_create_backup_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_backup_async( - transport: str = "grpc_asyncio", - request_type=cloud_filestore_service.CreateBackupRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_filestore_service.CreateBackupRequest(), + {}, + ], +) +async def test_create_backup_async(request_type, transport: str = "grpc_asyncio"): client = CloudFilestoreManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6730,7 +6751,7 @@ async def test_create_backup_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_backup), "__call__") as call: @@ -6750,11 +6771,6 @@ async def test_create_backup_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_backup_async_from_dict(): - await test_create_backup_async(request_type=dict) - - def test_create_backup_field_headers(): client = CloudFilestoreManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6921,8 +6937,8 @@ async def test_create_backup_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_filestore_service.DeleteBackupRequest, - dict, + cloud_filestore_service.DeleteBackupRequest(), + {}, ], ) def test_delete_backup(request_type, transport: str = "grpc"): @@ -6933,7 +6949,7 @@ def test_delete_backup(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_backup), "__call__") as call: @@ -6974,9 +6990,10 @@ def test_delete_backup_non_empty_request_with_auto_populated_field(): client.delete_backup(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_filestore_service.DeleteBackupRequest( + request_msg = cloud_filestore_service.DeleteBackupRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_backup_use_cached_wrapped_rpc(): @@ -7067,10 +7084,14 @@ async def test_delete_backup_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_backup_async( - transport: str = "grpc_asyncio", - request_type=cloud_filestore_service.DeleteBackupRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_filestore_service.DeleteBackupRequest(), + {}, + ], +) +async def test_delete_backup_async(request_type, transport: str = "grpc_asyncio"): client = CloudFilestoreManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7078,7 +7099,7 @@ async def test_delete_backup_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_backup), "__call__") as call: @@ -7098,11 +7119,6 @@ async def test_delete_backup_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_backup_async_from_dict(): - await test_delete_backup_async(request_type=dict) - - def test_delete_backup_field_headers(): client = CloudFilestoreManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7249,8 +7265,8 @@ async def test_delete_backup_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_filestore_service.UpdateBackupRequest, - dict, + cloud_filestore_service.UpdateBackupRequest(), + {}, ], ) def test_update_backup(request_type, transport: str = "grpc"): @@ -7261,7 +7277,7 @@ def test_update_backup(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_backup), "__call__") as call: @@ -7300,7 +7316,8 @@ def test_update_backup_non_empty_request_with_auto_populated_field(): client.update_backup(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_filestore_service.UpdateBackupRequest() + request_msg = cloud_filestore_service.UpdateBackupRequest() + assert args[0] == request_msg def test_update_backup_use_cached_wrapped_rpc(): @@ -7391,10 +7408,14 @@ async def test_update_backup_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_backup_async( - transport: str = "grpc_asyncio", - request_type=cloud_filestore_service.UpdateBackupRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_filestore_service.UpdateBackupRequest(), + {}, + ], +) +async def test_update_backup_async(request_type, transport: str = "grpc_asyncio"): client = CloudFilestoreManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7402,7 +7423,7 @@ async def test_update_backup_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_backup), "__call__") as call: @@ -7422,11 +7443,6 @@ async def test_update_backup_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_backup_async_from_dict(): - await test_update_backup_async(request_type=dict) - - def test_update_backup_field_headers(): client = CloudFilestoreManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7583,8 +7599,8 @@ async def test_update_backup_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_filestore_service.PromoteReplicaRequest, - dict, + cloud_filestore_service.PromoteReplicaRequest(), + {}, ], ) def test_promote_replica(request_type, transport: str = "grpc"): @@ -7595,7 +7611,7 @@ def test_promote_replica(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.promote_replica), "__call__") as call: @@ -7637,10 +7653,11 @@ def test_promote_replica_non_empty_request_with_auto_populated_field(): client.promote_replica(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_filestore_service.PromoteReplicaRequest( + request_msg = cloud_filestore_service.PromoteReplicaRequest( name="name_value", peer_instance="peer_instance_value", ) + assert args[0] == request_msg def test_promote_replica_use_cached_wrapped_rpc(): @@ -7731,10 +7748,14 @@ async def test_promote_replica_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_promote_replica_async( - transport: str = "grpc_asyncio", - request_type=cloud_filestore_service.PromoteReplicaRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_filestore_service.PromoteReplicaRequest(), + {}, + ], +) +async def test_promote_replica_async(request_type, transport: str = "grpc_asyncio"): client = CloudFilestoreManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7742,7 +7763,7 @@ async def test_promote_replica_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.promote_replica), "__call__") as call: @@ -7762,11 +7783,6 @@ async def test_promote_replica_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_promote_replica_async_from_dict(): - await test_promote_replica_async(request_type=dict) - - def test_promote_replica_field_headers(): client = CloudFilestoreManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11296,7 +11312,6 @@ def test_list_instances_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_filestore_service.ListInstancesRequest() - assert args[0] == request_msg @@ -11317,7 +11332,6 @@ def test_get_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_filestore_service.GetInstanceRequest() - assert args[0] == request_msg @@ -11338,7 +11352,6 @@ def test_create_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_filestore_service.CreateInstanceRequest() - assert args[0] == request_msg @@ -11359,7 +11372,6 @@ def test_update_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_filestore_service.UpdateInstanceRequest() - assert args[0] == request_msg @@ -11380,7 +11392,6 @@ def test_restore_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_filestore_service.RestoreInstanceRequest() - assert args[0] == request_msg @@ -11401,7 +11412,6 @@ def test_revert_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_filestore_service.RevertInstanceRequest() - assert args[0] == request_msg @@ -11422,7 +11432,6 @@ def test_delete_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_filestore_service.DeleteInstanceRequest() - assert args[0] == request_msg @@ -11443,7 +11452,6 @@ def test_list_snapshots_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_filestore_service.ListSnapshotsRequest() - assert args[0] == request_msg @@ -11464,7 +11472,6 @@ def test_get_snapshot_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_filestore_service.GetSnapshotRequest() - assert args[0] == request_msg @@ -11485,7 +11492,6 @@ def test_create_snapshot_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_filestore_service.CreateSnapshotRequest() - assert args[0] == request_msg @@ -11506,7 +11512,6 @@ def test_delete_snapshot_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_filestore_service.DeleteSnapshotRequest() - assert args[0] == request_msg @@ -11527,7 +11532,6 @@ def test_update_snapshot_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_filestore_service.UpdateSnapshotRequest() - assert args[0] == request_msg @@ -11548,7 +11552,6 @@ def test_list_backups_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_filestore_service.ListBackupsRequest() - assert args[0] == request_msg @@ -11569,7 +11572,6 @@ def test_get_backup_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_filestore_service.GetBackupRequest() - assert args[0] == request_msg @@ -11590,7 +11592,6 @@ def test_create_backup_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_filestore_service.CreateBackupRequest() - assert args[0] == request_msg @@ -11611,7 +11612,6 @@ def test_delete_backup_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_filestore_service.DeleteBackupRequest() - assert args[0] == request_msg @@ -11632,7 +11632,6 @@ def test_update_backup_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_filestore_service.UpdateBackupRequest() - assert args[0] == request_msg @@ -11653,7 +11652,6 @@ def test_promote_replica_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_filestore_service.PromoteReplicaRequest() - assert args[0] == request_msg @@ -11695,7 +11693,6 @@ async def test_list_instances_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_filestore_service.ListInstancesRequest() - assert args[0] == request_msg @@ -11736,7 +11733,6 @@ async def test_get_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_filestore_service.GetInstanceRequest() - assert args[0] == request_msg @@ -11761,7 +11757,6 @@ async def test_create_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_filestore_service.CreateInstanceRequest() - assert args[0] == request_msg @@ -11786,7 +11781,6 @@ async def test_update_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_filestore_service.UpdateInstanceRequest() - assert args[0] == request_msg @@ -11811,7 +11805,6 @@ async def test_restore_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_filestore_service.RestoreInstanceRequest() - assert args[0] == request_msg @@ -11836,7 +11829,6 @@ async def test_revert_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_filestore_service.RevertInstanceRequest() - assert args[0] == request_msg @@ -11861,7 +11853,6 @@ async def test_delete_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_filestore_service.DeleteInstanceRequest() - assert args[0] == request_msg @@ -11889,7 +11880,6 @@ async def test_list_snapshots_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_filestore_service.ListSnapshotsRequest() - assert args[0] == request_msg @@ -11919,7 +11909,6 @@ async def test_get_snapshot_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_filestore_service.GetSnapshotRequest() - assert args[0] == request_msg @@ -11944,7 +11933,6 @@ async def test_create_snapshot_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_filestore_service.CreateSnapshotRequest() - assert args[0] == request_msg @@ -11969,7 +11957,6 @@ async def test_delete_snapshot_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_filestore_service.DeleteSnapshotRequest() - assert args[0] == request_msg @@ -11994,7 +11981,6 @@ async def test_update_snapshot_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_filestore_service.UpdateSnapshotRequest() - assert args[0] == request_msg @@ -12022,7 +12008,6 @@ async def test_list_backups_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_filestore_service.ListBackupsRequest() - assert args[0] == request_msg @@ -12060,7 +12045,6 @@ async def test_get_backup_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_filestore_service.GetBackupRequest() - assert args[0] == request_msg @@ -12085,7 +12069,6 @@ async def test_create_backup_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_filestore_service.CreateBackupRequest() - assert args[0] == request_msg @@ -12110,7 +12093,6 @@ async def test_delete_backup_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_filestore_service.DeleteBackupRequest() - assert args[0] == request_msg @@ -12135,7 +12117,6 @@ async def test_update_backup_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_filestore_service.UpdateBackupRequest() - assert args[0] == request_msg @@ -12160,7 +12141,6 @@ async def test_promote_replica_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_filestore_service.PromoteReplicaRequest() - assert args[0] == request_msg @@ -15566,7 +15546,6 @@ def test_list_instances_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_filestore_service.ListInstancesRequest() - assert args[0] == request_msg @@ -15586,7 +15565,6 @@ def test_get_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_filestore_service.GetInstanceRequest() - assert args[0] == request_msg @@ -15606,7 +15584,6 @@ def test_create_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_filestore_service.CreateInstanceRequest() - assert args[0] == request_msg @@ -15626,7 +15603,6 @@ def test_update_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_filestore_service.UpdateInstanceRequest() - assert args[0] == request_msg @@ -15646,7 +15622,6 @@ def test_restore_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_filestore_service.RestoreInstanceRequest() - assert args[0] == request_msg @@ -15666,7 +15641,6 @@ def test_revert_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_filestore_service.RevertInstanceRequest() - assert args[0] == request_msg @@ -15686,7 +15660,6 @@ def test_delete_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_filestore_service.DeleteInstanceRequest() - assert args[0] == request_msg @@ -15706,7 +15679,6 @@ def test_list_snapshots_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_filestore_service.ListSnapshotsRequest() - assert args[0] == request_msg @@ -15726,7 +15698,6 @@ def test_get_snapshot_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_filestore_service.GetSnapshotRequest() - assert args[0] == request_msg @@ -15746,7 +15717,6 @@ def test_create_snapshot_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_filestore_service.CreateSnapshotRequest() - assert args[0] == request_msg @@ -15766,7 +15736,6 @@ def test_delete_snapshot_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_filestore_service.DeleteSnapshotRequest() - assert args[0] == request_msg @@ -15786,7 +15755,6 @@ def test_update_snapshot_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_filestore_service.UpdateSnapshotRequest() - assert args[0] == request_msg @@ -15806,7 +15774,6 @@ def test_list_backups_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_filestore_service.ListBackupsRequest() - assert args[0] == request_msg @@ -15826,7 +15793,6 @@ def test_get_backup_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_filestore_service.GetBackupRequest() - assert args[0] == request_msg @@ -15846,7 +15812,6 @@ def test_create_backup_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_filestore_service.CreateBackupRequest() - assert args[0] == request_msg @@ -15866,7 +15831,6 @@ def test_delete_backup_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_filestore_service.DeleteBackupRequest() - assert args[0] == request_msg @@ -15886,7 +15850,6 @@ def test_update_backup_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_filestore_service.UpdateBackupRequest() - assert args[0] == request_msg @@ -15906,7 +15869,6 @@ def test_promote_replica_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_filestore_service.PromoteReplicaRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-financialservices/noxfile.py b/packages/google-cloud-financialservices/noxfile.py index e6ddf99d4314..e9376f8c2c18 100644 --- a/packages/google-cloud-financialservices/noxfile.py +++ b/packages/google-cloud-financialservices/noxfile.py @@ -47,7 +47,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-financialservices" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-financialservices/setup.py b/packages/google-cloud-financialservices/setup.py index 1a7282829e2f..a487f81da4e8 100644 --- a/packages/google-cloud-financialservices/setup.py +++ b/packages/google-cloud-financialservices/setup.py @@ -45,7 +45,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/google-cloud-financialservices/testing/constraints-3.10.txt b/packages/google-cloud-financialservices/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-financialservices/testing/constraints-3.10.txt +++ b/packages/google-cloud-financialservices/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-financialservices/tests/unit/gapic/financialservices_v1/test_aml.py b/packages/google-cloud-financialservices/tests/unit/gapic/financialservices_v1/test_aml.py index 53e6021161cb..96b76fba91ae 100644 --- a/packages/google-cloud-financialservices/tests/unit/gapic/financialservices_v1/test_aml.py +++ b/packages/google-cloud-financialservices/tests/unit/gapic/financialservices_v1/test_aml.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 @@ -142,6 +143,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" @@ -1245,8 +1261,8 @@ def test_aml_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - instance.ListInstancesRequest, - dict, + instance.ListInstancesRequest(), + {}, ], ) def test_list_instances(request_type, transport: str = "grpc"): @@ -1257,7 +1273,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(type(client.transport.list_instances), "__call__") as call: @@ -1306,12 +1322,13 @@ 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] == instance.ListInstancesRequest( + request_msg = instance.ListInstancesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_instances_use_cached_wrapped_rpc(): @@ -1392,9 +1409,14 @@ async def test_list_instances_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_instances_async( - transport: str = "grpc_asyncio", request_type=instance.ListInstancesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + instance.ListInstancesRequest(), + {}, + ], +) +async def test_list_instances_async(request_type, transport: str = "grpc_asyncio"): client = AMLAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1402,7 +1424,7 @@ async def test_list_instances_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_instances), "__call__") as call: @@ -1427,11 +1449,6 @@ async def test_list_instances_async( 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 = AMLClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1768,8 +1785,8 @@ async def test_list_instances_async_pages(): @pytest.mark.parametrize( "request_type", [ - instance.GetInstanceRequest, - dict, + instance.GetInstanceRequest(), + {}, ], ) def test_get_instance(request_type, transport: str = "grpc"): @@ -1780,7 +1797,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(type(client.transport.get_instance), "__call__") as call: @@ -1828,9 +1845,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] == instance.GetInstanceRequest( + request_msg = instance.GetInstanceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_instance_use_cached_wrapped_rpc(): @@ -1911,9 +1929,14 @@ async def test_get_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_instance_async( - transport: str = "grpc_asyncio", request_type=instance.GetInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + instance.GetInstanceRequest(), + {}, + ], +) +async def test_get_instance_async(request_type, transport: str = "grpc_asyncio"): client = AMLAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1921,7 +1944,7 @@ async def test_get_instance_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_instance), "__call__") as call: @@ -1948,11 +1971,6 @@ async def test_get_instance_async( assert response.kms_key == "kms_key_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 = AMLClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2095,8 +2113,8 @@ async def test_get_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcf_instance.CreateInstanceRequest, - dict, + gcf_instance.CreateInstanceRequest(), + {}, ], ) def test_create_instance(request_type, transport: str = "grpc"): @@ -2107,7 +2125,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(type(client.transport.create_instance), "__call__") as call: @@ -2150,11 +2168,12 @@ 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] == gcf_instance.CreateInstanceRequest( + request_msg = gcf_instance.CreateInstanceRequest( parent="parent_value", instance_id="instance_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_instance_use_cached_wrapped_rpc(): @@ -2245,9 +2264,14 @@ async def test_create_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_instance_async( - transport: str = "grpc_asyncio", request_type=gcf_instance.CreateInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcf_instance.CreateInstanceRequest(), + {}, + ], +) +async def test_create_instance_async(request_type, transport: str = "grpc_asyncio"): client = AMLAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2255,7 +2279,7 @@ async def test_create_instance_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_instance), "__call__") as call: @@ -2275,11 +2299,6 @@ async def test_create_instance_async( 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 = AMLClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2446,8 +2465,8 @@ async def test_create_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcf_instance.UpdateInstanceRequest, - dict, + gcf_instance.UpdateInstanceRequest(), + {}, ], ) def test_update_instance(request_type, transport: str = "grpc"): @@ -2458,7 +2477,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(type(client.transport.update_instance), "__call__") as call: @@ -2499,9 +2518,10 @@ 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] == gcf_instance.UpdateInstanceRequest( + request_msg = gcf_instance.UpdateInstanceRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_instance_use_cached_wrapped_rpc(): @@ -2592,9 +2612,14 @@ async def test_update_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_instance_async( - transport: str = "grpc_asyncio", request_type=gcf_instance.UpdateInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcf_instance.UpdateInstanceRequest(), + {}, + ], +) +async def test_update_instance_async(request_type, transport: str = "grpc_asyncio"): client = AMLAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2602,7 +2627,7 @@ async def test_update_instance_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_instance), "__call__") as call: @@ -2622,11 +2647,6 @@ async def test_update_instance_async( 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 = AMLClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2783,8 +2803,8 @@ async def test_update_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - instance.DeleteInstanceRequest, - dict, + instance.DeleteInstanceRequest(), + {}, ], ) def test_delete_instance(request_type, transport: str = "grpc"): @@ -2795,7 +2815,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(type(client.transport.delete_instance), "__call__") as call: @@ -2837,10 +2857,11 @@ 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] == instance.DeleteInstanceRequest( + request_msg = instance.DeleteInstanceRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_instance_use_cached_wrapped_rpc(): @@ -2931,9 +2952,14 @@ async def test_delete_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_instance_async( - transport: str = "grpc_asyncio", request_type=instance.DeleteInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + instance.DeleteInstanceRequest(), + {}, + ], +) +async def test_delete_instance_async(request_type, transport: str = "grpc_asyncio"): client = AMLAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2941,7 +2967,7 @@ async def test_delete_instance_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_instance), "__call__") as call: @@ -2961,11 +2987,6 @@ async def test_delete_instance_async( 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 = AMLClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3112,8 +3133,8 @@ async def test_delete_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - instance.ImportRegisteredPartiesRequest, - dict, + instance.ImportRegisteredPartiesRequest(), + {}, ], ) def test_import_registered_parties(request_type, transport: str = "grpc"): @@ -3124,7 +3145,7 @@ def test_import_registered_parties(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3169,9 +3190,10 @@ def test_import_registered_parties_non_empty_request_with_auto_populated_field() client.import_registered_parties(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == instance.ImportRegisteredPartiesRequest( + request_msg = instance.ImportRegisteredPartiesRequest( name="name_value", ) + assert args[0] == request_msg def test_import_registered_parties_use_cached_wrapped_rpc(): @@ -3267,9 +3289,15 @@ async def test_import_registered_parties_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + instance.ImportRegisteredPartiesRequest(), + {}, + ], +) async def test_import_registered_parties_async( - transport: str = "grpc_asyncio", - request_type=instance.ImportRegisteredPartiesRequest, + request_type, transport: str = "grpc_asyncio" ): client = AMLAsyncClient( credentials=async_anonymous_credentials(), @@ -3278,7 +3306,7 @@ async def test_import_registered_parties_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( @@ -3300,11 +3328,6 @@ async def test_import_registered_parties_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_import_registered_parties_async_from_dict(): - await test_import_registered_parties_async(request_type=dict) - - def test_import_registered_parties_field_headers(): client = AMLClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3489,8 +3512,8 @@ async def test_import_registered_parties_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - instance.ExportRegisteredPartiesRequest, - dict, + instance.ExportRegisteredPartiesRequest(), + {}, ], ) def test_export_registered_parties(request_type, transport: str = "grpc"): @@ -3501,7 +3524,7 @@ def test_export_registered_parties(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3546,9 +3569,10 @@ def test_export_registered_parties_non_empty_request_with_auto_populated_field() client.export_registered_parties(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == instance.ExportRegisteredPartiesRequest( + request_msg = instance.ExportRegisteredPartiesRequest( name="name_value", ) + assert args[0] == request_msg def test_export_registered_parties_use_cached_wrapped_rpc(): @@ -3644,9 +3668,15 @@ async def test_export_registered_parties_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + instance.ExportRegisteredPartiesRequest(), + {}, + ], +) async def test_export_registered_parties_async( - transport: str = "grpc_asyncio", - request_type=instance.ExportRegisteredPartiesRequest, + request_type, transport: str = "grpc_asyncio" ): client = AMLAsyncClient( credentials=async_anonymous_credentials(), @@ -3655,7 +3685,7 @@ async def test_export_registered_parties_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( @@ -3677,11 +3707,6 @@ async def test_export_registered_parties_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_export_registered_parties_async_from_dict(): - await test_export_registered_parties_async(request_type=dict) - - def test_export_registered_parties_field_headers(): client = AMLClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3864,8 +3889,8 @@ async def test_export_registered_parties_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dataset.ListDatasetsRequest, - dict, + dataset.ListDatasetsRequest(), + {}, ], ) def test_list_datasets(request_type, transport: str = "grpc"): @@ -3876,7 +3901,7 @@ def test_list_datasets(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_datasets), "__call__") as call: @@ -3925,12 +3950,13 @@ def test_list_datasets_non_empty_request_with_auto_populated_field(): client.list_datasets(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataset.ListDatasetsRequest( + request_msg = dataset.ListDatasetsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_datasets_use_cached_wrapped_rpc(): @@ -4011,9 +4037,14 @@ async def test_list_datasets_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_datasets_async( - transport: str = "grpc_asyncio", request_type=dataset.ListDatasetsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataset.ListDatasetsRequest(), + {}, + ], +) +async def test_list_datasets_async(request_type, transport: str = "grpc_asyncio"): client = AMLAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4021,7 +4052,7 @@ async def test_list_datasets_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_datasets), "__call__") as call: @@ -4046,11 +4077,6 @@ async def test_list_datasets_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_datasets_async_from_dict(): - await test_list_datasets_async(request_type=dict) - - def test_list_datasets_field_headers(): client = AMLClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4387,8 +4413,8 @@ async def test_list_datasets_async_pages(): @pytest.mark.parametrize( "request_type", [ - dataset.GetDatasetRequest, - dict, + dataset.GetDatasetRequest(), + {}, ], ) def test_get_dataset(request_type, transport: str = "grpc"): @@ -4399,7 +4425,7 @@ def test_get_dataset(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_dataset), "__call__") as call: @@ -4445,9 +4471,10 @@ def test_get_dataset_non_empty_request_with_auto_populated_field(): client.get_dataset(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataset.GetDatasetRequest( + request_msg = dataset.GetDatasetRequest( name="name_value", ) + assert args[0] == request_msg def test_get_dataset_use_cached_wrapped_rpc(): @@ -4528,9 +4555,14 @@ async def test_get_dataset_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_dataset_async( - transport: str = "grpc_asyncio", request_type=dataset.GetDatasetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataset.GetDatasetRequest(), + {}, + ], +) +async def test_get_dataset_async(request_type, transport: str = "grpc_asyncio"): client = AMLAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4538,7 +4570,7 @@ async def test_get_dataset_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_dataset), "__call__") as call: @@ -4563,11 +4595,6 @@ async def test_get_dataset_async( assert response.state == dataset.Dataset.State.CREATING -@pytest.mark.asyncio -async def test_get_dataset_async_from_dict(): - await test_get_dataset_async(request_type=dict) - - def test_get_dataset_field_headers(): client = AMLClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4710,8 +4737,8 @@ async def test_get_dataset_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcf_dataset.CreateDatasetRequest, - dict, + gcf_dataset.CreateDatasetRequest(), + {}, ], ) def test_create_dataset(request_type, transport: str = "grpc"): @@ -4722,7 +4749,7 @@ def test_create_dataset(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_dataset), "__call__") as call: @@ -4765,11 +4792,12 @@ def test_create_dataset_non_empty_request_with_auto_populated_field(): client.create_dataset(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcf_dataset.CreateDatasetRequest( + request_msg = gcf_dataset.CreateDatasetRequest( parent="parent_value", dataset_id="dataset_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_dataset_use_cached_wrapped_rpc(): @@ -4860,9 +4888,14 @@ async def test_create_dataset_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_dataset_async( - transport: str = "grpc_asyncio", request_type=gcf_dataset.CreateDatasetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcf_dataset.CreateDatasetRequest(), + {}, + ], +) +async def test_create_dataset_async(request_type, transport: str = "grpc_asyncio"): client = AMLAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4870,7 +4903,7 @@ async def test_create_dataset_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_dataset), "__call__") as call: @@ -4890,11 +4923,6 @@ async def test_create_dataset_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_dataset_async_from_dict(): - await test_create_dataset_async(request_type=dict) - - def test_create_dataset_field_headers(): client = AMLClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5061,8 +5089,8 @@ async def test_create_dataset_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcf_dataset.UpdateDatasetRequest, - dict, + gcf_dataset.UpdateDatasetRequest(), + {}, ], ) def test_update_dataset(request_type, transport: str = "grpc"): @@ -5073,7 +5101,7 @@ def test_update_dataset(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_dataset), "__call__") as call: @@ -5114,9 +5142,10 @@ def test_update_dataset_non_empty_request_with_auto_populated_field(): client.update_dataset(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcf_dataset.UpdateDatasetRequest( + request_msg = gcf_dataset.UpdateDatasetRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_dataset_use_cached_wrapped_rpc(): @@ -5207,9 +5236,14 @@ async def test_update_dataset_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_dataset_async( - transport: str = "grpc_asyncio", request_type=gcf_dataset.UpdateDatasetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcf_dataset.UpdateDatasetRequest(), + {}, + ], +) +async def test_update_dataset_async(request_type, transport: str = "grpc_asyncio"): client = AMLAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5217,7 +5251,7 @@ async def test_update_dataset_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_dataset), "__call__") as call: @@ -5237,11 +5271,6 @@ async def test_update_dataset_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_dataset_async_from_dict(): - await test_update_dataset_async(request_type=dict) - - def test_update_dataset_field_headers(): client = AMLClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5398,8 +5427,8 @@ async def test_update_dataset_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dataset.DeleteDatasetRequest, - dict, + dataset.DeleteDatasetRequest(), + {}, ], ) def test_delete_dataset(request_type, transport: str = "grpc"): @@ -5410,7 +5439,7 @@ def test_delete_dataset(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_dataset), "__call__") as call: @@ -5452,10 +5481,11 @@ def test_delete_dataset_non_empty_request_with_auto_populated_field(): client.delete_dataset(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dataset.DeleteDatasetRequest( + request_msg = dataset.DeleteDatasetRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_dataset_use_cached_wrapped_rpc(): @@ -5546,9 +5576,14 @@ async def test_delete_dataset_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_dataset_async( - transport: str = "grpc_asyncio", request_type=dataset.DeleteDatasetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dataset.DeleteDatasetRequest(), + {}, + ], +) +async def test_delete_dataset_async(request_type, transport: str = "grpc_asyncio"): client = AMLAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5556,7 +5591,7 @@ async def test_delete_dataset_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_dataset), "__call__") as call: @@ -5576,11 +5611,6 @@ async def test_delete_dataset_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_dataset_async_from_dict(): - await test_delete_dataset_async(request_type=dict) - - def test_delete_dataset_field_headers(): client = AMLClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5727,8 +5757,8 @@ async def test_delete_dataset_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - model.ListModelsRequest, - dict, + model.ListModelsRequest(), + {}, ], ) def test_list_models(request_type, transport: str = "grpc"): @@ -5739,7 +5769,7 @@ def test_list_models(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_models), "__call__") as call: @@ -5788,12 +5818,13 @@ def test_list_models_non_empty_request_with_auto_populated_field(): client.list_models(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == model.ListModelsRequest( + request_msg = model.ListModelsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_models_use_cached_wrapped_rpc(): @@ -5874,9 +5905,14 @@ async def test_list_models_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_models_async( - transport: str = "grpc_asyncio", request_type=model.ListModelsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + model.ListModelsRequest(), + {}, + ], +) +async def test_list_models_async(request_type, transport: str = "grpc_asyncio"): client = AMLAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5884,7 +5920,7 @@ async def test_list_models_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_models), "__call__") as call: @@ -5909,11 +5945,6 @@ async def test_list_models_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_models_async_from_dict(): - await test_list_models_async(request_type=dict) - - def test_list_models_field_headers(): client = AMLClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6250,8 +6281,8 @@ async def test_list_models_async_pages(): @pytest.mark.parametrize( "request_type", [ - model.GetModelRequest, - dict, + model.GetModelRequest(), + {}, ], ) def test_get_model(request_type, transport: str = "grpc"): @@ -6262,7 +6293,7 @@ def test_get_model(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_model), "__call__") as call: @@ -6316,9 +6347,10 @@ def test_get_model_non_empty_request_with_auto_populated_field(): client.get_model(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == model.GetModelRequest( + request_msg = model.GetModelRequest( name="name_value", ) + assert args[0] == request_msg def test_get_model_use_cached_wrapped_rpc(): @@ -6397,9 +6429,14 @@ async def test_get_model_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_model_async( - transport: str = "grpc_asyncio", request_type=model.GetModelRequest -): +@pytest.mark.parametrize( + "request_type", + [ + model.GetModelRequest(), + {}, + ], +) +async def test_get_model_async(request_type, transport: str = "grpc_asyncio"): client = AMLAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6407,7 +6444,7 @@ async def test_get_model_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_model), "__call__") as call: @@ -6440,11 +6477,6 @@ async def test_get_model_async( assert response.line_of_business == line_of_business.LineOfBusiness.COMMERCIAL -@pytest.mark.asyncio -async def test_get_model_async_from_dict(): - await test_get_model_async(request_type=dict) - - def test_get_model_field_headers(): client = AMLClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6587,8 +6619,8 @@ async def test_get_model_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcf_model.CreateModelRequest, - dict, + gcf_model.CreateModelRequest(), + {}, ], ) def test_create_model(request_type, transport: str = "grpc"): @@ -6599,7 +6631,7 @@ def test_create_model(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_model), "__call__") as call: @@ -6642,11 +6674,12 @@ def test_create_model_non_empty_request_with_auto_populated_field(): client.create_model(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcf_model.CreateModelRequest( + request_msg = gcf_model.CreateModelRequest( parent="parent_value", model_id="model_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_model_use_cached_wrapped_rpc(): @@ -6737,9 +6770,14 @@ async def test_create_model_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_model_async( - transport: str = "grpc_asyncio", request_type=gcf_model.CreateModelRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcf_model.CreateModelRequest(), + {}, + ], +) +async def test_create_model_async(request_type, transport: str = "grpc_asyncio"): client = AMLAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6747,7 +6785,7 @@ async def test_create_model_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_model), "__call__") as call: @@ -6767,11 +6805,6 @@ async def test_create_model_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_model_async_from_dict(): - await test_create_model_async(request_type=dict) - - def test_create_model_field_headers(): client = AMLClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6938,8 +6971,8 @@ async def test_create_model_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcf_model.UpdateModelRequest, - dict, + gcf_model.UpdateModelRequest(), + {}, ], ) def test_update_model(request_type, transport: str = "grpc"): @@ -6950,7 +6983,7 @@ def test_update_model(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_model), "__call__") as call: @@ -6991,9 +7024,10 @@ def test_update_model_non_empty_request_with_auto_populated_field(): client.update_model(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcf_model.UpdateModelRequest( + request_msg = gcf_model.UpdateModelRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_model_use_cached_wrapped_rpc(): @@ -7084,9 +7118,14 @@ async def test_update_model_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_model_async( - transport: str = "grpc_asyncio", request_type=gcf_model.UpdateModelRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcf_model.UpdateModelRequest(), + {}, + ], +) +async def test_update_model_async(request_type, transport: str = "grpc_asyncio"): client = AMLAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7094,7 +7133,7 @@ async def test_update_model_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_model), "__call__") as call: @@ -7114,11 +7153,6 @@ async def test_update_model_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_model_async_from_dict(): - await test_update_model_async(request_type=dict) - - def test_update_model_field_headers(): client = AMLClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7275,8 +7309,8 @@ async def test_update_model_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcf_model.ExportModelMetadataRequest, - dict, + gcf_model.ExportModelMetadataRequest(), + {}, ], ) def test_export_model_metadata(request_type, transport: str = "grpc"): @@ -7287,7 +7321,7 @@ def test_export_model_metadata(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7332,9 +7366,10 @@ def test_export_model_metadata_non_empty_request_with_auto_populated_field(): client.export_model_metadata(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcf_model.ExportModelMetadataRequest( + request_msg = gcf_model.ExportModelMetadataRequest( model="model_value", ) + assert args[0] == request_msg def test_export_model_metadata_use_cached_wrapped_rpc(): @@ -7430,8 +7465,15 @@ async def test_export_model_metadata_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcf_model.ExportModelMetadataRequest(), + {}, + ], +) async def test_export_model_metadata_async( - transport: str = "grpc_asyncio", request_type=gcf_model.ExportModelMetadataRequest + request_type, transport: str = "grpc_asyncio" ): client = AMLAsyncClient( credentials=async_anonymous_credentials(), @@ -7440,7 +7482,7 @@ async def test_export_model_metadata_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( @@ -7462,11 +7504,6 @@ async def test_export_model_metadata_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_export_model_metadata_async_from_dict(): - await test_export_model_metadata_async(request_type=dict) - - def test_export_model_metadata_field_headers(): client = AMLClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7639,8 +7676,8 @@ async def test_export_model_metadata_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - model.DeleteModelRequest, - dict, + model.DeleteModelRequest(), + {}, ], ) def test_delete_model(request_type, transport: str = "grpc"): @@ -7651,7 +7688,7 @@ def test_delete_model(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_model), "__call__") as call: @@ -7693,10 +7730,11 @@ def test_delete_model_non_empty_request_with_auto_populated_field(): client.delete_model(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == model.DeleteModelRequest( + request_msg = model.DeleteModelRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_model_use_cached_wrapped_rpc(): @@ -7787,9 +7825,14 @@ async def test_delete_model_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_model_async( - transport: str = "grpc_asyncio", request_type=model.DeleteModelRequest -): +@pytest.mark.parametrize( + "request_type", + [ + model.DeleteModelRequest(), + {}, + ], +) +async def test_delete_model_async(request_type, transport: str = "grpc_asyncio"): client = AMLAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7797,7 +7840,7 @@ async def test_delete_model_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_model), "__call__") as call: @@ -7817,11 +7860,6 @@ async def test_delete_model_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_model_async_from_dict(): - await test_delete_model_async(request_type=dict) - - def test_delete_model_field_headers(): client = AMLClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7968,8 +8006,8 @@ async def test_delete_model_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - engine_config.ListEngineConfigsRequest, - dict, + engine_config.ListEngineConfigsRequest(), + {}, ], ) def test_list_engine_configs(request_type, transport: str = "grpc"): @@ -7980,7 +8018,7 @@ def test_list_engine_configs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8033,12 +8071,13 @@ def test_list_engine_configs_non_empty_request_with_auto_populated_field(): client.list_engine_configs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == engine_config.ListEngineConfigsRequest( + request_msg = engine_config.ListEngineConfigsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_engine_configs_use_cached_wrapped_rpc(): @@ -8123,9 +8162,14 @@ async def test_list_engine_configs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_engine_configs_async( - transport: str = "grpc_asyncio", request_type=engine_config.ListEngineConfigsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + engine_config.ListEngineConfigsRequest(), + {}, + ], +) +async def test_list_engine_configs_async(request_type, transport: str = "grpc_asyncio"): client = AMLAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8133,7 +8177,7 @@ async def test_list_engine_configs_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( @@ -8160,11 +8204,6 @@ async def test_list_engine_configs_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_engine_configs_async_from_dict(): - await test_list_engine_configs_async(request_type=dict) - - def test_list_engine_configs_field_headers(): client = AMLClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8517,8 +8556,8 @@ async def test_list_engine_configs_async_pages(): @pytest.mark.parametrize( "request_type", [ - engine_config.GetEngineConfigRequest, - dict, + engine_config.GetEngineConfigRequest(), + {}, ], ) def test_get_engine_config(request_type, transport: str = "grpc"): @@ -8529,7 +8568,7 @@ def test_get_engine_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( @@ -8588,9 +8627,10 @@ def test_get_engine_config_non_empty_request_with_auto_populated_field(): client.get_engine_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == engine_config.GetEngineConfigRequest( + request_msg = engine_config.GetEngineConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_engine_config_use_cached_wrapped_rpc(): @@ -8673,9 +8713,14 @@ async def test_get_engine_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_engine_config_async( - transport: str = "grpc_asyncio", request_type=engine_config.GetEngineConfigRequest -): +@pytest.mark.parametrize( + "request_type", + [ + engine_config.GetEngineConfigRequest(), + {}, + ], +) +async def test_get_engine_config_async(request_type, transport: str = "grpc_asyncio"): client = AMLAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8683,7 +8728,7 @@ async def test_get_engine_config_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( @@ -8719,11 +8764,6 @@ async def test_get_engine_config_async( ) -@pytest.mark.asyncio -async def test_get_engine_config_async_from_dict(): - await test_get_engine_config_async(request_type=dict) - - def test_get_engine_config_field_headers(): client = AMLClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8878,8 +8918,8 @@ async def test_get_engine_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcf_engine_config.CreateEngineConfigRequest, - dict, + gcf_engine_config.CreateEngineConfigRequest(), + {}, ], ) def test_create_engine_config(request_type, transport: str = "grpc"): @@ -8890,7 +8930,7 @@ def test_create_engine_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( @@ -8937,11 +8977,12 @@ def test_create_engine_config_non_empty_request_with_auto_populated_field(): client.create_engine_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcf_engine_config.CreateEngineConfigRequest( + request_msg = gcf_engine_config.CreateEngineConfigRequest( parent="parent_value", engine_config_id="engine_config_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_engine_config_use_cached_wrapped_rpc(): @@ -9036,9 +9077,15 @@ async def test_create_engine_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcf_engine_config.CreateEngineConfigRequest(), + {}, + ], +) async def test_create_engine_config_async( - transport: str = "grpc_asyncio", - request_type=gcf_engine_config.CreateEngineConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = AMLAsyncClient( credentials=async_anonymous_credentials(), @@ -9047,7 +9094,7 @@ async def test_create_engine_config_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( @@ -9069,11 +9116,6 @@ async def test_create_engine_config_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_engine_config_async_from_dict(): - await test_create_engine_config_async(request_type=dict) - - def test_create_engine_config_field_headers(): client = AMLClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9248,8 +9290,8 @@ async def test_create_engine_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcf_engine_config.UpdateEngineConfigRequest, - dict, + gcf_engine_config.UpdateEngineConfigRequest(), + {}, ], ) def test_update_engine_config(request_type, transport: str = "grpc"): @@ -9260,7 +9302,7 @@ def test_update_engine_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( @@ -9305,9 +9347,10 @@ def test_update_engine_config_non_empty_request_with_auto_populated_field(): client.update_engine_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcf_engine_config.UpdateEngineConfigRequest( + request_msg = gcf_engine_config.UpdateEngineConfigRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_engine_config_use_cached_wrapped_rpc(): @@ -9402,9 +9445,15 @@ async def test_update_engine_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcf_engine_config.UpdateEngineConfigRequest(), + {}, + ], +) async def test_update_engine_config_async( - transport: str = "grpc_asyncio", - request_type=gcf_engine_config.UpdateEngineConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = AMLAsyncClient( credentials=async_anonymous_credentials(), @@ -9413,7 +9462,7 @@ async def test_update_engine_config_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( @@ -9435,11 +9484,6 @@ async def test_update_engine_config_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_engine_config_async_from_dict(): - await test_update_engine_config_async(request_type=dict) - - def test_update_engine_config_field_headers(): client = AMLClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9604,8 +9648,8 @@ async def test_update_engine_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcf_engine_config.ExportEngineConfigMetadataRequest, - dict, + gcf_engine_config.ExportEngineConfigMetadataRequest(), + {}, ], ) def test_export_engine_config_metadata(request_type, transport: str = "grpc"): @@ -9616,7 +9660,7 @@ def test_export_engine_config_metadata(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9661,9 +9705,10 @@ def test_export_engine_config_metadata_non_empty_request_with_auto_populated_fie client.export_engine_config_metadata(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcf_engine_config.ExportEngineConfigMetadataRequest( + request_msg = gcf_engine_config.ExportEngineConfigMetadataRequest( engine_config="engine_config_value", ) + assert args[0] == request_msg def test_export_engine_config_metadata_use_cached_wrapped_rpc(): @@ -9759,9 +9804,15 @@ async def test_export_engine_config_metadata_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcf_engine_config.ExportEngineConfigMetadataRequest(), + {}, + ], +) async def test_export_engine_config_metadata_async( - transport: str = "grpc_asyncio", - request_type=gcf_engine_config.ExportEngineConfigMetadataRequest, + request_type, transport: str = "grpc_asyncio" ): client = AMLAsyncClient( credentials=async_anonymous_credentials(), @@ -9770,7 +9821,7 @@ async def test_export_engine_config_metadata_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( @@ -9792,11 +9843,6 @@ async def test_export_engine_config_metadata_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_export_engine_config_metadata_async_from_dict(): - await test_export_engine_config_metadata_async(request_type=dict) - - def test_export_engine_config_metadata_field_headers(): client = AMLClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9969,8 +10015,8 @@ async def test_export_engine_config_metadata_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - engine_config.DeleteEngineConfigRequest, - dict, + engine_config.DeleteEngineConfigRequest(), + {}, ], ) def test_delete_engine_config(request_type, transport: str = "grpc"): @@ -9981,7 +10027,7 @@ def test_delete_engine_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( @@ -10027,10 +10073,11 @@ def test_delete_engine_config_non_empty_request_with_auto_populated_field(): client.delete_engine_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == engine_config.DeleteEngineConfigRequest( + request_msg = engine_config.DeleteEngineConfigRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_engine_config_use_cached_wrapped_rpc(): @@ -10125,9 +10172,15 @@ async def test_delete_engine_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + engine_config.DeleteEngineConfigRequest(), + {}, + ], +) async def test_delete_engine_config_async( - transport: str = "grpc_asyncio", - request_type=engine_config.DeleteEngineConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = AMLAsyncClient( credentials=async_anonymous_credentials(), @@ -10136,7 +10189,7 @@ async def test_delete_engine_config_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( @@ -10158,11 +10211,6 @@ async def test_delete_engine_config_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_engine_config_async_from_dict(): - await test_delete_engine_config_async(request_type=dict) - - def test_delete_engine_config_field_headers(): client = AMLClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10317,8 +10365,8 @@ async def test_delete_engine_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - engine_version.GetEngineVersionRequest, - dict, + engine_version.GetEngineVersionRequest(), + {}, ], ) def test_get_engine_version(request_type, transport: str = "grpc"): @@ -10329,7 +10377,7 @@ def test_get_engine_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10381,9 +10429,10 @@ def test_get_engine_version_non_empty_request_with_auto_populated_field(): client.get_engine_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == engine_version.GetEngineVersionRequest( + request_msg = engine_version.GetEngineVersionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_engine_version_use_cached_wrapped_rpc(): @@ -10468,9 +10517,14 @@ async def test_get_engine_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_engine_version_async( - transport: str = "grpc_asyncio", request_type=engine_version.GetEngineVersionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + engine_version.GetEngineVersionRequest(), + {}, + ], +) +async def test_get_engine_version_async(request_type, transport: str = "grpc_asyncio"): client = AMLAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10478,7 +10532,7 @@ async def test_get_engine_version_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( @@ -10507,11 +10561,6 @@ async def test_get_engine_version_async( assert response.line_of_business == line_of_business.LineOfBusiness.COMMERCIAL -@pytest.mark.asyncio -async def test_get_engine_version_async_from_dict(): - await test_get_engine_version_async(request_type=dict) - - def test_get_engine_version_field_headers(): client = AMLClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10666,8 +10715,8 @@ async def test_get_engine_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - engine_version.ListEngineVersionsRequest, - dict, + engine_version.ListEngineVersionsRequest(), + {}, ], ) def test_list_engine_versions(request_type, transport: str = "grpc"): @@ -10678,7 +10727,7 @@ def test_list_engine_versions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10731,12 +10780,13 @@ def test_list_engine_versions_non_empty_request_with_auto_populated_field(): client.list_engine_versions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == engine_version.ListEngineVersionsRequest( + request_msg = engine_version.ListEngineVersionsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_engine_versions_use_cached_wrapped_rpc(): @@ -10821,9 +10871,15 @@ async def test_list_engine_versions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + engine_version.ListEngineVersionsRequest(), + {}, + ], +) async def test_list_engine_versions_async( - transport: str = "grpc_asyncio", - request_type=engine_version.ListEngineVersionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = AMLAsyncClient( credentials=async_anonymous_credentials(), @@ -10832,7 +10888,7 @@ async def test_list_engine_versions_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( @@ -10859,11 +10915,6 @@ async def test_list_engine_versions_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_engine_versions_async_from_dict(): - await test_list_engine_versions_async(request_type=dict) - - def test_list_engine_versions_field_headers(): client = AMLClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11216,8 +11267,8 @@ async def test_list_engine_versions_async_pages(): @pytest.mark.parametrize( "request_type", [ - prediction_result.ListPredictionResultsRequest, - dict, + prediction_result.ListPredictionResultsRequest(), + {}, ], ) def test_list_prediction_results(request_type, transport: str = "grpc"): @@ -11228,7 +11279,7 @@ def test_list_prediction_results(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11281,12 +11332,13 @@ def test_list_prediction_results_non_empty_request_with_auto_populated_field(): client.list_prediction_results(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == prediction_result.ListPredictionResultsRequest( + request_msg = prediction_result.ListPredictionResultsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_prediction_results_use_cached_wrapped_rpc(): @@ -11372,9 +11424,15 @@ async def test_list_prediction_results_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + prediction_result.ListPredictionResultsRequest(), + {}, + ], +) async def test_list_prediction_results_async( - transport: str = "grpc_asyncio", - request_type=prediction_result.ListPredictionResultsRequest, + request_type, transport: str = "grpc_asyncio" ): client = AMLAsyncClient( credentials=async_anonymous_credentials(), @@ -11383,7 +11441,7 @@ async def test_list_prediction_results_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( @@ -11410,11 +11468,6 @@ async def test_list_prediction_results_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_prediction_results_async_from_dict(): - await test_list_prediction_results_async(request_type=dict) - - def test_list_prediction_results_field_headers(): client = AMLClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11767,8 +11820,8 @@ async def test_list_prediction_results_async_pages(): @pytest.mark.parametrize( "request_type", [ - prediction_result.GetPredictionResultRequest, - dict, + prediction_result.GetPredictionResultRequest(), + {}, ], ) def test_get_prediction_result(request_type, transport: str = "grpc"): @@ -11779,7 +11832,7 @@ def test_get_prediction_result(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11837,9 +11890,10 @@ def test_get_prediction_result_non_empty_request_with_auto_populated_field(): client.get_prediction_result(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == prediction_result.GetPredictionResultRequest( + request_msg = prediction_result.GetPredictionResultRequest( name="name_value", ) + assert args[0] == request_msg def test_get_prediction_result_use_cached_wrapped_rpc(): @@ -11925,9 +11979,15 @@ async def test_get_prediction_result_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + prediction_result.GetPredictionResultRequest(), + {}, + ], +) async def test_get_prediction_result_async( - transport: str = "grpc_asyncio", - request_type=prediction_result.GetPredictionResultRequest, + request_type, transport: str = "grpc_asyncio" ): client = AMLAsyncClient( credentials=async_anonymous_credentials(), @@ -11936,7 +11996,7 @@ async def test_get_prediction_result_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( @@ -11971,11 +12031,6 @@ async def test_get_prediction_result_async( assert response.line_of_business == line_of_business.LineOfBusiness.COMMERCIAL -@pytest.mark.asyncio -async def test_get_prediction_result_async_from_dict(): - await test_get_prediction_result_async(request_type=dict) - - def test_get_prediction_result_field_headers(): client = AMLClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12130,8 +12185,8 @@ async def test_get_prediction_result_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcf_prediction_result.CreatePredictionResultRequest, - dict, + gcf_prediction_result.CreatePredictionResultRequest(), + {}, ], ) def test_create_prediction_result(request_type, transport: str = "grpc"): @@ -12142,7 +12197,7 @@ def test_create_prediction_result(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -12189,11 +12244,12 @@ def test_create_prediction_result_non_empty_request_with_auto_populated_field(): client.create_prediction_result(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcf_prediction_result.CreatePredictionResultRequest( + request_msg = gcf_prediction_result.CreatePredictionResultRequest( parent="parent_value", prediction_result_id="prediction_result_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_prediction_result_use_cached_wrapped_rpc(): @@ -12289,9 +12345,15 @@ async def test_create_prediction_result_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcf_prediction_result.CreatePredictionResultRequest(), + {}, + ], +) async def test_create_prediction_result_async( - transport: str = "grpc_asyncio", - request_type=gcf_prediction_result.CreatePredictionResultRequest, + request_type, transport: str = "grpc_asyncio" ): client = AMLAsyncClient( credentials=async_anonymous_credentials(), @@ -12300,7 +12362,7 @@ async def test_create_prediction_result_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( @@ -12322,11 +12384,6 @@ async def test_create_prediction_result_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_prediction_result_async_from_dict(): - await test_create_prediction_result_async(request_type=dict) - - def test_create_prediction_result_field_headers(): client = AMLClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12501,8 +12558,8 @@ async def test_create_prediction_result_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcf_prediction_result.UpdatePredictionResultRequest, - dict, + gcf_prediction_result.UpdatePredictionResultRequest(), + {}, ], ) def test_update_prediction_result(request_type, transport: str = "grpc"): @@ -12513,7 +12570,7 @@ def test_update_prediction_result(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -12558,9 +12615,10 @@ def test_update_prediction_result_non_empty_request_with_auto_populated_field(): client.update_prediction_result(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcf_prediction_result.UpdatePredictionResultRequest( + request_msg = gcf_prediction_result.UpdatePredictionResultRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_prediction_result_use_cached_wrapped_rpc(): @@ -12656,9 +12714,15 @@ async def test_update_prediction_result_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcf_prediction_result.UpdatePredictionResultRequest(), + {}, + ], +) async def test_update_prediction_result_async( - transport: str = "grpc_asyncio", - request_type=gcf_prediction_result.UpdatePredictionResultRequest, + request_type, transport: str = "grpc_asyncio" ): client = AMLAsyncClient( credentials=async_anonymous_credentials(), @@ -12667,7 +12731,7 @@ async def test_update_prediction_result_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( @@ -12689,11 +12753,6 @@ async def test_update_prediction_result_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_prediction_result_async_from_dict(): - await test_update_prediction_result_async(request_type=dict) - - def test_update_prediction_result_field_headers(): client = AMLClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12858,8 +12917,8 @@ async def test_update_prediction_result_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcf_prediction_result.ExportPredictionResultMetadataRequest, - dict, + gcf_prediction_result.ExportPredictionResultMetadataRequest(), + {}, ], ) def test_export_prediction_result_metadata(request_type, transport: str = "grpc"): @@ -12870,7 +12929,7 @@ def test_export_prediction_result_metadata(request_type, transport: str = "grpc" # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -12915,9 +12974,10 @@ def test_export_prediction_result_metadata_non_empty_request_with_auto_populated client.export_prediction_result_metadata(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcf_prediction_result.ExportPredictionResultMetadataRequest( + request_msg = gcf_prediction_result.ExportPredictionResultMetadataRequest( prediction_result="prediction_result_value", ) + assert args[0] == request_msg def test_export_prediction_result_metadata_use_cached_wrapped_rpc(): @@ -13013,9 +13073,15 @@ async def test_export_prediction_result_metadata_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcf_prediction_result.ExportPredictionResultMetadataRequest(), + {}, + ], +) async def test_export_prediction_result_metadata_async( - transport: str = "grpc_asyncio", - request_type=gcf_prediction_result.ExportPredictionResultMetadataRequest, + request_type, transport: str = "grpc_asyncio" ): client = AMLAsyncClient( credentials=async_anonymous_credentials(), @@ -13024,7 +13090,7 @@ async def test_export_prediction_result_metadata_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( @@ -13046,11 +13112,6 @@ async def test_export_prediction_result_metadata_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_export_prediction_result_metadata_async_from_dict(): - await test_export_prediction_result_metadata_async(request_type=dict) - - def test_export_prediction_result_metadata_field_headers(): client = AMLClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13223,8 +13284,8 @@ async def test_export_prediction_result_metadata_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - prediction_result.DeletePredictionResultRequest, - dict, + prediction_result.DeletePredictionResultRequest(), + {}, ], ) def test_delete_prediction_result(request_type, transport: str = "grpc"): @@ -13235,7 +13296,7 @@ def test_delete_prediction_result(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -13281,10 +13342,11 @@ def test_delete_prediction_result_non_empty_request_with_auto_populated_field(): client.delete_prediction_result(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == prediction_result.DeletePredictionResultRequest( + request_msg = prediction_result.DeletePredictionResultRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_prediction_result_use_cached_wrapped_rpc(): @@ -13380,9 +13442,15 @@ async def test_delete_prediction_result_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + prediction_result.DeletePredictionResultRequest(), + {}, + ], +) async def test_delete_prediction_result_async( - transport: str = "grpc_asyncio", - request_type=prediction_result.DeletePredictionResultRequest, + request_type, transport: str = "grpc_asyncio" ): client = AMLAsyncClient( credentials=async_anonymous_credentials(), @@ -13391,7 +13459,7 @@ async def test_delete_prediction_result_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( @@ -13413,11 +13481,6 @@ async def test_delete_prediction_result_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_prediction_result_async_from_dict(): - await test_delete_prediction_result_async(request_type=dict) - - def test_delete_prediction_result_field_headers(): client = AMLClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13572,8 +13635,8 @@ async def test_delete_prediction_result_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - backtest_result.ListBacktestResultsRequest, - dict, + backtest_result.ListBacktestResultsRequest(), + {}, ], ) def test_list_backtest_results(request_type, transport: str = "grpc"): @@ -13584,7 +13647,7 @@ def test_list_backtest_results(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -13637,12 +13700,13 @@ def test_list_backtest_results_non_empty_request_with_auto_populated_field(): client.list_backtest_results(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == backtest_result.ListBacktestResultsRequest( + request_msg = backtest_result.ListBacktestResultsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_backtest_results_use_cached_wrapped_rpc(): @@ -13728,9 +13792,15 @@ async def test_list_backtest_results_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + backtest_result.ListBacktestResultsRequest(), + {}, + ], +) async def test_list_backtest_results_async( - transport: str = "grpc_asyncio", - request_type=backtest_result.ListBacktestResultsRequest, + request_type, transport: str = "grpc_asyncio" ): client = AMLAsyncClient( credentials=async_anonymous_credentials(), @@ -13739,7 +13809,7 @@ async def test_list_backtest_results_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( @@ -13766,11 +13836,6 @@ async def test_list_backtest_results_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_backtest_results_async_from_dict(): - await test_list_backtest_results_async(request_type=dict) - - def test_list_backtest_results_field_headers(): client = AMLClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14123,8 +14188,8 @@ async def test_list_backtest_results_async_pages(): @pytest.mark.parametrize( "request_type", [ - backtest_result.GetBacktestResultRequest, - dict, + backtest_result.GetBacktestResultRequest(), + {}, ], ) def test_get_backtest_result(request_type, transport: str = "grpc"): @@ -14135,7 +14200,7 @@ def test_get_backtest_result(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -14193,9 +14258,10 @@ def test_get_backtest_result_non_empty_request_with_auto_populated_field(): client.get_backtest_result(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == backtest_result.GetBacktestResultRequest( + request_msg = backtest_result.GetBacktestResultRequest( name="name_value", ) + assert args[0] == request_msg def test_get_backtest_result_use_cached_wrapped_rpc(): @@ -14280,10 +14346,14 @@ async def test_get_backtest_result_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_backtest_result_async( - transport: str = "grpc_asyncio", - request_type=backtest_result.GetBacktestResultRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + backtest_result.GetBacktestResultRequest(), + {}, + ], +) +async def test_get_backtest_result_async(request_type, transport: str = "grpc_asyncio"): client = AMLAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14291,7 +14361,7 @@ async def test_get_backtest_result_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( @@ -14326,11 +14396,6 @@ async def test_get_backtest_result_async( assert response.line_of_business == line_of_business.LineOfBusiness.COMMERCIAL -@pytest.mark.asyncio -async def test_get_backtest_result_async_from_dict(): - await test_get_backtest_result_async(request_type=dict) - - def test_get_backtest_result_field_headers(): client = AMLClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14485,8 +14550,8 @@ async def test_get_backtest_result_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcf_backtest_result.CreateBacktestResultRequest, - dict, + gcf_backtest_result.CreateBacktestResultRequest(), + {}, ], ) def test_create_backtest_result(request_type, transport: str = "grpc"): @@ -14497,7 +14562,7 @@ def test_create_backtest_result(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -14544,11 +14609,12 @@ def test_create_backtest_result_non_empty_request_with_auto_populated_field(): client.create_backtest_result(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcf_backtest_result.CreateBacktestResultRequest( + request_msg = gcf_backtest_result.CreateBacktestResultRequest( parent="parent_value", backtest_result_id="backtest_result_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_backtest_result_use_cached_wrapped_rpc(): @@ -14644,9 +14710,15 @@ async def test_create_backtest_result_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcf_backtest_result.CreateBacktestResultRequest(), + {}, + ], +) async def test_create_backtest_result_async( - transport: str = "grpc_asyncio", - request_type=gcf_backtest_result.CreateBacktestResultRequest, + request_type, transport: str = "grpc_asyncio" ): client = AMLAsyncClient( credentials=async_anonymous_credentials(), @@ -14655,7 +14727,7 @@ async def test_create_backtest_result_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( @@ -14677,11 +14749,6 @@ async def test_create_backtest_result_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_backtest_result_async_from_dict(): - await test_create_backtest_result_async(request_type=dict) - - def test_create_backtest_result_field_headers(): client = AMLClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14856,8 +14923,8 @@ async def test_create_backtest_result_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcf_backtest_result.UpdateBacktestResultRequest, - dict, + gcf_backtest_result.UpdateBacktestResultRequest(), + {}, ], ) def test_update_backtest_result(request_type, transport: str = "grpc"): @@ -14868,7 +14935,7 @@ def test_update_backtest_result(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -14913,9 +14980,10 @@ def test_update_backtest_result_non_empty_request_with_auto_populated_field(): client.update_backtest_result(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcf_backtest_result.UpdateBacktestResultRequest( + request_msg = gcf_backtest_result.UpdateBacktestResultRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_backtest_result_use_cached_wrapped_rpc(): @@ -15011,9 +15079,15 @@ async def test_update_backtest_result_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcf_backtest_result.UpdateBacktestResultRequest(), + {}, + ], +) async def test_update_backtest_result_async( - transport: str = "grpc_asyncio", - request_type=gcf_backtest_result.UpdateBacktestResultRequest, + request_type, transport: str = "grpc_asyncio" ): client = AMLAsyncClient( credentials=async_anonymous_credentials(), @@ -15022,7 +15096,7 @@ async def test_update_backtest_result_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( @@ -15044,11 +15118,6 @@ async def test_update_backtest_result_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_backtest_result_async_from_dict(): - await test_update_backtest_result_async(request_type=dict) - - def test_update_backtest_result_field_headers(): client = AMLClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15213,8 +15282,8 @@ async def test_update_backtest_result_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcf_backtest_result.ExportBacktestResultMetadataRequest, - dict, + gcf_backtest_result.ExportBacktestResultMetadataRequest(), + {}, ], ) def test_export_backtest_result_metadata(request_type, transport: str = "grpc"): @@ -15225,7 +15294,7 @@ def test_export_backtest_result_metadata(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -15270,9 +15339,10 @@ def test_export_backtest_result_metadata_non_empty_request_with_auto_populated_f client.export_backtest_result_metadata(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcf_backtest_result.ExportBacktestResultMetadataRequest( + request_msg = gcf_backtest_result.ExportBacktestResultMetadataRequest( backtest_result="backtest_result_value", ) + assert args[0] == request_msg def test_export_backtest_result_metadata_use_cached_wrapped_rpc(): @@ -15368,9 +15438,15 @@ async def test_export_backtest_result_metadata_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcf_backtest_result.ExportBacktestResultMetadataRequest(), + {}, + ], +) async def test_export_backtest_result_metadata_async( - transport: str = "grpc_asyncio", - request_type=gcf_backtest_result.ExportBacktestResultMetadataRequest, + request_type, transport: str = "grpc_asyncio" ): client = AMLAsyncClient( credentials=async_anonymous_credentials(), @@ -15379,7 +15455,7 @@ async def test_export_backtest_result_metadata_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( @@ -15401,11 +15477,6 @@ async def test_export_backtest_result_metadata_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_export_backtest_result_metadata_async_from_dict(): - await test_export_backtest_result_metadata_async(request_type=dict) - - def test_export_backtest_result_metadata_field_headers(): client = AMLClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15578,8 +15649,8 @@ async def test_export_backtest_result_metadata_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - backtest_result.DeleteBacktestResultRequest, - dict, + backtest_result.DeleteBacktestResultRequest(), + {}, ], ) def test_delete_backtest_result(request_type, transport: str = "grpc"): @@ -15590,7 +15661,7 @@ def test_delete_backtest_result(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -15636,10 +15707,11 @@ def test_delete_backtest_result_non_empty_request_with_auto_populated_field(): client.delete_backtest_result(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == backtest_result.DeleteBacktestResultRequest( + request_msg = backtest_result.DeleteBacktestResultRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_backtest_result_use_cached_wrapped_rpc(): @@ -15735,9 +15807,15 @@ async def test_delete_backtest_result_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + backtest_result.DeleteBacktestResultRequest(), + {}, + ], +) async def test_delete_backtest_result_async( - transport: str = "grpc_asyncio", - request_type=backtest_result.DeleteBacktestResultRequest, + request_type, transport: str = "grpc_asyncio" ): client = AMLAsyncClient( credentials=async_anonymous_credentials(), @@ -15746,7 +15824,7 @@ async def test_delete_backtest_result_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( @@ -15768,11 +15846,6 @@ async def test_delete_backtest_result_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_backtest_result_async_from_dict(): - await test_delete_backtest_result_async(request_type=dict) - - def test_delete_backtest_result_field_headers(): client = AMLClient( credentials=ga_credentials.AnonymousCredentials(), @@ -23962,7 +24035,6 @@ def test_list_instances_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = instance.ListInstancesRequest() - assert args[0] == request_msg @@ -23983,7 +24055,6 @@ def test_get_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = instance.GetInstanceRequest() - assert args[0] == request_msg @@ -24004,7 +24075,6 @@ def test_create_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcf_instance.CreateInstanceRequest() - assert args[0] == request_msg @@ -24025,7 +24095,6 @@ def test_update_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcf_instance.UpdateInstanceRequest() - assert args[0] == request_msg @@ -24046,7 +24115,6 @@ def test_delete_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = instance.DeleteInstanceRequest() - assert args[0] == request_msg @@ -24069,7 +24137,6 @@ def test_import_registered_parties_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = instance.ImportRegisteredPartiesRequest() - assert args[0] == request_msg @@ -24092,7 +24159,6 @@ def test_export_registered_parties_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = instance.ExportRegisteredPartiesRequest() - assert args[0] == request_msg @@ -24113,7 +24179,6 @@ def test_list_datasets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataset.ListDatasetsRequest() - assert args[0] == request_msg @@ -24134,7 +24199,6 @@ def test_get_dataset_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataset.GetDatasetRequest() - assert args[0] == request_msg @@ -24155,7 +24219,6 @@ def test_create_dataset_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcf_dataset.CreateDatasetRequest() - assert args[0] == request_msg @@ -24176,7 +24239,6 @@ def test_update_dataset_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcf_dataset.UpdateDatasetRequest() - assert args[0] == request_msg @@ -24197,7 +24259,6 @@ def test_delete_dataset_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataset.DeleteDatasetRequest() - assert args[0] == request_msg @@ -24218,7 +24279,6 @@ def test_list_models_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model.ListModelsRequest() - assert args[0] == request_msg @@ -24239,7 +24299,6 @@ def test_get_model_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model.GetModelRequest() - assert args[0] == request_msg @@ -24260,7 +24319,6 @@ def test_create_model_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcf_model.CreateModelRequest() - assert args[0] == request_msg @@ -24281,7 +24339,6 @@ def test_update_model_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcf_model.UpdateModelRequest() - assert args[0] == request_msg @@ -24304,7 +24361,6 @@ def test_export_model_metadata_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcf_model.ExportModelMetadataRequest() - assert args[0] == request_msg @@ -24325,7 +24381,6 @@ def test_delete_model_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model.DeleteModelRequest() - assert args[0] == request_msg @@ -24348,7 +24403,6 @@ def test_list_engine_configs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_config.ListEngineConfigsRequest() - assert args[0] == request_msg @@ -24371,7 +24425,6 @@ def test_get_engine_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_config.GetEngineConfigRequest() - assert args[0] == request_msg @@ -24394,7 +24447,6 @@ def test_create_engine_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcf_engine_config.CreateEngineConfigRequest() - assert args[0] == request_msg @@ -24417,7 +24469,6 @@ def test_update_engine_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcf_engine_config.UpdateEngineConfigRequest() - assert args[0] == request_msg @@ -24440,7 +24491,6 @@ def test_export_engine_config_metadata_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcf_engine_config.ExportEngineConfigMetadataRequest() - assert args[0] == request_msg @@ -24463,7 +24513,6 @@ def test_delete_engine_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_config.DeleteEngineConfigRequest() - assert args[0] == request_msg @@ -24486,7 +24535,6 @@ def test_get_engine_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_version.GetEngineVersionRequest() - assert args[0] == request_msg @@ -24509,7 +24557,6 @@ def test_list_engine_versions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_version.ListEngineVersionsRequest() - assert args[0] == request_msg @@ -24532,7 +24579,6 @@ def test_list_prediction_results_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = prediction_result.ListPredictionResultsRequest() - assert args[0] == request_msg @@ -24555,7 +24601,6 @@ def test_get_prediction_result_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = prediction_result.GetPredictionResultRequest() - assert args[0] == request_msg @@ -24578,7 +24623,6 @@ def test_create_prediction_result_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcf_prediction_result.CreatePredictionResultRequest() - assert args[0] == request_msg @@ -24601,7 +24645,6 @@ def test_update_prediction_result_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcf_prediction_result.UpdatePredictionResultRequest() - assert args[0] == request_msg @@ -24624,7 +24667,6 @@ def test_export_prediction_result_metadata_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcf_prediction_result.ExportPredictionResultMetadataRequest() - assert args[0] == request_msg @@ -24647,7 +24689,6 @@ def test_delete_prediction_result_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = prediction_result.DeletePredictionResultRequest() - assert args[0] == request_msg @@ -24670,7 +24711,6 @@ def test_list_backtest_results_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backtest_result.ListBacktestResultsRequest() - assert args[0] == request_msg @@ -24693,7 +24733,6 @@ def test_get_backtest_result_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backtest_result.GetBacktestResultRequest() - assert args[0] == request_msg @@ -24716,7 +24755,6 @@ def test_create_backtest_result_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcf_backtest_result.CreateBacktestResultRequest() - assert args[0] == request_msg @@ -24739,7 +24777,6 @@ def test_update_backtest_result_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcf_backtest_result.UpdateBacktestResultRequest() - assert args[0] == request_msg @@ -24762,7 +24799,6 @@ def test_export_backtest_result_metadata_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcf_backtest_result.ExportBacktestResultMetadataRequest() - assert args[0] == request_msg @@ -24785,7 +24821,6 @@ def test_delete_backtest_result_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backtest_result.DeleteBacktestResultRequest() - assert args[0] == request_msg @@ -24827,7 +24862,6 @@ async def test_list_instances_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = instance.ListInstancesRequest() - assert args[0] == request_msg @@ -24856,7 +24890,6 @@ async def test_get_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = instance.GetInstanceRequest() - assert args[0] == request_msg @@ -24881,7 +24914,6 @@ async def test_create_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcf_instance.CreateInstanceRequest() - assert args[0] == request_msg @@ -24906,7 +24938,6 @@ async def test_update_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcf_instance.UpdateInstanceRequest() - assert args[0] == request_msg @@ -24931,7 +24962,6 @@ async def test_delete_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = instance.DeleteInstanceRequest() - assert args[0] == request_msg @@ -24958,7 +24988,6 @@ async def test_import_registered_parties_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = instance.ImportRegisteredPartiesRequest() - assert args[0] == request_msg @@ -24985,7 +25014,6 @@ async def test_export_registered_parties_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = instance.ExportRegisteredPartiesRequest() - assert args[0] == request_msg @@ -25013,7 +25041,6 @@ async def test_list_datasets_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataset.ListDatasetsRequest() - assert args[0] == request_msg @@ -25041,7 +25068,6 @@ async def test_get_dataset_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataset.GetDatasetRequest() - assert args[0] == request_msg @@ -25066,7 +25092,6 @@ async def test_create_dataset_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcf_dataset.CreateDatasetRequest() - assert args[0] == request_msg @@ -25091,7 +25116,6 @@ async def test_update_dataset_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcf_dataset.UpdateDatasetRequest() - assert args[0] == request_msg @@ -25116,7 +25140,6 @@ async def test_delete_dataset_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataset.DeleteDatasetRequest() - assert args[0] == request_msg @@ -25144,7 +25167,6 @@ async def test_list_models_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model.ListModelsRequest() - assert args[0] == request_msg @@ -25176,7 +25198,6 @@ async def test_get_model_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model.GetModelRequest() - assert args[0] == request_msg @@ -25201,7 +25222,6 @@ async def test_create_model_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcf_model.CreateModelRequest() - assert args[0] == request_msg @@ -25226,7 +25246,6 @@ async def test_update_model_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcf_model.UpdateModelRequest() - assert args[0] == request_msg @@ -25253,7 +25272,6 @@ async def test_export_model_metadata_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcf_model.ExportModelMetadataRequest() - assert args[0] == request_msg @@ -25278,7 +25296,6 @@ async def test_delete_model_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model.DeleteModelRequest() - assert args[0] == request_msg @@ -25308,7 +25325,6 @@ async def test_list_engine_configs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_config.ListEngineConfigsRequest() - assert args[0] == request_msg @@ -25341,7 +25357,6 @@ async def test_get_engine_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_config.GetEngineConfigRequest() - assert args[0] == request_msg @@ -25368,7 +25383,6 @@ async def test_create_engine_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcf_engine_config.CreateEngineConfigRequest() - assert args[0] == request_msg @@ -25395,7 +25409,6 @@ async def test_update_engine_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcf_engine_config.UpdateEngineConfigRequest() - assert args[0] == request_msg @@ -25422,7 +25435,6 @@ async def test_export_engine_config_metadata_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcf_engine_config.ExportEngineConfigMetadataRequest() - assert args[0] == request_msg @@ -25449,7 +25461,6 @@ async def test_delete_engine_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_config.DeleteEngineConfigRequest() - assert args[0] == request_msg @@ -25480,7 +25491,6 @@ async def test_get_engine_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_version.GetEngineVersionRequest() - assert args[0] == request_msg @@ -25510,7 +25520,6 @@ async def test_list_engine_versions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_version.ListEngineVersionsRequest() - assert args[0] == request_msg @@ -25540,7 +25549,6 @@ async def test_list_prediction_results_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = prediction_result.ListPredictionResultsRequest() - assert args[0] == request_msg @@ -25574,7 +25582,6 @@ async def test_get_prediction_result_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = prediction_result.GetPredictionResultRequest() - assert args[0] == request_msg @@ -25601,7 +25608,6 @@ async def test_create_prediction_result_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcf_prediction_result.CreatePredictionResultRequest() - assert args[0] == request_msg @@ -25628,7 +25634,6 @@ async def test_update_prediction_result_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcf_prediction_result.UpdatePredictionResultRequest() - assert args[0] == request_msg @@ -25655,7 +25660,6 @@ async def test_export_prediction_result_metadata_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcf_prediction_result.ExportPredictionResultMetadataRequest() - assert args[0] == request_msg @@ -25682,7 +25686,6 @@ async def test_delete_prediction_result_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = prediction_result.DeletePredictionResultRequest() - assert args[0] == request_msg @@ -25712,7 +25715,6 @@ async def test_list_backtest_results_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backtest_result.ListBacktestResultsRequest() - assert args[0] == request_msg @@ -25746,7 +25748,6 @@ async def test_get_backtest_result_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backtest_result.GetBacktestResultRequest() - assert args[0] == request_msg @@ -25773,7 +25774,6 @@ async def test_create_backtest_result_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcf_backtest_result.CreateBacktestResultRequest() - assert args[0] == request_msg @@ -25800,7 +25800,6 @@ async def test_update_backtest_result_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcf_backtest_result.UpdateBacktestResultRequest() - assert args[0] == request_msg @@ -25827,7 +25826,6 @@ async def test_export_backtest_result_metadata_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcf_backtest_result.ExportBacktestResultMetadataRequest() - assert args[0] == request_msg @@ -25854,7 +25852,6 @@ async def test_delete_backtest_result_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backtest_result.DeleteBacktestResultRequest() - assert args[0] == request_msg @@ -32080,7 +32077,6 @@ def test_list_instances_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = instance.ListInstancesRequest() - assert args[0] == request_msg @@ -32100,7 +32096,6 @@ def test_get_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = instance.GetInstanceRequest() - assert args[0] == request_msg @@ -32120,7 +32115,6 @@ def test_create_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcf_instance.CreateInstanceRequest() - assert args[0] == request_msg @@ -32140,7 +32134,6 @@ def test_update_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcf_instance.UpdateInstanceRequest() - assert args[0] == request_msg @@ -32160,7 +32153,6 @@ def test_delete_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = instance.DeleteInstanceRequest() - assert args[0] == request_msg @@ -32182,7 +32174,6 @@ def test_import_registered_parties_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = instance.ImportRegisteredPartiesRequest() - assert args[0] == request_msg @@ -32204,7 +32195,6 @@ def test_export_registered_parties_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = instance.ExportRegisteredPartiesRequest() - assert args[0] == request_msg @@ -32224,7 +32214,6 @@ def test_list_datasets_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataset.ListDatasetsRequest() - assert args[0] == request_msg @@ -32244,7 +32233,6 @@ def test_get_dataset_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataset.GetDatasetRequest() - assert args[0] == request_msg @@ -32264,7 +32252,6 @@ def test_create_dataset_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcf_dataset.CreateDatasetRequest() - assert args[0] == request_msg @@ -32284,7 +32271,6 @@ def test_update_dataset_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcf_dataset.UpdateDatasetRequest() - assert args[0] == request_msg @@ -32304,7 +32290,6 @@ def test_delete_dataset_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dataset.DeleteDatasetRequest() - assert args[0] == request_msg @@ -32324,7 +32309,6 @@ def test_list_models_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model.ListModelsRequest() - assert args[0] == request_msg @@ -32344,7 +32328,6 @@ def test_get_model_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model.GetModelRequest() - assert args[0] == request_msg @@ -32364,7 +32347,6 @@ def test_create_model_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcf_model.CreateModelRequest() - assert args[0] == request_msg @@ -32384,7 +32366,6 @@ def test_update_model_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcf_model.UpdateModelRequest() - assert args[0] == request_msg @@ -32406,7 +32387,6 @@ def test_export_model_metadata_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcf_model.ExportModelMetadataRequest() - assert args[0] == request_msg @@ -32426,7 +32406,6 @@ def test_delete_model_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model.DeleteModelRequest() - assert args[0] == request_msg @@ -32448,7 +32427,6 @@ def test_list_engine_configs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_config.ListEngineConfigsRequest() - assert args[0] == request_msg @@ -32470,7 +32448,6 @@ def test_get_engine_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_config.GetEngineConfigRequest() - assert args[0] == request_msg @@ -32492,7 +32469,6 @@ def test_create_engine_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcf_engine_config.CreateEngineConfigRequest() - assert args[0] == request_msg @@ -32514,7 +32490,6 @@ def test_update_engine_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcf_engine_config.UpdateEngineConfigRequest() - assert args[0] == request_msg @@ -32536,7 +32511,6 @@ def test_export_engine_config_metadata_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcf_engine_config.ExportEngineConfigMetadataRequest() - assert args[0] == request_msg @@ -32558,7 +32532,6 @@ def test_delete_engine_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_config.DeleteEngineConfigRequest() - assert args[0] == request_msg @@ -32580,7 +32553,6 @@ def test_get_engine_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_version.GetEngineVersionRequest() - assert args[0] == request_msg @@ -32602,7 +32574,6 @@ def test_list_engine_versions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = engine_version.ListEngineVersionsRequest() - assert args[0] == request_msg @@ -32624,7 +32595,6 @@ def test_list_prediction_results_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = prediction_result.ListPredictionResultsRequest() - assert args[0] == request_msg @@ -32646,7 +32616,6 @@ def test_get_prediction_result_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = prediction_result.GetPredictionResultRequest() - assert args[0] == request_msg @@ -32668,7 +32637,6 @@ def test_create_prediction_result_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcf_prediction_result.CreatePredictionResultRequest() - assert args[0] == request_msg @@ -32690,7 +32658,6 @@ def test_update_prediction_result_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcf_prediction_result.UpdatePredictionResultRequest() - assert args[0] == request_msg @@ -32712,7 +32679,6 @@ def test_export_prediction_result_metadata_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcf_prediction_result.ExportPredictionResultMetadataRequest() - assert args[0] == request_msg @@ -32734,7 +32700,6 @@ def test_delete_prediction_result_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = prediction_result.DeletePredictionResultRequest() - assert args[0] == request_msg @@ -32756,7 +32721,6 @@ def test_list_backtest_results_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backtest_result.ListBacktestResultsRequest() - assert args[0] == request_msg @@ -32778,7 +32742,6 @@ def test_get_backtest_result_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backtest_result.GetBacktestResultRequest() - assert args[0] == request_msg @@ -32800,7 +32763,6 @@ def test_create_backtest_result_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcf_backtest_result.CreateBacktestResultRequest() - assert args[0] == request_msg @@ -32822,7 +32784,6 @@ def test_update_backtest_result_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcf_backtest_result.UpdateBacktestResultRequest() - assert args[0] == request_msg @@ -32844,7 +32805,6 @@ def test_export_backtest_result_metadata_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcf_backtest_result.ExportBacktestResultMetadataRequest() - assert args[0] == request_msg @@ -32866,7 +32826,6 @@ def test_delete_backtest_result_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backtest_result.DeleteBacktestResultRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-firestore/noxfile.py b/packages/google-cloud-firestore/noxfile.py index d04ec2977262..ef340c48888a 100644 --- a/packages/google-cloud-firestore/noxfile.py +++ b/packages/google-cloud-firestore/noxfile.py @@ -47,7 +47,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-firestore" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -526,14 +531,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -645,14 +642,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-firestore/setup.py b/packages/google-cloud-firestore/setup.py index bbab3c2d58c6..520b78e9bc96 100644 --- a/packages/google-cloud-firestore/setup.py +++ b/packages/google-cloud-firestore/setup.py @@ -44,7 +44,7 @@ # See https://github.com/googleapis/google-cloud-python/issues/12364 "google-auth >= 2.14.1, <3.0.0,!=2.24.0,!=2.25.0", "google-cloud-core >= 2.0.0, <3.0.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-firestore/testing/constraints-3.10.txt b/packages/google-cloud-firestore/testing/constraints-3.10.txt index 19668da5f6e4..60c989183341 100644 --- a/packages/google-cloud-firestore/testing/constraints-3.10.txt +++ b/packages/google-cloud-firestore/testing/constraints-3.10.txt @@ -7,6 +7,6 @@ google-api-core==2.17.1 google-auth==2.14.1 google-cloud-core==2.0.0 -grpcio==1.44.0 +grpcio==1.59.0 proto-plus==1.22.3 protobuf==4.25.8 diff --git a/packages/google-cloud-firestore/tests/unit/gapic/firestore_admin_v1/test_firestore_admin.py b/packages/google-cloud-firestore/tests/unit/gapic/firestore_admin_v1/test_firestore_admin.py index e7262a74e1ef..3e16f524ee95 100644 --- a/packages/google-cloud-firestore/tests/unit/gapic/firestore_admin_v1/test_firestore_admin.py +++ b/packages/google-cloud-firestore/tests/unit/gapic/firestore_admin_v1/test_firestore_admin.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 @@ -133,6 +134,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" @@ -1339,8 +1355,8 @@ def test_firestore_admin_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - firestore_admin.CreateIndexRequest, - dict, + firestore_admin.CreateIndexRequest(), + {}, ], ) def test_create_index(request_type, transport: str = "grpc"): @@ -1351,7 +1367,7 @@ def test_create_index(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_index), "__call__") as call: @@ -1392,9 +1408,10 @@ def test_create_index_non_empty_request_with_auto_populated_field(): client.create_index(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == firestore_admin.CreateIndexRequest( + request_msg = firestore_admin.CreateIndexRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_index_use_cached_wrapped_rpc(): @@ -1485,9 +1502,14 @@ async def test_create_index_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_index_async( - transport: str = "grpc_asyncio", request_type=firestore_admin.CreateIndexRequest -): +@pytest.mark.parametrize( + "request_type", + [ + firestore_admin.CreateIndexRequest(), + {}, + ], +) +async def test_create_index_async(request_type, transport: str = "grpc_asyncio"): client = FirestoreAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1495,7 +1517,7 @@ async def test_create_index_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_index), "__call__") as call: @@ -1515,11 +1537,6 @@ async def test_create_index_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_index_async_from_dict(): - await test_create_index_async(request_type=dict) - - def test_create_index_field_headers(): client = FirestoreAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1676,8 +1693,8 @@ async def test_create_index_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - firestore_admin.ListIndexesRequest, - dict, + firestore_admin.ListIndexesRequest(), + {}, ], ) def test_list_indexes(request_type, transport: str = "grpc"): @@ -1688,7 +1705,7 @@ def test_list_indexes(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_indexes), "__call__") as call: @@ -1734,11 +1751,12 @@ def test_list_indexes_non_empty_request_with_auto_populated_field(): client.list_indexes(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == firestore_admin.ListIndexesRequest( + request_msg = firestore_admin.ListIndexesRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_indexes_use_cached_wrapped_rpc(): @@ -1819,9 +1837,14 @@ async def test_list_indexes_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_indexes_async( - transport: str = "grpc_asyncio", request_type=firestore_admin.ListIndexesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + firestore_admin.ListIndexesRequest(), + {}, + ], +) +async def test_list_indexes_async(request_type, transport: str = "grpc_asyncio"): client = FirestoreAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1829,7 +1852,7 @@ async def test_list_indexes_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_indexes), "__call__") as call: @@ -1852,11 +1875,6 @@ async def test_list_indexes_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_indexes_async_from_dict(): - await test_list_indexes_async(request_type=dict) - - def test_list_indexes_field_headers(): client = FirestoreAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2193,8 +2211,8 @@ async def test_list_indexes_async_pages(): @pytest.mark.parametrize( "request_type", [ - firestore_admin.GetIndexRequest, - dict, + firestore_admin.GetIndexRequest(), + {}, ], ) def test_get_index(request_type, transport: str = "grpc"): @@ -2205,7 +2223,7 @@ def test_get_index(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_index), "__call__") as call: @@ -2263,9 +2281,10 @@ def test_get_index_non_empty_request_with_auto_populated_field(): client.get_index(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == firestore_admin.GetIndexRequest( + request_msg = firestore_admin.GetIndexRequest( name="name_value", ) + assert args[0] == request_msg def test_get_index_use_cached_wrapped_rpc(): @@ -2344,9 +2363,14 @@ async def test_get_index_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_index_async( - transport: str = "grpc_asyncio", request_type=firestore_admin.GetIndexRequest -): +@pytest.mark.parametrize( + "request_type", + [ + firestore_admin.GetIndexRequest(), + {}, + ], +) +async def test_get_index_async(request_type, transport: str = "grpc_asyncio"): client = FirestoreAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2354,7 +2378,7 @@ async def test_get_index_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_index), "__call__") as call: @@ -2391,11 +2415,6 @@ async def test_get_index_async( assert response.unique is True -@pytest.mark.asyncio -async def test_get_index_async_from_dict(): - await test_get_index_async(request_type=dict) - - def test_get_index_field_headers(): client = FirestoreAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2538,8 +2557,8 @@ async def test_get_index_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - firestore_admin.DeleteIndexRequest, - dict, + firestore_admin.DeleteIndexRequest(), + {}, ], ) def test_delete_index(request_type, transport: str = "grpc"): @@ -2550,7 +2569,7 @@ def test_delete_index(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_index), "__call__") as call: @@ -2591,9 +2610,10 @@ def test_delete_index_non_empty_request_with_auto_populated_field(): client.delete_index(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == firestore_admin.DeleteIndexRequest( + request_msg = firestore_admin.DeleteIndexRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_index_use_cached_wrapped_rpc(): @@ -2674,9 +2694,14 @@ async def test_delete_index_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_index_async( - transport: str = "grpc_asyncio", request_type=firestore_admin.DeleteIndexRequest -): +@pytest.mark.parametrize( + "request_type", + [ + firestore_admin.DeleteIndexRequest(), + {}, + ], +) +async def test_delete_index_async(request_type, transport: str = "grpc_asyncio"): client = FirestoreAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2684,7 +2709,7 @@ async def test_delete_index_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_index), "__call__") as call: @@ -2702,11 +2727,6 @@ async def test_delete_index_async( assert response is None -@pytest.mark.asyncio -async def test_delete_index_async_from_dict(): - await test_delete_index_async(request_type=dict) - - def test_delete_index_field_headers(): client = FirestoreAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2849,8 +2869,8 @@ async def test_delete_index_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - firestore_admin.GetFieldRequest, - dict, + firestore_admin.GetFieldRequest(), + {}, ], ) def test_get_field(request_type, transport: str = "grpc"): @@ -2861,7 +2881,7 @@ def test_get_field(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_field), "__call__") as call: @@ -2905,9 +2925,10 @@ def test_get_field_non_empty_request_with_auto_populated_field(): client.get_field(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == firestore_admin.GetFieldRequest( + request_msg = firestore_admin.GetFieldRequest( name="name_value", ) + assert args[0] == request_msg def test_get_field_use_cached_wrapped_rpc(): @@ -2986,9 +3007,14 @@ async def test_get_field_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_field_async( - transport: str = "grpc_asyncio", request_type=firestore_admin.GetFieldRequest -): +@pytest.mark.parametrize( + "request_type", + [ + firestore_admin.GetFieldRequest(), + {}, + ], +) +async def test_get_field_async(request_type, transport: str = "grpc_asyncio"): client = FirestoreAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2996,7 +3022,7 @@ async def test_get_field_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_field), "__call__") as call: @@ -3019,11 +3045,6 @@ async def test_get_field_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_field_async_from_dict(): - await test_get_field_async(request_type=dict) - - def test_get_field_field_headers(): client = FirestoreAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3166,8 +3187,8 @@ async def test_get_field_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - firestore_admin.UpdateFieldRequest, - dict, + firestore_admin.UpdateFieldRequest(), + {}, ], ) def test_update_field(request_type, transport: str = "grpc"): @@ -3178,7 +3199,7 @@ def test_update_field(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_field), "__call__") as call: @@ -3217,7 +3238,8 @@ def test_update_field_non_empty_request_with_auto_populated_field(): client.update_field(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == firestore_admin.UpdateFieldRequest() + request_msg = firestore_admin.UpdateFieldRequest() + assert args[0] == request_msg def test_update_field_use_cached_wrapped_rpc(): @@ -3308,9 +3330,14 @@ async def test_update_field_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_field_async( - transport: str = "grpc_asyncio", request_type=firestore_admin.UpdateFieldRequest -): +@pytest.mark.parametrize( + "request_type", + [ + firestore_admin.UpdateFieldRequest(), + {}, + ], +) +async def test_update_field_async(request_type, transport: str = "grpc_asyncio"): client = FirestoreAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3318,7 +3345,7 @@ async def test_update_field_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_field), "__call__") as call: @@ -3338,11 +3365,6 @@ async def test_update_field_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_field_async_from_dict(): - await test_update_field_async(request_type=dict) - - def test_update_field_field_headers(): client = FirestoreAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3489,8 +3511,8 @@ async def test_update_field_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - firestore_admin.ListFieldsRequest, - dict, + firestore_admin.ListFieldsRequest(), + {}, ], ) def test_list_fields(request_type, transport: str = "grpc"): @@ -3501,7 +3523,7 @@ def test_list_fields(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_fields), "__call__") as call: @@ -3547,11 +3569,12 @@ def test_list_fields_non_empty_request_with_auto_populated_field(): client.list_fields(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == firestore_admin.ListFieldsRequest( + request_msg = firestore_admin.ListFieldsRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_fields_use_cached_wrapped_rpc(): @@ -3632,9 +3655,14 @@ async def test_list_fields_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_fields_async( - transport: str = "grpc_asyncio", request_type=firestore_admin.ListFieldsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + firestore_admin.ListFieldsRequest(), + {}, + ], +) +async def test_list_fields_async(request_type, transport: str = "grpc_asyncio"): client = FirestoreAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3642,7 +3670,7 @@ async def test_list_fields_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_fields), "__call__") as call: @@ -3665,11 +3693,6 @@ async def test_list_fields_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_fields_async_from_dict(): - await test_list_fields_async(request_type=dict) - - def test_list_fields_field_headers(): client = FirestoreAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4006,8 +4029,8 @@ async def test_list_fields_async_pages(): @pytest.mark.parametrize( "request_type", [ - firestore_admin.ExportDocumentsRequest, - dict, + firestore_admin.ExportDocumentsRequest(), + {}, ], ) def test_export_documents(request_type, transport: str = "grpc"): @@ -4018,7 +4041,7 @@ def test_export_documents(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.export_documents), "__call__") as call: @@ -4060,10 +4083,11 @@ def test_export_documents_non_empty_request_with_auto_populated_field(): client.export_documents(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == firestore_admin.ExportDocumentsRequest( + request_msg = firestore_admin.ExportDocumentsRequest( name="name_value", output_uri_prefix="output_uri_prefix_value", ) + assert args[0] == request_msg def test_export_documents_use_cached_wrapped_rpc(): @@ -4156,9 +4180,14 @@ async def test_export_documents_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_export_documents_async( - transport: str = "grpc_asyncio", request_type=firestore_admin.ExportDocumentsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + firestore_admin.ExportDocumentsRequest(), + {}, + ], +) +async def test_export_documents_async(request_type, transport: str = "grpc_asyncio"): client = FirestoreAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4166,7 +4195,7 @@ async def test_export_documents_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.export_documents), "__call__") as call: @@ -4186,11 +4215,6 @@ async def test_export_documents_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_export_documents_async_from_dict(): - await test_export_documents_async(request_type=dict) - - def test_export_documents_field_headers(): client = FirestoreAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4337,8 +4361,8 @@ async def test_export_documents_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - firestore_admin.ImportDocumentsRequest, - dict, + firestore_admin.ImportDocumentsRequest(), + {}, ], ) def test_import_documents(request_type, transport: str = "grpc"): @@ -4349,7 +4373,7 @@ def test_import_documents(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.import_documents), "__call__") as call: @@ -4391,10 +4415,11 @@ def test_import_documents_non_empty_request_with_auto_populated_field(): client.import_documents(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == firestore_admin.ImportDocumentsRequest( + request_msg = firestore_admin.ImportDocumentsRequest( name="name_value", input_uri_prefix="input_uri_prefix_value", ) + assert args[0] == request_msg def test_import_documents_use_cached_wrapped_rpc(): @@ -4487,9 +4512,14 @@ async def test_import_documents_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_import_documents_async( - transport: str = "grpc_asyncio", request_type=firestore_admin.ImportDocumentsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + firestore_admin.ImportDocumentsRequest(), + {}, + ], +) +async def test_import_documents_async(request_type, transport: str = "grpc_asyncio"): client = FirestoreAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4497,7 +4527,7 @@ async def test_import_documents_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.import_documents), "__call__") as call: @@ -4517,11 +4547,6 @@ async def test_import_documents_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_import_documents_async_from_dict(): - await test_import_documents_async(request_type=dict) - - def test_import_documents_field_headers(): client = FirestoreAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4668,8 +4693,8 @@ async def test_import_documents_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - firestore_admin.BulkDeleteDocumentsRequest, - dict, + firestore_admin.BulkDeleteDocumentsRequest(), + {}, ], ) def test_bulk_delete_documents(request_type, transport: str = "grpc"): @@ -4680,7 +4705,7 @@ def test_bulk_delete_documents(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4725,9 +4750,10 @@ def test_bulk_delete_documents_non_empty_request_with_auto_populated_field(): client.bulk_delete_documents(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == firestore_admin.BulkDeleteDocumentsRequest( + request_msg = firestore_admin.BulkDeleteDocumentsRequest( name="name_value", ) + assert args[0] == request_msg def test_bulk_delete_documents_use_cached_wrapped_rpc(): @@ -4823,9 +4849,15 @@ async def test_bulk_delete_documents_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + firestore_admin.BulkDeleteDocumentsRequest(), + {}, + ], +) async def test_bulk_delete_documents_async( - transport: str = "grpc_asyncio", - request_type=firestore_admin.BulkDeleteDocumentsRequest, + request_type, transport: str = "grpc_asyncio" ): client = FirestoreAdminAsyncClient( credentials=async_anonymous_credentials(), @@ -4834,7 +4866,7 @@ async def test_bulk_delete_documents_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( @@ -4856,11 +4888,6 @@ async def test_bulk_delete_documents_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_bulk_delete_documents_async_from_dict(): - await test_bulk_delete_documents_async(request_type=dict) - - def test_bulk_delete_documents_field_headers(): client = FirestoreAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5015,8 +5042,8 @@ async def test_bulk_delete_documents_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - firestore_admin.CreateDatabaseRequest, - dict, + firestore_admin.CreateDatabaseRequest(), + {}, ], ) def test_create_database(request_type, transport: str = "grpc"): @@ -5027,7 +5054,7 @@ def test_create_database(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_database), "__call__") as call: @@ -5069,10 +5096,11 @@ def test_create_database_non_empty_request_with_auto_populated_field(): client.create_database(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == firestore_admin.CreateDatabaseRequest( + request_msg = firestore_admin.CreateDatabaseRequest( parent="parent_value", database_id="database_id_value", ) + assert args[0] == request_msg def test_create_database_use_cached_wrapped_rpc(): @@ -5163,9 +5191,14 @@ async def test_create_database_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_database_async( - transport: str = "grpc_asyncio", request_type=firestore_admin.CreateDatabaseRequest -): +@pytest.mark.parametrize( + "request_type", + [ + firestore_admin.CreateDatabaseRequest(), + {}, + ], +) +async def test_create_database_async(request_type, transport: str = "grpc_asyncio"): client = FirestoreAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5173,7 +5206,7 @@ async def test_create_database_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_database), "__call__") as call: @@ -5193,11 +5226,6 @@ async def test_create_database_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_database_async_from_dict(): - await test_create_database_async(request_type=dict) - - def test_create_database_field_headers(): client = FirestoreAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5364,8 +5392,8 @@ async def test_create_database_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - firestore_admin.GetDatabaseRequest, - dict, + firestore_admin.GetDatabaseRequest(), + {}, ], ) def test_get_database(request_type, transport: str = "grpc"): @@ -5376,7 +5404,7 @@ def test_get_database(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_database), "__call__") as call: @@ -5468,9 +5496,10 @@ def test_get_database_non_empty_request_with_auto_populated_field(): client.get_database(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == firestore_admin.GetDatabaseRequest( + request_msg = firestore_admin.GetDatabaseRequest( name="name_value", ) + assert args[0] == request_msg def test_get_database_use_cached_wrapped_rpc(): @@ -5551,9 +5580,14 @@ async def test_get_database_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_database_async( - transport: str = "grpc_asyncio", request_type=firestore_admin.GetDatabaseRequest -): +@pytest.mark.parametrize( + "request_type", + [ + firestore_admin.GetDatabaseRequest(), + {}, + ], +) +async def test_get_database_async(request_type, transport: str = "grpc_asyncio"): client = FirestoreAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5561,7 +5595,7 @@ async def test_get_database_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_database), "__call__") as call: @@ -5632,11 +5666,6 @@ async def test_get_database_async( ) -@pytest.mark.asyncio -async def test_get_database_async_from_dict(): - await test_get_database_async(request_type=dict) - - def test_get_database_field_headers(): client = FirestoreAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5779,8 +5808,8 @@ async def test_get_database_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - firestore_admin.ListDatabasesRequest, - dict, + firestore_admin.ListDatabasesRequest(), + {}, ], ) def test_list_databases(request_type, transport: str = "grpc"): @@ -5791,7 +5820,7 @@ def test_list_databases(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_databases), "__call__") as call: @@ -5835,9 +5864,10 @@ def test_list_databases_non_empty_request_with_auto_populated_field(): client.list_databases(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == firestore_admin.ListDatabasesRequest( + request_msg = firestore_admin.ListDatabasesRequest( parent="parent_value", ) + assert args[0] == request_msg def test_list_databases_use_cached_wrapped_rpc(): @@ -5918,9 +5948,14 @@ async def test_list_databases_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_databases_async( - transport: str = "grpc_asyncio", request_type=firestore_admin.ListDatabasesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + firestore_admin.ListDatabasesRequest(), + {}, + ], +) +async def test_list_databases_async(request_type, transport: str = "grpc_asyncio"): client = FirestoreAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5928,7 +5963,7 @@ async def test_list_databases_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_databases), "__call__") as call: @@ -5951,11 +5986,6 @@ async def test_list_databases_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_databases_async_from_dict(): - await test_list_databases_async(request_type=dict) - - def test_list_databases_field_headers(): client = FirestoreAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6102,8 +6132,8 @@ async def test_list_databases_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - firestore_admin.UpdateDatabaseRequest, - dict, + firestore_admin.UpdateDatabaseRequest(), + {}, ], ) def test_update_database(request_type, transport: str = "grpc"): @@ -6114,7 +6144,7 @@ def test_update_database(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_database), "__call__") as call: @@ -6153,7 +6183,8 @@ def test_update_database_non_empty_request_with_auto_populated_field(): client.update_database(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == firestore_admin.UpdateDatabaseRequest() + request_msg = firestore_admin.UpdateDatabaseRequest() + assert args[0] == request_msg def test_update_database_use_cached_wrapped_rpc(): @@ -6244,9 +6275,14 @@ async def test_update_database_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_database_async( - transport: str = "grpc_asyncio", request_type=firestore_admin.UpdateDatabaseRequest -): +@pytest.mark.parametrize( + "request_type", + [ + firestore_admin.UpdateDatabaseRequest(), + {}, + ], +) +async def test_update_database_async(request_type, transport: str = "grpc_asyncio"): client = FirestoreAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6254,7 +6290,7 @@ async def test_update_database_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_database), "__call__") as call: @@ -6274,11 +6310,6 @@ async def test_update_database_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_database_async_from_dict(): - await test_update_database_async(request_type=dict) - - def test_update_database_field_headers(): client = FirestoreAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6435,8 +6466,8 @@ async def test_update_database_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - firestore_admin.DeleteDatabaseRequest, - dict, + firestore_admin.DeleteDatabaseRequest(), + {}, ], ) def test_delete_database(request_type, transport: str = "grpc"): @@ -6447,7 +6478,7 @@ def test_delete_database(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_database), "__call__") as call: @@ -6489,10 +6520,11 @@ def test_delete_database_non_empty_request_with_auto_populated_field(): client.delete_database(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == firestore_admin.DeleteDatabaseRequest( + request_msg = firestore_admin.DeleteDatabaseRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_database_use_cached_wrapped_rpc(): @@ -6583,9 +6615,14 @@ async def test_delete_database_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_database_async( - transport: str = "grpc_asyncio", request_type=firestore_admin.DeleteDatabaseRequest -): +@pytest.mark.parametrize( + "request_type", + [ + firestore_admin.DeleteDatabaseRequest(), + {}, + ], +) +async def test_delete_database_async(request_type, transport: str = "grpc_asyncio"): client = FirestoreAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6593,7 +6630,7 @@ async def test_delete_database_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_database), "__call__") as call: @@ -6613,11 +6650,6 @@ async def test_delete_database_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_database_async_from_dict(): - await test_delete_database_async(request_type=dict) - - def test_delete_database_field_headers(): client = FirestoreAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6764,8 +6796,8 @@ async def test_delete_database_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - firestore_admin.CreateUserCredsRequest, - dict, + firestore_admin.CreateUserCredsRequest(), + {}, ], ) def test_create_user_creds(request_type, transport: str = "grpc"): @@ -6776,7 +6808,7 @@ def test_create_user_creds(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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 +6861,11 @@ def test_create_user_creds_non_empty_request_with_auto_populated_field(): client.create_user_creds(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == firestore_admin.CreateUserCredsRequest( + request_msg = firestore_admin.CreateUserCredsRequest( parent="parent_value", user_creds_id="user_creds_id_value", ) + assert args[0] == request_msg def test_create_user_creds_use_cached_wrapped_rpc(): @@ -6915,9 +6948,14 @@ async def test_create_user_creds_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_user_creds_async( - transport: str = "grpc_asyncio", request_type=firestore_admin.CreateUserCredsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + firestore_admin.CreateUserCredsRequest(), + {}, + ], +) +async def test_create_user_creds_async(request_type, transport: str = "grpc_asyncio"): client = FirestoreAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6925,7 +6963,7 @@ async def test_create_user_creds_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( @@ -6954,11 +6992,6 @@ async def test_create_user_creds_async( assert response.secure_password == "secure_password_value" -@pytest.mark.asyncio -async def test_create_user_creds_async_from_dict(): - await test_create_user_creds_async(request_type=dict) - - def test_create_user_creds_field_headers(): client = FirestoreAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7133,8 +7166,8 @@ async def test_create_user_creds_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - firestore_admin.GetUserCredsRequest, - dict, + firestore_admin.GetUserCredsRequest(), + {}, ], ) def test_get_user_creds(request_type, transport: str = "grpc"): @@ -7145,7 +7178,7 @@ def test_get_user_creds(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_user_creds), "__call__") as call: @@ -7193,9 +7226,10 @@ def test_get_user_creds_non_empty_request_with_auto_populated_field(): client.get_user_creds(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == firestore_admin.GetUserCredsRequest( + request_msg = firestore_admin.GetUserCredsRequest( name="name_value", ) + assert args[0] == request_msg def test_get_user_creds_use_cached_wrapped_rpc(): @@ -7276,9 +7310,14 @@ async def test_get_user_creds_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_user_creds_async( - transport: str = "grpc_asyncio", request_type=firestore_admin.GetUserCredsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + firestore_admin.GetUserCredsRequest(), + {}, + ], +) +async def test_get_user_creds_async(request_type, transport: str = "grpc_asyncio"): client = FirestoreAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7286,7 +7325,7 @@ async def test_get_user_creds_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_user_creds), "__call__") as call: @@ -7313,11 +7352,6 @@ async def test_get_user_creds_async( assert response.secure_password == "secure_password_value" -@pytest.mark.asyncio -async def test_get_user_creds_async_from_dict(): - await test_get_user_creds_async(request_type=dict) - - def test_get_user_creds_field_headers(): client = FirestoreAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7464,8 +7498,8 @@ async def test_get_user_creds_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - firestore_admin.ListUserCredsRequest, - dict, + firestore_admin.ListUserCredsRequest(), + {}, ], ) def test_list_user_creds(request_type, transport: str = "grpc"): @@ -7476,7 +7510,7 @@ def test_list_user_creds(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_user_creds), "__call__") as call: @@ -7517,9 +7551,10 @@ def test_list_user_creds_non_empty_request_with_auto_populated_field(): client.list_user_creds(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == firestore_admin.ListUserCredsRequest( + request_msg = firestore_admin.ListUserCredsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_list_user_creds_use_cached_wrapped_rpc(): @@ -7600,9 +7635,14 @@ async def test_list_user_creds_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_user_creds_async( - transport: str = "grpc_asyncio", request_type=firestore_admin.ListUserCredsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + firestore_admin.ListUserCredsRequest(), + {}, + ], +) +async def test_list_user_creds_async(request_type, transport: str = "grpc_asyncio"): client = FirestoreAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7610,7 +7650,7 @@ async def test_list_user_creds_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_user_creds), "__call__") as call: @@ -7630,11 +7670,6 @@ async def test_list_user_creds_async( assert isinstance(response, firestore_admin.ListUserCredsResponse) -@pytest.mark.asyncio -async def test_list_user_creds_async_from_dict(): - await test_list_user_creds_async(request_type=dict) - - def test_list_user_creds_field_headers(): client = FirestoreAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7781,8 +7816,8 @@ async def test_list_user_creds_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - firestore_admin.EnableUserCredsRequest, - dict, + firestore_admin.EnableUserCredsRequest(), + {}, ], ) def test_enable_user_creds(request_type, transport: str = "grpc"): @@ -7793,7 +7828,7 @@ def test_enable_user_creds(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7845,9 +7880,10 @@ def test_enable_user_creds_non_empty_request_with_auto_populated_field(): client.enable_user_creds(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == firestore_admin.EnableUserCredsRequest( + request_msg = firestore_admin.EnableUserCredsRequest( name="name_value", ) + assert args[0] == request_msg def test_enable_user_creds_use_cached_wrapped_rpc(): @@ -7930,9 +7966,14 @@ async def test_enable_user_creds_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_enable_user_creds_async( - transport: str = "grpc_asyncio", request_type=firestore_admin.EnableUserCredsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + firestore_admin.EnableUserCredsRequest(), + {}, + ], +) +async def test_enable_user_creds_async(request_type, transport: str = "grpc_asyncio"): client = FirestoreAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7940,7 +7981,7 @@ async def test_enable_user_creds_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( @@ -7969,11 +8010,6 @@ async def test_enable_user_creds_async( assert response.secure_password == "secure_password_value" -@pytest.mark.asyncio -async def test_enable_user_creds_async_from_dict(): - await test_enable_user_creds_async(request_type=dict) - - def test_enable_user_creds_field_headers(): client = FirestoreAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8128,8 +8164,8 @@ async def test_enable_user_creds_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - firestore_admin.DisableUserCredsRequest, - dict, + firestore_admin.DisableUserCredsRequest(), + {}, ], ) def test_disable_user_creds(request_type, transport: str = "grpc"): @@ -8140,7 +8176,7 @@ def test_disable_user_creds(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8192,9 +8228,10 @@ def test_disable_user_creds_non_empty_request_with_auto_populated_field(): client.disable_user_creds(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == firestore_admin.DisableUserCredsRequest( + request_msg = firestore_admin.DisableUserCredsRequest( name="name_value", ) + assert args[0] == request_msg def test_disable_user_creds_use_cached_wrapped_rpc(): @@ -8279,10 +8316,14 @@ async def test_disable_user_creds_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_disable_user_creds_async( - transport: str = "grpc_asyncio", - request_type=firestore_admin.DisableUserCredsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + firestore_admin.DisableUserCredsRequest(), + {}, + ], +) +async def test_disable_user_creds_async(request_type, transport: str = "grpc_asyncio"): client = FirestoreAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8290,7 +8331,7 @@ async def test_disable_user_creds_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( @@ -8319,11 +8360,6 @@ async def test_disable_user_creds_async( assert response.secure_password == "secure_password_value" -@pytest.mark.asyncio -async def test_disable_user_creds_async_from_dict(): - await test_disable_user_creds_async(request_type=dict) - - def test_disable_user_creds_field_headers(): client = FirestoreAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8478,8 +8514,8 @@ async def test_disable_user_creds_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - firestore_admin.ResetUserPasswordRequest, - dict, + firestore_admin.ResetUserPasswordRequest(), + {}, ], ) def test_reset_user_password(request_type, transport: str = "grpc"): @@ -8490,7 +8526,7 @@ def test_reset_user_password(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8542,9 +8578,10 @@ def test_reset_user_password_non_empty_request_with_auto_populated_field(): client.reset_user_password(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == firestore_admin.ResetUserPasswordRequest( + request_msg = firestore_admin.ResetUserPasswordRequest( name="name_value", ) + assert args[0] == request_msg def test_reset_user_password_use_cached_wrapped_rpc(): @@ -8629,10 +8666,14 @@ async def test_reset_user_password_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_reset_user_password_async( - transport: str = "grpc_asyncio", - request_type=firestore_admin.ResetUserPasswordRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + firestore_admin.ResetUserPasswordRequest(), + {}, + ], +) +async def test_reset_user_password_async(request_type, transport: str = "grpc_asyncio"): client = FirestoreAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8640,7 +8681,7 @@ async def test_reset_user_password_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( @@ -8669,11 +8710,6 @@ async def test_reset_user_password_async( assert response.secure_password == "secure_password_value" -@pytest.mark.asyncio -async def test_reset_user_password_async_from_dict(): - await test_reset_user_password_async(request_type=dict) - - def test_reset_user_password_field_headers(): client = FirestoreAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8828,8 +8864,8 @@ async def test_reset_user_password_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - firestore_admin.DeleteUserCredsRequest, - dict, + firestore_admin.DeleteUserCredsRequest(), + {}, ], ) def test_delete_user_creds(request_type, transport: str = "grpc"): @@ -8840,7 +8876,7 @@ def test_delete_user_creds(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8885,9 +8921,10 @@ def test_delete_user_creds_non_empty_request_with_auto_populated_field(): client.delete_user_creds(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == firestore_admin.DeleteUserCredsRequest( + request_msg = firestore_admin.DeleteUserCredsRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_user_creds_use_cached_wrapped_rpc(): @@ -8970,9 +9007,14 @@ async def test_delete_user_creds_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_user_creds_async( - transport: str = "grpc_asyncio", request_type=firestore_admin.DeleteUserCredsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + firestore_admin.DeleteUserCredsRequest(), + {}, + ], +) +async def test_delete_user_creds_async(request_type, transport: str = "grpc_asyncio"): client = FirestoreAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8980,7 +9022,7 @@ async def test_delete_user_creds_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( @@ -9000,11 +9042,6 @@ async def test_delete_user_creds_async( assert response is None -@pytest.mark.asyncio -async def test_delete_user_creds_async_from_dict(): - await test_delete_user_creds_async(request_type=dict) - - def test_delete_user_creds_field_headers(): client = FirestoreAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9155,8 +9192,8 @@ async def test_delete_user_creds_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - firestore_admin.GetBackupRequest, - dict, + firestore_admin.GetBackupRequest(), + {}, ], ) def test_get_backup(request_type, transport: str = "grpc"): @@ -9167,7 +9204,7 @@ def test_get_backup(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_backup), "__call__") as call: @@ -9217,9 +9254,10 @@ def test_get_backup_non_empty_request_with_auto_populated_field(): client.get_backup(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == firestore_admin.GetBackupRequest( + request_msg = firestore_admin.GetBackupRequest( name="name_value", ) + assert args[0] == request_msg def test_get_backup_use_cached_wrapped_rpc(): @@ -9298,9 +9336,14 @@ async def test_get_backup_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_backup_async( - transport: str = "grpc_asyncio", request_type=firestore_admin.GetBackupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + firestore_admin.GetBackupRequest(), + {}, + ], +) +async def test_get_backup_async(request_type, transport: str = "grpc_asyncio"): client = FirestoreAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9308,7 +9351,7 @@ async def test_get_backup_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_backup), "__call__") as call: @@ -9337,11 +9380,6 @@ async def test_get_backup_async( assert response.state == backup.Backup.State.CREATING -@pytest.mark.asyncio -async def test_get_backup_async_from_dict(): - await test_get_backup_async(request_type=dict) - - def test_get_backup_field_headers(): client = FirestoreAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9484,8 +9522,8 @@ async def test_get_backup_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - firestore_admin.ListBackupsRequest, - dict, + firestore_admin.ListBackupsRequest(), + {}, ], ) def test_list_backups(request_type, transport: str = "grpc"): @@ -9496,7 +9534,7 @@ def test_list_backups(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_backups), "__call__") as call: @@ -9541,10 +9579,11 @@ def test_list_backups_non_empty_request_with_auto_populated_field(): client.list_backups(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == firestore_admin.ListBackupsRequest( + request_msg = firestore_admin.ListBackupsRequest( parent="parent_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_backups_use_cached_wrapped_rpc(): @@ -9625,9 +9664,14 @@ async def test_list_backups_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_backups_async( - transport: str = "grpc_asyncio", request_type=firestore_admin.ListBackupsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + firestore_admin.ListBackupsRequest(), + {}, + ], +) +async def test_list_backups_async(request_type, transport: str = "grpc_asyncio"): client = FirestoreAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9635,7 +9679,7 @@ async def test_list_backups_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_backups), "__call__") as call: @@ -9658,11 +9702,6 @@ async def test_list_backups_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_backups_async_from_dict(): - await test_list_backups_async(request_type=dict) - - def test_list_backups_field_headers(): client = FirestoreAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9809,8 +9848,8 @@ async def test_list_backups_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - firestore_admin.DeleteBackupRequest, - dict, + firestore_admin.DeleteBackupRequest(), + {}, ], ) def test_delete_backup(request_type, transport: str = "grpc"): @@ -9821,7 +9860,7 @@ def test_delete_backup(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_backup), "__call__") as call: @@ -9862,9 +9901,10 @@ def test_delete_backup_non_empty_request_with_auto_populated_field(): client.delete_backup(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == firestore_admin.DeleteBackupRequest( + request_msg = firestore_admin.DeleteBackupRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_backup_use_cached_wrapped_rpc(): @@ -9945,9 +9985,14 @@ async def test_delete_backup_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_backup_async( - transport: str = "grpc_asyncio", request_type=firestore_admin.DeleteBackupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + firestore_admin.DeleteBackupRequest(), + {}, + ], +) +async def test_delete_backup_async(request_type, transport: str = "grpc_asyncio"): client = FirestoreAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9955,7 +10000,7 @@ async def test_delete_backup_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_backup), "__call__") as call: @@ -9973,11 +10018,6 @@ async def test_delete_backup_async( assert response is None -@pytest.mark.asyncio -async def test_delete_backup_async_from_dict(): - await test_delete_backup_async(request_type=dict) - - def test_delete_backup_field_headers(): client = FirestoreAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10120,8 +10160,8 @@ async def test_delete_backup_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - firestore_admin.RestoreDatabaseRequest, - dict, + firestore_admin.RestoreDatabaseRequest(), + {}, ], ) def test_restore_database(request_type, transport: str = "grpc"): @@ -10132,7 +10172,7 @@ def test_restore_database(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.restore_database), "__call__") as call: @@ -10175,11 +10215,12 @@ def test_restore_database_non_empty_request_with_auto_populated_field(): client.restore_database(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == firestore_admin.RestoreDatabaseRequest( + request_msg = firestore_admin.RestoreDatabaseRequest( parent="parent_value", database_id="database_id_value", backup="backup_value", ) + assert args[0] == request_msg def test_restore_database_use_cached_wrapped_rpc(): @@ -10272,9 +10313,14 @@ async def test_restore_database_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_restore_database_async( - transport: str = "grpc_asyncio", request_type=firestore_admin.RestoreDatabaseRequest -): +@pytest.mark.parametrize( + "request_type", + [ + firestore_admin.RestoreDatabaseRequest(), + {}, + ], +) +async def test_restore_database_async(request_type, transport: str = "grpc_asyncio"): client = FirestoreAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10282,7 +10328,7 @@ async def test_restore_database_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.restore_database), "__call__") as call: @@ -10302,11 +10348,6 @@ async def test_restore_database_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_restore_database_async_from_dict(): - await test_restore_database_async(request_type=dict) - - def test_restore_database_field_headers(): client = FirestoreAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10371,8 +10412,8 @@ async def test_restore_database_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - firestore_admin.CreateBackupScheduleRequest, - dict, + firestore_admin.CreateBackupScheduleRequest(), + {}, ], ) def test_create_backup_schedule(request_type, transport: str = "grpc"): @@ -10383,7 +10424,7 @@ def test_create_backup_schedule(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10431,9 +10472,10 @@ def test_create_backup_schedule_non_empty_request_with_auto_populated_field(): client.create_backup_schedule(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == firestore_admin.CreateBackupScheduleRequest( + request_msg = firestore_admin.CreateBackupScheduleRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_backup_schedule_use_cached_wrapped_rpc(): @@ -10519,9 +10561,15 @@ async def test_create_backup_schedule_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + firestore_admin.CreateBackupScheduleRequest(), + {}, + ], +) async def test_create_backup_schedule_async( - transport: str = "grpc_asyncio", - request_type=firestore_admin.CreateBackupScheduleRequest, + request_type, transport: str = "grpc_asyncio" ): client = FirestoreAdminAsyncClient( credentials=async_anonymous_credentials(), @@ -10530,7 +10578,7 @@ async def test_create_backup_schedule_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( @@ -10555,11 +10603,6 @@ async def test_create_backup_schedule_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_create_backup_schedule_async_from_dict(): - await test_create_backup_schedule_async(request_type=dict) - - def test_create_backup_schedule_field_headers(): client = FirestoreAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10724,8 +10767,8 @@ async def test_create_backup_schedule_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - firestore_admin.GetBackupScheduleRequest, - dict, + firestore_admin.GetBackupScheduleRequest(), + {}, ], ) def test_get_backup_schedule(request_type, transport: str = "grpc"): @@ -10736,7 +10779,7 @@ def test_get_backup_schedule(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10784,9 +10827,10 @@ def test_get_backup_schedule_non_empty_request_with_auto_populated_field(): client.get_backup_schedule(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == firestore_admin.GetBackupScheduleRequest( + request_msg = firestore_admin.GetBackupScheduleRequest( name="name_value", ) + assert args[0] == request_msg def test_get_backup_schedule_use_cached_wrapped_rpc(): @@ -10871,10 +10915,14 @@ async def test_get_backup_schedule_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_backup_schedule_async( - transport: str = "grpc_asyncio", - request_type=firestore_admin.GetBackupScheduleRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + firestore_admin.GetBackupScheduleRequest(), + {}, + ], +) +async def test_get_backup_schedule_async(request_type, transport: str = "grpc_asyncio"): client = FirestoreAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10882,7 +10930,7 @@ async def test_get_backup_schedule_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( @@ -10907,11 +10955,6 @@ async def test_get_backup_schedule_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_backup_schedule_async_from_dict(): - await test_get_backup_schedule_async(request_type=dict) - - def test_get_backup_schedule_field_headers(): client = FirestoreAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11066,8 +11109,8 @@ async def test_get_backup_schedule_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - firestore_admin.ListBackupSchedulesRequest, - dict, + firestore_admin.ListBackupSchedulesRequest(), + {}, ], ) def test_list_backup_schedules(request_type, transport: str = "grpc"): @@ -11078,7 +11121,7 @@ def test_list_backup_schedules(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11123,9 +11166,10 @@ def test_list_backup_schedules_non_empty_request_with_auto_populated_field(): client.list_backup_schedules(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == firestore_admin.ListBackupSchedulesRequest( + request_msg = firestore_admin.ListBackupSchedulesRequest( parent="parent_value", ) + assert args[0] == request_msg def test_list_backup_schedules_use_cached_wrapped_rpc(): @@ -11211,9 +11255,15 @@ async def test_list_backup_schedules_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + firestore_admin.ListBackupSchedulesRequest(), + {}, + ], +) async def test_list_backup_schedules_async( - transport: str = "grpc_asyncio", - request_type=firestore_admin.ListBackupSchedulesRequest, + request_type, transport: str = "grpc_asyncio" ): client = FirestoreAdminAsyncClient( credentials=async_anonymous_credentials(), @@ -11222,7 +11272,7 @@ async def test_list_backup_schedules_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( @@ -11244,11 +11294,6 @@ async def test_list_backup_schedules_async( assert isinstance(response, firestore_admin.ListBackupSchedulesResponse) -@pytest.mark.asyncio -async def test_list_backup_schedules_async_from_dict(): - await test_list_backup_schedules_async(request_type=dict) - - def test_list_backup_schedules_field_headers(): client = FirestoreAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11403,8 +11448,8 @@ async def test_list_backup_schedules_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - firestore_admin.UpdateBackupScheduleRequest, - dict, + firestore_admin.UpdateBackupScheduleRequest(), + {}, ], ) def test_update_backup_schedule(request_type, transport: str = "grpc"): @@ -11415,7 +11460,7 @@ def test_update_backup_schedule(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11461,7 +11506,8 @@ def test_update_backup_schedule_non_empty_request_with_auto_populated_field(): client.update_backup_schedule(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == firestore_admin.UpdateBackupScheduleRequest() + request_msg = firestore_admin.UpdateBackupScheduleRequest() + assert args[0] == request_msg def test_update_backup_schedule_use_cached_wrapped_rpc(): @@ -11547,9 +11593,15 @@ async def test_update_backup_schedule_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + firestore_admin.UpdateBackupScheduleRequest(), + {}, + ], +) async def test_update_backup_schedule_async( - transport: str = "grpc_asyncio", - request_type=firestore_admin.UpdateBackupScheduleRequest, + request_type, transport: str = "grpc_asyncio" ): client = FirestoreAdminAsyncClient( credentials=async_anonymous_credentials(), @@ -11558,7 +11610,7 @@ async def test_update_backup_schedule_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( @@ -11583,11 +11635,6 @@ async def test_update_backup_schedule_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_update_backup_schedule_async_from_dict(): - await test_update_backup_schedule_async(request_type=dict) - - def test_update_backup_schedule_field_headers(): client = FirestoreAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11752,8 +11799,8 @@ async def test_update_backup_schedule_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - firestore_admin.DeleteBackupScheduleRequest, - dict, + firestore_admin.DeleteBackupScheduleRequest(), + {}, ], ) def test_delete_backup_schedule(request_type, transport: str = "grpc"): @@ -11764,7 +11811,7 @@ def test_delete_backup_schedule(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11809,9 +11856,10 @@ def test_delete_backup_schedule_non_empty_request_with_auto_populated_field(): client.delete_backup_schedule(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == firestore_admin.DeleteBackupScheduleRequest( + request_msg = firestore_admin.DeleteBackupScheduleRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_backup_schedule_use_cached_wrapped_rpc(): @@ -11897,9 +11945,15 @@ async def test_delete_backup_schedule_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + firestore_admin.DeleteBackupScheduleRequest(), + {}, + ], +) async def test_delete_backup_schedule_async( - transport: str = "grpc_asyncio", - request_type=firestore_admin.DeleteBackupScheduleRequest, + request_type, transport: str = "grpc_asyncio" ): client = FirestoreAdminAsyncClient( credentials=async_anonymous_credentials(), @@ -11908,7 +11962,7 @@ async def test_delete_backup_schedule_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( @@ -11928,11 +11982,6 @@ async def test_delete_backup_schedule_async( assert response is None -@pytest.mark.asyncio -async def test_delete_backup_schedule_async_from_dict(): - await test_delete_backup_schedule_async(request_type=dict) - - def test_delete_backup_schedule_field_headers(): client = FirestoreAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12083,8 +12132,8 @@ async def test_delete_backup_schedule_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - firestore_admin.CloneDatabaseRequest, - dict, + firestore_admin.CloneDatabaseRequest(), + {}, ], ) def test_clone_database(request_type, transport: str = "grpc"): @@ -12095,7 +12144,7 @@ def test_clone_database(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.clone_database), "__call__") as call: @@ -12137,10 +12186,11 @@ def test_clone_database_non_empty_request_with_auto_populated_field(): client.clone_database(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == firestore_admin.CloneDatabaseRequest( + request_msg = firestore_admin.CloneDatabaseRequest( parent="parent_value", database_id="database_id_value", ) + assert args[0] == request_msg def test_clone_database_use_cached_wrapped_rpc(): @@ -12231,9 +12281,14 @@ async def test_clone_database_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_clone_database_async( - transport: str = "grpc_asyncio", request_type=firestore_admin.CloneDatabaseRequest -): +@pytest.mark.parametrize( + "request_type", + [ + firestore_admin.CloneDatabaseRequest(), + {}, + ], +) +async def test_clone_database_async(request_type, transport: str = "grpc_asyncio"): client = FirestoreAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12241,7 +12296,7 @@ async def test_clone_database_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.clone_database), "__call__") as call: @@ -12261,11 +12316,6 @@ async def test_clone_database_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_clone_database_async_from_dict(): - await test_clone_database_async(request_type=dict) - - def test_create_index_rest_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, # instead of constructing them on each call @@ -18290,7 +18340,6 @@ def test_create_index_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.CreateIndexRequest() - assert args[0] == request_msg @@ -18311,7 +18360,6 @@ def test_list_indexes_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.ListIndexesRequest() - assert args[0] == request_msg @@ -18332,7 +18380,6 @@ def test_get_index_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.GetIndexRequest() - assert args[0] == request_msg @@ -18353,7 +18400,6 @@ def test_delete_index_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.DeleteIndexRequest() - assert args[0] == request_msg @@ -18374,7 +18420,6 @@ def test_get_field_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.GetFieldRequest() - assert args[0] == request_msg @@ -18395,7 +18440,6 @@ def test_update_field_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.UpdateFieldRequest() - assert args[0] == request_msg @@ -18416,7 +18460,6 @@ def test_list_fields_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.ListFieldsRequest() - assert args[0] == request_msg @@ -18437,7 +18480,6 @@ def test_export_documents_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.ExportDocumentsRequest() - assert args[0] == request_msg @@ -18458,7 +18500,6 @@ def test_import_documents_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.ImportDocumentsRequest() - assert args[0] == request_msg @@ -18481,7 +18522,6 @@ def test_bulk_delete_documents_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.BulkDeleteDocumentsRequest() - assert args[0] == request_msg @@ -18502,7 +18542,6 @@ def test_create_database_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.CreateDatabaseRequest() - assert args[0] == request_msg @@ -18523,7 +18562,6 @@ def test_get_database_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.GetDatabaseRequest() - assert args[0] == request_msg @@ -18544,7 +18582,6 @@ def test_list_databases_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.ListDatabasesRequest() - assert args[0] == request_msg @@ -18565,7 +18602,6 @@ def test_update_database_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.UpdateDatabaseRequest() - assert args[0] == request_msg @@ -18586,7 +18622,6 @@ def test_delete_database_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.DeleteDatabaseRequest() - assert args[0] == request_msg @@ -18609,7 +18644,6 @@ def test_create_user_creds_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.CreateUserCredsRequest() - assert args[0] == request_msg @@ -18630,7 +18664,6 @@ def test_get_user_creds_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.GetUserCredsRequest() - assert args[0] == request_msg @@ -18651,7 +18684,6 @@ def test_list_user_creds_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.ListUserCredsRequest() - assert args[0] == request_msg @@ -18674,7 +18706,6 @@ def test_enable_user_creds_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.EnableUserCredsRequest() - assert args[0] == request_msg @@ -18697,7 +18728,6 @@ def test_disable_user_creds_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.DisableUserCredsRequest() - assert args[0] == request_msg @@ -18720,7 +18750,6 @@ def test_reset_user_password_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.ResetUserPasswordRequest() - assert args[0] == request_msg @@ -18743,7 +18772,6 @@ def test_delete_user_creds_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.DeleteUserCredsRequest() - assert args[0] == request_msg @@ -18764,7 +18792,6 @@ def test_get_backup_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.GetBackupRequest() - assert args[0] == request_msg @@ -18785,7 +18812,6 @@ def test_list_backups_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.ListBackupsRequest() - assert args[0] == request_msg @@ -18806,7 +18832,6 @@ def test_delete_backup_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.DeleteBackupRequest() - assert args[0] == request_msg @@ -18827,7 +18852,6 @@ def test_restore_database_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.RestoreDatabaseRequest() - assert args[0] == request_msg @@ -18850,7 +18874,6 @@ def test_create_backup_schedule_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.CreateBackupScheduleRequest() - assert args[0] == request_msg @@ -18873,7 +18896,6 @@ def test_get_backup_schedule_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.GetBackupScheduleRequest() - assert args[0] == request_msg @@ -18896,7 +18918,6 @@ def test_list_backup_schedules_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.ListBackupSchedulesRequest() - assert args[0] == request_msg @@ -18919,7 +18940,6 @@ def test_update_backup_schedule_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.UpdateBackupScheduleRequest() - assert args[0] == request_msg @@ -18942,7 +18962,6 @@ def test_delete_backup_schedule_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.DeleteBackupScheduleRequest() - assert args[0] == request_msg @@ -18963,7 +18982,6 @@ def test_clone_database_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.CloneDatabaseRequest() - assert args[0] == request_msg @@ -18986,7 +19004,6 @@ def test_clone_database_routing_parameters_request_1_grpc(): request_msg = firestore_admin.CloneDatabaseRequest( **{"pitr_snapshot": {"database": "projects/sample1/sample2"}} ) - assert args[0] == request_msg expected_headers = {"project_id": "sample1"} @@ -19022,7 +19039,6 @@ def test_clone_database_routing_parameters_request_2_grpc(): } } ) - assert args[0] == request_msg expected_headers = {"project_id": "sample1", "database_id": "sample2"} @@ -19066,7 +19082,6 @@ async def test_create_index_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.CreateIndexRequest() - assert args[0] == request_msg @@ -19093,7 +19108,6 @@ async def test_list_indexes_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.ListIndexesRequest() - assert args[0] == request_msg @@ -19127,7 +19141,6 @@ async def test_get_index_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.GetIndexRequest() - assert args[0] == request_msg @@ -19150,7 +19163,6 @@ async def test_delete_index_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.DeleteIndexRequest() - assert args[0] == request_msg @@ -19177,7 +19189,6 @@ async def test_get_field_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.GetFieldRequest() - assert args[0] == request_msg @@ -19202,7 +19213,6 @@ async def test_update_field_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.UpdateFieldRequest() - assert args[0] == request_msg @@ -19229,7 +19239,6 @@ async def test_list_fields_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.ListFieldsRequest() - assert args[0] == request_msg @@ -19254,7 +19263,6 @@ async def test_export_documents_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.ExportDocumentsRequest() - assert args[0] == request_msg @@ -19279,7 +19287,6 @@ async def test_import_documents_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.ImportDocumentsRequest() - assert args[0] == request_msg @@ -19306,7 +19313,6 @@ async def test_bulk_delete_documents_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.BulkDeleteDocumentsRequest() - assert args[0] == request_msg @@ -19331,7 +19337,6 @@ async def test_create_database_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.CreateDatabaseRequest() - assert args[0] == request_msg @@ -19373,7 +19378,6 @@ async def test_get_database_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.GetDatabaseRequest() - assert args[0] == request_msg @@ -19400,7 +19404,6 @@ async def test_list_databases_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.ListDatabasesRequest() - assert args[0] == request_msg @@ -19425,7 +19428,6 @@ async def test_update_database_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.UpdateDatabaseRequest() - assert args[0] == request_msg @@ -19450,7 +19452,6 @@ async def test_delete_database_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.DeleteDatabaseRequest() - assert args[0] == request_msg @@ -19481,7 +19482,6 @@ async def test_create_user_creds_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.CreateUserCredsRequest() - assert args[0] == request_msg @@ -19510,7 +19510,6 @@ async def test_get_user_creds_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.GetUserCredsRequest() - assert args[0] == request_msg @@ -19535,7 +19534,6 @@ async def test_list_user_creds_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.ListUserCredsRequest() - assert args[0] == request_msg @@ -19566,7 +19564,6 @@ async def test_enable_user_creds_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.EnableUserCredsRequest() - assert args[0] == request_msg @@ -19597,7 +19594,6 @@ async def test_disable_user_creds_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.DisableUserCredsRequest() - assert args[0] == request_msg @@ -19628,7 +19624,6 @@ async def test_reset_user_password_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.ResetUserPasswordRequest() - assert args[0] == request_msg @@ -19653,7 +19648,6 @@ async def test_delete_user_creds_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.DeleteUserCredsRequest() - assert args[0] == request_msg @@ -19683,7 +19677,6 @@ async def test_get_backup_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.GetBackupRequest() - assert args[0] == request_msg @@ -19710,7 +19703,6 @@ async def test_list_backups_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.ListBackupsRequest() - assert args[0] == request_msg @@ -19733,7 +19725,6 @@ async def test_delete_backup_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.DeleteBackupRequest() - assert args[0] == request_msg @@ -19758,7 +19749,6 @@ async def test_restore_database_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.RestoreDatabaseRequest() - assert args[0] == request_msg @@ -19787,7 +19777,6 @@ async def test_create_backup_schedule_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.CreateBackupScheduleRequest() - assert args[0] == request_msg @@ -19816,7 +19805,6 @@ async def test_get_backup_schedule_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.GetBackupScheduleRequest() - assert args[0] == request_msg @@ -19843,7 +19831,6 @@ async def test_list_backup_schedules_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.ListBackupSchedulesRequest() - assert args[0] == request_msg @@ -19872,7 +19859,6 @@ async def test_update_backup_schedule_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.UpdateBackupScheduleRequest() - assert args[0] == request_msg @@ -19897,7 +19883,6 @@ async def test_delete_backup_schedule_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.DeleteBackupScheduleRequest() - assert args[0] == request_msg @@ -19922,7 +19907,6 @@ async def test_clone_database_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.CloneDatabaseRequest() - assert args[0] == request_msg @@ -19949,7 +19933,6 @@ async def test_clone_database_routing_parameters_request_1_grpc_asyncio(): request_msg = firestore_admin.CloneDatabaseRequest( **{"pitr_snapshot": {"database": "projects/sample1/sample2"}} ) - assert args[0] == request_msg expected_headers = {"project_id": "sample1"} @@ -19989,7 +19972,6 @@ async def test_clone_database_routing_parameters_request_2_grpc_asyncio(): } } ) - assert args[0] == request_msg expected_headers = {"project_id": "sample1", "database_id": "sample2"} @@ -25098,7 +25080,6 @@ def test_create_index_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.CreateIndexRequest() - assert args[0] == request_msg @@ -25118,7 +25099,6 @@ def test_list_indexes_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.ListIndexesRequest() - assert args[0] == request_msg @@ -25138,7 +25118,6 @@ def test_get_index_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.GetIndexRequest() - assert args[0] == request_msg @@ -25158,7 +25137,6 @@ def test_delete_index_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.DeleteIndexRequest() - assert args[0] == request_msg @@ -25178,7 +25156,6 @@ def test_get_field_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.GetFieldRequest() - assert args[0] == request_msg @@ -25198,7 +25175,6 @@ def test_update_field_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.UpdateFieldRequest() - assert args[0] == request_msg @@ -25218,7 +25194,6 @@ def test_list_fields_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.ListFieldsRequest() - assert args[0] == request_msg @@ -25238,7 +25213,6 @@ def test_export_documents_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.ExportDocumentsRequest() - assert args[0] == request_msg @@ -25258,7 +25232,6 @@ def test_import_documents_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.ImportDocumentsRequest() - assert args[0] == request_msg @@ -25280,7 +25253,6 @@ def test_bulk_delete_documents_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.BulkDeleteDocumentsRequest() - assert args[0] == request_msg @@ -25300,7 +25272,6 @@ def test_create_database_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.CreateDatabaseRequest() - assert args[0] == request_msg @@ -25320,7 +25291,6 @@ def test_get_database_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.GetDatabaseRequest() - assert args[0] == request_msg @@ -25340,7 +25310,6 @@ def test_list_databases_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.ListDatabasesRequest() - assert args[0] == request_msg @@ -25360,7 +25329,6 @@ def test_update_database_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.UpdateDatabaseRequest() - assert args[0] == request_msg @@ -25380,7 +25348,6 @@ def test_delete_database_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.DeleteDatabaseRequest() - assert args[0] == request_msg @@ -25402,7 +25369,6 @@ def test_create_user_creds_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.CreateUserCredsRequest() - assert args[0] == request_msg @@ -25422,7 +25388,6 @@ def test_get_user_creds_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.GetUserCredsRequest() - assert args[0] == request_msg @@ -25442,7 +25407,6 @@ def test_list_user_creds_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.ListUserCredsRequest() - assert args[0] == request_msg @@ -25464,7 +25428,6 @@ def test_enable_user_creds_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.EnableUserCredsRequest() - assert args[0] == request_msg @@ -25486,7 +25449,6 @@ def test_disable_user_creds_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.DisableUserCredsRequest() - assert args[0] == request_msg @@ -25508,7 +25470,6 @@ def test_reset_user_password_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.ResetUserPasswordRequest() - assert args[0] == request_msg @@ -25530,7 +25491,6 @@ def test_delete_user_creds_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.DeleteUserCredsRequest() - assert args[0] == request_msg @@ -25550,7 +25510,6 @@ def test_get_backup_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.GetBackupRequest() - assert args[0] == request_msg @@ -25570,7 +25529,6 @@ def test_list_backups_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.ListBackupsRequest() - assert args[0] == request_msg @@ -25590,7 +25548,6 @@ def test_delete_backup_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.DeleteBackupRequest() - assert args[0] == request_msg @@ -25610,7 +25567,6 @@ def test_restore_database_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.RestoreDatabaseRequest() - assert args[0] == request_msg @@ -25632,7 +25588,6 @@ def test_create_backup_schedule_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.CreateBackupScheduleRequest() - assert args[0] == request_msg @@ -25654,7 +25609,6 @@ def test_get_backup_schedule_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.GetBackupScheduleRequest() - assert args[0] == request_msg @@ -25676,7 +25630,6 @@ def test_list_backup_schedules_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.ListBackupSchedulesRequest() - assert args[0] == request_msg @@ -25698,7 +25651,6 @@ def test_update_backup_schedule_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.UpdateBackupScheduleRequest() - assert args[0] == request_msg @@ -25720,7 +25672,6 @@ def test_delete_backup_schedule_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.DeleteBackupScheduleRequest() - assert args[0] == request_msg @@ -25740,7 +25691,6 @@ def test_clone_database_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore_admin.CloneDatabaseRequest() - assert args[0] == request_msg @@ -25762,7 +25712,6 @@ def test_clone_database_routing_parameters_request_1_rest(): request_msg = firestore_admin.CloneDatabaseRequest( **{"pitr_snapshot": {"database": "projects/sample1/sample2"}} ) - assert args[0] == request_msg expected_headers = {"project_id": "sample1"} @@ -25797,7 +25746,6 @@ def test_clone_database_routing_parameters_request_2_rest(): } } ) - assert args[0] == request_msg expected_headers = {"project_id": "sample1", "database_id": "sample2"} diff --git a/packages/google-cloud-firestore/tests/unit/gapic/firestore_v1/test_firestore.py b/packages/google-cloud-firestore/tests/unit/gapic/firestore_v1/test_firestore.py index 664b3a39bd30..819c67f2cacf 100644 --- a/packages/google-cloud-firestore/tests/unit/gapic/firestore_v1/test_firestore.py +++ b/packages/google-cloud-firestore/tests/unit/gapic/firestore_v1/test_firestore.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 @@ -125,6 +126,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" @@ -1285,8 +1301,8 @@ def test_firestore_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - firestore.GetDocumentRequest, - dict, + firestore.GetDocumentRequest(), + {}, ], ) def test_get_document(request_type, transport: str = "grpc"): @@ -1297,7 +1313,7 @@ def test_get_document(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_document), "__call__") as call: @@ -1341,9 +1357,10 @@ def test_get_document_non_empty_request_with_auto_populated_field(): client.get_document(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == firestore.GetDocumentRequest( + request_msg = firestore.GetDocumentRequest( name="name_value", ) + assert args[0] == request_msg def test_get_document_use_cached_wrapped_rpc(): @@ -1424,9 +1441,14 @@ async def test_get_document_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_document_async( - transport: str = "grpc_asyncio", request_type=firestore.GetDocumentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + firestore.GetDocumentRequest(), + {}, + ], +) +async def test_get_document_async(request_type, transport: str = "grpc_asyncio"): client = FirestoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1434,7 +1456,7 @@ async def test_get_document_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_document), "__call__") as call: @@ -1457,11 +1479,6 @@ async def test_get_document_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_document_async_from_dict(): - await test_get_document_async(request_type=dict) - - def test_get_document_field_headers(): client = FirestoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1524,8 +1541,8 @@ async def test_get_document_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - firestore.ListDocumentsRequest, - dict, + firestore.ListDocumentsRequest(), + {}, ], ) def test_list_documents(request_type, transport: str = "grpc"): @@ -1536,7 +1553,7 @@ def test_list_documents(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_documents), "__call__") as call: @@ -1583,12 +1600,13 @@ def test_list_documents_non_empty_request_with_auto_populated_field(): client.list_documents(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == firestore.ListDocumentsRequest( + request_msg = firestore.ListDocumentsRequest( parent="parent_value", collection_id="collection_id_value", page_token="page_token_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_documents_use_cached_wrapped_rpc(): @@ -1669,9 +1687,14 @@ async def test_list_documents_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_documents_async( - transport: str = "grpc_asyncio", request_type=firestore.ListDocumentsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + firestore.ListDocumentsRequest(), + {}, + ], +) +async def test_list_documents_async(request_type, transport: str = "grpc_asyncio"): client = FirestoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1679,7 +1702,7 @@ async def test_list_documents_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_documents), "__call__") as call: @@ -1702,11 +1725,6 @@ async def test_list_documents_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_documents_async_from_dict(): - await test_list_documents_async(request_type=dict) - - def test_list_documents_field_headers(): client = FirestoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1968,8 +1986,8 @@ async def test_list_documents_async_pages(): @pytest.mark.parametrize( "request_type", [ - firestore.UpdateDocumentRequest, - dict, + firestore.UpdateDocumentRequest(), + {}, ], ) def test_update_document(request_type, transport: str = "grpc"): @@ -1980,7 +1998,7 @@ def test_update_document(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_document), "__call__") as call: @@ -2022,7 +2040,8 @@ def test_update_document_non_empty_request_with_auto_populated_field(): client.update_document(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == firestore.UpdateDocumentRequest() + request_msg = firestore.UpdateDocumentRequest() + assert args[0] == request_msg def test_update_document_use_cached_wrapped_rpc(): @@ -2103,9 +2122,14 @@ async def test_update_document_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_document_async( - transport: str = "grpc_asyncio", request_type=firestore.UpdateDocumentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + firestore.UpdateDocumentRequest(), + {}, + ], +) +async def test_update_document_async(request_type, transport: str = "grpc_asyncio"): client = FirestoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2113,7 +2137,7 @@ async def test_update_document_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_document), "__call__") as call: @@ -2136,11 +2160,6 @@ async def test_update_document_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_update_document_async_from_dict(): - await test_update_document_async(request_type=dict) - - def test_update_document_field_headers(): client = FirestoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2297,8 +2316,8 @@ async def test_update_document_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - firestore.DeleteDocumentRequest, - dict, + firestore.DeleteDocumentRequest(), + {}, ], ) def test_delete_document(request_type, transport: str = "grpc"): @@ -2309,7 +2328,7 @@ def test_delete_document(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_document), "__call__") as call: @@ -2350,9 +2369,10 @@ def test_delete_document_non_empty_request_with_auto_populated_field(): client.delete_document(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == firestore.DeleteDocumentRequest( + request_msg = firestore.DeleteDocumentRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_document_use_cached_wrapped_rpc(): @@ -2433,9 +2453,14 @@ async def test_delete_document_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_document_async( - transport: str = "grpc_asyncio", request_type=firestore.DeleteDocumentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + firestore.DeleteDocumentRequest(), + {}, + ], +) +async def test_delete_document_async(request_type, transport: str = "grpc_asyncio"): client = FirestoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2443,7 +2468,7 @@ async def test_delete_document_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_document), "__call__") as call: @@ -2461,11 +2486,6 @@ async def test_delete_document_async( assert response is None -@pytest.mark.asyncio -async def test_delete_document_async_from_dict(): - await test_delete_document_async(request_type=dict) - - def test_delete_document_field_headers(): client = FirestoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2608,8 +2628,8 @@ async def test_delete_document_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - firestore.BatchGetDocumentsRequest, - dict, + firestore.BatchGetDocumentsRequest(), + {}, ], ) def test_batch_get_documents(request_type, transport: str = "grpc"): @@ -2620,7 +2640,7 @@ def test_batch_get_documents(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2666,9 +2686,10 @@ def test_batch_get_documents_non_empty_request_with_auto_populated_field(): client.batch_get_documents(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == firestore.BatchGetDocumentsRequest( + request_msg = firestore.BatchGetDocumentsRequest( database="database_value", ) + assert args[0] == request_msg def test_batch_get_documents_use_cached_wrapped_rpc(): @@ -2753,9 +2774,14 @@ async def test_batch_get_documents_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_batch_get_documents_async( - transport: str = "grpc_asyncio", request_type=firestore.BatchGetDocumentsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + firestore.BatchGetDocumentsRequest(), + {}, + ], +) +async def test_batch_get_documents_async(request_type, transport: str = "grpc_asyncio"): client = FirestoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2763,7 +2789,7 @@ async def test_batch_get_documents_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( @@ -2787,11 +2813,6 @@ async def test_batch_get_documents_async( assert isinstance(message, firestore.BatchGetDocumentsResponse) -@pytest.mark.asyncio -async def test_batch_get_documents_async_from_dict(): - await test_batch_get_documents_async(request_type=dict) - - def test_batch_get_documents_field_headers(): client = FirestoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2861,8 +2882,8 @@ async def test_batch_get_documents_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - firestore.BeginTransactionRequest, - dict, + firestore.BeginTransactionRequest(), + {}, ], ) def test_begin_transaction(request_type, transport: str = "grpc"): @@ -2873,7 +2894,7 @@ def test_begin_transaction(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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 +2942,10 @@ def test_begin_transaction_non_empty_request_with_auto_populated_field(): client.begin_transaction(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == firestore.BeginTransactionRequest( + request_msg = firestore.BeginTransactionRequest( database="database_value", ) + assert args[0] == request_msg def test_begin_transaction_use_cached_wrapped_rpc(): @@ -3006,9 +3028,14 @@ async def test_begin_transaction_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_begin_transaction_async( - transport: str = "grpc_asyncio", request_type=firestore.BeginTransactionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + firestore.BeginTransactionRequest(), + {}, + ], +) +async def test_begin_transaction_async(request_type, transport: str = "grpc_asyncio"): client = FirestoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3016,7 +3043,7 @@ async def test_begin_transaction_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( @@ -3041,11 +3068,6 @@ async def test_begin_transaction_async( assert response.transaction == b"transaction_blob" -@pytest.mark.asyncio -async def test_begin_transaction_async_from_dict(): - await test_begin_transaction_async(request_type=dict) - - def test_begin_transaction_field_headers(): client = FirestoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3200,8 +3222,8 @@ async def test_begin_transaction_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - firestore.CommitRequest, - dict, + firestore.CommitRequest(), + {}, ], ) def test_commit(request_type, transport: str = "grpc"): @@ -3212,7 +3234,7 @@ def test_commit(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.commit), "__call__") as call: @@ -3253,9 +3275,10 @@ def test_commit_non_empty_request_with_auto_populated_field(): client.commit(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == firestore.CommitRequest( + request_msg = firestore.CommitRequest( database="database_value", ) + assert args[0] == request_msg def test_commit_use_cached_wrapped_rpc(): @@ -3334,9 +3357,14 @@ async def test_commit_async_use_cached_wrapped_rpc(transport: str = "grpc_asynci @pytest.mark.asyncio -async def test_commit_async( - transport: str = "grpc_asyncio", request_type=firestore.CommitRequest -): +@pytest.mark.parametrize( + "request_type", + [ + firestore.CommitRequest(), + {}, + ], +) +async def test_commit_async(request_type, transport: str = "grpc_asyncio"): client = FirestoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3344,7 +3372,7 @@ async def test_commit_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.commit), "__call__") as call: @@ -3364,11 +3392,6 @@ async def test_commit_async( assert isinstance(response, firestore.CommitResponse) -@pytest.mark.asyncio -async def test_commit_async_from_dict(): - await test_commit_async(request_type=dict) - - def test_commit_field_headers(): client = FirestoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3525,8 +3548,8 @@ async def test_commit_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - firestore.RollbackRequest, - dict, + firestore.RollbackRequest(), + {}, ], ) def test_rollback(request_type, transport: str = "grpc"): @@ -3537,7 +3560,7 @@ def test_rollback(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.rollback), "__call__") as call: @@ -3578,9 +3601,10 @@ def test_rollback_non_empty_request_with_auto_populated_field(): client.rollback(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == firestore.RollbackRequest( + request_msg = firestore.RollbackRequest( database="database_value", ) + assert args[0] == request_msg def test_rollback_use_cached_wrapped_rpc(): @@ -3659,9 +3683,14 @@ async def test_rollback_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn @pytest.mark.asyncio -async def test_rollback_async( - transport: str = "grpc_asyncio", request_type=firestore.RollbackRequest -): +@pytest.mark.parametrize( + "request_type", + [ + firestore.RollbackRequest(), + {}, + ], +) +async def test_rollback_async(request_type, transport: str = "grpc_asyncio"): client = FirestoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3669,7 +3698,7 @@ async def test_rollback_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.rollback), "__call__") as call: @@ -3687,11 +3716,6 @@ async def test_rollback_async( assert response is None -@pytest.mark.asyncio -async def test_rollback_async_from_dict(): - await test_rollback_async(request_type=dict) - - def test_rollback_field_headers(): client = FirestoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3844,8 +3868,8 @@ async def test_rollback_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - firestore.RunQueryRequest, - dict, + firestore.RunQueryRequest(), + {}, ], ) def test_run_query(request_type, transport: str = "grpc"): @@ -3856,7 +3880,7 @@ def test_run_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(type(client.transport.run_query), "__call__") as call: @@ -3898,9 +3922,10 @@ def test_run_query_non_empty_request_with_auto_populated_field(): client.run_query(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == firestore.RunQueryRequest( + request_msg = firestore.RunQueryRequest( parent="parent_value", ) + assert args[0] == request_msg def test_run_query_use_cached_wrapped_rpc(): @@ -3979,9 +4004,14 @@ async def test_run_query_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_run_query_async( - transport: str = "grpc_asyncio", request_type=firestore.RunQueryRequest -): +@pytest.mark.parametrize( + "request_type", + [ + firestore.RunQueryRequest(), + {}, + ], +) +async def test_run_query_async(request_type, transport: str = "grpc_asyncio"): client = FirestoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3989,7 +4019,7 @@ async def test_run_query_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.run_query), "__call__") as call: @@ -4011,11 +4041,6 @@ async def test_run_query_async( assert isinstance(message, firestore.RunQueryResponse) -@pytest.mark.asyncio -async def test_run_query_async_from_dict(): - await test_run_query_async(request_type=dict) - - def test_run_query_field_headers(): client = FirestoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4081,8 +4106,8 @@ async def test_run_query_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - firestore.ExecutePipelineRequest, - dict, + firestore.ExecutePipelineRequest(), + {}, ], ) def test_execute_pipeline(request_type, transport: str = "grpc"): @@ -4093,7 +4118,7 @@ def test_execute_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(type(client.transport.execute_pipeline), "__call__") as call: @@ -4135,9 +4160,10 @@ def test_execute_pipeline_non_empty_request_with_auto_populated_field(): client.execute_pipeline(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == firestore.ExecutePipelineRequest( + request_msg = firestore.ExecutePipelineRequest( database="database_value", ) + assert args[0] == request_msg def test_execute_pipeline_use_cached_wrapped_rpc(): @@ -4220,9 +4246,14 @@ async def test_execute_pipeline_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_execute_pipeline_async( - transport: str = "grpc_asyncio", request_type=firestore.ExecutePipelineRequest -): +@pytest.mark.parametrize( + "request_type", + [ + firestore.ExecutePipelineRequest(), + {}, + ], +) +async def test_execute_pipeline_async(request_type, transport: str = "grpc_asyncio"): client = FirestoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4230,7 +4261,7 @@ async def test_execute_pipeline_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.execute_pipeline), "__call__") as call: @@ -4252,16 +4283,11 @@ async def test_execute_pipeline_async( assert isinstance(message, firestore.ExecutePipelineResponse) -@pytest.mark.asyncio -async def test_execute_pipeline_async_from_dict(): - await test_execute_pipeline_async(request_type=dict) - - @pytest.mark.parametrize( "request_type", [ - firestore.RunAggregationQueryRequest, - dict, + firestore.RunAggregationQueryRequest(), + {}, ], ) def test_run_aggregation_query(request_type, transport: str = "grpc"): @@ -4272,7 +4298,7 @@ def test_run_aggregation_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( @@ -4318,9 +4344,10 @@ def test_run_aggregation_query_non_empty_request_with_auto_populated_field(): client.run_aggregation_query(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == firestore.RunAggregationQueryRequest( + request_msg = firestore.RunAggregationQueryRequest( parent="parent_value", ) + assert args[0] == request_msg def test_run_aggregation_query_use_cached_wrapped_rpc(): @@ -4406,8 +4433,15 @@ async def test_run_aggregation_query_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + firestore.RunAggregationQueryRequest(), + {}, + ], +) async def test_run_aggregation_query_async( - transport: str = "grpc_asyncio", request_type=firestore.RunAggregationQueryRequest + request_type, transport: str = "grpc_asyncio" ): client = FirestoreAsyncClient( credentials=async_anonymous_credentials(), @@ -4416,7 +4450,7 @@ async def test_run_aggregation_query_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( @@ -4440,11 +4474,6 @@ async def test_run_aggregation_query_async( assert isinstance(message, firestore.RunAggregationQueryResponse) -@pytest.mark.asyncio -async def test_run_aggregation_query_async_from_dict(): - await test_run_aggregation_query_async(request_type=dict) - - def test_run_aggregation_query_field_headers(): client = FirestoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4514,8 +4543,8 @@ async def test_run_aggregation_query_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - firestore.PartitionQueryRequest, - dict, + firestore.PartitionQueryRequest(), + {}, ], ) def test_partition_query(request_type, transport: str = "grpc"): @@ -4526,7 +4555,7 @@ def test_partition_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(type(client.transport.partition_query), "__call__") as call: @@ -4571,10 +4600,11 @@ def test_partition_query_non_empty_request_with_auto_populated_field(): client.partition_query(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == firestore.PartitionQueryRequest( + request_msg = firestore.PartitionQueryRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_partition_query_use_cached_wrapped_rpc(): @@ -4655,9 +4685,14 @@ async def test_partition_query_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_partition_query_async( - transport: str = "grpc_asyncio", request_type=firestore.PartitionQueryRequest -): +@pytest.mark.parametrize( + "request_type", + [ + firestore.PartitionQueryRequest(), + {}, + ], +) +async def test_partition_query_async(request_type, transport: str = "grpc_asyncio"): client = FirestoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4665,7 +4700,7 @@ async def test_partition_query_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.partition_query), "__call__") as call: @@ -4688,11 +4723,6 @@ async def test_partition_query_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_partition_query_async_from_dict(): - await test_partition_query_async(request_type=dict) - - def test_partition_query_field_headers(): client = FirestoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4947,8 +4977,8 @@ async def test_partition_query_async_pages(): @pytest.mark.parametrize( "request_type", [ - firestore.WriteRequest, - dict, + firestore.WriteRequest(), + {}, ], ) def test_write(request_type, transport: str = "grpc"): @@ -4959,7 +4989,7 @@ def test_write(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as 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. @@ -5054,9 +5084,14 @@ async def test_write_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio @pytest.mark.asyncio -async def test_write_async( - transport: str = "grpc_asyncio", request_type=firestore.WriteRequest -): +@pytest.mark.parametrize( + "request_type", + [ + firestore.WriteRequest(), + {}, + ], +) +async def test_write_async(request_type, transport: str = "grpc_asyncio"): client = FirestoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5064,7 +5099,7 @@ async def test_write_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. @@ -5084,16 +5119,11 @@ async def test_write_async( assert isinstance(message, firestore.WriteResponse) -@pytest.mark.asyncio -async def test_write_async_from_dict(): - await test_write_async(request_type=dict) - - @pytest.mark.parametrize( "request_type", [ - firestore.ListenRequest, - dict, + firestore.ListenRequest(), + {}, ], ) def test_listen(request_type, transport: str = "grpc"): @@ -5104,7 +5134,7 @@ def test_listen(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as 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. @@ -5199,9 +5229,14 @@ async def test_listen_async_use_cached_wrapped_rpc(transport: str = "grpc_asynci @pytest.mark.asyncio -async def test_listen_async( - transport: str = "grpc_asyncio", request_type=firestore.ListenRequest -): +@pytest.mark.parametrize( + "request_type", + [ + firestore.ListenRequest(), + {}, + ], +) +async def test_listen_async(request_type, transport: str = "grpc_asyncio"): client = FirestoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5209,7 +5244,7 @@ async def test_listen_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. @@ -5231,16 +5266,11 @@ async def test_listen_async( assert isinstance(message, firestore.ListenResponse) -@pytest.mark.asyncio -async def test_listen_async_from_dict(): - await test_listen_async(request_type=dict) - - @pytest.mark.parametrize( "request_type", [ - firestore.ListCollectionIdsRequest, - dict, + firestore.ListCollectionIdsRequest(), + {}, ], ) def test_list_collection_ids(request_type, transport: str = "grpc"): @@ -5251,7 +5281,7 @@ def test_list_collection_ids(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5302,10 +5332,11 @@ def test_list_collection_ids_non_empty_request_with_auto_populated_field(): client.list_collection_ids(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == firestore.ListCollectionIdsRequest( + request_msg = firestore.ListCollectionIdsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_collection_ids_use_cached_wrapped_rpc(): @@ -5390,9 +5421,14 @@ async def test_list_collection_ids_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_collection_ids_async( - transport: str = "grpc_asyncio", request_type=firestore.ListCollectionIdsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + firestore.ListCollectionIdsRequest(), + {}, + ], +) +async def test_list_collection_ids_async(request_type, transport: str = "grpc_asyncio"): client = FirestoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5400,7 +5436,7 @@ async def test_list_collection_ids_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( @@ -5427,11 +5463,6 @@ async def test_list_collection_ids_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_collection_ids_async_from_dict(): - await test_list_collection_ids_async(request_type=dict) - - def test_list_collection_ids_field_headers(): client = FirestoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5784,8 +5815,8 @@ async def test_list_collection_ids_async_pages(): @pytest.mark.parametrize( "request_type", [ - firestore.BatchWriteRequest, - dict, + firestore.BatchWriteRequest(), + {}, ], ) def test_batch_write(request_type, transport: str = "grpc"): @@ -5796,7 +5827,7 @@ def test_batch_write(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.batch_write), "__call__") as call: @@ -5837,9 +5868,10 @@ def test_batch_write_non_empty_request_with_auto_populated_field(): client.batch_write(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == firestore.BatchWriteRequest( + request_msg = firestore.BatchWriteRequest( database="database_value", ) + assert args[0] == request_msg def test_batch_write_use_cached_wrapped_rpc(): @@ -5920,9 +5952,14 @@ async def test_batch_write_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_batch_write_async( - transport: str = "grpc_asyncio", request_type=firestore.BatchWriteRequest -): +@pytest.mark.parametrize( + "request_type", + [ + firestore.BatchWriteRequest(), + {}, + ], +) +async def test_batch_write_async(request_type, transport: str = "grpc_asyncio"): client = FirestoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5930,7 +5967,7 @@ async def test_batch_write_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.batch_write), "__call__") as call: @@ -5950,11 +5987,6 @@ async def test_batch_write_async( assert isinstance(response, firestore.BatchWriteResponse) -@pytest.mark.asyncio -async def test_batch_write_async_from_dict(): - await test_batch_write_async(request_type=dict) - - def test_batch_write_field_headers(): client = FirestoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6019,8 +6051,8 @@ async def test_batch_write_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - firestore.CreateDocumentRequest, - dict, + firestore.CreateDocumentRequest(), + {}, ], ) def test_create_document(request_type, transport: str = "grpc"): @@ -6031,7 +6063,7 @@ def test_create_document(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_document), "__call__") as call: @@ -6077,11 +6109,12 @@ def test_create_document_non_empty_request_with_auto_populated_field(): client.create_document(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == firestore.CreateDocumentRequest( + request_msg = firestore.CreateDocumentRequest( parent="parent_value", collection_id="collection_id_value", document_id="document_id_value", ) + assert args[0] == request_msg def test_create_document_use_cached_wrapped_rpc(): @@ -6162,9 +6195,14 @@ async def test_create_document_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_document_async( - transport: str = "grpc_asyncio", request_type=firestore.CreateDocumentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + firestore.CreateDocumentRequest(), + {}, + ], +) +async def test_create_document_async(request_type, transport: str = "grpc_asyncio"): client = FirestoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6172,7 +6210,7 @@ async def test_create_document_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_document), "__call__") as call: @@ -6195,11 +6233,6 @@ async def test_create_document_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_create_document_async_from_dict(): - await test_create_document_async(request_type=dict) - - def test_create_document_field_headers(): client = FirestoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8868,7 +8901,6 @@ def test_get_document_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore.GetDocumentRequest() - assert args[0] == request_msg @@ -8889,7 +8921,6 @@ def test_list_documents_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore.ListDocumentsRequest() - assert args[0] == request_msg @@ -8910,7 +8941,6 @@ def test_update_document_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore.UpdateDocumentRequest() - assert args[0] == request_msg @@ -8931,7 +8961,6 @@ def test_delete_document_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore.DeleteDocumentRequest() - assert args[0] == request_msg @@ -8954,7 +8983,6 @@ def test_batch_get_documents_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore.BatchGetDocumentsRequest() - assert args[0] == request_msg @@ -8977,7 +9005,6 @@ def test_begin_transaction_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore.BeginTransactionRequest() - assert args[0] == request_msg @@ -8998,7 +9025,6 @@ def test_commit_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore.CommitRequest() - assert args[0] == request_msg @@ -9019,7 +9045,6 @@ def test_rollback_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore.RollbackRequest() - assert args[0] == request_msg @@ -9040,7 +9065,6 @@ def test_run_query_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore.RunQueryRequest() - assert args[0] == request_msg @@ -9061,7 +9085,6 @@ def test_execute_pipeline_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore.ExecutePipelineRequest() - assert args[0] == request_msg @@ -9084,7 +9107,6 @@ def test_run_aggregation_query_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore.RunAggregationQueryRequest() - assert args[0] == request_msg @@ -9105,7 +9127,6 @@ def test_partition_query_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore.PartitionQueryRequest() - assert args[0] == request_msg @@ -9128,7 +9149,6 @@ def test_list_collection_ids_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore.ListCollectionIdsRequest() - assert args[0] == request_msg @@ -9149,7 +9169,6 @@ def test_batch_write_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore.BatchWriteRequest() - assert args[0] == request_msg @@ -9170,7 +9189,6 @@ def test_create_document_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore.CreateDocumentRequest() - assert args[0] == request_msg @@ -9191,7 +9209,6 @@ def test_execute_pipeline_routing_parameters_request_1_grpc(): request_msg = firestore.ExecutePipelineRequest( **{"database": "projects/sample1/sample2"} ) - assert args[0] == request_msg expected_headers = {"project_id": "sample1"} @@ -9219,7 +9236,6 @@ def test_execute_pipeline_routing_parameters_request_2_grpc(): request_msg = firestore.ExecutePipelineRequest( **{"database": "projects/sample1/databases/sample2/sample3"} ) - assert args[0] == request_msg expected_headers = {"project_id": "sample1", "database_id": "sample2"} @@ -9265,7 +9281,6 @@ async def test_get_document_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore.GetDocumentRequest() - assert args[0] == request_msg @@ -9292,7 +9307,6 @@ async def test_list_documents_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore.ListDocumentsRequest() - assert args[0] == request_msg @@ -9319,7 +9333,6 @@ async def test_update_document_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore.UpdateDocumentRequest() - assert args[0] == request_msg @@ -9342,7 +9355,6 @@ async def test_delete_document_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore.DeleteDocumentRequest() - assert args[0] == request_msg @@ -9370,7 +9382,6 @@ async def test_batch_get_documents_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore.BatchGetDocumentsRequest() - assert args[0] == request_msg @@ -9399,7 +9410,6 @@ async def test_begin_transaction_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore.BeginTransactionRequest() - assert args[0] == request_msg @@ -9424,7 +9434,6 @@ async def test_commit_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore.CommitRequest() - assert args[0] == request_msg @@ -9447,7 +9456,6 @@ async def test_rollback_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore.RollbackRequest() - assert args[0] == request_msg @@ -9473,7 +9481,6 @@ async def test_run_query_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore.RunQueryRequest() - assert args[0] == request_msg @@ -9499,7 +9506,6 @@ async def test_execute_pipeline_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore.ExecutePipelineRequest() - assert args[0] == request_msg @@ -9527,7 +9533,6 @@ async def test_run_aggregation_query_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore.RunAggregationQueryRequest() - assert args[0] == request_msg @@ -9554,7 +9559,6 @@ async def test_partition_query_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore.PartitionQueryRequest() - assert args[0] == request_msg @@ -9584,7 +9588,6 @@ async def test_list_collection_ids_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore.ListCollectionIdsRequest() - assert args[0] == request_msg @@ -9609,7 +9612,6 @@ async def test_batch_write_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore.BatchWriteRequest() - assert args[0] == request_msg @@ -9636,7 +9638,6 @@ async def test_create_document_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore.CreateDocumentRequest() - assert args[0] == request_msg @@ -9662,7 +9663,6 @@ async def test_execute_pipeline_routing_parameters_request_1_grpc_asyncio(): request_msg = firestore.ExecutePipelineRequest( **{"database": "projects/sample1/sample2"} ) - assert args[0] == request_msg expected_headers = {"project_id": "sample1"} @@ -9695,7 +9695,6 @@ async def test_execute_pipeline_routing_parameters_request_2_grpc_asyncio(): request_msg = firestore.ExecutePipelineRequest( **{"database": "projects/sample1/databases/sample2/sample3"} ) - assert args[0] == request_msg expected_headers = {"project_id": "sample1", "database_id": "sample2"} @@ -12068,7 +12067,6 @@ def test_get_document_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore.GetDocumentRequest() - assert args[0] == request_msg @@ -12088,7 +12086,6 @@ def test_list_documents_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore.ListDocumentsRequest() - assert args[0] == request_msg @@ -12108,7 +12105,6 @@ def test_update_document_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore.UpdateDocumentRequest() - assert args[0] == request_msg @@ -12128,7 +12124,6 @@ def test_delete_document_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore.DeleteDocumentRequest() - assert args[0] == request_msg @@ -12150,7 +12145,6 @@ def test_batch_get_documents_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore.BatchGetDocumentsRequest() - assert args[0] == request_msg @@ -12172,7 +12166,6 @@ def test_begin_transaction_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore.BeginTransactionRequest() - assert args[0] == request_msg @@ -12192,7 +12185,6 @@ def test_commit_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore.CommitRequest() - assert args[0] == request_msg @@ -12212,7 +12204,6 @@ def test_rollback_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore.RollbackRequest() - assert args[0] == request_msg @@ -12232,7 +12223,6 @@ def test_run_query_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore.RunQueryRequest() - assert args[0] == request_msg @@ -12252,7 +12242,6 @@ def test_execute_pipeline_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore.ExecutePipelineRequest() - assert args[0] == request_msg @@ -12274,7 +12263,6 @@ def test_run_aggregation_query_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore.RunAggregationQueryRequest() - assert args[0] == request_msg @@ -12294,7 +12282,6 @@ def test_partition_query_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore.PartitionQueryRequest() - assert args[0] == request_msg @@ -12316,7 +12303,6 @@ def test_list_collection_ids_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore.ListCollectionIdsRequest() - assert args[0] == request_msg @@ -12336,7 +12322,6 @@ def test_batch_write_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore.BatchWriteRequest() - assert args[0] == request_msg @@ -12356,7 +12341,6 @@ def test_create_document_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firestore.CreateDocumentRequest() - assert args[0] == request_msg @@ -12376,7 +12360,6 @@ def test_execute_pipeline_routing_parameters_request_1_rest(): request_msg = firestore.ExecutePipelineRequest( **{"database": "projects/sample1/sample2"} ) - assert args[0] == request_msg expected_headers = {"project_id": "sample1"} @@ -12403,7 +12386,6 @@ def test_execute_pipeline_routing_parameters_request_2_rest(): request_msg = firestore.ExecutePipelineRequest( **{"database": "projects/sample1/databases/sample2/sample3"} ) - assert args[0] == request_msg expected_headers = {"project_id": "sample1", "database_id": "sample2"} diff --git a/packages/google-cloud-functions/noxfile.py b/packages/google-cloud-functions/noxfile.py index 26c364900523..c46cf4fc5cad 100644 --- a/packages/google-cloud-functions/noxfile.py +++ b/packages/google-cloud-functions/noxfile.py @@ -47,7 +47,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-functions" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-functions/setup.py b/packages/google-cloud-functions/setup.py index d15102497f91..10c335da2fca 100644 --- a/packages/google-cloud-functions/setup.py +++ b/packages/google-cloud-functions/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/google-cloud-functions/testing/constraints-3.10.txt b/packages/google-cloud-functions/testing/constraints-3.10.txt index a92801e1c8e2..b39cd54634f9 100644 --- a/packages/google-cloud-functions/testing/constraints-3.10.txt +++ b/packages/google-cloud-functions/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/google-cloud-functions/tests/unit/gapic/functions_v1/test_cloud_functions_service.py b/packages/google-cloud-functions/tests/unit/gapic/functions_v1/test_cloud_functions_service.py index 90151138fb39..6c2f40a704ef 100644 --- a/packages/google-cloud-functions/tests/unit/gapic/functions_v1/test_cloud_functions_service.py +++ b/packages/google-cloud-functions/tests/unit/gapic/functions_v1/test_cloud_functions_service.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 @@ -126,6 +127,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" @@ -1391,8 +1407,8 @@ def test_cloud_functions_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - functions.ListFunctionsRequest, - dict, + functions.ListFunctionsRequest(), + {}, ], ) def test_list_functions(request_type, transport: str = "grpc"): @@ -1403,7 +1419,7 @@ def test_list_functions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_functions), "__call__") as call: @@ -1450,10 +1466,11 @@ def test_list_functions_non_empty_request_with_auto_populated_field(): client.list_functions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == functions.ListFunctionsRequest( + request_msg = functions.ListFunctionsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_functions_use_cached_wrapped_rpc(): @@ -1534,9 +1551,14 @@ async def test_list_functions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_functions_async( - transport: str = "grpc_asyncio", request_type=functions.ListFunctionsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + functions.ListFunctionsRequest(), + {}, + ], +) +async def test_list_functions_async(request_type, transport: str = "grpc_asyncio"): client = CloudFunctionsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1544,7 +1566,7 @@ async def test_list_functions_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_functions), "__call__") as call: @@ -1569,11 +1591,6 @@ async def test_list_functions_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_functions_async_from_dict(): - await test_list_functions_async(request_type=dict) - - def test_list_functions_field_headers(): client = CloudFunctionsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1828,8 +1845,8 @@ async def test_list_functions_async_pages(): @pytest.mark.parametrize( "request_type", [ - functions.GetFunctionRequest, - dict, + functions.GetFunctionRequest(), + {}, ], ) def test_get_function(request_type, transport: str = "grpc"): @@ -1840,7 +1857,7 @@ def test_get_function(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_function), "__call__") as call: @@ -1935,9 +1952,10 @@ def test_get_function_non_empty_request_with_auto_populated_field(): client.get_function(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == functions.GetFunctionRequest( + request_msg = functions.GetFunctionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_function_use_cached_wrapped_rpc(): @@ -2018,9 +2036,14 @@ async def test_get_function_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_function_async( - transport: str = "grpc_asyncio", request_type=functions.GetFunctionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + functions.GetFunctionRequest(), + {}, + ], +) +async def test_get_function_async(request_type, transport: str = "grpc_asyncio"): client = CloudFunctionsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2028,7 +2051,7 @@ async def test_get_function_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_function), "__call__") as call: @@ -2101,11 +2124,6 @@ async def test_get_function_async( assert response.build_service_account == "build_service_account_value" -@pytest.mark.asyncio -async def test_get_function_async_from_dict(): - await test_get_function_async(request_type=dict) - - def test_get_function_field_headers(): client = CloudFunctionsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2252,8 +2270,8 @@ async def test_get_function_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - functions.CreateFunctionRequest, - dict, + functions.CreateFunctionRequest(), + {}, ], ) def test_create_function(request_type, transport: str = "grpc"): @@ -2264,7 +2282,7 @@ def test_create_function(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_function), "__call__") as call: @@ -2305,9 +2323,10 @@ def test_create_function_non_empty_request_with_auto_populated_field(): client.create_function(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == functions.CreateFunctionRequest( + request_msg = functions.CreateFunctionRequest( location="location_value", ) + assert args[0] == request_msg def test_create_function_use_cached_wrapped_rpc(): @@ -2398,9 +2417,14 @@ async def test_create_function_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_function_async( - transport: str = "grpc_asyncio", request_type=functions.CreateFunctionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + functions.CreateFunctionRequest(), + {}, + ], +) +async def test_create_function_async(request_type, transport: str = "grpc_asyncio"): client = CloudFunctionsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2408,7 +2432,7 @@ async def test_create_function_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_function), "__call__") as call: @@ -2428,11 +2452,6 @@ async def test_create_function_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_function_async_from_dict(): - await test_create_function_async(request_type=dict) - - def test_create_function_field_headers(): client = CloudFunctionsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2589,8 +2608,8 @@ async def test_create_function_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - functions.UpdateFunctionRequest, - dict, + functions.UpdateFunctionRequest(), + {}, ], ) def test_update_function(request_type, transport: str = "grpc"): @@ -2601,7 +2620,7 @@ def test_update_function(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_function), "__call__") as call: @@ -2640,7 +2659,8 @@ def test_update_function_non_empty_request_with_auto_populated_field(): client.update_function(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == functions.UpdateFunctionRequest() + request_msg = functions.UpdateFunctionRequest() + assert args[0] == request_msg def test_update_function_use_cached_wrapped_rpc(): @@ -2731,9 +2751,14 @@ async def test_update_function_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_function_async( - transport: str = "grpc_asyncio", request_type=functions.UpdateFunctionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + functions.UpdateFunctionRequest(), + {}, + ], +) +async def test_update_function_async(request_type, transport: str = "grpc_asyncio"): client = CloudFunctionsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2741,7 +2766,7 @@ async def test_update_function_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_function), "__call__") as call: @@ -2761,11 +2786,6 @@ async def test_update_function_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_function_async_from_dict(): - await test_update_function_async(request_type=dict) - - def test_update_function_field_headers(): client = CloudFunctionsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2912,8 +2932,8 @@ async def test_update_function_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - functions.DeleteFunctionRequest, - dict, + functions.DeleteFunctionRequest(), + {}, ], ) def test_delete_function(request_type, transport: str = "grpc"): @@ -2924,7 +2944,7 @@ def test_delete_function(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_function), "__call__") as call: @@ -2965,9 +2985,10 @@ def test_delete_function_non_empty_request_with_auto_populated_field(): client.delete_function(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == functions.DeleteFunctionRequest( + request_msg = functions.DeleteFunctionRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_function_use_cached_wrapped_rpc(): @@ -3058,9 +3079,14 @@ async def test_delete_function_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_function_async( - transport: str = "grpc_asyncio", request_type=functions.DeleteFunctionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + functions.DeleteFunctionRequest(), + {}, + ], +) +async def test_delete_function_async(request_type, transport: str = "grpc_asyncio"): client = CloudFunctionsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3068,7 +3094,7 @@ async def test_delete_function_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_function), "__call__") as call: @@ -3088,11 +3114,6 @@ async def test_delete_function_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_function_async_from_dict(): - await test_delete_function_async(request_type=dict) - - def test_delete_function_field_headers(): client = CloudFunctionsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3239,8 +3260,8 @@ async def test_delete_function_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - functions.CallFunctionRequest, - dict, + functions.CallFunctionRequest(), + {}, ], ) def test_call_function(request_type, transport: str = "grpc"): @@ -3251,7 +3272,7 @@ def test_call_function(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.call_function), "__call__") as call: @@ -3300,10 +3321,11 @@ def test_call_function_non_empty_request_with_auto_populated_field(): client.call_function(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == functions.CallFunctionRequest( + request_msg = functions.CallFunctionRequest( name="name_value", data="data_value", ) + assert args[0] == request_msg def test_call_function_use_cached_wrapped_rpc(): @@ -3384,9 +3406,14 @@ async def test_call_function_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_call_function_async( - transport: str = "grpc_asyncio", request_type=functions.CallFunctionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + functions.CallFunctionRequest(), + {}, + ], +) +async def test_call_function_async(request_type, transport: str = "grpc_asyncio"): client = CloudFunctionsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3394,7 +3421,7 @@ async def test_call_function_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.call_function), "__call__") as call: @@ -3421,11 +3448,6 @@ async def test_call_function_async( assert response.error == "error_value" -@pytest.mark.asyncio -async def test_call_function_async_from_dict(): - await test_call_function_async(request_type=dict) - - def test_call_function_field_headers(): client = CloudFunctionsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3582,8 +3604,8 @@ async def test_call_function_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - functions.GenerateUploadUrlRequest, - dict, + functions.GenerateUploadUrlRequest(), + {}, ], ) def test_generate_upload_url(request_type, transport: str = "grpc"): @@ -3594,7 +3616,7 @@ def test_generate_upload_url(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3643,10 +3665,11 @@ def test_generate_upload_url_non_empty_request_with_auto_populated_field(): client.generate_upload_url(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == functions.GenerateUploadUrlRequest( + request_msg = functions.GenerateUploadUrlRequest( parent="parent_value", kms_key_name="kms_key_name_value", ) + assert args[0] == request_msg def test_generate_upload_url_use_cached_wrapped_rpc(): @@ -3731,9 +3754,14 @@ async def test_generate_upload_url_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_generate_upload_url_async( - transport: str = "grpc_asyncio", request_type=functions.GenerateUploadUrlRequest -): +@pytest.mark.parametrize( + "request_type", + [ + functions.GenerateUploadUrlRequest(), + {}, + ], +) +async def test_generate_upload_url_async(request_type, transport: str = "grpc_asyncio"): client = CloudFunctionsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3741,7 +3769,7 @@ async def test_generate_upload_url_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( @@ -3766,11 +3794,6 @@ async def test_generate_upload_url_async( assert response.upload_url == "upload_url_value" -@pytest.mark.asyncio -async def test_generate_upload_url_async_from_dict(): - await test_generate_upload_url_async(request_type=dict) - - def test_generate_upload_url_field_headers(): client = CloudFunctionsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3839,8 +3862,8 @@ async def test_generate_upload_url_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - functions.GenerateDownloadUrlRequest, - dict, + functions.GenerateDownloadUrlRequest(), + {}, ], ) def test_generate_download_url(request_type, transport: str = "grpc"): @@ -3851,7 +3874,7 @@ def test_generate_download_url(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3899,9 +3922,10 @@ def test_generate_download_url_non_empty_request_with_auto_populated_field(): client.generate_download_url(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == functions.GenerateDownloadUrlRequest( + request_msg = functions.GenerateDownloadUrlRequest( name="name_value", ) + assert args[0] == request_msg def test_generate_download_url_use_cached_wrapped_rpc(): @@ -3987,8 +4011,15 @@ async def test_generate_download_url_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + functions.GenerateDownloadUrlRequest(), + {}, + ], +) async def test_generate_download_url_async( - transport: str = "grpc_asyncio", request_type=functions.GenerateDownloadUrlRequest + request_type, transport: str = "grpc_asyncio" ): client = CloudFunctionsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3997,7 +4028,7 @@ async def test_generate_download_url_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( @@ -4022,11 +4053,6 @@ async def test_generate_download_url_async( assert response.download_url == "download_url_value" -@pytest.mark.asyncio -async def test_generate_download_url_async_from_dict(): - await test_generate_download_url_async(request_type=dict) - - def test_generate_download_url_field_headers(): client = CloudFunctionsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4095,8 +4121,8 @@ async def test_generate_download_url_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.SetIamPolicyRequest, - dict, + iam_policy_pb2.SetIamPolicyRequest(), + {}, ], ) def test_set_iam_policy(request_type, transport: str = "grpc"): @@ -4107,7 +4133,7 @@ def test_set_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(type(client.transport.set_iam_policy), "__call__") as call: @@ -4153,9 +4179,10 @@ def test_set_iam_policy_non_empty_request_with_auto_populated_field(): client.set_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.SetIamPolicyRequest( + request_msg = iam_policy_pb2.SetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_set_iam_policy_use_cached_wrapped_rpc(): @@ -4236,9 +4263,14 @@ async def test_set_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.SetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.SetIamPolicyRequest(), + {}, + ], +) +async def test_set_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = CloudFunctionsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4246,7 +4278,7 @@ async def test_set_iam_policy_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.set_iam_policy), "__call__") as call: @@ -4271,11 +4303,6 @@ async def test_set_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_set_iam_policy_async_from_dict(): - await test_set_iam_policy_async(request_type=dict) - - def test_set_iam_policy_field_headers(): client = CloudFunctionsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4356,8 +4383,8 @@ def test_set_iam_policy_from_dict_foreign(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.GetIamPolicyRequest, - dict, + iam_policy_pb2.GetIamPolicyRequest(), + {}, ], ) def test_get_iam_policy(request_type, transport: str = "grpc"): @@ -4368,7 +4395,7 @@ def test_get_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(type(client.transport.get_iam_policy), "__call__") as call: @@ -4414,9 +4441,10 @@ def test_get_iam_policy_non_empty_request_with_auto_populated_field(): client.get_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.GetIamPolicyRequest( + request_msg = iam_policy_pb2.GetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_get_iam_policy_use_cached_wrapped_rpc(): @@ -4497,9 +4525,14 @@ async def test_get_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.GetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.GetIamPolicyRequest(), + {}, + ], +) +async def test_get_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = CloudFunctionsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4507,7 +4540,7 @@ async def test_get_iam_policy_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_iam_policy), "__call__") as call: @@ -4532,11 +4565,6 @@ async def test_get_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_get_iam_policy_async_from_dict(): - await test_get_iam_policy_async(request_type=dict) - - def test_get_iam_policy_field_headers(): client = CloudFunctionsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4616,8 +4644,8 @@ def test_get_iam_policy_from_dict_foreign(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.TestIamPermissionsRequest, - dict, + iam_policy_pb2.TestIamPermissionsRequest(), + {}, ], ) def test_test_iam_permissions(request_type, transport: str = "grpc"): @@ -4628,7 +4656,7 @@ def test_test_iam_permissions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4676,9 +4704,10 @@ def test_test_iam_permissions_non_empty_request_with_auto_populated_field(): client.test_iam_permissions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.TestIamPermissionsRequest( + request_msg = iam_policy_pb2.TestIamPermissionsRequest( resource="resource_value", ) + assert args[0] == request_msg def test_test_iam_permissions_use_cached_wrapped_rpc(): @@ -4763,9 +4792,15 @@ async def test_test_iam_permissions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.TestIamPermissionsRequest(), + {}, + ], +) async def test_test_iam_permissions_async( - transport: str = "grpc_asyncio", - request_type=iam_policy_pb2.TestIamPermissionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = CloudFunctionsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4774,7 +4809,7 @@ async def test_test_iam_permissions_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( @@ -4799,11 +4834,6 @@ async def test_test_iam_permissions_async( assert response.permissions == ["permissions_value"] -@pytest.mark.asyncio -async def test_test_iam_permissions_async_from_dict(): - await test_test_iam_permissions_async(request_type=dict) - - def test_test_iam_permissions_field_headers(): client = CloudFunctionsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6486,7 +6516,6 @@ def test_list_functions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = functions.ListFunctionsRequest() - assert args[0] == request_msg @@ -6507,7 +6536,6 @@ def test_get_function_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = functions.GetFunctionRequest() - assert args[0] == request_msg @@ -6528,7 +6556,6 @@ def test_create_function_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = functions.CreateFunctionRequest() - assert args[0] == request_msg @@ -6549,7 +6576,6 @@ def test_update_function_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = functions.UpdateFunctionRequest() - assert args[0] == request_msg @@ -6570,7 +6596,6 @@ def test_delete_function_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = functions.DeleteFunctionRequest() - assert args[0] == request_msg @@ -6591,7 +6616,6 @@ def test_call_function_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = functions.CallFunctionRequest() - assert args[0] == request_msg @@ -6614,7 +6638,6 @@ def test_generate_upload_url_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = functions.GenerateUploadUrlRequest() - assert args[0] == request_msg @@ -6637,7 +6660,6 @@ def test_generate_download_url_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = functions.GenerateDownloadUrlRequest() - assert args[0] == request_msg @@ -6658,7 +6680,6 @@ def test_set_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -6679,7 +6700,6 @@ def test_get_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -6702,7 +6722,6 @@ def test_test_iam_permissions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -6744,7 +6763,6 @@ async def test_list_functions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = functions.ListFunctionsRequest() - assert args[0] == request_msg @@ -6792,7 +6810,6 @@ async def test_get_function_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = functions.GetFunctionRequest() - assert args[0] == request_msg @@ -6817,7 +6834,6 @@ async def test_create_function_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = functions.CreateFunctionRequest() - assert args[0] == request_msg @@ -6842,7 +6858,6 @@ async def test_update_function_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = functions.UpdateFunctionRequest() - assert args[0] == request_msg @@ -6867,7 +6882,6 @@ async def test_delete_function_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = functions.DeleteFunctionRequest() - assert args[0] == request_msg @@ -6896,7 +6910,6 @@ async def test_call_function_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = functions.CallFunctionRequest() - assert args[0] == request_msg @@ -6925,7 +6938,6 @@ async def test_generate_upload_url_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = functions.GenerateUploadUrlRequest() - assert args[0] == request_msg @@ -6954,7 +6966,6 @@ async def test_generate_download_url_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = functions.GenerateDownloadUrlRequest() - assert args[0] == request_msg @@ -6982,7 +6993,6 @@ async def test_set_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -7010,7 +7020,6 @@ async def test_get_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -7039,7 +7048,6 @@ async def test_test_iam_permissions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -8982,7 +8990,6 @@ def test_list_functions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = functions.ListFunctionsRequest() - assert args[0] == request_msg @@ -9002,7 +9009,6 @@ def test_get_function_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = functions.GetFunctionRequest() - assert args[0] == request_msg @@ -9022,7 +9028,6 @@ def test_create_function_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = functions.CreateFunctionRequest() - assert args[0] == request_msg @@ -9042,7 +9047,6 @@ def test_update_function_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = functions.UpdateFunctionRequest() - assert args[0] == request_msg @@ -9062,7 +9066,6 @@ def test_delete_function_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = functions.DeleteFunctionRequest() - assert args[0] == request_msg @@ -9082,7 +9085,6 @@ def test_call_function_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = functions.CallFunctionRequest() - assert args[0] == request_msg @@ -9104,7 +9106,6 @@ def test_generate_upload_url_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = functions.GenerateUploadUrlRequest() - assert args[0] == request_msg @@ -9126,7 +9127,6 @@ def test_generate_download_url_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = functions.GenerateDownloadUrlRequest() - assert args[0] == request_msg @@ -9146,7 +9146,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -9166,7 +9165,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -9188,7 +9186,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-functions/tests/unit/gapic/functions_v2/test_function_service.py b/packages/google-cloud-functions/tests/unit/gapic/functions_v2/test_function_service.py index 27824593ce39..bdd051385f01 100644 --- a/packages/google-cloud-functions/tests/unit/gapic/functions_v2/test_function_service.py +++ b/packages/google-cloud-functions/tests/unit/gapic/functions_v2/test_function_service.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 @@ -121,6 +122,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" @@ -1348,8 +1364,8 @@ def test_function_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - functions.GetFunctionRequest, - dict, + functions.GetFunctionRequest(), + {}, ], ) def test_get_function(request_type, transport: str = "grpc"): @@ -1360,7 +1376,7 @@ def test_get_function(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_function), "__call__") as call: @@ -1417,10 +1433,11 @@ def test_get_function_non_empty_request_with_auto_populated_field(): client.get_function(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == functions.GetFunctionRequest( + request_msg = functions.GetFunctionRequest( name="name_value", revision="revision_value", ) + assert args[0] == request_msg def test_get_function_use_cached_wrapped_rpc(): @@ -1501,9 +1518,14 @@ async def test_get_function_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_function_async( - transport: str = "grpc_asyncio", request_type=functions.GetFunctionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + functions.GetFunctionRequest(), + {}, + ], +) +async def test_get_function_async(request_type, transport: str = "grpc_asyncio"): client = FunctionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1511,7 +1533,7 @@ async def test_get_function_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_function), "__call__") as call: @@ -1546,11 +1568,6 @@ async def test_get_function_async( assert response.satisfies_pzs is True -@pytest.mark.asyncio -async def test_get_function_async_from_dict(): - await test_get_function_async(request_type=dict) - - def test_get_function_field_headers(): client = FunctionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1693,8 +1710,8 @@ async def test_get_function_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - functions.ListFunctionsRequest, - dict, + functions.ListFunctionsRequest(), + {}, ], ) def test_list_functions(request_type, transport: str = "grpc"): @@ -1705,7 +1722,7 @@ def test_list_functions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_functions), "__call__") as call: @@ -1754,12 +1771,13 @@ def test_list_functions_non_empty_request_with_auto_populated_field(): client.list_functions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == functions.ListFunctionsRequest( + request_msg = functions.ListFunctionsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_functions_use_cached_wrapped_rpc(): @@ -1840,9 +1858,14 @@ async def test_list_functions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_functions_async( - transport: str = "grpc_asyncio", request_type=functions.ListFunctionsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + functions.ListFunctionsRequest(), + {}, + ], +) +async def test_list_functions_async(request_type, transport: str = "grpc_asyncio"): client = FunctionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1850,7 +1873,7 @@ async def test_list_functions_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_functions), "__call__") as call: @@ -1875,11 +1898,6 @@ async def test_list_functions_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_functions_async_from_dict(): - await test_list_functions_async(request_type=dict) - - def test_list_functions_field_headers(): client = FunctionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2216,8 +2234,8 @@ async def test_list_functions_async_pages(): @pytest.mark.parametrize( "request_type", [ - functions.CreateFunctionRequest, - dict, + functions.CreateFunctionRequest(), + {}, ], ) def test_create_function(request_type, transport: str = "grpc"): @@ -2228,7 +2246,7 @@ def test_create_function(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_function), "__call__") as call: @@ -2270,10 +2288,11 @@ def test_create_function_non_empty_request_with_auto_populated_field(): client.create_function(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == functions.CreateFunctionRequest( + request_msg = functions.CreateFunctionRequest( parent="parent_value", function_id="function_id_value", ) + assert args[0] == request_msg def test_create_function_use_cached_wrapped_rpc(): @@ -2364,9 +2383,14 @@ async def test_create_function_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_function_async( - transport: str = "grpc_asyncio", request_type=functions.CreateFunctionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + functions.CreateFunctionRequest(), + {}, + ], +) +async def test_create_function_async(request_type, transport: str = "grpc_asyncio"): client = FunctionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2374,7 +2398,7 @@ async def test_create_function_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_function), "__call__") as call: @@ -2394,11 +2418,6 @@ async def test_create_function_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_function_async_from_dict(): - await test_create_function_async(request_type=dict) - - def test_create_function_field_headers(): client = FunctionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2565,8 +2584,8 @@ async def test_create_function_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - functions.UpdateFunctionRequest, - dict, + functions.UpdateFunctionRequest(), + {}, ], ) def test_update_function(request_type, transport: str = "grpc"): @@ -2577,7 +2596,7 @@ def test_update_function(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_function), "__call__") as call: @@ -2616,7 +2635,8 @@ def test_update_function_non_empty_request_with_auto_populated_field(): client.update_function(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == functions.UpdateFunctionRequest() + request_msg = functions.UpdateFunctionRequest() + assert args[0] == request_msg def test_update_function_use_cached_wrapped_rpc(): @@ -2707,9 +2727,14 @@ async def test_update_function_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_function_async( - transport: str = "grpc_asyncio", request_type=functions.UpdateFunctionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + functions.UpdateFunctionRequest(), + {}, + ], +) +async def test_update_function_async(request_type, transport: str = "grpc_asyncio"): client = FunctionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2717,7 +2742,7 @@ async def test_update_function_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_function), "__call__") as call: @@ -2737,11 +2762,6 @@ async def test_update_function_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_function_async_from_dict(): - await test_update_function_async(request_type=dict) - - def test_update_function_field_headers(): client = FunctionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2898,8 +2918,8 @@ async def test_update_function_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - functions.DeleteFunctionRequest, - dict, + functions.DeleteFunctionRequest(), + {}, ], ) def test_delete_function(request_type, transport: str = "grpc"): @@ -2910,7 +2930,7 @@ def test_delete_function(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_function), "__call__") as call: @@ -2951,9 +2971,10 @@ def test_delete_function_non_empty_request_with_auto_populated_field(): client.delete_function(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == functions.DeleteFunctionRequest( + request_msg = functions.DeleteFunctionRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_function_use_cached_wrapped_rpc(): @@ -3044,9 +3065,14 @@ async def test_delete_function_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_function_async( - transport: str = "grpc_asyncio", request_type=functions.DeleteFunctionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + functions.DeleteFunctionRequest(), + {}, + ], +) +async def test_delete_function_async(request_type, transport: str = "grpc_asyncio"): client = FunctionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3054,7 +3080,7 @@ async def test_delete_function_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_function), "__call__") as call: @@ -3074,11 +3100,6 @@ async def test_delete_function_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_function_async_from_dict(): - await test_delete_function_async(request_type=dict) - - def test_delete_function_field_headers(): client = FunctionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3225,8 +3246,8 @@ async def test_delete_function_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - functions.GenerateUploadUrlRequest, - dict, + functions.GenerateUploadUrlRequest(), + {}, ], ) def test_generate_upload_url(request_type, transport: str = "grpc"): @@ -3237,7 +3258,7 @@ def test_generate_upload_url(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3286,10 +3307,11 @@ def test_generate_upload_url_non_empty_request_with_auto_populated_field(): client.generate_upload_url(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == functions.GenerateUploadUrlRequest( + request_msg = functions.GenerateUploadUrlRequest( parent="parent_value", kms_key_name="kms_key_name_value", ) + assert args[0] == request_msg def test_generate_upload_url_use_cached_wrapped_rpc(): @@ -3374,9 +3396,14 @@ async def test_generate_upload_url_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_generate_upload_url_async( - transport: str = "grpc_asyncio", request_type=functions.GenerateUploadUrlRequest -): +@pytest.mark.parametrize( + "request_type", + [ + functions.GenerateUploadUrlRequest(), + {}, + ], +) +async def test_generate_upload_url_async(request_type, transport: str = "grpc_asyncio"): client = FunctionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3384,7 +3411,7 @@ async def test_generate_upload_url_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( @@ -3409,11 +3436,6 @@ async def test_generate_upload_url_async( assert response.upload_url == "upload_url_value" -@pytest.mark.asyncio -async def test_generate_upload_url_async_from_dict(): - await test_generate_upload_url_async(request_type=dict) - - def test_generate_upload_url_field_headers(): client = FunctionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3482,8 +3504,8 @@ async def test_generate_upload_url_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - functions.GenerateDownloadUrlRequest, - dict, + functions.GenerateDownloadUrlRequest(), + {}, ], ) def test_generate_download_url(request_type, transport: str = "grpc"): @@ -3494,7 +3516,7 @@ def test_generate_download_url(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3542,9 +3564,10 @@ def test_generate_download_url_non_empty_request_with_auto_populated_field(): client.generate_download_url(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == functions.GenerateDownloadUrlRequest( + request_msg = functions.GenerateDownloadUrlRequest( name="name_value", ) + assert args[0] == request_msg def test_generate_download_url_use_cached_wrapped_rpc(): @@ -3630,8 +3653,15 @@ async def test_generate_download_url_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + functions.GenerateDownloadUrlRequest(), + {}, + ], +) async def test_generate_download_url_async( - transport: str = "grpc_asyncio", request_type=functions.GenerateDownloadUrlRequest + request_type, transport: str = "grpc_asyncio" ): client = FunctionServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3640,7 +3670,7 @@ async def test_generate_download_url_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( @@ -3665,11 +3695,6 @@ async def test_generate_download_url_async( assert response.download_url == "download_url_value" -@pytest.mark.asyncio -async def test_generate_download_url_async_from_dict(): - await test_generate_download_url_async(request_type=dict) - - def test_generate_download_url_field_headers(): client = FunctionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3738,8 +3763,8 @@ async def test_generate_download_url_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - functions.ListRuntimesRequest, - dict, + functions.ListRuntimesRequest(), + {}, ], ) def test_list_runtimes(request_type, transport: str = "grpc"): @@ -3750,7 +3775,7 @@ def test_list_runtimes(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_runtimes), "__call__") as call: @@ -3792,10 +3817,11 @@ def test_list_runtimes_non_empty_request_with_auto_populated_field(): client.list_runtimes(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == functions.ListRuntimesRequest( + request_msg = functions.ListRuntimesRequest( parent="parent_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_runtimes_use_cached_wrapped_rpc(): @@ -3876,9 +3902,14 @@ async def test_list_runtimes_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_runtimes_async( - transport: str = "grpc_asyncio", request_type=functions.ListRuntimesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + functions.ListRuntimesRequest(), + {}, + ], +) +async def test_list_runtimes_async(request_type, transport: str = "grpc_asyncio"): client = FunctionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3886,7 +3917,7 @@ async def test_list_runtimes_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_runtimes), "__call__") as call: @@ -3906,11 +3937,6 @@ async def test_list_runtimes_async( assert isinstance(response, functions.ListRuntimesResponse) -@pytest.mark.asyncio -async def test_list_runtimes_async_from_dict(): - await test_list_runtimes_async(request_type=dict) - - def test_list_runtimes_field_headers(): client = FunctionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5589,7 +5615,6 @@ def test_get_function_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = functions.GetFunctionRequest() - assert args[0] == request_msg @@ -5610,7 +5635,6 @@ def test_list_functions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = functions.ListFunctionsRequest() - assert args[0] == request_msg @@ -5631,7 +5655,6 @@ def test_create_function_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = functions.CreateFunctionRequest() - assert args[0] == request_msg @@ -5652,7 +5675,6 @@ def test_update_function_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = functions.UpdateFunctionRequest() - assert args[0] == request_msg @@ -5673,7 +5695,6 @@ def test_delete_function_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = functions.DeleteFunctionRequest() - assert args[0] == request_msg @@ -5696,7 +5717,6 @@ def test_generate_upload_url_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = functions.GenerateUploadUrlRequest() - assert args[0] == request_msg @@ -5719,7 +5739,6 @@ def test_generate_download_url_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = functions.GenerateDownloadUrlRequest() - assert args[0] == request_msg @@ -5740,7 +5759,6 @@ def test_list_runtimes_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = functions.ListRuntimesRequest() - assert args[0] == request_msg @@ -5787,7 +5805,6 @@ async def test_get_function_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = functions.GetFunctionRequest() - assert args[0] == request_msg @@ -5815,7 +5832,6 @@ async def test_list_functions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = functions.ListFunctionsRequest() - assert args[0] == request_msg @@ -5840,7 +5856,6 @@ async def test_create_function_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = functions.CreateFunctionRequest() - assert args[0] == request_msg @@ -5865,7 +5880,6 @@ async def test_update_function_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = functions.UpdateFunctionRequest() - assert args[0] == request_msg @@ -5890,7 +5904,6 @@ async def test_delete_function_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = functions.DeleteFunctionRequest() - assert args[0] == request_msg @@ -5919,7 +5932,6 @@ async def test_generate_upload_url_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = functions.GenerateUploadUrlRequest() - assert args[0] == request_msg @@ -5948,7 +5960,6 @@ async def test_generate_download_url_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = functions.GenerateDownloadUrlRequest() - assert args[0] == request_msg @@ -5973,7 +5984,6 @@ async def test_list_runtimes_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = functions.ListRuntimesRequest() - assert args[0] == request_msg @@ -7764,7 +7774,6 @@ def test_get_function_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = functions.GetFunctionRequest() - assert args[0] == request_msg @@ -7784,7 +7793,6 @@ def test_list_functions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = functions.ListFunctionsRequest() - assert args[0] == request_msg @@ -7804,7 +7812,6 @@ def test_create_function_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = functions.CreateFunctionRequest() - assert args[0] == request_msg @@ -7824,7 +7831,6 @@ def test_update_function_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = functions.UpdateFunctionRequest() - assert args[0] == request_msg @@ -7844,7 +7850,6 @@ def test_delete_function_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = functions.DeleteFunctionRequest() - assert args[0] == request_msg @@ -7866,7 +7871,6 @@ def test_generate_upload_url_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = functions.GenerateUploadUrlRequest() - assert args[0] == request_msg @@ -7888,7 +7892,6 @@ def test_generate_download_url_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = functions.GenerateDownloadUrlRequest() - assert args[0] == request_msg @@ -7908,7 +7911,6 @@ def test_list_runtimes_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = functions.ListRuntimesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-gdchardwaremanagement/noxfile.py b/packages/google-cloud-gdchardwaremanagement/noxfile.py index 1c0cffab27e7..6f51ea26c38b 100644 --- a/packages/google-cloud-gdchardwaremanagement/noxfile.py +++ b/packages/google-cloud-gdchardwaremanagement/noxfile.py @@ -47,7 +47,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-gdchardwaremanagement" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-gdchardwaremanagement/setup.py b/packages/google-cloud-gdchardwaremanagement/setup.py index 76fd7e9ed083..22c537fdf4cc 100644 --- a/packages/google-cloud-gdchardwaremanagement/setup.py +++ b/packages/google-cloud-gdchardwaremanagement/setup.py @@ -45,7 +45,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/google-cloud-gdchardwaremanagement/testing/constraints-3.10.txt b/packages/google-cloud-gdchardwaremanagement/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-gdchardwaremanagement/testing/constraints-3.10.txt +++ b/packages/google-cloud-gdchardwaremanagement/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-gdchardwaremanagement/tests/unit/gapic/gdchardwaremanagement_v1alpha/test_gdc_hardware_management.py b/packages/google-cloud-gdchardwaremanagement/tests/unit/gapic/gdchardwaremanagement_v1alpha/test_gdc_hardware_management.py index bdc6ac7a3322..7ec6687e7b81 100644 --- a/packages/google-cloud-gdchardwaremanagement/tests/unit/gapic/gdchardwaremanagement_v1alpha/test_gdc_hardware_management.py +++ b/packages/google-cloud-gdchardwaremanagement/tests/unit/gapic/gdchardwaremanagement_v1alpha/test_gdc_hardware_management.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 @@ -121,6 +122,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" @@ -1386,8 +1402,8 @@ def test_gdc_hardware_management_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - service.ListOrdersRequest, - dict, + service.ListOrdersRequest(), + {}, ], ) def test_list_orders(request_type, transport: str = "grpc"): @@ -1398,7 +1414,7 @@ def test_list_orders(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_orders), "__call__") as call: @@ -1447,12 +1463,13 @@ def test_list_orders_non_empty_request_with_auto_populated_field(): client.list_orders(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListOrdersRequest( + request_msg = service.ListOrdersRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_orders_use_cached_wrapped_rpc(): @@ -1533,9 +1550,14 @@ async def test_list_orders_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_orders_async( - transport: str = "grpc_asyncio", request_type=service.ListOrdersRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListOrdersRequest(), + {}, + ], +) +async def test_list_orders_async(request_type, transport: str = "grpc_asyncio"): client = GDCHardwareManagementAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1543,7 +1565,7 @@ async def test_list_orders_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_orders), "__call__") as call: @@ -1568,11 +1590,6 @@ async def test_list_orders_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_orders_async_from_dict(): - await test_list_orders_async(request_type=dict) - - def test_list_orders_field_headers(): client = GDCHardwareManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1909,8 +1926,8 @@ async def test_list_orders_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetOrderRequest, - dict, + service.GetOrderRequest(), + {}, ], ) def test_get_order(request_type, transport: str = "grpc"): @@ -1921,7 +1938,7 @@ def test_get_order(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_order), "__call__") as call: @@ -1987,9 +2004,10 @@ def test_get_order_non_empty_request_with_auto_populated_field(): client.get_order(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetOrderRequest( + request_msg = service.GetOrderRequest( name="name_value", ) + assert args[0] == request_msg def test_get_order_use_cached_wrapped_rpc(): @@ -2068,9 +2086,14 @@ async def test_get_order_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_order_async( - transport: str = "grpc_asyncio", request_type=service.GetOrderRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetOrderRequest(), + {}, + ], +) +async def test_get_order_async(request_type, transport: str = "grpc_asyncio"): client = GDCHardwareManagementAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2078,7 +2101,7 @@ async def test_get_order_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_order), "__call__") as call: @@ -2123,11 +2146,6 @@ async def test_get_order_async( assert response.vendor_notes == "vendor_notes_value" -@pytest.mark.asyncio -async def test_get_order_async_from_dict(): - await test_get_order_async(request_type=dict) - - def test_get_order_field_headers(): client = GDCHardwareManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2270,8 +2288,8 @@ async def test_get_order_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.CreateOrderRequest, - dict, + service.CreateOrderRequest(), + {}, ], ) def test_create_order(request_type, transport: str = "grpc"): @@ -2282,7 +2300,7 @@ def test_create_order(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_order), "__call__") as call: @@ -2325,11 +2343,12 @@ def test_create_order_non_empty_request_with_auto_populated_field(): client.create_order(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateOrderRequest( + request_msg = service.CreateOrderRequest( parent="parent_value", order_id="order_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_order_use_cached_wrapped_rpc(): @@ -2420,9 +2439,14 @@ async def test_create_order_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_order_async( - transport: str = "grpc_asyncio", request_type=service.CreateOrderRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CreateOrderRequest(), + {}, + ], +) +async def test_create_order_async(request_type, transport: str = "grpc_asyncio"): client = GDCHardwareManagementAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2430,7 +2454,7 @@ async def test_create_order_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_order), "__call__") as call: @@ -2450,11 +2474,6 @@ async def test_create_order_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_order_async_from_dict(): - await test_create_order_async(request_type=dict) - - def test_create_order_field_headers(): client = GDCHardwareManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2621,8 +2640,8 @@ async def test_create_order_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdateOrderRequest, - dict, + service.UpdateOrderRequest(), + {}, ], ) def test_update_order(request_type, transport: str = "grpc"): @@ -2633,7 +2652,7 @@ def test_update_order(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_order), "__call__") as call: @@ -2674,9 +2693,10 @@ def test_update_order_non_empty_request_with_auto_populated_field(): client.update_order(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateOrderRequest( + request_msg = service.UpdateOrderRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_order_use_cached_wrapped_rpc(): @@ -2767,9 +2787,14 @@ async def test_update_order_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_order_async( - transport: str = "grpc_asyncio", request_type=service.UpdateOrderRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateOrderRequest(), + {}, + ], +) +async def test_update_order_async(request_type, transport: str = "grpc_asyncio"): client = GDCHardwareManagementAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2777,7 +2802,7 @@ async def test_update_order_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_order), "__call__") as call: @@ -2797,11 +2822,6 @@ async def test_update_order_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_order_async_from_dict(): - await test_update_order_async(request_type=dict) - - def test_update_order_field_headers(): client = GDCHardwareManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2958,8 +2978,8 @@ async def test_update_order_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DeleteOrderRequest, - dict, + service.DeleteOrderRequest(), + {}, ], ) def test_delete_order(request_type, transport: str = "grpc"): @@ -2970,7 +2990,7 @@ def test_delete_order(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_order), "__call__") as call: @@ -3012,10 +3032,11 @@ def test_delete_order_non_empty_request_with_auto_populated_field(): client.delete_order(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteOrderRequest( + request_msg = service.DeleteOrderRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_order_use_cached_wrapped_rpc(): @@ -3106,9 +3127,14 @@ async def test_delete_order_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_order_async( - transport: str = "grpc_asyncio", request_type=service.DeleteOrderRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteOrderRequest(), + {}, + ], +) +async def test_delete_order_async(request_type, transport: str = "grpc_asyncio"): client = GDCHardwareManagementAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3116,7 +3142,7 @@ async def test_delete_order_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_order), "__call__") as call: @@ -3136,11 +3162,6 @@ async def test_delete_order_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_order_async_from_dict(): - await test_delete_order_async(request_type=dict) - - def test_delete_order_field_headers(): client = GDCHardwareManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3287,8 +3308,8 @@ async def test_delete_order_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.SubmitOrderRequest, - dict, + service.SubmitOrderRequest(), + {}, ], ) def test_submit_order(request_type, transport: str = "grpc"): @@ -3299,7 +3320,7 @@ def test_submit_order(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.submit_order), "__call__") as call: @@ -3341,10 +3362,11 @@ def test_submit_order_non_empty_request_with_auto_populated_field(): client.submit_order(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.SubmitOrderRequest( + request_msg = service.SubmitOrderRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_submit_order_use_cached_wrapped_rpc(): @@ -3435,9 +3457,14 @@ async def test_submit_order_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_submit_order_async( - transport: str = "grpc_asyncio", request_type=service.SubmitOrderRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.SubmitOrderRequest(), + {}, + ], +) +async def test_submit_order_async(request_type, transport: str = "grpc_asyncio"): client = GDCHardwareManagementAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3445,7 +3472,7 @@ async def test_submit_order_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.submit_order), "__call__") as call: @@ -3465,11 +3492,6 @@ async def test_submit_order_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_submit_order_async_from_dict(): - await test_submit_order_async(request_type=dict) - - def test_submit_order_field_headers(): client = GDCHardwareManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3616,8 +3638,8 @@ async def test_submit_order_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.CancelOrderRequest, - dict, + service.CancelOrderRequest(), + {}, ], ) def test_cancel_order(request_type, transport: str = "grpc"): @@ -3628,7 +3650,7 @@ def test_cancel_order(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.cancel_order), "__call__") as call: @@ -3669,9 +3691,10 @@ def test_cancel_order_non_empty_request_with_auto_populated_field(): client.cancel_order(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CancelOrderRequest( + request_msg = service.CancelOrderRequest( name="name_value", ) + assert args[0] == request_msg def test_cancel_order_use_cached_wrapped_rpc(): @@ -3762,9 +3785,14 @@ async def test_cancel_order_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_cancel_order_async( - transport: str = "grpc_asyncio", request_type=service.CancelOrderRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CancelOrderRequest(), + {}, + ], +) +async def test_cancel_order_async(request_type, transport: str = "grpc_asyncio"): client = GDCHardwareManagementAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3772,7 +3800,7 @@ async def test_cancel_order_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.cancel_order), "__call__") as call: @@ -3792,11 +3820,6 @@ async def test_cancel_order_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_cancel_order_async_from_dict(): - await test_cancel_order_async(request_type=dict) - - def test_cancel_order_field_headers(): client = GDCHardwareManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3943,8 +3966,8 @@ async def test_cancel_order_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListSitesRequest, - dict, + service.ListSitesRequest(), + {}, ], ) def test_list_sites(request_type, transport: str = "grpc"): @@ -3955,7 +3978,7 @@ def test_list_sites(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_sites), "__call__") as call: @@ -4004,12 +4027,13 @@ def test_list_sites_non_empty_request_with_auto_populated_field(): client.list_sites(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListSitesRequest( + request_msg = service.ListSitesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_sites_use_cached_wrapped_rpc(): @@ -4088,9 +4112,14 @@ async def test_list_sites_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_list_sites_async( - transport: str = "grpc_asyncio", request_type=service.ListSitesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListSitesRequest(), + {}, + ], +) +async def test_list_sites_async(request_type, transport: str = "grpc_asyncio"): client = GDCHardwareManagementAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4098,7 +4127,7 @@ async def test_list_sites_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_sites), "__call__") as call: @@ -4123,11 +4152,6 @@ async def test_list_sites_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_sites_async_from_dict(): - await test_list_sites_async(request_type=dict) - - def test_list_sites_field_headers(): client = GDCHardwareManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4464,8 +4488,8 @@ async def test_list_sites_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetSiteRequest, - dict, + service.GetSiteRequest(), + {}, ], ) def test_get_site(request_type, transport: str = "grpc"): @@ -4476,7 +4500,7 @@ def test_get_site(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_site), "__call__") as call: @@ -4530,9 +4554,10 @@ def test_get_site_non_empty_request_with_auto_populated_field(): client.get_site(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetSiteRequest( + request_msg = service.GetSiteRequest( name="name_value", ) + assert args[0] == request_msg def test_get_site_use_cached_wrapped_rpc(): @@ -4611,9 +4636,14 @@ async def test_get_site_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn @pytest.mark.asyncio -async def test_get_site_async( - transport: str = "grpc_asyncio", request_type=service.GetSiteRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetSiteRequest(), + {}, + ], +) +async def test_get_site_async(request_type, transport: str = "grpc_asyncio"): client = GDCHardwareManagementAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4621,7 +4651,7 @@ async def test_get_site_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_site), "__call__") as call: @@ -4654,11 +4684,6 @@ async def test_get_site_async( assert response.customer_site_id == "customer_site_id_value" -@pytest.mark.asyncio -async def test_get_site_async_from_dict(): - await test_get_site_async(request_type=dict) - - def test_get_site_field_headers(): client = GDCHardwareManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4801,8 +4826,8 @@ async def test_get_site_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.CreateSiteRequest, - dict, + service.CreateSiteRequest(), + {}, ], ) def test_create_site(request_type, transport: str = "grpc"): @@ -4813,7 +4838,7 @@ def test_create_site(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_site), "__call__") as call: @@ -4856,11 +4881,12 @@ def test_create_site_non_empty_request_with_auto_populated_field(): client.create_site(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateSiteRequest( + request_msg = service.CreateSiteRequest( parent="parent_value", site_id="site_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_site_use_cached_wrapped_rpc(): @@ -4951,9 +4977,14 @@ async def test_create_site_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_site_async( - transport: str = "grpc_asyncio", request_type=service.CreateSiteRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CreateSiteRequest(), + {}, + ], +) +async def test_create_site_async(request_type, transport: str = "grpc_asyncio"): client = GDCHardwareManagementAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4961,7 +4992,7 @@ async def test_create_site_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_site), "__call__") as call: @@ -4981,11 +5012,6 @@ async def test_create_site_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_site_async_from_dict(): - await test_create_site_async(request_type=dict) - - def test_create_site_field_headers(): client = GDCHardwareManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5152,8 +5178,8 @@ async def test_create_site_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdateSiteRequest, - dict, + service.UpdateSiteRequest(), + {}, ], ) def test_update_site(request_type, transport: str = "grpc"): @@ -5164,7 +5190,7 @@ def test_update_site(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_site), "__call__") as call: @@ -5205,9 +5231,10 @@ def test_update_site_non_empty_request_with_auto_populated_field(): client.update_site(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateSiteRequest( + request_msg = service.UpdateSiteRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_site_use_cached_wrapped_rpc(): @@ -5298,9 +5325,14 @@ async def test_update_site_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_site_async( - transport: str = "grpc_asyncio", request_type=service.UpdateSiteRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateSiteRequest(), + {}, + ], +) +async def test_update_site_async(request_type, transport: str = "grpc_asyncio"): client = GDCHardwareManagementAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5308,7 +5340,7 @@ async def test_update_site_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_site), "__call__") as call: @@ -5328,11 +5360,6 @@ async def test_update_site_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_site_async_from_dict(): - await test_update_site_async(request_type=dict) - - def test_update_site_field_headers(): client = GDCHardwareManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5489,8 +5516,8 @@ async def test_update_site_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DeleteSiteRequest, - dict, + service.DeleteSiteRequest(), + {}, ], ) def test_delete_site(request_type, transport: str = "grpc"): @@ -5501,7 +5528,7 @@ def test_delete_site(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_site), "__call__") as call: @@ -5542,9 +5569,10 @@ def test_delete_site_non_empty_request_with_auto_populated_field(): client.delete_site(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteSiteRequest( + request_msg = service.DeleteSiteRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_site_use_cached_wrapped_rpc(): @@ -5635,9 +5663,14 @@ async def test_delete_site_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_site_async( - transport: str = "grpc_asyncio", request_type=service.DeleteSiteRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteSiteRequest(), + {}, + ], +) +async def test_delete_site_async(request_type, transport: str = "grpc_asyncio"): client = GDCHardwareManagementAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5645,7 +5678,7 @@ async def test_delete_site_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_site), "__call__") as call: @@ -5665,11 +5698,6 @@ async def test_delete_site_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_site_async_from_dict(): - await test_delete_site_async(request_type=dict) - - def test_delete_site_field_headers(): client = GDCHardwareManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5816,8 +5844,8 @@ async def test_delete_site_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListHardwareGroupsRequest, - dict, + service.ListHardwareGroupsRequest(), + {}, ], ) def test_list_hardware_groups(request_type, transport: str = "grpc"): @@ -5828,7 +5856,7 @@ def test_list_hardware_groups(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5881,12 +5909,13 @@ def test_list_hardware_groups_non_empty_request_with_auto_populated_field(): client.list_hardware_groups(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListHardwareGroupsRequest( + request_msg = service.ListHardwareGroupsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_hardware_groups_use_cached_wrapped_rpc(): @@ -5971,8 +6000,15 @@ async def test_list_hardware_groups_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.ListHardwareGroupsRequest(), + {}, + ], +) async def test_list_hardware_groups_async( - transport: str = "grpc_asyncio", request_type=service.ListHardwareGroupsRequest + request_type, transport: str = "grpc_asyncio" ): client = GDCHardwareManagementAsyncClient( credentials=async_anonymous_credentials(), @@ -5981,7 +6017,7 @@ async def test_list_hardware_groups_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( @@ -6008,11 +6044,6 @@ async def test_list_hardware_groups_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_hardware_groups_async_from_dict(): - await test_list_hardware_groups_async(request_type=dict) - - def test_list_hardware_groups_field_headers(): client = GDCHardwareManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6365,8 +6396,8 @@ async def test_list_hardware_groups_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetHardwareGroupRequest, - dict, + service.GetHardwareGroupRequest(), + {}, ], ) def test_get_hardware_group(request_type, transport: str = "grpc"): @@ -6377,7 +6408,7 @@ def test_get_hardware_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6433,9 +6464,10 @@ def test_get_hardware_group_non_empty_request_with_auto_populated_field(): client.get_hardware_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetHardwareGroupRequest( + request_msg = service.GetHardwareGroupRequest( name="name_value", ) + assert args[0] == request_msg def test_get_hardware_group_use_cached_wrapped_rpc(): @@ -6520,9 +6552,14 @@ async def test_get_hardware_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_hardware_group_async( - transport: str = "grpc_asyncio", request_type=service.GetHardwareGroupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetHardwareGroupRequest(), + {}, + ], +) +async def test_get_hardware_group_async(request_type, transport: str = "grpc_asyncio"): client = GDCHardwareManagementAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6530,7 +6567,7 @@ async def test_get_hardware_group_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( @@ -6563,11 +6600,6 @@ async def test_get_hardware_group_async( assert response.zone == "zone_value" -@pytest.mark.asyncio -async def test_get_hardware_group_async_from_dict(): - await test_get_hardware_group_async(request_type=dict) - - def test_get_hardware_group_field_headers(): client = GDCHardwareManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6722,8 +6754,8 @@ async def test_get_hardware_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.CreateHardwareGroupRequest, - dict, + service.CreateHardwareGroupRequest(), + {}, ], ) def test_create_hardware_group(request_type, transport: str = "grpc"): @@ -6734,7 +6766,7 @@ def test_create_hardware_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6781,11 +6813,12 @@ def test_create_hardware_group_non_empty_request_with_auto_populated_field(): client.create_hardware_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateHardwareGroupRequest( + request_msg = service.CreateHardwareGroupRequest( parent="parent_value", hardware_group_id="hardware_group_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_hardware_group_use_cached_wrapped_rpc(): @@ -6881,8 +6914,15 @@ async def test_create_hardware_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.CreateHardwareGroupRequest(), + {}, + ], +) async def test_create_hardware_group_async( - transport: str = "grpc_asyncio", request_type=service.CreateHardwareGroupRequest + request_type, transport: str = "grpc_asyncio" ): client = GDCHardwareManagementAsyncClient( credentials=async_anonymous_credentials(), @@ -6891,7 +6931,7 @@ async def test_create_hardware_group_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( @@ -6913,11 +6953,6 @@ async def test_create_hardware_group_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_hardware_group_async_from_dict(): - await test_create_hardware_group_async(request_type=dict) - - def test_create_hardware_group_field_headers(): client = GDCHardwareManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7092,8 +7127,8 @@ async def test_create_hardware_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdateHardwareGroupRequest, - dict, + service.UpdateHardwareGroupRequest(), + {}, ], ) def test_update_hardware_group(request_type, transport: str = "grpc"): @@ -7104,7 +7139,7 @@ def test_update_hardware_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7149,9 +7184,10 @@ def test_update_hardware_group_non_empty_request_with_auto_populated_field(): client.update_hardware_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateHardwareGroupRequest( + request_msg = service.UpdateHardwareGroupRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_hardware_group_use_cached_wrapped_rpc(): @@ -7247,8 +7283,15 @@ async def test_update_hardware_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateHardwareGroupRequest(), + {}, + ], +) async def test_update_hardware_group_async( - transport: str = "grpc_asyncio", request_type=service.UpdateHardwareGroupRequest + request_type, transport: str = "grpc_asyncio" ): client = GDCHardwareManagementAsyncClient( credentials=async_anonymous_credentials(), @@ -7257,7 +7300,7 @@ async def test_update_hardware_group_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( @@ -7279,11 +7322,6 @@ async def test_update_hardware_group_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_hardware_group_async_from_dict(): - await test_update_hardware_group_async(request_type=dict) - - def test_update_hardware_group_field_headers(): client = GDCHardwareManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7448,8 +7486,8 @@ async def test_update_hardware_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DeleteHardwareGroupRequest, - dict, + service.DeleteHardwareGroupRequest(), + {}, ], ) def test_delete_hardware_group(request_type, transport: str = "grpc"): @@ -7460,7 +7498,7 @@ def test_delete_hardware_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7506,10 +7544,11 @@ def test_delete_hardware_group_non_empty_request_with_auto_populated_field(): client.delete_hardware_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteHardwareGroupRequest( + request_msg = service.DeleteHardwareGroupRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_hardware_group_use_cached_wrapped_rpc(): @@ -7605,8 +7644,15 @@ async def test_delete_hardware_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteHardwareGroupRequest(), + {}, + ], +) async def test_delete_hardware_group_async( - transport: str = "grpc_asyncio", request_type=service.DeleteHardwareGroupRequest + request_type, transport: str = "grpc_asyncio" ): client = GDCHardwareManagementAsyncClient( credentials=async_anonymous_credentials(), @@ -7615,7 +7661,7 @@ async def test_delete_hardware_group_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( @@ -7637,11 +7683,6 @@ async def test_delete_hardware_group_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_hardware_group_async_from_dict(): - await test_delete_hardware_group_async(request_type=dict) - - def test_delete_hardware_group_field_headers(): client = GDCHardwareManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7796,8 +7837,8 @@ async def test_delete_hardware_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListHardwareRequest, - dict, + service.ListHardwareRequest(), + {}, ], ) def test_list_hardware(request_type, transport: str = "grpc"): @@ -7808,7 +7849,7 @@ def test_list_hardware(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_hardware), "__call__") as call: @@ -7857,12 +7898,13 @@ def test_list_hardware_non_empty_request_with_auto_populated_field(): client.list_hardware(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListHardwareRequest( + request_msg = service.ListHardwareRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_hardware_use_cached_wrapped_rpc(): @@ -7943,9 +7985,14 @@ async def test_list_hardware_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_hardware_async( - transport: str = "grpc_asyncio", request_type=service.ListHardwareRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListHardwareRequest(), + {}, + ], +) +async def test_list_hardware_async(request_type, transport: str = "grpc_asyncio"): client = GDCHardwareManagementAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7953,7 +8000,7 @@ async def test_list_hardware_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_hardware), "__call__") as call: @@ -7978,11 +8025,6 @@ async def test_list_hardware_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_hardware_async_from_dict(): - await test_list_hardware_async(request_type=dict) - - def test_list_hardware_field_headers(): client = GDCHardwareManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8319,8 +8361,8 @@ async def test_list_hardware_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetHardwareRequest, - dict, + service.GetHardwareRequest(), + {}, ], ) def test_get_hardware(request_type, transport: str = "grpc"): @@ -8331,7 +8373,7 @@ def test_get_hardware(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_hardware), "__call__") as call: @@ -8389,9 +8431,10 @@ def test_get_hardware_non_empty_request_with_auto_populated_field(): client.get_hardware(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetHardwareRequest( + request_msg = service.GetHardwareRequest( name="name_value", ) + assert args[0] == request_msg def test_get_hardware_use_cached_wrapped_rpc(): @@ -8472,9 +8515,14 @@ async def test_get_hardware_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_hardware_async( - transport: str = "grpc_asyncio", request_type=service.GetHardwareRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetHardwareRequest(), + {}, + ], +) +async def test_get_hardware_async(request_type, transport: str = "grpc_asyncio"): client = GDCHardwareManagementAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8482,7 +8530,7 @@ async def test_get_hardware_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_hardware), "__call__") as call: @@ -8519,11 +8567,6 @@ async def test_get_hardware_async( assert response.zone == "zone_value" -@pytest.mark.asyncio -async def test_get_hardware_async_from_dict(): - await test_get_hardware_async(request_type=dict) - - def test_get_hardware_field_headers(): client = GDCHardwareManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8666,8 +8709,8 @@ async def test_get_hardware_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.CreateHardwareRequest, - dict, + service.CreateHardwareRequest(), + {}, ], ) def test_create_hardware(request_type, transport: str = "grpc"): @@ -8678,7 +8721,7 @@ def test_create_hardware(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_hardware), "__call__") as call: @@ -8720,10 +8763,11 @@ def test_create_hardware_non_empty_request_with_auto_populated_field(): client.create_hardware(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateHardwareRequest( + request_msg = service.CreateHardwareRequest( parent="parent_value", hardware_id="hardware_id_value", ) + assert args[0] == request_msg def test_create_hardware_use_cached_wrapped_rpc(): @@ -8814,9 +8858,14 @@ async def test_create_hardware_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_hardware_async( - transport: str = "grpc_asyncio", request_type=service.CreateHardwareRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CreateHardwareRequest(), + {}, + ], +) +async def test_create_hardware_async(request_type, transport: str = "grpc_asyncio"): client = GDCHardwareManagementAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8824,7 +8873,7 @@ async def test_create_hardware_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_hardware), "__call__") as call: @@ -8844,11 +8893,6 @@ async def test_create_hardware_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_hardware_async_from_dict(): - await test_create_hardware_async(request_type=dict) - - def test_create_hardware_field_headers(): client = GDCHardwareManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9015,8 +9059,8 @@ async def test_create_hardware_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdateHardwareRequest, - dict, + service.UpdateHardwareRequest(), + {}, ], ) def test_update_hardware(request_type, transport: str = "grpc"): @@ -9027,7 +9071,7 @@ def test_update_hardware(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_hardware), "__call__") as call: @@ -9068,9 +9112,10 @@ def test_update_hardware_non_empty_request_with_auto_populated_field(): client.update_hardware(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateHardwareRequest( + request_msg = service.UpdateHardwareRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_hardware_use_cached_wrapped_rpc(): @@ -9161,9 +9206,14 @@ async def test_update_hardware_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_hardware_async( - transport: str = "grpc_asyncio", request_type=service.UpdateHardwareRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateHardwareRequest(), + {}, + ], +) +async def test_update_hardware_async(request_type, transport: str = "grpc_asyncio"): client = GDCHardwareManagementAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9171,7 +9221,7 @@ async def test_update_hardware_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_hardware), "__call__") as call: @@ -9191,11 +9241,6 @@ async def test_update_hardware_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_hardware_async_from_dict(): - await test_update_hardware_async(request_type=dict) - - def test_update_hardware_field_headers(): client = GDCHardwareManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9352,8 +9397,8 @@ async def test_update_hardware_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DeleteHardwareRequest, - dict, + service.DeleteHardwareRequest(), + {}, ], ) def test_delete_hardware(request_type, transport: str = "grpc"): @@ -9364,7 +9409,7 @@ def test_delete_hardware(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_hardware), "__call__") as call: @@ -9405,9 +9450,10 @@ def test_delete_hardware_non_empty_request_with_auto_populated_field(): client.delete_hardware(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteHardwareRequest( + request_msg = service.DeleteHardwareRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_hardware_use_cached_wrapped_rpc(): @@ -9498,9 +9544,14 @@ async def test_delete_hardware_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_hardware_async( - transport: str = "grpc_asyncio", request_type=service.DeleteHardwareRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteHardwareRequest(), + {}, + ], +) +async def test_delete_hardware_async(request_type, transport: str = "grpc_asyncio"): client = GDCHardwareManagementAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9508,7 +9559,7 @@ async def test_delete_hardware_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_hardware), "__call__") as call: @@ -9528,11 +9579,6 @@ async def test_delete_hardware_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_hardware_async_from_dict(): - await test_delete_hardware_async(request_type=dict) - - def test_delete_hardware_field_headers(): client = GDCHardwareManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9679,8 +9725,8 @@ async def test_delete_hardware_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListCommentsRequest, - dict, + service.ListCommentsRequest(), + {}, ], ) def test_list_comments(request_type, transport: str = "grpc"): @@ -9691,7 +9737,7 @@ def test_list_comments(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_comments), "__call__") as call: @@ -9740,12 +9786,13 @@ def test_list_comments_non_empty_request_with_auto_populated_field(): client.list_comments(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListCommentsRequest( + request_msg = service.ListCommentsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_comments_use_cached_wrapped_rpc(): @@ -9826,9 +9873,14 @@ async def test_list_comments_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_comments_async( - transport: str = "grpc_asyncio", request_type=service.ListCommentsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListCommentsRequest(), + {}, + ], +) +async def test_list_comments_async(request_type, transport: str = "grpc_asyncio"): client = GDCHardwareManagementAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9836,7 +9888,7 @@ async def test_list_comments_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_comments), "__call__") as call: @@ -9861,11 +9913,6 @@ async def test_list_comments_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_comments_async_from_dict(): - await test_list_comments_async(request_type=dict) - - def test_list_comments_field_headers(): client = GDCHardwareManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10202,8 +10249,8 @@ async def test_list_comments_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetCommentRequest, - dict, + service.GetCommentRequest(), + {}, ], ) def test_get_comment(request_type, transport: str = "grpc"): @@ -10214,7 +10261,7 @@ def test_get_comment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_comment), "__call__") as call: @@ -10264,9 +10311,10 @@ def test_get_comment_non_empty_request_with_auto_populated_field(): client.get_comment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetCommentRequest( + request_msg = service.GetCommentRequest( name="name_value", ) + assert args[0] == request_msg def test_get_comment_use_cached_wrapped_rpc(): @@ -10347,9 +10395,14 @@ async def test_get_comment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_comment_async( - transport: str = "grpc_asyncio", request_type=service.GetCommentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetCommentRequest(), + {}, + ], +) +async def test_get_comment_async(request_type, transport: str = "grpc_asyncio"): client = GDCHardwareManagementAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10357,7 +10410,7 @@ async def test_get_comment_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_comment), "__call__") as call: @@ -10386,11 +10439,6 @@ async def test_get_comment_async( assert response.author_entity == resources.Entity.GOOGLE -@pytest.mark.asyncio -async def test_get_comment_async_from_dict(): - await test_get_comment_async(request_type=dict) - - def test_get_comment_field_headers(): client = GDCHardwareManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10533,8 +10581,8 @@ async def test_get_comment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.CreateCommentRequest, - dict, + service.CreateCommentRequest(), + {}, ], ) def test_create_comment(request_type, transport: str = "grpc"): @@ -10545,7 +10593,7 @@ def test_create_comment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_comment), "__call__") as call: @@ -10588,11 +10636,12 @@ def test_create_comment_non_empty_request_with_auto_populated_field(): client.create_comment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateCommentRequest( + request_msg = service.CreateCommentRequest( parent="parent_value", comment_id="comment_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_comment_use_cached_wrapped_rpc(): @@ -10683,9 +10732,14 @@ async def test_create_comment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_comment_async( - transport: str = "grpc_asyncio", request_type=service.CreateCommentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CreateCommentRequest(), + {}, + ], +) +async def test_create_comment_async(request_type, transport: str = "grpc_asyncio"): client = GDCHardwareManagementAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10693,7 +10747,7 @@ async def test_create_comment_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_comment), "__call__") as call: @@ -10713,11 +10767,6 @@ async def test_create_comment_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_comment_async_from_dict(): - await test_create_comment_async(request_type=dict) - - def test_create_comment_field_headers(): client = GDCHardwareManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10884,8 +10933,8 @@ async def test_create_comment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.RecordActionOnCommentRequest, - dict, + service.RecordActionOnCommentRequest(), + {}, ], ) def test_record_action_on_comment(request_type, transport: str = "grpc"): @@ -10896,7 +10945,7 @@ def test_record_action_on_comment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10950,9 +10999,10 @@ def test_record_action_on_comment_non_empty_request_with_auto_populated_field(): client.record_action_on_comment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.RecordActionOnCommentRequest( + request_msg = service.RecordActionOnCommentRequest( name="name_value", ) + assert args[0] == request_msg def test_record_action_on_comment_use_cached_wrapped_rpc(): @@ -11038,8 +11088,15 @@ async def test_record_action_on_comment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.RecordActionOnCommentRequest(), + {}, + ], +) async def test_record_action_on_comment_async( - transport: str = "grpc_asyncio", request_type=service.RecordActionOnCommentRequest + request_type, transport: str = "grpc_asyncio" ): client = GDCHardwareManagementAsyncClient( credentials=async_anonymous_credentials(), @@ -11048,7 +11105,7 @@ async def test_record_action_on_comment_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( @@ -11079,11 +11136,6 @@ async def test_record_action_on_comment_async( assert response.author_entity == resources.Entity.GOOGLE -@pytest.mark.asyncio -async def test_record_action_on_comment_async_from_dict(): - await test_record_action_on_comment_async(request_type=dict) - - def test_record_action_on_comment_field_headers(): client = GDCHardwareManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11244,8 +11296,8 @@ async def test_record_action_on_comment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListChangeLogEntriesRequest, - dict, + service.ListChangeLogEntriesRequest(), + {}, ], ) def test_list_change_log_entries(request_type, transport: str = "grpc"): @@ -11256,7 +11308,7 @@ def test_list_change_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( @@ -11309,12 +11361,13 @@ def test_list_change_log_entries_non_empty_request_with_auto_populated_field(): client.list_change_log_entries(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListChangeLogEntriesRequest( + request_msg = service.ListChangeLogEntriesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_change_log_entries_use_cached_wrapped_rpc(): @@ -11400,8 +11453,15 @@ async def test_list_change_log_entries_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.ListChangeLogEntriesRequest(), + {}, + ], +) async def test_list_change_log_entries_async( - transport: str = "grpc_asyncio", request_type=service.ListChangeLogEntriesRequest + request_type, transport: str = "grpc_asyncio" ): client = GDCHardwareManagementAsyncClient( credentials=async_anonymous_credentials(), @@ -11410,7 +11470,7 @@ async def test_list_change_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( @@ -11437,11 +11497,6 @@ async def test_list_change_log_entries_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_change_log_entries_async_from_dict(): - await test_list_change_log_entries_async(request_type=dict) - - def test_list_change_log_entries_field_headers(): client = GDCHardwareManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11794,8 +11849,8 @@ async def test_list_change_log_entries_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetChangeLogEntryRequest, - dict, + service.GetChangeLogEntryRequest(), + {}, ], ) def test_get_change_log_entry(request_type, transport: str = "grpc"): @@ -11806,7 +11861,7 @@ def test_get_change_log_entry(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11856,9 +11911,10 @@ def test_get_change_log_entry_non_empty_request_with_auto_populated_field(): client.get_change_log_entry(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetChangeLogEntryRequest( + request_msg = service.GetChangeLogEntryRequest( name="name_value", ) + assert args[0] == request_msg def test_get_change_log_entry_use_cached_wrapped_rpc(): @@ -11943,8 +11999,15 @@ async def test_get_change_log_entry_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.GetChangeLogEntryRequest(), + {}, + ], +) async def test_get_change_log_entry_async( - transport: str = "grpc_asyncio", request_type=service.GetChangeLogEntryRequest + request_type, transport: str = "grpc_asyncio" ): client = GDCHardwareManagementAsyncClient( credentials=async_anonymous_credentials(), @@ -11953,7 +12016,7 @@ async def test_get_change_log_entry_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( @@ -11980,11 +12043,6 @@ async def test_get_change_log_entry_async( assert response.log == "log_value" -@pytest.mark.asyncio -async def test_get_change_log_entry_async_from_dict(): - await test_get_change_log_entry_async(request_type=dict) - - def test_get_change_log_entry_field_headers(): client = GDCHardwareManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12139,8 +12197,8 @@ async def test_get_change_log_entry_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListSkusRequest, - dict, + service.ListSkusRequest(), + {}, ], ) def test_list_skus(request_type, transport: str = "grpc"): @@ -12151,7 +12209,7 @@ def test_list_skus(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_skus), "__call__") as call: @@ -12200,12 +12258,13 @@ def test_list_skus_non_empty_request_with_auto_populated_field(): client.list_skus(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListSkusRequest( + request_msg = service.ListSkusRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_skus_use_cached_wrapped_rpc(): @@ -12284,9 +12343,14 @@ async def test_list_skus_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_list_skus_async( - transport: str = "grpc_asyncio", request_type=service.ListSkusRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListSkusRequest(), + {}, + ], +) +async def test_list_skus_async(request_type, transport: str = "grpc_asyncio"): client = GDCHardwareManagementAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12294,7 +12358,7 @@ async def test_list_skus_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_skus), "__call__") as call: @@ -12319,11 +12383,6 @@ async def test_list_skus_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_skus_async_from_dict(): - await test_list_skus_async(request_type=dict) - - def test_list_skus_field_headers(): client = GDCHardwareManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12660,8 +12719,8 @@ async def test_list_skus_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetSkuRequest, - dict, + service.GetSkuRequest(), + {}, ], ) def test_get_sku(request_type, transport: str = "grpc"): @@ -12672,7 +12731,7 @@ def test_get_sku(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_sku), "__call__") as call: @@ -12728,9 +12787,10 @@ def test_get_sku_non_empty_request_with_auto_populated_field(): client.get_sku(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetSkuRequest( + request_msg = service.GetSkuRequest( name="name_value", ) + assert args[0] == request_msg def test_get_sku_use_cached_wrapped_rpc(): @@ -12809,9 +12869,14 @@ async def test_get_sku_async_use_cached_wrapped_rpc(transport: str = "grpc_async @pytest.mark.asyncio -async def test_get_sku_async( - transport: str = "grpc_asyncio", request_type=service.GetSkuRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetSkuRequest(), + {}, + ], +) +async def test_get_sku_async(request_type, transport: str = "grpc_asyncio"): client = GDCHardwareManagementAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12819,7 +12884,7 @@ async def test_get_sku_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_sku), "__call__") as call: @@ -12854,11 +12919,6 @@ async def test_get_sku_async( assert response.vcpu_count == 1094 -@pytest.mark.asyncio -async def test_get_sku_async_from_dict(): - await test_get_sku_async(request_type=dict) - - def test_get_sku_field_headers(): client = GDCHardwareManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13001,8 +13061,8 @@ async def test_get_sku_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListZonesRequest, - dict, + service.ListZonesRequest(), + {}, ], ) def test_list_zones(request_type, transport: str = "grpc"): @@ -13013,7 +13073,7 @@ def test_list_zones(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_zones), "__call__") as call: @@ -13062,12 +13122,13 @@ def test_list_zones_non_empty_request_with_auto_populated_field(): client.list_zones(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListZonesRequest( + request_msg = service.ListZonesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_zones_use_cached_wrapped_rpc(): @@ -13146,9 +13207,14 @@ async def test_list_zones_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_list_zones_async( - transport: str = "grpc_asyncio", request_type=service.ListZonesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListZonesRequest(), + {}, + ], +) +async def test_list_zones_async(request_type, transport: str = "grpc_asyncio"): client = GDCHardwareManagementAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13156,7 +13222,7 @@ async def test_list_zones_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_zones), "__call__") as call: @@ -13181,11 +13247,6 @@ async def test_list_zones_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_zones_async_from_dict(): - await test_list_zones_async(request_type=dict) - - def test_list_zones_field_headers(): client = GDCHardwareManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13522,8 +13583,8 @@ async def test_list_zones_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetZoneRequest, - dict, + service.GetZoneRequest(), + {}, ], ) def test_get_zone(request_type, transport: str = "grpc"): @@ -13534,7 +13595,7 @@ def test_get_zone(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_zone), "__call__") as call: @@ -13597,9 +13658,10 @@ def test_get_zone_non_empty_request_with_auto_populated_field(): client.get_zone(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetZoneRequest( + request_msg = service.GetZoneRequest( name="name_value", ) + assert args[0] == request_msg def test_get_zone_use_cached_wrapped_rpc(): @@ -13678,9 +13740,14 @@ async def test_get_zone_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn @pytest.mark.asyncio -async def test_get_zone_async( - transport: str = "grpc_asyncio", request_type=service.GetZoneRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetZoneRequest(), + {}, + ], +) +async def test_get_zone_async(request_type, transport: str = "grpc_asyncio"): client = GDCHardwareManagementAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13688,7 +13755,7 @@ async def test_get_zone_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_zone), "__call__") as call: @@ -13730,11 +13797,6 @@ async def test_get_zone_async( assert response.cluster_intent_verified is True -@pytest.mark.asyncio -async def test_get_zone_async_from_dict(): - await test_get_zone_async(request_type=dict) - - def test_get_zone_field_headers(): client = GDCHardwareManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13877,8 +13939,8 @@ async def test_get_zone_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.CreateZoneRequest, - dict, + service.CreateZoneRequest(), + {}, ], ) def test_create_zone(request_type, transport: str = "grpc"): @@ -13889,7 +13951,7 @@ def test_create_zone(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_zone), "__call__") as call: @@ -13931,10 +13993,11 @@ def test_create_zone_non_empty_request_with_auto_populated_field(): client.create_zone(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateZoneRequest( + request_msg = service.CreateZoneRequest( parent="parent_value", zone_id="zone_id_value", ) + assert args[0] == request_msg def test_create_zone_use_cached_wrapped_rpc(): @@ -14025,9 +14088,14 @@ async def test_create_zone_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_zone_async( - transport: str = "grpc_asyncio", request_type=service.CreateZoneRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CreateZoneRequest(), + {}, + ], +) +async def test_create_zone_async(request_type, transport: str = "grpc_asyncio"): client = GDCHardwareManagementAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14035,7 +14103,7 @@ async def test_create_zone_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_zone), "__call__") as call: @@ -14055,11 +14123,6 @@ async def test_create_zone_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_zone_async_from_dict(): - await test_create_zone_async(request_type=dict) - - def test_create_zone_field_headers(): client = GDCHardwareManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14226,8 +14289,8 @@ async def test_create_zone_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdateZoneRequest, - dict, + service.UpdateZoneRequest(), + {}, ], ) def test_update_zone(request_type, transport: str = "grpc"): @@ -14238,7 +14301,7 @@ def test_update_zone(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_zone), "__call__") as call: @@ -14277,7 +14340,8 @@ def test_update_zone_non_empty_request_with_auto_populated_field(): client.update_zone(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateZoneRequest() + request_msg = service.UpdateZoneRequest() + assert args[0] == request_msg def test_update_zone_use_cached_wrapped_rpc(): @@ -14368,9 +14432,14 @@ async def test_update_zone_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_zone_async( - transport: str = "grpc_asyncio", request_type=service.UpdateZoneRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateZoneRequest(), + {}, + ], +) +async def test_update_zone_async(request_type, transport: str = "grpc_asyncio"): client = GDCHardwareManagementAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14378,7 +14447,7 @@ async def test_update_zone_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_zone), "__call__") as call: @@ -14398,11 +14467,6 @@ async def test_update_zone_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_zone_async_from_dict(): - await test_update_zone_async(request_type=dict) - - def test_update_zone_field_headers(): client = GDCHardwareManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14559,8 +14623,8 @@ async def test_update_zone_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DeleteZoneRequest, - dict, + service.DeleteZoneRequest(), + {}, ], ) def test_delete_zone(request_type, transport: str = "grpc"): @@ -14571,7 +14635,7 @@ def test_delete_zone(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_zone), "__call__") as call: @@ -14612,9 +14676,10 @@ def test_delete_zone_non_empty_request_with_auto_populated_field(): client.delete_zone(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteZoneRequest( + request_msg = service.DeleteZoneRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_zone_use_cached_wrapped_rpc(): @@ -14705,9 +14770,14 @@ async def test_delete_zone_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_zone_async( - transport: str = "grpc_asyncio", request_type=service.DeleteZoneRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteZoneRequest(), + {}, + ], +) +async def test_delete_zone_async(request_type, transport: str = "grpc_asyncio"): client = GDCHardwareManagementAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14715,7 +14785,7 @@ async def test_delete_zone_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_zone), "__call__") as call: @@ -14735,11 +14805,6 @@ async def test_delete_zone_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_zone_async_from_dict(): - await test_delete_zone_async(request_type=dict) - - def test_delete_zone_field_headers(): client = GDCHardwareManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14886,8 +14951,8 @@ async def test_delete_zone_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.SignalZoneStateRequest, - dict, + service.SignalZoneStateRequest(), + {}, ], ) def test_signal_zone_state(request_type, transport: str = "grpc"): @@ -14898,7 +14963,7 @@ def test_signal_zone_state(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -14945,11 +15010,12 @@ def test_signal_zone_state_non_empty_request_with_auto_populated_field(): client.signal_zone_state(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.SignalZoneStateRequest( + request_msg = service.SignalZoneStateRequest( name="name_value", step="step_value", details="details_value", ) + assert args[0] == request_msg def test_signal_zone_state_use_cached_wrapped_rpc(): @@ -15042,9 +15108,14 @@ async def test_signal_zone_state_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_signal_zone_state_async( - transport: str = "grpc_asyncio", request_type=service.SignalZoneStateRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.SignalZoneStateRequest(), + {}, + ], +) +async def test_signal_zone_state_async(request_type, transport: str = "grpc_asyncio"): client = GDCHardwareManagementAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -15052,7 +15123,7 @@ async def test_signal_zone_state_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( @@ -15074,11 +15145,6 @@ async def test_signal_zone_state_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_signal_zone_state_async_from_dict(): - await test_signal_zone_state_async(request_type=dict) - - def test_signal_zone_state_field_headers(): client = GDCHardwareManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15247,8 +15313,8 @@ async def test_signal_zone_state_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.RequestOrderDateChangeRequest, - dict, + service.RequestOrderDateChangeRequest(), + {}, ], ) def test_request_order_date_change(request_type, transport: str = "grpc"): @@ -15259,7 +15325,7 @@ def test_request_order_date_change(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -15304,9 +15370,10 @@ def test_request_order_date_change_non_empty_request_with_auto_populated_field() client.request_order_date_change(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.RequestOrderDateChangeRequest( + request_msg = service.RequestOrderDateChangeRequest( name="name_value", ) + assert args[0] == request_msg def test_request_order_date_change_use_cached_wrapped_rpc(): @@ -15402,8 +15469,15 @@ async def test_request_order_date_change_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.RequestOrderDateChangeRequest(), + {}, + ], +) async def test_request_order_date_change_async( - transport: str = "grpc_asyncio", request_type=service.RequestOrderDateChangeRequest + request_type, transport: str = "grpc_asyncio" ): client = GDCHardwareManagementAsyncClient( credentials=async_anonymous_credentials(), @@ -15412,7 +15486,7 @@ async def test_request_order_date_change_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( @@ -15434,11 +15508,6 @@ async def test_request_order_date_change_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_request_order_date_change_async_from_dict(): - await test_request_order_date_change_async(request_type=dict) - - def test_request_order_date_change_field_headers(): client = GDCHardwareManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -23221,7 +23290,6 @@ def test_list_orders_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListOrdersRequest() - assert args[0] == request_msg @@ -23242,7 +23310,6 @@ def test_get_order_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetOrderRequest() - assert args[0] == request_msg @@ -23263,7 +23330,6 @@ def test_create_order_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateOrderRequest() - assert args[0] == request_msg @@ -23284,7 +23350,6 @@ def test_update_order_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateOrderRequest() - assert args[0] == request_msg @@ -23305,7 +23370,6 @@ def test_delete_order_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteOrderRequest() - assert args[0] == request_msg @@ -23326,7 +23390,6 @@ def test_submit_order_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.SubmitOrderRequest() - assert args[0] == request_msg @@ -23347,7 +23410,6 @@ def test_cancel_order_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CancelOrderRequest() - assert args[0] == request_msg @@ -23368,7 +23430,6 @@ def test_list_sites_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListSitesRequest() - assert args[0] == request_msg @@ -23389,7 +23450,6 @@ def test_get_site_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetSiteRequest() - assert args[0] == request_msg @@ -23410,7 +23470,6 @@ def test_create_site_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateSiteRequest() - assert args[0] == request_msg @@ -23431,7 +23490,6 @@ def test_update_site_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateSiteRequest() - assert args[0] == request_msg @@ -23452,7 +23510,6 @@ def test_delete_site_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteSiteRequest() - assert args[0] == request_msg @@ -23475,7 +23532,6 @@ def test_list_hardware_groups_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListHardwareGroupsRequest() - assert args[0] == request_msg @@ -23498,7 +23554,6 @@ def test_get_hardware_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetHardwareGroupRequest() - assert args[0] == request_msg @@ -23521,7 +23576,6 @@ def test_create_hardware_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateHardwareGroupRequest() - assert args[0] == request_msg @@ -23544,7 +23598,6 @@ def test_update_hardware_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateHardwareGroupRequest() - assert args[0] == request_msg @@ -23567,7 +23620,6 @@ def test_delete_hardware_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteHardwareGroupRequest() - assert args[0] == request_msg @@ -23588,7 +23640,6 @@ def test_list_hardware_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListHardwareRequest() - assert args[0] == request_msg @@ -23609,7 +23660,6 @@ def test_get_hardware_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetHardwareRequest() - assert args[0] == request_msg @@ -23630,7 +23680,6 @@ def test_create_hardware_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateHardwareRequest() - assert args[0] == request_msg @@ -23651,7 +23700,6 @@ def test_update_hardware_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateHardwareRequest() - assert args[0] == request_msg @@ -23672,7 +23720,6 @@ def test_delete_hardware_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteHardwareRequest() - assert args[0] == request_msg @@ -23693,7 +23740,6 @@ def test_list_comments_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListCommentsRequest() - assert args[0] == request_msg @@ -23714,7 +23760,6 @@ def test_get_comment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetCommentRequest() - assert args[0] == request_msg @@ -23735,7 +23780,6 @@ def test_create_comment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateCommentRequest() - assert args[0] == request_msg @@ -23758,7 +23802,6 @@ def test_record_action_on_comment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.RecordActionOnCommentRequest() - assert args[0] == request_msg @@ -23781,7 +23824,6 @@ def test_list_change_log_entries_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListChangeLogEntriesRequest() - assert args[0] == request_msg @@ -23804,7 +23846,6 @@ def test_get_change_log_entry_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetChangeLogEntryRequest() - assert args[0] == request_msg @@ -23825,7 +23866,6 @@ def test_list_skus_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListSkusRequest() - assert args[0] == request_msg @@ -23846,7 +23886,6 @@ def test_get_sku_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetSkuRequest() - assert args[0] == request_msg @@ -23867,7 +23906,6 @@ def test_list_zones_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListZonesRequest() - assert args[0] == request_msg @@ -23888,7 +23926,6 @@ def test_get_zone_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetZoneRequest() - assert args[0] == request_msg @@ -23909,7 +23946,6 @@ def test_create_zone_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateZoneRequest() - assert args[0] == request_msg @@ -23930,7 +23966,6 @@ def test_update_zone_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateZoneRequest() - assert args[0] == request_msg @@ -23951,7 +23986,6 @@ def test_delete_zone_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteZoneRequest() - assert args[0] == request_msg @@ -23974,7 +24008,6 @@ def test_signal_zone_state_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.SignalZoneStateRequest() - assert args[0] == request_msg @@ -23997,7 +24030,6 @@ def test_request_order_date_change_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.RequestOrderDateChangeRequest() - assert args[0] == request_msg @@ -24039,7 +24071,6 @@ async def test_list_orders_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListOrdersRequest() - assert args[0] == request_msg @@ -24077,7 +24108,6 @@ async def test_get_order_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetOrderRequest() - assert args[0] == request_msg @@ -24102,7 +24132,6 @@ async def test_create_order_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateOrderRequest() - assert args[0] == request_msg @@ -24127,7 +24156,6 @@ async def test_update_order_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateOrderRequest() - assert args[0] == request_msg @@ -24152,7 +24180,6 @@ async def test_delete_order_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteOrderRequest() - assert args[0] == request_msg @@ -24177,7 +24204,6 @@ async def test_submit_order_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.SubmitOrderRequest() - assert args[0] == request_msg @@ -24202,7 +24228,6 @@ async def test_cancel_order_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CancelOrderRequest() - assert args[0] == request_msg @@ -24230,7 +24255,6 @@ async def test_list_sites_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListSitesRequest() - assert args[0] == request_msg @@ -24262,7 +24286,6 @@ async def test_get_site_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetSiteRequest() - assert args[0] == request_msg @@ -24287,7 +24310,6 @@ async def test_create_site_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateSiteRequest() - assert args[0] == request_msg @@ -24312,7 +24334,6 @@ async def test_update_site_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateSiteRequest() - assert args[0] == request_msg @@ -24337,7 +24358,6 @@ async def test_delete_site_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteSiteRequest() - assert args[0] == request_msg @@ -24367,7 +24387,6 @@ async def test_list_hardware_groups_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListHardwareGroupsRequest() - assert args[0] == request_msg @@ -24400,7 +24419,6 @@ async def test_get_hardware_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetHardwareGroupRequest() - assert args[0] == request_msg @@ -24427,7 +24445,6 @@ async def test_create_hardware_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateHardwareGroupRequest() - assert args[0] == request_msg @@ -24454,7 +24471,6 @@ async def test_update_hardware_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateHardwareGroupRequest() - assert args[0] == request_msg @@ -24481,7 +24497,6 @@ async def test_delete_hardware_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteHardwareGroupRequest() - assert args[0] == request_msg @@ -24509,7 +24524,6 @@ async def test_list_hardware_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListHardwareRequest() - assert args[0] == request_msg @@ -24543,7 +24557,6 @@ async def test_get_hardware_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetHardwareRequest() - assert args[0] == request_msg @@ -24568,7 +24581,6 @@ async def test_create_hardware_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateHardwareRequest() - assert args[0] == request_msg @@ -24593,7 +24605,6 @@ async def test_update_hardware_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateHardwareRequest() - assert args[0] == request_msg @@ -24618,7 +24629,6 @@ async def test_delete_hardware_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteHardwareRequest() - assert args[0] == request_msg @@ -24646,7 +24656,6 @@ async def test_list_comments_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListCommentsRequest() - assert args[0] == request_msg @@ -24676,7 +24685,6 @@ async def test_get_comment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetCommentRequest() - assert args[0] == request_msg @@ -24701,7 +24709,6 @@ async def test_create_comment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateCommentRequest() - assert args[0] == request_msg @@ -24733,7 +24740,6 @@ async def test_record_action_on_comment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.RecordActionOnCommentRequest() - assert args[0] == request_msg @@ -24763,7 +24769,6 @@ async def test_list_change_log_entries_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListChangeLogEntriesRequest() - assert args[0] == request_msg @@ -24793,7 +24798,6 @@ async def test_get_change_log_entry_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetChangeLogEntryRequest() - assert args[0] == request_msg @@ -24821,7 +24825,6 @@ async def test_list_skus_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListSkusRequest() - assert args[0] == request_msg @@ -24854,7 +24857,6 @@ async def test_get_sku_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetSkuRequest() - assert args[0] == request_msg @@ -24882,7 +24884,6 @@ async def test_list_zones_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListZonesRequest() - assert args[0] == request_msg @@ -24917,7 +24918,6 @@ async def test_get_zone_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetZoneRequest() - assert args[0] == request_msg @@ -24942,7 +24942,6 @@ async def test_create_zone_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateZoneRequest() - assert args[0] == request_msg @@ -24967,7 +24966,6 @@ async def test_update_zone_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateZoneRequest() - assert args[0] == request_msg @@ -24992,7 +24990,6 @@ async def test_delete_zone_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteZoneRequest() - assert args[0] == request_msg @@ -25019,7 +25016,6 @@ async def test_signal_zone_state_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.SignalZoneStateRequest() - assert args[0] == request_msg @@ -25046,7 +25042,6 @@ async def test_request_order_date_change_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.RequestOrderDateChangeRequest() - assert args[0] == request_msg @@ -31530,7 +31525,6 @@ def test_list_orders_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListOrdersRequest() - assert args[0] == request_msg @@ -31550,7 +31544,6 @@ def test_get_order_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetOrderRequest() - assert args[0] == request_msg @@ -31570,7 +31563,6 @@ def test_create_order_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateOrderRequest() - assert args[0] == request_msg @@ -31590,7 +31582,6 @@ def test_update_order_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateOrderRequest() - assert args[0] == request_msg @@ -31610,7 +31601,6 @@ def test_delete_order_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteOrderRequest() - assert args[0] == request_msg @@ -31630,7 +31620,6 @@ def test_submit_order_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.SubmitOrderRequest() - assert args[0] == request_msg @@ -31650,7 +31639,6 @@ def test_cancel_order_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CancelOrderRequest() - assert args[0] == request_msg @@ -31670,7 +31658,6 @@ def test_list_sites_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListSitesRequest() - assert args[0] == request_msg @@ -31690,7 +31677,6 @@ def test_get_site_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetSiteRequest() - assert args[0] == request_msg @@ -31710,7 +31696,6 @@ def test_create_site_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateSiteRequest() - assert args[0] == request_msg @@ -31730,7 +31715,6 @@ def test_update_site_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateSiteRequest() - assert args[0] == request_msg @@ -31750,7 +31734,6 @@ def test_delete_site_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteSiteRequest() - assert args[0] == request_msg @@ -31772,7 +31755,6 @@ def test_list_hardware_groups_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListHardwareGroupsRequest() - assert args[0] == request_msg @@ -31794,7 +31776,6 @@ def test_get_hardware_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetHardwareGroupRequest() - assert args[0] == request_msg @@ -31816,7 +31797,6 @@ def test_create_hardware_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateHardwareGroupRequest() - assert args[0] == request_msg @@ -31838,7 +31818,6 @@ def test_update_hardware_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateHardwareGroupRequest() - assert args[0] == request_msg @@ -31860,7 +31839,6 @@ def test_delete_hardware_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteHardwareGroupRequest() - assert args[0] == request_msg @@ -31880,7 +31858,6 @@ def test_list_hardware_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListHardwareRequest() - assert args[0] == request_msg @@ -31900,7 +31877,6 @@ def test_get_hardware_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetHardwareRequest() - assert args[0] == request_msg @@ -31920,7 +31896,6 @@ def test_create_hardware_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateHardwareRequest() - assert args[0] == request_msg @@ -31940,7 +31915,6 @@ def test_update_hardware_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateHardwareRequest() - assert args[0] == request_msg @@ -31960,7 +31934,6 @@ def test_delete_hardware_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteHardwareRequest() - assert args[0] == request_msg @@ -31980,7 +31953,6 @@ def test_list_comments_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListCommentsRequest() - assert args[0] == request_msg @@ -32000,7 +31972,6 @@ def test_get_comment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetCommentRequest() - assert args[0] == request_msg @@ -32020,7 +31991,6 @@ def test_create_comment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateCommentRequest() - assert args[0] == request_msg @@ -32042,7 +32012,6 @@ def test_record_action_on_comment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.RecordActionOnCommentRequest() - assert args[0] == request_msg @@ -32064,7 +32033,6 @@ def test_list_change_log_entries_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListChangeLogEntriesRequest() - assert args[0] == request_msg @@ -32086,7 +32054,6 @@ def test_get_change_log_entry_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetChangeLogEntryRequest() - assert args[0] == request_msg @@ -32106,7 +32073,6 @@ def test_list_skus_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListSkusRequest() - assert args[0] == request_msg @@ -32126,7 +32092,6 @@ def test_get_sku_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetSkuRequest() - assert args[0] == request_msg @@ -32146,7 +32111,6 @@ def test_list_zones_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListZonesRequest() - assert args[0] == request_msg @@ -32166,7 +32130,6 @@ def test_get_zone_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetZoneRequest() - assert args[0] == request_msg @@ -32186,7 +32149,6 @@ def test_create_zone_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateZoneRequest() - assert args[0] == request_msg @@ -32206,7 +32168,6 @@ def test_update_zone_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateZoneRequest() - assert args[0] == request_msg @@ -32226,7 +32187,6 @@ def test_delete_zone_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteZoneRequest() - assert args[0] == request_msg @@ -32248,7 +32208,6 @@ def test_signal_zone_state_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.SignalZoneStateRequest() - assert args[0] == request_msg @@ -32270,7 +32229,6 @@ def test_request_order_date_change_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.RequestOrderDateChangeRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-geminidataanalytics/noxfile.py b/packages/google-cloud-geminidataanalytics/noxfile.py index 93495b468f83..8e27ba9291da 100644 --- a/packages/google-cloud-geminidataanalytics/noxfile.py +++ b/packages/google-cloud-geminidataanalytics/noxfile.py @@ -47,7 +47,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-geminidataanalytics" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-geminidataanalytics/setup.py b/packages/google-cloud-geminidataanalytics/setup.py index 85095e2ee6c2..cb8dfd005a02 100644 --- a/packages/google-cloud-geminidataanalytics/setup.py +++ b/packages/google-cloud-geminidataanalytics/setup.py @@ -45,7 +45,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/google-cloud-geminidataanalytics/testing/constraints-3.10.txt b/packages/google-cloud-geminidataanalytics/testing/constraints-3.10.txt index a92801e1c8e2..b39cd54634f9 100644 --- a/packages/google-cloud-geminidataanalytics/testing/constraints-3.10.txt +++ b/packages/google-cloud-geminidataanalytics/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/google-cloud-geminidataanalytics/tests/unit/gapic/geminidataanalytics_v1/test_data_agent_service.py b/packages/google-cloud-geminidataanalytics/tests/unit/gapic/geminidataanalytics_v1/test_data_agent_service.py index 1bb3a564639f..1eb657312a46 100644 --- a/packages/google-cloud-geminidataanalytics/tests/unit/gapic/geminidataanalytics_v1/test_data_agent_service.py +++ b/packages/google-cloud-geminidataanalytics/tests/unit/gapic/geminidataanalytics_v1/test_data_agent_service.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 @@ -128,6 +129,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" @@ -1361,8 +1377,8 @@ def test_data_agent_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - data_agent_service.ListDataAgentsRequest, - dict, + data_agent_service.ListDataAgentsRequest(), + {}, ], ) def test_list_data_agents(request_type, transport: str = "grpc"): @@ -1373,7 +1389,7 @@ def test_list_data_agents(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_data_agents), "__call__") as call: @@ -1422,12 +1438,13 @@ def test_list_data_agents_non_empty_request_with_auto_populated_field(): client.list_data_agents(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_agent_service.ListDataAgentsRequest( + request_msg = data_agent_service.ListDataAgentsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_data_agents_use_cached_wrapped_rpc(): @@ -1510,10 +1527,14 @@ async def test_list_data_agents_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_data_agents_async( - transport: str = "grpc_asyncio", - request_type=data_agent_service.ListDataAgentsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + data_agent_service.ListDataAgentsRequest(), + {}, + ], +) +async def test_list_data_agents_async(request_type, transport: str = "grpc_asyncio"): client = DataAgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1521,7 +1542,7 @@ async def test_list_data_agents_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_data_agents), "__call__") as call: @@ -1546,11 +1567,6 @@ async def test_list_data_agents_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_data_agents_async_from_dict(): - await test_list_data_agents_async(request_type=dict) - - def test_list_data_agents_field_headers(): client = DataAgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1887,8 +1903,8 @@ async def test_list_data_agents_async_pages(): @pytest.mark.parametrize( "request_type", [ - data_agent_service.ListAccessibleDataAgentsRequest, - dict, + data_agent_service.ListAccessibleDataAgentsRequest(), + {}, ], ) def test_list_accessible_data_agents(request_type, transport: str = "grpc"): @@ -1899,7 +1915,7 @@ def test_list_accessible_data_agents(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1952,12 +1968,13 @@ def test_list_accessible_data_agents_non_empty_request_with_auto_populated_field client.list_accessible_data_agents(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_agent_service.ListAccessibleDataAgentsRequest( + request_msg = data_agent_service.ListAccessibleDataAgentsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_accessible_data_agents_use_cached_wrapped_rpc(): @@ -2043,9 +2060,15 @@ async def test_list_accessible_data_agents_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_agent_service.ListAccessibleDataAgentsRequest(), + {}, + ], +) async def test_list_accessible_data_agents_async( - transport: str = "grpc_asyncio", - request_type=data_agent_service.ListAccessibleDataAgentsRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataAgentServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2054,7 +2077,7 @@ async def test_list_accessible_data_agents_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( @@ -2081,11 +2104,6 @@ async def test_list_accessible_data_agents_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_accessible_data_agents_async_from_dict(): - await test_list_accessible_data_agents_async(request_type=dict) - - def test_list_accessible_data_agents_field_headers(): client = DataAgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2440,8 +2458,8 @@ async def test_list_accessible_data_agents_async_pages(): @pytest.mark.parametrize( "request_type", [ - data_agent_service.GetDataAgentRequest, - dict, + data_agent_service.GetDataAgentRequest(), + {}, ], ) def test_get_data_agent(request_type, transport: str = "grpc"): @@ -2452,7 +2470,7 @@ def test_get_data_agent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_data_agent), "__call__") as call: @@ -2502,9 +2520,10 @@ def test_get_data_agent_non_empty_request_with_auto_populated_field(): client.get_data_agent(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_agent_service.GetDataAgentRequest( + request_msg = data_agent_service.GetDataAgentRequest( name="name_value", ) + assert args[0] == request_msg def test_get_data_agent_use_cached_wrapped_rpc(): @@ -2585,9 +2604,14 @@ async def test_get_data_agent_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_data_agent_async( - transport: str = "grpc_asyncio", request_type=data_agent_service.GetDataAgentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + data_agent_service.GetDataAgentRequest(), + {}, + ], +) +async def test_get_data_agent_async(request_type, transport: str = "grpc_asyncio"): client = DataAgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2595,7 +2619,7 @@ async def test_get_data_agent_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_data_agent), "__call__") as call: @@ -2624,11 +2648,6 @@ async def test_get_data_agent_async( assert response.kms_key == "kms_key_value" -@pytest.mark.asyncio -async def test_get_data_agent_async_from_dict(): - await test_get_data_agent_async(request_type=dict) - - def test_get_data_agent_field_headers(): client = DataAgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2775,8 +2794,8 @@ async def test_get_data_agent_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_agent_service.CreateDataAgentRequest, - dict, + data_agent_service.CreateDataAgentRequest(), + {}, ], ) def test_create_data_agent(request_type, transport: str = "grpc"): @@ -2787,7 +2806,7 @@ def test_create_data_agent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2833,10 +2852,11 @@ def test_create_data_agent_non_empty_request_with_auto_populated_field(): client.create_data_agent(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_agent_service.CreateDataAgentRequest( + request_msg = data_agent_service.CreateDataAgentRequest( parent="parent_value", data_agent_id="data_agent_id_value", ) + assert args[0] == request_msg def test_create_data_agent_use_cached_wrapped_rpc(): @@ -2929,10 +2949,14 @@ async def test_create_data_agent_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_data_agent_async( - transport: str = "grpc_asyncio", - request_type=data_agent_service.CreateDataAgentRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + data_agent_service.CreateDataAgentRequest(), + {}, + ], +) +async def test_create_data_agent_async(request_type, transport: str = "grpc_asyncio"): client = DataAgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2940,7 +2964,7 @@ async def test_create_data_agent_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( @@ -2962,11 +2986,6 @@ async def test_create_data_agent_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_data_agent_async_from_dict(): - await test_create_data_agent_async(request_type=dict) - - def test_create_data_agent_field_headers(): client = DataAgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3177,8 +3196,8 @@ async def test_create_data_agent_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_agent_service.CreateDataAgentRequest, - dict, + data_agent_service.CreateDataAgentRequest(), + {}, ], ) def test_create_data_agent_sync(request_type, transport: str = "grpc"): @@ -3189,7 +3208,7 @@ def test_create_data_agent_sync(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,10 +3263,11 @@ def test_create_data_agent_sync_non_empty_request_with_auto_populated_field(): client.create_data_agent_sync(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_agent_service.CreateDataAgentRequest( + request_msg = data_agent_service.CreateDataAgentRequest( parent="parent_value", data_agent_id="data_agent_id_value", ) + assert args[0] == request_msg def test_create_data_agent_sync_use_cached_wrapped_rpc(): @@ -3333,9 +3353,15 @@ async def test_create_data_agent_sync_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_agent_service.CreateDataAgentRequest(), + {}, + ], +) async def test_create_data_agent_sync_async( - transport: str = "grpc_asyncio", - request_type=data_agent_service.CreateDataAgentRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataAgentServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3344,7 +3370,7 @@ async def test_create_data_agent_sync_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( @@ -3375,11 +3401,6 @@ async def test_create_data_agent_sync_async( assert response.kms_key == "kms_key_value" -@pytest.mark.asyncio -async def test_create_data_agent_sync_async_from_dict(): - await test_create_data_agent_sync_async(request_type=dict) - - def test_create_data_agent_sync_field_headers(): client = DataAgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3590,8 +3611,8 @@ async def test_create_data_agent_sync_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_agent_service.UpdateDataAgentRequest, - dict, + data_agent_service.UpdateDataAgentRequest(), + {}, ], ) def test_update_data_agent(request_type, transport: str = "grpc"): @@ -3602,7 +3623,7 @@ def test_update_data_agent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3645,7 +3666,8 @@ def test_update_data_agent_non_empty_request_with_auto_populated_field(): client.update_data_agent(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_agent_service.UpdateDataAgentRequest() + request_msg = data_agent_service.UpdateDataAgentRequest() + assert args[0] == request_msg def test_update_data_agent_use_cached_wrapped_rpc(): @@ -3738,10 +3760,14 @@ async def test_update_data_agent_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_data_agent_async( - transport: str = "grpc_asyncio", - request_type=data_agent_service.UpdateDataAgentRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + data_agent_service.UpdateDataAgentRequest(), + {}, + ], +) +async def test_update_data_agent_async(request_type, transport: str = "grpc_asyncio"): client = DataAgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3749,7 +3775,7 @@ async def test_update_data_agent_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( @@ -3771,11 +3797,6 @@ async def test_update_data_agent_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_data_agent_async_from_dict(): - await test_update_data_agent_async(request_type=dict) - - def test_update_data_agent_field_headers(): client = DataAgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3976,8 +3997,8 @@ async def test_update_data_agent_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_agent_service.UpdateDataAgentRequest, - dict, + data_agent_service.UpdateDataAgentRequest(), + {}, ], ) def test_update_data_agent_sync(request_type, transport: str = "grpc"): @@ -3988,7 +4009,7 @@ def test_update_data_agent_sync(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4040,7 +4061,8 @@ def test_update_data_agent_sync_non_empty_request_with_auto_populated_field(): client.update_data_agent_sync(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_agent_service.UpdateDataAgentRequest() + request_msg = data_agent_service.UpdateDataAgentRequest() + assert args[0] == request_msg def test_update_data_agent_sync_use_cached_wrapped_rpc(): @@ -4126,9 +4148,15 @@ async def test_update_data_agent_sync_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_agent_service.UpdateDataAgentRequest(), + {}, + ], +) async def test_update_data_agent_sync_async( - transport: str = "grpc_asyncio", - request_type=data_agent_service.UpdateDataAgentRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataAgentServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4137,7 +4165,7 @@ async def test_update_data_agent_sync_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( @@ -4168,11 +4196,6 @@ async def test_update_data_agent_sync_async( assert response.kms_key == "kms_key_value" -@pytest.mark.asyncio -async def test_update_data_agent_sync_async_from_dict(): - await test_update_data_agent_sync_async(request_type=dict) - - def test_update_data_agent_sync_field_headers(): client = DataAgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4373,8 +4396,8 @@ async def test_update_data_agent_sync_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_agent_service.DeleteDataAgentRequest, - dict, + data_agent_service.DeleteDataAgentRequest(), + {}, ], ) def test_delete_data_agent(request_type, transport: str = "grpc"): @@ -4385,7 +4408,7 @@ def test_delete_data_agent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4430,9 +4453,10 @@ def test_delete_data_agent_non_empty_request_with_auto_populated_field(): client.delete_data_agent(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_agent_service.DeleteDataAgentRequest( + request_msg = data_agent_service.DeleteDataAgentRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_data_agent_use_cached_wrapped_rpc(): @@ -4525,10 +4549,14 @@ async def test_delete_data_agent_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_data_agent_async( - transport: str = "grpc_asyncio", - request_type=data_agent_service.DeleteDataAgentRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + data_agent_service.DeleteDataAgentRequest(), + {}, + ], +) +async def test_delete_data_agent_async(request_type, transport: str = "grpc_asyncio"): client = DataAgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4536,7 +4564,7 @@ async def test_delete_data_agent_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( @@ -4558,11 +4586,6 @@ async def test_delete_data_agent_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_data_agent_async_from_dict(): - await test_delete_data_agent_async(request_type=dict) - - def test_delete_data_agent_field_headers(): client = DataAgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4717,8 +4740,8 @@ async def test_delete_data_agent_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_agent_service.DeleteDataAgentRequest, - dict, + data_agent_service.DeleteDataAgentRequest(), + {}, ], ) def test_delete_data_agent_sync(request_type, transport: str = "grpc"): @@ -4729,7 +4752,7 @@ def test_delete_data_agent_sync(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4774,9 +4797,10 @@ def test_delete_data_agent_sync_non_empty_request_with_auto_populated_field(): client.delete_data_agent_sync(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_agent_service.DeleteDataAgentRequest( + request_msg = data_agent_service.DeleteDataAgentRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_data_agent_sync_use_cached_wrapped_rpc(): @@ -4862,9 +4886,15 @@ async def test_delete_data_agent_sync_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_agent_service.DeleteDataAgentRequest(), + {}, + ], +) async def test_delete_data_agent_sync_async( - transport: str = "grpc_asyncio", - request_type=data_agent_service.DeleteDataAgentRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataAgentServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4873,7 +4903,7 @@ async def test_delete_data_agent_sync_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( @@ -4893,11 +4923,6 @@ async def test_delete_data_agent_sync_async( assert response is None -@pytest.mark.asyncio -async def test_delete_data_agent_sync_async_from_dict(): - await test_delete_data_agent_sync_async(request_type=dict) - - def test_delete_data_agent_sync_field_headers(): client = DataAgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5048,8 +5073,8 @@ async def test_delete_data_agent_sync_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.GetIamPolicyRequest, - dict, + iam_policy_pb2.GetIamPolicyRequest(), + {}, ], ) def test_get_iam_policy(request_type, transport: str = "grpc"): @@ -5060,7 +5085,7 @@ def test_get_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(type(client.transport.get_iam_policy), "__call__") as call: @@ -5106,9 +5131,10 @@ def test_get_iam_policy_non_empty_request_with_auto_populated_field(): client.get_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.GetIamPolicyRequest( + request_msg = iam_policy_pb2.GetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_get_iam_policy_use_cached_wrapped_rpc(): @@ -5189,9 +5215,14 @@ async def test_get_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.GetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.GetIamPolicyRequest(), + {}, + ], +) +async def test_get_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = DataAgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5199,7 +5230,7 @@ async def test_get_iam_policy_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_iam_policy), "__call__") as call: @@ -5224,11 +5255,6 @@ async def test_get_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_get_iam_policy_async_from_dict(): - await test_get_iam_policy_async(request_type=dict) - - def test_get_iam_policy_field_headers(): client = DataAgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5388,8 +5414,8 @@ async def test_get_iam_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.SetIamPolicyRequest, - dict, + iam_policy_pb2.SetIamPolicyRequest(), + {}, ], ) def test_set_iam_policy(request_type, transport: str = "grpc"): @@ -5400,7 +5426,7 @@ def test_set_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(type(client.transport.set_iam_policy), "__call__") as call: @@ -5446,9 +5472,10 @@ def test_set_iam_policy_non_empty_request_with_auto_populated_field(): client.set_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.SetIamPolicyRequest( + request_msg = iam_policy_pb2.SetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_set_iam_policy_use_cached_wrapped_rpc(): @@ -5529,9 +5556,14 @@ async def test_set_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.SetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.SetIamPolicyRequest(), + {}, + ], +) +async def test_set_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = DataAgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5539,7 +5571,7 @@ async def test_set_iam_policy_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.set_iam_policy), "__call__") as call: @@ -5564,11 +5596,6 @@ async def test_set_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_set_iam_policy_async_from_dict(): - await test_set_iam_policy_async(request_type=dict) - - def test_set_iam_policy_field_headers(): client = DataAgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8146,7 +8173,6 @@ def test_list_data_agents_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.ListDataAgentsRequest() - assert args[0] == request_msg @@ -8169,7 +8195,6 @@ def test_list_accessible_data_agents_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.ListAccessibleDataAgentsRequest() - assert args[0] == request_msg @@ -8190,7 +8215,6 @@ def test_get_data_agent_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.GetDataAgentRequest() - assert args[0] == request_msg @@ -8213,7 +8237,6 @@ def test_create_data_agent_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.CreateDataAgentRequest() - assert args[0] == request_msg @@ -8236,7 +8259,6 @@ def test_create_data_agent_sync_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.CreateDataAgentRequest() - assert args[0] == request_msg @@ -8259,7 +8281,6 @@ def test_update_data_agent_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.UpdateDataAgentRequest() - assert args[0] == request_msg @@ -8282,7 +8303,6 @@ def test_update_data_agent_sync_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.UpdateDataAgentRequest() - assert args[0] == request_msg @@ -8305,7 +8325,6 @@ def test_delete_data_agent_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.DeleteDataAgentRequest() - assert args[0] == request_msg @@ -8328,7 +8347,6 @@ def test_delete_data_agent_sync_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.DeleteDataAgentRequest() - assert args[0] == request_msg @@ -8349,7 +8367,6 @@ def test_get_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -8370,7 +8387,6 @@ def test_set_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -8412,7 +8428,6 @@ async def test_list_data_agents_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.ListDataAgentsRequest() - assert args[0] == request_msg @@ -8442,7 +8457,6 @@ async def test_list_accessible_data_agents_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.ListAccessibleDataAgentsRequest() - assert args[0] == request_msg @@ -8472,7 +8486,6 @@ async def test_get_data_agent_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.GetDataAgentRequest() - assert args[0] == request_msg @@ -8499,7 +8512,6 @@ async def test_create_data_agent_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.CreateDataAgentRequest() - assert args[0] == request_msg @@ -8531,7 +8543,6 @@ async def test_create_data_agent_sync_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.CreateDataAgentRequest() - assert args[0] == request_msg @@ -8558,7 +8569,6 @@ async def test_update_data_agent_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.UpdateDataAgentRequest() - assert args[0] == request_msg @@ -8590,7 +8600,6 @@ async def test_update_data_agent_sync_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.UpdateDataAgentRequest() - assert args[0] == request_msg @@ -8617,7 +8626,6 @@ async def test_delete_data_agent_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.DeleteDataAgentRequest() - assert args[0] == request_msg @@ -8642,7 +8650,6 @@ async def test_delete_data_agent_sync_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.DeleteDataAgentRequest() - assert args[0] == request_msg @@ -8670,7 +8677,6 @@ async def test_get_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -8698,7 +8704,6 @@ async def test_set_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -11389,7 +11394,6 @@ def test_list_data_agents_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.ListDataAgentsRequest() - assert args[0] == request_msg @@ -11411,7 +11415,6 @@ def test_list_accessible_data_agents_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.ListAccessibleDataAgentsRequest() - assert args[0] == request_msg @@ -11431,7 +11434,6 @@ def test_get_data_agent_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.GetDataAgentRequest() - assert args[0] == request_msg @@ -11453,7 +11455,6 @@ def test_create_data_agent_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.CreateDataAgentRequest() - assert args[0] == request_msg @@ -11475,7 +11476,6 @@ def test_create_data_agent_sync_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.CreateDataAgentRequest() - assert args[0] == request_msg @@ -11497,7 +11497,6 @@ def test_update_data_agent_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.UpdateDataAgentRequest() - assert args[0] == request_msg @@ -11519,7 +11518,6 @@ def test_update_data_agent_sync_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.UpdateDataAgentRequest() - assert args[0] == request_msg @@ -11541,7 +11539,6 @@ def test_delete_data_agent_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.DeleteDataAgentRequest() - assert args[0] == request_msg @@ -11563,7 +11560,6 @@ def test_delete_data_agent_sync_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.DeleteDataAgentRequest() - assert args[0] == request_msg @@ -11583,7 +11579,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -11603,7 +11598,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-geminidataanalytics/tests/unit/gapic/geminidataanalytics_v1/test_data_chat_service.py b/packages/google-cloud-geminidataanalytics/tests/unit/gapic/geminidataanalytics_v1/test_data_chat_service.py index f7dbb9d198c9..5c945de3cb04 100644 --- a/packages/google-cloud-geminidataanalytics/tests/unit/gapic/geminidataanalytics_v1/test_data_chat_service.py +++ b/packages/google-cloud-geminidataanalytics/tests/unit/gapic/geminidataanalytics_v1/test_data_chat_service.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 @@ -119,6 +120,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" @@ -1346,8 +1362,8 @@ def test_data_chat_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - data_chat_service.ChatRequest, - dict, + data_chat_service.ChatRequest(), + {}, ], ) def test_chat(request_type, transport: str = "grpc"): @@ -1358,7 +1374,7 @@ def test_chat(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.chat), "__call__") as call: @@ -1400,9 +1416,10 @@ def test_chat_non_empty_request_with_auto_populated_field(): client.chat(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_chat_service.ChatRequest( + request_msg = data_chat_service.ChatRequest( parent="parent_value", ) + assert args[0] == request_msg def test_chat_use_cached_wrapped_rpc(): @@ -1480,9 +1497,14 @@ async def test_chat_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio" @pytest.mark.asyncio -async def test_chat_async( - transport: str = "grpc_asyncio", request_type=data_chat_service.ChatRequest -): +@pytest.mark.parametrize( + "request_type", + [ + data_chat_service.ChatRequest(), + {}, + ], +) +async def test_chat_async(request_type, transport: str = "grpc_asyncio"): client = DataChatServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1490,7 +1512,7 @@ async def test_chat_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.chat), "__call__") as call: @@ -1512,11 +1534,6 @@ async def test_chat_async( assert isinstance(message, data_chat_service.Message) -@pytest.mark.asyncio -async def test_chat_async_from_dict(): - await test_chat_async(request_type=dict) - - def test_chat_field_headers(): client = DataChatServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1582,8 +1599,8 @@ async def test_chat_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - gcg_conversation.CreateConversationRequest, - dict, + gcg_conversation.CreateConversationRequest(), + {}, ], ) def test_create_conversation(request_type, transport: str = "grpc"): @@ -1594,7 +1611,7 @@ def test_create_conversation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1649,10 +1666,11 @@ def test_create_conversation_non_empty_request_with_auto_populated_field(): client.create_conversation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcg_conversation.CreateConversationRequest( + request_msg = gcg_conversation.CreateConversationRequest( parent="parent_value", conversation_id="conversation_id_value", ) + assert args[0] == request_msg def test_create_conversation_use_cached_wrapped_rpc(): @@ -1737,10 +1755,14 @@ async def test_create_conversation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_conversation_async( - transport: str = "grpc_asyncio", - request_type=gcg_conversation.CreateConversationRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + gcg_conversation.CreateConversationRequest(), + {}, + ], +) +async def test_create_conversation_async(request_type, transport: str = "grpc_asyncio"): client = DataChatServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1748,7 +1770,7 @@ async def test_create_conversation_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( @@ -1779,11 +1801,6 @@ async def test_create_conversation_async( assert response.memory_paused is True -@pytest.mark.asyncio -async def test_create_conversation_async_from_dict(): - await test_create_conversation_async(request_type=dict) - - def test_create_conversation_field_headers(): client = DataChatServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1958,8 +1975,8 @@ async def test_create_conversation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversation.DeleteConversationRequest, - dict, + conversation.DeleteConversationRequest(), + {}, ], ) def test_delete_conversation(request_type, transport: str = "grpc"): @@ -1970,7 +1987,7 @@ def test_delete_conversation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2015,9 +2032,10 @@ def test_delete_conversation_non_empty_request_with_auto_populated_field(): client.delete_conversation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversation.DeleteConversationRequest( + request_msg = conversation.DeleteConversationRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_conversation_use_cached_wrapped_rpc(): @@ -2102,9 +2120,14 @@ async def test_delete_conversation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_conversation_async( - transport: str = "grpc_asyncio", request_type=conversation.DeleteConversationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + conversation.DeleteConversationRequest(), + {}, + ], +) +async def test_delete_conversation_async(request_type, transport: str = "grpc_asyncio"): client = DataChatServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2112,7 +2135,7 @@ async def test_delete_conversation_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( @@ -2132,11 +2155,6 @@ async def test_delete_conversation_async( assert response is None -@pytest.mark.asyncio -async def test_delete_conversation_async_from_dict(): - await test_delete_conversation_async(request_type=dict) - - def test_delete_conversation_field_headers(): client = DataChatServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2287,8 +2305,8 @@ async def test_delete_conversation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversation.GetConversationRequest, - dict, + conversation.GetConversationRequest(), + {}, ], ) def test_get_conversation(request_type, transport: str = "grpc"): @@ -2299,7 +2317,7 @@ def test_get_conversation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_conversation), "__call__") as call: @@ -2349,9 +2367,10 @@ def test_get_conversation_non_empty_request_with_auto_populated_field(): client.get_conversation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversation.GetConversationRequest( + request_msg = conversation.GetConversationRequest( name="name_value", ) + assert args[0] == request_msg def test_get_conversation_use_cached_wrapped_rpc(): @@ -2434,9 +2453,14 @@ async def test_get_conversation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_conversation_async( - transport: str = "grpc_asyncio", request_type=conversation.GetConversationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + conversation.GetConversationRequest(), + {}, + ], +) +async def test_get_conversation_async(request_type, transport: str = "grpc_asyncio"): client = DataChatServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2444,7 +2468,7 @@ async def test_get_conversation_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_conversation), "__call__") as call: @@ -2473,11 +2497,6 @@ async def test_get_conversation_async( assert response.memory_paused is True -@pytest.mark.asyncio -async def test_get_conversation_async_from_dict(): - await test_get_conversation_async(request_type=dict) - - def test_get_conversation_field_headers(): client = DataChatServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2624,8 +2643,8 @@ async def test_get_conversation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversation.ListConversationsRequest, - dict, + conversation.ListConversationsRequest(), + {}, ], ) def test_list_conversations(request_type, transport: str = "grpc"): @@ -2636,7 +2655,7 @@ def test_list_conversations(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2686,11 +2705,12 @@ def test_list_conversations_non_empty_request_with_auto_populated_field(): client.list_conversations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversation.ListConversationsRequest( + request_msg = conversation.ListConversationsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_conversations_use_cached_wrapped_rpc(): @@ -2775,9 +2795,14 @@ async def test_list_conversations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_conversations_async( - transport: str = "grpc_asyncio", request_type=conversation.ListConversationsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + conversation.ListConversationsRequest(), + {}, + ], +) +async def test_list_conversations_async(request_type, transport: str = "grpc_asyncio"): client = DataChatServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2785,7 +2810,7 @@ async def test_list_conversations_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( @@ -2810,11 +2835,6 @@ async def test_list_conversations_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_conversations_async_from_dict(): - await test_list_conversations_async(request_type=dict) - - def test_list_conversations_field_headers(): client = DataChatServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3167,8 +3187,8 @@ async def test_list_conversations_async_pages(): @pytest.mark.parametrize( "request_type", [ - data_chat_service.ListMessagesRequest, - dict, + data_chat_service.ListMessagesRequest(), + {}, ], ) def test_list_messages(request_type, transport: str = "grpc"): @@ -3179,7 +3199,7 @@ def test_list_messages(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_messages), "__call__") as call: @@ -3225,11 +3245,12 @@ def test_list_messages_non_empty_request_with_auto_populated_field(): client.list_messages(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_chat_service.ListMessagesRequest( + request_msg = data_chat_service.ListMessagesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_messages_use_cached_wrapped_rpc(): @@ -3310,9 +3331,14 @@ async def test_list_messages_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_messages_async( - transport: str = "grpc_asyncio", request_type=data_chat_service.ListMessagesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + data_chat_service.ListMessagesRequest(), + {}, + ], +) +async def test_list_messages_async(request_type, transport: str = "grpc_asyncio"): client = DataChatServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3320,7 +3346,7 @@ async def test_list_messages_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_messages), "__call__") as call: @@ -3343,11 +3369,6 @@ async def test_list_messages_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_messages_async_from_dict(): - await test_list_messages_async(request_type=dict) - - def test_list_messages_field_headers(): client = DataChatServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5026,7 +5047,6 @@ def test_chat_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_chat_service.ChatRequest() - assert args[0] == request_msg @@ -5049,7 +5069,6 @@ def test_create_conversation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcg_conversation.CreateConversationRequest() - assert args[0] == request_msg @@ -5072,7 +5091,6 @@ def test_delete_conversation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation.DeleteConversationRequest() - assert args[0] == request_msg @@ -5093,7 +5111,6 @@ def test_get_conversation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation.GetConversationRequest() - assert args[0] == request_msg @@ -5116,7 +5133,6 @@ def test_list_conversations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation.ListConversationsRequest() - assert args[0] == request_msg @@ -5137,7 +5153,6 @@ def test_list_messages_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_chat_service.ListMessagesRequest() - assert args[0] == request_msg @@ -5177,7 +5192,6 @@ async def test_chat_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_chat_service.ChatRequest() - assert args[0] == request_msg @@ -5209,7 +5223,6 @@ async def test_create_conversation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcg_conversation.CreateConversationRequest() - assert args[0] == request_msg @@ -5234,7 +5247,6 @@ async def test_delete_conversation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation.DeleteConversationRequest() - assert args[0] == request_msg @@ -5264,7 +5276,6 @@ async def test_get_conversation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation.GetConversationRequest() - assert args[0] == request_msg @@ -5293,7 +5304,6 @@ async def test_list_conversations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation.ListConversationsRequest() - assert args[0] == request_msg @@ -5320,7 +5330,6 @@ async def test_list_messages_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_chat_service.ListMessagesRequest() - assert args[0] == request_msg @@ -6594,7 +6603,6 @@ def test_chat_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_chat_service.ChatRequest() - assert args[0] == request_msg @@ -6616,7 +6624,6 @@ def test_create_conversation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcg_conversation.CreateConversationRequest() - assert args[0] == request_msg @@ -6638,7 +6645,6 @@ def test_delete_conversation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation.DeleteConversationRequest() - assert args[0] == request_msg @@ -6658,7 +6664,6 @@ def test_get_conversation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation.GetConversationRequest() - assert args[0] == request_msg @@ -6680,7 +6685,6 @@ def test_list_conversations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation.ListConversationsRequest() - assert args[0] == request_msg @@ -6700,7 +6704,6 @@ def test_list_messages_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_chat_service.ListMessagesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-geminidataanalytics/tests/unit/gapic/geminidataanalytics_v1alpha/test_data_agent_service.py b/packages/google-cloud-geminidataanalytics/tests/unit/gapic/geminidataanalytics_v1alpha/test_data_agent_service.py index 4179b30d33c6..a9762f9e709b 100644 --- a/packages/google-cloud-geminidataanalytics/tests/unit/gapic/geminidataanalytics_v1alpha/test_data_agent_service.py +++ b/packages/google-cloud-geminidataanalytics/tests/unit/gapic/geminidataanalytics_v1alpha/test_data_agent_service.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 @@ -130,6 +131,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" @@ -1363,8 +1379,8 @@ def test_data_agent_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - data_agent_service.ListDataAgentsRequest, - dict, + data_agent_service.ListDataAgentsRequest(), + {}, ], ) def test_list_data_agents(request_type, transport: str = "grpc"): @@ -1375,7 +1391,7 @@ def test_list_data_agents(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_data_agents), "__call__") as call: @@ -1424,12 +1440,13 @@ def test_list_data_agents_non_empty_request_with_auto_populated_field(): client.list_data_agents(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_agent_service.ListDataAgentsRequest( + request_msg = data_agent_service.ListDataAgentsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_data_agents_use_cached_wrapped_rpc(): @@ -1512,10 +1529,14 @@ async def test_list_data_agents_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_data_agents_async( - transport: str = "grpc_asyncio", - request_type=data_agent_service.ListDataAgentsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + data_agent_service.ListDataAgentsRequest(), + {}, + ], +) +async def test_list_data_agents_async(request_type, transport: str = "grpc_asyncio"): client = DataAgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1523,7 +1544,7 @@ async def test_list_data_agents_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_data_agents), "__call__") as call: @@ -1548,11 +1569,6 @@ async def test_list_data_agents_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_data_agents_async_from_dict(): - await test_list_data_agents_async(request_type=dict) - - def test_list_data_agents_field_headers(): client = DataAgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1889,8 +1905,8 @@ async def test_list_data_agents_async_pages(): @pytest.mark.parametrize( "request_type", [ - data_agent_service.ListAccessibleDataAgentsRequest, - dict, + data_agent_service.ListAccessibleDataAgentsRequest(), + {}, ], ) def test_list_accessible_data_agents(request_type, transport: str = "grpc"): @@ -1901,7 +1917,7 @@ def test_list_accessible_data_agents(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1954,12 +1970,13 @@ def test_list_accessible_data_agents_non_empty_request_with_auto_populated_field client.list_accessible_data_agents(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_agent_service.ListAccessibleDataAgentsRequest( + request_msg = data_agent_service.ListAccessibleDataAgentsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_accessible_data_agents_use_cached_wrapped_rpc(): @@ -2045,9 +2062,15 @@ async def test_list_accessible_data_agents_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_agent_service.ListAccessibleDataAgentsRequest(), + {}, + ], +) async def test_list_accessible_data_agents_async( - transport: str = "grpc_asyncio", - request_type=data_agent_service.ListAccessibleDataAgentsRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataAgentServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2056,7 +2079,7 @@ async def test_list_accessible_data_agents_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( @@ -2083,11 +2106,6 @@ async def test_list_accessible_data_agents_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_accessible_data_agents_async_from_dict(): - await test_list_accessible_data_agents_async(request_type=dict) - - def test_list_accessible_data_agents_field_headers(): client = DataAgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2442,8 +2460,8 @@ async def test_list_accessible_data_agents_async_pages(): @pytest.mark.parametrize( "request_type", [ - data_agent_service.GetDataAgentRequest, - dict, + data_agent_service.GetDataAgentRequest(), + {}, ], ) def test_get_data_agent(request_type, transport: str = "grpc"): @@ -2454,7 +2472,7 @@ def test_get_data_agent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_data_agent), "__call__") as call: @@ -2502,9 +2520,10 @@ def test_get_data_agent_non_empty_request_with_auto_populated_field(): client.get_data_agent(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_agent_service.GetDataAgentRequest( + request_msg = data_agent_service.GetDataAgentRequest( name="name_value", ) + assert args[0] == request_msg def test_get_data_agent_use_cached_wrapped_rpc(): @@ -2585,9 +2604,14 @@ async def test_get_data_agent_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_data_agent_async( - transport: str = "grpc_asyncio", request_type=data_agent_service.GetDataAgentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + data_agent_service.GetDataAgentRequest(), + {}, + ], +) +async def test_get_data_agent_async(request_type, transport: str = "grpc_asyncio"): client = DataAgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2595,7 +2619,7 @@ async def test_get_data_agent_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_data_agent), "__call__") as call: @@ -2622,11 +2646,6 @@ async def test_get_data_agent_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_get_data_agent_async_from_dict(): - await test_get_data_agent_async(request_type=dict) - - def test_get_data_agent_field_headers(): client = DataAgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2773,8 +2792,8 @@ async def test_get_data_agent_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_agent_service.CreateDataAgentRequest, - dict, + data_agent_service.CreateDataAgentRequest(), + {}, ], ) def test_create_data_agent(request_type, transport: str = "grpc"): @@ -2785,7 +2804,7 @@ def test_create_data_agent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2831,10 +2850,11 @@ def test_create_data_agent_non_empty_request_with_auto_populated_field(): client.create_data_agent(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_agent_service.CreateDataAgentRequest( + request_msg = data_agent_service.CreateDataAgentRequest( parent="parent_value", data_agent_id="data_agent_id_value", ) + assert args[0] == request_msg def test_create_data_agent_use_cached_wrapped_rpc(): @@ -2927,10 +2947,14 @@ async def test_create_data_agent_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_data_agent_async( - transport: str = "grpc_asyncio", - request_type=data_agent_service.CreateDataAgentRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + data_agent_service.CreateDataAgentRequest(), + {}, + ], +) +async def test_create_data_agent_async(request_type, transport: str = "grpc_asyncio"): client = DataAgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2938,7 +2962,7 @@ async def test_create_data_agent_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( @@ -2960,11 +2984,6 @@ async def test_create_data_agent_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_data_agent_async_from_dict(): - await test_create_data_agent_async(request_type=dict) - - def test_create_data_agent_field_headers(): client = DataAgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3175,8 +3194,8 @@ async def test_create_data_agent_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_agent_service.CreateDataAgentRequest, - dict, + data_agent_service.CreateDataAgentRequest(), + {}, ], ) def test_create_data_agent_sync(request_type, transport: str = "grpc"): @@ -3187,7 +3206,7 @@ def test_create_data_agent_sync(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3240,10 +3259,11 @@ def test_create_data_agent_sync_non_empty_request_with_auto_populated_field(): client.create_data_agent_sync(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_agent_service.CreateDataAgentRequest( + request_msg = data_agent_service.CreateDataAgentRequest( parent="parent_value", data_agent_id="data_agent_id_value", ) + assert args[0] == request_msg def test_create_data_agent_sync_use_cached_wrapped_rpc(): @@ -3329,9 +3349,15 @@ async def test_create_data_agent_sync_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_agent_service.CreateDataAgentRequest(), + {}, + ], +) async def test_create_data_agent_sync_async( - transport: str = "grpc_asyncio", - request_type=data_agent_service.CreateDataAgentRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataAgentServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3340,7 +3366,7 @@ async def test_create_data_agent_sync_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( @@ -3369,11 +3395,6 @@ async def test_create_data_agent_sync_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_create_data_agent_sync_async_from_dict(): - await test_create_data_agent_sync_async(request_type=dict) - - def test_create_data_agent_sync_field_headers(): client = DataAgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3584,8 +3605,8 @@ async def test_create_data_agent_sync_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_agent_service.UpdateDataAgentRequest, - dict, + data_agent_service.UpdateDataAgentRequest(), + {}, ], ) def test_update_data_agent(request_type, transport: str = "grpc"): @@ -3596,7 +3617,7 @@ def test_update_data_agent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3639,7 +3660,8 @@ def test_update_data_agent_non_empty_request_with_auto_populated_field(): client.update_data_agent(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_agent_service.UpdateDataAgentRequest() + request_msg = data_agent_service.UpdateDataAgentRequest() + assert args[0] == request_msg def test_update_data_agent_use_cached_wrapped_rpc(): @@ -3732,10 +3754,14 @@ async def test_update_data_agent_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_data_agent_async( - transport: str = "grpc_asyncio", - request_type=data_agent_service.UpdateDataAgentRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + data_agent_service.UpdateDataAgentRequest(), + {}, + ], +) +async def test_update_data_agent_async(request_type, transport: str = "grpc_asyncio"): client = DataAgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3743,7 +3769,7 @@ async def test_update_data_agent_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( @@ -3765,11 +3791,6 @@ async def test_update_data_agent_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_data_agent_async_from_dict(): - await test_update_data_agent_async(request_type=dict) - - def test_update_data_agent_field_headers(): client = DataAgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3970,8 +3991,8 @@ async def test_update_data_agent_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_agent_service.UpdateDataAgentRequest, - dict, + data_agent_service.UpdateDataAgentRequest(), + {}, ], ) def test_update_data_agent_sync(request_type, transport: str = "grpc"): @@ -3982,7 +4003,7 @@ def test_update_data_agent_sync(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4032,7 +4053,8 @@ def test_update_data_agent_sync_non_empty_request_with_auto_populated_field(): client.update_data_agent_sync(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_agent_service.UpdateDataAgentRequest() + request_msg = data_agent_service.UpdateDataAgentRequest() + assert args[0] == request_msg def test_update_data_agent_sync_use_cached_wrapped_rpc(): @@ -4118,9 +4140,15 @@ async def test_update_data_agent_sync_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_agent_service.UpdateDataAgentRequest(), + {}, + ], +) async def test_update_data_agent_sync_async( - transport: str = "grpc_asyncio", - request_type=data_agent_service.UpdateDataAgentRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataAgentServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4129,7 +4157,7 @@ async def test_update_data_agent_sync_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( @@ -4158,11 +4186,6 @@ async def test_update_data_agent_sync_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_update_data_agent_sync_async_from_dict(): - await test_update_data_agent_sync_async(request_type=dict) - - def test_update_data_agent_sync_field_headers(): client = DataAgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4363,8 +4386,8 @@ async def test_update_data_agent_sync_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_agent_service.DeleteDataAgentRequest, - dict, + data_agent_service.DeleteDataAgentRequest(), + {}, ], ) def test_delete_data_agent(request_type, transport: str = "grpc"): @@ -4375,7 +4398,7 @@ def test_delete_data_agent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4420,9 +4443,10 @@ def test_delete_data_agent_non_empty_request_with_auto_populated_field(): client.delete_data_agent(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_agent_service.DeleteDataAgentRequest( + request_msg = data_agent_service.DeleteDataAgentRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_data_agent_use_cached_wrapped_rpc(): @@ -4515,10 +4539,14 @@ async def test_delete_data_agent_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_data_agent_async( - transport: str = "grpc_asyncio", - request_type=data_agent_service.DeleteDataAgentRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + data_agent_service.DeleteDataAgentRequest(), + {}, + ], +) +async def test_delete_data_agent_async(request_type, transport: str = "grpc_asyncio"): client = DataAgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4526,7 +4554,7 @@ async def test_delete_data_agent_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( @@ -4548,11 +4576,6 @@ async def test_delete_data_agent_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_data_agent_async_from_dict(): - await test_delete_data_agent_async(request_type=dict) - - def test_delete_data_agent_field_headers(): client = DataAgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4707,8 +4730,8 @@ async def test_delete_data_agent_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_agent_service.DeleteDataAgentRequest, - dict, + data_agent_service.DeleteDataAgentRequest(), + {}, ], ) def test_delete_data_agent_sync(request_type, transport: str = "grpc"): @@ -4719,7 +4742,7 @@ def test_delete_data_agent_sync(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4764,9 +4787,10 @@ def test_delete_data_agent_sync_non_empty_request_with_auto_populated_field(): client.delete_data_agent_sync(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_agent_service.DeleteDataAgentRequest( + request_msg = data_agent_service.DeleteDataAgentRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_data_agent_sync_use_cached_wrapped_rpc(): @@ -4852,9 +4876,15 @@ async def test_delete_data_agent_sync_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_agent_service.DeleteDataAgentRequest(), + {}, + ], +) async def test_delete_data_agent_sync_async( - transport: str = "grpc_asyncio", - request_type=data_agent_service.DeleteDataAgentRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataAgentServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4863,7 +4893,7 @@ async def test_delete_data_agent_sync_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( @@ -4883,11 +4913,6 @@ async def test_delete_data_agent_sync_async( assert response is None -@pytest.mark.asyncio -async def test_delete_data_agent_sync_async_from_dict(): - await test_delete_data_agent_sync_async(request_type=dict) - - def test_delete_data_agent_sync_field_headers(): client = DataAgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5038,8 +5063,8 @@ async def test_delete_data_agent_sync_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.GetIamPolicyRequest, - dict, + iam_policy_pb2.GetIamPolicyRequest(), + {}, ], ) def test_get_iam_policy(request_type, transport: str = "grpc"): @@ -5050,7 +5075,7 @@ def test_get_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(type(client.transport.get_iam_policy), "__call__") as call: @@ -5096,9 +5121,10 @@ def test_get_iam_policy_non_empty_request_with_auto_populated_field(): client.get_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.GetIamPolicyRequest( + request_msg = iam_policy_pb2.GetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_get_iam_policy_use_cached_wrapped_rpc(): @@ -5179,9 +5205,14 @@ async def test_get_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.GetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.GetIamPolicyRequest(), + {}, + ], +) +async def test_get_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = DataAgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5189,7 +5220,7 @@ async def test_get_iam_policy_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_iam_policy), "__call__") as call: @@ -5214,11 +5245,6 @@ async def test_get_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_get_iam_policy_async_from_dict(): - await test_get_iam_policy_async(request_type=dict) - - def test_get_iam_policy_field_headers(): client = DataAgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5378,8 +5404,8 @@ async def test_get_iam_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.SetIamPolicyRequest, - dict, + iam_policy_pb2.SetIamPolicyRequest(), + {}, ], ) def test_set_iam_policy(request_type, transport: str = "grpc"): @@ -5390,7 +5416,7 @@ def test_set_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(type(client.transport.set_iam_policy), "__call__") as call: @@ -5436,9 +5462,10 @@ def test_set_iam_policy_non_empty_request_with_auto_populated_field(): client.set_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.SetIamPolicyRequest( + request_msg = iam_policy_pb2.SetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_set_iam_policy_use_cached_wrapped_rpc(): @@ -5519,9 +5546,14 @@ async def test_set_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.SetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.SetIamPolicyRequest(), + {}, + ], +) +async def test_set_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = DataAgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5529,7 +5561,7 @@ async def test_set_iam_policy_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.set_iam_policy), "__call__") as call: @@ -5554,11 +5586,6 @@ async def test_set_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_set_iam_policy_async_from_dict(): - await test_set_iam_policy_async(request_type=dict) - - def test_set_iam_policy_field_headers(): client = DataAgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8140,7 +8167,6 @@ def test_list_data_agents_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.ListDataAgentsRequest() - assert args[0] == request_msg @@ -8163,7 +8189,6 @@ def test_list_accessible_data_agents_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.ListAccessibleDataAgentsRequest() - assert args[0] == request_msg @@ -8184,7 +8209,6 @@ def test_get_data_agent_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.GetDataAgentRequest() - assert args[0] == request_msg @@ -8207,7 +8231,6 @@ def test_create_data_agent_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.CreateDataAgentRequest() - assert args[0] == request_msg @@ -8230,7 +8253,6 @@ def test_create_data_agent_sync_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.CreateDataAgentRequest() - assert args[0] == request_msg @@ -8253,7 +8275,6 @@ def test_update_data_agent_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.UpdateDataAgentRequest() - assert args[0] == request_msg @@ -8276,7 +8297,6 @@ def test_update_data_agent_sync_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.UpdateDataAgentRequest() - assert args[0] == request_msg @@ -8299,7 +8319,6 @@ def test_delete_data_agent_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.DeleteDataAgentRequest() - assert args[0] == request_msg @@ -8322,7 +8341,6 @@ def test_delete_data_agent_sync_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.DeleteDataAgentRequest() - assert args[0] == request_msg @@ -8343,7 +8361,6 @@ def test_get_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -8364,7 +8381,6 @@ def test_set_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -8406,7 +8422,6 @@ async def test_list_data_agents_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.ListDataAgentsRequest() - assert args[0] == request_msg @@ -8436,7 +8451,6 @@ async def test_list_accessible_data_agents_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.ListAccessibleDataAgentsRequest() - assert args[0] == request_msg @@ -8465,7 +8479,6 @@ async def test_get_data_agent_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.GetDataAgentRequest() - assert args[0] == request_msg @@ -8492,7 +8505,6 @@ async def test_create_data_agent_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.CreateDataAgentRequest() - assert args[0] == request_msg @@ -8523,7 +8535,6 @@ async def test_create_data_agent_sync_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.CreateDataAgentRequest() - assert args[0] == request_msg @@ -8550,7 +8561,6 @@ async def test_update_data_agent_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.UpdateDataAgentRequest() - assert args[0] == request_msg @@ -8581,7 +8591,6 @@ async def test_update_data_agent_sync_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.UpdateDataAgentRequest() - assert args[0] == request_msg @@ -8608,7 +8617,6 @@ async def test_delete_data_agent_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.DeleteDataAgentRequest() - assert args[0] == request_msg @@ -8633,7 +8641,6 @@ async def test_delete_data_agent_sync_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.DeleteDataAgentRequest() - assert args[0] == request_msg @@ -8661,7 +8668,6 @@ async def test_get_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -8689,7 +8695,6 @@ async def test_set_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -11466,7 +11471,6 @@ def test_list_data_agents_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.ListDataAgentsRequest() - assert args[0] == request_msg @@ -11488,7 +11492,6 @@ def test_list_accessible_data_agents_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.ListAccessibleDataAgentsRequest() - assert args[0] == request_msg @@ -11508,7 +11511,6 @@ def test_get_data_agent_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.GetDataAgentRequest() - assert args[0] == request_msg @@ -11530,7 +11532,6 @@ def test_create_data_agent_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.CreateDataAgentRequest() - assert args[0] == request_msg @@ -11552,7 +11553,6 @@ def test_create_data_agent_sync_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.CreateDataAgentRequest() - assert args[0] == request_msg @@ -11574,7 +11574,6 @@ def test_update_data_agent_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.UpdateDataAgentRequest() - assert args[0] == request_msg @@ -11596,7 +11595,6 @@ def test_update_data_agent_sync_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.UpdateDataAgentRequest() - assert args[0] == request_msg @@ -11618,7 +11616,6 @@ def test_delete_data_agent_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.DeleteDataAgentRequest() - assert args[0] == request_msg @@ -11640,7 +11637,6 @@ def test_delete_data_agent_sync_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.DeleteDataAgentRequest() - assert args[0] == request_msg @@ -11660,7 +11656,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -11680,7 +11675,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-geminidataanalytics/tests/unit/gapic/geminidataanalytics_v1alpha/test_data_chat_service.py b/packages/google-cloud-geminidataanalytics/tests/unit/gapic/geminidataanalytics_v1alpha/test_data_chat_service.py index b19a34843a35..d27f5a14a4cb 100644 --- a/packages/google-cloud-geminidataanalytics/tests/unit/gapic/geminidataanalytics_v1alpha/test_data_chat_service.py +++ b/packages/google-cloud-geminidataanalytics/tests/unit/gapic/geminidataanalytics_v1alpha/test_data_chat_service.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 @@ -122,6 +123,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" @@ -1349,8 +1365,8 @@ def test_data_chat_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - data_chat_service.ChatRequest, - dict, + data_chat_service.ChatRequest(), + {}, ], ) def test_chat(request_type, transport: str = "grpc"): @@ -1361,7 +1377,7 @@ def test_chat(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.chat), "__call__") as call: @@ -1404,10 +1420,11 @@ def test_chat_non_empty_request_with_auto_populated_field(): client.chat(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_chat_service.ChatRequest( + request_msg = data_chat_service.ChatRequest( project="project_value", parent="parent_value", ) + assert args[0] == request_msg def test_chat_use_cached_wrapped_rpc(): @@ -1485,9 +1502,14 @@ async def test_chat_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio" @pytest.mark.asyncio -async def test_chat_async( - transport: str = "grpc_asyncio", request_type=data_chat_service.ChatRequest -): +@pytest.mark.parametrize( + "request_type", + [ + data_chat_service.ChatRequest(), + {}, + ], +) +async def test_chat_async(request_type, transport: str = "grpc_asyncio"): client = DataChatServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1495,7 +1517,7 @@ async def test_chat_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.chat), "__call__") as call: @@ -1517,11 +1539,6 @@ async def test_chat_async( assert isinstance(message, data_chat_service.Message) -@pytest.mark.asyncio -async def test_chat_async_from_dict(): - await test_chat_async(request_type=dict) - - def test_chat_field_headers(): client = DataChatServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1587,8 +1604,8 @@ async def test_chat_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - gcg_conversation.CreateConversationRequest, - dict, + gcg_conversation.CreateConversationRequest(), + {}, ], ) def test_create_conversation(request_type, transport: str = "grpc"): @@ -1599,7 +1616,7 @@ def test_create_conversation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1650,10 +1667,11 @@ def test_create_conversation_non_empty_request_with_auto_populated_field(): client.create_conversation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcg_conversation.CreateConversationRequest( + request_msg = gcg_conversation.CreateConversationRequest( parent="parent_value", conversation_id="conversation_id_value", ) + assert args[0] == request_msg def test_create_conversation_use_cached_wrapped_rpc(): @@ -1738,10 +1756,14 @@ async def test_create_conversation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_conversation_async( - transport: str = "grpc_asyncio", - request_type=gcg_conversation.CreateConversationRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + gcg_conversation.CreateConversationRequest(), + {}, + ], +) +async def test_create_conversation_async(request_type, transport: str = "grpc_asyncio"): client = DataChatServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1749,7 +1771,7 @@ async def test_create_conversation_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( @@ -1776,11 +1798,6 @@ async def test_create_conversation_async( assert response.agents == ["agents_value"] -@pytest.mark.asyncio -async def test_create_conversation_async_from_dict(): - await test_create_conversation_async(request_type=dict) - - def test_create_conversation_field_headers(): client = DataChatServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1955,8 +1972,8 @@ async def test_create_conversation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversation.DeleteConversationRequest, - dict, + conversation.DeleteConversationRequest(), + {}, ], ) def test_delete_conversation(request_type, transport: str = "grpc"): @@ -1967,7 +1984,7 @@ def test_delete_conversation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2012,9 +2029,10 @@ def test_delete_conversation_non_empty_request_with_auto_populated_field(): client.delete_conversation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversation.DeleteConversationRequest( + request_msg = conversation.DeleteConversationRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_conversation_use_cached_wrapped_rpc(): @@ -2099,9 +2117,14 @@ async def test_delete_conversation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_conversation_async( - transport: str = "grpc_asyncio", request_type=conversation.DeleteConversationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + conversation.DeleteConversationRequest(), + {}, + ], +) +async def test_delete_conversation_async(request_type, transport: str = "grpc_asyncio"): client = DataChatServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2109,7 +2132,7 @@ async def test_delete_conversation_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( @@ -2129,11 +2152,6 @@ async def test_delete_conversation_async( assert response is None -@pytest.mark.asyncio -async def test_delete_conversation_async_from_dict(): - await test_delete_conversation_async(request_type=dict) - - def test_delete_conversation_field_headers(): client = DataChatServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2284,8 +2302,8 @@ async def test_delete_conversation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversation.GetConversationRequest, - dict, + conversation.GetConversationRequest(), + {}, ], ) def test_get_conversation(request_type, transport: str = "grpc"): @@ -2296,7 +2314,7 @@ def test_get_conversation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_conversation), "__call__") as call: @@ -2342,9 +2360,10 @@ def test_get_conversation_non_empty_request_with_auto_populated_field(): client.get_conversation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversation.GetConversationRequest( + request_msg = conversation.GetConversationRequest( name="name_value", ) + assert args[0] == request_msg def test_get_conversation_use_cached_wrapped_rpc(): @@ -2427,9 +2446,14 @@ async def test_get_conversation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_conversation_async( - transport: str = "grpc_asyncio", request_type=conversation.GetConversationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + conversation.GetConversationRequest(), + {}, + ], +) +async def test_get_conversation_async(request_type, transport: str = "grpc_asyncio"): client = DataChatServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2437,7 +2461,7 @@ async def test_get_conversation_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_conversation), "__call__") as call: @@ -2462,11 +2486,6 @@ async def test_get_conversation_async( assert response.agents == ["agents_value"] -@pytest.mark.asyncio -async def test_get_conversation_async_from_dict(): - await test_get_conversation_async(request_type=dict) - - def test_get_conversation_field_headers(): client = DataChatServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2613,8 +2632,8 @@ async def test_get_conversation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversation.ListConversationsRequest, - dict, + conversation.ListConversationsRequest(), + {}, ], ) def test_list_conversations(request_type, transport: str = "grpc"): @@ -2625,7 +2644,7 @@ def test_list_conversations(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2675,11 +2694,12 @@ def test_list_conversations_non_empty_request_with_auto_populated_field(): client.list_conversations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversation.ListConversationsRequest( + request_msg = conversation.ListConversationsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_conversations_use_cached_wrapped_rpc(): @@ -2764,9 +2784,14 @@ async def test_list_conversations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_conversations_async( - transport: str = "grpc_asyncio", request_type=conversation.ListConversationsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + conversation.ListConversationsRequest(), + {}, + ], +) +async def test_list_conversations_async(request_type, transport: str = "grpc_asyncio"): client = DataChatServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2774,7 +2799,7 @@ async def test_list_conversations_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( @@ -2799,11 +2824,6 @@ async def test_list_conversations_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_conversations_async_from_dict(): - await test_list_conversations_async(request_type=dict) - - def test_list_conversations_field_headers(): client = DataChatServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3156,8 +3176,8 @@ async def test_list_conversations_async_pages(): @pytest.mark.parametrize( "request_type", [ - data_chat_service.ListMessagesRequest, - dict, + data_chat_service.ListMessagesRequest(), + {}, ], ) def test_list_messages(request_type, transport: str = "grpc"): @@ -3168,7 +3188,7 @@ def test_list_messages(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_messages), "__call__") as call: @@ -3214,11 +3234,12 @@ def test_list_messages_non_empty_request_with_auto_populated_field(): client.list_messages(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_chat_service.ListMessagesRequest( + request_msg = data_chat_service.ListMessagesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_messages_use_cached_wrapped_rpc(): @@ -3299,9 +3320,14 @@ async def test_list_messages_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_messages_async( - transport: str = "grpc_asyncio", request_type=data_chat_service.ListMessagesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + data_chat_service.ListMessagesRequest(), + {}, + ], +) +async def test_list_messages_async(request_type, transport: str = "grpc_asyncio"): client = DataChatServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3309,7 +3335,7 @@ async def test_list_messages_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_messages), "__call__") as call: @@ -3332,11 +3358,6 @@ async def test_list_messages_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_messages_async_from_dict(): - await test_list_messages_async(request_type=dict) - - def test_list_messages_field_headers(): client = DataChatServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3673,8 +3694,8 @@ async def test_list_messages_async_pages(): @pytest.mark.parametrize( "request_type", [ - data_chat_service.QueryDataRequest, - dict, + data_chat_service.QueryDataRequest(), + {}, ], ) def test_query_data(request_type, transport: str = "grpc"): @@ -3685,7 +3706,7 @@ def test_query_data(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.query_data), "__call__") as call: @@ -3736,10 +3757,11 @@ def test_query_data_non_empty_request_with_auto_populated_field(): client.query_data(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_chat_service.QueryDataRequest( + request_msg = data_chat_service.QueryDataRequest( parent="parent_value", prompt="prompt_value", ) + assert args[0] == request_msg def test_query_data_use_cached_wrapped_rpc(): @@ -3818,9 +3840,14 @@ async def test_query_data_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_query_data_async( - transport: str = "grpc_asyncio", request_type=data_chat_service.QueryDataRequest -): +@pytest.mark.parametrize( + "request_type", + [ + data_chat_service.QueryDataRequest(), + {}, + ], +) +async def test_query_data_async(request_type, transport: str = "grpc_asyncio"): client = DataChatServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3828,7 +3855,7 @@ async def test_query_data_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.query_data), "__call__") as call: @@ -3857,11 +3884,6 @@ async def test_query_data_async( assert response.disambiguation_question == ["disambiguation_question_value"] -@pytest.mark.asyncio -async def test_query_data_async_from_dict(): - await test_query_data_async(request_type=dict) - - def test_query_data_field_headers(): client = DataChatServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5402,7 +5424,6 @@ def test_chat_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_chat_service.ChatRequest() - assert args[0] == request_msg @@ -5425,7 +5446,6 @@ def test_create_conversation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcg_conversation.CreateConversationRequest() - assert args[0] == request_msg @@ -5448,7 +5468,6 @@ def test_delete_conversation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation.DeleteConversationRequest() - assert args[0] == request_msg @@ -5469,7 +5488,6 @@ def test_get_conversation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation.GetConversationRequest() - assert args[0] == request_msg @@ -5492,7 +5510,6 @@ def test_list_conversations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation.ListConversationsRequest() - assert args[0] == request_msg @@ -5513,7 +5530,6 @@ def test_list_messages_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_chat_service.ListMessagesRequest() - assert args[0] == request_msg @@ -5534,7 +5550,6 @@ def test_query_data_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_chat_service.QueryDataRequest() - assert args[0] == request_msg @@ -5574,7 +5589,6 @@ async def test_chat_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_chat_service.ChatRequest() - assert args[0] == request_msg @@ -5604,7 +5618,6 @@ async def test_create_conversation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcg_conversation.CreateConversationRequest() - assert args[0] == request_msg @@ -5629,7 +5642,6 @@ async def test_delete_conversation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation.DeleteConversationRequest() - assert args[0] == request_msg @@ -5657,7 +5669,6 @@ async def test_get_conversation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation.GetConversationRequest() - assert args[0] == request_msg @@ -5686,7 +5697,6 @@ async def test_list_conversations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation.ListConversationsRequest() - assert args[0] == request_msg @@ -5713,7 +5723,6 @@ async def test_list_messages_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_chat_service.ListMessagesRequest() - assert args[0] == request_msg @@ -5743,7 +5752,6 @@ async def test_query_data_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_chat_service.QueryDataRequest() - assert args[0] == request_msg @@ -7146,7 +7154,6 @@ def test_chat_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_chat_service.ChatRequest() - assert args[0] == request_msg @@ -7168,7 +7175,6 @@ def test_create_conversation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcg_conversation.CreateConversationRequest() - assert args[0] == request_msg @@ -7190,7 +7196,6 @@ def test_delete_conversation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation.DeleteConversationRequest() - assert args[0] == request_msg @@ -7210,7 +7215,6 @@ def test_get_conversation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation.GetConversationRequest() - assert args[0] == request_msg @@ -7232,7 +7236,6 @@ def test_list_conversations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation.ListConversationsRequest() - assert args[0] == request_msg @@ -7252,7 +7255,6 @@ def test_list_messages_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_chat_service.ListMessagesRequest() - assert args[0] == request_msg @@ -7272,7 +7274,6 @@ def test_query_data_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_chat_service.QueryDataRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-geminidataanalytics/tests/unit/gapic/geminidataanalytics_v1beta/test_data_agent_service.py b/packages/google-cloud-geminidataanalytics/tests/unit/gapic/geminidataanalytics_v1beta/test_data_agent_service.py index d8ce7fc92cc5..c7b48b76e446 100644 --- a/packages/google-cloud-geminidataanalytics/tests/unit/gapic/geminidataanalytics_v1beta/test_data_agent_service.py +++ b/packages/google-cloud-geminidataanalytics/tests/unit/gapic/geminidataanalytics_v1beta/test_data_agent_service.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 @@ -130,6 +131,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" @@ -1363,8 +1379,8 @@ def test_data_agent_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - data_agent_service.ListDataAgentsRequest, - dict, + data_agent_service.ListDataAgentsRequest(), + {}, ], ) def test_list_data_agents(request_type, transport: str = "grpc"): @@ -1375,7 +1391,7 @@ def test_list_data_agents(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_data_agents), "__call__") as call: @@ -1424,12 +1440,13 @@ def test_list_data_agents_non_empty_request_with_auto_populated_field(): client.list_data_agents(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_agent_service.ListDataAgentsRequest( + request_msg = data_agent_service.ListDataAgentsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_data_agents_use_cached_wrapped_rpc(): @@ -1512,10 +1529,14 @@ async def test_list_data_agents_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_data_agents_async( - transport: str = "grpc_asyncio", - request_type=data_agent_service.ListDataAgentsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + data_agent_service.ListDataAgentsRequest(), + {}, + ], +) +async def test_list_data_agents_async(request_type, transport: str = "grpc_asyncio"): client = DataAgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1523,7 +1544,7 @@ async def test_list_data_agents_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_data_agents), "__call__") as call: @@ -1548,11 +1569,6 @@ async def test_list_data_agents_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_data_agents_async_from_dict(): - await test_list_data_agents_async(request_type=dict) - - def test_list_data_agents_field_headers(): client = DataAgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1889,8 +1905,8 @@ async def test_list_data_agents_async_pages(): @pytest.mark.parametrize( "request_type", [ - data_agent_service.ListAccessibleDataAgentsRequest, - dict, + data_agent_service.ListAccessibleDataAgentsRequest(), + {}, ], ) def test_list_accessible_data_agents(request_type, transport: str = "grpc"): @@ -1901,7 +1917,7 @@ def test_list_accessible_data_agents(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1954,12 +1970,13 @@ def test_list_accessible_data_agents_non_empty_request_with_auto_populated_field client.list_accessible_data_agents(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_agent_service.ListAccessibleDataAgentsRequest( + request_msg = data_agent_service.ListAccessibleDataAgentsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_accessible_data_agents_use_cached_wrapped_rpc(): @@ -2045,9 +2062,15 @@ async def test_list_accessible_data_agents_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_agent_service.ListAccessibleDataAgentsRequest(), + {}, + ], +) async def test_list_accessible_data_agents_async( - transport: str = "grpc_asyncio", - request_type=data_agent_service.ListAccessibleDataAgentsRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataAgentServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2056,7 +2079,7 @@ async def test_list_accessible_data_agents_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( @@ -2083,11 +2106,6 @@ async def test_list_accessible_data_agents_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_accessible_data_agents_async_from_dict(): - await test_list_accessible_data_agents_async(request_type=dict) - - def test_list_accessible_data_agents_field_headers(): client = DataAgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2442,8 +2460,8 @@ async def test_list_accessible_data_agents_async_pages(): @pytest.mark.parametrize( "request_type", [ - data_agent_service.GetDataAgentRequest, - dict, + data_agent_service.GetDataAgentRequest(), + {}, ], ) def test_get_data_agent(request_type, transport: str = "grpc"): @@ -2454,7 +2472,7 @@ def test_get_data_agent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_data_agent), "__call__") as call: @@ -2502,9 +2520,10 @@ def test_get_data_agent_non_empty_request_with_auto_populated_field(): client.get_data_agent(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_agent_service.GetDataAgentRequest( + request_msg = data_agent_service.GetDataAgentRequest( name="name_value", ) + assert args[0] == request_msg def test_get_data_agent_use_cached_wrapped_rpc(): @@ -2585,9 +2604,14 @@ async def test_get_data_agent_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_data_agent_async( - transport: str = "grpc_asyncio", request_type=data_agent_service.GetDataAgentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + data_agent_service.GetDataAgentRequest(), + {}, + ], +) +async def test_get_data_agent_async(request_type, transport: str = "grpc_asyncio"): client = DataAgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2595,7 +2619,7 @@ async def test_get_data_agent_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_data_agent), "__call__") as call: @@ -2622,11 +2646,6 @@ async def test_get_data_agent_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_get_data_agent_async_from_dict(): - await test_get_data_agent_async(request_type=dict) - - def test_get_data_agent_field_headers(): client = DataAgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2773,8 +2792,8 @@ async def test_get_data_agent_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_agent_service.CreateDataAgentRequest, - dict, + data_agent_service.CreateDataAgentRequest(), + {}, ], ) def test_create_data_agent(request_type, transport: str = "grpc"): @@ -2785,7 +2804,7 @@ def test_create_data_agent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2831,10 +2850,11 @@ def test_create_data_agent_non_empty_request_with_auto_populated_field(): client.create_data_agent(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_agent_service.CreateDataAgentRequest( + request_msg = data_agent_service.CreateDataAgentRequest( parent="parent_value", data_agent_id="data_agent_id_value", ) + assert args[0] == request_msg def test_create_data_agent_use_cached_wrapped_rpc(): @@ -2927,10 +2947,14 @@ async def test_create_data_agent_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_data_agent_async( - transport: str = "grpc_asyncio", - request_type=data_agent_service.CreateDataAgentRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + data_agent_service.CreateDataAgentRequest(), + {}, + ], +) +async def test_create_data_agent_async(request_type, transport: str = "grpc_asyncio"): client = DataAgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2938,7 +2962,7 @@ async def test_create_data_agent_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( @@ -2960,11 +2984,6 @@ async def test_create_data_agent_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_data_agent_async_from_dict(): - await test_create_data_agent_async(request_type=dict) - - def test_create_data_agent_field_headers(): client = DataAgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3175,8 +3194,8 @@ async def test_create_data_agent_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_agent_service.CreateDataAgentRequest, - dict, + data_agent_service.CreateDataAgentRequest(), + {}, ], ) def test_create_data_agent_sync(request_type, transport: str = "grpc"): @@ -3187,7 +3206,7 @@ def test_create_data_agent_sync(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3240,10 +3259,11 @@ def test_create_data_agent_sync_non_empty_request_with_auto_populated_field(): client.create_data_agent_sync(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_agent_service.CreateDataAgentRequest( + request_msg = data_agent_service.CreateDataAgentRequest( parent="parent_value", data_agent_id="data_agent_id_value", ) + assert args[0] == request_msg def test_create_data_agent_sync_use_cached_wrapped_rpc(): @@ -3329,9 +3349,15 @@ async def test_create_data_agent_sync_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_agent_service.CreateDataAgentRequest(), + {}, + ], +) async def test_create_data_agent_sync_async( - transport: str = "grpc_asyncio", - request_type=data_agent_service.CreateDataAgentRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataAgentServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3340,7 +3366,7 @@ async def test_create_data_agent_sync_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( @@ -3369,11 +3395,6 @@ async def test_create_data_agent_sync_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_create_data_agent_sync_async_from_dict(): - await test_create_data_agent_sync_async(request_type=dict) - - def test_create_data_agent_sync_field_headers(): client = DataAgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3584,8 +3605,8 @@ async def test_create_data_agent_sync_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_agent_service.UpdateDataAgentRequest, - dict, + data_agent_service.UpdateDataAgentRequest(), + {}, ], ) def test_update_data_agent(request_type, transport: str = "grpc"): @@ -3596,7 +3617,7 @@ def test_update_data_agent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3639,7 +3660,8 @@ def test_update_data_agent_non_empty_request_with_auto_populated_field(): client.update_data_agent(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_agent_service.UpdateDataAgentRequest() + request_msg = data_agent_service.UpdateDataAgentRequest() + assert args[0] == request_msg def test_update_data_agent_use_cached_wrapped_rpc(): @@ -3732,10 +3754,14 @@ async def test_update_data_agent_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_data_agent_async( - transport: str = "grpc_asyncio", - request_type=data_agent_service.UpdateDataAgentRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + data_agent_service.UpdateDataAgentRequest(), + {}, + ], +) +async def test_update_data_agent_async(request_type, transport: str = "grpc_asyncio"): client = DataAgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3743,7 +3769,7 @@ async def test_update_data_agent_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( @@ -3765,11 +3791,6 @@ async def test_update_data_agent_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_data_agent_async_from_dict(): - await test_update_data_agent_async(request_type=dict) - - def test_update_data_agent_field_headers(): client = DataAgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3970,8 +3991,8 @@ async def test_update_data_agent_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_agent_service.UpdateDataAgentRequest, - dict, + data_agent_service.UpdateDataAgentRequest(), + {}, ], ) def test_update_data_agent_sync(request_type, transport: str = "grpc"): @@ -3982,7 +4003,7 @@ def test_update_data_agent_sync(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4032,7 +4053,8 @@ def test_update_data_agent_sync_non_empty_request_with_auto_populated_field(): client.update_data_agent_sync(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_agent_service.UpdateDataAgentRequest() + request_msg = data_agent_service.UpdateDataAgentRequest() + assert args[0] == request_msg def test_update_data_agent_sync_use_cached_wrapped_rpc(): @@ -4118,9 +4140,15 @@ async def test_update_data_agent_sync_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_agent_service.UpdateDataAgentRequest(), + {}, + ], +) async def test_update_data_agent_sync_async( - transport: str = "grpc_asyncio", - request_type=data_agent_service.UpdateDataAgentRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataAgentServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4129,7 +4157,7 @@ async def test_update_data_agent_sync_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( @@ -4158,11 +4186,6 @@ async def test_update_data_agent_sync_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_update_data_agent_sync_async_from_dict(): - await test_update_data_agent_sync_async(request_type=dict) - - def test_update_data_agent_sync_field_headers(): client = DataAgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4363,8 +4386,8 @@ async def test_update_data_agent_sync_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_agent_service.DeleteDataAgentRequest, - dict, + data_agent_service.DeleteDataAgentRequest(), + {}, ], ) def test_delete_data_agent(request_type, transport: str = "grpc"): @@ -4375,7 +4398,7 @@ def test_delete_data_agent(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4420,9 +4443,10 @@ def test_delete_data_agent_non_empty_request_with_auto_populated_field(): client.delete_data_agent(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_agent_service.DeleteDataAgentRequest( + request_msg = data_agent_service.DeleteDataAgentRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_data_agent_use_cached_wrapped_rpc(): @@ -4515,10 +4539,14 @@ async def test_delete_data_agent_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_data_agent_async( - transport: str = "grpc_asyncio", - request_type=data_agent_service.DeleteDataAgentRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + data_agent_service.DeleteDataAgentRequest(), + {}, + ], +) +async def test_delete_data_agent_async(request_type, transport: str = "grpc_asyncio"): client = DataAgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4526,7 +4554,7 @@ async def test_delete_data_agent_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( @@ -4548,11 +4576,6 @@ async def test_delete_data_agent_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_data_agent_async_from_dict(): - await test_delete_data_agent_async(request_type=dict) - - def test_delete_data_agent_field_headers(): client = DataAgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4707,8 +4730,8 @@ async def test_delete_data_agent_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_agent_service.DeleteDataAgentRequest, - dict, + data_agent_service.DeleteDataAgentRequest(), + {}, ], ) def test_delete_data_agent_sync(request_type, transport: str = "grpc"): @@ -4719,7 +4742,7 @@ def test_delete_data_agent_sync(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4764,9 +4787,10 @@ def test_delete_data_agent_sync_non_empty_request_with_auto_populated_field(): client.delete_data_agent_sync(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_agent_service.DeleteDataAgentRequest( + request_msg = data_agent_service.DeleteDataAgentRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_data_agent_sync_use_cached_wrapped_rpc(): @@ -4852,9 +4876,15 @@ async def test_delete_data_agent_sync_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_agent_service.DeleteDataAgentRequest(), + {}, + ], +) async def test_delete_data_agent_sync_async( - transport: str = "grpc_asyncio", - request_type=data_agent_service.DeleteDataAgentRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataAgentServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4863,7 +4893,7 @@ async def test_delete_data_agent_sync_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( @@ -4883,11 +4913,6 @@ async def test_delete_data_agent_sync_async( assert response is None -@pytest.mark.asyncio -async def test_delete_data_agent_sync_async_from_dict(): - await test_delete_data_agent_sync_async(request_type=dict) - - def test_delete_data_agent_sync_field_headers(): client = DataAgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5038,8 +5063,8 @@ async def test_delete_data_agent_sync_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.GetIamPolicyRequest, - dict, + iam_policy_pb2.GetIamPolicyRequest(), + {}, ], ) def test_get_iam_policy(request_type, transport: str = "grpc"): @@ -5050,7 +5075,7 @@ def test_get_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(type(client.transport.get_iam_policy), "__call__") as call: @@ -5096,9 +5121,10 @@ def test_get_iam_policy_non_empty_request_with_auto_populated_field(): client.get_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.GetIamPolicyRequest( + request_msg = iam_policy_pb2.GetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_get_iam_policy_use_cached_wrapped_rpc(): @@ -5179,9 +5205,14 @@ async def test_get_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.GetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.GetIamPolicyRequest(), + {}, + ], +) +async def test_get_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = DataAgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5189,7 +5220,7 @@ async def test_get_iam_policy_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_iam_policy), "__call__") as call: @@ -5214,11 +5245,6 @@ async def test_get_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_get_iam_policy_async_from_dict(): - await test_get_iam_policy_async(request_type=dict) - - def test_get_iam_policy_field_headers(): client = DataAgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5378,8 +5404,8 @@ async def test_get_iam_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.SetIamPolicyRequest, - dict, + iam_policy_pb2.SetIamPolicyRequest(), + {}, ], ) def test_set_iam_policy(request_type, transport: str = "grpc"): @@ -5390,7 +5416,7 @@ def test_set_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(type(client.transport.set_iam_policy), "__call__") as call: @@ -5436,9 +5462,10 @@ def test_set_iam_policy_non_empty_request_with_auto_populated_field(): client.set_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.SetIamPolicyRequest( + request_msg = iam_policy_pb2.SetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_set_iam_policy_use_cached_wrapped_rpc(): @@ -5519,9 +5546,14 @@ async def test_set_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.SetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.SetIamPolicyRequest(), + {}, + ], +) +async def test_set_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = DataAgentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5529,7 +5561,7 @@ async def test_set_iam_policy_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.set_iam_policy), "__call__") as call: @@ -5554,11 +5586,6 @@ async def test_set_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_set_iam_policy_async_from_dict(): - await test_set_iam_policy_async(request_type=dict) - - def test_set_iam_policy_field_headers(): client = DataAgentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8140,7 +8167,6 @@ def test_list_data_agents_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.ListDataAgentsRequest() - assert args[0] == request_msg @@ -8163,7 +8189,6 @@ def test_list_accessible_data_agents_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.ListAccessibleDataAgentsRequest() - assert args[0] == request_msg @@ -8184,7 +8209,6 @@ def test_get_data_agent_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.GetDataAgentRequest() - assert args[0] == request_msg @@ -8207,7 +8231,6 @@ def test_create_data_agent_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.CreateDataAgentRequest() - assert args[0] == request_msg @@ -8230,7 +8253,6 @@ def test_create_data_agent_sync_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.CreateDataAgentRequest() - assert args[0] == request_msg @@ -8253,7 +8275,6 @@ def test_update_data_agent_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.UpdateDataAgentRequest() - assert args[0] == request_msg @@ -8276,7 +8297,6 @@ def test_update_data_agent_sync_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.UpdateDataAgentRequest() - assert args[0] == request_msg @@ -8299,7 +8319,6 @@ def test_delete_data_agent_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.DeleteDataAgentRequest() - assert args[0] == request_msg @@ -8322,7 +8341,6 @@ def test_delete_data_agent_sync_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.DeleteDataAgentRequest() - assert args[0] == request_msg @@ -8343,7 +8361,6 @@ def test_get_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -8364,7 +8381,6 @@ def test_set_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -8406,7 +8422,6 @@ async def test_list_data_agents_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.ListDataAgentsRequest() - assert args[0] == request_msg @@ -8436,7 +8451,6 @@ async def test_list_accessible_data_agents_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.ListAccessibleDataAgentsRequest() - assert args[0] == request_msg @@ -8465,7 +8479,6 @@ async def test_get_data_agent_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.GetDataAgentRequest() - assert args[0] == request_msg @@ -8492,7 +8505,6 @@ async def test_create_data_agent_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.CreateDataAgentRequest() - assert args[0] == request_msg @@ -8523,7 +8535,6 @@ async def test_create_data_agent_sync_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.CreateDataAgentRequest() - assert args[0] == request_msg @@ -8550,7 +8561,6 @@ async def test_update_data_agent_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.UpdateDataAgentRequest() - assert args[0] == request_msg @@ -8581,7 +8591,6 @@ async def test_update_data_agent_sync_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.UpdateDataAgentRequest() - assert args[0] == request_msg @@ -8608,7 +8617,6 @@ async def test_delete_data_agent_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.DeleteDataAgentRequest() - assert args[0] == request_msg @@ -8633,7 +8641,6 @@ async def test_delete_data_agent_sync_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.DeleteDataAgentRequest() - assert args[0] == request_msg @@ -8661,7 +8668,6 @@ async def test_get_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -8689,7 +8695,6 @@ async def test_set_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -11466,7 +11471,6 @@ def test_list_data_agents_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.ListDataAgentsRequest() - assert args[0] == request_msg @@ -11488,7 +11492,6 @@ def test_list_accessible_data_agents_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.ListAccessibleDataAgentsRequest() - assert args[0] == request_msg @@ -11508,7 +11511,6 @@ def test_get_data_agent_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.GetDataAgentRequest() - assert args[0] == request_msg @@ -11530,7 +11532,6 @@ def test_create_data_agent_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.CreateDataAgentRequest() - assert args[0] == request_msg @@ -11552,7 +11553,6 @@ def test_create_data_agent_sync_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.CreateDataAgentRequest() - assert args[0] == request_msg @@ -11574,7 +11574,6 @@ def test_update_data_agent_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.UpdateDataAgentRequest() - assert args[0] == request_msg @@ -11596,7 +11595,6 @@ def test_update_data_agent_sync_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.UpdateDataAgentRequest() - assert args[0] == request_msg @@ -11618,7 +11616,6 @@ def test_delete_data_agent_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.DeleteDataAgentRequest() - assert args[0] == request_msg @@ -11640,7 +11637,6 @@ def test_delete_data_agent_sync_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_agent_service.DeleteDataAgentRequest() - assert args[0] == request_msg @@ -11660,7 +11656,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -11680,7 +11675,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-geminidataanalytics/tests/unit/gapic/geminidataanalytics_v1beta/test_data_chat_service.py b/packages/google-cloud-geminidataanalytics/tests/unit/gapic/geminidataanalytics_v1beta/test_data_chat_service.py index 6fc1bca36297..6348deebdc71 100644 --- a/packages/google-cloud-geminidataanalytics/tests/unit/gapic/geminidataanalytics_v1beta/test_data_chat_service.py +++ b/packages/google-cloud-geminidataanalytics/tests/unit/gapic/geminidataanalytics_v1beta/test_data_chat_service.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 @@ -122,6 +123,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" @@ -1349,8 +1365,8 @@ def test_data_chat_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - data_chat_service.ChatRequest, - dict, + data_chat_service.ChatRequest(), + {}, ], ) def test_chat(request_type, transport: str = "grpc"): @@ -1361,7 +1377,7 @@ def test_chat(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.chat), "__call__") as call: @@ -1404,10 +1420,11 @@ def test_chat_non_empty_request_with_auto_populated_field(): client.chat(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_chat_service.ChatRequest( + request_msg = data_chat_service.ChatRequest( project="project_value", parent="parent_value", ) + assert args[0] == request_msg def test_chat_use_cached_wrapped_rpc(): @@ -1485,9 +1502,14 @@ async def test_chat_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio" @pytest.mark.asyncio -async def test_chat_async( - transport: str = "grpc_asyncio", request_type=data_chat_service.ChatRequest -): +@pytest.mark.parametrize( + "request_type", + [ + data_chat_service.ChatRequest(), + {}, + ], +) +async def test_chat_async(request_type, transport: str = "grpc_asyncio"): client = DataChatServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1495,7 +1517,7 @@ async def test_chat_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.chat), "__call__") as call: @@ -1517,11 +1539,6 @@ async def test_chat_async( assert isinstance(message, data_chat_service.Message) -@pytest.mark.asyncio -async def test_chat_async_from_dict(): - await test_chat_async(request_type=dict) - - def test_chat_field_headers(): client = DataChatServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1587,8 +1604,8 @@ async def test_chat_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - gcg_conversation.CreateConversationRequest, - dict, + gcg_conversation.CreateConversationRequest(), + {}, ], ) def test_create_conversation(request_type, transport: str = "grpc"): @@ -1599,7 +1616,7 @@ def test_create_conversation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1650,10 +1667,11 @@ def test_create_conversation_non_empty_request_with_auto_populated_field(): client.create_conversation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcg_conversation.CreateConversationRequest( + request_msg = gcg_conversation.CreateConversationRequest( parent="parent_value", conversation_id="conversation_id_value", ) + assert args[0] == request_msg def test_create_conversation_use_cached_wrapped_rpc(): @@ -1738,10 +1756,14 @@ async def test_create_conversation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_conversation_async( - transport: str = "grpc_asyncio", - request_type=gcg_conversation.CreateConversationRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + gcg_conversation.CreateConversationRequest(), + {}, + ], +) +async def test_create_conversation_async(request_type, transport: str = "grpc_asyncio"): client = DataChatServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1749,7 +1771,7 @@ async def test_create_conversation_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( @@ -1776,11 +1798,6 @@ async def test_create_conversation_async( assert response.agents == ["agents_value"] -@pytest.mark.asyncio -async def test_create_conversation_async_from_dict(): - await test_create_conversation_async(request_type=dict) - - def test_create_conversation_field_headers(): client = DataChatServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1955,8 +1972,8 @@ async def test_create_conversation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversation.DeleteConversationRequest, - dict, + conversation.DeleteConversationRequest(), + {}, ], ) def test_delete_conversation(request_type, transport: str = "grpc"): @@ -1967,7 +1984,7 @@ def test_delete_conversation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2012,9 +2029,10 @@ def test_delete_conversation_non_empty_request_with_auto_populated_field(): client.delete_conversation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversation.DeleteConversationRequest( + request_msg = conversation.DeleteConversationRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_conversation_use_cached_wrapped_rpc(): @@ -2099,9 +2117,14 @@ async def test_delete_conversation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_conversation_async( - transport: str = "grpc_asyncio", request_type=conversation.DeleteConversationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + conversation.DeleteConversationRequest(), + {}, + ], +) +async def test_delete_conversation_async(request_type, transport: str = "grpc_asyncio"): client = DataChatServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2109,7 +2132,7 @@ async def test_delete_conversation_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( @@ -2129,11 +2152,6 @@ async def test_delete_conversation_async( assert response is None -@pytest.mark.asyncio -async def test_delete_conversation_async_from_dict(): - await test_delete_conversation_async(request_type=dict) - - def test_delete_conversation_field_headers(): client = DataChatServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2284,8 +2302,8 @@ async def test_delete_conversation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversation.GetConversationRequest, - dict, + conversation.GetConversationRequest(), + {}, ], ) def test_get_conversation(request_type, transport: str = "grpc"): @@ -2296,7 +2314,7 @@ def test_get_conversation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_conversation), "__call__") as call: @@ -2342,9 +2360,10 @@ def test_get_conversation_non_empty_request_with_auto_populated_field(): client.get_conversation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversation.GetConversationRequest( + request_msg = conversation.GetConversationRequest( name="name_value", ) + assert args[0] == request_msg def test_get_conversation_use_cached_wrapped_rpc(): @@ -2427,9 +2446,14 @@ async def test_get_conversation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_conversation_async( - transport: str = "grpc_asyncio", request_type=conversation.GetConversationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + conversation.GetConversationRequest(), + {}, + ], +) +async def test_get_conversation_async(request_type, transport: str = "grpc_asyncio"): client = DataChatServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2437,7 +2461,7 @@ async def test_get_conversation_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_conversation), "__call__") as call: @@ -2462,11 +2486,6 @@ async def test_get_conversation_async( assert response.agents == ["agents_value"] -@pytest.mark.asyncio -async def test_get_conversation_async_from_dict(): - await test_get_conversation_async(request_type=dict) - - def test_get_conversation_field_headers(): client = DataChatServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2613,8 +2632,8 @@ async def test_get_conversation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversation.ListConversationsRequest, - dict, + conversation.ListConversationsRequest(), + {}, ], ) def test_list_conversations(request_type, transport: str = "grpc"): @@ -2625,7 +2644,7 @@ def test_list_conversations(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2675,11 +2694,12 @@ def test_list_conversations_non_empty_request_with_auto_populated_field(): client.list_conversations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversation.ListConversationsRequest( + request_msg = conversation.ListConversationsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_conversations_use_cached_wrapped_rpc(): @@ -2764,9 +2784,14 @@ async def test_list_conversations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_conversations_async( - transport: str = "grpc_asyncio", request_type=conversation.ListConversationsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + conversation.ListConversationsRequest(), + {}, + ], +) +async def test_list_conversations_async(request_type, transport: str = "grpc_asyncio"): client = DataChatServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2774,7 +2799,7 @@ async def test_list_conversations_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( @@ -2799,11 +2824,6 @@ async def test_list_conversations_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_conversations_async_from_dict(): - await test_list_conversations_async(request_type=dict) - - def test_list_conversations_field_headers(): client = DataChatServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3156,8 +3176,8 @@ async def test_list_conversations_async_pages(): @pytest.mark.parametrize( "request_type", [ - data_chat_service.ListMessagesRequest, - dict, + data_chat_service.ListMessagesRequest(), + {}, ], ) def test_list_messages(request_type, transport: str = "grpc"): @@ -3168,7 +3188,7 @@ def test_list_messages(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_messages), "__call__") as call: @@ -3214,11 +3234,12 @@ def test_list_messages_non_empty_request_with_auto_populated_field(): client.list_messages(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_chat_service.ListMessagesRequest( + request_msg = data_chat_service.ListMessagesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_messages_use_cached_wrapped_rpc(): @@ -3299,9 +3320,14 @@ async def test_list_messages_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_messages_async( - transport: str = "grpc_asyncio", request_type=data_chat_service.ListMessagesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + data_chat_service.ListMessagesRequest(), + {}, + ], +) +async def test_list_messages_async(request_type, transport: str = "grpc_asyncio"): client = DataChatServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3309,7 +3335,7 @@ async def test_list_messages_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_messages), "__call__") as call: @@ -3332,11 +3358,6 @@ async def test_list_messages_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_messages_async_from_dict(): - await test_list_messages_async(request_type=dict) - - def test_list_messages_field_headers(): client = DataChatServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3673,8 +3694,8 @@ async def test_list_messages_async_pages(): @pytest.mark.parametrize( "request_type", [ - data_chat_service.QueryDataRequest, - dict, + data_chat_service.QueryDataRequest(), + {}, ], ) def test_query_data(request_type, transport: str = "grpc"): @@ -3685,7 +3706,7 @@ def test_query_data(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.query_data), "__call__") as call: @@ -3736,10 +3757,11 @@ def test_query_data_non_empty_request_with_auto_populated_field(): client.query_data(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_chat_service.QueryDataRequest( + request_msg = data_chat_service.QueryDataRequest( parent="parent_value", prompt="prompt_value", ) + assert args[0] == request_msg def test_query_data_use_cached_wrapped_rpc(): @@ -3818,9 +3840,14 @@ async def test_query_data_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_query_data_async( - transport: str = "grpc_asyncio", request_type=data_chat_service.QueryDataRequest -): +@pytest.mark.parametrize( + "request_type", + [ + data_chat_service.QueryDataRequest(), + {}, + ], +) +async def test_query_data_async(request_type, transport: str = "grpc_asyncio"): client = DataChatServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3828,7 +3855,7 @@ async def test_query_data_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.query_data), "__call__") as call: @@ -3857,11 +3884,6 @@ async def test_query_data_async( assert response.disambiguation_question == ["disambiguation_question_value"] -@pytest.mark.asyncio -async def test_query_data_async_from_dict(): - await test_query_data_async(request_type=dict) - - def test_query_data_field_headers(): client = DataChatServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5402,7 +5424,6 @@ def test_chat_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_chat_service.ChatRequest() - assert args[0] == request_msg @@ -5425,7 +5446,6 @@ def test_create_conversation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcg_conversation.CreateConversationRequest() - assert args[0] == request_msg @@ -5448,7 +5468,6 @@ def test_delete_conversation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation.DeleteConversationRequest() - assert args[0] == request_msg @@ -5469,7 +5488,6 @@ def test_get_conversation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation.GetConversationRequest() - assert args[0] == request_msg @@ -5492,7 +5510,6 @@ def test_list_conversations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation.ListConversationsRequest() - assert args[0] == request_msg @@ -5513,7 +5530,6 @@ def test_list_messages_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_chat_service.ListMessagesRequest() - assert args[0] == request_msg @@ -5534,7 +5550,6 @@ def test_query_data_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_chat_service.QueryDataRequest() - assert args[0] == request_msg @@ -5574,7 +5589,6 @@ async def test_chat_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_chat_service.ChatRequest() - assert args[0] == request_msg @@ -5604,7 +5618,6 @@ async def test_create_conversation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcg_conversation.CreateConversationRequest() - assert args[0] == request_msg @@ -5629,7 +5642,6 @@ async def test_delete_conversation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation.DeleteConversationRequest() - assert args[0] == request_msg @@ -5657,7 +5669,6 @@ async def test_get_conversation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation.GetConversationRequest() - assert args[0] == request_msg @@ -5686,7 +5697,6 @@ async def test_list_conversations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation.ListConversationsRequest() - assert args[0] == request_msg @@ -5713,7 +5723,6 @@ async def test_list_messages_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_chat_service.ListMessagesRequest() - assert args[0] == request_msg @@ -5743,7 +5752,6 @@ async def test_query_data_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_chat_service.QueryDataRequest() - assert args[0] == request_msg @@ -7146,7 +7154,6 @@ def test_chat_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_chat_service.ChatRequest() - assert args[0] == request_msg @@ -7168,7 +7175,6 @@ def test_create_conversation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcg_conversation.CreateConversationRequest() - assert args[0] == request_msg @@ -7190,7 +7196,6 @@ def test_delete_conversation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation.DeleteConversationRequest() - assert args[0] == request_msg @@ -7210,7 +7215,6 @@ def test_get_conversation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation.GetConversationRequest() - assert args[0] == request_msg @@ -7232,7 +7236,6 @@ def test_list_conversations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversation.ListConversationsRequest() - assert args[0] == request_msg @@ -7252,7 +7255,6 @@ def test_list_messages_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_chat_service.ListMessagesRequest() - assert args[0] == request_msg @@ -7272,7 +7274,6 @@ def test_query_data_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_chat_service.QueryDataRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-gke-backup/noxfile.py b/packages/google-cloud-gke-backup/noxfile.py index b0d7725585b1..56fab5920e83 100644 --- a/packages/google-cloud-gke-backup/noxfile.py +++ b/packages/google-cloud-gke-backup/noxfile.py @@ -47,7 +47,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-gke-backup" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-gke-backup/setup.py b/packages/google-cloud-gke-backup/setup.py index cc1f14eb620d..7257d38c1fc7 100644 --- a/packages/google-cloud-gke-backup/setup.py +++ b/packages/google-cloud-gke-backup/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/google-cloud-gke-backup/testing/constraints-3.10.txt b/packages/google-cloud-gke-backup/testing/constraints-3.10.txt index a92801e1c8e2..b39cd54634f9 100644 --- a/packages/google-cloud-gke-backup/testing/constraints-3.10.txt +++ b/packages/google-cloud-gke-backup/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/google-cloud-gke-backup/tests/unit/gapic/gke_backup_v1/test_backup_for_gke.py b/packages/google-cloud-gke-backup/tests/unit/gapic/gke_backup_v1/test_backup_for_gke.py index fadf05084847..bad7302f6fc8 100644 --- a/packages/google-cloud-gke-backup/tests/unit/gapic/gke_backup_v1/test_backup_for_gke.py +++ b/packages/google-cloud-gke-backup/tests/unit/gapic/gke_backup_v1/test_backup_for_gke.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 @@ -143,6 +144,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" @@ -1323,8 +1339,8 @@ def test_backup_for_gke_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - gkebackup.CreateBackupPlanRequest, - dict, + gkebackup.CreateBackupPlanRequest(), + {}, ], ) def test_create_backup_plan(request_type, transport: str = "grpc"): @@ -1335,7 +1351,7 @@ def test_create_backup_plan(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1381,10 +1397,11 @@ def test_create_backup_plan_non_empty_request_with_auto_populated_field(): client.create_backup_plan(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gkebackup.CreateBackupPlanRequest( + request_msg = gkebackup.CreateBackupPlanRequest( parent="parent_value", backup_plan_id="backup_plan_id_value", ) + assert args[0] == request_msg def test_create_backup_plan_use_cached_wrapped_rpc(): @@ -1479,9 +1496,14 @@ async def test_create_backup_plan_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_backup_plan_async( - transport: str = "grpc_asyncio", request_type=gkebackup.CreateBackupPlanRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gkebackup.CreateBackupPlanRequest(), + {}, + ], +) +async def test_create_backup_plan_async(request_type, transport: str = "grpc_asyncio"): client = BackupForGKEAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1489,7 +1511,7 @@ async def test_create_backup_plan_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( @@ -1511,11 +1533,6 @@ async def test_create_backup_plan_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_backup_plan_async_from_dict(): - await test_create_backup_plan_async(request_type=dict) - - def test_create_backup_plan_field_headers(): client = BackupForGKEClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1690,8 +1707,8 @@ async def test_create_backup_plan_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gkebackup.ListBackupPlansRequest, - dict, + gkebackup.ListBackupPlansRequest(), + {}, ], ) def test_list_backup_plans(request_type, transport: str = "grpc"): @@ -1702,7 +1719,7 @@ def test_list_backup_plans(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1755,12 +1772,13 @@ def test_list_backup_plans_non_empty_request_with_auto_populated_field(): client.list_backup_plans(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gkebackup.ListBackupPlansRequest( + request_msg = gkebackup.ListBackupPlansRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_backup_plans_use_cached_wrapped_rpc(): @@ -1843,9 +1861,14 @@ async def test_list_backup_plans_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_backup_plans_async( - transport: str = "grpc_asyncio", request_type=gkebackup.ListBackupPlansRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gkebackup.ListBackupPlansRequest(), + {}, + ], +) +async def test_list_backup_plans_async(request_type, transport: str = "grpc_asyncio"): client = BackupForGKEAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1853,7 +1876,7 @@ async def test_list_backup_plans_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( @@ -1880,11 +1903,6 @@ async def test_list_backup_plans_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_backup_plans_async_from_dict(): - await test_list_backup_plans_async(request_type=dict) - - def test_list_backup_plans_field_headers(): client = BackupForGKEClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2237,8 +2255,8 @@ async def test_list_backup_plans_async_pages(): @pytest.mark.parametrize( "request_type", [ - gkebackup.GetBackupPlanRequest, - dict, + gkebackup.GetBackupPlanRequest(), + {}, ], ) def test_get_backup_plan(request_type, transport: str = "grpc"): @@ -2249,7 +2267,7 @@ def test_get_backup_plan(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_backup_plan), "__call__") as call: @@ -2315,9 +2333,10 @@ def test_get_backup_plan_non_empty_request_with_auto_populated_field(): client.get_backup_plan(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gkebackup.GetBackupPlanRequest( + request_msg = gkebackup.GetBackupPlanRequest( name="name_value", ) + assert args[0] == request_msg def test_get_backup_plan_use_cached_wrapped_rpc(): @@ -2398,9 +2417,14 @@ async def test_get_backup_plan_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_backup_plan_async( - transport: str = "grpc_asyncio", request_type=gkebackup.GetBackupPlanRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gkebackup.GetBackupPlanRequest(), + {}, + ], +) +async def test_get_backup_plan_async(request_type, transport: str = "grpc_asyncio"): client = BackupForGKEAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2408,7 +2432,7 @@ async def test_get_backup_plan_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_backup_plan), "__call__") as call: @@ -2453,11 +2477,6 @@ async def test_get_backup_plan_async( assert response.backup_channel == "backup_channel_value" -@pytest.mark.asyncio -async def test_get_backup_plan_async_from_dict(): - await test_get_backup_plan_async(request_type=dict) - - def test_get_backup_plan_field_headers(): client = BackupForGKEClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2604,8 +2623,8 @@ async def test_get_backup_plan_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gkebackup.UpdateBackupPlanRequest, - dict, + gkebackup.UpdateBackupPlanRequest(), + {}, ], ) def test_update_backup_plan(request_type, transport: str = "grpc"): @@ -2616,7 +2635,7 @@ def test_update_backup_plan(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2659,7 +2678,8 @@ def test_update_backup_plan_non_empty_request_with_auto_populated_field(): client.update_backup_plan(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gkebackup.UpdateBackupPlanRequest() + request_msg = gkebackup.UpdateBackupPlanRequest() + assert args[0] == request_msg def test_update_backup_plan_use_cached_wrapped_rpc(): @@ -2754,9 +2774,14 @@ async def test_update_backup_plan_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_backup_plan_async( - transport: str = "grpc_asyncio", request_type=gkebackup.UpdateBackupPlanRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gkebackup.UpdateBackupPlanRequest(), + {}, + ], +) +async def test_update_backup_plan_async(request_type, transport: str = "grpc_asyncio"): client = BackupForGKEAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2764,7 +2789,7 @@ async def test_update_backup_plan_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( @@ -2786,11 +2811,6 @@ async def test_update_backup_plan_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_backup_plan_async_from_dict(): - await test_update_backup_plan_async(request_type=dict) - - def test_update_backup_plan_field_headers(): client = BackupForGKEClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2955,8 +2975,8 @@ async def test_update_backup_plan_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gkebackup.DeleteBackupPlanRequest, - dict, + gkebackup.DeleteBackupPlanRequest(), + {}, ], ) def test_delete_backup_plan(request_type, transport: str = "grpc"): @@ -2967,7 +2987,7 @@ def test_delete_backup_plan(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3013,10 +3033,11 @@ def test_delete_backup_plan_non_empty_request_with_auto_populated_field(): client.delete_backup_plan(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gkebackup.DeleteBackupPlanRequest( + request_msg = gkebackup.DeleteBackupPlanRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_backup_plan_use_cached_wrapped_rpc(): @@ -3111,9 +3132,14 @@ async def test_delete_backup_plan_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_backup_plan_async( - transport: str = "grpc_asyncio", request_type=gkebackup.DeleteBackupPlanRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gkebackup.DeleteBackupPlanRequest(), + {}, + ], +) +async def test_delete_backup_plan_async(request_type, transport: str = "grpc_asyncio"): client = BackupForGKEAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3121,7 +3147,7 @@ async def test_delete_backup_plan_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( @@ -3143,11 +3169,6 @@ async def test_delete_backup_plan_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_backup_plan_async_from_dict(): - await test_delete_backup_plan_async(request_type=dict) - - def test_delete_backup_plan_field_headers(): client = BackupForGKEClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3302,8 +3323,8 @@ async def test_delete_backup_plan_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gkebackup.CreateBackupChannelRequest, - dict, + gkebackup.CreateBackupChannelRequest(), + {}, ], ) def test_create_backup_channel(request_type, transport: str = "grpc"): @@ -3314,7 +3335,7 @@ def test_create_backup_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( @@ -3360,10 +3381,11 @@ def test_create_backup_channel_non_empty_request_with_auto_populated_field(): client.create_backup_channel(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gkebackup.CreateBackupChannelRequest( + request_msg = gkebackup.CreateBackupChannelRequest( parent="parent_value", backup_channel_id="backup_channel_id_value", ) + assert args[0] == request_msg def test_create_backup_channel_use_cached_wrapped_rpc(): @@ -3459,8 +3481,15 @@ async def test_create_backup_channel_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gkebackup.CreateBackupChannelRequest(), + {}, + ], +) async def test_create_backup_channel_async( - transport: str = "grpc_asyncio", request_type=gkebackup.CreateBackupChannelRequest + request_type, transport: str = "grpc_asyncio" ): client = BackupForGKEAsyncClient( credentials=async_anonymous_credentials(), @@ -3469,7 +3498,7 @@ async def test_create_backup_channel_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( @@ -3491,11 +3520,6 @@ async def test_create_backup_channel_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_backup_channel_async_from_dict(): - await test_create_backup_channel_async(request_type=dict) - - def test_create_backup_channel_field_headers(): client = BackupForGKEClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3670,8 +3694,8 @@ async def test_create_backup_channel_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gkebackup.ListBackupChannelsRequest, - dict, + gkebackup.ListBackupChannelsRequest(), + {}, ], ) def test_list_backup_channels(request_type, transport: str = "grpc"): @@ -3682,7 +3706,7 @@ def test_list_backup_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( @@ -3735,12 +3759,13 @@ def test_list_backup_channels_non_empty_request_with_auto_populated_field(): client.list_backup_channels(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gkebackup.ListBackupChannelsRequest( + request_msg = gkebackup.ListBackupChannelsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_backup_channels_use_cached_wrapped_rpc(): @@ -3825,8 +3850,15 @@ async def test_list_backup_channels_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gkebackup.ListBackupChannelsRequest(), + {}, + ], +) async def test_list_backup_channels_async( - transport: str = "grpc_asyncio", request_type=gkebackup.ListBackupChannelsRequest + request_type, transport: str = "grpc_asyncio" ): client = BackupForGKEAsyncClient( credentials=async_anonymous_credentials(), @@ -3835,7 +3867,7 @@ async def test_list_backup_channels_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( @@ -3862,11 +3894,6 @@ async def test_list_backup_channels_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_backup_channels_async_from_dict(): - await test_list_backup_channels_async(request_type=dict) - - def test_list_backup_channels_field_headers(): client = BackupForGKEClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4219,8 +4246,8 @@ async def test_list_backup_channels_async_pages(): @pytest.mark.parametrize( "request_type", [ - gkebackup.GetBackupChannelRequest, - dict, + gkebackup.GetBackupChannelRequest(), + {}, ], ) def test_get_backup_channel(request_type, transport: str = "grpc"): @@ -4231,7 +4258,7 @@ def test_get_backup_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( @@ -4289,9 +4316,10 @@ def test_get_backup_channel_non_empty_request_with_auto_populated_field(): client.get_backup_channel(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gkebackup.GetBackupChannelRequest( + request_msg = gkebackup.GetBackupChannelRequest( name="name_value", ) + assert args[0] == request_msg def test_get_backup_channel_use_cached_wrapped_rpc(): @@ -4376,9 +4404,14 @@ async def test_get_backup_channel_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_backup_channel_async( - transport: str = "grpc_asyncio", request_type=gkebackup.GetBackupChannelRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gkebackup.GetBackupChannelRequest(), + {}, + ], +) +async def test_get_backup_channel_async(request_type, transport: str = "grpc_asyncio"): client = BackupForGKEAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4386,7 +4419,7 @@ async def test_get_backup_channel_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( @@ -4421,11 +4454,6 @@ async def test_get_backup_channel_async( assert response.destination_project_id == "destination_project_id_value" -@pytest.mark.asyncio -async def test_get_backup_channel_async_from_dict(): - await test_get_backup_channel_async(request_type=dict) - - def test_get_backup_channel_field_headers(): client = BackupForGKEClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4580,8 +4608,8 @@ async def test_get_backup_channel_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gkebackup.UpdateBackupChannelRequest, - dict, + gkebackup.UpdateBackupChannelRequest(), + {}, ], ) def test_update_backup_channel(request_type, transport: str = "grpc"): @@ -4592,7 +4620,7 @@ def test_update_backup_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( @@ -4635,7 +4663,8 @@ def test_update_backup_channel_non_empty_request_with_auto_populated_field(): client.update_backup_channel(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gkebackup.UpdateBackupChannelRequest() + request_msg = gkebackup.UpdateBackupChannelRequest() + assert args[0] == request_msg def test_update_backup_channel_use_cached_wrapped_rpc(): @@ -4731,8 +4760,15 @@ async def test_update_backup_channel_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gkebackup.UpdateBackupChannelRequest(), + {}, + ], +) async def test_update_backup_channel_async( - transport: str = "grpc_asyncio", request_type=gkebackup.UpdateBackupChannelRequest + request_type, transport: str = "grpc_asyncio" ): client = BackupForGKEAsyncClient( credentials=async_anonymous_credentials(), @@ -4741,7 +4777,7 @@ async def test_update_backup_channel_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( @@ -4763,11 +4799,6 @@ async def test_update_backup_channel_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_backup_channel_async_from_dict(): - await test_update_backup_channel_async(request_type=dict) - - def test_update_backup_channel_field_headers(): client = BackupForGKEClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4932,8 +4963,8 @@ async def test_update_backup_channel_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gkebackup.DeleteBackupChannelRequest, - dict, + gkebackup.DeleteBackupChannelRequest(), + {}, ], ) def test_delete_backup_channel(request_type, transport: str = "grpc"): @@ -4944,7 +4975,7 @@ def test_delete_backup_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( @@ -4990,10 +5021,11 @@ def test_delete_backup_channel_non_empty_request_with_auto_populated_field(): client.delete_backup_channel(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gkebackup.DeleteBackupChannelRequest( + request_msg = gkebackup.DeleteBackupChannelRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_backup_channel_use_cached_wrapped_rpc(): @@ -5089,8 +5121,15 @@ async def test_delete_backup_channel_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gkebackup.DeleteBackupChannelRequest(), + {}, + ], +) async def test_delete_backup_channel_async( - transport: str = "grpc_asyncio", request_type=gkebackup.DeleteBackupChannelRequest + request_type, transport: str = "grpc_asyncio" ): client = BackupForGKEAsyncClient( credentials=async_anonymous_credentials(), @@ -5099,7 +5138,7 @@ async def test_delete_backup_channel_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( @@ -5121,11 +5160,6 @@ async def test_delete_backup_channel_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_backup_channel_async_from_dict(): - await test_delete_backup_channel_async(request_type=dict) - - def test_delete_backup_channel_field_headers(): client = BackupForGKEClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5280,8 +5314,8 @@ async def test_delete_backup_channel_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gkebackup.ListBackupPlanBindingsRequest, - dict, + gkebackup.ListBackupPlanBindingsRequest(), + {}, ], ) def test_list_backup_plan_bindings(request_type, transport: str = "grpc"): @@ -5292,7 +5326,7 @@ def test_list_backup_plan_bindings(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5345,12 +5379,13 @@ def test_list_backup_plan_bindings_non_empty_request_with_auto_populated_field() client.list_backup_plan_bindings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gkebackup.ListBackupPlanBindingsRequest( + request_msg = gkebackup.ListBackupPlanBindingsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_backup_plan_bindings_use_cached_wrapped_rpc(): @@ -5436,9 +5471,15 @@ async def test_list_backup_plan_bindings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gkebackup.ListBackupPlanBindingsRequest(), + {}, + ], +) async def test_list_backup_plan_bindings_async( - transport: str = "grpc_asyncio", - request_type=gkebackup.ListBackupPlanBindingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = BackupForGKEAsyncClient( credentials=async_anonymous_credentials(), @@ -5447,7 +5488,7 @@ async def test_list_backup_plan_bindings_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( @@ -5474,11 +5515,6 @@ async def test_list_backup_plan_bindings_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_backup_plan_bindings_async_from_dict(): - await test_list_backup_plan_bindings_async(request_type=dict) - - def test_list_backup_plan_bindings_field_headers(): client = BackupForGKEClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5837,8 +5873,8 @@ async def test_list_backup_plan_bindings_async_pages(): @pytest.mark.parametrize( "request_type", [ - gkebackup.GetBackupPlanBindingRequest, - dict, + gkebackup.GetBackupPlanBindingRequest(), + {}, ], ) def test_get_backup_plan_binding(request_type, transport: str = "grpc"): @@ -5849,7 +5885,7 @@ def test_get_backup_plan_binding(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5905,9 +5941,10 @@ def test_get_backup_plan_binding_non_empty_request_with_auto_populated_field(): client.get_backup_plan_binding(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gkebackup.GetBackupPlanBindingRequest( + request_msg = gkebackup.GetBackupPlanBindingRequest( name="name_value", ) + assert args[0] == request_msg def test_get_backup_plan_binding_use_cached_wrapped_rpc(): @@ -5993,8 +6030,15 @@ async def test_get_backup_plan_binding_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gkebackup.GetBackupPlanBindingRequest(), + {}, + ], +) async def test_get_backup_plan_binding_async( - transport: str = "grpc_asyncio", request_type=gkebackup.GetBackupPlanBindingRequest + request_type, transport: str = "grpc_asyncio" ): client = BackupForGKEAsyncClient( credentials=async_anonymous_credentials(), @@ -6003,7 +6047,7 @@ async def test_get_backup_plan_binding_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( @@ -6036,11 +6080,6 @@ async def test_get_backup_plan_binding_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_backup_plan_binding_async_from_dict(): - await test_get_backup_plan_binding_async(request_type=dict) - - def test_get_backup_plan_binding_field_headers(): client = BackupForGKEClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6195,8 +6234,8 @@ async def test_get_backup_plan_binding_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gkebackup.CreateBackupRequest, - dict, + gkebackup.CreateBackupRequest(), + {}, ], ) def test_create_backup(request_type, transport: str = "grpc"): @@ -6207,7 +6246,7 @@ def test_create_backup(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_backup), "__call__") as call: @@ -6249,10 +6288,11 @@ def test_create_backup_non_empty_request_with_auto_populated_field(): client.create_backup(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gkebackup.CreateBackupRequest( + request_msg = gkebackup.CreateBackupRequest( parent="parent_value", backup_id="backup_id_value", ) + assert args[0] == request_msg def test_create_backup_use_cached_wrapped_rpc(): @@ -6343,9 +6383,14 @@ async def test_create_backup_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_backup_async( - transport: str = "grpc_asyncio", request_type=gkebackup.CreateBackupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gkebackup.CreateBackupRequest(), + {}, + ], +) +async def test_create_backup_async(request_type, transport: str = "grpc_asyncio"): client = BackupForGKEAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6353,7 +6398,7 @@ async def test_create_backup_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_backup), "__call__") as call: @@ -6373,11 +6418,6 @@ async def test_create_backup_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_backup_async_from_dict(): - await test_create_backup_async(request_type=dict) - - def test_create_backup_field_headers(): client = BackupForGKEClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6544,8 +6584,8 @@ async def test_create_backup_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gkebackup.ListBackupsRequest, - dict, + gkebackup.ListBackupsRequest(), + {}, ], ) def test_list_backups(request_type, transport: str = "grpc"): @@ -6556,7 +6596,7 @@ def test_list_backups(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_backups), "__call__") as call: @@ -6605,12 +6645,13 @@ def test_list_backups_non_empty_request_with_auto_populated_field(): client.list_backups(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gkebackup.ListBackupsRequest( + request_msg = gkebackup.ListBackupsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_backups_use_cached_wrapped_rpc(): @@ -6691,9 +6732,14 @@ async def test_list_backups_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_backups_async( - transport: str = "grpc_asyncio", request_type=gkebackup.ListBackupsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gkebackup.ListBackupsRequest(), + {}, + ], +) +async def test_list_backups_async(request_type, transport: str = "grpc_asyncio"): client = BackupForGKEAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6701,7 +6747,7 @@ async def test_list_backups_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_backups), "__call__") as call: @@ -6726,11 +6772,6 @@ async def test_list_backups_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_backups_async_from_dict(): - await test_list_backups_async(request_type=dict) - - def test_list_backups_field_headers(): client = BackupForGKEClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7067,8 +7108,8 @@ async def test_list_backups_async_pages(): @pytest.mark.parametrize( "request_type", [ - gkebackup.GetBackupRequest, - dict, + gkebackup.GetBackupRequest(), + {}, ], ) def test_get_backup(request_type, transport: str = "grpc"): @@ -7079,7 +7120,7 @@ def test_get_backup(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_backup), "__call__") as call: @@ -7160,9 +7201,10 @@ def test_get_backup_non_empty_request_with_auto_populated_field(): client.get_backup(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gkebackup.GetBackupRequest( + request_msg = gkebackup.GetBackupRequest( name="name_value", ) + assert args[0] == request_msg def test_get_backup_use_cached_wrapped_rpc(): @@ -7241,9 +7283,14 @@ async def test_get_backup_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_backup_async( - transport: str = "grpc_asyncio", request_type=gkebackup.GetBackupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gkebackup.GetBackupRequest(), + {}, + ], +) +async def test_get_backup_async(request_type, transport: str = "grpc_asyncio"): client = BackupForGKEAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7251,7 +7298,7 @@ async def test_get_backup_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_backup), "__call__") as call: @@ -7310,11 +7357,6 @@ async def test_get_backup_async( assert response.satisfies_pzi is True -@pytest.mark.asyncio -async def test_get_backup_async_from_dict(): - await test_get_backup_async(request_type=dict) - - def test_get_backup_field_headers(): client = BackupForGKEClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7457,8 +7499,8 @@ async def test_get_backup_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gkebackup.UpdateBackupRequest, - dict, + gkebackup.UpdateBackupRequest(), + {}, ], ) def test_update_backup(request_type, transport: str = "grpc"): @@ -7469,7 +7511,7 @@ def test_update_backup(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_backup), "__call__") as call: @@ -7508,7 +7550,8 @@ def test_update_backup_non_empty_request_with_auto_populated_field(): client.update_backup(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gkebackup.UpdateBackupRequest() + request_msg = gkebackup.UpdateBackupRequest() + assert args[0] == request_msg def test_update_backup_use_cached_wrapped_rpc(): @@ -7599,9 +7642,14 @@ async def test_update_backup_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_backup_async( - transport: str = "grpc_asyncio", request_type=gkebackup.UpdateBackupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gkebackup.UpdateBackupRequest(), + {}, + ], +) +async def test_update_backup_async(request_type, transport: str = "grpc_asyncio"): client = BackupForGKEAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7609,7 +7657,7 @@ async def test_update_backup_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_backup), "__call__") as call: @@ -7629,11 +7677,6 @@ async def test_update_backup_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_backup_async_from_dict(): - await test_update_backup_async(request_type=dict) - - def test_update_backup_field_headers(): client = BackupForGKEClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7790,8 +7833,8 @@ async def test_update_backup_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gkebackup.DeleteBackupRequest, - dict, + gkebackup.DeleteBackupRequest(), + {}, ], ) def test_delete_backup(request_type, transport: str = "grpc"): @@ -7802,7 +7845,7 @@ def test_delete_backup(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_backup), "__call__") as call: @@ -7844,10 +7887,11 @@ def test_delete_backup_non_empty_request_with_auto_populated_field(): client.delete_backup(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gkebackup.DeleteBackupRequest( + request_msg = gkebackup.DeleteBackupRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_backup_use_cached_wrapped_rpc(): @@ -7938,9 +7982,14 @@ async def test_delete_backup_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_backup_async( - transport: str = "grpc_asyncio", request_type=gkebackup.DeleteBackupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gkebackup.DeleteBackupRequest(), + {}, + ], +) +async def test_delete_backup_async(request_type, transport: str = "grpc_asyncio"): client = BackupForGKEAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7948,7 +7997,7 @@ async def test_delete_backup_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_backup), "__call__") as call: @@ -7968,11 +8017,6 @@ async def test_delete_backup_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_backup_async_from_dict(): - await test_delete_backup_async(request_type=dict) - - def test_delete_backup_field_headers(): client = BackupForGKEClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8119,8 +8163,8 @@ async def test_delete_backup_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gkebackup.ListVolumeBackupsRequest, - dict, + gkebackup.ListVolumeBackupsRequest(), + {}, ], ) def test_list_volume_backups(request_type, transport: str = "grpc"): @@ -8131,7 +8175,7 @@ def test_list_volume_backups(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8182,12 +8226,13 @@ def test_list_volume_backups_non_empty_request_with_auto_populated_field(): client.list_volume_backups(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gkebackup.ListVolumeBackupsRequest( + request_msg = gkebackup.ListVolumeBackupsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_volume_backups_use_cached_wrapped_rpc(): @@ -8272,9 +8317,14 @@ async def test_list_volume_backups_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_volume_backups_async( - transport: str = "grpc_asyncio", request_type=gkebackup.ListVolumeBackupsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gkebackup.ListVolumeBackupsRequest(), + {}, + ], +) +async def test_list_volume_backups_async(request_type, transport: str = "grpc_asyncio"): client = BackupForGKEAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8282,7 +8332,7 @@ async def test_list_volume_backups_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( @@ -8307,11 +8357,6 @@ async def test_list_volume_backups_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_volume_backups_async_from_dict(): - await test_list_volume_backups_async(request_type=dict) - - def test_list_volume_backups_field_headers(): client = BackupForGKEClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8664,8 +8709,8 @@ async def test_list_volume_backups_async_pages(): @pytest.mark.parametrize( "request_type", [ - gkebackup.GetVolumeBackupRequest, - dict, + gkebackup.GetVolumeBackupRequest(), + {}, ], ) def test_get_volume_backup(request_type, transport: str = "grpc"): @@ -8676,7 +8721,7 @@ def test_get_volume_backup(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8746,9 +8791,10 @@ def test_get_volume_backup_non_empty_request_with_auto_populated_field(): client.get_volume_backup(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gkebackup.GetVolumeBackupRequest( + request_msg = gkebackup.GetVolumeBackupRequest( name="name_value", ) + assert args[0] == request_msg def test_get_volume_backup_use_cached_wrapped_rpc(): @@ -8831,9 +8877,14 @@ async def test_get_volume_backup_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_volume_backup_async( - transport: str = "grpc_asyncio", request_type=gkebackup.GetVolumeBackupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gkebackup.GetVolumeBackupRequest(), + {}, + ], +) +async def test_get_volume_backup_async(request_type, transport: str = "grpc_asyncio"): client = BackupForGKEAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8841,7 +8892,7 @@ async def test_get_volume_backup_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( @@ -8888,11 +8939,6 @@ async def test_get_volume_backup_async( assert response.satisfies_pzi is True -@pytest.mark.asyncio -async def test_get_volume_backup_async_from_dict(): - await test_get_volume_backup_async(request_type=dict) - - def test_get_volume_backup_field_headers(): client = BackupForGKEClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9043,8 +9089,8 @@ async def test_get_volume_backup_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gkebackup.CreateRestorePlanRequest, - dict, + gkebackup.CreateRestorePlanRequest(), + {}, ], ) def test_create_restore_plan(request_type, transport: str = "grpc"): @@ -9055,7 +9101,7 @@ def test_create_restore_plan(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9101,10 +9147,11 @@ def test_create_restore_plan_non_empty_request_with_auto_populated_field(): client.create_restore_plan(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gkebackup.CreateRestorePlanRequest( + request_msg = gkebackup.CreateRestorePlanRequest( parent="parent_value", restore_plan_id="restore_plan_id_value", ) + assert args[0] == request_msg def test_create_restore_plan_use_cached_wrapped_rpc(): @@ -9199,9 +9246,14 @@ async def test_create_restore_plan_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_restore_plan_async( - transport: str = "grpc_asyncio", request_type=gkebackup.CreateRestorePlanRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gkebackup.CreateRestorePlanRequest(), + {}, + ], +) +async def test_create_restore_plan_async(request_type, transport: str = "grpc_asyncio"): client = BackupForGKEAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9209,7 +9261,7 @@ async def test_create_restore_plan_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( @@ -9231,11 +9283,6 @@ async def test_create_restore_plan_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_restore_plan_async_from_dict(): - await test_create_restore_plan_async(request_type=dict) - - def test_create_restore_plan_field_headers(): client = BackupForGKEClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9410,8 +9457,8 @@ async def test_create_restore_plan_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gkebackup.ListRestorePlansRequest, - dict, + gkebackup.ListRestorePlansRequest(), + {}, ], ) def test_list_restore_plans(request_type, transport: str = "grpc"): @@ -9422,7 +9469,7 @@ def test_list_restore_plans(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,12 +9522,13 @@ def test_list_restore_plans_non_empty_request_with_auto_populated_field(): client.list_restore_plans(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gkebackup.ListRestorePlansRequest( + request_msg = gkebackup.ListRestorePlansRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_restore_plans_use_cached_wrapped_rpc(): @@ -9565,9 +9613,14 @@ async def test_list_restore_plans_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_restore_plans_async( - transport: str = "grpc_asyncio", request_type=gkebackup.ListRestorePlansRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gkebackup.ListRestorePlansRequest(), + {}, + ], +) +async def test_list_restore_plans_async(request_type, transport: str = "grpc_asyncio"): client = BackupForGKEAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9575,7 +9628,7 @@ async def test_list_restore_plans_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( @@ -9602,11 +9655,6 @@ async def test_list_restore_plans_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_restore_plans_async_from_dict(): - await test_list_restore_plans_async(request_type=dict) - - def test_list_restore_plans_field_headers(): client = BackupForGKEClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9959,8 +10007,8 @@ async def test_list_restore_plans_async_pages(): @pytest.mark.parametrize( "request_type", [ - gkebackup.GetRestorePlanRequest, - dict, + gkebackup.GetRestorePlanRequest(), + {}, ], ) def test_get_restore_plan(request_type, transport: str = "grpc"): @@ -9971,7 +10019,7 @@ def test_get_restore_plan(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_restore_plan), "__call__") as call: @@ -10031,9 +10079,10 @@ def test_get_restore_plan_non_empty_request_with_auto_populated_field(): client.get_restore_plan(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gkebackup.GetRestorePlanRequest( + request_msg = gkebackup.GetRestorePlanRequest( name="name_value", ) + assert args[0] == request_msg def test_get_restore_plan_use_cached_wrapped_rpc(): @@ -10116,9 +10165,14 @@ async def test_get_restore_plan_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_restore_plan_async( - transport: str = "grpc_asyncio", request_type=gkebackup.GetRestorePlanRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gkebackup.GetRestorePlanRequest(), + {}, + ], +) +async def test_get_restore_plan_async(request_type, transport: str = "grpc_asyncio"): client = BackupForGKEAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10126,7 +10180,7 @@ async def test_get_restore_plan_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_restore_plan), "__call__") as call: @@ -10165,11 +10219,6 @@ async def test_get_restore_plan_async( assert response.restore_channel == "restore_channel_value" -@pytest.mark.asyncio -async def test_get_restore_plan_async_from_dict(): - await test_get_restore_plan_async(request_type=dict) - - def test_get_restore_plan_field_headers(): client = BackupForGKEClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10316,8 +10365,8 @@ async def test_get_restore_plan_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gkebackup.UpdateRestorePlanRequest, - dict, + gkebackup.UpdateRestorePlanRequest(), + {}, ], ) def test_update_restore_plan(request_type, transport: str = "grpc"): @@ -10328,7 +10377,7 @@ def test_update_restore_plan(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10371,7 +10420,8 @@ def test_update_restore_plan_non_empty_request_with_auto_populated_field(): client.update_restore_plan(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gkebackup.UpdateRestorePlanRequest() + request_msg = gkebackup.UpdateRestorePlanRequest() + assert args[0] == request_msg def test_update_restore_plan_use_cached_wrapped_rpc(): @@ -10466,9 +10516,14 @@ async def test_update_restore_plan_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_restore_plan_async( - transport: str = "grpc_asyncio", request_type=gkebackup.UpdateRestorePlanRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gkebackup.UpdateRestorePlanRequest(), + {}, + ], +) +async def test_update_restore_plan_async(request_type, transport: str = "grpc_asyncio"): client = BackupForGKEAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10476,7 +10531,7 @@ async def test_update_restore_plan_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( @@ -10498,11 +10553,6 @@ async def test_update_restore_plan_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_restore_plan_async_from_dict(): - await test_update_restore_plan_async(request_type=dict) - - def test_update_restore_plan_field_headers(): client = BackupForGKEClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10667,8 +10717,8 @@ async def test_update_restore_plan_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gkebackup.DeleteRestorePlanRequest, - dict, + gkebackup.DeleteRestorePlanRequest(), + {}, ], ) def test_delete_restore_plan(request_type, transport: str = "grpc"): @@ -10679,7 +10729,7 @@ def test_delete_restore_plan(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10725,10 +10775,11 @@ def test_delete_restore_plan_non_empty_request_with_auto_populated_field(): client.delete_restore_plan(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gkebackup.DeleteRestorePlanRequest( + request_msg = gkebackup.DeleteRestorePlanRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_restore_plan_use_cached_wrapped_rpc(): @@ -10823,9 +10874,14 @@ async def test_delete_restore_plan_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_restore_plan_async( - transport: str = "grpc_asyncio", request_type=gkebackup.DeleteRestorePlanRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gkebackup.DeleteRestorePlanRequest(), + {}, + ], +) +async def test_delete_restore_plan_async(request_type, transport: str = "grpc_asyncio"): client = BackupForGKEAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10833,7 +10889,7 @@ async def test_delete_restore_plan_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( @@ -10855,11 +10911,6 @@ async def test_delete_restore_plan_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_restore_plan_async_from_dict(): - await test_delete_restore_plan_async(request_type=dict) - - def test_delete_restore_plan_field_headers(): client = BackupForGKEClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11014,8 +11065,8 @@ async def test_delete_restore_plan_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gkebackup.CreateRestoreChannelRequest, - dict, + gkebackup.CreateRestoreChannelRequest(), + {}, ], ) def test_create_restore_channel(request_type, transport: str = "grpc"): @@ -11026,7 +11077,7 @@ def test_create_restore_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( @@ -11072,10 +11123,11 @@ def test_create_restore_channel_non_empty_request_with_auto_populated_field(): client.create_restore_channel(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gkebackup.CreateRestoreChannelRequest( + request_msg = gkebackup.CreateRestoreChannelRequest( parent="parent_value", restore_channel_id="restore_channel_id_value", ) + assert args[0] == request_msg def test_create_restore_channel_use_cached_wrapped_rpc(): @@ -11171,8 +11223,15 @@ async def test_create_restore_channel_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gkebackup.CreateRestoreChannelRequest(), + {}, + ], +) async def test_create_restore_channel_async( - transport: str = "grpc_asyncio", request_type=gkebackup.CreateRestoreChannelRequest + request_type, transport: str = "grpc_asyncio" ): client = BackupForGKEAsyncClient( credentials=async_anonymous_credentials(), @@ -11181,7 +11240,7 @@ async def test_create_restore_channel_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( @@ -11203,11 +11262,6 @@ async def test_create_restore_channel_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_restore_channel_async_from_dict(): - await test_create_restore_channel_async(request_type=dict) - - def test_create_restore_channel_field_headers(): client = BackupForGKEClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11382,8 +11436,8 @@ async def test_create_restore_channel_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gkebackup.ListRestoreChannelsRequest, - dict, + gkebackup.ListRestoreChannelsRequest(), + {}, ], ) def test_list_restore_channels(request_type, transport: str = "grpc"): @@ -11394,7 +11448,7 @@ def test_list_restore_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( @@ -11447,12 +11501,13 @@ def test_list_restore_channels_non_empty_request_with_auto_populated_field(): client.list_restore_channels(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gkebackup.ListRestoreChannelsRequest( + request_msg = gkebackup.ListRestoreChannelsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_restore_channels_use_cached_wrapped_rpc(): @@ -11538,8 +11593,15 @@ async def test_list_restore_channels_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gkebackup.ListRestoreChannelsRequest(), + {}, + ], +) async def test_list_restore_channels_async( - transport: str = "grpc_asyncio", request_type=gkebackup.ListRestoreChannelsRequest + request_type, transport: str = "grpc_asyncio" ): client = BackupForGKEAsyncClient( credentials=async_anonymous_credentials(), @@ -11548,7 +11610,7 @@ async def test_list_restore_channels_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( @@ -11575,11 +11637,6 @@ async def test_list_restore_channels_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_restore_channels_async_from_dict(): - await test_list_restore_channels_async(request_type=dict) - - def test_list_restore_channels_field_headers(): client = BackupForGKEClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11932,8 +11989,8 @@ async def test_list_restore_channels_async_pages(): @pytest.mark.parametrize( "request_type", [ - gkebackup.GetRestoreChannelRequest, - dict, + gkebackup.GetRestoreChannelRequest(), + {}, ], ) def test_get_restore_channel(request_type, transport: str = "grpc"): @@ -11944,7 +12001,7 @@ def test_get_restore_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( @@ -12002,9 +12059,10 @@ def test_get_restore_channel_non_empty_request_with_auto_populated_field(): client.get_restore_channel(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gkebackup.GetRestoreChannelRequest( + request_msg = gkebackup.GetRestoreChannelRequest( name="name_value", ) + assert args[0] == request_msg def test_get_restore_channel_use_cached_wrapped_rpc(): @@ -12089,9 +12147,14 @@ async def test_get_restore_channel_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_restore_channel_async( - transport: str = "grpc_asyncio", request_type=gkebackup.GetRestoreChannelRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gkebackup.GetRestoreChannelRequest(), + {}, + ], +) +async def test_get_restore_channel_async(request_type, transport: str = "grpc_asyncio"): client = BackupForGKEAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12099,7 +12162,7 @@ async def test_get_restore_channel_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( @@ -12134,11 +12197,6 @@ async def test_get_restore_channel_async( assert response.destination_project_id == "destination_project_id_value" -@pytest.mark.asyncio -async def test_get_restore_channel_async_from_dict(): - await test_get_restore_channel_async(request_type=dict) - - def test_get_restore_channel_field_headers(): client = BackupForGKEClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12293,8 +12351,8 @@ async def test_get_restore_channel_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gkebackup.UpdateRestoreChannelRequest, - dict, + gkebackup.UpdateRestoreChannelRequest(), + {}, ], ) def test_update_restore_channel(request_type, transport: str = "grpc"): @@ -12305,7 +12363,7 @@ def test_update_restore_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( @@ -12348,7 +12406,8 @@ def test_update_restore_channel_non_empty_request_with_auto_populated_field(): client.update_restore_channel(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gkebackup.UpdateRestoreChannelRequest() + request_msg = gkebackup.UpdateRestoreChannelRequest() + assert args[0] == request_msg def test_update_restore_channel_use_cached_wrapped_rpc(): @@ -12444,8 +12503,15 @@ async def test_update_restore_channel_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gkebackup.UpdateRestoreChannelRequest(), + {}, + ], +) async def test_update_restore_channel_async( - transport: str = "grpc_asyncio", request_type=gkebackup.UpdateRestoreChannelRequest + request_type, transport: str = "grpc_asyncio" ): client = BackupForGKEAsyncClient( credentials=async_anonymous_credentials(), @@ -12454,7 +12520,7 @@ async def test_update_restore_channel_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( @@ -12476,11 +12542,6 @@ async def test_update_restore_channel_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_restore_channel_async_from_dict(): - await test_update_restore_channel_async(request_type=dict) - - def test_update_restore_channel_field_headers(): client = BackupForGKEClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12645,8 +12706,8 @@ async def test_update_restore_channel_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gkebackup.DeleteRestoreChannelRequest, - dict, + gkebackup.DeleteRestoreChannelRequest(), + {}, ], ) def test_delete_restore_channel(request_type, transport: str = "grpc"): @@ -12657,7 +12718,7 @@ def test_delete_restore_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( @@ -12703,10 +12764,11 @@ def test_delete_restore_channel_non_empty_request_with_auto_populated_field(): client.delete_restore_channel(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gkebackup.DeleteRestoreChannelRequest( + request_msg = gkebackup.DeleteRestoreChannelRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_restore_channel_use_cached_wrapped_rpc(): @@ -12802,8 +12864,15 @@ async def test_delete_restore_channel_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gkebackup.DeleteRestoreChannelRequest(), + {}, + ], +) async def test_delete_restore_channel_async( - transport: str = "grpc_asyncio", request_type=gkebackup.DeleteRestoreChannelRequest + request_type, transport: str = "grpc_asyncio" ): client = BackupForGKEAsyncClient( credentials=async_anonymous_credentials(), @@ -12812,7 +12881,7 @@ async def test_delete_restore_channel_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( @@ -12834,11 +12903,6 @@ async def test_delete_restore_channel_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_restore_channel_async_from_dict(): - await test_delete_restore_channel_async(request_type=dict) - - def test_delete_restore_channel_field_headers(): client = BackupForGKEClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12993,8 +13057,8 @@ async def test_delete_restore_channel_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gkebackup.ListRestorePlanBindingsRequest, - dict, + gkebackup.ListRestorePlanBindingsRequest(), + {}, ], ) def test_list_restore_plan_bindings(request_type, transport: str = "grpc"): @@ -13005,7 +13069,7 @@ def test_list_restore_plan_bindings(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -13058,12 +13122,13 @@ def test_list_restore_plan_bindings_non_empty_request_with_auto_populated_field( client.list_restore_plan_bindings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gkebackup.ListRestorePlanBindingsRequest( + request_msg = gkebackup.ListRestorePlanBindingsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_restore_plan_bindings_use_cached_wrapped_rpc(): @@ -13149,9 +13214,15 @@ async def test_list_restore_plan_bindings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gkebackup.ListRestorePlanBindingsRequest(), + {}, + ], +) async def test_list_restore_plan_bindings_async( - transport: str = "grpc_asyncio", - request_type=gkebackup.ListRestorePlanBindingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = BackupForGKEAsyncClient( credentials=async_anonymous_credentials(), @@ -13160,7 +13231,7 @@ async def test_list_restore_plan_bindings_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( @@ -13187,11 +13258,6 @@ async def test_list_restore_plan_bindings_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_restore_plan_bindings_async_from_dict(): - await test_list_restore_plan_bindings_async(request_type=dict) - - def test_list_restore_plan_bindings_field_headers(): client = BackupForGKEClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13550,8 +13616,8 @@ async def test_list_restore_plan_bindings_async_pages(): @pytest.mark.parametrize( "request_type", [ - gkebackup.GetRestorePlanBindingRequest, - dict, + gkebackup.GetRestorePlanBindingRequest(), + {}, ], ) def test_get_restore_plan_binding(request_type, transport: str = "grpc"): @@ -13562,7 +13628,7 @@ def test_get_restore_plan_binding(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -13618,9 +13684,10 @@ def test_get_restore_plan_binding_non_empty_request_with_auto_populated_field(): client.get_restore_plan_binding(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gkebackup.GetRestorePlanBindingRequest( + request_msg = gkebackup.GetRestorePlanBindingRequest( name="name_value", ) + assert args[0] == request_msg def test_get_restore_plan_binding_use_cached_wrapped_rpc(): @@ -13706,8 +13773,15 @@ async def test_get_restore_plan_binding_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gkebackup.GetRestorePlanBindingRequest(), + {}, + ], +) async def test_get_restore_plan_binding_async( - transport: str = "grpc_asyncio", request_type=gkebackup.GetRestorePlanBindingRequest + request_type, transport: str = "grpc_asyncio" ): client = BackupForGKEAsyncClient( credentials=async_anonymous_credentials(), @@ -13716,7 +13790,7 @@ async def test_get_restore_plan_binding_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( @@ -13749,11 +13823,6 @@ async def test_get_restore_plan_binding_async( assert response.backup_plan == "backup_plan_value" -@pytest.mark.asyncio -async def test_get_restore_plan_binding_async_from_dict(): - await test_get_restore_plan_binding_async(request_type=dict) - - def test_get_restore_plan_binding_field_headers(): client = BackupForGKEClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13908,8 +13977,8 @@ async def test_get_restore_plan_binding_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gkebackup.CreateRestoreRequest, - dict, + gkebackup.CreateRestoreRequest(), + {}, ], ) def test_create_restore(request_type, transport: str = "grpc"): @@ -13920,7 +13989,7 @@ def test_create_restore(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_restore), "__call__") as call: @@ -13962,10 +14031,11 @@ def test_create_restore_non_empty_request_with_auto_populated_field(): client.create_restore(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gkebackup.CreateRestoreRequest( + request_msg = gkebackup.CreateRestoreRequest( parent="parent_value", restore_id="restore_id_value", ) + assert args[0] == request_msg def test_create_restore_use_cached_wrapped_rpc(): @@ -14056,9 +14126,14 @@ async def test_create_restore_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_restore_async( - transport: str = "grpc_asyncio", request_type=gkebackup.CreateRestoreRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gkebackup.CreateRestoreRequest(), + {}, + ], +) +async def test_create_restore_async(request_type, transport: str = "grpc_asyncio"): client = BackupForGKEAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14066,7 +14141,7 @@ async def test_create_restore_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_restore), "__call__") as call: @@ -14086,11 +14161,6 @@ async def test_create_restore_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_restore_async_from_dict(): - await test_create_restore_async(request_type=dict) - - def test_create_restore_field_headers(): client = BackupForGKEClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14257,8 +14327,8 @@ async def test_create_restore_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gkebackup.ListRestoresRequest, - dict, + gkebackup.ListRestoresRequest(), + {}, ], ) def test_list_restores(request_type, transport: str = "grpc"): @@ -14269,7 +14339,7 @@ def test_list_restores(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_restores), "__call__") as call: @@ -14318,12 +14388,13 @@ def test_list_restores_non_empty_request_with_auto_populated_field(): client.list_restores(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gkebackup.ListRestoresRequest( + request_msg = gkebackup.ListRestoresRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_restores_use_cached_wrapped_rpc(): @@ -14404,9 +14475,14 @@ async def test_list_restores_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_restores_async( - transport: str = "grpc_asyncio", request_type=gkebackup.ListRestoresRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gkebackup.ListRestoresRequest(), + {}, + ], +) +async def test_list_restores_async(request_type, transport: str = "grpc_asyncio"): client = BackupForGKEAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14414,7 +14490,7 @@ async def test_list_restores_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_restores), "__call__") as call: @@ -14439,11 +14515,6 @@ async def test_list_restores_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_restores_async_from_dict(): - await test_list_restores_async(request_type=dict) - - def test_list_restores_field_headers(): client = BackupForGKEClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14780,8 +14851,8 @@ async def test_list_restores_async_pages(): @pytest.mark.parametrize( "request_type", [ - gkebackup.GetRestoreRequest, - dict, + gkebackup.GetRestoreRequest(), + {}, ], ) def test_get_restore(request_type, transport: str = "grpc"): @@ -14792,7 +14863,7 @@ def test_get_restore(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_restore), "__call__") as call: @@ -14858,9 +14929,10 @@ def test_get_restore_non_empty_request_with_auto_populated_field(): client.get_restore(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gkebackup.GetRestoreRequest( + request_msg = gkebackup.GetRestoreRequest( name="name_value", ) + assert args[0] == request_msg def test_get_restore_use_cached_wrapped_rpc(): @@ -14941,9 +15013,14 @@ async def test_get_restore_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_restore_async( - transport: str = "grpc_asyncio", request_type=gkebackup.GetRestoreRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gkebackup.GetRestoreRequest(), + {}, + ], +) +async def test_get_restore_async(request_type, transport: str = "grpc_asyncio"): client = BackupForGKEAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14951,7 +15028,7 @@ async def test_get_restore_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_restore), "__call__") as call: @@ -14996,11 +15073,6 @@ async def test_get_restore_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_restore_async_from_dict(): - await test_get_restore_async(request_type=dict) - - def test_get_restore_field_headers(): client = BackupForGKEClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15143,8 +15215,8 @@ async def test_get_restore_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gkebackup.UpdateRestoreRequest, - dict, + gkebackup.UpdateRestoreRequest(), + {}, ], ) def test_update_restore(request_type, transport: str = "grpc"): @@ -15155,7 +15227,7 @@ def test_update_restore(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_restore), "__call__") as call: @@ -15194,7 +15266,8 @@ def test_update_restore_non_empty_request_with_auto_populated_field(): client.update_restore(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gkebackup.UpdateRestoreRequest() + request_msg = gkebackup.UpdateRestoreRequest() + assert args[0] == request_msg def test_update_restore_use_cached_wrapped_rpc(): @@ -15285,9 +15358,14 @@ async def test_update_restore_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_restore_async( - transport: str = "grpc_asyncio", request_type=gkebackup.UpdateRestoreRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gkebackup.UpdateRestoreRequest(), + {}, + ], +) +async def test_update_restore_async(request_type, transport: str = "grpc_asyncio"): client = BackupForGKEAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -15295,7 +15373,7 @@ async def test_update_restore_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_restore), "__call__") as call: @@ -15315,11 +15393,6 @@ async def test_update_restore_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_restore_async_from_dict(): - await test_update_restore_async(request_type=dict) - - def test_update_restore_field_headers(): client = BackupForGKEClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15476,8 +15549,8 @@ async def test_update_restore_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gkebackup.DeleteRestoreRequest, - dict, + gkebackup.DeleteRestoreRequest(), + {}, ], ) def test_delete_restore(request_type, transport: str = "grpc"): @@ -15488,7 +15561,7 @@ def test_delete_restore(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_restore), "__call__") as call: @@ -15530,10 +15603,11 @@ def test_delete_restore_non_empty_request_with_auto_populated_field(): client.delete_restore(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gkebackup.DeleteRestoreRequest( + request_msg = gkebackup.DeleteRestoreRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_restore_use_cached_wrapped_rpc(): @@ -15624,9 +15698,14 @@ async def test_delete_restore_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_restore_async( - transport: str = "grpc_asyncio", request_type=gkebackup.DeleteRestoreRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gkebackup.DeleteRestoreRequest(), + {}, + ], +) +async def test_delete_restore_async(request_type, transport: str = "grpc_asyncio"): client = BackupForGKEAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -15634,7 +15713,7 @@ async def test_delete_restore_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_restore), "__call__") as call: @@ -15654,11 +15733,6 @@ async def test_delete_restore_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_restore_async_from_dict(): - await test_delete_restore_async(request_type=dict) - - def test_delete_restore_field_headers(): client = BackupForGKEClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15805,8 +15879,8 @@ async def test_delete_restore_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gkebackup.ListVolumeRestoresRequest, - dict, + gkebackup.ListVolumeRestoresRequest(), + {}, ], ) def test_list_volume_restores(request_type, transport: str = "grpc"): @@ -15817,7 +15891,7 @@ def test_list_volume_restores(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -15868,12 +15942,13 @@ def test_list_volume_restores_non_empty_request_with_auto_populated_field(): client.list_volume_restores(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gkebackup.ListVolumeRestoresRequest( + request_msg = gkebackup.ListVolumeRestoresRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_volume_restores_use_cached_wrapped_rpc(): @@ -15958,8 +16033,15 @@ async def test_list_volume_restores_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gkebackup.ListVolumeRestoresRequest(), + {}, + ], +) async def test_list_volume_restores_async( - transport: str = "grpc_asyncio", request_type=gkebackup.ListVolumeRestoresRequest + request_type, transport: str = "grpc_asyncio" ): client = BackupForGKEAsyncClient( credentials=async_anonymous_credentials(), @@ -15968,7 +16050,7 @@ async def test_list_volume_restores_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( @@ -15993,11 +16075,6 @@ async def test_list_volume_restores_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_volume_restores_async_from_dict(): - await test_list_volume_restores_async(request_type=dict) - - def test_list_volume_restores_field_headers(): client = BackupForGKEClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16350,8 +16427,8 @@ async def test_list_volume_restores_async_pages(): @pytest.mark.parametrize( "request_type", [ - gkebackup.GetVolumeRestoreRequest, - dict, + gkebackup.GetVolumeRestoreRequest(), + {}, ], ) def test_get_volume_restore(request_type, transport: str = "grpc"): @@ -16362,7 +16439,7 @@ def test_get_volume_restore(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -16424,9 +16501,10 @@ def test_get_volume_restore_non_empty_request_with_auto_populated_field(): client.get_volume_restore(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gkebackup.GetVolumeRestoreRequest( + request_msg = gkebackup.GetVolumeRestoreRequest( name="name_value", ) + assert args[0] == request_msg def test_get_volume_restore_use_cached_wrapped_rpc(): @@ -16511,9 +16589,14 @@ async def test_get_volume_restore_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_volume_restore_async( - transport: str = "grpc_asyncio", request_type=gkebackup.GetVolumeRestoreRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gkebackup.GetVolumeRestoreRequest(), + {}, + ], +) +async def test_get_volume_restore_async(request_type, transport: str = "grpc_asyncio"): client = BackupForGKEAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -16521,7 +16604,7 @@ async def test_get_volume_restore_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( @@ -16560,11 +16643,6 @@ async def test_get_volume_restore_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_volume_restore_async_from_dict(): - await test_get_volume_restore_async(request_type=dict) - - def test_get_volume_restore_field_headers(): client = BackupForGKEClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16719,8 +16797,8 @@ async def test_get_volume_restore_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gkebackup.GetBackupIndexDownloadUrlRequest, - dict, + gkebackup.GetBackupIndexDownloadUrlRequest(), + {}, ], ) def test_get_backup_index_download_url(request_type, transport: str = "grpc"): @@ -16731,7 +16809,7 @@ def test_get_backup_index_download_url(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -16779,9 +16857,10 @@ def test_get_backup_index_download_url_non_empty_request_with_auto_populated_fie client.get_backup_index_download_url(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gkebackup.GetBackupIndexDownloadUrlRequest( + request_msg = gkebackup.GetBackupIndexDownloadUrlRequest( backup="backup_value", ) + assert args[0] == request_msg def test_get_backup_index_download_url_use_cached_wrapped_rpc(): @@ -16867,9 +16946,15 @@ async def test_get_backup_index_download_url_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gkebackup.GetBackupIndexDownloadUrlRequest(), + {}, + ], +) async def test_get_backup_index_download_url_async( - transport: str = "grpc_asyncio", - request_type=gkebackup.GetBackupIndexDownloadUrlRequest, + request_type, transport: str = "grpc_asyncio" ): client = BackupForGKEAsyncClient( credentials=async_anonymous_credentials(), @@ -16878,7 +16963,7 @@ async def test_get_backup_index_download_url_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( @@ -16903,11 +16988,6 @@ async def test_get_backup_index_download_url_async( assert response.signed_url == "signed_url_value" -@pytest.mark.asyncio -async def test_get_backup_index_download_url_async_from_dict(): - await test_get_backup_index_download_url_async(request_type=dict) - - def test_get_backup_index_download_url_field_headers(): client = BackupForGKEClient( credentials=ga_credentials.AnonymousCredentials(), @@ -25308,7 +25388,6 @@ def test_create_backup_plan_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.CreateBackupPlanRequest() - assert args[0] == request_msg @@ -25331,7 +25410,6 @@ def test_list_backup_plans_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.ListBackupPlansRequest() - assert args[0] == request_msg @@ -25352,7 +25430,6 @@ def test_get_backup_plan_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.GetBackupPlanRequest() - assert args[0] == request_msg @@ -25375,7 +25452,6 @@ def test_update_backup_plan_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.UpdateBackupPlanRequest() - assert args[0] == request_msg @@ -25398,7 +25474,6 @@ def test_delete_backup_plan_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.DeleteBackupPlanRequest() - assert args[0] == request_msg @@ -25421,7 +25496,6 @@ def test_create_backup_channel_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.CreateBackupChannelRequest() - assert args[0] == request_msg @@ -25444,7 +25518,6 @@ def test_list_backup_channels_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.ListBackupChannelsRequest() - assert args[0] == request_msg @@ -25467,7 +25540,6 @@ def test_get_backup_channel_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.GetBackupChannelRequest() - assert args[0] == request_msg @@ -25490,7 +25562,6 @@ def test_update_backup_channel_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.UpdateBackupChannelRequest() - assert args[0] == request_msg @@ -25513,7 +25584,6 @@ def test_delete_backup_channel_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.DeleteBackupChannelRequest() - assert args[0] == request_msg @@ -25536,7 +25606,6 @@ def test_list_backup_plan_bindings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.ListBackupPlanBindingsRequest() - assert args[0] == request_msg @@ -25559,7 +25628,6 @@ def test_get_backup_plan_binding_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.GetBackupPlanBindingRequest() - assert args[0] == request_msg @@ -25580,7 +25648,6 @@ def test_create_backup_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.CreateBackupRequest() - assert args[0] == request_msg @@ -25601,7 +25668,6 @@ def test_list_backups_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.ListBackupsRequest() - assert args[0] == request_msg @@ -25622,7 +25688,6 @@ def test_get_backup_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.GetBackupRequest() - assert args[0] == request_msg @@ -25643,7 +25708,6 @@ def test_update_backup_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.UpdateBackupRequest() - assert args[0] == request_msg @@ -25664,7 +25728,6 @@ def test_delete_backup_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.DeleteBackupRequest() - assert args[0] == request_msg @@ -25687,7 +25750,6 @@ def test_list_volume_backups_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.ListVolumeBackupsRequest() - assert args[0] == request_msg @@ -25710,7 +25772,6 @@ def test_get_volume_backup_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.GetVolumeBackupRequest() - assert args[0] == request_msg @@ -25733,7 +25794,6 @@ def test_create_restore_plan_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.CreateRestorePlanRequest() - assert args[0] == request_msg @@ -25756,7 +25816,6 @@ def test_list_restore_plans_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.ListRestorePlansRequest() - assert args[0] == request_msg @@ -25777,7 +25836,6 @@ def test_get_restore_plan_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.GetRestorePlanRequest() - assert args[0] == request_msg @@ -25800,7 +25858,6 @@ def test_update_restore_plan_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.UpdateRestorePlanRequest() - assert args[0] == request_msg @@ -25823,7 +25880,6 @@ def test_delete_restore_plan_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.DeleteRestorePlanRequest() - assert args[0] == request_msg @@ -25846,7 +25902,6 @@ def test_create_restore_channel_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.CreateRestoreChannelRequest() - assert args[0] == request_msg @@ -25869,7 +25924,6 @@ def test_list_restore_channels_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.ListRestoreChannelsRequest() - assert args[0] == request_msg @@ -25892,7 +25946,6 @@ def test_get_restore_channel_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.GetRestoreChannelRequest() - assert args[0] == request_msg @@ -25915,7 +25968,6 @@ def test_update_restore_channel_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.UpdateRestoreChannelRequest() - assert args[0] == request_msg @@ -25938,7 +25990,6 @@ def test_delete_restore_channel_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.DeleteRestoreChannelRequest() - assert args[0] == request_msg @@ -25961,7 +26012,6 @@ def test_list_restore_plan_bindings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.ListRestorePlanBindingsRequest() - assert args[0] == request_msg @@ -25984,7 +26034,6 @@ def test_get_restore_plan_binding_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.GetRestorePlanBindingRequest() - assert args[0] == request_msg @@ -26005,7 +26054,6 @@ def test_create_restore_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.CreateRestoreRequest() - assert args[0] == request_msg @@ -26026,7 +26074,6 @@ def test_list_restores_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.ListRestoresRequest() - assert args[0] == request_msg @@ -26047,7 +26094,6 @@ def test_get_restore_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.GetRestoreRequest() - assert args[0] == request_msg @@ -26068,7 +26114,6 @@ def test_update_restore_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.UpdateRestoreRequest() - assert args[0] == request_msg @@ -26089,7 +26134,6 @@ def test_delete_restore_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.DeleteRestoreRequest() - assert args[0] == request_msg @@ -26112,7 +26156,6 @@ def test_list_volume_restores_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.ListVolumeRestoresRequest() - assert args[0] == request_msg @@ -26135,7 +26178,6 @@ def test_get_volume_restore_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.GetVolumeRestoreRequest() - assert args[0] == request_msg @@ -26158,7 +26200,6 @@ def test_get_backup_index_download_url_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.GetBackupIndexDownloadUrlRequest() - assert args[0] == request_msg @@ -26199,7 +26240,6 @@ async def test_create_backup_plan_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.CreateBackupPlanRequest() - assert args[0] == request_msg @@ -26229,7 +26269,6 @@ async def test_list_backup_plans_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.ListBackupPlansRequest() - assert args[0] == request_msg @@ -26267,7 +26306,6 @@ async def test_get_backup_plan_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.GetBackupPlanRequest() - assert args[0] == request_msg @@ -26294,7 +26332,6 @@ async def test_update_backup_plan_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.UpdateBackupPlanRequest() - assert args[0] == request_msg @@ -26321,7 +26358,6 @@ async def test_delete_backup_plan_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.DeleteBackupPlanRequest() - assert args[0] == request_msg @@ -26348,7 +26384,6 @@ async def test_create_backup_channel_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.CreateBackupChannelRequest() - assert args[0] == request_msg @@ -26378,7 +26413,6 @@ async def test_list_backup_channels_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.ListBackupChannelsRequest() - assert args[0] == request_msg @@ -26412,7 +26446,6 @@ async def test_get_backup_channel_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.GetBackupChannelRequest() - assert args[0] == request_msg @@ -26439,7 +26472,6 @@ async def test_update_backup_channel_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.UpdateBackupChannelRequest() - assert args[0] == request_msg @@ -26466,7 +26498,6 @@ async def test_delete_backup_channel_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.DeleteBackupChannelRequest() - assert args[0] == request_msg @@ -26496,7 +26527,6 @@ async def test_list_backup_plan_bindings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.ListBackupPlanBindingsRequest() - assert args[0] == request_msg @@ -26529,7 +26559,6 @@ async def test_get_backup_plan_binding_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.GetBackupPlanBindingRequest() - assert args[0] == request_msg @@ -26554,7 +26583,6 @@ async def test_create_backup_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.CreateBackupRequest() - assert args[0] == request_msg @@ -26582,7 +26610,6 @@ async def test_list_backups_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.ListBackupsRequest() - assert args[0] == request_msg @@ -26627,7 +26654,6 @@ async def test_get_backup_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.GetBackupRequest() - assert args[0] == request_msg @@ -26652,7 +26678,6 @@ async def test_update_backup_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.UpdateBackupRequest() - assert args[0] == request_msg @@ -26677,7 +26702,6 @@ async def test_delete_backup_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.DeleteBackupRequest() - assert args[0] == request_msg @@ -26706,7 +26730,6 @@ async def test_list_volume_backups_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.ListVolumeBackupsRequest() - assert args[0] == request_msg @@ -26745,7 +26768,6 @@ async def test_get_volume_backup_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.GetVolumeBackupRequest() - assert args[0] == request_msg @@ -26772,7 +26794,6 @@ async def test_create_restore_plan_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.CreateRestorePlanRequest() - assert args[0] == request_msg @@ -26802,7 +26823,6 @@ async def test_list_restore_plans_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.ListRestorePlansRequest() - assert args[0] == request_msg @@ -26837,7 +26857,6 @@ async def test_get_restore_plan_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.GetRestorePlanRequest() - assert args[0] == request_msg @@ -26864,7 +26883,6 @@ async def test_update_restore_plan_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.UpdateRestorePlanRequest() - assert args[0] == request_msg @@ -26891,7 +26909,6 @@ async def test_delete_restore_plan_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.DeleteRestorePlanRequest() - assert args[0] == request_msg @@ -26918,7 +26935,6 @@ async def test_create_restore_channel_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.CreateRestoreChannelRequest() - assert args[0] == request_msg @@ -26948,7 +26964,6 @@ async def test_list_restore_channels_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.ListRestoreChannelsRequest() - assert args[0] == request_msg @@ -26982,7 +26997,6 @@ async def test_get_restore_channel_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.GetRestoreChannelRequest() - assert args[0] == request_msg @@ -27009,7 +27023,6 @@ async def test_update_restore_channel_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.UpdateRestoreChannelRequest() - assert args[0] == request_msg @@ -27036,7 +27049,6 @@ async def test_delete_restore_channel_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.DeleteRestoreChannelRequest() - assert args[0] == request_msg @@ -27066,7 +27078,6 @@ async def test_list_restore_plan_bindings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.ListRestorePlanBindingsRequest() - assert args[0] == request_msg @@ -27099,7 +27110,6 @@ async def test_get_restore_plan_binding_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.GetRestorePlanBindingRequest() - assert args[0] == request_msg @@ -27124,7 +27134,6 @@ async def test_create_restore_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.CreateRestoreRequest() - assert args[0] == request_msg @@ -27152,7 +27161,6 @@ async def test_list_restores_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.ListRestoresRequest() - assert args[0] == request_msg @@ -27190,7 +27198,6 @@ async def test_get_restore_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.GetRestoreRequest() - assert args[0] == request_msg @@ -27215,7 +27222,6 @@ async def test_update_restore_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.UpdateRestoreRequest() - assert args[0] == request_msg @@ -27240,7 +27246,6 @@ async def test_delete_restore_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.DeleteRestoreRequest() - assert args[0] == request_msg @@ -27269,7 +27274,6 @@ async def test_list_volume_restores_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.ListVolumeRestoresRequest() - assert args[0] == request_msg @@ -27305,7 +27309,6 @@ async def test_get_volume_restore_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.GetVolumeRestoreRequest() - assert args[0] == request_msg @@ -27334,7 +27337,6 @@ async def test_get_backup_index_download_url_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.GetBackupIndexDownloadUrlRequest() - assert args[0] == request_msg @@ -34649,7 +34651,6 @@ def test_create_backup_plan_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.CreateBackupPlanRequest() - assert args[0] == request_msg @@ -34671,7 +34672,6 @@ def test_list_backup_plans_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.ListBackupPlansRequest() - assert args[0] == request_msg @@ -34691,7 +34691,6 @@ def test_get_backup_plan_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.GetBackupPlanRequest() - assert args[0] == request_msg @@ -34713,7 +34712,6 @@ def test_update_backup_plan_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.UpdateBackupPlanRequest() - assert args[0] == request_msg @@ -34735,7 +34733,6 @@ def test_delete_backup_plan_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.DeleteBackupPlanRequest() - assert args[0] == request_msg @@ -34757,7 +34754,6 @@ def test_create_backup_channel_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.CreateBackupChannelRequest() - assert args[0] == request_msg @@ -34779,7 +34775,6 @@ def test_list_backup_channels_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.ListBackupChannelsRequest() - assert args[0] == request_msg @@ -34801,7 +34796,6 @@ def test_get_backup_channel_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.GetBackupChannelRequest() - assert args[0] == request_msg @@ -34823,7 +34817,6 @@ def test_update_backup_channel_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.UpdateBackupChannelRequest() - assert args[0] == request_msg @@ -34845,7 +34838,6 @@ def test_delete_backup_channel_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.DeleteBackupChannelRequest() - assert args[0] == request_msg @@ -34867,7 +34859,6 @@ def test_list_backup_plan_bindings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.ListBackupPlanBindingsRequest() - assert args[0] == request_msg @@ -34889,7 +34880,6 @@ def test_get_backup_plan_binding_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.GetBackupPlanBindingRequest() - assert args[0] == request_msg @@ -34909,7 +34899,6 @@ def test_create_backup_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.CreateBackupRequest() - assert args[0] == request_msg @@ -34929,7 +34918,6 @@ def test_list_backups_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.ListBackupsRequest() - assert args[0] == request_msg @@ -34949,7 +34937,6 @@ def test_get_backup_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.GetBackupRequest() - assert args[0] == request_msg @@ -34969,7 +34956,6 @@ def test_update_backup_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.UpdateBackupRequest() - assert args[0] == request_msg @@ -34989,7 +34975,6 @@ def test_delete_backup_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.DeleteBackupRequest() - assert args[0] == request_msg @@ -35011,7 +34996,6 @@ def test_list_volume_backups_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.ListVolumeBackupsRequest() - assert args[0] == request_msg @@ -35033,7 +35017,6 @@ def test_get_volume_backup_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.GetVolumeBackupRequest() - assert args[0] == request_msg @@ -35055,7 +35038,6 @@ def test_create_restore_plan_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.CreateRestorePlanRequest() - assert args[0] == request_msg @@ -35077,7 +35059,6 @@ def test_list_restore_plans_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.ListRestorePlansRequest() - assert args[0] == request_msg @@ -35097,7 +35078,6 @@ def test_get_restore_plan_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.GetRestorePlanRequest() - assert args[0] == request_msg @@ -35119,7 +35099,6 @@ def test_update_restore_plan_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.UpdateRestorePlanRequest() - assert args[0] == request_msg @@ -35141,7 +35120,6 @@ def test_delete_restore_plan_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.DeleteRestorePlanRequest() - assert args[0] == request_msg @@ -35163,7 +35141,6 @@ def test_create_restore_channel_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.CreateRestoreChannelRequest() - assert args[0] == request_msg @@ -35185,7 +35162,6 @@ def test_list_restore_channels_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.ListRestoreChannelsRequest() - assert args[0] == request_msg @@ -35207,7 +35183,6 @@ def test_get_restore_channel_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.GetRestoreChannelRequest() - assert args[0] == request_msg @@ -35229,7 +35204,6 @@ def test_update_restore_channel_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.UpdateRestoreChannelRequest() - assert args[0] == request_msg @@ -35251,7 +35225,6 @@ def test_delete_restore_channel_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.DeleteRestoreChannelRequest() - assert args[0] == request_msg @@ -35273,7 +35246,6 @@ def test_list_restore_plan_bindings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.ListRestorePlanBindingsRequest() - assert args[0] == request_msg @@ -35295,7 +35267,6 @@ def test_get_restore_plan_binding_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.GetRestorePlanBindingRequest() - assert args[0] == request_msg @@ -35315,7 +35286,6 @@ def test_create_restore_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.CreateRestoreRequest() - assert args[0] == request_msg @@ -35335,7 +35305,6 @@ def test_list_restores_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.ListRestoresRequest() - assert args[0] == request_msg @@ -35355,7 +35324,6 @@ def test_get_restore_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.GetRestoreRequest() - assert args[0] == request_msg @@ -35375,7 +35343,6 @@ def test_update_restore_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.UpdateRestoreRequest() - assert args[0] == request_msg @@ -35395,7 +35362,6 @@ def test_delete_restore_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.DeleteRestoreRequest() - assert args[0] == request_msg @@ -35417,7 +35383,6 @@ def test_list_volume_restores_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.ListVolumeRestoresRequest() - assert args[0] == request_msg @@ -35439,7 +35404,6 @@ def test_get_volume_restore_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.GetVolumeRestoreRequest() - assert args[0] == request_msg @@ -35461,7 +35425,6 @@ def test_get_backup_index_download_url_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkebackup.GetBackupIndexDownloadUrlRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-gke-connect-gateway/noxfile.py b/packages/google-cloud-gke-connect-gateway/noxfile.py index e03767d57fee..0154a64bc1b5 100644 --- a/packages/google-cloud-gke-connect-gateway/noxfile.py +++ b/packages/google-cloud-gke-connect-gateway/noxfile.py @@ -47,7 +47,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-gke-connect-gateway" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-gke-connect-gateway/setup.py b/packages/google-cloud-gke-connect-gateway/setup.py index 08c5c8163440..95296f191dc0 100644 --- a/packages/google-cloud-gke-connect-gateway/setup.py +++ b/packages/google-cloud-gke-connect-gateway/setup.py @@ -45,7 +45,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/google-cloud-gke-connect-gateway/testing/constraints-3.10.txt b/packages/google-cloud-gke-connect-gateway/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-gke-connect-gateway/testing/constraints-3.10.txt +++ b/packages/google-cloud-gke-connect-gateway/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-gke-connect-gateway/tests/unit/gapic/gateway_v1/test_gateway_control.py b/packages/google-cloud-gke-connect-gateway/tests/unit/gapic/gateway_v1/test_gateway_control.py index 1bf39c8a8336..d8abd23a7d19 100644 --- a/packages/google-cloud-gke-connect-gateway/tests/unit/gapic/gateway_v1/test_gateway_control.py +++ b/packages/google-cloud-gke-connect-gateway/tests/unit/gapic/gateway_v1/test_gateway_control.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 @@ -105,6 +106,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" @@ -1529,7 +1545,6 @@ def test_generate_credentials_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control.GenerateCredentialsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-gke-connect-gateway/tests/unit/gapic/gateway_v1beta1/test_gateway_control.py b/packages/google-cloud-gke-connect-gateway/tests/unit/gapic/gateway_v1beta1/test_gateway_control.py index 05f96dfa1b6e..49fb08ca8bdc 100644 --- a/packages/google-cloud-gke-connect-gateway/tests/unit/gapic/gateway_v1beta1/test_gateway_control.py +++ b/packages/google-cloud-gke-connect-gateway/tests/unit/gapic/gateway_v1beta1/test_gateway_control.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 @@ -105,6 +106,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" @@ -1529,7 +1545,6 @@ def test_generate_credentials_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control.GenerateCredentialsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-gke-hub/noxfile.py b/packages/google-cloud-gke-hub/noxfile.py index 6c6b394d1d8a..a5124d5be99a 100644 --- a/packages/google-cloud-gke-hub/noxfile.py +++ b/packages/google-cloud-gke-hub/noxfile.py @@ -47,7 +47,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-gke-hub" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-gke-hub/setup.py b/packages/google-cloud-gke-hub/setup.py index 9727979aea36..e5a9ecc0bec0 100644 --- a/packages/google-cloud-gke-hub/setup.py +++ b/packages/google-cloud-gke-hub/setup.py @@ -44,7 +44,7 @@ # See https://github.com/googleapis/google-cloud-python/issues/12364 "google-auth >= 2.14.1, <3.0.0,!=2.24.0,!=2.25.0", "grpc-google-iam-v1 >=0.12.4, <1.0.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-gke-hub/testing/constraints-3.10.txt b/packages/google-cloud-gke-hub/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-gke-hub/testing/constraints-3.10.txt +++ b/packages/google-cloud-gke-hub/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-gke-hub/tests/unit/gapic/gkehub_v1/test_gke_hub.py b/packages/google-cloud-gke-hub/tests/unit/gapic/gkehub_v1/test_gke_hub.py index 280f38cdf74e..7175d8a88819 100644 --- a/packages/google-cloud-gke-hub/tests/unit/gapic/gkehub_v1/test_gke_hub.py +++ b/packages/google-cloud-gke-hub/tests/unit/gapic/gkehub_v1/test_gke_hub.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 @@ -116,6 +117,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" @@ -1248,8 +1264,8 @@ def test_gke_hub_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - service.ListMembershipsRequest, - dict, + service.ListMembershipsRequest(), + {}, ], ) def test_list_memberships(request_type, transport: str = "grpc"): @@ -1260,7 +1276,7 @@ def test_list_memberships(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_memberships), "__call__") as call: @@ -1309,12 +1325,13 @@ def test_list_memberships_non_empty_request_with_auto_populated_field(): client.list_memberships(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListMembershipsRequest( + request_msg = service.ListMembershipsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_memberships_use_cached_wrapped_rpc(): @@ -1397,9 +1414,14 @@ async def test_list_memberships_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_memberships_async( - transport: str = "grpc_asyncio", request_type=service.ListMembershipsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListMembershipsRequest(), + {}, + ], +) +async def test_list_memberships_async(request_type, transport: str = "grpc_asyncio"): client = GkeHubAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1407,7 +1429,7 @@ async def test_list_memberships_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_memberships), "__call__") as call: @@ -1432,11 +1454,6 @@ async def test_list_memberships_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_memberships_async_from_dict(): - await test_list_memberships_async(request_type=dict) - - def test_list_memberships_field_headers(): client = GkeHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1773,8 +1790,8 @@ async def test_list_memberships_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.ListBoundMembershipsRequest, - dict, + service.ListBoundMembershipsRequest(), + {}, ], ) def test_list_bound_memberships(request_type, transport: str = "grpc"): @@ -1785,7 +1802,7 @@ def test_list_bound_memberships(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1837,11 +1854,12 @@ def test_list_bound_memberships_non_empty_request_with_auto_populated_field(): client.list_bound_memberships(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListBoundMembershipsRequest( + request_msg = service.ListBoundMembershipsRequest( scope_name="scope_name_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_bound_memberships_use_cached_wrapped_rpc(): @@ -1927,8 +1945,15 @@ async def test_list_bound_memberships_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.ListBoundMembershipsRequest(), + {}, + ], +) async def test_list_bound_memberships_async( - transport: str = "grpc_asyncio", request_type=service.ListBoundMembershipsRequest + request_type, transport: str = "grpc_asyncio" ): client = GkeHubAsyncClient( credentials=async_anonymous_credentials(), @@ -1937,7 +1962,7 @@ async def test_list_bound_memberships_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( @@ -1964,11 +1989,6 @@ async def test_list_bound_memberships_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_bound_memberships_async_from_dict(): - await test_list_bound_memberships_async(request_type=dict) - - def test_list_bound_memberships_field_headers(): client = GkeHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2321,8 +2341,8 @@ async def test_list_bound_memberships_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.ListFeaturesRequest, - dict, + service.ListFeaturesRequest(), + {}, ], ) def test_list_features(request_type, transport: str = "grpc"): @@ -2333,7 +2353,7 @@ def test_list_features(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_features), "__call__") as call: @@ -2380,12 +2400,13 @@ def test_list_features_non_empty_request_with_auto_populated_field(): client.list_features(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListFeaturesRequest( + request_msg = service.ListFeaturesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_features_use_cached_wrapped_rpc(): @@ -2466,9 +2487,14 @@ async def test_list_features_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_features_async( - transport: str = "grpc_asyncio", request_type=service.ListFeaturesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListFeaturesRequest(), + {}, + ], +) +async def test_list_features_async(request_type, transport: str = "grpc_asyncio"): client = GkeHubAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2476,7 +2502,7 @@ async def test_list_features_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_features), "__call__") as call: @@ -2499,11 +2525,6 @@ async def test_list_features_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_features_async_from_dict(): - await test_list_features_async(request_type=dict) - - def test_list_features_field_headers(): client = GkeHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2840,8 +2861,8 @@ async def test_list_features_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetMembershipRequest, - dict, + service.GetMembershipRequest(), + {}, ], ) def test_get_membership(request_type, transport: str = "grpc"): @@ -2852,7 +2873,7 @@ def test_get_membership(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_membership), "__call__") as call: @@ -2902,9 +2923,10 @@ def test_get_membership_non_empty_request_with_auto_populated_field(): client.get_membership(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetMembershipRequest( + request_msg = service.GetMembershipRequest( name="name_value", ) + assert args[0] == request_msg def test_get_membership_use_cached_wrapped_rpc(): @@ -2985,9 +3007,14 @@ async def test_get_membership_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_membership_async( - transport: str = "grpc_asyncio", request_type=service.GetMembershipRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetMembershipRequest(), + {}, + ], +) +async def test_get_membership_async(request_type, transport: str = "grpc_asyncio"): client = GkeHubAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2995,7 +3022,7 @@ async def test_get_membership_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_membership), "__call__") as call: @@ -3024,11 +3051,6 @@ async def test_get_membership_async( assert response.unique_id == "unique_id_value" -@pytest.mark.asyncio -async def test_get_membership_async_from_dict(): - await test_get_membership_async(request_type=dict) - - def test_get_membership_field_headers(): client = GkeHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3175,8 +3197,8 @@ async def test_get_membership_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.GetFeatureRequest, - dict, + service.GetFeatureRequest(), + {}, ], ) def test_get_feature(request_type, transport: str = "grpc"): @@ -3187,7 +3209,7 @@ def test_get_feature(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_feature), "__call__") as call: @@ -3233,9 +3255,10 @@ def test_get_feature_non_empty_request_with_auto_populated_field(): client.get_feature(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetFeatureRequest( + request_msg = service.GetFeatureRequest( name="name_value", ) + assert args[0] == request_msg def test_get_feature_use_cached_wrapped_rpc(): @@ -3316,9 +3339,14 @@ async def test_get_feature_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_feature_async( - transport: str = "grpc_asyncio", request_type=service.GetFeatureRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetFeatureRequest(), + {}, + ], +) +async def test_get_feature_async(request_type, transport: str = "grpc_asyncio"): client = GkeHubAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3326,7 +3354,7 @@ async def test_get_feature_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_feature), "__call__") as call: @@ -3351,11 +3379,6 @@ async def test_get_feature_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_get_feature_async_from_dict(): - await test_get_feature_async(request_type=dict) - - def test_get_feature_field_headers(): client = GkeHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3498,8 +3521,8 @@ async def test_get_feature_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.CreateMembershipRequest, - dict, + service.CreateMembershipRequest(), + {}, ], ) def test_create_membership(request_type, transport: str = "grpc"): @@ -3510,7 +3533,7 @@ def test_create_membership(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3557,11 +3580,12 @@ def test_create_membership_non_empty_request_with_auto_populated_field(): client.create_membership(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateMembershipRequest( + request_msg = service.CreateMembershipRequest( parent="parent_value", membership_id="membership_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_membership_use_cached_wrapped_rpc(): @@ -3654,9 +3678,14 @@ async def test_create_membership_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_membership_async( - transport: str = "grpc_asyncio", request_type=service.CreateMembershipRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CreateMembershipRequest(), + {}, + ], +) +async def test_create_membership_async(request_type, transport: str = "grpc_asyncio"): client = GkeHubAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3664,7 +3693,7 @@ async def test_create_membership_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( @@ -3686,11 +3715,6 @@ async def test_create_membership_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_membership_async_from_dict(): - await test_create_membership_async(request_type=dict) - - def test_create_membership_field_headers(): client = GkeHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3897,8 +3921,8 @@ async def test_create_membership_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.CreateFeatureRequest, - dict, + service.CreateFeatureRequest(), + {}, ], ) def test_create_feature(request_type, transport: str = "grpc"): @@ -3909,7 +3933,7 @@ def test_create_feature(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_feature), "__call__") as call: @@ -3952,11 +3976,12 @@ def test_create_feature_non_empty_request_with_auto_populated_field(): client.create_feature(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateFeatureRequest( + request_msg = service.CreateFeatureRequest( parent="parent_value", feature_id="feature_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_feature_use_cached_wrapped_rpc(): @@ -4047,9 +4072,14 @@ async def test_create_feature_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_feature_async( - transport: str = "grpc_asyncio", request_type=service.CreateFeatureRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CreateFeatureRequest(), + {}, + ], +) +async def test_create_feature_async(request_type, transport: str = "grpc_asyncio"): client = GkeHubAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4057,7 +4087,7 @@ async def test_create_feature_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_feature), "__call__") as call: @@ -4077,11 +4107,6 @@ async def test_create_feature_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_feature_async_from_dict(): - await test_create_feature_async(request_type=dict) - - def test_create_feature_field_headers(): client = GkeHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4248,8 +4273,8 @@ async def test_create_feature_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DeleteMembershipRequest, - dict, + service.DeleteMembershipRequest(), + {}, ], ) def test_delete_membership(request_type, transport: str = "grpc"): @@ -4260,7 +4285,7 @@ def test_delete_membership(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4306,10 +4331,11 @@ def test_delete_membership_non_empty_request_with_auto_populated_field(): client.delete_membership(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteMembershipRequest( + request_msg = service.DeleteMembershipRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_membership_use_cached_wrapped_rpc(): @@ -4402,9 +4428,14 @@ async def test_delete_membership_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_membership_async( - transport: str = "grpc_asyncio", request_type=service.DeleteMembershipRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteMembershipRequest(), + {}, + ], +) +async def test_delete_membership_async(request_type, transport: str = "grpc_asyncio"): client = GkeHubAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4412,7 +4443,7 @@ async def test_delete_membership_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( @@ -4434,11 +4465,6 @@ async def test_delete_membership_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_membership_async_from_dict(): - await test_delete_membership_async(request_type=dict) - - def test_delete_membership_field_headers(): client = GkeHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4593,8 +4619,8 @@ async def test_delete_membership_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DeleteFeatureRequest, - dict, + service.DeleteFeatureRequest(), + {}, ], ) def test_delete_feature(request_type, transport: str = "grpc"): @@ -4605,7 +4631,7 @@ def test_delete_feature(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_feature), "__call__") as call: @@ -4647,10 +4673,11 @@ def test_delete_feature_non_empty_request_with_auto_populated_field(): client.delete_feature(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteFeatureRequest( + request_msg = service.DeleteFeatureRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_feature_use_cached_wrapped_rpc(): @@ -4741,9 +4768,14 @@ async def test_delete_feature_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_feature_async( - transport: str = "grpc_asyncio", request_type=service.DeleteFeatureRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteFeatureRequest(), + {}, + ], +) +async def test_delete_feature_async(request_type, transport: str = "grpc_asyncio"): client = GkeHubAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4751,7 +4783,7 @@ async def test_delete_feature_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_feature), "__call__") as call: @@ -4771,11 +4803,6 @@ async def test_delete_feature_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_feature_async_from_dict(): - await test_delete_feature_async(request_type=dict) - - def test_delete_feature_field_headers(): client = GkeHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4922,8 +4949,8 @@ async def test_delete_feature_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdateMembershipRequest, - dict, + service.UpdateMembershipRequest(), + {}, ], ) def test_update_membership(request_type, transport: str = "grpc"): @@ -4934,7 +4961,7 @@ def test_update_membership(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4980,10 +5007,11 @@ def test_update_membership_non_empty_request_with_auto_populated_field(): client.update_membership(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateMembershipRequest( + request_msg = service.UpdateMembershipRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_update_membership_use_cached_wrapped_rpc(): @@ -5076,9 +5104,14 @@ async def test_update_membership_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_membership_async( - transport: str = "grpc_asyncio", request_type=service.UpdateMembershipRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateMembershipRequest(), + {}, + ], +) +async def test_update_membership_async(request_type, transport: str = "grpc_asyncio"): client = GkeHubAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5086,7 +5119,7 @@ async def test_update_membership_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( @@ -5108,11 +5141,6 @@ async def test_update_membership_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_membership_async_from_dict(): - await test_update_membership_async(request_type=dict) - - def test_update_membership_field_headers(): client = GkeHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5319,8 +5347,8 @@ async def test_update_membership_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdateFeatureRequest, - dict, + service.UpdateFeatureRequest(), + {}, ], ) def test_update_feature(request_type, transport: str = "grpc"): @@ -5331,7 +5359,7 @@ def test_update_feature(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_feature), "__call__") as call: @@ -5373,10 +5401,11 @@ def test_update_feature_non_empty_request_with_auto_populated_field(): client.update_feature(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateFeatureRequest( + request_msg = service.UpdateFeatureRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_update_feature_use_cached_wrapped_rpc(): @@ -5467,9 +5496,14 @@ async def test_update_feature_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_feature_async( - transport: str = "grpc_asyncio", request_type=service.UpdateFeatureRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateFeatureRequest(), + {}, + ], +) +async def test_update_feature_async(request_type, transport: str = "grpc_asyncio"): client = GkeHubAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5477,7 +5511,7 @@ async def test_update_feature_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_feature), "__call__") as call: @@ -5497,11 +5531,6 @@ async def test_update_feature_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_feature_async_from_dict(): - await test_update_feature_async(request_type=dict) - - def test_update_feature_field_headers(): client = GkeHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5668,8 +5697,8 @@ async def test_update_feature_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.GenerateConnectManifestRequest, - dict, + service.GenerateConnectManifestRequest(), + {}, ], ) def test_generate_connect_manifest(request_type, transport: str = "grpc"): @@ -5680,7 +5709,7 @@ def test_generate_connect_manifest(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5728,12 +5757,13 @@ def test_generate_connect_manifest_non_empty_request_with_auto_populated_field() client.generate_connect_manifest(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GenerateConnectManifestRequest( + request_msg = service.GenerateConnectManifestRequest( name="name_value", namespace="namespace_value", version="version_value", registry="registry_value", ) + assert args[0] == request_msg def test_generate_connect_manifest_use_cached_wrapped_rpc(): @@ -5819,8 +5849,15 @@ async def test_generate_connect_manifest_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.GenerateConnectManifestRequest(), + {}, + ], +) async def test_generate_connect_manifest_async( - transport: str = "grpc_asyncio", request_type=service.GenerateConnectManifestRequest + request_type, transport: str = "grpc_asyncio" ): client = GkeHubAsyncClient( credentials=async_anonymous_credentials(), @@ -5829,7 +5866,7 @@ async def test_generate_connect_manifest_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( @@ -5851,11 +5888,6 @@ async def test_generate_connect_manifest_async( assert isinstance(response, service.GenerateConnectManifestResponse) -@pytest.mark.asyncio -async def test_generate_connect_manifest_async_from_dict(): - await test_generate_connect_manifest_async(request_type=dict) - - def test_generate_connect_manifest_field_headers(): client = GkeHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5924,8 +5956,8 @@ async def test_generate_connect_manifest_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.CreateFleetRequest, - dict, + service.CreateFleetRequest(), + {}, ], ) def test_create_fleet(request_type, transport: str = "grpc"): @@ -5936,7 +5968,7 @@ def test_create_fleet(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_fleet), "__call__") as call: @@ -5977,9 +6009,10 @@ def test_create_fleet_non_empty_request_with_auto_populated_field(): client.create_fleet(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateFleetRequest( + request_msg = service.CreateFleetRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_fleet_use_cached_wrapped_rpc(): @@ -6070,9 +6103,14 @@ async def test_create_fleet_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_fleet_async( - transport: str = "grpc_asyncio", request_type=service.CreateFleetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CreateFleetRequest(), + {}, + ], +) +async def test_create_fleet_async(request_type, transport: str = "grpc_asyncio"): client = GkeHubAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6080,7 +6118,7 @@ async def test_create_fleet_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_fleet), "__call__") as call: @@ -6100,11 +6138,6 @@ async def test_create_fleet_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_fleet_async_from_dict(): - await test_create_fleet_async(request_type=dict) - - def test_create_fleet_field_headers(): client = GkeHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6261,8 +6294,8 @@ async def test_create_fleet_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.GetFleetRequest, - dict, + service.GetFleetRequest(), + {}, ], ) def test_get_fleet(request_type, transport: str = "grpc"): @@ -6273,7 +6306,7 @@ def test_get_fleet(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_fleet), "__call__") as call: @@ -6321,9 +6354,10 @@ def test_get_fleet_non_empty_request_with_auto_populated_field(): client.get_fleet(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetFleetRequest( + request_msg = service.GetFleetRequest( name="name_value", ) + assert args[0] == request_msg def test_get_fleet_use_cached_wrapped_rpc(): @@ -6402,9 +6436,14 @@ async def test_get_fleet_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_fleet_async( - transport: str = "grpc_asyncio", request_type=service.GetFleetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetFleetRequest(), + {}, + ], +) +async def test_get_fleet_async(request_type, transport: str = "grpc_asyncio"): client = GkeHubAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6412,7 +6451,7 @@ async def test_get_fleet_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_fleet), "__call__") as call: @@ -6439,11 +6478,6 @@ async def test_get_fleet_async( assert response.uid == "uid_value" -@pytest.mark.asyncio -async def test_get_fleet_async_from_dict(): - await test_get_fleet_async(request_type=dict) - - def test_get_fleet_field_headers(): client = GkeHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6586,8 +6620,8 @@ async def test_get_fleet_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdateFleetRequest, - dict, + service.UpdateFleetRequest(), + {}, ], ) def test_update_fleet(request_type, transport: str = "grpc"): @@ -6598,7 +6632,7 @@ def test_update_fleet(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_fleet), "__call__") as call: @@ -6637,7 +6671,8 @@ def test_update_fleet_non_empty_request_with_auto_populated_field(): client.update_fleet(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateFleetRequest() + request_msg = service.UpdateFleetRequest() + assert args[0] == request_msg def test_update_fleet_use_cached_wrapped_rpc(): @@ -6728,9 +6763,14 @@ async def test_update_fleet_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_fleet_async( - transport: str = "grpc_asyncio", request_type=service.UpdateFleetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateFleetRequest(), + {}, + ], +) +async def test_update_fleet_async(request_type, transport: str = "grpc_asyncio"): client = GkeHubAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6738,7 +6778,7 @@ async def test_update_fleet_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_fleet), "__call__") as call: @@ -6758,11 +6798,6 @@ async def test_update_fleet_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_fleet_async_from_dict(): - await test_update_fleet_async(request_type=dict) - - def test_update_fleet_field_headers(): client = GkeHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6919,8 +6954,8 @@ async def test_update_fleet_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DeleteFleetRequest, - dict, + service.DeleteFleetRequest(), + {}, ], ) def test_delete_fleet(request_type, transport: str = "grpc"): @@ -6931,7 +6966,7 @@ def test_delete_fleet(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_fleet), "__call__") as call: @@ -6972,9 +7007,10 @@ def test_delete_fleet_non_empty_request_with_auto_populated_field(): client.delete_fleet(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteFleetRequest( + request_msg = service.DeleteFleetRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_fleet_use_cached_wrapped_rpc(): @@ -7065,9 +7101,14 @@ async def test_delete_fleet_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_fleet_async( - transport: str = "grpc_asyncio", request_type=service.DeleteFleetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteFleetRequest(), + {}, + ], +) +async def test_delete_fleet_async(request_type, transport: str = "grpc_asyncio"): client = GkeHubAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7075,7 +7116,7 @@ async def test_delete_fleet_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_fleet), "__call__") as call: @@ -7095,11 +7136,6 @@ async def test_delete_fleet_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_fleet_async_from_dict(): - await test_delete_fleet_async(request_type=dict) - - def test_delete_fleet_field_headers(): client = GkeHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7246,8 +7282,8 @@ async def test_delete_fleet_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListFleetsRequest, - dict, + service.ListFleetsRequest(), + {}, ], ) def test_list_fleets(request_type, transport: str = "grpc"): @@ -7258,7 +7294,7 @@ def test_list_fleets(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_fleets), "__call__") as call: @@ -7303,10 +7339,11 @@ def test_list_fleets_non_empty_request_with_auto_populated_field(): client.list_fleets(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListFleetsRequest( + request_msg = service.ListFleetsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_fleets_use_cached_wrapped_rpc(): @@ -7387,9 +7424,14 @@ async def test_list_fleets_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_fleets_async( - transport: str = "grpc_asyncio", request_type=service.ListFleetsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListFleetsRequest(), + {}, + ], +) +async def test_list_fleets_async(request_type, transport: str = "grpc_asyncio"): client = GkeHubAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7397,7 +7439,7 @@ async def test_list_fleets_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_fleets), "__call__") as call: @@ -7420,11 +7462,6 @@ async def test_list_fleets_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_fleets_async_from_dict(): - await test_list_fleets_async(request_type=dict) - - def test_list_fleets_field_headers(): client = GkeHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7761,8 +7798,8 @@ async def test_list_fleets_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetScopeNamespaceRequest, - dict, + service.GetScopeNamespaceRequest(), + {}, ], ) def test_get_scope_namespace(request_type, transport: str = "grpc"): @@ -7773,7 +7810,7 @@ def test_get_scope_namespace(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7825,9 +7862,10 @@ def test_get_scope_namespace_non_empty_request_with_auto_populated_field(): client.get_scope_namespace(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetScopeNamespaceRequest( + request_msg = service.GetScopeNamespaceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_scope_namespace_use_cached_wrapped_rpc(): @@ -7912,9 +7950,14 @@ async def test_get_scope_namespace_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_scope_namespace_async( - transport: str = "grpc_asyncio", request_type=service.GetScopeNamespaceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetScopeNamespaceRequest(), + {}, + ], +) +async def test_get_scope_namespace_async(request_type, transport: str = "grpc_asyncio"): client = GkeHubAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7922,7 +7965,7 @@ async def test_get_scope_namespace_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( @@ -7951,11 +7994,6 @@ async def test_get_scope_namespace_async( assert response.scope == "scope_value" -@pytest.mark.asyncio -async def test_get_scope_namespace_async_from_dict(): - await test_get_scope_namespace_async(request_type=dict) - - def test_get_scope_namespace_field_headers(): client = GkeHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8106,8 +8144,8 @@ async def test_get_scope_namespace_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.CreateScopeNamespaceRequest, - dict, + service.CreateScopeNamespaceRequest(), + {}, ], ) def test_create_scope_namespace(request_type, transport: str = "grpc"): @@ -8118,7 +8156,7 @@ def test_create_scope_namespace(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8164,10 +8202,11 @@ def test_create_scope_namespace_non_empty_request_with_auto_populated_field(): client.create_scope_namespace(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateScopeNamespaceRequest( + request_msg = service.CreateScopeNamespaceRequest( parent="parent_value", scope_namespace_id="scope_namespace_id_value", ) + assert args[0] == request_msg def test_create_scope_namespace_use_cached_wrapped_rpc(): @@ -8263,8 +8302,15 @@ async def test_create_scope_namespace_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.CreateScopeNamespaceRequest(), + {}, + ], +) async def test_create_scope_namespace_async( - transport: str = "grpc_asyncio", request_type=service.CreateScopeNamespaceRequest + request_type, transport: str = "grpc_asyncio" ): client = GkeHubAsyncClient( credentials=async_anonymous_credentials(), @@ -8273,7 +8319,7 @@ async def test_create_scope_namespace_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( @@ -8295,11 +8341,6 @@ async def test_create_scope_namespace_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_scope_namespace_async_from_dict(): - await test_create_scope_namespace_async(request_type=dict) - - def test_create_scope_namespace_field_headers(): client = GkeHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8474,8 +8515,8 @@ async def test_create_scope_namespace_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdateScopeNamespaceRequest, - dict, + service.UpdateScopeNamespaceRequest(), + {}, ], ) def test_update_scope_namespace(request_type, transport: str = "grpc"): @@ -8486,7 +8527,7 @@ def test_update_scope_namespace(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8529,7 +8570,8 @@ def test_update_scope_namespace_non_empty_request_with_auto_populated_field(): client.update_scope_namespace(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateScopeNamespaceRequest() + request_msg = service.UpdateScopeNamespaceRequest() + assert args[0] == request_msg def test_update_scope_namespace_use_cached_wrapped_rpc(): @@ -8625,8 +8667,15 @@ async def test_update_scope_namespace_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateScopeNamespaceRequest(), + {}, + ], +) async def test_update_scope_namespace_async( - transport: str = "grpc_asyncio", request_type=service.UpdateScopeNamespaceRequest + request_type, transport: str = "grpc_asyncio" ): client = GkeHubAsyncClient( credentials=async_anonymous_credentials(), @@ -8635,7 +8684,7 @@ async def test_update_scope_namespace_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( @@ -8657,11 +8706,6 @@ async def test_update_scope_namespace_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_scope_namespace_async_from_dict(): - await test_update_scope_namespace_async(request_type=dict) - - def test_update_scope_namespace_field_headers(): client = GkeHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8826,8 +8870,8 @@ async def test_update_scope_namespace_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DeleteScopeNamespaceRequest, - dict, + service.DeleteScopeNamespaceRequest(), + {}, ], ) def test_delete_scope_namespace(request_type, transport: str = "grpc"): @@ -8838,7 +8882,7 @@ def test_delete_scope_namespace(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8883,9 +8927,10 @@ def test_delete_scope_namespace_non_empty_request_with_auto_populated_field(): client.delete_scope_namespace(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteScopeNamespaceRequest( + request_msg = service.DeleteScopeNamespaceRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_scope_namespace_use_cached_wrapped_rpc(): @@ -8981,8 +9026,15 @@ async def test_delete_scope_namespace_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteScopeNamespaceRequest(), + {}, + ], +) async def test_delete_scope_namespace_async( - transport: str = "grpc_asyncio", request_type=service.DeleteScopeNamespaceRequest + request_type, transport: str = "grpc_asyncio" ): client = GkeHubAsyncClient( credentials=async_anonymous_credentials(), @@ -8991,7 +9043,7 @@ async def test_delete_scope_namespace_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( @@ -9013,11 +9065,6 @@ async def test_delete_scope_namespace_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_scope_namespace_async_from_dict(): - await test_delete_scope_namespace_async(request_type=dict) - - def test_delete_scope_namespace_field_headers(): client = GkeHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9172,8 +9219,8 @@ async def test_delete_scope_namespace_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListScopeNamespacesRequest, - dict, + service.ListScopeNamespacesRequest(), + {}, ], ) def test_list_scope_namespaces(request_type, transport: str = "grpc"): @@ -9184,7 +9231,7 @@ def test_list_scope_namespaces(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9233,10 +9280,11 @@ def test_list_scope_namespaces_non_empty_request_with_auto_populated_field(): client.list_scope_namespaces(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListScopeNamespacesRequest( + request_msg = service.ListScopeNamespacesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_scope_namespaces_use_cached_wrapped_rpc(): @@ -9322,8 +9370,15 @@ async def test_list_scope_namespaces_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.ListScopeNamespacesRequest(), + {}, + ], +) async def test_list_scope_namespaces_async( - transport: str = "grpc_asyncio", request_type=service.ListScopeNamespacesRequest + request_type, transport: str = "grpc_asyncio" ): client = GkeHubAsyncClient( credentials=async_anonymous_credentials(), @@ -9332,7 +9387,7 @@ async def test_list_scope_namespaces_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( @@ -9357,11 +9412,6 @@ async def test_list_scope_namespaces_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_scope_namespaces_async_from_dict(): - await test_list_scope_namespaces_async(request_type=dict) - - def test_list_scope_namespaces_field_headers(): client = GkeHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9714,8 +9764,8 @@ async def test_list_scope_namespaces_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetScopeRBACRoleBindingRequest, - dict, + service.GetScopeRBACRoleBindingRequest(), + {}, ], ) def test_get_scope_rbac_role_binding(request_type, transport: str = "grpc"): @@ -9726,7 +9776,7 @@ def test_get_scope_rbac_role_binding(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9777,9 +9827,10 @@ def test_get_scope_rbac_role_binding_non_empty_request_with_auto_populated_field client.get_scope_rbac_role_binding(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetScopeRBACRoleBindingRequest( + request_msg = service.GetScopeRBACRoleBindingRequest( name="name_value", ) + assert args[0] == request_msg def test_get_scope_rbac_role_binding_use_cached_wrapped_rpc(): @@ -9865,8 +9916,15 @@ async def test_get_scope_rbac_role_binding_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.GetScopeRBACRoleBindingRequest(), + {}, + ], +) async def test_get_scope_rbac_role_binding_async( - transport: str = "grpc_asyncio", request_type=service.GetScopeRBACRoleBindingRequest + request_type, transport: str = "grpc_asyncio" ): client = GkeHubAsyncClient( credentials=async_anonymous_credentials(), @@ -9875,7 +9933,7 @@ async def test_get_scope_rbac_role_binding_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( @@ -9902,11 +9960,6 @@ async def test_get_scope_rbac_role_binding_async( assert response.uid == "uid_value" -@pytest.mark.asyncio -async def test_get_scope_rbac_role_binding_async_from_dict(): - await test_get_scope_rbac_role_binding_async(request_type=dict) - - def test_get_scope_rbac_role_binding_field_headers(): client = GkeHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10061,8 +10114,8 @@ async def test_get_scope_rbac_role_binding_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.CreateScopeRBACRoleBindingRequest, - dict, + service.CreateScopeRBACRoleBindingRequest(), + {}, ], ) def test_create_scope_rbac_role_binding(request_type, transport: str = "grpc"): @@ -10073,7 +10126,7 @@ def test_create_scope_rbac_role_binding(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10119,10 +10172,11 @@ def test_create_scope_rbac_role_binding_non_empty_request_with_auto_populated_fi client.create_scope_rbac_role_binding(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateScopeRBACRoleBindingRequest( + request_msg = service.CreateScopeRBACRoleBindingRequest( parent="parent_value", rbacrolebinding_id="rbacrolebinding_id_value", ) + assert args[0] == request_msg def test_create_scope_rbac_role_binding_use_cached_wrapped_rpc(): @@ -10218,9 +10272,15 @@ async def test_create_scope_rbac_role_binding_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.CreateScopeRBACRoleBindingRequest(), + {}, + ], +) async def test_create_scope_rbac_role_binding_async( - transport: str = "grpc_asyncio", - request_type=service.CreateScopeRBACRoleBindingRequest, + request_type, transport: str = "grpc_asyncio" ): client = GkeHubAsyncClient( credentials=async_anonymous_credentials(), @@ -10229,7 +10289,7 @@ async def test_create_scope_rbac_role_binding_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( @@ -10251,11 +10311,6 @@ async def test_create_scope_rbac_role_binding_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_scope_rbac_role_binding_async_from_dict(): - await test_create_scope_rbac_role_binding_async(request_type=dict) - - def test_create_scope_rbac_role_binding_field_headers(): client = GkeHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10430,8 +10485,8 @@ async def test_create_scope_rbac_role_binding_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdateScopeRBACRoleBindingRequest, - dict, + service.UpdateScopeRBACRoleBindingRequest(), + {}, ], ) def test_update_scope_rbac_role_binding(request_type, transport: str = "grpc"): @@ -10442,7 +10497,7 @@ def test_update_scope_rbac_role_binding(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10485,7 +10540,8 @@ def test_update_scope_rbac_role_binding_non_empty_request_with_auto_populated_fi client.update_scope_rbac_role_binding(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateScopeRBACRoleBindingRequest() + request_msg = service.UpdateScopeRBACRoleBindingRequest() + assert args[0] == request_msg def test_update_scope_rbac_role_binding_use_cached_wrapped_rpc(): @@ -10581,9 +10637,15 @@ async def test_update_scope_rbac_role_binding_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateScopeRBACRoleBindingRequest(), + {}, + ], +) async def test_update_scope_rbac_role_binding_async( - transport: str = "grpc_asyncio", - request_type=service.UpdateScopeRBACRoleBindingRequest, + request_type, transport: str = "grpc_asyncio" ): client = GkeHubAsyncClient( credentials=async_anonymous_credentials(), @@ -10592,7 +10654,7 @@ async def test_update_scope_rbac_role_binding_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( @@ -10614,11 +10676,6 @@ async def test_update_scope_rbac_role_binding_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_scope_rbac_role_binding_async_from_dict(): - await test_update_scope_rbac_role_binding_async(request_type=dict) - - def test_update_scope_rbac_role_binding_field_headers(): client = GkeHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10783,8 +10840,8 @@ async def test_update_scope_rbac_role_binding_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DeleteScopeRBACRoleBindingRequest, - dict, + service.DeleteScopeRBACRoleBindingRequest(), + {}, ], ) def test_delete_scope_rbac_role_binding(request_type, transport: str = "grpc"): @@ -10795,7 +10852,7 @@ def test_delete_scope_rbac_role_binding(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10840,9 +10897,10 @@ def test_delete_scope_rbac_role_binding_non_empty_request_with_auto_populated_fi client.delete_scope_rbac_role_binding(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteScopeRBACRoleBindingRequest( + request_msg = service.DeleteScopeRBACRoleBindingRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_scope_rbac_role_binding_use_cached_wrapped_rpc(): @@ -10938,9 +10996,15 @@ async def test_delete_scope_rbac_role_binding_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteScopeRBACRoleBindingRequest(), + {}, + ], +) async def test_delete_scope_rbac_role_binding_async( - transport: str = "grpc_asyncio", - request_type=service.DeleteScopeRBACRoleBindingRequest, + request_type, transport: str = "grpc_asyncio" ): client = GkeHubAsyncClient( credentials=async_anonymous_credentials(), @@ -10949,7 +11013,7 @@ async def test_delete_scope_rbac_role_binding_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( @@ -10971,11 +11035,6 @@ async def test_delete_scope_rbac_role_binding_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_scope_rbac_role_binding_async_from_dict(): - await test_delete_scope_rbac_role_binding_async(request_type=dict) - - def test_delete_scope_rbac_role_binding_field_headers(): client = GkeHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11130,8 +11189,8 @@ async def test_delete_scope_rbac_role_binding_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListScopeRBACRoleBindingsRequest, - dict, + service.ListScopeRBACRoleBindingsRequest(), + {}, ], ) def test_list_scope_rbac_role_bindings(request_type, transport: str = "grpc"): @@ -11142,7 +11201,7 @@ def test_list_scope_rbac_role_bindings(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11191,10 +11250,11 @@ def test_list_scope_rbac_role_bindings_non_empty_request_with_auto_populated_fie client.list_scope_rbac_role_bindings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListScopeRBACRoleBindingsRequest( + request_msg = service.ListScopeRBACRoleBindingsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_scope_rbac_role_bindings_use_cached_wrapped_rpc(): @@ -11280,9 +11340,15 @@ async def test_list_scope_rbac_role_bindings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.ListScopeRBACRoleBindingsRequest(), + {}, + ], +) async def test_list_scope_rbac_role_bindings_async( - transport: str = "grpc_asyncio", - request_type=service.ListScopeRBACRoleBindingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = GkeHubAsyncClient( credentials=async_anonymous_credentials(), @@ -11291,7 +11357,7 @@ async def test_list_scope_rbac_role_bindings_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( @@ -11316,11 +11382,6 @@ async def test_list_scope_rbac_role_bindings_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_scope_rbac_role_bindings_async_from_dict(): - await test_list_scope_rbac_role_bindings_async(request_type=dict) - - def test_list_scope_rbac_role_bindings_field_headers(): client = GkeHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11677,8 +11738,8 @@ async def test_list_scope_rbac_role_bindings_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetScopeRequest, - dict, + service.GetScopeRequest(), + {}, ], ) def test_get_scope(request_type, transport: str = "grpc"): @@ -11689,7 +11750,7 @@ def test_get_scope(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_scope), "__call__") as call: @@ -11735,9 +11796,10 @@ def test_get_scope_non_empty_request_with_auto_populated_field(): client.get_scope(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetScopeRequest( + request_msg = service.GetScopeRequest( name="name_value", ) + assert args[0] == request_msg def test_get_scope_use_cached_wrapped_rpc(): @@ -11816,9 +11878,14 @@ async def test_get_scope_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_scope_async( - transport: str = "grpc_asyncio", request_type=service.GetScopeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetScopeRequest(), + {}, + ], +) +async def test_get_scope_async(request_type, transport: str = "grpc_asyncio"): client = GkeHubAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11826,7 +11893,7 @@ async def test_get_scope_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_scope), "__call__") as call: @@ -11851,11 +11918,6 @@ async def test_get_scope_async( assert response.uid == "uid_value" -@pytest.mark.asyncio -async def test_get_scope_async_from_dict(): - await test_get_scope_async(request_type=dict) - - def test_get_scope_field_headers(): client = GkeHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11998,8 +12060,8 @@ async def test_get_scope_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.CreateScopeRequest, - dict, + service.CreateScopeRequest(), + {}, ], ) def test_create_scope(request_type, transport: str = "grpc"): @@ -12010,7 +12072,7 @@ def test_create_scope(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_scope), "__call__") as call: @@ -12052,10 +12114,11 @@ def test_create_scope_non_empty_request_with_auto_populated_field(): client.create_scope(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateScopeRequest( + request_msg = service.CreateScopeRequest( parent="parent_value", scope_id="scope_id_value", ) + assert args[0] == request_msg def test_create_scope_use_cached_wrapped_rpc(): @@ -12146,9 +12209,14 @@ async def test_create_scope_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_scope_async( - transport: str = "grpc_asyncio", request_type=service.CreateScopeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CreateScopeRequest(), + {}, + ], +) +async def test_create_scope_async(request_type, transport: str = "grpc_asyncio"): client = GkeHubAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12156,7 +12224,7 @@ async def test_create_scope_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_scope), "__call__") as call: @@ -12176,11 +12244,6 @@ async def test_create_scope_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_scope_async_from_dict(): - await test_create_scope_async(request_type=dict) - - def test_create_scope_field_headers(): client = GkeHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12347,8 +12410,8 @@ async def test_create_scope_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdateScopeRequest, - dict, + service.UpdateScopeRequest(), + {}, ], ) def test_update_scope(request_type, transport: str = "grpc"): @@ -12359,7 +12422,7 @@ def test_update_scope(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_scope), "__call__") as call: @@ -12398,7 +12461,8 @@ def test_update_scope_non_empty_request_with_auto_populated_field(): client.update_scope(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateScopeRequest() + request_msg = service.UpdateScopeRequest() + assert args[0] == request_msg def test_update_scope_use_cached_wrapped_rpc(): @@ -12489,9 +12553,14 @@ async def test_update_scope_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_scope_async( - transport: str = "grpc_asyncio", request_type=service.UpdateScopeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateScopeRequest(), + {}, + ], +) +async def test_update_scope_async(request_type, transport: str = "grpc_asyncio"): client = GkeHubAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12499,7 +12568,7 @@ async def test_update_scope_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_scope), "__call__") as call: @@ -12519,11 +12588,6 @@ async def test_update_scope_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_scope_async_from_dict(): - await test_update_scope_async(request_type=dict) - - def test_update_scope_field_headers(): client = GkeHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12680,8 +12744,8 @@ async def test_update_scope_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DeleteScopeRequest, - dict, + service.DeleteScopeRequest(), + {}, ], ) def test_delete_scope(request_type, transport: str = "grpc"): @@ -12692,7 +12756,7 @@ def test_delete_scope(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_scope), "__call__") as call: @@ -12733,9 +12797,10 @@ def test_delete_scope_non_empty_request_with_auto_populated_field(): client.delete_scope(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteScopeRequest( + request_msg = service.DeleteScopeRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_scope_use_cached_wrapped_rpc(): @@ -12826,9 +12891,14 @@ async def test_delete_scope_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_scope_async( - transport: str = "grpc_asyncio", request_type=service.DeleteScopeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteScopeRequest(), + {}, + ], +) +async def test_delete_scope_async(request_type, transport: str = "grpc_asyncio"): client = GkeHubAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12836,7 +12906,7 @@ async def test_delete_scope_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_scope), "__call__") as call: @@ -12856,11 +12926,6 @@ async def test_delete_scope_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_scope_async_from_dict(): - await test_delete_scope_async(request_type=dict) - - def test_delete_scope_field_headers(): client = GkeHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13007,8 +13072,8 @@ async def test_delete_scope_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListScopesRequest, - dict, + service.ListScopesRequest(), + {}, ], ) def test_list_scopes(request_type, transport: str = "grpc"): @@ -13019,7 +13084,7 @@ def test_list_scopes(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_scopes), "__call__") as call: @@ -13064,10 +13129,11 @@ def test_list_scopes_non_empty_request_with_auto_populated_field(): client.list_scopes(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListScopesRequest( + request_msg = service.ListScopesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_scopes_use_cached_wrapped_rpc(): @@ -13148,9 +13214,14 @@ async def test_list_scopes_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_scopes_async( - transport: str = "grpc_asyncio", request_type=service.ListScopesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListScopesRequest(), + {}, + ], +) +async def test_list_scopes_async(request_type, transport: str = "grpc_asyncio"): client = GkeHubAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13158,7 +13229,7 @@ async def test_list_scopes_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_scopes), "__call__") as call: @@ -13181,11 +13252,6 @@ async def test_list_scopes_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_scopes_async_from_dict(): - await test_list_scopes_async(request_type=dict) - - def test_list_scopes_field_headers(): client = GkeHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13522,8 +13588,8 @@ async def test_list_scopes_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.ListPermittedScopesRequest, - dict, + service.ListPermittedScopesRequest(), + {}, ], ) def test_list_permitted_scopes(request_type, transport: str = "grpc"): @@ -13534,7 +13600,7 @@ def test_list_permitted_scopes(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -13583,10 +13649,11 @@ def test_list_permitted_scopes_non_empty_request_with_auto_populated_field(): client.list_permitted_scopes(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListPermittedScopesRequest( + request_msg = service.ListPermittedScopesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_permitted_scopes_use_cached_wrapped_rpc(): @@ -13672,8 +13739,15 @@ async def test_list_permitted_scopes_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.ListPermittedScopesRequest(), + {}, + ], +) async def test_list_permitted_scopes_async( - transport: str = "grpc_asyncio", request_type=service.ListPermittedScopesRequest + request_type, transport: str = "grpc_asyncio" ): client = GkeHubAsyncClient( credentials=async_anonymous_credentials(), @@ -13682,7 +13756,7 @@ async def test_list_permitted_scopes_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( @@ -13707,11 +13781,6 @@ async def test_list_permitted_scopes_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_permitted_scopes_async_from_dict(): - await test_list_permitted_scopes_async(request_type=dict) - - def test_list_permitted_scopes_field_headers(): client = GkeHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14064,8 +14133,8 @@ async def test_list_permitted_scopes_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetMembershipBindingRequest, - dict, + service.GetMembershipBindingRequest(), + {}, ], ) def test_get_membership_binding(request_type, transport: str = "grpc"): @@ -14076,7 +14145,7 @@ def test_get_membership_binding(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -14127,9 +14196,10 @@ def test_get_membership_binding_non_empty_request_with_auto_populated_field(): client.get_membership_binding(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetMembershipBindingRequest( + request_msg = service.GetMembershipBindingRequest( name="name_value", ) + assert args[0] == request_msg def test_get_membership_binding_use_cached_wrapped_rpc(): @@ -14215,8 +14285,15 @@ async def test_get_membership_binding_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.GetMembershipBindingRequest(), + {}, + ], +) async def test_get_membership_binding_async( - transport: str = "grpc_asyncio", request_type=service.GetMembershipBindingRequest + request_type, transport: str = "grpc_asyncio" ): client = GkeHubAsyncClient( credentials=async_anonymous_credentials(), @@ -14225,7 +14302,7 @@ async def test_get_membership_binding_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( @@ -14252,11 +14329,6 @@ async def test_get_membership_binding_async( assert response.uid == "uid_value" -@pytest.mark.asyncio -async def test_get_membership_binding_async_from_dict(): - await test_get_membership_binding_async(request_type=dict) - - def test_get_membership_binding_field_headers(): client = GkeHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14411,8 +14483,8 @@ async def test_get_membership_binding_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.CreateMembershipBindingRequest, - dict, + service.CreateMembershipBindingRequest(), + {}, ], ) def test_create_membership_binding(request_type, transport: str = "grpc"): @@ -14423,7 +14495,7 @@ def test_create_membership_binding(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -14469,10 +14541,11 @@ def test_create_membership_binding_non_empty_request_with_auto_populated_field() client.create_membership_binding(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateMembershipBindingRequest( + request_msg = service.CreateMembershipBindingRequest( parent="parent_value", membership_binding_id="membership_binding_id_value", ) + assert args[0] == request_msg def test_create_membership_binding_use_cached_wrapped_rpc(): @@ -14568,8 +14641,15 @@ async def test_create_membership_binding_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.CreateMembershipBindingRequest(), + {}, + ], +) async def test_create_membership_binding_async( - transport: str = "grpc_asyncio", request_type=service.CreateMembershipBindingRequest + request_type, transport: str = "grpc_asyncio" ): client = GkeHubAsyncClient( credentials=async_anonymous_credentials(), @@ -14578,7 +14658,7 @@ async def test_create_membership_binding_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( @@ -14600,11 +14680,6 @@ async def test_create_membership_binding_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_membership_binding_async_from_dict(): - await test_create_membership_binding_async(request_type=dict) - - def test_create_membership_binding_field_headers(): client = GkeHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14779,8 +14854,8 @@ async def test_create_membership_binding_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdateMembershipBindingRequest, - dict, + service.UpdateMembershipBindingRequest(), + {}, ], ) def test_update_membership_binding(request_type, transport: str = "grpc"): @@ -14791,7 +14866,7 @@ def test_update_membership_binding(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -14834,7 +14909,8 @@ def test_update_membership_binding_non_empty_request_with_auto_populated_field() client.update_membership_binding(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateMembershipBindingRequest() + request_msg = service.UpdateMembershipBindingRequest() + assert args[0] == request_msg def test_update_membership_binding_use_cached_wrapped_rpc(): @@ -14930,8 +15006,15 @@ async def test_update_membership_binding_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateMembershipBindingRequest(), + {}, + ], +) async def test_update_membership_binding_async( - transport: str = "grpc_asyncio", request_type=service.UpdateMembershipBindingRequest + request_type, transport: str = "grpc_asyncio" ): client = GkeHubAsyncClient( credentials=async_anonymous_credentials(), @@ -14940,7 +15023,7 @@ async def test_update_membership_binding_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( @@ -14962,11 +15045,6 @@ async def test_update_membership_binding_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_membership_binding_async_from_dict(): - await test_update_membership_binding_async(request_type=dict) - - def test_update_membership_binding_field_headers(): client = GkeHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15131,8 +15209,8 @@ async def test_update_membership_binding_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DeleteMembershipBindingRequest, - dict, + service.DeleteMembershipBindingRequest(), + {}, ], ) def test_delete_membership_binding(request_type, transport: str = "grpc"): @@ -15143,7 +15221,7 @@ def test_delete_membership_binding(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -15188,9 +15266,10 @@ def test_delete_membership_binding_non_empty_request_with_auto_populated_field() client.delete_membership_binding(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteMembershipBindingRequest( + request_msg = service.DeleteMembershipBindingRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_membership_binding_use_cached_wrapped_rpc(): @@ -15286,8 +15365,15 @@ async def test_delete_membership_binding_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteMembershipBindingRequest(), + {}, + ], +) async def test_delete_membership_binding_async( - transport: str = "grpc_asyncio", request_type=service.DeleteMembershipBindingRequest + request_type, transport: str = "grpc_asyncio" ): client = GkeHubAsyncClient( credentials=async_anonymous_credentials(), @@ -15296,7 +15382,7 @@ async def test_delete_membership_binding_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( @@ -15318,11 +15404,6 @@ async def test_delete_membership_binding_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_membership_binding_async_from_dict(): - await test_delete_membership_binding_async(request_type=dict) - - def test_delete_membership_binding_field_headers(): client = GkeHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15477,8 +15558,8 @@ async def test_delete_membership_binding_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListMembershipBindingsRequest, - dict, + service.ListMembershipBindingsRequest(), + {}, ], ) def test_list_membership_bindings(request_type, transport: str = "grpc"): @@ -15489,7 +15570,7 @@ def test_list_membership_bindings(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -15541,11 +15622,12 @@ def test_list_membership_bindings_non_empty_request_with_auto_populated_field(): client.list_membership_bindings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListMembershipBindingsRequest( + request_msg = service.ListMembershipBindingsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_membership_bindings_use_cached_wrapped_rpc(): @@ -15631,8 +15713,15 @@ async def test_list_membership_bindings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.ListMembershipBindingsRequest(), + {}, + ], +) async def test_list_membership_bindings_async( - transport: str = "grpc_asyncio", request_type=service.ListMembershipBindingsRequest + request_type, transport: str = "grpc_asyncio" ): client = GkeHubAsyncClient( credentials=async_anonymous_credentials(), @@ -15641,7 +15730,7 @@ async def test_list_membership_bindings_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( @@ -15668,11 +15757,6 @@ async def test_list_membership_bindings_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_membership_bindings_async_from_dict(): - await test_list_membership_bindings_async(request_type=dict) - - def test_list_membership_bindings_field_headers(): client = GkeHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16027,8 +16111,8 @@ async def test_list_membership_bindings_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetMembershipRBACRoleBindingRequest, - dict, + service.GetMembershipRBACRoleBindingRequest(), + {}, ], ) def test_get_membership_rbac_role_binding(request_type, transport: str = "grpc"): @@ -16039,7 +16123,7 @@ def test_get_membership_rbac_role_binding(request_type, transport: str = "grpc") # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -16090,9 +16174,10 @@ def test_get_membership_rbac_role_binding_non_empty_request_with_auto_populated_ client.get_membership_rbac_role_binding(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetMembershipRBACRoleBindingRequest( + request_msg = service.GetMembershipRBACRoleBindingRequest( name="name_value", ) + assert args[0] == request_msg def test_get_membership_rbac_role_binding_use_cached_wrapped_rpc(): @@ -16178,9 +16263,15 @@ async def test_get_membership_rbac_role_binding_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.GetMembershipRBACRoleBindingRequest(), + {}, + ], +) async def test_get_membership_rbac_role_binding_async( - transport: str = "grpc_asyncio", - request_type=service.GetMembershipRBACRoleBindingRequest, + request_type, transport: str = "grpc_asyncio" ): client = GkeHubAsyncClient( credentials=async_anonymous_credentials(), @@ -16189,7 +16280,7 @@ async def test_get_membership_rbac_role_binding_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( @@ -16216,11 +16307,6 @@ async def test_get_membership_rbac_role_binding_async( assert response.uid == "uid_value" -@pytest.mark.asyncio -async def test_get_membership_rbac_role_binding_async_from_dict(): - await test_get_membership_rbac_role_binding_async(request_type=dict) - - def test_get_membership_rbac_role_binding_field_headers(): client = GkeHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16375,8 +16461,8 @@ async def test_get_membership_rbac_role_binding_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.CreateMembershipRBACRoleBindingRequest, - dict, + service.CreateMembershipRBACRoleBindingRequest(), + {}, ], ) def test_create_membership_rbac_role_binding(request_type, transport: str = "grpc"): @@ -16387,7 +16473,7 @@ def test_create_membership_rbac_role_binding(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( @@ -16433,10 +16519,11 @@ def test_create_membership_rbac_role_binding_non_empty_request_with_auto_populat client.create_membership_rbac_role_binding(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateMembershipRBACRoleBindingRequest( + request_msg = service.CreateMembershipRBACRoleBindingRequest( parent="parent_value", rbacrolebinding_id="rbacrolebinding_id_value", ) + assert args[0] == request_msg def test_create_membership_rbac_role_binding_use_cached_wrapped_rpc(): @@ -16532,9 +16619,15 @@ async def test_create_membership_rbac_role_binding_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.CreateMembershipRBACRoleBindingRequest(), + {}, + ], +) async def test_create_membership_rbac_role_binding_async( - transport: str = "grpc_asyncio", - request_type=service.CreateMembershipRBACRoleBindingRequest, + request_type, transport: str = "grpc_asyncio" ): client = GkeHubAsyncClient( credentials=async_anonymous_credentials(), @@ -16543,7 +16636,7 @@ async def test_create_membership_rbac_role_binding_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( @@ -16565,11 +16658,6 @@ async def test_create_membership_rbac_role_binding_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_membership_rbac_role_binding_async_from_dict(): - await test_create_membership_rbac_role_binding_async(request_type=dict) - - def test_create_membership_rbac_role_binding_field_headers(): client = GkeHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16744,8 +16832,8 @@ async def test_create_membership_rbac_role_binding_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdateMembershipRBACRoleBindingRequest, - dict, + service.UpdateMembershipRBACRoleBindingRequest(), + {}, ], ) def test_update_membership_rbac_role_binding(request_type, transport: str = "grpc"): @@ -16756,7 +16844,7 @@ def test_update_membership_rbac_role_binding(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( @@ -16799,7 +16887,8 @@ def test_update_membership_rbac_role_binding_non_empty_request_with_auto_populat client.update_membership_rbac_role_binding(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateMembershipRBACRoleBindingRequest() + request_msg = service.UpdateMembershipRBACRoleBindingRequest() + assert args[0] == request_msg def test_update_membership_rbac_role_binding_use_cached_wrapped_rpc(): @@ -16895,9 +16984,15 @@ async def test_update_membership_rbac_role_binding_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateMembershipRBACRoleBindingRequest(), + {}, + ], +) async def test_update_membership_rbac_role_binding_async( - transport: str = "grpc_asyncio", - request_type=service.UpdateMembershipRBACRoleBindingRequest, + request_type, transport: str = "grpc_asyncio" ): client = GkeHubAsyncClient( credentials=async_anonymous_credentials(), @@ -16906,7 +17001,7 @@ async def test_update_membership_rbac_role_binding_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( @@ -16928,11 +17023,6 @@ async def test_update_membership_rbac_role_binding_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_membership_rbac_role_binding_async_from_dict(): - await test_update_membership_rbac_role_binding_async(request_type=dict) - - def test_update_membership_rbac_role_binding_field_headers(): client = GkeHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17097,8 +17187,8 @@ async def test_update_membership_rbac_role_binding_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DeleteMembershipRBACRoleBindingRequest, - dict, + service.DeleteMembershipRBACRoleBindingRequest(), + {}, ], ) def test_delete_membership_rbac_role_binding(request_type, transport: str = "grpc"): @@ -17109,7 +17199,7 @@ def test_delete_membership_rbac_role_binding(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( @@ -17154,9 +17244,10 @@ def test_delete_membership_rbac_role_binding_non_empty_request_with_auto_populat client.delete_membership_rbac_role_binding(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteMembershipRBACRoleBindingRequest( + request_msg = service.DeleteMembershipRBACRoleBindingRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_membership_rbac_role_binding_use_cached_wrapped_rpc(): @@ -17252,9 +17343,15 @@ async def test_delete_membership_rbac_role_binding_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteMembershipRBACRoleBindingRequest(), + {}, + ], +) async def test_delete_membership_rbac_role_binding_async( - transport: str = "grpc_asyncio", - request_type=service.DeleteMembershipRBACRoleBindingRequest, + request_type, transport: str = "grpc_asyncio" ): client = GkeHubAsyncClient( credentials=async_anonymous_credentials(), @@ -17263,7 +17360,7 @@ async def test_delete_membership_rbac_role_binding_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( @@ -17285,11 +17382,6 @@ async def test_delete_membership_rbac_role_binding_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_membership_rbac_role_binding_async_from_dict(): - await test_delete_membership_rbac_role_binding_async(request_type=dict) - - def test_delete_membership_rbac_role_binding_field_headers(): client = GkeHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17444,8 +17536,8 @@ async def test_delete_membership_rbac_role_binding_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListMembershipRBACRoleBindingsRequest, - dict, + service.ListMembershipRBACRoleBindingsRequest(), + {}, ], ) def test_list_membership_rbac_role_bindings(request_type, transport: str = "grpc"): @@ -17456,7 +17548,7 @@ def test_list_membership_rbac_role_bindings(request_type, transport: str = "grpc # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -17507,10 +17599,11 @@ def test_list_membership_rbac_role_bindings_non_empty_request_with_auto_populate client.list_membership_rbac_role_bindings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListMembershipRBACRoleBindingsRequest( + request_msg = service.ListMembershipRBACRoleBindingsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_membership_rbac_role_bindings_use_cached_wrapped_rpc(): @@ -17596,9 +17689,15 @@ async def test_list_membership_rbac_role_bindings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.ListMembershipRBACRoleBindingsRequest(), + {}, + ], +) async def test_list_membership_rbac_role_bindings_async( - transport: str = "grpc_asyncio", - request_type=service.ListMembershipRBACRoleBindingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = GkeHubAsyncClient( credentials=async_anonymous_credentials(), @@ -17607,7 +17706,7 @@ async def test_list_membership_rbac_role_bindings_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( @@ -17634,11 +17733,6 @@ async def test_list_membership_rbac_role_bindings_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_membership_rbac_role_bindings_async_from_dict(): - await test_list_membership_rbac_role_bindings_async(request_type=dict) - - def test_list_membership_rbac_role_bindings_field_headers(): client = GkeHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17995,8 +18089,8 @@ async def test_list_membership_rbac_role_bindings_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GenerateMembershipRBACRoleBindingYAMLRequest, - dict, + service.GenerateMembershipRBACRoleBindingYAMLRequest(), + {}, ], ) def test_generate_membership_rbac_role_binding_yaml( @@ -18009,7 +18103,7 @@ def test_generate_membership_rbac_role_binding_yaml( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -18058,10 +18152,11 @@ def test_generate_membership_rbac_role_binding_yaml_non_empty_request_with_auto_ client.generate_membership_rbac_role_binding_yaml(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GenerateMembershipRBACRoleBindingYAMLRequest( + request_msg = service.GenerateMembershipRBACRoleBindingYAMLRequest( parent="parent_value", rbacrolebinding_id="rbacrolebinding_id_value", ) + assert args[0] == request_msg def test_generate_membership_rbac_role_binding_yaml_use_cached_wrapped_rpc(): @@ -18147,9 +18242,15 @@ async def test_generate_membership_rbac_role_binding_yaml_async_use_cached_wrapp @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.GenerateMembershipRBACRoleBindingYAMLRequest(), + {}, + ], +) async def test_generate_membership_rbac_role_binding_yaml_async( - transport: str = "grpc_asyncio", - request_type=service.GenerateMembershipRBACRoleBindingYAMLRequest, + request_type, transport: str = "grpc_asyncio" ): client = GkeHubAsyncClient( credentials=async_anonymous_credentials(), @@ -18158,7 +18259,7 @@ async def test_generate_membership_rbac_role_binding_yaml_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( @@ -18183,11 +18284,6 @@ async def test_generate_membership_rbac_role_binding_yaml_async( assert response.role_bindings_yaml == "role_bindings_yaml_value" -@pytest.mark.asyncio -async def test_generate_membership_rbac_role_binding_yaml_async_from_dict(): - await test_generate_membership_rbac_role_binding_yaml_async(request_type=dict) - - def test_generate_membership_rbac_role_binding_yaml_field_headers(): client = GkeHubClient( credentials=ga_credentials.AnonymousCredentials(), @@ -26979,7 +27075,6 @@ def test_list_memberships_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListMembershipsRequest() - assert args[0] == request_msg @@ -27002,7 +27097,6 @@ def test_list_bound_memberships_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListBoundMembershipsRequest() - assert args[0] == request_msg @@ -27023,7 +27117,6 @@ def test_list_features_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListFeaturesRequest() - assert args[0] == request_msg @@ -27044,7 +27137,6 @@ def test_get_membership_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetMembershipRequest() - assert args[0] == request_msg @@ -27065,7 +27157,6 @@ def test_get_feature_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetFeatureRequest() - assert args[0] == request_msg @@ -27088,7 +27179,6 @@ def test_create_membership_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateMembershipRequest() - assert args[0] == request_msg @@ -27109,7 +27199,6 @@ def test_create_feature_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateFeatureRequest() - assert args[0] == request_msg @@ -27132,7 +27221,6 @@ def test_delete_membership_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteMembershipRequest() - assert args[0] == request_msg @@ -27153,7 +27241,6 @@ def test_delete_feature_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteFeatureRequest() - assert args[0] == request_msg @@ -27176,7 +27263,6 @@ def test_update_membership_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateMembershipRequest() - assert args[0] == request_msg @@ -27197,7 +27283,6 @@ def test_update_feature_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateFeatureRequest() - assert args[0] == request_msg @@ -27220,7 +27305,6 @@ def test_generate_connect_manifest_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GenerateConnectManifestRequest() - assert args[0] == request_msg @@ -27241,7 +27325,6 @@ def test_create_fleet_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateFleetRequest() - assert args[0] == request_msg @@ -27262,7 +27345,6 @@ def test_get_fleet_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetFleetRequest() - assert args[0] == request_msg @@ -27283,7 +27365,6 @@ def test_update_fleet_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateFleetRequest() - assert args[0] == request_msg @@ -27304,7 +27385,6 @@ def test_delete_fleet_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteFleetRequest() - assert args[0] == request_msg @@ -27325,7 +27405,6 @@ def test_list_fleets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListFleetsRequest() - assert args[0] == request_msg @@ -27348,7 +27427,6 @@ def test_get_scope_namespace_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetScopeNamespaceRequest() - assert args[0] == request_msg @@ -27371,7 +27449,6 @@ def test_create_scope_namespace_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateScopeNamespaceRequest() - assert args[0] == request_msg @@ -27394,7 +27471,6 @@ def test_update_scope_namespace_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateScopeNamespaceRequest() - assert args[0] == request_msg @@ -27417,7 +27493,6 @@ def test_delete_scope_namespace_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteScopeNamespaceRequest() - assert args[0] == request_msg @@ -27440,7 +27515,6 @@ def test_list_scope_namespaces_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListScopeNamespacesRequest() - assert args[0] == request_msg @@ -27463,7 +27537,6 @@ def test_get_scope_rbac_role_binding_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetScopeRBACRoleBindingRequest() - assert args[0] == request_msg @@ -27486,7 +27559,6 @@ def test_create_scope_rbac_role_binding_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateScopeRBACRoleBindingRequest() - assert args[0] == request_msg @@ -27509,7 +27581,6 @@ def test_update_scope_rbac_role_binding_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateScopeRBACRoleBindingRequest() - assert args[0] == request_msg @@ -27532,7 +27603,6 @@ def test_delete_scope_rbac_role_binding_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteScopeRBACRoleBindingRequest() - assert args[0] == request_msg @@ -27555,7 +27625,6 @@ def test_list_scope_rbac_role_bindings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListScopeRBACRoleBindingsRequest() - assert args[0] == request_msg @@ -27576,7 +27645,6 @@ def test_get_scope_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetScopeRequest() - assert args[0] == request_msg @@ -27597,7 +27665,6 @@ def test_create_scope_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateScopeRequest() - assert args[0] == request_msg @@ -27618,7 +27685,6 @@ def test_update_scope_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateScopeRequest() - assert args[0] == request_msg @@ -27639,7 +27705,6 @@ def test_delete_scope_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteScopeRequest() - assert args[0] == request_msg @@ -27660,7 +27725,6 @@ def test_list_scopes_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListScopesRequest() - assert args[0] == request_msg @@ -27683,7 +27747,6 @@ def test_list_permitted_scopes_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListPermittedScopesRequest() - assert args[0] == request_msg @@ -27706,7 +27769,6 @@ def test_get_membership_binding_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetMembershipBindingRequest() - assert args[0] == request_msg @@ -27729,7 +27791,6 @@ def test_create_membership_binding_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateMembershipBindingRequest() - assert args[0] == request_msg @@ -27752,7 +27813,6 @@ def test_update_membership_binding_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateMembershipBindingRequest() - assert args[0] == request_msg @@ -27775,7 +27835,6 @@ def test_delete_membership_binding_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteMembershipBindingRequest() - assert args[0] == request_msg @@ -27798,7 +27857,6 @@ def test_list_membership_bindings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListMembershipBindingsRequest() - assert args[0] == request_msg @@ -27821,7 +27879,6 @@ def test_get_membership_rbac_role_binding_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetMembershipRBACRoleBindingRequest() - assert args[0] == request_msg @@ -27844,7 +27901,6 @@ def test_create_membership_rbac_role_binding_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateMembershipRBACRoleBindingRequest() - assert args[0] == request_msg @@ -27867,7 +27923,6 @@ def test_update_membership_rbac_role_binding_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateMembershipRBACRoleBindingRequest() - assert args[0] == request_msg @@ -27890,7 +27945,6 @@ def test_delete_membership_rbac_role_binding_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteMembershipRBACRoleBindingRequest() - assert args[0] == request_msg @@ -27913,7 +27967,6 @@ def test_list_membership_rbac_role_bindings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListMembershipRBACRoleBindingsRequest() - assert args[0] == request_msg @@ -27936,7 +27989,6 @@ def test_generate_membership_rbac_role_binding_yaml_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GenerateMembershipRBACRoleBindingYAMLRequest() - assert args[0] == request_msg @@ -27978,7 +28030,6 @@ async def test_list_memberships_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListMembershipsRequest() - assert args[0] == request_msg @@ -28008,7 +28059,6 @@ async def test_list_bound_memberships_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListBoundMembershipsRequest() - assert args[0] == request_msg @@ -28035,7 +28085,6 @@ async def test_list_features_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListFeaturesRequest() - assert args[0] == request_msg @@ -28065,7 +28114,6 @@ async def test_get_membership_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetMembershipRequest() - assert args[0] == request_msg @@ -28093,7 +28141,6 @@ async def test_get_feature_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetFeatureRequest() - assert args[0] == request_msg @@ -28120,7 +28167,6 @@ async def test_create_membership_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateMembershipRequest() - assert args[0] == request_msg @@ -28145,7 +28191,6 @@ async def test_create_feature_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateFeatureRequest() - assert args[0] == request_msg @@ -28172,7 +28217,6 @@ async def test_delete_membership_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteMembershipRequest() - assert args[0] == request_msg @@ -28197,7 +28241,6 @@ async def test_delete_feature_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteFeatureRequest() - assert args[0] == request_msg @@ -28224,7 +28267,6 @@ async def test_update_membership_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateMembershipRequest() - assert args[0] == request_msg @@ -28249,7 +28291,6 @@ async def test_update_feature_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateFeatureRequest() - assert args[0] == request_msg @@ -28276,7 +28317,6 @@ async def test_generate_connect_manifest_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GenerateConnectManifestRequest() - assert args[0] == request_msg @@ -28301,7 +28341,6 @@ async def test_create_fleet_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateFleetRequest() - assert args[0] == request_msg @@ -28330,7 +28369,6 @@ async def test_get_fleet_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetFleetRequest() - assert args[0] == request_msg @@ -28355,7 +28393,6 @@ async def test_update_fleet_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateFleetRequest() - assert args[0] == request_msg @@ -28380,7 +28417,6 @@ async def test_delete_fleet_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteFleetRequest() - assert args[0] == request_msg @@ -28407,7 +28443,6 @@ async def test_list_fleets_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListFleetsRequest() - assert args[0] == request_msg @@ -28438,7 +28473,6 @@ async def test_get_scope_namespace_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetScopeNamespaceRequest() - assert args[0] == request_msg @@ -28465,7 +28499,6 @@ async def test_create_scope_namespace_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateScopeNamespaceRequest() - assert args[0] == request_msg @@ -28492,7 +28525,6 @@ async def test_update_scope_namespace_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateScopeNamespaceRequest() - assert args[0] == request_msg @@ -28519,7 +28551,6 @@ async def test_delete_scope_namespace_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteScopeNamespaceRequest() - assert args[0] == request_msg @@ -28548,7 +28579,6 @@ async def test_list_scope_namespaces_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListScopeNamespacesRequest() - assert args[0] == request_msg @@ -28578,7 +28608,6 @@ async def test_get_scope_rbac_role_binding_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetScopeRBACRoleBindingRequest() - assert args[0] == request_msg @@ -28605,7 +28634,6 @@ async def test_create_scope_rbac_role_binding_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateScopeRBACRoleBindingRequest() - assert args[0] == request_msg @@ -28632,7 +28660,6 @@ async def test_update_scope_rbac_role_binding_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateScopeRBACRoleBindingRequest() - assert args[0] == request_msg @@ -28659,7 +28686,6 @@ async def test_delete_scope_rbac_role_binding_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteScopeRBACRoleBindingRequest() - assert args[0] == request_msg @@ -28688,7 +28714,6 @@ async def test_list_scope_rbac_role_bindings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListScopeRBACRoleBindingsRequest() - assert args[0] == request_msg @@ -28716,7 +28741,6 @@ async def test_get_scope_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetScopeRequest() - assert args[0] == request_msg @@ -28741,7 +28765,6 @@ async def test_create_scope_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateScopeRequest() - assert args[0] == request_msg @@ -28766,7 +28789,6 @@ async def test_update_scope_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateScopeRequest() - assert args[0] == request_msg @@ -28791,7 +28813,6 @@ async def test_delete_scope_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteScopeRequest() - assert args[0] == request_msg @@ -28818,7 +28839,6 @@ async def test_list_scopes_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListScopesRequest() - assert args[0] == request_msg @@ -28847,7 +28867,6 @@ async def test_list_permitted_scopes_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListPermittedScopesRequest() - assert args[0] == request_msg @@ -28877,7 +28896,6 @@ async def test_get_membership_binding_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetMembershipBindingRequest() - assert args[0] == request_msg @@ -28904,7 +28922,6 @@ async def test_create_membership_binding_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateMembershipBindingRequest() - assert args[0] == request_msg @@ -28931,7 +28948,6 @@ async def test_update_membership_binding_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateMembershipBindingRequest() - assert args[0] == request_msg @@ -28958,7 +28974,6 @@ async def test_delete_membership_binding_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteMembershipBindingRequest() - assert args[0] == request_msg @@ -28988,7 +29003,6 @@ async def test_list_membership_bindings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListMembershipBindingsRequest() - assert args[0] == request_msg @@ -29018,7 +29032,6 @@ async def test_get_membership_rbac_role_binding_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetMembershipRBACRoleBindingRequest() - assert args[0] == request_msg @@ -29045,7 +29058,6 @@ async def test_create_membership_rbac_role_binding_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateMembershipRBACRoleBindingRequest() - assert args[0] == request_msg @@ -29072,7 +29084,6 @@ async def test_update_membership_rbac_role_binding_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateMembershipRBACRoleBindingRequest() - assert args[0] == request_msg @@ -29099,7 +29110,6 @@ async def test_delete_membership_rbac_role_binding_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteMembershipRBACRoleBindingRequest() - assert args[0] == request_msg @@ -29129,7 +29139,6 @@ async def test_list_membership_rbac_role_bindings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListMembershipRBACRoleBindingsRequest() - assert args[0] == request_msg @@ -29158,7 +29167,6 @@ async def test_generate_membership_rbac_role_binding_yaml_empty_call_grpc_asynci call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GenerateMembershipRBACRoleBindingYAMLRequest() - assert args[0] == request_msg @@ -36246,7 +36254,6 @@ def test_list_memberships_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListMembershipsRequest() - assert args[0] == request_msg @@ -36268,7 +36275,6 @@ def test_list_bound_memberships_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListBoundMembershipsRequest() - assert args[0] == request_msg @@ -36288,7 +36294,6 @@ def test_list_features_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListFeaturesRequest() - assert args[0] == request_msg @@ -36308,7 +36313,6 @@ def test_get_membership_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetMembershipRequest() - assert args[0] == request_msg @@ -36328,7 +36332,6 @@ def test_get_feature_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetFeatureRequest() - assert args[0] == request_msg @@ -36350,7 +36353,6 @@ def test_create_membership_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateMembershipRequest() - assert args[0] == request_msg @@ -36370,7 +36372,6 @@ def test_create_feature_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateFeatureRequest() - assert args[0] == request_msg @@ -36392,7 +36393,6 @@ def test_delete_membership_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteMembershipRequest() - assert args[0] == request_msg @@ -36412,7 +36412,6 @@ def test_delete_feature_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteFeatureRequest() - assert args[0] == request_msg @@ -36434,7 +36433,6 @@ def test_update_membership_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateMembershipRequest() - assert args[0] == request_msg @@ -36454,7 +36452,6 @@ def test_update_feature_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateFeatureRequest() - assert args[0] == request_msg @@ -36476,7 +36473,6 @@ def test_generate_connect_manifest_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GenerateConnectManifestRequest() - assert args[0] == request_msg @@ -36496,7 +36492,6 @@ def test_create_fleet_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateFleetRequest() - assert args[0] == request_msg @@ -36516,7 +36511,6 @@ def test_get_fleet_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetFleetRequest() - assert args[0] == request_msg @@ -36536,7 +36530,6 @@ def test_update_fleet_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateFleetRequest() - assert args[0] == request_msg @@ -36556,7 +36549,6 @@ def test_delete_fleet_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteFleetRequest() - assert args[0] == request_msg @@ -36576,7 +36568,6 @@ def test_list_fleets_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListFleetsRequest() - assert args[0] == request_msg @@ -36598,7 +36589,6 @@ def test_get_scope_namespace_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetScopeNamespaceRequest() - assert args[0] == request_msg @@ -36620,7 +36610,6 @@ def test_create_scope_namespace_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateScopeNamespaceRequest() - assert args[0] == request_msg @@ -36642,7 +36631,6 @@ def test_update_scope_namespace_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateScopeNamespaceRequest() - assert args[0] == request_msg @@ -36664,7 +36652,6 @@ def test_delete_scope_namespace_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteScopeNamespaceRequest() - assert args[0] == request_msg @@ -36686,7 +36673,6 @@ def test_list_scope_namespaces_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListScopeNamespacesRequest() - assert args[0] == request_msg @@ -36708,7 +36694,6 @@ def test_get_scope_rbac_role_binding_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetScopeRBACRoleBindingRequest() - assert args[0] == request_msg @@ -36730,7 +36715,6 @@ def test_create_scope_rbac_role_binding_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateScopeRBACRoleBindingRequest() - assert args[0] == request_msg @@ -36752,7 +36736,6 @@ def test_update_scope_rbac_role_binding_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateScopeRBACRoleBindingRequest() - assert args[0] == request_msg @@ -36774,7 +36757,6 @@ def test_delete_scope_rbac_role_binding_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteScopeRBACRoleBindingRequest() - assert args[0] == request_msg @@ -36796,7 +36778,6 @@ def test_list_scope_rbac_role_bindings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListScopeRBACRoleBindingsRequest() - assert args[0] == request_msg @@ -36816,7 +36797,6 @@ def test_get_scope_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetScopeRequest() - assert args[0] == request_msg @@ -36836,7 +36816,6 @@ def test_create_scope_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateScopeRequest() - assert args[0] == request_msg @@ -36856,7 +36835,6 @@ def test_update_scope_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateScopeRequest() - assert args[0] == request_msg @@ -36876,7 +36854,6 @@ def test_delete_scope_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteScopeRequest() - assert args[0] == request_msg @@ -36896,7 +36873,6 @@ def test_list_scopes_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListScopesRequest() - assert args[0] == request_msg @@ -36918,7 +36894,6 @@ def test_list_permitted_scopes_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListPermittedScopesRequest() - assert args[0] == request_msg @@ -36940,7 +36915,6 @@ def test_get_membership_binding_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetMembershipBindingRequest() - assert args[0] == request_msg @@ -36962,7 +36936,6 @@ def test_create_membership_binding_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateMembershipBindingRequest() - assert args[0] == request_msg @@ -36984,7 +36957,6 @@ def test_update_membership_binding_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateMembershipBindingRequest() - assert args[0] == request_msg @@ -37006,7 +36978,6 @@ def test_delete_membership_binding_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteMembershipBindingRequest() - assert args[0] == request_msg @@ -37028,7 +36999,6 @@ def test_list_membership_bindings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListMembershipBindingsRequest() - assert args[0] == request_msg @@ -37050,7 +37020,6 @@ def test_get_membership_rbac_role_binding_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetMembershipRBACRoleBindingRequest() - assert args[0] == request_msg @@ -37072,7 +37041,6 @@ def test_create_membership_rbac_role_binding_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateMembershipRBACRoleBindingRequest() - assert args[0] == request_msg @@ -37094,7 +37062,6 @@ def test_update_membership_rbac_role_binding_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateMembershipRBACRoleBindingRequest() - assert args[0] == request_msg @@ -37116,7 +37083,6 @@ def test_delete_membership_rbac_role_binding_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteMembershipRBACRoleBindingRequest() - assert args[0] == request_msg @@ -37138,7 +37104,6 @@ def test_list_membership_rbac_role_bindings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListMembershipRBACRoleBindingsRequest() - assert args[0] == request_msg @@ -37160,7 +37125,6 @@ def test_generate_membership_rbac_role_binding_yaml_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GenerateMembershipRBACRoleBindingYAMLRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-gke-hub/tests/unit/gapic/gkehub_v1beta1/test_gke_hub_membership_service.py b/packages/google-cloud-gke-hub/tests/unit/gapic/gkehub_v1beta1/test_gke_hub_membership_service.py index 852e6a148352..491a9c7425b8 100644 --- a/packages/google-cloud-gke-hub/tests/unit/gapic/gkehub_v1beta1/test_gke_hub_membership_service.py +++ b/packages/google-cloud-gke-hub/tests/unit/gapic/gkehub_v1beta1/test_gke_hub_membership_service.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 @@ -122,6 +123,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" @@ -1391,8 +1407,8 @@ def test_gke_hub_membership_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - membership.ListMembershipsRequest, - dict, + membership.ListMembershipsRequest(), + {}, ], ) def test_list_memberships(request_type, transport: str = "grpc"): @@ -1403,7 +1419,7 @@ def test_list_memberships(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_memberships), "__call__") as call: @@ -1452,12 +1468,13 @@ def test_list_memberships_non_empty_request_with_auto_populated_field(): client.list_memberships(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == membership.ListMembershipsRequest( + request_msg = membership.ListMembershipsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_memberships_use_cached_wrapped_rpc(): @@ -1540,9 +1557,14 @@ async def test_list_memberships_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_memberships_async( - transport: str = "grpc_asyncio", request_type=membership.ListMembershipsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + membership.ListMembershipsRequest(), + {}, + ], +) +async def test_list_memberships_async(request_type, transport: str = "grpc_asyncio"): client = GkeHubMembershipServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1550,7 +1572,7 @@ async def test_list_memberships_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_memberships), "__call__") as call: @@ -1575,11 +1597,6 @@ async def test_list_memberships_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_memberships_async_from_dict(): - await test_list_memberships_async(request_type=dict) - - def test_list_memberships_field_headers(): client = GkeHubMembershipServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1916,8 +1933,8 @@ async def test_list_memberships_async_pages(): @pytest.mark.parametrize( "request_type", [ - membership.GetMembershipRequest, - dict, + membership.GetMembershipRequest(), + {}, ], ) def test_get_membership(request_type, transport: str = "grpc"): @@ -1928,7 +1945,7 @@ def test_get_membership(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_membership), "__call__") as call: @@ -1982,9 +1999,10 @@ def test_get_membership_non_empty_request_with_auto_populated_field(): client.get_membership(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == membership.GetMembershipRequest( + request_msg = membership.GetMembershipRequest( name="name_value", ) + assert args[0] == request_msg def test_get_membership_use_cached_wrapped_rpc(): @@ -2065,9 +2083,14 @@ async def test_get_membership_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_membership_async( - transport: str = "grpc_asyncio", request_type=membership.GetMembershipRequest -): +@pytest.mark.parametrize( + "request_type", + [ + membership.GetMembershipRequest(), + {}, + ], +) +async def test_get_membership_async(request_type, transport: str = "grpc_asyncio"): client = GkeHubMembershipServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2075,7 +2098,7 @@ async def test_get_membership_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_membership), "__call__") as call: @@ -2108,11 +2131,6 @@ async def test_get_membership_async( ) -@pytest.mark.asyncio -async def test_get_membership_async_from_dict(): - await test_get_membership_async(request_type=dict) - - def test_get_membership_field_headers(): client = GkeHubMembershipServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2259,8 +2277,8 @@ async def test_get_membership_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - membership.CreateMembershipRequest, - dict, + membership.CreateMembershipRequest(), + {}, ], ) def test_create_membership(request_type, transport: str = "grpc"): @@ -2271,7 +2289,7 @@ def test_create_membership(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2318,11 +2336,12 @@ def test_create_membership_non_empty_request_with_auto_populated_field(): client.create_membership(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == membership.CreateMembershipRequest( + request_msg = membership.CreateMembershipRequest( parent="parent_value", membership_id="membership_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_membership_use_cached_wrapped_rpc(): @@ -2415,9 +2434,14 @@ async def test_create_membership_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_membership_async( - transport: str = "grpc_asyncio", request_type=membership.CreateMembershipRequest -): +@pytest.mark.parametrize( + "request_type", + [ + membership.CreateMembershipRequest(), + {}, + ], +) +async def test_create_membership_async(request_type, transport: str = "grpc_asyncio"): client = GkeHubMembershipServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2425,7 +2449,7 @@ async def test_create_membership_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( @@ -2447,11 +2471,6 @@ async def test_create_membership_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_membership_async_from_dict(): - await test_create_membership_async(request_type=dict) - - def test_create_membership_field_headers(): client = GkeHubMembershipServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2626,8 +2645,8 @@ async def test_create_membership_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - membership.DeleteMembershipRequest, - dict, + membership.DeleteMembershipRequest(), + {}, ], ) def test_delete_membership(request_type, transport: str = "grpc"): @@ -2638,7 +2657,7 @@ def test_delete_membership(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2684,10 +2703,11 @@ def test_delete_membership_non_empty_request_with_auto_populated_field(): client.delete_membership(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == membership.DeleteMembershipRequest( + request_msg = membership.DeleteMembershipRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_membership_use_cached_wrapped_rpc(): @@ -2780,9 +2800,14 @@ async def test_delete_membership_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_membership_async( - transport: str = "grpc_asyncio", request_type=membership.DeleteMembershipRequest -): +@pytest.mark.parametrize( + "request_type", + [ + membership.DeleteMembershipRequest(), + {}, + ], +) +async def test_delete_membership_async(request_type, transport: str = "grpc_asyncio"): client = GkeHubMembershipServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2790,7 +2815,7 @@ async def test_delete_membership_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( @@ -2812,11 +2837,6 @@ async def test_delete_membership_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_membership_async_from_dict(): - await test_delete_membership_async(request_type=dict) - - def test_delete_membership_field_headers(): client = GkeHubMembershipServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2971,8 +2991,8 @@ async def test_delete_membership_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - membership.UpdateMembershipRequest, - dict, + membership.UpdateMembershipRequest(), + {}, ], ) def test_update_membership(request_type, transport: str = "grpc"): @@ -2983,7 +3003,7 @@ def test_update_membership(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3029,10 +3049,11 @@ def test_update_membership_non_empty_request_with_auto_populated_field(): client.update_membership(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == membership.UpdateMembershipRequest( + request_msg = membership.UpdateMembershipRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_update_membership_use_cached_wrapped_rpc(): @@ -3125,9 +3146,14 @@ async def test_update_membership_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_membership_async( - transport: str = "grpc_asyncio", request_type=membership.UpdateMembershipRequest -): +@pytest.mark.parametrize( + "request_type", + [ + membership.UpdateMembershipRequest(), + {}, + ], +) +async def test_update_membership_async(request_type, transport: str = "grpc_asyncio"): client = GkeHubMembershipServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3135,7 +3161,7 @@ async def test_update_membership_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( @@ -3157,11 +3183,6 @@ async def test_update_membership_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_membership_async_from_dict(): - await test_update_membership_async(request_type=dict) - - def test_update_membership_field_headers(): client = GkeHubMembershipServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3336,8 +3357,8 @@ async def test_update_membership_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - membership.GenerateConnectManifestRequest, - dict, + membership.GenerateConnectManifestRequest(), + {}, ], ) def test_generate_connect_manifest(request_type, transport: str = "grpc"): @@ -3348,7 +3369,7 @@ def test_generate_connect_manifest(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3395,11 +3416,12 @@ def test_generate_connect_manifest_non_empty_request_with_auto_populated_field() client.generate_connect_manifest(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == membership.GenerateConnectManifestRequest( + request_msg = membership.GenerateConnectManifestRequest( name="name_value", version="version_value", registry="registry_value", ) + assert args[0] == request_msg def test_generate_connect_manifest_use_cached_wrapped_rpc(): @@ -3485,9 +3507,15 @@ async def test_generate_connect_manifest_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + membership.GenerateConnectManifestRequest(), + {}, + ], +) async def test_generate_connect_manifest_async( - transport: str = "grpc_asyncio", - request_type=membership.GenerateConnectManifestRequest, + request_type, transport: str = "grpc_asyncio" ): client = GkeHubMembershipServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3496,7 +3524,7 @@ async def test_generate_connect_manifest_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( @@ -3518,11 +3546,6 @@ async def test_generate_connect_manifest_async( assert isinstance(response, membership.GenerateConnectManifestResponse) -@pytest.mark.asyncio -async def test_generate_connect_manifest_async_from_dict(): - await test_generate_connect_manifest_async(request_type=dict) - - def test_generate_connect_manifest_field_headers(): client = GkeHubMembershipServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3591,8 +3614,8 @@ async def test_generate_connect_manifest_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - membership.ValidateExclusivityRequest, - dict, + membership.ValidateExclusivityRequest(), + {}, ], ) def test_validate_exclusivity(request_type, transport: str = "grpc"): @@ -3603,7 +3626,7 @@ def test_validate_exclusivity(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3650,11 +3673,12 @@ def test_validate_exclusivity_non_empty_request_with_auto_populated_field(): client.validate_exclusivity(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == membership.ValidateExclusivityRequest( + request_msg = membership.ValidateExclusivityRequest( parent="parent_value", cr_manifest="cr_manifest_value", intended_membership="intended_membership_value", ) + assert args[0] == request_msg def test_validate_exclusivity_use_cached_wrapped_rpc(): @@ -3739,8 +3763,15 @@ async def test_validate_exclusivity_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + membership.ValidateExclusivityRequest(), + {}, + ], +) async def test_validate_exclusivity_async( - transport: str = "grpc_asyncio", request_type=membership.ValidateExclusivityRequest + request_type, transport: str = "grpc_asyncio" ): client = GkeHubMembershipServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3749,7 +3780,7 @@ async def test_validate_exclusivity_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( @@ -3771,11 +3802,6 @@ async def test_validate_exclusivity_async( assert isinstance(response, membership.ValidateExclusivityResponse) -@pytest.mark.asyncio -async def test_validate_exclusivity_async_from_dict(): - await test_validate_exclusivity_async(request_type=dict) - - def test_validate_exclusivity_field_headers(): client = GkeHubMembershipServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3844,8 +3870,8 @@ async def test_validate_exclusivity_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - membership.GenerateExclusivityManifestRequest, - dict, + membership.GenerateExclusivityManifestRequest(), + {}, ], ) def test_generate_exclusivity_manifest(request_type, transport: str = "grpc"): @@ -3856,7 +3882,7 @@ def test_generate_exclusivity_manifest(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3908,11 +3934,12 @@ def test_generate_exclusivity_manifest_non_empty_request_with_auto_populated_fie client.generate_exclusivity_manifest(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == membership.GenerateExclusivityManifestRequest( + request_msg = membership.GenerateExclusivityManifestRequest( name="name_value", crd_manifest="crd_manifest_value", cr_manifest="cr_manifest_value", ) + assert args[0] == request_msg def test_generate_exclusivity_manifest_use_cached_wrapped_rpc(): @@ -3998,9 +4025,15 @@ async def test_generate_exclusivity_manifest_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + membership.GenerateExclusivityManifestRequest(), + {}, + ], +) async def test_generate_exclusivity_manifest_async( - transport: str = "grpc_asyncio", - request_type=membership.GenerateExclusivityManifestRequest, + request_type, transport: str = "grpc_asyncio" ): client = GkeHubMembershipServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4009,7 +4042,7 @@ async def test_generate_exclusivity_manifest_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( @@ -4036,11 +4069,6 @@ async def test_generate_exclusivity_manifest_async( assert response.cr_manifest == "cr_manifest_value" -@pytest.mark.asyncio -async def test_generate_exclusivity_manifest_async_from_dict(): - await test_generate_exclusivity_manifest_async(request_type=dict) - - def test_generate_exclusivity_manifest_field_headers(): client = GkeHubMembershipServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5741,7 +5769,6 @@ def test_list_memberships_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = membership.ListMembershipsRequest() - assert args[0] == request_msg @@ -5762,7 +5789,6 @@ def test_get_membership_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = membership.GetMembershipRequest() - assert args[0] == request_msg @@ -5785,7 +5811,6 @@ def test_create_membership_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = membership.CreateMembershipRequest() - assert args[0] == request_msg @@ -5808,7 +5833,6 @@ def test_delete_membership_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = membership.DeleteMembershipRequest() - assert args[0] == request_msg @@ -5831,7 +5855,6 @@ def test_update_membership_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = membership.UpdateMembershipRequest() - assert args[0] == request_msg @@ -5854,7 +5877,6 @@ def test_generate_connect_manifest_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = membership.GenerateConnectManifestRequest() - assert args[0] == request_msg @@ -5877,7 +5899,6 @@ def test_validate_exclusivity_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = membership.ValidateExclusivityRequest() - assert args[0] == request_msg @@ -5900,7 +5921,6 @@ def test_generate_exclusivity_manifest_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = membership.GenerateExclusivityManifestRequest() - assert args[0] == request_msg @@ -5942,7 +5962,6 @@ async def test_list_memberships_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = membership.ListMembershipsRequest() - assert args[0] == request_msg @@ -5973,7 +5992,6 @@ async def test_get_membership_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = membership.GetMembershipRequest() - assert args[0] == request_msg @@ -6000,7 +6018,6 @@ async def test_create_membership_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = membership.CreateMembershipRequest() - assert args[0] == request_msg @@ -6027,7 +6044,6 @@ async def test_delete_membership_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = membership.DeleteMembershipRequest() - assert args[0] == request_msg @@ -6054,7 +6070,6 @@ async def test_update_membership_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = membership.UpdateMembershipRequest() - assert args[0] == request_msg @@ -6081,7 +6096,6 @@ async def test_generate_connect_manifest_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = membership.GenerateConnectManifestRequest() - assert args[0] == request_msg @@ -6108,7 +6122,6 @@ async def test_validate_exclusivity_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = membership.ValidateExclusivityRequest() - assert args[0] == request_msg @@ -6138,7 +6151,6 @@ async def test_generate_exclusivity_manifest_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = membership.GenerateExclusivityManifestRequest() - assert args[0] == request_msg @@ -8067,7 +8079,6 @@ def test_list_memberships_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = membership.ListMembershipsRequest() - assert args[0] == request_msg @@ -8087,7 +8098,6 @@ def test_get_membership_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = membership.GetMembershipRequest() - assert args[0] == request_msg @@ -8109,7 +8119,6 @@ def test_create_membership_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = membership.CreateMembershipRequest() - assert args[0] == request_msg @@ -8131,7 +8140,6 @@ def test_delete_membership_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = membership.DeleteMembershipRequest() - assert args[0] == request_msg @@ -8153,7 +8161,6 @@ def test_update_membership_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = membership.UpdateMembershipRequest() - assert args[0] == request_msg @@ -8175,7 +8182,6 @@ def test_generate_connect_manifest_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = membership.GenerateConnectManifestRequest() - assert args[0] == request_msg @@ -8197,7 +8203,6 @@ def test_validate_exclusivity_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = membership.ValidateExclusivityRequest() - assert args[0] == request_msg @@ -8219,7 +8224,6 @@ def test_generate_exclusivity_manifest_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = membership.GenerateExclusivityManifestRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-gke-multicloud/noxfile.py b/packages/google-cloud-gke-multicloud/noxfile.py index ff5e7bd99de1..6dbc9a81300b 100644 --- a/packages/google-cloud-gke-multicloud/noxfile.py +++ b/packages/google-cloud-gke-multicloud/noxfile.py @@ -47,7 +47,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-gke-multicloud" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-gke-multicloud/setup.py b/packages/google-cloud-gke-multicloud/setup.py index 5e4265260623..248c51dc4af8 100644 --- a/packages/google-cloud-gke-multicloud/setup.py +++ b/packages/google-cloud-gke-multicloud/setup.py @@ -45,7 +45,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/google-cloud-gke-multicloud/testing/constraints-3.10.txt b/packages/google-cloud-gke-multicloud/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-gke-multicloud/testing/constraints-3.10.txt +++ b/packages/google-cloud-gke-multicloud/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-gke-multicloud/tests/unit/gapic/gke_multicloud_v1/test_attached_clusters.py b/packages/google-cloud-gke-multicloud/tests/unit/gapic/gke_multicloud_v1/test_attached_clusters.py index 49bdf429e7df..68c140bae149 100644 --- a/packages/google-cloud-gke-multicloud/tests/unit/gapic/gke_multicloud_v1/test_attached_clusters.py +++ b/packages/google-cloud-gke-multicloud/tests/unit/gapic/gke_multicloud_v1/test_attached_clusters.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 @@ -119,6 +120,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" @@ -1352,8 +1368,8 @@ def test_attached_clusters_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - attached_service.CreateAttachedClusterRequest, - dict, + attached_service.CreateAttachedClusterRequest(), + {}, ], ) def test_create_attached_cluster(request_type, transport: str = "grpc"): @@ -1364,7 +1380,7 @@ def test_create_attached_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1410,10 +1426,11 @@ def test_create_attached_cluster_non_empty_request_with_auto_populated_field(): client.create_attached_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == attached_service.CreateAttachedClusterRequest( + request_msg = attached_service.CreateAttachedClusterRequest( parent="parent_value", attached_cluster_id="attached_cluster_id_value", ) + assert args[0] == request_msg def test_create_attached_cluster_use_cached_wrapped_rpc(): @@ -1509,9 +1526,15 @@ async def test_create_attached_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + attached_service.CreateAttachedClusterRequest(), + {}, + ], +) async def test_create_attached_cluster_async( - transport: str = "grpc_asyncio", - request_type=attached_service.CreateAttachedClusterRequest, + request_type, transport: str = "grpc_asyncio" ): client = AttachedClustersAsyncClient( credentials=async_anonymous_credentials(), @@ -1520,7 +1543,7 @@ async def test_create_attached_cluster_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( @@ -1542,11 +1565,6 @@ async def test_create_attached_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_attached_cluster_async_from_dict(): - await test_create_attached_cluster_async(request_type=dict) - - def test_create_attached_cluster_field_headers(): client = AttachedClustersClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1721,8 +1739,8 @@ async def test_create_attached_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - attached_service.UpdateAttachedClusterRequest, - dict, + attached_service.UpdateAttachedClusterRequest(), + {}, ], ) def test_update_attached_cluster(request_type, transport: str = "grpc"): @@ -1733,7 +1751,7 @@ def test_update_attached_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1776,7 +1794,8 @@ def test_update_attached_cluster_non_empty_request_with_auto_populated_field(): client.update_attached_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == attached_service.UpdateAttachedClusterRequest() + request_msg = attached_service.UpdateAttachedClusterRequest() + assert args[0] == request_msg def test_update_attached_cluster_use_cached_wrapped_rpc(): @@ -1872,9 +1891,15 @@ async def test_update_attached_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + attached_service.UpdateAttachedClusterRequest(), + {}, + ], +) async def test_update_attached_cluster_async( - transport: str = "grpc_asyncio", - request_type=attached_service.UpdateAttachedClusterRequest, + request_type, transport: str = "grpc_asyncio" ): client = AttachedClustersAsyncClient( credentials=async_anonymous_credentials(), @@ -1883,7 +1908,7 @@ async def test_update_attached_cluster_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( @@ -1905,11 +1930,6 @@ async def test_update_attached_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_attached_cluster_async_from_dict(): - await test_update_attached_cluster_async(request_type=dict) - - def test_update_attached_cluster_field_headers(): client = AttachedClustersClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2074,8 +2094,8 @@ async def test_update_attached_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - attached_service.ImportAttachedClusterRequest, - dict, + attached_service.ImportAttachedClusterRequest(), + {}, ], ) def test_import_attached_cluster(request_type, transport: str = "grpc"): @@ -2086,7 +2106,7 @@ def test_import_attached_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2134,12 +2154,13 @@ def test_import_attached_cluster_non_empty_request_with_auto_populated_field(): client.import_attached_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == attached_service.ImportAttachedClusterRequest( + request_msg = attached_service.ImportAttachedClusterRequest( parent="parent_value", fleet_membership="fleet_membership_value", platform_version="platform_version_value", distribution="distribution_value", ) + assert args[0] == request_msg def test_import_attached_cluster_use_cached_wrapped_rpc(): @@ -2235,9 +2256,15 @@ async def test_import_attached_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + attached_service.ImportAttachedClusterRequest(), + {}, + ], +) async def test_import_attached_cluster_async( - transport: str = "grpc_asyncio", - request_type=attached_service.ImportAttachedClusterRequest, + request_type, transport: str = "grpc_asyncio" ): client = AttachedClustersAsyncClient( credentials=async_anonymous_credentials(), @@ -2246,7 +2273,7 @@ async def test_import_attached_cluster_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( @@ -2268,11 +2295,6 @@ async def test_import_attached_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_import_attached_cluster_async_from_dict(): - await test_import_attached_cluster_async(request_type=dict) - - def test_import_attached_cluster_field_headers(): client = AttachedClustersClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2437,8 +2459,8 @@ async def test_import_attached_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - attached_service.GetAttachedClusterRequest, - dict, + attached_service.GetAttachedClusterRequest(), + {}, ], ) def test_get_attached_cluster(request_type, transport: str = "grpc"): @@ -2449,7 +2471,7 @@ def test_get_attached_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,9 +2537,10 @@ def test_get_attached_cluster_non_empty_request_with_auto_populated_field(): client.get_attached_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == attached_service.GetAttachedClusterRequest( + request_msg = attached_service.GetAttachedClusterRequest( name="name_value", ) + assert args[0] == request_msg def test_get_attached_cluster_use_cached_wrapped_rpc(): @@ -2602,9 +2625,15 @@ async def test_get_attached_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + attached_service.GetAttachedClusterRequest(), + {}, + ], +) async def test_get_attached_cluster_async( - transport: str = "grpc_asyncio", - request_type=attached_service.GetAttachedClusterRequest, + request_type, transport: str = "grpc_asyncio" ): client = AttachedClustersAsyncClient( credentials=async_anonymous_credentials(), @@ -2613,7 +2642,7 @@ async def test_get_attached_cluster_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( @@ -2656,11 +2685,6 @@ async def test_get_attached_cluster_async( assert response.kubernetes_version == "kubernetes_version_value" -@pytest.mark.asyncio -async def test_get_attached_cluster_async_from_dict(): - await test_get_attached_cluster_async(request_type=dict) - - def test_get_attached_cluster_field_headers(): client = AttachedClustersClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2815,8 +2839,8 @@ async def test_get_attached_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - attached_service.ListAttachedClustersRequest, - dict, + attached_service.ListAttachedClustersRequest(), + {}, ], ) def test_list_attached_clusters(request_type, transport: str = "grpc"): @@ -2827,7 +2851,7 @@ def test_list_attached_clusters(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2876,10 +2900,11 @@ def test_list_attached_clusters_non_empty_request_with_auto_populated_field(): client.list_attached_clusters(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == attached_service.ListAttachedClustersRequest( + request_msg = attached_service.ListAttachedClustersRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_attached_clusters_use_cached_wrapped_rpc(): @@ -2965,9 +2990,15 @@ async def test_list_attached_clusters_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + attached_service.ListAttachedClustersRequest(), + {}, + ], +) async def test_list_attached_clusters_async( - transport: str = "grpc_asyncio", - request_type=attached_service.ListAttachedClustersRequest, + request_type, transport: str = "grpc_asyncio" ): client = AttachedClustersAsyncClient( credentials=async_anonymous_credentials(), @@ -2976,7 +3007,7 @@ async def test_list_attached_clusters_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( @@ -3001,11 +3032,6 @@ async def test_list_attached_clusters_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_attached_clusters_async_from_dict(): - await test_list_attached_clusters_async(request_type=dict) - - def test_list_attached_clusters_field_headers(): client = AttachedClustersClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3358,8 +3384,8 @@ async def test_list_attached_clusters_async_pages(): @pytest.mark.parametrize( "request_type", [ - attached_service.DeleteAttachedClusterRequest, - dict, + attached_service.DeleteAttachedClusterRequest(), + {}, ], ) def test_delete_attached_cluster(request_type, transport: str = "grpc"): @@ -3370,7 +3396,7 @@ def test_delete_attached_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3416,10 +3442,11 @@ def test_delete_attached_cluster_non_empty_request_with_auto_populated_field(): client.delete_attached_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == attached_service.DeleteAttachedClusterRequest( + request_msg = attached_service.DeleteAttachedClusterRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_attached_cluster_use_cached_wrapped_rpc(): @@ -3515,9 +3542,15 @@ async def test_delete_attached_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + attached_service.DeleteAttachedClusterRequest(), + {}, + ], +) async def test_delete_attached_cluster_async( - transport: str = "grpc_asyncio", - request_type=attached_service.DeleteAttachedClusterRequest, + request_type, transport: str = "grpc_asyncio" ): client = AttachedClustersAsyncClient( credentials=async_anonymous_credentials(), @@ -3526,7 +3559,7 @@ async def test_delete_attached_cluster_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( @@ -3548,11 +3581,6 @@ async def test_delete_attached_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_attached_cluster_async_from_dict(): - await test_delete_attached_cluster_async(request_type=dict) - - def test_delete_attached_cluster_field_headers(): client = AttachedClustersClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3707,8 +3735,8 @@ async def test_delete_attached_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - attached_service.GetAttachedServerConfigRequest, - dict, + attached_service.GetAttachedServerConfigRequest(), + {}, ], ) def test_get_attached_server_config(request_type, transport: str = "grpc"): @@ -3719,7 +3747,7 @@ def test_get_attached_server_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( @@ -3767,9 +3795,10 @@ def test_get_attached_server_config_non_empty_request_with_auto_populated_field( client.get_attached_server_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == attached_service.GetAttachedServerConfigRequest( + request_msg = attached_service.GetAttachedServerConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_attached_server_config_use_cached_wrapped_rpc(): @@ -3855,9 +3884,15 @@ async def test_get_attached_server_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + attached_service.GetAttachedServerConfigRequest(), + {}, + ], +) async def test_get_attached_server_config_async( - transport: str = "grpc_asyncio", - request_type=attached_service.GetAttachedServerConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = AttachedClustersAsyncClient( credentials=async_anonymous_credentials(), @@ -3866,7 +3901,7 @@ async def test_get_attached_server_config_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( @@ -3891,11 +3926,6 @@ async def test_get_attached_server_config_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_attached_server_config_async_from_dict(): - await test_get_attached_server_config_async(request_type=dict) - - def test_get_attached_server_config_field_headers(): client = AttachedClustersClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4050,8 +4080,8 @@ async def test_get_attached_server_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - attached_service.GenerateAttachedClusterInstallManifestRequest, - dict, + attached_service.GenerateAttachedClusterInstallManifestRequest(), + {}, ], ) def test_generate_attached_cluster_install_manifest( @@ -4064,7 +4094,7 @@ def test_generate_attached_cluster_install_manifest( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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 +4148,12 @@ def test_generate_attached_cluster_install_manifest_non_empty_request_with_auto_ client.generate_attached_cluster_install_manifest(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == attached_service.GenerateAttachedClusterInstallManifestRequest( + request_msg = attached_service.GenerateAttachedClusterInstallManifestRequest( parent="parent_value", attached_cluster_id="attached_cluster_id_value", platform_version="platform_version_value", ) + assert args[0] == request_msg def test_generate_attached_cluster_install_manifest_use_cached_wrapped_rpc(): @@ -4210,9 +4239,15 @@ async def test_generate_attached_cluster_install_manifest_async_use_cached_wrapp @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + attached_service.GenerateAttachedClusterInstallManifestRequest(), + {}, + ], +) async def test_generate_attached_cluster_install_manifest_async( - transport: str = "grpc_asyncio", - request_type=attached_service.GenerateAttachedClusterInstallManifestRequest, + request_type, transport: str = "grpc_asyncio" ): client = AttachedClustersAsyncClient( credentials=async_anonymous_credentials(), @@ -4221,7 +4256,7 @@ async def test_generate_attached_cluster_install_manifest_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( @@ -4248,11 +4283,6 @@ async def test_generate_attached_cluster_install_manifest_async( assert response.manifest == "manifest_value" -@pytest.mark.asyncio -async def test_generate_attached_cluster_install_manifest_async_from_dict(): - await test_generate_attached_cluster_install_manifest_async(request_type=dict) - - def test_generate_attached_cluster_install_manifest_field_headers(): client = AttachedClustersClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4423,8 +4453,8 @@ async def test_generate_attached_cluster_install_manifest_flattened_error_async( @pytest.mark.parametrize( "request_type", [ - attached_service.GenerateAttachedClusterAgentTokenRequest, - dict, + attached_service.GenerateAttachedClusterAgentTokenRequest(), + {}, ], ) def test_generate_attached_cluster_agent_token(request_type, transport: str = "grpc"): @@ -4435,7 +4465,7 @@ def test_generate_attached_cluster_agent_token(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( @@ -4497,7 +4527,7 @@ def test_generate_attached_cluster_agent_token_non_empty_request_with_auto_popul client.generate_attached_cluster_agent_token(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == attached_service.GenerateAttachedClusterAgentTokenRequest( + request_msg = attached_service.GenerateAttachedClusterAgentTokenRequest( attached_cluster="attached_cluster_value", subject_token="subject_token_value", subject_token_type="subject_token_type_value", @@ -4508,6 +4538,7 @@ def test_generate_attached_cluster_agent_token_non_empty_request_with_auto_popul requested_token_type="requested_token_type_value", options="options_value", ) + assert args[0] == request_msg def test_generate_attached_cluster_agent_token_use_cached_wrapped_rpc(): @@ -4593,9 +4624,15 @@ async def test_generate_attached_cluster_agent_token_async_use_cached_wrapped_rp @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + attached_service.GenerateAttachedClusterAgentTokenRequest(), + {}, + ], +) async def test_generate_attached_cluster_agent_token_async( - transport: str = "grpc_asyncio", - request_type=attached_service.GenerateAttachedClusterAgentTokenRequest, + request_type, transport: str = "grpc_asyncio" ): client = AttachedClustersAsyncClient( credentials=async_anonymous_credentials(), @@ -4604,7 +4641,7 @@ async def test_generate_attached_cluster_agent_token_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( @@ -4635,11 +4672,6 @@ async def test_generate_attached_cluster_agent_token_async( assert response.token_type == "token_type_value" -@pytest.mark.asyncio -async def test_generate_attached_cluster_agent_token_async_from_dict(): - await test_generate_attached_cluster_agent_token_async(request_type=dict) - - def test_generate_attached_cluster_agent_token_field_headers(): client = AttachedClustersClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6703,7 +6735,6 @@ def test_create_attached_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = attached_service.CreateAttachedClusterRequest() - assert args[0] == request_msg @@ -6726,7 +6757,6 @@ def test_update_attached_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = attached_service.UpdateAttachedClusterRequest() - assert args[0] == request_msg @@ -6749,7 +6779,6 @@ def test_import_attached_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = attached_service.ImportAttachedClusterRequest() - assert args[0] == request_msg @@ -6772,7 +6801,6 @@ def test_get_attached_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = attached_service.GetAttachedClusterRequest() - assert args[0] == request_msg @@ -6795,7 +6823,6 @@ def test_list_attached_clusters_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = attached_service.ListAttachedClustersRequest() - assert args[0] == request_msg @@ -6818,7 +6845,6 @@ def test_delete_attached_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = attached_service.DeleteAttachedClusterRequest() - assert args[0] == request_msg @@ -6841,7 +6867,6 @@ def test_get_attached_server_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = attached_service.GetAttachedServerConfigRequest() - assert args[0] == request_msg @@ -6866,7 +6891,6 @@ def test_generate_attached_cluster_install_manifest_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = attached_service.GenerateAttachedClusterInstallManifestRequest() - assert args[0] == request_msg @@ -6889,7 +6913,6 @@ def test_generate_attached_cluster_agent_token_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = attached_service.GenerateAttachedClusterAgentTokenRequest() - assert args[0] == request_msg @@ -6930,7 +6953,6 @@ async def test_create_attached_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = attached_service.CreateAttachedClusterRequest() - assert args[0] == request_msg @@ -6957,7 +6979,6 @@ async def test_update_attached_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = attached_service.UpdateAttachedClusterRequest() - assert args[0] == request_msg @@ -6984,7 +7005,6 @@ async def test_import_attached_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = attached_service.ImportAttachedClusterRequest() - assert args[0] == request_msg @@ -7022,7 +7042,6 @@ async def test_get_attached_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = attached_service.GetAttachedClusterRequest() - assert args[0] == request_msg @@ -7051,7 +7070,6 @@ async def test_list_attached_clusters_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = attached_service.ListAttachedClustersRequest() - assert args[0] == request_msg @@ -7078,7 +7096,6 @@ async def test_delete_attached_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = attached_service.DeleteAttachedClusterRequest() - assert args[0] == request_msg @@ -7107,7 +7124,6 @@ async def test_get_attached_server_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = attached_service.GetAttachedServerConfigRequest() - assert args[0] == request_msg @@ -7136,7 +7152,6 @@ async def test_generate_attached_cluster_install_manifest_empty_call_grpc_asynci call.assert_called() _, args, _ = call.mock_calls[0] request_msg = attached_service.GenerateAttachedClusterInstallManifestRequest() - assert args[0] == request_msg @@ -7167,7 +7182,6 @@ async def test_generate_attached_cluster_agent_token_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = attached_service.GenerateAttachedClusterAgentTokenRequest() - assert args[0] == request_msg @@ -8935,7 +8949,6 @@ def test_create_attached_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = attached_service.CreateAttachedClusterRequest() - assert args[0] == request_msg @@ -8957,7 +8970,6 @@ def test_update_attached_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = attached_service.UpdateAttachedClusterRequest() - assert args[0] == request_msg @@ -8979,7 +8991,6 @@ def test_import_attached_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = attached_service.ImportAttachedClusterRequest() - assert args[0] == request_msg @@ -9001,7 +9012,6 @@ def test_get_attached_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = attached_service.GetAttachedClusterRequest() - assert args[0] == request_msg @@ -9023,7 +9033,6 @@ def test_list_attached_clusters_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = attached_service.ListAttachedClustersRequest() - assert args[0] == request_msg @@ -9045,7 +9054,6 @@ def test_delete_attached_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = attached_service.DeleteAttachedClusterRequest() - assert args[0] == request_msg @@ -9067,7 +9075,6 @@ def test_get_attached_server_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = attached_service.GetAttachedServerConfigRequest() - assert args[0] == request_msg @@ -9089,7 +9096,6 @@ def test_generate_attached_cluster_install_manifest_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = attached_service.GenerateAttachedClusterInstallManifestRequest() - assert args[0] == request_msg @@ -9111,7 +9117,6 @@ def test_generate_attached_cluster_agent_token_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = attached_service.GenerateAttachedClusterAgentTokenRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-gke-multicloud/tests/unit/gapic/gke_multicloud_v1/test_aws_clusters.py b/packages/google-cloud-gke-multicloud/tests/unit/gapic/gke_multicloud_v1/test_aws_clusters.py index a39cf56ebc75..b13dcc0bf8ff 100644 --- a/packages/google-cloud-gke-multicloud/tests/unit/gapic/gke_multicloud_v1/test_aws_clusters.py +++ b/packages/google-cloud-gke-multicloud/tests/unit/gapic/gke_multicloud_v1/test_aws_clusters.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 @@ -119,6 +120,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" @@ -1284,8 +1300,8 @@ def test_aws_clusters_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - aws_service.CreateAwsClusterRequest, - dict, + aws_service.CreateAwsClusterRequest(), + {}, ], ) def test_create_aws_cluster(request_type, transport: str = "grpc"): @@ -1296,7 +1312,7 @@ def test_create_aws_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1342,10 +1358,11 @@ def test_create_aws_cluster_non_empty_request_with_auto_populated_field(): client.create_aws_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == aws_service.CreateAwsClusterRequest( + request_msg = aws_service.CreateAwsClusterRequest( parent="parent_value", aws_cluster_id="aws_cluster_id_value", ) + assert args[0] == request_msg def test_create_aws_cluster_use_cached_wrapped_rpc(): @@ -1440,9 +1457,14 @@ async def test_create_aws_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_aws_cluster_async( - transport: str = "grpc_asyncio", request_type=aws_service.CreateAwsClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + aws_service.CreateAwsClusterRequest(), + {}, + ], +) +async def test_create_aws_cluster_async(request_type, transport: str = "grpc_asyncio"): client = AwsClustersAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1450,7 +1472,7 @@ async def test_create_aws_cluster_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( @@ -1472,11 +1494,6 @@ async def test_create_aws_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_aws_cluster_async_from_dict(): - await test_create_aws_cluster_async(request_type=dict) - - def test_create_aws_cluster_field_headers(): client = AwsClustersClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1651,8 +1668,8 @@ async def test_create_aws_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - aws_service.UpdateAwsClusterRequest, - dict, + aws_service.UpdateAwsClusterRequest(), + {}, ], ) def test_update_aws_cluster(request_type, transport: str = "grpc"): @@ -1663,7 +1680,7 @@ def test_update_aws_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,7 +1723,8 @@ def test_update_aws_cluster_non_empty_request_with_auto_populated_field(): client.update_aws_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == aws_service.UpdateAwsClusterRequest() + request_msg = aws_service.UpdateAwsClusterRequest() + assert args[0] == request_msg def test_update_aws_cluster_use_cached_wrapped_rpc(): @@ -1801,9 +1819,14 @@ async def test_update_aws_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_aws_cluster_async( - transport: str = "grpc_asyncio", request_type=aws_service.UpdateAwsClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + aws_service.UpdateAwsClusterRequest(), + {}, + ], +) +async def test_update_aws_cluster_async(request_type, transport: str = "grpc_asyncio"): client = AwsClustersAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1811,7 +1834,7 @@ async def test_update_aws_cluster_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( @@ -1833,11 +1856,6 @@ async def test_update_aws_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_aws_cluster_async_from_dict(): - await test_update_aws_cluster_async(request_type=dict) - - def test_update_aws_cluster_field_headers(): client = AwsClustersClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2002,8 +2020,8 @@ async def test_update_aws_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - aws_service.GetAwsClusterRequest, - dict, + aws_service.GetAwsClusterRequest(), + {}, ], ) def test_get_aws_cluster(request_type, transport: str = "grpc"): @@ -2014,7 +2032,7 @@ def test_get_aws_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_aws_cluster), "__call__") as call: @@ -2074,9 +2092,10 @@ def test_get_aws_cluster_non_empty_request_with_auto_populated_field(): client.get_aws_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == aws_service.GetAwsClusterRequest( + request_msg = aws_service.GetAwsClusterRequest( name="name_value", ) + assert args[0] == request_msg def test_get_aws_cluster_use_cached_wrapped_rpc(): @@ -2157,9 +2176,14 @@ async def test_get_aws_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_aws_cluster_async( - transport: str = "grpc_asyncio", request_type=aws_service.GetAwsClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + aws_service.GetAwsClusterRequest(), + {}, + ], +) +async def test_get_aws_cluster_async(request_type, transport: str = "grpc_asyncio"): client = AwsClustersAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2167,7 +2191,7 @@ async def test_get_aws_cluster_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_aws_cluster), "__call__") as call: @@ -2206,11 +2230,6 @@ async def test_get_aws_cluster_async( assert response.cluster_ca_certificate == "cluster_ca_certificate_value" -@pytest.mark.asyncio -async def test_get_aws_cluster_async_from_dict(): - await test_get_aws_cluster_async(request_type=dict) - - def test_get_aws_cluster_field_headers(): client = AwsClustersClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2357,8 +2376,8 @@ async def test_get_aws_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - aws_service.ListAwsClustersRequest, - dict, + aws_service.ListAwsClustersRequest(), + {}, ], ) def test_list_aws_clusters(request_type, transport: str = "grpc"): @@ -2369,7 +2388,7 @@ def test_list_aws_clusters(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2418,10 +2437,11 @@ def test_list_aws_clusters_non_empty_request_with_auto_populated_field(): client.list_aws_clusters(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == aws_service.ListAwsClustersRequest( + request_msg = aws_service.ListAwsClustersRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_aws_clusters_use_cached_wrapped_rpc(): @@ -2504,9 +2524,14 @@ async def test_list_aws_clusters_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_aws_clusters_async( - transport: str = "grpc_asyncio", request_type=aws_service.ListAwsClustersRequest -): +@pytest.mark.parametrize( + "request_type", + [ + aws_service.ListAwsClustersRequest(), + {}, + ], +) +async def test_list_aws_clusters_async(request_type, transport: str = "grpc_asyncio"): client = AwsClustersAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2514,7 +2539,7 @@ async def test_list_aws_clusters_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( @@ -2539,11 +2564,6 @@ async def test_list_aws_clusters_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_aws_clusters_async_from_dict(): - await test_list_aws_clusters_async(request_type=dict) - - def test_list_aws_clusters_field_headers(): client = AwsClustersClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2896,8 +2916,8 @@ async def test_list_aws_clusters_async_pages(): @pytest.mark.parametrize( "request_type", [ - aws_service.DeleteAwsClusterRequest, - dict, + aws_service.DeleteAwsClusterRequest(), + {}, ], ) def test_delete_aws_cluster(request_type, transport: str = "grpc"): @@ -2908,7 +2928,7 @@ def test_delete_aws_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2954,10 +2974,11 @@ def test_delete_aws_cluster_non_empty_request_with_auto_populated_field(): client.delete_aws_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == aws_service.DeleteAwsClusterRequest( + request_msg = aws_service.DeleteAwsClusterRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_aws_cluster_use_cached_wrapped_rpc(): @@ -3052,9 +3073,14 @@ async def test_delete_aws_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_aws_cluster_async( - transport: str = "grpc_asyncio", request_type=aws_service.DeleteAwsClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + aws_service.DeleteAwsClusterRequest(), + {}, + ], +) +async def test_delete_aws_cluster_async(request_type, transport: str = "grpc_asyncio"): client = AwsClustersAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3062,7 +3088,7 @@ async def test_delete_aws_cluster_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( @@ -3084,11 +3110,6 @@ async def test_delete_aws_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_aws_cluster_async_from_dict(): - await test_delete_aws_cluster_async(request_type=dict) - - def test_delete_aws_cluster_field_headers(): client = AwsClustersClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3243,8 +3264,8 @@ async def test_delete_aws_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - aws_service.GenerateAwsClusterAgentTokenRequest, - dict, + aws_service.GenerateAwsClusterAgentTokenRequest(), + {}, ], ) def test_generate_aws_cluster_agent_token(request_type, transport: str = "grpc"): @@ -3255,7 +3276,7 @@ def test_generate_aws_cluster_agent_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( @@ -3316,7 +3337,7 @@ def test_generate_aws_cluster_agent_token_non_empty_request_with_auto_populated_ client.generate_aws_cluster_agent_token(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == aws_service.GenerateAwsClusterAgentTokenRequest( + request_msg = aws_service.GenerateAwsClusterAgentTokenRequest( aws_cluster="aws_cluster_value", subject_token="subject_token_value", subject_token_type="subject_token_type_value", @@ -3328,6 +3349,7 @@ def test_generate_aws_cluster_agent_token_non_empty_request_with_auto_populated_ requested_token_type="requested_token_type_value", options="options_value", ) + assert args[0] == request_msg def test_generate_aws_cluster_agent_token_use_cached_wrapped_rpc(): @@ -3413,9 +3435,15 @@ async def test_generate_aws_cluster_agent_token_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + aws_service.GenerateAwsClusterAgentTokenRequest(), + {}, + ], +) async def test_generate_aws_cluster_agent_token_async( - transport: str = "grpc_asyncio", - request_type=aws_service.GenerateAwsClusterAgentTokenRequest, + request_type, transport: str = "grpc_asyncio" ): client = AwsClustersAsyncClient( credentials=async_anonymous_credentials(), @@ -3424,7 +3452,7 @@ async def test_generate_aws_cluster_agent_token_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( @@ -3453,11 +3481,6 @@ async def test_generate_aws_cluster_agent_token_async( assert response.token_type == "token_type_value" -@pytest.mark.asyncio -async def test_generate_aws_cluster_agent_token_async_from_dict(): - await test_generate_aws_cluster_agent_token_async(request_type=dict) - - def test_generate_aws_cluster_agent_token_field_headers(): client = AwsClustersClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3526,8 +3549,8 @@ async def test_generate_aws_cluster_agent_token_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - aws_service.GenerateAwsAccessTokenRequest, - dict, + aws_service.GenerateAwsAccessTokenRequest(), + {}, ], ) def test_generate_aws_access_token(request_type, transport: str = "grpc"): @@ -3538,7 +3561,7 @@ def test_generate_aws_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( @@ -3586,9 +3609,10 @@ def test_generate_aws_access_token_non_empty_request_with_auto_populated_field() client.generate_aws_access_token(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == aws_service.GenerateAwsAccessTokenRequest( + request_msg = aws_service.GenerateAwsAccessTokenRequest( aws_cluster="aws_cluster_value", ) + assert args[0] == request_msg def test_generate_aws_access_token_use_cached_wrapped_rpc(): @@ -3674,9 +3698,15 @@ async def test_generate_aws_access_token_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + aws_service.GenerateAwsAccessTokenRequest(), + {}, + ], +) async def test_generate_aws_access_token_async( - transport: str = "grpc_asyncio", - request_type=aws_service.GenerateAwsAccessTokenRequest, + request_type, transport: str = "grpc_asyncio" ): client = AwsClustersAsyncClient( credentials=async_anonymous_credentials(), @@ -3685,7 +3715,7 @@ async def test_generate_aws_access_token_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( @@ -3710,11 +3740,6 @@ async def test_generate_aws_access_token_async( assert response.access_token == "access_token_value" -@pytest.mark.asyncio -async def test_generate_aws_access_token_async_from_dict(): - await test_generate_aws_access_token_async(request_type=dict) - - def test_generate_aws_access_token_field_headers(): client = AwsClustersClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3783,8 +3808,8 @@ async def test_generate_aws_access_token_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - aws_service.CreateAwsNodePoolRequest, - dict, + aws_service.CreateAwsNodePoolRequest(), + {}, ], ) def test_create_aws_node_pool(request_type, transport: str = "grpc"): @@ -3795,7 +3820,7 @@ def test_create_aws_node_pool(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3841,10 +3866,11 @@ def test_create_aws_node_pool_non_empty_request_with_auto_populated_field(): client.create_aws_node_pool(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == aws_service.CreateAwsNodePoolRequest( + request_msg = aws_service.CreateAwsNodePoolRequest( parent="parent_value", aws_node_pool_id="aws_node_pool_id_value", ) + assert args[0] == request_msg def test_create_aws_node_pool_use_cached_wrapped_rpc(): @@ -3939,8 +3965,15 @@ async def test_create_aws_node_pool_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + aws_service.CreateAwsNodePoolRequest(), + {}, + ], +) async def test_create_aws_node_pool_async( - transport: str = "grpc_asyncio", request_type=aws_service.CreateAwsNodePoolRequest + request_type, transport: str = "grpc_asyncio" ): client = AwsClustersAsyncClient( credentials=async_anonymous_credentials(), @@ -3949,7 +3982,7 @@ async def test_create_aws_node_pool_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( @@ -3971,11 +4004,6 @@ async def test_create_aws_node_pool_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_aws_node_pool_async_from_dict(): - await test_create_aws_node_pool_async(request_type=dict) - - def test_create_aws_node_pool_field_headers(): client = AwsClustersClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4150,8 +4178,8 @@ async def test_create_aws_node_pool_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - aws_service.UpdateAwsNodePoolRequest, - dict, + aws_service.UpdateAwsNodePoolRequest(), + {}, ], ) def test_update_aws_node_pool(request_type, transport: str = "grpc"): @@ -4162,7 +4190,7 @@ def test_update_aws_node_pool(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4205,7 +4233,8 @@ def test_update_aws_node_pool_non_empty_request_with_auto_populated_field(): client.update_aws_node_pool(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == aws_service.UpdateAwsNodePoolRequest() + request_msg = aws_service.UpdateAwsNodePoolRequest() + assert args[0] == request_msg def test_update_aws_node_pool_use_cached_wrapped_rpc(): @@ -4300,8 +4329,15 @@ async def test_update_aws_node_pool_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + aws_service.UpdateAwsNodePoolRequest(), + {}, + ], +) async def test_update_aws_node_pool_async( - transport: str = "grpc_asyncio", request_type=aws_service.UpdateAwsNodePoolRequest + request_type, transport: str = "grpc_asyncio" ): client = AwsClustersAsyncClient( credentials=async_anonymous_credentials(), @@ -4310,7 +4346,7 @@ async def test_update_aws_node_pool_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( @@ -4332,11 +4368,6 @@ async def test_update_aws_node_pool_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_aws_node_pool_async_from_dict(): - await test_update_aws_node_pool_async(request_type=dict) - - def test_update_aws_node_pool_field_headers(): client = AwsClustersClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4501,8 +4532,8 @@ async def test_update_aws_node_pool_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - aws_service.RollbackAwsNodePoolUpdateRequest, - dict, + aws_service.RollbackAwsNodePoolUpdateRequest(), + {}, ], ) def test_rollback_aws_node_pool_update(request_type, transport: str = "grpc"): @@ -4513,7 +4544,7 @@ def test_rollback_aws_node_pool_update(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4558,9 +4589,10 @@ def test_rollback_aws_node_pool_update_non_empty_request_with_auto_populated_fie client.rollback_aws_node_pool_update(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == aws_service.RollbackAwsNodePoolUpdateRequest( + request_msg = aws_service.RollbackAwsNodePoolUpdateRequest( name="name_value", ) + assert args[0] == request_msg def test_rollback_aws_node_pool_update_use_cached_wrapped_rpc(): @@ -4656,9 +4688,15 @@ async def test_rollback_aws_node_pool_update_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + aws_service.RollbackAwsNodePoolUpdateRequest(), + {}, + ], +) async def test_rollback_aws_node_pool_update_async( - transport: str = "grpc_asyncio", - request_type=aws_service.RollbackAwsNodePoolUpdateRequest, + request_type, transport: str = "grpc_asyncio" ): client = AwsClustersAsyncClient( credentials=async_anonymous_credentials(), @@ -4667,7 +4705,7 @@ async def test_rollback_aws_node_pool_update_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( @@ -4689,11 +4727,6 @@ async def test_rollback_aws_node_pool_update_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_rollback_aws_node_pool_update_async_from_dict(): - await test_rollback_aws_node_pool_update_async(request_type=dict) - - def test_rollback_aws_node_pool_update_field_headers(): client = AwsClustersClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4848,8 +4881,8 @@ async def test_rollback_aws_node_pool_update_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - aws_service.GetAwsNodePoolRequest, - dict, + aws_service.GetAwsNodePoolRequest(), + {}, ], ) def test_get_aws_node_pool(request_type, transport: str = "grpc"): @@ -4860,7 +4893,7 @@ def test_get_aws_node_pool(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4920,9 +4953,10 @@ def test_get_aws_node_pool_non_empty_request_with_auto_populated_field(): client.get_aws_node_pool(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == aws_service.GetAwsNodePoolRequest( + request_msg = aws_service.GetAwsNodePoolRequest( name="name_value", ) + assert args[0] == request_msg def test_get_aws_node_pool_use_cached_wrapped_rpc(): @@ -5005,9 +5039,14 @@ async def test_get_aws_node_pool_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_aws_node_pool_async( - transport: str = "grpc_asyncio", request_type=aws_service.GetAwsNodePoolRequest -): +@pytest.mark.parametrize( + "request_type", + [ + aws_service.GetAwsNodePoolRequest(), + {}, + ], +) +async def test_get_aws_node_pool_async(request_type, transport: str = "grpc_asyncio"): client = AwsClustersAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5015,7 +5054,7 @@ async def test_get_aws_node_pool_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( @@ -5052,11 +5091,6 @@ async def test_get_aws_node_pool_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_aws_node_pool_async_from_dict(): - await test_get_aws_node_pool_async(request_type=dict) - - def test_get_aws_node_pool_field_headers(): client = AwsClustersClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5211,8 +5245,8 @@ async def test_get_aws_node_pool_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - aws_service.ListAwsNodePoolsRequest, - dict, + aws_service.ListAwsNodePoolsRequest(), + {}, ], ) def test_list_aws_node_pools(request_type, transport: str = "grpc"): @@ -5223,7 +5257,7 @@ def test_list_aws_node_pools(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5272,10 +5306,11 @@ def test_list_aws_node_pools_non_empty_request_with_auto_populated_field(): client.list_aws_node_pools(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == aws_service.ListAwsNodePoolsRequest( + request_msg = aws_service.ListAwsNodePoolsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_aws_node_pools_use_cached_wrapped_rpc(): @@ -5360,9 +5395,14 @@ async def test_list_aws_node_pools_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_aws_node_pools_async( - transport: str = "grpc_asyncio", request_type=aws_service.ListAwsNodePoolsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + aws_service.ListAwsNodePoolsRequest(), + {}, + ], +) +async def test_list_aws_node_pools_async(request_type, transport: str = "grpc_asyncio"): client = AwsClustersAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5370,7 +5410,7 @@ async def test_list_aws_node_pools_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( @@ -5395,11 +5435,6 @@ async def test_list_aws_node_pools_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_aws_node_pools_async_from_dict(): - await test_list_aws_node_pools_async(request_type=dict) - - def test_list_aws_node_pools_field_headers(): client = AwsClustersClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5752,8 +5787,8 @@ async def test_list_aws_node_pools_async_pages(): @pytest.mark.parametrize( "request_type", [ - aws_service.DeleteAwsNodePoolRequest, - dict, + aws_service.DeleteAwsNodePoolRequest(), + {}, ], ) def test_delete_aws_node_pool(request_type, transport: str = "grpc"): @@ -5764,7 +5799,7 @@ def test_delete_aws_node_pool(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5810,10 +5845,11 @@ def test_delete_aws_node_pool_non_empty_request_with_auto_populated_field(): client.delete_aws_node_pool(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == aws_service.DeleteAwsNodePoolRequest( + request_msg = aws_service.DeleteAwsNodePoolRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_aws_node_pool_use_cached_wrapped_rpc(): @@ -5908,8 +5944,15 @@ async def test_delete_aws_node_pool_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + aws_service.DeleteAwsNodePoolRequest(), + {}, + ], +) async def test_delete_aws_node_pool_async( - transport: str = "grpc_asyncio", request_type=aws_service.DeleteAwsNodePoolRequest + request_type, transport: str = "grpc_asyncio" ): client = AwsClustersAsyncClient( credentials=async_anonymous_credentials(), @@ -5918,7 +5961,7 @@ async def test_delete_aws_node_pool_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( @@ -5940,11 +5983,6 @@ async def test_delete_aws_node_pool_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_aws_node_pool_async_from_dict(): - await test_delete_aws_node_pool_async(request_type=dict) - - def test_delete_aws_node_pool_field_headers(): client = AwsClustersClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6099,8 +6137,8 @@ async def test_delete_aws_node_pool_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - aws_service.GetAwsOpenIdConfigRequest, - dict, + aws_service.GetAwsOpenIdConfigRequest(), + {}, ], ) def test_get_aws_open_id_config(request_type, transport: str = "grpc"): @@ -6111,7 +6149,7 @@ def test_get_aws_open_id_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( @@ -6175,9 +6213,10 @@ def test_get_aws_open_id_config_non_empty_request_with_auto_populated_field(): client.get_aws_open_id_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == aws_service.GetAwsOpenIdConfigRequest( + request_msg = aws_service.GetAwsOpenIdConfigRequest( aws_cluster="aws_cluster_value", ) + assert args[0] == request_msg def test_get_aws_open_id_config_use_cached_wrapped_rpc(): @@ -6263,8 +6302,15 @@ async def test_get_aws_open_id_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + aws_service.GetAwsOpenIdConfigRequest(), + {}, + ], +) async def test_get_aws_open_id_config_async( - transport: str = "grpc_asyncio", request_type=aws_service.GetAwsOpenIdConfigRequest + request_type, transport: str = "grpc_asyncio" ): client = AwsClustersAsyncClient( credentials=async_anonymous_credentials(), @@ -6273,7 +6319,7 @@ async def test_get_aws_open_id_config_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( @@ -6314,11 +6360,6 @@ async def test_get_aws_open_id_config_async( assert response.grant_types == ["grant_types_value"] -@pytest.mark.asyncio -async def test_get_aws_open_id_config_async_from_dict(): - await test_get_aws_open_id_config_async(request_type=dict) - - def test_get_aws_open_id_config_field_headers(): client = AwsClustersClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6387,8 +6428,8 @@ async def test_get_aws_open_id_config_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - aws_service.GetAwsJsonWebKeysRequest, - dict, + aws_service.GetAwsJsonWebKeysRequest(), + {}, ], ) def test_get_aws_json_web_keys(request_type, transport: str = "grpc"): @@ -6399,7 +6440,7 @@ def test_get_aws_json_web_keys(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6444,9 +6485,10 @@ def test_get_aws_json_web_keys_non_empty_request_with_auto_populated_field(): client.get_aws_json_web_keys(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == aws_service.GetAwsJsonWebKeysRequest( + request_msg = aws_service.GetAwsJsonWebKeysRequest( aws_cluster="aws_cluster_value", ) + assert args[0] == request_msg def test_get_aws_json_web_keys_use_cached_wrapped_rpc(): @@ -6532,8 +6574,15 @@ async def test_get_aws_json_web_keys_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + aws_service.GetAwsJsonWebKeysRequest(), + {}, + ], +) async def test_get_aws_json_web_keys_async( - transport: str = "grpc_asyncio", request_type=aws_service.GetAwsJsonWebKeysRequest + request_type, transport: str = "grpc_asyncio" ): client = AwsClustersAsyncClient( credentials=async_anonymous_credentials(), @@ -6542,7 +6591,7 @@ async def test_get_aws_json_web_keys_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( @@ -6564,11 +6613,6 @@ async def test_get_aws_json_web_keys_async( assert isinstance(response, aws_resources.AwsJsonWebKeys) -@pytest.mark.asyncio -async def test_get_aws_json_web_keys_async_from_dict(): - await test_get_aws_json_web_keys_async(request_type=dict) - - def test_get_aws_json_web_keys_field_headers(): client = AwsClustersClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6637,8 +6681,8 @@ async def test_get_aws_json_web_keys_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - aws_service.GetAwsServerConfigRequest, - dict, + aws_service.GetAwsServerConfigRequest(), + {}, ], ) def test_get_aws_server_config(request_type, transport: str = "grpc"): @@ -6649,7 +6693,7 @@ def test_get_aws_server_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( @@ -6699,9 +6743,10 @@ def test_get_aws_server_config_non_empty_request_with_auto_populated_field(): client.get_aws_server_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == aws_service.GetAwsServerConfigRequest( + request_msg = aws_service.GetAwsServerConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_aws_server_config_use_cached_wrapped_rpc(): @@ -6787,8 +6832,15 @@ async def test_get_aws_server_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + aws_service.GetAwsServerConfigRequest(), + {}, + ], +) async def test_get_aws_server_config_async( - transport: str = "grpc_asyncio", request_type=aws_service.GetAwsServerConfigRequest + request_type, transport: str = "grpc_asyncio" ): client = AwsClustersAsyncClient( credentials=async_anonymous_credentials(), @@ -6797,7 +6849,7 @@ async def test_get_aws_server_config_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( @@ -6824,11 +6876,6 @@ async def test_get_aws_server_config_async( assert response.supported_aws_regions == ["supported_aws_regions_value"] -@pytest.mark.asyncio -async def test_get_aws_server_config_async_from_dict(): - await test_get_aws_server_config_async(request_type=dict) - - def test_get_aws_server_config_field_headers(): client = AwsClustersClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10136,7 +10183,6 @@ def test_create_aws_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = aws_service.CreateAwsClusterRequest() - assert args[0] == request_msg @@ -10159,7 +10205,6 @@ def test_update_aws_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = aws_service.UpdateAwsClusterRequest() - assert args[0] == request_msg @@ -10180,7 +10225,6 @@ def test_get_aws_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = aws_service.GetAwsClusterRequest() - assert args[0] == request_msg @@ -10203,7 +10247,6 @@ def test_list_aws_clusters_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = aws_service.ListAwsClustersRequest() - assert args[0] == request_msg @@ -10226,7 +10269,6 @@ def test_delete_aws_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = aws_service.DeleteAwsClusterRequest() - assert args[0] == request_msg @@ -10249,7 +10291,6 @@ def test_generate_aws_cluster_agent_token_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = aws_service.GenerateAwsClusterAgentTokenRequest() - assert args[0] == request_msg @@ -10272,7 +10313,6 @@ def test_generate_aws_access_token_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = aws_service.GenerateAwsAccessTokenRequest() - assert args[0] == request_msg @@ -10295,7 +10335,6 @@ def test_create_aws_node_pool_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = aws_service.CreateAwsNodePoolRequest() - assert args[0] == request_msg @@ -10318,7 +10357,6 @@ def test_update_aws_node_pool_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = aws_service.UpdateAwsNodePoolRequest() - assert args[0] == request_msg @@ -10341,7 +10379,6 @@ def test_rollback_aws_node_pool_update_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = aws_service.RollbackAwsNodePoolUpdateRequest() - assert args[0] == request_msg @@ -10364,7 +10401,6 @@ def test_get_aws_node_pool_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = aws_service.GetAwsNodePoolRequest() - assert args[0] == request_msg @@ -10387,7 +10423,6 @@ def test_list_aws_node_pools_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = aws_service.ListAwsNodePoolsRequest() - assert args[0] == request_msg @@ -10410,7 +10445,6 @@ def test_delete_aws_node_pool_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = aws_service.DeleteAwsNodePoolRequest() - assert args[0] == request_msg @@ -10433,7 +10467,6 @@ def test_get_aws_open_id_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = aws_service.GetAwsOpenIdConfigRequest() - assert args[0] == request_msg @@ -10456,7 +10489,6 @@ def test_get_aws_json_web_keys_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = aws_service.GetAwsJsonWebKeysRequest() - assert args[0] == request_msg @@ -10479,7 +10511,6 @@ def test_get_aws_server_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = aws_service.GetAwsServerConfigRequest() - assert args[0] == request_msg @@ -10520,7 +10551,6 @@ async def test_create_aws_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = aws_service.CreateAwsClusterRequest() - assert args[0] == request_msg @@ -10547,7 +10577,6 @@ async def test_update_aws_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = aws_service.UpdateAwsClusterRequest() - assert args[0] == request_msg @@ -10582,7 +10611,6 @@ async def test_get_aws_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = aws_service.GetAwsClusterRequest() - assert args[0] == request_msg @@ -10611,7 +10639,6 @@ async def test_list_aws_clusters_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = aws_service.ListAwsClustersRequest() - assert args[0] == request_msg @@ -10638,7 +10665,6 @@ async def test_delete_aws_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = aws_service.DeleteAwsClusterRequest() - assert args[0] == request_msg @@ -10669,7 +10695,6 @@ async def test_generate_aws_cluster_agent_token_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = aws_service.GenerateAwsClusterAgentTokenRequest() - assert args[0] == request_msg @@ -10698,7 +10723,6 @@ async def test_generate_aws_access_token_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = aws_service.GenerateAwsAccessTokenRequest() - assert args[0] == request_msg @@ -10725,7 +10749,6 @@ async def test_create_aws_node_pool_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = aws_service.CreateAwsNodePoolRequest() - assert args[0] == request_msg @@ -10752,7 +10775,6 @@ async def test_update_aws_node_pool_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = aws_service.UpdateAwsNodePoolRequest() - assert args[0] == request_msg @@ -10779,7 +10801,6 @@ async def test_rollback_aws_node_pool_update_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = aws_service.RollbackAwsNodePoolUpdateRequest() - assert args[0] == request_msg @@ -10814,7 +10835,6 @@ async def test_get_aws_node_pool_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = aws_service.GetAwsNodePoolRequest() - assert args[0] == request_msg @@ -10843,7 +10863,6 @@ async def test_list_aws_node_pools_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = aws_service.ListAwsNodePoolsRequest() - assert args[0] == request_msg @@ -10870,7 +10889,6 @@ async def test_delete_aws_node_pool_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = aws_service.DeleteAwsNodePoolRequest() - assert args[0] == request_msg @@ -10907,7 +10925,6 @@ async def test_get_aws_open_id_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = aws_service.GetAwsOpenIdConfigRequest() - assert args[0] == request_msg @@ -10934,7 +10951,6 @@ async def test_get_aws_json_web_keys_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = aws_service.GetAwsJsonWebKeysRequest() - assert args[0] == request_msg @@ -10964,7 +10980,6 @@ async def test_get_aws_server_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = aws_service.GetAwsServerConfigRequest() - assert args[0] == request_msg @@ -13965,7 +13980,6 @@ def test_create_aws_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = aws_service.CreateAwsClusterRequest() - assert args[0] == request_msg @@ -13987,7 +14001,6 @@ def test_update_aws_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = aws_service.UpdateAwsClusterRequest() - assert args[0] == request_msg @@ -14007,7 +14020,6 @@ def test_get_aws_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = aws_service.GetAwsClusterRequest() - assert args[0] == request_msg @@ -14029,7 +14041,6 @@ def test_list_aws_clusters_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = aws_service.ListAwsClustersRequest() - assert args[0] == request_msg @@ -14051,7 +14062,6 @@ def test_delete_aws_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = aws_service.DeleteAwsClusterRequest() - assert args[0] == request_msg @@ -14073,7 +14083,6 @@ def test_generate_aws_cluster_agent_token_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = aws_service.GenerateAwsClusterAgentTokenRequest() - assert args[0] == request_msg @@ -14095,7 +14104,6 @@ def test_generate_aws_access_token_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = aws_service.GenerateAwsAccessTokenRequest() - assert args[0] == request_msg @@ -14117,7 +14125,6 @@ def test_create_aws_node_pool_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = aws_service.CreateAwsNodePoolRequest() - assert args[0] == request_msg @@ -14139,7 +14146,6 @@ def test_update_aws_node_pool_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = aws_service.UpdateAwsNodePoolRequest() - assert args[0] == request_msg @@ -14161,7 +14167,6 @@ def test_rollback_aws_node_pool_update_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = aws_service.RollbackAwsNodePoolUpdateRequest() - assert args[0] == request_msg @@ -14183,7 +14188,6 @@ def test_get_aws_node_pool_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = aws_service.GetAwsNodePoolRequest() - assert args[0] == request_msg @@ -14205,7 +14209,6 @@ def test_list_aws_node_pools_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = aws_service.ListAwsNodePoolsRequest() - assert args[0] == request_msg @@ -14227,7 +14230,6 @@ def test_delete_aws_node_pool_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = aws_service.DeleteAwsNodePoolRequest() - assert args[0] == request_msg @@ -14249,7 +14251,6 @@ def test_get_aws_open_id_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = aws_service.GetAwsOpenIdConfigRequest() - assert args[0] == request_msg @@ -14271,7 +14272,6 @@ def test_get_aws_json_web_keys_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = aws_service.GetAwsJsonWebKeysRequest() - assert args[0] == request_msg @@ -14293,7 +14293,6 @@ def test_get_aws_server_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = aws_service.GetAwsServerConfigRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-gke-multicloud/tests/unit/gapic/gke_multicloud_v1/test_azure_clusters.py b/packages/google-cloud-gke-multicloud/tests/unit/gapic/gke_multicloud_v1/test_azure_clusters.py index f2a4dea41800..c859ee3f8243 100644 --- a/packages/google-cloud-gke-multicloud/tests/unit/gapic/gke_multicloud_v1/test_azure_clusters.py +++ b/packages/google-cloud-gke-multicloud/tests/unit/gapic/gke_multicloud_v1/test_azure_clusters.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 @@ -119,6 +120,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" @@ -1318,8 +1334,8 @@ def test_azure_clusters_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - azure_service.CreateAzureClientRequest, - dict, + azure_service.CreateAzureClientRequest(), + {}, ], ) def test_create_azure_client(request_type, transport: str = "grpc"): @@ -1330,7 +1346,7 @@ def test_create_azure_client(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1376,10 +1392,11 @@ def test_create_azure_client_non_empty_request_with_auto_populated_field(): client.create_azure_client(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == azure_service.CreateAzureClientRequest( + request_msg = azure_service.CreateAzureClientRequest( parent="parent_value", azure_client_id="azure_client_id_value", ) + assert args[0] == request_msg def test_create_azure_client_use_cached_wrapped_rpc(): @@ -1474,9 +1491,14 @@ async def test_create_azure_client_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_azure_client_async( - transport: str = "grpc_asyncio", request_type=azure_service.CreateAzureClientRequest -): +@pytest.mark.parametrize( + "request_type", + [ + azure_service.CreateAzureClientRequest(), + {}, + ], +) +async def test_create_azure_client_async(request_type, transport: str = "grpc_asyncio"): client = AzureClustersAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1484,7 +1506,7 @@ async def test_create_azure_client_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( @@ -1506,11 +1528,6 @@ async def test_create_azure_client_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_azure_client_async_from_dict(): - await test_create_azure_client_async(request_type=dict) - - def test_create_azure_client_field_headers(): client = AzureClustersClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1685,8 +1702,8 @@ async def test_create_azure_client_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - azure_service.GetAzureClientRequest, - dict, + azure_service.GetAzureClientRequest(), + {}, ], ) def test_get_azure_client(request_type, transport: str = "grpc"): @@ -1697,7 +1714,7 @@ def test_get_azure_client(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_azure_client), "__call__") as call: @@ -1751,9 +1768,10 @@ def test_get_azure_client_non_empty_request_with_auto_populated_field(): client.get_azure_client(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == azure_service.GetAzureClientRequest( + request_msg = azure_service.GetAzureClientRequest( name="name_value", ) + assert args[0] == request_msg def test_get_azure_client_use_cached_wrapped_rpc(): @@ -1836,9 +1854,14 @@ async def test_get_azure_client_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_azure_client_async( - transport: str = "grpc_asyncio", request_type=azure_service.GetAzureClientRequest -): +@pytest.mark.parametrize( + "request_type", + [ + azure_service.GetAzureClientRequest(), + {}, + ], +) +async def test_get_azure_client_async(request_type, transport: str = "grpc_asyncio"): client = AzureClustersAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1846,7 +1869,7 @@ async def test_get_azure_client_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_azure_client), "__call__") as call: @@ -1879,11 +1902,6 @@ async def test_get_azure_client_async( assert response.uid == "uid_value" -@pytest.mark.asyncio -async def test_get_azure_client_async_from_dict(): - await test_get_azure_client_async(request_type=dict) - - def test_get_azure_client_field_headers(): client = AzureClustersClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2030,8 +2048,8 @@ async def test_get_azure_client_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - azure_service.ListAzureClientsRequest, - dict, + azure_service.ListAzureClientsRequest(), + {}, ], ) def test_list_azure_clients(request_type, transport: str = "grpc"): @@ -2042,7 +2060,7 @@ def test_list_azure_clients(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2091,10 +2109,11 @@ def test_list_azure_clients_non_empty_request_with_auto_populated_field(): client.list_azure_clients(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == azure_service.ListAzureClientsRequest( + request_msg = azure_service.ListAzureClientsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_azure_clients_use_cached_wrapped_rpc(): @@ -2179,9 +2198,14 @@ async def test_list_azure_clients_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_azure_clients_async( - transport: str = "grpc_asyncio", request_type=azure_service.ListAzureClientsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + azure_service.ListAzureClientsRequest(), + {}, + ], +) +async def test_list_azure_clients_async(request_type, transport: str = "grpc_asyncio"): client = AzureClustersAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2189,7 +2213,7 @@ async def test_list_azure_clients_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( @@ -2214,11 +2238,6 @@ async def test_list_azure_clients_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_azure_clients_async_from_dict(): - await test_list_azure_clients_async(request_type=dict) - - def test_list_azure_clients_field_headers(): client = AzureClustersClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2571,8 +2590,8 @@ async def test_list_azure_clients_async_pages(): @pytest.mark.parametrize( "request_type", [ - azure_service.DeleteAzureClientRequest, - dict, + azure_service.DeleteAzureClientRequest(), + {}, ], ) def test_delete_azure_client(request_type, transport: str = "grpc"): @@ -2583,7 +2602,7 @@ def test_delete_azure_client(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2628,9 +2647,10 @@ def test_delete_azure_client_non_empty_request_with_auto_populated_field(): client.delete_azure_client(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == azure_service.DeleteAzureClientRequest( + request_msg = azure_service.DeleteAzureClientRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_azure_client_use_cached_wrapped_rpc(): @@ -2725,9 +2745,14 @@ async def test_delete_azure_client_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_azure_client_async( - transport: str = "grpc_asyncio", request_type=azure_service.DeleteAzureClientRequest -): +@pytest.mark.parametrize( + "request_type", + [ + azure_service.DeleteAzureClientRequest(), + {}, + ], +) +async def test_delete_azure_client_async(request_type, transport: str = "grpc_asyncio"): client = AzureClustersAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2735,7 +2760,7 @@ async def test_delete_azure_client_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( @@ -2757,11 +2782,6 @@ async def test_delete_azure_client_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_azure_client_async_from_dict(): - await test_delete_azure_client_async(request_type=dict) - - def test_delete_azure_client_field_headers(): client = AzureClustersClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2916,8 +2936,8 @@ async def test_delete_azure_client_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - azure_service.CreateAzureClusterRequest, - dict, + azure_service.CreateAzureClusterRequest(), + {}, ], ) def test_create_azure_cluster(request_type, transport: str = "grpc"): @@ -2928,7 +2948,7 @@ def test_create_azure_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2974,10 +2994,11 @@ def test_create_azure_cluster_non_empty_request_with_auto_populated_field(): client.create_azure_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == azure_service.CreateAzureClusterRequest( + request_msg = azure_service.CreateAzureClusterRequest( parent="parent_value", azure_cluster_id="azure_cluster_id_value", ) + assert args[0] == request_msg def test_create_azure_cluster_use_cached_wrapped_rpc(): @@ -3072,9 +3093,15 @@ async def test_create_azure_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + azure_service.CreateAzureClusterRequest(), + {}, + ], +) async def test_create_azure_cluster_async( - transport: str = "grpc_asyncio", - request_type=azure_service.CreateAzureClusterRequest, + request_type, transport: str = "grpc_asyncio" ): client = AzureClustersAsyncClient( credentials=async_anonymous_credentials(), @@ -3083,7 +3110,7 @@ async def test_create_azure_cluster_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( @@ -3105,11 +3132,6 @@ async def test_create_azure_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_azure_cluster_async_from_dict(): - await test_create_azure_cluster_async(request_type=dict) - - def test_create_azure_cluster_field_headers(): client = AzureClustersClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3284,8 +3306,8 @@ async def test_create_azure_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - azure_service.UpdateAzureClusterRequest, - dict, + azure_service.UpdateAzureClusterRequest(), + {}, ], ) def test_update_azure_cluster(request_type, transport: str = "grpc"): @@ -3296,7 +3318,7 @@ def test_update_azure_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3339,7 +3361,8 @@ def test_update_azure_cluster_non_empty_request_with_auto_populated_field(): client.update_azure_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == azure_service.UpdateAzureClusterRequest() + request_msg = azure_service.UpdateAzureClusterRequest() + assert args[0] == request_msg def test_update_azure_cluster_use_cached_wrapped_rpc(): @@ -3434,9 +3457,15 @@ async def test_update_azure_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + azure_service.UpdateAzureClusterRequest(), + {}, + ], +) async def test_update_azure_cluster_async( - transport: str = "grpc_asyncio", - request_type=azure_service.UpdateAzureClusterRequest, + request_type, transport: str = "grpc_asyncio" ): client = AzureClustersAsyncClient( credentials=async_anonymous_credentials(), @@ -3445,7 +3474,7 @@ async def test_update_azure_cluster_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( @@ -3467,11 +3496,6 @@ async def test_update_azure_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_azure_cluster_async_from_dict(): - await test_update_azure_cluster_async(request_type=dict) - - def test_update_azure_cluster_field_headers(): client = AzureClustersClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3636,8 +3660,8 @@ async def test_update_azure_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - azure_service.GetAzureClusterRequest, - dict, + azure_service.GetAzureClusterRequest(), + {}, ], ) def test_get_azure_cluster(request_type, transport: str = "grpc"): @@ -3648,7 +3672,7 @@ def test_get_azure_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3716,9 +3740,10 @@ def test_get_azure_cluster_non_empty_request_with_auto_populated_field(): client.get_azure_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == azure_service.GetAzureClusterRequest( + request_msg = azure_service.GetAzureClusterRequest( name="name_value", ) + assert args[0] == request_msg def test_get_azure_cluster_use_cached_wrapped_rpc(): @@ -3801,9 +3826,14 @@ async def test_get_azure_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_azure_cluster_async( - transport: str = "grpc_asyncio", request_type=azure_service.GetAzureClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + azure_service.GetAzureClusterRequest(), + {}, + ], +) +async def test_get_azure_cluster_async(request_type, transport: str = "grpc_asyncio"): client = AzureClustersAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3811,7 +3841,7 @@ async def test_get_azure_cluster_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( @@ -3856,11 +3886,6 @@ async def test_get_azure_cluster_async( assert response.cluster_ca_certificate == "cluster_ca_certificate_value" -@pytest.mark.asyncio -async def test_get_azure_cluster_async_from_dict(): - await test_get_azure_cluster_async(request_type=dict) - - def test_get_azure_cluster_field_headers(): client = AzureClustersClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4015,8 +4040,8 @@ async def test_get_azure_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - azure_service.ListAzureClustersRequest, - dict, + azure_service.ListAzureClustersRequest(), + {}, ], ) def test_list_azure_clusters(request_type, transport: str = "grpc"): @@ -4027,7 +4052,7 @@ def test_list_azure_clusters(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4076,10 +4101,11 @@ def test_list_azure_clusters_non_empty_request_with_auto_populated_field(): client.list_azure_clusters(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == azure_service.ListAzureClustersRequest( + request_msg = azure_service.ListAzureClustersRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_azure_clusters_use_cached_wrapped_rpc(): @@ -4164,9 +4190,14 @@ async def test_list_azure_clusters_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_azure_clusters_async( - transport: str = "grpc_asyncio", request_type=azure_service.ListAzureClustersRequest -): +@pytest.mark.parametrize( + "request_type", + [ + azure_service.ListAzureClustersRequest(), + {}, + ], +) +async def test_list_azure_clusters_async(request_type, transport: str = "grpc_asyncio"): client = AzureClustersAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4174,7 +4205,7 @@ async def test_list_azure_clusters_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( @@ -4199,11 +4230,6 @@ async def test_list_azure_clusters_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_azure_clusters_async_from_dict(): - await test_list_azure_clusters_async(request_type=dict) - - def test_list_azure_clusters_field_headers(): client = AzureClustersClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4556,8 +4582,8 @@ async def test_list_azure_clusters_async_pages(): @pytest.mark.parametrize( "request_type", [ - azure_service.DeleteAzureClusterRequest, - dict, + azure_service.DeleteAzureClusterRequest(), + {}, ], ) def test_delete_azure_cluster(request_type, transport: str = "grpc"): @@ -4568,7 +4594,7 @@ def test_delete_azure_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4614,10 +4640,11 @@ def test_delete_azure_cluster_non_empty_request_with_auto_populated_field(): client.delete_azure_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == azure_service.DeleteAzureClusterRequest( + request_msg = azure_service.DeleteAzureClusterRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_azure_cluster_use_cached_wrapped_rpc(): @@ -4712,9 +4739,15 @@ async def test_delete_azure_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + azure_service.DeleteAzureClusterRequest(), + {}, + ], +) async def test_delete_azure_cluster_async( - transport: str = "grpc_asyncio", - request_type=azure_service.DeleteAzureClusterRequest, + request_type, transport: str = "grpc_asyncio" ): client = AzureClustersAsyncClient( credentials=async_anonymous_credentials(), @@ -4723,7 +4756,7 @@ async def test_delete_azure_cluster_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( @@ -4745,11 +4778,6 @@ async def test_delete_azure_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_azure_cluster_async_from_dict(): - await test_delete_azure_cluster_async(request_type=dict) - - def test_delete_azure_cluster_field_headers(): client = AzureClustersClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4904,8 +4932,8 @@ async def test_delete_azure_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - azure_service.GenerateAzureClusterAgentTokenRequest, - dict, + azure_service.GenerateAzureClusterAgentTokenRequest(), + {}, ], ) def test_generate_azure_cluster_agent_token(request_type, transport: str = "grpc"): @@ -4916,7 +4944,7 @@ def test_generate_azure_cluster_agent_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( @@ -4977,7 +5005,7 @@ def test_generate_azure_cluster_agent_token_non_empty_request_with_auto_populate client.generate_azure_cluster_agent_token(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == azure_service.GenerateAzureClusterAgentTokenRequest( + request_msg = azure_service.GenerateAzureClusterAgentTokenRequest( azure_cluster="azure_cluster_value", subject_token="subject_token_value", subject_token_type="subject_token_type_value", @@ -4989,6 +5017,7 @@ def test_generate_azure_cluster_agent_token_non_empty_request_with_auto_populate requested_token_type="requested_token_type_value", options="options_value", ) + assert args[0] == request_msg def test_generate_azure_cluster_agent_token_use_cached_wrapped_rpc(): @@ -5074,9 +5103,15 @@ async def test_generate_azure_cluster_agent_token_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + azure_service.GenerateAzureClusterAgentTokenRequest(), + {}, + ], +) async def test_generate_azure_cluster_agent_token_async( - transport: str = "grpc_asyncio", - request_type=azure_service.GenerateAzureClusterAgentTokenRequest, + request_type, transport: str = "grpc_asyncio" ): client = AzureClustersAsyncClient( credentials=async_anonymous_credentials(), @@ -5085,7 +5120,7 @@ async def test_generate_azure_cluster_agent_token_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( @@ -5114,11 +5149,6 @@ async def test_generate_azure_cluster_agent_token_async( assert response.token_type == "token_type_value" -@pytest.mark.asyncio -async def test_generate_azure_cluster_agent_token_async_from_dict(): - await test_generate_azure_cluster_agent_token_async(request_type=dict) - - def test_generate_azure_cluster_agent_token_field_headers(): client = AzureClustersClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5187,8 +5217,8 @@ async def test_generate_azure_cluster_agent_token_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - azure_service.GenerateAzureAccessTokenRequest, - dict, + azure_service.GenerateAzureAccessTokenRequest(), + {}, ], ) def test_generate_azure_access_token(request_type, transport: str = "grpc"): @@ -5199,7 +5229,7 @@ def test_generate_azure_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( @@ -5247,9 +5277,10 @@ def test_generate_azure_access_token_non_empty_request_with_auto_populated_field client.generate_azure_access_token(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == azure_service.GenerateAzureAccessTokenRequest( + request_msg = azure_service.GenerateAzureAccessTokenRequest( azure_cluster="azure_cluster_value", ) + assert args[0] == request_msg def test_generate_azure_access_token_use_cached_wrapped_rpc(): @@ -5335,9 +5366,15 @@ async def test_generate_azure_access_token_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + azure_service.GenerateAzureAccessTokenRequest(), + {}, + ], +) async def test_generate_azure_access_token_async( - transport: str = "grpc_asyncio", - request_type=azure_service.GenerateAzureAccessTokenRequest, + request_type, transport: str = "grpc_asyncio" ): client = AzureClustersAsyncClient( credentials=async_anonymous_credentials(), @@ -5346,7 +5383,7 @@ async def test_generate_azure_access_token_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( @@ -5371,11 +5408,6 @@ async def test_generate_azure_access_token_async( assert response.access_token == "access_token_value" -@pytest.mark.asyncio -async def test_generate_azure_access_token_async_from_dict(): - await test_generate_azure_access_token_async(request_type=dict) - - def test_generate_azure_access_token_field_headers(): client = AzureClustersClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5444,8 +5476,8 @@ async def test_generate_azure_access_token_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - azure_service.CreateAzureNodePoolRequest, - dict, + azure_service.CreateAzureNodePoolRequest(), + {}, ], ) def test_create_azure_node_pool(request_type, transport: str = "grpc"): @@ -5456,7 +5488,7 @@ def test_create_azure_node_pool(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5502,10 +5534,11 @@ def test_create_azure_node_pool_non_empty_request_with_auto_populated_field(): client.create_azure_node_pool(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == azure_service.CreateAzureNodePoolRequest( + request_msg = azure_service.CreateAzureNodePoolRequest( parent="parent_value", azure_node_pool_id="azure_node_pool_id_value", ) + assert args[0] == request_msg def test_create_azure_node_pool_use_cached_wrapped_rpc(): @@ -5601,9 +5634,15 @@ async def test_create_azure_node_pool_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + azure_service.CreateAzureNodePoolRequest(), + {}, + ], +) async def test_create_azure_node_pool_async( - transport: str = "grpc_asyncio", - request_type=azure_service.CreateAzureNodePoolRequest, + request_type, transport: str = "grpc_asyncio" ): client = AzureClustersAsyncClient( credentials=async_anonymous_credentials(), @@ -5612,7 +5651,7 @@ async def test_create_azure_node_pool_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( @@ -5634,11 +5673,6 @@ async def test_create_azure_node_pool_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_azure_node_pool_async_from_dict(): - await test_create_azure_node_pool_async(request_type=dict) - - def test_create_azure_node_pool_field_headers(): client = AzureClustersClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5813,8 +5847,8 @@ async def test_create_azure_node_pool_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - azure_service.UpdateAzureNodePoolRequest, - dict, + azure_service.UpdateAzureNodePoolRequest(), + {}, ], ) def test_update_azure_node_pool(request_type, transport: str = "grpc"): @@ -5825,7 +5859,7 @@ def test_update_azure_node_pool(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5868,7 +5902,8 @@ def test_update_azure_node_pool_non_empty_request_with_auto_populated_field(): client.update_azure_node_pool(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == azure_service.UpdateAzureNodePoolRequest() + request_msg = azure_service.UpdateAzureNodePoolRequest() + assert args[0] == request_msg def test_update_azure_node_pool_use_cached_wrapped_rpc(): @@ -5964,9 +5999,15 @@ async def test_update_azure_node_pool_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + azure_service.UpdateAzureNodePoolRequest(), + {}, + ], +) async def test_update_azure_node_pool_async( - transport: str = "grpc_asyncio", - request_type=azure_service.UpdateAzureNodePoolRequest, + request_type, transport: str = "grpc_asyncio" ): client = AzureClustersAsyncClient( credentials=async_anonymous_credentials(), @@ -5975,7 +6016,7 @@ async def test_update_azure_node_pool_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( @@ -5997,11 +6038,6 @@ async def test_update_azure_node_pool_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_azure_node_pool_async_from_dict(): - await test_update_azure_node_pool_async(request_type=dict) - - def test_update_azure_node_pool_field_headers(): client = AzureClustersClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6166,8 +6202,8 @@ async def test_update_azure_node_pool_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - azure_service.GetAzureNodePoolRequest, - dict, + azure_service.GetAzureNodePoolRequest(), + {}, ], ) def test_get_azure_node_pool(request_type, transport: str = "grpc"): @@ -6178,7 +6214,7 @@ def test_get_azure_node_pool(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6240,9 +6276,10 @@ def test_get_azure_node_pool_non_empty_request_with_auto_populated_field(): client.get_azure_node_pool(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == azure_service.GetAzureNodePoolRequest( + request_msg = azure_service.GetAzureNodePoolRequest( name="name_value", ) + assert args[0] == request_msg def test_get_azure_node_pool_use_cached_wrapped_rpc(): @@ -6327,9 +6364,14 @@ async def test_get_azure_node_pool_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_azure_node_pool_async( - transport: str = "grpc_asyncio", request_type=azure_service.GetAzureNodePoolRequest -): +@pytest.mark.parametrize( + "request_type", + [ + azure_service.GetAzureNodePoolRequest(), + {}, + ], +) +async def test_get_azure_node_pool_async(request_type, transport: str = "grpc_asyncio"): client = AzureClustersAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6337,7 +6379,7 @@ async def test_get_azure_node_pool_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( @@ -6376,11 +6418,6 @@ async def test_get_azure_node_pool_async( assert response.azure_availability_zone == "azure_availability_zone_value" -@pytest.mark.asyncio -async def test_get_azure_node_pool_async_from_dict(): - await test_get_azure_node_pool_async(request_type=dict) - - def test_get_azure_node_pool_field_headers(): client = AzureClustersClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6535,8 +6572,8 @@ async def test_get_azure_node_pool_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - azure_service.ListAzureNodePoolsRequest, - dict, + azure_service.ListAzureNodePoolsRequest(), + {}, ], ) def test_list_azure_node_pools(request_type, transport: str = "grpc"): @@ -6547,7 +6584,7 @@ def test_list_azure_node_pools(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6596,10 +6633,11 @@ def test_list_azure_node_pools_non_empty_request_with_auto_populated_field(): client.list_azure_node_pools(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == azure_service.ListAzureNodePoolsRequest( + request_msg = azure_service.ListAzureNodePoolsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_azure_node_pools_use_cached_wrapped_rpc(): @@ -6685,9 +6723,15 @@ async def test_list_azure_node_pools_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + azure_service.ListAzureNodePoolsRequest(), + {}, + ], +) async def test_list_azure_node_pools_async( - transport: str = "grpc_asyncio", - request_type=azure_service.ListAzureNodePoolsRequest, + request_type, transport: str = "grpc_asyncio" ): client = AzureClustersAsyncClient( credentials=async_anonymous_credentials(), @@ -6696,7 +6740,7 @@ async def test_list_azure_node_pools_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( @@ -6721,11 +6765,6 @@ async def test_list_azure_node_pools_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_azure_node_pools_async_from_dict(): - await test_list_azure_node_pools_async(request_type=dict) - - def test_list_azure_node_pools_field_headers(): client = AzureClustersClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7078,8 +7117,8 @@ async def test_list_azure_node_pools_async_pages(): @pytest.mark.parametrize( "request_type", [ - azure_service.DeleteAzureNodePoolRequest, - dict, + azure_service.DeleteAzureNodePoolRequest(), + {}, ], ) def test_delete_azure_node_pool(request_type, transport: str = "grpc"): @@ -7090,7 +7129,7 @@ def test_delete_azure_node_pool(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7136,10 +7175,11 @@ def test_delete_azure_node_pool_non_empty_request_with_auto_populated_field(): client.delete_azure_node_pool(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == azure_service.DeleteAzureNodePoolRequest( + request_msg = azure_service.DeleteAzureNodePoolRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_azure_node_pool_use_cached_wrapped_rpc(): @@ -7235,9 +7275,15 @@ async def test_delete_azure_node_pool_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + azure_service.DeleteAzureNodePoolRequest(), + {}, + ], +) async def test_delete_azure_node_pool_async( - transport: str = "grpc_asyncio", - request_type=azure_service.DeleteAzureNodePoolRequest, + request_type, transport: str = "grpc_asyncio" ): client = AzureClustersAsyncClient( credentials=async_anonymous_credentials(), @@ -7246,7 +7292,7 @@ async def test_delete_azure_node_pool_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( @@ -7268,11 +7314,6 @@ async def test_delete_azure_node_pool_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_azure_node_pool_async_from_dict(): - await test_delete_azure_node_pool_async(request_type=dict) - - def test_delete_azure_node_pool_field_headers(): client = AzureClustersClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7427,8 +7468,8 @@ async def test_delete_azure_node_pool_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - azure_service.GetAzureOpenIdConfigRequest, - dict, + azure_service.GetAzureOpenIdConfigRequest(), + {}, ], ) def test_get_azure_open_id_config(request_type, transport: str = "grpc"): @@ -7439,7 +7480,7 @@ def test_get_azure_open_id_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( @@ -7503,9 +7544,10 @@ def test_get_azure_open_id_config_non_empty_request_with_auto_populated_field(): client.get_azure_open_id_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == azure_service.GetAzureOpenIdConfigRequest( + request_msg = azure_service.GetAzureOpenIdConfigRequest( azure_cluster="azure_cluster_value", ) + assert args[0] == request_msg def test_get_azure_open_id_config_use_cached_wrapped_rpc(): @@ -7591,9 +7633,15 @@ async def test_get_azure_open_id_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + azure_service.GetAzureOpenIdConfigRequest(), + {}, + ], +) async def test_get_azure_open_id_config_async( - transport: str = "grpc_asyncio", - request_type=azure_service.GetAzureOpenIdConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = AzureClustersAsyncClient( credentials=async_anonymous_credentials(), @@ -7602,7 +7650,7 @@ async def test_get_azure_open_id_config_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( @@ -7643,11 +7691,6 @@ async def test_get_azure_open_id_config_async( assert response.grant_types == ["grant_types_value"] -@pytest.mark.asyncio -async def test_get_azure_open_id_config_async_from_dict(): - await test_get_azure_open_id_config_async(request_type=dict) - - def test_get_azure_open_id_config_field_headers(): client = AzureClustersClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7802,8 +7845,8 @@ async def test_get_azure_open_id_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - azure_service.GetAzureJsonWebKeysRequest, - dict, + azure_service.GetAzureJsonWebKeysRequest(), + {}, ], ) def test_get_azure_json_web_keys(request_type, transport: str = "grpc"): @@ -7814,7 +7857,7 @@ def test_get_azure_json_web_keys(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7859,9 +7902,10 @@ def test_get_azure_json_web_keys_non_empty_request_with_auto_populated_field(): client.get_azure_json_web_keys(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == azure_service.GetAzureJsonWebKeysRequest( + request_msg = azure_service.GetAzureJsonWebKeysRequest( azure_cluster="azure_cluster_value", ) + assert args[0] == request_msg def test_get_azure_json_web_keys_use_cached_wrapped_rpc(): @@ -7947,9 +7991,15 @@ async def test_get_azure_json_web_keys_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + azure_service.GetAzureJsonWebKeysRequest(), + {}, + ], +) async def test_get_azure_json_web_keys_async( - transport: str = "grpc_asyncio", - request_type=azure_service.GetAzureJsonWebKeysRequest, + request_type, transport: str = "grpc_asyncio" ): client = AzureClustersAsyncClient( credentials=async_anonymous_credentials(), @@ -7958,7 +8008,7 @@ async def test_get_azure_json_web_keys_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( @@ -7980,11 +8030,6 @@ async def test_get_azure_json_web_keys_async( assert isinstance(response, azure_resources.AzureJsonWebKeys) -@pytest.mark.asyncio -async def test_get_azure_json_web_keys_async_from_dict(): - await test_get_azure_json_web_keys_async(request_type=dict) - - def test_get_azure_json_web_keys_field_headers(): client = AzureClustersClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8139,8 +8184,8 @@ async def test_get_azure_json_web_keys_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - azure_service.GetAzureServerConfigRequest, - dict, + azure_service.GetAzureServerConfigRequest(), + {}, ], ) def test_get_azure_server_config(request_type, transport: str = "grpc"): @@ -8151,7 +8196,7 @@ def test_get_azure_server_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( @@ -8201,9 +8246,10 @@ def test_get_azure_server_config_non_empty_request_with_auto_populated_field(): client.get_azure_server_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == azure_service.GetAzureServerConfigRequest( + request_msg = azure_service.GetAzureServerConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_azure_server_config_use_cached_wrapped_rpc(): @@ -8289,9 +8335,15 @@ async def test_get_azure_server_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + azure_service.GetAzureServerConfigRequest(), + {}, + ], +) async def test_get_azure_server_config_async( - transport: str = "grpc_asyncio", - request_type=azure_service.GetAzureServerConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = AzureClustersAsyncClient( credentials=async_anonymous_credentials(), @@ -8300,7 +8352,7 @@ async def test_get_azure_server_config_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( @@ -8327,11 +8379,6 @@ async def test_get_azure_server_config_async( assert response.supported_azure_regions == ["supported_azure_regions_value"] -@pytest.mark.asyncio -async def test_get_azure_server_config_async_from_dict(): - await test_get_azure_server_config_async(request_type=dict) - - def test_get_azure_server_config_field_headers(): client = AzureClustersClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12445,7 +12492,6 @@ def test_create_azure_client_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = azure_service.CreateAzureClientRequest() - assert args[0] == request_msg @@ -12466,7 +12512,6 @@ def test_get_azure_client_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = azure_service.GetAzureClientRequest() - assert args[0] == request_msg @@ -12489,7 +12534,6 @@ def test_list_azure_clients_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = azure_service.ListAzureClientsRequest() - assert args[0] == request_msg @@ -12512,7 +12556,6 @@ def test_delete_azure_client_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = azure_service.DeleteAzureClientRequest() - assert args[0] == request_msg @@ -12535,7 +12578,6 @@ def test_create_azure_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = azure_service.CreateAzureClusterRequest() - assert args[0] == request_msg @@ -12558,7 +12600,6 @@ def test_update_azure_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = azure_service.UpdateAzureClusterRequest() - assert args[0] == request_msg @@ -12581,7 +12622,6 @@ def test_get_azure_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = azure_service.GetAzureClusterRequest() - assert args[0] == request_msg @@ -12604,7 +12644,6 @@ def test_list_azure_clusters_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = azure_service.ListAzureClustersRequest() - assert args[0] == request_msg @@ -12627,7 +12666,6 @@ def test_delete_azure_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = azure_service.DeleteAzureClusterRequest() - assert args[0] == request_msg @@ -12650,7 +12688,6 @@ def test_generate_azure_cluster_agent_token_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = azure_service.GenerateAzureClusterAgentTokenRequest() - assert args[0] == request_msg @@ -12673,7 +12710,6 @@ def test_generate_azure_access_token_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = azure_service.GenerateAzureAccessTokenRequest() - assert args[0] == request_msg @@ -12696,7 +12732,6 @@ def test_create_azure_node_pool_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = azure_service.CreateAzureNodePoolRequest() - assert args[0] == request_msg @@ -12719,7 +12754,6 @@ def test_update_azure_node_pool_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = azure_service.UpdateAzureNodePoolRequest() - assert args[0] == request_msg @@ -12742,7 +12776,6 @@ def test_get_azure_node_pool_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = azure_service.GetAzureNodePoolRequest() - assert args[0] == request_msg @@ -12765,7 +12798,6 @@ def test_list_azure_node_pools_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = azure_service.ListAzureNodePoolsRequest() - assert args[0] == request_msg @@ -12788,7 +12820,6 @@ def test_delete_azure_node_pool_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = azure_service.DeleteAzureNodePoolRequest() - assert args[0] == request_msg @@ -12811,7 +12842,6 @@ def test_get_azure_open_id_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = azure_service.GetAzureOpenIdConfigRequest() - assert args[0] == request_msg @@ -12834,7 +12864,6 @@ def test_get_azure_json_web_keys_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = azure_service.GetAzureJsonWebKeysRequest() - assert args[0] == request_msg @@ -12857,7 +12886,6 @@ def test_get_azure_server_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = azure_service.GetAzureServerConfigRequest() - assert args[0] == request_msg @@ -12898,7 +12926,6 @@ async def test_create_azure_client_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = azure_service.CreateAzureClientRequest() - assert args[0] == request_msg @@ -12930,7 +12957,6 @@ async def test_get_azure_client_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = azure_service.GetAzureClientRequest() - assert args[0] == request_msg @@ -12959,7 +12985,6 @@ async def test_list_azure_clients_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = azure_service.ListAzureClientsRequest() - assert args[0] == request_msg @@ -12986,7 +13011,6 @@ async def test_delete_azure_client_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = azure_service.DeleteAzureClientRequest() - assert args[0] == request_msg @@ -13013,7 +13037,6 @@ async def test_create_azure_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = azure_service.CreateAzureClusterRequest() - assert args[0] == request_msg @@ -13040,7 +13063,6 @@ async def test_update_azure_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = azure_service.UpdateAzureClusterRequest() - assert args[0] == request_msg @@ -13079,7 +13101,6 @@ async def test_get_azure_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = azure_service.GetAzureClusterRequest() - assert args[0] == request_msg @@ -13108,7 +13129,6 @@ async def test_list_azure_clusters_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = azure_service.ListAzureClustersRequest() - assert args[0] == request_msg @@ -13135,7 +13155,6 @@ async def test_delete_azure_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = azure_service.DeleteAzureClusterRequest() - assert args[0] == request_msg @@ -13166,7 +13185,6 @@ async def test_generate_azure_cluster_agent_token_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = azure_service.GenerateAzureClusterAgentTokenRequest() - assert args[0] == request_msg @@ -13195,7 +13213,6 @@ async def test_generate_azure_access_token_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = azure_service.GenerateAzureAccessTokenRequest() - assert args[0] == request_msg @@ -13222,7 +13239,6 @@ async def test_create_azure_node_pool_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = azure_service.CreateAzureNodePoolRequest() - assert args[0] == request_msg @@ -13249,7 +13265,6 @@ async def test_update_azure_node_pool_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = azure_service.UpdateAzureNodePoolRequest() - assert args[0] == request_msg @@ -13285,7 +13300,6 @@ async def test_get_azure_node_pool_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = azure_service.GetAzureNodePoolRequest() - assert args[0] == request_msg @@ -13314,7 +13328,6 @@ async def test_list_azure_node_pools_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = azure_service.ListAzureNodePoolsRequest() - assert args[0] == request_msg @@ -13341,7 +13354,6 @@ async def test_delete_azure_node_pool_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = azure_service.DeleteAzureNodePoolRequest() - assert args[0] == request_msg @@ -13378,7 +13390,6 @@ async def test_get_azure_open_id_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = azure_service.GetAzureOpenIdConfigRequest() - assert args[0] == request_msg @@ -13405,7 +13416,6 @@ async def test_get_azure_json_web_keys_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = azure_service.GetAzureJsonWebKeysRequest() - assert args[0] == request_msg @@ -13435,7 +13445,6 @@ async def test_get_azure_server_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = azure_service.GetAzureServerConfigRequest() - assert args[0] == request_msg @@ -16892,7 +16901,6 @@ def test_create_azure_client_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = azure_service.CreateAzureClientRequest() - assert args[0] == request_msg @@ -16912,7 +16920,6 @@ def test_get_azure_client_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = azure_service.GetAzureClientRequest() - assert args[0] == request_msg @@ -16934,7 +16941,6 @@ def test_list_azure_clients_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = azure_service.ListAzureClientsRequest() - assert args[0] == request_msg @@ -16956,7 +16962,6 @@ def test_delete_azure_client_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = azure_service.DeleteAzureClientRequest() - assert args[0] == request_msg @@ -16978,7 +16983,6 @@ def test_create_azure_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = azure_service.CreateAzureClusterRequest() - assert args[0] == request_msg @@ -17000,7 +17004,6 @@ def test_update_azure_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = azure_service.UpdateAzureClusterRequest() - assert args[0] == request_msg @@ -17022,7 +17025,6 @@ def test_get_azure_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = azure_service.GetAzureClusterRequest() - assert args[0] == request_msg @@ -17044,7 +17046,6 @@ def test_list_azure_clusters_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = azure_service.ListAzureClustersRequest() - assert args[0] == request_msg @@ -17066,7 +17067,6 @@ def test_delete_azure_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = azure_service.DeleteAzureClusterRequest() - assert args[0] == request_msg @@ -17088,7 +17088,6 @@ def test_generate_azure_cluster_agent_token_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = azure_service.GenerateAzureClusterAgentTokenRequest() - assert args[0] == request_msg @@ -17110,7 +17109,6 @@ def test_generate_azure_access_token_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = azure_service.GenerateAzureAccessTokenRequest() - assert args[0] == request_msg @@ -17132,7 +17130,6 @@ def test_create_azure_node_pool_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = azure_service.CreateAzureNodePoolRequest() - assert args[0] == request_msg @@ -17154,7 +17151,6 @@ def test_update_azure_node_pool_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = azure_service.UpdateAzureNodePoolRequest() - assert args[0] == request_msg @@ -17176,7 +17172,6 @@ def test_get_azure_node_pool_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = azure_service.GetAzureNodePoolRequest() - assert args[0] == request_msg @@ -17198,7 +17193,6 @@ def test_list_azure_node_pools_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = azure_service.ListAzureNodePoolsRequest() - assert args[0] == request_msg @@ -17220,7 +17214,6 @@ def test_delete_azure_node_pool_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = azure_service.DeleteAzureNodePoolRequest() - assert args[0] == request_msg @@ -17242,7 +17235,6 @@ def test_get_azure_open_id_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = azure_service.GetAzureOpenIdConfigRequest() - assert args[0] == request_msg @@ -17264,7 +17256,6 @@ def test_get_azure_json_web_keys_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = azure_service.GetAzureJsonWebKeysRequest() - assert args[0] == request_msg @@ -17286,7 +17277,6 @@ def test_get_azure_server_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = azure_service.GetAzureServerConfigRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-gkerecommender/noxfile.py b/packages/google-cloud-gkerecommender/noxfile.py index ee2862eacec0..b11b2a44dfee 100644 --- a/packages/google-cloud-gkerecommender/noxfile.py +++ b/packages/google-cloud-gkerecommender/noxfile.py @@ -47,7 +47,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-gkerecommender" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-gkerecommender/setup.py b/packages/google-cloud-gkerecommender/setup.py index 017454eb8797..cac4e5c4b9c5 100644 --- a/packages/google-cloud-gkerecommender/setup.py +++ b/packages/google-cloud-gkerecommender/setup.py @@ -45,7 +45,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/google-cloud-gkerecommender/testing/constraints-3.10.txt b/packages/google-cloud-gkerecommender/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-gkerecommender/testing/constraints-3.10.txt +++ b/packages/google-cloud-gkerecommender/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-gkerecommender/tests/unit/gapic/gkerecommender_v1/test_gke_inference_quickstart.py b/packages/google-cloud-gkerecommender/tests/unit/gapic/gkerecommender_v1/test_gke_inference_quickstart.py index 8c79b18e1d8d..df0993f0ce29 100644 --- a/packages/google-cloud-gkerecommender/tests/unit/gapic/gkerecommender_v1/test_gke_inference_quickstart.py +++ b/packages/google-cloud-gkerecommender/tests/unit/gapic/gkerecommender_v1/test_gke_inference_quickstart.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 @@ -107,6 +108,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" @@ -1376,8 +1392,8 @@ def test_gke_inference_quickstart_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - gkerecommender.FetchModelsRequest, - dict, + gkerecommender.FetchModelsRequest(), + {}, ], ) def test_fetch_models(request_type, transport: str = "grpc"): @@ -1388,7 +1404,7 @@ def test_fetch_models(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.fetch_models), "__call__") as call: @@ -1434,9 +1450,10 @@ def test_fetch_models_non_empty_request_with_auto_populated_field(): client.fetch_models(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gkerecommender.FetchModelsRequest( + request_msg = gkerecommender.FetchModelsRequest( page_token="page_token_value", ) + assert args[0] == request_msg def test_fetch_models_use_cached_wrapped_rpc(): @@ -1517,9 +1534,14 @@ async def test_fetch_models_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_fetch_models_async( - transport: str = "grpc_asyncio", request_type=gkerecommender.FetchModelsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gkerecommender.FetchModelsRequest(), + {}, + ], +) +async def test_fetch_models_async(request_type, transport: str = "grpc_asyncio"): client = GkeInferenceQuickstartAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1527,7 +1549,7 @@ async def test_fetch_models_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.fetch_models), "__call__") as call: @@ -1552,11 +1574,6 @@ async def test_fetch_models_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_fetch_models_async_from_dict(): - await test_fetch_models_async(request_type=dict) - - def test_fetch_models_pager(transport_name: str = "grpc"): client = GkeInferenceQuickstartClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1747,8 +1764,8 @@ async def test_fetch_models_async_pages(): @pytest.mark.parametrize( "request_type", [ - gkerecommender.FetchModelServersRequest, - dict, + gkerecommender.FetchModelServersRequest(), + {}, ], ) def test_fetch_model_servers(request_type, transport: str = "grpc"): @@ -1759,7 +1776,7 @@ def test_fetch_model_servers(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1810,10 +1827,11 @@ def test_fetch_model_servers_non_empty_request_with_auto_populated_field(): client.fetch_model_servers(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gkerecommender.FetchModelServersRequest( + request_msg = gkerecommender.FetchModelServersRequest( model="model_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_fetch_model_servers_use_cached_wrapped_rpc(): @@ -1898,10 +1916,14 @@ async def test_fetch_model_servers_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_fetch_model_servers_async( - transport: str = "grpc_asyncio", - request_type=gkerecommender.FetchModelServersRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + gkerecommender.FetchModelServersRequest(), + {}, + ], +) +async def test_fetch_model_servers_async(request_type, transport: str = "grpc_asyncio"): client = GkeInferenceQuickstartAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1909,7 +1931,7 @@ async def test_fetch_model_servers_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( @@ -1936,11 +1958,6 @@ async def test_fetch_model_servers_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_fetch_model_servers_async_from_dict(): - await test_fetch_model_servers_async(request_type=dict) - - def test_fetch_model_servers_pager(transport_name: str = "grpc"): client = GkeInferenceQuickstartClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2139,8 +2156,8 @@ async def test_fetch_model_servers_async_pages(): @pytest.mark.parametrize( "request_type", [ - gkerecommender.FetchModelServerVersionsRequest, - dict, + gkerecommender.FetchModelServerVersionsRequest(), + {}, ], ) def test_fetch_model_server_versions(request_type, transport: str = "grpc"): @@ -2151,7 +2168,7 @@ def test_fetch_model_server_versions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2203,11 +2220,12 @@ def test_fetch_model_server_versions_non_empty_request_with_auto_populated_field client.fetch_model_server_versions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gkerecommender.FetchModelServerVersionsRequest( + request_msg = gkerecommender.FetchModelServerVersionsRequest( model="model_value", model_server="model_server_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_fetch_model_server_versions_use_cached_wrapped_rpc(): @@ -2293,9 +2311,15 @@ async def test_fetch_model_server_versions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gkerecommender.FetchModelServerVersionsRequest(), + {}, + ], +) async def test_fetch_model_server_versions_async( - transport: str = "grpc_asyncio", - request_type=gkerecommender.FetchModelServerVersionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = GkeInferenceQuickstartAsyncClient( credentials=async_anonymous_credentials(), @@ -2304,7 +2328,7 @@ async def test_fetch_model_server_versions_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( @@ -2331,11 +2355,6 @@ async def test_fetch_model_server_versions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_fetch_model_server_versions_async_from_dict(): - await test_fetch_model_server_versions_async(request_type=dict) - - def test_fetch_model_server_versions_pager(transport_name: str = "grpc"): client = GkeInferenceQuickstartClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2536,8 +2555,8 @@ async def test_fetch_model_server_versions_async_pages(): @pytest.mark.parametrize( "request_type", [ - gkerecommender.FetchProfilesRequest, - dict, + gkerecommender.FetchProfilesRequest(), + {}, ], ) def test_fetch_profiles(request_type, transport: str = "grpc"): @@ -2548,7 +2567,7 @@ def test_fetch_profiles(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.fetch_profiles), "__call__") as call: @@ -2597,12 +2616,13 @@ def test_fetch_profiles_non_empty_request_with_auto_populated_field(): client.fetch_profiles(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gkerecommender.FetchProfilesRequest( + request_msg = gkerecommender.FetchProfilesRequest( model="model_value", model_server="model_server_value", model_server_version="model_server_version_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_fetch_profiles_use_cached_wrapped_rpc(): @@ -2683,9 +2703,14 @@ async def test_fetch_profiles_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_fetch_profiles_async( - transport: str = "grpc_asyncio", request_type=gkerecommender.FetchProfilesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gkerecommender.FetchProfilesRequest(), + {}, + ], +) +async def test_fetch_profiles_async(request_type, transport: str = "grpc_asyncio"): client = GkeInferenceQuickstartAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2693,7 +2718,7 @@ async def test_fetch_profiles_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.fetch_profiles), "__call__") as call: @@ -2718,11 +2743,6 @@ async def test_fetch_profiles_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_fetch_profiles_async_from_dict(): - await test_fetch_profiles_async(request_type=dict) - - def test_fetch_profiles_pager(transport_name: str = "grpc"): client = GkeInferenceQuickstartClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2913,8 +2933,8 @@ async def test_fetch_profiles_async_pages(): @pytest.mark.parametrize( "request_type", [ - gkerecommender.GenerateOptimizedManifestRequest, - dict, + gkerecommender.GenerateOptimizedManifestRequest(), + {}, ], ) def test_generate_optimized_manifest(request_type, transport: str = "grpc"): @@ -2925,7 +2945,7 @@ def test_generate_optimized_manifest(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2976,10 +2996,11 @@ def test_generate_optimized_manifest_non_empty_request_with_auto_populated_field client.generate_optimized_manifest(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gkerecommender.GenerateOptimizedManifestRequest( + request_msg = gkerecommender.GenerateOptimizedManifestRequest( accelerator_type="accelerator_type_value", kubernetes_namespace="kubernetes_namespace_value", ) + assert args[0] == request_msg def test_generate_optimized_manifest_use_cached_wrapped_rpc(): @@ -3065,9 +3086,15 @@ async def test_generate_optimized_manifest_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gkerecommender.GenerateOptimizedManifestRequest(), + {}, + ], +) async def test_generate_optimized_manifest_async( - transport: str = "grpc_asyncio", - request_type=gkerecommender.GenerateOptimizedManifestRequest, + request_type, transport: str = "grpc_asyncio" ): client = GkeInferenceQuickstartAsyncClient( credentials=async_anonymous_credentials(), @@ -3076,7 +3103,7 @@ async def test_generate_optimized_manifest_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( @@ -3103,16 +3130,11 @@ async def test_generate_optimized_manifest_async( assert response.manifest_version == "manifest_version_value" -@pytest.mark.asyncio -async def test_generate_optimized_manifest_async_from_dict(): - await test_generate_optimized_manifest_async(request_type=dict) - - @pytest.mark.parametrize( "request_type", [ - gkerecommender.FetchBenchmarkingDataRequest, - dict, + gkerecommender.FetchBenchmarkingDataRequest(), + {}, ], ) def test_fetch_benchmarking_data(request_type, transport: str = "grpc"): @@ -3123,7 +3145,7 @@ def test_fetch_benchmarking_data(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3169,10 +3191,11 @@ def test_fetch_benchmarking_data_non_empty_request_with_auto_populated_field(): client.fetch_benchmarking_data(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gkerecommender.FetchBenchmarkingDataRequest( + request_msg = gkerecommender.FetchBenchmarkingDataRequest( instance_type="instance_type_value", pricing_model="pricing_model_value", ) + assert args[0] == request_msg def test_fetch_benchmarking_data_use_cached_wrapped_rpc(): @@ -3258,9 +3281,15 @@ async def test_fetch_benchmarking_data_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gkerecommender.FetchBenchmarkingDataRequest(), + {}, + ], +) async def test_fetch_benchmarking_data_async( - transport: str = "grpc_asyncio", - request_type=gkerecommender.FetchBenchmarkingDataRequest, + request_type, transport: str = "grpc_asyncio" ): client = GkeInferenceQuickstartAsyncClient( credentials=async_anonymous_credentials(), @@ -3269,7 +3298,7 @@ async def test_fetch_benchmarking_data_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( @@ -3291,11 +3320,6 @@ async def test_fetch_benchmarking_data_async( assert isinstance(response, gkerecommender.FetchBenchmarkingDataResponse) -@pytest.mark.asyncio -async def test_fetch_benchmarking_data_async_from_dict(): - await test_fetch_benchmarking_data_async(request_type=dict) - - def test_fetch_models_rest_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, # instead of constructing them on each call @@ -4321,7 +4345,6 @@ def test_fetch_models_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkerecommender.FetchModelsRequest() - assert args[0] == request_msg @@ -4344,7 +4367,6 @@ def test_fetch_model_servers_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkerecommender.FetchModelServersRequest() - assert args[0] == request_msg @@ -4367,7 +4389,6 @@ def test_fetch_model_server_versions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkerecommender.FetchModelServerVersionsRequest() - assert args[0] == request_msg @@ -4388,7 +4409,6 @@ def test_fetch_profiles_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkerecommender.FetchProfilesRequest() - assert args[0] == request_msg @@ -4411,7 +4431,6 @@ def test_generate_optimized_manifest_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkerecommender.GenerateOptimizedManifestRequest() - assert args[0] == request_msg @@ -4434,7 +4453,6 @@ def test_fetch_benchmarking_data_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkerecommender.FetchBenchmarkingDataRequest() - assert args[0] == request_msg @@ -4476,7 +4494,6 @@ async def test_fetch_models_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkerecommender.FetchModelsRequest() - assert args[0] == request_msg @@ -4506,7 +4523,6 @@ async def test_fetch_model_servers_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkerecommender.FetchModelServersRequest() - assert args[0] == request_msg @@ -4536,7 +4552,6 @@ async def test_fetch_model_server_versions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkerecommender.FetchModelServerVersionsRequest() - assert args[0] == request_msg @@ -4564,7 +4579,6 @@ async def test_fetch_profiles_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkerecommender.FetchProfilesRequest() - assert args[0] == request_msg @@ -4594,7 +4608,6 @@ async def test_generate_optimized_manifest_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkerecommender.GenerateOptimizedManifestRequest() - assert args[0] == request_msg @@ -4621,7 +4634,6 @@ async def test_fetch_benchmarking_data_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkerecommender.FetchBenchmarkingDataRequest() - assert args[0] == request_msg @@ -5479,7 +5491,6 @@ def test_fetch_models_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkerecommender.FetchModelsRequest() - assert args[0] == request_msg @@ -5501,7 +5512,6 @@ def test_fetch_model_servers_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkerecommender.FetchModelServersRequest() - assert args[0] == request_msg @@ -5523,7 +5533,6 @@ def test_fetch_model_server_versions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkerecommender.FetchModelServerVersionsRequest() - assert args[0] == request_msg @@ -5543,7 +5552,6 @@ def test_fetch_profiles_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkerecommender.FetchProfilesRequest() - assert args[0] == request_msg @@ -5565,7 +5573,6 @@ def test_generate_optimized_manifest_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkerecommender.GenerateOptimizedManifestRequest() - assert args[0] == request_msg @@ -5587,7 +5594,6 @@ def test_fetch_benchmarking_data_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gkerecommender.FetchBenchmarkingDataRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-gsuiteaddons/noxfile.py b/packages/google-cloud-gsuiteaddons/noxfile.py index d8fc404df287..da154872a469 100644 --- a/packages/google-cloud-gsuiteaddons/noxfile.py +++ b/packages/google-cloud-gsuiteaddons/noxfile.py @@ -47,7 +47,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-gsuiteaddons" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-gsuiteaddons/setup.py b/packages/google-cloud-gsuiteaddons/setup.py index 868d9f66b004..a2d572a5e832 100644 --- a/packages/google-cloud-gsuiteaddons/setup.py +++ b/packages/google-cloud-gsuiteaddons/setup.py @@ -45,7 +45,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/google-cloud-gsuiteaddons/testing/constraints-3.10.txt b/packages/google-cloud-gsuiteaddons/testing/constraints-3.10.txt index ce2dbec8cfeb..287fc3345b5d 100644 --- a/packages/google-cloud-gsuiteaddons/testing/constraints-3.10.txt +++ b/packages/google-cloud-gsuiteaddons/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-apps-script-type==0.2.0 diff --git a/packages/google-cloud-gsuiteaddons/tests/unit/gapic/gsuiteaddons_v1/test_g_suite_add_ons.py b/packages/google-cloud-gsuiteaddons/tests/unit/gapic/gsuiteaddons_v1/test_g_suite_add_ons.py index d9376895b2e9..ecdc15b48b11 100644 --- a/packages/google-cloud-gsuiteaddons/tests/unit/gapic/gsuiteaddons_v1/test_g_suite_add_ons.py +++ b/packages/google-cloud-gsuiteaddons/tests/unit/gapic/gsuiteaddons_v1/test_g_suite_add_ons.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 @@ -120,6 +121,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" @@ -1300,8 +1316,8 @@ def test_g_suite_add_ons_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - gsuiteaddons.GetAuthorizationRequest, - dict, + gsuiteaddons.GetAuthorizationRequest(), + {}, ], ) def test_get_authorization(request_type, transport: str = "grpc"): @@ -1312,7 +1328,7 @@ def test_get_authorization(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,9 +1380,10 @@ def test_get_authorization_non_empty_request_with_auto_populated_field(): client.get_authorization(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gsuiteaddons.GetAuthorizationRequest( + request_msg = gsuiteaddons.GetAuthorizationRequest( name="name_value", ) + assert args[0] == request_msg def test_get_authorization_use_cached_wrapped_rpc(): @@ -1449,9 +1466,14 @@ async def test_get_authorization_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_authorization_async( - transport: str = "grpc_asyncio", request_type=gsuiteaddons.GetAuthorizationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gsuiteaddons.GetAuthorizationRequest(), + {}, + ], +) +async def test_get_authorization_async(request_type, transport: str = "grpc_asyncio"): client = GSuiteAddOnsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1459,7 +1481,7 @@ async def test_get_authorization_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( @@ -1488,11 +1510,6 @@ async def test_get_authorization_async( assert response.oauth_client_id == "oauth_client_id_value" -@pytest.mark.asyncio -async def test_get_authorization_async_from_dict(): - await test_get_authorization_async(request_type=dict) - - def test_get_authorization_field_headers(): client = GSuiteAddOnsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1647,8 +1664,8 @@ async def test_get_authorization_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gsuiteaddons.CreateDeploymentRequest, - dict, + gsuiteaddons.CreateDeploymentRequest(), + {}, ], ) def test_create_deployment(request_type, transport: str = "grpc"): @@ -1659,7 +1676,7 @@ def test_create_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1712,10 +1729,11 @@ def test_create_deployment_non_empty_request_with_auto_populated_field(): client.create_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gsuiteaddons.CreateDeploymentRequest( + request_msg = gsuiteaddons.CreateDeploymentRequest( parent="parent_value", deployment_id="deployment_id_value", ) + assert args[0] == request_msg def test_create_deployment_use_cached_wrapped_rpc(): @@ -1798,9 +1816,14 @@ async def test_create_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_deployment_async( - transport: str = "grpc_asyncio", request_type=gsuiteaddons.CreateDeploymentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gsuiteaddons.CreateDeploymentRequest(), + {}, + ], +) +async def test_create_deployment_async(request_type, transport: str = "grpc_asyncio"): client = GSuiteAddOnsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1808,7 +1831,7 @@ async def test_create_deployment_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( @@ -1837,11 +1860,6 @@ async def test_create_deployment_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_create_deployment_async_from_dict(): - await test_create_deployment_async(request_type=dict) - - def test_create_deployment_field_headers(): client = GSuiteAddOnsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2016,8 +2034,8 @@ async def test_create_deployment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gsuiteaddons.ReplaceDeploymentRequest, - dict, + gsuiteaddons.ReplaceDeploymentRequest(), + {}, ], ) def test_replace_deployment(request_type, transport: str = "grpc"): @@ -2028,7 +2046,7 @@ def test_replace_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2078,7 +2096,8 @@ def test_replace_deployment_non_empty_request_with_auto_populated_field(): client.replace_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gsuiteaddons.ReplaceDeploymentRequest() + request_msg = gsuiteaddons.ReplaceDeploymentRequest() + assert args[0] == request_msg def test_replace_deployment_use_cached_wrapped_rpc(): @@ -2163,9 +2182,14 @@ async def test_replace_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_replace_deployment_async( - transport: str = "grpc_asyncio", request_type=gsuiteaddons.ReplaceDeploymentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gsuiteaddons.ReplaceDeploymentRequest(), + {}, + ], +) +async def test_replace_deployment_async(request_type, transport: str = "grpc_asyncio"): client = GSuiteAddOnsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2173,7 +2197,7 @@ async def test_replace_deployment_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( @@ -2202,11 +2226,6 @@ async def test_replace_deployment_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_replace_deployment_async_from_dict(): - await test_replace_deployment_async(request_type=dict) - - def test_replace_deployment_field_headers(): client = GSuiteAddOnsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2361,8 +2380,8 @@ async def test_replace_deployment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gsuiteaddons.GetDeploymentRequest, - dict, + gsuiteaddons.GetDeploymentRequest(), + {}, ], ) def test_get_deployment(request_type, transport: str = "grpc"): @@ -2373,7 +2392,7 @@ def test_get_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_deployment), "__call__") as call: @@ -2421,9 +2440,10 @@ def test_get_deployment_non_empty_request_with_auto_populated_field(): client.get_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gsuiteaddons.GetDeploymentRequest( + request_msg = gsuiteaddons.GetDeploymentRequest( name="name_value", ) + assert args[0] == request_msg def test_get_deployment_use_cached_wrapped_rpc(): @@ -2504,9 +2524,14 @@ async def test_get_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_deployment_async( - transport: str = "grpc_asyncio", request_type=gsuiteaddons.GetDeploymentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gsuiteaddons.GetDeploymentRequest(), + {}, + ], +) +async def test_get_deployment_async(request_type, transport: str = "grpc_asyncio"): client = GSuiteAddOnsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2514,7 +2539,7 @@ async def test_get_deployment_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_deployment), "__call__") as call: @@ -2541,11 +2566,6 @@ async def test_get_deployment_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_deployment_async_from_dict(): - await test_get_deployment_async(request_type=dict) - - def test_get_deployment_field_headers(): client = GSuiteAddOnsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2692,8 +2712,8 @@ async def test_get_deployment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gsuiteaddons.ListDeploymentsRequest, - dict, + gsuiteaddons.ListDeploymentsRequest(), + {}, ], ) def test_list_deployments(request_type, transport: str = "grpc"): @@ -2704,7 +2724,7 @@ def test_list_deployments(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_deployments), "__call__") as call: @@ -2749,10 +2769,11 @@ def test_list_deployments_non_empty_request_with_auto_populated_field(): client.list_deployments(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gsuiteaddons.ListDeploymentsRequest( + request_msg = gsuiteaddons.ListDeploymentsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_deployments_use_cached_wrapped_rpc(): @@ -2835,9 +2856,14 @@ async def test_list_deployments_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_deployments_async( - transport: str = "grpc_asyncio", request_type=gsuiteaddons.ListDeploymentsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gsuiteaddons.ListDeploymentsRequest(), + {}, + ], +) +async def test_list_deployments_async(request_type, transport: str = "grpc_asyncio"): client = GSuiteAddOnsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2845,7 +2871,7 @@ async def test_list_deployments_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_deployments), "__call__") as call: @@ -2868,11 +2894,6 @@ async def test_list_deployments_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_deployments_async_from_dict(): - await test_list_deployments_async(request_type=dict) - - def test_list_deployments_field_headers(): client = GSuiteAddOnsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3209,8 +3230,8 @@ async def test_list_deployments_async_pages(): @pytest.mark.parametrize( "request_type", [ - gsuiteaddons.DeleteDeploymentRequest, - dict, + gsuiteaddons.DeleteDeploymentRequest(), + {}, ], ) def test_delete_deployment(request_type, transport: str = "grpc"): @@ -3221,7 +3242,7 @@ def test_delete_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,10 +3288,11 @@ def test_delete_deployment_non_empty_request_with_auto_populated_field(): client.delete_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gsuiteaddons.DeleteDeploymentRequest( + request_msg = gsuiteaddons.DeleteDeploymentRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_deployment_use_cached_wrapped_rpc(): @@ -3353,9 +3375,14 @@ async def test_delete_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_deployment_async( - transport: str = "grpc_asyncio", request_type=gsuiteaddons.DeleteDeploymentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gsuiteaddons.DeleteDeploymentRequest(), + {}, + ], +) +async def test_delete_deployment_async(request_type, transport: str = "grpc_asyncio"): client = GSuiteAddOnsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3363,7 +3390,7 @@ async def test_delete_deployment_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( @@ -3383,11 +3410,6 @@ async def test_delete_deployment_async( assert response is None -@pytest.mark.asyncio -async def test_delete_deployment_async_from_dict(): - await test_delete_deployment_async(request_type=dict) - - def test_delete_deployment_field_headers(): client = GSuiteAddOnsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3538,8 +3560,8 @@ async def test_delete_deployment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gsuiteaddons.InstallDeploymentRequest, - dict, + gsuiteaddons.InstallDeploymentRequest(), + {}, ], ) def test_install_deployment(request_type, transport: str = "grpc"): @@ -3550,7 +3572,7 @@ def test_install_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3595,9 +3617,10 @@ def test_install_deployment_non_empty_request_with_auto_populated_field(): client.install_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gsuiteaddons.InstallDeploymentRequest( + request_msg = gsuiteaddons.InstallDeploymentRequest( name="name_value", ) + assert args[0] == request_msg def test_install_deployment_use_cached_wrapped_rpc(): @@ -3682,9 +3705,14 @@ async def test_install_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_install_deployment_async( - transport: str = "grpc_asyncio", request_type=gsuiteaddons.InstallDeploymentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gsuiteaddons.InstallDeploymentRequest(), + {}, + ], +) +async def test_install_deployment_async(request_type, transport: str = "grpc_asyncio"): client = GSuiteAddOnsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3692,7 +3720,7 @@ async def test_install_deployment_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( @@ -3712,11 +3740,6 @@ async def test_install_deployment_async( assert response is None -@pytest.mark.asyncio -async def test_install_deployment_async_from_dict(): - await test_install_deployment_async(request_type=dict) - - def test_install_deployment_field_headers(): client = GSuiteAddOnsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3867,8 +3890,8 @@ async def test_install_deployment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gsuiteaddons.UninstallDeploymentRequest, - dict, + gsuiteaddons.UninstallDeploymentRequest(), + {}, ], ) def test_uninstall_deployment(request_type, transport: str = "grpc"): @@ -3879,7 +3902,7 @@ def test_uninstall_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3924,9 +3947,10 @@ def test_uninstall_deployment_non_empty_request_with_auto_populated_field(): client.uninstall_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gsuiteaddons.UninstallDeploymentRequest( + request_msg = gsuiteaddons.UninstallDeploymentRequest( name="name_value", ) + assert args[0] == request_msg def test_uninstall_deployment_use_cached_wrapped_rpc(): @@ -4011,9 +4035,15 @@ async def test_uninstall_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gsuiteaddons.UninstallDeploymentRequest(), + {}, + ], +) async def test_uninstall_deployment_async( - transport: str = "grpc_asyncio", - request_type=gsuiteaddons.UninstallDeploymentRequest, + request_type, transport: str = "grpc_asyncio" ): client = GSuiteAddOnsAsyncClient( credentials=async_anonymous_credentials(), @@ -4022,7 +4052,7 @@ async def test_uninstall_deployment_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( @@ -4042,11 +4072,6 @@ async def test_uninstall_deployment_async( assert response is None -@pytest.mark.asyncio -async def test_uninstall_deployment_async_from_dict(): - await test_uninstall_deployment_async(request_type=dict) - - def test_uninstall_deployment_field_headers(): client = GSuiteAddOnsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4197,8 +4222,8 @@ async def test_uninstall_deployment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gsuiteaddons.GetInstallStatusRequest, - dict, + gsuiteaddons.GetInstallStatusRequest(), + {}, ], ) def test_get_install_status(request_type, transport: str = "grpc"): @@ -4209,7 +4234,7 @@ def test_get_install_status(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4257,9 +4282,10 @@ def test_get_install_status_non_empty_request_with_auto_populated_field(): client.get_install_status(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gsuiteaddons.GetInstallStatusRequest( + request_msg = gsuiteaddons.GetInstallStatusRequest( name="name_value", ) + assert args[0] == request_msg def test_get_install_status_use_cached_wrapped_rpc(): @@ -4344,9 +4370,14 @@ async def test_get_install_status_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_install_status_async( - transport: str = "grpc_asyncio", request_type=gsuiteaddons.GetInstallStatusRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gsuiteaddons.GetInstallStatusRequest(), + {}, + ], +) +async def test_get_install_status_async(request_type, transport: str = "grpc_asyncio"): client = GSuiteAddOnsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4354,7 +4385,7 @@ async def test_get_install_status_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( @@ -4379,11 +4410,6 @@ async def test_get_install_status_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_install_status_async_from_dict(): - await test_get_install_status_async(request_type=dict) - - def test_get_install_status_field_headers(): client = GSuiteAddOnsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6367,7 +6393,6 @@ def test_get_authorization_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gsuiteaddons.GetAuthorizationRequest() - assert args[0] == request_msg @@ -6390,7 +6415,6 @@ def test_create_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gsuiteaddons.CreateDeploymentRequest() - assert args[0] == request_msg @@ -6413,7 +6437,6 @@ def test_replace_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gsuiteaddons.ReplaceDeploymentRequest() - assert args[0] == request_msg @@ -6434,7 +6457,6 @@ def test_get_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gsuiteaddons.GetDeploymentRequest() - assert args[0] == request_msg @@ -6455,7 +6477,6 @@ def test_list_deployments_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gsuiteaddons.ListDeploymentsRequest() - assert args[0] == request_msg @@ -6478,7 +6499,6 @@ def test_delete_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gsuiteaddons.DeleteDeploymentRequest() - assert args[0] == request_msg @@ -6501,7 +6521,6 @@ def test_install_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gsuiteaddons.InstallDeploymentRequest() - assert args[0] == request_msg @@ -6524,7 +6543,6 @@ def test_uninstall_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gsuiteaddons.UninstallDeploymentRequest() - assert args[0] == request_msg @@ -6547,7 +6565,6 @@ def test_get_install_status_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gsuiteaddons.GetInstallStatusRequest() - assert args[0] == request_msg @@ -6592,7 +6609,6 @@ async def test_get_authorization_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gsuiteaddons.GetAuthorizationRequest() - assert args[0] == request_msg @@ -6623,7 +6639,6 @@ async def test_create_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gsuiteaddons.CreateDeploymentRequest() - assert args[0] == request_msg @@ -6654,7 +6669,6 @@ async def test_replace_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gsuiteaddons.ReplaceDeploymentRequest() - assert args[0] == request_msg @@ -6683,7 +6697,6 @@ async def test_get_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gsuiteaddons.GetDeploymentRequest() - assert args[0] == request_msg @@ -6710,7 +6723,6 @@ async def test_list_deployments_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gsuiteaddons.ListDeploymentsRequest() - assert args[0] == request_msg @@ -6735,7 +6747,6 @@ async def test_delete_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gsuiteaddons.DeleteDeploymentRequest() - assert args[0] == request_msg @@ -6760,7 +6771,6 @@ async def test_install_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gsuiteaddons.InstallDeploymentRequest() - assert args[0] == request_msg @@ -6785,7 +6795,6 @@ async def test_uninstall_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gsuiteaddons.UninstallDeploymentRequest() - assert args[0] == request_msg @@ -6814,7 +6823,6 @@ async def test_get_install_status_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gsuiteaddons.GetInstallStatusRequest() - assert args[0] == request_msg @@ -8318,7 +8326,6 @@ def test_get_authorization_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gsuiteaddons.GetAuthorizationRequest() - assert args[0] == request_msg @@ -8340,7 +8347,6 @@ def test_create_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gsuiteaddons.CreateDeploymentRequest() - assert args[0] == request_msg @@ -8362,7 +8368,6 @@ def test_replace_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gsuiteaddons.ReplaceDeploymentRequest() - assert args[0] == request_msg @@ -8382,7 +8387,6 @@ def test_get_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gsuiteaddons.GetDeploymentRequest() - assert args[0] == request_msg @@ -8402,7 +8406,6 @@ def test_list_deployments_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gsuiteaddons.ListDeploymentsRequest() - assert args[0] == request_msg @@ -8424,7 +8427,6 @@ def test_delete_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gsuiteaddons.DeleteDeploymentRequest() - assert args[0] == request_msg @@ -8446,7 +8448,6 @@ def test_install_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gsuiteaddons.InstallDeploymentRequest() - assert args[0] == request_msg @@ -8468,7 +8469,6 @@ def test_uninstall_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gsuiteaddons.UninstallDeploymentRequest() - assert args[0] == request_msg @@ -8490,7 +8490,6 @@ def test_get_install_status_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gsuiteaddons.GetInstallStatusRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-hypercomputecluster/noxfile.py b/packages/google-cloud-hypercomputecluster/noxfile.py index 458d4dd0e990..0a5b009a3092 100644 --- a/packages/google-cloud-hypercomputecluster/noxfile.py +++ b/packages/google-cloud-hypercomputecluster/noxfile.py @@ -47,7 +47,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-hypercomputecluster" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-hypercomputecluster/setup.py b/packages/google-cloud-hypercomputecluster/setup.py index 94c1e017df67..30775e33ba78 100644 --- a/packages/google-cloud-hypercomputecluster/setup.py +++ b/packages/google-cloud-hypercomputecluster/setup.py @@ -45,7 +45,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/google-cloud-hypercomputecluster/testing/constraints-3.10.txt b/packages/google-cloud-hypercomputecluster/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-hypercomputecluster/testing/constraints-3.10.txt +++ b/packages/google-cloud-hypercomputecluster/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-hypercomputecluster/tests/unit/gapic/hypercomputecluster_v1/test_hypercompute_cluster.py b/packages/google-cloud-hypercomputecluster/tests/unit/gapic/hypercomputecluster_v1/test_hypercompute_cluster.py index 4acae63e8373..c75ced1f1f90 100644 --- a/packages/google-cloud-hypercomputecluster/tests/unit/gapic/hypercomputecluster_v1/test_hypercompute_cluster.py +++ b/packages/google-cloud-hypercomputecluster/tests/unit/gapic/hypercomputecluster_v1/test_hypercompute_cluster.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 @@ -120,6 +121,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" @@ -1383,8 +1399,8 @@ def test_hypercompute_cluster_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - hypercompute_cluster.ListClustersRequest, - dict, + hypercompute_cluster.ListClustersRequest(), + {}, ], ) def test_list_clusters(request_type, transport: str = "grpc"): @@ -1395,7 +1411,7 @@ def test_list_clusters(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_clusters), "__call__") as call: @@ -1444,12 +1460,13 @@ def test_list_clusters_non_empty_request_with_auto_populated_field(): client.list_clusters(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hypercompute_cluster.ListClustersRequest( + request_msg = hypercompute_cluster.ListClustersRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_clusters_use_cached_wrapped_rpc(): @@ -1530,10 +1547,14 @@ async def test_list_clusters_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_clusters_async( - transport: str = "grpc_asyncio", - request_type=hypercompute_cluster.ListClustersRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + hypercompute_cluster.ListClustersRequest(), + {}, + ], +) +async def test_list_clusters_async(request_type, transport: str = "grpc_asyncio"): client = HypercomputeClusterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1541,7 +1562,7 @@ async def test_list_clusters_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_clusters), "__call__") as call: @@ -1566,11 +1587,6 @@ async def test_list_clusters_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_clusters_async_from_dict(): - await test_list_clusters_async(request_type=dict) - - def test_list_clusters_field_headers(): client = HypercomputeClusterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1907,8 +1923,8 @@ async def test_list_clusters_async_pages(): @pytest.mark.parametrize( "request_type", [ - hypercompute_cluster.GetClusterRequest, - dict, + hypercompute_cluster.GetClusterRequest(), + {}, ], ) def test_get_cluster(request_type, transport: str = "grpc"): @@ -1919,7 +1935,7 @@ def test_get_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_cluster), "__call__") as call: @@ -1967,9 +1983,10 @@ def test_get_cluster_non_empty_request_with_auto_populated_field(): client.get_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hypercompute_cluster.GetClusterRequest( + request_msg = hypercompute_cluster.GetClusterRequest( name="name_value", ) + assert args[0] == request_msg def test_get_cluster_use_cached_wrapped_rpc(): @@ -2050,9 +2067,14 @@ async def test_get_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_cluster_async( - transport: str = "grpc_asyncio", request_type=hypercompute_cluster.GetClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + hypercompute_cluster.GetClusterRequest(), + {}, + ], +) +async def test_get_cluster_async(request_type, transport: str = "grpc_asyncio"): client = HypercomputeClusterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2060,7 +2082,7 @@ async def test_get_cluster_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_cluster), "__call__") as call: @@ -2087,11 +2109,6 @@ async def test_get_cluster_async( assert response.reconciling is True -@pytest.mark.asyncio -async def test_get_cluster_async_from_dict(): - await test_get_cluster_async(request_type=dict) - - def test_get_cluster_field_headers(): client = HypercomputeClusterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2238,8 +2255,8 @@ async def test_get_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - hypercompute_cluster.CreateClusterRequest, - dict, + hypercompute_cluster.CreateClusterRequest(), + {}, ], ) def test_create_cluster(request_type, transport: str = "grpc"): @@ -2250,7 +2267,7 @@ def test_create_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_cluster), "__call__") as call: @@ -2292,10 +2309,11 @@ def test_create_cluster_non_empty_request_with_auto_populated_field(): client.create_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hypercompute_cluster.CreateClusterRequest( + request_msg = hypercompute_cluster.CreateClusterRequest( parent="parent_value", cluster_id="cluster_id_value", ) + assert args[0] == request_msg def test_create_cluster_use_cached_wrapped_rpc(): @@ -2386,10 +2404,14 @@ async def test_create_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_cluster_async( - transport: str = "grpc_asyncio", - request_type=hypercompute_cluster.CreateClusterRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + hypercompute_cluster.CreateClusterRequest(), + {}, + ], +) +async def test_create_cluster_async(request_type, transport: str = "grpc_asyncio"): client = HypercomputeClusterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2397,7 +2419,7 @@ async def test_create_cluster_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_cluster), "__call__") as call: @@ -2417,11 +2439,6 @@ async def test_create_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_cluster_async_from_dict(): - await test_create_cluster_async(request_type=dict) - - def test_create_cluster_field_headers(): client = HypercomputeClusterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2588,8 +2605,8 @@ async def test_create_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - hypercompute_cluster.UpdateClusterRequest, - dict, + hypercompute_cluster.UpdateClusterRequest(), + {}, ], ) def test_update_cluster(request_type, transport: str = "grpc"): @@ -2600,7 +2617,7 @@ def test_update_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_cluster), "__call__") as call: @@ -2639,7 +2656,8 @@ def test_update_cluster_non_empty_request_with_auto_populated_field(): client.update_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hypercompute_cluster.UpdateClusterRequest() + request_msg = hypercompute_cluster.UpdateClusterRequest() + assert args[0] == request_msg def test_update_cluster_use_cached_wrapped_rpc(): @@ -2730,10 +2748,14 @@ async def test_update_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_cluster_async( - transport: str = "grpc_asyncio", - request_type=hypercompute_cluster.UpdateClusterRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + hypercompute_cluster.UpdateClusterRequest(), + {}, + ], +) +async def test_update_cluster_async(request_type, transport: str = "grpc_asyncio"): client = HypercomputeClusterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2741,7 +2763,7 @@ async def test_update_cluster_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_cluster), "__call__") as call: @@ -2761,11 +2783,6 @@ async def test_update_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_cluster_async_from_dict(): - await test_update_cluster_async(request_type=dict) - - def test_update_cluster_field_headers(): client = HypercomputeClusterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2922,8 +2939,8 @@ async def test_update_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - hypercompute_cluster.DeleteClusterRequest, - dict, + hypercompute_cluster.DeleteClusterRequest(), + {}, ], ) def test_delete_cluster(request_type, transport: str = "grpc"): @@ -2934,7 +2951,7 @@ def test_delete_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_cluster), "__call__") as call: @@ -2975,9 +2992,10 @@ def test_delete_cluster_non_empty_request_with_auto_populated_field(): client.delete_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hypercompute_cluster.DeleteClusterRequest( + request_msg = hypercompute_cluster.DeleteClusterRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_cluster_use_cached_wrapped_rpc(): @@ -3068,10 +3086,14 @@ async def test_delete_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_cluster_async( - transport: str = "grpc_asyncio", - request_type=hypercompute_cluster.DeleteClusterRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + hypercompute_cluster.DeleteClusterRequest(), + {}, + ], +) +async def test_delete_cluster_async(request_type, transport: str = "grpc_asyncio"): client = HypercomputeClusterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3079,7 +3101,7 @@ async def test_delete_cluster_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_cluster), "__call__") as call: @@ -3099,11 +3121,6 @@ async def test_delete_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_cluster_async_from_dict(): - await test_delete_cluster_async(request_type=dict) - - def test_delete_cluster_field_headers(): client = HypercomputeClusterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4391,7 +4408,6 @@ def test_list_clusters_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hypercompute_cluster.ListClustersRequest() - assert args[0] == request_msg @@ -4412,7 +4428,6 @@ def test_get_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hypercompute_cluster.GetClusterRequest() - assert args[0] == request_msg @@ -4433,7 +4448,6 @@ def test_create_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hypercompute_cluster.CreateClusterRequest() - assert args[0] == request_msg @@ -4454,7 +4468,6 @@ def test_update_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hypercompute_cluster.UpdateClusterRequest() - assert args[0] == request_msg @@ -4475,7 +4488,6 @@ def test_delete_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hypercompute_cluster.DeleteClusterRequest() - assert args[0] == request_msg @@ -4517,7 +4529,6 @@ async def test_list_clusters_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hypercompute_cluster.ListClustersRequest() - assert args[0] == request_msg @@ -4546,7 +4557,6 @@ async def test_get_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hypercompute_cluster.GetClusterRequest() - assert args[0] == request_msg @@ -4571,7 +4581,6 @@ async def test_create_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hypercompute_cluster.CreateClusterRequest() - assert args[0] == request_msg @@ -4596,7 +4605,6 @@ async def test_update_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hypercompute_cluster.UpdateClusterRequest() - assert args[0] == request_msg @@ -4621,7 +4629,6 @@ async def test_delete_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hypercompute_cluster.DeleteClusterRequest() - assert args[0] == request_msg @@ -5936,7 +5943,6 @@ def test_list_clusters_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hypercompute_cluster.ListClustersRequest() - assert args[0] == request_msg @@ -5956,7 +5962,6 @@ def test_get_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hypercompute_cluster.GetClusterRequest() - assert args[0] == request_msg @@ -5976,7 +5981,6 @@ def test_create_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hypercompute_cluster.CreateClusterRequest() - assert args[0] == request_msg @@ -5996,7 +6000,6 @@ def test_update_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hypercompute_cluster.UpdateClusterRequest() - assert args[0] == request_msg @@ -6016,7 +6019,6 @@ def test_delete_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hypercompute_cluster.DeleteClusterRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-hypercomputecluster/tests/unit/gapic/hypercomputecluster_v1beta/test_hypercompute_cluster.py b/packages/google-cloud-hypercomputecluster/tests/unit/gapic/hypercomputecluster_v1beta/test_hypercompute_cluster.py index bfe5c96674ff..61f8b04ca6a2 100644 --- a/packages/google-cloud-hypercomputecluster/tests/unit/gapic/hypercomputecluster_v1beta/test_hypercompute_cluster.py +++ b/packages/google-cloud-hypercomputecluster/tests/unit/gapic/hypercomputecluster_v1beta/test_hypercompute_cluster.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 @@ -120,6 +121,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" @@ -1383,8 +1399,8 @@ def test_hypercompute_cluster_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - hypercompute_cluster.ListClustersRequest, - dict, + hypercompute_cluster.ListClustersRequest(), + {}, ], ) def test_list_clusters(request_type, transport: str = "grpc"): @@ -1395,7 +1411,7 @@ def test_list_clusters(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_clusters), "__call__") as call: @@ -1444,12 +1460,13 @@ def test_list_clusters_non_empty_request_with_auto_populated_field(): client.list_clusters(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hypercompute_cluster.ListClustersRequest( + request_msg = hypercompute_cluster.ListClustersRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_clusters_use_cached_wrapped_rpc(): @@ -1530,10 +1547,14 @@ async def test_list_clusters_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_clusters_async( - transport: str = "grpc_asyncio", - request_type=hypercompute_cluster.ListClustersRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + hypercompute_cluster.ListClustersRequest(), + {}, + ], +) +async def test_list_clusters_async(request_type, transport: str = "grpc_asyncio"): client = HypercomputeClusterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1541,7 +1562,7 @@ async def test_list_clusters_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_clusters), "__call__") as call: @@ -1566,11 +1587,6 @@ async def test_list_clusters_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_clusters_async_from_dict(): - await test_list_clusters_async(request_type=dict) - - def test_list_clusters_field_headers(): client = HypercomputeClusterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1907,8 +1923,8 @@ async def test_list_clusters_async_pages(): @pytest.mark.parametrize( "request_type", [ - hypercompute_cluster.GetClusterRequest, - dict, + hypercompute_cluster.GetClusterRequest(), + {}, ], ) def test_get_cluster(request_type, transport: str = "grpc"): @@ -1919,7 +1935,7 @@ def test_get_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_cluster), "__call__") as call: @@ -1967,9 +1983,10 @@ def test_get_cluster_non_empty_request_with_auto_populated_field(): client.get_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hypercompute_cluster.GetClusterRequest( + request_msg = hypercompute_cluster.GetClusterRequest( name="name_value", ) + assert args[0] == request_msg def test_get_cluster_use_cached_wrapped_rpc(): @@ -2050,9 +2067,14 @@ async def test_get_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_cluster_async( - transport: str = "grpc_asyncio", request_type=hypercompute_cluster.GetClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + hypercompute_cluster.GetClusterRequest(), + {}, + ], +) +async def test_get_cluster_async(request_type, transport: str = "grpc_asyncio"): client = HypercomputeClusterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2060,7 +2082,7 @@ async def test_get_cluster_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_cluster), "__call__") as call: @@ -2087,11 +2109,6 @@ async def test_get_cluster_async( assert response.reconciling is True -@pytest.mark.asyncio -async def test_get_cluster_async_from_dict(): - await test_get_cluster_async(request_type=dict) - - def test_get_cluster_field_headers(): client = HypercomputeClusterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2238,8 +2255,8 @@ async def test_get_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - hypercompute_cluster.CreateClusterRequest, - dict, + hypercompute_cluster.CreateClusterRequest(), + {}, ], ) def test_create_cluster(request_type, transport: str = "grpc"): @@ -2250,7 +2267,7 @@ def test_create_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_cluster), "__call__") as call: @@ -2292,10 +2309,11 @@ def test_create_cluster_non_empty_request_with_auto_populated_field(): client.create_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hypercompute_cluster.CreateClusterRequest( + request_msg = hypercompute_cluster.CreateClusterRequest( parent="parent_value", cluster_id="cluster_id_value", ) + assert args[0] == request_msg def test_create_cluster_use_cached_wrapped_rpc(): @@ -2386,10 +2404,14 @@ async def test_create_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_cluster_async( - transport: str = "grpc_asyncio", - request_type=hypercompute_cluster.CreateClusterRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + hypercompute_cluster.CreateClusterRequest(), + {}, + ], +) +async def test_create_cluster_async(request_type, transport: str = "grpc_asyncio"): client = HypercomputeClusterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2397,7 +2419,7 @@ async def test_create_cluster_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_cluster), "__call__") as call: @@ -2417,11 +2439,6 @@ async def test_create_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_cluster_async_from_dict(): - await test_create_cluster_async(request_type=dict) - - def test_create_cluster_field_headers(): client = HypercomputeClusterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2588,8 +2605,8 @@ async def test_create_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - hypercompute_cluster.UpdateClusterRequest, - dict, + hypercompute_cluster.UpdateClusterRequest(), + {}, ], ) def test_update_cluster(request_type, transport: str = "grpc"): @@ -2600,7 +2617,7 @@ def test_update_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_cluster), "__call__") as call: @@ -2639,7 +2656,8 @@ def test_update_cluster_non_empty_request_with_auto_populated_field(): client.update_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hypercompute_cluster.UpdateClusterRequest() + request_msg = hypercompute_cluster.UpdateClusterRequest() + assert args[0] == request_msg def test_update_cluster_use_cached_wrapped_rpc(): @@ -2730,10 +2748,14 @@ async def test_update_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_cluster_async( - transport: str = "grpc_asyncio", - request_type=hypercompute_cluster.UpdateClusterRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + hypercompute_cluster.UpdateClusterRequest(), + {}, + ], +) +async def test_update_cluster_async(request_type, transport: str = "grpc_asyncio"): client = HypercomputeClusterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2741,7 +2763,7 @@ async def test_update_cluster_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_cluster), "__call__") as call: @@ -2761,11 +2783,6 @@ async def test_update_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_cluster_async_from_dict(): - await test_update_cluster_async(request_type=dict) - - def test_update_cluster_field_headers(): client = HypercomputeClusterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2922,8 +2939,8 @@ async def test_update_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - hypercompute_cluster.DeleteClusterRequest, - dict, + hypercompute_cluster.DeleteClusterRequest(), + {}, ], ) def test_delete_cluster(request_type, transport: str = "grpc"): @@ -2934,7 +2951,7 @@ def test_delete_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_cluster), "__call__") as call: @@ -2975,9 +2992,10 @@ def test_delete_cluster_non_empty_request_with_auto_populated_field(): client.delete_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hypercompute_cluster.DeleteClusterRequest( + request_msg = hypercompute_cluster.DeleteClusterRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_cluster_use_cached_wrapped_rpc(): @@ -3068,10 +3086,14 @@ async def test_delete_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_cluster_async( - transport: str = "grpc_asyncio", - request_type=hypercompute_cluster.DeleteClusterRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + hypercompute_cluster.DeleteClusterRequest(), + {}, + ], +) +async def test_delete_cluster_async(request_type, transport: str = "grpc_asyncio"): client = HypercomputeClusterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3079,7 +3101,7 @@ async def test_delete_cluster_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_cluster), "__call__") as call: @@ -3099,11 +3121,6 @@ async def test_delete_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_cluster_async_from_dict(): - await test_delete_cluster_async(request_type=dict) - - def test_delete_cluster_field_headers(): client = HypercomputeClusterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4395,7 +4412,6 @@ def test_list_clusters_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hypercompute_cluster.ListClustersRequest() - assert args[0] == request_msg @@ -4416,7 +4432,6 @@ def test_get_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hypercompute_cluster.GetClusterRequest() - assert args[0] == request_msg @@ -4437,7 +4452,6 @@ def test_create_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hypercompute_cluster.CreateClusterRequest() - assert args[0] == request_msg @@ -4458,7 +4472,6 @@ def test_update_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hypercompute_cluster.UpdateClusterRequest() - assert args[0] == request_msg @@ -4479,7 +4492,6 @@ def test_delete_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hypercompute_cluster.DeleteClusterRequest() - assert args[0] == request_msg @@ -4521,7 +4533,6 @@ async def test_list_clusters_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hypercompute_cluster.ListClustersRequest() - assert args[0] == request_msg @@ -4550,7 +4561,6 @@ async def test_get_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hypercompute_cluster.GetClusterRequest() - assert args[0] == request_msg @@ -4575,7 +4585,6 @@ async def test_create_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hypercompute_cluster.CreateClusterRequest() - assert args[0] == request_msg @@ -4600,7 +4609,6 @@ async def test_update_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hypercompute_cluster.UpdateClusterRequest() - assert args[0] == request_msg @@ -4625,7 +4633,6 @@ async def test_delete_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hypercompute_cluster.DeleteClusterRequest() - assert args[0] == request_msg @@ -5940,7 +5947,6 @@ def test_list_clusters_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hypercompute_cluster.ListClustersRequest() - assert args[0] == request_msg @@ -5960,7 +5966,6 @@ def test_get_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hypercompute_cluster.GetClusterRequest() - assert args[0] == request_msg @@ -5980,7 +5985,6 @@ def test_create_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hypercompute_cluster.CreateClusterRequest() - assert args[0] == request_msg @@ -6000,7 +6004,6 @@ def test_update_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hypercompute_cluster.UpdateClusterRequest() - assert args[0] == request_msg @@ -6020,7 +6023,6 @@ def test_delete_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hypercompute_cluster.DeleteClusterRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-iam-logging/noxfile.py b/packages/google-cloud-iam-logging/noxfile.py index 975899b8466b..eb1274b44083 100644 --- a/packages/google-cloud-iam-logging/noxfile.py +++ b/packages/google-cloud-iam-logging/noxfile.py @@ -47,7 +47,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-iam-logging" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-iam-logging/setup.py b/packages/google-cloud-iam-logging/setup.py index db41d71cb205..910ca3483003 100644 --- a/packages/google-cloud-iam-logging/setup.py +++ b/packages/google-cloud-iam-logging/setup.py @@ -45,7 +45,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/google-cloud-iam-logging/testing/constraints-3.10.txt b/packages/google-cloud-iam-logging/testing/constraints-3.10.txt index a92801e1c8e2..b39cd54634f9 100644 --- a/packages/google-cloud-iam-logging/testing/constraints-3.10.txt +++ b/packages/google-cloud-iam-logging/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/google-cloud-iam/noxfile.py b/packages/google-cloud-iam/noxfile.py index c52615db159f..60be3c6e4e18 100644 --- a/packages/google-cloud-iam/noxfile.py +++ b/packages/google-cloud-iam/noxfile.py @@ -47,7 +47,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-iam" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-iam/setup.py b/packages/google-cloud-iam/setup.py index 9940c055aba1..daf8695c129d 100644 --- a/packages/google-cloud-iam/setup.py +++ b/packages/google-cloud-iam/setup.py @@ -44,7 +44,7 @@ # See https://github.com/googleapis/google-cloud-python/issues/12364 "google-auth >= 2.14.1, <3.0.0,!=2.24.0,!=2.25.0", "grpc-google-iam-v1 >=0.12.4, <1.0.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-iam/testing/constraints-3.10.txt b/packages/google-cloud-iam/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-iam/testing/constraints-3.10.txt +++ b/packages/google-cloud-iam/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-iam/tests/unit/gapic/iam_admin_v1/test_iam.py b/packages/google-cloud-iam/tests/unit/gapic/iam_admin_v1/test_iam.py index b47aab5c51b7..bea1199eaa25 100644 --- a/packages/google-cloud-iam/tests/unit/gapic/iam_admin_v1/test_iam.py +++ b/packages/google-cloud-iam/tests/unit/gapic/iam_admin_v1/test_iam.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 @@ -110,6 +111,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" @@ -1196,8 +1212,8 @@ def test_iam_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - iam.ListServiceAccountsRequest, - dict, + iam.ListServiceAccountsRequest(), + {}, ], ) def test_list_service_accounts(request_type, transport: str = "grpc"): @@ -1208,7 +1224,7 @@ def test_list_service_accounts(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1257,10 +1273,11 @@ def test_list_service_accounts_non_empty_request_with_auto_populated_field(): client.list_service_accounts(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam.ListServiceAccountsRequest( + request_msg = iam.ListServiceAccountsRequest( name="name_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_service_accounts_use_cached_wrapped_rpc(): @@ -1346,8 +1363,15 @@ async def test_list_service_accounts_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + iam.ListServiceAccountsRequest(), + {}, + ], +) async def test_list_service_accounts_async( - transport: str = "grpc_asyncio", request_type=iam.ListServiceAccountsRequest + request_type, transport: str = "grpc_asyncio" ): client = IAMAsyncClient( credentials=async_anonymous_credentials(), @@ -1356,7 +1380,7 @@ async def test_list_service_accounts_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( @@ -1381,11 +1405,6 @@ async def test_list_service_accounts_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_service_accounts_async_from_dict(): - await test_list_service_accounts_async(request_type=dict) - - def test_list_service_accounts_field_headers(): client = IAMClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1738,8 +1757,8 @@ async def test_list_service_accounts_async_pages(): @pytest.mark.parametrize( "request_type", [ - iam.GetServiceAccountRequest, - dict, + iam.GetServiceAccountRequest(), + {}, ], ) def test_get_service_account(request_type, transport: str = "grpc"): @@ -1750,7 +1769,7 @@ def test_get_service_account(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1814,9 +1833,10 @@ def test_get_service_account_non_empty_request_with_auto_populated_field(): client.get_service_account(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam.GetServiceAccountRequest( + request_msg = iam.GetServiceAccountRequest( name="name_value", ) + assert args[0] == request_msg def test_get_service_account_use_cached_wrapped_rpc(): @@ -1901,9 +1921,14 @@ async def test_get_service_account_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_service_account_async( - transport: str = "grpc_asyncio", request_type=iam.GetServiceAccountRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam.GetServiceAccountRequest(), + {}, + ], +) +async def test_get_service_account_async(request_type, transport: str = "grpc_asyncio"): client = IAMAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1911,7 +1936,7 @@ async def test_get_service_account_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( @@ -1952,11 +1977,6 @@ async def test_get_service_account_async( assert response.disabled is True -@pytest.mark.asyncio -async def test_get_service_account_async_from_dict(): - await test_get_service_account_async(request_type=dict) - - def test_get_service_account_field_headers(): client = IAMClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2107,8 +2127,8 @@ async def test_get_service_account_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam.CreateServiceAccountRequest, - dict, + iam.CreateServiceAccountRequest(), + {}, ], ) def test_create_service_account(request_type, transport: str = "grpc"): @@ -2119,7 +2139,7 @@ def test_create_service_account(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2184,10 +2204,11 @@ def test_create_service_account_non_empty_request_with_auto_populated_field(): client.create_service_account(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam.CreateServiceAccountRequest( + request_msg = iam.CreateServiceAccountRequest( name="name_value", account_id="account_id_value", ) + assert args[0] == request_msg def test_create_service_account_use_cached_wrapped_rpc(): @@ -2273,8 +2294,15 @@ async def test_create_service_account_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + iam.CreateServiceAccountRequest(), + {}, + ], +) async def test_create_service_account_async( - transport: str = "grpc_asyncio", request_type=iam.CreateServiceAccountRequest + request_type, transport: str = "grpc_asyncio" ): client = IAMAsyncClient( credentials=async_anonymous_credentials(), @@ -2283,7 +2311,7 @@ async def test_create_service_account_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( @@ -2324,11 +2352,6 @@ async def test_create_service_account_async( assert response.disabled is True -@pytest.mark.asyncio -async def test_create_service_account_async_from_dict(): - await test_create_service_account_async(request_type=dict) - - def test_create_service_account_field_headers(): client = IAMClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2499,8 +2522,8 @@ async def test_create_service_account_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam.ServiceAccount, - dict, + iam.ServiceAccount(), + {}, ], ) def test_update_service_account(request_type, transport: str = "grpc"): @@ -2511,7 +2534,7 @@ def test_update_service_account(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2581,7 +2604,7 @@ def test_update_service_account_non_empty_request_with_auto_populated_field(): client.update_service_account(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam.ServiceAccount( + request_msg = iam.ServiceAccount( name="name_value", project_id="project_id_value", unique_id="unique_id_value", @@ -2590,6 +2613,7 @@ def test_update_service_account_non_empty_request_with_auto_populated_field(): description="description_value", oauth2_client_id="oauth2_client_id_value", ) + assert args[0] == request_msg def test_update_service_account_use_cached_wrapped_rpc(): @@ -2675,8 +2699,15 @@ async def test_update_service_account_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + iam.ServiceAccount(), + {}, + ], +) async def test_update_service_account_async( - transport: str = "grpc_asyncio", request_type=iam.ServiceAccount + request_type, transport: str = "grpc_asyncio" ): client = IAMAsyncClient( credentials=async_anonymous_credentials(), @@ -2685,7 +2716,7 @@ async def test_update_service_account_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( @@ -2726,11 +2757,6 @@ async def test_update_service_account_async( assert response.disabled is True -@pytest.mark.asyncio -async def test_update_service_account_async_from_dict(): - await test_update_service_account_async(request_type=dict) - - def test_update_service_account_field_headers(): client = IAMClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2797,8 +2823,8 @@ async def test_update_service_account_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - iam.PatchServiceAccountRequest, - dict, + iam.PatchServiceAccountRequest(), + {}, ], ) def test_patch_service_account(request_type, transport: str = "grpc"): @@ -2809,7 +2835,7 @@ def test_patch_service_account(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2871,7 +2897,8 @@ def test_patch_service_account_non_empty_request_with_auto_populated_field(): client.patch_service_account(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam.PatchServiceAccountRequest() + request_msg = iam.PatchServiceAccountRequest() + assert args[0] == request_msg def test_patch_service_account_use_cached_wrapped_rpc(): @@ -2957,8 +2984,15 @@ async def test_patch_service_account_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + iam.PatchServiceAccountRequest(), + {}, + ], +) async def test_patch_service_account_async( - transport: str = "grpc_asyncio", request_type=iam.PatchServiceAccountRequest + request_type, transport: str = "grpc_asyncio" ): client = IAMAsyncClient( credentials=async_anonymous_credentials(), @@ -2967,7 +3001,7 @@ async def test_patch_service_account_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( @@ -3008,11 +3042,6 @@ async def test_patch_service_account_async( assert response.disabled is True -@pytest.mark.asyncio -async def test_patch_service_account_async_from_dict(): - await test_patch_service_account_async(request_type=dict) - - def test_patch_service_account_field_headers(): client = IAMClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3079,8 +3108,8 @@ async def test_patch_service_account_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - iam.DeleteServiceAccountRequest, - dict, + iam.DeleteServiceAccountRequest(), + {}, ], ) def test_delete_service_account(request_type, transport: str = "grpc"): @@ -3091,7 +3120,7 @@ def test_delete_service_account(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3136,9 +3165,10 @@ def test_delete_service_account_non_empty_request_with_auto_populated_field(): client.delete_service_account(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam.DeleteServiceAccountRequest( + request_msg = iam.DeleteServiceAccountRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_service_account_use_cached_wrapped_rpc(): @@ -3224,8 +3254,15 @@ async def test_delete_service_account_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + iam.DeleteServiceAccountRequest(), + {}, + ], +) async def test_delete_service_account_async( - transport: str = "grpc_asyncio", request_type=iam.DeleteServiceAccountRequest + request_type, transport: str = "grpc_asyncio" ): client = IAMAsyncClient( credentials=async_anonymous_credentials(), @@ -3234,7 +3271,7 @@ async def test_delete_service_account_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( @@ -3254,11 +3291,6 @@ async def test_delete_service_account_async( assert response is None -@pytest.mark.asyncio -async def test_delete_service_account_async_from_dict(): - await test_delete_service_account_async(request_type=dict) - - def test_delete_service_account_field_headers(): client = IAMClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3409,8 +3441,8 @@ async def test_delete_service_account_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam.UndeleteServiceAccountRequest, - dict, + iam.UndeleteServiceAccountRequest(), + {}, ], ) def test_undelete_service_account(request_type, transport: str = "grpc"): @@ -3421,7 +3453,7 @@ def test_undelete_service_account(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3466,9 +3498,10 @@ def test_undelete_service_account_non_empty_request_with_auto_populated_field(): client.undelete_service_account(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam.UndeleteServiceAccountRequest( + request_msg = iam.UndeleteServiceAccountRequest( name="name_value", ) + assert args[0] == request_msg def test_undelete_service_account_use_cached_wrapped_rpc(): @@ -3554,8 +3587,15 @@ async def test_undelete_service_account_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + iam.UndeleteServiceAccountRequest(), + {}, + ], +) async def test_undelete_service_account_async( - transport: str = "grpc_asyncio", request_type=iam.UndeleteServiceAccountRequest + request_type, transport: str = "grpc_asyncio" ): client = IAMAsyncClient( credentials=async_anonymous_credentials(), @@ -3564,7 +3604,7 @@ async def test_undelete_service_account_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( @@ -3586,11 +3626,6 @@ async def test_undelete_service_account_async( assert isinstance(response, iam.UndeleteServiceAccountResponse) -@pytest.mark.asyncio -async def test_undelete_service_account_async_from_dict(): - await test_undelete_service_account_async(request_type=dict) - - def test_undelete_service_account_field_headers(): client = IAMClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3659,8 +3694,8 @@ async def test_undelete_service_account_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - iam.EnableServiceAccountRequest, - dict, + iam.EnableServiceAccountRequest(), + {}, ], ) def test_enable_service_account(request_type, transport: str = "grpc"): @@ -3671,7 +3706,7 @@ def test_enable_service_account(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3716,9 +3751,10 @@ def test_enable_service_account_non_empty_request_with_auto_populated_field(): client.enable_service_account(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam.EnableServiceAccountRequest( + request_msg = iam.EnableServiceAccountRequest( name="name_value", ) + assert args[0] == request_msg def test_enable_service_account_use_cached_wrapped_rpc(): @@ -3804,8 +3840,15 @@ async def test_enable_service_account_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + iam.EnableServiceAccountRequest(), + {}, + ], +) async def test_enable_service_account_async( - transport: str = "grpc_asyncio", request_type=iam.EnableServiceAccountRequest + request_type, transport: str = "grpc_asyncio" ): client = IAMAsyncClient( credentials=async_anonymous_credentials(), @@ -3814,7 +3857,7 @@ async def test_enable_service_account_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( @@ -3834,11 +3877,6 @@ async def test_enable_service_account_async( assert response is None -@pytest.mark.asyncio -async def test_enable_service_account_async_from_dict(): - await test_enable_service_account_async(request_type=dict) - - def test_enable_service_account_field_headers(): client = IAMClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3905,8 +3943,8 @@ async def test_enable_service_account_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - iam.DisableServiceAccountRequest, - dict, + iam.DisableServiceAccountRequest(), + {}, ], ) def test_disable_service_account(request_type, transport: str = "grpc"): @@ -3917,7 +3955,7 @@ def test_disable_service_account(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3962,9 +4000,10 @@ def test_disable_service_account_non_empty_request_with_auto_populated_field(): client.disable_service_account(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam.DisableServiceAccountRequest( + request_msg = iam.DisableServiceAccountRequest( name="name_value", ) + assert args[0] == request_msg def test_disable_service_account_use_cached_wrapped_rpc(): @@ -4050,8 +4089,15 @@ async def test_disable_service_account_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + iam.DisableServiceAccountRequest(), + {}, + ], +) async def test_disable_service_account_async( - transport: str = "grpc_asyncio", request_type=iam.DisableServiceAccountRequest + request_type, transport: str = "grpc_asyncio" ): client = IAMAsyncClient( credentials=async_anonymous_credentials(), @@ -4060,7 +4106,7 @@ async def test_disable_service_account_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( @@ -4080,11 +4126,6 @@ async def test_disable_service_account_async( assert response is None -@pytest.mark.asyncio -async def test_disable_service_account_async_from_dict(): - await test_disable_service_account_async(request_type=dict) - - def test_disable_service_account_field_headers(): client = IAMClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4151,8 +4192,8 @@ async def test_disable_service_account_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - iam.ListServiceAccountKeysRequest, - dict, + iam.ListServiceAccountKeysRequest(), + {}, ], ) def test_list_service_account_keys(request_type, transport: str = "grpc"): @@ -4163,7 +4204,7 @@ def test_list_service_account_keys(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4208,9 +4249,10 @@ def test_list_service_account_keys_non_empty_request_with_auto_populated_field() client.list_service_account_keys(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam.ListServiceAccountKeysRequest( + request_msg = iam.ListServiceAccountKeysRequest( name="name_value", ) + assert args[0] == request_msg def test_list_service_account_keys_use_cached_wrapped_rpc(): @@ -4296,8 +4338,15 @@ async def test_list_service_account_keys_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + iam.ListServiceAccountKeysRequest(), + {}, + ], +) async def test_list_service_account_keys_async( - transport: str = "grpc_asyncio", request_type=iam.ListServiceAccountKeysRequest + request_type, transport: str = "grpc_asyncio" ): client = IAMAsyncClient( credentials=async_anonymous_credentials(), @@ -4306,7 +4355,7 @@ async def test_list_service_account_keys_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( @@ -4328,11 +4377,6 @@ async def test_list_service_account_keys_async( assert isinstance(response, iam.ListServiceAccountKeysResponse) -@pytest.mark.asyncio -async def test_list_service_account_keys_async_from_dict(): - await test_list_service_account_keys_async(request_type=dict) - - def test_list_service_account_keys_field_headers(): client = IAMClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4497,8 +4541,8 @@ async def test_list_service_account_keys_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam.GetServiceAccountKeyRequest, - dict, + iam.GetServiceAccountKeyRequest(), + {}, ], ) def test_get_service_account_key(request_type, transport: str = "grpc"): @@ -4509,7 +4553,7 @@ def test_get_service_account_key(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4573,9 +4617,10 @@ def test_get_service_account_key_non_empty_request_with_auto_populated_field(): client.get_service_account_key(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam.GetServiceAccountKeyRequest( + request_msg = iam.GetServiceAccountKeyRequest( name="name_value", ) + assert args[0] == request_msg def test_get_service_account_key_use_cached_wrapped_rpc(): @@ -4661,8 +4706,15 @@ async def test_get_service_account_key_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + iam.GetServiceAccountKeyRequest(), + {}, + ], +) async def test_get_service_account_key_async( - transport: str = "grpc_asyncio", request_type=iam.GetServiceAccountKeyRequest + request_type, transport: str = "grpc_asyncio" ): client = IAMAsyncClient( credentials=async_anonymous_credentials(), @@ -4671,7 +4723,7 @@ async def test_get_service_account_key_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( @@ -4712,11 +4764,6 @@ async def test_get_service_account_key_async( assert response.disabled is True -@pytest.mark.asyncio -async def test_get_service_account_key_async_from_dict(): - await test_get_service_account_key_async(request_type=dict) - - def test_get_service_account_key_field_headers(): client = IAMClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4881,8 +4928,8 @@ async def test_get_service_account_key_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam.CreateServiceAccountKeyRequest, - dict, + iam.CreateServiceAccountKeyRequest(), + {}, ], ) def test_create_service_account_key(request_type, transport: str = "grpc"): @@ -4893,7 +4940,7 @@ def test_create_service_account_key(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4957,9 +5004,10 @@ def test_create_service_account_key_non_empty_request_with_auto_populated_field( client.create_service_account_key(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam.CreateServiceAccountKeyRequest( + request_msg = iam.CreateServiceAccountKeyRequest( name="name_value", ) + assert args[0] == request_msg def test_create_service_account_key_use_cached_wrapped_rpc(): @@ -5045,8 +5093,15 @@ async def test_create_service_account_key_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + iam.CreateServiceAccountKeyRequest(), + {}, + ], +) async def test_create_service_account_key_async( - transport: str = "grpc_asyncio", request_type=iam.CreateServiceAccountKeyRequest + request_type, transport: str = "grpc_asyncio" ): client = IAMAsyncClient( credentials=async_anonymous_credentials(), @@ -5055,7 +5110,7 @@ async def test_create_service_account_key_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( @@ -5096,11 +5151,6 @@ async def test_create_service_account_key_async( assert response.disabled is True -@pytest.mark.asyncio -async def test_create_service_account_key_async_from_dict(): - await test_create_service_account_key_async(request_type=dict) - - def test_create_service_account_key_field_headers(): client = IAMClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5275,8 +5325,8 @@ async def test_create_service_account_key_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam.UploadServiceAccountKeyRequest, - dict, + iam.UploadServiceAccountKeyRequest(), + {}, ], ) def test_upload_service_account_key(request_type, transport: str = "grpc"): @@ -5287,7 +5337,7 @@ def test_upload_service_account_key(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5351,9 +5401,10 @@ def test_upload_service_account_key_non_empty_request_with_auto_populated_field( client.upload_service_account_key(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam.UploadServiceAccountKeyRequest( + request_msg = iam.UploadServiceAccountKeyRequest( name="name_value", ) + assert args[0] == request_msg def test_upload_service_account_key_use_cached_wrapped_rpc(): @@ -5439,8 +5490,15 @@ async def test_upload_service_account_key_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + iam.UploadServiceAccountKeyRequest(), + {}, + ], +) async def test_upload_service_account_key_async( - transport: str = "grpc_asyncio", request_type=iam.UploadServiceAccountKeyRequest + request_type, transport: str = "grpc_asyncio" ): client = IAMAsyncClient( credentials=async_anonymous_credentials(), @@ -5449,7 +5507,7 @@ async def test_upload_service_account_key_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( @@ -5490,11 +5548,6 @@ async def test_upload_service_account_key_async( assert response.disabled is True -@pytest.mark.asyncio -async def test_upload_service_account_key_async_from_dict(): - await test_upload_service_account_key_async(request_type=dict) - - def test_upload_service_account_key_field_headers(): client = IAMClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5563,8 +5616,8 @@ async def test_upload_service_account_key_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - iam.DeleteServiceAccountKeyRequest, - dict, + iam.DeleteServiceAccountKeyRequest(), + {}, ], ) def test_delete_service_account_key(request_type, transport: str = "grpc"): @@ -5575,7 +5628,7 @@ def test_delete_service_account_key(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5620,9 +5673,10 @@ def test_delete_service_account_key_non_empty_request_with_auto_populated_field( client.delete_service_account_key(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam.DeleteServiceAccountKeyRequest( + request_msg = iam.DeleteServiceAccountKeyRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_service_account_key_use_cached_wrapped_rpc(): @@ -5708,8 +5762,15 @@ async def test_delete_service_account_key_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + iam.DeleteServiceAccountKeyRequest(), + {}, + ], +) async def test_delete_service_account_key_async( - transport: str = "grpc_asyncio", request_type=iam.DeleteServiceAccountKeyRequest + request_type, transport: str = "grpc_asyncio" ): client = IAMAsyncClient( credentials=async_anonymous_credentials(), @@ -5718,7 +5779,7 @@ async def test_delete_service_account_key_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( @@ -5738,11 +5799,6 @@ async def test_delete_service_account_key_async( assert response is None -@pytest.mark.asyncio -async def test_delete_service_account_key_async_from_dict(): - await test_delete_service_account_key_async(request_type=dict) - - def test_delete_service_account_key_field_headers(): client = IAMClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5893,8 +5949,8 @@ async def test_delete_service_account_key_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam.DisableServiceAccountKeyRequest, - dict, + iam.DisableServiceAccountKeyRequest(), + {}, ], ) def test_disable_service_account_key(request_type, transport: str = "grpc"): @@ -5905,7 +5961,7 @@ def test_disable_service_account_key(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5950,9 +6006,10 @@ def test_disable_service_account_key_non_empty_request_with_auto_populated_field client.disable_service_account_key(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam.DisableServiceAccountKeyRequest( + request_msg = iam.DisableServiceAccountKeyRequest( name="name_value", ) + assert args[0] == request_msg def test_disable_service_account_key_use_cached_wrapped_rpc(): @@ -6038,8 +6095,15 @@ async def test_disable_service_account_key_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + iam.DisableServiceAccountKeyRequest(), + {}, + ], +) async def test_disable_service_account_key_async( - transport: str = "grpc_asyncio", request_type=iam.DisableServiceAccountKeyRequest + request_type, transport: str = "grpc_asyncio" ): client = IAMAsyncClient( credentials=async_anonymous_credentials(), @@ -6048,7 +6112,7 @@ async def test_disable_service_account_key_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( @@ -6068,11 +6132,6 @@ async def test_disable_service_account_key_async( assert response is None -@pytest.mark.asyncio -async def test_disable_service_account_key_async_from_dict(): - await test_disable_service_account_key_async(request_type=dict) - - def test_disable_service_account_key_field_headers(): client = IAMClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6223,8 +6282,8 @@ async def test_disable_service_account_key_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam.EnableServiceAccountKeyRequest, - dict, + iam.EnableServiceAccountKeyRequest(), + {}, ], ) def test_enable_service_account_key(request_type, transport: str = "grpc"): @@ -6235,7 +6294,7 @@ def test_enable_service_account_key(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6280,9 +6339,10 @@ def test_enable_service_account_key_non_empty_request_with_auto_populated_field( client.enable_service_account_key(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam.EnableServiceAccountKeyRequest( + request_msg = iam.EnableServiceAccountKeyRequest( name="name_value", ) + assert args[0] == request_msg def test_enable_service_account_key_use_cached_wrapped_rpc(): @@ -6368,8 +6428,15 @@ async def test_enable_service_account_key_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + iam.EnableServiceAccountKeyRequest(), + {}, + ], +) async def test_enable_service_account_key_async( - transport: str = "grpc_asyncio", request_type=iam.EnableServiceAccountKeyRequest + request_type, transport: str = "grpc_asyncio" ): client = IAMAsyncClient( credentials=async_anonymous_credentials(), @@ -6378,7 +6445,7 @@ async def test_enable_service_account_key_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( @@ -6398,11 +6465,6 @@ async def test_enable_service_account_key_async( assert response is None -@pytest.mark.asyncio -async def test_enable_service_account_key_async_from_dict(): - await test_enable_service_account_key_async(request_type=dict) - - def test_enable_service_account_key_field_headers(): client = IAMClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6553,8 +6615,8 @@ async def test_enable_service_account_key_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam.SignBlobRequest, - dict, + iam.SignBlobRequest(), + {}, ], ) def test_sign_blob(request_type, transport: str = "grpc"): @@ -6565,7 +6627,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(type(client.transport.sign_blob), "__call__") as call: @@ -6611,9 +6673,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] == iam.SignBlobRequest( + request_msg = iam.SignBlobRequest( name="name_value", ) + assert args[0] == request_msg def test_sign_blob_use_cached_wrapped_rpc(): @@ -6692,9 +6755,14 @@ async def test_sign_blob_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_sign_blob_async( - transport: str = "grpc_asyncio", request_type=iam.SignBlobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam.SignBlobRequest(), + {}, + ], +) +async def test_sign_blob_async(request_type, transport: str = "grpc_asyncio"): client = IAMAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6702,7 +6770,7 @@ async def test_sign_blob_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.sign_blob), "__call__") as call: @@ -6727,11 +6795,6 @@ async def test_sign_blob_async( assert response.signature == b"signature_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 = IAMClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6888,8 +6951,8 @@ async def test_sign_blob_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam.SignJwtRequest, - dict, + iam.SignJwtRequest(), + {}, ], ) def test_sign_jwt(request_type, transport: str = "grpc"): @@ -6900,7 +6963,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(type(client.transport.sign_jwt), "__call__") as call: @@ -6947,10 +7010,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] == iam.SignJwtRequest( + request_msg = iam.SignJwtRequest( name="name_value", payload="payload_value", ) + assert args[0] == request_msg def test_sign_jwt_use_cached_wrapped_rpc(): @@ -7029,9 +7093,14 @@ async def test_sign_jwt_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn @pytest.mark.asyncio -async def test_sign_jwt_async( - transport: str = "grpc_asyncio", request_type=iam.SignJwtRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam.SignJwtRequest(), + {}, + ], +) +async def test_sign_jwt_async(request_type, transport: str = "grpc_asyncio"): client = IAMAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7039,7 +7108,7 @@ async def test_sign_jwt_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.sign_jwt), "__call__") as call: @@ -7064,11 +7133,6 @@ async def test_sign_jwt_async( 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 = IAMClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7221,8 +7285,8 @@ async def test_sign_jwt_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.GetIamPolicyRequest, - dict, + iam_policy_pb2.GetIamPolicyRequest(), + {}, ], ) def test_get_iam_policy(request_type, transport: str = "grpc"): @@ -7233,7 +7297,7 @@ def test_get_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(type(client.transport.get_iam_policy), "__call__") as call: @@ -7279,9 +7343,10 @@ def test_get_iam_policy_non_empty_request_with_auto_populated_field(): client.get_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.GetIamPolicyRequest( + request_msg = iam_policy_pb2.GetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_get_iam_policy_use_cached_wrapped_rpc(): @@ -7362,9 +7427,14 @@ async def test_get_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.GetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.GetIamPolicyRequest(), + {}, + ], +) +async def test_get_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = IAMAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7372,7 +7442,7 @@ async def test_get_iam_policy_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_iam_policy), "__call__") as call: @@ -7397,11 +7467,6 @@ async def test_get_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_get_iam_policy_async_from_dict(): - await test_get_iam_policy_async(request_type=dict) - - def test_get_iam_policy_field_headers(): client = IAMClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7561,8 +7626,8 @@ async def test_get_iam_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.SetIamPolicyRequest, - dict, + iam_policy_pb2.SetIamPolicyRequest(), + {}, ], ) def test_set_iam_policy(request_type, transport: str = "grpc"): @@ -7573,7 +7638,7 @@ def test_set_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(type(client.transport.set_iam_policy), "__call__") as call: @@ -7619,9 +7684,10 @@ def test_set_iam_policy_non_empty_request_with_auto_populated_field(): client.set_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.SetIamPolicyRequest( + request_msg = iam_policy_pb2.SetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_set_iam_policy_use_cached_wrapped_rpc(): @@ -7702,9 +7768,14 @@ async def test_set_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.SetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.SetIamPolicyRequest(), + {}, + ], +) +async def test_set_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = IAMAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7712,7 +7783,7 @@ async def test_set_iam_policy_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.set_iam_policy), "__call__") as call: @@ -7737,11 +7808,6 @@ async def test_set_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_set_iam_policy_async_from_dict(): - await test_set_iam_policy_async(request_type=dict) - - def test_set_iam_policy_field_headers(): client = IAMClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7902,8 +7968,8 @@ async def test_set_iam_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.TestIamPermissionsRequest, - dict, + iam_policy_pb2.TestIamPermissionsRequest(), + {}, ], ) def test_test_iam_permissions(request_type, transport: str = "grpc"): @@ -7914,7 +7980,7 @@ def test_test_iam_permissions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7962,9 +8028,10 @@ def test_test_iam_permissions_non_empty_request_with_auto_populated_field(): client.test_iam_permissions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.TestIamPermissionsRequest( + request_msg = iam_policy_pb2.TestIamPermissionsRequest( resource="resource_value", ) + assert args[0] == request_msg def test_test_iam_permissions_use_cached_wrapped_rpc(): @@ -8049,9 +8116,15 @@ async def test_test_iam_permissions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.TestIamPermissionsRequest(), + {}, + ], +) async def test_test_iam_permissions_async( - transport: str = "grpc_asyncio", - request_type=iam_policy_pb2.TestIamPermissionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = IAMAsyncClient( credentials=async_anonymous_credentials(), @@ -8060,7 +8133,7 @@ async def test_test_iam_permissions_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,11 +8158,6 @@ async def test_test_iam_permissions_async( assert response.permissions == ["permissions_value"] -@pytest.mark.asyncio -async def test_test_iam_permissions_async_from_dict(): - await test_test_iam_permissions_async(request_type=dict) - - def test_test_iam_permissions_field_headers(): client = IAMClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8273,8 +8341,8 @@ async def test_test_iam_permissions_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam.QueryGrantableRolesRequest, - dict, + iam.QueryGrantableRolesRequest(), + {}, ], ) def test_query_grantable_roles(request_type, transport: str = "grpc"): @@ -8285,7 +8353,7 @@ def test_query_grantable_roles(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8334,10 +8402,11 @@ def test_query_grantable_roles_non_empty_request_with_auto_populated_field(): client.query_grantable_roles(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam.QueryGrantableRolesRequest( + request_msg = iam.QueryGrantableRolesRequest( full_resource_name="full_resource_name_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_query_grantable_roles_use_cached_wrapped_rpc(): @@ -8423,8 +8492,15 @@ async def test_query_grantable_roles_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + iam.QueryGrantableRolesRequest(), + {}, + ], +) async def test_query_grantable_roles_async( - transport: str = "grpc_asyncio", request_type=iam.QueryGrantableRolesRequest + request_type, transport: str = "grpc_asyncio" ): client = IAMAsyncClient( credentials=async_anonymous_credentials(), @@ -8433,7 +8509,7 @@ async def test_query_grantable_roles_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( @@ -8458,11 +8534,6 @@ async def test_query_grantable_roles_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_query_grantable_roles_async_from_dict(): - await test_query_grantable_roles_async(request_type=dict) - - def test_query_grantable_roles_flattened(): client = IAMClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8747,8 +8818,8 @@ async def test_query_grantable_roles_async_pages(): @pytest.mark.parametrize( "request_type", [ - iam.ListRolesRequest, - dict, + iam.ListRolesRequest(), + {}, ], ) def test_list_roles(request_type, transport: str = "grpc"): @@ -8759,7 +8830,7 @@ def test_list_roles(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_roles), "__call__") as call: @@ -8804,10 +8875,11 @@ def test_list_roles_non_empty_request_with_auto_populated_field(): client.list_roles(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam.ListRolesRequest( + request_msg = iam.ListRolesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_roles_use_cached_wrapped_rpc(): @@ -8886,9 +8958,14 @@ async def test_list_roles_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_list_roles_async( - transport: str = "grpc_asyncio", request_type=iam.ListRolesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam.ListRolesRequest(), + {}, + ], +) +async def test_list_roles_async(request_type, transport: str = "grpc_asyncio"): client = IAMAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8896,7 +8973,7 @@ async def test_list_roles_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_roles), "__call__") as call: @@ -8919,11 +8996,6 @@ async def test_list_roles_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_roles_async_from_dict(): - await test_list_roles_async(request_type=dict) - - def test_list_roles_pager(transport_name: str = "grpc"): client = IAMClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9114,8 +9186,8 @@ async def test_list_roles_async_pages(): @pytest.mark.parametrize( "request_type", [ - iam.GetRoleRequest, - dict, + iam.GetRoleRequest(), + {}, ], ) def test_get_role(request_type, transport: str = "grpc"): @@ -9126,7 +9198,7 @@ def test_get_role(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_role), "__call__") as call: @@ -9182,9 +9254,10 @@ def test_get_role_non_empty_request_with_auto_populated_field(): client.get_role(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam.GetRoleRequest( + request_msg = iam.GetRoleRequest( name="name_value", ) + assert args[0] == request_msg def test_get_role_use_cached_wrapped_rpc(): @@ -9263,9 +9336,14 @@ async def test_get_role_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn @pytest.mark.asyncio -async def test_get_role_async( - transport: str = "grpc_asyncio", request_type=iam.GetRoleRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam.GetRoleRequest(), + {}, + ], +) +async def test_get_role_async(request_type, transport: str = "grpc_asyncio"): client = IAMAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9273,7 +9351,7 @@ async def test_get_role_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_role), "__call__") as call: @@ -9308,11 +9386,6 @@ async def test_get_role_async( assert response.deleted is True -@pytest.mark.asyncio -async def test_get_role_async_from_dict(): - await test_get_role_async(request_type=dict) - - def test_get_role_field_headers(): client = IAMClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9375,8 +9448,8 @@ async def test_get_role_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - iam.CreateRoleRequest, - dict, + iam.CreateRoleRequest(), + {}, ], ) def test_create_role(request_type, transport: str = "grpc"): @@ -9387,7 +9460,7 @@ def test_create_role(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_role), "__call__") as call: @@ -9444,10 +9517,11 @@ def test_create_role_non_empty_request_with_auto_populated_field(): client.create_role(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam.CreateRoleRequest( + request_msg = iam.CreateRoleRequest( parent="parent_value", role_id="role_id_value", ) + assert args[0] == request_msg def test_create_role_use_cached_wrapped_rpc(): @@ -9528,9 +9602,14 @@ async def test_create_role_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_role_async( - transport: str = "grpc_asyncio", request_type=iam.CreateRoleRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam.CreateRoleRequest(), + {}, + ], +) +async def test_create_role_async(request_type, transport: str = "grpc_asyncio"): client = IAMAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9538,7 +9617,7 @@ async def test_create_role_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_role), "__call__") as call: @@ -9573,11 +9652,6 @@ async def test_create_role_async( assert response.deleted is True -@pytest.mark.asyncio -async def test_create_role_async_from_dict(): - await test_create_role_async(request_type=dict) - - def test_create_role_field_headers(): client = IAMClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9640,8 +9714,8 @@ async def test_create_role_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - iam.UpdateRoleRequest, - dict, + iam.UpdateRoleRequest(), + {}, ], ) def test_update_role(request_type, transport: str = "grpc"): @@ -9652,7 +9726,7 @@ def test_update_role(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_role), "__call__") as call: @@ -9708,9 +9782,10 @@ def test_update_role_non_empty_request_with_auto_populated_field(): client.update_role(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam.UpdateRoleRequest( + request_msg = iam.UpdateRoleRequest( name="name_value", ) + assert args[0] == request_msg def test_update_role_use_cached_wrapped_rpc(): @@ -9791,9 +9866,14 @@ async def test_update_role_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_role_async( - transport: str = "grpc_asyncio", request_type=iam.UpdateRoleRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam.UpdateRoleRequest(), + {}, + ], +) +async def test_update_role_async(request_type, transport: str = "grpc_asyncio"): client = IAMAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9801,7 +9881,7 @@ async def test_update_role_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_role), "__call__") as call: @@ -9836,11 +9916,6 @@ async def test_update_role_async( assert response.deleted is True -@pytest.mark.asyncio -async def test_update_role_async_from_dict(): - await test_update_role_async(request_type=dict) - - def test_update_role_field_headers(): client = IAMClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9903,8 +9978,8 @@ async def test_update_role_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - iam.DeleteRoleRequest, - dict, + iam.DeleteRoleRequest(), + {}, ], ) def test_delete_role(request_type, transport: str = "grpc"): @@ -9915,7 +9990,7 @@ def test_delete_role(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_role), "__call__") as call: @@ -9971,9 +10046,10 @@ def test_delete_role_non_empty_request_with_auto_populated_field(): client.delete_role(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam.DeleteRoleRequest( + request_msg = iam.DeleteRoleRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_role_use_cached_wrapped_rpc(): @@ -10054,9 +10130,14 @@ async def test_delete_role_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_role_async( - transport: str = "grpc_asyncio", request_type=iam.DeleteRoleRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam.DeleteRoleRequest(), + {}, + ], +) +async def test_delete_role_async(request_type, transport: str = "grpc_asyncio"): client = IAMAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10064,7 +10145,7 @@ async def test_delete_role_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_role), "__call__") as call: @@ -10099,11 +10180,6 @@ async def test_delete_role_async( assert response.deleted is True -@pytest.mark.asyncio -async def test_delete_role_async_from_dict(): - await test_delete_role_async(request_type=dict) - - def test_delete_role_field_headers(): client = IAMClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10166,8 +10242,8 @@ async def test_delete_role_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - iam.UndeleteRoleRequest, - dict, + iam.UndeleteRoleRequest(), + {}, ], ) def test_undelete_role(request_type, transport: str = "grpc"): @@ -10178,7 +10254,7 @@ def test_undelete_role(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_role), "__call__") as call: @@ -10234,9 +10310,10 @@ def test_undelete_role_non_empty_request_with_auto_populated_field(): client.undelete_role(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam.UndeleteRoleRequest( + request_msg = iam.UndeleteRoleRequest( name="name_value", ) + assert args[0] == request_msg def test_undelete_role_use_cached_wrapped_rpc(): @@ -10317,9 +10394,14 @@ async def test_undelete_role_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_undelete_role_async( - transport: str = "grpc_asyncio", request_type=iam.UndeleteRoleRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam.UndeleteRoleRequest(), + {}, + ], +) +async def test_undelete_role_async(request_type, transport: str = "grpc_asyncio"): client = IAMAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10327,7 +10409,7 @@ async def test_undelete_role_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_role), "__call__") as call: @@ -10362,11 +10444,6 @@ async def test_undelete_role_async( assert response.deleted is True -@pytest.mark.asyncio -async def test_undelete_role_async_from_dict(): - await test_undelete_role_async(request_type=dict) - - def test_undelete_role_field_headers(): client = IAMClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10429,8 +10506,8 @@ async def test_undelete_role_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - iam.QueryTestablePermissionsRequest, - dict, + iam.QueryTestablePermissionsRequest(), + {}, ], ) def test_query_testable_permissions(request_type, transport: str = "grpc"): @@ -10441,7 +10518,7 @@ def test_query_testable_permissions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10490,10 +10567,11 @@ def test_query_testable_permissions_non_empty_request_with_auto_populated_field( client.query_testable_permissions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam.QueryTestablePermissionsRequest( + request_msg = iam.QueryTestablePermissionsRequest( full_resource_name="full_resource_name_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_query_testable_permissions_use_cached_wrapped_rpc(): @@ -10579,8 +10657,15 @@ async def test_query_testable_permissions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + iam.QueryTestablePermissionsRequest(), + {}, + ], +) async def test_query_testable_permissions_async( - transport: str = "grpc_asyncio", request_type=iam.QueryTestablePermissionsRequest + request_type, transport: str = "grpc_asyncio" ): client = IAMAsyncClient( credentials=async_anonymous_credentials(), @@ -10589,7 +10674,7 @@ async def test_query_testable_permissions_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( @@ -10614,11 +10699,6 @@ async def test_query_testable_permissions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_query_testable_permissions_async_from_dict(): - await test_query_testable_permissions_async(request_type=dict) - - def test_query_testable_permissions_pager(transport_name: str = "grpc"): client = IAMClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10819,8 +10899,8 @@ async def test_query_testable_permissions_async_pages(): @pytest.mark.parametrize( "request_type", [ - iam.QueryAuditableServicesRequest, - dict, + iam.QueryAuditableServicesRequest(), + {}, ], ) def test_query_auditable_services(request_type, transport: str = "grpc"): @@ -10831,7 +10911,7 @@ def test_query_auditable_services(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10876,9 +10956,10 @@ def test_query_auditable_services_non_empty_request_with_auto_populated_field(): client.query_auditable_services(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam.QueryAuditableServicesRequest( + request_msg = iam.QueryAuditableServicesRequest( full_resource_name="full_resource_name_value", ) + assert args[0] == request_msg def test_query_auditable_services_use_cached_wrapped_rpc(): @@ -10964,8 +11045,15 @@ async def test_query_auditable_services_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + iam.QueryAuditableServicesRequest(), + {}, + ], +) async def test_query_auditable_services_async( - transport: str = "grpc_asyncio", request_type=iam.QueryAuditableServicesRequest + request_type, transport: str = "grpc_asyncio" ): client = IAMAsyncClient( credentials=async_anonymous_credentials(), @@ -10974,7 +11062,7 @@ async def test_query_auditable_services_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( @@ -10996,16 +11084,11 @@ async def test_query_auditable_services_async( assert isinstance(response, iam.QueryAuditableServicesResponse) -@pytest.mark.asyncio -async def test_query_auditable_services_async_from_dict(): - await test_query_auditable_services_async(request_type=dict) - - @pytest.mark.parametrize( "request_type", [ - iam.LintPolicyRequest, - dict, + iam.LintPolicyRequest(), + {}, ], ) def test_lint_policy(request_type, transport: str = "grpc"): @@ -11016,7 +11099,7 @@ def test_lint_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(type(client.transport.lint_policy), "__call__") as call: @@ -11057,9 +11140,10 @@ def test_lint_policy_non_empty_request_with_auto_populated_field(): client.lint_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam.LintPolicyRequest( + request_msg = iam.LintPolicyRequest( full_resource_name="full_resource_name_value", ) + assert args[0] == request_msg def test_lint_policy_use_cached_wrapped_rpc(): @@ -11140,9 +11224,14 @@ async def test_lint_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_lint_policy_async( - transport: str = "grpc_asyncio", request_type=iam.LintPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam.LintPolicyRequest(), + {}, + ], +) +async def test_lint_policy_async(request_type, transport: str = "grpc_asyncio"): client = IAMAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11150,7 +11239,7 @@ async def test_lint_policy_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.lint_policy), "__call__") as call: @@ -11170,11 +11259,6 @@ async def test_lint_policy_async( assert isinstance(response, iam.LintPolicyResponse) -@pytest.mark.asyncio -async def test_lint_policy_async_from_dict(): - await test_lint_policy_async(request_type=dict) - - def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.IAMGrpcTransport( @@ -11299,7 +11383,6 @@ def test_list_service_accounts_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam.ListServiceAccountsRequest() - assert args[0] == request_msg @@ -11322,7 +11405,6 @@ def test_get_service_account_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam.GetServiceAccountRequest() - assert args[0] == request_msg @@ -11345,7 +11427,6 @@ def test_create_service_account_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam.CreateServiceAccountRequest() - assert args[0] == request_msg @@ -11368,7 +11449,6 @@ def test_update_service_account_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam.ServiceAccount() - assert args[0] == request_msg @@ -11391,7 +11471,6 @@ def test_patch_service_account_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam.PatchServiceAccountRequest() - assert args[0] == request_msg @@ -11414,7 +11493,6 @@ def test_delete_service_account_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam.DeleteServiceAccountRequest() - assert args[0] == request_msg @@ -11437,7 +11515,6 @@ def test_undelete_service_account_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam.UndeleteServiceAccountRequest() - assert args[0] == request_msg @@ -11460,7 +11537,6 @@ def test_enable_service_account_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam.EnableServiceAccountRequest() - assert args[0] == request_msg @@ -11483,7 +11559,6 @@ def test_disable_service_account_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam.DisableServiceAccountRequest() - assert args[0] == request_msg @@ -11506,7 +11581,6 @@ def test_list_service_account_keys_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam.ListServiceAccountKeysRequest() - assert args[0] == request_msg @@ -11529,7 +11603,6 @@ def test_get_service_account_key_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam.GetServiceAccountKeyRequest() - assert args[0] == request_msg @@ -11552,7 +11625,6 @@ def test_create_service_account_key_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam.CreateServiceAccountKeyRequest() - assert args[0] == request_msg @@ -11575,7 +11647,6 @@ def test_upload_service_account_key_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam.UploadServiceAccountKeyRequest() - assert args[0] == request_msg @@ -11598,7 +11669,6 @@ def test_delete_service_account_key_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam.DeleteServiceAccountKeyRequest() - assert args[0] == request_msg @@ -11621,7 +11691,6 @@ def test_disable_service_account_key_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam.DisableServiceAccountKeyRequest() - assert args[0] == request_msg @@ -11644,7 +11713,6 @@ def test_enable_service_account_key_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam.EnableServiceAccountKeyRequest() - assert args[0] == request_msg @@ -11665,7 +11733,6 @@ def test_sign_blob_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam.SignBlobRequest() - assert args[0] == request_msg @@ -11686,7 +11753,6 @@ def test_sign_jwt_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam.SignJwtRequest() - assert args[0] == request_msg @@ -11707,7 +11773,6 @@ def test_get_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -11728,7 +11793,6 @@ def test_set_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -11751,7 +11815,6 @@ def test_test_iam_permissions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -11774,7 +11837,6 @@ def test_query_grantable_roles_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam.QueryGrantableRolesRequest() - assert args[0] == request_msg @@ -11795,7 +11857,6 @@ def test_list_roles_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam.ListRolesRequest() - assert args[0] == request_msg @@ -11816,7 +11877,6 @@ def test_get_role_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam.GetRoleRequest() - assert args[0] == request_msg @@ -11837,7 +11897,6 @@ def test_create_role_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam.CreateRoleRequest() - assert args[0] == request_msg @@ -11858,7 +11917,6 @@ def test_update_role_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam.UpdateRoleRequest() - assert args[0] == request_msg @@ -11879,7 +11937,6 @@ def test_delete_role_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam.DeleteRoleRequest() - assert args[0] == request_msg @@ -11900,7 +11957,6 @@ def test_undelete_role_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam.UndeleteRoleRequest() - assert args[0] == request_msg @@ -11923,7 +11979,6 @@ def test_query_testable_permissions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam.QueryTestablePermissionsRequest() - assert args[0] == request_msg @@ -11946,7 +12001,6 @@ def test_query_auditable_services_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam.QueryAuditableServicesRequest() - assert args[0] == request_msg @@ -11967,7 +12021,6 @@ def test_lint_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam.LintPolicyRequest() - assert args[0] == request_msg @@ -12010,7 +12063,6 @@ async def test_list_service_accounts_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam.ListServiceAccountsRequest() - assert args[0] == request_msg @@ -12047,7 +12099,6 @@ async def test_get_service_account_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam.GetServiceAccountRequest() - assert args[0] == request_msg @@ -12084,7 +12135,6 @@ async def test_create_service_account_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam.CreateServiceAccountRequest() - assert args[0] == request_msg @@ -12121,7 +12171,6 @@ async def test_update_service_account_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam.ServiceAccount() - assert args[0] == request_msg @@ -12158,7 +12207,6 @@ async def test_patch_service_account_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam.PatchServiceAccountRequest() - assert args[0] == request_msg @@ -12183,7 +12231,6 @@ async def test_delete_service_account_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam.DeleteServiceAccountRequest() - assert args[0] == request_msg @@ -12210,7 +12257,6 @@ async def test_undelete_service_account_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam.UndeleteServiceAccountRequest() - assert args[0] == request_msg @@ -12235,7 +12281,6 @@ async def test_enable_service_account_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam.EnableServiceAccountRequest() - assert args[0] == request_msg @@ -12260,7 +12305,6 @@ async def test_disable_service_account_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam.DisableServiceAccountRequest() - assert args[0] == request_msg @@ -12287,7 +12331,6 @@ async def test_list_service_account_keys_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam.ListServiceAccountKeysRequest() - assert args[0] == request_msg @@ -12323,7 +12366,6 @@ async def test_get_service_account_key_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam.GetServiceAccountKeyRequest() - assert args[0] == request_msg @@ -12359,7 +12401,6 @@ async def test_create_service_account_key_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam.CreateServiceAccountKeyRequest() - assert args[0] == request_msg @@ -12395,7 +12436,6 @@ async def test_upload_service_account_key_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam.UploadServiceAccountKeyRequest() - assert args[0] == request_msg @@ -12420,7 +12460,6 @@ async def test_delete_service_account_key_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam.DeleteServiceAccountKeyRequest() - assert args[0] == request_msg @@ -12445,7 +12484,6 @@ async def test_disable_service_account_key_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam.DisableServiceAccountKeyRequest() - assert args[0] == request_msg @@ -12470,7 +12508,6 @@ async def test_enable_service_account_key_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam.EnableServiceAccountKeyRequest() - assert args[0] == request_msg @@ -12498,7 +12535,6 @@ async def test_sign_blob_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam.SignBlobRequest() - assert args[0] == request_msg @@ -12526,7 +12562,6 @@ async def test_sign_jwt_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam.SignJwtRequest() - assert args[0] == request_msg @@ -12554,7 +12589,6 @@ async def test_get_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -12582,7 +12616,6 @@ async def test_set_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -12611,7 +12644,6 @@ async def test_test_iam_permissions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -12640,7 +12672,6 @@ async def test_query_grantable_roles_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam.QueryGrantableRolesRequest() - assert args[0] == request_msg @@ -12667,7 +12698,6 @@ async def test_list_roles_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam.ListRolesRequest() - assert args[0] == request_msg @@ -12700,7 +12730,6 @@ async def test_get_role_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam.GetRoleRequest() - assert args[0] == request_msg @@ -12733,7 +12762,6 @@ async def test_create_role_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam.CreateRoleRequest() - assert args[0] == request_msg @@ -12766,7 +12794,6 @@ async def test_update_role_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam.UpdateRoleRequest() - assert args[0] == request_msg @@ -12799,7 +12826,6 @@ async def test_delete_role_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam.DeleteRoleRequest() - assert args[0] == request_msg @@ -12832,7 +12858,6 @@ async def test_undelete_role_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam.UndeleteRoleRequest() - assert args[0] == request_msg @@ -12861,7 +12886,6 @@ async def test_query_testable_permissions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam.QueryTestablePermissionsRequest() - assert args[0] == request_msg @@ -12888,7 +12912,6 @@ async def test_query_auditable_services_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam.QueryAuditableServicesRequest() - assert args[0] == request_msg @@ -12913,7 +12936,6 @@ async def test_lint_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam.LintPolicyRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-iam/tests/unit/gapic/iam_credentials_v1/test_iam_credentials.py b/packages/google-cloud-iam/tests/unit/gapic/iam_credentials_v1/test_iam_credentials.py index 9f61bd874602..4fed983c559e 100644 --- a/packages/google-cloud-iam/tests/unit/gapic/iam_credentials_v1/test_iam_credentials.py +++ b/packages/google-cloud-iam/tests/unit/gapic/iam_credentials_v1/test_iam_credentials.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 @@ -108,6 +109,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" @@ -1311,8 +1327,8 @@ def test_iam_credentials_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - common.GenerateAccessTokenRequest, - dict, + common.GenerateAccessTokenRequest(), + {}, ], ) def test_generate_access_token(request_type, transport: str = "grpc"): @@ -1323,7 +1339,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( @@ -1371,9 +1387,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(): @@ -1459,8 +1476,15 @@ async def test_generate_access_token_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + common.GenerateAccessTokenRequest(), + {}, + ], +) async def test_generate_access_token_async( - transport: str = "grpc_asyncio", request_type=common.GenerateAccessTokenRequest + request_type, transport: str = "grpc_asyncio" ): client = IAMCredentialsAsyncClient( credentials=async_anonymous_credentials(), @@ -1469,7 +1493,7 @@ async def test_generate_access_token_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( @@ -1494,11 +1518,6 @@ async def test_generate_access_token_async( 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(), @@ -1683,8 +1702,8 @@ 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"): @@ -1695,7 +1714,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( @@ -1744,10 +1763,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(): @@ -1830,9 +1850,14 @@ async def test_generate_id_token_async_use_cached_wrapped_rpc( @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, @@ -1840,7 +1865,7 @@ async def test_generate_id_token_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( @@ -1865,11 +1890,6 @@ async def test_generate_id_token_async( 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(), @@ -2054,8 +2074,8 @@ 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"): @@ -2066,7 +2086,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(type(client.transport.sign_blob), "__call__") as call: @@ -2112,9 +2132,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(): @@ -2193,9 +2214,14 @@ async def test_sign_blob_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @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, @@ -2203,7 +2229,7 @@ async def test_sign_blob_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.sign_blob), "__call__") as call: @@ -2228,11 +2254,6 @@ async def test_sign_blob_async( 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(), @@ -2399,8 +2420,8 @@ 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"): @@ -2411,7 +2432,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(type(client.transport.sign_jwt), "__call__") as call: @@ -2458,10 +2479,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(): @@ -2540,9 +2562,14 @@ async def test_sign_jwt_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn @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, @@ -2550,7 +2577,7 @@ async def test_sign_jwt_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.sign_jwt), "__call__") as call: @@ -2575,11 +2602,6 @@ async def test_sign_jwt_async( 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(), @@ -3655,7 +3677,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 @@ -3678,7 +3699,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 @@ -3699,7 +3719,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 @@ -3720,7 +3739,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 @@ -3763,7 +3781,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 @@ -3792,7 +3809,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 @@ -3820,7 +3836,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 @@ -3848,7 +3863,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 @@ -4402,7 +4416,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 @@ -4424,7 +4437,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 @@ -4444,7 +4456,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 @@ -4464,7 +4475,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/google-cloud-iam/tests/unit/gapic/iam_v2/test_policies.py b/packages/google-cloud-iam/tests/unit/gapic/iam_v2/test_policies.py index b6198fdf6eba..914107150922 100644 --- a/packages/google-cloud-iam/tests/unit/gapic/iam_v2/test_policies.py +++ b/packages/google-cloud-iam/tests/unit/gapic/iam_v2/test_policies.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 @@ -115,6 +116,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" @@ -1259,8 +1275,8 @@ def test_policies_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - policy.ListPoliciesRequest, - dict, + policy.ListPoliciesRequest(), + {}, ], ) def test_list_policies(request_type, transport: str = "grpc"): @@ -1271,7 +1287,7 @@ def test_list_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(type(client.transport.list_policies), "__call__") as call: @@ -1316,10 +1332,11 @@ def test_list_policies_non_empty_request_with_auto_populated_field(): client.list_policies(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == policy.ListPoliciesRequest( + request_msg = policy.ListPoliciesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_policies_use_cached_wrapped_rpc(): @@ -1400,9 +1417,14 @@ async def test_list_policies_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_policies_async( - transport: str = "grpc_asyncio", request_type=policy.ListPoliciesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + policy.ListPoliciesRequest(), + {}, + ], +) +async def test_list_policies_async(request_type, transport: str = "grpc_asyncio"): client = PoliciesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1410,7 +1432,7 @@ async def test_list_policies_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_policies), "__call__") as call: @@ -1433,11 +1455,6 @@ async def test_list_policies_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_policies_async_from_dict(): - await test_list_policies_async(request_type=dict) - - def test_list_policies_field_headers(): client = PoliciesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1774,8 +1791,8 @@ async def test_list_policies_async_pages(): @pytest.mark.parametrize( "request_type", [ - policy.GetPolicyRequest, - dict, + policy.GetPolicyRequest(), + {}, ], ) def test_get_policy(request_type, transport: str = "grpc"): @@ -1786,7 +1803,7 @@ def test_get_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(type(client.transport.get_policy), "__call__") as call: @@ -1840,9 +1857,10 @@ def test_get_policy_non_empty_request_with_auto_populated_field(): client.get_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == policy.GetPolicyRequest( + request_msg = policy.GetPolicyRequest( name="name_value", ) + assert args[0] == request_msg def test_get_policy_use_cached_wrapped_rpc(): @@ -1921,9 +1939,14 @@ async def test_get_policy_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_policy_async( - transport: str = "grpc_asyncio", request_type=policy.GetPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + policy.GetPolicyRequest(), + {}, + ], +) +async def test_get_policy_async(request_type, transport: str = "grpc_asyncio"): client = PoliciesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1931,7 +1954,7 @@ async def test_get_policy_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_policy), "__call__") as call: @@ -1964,11 +1987,6 @@ async def test_get_policy_async( assert response.managing_authority == "managing_authority_value" -@pytest.mark.asyncio -async def test_get_policy_async_from_dict(): - await test_get_policy_async(request_type=dict) - - def test_get_policy_field_headers(): client = PoliciesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2111,8 +2129,8 @@ async def test_get_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gi_policy.CreatePolicyRequest, - dict, + gi_policy.CreatePolicyRequest(), + {}, ], ) def test_create_policy(request_type, transport: str = "grpc"): @@ -2123,7 +2141,7 @@ def test_create_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(type(client.transport.create_policy), "__call__") as call: @@ -2165,10 +2183,11 @@ def test_create_policy_non_empty_request_with_auto_populated_field(): client.create_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gi_policy.CreatePolicyRequest( + request_msg = gi_policy.CreatePolicyRequest( parent="parent_value", policy_id="policy_id_value", ) + assert args[0] == request_msg def test_create_policy_use_cached_wrapped_rpc(): @@ -2259,9 +2278,14 @@ async def test_create_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_policy_async( - transport: str = "grpc_asyncio", request_type=gi_policy.CreatePolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gi_policy.CreatePolicyRequest(), + {}, + ], +) +async def test_create_policy_async(request_type, transport: str = "grpc_asyncio"): client = PoliciesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2269,7 +2293,7 @@ async def test_create_policy_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_policy), "__call__") as call: @@ -2289,11 +2313,6 @@ async def test_create_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_policy_async_from_dict(): - await test_create_policy_async(request_type=dict) - - def test_create_policy_field_headers(): client = PoliciesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2460,8 +2479,8 @@ async def test_create_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - policy.UpdatePolicyRequest, - dict, + policy.UpdatePolicyRequest(), + {}, ], ) def test_update_policy(request_type, transport: str = "grpc"): @@ -2472,7 +2491,7 @@ def test_update_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(type(client.transport.update_policy), "__call__") as call: @@ -2511,7 +2530,8 @@ def test_update_policy_non_empty_request_with_auto_populated_field(): client.update_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == policy.UpdatePolicyRequest() + request_msg = policy.UpdatePolicyRequest() + assert args[0] == request_msg def test_update_policy_use_cached_wrapped_rpc(): @@ -2602,9 +2622,14 @@ async def test_update_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_policy_async( - transport: str = "grpc_asyncio", request_type=policy.UpdatePolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + policy.UpdatePolicyRequest(), + {}, + ], +) +async def test_update_policy_async(request_type, transport: str = "grpc_asyncio"): client = PoliciesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2612,7 +2637,7 @@ async def test_update_policy_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_policy), "__call__") as call: @@ -2632,11 +2657,6 @@ async def test_update_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_policy_async_from_dict(): - await test_update_policy_async(request_type=dict) - - def test_update_policy_field_headers(): client = PoliciesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2701,8 +2721,8 @@ async def test_update_policy_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - policy.DeletePolicyRequest, - dict, + policy.DeletePolicyRequest(), + {}, ], ) def test_delete_policy(request_type, transport: str = "grpc"): @@ -2713,7 +2733,7 @@ def test_delete_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(type(client.transport.delete_policy), "__call__") as call: @@ -2755,10 +2775,11 @@ def test_delete_policy_non_empty_request_with_auto_populated_field(): client.delete_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == policy.DeletePolicyRequest( + request_msg = policy.DeletePolicyRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_policy_use_cached_wrapped_rpc(): @@ -2849,9 +2870,14 @@ async def test_delete_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_policy_async( - transport: str = "grpc_asyncio", request_type=policy.DeletePolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + policy.DeletePolicyRequest(), + {}, + ], +) +async def test_delete_policy_async(request_type, transport: str = "grpc_asyncio"): client = PoliciesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2859,7 +2885,7 @@ async def test_delete_policy_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_policy), "__call__") as call: @@ -2879,11 +2905,6 @@ async def test_delete_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_policy_async_from_dict(): - await test_delete_policy_async(request_type=dict) - - def test_delete_policy_field_headers(): client = PoliciesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4052,7 +4073,6 @@ def test_list_policies_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policy.ListPoliciesRequest() - assert args[0] == request_msg @@ -4073,7 +4093,6 @@ def test_get_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policy.GetPolicyRequest() - assert args[0] == request_msg @@ -4094,7 +4113,6 @@ def test_create_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gi_policy.CreatePolicyRequest() - assert args[0] == request_msg @@ -4115,7 +4133,6 @@ def test_update_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policy.UpdatePolicyRequest() - assert args[0] == request_msg @@ -4136,7 +4153,6 @@ def test_delete_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policy.DeletePolicyRequest() - assert args[0] == request_msg @@ -4177,7 +4193,6 @@ async def test_list_policies_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policy.ListPoliciesRequest() - assert args[0] == request_msg @@ -4209,7 +4224,6 @@ async def test_get_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policy.GetPolicyRequest() - assert args[0] == request_msg @@ -4234,7 +4248,6 @@ async def test_create_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gi_policy.CreatePolicyRequest() - assert args[0] == request_msg @@ -4259,7 +4272,6 @@ async def test_update_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policy.UpdatePolicyRequest() - assert args[0] == request_msg @@ -4284,7 +4296,6 @@ async def test_delete_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policy.DeletePolicyRequest() - assert args[0] == request_msg @@ -5212,7 +5223,6 @@ def test_list_policies_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policy.ListPoliciesRequest() - assert args[0] == request_msg @@ -5232,7 +5242,6 @@ def test_get_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policy.GetPolicyRequest() - assert args[0] == request_msg @@ -5252,7 +5261,6 @@ def test_create_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gi_policy.CreatePolicyRequest() - assert args[0] == request_msg @@ -5272,7 +5280,6 @@ def test_update_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policy.UpdatePolicyRequest() - assert args[0] == request_msg @@ -5292,7 +5299,6 @@ def test_delete_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policy.DeletePolicyRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-iam/tests/unit/gapic/iam_v2beta/test_policies.py b/packages/google-cloud-iam/tests/unit/gapic/iam_v2beta/test_policies.py index eea47145e8c0..3486e59a301f 100644 --- a/packages/google-cloud-iam/tests/unit/gapic/iam_v2beta/test_policies.py +++ b/packages/google-cloud-iam/tests/unit/gapic/iam_v2beta/test_policies.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" @@ -1239,8 +1255,8 @@ def test_policies_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - policy.ListPoliciesRequest, - dict, + policy.ListPoliciesRequest(), + {}, ], ) def test_list_policies(request_type, transport: str = "grpc"): @@ -1251,7 +1267,7 @@ def test_list_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(type(client.transport.list_policies), "__call__") as call: @@ -1296,10 +1312,11 @@ def test_list_policies_non_empty_request_with_auto_populated_field(): client.list_policies(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == policy.ListPoliciesRequest( + request_msg = policy.ListPoliciesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_policies_use_cached_wrapped_rpc(): @@ -1380,9 +1397,14 @@ async def test_list_policies_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_policies_async( - transport: str = "grpc_asyncio", request_type=policy.ListPoliciesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + policy.ListPoliciesRequest(), + {}, + ], +) +async def test_list_policies_async(request_type, transport: str = "grpc_asyncio"): client = PoliciesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1390,7 +1412,7 @@ async def test_list_policies_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_policies), "__call__") as call: @@ -1413,11 +1435,6 @@ async def test_list_policies_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_policies_async_from_dict(): - await test_list_policies_async(request_type=dict) - - def test_list_policies_field_headers(): client = PoliciesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1754,8 +1771,8 @@ async def test_list_policies_async_pages(): @pytest.mark.parametrize( "request_type", [ - policy.GetPolicyRequest, - dict, + policy.GetPolicyRequest(), + {}, ], ) def test_get_policy(request_type, transport: str = "grpc"): @@ -1766,7 +1783,7 @@ def test_get_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(type(client.transport.get_policy), "__call__") as call: @@ -1818,9 +1835,10 @@ def test_get_policy_non_empty_request_with_auto_populated_field(): client.get_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == policy.GetPolicyRequest( + request_msg = policy.GetPolicyRequest( name="name_value", ) + assert args[0] == request_msg def test_get_policy_use_cached_wrapped_rpc(): @@ -1899,9 +1917,14 @@ async def test_get_policy_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_policy_async( - transport: str = "grpc_asyncio", request_type=policy.GetPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + policy.GetPolicyRequest(), + {}, + ], +) +async def test_get_policy_async(request_type, transport: str = "grpc_asyncio"): client = PoliciesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1909,7 +1932,7 @@ async def test_get_policy_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_policy), "__call__") as call: @@ -1940,11 +1963,6 @@ async def test_get_policy_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_policy_async_from_dict(): - await test_get_policy_async(request_type=dict) - - def test_get_policy_field_headers(): client = PoliciesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2087,8 +2105,8 @@ async def test_get_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gi_policy.CreatePolicyRequest, - dict, + gi_policy.CreatePolicyRequest(), + {}, ], ) def test_create_policy(request_type, transport: str = "grpc"): @@ -2099,7 +2117,7 @@ def test_create_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(type(client.transport.create_policy), "__call__") as call: @@ -2141,10 +2159,11 @@ def test_create_policy_non_empty_request_with_auto_populated_field(): client.create_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gi_policy.CreatePolicyRequest( + request_msg = gi_policy.CreatePolicyRequest( parent="parent_value", policy_id="policy_id_value", ) + assert args[0] == request_msg def test_create_policy_use_cached_wrapped_rpc(): @@ -2235,9 +2254,14 @@ async def test_create_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_policy_async( - transport: str = "grpc_asyncio", request_type=gi_policy.CreatePolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gi_policy.CreatePolicyRequest(), + {}, + ], +) +async def test_create_policy_async(request_type, transport: str = "grpc_asyncio"): client = PoliciesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2245,7 +2269,7 @@ async def test_create_policy_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_policy), "__call__") as call: @@ -2265,11 +2289,6 @@ async def test_create_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_policy_async_from_dict(): - await test_create_policy_async(request_type=dict) - - def test_create_policy_field_headers(): client = PoliciesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2436,8 +2455,8 @@ async def test_create_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - policy.UpdatePolicyRequest, - dict, + policy.UpdatePolicyRequest(), + {}, ], ) def test_update_policy(request_type, transport: str = "grpc"): @@ -2448,7 +2467,7 @@ def test_update_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(type(client.transport.update_policy), "__call__") as call: @@ -2487,7 +2506,8 @@ def test_update_policy_non_empty_request_with_auto_populated_field(): client.update_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == policy.UpdatePolicyRequest() + request_msg = policy.UpdatePolicyRequest() + assert args[0] == request_msg def test_update_policy_use_cached_wrapped_rpc(): @@ -2578,9 +2598,14 @@ async def test_update_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_policy_async( - transport: str = "grpc_asyncio", request_type=policy.UpdatePolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + policy.UpdatePolicyRequest(), + {}, + ], +) +async def test_update_policy_async(request_type, transport: str = "grpc_asyncio"): client = PoliciesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2588,7 +2613,7 @@ async def test_update_policy_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_policy), "__call__") as call: @@ -2608,11 +2633,6 @@ async def test_update_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_policy_async_from_dict(): - await test_update_policy_async(request_type=dict) - - def test_update_policy_field_headers(): client = PoliciesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2677,8 +2697,8 @@ async def test_update_policy_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - policy.DeletePolicyRequest, - dict, + policy.DeletePolicyRequest(), + {}, ], ) def test_delete_policy(request_type, transport: str = "grpc"): @@ -2689,7 +2709,7 @@ def test_delete_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(type(client.transport.delete_policy), "__call__") as call: @@ -2731,10 +2751,11 @@ def test_delete_policy_non_empty_request_with_auto_populated_field(): client.delete_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == policy.DeletePolicyRequest( + request_msg = policy.DeletePolicyRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_policy_use_cached_wrapped_rpc(): @@ -2825,9 +2846,14 @@ async def test_delete_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_policy_async( - transport: str = "grpc_asyncio", request_type=policy.DeletePolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + policy.DeletePolicyRequest(), + {}, + ], +) +async def test_delete_policy_async(request_type, transport: str = "grpc_asyncio"): client = PoliciesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2835,7 +2861,7 @@ async def test_delete_policy_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_policy), "__call__") as call: @@ -2855,11 +2881,6 @@ async def test_delete_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_policy_async_from_dict(): - await test_delete_policy_async(request_type=dict) - - def test_delete_policy_field_headers(): client = PoliciesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3125,7 +3146,6 @@ def test_list_policies_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policy.ListPoliciesRequest() - assert args[0] == request_msg @@ -3146,7 +3166,6 @@ def test_get_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policy.GetPolicyRequest() - assert args[0] == request_msg @@ -3167,7 +3186,6 @@ def test_create_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gi_policy.CreatePolicyRequest() - assert args[0] == request_msg @@ -3188,7 +3206,6 @@ def test_update_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policy.UpdatePolicyRequest() - assert args[0] == request_msg @@ -3209,7 +3226,6 @@ def test_delete_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policy.DeletePolicyRequest() - assert args[0] == request_msg @@ -3250,7 +3266,6 @@ async def test_list_policies_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policy.ListPoliciesRequest() - assert args[0] == request_msg @@ -3281,7 +3296,6 @@ async def test_get_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policy.GetPolicyRequest() - assert args[0] == request_msg @@ -3306,7 +3320,6 @@ async def test_create_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gi_policy.CreatePolicyRequest() - assert args[0] == request_msg @@ -3331,7 +3344,6 @@ async def test_update_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policy.UpdatePolicyRequest() - assert args[0] == request_msg @@ -3356,7 +3368,6 @@ async def test_delete_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policy.DeletePolicyRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-iam/tests/unit/gapic/iam_v3/test_policy_bindings.py b/packages/google-cloud-iam/tests/unit/gapic/iam_v3/test_policy_bindings.py index 17a1a090bc15..c9fa5037d148 100644 --- a/packages/google-cloud-iam/tests/unit/gapic/iam_v3/test_policy_bindings.py +++ b/packages/google-cloud-iam/tests/unit/gapic/iam_v3/test_policy_bindings.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 @@ -121,6 +122,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" @@ -1324,8 +1340,8 @@ def test_policy_bindings_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - policy_bindings_service.CreatePolicyBindingRequest, - dict, + policy_bindings_service.CreatePolicyBindingRequest(), + {}, ], ) def test_create_policy_binding(request_type, transport: str = "grpc"): @@ -1336,7 +1352,7 @@ def test_create_policy_binding(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1382,10 +1398,11 @@ def test_create_policy_binding_non_empty_request_with_auto_populated_field(): client.create_policy_binding(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == policy_bindings_service.CreatePolicyBindingRequest( + request_msg = policy_bindings_service.CreatePolicyBindingRequest( parent="parent_value", policy_binding_id="policy_binding_id_value", ) + assert args[0] == request_msg def test_create_policy_binding_use_cached_wrapped_rpc(): @@ -1481,9 +1498,15 @@ async def test_create_policy_binding_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + policy_bindings_service.CreatePolicyBindingRequest(), + {}, + ], +) async def test_create_policy_binding_async( - transport: str = "grpc_asyncio", - request_type=policy_bindings_service.CreatePolicyBindingRequest, + request_type, transport: str = "grpc_asyncio" ): client = PolicyBindingsAsyncClient( credentials=async_anonymous_credentials(), @@ -1492,7 +1515,7 @@ async def test_create_policy_binding_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( @@ -1514,11 +1537,6 @@ async def test_create_policy_binding_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_policy_binding_async_from_dict(): - await test_create_policy_binding_async(request_type=dict) - - def test_create_policy_binding_field_headers(): client = PolicyBindingsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1693,8 +1711,8 @@ async def test_create_policy_binding_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - policy_bindings_service.GetPolicyBindingRequest, - dict, + policy_bindings_service.GetPolicyBindingRequest(), + {}, ], ) def test_get_policy_binding(request_type, transport: str = "grpc"): @@ -1705,7 +1723,7 @@ def test_get_policy_binding(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1768,9 +1786,10 @@ def test_get_policy_binding_non_empty_request_with_auto_populated_field(): client.get_policy_binding(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == policy_bindings_service.GetPolicyBindingRequest( + request_msg = policy_bindings_service.GetPolicyBindingRequest( name="name_value", ) + assert args[0] == request_msg def test_get_policy_binding_use_cached_wrapped_rpc(): @@ -1855,10 +1874,14 @@ async def test_get_policy_binding_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_policy_binding_async( - transport: str = "grpc_asyncio", - request_type=policy_bindings_service.GetPolicyBindingRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + policy_bindings_service.GetPolicyBindingRequest(), + {}, + ], +) +async def test_get_policy_binding_async(request_type, transport: str = "grpc_asyncio"): client = PolicyBindingsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1866,7 +1889,7 @@ async def test_get_policy_binding_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( @@ -1906,11 +1929,6 @@ async def test_get_policy_binding_async( assert response.policy_uid == "policy_uid_value" -@pytest.mark.asyncio -async def test_get_policy_binding_async_from_dict(): - await test_get_policy_binding_async(request_type=dict) - - def test_get_policy_binding_field_headers(): client = PolicyBindingsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2065,8 +2083,8 @@ async def test_get_policy_binding_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - policy_bindings_service.UpdatePolicyBindingRequest, - dict, + policy_bindings_service.UpdatePolicyBindingRequest(), + {}, ], ) def test_update_policy_binding(request_type, transport: str = "grpc"): @@ -2077,7 +2095,7 @@ def test_update_policy_binding(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2120,7 +2138,8 @@ def test_update_policy_binding_non_empty_request_with_auto_populated_field(): client.update_policy_binding(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == policy_bindings_service.UpdatePolicyBindingRequest() + request_msg = policy_bindings_service.UpdatePolicyBindingRequest() + assert args[0] == request_msg def test_update_policy_binding_use_cached_wrapped_rpc(): @@ -2216,9 +2235,15 @@ async def test_update_policy_binding_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + policy_bindings_service.UpdatePolicyBindingRequest(), + {}, + ], +) async def test_update_policy_binding_async( - transport: str = "grpc_asyncio", - request_type=policy_bindings_service.UpdatePolicyBindingRequest, + request_type, transport: str = "grpc_asyncio" ): client = PolicyBindingsAsyncClient( credentials=async_anonymous_credentials(), @@ -2227,7 +2252,7 @@ async def test_update_policy_binding_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( @@ -2249,11 +2274,6 @@ async def test_update_policy_binding_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_policy_binding_async_from_dict(): - await test_update_policy_binding_async(request_type=dict) - - def test_update_policy_binding_field_headers(): client = PolicyBindingsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2418,8 +2438,8 @@ async def test_update_policy_binding_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - policy_bindings_service.DeletePolicyBindingRequest, - dict, + policy_bindings_service.DeletePolicyBindingRequest(), + {}, ], ) def test_delete_policy_binding(request_type, transport: str = "grpc"): @@ -2430,7 +2450,7 @@ def test_delete_policy_binding(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2476,10 +2496,11 @@ def test_delete_policy_binding_non_empty_request_with_auto_populated_field(): client.delete_policy_binding(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == policy_bindings_service.DeletePolicyBindingRequest( + request_msg = policy_bindings_service.DeletePolicyBindingRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_policy_binding_use_cached_wrapped_rpc(): @@ -2575,9 +2596,15 @@ async def test_delete_policy_binding_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + policy_bindings_service.DeletePolicyBindingRequest(), + {}, + ], +) async def test_delete_policy_binding_async( - transport: str = "grpc_asyncio", - request_type=policy_bindings_service.DeletePolicyBindingRequest, + request_type, transport: str = "grpc_asyncio" ): client = PolicyBindingsAsyncClient( credentials=async_anonymous_credentials(), @@ -2586,7 +2613,7 @@ async def test_delete_policy_binding_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( @@ -2608,11 +2635,6 @@ async def test_delete_policy_binding_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_policy_binding_async_from_dict(): - await test_delete_policy_binding_async(request_type=dict) - - def test_delete_policy_binding_field_headers(): client = PolicyBindingsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2767,8 +2789,8 @@ async def test_delete_policy_binding_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - policy_bindings_service.ListPolicyBindingsRequest, - dict, + policy_bindings_service.ListPolicyBindingsRequest(), + {}, ], ) def test_list_policy_bindings(request_type, transport: str = "grpc"): @@ -2779,7 +2801,7 @@ def test_list_policy_bindings(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2829,11 +2851,12 @@ def test_list_policy_bindings_non_empty_request_with_auto_populated_field(): client.list_policy_bindings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == policy_bindings_service.ListPolicyBindingsRequest( + request_msg = policy_bindings_service.ListPolicyBindingsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_policy_bindings_use_cached_wrapped_rpc(): @@ -2918,9 +2941,15 @@ async def test_list_policy_bindings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + policy_bindings_service.ListPolicyBindingsRequest(), + {}, + ], +) async def test_list_policy_bindings_async( - transport: str = "grpc_asyncio", - request_type=policy_bindings_service.ListPolicyBindingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = PolicyBindingsAsyncClient( credentials=async_anonymous_credentials(), @@ -2929,7 +2958,7 @@ async def test_list_policy_bindings_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( @@ -2954,11 +2983,6 @@ async def test_list_policy_bindings_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_policy_bindings_async_from_dict(): - await test_list_policy_bindings_async(request_type=dict) - - def test_list_policy_bindings_field_headers(): client = PolicyBindingsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3315,8 +3339,8 @@ async def test_list_policy_bindings_async_pages(): @pytest.mark.parametrize( "request_type", [ - policy_bindings_service.SearchTargetPolicyBindingsRequest, - dict, + policy_bindings_service.SearchTargetPolicyBindingsRequest(), + {}, ], ) def test_search_target_policy_bindings(request_type, transport: str = "grpc"): @@ -3327,7 +3351,7 @@ def test_search_target_policy_bindings(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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 +3401,12 @@ def test_search_target_policy_bindings_non_empty_request_with_auto_populated_fie client.search_target_policy_bindings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == policy_bindings_service.SearchTargetPolicyBindingsRequest( + request_msg = policy_bindings_service.SearchTargetPolicyBindingsRequest( target="target_value", page_token="page_token_value", parent="parent_value", ) + assert args[0] == request_msg def test_search_target_policy_bindings_use_cached_wrapped_rpc(): @@ -3467,9 +3492,15 @@ async def test_search_target_policy_bindings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + policy_bindings_service.SearchTargetPolicyBindingsRequest(), + {}, + ], +) async def test_search_target_policy_bindings_async( - transport: str = "grpc_asyncio", - request_type=policy_bindings_service.SearchTargetPolicyBindingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = PolicyBindingsAsyncClient( credentials=async_anonymous_credentials(), @@ -3478,7 +3509,7 @@ async def test_search_target_policy_bindings_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( @@ -3503,11 +3534,6 @@ async def test_search_target_policy_bindings_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_search_target_policy_bindings_async_from_dict(): - await test_search_target_policy_bindings_async(request_type=dict) - - def test_search_target_policy_bindings_field_headers(): client = PolicyBindingsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5366,7 +5392,6 @@ def test_create_policy_binding_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policy_bindings_service.CreatePolicyBindingRequest() - assert args[0] == request_msg @@ -5389,7 +5414,6 @@ def test_get_policy_binding_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policy_bindings_service.GetPolicyBindingRequest() - assert args[0] == request_msg @@ -5412,7 +5436,6 @@ def test_update_policy_binding_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policy_bindings_service.UpdatePolicyBindingRequest() - assert args[0] == request_msg @@ -5435,7 +5458,6 @@ def test_delete_policy_binding_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policy_bindings_service.DeletePolicyBindingRequest() - assert args[0] == request_msg @@ -5458,7 +5480,6 @@ def test_list_policy_bindings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policy_bindings_service.ListPolicyBindingsRequest() - assert args[0] == request_msg @@ -5481,7 +5502,6 @@ def test_search_target_policy_bindings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policy_bindings_service.SearchTargetPolicyBindingsRequest() - assert args[0] == request_msg @@ -5522,7 +5542,6 @@ async def test_create_policy_binding_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policy_bindings_service.CreatePolicyBindingRequest() - assert args[0] == request_msg @@ -5557,7 +5576,6 @@ async def test_get_policy_binding_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policy_bindings_service.GetPolicyBindingRequest() - assert args[0] == request_msg @@ -5584,7 +5602,6 @@ async def test_update_policy_binding_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policy_bindings_service.UpdatePolicyBindingRequest() - assert args[0] == request_msg @@ -5611,7 +5628,6 @@ async def test_delete_policy_binding_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policy_bindings_service.DeletePolicyBindingRequest() - assert args[0] == request_msg @@ -5640,7 +5656,6 @@ async def test_list_policy_bindings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policy_bindings_service.ListPolicyBindingsRequest() - assert args[0] == request_msg @@ -5669,7 +5684,6 @@ async def test_search_target_policy_bindings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policy_bindings_service.SearchTargetPolicyBindingsRequest() - assert args[0] == request_msg @@ -6761,7 +6775,6 @@ def test_create_policy_binding_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policy_bindings_service.CreatePolicyBindingRequest() - assert args[0] == request_msg @@ -6783,7 +6796,6 @@ def test_get_policy_binding_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policy_bindings_service.GetPolicyBindingRequest() - assert args[0] == request_msg @@ -6805,7 +6817,6 @@ def test_update_policy_binding_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policy_bindings_service.UpdatePolicyBindingRequest() - assert args[0] == request_msg @@ -6827,7 +6838,6 @@ def test_delete_policy_binding_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policy_bindings_service.DeletePolicyBindingRequest() - assert args[0] == request_msg @@ -6849,7 +6859,6 @@ def test_list_policy_bindings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policy_bindings_service.ListPolicyBindingsRequest() - assert args[0] == request_msg @@ -6871,7 +6880,6 @@ def test_search_target_policy_bindings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policy_bindings_service.SearchTargetPolicyBindingsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-iam/tests/unit/gapic/iam_v3/test_principal_access_boundary_policies.py b/packages/google-cloud-iam/tests/unit/gapic/iam_v3/test_principal_access_boundary_policies.py index 0361b04cda17..69e40433dbbb 100644 --- a/packages/google-cloud-iam/tests/unit/gapic/iam_v3/test_principal_access_boundary_policies.py +++ b/packages/google-cloud-iam/tests/unit/gapic/iam_v3/test_principal_access_boundary_policies.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 @@ -121,6 +122,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" @@ -1458,8 +1474,8 @@ def test_principal_access_boundary_policies_client_create_channel_credentials_fi @pytest.mark.parametrize( "request_type", [ - principal_access_boundary_policies_service.CreatePrincipalAccessBoundaryPolicyRequest, - dict, + principal_access_boundary_policies_service.CreatePrincipalAccessBoundaryPolicyRequest(), + {}, ], ) def test_create_principal_access_boundary_policy(request_type, transport: str = "grpc"): @@ -1470,7 +1486,7 @@ def test_create_principal_access_boundary_policy(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( @@ -1516,13 +1532,11 @@ def test_create_principal_access_boundary_policy_non_empty_request_with_auto_pop client.create_principal_access_boundary_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert ( - args[0] - == principal_access_boundary_policies_service.CreatePrincipalAccessBoundaryPolicyRequest( - parent="parent_value", - principal_access_boundary_policy_id="principal_access_boundary_policy_id_value", - ) + request_msg = principal_access_boundary_policies_service.CreatePrincipalAccessBoundaryPolicyRequest( + parent="parent_value", + principal_access_boundary_policy_id="principal_access_boundary_policy_id_value", ) + assert args[0] == request_msg def test_create_principal_access_boundary_policy_use_cached_wrapped_rpc(): @@ -1618,9 +1632,15 @@ async def test_create_principal_access_boundary_policy_async_use_cached_wrapped_ @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + principal_access_boundary_policies_service.CreatePrincipalAccessBoundaryPolicyRequest(), + {}, + ], +) async def test_create_principal_access_boundary_policy_async( - transport: str = "grpc_asyncio", - request_type=principal_access_boundary_policies_service.CreatePrincipalAccessBoundaryPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = PrincipalAccessBoundaryPoliciesAsyncClient( credentials=async_anonymous_credentials(), @@ -1629,7 +1649,7 @@ async def test_create_principal_access_boundary_policy_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( @@ -1651,11 +1671,6 @@ async def test_create_principal_access_boundary_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_principal_access_boundary_policy_async_from_dict(): - await test_create_principal_access_boundary_policy_async(request_type=dict) - - def test_create_principal_access_boundary_policy_field_headers(): client = PrincipalAccessBoundaryPoliciesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1846,8 +1861,8 @@ async def test_create_principal_access_boundary_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - principal_access_boundary_policies_service.GetPrincipalAccessBoundaryPolicyRequest, - dict, + principal_access_boundary_policies_service.GetPrincipalAccessBoundaryPolicyRequest(), + {}, ], ) def test_get_principal_access_boundary_policy(request_type, transport: str = "grpc"): @@ -1858,7 +1873,7 @@ def test_get_principal_access_boundary_policy(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( @@ -1917,12 +1932,10 @@ def test_get_principal_access_boundary_policy_non_empty_request_with_auto_popula client.get_principal_access_boundary_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert ( - args[0] - == principal_access_boundary_policies_service.GetPrincipalAccessBoundaryPolicyRequest( - name="name_value", - ) + request_msg = principal_access_boundary_policies_service.GetPrincipalAccessBoundaryPolicyRequest( + name="name_value", ) + assert args[0] == request_msg def test_get_principal_access_boundary_policy_use_cached_wrapped_rpc(): @@ -2008,9 +2021,15 @@ async def test_get_principal_access_boundary_policy_async_use_cached_wrapped_rpc @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + principal_access_boundary_policies_service.GetPrincipalAccessBoundaryPolicyRequest(), + {}, + ], +) async def test_get_principal_access_boundary_policy_async( - transport: str = "grpc_asyncio", - request_type=principal_access_boundary_policies_service.GetPrincipalAccessBoundaryPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = PrincipalAccessBoundaryPoliciesAsyncClient( credentials=async_anonymous_credentials(), @@ -2019,7 +2038,7 @@ async def test_get_principal_access_boundary_policy_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( @@ -2053,11 +2072,6 @@ async def test_get_principal_access_boundary_policy_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_get_principal_access_boundary_policy_async_from_dict(): - await test_get_principal_access_boundary_policy_async(request_type=dict) - - def test_get_principal_access_boundary_policy_field_headers(): client = PrincipalAccessBoundaryPoliciesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2218,8 +2232,8 @@ async def test_get_principal_access_boundary_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - principal_access_boundary_policies_service.UpdatePrincipalAccessBoundaryPolicyRequest, - dict, + principal_access_boundary_policies_service.UpdatePrincipalAccessBoundaryPolicyRequest(), + {}, ], ) def test_update_principal_access_boundary_policy(request_type, transport: str = "grpc"): @@ -2230,7 +2244,7 @@ def test_update_principal_access_boundary_policy(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( @@ -2273,10 +2287,8 @@ def test_update_principal_access_boundary_policy_non_empty_request_with_auto_pop client.update_principal_access_boundary_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert ( - args[0] - == principal_access_boundary_policies_service.UpdatePrincipalAccessBoundaryPolicyRequest() - ) + request_msg = principal_access_boundary_policies_service.UpdatePrincipalAccessBoundaryPolicyRequest() + assert args[0] == request_msg def test_update_principal_access_boundary_policy_use_cached_wrapped_rpc(): @@ -2372,9 +2384,15 @@ async def test_update_principal_access_boundary_policy_async_use_cached_wrapped_ @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + principal_access_boundary_policies_service.UpdatePrincipalAccessBoundaryPolicyRequest(), + {}, + ], +) async def test_update_principal_access_boundary_policy_async( - transport: str = "grpc_asyncio", - request_type=principal_access_boundary_policies_service.UpdatePrincipalAccessBoundaryPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = PrincipalAccessBoundaryPoliciesAsyncClient( credentials=async_anonymous_credentials(), @@ -2383,7 +2401,7 @@ async def test_update_principal_access_boundary_policy_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( @@ -2405,11 +2423,6 @@ async def test_update_principal_access_boundary_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_principal_access_boundary_policy_async_from_dict(): - await test_update_principal_access_boundary_policy_async(request_type=dict) - - def test_update_principal_access_boundary_policy_field_headers(): client = PrincipalAccessBoundaryPoliciesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2590,8 +2603,8 @@ async def test_update_principal_access_boundary_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - principal_access_boundary_policies_service.DeletePrincipalAccessBoundaryPolicyRequest, - dict, + principal_access_boundary_policies_service.DeletePrincipalAccessBoundaryPolicyRequest(), + {}, ], ) def test_delete_principal_access_boundary_policy(request_type, transport: str = "grpc"): @@ -2602,7 +2615,7 @@ def test_delete_principal_access_boundary_policy(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( @@ -2648,13 +2661,11 @@ def test_delete_principal_access_boundary_policy_non_empty_request_with_auto_pop client.delete_principal_access_boundary_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert ( - args[0] - == principal_access_boundary_policies_service.DeletePrincipalAccessBoundaryPolicyRequest( - name="name_value", - etag="etag_value", - ) + request_msg = principal_access_boundary_policies_service.DeletePrincipalAccessBoundaryPolicyRequest( + name="name_value", + etag="etag_value", ) + assert args[0] == request_msg def test_delete_principal_access_boundary_policy_use_cached_wrapped_rpc(): @@ -2750,9 +2761,15 @@ async def test_delete_principal_access_boundary_policy_async_use_cached_wrapped_ @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + principal_access_boundary_policies_service.DeletePrincipalAccessBoundaryPolicyRequest(), + {}, + ], +) async def test_delete_principal_access_boundary_policy_async( - transport: str = "grpc_asyncio", - request_type=principal_access_boundary_policies_service.DeletePrincipalAccessBoundaryPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = PrincipalAccessBoundaryPoliciesAsyncClient( credentials=async_anonymous_credentials(), @@ -2761,7 +2778,7 @@ async def test_delete_principal_access_boundary_policy_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( @@ -2783,11 +2800,6 @@ async def test_delete_principal_access_boundary_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_principal_access_boundary_policy_async_from_dict(): - await test_delete_principal_access_boundary_policy_async(request_type=dict) - - def test_delete_principal_access_boundary_policy_field_headers(): client = PrincipalAccessBoundaryPoliciesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2942,8 +2954,8 @@ async def test_delete_principal_access_boundary_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - principal_access_boundary_policies_service.ListPrincipalAccessBoundaryPoliciesRequest, - dict, + principal_access_boundary_policies_service.ListPrincipalAccessBoundaryPoliciesRequest(), + {}, ], ) def test_list_principal_access_boundary_policies(request_type, transport: str = "grpc"): @@ -2954,7 +2966,7 @@ def test_list_principal_access_boundary_policies(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( @@ -3003,13 +3015,11 @@ def test_list_principal_access_boundary_policies_non_empty_request_with_auto_pop client.list_principal_access_boundary_policies(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert ( - args[0] - == principal_access_boundary_policies_service.ListPrincipalAccessBoundaryPoliciesRequest( - parent="parent_value", - page_token="page_token_value", - ) + request_msg = principal_access_boundary_policies_service.ListPrincipalAccessBoundaryPoliciesRequest( + parent="parent_value", + page_token="page_token_value", ) + assert args[0] == request_msg def test_list_principal_access_boundary_policies_use_cached_wrapped_rpc(): @@ -3095,9 +3105,15 @@ async def test_list_principal_access_boundary_policies_async_use_cached_wrapped_ @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + principal_access_boundary_policies_service.ListPrincipalAccessBoundaryPoliciesRequest(), + {}, + ], +) async def test_list_principal_access_boundary_policies_async( - transport: str = "grpc_asyncio", - request_type=principal_access_boundary_policies_service.ListPrincipalAccessBoundaryPoliciesRequest, + request_type, transport: str = "grpc_asyncio" ): client = PrincipalAccessBoundaryPoliciesAsyncClient( credentials=async_anonymous_credentials(), @@ -3106,7 +3122,7 @@ async def test_list_principal_access_boundary_policies_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( @@ -3131,11 +3147,6 @@ async def test_list_principal_access_boundary_policies_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_principal_access_boundary_policies_async_from_dict(): - await test_list_principal_access_boundary_policies_async(request_type=dict) - - def test_list_principal_access_boundary_policies_field_headers(): client = PrincipalAccessBoundaryPoliciesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3504,8 +3515,8 @@ async def test_list_principal_access_boundary_policies_async_pages(): @pytest.mark.parametrize( "request_type", [ - principal_access_boundary_policies_service.SearchPrincipalAccessBoundaryPolicyBindingsRequest, - dict, + principal_access_boundary_policies_service.SearchPrincipalAccessBoundaryPolicyBindingsRequest(), + {}, ], ) def test_search_principal_access_boundary_policy_bindings( @@ -3518,7 +3529,7 @@ def test_search_principal_access_boundary_policy_bindings( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3569,13 +3580,11 @@ def test_search_principal_access_boundary_policy_bindings_non_empty_request_with client.search_principal_access_boundary_policy_bindings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert ( - args[0] - == principal_access_boundary_policies_service.SearchPrincipalAccessBoundaryPolicyBindingsRequest( - name="name_value", - page_token="page_token_value", - ) + request_msg = principal_access_boundary_policies_service.SearchPrincipalAccessBoundaryPolicyBindingsRequest( + name="name_value", + page_token="page_token_value", ) + assert args[0] == request_msg def test_search_principal_access_boundary_policy_bindings_use_cached_wrapped_rpc(): @@ -3661,9 +3670,15 @@ async def test_search_principal_access_boundary_policy_bindings_async_use_cached @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + principal_access_boundary_policies_service.SearchPrincipalAccessBoundaryPolicyBindingsRequest(), + {}, + ], +) async def test_search_principal_access_boundary_policy_bindings_async( - transport: str = "grpc_asyncio", - request_type=principal_access_boundary_policies_service.SearchPrincipalAccessBoundaryPolicyBindingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = PrincipalAccessBoundaryPoliciesAsyncClient( credentials=async_anonymous_credentials(), @@ -3672,7 +3687,7 @@ async def test_search_principal_access_boundary_policy_bindings_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( @@ -3702,11 +3717,6 @@ async def test_search_principal_access_boundary_policy_bindings_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_search_principal_access_boundary_policy_bindings_async_from_dict(): - await test_search_principal_access_boundary_policy_bindings_async(request_type=dict) - - def test_search_principal_access_boundary_policy_bindings_field_headers(): client = PrincipalAccessBoundaryPoliciesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5635,7 +5645,6 @@ def test_create_principal_access_boundary_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = principal_access_boundary_policies_service.CreatePrincipalAccessBoundaryPolicyRequest() - assert args[0] == request_msg @@ -5660,7 +5669,6 @@ def test_get_principal_access_boundary_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = principal_access_boundary_policies_service.GetPrincipalAccessBoundaryPolicyRequest() - assert args[0] == request_msg @@ -5683,7 +5691,6 @@ def test_update_principal_access_boundary_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = principal_access_boundary_policies_service.UpdatePrincipalAccessBoundaryPolicyRequest() - assert args[0] == request_msg @@ -5706,7 +5713,6 @@ def test_delete_principal_access_boundary_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = principal_access_boundary_policies_service.DeletePrincipalAccessBoundaryPolicyRequest() - assert args[0] == request_msg @@ -5729,7 +5735,6 @@ def test_list_principal_access_boundary_policies_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = principal_access_boundary_policies_service.ListPrincipalAccessBoundaryPoliciesRequest() - assert args[0] == request_msg @@ -5753,7 +5758,6 @@ def test_search_principal_access_boundary_policy_bindings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = principal_access_boundary_policies_service.SearchPrincipalAccessBoundaryPolicyBindingsRequest() - assert args[0] == request_msg @@ -5794,7 +5798,6 @@ async def test_create_principal_access_boundary_policy_empty_call_grpc_asyncio() call.assert_called() _, args, _ = call.mock_calls[0] request_msg = principal_access_boundary_policies_service.CreatePrincipalAccessBoundaryPolicyRequest() - assert args[0] == request_msg @@ -5826,7 +5829,6 @@ async def test_get_principal_access_boundary_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = principal_access_boundary_policies_service.GetPrincipalAccessBoundaryPolicyRequest() - assert args[0] == request_msg @@ -5853,7 +5855,6 @@ async def test_update_principal_access_boundary_policy_empty_call_grpc_asyncio() call.assert_called() _, args, _ = call.mock_calls[0] request_msg = principal_access_boundary_policies_service.UpdatePrincipalAccessBoundaryPolicyRequest() - assert args[0] == request_msg @@ -5880,7 +5881,6 @@ async def test_delete_principal_access_boundary_policy_empty_call_grpc_asyncio() call.assert_called() _, args, _ = call.mock_calls[0] request_msg = principal_access_boundary_policies_service.DeletePrincipalAccessBoundaryPolicyRequest() - assert args[0] == request_msg @@ -5909,7 +5909,6 @@ async def test_list_principal_access_boundary_policies_empty_call_grpc_asyncio() call.assert_called() _, args, _ = call.mock_calls[0] request_msg = principal_access_boundary_policies_service.ListPrincipalAccessBoundaryPoliciesRequest() - assert args[0] == request_msg @@ -5939,7 +5938,6 @@ async def test_search_principal_access_boundary_policy_bindings_empty_call_grpc_ call.assert_called() _, args, _ = call.mock_calls[0] request_msg = principal_access_boundary_policies_service.SearchPrincipalAccessBoundaryPolicyBindingsRequest() - assert args[0] == request_msg @@ -7069,7 +7067,6 @@ def test_create_principal_access_boundary_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = principal_access_boundary_policies_service.CreatePrincipalAccessBoundaryPolicyRequest() - assert args[0] == request_msg @@ -7091,7 +7088,6 @@ def test_get_principal_access_boundary_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = principal_access_boundary_policies_service.GetPrincipalAccessBoundaryPolicyRequest() - assert args[0] == request_msg @@ -7113,7 +7109,6 @@ def test_update_principal_access_boundary_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = principal_access_boundary_policies_service.UpdatePrincipalAccessBoundaryPolicyRequest() - assert args[0] == request_msg @@ -7135,7 +7130,6 @@ def test_delete_principal_access_boundary_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = principal_access_boundary_policies_service.DeletePrincipalAccessBoundaryPolicyRequest() - assert args[0] == request_msg @@ -7157,7 +7151,6 @@ def test_list_principal_access_boundary_policies_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = principal_access_boundary_policies_service.ListPrincipalAccessBoundaryPoliciesRequest() - assert args[0] == request_msg @@ -7180,7 +7173,6 @@ def test_search_principal_access_boundary_policy_bindings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = principal_access_boundary_policies_service.SearchPrincipalAccessBoundaryPolicyBindingsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-iam/tests/unit/gapic/iam_v3beta/test_access_policies.py b/packages/google-cloud-iam/tests/unit/gapic/iam_v3beta/test_access_policies.py index dd508bf9eee8..c306af2b168b 100644 --- a/packages/google-cloud-iam/tests/unit/gapic/iam_v3beta/test_access_policies.py +++ b/packages/google-cloud-iam/tests/unit/gapic/iam_v3beta/test_access_policies.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 @@ -121,6 +122,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" @@ -1324,8 +1340,8 @@ def test_access_policies_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - access_policies_service.CreateAccessPolicyRequest, - dict, + access_policies_service.CreateAccessPolicyRequest(), + {}, ], ) def test_create_access_policy(request_type, transport: str = "grpc"): @@ -1336,7 +1352,7 @@ def test_create_access_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( @@ -1382,10 +1398,11 @@ def test_create_access_policy_non_empty_request_with_auto_populated_field(): client.create_access_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == access_policies_service.CreateAccessPolicyRequest( + request_msg = access_policies_service.CreateAccessPolicyRequest( parent="parent_value", access_policy_id="access_policy_id_value", ) + assert args[0] == request_msg def test_create_access_policy_use_cached_wrapped_rpc(): @@ -1480,9 +1497,15 @@ async def test_create_access_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + access_policies_service.CreateAccessPolicyRequest(), + {}, + ], +) async def test_create_access_policy_async( - transport: str = "grpc_asyncio", - request_type=access_policies_service.CreateAccessPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = AccessPoliciesAsyncClient( credentials=async_anonymous_credentials(), @@ -1491,7 +1514,7 @@ async def test_create_access_policy_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( @@ -1513,11 +1536,6 @@ async def test_create_access_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_access_policy_async_from_dict(): - await test_create_access_policy_async(request_type=dict) - - def test_create_access_policy_field_headers(): client = AccessPoliciesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1692,8 +1710,8 @@ async def test_create_access_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - access_policies_service.GetAccessPolicyRequest, - dict, + access_policies_service.GetAccessPolicyRequest(), + {}, ], ) def test_get_access_policy(request_type, transport: str = "grpc"): @@ -1704,7 +1722,7 @@ def test_get_access_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( @@ -1758,9 +1776,10 @@ def test_get_access_policy_non_empty_request_with_auto_populated_field(): client.get_access_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == access_policies_service.GetAccessPolicyRequest( + request_msg = access_policies_service.GetAccessPolicyRequest( name="name_value", ) + assert args[0] == request_msg def test_get_access_policy_use_cached_wrapped_rpc(): @@ -1843,10 +1862,14 @@ async def test_get_access_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_access_policy_async( - transport: str = "grpc_asyncio", - request_type=access_policies_service.GetAccessPolicyRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + access_policies_service.GetAccessPolicyRequest(), + {}, + ], +) +async def test_get_access_policy_async(request_type, transport: str = "grpc_asyncio"): client = AccessPoliciesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1854,7 +1877,7 @@ async def test_get_access_policy_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( @@ -1885,11 +1908,6 @@ async def test_get_access_policy_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_get_access_policy_async_from_dict(): - await test_get_access_policy_async(request_type=dict) - - def test_get_access_policy_field_headers(): client = AccessPoliciesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2044,8 +2062,8 @@ async def test_get_access_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - access_policies_service.UpdateAccessPolicyRequest, - dict, + access_policies_service.UpdateAccessPolicyRequest(), + {}, ], ) def test_update_access_policy(request_type, transport: str = "grpc"): @@ -2056,7 +2074,7 @@ def test_update_access_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( @@ -2099,7 +2117,8 @@ def test_update_access_policy_non_empty_request_with_auto_populated_field(): client.update_access_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == access_policies_service.UpdateAccessPolicyRequest() + request_msg = access_policies_service.UpdateAccessPolicyRequest() + assert args[0] == request_msg def test_update_access_policy_use_cached_wrapped_rpc(): @@ -2194,9 +2213,15 @@ async def test_update_access_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + access_policies_service.UpdateAccessPolicyRequest(), + {}, + ], +) async def test_update_access_policy_async( - transport: str = "grpc_asyncio", - request_type=access_policies_service.UpdateAccessPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = AccessPoliciesAsyncClient( credentials=async_anonymous_credentials(), @@ -2205,7 +2230,7 @@ async def test_update_access_policy_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( @@ -2227,11 +2252,6 @@ async def test_update_access_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_access_policy_async_from_dict(): - await test_update_access_policy_async(request_type=dict) - - def test_update_access_policy_field_headers(): client = AccessPoliciesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2300,8 +2320,8 @@ async def test_update_access_policy_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - access_policies_service.DeleteAccessPolicyRequest, - dict, + access_policies_service.DeleteAccessPolicyRequest(), + {}, ], ) def test_delete_access_policy(request_type, transport: str = "grpc"): @@ -2312,7 +2332,7 @@ def test_delete_access_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( @@ -2358,10 +2378,11 @@ def test_delete_access_policy_non_empty_request_with_auto_populated_field(): client.delete_access_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == access_policies_service.DeleteAccessPolicyRequest( + request_msg = access_policies_service.DeleteAccessPolicyRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_access_policy_use_cached_wrapped_rpc(): @@ -2456,9 +2477,15 @@ async def test_delete_access_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + access_policies_service.DeleteAccessPolicyRequest(), + {}, + ], +) async def test_delete_access_policy_async( - transport: str = "grpc_asyncio", - request_type=access_policies_service.DeleteAccessPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = AccessPoliciesAsyncClient( credentials=async_anonymous_credentials(), @@ -2467,7 +2494,7 @@ async def test_delete_access_policy_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( @@ -2489,11 +2516,6 @@ async def test_delete_access_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_access_policy_async_from_dict(): - await test_delete_access_policy_async(request_type=dict) - - def test_delete_access_policy_field_headers(): client = AccessPoliciesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2648,8 +2670,8 @@ async def test_delete_access_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - access_policies_service.ListAccessPoliciesRequest, - dict, + access_policies_service.ListAccessPoliciesRequest(), + {}, ], ) def test_list_access_policies(request_type, transport: str = "grpc"): @@ -2660,7 +2682,7 @@ def test_list_access_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( @@ -2709,10 +2731,11 @@ def test_list_access_policies_non_empty_request_with_auto_populated_field(): client.list_access_policies(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == access_policies_service.ListAccessPoliciesRequest( + request_msg = access_policies_service.ListAccessPoliciesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_access_policies_use_cached_wrapped_rpc(): @@ -2797,9 +2820,15 @@ async def test_list_access_policies_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + access_policies_service.ListAccessPoliciesRequest(), + {}, + ], +) async def test_list_access_policies_async( - transport: str = "grpc_asyncio", - request_type=access_policies_service.ListAccessPoliciesRequest, + request_type, transport: str = "grpc_asyncio" ): client = AccessPoliciesAsyncClient( credentials=async_anonymous_credentials(), @@ -2808,7 +2837,7 @@ async def test_list_access_policies_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( @@ -2833,11 +2862,6 @@ async def test_list_access_policies_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_access_policies_async_from_dict(): - await test_list_access_policies_async(request_type=dict) - - def test_list_access_policies_field_headers(): client = AccessPoliciesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3192,8 +3216,8 @@ async def test_list_access_policies_async_pages(): @pytest.mark.parametrize( "request_type", [ - access_policies_service.SearchAccessPolicyBindingsRequest, - dict, + access_policies_service.SearchAccessPolicyBindingsRequest(), + {}, ], ) def test_search_access_policy_bindings(request_type, transport: str = "grpc"): @@ -3204,7 +3228,7 @@ def test_search_access_policy_bindings(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3253,10 +3277,11 @@ def test_search_access_policy_bindings_non_empty_request_with_auto_populated_fie client.search_access_policy_bindings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == access_policies_service.SearchAccessPolicyBindingsRequest( + request_msg = access_policies_service.SearchAccessPolicyBindingsRequest( name="name_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_search_access_policy_bindings_use_cached_wrapped_rpc(): @@ -3342,9 +3367,15 @@ async def test_search_access_policy_bindings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + access_policies_service.SearchAccessPolicyBindingsRequest(), + {}, + ], +) async def test_search_access_policy_bindings_async( - transport: str = "grpc_asyncio", - request_type=access_policies_service.SearchAccessPolicyBindingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = AccessPoliciesAsyncClient( credentials=async_anonymous_credentials(), @@ -3353,7 +3384,7 @@ async def test_search_access_policy_bindings_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( @@ -3378,11 +3409,6 @@ async def test_search_access_policy_bindings_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_search_access_policy_bindings_async_from_dict(): - await test_search_access_policy_bindings_async(request_type=dict) - - def test_search_access_policy_bindings_field_headers(): client = AccessPoliciesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5131,7 +5157,6 @@ def test_create_access_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = access_policies_service.CreateAccessPolicyRequest() - assert args[0] == request_msg @@ -5154,7 +5179,6 @@ def test_get_access_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = access_policies_service.GetAccessPolicyRequest() - assert args[0] == request_msg @@ -5177,7 +5201,6 @@ def test_update_access_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = access_policies_service.UpdateAccessPolicyRequest() - assert args[0] == request_msg @@ -5200,7 +5223,6 @@ def test_delete_access_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = access_policies_service.DeleteAccessPolicyRequest() - assert args[0] == request_msg @@ -5223,7 +5245,6 @@ def test_list_access_policies_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = access_policies_service.ListAccessPoliciesRequest() - assert args[0] == request_msg @@ -5246,7 +5267,6 @@ def test_search_access_policy_bindings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = access_policies_service.SearchAccessPolicyBindingsRequest() - assert args[0] == request_msg @@ -5287,7 +5307,6 @@ async def test_create_access_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = access_policies_service.CreateAccessPolicyRequest() - assert args[0] == request_msg @@ -5319,7 +5338,6 @@ async def test_get_access_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = access_policies_service.GetAccessPolicyRequest() - assert args[0] == request_msg @@ -5346,7 +5364,6 @@ async def test_update_access_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = access_policies_service.UpdateAccessPolicyRequest() - assert args[0] == request_msg @@ -5373,7 +5390,6 @@ async def test_delete_access_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = access_policies_service.DeleteAccessPolicyRequest() - assert args[0] == request_msg @@ -5402,7 +5418,6 @@ async def test_list_access_policies_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = access_policies_service.ListAccessPoliciesRequest() - assert args[0] == request_msg @@ -5431,7 +5446,6 @@ async def test_search_access_policy_bindings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = access_policies_service.SearchAccessPolicyBindingsRequest() - assert args[0] == request_msg @@ -6540,7 +6554,6 @@ def test_create_access_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = access_policies_service.CreateAccessPolicyRequest() - assert args[0] == request_msg @@ -6562,7 +6575,6 @@ def test_get_access_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = access_policies_service.GetAccessPolicyRequest() - assert args[0] == request_msg @@ -6584,7 +6596,6 @@ def test_update_access_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = access_policies_service.UpdateAccessPolicyRequest() - assert args[0] == request_msg @@ -6606,7 +6617,6 @@ def test_delete_access_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = access_policies_service.DeleteAccessPolicyRequest() - assert args[0] == request_msg @@ -6628,7 +6638,6 @@ def test_list_access_policies_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = access_policies_service.ListAccessPoliciesRequest() - assert args[0] == request_msg @@ -6650,7 +6659,6 @@ def test_search_access_policy_bindings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = access_policies_service.SearchAccessPolicyBindingsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-iam/tests/unit/gapic/iam_v3beta/test_policy_bindings.py b/packages/google-cloud-iam/tests/unit/gapic/iam_v3beta/test_policy_bindings.py index 6905a297096d..6153a72437d6 100644 --- a/packages/google-cloud-iam/tests/unit/gapic/iam_v3beta/test_policy_bindings.py +++ b/packages/google-cloud-iam/tests/unit/gapic/iam_v3beta/test_policy_bindings.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 @@ -121,6 +122,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" @@ -1324,8 +1340,8 @@ def test_policy_bindings_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - policy_bindings_service.CreatePolicyBindingRequest, - dict, + policy_bindings_service.CreatePolicyBindingRequest(), + {}, ], ) def test_create_policy_binding(request_type, transport: str = "grpc"): @@ -1336,7 +1352,7 @@ def test_create_policy_binding(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1382,10 +1398,11 @@ def test_create_policy_binding_non_empty_request_with_auto_populated_field(): client.create_policy_binding(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == policy_bindings_service.CreatePolicyBindingRequest( + request_msg = policy_bindings_service.CreatePolicyBindingRequest( parent="parent_value", policy_binding_id="policy_binding_id_value", ) + assert args[0] == request_msg def test_create_policy_binding_use_cached_wrapped_rpc(): @@ -1481,9 +1498,15 @@ async def test_create_policy_binding_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + policy_bindings_service.CreatePolicyBindingRequest(), + {}, + ], +) async def test_create_policy_binding_async( - transport: str = "grpc_asyncio", - request_type=policy_bindings_service.CreatePolicyBindingRequest, + request_type, transport: str = "grpc_asyncio" ): client = PolicyBindingsAsyncClient( credentials=async_anonymous_credentials(), @@ -1492,7 +1515,7 @@ async def test_create_policy_binding_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( @@ -1514,11 +1537,6 @@ async def test_create_policy_binding_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_policy_binding_async_from_dict(): - await test_create_policy_binding_async(request_type=dict) - - def test_create_policy_binding_field_headers(): client = PolicyBindingsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1693,8 +1711,8 @@ async def test_create_policy_binding_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - policy_bindings_service.GetPolicyBindingRequest, - dict, + policy_bindings_service.GetPolicyBindingRequest(), + {}, ], ) def test_get_policy_binding(request_type, transport: str = "grpc"): @@ -1705,7 +1723,7 @@ def test_get_policy_binding(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1768,9 +1786,10 @@ def test_get_policy_binding_non_empty_request_with_auto_populated_field(): client.get_policy_binding(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == policy_bindings_service.GetPolicyBindingRequest( + request_msg = policy_bindings_service.GetPolicyBindingRequest( name="name_value", ) + assert args[0] == request_msg def test_get_policy_binding_use_cached_wrapped_rpc(): @@ -1855,10 +1874,14 @@ async def test_get_policy_binding_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_policy_binding_async( - transport: str = "grpc_asyncio", - request_type=policy_bindings_service.GetPolicyBindingRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + policy_bindings_service.GetPolicyBindingRequest(), + {}, + ], +) +async def test_get_policy_binding_async(request_type, transport: str = "grpc_asyncio"): client = PolicyBindingsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1866,7 +1889,7 @@ async def test_get_policy_binding_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( @@ -1906,11 +1929,6 @@ async def test_get_policy_binding_async( assert response.policy_uid == "policy_uid_value" -@pytest.mark.asyncio -async def test_get_policy_binding_async_from_dict(): - await test_get_policy_binding_async(request_type=dict) - - def test_get_policy_binding_field_headers(): client = PolicyBindingsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2065,8 +2083,8 @@ async def test_get_policy_binding_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - policy_bindings_service.UpdatePolicyBindingRequest, - dict, + policy_bindings_service.UpdatePolicyBindingRequest(), + {}, ], ) def test_update_policy_binding(request_type, transport: str = "grpc"): @@ -2077,7 +2095,7 @@ def test_update_policy_binding(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2120,7 +2138,8 @@ def test_update_policy_binding_non_empty_request_with_auto_populated_field(): client.update_policy_binding(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == policy_bindings_service.UpdatePolicyBindingRequest() + request_msg = policy_bindings_service.UpdatePolicyBindingRequest() + assert args[0] == request_msg def test_update_policy_binding_use_cached_wrapped_rpc(): @@ -2216,9 +2235,15 @@ async def test_update_policy_binding_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + policy_bindings_service.UpdatePolicyBindingRequest(), + {}, + ], +) async def test_update_policy_binding_async( - transport: str = "grpc_asyncio", - request_type=policy_bindings_service.UpdatePolicyBindingRequest, + request_type, transport: str = "grpc_asyncio" ): client = PolicyBindingsAsyncClient( credentials=async_anonymous_credentials(), @@ -2227,7 +2252,7 @@ async def test_update_policy_binding_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( @@ -2249,11 +2274,6 @@ async def test_update_policy_binding_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_policy_binding_async_from_dict(): - await test_update_policy_binding_async(request_type=dict) - - def test_update_policy_binding_field_headers(): client = PolicyBindingsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2418,8 +2438,8 @@ async def test_update_policy_binding_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - policy_bindings_service.DeletePolicyBindingRequest, - dict, + policy_bindings_service.DeletePolicyBindingRequest(), + {}, ], ) def test_delete_policy_binding(request_type, transport: str = "grpc"): @@ -2430,7 +2450,7 @@ def test_delete_policy_binding(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2476,10 +2496,11 @@ def test_delete_policy_binding_non_empty_request_with_auto_populated_field(): client.delete_policy_binding(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == policy_bindings_service.DeletePolicyBindingRequest( + request_msg = policy_bindings_service.DeletePolicyBindingRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_policy_binding_use_cached_wrapped_rpc(): @@ -2575,9 +2596,15 @@ async def test_delete_policy_binding_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + policy_bindings_service.DeletePolicyBindingRequest(), + {}, + ], +) async def test_delete_policy_binding_async( - transport: str = "grpc_asyncio", - request_type=policy_bindings_service.DeletePolicyBindingRequest, + request_type, transport: str = "grpc_asyncio" ): client = PolicyBindingsAsyncClient( credentials=async_anonymous_credentials(), @@ -2586,7 +2613,7 @@ async def test_delete_policy_binding_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( @@ -2608,11 +2635,6 @@ async def test_delete_policy_binding_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_policy_binding_async_from_dict(): - await test_delete_policy_binding_async(request_type=dict) - - def test_delete_policy_binding_field_headers(): client = PolicyBindingsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2767,8 +2789,8 @@ async def test_delete_policy_binding_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - policy_bindings_service.ListPolicyBindingsRequest, - dict, + policy_bindings_service.ListPolicyBindingsRequest(), + {}, ], ) def test_list_policy_bindings(request_type, transport: str = "grpc"): @@ -2779,7 +2801,7 @@ def test_list_policy_bindings(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2829,11 +2851,12 @@ def test_list_policy_bindings_non_empty_request_with_auto_populated_field(): client.list_policy_bindings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == policy_bindings_service.ListPolicyBindingsRequest( + request_msg = policy_bindings_service.ListPolicyBindingsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_policy_bindings_use_cached_wrapped_rpc(): @@ -2918,9 +2941,15 @@ async def test_list_policy_bindings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + policy_bindings_service.ListPolicyBindingsRequest(), + {}, + ], +) async def test_list_policy_bindings_async( - transport: str = "grpc_asyncio", - request_type=policy_bindings_service.ListPolicyBindingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = PolicyBindingsAsyncClient( credentials=async_anonymous_credentials(), @@ -2929,7 +2958,7 @@ async def test_list_policy_bindings_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( @@ -2954,11 +2983,6 @@ async def test_list_policy_bindings_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_policy_bindings_async_from_dict(): - await test_list_policy_bindings_async(request_type=dict) - - def test_list_policy_bindings_field_headers(): client = PolicyBindingsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3315,8 +3339,8 @@ async def test_list_policy_bindings_async_pages(): @pytest.mark.parametrize( "request_type", [ - policy_bindings_service.SearchTargetPolicyBindingsRequest, - dict, + policy_bindings_service.SearchTargetPolicyBindingsRequest(), + {}, ], ) def test_search_target_policy_bindings(request_type, transport: str = "grpc"): @@ -3327,7 +3351,7 @@ def test_search_target_policy_bindings(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3378,12 +3402,13 @@ def test_search_target_policy_bindings_non_empty_request_with_auto_populated_fie client.search_target_policy_bindings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == policy_bindings_service.SearchTargetPolicyBindingsRequest( + request_msg = policy_bindings_service.SearchTargetPolicyBindingsRequest( target="target_value", page_token="page_token_value", parent="parent_value", filter="filter_value", ) + assert args[0] == request_msg def test_search_target_policy_bindings_use_cached_wrapped_rpc(): @@ -3469,9 +3494,15 @@ async def test_search_target_policy_bindings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + policy_bindings_service.SearchTargetPolicyBindingsRequest(), + {}, + ], +) async def test_search_target_policy_bindings_async( - transport: str = "grpc_asyncio", - request_type=policy_bindings_service.SearchTargetPolicyBindingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = PolicyBindingsAsyncClient( credentials=async_anonymous_credentials(), @@ -3480,7 +3511,7 @@ async def test_search_target_policy_bindings_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( @@ -3505,11 +3536,6 @@ async def test_search_target_policy_bindings_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_search_target_policy_bindings_async_from_dict(): - await test_search_target_policy_bindings_async(request_type=dict) - - def test_search_target_policy_bindings_field_headers(): client = PolicyBindingsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5370,7 +5396,6 @@ def test_create_policy_binding_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policy_bindings_service.CreatePolicyBindingRequest() - assert args[0] == request_msg @@ -5393,7 +5418,6 @@ def test_get_policy_binding_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policy_bindings_service.GetPolicyBindingRequest() - assert args[0] == request_msg @@ -5416,7 +5440,6 @@ def test_update_policy_binding_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policy_bindings_service.UpdatePolicyBindingRequest() - assert args[0] == request_msg @@ -5439,7 +5462,6 @@ def test_delete_policy_binding_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policy_bindings_service.DeletePolicyBindingRequest() - assert args[0] == request_msg @@ -5462,7 +5484,6 @@ def test_list_policy_bindings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policy_bindings_service.ListPolicyBindingsRequest() - assert args[0] == request_msg @@ -5485,7 +5506,6 @@ def test_search_target_policy_bindings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policy_bindings_service.SearchTargetPolicyBindingsRequest() - assert args[0] == request_msg @@ -5526,7 +5546,6 @@ async def test_create_policy_binding_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policy_bindings_service.CreatePolicyBindingRequest() - assert args[0] == request_msg @@ -5561,7 +5580,6 @@ async def test_get_policy_binding_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policy_bindings_service.GetPolicyBindingRequest() - assert args[0] == request_msg @@ -5588,7 +5606,6 @@ async def test_update_policy_binding_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policy_bindings_service.UpdatePolicyBindingRequest() - assert args[0] == request_msg @@ -5615,7 +5632,6 @@ async def test_delete_policy_binding_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policy_bindings_service.DeletePolicyBindingRequest() - assert args[0] == request_msg @@ -5644,7 +5660,6 @@ async def test_list_policy_bindings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policy_bindings_service.ListPolicyBindingsRequest() - assert args[0] == request_msg @@ -5673,7 +5688,6 @@ async def test_search_target_policy_bindings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policy_bindings_service.SearchTargetPolicyBindingsRequest() - assert args[0] == request_msg @@ -6771,7 +6785,6 @@ def test_create_policy_binding_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policy_bindings_service.CreatePolicyBindingRequest() - assert args[0] == request_msg @@ -6793,7 +6806,6 @@ def test_get_policy_binding_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policy_bindings_service.GetPolicyBindingRequest() - assert args[0] == request_msg @@ -6815,7 +6827,6 @@ def test_update_policy_binding_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policy_bindings_service.UpdatePolicyBindingRequest() - assert args[0] == request_msg @@ -6837,7 +6848,6 @@ def test_delete_policy_binding_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policy_bindings_service.DeletePolicyBindingRequest() - assert args[0] == request_msg @@ -6859,7 +6869,6 @@ def test_list_policy_bindings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policy_bindings_service.ListPolicyBindingsRequest() - assert args[0] == request_msg @@ -6881,7 +6890,6 @@ def test_search_target_policy_bindings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policy_bindings_service.SearchTargetPolicyBindingsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-iam/tests/unit/gapic/iam_v3beta/test_principal_access_boundary_policies.py b/packages/google-cloud-iam/tests/unit/gapic/iam_v3beta/test_principal_access_boundary_policies.py index ec6a4350cdbc..a7d3858bd6e2 100644 --- a/packages/google-cloud-iam/tests/unit/gapic/iam_v3beta/test_principal_access_boundary_policies.py +++ b/packages/google-cloud-iam/tests/unit/gapic/iam_v3beta/test_principal_access_boundary_policies.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 @@ -121,6 +122,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" @@ -1458,8 +1474,8 @@ def test_principal_access_boundary_policies_client_create_channel_credentials_fi @pytest.mark.parametrize( "request_type", [ - principal_access_boundary_policies_service.CreatePrincipalAccessBoundaryPolicyRequest, - dict, + principal_access_boundary_policies_service.CreatePrincipalAccessBoundaryPolicyRequest(), + {}, ], ) def test_create_principal_access_boundary_policy(request_type, transport: str = "grpc"): @@ -1470,7 +1486,7 @@ def test_create_principal_access_boundary_policy(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( @@ -1516,13 +1532,11 @@ def test_create_principal_access_boundary_policy_non_empty_request_with_auto_pop client.create_principal_access_boundary_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert ( - args[0] - == principal_access_boundary_policies_service.CreatePrincipalAccessBoundaryPolicyRequest( - parent="parent_value", - principal_access_boundary_policy_id="principal_access_boundary_policy_id_value", - ) + request_msg = principal_access_boundary_policies_service.CreatePrincipalAccessBoundaryPolicyRequest( + parent="parent_value", + principal_access_boundary_policy_id="principal_access_boundary_policy_id_value", ) + assert args[0] == request_msg def test_create_principal_access_boundary_policy_use_cached_wrapped_rpc(): @@ -1618,9 +1632,15 @@ async def test_create_principal_access_boundary_policy_async_use_cached_wrapped_ @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + principal_access_boundary_policies_service.CreatePrincipalAccessBoundaryPolicyRequest(), + {}, + ], +) async def test_create_principal_access_boundary_policy_async( - transport: str = "grpc_asyncio", - request_type=principal_access_boundary_policies_service.CreatePrincipalAccessBoundaryPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = PrincipalAccessBoundaryPoliciesAsyncClient( credentials=async_anonymous_credentials(), @@ -1629,7 +1649,7 @@ async def test_create_principal_access_boundary_policy_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( @@ -1651,11 +1671,6 @@ async def test_create_principal_access_boundary_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_principal_access_boundary_policy_async_from_dict(): - await test_create_principal_access_boundary_policy_async(request_type=dict) - - def test_create_principal_access_boundary_policy_field_headers(): client = PrincipalAccessBoundaryPoliciesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1846,8 +1861,8 @@ async def test_create_principal_access_boundary_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - principal_access_boundary_policies_service.GetPrincipalAccessBoundaryPolicyRequest, - dict, + principal_access_boundary_policies_service.GetPrincipalAccessBoundaryPolicyRequest(), + {}, ], ) def test_get_principal_access_boundary_policy(request_type, transport: str = "grpc"): @@ -1858,7 +1873,7 @@ def test_get_principal_access_boundary_policy(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( @@ -1917,12 +1932,10 @@ def test_get_principal_access_boundary_policy_non_empty_request_with_auto_popula client.get_principal_access_boundary_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert ( - args[0] - == principal_access_boundary_policies_service.GetPrincipalAccessBoundaryPolicyRequest( - name="name_value", - ) + request_msg = principal_access_boundary_policies_service.GetPrincipalAccessBoundaryPolicyRequest( + name="name_value", ) + assert args[0] == request_msg def test_get_principal_access_boundary_policy_use_cached_wrapped_rpc(): @@ -2008,9 +2021,15 @@ async def test_get_principal_access_boundary_policy_async_use_cached_wrapped_rpc @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + principal_access_boundary_policies_service.GetPrincipalAccessBoundaryPolicyRequest(), + {}, + ], +) async def test_get_principal_access_boundary_policy_async( - transport: str = "grpc_asyncio", - request_type=principal_access_boundary_policies_service.GetPrincipalAccessBoundaryPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = PrincipalAccessBoundaryPoliciesAsyncClient( credentials=async_anonymous_credentials(), @@ -2019,7 +2038,7 @@ async def test_get_principal_access_boundary_policy_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( @@ -2053,11 +2072,6 @@ async def test_get_principal_access_boundary_policy_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_get_principal_access_boundary_policy_async_from_dict(): - await test_get_principal_access_boundary_policy_async(request_type=dict) - - def test_get_principal_access_boundary_policy_field_headers(): client = PrincipalAccessBoundaryPoliciesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2218,8 +2232,8 @@ async def test_get_principal_access_boundary_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - principal_access_boundary_policies_service.UpdatePrincipalAccessBoundaryPolicyRequest, - dict, + principal_access_boundary_policies_service.UpdatePrincipalAccessBoundaryPolicyRequest(), + {}, ], ) def test_update_principal_access_boundary_policy(request_type, transport: str = "grpc"): @@ -2230,7 +2244,7 @@ def test_update_principal_access_boundary_policy(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( @@ -2273,10 +2287,8 @@ def test_update_principal_access_boundary_policy_non_empty_request_with_auto_pop client.update_principal_access_boundary_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert ( - args[0] - == principal_access_boundary_policies_service.UpdatePrincipalAccessBoundaryPolicyRequest() - ) + request_msg = principal_access_boundary_policies_service.UpdatePrincipalAccessBoundaryPolicyRequest() + assert args[0] == request_msg def test_update_principal_access_boundary_policy_use_cached_wrapped_rpc(): @@ -2372,9 +2384,15 @@ async def test_update_principal_access_boundary_policy_async_use_cached_wrapped_ @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + principal_access_boundary_policies_service.UpdatePrincipalAccessBoundaryPolicyRequest(), + {}, + ], +) async def test_update_principal_access_boundary_policy_async( - transport: str = "grpc_asyncio", - request_type=principal_access_boundary_policies_service.UpdatePrincipalAccessBoundaryPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = PrincipalAccessBoundaryPoliciesAsyncClient( credentials=async_anonymous_credentials(), @@ -2383,7 +2401,7 @@ async def test_update_principal_access_boundary_policy_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( @@ -2405,11 +2423,6 @@ async def test_update_principal_access_boundary_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_principal_access_boundary_policy_async_from_dict(): - await test_update_principal_access_boundary_policy_async(request_type=dict) - - def test_update_principal_access_boundary_policy_field_headers(): client = PrincipalAccessBoundaryPoliciesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2590,8 +2603,8 @@ async def test_update_principal_access_boundary_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - principal_access_boundary_policies_service.DeletePrincipalAccessBoundaryPolicyRequest, - dict, + principal_access_boundary_policies_service.DeletePrincipalAccessBoundaryPolicyRequest(), + {}, ], ) def test_delete_principal_access_boundary_policy(request_type, transport: str = "grpc"): @@ -2602,7 +2615,7 @@ def test_delete_principal_access_boundary_policy(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( @@ -2648,13 +2661,11 @@ def test_delete_principal_access_boundary_policy_non_empty_request_with_auto_pop client.delete_principal_access_boundary_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert ( - args[0] - == principal_access_boundary_policies_service.DeletePrincipalAccessBoundaryPolicyRequest( - name="name_value", - etag="etag_value", - ) + request_msg = principal_access_boundary_policies_service.DeletePrincipalAccessBoundaryPolicyRequest( + name="name_value", + etag="etag_value", ) + assert args[0] == request_msg def test_delete_principal_access_boundary_policy_use_cached_wrapped_rpc(): @@ -2750,9 +2761,15 @@ async def test_delete_principal_access_boundary_policy_async_use_cached_wrapped_ @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + principal_access_boundary_policies_service.DeletePrincipalAccessBoundaryPolicyRequest(), + {}, + ], +) async def test_delete_principal_access_boundary_policy_async( - transport: str = "grpc_asyncio", - request_type=principal_access_boundary_policies_service.DeletePrincipalAccessBoundaryPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = PrincipalAccessBoundaryPoliciesAsyncClient( credentials=async_anonymous_credentials(), @@ -2761,7 +2778,7 @@ async def test_delete_principal_access_boundary_policy_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( @@ -2783,11 +2800,6 @@ async def test_delete_principal_access_boundary_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_principal_access_boundary_policy_async_from_dict(): - await test_delete_principal_access_boundary_policy_async(request_type=dict) - - def test_delete_principal_access_boundary_policy_field_headers(): client = PrincipalAccessBoundaryPoliciesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2942,8 +2954,8 @@ async def test_delete_principal_access_boundary_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - principal_access_boundary_policies_service.ListPrincipalAccessBoundaryPoliciesRequest, - dict, + principal_access_boundary_policies_service.ListPrincipalAccessBoundaryPoliciesRequest(), + {}, ], ) def test_list_principal_access_boundary_policies(request_type, transport: str = "grpc"): @@ -2954,7 +2966,7 @@ def test_list_principal_access_boundary_policies(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( @@ -3003,13 +3015,11 @@ def test_list_principal_access_boundary_policies_non_empty_request_with_auto_pop client.list_principal_access_boundary_policies(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert ( - args[0] - == principal_access_boundary_policies_service.ListPrincipalAccessBoundaryPoliciesRequest( - parent="parent_value", - page_token="page_token_value", - ) + request_msg = principal_access_boundary_policies_service.ListPrincipalAccessBoundaryPoliciesRequest( + parent="parent_value", + page_token="page_token_value", ) + assert args[0] == request_msg def test_list_principal_access_boundary_policies_use_cached_wrapped_rpc(): @@ -3095,9 +3105,15 @@ async def test_list_principal_access_boundary_policies_async_use_cached_wrapped_ @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + principal_access_boundary_policies_service.ListPrincipalAccessBoundaryPoliciesRequest(), + {}, + ], +) async def test_list_principal_access_boundary_policies_async( - transport: str = "grpc_asyncio", - request_type=principal_access_boundary_policies_service.ListPrincipalAccessBoundaryPoliciesRequest, + request_type, transport: str = "grpc_asyncio" ): client = PrincipalAccessBoundaryPoliciesAsyncClient( credentials=async_anonymous_credentials(), @@ -3106,7 +3122,7 @@ async def test_list_principal_access_boundary_policies_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( @@ -3131,11 +3147,6 @@ async def test_list_principal_access_boundary_policies_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_principal_access_boundary_policies_async_from_dict(): - await test_list_principal_access_boundary_policies_async(request_type=dict) - - def test_list_principal_access_boundary_policies_field_headers(): client = PrincipalAccessBoundaryPoliciesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3504,8 +3515,8 @@ async def test_list_principal_access_boundary_policies_async_pages(): @pytest.mark.parametrize( "request_type", [ - principal_access_boundary_policies_service.SearchPrincipalAccessBoundaryPolicyBindingsRequest, - dict, + principal_access_boundary_policies_service.SearchPrincipalAccessBoundaryPolicyBindingsRequest(), + {}, ], ) def test_search_principal_access_boundary_policy_bindings( @@ -3518,7 +3529,7 @@ def test_search_principal_access_boundary_policy_bindings( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3569,13 +3580,11 @@ def test_search_principal_access_boundary_policy_bindings_non_empty_request_with client.search_principal_access_boundary_policy_bindings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert ( - args[0] - == principal_access_boundary_policies_service.SearchPrincipalAccessBoundaryPolicyBindingsRequest( - name="name_value", - page_token="page_token_value", - ) + request_msg = principal_access_boundary_policies_service.SearchPrincipalAccessBoundaryPolicyBindingsRequest( + name="name_value", + page_token="page_token_value", ) + assert args[0] == request_msg def test_search_principal_access_boundary_policy_bindings_use_cached_wrapped_rpc(): @@ -3661,9 +3670,15 @@ async def test_search_principal_access_boundary_policy_bindings_async_use_cached @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + principal_access_boundary_policies_service.SearchPrincipalAccessBoundaryPolicyBindingsRequest(), + {}, + ], +) async def test_search_principal_access_boundary_policy_bindings_async( - transport: str = "grpc_asyncio", - request_type=principal_access_boundary_policies_service.SearchPrincipalAccessBoundaryPolicyBindingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = PrincipalAccessBoundaryPoliciesAsyncClient( credentials=async_anonymous_credentials(), @@ -3672,7 +3687,7 @@ async def test_search_principal_access_boundary_policy_bindings_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( @@ -3702,11 +3717,6 @@ async def test_search_principal_access_boundary_policy_bindings_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_search_principal_access_boundary_policy_bindings_async_from_dict(): - await test_search_principal_access_boundary_policy_bindings_async(request_type=dict) - - def test_search_principal_access_boundary_policy_bindings_field_headers(): client = PrincipalAccessBoundaryPoliciesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5635,7 +5645,6 @@ def test_create_principal_access_boundary_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = principal_access_boundary_policies_service.CreatePrincipalAccessBoundaryPolicyRequest() - assert args[0] == request_msg @@ -5660,7 +5669,6 @@ def test_get_principal_access_boundary_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = principal_access_boundary_policies_service.GetPrincipalAccessBoundaryPolicyRequest() - assert args[0] == request_msg @@ -5683,7 +5691,6 @@ def test_update_principal_access_boundary_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = principal_access_boundary_policies_service.UpdatePrincipalAccessBoundaryPolicyRequest() - assert args[0] == request_msg @@ -5706,7 +5713,6 @@ def test_delete_principal_access_boundary_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = principal_access_boundary_policies_service.DeletePrincipalAccessBoundaryPolicyRequest() - assert args[0] == request_msg @@ -5729,7 +5735,6 @@ def test_list_principal_access_boundary_policies_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = principal_access_boundary_policies_service.ListPrincipalAccessBoundaryPoliciesRequest() - assert args[0] == request_msg @@ -5753,7 +5758,6 @@ def test_search_principal_access_boundary_policy_bindings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = principal_access_boundary_policies_service.SearchPrincipalAccessBoundaryPolicyBindingsRequest() - assert args[0] == request_msg @@ -5794,7 +5798,6 @@ async def test_create_principal_access_boundary_policy_empty_call_grpc_asyncio() call.assert_called() _, args, _ = call.mock_calls[0] request_msg = principal_access_boundary_policies_service.CreatePrincipalAccessBoundaryPolicyRequest() - assert args[0] == request_msg @@ -5826,7 +5829,6 @@ async def test_get_principal_access_boundary_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = principal_access_boundary_policies_service.GetPrincipalAccessBoundaryPolicyRequest() - assert args[0] == request_msg @@ -5853,7 +5855,6 @@ async def test_update_principal_access_boundary_policy_empty_call_grpc_asyncio() call.assert_called() _, args, _ = call.mock_calls[0] request_msg = principal_access_boundary_policies_service.UpdatePrincipalAccessBoundaryPolicyRequest() - assert args[0] == request_msg @@ -5880,7 +5881,6 @@ async def test_delete_principal_access_boundary_policy_empty_call_grpc_asyncio() call.assert_called() _, args, _ = call.mock_calls[0] request_msg = principal_access_boundary_policies_service.DeletePrincipalAccessBoundaryPolicyRequest() - assert args[0] == request_msg @@ -5909,7 +5909,6 @@ async def test_list_principal_access_boundary_policies_empty_call_grpc_asyncio() call.assert_called() _, args, _ = call.mock_calls[0] request_msg = principal_access_boundary_policies_service.ListPrincipalAccessBoundaryPoliciesRequest() - assert args[0] == request_msg @@ -5939,7 +5938,6 @@ async def test_search_principal_access_boundary_policy_bindings_empty_call_grpc_ call.assert_called() _, args, _ = call.mock_calls[0] request_msg = principal_access_boundary_policies_service.SearchPrincipalAccessBoundaryPolicyBindingsRequest() - assert args[0] == request_msg @@ -7069,7 +7067,6 @@ def test_create_principal_access_boundary_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = principal_access_boundary_policies_service.CreatePrincipalAccessBoundaryPolicyRequest() - assert args[0] == request_msg @@ -7091,7 +7088,6 @@ def test_get_principal_access_boundary_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = principal_access_boundary_policies_service.GetPrincipalAccessBoundaryPolicyRequest() - assert args[0] == request_msg @@ -7113,7 +7109,6 @@ def test_update_principal_access_boundary_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = principal_access_boundary_policies_service.UpdatePrincipalAccessBoundaryPolicyRequest() - assert args[0] == request_msg @@ -7135,7 +7130,6 @@ def test_delete_principal_access_boundary_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = principal_access_boundary_policies_service.DeletePrincipalAccessBoundaryPolicyRequest() - assert args[0] == request_msg @@ -7157,7 +7151,6 @@ def test_list_principal_access_boundary_policies_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = principal_access_boundary_policies_service.ListPrincipalAccessBoundaryPoliciesRequest() - assert args[0] == request_msg @@ -7180,7 +7173,6 @@ def test_search_principal_access_boundary_policy_bindings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = principal_access_boundary_policies_service.SearchPrincipalAccessBoundaryPolicyBindingsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-iamconnectorcredentials/noxfile.py b/packages/google-cloud-iamconnectorcredentials/noxfile.py index 9b477dd43b5a..1fff9f2e6f1e 100644 --- a/packages/google-cloud-iamconnectorcredentials/noxfile.py +++ b/packages/google-cloud-iamconnectorcredentials/noxfile.py @@ -47,7 +47,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-iamconnectorcredentials" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-iamconnectorcredentials/setup.py b/packages/google-cloud-iamconnectorcredentials/setup.py index 8ac7400d2a34..db191dee7c5b 100644 --- a/packages/google-cloud-iamconnectorcredentials/setup.py +++ b/packages/google-cloud-iamconnectorcredentials/setup.py @@ -45,7 +45,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/google-cloud-iamconnectorcredentials/testing/constraints-3.10.txt b/packages/google-cloud-iamconnectorcredentials/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-iamconnectorcredentials/testing/constraints-3.10.txt +++ b/packages/google-cloud-iamconnectorcredentials/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-iamconnectorcredentials/tests/unit/gapic/iamconnectorcredentials_v1alpha/test_iam_connector_credentials_service.py b/packages/google-cloud-iamconnectorcredentials/tests/unit/gapic/iamconnectorcredentials_v1alpha/test_iam_connector_credentials_service.py index 85231a565949..38f1b68b9e5a 100644 --- a/packages/google-cloud-iamconnectorcredentials/tests/unit/gapic/iamconnectorcredentials_v1alpha/test_iam_connector_credentials_service.py +++ b/packages/google-cloud-iamconnectorcredentials/tests/unit/gapic/iamconnectorcredentials_v1alpha/test_iam_connector_credentials_service.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" @@ -1439,8 +1455,8 @@ def test_iam_connector_credentials_service_client_create_channel_credentials_fil @pytest.mark.parametrize( "request_type", [ - connector_credentials.RetrieveCredentialsRequest, - dict, + connector_credentials.RetrieveCredentialsRequest(), + {}, ], ) def test_retrieve_credentials(request_type, transport: str = "grpc"): @@ -1451,7 +1467,7 @@ def test_retrieve_credentials(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1498,11 +1514,12 @@ def test_retrieve_credentials_non_empty_request_with_auto_populated_field(): client.retrieve_credentials(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == connector_credentials.RetrieveCredentialsRequest( + request_msg = connector_credentials.RetrieveCredentialsRequest( connector="connector_value", user_id="user_id_value", continue_uri="continue_uri_value", ) + assert args[0] == request_msg def test_retrieve_credentials_use_cached_wrapped_rpc(): @@ -1597,9 +1614,15 @@ async def test_retrieve_credentials_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + connector_credentials.RetrieveCredentialsRequest(), + {}, + ], +) async def test_retrieve_credentials_async( - transport: str = "grpc_asyncio", - request_type=connector_credentials.RetrieveCredentialsRequest, + request_type, transport: str = "grpc_asyncio" ): client = IAMConnectorCredentialsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1608,7 +1631,7 @@ async def test_retrieve_credentials_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( @@ -1630,11 +1653,6 @@ async def test_retrieve_credentials_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_retrieve_credentials_async_from_dict(): - await test_retrieve_credentials_async(request_type=dict) - - def test_retrieve_credentials_field_headers(): client = IAMConnectorCredentialsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1829,8 +1847,8 @@ async def test_retrieve_credentials_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - connector_credentials.FinalizeCredentialsRequest, - dict, + connector_credentials.FinalizeCredentialsRequest(), + {}, ], ) def test_finalize_credentials(request_type, transport: str = "grpc"): @@ -1841,7 +1859,7 @@ def test_finalize_credentials(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1888,11 +1906,12 @@ def test_finalize_credentials_non_empty_request_with_auto_populated_field(): client.finalize_credentials(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == connector_credentials.FinalizeCredentialsRequest( + request_msg = connector_credentials.FinalizeCredentialsRequest( connector="connector_value", user_id="user_id_value", consent_nonce="consent_nonce_value", ) + assert args[0] == request_msg def test_finalize_credentials_use_cached_wrapped_rpc(): @@ -1977,9 +1996,15 @@ async def test_finalize_credentials_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + connector_credentials.FinalizeCredentialsRequest(), + {}, + ], +) async def test_finalize_credentials_async( - transport: str = "grpc_asyncio", - request_type=connector_credentials.FinalizeCredentialsRequest, + request_type, transport: str = "grpc_asyncio" ): client = IAMConnectorCredentialsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1988,7 +2013,7 @@ async def test_finalize_credentials_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( @@ -2010,11 +2035,6 @@ async def test_finalize_credentials_async( assert isinstance(response, connector_credentials.FinalizeCredentialsResponse) -@pytest.mark.asyncio -async def test_finalize_credentials_async_from_dict(): - await test_finalize_credentials_async(request_type=dict) - - def test_finalize_credentials_field_headers(): client = IAMConnectorCredentialsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2560,7 +2580,6 @@ def test_retrieve_credentials_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = connector_credentials.RetrieveCredentialsRequest() - assert args[0] == request_msg @@ -2583,7 +2602,6 @@ def test_finalize_credentials_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = connector_credentials.FinalizeCredentialsRequest() - assert args[0] == request_msg @@ -2624,7 +2642,6 @@ async def test_retrieve_credentials_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = connector_credentials.RetrieveCredentialsRequest() - assert args[0] == request_msg @@ -2651,7 +2668,6 @@ async def test_finalize_credentials_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = connector_credentials.FinalizeCredentialsRequest() - assert args[0] == request_msg @@ -2960,7 +2976,6 @@ def test_retrieve_credentials_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = connector_credentials.RetrieveCredentialsRequest() - assert args[0] == request_msg @@ -2982,7 +2997,6 @@ def test_finalize_credentials_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = connector_credentials.FinalizeCredentialsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-iap/noxfile.py b/packages/google-cloud-iap/noxfile.py index 6ab4698e480d..239436d95342 100644 --- a/packages/google-cloud-iap/noxfile.py +++ b/packages/google-cloud-iap/noxfile.py @@ -47,7 +47,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-iap" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-iap/setup.py b/packages/google-cloud-iap/setup.py index bd864f482c50..4bf15966b7bd 100644 --- a/packages/google-cloud-iap/setup.py +++ b/packages/google-cloud-iap/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/google-cloud-iap/testing/constraints-3.10.txt b/packages/google-cloud-iap/testing/constraints-3.10.txt index a92801e1c8e2..b39cd54634f9 100644 --- a/packages/google-cloud-iap/testing/constraints-3.10.txt +++ b/packages/google-cloud-iap/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/google-cloud-iap/tests/unit/gapic/iap_v1/test_identity_aware_proxy_admin_service.py b/packages/google-cloud-iap/tests/unit/gapic/iap_v1/test_identity_aware_proxy_admin_service.py index 36cac431a0a5..335d0ddee7da 100644 --- a/packages/google-cloud-iap/tests/unit/gapic/iap_v1/test_identity_aware_proxy_admin_service.py +++ b/packages/google-cloud-iap/tests/unit/gapic/iap_v1/test_identity_aware_proxy_admin_service.py @@ -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 @@ -114,6 +115,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" @@ -1442,8 +1458,8 @@ def test_identity_aware_proxy_admin_service_client_create_channel_credentials_fi @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.SetIamPolicyRequest, - dict, + iam_policy_pb2.SetIamPolicyRequest(), + {}, ], ) def test_set_iam_policy(request_type, transport: str = "grpc"): @@ -1454,7 +1470,7 @@ def test_set_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(type(client.transport.set_iam_policy), "__call__") as call: @@ -1500,9 +1516,10 @@ def test_set_iam_policy_non_empty_request_with_auto_populated_field(): client.set_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.SetIamPolicyRequest( + request_msg = iam_policy_pb2.SetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_set_iam_policy_use_cached_wrapped_rpc(): @@ -1583,9 +1600,14 @@ async def test_set_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.SetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.SetIamPolicyRequest(), + {}, + ], +) +async def test_set_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = IdentityAwareProxyAdminServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1593,7 +1615,7 @@ async def test_set_iam_policy_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.set_iam_policy), "__call__") as call: @@ -1618,11 +1640,6 @@ async def test_set_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_set_iam_policy_async_from_dict(): - await test_set_iam_policy_async(request_type=dict) - - def test_set_iam_policy_field_headers(): client = IdentityAwareProxyAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1703,8 +1720,8 @@ def test_set_iam_policy_from_dict_foreign(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.GetIamPolicyRequest, - dict, + iam_policy_pb2.GetIamPolicyRequest(), + {}, ], ) def test_get_iam_policy(request_type, transport: str = "grpc"): @@ -1715,7 +1732,7 @@ def test_get_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(type(client.transport.get_iam_policy), "__call__") as call: @@ -1761,9 +1778,10 @@ def test_get_iam_policy_non_empty_request_with_auto_populated_field(): client.get_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.GetIamPolicyRequest( + request_msg = iam_policy_pb2.GetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_get_iam_policy_use_cached_wrapped_rpc(): @@ -1844,9 +1862,14 @@ async def test_get_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.GetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.GetIamPolicyRequest(), + {}, + ], +) +async def test_get_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = IdentityAwareProxyAdminServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1854,7 +1877,7 @@ async def test_get_iam_policy_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_iam_policy), "__call__") as call: @@ -1879,11 +1902,6 @@ async def test_get_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_get_iam_policy_async_from_dict(): - await test_get_iam_policy_async(request_type=dict) - - def test_get_iam_policy_field_headers(): client = IdentityAwareProxyAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1963,8 +1981,8 @@ def test_get_iam_policy_from_dict_foreign(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.TestIamPermissionsRequest, - dict, + iam_policy_pb2.TestIamPermissionsRequest(), + {}, ], ) def test_test_iam_permissions(request_type, transport: str = "grpc"): @@ -1975,7 +1993,7 @@ def test_test_iam_permissions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2023,9 +2041,10 @@ def test_test_iam_permissions_non_empty_request_with_auto_populated_field(): client.test_iam_permissions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.TestIamPermissionsRequest( + request_msg = iam_policy_pb2.TestIamPermissionsRequest( resource="resource_value", ) + assert args[0] == request_msg def test_test_iam_permissions_use_cached_wrapped_rpc(): @@ -2110,9 +2129,15 @@ async def test_test_iam_permissions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.TestIamPermissionsRequest(), + {}, + ], +) async def test_test_iam_permissions_async( - transport: str = "grpc_asyncio", - request_type=iam_policy_pb2.TestIamPermissionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = IdentityAwareProxyAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2121,7 +2146,7 @@ async def test_test_iam_permissions_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( @@ -2146,11 +2171,6 @@ async def test_test_iam_permissions_async( assert response.permissions == ["permissions_value"] -@pytest.mark.asyncio -async def test_test_iam_permissions_async_from_dict(): - await test_test_iam_permissions_async(request_type=dict) - - def test_test_iam_permissions_field_headers(): client = IdentityAwareProxyAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2238,8 +2258,8 @@ def test_test_iam_permissions_from_dict_foreign(): @pytest.mark.parametrize( "request_type", [ - service.GetIapSettingsRequest, - dict, + service.GetIapSettingsRequest(), + {}, ], ) def test_get_iap_settings(request_type, transport: str = "grpc"): @@ -2250,7 +2270,7 @@ def test_get_iap_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_iap_settings), "__call__") as call: @@ -2294,9 +2314,10 @@ def test_get_iap_settings_non_empty_request_with_auto_populated_field(): client.get_iap_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetIapSettingsRequest( + request_msg = service.GetIapSettingsRequest( name="name_value", ) + assert args[0] == request_msg def test_get_iap_settings_use_cached_wrapped_rpc(): @@ -2379,9 +2400,14 @@ async def test_get_iap_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_iap_settings_async( - transport: str = "grpc_asyncio", request_type=service.GetIapSettingsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetIapSettingsRequest(), + {}, + ], +) +async def test_get_iap_settings_async(request_type, transport: str = "grpc_asyncio"): client = IdentityAwareProxyAdminServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2389,7 +2415,7 @@ async def test_get_iap_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_iap_settings), "__call__") as call: @@ -2412,11 +2438,6 @@ async def test_get_iap_settings_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_iap_settings_async_from_dict(): - await test_get_iap_settings_async(request_type=dict) - - def test_get_iap_settings_field_headers(): client = IdentityAwareProxyAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2479,8 +2500,8 @@ async def test_get_iap_settings_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdateIapSettingsRequest, - dict, + service.UpdateIapSettingsRequest(), + {}, ], ) def test_update_iap_settings(request_type, transport: str = "grpc"): @@ -2491,7 +2512,7 @@ def test_update_iap_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( @@ -2537,7 +2558,8 @@ def test_update_iap_settings_non_empty_request_with_auto_populated_field(): client.update_iap_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateIapSettingsRequest() + request_msg = service.UpdateIapSettingsRequest() + assert args[0] == request_msg def test_update_iap_settings_use_cached_wrapped_rpc(): @@ -2622,9 +2644,14 @@ async def test_update_iap_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_iap_settings_async( - transport: str = "grpc_asyncio", request_type=service.UpdateIapSettingsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateIapSettingsRequest(), + {}, + ], +) +async def test_update_iap_settings_async(request_type, transport: str = "grpc_asyncio"): client = IdentityAwareProxyAdminServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2632,7 +2659,7 @@ async def test_update_iap_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( @@ -2657,11 +2684,6 @@ async def test_update_iap_settings_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_update_iap_settings_async_from_dict(): - await test_update_iap_settings_async(request_type=dict) - - def test_update_iap_settings_field_headers(): client = IdentityAwareProxyAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2728,8 +2750,8 @@ async def test_update_iap_settings_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.ValidateIapAttributeExpressionRequest, - dict, + service.ValidateIapAttributeExpressionRequest(), + {}, ], ) def test_validate_iap_attribute_expression(request_type, transport: str = "grpc"): @@ -2740,7 +2762,7 @@ def test_validate_iap_attribute_expression(request_type, transport: str = "grpc" # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2786,10 +2808,11 @@ def test_validate_iap_attribute_expression_non_empty_request_with_auto_populated client.validate_iap_attribute_expression(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ValidateIapAttributeExpressionRequest( + request_msg = service.ValidateIapAttributeExpressionRequest( name="name_value", expression="expression_value", ) + assert args[0] == request_msg def test_validate_iap_attribute_expression_use_cached_wrapped_rpc(): @@ -2875,9 +2898,15 @@ async def test_validate_iap_attribute_expression_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.ValidateIapAttributeExpressionRequest(), + {}, + ], +) async def test_validate_iap_attribute_expression_async( - transport: str = "grpc_asyncio", - request_type=service.ValidateIapAttributeExpressionRequest, + request_type, transport: str = "grpc_asyncio" ): client = IdentityAwareProxyAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2886,7 +2915,7 @@ async def test_validate_iap_attribute_expression_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( @@ -2908,11 +2937,6 @@ async def test_validate_iap_attribute_expression_async( assert isinstance(response, service.ValidateIapAttributeExpressionResponse) -@pytest.mark.asyncio -async def test_validate_iap_attribute_expression_async_from_dict(): - await test_validate_iap_attribute_expression_async(request_type=dict) - - def test_validate_iap_attribute_expression_field_headers(): client = IdentityAwareProxyAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2981,8 +3005,8 @@ async def test_validate_iap_attribute_expression_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.ListTunnelDestGroupsRequest, - dict, + service.ListTunnelDestGroupsRequest(), + {}, ], ) def test_list_tunnel_dest_groups(request_type, transport: str = "grpc"): @@ -2993,7 +3017,7 @@ def test_list_tunnel_dest_groups(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3042,10 +3066,11 @@ def test_list_tunnel_dest_groups_non_empty_request_with_auto_populated_field(): client.list_tunnel_dest_groups(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListTunnelDestGroupsRequest( + request_msg = service.ListTunnelDestGroupsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_tunnel_dest_groups_use_cached_wrapped_rpc(): @@ -3131,8 +3156,15 @@ async def test_list_tunnel_dest_groups_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.ListTunnelDestGroupsRequest(), + {}, + ], +) async def test_list_tunnel_dest_groups_async( - transport: str = "grpc_asyncio", request_type=service.ListTunnelDestGroupsRequest + request_type, transport: str = "grpc_asyncio" ): client = IdentityAwareProxyAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3141,7 +3173,7 @@ async def test_list_tunnel_dest_groups_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( @@ -3166,11 +3198,6 @@ async def test_list_tunnel_dest_groups_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_tunnel_dest_groups_async_from_dict(): - await test_list_tunnel_dest_groups_async(request_type=dict) - - def test_list_tunnel_dest_groups_field_headers(): client = IdentityAwareProxyAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3523,8 +3550,8 @@ async def test_list_tunnel_dest_groups_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.CreateTunnelDestGroupRequest, - dict, + service.CreateTunnelDestGroupRequest(), + {}, ], ) def test_create_tunnel_dest_group(request_type, transport: str = "grpc"): @@ -3535,7 +3562,7 @@ def test_create_tunnel_dest_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3588,10 +3615,11 @@ def test_create_tunnel_dest_group_non_empty_request_with_auto_populated_field(): client.create_tunnel_dest_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateTunnelDestGroupRequest( + request_msg = service.CreateTunnelDestGroupRequest( parent="parent_value", tunnel_dest_group_id="tunnel_dest_group_id_value", ) + assert args[0] == request_msg def test_create_tunnel_dest_group_use_cached_wrapped_rpc(): @@ -3677,8 +3705,15 @@ async def test_create_tunnel_dest_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.CreateTunnelDestGroupRequest(), + {}, + ], +) async def test_create_tunnel_dest_group_async( - transport: str = "grpc_asyncio", request_type=service.CreateTunnelDestGroupRequest + request_type, transport: str = "grpc_asyncio" ): client = IdentityAwareProxyAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3687,7 +3722,7 @@ async def test_create_tunnel_dest_group_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( @@ -3716,11 +3751,6 @@ async def test_create_tunnel_dest_group_async( assert response.fqdns == ["fqdns_value"] -@pytest.mark.asyncio -async def test_create_tunnel_dest_group_async_from_dict(): - await test_create_tunnel_dest_group_async(request_type=dict) - - def test_create_tunnel_dest_group_field_headers(): client = IdentityAwareProxyAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3895,8 +3925,8 @@ async def test_create_tunnel_dest_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.GetTunnelDestGroupRequest, - dict, + service.GetTunnelDestGroupRequest(), + {}, ], ) def test_get_tunnel_dest_group(request_type, transport: str = "grpc"): @@ -3907,7 +3937,7 @@ def test_get_tunnel_dest_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3959,9 +3989,10 @@ def test_get_tunnel_dest_group_non_empty_request_with_auto_populated_field(): client.get_tunnel_dest_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetTunnelDestGroupRequest( + request_msg = service.GetTunnelDestGroupRequest( name="name_value", ) + assert args[0] == request_msg def test_get_tunnel_dest_group_use_cached_wrapped_rpc(): @@ -4047,8 +4078,15 @@ async def test_get_tunnel_dest_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.GetTunnelDestGroupRequest(), + {}, + ], +) async def test_get_tunnel_dest_group_async( - transport: str = "grpc_asyncio", request_type=service.GetTunnelDestGroupRequest + request_type, transport: str = "grpc_asyncio" ): client = IdentityAwareProxyAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4057,7 +4095,7 @@ async def test_get_tunnel_dest_group_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( @@ -4086,11 +4124,6 @@ async def test_get_tunnel_dest_group_async( assert response.fqdns == ["fqdns_value"] -@pytest.mark.asyncio -async def test_get_tunnel_dest_group_async_from_dict(): - await test_get_tunnel_dest_group_async(request_type=dict) - - def test_get_tunnel_dest_group_field_headers(): client = IdentityAwareProxyAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4245,8 +4278,8 @@ async def test_get_tunnel_dest_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DeleteTunnelDestGroupRequest, - dict, + service.DeleteTunnelDestGroupRequest(), + {}, ], ) def test_delete_tunnel_dest_group(request_type, transport: str = "grpc"): @@ -4257,7 +4290,7 @@ def test_delete_tunnel_dest_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4302,9 +4335,10 @@ def test_delete_tunnel_dest_group_non_empty_request_with_auto_populated_field(): client.delete_tunnel_dest_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteTunnelDestGroupRequest( + request_msg = service.DeleteTunnelDestGroupRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_tunnel_dest_group_use_cached_wrapped_rpc(): @@ -4390,8 +4424,15 @@ async def test_delete_tunnel_dest_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteTunnelDestGroupRequest(), + {}, + ], +) async def test_delete_tunnel_dest_group_async( - transport: str = "grpc_asyncio", request_type=service.DeleteTunnelDestGroupRequest + request_type, transport: str = "grpc_asyncio" ): client = IdentityAwareProxyAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4400,7 +4441,7 @@ async def test_delete_tunnel_dest_group_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( @@ -4420,11 +4461,6 @@ async def test_delete_tunnel_dest_group_async( assert response is None -@pytest.mark.asyncio -async def test_delete_tunnel_dest_group_async_from_dict(): - await test_delete_tunnel_dest_group_async(request_type=dict) - - def test_delete_tunnel_dest_group_field_headers(): client = IdentityAwareProxyAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4575,8 +4611,8 @@ async def test_delete_tunnel_dest_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdateTunnelDestGroupRequest, - dict, + service.UpdateTunnelDestGroupRequest(), + {}, ], ) def test_update_tunnel_dest_group(request_type, transport: str = "grpc"): @@ -4587,7 +4623,7 @@ def test_update_tunnel_dest_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4637,7 +4673,8 @@ def test_update_tunnel_dest_group_non_empty_request_with_auto_populated_field(): client.update_tunnel_dest_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateTunnelDestGroupRequest() + request_msg = service.UpdateTunnelDestGroupRequest() + assert args[0] == request_msg def test_update_tunnel_dest_group_use_cached_wrapped_rpc(): @@ -4723,8 +4760,15 @@ async def test_update_tunnel_dest_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateTunnelDestGroupRequest(), + {}, + ], +) async def test_update_tunnel_dest_group_async( - transport: str = "grpc_asyncio", request_type=service.UpdateTunnelDestGroupRequest + request_type, transport: str = "grpc_asyncio" ): client = IdentityAwareProxyAdminServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4733,7 +4777,7 @@ async def test_update_tunnel_dest_group_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( @@ -4762,11 +4806,6 @@ async def test_update_tunnel_dest_group_async( assert response.fqdns == ["fqdns_value"] -@pytest.mark.asyncio -async def test_update_tunnel_dest_group_async_from_dict(): - await test_update_tunnel_dest_group_async(request_type=dict) - - def test_update_tunnel_dest_group_field_headers(): client = IdentityAwareProxyAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6855,7 +6894,6 @@ def test_set_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -6876,7 +6914,6 @@ def test_get_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -6899,7 +6936,6 @@ def test_test_iam_permissions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -6920,7 +6956,6 @@ def test_get_iap_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetIapSettingsRequest() - assert args[0] == request_msg @@ -6943,7 +6978,6 @@ def test_update_iap_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateIapSettingsRequest() - assert args[0] == request_msg @@ -6966,7 +7000,6 @@ def test_validate_iap_attribute_expression_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ValidateIapAttributeExpressionRequest() - assert args[0] == request_msg @@ -6989,7 +7022,6 @@ def test_list_tunnel_dest_groups_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListTunnelDestGroupsRequest() - assert args[0] == request_msg @@ -7012,7 +7044,6 @@ def test_create_tunnel_dest_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateTunnelDestGroupRequest() - assert args[0] == request_msg @@ -7035,7 +7066,6 @@ def test_get_tunnel_dest_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetTunnelDestGroupRequest() - assert args[0] == request_msg @@ -7058,7 +7088,6 @@ def test_delete_tunnel_dest_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteTunnelDestGroupRequest() - assert args[0] == request_msg @@ -7081,7 +7110,6 @@ def test_update_tunnel_dest_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateTunnelDestGroupRequest() - assert args[0] == request_msg @@ -7123,7 +7151,6 @@ async def test_set_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -7151,7 +7178,6 @@ async def test_get_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -7180,7 +7206,6 @@ async def test_test_iam_permissions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -7207,7 +7232,6 @@ async def test_get_iap_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetIapSettingsRequest() - assert args[0] == request_msg @@ -7236,7 +7260,6 @@ async def test_update_iap_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateIapSettingsRequest() - assert args[0] == request_msg @@ -7263,7 +7286,6 @@ async def test_validate_iap_attribute_expression_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ValidateIapAttributeExpressionRequest() - assert args[0] == request_msg @@ -7292,7 +7314,6 @@ async def test_list_tunnel_dest_groups_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListTunnelDestGroupsRequest() - assert args[0] == request_msg @@ -7323,7 +7344,6 @@ async def test_create_tunnel_dest_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateTunnelDestGroupRequest() - assert args[0] == request_msg @@ -7354,7 +7374,6 @@ async def test_get_tunnel_dest_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetTunnelDestGroupRequest() - assert args[0] == request_msg @@ -7379,7 +7398,6 @@ async def test_delete_tunnel_dest_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteTunnelDestGroupRequest() - assert args[0] == request_msg @@ -7410,7 +7428,6 @@ async def test_update_tunnel_dest_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateTunnelDestGroupRequest() - assert args[0] == request_msg @@ -9173,7 +9190,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -9193,7 +9209,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -9215,7 +9230,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -9235,7 +9249,6 @@ def test_get_iap_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetIapSettingsRequest() - assert args[0] == request_msg @@ -9257,7 +9270,6 @@ def test_update_iap_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateIapSettingsRequest() - assert args[0] == request_msg @@ -9279,7 +9291,6 @@ def test_validate_iap_attribute_expression_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ValidateIapAttributeExpressionRequest() - assert args[0] == request_msg @@ -9301,7 +9312,6 @@ def test_list_tunnel_dest_groups_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListTunnelDestGroupsRequest() - assert args[0] == request_msg @@ -9323,7 +9333,6 @@ def test_create_tunnel_dest_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateTunnelDestGroupRequest() - assert args[0] == request_msg @@ -9345,7 +9354,6 @@ def test_get_tunnel_dest_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetTunnelDestGroupRequest() - assert args[0] == request_msg @@ -9367,7 +9375,6 @@ def test_delete_tunnel_dest_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteTunnelDestGroupRequest() - assert args[0] == request_msg @@ -9389,7 +9396,6 @@ def test_update_tunnel_dest_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateTunnelDestGroupRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-iap/tests/unit/gapic/iap_v1/test_identity_aware_proxy_o_auth_service.py b/packages/google-cloud-iap/tests/unit/gapic/iap_v1/test_identity_aware_proxy_o_auth_service.py index 471f082e5265..61fd8b9d0fa6 100644 --- a/packages/google-cloud-iap/tests/unit/gapic/iap_v1/test_identity_aware_proxy_o_auth_service.py +++ b/packages/google-cloud-iap/tests/unit/gapic/iap_v1/test_identity_aware_proxy_o_auth_service.py @@ -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 @@ -107,6 +108,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" @@ -1435,8 +1451,8 @@ def test_identity_aware_proxy_o_auth_service_client_create_channel_credentials_f @pytest.mark.parametrize( "request_type", [ - service.ListBrandsRequest, - dict, + service.ListBrandsRequest(), + {}, ], ) def test_list_brands(request_type, transport: str = "grpc"): @@ -1447,7 +1463,7 @@ def test_list_brands(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_brands), "__call__") as call: @@ -1488,9 +1504,10 @@ def test_list_brands_non_empty_request_with_auto_populated_field(): client.list_brands(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListBrandsRequest( + request_msg = service.ListBrandsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_list_brands_use_cached_wrapped_rpc(): @@ -1571,9 +1588,14 @@ async def test_list_brands_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_brands_async( - transport: str = "grpc_asyncio", request_type=service.ListBrandsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListBrandsRequest(), + {}, + ], +) +async def test_list_brands_async(request_type, transport: str = "grpc_asyncio"): client = IdentityAwareProxyOAuthServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1581,7 +1603,7 @@ async def test_list_brands_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_brands), "__call__") as call: @@ -1601,11 +1623,6 @@ async def test_list_brands_async( assert isinstance(response, service.ListBrandsResponse) -@pytest.mark.asyncio -async def test_list_brands_async_from_dict(): - await test_list_brands_async(request_type=dict) - - def test_list_brands_field_headers(): client = IdentityAwareProxyOAuthServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1670,8 +1687,8 @@ async def test_list_brands_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.CreateBrandRequest, - dict, + service.CreateBrandRequest(), + {}, ], ) def test_create_brand(request_type, transport: str = "grpc"): @@ -1682,7 +1699,7 @@ def test_create_brand(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_brand), "__call__") as call: @@ -1732,9 +1749,10 @@ def test_create_brand_non_empty_request_with_auto_populated_field(): client.create_brand(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateBrandRequest( + request_msg = service.CreateBrandRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_brand_use_cached_wrapped_rpc(): @@ -1815,9 +1833,14 @@ async def test_create_brand_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_brand_async( - transport: str = "grpc_asyncio", request_type=service.CreateBrandRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CreateBrandRequest(), + {}, + ], +) +async def test_create_brand_async(request_type, transport: str = "grpc_asyncio"): client = IdentityAwareProxyOAuthServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1825,7 +1848,7 @@ async def test_create_brand_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_brand), "__call__") as call: @@ -1854,11 +1877,6 @@ async def test_create_brand_async( assert response.org_internal_only is True -@pytest.mark.asyncio -async def test_create_brand_async_from_dict(): - await test_create_brand_async(request_type=dict) - - def test_create_brand_field_headers(): client = IdentityAwareProxyOAuthServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1921,8 +1939,8 @@ async def test_create_brand_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.GetBrandRequest, - dict, + service.GetBrandRequest(), + {}, ], ) def test_get_brand(request_type, transport: str = "grpc"): @@ -1933,7 +1951,7 @@ def test_get_brand(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_brand), "__call__") as call: @@ -1983,9 +2001,10 @@ def test_get_brand_non_empty_request_with_auto_populated_field(): client.get_brand(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetBrandRequest( + request_msg = service.GetBrandRequest( name="name_value", ) + assert args[0] == request_msg def test_get_brand_use_cached_wrapped_rpc(): @@ -2064,9 +2083,14 @@ async def test_get_brand_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_brand_async( - transport: str = "grpc_asyncio", request_type=service.GetBrandRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetBrandRequest(), + {}, + ], +) +async def test_get_brand_async(request_type, transport: str = "grpc_asyncio"): client = IdentityAwareProxyOAuthServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2074,7 +2098,7 @@ async def test_get_brand_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_brand), "__call__") as call: @@ -2103,11 +2127,6 @@ async def test_get_brand_async( assert response.org_internal_only is True -@pytest.mark.asyncio -async def test_get_brand_async_from_dict(): - await test_get_brand_async(request_type=dict) - - def test_get_brand_field_headers(): client = IdentityAwareProxyOAuthServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2170,8 +2189,8 @@ async def test_get_brand_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.CreateIdentityAwareProxyClientRequest, - dict, + service.CreateIdentityAwareProxyClientRequest(), + {}, ], ) def test_create_identity_aware_proxy_client(request_type, transport: str = "grpc"): @@ -2182,7 +2201,7 @@ def test_create_identity_aware_proxy_client(request_type, transport: str = "grpc # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2234,9 +2253,10 @@ def test_create_identity_aware_proxy_client_non_empty_request_with_auto_populate client.create_identity_aware_proxy_client(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateIdentityAwareProxyClientRequest( + request_msg = service.CreateIdentityAwareProxyClientRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_identity_aware_proxy_client_use_cached_wrapped_rpc(): @@ -2322,9 +2342,15 @@ async def test_create_identity_aware_proxy_client_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.CreateIdentityAwareProxyClientRequest(), + {}, + ], +) async def test_create_identity_aware_proxy_client_async( - transport: str = "grpc_asyncio", - request_type=service.CreateIdentityAwareProxyClientRequest, + request_type, transport: str = "grpc_asyncio" ): client = IdentityAwareProxyOAuthServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2333,7 +2359,7 @@ async def test_create_identity_aware_proxy_client_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( @@ -2362,11 +2388,6 @@ async def test_create_identity_aware_proxy_client_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_create_identity_aware_proxy_client_async_from_dict(): - await test_create_identity_aware_proxy_client_async(request_type=dict) - - def test_create_identity_aware_proxy_client_field_headers(): client = IdentityAwareProxyOAuthServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2435,8 +2456,8 @@ async def test_create_identity_aware_proxy_client_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.ListIdentityAwareProxyClientsRequest, - dict, + service.ListIdentityAwareProxyClientsRequest(), + {}, ], ) def test_list_identity_aware_proxy_clients(request_type, transport: str = "grpc"): @@ -2447,7 +2468,7 @@ def test_list_identity_aware_proxy_clients(request_type, transport: str = "grpc" # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2496,10 +2517,11 @@ def test_list_identity_aware_proxy_clients_non_empty_request_with_auto_populated client.list_identity_aware_proxy_clients(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListIdentityAwareProxyClientsRequest( + request_msg = service.ListIdentityAwareProxyClientsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_identity_aware_proxy_clients_use_cached_wrapped_rpc(): @@ -2585,9 +2607,15 @@ async def test_list_identity_aware_proxy_clients_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.ListIdentityAwareProxyClientsRequest(), + {}, + ], +) async def test_list_identity_aware_proxy_clients_async( - transport: str = "grpc_asyncio", - request_type=service.ListIdentityAwareProxyClientsRequest, + request_type, transport: str = "grpc_asyncio" ): client = IdentityAwareProxyOAuthServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2596,7 +2624,7 @@ async def test_list_identity_aware_proxy_clients_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( @@ -2621,11 +2649,6 @@ async def test_list_identity_aware_proxy_clients_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_identity_aware_proxy_clients_async_from_dict(): - await test_list_identity_aware_proxy_clients_async(request_type=dict) - - def test_list_identity_aware_proxy_clients_field_headers(): client = IdentityAwareProxyOAuthServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2896,8 +2919,8 @@ async def test_list_identity_aware_proxy_clients_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetIdentityAwareProxyClientRequest, - dict, + service.GetIdentityAwareProxyClientRequest(), + {}, ], ) def test_get_identity_aware_proxy_client(request_type, transport: str = "grpc"): @@ -2908,7 +2931,7 @@ def test_get_identity_aware_proxy_client(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2960,9 +2983,10 @@ def test_get_identity_aware_proxy_client_non_empty_request_with_auto_populated_f client.get_identity_aware_proxy_client(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetIdentityAwareProxyClientRequest( + request_msg = service.GetIdentityAwareProxyClientRequest( name="name_value", ) + assert args[0] == request_msg def test_get_identity_aware_proxy_client_use_cached_wrapped_rpc(): @@ -3048,9 +3072,15 @@ async def test_get_identity_aware_proxy_client_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.GetIdentityAwareProxyClientRequest(), + {}, + ], +) async def test_get_identity_aware_proxy_client_async( - transport: str = "grpc_asyncio", - request_type=service.GetIdentityAwareProxyClientRequest, + request_type, transport: str = "grpc_asyncio" ): client = IdentityAwareProxyOAuthServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3059,7 +3089,7 @@ async def test_get_identity_aware_proxy_client_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( @@ -3088,11 +3118,6 @@ async def test_get_identity_aware_proxy_client_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_get_identity_aware_proxy_client_async_from_dict(): - await test_get_identity_aware_proxy_client_async(request_type=dict) - - def test_get_identity_aware_proxy_client_field_headers(): client = IdentityAwareProxyOAuthServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3161,8 +3186,8 @@ async def test_get_identity_aware_proxy_client_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.ResetIdentityAwareProxyClientSecretRequest, - dict, + service.ResetIdentityAwareProxyClientSecretRequest(), + {}, ], ) def test_reset_identity_aware_proxy_client_secret( @@ -3175,7 +3200,7 @@ def test_reset_identity_aware_proxy_client_secret( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3227,9 +3252,10 @@ def test_reset_identity_aware_proxy_client_secret_non_empty_request_with_auto_po client.reset_identity_aware_proxy_client_secret(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ResetIdentityAwareProxyClientSecretRequest( + request_msg = service.ResetIdentityAwareProxyClientSecretRequest( name="name_value", ) + assert args[0] == request_msg def test_reset_identity_aware_proxy_client_secret_use_cached_wrapped_rpc(): @@ -3315,9 +3341,15 @@ async def test_reset_identity_aware_proxy_client_secret_async_use_cached_wrapped @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.ResetIdentityAwareProxyClientSecretRequest(), + {}, + ], +) async def test_reset_identity_aware_proxy_client_secret_async( - transport: str = "grpc_asyncio", - request_type=service.ResetIdentityAwareProxyClientSecretRequest, + request_type, transport: str = "grpc_asyncio" ): client = IdentityAwareProxyOAuthServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3326,7 +3358,7 @@ async def test_reset_identity_aware_proxy_client_secret_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( @@ -3355,11 +3387,6 @@ async def test_reset_identity_aware_proxy_client_secret_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_reset_identity_aware_proxy_client_secret_async_from_dict(): - await test_reset_identity_aware_proxy_client_secret_async(request_type=dict) - - def test_reset_identity_aware_proxy_client_secret_field_headers(): client = IdentityAwareProxyOAuthServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3428,8 +3455,8 @@ async def test_reset_identity_aware_proxy_client_secret_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.DeleteIdentityAwareProxyClientRequest, - dict, + service.DeleteIdentityAwareProxyClientRequest(), + {}, ], ) def test_delete_identity_aware_proxy_client(request_type, transport: str = "grpc"): @@ -3440,7 +3467,7 @@ def test_delete_identity_aware_proxy_client(request_type, transport: str = "grpc # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3485,9 +3512,10 @@ def test_delete_identity_aware_proxy_client_non_empty_request_with_auto_populate client.delete_identity_aware_proxy_client(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteIdentityAwareProxyClientRequest( + request_msg = service.DeleteIdentityAwareProxyClientRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_identity_aware_proxy_client_use_cached_wrapped_rpc(): @@ -3573,9 +3601,15 @@ async def test_delete_identity_aware_proxy_client_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteIdentityAwareProxyClientRequest(), + {}, + ], +) async def test_delete_identity_aware_proxy_client_async( - transport: str = "grpc_asyncio", - request_type=service.DeleteIdentityAwareProxyClientRequest, + request_type, transport: str = "grpc_asyncio" ): client = IdentityAwareProxyOAuthServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3584,7 +3618,7 @@ async def test_delete_identity_aware_proxy_client_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( @@ -3604,11 +3638,6 @@ async def test_delete_identity_aware_proxy_client_async( assert response is None -@pytest.mark.asyncio -async def test_delete_identity_aware_proxy_client_async_from_dict(): - await test_delete_identity_aware_proxy_client_async(request_type=dict) - - def test_delete_identity_aware_proxy_client_field_headers(): client = IdentityAwareProxyOAuthServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4888,7 +4917,6 @@ def test_list_brands_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListBrandsRequest() - assert args[0] == request_msg @@ -4909,7 +4937,6 @@ def test_create_brand_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateBrandRequest() - assert args[0] == request_msg @@ -4930,7 +4957,6 @@ def test_get_brand_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetBrandRequest() - assert args[0] == request_msg @@ -4953,7 +4979,6 @@ def test_create_identity_aware_proxy_client_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateIdentityAwareProxyClientRequest() - assert args[0] == request_msg @@ -4976,7 +5001,6 @@ def test_list_identity_aware_proxy_clients_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListIdentityAwareProxyClientsRequest() - assert args[0] == request_msg @@ -4999,7 +5023,6 @@ def test_get_identity_aware_proxy_client_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetIdentityAwareProxyClientRequest() - assert args[0] == request_msg @@ -5022,7 +5045,6 @@ def test_reset_identity_aware_proxy_client_secret_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ResetIdentityAwareProxyClientSecretRequest() - assert args[0] == request_msg @@ -5045,7 +5067,6 @@ def test_delete_identity_aware_proxy_client_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteIdentityAwareProxyClientRequest() - assert args[0] == request_msg @@ -5084,7 +5105,6 @@ async def test_list_brands_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListBrandsRequest() - assert args[0] == request_msg @@ -5114,7 +5134,6 @@ async def test_create_brand_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateBrandRequest() - assert args[0] == request_msg @@ -5144,7 +5163,6 @@ async def test_get_brand_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetBrandRequest() - assert args[0] == request_msg @@ -5175,7 +5193,6 @@ async def test_create_identity_aware_proxy_client_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateIdentityAwareProxyClientRequest() - assert args[0] == request_msg @@ -5204,7 +5221,6 @@ async def test_list_identity_aware_proxy_clients_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListIdentityAwareProxyClientsRequest() - assert args[0] == request_msg @@ -5235,7 +5251,6 @@ async def test_get_identity_aware_proxy_client_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetIdentityAwareProxyClientRequest() - assert args[0] == request_msg @@ -5266,7 +5281,6 @@ async def test_reset_identity_aware_proxy_client_secret_empty_call_grpc_asyncio( call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ResetIdentityAwareProxyClientSecretRequest() - assert args[0] == request_msg @@ -5291,7 +5305,6 @@ async def test_delete_identity_aware_proxy_client_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteIdentityAwareProxyClientRequest() - assert args[0] == request_msg @@ -6545,7 +6558,6 @@ def test_list_brands_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListBrandsRequest() - assert args[0] == request_msg @@ -6565,7 +6577,6 @@ def test_create_brand_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateBrandRequest() - assert args[0] == request_msg @@ -6585,7 +6596,6 @@ def test_get_brand_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetBrandRequest() - assert args[0] == request_msg @@ -6607,7 +6617,6 @@ def test_create_identity_aware_proxy_client_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateIdentityAwareProxyClientRequest() - assert args[0] == request_msg @@ -6629,7 +6638,6 @@ def test_list_identity_aware_proxy_clients_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListIdentityAwareProxyClientsRequest() - assert args[0] == request_msg @@ -6651,7 +6659,6 @@ def test_get_identity_aware_proxy_client_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetIdentityAwareProxyClientRequest() - assert args[0] == request_msg @@ -6673,7 +6680,6 @@ def test_reset_identity_aware_proxy_client_secret_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ResetIdentityAwareProxyClientSecretRequest() - assert args[0] == request_msg @@ -6695,7 +6701,6 @@ def test_delete_identity_aware_proxy_client_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteIdentityAwareProxyClientRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-ids/noxfile.py b/packages/google-cloud-ids/noxfile.py index 5f9f1cc36e9d..039b77ebbb70 100644 --- a/packages/google-cloud-ids/noxfile.py +++ b/packages/google-cloud-ids/noxfile.py @@ -47,7 +47,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-ids" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-ids/setup.py b/packages/google-cloud-ids/setup.py index 995e0e086ad3..83d09ccc178f 100644 --- a/packages/google-cloud-ids/setup.py +++ b/packages/google-cloud-ids/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/google-cloud-ids/testing/constraints-3.10.txt b/packages/google-cloud-ids/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-ids/testing/constraints-3.10.txt +++ b/packages/google-cloud-ids/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-ids/tests/unit/gapic/ids_v1/test_ids.py b/packages/google-cloud-ids/tests/unit/gapic/ids_v1/test_ids.py index 3c9da4547634..cc65eb80b84a 100644 --- a/packages/google-cloud-ids/tests/unit/gapic/ids_v1/test_ids.py +++ b/packages/google-cloud-ids/tests/unit/gapic/ids_v1/test_ids.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 @@ -114,6 +115,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" @@ -1217,8 +1233,8 @@ def test_ids_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - ids.ListEndpointsRequest, - dict, + ids.ListEndpointsRequest(), + {}, ], ) def test_list_endpoints(request_type, transport: str = "grpc"): @@ -1229,7 +1245,7 @@ def test_list_endpoints(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_endpoints), "__call__") as call: @@ -1278,12 +1294,13 @@ def test_list_endpoints_non_empty_request_with_auto_populated_field(): client.list_endpoints(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == ids.ListEndpointsRequest( + request_msg = ids.ListEndpointsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_endpoints_use_cached_wrapped_rpc(): @@ -1364,9 +1381,14 @@ async def test_list_endpoints_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_endpoints_async( - transport: str = "grpc_asyncio", request_type=ids.ListEndpointsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + ids.ListEndpointsRequest(), + {}, + ], +) +async def test_list_endpoints_async(request_type, transport: str = "grpc_asyncio"): client = IDSAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1374,7 +1396,7 @@ async def test_list_endpoints_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_endpoints), "__call__") as call: @@ -1399,11 +1421,6 @@ async def test_list_endpoints_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_endpoints_async_from_dict(): - await test_list_endpoints_async(request_type=dict) - - def test_list_endpoints_field_headers(): client = IDSClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1740,8 +1757,8 @@ async def test_list_endpoints_async_pages(): @pytest.mark.parametrize( "request_type", [ - ids.GetEndpointRequest, - dict, + ids.GetEndpointRequest(), + {}, ], ) def test_get_endpoint(request_type, transport: str = "grpc"): @@ -1752,7 +1769,7 @@ def test_get_endpoint(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_endpoint), "__call__") as call: @@ -1810,9 +1827,10 @@ def test_get_endpoint_non_empty_request_with_auto_populated_field(): client.get_endpoint(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == ids.GetEndpointRequest( + request_msg = ids.GetEndpointRequest( name="name_value", ) + assert args[0] == request_msg def test_get_endpoint_use_cached_wrapped_rpc(): @@ -1893,9 +1911,14 @@ async def test_get_endpoint_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_endpoint_async( - transport: str = "grpc_asyncio", request_type=ids.GetEndpointRequest -): +@pytest.mark.parametrize( + "request_type", + [ + ids.GetEndpointRequest(), + {}, + ], +) +async def test_get_endpoint_async(request_type, transport: str = "grpc_asyncio"): client = IDSAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1903,7 +1926,7 @@ async def test_get_endpoint_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_endpoint), "__call__") as call: @@ -1940,11 +1963,6 @@ async def test_get_endpoint_async( assert response.traffic_logs is True -@pytest.mark.asyncio -async def test_get_endpoint_async_from_dict(): - await test_get_endpoint_async(request_type=dict) - - def test_get_endpoint_field_headers(): client = IDSClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2087,8 +2105,8 @@ async def test_get_endpoint_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - ids.CreateEndpointRequest, - dict, + ids.CreateEndpointRequest(), + {}, ], ) def test_create_endpoint(request_type, transport: str = "grpc"): @@ -2099,7 +2117,7 @@ def test_create_endpoint(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_endpoint), "__call__") as call: @@ -2142,11 +2160,12 @@ def test_create_endpoint_non_empty_request_with_auto_populated_field(): client.create_endpoint(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == ids.CreateEndpointRequest( + request_msg = ids.CreateEndpointRequest( parent="parent_value", endpoint_id="endpoint_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_endpoint_use_cached_wrapped_rpc(): @@ -2237,9 +2256,14 @@ async def test_create_endpoint_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_endpoint_async( - transport: str = "grpc_asyncio", request_type=ids.CreateEndpointRequest -): +@pytest.mark.parametrize( + "request_type", + [ + ids.CreateEndpointRequest(), + {}, + ], +) +async def test_create_endpoint_async(request_type, transport: str = "grpc_asyncio"): client = IDSAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2247,7 +2271,7 @@ async def test_create_endpoint_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_endpoint), "__call__") as call: @@ -2267,11 +2291,6 @@ async def test_create_endpoint_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_endpoint_async_from_dict(): - await test_create_endpoint_async(request_type=dict) - - def test_create_endpoint_field_headers(): client = IDSClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2438,8 +2457,8 @@ async def test_create_endpoint_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - ids.DeleteEndpointRequest, - dict, + ids.DeleteEndpointRequest(), + {}, ], ) def test_delete_endpoint(request_type, transport: str = "grpc"): @@ -2450,7 +2469,7 @@ def test_delete_endpoint(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_endpoint), "__call__") as call: @@ -2492,10 +2511,11 @@ def test_delete_endpoint_non_empty_request_with_auto_populated_field(): client.delete_endpoint(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == ids.DeleteEndpointRequest( + request_msg = ids.DeleteEndpointRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_endpoint_use_cached_wrapped_rpc(): @@ -2586,9 +2606,14 @@ async def test_delete_endpoint_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_endpoint_async( - transport: str = "grpc_asyncio", request_type=ids.DeleteEndpointRequest -): +@pytest.mark.parametrize( + "request_type", + [ + ids.DeleteEndpointRequest(), + {}, + ], +) +async def test_delete_endpoint_async(request_type, transport: str = "grpc_asyncio"): client = IDSAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2596,7 +2621,7 @@ async def test_delete_endpoint_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_endpoint), "__call__") as call: @@ -2616,11 +2641,6 @@ async def test_delete_endpoint_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_endpoint_async_from_dict(): - await test_delete_endpoint_async(request_type=dict) - - def test_delete_endpoint_field_headers(): client = IDSClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3710,7 +3730,6 @@ def test_list_endpoints_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ids.ListEndpointsRequest() - assert args[0] == request_msg @@ -3731,7 +3750,6 @@ def test_get_endpoint_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ids.GetEndpointRequest() - assert args[0] == request_msg @@ -3752,7 +3770,6 @@ def test_create_endpoint_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ids.CreateEndpointRequest() - assert args[0] == request_msg @@ -3773,7 +3790,6 @@ def test_delete_endpoint_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ids.DeleteEndpointRequest() - assert args[0] == request_msg @@ -3815,7 +3831,6 @@ async def test_list_endpoints_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ids.ListEndpointsRequest() - assert args[0] == request_msg @@ -3849,7 +3864,6 @@ async def test_get_endpoint_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ids.GetEndpointRequest() - assert args[0] == request_msg @@ -3874,7 +3888,6 @@ async def test_create_endpoint_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ids.CreateEndpointRequest() - assert args[0] == request_msg @@ -3899,7 +3912,6 @@ async def test_delete_endpoint_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ids.DeleteEndpointRequest() - assert args[0] == request_msg @@ -4503,7 +4515,6 @@ def test_list_endpoints_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ids.ListEndpointsRequest() - assert args[0] == request_msg @@ -4523,7 +4534,6 @@ def test_get_endpoint_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ids.GetEndpointRequest() - assert args[0] == request_msg @@ -4543,7 +4553,6 @@ def test_create_endpoint_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ids.CreateEndpointRequest() - assert args[0] == request_msg @@ -4563,7 +4572,6 @@ def test_delete_endpoint_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ids.DeleteEndpointRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-kms-inventory/noxfile.py b/packages/google-cloud-kms-inventory/noxfile.py index b346221c8982..beb750ab1711 100644 --- a/packages/google-cloud-kms-inventory/noxfile.py +++ b/packages/google-cloud-kms-inventory/noxfile.py @@ -47,7 +47,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-kms-inventory" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-kms-inventory/setup.py b/packages/google-cloud-kms-inventory/setup.py index 36b206382cbc..8ee40e58be3d 100644 --- a/packages/google-cloud-kms-inventory/setup.py +++ b/packages/google-cloud-kms-inventory/setup.py @@ -45,7 +45,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/google-cloud-kms-inventory/testing/constraints-3.10.txt b/packages/google-cloud-kms-inventory/testing/constraints-3.10.txt index ca7bb34a9fde..c7005b0b2be5 100644 --- a/packages/google-cloud-kms-inventory/testing/constraints-3.10.txt +++ b/packages/google-cloud-kms-inventory/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-kms==2.13.0 diff --git a/packages/google-cloud-kms-inventory/tests/unit/gapic/kms_inventory_v1/test_key_dashboard_service.py b/packages/google-cloud-kms-inventory/tests/unit/gapic/kms_inventory_v1/test_key_dashboard_service.py index 76d0e0551ced..5ccb6b2397b0 100644 --- a/packages/google-cloud-kms-inventory/tests/unit/gapic/kms_inventory_v1/test_key_dashboard_service.py +++ b/packages/google-cloud-kms-inventory/tests/unit/gapic/kms_inventory_v1/test_key_dashboard_service.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 @@ -108,6 +109,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" @@ -1371,8 +1387,8 @@ def test_key_dashboard_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - key_dashboard_service.ListCryptoKeysRequest, - dict, + key_dashboard_service.ListCryptoKeysRequest(), + {}, ], ) def test_list_crypto_keys(request_type, transport: str = "grpc"): @@ -1383,7 +1399,7 @@ def test_list_crypto_keys(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_crypto_keys), "__call__") as call: @@ -1428,10 +1444,11 @@ def test_list_crypto_keys_non_empty_request_with_auto_populated_field(): client.list_crypto_keys(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == key_dashboard_service.ListCryptoKeysRequest( + request_msg = key_dashboard_service.ListCryptoKeysRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_crypto_keys_use_cached_wrapped_rpc(): @@ -1514,10 +1531,14 @@ async def test_list_crypto_keys_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_crypto_keys_async( - transport: str = "grpc_asyncio", - request_type=key_dashboard_service.ListCryptoKeysRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + key_dashboard_service.ListCryptoKeysRequest(), + {}, + ], +) +async def test_list_crypto_keys_async(request_type, transport: str = "grpc_asyncio"): client = KeyDashboardServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1525,7 +1546,7 @@ async def test_list_crypto_keys_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_crypto_keys), "__call__") as call: @@ -1548,11 +1569,6 @@ async def test_list_crypto_keys_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_crypto_keys_async_from_dict(): - await test_list_crypto_keys_async(request_type=dict) - - def test_list_crypto_keys_field_headers(): client = KeyDashboardServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2265,7 +2281,6 @@ def test_list_crypto_keys_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = key_dashboard_service.ListCryptoKeysRequest() - assert args[0] == request_msg @@ -2306,7 +2321,6 @@ async def test_list_crypto_keys_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = key_dashboard_service.ListCryptoKeysRequest() - assert args[0] == request_msg @@ -2476,7 +2490,6 @@ def test_list_crypto_keys_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = key_dashboard_service.ListCryptoKeysRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-kms-inventory/tests/unit/gapic/kms_inventory_v1/test_key_tracking_service.py b/packages/google-cloud-kms-inventory/tests/unit/gapic/kms_inventory_v1/test_key_tracking_service.py index 4581d9e172a2..1414b70e45a7 100644 --- a/packages/google-cloud-kms-inventory/tests/unit/gapic/kms_inventory_v1/test_key_tracking_service.py +++ b/packages/google-cloud-kms-inventory/tests/unit/gapic/kms_inventory_v1/test_key_tracking_service.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 @@ -107,6 +108,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" @@ -1352,8 +1368,8 @@ def test_key_tracking_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - key_tracking_service.GetProtectedResourcesSummaryRequest, - dict, + key_tracking_service.GetProtectedResourcesSummaryRequest(), + {}, ], ) def test_get_protected_resources_summary(request_type, transport: str = "grpc"): @@ -1364,7 +1380,7 @@ def test_get_protected_resources_summary(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1416,9 +1432,10 @@ def test_get_protected_resources_summary_non_empty_request_with_auto_populated_f client.get_protected_resources_summary(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == key_tracking_service.GetProtectedResourcesSummaryRequest( + request_msg = key_tracking_service.GetProtectedResourcesSummaryRequest( name="name_value", ) + assert args[0] == request_msg def test_get_protected_resources_summary_use_cached_wrapped_rpc(): @@ -1504,9 +1521,15 @@ async def test_get_protected_resources_summary_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + key_tracking_service.GetProtectedResourcesSummaryRequest(), + {}, + ], +) async def test_get_protected_resources_summary_async( - transport: str = "grpc_asyncio", - request_type=key_tracking_service.GetProtectedResourcesSummaryRequest, + request_type, transport: str = "grpc_asyncio" ): client = KeyTrackingServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1515,7 +1538,7 @@ async def test_get_protected_resources_summary_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( @@ -1544,11 +1567,6 @@ async def test_get_protected_resources_summary_async( assert response.project_count == 1407 -@pytest.mark.asyncio -async def test_get_protected_resources_summary_async_from_dict(): - await test_get_protected_resources_summary_async(request_type=dict) - - def test_get_protected_resources_summary_field_headers(): client = KeyTrackingServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1703,8 +1721,8 @@ async def test_get_protected_resources_summary_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - key_tracking_service.SearchProtectedResourcesRequest, - dict, + key_tracking_service.SearchProtectedResourcesRequest(), + {}, ], ) def test_search_protected_resources(request_type, transport: str = "grpc"): @@ -1715,7 +1733,7 @@ def test_search_protected_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( @@ -1765,11 +1783,12 @@ def test_search_protected_resources_non_empty_request_with_auto_populated_field( client.search_protected_resources(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == key_tracking_service.SearchProtectedResourcesRequest( + request_msg = key_tracking_service.SearchProtectedResourcesRequest( scope="scope_value", crypto_key="crypto_key_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_search_protected_resources_use_cached_wrapped_rpc(): @@ -1855,9 +1874,15 @@ async def test_search_protected_resources_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + key_tracking_service.SearchProtectedResourcesRequest(), + {}, + ], +) async def test_search_protected_resources_async( - transport: str = "grpc_asyncio", - request_type=key_tracking_service.SearchProtectedResourcesRequest, + request_type, transport: str = "grpc_asyncio" ): client = KeyTrackingServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1866,7 +1891,7 @@ async def test_search_protected_resources_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( @@ -1891,11 +1916,6 @@ async def test_search_protected_resources_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_search_protected_resources_async_from_dict(): - await test_search_protected_resources_async(request_type=dict) - - def test_search_protected_resources_field_headers(): client = KeyTrackingServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2869,7 +2889,6 @@ def test_get_protected_resources_summary_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = key_tracking_service.GetProtectedResourcesSummaryRequest() - assert args[0] == request_msg @@ -2892,7 +2911,6 @@ def test_search_protected_resources_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = key_tracking_service.SearchProtectedResourcesRequest() - assert args[0] == request_msg @@ -2937,7 +2955,6 @@ async def test_get_protected_resources_summary_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = key_tracking_service.GetProtectedResourcesSummaryRequest() - assert args[0] == request_msg @@ -2966,7 +2983,6 @@ async def test_search_protected_resources_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = key_tracking_service.SearchProtectedResourcesRequest() - assert args[0] == request_msg @@ -3288,7 +3304,6 @@ def test_get_protected_resources_summary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = key_tracking_service.GetProtectedResourcesSummaryRequest() - assert args[0] == request_msg @@ -3310,7 +3325,6 @@ def test_search_protected_resources_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = key_tracking_service.SearchProtectedResourcesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-kms/noxfile.py b/packages/google-cloud-kms/noxfile.py index fa78e4a69612..0468f42a5bc4 100644 --- a/packages/google-cloud-kms/noxfile.py +++ b/packages/google-cloud-kms/noxfile.py @@ -47,7 +47,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-kms" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-kms/setup.py b/packages/google-cloud-kms/setup.py index 1fd6b5c41053..91013ea6d3b3 100644 --- a/packages/google-cloud-kms/setup.py +++ b/packages/google-cloud-kms/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/google-cloud-kms/testing/constraints-3.10.txt b/packages/google-cloud-kms/testing/constraints-3.10.txt index a92801e1c8e2..b39cd54634f9 100644 --- a/packages/google-cloud-kms/testing/constraints-3.10.txt +++ b/packages/google-cloud-kms/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/google-cloud-kms/tests/unit/gapic/kms_v1/test_autokey.py b/packages/google-cloud-kms/tests/unit/gapic/kms_v1/test_autokey.py index 04ff8e8f871f..915a54d6646c 100644 --- a/packages/google-cloud-kms/tests/unit/gapic/kms_v1/test_autokey.py +++ b/packages/google-cloud-kms/tests/unit/gapic/kms_v1/test_autokey.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 @@ -118,6 +119,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" @@ -1254,8 +1270,8 @@ def test_autokey_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - autokey.CreateKeyHandleRequest, - dict, + autokey.CreateKeyHandleRequest(), + {}, ], ) def test_create_key_handle(request_type, transport: str = "grpc"): @@ -1266,7 +1282,7 @@ def test_create_key_handle(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1312,10 +1328,11 @@ def test_create_key_handle_non_empty_request_with_auto_populated_field(): client.create_key_handle(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == autokey.CreateKeyHandleRequest( + request_msg = autokey.CreateKeyHandleRequest( parent="parent_value", key_handle_id="key_handle_id_value", ) + assert args[0] == request_msg def test_create_key_handle_use_cached_wrapped_rpc(): @@ -1408,9 +1425,14 @@ async def test_create_key_handle_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_key_handle_async( - transport: str = "grpc_asyncio", request_type=autokey.CreateKeyHandleRequest -): +@pytest.mark.parametrize( + "request_type", + [ + autokey.CreateKeyHandleRequest(), + {}, + ], +) +async def test_create_key_handle_async(request_type, transport: str = "grpc_asyncio"): client = AutokeyAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1418,7 +1440,7 @@ async def test_create_key_handle_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( @@ -1440,11 +1462,6 @@ async def test_create_key_handle_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_key_handle_async_from_dict(): - await test_create_key_handle_async(request_type=dict) - - def test_create_key_handle_field_headers(): client = AutokeyClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1619,8 +1636,8 @@ async def test_create_key_handle_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - autokey.GetKeyHandleRequest, - dict, + autokey.GetKeyHandleRequest(), + {}, ], ) def test_get_key_handle(request_type, transport: str = "grpc"): @@ -1631,7 +1648,7 @@ def test_get_key_handle(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_key_handle), "__call__") as call: @@ -1679,9 +1696,10 @@ def test_get_key_handle_non_empty_request_with_auto_populated_field(): client.get_key_handle(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == autokey.GetKeyHandleRequest( + request_msg = autokey.GetKeyHandleRequest( name="name_value", ) + assert args[0] == request_msg def test_get_key_handle_use_cached_wrapped_rpc(): @@ -1762,9 +1780,14 @@ async def test_get_key_handle_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_key_handle_async( - transport: str = "grpc_asyncio", request_type=autokey.GetKeyHandleRequest -): +@pytest.mark.parametrize( + "request_type", + [ + autokey.GetKeyHandleRequest(), + {}, + ], +) +async def test_get_key_handle_async(request_type, transport: str = "grpc_asyncio"): client = AutokeyAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1772,7 +1795,7 @@ async def test_get_key_handle_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_key_handle), "__call__") as call: @@ -1799,11 +1822,6 @@ async def test_get_key_handle_async( assert response.resource_type_selector == "resource_type_selector_value" -@pytest.mark.asyncio -async def test_get_key_handle_async_from_dict(): - await test_get_key_handle_async(request_type=dict) - - def test_get_key_handle_field_headers(): client = AutokeyClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1946,8 +1964,8 @@ async def test_get_key_handle_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - autokey.ListKeyHandlesRequest, - dict, + autokey.ListKeyHandlesRequest(), + {}, ], ) def test_list_key_handles(request_type, transport: str = "grpc"): @@ -1958,7 +1976,7 @@ def test_list_key_handles(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_key_handles), "__call__") as call: @@ -2004,11 +2022,12 @@ def test_list_key_handles_non_empty_request_with_auto_populated_field(): client.list_key_handles(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == autokey.ListKeyHandlesRequest( + request_msg = autokey.ListKeyHandlesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_key_handles_use_cached_wrapped_rpc(): @@ -2091,9 +2110,14 @@ async def test_list_key_handles_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_key_handles_async( - transport: str = "grpc_asyncio", request_type=autokey.ListKeyHandlesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + autokey.ListKeyHandlesRequest(), + {}, + ], +) +async def test_list_key_handles_async(request_type, transport: str = "grpc_asyncio"): client = AutokeyAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2101,7 +2125,7 @@ async def test_list_key_handles_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_key_handles), "__call__") as call: @@ -2124,11 +2148,6 @@ async def test_list_key_handles_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_key_handles_async_from_dict(): - await test_list_key_handles_async(request_type=dict) - - def test_list_key_handles_field_headers(): client = AutokeyClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3214,7 +3233,6 @@ def test_create_key_handle_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = autokey.CreateKeyHandleRequest() - assert args[0] == request_msg @@ -3235,7 +3253,6 @@ def test_get_key_handle_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = autokey.GetKeyHandleRequest() - assert args[0] == request_msg @@ -3256,7 +3273,6 @@ def test_list_key_handles_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = autokey.ListKeyHandlesRequest() - assert args[0] == request_msg @@ -3297,7 +3313,6 @@ async def test_create_key_handle_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = autokey.CreateKeyHandleRequest() - assert args[0] == request_msg @@ -3326,7 +3341,6 @@ async def test_get_key_handle_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = autokey.GetKeyHandleRequest() - assert args[0] == request_msg @@ -3353,7 +3367,6 @@ async def test_list_key_handles_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = autokey.ListKeyHandlesRequest() - assert args[0] == request_msg @@ -4210,7 +4223,6 @@ def test_create_key_handle_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = autokey.CreateKeyHandleRequest() - assert args[0] == request_msg @@ -4230,7 +4242,6 @@ def test_get_key_handle_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = autokey.GetKeyHandleRequest() - assert args[0] == request_msg @@ -4250,7 +4261,6 @@ def test_list_key_handles_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = autokey.ListKeyHandlesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-kms/tests/unit/gapic/kms_v1/test_autokey_admin.py b/packages/google-cloud-kms/tests/unit/gapic/kms_v1/test_autokey_admin.py index 1e0c00c2467b..60682de46309 100644 --- a/packages/google-cloud-kms/tests/unit/gapic/kms_v1/test_autokey_admin.py +++ b/packages/google-cloud-kms/tests/unit/gapic/kms_v1/test_autokey_admin.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 @@ -114,6 +115,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" @@ -1297,8 +1313,8 @@ def test_autokey_admin_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - autokey_admin.UpdateAutokeyConfigRequest, - dict, + autokey_admin.UpdateAutokeyConfigRequest(), + {}, ], ) def test_update_autokey_config(request_type, transport: str = "grpc"): @@ -1309,7 +1325,7 @@ def test_update_autokey_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( @@ -1366,7 +1382,8 @@ def test_update_autokey_config_non_empty_request_with_auto_populated_field(): client.update_autokey_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == autokey_admin.UpdateAutokeyConfigRequest() + request_msg = autokey_admin.UpdateAutokeyConfigRequest() + assert args[0] == request_msg def test_update_autokey_config_use_cached_wrapped_rpc(): @@ -1452,9 +1469,15 @@ async def test_update_autokey_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + autokey_admin.UpdateAutokeyConfigRequest(), + {}, + ], +) async def test_update_autokey_config_async( - transport: str = "grpc_asyncio", - request_type=autokey_admin.UpdateAutokeyConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = AutokeyAdminAsyncClient( credentials=async_anonymous_credentials(), @@ -1463,7 +1486,7 @@ async def test_update_autokey_config_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( @@ -1499,11 +1522,6 @@ async def test_update_autokey_config_async( ) -@pytest.mark.asyncio -async def test_update_autokey_config_async_from_dict(): - await test_update_autokey_config_async(request_type=dict) - - def test_update_autokey_config_field_headers(): client = AutokeyAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1668,8 +1686,8 @@ async def test_update_autokey_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - autokey_admin.GetAutokeyConfigRequest, - dict, + autokey_admin.GetAutokeyConfigRequest(), + {}, ], ) def test_get_autokey_config(request_type, transport: str = "grpc"): @@ -1680,7 +1698,7 @@ def test_get_autokey_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( @@ -1739,9 +1757,10 @@ def test_get_autokey_config_non_empty_request_with_auto_populated_field(): client.get_autokey_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == autokey_admin.GetAutokeyConfigRequest( + request_msg = autokey_admin.GetAutokeyConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_autokey_config_use_cached_wrapped_rpc(): @@ -1826,9 +1845,14 @@ async def test_get_autokey_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_autokey_config_async( - transport: str = "grpc_asyncio", request_type=autokey_admin.GetAutokeyConfigRequest -): +@pytest.mark.parametrize( + "request_type", + [ + autokey_admin.GetAutokeyConfigRequest(), + {}, + ], +) +async def test_get_autokey_config_async(request_type, transport: str = "grpc_asyncio"): client = AutokeyAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1836,7 +1860,7 @@ async def test_get_autokey_config_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( @@ -1872,11 +1896,6 @@ async def test_get_autokey_config_async( ) -@pytest.mark.asyncio -async def test_get_autokey_config_async_from_dict(): - await test_get_autokey_config_async(request_type=dict) - - def test_get_autokey_config_field_headers(): client = AutokeyAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2031,8 +2050,8 @@ async def test_get_autokey_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - autokey_admin.ShowEffectiveAutokeyConfigRequest, - dict, + autokey_admin.ShowEffectiveAutokeyConfigRequest(), + {}, ], ) def test_show_effective_autokey_config(request_type, transport: str = "grpc"): @@ -2043,7 +2062,7 @@ def test_show_effective_autokey_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( @@ -2091,9 +2110,10 @@ def test_show_effective_autokey_config_non_empty_request_with_auto_populated_fie client.show_effective_autokey_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == autokey_admin.ShowEffectiveAutokeyConfigRequest( + request_msg = autokey_admin.ShowEffectiveAutokeyConfigRequest( parent="parent_value", ) + assert args[0] == request_msg def test_show_effective_autokey_config_use_cached_wrapped_rpc(): @@ -2179,9 +2199,15 @@ async def test_show_effective_autokey_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + autokey_admin.ShowEffectiveAutokeyConfigRequest(), + {}, + ], +) async def test_show_effective_autokey_config_async( - transport: str = "grpc_asyncio", - request_type=autokey_admin.ShowEffectiveAutokeyConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = AutokeyAdminAsyncClient( credentials=async_anonymous_credentials(), @@ -2190,7 +2216,7 @@ async def test_show_effective_autokey_config_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( @@ -2215,11 +2241,6 @@ async def test_show_effective_autokey_config_async( assert response.key_project == "key_project_value" -@pytest.mark.asyncio -async def test_show_effective_autokey_config_async_from_dict(): - await test_show_effective_autokey_config_async(request_type=dict) - - def test_show_effective_autokey_config_field_headers(): client = AutokeyAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3054,7 +3075,6 @@ def test_update_autokey_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = autokey_admin.UpdateAutokeyConfigRequest() - assert args[0] == request_msg @@ -3077,7 +3097,6 @@ def test_get_autokey_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = autokey_admin.GetAutokeyConfigRequest() - assert args[0] == request_msg @@ -3100,7 +3119,6 @@ def test_show_effective_autokey_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = autokey_admin.ShowEffectiveAutokeyConfigRequest() - assert args[0] == request_msg @@ -3147,7 +3165,6 @@ async def test_update_autokey_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = autokey_admin.UpdateAutokeyConfigRequest() - assert args[0] == request_msg @@ -3180,7 +3197,6 @@ async def test_get_autokey_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = autokey_admin.GetAutokeyConfigRequest() - assert args[0] == request_msg @@ -3209,7 +3225,6 @@ async def test_show_effective_autokey_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = autokey_admin.ShowEffectiveAutokeyConfigRequest() - assert args[0] == request_msg @@ -4117,7 +4132,6 @@ def test_update_autokey_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = autokey_admin.UpdateAutokeyConfigRequest() - assert args[0] == request_msg @@ -4139,7 +4153,6 @@ def test_get_autokey_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = autokey_admin.GetAutokeyConfigRequest() - assert args[0] == request_msg @@ -4161,7 +4174,6 @@ def test_show_effective_autokey_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = autokey_admin.ShowEffectiveAutokeyConfigRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-kms/tests/unit/gapic/kms_v1/test_ekm_service.py b/packages/google-cloud-kms/tests/unit/gapic/kms_v1/test_ekm_service.py index 3281066f5d6e..ed31668490a4 100644 --- a/packages/google-cloud-kms/tests/unit/gapic/kms_v1/test_ekm_service.py +++ b/packages/google-cloud-kms/tests/unit/gapic/kms_v1/test_ekm_service.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 @@ -116,6 +117,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" @@ -1280,8 +1296,8 @@ def test_ekm_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - ekm_service.ListEkmConnectionsRequest, - dict, + ekm_service.ListEkmConnectionsRequest(), + {}, ], ) def test_list_ekm_connections(request_type, transport: str = "grpc"): @@ -1292,7 +1308,7 @@ def test_list_ekm_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( @@ -1345,12 +1361,13 @@ def test_list_ekm_connections_non_empty_request_with_auto_populated_field(): client.list_ekm_connections(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == ekm_service.ListEkmConnectionsRequest( + request_msg = ekm_service.ListEkmConnectionsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_ekm_connections_use_cached_wrapped_rpc(): @@ -1435,8 +1452,15 @@ async def test_list_ekm_connections_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + ekm_service.ListEkmConnectionsRequest(), + {}, + ], +) async def test_list_ekm_connections_async( - transport: str = "grpc_asyncio", request_type=ekm_service.ListEkmConnectionsRequest + request_type, transport: str = "grpc_asyncio" ): client = EkmServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1445,7 +1469,7 @@ async def test_list_ekm_connections_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( @@ -1472,11 +1496,6 @@ async def test_list_ekm_connections_async( assert response.total_size == 1086 -@pytest.mark.asyncio -async def test_list_ekm_connections_async_from_dict(): - await test_list_ekm_connections_async(request_type=dict) - - def test_list_ekm_connections_field_headers(): client = EkmServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1829,8 +1848,8 @@ async def test_list_ekm_connections_async_pages(): @pytest.mark.parametrize( "request_type", [ - ekm_service.GetEkmConnectionRequest, - dict, + ekm_service.GetEkmConnectionRequest(), + {}, ], ) def test_get_ekm_connection(request_type, transport: str = "grpc"): @@ -1841,7 +1860,7 @@ def test_get_ekm_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( @@ -1898,9 +1917,10 @@ def test_get_ekm_connection_non_empty_request_with_auto_populated_field(): client.get_ekm_connection(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == ekm_service.GetEkmConnectionRequest( + request_msg = ekm_service.GetEkmConnectionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_ekm_connection_use_cached_wrapped_rpc(): @@ -1985,9 +2005,14 @@ async def test_get_ekm_connection_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_ekm_connection_async( - transport: str = "grpc_asyncio", request_type=ekm_service.GetEkmConnectionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + ekm_service.GetEkmConnectionRequest(), + {}, + ], +) +async def test_get_ekm_connection_async(request_type, transport: str = "grpc_asyncio"): client = EkmServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1995,7 +2020,7 @@ async def test_get_ekm_connection_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( @@ -2029,11 +2054,6 @@ async def test_get_ekm_connection_async( assert response.crypto_space_path == "crypto_space_path_value" -@pytest.mark.asyncio -async def test_get_ekm_connection_async_from_dict(): - await test_get_ekm_connection_async(request_type=dict) - - def test_get_ekm_connection_field_headers(): client = EkmServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2188,8 +2208,8 @@ async def test_get_ekm_connection_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - ekm_service.CreateEkmConnectionRequest, - dict, + ekm_service.CreateEkmConnectionRequest(), + {}, ], ) def test_create_ekm_connection(request_type, transport: str = "grpc"): @@ -2200,7 +2220,7 @@ def test_create_ekm_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( @@ -2258,10 +2278,11 @@ def test_create_ekm_connection_non_empty_request_with_auto_populated_field(): client.create_ekm_connection(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == ekm_service.CreateEkmConnectionRequest( + request_msg = ekm_service.CreateEkmConnectionRequest( parent="parent_value", ekm_connection_id="ekm_connection_id_value", ) + assert args[0] == request_msg def test_create_ekm_connection_use_cached_wrapped_rpc(): @@ -2347,8 +2368,15 @@ async def test_create_ekm_connection_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + ekm_service.CreateEkmConnectionRequest(), + {}, + ], +) async def test_create_ekm_connection_async( - transport: str = "grpc_asyncio", request_type=ekm_service.CreateEkmConnectionRequest + request_type, transport: str = "grpc_asyncio" ): client = EkmServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2357,7 +2385,7 @@ async def test_create_ekm_connection_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( @@ -2391,11 +2419,6 @@ async def test_create_ekm_connection_async( assert response.crypto_space_path == "crypto_space_path_value" -@pytest.mark.asyncio -async def test_create_ekm_connection_async_from_dict(): - await test_create_ekm_connection_async(request_type=dict) - - def test_create_ekm_connection_field_headers(): client = EkmServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2570,8 +2593,8 @@ async def test_create_ekm_connection_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - ekm_service.UpdateEkmConnectionRequest, - dict, + ekm_service.UpdateEkmConnectionRequest(), + {}, ], ) def test_update_ekm_connection(request_type, transport: str = "grpc"): @@ -2582,7 +2605,7 @@ def test_update_ekm_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( @@ -2637,7 +2660,8 @@ def test_update_ekm_connection_non_empty_request_with_auto_populated_field(): client.update_ekm_connection(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == ekm_service.UpdateEkmConnectionRequest() + request_msg = ekm_service.UpdateEkmConnectionRequest() + assert args[0] == request_msg def test_update_ekm_connection_use_cached_wrapped_rpc(): @@ -2723,8 +2747,15 @@ async def test_update_ekm_connection_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + ekm_service.UpdateEkmConnectionRequest(), + {}, + ], +) async def test_update_ekm_connection_async( - transport: str = "grpc_asyncio", request_type=ekm_service.UpdateEkmConnectionRequest + request_type, transport: str = "grpc_asyncio" ): client = EkmServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2733,7 +2764,7 @@ async def test_update_ekm_connection_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( @@ -2767,11 +2798,6 @@ async def test_update_ekm_connection_async( assert response.crypto_space_path == "crypto_space_path_value" -@pytest.mark.asyncio -async def test_update_ekm_connection_async_from_dict(): - await test_update_ekm_connection_async(request_type=dict) - - def test_update_ekm_connection_field_headers(): client = EkmServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2936,8 +2962,8 @@ async def test_update_ekm_connection_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - ekm_service.GetEkmConfigRequest, - dict, + ekm_service.GetEkmConfigRequest(), + {}, ], ) def test_get_ekm_config(request_type, transport: str = "grpc"): @@ -2948,7 +2974,7 @@ def test_get_ekm_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(type(client.transport.get_ekm_config), "__call__") as call: @@ -2994,9 +3020,10 @@ def test_get_ekm_config_non_empty_request_with_auto_populated_field(): client.get_ekm_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == ekm_service.GetEkmConfigRequest( + request_msg = ekm_service.GetEkmConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_ekm_config_use_cached_wrapped_rpc(): @@ -3077,9 +3104,14 @@ async def test_get_ekm_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_ekm_config_async( - transport: str = "grpc_asyncio", request_type=ekm_service.GetEkmConfigRequest -): +@pytest.mark.parametrize( + "request_type", + [ + ekm_service.GetEkmConfigRequest(), + {}, + ], +) +async def test_get_ekm_config_async(request_type, transport: str = "grpc_asyncio"): client = EkmServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3087,7 +3119,7 @@ async def test_get_ekm_config_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_ekm_config), "__call__") as call: @@ -3112,11 +3144,6 @@ async def test_get_ekm_config_async( assert response.default_ekm_connection == "default_ekm_connection_value" -@pytest.mark.asyncio -async def test_get_ekm_config_async_from_dict(): - await test_get_ekm_config_async(request_type=dict) - - def test_get_ekm_config_field_headers(): client = EkmServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3263,8 +3290,8 @@ async def test_get_ekm_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - ekm_service.UpdateEkmConfigRequest, - dict, + ekm_service.UpdateEkmConfigRequest(), + {}, ], ) def test_update_ekm_config(request_type, transport: str = "grpc"): @@ -3275,7 +3302,7 @@ def test_update_ekm_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( @@ -3323,7 +3350,8 @@ def test_update_ekm_config_non_empty_request_with_auto_populated_field(): client.update_ekm_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == ekm_service.UpdateEkmConfigRequest() + request_msg = ekm_service.UpdateEkmConfigRequest() + assert args[0] == request_msg def test_update_ekm_config_use_cached_wrapped_rpc(): @@ -3406,9 +3434,14 @@ async def test_update_ekm_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_ekm_config_async( - transport: str = "grpc_asyncio", request_type=ekm_service.UpdateEkmConfigRequest -): +@pytest.mark.parametrize( + "request_type", + [ + ekm_service.UpdateEkmConfigRequest(), + {}, + ], +) +async def test_update_ekm_config_async(request_type, transport: str = "grpc_asyncio"): client = EkmServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3416,7 +3449,7 @@ async def test_update_ekm_config_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( @@ -3443,11 +3476,6 @@ async def test_update_ekm_config_async( assert response.default_ekm_connection == "default_ekm_connection_value" -@pytest.mark.asyncio -async def test_update_ekm_config_async_from_dict(): - await test_update_ekm_config_async(request_type=dict) - - def test_update_ekm_config_field_headers(): client = EkmServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3612,8 +3640,8 @@ async def test_update_ekm_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - ekm_service.VerifyConnectivityRequest, - dict, + ekm_service.VerifyConnectivityRequest(), + {}, ], ) def test_verify_connectivity(request_type, transport: str = "grpc"): @@ -3624,7 +3652,7 @@ def test_verify_connectivity(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3669,9 +3697,10 @@ def test_verify_connectivity_non_empty_request_with_auto_populated_field(): client.verify_connectivity(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == ekm_service.VerifyConnectivityRequest( + request_msg = ekm_service.VerifyConnectivityRequest( name="name_value", ) + assert args[0] == request_msg def test_verify_connectivity_use_cached_wrapped_rpc(): @@ -3756,9 +3785,14 @@ async def test_verify_connectivity_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_verify_connectivity_async( - transport: str = "grpc_asyncio", request_type=ekm_service.VerifyConnectivityRequest -): +@pytest.mark.parametrize( + "request_type", + [ + ekm_service.VerifyConnectivityRequest(), + {}, + ], +) +async def test_verify_connectivity_async(request_type, transport: str = "grpc_asyncio"): client = EkmServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3766,7 +3800,7 @@ async def test_verify_connectivity_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( @@ -3788,11 +3822,6 @@ async def test_verify_connectivity_async( assert isinstance(response, ekm_service.VerifyConnectivityResponse) -@pytest.mark.asyncio -async def test_verify_connectivity_async_from_dict(): - await test_verify_connectivity_async(request_type=dict) - - def test_verify_connectivity_field_headers(): client = EkmServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5475,7 +5504,6 @@ def test_list_ekm_connections_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ekm_service.ListEkmConnectionsRequest() - assert args[0] == request_msg @@ -5498,7 +5526,6 @@ def test_get_ekm_connection_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ekm_service.GetEkmConnectionRequest() - assert args[0] == request_msg @@ -5521,7 +5548,6 @@ def test_create_ekm_connection_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ekm_service.CreateEkmConnectionRequest() - assert args[0] == request_msg @@ -5544,7 +5570,6 @@ def test_update_ekm_connection_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ekm_service.UpdateEkmConnectionRequest() - assert args[0] == request_msg @@ -5565,7 +5590,6 @@ def test_get_ekm_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ekm_service.GetEkmConfigRequest() - assert args[0] == request_msg @@ -5588,7 +5612,6 @@ def test_update_ekm_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ekm_service.UpdateEkmConfigRequest() - assert args[0] == request_msg @@ -5611,7 +5634,6 @@ def test_verify_connectivity_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ekm_service.VerifyConnectivityRequest() - assert args[0] == request_msg @@ -5655,7 +5677,6 @@ async def test_list_ekm_connections_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ekm_service.ListEkmConnectionsRequest() - assert args[0] == request_msg @@ -5687,7 +5708,6 @@ async def test_get_ekm_connection_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ekm_service.GetEkmConnectionRequest() - assert args[0] == request_msg @@ -5719,7 +5739,6 @@ async def test_create_ekm_connection_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ekm_service.CreateEkmConnectionRequest() - assert args[0] == request_msg @@ -5751,7 +5770,6 @@ async def test_update_ekm_connection_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ekm_service.UpdateEkmConnectionRequest() - assert args[0] == request_msg @@ -5779,7 +5797,6 @@ async def test_get_ekm_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ekm_service.GetEkmConfigRequest() - assert args[0] == request_msg @@ -5809,7 +5826,6 @@ async def test_update_ekm_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ekm_service.UpdateEkmConfigRequest() - assert args[0] == request_msg @@ -5836,7 +5852,6 @@ async def test_verify_connectivity_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ekm_service.VerifyConnectivityRequest() - assert args[0] == request_msg @@ -7476,7 +7491,6 @@ def test_list_ekm_connections_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ekm_service.ListEkmConnectionsRequest() - assert args[0] == request_msg @@ -7498,7 +7512,6 @@ def test_get_ekm_connection_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ekm_service.GetEkmConnectionRequest() - assert args[0] == request_msg @@ -7520,7 +7533,6 @@ def test_create_ekm_connection_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ekm_service.CreateEkmConnectionRequest() - assert args[0] == request_msg @@ -7542,7 +7554,6 @@ def test_update_ekm_connection_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ekm_service.UpdateEkmConnectionRequest() - assert args[0] == request_msg @@ -7562,7 +7573,6 @@ def test_get_ekm_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ekm_service.GetEkmConfigRequest() - assert args[0] == request_msg @@ -7584,7 +7594,6 @@ def test_update_ekm_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ekm_service.UpdateEkmConfigRequest() - assert args[0] == request_msg @@ -7606,7 +7615,6 @@ def test_verify_connectivity_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ekm_service.VerifyConnectivityRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-kms/tests/unit/gapic/kms_v1/test_hsm_management.py b/packages/google-cloud-kms/tests/unit/gapic/kms_v1/test_hsm_management.py index 4583af617ba2..ade38c253eb0 100644 --- a/packages/google-cloud-kms/tests/unit/gapic/kms_v1/test_hsm_management.py +++ b/packages/google-cloud-kms/tests/unit/gapic/kms_v1/test_hsm_management.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 @@ -120,6 +121,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" @@ -1322,8 +1338,8 @@ def test_hsm_management_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - hsm_management.ListSingleTenantHsmInstancesRequest, - dict, + hsm_management.ListSingleTenantHsmInstancesRequest(), + {}, ], ) def test_list_single_tenant_hsm_instances(request_type, transport: str = "grpc"): @@ -1334,7 +1350,7 @@ def test_list_single_tenant_hsm_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( @@ -1387,12 +1403,13 @@ def test_list_single_tenant_hsm_instances_non_empty_request_with_auto_populated_ client.list_single_tenant_hsm_instances(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hsm_management.ListSingleTenantHsmInstancesRequest( + request_msg = hsm_management.ListSingleTenantHsmInstancesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_single_tenant_hsm_instances_use_cached_wrapped_rpc(): @@ -1478,9 +1495,15 @@ async def test_list_single_tenant_hsm_instances_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + hsm_management.ListSingleTenantHsmInstancesRequest(), + {}, + ], +) async def test_list_single_tenant_hsm_instances_async( - transport: str = "grpc_asyncio", - request_type=hsm_management.ListSingleTenantHsmInstancesRequest, + request_type, transport: str = "grpc_asyncio" ): client = HsmManagementAsyncClient( credentials=async_anonymous_credentials(), @@ -1489,7 +1512,7 @@ async def test_list_single_tenant_hsm_instances_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( @@ -1516,11 +1539,6 @@ async def test_list_single_tenant_hsm_instances_async( assert response.total_size == 1086 -@pytest.mark.asyncio -async def test_list_single_tenant_hsm_instances_async_from_dict(): - await test_list_single_tenant_hsm_instances_async(request_type=dict) - - def test_list_single_tenant_hsm_instances_field_headers(): client = HsmManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1881,8 +1899,8 @@ async def test_list_single_tenant_hsm_instances_async_pages(): @pytest.mark.parametrize( "request_type", [ - hsm_management.GetSingleTenantHsmInstanceRequest, - dict, + hsm_management.GetSingleTenantHsmInstanceRequest(), + {}, ], ) def test_get_single_tenant_hsm_instance(request_type, transport: str = "grpc"): @@ -1893,7 +1911,7 @@ def test_get_single_tenant_hsm_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( @@ -1945,9 +1963,10 @@ def test_get_single_tenant_hsm_instance_non_empty_request_with_auto_populated_fi client.get_single_tenant_hsm_instance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hsm_management.GetSingleTenantHsmInstanceRequest( + request_msg = hsm_management.GetSingleTenantHsmInstanceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_single_tenant_hsm_instance_use_cached_wrapped_rpc(): @@ -2033,9 +2052,15 @@ async def test_get_single_tenant_hsm_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + hsm_management.GetSingleTenantHsmInstanceRequest(), + {}, + ], +) async def test_get_single_tenant_hsm_instance_async( - transport: str = "grpc_asyncio", - request_type=hsm_management.GetSingleTenantHsmInstanceRequest, + request_type, transport: str = "grpc_asyncio" ): client = HsmManagementAsyncClient( credentials=async_anonymous_credentials(), @@ -2044,7 +2069,7 @@ async def test_get_single_tenant_hsm_instance_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( @@ -2073,11 +2098,6 @@ async def test_get_single_tenant_hsm_instance_async( assert response.key_portability_enabled is True -@pytest.mark.asyncio -async def test_get_single_tenant_hsm_instance_async_from_dict(): - await test_get_single_tenant_hsm_instance_async(request_type=dict) - - def test_get_single_tenant_hsm_instance_field_headers(): client = HsmManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2232,8 +2252,8 @@ async def test_get_single_tenant_hsm_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - hsm_management.CreateSingleTenantHsmInstanceRequest, - dict, + hsm_management.CreateSingleTenantHsmInstanceRequest(), + {}, ], ) def test_create_single_tenant_hsm_instance(request_type, transport: str = "grpc"): @@ -2244,7 +2264,7 @@ def test_create_single_tenant_hsm_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( @@ -2290,10 +2310,11 @@ def test_create_single_tenant_hsm_instance_non_empty_request_with_auto_populated client.create_single_tenant_hsm_instance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hsm_management.CreateSingleTenantHsmInstanceRequest( + request_msg = hsm_management.CreateSingleTenantHsmInstanceRequest( parent="parent_value", single_tenant_hsm_instance_id="single_tenant_hsm_instance_id_value", ) + assert args[0] == request_msg def test_create_single_tenant_hsm_instance_use_cached_wrapped_rpc(): @@ -2389,9 +2410,15 @@ async def test_create_single_tenant_hsm_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + hsm_management.CreateSingleTenantHsmInstanceRequest(), + {}, + ], +) async def test_create_single_tenant_hsm_instance_async( - transport: str = "grpc_asyncio", - request_type=hsm_management.CreateSingleTenantHsmInstanceRequest, + request_type, transport: str = "grpc_asyncio" ): client = HsmManagementAsyncClient( credentials=async_anonymous_credentials(), @@ -2400,7 +2427,7 @@ async def test_create_single_tenant_hsm_instance_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( @@ -2422,11 +2449,6 @@ async def test_create_single_tenant_hsm_instance_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_single_tenant_hsm_instance_async_from_dict(): - await test_create_single_tenant_hsm_instance_async(request_type=dict) - - def test_create_single_tenant_hsm_instance_field_headers(): client = HsmManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2609,8 +2631,8 @@ async def test_create_single_tenant_hsm_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - hsm_management.CreateSingleTenantHsmInstanceProposalRequest, - dict, + hsm_management.CreateSingleTenantHsmInstanceProposalRequest(), + {}, ], ) def test_create_single_tenant_hsm_instance_proposal( @@ -2623,7 +2645,7 @@ def test_create_single_tenant_hsm_instance_proposal( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2669,10 +2691,11 @@ def test_create_single_tenant_hsm_instance_proposal_non_empty_request_with_auto_ client.create_single_tenant_hsm_instance_proposal(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hsm_management.CreateSingleTenantHsmInstanceProposalRequest( + request_msg = hsm_management.CreateSingleTenantHsmInstanceProposalRequest( parent="parent_value", single_tenant_hsm_instance_proposal_id="single_tenant_hsm_instance_proposal_id_value", ) + assert args[0] == request_msg def test_create_single_tenant_hsm_instance_proposal_use_cached_wrapped_rpc(): @@ -2768,9 +2791,15 @@ async def test_create_single_tenant_hsm_instance_proposal_async_use_cached_wrapp @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + hsm_management.CreateSingleTenantHsmInstanceProposalRequest(), + {}, + ], +) async def test_create_single_tenant_hsm_instance_proposal_async( - transport: str = "grpc_asyncio", - request_type=hsm_management.CreateSingleTenantHsmInstanceProposalRequest, + request_type, transport: str = "grpc_asyncio" ): client = HsmManagementAsyncClient( credentials=async_anonymous_credentials(), @@ -2779,7 +2808,7 @@ async def test_create_single_tenant_hsm_instance_proposal_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( @@ -2801,11 +2830,6 @@ async def test_create_single_tenant_hsm_instance_proposal_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_single_tenant_hsm_instance_proposal_async_from_dict(): - await test_create_single_tenant_hsm_instance_proposal_async(request_type=dict) - - def test_create_single_tenant_hsm_instance_proposal_field_headers(): client = HsmManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2988,8 +3012,8 @@ async def test_create_single_tenant_hsm_instance_proposal_flattened_error_async( @pytest.mark.parametrize( "request_type", [ - hsm_management.ApproveSingleTenantHsmInstanceProposalRequest, - dict, + hsm_management.ApproveSingleTenantHsmInstanceProposalRequest(), + {}, ], ) def test_approve_single_tenant_hsm_instance_proposal( @@ -3002,7 +3026,7 @@ def test_approve_single_tenant_hsm_instance_proposal( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,9 +3075,10 @@ def test_approve_single_tenant_hsm_instance_proposal_non_empty_request_with_auto client.approve_single_tenant_hsm_instance_proposal(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hsm_management.ApproveSingleTenantHsmInstanceProposalRequest( + request_msg = hsm_management.ApproveSingleTenantHsmInstanceProposalRequest( name="name_value", ) + assert args[0] == request_msg def test_approve_single_tenant_hsm_instance_proposal_use_cached_wrapped_rpc(): @@ -3139,9 +3164,15 @@ async def test_approve_single_tenant_hsm_instance_proposal_async_use_cached_wrap @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + hsm_management.ApproveSingleTenantHsmInstanceProposalRequest(), + {}, + ], +) async def test_approve_single_tenant_hsm_instance_proposal_async( - transport: str = "grpc_asyncio", - request_type=hsm_management.ApproveSingleTenantHsmInstanceProposalRequest, + request_type, transport: str = "grpc_asyncio" ): client = HsmManagementAsyncClient( credentials=async_anonymous_credentials(), @@ -3150,7 +3181,7 @@ async def test_approve_single_tenant_hsm_instance_proposal_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( @@ -3174,11 +3205,6 @@ async def test_approve_single_tenant_hsm_instance_proposal_async( ) -@pytest.mark.asyncio -async def test_approve_single_tenant_hsm_instance_proposal_async_from_dict(): - await test_approve_single_tenant_hsm_instance_proposal_async(request_type=dict) - - def test_approve_single_tenant_hsm_instance_proposal_field_headers(): client = HsmManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3387,8 +3413,8 @@ async def test_approve_single_tenant_hsm_instance_proposal_flattened_error_async @pytest.mark.parametrize( "request_type", [ - hsm_management.ExecuteSingleTenantHsmInstanceProposalRequest, - dict, + hsm_management.ExecuteSingleTenantHsmInstanceProposalRequest(), + {}, ], ) def test_execute_single_tenant_hsm_instance_proposal( @@ -3401,7 +3427,7 @@ def test_execute_single_tenant_hsm_instance_proposal( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3446,9 +3472,10 @@ def test_execute_single_tenant_hsm_instance_proposal_non_empty_request_with_auto client.execute_single_tenant_hsm_instance_proposal(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hsm_management.ExecuteSingleTenantHsmInstanceProposalRequest( + request_msg = hsm_management.ExecuteSingleTenantHsmInstanceProposalRequest( name="name_value", ) + assert args[0] == request_msg def test_execute_single_tenant_hsm_instance_proposal_use_cached_wrapped_rpc(): @@ -3544,9 +3571,15 @@ async def test_execute_single_tenant_hsm_instance_proposal_async_use_cached_wrap @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + hsm_management.ExecuteSingleTenantHsmInstanceProposalRequest(), + {}, + ], +) async def test_execute_single_tenant_hsm_instance_proposal_async( - transport: str = "grpc_asyncio", - request_type=hsm_management.ExecuteSingleTenantHsmInstanceProposalRequest, + request_type, transport: str = "grpc_asyncio" ): client = HsmManagementAsyncClient( credentials=async_anonymous_credentials(), @@ -3555,7 +3588,7 @@ async def test_execute_single_tenant_hsm_instance_proposal_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( @@ -3577,11 +3610,6 @@ async def test_execute_single_tenant_hsm_instance_proposal_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_execute_single_tenant_hsm_instance_proposal_async_from_dict(): - await test_execute_single_tenant_hsm_instance_proposal_async(request_type=dict) - - def test_execute_single_tenant_hsm_instance_proposal_field_headers(): client = HsmManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3736,8 +3764,8 @@ async def test_execute_single_tenant_hsm_instance_proposal_flattened_error_async @pytest.mark.parametrize( "request_type", [ - hsm_management.GetSingleTenantHsmInstanceProposalRequest, - dict, + hsm_management.GetSingleTenantHsmInstanceProposalRequest(), + {}, ], ) def test_get_single_tenant_hsm_instance_proposal(request_type, transport: str = "grpc"): @@ -3748,7 +3776,7 @@ def test_get_single_tenant_hsm_instance_proposal(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( @@ -3802,9 +3830,10 @@ def test_get_single_tenant_hsm_instance_proposal_non_empty_request_with_auto_pop client.get_single_tenant_hsm_instance_proposal(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hsm_management.GetSingleTenantHsmInstanceProposalRequest( + request_msg = hsm_management.GetSingleTenantHsmInstanceProposalRequest( name="name_value", ) + assert args[0] == request_msg def test_get_single_tenant_hsm_instance_proposal_use_cached_wrapped_rpc(): @@ -3890,9 +3919,15 @@ async def test_get_single_tenant_hsm_instance_proposal_async_use_cached_wrapped_ @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + hsm_management.GetSingleTenantHsmInstanceProposalRequest(), + {}, + ], +) async def test_get_single_tenant_hsm_instance_proposal_async( - transport: str = "grpc_asyncio", - request_type=hsm_management.GetSingleTenantHsmInstanceProposalRequest, + request_type, transport: str = "grpc_asyncio" ): client = HsmManagementAsyncClient( credentials=async_anonymous_credentials(), @@ -3901,7 +3936,7 @@ async def test_get_single_tenant_hsm_instance_proposal_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( @@ -3932,11 +3967,6 @@ async def test_get_single_tenant_hsm_instance_proposal_async( assert response.failure_reason == "failure_reason_value" -@pytest.mark.asyncio -async def test_get_single_tenant_hsm_instance_proposal_async_from_dict(): - await test_get_single_tenant_hsm_instance_proposal_async(request_type=dict) - - def test_get_single_tenant_hsm_instance_proposal_field_headers(): client = HsmManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4091,8 +4121,8 @@ async def test_get_single_tenant_hsm_instance_proposal_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - hsm_management.ListSingleTenantHsmInstanceProposalsRequest, - dict, + hsm_management.ListSingleTenantHsmInstanceProposalsRequest(), + {}, ], ) def test_list_single_tenant_hsm_instance_proposals( @@ -4105,7 +4135,7 @@ def test_list_single_tenant_hsm_instance_proposals( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4158,12 +4188,13 @@ def test_list_single_tenant_hsm_instance_proposals_non_empty_request_with_auto_p client.list_single_tenant_hsm_instance_proposals(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hsm_management.ListSingleTenantHsmInstanceProposalsRequest( + request_msg = hsm_management.ListSingleTenantHsmInstanceProposalsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_single_tenant_hsm_instance_proposals_use_cached_wrapped_rpc(): @@ -4249,9 +4280,15 @@ async def test_list_single_tenant_hsm_instance_proposals_async_use_cached_wrappe @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + hsm_management.ListSingleTenantHsmInstanceProposalsRequest(), + {}, + ], +) async def test_list_single_tenant_hsm_instance_proposals_async( - transport: str = "grpc_asyncio", - request_type=hsm_management.ListSingleTenantHsmInstanceProposalsRequest, + request_type, transport: str = "grpc_asyncio" ): client = HsmManagementAsyncClient( credentials=async_anonymous_credentials(), @@ -4260,7 +4297,7 @@ async def test_list_single_tenant_hsm_instance_proposals_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( @@ -4287,11 +4324,6 @@ async def test_list_single_tenant_hsm_instance_proposals_async( assert response.total_size == 1086 -@pytest.mark.asyncio -async def test_list_single_tenant_hsm_instance_proposals_async_from_dict(): - await test_list_single_tenant_hsm_instance_proposals_async(request_type=dict) - - def test_list_single_tenant_hsm_instance_proposals_field_headers(): client = HsmManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4660,8 +4692,8 @@ async def test_list_single_tenant_hsm_instance_proposals_async_pages(): @pytest.mark.parametrize( "request_type", [ - hsm_management.DeleteSingleTenantHsmInstanceProposalRequest, - dict, + hsm_management.DeleteSingleTenantHsmInstanceProposalRequest(), + {}, ], ) def test_delete_single_tenant_hsm_instance_proposal( @@ -4674,7 +4706,7 @@ def test_delete_single_tenant_hsm_instance_proposal( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4719,9 +4751,10 @@ def test_delete_single_tenant_hsm_instance_proposal_non_empty_request_with_auto_ client.delete_single_tenant_hsm_instance_proposal(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hsm_management.DeleteSingleTenantHsmInstanceProposalRequest( + request_msg = hsm_management.DeleteSingleTenantHsmInstanceProposalRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_single_tenant_hsm_instance_proposal_use_cached_wrapped_rpc(): @@ -4807,9 +4840,15 @@ async def test_delete_single_tenant_hsm_instance_proposal_async_use_cached_wrapp @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + hsm_management.DeleteSingleTenantHsmInstanceProposalRequest(), + {}, + ], +) async def test_delete_single_tenant_hsm_instance_proposal_async( - transport: str = "grpc_asyncio", - request_type=hsm_management.DeleteSingleTenantHsmInstanceProposalRequest, + request_type, transport: str = "grpc_asyncio" ): client = HsmManagementAsyncClient( credentials=async_anonymous_credentials(), @@ -4818,7 +4857,7 @@ async def test_delete_single_tenant_hsm_instance_proposal_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( @@ -4838,11 +4877,6 @@ async def test_delete_single_tenant_hsm_instance_proposal_async( assert response is None -@pytest.mark.asyncio -async def test_delete_single_tenant_hsm_instance_proposal_async_from_dict(): - await test_delete_single_tenant_hsm_instance_proposal_async(request_type=dict) - - def test_delete_single_tenant_hsm_instance_proposal_field_headers(): client = HsmManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7087,7 +7121,6 @@ def test_list_single_tenant_hsm_instances_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hsm_management.ListSingleTenantHsmInstancesRequest() - assert args[0] == request_msg @@ -7110,7 +7143,6 @@ def test_get_single_tenant_hsm_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hsm_management.GetSingleTenantHsmInstanceRequest() - assert args[0] == request_msg @@ -7133,7 +7165,6 @@ def test_create_single_tenant_hsm_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hsm_management.CreateSingleTenantHsmInstanceRequest() - assert args[0] == request_msg @@ -7156,7 +7187,6 @@ def test_create_single_tenant_hsm_instance_proposal_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hsm_management.CreateSingleTenantHsmInstanceProposalRequest() - assert args[0] == request_msg @@ -7181,7 +7211,6 @@ def test_approve_single_tenant_hsm_instance_proposal_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hsm_management.ApproveSingleTenantHsmInstanceProposalRequest() - assert args[0] == request_msg @@ -7204,7 +7233,6 @@ def test_execute_single_tenant_hsm_instance_proposal_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hsm_management.ExecuteSingleTenantHsmInstanceProposalRequest() - assert args[0] == request_msg @@ -7227,7 +7255,6 @@ def test_get_single_tenant_hsm_instance_proposal_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hsm_management.GetSingleTenantHsmInstanceProposalRequest() - assert args[0] == request_msg @@ -7252,7 +7279,6 @@ def test_list_single_tenant_hsm_instance_proposals_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hsm_management.ListSingleTenantHsmInstanceProposalsRequest() - assert args[0] == request_msg @@ -7275,7 +7301,6 @@ def test_delete_single_tenant_hsm_instance_proposal_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hsm_management.DeleteSingleTenantHsmInstanceProposalRequest() - assert args[0] == request_msg @@ -7319,7 +7344,6 @@ async def test_list_single_tenant_hsm_instances_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hsm_management.ListSingleTenantHsmInstancesRequest() - assert args[0] == request_msg @@ -7350,7 +7374,6 @@ async def test_get_single_tenant_hsm_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hsm_management.GetSingleTenantHsmInstanceRequest() - assert args[0] == request_msg @@ -7377,7 +7400,6 @@ async def test_create_single_tenant_hsm_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hsm_management.CreateSingleTenantHsmInstanceRequest() - assert args[0] == request_msg @@ -7404,7 +7426,6 @@ async def test_create_single_tenant_hsm_instance_proposal_empty_call_grpc_asynci call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hsm_management.CreateSingleTenantHsmInstanceProposalRequest() - assert args[0] == request_msg @@ -7431,7 +7452,6 @@ async def test_approve_single_tenant_hsm_instance_proposal_empty_call_grpc_async call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hsm_management.ApproveSingleTenantHsmInstanceProposalRequest() - assert args[0] == request_msg @@ -7458,7 +7478,6 @@ async def test_execute_single_tenant_hsm_instance_proposal_empty_call_grpc_async call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hsm_management.ExecuteSingleTenantHsmInstanceProposalRequest() - assert args[0] == request_msg @@ -7489,7 +7508,6 @@ async def test_get_single_tenant_hsm_instance_proposal_empty_call_grpc_asyncio() call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hsm_management.GetSingleTenantHsmInstanceProposalRequest() - assert args[0] == request_msg @@ -7519,7 +7537,6 @@ async def test_list_single_tenant_hsm_instance_proposals_empty_call_grpc_asyncio call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hsm_management.ListSingleTenantHsmInstanceProposalsRequest() - assert args[0] == request_msg @@ -7544,7 +7561,6 @@ async def test_delete_single_tenant_hsm_instance_proposal_empty_call_grpc_asynci call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hsm_management.DeleteSingleTenantHsmInstanceProposalRequest() - assert args[0] == request_msg @@ -9414,7 +9430,6 @@ def test_list_single_tenant_hsm_instances_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hsm_management.ListSingleTenantHsmInstancesRequest() - assert args[0] == request_msg @@ -9436,7 +9451,6 @@ def test_get_single_tenant_hsm_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hsm_management.GetSingleTenantHsmInstanceRequest() - assert args[0] == request_msg @@ -9458,7 +9472,6 @@ def test_create_single_tenant_hsm_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hsm_management.CreateSingleTenantHsmInstanceRequest() - assert args[0] == request_msg @@ -9480,7 +9493,6 @@ def test_create_single_tenant_hsm_instance_proposal_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hsm_management.CreateSingleTenantHsmInstanceProposalRequest() - assert args[0] == request_msg @@ -9502,7 +9514,6 @@ def test_approve_single_tenant_hsm_instance_proposal_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hsm_management.ApproveSingleTenantHsmInstanceProposalRequest() - assert args[0] == request_msg @@ -9524,7 +9535,6 @@ def test_execute_single_tenant_hsm_instance_proposal_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hsm_management.ExecuteSingleTenantHsmInstanceProposalRequest() - assert args[0] == request_msg @@ -9546,7 +9556,6 @@ def test_get_single_tenant_hsm_instance_proposal_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hsm_management.GetSingleTenantHsmInstanceProposalRequest() - assert args[0] == request_msg @@ -9568,7 +9577,6 @@ def test_list_single_tenant_hsm_instance_proposals_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hsm_management.ListSingleTenantHsmInstanceProposalsRequest() - assert args[0] == request_msg @@ -9590,7 +9598,6 @@ def test_delete_single_tenant_hsm_instance_proposal_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hsm_management.DeleteSingleTenantHsmInstanceProposalRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-kms/tests/unit/gapic/kms_v1/test_key_management_service.py b/packages/google-cloud-kms/tests/unit/gapic/kms_v1/test_key_management_service.py index b3266d6d4f1d..4d20ac04502b 100644 --- a/packages/google-cloud-kms/tests/unit/gapic/kms_v1/test_key_management_service.py +++ b/packages/google-cloud-kms/tests/unit/gapic/kms_v1/test_key_management_service.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 @@ -123,6 +124,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" @@ -1389,8 +1405,8 @@ def test_key_management_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - service.ListKeyRingsRequest, - dict, + service.ListKeyRingsRequest(), + {}, ], ) def test_list_key_rings(request_type, transport: str = "grpc"): @@ -1401,7 +1417,7 @@ def test_list_key_rings(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_key_rings), "__call__") as call: @@ -1450,12 +1466,13 @@ def test_list_key_rings_non_empty_request_with_auto_populated_field(): client.list_key_rings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListKeyRingsRequest( + request_msg = service.ListKeyRingsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_key_rings_use_cached_wrapped_rpc(): @@ -1536,9 +1553,14 @@ async def test_list_key_rings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_key_rings_async( - transport: str = "grpc_asyncio", request_type=service.ListKeyRingsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListKeyRingsRequest(), + {}, + ], +) +async def test_list_key_rings_async(request_type, transport: str = "grpc_asyncio"): client = KeyManagementServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1546,7 +1568,7 @@ async def test_list_key_rings_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_key_rings), "__call__") as call: @@ -1571,11 +1593,6 @@ async def test_list_key_rings_async( assert response.total_size == 1086 -@pytest.mark.asyncio -async def test_list_key_rings_async_from_dict(): - await test_list_key_rings_async(request_type=dict) - - def test_list_key_rings_field_headers(): client = KeyManagementServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1912,8 +1929,8 @@ async def test_list_key_rings_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.ListCryptoKeysRequest, - dict, + service.ListCryptoKeysRequest(), + {}, ], ) def test_list_crypto_keys(request_type, transport: str = "grpc"): @@ -1924,7 +1941,7 @@ def test_list_crypto_keys(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_crypto_keys), "__call__") as call: @@ -1973,12 +1990,13 @@ def test_list_crypto_keys_non_empty_request_with_auto_populated_field(): client.list_crypto_keys(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListCryptoKeysRequest( + request_msg = service.ListCryptoKeysRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_crypto_keys_use_cached_wrapped_rpc(): @@ -2061,9 +2079,14 @@ async def test_list_crypto_keys_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_crypto_keys_async( - transport: str = "grpc_asyncio", request_type=service.ListCryptoKeysRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListCryptoKeysRequest(), + {}, + ], +) +async def test_list_crypto_keys_async(request_type, transport: str = "grpc_asyncio"): client = KeyManagementServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2071,7 +2094,7 @@ async def test_list_crypto_keys_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_crypto_keys), "__call__") as call: @@ -2096,11 +2119,6 @@ async def test_list_crypto_keys_async( assert response.total_size == 1086 -@pytest.mark.asyncio -async def test_list_crypto_keys_async_from_dict(): - await test_list_crypto_keys_async(request_type=dict) - - def test_list_crypto_keys_field_headers(): client = KeyManagementServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2437,8 +2455,8 @@ async def test_list_crypto_keys_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.ListCryptoKeyVersionsRequest, - dict, + service.ListCryptoKeyVersionsRequest(), + {}, ], ) def test_list_crypto_key_versions(request_type, transport: str = "grpc"): @@ -2449,7 +2467,7 @@ def test_list_crypto_key_versions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,12 +2520,13 @@ def test_list_crypto_key_versions_non_empty_request_with_auto_populated_field(): client.list_crypto_key_versions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListCryptoKeyVersionsRequest( + request_msg = service.ListCryptoKeyVersionsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_crypto_key_versions_use_cached_wrapped_rpc(): @@ -2593,8 +2612,15 @@ async def test_list_crypto_key_versions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.ListCryptoKeyVersionsRequest(), + {}, + ], +) async def test_list_crypto_key_versions_async( - transport: str = "grpc_asyncio", request_type=service.ListCryptoKeyVersionsRequest + request_type, transport: str = "grpc_asyncio" ): client = KeyManagementServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2603,7 +2629,7 @@ async def test_list_crypto_key_versions_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( @@ -2630,11 +2656,6 @@ async def test_list_crypto_key_versions_async( assert response.total_size == 1086 -@pytest.mark.asyncio -async def test_list_crypto_key_versions_async_from_dict(): - await test_list_crypto_key_versions_async(request_type=dict) - - def test_list_crypto_key_versions_field_headers(): client = KeyManagementServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2989,8 +3010,8 @@ async def test_list_crypto_key_versions_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.ListImportJobsRequest, - dict, + service.ListImportJobsRequest(), + {}, ], ) def test_list_import_jobs(request_type, transport: str = "grpc"): @@ -3001,7 +3022,7 @@ def test_list_import_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(type(client.transport.list_import_jobs), "__call__") as call: @@ -3050,12 +3071,13 @@ def test_list_import_jobs_non_empty_request_with_auto_populated_field(): client.list_import_jobs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListImportJobsRequest( + request_msg = service.ListImportJobsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_import_jobs_use_cached_wrapped_rpc(): @@ -3138,9 +3160,14 @@ async def test_list_import_jobs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_import_jobs_async( - transport: str = "grpc_asyncio", request_type=service.ListImportJobsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListImportJobsRequest(), + {}, + ], +) +async def test_list_import_jobs_async(request_type, transport: str = "grpc_asyncio"): client = KeyManagementServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3148,7 +3175,7 @@ async def test_list_import_jobs_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_import_jobs), "__call__") as call: @@ -3173,11 +3200,6 @@ async def test_list_import_jobs_async( assert response.total_size == 1086 -@pytest.mark.asyncio -async def test_list_import_jobs_async_from_dict(): - await test_list_import_jobs_async(request_type=dict) - - def test_list_import_jobs_field_headers(): client = KeyManagementServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3514,8 +3536,8 @@ async def test_list_import_jobs_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.ListRetiredResourcesRequest, - dict, + service.ListRetiredResourcesRequest(), + {}, ], ) def test_list_retired_resources(request_type, transport: str = "grpc"): @@ -3526,7 +3548,7 @@ def test_list_retired_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( @@ -3577,10 +3599,11 @@ def test_list_retired_resources_non_empty_request_with_auto_populated_field(): client.list_retired_resources(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListRetiredResourcesRequest( + request_msg = service.ListRetiredResourcesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_retired_resources_use_cached_wrapped_rpc(): @@ -3666,8 +3689,15 @@ async def test_list_retired_resources_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.ListRetiredResourcesRequest(), + {}, + ], +) async def test_list_retired_resources_async( - transport: str = "grpc_asyncio", request_type=service.ListRetiredResourcesRequest + request_type, transport: str = "grpc_asyncio" ): client = KeyManagementServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3676,7 +3706,7 @@ async def test_list_retired_resources_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( @@ -3703,11 +3733,6 @@ async def test_list_retired_resources_async( assert response.total_size == 1086 -@pytest.mark.asyncio -async def test_list_retired_resources_async_from_dict(): - await test_list_retired_resources_async(request_type=dict) - - def test_list_retired_resources_field_headers(): client = KeyManagementServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4060,8 +4085,8 @@ async def test_list_retired_resources_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetKeyRingRequest, - dict, + service.GetKeyRingRequest(), + {}, ], ) def test_get_key_ring(request_type, transport: str = "grpc"): @@ -4072,7 +4097,7 @@ def test_get_key_ring(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_key_ring), "__call__") as call: @@ -4116,9 +4141,10 @@ def test_get_key_ring_non_empty_request_with_auto_populated_field(): client.get_key_ring(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetKeyRingRequest( + request_msg = service.GetKeyRingRequest( name="name_value", ) + assert args[0] == request_msg def test_get_key_ring_use_cached_wrapped_rpc(): @@ -4199,9 +4225,14 @@ async def test_get_key_ring_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_key_ring_async( - transport: str = "grpc_asyncio", request_type=service.GetKeyRingRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetKeyRingRequest(), + {}, + ], +) +async def test_get_key_ring_async(request_type, transport: str = "grpc_asyncio"): client = KeyManagementServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4209,7 +4240,7 @@ async def test_get_key_ring_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_key_ring), "__call__") as call: @@ -4232,11 +4263,6 @@ async def test_get_key_ring_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_key_ring_async_from_dict(): - await test_get_key_ring_async(request_type=dict) - - def test_get_key_ring_field_headers(): client = KeyManagementServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4379,8 +4405,8 @@ async def test_get_key_ring_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.GetCryptoKeyRequest, - dict, + service.GetCryptoKeyRequest(), + {}, ], ) def test_get_crypto_key(request_type, transport: str = "grpc"): @@ -4391,7 +4417,7 @@ def test_get_crypto_key(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_crypto_key), "__call__") as call: @@ -4441,9 +4467,10 @@ def test_get_crypto_key_non_empty_request_with_auto_populated_field(): client.get_crypto_key(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetCryptoKeyRequest( + request_msg = service.GetCryptoKeyRequest( name="name_value", ) + assert args[0] == request_msg def test_get_crypto_key_use_cached_wrapped_rpc(): @@ -4524,9 +4551,14 @@ async def test_get_crypto_key_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_crypto_key_async( - transport: str = "grpc_asyncio", request_type=service.GetCryptoKeyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetCryptoKeyRequest(), + {}, + ], +) +async def test_get_crypto_key_async(request_type, transport: str = "grpc_asyncio"): client = KeyManagementServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4534,7 +4566,7 @@ async def test_get_crypto_key_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_crypto_key), "__call__") as call: @@ -4563,11 +4595,6 @@ async def test_get_crypto_key_async( assert response.crypto_key_backend == "crypto_key_backend_value" -@pytest.mark.asyncio -async def test_get_crypto_key_async_from_dict(): - await test_get_crypto_key_async(request_type=dict) - - def test_get_crypto_key_field_headers(): client = KeyManagementServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4710,8 +4737,8 @@ async def test_get_crypto_key_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.GetCryptoKeyVersionRequest, - dict, + service.GetCryptoKeyVersionRequest(), + {}, ], ) def test_get_crypto_key_version(request_type, transport: str = "grpc"): @@ -4722,7 +4749,7 @@ def test_get_crypto_key_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4795,9 +4822,10 @@ def test_get_crypto_key_version_non_empty_request_with_auto_populated_field(): client.get_crypto_key_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetCryptoKeyVersionRequest( + request_msg = service.GetCryptoKeyVersionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_crypto_key_version_use_cached_wrapped_rpc(): @@ -4883,8 +4911,15 @@ async def test_get_crypto_key_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.GetCryptoKeyVersionRequest(), + {}, + ], +) async def test_get_crypto_key_version_async( - transport: str = "grpc_asyncio", request_type=service.GetCryptoKeyVersionRequest + request_type, transport: str = "grpc_asyncio" ): client = KeyManagementServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4893,7 +4928,7 @@ async def test_get_crypto_key_version_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( @@ -4943,11 +4978,6 @@ async def test_get_crypto_key_version_async( assert response.reimport_eligible is True -@pytest.mark.asyncio -async def test_get_crypto_key_version_async_from_dict(): - await test_get_crypto_key_version_async(request_type=dict) - - def test_get_crypto_key_version_field_headers(): client = KeyManagementServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5102,8 +5132,8 @@ async def test_get_crypto_key_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.GetPublicKeyRequest, - dict, + service.GetPublicKeyRequest(), + {}, ], ) def test_get_public_key(request_type, transport: str = "grpc"): @@ -5114,7 +5144,7 @@ def test_get_public_key(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_public_key), "__call__") as call: @@ -5169,9 +5199,10 @@ def test_get_public_key_non_empty_request_with_auto_populated_field(): client.get_public_key(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetPublicKeyRequest( + request_msg = service.GetPublicKeyRequest( name="name_value", ) + assert args[0] == request_msg def test_get_public_key_use_cached_wrapped_rpc(): @@ -5252,9 +5283,14 @@ async def test_get_public_key_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_public_key_async( - transport: str = "grpc_asyncio", request_type=service.GetPublicKeyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetPublicKeyRequest(), + {}, + ], +) +async def test_get_public_key_async(request_type, transport: str = "grpc_asyncio"): client = KeyManagementServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5262,7 +5298,7 @@ async def test_get_public_key_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_public_key), "__call__") as call: @@ -5296,11 +5332,6 @@ async def test_get_public_key_async( assert response.public_key_format == resources.PublicKey.PublicKeyFormat.PEM -@pytest.mark.asyncio -async def test_get_public_key_async_from_dict(): - await test_get_public_key_async(request_type=dict) - - def test_get_public_key_field_headers(): client = KeyManagementServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5443,8 +5474,8 @@ async def test_get_public_key_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.GetImportJobRequest, - dict, + service.GetImportJobRequest(), + {}, ], ) def test_get_import_job(request_type, transport: str = "grpc"): @@ -5455,7 +5486,7 @@ def test_get_import_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(type(client.transport.get_import_job), "__call__") as call: @@ -5510,9 +5541,10 @@ def test_get_import_job_non_empty_request_with_auto_populated_field(): client.get_import_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetImportJobRequest( + request_msg = service.GetImportJobRequest( name="name_value", ) + assert args[0] == request_msg def test_get_import_job_use_cached_wrapped_rpc(): @@ -5593,9 +5625,14 @@ async def test_get_import_job_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_import_job_async( - transport: str = "grpc_asyncio", request_type=service.GetImportJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetImportJobRequest(), + {}, + ], +) +async def test_get_import_job_async(request_type, transport: str = "grpc_asyncio"): client = KeyManagementServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5603,7 +5640,7 @@ async def test_get_import_job_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_import_job), "__call__") as call: @@ -5637,11 +5674,6 @@ async def test_get_import_job_async( assert response.crypto_key_backend == "crypto_key_backend_value" -@pytest.mark.asyncio -async def test_get_import_job_async_from_dict(): - await test_get_import_job_async(request_type=dict) - - def test_get_import_job_field_headers(): client = KeyManagementServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5784,8 +5816,8 @@ async def test_get_import_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.GetRetiredResourceRequest, - dict, + service.GetRetiredResourceRequest(), + {}, ], ) def test_get_retired_resource(request_type, transport: str = "grpc"): @@ -5796,7 +5828,7 @@ def test_get_retired_resource(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5848,9 +5880,10 @@ def test_get_retired_resource_non_empty_request_with_auto_populated_field(): client.get_retired_resource(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetRetiredResourceRequest( + request_msg = service.GetRetiredResourceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_retired_resource_use_cached_wrapped_rpc(): @@ -5935,8 +5968,15 @@ async def test_get_retired_resource_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.GetRetiredResourceRequest(), + {}, + ], +) async def test_get_retired_resource_async( - transport: str = "grpc_asyncio", request_type=service.GetRetiredResourceRequest + request_type, transport: str = "grpc_asyncio" ): client = KeyManagementServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5945,7 +5985,7 @@ async def test_get_retired_resource_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( @@ -5974,11 +6014,6 @@ async def test_get_retired_resource_async( assert response.resource_type == "resource_type_value" -@pytest.mark.asyncio -async def test_get_retired_resource_async_from_dict(): - await test_get_retired_resource_async(request_type=dict) - - def test_get_retired_resource_field_headers(): client = KeyManagementServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6133,8 +6168,8 @@ async def test_get_retired_resource_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.CreateKeyRingRequest, - dict, + service.CreateKeyRingRequest(), + {}, ], ) def test_create_key_ring(request_type, transport: str = "grpc"): @@ -6145,7 +6180,7 @@ def test_create_key_ring(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_key_ring), "__call__") as call: @@ -6190,10 +6225,11 @@ def test_create_key_ring_non_empty_request_with_auto_populated_field(): client.create_key_ring(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateKeyRingRequest( + request_msg = service.CreateKeyRingRequest( parent="parent_value", key_ring_id="key_ring_id_value", ) + assert args[0] == request_msg def test_create_key_ring_use_cached_wrapped_rpc(): @@ -6274,9 +6310,14 @@ async def test_create_key_ring_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_key_ring_async( - transport: str = "grpc_asyncio", request_type=service.CreateKeyRingRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CreateKeyRingRequest(), + {}, + ], +) +async def test_create_key_ring_async(request_type, transport: str = "grpc_asyncio"): client = KeyManagementServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6284,7 +6325,7 @@ async def test_create_key_ring_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_key_ring), "__call__") as call: @@ -6307,11 +6348,6 @@ async def test_create_key_ring_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_create_key_ring_async_from_dict(): - await test_create_key_ring_async(request_type=dict) - - def test_create_key_ring_field_headers(): client = KeyManagementServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6474,8 +6510,8 @@ async def test_create_key_ring_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.CreateCryptoKeyRequest, - dict, + service.CreateCryptoKeyRequest(), + {}, ], ) def test_create_crypto_key(request_type, transport: str = "grpc"): @@ -6486,7 +6522,7 @@ def test_create_crypto_key(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6541,10 +6577,11 @@ def test_create_crypto_key_non_empty_request_with_auto_populated_field(): client.create_crypto_key(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateCryptoKeyRequest( + request_msg = service.CreateCryptoKeyRequest( parent="parent_value", crypto_key_id="crypto_key_id_value", ) + assert args[0] == request_msg def test_create_crypto_key_use_cached_wrapped_rpc(): @@ -6627,9 +6664,14 @@ async def test_create_crypto_key_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_crypto_key_async( - transport: str = "grpc_asyncio", request_type=service.CreateCryptoKeyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CreateCryptoKeyRequest(), + {}, + ], +) +async def test_create_crypto_key_async(request_type, transport: str = "grpc_asyncio"): client = KeyManagementServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6637,7 +6679,7 @@ async def test_create_crypto_key_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( @@ -6668,11 +6710,6 @@ async def test_create_crypto_key_async( assert response.crypto_key_backend == "crypto_key_backend_value" -@pytest.mark.asyncio -async def test_create_crypto_key_async_from_dict(): - await test_create_crypto_key_async(request_type=dict) - - def test_create_crypto_key_field_headers(): client = KeyManagementServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6843,8 +6880,8 @@ async def test_create_crypto_key_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.CreateCryptoKeyVersionRequest, - dict, + service.CreateCryptoKeyVersionRequest(), + {}, ], ) def test_create_crypto_key_version(request_type, transport: str = "grpc"): @@ -6855,7 +6892,7 @@ def test_create_crypto_key_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6928,9 +6965,10 @@ def test_create_crypto_key_version_non_empty_request_with_auto_populated_field() client.create_crypto_key_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateCryptoKeyVersionRequest( + request_msg = service.CreateCryptoKeyVersionRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_crypto_key_version_use_cached_wrapped_rpc(): @@ -7016,8 +7054,15 @@ async def test_create_crypto_key_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.CreateCryptoKeyVersionRequest(), + {}, + ], +) async def test_create_crypto_key_version_async( - transport: str = "grpc_asyncio", request_type=service.CreateCryptoKeyVersionRequest + request_type, transport: str = "grpc_asyncio" ): client = KeyManagementServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -7026,7 +7071,7 @@ async def test_create_crypto_key_version_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( @@ -7076,11 +7121,6 @@ async def test_create_crypto_key_version_async( assert response.reimport_eligible is True -@pytest.mark.asyncio -async def test_create_crypto_key_version_async_from_dict(): - await test_create_crypto_key_version_async(request_type=dict) - - def test_create_crypto_key_version_field_headers(): client = KeyManagementServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7245,8 +7285,8 @@ async def test_create_crypto_key_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DeleteCryptoKeyRequest, - dict, + service.DeleteCryptoKeyRequest(), + {}, ], ) def test_delete_crypto_key(request_type, transport: str = "grpc"): @@ -7257,7 +7297,7 @@ def test_delete_crypto_key(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7302,9 +7342,10 @@ def test_delete_crypto_key_non_empty_request_with_auto_populated_field(): client.delete_crypto_key(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteCryptoKeyRequest( + request_msg = service.DeleteCryptoKeyRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_crypto_key_use_cached_wrapped_rpc(): @@ -7397,9 +7438,14 @@ async def test_delete_crypto_key_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_crypto_key_async( - transport: str = "grpc_asyncio", request_type=service.DeleteCryptoKeyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteCryptoKeyRequest(), + {}, + ], +) +async def test_delete_crypto_key_async(request_type, transport: str = "grpc_asyncio"): client = KeyManagementServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7407,7 +7453,7 @@ async def test_delete_crypto_key_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( @@ -7429,11 +7475,6 @@ async def test_delete_crypto_key_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_crypto_key_async_from_dict(): - await test_delete_crypto_key_async(request_type=dict) - - def test_delete_crypto_key_field_headers(): client = KeyManagementServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7588,8 +7629,8 @@ async def test_delete_crypto_key_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DeleteCryptoKeyVersionRequest, - dict, + service.DeleteCryptoKeyVersionRequest(), + {}, ], ) def test_delete_crypto_key_version(request_type, transport: str = "grpc"): @@ -7600,7 +7641,7 @@ def test_delete_crypto_key_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7645,9 +7686,10 @@ def test_delete_crypto_key_version_non_empty_request_with_auto_populated_field() client.delete_crypto_key_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteCryptoKeyVersionRequest( + request_msg = service.DeleteCryptoKeyVersionRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_crypto_key_version_use_cached_wrapped_rpc(): @@ -7743,8 +7785,15 @@ async def test_delete_crypto_key_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteCryptoKeyVersionRequest(), + {}, + ], +) async def test_delete_crypto_key_version_async( - transport: str = "grpc_asyncio", request_type=service.DeleteCryptoKeyVersionRequest + request_type, transport: str = "grpc_asyncio" ): client = KeyManagementServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -7753,7 +7802,7 @@ async def test_delete_crypto_key_version_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( @@ -7775,11 +7824,6 @@ async def test_delete_crypto_key_version_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_crypto_key_version_async_from_dict(): - await test_delete_crypto_key_version_async(request_type=dict) - - def test_delete_crypto_key_version_field_headers(): client = KeyManagementServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7934,8 +7978,8 @@ async def test_delete_crypto_key_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ImportCryptoKeyVersionRequest, - dict, + service.ImportCryptoKeyVersionRequest(), + {}, ], ) def test_import_crypto_key_version(request_type, transport: str = "grpc"): @@ -7946,7 +7990,7 @@ def test_import_crypto_key_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8021,11 +8065,12 @@ def test_import_crypto_key_version_non_empty_request_with_auto_populated_field() client.import_crypto_key_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ImportCryptoKeyVersionRequest( + request_msg = service.ImportCryptoKeyVersionRequest( parent="parent_value", crypto_key_version="crypto_key_version_value", import_job="import_job_value", ) + assert args[0] == request_msg def test_import_crypto_key_version_use_cached_wrapped_rpc(): @@ -8111,8 +8156,15 @@ async def test_import_crypto_key_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.ImportCryptoKeyVersionRequest(), + {}, + ], +) async def test_import_crypto_key_version_async( - transport: str = "grpc_asyncio", request_type=service.ImportCryptoKeyVersionRequest + request_type, transport: str = "grpc_asyncio" ): client = KeyManagementServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -8121,7 +8173,7 @@ async def test_import_crypto_key_version_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( @@ -8171,11 +8223,6 @@ async def test_import_crypto_key_version_async( assert response.reimport_eligible is True -@pytest.mark.asyncio -async def test_import_crypto_key_version_async_from_dict(): - await test_import_crypto_key_version_async(request_type=dict) - - def test_import_crypto_key_version_field_headers(): client = KeyManagementServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8244,8 +8291,8 @@ async def test_import_crypto_key_version_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.CreateImportJobRequest, - dict, + service.CreateImportJobRequest(), + {}, ], ) def test_create_import_job(request_type, transport: str = "grpc"): @@ -8256,7 +8303,7 @@ def test_create_import_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( @@ -8316,10 +8363,11 @@ def test_create_import_job_non_empty_request_with_auto_populated_field(): client.create_import_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateImportJobRequest( + request_msg = service.CreateImportJobRequest( parent="parent_value", import_job_id="import_job_id_value", ) + assert args[0] == request_msg def test_create_import_job_use_cached_wrapped_rpc(): @@ -8402,9 +8450,14 @@ async def test_create_import_job_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_import_job_async( - transport: str = "grpc_asyncio", request_type=service.CreateImportJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CreateImportJobRequest(), + {}, + ], +) +async def test_create_import_job_async(request_type, transport: str = "grpc_asyncio"): client = KeyManagementServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8412,7 +8465,7 @@ async def test_create_import_job_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( @@ -8448,11 +8501,6 @@ async def test_create_import_job_async( assert response.crypto_key_backend == "crypto_key_backend_value" -@pytest.mark.asyncio -async def test_create_import_job_async_from_dict(): - await test_create_import_job_async(request_type=dict) - - def test_create_import_job_field_headers(): client = KeyManagementServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8623,8 +8671,8 @@ async def test_create_import_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdateCryptoKeyRequest, - dict, + service.UpdateCryptoKeyRequest(), + {}, ], ) def test_update_crypto_key(request_type, transport: str = "grpc"): @@ -8635,7 +8683,7 @@ def test_update_crypto_key(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8687,7 +8735,8 @@ def test_update_crypto_key_non_empty_request_with_auto_populated_field(): client.update_crypto_key(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateCryptoKeyRequest() + request_msg = service.UpdateCryptoKeyRequest() + assert args[0] == request_msg def test_update_crypto_key_use_cached_wrapped_rpc(): @@ -8770,9 +8819,14 @@ async def test_update_crypto_key_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_crypto_key_async( - transport: str = "grpc_asyncio", request_type=service.UpdateCryptoKeyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateCryptoKeyRequest(), + {}, + ], +) +async def test_update_crypto_key_async(request_type, transport: str = "grpc_asyncio"): client = KeyManagementServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8780,7 +8834,7 @@ async def test_update_crypto_key_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( @@ -8811,11 +8865,6 @@ async def test_update_crypto_key_async( assert response.crypto_key_backend == "crypto_key_backend_value" -@pytest.mark.asyncio -async def test_update_crypto_key_async_from_dict(): - await test_update_crypto_key_async(request_type=dict) - - def test_update_crypto_key_field_headers(): client = KeyManagementServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8976,8 +9025,8 @@ async def test_update_crypto_key_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdateCryptoKeyVersionRequest, - dict, + service.UpdateCryptoKeyVersionRequest(), + {}, ], ) def test_update_crypto_key_version(request_type, transport: str = "grpc"): @@ -8988,7 +9037,7 @@ def test_update_crypto_key_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9059,7 +9108,8 @@ def test_update_crypto_key_version_non_empty_request_with_auto_populated_field() client.update_crypto_key_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateCryptoKeyVersionRequest() + request_msg = service.UpdateCryptoKeyVersionRequest() + assert args[0] == request_msg def test_update_crypto_key_version_use_cached_wrapped_rpc(): @@ -9145,8 +9195,15 @@ async def test_update_crypto_key_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateCryptoKeyVersionRequest(), + {}, + ], +) async def test_update_crypto_key_version_async( - transport: str = "grpc_asyncio", request_type=service.UpdateCryptoKeyVersionRequest + request_type, transport: str = "grpc_asyncio" ): client = KeyManagementServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -9155,7 +9212,7 @@ async def test_update_crypto_key_version_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( @@ -9205,11 +9262,6 @@ async def test_update_crypto_key_version_async( assert response.reimport_eligible is True -@pytest.mark.asyncio -async def test_update_crypto_key_version_async_from_dict(): - await test_update_crypto_key_version_async(request_type=dict) - - def test_update_crypto_key_version_field_headers(): client = KeyManagementServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9374,8 +9426,8 @@ async def test_update_crypto_key_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdateCryptoKeyPrimaryVersionRequest, - dict, + service.UpdateCryptoKeyPrimaryVersionRequest(), + {}, ], ) def test_update_crypto_key_primary_version(request_type, transport: str = "grpc"): @@ -9386,7 +9438,7 @@ def test_update_crypto_key_primary_version(request_type, transport: str = "grpc" # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9441,10 +9493,11 @@ def test_update_crypto_key_primary_version_non_empty_request_with_auto_populated client.update_crypto_key_primary_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateCryptoKeyPrimaryVersionRequest( + request_msg = service.UpdateCryptoKeyPrimaryVersionRequest( name="name_value", crypto_key_version_id="crypto_key_version_id_value", ) + assert args[0] == request_msg def test_update_crypto_key_primary_version_use_cached_wrapped_rpc(): @@ -9530,9 +9583,15 @@ async def test_update_crypto_key_primary_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateCryptoKeyPrimaryVersionRequest(), + {}, + ], +) async def test_update_crypto_key_primary_version_async( - transport: str = "grpc_asyncio", - request_type=service.UpdateCryptoKeyPrimaryVersionRequest, + request_type, transport: str = "grpc_asyncio" ): client = KeyManagementServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -9541,7 +9600,7 @@ async def test_update_crypto_key_primary_version_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( @@ -9572,11 +9631,6 @@ async def test_update_crypto_key_primary_version_async( assert response.crypto_key_backend == "crypto_key_backend_value" -@pytest.mark.asyncio -async def test_update_crypto_key_primary_version_async_from_dict(): - await test_update_crypto_key_primary_version_async(request_type=dict) - - def test_update_crypto_key_primary_version_field_headers(): client = KeyManagementServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9737,8 +9791,8 @@ async def test_update_crypto_key_primary_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DestroyCryptoKeyVersionRequest, - dict, + service.DestroyCryptoKeyVersionRequest(), + {}, ], ) def test_destroy_crypto_key_version(request_type, transport: str = "grpc"): @@ -9749,7 +9803,7 @@ def test_destroy_crypto_key_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9822,9 +9876,10 @@ def test_destroy_crypto_key_version_non_empty_request_with_auto_populated_field( client.destroy_crypto_key_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DestroyCryptoKeyVersionRequest( + request_msg = service.DestroyCryptoKeyVersionRequest( name="name_value", ) + assert args[0] == request_msg def test_destroy_crypto_key_version_use_cached_wrapped_rpc(): @@ -9910,8 +9965,15 @@ async def test_destroy_crypto_key_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.DestroyCryptoKeyVersionRequest(), + {}, + ], +) async def test_destroy_crypto_key_version_async( - transport: str = "grpc_asyncio", request_type=service.DestroyCryptoKeyVersionRequest + request_type, transport: str = "grpc_asyncio" ): client = KeyManagementServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -9920,7 +9982,7 @@ async def test_destroy_crypto_key_version_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( @@ -9970,11 +10032,6 @@ async def test_destroy_crypto_key_version_async( assert response.reimport_eligible is True -@pytest.mark.asyncio -async def test_destroy_crypto_key_version_async_from_dict(): - await test_destroy_crypto_key_version_async(request_type=dict) - - def test_destroy_crypto_key_version_field_headers(): client = KeyManagementServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10129,8 +10186,8 @@ async def test_destroy_crypto_key_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.RestoreCryptoKeyVersionRequest, - dict, + service.RestoreCryptoKeyVersionRequest(), + {}, ], ) def test_restore_crypto_key_version(request_type, transport: str = "grpc"): @@ -10141,7 +10198,7 @@ def test_restore_crypto_key_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10214,9 +10271,10 @@ def test_restore_crypto_key_version_non_empty_request_with_auto_populated_field( client.restore_crypto_key_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.RestoreCryptoKeyVersionRequest( + request_msg = service.RestoreCryptoKeyVersionRequest( name="name_value", ) + assert args[0] == request_msg def test_restore_crypto_key_version_use_cached_wrapped_rpc(): @@ -10302,8 +10360,15 @@ async def test_restore_crypto_key_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.RestoreCryptoKeyVersionRequest(), + {}, + ], +) async def test_restore_crypto_key_version_async( - transport: str = "grpc_asyncio", request_type=service.RestoreCryptoKeyVersionRequest + request_type, transport: str = "grpc_asyncio" ): client = KeyManagementServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -10312,7 +10377,7 @@ async def test_restore_crypto_key_version_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( @@ -10362,11 +10427,6 @@ async def test_restore_crypto_key_version_async( assert response.reimport_eligible is True -@pytest.mark.asyncio -async def test_restore_crypto_key_version_async_from_dict(): - await test_restore_crypto_key_version_async(request_type=dict) - - def test_restore_crypto_key_version_field_headers(): client = KeyManagementServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10521,8 +10581,8 @@ async def test_restore_crypto_key_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.EncryptRequest, - dict, + service.EncryptRequest(), + {}, ], ) def test_encrypt(request_type, transport: str = "grpc"): @@ -10533,7 +10593,7 @@ def test_encrypt(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.encrypt), "__call__") as call: @@ -10585,9 +10645,10 @@ def test_encrypt_non_empty_request_with_auto_populated_field(): client.encrypt(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.EncryptRequest( + request_msg = service.EncryptRequest( name="name_value", ) + assert args[0] == request_msg def test_encrypt_use_cached_wrapped_rpc(): @@ -10666,9 +10727,14 @@ async def test_encrypt_async_use_cached_wrapped_rpc(transport: str = "grpc_async @pytest.mark.asyncio -async def test_encrypt_async( - transport: str = "grpc_asyncio", request_type=service.EncryptRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.EncryptRequest(), + {}, + ], +) +async def test_encrypt_async(request_type, transport: str = "grpc_asyncio"): client = KeyManagementServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10676,7 +10742,7 @@ async def test_encrypt_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.encrypt), "__call__") as call: @@ -10707,11 +10773,6 @@ async def test_encrypt_async( assert response.protection_level == resources.ProtectionLevel.SOFTWARE -@pytest.mark.asyncio -async def test_encrypt_async_from_dict(): - await test_encrypt_async(request_type=dict) - - def test_encrypt_field_headers(): client = KeyManagementServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10868,8 +10929,8 @@ async def test_encrypt_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DecryptRequest, - dict, + service.DecryptRequest(), + {}, ], ) def test_decrypt(request_type, transport: str = "grpc"): @@ -10880,7 +10941,7 @@ def test_decrypt(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.decrypt), "__call__") as call: @@ -10928,9 +10989,10 @@ def test_decrypt_non_empty_request_with_auto_populated_field(): client.decrypt(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DecryptRequest( + request_msg = service.DecryptRequest( name="name_value", ) + assert args[0] == request_msg def test_decrypt_use_cached_wrapped_rpc(): @@ -11009,9 +11071,14 @@ async def test_decrypt_async_use_cached_wrapped_rpc(transport: str = "grpc_async @pytest.mark.asyncio -async def test_decrypt_async( - transport: str = "grpc_asyncio", request_type=service.DecryptRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.DecryptRequest(), + {}, + ], +) +async def test_decrypt_async(request_type, transport: str = "grpc_asyncio"): client = KeyManagementServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11019,7 +11086,7 @@ async def test_decrypt_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.decrypt), "__call__") as call: @@ -11046,11 +11113,6 @@ async def test_decrypt_async( assert response.protection_level == resources.ProtectionLevel.SOFTWARE -@pytest.mark.asyncio -async def test_decrypt_async_from_dict(): - await test_decrypt_async(request_type=dict) - - def test_decrypt_field_headers(): client = KeyManagementServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11207,8 +11269,8 @@ async def test_decrypt_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.RawEncryptRequest, - dict, + service.RawEncryptRequest(), + {}, ], ) def test_raw_encrypt(request_type, transport: str = "grpc"): @@ -11219,7 +11281,7 @@ def test_raw_encrypt(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.raw_encrypt), "__call__") as call: @@ -11277,9 +11339,10 @@ def test_raw_encrypt_non_empty_request_with_auto_populated_field(): client.raw_encrypt(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.RawEncryptRequest( + request_msg = service.RawEncryptRequest( name="name_value", ) + assert args[0] == request_msg def test_raw_encrypt_use_cached_wrapped_rpc(): @@ -11360,9 +11423,14 @@ async def test_raw_encrypt_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_raw_encrypt_async( - transport: str = "grpc_asyncio", request_type=service.RawEncryptRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.RawEncryptRequest(), + {}, + ], +) +async def test_raw_encrypt_async(request_type, transport: str = "grpc_asyncio"): client = KeyManagementServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11370,7 +11438,7 @@ async def test_raw_encrypt_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.raw_encrypt), "__call__") as call: @@ -11407,11 +11475,6 @@ async def test_raw_encrypt_async( assert response.protection_level == resources.ProtectionLevel.SOFTWARE -@pytest.mark.asyncio -async def test_raw_encrypt_async_from_dict(): - await test_raw_encrypt_async(request_type=dict) - - def test_raw_encrypt_field_headers(): client = KeyManagementServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11476,8 +11539,8 @@ async def test_raw_encrypt_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.RawDecryptRequest, - dict, + service.RawDecryptRequest(), + {}, ], ) def test_raw_decrypt(request_type, transport: str = "grpc"): @@ -11488,7 +11551,7 @@ def test_raw_decrypt(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.raw_decrypt), "__call__") as call: @@ -11540,9 +11603,10 @@ def test_raw_decrypt_non_empty_request_with_auto_populated_field(): client.raw_decrypt(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.RawDecryptRequest( + request_msg = service.RawDecryptRequest( name="name_value", ) + assert args[0] == request_msg def test_raw_decrypt_use_cached_wrapped_rpc(): @@ -11623,9 +11687,14 @@ async def test_raw_decrypt_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_raw_decrypt_async( - transport: str = "grpc_asyncio", request_type=service.RawDecryptRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.RawDecryptRequest(), + {}, + ], +) +async def test_raw_decrypt_async(request_type, transport: str = "grpc_asyncio"): client = KeyManagementServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11633,7 +11702,7 @@ async def test_raw_decrypt_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.raw_decrypt), "__call__") as call: @@ -11664,11 +11733,6 @@ async def test_raw_decrypt_async( assert response.verified_initialization_vector_crc32c is True -@pytest.mark.asyncio -async def test_raw_decrypt_async_from_dict(): - await test_raw_decrypt_async(request_type=dict) - - def test_raw_decrypt_field_headers(): client = KeyManagementServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11733,8 +11797,8 @@ async def test_raw_decrypt_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.AsymmetricSignRequest, - dict, + service.AsymmetricSignRequest(), + {}, ], ) def test_asymmetric_sign(request_type, transport: str = "grpc"): @@ -11745,7 +11809,7 @@ def test_asymmetric_sign(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.asymmetric_sign), "__call__") as call: @@ -11797,9 +11861,10 @@ def test_asymmetric_sign_non_empty_request_with_auto_populated_field(): client.asymmetric_sign(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.AsymmetricSignRequest( + request_msg = service.AsymmetricSignRequest( name="name_value", ) + assert args[0] == request_msg def test_asymmetric_sign_use_cached_wrapped_rpc(): @@ -11880,9 +11945,14 @@ async def test_asymmetric_sign_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_asymmetric_sign_async( - transport: str = "grpc_asyncio", request_type=service.AsymmetricSignRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.AsymmetricSignRequest(), + {}, + ], +) +async def test_asymmetric_sign_async(request_type, transport: str = "grpc_asyncio"): client = KeyManagementServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11890,7 +11960,7 @@ async def test_asymmetric_sign_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.asymmetric_sign), "__call__") as call: @@ -11921,11 +11991,6 @@ async def test_asymmetric_sign_async( assert response.protection_level == resources.ProtectionLevel.SOFTWARE -@pytest.mark.asyncio -async def test_asymmetric_sign_async_from_dict(): - await test_asymmetric_sign_async(request_type=dict) - - def test_asymmetric_sign_field_headers(): client = KeyManagementServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12082,8 +12147,8 @@ async def test_asymmetric_sign_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.AsymmetricDecryptRequest, - dict, + service.AsymmetricDecryptRequest(), + {}, ], ) def test_asymmetric_decrypt(request_type, transport: str = "grpc"): @@ -12094,7 +12159,7 @@ def test_asymmetric_decrypt(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -12146,9 +12211,10 @@ def test_asymmetric_decrypt_non_empty_request_with_auto_populated_field(): client.asymmetric_decrypt(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.AsymmetricDecryptRequest( + request_msg = service.AsymmetricDecryptRequest( name="name_value", ) + assert args[0] == request_msg def test_asymmetric_decrypt_use_cached_wrapped_rpc(): @@ -12233,9 +12299,14 @@ async def test_asymmetric_decrypt_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_asymmetric_decrypt_async( - transport: str = "grpc_asyncio", request_type=service.AsymmetricDecryptRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.AsymmetricDecryptRequest(), + {}, + ], +) +async def test_asymmetric_decrypt_async(request_type, transport: str = "grpc_asyncio"): client = KeyManagementServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12243,7 +12314,7 @@ async def test_asymmetric_decrypt_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( @@ -12272,11 +12343,6 @@ async def test_asymmetric_decrypt_async( assert response.protection_level == resources.ProtectionLevel.SOFTWARE -@pytest.mark.asyncio -async def test_asymmetric_decrypt_async_from_dict(): - await test_asymmetric_decrypt_async(request_type=dict) - - def test_asymmetric_decrypt_field_headers(): client = KeyManagementServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12441,8 +12507,8 @@ async def test_asymmetric_decrypt_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.MacSignRequest, - dict, + service.MacSignRequest(), + {}, ], ) def test_mac_sign(request_type, transport: str = "grpc"): @@ -12453,7 +12519,7 @@ def test_mac_sign(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.mac_sign), "__call__") as call: @@ -12503,9 +12569,10 @@ def test_mac_sign_non_empty_request_with_auto_populated_field(): client.mac_sign(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.MacSignRequest( + request_msg = service.MacSignRequest( name="name_value", ) + assert args[0] == request_msg def test_mac_sign_use_cached_wrapped_rpc(): @@ -12584,9 +12651,14 @@ async def test_mac_sign_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn @pytest.mark.asyncio -async def test_mac_sign_async( - transport: str = "grpc_asyncio", request_type=service.MacSignRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.MacSignRequest(), + {}, + ], +) +async def test_mac_sign_async(request_type, transport: str = "grpc_asyncio"): client = KeyManagementServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12594,7 +12666,7 @@ async def test_mac_sign_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.mac_sign), "__call__") as call: @@ -12623,11 +12695,6 @@ async def test_mac_sign_async( assert response.protection_level == resources.ProtectionLevel.SOFTWARE -@pytest.mark.asyncio -async def test_mac_sign_async_from_dict(): - await test_mac_sign_async(request_type=dict) - - def test_mac_sign_field_headers(): client = KeyManagementServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12784,8 +12851,8 @@ async def test_mac_sign_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.MacVerifyRequest, - dict, + service.MacVerifyRequest(), + {}, ], ) def test_mac_verify(request_type, transport: str = "grpc"): @@ -12796,7 +12863,7 @@ def test_mac_verify(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.mac_verify), "__call__") as call: @@ -12850,9 +12917,10 @@ def test_mac_verify_non_empty_request_with_auto_populated_field(): client.mac_verify(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.MacVerifyRequest( + request_msg = service.MacVerifyRequest( name="name_value", ) + assert args[0] == request_msg def test_mac_verify_use_cached_wrapped_rpc(): @@ -12931,9 +12999,14 @@ async def test_mac_verify_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_mac_verify_async( - transport: str = "grpc_asyncio", request_type=service.MacVerifyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.MacVerifyRequest(), + {}, + ], +) +async def test_mac_verify_async(request_type, transport: str = "grpc_asyncio"): client = KeyManagementServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12941,7 +13014,7 @@ async def test_mac_verify_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.mac_verify), "__call__") as call: @@ -12974,11 +13047,6 @@ async def test_mac_verify_async( assert response.protection_level == resources.ProtectionLevel.SOFTWARE -@pytest.mark.asyncio -async def test_mac_verify_async_from_dict(): - await test_mac_verify_async(request_type=dict) - - def test_mac_verify_field_headers(): client = KeyManagementServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13145,8 +13213,8 @@ async def test_mac_verify_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DecapsulateRequest, - dict, + service.DecapsulateRequest(), + {}, ], ) def test_decapsulate(request_type, transport: str = "grpc"): @@ -13157,7 +13225,7 @@ def test_decapsulate(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.decapsulate), "__call__") as call: @@ -13209,9 +13277,10 @@ def test_decapsulate_non_empty_request_with_auto_populated_field(): client.decapsulate(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DecapsulateRequest( + request_msg = service.DecapsulateRequest( name="name_value", ) + assert args[0] == request_msg def test_decapsulate_use_cached_wrapped_rpc(): @@ -13292,9 +13361,14 @@ async def test_decapsulate_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_decapsulate_async( - transport: str = "grpc_asyncio", request_type=service.DecapsulateRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.DecapsulateRequest(), + {}, + ], +) +async def test_decapsulate_async(request_type, transport: str = "grpc_asyncio"): client = KeyManagementServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13302,7 +13376,7 @@ async def test_decapsulate_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.decapsulate), "__call__") as call: @@ -13333,11 +13407,6 @@ async def test_decapsulate_async( assert response.protection_level == resources.ProtectionLevel.SOFTWARE -@pytest.mark.asyncio -async def test_decapsulate_async_from_dict(): - await test_decapsulate_async(request_type=dict) - - def test_decapsulate_field_headers(): client = KeyManagementServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13402,8 +13471,8 @@ async def test_decapsulate_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.GenerateRandomBytesRequest, - dict, + service.GenerateRandomBytesRequest(), + {}, ], ) def test_generate_random_bytes(request_type, transport: str = "grpc"): @@ -13414,7 +13483,7 @@ def test_generate_random_bytes(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -13462,9 +13531,10 @@ def test_generate_random_bytes_non_empty_request_with_auto_populated_field(): client.generate_random_bytes(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GenerateRandomBytesRequest( + request_msg = service.GenerateRandomBytesRequest( location="location_value", ) + assert args[0] == request_msg def test_generate_random_bytes_use_cached_wrapped_rpc(): @@ -13550,8 +13620,15 @@ async def test_generate_random_bytes_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.GenerateRandomBytesRequest(), + {}, + ], +) async def test_generate_random_bytes_async( - transport: str = "grpc_asyncio", request_type=service.GenerateRandomBytesRequest + request_type, transport: str = "grpc_asyncio" ): client = KeyManagementServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -13560,7 +13637,7 @@ async def test_generate_random_bytes_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( @@ -13585,11 +13662,6 @@ async def test_generate_random_bytes_async( assert response.data == b"data_blob" -@pytest.mark.asyncio -async def test_generate_random_bytes_async_from_dict(): - await test_generate_random_bytes_async(request_type=dict) - - def test_generate_random_bytes_field_headers(): client = KeyManagementServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -20244,7 +20316,6 @@ def test_list_key_rings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListKeyRingsRequest() - assert args[0] == request_msg @@ -20265,7 +20336,6 @@ def test_list_crypto_keys_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListCryptoKeysRequest() - assert args[0] == request_msg @@ -20288,7 +20358,6 @@ def test_list_crypto_key_versions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListCryptoKeyVersionsRequest() - assert args[0] == request_msg @@ -20309,7 +20378,6 @@ def test_list_import_jobs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListImportJobsRequest() - assert args[0] == request_msg @@ -20332,7 +20400,6 @@ def test_list_retired_resources_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListRetiredResourcesRequest() - assert args[0] == request_msg @@ -20353,7 +20420,6 @@ def test_get_key_ring_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetKeyRingRequest() - assert args[0] == request_msg @@ -20374,7 +20440,6 @@ def test_get_crypto_key_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetCryptoKeyRequest() - assert args[0] == request_msg @@ -20397,7 +20462,6 @@ def test_get_crypto_key_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetCryptoKeyVersionRequest() - assert args[0] == request_msg @@ -20418,7 +20482,6 @@ def test_get_public_key_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetPublicKeyRequest() - assert args[0] == request_msg @@ -20439,7 +20502,6 @@ def test_get_import_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetImportJobRequest() - assert args[0] == request_msg @@ -20462,7 +20524,6 @@ def test_get_retired_resource_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetRetiredResourceRequest() - assert args[0] == request_msg @@ -20483,7 +20544,6 @@ def test_create_key_ring_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateKeyRingRequest() - assert args[0] == request_msg @@ -20506,7 +20566,6 @@ def test_create_crypto_key_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateCryptoKeyRequest() - assert args[0] == request_msg @@ -20529,7 +20588,6 @@ def test_create_crypto_key_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateCryptoKeyVersionRequest() - assert args[0] == request_msg @@ -20552,7 +20610,6 @@ def test_delete_crypto_key_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteCryptoKeyRequest() - assert args[0] == request_msg @@ -20575,7 +20632,6 @@ def test_delete_crypto_key_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteCryptoKeyVersionRequest() - assert args[0] == request_msg @@ -20598,7 +20654,6 @@ def test_import_crypto_key_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ImportCryptoKeyVersionRequest() - assert args[0] == request_msg @@ -20621,7 +20676,6 @@ def test_create_import_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateImportJobRequest() - assert args[0] == request_msg @@ -20644,7 +20698,6 @@ def test_update_crypto_key_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateCryptoKeyRequest() - assert args[0] == request_msg @@ -20667,7 +20720,6 @@ def test_update_crypto_key_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateCryptoKeyVersionRequest() - assert args[0] == request_msg @@ -20690,7 +20742,6 @@ def test_update_crypto_key_primary_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateCryptoKeyPrimaryVersionRequest() - assert args[0] == request_msg @@ -20713,7 +20764,6 @@ def test_destroy_crypto_key_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DestroyCryptoKeyVersionRequest() - assert args[0] == request_msg @@ -20736,7 +20786,6 @@ def test_restore_crypto_key_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.RestoreCryptoKeyVersionRequest() - assert args[0] == request_msg @@ -20757,7 +20806,6 @@ def test_encrypt_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.EncryptRequest() - assert args[0] == request_msg @@ -20778,7 +20826,6 @@ def test_decrypt_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DecryptRequest() - assert args[0] == request_msg @@ -20799,7 +20846,6 @@ def test_raw_encrypt_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.RawEncryptRequest() - assert args[0] == request_msg @@ -20820,7 +20866,6 @@ def test_raw_decrypt_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.RawDecryptRequest() - assert args[0] == request_msg @@ -20841,7 +20886,6 @@ def test_asymmetric_sign_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.AsymmetricSignRequest() - assert args[0] == request_msg @@ -20864,7 +20908,6 @@ def test_asymmetric_decrypt_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.AsymmetricDecryptRequest() - assert args[0] == request_msg @@ -20885,7 +20928,6 @@ def test_mac_sign_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.MacSignRequest() - assert args[0] == request_msg @@ -20906,7 +20948,6 @@ def test_mac_verify_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.MacVerifyRequest() - assert args[0] == request_msg @@ -20927,7 +20968,6 @@ def test_decapsulate_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DecapsulateRequest() - assert args[0] == request_msg @@ -20950,7 +20990,6 @@ def test_generate_random_bytes_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GenerateRandomBytesRequest() - assert args[0] == request_msg @@ -20992,7 +21031,6 @@ async def test_list_key_rings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListKeyRingsRequest() - assert args[0] == request_msg @@ -21020,7 +21058,6 @@ async def test_list_crypto_keys_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListCryptoKeysRequest() - assert args[0] == request_msg @@ -21050,7 +21087,6 @@ async def test_list_crypto_key_versions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListCryptoKeyVersionsRequest() - assert args[0] == request_msg @@ -21078,7 +21114,6 @@ async def test_list_import_jobs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListImportJobsRequest() - assert args[0] == request_msg @@ -21108,7 +21143,6 @@ async def test_list_retired_resources_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListRetiredResourcesRequest() - assert args[0] == request_msg @@ -21135,7 +21169,6 @@ async def test_get_key_ring_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetKeyRingRequest() - assert args[0] == request_msg @@ -21165,7 +21198,6 @@ async def test_get_crypto_key_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetCryptoKeyRequest() - assert args[0] == request_msg @@ -21202,7 +21234,6 @@ async def test_get_crypto_key_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetCryptoKeyVersionRequest() - assert args[0] == request_msg @@ -21233,7 +21264,6 @@ async def test_get_public_key_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetPublicKeyRequest() - assert args[0] == request_msg @@ -21264,7 +21294,6 @@ async def test_get_import_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetImportJobRequest() - assert args[0] == request_msg @@ -21295,7 +21324,6 @@ async def test_get_retired_resource_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetRetiredResourceRequest() - assert args[0] == request_msg @@ -21322,7 +21350,6 @@ async def test_create_key_ring_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateKeyRingRequest() - assert args[0] == request_msg @@ -21354,7 +21381,6 @@ async def test_create_crypto_key_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateCryptoKeyRequest() - assert args[0] == request_msg @@ -21391,7 +21417,6 @@ async def test_create_crypto_key_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateCryptoKeyVersionRequest() - assert args[0] == request_msg @@ -21418,7 +21443,6 @@ async def test_delete_crypto_key_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteCryptoKeyRequest() - assert args[0] == request_msg @@ -21445,7 +21469,6 @@ async def test_delete_crypto_key_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteCryptoKeyVersionRequest() - assert args[0] == request_msg @@ -21482,7 +21505,6 @@ async def test_import_crypto_key_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ImportCryptoKeyVersionRequest() - assert args[0] == request_msg @@ -21515,7 +21537,6 @@ async def test_create_import_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateImportJobRequest() - assert args[0] == request_msg @@ -21547,7 +21568,6 @@ async def test_update_crypto_key_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateCryptoKeyRequest() - assert args[0] == request_msg @@ -21584,7 +21604,6 @@ async def test_update_crypto_key_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateCryptoKeyVersionRequest() - assert args[0] == request_msg @@ -21616,7 +21635,6 @@ async def test_update_crypto_key_primary_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateCryptoKeyPrimaryVersionRequest() - assert args[0] == request_msg @@ -21653,7 +21671,6 @@ async def test_destroy_crypto_key_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DestroyCryptoKeyVersionRequest() - assert args[0] == request_msg @@ -21690,7 +21707,6 @@ async def test_restore_crypto_key_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.RestoreCryptoKeyVersionRequest() - assert args[0] == request_msg @@ -21721,7 +21737,6 @@ async def test_encrypt_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.EncryptRequest() - assert args[0] == request_msg @@ -21750,7 +21765,6 @@ async def test_decrypt_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DecryptRequest() - assert args[0] == request_msg @@ -21784,7 +21798,6 @@ async def test_raw_encrypt_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.RawEncryptRequest() - assert args[0] == request_msg @@ -21815,7 +21828,6 @@ async def test_raw_decrypt_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.RawDecryptRequest() - assert args[0] == request_msg @@ -21846,7 +21858,6 @@ async def test_asymmetric_sign_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.AsymmetricSignRequest() - assert args[0] == request_msg @@ -21877,7 +21888,6 @@ async def test_asymmetric_decrypt_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.AsymmetricDecryptRequest() - assert args[0] == request_msg @@ -21907,7 +21917,6 @@ async def test_mac_sign_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.MacSignRequest() - assert args[0] == request_msg @@ -21939,7 +21948,6 @@ async def test_mac_verify_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.MacVerifyRequest() - assert args[0] == request_msg @@ -21970,7 +21978,6 @@ async def test_decapsulate_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DecapsulateRequest() - assert args[0] == request_msg @@ -21999,7 +22006,6 @@ async def test_generate_random_bytes_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GenerateRandomBytesRequest() - assert args[0] == request_msg @@ -27685,7 +27691,6 @@ def test_list_key_rings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListKeyRingsRequest() - assert args[0] == request_msg @@ -27705,7 +27710,6 @@ def test_list_crypto_keys_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListCryptoKeysRequest() - assert args[0] == request_msg @@ -27727,7 +27731,6 @@ def test_list_crypto_key_versions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListCryptoKeyVersionsRequest() - assert args[0] == request_msg @@ -27747,7 +27750,6 @@ def test_list_import_jobs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListImportJobsRequest() - assert args[0] == request_msg @@ -27769,7 +27771,6 @@ def test_list_retired_resources_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListRetiredResourcesRequest() - assert args[0] == request_msg @@ -27789,7 +27790,6 @@ def test_get_key_ring_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetKeyRingRequest() - assert args[0] == request_msg @@ -27809,7 +27809,6 @@ def test_get_crypto_key_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetCryptoKeyRequest() - assert args[0] == request_msg @@ -27831,7 +27830,6 @@ def test_get_crypto_key_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetCryptoKeyVersionRequest() - assert args[0] == request_msg @@ -27851,7 +27849,6 @@ def test_get_public_key_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetPublicKeyRequest() - assert args[0] == request_msg @@ -27871,7 +27868,6 @@ def test_get_import_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetImportJobRequest() - assert args[0] == request_msg @@ -27893,7 +27889,6 @@ def test_get_retired_resource_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetRetiredResourceRequest() - assert args[0] == request_msg @@ -27913,7 +27908,6 @@ def test_create_key_ring_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateKeyRingRequest() - assert args[0] == request_msg @@ -27935,7 +27929,6 @@ def test_create_crypto_key_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateCryptoKeyRequest() - assert args[0] == request_msg @@ -27957,7 +27950,6 @@ def test_create_crypto_key_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateCryptoKeyVersionRequest() - assert args[0] == request_msg @@ -27979,7 +27971,6 @@ def test_delete_crypto_key_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteCryptoKeyRequest() - assert args[0] == request_msg @@ -28001,7 +27992,6 @@ def test_delete_crypto_key_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteCryptoKeyVersionRequest() - assert args[0] == request_msg @@ -28023,7 +28013,6 @@ def test_import_crypto_key_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ImportCryptoKeyVersionRequest() - assert args[0] == request_msg @@ -28045,7 +28034,6 @@ def test_create_import_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateImportJobRequest() - assert args[0] == request_msg @@ -28067,7 +28055,6 @@ def test_update_crypto_key_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateCryptoKeyRequest() - assert args[0] == request_msg @@ -28089,7 +28076,6 @@ def test_update_crypto_key_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateCryptoKeyVersionRequest() - assert args[0] == request_msg @@ -28111,7 +28097,6 @@ def test_update_crypto_key_primary_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateCryptoKeyPrimaryVersionRequest() - assert args[0] == request_msg @@ -28133,7 +28118,6 @@ def test_destroy_crypto_key_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DestroyCryptoKeyVersionRequest() - assert args[0] == request_msg @@ -28155,7 +28139,6 @@ def test_restore_crypto_key_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.RestoreCryptoKeyVersionRequest() - assert args[0] == request_msg @@ -28175,7 +28158,6 @@ def test_encrypt_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.EncryptRequest() - assert args[0] == request_msg @@ -28195,7 +28177,6 @@ def test_decrypt_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DecryptRequest() - assert args[0] == request_msg @@ -28215,7 +28196,6 @@ def test_raw_encrypt_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.RawEncryptRequest() - assert args[0] == request_msg @@ -28235,7 +28215,6 @@ def test_raw_decrypt_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.RawDecryptRequest() - assert args[0] == request_msg @@ -28255,7 +28234,6 @@ def test_asymmetric_sign_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.AsymmetricSignRequest() - assert args[0] == request_msg @@ -28277,7 +28255,6 @@ def test_asymmetric_decrypt_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.AsymmetricDecryptRequest() - assert args[0] == request_msg @@ -28297,7 +28274,6 @@ def test_mac_sign_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.MacSignRequest() - assert args[0] == request_msg @@ -28317,7 +28293,6 @@ def test_mac_verify_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.MacVerifyRequest() - assert args[0] == request_msg @@ -28337,7 +28312,6 @@ def test_decapsulate_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DecapsulateRequest() - assert args[0] == request_msg @@ -28359,7 +28333,6 @@ def test_generate_random_bytes_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GenerateRandomBytesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-language/noxfile.py b/packages/google-cloud-language/noxfile.py index 50e73cc2147b..7c8f31734518 100644 --- a/packages/google-cloud-language/noxfile.py +++ b/packages/google-cloud-language/noxfile.py @@ -47,7 +47,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-language" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-language/setup.py b/packages/google-cloud-language/setup.py index 38af0bf2d378..422879cbb6fa 100644 --- a/packages/google-cloud-language/setup.py +++ b/packages/google-cloud-language/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/google-cloud-language/testing/constraints-3.10.txt b/packages/google-cloud-language/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-language/testing/constraints-3.10.txt +++ b/packages/google-cloud-language/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-language/tests/unit/gapic/language_v1/test_language_service.py b/packages/google-cloud-language/tests/unit/gapic/language_v1/test_language_service.py index 8c6b302fa9ea..7effffc66f14 100644 --- a/packages/google-cloud-language/tests/unit/gapic/language_v1/test_language_service.py +++ b/packages/google-cloud-language/tests/unit/gapic/language_v1/test_language_service.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 @@ -106,6 +107,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" @@ -1336,8 +1352,8 @@ def test_language_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - language_service.AnalyzeSentimentRequest, - dict, + language_service.AnalyzeSentimentRequest(), + {}, ], ) def test_analyze_sentiment(request_type, transport: str = "grpc"): @@ -1348,7 +1364,7 @@ def test_analyze_sentiment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1394,7 +1410,8 @@ def test_analyze_sentiment_non_empty_request_with_auto_populated_field(): client.analyze_sentiment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == language_service.AnalyzeSentimentRequest() + request_msg = language_service.AnalyzeSentimentRequest() + assert args[0] == request_msg def test_analyze_sentiment_use_cached_wrapped_rpc(): @@ -1477,10 +1494,14 @@ async def test_analyze_sentiment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_analyze_sentiment_async( - transport: str = "grpc_asyncio", - request_type=language_service.AnalyzeSentimentRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + language_service.AnalyzeSentimentRequest(), + {}, + ], +) +async def test_analyze_sentiment_async(request_type, transport: str = "grpc_asyncio"): client = LanguageServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1488,7 +1509,7 @@ async def test_analyze_sentiment_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( @@ -1513,11 +1534,6 @@ async def test_analyze_sentiment_async( assert response.language == "language_value" -@pytest.mark.asyncio -async def test_analyze_sentiment_async_from_dict(): - await test_analyze_sentiment_async(request_type=dict) - - def test_analyze_sentiment_flattened(): client = LanguageServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1629,8 +1645,8 @@ async def test_analyze_sentiment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - language_service.AnalyzeEntitiesRequest, - dict, + language_service.AnalyzeEntitiesRequest(), + {}, ], ) def test_analyze_entities(request_type, transport: str = "grpc"): @@ -1641,7 +1657,7 @@ def test_analyze_entities(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.analyze_entities), "__call__") as call: @@ -1683,7 +1699,8 @@ def test_analyze_entities_non_empty_request_with_auto_populated_field(): client.analyze_entities(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == language_service.AnalyzeEntitiesRequest() + request_msg = language_service.AnalyzeEntitiesRequest() + assert args[0] == request_msg def test_analyze_entities_use_cached_wrapped_rpc(): @@ -1766,10 +1783,14 @@ async def test_analyze_entities_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_analyze_entities_async( - transport: str = "grpc_asyncio", - request_type=language_service.AnalyzeEntitiesRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + language_service.AnalyzeEntitiesRequest(), + {}, + ], +) +async def test_analyze_entities_async(request_type, transport: str = "grpc_asyncio"): client = LanguageServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1777,7 +1798,7 @@ async def test_analyze_entities_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.analyze_entities), "__call__") as call: @@ -1800,11 +1821,6 @@ async def test_analyze_entities_async( assert response.language == "language_value" -@pytest.mark.asyncio -async def test_analyze_entities_async_from_dict(): - await test_analyze_entities_async(request_type=dict) - - def test_analyze_entities_flattened(): client = LanguageServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1912,8 +1928,8 @@ async def test_analyze_entities_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - language_service.AnalyzeEntitySentimentRequest, - dict, + language_service.AnalyzeEntitySentimentRequest(), + {}, ], ) def test_analyze_entity_sentiment(request_type, transport: str = "grpc"): @@ -1924,7 +1940,7 @@ def test_analyze_entity_sentiment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1970,7 +1986,8 @@ def test_analyze_entity_sentiment_non_empty_request_with_auto_populated_field(): client.analyze_entity_sentiment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == language_service.AnalyzeEntitySentimentRequest() + request_msg = language_service.AnalyzeEntitySentimentRequest() + assert args[0] == request_msg def test_analyze_entity_sentiment_use_cached_wrapped_rpc(): @@ -2056,9 +2073,15 @@ async def test_analyze_entity_sentiment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + language_service.AnalyzeEntitySentimentRequest(), + {}, + ], +) async def test_analyze_entity_sentiment_async( - transport: str = "grpc_asyncio", - request_type=language_service.AnalyzeEntitySentimentRequest, + request_type, transport: str = "grpc_asyncio" ): client = LanguageServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2067,7 +2090,7 @@ async def test_analyze_entity_sentiment_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( @@ -2092,11 +2115,6 @@ async def test_analyze_entity_sentiment_async( assert response.language == "language_value" -@pytest.mark.asyncio -async def test_analyze_entity_sentiment_async_from_dict(): - await test_analyze_entity_sentiment_async(request_type=dict) - - def test_analyze_entity_sentiment_flattened(): client = LanguageServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2208,8 +2226,8 @@ async def test_analyze_entity_sentiment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - language_service.AnalyzeSyntaxRequest, - dict, + language_service.AnalyzeSyntaxRequest(), + {}, ], ) def test_analyze_syntax(request_type, transport: str = "grpc"): @@ -2220,7 +2238,7 @@ def test_analyze_syntax(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.analyze_syntax), "__call__") as call: @@ -2262,7 +2280,8 @@ def test_analyze_syntax_non_empty_request_with_auto_populated_field(): client.analyze_syntax(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == language_service.AnalyzeSyntaxRequest() + request_msg = language_service.AnalyzeSyntaxRequest() + assert args[0] == request_msg def test_analyze_syntax_use_cached_wrapped_rpc(): @@ -2343,9 +2362,14 @@ async def test_analyze_syntax_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_analyze_syntax_async( - transport: str = "grpc_asyncio", request_type=language_service.AnalyzeSyntaxRequest -): +@pytest.mark.parametrize( + "request_type", + [ + language_service.AnalyzeSyntaxRequest(), + {}, + ], +) +async def test_analyze_syntax_async(request_type, transport: str = "grpc_asyncio"): client = LanguageServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2353,7 +2377,7 @@ async def test_analyze_syntax_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.analyze_syntax), "__call__") as call: @@ -2376,11 +2400,6 @@ async def test_analyze_syntax_async( assert response.language == "language_value" -@pytest.mark.asyncio -async def test_analyze_syntax_async_from_dict(): - await test_analyze_syntax_async(request_type=dict) - - def test_analyze_syntax_flattened(): client = LanguageServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2488,8 +2507,8 @@ async def test_analyze_syntax_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - language_service.ClassifyTextRequest, - dict, + language_service.ClassifyTextRequest(), + {}, ], ) def test_classify_text(request_type, transport: str = "grpc"): @@ -2500,7 +2519,7 @@ def test_classify_text(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.classify_text), "__call__") as call: @@ -2539,7 +2558,8 @@ def test_classify_text_non_empty_request_with_auto_populated_field(): client.classify_text(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == language_service.ClassifyTextRequest() + request_msg = language_service.ClassifyTextRequest() + assert args[0] == request_msg def test_classify_text_use_cached_wrapped_rpc(): @@ -2620,9 +2640,14 @@ async def test_classify_text_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_classify_text_async( - transport: str = "grpc_asyncio", request_type=language_service.ClassifyTextRequest -): +@pytest.mark.parametrize( + "request_type", + [ + language_service.ClassifyTextRequest(), + {}, + ], +) +async def test_classify_text_async(request_type, transport: str = "grpc_asyncio"): client = LanguageServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2630,7 +2655,7 @@ async def test_classify_text_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.classify_text), "__call__") as call: @@ -2650,11 +2675,6 @@ async def test_classify_text_async( assert isinstance(response, language_service.ClassifyTextResponse) -@pytest.mark.asyncio -async def test_classify_text_async_from_dict(): - await test_classify_text_async(request_type=dict) - - def test_classify_text_flattened(): client = LanguageServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2752,8 +2772,8 @@ async def test_classify_text_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - language_service.ModerateTextRequest, - dict, + language_service.ModerateTextRequest(), + {}, ], ) def test_moderate_text(request_type, transport: str = "grpc"): @@ -2764,7 +2784,7 @@ def test_moderate_text(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.moderate_text), "__call__") as call: @@ -2803,7 +2823,8 @@ def test_moderate_text_non_empty_request_with_auto_populated_field(): client.moderate_text(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == language_service.ModerateTextRequest() + request_msg = language_service.ModerateTextRequest() + assert args[0] == request_msg def test_moderate_text_use_cached_wrapped_rpc(): @@ -2884,9 +2905,14 @@ async def test_moderate_text_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_moderate_text_async( - transport: str = "grpc_asyncio", request_type=language_service.ModerateTextRequest -): +@pytest.mark.parametrize( + "request_type", + [ + language_service.ModerateTextRequest(), + {}, + ], +) +async def test_moderate_text_async(request_type, transport: str = "grpc_asyncio"): client = LanguageServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2894,7 +2920,7 @@ async def test_moderate_text_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.moderate_text), "__call__") as call: @@ -2914,11 +2940,6 @@ async def test_moderate_text_async( assert isinstance(response, language_service.ModerateTextResponse) -@pytest.mark.asyncio -async def test_moderate_text_async_from_dict(): - await test_moderate_text_async(request_type=dict) - - def test_moderate_text_flattened(): client = LanguageServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3016,8 +3037,8 @@ async def test_moderate_text_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - language_service.AnnotateTextRequest, - dict, + language_service.AnnotateTextRequest(), + {}, ], ) def test_annotate_text(request_type, transport: str = "grpc"): @@ -3028,7 +3049,7 @@ def test_annotate_text(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.annotate_text), "__call__") as call: @@ -3070,7 +3091,8 @@ def test_annotate_text_non_empty_request_with_auto_populated_field(): client.annotate_text(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == language_service.AnnotateTextRequest() + request_msg = language_service.AnnotateTextRequest() + assert args[0] == request_msg def test_annotate_text_use_cached_wrapped_rpc(): @@ -3151,9 +3173,14 @@ async def test_annotate_text_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_annotate_text_async( - transport: str = "grpc_asyncio", request_type=language_service.AnnotateTextRequest -): +@pytest.mark.parametrize( + "request_type", + [ + language_service.AnnotateTextRequest(), + {}, + ], +) +async def test_annotate_text_async(request_type, transport: str = "grpc_asyncio"): client = LanguageServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3161,7 +3188,7 @@ async def test_annotate_text_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.annotate_text), "__call__") as call: @@ -3184,11 +3211,6 @@ async def test_annotate_text_async( assert response.language == "language_value" -@pytest.mark.asyncio -async def test_annotate_text_async_from_dict(): - await test_annotate_text_async(request_type=dict) - - def test_annotate_text_flattened(): client = LanguageServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4691,7 +4713,6 @@ def test_analyze_sentiment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = language_service.AnalyzeSentimentRequest() - assert args[0] == request_msg @@ -4712,7 +4733,6 @@ def test_analyze_entities_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = language_service.AnalyzeEntitiesRequest() - assert args[0] == request_msg @@ -4735,7 +4755,6 @@ def test_analyze_entity_sentiment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = language_service.AnalyzeEntitySentimentRequest() - assert args[0] == request_msg @@ -4756,7 +4775,6 @@ def test_analyze_syntax_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = language_service.AnalyzeSyntaxRequest() - assert args[0] == request_msg @@ -4777,7 +4795,6 @@ def test_classify_text_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = language_service.ClassifyTextRequest() - assert args[0] == request_msg @@ -4798,7 +4815,6 @@ def test_moderate_text_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = language_service.ModerateTextRequest() - assert args[0] == request_msg @@ -4819,7 +4835,6 @@ def test_annotate_text_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = language_service.AnnotateTextRequest() - assert args[0] == request_msg @@ -4862,7 +4877,6 @@ async def test_analyze_sentiment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = language_service.AnalyzeSentimentRequest() - assert args[0] == request_msg @@ -4889,7 +4903,6 @@ async def test_analyze_entities_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = language_service.AnalyzeEntitiesRequest() - assert args[0] == request_msg @@ -4918,7 +4931,6 @@ async def test_analyze_entity_sentiment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = language_service.AnalyzeEntitySentimentRequest() - assert args[0] == request_msg @@ -4945,7 +4957,6 @@ async def test_analyze_syntax_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = language_service.AnalyzeSyntaxRequest() - assert args[0] == request_msg @@ -4970,7 +4981,6 @@ async def test_classify_text_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = language_service.ClassifyTextRequest() - assert args[0] == request_msg @@ -4995,7 +5005,6 @@ async def test_moderate_text_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = language_service.ModerateTextRequest() - assert args[0] == request_msg @@ -5022,7 +5031,6 @@ async def test_annotate_text_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = language_service.AnnotateTextRequest() - assert args[0] == request_msg @@ -6004,7 +6012,6 @@ def test_analyze_sentiment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = language_service.AnalyzeSentimentRequest() - assert args[0] == request_msg @@ -6024,7 +6031,6 @@ def test_analyze_entities_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = language_service.AnalyzeEntitiesRequest() - assert args[0] == request_msg @@ -6046,7 +6052,6 @@ def test_analyze_entity_sentiment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = language_service.AnalyzeEntitySentimentRequest() - assert args[0] == request_msg @@ -6066,7 +6071,6 @@ def test_analyze_syntax_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = language_service.AnalyzeSyntaxRequest() - assert args[0] == request_msg @@ -6086,7 +6090,6 @@ def test_classify_text_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = language_service.ClassifyTextRequest() - assert args[0] == request_msg @@ -6106,7 +6109,6 @@ def test_moderate_text_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = language_service.ModerateTextRequest() - assert args[0] == request_msg @@ -6126,7 +6128,6 @@ def test_annotate_text_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = language_service.AnnotateTextRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-language/tests/unit/gapic/language_v1beta2/test_language_service.py b/packages/google-cloud-language/tests/unit/gapic/language_v1beta2/test_language_service.py index 14815b53aeea..2a15c090ff18 100644 --- a/packages/google-cloud-language/tests/unit/gapic/language_v1beta2/test_language_service.py +++ b/packages/google-cloud-language/tests/unit/gapic/language_v1beta2/test_language_service.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 @@ -106,6 +107,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" @@ -1336,8 +1352,8 @@ def test_language_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - language_service.AnalyzeSentimentRequest, - dict, + language_service.AnalyzeSentimentRequest(), + {}, ], ) def test_analyze_sentiment(request_type, transport: str = "grpc"): @@ -1348,7 +1364,7 @@ def test_analyze_sentiment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1394,7 +1410,8 @@ def test_analyze_sentiment_non_empty_request_with_auto_populated_field(): client.analyze_sentiment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == language_service.AnalyzeSentimentRequest() + request_msg = language_service.AnalyzeSentimentRequest() + assert args[0] == request_msg def test_analyze_sentiment_use_cached_wrapped_rpc(): @@ -1477,10 +1494,14 @@ async def test_analyze_sentiment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_analyze_sentiment_async( - transport: str = "grpc_asyncio", - request_type=language_service.AnalyzeSentimentRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + language_service.AnalyzeSentimentRequest(), + {}, + ], +) +async def test_analyze_sentiment_async(request_type, transport: str = "grpc_asyncio"): client = LanguageServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1488,7 +1509,7 @@ async def test_analyze_sentiment_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( @@ -1513,11 +1534,6 @@ async def test_analyze_sentiment_async( assert response.language == "language_value" -@pytest.mark.asyncio -async def test_analyze_sentiment_async_from_dict(): - await test_analyze_sentiment_async(request_type=dict) - - def test_analyze_sentiment_flattened(): client = LanguageServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1629,8 +1645,8 @@ async def test_analyze_sentiment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - language_service.AnalyzeEntitiesRequest, - dict, + language_service.AnalyzeEntitiesRequest(), + {}, ], ) def test_analyze_entities(request_type, transport: str = "grpc"): @@ -1641,7 +1657,7 @@ def test_analyze_entities(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.analyze_entities), "__call__") as call: @@ -1683,7 +1699,8 @@ def test_analyze_entities_non_empty_request_with_auto_populated_field(): client.analyze_entities(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == language_service.AnalyzeEntitiesRequest() + request_msg = language_service.AnalyzeEntitiesRequest() + assert args[0] == request_msg def test_analyze_entities_use_cached_wrapped_rpc(): @@ -1766,10 +1783,14 @@ async def test_analyze_entities_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_analyze_entities_async( - transport: str = "grpc_asyncio", - request_type=language_service.AnalyzeEntitiesRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + language_service.AnalyzeEntitiesRequest(), + {}, + ], +) +async def test_analyze_entities_async(request_type, transport: str = "grpc_asyncio"): client = LanguageServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1777,7 +1798,7 @@ async def test_analyze_entities_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.analyze_entities), "__call__") as call: @@ -1800,11 +1821,6 @@ async def test_analyze_entities_async( assert response.language == "language_value" -@pytest.mark.asyncio -async def test_analyze_entities_async_from_dict(): - await test_analyze_entities_async(request_type=dict) - - def test_analyze_entities_flattened(): client = LanguageServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1912,8 +1928,8 @@ async def test_analyze_entities_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - language_service.AnalyzeEntitySentimentRequest, - dict, + language_service.AnalyzeEntitySentimentRequest(), + {}, ], ) def test_analyze_entity_sentiment(request_type, transport: str = "grpc"): @@ -1924,7 +1940,7 @@ def test_analyze_entity_sentiment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1970,7 +1986,8 @@ def test_analyze_entity_sentiment_non_empty_request_with_auto_populated_field(): client.analyze_entity_sentiment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == language_service.AnalyzeEntitySentimentRequest() + request_msg = language_service.AnalyzeEntitySentimentRequest() + assert args[0] == request_msg def test_analyze_entity_sentiment_use_cached_wrapped_rpc(): @@ -2056,9 +2073,15 @@ async def test_analyze_entity_sentiment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + language_service.AnalyzeEntitySentimentRequest(), + {}, + ], +) async def test_analyze_entity_sentiment_async( - transport: str = "grpc_asyncio", - request_type=language_service.AnalyzeEntitySentimentRequest, + request_type, transport: str = "grpc_asyncio" ): client = LanguageServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2067,7 +2090,7 @@ async def test_analyze_entity_sentiment_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( @@ -2092,11 +2115,6 @@ async def test_analyze_entity_sentiment_async( assert response.language == "language_value" -@pytest.mark.asyncio -async def test_analyze_entity_sentiment_async_from_dict(): - await test_analyze_entity_sentiment_async(request_type=dict) - - def test_analyze_entity_sentiment_flattened(): client = LanguageServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2208,8 +2226,8 @@ async def test_analyze_entity_sentiment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - language_service.AnalyzeSyntaxRequest, - dict, + language_service.AnalyzeSyntaxRequest(), + {}, ], ) def test_analyze_syntax(request_type, transport: str = "grpc"): @@ -2220,7 +2238,7 @@ def test_analyze_syntax(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.analyze_syntax), "__call__") as call: @@ -2262,7 +2280,8 @@ def test_analyze_syntax_non_empty_request_with_auto_populated_field(): client.analyze_syntax(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == language_service.AnalyzeSyntaxRequest() + request_msg = language_service.AnalyzeSyntaxRequest() + assert args[0] == request_msg def test_analyze_syntax_use_cached_wrapped_rpc(): @@ -2343,9 +2362,14 @@ async def test_analyze_syntax_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_analyze_syntax_async( - transport: str = "grpc_asyncio", request_type=language_service.AnalyzeSyntaxRequest -): +@pytest.mark.parametrize( + "request_type", + [ + language_service.AnalyzeSyntaxRequest(), + {}, + ], +) +async def test_analyze_syntax_async(request_type, transport: str = "grpc_asyncio"): client = LanguageServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2353,7 +2377,7 @@ async def test_analyze_syntax_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.analyze_syntax), "__call__") as call: @@ -2376,11 +2400,6 @@ async def test_analyze_syntax_async( assert response.language == "language_value" -@pytest.mark.asyncio -async def test_analyze_syntax_async_from_dict(): - await test_analyze_syntax_async(request_type=dict) - - def test_analyze_syntax_flattened(): client = LanguageServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2488,8 +2507,8 @@ async def test_analyze_syntax_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - language_service.ClassifyTextRequest, - dict, + language_service.ClassifyTextRequest(), + {}, ], ) def test_classify_text(request_type, transport: str = "grpc"): @@ -2500,7 +2519,7 @@ def test_classify_text(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.classify_text), "__call__") as call: @@ -2539,7 +2558,8 @@ def test_classify_text_non_empty_request_with_auto_populated_field(): client.classify_text(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == language_service.ClassifyTextRequest() + request_msg = language_service.ClassifyTextRequest() + assert args[0] == request_msg def test_classify_text_use_cached_wrapped_rpc(): @@ -2620,9 +2640,14 @@ async def test_classify_text_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_classify_text_async( - transport: str = "grpc_asyncio", request_type=language_service.ClassifyTextRequest -): +@pytest.mark.parametrize( + "request_type", + [ + language_service.ClassifyTextRequest(), + {}, + ], +) +async def test_classify_text_async(request_type, transport: str = "grpc_asyncio"): client = LanguageServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2630,7 +2655,7 @@ async def test_classify_text_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.classify_text), "__call__") as call: @@ -2650,11 +2675,6 @@ async def test_classify_text_async( assert isinstance(response, language_service.ClassifyTextResponse) -@pytest.mark.asyncio -async def test_classify_text_async_from_dict(): - await test_classify_text_async(request_type=dict) - - def test_classify_text_flattened(): client = LanguageServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2752,8 +2772,8 @@ async def test_classify_text_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - language_service.ModerateTextRequest, - dict, + language_service.ModerateTextRequest(), + {}, ], ) def test_moderate_text(request_type, transport: str = "grpc"): @@ -2764,7 +2784,7 @@ def test_moderate_text(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.moderate_text), "__call__") as call: @@ -2803,7 +2823,8 @@ def test_moderate_text_non_empty_request_with_auto_populated_field(): client.moderate_text(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == language_service.ModerateTextRequest() + request_msg = language_service.ModerateTextRequest() + assert args[0] == request_msg def test_moderate_text_use_cached_wrapped_rpc(): @@ -2884,9 +2905,14 @@ async def test_moderate_text_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_moderate_text_async( - transport: str = "grpc_asyncio", request_type=language_service.ModerateTextRequest -): +@pytest.mark.parametrize( + "request_type", + [ + language_service.ModerateTextRequest(), + {}, + ], +) +async def test_moderate_text_async(request_type, transport: str = "grpc_asyncio"): client = LanguageServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2894,7 +2920,7 @@ async def test_moderate_text_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.moderate_text), "__call__") as call: @@ -2914,11 +2940,6 @@ async def test_moderate_text_async( assert isinstance(response, language_service.ModerateTextResponse) -@pytest.mark.asyncio -async def test_moderate_text_async_from_dict(): - await test_moderate_text_async(request_type=dict) - - def test_moderate_text_flattened(): client = LanguageServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3016,8 +3037,8 @@ async def test_moderate_text_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - language_service.AnnotateTextRequest, - dict, + language_service.AnnotateTextRequest(), + {}, ], ) def test_annotate_text(request_type, transport: str = "grpc"): @@ -3028,7 +3049,7 @@ def test_annotate_text(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.annotate_text), "__call__") as call: @@ -3070,7 +3091,8 @@ def test_annotate_text_non_empty_request_with_auto_populated_field(): client.annotate_text(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == language_service.AnnotateTextRequest() + request_msg = language_service.AnnotateTextRequest() + assert args[0] == request_msg def test_annotate_text_use_cached_wrapped_rpc(): @@ -3151,9 +3173,14 @@ async def test_annotate_text_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_annotate_text_async( - transport: str = "grpc_asyncio", request_type=language_service.AnnotateTextRequest -): +@pytest.mark.parametrize( + "request_type", + [ + language_service.AnnotateTextRequest(), + {}, + ], +) +async def test_annotate_text_async(request_type, transport: str = "grpc_asyncio"): client = LanguageServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3161,7 +3188,7 @@ async def test_annotate_text_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.annotate_text), "__call__") as call: @@ -3184,11 +3211,6 @@ async def test_annotate_text_async( assert response.language == "language_value" -@pytest.mark.asyncio -async def test_annotate_text_async_from_dict(): - await test_annotate_text_async(request_type=dict) - - def test_annotate_text_flattened(): client = LanguageServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4692,7 +4714,6 @@ def test_analyze_sentiment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = language_service.AnalyzeSentimentRequest() - assert args[0] == request_msg @@ -4713,7 +4734,6 @@ def test_analyze_entities_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = language_service.AnalyzeEntitiesRequest() - assert args[0] == request_msg @@ -4736,7 +4756,6 @@ def test_analyze_entity_sentiment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = language_service.AnalyzeEntitySentimentRequest() - assert args[0] == request_msg @@ -4757,7 +4776,6 @@ def test_analyze_syntax_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = language_service.AnalyzeSyntaxRequest() - assert args[0] == request_msg @@ -4778,7 +4796,6 @@ def test_classify_text_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = language_service.ClassifyTextRequest() - assert args[0] == request_msg @@ -4799,7 +4816,6 @@ def test_moderate_text_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = language_service.ModerateTextRequest() - assert args[0] == request_msg @@ -4820,7 +4836,6 @@ def test_annotate_text_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = language_service.AnnotateTextRequest() - assert args[0] == request_msg @@ -4863,7 +4878,6 @@ async def test_analyze_sentiment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = language_service.AnalyzeSentimentRequest() - assert args[0] == request_msg @@ -4890,7 +4904,6 @@ async def test_analyze_entities_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = language_service.AnalyzeEntitiesRequest() - assert args[0] == request_msg @@ -4919,7 +4932,6 @@ async def test_analyze_entity_sentiment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = language_service.AnalyzeEntitySentimentRequest() - assert args[0] == request_msg @@ -4946,7 +4958,6 @@ async def test_analyze_syntax_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = language_service.AnalyzeSyntaxRequest() - assert args[0] == request_msg @@ -4971,7 +4982,6 @@ async def test_classify_text_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = language_service.ClassifyTextRequest() - assert args[0] == request_msg @@ -4996,7 +5006,6 @@ async def test_moderate_text_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = language_service.ModerateTextRequest() - assert args[0] == request_msg @@ -5023,7 +5032,6 @@ async def test_annotate_text_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = language_service.AnnotateTextRequest() - assert args[0] == request_msg @@ -6005,7 +6013,6 @@ def test_analyze_sentiment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = language_service.AnalyzeSentimentRequest() - assert args[0] == request_msg @@ -6025,7 +6032,6 @@ def test_analyze_entities_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = language_service.AnalyzeEntitiesRequest() - assert args[0] == request_msg @@ -6047,7 +6053,6 @@ def test_analyze_entity_sentiment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = language_service.AnalyzeEntitySentimentRequest() - assert args[0] == request_msg @@ -6067,7 +6072,6 @@ def test_analyze_syntax_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = language_service.AnalyzeSyntaxRequest() - assert args[0] == request_msg @@ -6087,7 +6091,6 @@ def test_classify_text_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = language_service.ClassifyTextRequest() - assert args[0] == request_msg @@ -6107,7 +6110,6 @@ def test_moderate_text_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = language_service.ModerateTextRequest() - assert args[0] == request_msg @@ -6127,7 +6129,6 @@ def test_annotate_text_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = language_service.AnnotateTextRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-language/tests/unit/gapic/language_v2/test_language_service.py b/packages/google-cloud-language/tests/unit/gapic/language_v2/test_language_service.py index d878a9b3b7a0..2d23000e2da2 100644 --- a/packages/google-cloud-language/tests/unit/gapic/language_v2/test_language_service.py +++ b/packages/google-cloud-language/tests/unit/gapic/language_v2/test_language_service.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 @@ -106,6 +107,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" @@ -1336,8 +1352,8 @@ def test_language_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - language_service.AnalyzeSentimentRequest, - dict, + language_service.AnalyzeSentimentRequest(), + {}, ], ) def test_analyze_sentiment(request_type, transport: str = "grpc"): @@ -1348,7 +1364,7 @@ def test_analyze_sentiment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1396,7 +1412,8 @@ def test_analyze_sentiment_non_empty_request_with_auto_populated_field(): client.analyze_sentiment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == language_service.AnalyzeSentimentRequest() + request_msg = language_service.AnalyzeSentimentRequest() + assert args[0] == request_msg def test_analyze_sentiment_use_cached_wrapped_rpc(): @@ -1479,10 +1496,14 @@ async def test_analyze_sentiment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_analyze_sentiment_async( - transport: str = "grpc_asyncio", - request_type=language_service.AnalyzeSentimentRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + language_service.AnalyzeSentimentRequest(), + {}, + ], +) +async def test_analyze_sentiment_async(request_type, transport: str = "grpc_asyncio"): client = LanguageServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1490,7 +1511,7 @@ async def test_analyze_sentiment_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( @@ -1517,11 +1538,6 @@ async def test_analyze_sentiment_async( assert response.language_supported is True -@pytest.mark.asyncio -async def test_analyze_sentiment_async_from_dict(): - await test_analyze_sentiment_async(request_type=dict) - - def test_analyze_sentiment_flattened(): client = LanguageServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1633,8 +1649,8 @@ async def test_analyze_sentiment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - language_service.AnalyzeEntitiesRequest, - dict, + language_service.AnalyzeEntitiesRequest(), + {}, ], ) def test_analyze_entities(request_type, transport: str = "grpc"): @@ -1645,7 +1661,7 @@ def test_analyze_entities(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.analyze_entities), "__call__") as call: @@ -1689,7 +1705,8 @@ def test_analyze_entities_non_empty_request_with_auto_populated_field(): client.analyze_entities(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == language_service.AnalyzeEntitiesRequest() + request_msg = language_service.AnalyzeEntitiesRequest() + assert args[0] == request_msg def test_analyze_entities_use_cached_wrapped_rpc(): @@ -1772,10 +1789,14 @@ async def test_analyze_entities_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_analyze_entities_async( - transport: str = "grpc_asyncio", - request_type=language_service.AnalyzeEntitiesRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + language_service.AnalyzeEntitiesRequest(), + {}, + ], +) +async def test_analyze_entities_async(request_type, transport: str = "grpc_asyncio"): client = LanguageServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1783,7 +1804,7 @@ async def test_analyze_entities_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.analyze_entities), "__call__") as call: @@ -1808,11 +1829,6 @@ async def test_analyze_entities_async( assert response.language_supported is True -@pytest.mark.asyncio -async def test_analyze_entities_async_from_dict(): - await test_analyze_entities_async(request_type=dict) - - def test_analyze_entities_flattened(): client = LanguageServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1920,8 +1936,8 @@ async def test_analyze_entities_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - language_service.ClassifyTextRequest, - dict, + language_service.ClassifyTextRequest(), + {}, ], ) def test_classify_text(request_type, transport: str = "grpc"): @@ -1932,7 +1948,7 @@ def test_classify_text(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.classify_text), "__call__") as call: @@ -1976,7 +1992,8 @@ def test_classify_text_non_empty_request_with_auto_populated_field(): client.classify_text(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == language_service.ClassifyTextRequest() + request_msg = language_service.ClassifyTextRequest() + assert args[0] == request_msg def test_classify_text_use_cached_wrapped_rpc(): @@ -2057,9 +2074,14 @@ async def test_classify_text_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_classify_text_async( - transport: str = "grpc_asyncio", request_type=language_service.ClassifyTextRequest -): +@pytest.mark.parametrize( + "request_type", + [ + language_service.ClassifyTextRequest(), + {}, + ], +) +async def test_classify_text_async(request_type, transport: str = "grpc_asyncio"): client = LanguageServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2067,7 +2089,7 @@ async def test_classify_text_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.classify_text), "__call__") as call: @@ -2092,11 +2114,6 @@ async def test_classify_text_async( assert response.language_supported is True -@pytest.mark.asyncio -async def test_classify_text_async_from_dict(): - await test_classify_text_async(request_type=dict) - - def test_classify_text_flattened(): client = LanguageServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2194,8 +2211,8 @@ async def test_classify_text_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - language_service.ModerateTextRequest, - dict, + language_service.ModerateTextRequest(), + {}, ], ) def test_moderate_text(request_type, transport: str = "grpc"): @@ -2206,7 +2223,7 @@ def test_moderate_text(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.moderate_text), "__call__") as call: @@ -2250,7 +2267,8 @@ def test_moderate_text_non_empty_request_with_auto_populated_field(): client.moderate_text(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == language_service.ModerateTextRequest() + request_msg = language_service.ModerateTextRequest() + assert args[0] == request_msg def test_moderate_text_use_cached_wrapped_rpc(): @@ -2331,9 +2349,14 @@ async def test_moderate_text_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_moderate_text_async( - transport: str = "grpc_asyncio", request_type=language_service.ModerateTextRequest -): +@pytest.mark.parametrize( + "request_type", + [ + language_service.ModerateTextRequest(), + {}, + ], +) +async def test_moderate_text_async(request_type, transport: str = "grpc_asyncio"): client = LanguageServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2341,7 +2364,7 @@ async def test_moderate_text_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.moderate_text), "__call__") as call: @@ -2366,11 +2389,6 @@ async def test_moderate_text_async( assert response.language_supported is True -@pytest.mark.asyncio -async def test_moderate_text_async_from_dict(): - await test_moderate_text_async(request_type=dict) - - def test_moderate_text_flattened(): client = LanguageServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2468,8 +2486,8 @@ async def test_moderate_text_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - language_service.AnnotateTextRequest, - dict, + language_service.AnnotateTextRequest(), + {}, ], ) def test_annotate_text(request_type, transport: str = "grpc"): @@ -2480,7 +2498,7 @@ def test_annotate_text(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.annotate_text), "__call__") as call: @@ -2524,7 +2542,8 @@ def test_annotate_text_non_empty_request_with_auto_populated_field(): client.annotate_text(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == language_service.AnnotateTextRequest() + request_msg = language_service.AnnotateTextRequest() + assert args[0] == request_msg def test_annotate_text_use_cached_wrapped_rpc(): @@ -2605,9 +2624,14 @@ async def test_annotate_text_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_annotate_text_async( - transport: str = "grpc_asyncio", request_type=language_service.AnnotateTextRequest -): +@pytest.mark.parametrize( + "request_type", + [ + language_service.AnnotateTextRequest(), + {}, + ], +) +async def test_annotate_text_async(request_type, transport: str = "grpc_asyncio"): client = LanguageServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2615,7 +2639,7 @@ async def test_annotate_text_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.annotate_text), "__call__") as call: @@ -2640,11 +2664,6 @@ async def test_annotate_text_async( assert response.language_supported is True -@pytest.mark.asyncio -async def test_annotate_text_async_from_dict(): - await test_annotate_text_async(request_type=dict) - - def test_annotate_text_flattened(): client = LanguageServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3796,7 +3815,6 @@ def test_analyze_sentiment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = language_service.AnalyzeSentimentRequest() - assert args[0] == request_msg @@ -3817,7 +3835,6 @@ def test_analyze_entities_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = language_service.AnalyzeEntitiesRequest() - assert args[0] == request_msg @@ -3838,7 +3855,6 @@ def test_classify_text_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = language_service.ClassifyTextRequest() - assert args[0] == request_msg @@ -3859,7 +3875,6 @@ def test_moderate_text_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = language_service.ModerateTextRequest() - assert args[0] == request_msg @@ -3880,7 +3895,6 @@ def test_annotate_text_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = language_service.AnnotateTextRequest() - assert args[0] == request_msg @@ -3924,7 +3938,6 @@ async def test_analyze_sentiment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = language_service.AnalyzeSentimentRequest() - assert args[0] == request_msg @@ -3952,7 +3965,6 @@ async def test_analyze_entities_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = language_service.AnalyzeEntitiesRequest() - assert args[0] == request_msg @@ -3980,7 +3992,6 @@ async def test_classify_text_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = language_service.ClassifyTextRequest() - assert args[0] == request_msg @@ -4008,7 +4019,6 @@ async def test_moderate_text_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = language_service.ModerateTextRequest() - assert args[0] == request_msg @@ -4036,7 +4046,6 @@ async def test_annotate_text_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = language_service.AnnotateTextRequest() - assert args[0] == request_msg @@ -4762,7 +4771,6 @@ def test_analyze_sentiment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = language_service.AnalyzeSentimentRequest() - assert args[0] == request_msg @@ -4782,7 +4790,6 @@ def test_analyze_entities_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = language_service.AnalyzeEntitiesRequest() - assert args[0] == request_msg @@ -4802,7 +4809,6 @@ def test_classify_text_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = language_service.ClassifyTextRequest() - assert args[0] == request_msg @@ -4822,7 +4828,6 @@ def test_moderate_text_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = language_service.ModerateTextRequest() - assert args[0] == request_msg @@ -4842,7 +4847,6 @@ def test_annotate_text_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = language_service.AnnotateTextRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-licensemanager/noxfile.py b/packages/google-cloud-licensemanager/noxfile.py index 13a0d772d37d..faab51c77445 100644 --- a/packages/google-cloud-licensemanager/noxfile.py +++ b/packages/google-cloud-licensemanager/noxfile.py @@ -47,7 +47,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-licensemanager" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-licensemanager/setup.py b/packages/google-cloud-licensemanager/setup.py index 66c16072049d..e6ae92e3cc25 100644 --- a/packages/google-cloud-licensemanager/setup.py +++ b/packages/google-cloud-licensemanager/setup.py @@ -45,7 +45,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/google-cloud-licensemanager/testing/constraints-3.10.txt b/packages/google-cloud-licensemanager/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-licensemanager/testing/constraints-3.10.txt +++ b/packages/google-cloud-licensemanager/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-licensemanager/tests/unit/gapic/licensemanager_v1/test_license_manager.py b/packages/google-cloud-licensemanager/tests/unit/gapic/licensemanager_v1/test_license_manager.py index 0bd382b98389..495a823bd0bf 100644 --- a/packages/google-cloud-licensemanager/tests/unit/gapic/licensemanager_v1/test_license_manager.py +++ b/packages/google-cloud-licensemanager/tests/unit/gapic/licensemanager_v1/test_license_manager.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 @@ -116,6 +117,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" @@ -1319,8 +1335,8 @@ def test_license_manager_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - licensemanager.ListConfigurationsRequest, - dict, + licensemanager.ListConfigurationsRequest(), + {}, ], ) def test_list_configurations(request_type, transport: str = "grpc"): @@ -1331,7 +1347,7 @@ def test_list_configurations(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1384,12 +1400,13 @@ def test_list_configurations_non_empty_request_with_auto_populated_field(): client.list_configurations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == licensemanager.ListConfigurationsRequest( + request_msg = licensemanager.ListConfigurationsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_configurations_use_cached_wrapped_rpc(): @@ -1474,10 +1491,14 @@ async def test_list_configurations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_configurations_async( - transport: str = "grpc_asyncio", - request_type=licensemanager.ListConfigurationsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + licensemanager.ListConfigurationsRequest(), + {}, + ], +) +async def test_list_configurations_async(request_type, transport: str = "grpc_asyncio"): client = LicenseManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1485,7 +1506,7 @@ async def test_list_configurations_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( @@ -1512,11 +1533,6 @@ async def test_list_configurations_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_configurations_async_from_dict(): - await test_list_configurations_async(request_type=dict) - - def test_list_configurations_field_headers(): client = LicenseManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1869,8 +1885,8 @@ async def test_list_configurations_async_pages(): @pytest.mark.parametrize( "request_type", [ - licensemanager.GetConfigurationRequest, - dict, + licensemanager.GetConfigurationRequest(), + {}, ], ) def test_get_configuration(request_type, transport: str = "grpc"): @@ -1881,7 +1897,7 @@ def test_get_configuration(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1940,9 +1956,10 @@ def test_get_configuration_non_empty_request_with_auto_populated_field(): client.get_configuration(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == licensemanager.GetConfigurationRequest( + request_msg = licensemanager.GetConfigurationRequest( name="name_value", ) + assert args[0] == request_msg def test_get_configuration_use_cached_wrapped_rpc(): @@ -2025,9 +2042,14 @@ async def test_get_configuration_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_configuration_async( - transport: str = "grpc_asyncio", request_type=licensemanager.GetConfigurationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + licensemanager.GetConfigurationRequest(), + {}, + ], +) +async def test_get_configuration_async(request_type, transport: str = "grpc_asyncio"): client = LicenseManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2035,7 +2057,7 @@ async def test_get_configuration_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( @@ -2071,11 +2093,6 @@ async def test_get_configuration_async( assert response.state == api_entities.Configuration.State.STATE_ACTIVE -@pytest.mark.asyncio -async def test_get_configuration_async_from_dict(): - await test_get_configuration_async(request_type=dict) - - def test_get_configuration_field_headers(): client = LicenseManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2230,8 +2247,8 @@ async def test_get_configuration_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - licensemanager.CreateConfigurationRequest, - dict, + licensemanager.CreateConfigurationRequest(), + {}, ], ) def test_create_configuration(request_type, transport: str = "grpc"): @@ -2242,7 +2259,7 @@ def test_create_configuration(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2288,10 +2305,11 @@ def test_create_configuration_non_empty_request_with_auto_populated_field(): client.create_configuration(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == licensemanager.CreateConfigurationRequest( + request_msg = licensemanager.CreateConfigurationRequest( parent="parent_value", configuration_id="configuration_id_value", ) + assert args[0] == request_msg def test_create_configuration_use_cached_wrapped_rpc(): @@ -2386,9 +2404,15 @@ async def test_create_configuration_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + licensemanager.CreateConfigurationRequest(), + {}, + ], +) async def test_create_configuration_async( - transport: str = "grpc_asyncio", - request_type=licensemanager.CreateConfigurationRequest, + request_type, transport: str = "grpc_asyncio" ): client = LicenseManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -2397,7 +2421,7 @@ async def test_create_configuration_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( @@ -2419,11 +2443,6 @@ async def test_create_configuration_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_configuration_async_from_dict(): - await test_create_configuration_async(request_type=dict) - - def test_create_configuration_field_headers(): client = LicenseManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2598,8 +2617,8 @@ async def test_create_configuration_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - licensemanager.UpdateConfigurationRequest, - dict, + licensemanager.UpdateConfigurationRequest(), + {}, ], ) def test_update_configuration(request_type, transport: str = "grpc"): @@ -2610,7 +2629,7 @@ def test_update_configuration(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2653,7 +2672,8 @@ def test_update_configuration_non_empty_request_with_auto_populated_field(): client.update_configuration(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == licensemanager.UpdateConfigurationRequest() + request_msg = licensemanager.UpdateConfigurationRequest() + assert args[0] == request_msg def test_update_configuration_use_cached_wrapped_rpc(): @@ -2748,9 +2768,15 @@ async def test_update_configuration_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + licensemanager.UpdateConfigurationRequest(), + {}, + ], +) async def test_update_configuration_async( - transport: str = "grpc_asyncio", - request_type=licensemanager.UpdateConfigurationRequest, + request_type, transport: str = "grpc_asyncio" ): client = LicenseManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -2759,7 +2785,7 @@ async def test_update_configuration_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( @@ -2781,11 +2807,6 @@ async def test_update_configuration_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_configuration_async_from_dict(): - await test_update_configuration_async(request_type=dict) - - def test_update_configuration_field_headers(): client = LicenseManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2950,8 +2971,8 @@ async def test_update_configuration_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - licensemanager.DeleteConfigurationRequest, - dict, + licensemanager.DeleteConfigurationRequest(), + {}, ], ) def test_delete_configuration(request_type, transport: str = "grpc"): @@ -2962,7 +2983,7 @@ def test_delete_configuration(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3007,9 +3028,10 @@ def test_delete_configuration_non_empty_request_with_auto_populated_field(): client.delete_configuration(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == licensemanager.DeleteConfigurationRequest( + request_msg = licensemanager.DeleteConfigurationRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_configuration_use_cached_wrapped_rpc(): @@ -3104,9 +3126,15 @@ async def test_delete_configuration_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + licensemanager.DeleteConfigurationRequest(), + {}, + ], +) async def test_delete_configuration_async( - transport: str = "grpc_asyncio", - request_type=licensemanager.DeleteConfigurationRequest, + request_type, transport: str = "grpc_asyncio" ): client = LicenseManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -3115,7 +3143,7 @@ async def test_delete_configuration_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( @@ -3137,11 +3165,6 @@ async def test_delete_configuration_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_configuration_async_from_dict(): - await test_delete_configuration_async(request_type=dict) - - def test_delete_configuration_field_headers(): client = LicenseManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3296,8 +3319,8 @@ async def test_delete_configuration_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - licensemanager.ListInstancesRequest, - dict, + licensemanager.ListInstancesRequest(), + {}, ], ) def test_list_instances(request_type, transport: str = "grpc"): @@ -3308,7 +3331,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(type(client.transport.list_instances), "__call__") as call: @@ -3357,12 +3380,13 @@ 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] == licensemanager.ListInstancesRequest( + request_msg = licensemanager.ListInstancesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_instances_use_cached_wrapped_rpc(): @@ -3443,9 +3467,14 @@ async def test_list_instances_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_instances_async( - transport: str = "grpc_asyncio", request_type=licensemanager.ListInstancesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + licensemanager.ListInstancesRequest(), + {}, + ], +) +async def test_list_instances_async(request_type, transport: str = "grpc_asyncio"): client = LicenseManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3453,7 +3482,7 @@ async def test_list_instances_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_instances), "__call__") as call: @@ -3478,11 +3507,6 @@ async def test_list_instances_async( 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 = LicenseManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3819,8 +3843,8 @@ async def test_list_instances_async_pages(): @pytest.mark.parametrize( "request_type", [ - licensemanager.GetInstanceRequest, - dict, + licensemanager.GetInstanceRequest(), + {}, ], ) def test_get_instance(request_type, transport: str = "grpc"): @@ -3831,7 +3855,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(type(client.transport.get_instance), "__call__") as call: @@ -3883,9 +3907,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] == licensemanager.GetInstanceRequest( + request_msg = licensemanager.GetInstanceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_instance_use_cached_wrapped_rpc(): @@ -3966,9 +3991,14 @@ async def test_get_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_instance_async( - transport: str = "grpc_asyncio", request_type=licensemanager.GetInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + licensemanager.GetInstanceRequest(), + {}, + ], +) +async def test_get_instance_async(request_type, transport: str = "grpc_asyncio"): client = LicenseManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3976,7 +4006,7 @@ async def test_get_instance_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_instance), "__call__") as call: @@ -4007,11 +4037,6 @@ async def test_get_instance_async( assert response.compute_instance == "compute_instance_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 = LicenseManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4158,8 +4183,8 @@ async def test_get_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - licensemanager.DeactivateConfigurationRequest, - dict, + licensemanager.DeactivateConfigurationRequest(), + {}, ], ) def test_deactivate_configuration(request_type, transport: str = "grpc"): @@ -4170,7 +4195,7 @@ def test_deactivate_configuration(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4215,9 +4240,10 @@ def test_deactivate_configuration_non_empty_request_with_auto_populated_field(): client.deactivate_configuration(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == licensemanager.DeactivateConfigurationRequest( + request_msg = licensemanager.DeactivateConfigurationRequest( name="name_value", ) + assert args[0] == request_msg def test_deactivate_configuration_use_cached_wrapped_rpc(): @@ -4313,9 +4339,15 @@ async def test_deactivate_configuration_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + licensemanager.DeactivateConfigurationRequest(), + {}, + ], +) async def test_deactivate_configuration_async( - transport: str = "grpc_asyncio", - request_type=licensemanager.DeactivateConfigurationRequest, + request_type, transport: str = "grpc_asyncio" ): client = LicenseManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -4324,7 +4356,7 @@ async def test_deactivate_configuration_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( @@ -4346,11 +4378,6 @@ async def test_deactivate_configuration_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_deactivate_configuration_async_from_dict(): - await test_deactivate_configuration_async(request_type=dict) - - def test_deactivate_configuration_field_headers(): client = LicenseManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4505,8 +4532,8 @@ async def test_deactivate_configuration_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - licensemanager.ReactivateConfigurationRequest, - dict, + licensemanager.ReactivateConfigurationRequest(), + {}, ], ) def test_reactivate_configuration(request_type, transport: str = "grpc"): @@ -4517,7 +4544,7 @@ def test_reactivate_configuration(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4562,9 +4589,10 @@ def test_reactivate_configuration_non_empty_request_with_auto_populated_field(): client.reactivate_configuration(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == licensemanager.ReactivateConfigurationRequest( + request_msg = licensemanager.ReactivateConfigurationRequest( name="name_value", ) + assert args[0] == request_msg def test_reactivate_configuration_use_cached_wrapped_rpc(): @@ -4660,9 +4688,15 @@ async def test_reactivate_configuration_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + licensemanager.ReactivateConfigurationRequest(), + {}, + ], +) async def test_reactivate_configuration_async( - transport: str = "grpc_asyncio", - request_type=licensemanager.ReactivateConfigurationRequest, + request_type, transport: str = "grpc_asyncio" ): client = LicenseManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -4671,7 +4705,7 @@ async def test_reactivate_configuration_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( @@ -4693,11 +4727,6 @@ async def test_reactivate_configuration_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_reactivate_configuration_async_from_dict(): - await test_reactivate_configuration_async(request_type=dict) - - def test_reactivate_configuration_field_headers(): client = LicenseManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4852,8 +4881,8 @@ async def test_reactivate_configuration_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - licensemanager.QueryConfigurationLicenseUsageRequest, - dict, + licensemanager.QueryConfigurationLicenseUsageRequest(), + {}, ], ) def test_query_configuration_license_usage(request_type, transport: str = "grpc"): @@ -4864,7 +4893,7 @@ def test_query_configuration_license_usage(request_type, transport: str = "grpc" # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4909,9 +4938,10 @@ def test_query_configuration_license_usage_non_empty_request_with_auto_populated client.query_configuration_license_usage(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == licensemanager.QueryConfigurationLicenseUsageRequest( + request_msg = licensemanager.QueryConfigurationLicenseUsageRequest( name="name_value", ) + assert args[0] == request_msg def test_query_configuration_license_usage_use_cached_wrapped_rpc(): @@ -4997,9 +5027,15 @@ async def test_query_configuration_license_usage_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + licensemanager.QueryConfigurationLicenseUsageRequest(), + {}, + ], +) async def test_query_configuration_license_usage_async( - transport: str = "grpc_asyncio", - request_type=licensemanager.QueryConfigurationLicenseUsageRequest, + request_type, transport: str = "grpc_asyncio" ): client = LicenseManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -5008,7 +5044,7 @@ async def test_query_configuration_license_usage_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( @@ -5030,11 +5066,6 @@ async def test_query_configuration_license_usage_async( assert isinstance(response, licensemanager.QueryConfigurationLicenseUsageResponse) -@pytest.mark.asyncio -async def test_query_configuration_license_usage_async_from_dict(): - await test_query_configuration_license_usage_async(request_type=dict) - - def test_query_configuration_license_usage_field_headers(): client = LicenseManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5209,8 +5240,8 @@ async def test_query_configuration_license_usage_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - licensemanager.AggregateUsageRequest, - dict, + licensemanager.AggregateUsageRequest(), + {}, ], ) def test_aggregate_usage(request_type, transport: str = "grpc"): @@ -5221,7 +5252,7 @@ def test_aggregate_usage(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.aggregate_usage), "__call__") as call: @@ -5270,12 +5301,13 @@ def test_aggregate_usage_non_empty_request_with_auto_populated_field(): client.aggregate_usage(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == licensemanager.AggregateUsageRequest( + request_msg = licensemanager.AggregateUsageRequest( name="name_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_aggregate_usage_use_cached_wrapped_rpc(): @@ -5356,9 +5388,14 @@ async def test_aggregate_usage_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_aggregate_usage_async( - transport: str = "grpc_asyncio", request_type=licensemanager.AggregateUsageRequest -): +@pytest.mark.parametrize( + "request_type", + [ + licensemanager.AggregateUsageRequest(), + {}, + ], +) +async def test_aggregate_usage_async(request_type, transport: str = "grpc_asyncio"): client = LicenseManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5366,7 +5403,7 @@ async def test_aggregate_usage_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.aggregate_usage), "__call__") as call: @@ -5391,11 +5428,6 @@ async def test_aggregate_usage_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_aggregate_usage_async_from_dict(): - await test_aggregate_usage_async(request_type=dict) - - def test_aggregate_usage_field_headers(): client = LicenseManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5752,8 +5784,8 @@ async def test_aggregate_usage_async_pages(): @pytest.mark.parametrize( "request_type", [ - licensemanager.ListProductsRequest, - dict, + licensemanager.ListProductsRequest(), + {}, ], ) def test_list_products(request_type, transport: str = "grpc"): @@ -5764,7 +5796,7 @@ def test_list_products(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_products), "__call__") as call: @@ -5813,12 +5845,13 @@ def test_list_products_non_empty_request_with_auto_populated_field(): client.list_products(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == licensemanager.ListProductsRequest( + request_msg = licensemanager.ListProductsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_products_use_cached_wrapped_rpc(): @@ -5899,9 +5932,14 @@ async def test_list_products_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_products_async( - transport: str = "grpc_asyncio", request_type=licensemanager.ListProductsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + licensemanager.ListProductsRequest(), + {}, + ], +) +async def test_list_products_async(request_type, transport: str = "grpc_asyncio"): client = LicenseManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5909,7 +5947,7 @@ async def test_list_products_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_products), "__call__") as call: @@ -5934,11 +5972,6 @@ async def test_list_products_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_products_async_from_dict(): - await test_list_products_async(request_type=dict) - - def test_list_products_field_headers(): client = LicenseManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6275,8 +6308,8 @@ async def test_list_products_async_pages(): @pytest.mark.parametrize( "request_type", [ - licensemanager.GetProductRequest, - dict, + licensemanager.GetProductRequest(), + {}, ], ) def test_get_product(request_type, transport: str = "grpc"): @@ -6287,7 +6320,7 @@ def test_get_product(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_product), "__call__") as call: @@ -6343,9 +6376,10 @@ def test_get_product_non_empty_request_with_auto_populated_field(): client.get_product(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == licensemanager.GetProductRequest( + request_msg = licensemanager.GetProductRequest( name="name_value", ) + assert args[0] == request_msg def test_get_product_use_cached_wrapped_rpc(): @@ -6426,9 +6460,14 @@ async def test_get_product_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_product_async( - transport: str = "grpc_asyncio", request_type=licensemanager.GetProductRequest -): +@pytest.mark.parametrize( + "request_type", + [ + licensemanager.GetProductRequest(), + {}, + ], +) +async def test_get_product_async(request_type, transport: str = "grpc_asyncio"): client = LicenseManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6436,7 +6475,7 @@ async def test_get_product_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_product), "__call__") as call: @@ -6471,11 +6510,6 @@ async def test_get_product_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_get_product_async_from_dict(): - await test_get_product_async(request_type=dict) - - def test_get_product_field_headers(): client = LicenseManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9533,7 +9567,6 @@ def test_list_configurations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = licensemanager.ListConfigurationsRequest() - assert args[0] == request_msg @@ -9556,7 +9589,6 @@ def test_get_configuration_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = licensemanager.GetConfigurationRequest() - assert args[0] == request_msg @@ -9579,7 +9611,6 @@ def test_create_configuration_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = licensemanager.CreateConfigurationRequest() - assert args[0] == request_msg @@ -9602,7 +9633,6 @@ def test_update_configuration_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = licensemanager.UpdateConfigurationRequest() - assert args[0] == request_msg @@ -9625,7 +9655,6 @@ def test_delete_configuration_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = licensemanager.DeleteConfigurationRequest() - assert args[0] == request_msg @@ -9646,7 +9675,6 @@ def test_list_instances_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = licensemanager.ListInstancesRequest() - assert args[0] == request_msg @@ -9667,7 +9695,6 @@ def test_get_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = licensemanager.GetInstanceRequest() - assert args[0] == request_msg @@ -9690,7 +9717,6 @@ def test_deactivate_configuration_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = licensemanager.DeactivateConfigurationRequest() - assert args[0] == request_msg @@ -9713,7 +9739,6 @@ def test_reactivate_configuration_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = licensemanager.ReactivateConfigurationRequest() - assert args[0] == request_msg @@ -9736,7 +9761,6 @@ def test_query_configuration_license_usage_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = licensemanager.QueryConfigurationLicenseUsageRequest() - assert args[0] == request_msg @@ -9757,7 +9781,6 @@ def test_aggregate_usage_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = licensemanager.AggregateUsageRequest() - assert args[0] == request_msg @@ -9778,7 +9801,6 @@ def test_list_products_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = licensemanager.ListProductsRequest() - assert args[0] == request_msg @@ -9799,7 +9821,6 @@ def test_get_product_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = licensemanager.GetProductRequest() - assert args[0] == request_msg @@ -9843,7 +9864,6 @@ async def test_list_configurations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = licensemanager.ListConfigurationsRequest() - assert args[0] == request_msg @@ -9876,7 +9896,6 @@ async def test_get_configuration_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = licensemanager.GetConfigurationRequest() - assert args[0] == request_msg @@ -9903,7 +9922,6 @@ async def test_create_configuration_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = licensemanager.CreateConfigurationRequest() - assert args[0] == request_msg @@ -9930,7 +9948,6 @@ async def test_update_configuration_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = licensemanager.UpdateConfigurationRequest() - assert args[0] == request_msg @@ -9957,7 +9974,6 @@ async def test_delete_configuration_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = licensemanager.DeleteConfigurationRequest() - assert args[0] == request_msg @@ -9985,7 +10001,6 @@ async def test_list_instances_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = licensemanager.ListInstancesRequest() - assert args[0] == request_msg @@ -10016,7 +10031,6 @@ async def test_get_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = licensemanager.GetInstanceRequest() - assert args[0] == request_msg @@ -10043,7 +10057,6 @@ async def test_deactivate_configuration_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = licensemanager.DeactivateConfigurationRequest() - assert args[0] == request_msg @@ -10070,7 +10083,6 @@ async def test_reactivate_configuration_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = licensemanager.ReactivateConfigurationRequest() - assert args[0] == request_msg @@ -10097,7 +10109,6 @@ async def test_query_configuration_license_usage_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = licensemanager.QueryConfigurationLicenseUsageRequest() - assert args[0] == request_msg @@ -10125,7 +10136,6 @@ async def test_aggregate_usage_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = licensemanager.AggregateUsageRequest() - assert args[0] == request_msg @@ -10153,7 +10163,6 @@ async def test_list_products_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = licensemanager.ListProductsRequest() - assert args[0] == request_msg @@ -10186,7 +10195,6 @@ async def test_get_product_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = licensemanager.GetProductRequest() - assert args[0] == request_msg @@ -12506,7 +12514,6 @@ def test_list_configurations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = licensemanager.ListConfigurationsRequest() - assert args[0] == request_msg @@ -12528,7 +12535,6 @@ def test_get_configuration_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = licensemanager.GetConfigurationRequest() - assert args[0] == request_msg @@ -12550,7 +12556,6 @@ def test_create_configuration_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = licensemanager.CreateConfigurationRequest() - assert args[0] == request_msg @@ -12572,7 +12577,6 @@ def test_update_configuration_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = licensemanager.UpdateConfigurationRequest() - assert args[0] == request_msg @@ -12594,7 +12598,6 @@ def test_delete_configuration_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = licensemanager.DeleteConfigurationRequest() - assert args[0] == request_msg @@ -12614,7 +12617,6 @@ def test_list_instances_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = licensemanager.ListInstancesRequest() - assert args[0] == request_msg @@ -12634,7 +12636,6 @@ def test_get_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = licensemanager.GetInstanceRequest() - assert args[0] == request_msg @@ -12656,7 +12657,6 @@ def test_deactivate_configuration_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = licensemanager.DeactivateConfigurationRequest() - assert args[0] == request_msg @@ -12678,7 +12678,6 @@ def test_reactivate_configuration_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = licensemanager.ReactivateConfigurationRequest() - assert args[0] == request_msg @@ -12700,7 +12699,6 @@ def test_query_configuration_license_usage_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = licensemanager.QueryConfigurationLicenseUsageRequest() - assert args[0] == request_msg @@ -12720,7 +12718,6 @@ def test_aggregate_usage_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = licensemanager.AggregateUsageRequest() - assert args[0] == request_msg @@ -12740,7 +12737,6 @@ def test_list_products_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = licensemanager.ListProductsRequest() - assert args[0] == request_msg @@ -12760,7 +12756,6 @@ def test_get_product_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = licensemanager.GetProductRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-life-sciences/noxfile.py b/packages/google-cloud-life-sciences/noxfile.py index c60fcada1c74..21cf5135ed89 100644 --- a/packages/google-cloud-life-sciences/noxfile.py +++ b/packages/google-cloud-life-sciences/noxfile.py @@ -47,7 +47,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-life-sciences" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-life-sciences/setup.py b/packages/google-cloud-life-sciences/setup.py index 6f823409ab4f..c8809c0aaaed 100644 --- a/packages/google-cloud-life-sciences/setup.py +++ b/packages/google-cloud-life-sciences/setup.py @@ -45,7 +45,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/google-cloud-life-sciences/testing/constraints-3.10.txt b/packages/google-cloud-life-sciences/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-life-sciences/testing/constraints-3.10.txt +++ b/packages/google-cloud-life-sciences/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-life-sciences/tests/unit/gapic/lifesciences_v2beta/test_workflows_service_v2_beta.py b/packages/google-cloud-life-sciences/tests/unit/gapic/lifesciences_v2beta/test_workflows_service_v2_beta.py index 329959e5a1f3..b76ad7888a64 100644 --- a/packages/google-cloud-life-sciences/tests/unit/gapic/lifesciences_v2beta/test_workflows_service_v2_beta.py +++ b/packages/google-cloud-life-sciences/tests/unit/gapic/lifesciences_v2beta/test_workflows_service_v2_beta.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 @@ -113,6 +114,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" @@ -1382,8 +1398,8 @@ def test_workflows_service_v2_beta_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - workflows.RunPipelineRequest, - dict, + workflows.RunPipelineRequest(), + {}, ], ) def test_run_pipeline(request_type, transport: str = "grpc"): @@ -1394,7 +1410,7 @@ def test_run_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(type(client.transport.run_pipeline), "__call__") as call: @@ -1436,10 +1452,11 @@ def test_run_pipeline_non_empty_request_with_auto_populated_field(): client.run_pipeline(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == workflows.RunPipelineRequest( + request_msg = workflows.RunPipelineRequest( parent="parent_value", pub_sub_topic="pub_sub_topic_value", ) + assert args[0] == request_msg def test_run_pipeline_use_cached_wrapped_rpc(): @@ -1530,9 +1547,14 @@ async def test_run_pipeline_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_run_pipeline_async( - transport: str = "grpc_asyncio", request_type=workflows.RunPipelineRequest -): +@pytest.mark.parametrize( + "request_type", + [ + workflows.RunPipelineRequest(), + {}, + ], +) +async def test_run_pipeline_async(request_type, transport: str = "grpc_asyncio"): client = WorkflowsServiceV2BetaAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1540,7 +1562,7 @@ async def test_run_pipeline_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.run_pipeline), "__call__") as call: @@ -1560,11 +1582,6 @@ async def test_run_pipeline_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_run_pipeline_async_from_dict(): - await test_run_pipeline_async(request_type=dict) - - def test_run_pipeline_field_headers(): client = WorkflowsServiceV2BetaClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1864,7 +1881,6 @@ def test_run_pipeline_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workflows.RunPipelineRequest() - assert args[0] == request_msg @@ -1903,7 +1919,6 @@ async def test_run_pipeline_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workflows.RunPipelineRequest() - assert args[0] == request_msg @@ -2370,7 +2385,6 @@ def test_run_pipeline_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workflows.RunPipelineRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-locationfinder/noxfile.py b/packages/google-cloud-locationfinder/noxfile.py index 92681ec28328..cc2ef53e813b 100644 --- a/packages/google-cloud-locationfinder/noxfile.py +++ b/packages/google-cloud-locationfinder/noxfile.py @@ -47,7 +47,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-locationfinder" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-locationfinder/setup.py b/packages/google-cloud-locationfinder/setup.py index 137bb346b260..db61f4b9fc5b 100644 --- a/packages/google-cloud-locationfinder/setup.py +++ b/packages/google-cloud-locationfinder/setup.py @@ -45,7 +45,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/google-cloud-locationfinder/testing/constraints-3.10.txt b/packages/google-cloud-locationfinder/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-locationfinder/testing/constraints-3.10.txt +++ b/packages/google-cloud-locationfinder/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-locationfinder/tests/unit/gapic/locationfinder_v1/test_cloud_location_finder.py b/packages/google-cloud-locationfinder/tests/unit/gapic/locationfinder_v1/test_cloud_location_finder.py index 4b418eb5ab25..efbab18a4dc2 100644 --- a/packages/google-cloud-locationfinder/tests/unit/gapic/locationfinder_v1/test_cloud_location_finder.py +++ b/packages/google-cloud-locationfinder/tests/unit/gapic/locationfinder_v1/test_cloud_location_finder.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 @@ -108,6 +109,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" @@ -1371,8 +1387,8 @@ def test_cloud_location_finder_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - cloud_location.ListCloudLocationsRequest, - dict, + cloud_location.ListCloudLocationsRequest(), + {}, ], ) def test_list_cloud_locations(request_type, transport: str = "grpc"): @@ -1383,7 +1399,7 @@ def test_list_cloud_locations(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1433,11 +1449,12 @@ def test_list_cloud_locations_non_empty_request_with_auto_populated_field(): client.list_cloud_locations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_location.ListCloudLocationsRequest( + request_msg = cloud_location.ListCloudLocationsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_cloud_locations_use_cached_wrapped_rpc(): @@ -1522,9 +1539,15 @@ async def test_list_cloud_locations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloud_location.ListCloudLocationsRequest(), + {}, + ], +) async def test_list_cloud_locations_async( - transport: str = "grpc_asyncio", - request_type=cloud_location.ListCloudLocationsRequest, + request_type, transport: str = "grpc_asyncio" ): client = CloudLocationFinderAsyncClient( credentials=async_anonymous_credentials(), @@ -1533,7 +1556,7 @@ async def test_list_cloud_locations_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( @@ -1558,11 +1581,6 @@ async def test_list_cloud_locations_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_cloud_locations_async_from_dict(): - await test_list_cloud_locations_async(request_type=dict) - - def test_list_cloud_locations_field_headers(): client = CloudLocationFinderClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1915,8 +1933,8 @@ async def test_list_cloud_locations_async_pages(): @pytest.mark.parametrize( "request_type", [ - cloud_location.GetCloudLocationRequest, - dict, + cloud_location.GetCloudLocationRequest(), + {}, ], ) def test_get_cloud_location(request_type, transport: str = "grpc"): @@ -1927,7 +1945,7 @@ def test_get_cloud_location(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1995,9 +2013,10 @@ def test_get_cloud_location_non_empty_request_with_auto_populated_field(): client.get_cloud_location(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_location.GetCloudLocationRequest( + request_msg = cloud_location.GetCloudLocationRequest( name="name_value", ) + assert args[0] == request_msg def test_get_cloud_location_use_cached_wrapped_rpc(): @@ -2082,9 +2101,14 @@ async def test_get_cloud_location_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_cloud_location_async( - transport: str = "grpc_asyncio", request_type=cloud_location.GetCloudLocationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_location.GetCloudLocationRequest(), + {}, + ], +) +async def test_get_cloud_location_async(request_type, transport: str = "grpc_asyncio"): client = CloudLocationFinderAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2092,7 +2116,7 @@ async def test_get_cloud_location_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( @@ -2137,11 +2161,6 @@ async def test_get_cloud_location_async( ) -@pytest.mark.asyncio -async def test_get_cloud_location_async_from_dict(): - await test_get_cloud_location_async(request_type=dict) - - def test_get_cloud_location_field_headers(): client = CloudLocationFinderClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2296,8 +2315,8 @@ async def test_get_cloud_location_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_location.SearchCloudLocationsRequest, - dict, + cloud_location.SearchCloudLocationsRequest(), + {}, ], ) def test_search_cloud_locations(request_type, transport: str = "grpc"): @@ -2308,7 +2327,7 @@ def test_search_cloud_locations(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2359,12 +2378,13 @@ def test_search_cloud_locations_non_empty_request_with_auto_populated_field(): client.search_cloud_locations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_location.SearchCloudLocationsRequest( + request_msg = cloud_location.SearchCloudLocationsRequest( parent="parent_value", source_cloud_location="source_cloud_location_value", page_token="page_token_value", query="query_value", ) + assert args[0] == request_msg def test_search_cloud_locations_use_cached_wrapped_rpc(): @@ -2450,9 +2470,15 @@ async def test_search_cloud_locations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloud_location.SearchCloudLocationsRequest(), + {}, + ], +) async def test_search_cloud_locations_async( - transport: str = "grpc_asyncio", - request_type=cloud_location.SearchCloudLocationsRequest, + request_type, transport: str = "grpc_asyncio" ): client = CloudLocationFinderAsyncClient( credentials=async_anonymous_credentials(), @@ -2461,7 +2487,7 @@ async def test_search_cloud_locations_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( @@ -2486,11 +2512,6 @@ async def test_search_cloud_locations_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_search_cloud_locations_async_from_dict(): - await test_search_cloud_locations_async(request_type=dict) - - def test_search_cloud_locations_field_headers(): client = CloudLocationFinderClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3721,7 +3742,6 @@ def test_list_cloud_locations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_location.ListCloudLocationsRequest() - assert args[0] == request_msg @@ -3744,7 +3764,6 @@ def test_get_cloud_location_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_location.GetCloudLocationRequest() - assert args[0] == request_msg @@ -3767,7 +3786,6 @@ def test_search_cloud_locations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_location.SearchCloudLocationsRequest() - assert args[0] == request_msg @@ -3810,7 +3828,6 @@ async def test_list_cloud_locations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_location.ListCloudLocationsRequest() - assert args[0] == request_msg @@ -3845,7 +3862,6 @@ async def test_get_cloud_location_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_location.GetCloudLocationRequest() - assert args[0] == request_msg @@ -3874,7 +3890,6 @@ async def test_search_cloud_locations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_location.SearchCloudLocationsRequest() - assert args[0] == request_msg @@ -4457,7 +4472,6 @@ def test_list_cloud_locations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_location.ListCloudLocationsRequest() - assert args[0] == request_msg @@ -4479,7 +4493,6 @@ def test_get_cloud_location_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_location.GetCloudLocationRequest() - assert args[0] == request_msg @@ -4501,7 +4514,6 @@ def test_search_cloud_locations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_location.SearchCloudLocationsRequest() - assert args[0] == request_msg 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..20815de79211 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 @@ -1333,7 +1333,7 @@ def test_config_service_v2_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - logging_config.ListBucketsRequest({}), + logging_config.ListBucketsRequest(), {}, ], ) @@ -1478,7 +1478,7 @@ async def test_list_buckets_async_use_cached_wrapped_rpc( @pytest.mark.parametrize( "request_type", [ - logging_config.ListBucketsRequest({}), + logging_config.ListBucketsRequest(), {}, ], ) @@ -1849,7 +1849,7 @@ async def test_list_buckets_async_pages(): @pytest.mark.parametrize( "request_type", [ - logging_config.GetBucketRequest({}), + logging_config.GetBucketRequest(), {}, ], ) @@ -2002,7 +2002,7 @@ async def test_get_bucket_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.parametrize( "request_type", [ - logging_config.GetBucketRequest({}), + logging_config.GetBucketRequest(), {}, ], ) @@ -2113,7 +2113,7 @@ async def test_get_bucket_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - logging_config.CreateBucketRequest({}), + logging_config.CreateBucketRequest(), {}, ], ) @@ -2273,7 +2273,7 @@ async def test_create_bucket_async_async_use_cached_wrapped_rpc( @pytest.mark.parametrize( "request_type", [ - logging_config.CreateBucketRequest({}), + logging_config.CreateBucketRequest(), {}, ], ) @@ -2375,7 +2375,7 @@ async def test_create_bucket_async_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - logging_config.UpdateBucketRequest({}), + logging_config.UpdateBucketRequest(), {}, ], ) @@ -2533,7 +2533,7 @@ async def test_update_bucket_async_async_use_cached_wrapped_rpc( @pytest.mark.parametrize( "request_type", [ - logging_config.UpdateBucketRequest({}), + logging_config.UpdateBucketRequest(), {}, ], ) @@ -2635,7 +2635,7 @@ async def test_update_bucket_async_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - logging_config.CreateBucketRequest({}), + logging_config.CreateBucketRequest(), {}, ], ) @@ -2792,7 +2792,7 @@ async def test_create_bucket_async_use_cached_wrapped_rpc( @pytest.mark.parametrize( "request_type", [ - logging_config.CreateBucketRequest({}), + logging_config.CreateBucketRequest(), {}, ], ) @@ -2903,7 +2903,7 @@ async def test_create_bucket_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - logging_config.UpdateBucketRequest({}), + logging_config.UpdateBucketRequest(), {}, ], ) @@ -3058,7 +3058,7 @@ async def test_update_bucket_async_use_cached_wrapped_rpc( @pytest.mark.parametrize( "request_type", [ - logging_config.UpdateBucketRequest({}), + logging_config.UpdateBucketRequest(), {}, ], ) @@ -3169,7 +3169,7 @@ async def test_update_bucket_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - logging_config.DeleteBucketRequest({}), + logging_config.DeleteBucketRequest(), {}, ], ) @@ -3309,7 +3309,7 @@ async def test_delete_bucket_async_use_cached_wrapped_rpc( @pytest.mark.parametrize( "request_type", [ - logging_config.DeleteBucketRequest({}), + logging_config.DeleteBucketRequest(), {}, ], ) @@ -3401,7 +3401,7 @@ async def test_delete_bucket_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - logging_config.UndeleteBucketRequest({}), + logging_config.UndeleteBucketRequest(), {}, ], ) @@ -3541,7 +3541,7 @@ async def test_undelete_bucket_async_use_cached_wrapped_rpc( @pytest.mark.parametrize( "request_type", [ - logging_config.UndeleteBucketRequest({}), + logging_config.UndeleteBucketRequest(), {}, ], ) @@ -3633,7 +3633,7 @@ async def test_undelete_bucket_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - logging_config.ListViewsRequest({}), + logging_config.ListViewsRequest(), {}, ], ) @@ -3776,7 +3776,7 @@ async def test_list_views_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.parametrize( "request_type", [ - logging_config.ListViewsRequest({}), + logging_config.ListViewsRequest(), {}, ], ) @@ -4147,7 +4147,7 @@ async def test_list_views_async_pages(): @pytest.mark.parametrize( "request_type", [ - logging_config.GetViewRequest({}), + logging_config.GetViewRequest(), {}, ], ) @@ -4292,7 +4292,7 @@ async def test_get_view_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn @pytest.mark.parametrize( "request_type", [ - logging_config.GetViewRequest({}), + logging_config.GetViewRequest(), {}, ], ) @@ -4395,7 +4395,7 @@ async def test_get_view_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - logging_config.CreateViewRequest({}), + logging_config.CreateViewRequest(), {}, ], ) @@ -4544,7 +4544,7 @@ async def test_create_view_async_use_cached_wrapped_rpc( @pytest.mark.parametrize( "request_type", [ - logging_config.CreateViewRequest({}), + logging_config.CreateViewRequest(), {}, ], ) @@ -4647,7 +4647,7 @@ async def test_create_view_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - logging_config.UpdateViewRequest({}), + logging_config.UpdateViewRequest(), {}, ], ) @@ -4794,7 +4794,7 @@ async def test_update_view_async_use_cached_wrapped_rpc( @pytest.mark.parametrize( "request_type", [ - logging_config.UpdateViewRequest({}), + logging_config.UpdateViewRequest(), {}, ], ) @@ -4897,7 +4897,7 @@ async def test_update_view_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - logging_config.DeleteViewRequest({}), + logging_config.DeleteViewRequest(), {}, ], ) @@ -5037,7 +5037,7 @@ async def test_delete_view_async_use_cached_wrapped_rpc( @pytest.mark.parametrize( "request_type", [ - logging_config.DeleteViewRequest({}), + logging_config.DeleteViewRequest(), {}, ], ) @@ -5129,7 +5129,7 @@ async def test_delete_view_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - logging_config.ListSinksRequest({}), + logging_config.ListSinksRequest(), {}, ], ) @@ -5272,7 +5272,7 @@ async def test_list_sinks_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.parametrize( "request_type", [ - logging_config.ListSinksRequest({}), + logging_config.ListSinksRequest(), {}, ], ) @@ -5643,7 +5643,7 @@ async def test_list_sinks_async_pages(): @pytest.mark.parametrize( "request_type", [ - logging_config.GetSinkRequest({}), + logging_config.GetSinkRequest(), {}, ], ) @@ -5798,7 +5798,7 @@ async def test_get_sink_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn @pytest.mark.parametrize( "request_type", [ - logging_config.GetSinkRequest({}), + logging_config.GetSinkRequest(), {}, ], ) @@ -5993,7 +5993,7 @@ async def test_get_sink_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - logging_config.CreateSinkRequest({}), + logging_config.CreateSinkRequest(), {}, ], ) @@ -6150,7 +6150,7 @@ async def test_create_sink_async_use_cached_wrapped_rpc( @pytest.mark.parametrize( "request_type", [ - logging_config.CreateSinkRequest({}), + logging_config.CreateSinkRequest(), {}, ], ) @@ -6355,7 +6355,7 @@ async def test_create_sink_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - logging_config.UpdateSinkRequest({}), + logging_config.UpdateSinkRequest(), {}, ], ) @@ -6512,7 +6512,7 @@ async def test_update_sink_async_use_cached_wrapped_rpc( @pytest.mark.parametrize( "request_type", [ - logging_config.UpdateSinkRequest({}), + logging_config.UpdateSinkRequest(), {}, ], ) @@ -6727,7 +6727,7 @@ async def test_update_sink_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - logging_config.DeleteSinkRequest({}), + logging_config.DeleteSinkRequest(), {}, ], ) @@ -6867,7 +6867,7 @@ async def test_delete_sink_async_use_cached_wrapped_rpc( @pytest.mark.parametrize( "request_type", [ - logging_config.DeleteSinkRequest({}), + logging_config.DeleteSinkRequest(), {}, ], ) @@ -7039,7 +7039,7 @@ async def test_delete_sink_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - logging_config.CreateLinkRequest({}), + logging_config.CreateLinkRequest(), {}, ], ) @@ -7191,7 +7191,7 @@ async def test_create_link_async_use_cached_wrapped_rpc( @pytest.mark.parametrize( "request_type", [ - logging_config.CreateLinkRequest({}), + logging_config.CreateLinkRequest(), {}, ], ) @@ -7389,7 +7389,7 @@ async def test_create_link_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - logging_config.DeleteLinkRequest({}), + logging_config.DeleteLinkRequest(), {}, ], ) @@ -7539,7 +7539,7 @@ async def test_delete_link_async_use_cached_wrapped_rpc( @pytest.mark.parametrize( "request_type", [ - logging_config.DeleteLinkRequest({}), + logging_config.DeleteLinkRequest(), {}, ], ) @@ -7717,7 +7717,7 @@ async def test_delete_link_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - logging_config.ListLinksRequest({}), + logging_config.ListLinksRequest(), {}, ], ) @@ -7860,7 +7860,7 @@ async def test_list_links_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.parametrize( "request_type", [ - logging_config.ListLinksRequest({}), + logging_config.ListLinksRequest(), {}, ], ) @@ -8231,7 +8231,7 @@ async def test_list_links_async_pages(): @pytest.mark.parametrize( "request_type", [ - logging_config.GetLinkRequest({}), + logging_config.GetLinkRequest(), {}, ], ) @@ -8376,7 +8376,7 @@ async def test_get_link_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn @pytest.mark.parametrize( "request_type", [ - logging_config.GetLinkRequest({}), + logging_config.GetLinkRequest(), {}, ], ) @@ -8557,7 +8557,7 @@ async def test_get_link_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - logging_config.ListExclusionsRequest({}), + logging_config.ListExclusionsRequest(), {}, ], ) @@ -8702,7 +8702,7 @@ async def test_list_exclusions_async_use_cached_wrapped_rpc( @pytest.mark.parametrize( "request_type", [ - logging_config.ListExclusionsRequest({}), + logging_config.ListExclusionsRequest(), {}, ], ) @@ -9073,7 +9073,7 @@ async def test_list_exclusions_async_pages(): @pytest.mark.parametrize( "request_type", [ - logging_config.GetExclusionRequest({}), + logging_config.GetExclusionRequest(), {}, ], ) @@ -9222,7 +9222,7 @@ async def test_get_exclusion_async_use_cached_wrapped_rpc( @pytest.mark.parametrize( "request_type", [ - logging_config.GetExclusionRequest({}), + logging_config.GetExclusionRequest(), {}, ], ) @@ -9409,7 +9409,7 @@ async def test_get_exclusion_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - logging_config.CreateExclusionRequest({}), + logging_config.CreateExclusionRequest(), {}, ], ) @@ -9560,7 +9560,7 @@ async def test_create_exclusion_async_use_cached_wrapped_rpc( @pytest.mark.parametrize( "request_type", [ - logging_config.CreateExclusionRequest({}), + logging_config.CreateExclusionRequest(), {}, ], ) @@ -9757,7 +9757,7 @@ async def test_create_exclusion_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - logging_config.UpdateExclusionRequest({}), + logging_config.UpdateExclusionRequest(), {}, ], ) @@ -9908,7 +9908,7 @@ async def test_update_exclusion_async_use_cached_wrapped_rpc( @pytest.mark.parametrize( "request_type", [ - logging_config.UpdateExclusionRequest({}), + logging_config.UpdateExclusionRequest(), {}, ], ) @@ -10115,7 +10115,7 @@ async def test_update_exclusion_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - logging_config.DeleteExclusionRequest({}), + logging_config.DeleteExclusionRequest(), {}, ], ) @@ -10257,7 +10257,7 @@ async def test_delete_exclusion_async_use_cached_wrapped_rpc( @pytest.mark.parametrize( "request_type", [ - logging_config.DeleteExclusionRequest({}), + logging_config.DeleteExclusionRequest(), {}, ], ) @@ -10429,7 +10429,7 @@ async def test_delete_exclusion_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - logging_config.GetCmekSettingsRequest({}), + logging_config.GetCmekSettingsRequest(), {}, ], ) @@ -10584,7 +10584,7 @@ async def test_get_cmek_settings_async_use_cached_wrapped_rpc( @pytest.mark.parametrize( "request_type", [ - logging_config.GetCmekSettingsRequest({}), + logging_config.GetCmekSettingsRequest(), {}, ], ) @@ -10695,7 +10695,7 @@ async def test_get_cmek_settings_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - logging_config.UpdateCmekSettingsRequest({}), + logging_config.UpdateCmekSettingsRequest(), {}, ], ) @@ -10852,7 +10852,7 @@ async def test_update_cmek_settings_async_use_cached_wrapped_rpc( @pytest.mark.parametrize( "request_type", [ - logging_config.UpdateCmekSettingsRequest({}), + logging_config.UpdateCmekSettingsRequest(), {}, ], ) @@ -10965,7 +10965,7 @@ async def test_update_cmek_settings_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - logging_config.GetSettingsRequest({}), + logging_config.GetSettingsRequest(), {}, ], ) @@ -11116,7 +11116,7 @@ async def test_get_settings_async_use_cached_wrapped_rpc( @pytest.mark.parametrize( "request_type", [ - logging_config.GetSettingsRequest({}), + logging_config.GetSettingsRequest(), {}, ], ) @@ -11305,7 +11305,7 @@ async def test_get_settings_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - logging_config.UpdateSettingsRequest({}), + logging_config.UpdateSettingsRequest(), {}, ], ) @@ -11456,7 +11456,7 @@ async def test_update_settings_async_use_cached_wrapped_rpc( @pytest.mark.parametrize( "request_type", [ - logging_config.UpdateSettingsRequest({}), + logging_config.UpdateSettingsRequest(), {}, ], ) @@ -11655,7 +11655,7 @@ async def test_update_settings_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - logging_config.CopyLogEntriesRequest({}), + logging_config.CopyLogEntriesRequest(), {}, ], ) @@ -11811,7 +11811,7 @@ async def test_copy_log_entries_async_use_cached_wrapped_rpc( @pytest.mark.parametrize( "request_type", [ - logging_config.CopyLogEntriesRequest({}), + logging_config.CopyLogEntriesRequest(), {}, ], ) 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..2fb4e10bbeca 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 @@ -1335,7 +1335,7 @@ def test_logging_service_v2_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - logging.DeleteLogRequest({}), + logging.DeleteLogRequest(), {}, ], ) @@ -1473,7 +1473,7 @@ async def test_delete_log_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.parametrize( "request_type", [ - logging.DeleteLogRequest({}), + logging.DeleteLogRequest(), {}, ], ) @@ -1645,7 +1645,7 @@ async def test_delete_log_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - logging.WriteLogEntriesRequest({}), + logging.WriteLogEntriesRequest(), {}, ], ) @@ -1791,7 +1791,7 @@ async def test_write_log_entries_async_use_cached_wrapped_rpc( @pytest.mark.parametrize( "request_type", [ - logging.WriteLogEntriesRequest({}), + logging.WriteLogEntriesRequest(), {}, ], ) @@ -1944,7 +1944,7 @@ async def test_write_log_entries_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - logging.ListLogEntriesRequest({}), + logging.ListLogEntriesRequest(), {}, ], ) @@ -2093,7 +2093,7 @@ async def test_list_log_entries_async_use_cached_wrapped_rpc( @pytest.mark.parametrize( "request_type", [ - logging.ListLogEntriesRequest({}), + logging.ListLogEntriesRequest(), {}, ], ) @@ -2420,7 +2420,7 @@ async def test_list_log_entries_async_pages(): @pytest.mark.parametrize( "request_type", [ - logging.ListMonitoredResourceDescriptorsRequest({}), + logging.ListMonitoredResourceDescriptorsRequest(), {}, ], ) @@ -2572,7 +2572,7 @@ async def test_list_monitored_resource_descriptors_async_use_cached_wrapped_rpc( @pytest.mark.parametrize( "request_type", [ - logging.ListMonitoredResourceDescriptorsRequest({}), + logging.ListMonitoredResourceDescriptorsRequest(), {}, ], ) @@ -2819,7 +2819,7 @@ async def test_list_monitored_resource_descriptors_async_pages(): @pytest.mark.parametrize( "request_type", [ - logging.ListLogsRequest({}), + logging.ListLogsRequest(), {}, ], ) @@ -2964,7 +2964,7 @@ async def test_list_logs_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.parametrize( "request_type", [ - logging.ListLogsRequest({}), + logging.ListLogsRequest(), {}, ], ) @@ -3337,7 +3337,7 @@ async def test_list_logs_async_pages(): @pytest.mark.parametrize( "request_type", [ - logging.TailLogEntriesRequest({}), + logging.TailLogEntriesRequest(), {}, ], ) @@ -3451,7 +3451,7 @@ async def test_tail_log_entries_async_use_cached_wrapped_rpc( @pytest.mark.parametrize( "request_type", [ - logging.TailLogEntriesRequest({}), + logging.TailLogEntriesRequest(), {}, ], ) 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..c682839cbe2c 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 @@ -1334,7 +1334,7 @@ def test_metrics_service_v2_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - logging_metrics.ListLogMetricsRequest({}), + logging_metrics.ListLogMetricsRequest(), {}, ], ) @@ -1481,7 +1481,7 @@ async def test_list_log_metrics_async_use_cached_wrapped_rpc( @pytest.mark.parametrize( "request_type", [ - logging_metrics.ListLogMetricsRequest({}), + logging_metrics.ListLogMetricsRequest(), {}, ], ) @@ -1852,7 +1852,7 @@ async def test_list_log_metrics_async_pages(): @pytest.mark.parametrize( "request_type", [ - logging_metrics.GetLogMetricRequest({}), + logging_metrics.GetLogMetricRequest(), {}, ], ) @@ -2007,7 +2007,7 @@ async def test_get_log_metric_async_use_cached_wrapped_rpc( @pytest.mark.parametrize( "request_type", [ - logging_metrics.GetLogMetricRequest({}), + logging_metrics.GetLogMetricRequest(), {}, ], ) @@ -2200,7 +2200,7 @@ async def test_get_log_metric_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - logging_metrics.CreateLogMetricRequest({}), + logging_metrics.CreateLogMetricRequest(), {}, ], ) @@ -2361,7 +2361,7 @@ async def test_create_log_metric_async_use_cached_wrapped_rpc( @pytest.mark.parametrize( "request_type", [ - logging_metrics.CreateLogMetricRequest({}), + logging_metrics.CreateLogMetricRequest(), {}, ], ) @@ -2574,7 +2574,7 @@ async def test_create_log_metric_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - logging_metrics.UpdateLogMetricRequest({}), + logging_metrics.UpdateLogMetricRequest(), {}, ], ) @@ -2735,7 +2735,7 @@ async def test_update_log_metric_async_use_cached_wrapped_rpc( @pytest.mark.parametrize( "request_type", [ - logging_metrics.UpdateLogMetricRequest({}), + logging_metrics.UpdateLogMetricRequest(), {}, ], ) @@ -2948,7 +2948,7 @@ async def test_update_log_metric_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - logging_metrics.DeleteLogMetricRequest({}), + logging_metrics.DeleteLogMetricRequest(), {}, ], ) @@ -3094,7 +3094,7 @@ async def test_delete_log_metric_async_use_cached_wrapped_rpc( @pytest.mark.parametrize( "request_type", [ - logging_metrics.DeleteLogMetricRequest({}), + logging_metrics.DeleteLogMetricRequest(), {}, ], ) diff --git a/packages/google-cloud-lustre/noxfile.py b/packages/google-cloud-lustre/noxfile.py index 27efe9f74365..adedfe930707 100644 --- a/packages/google-cloud-lustre/noxfile.py +++ b/packages/google-cloud-lustre/noxfile.py @@ -47,7 +47,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-lustre" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-lustre/setup.py b/packages/google-cloud-lustre/setup.py index 0c977c61ccf4..79ffe101e41f 100644 --- a/packages/google-cloud-lustre/setup.py +++ b/packages/google-cloud-lustre/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/google-cloud-lustre/testing/constraints-3.10.txt b/packages/google-cloud-lustre/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-lustre/testing/constraints-3.10.txt +++ b/packages/google-cloud-lustre/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-lustre/tests/unit/gapic/lustre_v1/test_lustre.py b/packages/google-cloud-lustre/tests/unit/gapic/lustre_v1/test_lustre.py index bbe9b1108a30..bc49836a2a7e 100644 --- a/packages/google-cloud-lustre/tests/unit/gapic/lustre_v1/test_lustre.py +++ b/packages/google-cloud-lustre/tests/unit/gapic/lustre_v1/test_lustre.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 @@ -117,6 +118,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" @@ -1249,8 +1265,8 @@ def test_lustre_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - instance.ListInstancesRequest, - dict, + instance.ListInstancesRequest(), + {}, ], ) def test_list_instances(request_type, transport: str = "grpc"): @@ -1261,7 +1277,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(type(client.transport.list_instances), "__call__") as call: @@ -1310,12 +1326,13 @@ 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] == instance.ListInstancesRequest( + request_msg = instance.ListInstancesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_instances_use_cached_wrapped_rpc(): @@ -1396,9 +1413,14 @@ async def test_list_instances_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_instances_async( - transport: str = "grpc_asyncio", request_type=instance.ListInstancesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + instance.ListInstancesRequest(), + {}, + ], +) +async def test_list_instances_async(request_type, transport: str = "grpc_asyncio"): client = LustreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1406,7 +1428,7 @@ async def test_list_instances_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_instances), "__call__") as call: @@ -1431,11 +1453,6 @@ async def test_list_instances_async( 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 = LustreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1772,8 +1789,8 @@ async def test_list_instances_async_pages(): @pytest.mark.parametrize( "request_type", [ - instance.GetInstanceRequest, - dict, + instance.GetInstanceRequest(), + {}, ], ) def test_get_instance(request_type, transport: str = "grpc"): @@ -1784,7 +1801,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(type(client.transport.get_instance), "__call__") as call: @@ -1844,9 +1861,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] == instance.GetInstanceRequest( + request_msg = instance.GetInstanceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_instance_use_cached_wrapped_rpc(): @@ -1927,9 +1945,14 @@ async def test_get_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_instance_async( - transport: str = "grpc_asyncio", request_type=instance.GetInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + instance.GetInstanceRequest(), + {}, + ], +) +async def test_get_instance_async(request_type, transport: str = "grpc_asyncio"): client = LustreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1937,7 +1960,7 @@ async def test_get_instance_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_instance), "__call__") as call: @@ -1976,11 +1999,6 @@ async def test_get_instance_async( assert response.gke_support_enabled is True -@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 = LustreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2123,8 +2141,8 @@ async def test_get_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcl_instance.CreateInstanceRequest, - dict, + gcl_instance.CreateInstanceRequest(), + {}, ], ) def test_create_instance(request_type, transport: str = "grpc"): @@ -2135,7 +2153,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(type(client.transport.create_instance), "__call__") as call: @@ -2177,10 +2195,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] == gcl_instance.CreateInstanceRequest( + request_msg = gcl_instance.CreateInstanceRequest( parent="parent_value", instance_id="instance_id_value", ) + assert args[0] == request_msg def test_create_instance_use_cached_wrapped_rpc(): @@ -2271,9 +2290,14 @@ async def test_create_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_instance_async( - transport: str = "grpc_asyncio", request_type=gcl_instance.CreateInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcl_instance.CreateInstanceRequest(), + {}, + ], +) +async def test_create_instance_async(request_type, transport: str = "grpc_asyncio"): client = LustreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2281,7 +2305,7 @@ async def test_create_instance_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_instance), "__call__") as call: @@ -2301,11 +2325,6 @@ async def test_create_instance_async( 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 = LustreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2472,8 +2491,8 @@ async def test_create_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcl_instance.UpdateInstanceRequest, - dict, + gcl_instance.UpdateInstanceRequest(), + {}, ], ) def test_update_instance(request_type, transport: str = "grpc"): @@ -2484,7 +2503,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(type(client.transport.update_instance), "__call__") as call: @@ -2523,7 +2542,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] - assert args[0] == gcl_instance.UpdateInstanceRequest() + request_msg = gcl_instance.UpdateInstanceRequest() + assert args[0] == request_msg def test_update_instance_use_cached_wrapped_rpc(): @@ -2614,9 +2634,14 @@ async def test_update_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_instance_async( - transport: str = "grpc_asyncio", request_type=gcl_instance.UpdateInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcl_instance.UpdateInstanceRequest(), + {}, + ], +) +async def test_update_instance_async(request_type, transport: str = "grpc_asyncio"): client = LustreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2624,7 +2649,7 @@ async def test_update_instance_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_instance), "__call__") as call: @@ -2644,11 +2669,6 @@ async def test_update_instance_async( 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 = LustreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2805,8 +2825,8 @@ async def test_update_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - instance.DeleteInstanceRequest, - dict, + instance.DeleteInstanceRequest(), + {}, ], ) def test_delete_instance(request_type, transport: str = "grpc"): @@ -2817,7 +2837,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(type(client.transport.delete_instance), "__call__") as call: @@ -2858,9 +2878,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] == instance.DeleteInstanceRequest( + request_msg = instance.DeleteInstanceRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_instance_use_cached_wrapped_rpc(): @@ -2951,9 +2972,14 @@ async def test_delete_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_instance_async( - transport: str = "grpc_asyncio", request_type=instance.DeleteInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + instance.DeleteInstanceRequest(), + {}, + ], +) +async def test_delete_instance_async(request_type, transport: str = "grpc_asyncio"): client = LustreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2961,7 +2987,7 @@ async def test_delete_instance_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_instance), "__call__") as call: @@ -2981,11 +3007,6 @@ async def test_delete_instance_async( 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 = LustreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3132,8 +3153,8 @@ async def test_delete_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - transfer.ImportDataRequest, - dict, + transfer.ImportDataRequest(), + {}, ], ) def test_import_data(request_type, transport: str = "grpc"): @@ -3144,7 +3165,7 @@ def test_import_data(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.import_data), "__call__") as call: @@ -3186,10 +3207,11 @@ def test_import_data_non_empty_request_with_auto_populated_field(): client.import_data(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == transfer.ImportDataRequest( + request_msg = transfer.ImportDataRequest( name="name_value", service_account="service_account_value", ) + assert args[0] == request_msg def test_import_data_use_cached_wrapped_rpc(): @@ -3280,9 +3302,14 @@ async def test_import_data_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_import_data_async( - transport: str = "grpc_asyncio", request_type=transfer.ImportDataRequest -): +@pytest.mark.parametrize( + "request_type", + [ + transfer.ImportDataRequest(), + {}, + ], +) +async def test_import_data_async(request_type, transport: str = "grpc_asyncio"): client = LustreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3290,7 +3317,7 @@ async def test_import_data_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.import_data), "__call__") as call: @@ -3310,11 +3337,6 @@ async def test_import_data_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_import_data_async_from_dict(): - await test_import_data_async(request_type=dict) - - def test_import_data_field_headers(): client = LustreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3461,8 +3483,8 @@ async def test_import_data_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - transfer.ExportDataRequest, - dict, + transfer.ExportDataRequest(), + {}, ], ) def test_export_data(request_type, transport: str = "grpc"): @@ -3473,7 +3495,7 @@ def test_export_data(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.export_data), "__call__") as call: @@ -3515,10 +3537,11 @@ def test_export_data_non_empty_request_with_auto_populated_field(): client.export_data(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == transfer.ExportDataRequest( + request_msg = transfer.ExportDataRequest( name="name_value", service_account="service_account_value", ) + assert args[0] == request_msg def test_export_data_use_cached_wrapped_rpc(): @@ -3609,9 +3632,14 @@ async def test_export_data_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_export_data_async( - transport: str = "grpc_asyncio", request_type=transfer.ExportDataRequest -): +@pytest.mark.parametrize( + "request_type", + [ + transfer.ExportDataRequest(), + {}, + ], +) +async def test_export_data_async(request_type, transport: str = "grpc_asyncio"): client = LustreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3619,7 +3647,7 @@ async def test_export_data_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.export_data), "__call__") as call: @@ -3639,11 +3667,6 @@ async def test_export_data_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_export_data_async_from_dict(): - await test_export_data_async(request_type=dict) - - def test_export_data_field_headers(): client = LustreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5147,7 +5170,6 @@ def test_list_instances_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = instance.ListInstancesRequest() - assert args[0] == request_msg @@ -5168,7 +5190,6 @@ def test_get_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = instance.GetInstanceRequest() - assert args[0] == request_msg @@ -5189,7 +5210,6 @@ def test_create_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcl_instance.CreateInstanceRequest() - assert args[0] == request_msg @@ -5210,7 +5230,6 @@ def test_update_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcl_instance.UpdateInstanceRequest() - assert args[0] == request_msg @@ -5231,7 +5250,6 @@ def test_delete_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = instance.DeleteInstanceRequest() - assert args[0] == request_msg @@ -5252,7 +5270,6 @@ def test_import_data_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transfer.ImportDataRequest() - assert args[0] == request_msg @@ -5273,7 +5290,6 @@ def test_export_data_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transfer.ExportDataRequest() - assert args[0] == request_msg @@ -5315,7 +5331,6 @@ async def test_list_instances_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = instance.ListInstancesRequest() - assert args[0] == request_msg @@ -5350,7 +5365,6 @@ async def test_get_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = instance.GetInstanceRequest() - assert args[0] == request_msg @@ -5375,7 +5389,6 @@ async def test_create_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcl_instance.CreateInstanceRequest() - assert args[0] == request_msg @@ -5400,7 +5413,6 @@ async def test_update_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcl_instance.UpdateInstanceRequest() - assert args[0] == request_msg @@ -5425,7 +5437,6 @@ async def test_delete_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = instance.DeleteInstanceRequest() - assert args[0] == request_msg @@ -5450,7 +5461,6 @@ async def test_import_data_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transfer.ImportDataRequest() - assert args[0] == request_msg @@ -5475,7 +5485,6 @@ async def test_export_data_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transfer.ExportDataRequest() - assert args[0] == request_msg @@ -6910,7 +6919,6 @@ def test_list_instances_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = instance.ListInstancesRequest() - assert args[0] == request_msg @@ -6930,7 +6938,6 @@ def test_get_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = instance.GetInstanceRequest() - assert args[0] == request_msg @@ -6950,7 +6957,6 @@ def test_create_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcl_instance.CreateInstanceRequest() - assert args[0] == request_msg @@ -6970,7 +6976,6 @@ def test_update_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcl_instance.UpdateInstanceRequest() - assert args[0] == request_msg @@ -6990,7 +6995,6 @@ def test_delete_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = instance.DeleteInstanceRequest() - assert args[0] == request_msg @@ -7010,7 +7014,6 @@ def test_import_data_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transfer.ImportDataRequest() - assert args[0] == request_msg @@ -7030,7 +7033,6 @@ def test_export_data_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transfer.ExportDataRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-maintenance-api/noxfile.py b/packages/google-cloud-maintenance-api/noxfile.py index a4c0725547e9..c454a3334353 100644 --- a/packages/google-cloud-maintenance-api/noxfile.py +++ b/packages/google-cloud-maintenance-api/noxfile.py @@ -47,7 +47,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-maintenance-api" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-maintenance-api/setup.py b/packages/google-cloud-maintenance-api/setup.py index 54527db094ff..b6c5444d0ce4 100644 --- a/packages/google-cloud-maintenance-api/setup.py +++ b/packages/google-cloud-maintenance-api/setup.py @@ -45,7 +45,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/google-cloud-maintenance-api/testing/constraints-3.10.txt b/packages/google-cloud-maintenance-api/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-maintenance-api/testing/constraints-3.10.txt +++ b/packages/google-cloud-maintenance-api/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-maintenance-api/tests/unit/gapic/maintenance_api_v1/test_maintenance.py b/packages/google-cloud-maintenance-api/tests/unit/gapic/maintenance_api_v1/test_maintenance.py index 7d1206795bbe..7be5cef78777 100644 --- a/packages/google-cloud-maintenance-api/tests/unit/gapic/maintenance_api_v1/test_maintenance.py +++ b/packages/google-cloud-maintenance-api/tests/unit/gapic/maintenance_api_v1/test_maintenance.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 @@ -109,6 +110,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" @@ -1274,8 +1290,8 @@ def test_maintenance_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - maintenance_service.SummarizeMaintenancesRequest, - dict, + maintenance_service.SummarizeMaintenancesRequest(), + {}, ], ) def test_summarize_maintenances(request_type, transport: str = "grpc"): @@ -1286,7 +1302,7 @@ def test_summarize_maintenances(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1339,12 +1355,13 @@ def test_summarize_maintenances_non_empty_request_with_auto_populated_field(): client.summarize_maintenances(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == maintenance_service.SummarizeMaintenancesRequest( + request_msg = maintenance_service.SummarizeMaintenancesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_summarize_maintenances_use_cached_wrapped_rpc(): @@ -1430,9 +1447,15 @@ async def test_summarize_maintenances_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + maintenance_service.SummarizeMaintenancesRequest(), + {}, + ], +) async def test_summarize_maintenances_async( - transport: str = "grpc_asyncio", - request_type=maintenance_service.SummarizeMaintenancesRequest, + request_type, transport: str = "grpc_asyncio" ): client = MaintenanceAsyncClient( credentials=async_anonymous_credentials(), @@ -1441,7 +1464,7 @@ async def test_summarize_maintenances_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( @@ -1468,11 +1491,6 @@ async def test_summarize_maintenances_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_summarize_maintenances_async_from_dict(): - await test_summarize_maintenances_async(request_type=dict) - - def test_summarize_maintenances_field_headers(): client = MaintenanceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1829,8 +1847,8 @@ async def test_summarize_maintenances_async_pages(): @pytest.mark.parametrize( "request_type", [ - maintenance_service.ListResourceMaintenancesRequest, - dict, + maintenance_service.ListResourceMaintenancesRequest(), + {}, ], ) def test_list_resource_maintenances(request_type, transport: str = "grpc"): @@ -1841,7 +1859,7 @@ def test_list_resource_maintenances(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1894,12 +1912,13 @@ def test_list_resource_maintenances_non_empty_request_with_auto_populated_field( client.list_resource_maintenances(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == maintenance_service.ListResourceMaintenancesRequest( + request_msg = maintenance_service.ListResourceMaintenancesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_resource_maintenances_use_cached_wrapped_rpc(): @@ -1985,9 +2004,15 @@ async def test_list_resource_maintenances_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + maintenance_service.ListResourceMaintenancesRequest(), + {}, + ], +) async def test_list_resource_maintenances_async( - transport: str = "grpc_asyncio", - request_type=maintenance_service.ListResourceMaintenancesRequest, + request_type, transport: str = "grpc_asyncio" ): client = MaintenanceAsyncClient( credentials=async_anonymous_credentials(), @@ -1996,7 +2021,7 @@ async def test_list_resource_maintenances_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( @@ -2023,11 +2048,6 @@ async def test_list_resource_maintenances_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_resource_maintenances_async_from_dict(): - await test_list_resource_maintenances_async(request_type=dict) - - def test_list_resource_maintenances_field_headers(): client = MaintenanceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2386,8 +2406,8 @@ async def test_list_resource_maintenances_async_pages(): @pytest.mark.parametrize( "request_type", [ - maintenance_service.GetResourceMaintenanceRequest, - dict, + maintenance_service.GetResourceMaintenanceRequest(), + {}, ], ) def test_get_resource_maintenance(request_type, transport: str = "grpc"): @@ -2398,7 +2418,7 @@ def test_get_resource_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( @@ -2454,9 +2474,10 @@ def test_get_resource_maintenance_non_empty_request_with_auto_populated_field(): client.get_resource_maintenance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == maintenance_service.GetResourceMaintenanceRequest( + request_msg = maintenance_service.GetResourceMaintenanceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_resource_maintenance_use_cached_wrapped_rpc(): @@ -2542,9 +2563,15 @@ async def test_get_resource_maintenance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + maintenance_service.GetResourceMaintenanceRequest(), + {}, + ], +) async def test_get_resource_maintenance_async( - transport: str = "grpc_asyncio", - request_type=maintenance_service.GetResourceMaintenanceRequest, + request_type, transport: str = "grpc_asyncio" ): client = MaintenanceAsyncClient( credentials=async_anonymous_credentials(), @@ -2553,7 +2580,7 @@ async def test_get_resource_maintenance_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( @@ -2586,11 +2613,6 @@ async def test_get_resource_maintenance_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_resource_maintenance_async_from_dict(): - await test_get_resource_maintenance_async(request_type=dict) - - def test_get_resource_maintenance_field_headers(): client = MaintenanceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3596,7 +3618,6 @@ def test_summarize_maintenances_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = maintenance_service.SummarizeMaintenancesRequest() - assert args[0] == request_msg @@ -3619,7 +3640,6 @@ def test_list_resource_maintenances_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = maintenance_service.ListResourceMaintenancesRequest() - assert args[0] == request_msg @@ -3642,7 +3662,6 @@ def test_get_resource_maintenance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = maintenance_service.GetResourceMaintenanceRequest() - assert args[0] == request_msg @@ -3686,7 +3705,6 @@ async def test_summarize_maintenances_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = maintenance_service.SummarizeMaintenancesRequest() - assert args[0] == request_msg @@ -3716,7 +3734,6 @@ async def test_list_resource_maintenances_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = maintenance_service.ListResourceMaintenancesRequest() - assert args[0] == request_msg @@ -3749,7 +3766,6 @@ async def test_get_resource_maintenance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = maintenance_service.GetResourceMaintenanceRequest() - assert args[0] == request_msg @@ -4335,7 +4351,6 @@ def test_summarize_maintenances_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = maintenance_service.SummarizeMaintenancesRequest() - assert args[0] == request_msg @@ -4357,7 +4372,6 @@ def test_list_resource_maintenances_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = maintenance_service.ListResourceMaintenancesRequest() - assert args[0] == request_msg @@ -4379,7 +4393,6 @@ def test_get_resource_maintenance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = maintenance_service.GetResourceMaintenanceRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-maintenance-api/tests/unit/gapic/maintenance_api_v1beta/test_maintenance.py b/packages/google-cloud-maintenance-api/tests/unit/gapic/maintenance_api_v1beta/test_maintenance.py index f1488db1036b..1ea6bcc684c4 100644 --- a/packages/google-cloud-maintenance-api/tests/unit/gapic/maintenance_api_v1beta/test_maintenance.py +++ b/packages/google-cloud-maintenance-api/tests/unit/gapic/maintenance_api_v1beta/test_maintenance.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 @@ -109,6 +110,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" @@ -1274,8 +1290,8 @@ def test_maintenance_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - maintenance_service.SummarizeMaintenancesRequest, - dict, + maintenance_service.SummarizeMaintenancesRequest(), + {}, ], ) def test_summarize_maintenances(request_type, transport: str = "grpc"): @@ -1286,7 +1302,7 @@ def test_summarize_maintenances(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1339,12 +1355,13 @@ def test_summarize_maintenances_non_empty_request_with_auto_populated_field(): client.summarize_maintenances(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == maintenance_service.SummarizeMaintenancesRequest( + request_msg = maintenance_service.SummarizeMaintenancesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_summarize_maintenances_use_cached_wrapped_rpc(): @@ -1430,9 +1447,15 @@ async def test_summarize_maintenances_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + maintenance_service.SummarizeMaintenancesRequest(), + {}, + ], +) async def test_summarize_maintenances_async( - transport: str = "grpc_asyncio", - request_type=maintenance_service.SummarizeMaintenancesRequest, + request_type, transport: str = "grpc_asyncio" ): client = MaintenanceAsyncClient( credentials=async_anonymous_credentials(), @@ -1441,7 +1464,7 @@ async def test_summarize_maintenances_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( @@ -1468,11 +1491,6 @@ async def test_summarize_maintenances_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_summarize_maintenances_async_from_dict(): - await test_summarize_maintenances_async(request_type=dict) - - def test_summarize_maintenances_field_headers(): client = MaintenanceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1829,8 +1847,8 @@ async def test_summarize_maintenances_async_pages(): @pytest.mark.parametrize( "request_type", [ - maintenance_service.ListResourceMaintenancesRequest, - dict, + maintenance_service.ListResourceMaintenancesRequest(), + {}, ], ) def test_list_resource_maintenances(request_type, transport: str = "grpc"): @@ -1841,7 +1859,7 @@ def test_list_resource_maintenances(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1894,12 +1912,13 @@ def test_list_resource_maintenances_non_empty_request_with_auto_populated_field( client.list_resource_maintenances(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == maintenance_service.ListResourceMaintenancesRequest( + request_msg = maintenance_service.ListResourceMaintenancesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_resource_maintenances_use_cached_wrapped_rpc(): @@ -1985,9 +2004,15 @@ async def test_list_resource_maintenances_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + maintenance_service.ListResourceMaintenancesRequest(), + {}, + ], +) async def test_list_resource_maintenances_async( - transport: str = "grpc_asyncio", - request_type=maintenance_service.ListResourceMaintenancesRequest, + request_type, transport: str = "grpc_asyncio" ): client = MaintenanceAsyncClient( credentials=async_anonymous_credentials(), @@ -1996,7 +2021,7 @@ async def test_list_resource_maintenances_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( @@ -2023,11 +2048,6 @@ async def test_list_resource_maintenances_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_resource_maintenances_async_from_dict(): - await test_list_resource_maintenances_async(request_type=dict) - - def test_list_resource_maintenances_field_headers(): client = MaintenanceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2386,8 +2406,8 @@ async def test_list_resource_maintenances_async_pages(): @pytest.mark.parametrize( "request_type", [ - maintenance_service.GetResourceMaintenanceRequest, - dict, + maintenance_service.GetResourceMaintenanceRequest(), + {}, ], ) def test_get_resource_maintenance(request_type, transport: str = "grpc"): @@ -2398,7 +2418,7 @@ def test_get_resource_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( @@ -2454,9 +2474,10 @@ def test_get_resource_maintenance_non_empty_request_with_auto_populated_field(): client.get_resource_maintenance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == maintenance_service.GetResourceMaintenanceRequest( + request_msg = maintenance_service.GetResourceMaintenanceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_resource_maintenance_use_cached_wrapped_rpc(): @@ -2542,9 +2563,15 @@ async def test_get_resource_maintenance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + maintenance_service.GetResourceMaintenanceRequest(), + {}, + ], +) async def test_get_resource_maintenance_async( - transport: str = "grpc_asyncio", - request_type=maintenance_service.GetResourceMaintenanceRequest, + request_type, transport: str = "grpc_asyncio" ): client = MaintenanceAsyncClient( credentials=async_anonymous_credentials(), @@ -2553,7 +2580,7 @@ async def test_get_resource_maintenance_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( @@ -2586,11 +2613,6 @@ async def test_get_resource_maintenance_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_resource_maintenance_async_from_dict(): - await test_get_resource_maintenance_async(request_type=dict) - - def test_get_resource_maintenance_field_headers(): client = MaintenanceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3596,7 +3618,6 @@ def test_summarize_maintenances_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = maintenance_service.SummarizeMaintenancesRequest() - assert args[0] == request_msg @@ -3619,7 +3640,6 @@ def test_list_resource_maintenances_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = maintenance_service.ListResourceMaintenancesRequest() - assert args[0] == request_msg @@ -3642,7 +3662,6 @@ def test_get_resource_maintenance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = maintenance_service.GetResourceMaintenanceRequest() - assert args[0] == request_msg @@ -3686,7 +3705,6 @@ async def test_summarize_maintenances_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = maintenance_service.SummarizeMaintenancesRequest() - assert args[0] == request_msg @@ -3716,7 +3734,6 @@ async def test_list_resource_maintenances_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = maintenance_service.ListResourceMaintenancesRequest() - assert args[0] == request_msg @@ -3749,7 +3766,6 @@ async def test_get_resource_maintenance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = maintenance_service.GetResourceMaintenanceRequest() - assert args[0] == request_msg @@ -4335,7 +4351,6 @@ def test_summarize_maintenances_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = maintenance_service.SummarizeMaintenancesRequest() - assert args[0] == request_msg @@ -4357,7 +4372,6 @@ def test_list_resource_maintenances_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = maintenance_service.ListResourceMaintenancesRequest() - assert args[0] == request_msg @@ -4379,7 +4393,6 @@ def test_get_resource_maintenance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = maintenance_service.GetResourceMaintenanceRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-managed-identities/noxfile.py b/packages/google-cloud-managed-identities/noxfile.py index 87f14afef481..a9c496f3b4cf 100644 --- a/packages/google-cloud-managed-identities/noxfile.py +++ b/packages/google-cloud-managed-identities/noxfile.py @@ -47,7 +47,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-managed-identities" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-managed-identities/setup.py b/packages/google-cloud-managed-identities/setup.py index 74091d5e8be6..6b43890953d3 100644 --- a/packages/google-cloud-managed-identities/setup.py +++ b/packages/google-cloud-managed-identities/setup.py @@ -45,7 +45,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/google-cloud-managed-identities/testing/constraints-3.10.txt b/packages/google-cloud-managed-identities/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-managed-identities/testing/constraints-3.10.txt +++ b/packages/google-cloud-managed-identities/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-managed-identities/tests/unit/gapic/managedidentities_v1/test_managed_identities_service.py b/packages/google-cloud-managed-identities/tests/unit/gapic/managedidentities_v1/test_managed_identities_service.py index 3fe31119e7bf..459845e2ae17 100644 --- a/packages/google-cloud-managed-identities/tests/unit/gapic/managedidentities_v1/test_managed_identities_service.py +++ b/packages/google-cloud-managed-identities/tests/unit/gapic/managedidentities_v1/test_managed_identities_service.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" @@ -1347,8 +1363,8 @@ def test_managed_identities_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - managed_identities_service.CreateMicrosoftAdDomainRequest, - dict, + managed_identities_service.CreateMicrosoftAdDomainRequest(), + {}, ], ) def test_create_microsoft_ad_domain(request_type, transport: str = "grpc"): @@ -1359,7 +1375,7 @@ def test_create_microsoft_ad_domain(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1405,10 +1421,11 @@ def test_create_microsoft_ad_domain_non_empty_request_with_auto_populated_field( client.create_microsoft_ad_domain(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == managed_identities_service.CreateMicrosoftAdDomainRequest( + request_msg = managed_identities_service.CreateMicrosoftAdDomainRequest( parent="parent_value", domain_name="domain_name_value", ) + assert args[0] == request_msg def test_create_microsoft_ad_domain_use_cached_wrapped_rpc(): @@ -1504,9 +1521,15 @@ async def test_create_microsoft_ad_domain_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + managed_identities_service.CreateMicrosoftAdDomainRequest(), + {}, + ], +) async def test_create_microsoft_ad_domain_async( - transport: str = "grpc_asyncio", - request_type=managed_identities_service.CreateMicrosoftAdDomainRequest, + request_type, transport: str = "grpc_asyncio" ): client = ManagedIdentitiesServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1515,7 +1538,7 @@ async def test_create_microsoft_ad_domain_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( @@ -1537,11 +1560,6 @@ async def test_create_microsoft_ad_domain_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_microsoft_ad_domain_async_from_dict(): - await test_create_microsoft_ad_domain_async(request_type=dict) - - def test_create_microsoft_ad_domain_field_headers(): client = ManagedIdentitiesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1716,8 +1734,8 @@ async def test_create_microsoft_ad_domain_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - managed_identities_service.ResetAdminPasswordRequest, - dict, + managed_identities_service.ResetAdminPasswordRequest(), + {}, ], ) def test_reset_admin_password(request_type, transport: str = "grpc"): @@ -1728,7 +1746,7 @@ def test_reset_admin_password(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1776,9 +1794,10 @@ def test_reset_admin_password_non_empty_request_with_auto_populated_field(): client.reset_admin_password(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == managed_identities_service.ResetAdminPasswordRequest( + request_msg = managed_identities_service.ResetAdminPasswordRequest( name="name_value", ) + assert args[0] == request_msg def test_reset_admin_password_use_cached_wrapped_rpc(): @@ -1863,9 +1882,15 @@ async def test_reset_admin_password_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + managed_identities_service.ResetAdminPasswordRequest(), + {}, + ], +) async def test_reset_admin_password_async( - transport: str = "grpc_asyncio", - request_type=managed_identities_service.ResetAdminPasswordRequest, + request_type, transport: str = "grpc_asyncio" ): client = ManagedIdentitiesServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1874,7 +1899,7 @@ async def test_reset_admin_password_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( @@ -1899,11 +1924,6 @@ async def test_reset_admin_password_async( assert response.password == "password_value" -@pytest.mark.asyncio -async def test_reset_admin_password_async_from_dict(): - await test_reset_admin_password_async(request_type=dict) - - def test_reset_admin_password_field_headers(): client = ManagedIdentitiesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2058,8 +2078,8 @@ async def test_reset_admin_password_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - managed_identities_service.ListDomainsRequest, - dict, + managed_identities_service.ListDomainsRequest(), + {}, ], ) def test_list_domains(request_type, transport: str = "grpc"): @@ -2070,7 +2090,7 @@ def test_list_domains(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_domains), "__call__") as call: @@ -2119,12 +2139,13 @@ def test_list_domains_non_empty_request_with_auto_populated_field(): client.list_domains(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == managed_identities_service.ListDomainsRequest( + request_msg = managed_identities_service.ListDomainsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_domains_use_cached_wrapped_rpc(): @@ -2205,10 +2226,14 @@ async def test_list_domains_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_domains_async( - transport: str = "grpc_asyncio", - request_type=managed_identities_service.ListDomainsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + managed_identities_service.ListDomainsRequest(), + {}, + ], +) +async def test_list_domains_async(request_type, transport: str = "grpc_asyncio"): client = ManagedIdentitiesServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2216,7 +2241,7 @@ async def test_list_domains_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_domains), "__call__") as call: @@ -2241,11 +2266,6 @@ async def test_list_domains_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_domains_async_from_dict(): - await test_list_domains_async(request_type=dict) - - def test_list_domains_field_headers(): client = ManagedIdentitiesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2582,8 +2602,8 @@ async def test_list_domains_async_pages(): @pytest.mark.parametrize( "request_type", [ - managed_identities_service.GetDomainRequest, - dict, + managed_identities_service.GetDomainRequest(), + {}, ], ) def test_get_domain(request_type, transport: str = "grpc"): @@ -2594,7 +2614,7 @@ def test_get_domain(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_domain), "__call__") as call: @@ -2652,9 +2672,10 @@ def test_get_domain_non_empty_request_with_auto_populated_field(): client.get_domain(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == managed_identities_service.GetDomainRequest( + request_msg = managed_identities_service.GetDomainRequest( name="name_value", ) + assert args[0] == request_msg def test_get_domain_use_cached_wrapped_rpc(): @@ -2733,10 +2754,14 @@ async def test_get_domain_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_domain_async( - transport: str = "grpc_asyncio", - request_type=managed_identities_service.GetDomainRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + managed_identities_service.GetDomainRequest(), + {}, + ], +) +async def test_get_domain_async(request_type, transport: str = "grpc_asyncio"): client = ManagedIdentitiesServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2744,7 +2769,7 @@ async def test_get_domain_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_domain), "__call__") as call: @@ -2781,11 +2806,6 @@ async def test_get_domain_async( assert response.status_message == "status_message_value" -@pytest.mark.asyncio -async def test_get_domain_async_from_dict(): - await test_get_domain_async(request_type=dict) - - def test_get_domain_field_headers(): client = ManagedIdentitiesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2928,8 +2948,8 @@ async def test_get_domain_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - managed_identities_service.UpdateDomainRequest, - dict, + managed_identities_service.UpdateDomainRequest(), + {}, ], ) def test_update_domain(request_type, transport: str = "grpc"): @@ -2940,7 +2960,7 @@ def test_update_domain(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_domain), "__call__") as call: @@ -2979,7 +2999,8 @@ def test_update_domain_non_empty_request_with_auto_populated_field(): client.update_domain(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == managed_identities_service.UpdateDomainRequest() + request_msg = managed_identities_service.UpdateDomainRequest() + assert args[0] == request_msg def test_update_domain_use_cached_wrapped_rpc(): @@ -3070,10 +3091,14 @@ async def test_update_domain_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_domain_async( - transport: str = "grpc_asyncio", - request_type=managed_identities_service.UpdateDomainRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + managed_identities_service.UpdateDomainRequest(), + {}, + ], +) +async def test_update_domain_async(request_type, transport: str = "grpc_asyncio"): client = ManagedIdentitiesServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3081,7 +3106,7 @@ async def test_update_domain_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_domain), "__call__") as call: @@ -3101,11 +3126,6 @@ async def test_update_domain_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_domain_async_from_dict(): - await test_update_domain_async(request_type=dict) - - def test_update_domain_field_headers(): client = ManagedIdentitiesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3262,8 +3282,8 @@ async def test_update_domain_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - managed_identities_service.DeleteDomainRequest, - dict, + managed_identities_service.DeleteDomainRequest(), + {}, ], ) def test_delete_domain(request_type, transport: str = "grpc"): @@ -3274,7 +3294,7 @@ def test_delete_domain(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_domain), "__call__") as call: @@ -3315,9 +3335,10 @@ def test_delete_domain_non_empty_request_with_auto_populated_field(): client.delete_domain(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == managed_identities_service.DeleteDomainRequest( + request_msg = managed_identities_service.DeleteDomainRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_domain_use_cached_wrapped_rpc(): @@ -3408,10 +3429,14 @@ async def test_delete_domain_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_domain_async( - transport: str = "grpc_asyncio", - request_type=managed_identities_service.DeleteDomainRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + managed_identities_service.DeleteDomainRequest(), + {}, + ], +) +async def test_delete_domain_async(request_type, transport: str = "grpc_asyncio"): client = ManagedIdentitiesServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3419,7 +3444,7 @@ async def test_delete_domain_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_domain), "__call__") as call: @@ -3439,11 +3464,6 @@ async def test_delete_domain_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_domain_async_from_dict(): - await test_delete_domain_async(request_type=dict) - - def test_delete_domain_field_headers(): client = ManagedIdentitiesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3590,8 +3610,8 @@ async def test_delete_domain_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - managed_identities_service.AttachTrustRequest, - dict, + managed_identities_service.AttachTrustRequest(), + {}, ], ) def test_attach_trust(request_type, transport: str = "grpc"): @@ -3602,7 +3622,7 @@ def test_attach_trust(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.attach_trust), "__call__") as call: @@ -3643,9 +3663,10 @@ def test_attach_trust_non_empty_request_with_auto_populated_field(): client.attach_trust(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == managed_identities_service.AttachTrustRequest( + request_msg = managed_identities_service.AttachTrustRequest( name="name_value", ) + assert args[0] == request_msg def test_attach_trust_use_cached_wrapped_rpc(): @@ -3736,10 +3757,14 @@ async def test_attach_trust_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_attach_trust_async( - transport: str = "grpc_asyncio", - request_type=managed_identities_service.AttachTrustRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + managed_identities_service.AttachTrustRequest(), + {}, + ], +) +async def test_attach_trust_async(request_type, transport: str = "grpc_asyncio"): client = ManagedIdentitiesServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3747,7 +3772,7 @@ async def test_attach_trust_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.attach_trust), "__call__") as call: @@ -3767,11 +3792,6 @@ async def test_attach_trust_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_attach_trust_async_from_dict(): - await test_attach_trust_async(request_type=dict) - - def test_attach_trust_field_headers(): client = ManagedIdentitiesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3928,8 +3948,8 @@ async def test_attach_trust_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - managed_identities_service.ReconfigureTrustRequest, - dict, + managed_identities_service.ReconfigureTrustRequest(), + {}, ], ) def test_reconfigure_trust(request_type, transport: str = "grpc"): @@ -3940,7 +3960,7 @@ def test_reconfigure_trust(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3986,10 +4006,11 @@ def test_reconfigure_trust_non_empty_request_with_auto_populated_field(): client.reconfigure_trust(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == managed_identities_service.ReconfigureTrustRequest( + request_msg = managed_identities_service.ReconfigureTrustRequest( name="name_value", target_domain_name="target_domain_name_value", ) + assert args[0] == request_msg def test_reconfigure_trust_use_cached_wrapped_rpc(): @@ -4082,10 +4103,14 @@ async def test_reconfigure_trust_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_reconfigure_trust_async( - transport: str = "grpc_asyncio", - request_type=managed_identities_service.ReconfigureTrustRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + managed_identities_service.ReconfigureTrustRequest(), + {}, + ], +) +async def test_reconfigure_trust_async(request_type, transport: str = "grpc_asyncio"): client = ManagedIdentitiesServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4093,7 +4118,7 @@ async def test_reconfigure_trust_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( @@ -4115,11 +4140,6 @@ async def test_reconfigure_trust_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_reconfigure_trust_async_from_dict(): - await test_reconfigure_trust_async(request_type=dict) - - def test_reconfigure_trust_field_headers(): client = ManagedIdentitiesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4294,8 +4314,8 @@ async def test_reconfigure_trust_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - managed_identities_service.DetachTrustRequest, - dict, + managed_identities_service.DetachTrustRequest(), + {}, ], ) def test_detach_trust(request_type, transport: str = "grpc"): @@ -4306,7 +4326,7 @@ def test_detach_trust(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.detach_trust), "__call__") as call: @@ -4347,9 +4367,10 @@ def test_detach_trust_non_empty_request_with_auto_populated_field(): client.detach_trust(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == managed_identities_service.DetachTrustRequest( + request_msg = managed_identities_service.DetachTrustRequest( name="name_value", ) + assert args[0] == request_msg def test_detach_trust_use_cached_wrapped_rpc(): @@ -4440,10 +4461,14 @@ async def test_detach_trust_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_detach_trust_async( - transport: str = "grpc_asyncio", - request_type=managed_identities_service.DetachTrustRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + managed_identities_service.DetachTrustRequest(), + {}, + ], +) +async def test_detach_trust_async(request_type, transport: str = "grpc_asyncio"): client = ManagedIdentitiesServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4451,7 +4476,7 @@ async def test_detach_trust_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.detach_trust), "__call__") as call: @@ -4471,11 +4496,6 @@ async def test_detach_trust_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_detach_trust_async_from_dict(): - await test_detach_trust_async(request_type=dict) - - def test_detach_trust_field_headers(): client = ManagedIdentitiesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4632,8 +4652,8 @@ async def test_detach_trust_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - managed_identities_service.ValidateTrustRequest, - dict, + managed_identities_service.ValidateTrustRequest(), + {}, ], ) def test_validate_trust(request_type, transport: str = "grpc"): @@ -4644,7 +4664,7 @@ def test_validate_trust(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.validate_trust), "__call__") as call: @@ -4685,9 +4705,10 @@ def test_validate_trust_non_empty_request_with_auto_populated_field(): client.validate_trust(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == managed_identities_service.ValidateTrustRequest( + request_msg = managed_identities_service.ValidateTrustRequest( name="name_value", ) + assert args[0] == request_msg def test_validate_trust_use_cached_wrapped_rpc(): @@ -4778,10 +4799,14 @@ async def test_validate_trust_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_validate_trust_async( - transport: str = "grpc_asyncio", - request_type=managed_identities_service.ValidateTrustRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + managed_identities_service.ValidateTrustRequest(), + {}, + ], +) +async def test_validate_trust_async(request_type, transport: str = "grpc_asyncio"): client = ManagedIdentitiesServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4789,7 +4814,7 @@ async def test_validate_trust_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.validate_trust), "__call__") as call: @@ -4809,11 +4834,6 @@ async def test_validate_trust_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_validate_trust_async_from_dict(): - await test_validate_trust_async(request_type=dict) - - def test_validate_trust_field_headers(): client = ManagedIdentitiesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5091,7 +5111,6 @@ def test_create_microsoft_ad_domain_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_identities_service.CreateMicrosoftAdDomainRequest() - assert args[0] == request_msg @@ -5114,7 +5133,6 @@ def test_reset_admin_password_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_identities_service.ResetAdminPasswordRequest() - assert args[0] == request_msg @@ -5135,7 +5153,6 @@ def test_list_domains_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_identities_service.ListDomainsRequest() - assert args[0] == request_msg @@ -5156,7 +5173,6 @@ def test_get_domain_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_identities_service.GetDomainRequest() - assert args[0] == request_msg @@ -5177,7 +5193,6 @@ def test_update_domain_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_identities_service.UpdateDomainRequest() - assert args[0] == request_msg @@ -5198,7 +5213,6 @@ def test_delete_domain_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_identities_service.DeleteDomainRequest() - assert args[0] == request_msg @@ -5219,7 +5233,6 @@ def test_attach_trust_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_identities_service.AttachTrustRequest() - assert args[0] == request_msg @@ -5242,7 +5255,6 @@ def test_reconfigure_trust_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_identities_service.ReconfigureTrustRequest() - assert args[0] == request_msg @@ -5263,7 +5275,6 @@ def test_detach_trust_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_identities_service.DetachTrustRequest() - assert args[0] == request_msg @@ -5284,7 +5295,6 @@ def test_validate_trust_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_identities_service.ValidateTrustRequest() - assert args[0] == request_msg @@ -5325,7 +5335,6 @@ async def test_create_microsoft_ad_domain_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_identities_service.CreateMicrosoftAdDomainRequest() - assert args[0] == request_msg @@ -5354,7 +5363,6 @@ async def test_reset_admin_password_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_identities_service.ResetAdminPasswordRequest() - assert args[0] == request_msg @@ -5382,7 +5390,6 @@ async def test_list_domains_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_identities_service.ListDomainsRequest() - assert args[0] == request_msg @@ -5416,7 +5423,6 @@ async def test_get_domain_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_identities_service.GetDomainRequest() - assert args[0] == request_msg @@ -5441,7 +5447,6 @@ async def test_update_domain_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_identities_service.UpdateDomainRequest() - assert args[0] == request_msg @@ -5466,7 +5471,6 @@ async def test_delete_domain_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_identities_service.DeleteDomainRequest() - assert args[0] == request_msg @@ -5491,7 +5495,6 @@ async def test_attach_trust_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_identities_service.AttachTrustRequest() - assert args[0] == request_msg @@ -5518,7 +5521,6 @@ async def test_reconfigure_trust_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_identities_service.ReconfigureTrustRequest() - assert args[0] == request_msg @@ -5543,7 +5545,6 @@ async def test_detach_trust_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_identities_service.DetachTrustRequest() - assert args[0] == request_msg @@ -5568,7 +5569,6 @@ async def test_validate_trust_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_identities_service.ValidateTrustRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-managedkafka-schemaregistry/noxfile.py b/packages/google-cloud-managedkafka-schemaregistry/noxfile.py index 4016499367fe..84a7800166e5 100644 --- a/packages/google-cloud-managedkafka-schemaregistry/noxfile.py +++ b/packages/google-cloud-managedkafka-schemaregistry/noxfile.py @@ -47,7 +47,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-managedkafka-schemaregistry" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-managedkafka-schemaregistry/setup.py b/packages/google-cloud-managedkafka-schemaregistry/setup.py index b649cf4a8555..9416c56d5a36 100644 --- a/packages/google-cloud-managedkafka-schemaregistry/setup.py +++ b/packages/google-cloud-managedkafka-schemaregistry/setup.py @@ -47,7 +47,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/google-cloud-managedkafka-schemaregistry/testing/constraints-3.10.txt b/packages/google-cloud-managedkafka-schemaregistry/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-managedkafka-schemaregistry/testing/constraints-3.10.txt +++ b/packages/google-cloud-managedkafka-schemaregistry/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-managedkafka-schemaregistry/tests/unit/gapic/managedkafka_schemaregistry_v1/test_managed_schema_registry.py b/packages/google-cloud-managedkafka-schemaregistry/tests/unit/gapic/managedkafka_schemaregistry_v1/test_managed_schema_registry.py index 96a6a8b52198..5b19c2936d15 100644 --- a/packages/google-cloud-managedkafka-schemaregistry/tests/unit/gapic/managedkafka_schemaregistry_v1/test_managed_schema_registry.py +++ b/packages/google-cloud-managedkafka-schemaregistry/tests/unit/gapic/managedkafka_schemaregistry_v1/test_managed_schema_registry.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 @@ -116,6 +117,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" @@ -1381,8 +1397,8 @@ def test_managed_schema_registry_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - schema_registry.GetSchemaRegistryRequest, - dict, + schema_registry.GetSchemaRegistryRequest(), + {}, ], ) def test_get_schema_registry(request_type, transport: str = "grpc"): @@ -1393,7 +1409,7 @@ def test_get_schema_registry(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1443,9 +1459,10 @@ def test_get_schema_registry_non_empty_request_with_auto_populated_field(): client.get_schema_registry(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == schema_registry.GetSchemaRegistryRequest( + request_msg = schema_registry.GetSchemaRegistryRequest( name="name_value", ) + assert args[0] == request_msg def test_get_schema_registry_use_cached_wrapped_rpc(): @@ -1530,10 +1547,14 @@ async def test_get_schema_registry_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_schema_registry_async( - transport: str = "grpc_asyncio", - request_type=schema_registry.GetSchemaRegistryRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + schema_registry.GetSchemaRegistryRequest(), + {}, + ], +) +async def test_get_schema_registry_async(request_type, transport: str = "grpc_asyncio"): client = ManagedSchemaRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1541,7 +1562,7 @@ async def test_get_schema_registry_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( @@ -1568,11 +1589,6 @@ async def test_get_schema_registry_async( assert response.contexts == ["contexts_value"] -@pytest.mark.asyncio -async def test_get_schema_registry_async_from_dict(): - await test_get_schema_registry_async(request_type=dict) - - def test_get_schema_registry_field_headers(): client = ManagedSchemaRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1727,8 +1743,8 @@ async def test_get_schema_registry_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - schema_registry.ListSchemaRegistriesRequest, - dict, + schema_registry.ListSchemaRegistriesRequest(), + {}, ], ) def test_list_schema_registries(request_type, transport: str = "grpc"): @@ -1739,7 +1755,7 @@ def test_list_schema_registries(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1784,9 +1800,10 @@ def test_list_schema_registries_non_empty_request_with_auto_populated_field(): client.list_schema_registries(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == schema_registry.ListSchemaRegistriesRequest( + request_msg = schema_registry.ListSchemaRegistriesRequest( parent="parent_value", ) + assert args[0] == request_msg def test_list_schema_registries_use_cached_wrapped_rpc(): @@ -1872,9 +1889,15 @@ async def test_list_schema_registries_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + schema_registry.ListSchemaRegistriesRequest(), + {}, + ], +) async def test_list_schema_registries_async( - transport: str = "grpc_asyncio", - request_type=schema_registry.ListSchemaRegistriesRequest, + request_type, transport: str = "grpc_asyncio" ): client = ManagedSchemaRegistryAsyncClient( credentials=async_anonymous_credentials(), @@ -1883,7 +1906,7 @@ async def test_list_schema_registries_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( @@ -1905,11 +1928,6 @@ async def test_list_schema_registries_async( assert isinstance(response, schema_registry.ListSchemaRegistriesResponse) -@pytest.mark.asyncio -async def test_list_schema_registries_async_from_dict(): - await test_list_schema_registries_async(request_type=dict) - - def test_list_schema_registries_field_headers(): client = ManagedSchemaRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2064,8 +2082,8 @@ async def test_list_schema_registries_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcms_schema_registry.CreateSchemaRegistryRequest, - dict, + gcms_schema_registry.CreateSchemaRegistryRequest(), + {}, ], ) def test_create_schema_registry(request_type, transport: str = "grpc"): @@ -2076,7 +2094,7 @@ def test_create_schema_registry(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2127,10 +2145,11 @@ def test_create_schema_registry_non_empty_request_with_auto_populated_field(): client.create_schema_registry(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcms_schema_registry.CreateSchemaRegistryRequest( + request_msg = gcms_schema_registry.CreateSchemaRegistryRequest( parent="parent_value", schema_registry_id="schema_registry_id_value", ) + assert args[0] == request_msg def test_create_schema_registry_use_cached_wrapped_rpc(): @@ -2216,9 +2235,15 @@ async def test_create_schema_registry_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcms_schema_registry.CreateSchemaRegistryRequest(), + {}, + ], +) async def test_create_schema_registry_async( - transport: str = "grpc_asyncio", - request_type=gcms_schema_registry.CreateSchemaRegistryRequest, + request_type, transport: str = "grpc_asyncio" ): client = ManagedSchemaRegistryAsyncClient( credentials=async_anonymous_credentials(), @@ -2227,7 +2252,7 @@ async def test_create_schema_registry_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( @@ -2254,11 +2279,6 @@ async def test_create_schema_registry_async( assert response.contexts == ["contexts_value"] -@pytest.mark.asyncio -async def test_create_schema_registry_async_from_dict(): - await test_create_schema_registry_async(request_type=dict) - - def test_create_schema_registry_field_headers(): client = ManagedSchemaRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2423,8 +2443,8 @@ async def test_create_schema_registry_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - schema_registry.DeleteSchemaRegistryRequest, - dict, + schema_registry.DeleteSchemaRegistryRequest(), + {}, ], ) def test_delete_schema_registry(request_type, transport: str = "grpc"): @@ -2435,7 +2455,7 @@ def test_delete_schema_registry(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2480,9 +2500,10 @@ def test_delete_schema_registry_non_empty_request_with_auto_populated_field(): client.delete_schema_registry(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == schema_registry.DeleteSchemaRegistryRequest( + request_msg = schema_registry.DeleteSchemaRegistryRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_schema_registry_use_cached_wrapped_rpc(): @@ -2568,9 +2589,15 @@ async def test_delete_schema_registry_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + schema_registry.DeleteSchemaRegistryRequest(), + {}, + ], +) async def test_delete_schema_registry_async( - transport: str = "grpc_asyncio", - request_type=schema_registry.DeleteSchemaRegistryRequest, + request_type, transport: str = "grpc_asyncio" ): client = ManagedSchemaRegistryAsyncClient( credentials=async_anonymous_credentials(), @@ -2579,7 +2606,7 @@ async def test_delete_schema_registry_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( @@ -2599,11 +2626,6 @@ async def test_delete_schema_registry_async( assert response is None -@pytest.mark.asyncio -async def test_delete_schema_registry_async_from_dict(): - await test_delete_schema_registry_async(request_type=dict) - - def test_delete_schema_registry_field_headers(): client = ManagedSchemaRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2754,8 +2776,8 @@ async def test_delete_schema_registry_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - schema_registry.GetContextRequest, - dict, + schema_registry.GetContextRequest(), + {}, ], ) def test_get_context(request_type, transport: str = "grpc"): @@ -2766,7 +2788,7 @@ def test_get_context(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_context), "__call__") as call: @@ -2812,9 +2834,10 @@ def test_get_context_non_empty_request_with_auto_populated_field(): client.get_context(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == schema_registry.GetContextRequest( + request_msg = schema_registry.GetContextRequest( name="name_value", ) + assert args[0] == request_msg def test_get_context_use_cached_wrapped_rpc(): @@ -2895,9 +2918,14 @@ async def test_get_context_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_context_async( - transport: str = "grpc_asyncio", request_type=schema_registry.GetContextRequest -): +@pytest.mark.parametrize( + "request_type", + [ + schema_registry.GetContextRequest(), + {}, + ], +) +async def test_get_context_async(request_type, transport: str = "grpc_asyncio"): client = ManagedSchemaRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2905,7 +2933,7 @@ async def test_get_context_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_context), "__call__") as call: @@ -2930,11 +2958,6 @@ async def test_get_context_async( assert response.subjects == ["subjects_value"] -@pytest.mark.asyncio -async def test_get_context_async_from_dict(): - await test_get_context_async(request_type=dict) - - def test_get_context_field_headers(): client = ManagedSchemaRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3081,8 +3104,8 @@ async def test_get_context_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - schema_registry.ListContextsRequest, - dict, + schema_registry.ListContextsRequest(), + {}, ], ) def test_list_contexts(request_type, transport: str = "grpc"): @@ -3093,7 +3116,7 @@ def test_list_contexts(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_contexts), "__call__") as call: @@ -3139,9 +3162,10 @@ def test_list_contexts_non_empty_request_with_auto_populated_field(): client.list_contexts(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == schema_registry.ListContextsRequest( + request_msg = schema_registry.ListContextsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_list_contexts_use_cached_wrapped_rpc(): @@ -3222,9 +3246,14 @@ async def test_list_contexts_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_contexts_async( - transport: str = "grpc_asyncio", request_type=schema_registry.ListContextsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + schema_registry.ListContextsRequest(), + {}, + ], +) +async def test_list_contexts_async(request_type, transport: str = "grpc_asyncio"): client = ManagedSchemaRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3232,7 +3261,7 @@ async def test_list_contexts_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_contexts), "__call__") as call: @@ -3257,11 +3286,6 @@ async def test_list_contexts_async( assert response.data == b"data_blob" -@pytest.mark.asyncio -async def test_list_contexts_async_from_dict(): - await test_list_contexts_async(request_type=dict) - - def test_list_contexts_field_headers(): client = ManagedSchemaRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3408,8 +3432,8 @@ async def test_list_contexts_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - schema_registry.GetSchemaRequest, - dict, + schema_registry.GetSchemaRequest(), + {}, ], ) def test_get_schema(request_type, transport: str = "grpc"): @@ -3420,7 +3444,7 @@ def test_get_schema(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_schema), "__call__") as call: @@ -3467,10 +3491,11 @@ def test_get_schema_non_empty_request_with_auto_populated_field(): client.get_schema(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == schema_registry.GetSchemaRequest( + request_msg = schema_registry.GetSchemaRequest( name="name_value", subject="subject_value", ) + assert args[0] == request_msg def test_get_schema_use_cached_wrapped_rpc(): @@ -3549,9 +3574,14 @@ async def test_get_schema_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_schema_async( - transport: str = "grpc_asyncio", request_type=schema_registry.GetSchemaRequest -): +@pytest.mark.parametrize( + "request_type", + [ + schema_registry.GetSchemaRequest(), + {}, + ], +) +async def test_get_schema_async(request_type, transport: str = "grpc_asyncio"): client = ManagedSchemaRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3559,7 +3589,7 @@ async def test_get_schema_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_schema), "__call__") as call: @@ -3584,11 +3614,6 @@ async def test_get_schema_async( assert response.schema_payload == "schema_payload_value" -@pytest.mark.asyncio -async def test_get_schema_async_from_dict(): - await test_get_schema_async(request_type=dict) - - def test_get_schema_field_headers(): client = ManagedSchemaRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3735,8 +3760,8 @@ async def test_get_schema_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - schema_registry.GetSchemaRequest, - dict, + schema_registry.GetSchemaRequest(), + {}, ], ) def test_get_raw_schema(request_type, transport: str = "grpc"): @@ -3747,7 +3772,7 @@ def test_get_raw_schema(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_raw_schema), "__call__") as call: @@ -3794,10 +3819,11 @@ def test_get_raw_schema_non_empty_request_with_auto_populated_field(): client.get_raw_schema(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == schema_registry.GetSchemaRequest( + request_msg = schema_registry.GetSchemaRequest( name="name_value", subject="subject_value", ) + assert args[0] == request_msg def test_get_raw_schema_use_cached_wrapped_rpc(): @@ -3878,9 +3904,14 @@ async def test_get_raw_schema_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_raw_schema_async( - transport: str = "grpc_asyncio", request_type=schema_registry.GetSchemaRequest -): +@pytest.mark.parametrize( + "request_type", + [ + schema_registry.GetSchemaRequest(), + {}, + ], +) +async def test_get_raw_schema_async(request_type, transport: str = "grpc_asyncio"): client = ManagedSchemaRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3888,7 +3919,7 @@ async def test_get_raw_schema_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_raw_schema), "__call__") as call: @@ -3913,11 +3944,6 @@ async def test_get_raw_schema_async( assert response.data == b"data_blob" -@pytest.mark.asyncio -async def test_get_raw_schema_async_from_dict(): - await test_get_raw_schema_async(request_type=dict) - - def test_get_raw_schema_field_headers(): client = ManagedSchemaRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4064,8 +4090,8 @@ async def test_get_raw_schema_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - schema_registry.ListSchemaVersionsRequest, - dict, + schema_registry.ListSchemaVersionsRequest(), + {}, ], ) def test_list_schema_versions(request_type, transport: str = "grpc"): @@ -4076,7 +4102,7 @@ def test_list_schema_versions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4127,10 +4153,11 @@ def test_list_schema_versions_non_empty_request_with_auto_populated_field(): client.list_schema_versions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == schema_registry.ListSchemaVersionsRequest( + request_msg = schema_registry.ListSchemaVersionsRequest( parent="parent_value", subject="subject_value", ) + assert args[0] == request_msg def test_list_schema_versions_use_cached_wrapped_rpc(): @@ -4215,9 +4242,15 @@ async def test_list_schema_versions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + schema_registry.ListSchemaVersionsRequest(), + {}, + ], +) async def test_list_schema_versions_async( - transport: str = "grpc_asyncio", - request_type=schema_registry.ListSchemaVersionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = ManagedSchemaRegistryAsyncClient( credentials=async_anonymous_credentials(), @@ -4226,7 +4259,7 @@ async def test_list_schema_versions_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( @@ -4253,11 +4286,6 @@ async def test_list_schema_versions_async( assert response.data == b"data_blob" -@pytest.mark.asyncio -async def test_list_schema_versions_async_from_dict(): - await test_list_schema_versions_async(request_type=dict) - - def test_list_schema_versions_field_headers(): client = ManagedSchemaRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4412,8 +4440,8 @@ async def test_list_schema_versions_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - schema_registry.ListSchemaTypesRequest, - dict, + schema_registry.ListSchemaTypesRequest(), + {}, ], ) def test_list_schema_types(request_type, transport: str = "grpc"): @@ -4424,7 +4452,7 @@ def test_list_schema_types(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4474,9 +4502,10 @@ def test_list_schema_types_non_empty_request_with_auto_populated_field(): client.list_schema_types(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == schema_registry.ListSchemaTypesRequest( + request_msg = schema_registry.ListSchemaTypesRequest( parent="parent_value", ) + assert args[0] == request_msg def test_list_schema_types_use_cached_wrapped_rpc(): @@ -4559,9 +4588,14 @@ async def test_list_schema_types_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_schema_types_async( - transport: str = "grpc_asyncio", request_type=schema_registry.ListSchemaTypesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + schema_registry.ListSchemaTypesRequest(), + {}, + ], +) +async def test_list_schema_types_async(request_type, transport: str = "grpc_asyncio"): client = ManagedSchemaRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4569,7 +4603,7 @@ async def test_list_schema_types_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( @@ -4596,11 +4630,6 @@ async def test_list_schema_types_async( assert response.data == b"data_blob" -@pytest.mark.asyncio -async def test_list_schema_types_async_from_dict(): - await test_list_schema_types_async(request_type=dict) - - def test_list_schema_types_field_headers(): client = ManagedSchemaRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4755,8 +4784,8 @@ async def test_list_schema_types_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - schema_registry.ListSubjectsRequest, - dict, + schema_registry.ListSubjectsRequest(), + {}, ], ) def test_list_subjects(request_type, transport: str = "grpc"): @@ -4767,7 +4796,7 @@ def test_list_subjects(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_subjects), "__call__") as call: @@ -4814,10 +4843,11 @@ def test_list_subjects_non_empty_request_with_auto_populated_field(): client.list_subjects(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == schema_registry.ListSubjectsRequest( + request_msg = schema_registry.ListSubjectsRequest( parent="parent_value", subject_prefix="subject_prefix_value", ) + assert args[0] == request_msg def test_list_subjects_use_cached_wrapped_rpc(): @@ -4898,9 +4928,14 @@ async def test_list_subjects_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_subjects_async( - transport: str = "grpc_asyncio", request_type=schema_registry.ListSubjectsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + schema_registry.ListSubjectsRequest(), + {}, + ], +) +async def test_list_subjects_async(request_type, transport: str = "grpc_asyncio"): client = ManagedSchemaRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4908,7 +4943,7 @@ async def test_list_subjects_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_subjects), "__call__") as call: @@ -4933,11 +4968,6 @@ async def test_list_subjects_async( assert response.data == b"data_blob" -@pytest.mark.asyncio -async def test_list_subjects_async_from_dict(): - await test_list_subjects_async(request_type=dict) - - def test_list_subjects_field_headers(): client = ManagedSchemaRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5104,8 +5134,8 @@ async def test_list_subjects_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - schema_registry.ListSubjectsBySchemaIdRequest, - dict, + schema_registry.ListSubjectsBySchemaIdRequest(), + {}, ], ) def test_list_subjects_by_schema_id(request_type, transport: str = "grpc"): @@ -5116,7 +5146,7 @@ def test_list_subjects_by_schema_id(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5167,10 +5197,11 @@ def test_list_subjects_by_schema_id_non_empty_request_with_auto_populated_field( client.list_subjects_by_schema_id(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == schema_registry.ListSubjectsBySchemaIdRequest( + request_msg = schema_registry.ListSubjectsBySchemaIdRequest( parent="parent_value", subject="subject_value", ) + assert args[0] == request_msg def test_list_subjects_by_schema_id_use_cached_wrapped_rpc(): @@ -5256,9 +5287,15 @@ async def test_list_subjects_by_schema_id_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + schema_registry.ListSubjectsBySchemaIdRequest(), + {}, + ], +) async def test_list_subjects_by_schema_id_async( - transport: str = "grpc_asyncio", - request_type=schema_registry.ListSubjectsBySchemaIdRequest, + request_type, transport: str = "grpc_asyncio" ): client = ManagedSchemaRegistryAsyncClient( credentials=async_anonymous_credentials(), @@ -5267,7 +5304,7 @@ async def test_list_subjects_by_schema_id_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( @@ -5294,11 +5331,6 @@ async def test_list_subjects_by_schema_id_async( assert response.data == b"data_blob" -@pytest.mark.asyncio -async def test_list_subjects_by_schema_id_async_from_dict(): - await test_list_subjects_by_schema_id_async(request_type=dict) - - def test_list_subjects_by_schema_id_field_headers(): client = ManagedSchemaRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5473,8 +5505,8 @@ async def test_list_subjects_by_schema_id_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - schema_registry.DeleteSubjectRequest, - dict, + schema_registry.DeleteSubjectRequest(), + {}, ], ) def test_delete_subject(request_type, transport: str = "grpc"): @@ -5485,7 +5517,7 @@ def test_delete_subject(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_subject), "__call__") as call: @@ -5531,9 +5563,10 @@ def test_delete_subject_non_empty_request_with_auto_populated_field(): client.delete_subject(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == schema_registry.DeleteSubjectRequest( + request_msg = schema_registry.DeleteSubjectRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_subject_use_cached_wrapped_rpc(): @@ -5614,9 +5647,14 @@ async def test_delete_subject_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_subject_async( - transport: str = "grpc_asyncio", request_type=schema_registry.DeleteSubjectRequest -): +@pytest.mark.parametrize( + "request_type", + [ + schema_registry.DeleteSubjectRequest(), + {}, + ], +) +async def test_delete_subject_async(request_type, transport: str = "grpc_asyncio"): client = ManagedSchemaRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5624,7 +5662,7 @@ async def test_delete_subject_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_subject), "__call__") as call: @@ -5649,11 +5687,6 @@ async def test_delete_subject_async( assert response.data == b"data_blob" -@pytest.mark.asyncio -async def test_delete_subject_async_from_dict(): - await test_delete_subject_async(request_type=dict) - - def test_delete_subject_field_headers(): client = ManagedSchemaRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5800,8 +5833,8 @@ async def test_delete_subject_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - schema_registry.LookupVersionRequest, - dict, + schema_registry.LookupVersionRequest(), + {}, ], ) def test_lookup_version(request_type, transport: str = "grpc"): @@ -5812,7 +5845,7 @@ def test_lookup_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.lookup_version), "__call__") as call: @@ -5865,10 +5898,11 @@ def test_lookup_version_non_empty_request_with_auto_populated_field(): client.lookup_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == schema_registry.LookupVersionRequest( + request_msg = schema_registry.LookupVersionRequest( parent="parent_value", schema="schema_value", ) + assert args[0] == request_msg def test_lookup_version_use_cached_wrapped_rpc(): @@ -5949,9 +5983,14 @@ async def test_lookup_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_lookup_version_async( - transport: str = "grpc_asyncio", request_type=schema_registry.LookupVersionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + schema_registry.LookupVersionRequest(), + {}, + ], +) +async def test_lookup_version_async(request_type, transport: str = "grpc_asyncio"): client = ManagedSchemaRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5959,7 +5998,7 @@ async def test_lookup_version_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.lookup_version), "__call__") as call: @@ -5990,11 +6029,6 @@ async def test_lookup_version_async( assert response.schema_payload == "schema_payload_value" -@pytest.mark.asyncio -async def test_lookup_version_async_from_dict(): - await test_lookup_version_async(request_type=dict) - - def test_lookup_version_field_headers(): client = ManagedSchemaRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6151,8 +6185,8 @@ async def test_lookup_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - schema_registry.GetVersionRequest, - dict, + schema_registry.GetVersionRequest(), + {}, ], ) def test_get_version(request_type, transport: str = "grpc"): @@ -6163,7 +6197,7 @@ def test_get_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_version), "__call__") as call: @@ -6215,9 +6249,10 @@ def test_get_version_non_empty_request_with_auto_populated_field(): client.get_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == schema_registry.GetVersionRequest( + request_msg = schema_registry.GetVersionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_version_use_cached_wrapped_rpc(): @@ -6298,9 +6333,14 @@ async def test_get_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_version_async( - transport: str = "grpc_asyncio", request_type=schema_registry.GetVersionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + schema_registry.GetVersionRequest(), + {}, + ], +) +async def test_get_version_async(request_type, transport: str = "grpc_asyncio"): client = ManagedSchemaRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6308,7 +6348,7 @@ async def test_get_version_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_version), "__call__") as call: @@ -6339,11 +6379,6 @@ async def test_get_version_async( assert response.schema_payload == "schema_payload_value" -@pytest.mark.asyncio -async def test_get_version_async_from_dict(): - await test_get_version_async(request_type=dict) - - def test_get_version_field_headers(): client = ManagedSchemaRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6490,8 +6525,8 @@ async def test_get_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - schema_registry.GetVersionRequest, - dict, + schema_registry.GetVersionRequest(), + {}, ], ) def test_get_raw_schema_version(request_type, transport: str = "grpc"): @@ -6502,7 +6537,7 @@ def test_get_raw_schema_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6552,9 +6587,10 @@ def test_get_raw_schema_version_non_empty_request_with_auto_populated_field(): client.get_raw_schema_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == schema_registry.GetVersionRequest( + request_msg = schema_registry.GetVersionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_raw_schema_version_use_cached_wrapped_rpc(): @@ -6640,8 +6676,15 @@ async def test_get_raw_schema_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + schema_registry.GetVersionRequest(), + {}, + ], +) async def test_get_raw_schema_version_async( - transport: str = "grpc_asyncio", request_type=schema_registry.GetVersionRequest + request_type, transport: str = "grpc_asyncio" ): client = ManagedSchemaRegistryAsyncClient( credentials=async_anonymous_credentials(), @@ -6650,7 +6693,7 @@ async def test_get_raw_schema_version_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( @@ -6677,11 +6720,6 @@ async def test_get_raw_schema_version_async( assert response.data == b"data_blob" -@pytest.mark.asyncio -async def test_get_raw_schema_version_async_from_dict(): - await test_get_raw_schema_version_async(request_type=dict) - - def test_get_raw_schema_version_field_headers(): client = ManagedSchemaRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6836,8 +6874,8 @@ async def test_get_raw_schema_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - schema_registry.ListVersionsRequest, - dict, + schema_registry.ListVersionsRequest(), + {}, ], ) def test_list_versions(request_type, transport: str = "grpc"): @@ -6848,7 +6886,7 @@ def test_list_versions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_versions), "__call__") as call: @@ -6894,9 +6932,10 @@ def test_list_versions_non_empty_request_with_auto_populated_field(): client.list_versions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == schema_registry.ListVersionsRequest( + request_msg = schema_registry.ListVersionsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_list_versions_use_cached_wrapped_rpc(): @@ -6977,9 +7016,14 @@ async def test_list_versions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_versions_async( - transport: str = "grpc_asyncio", request_type=schema_registry.ListVersionsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + schema_registry.ListVersionsRequest(), + {}, + ], +) +async def test_list_versions_async(request_type, transport: str = "grpc_asyncio"): client = ManagedSchemaRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6987,7 +7031,7 @@ async def test_list_versions_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_versions), "__call__") as call: @@ -7012,11 +7056,6 @@ async def test_list_versions_async( assert response.data == b"data_blob" -@pytest.mark.asyncio -async def test_list_versions_async_from_dict(): - await test_list_versions_async(request_type=dict) - - def test_list_versions_field_headers(): client = ManagedSchemaRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7163,8 +7202,8 @@ async def test_list_versions_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - schema_registry.CreateVersionRequest, - dict, + schema_registry.CreateVersionRequest(), + {}, ], ) def test_create_version(request_type, transport: str = "grpc"): @@ -7175,7 +7214,7 @@ def test_create_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_version), "__call__") as call: @@ -7220,10 +7259,11 @@ def test_create_version_non_empty_request_with_auto_populated_field(): client.create_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == schema_registry.CreateVersionRequest( + request_msg = schema_registry.CreateVersionRequest( parent="parent_value", schema="schema_value", ) + assert args[0] == request_msg def test_create_version_use_cached_wrapped_rpc(): @@ -7304,9 +7344,14 @@ async def test_create_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_version_async( - transport: str = "grpc_asyncio", request_type=schema_registry.CreateVersionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + schema_registry.CreateVersionRequest(), + {}, + ], +) +async def test_create_version_async(request_type, transport: str = "grpc_asyncio"): client = ManagedSchemaRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7314,7 +7359,7 @@ async def test_create_version_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_version), "__call__") as call: @@ -7337,11 +7382,6 @@ async def test_create_version_async( assert response.id == 205 -@pytest.mark.asyncio -async def test_create_version_async_from_dict(): - await test_create_version_async(request_type=dict) - - def test_create_version_field_headers(): client = ManagedSchemaRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7556,8 +7596,8 @@ async def test_create_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - schema_registry.DeleteVersionRequest, - dict, + schema_registry.DeleteVersionRequest(), + {}, ], ) def test_delete_version(request_type, transport: str = "grpc"): @@ -7568,7 +7608,7 @@ def test_delete_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_version), "__call__") as call: @@ -7614,9 +7654,10 @@ def test_delete_version_non_empty_request_with_auto_populated_field(): client.delete_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == schema_registry.DeleteVersionRequest( + request_msg = schema_registry.DeleteVersionRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_version_use_cached_wrapped_rpc(): @@ -7697,9 +7738,14 @@ async def test_delete_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_version_async( - transport: str = "grpc_asyncio", request_type=schema_registry.DeleteVersionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + schema_registry.DeleteVersionRequest(), + {}, + ], +) +async def test_delete_version_async(request_type, transport: str = "grpc_asyncio"): client = ManagedSchemaRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7707,7 +7753,7 @@ async def test_delete_version_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_version), "__call__") as call: @@ -7732,11 +7778,6 @@ async def test_delete_version_async( assert response.data == b"data_blob" -@pytest.mark.asyncio -async def test_delete_version_async_from_dict(): - await test_delete_version_async(request_type=dict) - - def test_delete_version_field_headers(): client = ManagedSchemaRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7883,8 +7924,8 @@ async def test_delete_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - schema_registry.ListReferencedSchemasRequest, - dict, + schema_registry.ListReferencedSchemasRequest(), + {}, ], ) def test_list_referenced_schemas(request_type, transport: str = "grpc"): @@ -7895,7 +7936,7 @@ def test_list_referenced_schemas(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7945,9 +7986,10 @@ def test_list_referenced_schemas_non_empty_request_with_auto_populated_field(): client.list_referenced_schemas(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == schema_registry.ListReferencedSchemasRequest( + request_msg = schema_registry.ListReferencedSchemasRequest( parent="parent_value", ) + assert args[0] == request_msg def test_list_referenced_schemas_use_cached_wrapped_rpc(): @@ -8033,9 +8075,15 @@ async def test_list_referenced_schemas_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + schema_registry.ListReferencedSchemasRequest(), + {}, + ], +) async def test_list_referenced_schemas_async( - transport: str = "grpc_asyncio", - request_type=schema_registry.ListReferencedSchemasRequest, + request_type, transport: str = "grpc_asyncio" ): client = ManagedSchemaRegistryAsyncClient( credentials=async_anonymous_credentials(), @@ -8044,7 +8092,7 @@ async def test_list_referenced_schemas_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( @@ -8071,11 +8119,6 @@ async def test_list_referenced_schemas_async( assert response.data == b"data_blob" -@pytest.mark.asyncio -async def test_list_referenced_schemas_async_from_dict(): - await test_list_referenced_schemas_async(request_type=dict) - - def test_list_referenced_schemas_field_headers(): client = ManagedSchemaRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8230,8 +8273,8 @@ async def test_list_referenced_schemas_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - schema_registry.CheckCompatibilityRequest, - dict, + schema_registry.CheckCompatibilityRequest(), + {}, ], ) def test_check_compatibility(request_type, transport: str = "grpc"): @@ -8242,7 +8285,7 @@ def test_check_compatibility(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8293,10 +8336,11 @@ def test_check_compatibility_non_empty_request_with_auto_populated_field(): client.check_compatibility(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == schema_registry.CheckCompatibilityRequest( + request_msg = schema_registry.CheckCompatibilityRequest( name="name_value", schema="schema_value", ) + assert args[0] == request_msg def test_check_compatibility_use_cached_wrapped_rpc(): @@ -8381,10 +8425,14 @@ async def test_check_compatibility_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_check_compatibility_async( - transport: str = "grpc_asyncio", - request_type=schema_registry.CheckCompatibilityRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + schema_registry.CheckCompatibilityRequest(), + {}, + ], +) +async def test_check_compatibility_async(request_type, transport: str = "grpc_asyncio"): client = ManagedSchemaRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8392,7 +8440,7 @@ async def test_check_compatibility_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( @@ -8419,11 +8467,6 @@ async def test_check_compatibility_async( assert response.messages == ["messages_value"] -@pytest.mark.asyncio -async def test_check_compatibility_async_from_dict(): - await test_check_compatibility_async(request_type=dict) - - def test_check_compatibility_field_headers(): client = ManagedSchemaRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8588,8 +8631,8 @@ async def test_check_compatibility_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - schema_registry.GetSchemaConfigRequest, - dict, + schema_registry.GetSchemaConfigRequest(), + {}, ], ) def test_get_schema_config(request_type, transport: str = "grpc"): @@ -8600,7 +8643,7 @@ def test_get_schema_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( @@ -8655,9 +8698,10 @@ def test_get_schema_config_non_empty_request_with_auto_populated_field(): client.get_schema_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == schema_registry.GetSchemaConfigRequest( + request_msg = schema_registry.GetSchemaConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_schema_config_use_cached_wrapped_rpc(): @@ -8740,9 +8784,14 @@ async def test_get_schema_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_schema_config_async( - transport: str = "grpc_asyncio", request_type=schema_registry.GetSchemaConfigRequest -): +@pytest.mark.parametrize( + "request_type", + [ + schema_registry.GetSchemaConfigRequest(), + {}, + ], +) +async def test_get_schema_config_async(request_type, transport: str = "grpc_asyncio"): client = ManagedSchemaRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8750,7 +8799,7 @@ async def test_get_schema_config_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( @@ -8782,11 +8831,6 @@ async def test_get_schema_config_async( assert response.alias == "alias_value" -@pytest.mark.asyncio -async def test_get_schema_config_async_from_dict(): - await test_get_schema_config_async(request_type=dict) - - def test_get_schema_config_field_headers(): client = ManagedSchemaRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8941,8 +8985,8 @@ async def test_get_schema_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - schema_registry.UpdateSchemaConfigRequest, - dict, + schema_registry.UpdateSchemaConfigRequest(), + {}, ], ) def test_update_schema_config(request_type, transport: str = "grpc"): @@ -8953,7 +8997,7 @@ def test_update_schema_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( @@ -9008,9 +9052,10 @@ def test_update_schema_config_non_empty_request_with_auto_populated_field(): client.update_schema_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == schema_registry.UpdateSchemaConfigRequest( + request_msg = schema_registry.UpdateSchemaConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_update_schema_config_use_cached_wrapped_rpc(): @@ -9095,9 +9140,15 @@ async def test_update_schema_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + schema_registry.UpdateSchemaConfigRequest(), + {}, + ], +) async def test_update_schema_config_async( - transport: str = "grpc_asyncio", - request_type=schema_registry.UpdateSchemaConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = ManagedSchemaRegistryAsyncClient( credentials=async_anonymous_credentials(), @@ -9106,7 +9157,7 @@ async def test_update_schema_config_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( @@ -9138,11 +9189,6 @@ async def test_update_schema_config_async( assert response.alias == "alias_value" -@pytest.mark.asyncio -async def test_update_schema_config_async_from_dict(): - await test_update_schema_config_async(request_type=dict) - - def test_update_schema_config_field_headers(): client = ManagedSchemaRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9307,8 +9353,8 @@ async def test_update_schema_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - schema_registry.DeleteSchemaConfigRequest, - dict, + schema_registry.DeleteSchemaConfigRequest(), + {}, ], ) def test_delete_schema_config(request_type, transport: str = "grpc"): @@ -9319,7 +9365,7 @@ def test_delete_schema_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( @@ -9374,9 +9420,10 @@ def test_delete_schema_config_non_empty_request_with_auto_populated_field(): client.delete_schema_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == schema_registry.DeleteSchemaConfigRequest( + request_msg = schema_registry.DeleteSchemaConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_schema_config_use_cached_wrapped_rpc(): @@ -9461,9 +9508,15 @@ async def test_delete_schema_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + schema_registry.DeleteSchemaConfigRequest(), + {}, + ], +) async def test_delete_schema_config_async( - transport: str = "grpc_asyncio", - request_type=schema_registry.DeleteSchemaConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = ManagedSchemaRegistryAsyncClient( credentials=async_anonymous_credentials(), @@ -9472,7 +9525,7 @@ async def test_delete_schema_config_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( @@ -9504,11 +9557,6 @@ async def test_delete_schema_config_async( assert response.alias == "alias_value" -@pytest.mark.asyncio -async def test_delete_schema_config_async_from_dict(): - await test_delete_schema_config_async(request_type=dict) - - def test_delete_schema_config_field_headers(): client = ManagedSchemaRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9663,8 +9711,8 @@ async def test_delete_schema_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - schema_registry.GetSchemaModeRequest, - dict, + schema_registry.GetSchemaModeRequest(), + {}, ], ) def test_get_schema_mode(request_type, transport: str = "grpc"): @@ -9675,7 +9723,7 @@ def test_get_schema_mode(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_schema_mode), "__call__") as call: @@ -9719,9 +9767,10 @@ def test_get_schema_mode_non_empty_request_with_auto_populated_field(): client.get_schema_mode(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == schema_registry.GetSchemaModeRequest( + request_msg = schema_registry.GetSchemaModeRequest( name="name_value", ) + assert args[0] == request_msg def test_get_schema_mode_use_cached_wrapped_rpc(): @@ -9802,9 +9851,14 @@ async def test_get_schema_mode_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_schema_mode_async( - transport: str = "grpc_asyncio", request_type=schema_registry.GetSchemaModeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + schema_registry.GetSchemaModeRequest(), + {}, + ], +) +async def test_get_schema_mode_async(request_type, transport: str = "grpc_asyncio"): client = ManagedSchemaRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9812,7 +9866,7 @@ async def test_get_schema_mode_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_schema_mode), "__call__") as call: @@ -9835,11 +9889,6 @@ async def test_get_schema_mode_async( assert response.mode == schema_registry_resources.SchemaMode.ModeType.READONLY -@pytest.mark.asyncio -async def test_get_schema_mode_async_from_dict(): - await test_get_schema_mode_async(request_type=dict) - - def test_get_schema_mode_field_headers(): client = ManagedSchemaRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9986,8 +10035,8 @@ async def test_get_schema_mode_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - schema_registry.UpdateSchemaModeRequest, - dict, + schema_registry.UpdateSchemaModeRequest(), + {}, ], ) def test_update_schema_mode(request_type, transport: str = "grpc"): @@ -9998,7 +10047,7 @@ def test_update_schema_mode(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10046,9 +10095,10 @@ def test_update_schema_mode_non_empty_request_with_auto_populated_field(): client.update_schema_mode(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == schema_registry.UpdateSchemaModeRequest( + request_msg = schema_registry.UpdateSchemaModeRequest( name="name_value", ) + assert args[0] == request_msg def test_update_schema_mode_use_cached_wrapped_rpc(): @@ -10133,10 +10183,14 @@ async def test_update_schema_mode_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_schema_mode_async( - transport: str = "grpc_asyncio", - request_type=schema_registry.UpdateSchemaModeRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + schema_registry.UpdateSchemaModeRequest(), + {}, + ], +) +async def test_update_schema_mode_async(request_type, transport: str = "grpc_asyncio"): client = ManagedSchemaRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10144,7 +10198,7 @@ async def test_update_schema_mode_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( @@ -10169,11 +10223,6 @@ async def test_update_schema_mode_async( assert response.mode == schema_registry_resources.SchemaMode.ModeType.READONLY -@pytest.mark.asyncio -async def test_update_schema_mode_async_from_dict(): - await test_update_schema_mode_async(request_type=dict) - - def test_update_schema_mode_field_headers(): client = ManagedSchemaRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10338,8 +10387,8 @@ async def test_update_schema_mode_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - schema_registry.DeleteSchemaModeRequest, - dict, + schema_registry.DeleteSchemaModeRequest(), + {}, ], ) def test_delete_schema_mode(request_type, transport: str = "grpc"): @@ -10350,7 +10399,7 @@ def test_delete_schema_mode(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,9 +10447,10 @@ def test_delete_schema_mode_non_empty_request_with_auto_populated_field(): client.delete_schema_mode(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == schema_registry.DeleteSchemaModeRequest( + request_msg = schema_registry.DeleteSchemaModeRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_schema_mode_use_cached_wrapped_rpc(): @@ -10485,10 +10535,14 @@ async def test_delete_schema_mode_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_schema_mode_async( - transport: str = "grpc_asyncio", - request_type=schema_registry.DeleteSchemaModeRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + schema_registry.DeleteSchemaModeRequest(), + {}, + ], +) +async def test_delete_schema_mode_async(request_type, transport: str = "grpc_asyncio"): client = ManagedSchemaRegistryAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10496,7 +10550,7 @@ async def test_delete_schema_mode_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( @@ -10521,11 +10575,6 @@ async def test_delete_schema_mode_async( assert response.mode == schema_registry_resources.SchemaMode.ModeType.READONLY -@pytest.mark.asyncio -async def test_delete_schema_mode_async_from_dict(): - await test_delete_schema_mode_async(request_type=dict) - - def test_delete_schema_mode_field_headers(): client = ManagedSchemaRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15835,7 +15884,6 @@ def test_get_schema_registry_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.GetSchemaRegistryRequest() - assert args[0] == request_msg @@ -15858,7 +15906,6 @@ def test_list_schema_registries_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.ListSchemaRegistriesRequest() - assert args[0] == request_msg @@ -15881,7 +15928,6 @@ def test_create_schema_registry_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcms_schema_registry.CreateSchemaRegistryRequest() - assert args[0] == request_msg @@ -15904,7 +15950,6 @@ def test_delete_schema_registry_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.DeleteSchemaRegistryRequest() - assert args[0] == request_msg @@ -15925,7 +15970,6 @@ def test_get_context_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.GetContextRequest() - assert args[0] == request_msg @@ -15946,7 +15990,6 @@ def test_list_contexts_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.ListContextsRequest() - assert args[0] == request_msg @@ -15967,7 +16010,6 @@ def test_get_schema_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.GetSchemaRequest() - assert args[0] == request_msg @@ -15988,7 +16030,6 @@ def test_get_raw_schema_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.GetSchemaRequest() - assert args[0] == request_msg @@ -16011,7 +16052,6 @@ def test_list_schema_versions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.ListSchemaVersionsRequest() - assert args[0] == request_msg @@ -16034,7 +16074,6 @@ def test_list_schema_types_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.ListSchemaTypesRequest() - assert args[0] == request_msg @@ -16055,7 +16094,6 @@ def test_list_subjects_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.ListSubjectsRequest() - assert args[0] == request_msg @@ -16078,7 +16116,6 @@ def test_list_subjects_by_schema_id_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.ListSubjectsBySchemaIdRequest() - assert args[0] == request_msg @@ -16099,7 +16136,6 @@ def test_delete_subject_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.DeleteSubjectRequest() - assert args[0] == request_msg @@ -16120,7 +16156,6 @@ def test_lookup_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.LookupVersionRequest() - assert args[0] == request_msg @@ -16141,7 +16176,6 @@ def test_get_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.GetVersionRequest() - assert args[0] == request_msg @@ -16164,7 +16198,6 @@ def test_get_raw_schema_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.GetVersionRequest() - assert args[0] == request_msg @@ -16185,7 +16218,6 @@ def test_list_versions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.ListVersionsRequest() - assert args[0] == request_msg @@ -16206,7 +16238,6 @@ def test_create_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.CreateVersionRequest() - assert args[0] == request_msg @@ -16227,7 +16258,6 @@ def test_delete_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.DeleteVersionRequest() - assert args[0] == request_msg @@ -16250,7 +16280,6 @@ def test_list_referenced_schemas_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.ListReferencedSchemasRequest() - assert args[0] == request_msg @@ -16273,7 +16302,6 @@ def test_check_compatibility_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.CheckCompatibilityRequest() - assert args[0] == request_msg @@ -16296,7 +16324,6 @@ def test_get_schema_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.GetSchemaConfigRequest() - assert args[0] == request_msg @@ -16319,7 +16346,6 @@ def test_update_schema_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.UpdateSchemaConfigRequest() - assert args[0] == request_msg @@ -16342,7 +16368,6 @@ def test_delete_schema_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.DeleteSchemaConfigRequest() - assert args[0] == request_msg @@ -16363,7 +16388,6 @@ def test_get_schema_mode_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.GetSchemaModeRequest() - assert args[0] == request_msg @@ -16386,7 +16410,6 @@ def test_update_schema_mode_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.UpdateSchemaModeRequest() - assert args[0] == request_msg @@ -16409,7 +16432,6 @@ def test_delete_schema_mode_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.DeleteSchemaModeRequest() - assert args[0] == request_msg @@ -16453,7 +16475,6 @@ async def test_get_schema_registry_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.GetSchemaRegistryRequest() - assert args[0] == request_msg @@ -16480,7 +16501,6 @@ async def test_list_schema_registries_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.ListSchemaRegistriesRequest() - assert args[0] == request_msg @@ -16510,7 +16530,6 @@ async def test_create_schema_registry_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcms_schema_registry.CreateSchemaRegistryRequest() - assert args[0] == request_msg @@ -16535,7 +16554,6 @@ async def test_delete_schema_registry_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.DeleteSchemaRegistryRequest() - assert args[0] == request_msg @@ -16563,7 +16581,6 @@ async def test_get_context_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.GetContextRequest() - assert args[0] == request_msg @@ -16591,7 +16608,6 @@ async def test_list_contexts_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.ListContextsRequest() - assert args[0] == request_msg @@ -16619,7 +16635,6 @@ async def test_get_schema_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.GetSchemaRequest() - assert args[0] == request_msg @@ -16647,7 +16662,6 @@ async def test_get_raw_schema_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.GetSchemaRequest() - assert args[0] == request_msg @@ -16677,7 +16691,6 @@ async def test_list_schema_versions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.ListSchemaVersionsRequest() - assert args[0] == request_msg @@ -16707,7 +16720,6 @@ async def test_list_schema_types_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.ListSchemaTypesRequest() - assert args[0] == request_msg @@ -16735,7 +16747,6 @@ async def test_list_subjects_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.ListSubjectsRequest() - assert args[0] == request_msg @@ -16765,7 +16776,6 @@ async def test_list_subjects_by_schema_id_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.ListSubjectsBySchemaIdRequest() - assert args[0] == request_msg @@ -16793,7 +16803,6 @@ async def test_delete_subject_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.DeleteSubjectRequest() - assert args[0] == request_msg @@ -16824,7 +16833,6 @@ async def test_lookup_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.LookupVersionRequest() - assert args[0] == request_msg @@ -16855,7 +16863,6 @@ async def test_get_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.GetVersionRequest() - assert args[0] == request_msg @@ -16885,7 +16892,6 @@ async def test_get_raw_schema_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.GetVersionRequest() - assert args[0] == request_msg @@ -16913,7 +16919,6 @@ async def test_list_versions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.ListVersionsRequest() - assert args[0] == request_msg @@ -16940,7 +16945,6 @@ async def test_create_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.CreateVersionRequest() - assert args[0] == request_msg @@ -16968,7 +16972,6 @@ async def test_delete_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.DeleteVersionRequest() - assert args[0] == request_msg @@ -16998,7 +17001,6 @@ async def test_list_referenced_schemas_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.ListReferencedSchemasRequest() - assert args[0] == request_msg @@ -17028,7 +17030,6 @@ async def test_check_compatibility_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.CheckCompatibilityRequest() - assert args[0] == request_msg @@ -17059,7 +17060,6 @@ async def test_get_schema_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.GetSchemaConfigRequest() - assert args[0] == request_msg @@ -17090,7 +17090,6 @@ async def test_update_schema_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.UpdateSchemaConfigRequest() - assert args[0] == request_msg @@ -17121,7 +17120,6 @@ async def test_delete_schema_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.DeleteSchemaConfigRequest() - assert args[0] == request_msg @@ -17148,7 +17146,6 @@ async def test_get_schema_mode_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.GetSchemaModeRequest() - assert args[0] == request_msg @@ -17177,7 +17174,6 @@ async def test_update_schema_mode_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.UpdateSchemaModeRequest() - assert args[0] == request_msg @@ -17206,7 +17202,6 @@ async def test_delete_schema_mode_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.DeleteSchemaModeRequest() - assert args[0] == request_msg @@ -21337,7 +21332,6 @@ def test_get_schema_registry_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.GetSchemaRegistryRequest() - assert args[0] == request_msg @@ -21359,7 +21353,6 @@ def test_list_schema_registries_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.ListSchemaRegistriesRequest() - assert args[0] == request_msg @@ -21381,7 +21374,6 @@ def test_create_schema_registry_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcms_schema_registry.CreateSchemaRegistryRequest() - assert args[0] == request_msg @@ -21403,7 +21395,6 @@ def test_delete_schema_registry_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.DeleteSchemaRegistryRequest() - assert args[0] == request_msg @@ -21423,7 +21414,6 @@ def test_get_context_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.GetContextRequest() - assert args[0] == request_msg @@ -21443,7 +21433,6 @@ def test_list_contexts_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.ListContextsRequest() - assert args[0] == request_msg @@ -21463,7 +21452,6 @@ def test_get_schema_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.GetSchemaRequest() - assert args[0] == request_msg @@ -21483,7 +21471,6 @@ def test_get_raw_schema_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.GetSchemaRequest() - assert args[0] == request_msg @@ -21505,7 +21492,6 @@ def test_list_schema_versions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.ListSchemaVersionsRequest() - assert args[0] == request_msg @@ -21527,7 +21513,6 @@ def test_list_schema_types_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.ListSchemaTypesRequest() - assert args[0] == request_msg @@ -21547,7 +21532,6 @@ def test_list_subjects_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.ListSubjectsRequest() - assert args[0] == request_msg @@ -21569,7 +21553,6 @@ def test_list_subjects_by_schema_id_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.ListSubjectsBySchemaIdRequest() - assert args[0] == request_msg @@ -21589,7 +21572,6 @@ def test_delete_subject_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.DeleteSubjectRequest() - assert args[0] == request_msg @@ -21609,7 +21591,6 @@ def test_lookup_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.LookupVersionRequest() - assert args[0] == request_msg @@ -21629,7 +21610,6 @@ def test_get_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.GetVersionRequest() - assert args[0] == request_msg @@ -21651,7 +21631,6 @@ def test_get_raw_schema_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.GetVersionRequest() - assert args[0] == request_msg @@ -21671,7 +21650,6 @@ def test_list_versions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.ListVersionsRequest() - assert args[0] == request_msg @@ -21691,7 +21669,6 @@ def test_create_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.CreateVersionRequest() - assert args[0] == request_msg @@ -21711,7 +21688,6 @@ def test_delete_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.DeleteVersionRequest() - assert args[0] == request_msg @@ -21733,7 +21709,6 @@ def test_list_referenced_schemas_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.ListReferencedSchemasRequest() - assert args[0] == request_msg @@ -21755,7 +21730,6 @@ def test_check_compatibility_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.CheckCompatibilityRequest() - assert args[0] == request_msg @@ -21777,7 +21751,6 @@ def test_get_schema_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.GetSchemaConfigRequest() - assert args[0] == request_msg @@ -21799,7 +21772,6 @@ def test_update_schema_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.UpdateSchemaConfigRequest() - assert args[0] == request_msg @@ -21821,7 +21793,6 @@ def test_delete_schema_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.DeleteSchemaConfigRequest() - assert args[0] == request_msg @@ -21841,7 +21812,6 @@ def test_get_schema_mode_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.GetSchemaModeRequest() - assert args[0] == request_msg @@ -21863,7 +21833,6 @@ def test_update_schema_mode_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.UpdateSchemaModeRequest() - assert args[0] == request_msg @@ -21885,7 +21854,6 @@ def test_delete_schema_mode_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema_registry.DeleteSchemaModeRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-managedkafka/noxfile.py b/packages/google-cloud-managedkafka/noxfile.py index 4a5286655c93..c37d675428ee 100644 --- a/packages/google-cloud-managedkafka/noxfile.py +++ b/packages/google-cloud-managedkafka/noxfile.py @@ -47,7 +47,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-managedkafka" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-managedkafka/setup.py b/packages/google-cloud-managedkafka/setup.py index 7c8ee14bac34..d9ea063674ea 100644 --- a/packages/google-cloud-managedkafka/setup.py +++ b/packages/google-cloud-managedkafka/setup.py @@ -45,7 +45,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/google-cloud-managedkafka/testing/constraints-3.10.txt b/packages/google-cloud-managedkafka/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-managedkafka/testing/constraints-3.10.txt +++ b/packages/google-cloud-managedkafka/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-managedkafka/tests/unit/gapic/managedkafka_v1/test_managed_kafka.py b/packages/google-cloud-managedkafka/tests/unit/gapic/managedkafka_v1/test_managed_kafka.py index 5fe2789df831..48832b931360 100644 --- a/packages/google-cloud-managedkafka/tests/unit/gapic/managedkafka_v1/test_managed_kafka.py +++ b/packages/google-cloud-managedkafka/tests/unit/gapic/managedkafka_v1/test_managed_kafka.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 @@ -116,6 +117,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" @@ -1296,8 +1312,8 @@ def test_managed_kafka_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - managed_kafka.ListClustersRequest, - dict, + managed_kafka.ListClustersRequest(), + {}, ], ) def test_list_clusters(request_type, transport: str = "grpc"): @@ -1308,7 +1324,7 @@ def test_list_clusters(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_clusters), "__call__") as call: @@ -1357,12 +1373,13 @@ def test_list_clusters_non_empty_request_with_auto_populated_field(): client.list_clusters(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == managed_kafka.ListClustersRequest( + request_msg = managed_kafka.ListClustersRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_clusters_use_cached_wrapped_rpc(): @@ -1443,9 +1460,14 @@ async def test_list_clusters_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_clusters_async( - transport: str = "grpc_asyncio", request_type=managed_kafka.ListClustersRequest -): +@pytest.mark.parametrize( + "request_type", + [ + managed_kafka.ListClustersRequest(), + {}, + ], +) +async def test_list_clusters_async(request_type, transport: str = "grpc_asyncio"): client = ManagedKafkaAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1453,7 +1475,7 @@ async def test_list_clusters_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_clusters), "__call__") as call: @@ -1478,11 +1500,6 @@ async def test_list_clusters_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_clusters_async_from_dict(): - await test_list_clusters_async(request_type=dict) - - def test_list_clusters_field_headers(): client = ManagedKafkaClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1819,8 +1836,8 @@ async def test_list_clusters_async_pages(): @pytest.mark.parametrize( "request_type", [ - managed_kafka.GetClusterRequest, - dict, + managed_kafka.GetClusterRequest(), + {}, ], ) def test_get_cluster(request_type, transport: str = "grpc"): @@ -1831,7 +1848,7 @@ def test_get_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_cluster), "__call__") as call: @@ -1881,9 +1898,10 @@ def test_get_cluster_non_empty_request_with_auto_populated_field(): client.get_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == managed_kafka.GetClusterRequest( + request_msg = managed_kafka.GetClusterRequest( name="name_value", ) + assert args[0] == request_msg def test_get_cluster_use_cached_wrapped_rpc(): @@ -1964,9 +1982,14 @@ async def test_get_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_cluster_async( - transport: str = "grpc_asyncio", request_type=managed_kafka.GetClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + managed_kafka.GetClusterRequest(), + {}, + ], +) +async def test_get_cluster_async(request_type, transport: str = "grpc_asyncio"): client = ManagedKafkaAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1974,7 +1997,7 @@ async def test_get_cluster_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_cluster), "__call__") as call: @@ -2003,11 +2026,6 @@ async def test_get_cluster_async( assert response.satisfies_pzs is True -@pytest.mark.asyncio -async def test_get_cluster_async_from_dict(): - await test_get_cluster_async(request_type=dict) - - def test_get_cluster_field_headers(): client = ManagedKafkaClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2150,8 +2168,8 @@ async def test_get_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - managed_kafka.CreateClusterRequest, - dict, + managed_kafka.CreateClusterRequest(), + {}, ], ) def test_create_cluster(request_type, transport: str = "grpc"): @@ -2162,7 +2180,7 @@ def test_create_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_cluster), "__call__") as call: @@ -2204,10 +2222,11 @@ def test_create_cluster_non_empty_request_with_auto_populated_field(): client.create_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == managed_kafka.CreateClusterRequest( + request_msg = managed_kafka.CreateClusterRequest( parent="parent_value", cluster_id="cluster_id_value", ) + assert args[0] == request_msg def test_create_cluster_use_cached_wrapped_rpc(): @@ -2298,9 +2317,14 @@ async def test_create_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_cluster_async( - transport: str = "grpc_asyncio", request_type=managed_kafka.CreateClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + managed_kafka.CreateClusterRequest(), + {}, + ], +) +async def test_create_cluster_async(request_type, transport: str = "grpc_asyncio"): client = ManagedKafkaAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2308,7 +2332,7 @@ async def test_create_cluster_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_cluster), "__call__") as call: @@ -2328,11 +2352,6 @@ async def test_create_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_cluster_async_from_dict(): - await test_create_cluster_async(request_type=dict) - - def test_create_cluster_field_headers(): client = ManagedKafkaClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2535,8 +2554,8 @@ async def test_create_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - managed_kafka.UpdateClusterRequest, - dict, + managed_kafka.UpdateClusterRequest(), + {}, ], ) def test_update_cluster(request_type, transport: str = "grpc"): @@ -2547,7 +2566,7 @@ def test_update_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_cluster), "__call__") as call: @@ -2586,7 +2605,8 @@ def test_update_cluster_non_empty_request_with_auto_populated_field(): client.update_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == managed_kafka.UpdateClusterRequest() + request_msg = managed_kafka.UpdateClusterRequest() + assert args[0] == request_msg def test_update_cluster_use_cached_wrapped_rpc(): @@ -2677,9 +2697,14 @@ async def test_update_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_cluster_async( - transport: str = "grpc_asyncio", request_type=managed_kafka.UpdateClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + managed_kafka.UpdateClusterRequest(), + {}, + ], +) +async def test_update_cluster_async(request_type, transport: str = "grpc_asyncio"): client = ManagedKafkaAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2687,7 +2712,7 @@ async def test_update_cluster_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_cluster), "__call__") as call: @@ -2707,11 +2732,6 @@ async def test_update_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_cluster_async_from_dict(): - await test_update_cluster_async(request_type=dict) - - def test_update_cluster_field_headers(): client = ManagedKafkaClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2904,8 +2924,8 @@ async def test_update_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - managed_kafka.DeleteClusterRequest, - dict, + managed_kafka.DeleteClusterRequest(), + {}, ], ) def test_delete_cluster(request_type, transport: str = "grpc"): @@ -2916,7 +2936,7 @@ def test_delete_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_cluster), "__call__") as call: @@ -2957,9 +2977,10 @@ def test_delete_cluster_non_empty_request_with_auto_populated_field(): client.delete_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == managed_kafka.DeleteClusterRequest( + request_msg = managed_kafka.DeleteClusterRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_cluster_use_cached_wrapped_rpc(): @@ -3050,9 +3071,14 @@ async def test_delete_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_cluster_async( - transport: str = "grpc_asyncio", request_type=managed_kafka.DeleteClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + managed_kafka.DeleteClusterRequest(), + {}, + ], +) +async def test_delete_cluster_async(request_type, transport: str = "grpc_asyncio"): client = ManagedKafkaAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3060,7 +3086,7 @@ async def test_delete_cluster_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_cluster), "__call__") as call: @@ -3080,11 +3106,6 @@ async def test_delete_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_cluster_async_from_dict(): - await test_delete_cluster_async(request_type=dict) - - def test_delete_cluster_field_headers(): client = ManagedKafkaClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3231,8 +3252,8 @@ async def test_delete_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - managed_kafka.ListTopicsRequest, - dict, + managed_kafka.ListTopicsRequest(), + {}, ], ) def test_list_topics(request_type, transport: str = "grpc"): @@ -3243,7 +3264,7 @@ def test_list_topics(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_topics), "__call__") as call: @@ -3288,10 +3309,11 @@ def test_list_topics_non_empty_request_with_auto_populated_field(): client.list_topics(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == managed_kafka.ListTopicsRequest( + request_msg = managed_kafka.ListTopicsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_topics_use_cached_wrapped_rpc(): @@ -3372,9 +3394,14 @@ async def test_list_topics_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_topics_async( - transport: str = "grpc_asyncio", request_type=managed_kafka.ListTopicsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + managed_kafka.ListTopicsRequest(), + {}, + ], +) +async def test_list_topics_async(request_type, transport: str = "grpc_asyncio"): client = ManagedKafkaAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3382,7 +3409,7 @@ async def test_list_topics_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_topics), "__call__") as call: @@ -3405,11 +3432,6 @@ async def test_list_topics_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_topics_async_from_dict(): - await test_list_topics_async(request_type=dict) - - def test_list_topics_field_headers(): client = ManagedKafkaClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3746,8 +3768,8 @@ async def test_list_topics_async_pages(): @pytest.mark.parametrize( "request_type", [ - managed_kafka.GetTopicRequest, - dict, + managed_kafka.GetTopicRequest(), + {}, ], ) def test_get_topic(request_type, transport: str = "grpc"): @@ -3758,7 +3780,7 @@ def test_get_topic(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_topic), "__call__") as call: @@ -3806,9 +3828,10 @@ def test_get_topic_non_empty_request_with_auto_populated_field(): client.get_topic(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == managed_kafka.GetTopicRequest( + request_msg = managed_kafka.GetTopicRequest( name="name_value", ) + assert args[0] == request_msg def test_get_topic_use_cached_wrapped_rpc(): @@ -3887,9 +3910,14 @@ async def test_get_topic_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_topic_async( - transport: str = "grpc_asyncio", request_type=managed_kafka.GetTopicRequest -): +@pytest.mark.parametrize( + "request_type", + [ + managed_kafka.GetTopicRequest(), + {}, + ], +) +async def test_get_topic_async(request_type, transport: str = "grpc_asyncio"): client = ManagedKafkaAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3897,7 +3925,7 @@ async def test_get_topic_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_topic), "__call__") as call: @@ -3924,11 +3952,6 @@ async def test_get_topic_async( assert response.replication_factor == 1912 -@pytest.mark.asyncio -async def test_get_topic_async_from_dict(): - await test_get_topic_async(request_type=dict) - - def test_get_topic_field_headers(): client = ManagedKafkaClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4071,8 +4094,8 @@ async def test_get_topic_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - managed_kafka.CreateTopicRequest, - dict, + managed_kafka.CreateTopicRequest(), + {}, ], ) def test_create_topic(request_type, transport: str = "grpc"): @@ -4083,7 +4106,7 @@ def test_create_topic(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_topic), "__call__") as call: @@ -4132,10 +4155,11 @@ def test_create_topic_non_empty_request_with_auto_populated_field(): client.create_topic(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == managed_kafka.CreateTopicRequest( + request_msg = managed_kafka.CreateTopicRequest( parent="parent_value", topic_id="topic_id_value", ) + assert args[0] == request_msg def test_create_topic_use_cached_wrapped_rpc(): @@ -4216,9 +4240,14 @@ async def test_create_topic_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_topic_async( - transport: str = "grpc_asyncio", request_type=managed_kafka.CreateTopicRequest -): +@pytest.mark.parametrize( + "request_type", + [ + managed_kafka.CreateTopicRequest(), + {}, + ], +) +async def test_create_topic_async(request_type, transport: str = "grpc_asyncio"): client = ManagedKafkaAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4226,7 +4255,7 @@ async def test_create_topic_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_topic), "__call__") as call: @@ -4253,11 +4282,6 @@ async def test_create_topic_async( assert response.replication_factor == 1912 -@pytest.mark.asyncio -async def test_create_topic_async_from_dict(): - await test_create_topic_async(request_type=dict) - - def test_create_topic_field_headers(): client = ManagedKafkaClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4420,8 +4444,8 @@ async def test_create_topic_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - managed_kafka.UpdateTopicRequest, - dict, + managed_kafka.UpdateTopicRequest(), + {}, ], ) def test_update_topic(request_type, transport: str = "grpc"): @@ -4432,7 +4456,7 @@ def test_update_topic(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_topic), "__call__") as call: @@ -4478,7 +4502,8 @@ def test_update_topic_non_empty_request_with_auto_populated_field(): client.update_topic(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == managed_kafka.UpdateTopicRequest() + request_msg = managed_kafka.UpdateTopicRequest() + assert args[0] == request_msg def test_update_topic_use_cached_wrapped_rpc(): @@ -4559,9 +4584,14 @@ async def test_update_topic_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_topic_async( - transport: str = "grpc_asyncio", request_type=managed_kafka.UpdateTopicRequest -): +@pytest.mark.parametrize( + "request_type", + [ + managed_kafka.UpdateTopicRequest(), + {}, + ], +) +async def test_update_topic_async(request_type, transport: str = "grpc_asyncio"): client = ManagedKafkaAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4569,7 +4599,7 @@ async def test_update_topic_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_topic), "__call__") as call: @@ -4596,11 +4626,6 @@ async def test_update_topic_async( assert response.replication_factor == 1912 -@pytest.mark.asyncio -async def test_update_topic_async_from_dict(): - await test_update_topic_async(request_type=dict) - - def test_update_topic_field_headers(): client = ManagedKafkaClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4753,8 +4778,8 @@ async def test_update_topic_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - managed_kafka.DeleteTopicRequest, - dict, + managed_kafka.DeleteTopicRequest(), + {}, ], ) def test_delete_topic(request_type, transport: str = "grpc"): @@ -4765,7 +4790,7 @@ def test_delete_topic(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_topic), "__call__") as call: @@ -4806,9 +4831,10 @@ def test_delete_topic_non_empty_request_with_auto_populated_field(): client.delete_topic(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == managed_kafka.DeleteTopicRequest( + request_msg = managed_kafka.DeleteTopicRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_topic_use_cached_wrapped_rpc(): @@ -4889,9 +4915,14 @@ async def test_delete_topic_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_topic_async( - transport: str = "grpc_asyncio", request_type=managed_kafka.DeleteTopicRequest -): +@pytest.mark.parametrize( + "request_type", + [ + managed_kafka.DeleteTopicRequest(), + {}, + ], +) +async def test_delete_topic_async(request_type, transport: str = "grpc_asyncio"): client = ManagedKafkaAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4899,7 +4930,7 @@ async def test_delete_topic_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_topic), "__call__") as call: @@ -4917,11 +4948,6 @@ async def test_delete_topic_async( assert response is None -@pytest.mark.asyncio -async def test_delete_topic_async_from_dict(): - await test_delete_topic_async(request_type=dict) - - def test_delete_topic_field_headers(): client = ManagedKafkaClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5064,8 +5090,8 @@ async def test_delete_topic_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - managed_kafka.ListConsumerGroupsRequest, - dict, + managed_kafka.ListConsumerGroupsRequest(), + {}, ], ) def test_list_consumer_groups(request_type, transport: str = "grpc"): @@ -5076,7 +5102,7 @@ def test_list_consumer_groups(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5125,10 +5151,11 @@ def test_list_consumer_groups_non_empty_request_with_auto_populated_field(): client.list_consumer_groups(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == managed_kafka.ListConsumerGroupsRequest( + request_msg = managed_kafka.ListConsumerGroupsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_consumer_groups_use_cached_wrapped_rpc(): @@ -5213,9 +5240,15 @@ async def test_list_consumer_groups_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + managed_kafka.ListConsumerGroupsRequest(), + {}, + ], +) async def test_list_consumer_groups_async( - transport: str = "grpc_asyncio", - request_type=managed_kafka.ListConsumerGroupsRequest, + request_type, transport: str = "grpc_asyncio" ): client = ManagedKafkaAsyncClient( credentials=async_anonymous_credentials(), @@ -5224,7 +5257,7 @@ async def test_list_consumer_groups_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( @@ -5249,11 +5282,6 @@ async def test_list_consumer_groups_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_consumer_groups_async_from_dict(): - await test_list_consumer_groups_async(request_type=dict) - - def test_list_consumer_groups_field_headers(): client = ManagedKafkaClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5606,8 +5634,8 @@ async def test_list_consumer_groups_async_pages(): @pytest.mark.parametrize( "request_type", [ - managed_kafka.GetConsumerGroupRequest, - dict, + managed_kafka.GetConsumerGroupRequest(), + {}, ], ) def test_get_consumer_group(request_type, transport: str = "grpc"): @@ -5618,7 +5646,7 @@ def test_get_consumer_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5666,9 +5694,10 @@ def test_get_consumer_group_non_empty_request_with_auto_populated_field(): client.get_consumer_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == managed_kafka.GetConsumerGroupRequest( + request_msg = managed_kafka.GetConsumerGroupRequest( name="name_value", ) + assert args[0] == request_msg def test_get_consumer_group_use_cached_wrapped_rpc(): @@ -5753,9 +5782,14 @@ async def test_get_consumer_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_consumer_group_async( - transport: str = "grpc_asyncio", request_type=managed_kafka.GetConsumerGroupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + managed_kafka.GetConsumerGroupRequest(), + {}, + ], +) +async def test_get_consumer_group_async(request_type, transport: str = "grpc_asyncio"): client = ManagedKafkaAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5763,7 +5797,7 @@ async def test_get_consumer_group_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( @@ -5788,11 +5822,6 @@ async def test_get_consumer_group_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_consumer_group_async_from_dict(): - await test_get_consumer_group_async(request_type=dict) - - def test_get_consumer_group_field_headers(): client = ManagedKafkaClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5947,8 +5976,8 @@ async def test_get_consumer_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - managed_kafka.UpdateConsumerGroupRequest, - dict, + managed_kafka.UpdateConsumerGroupRequest(), + {}, ], ) def test_update_consumer_group(request_type, transport: str = "grpc"): @@ -5959,7 +5988,7 @@ def test_update_consumer_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,7 +6034,8 @@ def test_update_consumer_group_non_empty_request_with_auto_populated_field(): client.update_consumer_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == managed_kafka.UpdateConsumerGroupRequest() + request_msg = managed_kafka.UpdateConsumerGroupRequest() + assert args[0] == request_msg def test_update_consumer_group_use_cached_wrapped_rpc(): @@ -6091,9 +6121,15 @@ async def test_update_consumer_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + managed_kafka.UpdateConsumerGroupRequest(), + {}, + ], +) async def test_update_consumer_group_async( - transport: str = "grpc_asyncio", - request_type=managed_kafka.UpdateConsumerGroupRequest, + request_type, transport: str = "grpc_asyncio" ): client = ManagedKafkaAsyncClient( credentials=async_anonymous_credentials(), @@ -6102,7 +6138,7 @@ async def test_update_consumer_group_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( @@ -6127,11 +6163,6 @@ async def test_update_consumer_group_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_update_consumer_group_async_from_dict(): - await test_update_consumer_group_async(request_type=dict) - - def test_update_consumer_group_field_headers(): client = ManagedKafkaClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6296,8 +6327,8 @@ async def test_update_consumer_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - managed_kafka.DeleteConsumerGroupRequest, - dict, + managed_kafka.DeleteConsumerGroupRequest(), + {}, ], ) def test_delete_consumer_group(request_type, transport: str = "grpc"): @@ -6308,7 +6339,7 @@ def test_delete_consumer_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6353,9 +6384,10 @@ def test_delete_consumer_group_non_empty_request_with_auto_populated_field(): client.delete_consumer_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == managed_kafka.DeleteConsumerGroupRequest( + request_msg = managed_kafka.DeleteConsumerGroupRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_consumer_group_use_cached_wrapped_rpc(): @@ -6441,9 +6473,15 @@ async def test_delete_consumer_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + managed_kafka.DeleteConsumerGroupRequest(), + {}, + ], +) async def test_delete_consumer_group_async( - transport: str = "grpc_asyncio", - request_type=managed_kafka.DeleteConsumerGroupRequest, + request_type, transport: str = "grpc_asyncio" ): client = ManagedKafkaAsyncClient( credentials=async_anonymous_credentials(), @@ -6452,7 +6490,7 @@ async def test_delete_consumer_group_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( @@ -6472,11 +6510,6 @@ async def test_delete_consumer_group_async( assert response is None -@pytest.mark.asyncio -async def test_delete_consumer_group_async_from_dict(): - await test_delete_consumer_group_async(request_type=dict) - - def test_delete_consumer_group_field_headers(): client = ManagedKafkaClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6627,8 +6660,8 @@ async def test_delete_consumer_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - managed_kafka.ListAclsRequest, - dict, + managed_kafka.ListAclsRequest(), + {}, ], ) def test_list_acls(request_type, transport: str = "grpc"): @@ -6639,7 +6672,7 @@ def test_list_acls(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_acls), "__call__") as call: @@ -6684,10 +6717,11 @@ def test_list_acls_non_empty_request_with_auto_populated_field(): client.list_acls(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == managed_kafka.ListAclsRequest( + request_msg = managed_kafka.ListAclsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_acls_use_cached_wrapped_rpc(): @@ -6766,9 +6800,14 @@ async def test_list_acls_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_list_acls_async( - transport: str = "grpc_asyncio", request_type=managed_kafka.ListAclsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + managed_kafka.ListAclsRequest(), + {}, + ], +) +async def test_list_acls_async(request_type, transport: str = "grpc_asyncio"): client = ManagedKafkaAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6776,7 +6815,7 @@ async def test_list_acls_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_acls), "__call__") as call: @@ -6799,11 +6838,6 @@ async def test_list_acls_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_acls_async_from_dict(): - await test_list_acls_async(request_type=dict) - - def test_list_acls_field_headers(): client = ManagedKafkaClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7140,8 +7174,8 @@ async def test_list_acls_async_pages(): @pytest.mark.parametrize( "request_type", [ - managed_kafka.GetAclRequest, - dict, + managed_kafka.GetAclRequest(), + {}, ], ) def test_get_acl(request_type, transport: str = "grpc"): @@ -7152,7 +7186,7 @@ def test_get_acl(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_acl), "__call__") as call: @@ -7204,9 +7238,10 @@ def test_get_acl_non_empty_request_with_auto_populated_field(): client.get_acl(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == managed_kafka.GetAclRequest( + request_msg = managed_kafka.GetAclRequest( name="name_value", ) + assert args[0] == request_msg def test_get_acl_use_cached_wrapped_rpc(): @@ -7285,9 +7320,14 @@ async def test_get_acl_async_use_cached_wrapped_rpc(transport: str = "grpc_async @pytest.mark.asyncio -async def test_get_acl_async( - transport: str = "grpc_asyncio", request_type=managed_kafka.GetAclRequest -): +@pytest.mark.parametrize( + "request_type", + [ + managed_kafka.GetAclRequest(), + {}, + ], +) +async def test_get_acl_async(request_type, transport: str = "grpc_asyncio"): client = ManagedKafkaAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7295,7 +7335,7 @@ async def test_get_acl_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_acl), "__call__") as call: @@ -7326,11 +7366,6 @@ async def test_get_acl_async( assert response.pattern_type == "pattern_type_value" -@pytest.mark.asyncio -async def test_get_acl_async_from_dict(): - await test_get_acl_async(request_type=dict) - - def test_get_acl_field_headers(): client = ManagedKafkaClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7473,8 +7508,8 @@ async def test_get_acl_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - managed_kafka.CreateAclRequest, - dict, + managed_kafka.CreateAclRequest(), + {}, ], ) def test_create_acl(request_type, transport: str = "grpc"): @@ -7485,7 +7520,7 @@ def test_create_acl(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_acl), "__call__") as call: @@ -7538,10 +7573,11 @@ def test_create_acl_non_empty_request_with_auto_populated_field(): client.create_acl(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == managed_kafka.CreateAclRequest( + request_msg = managed_kafka.CreateAclRequest( parent="parent_value", acl_id="acl_id_value", ) + assert args[0] == request_msg def test_create_acl_use_cached_wrapped_rpc(): @@ -7620,9 +7656,14 @@ async def test_create_acl_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_create_acl_async( - transport: str = "grpc_asyncio", request_type=managed_kafka.CreateAclRequest -): +@pytest.mark.parametrize( + "request_type", + [ + managed_kafka.CreateAclRequest(), + {}, + ], +) +async def test_create_acl_async(request_type, transport: str = "grpc_asyncio"): client = ManagedKafkaAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7630,7 +7671,7 @@ async def test_create_acl_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_acl), "__call__") as call: @@ -7661,11 +7702,6 @@ async def test_create_acl_async( assert response.pattern_type == "pattern_type_value" -@pytest.mark.asyncio -async def test_create_acl_async_from_dict(): - await test_create_acl_async(request_type=dict) - - def test_create_acl_field_headers(): client = ManagedKafkaClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7828,8 +7864,8 @@ async def test_create_acl_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - managed_kafka.UpdateAclRequest, - dict, + managed_kafka.UpdateAclRequest(), + {}, ], ) def test_update_acl(request_type, transport: str = "grpc"): @@ -7840,7 +7876,7 @@ def test_update_acl(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_acl), "__call__") as call: @@ -7890,7 +7926,8 @@ def test_update_acl_non_empty_request_with_auto_populated_field(): client.update_acl(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == managed_kafka.UpdateAclRequest() + request_msg = managed_kafka.UpdateAclRequest() + assert args[0] == request_msg def test_update_acl_use_cached_wrapped_rpc(): @@ -7969,9 +8006,14 @@ async def test_update_acl_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_update_acl_async( - transport: str = "grpc_asyncio", request_type=managed_kafka.UpdateAclRequest -): +@pytest.mark.parametrize( + "request_type", + [ + managed_kafka.UpdateAclRequest(), + {}, + ], +) +async def test_update_acl_async(request_type, transport: str = "grpc_asyncio"): client = ManagedKafkaAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7979,7 +8021,7 @@ async def test_update_acl_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_acl), "__call__") as call: @@ -8010,11 +8052,6 @@ async def test_update_acl_async( assert response.pattern_type == "pattern_type_value" -@pytest.mark.asyncio -async def test_update_acl_async_from_dict(): - await test_update_acl_async(request_type=dict) - - def test_update_acl_field_headers(): client = ManagedKafkaClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8167,8 +8204,8 @@ async def test_update_acl_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - managed_kafka.DeleteAclRequest, - dict, + managed_kafka.DeleteAclRequest(), + {}, ], ) def test_delete_acl(request_type, transport: str = "grpc"): @@ -8179,7 +8216,7 @@ def test_delete_acl(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_acl), "__call__") as call: @@ -8220,9 +8257,10 @@ def test_delete_acl_non_empty_request_with_auto_populated_field(): client.delete_acl(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == managed_kafka.DeleteAclRequest( + request_msg = managed_kafka.DeleteAclRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_acl_use_cached_wrapped_rpc(): @@ -8301,9 +8339,14 @@ async def test_delete_acl_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_delete_acl_async( - transport: str = "grpc_asyncio", request_type=managed_kafka.DeleteAclRequest -): +@pytest.mark.parametrize( + "request_type", + [ + managed_kafka.DeleteAclRequest(), + {}, + ], +) +async def test_delete_acl_async(request_type, transport: str = "grpc_asyncio"): client = ManagedKafkaAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8311,7 +8354,7 @@ async def test_delete_acl_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_acl), "__call__") as call: @@ -8329,11 +8372,6 @@ async def test_delete_acl_async( assert response is None -@pytest.mark.asyncio -async def test_delete_acl_async_from_dict(): - await test_delete_acl_async(request_type=dict) - - def test_delete_acl_field_headers(): client = ManagedKafkaClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8476,8 +8514,8 @@ async def test_delete_acl_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - managed_kafka.AddAclEntryRequest, - dict, + managed_kafka.AddAclEntryRequest(), + {}, ], ) def test_add_acl_entry(request_type, transport: str = "grpc"): @@ -8488,7 +8526,7 @@ def test_add_acl_entry(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.add_acl_entry), "__call__") as call: @@ -8532,9 +8570,10 @@ def test_add_acl_entry_non_empty_request_with_auto_populated_field(): client.add_acl_entry(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == managed_kafka.AddAclEntryRequest( + request_msg = managed_kafka.AddAclEntryRequest( acl="acl_value", ) + assert args[0] == request_msg def test_add_acl_entry_use_cached_wrapped_rpc(): @@ -8615,9 +8654,14 @@ async def test_add_acl_entry_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_add_acl_entry_async( - transport: str = "grpc_asyncio", request_type=managed_kafka.AddAclEntryRequest -): +@pytest.mark.parametrize( + "request_type", + [ + managed_kafka.AddAclEntryRequest(), + {}, + ], +) +async def test_add_acl_entry_async(request_type, transport: str = "grpc_asyncio"): client = ManagedKafkaAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8625,7 +8669,7 @@ async def test_add_acl_entry_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.add_acl_entry), "__call__") as call: @@ -8648,11 +8692,6 @@ async def test_add_acl_entry_async( assert response.acl_created is True -@pytest.mark.asyncio -async def test_add_acl_entry_async_from_dict(): - await test_add_acl_entry_async(request_type=dict) - - def test_add_acl_entry_field_headers(): client = ManagedKafkaClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8809,8 +8848,8 @@ async def test_add_acl_entry_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - managed_kafka.RemoveAclEntryRequest, - dict, + managed_kafka.RemoveAclEntryRequest(), + {}, ], ) def test_remove_acl_entry(request_type, transport: str = "grpc"): @@ -8821,7 +8860,7 @@ def test_remove_acl_entry(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.remove_acl_entry), "__call__") as call: @@ -8864,9 +8903,10 @@ def test_remove_acl_entry_non_empty_request_with_auto_populated_field(): client.remove_acl_entry(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == managed_kafka.RemoveAclEntryRequest( + request_msg = managed_kafka.RemoveAclEntryRequest( acl="acl_value", ) + assert args[0] == request_msg def test_remove_acl_entry_use_cached_wrapped_rpc(): @@ -8949,9 +8989,14 @@ async def test_remove_acl_entry_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_remove_acl_entry_async( - transport: str = "grpc_asyncio", request_type=managed_kafka.RemoveAclEntryRequest -): +@pytest.mark.parametrize( + "request_type", + [ + managed_kafka.RemoveAclEntryRequest(), + {}, + ], +) +async def test_remove_acl_entry_async(request_type, transport: str = "grpc_asyncio"): client = ManagedKafkaAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8959,7 +9004,7 @@ async def test_remove_acl_entry_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.remove_acl_entry), "__call__") as call: @@ -8979,11 +9024,6 @@ async def test_remove_acl_entry_async( assert isinstance(response, managed_kafka.RemoveAclEntryResponse) -@pytest.mark.asyncio -async def test_remove_acl_entry_async_from_dict(): - await test_remove_acl_entry_async(request_type=dict) - - def test_remove_acl_entry_field_headers(): client = ManagedKafkaClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13517,7 +13557,6 @@ def test_list_clusters_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka.ListClustersRequest() - assert args[0] == request_msg @@ -13538,7 +13577,6 @@ def test_get_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka.GetClusterRequest() - assert args[0] == request_msg @@ -13559,7 +13597,6 @@ def test_create_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka.CreateClusterRequest() - assert args[0] == request_msg @@ -13580,7 +13617,6 @@ def test_update_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka.UpdateClusterRequest() - assert args[0] == request_msg @@ -13601,7 +13637,6 @@ def test_delete_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka.DeleteClusterRequest() - assert args[0] == request_msg @@ -13622,7 +13657,6 @@ def test_list_topics_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka.ListTopicsRequest() - assert args[0] == request_msg @@ -13643,7 +13677,6 @@ def test_get_topic_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka.GetTopicRequest() - assert args[0] == request_msg @@ -13664,7 +13697,6 @@ def test_create_topic_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka.CreateTopicRequest() - assert args[0] == request_msg @@ -13685,7 +13717,6 @@ def test_update_topic_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka.UpdateTopicRequest() - assert args[0] == request_msg @@ -13706,7 +13737,6 @@ def test_delete_topic_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka.DeleteTopicRequest() - assert args[0] == request_msg @@ -13729,7 +13759,6 @@ def test_list_consumer_groups_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka.ListConsumerGroupsRequest() - assert args[0] == request_msg @@ -13752,7 +13781,6 @@ def test_get_consumer_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka.GetConsumerGroupRequest() - assert args[0] == request_msg @@ -13775,7 +13803,6 @@ def test_update_consumer_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka.UpdateConsumerGroupRequest() - assert args[0] == request_msg @@ -13798,7 +13825,6 @@ def test_delete_consumer_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka.DeleteConsumerGroupRequest() - assert args[0] == request_msg @@ -13819,7 +13845,6 @@ def test_list_acls_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka.ListAclsRequest() - assert args[0] == request_msg @@ -13840,7 +13865,6 @@ def test_get_acl_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka.GetAclRequest() - assert args[0] == request_msg @@ -13861,7 +13885,6 @@ def test_create_acl_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka.CreateAclRequest() - assert args[0] == request_msg @@ -13882,7 +13905,6 @@ def test_update_acl_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka.UpdateAclRequest() - assert args[0] == request_msg @@ -13903,7 +13925,6 @@ def test_delete_acl_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka.DeleteAclRequest() - assert args[0] == request_msg @@ -13924,7 +13945,6 @@ def test_add_acl_entry_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka.AddAclEntryRequest() - assert args[0] == request_msg @@ -13945,7 +13965,6 @@ def test_remove_acl_entry_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka.RemoveAclEntryRequest() - assert args[0] == request_msg @@ -13987,7 +14006,6 @@ async def test_list_clusters_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka.ListClustersRequest() - assert args[0] == request_msg @@ -14017,7 +14035,6 @@ async def test_get_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka.GetClusterRequest() - assert args[0] == request_msg @@ -14042,7 +14059,6 @@ async def test_create_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka.CreateClusterRequest() - assert args[0] == request_msg @@ -14067,7 +14083,6 @@ async def test_update_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka.UpdateClusterRequest() - assert args[0] == request_msg @@ -14092,7 +14107,6 @@ async def test_delete_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka.DeleteClusterRequest() - assert args[0] == request_msg @@ -14119,7 +14133,6 @@ async def test_list_topics_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka.ListTopicsRequest() - assert args[0] == request_msg @@ -14148,7 +14161,6 @@ async def test_get_topic_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka.GetTopicRequest() - assert args[0] == request_msg @@ -14177,7 +14189,6 @@ async def test_create_topic_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka.CreateTopicRequest() - assert args[0] == request_msg @@ -14206,7 +14217,6 @@ async def test_update_topic_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka.UpdateTopicRequest() - assert args[0] == request_msg @@ -14229,7 +14239,6 @@ async def test_delete_topic_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka.DeleteTopicRequest() - assert args[0] == request_msg @@ -14258,7 +14267,6 @@ async def test_list_consumer_groups_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka.ListConsumerGroupsRequest() - assert args[0] == request_msg @@ -14287,7 +14295,6 @@ async def test_get_consumer_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka.GetConsumerGroupRequest() - assert args[0] == request_msg @@ -14316,7 +14323,6 @@ async def test_update_consumer_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka.UpdateConsumerGroupRequest() - assert args[0] == request_msg @@ -14341,7 +14347,6 @@ async def test_delete_consumer_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka.DeleteConsumerGroupRequest() - assert args[0] == request_msg @@ -14368,7 +14373,6 @@ async def test_list_acls_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka.ListAclsRequest() - assert args[0] == request_msg @@ -14399,7 +14403,6 @@ async def test_get_acl_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka.GetAclRequest() - assert args[0] == request_msg @@ -14430,7 +14433,6 @@ async def test_create_acl_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka.CreateAclRequest() - assert args[0] == request_msg @@ -14461,7 +14463,6 @@ async def test_update_acl_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka.UpdateAclRequest() - assert args[0] == request_msg @@ -14484,7 +14485,6 @@ async def test_delete_acl_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka.DeleteAclRequest() - assert args[0] == request_msg @@ -14511,7 +14511,6 @@ async def test_add_acl_entry_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka.AddAclEntryRequest() - assert args[0] == request_msg @@ -14536,7 +14535,6 @@ async def test_remove_acl_entry_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka.RemoveAclEntryRequest() - assert args[0] == request_msg @@ -18383,7 +18381,6 @@ def test_list_clusters_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka.ListClustersRequest() - assert args[0] == request_msg @@ -18403,7 +18400,6 @@ def test_get_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka.GetClusterRequest() - assert args[0] == request_msg @@ -18423,7 +18419,6 @@ def test_create_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka.CreateClusterRequest() - assert args[0] == request_msg @@ -18443,7 +18438,6 @@ def test_update_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka.UpdateClusterRequest() - assert args[0] == request_msg @@ -18463,7 +18457,6 @@ def test_delete_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka.DeleteClusterRequest() - assert args[0] == request_msg @@ -18483,7 +18476,6 @@ def test_list_topics_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka.ListTopicsRequest() - assert args[0] == request_msg @@ -18503,7 +18495,6 @@ def test_get_topic_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka.GetTopicRequest() - assert args[0] == request_msg @@ -18523,7 +18514,6 @@ def test_create_topic_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka.CreateTopicRequest() - assert args[0] == request_msg @@ -18543,7 +18533,6 @@ def test_update_topic_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka.UpdateTopicRequest() - assert args[0] == request_msg @@ -18563,7 +18552,6 @@ def test_delete_topic_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka.DeleteTopicRequest() - assert args[0] == request_msg @@ -18585,7 +18573,6 @@ def test_list_consumer_groups_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka.ListConsumerGroupsRequest() - assert args[0] == request_msg @@ -18607,7 +18594,6 @@ def test_get_consumer_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka.GetConsumerGroupRequest() - assert args[0] == request_msg @@ -18629,7 +18615,6 @@ def test_update_consumer_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka.UpdateConsumerGroupRequest() - assert args[0] == request_msg @@ -18651,7 +18636,6 @@ def test_delete_consumer_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka.DeleteConsumerGroupRequest() - assert args[0] == request_msg @@ -18671,7 +18655,6 @@ def test_list_acls_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka.ListAclsRequest() - assert args[0] == request_msg @@ -18691,7 +18674,6 @@ def test_get_acl_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka.GetAclRequest() - assert args[0] == request_msg @@ -18711,7 +18693,6 @@ def test_create_acl_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka.CreateAclRequest() - assert args[0] == request_msg @@ -18731,7 +18712,6 @@ def test_update_acl_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka.UpdateAclRequest() - assert args[0] == request_msg @@ -18751,7 +18731,6 @@ def test_delete_acl_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka.DeleteAclRequest() - assert args[0] == request_msg @@ -18771,7 +18750,6 @@ def test_add_acl_entry_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka.AddAclEntryRequest() - assert args[0] == request_msg @@ -18791,7 +18769,6 @@ def test_remove_acl_entry_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka.RemoveAclEntryRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-managedkafka/tests/unit/gapic/managedkafka_v1/test_managed_kafka_connect.py b/packages/google-cloud-managedkafka/tests/unit/gapic/managedkafka_v1/test_managed_kafka_connect.py index 8ca426d642d6..7345e4a6977b 100644 --- a/packages/google-cloud-managedkafka/tests/unit/gapic/managedkafka_v1/test_managed_kafka_connect.py +++ b/packages/google-cloud-managedkafka/tests/unit/gapic/managedkafka_v1/test_managed_kafka_connect.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 @@ -117,6 +118,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" @@ -1380,8 +1396,8 @@ def test_managed_kafka_connect_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - managed_kafka_connect.ListConnectClustersRequest, - dict, + managed_kafka_connect.ListConnectClustersRequest(), + {}, ], ) def test_list_connect_clusters(request_type, transport: str = "grpc"): @@ -1392,7 +1408,7 @@ def test_list_connect_clusters(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1445,12 +1461,13 @@ def test_list_connect_clusters_non_empty_request_with_auto_populated_field(): client.list_connect_clusters(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == managed_kafka_connect.ListConnectClustersRequest( + request_msg = managed_kafka_connect.ListConnectClustersRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_connect_clusters_use_cached_wrapped_rpc(): @@ -1536,9 +1553,15 @@ async def test_list_connect_clusters_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + managed_kafka_connect.ListConnectClustersRequest(), + {}, + ], +) async def test_list_connect_clusters_async( - transport: str = "grpc_asyncio", - request_type=managed_kafka_connect.ListConnectClustersRequest, + request_type, transport: str = "grpc_asyncio" ): client = ManagedKafkaConnectAsyncClient( credentials=async_anonymous_credentials(), @@ -1547,7 +1570,7 @@ async def test_list_connect_clusters_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( @@ -1574,11 +1597,6 @@ async def test_list_connect_clusters_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_connect_clusters_async_from_dict(): - await test_list_connect_clusters_async(request_type=dict) - - def test_list_connect_clusters_field_headers(): client = ManagedKafkaConnectClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1931,8 +1949,8 @@ async def test_list_connect_clusters_async_pages(): @pytest.mark.parametrize( "request_type", [ - managed_kafka_connect.GetConnectClusterRequest, - dict, + managed_kafka_connect.GetConnectClusterRequest(), + {}, ], ) def test_get_connect_cluster(request_type, transport: str = "grpc"): @@ -1943,7 +1961,7 @@ def test_get_connect_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1995,9 +2013,10 @@ def test_get_connect_cluster_non_empty_request_with_auto_populated_field(): client.get_connect_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == managed_kafka_connect.GetConnectClusterRequest( + request_msg = managed_kafka_connect.GetConnectClusterRequest( name="name_value", ) + assert args[0] == request_msg def test_get_connect_cluster_use_cached_wrapped_rpc(): @@ -2082,10 +2101,14 @@ async def test_get_connect_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_connect_cluster_async( - transport: str = "grpc_asyncio", - request_type=managed_kafka_connect.GetConnectClusterRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + managed_kafka_connect.GetConnectClusterRequest(), + {}, + ], +) +async def test_get_connect_cluster_async(request_type, transport: str = "grpc_asyncio"): client = ManagedKafkaConnectAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2093,7 +2116,7 @@ async def test_get_connect_cluster_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( @@ -2122,11 +2145,6 @@ async def test_get_connect_cluster_async( assert response.state == resources.ConnectCluster.State.CREATING -@pytest.mark.asyncio -async def test_get_connect_cluster_async_from_dict(): - await test_get_connect_cluster_async(request_type=dict) - - def test_get_connect_cluster_field_headers(): client = ManagedKafkaConnectClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2281,8 +2299,8 @@ async def test_get_connect_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - managed_kafka_connect.CreateConnectClusterRequest, - dict, + managed_kafka_connect.CreateConnectClusterRequest(), + {}, ], ) def test_create_connect_cluster(request_type, transport: str = "grpc"): @@ -2293,7 +2311,7 @@ def test_create_connect_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2339,10 +2357,11 @@ def test_create_connect_cluster_non_empty_request_with_auto_populated_field(): client.create_connect_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == managed_kafka_connect.CreateConnectClusterRequest( + request_msg = managed_kafka_connect.CreateConnectClusterRequest( parent="parent_value", connect_cluster_id="connect_cluster_id_value", ) + assert args[0] == request_msg def test_create_connect_cluster_use_cached_wrapped_rpc(): @@ -2438,9 +2457,15 @@ async def test_create_connect_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + managed_kafka_connect.CreateConnectClusterRequest(), + {}, + ], +) async def test_create_connect_cluster_async( - transport: str = "grpc_asyncio", - request_type=managed_kafka_connect.CreateConnectClusterRequest, + request_type, transport: str = "grpc_asyncio" ): client = ManagedKafkaConnectAsyncClient( credentials=async_anonymous_credentials(), @@ -2449,7 +2474,7 @@ async def test_create_connect_cluster_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( @@ -2471,11 +2496,6 @@ async def test_create_connect_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_connect_cluster_async_from_dict(): - await test_create_connect_cluster_async(request_type=dict) - - def test_create_connect_cluster_field_headers(): client = ManagedKafkaConnectClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2710,8 +2730,8 @@ async def test_create_connect_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - managed_kafka_connect.UpdateConnectClusterRequest, - dict, + managed_kafka_connect.UpdateConnectClusterRequest(), + {}, ], ) def test_update_connect_cluster(request_type, transport: str = "grpc"): @@ -2722,7 +2742,7 @@ def test_update_connect_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2765,7 +2785,8 @@ def test_update_connect_cluster_non_empty_request_with_auto_populated_field(): client.update_connect_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == managed_kafka_connect.UpdateConnectClusterRequest() + request_msg = managed_kafka_connect.UpdateConnectClusterRequest() + assert args[0] == request_msg def test_update_connect_cluster_use_cached_wrapped_rpc(): @@ -2861,9 +2882,15 @@ async def test_update_connect_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + managed_kafka_connect.UpdateConnectClusterRequest(), + {}, + ], +) async def test_update_connect_cluster_async( - transport: str = "grpc_asyncio", - request_type=managed_kafka_connect.UpdateConnectClusterRequest, + request_type, transport: str = "grpc_asyncio" ): client = ManagedKafkaConnectAsyncClient( credentials=async_anonymous_credentials(), @@ -2872,7 +2899,7 @@ async def test_update_connect_cluster_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( @@ -2894,11 +2921,6 @@ async def test_update_connect_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_connect_cluster_async_from_dict(): - await test_update_connect_cluster_async(request_type=dict) - - def test_update_connect_cluster_field_headers(): client = ManagedKafkaConnectClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3123,8 +3145,8 @@ async def test_update_connect_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - managed_kafka_connect.DeleteConnectClusterRequest, - dict, + managed_kafka_connect.DeleteConnectClusterRequest(), + {}, ], ) def test_delete_connect_cluster(request_type, transport: str = "grpc"): @@ -3135,7 +3157,7 @@ def test_delete_connect_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3180,9 +3202,10 @@ def test_delete_connect_cluster_non_empty_request_with_auto_populated_field(): client.delete_connect_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == managed_kafka_connect.DeleteConnectClusterRequest( + request_msg = managed_kafka_connect.DeleteConnectClusterRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_connect_cluster_use_cached_wrapped_rpc(): @@ -3278,9 +3301,15 @@ async def test_delete_connect_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + managed_kafka_connect.DeleteConnectClusterRequest(), + {}, + ], +) async def test_delete_connect_cluster_async( - transport: str = "grpc_asyncio", - request_type=managed_kafka_connect.DeleteConnectClusterRequest, + request_type, transport: str = "grpc_asyncio" ): client = ManagedKafkaConnectAsyncClient( credentials=async_anonymous_credentials(), @@ -3289,7 +3318,7 @@ async def test_delete_connect_cluster_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( @@ -3311,11 +3340,6 @@ async def test_delete_connect_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_connect_cluster_async_from_dict(): - await test_delete_connect_cluster_async(request_type=dict) - - def test_delete_connect_cluster_field_headers(): client = ManagedKafkaConnectClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3470,8 +3494,8 @@ async def test_delete_connect_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - managed_kafka_connect.ListConnectorsRequest, - dict, + managed_kafka_connect.ListConnectorsRequest(), + {}, ], ) def test_list_connectors(request_type, transport: str = "grpc"): @@ -3482,7 +3506,7 @@ def test_list_connectors(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_connectors), "__call__") as call: @@ -3527,10 +3551,11 @@ def test_list_connectors_non_empty_request_with_auto_populated_field(): client.list_connectors(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == managed_kafka_connect.ListConnectorsRequest( + request_msg = managed_kafka_connect.ListConnectorsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_connectors_use_cached_wrapped_rpc(): @@ -3611,10 +3636,14 @@ async def test_list_connectors_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_connectors_async( - transport: str = "grpc_asyncio", - request_type=managed_kafka_connect.ListConnectorsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + managed_kafka_connect.ListConnectorsRequest(), + {}, + ], +) +async def test_list_connectors_async(request_type, transport: str = "grpc_asyncio"): client = ManagedKafkaConnectAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3622,7 +3651,7 @@ async def test_list_connectors_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_connectors), "__call__") as call: @@ -3645,11 +3674,6 @@ async def test_list_connectors_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_connectors_async_from_dict(): - await test_list_connectors_async(request_type=dict) - - def test_list_connectors_field_headers(): client = ManagedKafkaConnectClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3986,8 +4010,8 @@ async def test_list_connectors_async_pages(): @pytest.mark.parametrize( "request_type", [ - managed_kafka_connect.GetConnectorRequest, - dict, + managed_kafka_connect.GetConnectorRequest(), + {}, ], ) def test_get_connector(request_type, transport: str = "grpc"): @@ -3998,7 +4022,7 @@ def test_get_connector(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_connector), "__call__") as call: @@ -4044,9 +4068,10 @@ def test_get_connector_non_empty_request_with_auto_populated_field(): client.get_connector(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == managed_kafka_connect.GetConnectorRequest( + request_msg = managed_kafka_connect.GetConnectorRequest( name="name_value", ) + assert args[0] == request_msg def test_get_connector_use_cached_wrapped_rpc(): @@ -4127,10 +4152,14 @@ async def test_get_connector_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_connector_async( - transport: str = "grpc_asyncio", - request_type=managed_kafka_connect.GetConnectorRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + managed_kafka_connect.GetConnectorRequest(), + {}, + ], +) +async def test_get_connector_async(request_type, transport: str = "grpc_asyncio"): client = ManagedKafkaConnectAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4138,7 +4167,7 @@ async def test_get_connector_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_connector), "__call__") as call: @@ -4163,11 +4192,6 @@ async def test_get_connector_async( assert response.state == resources.Connector.State.UNASSIGNED -@pytest.mark.asyncio -async def test_get_connector_async_from_dict(): - await test_get_connector_async(request_type=dict) - - def test_get_connector_field_headers(): client = ManagedKafkaConnectClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4310,8 +4334,8 @@ async def test_get_connector_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - managed_kafka_connect.CreateConnectorRequest, - dict, + managed_kafka_connect.CreateConnectorRequest(), + {}, ], ) def test_create_connector(request_type, transport: str = "grpc"): @@ -4322,7 +4346,7 @@ def test_create_connector(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_connector), "__call__") as call: @@ -4369,10 +4393,11 @@ def test_create_connector_non_empty_request_with_auto_populated_field(): client.create_connector(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == managed_kafka_connect.CreateConnectorRequest( + request_msg = managed_kafka_connect.CreateConnectorRequest( parent="parent_value", connector_id="connector_id_value", ) + assert args[0] == request_msg def test_create_connector_use_cached_wrapped_rpc(): @@ -4455,10 +4480,14 @@ async def test_create_connector_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_connector_async( - transport: str = "grpc_asyncio", - request_type=managed_kafka_connect.CreateConnectorRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + managed_kafka_connect.CreateConnectorRequest(), + {}, + ], +) +async def test_create_connector_async(request_type, transport: str = "grpc_asyncio"): client = ManagedKafkaConnectAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4466,7 +4495,7 @@ async def test_create_connector_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_connector), "__call__") as call: @@ -4491,11 +4520,6 @@ async def test_create_connector_async( assert response.state == resources.Connector.State.UNASSIGNED -@pytest.mark.asyncio -async def test_create_connector_async_from_dict(): - await test_create_connector_async(request_type=dict) - - def test_create_connector_field_headers(): client = ManagedKafkaConnectClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4682,8 +4706,8 @@ async def test_create_connector_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - managed_kafka_connect.UpdateConnectorRequest, - dict, + managed_kafka_connect.UpdateConnectorRequest(), + {}, ], ) def test_update_connector(request_type, transport: str = "grpc"): @@ -4694,7 +4718,7 @@ def test_update_connector(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_connector), "__call__") as call: @@ -4738,7 +4762,8 @@ def test_update_connector_non_empty_request_with_auto_populated_field(): client.update_connector(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == managed_kafka_connect.UpdateConnectorRequest() + request_msg = managed_kafka_connect.UpdateConnectorRequest() + assert args[0] == request_msg def test_update_connector_use_cached_wrapped_rpc(): @@ -4821,10 +4846,14 @@ async def test_update_connector_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_connector_async( - transport: str = "grpc_asyncio", - request_type=managed_kafka_connect.UpdateConnectorRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + managed_kafka_connect.UpdateConnectorRequest(), + {}, + ], +) +async def test_update_connector_async(request_type, transport: str = "grpc_asyncio"): client = ManagedKafkaConnectAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4832,7 +4861,7 @@ async def test_update_connector_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_connector), "__call__") as call: @@ -4857,11 +4886,6 @@ async def test_update_connector_async( assert response.state == resources.Connector.State.UNASSIGNED -@pytest.mark.asyncio -async def test_update_connector_async_from_dict(): - await test_update_connector_async(request_type=dict) - - def test_update_connector_field_headers(): client = ManagedKafkaConnectClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5038,8 +5062,8 @@ async def test_update_connector_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - managed_kafka_connect.DeleteConnectorRequest, - dict, + managed_kafka_connect.DeleteConnectorRequest(), + {}, ], ) def test_delete_connector(request_type, transport: str = "grpc"): @@ -5050,7 +5074,7 @@ def test_delete_connector(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_connector), "__call__") as call: @@ -5091,9 +5115,10 @@ def test_delete_connector_non_empty_request_with_auto_populated_field(): client.delete_connector(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == managed_kafka_connect.DeleteConnectorRequest( + request_msg = managed_kafka_connect.DeleteConnectorRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_connector_use_cached_wrapped_rpc(): @@ -5176,10 +5201,14 @@ async def test_delete_connector_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_connector_async( - transport: str = "grpc_asyncio", - request_type=managed_kafka_connect.DeleteConnectorRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + managed_kafka_connect.DeleteConnectorRequest(), + {}, + ], +) +async def test_delete_connector_async(request_type, transport: str = "grpc_asyncio"): client = ManagedKafkaConnectAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5187,7 +5216,7 @@ async def test_delete_connector_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_connector), "__call__") as call: @@ -5205,11 +5234,6 @@ async def test_delete_connector_async( assert response is None -@pytest.mark.asyncio -async def test_delete_connector_async_from_dict(): - await test_delete_connector_async(request_type=dict) - - def test_delete_connector_field_headers(): client = ManagedKafkaConnectClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5352,8 +5376,8 @@ async def test_delete_connector_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - managed_kafka_connect.PauseConnectorRequest, - dict, + managed_kafka_connect.PauseConnectorRequest(), + {}, ], ) def test_pause_connector(request_type, transport: str = "grpc"): @@ -5364,7 +5388,7 @@ def test_pause_connector(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.pause_connector), "__call__") as call: @@ -5405,9 +5429,10 @@ def test_pause_connector_non_empty_request_with_auto_populated_field(): client.pause_connector(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == managed_kafka_connect.PauseConnectorRequest( + request_msg = managed_kafka_connect.PauseConnectorRequest( name="name_value", ) + assert args[0] == request_msg def test_pause_connector_use_cached_wrapped_rpc(): @@ -5488,10 +5513,14 @@ async def test_pause_connector_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_pause_connector_async( - transport: str = "grpc_asyncio", - request_type=managed_kafka_connect.PauseConnectorRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + managed_kafka_connect.PauseConnectorRequest(), + {}, + ], +) +async def test_pause_connector_async(request_type, transport: str = "grpc_asyncio"): client = ManagedKafkaConnectAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5499,7 +5528,7 @@ async def test_pause_connector_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.pause_connector), "__call__") as call: @@ -5519,11 +5548,6 @@ async def test_pause_connector_async( assert isinstance(response, managed_kafka_connect.PauseConnectorResponse) -@pytest.mark.asyncio -async def test_pause_connector_async_from_dict(): - await test_pause_connector_async(request_type=dict) - - def test_pause_connector_field_headers(): client = ManagedKafkaConnectClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5670,8 +5694,8 @@ async def test_pause_connector_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - managed_kafka_connect.ResumeConnectorRequest, - dict, + managed_kafka_connect.ResumeConnectorRequest(), + {}, ], ) def test_resume_connector(request_type, transport: str = "grpc"): @@ -5682,7 +5706,7 @@ def test_resume_connector(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.resume_connector), "__call__") as call: @@ -5723,9 +5747,10 @@ def test_resume_connector_non_empty_request_with_auto_populated_field(): client.resume_connector(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == managed_kafka_connect.ResumeConnectorRequest( + request_msg = managed_kafka_connect.ResumeConnectorRequest( name="name_value", ) + assert args[0] == request_msg def test_resume_connector_use_cached_wrapped_rpc(): @@ -5808,10 +5833,14 @@ async def test_resume_connector_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_resume_connector_async( - transport: str = "grpc_asyncio", - request_type=managed_kafka_connect.ResumeConnectorRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + managed_kafka_connect.ResumeConnectorRequest(), + {}, + ], +) +async def test_resume_connector_async(request_type, transport: str = "grpc_asyncio"): client = ManagedKafkaConnectAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5819,7 +5848,7 @@ async def test_resume_connector_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.resume_connector), "__call__") as call: @@ -5839,11 +5868,6 @@ async def test_resume_connector_async( assert isinstance(response, managed_kafka_connect.ResumeConnectorResponse) -@pytest.mark.asyncio -async def test_resume_connector_async_from_dict(): - await test_resume_connector_async(request_type=dict) - - def test_resume_connector_field_headers(): client = ManagedKafkaConnectClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5990,8 +6014,8 @@ async def test_resume_connector_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - managed_kafka_connect.RestartConnectorRequest, - dict, + managed_kafka_connect.RestartConnectorRequest(), + {}, ], ) def test_restart_connector(request_type, transport: str = "grpc"): @@ -6002,7 +6026,7 @@ def test_restart_connector(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6047,9 +6071,10 @@ def test_restart_connector_non_empty_request_with_auto_populated_field(): client.restart_connector(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == managed_kafka_connect.RestartConnectorRequest( + request_msg = managed_kafka_connect.RestartConnectorRequest( name="name_value", ) + assert args[0] == request_msg def test_restart_connector_use_cached_wrapped_rpc(): @@ -6132,10 +6157,14 @@ async def test_restart_connector_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_restart_connector_async( - transport: str = "grpc_asyncio", - request_type=managed_kafka_connect.RestartConnectorRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + managed_kafka_connect.RestartConnectorRequest(), + {}, + ], +) +async def test_restart_connector_async(request_type, transport: str = "grpc_asyncio"): client = ManagedKafkaConnectAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6143,7 +6172,7 @@ async def test_restart_connector_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( @@ -6165,11 +6194,6 @@ async def test_restart_connector_async( assert isinstance(response, managed_kafka_connect.RestartConnectorResponse) -@pytest.mark.asyncio -async def test_restart_connector_async_from_dict(): - await test_restart_connector_async(request_type=dict) - - def test_restart_connector_field_headers(): client = ManagedKafkaConnectClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6324,8 +6348,8 @@ async def test_restart_connector_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - managed_kafka_connect.StopConnectorRequest, - dict, + managed_kafka_connect.StopConnectorRequest(), + {}, ], ) def test_stop_connector(request_type, transport: str = "grpc"): @@ -6336,7 +6360,7 @@ def test_stop_connector(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.stop_connector), "__call__") as call: @@ -6377,9 +6401,10 @@ def test_stop_connector_non_empty_request_with_auto_populated_field(): client.stop_connector(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == managed_kafka_connect.StopConnectorRequest( + request_msg = managed_kafka_connect.StopConnectorRequest( name="name_value", ) + assert args[0] == request_msg def test_stop_connector_use_cached_wrapped_rpc(): @@ -6460,10 +6485,14 @@ async def test_stop_connector_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_stop_connector_async( - transport: str = "grpc_asyncio", - request_type=managed_kafka_connect.StopConnectorRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + managed_kafka_connect.StopConnectorRequest(), + {}, + ], +) +async def test_stop_connector_async(request_type, transport: str = "grpc_asyncio"): client = ManagedKafkaConnectAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6471,7 +6500,7 @@ async def test_stop_connector_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.stop_connector), "__call__") as call: @@ -6491,11 +6520,6 @@ async def test_stop_connector_async( assert isinstance(response, managed_kafka_connect.StopConnectorResponse) -@pytest.mark.asyncio -async def test_stop_connector_async_from_dict(): - await test_stop_connector_async(request_type=dict) - - def test_stop_connector_field_headers(): client = ManagedKafkaConnectClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9637,7 +9661,6 @@ def test_list_connect_clusters_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka_connect.ListConnectClustersRequest() - assert args[0] == request_msg @@ -9660,7 +9683,6 @@ def test_get_connect_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka_connect.GetConnectClusterRequest() - assert args[0] == request_msg @@ -9683,7 +9705,6 @@ def test_create_connect_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka_connect.CreateConnectClusterRequest() - assert args[0] == request_msg @@ -9706,7 +9727,6 @@ def test_update_connect_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka_connect.UpdateConnectClusterRequest() - assert args[0] == request_msg @@ -9729,7 +9749,6 @@ def test_delete_connect_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka_connect.DeleteConnectClusterRequest() - assert args[0] == request_msg @@ -9750,7 +9769,6 @@ def test_list_connectors_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka_connect.ListConnectorsRequest() - assert args[0] == request_msg @@ -9771,7 +9789,6 @@ def test_get_connector_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka_connect.GetConnectorRequest() - assert args[0] == request_msg @@ -9792,7 +9809,6 @@ def test_create_connector_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka_connect.CreateConnectorRequest() - assert args[0] == request_msg @@ -9813,7 +9829,6 @@ def test_update_connector_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka_connect.UpdateConnectorRequest() - assert args[0] == request_msg @@ -9834,7 +9849,6 @@ def test_delete_connector_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka_connect.DeleteConnectorRequest() - assert args[0] == request_msg @@ -9855,7 +9869,6 @@ def test_pause_connector_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka_connect.PauseConnectorRequest() - assert args[0] == request_msg @@ -9876,7 +9889,6 @@ def test_resume_connector_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka_connect.ResumeConnectorRequest() - assert args[0] == request_msg @@ -9899,7 +9911,6 @@ def test_restart_connector_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka_connect.RestartConnectorRequest() - assert args[0] == request_msg @@ -9920,7 +9931,6 @@ def test_stop_connector_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka_connect.StopConnectorRequest() - assert args[0] == request_msg @@ -9964,7 +9974,6 @@ async def test_list_connect_clusters_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka_connect.ListConnectClustersRequest() - assert args[0] == request_msg @@ -9995,7 +10004,6 @@ async def test_get_connect_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka_connect.GetConnectClusterRequest() - assert args[0] == request_msg @@ -10022,7 +10030,6 @@ async def test_create_connect_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka_connect.CreateConnectClusterRequest() - assert args[0] == request_msg @@ -10049,7 +10056,6 @@ async def test_update_connect_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka_connect.UpdateConnectClusterRequest() - assert args[0] == request_msg @@ -10076,7 +10082,6 @@ async def test_delete_connect_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka_connect.DeleteConnectClusterRequest() - assert args[0] == request_msg @@ -10103,7 +10108,6 @@ async def test_list_connectors_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka_connect.ListConnectorsRequest() - assert args[0] == request_msg @@ -10131,7 +10135,6 @@ async def test_get_connector_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka_connect.GetConnectorRequest() - assert args[0] == request_msg @@ -10159,7 +10162,6 @@ async def test_create_connector_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka_connect.CreateConnectorRequest() - assert args[0] == request_msg @@ -10187,7 +10189,6 @@ async def test_update_connector_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka_connect.UpdateConnectorRequest() - assert args[0] == request_msg @@ -10210,7 +10211,6 @@ async def test_delete_connector_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka_connect.DeleteConnectorRequest() - assert args[0] == request_msg @@ -10235,7 +10235,6 @@ async def test_pause_connector_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka_connect.PauseConnectorRequest() - assert args[0] == request_msg @@ -10260,7 +10259,6 @@ async def test_resume_connector_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka_connect.ResumeConnectorRequest() - assert args[0] == request_msg @@ -10287,7 +10285,6 @@ async def test_restart_connector_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka_connect.RestartConnectorRequest() - assert args[0] == request_msg @@ -10312,7 +10309,6 @@ async def test_stop_connector_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka_connect.StopConnectorRequest() - assert args[0] == request_msg @@ -12954,7 +12950,6 @@ def test_list_connect_clusters_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka_connect.ListConnectClustersRequest() - assert args[0] == request_msg @@ -12976,7 +12971,6 @@ def test_get_connect_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka_connect.GetConnectClusterRequest() - assert args[0] == request_msg @@ -12998,7 +12992,6 @@ def test_create_connect_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka_connect.CreateConnectClusterRequest() - assert args[0] == request_msg @@ -13020,7 +13013,6 @@ def test_update_connect_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka_connect.UpdateConnectClusterRequest() - assert args[0] == request_msg @@ -13042,7 +13034,6 @@ def test_delete_connect_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka_connect.DeleteConnectClusterRequest() - assert args[0] == request_msg @@ -13062,7 +13053,6 @@ def test_list_connectors_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka_connect.ListConnectorsRequest() - assert args[0] == request_msg @@ -13082,7 +13072,6 @@ def test_get_connector_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka_connect.GetConnectorRequest() - assert args[0] == request_msg @@ -13102,7 +13091,6 @@ def test_create_connector_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka_connect.CreateConnectorRequest() - assert args[0] == request_msg @@ -13122,7 +13110,6 @@ def test_update_connector_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka_connect.UpdateConnectorRequest() - assert args[0] == request_msg @@ -13142,7 +13129,6 @@ def test_delete_connector_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka_connect.DeleteConnectorRequest() - assert args[0] == request_msg @@ -13162,7 +13148,6 @@ def test_pause_connector_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka_connect.PauseConnectorRequest() - assert args[0] == request_msg @@ -13182,7 +13167,6 @@ def test_resume_connector_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka_connect.ResumeConnectorRequest() - assert args[0] == request_msg @@ -13204,7 +13188,6 @@ def test_restart_connector_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka_connect.RestartConnectorRequest() - assert args[0] == request_msg @@ -13224,7 +13207,6 @@ def test_stop_connector_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_kafka_connect.StopConnectorRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-media-translation/noxfile.py b/packages/google-cloud-media-translation/noxfile.py index b795c3bb783d..32561ecc46e5 100644 --- a/packages/google-cloud-media-translation/noxfile.py +++ b/packages/google-cloud-media-translation/noxfile.py @@ -47,7 +47,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-media-translation" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-media-translation/setup.py b/packages/google-cloud-media-translation/setup.py index 579567067f1e..44edff2adc76 100644 --- a/packages/google-cloud-media-translation/setup.py +++ b/packages/google-cloud-media-translation/setup.py @@ -45,7 +45,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/google-cloud-media-translation/testing/constraints-3.10.txt b/packages/google-cloud-media-translation/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-media-translation/testing/constraints-3.10.txt +++ b/packages/google-cloud-media-translation/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-media-translation/tests/unit/gapic/mediatranslation_v1beta1/test_speech_translation_service.py b/packages/google-cloud-media-translation/tests/unit/gapic/mediatranslation_v1beta1/test_speech_translation_service.py index 1bf49db491e8..f758699325cc 100644 --- a/packages/google-cloud-media-translation/tests/unit/gapic/mediatranslation_v1beta1/test_speech_translation_service.py +++ b/packages/google-cloud-media-translation/tests/unit/gapic/mediatranslation_v1beta1/test_speech_translation_service.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 @@ -104,6 +105,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" @@ -1339,8 +1355,8 @@ def test_speech_translation_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - media_translation.StreamingTranslateSpeechRequest, - dict, + media_translation.StreamingTranslateSpeechRequest(), + {}, ], ) def test_streaming_translate_speech(request_type, transport: str = "grpc"): @@ -1351,7 +1367,7 @@ def test_streaming_translate_speech(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as 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. @@ -1455,9 +1471,15 @@ async def test_streaming_translate_speech_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + media_translation.StreamingTranslateSpeechRequest(), + {}, + ], +) async def test_streaming_translate_speech_async( - transport: str = "grpc_asyncio", - request_type=media_translation.StreamingTranslateSpeechRequest, + request_type, transport: str = "grpc_asyncio" ): client = SpeechTranslationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1466,7 +1488,7 @@ async def test_streaming_translate_speech_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. @@ -1490,11 +1512,6 @@ async def test_streaming_translate_speech_async( assert isinstance(message, media_translation.StreamingTranslateSpeechResponse) -@pytest.mark.asyncio -async def test_streaming_translate_speech_async_from_dict(): - await test_streaming_translate_speech_async(request_type=dict) - - def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.SpeechTranslationServiceGrpcTransport( diff --git a/packages/google-cloud-memcache/noxfile.py b/packages/google-cloud-memcache/noxfile.py index d7f254648bfb..53eca79c60e2 100644 --- a/packages/google-cloud-memcache/noxfile.py +++ b/packages/google-cloud-memcache/noxfile.py @@ -47,7 +47,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-memcache" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-memcache/setup.py b/packages/google-cloud-memcache/setup.py index 17b78c95bc21..79d8a055aabe 100644 --- a/packages/google-cloud-memcache/setup.py +++ b/packages/google-cloud-memcache/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/google-cloud-memcache/testing/constraints-3.10.txt b/packages/google-cloud-memcache/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-memcache/testing/constraints-3.10.txt +++ b/packages/google-cloud-memcache/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-memcache/tests/unit/gapic/memcache_v1/test_cloud_memcache.py b/packages/google-cloud-memcache/tests/unit/gapic/memcache_v1/test_cloud_memcache.py index cb431f54e3ba..33d35a093a81 100644 --- a/packages/google-cloud-memcache/tests/unit/gapic/memcache_v1/test_cloud_memcache.py +++ b/packages/google-cloud-memcache/tests/unit/gapic/memcache_v1/test_cloud_memcache.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 @@ -119,6 +120,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" @@ -1318,8 +1334,8 @@ def test_cloud_memcache_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - cloud_memcache.ListInstancesRequest, - dict, + cloud_memcache.ListInstancesRequest(), + {}, ], ) def test_list_instances(request_type, transport: str = "grpc"): @@ -1330,7 +1346,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(type(client.transport.list_instances), "__call__") as call: @@ -1379,12 +1395,13 @@ 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_memcache.ListInstancesRequest( + request_msg = cloud_memcache.ListInstancesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_instances_use_cached_wrapped_rpc(): @@ -1465,9 +1482,14 @@ async def test_list_instances_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_instances_async( - transport: str = "grpc_asyncio", request_type=cloud_memcache.ListInstancesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_memcache.ListInstancesRequest(), + {}, + ], +) +async def test_list_instances_async(request_type, transport: str = "grpc_asyncio"): client = CloudMemcacheAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1475,7 +1497,7 @@ async def test_list_instances_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_instances), "__call__") as call: @@ -1500,11 +1522,6 @@ async def test_list_instances_async( 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 = CloudMemcacheClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1841,8 +1858,8 @@ async def test_list_instances_async_pages(): @pytest.mark.parametrize( "request_type", [ - cloud_memcache.GetInstanceRequest, - dict, + cloud_memcache.GetInstanceRequest(), + {}, ], ) def test_get_instance(request_type, transport: str = "grpc"): @@ -1853,7 +1870,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(type(client.transport.get_instance), "__call__") as call: @@ -1913,9 +1930,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_memcache.GetInstanceRequest( + request_msg = cloud_memcache.GetInstanceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_instance_use_cached_wrapped_rpc(): @@ -1996,9 +2014,14 @@ async def test_get_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_instance_async( - transport: str = "grpc_asyncio", request_type=cloud_memcache.GetInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_memcache.GetInstanceRequest(), + {}, + ], +) +async def test_get_instance_async(request_type, transport: str = "grpc_asyncio"): client = CloudMemcacheAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2006,7 +2029,7 @@ async def test_get_instance_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_instance), "__call__") as call: @@ -2045,11 +2068,6 @@ async def test_get_instance_async( assert response.discovery_endpoint == "discovery_endpoint_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 = CloudMemcacheClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2196,8 +2214,8 @@ async def test_get_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_memcache.CreateInstanceRequest, - dict, + cloud_memcache.CreateInstanceRequest(), + {}, ], ) def test_create_instance(request_type, transport: str = "grpc"): @@ -2208,7 +2226,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(type(client.transport.create_instance), "__call__") as call: @@ -2250,10 +2268,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_memcache.CreateInstanceRequest( + request_msg = cloud_memcache.CreateInstanceRequest( parent="parent_value", instance_id="instance_id_value", ) + assert args[0] == request_msg def test_create_instance_use_cached_wrapped_rpc(): @@ -2344,9 +2363,14 @@ async def test_create_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_instance_async( - transport: str = "grpc_asyncio", request_type=cloud_memcache.CreateInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_memcache.CreateInstanceRequest(), + {}, + ], +) +async def test_create_instance_async(request_type, transport: str = "grpc_asyncio"): client = CloudMemcacheAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2354,7 +2378,7 @@ async def test_create_instance_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_instance), "__call__") as call: @@ -2374,11 +2398,6 @@ async def test_create_instance_async( 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 = CloudMemcacheClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2545,8 +2564,8 @@ async def test_create_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_memcache.UpdateInstanceRequest, - dict, + cloud_memcache.UpdateInstanceRequest(), + {}, ], ) def test_update_instance(request_type, transport: str = "grpc"): @@ -2557,7 +2576,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(type(client.transport.update_instance), "__call__") as call: @@ -2596,7 +2615,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] - assert args[0] == cloud_memcache.UpdateInstanceRequest() + request_msg = cloud_memcache.UpdateInstanceRequest() + assert args[0] == request_msg def test_update_instance_use_cached_wrapped_rpc(): @@ -2687,9 +2707,14 @@ async def test_update_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_instance_async( - transport: str = "grpc_asyncio", request_type=cloud_memcache.UpdateInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_memcache.UpdateInstanceRequest(), + {}, + ], +) +async def test_update_instance_async(request_type, transport: str = "grpc_asyncio"): client = CloudMemcacheAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2697,7 +2722,7 @@ async def test_update_instance_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_instance), "__call__") as call: @@ -2717,11 +2742,6 @@ async def test_update_instance_async( 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 = CloudMemcacheClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2878,8 +2898,8 @@ async def test_update_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_memcache.UpdateParametersRequest, - dict, + cloud_memcache.UpdateParametersRequest(), + {}, ], ) def test_update_parameters(request_type, transport: str = "grpc"): @@ -2890,7 +2910,7 @@ def test_update_parameters(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,9 +2955,10 @@ def test_update_parameters_non_empty_request_with_auto_populated_field(): client.update_parameters(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_memcache.UpdateParametersRequest( + request_msg = cloud_memcache.UpdateParametersRequest( name="name_value", ) + assert args[0] == request_msg def test_update_parameters_use_cached_wrapped_rpc(): @@ -3030,9 +3051,14 @@ async def test_update_parameters_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_parameters_async( - transport: str = "grpc_asyncio", request_type=cloud_memcache.UpdateParametersRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_memcache.UpdateParametersRequest(), + {}, + ], +) +async def test_update_parameters_async(request_type, transport: str = "grpc_asyncio"): client = CloudMemcacheAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3040,7 +3066,7 @@ async def test_update_parameters_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( @@ -3062,11 +3088,6 @@ async def test_update_parameters_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_parameters_async_from_dict(): - await test_update_parameters_async(request_type=dict) - - def test_update_parameters_field_headers(): client = CloudMemcacheClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3241,8 +3262,8 @@ async def test_update_parameters_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_memcache.DeleteInstanceRequest, - dict, + cloud_memcache.DeleteInstanceRequest(), + {}, ], ) def test_delete_instance(request_type, transport: str = "grpc"): @@ -3253,7 +3274,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(type(client.transport.delete_instance), "__call__") as call: @@ -3294,9 +3315,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_memcache.DeleteInstanceRequest( + request_msg = cloud_memcache.DeleteInstanceRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_instance_use_cached_wrapped_rpc(): @@ -3387,9 +3409,14 @@ async def test_delete_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_instance_async( - transport: str = "grpc_asyncio", request_type=cloud_memcache.DeleteInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_memcache.DeleteInstanceRequest(), + {}, + ], +) +async def test_delete_instance_async(request_type, transport: str = "grpc_asyncio"): client = CloudMemcacheAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3397,7 +3424,7 @@ async def test_delete_instance_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_instance), "__call__") as call: @@ -3417,11 +3444,6 @@ async def test_delete_instance_async( 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 = CloudMemcacheClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3568,8 +3590,8 @@ async def test_delete_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_memcache.ApplyParametersRequest, - dict, + cloud_memcache.ApplyParametersRequest(), + {}, ], ) def test_apply_parameters(request_type, transport: str = "grpc"): @@ -3580,7 +3602,7 @@ def test_apply_parameters(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.apply_parameters), "__call__") as call: @@ -3621,9 +3643,10 @@ def test_apply_parameters_non_empty_request_with_auto_populated_field(): client.apply_parameters(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_memcache.ApplyParametersRequest( + request_msg = cloud_memcache.ApplyParametersRequest( name="name_value", ) + assert args[0] == request_msg def test_apply_parameters_use_cached_wrapped_rpc(): @@ -3716,9 +3739,14 @@ async def test_apply_parameters_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_apply_parameters_async( - transport: str = "grpc_asyncio", request_type=cloud_memcache.ApplyParametersRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_memcache.ApplyParametersRequest(), + {}, + ], +) +async def test_apply_parameters_async(request_type, transport: str = "grpc_asyncio"): client = CloudMemcacheAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3726,7 +3754,7 @@ async def test_apply_parameters_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.apply_parameters), "__call__") as call: @@ -3746,11 +3774,6 @@ async def test_apply_parameters_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_apply_parameters_async_from_dict(): - await test_apply_parameters_async(request_type=dict) - - def test_apply_parameters_field_headers(): client = CloudMemcacheClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3917,8 +3940,8 @@ async def test_apply_parameters_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_memcache.RescheduleMaintenanceRequest, - dict, + cloud_memcache.RescheduleMaintenanceRequest(), + {}, ], ) def test_reschedule_maintenance(request_type, transport: str = "grpc"): @@ -3929,7 +3952,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( @@ -3974,9 +3997,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_memcache.RescheduleMaintenanceRequest( + request_msg = cloud_memcache.RescheduleMaintenanceRequest( instance="instance_value", ) + assert args[0] == request_msg def test_reschedule_maintenance_use_cached_wrapped_rpc(): @@ -4072,9 +4096,15 @@ async def test_reschedule_maintenance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloud_memcache.RescheduleMaintenanceRequest(), + {}, + ], +) async def test_reschedule_maintenance_async( - transport: str = "grpc_asyncio", - request_type=cloud_memcache.RescheduleMaintenanceRequest, + request_type, transport: str = "grpc_asyncio" ): client = CloudMemcacheAsyncClient( credentials=async_anonymous_credentials(), @@ -4083,7 +4113,7 @@ async def test_reschedule_maintenance_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( @@ -4105,11 +4135,6 @@ async def test_reschedule_maintenance_async( 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 = CloudMemcacheClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5989,7 +6014,6 @@ def test_list_instances_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_memcache.ListInstancesRequest() - assert args[0] == request_msg @@ -6010,7 +6034,6 @@ def test_get_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_memcache.GetInstanceRequest() - assert args[0] == request_msg @@ -6031,7 +6054,6 @@ def test_create_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_memcache.CreateInstanceRequest() - assert args[0] == request_msg @@ -6052,7 +6074,6 @@ def test_update_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_memcache.UpdateInstanceRequest() - assert args[0] == request_msg @@ -6075,7 +6096,6 @@ def test_update_parameters_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_memcache.UpdateParametersRequest() - assert args[0] == request_msg @@ -6096,7 +6116,6 @@ def test_delete_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_memcache.DeleteInstanceRequest() - assert args[0] == request_msg @@ -6117,7 +6136,6 @@ def test_apply_parameters_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_memcache.ApplyParametersRequest() - assert args[0] == request_msg @@ -6140,7 +6158,6 @@ def test_reschedule_maintenance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_memcache.RescheduleMaintenanceRequest() - assert args[0] == request_msg @@ -6182,7 +6199,6 @@ async def test_list_instances_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_memcache.ListInstancesRequest() - assert args[0] == request_msg @@ -6217,7 +6233,6 @@ async def test_get_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_memcache.GetInstanceRequest() - assert args[0] == request_msg @@ -6242,7 +6257,6 @@ async def test_create_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_memcache.CreateInstanceRequest() - assert args[0] == request_msg @@ -6267,7 +6281,6 @@ async def test_update_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_memcache.UpdateInstanceRequest() - assert args[0] == request_msg @@ -6294,7 +6307,6 @@ async def test_update_parameters_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_memcache.UpdateParametersRequest() - assert args[0] == request_msg @@ -6319,7 +6331,6 @@ async def test_delete_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_memcache.DeleteInstanceRequest() - assert args[0] == request_msg @@ -6344,7 +6355,6 @@ async def test_apply_parameters_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_memcache.ApplyParametersRequest() - assert args[0] == request_msg @@ -6371,7 +6381,6 @@ async def test_reschedule_maintenance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_memcache.RescheduleMaintenanceRequest() - assert args[0] == request_msg @@ -8052,7 +8061,6 @@ def test_list_instances_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_memcache.ListInstancesRequest() - assert args[0] == request_msg @@ -8072,7 +8080,6 @@ def test_get_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_memcache.GetInstanceRequest() - assert args[0] == request_msg @@ -8092,7 +8099,6 @@ def test_create_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_memcache.CreateInstanceRequest() - assert args[0] == request_msg @@ -8112,7 +8118,6 @@ def test_update_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_memcache.UpdateInstanceRequest() - assert args[0] == request_msg @@ -8134,7 +8139,6 @@ def test_update_parameters_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_memcache.UpdateParametersRequest() - assert args[0] == request_msg @@ -8154,7 +8158,6 @@ def test_delete_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_memcache.DeleteInstanceRequest() - assert args[0] == request_msg @@ -8174,7 +8177,6 @@ def test_apply_parameters_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_memcache.ApplyParametersRequest() - assert args[0] == request_msg @@ -8196,7 +8198,6 @@ def test_reschedule_maintenance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_memcache.RescheduleMaintenanceRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-memcache/tests/unit/gapic/memcache_v1beta2/test_cloud_memcache.py b/packages/google-cloud-memcache/tests/unit/gapic/memcache_v1beta2/test_cloud_memcache.py index 5e7269428f13..9d79189ef76c 100644 --- a/packages/google-cloud-memcache/tests/unit/gapic/memcache_v1beta2/test_cloud_memcache.py +++ b/packages/google-cloud-memcache/tests/unit/gapic/memcache_v1beta2/test_cloud_memcache.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 @@ -119,6 +120,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" @@ -1318,8 +1334,8 @@ def test_cloud_memcache_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - cloud_memcache.ListInstancesRequest, - dict, + cloud_memcache.ListInstancesRequest(), + {}, ], ) def test_list_instances(request_type, transport: str = "grpc"): @@ -1330,7 +1346,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(type(client.transport.list_instances), "__call__") as call: @@ -1379,12 +1395,13 @@ 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_memcache.ListInstancesRequest( + request_msg = cloud_memcache.ListInstancesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_instances_use_cached_wrapped_rpc(): @@ -1465,9 +1482,14 @@ async def test_list_instances_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_instances_async( - transport: str = "grpc_asyncio", request_type=cloud_memcache.ListInstancesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_memcache.ListInstancesRequest(), + {}, + ], +) +async def test_list_instances_async(request_type, transport: str = "grpc_asyncio"): client = CloudMemcacheAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1475,7 +1497,7 @@ async def test_list_instances_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_instances), "__call__") as call: @@ -1500,11 +1522,6 @@ async def test_list_instances_async( 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 = CloudMemcacheClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1841,8 +1858,8 @@ async def test_list_instances_async_pages(): @pytest.mark.parametrize( "request_type", [ - cloud_memcache.GetInstanceRequest, - dict, + cloud_memcache.GetInstanceRequest(), + {}, ], ) def test_get_instance(request_type, transport: str = "grpc"): @@ -1853,7 +1870,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(type(client.transport.get_instance), "__call__") as call: @@ -1915,9 +1932,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_memcache.GetInstanceRequest( + request_msg = cloud_memcache.GetInstanceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_instance_use_cached_wrapped_rpc(): @@ -1998,9 +2016,14 @@ async def test_get_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_instance_async( - transport: str = "grpc_asyncio", request_type=cloud_memcache.GetInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_memcache.GetInstanceRequest(), + {}, + ], +) +async def test_get_instance_async(request_type, transport: str = "grpc_asyncio"): client = CloudMemcacheAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2008,7 +2031,7 @@ async def test_get_instance_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_instance), "__call__") as call: @@ -2049,11 +2072,6 @@ async def test_get_instance_async( assert response.update_available is True -@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 = CloudMemcacheClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2200,8 +2218,8 @@ async def test_get_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_memcache.CreateInstanceRequest, - dict, + cloud_memcache.CreateInstanceRequest(), + {}, ], ) def test_create_instance(request_type, transport: str = "grpc"): @@ -2212,7 +2230,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(type(client.transport.create_instance), "__call__") as call: @@ -2254,10 +2272,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_memcache.CreateInstanceRequest( + request_msg = cloud_memcache.CreateInstanceRequest( parent="parent_value", instance_id="instance_id_value", ) + assert args[0] == request_msg def test_create_instance_use_cached_wrapped_rpc(): @@ -2348,9 +2367,14 @@ async def test_create_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_instance_async( - transport: str = "grpc_asyncio", request_type=cloud_memcache.CreateInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_memcache.CreateInstanceRequest(), + {}, + ], +) +async def test_create_instance_async(request_type, transport: str = "grpc_asyncio"): client = CloudMemcacheAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2358,7 +2382,7 @@ async def test_create_instance_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_instance), "__call__") as call: @@ -2378,11 +2402,6 @@ async def test_create_instance_async( 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 = CloudMemcacheClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2549,8 +2568,8 @@ async def test_create_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_memcache.UpdateInstanceRequest, - dict, + cloud_memcache.UpdateInstanceRequest(), + {}, ], ) def test_update_instance(request_type, transport: str = "grpc"): @@ -2561,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(type(client.transport.update_instance), "__call__") as call: @@ -2600,7 +2619,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] - assert args[0] == cloud_memcache.UpdateInstanceRequest() + request_msg = cloud_memcache.UpdateInstanceRequest() + assert args[0] == request_msg def test_update_instance_use_cached_wrapped_rpc(): @@ -2691,9 +2711,14 @@ async def test_update_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_instance_async( - transport: str = "grpc_asyncio", request_type=cloud_memcache.UpdateInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_memcache.UpdateInstanceRequest(), + {}, + ], +) +async def test_update_instance_async(request_type, transport: str = "grpc_asyncio"): client = CloudMemcacheAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2701,7 +2726,7 @@ async def test_update_instance_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_instance), "__call__") as call: @@ -2721,11 +2746,6 @@ async def test_update_instance_async( 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 = CloudMemcacheClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2882,8 +2902,8 @@ async def test_update_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_memcache.UpdateParametersRequest, - dict, + cloud_memcache.UpdateParametersRequest(), + {}, ], ) def test_update_parameters(request_type, transport: str = "grpc"): @@ -2894,7 +2914,7 @@ def test_update_parameters(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,9 +2959,10 @@ def test_update_parameters_non_empty_request_with_auto_populated_field(): client.update_parameters(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_memcache.UpdateParametersRequest( + request_msg = cloud_memcache.UpdateParametersRequest( name="name_value", ) + assert args[0] == request_msg def test_update_parameters_use_cached_wrapped_rpc(): @@ -3034,9 +3055,14 @@ async def test_update_parameters_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_parameters_async( - transport: str = "grpc_asyncio", request_type=cloud_memcache.UpdateParametersRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_memcache.UpdateParametersRequest(), + {}, + ], +) +async def test_update_parameters_async(request_type, transport: str = "grpc_asyncio"): client = CloudMemcacheAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3044,7 +3070,7 @@ async def test_update_parameters_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( @@ -3066,11 +3092,6 @@ async def test_update_parameters_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_parameters_async_from_dict(): - await test_update_parameters_async(request_type=dict) - - def test_update_parameters_field_headers(): client = CloudMemcacheClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3245,8 +3266,8 @@ async def test_update_parameters_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_memcache.DeleteInstanceRequest, - dict, + cloud_memcache.DeleteInstanceRequest(), + {}, ], ) def test_delete_instance(request_type, transport: str = "grpc"): @@ -3257,7 +3278,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(type(client.transport.delete_instance), "__call__") as call: @@ -3298,9 +3319,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_memcache.DeleteInstanceRequest( + request_msg = cloud_memcache.DeleteInstanceRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_instance_use_cached_wrapped_rpc(): @@ -3391,9 +3413,14 @@ async def test_delete_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_instance_async( - transport: str = "grpc_asyncio", request_type=cloud_memcache.DeleteInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_memcache.DeleteInstanceRequest(), + {}, + ], +) +async def test_delete_instance_async(request_type, transport: str = "grpc_asyncio"): client = CloudMemcacheAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3401,7 +3428,7 @@ async def test_delete_instance_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_instance), "__call__") as call: @@ -3421,11 +3448,6 @@ async def test_delete_instance_async( 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 = CloudMemcacheClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3572,8 +3594,8 @@ async def test_delete_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_memcache.ApplyParametersRequest, - dict, + cloud_memcache.ApplyParametersRequest(), + {}, ], ) def test_apply_parameters(request_type, transport: str = "grpc"): @@ -3584,7 +3606,7 @@ def test_apply_parameters(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.apply_parameters), "__call__") as call: @@ -3625,9 +3647,10 @@ def test_apply_parameters_non_empty_request_with_auto_populated_field(): client.apply_parameters(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_memcache.ApplyParametersRequest( + request_msg = cloud_memcache.ApplyParametersRequest( name="name_value", ) + assert args[0] == request_msg def test_apply_parameters_use_cached_wrapped_rpc(): @@ -3720,9 +3743,14 @@ async def test_apply_parameters_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_apply_parameters_async( - transport: str = "grpc_asyncio", request_type=cloud_memcache.ApplyParametersRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_memcache.ApplyParametersRequest(), + {}, + ], +) +async def test_apply_parameters_async(request_type, transport: str = "grpc_asyncio"): client = CloudMemcacheAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3730,7 +3758,7 @@ async def test_apply_parameters_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.apply_parameters), "__call__") as call: @@ -3750,11 +3778,6 @@ async def test_apply_parameters_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_apply_parameters_async_from_dict(): - await test_apply_parameters_async(request_type=dict) - - def test_apply_parameters_field_headers(): client = CloudMemcacheClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3921,8 +3944,8 @@ async def test_apply_parameters_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_memcache.ApplySoftwareUpdateRequest, - dict, + cloud_memcache.ApplySoftwareUpdateRequest(), + {}, ], ) def test_apply_software_update(request_type, transport: str = "grpc"): @@ -3933,7 +3956,7 @@ def test_apply_software_update(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3978,9 +4001,10 @@ def test_apply_software_update_non_empty_request_with_auto_populated_field(): client.apply_software_update(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_memcache.ApplySoftwareUpdateRequest( + request_msg = cloud_memcache.ApplySoftwareUpdateRequest( instance="instance_value", ) + assert args[0] == request_msg def test_apply_software_update_use_cached_wrapped_rpc(): @@ -4076,9 +4100,15 @@ async def test_apply_software_update_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloud_memcache.ApplySoftwareUpdateRequest(), + {}, + ], +) async def test_apply_software_update_async( - transport: str = "grpc_asyncio", - request_type=cloud_memcache.ApplySoftwareUpdateRequest, + request_type, transport: str = "grpc_asyncio" ): client = CloudMemcacheAsyncClient( credentials=async_anonymous_credentials(), @@ -4087,7 +4117,7 @@ async def test_apply_software_update_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( @@ -4109,11 +4139,6 @@ async def test_apply_software_update_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_apply_software_update_async_from_dict(): - await test_apply_software_update_async(request_type=dict) - - def test_apply_software_update_field_headers(): client = CloudMemcacheClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4288,8 +4313,8 @@ async def test_apply_software_update_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_memcache.RescheduleMaintenanceRequest, - dict, + cloud_memcache.RescheduleMaintenanceRequest(), + {}, ], ) def test_reschedule_maintenance(request_type, transport: str = "grpc"): @@ -4300,7 +4325,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( @@ -4345,9 +4370,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_memcache.RescheduleMaintenanceRequest( + request_msg = cloud_memcache.RescheduleMaintenanceRequest( instance="instance_value", ) + assert args[0] == request_msg def test_reschedule_maintenance_use_cached_wrapped_rpc(): @@ -4443,9 +4469,15 @@ async def test_reschedule_maintenance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloud_memcache.RescheduleMaintenanceRequest(), + {}, + ], +) async def test_reschedule_maintenance_async( - transport: str = "grpc_asyncio", - request_type=cloud_memcache.RescheduleMaintenanceRequest, + request_type, transport: str = "grpc_asyncio" ): client = CloudMemcacheAsyncClient( credentials=async_anonymous_credentials(), @@ -4454,7 +4486,7 @@ async def test_reschedule_maintenance_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( @@ -4476,11 +4508,6 @@ async def test_reschedule_maintenance_async( 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 = CloudMemcacheClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6553,7 +6580,6 @@ def test_list_instances_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_memcache.ListInstancesRequest() - assert args[0] == request_msg @@ -6574,7 +6600,6 @@ def test_get_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_memcache.GetInstanceRequest() - assert args[0] == request_msg @@ -6595,7 +6620,6 @@ def test_create_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_memcache.CreateInstanceRequest() - assert args[0] == request_msg @@ -6616,7 +6640,6 @@ def test_update_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_memcache.UpdateInstanceRequest() - assert args[0] == request_msg @@ -6639,7 +6662,6 @@ def test_update_parameters_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_memcache.UpdateParametersRequest() - assert args[0] == request_msg @@ -6660,7 +6682,6 @@ def test_delete_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_memcache.DeleteInstanceRequest() - assert args[0] == request_msg @@ -6681,7 +6702,6 @@ def test_apply_parameters_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_memcache.ApplyParametersRequest() - assert args[0] == request_msg @@ -6704,7 +6724,6 @@ def test_apply_software_update_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_memcache.ApplySoftwareUpdateRequest() - assert args[0] == request_msg @@ -6727,7 +6746,6 @@ def test_reschedule_maintenance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_memcache.RescheduleMaintenanceRequest() - assert args[0] == request_msg @@ -6769,7 +6787,6 @@ async def test_list_instances_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_memcache.ListInstancesRequest() - assert args[0] == request_msg @@ -6805,7 +6822,6 @@ async def test_get_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_memcache.GetInstanceRequest() - assert args[0] == request_msg @@ -6830,7 +6846,6 @@ async def test_create_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_memcache.CreateInstanceRequest() - assert args[0] == request_msg @@ -6855,7 +6870,6 @@ async def test_update_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_memcache.UpdateInstanceRequest() - assert args[0] == request_msg @@ -6882,7 +6896,6 @@ async def test_update_parameters_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_memcache.UpdateParametersRequest() - assert args[0] == request_msg @@ -6907,7 +6920,6 @@ async def test_delete_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_memcache.DeleteInstanceRequest() - assert args[0] == request_msg @@ -6932,7 +6944,6 @@ async def test_apply_parameters_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_memcache.ApplyParametersRequest() - assert args[0] == request_msg @@ -6959,7 +6970,6 @@ async def test_apply_software_update_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_memcache.ApplySoftwareUpdateRequest() - assert args[0] == request_msg @@ -6986,7 +6996,6 @@ async def test_reschedule_maintenance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_memcache.RescheduleMaintenanceRequest() - assert args[0] == request_msg @@ -8799,7 +8808,6 @@ def test_list_instances_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_memcache.ListInstancesRequest() - assert args[0] == request_msg @@ -8819,7 +8827,6 @@ def test_get_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_memcache.GetInstanceRequest() - assert args[0] == request_msg @@ -8839,7 +8846,6 @@ def test_create_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_memcache.CreateInstanceRequest() - assert args[0] == request_msg @@ -8859,7 +8865,6 @@ def test_update_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_memcache.UpdateInstanceRequest() - assert args[0] == request_msg @@ -8881,7 +8886,6 @@ def test_update_parameters_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_memcache.UpdateParametersRequest() - assert args[0] == request_msg @@ -8901,7 +8905,6 @@ def test_delete_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_memcache.DeleteInstanceRequest() - assert args[0] == request_msg @@ -8921,7 +8924,6 @@ def test_apply_parameters_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_memcache.ApplyParametersRequest() - assert args[0] == request_msg @@ -8943,7 +8945,6 @@ def test_apply_software_update_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_memcache.ApplySoftwareUpdateRequest() - assert args[0] == request_msg @@ -8965,7 +8966,6 @@ def test_reschedule_maintenance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_memcache.RescheduleMaintenanceRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-memorystore/noxfile.py b/packages/google-cloud-memorystore/noxfile.py index 84bfb00b5b7e..f25e737a088f 100644 --- a/packages/google-cloud-memorystore/noxfile.py +++ b/packages/google-cloud-memorystore/noxfile.py @@ -47,7 +47,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-memorystore" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-memorystore/setup.py b/packages/google-cloud-memorystore/setup.py index ea0912469c23..208691caab56 100644 --- a/packages/google-cloud-memorystore/setup.py +++ b/packages/google-cloud-memorystore/setup.py @@ -45,7 +45,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/google-cloud-memorystore/testing/constraints-3.10.txt b/packages/google-cloud-memorystore/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-memorystore/testing/constraints-3.10.txt +++ b/packages/google-cloud-memorystore/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-memorystore/tests/unit/gapic/memorystore_v1/test_memorystore.py b/packages/google-cloud-memorystore/tests/unit/gapic/memorystore_v1/test_memorystore.py index 12558a9f68e1..dbd31326d61e 100644 --- a/packages/google-cloud-memorystore/tests/unit/gapic/memorystore_v1/test_memorystore.py +++ b/packages/google-cloud-memorystore/tests/unit/gapic/memorystore_v1/test_memorystore.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 @@ -119,6 +120,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" @@ -1284,8 +1300,8 @@ def test_memorystore_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - memorystore.ListInstancesRequest, - dict, + memorystore.ListInstancesRequest(), + {}, ], ) def test_list_instances(request_type, transport: str = "grpc"): @@ -1296,7 +1312,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(type(client.transport.list_instances), "__call__") as call: @@ -1345,12 +1361,13 @@ 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] == memorystore.ListInstancesRequest( + request_msg = memorystore.ListInstancesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_instances_use_cached_wrapped_rpc(): @@ -1431,9 +1448,14 @@ async def test_list_instances_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_instances_async( - transport: str = "grpc_asyncio", request_type=memorystore.ListInstancesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + memorystore.ListInstancesRequest(), + {}, + ], +) +async def test_list_instances_async(request_type, transport: str = "grpc_asyncio"): client = MemorystoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1441,7 +1463,7 @@ async def test_list_instances_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_instances), "__call__") as call: @@ -1466,11 +1488,6 @@ async def test_list_instances_async( 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 = MemorystoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1807,8 +1824,8 @@ async def test_list_instances_async_pages(): @pytest.mark.parametrize( "request_type", [ - memorystore.GetInstanceRequest, - dict, + memorystore.GetInstanceRequest(), + {}, ], ) def test_get_instance(request_type, transport: str = "grpc"): @@ -1819,7 +1836,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(type(client.transport.get_instance), "__call__") as call: @@ -1924,9 +1941,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] == memorystore.GetInstanceRequest( + request_msg = memorystore.GetInstanceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_instance_use_cached_wrapped_rpc(): @@ -2007,9 +2025,14 @@ async def test_get_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_instance_async( - transport: str = "grpc_asyncio", request_type=memorystore.GetInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + memorystore.GetInstanceRequest(), + {}, + ], +) +async def test_get_instance_async(request_type, transport: str = "grpc_asyncio"): client = MemorystoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2017,7 +2040,7 @@ async def test_get_instance_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_instance), "__call__") as call: @@ -2101,11 +2124,6 @@ async def test_get_instance_async( assert response.rotate_server_certificate is True -@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 = MemorystoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2252,8 +2270,8 @@ async def test_get_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - memorystore.CreateInstanceRequest, - dict, + memorystore.CreateInstanceRequest(), + {}, ], ) def test_create_instance(request_type, transport: str = "grpc"): @@ -2264,7 +2282,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(type(client.transport.create_instance), "__call__") as call: @@ -2306,10 +2324,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] == memorystore.CreateInstanceRequest( + request_msg = memorystore.CreateInstanceRequest( parent="parent_value", instance_id="instance_id_value", ) + assert args[0] == request_msg def test_create_instance_use_cached_wrapped_rpc(): @@ -2400,9 +2419,14 @@ async def test_create_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_instance_async( - transport: str = "grpc_asyncio", request_type=memorystore.CreateInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + memorystore.CreateInstanceRequest(), + {}, + ], +) +async def test_create_instance_async(request_type, transport: str = "grpc_asyncio"): client = MemorystoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2410,7 +2434,7 @@ async def test_create_instance_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_instance), "__call__") as call: @@ -2430,11 +2454,6 @@ async def test_create_instance_async( 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 = MemorystoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2613,8 +2632,8 @@ async def test_create_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - memorystore.UpdateInstanceRequest, - dict, + memorystore.UpdateInstanceRequest(), + {}, ], ) def test_update_instance(request_type, transport: str = "grpc"): @@ -2625,7 +2644,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(type(client.transport.update_instance), "__call__") as call: @@ -2664,7 +2683,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] - assert args[0] == memorystore.UpdateInstanceRequest() + request_msg = memorystore.UpdateInstanceRequest() + assert args[0] == request_msg def test_update_instance_use_cached_wrapped_rpc(): @@ -2755,9 +2775,14 @@ async def test_update_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_instance_async( - transport: str = "grpc_asyncio", request_type=memorystore.UpdateInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + memorystore.UpdateInstanceRequest(), + {}, + ], +) +async def test_update_instance_async(request_type, transport: str = "grpc_asyncio"): client = MemorystoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2765,7 +2790,7 @@ async def test_update_instance_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_instance), "__call__") as call: @@ -2785,11 +2810,6 @@ async def test_update_instance_async( 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 = MemorystoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2958,8 +2978,8 @@ async def test_update_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - memorystore.DeleteInstanceRequest, - dict, + memorystore.DeleteInstanceRequest(), + {}, ], ) def test_delete_instance(request_type, transport: str = "grpc"): @@ -2970,7 +2990,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(type(client.transport.delete_instance), "__call__") as call: @@ -3011,9 +3031,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] == memorystore.DeleteInstanceRequest( + request_msg = memorystore.DeleteInstanceRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_instance_use_cached_wrapped_rpc(): @@ -3104,9 +3125,14 @@ async def test_delete_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_instance_async( - transport: str = "grpc_asyncio", request_type=memorystore.DeleteInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + memorystore.DeleteInstanceRequest(), + {}, + ], +) +async def test_delete_instance_async(request_type, transport: str = "grpc_asyncio"): client = MemorystoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3114,7 +3140,7 @@ async def test_delete_instance_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_instance), "__call__") as call: @@ -3134,11 +3160,6 @@ async def test_delete_instance_async( 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 = MemorystoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3285,8 +3306,8 @@ async def test_delete_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - memorystore.GetCertificateAuthorityRequest, - dict, + memorystore.GetCertificateAuthorityRequest(), + {}, ], ) def test_get_certificate_authority(request_type, transport: str = "grpc"): @@ -3297,7 +3318,7 @@ def test_get_certificate_authority(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3345,9 +3366,10 @@ def test_get_certificate_authority_non_empty_request_with_auto_populated_field() client.get_certificate_authority(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == memorystore.GetCertificateAuthorityRequest( + request_msg = memorystore.GetCertificateAuthorityRequest( name="name_value", ) + assert args[0] == request_msg def test_get_certificate_authority_use_cached_wrapped_rpc(): @@ -3433,9 +3455,15 @@ async def test_get_certificate_authority_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + memorystore.GetCertificateAuthorityRequest(), + {}, + ], +) async def test_get_certificate_authority_async( - transport: str = "grpc_asyncio", - request_type=memorystore.GetCertificateAuthorityRequest, + request_type, transport: str = "grpc_asyncio" ): client = MemorystoreAsyncClient( credentials=async_anonymous_credentials(), @@ -3444,7 +3472,7 @@ async def test_get_certificate_authority_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( @@ -3469,11 +3497,6 @@ async def test_get_certificate_authority_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_certificate_authority_async_from_dict(): - await test_get_certificate_authority_async(request_type=dict) - - def test_get_certificate_authority_field_headers(): client = MemorystoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3628,8 +3651,8 @@ async def test_get_certificate_authority_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - memorystore.GetSharedRegionalCertificateAuthorityRequest, - dict, + memorystore.GetSharedRegionalCertificateAuthorityRequest(), + {}, ], ) def test_get_shared_regional_certificate_authority( @@ -3642,7 +3665,7 @@ def test_get_shared_regional_certificate_authority( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3690,9 +3713,10 @@ def test_get_shared_regional_certificate_authority_non_empty_request_with_auto_p client.get_shared_regional_certificate_authority(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == memorystore.GetSharedRegionalCertificateAuthorityRequest( + request_msg = memorystore.GetSharedRegionalCertificateAuthorityRequest( name="name_value", ) + assert args[0] == request_msg def test_get_shared_regional_certificate_authority_use_cached_wrapped_rpc(): @@ -3778,9 +3802,15 @@ async def test_get_shared_regional_certificate_authority_async_use_cached_wrappe @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + memorystore.GetSharedRegionalCertificateAuthorityRequest(), + {}, + ], +) async def test_get_shared_regional_certificate_authority_async( - transport: str = "grpc_asyncio", - request_type=memorystore.GetSharedRegionalCertificateAuthorityRequest, + request_type, transport: str = "grpc_asyncio" ): client = MemorystoreAsyncClient( credentials=async_anonymous_credentials(), @@ -3789,7 +3819,7 @@ async def test_get_shared_regional_certificate_authority_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( @@ -3814,11 +3844,6 @@ async def test_get_shared_regional_certificate_authority_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_shared_regional_certificate_authority_async_from_dict(): - await test_get_shared_regional_certificate_authority_async(request_type=dict) - - def test_get_shared_regional_certificate_authority_field_headers(): client = MemorystoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3973,8 +3998,8 @@ async def test_get_shared_regional_certificate_authority_flattened_error_async() @pytest.mark.parametrize( "request_type", [ - memorystore.RescheduleMaintenanceRequest, - dict, + memorystore.RescheduleMaintenanceRequest(), + {}, ], ) def test_reschedule_maintenance(request_type, transport: str = "grpc"): @@ -3985,7 +4010,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( @@ -4030,9 +4055,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] == memorystore.RescheduleMaintenanceRequest( + request_msg = memorystore.RescheduleMaintenanceRequest( name="name_value", ) + assert args[0] == request_msg def test_reschedule_maintenance_use_cached_wrapped_rpc(): @@ -4128,9 +4154,15 @@ async def test_reschedule_maintenance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + memorystore.RescheduleMaintenanceRequest(), + {}, + ], +) async def test_reschedule_maintenance_async( - transport: str = "grpc_asyncio", - request_type=memorystore.RescheduleMaintenanceRequest, + request_type, transport: str = "grpc_asyncio" ): client = MemorystoreAsyncClient( credentials=async_anonymous_credentials(), @@ -4139,7 +4171,7 @@ async def test_reschedule_maintenance_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( @@ -4161,11 +4193,6 @@ async def test_reschedule_maintenance_async( 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 = MemorystoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4340,8 +4367,8 @@ async def test_reschedule_maintenance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - memorystore.ListBackupCollectionsRequest, - dict, + memorystore.ListBackupCollectionsRequest(), + {}, ], ) def test_list_backup_collections(request_type, transport: str = "grpc"): @@ -4352,7 +4379,7 @@ def test_list_backup_collections(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4403,10 +4430,11 @@ def test_list_backup_collections_non_empty_request_with_auto_populated_field(): client.list_backup_collections(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == memorystore.ListBackupCollectionsRequest( + request_msg = memorystore.ListBackupCollectionsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_backup_collections_use_cached_wrapped_rpc(): @@ -4492,9 +4520,15 @@ async def test_list_backup_collections_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + memorystore.ListBackupCollectionsRequest(), + {}, + ], +) async def test_list_backup_collections_async( - transport: str = "grpc_asyncio", - request_type=memorystore.ListBackupCollectionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = MemorystoreAsyncClient( credentials=async_anonymous_credentials(), @@ -4503,7 +4537,7 @@ async def test_list_backup_collections_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( @@ -4530,11 +4564,6 @@ async def test_list_backup_collections_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_backup_collections_async_from_dict(): - await test_list_backup_collections_async(request_type=dict) - - def test_list_backup_collections_field_headers(): client = MemorystoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4887,8 +4916,8 @@ async def test_list_backup_collections_async_pages(): @pytest.mark.parametrize( "request_type", [ - memorystore.GetBackupCollectionRequest, - dict, + memorystore.GetBackupCollectionRequest(), + {}, ], ) def test_get_backup_collection(request_type, transport: str = "grpc"): @@ -4899,7 +4928,7 @@ def test_get_backup_collection(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4959,9 +4988,10 @@ def test_get_backup_collection_non_empty_request_with_auto_populated_field(): client.get_backup_collection(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == memorystore.GetBackupCollectionRequest( + request_msg = memorystore.GetBackupCollectionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_backup_collection_use_cached_wrapped_rpc(): @@ -5047,8 +5077,15 @@ async def test_get_backup_collection_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + memorystore.GetBackupCollectionRequest(), + {}, + ], +) async def test_get_backup_collection_async( - transport: str = "grpc_asyncio", request_type=memorystore.GetBackupCollectionRequest + request_type, transport: str = "grpc_asyncio" ): client = MemorystoreAsyncClient( credentials=async_anonymous_credentials(), @@ -5057,7 +5094,7 @@ async def test_get_backup_collection_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( @@ -5094,11 +5131,6 @@ async def test_get_backup_collection_async( assert response.total_backup_count == 1921 -@pytest.mark.asyncio -async def test_get_backup_collection_async_from_dict(): - await test_get_backup_collection_async(request_type=dict) - - def test_get_backup_collection_field_headers(): client = MemorystoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5253,8 +5285,8 @@ async def test_get_backup_collection_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - memorystore.ListBackupsRequest, - dict, + memorystore.ListBackupsRequest(), + {}, ], ) def test_list_backups(request_type, transport: str = "grpc"): @@ -5265,7 +5297,7 @@ def test_list_backups(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_backups), "__call__") as call: @@ -5312,10 +5344,11 @@ def test_list_backups_non_empty_request_with_auto_populated_field(): client.list_backups(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == memorystore.ListBackupsRequest( + request_msg = memorystore.ListBackupsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_backups_use_cached_wrapped_rpc(): @@ -5396,9 +5429,14 @@ async def test_list_backups_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_backups_async( - transport: str = "grpc_asyncio", request_type=memorystore.ListBackupsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + memorystore.ListBackupsRequest(), + {}, + ], +) +async def test_list_backups_async(request_type, transport: str = "grpc_asyncio"): client = MemorystoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5406,7 +5444,7 @@ async def test_list_backups_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_backups), "__call__") as call: @@ -5431,11 +5469,6 @@ async def test_list_backups_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_backups_async_from_dict(): - await test_list_backups_async(request_type=dict) - - def test_list_backups_field_headers(): client = MemorystoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5772,8 +5805,8 @@ async def test_list_backups_async_pages(): @pytest.mark.parametrize( "request_type", [ - memorystore.GetBackupRequest, - dict, + memorystore.GetBackupRequest(), + {}, ], ) def test_get_backup(request_type, transport: str = "grpc"): @@ -5784,7 +5817,7 @@ def test_get_backup(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_backup), "__call__") as call: @@ -5848,9 +5881,10 @@ def test_get_backup_non_empty_request_with_auto_populated_field(): client.get_backup(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == memorystore.GetBackupRequest( + request_msg = memorystore.GetBackupRequest( name="name_value", ) + assert args[0] == request_msg def test_get_backup_use_cached_wrapped_rpc(): @@ -5929,9 +5963,14 @@ async def test_get_backup_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_backup_async( - transport: str = "grpc_asyncio", request_type=memorystore.GetBackupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + memorystore.GetBackupRequest(), + {}, + ], +) +async def test_get_backup_async(request_type, transport: str = "grpc_asyncio"): client = MemorystoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5939,7 +5978,7 @@ async def test_get_backup_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_backup), "__call__") as call: @@ -5982,11 +6021,6 @@ async def test_get_backup_async( assert response.uid == "uid_value" -@pytest.mark.asyncio -async def test_get_backup_async_from_dict(): - await test_get_backup_async(request_type=dict) - - def test_get_backup_field_headers(): client = MemorystoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6129,8 +6163,8 @@ async def test_get_backup_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - memorystore.DeleteBackupRequest, - dict, + memorystore.DeleteBackupRequest(), + {}, ], ) def test_delete_backup(request_type, transport: str = "grpc"): @@ -6141,7 +6175,7 @@ def test_delete_backup(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_backup), "__call__") as call: @@ -6182,9 +6216,10 @@ def test_delete_backup_non_empty_request_with_auto_populated_field(): client.delete_backup(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == memorystore.DeleteBackupRequest( + request_msg = memorystore.DeleteBackupRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_backup_use_cached_wrapped_rpc(): @@ -6275,9 +6310,14 @@ async def test_delete_backup_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_backup_async( - transport: str = "grpc_asyncio", request_type=memorystore.DeleteBackupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + memorystore.DeleteBackupRequest(), + {}, + ], +) +async def test_delete_backup_async(request_type, transport: str = "grpc_asyncio"): client = MemorystoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6285,7 +6325,7 @@ async def test_delete_backup_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_backup), "__call__") as call: @@ -6305,11 +6345,6 @@ async def test_delete_backup_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_backup_async_from_dict(): - await test_delete_backup_async(request_type=dict) - - def test_delete_backup_field_headers(): client = MemorystoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6456,8 +6491,8 @@ async def test_delete_backup_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - memorystore.ExportBackupRequest, - dict, + memorystore.ExportBackupRequest(), + {}, ], ) def test_export_backup(request_type, transport: str = "grpc"): @@ -6468,7 +6503,7 @@ def test_export_backup(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.export_backup), "__call__") as call: @@ -6510,10 +6545,11 @@ def test_export_backup_non_empty_request_with_auto_populated_field(): client.export_backup(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == memorystore.ExportBackupRequest( + request_msg = memorystore.ExportBackupRequest( gcs_bucket="gcs_bucket_value", name="name_value", ) + assert args[0] == request_msg def test_export_backup_use_cached_wrapped_rpc(): @@ -6604,9 +6640,14 @@ async def test_export_backup_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_export_backup_async( - transport: str = "grpc_asyncio", request_type=memorystore.ExportBackupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + memorystore.ExportBackupRequest(), + {}, + ], +) +async def test_export_backup_async(request_type, transport: str = "grpc_asyncio"): client = MemorystoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6614,7 +6655,7 @@ async def test_export_backup_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.export_backup), "__call__") as call: @@ -6634,11 +6675,6 @@ async def test_export_backup_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_export_backup_async_from_dict(): - await test_export_backup_async(request_type=dict) - - def test_export_backup_field_headers(): client = MemorystoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6703,8 +6739,8 @@ async def test_export_backup_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - memorystore.BackupInstanceRequest, - dict, + memorystore.BackupInstanceRequest(), + {}, ], ) def test_backup_instance(request_type, transport: str = "grpc"): @@ -6715,7 +6751,7 @@ def test_backup_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(type(client.transport.backup_instance), "__call__") as call: @@ -6757,10 +6793,11 @@ def test_backup_instance_non_empty_request_with_auto_populated_field(): client.backup_instance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == memorystore.BackupInstanceRequest( + request_msg = memorystore.BackupInstanceRequest( name="name_value", backup_id="backup_id_value", ) + assert args[0] == request_msg def test_backup_instance_use_cached_wrapped_rpc(): @@ -6851,9 +6888,14 @@ async def test_backup_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_backup_instance_async( - transport: str = "grpc_asyncio", request_type=memorystore.BackupInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + memorystore.BackupInstanceRequest(), + {}, + ], +) +async def test_backup_instance_async(request_type, transport: str = "grpc_asyncio"): client = MemorystoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6861,7 +6903,7 @@ async def test_backup_instance_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.backup_instance), "__call__") as call: @@ -6881,11 +6923,6 @@ async def test_backup_instance_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_backup_instance_async_from_dict(): - await test_backup_instance_async(request_type=dict) - - def test_backup_instance_field_headers(): client = MemorystoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10123,7 +10160,6 @@ def test_list_instances_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = memorystore.ListInstancesRequest() - assert args[0] == request_msg @@ -10144,7 +10180,6 @@ def test_get_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = memorystore.GetInstanceRequest() - assert args[0] == request_msg @@ -10165,7 +10200,6 @@ def test_create_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = memorystore.CreateInstanceRequest() - assert args[0] == request_msg @@ -10186,7 +10220,6 @@ def test_update_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = memorystore.UpdateInstanceRequest() - assert args[0] == request_msg @@ -10207,7 +10240,6 @@ def test_delete_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = memorystore.DeleteInstanceRequest() - assert args[0] == request_msg @@ -10230,7 +10262,6 @@ def test_get_certificate_authority_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = memorystore.GetCertificateAuthorityRequest() - assert args[0] == request_msg @@ -10253,7 +10284,6 @@ def test_get_shared_regional_certificate_authority_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = memorystore.GetSharedRegionalCertificateAuthorityRequest() - assert args[0] == request_msg @@ -10276,7 +10306,6 @@ def test_reschedule_maintenance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = memorystore.RescheduleMaintenanceRequest() - assert args[0] == request_msg @@ -10299,7 +10328,6 @@ def test_list_backup_collections_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = memorystore.ListBackupCollectionsRequest() - assert args[0] == request_msg @@ -10322,7 +10350,6 @@ def test_get_backup_collection_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = memorystore.GetBackupCollectionRequest() - assert args[0] == request_msg @@ -10343,7 +10370,6 @@ def test_list_backups_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = memorystore.ListBackupsRequest() - assert args[0] == request_msg @@ -10364,7 +10390,6 @@ def test_get_backup_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = memorystore.GetBackupRequest() - assert args[0] == request_msg @@ -10385,7 +10410,6 @@ def test_delete_backup_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = memorystore.DeleteBackupRequest() - assert args[0] == request_msg @@ -10406,7 +10430,6 @@ def test_export_backup_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = memorystore.ExportBackupRequest() - assert args[0] == request_msg @@ -10427,7 +10450,6 @@ def test_backup_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = memorystore.BackupInstanceRequest() - assert args[0] == request_msg @@ -10469,7 +10491,6 @@ async def test_list_instances_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = memorystore.ListInstancesRequest() - assert args[0] == request_msg @@ -10520,7 +10541,6 @@ async def test_get_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = memorystore.GetInstanceRequest() - assert args[0] == request_msg @@ -10545,7 +10565,6 @@ async def test_create_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = memorystore.CreateInstanceRequest() - assert args[0] == request_msg @@ -10570,7 +10589,6 @@ async def test_update_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = memorystore.UpdateInstanceRequest() - assert args[0] == request_msg @@ -10595,7 +10613,6 @@ async def test_delete_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = memorystore.DeleteInstanceRequest() - assert args[0] == request_msg @@ -10624,7 +10641,6 @@ async def test_get_certificate_authority_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = memorystore.GetCertificateAuthorityRequest() - assert args[0] == request_msg @@ -10653,7 +10669,6 @@ async def test_get_shared_regional_certificate_authority_empty_call_grpc_asyncio call.assert_called() _, args, _ = call.mock_calls[0] request_msg = memorystore.GetSharedRegionalCertificateAuthorityRequest() - assert args[0] == request_msg @@ -10680,7 +10695,6 @@ async def test_reschedule_maintenance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = memorystore.RescheduleMaintenanceRequest() - assert args[0] == request_msg @@ -10710,7 +10724,6 @@ async def test_list_backup_collections_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = memorystore.ListBackupCollectionsRequest() - assert args[0] == request_msg @@ -10745,7 +10758,6 @@ async def test_get_backup_collection_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = memorystore.GetBackupCollectionRequest() - assert args[0] == request_msg @@ -10773,7 +10785,6 @@ async def test_list_backups_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = memorystore.ListBackupsRequest() - assert args[0] == request_msg @@ -10810,7 +10821,6 @@ async def test_get_backup_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = memorystore.GetBackupRequest() - assert args[0] == request_msg @@ -10835,7 +10845,6 @@ async def test_delete_backup_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = memorystore.DeleteBackupRequest() - assert args[0] == request_msg @@ -10860,7 +10869,6 @@ async def test_export_backup_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = memorystore.ExportBackupRequest() - assert args[0] == request_msg @@ -10885,7 +10893,6 @@ async def test_backup_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = memorystore.BackupInstanceRequest() - assert args[0] == request_msg @@ -13724,7 +13731,6 @@ def test_list_instances_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = memorystore.ListInstancesRequest() - assert args[0] == request_msg @@ -13744,7 +13750,6 @@ def test_get_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = memorystore.GetInstanceRequest() - assert args[0] == request_msg @@ -13764,7 +13769,6 @@ def test_create_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = memorystore.CreateInstanceRequest() - assert args[0] == request_msg @@ -13784,7 +13788,6 @@ def test_update_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = memorystore.UpdateInstanceRequest() - assert args[0] == request_msg @@ -13804,7 +13807,6 @@ def test_delete_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = memorystore.DeleteInstanceRequest() - assert args[0] == request_msg @@ -13826,7 +13828,6 @@ def test_get_certificate_authority_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = memorystore.GetCertificateAuthorityRequest() - assert args[0] == request_msg @@ -13848,7 +13849,6 @@ def test_get_shared_regional_certificate_authority_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = memorystore.GetSharedRegionalCertificateAuthorityRequest() - assert args[0] == request_msg @@ -13870,7 +13870,6 @@ def test_reschedule_maintenance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = memorystore.RescheduleMaintenanceRequest() - assert args[0] == request_msg @@ -13892,7 +13891,6 @@ def test_list_backup_collections_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = memorystore.ListBackupCollectionsRequest() - assert args[0] == request_msg @@ -13914,7 +13912,6 @@ def test_get_backup_collection_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = memorystore.GetBackupCollectionRequest() - assert args[0] == request_msg @@ -13934,7 +13931,6 @@ def test_list_backups_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = memorystore.ListBackupsRequest() - assert args[0] == request_msg @@ -13954,7 +13950,6 @@ def test_get_backup_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = memorystore.GetBackupRequest() - assert args[0] == request_msg @@ -13974,7 +13969,6 @@ def test_delete_backup_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = memorystore.DeleteBackupRequest() - assert args[0] == request_msg @@ -13994,7 +13988,6 @@ def test_export_backup_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = memorystore.ExportBackupRequest() - assert args[0] == request_msg @@ -14014,7 +14007,6 @@ def test_backup_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = memorystore.BackupInstanceRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-memorystore/tests/unit/gapic/memorystore_v1beta/test_memorystore.py b/packages/google-cloud-memorystore/tests/unit/gapic/memorystore_v1beta/test_memorystore.py index 0f6c4cda01f6..03c35c358cd3 100644 --- a/packages/google-cloud-memorystore/tests/unit/gapic/memorystore_v1beta/test_memorystore.py +++ b/packages/google-cloud-memorystore/tests/unit/gapic/memorystore_v1beta/test_memorystore.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 @@ -116,6 +117,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" @@ -1281,8 +1297,8 @@ def test_memorystore_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - memorystore.ListInstancesRequest, - dict, + memorystore.ListInstancesRequest(), + {}, ], ) def test_list_instances(request_type, transport: str = "grpc"): @@ -1293,7 +1309,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(type(client.transport.list_instances), "__call__") as call: @@ -1342,12 +1358,13 @@ 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] == memorystore.ListInstancesRequest( + request_msg = memorystore.ListInstancesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_instances_use_cached_wrapped_rpc(): @@ -1428,9 +1445,14 @@ async def test_list_instances_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_instances_async( - transport: str = "grpc_asyncio", request_type=memorystore.ListInstancesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + memorystore.ListInstancesRequest(), + {}, + ], +) +async def test_list_instances_async(request_type, transport: str = "grpc_asyncio"): client = MemorystoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1438,7 +1460,7 @@ async def test_list_instances_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_instances), "__call__") as call: @@ -1463,11 +1485,6 @@ async def test_list_instances_async( 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 = MemorystoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1804,8 +1821,8 @@ async def test_list_instances_async_pages(): @pytest.mark.parametrize( "request_type", [ - memorystore.GetInstanceRequest, - dict, + memorystore.GetInstanceRequest(), + {}, ], ) def test_get_instance(request_type, transport: str = "grpc"): @@ -1816,7 +1833,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(type(client.transport.get_instance), "__call__") as call: @@ -1895,9 +1912,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] == memorystore.GetInstanceRequest( + request_msg = memorystore.GetInstanceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_instance_use_cached_wrapped_rpc(): @@ -1978,9 +1996,14 @@ async def test_get_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_instance_async( - transport: str = "grpc_asyncio", request_type=memorystore.GetInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + memorystore.GetInstanceRequest(), + {}, + ], +) +async def test_get_instance_async(request_type, transport: str = "grpc_asyncio"): client = MemorystoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1988,7 +2011,7 @@ async def test_get_instance_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_instance), "__call__") as call: @@ -2046,11 +2069,6 @@ async def test_get_instance_async( assert response.rotate_server_certificate is True -@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 = MemorystoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2197,8 +2215,8 @@ async def test_get_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - memorystore.CreateInstanceRequest, - dict, + memorystore.CreateInstanceRequest(), + {}, ], ) def test_create_instance(request_type, transport: str = "grpc"): @@ -2209,7 +2227,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(type(client.transport.create_instance), "__call__") as call: @@ -2251,10 +2269,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] == memorystore.CreateInstanceRequest( + request_msg = memorystore.CreateInstanceRequest( parent="parent_value", instance_id="instance_id_value", ) + assert args[0] == request_msg def test_create_instance_use_cached_wrapped_rpc(): @@ -2345,9 +2364,14 @@ async def test_create_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_instance_async( - transport: str = "grpc_asyncio", request_type=memorystore.CreateInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + memorystore.CreateInstanceRequest(), + {}, + ], +) +async def test_create_instance_async(request_type, transport: str = "grpc_asyncio"): client = MemorystoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2355,7 +2379,7 @@ async def test_create_instance_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_instance), "__call__") as call: @@ -2375,11 +2399,6 @@ async def test_create_instance_async( 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 = MemorystoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2546,8 +2565,8 @@ async def test_create_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - memorystore.UpdateInstanceRequest, - dict, + memorystore.UpdateInstanceRequest(), + {}, ], ) def test_update_instance(request_type, transport: str = "grpc"): @@ -2558,7 +2577,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(type(client.transport.update_instance), "__call__") as call: @@ -2597,7 +2616,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] - assert args[0] == memorystore.UpdateInstanceRequest() + request_msg = memorystore.UpdateInstanceRequest() + assert args[0] == request_msg def test_update_instance_use_cached_wrapped_rpc(): @@ -2688,9 +2708,14 @@ async def test_update_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_instance_async( - transport: str = "grpc_asyncio", request_type=memorystore.UpdateInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + memorystore.UpdateInstanceRequest(), + {}, + ], +) +async def test_update_instance_async(request_type, transport: str = "grpc_asyncio"): client = MemorystoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2698,7 +2723,7 @@ async def test_update_instance_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_instance), "__call__") as call: @@ -2718,11 +2743,6 @@ async def test_update_instance_async( 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 = MemorystoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2879,8 +2899,8 @@ async def test_update_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - memorystore.DeleteInstanceRequest, - dict, + memorystore.DeleteInstanceRequest(), + {}, ], ) def test_delete_instance(request_type, transport: str = "grpc"): @@ -2891,7 +2911,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(type(client.transport.delete_instance), "__call__") as call: @@ -2932,9 +2952,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] == memorystore.DeleteInstanceRequest( + request_msg = memorystore.DeleteInstanceRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_instance_use_cached_wrapped_rpc(): @@ -3025,9 +3046,14 @@ async def test_delete_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_instance_async( - transport: str = "grpc_asyncio", request_type=memorystore.DeleteInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + memorystore.DeleteInstanceRequest(), + {}, + ], +) +async def test_delete_instance_async(request_type, transport: str = "grpc_asyncio"): client = MemorystoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3035,7 +3061,7 @@ async def test_delete_instance_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_instance), "__call__") as call: @@ -3055,11 +3081,6 @@ async def test_delete_instance_async( 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 = MemorystoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3206,8 +3227,8 @@ async def test_delete_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - memorystore.GetCertificateAuthorityRequest, - dict, + memorystore.GetCertificateAuthorityRequest(), + {}, ], ) def test_get_certificate_authority(request_type, transport: str = "grpc"): @@ -3218,7 +3239,7 @@ def test_get_certificate_authority(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3266,9 +3287,10 @@ def test_get_certificate_authority_non_empty_request_with_auto_populated_field() client.get_certificate_authority(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == memorystore.GetCertificateAuthorityRequest( + request_msg = memorystore.GetCertificateAuthorityRequest( name="name_value", ) + assert args[0] == request_msg def test_get_certificate_authority_use_cached_wrapped_rpc(): @@ -3354,9 +3376,15 @@ async def test_get_certificate_authority_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + memorystore.GetCertificateAuthorityRequest(), + {}, + ], +) async def test_get_certificate_authority_async( - transport: str = "grpc_asyncio", - request_type=memorystore.GetCertificateAuthorityRequest, + request_type, transport: str = "grpc_asyncio" ): client = MemorystoreAsyncClient( credentials=async_anonymous_credentials(), @@ -3365,7 +3393,7 @@ async def test_get_certificate_authority_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( @@ -3390,11 +3418,6 @@ async def test_get_certificate_authority_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_certificate_authority_async_from_dict(): - await test_get_certificate_authority_async(request_type=dict) - - def test_get_certificate_authority_field_headers(): client = MemorystoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3549,8 +3572,8 @@ async def test_get_certificate_authority_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - memorystore.GetSharedRegionalCertificateAuthorityRequest, - dict, + memorystore.GetSharedRegionalCertificateAuthorityRequest(), + {}, ], ) def test_get_shared_regional_certificate_authority( @@ -3563,7 +3586,7 @@ def test_get_shared_regional_certificate_authority( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3611,9 +3634,10 @@ def test_get_shared_regional_certificate_authority_non_empty_request_with_auto_p client.get_shared_regional_certificate_authority(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == memorystore.GetSharedRegionalCertificateAuthorityRequest( + request_msg = memorystore.GetSharedRegionalCertificateAuthorityRequest( name="name_value", ) + assert args[0] == request_msg def test_get_shared_regional_certificate_authority_use_cached_wrapped_rpc(): @@ -3699,9 +3723,15 @@ async def test_get_shared_regional_certificate_authority_async_use_cached_wrappe @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + memorystore.GetSharedRegionalCertificateAuthorityRequest(), + {}, + ], +) async def test_get_shared_regional_certificate_authority_async( - transport: str = "grpc_asyncio", - request_type=memorystore.GetSharedRegionalCertificateAuthorityRequest, + request_type, transport: str = "grpc_asyncio" ): client = MemorystoreAsyncClient( credentials=async_anonymous_credentials(), @@ -3710,7 +3740,7 @@ async def test_get_shared_regional_certificate_authority_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( @@ -3735,11 +3765,6 @@ async def test_get_shared_regional_certificate_authority_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_shared_regional_certificate_authority_async_from_dict(): - await test_get_shared_regional_certificate_authority_async(request_type=dict) - - def test_get_shared_regional_certificate_authority_field_headers(): client = MemorystoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5421,7 +5446,6 @@ def test_list_instances_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = memorystore.ListInstancesRequest() - assert args[0] == request_msg @@ -5442,7 +5466,6 @@ def test_get_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = memorystore.GetInstanceRequest() - assert args[0] == request_msg @@ -5463,7 +5486,6 @@ def test_create_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = memorystore.CreateInstanceRequest() - assert args[0] == request_msg @@ -5484,7 +5506,6 @@ def test_update_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = memorystore.UpdateInstanceRequest() - assert args[0] == request_msg @@ -5505,7 +5526,6 @@ def test_delete_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = memorystore.DeleteInstanceRequest() - assert args[0] == request_msg @@ -5528,7 +5548,6 @@ def test_get_certificate_authority_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = memorystore.GetCertificateAuthorityRequest() - assert args[0] == request_msg @@ -5551,7 +5570,6 @@ def test_get_shared_regional_certificate_authority_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = memorystore.GetSharedRegionalCertificateAuthorityRequest() - assert args[0] == request_msg @@ -5593,7 +5611,6 @@ async def test_list_instances_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = memorystore.ListInstancesRequest() - assert args[0] == request_msg @@ -5633,7 +5650,6 @@ async def test_get_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = memorystore.GetInstanceRequest() - assert args[0] == request_msg @@ -5658,7 +5674,6 @@ async def test_create_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = memorystore.CreateInstanceRequest() - assert args[0] == request_msg @@ -5683,7 +5698,6 @@ async def test_update_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = memorystore.UpdateInstanceRequest() - assert args[0] == request_msg @@ -5708,7 +5722,6 @@ async def test_delete_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = memorystore.DeleteInstanceRequest() - assert args[0] == request_msg @@ -5737,7 +5750,6 @@ async def test_get_certificate_authority_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = memorystore.GetCertificateAuthorityRequest() - assert args[0] == request_msg @@ -5766,7 +5778,6 @@ async def test_get_shared_regional_certificate_authority_empty_call_grpc_asyncio call.assert_called() _, args, _ = call.mock_calls[0] request_msg = memorystore.GetSharedRegionalCertificateAuthorityRequest() - assert args[0] == request_msg @@ -7385,7 +7396,6 @@ def test_list_instances_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = memorystore.ListInstancesRequest() - assert args[0] == request_msg @@ -7405,7 +7415,6 @@ def test_get_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = memorystore.GetInstanceRequest() - assert args[0] == request_msg @@ -7425,7 +7434,6 @@ def test_create_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = memorystore.CreateInstanceRequest() - assert args[0] == request_msg @@ -7445,7 +7453,6 @@ def test_update_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = memorystore.UpdateInstanceRequest() - assert args[0] == request_msg @@ -7465,7 +7472,6 @@ def test_delete_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = memorystore.DeleteInstanceRequest() - assert args[0] == request_msg @@ -7487,7 +7493,6 @@ def test_get_certificate_authority_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = memorystore.GetCertificateAuthorityRequest() - assert args[0] == request_msg @@ -7509,7 +7514,6 @@ def test_get_shared_regional_certificate_authority_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = memorystore.GetSharedRegionalCertificateAuthorityRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-migrationcenter/noxfile.py b/packages/google-cloud-migrationcenter/noxfile.py index 2833ec7a7298..24d0f586240d 100644 --- a/packages/google-cloud-migrationcenter/noxfile.py +++ b/packages/google-cloud-migrationcenter/noxfile.py @@ -47,7 +47,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-migrationcenter" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-migrationcenter/setup.py b/packages/google-cloud-migrationcenter/setup.py index 65f05cce7a30..e86879e9c131 100644 --- a/packages/google-cloud-migrationcenter/setup.py +++ b/packages/google-cloud-migrationcenter/setup.py @@ -45,7 +45,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/google-cloud-migrationcenter/testing/constraints-3.10.txt b/packages/google-cloud-migrationcenter/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-migrationcenter/testing/constraints-3.10.txt +++ b/packages/google-cloud-migrationcenter/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-migrationcenter/tests/unit/gapic/migrationcenter_v1/test_migration_center.py b/packages/google-cloud-migrationcenter/tests/unit/gapic/migrationcenter_v1/test_migration_center.py index ecbf6d037bce..9035f0136f9a 100644 --- a/packages/google-cloud-migrationcenter/tests/unit/gapic/migrationcenter_v1/test_migration_center.py +++ b/packages/google-cloud-migrationcenter/tests/unit/gapic/migrationcenter_v1/test_migration_center.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 @@ -118,6 +119,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" @@ -1345,8 +1361,8 @@ def test_migration_center_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - migrationcenter.ListAssetsRequest, - dict, + migrationcenter.ListAssetsRequest(), + {}, ], ) def test_list_assets(request_type, transport: str = "grpc"): @@ -1357,7 +1373,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(type(client.transport.list_assets), "__call__") as call: @@ -1406,12 +1422,13 @@ 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] == migrationcenter.ListAssetsRequest( + request_msg = migrationcenter.ListAssetsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_assets_use_cached_wrapped_rpc(): @@ -1492,9 +1509,14 @@ async def test_list_assets_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_assets_async( - transport: str = "grpc_asyncio", request_type=migrationcenter.ListAssetsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + migrationcenter.ListAssetsRequest(), + {}, + ], +) +async def test_list_assets_async(request_type, transport: str = "grpc_asyncio"): client = MigrationCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1502,7 +1524,7 @@ async def test_list_assets_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_assets), "__call__") as call: @@ -1527,11 +1549,6 @@ async def test_list_assets_async( assert response.unreachable == ["unreachable_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 = MigrationCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1868,8 +1885,8 @@ async def test_list_assets_async_pages(): @pytest.mark.parametrize( "request_type", [ - migrationcenter.GetAssetRequest, - dict, + migrationcenter.GetAssetRequest(), + {}, ], ) def test_get_asset(request_type, transport: str = "grpc"): @@ -1880,7 +1897,7 @@ def test_get_asset(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_asset), "__call__") as call: @@ -1928,9 +1945,10 @@ def test_get_asset_non_empty_request_with_auto_populated_field(): client.get_asset(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == migrationcenter.GetAssetRequest( + request_msg = migrationcenter.GetAssetRequest( name="name_value", ) + assert args[0] == request_msg def test_get_asset_use_cached_wrapped_rpc(): @@ -2009,9 +2027,14 @@ async def test_get_asset_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_asset_async( - transport: str = "grpc_asyncio", request_type=migrationcenter.GetAssetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + migrationcenter.GetAssetRequest(), + {}, + ], +) +async def test_get_asset_async(request_type, transport: str = "grpc_asyncio"): client = MigrationCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2019,7 +2042,7 @@ async def test_get_asset_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_asset), "__call__") as call: @@ -2046,11 +2069,6 @@ async def test_get_asset_async( assert response.assigned_groups == ["assigned_groups_value"] -@pytest.mark.asyncio -async def test_get_asset_async_from_dict(): - await test_get_asset_async(request_type=dict) - - def test_get_asset_field_headers(): client = MigrationCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2197,8 +2215,8 @@ async def test_get_asset_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - migrationcenter.UpdateAssetRequest, - dict, + migrationcenter.UpdateAssetRequest(), + {}, ], ) def test_update_asset(request_type, transport: str = "grpc"): @@ -2209,7 +2227,7 @@ def test_update_asset(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_asset), "__call__") as call: @@ -2257,9 +2275,10 @@ def test_update_asset_non_empty_request_with_auto_populated_field(): client.update_asset(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == migrationcenter.UpdateAssetRequest( + request_msg = migrationcenter.UpdateAssetRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_asset_use_cached_wrapped_rpc(): @@ -2340,9 +2359,14 @@ async def test_update_asset_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_asset_async( - transport: str = "grpc_asyncio", request_type=migrationcenter.UpdateAssetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + migrationcenter.UpdateAssetRequest(), + {}, + ], +) +async def test_update_asset_async(request_type, transport: str = "grpc_asyncio"): client = MigrationCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2350,7 +2374,7 @@ async def test_update_asset_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_asset), "__call__") as call: @@ -2377,11 +2401,6 @@ async def test_update_asset_async( assert response.assigned_groups == ["assigned_groups_value"] -@pytest.mark.asyncio -async def test_update_asset_async_from_dict(): - await test_update_asset_async(request_type=dict) - - def test_update_asset_field_headers(): client = MigrationCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2538,8 +2557,8 @@ async def test_update_asset_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - migrationcenter.BatchUpdateAssetsRequest, - dict, + migrationcenter.BatchUpdateAssetsRequest(), + {}, ], ) def test_batch_update_assets(request_type, transport: str = "grpc"): @@ -2550,7 +2569,7 @@ def test_batch_update_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( @@ -2595,9 +2614,10 @@ def test_batch_update_assets_non_empty_request_with_auto_populated_field(): client.batch_update_assets(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == migrationcenter.BatchUpdateAssetsRequest( + request_msg = migrationcenter.BatchUpdateAssetsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_batch_update_assets_use_cached_wrapped_rpc(): @@ -2682,10 +2702,14 @@ async def test_batch_update_assets_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_batch_update_assets_async( - transport: str = "grpc_asyncio", - request_type=migrationcenter.BatchUpdateAssetsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + migrationcenter.BatchUpdateAssetsRequest(), + {}, + ], +) +async def test_batch_update_assets_async(request_type, transport: str = "grpc_asyncio"): client = MigrationCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2693,7 +2717,7 @@ async def test_batch_update_assets_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( @@ -2715,11 +2739,6 @@ async def test_batch_update_assets_async( assert isinstance(response, migrationcenter.BatchUpdateAssetsResponse) -@pytest.mark.asyncio -async def test_batch_update_assets_async_from_dict(): - await test_batch_update_assets_async(request_type=dict) - - def test_batch_update_assets_field_headers(): client = MigrationCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2908,8 +2927,8 @@ async def test_batch_update_assets_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - migrationcenter.DeleteAssetRequest, - dict, + migrationcenter.DeleteAssetRequest(), + {}, ], ) def test_delete_asset(request_type, transport: str = "grpc"): @@ -2920,7 +2939,7 @@ def test_delete_asset(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_asset), "__call__") as call: @@ -2962,10 +2981,11 @@ def test_delete_asset_non_empty_request_with_auto_populated_field(): client.delete_asset(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == migrationcenter.DeleteAssetRequest( + request_msg = migrationcenter.DeleteAssetRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_asset_use_cached_wrapped_rpc(): @@ -3046,9 +3066,14 @@ async def test_delete_asset_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_asset_async( - transport: str = "grpc_asyncio", request_type=migrationcenter.DeleteAssetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + migrationcenter.DeleteAssetRequest(), + {}, + ], +) +async def test_delete_asset_async(request_type, transport: str = "grpc_asyncio"): client = MigrationCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3056,7 +3081,7 @@ async def test_delete_asset_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_asset), "__call__") as call: @@ -3074,11 +3099,6 @@ async def test_delete_asset_async( assert response is None -@pytest.mark.asyncio -async def test_delete_asset_async_from_dict(): - await test_delete_asset_async(request_type=dict) - - def test_delete_asset_field_headers(): client = MigrationCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3221,8 +3241,8 @@ async def test_delete_asset_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - migrationcenter.BatchDeleteAssetsRequest, - dict, + migrationcenter.BatchDeleteAssetsRequest(), + {}, ], ) def test_batch_delete_assets(request_type, transport: str = "grpc"): @@ -3233,7 +3253,7 @@ def test_batch_delete_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( @@ -3278,9 +3298,10 @@ def test_batch_delete_assets_non_empty_request_with_auto_populated_field(): client.batch_delete_assets(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == migrationcenter.BatchDeleteAssetsRequest( + request_msg = migrationcenter.BatchDeleteAssetsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_batch_delete_assets_use_cached_wrapped_rpc(): @@ -3365,10 +3386,14 @@ async def test_batch_delete_assets_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_batch_delete_assets_async( - transport: str = "grpc_asyncio", - request_type=migrationcenter.BatchDeleteAssetsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + migrationcenter.BatchDeleteAssetsRequest(), + {}, + ], +) +async def test_batch_delete_assets_async(request_type, transport: str = "grpc_asyncio"): client = MigrationCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3376,7 +3401,7 @@ async def test_batch_delete_assets_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( @@ -3396,11 +3421,6 @@ async def test_batch_delete_assets_async( assert response is None -@pytest.mark.asyncio -async def test_batch_delete_assets_async_from_dict(): - await test_batch_delete_assets_async(request_type=dict) - - def test_batch_delete_assets_field_headers(): client = MigrationCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3561,8 +3581,8 @@ async def test_batch_delete_assets_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - migrationcenter.ReportAssetFramesRequest, - dict, + migrationcenter.ReportAssetFramesRequest(), + {}, ], ) def test_report_asset_frames(request_type, transport: str = "grpc"): @@ -3573,7 +3593,7 @@ def test_report_asset_frames(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3619,10 +3639,11 @@ def test_report_asset_frames_non_empty_request_with_auto_populated_field(): client.report_asset_frames(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == migrationcenter.ReportAssetFramesRequest( + request_msg = migrationcenter.ReportAssetFramesRequest( parent="parent_value", source="source_value", ) + assert args[0] == request_msg def test_report_asset_frames_use_cached_wrapped_rpc(): @@ -3707,10 +3728,14 @@ async def test_report_asset_frames_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_report_asset_frames_async( - transport: str = "grpc_asyncio", - request_type=migrationcenter.ReportAssetFramesRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + migrationcenter.ReportAssetFramesRequest(), + {}, + ], +) +async def test_report_asset_frames_async(request_type, transport: str = "grpc_asyncio"): client = MigrationCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3718,7 +3743,7 @@ async def test_report_asset_frames_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( @@ -3740,11 +3765,6 @@ async def test_report_asset_frames_async( assert isinstance(response, migrationcenter.ReportAssetFramesResponse) -@pytest.mark.asyncio -async def test_report_asset_frames_async_from_dict(): - await test_report_asset_frames_async(request_type=dict) - - def test_report_asset_frames_field_headers(): client = MigrationCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3813,8 +3833,8 @@ async def test_report_asset_frames_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - migrationcenter.AggregateAssetsValuesRequest, - dict, + migrationcenter.AggregateAssetsValuesRequest(), + {}, ], ) def test_aggregate_assets_values(request_type, transport: str = "grpc"): @@ -3825,7 +3845,7 @@ def test_aggregate_assets_values(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3871,10 +3891,11 @@ def test_aggregate_assets_values_non_empty_request_with_auto_populated_field(): client.aggregate_assets_values(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == migrationcenter.AggregateAssetsValuesRequest( + request_msg = migrationcenter.AggregateAssetsValuesRequest( parent="parent_value", filter="filter_value", ) + assert args[0] == request_msg def test_aggregate_assets_values_use_cached_wrapped_rpc(): @@ -3960,9 +3981,15 @@ async def test_aggregate_assets_values_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + migrationcenter.AggregateAssetsValuesRequest(), + {}, + ], +) async def test_aggregate_assets_values_async( - transport: str = "grpc_asyncio", - request_type=migrationcenter.AggregateAssetsValuesRequest, + request_type, transport: str = "grpc_asyncio" ): client = MigrationCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -3971,7 +3998,7 @@ async def test_aggregate_assets_values_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( @@ -3993,11 +4020,6 @@ async def test_aggregate_assets_values_async( assert isinstance(response, migrationcenter.AggregateAssetsValuesResponse) -@pytest.mark.asyncio -async def test_aggregate_assets_values_async_from_dict(): - await test_aggregate_assets_values_async(request_type=dict) - - def test_aggregate_assets_values_field_headers(): client = MigrationCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4066,8 +4088,8 @@ async def test_aggregate_assets_values_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - migrationcenter.CreateImportJobRequest, - dict, + migrationcenter.CreateImportJobRequest(), + {}, ], ) def test_create_import_job(request_type, transport: str = "grpc"): @@ -4078,7 +4100,7 @@ def test_create_import_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( @@ -4125,11 +4147,12 @@ def test_create_import_job_non_empty_request_with_auto_populated_field(): client.create_import_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == migrationcenter.CreateImportJobRequest( + request_msg = migrationcenter.CreateImportJobRequest( parent="parent_value", import_job_id="import_job_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_import_job_use_cached_wrapped_rpc(): @@ -4222,9 +4245,14 @@ async def test_create_import_job_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_import_job_async( - transport: str = "grpc_asyncio", request_type=migrationcenter.CreateImportJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + migrationcenter.CreateImportJobRequest(), + {}, + ], +) +async def test_create_import_job_async(request_type, transport: str = "grpc_asyncio"): client = MigrationCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4232,7 +4260,7 @@ async def test_create_import_job_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( @@ -4254,11 +4282,6 @@ async def test_create_import_job_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_import_job_async_from_dict(): - await test_create_import_job_async(request_type=dict) - - def test_create_import_job_field_headers(): client = MigrationCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4433,8 +4456,8 @@ async def test_create_import_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - migrationcenter.ListImportJobsRequest, - dict, + migrationcenter.ListImportJobsRequest(), + {}, ], ) def test_list_import_jobs(request_type, transport: str = "grpc"): @@ -4445,7 +4468,7 @@ def test_list_import_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(type(client.transport.list_import_jobs), "__call__") as call: @@ -4494,12 +4517,13 @@ def test_list_import_jobs_non_empty_request_with_auto_populated_field(): client.list_import_jobs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == migrationcenter.ListImportJobsRequest( + request_msg = migrationcenter.ListImportJobsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_import_jobs_use_cached_wrapped_rpc(): @@ -4582,9 +4606,14 @@ async def test_list_import_jobs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_import_jobs_async( - transport: str = "grpc_asyncio", request_type=migrationcenter.ListImportJobsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + migrationcenter.ListImportJobsRequest(), + {}, + ], +) +async def test_list_import_jobs_async(request_type, transport: str = "grpc_asyncio"): client = MigrationCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4592,7 +4621,7 @@ async def test_list_import_jobs_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_import_jobs), "__call__") as call: @@ -4617,11 +4646,6 @@ async def test_list_import_jobs_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_import_jobs_async_from_dict(): - await test_list_import_jobs_async(request_type=dict) - - def test_list_import_jobs_field_headers(): client = MigrationCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4958,8 +4982,8 @@ async def test_list_import_jobs_async_pages(): @pytest.mark.parametrize( "request_type", [ - migrationcenter.GetImportJobRequest, - dict, + migrationcenter.GetImportJobRequest(), + {}, ], ) def test_get_import_job(request_type, transport: str = "grpc"): @@ -4970,7 +4994,7 @@ def test_get_import_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(type(client.transport.get_import_job), "__call__") as call: @@ -5023,9 +5047,10 @@ def test_get_import_job_non_empty_request_with_auto_populated_field(): client.get_import_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == migrationcenter.GetImportJobRequest( + request_msg = migrationcenter.GetImportJobRequest( name="name_value", ) + assert args[0] == request_msg def test_get_import_job_use_cached_wrapped_rpc(): @@ -5106,9 +5131,14 @@ async def test_get_import_job_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_import_job_async( - transport: str = "grpc_asyncio", request_type=migrationcenter.GetImportJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + migrationcenter.GetImportJobRequest(), + {}, + ], +) +async def test_get_import_job_async(request_type, transport: str = "grpc_asyncio"): client = MigrationCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5116,7 +5146,7 @@ async def test_get_import_job_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_import_job), "__call__") as call: @@ -5148,11 +5178,6 @@ async def test_get_import_job_async( assert response.asset_source == "asset_source_value" -@pytest.mark.asyncio -async def test_get_import_job_async_from_dict(): - await test_get_import_job_async(request_type=dict) - - def test_get_import_job_field_headers(): client = MigrationCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5299,8 +5324,8 @@ async def test_get_import_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - migrationcenter.DeleteImportJobRequest, - dict, + migrationcenter.DeleteImportJobRequest(), + {}, ], ) def test_delete_import_job(request_type, transport: str = "grpc"): @@ -5311,7 +5336,7 @@ def test_delete_import_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( @@ -5357,10 +5382,11 @@ def test_delete_import_job_non_empty_request_with_auto_populated_field(): client.delete_import_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == migrationcenter.DeleteImportJobRequest( + request_msg = migrationcenter.DeleteImportJobRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_import_job_use_cached_wrapped_rpc(): @@ -5453,9 +5479,14 @@ async def test_delete_import_job_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_import_job_async( - transport: str = "grpc_asyncio", request_type=migrationcenter.DeleteImportJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + migrationcenter.DeleteImportJobRequest(), + {}, + ], +) +async def test_delete_import_job_async(request_type, transport: str = "grpc_asyncio"): client = MigrationCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5463,7 +5494,7 @@ async def test_delete_import_job_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( @@ -5485,11 +5516,6 @@ async def test_delete_import_job_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_import_job_async_from_dict(): - await test_delete_import_job_async(request_type=dict) - - def test_delete_import_job_field_headers(): client = MigrationCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5644,8 +5670,8 @@ async def test_delete_import_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - migrationcenter.UpdateImportJobRequest, - dict, + migrationcenter.UpdateImportJobRequest(), + {}, ], ) def test_update_import_job(request_type, transport: str = "grpc"): @@ -5656,7 +5682,7 @@ def test_update_import_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( @@ -5701,9 +5727,10 @@ def test_update_import_job_non_empty_request_with_auto_populated_field(): client.update_import_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == migrationcenter.UpdateImportJobRequest( + request_msg = migrationcenter.UpdateImportJobRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_import_job_use_cached_wrapped_rpc(): @@ -5796,9 +5823,14 @@ async def test_update_import_job_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_import_job_async( - transport: str = "grpc_asyncio", request_type=migrationcenter.UpdateImportJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + migrationcenter.UpdateImportJobRequest(), + {}, + ], +) +async def test_update_import_job_async(request_type, transport: str = "grpc_asyncio"): client = MigrationCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5806,7 +5838,7 @@ async def test_update_import_job_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( @@ -5828,11 +5860,6 @@ async def test_update_import_job_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_import_job_async_from_dict(): - await test_update_import_job_async(request_type=dict) - - def test_update_import_job_field_headers(): client = MigrationCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5997,8 +6024,8 @@ async def test_update_import_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - migrationcenter.ValidateImportJobRequest, - dict, + migrationcenter.ValidateImportJobRequest(), + {}, ], ) def test_validate_import_job(request_type, transport: str = "grpc"): @@ -6009,7 +6036,7 @@ def test_validate_import_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( @@ -6055,10 +6082,11 @@ def test_validate_import_job_non_empty_request_with_auto_populated_field(): client.validate_import_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == migrationcenter.ValidateImportJobRequest( + request_msg = migrationcenter.ValidateImportJobRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_validate_import_job_use_cached_wrapped_rpc(): @@ -6153,10 +6181,14 @@ async def test_validate_import_job_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_validate_import_job_async( - transport: str = "grpc_asyncio", - request_type=migrationcenter.ValidateImportJobRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + migrationcenter.ValidateImportJobRequest(), + {}, + ], +) +async def test_validate_import_job_async(request_type, transport: str = "grpc_asyncio"): client = MigrationCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6164,7 +6196,7 @@ async def test_validate_import_job_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( @@ -6186,11 +6218,6 @@ async def test_validate_import_job_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_validate_import_job_async_from_dict(): - await test_validate_import_job_async(request_type=dict) - - def test_validate_import_job_field_headers(): client = MigrationCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6345,8 +6372,8 @@ async def test_validate_import_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - migrationcenter.RunImportJobRequest, - dict, + migrationcenter.RunImportJobRequest(), + {}, ], ) def test_run_import_job(request_type, transport: str = "grpc"): @@ -6357,7 +6384,7 @@ def test_run_import_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(type(client.transport.run_import_job), "__call__") as call: @@ -6399,10 +6426,11 @@ def test_run_import_job_non_empty_request_with_auto_populated_field(): client.run_import_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == migrationcenter.RunImportJobRequest( + request_msg = migrationcenter.RunImportJobRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_run_import_job_use_cached_wrapped_rpc(): @@ -6493,9 +6521,14 @@ async def test_run_import_job_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_run_import_job_async( - transport: str = "grpc_asyncio", request_type=migrationcenter.RunImportJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + migrationcenter.RunImportJobRequest(), + {}, + ], +) +async def test_run_import_job_async(request_type, transport: str = "grpc_asyncio"): client = MigrationCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6503,7 +6536,7 @@ async def test_run_import_job_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.run_import_job), "__call__") as call: @@ -6523,11 +6556,6 @@ async def test_run_import_job_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_run_import_job_async_from_dict(): - await test_run_import_job_async(request_type=dict) - - def test_run_import_job_field_headers(): client = MigrationCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6674,8 +6702,8 @@ async def test_run_import_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - migrationcenter.GetImportDataFileRequest, - dict, + migrationcenter.GetImportDataFileRequest(), + {}, ], ) def test_get_import_data_file(request_type, transport: str = "grpc"): @@ -6686,7 +6714,7 @@ def test_get_import_data_file(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6743,9 +6771,10 @@ def test_get_import_data_file_non_empty_request_with_auto_populated_field(): client.get_import_data_file(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == migrationcenter.GetImportDataFileRequest( + request_msg = migrationcenter.GetImportDataFileRequest( name="name_value", ) + assert args[0] == request_msg def test_get_import_data_file_use_cached_wrapped_rpc(): @@ -6830,9 +6859,15 @@ async def test_get_import_data_file_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + migrationcenter.GetImportDataFileRequest(), + {}, + ], +) async def test_get_import_data_file_async( - transport: str = "grpc_asyncio", - request_type=migrationcenter.GetImportDataFileRequest, + request_type, transport: str = "grpc_asyncio" ): client = MigrationCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -6841,7 +6876,7 @@ async def test_get_import_data_file_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( @@ -6875,11 +6910,6 @@ async def test_get_import_data_file_async( assert response.state == migrationcenter.ImportDataFile.State.CREATING -@pytest.mark.asyncio -async def test_get_import_data_file_async_from_dict(): - await test_get_import_data_file_async(request_type=dict) - - def test_get_import_data_file_field_headers(): client = MigrationCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7034,8 +7064,8 @@ async def test_get_import_data_file_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - migrationcenter.ListImportDataFilesRequest, - dict, + migrationcenter.ListImportDataFilesRequest(), + {}, ], ) def test_list_import_data_files(request_type, transport: str = "grpc"): @@ -7046,7 +7076,7 @@ def test_list_import_data_files(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7099,12 +7129,13 @@ def test_list_import_data_files_non_empty_request_with_auto_populated_field(): client.list_import_data_files(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == migrationcenter.ListImportDataFilesRequest( + request_msg = migrationcenter.ListImportDataFilesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_import_data_files_use_cached_wrapped_rpc(): @@ -7190,9 +7221,15 @@ async def test_list_import_data_files_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + migrationcenter.ListImportDataFilesRequest(), + {}, + ], +) async def test_list_import_data_files_async( - transport: str = "grpc_asyncio", - request_type=migrationcenter.ListImportDataFilesRequest, + request_type, transport: str = "grpc_asyncio" ): client = MigrationCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -7201,7 +7238,7 @@ async def test_list_import_data_files_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( @@ -7228,11 +7265,6 @@ async def test_list_import_data_files_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_import_data_files_async_from_dict(): - await test_list_import_data_files_async(request_type=dict) - - def test_list_import_data_files_field_headers(): client = MigrationCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7585,8 +7617,8 @@ async def test_list_import_data_files_async_pages(): @pytest.mark.parametrize( "request_type", [ - migrationcenter.CreateImportDataFileRequest, - dict, + migrationcenter.CreateImportDataFileRequest(), + {}, ], ) def test_create_import_data_file(request_type, transport: str = "grpc"): @@ -7597,7 +7629,7 @@ def test_create_import_data_file(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7644,11 +7676,12 @@ def test_create_import_data_file_non_empty_request_with_auto_populated_field(): client.create_import_data_file(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == migrationcenter.CreateImportDataFileRequest( + request_msg = migrationcenter.CreateImportDataFileRequest( parent="parent_value", import_data_file_id="import_data_file_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_import_data_file_use_cached_wrapped_rpc(): @@ -7744,9 +7777,15 @@ async def test_create_import_data_file_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + migrationcenter.CreateImportDataFileRequest(), + {}, + ], +) async def test_create_import_data_file_async( - transport: str = "grpc_asyncio", - request_type=migrationcenter.CreateImportDataFileRequest, + request_type, transport: str = "grpc_asyncio" ): client = MigrationCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -7755,7 +7794,7 @@ async def test_create_import_data_file_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( @@ -7777,11 +7816,6 @@ async def test_create_import_data_file_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_import_data_file_async_from_dict(): - await test_create_import_data_file_async(request_type=dict) - - def test_create_import_data_file_field_headers(): client = MigrationCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7956,8 +7990,8 @@ async def test_create_import_data_file_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - migrationcenter.DeleteImportDataFileRequest, - dict, + migrationcenter.DeleteImportDataFileRequest(), + {}, ], ) def test_delete_import_data_file(request_type, transport: str = "grpc"): @@ -7968,7 +8002,7 @@ def test_delete_import_data_file(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8014,10 +8048,11 @@ def test_delete_import_data_file_non_empty_request_with_auto_populated_field(): client.delete_import_data_file(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == migrationcenter.DeleteImportDataFileRequest( + request_msg = migrationcenter.DeleteImportDataFileRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_import_data_file_use_cached_wrapped_rpc(): @@ -8113,9 +8148,15 @@ async def test_delete_import_data_file_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + migrationcenter.DeleteImportDataFileRequest(), + {}, + ], +) async def test_delete_import_data_file_async( - transport: str = "grpc_asyncio", - request_type=migrationcenter.DeleteImportDataFileRequest, + request_type, transport: str = "grpc_asyncio" ): client = MigrationCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -8124,7 +8165,7 @@ async def test_delete_import_data_file_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( @@ -8146,11 +8187,6 @@ async def test_delete_import_data_file_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_import_data_file_async_from_dict(): - await test_delete_import_data_file_async(request_type=dict) - - def test_delete_import_data_file_field_headers(): client = MigrationCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8305,8 +8341,8 @@ async def test_delete_import_data_file_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - migrationcenter.ListGroupsRequest, - dict, + migrationcenter.ListGroupsRequest(), + {}, ], ) def test_list_groups(request_type, transport: str = "grpc"): @@ -8317,7 +8353,7 @@ def test_list_groups(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_groups), "__call__") as call: @@ -8366,12 +8402,13 @@ def test_list_groups_non_empty_request_with_auto_populated_field(): client.list_groups(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == migrationcenter.ListGroupsRequest( + request_msg = migrationcenter.ListGroupsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_groups_use_cached_wrapped_rpc(): @@ -8452,9 +8489,14 @@ async def test_list_groups_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_groups_async( - transport: str = "grpc_asyncio", request_type=migrationcenter.ListGroupsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + migrationcenter.ListGroupsRequest(), + {}, + ], +) +async def test_list_groups_async(request_type, transport: str = "grpc_asyncio"): client = MigrationCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8462,7 +8504,7 @@ async def test_list_groups_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_groups), "__call__") as call: @@ -8487,11 +8529,6 @@ async def test_list_groups_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_groups_async_from_dict(): - await test_list_groups_async(request_type=dict) - - def test_list_groups_field_headers(): client = MigrationCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8828,8 +8865,8 @@ async def test_list_groups_async_pages(): @pytest.mark.parametrize( "request_type", [ - migrationcenter.GetGroupRequest, - dict, + migrationcenter.GetGroupRequest(), + {}, ], ) def test_get_group(request_type, transport: str = "grpc"): @@ -8840,7 +8877,7 @@ def test_get_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_group), "__call__") as call: @@ -8888,9 +8925,10 @@ def test_get_group_non_empty_request_with_auto_populated_field(): client.get_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == migrationcenter.GetGroupRequest( + request_msg = migrationcenter.GetGroupRequest( name="name_value", ) + assert args[0] == request_msg def test_get_group_use_cached_wrapped_rpc(): @@ -8969,9 +9007,14 @@ async def test_get_group_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_group_async( - transport: str = "grpc_asyncio", request_type=migrationcenter.GetGroupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + migrationcenter.GetGroupRequest(), + {}, + ], +) +async def test_get_group_async(request_type, transport: str = "grpc_asyncio"): client = MigrationCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8979,7 +9022,7 @@ async def test_get_group_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_group), "__call__") as call: @@ -9006,11 +9049,6 @@ async def test_get_group_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_get_group_async_from_dict(): - await test_get_group_async(request_type=dict) - - def test_get_group_field_headers(): client = MigrationCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9157,8 +9195,8 @@ async def test_get_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - migrationcenter.CreateGroupRequest, - dict, + migrationcenter.CreateGroupRequest(), + {}, ], ) def test_create_group(request_type, transport: str = "grpc"): @@ -9169,7 +9207,7 @@ def test_create_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_group), "__call__") as call: @@ -9212,11 +9250,12 @@ def test_create_group_non_empty_request_with_auto_populated_field(): client.create_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == migrationcenter.CreateGroupRequest( + request_msg = migrationcenter.CreateGroupRequest( parent="parent_value", group_id="group_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_group_use_cached_wrapped_rpc(): @@ -9307,9 +9346,14 @@ async def test_create_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_group_async( - transport: str = "grpc_asyncio", request_type=migrationcenter.CreateGroupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + migrationcenter.CreateGroupRequest(), + {}, + ], +) +async def test_create_group_async(request_type, transport: str = "grpc_asyncio"): client = MigrationCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9317,7 +9361,7 @@ async def test_create_group_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_group), "__call__") as call: @@ -9337,11 +9381,6 @@ async def test_create_group_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_group_async_from_dict(): - await test_create_group_async(request_type=dict) - - def test_create_group_field_headers(): client = MigrationCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9508,8 +9547,8 @@ async def test_create_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - migrationcenter.UpdateGroupRequest, - dict, + migrationcenter.UpdateGroupRequest(), + {}, ], ) def test_update_group(request_type, transport: str = "grpc"): @@ -9520,7 +9559,7 @@ def test_update_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_group), "__call__") as call: @@ -9561,9 +9600,10 @@ def test_update_group_non_empty_request_with_auto_populated_field(): client.update_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == migrationcenter.UpdateGroupRequest( + request_msg = migrationcenter.UpdateGroupRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_group_use_cached_wrapped_rpc(): @@ -9654,9 +9694,14 @@ async def test_update_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_group_async( - transport: str = "grpc_asyncio", request_type=migrationcenter.UpdateGroupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + migrationcenter.UpdateGroupRequest(), + {}, + ], +) +async def test_update_group_async(request_type, transport: str = "grpc_asyncio"): client = MigrationCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9664,7 +9709,7 @@ async def test_update_group_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_group), "__call__") as call: @@ -9684,11 +9729,6 @@ async def test_update_group_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_group_async_from_dict(): - await test_update_group_async(request_type=dict) - - def test_update_group_field_headers(): client = MigrationCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9845,8 +9885,8 @@ async def test_update_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - migrationcenter.DeleteGroupRequest, - dict, + migrationcenter.DeleteGroupRequest(), + {}, ], ) def test_delete_group(request_type, transport: str = "grpc"): @@ -9857,7 +9897,7 @@ def test_delete_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_group), "__call__") as call: @@ -9899,10 +9939,11 @@ def test_delete_group_non_empty_request_with_auto_populated_field(): client.delete_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == migrationcenter.DeleteGroupRequest( + request_msg = migrationcenter.DeleteGroupRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_group_use_cached_wrapped_rpc(): @@ -9993,9 +10034,14 @@ async def test_delete_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_group_async( - transport: str = "grpc_asyncio", request_type=migrationcenter.DeleteGroupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + migrationcenter.DeleteGroupRequest(), + {}, + ], +) +async def test_delete_group_async(request_type, transport: str = "grpc_asyncio"): client = MigrationCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10003,7 +10049,7 @@ async def test_delete_group_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_group), "__call__") as call: @@ -10023,11 +10069,6 @@ async def test_delete_group_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_group_async_from_dict(): - await test_delete_group_async(request_type=dict) - - def test_delete_group_field_headers(): client = MigrationCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10174,8 +10215,8 @@ async def test_delete_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - migrationcenter.AddAssetsToGroupRequest, - dict, + migrationcenter.AddAssetsToGroupRequest(), + {}, ], ) def test_add_assets_to_group(request_type, transport: str = "grpc"): @@ -10186,7 +10227,7 @@ def test_add_assets_to_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10232,10 +10273,11 @@ def test_add_assets_to_group_non_empty_request_with_auto_populated_field(): client.add_assets_to_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == migrationcenter.AddAssetsToGroupRequest( + request_msg = migrationcenter.AddAssetsToGroupRequest( group="group_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_add_assets_to_group_use_cached_wrapped_rpc(): @@ -10330,10 +10372,14 @@ async def test_add_assets_to_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_add_assets_to_group_async( - transport: str = "grpc_asyncio", - request_type=migrationcenter.AddAssetsToGroupRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + migrationcenter.AddAssetsToGroupRequest(), + {}, + ], +) +async def test_add_assets_to_group_async(request_type, transport: str = "grpc_asyncio"): client = MigrationCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10341,7 +10387,7 @@ async def test_add_assets_to_group_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( @@ -10363,11 +10409,6 @@ async def test_add_assets_to_group_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_add_assets_to_group_async_from_dict(): - await test_add_assets_to_group_async(request_type=dict) - - def test_add_assets_to_group_field_headers(): client = MigrationCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10522,8 +10563,8 @@ async def test_add_assets_to_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - migrationcenter.RemoveAssetsFromGroupRequest, - dict, + migrationcenter.RemoveAssetsFromGroupRequest(), + {}, ], ) def test_remove_assets_from_group(request_type, transport: str = "grpc"): @@ -10534,7 +10575,7 @@ def test_remove_assets_from_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10580,10 +10621,11 @@ def test_remove_assets_from_group_non_empty_request_with_auto_populated_field(): client.remove_assets_from_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == migrationcenter.RemoveAssetsFromGroupRequest( + request_msg = migrationcenter.RemoveAssetsFromGroupRequest( group="group_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_remove_assets_from_group_use_cached_wrapped_rpc(): @@ -10679,9 +10721,15 @@ async def test_remove_assets_from_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + migrationcenter.RemoveAssetsFromGroupRequest(), + {}, + ], +) async def test_remove_assets_from_group_async( - transport: str = "grpc_asyncio", - request_type=migrationcenter.RemoveAssetsFromGroupRequest, + request_type, transport: str = "grpc_asyncio" ): client = MigrationCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -10690,7 +10738,7 @@ async def test_remove_assets_from_group_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( @@ -10712,11 +10760,6 @@ async def test_remove_assets_from_group_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_remove_assets_from_group_async_from_dict(): - await test_remove_assets_from_group_async(request_type=dict) - - def test_remove_assets_from_group_field_headers(): client = MigrationCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10871,8 +10914,8 @@ async def test_remove_assets_from_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - migrationcenter.ListErrorFramesRequest, - dict, + migrationcenter.ListErrorFramesRequest(), + {}, ], ) def test_list_error_frames(request_type, transport: str = "grpc"): @@ -10883,7 +10926,7 @@ def test_list_error_frames(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10934,10 +10977,11 @@ def test_list_error_frames_non_empty_request_with_auto_populated_field(): client.list_error_frames(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == migrationcenter.ListErrorFramesRequest( + request_msg = migrationcenter.ListErrorFramesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_error_frames_use_cached_wrapped_rpc(): @@ -11020,9 +11064,14 @@ async def test_list_error_frames_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_error_frames_async( - transport: str = "grpc_asyncio", request_type=migrationcenter.ListErrorFramesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + migrationcenter.ListErrorFramesRequest(), + {}, + ], +) +async def test_list_error_frames_async(request_type, transport: str = "grpc_asyncio"): client = MigrationCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11030,7 +11079,7 @@ async def test_list_error_frames_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( @@ -11057,11 +11106,6 @@ async def test_list_error_frames_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_error_frames_async_from_dict(): - await test_list_error_frames_async(request_type=dict) - - def test_list_error_frames_field_headers(): client = MigrationCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11414,8 +11458,8 @@ async def test_list_error_frames_async_pages(): @pytest.mark.parametrize( "request_type", [ - migrationcenter.GetErrorFrameRequest, - dict, + migrationcenter.GetErrorFrameRequest(), + {}, ], ) def test_get_error_frame(request_type, transport: str = "grpc"): @@ -11426,7 +11470,7 @@ def test_get_error_frame(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_error_frame), "__call__") as call: @@ -11470,9 +11514,10 @@ def test_get_error_frame_non_empty_request_with_auto_populated_field(): client.get_error_frame(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == migrationcenter.GetErrorFrameRequest( + request_msg = migrationcenter.GetErrorFrameRequest( name="name_value", ) + assert args[0] == request_msg def test_get_error_frame_use_cached_wrapped_rpc(): @@ -11553,9 +11598,14 @@ async def test_get_error_frame_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_error_frame_async( - transport: str = "grpc_asyncio", request_type=migrationcenter.GetErrorFrameRequest -): +@pytest.mark.parametrize( + "request_type", + [ + migrationcenter.GetErrorFrameRequest(), + {}, + ], +) +async def test_get_error_frame_async(request_type, transport: str = "grpc_asyncio"): client = MigrationCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11563,7 +11613,7 @@ async def test_get_error_frame_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_error_frame), "__call__") as call: @@ -11586,11 +11636,6 @@ async def test_get_error_frame_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_error_frame_async_from_dict(): - await test_get_error_frame_async(request_type=dict) - - def test_get_error_frame_field_headers(): client = MigrationCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11737,8 +11782,8 @@ async def test_get_error_frame_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - migrationcenter.ListSourcesRequest, - dict, + migrationcenter.ListSourcesRequest(), + {}, ], ) def test_list_sources(request_type, transport: str = "grpc"): @@ -11749,7 +11794,7 @@ def test_list_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(type(client.transport.list_sources), "__call__") as call: @@ -11798,12 +11843,13 @@ def test_list_sources_non_empty_request_with_auto_populated_field(): client.list_sources(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == migrationcenter.ListSourcesRequest( + request_msg = migrationcenter.ListSourcesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_sources_use_cached_wrapped_rpc(): @@ -11884,9 +11930,14 @@ async def test_list_sources_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_sources_async( - transport: str = "grpc_asyncio", request_type=migrationcenter.ListSourcesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + migrationcenter.ListSourcesRequest(), + {}, + ], +) +async def test_list_sources_async(request_type, transport: str = "grpc_asyncio"): client = MigrationCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11894,7 +11945,7 @@ async def test_list_sources_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_sources), "__call__") as call: @@ -11919,11 +11970,6 @@ async def test_list_sources_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_sources_async_from_dict(): - await test_list_sources_async(request_type=dict) - - def test_list_sources_field_headers(): client = MigrationCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12260,8 +12306,8 @@ async def test_list_sources_async_pages(): @pytest.mark.parametrize( "request_type", [ - migrationcenter.GetSourceRequest, - dict, + migrationcenter.GetSourceRequest(), + {}, ], ) def test_get_source(request_type, transport: str = "grpc"): @@ -12272,7 +12318,7 @@ def test_get_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(type(client.transport.get_source), "__call__") as call: @@ -12332,9 +12378,10 @@ def test_get_source_non_empty_request_with_auto_populated_field(): client.get_source(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == migrationcenter.GetSourceRequest( + request_msg = migrationcenter.GetSourceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_source_use_cached_wrapped_rpc(): @@ -12413,9 +12460,14 @@ async def test_get_source_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_source_async( - transport: str = "grpc_asyncio", request_type=migrationcenter.GetSourceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + migrationcenter.GetSourceRequest(), + {}, + ], +) +async def test_get_source_async(request_type, transport: str = "grpc_asyncio"): client = MigrationCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12423,7 +12475,7 @@ async def test_get_source_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_source), "__call__") as call: @@ -12462,11 +12514,6 @@ async def test_get_source_async( assert response.state == migrationcenter.Source.State.ACTIVE -@pytest.mark.asyncio -async def test_get_source_async_from_dict(): - await test_get_source_async(request_type=dict) - - def test_get_source_field_headers(): client = MigrationCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12613,8 +12660,8 @@ async def test_get_source_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - migrationcenter.CreateSourceRequest, - dict, + migrationcenter.CreateSourceRequest(), + {}, ], ) def test_create_source(request_type, transport: str = "grpc"): @@ -12625,7 +12672,7 @@ def test_create_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(type(client.transport.create_source), "__call__") as call: @@ -12668,11 +12715,12 @@ def test_create_source_non_empty_request_with_auto_populated_field(): client.create_source(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == migrationcenter.CreateSourceRequest( + request_msg = migrationcenter.CreateSourceRequest( parent="parent_value", source_id="source_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_source_use_cached_wrapped_rpc(): @@ -12763,9 +12811,14 @@ async def test_create_source_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_source_async( - transport: str = "grpc_asyncio", request_type=migrationcenter.CreateSourceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + migrationcenter.CreateSourceRequest(), + {}, + ], +) +async def test_create_source_async(request_type, transport: str = "grpc_asyncio"): client = MigrationCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12773,7 +12826,7 @@ async def test_create_source_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_source), "__call__") as call: @@ -12793,11 +12846,6 @@ async def test_create_source_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_source_async_from_dict(): - await test_create_source_async(request_type=dict) - - def test_create_source_field_headers(): client = MigrationCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12964,8 +13012,8 @@ async def test_create_source_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - migrationcenter.UpdateSourceRequest, - dict, + migrationcenter.UpdateSourceRequest(), + {}, ], ) def test_update_source(request_type, transport: str = "grpc"): @@ -12976,7 +13024,7 @@ def test_update_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(type(client.transport.update_source), "__call__") as call: @@ -13017,9 +13065,10 @@ def test_update_source_non_empty_request_with_auto_populated_field(): client.update_source(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == migrationcenter.UpdateSourceRequest( + request_msg = migrationcenter.UpdateSourceRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_source_use_cached_wrapped_rpc(): @@ -13110,9 +13159,14 @@ async def test_update_source_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_source_async( - transport: str = "grpc_asyncio", request_type=migrationcenter.UpdateSourceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + migrationcenter.UpdateSourceRequest(), + {}, + ], +) +async def test_update_source_async(request_type, transport: str = "grpc_asyncio"): client = MigrationCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13120,7 +13174,7 @@ async def test_update_source_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_source), "__call__") as call: @@ -13140,11 +13194,6 @@ async def test_update_source_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_source_async_from_dict(): - await test_update_source_async(request_type=dict) - - def test_update_source_field_headers(): client = MigrationCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13301,8 +13350,8 @@ async def test_update_source_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - migrationcenter.DeleteSourceRequest, - dict, + migrationcenter.DeleteSourceRequest(), + {}, ], ) def test_delete_source(request_type, transport: str = "grpc"): @@ -13313,7 +13362,7 @@ def test_delete_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(type(client.transport.delete_source), "__call__") as call: @@ -13355,10 +13404,11 @@ def test_delete_source_non_empty_request_with_auto_populated_field(): client.delete_source(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == migrationcenter.DeleteSourceRequest( + request_msg = migrationcenter.DeleteSourceRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_source_use_cached_wrapped_rpc(): @@ -13449,9 +13499,14 @@ async def test_delete_source_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_source_async( - transport: str = "grpc_asyncio", request_type=migrationcenter.DeleteSourceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + migrationcenter.DeleteSourceRequest(), + {}, + ], +) +async def test_delete_source_async(request_type, transport: str = "grpc_asyncio"): client = MigrationCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13459,7 +13514,7 @@ async def test_delete_source_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_source), "__call__") as call: @@ -13479,11 +13534,6 @@ async def test_delete_source_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_source_async_from_dict(): - await test_delete_source_async(request_type=dict) - - def test_delete_source_field_headers(): client = MigrationCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13630,8 +13680,8 @@ async def test_delete_source_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - migrationcenter.ListPreferenceSetsRequest, - dict, + migrationcenter.ListPreferenceSetsRequest(), + {}, ], ) def test_list_preference_sets(request_type, transport: str = "grpc"): @@ -13642,7 +13692,7 @@ def test_list_preference_sets(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -13694,11 +13744,12 @@ def test_list_preference_sets_non_empty_request_with_auto_populated_field(): client.list_preference_sets(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == migrationcenter.ListPreferenceSetsRequest( + request_msg = migrationcenter.ListPreferenceSetsRequest( parent="parent_value", page_token="page_token_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_preference_sets_use_cached_wrapped_rpc(): @@ -13783,9 +13834,15 @@ async def test_list_preference_sets_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + migrationcenter.ListPreferenceSetsRequest(), + {}, + ], +) async def test_list_preference_sets_async( - transport: str = "grpc_asyncio", - request_type=migrationcenter.ListPreferenceSetsRequest, + request_type, transport: str = "grpc_asyncio" ): client = MigrationCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -13794,7 +13851,7 @@ async def test_list_preference_sets_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( @@ -13821,11 +13878,6 @@ async def test_list_preference_sets_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_preference_sets_async_from_dict(): - await test_list_preference_sets_async(request_type=dict) - - def test_list_preference_sets_field_headers(): client = MigrationCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14178,8 +14230,8 @@ async def test_list_preference_sets_async_pages(): @pytest.mark.parametrize( "request_type", [ - migrationcenter.GetPreferenceSetRequest, - dict, + migrationcenter.GetPreferenceSetRequest(), + {}, ], ) def test_get_preference_set(request_type, transport: str = "grpc"): @@ -14190,7 +14242,7 @@ def test_get_preference_set(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -14242,9 +14294,10 @@ def test_get_preference_set_non_empty_request_with_auto_populated_field(): client.get_preference_set(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == migrationcenter.GetPreferenceSetRequest( + request_msg = migrationcenter.GetPreferenceSetRequest( name="name_value", ) + assert args[0] == request_msg def test_get_preference_set_use_cached_wrapped_rpc(): @@ -14329,10 +14382,14 @@ async def test_get_preference_set_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_preference_set_async( - transport: str = "grpc_asyncio", - request_type=migrationcenter.GetPreferenceSetRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + migrationcenter.GetPreferenceSetRequest(), + {}, + ], +) +async def test_get_preference_set_async(request_type, transport: str = "grpc_asyncio"): client = MigrationCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14340,7 +14397,7 @@ async def test_get_preference_set_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( @@ -14369,11 +14426,6 @@ async def test_get_preference_set_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_get_preference_set_async_from_dict(): - await test_get_preference_set_async(request_type=dict) - - def test_get_preference_set_field_headers(): client = MigrationCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14528,8 +14580,8 @@ async def test_get_preference_set_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - migrationcenter.CreatePreferenceSetRequest, - dict, + migrationcenter.CreatePreferenceSetRequest(), + {}, ], ) def test_create_preference_set(request_type, transport: str = "grpc"): @@ -14540,7 +14592,7 @@ def test_create_preference_set(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -14587,11 +14639,12 @@ def test_create_preference_set_non_empty_request_with_auto_populated_field(): client.create_preference_set(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == migrationcenter.CreatePreferenceSetRequest( + request_msg = migrationcenter.CreatePreferenceSetRequest( parent="parent_value", preference_set_id="preference_set_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_preference_set_use_cached_wrapped_rpc(): @@ -14687,9 +14740,15 @@ async def test_create_preference_set_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + migrationcenter.CreatePreferenceSetRequest(), + {}, + ], +) async def test_create_preference_set_async( - transport: str = "grpc_asyncio", - request_type=migrationcenter.CreatePreferenceSetRequest, + request_type, transport: str = "grpc_asyncio" ): client = MigrationCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -14698,7 +14757,7 @@ async def test_create_preference_set_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( @@ -14720,11 +14779,6 @@ async def test_create_preference_set_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_preference_set_async_from_dict(): - await test_create_preference_set_async(request_type=dict) - - def test_create_preference_set_field_headers(): client = MigrationCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14899,8 +14953,8 @@ async def test_create_preference_set_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - migrationcenter.UpdatePreferenceSetRequest, - dict, + migrationcenter.UpdatePreferenceSetRequest(), + {}, ], ) def test_update_preference_set(request_type, transport: str = "grpc"): @@ -14911,7 +14965,7 @@ def test_update_preference_set(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -14956,9 +15010,10 @@ def test_update_preference_set_non_empty_request_with_auto_populated_field(): client.update_preference_set(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == migrationcenter.UpdatePreferenceSetRequest( + request_msg = migrationcenter.UpdatePreferenceSetRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_preference_set_use_cached_wrapped_rpc(): @@ -15054,9 +15109,15 @@ async def test_update_preference_set_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + migrationcenter.UpdatePreferenceSetRequest(), + {}, + ], +) async def test_update_preference_set_async( - transport: str = "grpc_asyncio", - request_type=migrationcenter.UpdatePreferenceSetRequest, + request_type, transport: str = "grpc_asyncio" ): client = MigrationCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -15065,7 +15126,7 @@ async def test_update_preference_set_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( @@ -15087,11 +15148,6 @@ async def test_update_preference_set_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_preference_set_async_from_dict(): - await test_update_preference_set_async(request_type=dict) - - def test_update_preference_set_field_headers(): client = MigrationCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15256,8 +15312,8 @@ async def test_update_preference_set_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - migrationcenter.DeletePreferenceSetRequest, - dict, + migrationcenter.DeletePreferenceSetRequest(), + {}, ], ) def test_delete_preference_set(request_type, transport: str = "grpc"): @@ -15268,7 +15324,7 @@ def test_delete_preference_set(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -15314,10 +15370,11 @@ def test_delete_preference_set_non_empty_request_with_auto_populated_field(): client.delete_preference_set(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == migrationcenter.DeletePreferenceSetRequest( + request_msg = migrationcenter.DeletePreferenceSetRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_preference_set_use_cached_wrapped_rpc(): @@ -15413,9 +15470,15 @@ async def test_delete_preference_set_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + migrationcenter.DeletePreferenceSetRequest(), + {}, + ], +) async def test_delete_preference_set_async( - transport: str = "grpc_asyncio", - request_type=migrationcenter.DeletePreferenceSetRequest, + request_type, transport: str = "grpc_asyncio" ): client = MigrationCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -15424,7 +15487,7 @@ async def test_delete_preference_set_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( @@ -15446,11 +15509,6 @@ async def test_delete_preference_set_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_preference_set_async_from_dict(): - await test_delete_preference_set_async(request_type=dict) - - def test_delete_preference_set_field_headers(): client = MigrationCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15605,8 +15663,8 @@ async def test_delete_preference_set_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - migrationcenter.GetSettingsRequest, - dict, + migrationcenter.GetSettingsRequest(), + {}, ], ) def test_get_settings(request_type, transport: str = "grpc"): @@ -15617,7 +15675,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: @@ -15663,9 +15721,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] == migrationcenter.GetSettingsRequest( + request_msg = migrationcenter.GetSettingsRequest( name="name_value", ) + assert args[0] == request_msg def test_get_settings_use_cached_wrapped_rpc(): @@ -15746,9 +15805,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=migrationcenter.GetSettingsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + migrationcenter.GetSettingsRequest(), + {}, + ], +) +async def test_get_settings_async(request_type, transport: str = "grpc_asyncio"): client = MigrationCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -15756,7 +15820,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: @@ -15781,11 +15845,6 @@ async def test_get_settings_async( assert response.preference_set == "preference_set_value" -@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 = MigrationCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15932,8 +15991,8 @@ async def test_get_settings_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - migrationcenter.UpdateSettingsRequest, - dict, + migrationcenter.UpdateSettingsRequest(), + {}, ], ) def test_update_settings(request_type, transport: str = "grpc"): @@ -15944,7 +16003,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: @@ -15985,9 +16044,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] == migrationcenter.UpdateSettingsRequest( + request_msg = migrationcenter.UpdateSettingsRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_settings_use_cached_wrapped_rpc(): @@ -16078,9 +16138,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=migrationcenter.UpdateSettingsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + migrationcenter.UpdateSettingsRequest(), + {}, + ], +) +async def test_update_settings_async(request_type, transport: str = "grpc_asyncio"): client = MigrationCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -16088,7 +16153,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: @@ -16108,11 +16173,6 @@ async def test_update_settings_async( assert isinstance(response, future.Future) -@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 = MigrationCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16269,8 +16329,8 @@ async def test_update_settings_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - migrationcenter.CreateReportConfigRequest, - dict, + migrationcenter.CreateReportConfigRequest(), + {}, ], ) def test_create_report_config(request_type, transport: str = "grpc"): @@ -16281,7 +16341,7 @@ def test_create_report_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( @@ -16328,11 +16388,12 @@ def test_create_report_config_non_empty_request_with_auto_populated_field(): client.create_report_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == migrationcenter.CreateReportConfigRequest( + request_msg = migrationcenter.CreateReportConfigRequest( parent="parent_value", report_config_id="report_config_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_report_config_use_cached_wrapped_rpc(): @@ -16427,9 +16488,15 @@ async def test_create_report_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + migrationcenter.CreateReportConfigRequest(), + {}, + ], +) async def test_create_report_config_async( - transport: str = "grpc_asyncio", - request_type=migrationcenter.CreateReportConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = MigrationCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -16438,7 +16505,7 @@ async def test_create_report_config_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( @@ -16460,11 +16527,6 @@ async def test_create_report_config_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_report_config_async_from_dict(): - await test_create_report_config_async(request_type=dict) - - def test_create_report_config_field_headers(): client = MigrationCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16639,8 +16701,8 @@ async def test_create_report_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - migrationcenter.GetReportConfigRequest, - dict, + migrationcenter.GetReportConfigRequest(), + {}, ], ) def test_get_report_config(request_type, transport: str = "grpc"): @@ -16651,7 +16713,7 @@ def test_get_report_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( @@ -16703,9 +16765,10 @@ def test_get_report_config_non_empty_request_with_auto_populated_field(): client.get_report_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == migrationcenter.GetReportConfigRequest( + request_msg = migrationcenter.GetReportConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_report_config_use_cached_wrapped_rpc(): @@ -16788,9 +16851,14 @@ async def test_get_report_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_report_config_async( - transport: str = "grpc_asyncio", request_type=migrationcenter.GetReportConfigRequest -): +@pytest.mark.parametrize( + "request_type", + [ + migrationcenter.GetReportConfigRequest(), + {}, + ], +) +async def test_get_report_config_async(request_type, transport: str = "grpc_asyncio"): client = MigrationCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -16798,7 +16866,7 @@ async def test_get_report_config_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( @@ -16827,11 +16895,6 @@ async def test_get_report_config_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_get_report_config_async_from_dict(): - await test_get_report_config_async(request_type=dict) - - def test_get_report_config_field_headers(): client = MigrationCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16986,8 +17049,8 @@ async def test_get_report_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - migrationcenter.ListReportConfigsRequest, - dict, + migrationcenter.ListReportConfigsRequest(), + {}, ], ) def test_list_report_configs(request_type, transport: str = "grpc"): @@ -16998,7 +17061,7 @@ def test_list_report_configs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -17051,12 +17114,13 @@ def test_list_report_configs_non_empty_request_with_auto_populated_field(): client.list_report_configs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == migrationcenter.ListReportConfigsRequest( + request_msg = migrationcenter.ListReportConfigsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_report_configs_use_cached_wrapped_rpc(): @@ -17141,10 +17205,14 @@ async def test_list_report_configs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_report_configs_async( - transport: str = "grpc_asyncio", - request_type=migrationcenter.ListReportConfigsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + migrationcenter.ListReportConfigsRequest(), + {}, + ], +) +async def test_list_report_configs_async(request_type, transport: str = "grpc_asyncio"): client = MigrationCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -17152,7 +17220,7 @@ async def test_list_report_configs_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( @@ -17179,11 +17247,6 @@ async def test_list_report_configs_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_report_configs_async_from_dict(): - await test_list_report_configs_async(request_type=dict) - - def test_list_report_configs_field_headers(): client = MigrationCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17536,8 +17599,8 @@ async def test_list_report_configs_async_pages(): @pytest.mark.parametrize( "request_type", [ - migrationcenter.DeleteReportConfigRequest, - dict, + migrationcenter.DeleteReportConfigRequest(), + {}, ], ) def test_delete_report_config(request_type, transport: str = "grpc"): @@ -17548,7 +17611,7 @@ def test_delete_report_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( @@ -17594,10 +17657,11 @@ def test_delete_report_config_non_empty_request_with_auto_populated_field(): client.delete_report_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == migrationcenter.DeleteReportConfigRequest( + request_msg = migrationcenter.DeleteReportConfigRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_report_config_use_cached_wrapped_rpc(): @@ -17692,9 +17756,15 @@ async def test_delete_report_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + migrationcenter.DeleteReportConfigRequest(), + {}, + ], +) async def test_delete_report_config_async( - transport: str = "grpc_asyncio", - request_type=migrationcenter.DeleteReportConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = MigrationCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -17703,7 +17773,7 @@ async def test_delete_report_config_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( @@ -17725,11 +17795,6 @@ async def test_delete_report_config_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_report_config_async_from_dict(): - await test_delete_report_config_async(request_type=dict) - - def test_delete_report_config_field_headers(): client = MigrationCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17884,8 +17949,8 @@ async def test_delete_report_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - migrationcenter.CreateReportRequest, - dict, + migrationcenter.CreateReportRequest(), + {}, ], ) def test_create_report(request_type, transport: str = "grpc"): @@ -17896,7 +17961,7 @@ def test_create_report(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_report), "__call__") as call: @@ -17939,11 +18004,12 @@ def test_create_report_non_empty_request_with_auto_populated_field(): client.create_report(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == migrationcenter.CreateReportRequest( + request_msg = migrationcenter.CreateReportRequest( parent="parent_value", report_id="report_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_report_use_cached_wrapped_rpc(): @@ -18034,9 +18100,14 @@ async def test_create_report_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_report_async( - transport: str = "grpc_asyncio", request_type=migrationcenter.CreateReportRequest -): +@pytest.mark.parametrize( + "request_type", + [ + migrationcenter.CreateReportRequest(), + {}, + ], +) +async def test_create_report_async(request_type, transport: str = "grpc_asyncio"): client = MigrationCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -18044,7 +18115,7 @@ async def test_create_report_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_report), "__call__") as call: @@ -18064,11 +18135,6 @@ async def test_create_report_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_report_async_from_dict(): - await test_create_report_async(request_type=dict) - - def test_create_report_field_headers(): client = MigrationCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18235,8 +18301,8 @@ async def test_create_report_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - migrationcenter.GetReportRequest, - dict, + migrationcenter.GetReportRequest(), + {}, ], ) def test_get_report(request_type, transport: str = "grpc"): @@ -18247,7 +18313,7 @@ def test_get_report(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_report), "__call__") as call: @@ -18299,9 +18365,10 @@ def test_get_report_non_empty_request_with_auto_populated_field(): client.get_report(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == migrationcenter.GetReportRequest( + request_msg = migrationcenter.GetReportRequest( name="name_value", ) + assert args[0] == request_msg def test_get_report_use_cached_wrapped_rpc(): @@ -18380,9 +18447,14 @@ async def test_get_report_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_report_async( - transport: str = "grpc_asyncio", request_type=migrationcenter.GetReportRequest -): +@pytest.mark.parametrize( + "request_type", + [ + migrationcenter.GetReportRequest(), + {}, + ], +) +async def test_get_report_async(request_type, transport: str = "grpc_asyncio"): client = MigrationCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -18390,7 +18462,7 @@ async def test_get_report_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_report), "__call__") as call: @@ -18421,11 +18493,6 @@ async def test_get_report_async( assert response.state == migrationcenter.Report.State.PENDING -@pytest.mark.asyncio -async def test_get_report_async_from_dict(): - await test_get_report_async(request_type=dict) - - def test_get_report_field_headers(): client = MigrationCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18572,8 +18639,8 @@ async def test_get_report_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - migrationcenter.ListReportsRequest, - dict, + migrationcenter.ListReportsRequest(), + {}, ], ) def test_list_reports(request_type, transport: str = "grpc"): @@ -18584,7 +18651,7 @@ def test_list_reports(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_reports), "__call__") as call: @@ -18633,12 +18700,13 @@ def test_list_reports_non_empty_request_with_auto_populated_field(): client.list_reports(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == migrationcenter.ListReportsRequest( + request_msg = migrationcenter.ListReportsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_reports_use_cached_wrapped_rpc(): @@ -18719,9 +18787,14 @@ async def test_list_reports_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_reports_async( - transport: str = "grpc_asyncio", request_type=migrationcenter.ListReportsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + migrationcenter.ListReportsRequest(), + {}, + ], +) +async def test_list_reports_async(request_type, transport: str = "grpc_asyncio"): client = MigrationCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -18729,7 +18802,7 @@ async def test_list_reports_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_reports), "__call__") as call: @@ -18754,11 +18827,6 @@ async def test_list_reports_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_reports_async_from_dict(): - await test_list_reports_async(request_type=dict) - - def test_list_reports_field_headers(): client = MigrationCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -19095,8 +19163,8 @@ async def test_list_reports_async_pages(): @pytest.mark.parametrize( "request_type", [ - migrationcenter.DeleteReportRequest, - dict, + migrationcenter.DeleteReportRequest(), + {}, ], ) def test_delete_report(request_type, transport: str = "grpc"): @@ -19107,7 +19175,7 @@ def test_delete_report(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_report), "__call__") as call: @@ -19149,10 +19217,11 @@ def test_delete_report_non_empty_request_with_auto_populated_field(): client.delete_report(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == migrationcenter.DeleteReportRequest( + request_msg = migrationcenter.DeleteReportRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_report_use_cached_wrapped_rpc(): @@ -19243,9 +19312,14 @@ async def test_delete_report_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_report_async( - transport: str = "grpc_asyncio", request_type=migrationcenter.DeleteReportRequest -): +@pytest.mark.parametrize( + "request_type", + [ + migrationcenter.DeleteReportRequest(), + {}, + ], +) +async def test_delete_report_async(request_type, transport: str = "grpc_asyncio"): client = MigrationCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -19253,7 +19327,7 @@ async def test_delete_report_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_report), "__call__") as call: @@ -19273,11 +19347,6 @@ async def test_delete_report_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_report_async_from_dict(): - await test_delete_report_async(request_type=dict) - - def test_delete_report_field_headers(): client = MigrationCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -29321,7 +29390,6 @@ def test_list_assets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.ListAssetsRequest() - assert args[0] == request_msg @@ -29342,7 +29410,6 @@ def test_get_asset_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.GetAssetRequest() - assert args[0] == request_msg @@ -29363,7 +29430,6 @@ def test_update_asset_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.UpdateAssetRequest() - assert args[0] == request_msg @@ -29386,7 +29452,6 @@ def test_batch_update_assets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.BatchUpdateAssetsRequest() - assert args[0] == request_msg @@ -29407,7 +29472,6 @@ def test_delete_asset_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.DeleteAssetRequest() - assert args[0] == request_msg @@ -29430,7 +29494,6 @@ def test_batch_delete_assets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.BatchDeleteAssetsRequest() - assert args[0] == request_msg @@ -29453,7 +29516,6 @@ def test_report_asset_frames_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.ReportAssetFramesRequest() - assert args[0] == request_msg @@ -29476,7 +29538,6 @@ def test_aggregate_assets_values_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.AggregateAssetsValuesRequest() - assert args[0] == request_msg @@ -29499,7 +29560,6 @@ def test_create_import_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.CreateImportJobRequest() - assert args[0] == request_msg @@ -29520,7 +29580,6 @@ def test_list_import_jobs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.ListImportJobsRequest() - assert args[0] == request_msg @@ -29541,7 +29600,6 @@ def test_get_import_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.GetImportJobRequest() - assert args[0] == request_msg @@ -29564,7 +29622,6 @@ def test_delete_import_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.DeleteImportJobRequest() - assert args[0] == request_msg @@ -29587,7 +29644,6 @@ def test_update_import_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.UpdateImportJobRequest() - assert args[0] == request_msg @@ -29610,7 +29666,6 @@ def test_validate_import_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.ValidateImportJobRequest() - assert args[0] == request_msg @@ -29631,7 +29686,6 @@ def test_run_import_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.RunImportJobRequest() - assert args[0] == request_msg @@ -29654,7 +29708,6 @@ def test_get_import_data_file_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.GetImportDataFileRequest() - assert args[0] == request_msg @@ -29677,7 +29730,6 @@ def test_list_import_data_files_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.ListImportDataFilesRequest() - assert args[0] == request_msg @@ -29700,7 +29752,6 @@ def test_create_import_data_file_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.CreateImportDataFileRequest() - assert args[0] == request_msg @@ -29723,7 +29774,6 @@ def test_delete_import_data_file_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.DeleteImportDataFileRequest() - assert args[0] == request_msg @@ -29744,7 +29794,6 @@ def test_list_groups_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.ListGroupsRequest() - assert args[0] == request_msg @@ -29765,7 +29814,6 @@ def test_get_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.GetGroupRequest() - assert args[0] == request_msg @@ -29786,7 +29834,6 @@ def test_create_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.CreateGroupRequest() - assert args[0] == request_msg @@ -29807,7 +29854,6 @@ def test_update_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.UpdateGroupRequest() - assert args[0] == request_msg @@ -29828,7 +29874,6 @@ def test_delete_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.DeleteGroupRequest() - assert args[0] == request_msg @@ -29851,7 +29896,6 @@ def test_add_assets_to_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.AddAssetsToGroupRequest() - assert args[0] == request_msg @@ -29874,7 +29918,6 @@ def test_remove_assets_from_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.RemoveAssetsFromGroupRequest() - assert args[0] == request_msg @@ -29897,7 +29940,6 @@ def test_list_error_frames_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.ListErrorFramesRequest() - assert args[0] == request_msg @@ -29918,7 +29960,6 @@ def test_get_error_frame_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.GetErrorFrameRequest() - assert args[0] == request_msg @@ -29939,7 +29980,6 @@ def test_list_sources_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.ListSourcesRequest() - assert args[0] == request_msg @@ -29960,7 +30000,6 @@ def test_get_source_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.GetSourceRequest() - assert args[0] == request_msg @@ -29981,7 +30020,6 @@ def test_create_source_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.CreateSourceRequest() - assert args[0] == request_msg @@ -30002,7 +30040,6 @@ def test_update_source_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.UpdateSourceRequest() - assert args[0] == request_msg @@ -30023,7 +30060,6 @@ def test_delete_source_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.DeleteSourceRequest() - assert args[0] == request_msg @@ -30046,7 +30082,6 @@ def test_list_preference_sets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.ListPreferenceSetsRequest() - assert args[0] == request_msg @@ -30069,7 +30104,6 @@ def test_get_preference_set_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.GetPreferenceSetRequest() - assert args[0] == request_msg @@ -30092,7 +30126,6 @@ def test_create_preference_set_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.CreatePreferenceSetRequest() - assert args[0] == request_msg @@ -30115,7 +30148,6 @@ def test_update_preference_set_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.UpdatePreferenceSetRequest() - assert args[0] == request_msg @@ -30138,7 +30170,6 @@ def test_delete_preference_set_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.DeletePreferenceSetRequest() - assert args[0] == request_msg @@ -30159,7 +30190,6 @@ def test_get_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.GetSettingsRequest() - assert args[0] == request_msg @@ -30180,7 +30210,6 @@ def test_update_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.UpdateSettingsRequest() - assert args[0] == request_msg @@ -30203,7 +30232,6 @@ def test_create_report_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.CreateReportConfigRequest() - assert args[0] == request_msg @@ -30226,7 +30254,6 @@ def test_get_report_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.GetReportConfigRequest() - assert args[0] == request_msg @@ -30249,7 +30276,6 @@ def test_list_report_configs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.ListReportConfigsRequest() - assert args[0] == request_msg @@ -30272,7 +30298,6 @@ def test_delete_report_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.DeleteReportConfigRequest() - assert args[0] == request_msg @@ -30293,7 +30318,6 @@ def test_create_report_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.CreateReportRequest() - assert args[0] == request_msg @@ -30314,7 +30338,6 @@ def test_get_report_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.GetReportRequest() - assert args[0] == request_msg @@ -30335,7 +30358,6 @@ def test_list_reports_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.ListReportsRequest() - assert args[0] == request_msg @@ -30356,7 +30378,6 @@ def test_delete_report_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.DeleteReportRequest() - assert args[0] == request_msg @@ -30398,7 +30419,6 @@ async def test_list_assets_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.ListAssetsRequest() - assert args[0] == request_msg @@ -30427,7 +30447,6 @@ async def test_get_asset_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.GetAssetRequest() - assert args[0] == request_msg @@ -30456,7 +30475,6 @@ async def test_update_asset_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.UpdateAssetRequest() - assert args[0] == request_msg @@ -30483,7 +30501,6 @@ async def test_batch_update_assets_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.BatchUpdateAssetsRequest() - assert args[0] == request_msg @@ -30506,7 +30523,6 @@ async def test_delete_asset_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.DeleteAssetRequest() - assert args[0] == request_msg @@ -30531,7 +30547,6 @@ async def test_batch_delete_assets_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.BatchDeleteAssetsRequest() - assert args[0] == request_msg @@ -30558,7 +30573,6 @@ async def test_report_asset_frames_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.ReportAssetFramesRequest() - assert args[0] == request_msg @@ -30585,7 +30599,6 @@ async def test_aggregate_assets_values_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.AggregateAssetsValuesRequest() - assert args[0] == request_msg @@ -30612,7 +30625,6 @@ async def test_create_import_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.CreateImportJobRequest() - assert args[0] == request_msg @@ -30640,7 +30652,6 @@ async def test_list_import_jobs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.ListImportJobsRequest() - assert args[0] == request_msg @@ -30670,7 +30681,6 @@ async def test_get_import_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.GetImportJobRequest() - assert args[0] == request_msg @@ -30697,7 +30707,6 @@ async def test_delete_import_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.DeleteImportJobRequest() - assert args[0] == request_msg @@ -30724,7 +30733,6 @@ async def test_update_import_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.UpdateImportJobRequest() - assert args[0] == request_msg @@ -30751,7 +30759,6 @@ async def test_validate_import_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.ValidateImportJobRequest() - assert args[0] == request_msg @@ -30776,7 +30783,6 @@ async def test_run_import_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.RunImportJobRequest() - assert args[0] == request_msg @@ -30808,7 +30814,6 @@ async def test_get_import_data_file_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.GetImportDataFileRequest() - assert args[0] == request_msg @@ -30838,7 +30843,6 @@ async def test_list_import_data_files_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.ListImportDataFilesRequest() - assert args[0] == request_msg @@ -30865,7 +30869,6 @@ async def test_create_import_data_file_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.CreateImportDataFileRequest() - assert args[0] == request_msg @@ -30892,7 +30895,6 @@ async def test_delete_import_data_file_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.DeleteImportDataFileRequest() - assert args[0] == request_msg @@ -30920,7 +30922,6 @@ async def test_list_groups_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.ListGroupsRequest() - assert args[0] == request_msg @@ -30949,7 +30950,6 @@ async def test_get_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.GetGroupRequest() - assert args[0] == request_msg @@ -30974,7 +30974,6 @@ async def test_create_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.CreateGroupRequest() - assert args[0] == request_msg @@ -30999,7 +30998,6 @@ async def test_update_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.UpdateGroupRequest() - assert args[0] == request_msg @@ -31024,7 +31022,6 @@ async def test_delete_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.DeleteGroupRequest() - assert args[0] == request_msg @@ -31051,7 +31048,6 @@ async def test_add_assets_to_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.AddAssetsToGroupRequest() - assert args[0] == request_msg @@ -31078,7 +31074,6 @@ async def test_remove_assets_from_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.RemoveAssetsFromGroupRequest() - assert args[0] == request_msg @@ -31108,7 +31103,6 @@ async def test_list_error_frames_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.ListErrorFramesRequest() - assert args[0] == request_msg @@ -31135,7 +31129,6 @@ async def test_get_error_frame_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.GetErrorFrameRequest() - assert args[0] == request_msg @@ -31163,7 +31156,6 @@ async def test_list_sources_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.ListSourcesRequest() - assert args[0] == request_msg @@ -31198,7 +31190,6 @@ async def test_get_source_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.GetSourceRequest() - assert args[0] == request_msg @@ -31223,7 +31214,6 @@ async def test_create_source_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.CreateSourceRequest() - assert args[0] == request_msg @@ -31248,7 +31238,6 @@ async def test_update_source_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.UpdateSourceRequest() - assert args[0] == request_msg @@ -31273,7 +31262,6 @@ async def test_delete_source_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.DeleteSourceRequest() - assert args[0] == request_msg @@ -31303,7 +31291,6 @@ async def test_list_preference_sets_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.ListPreferenceSetsRequest() - assert args[0] == request_msg @@ -31334,7 +31321,6 @@ async def test_get_preference_set_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.GetPreferenceSetRequest() - assert args[0] == request_msg @@ -31361,7 +31347,6 @@ async def test_create_preference_set_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.CreatePreferenceSetRequest() - assert args[0] == request_msg @@ -31388,7 +31373,6 @@ async def test_update_preference_set_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.UpdatePreferenceSetRequest() - assert args[0] == request_msg @@ -31415,7 +31399,6 @@ async def test_delete_preference_set_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.DeletePreferenceSetRequest() - assert args[0] == request_msg @@ -31443,7 +31426,6 @@ async def test_get_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.GetSettingsRequest() - assert args[0] == request_msg @@ -31468,7 +31450,6 @@ async def test_update_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.UpdateSettingsRequest() - assert args[0] == request_msg @@ -31495,7 +31476,6 @@ async def test_create_report_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.CreateReportConfigRequest() - assert args[0] == request_msg @@ -31526,7 +31506,6 @@ async def test_get_report_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.GetReportConfigRequest() - assert args[0] == request_msg @@ -31556,7 +31535,6 @@ async def test_list_report_configs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.ListReportConfigsRequest() - assert args[0] == request_msg @@ -31583,7 +31561,6 @@ async def test_delete_report_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.DeleteReportConfigRequest() - assert args[0] == request_msg @@ -31608,7 +31585,6 @@ async def test_create_report_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.CreateReportRequest() - assert args[0] == request_msg @@ -31639,7 +31615,6 @@ async def test_get_report_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.GetReportRequest() - assert args[0] == request_msg @@ -31667,7 +31642,6 @@ async def test_list_reports_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.ListReportsRequest() - assert args[0] == request_msg @@ -31692,7 +31666,6 @@ async def test_delete_report_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.DeleteReportRequest() - assert args[0] == request_msg @@ -40154,7 +40127,6 @@ def test_list_assets_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.ListAssetsRequest() - assert args[0] == request_msg @@ -40174,7 +40146,6 @@ def test_get_asset_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.GetAssetRequest() - assert args[0] == request_msg @@ -40194,7 +40165,6 @@ def test_update_asset_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.UpdateAssetRequest() - assert args[0] == request_msg @@ -40216,7 +40186,6 @@ def test_batch_update_assets_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.BatchUpdateAssetsRequest() - assert args[0] == request_msg @@ -40236,7 +40205,6 @@ def test_delete_asset_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.DeleteAssetRequest() - assert args[0] == request_msg @@ -40258,7 +40226,6 @@ def test_batch_delete_assets_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.BatchDeleteAssetsRequest() - assert args[0] == request_msg @@ -40280,7 +40247,6 @@ def test_report_asset_frames_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.ReportAssetFramesRequest() - assert args[0] == request_msg @@ -40302,7 +40268,6 @@ def test_aggregate_assets_values_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.AggregateAssetsValuesRequest() - assert args[0] == request_msg @@ -40324,7 +40289,6 @@ def test_create_import_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.CreateImportJobRequest() - assert args[0] == request_msg @@ -40344,7 +40308,6 @@ def test_list_import_jobs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.ListImportJobsRequest() - assert args[0] == request_msg @@ -40364,7 +40327,6 @@ def test_get_import_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.GetImportJobRequest() - assert args[0] == request_msg @@ -40386,7 +40348,6 @@ def test_delete_import_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.DeleteImportJobRequest() - assert args[0] == request_msg @@ -40408,7 +40369,6 @@ def test_update_import_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.UpdateImportJobRequest() - assert args[0] == request_msg @@ -40430,7 +40390,6 @@ def test_validate_import_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.ValidateImportJobRequest() - assert args[0] == request_msg @@ -40450,7 +40409,6 @@ def test_run_import_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.RunImportJobRequest() - assert args[0] == request_msg @@ -40472,7 +40430,6 @@ def test_get_import_data_file_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.GetImportDataFileRequest() - assert args[0] == request_msg @@ -40494,7 +40451,6 @@ def test_list_import_data_files_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.ListImportDataFilesRequest() - assert args[0] == request_msg @@ -40516,7 +40472,6 @@ def test_create_import_data_file_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.CreateImportDataFileRequest() - assert args[0] == request_msg @@ -40538,7 +40493,6 @@ def test_delete_import_data_file_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.DeleteImportDataFileRequest() - assert args[0] == request_msg @@ -40558,7 +40512,6 @@ def test_list_groups_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.ListGroupsRequest() - assert args[0] == request_msg @@ -40578,7 +40531,6 @@ def test_get_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.GetGroupRequest() - assert args[0] == request_msg @@ -40598,7 +40550,6 @@ def test_create_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.CreateGroupRequest() - assert args[0] == request_msg @@ -40618,7 +40569,6 @@ def test_update_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.UpdateGroupRequest() - assert args[0] == request_msg @@ -40638,7 +40588,6 @@ def test_delete_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.DeleteGroupRequest() - assert args[0] == request_msg @@ -40660,7 +40609,6 @@ def test_add_assets_to_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.AddAssetsToGroupRequest() - assert args[0] == request_msg @@ -40682,7 +40630,6 @@ def test_remove_assets_from_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.RemoveAssetsFromGroupRequest() - assert args[0] == request_msg @@ -40704,7 +40651,6 @@ def test_list_error_frames_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.ListErrorFramesRequest() - assert args[0] == request_msg @@ -40724,7 +40670,6 @@ def test_get_error_frame_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.GetErrorFrameRequest() - assert args[0] == request_msg @@ -40744,7 +40689,6 @@ def test_list_sources_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.ListSourcesRequest() - assert args[0] == request_msg @@ -40764,7 +40708,6 @@ def test_get_source_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.GetSourceRequest() - assert args[0] == request_msg @@ -40784,7 +40727,6 @@ def test_create_source_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.CreateSourceRequest() - assert args[0] == request_msg @@ -40804,7 +40746,6 @@ def test_update_source_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.UpdateSourceRequest() - assert args[0] == request_msg @@ -40824,7 +40765,6 @@ def test_delete_source_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.DeleteSourceRequest() - assert args[0] == request_msg @@ -40846,7 +40786,6 @@ def test_list_preference_sets_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.ListPreferenceSetsRequest() - assert args[0] == request_msg @@ -40868,7 +40807,6 @@ def test_get_preference_set_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.GetPreferenceSetRequest() - assert args[0] == request_msg @@ -40890,7 +40828,6 @@ def test_create_preference_set_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.CreatePreferenceSetRequest() - assert args[0] == request_msg @@ -40912,7 +40849,6 @@ def test_update_preference_set_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.UpdatePreferenceSetRequest() - assert args[0] == request_msg @@ -40934,7 +40870,6 @@ def test_delete_preference_set_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.DeletePreferenceSetRequest() - assert args[0] == request_msg @@ -40954,7 +40889,6 @@ def test_get_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.GetSettingsRequest() - assert args[0] == request_msg @@ -40974,7 +40908,6 @@ def test_update_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.UpdateSettingsRequest() - assert args[0] == request_msg @@ -40996,7 +40929,6 @@ def test_create_report_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.CreateReportConfigRequest() - assert args[0] == request_msg @@ -41018,7 +40950,6 @@ def test_get_report_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.GetReportConfigRequest() - assert args[0] == request_msg @@ -41040,7 +40971,6 @@ def test_list_report_configs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.ListReportConfigsRequest() - assert args[0] == request_msg @@ -41062,7 +40992,6 @@ def test_delete_report_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.DeleteReportConfigRequest() - assert args[0] == request_msg @@ -41082,7 +41011,6 @@ def test_create_report_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.CreateReportRequest() - assert args[0] == request_msg @@ -41102,7 +41030,6 @@ def test_get_report_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.GetReportRequest() - assert args[0] == request_msg @@ -41122,7 +41049,6 @@ def test_list_reports_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.ListReportsRequest() - assert args[0] == request_msg @@ -41142,7 +41068,6 @@ def test_delete_report_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = migrationcenter.DeleteReportRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-modelarmor/noxfile.py b/packages/google-cloud-modelarmor/noxfile.py index c6f0a6481b46..543e80995c76 100644 --- a/packages/google-cloud-modelarmor/noxfile.py +++ b/packages/google-cloud-modelarmor/noxfile.py @@ -47,7 +47,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-modelarmor" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-modelarmor/setup.py b/packages/google-cloud-modelarmor/setup.py index a83ce9a51592..8506f9fb203b 100644 --- a/packages/google-cloud-modelarmor/setup.py +++ b/packages/google-cloud-modelarmor/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/google-cloud-modelarmor/testing/constraints-3.10.txt b/packages/google-cloud-modelarmor/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-modelarmor/testing/constraints-3.10.txt +++ b/packages/google-cloud-modelarmor/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-modelarmor/tests/unit/gapic/modelarmor_v1/test_model_armor.py b/packages/google-cloud-modelarmor/tests/unit/gapic/modelarmor_v1/test_model_armor.py index e53cf20bff57..cd9535a7e721 100644 --- a/packages/google-cloud-modelarmor/tests/unit/gapic/modelarmor_v1/test_model_armor.py +++ b/packages/google-cloud-modelarmor/tests/unit/gapic/modelarmor_v1/test_model_armor.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 @@ -110,6 +111,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" @@ -1271,8 +1287,8 @@ def test_model_armor_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - service.ListTemplatesRequest, - dict, + service.ListTemplatesRequest(), + {}, ], ) def test_list_templates(request_type, transport: str = "grpc"): @@ -1283,7 +1299,7 @@ def test_list_templates(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_templates), "__call__") as call: @@ -1332,12 +1348,13 @@ def test_list_templates_non_empty_request_with_auto_populated_field(): client.list_templates(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListTemplatesRequest( + request_msg = service.ListTemplatesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_templates_use_cached_wrapped_rpc(): @@ -1418,9 +1435,14 @@ async def test_list_templates_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_templates_async( - transport: str = "grpc_asyncio", request_type=service.ListTemplatesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListTemplatesRequest(), + {}, + ], +) +async def test_list_templates_async(request_type, transport: str = "grpc_asyncio"): client = ModelArmorAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1428,7 +1450,7 @@ async def test_list_templates_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_templates), "__call__") as call: @@ -1453,11 +1475,6 @@ async def test_list_templates_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_templates_async_from_dict(): - await test_list_templates_async(request_type=dict) - - def test_list_templates_field_headers(): client = ModelArmorClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1794,8 +1811,8 @@ async def test_list_templates_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetTemplateRequest, - dict, + service.GetTemplateRequest(), + {}, ], ) def test_get_template(request_type, transport: str = "grpc"): @@ -1806,7 +1823,7 @@ def test_get_template(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_template), "__call__") as call: @@ -1850,9 +1867,10 @@ def test_get_template_non_empty_request_with_auto_populated_field(): client.get_template(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetTemplateRequest( + request_msg = service.GetTemplateRequest( name="name_value", ) + assert args[0] == request_msg def test_get_template_use_cached_wrapped_rpc(): @@ -1933,9 +1951,14 @@ async def test_get_template_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_template_async( - transport: str = "grpc_asyncio", request_type=service.GetTemplateRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetTemplateRequest(), + {}, + ], +) +async def test_get_template_async(request_type, transport: str = "grpc_asyncio"): client = ModelArmorAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1943,7 +1966,7 @@ async def test_get_template_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_template), "__call__") as call: @@ -1966,11 +1989,6 @@ async def test_get_template_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_template_async_from_dict(): - await test_get_template_async(request_type=dict) - - def test_get_template_field_headers(): client = ModelArmorClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2113,8 +2131,8 @@ async def test_get_template_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.CreateTemplateRequest, - dict, + service.CreateTemplateRequest(), + {}, ], ) def test_create_template(request_type, transport: str = "grpc"): @@ -2125,7 +2143,7 @@ def test_create_template(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_template), "__call__") as call: @@ -2170,10 +2188,11 @@ def test_create_template_non_empty_request_with_auto_populated_field(): client.create_template(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateTemplateRequest( + request_msg = service.CreateTemplateRequest( parent="parent_value", template_id="template_id_value", ) + assert args[0] == request_msg def test_create_template_use_cached_wrapped_rpc(): @@ -2254,9 +2273,14 @@ async def test_create_template_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_template_async( - transport: str = "grpc_asyncio", request_type=service.CreateTemplateRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CreateTemplateRequest(), + {}, + ], +) +async def test_create_template_async(request_type, transport: str = "grpc_asyncio"): client = ModelArmorAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2264,7 +2288,7 @@ async def test_create_template_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_template), "__call__") as call: @@ -2287,11 +2311,6 @@ async def test_create_template_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_create_template_async_from_dict(): - await test_create_template_async(request_type=dict) - - def test_create_template_field_headers(): client = ModelArmorClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2454,8 +2473,8 @@ async def test_create_template_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdateTemplateRequest, - dict, + service.UpdateTemplateRequest(), + {}, ], ) def test_update_template(request_type, transport: str = "grpc"): @@ -2466,7 +2485,7 @@ def test_update_template(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_template), "__call__") as call: @@ -2508,7 +2527,8 @@ def test_update_template_non_empty_request_with_auto_populated_field(): client.update_template(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateTemplateRequest() + request_msg = service.UpdateTemplateRequest() + assert args[0] == request_msg def test_update_template_use_cached_wrapped_rpc(): @@ -2589,9 +2609,14 @@ async def test_update_template_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_template_async( - transport: str = "grpc_asyncio", request_type=service.UpdateTemplateRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateTemplateRequest(), + {}, + ], +) +async def test_update_template_async(request_type, transport: str = "grpc_asyncio"): client = ModelArmorAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2599,7 +2624,7 @@ async def test_update_template_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_template), "__call__") as call: @@ -2622,11 +2647,6 @@ async def test_update_template_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_update_template_async_from_dict(): - await test_update_template_async(request_type=dict) - - def test_update_template_field_headers(): client = ModelArmorClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2779,8 +2799,8 @@ async def test_update_template_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DeleteTemplateRequest, - dict, + service.DeleteTemplateRequest(), + {}, ], ) def test_delete_template(request_type, transport: str = "grpc"): @@ -2791,7 +2811,7 @@ def test_delete_template(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_template), "__call__") as call: @@ -2832,9 +2852,10 @@ def test_delete_template_non_empty_request_with_auto_populated_field(): client.delete_template(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteTemplateRequest( + request_msg = service.DeleteTemplateRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_template_use_cached_wrapped_rpc(): @@ -2915,9 +2936,14 @@ async def test_delete_template_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_template_async( - transport: str = "grpc_asyncio", request_type=service.DeleteTemplateRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteTemplateRequest(), + {}, + ], +) +async def test_delete_template_async(request_type, transport: str = "grpc_asyncio"): client = ModelArmorAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2925,7 +2951,7 @@ async def test_delete_template_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_template), "__call__") as call: @@ -2943,11 +2969,6 @@ async def test_delete_template_async( assert response is None -@pytest.mark.asyncio -async def test_delete_template_async_from_dict(): - await test_delete_template_async(request_type=dict) - - def test_delete_template_field_headers(): client = ModelArmorClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3090,8 +3111,8 @@ async def test_delete_template_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.GetFloorSettingRequest, - dict, + service.GetFloorSettingRequest(), + {}, ], ) def test_get_floor_setting(request_type, transport: str = "grpc"): @@ -3102,7 +3123,7 @@ def test_get_floor_setting(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3156,9 +3177,10 @@ def test_get_floor_setting_non_empty_request_with_auto_populated_field(): client.get_floor_setting(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetFloorSettingRequest( + request_msg = service.GetFloorSettingRequest( name="name_value", ) + assert args[0] == request_msg def test_get_floor_setting_use_cached_wrapped_rpc(): @@ -3241,9 +3263,14 @@ async def test_get_floor_setting_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_floor_setting_async( - transport: str = "grpc_asyncio", request_type=service.GetFloorSettingRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetFloorSettingRequest(), + {}, + ], +) +async def test_get_floor_setting_async(request_type, transport: str = "grpc_asyncio"): client = ModelArmorAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3251,7 +3278,7 @@ async def test_get_floor_setting_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( @@ -3284,11 +3311,6 @@ async def test_get_floor_setting_async( ] -@pytest.mark.asyncio -async def test_get_floor_setting_async_from_dict(): - await test_get_floor_setting_async(request_type=dict) - - def test_get_floor_setting_field_headers(): client = ModelArmorClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3443,8 +3465,8 @@ async def test_get_floor_setting_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdateFloorSettingRequest, - dict, + service.UpdateFloorSettingRequest(), + {}, ], ) def test_update_floor_setting(request_type, transport: str = "grpc"): @@ -3455,7 +3477,7 @@ def test_update_floor_setting(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3507,7 +3529,8 @@ def test_update_floor_setting_non_empty_request_with_auto_populated_field(): client.update_floor_setting(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateFloorSettingRequest() + request_msg = service.UpdateFloorSettingRequest() + assert args[0] == request_msg def test_update_floor_setting_use_cached_wrapped_rpc(): @@ -3592,8 +3615,15 @@ async def test_update_floor_setting_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateFloorSettingRequest(), + {}, + ], +) async def test_update_floor_setting_async( - transport: str = "grpc_asyncio", request_type=service.UpdateFloorSettingRequest + request_type, transport: str = "grpc_asyncio" ): client = ModelArmorAsyncClient( credentials=async_anonymous_credentials(), @@ -3602,7 +3632,7 @@ async def test_update_floor_setting_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( @@ -3635,11 +3665,6 @@ async def test_update_floor_setting_async( ] -@pytest.mark.asyncio -async def test_update_floor_setting_async_from_dict(): - await test_update_floor_setting_async(request_type=dict) - - def test_update_floor_setting_field_headers(): client = ModelArmorClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3804,8 +3829,8 @@ async def test_update_floor_setting_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.SanitizeUserPromptRequest, - dict, + service.SanitizeUserPromptRequest(), + {}, ], ) def test_sanitize_user_prompt(request_type, transport: str = "grpc"): @@ -3816,7 +3841,7 @@ def test_sanitize_user_prompt(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3861,9 +3886,10 @@ def test_sanitize_user_prompt_non_empty_request_with_auto_populated_field(): client.sanitize_user_prompt(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.SanitizeUserPromptRequest( + request_msg = service.SanitizeUserPromptRequest( name="name_value", ) + assert args[0] == request_msg def test_sanitize_user_prompt_use_cached_wrapped_rpc(): @@ -3948,8 +3974,15 @@ async def test_sanitize_user_prompt_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.SanitizeUserPromptRequest(), + {}, + ], +) async def test_sanitize_user_prompt_async( - transport: str = "grpc_asyncio", request_type=service.SanitizeUserPromptRequest + request_type, transport: str = "grpc_asyncio" ): client = ModelArmorAsyncClient( credentials=async_anonymous_credentials(), @@ -3958,7 +3991,7 @@ async def test_sanitize_user_prompt_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( @@ -3980,11 +4013,6 @@ async def test_sanitize_user_prompt_async( assert isinstance(response, service.SanitizeUserPromptResponse) -@pytest.mark.asyncio -async def test_sanitize_user_prompt_async_from_dict(): - await test_sanitize_user_prompt_async(request_type=dict) - - def test_sanitize_user_prompt_field_headers(): client = ModelArmorClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4053,8 +4081,8 @@ async def test_sanitize_user_prompt_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.SanitizeModelResponseRequest, - dict, + service.SanitizeModelResponseRequest(), + {}, ], ) def test_sanitize_model_response(request_type, transport: str = "grpc"): @@ -4065,7 +4093,7 @@ def test_sanitize_model_response(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4111,10 +4139,11 @@ def test_sanitize_model_response_non_empty_request_with_auto_populated_field(): client.sanitize_model_response(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.SanitizeModelResponseRequest( + request_msg = service.SanitizeModelResponseRequest( name="name_value", user_prompt="user_prompt_value", ) + assert args[0] == request_msg def test_sanitize_model_response_use_cached_wrapped_rpc(): @@ -4200,8 +4229,15 @@ async def test_sanitize_model_response_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.SanitizeModelResponseRequest(), + {}, + ], +) async def test_sanitize_model_response_async( - transport: str = "grpc_asyncio", request_type=service.SanitizeModelResponseRequest + request_type, transport: str = "grpc_asyncio" ): client = ModelArmorAsyncClient( credentials=async_anonymous_credentials(), @@ -4210,7 +4246,7 @@ async def test_sanitize_model_response_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( @@ -4232,11 +4268,6 @@ async def test_sanitize_model_response_async( assert isinstance(response, service.SanitizeModelResponseResponse) -@pytest.mark.asyncio -async def test_sanitize_model_response_async_from_dict(): - await test_sanitize_model_response_async(request_type=dict) - - def test_sanitize_model_response_field_headers(): client = ModelArmorClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6077,7 +6108,6 @@ def test_list_templates_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListTemplatesRequest() - assert args[0] == request_msg @@ -6098,7 +6128,6 @@ def test_get_template_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetTemplateRequest() - assert args[0] == request_msg @@ -6119,7 +6148,6 @@ def test_create_template_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateTemplateRequest() - assert args[0] == request_msg @@ -6140,7 +6168,6 @@ def test_update_template_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateTemplateRequest() - assert args[0] == request_msg @@ -6161,7 +6188,6 @@ def test_delete_template_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteTemplateRequest() - assert args[0] == request_msg @@ -6184,7 +6210,6 @@ def test_get_floor_setting_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetFloorSettingRequest() - assert args[0] == request_msg @@ -6207,7 +6232,6 @@ def test_update_floor_setting_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateFloorSettingRequest() - assert args[0] == request_msg @@ -6230,7 +6254,6 @@ def test_sanitize_user_prompt_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.SanitizeUserPromptRequest() - assert args[0] == request_msg @@ -6253,7 +6276,6 @@ def test_sanitize_model_response_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.SanitizeModelResponseRequest() - assert args[0] == request_msg @@ -6295,7 +6317,6 @@ async def test_list_templates_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListTemplatesRequest() - assert args[0] == request_msg @@ -6322,7 +6343,6 @@ async def test_get_template_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetTemplateRequest() - assert args[0] == request_msg @@ -6349,7 +6369,6 @@ async def test_create_template_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateTemplateRequest() - assert args[0] == request_msg @@ -6376,7 +6395,6 @@ async def test_update_template_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateTemplateRequest() - assert args[0] == request_msg @@ -6399,7 +6417,6 @@ async def test_delete_template_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteTemplateRequest() - assert args[0] == request_msg @@ -6432,7 +6449,6 @@ async def test_get_floor_setting_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetFloorSettingRequest() - assert args[0] == request_msg @@ -6465,7 +6481,6 @@ async def test_update_floor_setting_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateFloorSettingRequest() - assert args[0] == request_msg @@ -6492,7 +6507,6 @@ async def test_sanitize_user_prompt_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.SanitizeUserPromptRequest() - assert args[0] == request_msg @@ -6519,7 +6533,6 @@ async def test_sanitize_model_response_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.SanitizeModelResponseRequest() - assert args[0] == request_msg @@ -8132,7 +8145,6 @@ def test_list_templates_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListTemplatesRequest() - assert args[0] == request_msg @@ -8152,7 +8164,6 @@ def test_get_template_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetTemplateRequest() - assert args[0] == request_msg @@ -8172,7 +8183,6 @@ def test_create_template_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateTemplateRequest() - assert args[0] == request_msg @@ -8192,7 +8202,6 @@ def test_update_template_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateTemplateRequest() - assert args[0] == request_msg @@ -8212,7 +8221,6 @@ def test_delete_template_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteTemplateRequest() - assert args[0] == request_msg @@ -8234,7 +8242,6 @@ def test_get_floor_setting_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetFloorSettingRequest() - assert args[0] == request_msg @@ -8256,7 +8263,6 @@ def test_update_floor_setting_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateFloorSettingRequest() - assert args[0] == request_msg @@ -8278,7 +8284,6 @@ def test_sanitize_user_prompt_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.SanitizeUserPromptRequest() - assert args[0] == request_msg @@ -8300,7 +8305,6 @@ def test_sanitize_model_response_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.SanitizeModelResponseRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-modelarmor/tests/unit/gapic/modelarmor_v1beta/test_model_armor.py b/packages/google-cloud-modelarmor/tests/unit/gapic/modelarmor_v1beta/test_model_armor.py index cf87cb7375d7..1f9bfc692ae5 100644 --- a/packages/google-cloud-modelarmor/tests/unit/gapic/modelarmor_v1beta/test_model_armor.py +++ b/packages/google-cloud-modelarmor/tests/unit/gapic/modelarmor_v1beta/test_model_armor.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 @@ -110,6 +111,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" @@ -1271,8 +1287,8 @@ def test_model_armor_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - service.ListTemplatesRequest, - dict, + service.ListTemplatesRequest(), + {}, ], ) def test_list_templates(request_type, transport: str = "grpc"): @@ -1283,7 +1299,7 @@ def test_list_templates(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_templates), "__call__") as call: @@ -1332,12 +1348,13 @@ def test_list_templates_non_empty_request_with_auto_populated_field(): client.list_templates(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListTemplatesRequest( + request_msg = service.ListTemplatesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_templates_use_cached_wrapped_rpc(): @@ -1418,9 +1435,14 @@ async def test_list_templates_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_templates_async( - transport: str = "grpc_asyncio", request_type=service.ListTemplatesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListTemplatesRequest(), + {}, + ], +) +async def test_list_templates_async(request_type, transport: str = "grpc_asyncio"): client = ModelArmorAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1428,7 +1450,7 @@ async def test_list_templates_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_templates), "__call__") as call: @@ -1453,11 +1475,6 @@ async def test_list_templates_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_templates_async_from_dict(): - await test_list_templates_async(request_type=dict) - - def test_list_templates_field_headers(): client = ModelArmorClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1794,8 +1811,8 @@ async def test_list_templates_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetTemplateRequest, - dict, + service.GetTemplateRequest(), + {}, ], ) def test_get_template(request_type, transport: str = "grpc"): @@ -1806,7 +1823,7 @@ def test_get_template(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_template), "__call__") as call: @@ -1850,9 +1867,10 @@ def test_get_template_non_empty_request_with_auto_populated_field(): client.get_template(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetTemplateRequest( + request_msg = service.GetTemplateRequest( name="name_value", ) + assert args[0] == request_msg def test_get_template_use_cached_wrapped_rpc(): @@ -1933,9 +1951,14 @@ async def test_get_template_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_template_async( - transport: str = "grpc_asyncio", request_type=service.GetTemplateRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetTemplateRequest(), + {}, + ], +) +async def test_get_template_async(request_type, transport: str = "grpc_asyncio"): client = ModelArmorAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1943,7 +1966,7 @@ async def test_get_template_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_template), "__call__") as call: @@ -1966,11 +1989,6 @@ async def test_get_template_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_template_async_from_dict(): - await test_get_template_async(request_type=dict) - - def test_get_template_field_headers(): client = ModelArmorClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2113,8 +2131,8 @@ async def test_get_template_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.CreateTemplateRequest, - dict, + service.CreateTemplateRequest(), + {}, ], ) def test_create_template(request_type, transport: str = "grpc"): @@ -2125,7 +2143,7 @@ def test_create_template(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_template), "__call__") as call: @@ -2170,10 +2188,11 @@ def test_create_template_non_empty_request_with_auto_populated_field(): client.create_template(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateTemplateRequest( + request_msg = service.CreateTemplateRequest( parent="parent_value", template_id="template_id_value", ) + assert args[0] == request_msg def test_create_template_use_cached_wrapped_rpc(): @@ -2254,9 +2273,14 @@ async def test_create_template_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_template_async( - transport: str = "grpc_asyncio", request_type=service.CreateTemplateRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CreateTemplateRequest(), + {}, + ], +) +async def test_create_template_async(request_type, transport: str = "grpc_asyncio"): client = ModelArmorAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2264,7 +2288,7 @@ async def test_create_template_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_template), "__call__") as call: @@ -2287,11 +2311,6 @@ async def test_create_template_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_create_template_async_from_dict(): - await test_create_template_async(request_type=dict) - - def test_create_template_field_headers(): client = ModelArmorClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2454,8 +2473,8 @@ async def test_create_template_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdateTemplateRequest, - dict, + service.UpdateTemplateRequest(), + {}, ], ) def test_update_template(request_type, transport: str = "grpc"): @@ -2466,7 +2485,7 @@ def test_update_template(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_template), "__call__") as call: @@ -2508,7 +2527,8 @@ def test_update_template_non_empty_request_with_auto_populated_field(): client.update_template(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateTemplateRequest() + request_msg = service.UpdateTemplateRequest() + assert args[0] == request_msg def test_update_template_use_cached_wrapped_rpc(): @@ -2589,9 +2609,14 @@ async def test_update_template_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_template_async( - transport: str = "grpc_asyncio", request_type=service.UpdateTemplateRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateTemplateRequest(), + {}, + ], +) +async def test_update_template_async(request_type, transport: str = "grpc_asyncio"): client = ModelArmorAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2599,7 +2624,7 @@ async def test_update_template_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_template), "__call__") as call: @@ -2622,11 +2647,6 @@ async def test_update_template_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_update_template_async_from_dict(): - await test_update_template_async(request_type=dict) - - def test_update_template_field_headers(): client = ModelArmorClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2779,8 +2799,8 @@ async def test_update_template_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DeleteTemplateRequest, - dict, + service.DeleteTemplateRequest(), + {}, ], ) def test_delete_template(request_type, transport: str = "grpc"): @@ -2791,7 +2811,7 @@ def test_delete_template(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_template), "__call__") as call: @@ -2832,9 +2852,10 @@ def test_delete_template_non_empty_request_with_auto_populated_field(): client.delete_template(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteTemplateRequest( + request_msg = service.DeleteTemplateRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_template_use_cached_wrapped_rpc(): @@ -2915,9 +2936,14 @@ async def test_delete_template_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_template_async( - transport: str = "grpc_asyncio", request_type=service.DeleteTemplateRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteTemplateRequest(), + {}, + ], +) +async def test_delete_template_async(request_type, transport: str = "grpc_asyncio"): client = ModelArmorAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2925,7 +2951,7 @@ async def test_delete_template_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_template), "__call__") as call: @@ -2943,11 +2969,6 @@ async def test_delete_template_async( assert response is None -@pytest.mark.asyncio -async def test_delete_template_async_from_dict(): - await test_delete_template_async(request_type=dict) - - def test_delete_template_field_headers(): client = ModelArmorClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3090,8 +3111,8 @@ async def test_delete_template_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.GetFloorSettingRequest, - dict, + service.GetFloorSettingRequest(), + {}, ], ) def test_get_floor_setting(request_type, transport: str = "grpc"): @@ -3102,7 +3123,7 @@ def test_get_floor_setting(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3156,9 +3177,10 @@ def test_get_floor_setting_non_empty_request_with_auto_populated_field(): client.get_floor_setting(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetFloorSettingRequest( + request_msg = service.GetFloorSettingRequest( name="name_value", ) + assert args[0] == request_msg def test_get_floor_setting_use_cached_wrapped_rpc(): @@ -3241,9 +3263,14 @@ async def test_get_floor_setting_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_floor_setting_async( - transport: str = "grpc_asyncio", request_type=service.GetFloorSettingRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetFloorSettingRequest(), + {}, + ], +) +async def test_get_floor_setting_async(request_type, transport: str = "grpc_asyncio"): client = ModelArmorAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3251,7 +3278,7 @@ async def test_get_floor_setting_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( @@ -3284,11 +3311,6 @@ async def test_get_floor_setting_async( ] -@pytest.mark.asyncio -async def test_get_floor_setting_async_from_dict(): - await test_get_floor_setting_async(request_type=dict) - - def test_get_floor_setting_field_headers(): client = ModelArmorClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3443,8 +3465,8 @@ async def test_get_floor_setting_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdateFloorSettingRequest, - dict, + service.UpdateFloorSettingRequest(), + {}, ], ) def test_update_floor_setting(request_type, transport: str = "grpc"): @@ -3455,7 +3477,7 @@ def test_update_floor_setting(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3507,7 +3529,8 @@ def test_update_floor_setting_non_empty_request_with_auto_populated_field(): client.update_floor_setting(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateFloorSettingRequest() + request_msg = service.UpdateFloorSettingRequest() + assert args[0] == request_msg def test_update_floor_setting_use_cached_wrapped_rpc(): @@ -3592,8 +3615,15 @@ async def test_update_floor_setting_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateFloorSettingRequest(), + {}, + ], +) async def test_update_floor_setting_async( - transport: str = "grpc_asyncio", request_type=service.UpdateFloorSettingRequest + request_type, transport: str = "grpc_asyncio" ): client = ModelArmorAsyncClient( credentials=async_anonymous_credentials(), @@ -3602,7 +3632,7 @@ async def test_update_floor_setting_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( @@ -3635,11 +3665,6 @@ async def test_update_floor_setting_async( ] -@pytest.mark.asyncio -async def test_update_floor_setting_async_from_dict(): - await test_update_floor_setting_async(request_type=dict) - - def test_update_floor_setting_field_headers(): client = ModelArmorClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3804,8 +3829,8 @@ async def test_update_floor_setting_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.SanitizeUserPromptRequest, - dict, + service.SanitizeUserPromptRequest(), + {}, ], ) def test_sanitize_user_prompt(request_type, transport: str = "grpc"): @@ -3816,7 +3841,7 @@ def test_sanitize_user_prompt(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3861,9 +3886,10 @@ def test_sanitize_user_prompt_non_empty_request_with_auto_populated_field(): client.sanitize_user_prompt(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.SanitizeUserPromptRequest( + request_msg = service.SanitizeUserPromptRequest( name="name_value", ) + assert args[0] == request_msg def test_sanitize_user_prompt_use_cached_wrapped_rpc(): @@ -3948,8 +3974,15 @@ async def test_sanitize_user_prompt_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.SanitizeUserPromptRequest(), + {}, + ], +) async def test_sanitize_user_prompt_async( - transport: str = "grpc_asyncio", request_type=service.SanitizeUserPromptRequest + request_type, transport: str = "grpc_asyncio" ): client = ModelArmorAsyncClient( credentials=async_anonymous_credentials(), @@ -3958,7 +3991,7 @@ async def test_sanitize_user_prompt_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( @@ -3980,11 +4013,6 @@ async def test_sanitize_user_prompt_async( assert isinstance(response, service.SanitizeUserPromptResponse) -@pytest.mark.asyncio -async def test_sanitize_user_prompt_async_from_dict(): - await test_sanitize_user_prompt_async(request_type=dict) - - def test_sanitize_user_prompt_field_headers(): client = ModelArmorClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4053,8 +4081,8 @@ async def test_sanitize_user_prompt_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.SanitizeModelResponseRequest, - dict, + service.SanitizeModelResponseRequest(), + {}, ], ) def test_sanitize_model_response(request_type, transport: str = "grpc"): @@ -4065,7 +4093,7 @@ def test_sanitize_model_response(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4111,10 +4139,11 @@ def test_sanitize_model_response_non_empty_request_with_auto_populated_field(): client.sanitize_model_response(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.SanitizeModelResponseRequest( + request_msg = service.SanitizeModelResponseRequest( name="name_value", user_prompt="user_prompt_value", ) + assert args[0] == request_msg def test_sanitize_model_response_use_cached_wrapped_rpc(): @@ -4200,8 +4229,15 @@ async def test_sanitize_model_response_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.SanitizeModelResponseRequest(), + {}, + ], +) async def test_sanitize_model_response_async( - transport: str = "grpc_asyncio", request_type=service.SanitizeModelResponseRequest + request_type, transport: str = "grpc_asyncio" ): client = ModelArmorAsyncClient( credentials=async_anonymous_credentials(), @@ -4210,7 +4246,7 @@ async def test_sanitize_model_response_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( @@ -4232,11 +4268,6 @@ async def test_sanitize_model_response_async( assert isinstance(response, service.SanitizeModelResponseResponse) -@pytest.mark.asyncio -async def test_sanitize_model_response_async_from_dict(): - await test_sanitize_model_response_async(request_type=dict) - - def test_sanitize_model_response_field_headers(): client = ModelArmorClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4305,8 +4336,8 @@ async def test_sanitize_model_response_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.SanitizeUserPromptRequest, - dict, + service.SanitizeUserPromptRequest(), + {}, ], ) def test_stream_sanitize_user_prompt(request_type, transport: str = "grpc"): @@ -4317,7 +4348,7 @@ def test_stream_sanitize_user_prompt(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as 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. @@ -4421,8 +4452,15 @@ async def test_stream_sanitize_user_prompt_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.SanitizeUserPromptRequest(), + {}, + ], +) async def test_stream_sanitize_user_prompt_async( - transport: str = "grpc_asyncio", request_type=service.SanitizeUserPromptRequest + request_type, transport: str = "grpc_asyncio" ): client = ModelArmorAsyncClient( credentials=async_anonymous_credentials(), @@ -4431,7 +4469,7 @@ async def test_stream_sanitize_user_prompt_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. @@ -4455,16 +4493,11 @@ async def test_stream_sanitize_user_prompt_async( assert isinstance(message, service.SanitizeUserPromptResponse) -@pytest.mark.asyncio -async def test_stream_sanitize_user_prompt_async_from_dict(): - await test_stream_sanitize_user_prompt_async(request_type=dict) - - @pytest.mark.parametrize( "request_type", [ - service.SanitizeModelResponseRequest, - dict, + service.SanitizeModelResponseRequest(), + {}, ], ) def test_stream_sanitize_model_response(request_type, transport: str = "grpc"): @@ -4475,7 +4508,7 @@ def test_stream_sanitize_model_response(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as 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. @@ -4579,8 +4612,15 @@ async def test_stream_sanitize_model_response_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.SanitizeModelResponseRequest(), + {}, + ], +) async def test_stream_sanitize_model_response_async( - transport: str = "grpc_asyncio", request_type=service.SanitizeModelResponseRequest + request_type, transport: str = "grpc_asyncio" ): client = ModelArmorAsyncClient( credentials=async_anonymous_credentials(), @@ -4589,7 +4629,7 @@ async def test_stream_sanitize_model_response_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. @@ -4613,11 +4653,6 @@ async def test_stream_sanitize_model_response_async( assert isinstance(message, service.SanitizeModelResponseResponse) -@pytest.mark.asyncio -async def test_stream_sanitize_model_response_async_from_dict(): - await test_stream_sanitize_model_response_async(request_type=dict) - - def test_list_templates_rest_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, # instead of constructing them on each call @@ -6448,7 +6483,6 @@ def test_list_templates_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListTemplatesRequest() - assert args[0] == request_msg @@ -6469,7 +6503,6 @@ def test_get_template_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetTemplateRequest() - assert args[0] == request_msg @@ -6490,7 +6523,6 @@ def test_create_template_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateTemplateRequest() - assert args[0] == request_msg @@ -6511,7 +6543,6 @@ def test_update_template_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateTemplateRequest() - assert args[0] == request_msg @@ -6532,7 +6563,6 @@ def test_delete_template_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteTemplateRequest() - assert args[0] == request_msg @@ -6555,7 +6585,6 @@ def test_get_floor_setting_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetFloorSettingRequest() - assert args[0] == request_msg @@ -6578,7 +6607,6 @@ def test_update_floor_setting_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateFloorSettingRequest() - assert args[0] == request_msg @@ -6601,7 +6629,6 @@ def test_sanitize_user_prompt_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.SanitizeUserPromptRequest() - assert args[0] == request_msg @@ -6624,7 +6651,6 @@ def test_sanitize_model_response_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.SanitizeModelResponseRequest() - assert args[0] == request_msg @@ -6666,7 +6692,6 @@ async def test_list_templates_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListTemplatesRequest() - assert args[0] == request_msg @@ -6693,7 +6718,6 @@ async def test_get_template_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetTemplateRequest() - assert args[0] == request_msg @@ -6720,7 +6744,6 @@ async def test_create_template_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateTemplateRequest() - assert args[0] == request_msg @@ -6747,7 +6770,6 @@ async def test_update_template_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateTemplateRequest() - assert args[0] == request_msg @@ -6770,7 +6792,6 @@ async def test_delete_template_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteTemplateRequest() - assert args[0] == request_msg @@ -6803,7 +6824,6 @@ async def test_get_floor_setting_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetFloorSettingRequest() - assert args[0] == request_msg @@ -6836,7 +6856,6 @@ async def test_update_floor_setting_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateFloorSettingRequest() - assert args[0] == request_msg @@ -6863,7 +6882,6 @@ async def test_sanitize_user_prompt_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.SanitizeUserPromptRequest() - assert args[0] == request_msg @@ -6890,7 +6908,6 @@ async def test_sanitize_model_response_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.SanitizeModelResponseRequest() - assert args[0] == request_msg @@ -8535,7 +8552,6 @@ def test_list_templates_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListTemplatesRequest() - assert args[0] == request_msg @@ -8555,7 +8571,6 @@ def test_get_template_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetTemplateRequest() - assert args[0] == request_msg @@ -8575,7 +8590,6 @@ def test_create_template_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateTemplateRequest() - assert args[0] == request_msg @@ -8595,7 +8609,6 @@ def test_update_template_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateTemplateRequest() - assert args[0] == request_msg @@ -8615,7 +8628,6 @@ def test_delete_template_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteTemplateRequest() - assert args[0] == request_msg @@ -8637,7 +8649,6 @@ def test_get_floor_setting_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetFloorSettingRequest() - assert args[0] == request_msg @@ -8659,7 +8670,6 @@ def test_update_floor_setting_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateFloorSettingRequest() - assert args[0] == request_msg @@ -8681,7 +8691,6 @@ def test_sanitize_user_prompt_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.SanitizeUserPromptRequest() - assert args[0] == request_msg @@ -8703,7 +8712,6 @@ def test_sanitize_model_response_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.SanitizeModelResponseRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-monitoring-metrics-scopes/noxfile.py b/packages/google-cloud-monitoring-metrics-scopes/noxfile.py index 3598c1863a6a..c28daef40ff2 100644 --- a/packages/google-cloud-monitoring-metrics-scopes/noxfile.py +++ b/packages/google-cloud-monitoring-metrics-scopes/noxfile.py @@ -47,7 +47,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-monitoring-metrics-scopes" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-monitoring-metrics-scopes/setup.py b/packages/google-cloud-monitoring-metrics-scopes/setup.py index 822ffcb860e9..00bd7975c4cb 100644 --- a/packages/google-cloud-monitoring-metrics-scopes/setup.py +++ b/packages/google-cloud-monitoring-metrics-scopes/setup.py @@ -45,7 +45,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/google-cloud-monitoring-metrics-scopes/testing/constraints-3.10.txt b/packages/google-cloud-monitoring-metrics-scopes/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-monitoring-metrics-scopes/testing/constraints-3.10.txt +++ b/packages/google-cloud-monitoring-metrics-scopes/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-monitoring-metrics-scopes/tests/unit/gapic/monitoring_metrics_scope_v1/test_metrics_scopes.py b/packages/google-cloud-monitoring-metrics-scopes/tests/unit/gapic/monitoring_metrics_scope_v1/test_metrics_scopes.py index 9c689ca60332..1bc601b54533 100644 --- a/packages/google-cloud-monitoring-metrics-scopes/tests/unit/gapic/monitoring_metrics_scope_v1/test_metrics_scopes.py +++ b/packages/google-cloud-monitoring-metrics-scopes/tests/unit/gapic/monitoring_metrics_scope_v1/test_metrics_scopes.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 @@ -110,6 +111,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" @@ -1297,8 +1313,8 @@ def test_metrics_scopes_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - metrics_scopes.GetMetricsScopeRequest, - dict, + metrics_scopes.GetMetricsScopeRequest(), + {}, ], ) def test_get_metrics_scope(request_type, transport: str = "grpc"): @@ -1309,7 +1325,7 @@ def test_get_metrics_scope(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1357,9 +1373,10 @@ def test_get_metrics_scope_non_empty_request_with_auto_populated_field(): client.get_metrics_scope(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metrics_scopes.GetMetricsScopeRequest( + request_msg = metrics_scopes.GetMetricsScopeRequest( name="name_value", ) + assert args[0] == request_msg def test_get_metrics_scope_use_cached_wrapped_rpc(): @@ -1442,9 +1459,14 @@ async def test_get_metrics_scope_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_metrics_scope_async( - transport: str = "grpc_asyncio", request_type=metrics_scopes.GetMetricsScopeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metrics_scopes.GetMetricsScopeRequest(), + {}, + ], +) +async def test_get_metrics_scope_async(request_type, transport: str = "grpc_asyncio"): client = MetricsScopesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1452,7 +1474,7 @@ async def test_get_metrics_scope_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( @@ -1477,11 +1499,6 @@ async def test_get_metrics_scope_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_metrics_scope_async_from_dict(): - await test_get_metrics_scope_async(request_type=dict) - - def test_get_metrics_scope_field_headers(): client = MetricsScopesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1636,8 +1653,8 @@ async def test_get_metrics_scope_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metrics_scopes.ListMetricsScopesByMonitoredProjectRequest, - dict, + metrics_scopes.ListMetricsScopesByMonitoredProjectRequest(), + {}, ], ) def test_list_metrics_scopes_by_monitored_project( @@ -1650,7 +1667,7 @@ def test_list_metrics_scopes_by_monitored_project( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1697,9 +1714,10 @@ def test_list_metrics_scopes_by_monitored_project_non_empty_request_with_auto_po client.list_metrics_scopes_by_monitored_project(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metrics_scopes.ListMetricsScopesByMonitoredProjectRequest( + request_msg = metrics_scopes.ListMetricsScopesByMonitoredProjectRequest( monitored_resource_container="monitored_resource_container_value", ) + assert args[0] == request_msg def test_list_metrics_scopes_by_monitored_project_use_cached_wrapped_rpc(): @@ -1785,9 +1803,15 @@ async def test_list_metrics_scopes_by_monitored_project_async_use_cached_wrapped @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + metrics_scopes.ListMetricsScopesByMonitoredProjectRequest(), + {}, + ], +) async def test_list_metrics_scopes_by_monitored_project_async( - transport: str = "grpc_asyncio", - request_type=metrics_scopes.ListMetricsScopesByMonitoredProjectRequest, + request_type, transport: str = "grpc_asyncio" ): client = MetricsScopesAsyncClient( credentials=async_anonymous_credentials(), @@ -1796,7 +1820,7 @@ async def test_list_metrics_scopes_by_monitored_project_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( @@ -1820,16 +1844,11 @@ async def test_list_metrics_scopes_by_monitored_project_async( ) -@pytest.mark.asyncio -async def test_list_metrics_scopes_by_monitored_project_async_from_dict(): - await test_list_metrics_scopes_by_monitored_project_async(request_type=dict) - - @pytest.mark.parametrize( "request_type", [ - metrics_scopes.CreateMonitoredProjectRequest, - dict, + metrics_scopes.CreateMonitoredProjectRequest(), + {}, ], ) def test_create_monitored_project(request_type, transport: str = "grpc"): @@ -1840,7 +1859,7 @@ def test_create_monitored_project(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1885,9 +1904,10 @@ def test_create_monitored_project_non_empty_request_with_auto_populated_field(): client.create_monitored_project(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metrics_scopes.CreateMonitoredProjectRequest( + request_msg = metrics_scopes.CreateMonitoredProjectRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_monitored_project_use_cached_wrapped_rpc(): @@ -1983,9 +2003,15 @@ async def test_create_monitored_project_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + metrics_scopes.CreateMonitoredProjectRequest(), + {}, + ], +) async def test_create_monitored_project_async( - transport: str = "grpc_asyncio", - request_type=metrics_scopes.CreateMonitoredProjectRequest, + request_type, transport: str = "grpc_asyncio" ): client = MetricsScopesAsyncClient( credentials=async_anonymous_credentials(), @@ -1994,7 +2020,7 @@ async def test_create_monitored_project_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( @@ -2016,11 +2042,6 @@ async def test_create_monitored_project_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_monitored_project_async_from_dict(): - await test_create_monitored_project_async(request_type=dict) - - def test_create_monitored_project_field_headers(): client = MetricsScopesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2185,8 +2206,8 @@ async def test_create_monitored_project_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metrics_scopes.DeleteMonitoredProjectRequest, - dict, + metrics_scopes.DeleteMonitoredProjectRequest(), + {}, ], ) def test_delete_monitored_project(request_type, transport: str = "grpc"): @@ -2197,7 +2218,7 @@ def test_delete_monitored_project(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2242,9 +2263,10 @@ def test_delete_monitored_project_non_empty_request_with_auto_populated_field(): client.delete_monitored_project(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metrics_scopes.DeleteMonitoredProjectRequest( + request_msg = metrics_scopes.DeleteMonitoredProjectRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_monitored_project_use_cached_wrapped_rpc(): @@ -2340,9 +2362,15 @@ async def test_delete_monitored_project_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + metrics_scopes.DeleteMonitoredProjectRequest(), + {}, + ], +) async def test_delete_monitored_project_async( - transport: str = "grpc_asyncio", - request_type=metrics_scopes.DeleteMonitoredProjectRequest, + request_type, transport: str = "grpc_asyncio" ): client = MetricsScopesAsyncClient( credentials=async_anonymous_credentials(), @@ -2351,7 +2379,7 @@ async def test_delete_monitored_project_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( @@ -2373,11 +2401,6 @@ async def test_delete_monitored_project_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_monitored_project_async_from_dict(): - await test_delete_monitored_project_async(request_type=dict) - - def test_delete_monitored_project_field_headers(): client = MetricsScopesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2653,7 +2676,6 @@ def test_get_metrics_scope_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metrics_scopes.GetMetricsScopeRequest() - assert args[0] == request_msg @@ -2676,7 +2698,6 @@ def test_list_metrics_scopes_by_monitored_project_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metrics_scopes.ListMetricsScopesByMonitoredProjectRequest() - assert args[0] == request_msg @@ -2699,7 +2720,6 @@ def test_create_monitored_project_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metrics_scopes.CreateMonitoredProjectRequest() - assert args[0] == request_msg @@ -2722,7 +2742,6 @@ def test_delete_monitored_project_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metrics_scopes.DeleteMonitoredProjectRequest() - assert args[0] == request_msg @@ -2765,7 +2784,6 @@ async def test_get_metrics_scope_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metrics_scopes.GetMetricsScopeRequest() - assert args[0] == request_msg @@ -2792,7 +2810,6 @@ async def test_list_metrics_scopes_by_monitored_project_empty_call_grpc_asyncio( call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metrics_scopes.ListMetricsScopesByMonitoredProjectRequest() - assert args[0] == request_msg @@ -2819,7 +2836,6 @@ async def test_create_monitored_project_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metrics_scopes.CreateMonitoredProjectRequest() - assert args[0] == request_msg @@ -2846,7 +2862,6 @@ async def test_delete_monitored_project_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metrics_scopes.DeleteMonitoredProjectRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-monitoring/noxfile.py b/packages/google-cloud-monitoring/noxfile.py index 613ef3e273b0..ed53a8853665 100644 --- a/packages/google-cloud-monitoring/noxfile.py +++ b/packages/google-cloud-monitoring/noxfile.py @@ -47,7 +47,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-monitoring" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -469,14 +474,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -588,14 +585,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-monitoring/setup.py b/packages/google-cloud-monitoring/setup.py index 2036451eb43a..e549aed6fc15 100644 --- a/packages/google-cloud-monitoring/setup.py +++ b/packages/google-cloud-monitoring/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/google-cloud-monitoring/testing/constraints-3.10.txt b/packages/google-cloud-monitoring/testing/constraints-3.10.txt index 99b40dadf3bd..d335f6419cf8 100644 --- a/packages/google-cloud-monitoring/testing/constraints-3.10.txt +++ b/packages/google-cloud-monitoring/testing/constraints-3.10.txt @@ -8,6 +8,6 @@ google-api-core==2.17.1 pandas==1.3.4 numpy==1.21.3 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-monitoring/tests/unit/gapic/monitoring_v3/test_alert_policy_service.py b/packages/google-cloud-monitoring/tests/unit/gapic/monitoring_v3/test_alert_policy_service.py index d76635404b73..2a06c5cf0787 100644 --- a/packages/google-cloud-monitoring/tests/unit/gapic/monitoring_v3/test_alert_policy_service.py +++ b/packages/google-cloud-monitoring/tests/unit/gapic/monitoring_v3/test_alert_policy_service.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 @@ -117,6 +118,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" @@ -1334,8 +1350,8 @@ def test_alert_policy_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - alert_service.ListAlertPoliciesRequest, - dict, + alert_service.ListAlertPoliciesRequest(), + {}, ], ) def test_list_alert_policies(request_type, transport: str = "grpc"): @@ -1346,7 +1362,7 @@ def test_list_alert_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( @@ -1399,12 +1415,13 @@ def test_list_alert_policies_non_empty_request_with_auto_populated_field(): client.list_alert_policies(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == alert_service.ListAlertPoliciesRequest( + request_msg = alert_service.ListAlertPoliciesRequest( name="name_value", filter="filter_value", order_by="order_by_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_alert_policies_use_cached_wrapped_rpc(): @@ -1489,9 +1506,14 @@ async def test_list_alert_policies_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_alert_policies_async( - transport: str = "grpc_asyncio", request_type=alert_service.ListAlertPoliciesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + alert_service.ListAlertPoliciesRequest(), + {}, + ], +) +async def test_list_alert_policies_async(request_type, transport: str = "grpc_asyncio"): client = AlertPolicyServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1499,7 +1521,7 @@ async def test_list_alert_policies_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( @@ -1526,11 +1548,6 @@ async def test_list_alert_policies_async( assert response.total_size == 1086 -@pytest.mark.asyncio -async def test_list_alert_policies_async_from_dict(): - await test_list_alert_policies_async(request_type=dict) - - def test_list_alert_policies_field_headers(): client = AlertPolicyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1883,8 +1900,8 @@ async def test_list_alert_policies_async_pages(): @pytest.mark.parametrize( "request_type", [ - alert_service.GetAlertPolicyRequest, - dict, + alert_service.GetAlertPolicyRequest(), + {}, ], ) def test_get_alert_policy(request_type, transport: str = "grpc"): @@ -1895,7 +1912,7 @@ def test_get_alert_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(type(client.transport.get_alert_policy), "__call__") as call: @@ -1947,9 +1964,10 @@ def test_get_alert_policy_non_empty_request_with_auto_populated_field(): client.get_alert_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == alert_service.GetAlertPolicyRequest( + request_msg = alert_service.GetAlertPolicyRequest( name="name_value", ) + assert args[0] == request_msg def test_get_alert_policy_use_cached_wrapped_rpc(): @@ -2032,9 +2050,14 @@ async def test_get_alert_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_alert_policy_async( - transport: str = "grpc_asyncio", request_type=alert_service.GetAlertPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + alert_service.GetAlertPolicyRequest(), + {}, + ], +) +async def test_get_alert_policy_async(request_type, transport: str = "grpc_asyncio"): client = AlertPolicyServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2042,7 +2065,7 @@ async def test_get_alert_policy_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_alert_policy), "__call__") as call: @@ -2073,11 +2096,6 @@ async def test_get_alert_policy_async( assert response.severity == alert.AlertPolicy.Severity.CRITICAL -@pytest.mark.asyncio -async def test_get_alert_policy_async_from_dict(): - await test_get_alert_policy_async(request_type=dict) - - def test_get_alert_policy_field_headers(): client = AlertPolicyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2220,8 +2238,8 @@ async def test_get_alert_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - alert_service.CreateAlertPolicyRequest, - dict, + alert_service.CreateAlertPolicyRequest(), + {}, ], ) def test_create_alert_policy(request_type, transport: str = "grpc"): @@ -2232,7 +2250,7 @@ def test_create_alert_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( @@ -2288,9 +2306,10 @@ def test_create_alert_policy_non_empty_request_with_auto_populated_field(): client.create_alert_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == alert_service.CreateAlertPolicyRequest( + request_msg = alert_service.CreateAlertPolicyRequest( name="name_value", ) + assert args[0] == request_msg def test_create_alert_policy_use_cached_wrapped_rpc(): @@ -2375,9 +2394,14 @@ async def test_create_alert_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_alert_policy_async( - transport: str = "grpc_asyncio", request_type=alert_service.CreateAlertPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + alert_service.CreateAlertPolicyRequest(), + {}, + ], +) +async def test_create_alert_policy_async(request_type, transport: str = "grpc_asyncio"): client = AlertPolicyServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2385,7 +2409,7 @@ async def test_create_alert_policy_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( @@ -2418,11 +2442,6 @@ async def test_create_alert_policy_async( assert response.severity == alert.AlertPolicy.Severity.CRITICAL -@pytest.mark.asyncio -async def test_create_alert_policy_async_from_dict(): - await test_create_alert_policy_async(request_type=dict) - - def test_create_alert_policy_field_headers(): client = AlertPolicyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2583,8 +2602,8 @@ async def test_create_alert_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - alert_service.DeleteAlertPolicyRequest, - dict, + alert_service.DeleteAlertPolicyRequest(), + {}, ], ) def test_delete_alert_policy(request_type, transport: str = "grpc"): @@ -2595,7 +2614,7 @@ def test_delete_alert_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( @@ -2640,9 +2659,10 @@ def test_delete_alert_policy_non_empty_request_with_auto_populated_field(): client.delete_alert_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == alert_service.DeleteAlertPolicyRequest( + request_msg = alert_service.DeleteAlertPolicyRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_alert_policy_use_cached_wrapped_rpc(): @@ -2727,9 +2747,14 @@ async def test_delete_alert_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_alert_policy_async( - transport: str = "grpc_asyncio", request_type=alert_service.DeleteAlertPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + alert_service.DeleteAlertPolicyRequest(), + {}, + ], +) +async def test_delete_alert_policy_async(request_type, transport: str = "grpc_asyncio"): client = AlertPolicyServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2737,7 +2762,7 @@ async def test_delete_alert_policy_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( @@ -2757,11 +2782,6 @@ async def test_delete_alert_policy_async( assert response is None -@pytest.mark.asyncio -async def test_delete_alert_policy_async_from_dict(): - await test_delete_alert_policy_async(request_type=dict) - - def test_delete_alert_policy_field_headers(): client = AlertPolicyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2912,8 +2932,8 @@ async def test_delete_alert_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - alert_service.UpdateAlertPolicyRequest, - dict, + alert_service.UpdateAlertPolicyRequest(), + {}, ], ) def test_update_alert_policy(request_type, transport: str = "grpc"): @@ -2924,7 +2944,7 @@ def test_update_alert_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( @@ -2978,7 +2998,8 @@ def test_update_alert_policy_non_empty_request_with_auto_populated_field(): client.update_alert_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == alert_service.UpdateAlertPolicyRequest() + request_msg = alert_service.UpdateAlertPolicyRequest() + assert args[0] == request_msg def test_update_alert_policy_use_cached_wrapped_rpc(): @@ -3063,9 +3084,14 @@ async def test_update_alert_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_alert_policy_async( - transport: str = "grpc_asyncio", request_type=alert_service.UpdateAlertPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + alert_service.UpdateAlertPolicyRequest(), + {}, + ], +) +async def test_update_alert_policy_async(request_type, transport: str = "grpc_asyncio"): client = AlertPolicyServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3073,7 +3099,7 @@ async def test_update_alert_policy_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( @@ -3106,11 +3132,6 @@ async def test_update_alert_policy_async( assert response.severity == alert.AlertPolicy.Severity.CRITICAL -@pytest.mark.asyncio -async def test_update_alert_policy_async_from_dict(): - await test_update_alert_policy_async(request_type=dict) - - def test_update_alert_policy_field_headers(): client = AlertPolicyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3392,7 +3413,6 @@ def test_list_alert_policies_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = alert_service.ListAlertPoliciesRequest() - assert args[0] == request_msg @@ -3413,7 +3433,6 @@ def test_get_alert_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = alert_service.GetAlertPolicyRequest() - assert args[0] == request_msg @@ -3436,7 +3455,6 @@ def test_create_alert_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = alert_service.CreateAlertPolicyRequest() - assert args[0] == request_msg @@ -3459,7 +3477,6 @@ def test_delete_alert_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = alert_service.DeleteAlertPolicyRequest() - assert args[0] == request_msg @@ -3482,7 +3499,6 @@ def test_update_alert_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = alert_service.UpdateAlertPolicyRequest() - assert args[0] == request_msg @@ -3526,7 +3542,6 @@ async def test_list_alert_policies_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = alert_service.ListAlertPoliciesRequest() - assert args[0] == request_msg @@ -3557,7 +3572,6 @@ async def test_get_alert_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = alert_service.GetAlertPolicyRequest() - assert args[0] == request_msg @@ -3590,7 +3604,6 @@ async def test_create_alert_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = alert_service.CreateAlertPolicyRequest() - assert args[0] == request_msg @@ -3615,7 +3628,6 @@ async def test_delete_alert_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = alert_service.DeleteAlertPolicyRequest() - assert args[0] == request_msg @@ -3648,7 +3660,6 @@ async def test_update_alert_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = alert_service.UpdateAlertPolicyRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-monitoring/tests/unit/gapic/monitoring_v3/test_group_service.py b/packages/google-cloud-monitoring/tests/unit/gapic/monitoring_v3/test_group_service.py index 84c9bf991d10..6491aed75023 100644 --- a/packages/google-cloud-monitoring/tests/unit/gapic/monitoring_v3/test_group_service.py +++ b/packages/google-cloud-monitoring/tests/unit/gapic/monitoring_v3/test_group_service.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 @@ -108,6 +109,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" @@ -1275,8 +1291,8 @@ def test_group_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - group_service.ListGroupsRequest, - dict, + group_service.ListGroupsRequest(), + {}, ], ) def test_list_groups(request_type, transport: str = "grpc"): @@ -1287,7 +1303,7 @@ def test_list_groups(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_groups), "__call__") as call: @@ -1335,13 +1351,14 @@ def test_list_groups_non_empty_request_with_auto_populated_field(): client.list_groups(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == group_service.ListGroupsRequest( + request_msg = group_service.ListGroupsRequest( name="name_value", children_of_group="children_of_group_value", ancestors_of_group="ancestors_of_group_value", descendants_of_group="descendants_of_group_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_groups_use_cached_wrapped_rpc(): @@ -1422,9 +1439,14 @@ async def test_list_groups_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_groups_async( - transport: str = "grpc_asyncio", request_type=group_service.ListGroupsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + group_service.ListGroupsRequest(), + {}, + ], +) +async def test_list_groups_async(request_type, transport: str = "grpc_asyncio"): client = GroupServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1432,7 +1454,7 @@ async def test_list_groups_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_groups), "__call__") as call: @@ -1455,11 +1477,6 @@ async def test_list_groups_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_groups_async_from_dict(): - await test_list_groups_async(request_type=dict) - - def test_list_groups_field_headers(): client = GroupServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1796,8 +1813,8 @@ async def test_list_groups_async_pages(): @pytest.mark.parametrize( "request_type", [ - group_service.GetGroupRequest, - dict, + group_service.GetGroupRequest(), + {}, ], ) def test_get_group(request_type, transport: str = "grpc"): @@ -1808,7 +1825,7 @@ def test_get_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_group), "__call__") as call: @@ -1860,9 +1877,10 @@ def test_get_group_non_empty_request_with_auto_populated_field(): client.get_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == group_service.GetGroupRequest( + request_msg = group_service.GetGroupRequest( name="name_value", ) + assert args[0] == request_msg def test_get_group_use_cached_wrapped_rpc(): @@ -1941,9 +1959,14 @@ async def test_get_group_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_group_async( - transport: str = "grpc_asyncio", request_type=group_service.GetGroupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + group_service.GetGroupRequest(), + {}, + ], +) +async def test_get_group_async(request_type, transport: str = "grpc_asyncio"): client = GroupServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1951,7 +1974,7 @@ async def test_get_group_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_group), "__call__") as call: @@ -1982,11 +2005,6 @@ async def test_get_group_async( assert response.is_cluster is True -@pytest.mark.asyncio -async def test_get_group_async_from_dict(): - await test_get_group_async(request_type=dict) - - def test_get_group_field_headers(): client = GroupServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2129,8 +2147,8 @@ async def test_get_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - group_service.CreateGroupRequest, - dict, + group_service.CreateGroupRequest(), + {}, ], ) def test_create_group(request_type, transport: str = "grpc"): @@ -2141,7 +2159,7 @@ def test_create_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_group), "__call__") as call: @@ -2193,9 +2211,10 @@ def test_create_group_non_empty_request_with_auto_populated_field(): client.create_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == group_service.CreateGroupRequest( + request_msg = group_service.CreateGroupRequest( name="name_value", ) + assert args[0] == request_msg def test_create_group_use_cached_wrapped_rpc(): @@ -2276,9 +2295,14 @@ async def test_create_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_group_async( - transport: str = "grpc_asyncio", request_type=group_service.CreateGroupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + group_service.CreateGroupRequest(), + {}, + ], +) +async def test_create_group_async(request_type, transport: str = "grpc_asyncio"): client = GroupServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2286,7 +2310,7 @@ async def test_create_group_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_group), "__call__") as call: @@ -2317,11 +2341,6 @@ async def test_create_group_async( assert response.is_cluster is True -@pytest.mark.asyncio -async def test_create_group_async_from_dict(): - await test_create_group_async(request_type=dict) - - def test_create_group_field_headers(): client = GroupServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2474,8 +2493,8 @@ async def test_create_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - group_service.UpdateGroupRequest, - dict, + group_service.UpdateGroupRequest(), + {}, ], ) def test_update_group(request_type, transport: str = "grpc"): @@ -2486,7 +2505,7 @@ def test_update_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_group), "__call__") as call: @@ -2536,7 +2555,8 @@ def test_update_group_non_empty_request_with_auto_populated_field(): client.update_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == group_service.UpdateGroupRequest() + request_msg = group_service.UpdateGroupRequest() + assert args[0] == request_msg def test_update_group_use_cached_wrapped_rpc(): @@ -2617,9 +2637,14 @@ async def test_update_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_group_async( - transport: str = "grpc_asyncio", request_type=group_service.UpdateGroupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + group_service.UpdateGroupRequest(), + {}, + ], +) +async def test_update_group_async(request_type, transport: str = "grpc_asyncio"): client = GroupServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2627,7 +2652,7 @@ async def test_update_group_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_group), "__call__") as call: @@ -2658,11 +2683,6 @@ async def test_update_group_async( assert response.is_cluster is True -@pytest.mark.asyncio -async def test_update_group_async_from_dict(): - await test_update_group_async(request_type=dict) - - def test_update_group_field_headers(): client = GroupServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2805,8 +2825,8 @@ async def test_update_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - group_service.DeleteGroupRequest, - dict, + group_service.DeleteGroupRequest(), + {}, ], ) def test_delete_group(request_type, transport: str = "grpc"): @@ -2817,7 +2837,7 @@ def test_delete_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_group), "__call__") as call: @@ -2858,9 +2878,10 @@ def test_delete_group_non_empty_request_with_auto_populated_field(): client.delete_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == group_service.DeleteGroupRequest( + request_msg = group_service.DeleteGroupRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_group_use_cached_wrapped_rpc(): @@ -2941,9 +2962,14 @@ async def test_delete_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_group_async( - transport: str = "grpc_asyncio", request_type=group_service.DeleteGroupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + group_service.DeleteGroupRequest(), + {}, + ], +) +async def test_delete_group_async(request_type, transport: str = "grpc_asyncio"): client = GroupServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2951,7 +2977,7 @@ async def test_delete_group_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_group), "__call__") as call: @@ -2969,11 +2995,6 @@ async def test_delete_group_async( assert response is None -@pytest.mark.asyncio -async def test_delete_group_async_from_dict(): - await test_delete_group_async(request_type=dict) - - def test_delete_group_field_headers(): client = GroupServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3116,8 +3137,8 @@ async def test_delete_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - group_service.ListGroupMembersRequest, - dict, + group_service.ListGroupMembersRequest(), + {}, ], ) def test_list_group_members(request_type, transport: str = "grpc"): @@ -3128,7 +3149,7 @@ def test_list_group_members(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3180,11 +3201,12 @@ def test_list_group_members_non_empty_request_with_auto_populated_field(): client.list_group_members(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == group_service.ListGroupMembersRequest( + request_msg = group_service.ListGroupMembersRequest( name="name_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_group_members_use_cached_wrapped_rpc(): @@ -3269,9 +3291,14 @@ async def test_list_group_members_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_group_members_async( - transport: str = "grpc_asyncio", request_type=group_service.ListGroupMembersRequest -): +@pytest.mark.parametrize( + "request_type", + [ + group_service.ListGroupMembersRequest(), + {}, + ], +) +async def test_list_group_members_async(request_type, transport: str = "grpc_asyncio"): client = GroupServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3279,7 +3306,7 @@ async def test_list_group_members_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( @@ -3306,11 +3333,6 @@ async def test_list_group_members_async( assert response.total_size == 1086 -@pytest.mark.asyncio -async def test_list_group_members_async_from_dict(): - await test_list_group_members_async(request_type=dict) - - def test_list_group_members_field_headers(): client = GroupServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3786,7 +3808,6 @@ def test_list_groups_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = group_service.ListGroupsRequest() - assert args[0] == request_msg @@ -3807,7 +3828,6 @@ def test_get_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = group_service.GetGroupRequest() - assert args[0] == request_msg @@ -3828,7 +3848,6 @@ def test_create_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = group_service.CreateGroupRequest() - assert args[0] == request_msg @@ -3849,7 +3868,6 @@ def test_update_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = group_service.UpdateGroupRequest() - assert args[0] == request_msg @@ -3870,7 +3888,6 @@ def test_delete_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = group_service.DeleteGroupRequest() - assert args[0] == request_msg @@ -3893,7 +3910,6 @@ def test_list_group_members_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = group_service.ListGroupMembersRequest() - assert args[0] == request_msg @@ -3934,7 +3950,6 @@ async def test_list_groups_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = group_service.ListGroupsRequest() - assert args[0] == request_msg @@ -3965,7 +3980,6 @@ async def test_get_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = group_service.GetGroupRequest() - assert args[0] == request_msg @@ -3996,7 +4010,6 @@ async def test_create_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = group_service.CreateGroupRequest() - assert args[0] == request_msg @@ -4027,7 +4040,6 @@ async def test_update_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = group_service.UpdateGroupRequest() - assert args[0] == request_msg @@ -4050,7 +4062,6 @@ async def test_delete_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = group_service.DeleteGroupRequest() - assert args[0] == request_msg @@ -4080,7 +4091,6 @@ async def test_list_group_members_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = group_service.ListGroupMembersRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-monitoring/tests/unit/gapic/monitoring_v3/test_metric_service.py b/packages/google-cloud-monitoring/tests/unit/gapic/monitoring_v3/test_metric_service.py index b7d0f4949e58..cbfb669bb81c 100644 --- a/packages/google-cloud-monitoring/tests/unit/gapic/monitoring_v3/test_metric_service.py +++ b/packages/google-cloud-monitoring/tests/unit/gapic/monitoring_v3/test_metric_service.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 @@ -115,6 +116,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" @@ -1302,8 +1318,8 @@ def test_metric_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - metric_service.ListMonitoredResourceDescriptorsRequest, - dict, + metric_service.ListMonitoredResourceDescriptorsRequest(), + {}, ], ) def test_list_monitored_resource_descriptors(request_type, transport: str = "grpc"): @@ -1314,7 +1330,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( @@ -1364,11 +1380,12 @@ 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] == metric_service.ListMonitoredResourceDescriptorsRequest( + request_msg = metric_service.ListMonitoredResourceDescriptorsRequest( name="name_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_monitored_resource_descriptors_use_cached_wrapped_rpc(): @@ -1454,9 +1471,15 @@ async def test_list_monitored_resource_descriptors_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + metric_service.ListMonitoredResourceDescriptorsRequest(), + {}, + ], +) async def test_list_monitored_resource_descriptors_async( - transport: str = "grpc_asyncio", - request_type=metric_service.ListMonitoredResourceDescriptorsRequest, + request_type, transport: str = "grpc_asyncio" ): client = MetricServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1465,7 +1488,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( @@ -1490,11 +1513,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_field_headers(): client = MetricServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1857,8 +1875,8 @@ async def test_list_monitored_resource_descriptors_async_pages(): @pytest.mark.parametrize( "request_type", [ - metric_service.GetMonitoredResourceDescriptorRequest, - dict, + metric_service.GetMonitoredResourceDescriptorRequest(), + {}, ], ) def test_get_monitored_resource_descriptor(request_type, transport: str = "grpc"): @@ -1869,7 +1887,7 @@ def test_get_monitored_resource_descriptor(request_type, transport: str = "grpc" # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1925,9 +1943,10 @@ def test_get_monitored_resource_descriptor_non_empty_request_with_auto_populated client.get_monitored_resource_descriptor(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metric_service.GetMonitoredResourceDescriptorRequest( + request_msg = metric_service.GetMonitoredResourceDescriptorRequest( name="name_value", ) + assert args[0] == request_msg def test_get_monitored_resource_descriptor_use_cached_wrapped_rpc(): @@ -2013,9 +2032,15 @@ async def test_get_monitored_resource_descriptor_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + metric_service.GetMonitoredResourceDescriptorRequest(), + {}, + ], +) async def test_get_monitored_resource_descriptor_async( - transport: str = "grpc_asyncio", - request_type=metric_service.GetMonitoredResourceDescriptorRequest, + request_type, transport: str = "grpc_asyncio" ): client = MetricServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2024,7 +2049,7 @@ async def test_get_monitored_resource_descriptor_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( @@ -2057,11 +2082,6 @@ async def test_get_monitored_resource_descriptor_async( assert response.launch_stage == launch_stage_pb2.LaunchStage.UNIMPLEMENTED -@pytest.mark.asyncio -async def test_get_monitored_resource_descriptor_async_from_dict(): - await test_get_monitored_resource_descriptor_async(request_type=dict) - - def test_get_monitored_resource_descriptor_field_headers(): client = MetricServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2216,8 +2236,8 @@ async def test_get_monitored_resource_descriptor_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metric_service.ListMetricDescriptorsRequest, - dict, + metric_service.ListMetricDescriptorsRequest(), + {}, ], ) def test_list_metric_descriptors(request_type, transport: str = "grpc"): @@ -2228,7 +2248,7 @@ def test_list_metric_descriptors(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2278,11 +2298,12 @@ def test_list_metric_descriptors_non_empty_request_with_auto_populated_field(): client.list_metric_descriptors(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metric_service.ListMetricDescriptorsRequest( + request_msg = metric_service.ListMetricDescriptorsRequest( name="name_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_metric_descriptors_use_cached_wrapped_rpc(): @@ -2368,9 +2389,15 @@ async def test_list_metric_descriptors_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + metric_service.ListMetricDescriptorsRequest(), + {}, + ], +) async def test_list_metric_descriptors_async( - transport: str = "grpc_asyncio", - request_type=metric_service.ListMetricDescriptorsRequest, + request_type, transport: str = "grpc_asyncio" ): client = MetricServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2379,7 +2406,7 @@ async def test_list_metric_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( @@ -2404,11 +2431,6 @@ async def test_list_metric_descriptors_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_metric_descriptors_async_from_dict(): - await test_list_metric_descriptors_async(request_type=dict) - - def test_list_metric_descriptors_field_headers(): client = MetricServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2761,8 +2783,8 @@ async def test_list_metric_descriptors_async_pages(): @pytest.mark.parametrize( "request_type", [ - metric_service.GetMetricDescriptorRequest, - dict, + metric_service.GetMetricDescriptorRequest(), + {}, ], ) def test_get_metric_descriptor(request_type, transport: str = "grpc"): @@ -2773,7 +2795,7 @@ def test_get_metric_descriptor(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2837,9 +2859,10 @@ def test_get_metric_descriptor_non_empty_request_with_auto_populated_field(): client.get_metric_descriptor(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metric_service.GetMetricDescriptorRequest( + request_msg = metric_service.GetMetricDescriptorRequest( name="name_value", ) + assert args[0] == request_msg def test_get_metric_descriptor_use_cached_wrapped_rpc(): @@ -2925,9 +2948,15 @@ async def test_get_metric_descriptor_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + metric_service.GetMetricDescriptorRequest(), + {}, + ], +) async def test_get_metric_descriptor_async( - transport: str = "grpc_asyncio", - request_type=metric_service.GetMetricDescriptorRequest, + request_type, transport: str = "grpc_asyncio" ): client = MetricServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2936,7 +2965,7 @@ async def test_get_metric_descriptor_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( @@ -2977,11 +3006,6 @@ async def test_get_metric_descriptor_async( assert response.monitored_resource_types == ["monitored_resource_types_value"] -@pytest.mark.asyncio -async def test_get_metric_descriptor_async_from_dict(): - await test_get_metric_descriptor_async(request_type=dict) - - def test_get_metric_descriptor_field_headers(): client = MetricServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3136,8 +3160,8 @@ async def test_get_metric_descriptor_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metric_service.CreateMetricDescriptorRequest, - dict, + metric_service.CreateMetricDescriptorRequest(), + {}, ], ) def test_create_metric_descriptor(request_type, transport: str = "grpc"): @@ -3148,7 +3172,7 @@ def test_create_metric_descriptor(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3212,9 +3236,10 @@ def test_create_metric_descriptor_non_empty_request_with_auto_populated_field(): client.create_metric_descriptor(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metric_service.CreateMetricDescriptorRequest( + request_msg = metric_service.CreateMetricDescriptorRequest( name="name_value", ) + assert args[0] == request_msg def test_create_metric_descriptor_use_cached_wrapped_rpc(): @@ -3300,9 +3325,15 @@ async def test_create_metric_descriptor_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + metric_service.CreateMetricDescriptorRequest(), + {}, + ], +) async def test_create_metric_descriptor_async( - transport: str = "grpc_asyncio", - request_type=metric_service.CreateMetricDescriptorRequest, + request_type, transport: str = "grpc_asyncio" ): client = MetricServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3311,7 +3342,7 @@ async def test_create_metric_descriptor_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( @@ -3352,11 +3383,6 @@ async def test_create_metric_descriptor_async( assert response.monitored_resource_types == ["monitored_resource_types_value"] -@pytest.mark.asyncio -async def test_create_metric_descriptor_async_from_dict(): - await test_create_metric_descriptor_async(request_type=dict) - - def test_create_metric_descriptor_field_headers(): client = MetricServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3521,8 +3547,8 @@ async def test_create_metric_descriptor_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metric_service.DeleteMetricDescriptorRequest, - dict, + metric_service.DeleteMetricDescriptorRequest(), + {}, ], ) def test_delete_metric_descriptor(request_type, transport: str = "grpc"): @@ -3533,7 +3559,7 @@ def test_delete_metric_descriptor(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3578,9 +3604,10 @@ def test_delete_metric_descriptor_non_empty_request_with_auto_populated_field(): client.delete_metric_descriptor(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metric_service.DeleteMetricDescriptorRequest( + request_msg = metric_service.DeleteMetricDescriptorRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_metric_descriptor_use_cached_wrapped_rpc(): @@ -3666,9 +3693,15 @@ async def test_delete_metric_descriptor_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + metric_service.DeleteMetricDescriptorRequest(), + {}, + ], +) async def test_delete_metric_descriptor_async( - transport: str = "grpc_asyncio", - request_type=metric_service.DeleteMetricDescriptorRequest, + request_type, transport: str = "grpc_asyncio" ): client = MetricServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3677,7 +3710,7 @@ async def test_delete_metric_descriptor_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( @@ -3697,11 +3730,6 @@ async def test_delete_metric_descriptor_async( assert response is None -@pytest.mark.asyncio -async def test_delete_metric_descriptor_async_from_dict(): - await test_delete_metric_descriptor_async(request_type=dict) - - def test_delete_metric_descriptor_field_headers(): client = MetricServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3852,8 +3880,8 @@ async def test_delete_metric_descriptor_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metric_service.ListTimeSeriesRequest, - dict, + metric_service.ListTimeSeriesRequest(), + {}, ], ) def test_list_time_series(request_type, transport: str = "grpc"): @@ -3864,7 +3892,7 @@ def test_list_time_series(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_time_series), "__call__") as call: @@ -3913,12 +3941,13 @@ def test_list_time_series_non_empty_request_with_auto_populated_field(): client.list_time_series(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metric_service.ListTimeSeriesRequest( + request_msg = metric_service.ListTimeSeriesRequest( name="name_value", filter="filter_value", order_by="order_by_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_time_series_use_cached_wrapped_rpc(): @@ -4001,9 +4030,14 @@ async def test_list_time_series_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_time_series_async( - transport: str = "grpc_asyncio", request_type=metric_service.ListTimeSeriesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metric_service.ListTimeSeriesRequest(), + {}, + ], +) +async def test_list_time_series_async(request_type, transport: str = "grpc_asyncio"): client = MetricServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4011,7 +4045,7 @@ async def test_list_time_series_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_time_series), "__call__") as call: @@ -4036,11 +4070,6 @@ async def test_list_time_series_async( assert response.unit == "unit_value" -@pytest.mark.asyncio -async def test_list_time_series_async_from_dict(): - await test_list_time_series_async(request_type=dict) - - def test_list_time_series_field_headers(): client = MetricServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4407,8 +4436,8 @@ async def test_list_time_series_async_pages(): @pytest.mark.parametrize( "request_type", [ - metric_service.CreateTimeSeriesRequest, - dict, + metric_service.CreateTimeSeriesRequest(), + {}, ], ) def test_create_time_series(request_type, transport: str = "grpc"): @@ -4419,7 +4448,7 @@ def test_create_time_series(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4464,9 +4493,10 @@ def test_create_time_series_non_empty_request_with_auto_populated_field(): client.create_time_series(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metric_service.CreateTimeSeriesRequest( + request_msg = metric_service.CreateTimeSeriesRequest( name="name_value", ) + assert args[0] == request_msg def test_create_time_series_use_cached_wrapped_rpc(): @@ -4551,9 +4581,14 @@ async def test_create_time_series_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_time_series_async( - transport: str = "grpc_asyncio", request_type=metric_service.CreateTimeSeriesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metric_service.CreateTimeSeriesRequest(), + {}, + ], +) +async def test_create_time_series_async(request_type, transport: str = "grpc_asyncio"): client = MetricServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4561,7 +4596,7 @@ async def test_create_time_series_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( @@ -4581,11 +4616,6 @@ async def test_create_time_series_async( assert response is None -@pytest.mark.asyncio -async def test_create_time_series_async_from_dict(): - await test_create_time_series_async(request_type=dict) - - def test_create_time_series_field_headers(): client = MetricServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4754,8 +4784,8 @@ async def test_create_time_series_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - metric_service.CreateTimeSeriesRequest, - dict, + metric_service.CreateTimeSeriesRequest(), + {}, ], ) def test_create_service_time_series(request_type, transport: str = "grpc"): @@ -4766,7 +4796,7 @@ def test_create_service_time_series(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4811,9 +4841,10 @@ def test_create_service_time_series_non_empty_request_with_auto_populated_field( client.create_service_time_series(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metric_service.CreateTimeSeriesRequest( + request_msg = metric_service.CreateTimeSeriesRequest( name="name_value", ) + assert args[0] == request_msg def test_create_service_time_series_use_cached_wrapped_rpc(): @@ -4899,8 +4930,15 @@ async def test_create_service_time_series_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + metric_service.CreateTimeSeriesRequest(), + {}, + ], +) async def test_create_service_time_series_async( - transport: str = "grpc_asyncio", request_type=metric_service.CreateTimeSeriesRequest + request_type, transport: str = "grpc_asyncio" ): client = MetricServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4909,7 +4947,7 @@ async def test_create_service_time_series_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( @@ -4929,11 +4967,6 @@ async def test_create_service_time_series_async( assert response is None -@pytest.mark.asyncio -async def test_create_service_time_series_async_from_dict(): - await test_create_service_time_series_async(request_type=dict) - - def test_create_service_time_series_field_headers(): client = MetricServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5223,7 +5256,6 @@ def test_list_monitored_resource_descriptors_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metric_service.ListMonitoredResourceDescriptorsRequest() - assert args[0] == request_msg @@ -5246,7 +5278,6 @@ def test_get_monitored_resource_descriptor_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metric_service.GetMonitoredResourceDescriptorRequest() - assert args[0] == request_msg @@ -5269,7 +5300,6 @@ def test_list_metric_descriptors_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metric_service.ListMetricDescriptorsRequest() - assert args[0] == request_msg @@ -5292,7 +5322,6 @@ def test_get_metric_descriptor_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metric_service.GetMetricDescriptorRequest() - assert args[0] == request_msg @@ -5315,7 +5344,6 @@ def test_create_metric_descriptor_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metric_service.CreateMetricDescriptorRequest() - assert args[0] == request_msg @@ -5338,7 +5366,6 @@ def test_delete_metric_descriptor_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metric_service.DeleteMetricDescriptorRequest() - assert args[0] == request_msg @@ -5359,7 +5386,6 @@ def test_list_time_series_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metric_service.ListTimeSeriesRequest() - assert args[0] == request_msg @@ -5382,7 +5408,6 @@ def test_create_time_series_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metric_service.CreateTimeSeriesRequest() - assert args[0] == request_msg @@ -5405,7 +5430,6 @@ def test_create_service_time_series_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metric_service.CreateTimeSeriesRequest() - assert args[0] == request_msg @@ -5448,7 +5472,6 @@ async def test_list_monitored_resource_descriptors_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metric_service.ListMonitoredResourceDescriptorsRequest() - assert args[0] == request_msg @@ -5481,7 +5504,6 @@ async def test_get_monitored_resource_descriptor_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metric_service.GetMonitoredResourceDescriptorRequest() - assert args[0] == request_msg @@ -5510,7 +5532,6 @@ async def test_list_metric_descriptors_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metric_service.ListMetricDescriptorsRequest() - assert args[0] == request_msg @@ -5547,7 +5568,6 @@ async def test_get_metric_descriptor_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metric_service.GetMetricDescriptorRequest() - assert args[0] == request_msg @@ -5584,7 +5604,6 @@ async def test_create_metric_descriptor_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metric_service.CreateMetricDescriptorRequest() - assert args[0] == request_msg @@ -5609,7 +5628,6 @@ async def test_delete_metric_descriptor_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metric_service.DeleteMetricDescriptorRequest() - assert args[0] == request_msg @@ -5637,7 +5655,6 @@ async def test_list_time_series_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metric_service.ListTimeSeriesRequest() - assert args[0] == request_msg @@ -5662,7 +5679,6 @@ async def test_create_time_series_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metric_service.CreateTimeSeriesRequest() - assert args[0] == request_msg @@ -5687,7 +5703,6 @@ async def test_create_service_time_series_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metric_service.CreateTimeSeriesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-monitoring/tests/unit/gapic/monitoring_v3/test_notification_channel_service.py b/packages/google-cloud-monitoring/tests/unit/gapic/monitoring_v3/test_notification_channel_service.py index de3220b534d1..d22ab18c642c 100644 --- a/packages/google-cloud-monitoring/tests/unit/gapic/monitoring_v3/test_notification_channel_service.py +++ b/packages/google-cloud-monitoring/tests/unit/gapic/monitoring_v3/test_notification_channel_service.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 @@ -115,6 +116,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" @@ -1373,8 +1389,8 @@ def test_notification_channel_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - notification_service.ListNotificationChannelDescriptorsRequest, - dict, + notification_service.ListNotificationChannelDescriptorsRequest(), + {}, ], ) def test_list_notification_channel_descriptors(request_type, transport: str = "grpc"): @@ -1385,7 +1401,7 @@ def test_list_notification_channel_descriptors(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( @@ -1436,12 +1452,11 @@ def test_list_notification_channel_descriptors_non_empty_request_with_auto_popul client.list_notification_channel_descriptors(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == notification_service.ListNotificationChannelDescriptorsRequest( + request_msg = notification_service.ListNotificationChannelDescriptorsRequest( name="name_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_notification_channel_descriptors_use_cached_wrapped_rpc(): @@ -1527,9 +1542,15 @@ async def test_list_notification_channel_descriptors_async_use_cached_wrapped_rp @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + notification_service.ListNotificationChannelDescriptorsRequest(), + {}, + ], +) async def test_list_notification_channel_descriptors_async( - transport: str = "grpc_asyncio", - request_type=notification_service.ListNotificationChannelDescriptorsRequest, + request_type, transport: str = "grpc_asyncio" ): client = NotificationChannelServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1538,7 +1559,7 @@ async def test_list_notification_channel_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( @@ -1563,11 +1584,6 @@ async def test_list_notification_channel_descriptors_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_notification_channel_descriptors_async_from_dict(): - await test_list_notification_channel_descriptors_async(request_type=dict) - - def test_list_notification_channel_descriptors_field_headers(): client = NotificationChannelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1934,8 +1950,8 @@ async def test_list_notification_channel_descriptors_async_pages(): @pytest.mark.parametrize( "request_type", [ - notification_service.GetNotificationChannelDescriptorRequest, - dict, + notification_service.GetNotificationChannelDescriptorRequest(), + {}, ], ) def test_get_notification_channel_descriptor(request_type, transport: str = "grpc"): @@ -1946,7 +1962,7 @@ def test_get_notification_channel_descriptor(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( @@ -2004,9 +2020,10 @@ def test_get_notification_channel_descriptor_non_empty_request_with_auto_populat client.get_notification_channel_descriptor(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == notification_service.GetNotificationChannelDescriptorRequest( + request_msg = notification_service.GetNotificationChannelDescriptorRequest( name="name_value", ) + assert args[0] == request_msg def test_get_notification_channel_descriptor_use_cached_wrapped_rpc(): @@ -2092,9 +2109,15 @@ async def test_get_notification_channel_descriptor_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + notification_service.GetNotificationChannelDescriptorRequest(), + {}, + ], +) async def test_get_notification_channel_descriptor_async( - transport: str = "grpc_asyncio", - request_type=notification_service.GetNotificationChannelDescriptorRequest, + request_type, transport: str = "grpc_asyncio" ): client = NotificationChannelServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2103,7 +2126,7 @@ async def test_get_notification_channel_descriptor_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( @@ -2138,11 +2161,6 @@ async def test_get_notification_channel_descriptor_async( assert response.launch_stage == launch_stage_pb2.LaunchStage.UNIMPLEMENTED -@pytest.mark.asyncio -async def test_get_notification_channel_descriptor_async_from_dict(): - await test_get_notification_channel_descriptor_async(request_type=dict) - - def test_get_notification_channel_descriptor_field_headers(): client = NotificationChannelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2297,8 +2315,8 @@ async def test_get_notification_channel_descriptor_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - notification_service.ListNotificationChannelsRequest, - dict, + notification_service.ListNotificationChannelsRequest(), + {}, ], ) def test_list_notification_channels(request_type, transport: str = "grpc"): @@ -2309,7 +2327,7 @@ def test_list_notification_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( @@ -2362,12 +2380,13 @@ def test_list_notification_channels_non_empty_request_with_auto_populated_field( client.list_notification_channels(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == notification_service.ListNotificationChannelsRequest( + request_msg = notification_service.ListNotificationChannelsRequest( name="name_value", filter="filter_value", order_by="order_by_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_notification_channels_use_cached_wrapped_rpc(): @@ -2453,9 +2472,15 @@ async def test_list_notification_channels_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + notification_service.ListNotificationChannelsRequest(), + {}, + ], +) async def test_list_notification_channels_async( - transport: str = "grpc_asyncio", - request_type=notification_service.ListNotificationChannelsRequest, + request_type, transport: str = "grpc_asyncio" ): client = NotificationChannelServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2464,7 +2489,7 @@ async def test_list_notification_channels_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( @@ -2491,11 +2516,6 @@ async def test_list_notification_channels_async( assert response.total_size == 1086 -@pytest.mark.asyncio -async def test_list_notification_channels_async_from_dict(): - await test_list_notification_channels_async(request_type=dict) - - def test_list_notification_channels_field_headers(): client = NotificationChannelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2850,8 +2870,8 @@ async def test_list_notification_channels_async_pages(): @pytest.mark.parametrize( "request_type", [ - notification_service.GetNotificationChannelRequest, - dict, + notification_service.GetNotificationChannelRequest(), + {}, ], ) def test_get_notification_channel(request_type, transport: str = "grpc"): @@ -2862,7 +2882,7 @@ def test_get_notification_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 +2941,10 @@ def test_get_notification_channel_non_empty_request_with_auto_populated_field(): client.get_notification_channel(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == notification_service.GetNotificationChannelRequest( + request_msg = notification_service.GetNotificationChannelRequest( name="name_value", ) + assert args[0] == request_msg def test_get_notification_channel_use_cached_wrapped_rpc(): @@ -3009,9 +3030,15 @@ async def test_get_notification_channel_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + notification_service.GetNotificationChannelRequest(), + {}, + ], +) async def test_get_notification_channel_async( - transport: str = "grpc_asyncio", - request_type=notification_service.GetNotificationChannelRequest, + request_type, transport: str = "grpc_asyncio" ): client = NotificationChannelServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3020,7 +3047,7 @@ async def test_get_notification_channel_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( @@ -3056,11 +3083,6 @@ async def test_get_notification_channel_async( ) -@pytest.mark.asyncio -async def test_get_notification_channel_async_from_dict(): - await test_get_notification_channel_async(request_type=dict) - - def test_get_notification_channel_field_headers(): client = NotificationChannelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3215,8 +3237,8 @@ async def test_get_notification_channel_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - notification_service.CreateNotificationChannelRequest, - dict, + notification_service.CreateNotificationChannelRequest(), + {}, ], ) def test_create_notification_channel(request_type, transport: str = "grpc"): @@ -3227,7 +3249,7 @@ def test_create_notification_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( @@ -3286,9 +3308,10 @@ def test_create_notification_channel_non_empty_request_with_auto_populated_field client.create_notification_channel(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == notification_service.CreateNotificationChannelRequest( + request_msg = notification_service.CreateNotificationChannelRequest( name="name_value", ) + assert args[0] == request_msg def test_create_notification_channel_use_cached_wrapped_rpc(): @@ -3374,9 +3397,15 @@ async def test_create_notification_channel_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + notification_service.CreateNotificationChannelRequest(), + {}, + ], +) async def test_create_notification_channel_async( - transport: str = "grpc_asyncio", - request_type=notification_service.CreateNotificationChannelRequest, + request_type, transport: str = "grpc_asyncio" ): client = NotificationChannelServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3385,7 +3414,7 @@ async def test_create_notification_channel_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( @@ -3421,11 +3450,6 @@ async def test_create_notification_channel_async( ) -@pytest.mark.asyncio -async def test_create_notification_channel_async_from_dict(): - await test_create_notification_channel_async(request_type=dict) - - def test_create_notification_channel_field_headers(): client = NotificationChannelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3590,8 +3614,8 @@ async def test_create_notification_channel_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - notification_service.UpdateNotificationChannelRequest, - dict, + notification_service.UpdateNotificationChannelRequest(), + {}, ], ) def test_update_notification_channel(request_type, transport: str = "grpc"): @@ -3602,7 +3626,7 @@ def test_update_notification_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( @@ -3659,7 +3683,8 @@ def test_update_notification_channel_non_empty_request_with_auto_populated_field client.update_notification_channel(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == notification_service.UpdateNotificationChannelRequest() + request_msg = notification_service.UpdateNotificationChannelRequest() + assert args[0] == request_msg def test_update_notification_channel_use_cached_wrapped_rpc(): @@ -3745,9 +3770,15 @@ async def test_update_notification_channel_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + notification_service.UpdateNotificationChannelRequest(), + {}, + ], +) async def test_update_notification_channel_async( - transport: str = "grpc_asyncio", - request_type=notification_service.UpdateNotificationChannelRequest, + request_type, transport: str = "grpc_asyncio" ): client = NotificationChannelServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3756,7 +3787,7 @@ async def test_update_notification_channel_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( @@ -3792,11 +3823,6 @@ async def test_update_notification_channel_async( ) -@pytest.mark.asyncio -async def test_update_notification_channel_async_from_dict(): - await test_update_notification_channel_async(request_type=dict) - - def test_update_notification_channel_field_headers(): client = NotificationChannelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3961,8 +3987,8 @@ async def test_update_notification_channel_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - notification_service.DeleteNotificationChannelRequest, - dict, + notification_service.DeleteNotificationChannelRequest(), + {}, ], ) def test_delete_notification_channel(request_type, transport: str = "grpc"): @@ -3973,7 +3999,7 @@ def test_delete_notification_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( @@ -4018,9 +4044,10 @@ def test_delete_notification_channel_non_empty_request_with_auto_populated_field client.delete_notification_channel(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == notification_service.DeleteNotificationChannelRequest( + request_msg = notification_service.DeleteNotificationChannelRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_notification_channel_use_cached_wrapped_rpc(): @@ -4106,9 +4133,15 @@ async def test_delete_notification_channel_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + notification_service.DeleteNotificationChannelRequest(), + {}, + ], +) async def test_delete_notification_channel_async( - transport: str = "grpc_asyncio", - request_type=notification_service.DeleteNotificationChannelRequest, + request_type, transport: str = "grpc_asyncio" ): client = NotificationChannelServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4117,7 +4150,7 @@ async def test_delete_notification_channel_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( @@ -4137,11 +4170,6 @@ async def test_delete_notification_channel_async( assert response is None -@pytest.mark.asyncio -async def test_delete_notification_channel_async_from_dict(): - await test_delete_notification_channel_async(request_type=dict) - - def test_delete_notification_channel_field_headers(): client = NotificationChannelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4302,8 +4330,8 @@ async def test_delete_notification_channel_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - notification_service.SendNotificationChannelVerificationCodeRequest, - dict, + notification_service.SendNotificationChannelVerificationCodeRequest(), + {}, ], ) def test_send_notification_channel_verification_code( @@ -4316,7 +4344,7 @@ def test_send_notification_channel_verification_code( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4361,11 +4389,12 @@ def test_send_notification_channel_verification_code_non_empty_request_with_auto client.send_notification_channel_verification_code(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == notification_service.SendNotificationChannelVerificationCodeRequest( - name="name_value", + request_msg = ( + notification_service.SendNotificationChannelVerificationCodeRequest( + name="name_value", + ) ) + assert args[0] == request_msg def test_send_notification_channel_verification_code_use_cached_wrapped_rpc(): @@ -4451,9 +4480,15 @@ async def test_send_notification_channel_verification_code_async_use_cached_wrap @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + notification_service.SendNotificationChannelVerificationCodeRequest(), + {}, + ], +) async def test_send_notification_channel_verification_code_async( - transport: str = "grpc_asyncio", - request_type=notification_service.SendNotificationChannelVerificationCodeRequest, + request_type, transport: str = "grpc_asyncio" ): client = NotificationChannelServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4462,7 +4497,7 @@ async def test_send_notification_channel_verification_code_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( @@ -4482,11 +4517,6 @@ async def test_send_notification_channel_verification_code_async( assert response is None -@pytest.mark.asyncio -async def test_send_notification_channel_verification_code_async_from_dict(): - await test_send_notification_channel_verification_code_async(request_type=dict) - - def test_send_notification_channel_verification_code_field_headers(): client = NotificationChannelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4637,8 +4667,8 @@ async def test_send_notification_channel_verification_code_flattened_error_async @pytest.mark.parametrize( "request_type", [ - notification_service.GetNotificationChannelVerificationCodeRequest, - dict, + notification_service.GetNotificationChannelVerificationCodeRequest(), + {}, ], ) def test_get_notification_channel_verification_code( @@ -4651,7 +4681,7 @@ def test_get_notification_channel_verification_code( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4703,11 +4733,12 @@ def test_get_notification_channel_verification_code_non_empty_request_with_auto_ client.get_notification_channel_verification_code(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == notification_service.GetNotificationChannelVerificationCodeRequest( - name="name_value", + request_msg = ( + notification_service.GetNotificationChannelVerificationCodeRequest( + name="name_value", + ) ) + assert args[0] == request_msg def test_get_notification_channel_verification_code_use_cached_wrapped_rpc(): @@ -4793,9 +4824,15 @@ async def test_get_notification_channel_verification_code_async_use_cached_wrapp @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + notification_service.GetNotificationChannelVerificationCodeRequest(), + {}, + ], +) async def test_get_notification_channel_verification_code_async( - transport: str = "grpc_asyncio", - request_type=notification_service.GetNotificationChannelVerificationCodeRequest, + request_type, transport: str = "grpc_asyncio" ): client = NotificationChannelServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4804,7 +4841,7 @@ async def test_get_notification_channel_verification_code_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( @@ -4831,11 +4868,6 @@ async def test_get_notification_channel_verification_code_async( assert response.code == "code_value" -@pytest.mark.asyncio -async def test_get_notification_channel_verification_code_async_from_dict(): - await test_get_notification_channel_verification_code_async(request_type=dict) - - def test_get_notification_channel_verification_code_field_headers(): client = NotificationChannelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4996,8 +5028,8 @@ async def test_get_notification_channel_verification_code_flattened_error_async( @pytest.mark.parametrize( "request_type", [ - notification_service.VerifyNotificationChannelRequest, - dict, + notification_service.VerifyNotificationChannelRequest(), + {}, ], ) def test_verify_notification_channel(request_type, transport: str = "grpc"): @@ -5008,7 +5040,7 @@ def test_verify_notification_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( @@ -5068,10 +5100,11 @@ def test_verify_notification_channel_non_empty_request_with_auto_populated_field client.verify_notification_channel(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == notification_service.VerifyNotificationChannelRequest( + request_msg = notification_service.VerifyNotificationChannelRequest( name="name_value", code="code_value", ) + assert args[0] == request_msg def test_verify_notification_channel_use_cached_wrapped_rpc(): @@ -5157,9 +5190,15 @@ async def test_verify_notification_channel_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + notification_service.VerifyNotificationChannelRequest(), + {}, + ], +) async def test_verify_notification_channel_async( - transport: str = "grpc_asyncio", - request_type=notification_service.VerifyNotificationChannelRequest, + request_type, transport: str = "grpc_asyncio" ): client = NotificationChannelServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5168,7 +5207,7 @@ async def test_verify_notification_channel_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( @@ -5204,11 +5243,6 @@ async def test_verify_notification_channel_async( ) -@pytest.mark.asyncio -async def test_verify_notification_channel_async_from_dict(): - await test_verify_notification_channel_async(request_type=dict) - - def test_verify_notification_channel_field_headers(): client = NotificationChannelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5496,7 +5530,6 @@ def test_list_notification_channel_descriptors_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = notification_service.ListNotificationChannelDescriptorsRequest() - assert args[0] == request_msg @@ -5519,7 +5552,6 @@ def test_get_notification_channel_descriptor_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = notification_service.GetNotificationChannelDescriptorRequest() - assert args[0] == request_msg @@ -5542,7 +5574,6 @@ def test_list_notification_channels_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = notification_service.ListNotificationChannelsRequest() - assert args[0] == request_msg @@ -5565,7 +5596,6 @@ def test_get_notification_channel_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = notification_service.GetNotificationChannelRequest() - assert args[0] == request_msg @@ -5588,7 +5618,6 @@ def test_create_notification_channel_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = notification_service.CreateNotificationChannelRequest() - assert args[0] == request_msg @@ -5611,7 +5640,6 @@ def test_update_notification_channel_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = notification_service.UpdateNotificationChannelRequest() - assert args[0] == request_msg @@ -5634,7 +5662,6 @@ def test_delete_notification_channel_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = notification_service.DeleteNotificationChannelRequest() - assert args[0] == request_msg @@ -5659,7 +5686,6 @@ def test_send_notification_channel_verification_code_empty_call_grpc(): request_msg = ( notification_service.SendNotificationChannelVerificationCodeRequest() ) - assert args[0] == request_msg @@ -5686,7 +5712,6 @@ def test_get_notification_channel_verification_code_empty_call_grpc(): request_msg = ( notification_service.GetNotificationChannelVerificationCodeRequest() ) - assert args[0] == request_msg @@ -5709,7 +5734,6 @@ def test_verify_notification_channel_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = notification_service.VerifyNotificationChannelRequest() - assert args[0] == request_msg @@ -5752,7 +5776,6 @@ async def test_list_notification_channel_descriptors_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = notification_service.ListNotificationChannelDescriptorsRequest() - assert args[0] == request_msg @@ -5786,7 +5809,6 @@ async def test_get_notification_channel_descriptor_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = notification_service.GetNotificationChannelDescriptorRequest() - assert args[0] == request_msg @@ -5816,7 +5838,6 @@ async def test_list_notification_channels_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = notification_service.ListNotificationChannelsRequest() - assert args[0] == request_msg @@ -5849,7 +5870,6 @@ async def test_get_notification_channel_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = notification_service.GetNotificationChannelRequest() - assert args[0] == request_msg @@ -5882,7 +5902,6 @@ async def test_create_notification_channel_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = notification_service.CreateNotificationChannelRequest() - assert args[0] == request_msg @@ -5915,7 +5934,6 @@ async def test_update_notification_channel_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = notification_service.UpdateNotificationChannelRequest() - assert args[0] == request_msg @@ -5940,7 +5958,6 @@ async def test_delete_notification_channel_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = notification_service.DeleteNotificationChannelRequest() - assert args[0] == request_msg @@ -5967,7 +5984,6 @@ async def test_send_notification_channel_verification_code_empty_call_grpc_async request_msg = ( notification_service.SendNotificationChannelVerificationCodeRequest() ) - assert args[0] == request_msg @@ -5998,7 +6014,6 @@ async def test_get_notification_channel_verification_code_empty_call_grpc_asynci request_msg = ( notification_service.GetNotificationChannelVerificationCodeRequest() ) - assert args[0] == request_msg @@ -6031,7 +6046,6 @@ async def test_verify_notification_channel_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = notification_service.VerifyNotificationChannelRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-monitoring/tests/unit/gapic/monitoring_v3/test_query_service.py b/packages/google-cloud-monitoring/tests/unit/gapic/monitoring_v3/test_query_service.py index 4e7419b4d9cf..d32d82713662 100644 --- a/packages/google-cloud-monitoring/tests/unit/gapic/monitoring_v3/test_query_service.py +++ b/packages/google-cloud-monitoring/tests/unit/gapic/monitoring_v3/test_query_service.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 @@ -105,6 +106,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" @@ -1272,8 +1288,8 @@ def test_query_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - metric_service.QueryTimeSeriesRequest, - dict, + metric_service.QueryTimeSeriesRequest(), + {}, ], ) def test_query_time_series(request_type, transport: str = "grpc"): @@ -1284,7 +1300,7 @@ def test_query_time_series(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1334,11 +1350,12 @@ def test_query_time_series_non_empty_request_with_auto_populated_field(): client.query_time_series(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == metric_service.QueryTimeSeriesRequest( + request_msg = metric_service.QueryTimeSeriesRequest( name="name_value", query="query_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_query_time_series_use_cached_wrapped_rpc(): @@ -1421,9 +1438,14 @@ async def test_query_time_series_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_query_time_series_async( - transport: str = "grpc_asyncio", request_type=metric_service.QueryTimeSeriesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + metric_service.QueryTimeSeriesRequest(), + {}, + ], +) +async def test_query_time_series_async(request_type, transport: str = "grpc_asyncio"): client = QueryServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1431,7 +1453,7 @@ async def test_query_time_series_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( @@ -1456,11 +1478,6 @@ async def test_query_time_series_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_query_time_series_async_from_dict(): - await test_query_time_series_async(request_type=dict) - - def test_query_time_series_field_headers(): client = QueryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1848,7 +1865,6 @@ def test_query_time_series_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metric_service.QueryTimeSeriesRequest() - assert args[0] == request_msg @@ -1891,7 +1907,6 @@ async def test_query_time_series_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = metric_service.QueryTimeSeriesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-monitoring/tests/unit/gapic/monitoring_v3/test_service_monitoring_service.py b/packages/google-cloud-monitoring/tests/unit/gapic/monitoring_v3/test_service_monitoring_service.py index e791ff8f64fc..fec1ef71058d 100644 --- a/packages/google-cloud-monitoring/tests/unit/gapic/monitoring_v3/test_service_monitoring_service.py +++ b/packages/google-cloud-monitoring/tests/unit/gapic/monitoring_v3/test_service_monitoring_service.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 @@ -109,6 +110,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" @@ -1348,8 +1364,8 @@ def test_service_monitoring_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - service_service.CreateServiceRequest, - dict, + service_service.CreateServiceRequest(), + {}, ], ) def test_create_service(request_type, transport: str = "grpc"): @@ -1360,7 +1376,7 @@ def test_create_service(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_service), "__call__") as call: @@ -1407,10 +1423,11 @@ def test_create_service_non_empty_request_with_auto_populated_field(): client.create_service(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service_service.CreateServiceRequest( + request_msg = service_service.CreateServiceRequest( parent="parent_value", service_id="service_id_value", ) + assert args[0] == request_msg def test_create_service_use_cached_wrapped_rpc(): @@ -1491,9 +1508,14 @@ async def test_create_service_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_service_async( - transport: str = "grpc_asyncio", request_type=service_service.CreateServiceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service_service.CreateServiceRequest(), + {}, + ], +) +async def test_create_service_async(request_type, transport: str = "grpc_asyncio"): client = ServiceMonitoringServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1501,7 +1523,7 @@ async def test_create_service_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_service), "__call__") as call: @@ -1526,11 +1548,6 @@ async def test_create_service_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_create_service_async_from_dict(): - await test_create_service_async(request_type=dict) - - def test_create_service_field_headers(): client = ServiceMonitoringServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1683,8 +1700,8 @@ async def test_create_service_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service_service.GetServiceRequest, - dict, + service_service.GetServiceRequest(), + {}, ], ) def test_get_service(request_type, transport: str = "grpc"): @@ -1695,7 +1712,7 @@ def test_get_service(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_service), "__call__") as call: @@ -1741,9 +1758,10 @@ def test_get_service_non_empty_request_with_auto_populated_field(): client.get_service(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service_service.GetServiceRequest( + request_msg = service_service.GetServiceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_service_use_cached_wrapped_rpc(): @@ -1824,9 +1842,14 @@ async def test_get_service_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_service_async( - transport: str = "grpc_asyncio", request_type=service_service.GetServiceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service_service.GetServiceRequest(), + {}, + ], +) +async def test_get_service_async(request_type, transport: str = "grpc_asyncio"): client = ServiceMonitoringServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1834,7 +1857,7 @@ async def test_get_service_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_service), "__call__") as call: @@ -1859,11 +1882,6 @@ async def test_get_service_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_get_service_async_from_dict(): - await test_get_service_async(request_type=dict) - - def test_get_service_field_headers(): client = ServiceMonitoringServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2006,8 +2024,8 @@ async def test_get_service_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service_service.ListServicesRequest, - dict, + service_service.ListServicesRequest(), + {}, ], ) def test_list_services(request_type, transport: str = "grpc"): @@ -2018,7 +2036,7 @@ def test_list_services(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_services), "__call__") as call: @@ -2064,11 +2082,12 @@ def test_list_services_non_empty_request_with_auto_populated_field(): client.list_services(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service_service.ListServicesRequest( + request_msg = service_service.ListServicesRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_services_use_cached_wrapped_rpc(): @@ -2149,9 +2168,14 @@ async def test_list_services_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_services_async( - transport: str = "grpc_asyncio", request_type=service_service.ListServicesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service_service.ListServicesRequest(), + {}, + ], +) +async def test_list_services_async(request_type, transport: str = "grpc_asyncio"): client = ServiceMonitoringServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2159,7 +2183,7 @@ async def test_list_services_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_services), "__call__") as call: @@ -2182,11 +2206,6 @@ async def test_list_services_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_services_async_from_dict(): - await test_list_services_async(request_type=dict) - - def test_list_services_field_headers(): client = ServiceMonitoringServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2523,8 +2542,8 @@ async def test_list_services_async_pages(): @pytest.mark.parametrize( "request_type", [ - service_service.UpdateServiceRequest, - dict, + service_service.UpdateServiceRequest(), + {}, ], ) def test_update_service(request_type, transport: str = "grpc"): @@ -2535,7 +2554,7 @@ def test_update_service(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_service), "__call__") as call: @@ -2579,7 +2598,8 @@ def test_update_service_non_empty_request_with_auto_populated_field(): client.update_service(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service_service.UpdateServiceRequest() + request_msg = service_service.UpdateServiceRequest() + assert args[0] == request_msg def test_update_service_use_cached_wrapped_rpc(): @@ -2660,9 +2680,14 @@ async def test_update_service_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_service_async( - transport: str = "grpc_asyncio", request_type=service_service.UpdateServiceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service_service.UpdateServiceRequest(), + {}, + ], +) +async def test_update_service_async(request_type, transport: str = "grpc_asyncio"): client = ServiceMonitoringServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2670,7 +2695,7 @@ async def test_update_service_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_service), "__call__") as call: @@ -2695,11 +2720,6 @@ async def test_update_service_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_update_service_async_from_dict(): - await test_update_service_async(request_type=dict) - - def test_update_service_field_headers(): client = ServiceMonitoringServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2842,8 +2862,8 @@ async def test_update_service_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service_service.DeleteServiceRequest, - dict, + service_service.DeleteServiceRequest(), + {}, ], ) def test_delete_service(request_type, transport: str = "grpc"): @@ -2854,7 +2874,7 @@ def test_delete_service(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_service), "__call__") as call: @@ -2895,9 +2915,10 @@ def test_delete_service_non_empty_request_with_auto_populated_field(): client.delete_service(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service_service.DeleteServiceRequest( + request_msg = service_service.DeleteServiceRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_service_use_cached_wrapped_rpc(): @@ -2978,9 +2999,14 @@ async def test_delete_service_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_service_async( - transport: str = "grpc_asyncio", request_type=service_service.DeleteServiceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service_service.DeleteServiceRequest(), + {}, + ], +) +async def test_delete_service_async(request_type, transport: str = "grpc_asyncio"): client = ServiceMonitoringServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2988,7 +3014,7 @@ async def test_delete_service_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_service), "__call__") as call: @@ -3006,11 +3032,6 @@ async def test_delete_service_async( assert response is None -@pytest.mark.asyncio -async def test_delete_service_async_from_dict(): - await test_delete_service_async(request_type=dict) - - def test_delete_service_field_headers(): client = ServiceMonitoringServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3153,8 +3174,8 @@ async def test_delete_service_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service_service.CreateServiceLevelObjectiveRequest, - dict, + service_service.CreateServiceLevelObjectiveRequest(), + {}, ], ) def test_create_service_level_objective(request_type, transport: str = "grpc"): @@ -3165,7 +3186,7 @@ def test_create_service_level_objective(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3219,10 +3240,11 @@ def test_create_service_level_objective_non_empty_request_with_auto_populated_fi client.create_service_level_objective(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service_service.CreateServiceLevelObjectiveRequest( + request_msg = service_service.CreateServiceLevelObjectiveRequest( parent="parent_value", service_level_objective_id="service_level_objective_id_value", ) + assert args[0] == request_msg def test_create_service_level_objective_use_cached_wrapped_rpc(): @@ -3308,9 +3330,15 @@ async def test_create_service_level_objective_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service_service.CreateServiceLevelObjectiveRequest(), + {}, + ], +) async def test_create_service_level_objective_async( - transport: str = "grpc_asyncio", - request_type=service_service.CreateServiceLevelObjectiveRequest, + request_type, transport: str = "grpc_asyncio" ): client = ServiceMonitoringServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3319,7 +3347,7 @@ async def test_create_service_level_objective_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( @@ -3348,11 +3376,6 @@ async def test_create_service_level_objective_async( assert math.isclose(response.goal, 0.419, rel_tol=1e-6) -@pytest.mark.asyncio -async def test_create_service_level_objective_async_from_dict(): - await test_create_service_level_objective_async(request_type=dict) - - def test_create_service_level_objective_field_headers(): client = ServiceMonitoringServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3517,8 +3540,8 @@ async def test_create_service_level_objective_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service_service.GetServiceLevelObjectiveRequest, - dict, + service_service.GetServiceLevelObjectiveRequest(), + {}, ], ) def test_get_service_level_objective(request_type, transport: str = "grpc"): @@ -3529,7 +3552,7 @@ def test_get_service_level_objective(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3582,9 +3605,10 @@ def test_get_service_level_objective_non_empty_request_with_auto_populated_field client.get_service_level_objective(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service_service.GetServiceLevelObjectiveRequest( + request_msg = service_service.GetServiceLevelObjectiveRequest( name="name_value", ) + assert args[0] == request_msg def test_get_service_level_objective_use_cached_wrapped_rpc(): @@ -3670,9 +3694,15 @@ async def test_get_service_level_objective_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service_service.GetServiceLevelObjectiveRequest(), + {}, + ], +) async def test_get_service_level_objective_async( - transport: str = "grpc_asyncio", - request_type=service_service.GetServiceLevelObjectiveRequest, + request_type, transport: str = "grpc_asyncio" ): client = ServiceMonitoringServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3681,7 +3711,7 @@ async def test_get_service_level_objective_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( @@ -3710,11 +3740,6 @@ async def test_get_service_level_objective_async( assert math.isclose(response.goal, 0.419, rel_tol=1e-6) -@pytest.mark.asyncio -async def test_get_service_level_objective_async_from_dict(): - await test_get_service_level_objective_async(request_type=dict) - - def test_get_service_level_objective_field_headers(): client = ServiceMonitoringServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3869,8 +3894,8 @@ async def test_get_service_level_objective_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service_service.ListServiceLevelObjectivesRequest, - dict, + service_service.ListServiceLevelObjectivesRequest(), + {}, ], ) def test_list_service_level_objectives(request_type, transport: str = "grpc"): @@ -3881,7 +3906,7 @@ def test_list_service_level_objectives(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3931,11 +3956,12 @@ def test_list_service_level_objectives_non_empty_request_with_auto_populated_fie client.list_service_level_objectives(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service_service.ListServiceLevelObjectivesRequest( + request_msg = service_service.ListServiceLevelObjectivesRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_service_level_objectives_use_cached_wrapped_rpc(): @@ -4021,9 +4047,15 @@ async def test_list_service_level_objectives_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service_service.ListServiceLevelObjectivesRequest(), + {}, + ], +) async def test_list_service_level_objectives_async( - transport: str = "grpc_asyncio", - request_type=service_service.ListServiceLevelObjectivesRequest, + request_type, transport: str = "grpc_asyncio" ): client = ServiceMonitoringServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4032,7 +4064,7 @@ async def test_list_service_level_objectives_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( @@ -4057,11 +4089,6 @@ async def test_list_service_level_objectives_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_service_level_objectives_async_from_dict(): - await test_list_service_level_objectives_async(request_type=dict) - - def test_list_service_level_objectives_field_headers(): client = ServiceMonitoringServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4418,8 +4445,8 @@ async def test_list_service_level_objectives_async_pages(): @pytest.mark.parametrize( "request_type", [ - service_service.UpdateServiceLevelObjectiveRequest, - dict, + service_service.UpdateServiceLevelObjectiveRequest(), + {}, ], ) def test_update_service_level_objective(request_type, transport: str = "grpc"): @@ -4430,7 +4457,7 @@ def test_update_service_level_objective(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4481,7 +4508,8 @@ def test_update_service_level_objective_non_empty_request_with_auto_populated_fi client.update_service_level_objective(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service_service.UpdateServiceLevelObjectiveRequest() + request_msg = service_service.UpdateServiceLevelObjectiveRequest() + assert args[0] == request_msg def test_update_service_level_objective_use_cached_wrapped_rpc(): @@ -4567,9 +4595,15 @@ async def test_update_service_level_objective_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service_service.UpdateServiceLevelObjectiveRequest(), + {}, + ], +) async def test_update_service_level_objective_async( - transport: str = "grpc_asyncio", - request_type=service_service.UpdateServiceLevelObjectiveRequest, + request_type, transport: str = "grpc_asyncio" ): client = ServiceMonitoringServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4578,7 +4612,7 @@ async def test_update_service_level_objective_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( @@ -4607,11 +4641,6 @@ async def test_update_service_level_objective_async( assert math.isclose(response.goal, 0.419, rel_tol=1e-6) -@pytest.mark.asyncio -async def test_update_service_level_objective_async_from_dict(): - await test_update_service_level_objective_async(request_type=dict) - - def test_update_service_level_objective_field_headers(): client = ServiceMonitoringServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4766,8 +4795,8 @@ async def test_update_service_level_objective_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service_service.DeleteServiceLevelObjectiveRequest, - dict, + service_service.DeleteServiceLevelObjectiveRequest(), + {}, ], ) def test_delete_service_level_objective(request_type, transport: str = "grpc"): @@ -4778,7 +4807,7 @@ def test_delete_service_level_objective(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4823,9 +4852,10 @@ def test_delete_service_level_objective_non_empty_request_with_auto_populated_fi client.delete_service_level_objective(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service_service.DeleteServiceLevelObjectiveRequest( + request_msg = service_service.DeleteServiceLevelObjectiveRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_service_level_objective_use_cached_wrapped_rpc(): @@ -4911,9 +4941,15 @@ async def test_delete_service_level_objective_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service_service.DeleteServiceLevelObjectiveRequest(), + {}, + ], +) async def test_delete_service_level_objective_async( - transport: str = "grpc_asyncio", - request_type=service_service.DeleteServiceLevelObjectiveRequest, + request_type, transport: str = "grpc_asyncio" ): client = ServiceMonitoringServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4922,7 +4958,7 @@ async def test_delete_service_level_objective_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( @@ -4942,11 +4978,6 @@ async def test_delete_service_level_objective_async( assert response is None -@pytest.mark.asyncio -async def test_delete_service_level_objective_async_from_dict(): - await test_delete_service_level_objective_async(request_type=dict) - - def test_delete_service_level_objective_field_headers(): client = ServiceMonitoringServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5216,7 +5247,6 @@ def test_create_service_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service_service.CreateServiceRequest() - assert args[0] == request_msg @@ -5237,7 +5267,6 @@ def test_get_service_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service_service.GetServiceRequest() - assert args[0] == request_msg @@ -5258,7 +5287,6 @@ def test_list_services_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service_service.ListServicesRequest() - assert args[0] == request_msg @@ -5279,7 +5307,6 @@ def test_update_service_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service_service.UpdateServiceRequest() - assert args[0] == request_msg @@ -5300,7 +5327,6 @@ def test_delete_service_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service_service.DeleteServiceRequest() - assert args[0] == request_msg @@ -5323,7 +5349,6 @@ def test_create_service_level_objective_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service_service.CreateServiceLevelObjectiveRequest() - assert args[0] == request_msg @@ -5346,7 +5371,6 @@ def test_get_service_level_objective_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service_service.GetServiceLevelObjectiveRequest() - assert args[0] == request_msg @@ -5369,7 +5393,6 @@ def test_list_service_level_objectives_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service_service.ListServiceLevelObjectivesRequest() - assert args[0] == request_msg @@ -5392,7 +5415,6 @@ def test_update_service_level_objective_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service_service.UpdateServiceLevelObjectiveRequest() - assert args[0] == request_msg @@ -5415,7 +5437,6 @@ def test_delete_service_level_objective_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service_service.DeleteServiceLevelObjectiveRequest() - assert args[0] == request_msg @@ -5457,7 +5478,6 @@ async def test_create_service_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service_service.CreateServiceRequest() - assert args[0] == request_msg @@ -5485,7 +5505,6 @@ async def test_get_service_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service_service.GetServiceRequest() - assert args[0] == request_msg @@ -5512,7 +5531,6 @@ async def test_list_services_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service_service.ListServicesRequest() - assert args[0] == request_msg @@ -5540,7 +5558,6 @@ async def test_update_service_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service_service.UpdateServiceRequest() - assert args[0] == request_msg @@ -5563,7 +5580,6 @@ async def test_delete_service_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service_service.DeleteServiceRequest() - assert args[0] == request_msg @@ -5594,7 +5610,6 @@ async def test_create_service_level_objective_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service_service.CreateServiceLevelObjectiveRequest() - assert args[0] == request_msg @@ -5625,7 +5640,6 @@ async def test_get_service_level_objective_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service_service.GetServiceLevelObjectiveRequest() - assert args[0] == request_msg @@ -5654,7 +5668,6 @@ async def test_list_service_level_objectives_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service_service.ListServiceLevelObjectivesRequest() - assert args[0] == request_msg @@ -5685,7 +5698,6 @@ async def test_update_service_level_objective_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service_service.UpdateServiceLevelObjectiveRequest() - assert args[0] == request_msg @@ -5710,7 +5722,6 @@ async def test_delete_service_level_objective_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service_service.DeleteServiceLevelObjectiveRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-monitoring/tests/unit/gapic/monitoring_v3/test_snooze_service.py b/packages/google-cloud-monitoring/tests/unit/gapic/monitoring_v3/test_snooze_service.py index f7be2482fadb..e29a3e4a9d93 100644 --- a/packages/google-cloud-monitoring/tests/unit/gapic/monitoring_v3/test_snooze_service.py +++ b/packages/google-cloud-monitoring/tests/unit/gapic/monitoring_v3/test_snooze_service.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 @@ -108,6 +109,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" @@ -1294,8 +1310,8 @@ def test_snooze_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - snooze_service.CreateSnoozeRequest, - dict, + snooze_service.CreateSnoozeRequest(), + {}, ], ) def test_create_snooze(request_type, transport: str = "grpc"): @@ -1306,7 +1322,7 @@ def test_create_snooze(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_snooze), "__call__") as call: @@ -1352,9 +1368,10 @@ def test_create_snooze_non_empty_request_with_auto_populated_field(): client.create_snooze(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == snooze_service.CreateSnoozeRequest( + request_msg = snooze_service.CreateSnoozeRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_snooze_use_cached_wrapped_rpc(): @@ -1435,9 +1452,14 @@ async def test_create_snooze_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_snooze_async( - transport: str = "grpc_asyncio", request_type=snooze_service.CreateSnoozeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + snooze_service.CreateSnoozeRequest(), + {}, + ], +) +async def test_create_snooze_async(request_type, transport: str = "grpc_asyncio"): client = SnoozeServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1445,7 +1467,7 @@ async def test_create_snooze_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_snooze), "__call__") as call: @@ -1470,11 +1492,6 @@ async def test_create_snooze_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_create_snooze_async_from_dict(): - await test_create_snooze_async(request_type=dict) - - def test_create_snooze_field_headers(): client = SnoozeServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1627,8 +1644,8 @@ async def test_create_snooze_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - snooze_service.ListSnoozesRequest, - dict, + snooze_service.ListSnoozesRequest(), + {}, ], ) def test_list_snoozes(request_type, transport: str = "grpc"): @@ -1639,7 +1656,7 @@ def test_list_snoozes(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_snoozes), "__call__") as call: @@ -1685,11 +1702,12 @@ def test_list_snoozes_non_empty_request_with_auto_populated_field(): client.list_snoozes(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == snooze_service.ListSnoozesRequest( + request_msg = snooze_service.ListSnoozesRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_snoozes_use_cached_wrapped_rpc(): @@ -1770,9 +1788,14 @@ async def test_list_snoozes_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_snoozes_async( - transport: str = "grpc_asyncio", request_type=snooze_service.ListSnoozesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + snooze_service.ListSnoozesRequest(), + {}, + ], +) +async def test_list_snoozes_async(request_type, transport: str = "grpc_asyncio"): client = SnoozeServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1780,7 +1803,7 @@ async def test_list_snoozes_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_snoozes), "__call__") as call: @@ -1803,11 +1826,6 @@ async def test_list_snoozes_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_snoozes_async_from_dict(): - await test_list_snoozes_async(request_type=dict) - - def test_list_snoozes_field_headers(): client = SnoozeServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2144,8 +2162,8 @@ async def test_list_snoozes_async_pages(): @pytest.mark.parametrize( "request_type", [ - snooze_service.GetSnoozeRequest, - dict, + snooze_service.GetSnoozeRequest(), + {}, ], ) def test_get_snooze(request_type, transport: str = "grpc"): @@ -2156,7 +2174,7 @@ def test_get_snooze(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_snooze), "__call__") as call: @@ -2202,9 +2220,10 @@ def test_get_snooze_non_empty_request_with_auto_populated_field(): client.get_snooze(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == snooze_service.GetSnoozeRequest( + request_msg = snooze_service.GetSnoozeRequest( name="name_value", ) + assert args[0] == request_msg def test_get_snooze_use_cached_wrapped_rpc(): @@ -2283,9 +2302,14 @@ async def test_get_snooze_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_snooze_async( - transport: str = "grpc_asyncio", request_type=snooze_service.GetSnoozeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + snooze_service.GetSnoozeRequest(), + {}, + ], +) +async def test_get_snooze_async(request_type, transport: str = "grpc_asyncio"): client = SnoozeServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2293,7 +2317,7 @@ async def test_get_snooze_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_snooze), "__call__") as call: @@ -2318,11 +2342,6 @@ async def test_get_snooze_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_get_snooze_async_from_dict(): - await test_get_snooze_async(request_type=dict) - - def test_get_snooze_field_headers(): client = SnoozeServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2465,8 +2484,8 @@ async def test_get_snooze_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - snooze_service.UpdateSnoozeRequest, - dict, + snooze_service.UpdateSnoozeRequest(), + {}, ], ) def test_update_snooze(request_type, transport: str = "grpc"): @@ -2477,7 +2496,7 @@ def test_update_snooze(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_snooze), "__call__") as call: @@ -2521,7 +2540,8 @@ def test_update_snooze_non_empty_request_with_auto_populated_field(): client.update_snooze(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == snooze_service.UpdateSnoozeRequest() + request_msg = snooze_service.UpdateSnoozeRequest() + assert args[0] == request_msg def test_update_snooze_use_cached_wrapped_rpc(): @@ -2602,9 +2622,14 @@ async def test_update_snooze_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_snooze_async( - transport: str = "grpc_asyncio", request_type=snooze_service.UpdateSnoozeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + snooze_service.UpdateSnoozeRequest(), + {}, + ], +) +async def test_update_snooze_async(request_type, transport: str = "grpc_asyncio"): client = SnoozeServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2612,7 +2637,7 @@ async def test_update_snooze_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_snooze), "__call__") as call: @@ -2637,11 +2662,6 @@ async def test_update_snooze_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_update_snooze_async_from_dict(): - await test_update_snooze_async(request_type=dict) - - def test_update_snooze_field_headers(): client = SnoozeServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2913,7 +2933,6 @@ def test_create_snooze_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = snooze_service.CreateSnoozeRequest() - assert args[0] == request_msg @@ -2934,7 +2953,6 @@ def test_list_snoozes_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = snooze_service.ListSnoozesRequest() - assert args[0] == request_msg @@ -2955,7 +2973,6 @@ def test_get_snooze_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = snooze_service.GetSnoozeRequest() - assert args[0] == request_msg @@ -2976,7 +2993,6 @@ def test_update_snooze_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = snooze_service.UpdateSnoozeRequest() - assert args[0] == request_msg @@ -3018,7 +3034,6 @@ async def test_create_snooze_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = snooze_service.CreateSnoozeRequest() - assert args[0] == request_msg @@ -3045,7 +3060,6 @@ async def test_list_snoozes_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = snooze_service.ListSnoozesRequest() - assert args[0] == request_msg @@ -3073,7 +3087,6 @@ async def test_get_snooze_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = snooze_service.GetSnoozeRequest() - assert args[0] == request_msg @@ -3101,7 +3114,6 @@ async def test_update_snooze_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = snooze_service.UpdateSnoozeRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-monitoring/tests/unit/gapic/monitoring_v3/test_uptime_check_service.py b/packages/google-cloud-monitoring/tests/unit/gapic/monitoring_v3/test_uptime_check_service.py index 10a4e27408ab..66948d8a5fa0 100644 --- a/packages/google-cloud-monitoring/tests/unit/gapic/monitoring_v3/test_uptime_check_service.py +++ b/packages/google-cloud-monitoring/tests/unit/gapic/monitoring_v3/test_uptime_check_service.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 @@ -108,6 +109,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" @@ -1325,8 +1341,8 @@ def test_uptime_check_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - uptime_service.ListUptimeCheckConfigsRequest, - dict, + uptime_service.ListUptimeCheckConfigsRequest(), + {}, ], ) def test_list_uptime_check_configs(request_type, transport: str = "grpc"): @@ -1337,7 +1353,7 @@ def test_list_uptime_check_configs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1389,11 +1405,12 @@ def test_list_uptime_check_configs_non_empty_request_with_auto_populated_field() client.list_uptime_check_configs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == uptime_service.ListUptimeCheckConfigsRequest( + request_msg = uptime_service.ListUptimeCheckConfigsRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_uptime_check_configs_use_cached_wrapped_rpc(): @@ -1479,9 +1496,15 @@ async def test_list_uptime_check_configs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + uptime_service.ListUptimeCheckConfigsRequest(), + {}, + ], +) async def test_list_uptime_check_configs_async( - transport: str = "grpc_asyncio", - request_type=uptime_service.ListUptimeCheckConfigsRequest, + request_type, transport: str = "grpc_asyncio" ): client = UptimeCheckServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1490,7 +1513,7 @@ async def test_list_uptime_check_configs_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( @@ -1517,11 +1540,6 @@ async def test_list_uptime_check_configs_async( assert response.total_size == 1086 -@pytest.mark.asyncio -async def test_list_uptime_check_configs_async_from_dict(): - await test_list_uptime_check_configs_async(request_type=dict) - - def test_list_uptime_check_configs_field_headers(): client = UptimeCheckServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1876,8 +1894,8 @@ async def test_list_uptime_check_configs_async_pages(): @pytest.mark.parametrize( "request_type", [ - uptime_service.GetUptimeCheckConfigRequest, - dict, + uptime_service.GetUptimeCheckConfigRequest(), + {}, ], ) def test_get_uptime_check_config(request_type, transport: str = "grpc"): @@ -1888,7 +1906,7 @@ def test_get_uptime_check_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( @@ -1946,9 +1964,10 @@ def test_get_uptime_check_config_non_empty_request_with_auto_populated_field(): client.get_uptime_check_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == uptime_service.GetUptimeCheckConfigRequest( + request_msg = uptime_service.GetUptimeCheckConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_uptime_check_config_use_cached_wrapped_rpc(): @@ -2034,9 +2053,15 @@ async def test_get_uptime_check_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + uptime_service.GetUptimeCheckConfigRequest(), + {}, + ], +) async def test_get_uptime_check_config_async( - transport: str = "grpc_asyncio", - request_type=uptime_service.GetUptimeCheckConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = UptimeCheckServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2045,7 +2070,7 @@ async def test_get_uptime_check_config_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( @@ -2080,11 +2105,6 @@ async def test_get_uptime_check_config_async( assert response.is_internal is True -@pytest.mark.asyncio -async def test_get_uptime_check_config_async_from_dict(): - await test_get_uptime_check_config_async(request_type=dict) - - def test_get_uptime_check_config_field_headers(): client = UptimeCheckServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2239,8 +2259,8 @@ async def test_get_uptime_check_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - uptime_service.CreateUptimeCheckConfigRequest, - dict, + uptime_service.CreateUptimeCheckConfigRequest(), + {}, ], ) def test_create_uptime_check_config(request_type, transport: str = "grpc"): @@ -2251,7 +2271,7 @@ def test_create_uptime_check_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( @@ -2309,9 +2329,10 @@ def test_create_uptime_check_config_non_empty_request_with_auto_populated_field( client.create_uptime_check_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == uptime_service.CreateUptimeCheckConfigRequest( + request_msg = uptime_service.CreateUptimeCheckConfigRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_uptime_check_config_use_cached_wrapped_rpc(): @@ -2397,9 +2418,15 @@ async def test_create_uptime_check_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + uptime_service.CreateUptimeCheckConfigRequest(), + {}, + ], +) async def test_create_uptime_check_config_async( - transport: str = "grpc_asyncio", - request_type=uptime_service.CreateUptimeCheckConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = UptimeCheckServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2408,7 +2435,7 @@ async def test_create_uptime_check_config_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( @@ -2443,11 +2470,6 @@ async def test_create_uptime_check_config_async( assert response.is_internal is True -@pytest.mark.asyncio -async def test_create_uptime_check_config_async_from_dict(): - await test_create_uptime_check_config_async(request_type=dict) - - def test_create_uptime_check_config_field_headers(): client = UptimeCheckServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2612,8 +2634,8 @@ async def test_create_uptime_check_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - uptime_service.UpdateUptimeCheckConfigRequest, - dict, + uptime_service.UpdateUptimeCheckConfigRequest(), + {}, ], ) def test_update_uptime_check_config(request_type, transport: str = "grpc"): @@ -2624,7 +2646,7 @@ def test_update_uptime_check_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( @@ -2680,7 +2702,8 @@ def test_update_uptime_check_config_non_empty_request_with_auto_populated_field( client.update_uptime_check_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == uptime_service.UpdateUptimeCheckConfigRequest() + request_msg = uptime_service.UpdateUptimeCheckConfigRequest() + assert args[0] == request_msg def test_update_uptime_check_config_use_cached_wrapped_rpc(): @@ -2766,9 +2789,15 @@ async def test_update_uptime_check_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + uptime_service.UpdateUptimeCheckConfigRequest(), + {}, + ], +) async def test_update_uptime_check_config_async( - transport: str = "grpc_asyncio", - request_type=uptime_service.UpdateUptimeCheckConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = UptimeCheckServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2777,7 +2806,7 @@ async def test_update_uptime_check_config_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( @@ -2812,11 +2841,6 @@ async def test_update_uptime_check_config_async( assert response.is_internal is True -@pytest.mark.asyncio -async def test_update_uptime_check_config_async_from_dict(): - await test_update_uptime_check_config_async(request_type=dict) - - def test_update_uptime_check_config_field_headers(): client = UptimeCheckServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2971,8 +2995,8 @@ async def test_update_uptime_check_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - uptime_service.DeleteUptimeCheckConfigRequest, - dict, + uptime_service.DeleteUptimeCheckConfigRequest(), + {}, ], ) def test_delete_uptime_check_config(request_type, transport: str = "grpc"): @@ -2983,7 +3007,7 @@ def test_delete_uptime_check_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( @@ -3028,9 +3052,10 @@ def test_delete_uptime_check_config_non_empty_request_with_auto_populated_field( client.delete_uptime_check_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == uptime_service.DeleteUptimeCheckConfigRequest( + request_msg = uptime_service.DeleteUptimeCheckConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_uptime_check_config_use_cached_wrapped_rpc(): @@ -3116,9 +3141,15 @@ async def test_delete_uptime_check_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + uptime_service.DeleteUptimeCheckConfigRequest(), + {}, + ], +) async def test_delete_uptime_check_config_async( - transport: str = "grpc_asyncio", - request_type=uptime_service.DeleteUptimeCheckConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = UptimeCheckServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3127,7 +3158,7 @@ async def test_delete_uptime_check_config_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( @@ -3147,11 +3178,6 @@ async def test_delete_uptime_check_config_async( assert response is None -@pytest.mark.asyncio -async def test_delete_uptime_check_config_async_from_dict(): - await test_delete_uptime_check_config_async(request_type=dict) - - def test_delete_uptime_check_config_field_headers(): client = UptimeCheckServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3302,8 +3328,8 @@ async def test_delete_uptime_check_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - uptime_service.ListUptimeCheckIpsRequest, - dict, + uptime_service.ListUptimeCheckIpsRequest(), + {}, ], ) def test_list_uptime_check_ips(request_type, transport: str = "grpc"): @@ -3314,7 +3340,7 @@ def test_list_uptime_check_ips(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3362,9 +3388,10 @@ def test_list_uptime_check_ips_non_empty_request_with_auto_populated_field(): client.list_uptime_check_ips(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == uptime_service.ListUptimeCheckIpsRequest( + request_msg = uptime_service.ListUptimeCheckIpsRequest( page_token="page_token_value", ) + assert args[0] == request_msg def test_list_uptime_check_ips_use_cached_wrapped_rpc(): @@ -3450,9 +3477,15 @@ async def test_list_uptime_check_ips_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + uptime_service.ListUptimeCheckIpsRequest(), + {}, + ], +) async def test_list_uptime_check_ips_async( - transport: str = "grpc_asyncio", - request_type=uptime_service.ListUptimeCheckIpsRequest, + request_type, transport: str = "grpc_asyncio" ): client = UptimeCheckServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3461,7 +3494,7 @@ async def test_list_uptime_check_ips_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( @@ -3486,11 +3519,6 @@ async def test_list_uptime_check_ips_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_uptime_check_ips_async_from_dict(): - await test_list_uptime_check_ips_async(request_type=dict) - - def test_list_uptime_check_ips_pager(transport_name: str = "grpc"): client = UptimeCheckServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3810,7 +3838,6 @@ def test_list_uptime_check_configs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = uptime_service.ListUptimeCheckConfigsRequest() - assert args[0] == request_msg @@ -3833,7 +3860,6 @@ def test_get_uptime_check_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = uptime_service.GetUptimeCheckConfigRequest() - assert args[0] == request_msg @@ -3856,7 +3882,6 @@ def test_create_uptime_check_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = uptime_service.CreateUptimeCheckConfigRequest() - assert args[0] == request_msg @@ -3879,7 +3904,6 @@ def test_update_uptime_check_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = uptime_service.UpdateUptimeCheckConfigRequest() - assert args[0] == request_msg @@ -3902,7 +3926,6 @@ def test_delete_uptime_check_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = uptime_service.DeleteUptimeCheckConfigRequest() - assert args[0] == request_msg @@ -3925,7 +3948,6 @@ def test_list_uptime_check_ips_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = uptime_service.ListUptimeCheckIpsRequest() - assert args[0] == request_msg @@ -3969,7 +3991,6 @@ async def test_list_uptime_check_configs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = uptime_service.ListUptimeCheckConfigsRequest() - assert args[0] == request_msg @@ -4002,7 +4023,6 @@ async def test_get_uptime_check_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = uptime_service.GetUptimeCheckConfigRequest() - assert args[0] == request_msg @@ -4035,7 +4055,6 @@ async def test_create_uptime_check_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = uptime_service.CreateUptimeCheckConfigRequest() - assert args[0] == request_msg @@ -4068,7 +4087,6 @@ async def test_update_uptime_check_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = uptime_service.UpdateUptimeCheckConfigRequest() - assert args[0] == request_msg @@ -4093,7 +4111,6 @@ async def test_delete_uptime_check_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = uptime_service.DeleteUptimeCheckConfigRequest() - assert args[0] == request_msg @@ -4122,7 +4139,6 @@ async def test_list_uptime_check_ips_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = uptime_service.ListUptimeCheckIpsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-netapp/noxfile.py b/packages/google-cloud-netapp/noxfile.py index 0d238ade5fce..9cdc985be32a 100644 --- a/packages/google-cloud-netapp/noxfile.py +++ b/packages/google-cloud-netapp/noxfile.py @@ -47,7 +47,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-netapp" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-netapp/setup.py b/packages/google-cloud-netapp/setup.py index c42ebaeb0e6c..f7360b1daeb6 100644 --- a/packages/google-cloud-netapp/setup.py +++ b/packages/google-cloud-netapp/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/google-cloud-netapp/testing/constraints-3.10.txt b/packages/google-cloud-netapp/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-netapp/testing/constraints-3.10.txt +++ b/packages/google-cloud-netapp/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-netapp/tests/unit/gapic/netapp_v1/test_net_app.py b/packages/google-cloud-netapp/tests/unit/gapic/netapp_v1/test_net_app.py index 606a97774342..a673f76149b5 100644 --- a/packages/google-cloud-netapp/tests/unit/gapic/netapp_v1/test_net_app.py +++ b/packages/google-cloud-netapp/tests/unit/gapic/netapp_v1/test_net_app.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 @@ -143,6 +144,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" @@ -1275,8 +1291,8 @@ def test_net_app_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - storage_pool.ListStoragePoolsRequest, - dict, + storage_pool.ListStoragePoolsRequest(), + {}, ], ) def test_list_storage_pools(request_type, transport: str = "grpc"): @@ -1287,7 +1303,7 @@ def test_list_storage_pools(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1340,12 +1356,13 @@ def test_list_storage_pools_non_empty_request_with_auto_populated_field(): client.list_storage_pools(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == storage_pool.ListStoragePoolsRequest( + request_msg = storage_pool.ListStoragePoolsRequest( parent="parent_value", page_token="page_token_value", order_by="order_by_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_storage_pools_use_cached_wrapped_rpc(): @@ -1430,9 +1447,14 @@ async def test_list_storage_pools_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_storage_pools_async( - transport: str = "grpc_asyncio", request_type=storage_pool.ListStoragePoolsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + storage_pool.ListStoragePoolsRequest(), + {}, + ], +) +async def test_list_storage_pools_async(request_type, transport: str = "grpc_asyncio"): client = NetAppAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1440,7 +1462,7 @@ async def test_list_storage_pools_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( @@ -1467,11 +1489,6 @@ async def test_list_storage_pools_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_storage_pools_async_from_dict(): - await test_list_storage_pools_async(request_type=dict) - - def test_list_storage_pools_field_headers(): client = NetAppClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1824,8 +1841,8 @@ async def test_list_storage_pools_async_pages(): @pytest.mark.parametrize( "request_type", [ - gcn_storage_pool.CreateStoragePoolRequest, - dict, + gcn_storage_pool.CreateStoragePoolRequest(), + {}, ], ) def test_create_storage_pool(request_type, transport: str = "grpc"): @@ -1836,7 +1853,7 @@ def test_create_storage_pool(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,10 +1899,11 @@ def test_create_storage_pool_non_empty_request_with_auto_populated_field(): client.create_storage_pool(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_storage_pool.CreateStoragePoolRequest( + request_msg = gcn_storage_pool.CreateStoragePoolRequest( parent="parent_value", storage_pool_id="storage_pool_id_value", ) + assert args[0] == request_msg def test_create_storage_pool_use_cached_wrapped_rpc(): @@ -1980,10 +1998,14 @@ async def test_create_storage_pool_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_storage_pool_async( - transport: str = "grpc_asyncio", - request_type=gcn_storage_pool.CreateStoragePoolRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + gcn_storage_pool.CreateStoragePoolRequest(), + {}, + ], +) +async def test_create_storage_pool_async(request_type, transport: str = "grpc_asyncio"): client = NetAppAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1991,7 +2013,7 @@ async def test_create_storage_pool_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( @@ -2013,11 +2035,6 @@ async def test_create_storage_pool_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_storage_pool_async_from_dict(): - await test_create_storage_pool_async(request_type=dict) - - def test_create_storage_pool_field_headers(): client = NetAppClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2192,8 +2209,8 @@ async def test_create_storage_pool_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - storage_pool.GetStoragePoolRequest, - dict, + storage_pool.GetStoragePoolRequest(), + {}, ], ) def test_get_storage_pool(request_type, transport: str = "grpc"): @@ -2204,7 +2221,7 @@ def test_get_storage_pool(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_storage_pool), "__call__") as call: @@ -2310,9 +2327,10 @@ def test_get_storage_pool_non_empty_request_with_auto_populated_field(): client.get_storage_pool(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == storage_pool.GetStoragePoolRequest( + request_msg = storage_pool.GetStoragePoolRequest( name="name_value", ) + assert args[0] == request_msg def test_get_storage_pool_use_cached_wrapped_rpc(): @@ -2395,9 +2413,14 @@ async def test_get_storage_pool_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_storage_pool_async( - transport: str = "grpc_asyncio", request_type=storage_pool.GetStoragePoolRequest -): +@pytest.mark.parametrize( + "request_type", + [ + storage_pool.GetStoragePoolRequest(), + {}, + ], +) +async def test_get_storage_pool_async(request_type, transport: str = "grpc_asyncio"): client = NetAppAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2405,7 +2428,7 @@ async def test_get_storage_pool_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_storage_pool), "__call__") as call: @@ -2490,11 +2513,6 @@ async def test_get_storage_pool_async( assert response.scale_type == common.ScaleType.SCALE_TYPE_DEFAULT -@pytest.mark.asyncio -async def test_get_storage_pool_async_from_dict(): - await test_get_storage_pool_async(request_type=dict) - - def test_get_storage_pool_field_headers(): client = NetAppClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2641,8 +2659,8 @@ async def test_get_storage_pool_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_storage_pool.UpdateStoragePoolRequest, - dict, + gcn_storage_pool.UpdateStoragePoolRequest(), + {}, ], ) def test_update_storage_pool(request_type, transport: str = "grpc"): @@ -2653,7 +2671,7 @@ def test_update_storage_pool(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2696,7 +2714,8 @@ def test_update_storage_pool_non_empty_request_with_auto_populated_field(): client.update_storage_pool(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_storage_pool.UpdateStoragePoolRequest() + request_msg = gcn_storage_pool.UpdateStoragePoolRequest() + assert args[0] == request_msg def test_update_storage_pool_use_cached_wrapped_rpc(): @@ -2791,10 +2810,14 @@ async def test_update_storage_pool_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_storage_pool_async( - transport: str = "grpc_asyncio", - request_type=gcn_storage_pool.UpdateStoragePoolRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + gcn_storage_pool.UpdateStoragePoolRequest(), + {}, + ], +) +async def test_update_storage_pool_async(request_type, transport: str = "grpc_asyncio"): client = NetAppAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2802,7 +2825,7 @@ async def test_update_storage_pool_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( @@ -2824,11 +2847,6 @@ async def test_update_storage_pool_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_storage_pool_async_from_dict(): - await test_update_storage_pool_async(request_type=dict) - - def test_update_storage_pool_field_headers(): client = NetAppClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2993,8 +3011,8 @@ async def test_update_storage_pool_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - storage_pool.DeleteStoragePoolRequest, - dict, + storage_pool.DeleteStoragePoolRequest(), + {}, ], ) def test_delete_storage_pool(request_type, transport: str = "grpc"): @@ -3005,7 +3023,7 @@ def test_delete_storage_pool(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,9 +3068,10 @@ def test_delete_storage_pool_non_empty_request_with_auto_populated_field(): client.delete_storage_pool(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == storage_pool.DeleteStoragePoolRequest( + request_msg = storage_pool.DeleteStoragePoolRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_storage_pool_use_cached_wrapped_rpc(): @@ -3147,9 +3166,14 @@ async def test_delete_storage_pool_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_storage_pool_async( - transport: str = "grpc_asyncio", request_type=storage_pool.DeleteStoragePoolRequest -): +@pytest.mark.parametrize( + "request_type", + [ + storage_pool.DeleteStoragePoolRequest(), + {}, + ], +) +async def test_delete_storage_pool_async(request_type, transport: str = "grpc_asyncio"): client = NetAppAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3157,7 +3181,7 @@ async def test_delete_storage_pool_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( @@ -3179,11 +3203,6 @@ async def test_delete_storage_pool_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_storage_pool_async_from_dict(): - await test_delete_storage_pool_async(request_type=dict) - - def test_delete_storage_pool_field_headers(): client = NetAppClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3338,8 +3357,8 @@ async def test_delete_storage_pool_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - storage_pool.ValidateDirectoryServiceRequest, - dict, + storage_pool.ValidateDirectoryServiceRequest(), + {}, ], ) def test_validate_directory_service(request_type, transport: str = "grpc"): @@ -3350,7 +3369,7 @@ def test_validate_directory_service(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3395,9 +3414,10 @@ def test_validate_directory_service_non_empty_request_with_auto_populated_field( client.validate_directory_service(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == storage_pool.ValidateDirectoryServiceRequest( + request_msg = storage_pool.ValidateDirectoryServiceRequest( name="name_value", ) + assert args[0] == request_msg def test_validate_directory_service_use_cached_wrapped_rpc(): @@ -3493,9 +3513,15 @@ async def test_validate_directory_service_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + storage_pool.ValidateDirectoryServiceRequest(), + {}, + ], +) async def test_validate_directory_service_async( - transport: str = "grpc_asyncio", - request_type=storage_pool.ValidateDirectoryServiceRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetAppAsyncClient( credentials=async_anonymous_credentials(), @@ -3504,7 +3530,7 @@ async def test_validate_directory_service_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( @@ -3526,11 +3552,6 @@ async def test_validate_directory_service_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_validate_directory_service_async_from_dict(): - await test_validate_directory_service_async(request_type=dict) - - def test_validate_directory_service_field_headers(): client = NetAppClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3599,8 +3620,8 @@ async def test_validate_directory_service_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - storage_pool.SwitchActiveReplicaZoneRequest, - dict, + storage_pool.SwitchActiveReplicaZoneRequest(), + {}, ], ) def test_switch_active_replica_zone(request_type, transport: str = "grpc"): @@ -3611,7 +3632,7 @@ def test_switch_active_replica_zone(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3656,9 +3677,10 @@ def test_switch_active_replica_zone_non_empty_request_with_auto_populated_field( client.switch_active_replica_zone(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == storage_pool.SwitchActiveReplicaZoneRequest( + request_msg = storage_pool.SwitchActiveReplicaZoneRequest( name="name_value", ) + assert args[0] == request_msg def test_switch_active_replica_zone_use_cached_wrapped_rpc(): @@ -3754,9 +3776,15 @@ async def test_switch_active_replica_zone_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + storage_pool.SwitchActiveReplicaZoneRequest(), + {}, + ], +) async def test_switch_active_replica_zone_async( - transport: str = "grpc_asyncio", - request_type=storage_pool.SwitchActiveReplicaZoneRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetAppAsyncClient( credentials=async_anonymous_credentials(), @@ -3765,7 +3793,7 @@ async def test_switch_active_replica_zone_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( @@ -3787,11 +3815,6 @@ async def test_switch_active_replica_zone_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_switch_active_replica_zone_async_from_dict(): - await test_switch_active_replica_zone_async(request_type=dict) - - def test_switch_active_replica_zone_field_headers(): client = NetAppClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3860,8 +3883,8 @@ async def test_switch_active_replica_zone_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - volume.ListVolumesRequest, - dict, + volume.ListVolumesRequest(), + {}, ], ) def test_list_volumes(request_type, transport: str = "grpc"): @@ -3872,7 +3895,7 @@ def test_list_volumes(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_volumes), "__call__") as call: @@ -3921,12 +3944,13 @@ def test_list_volumes_non_empty_request_with_auto_populated_field(): client.list_volumes(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == volume.ListVolumesRequest( + request_msg = volume.ListVolumesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_volumes_use_cached_wrapped_rpc(): @@ -4007,9 +4031,14 @@ async def test_list_volumes_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_volumes_async( - transport: str = "grpc_asyncio", request_type=volume.ListVolumesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + volume.ListVolumesRequest(), + {}, + ], +) +async def test_list_volumes_async(request_type, transport: str = "grpc_asyncio"): client = NetAppAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4017,7 +4046,7 @@ async def test_list_volumes_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_volumes), "__call__") as call: @@ -4042,11 +4071,6 @@ async def test_list_volumes_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_volumes_async_from_dict(): - await test_list_volumes_async(request_type=dict) - - def test_list_volumes_field_headers(): client = NetAppClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4383,8 +4407,8 @@ async def test_list_volumes_async_pages(): @pytest.mark.parametrize( "request_type", [ - volume.GetVolumeRequest, - dict, + volume.GetVolumeRequest(), + {}, ], ) def test_get_volume(request_type, transport: str = "grpc"): @@ -4395,7 +4419,7 @@ def test_get_volume(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_volume), "__call__") as call: @@ -4499,9 +4523,10 @@ def test_get_volume_non_empty_request_with_auto_populated_field(): client.get_volume(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == volume.GetVolumeRequest( + request_msg = volume.GetVolumeRequest( name="name_value", ) + assert args[0] == request_msg def test_get_volume_use_cached_wrapped_rpc(): @@ -4580,9 +4605,14 @@ async def test_get_volume_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_volume_async( - transport: str = "grpc_asyncio", request_type=volume.GetVolumeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + volume.GetVolumeRequest(), + {}, + ], +) +async def test_get_volume_async(request_type, transport: str = "grpc_asyncio"): client = NetAppAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4590,7 +4620,7 @@ async def test_get_volume_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_volume), "__call__") as call: @@ -4673,11 +4703,6 @@ async def test_get_volume_async( assert response.hot_tier_size_used_gib == 2329 -@pytest.mark.asyncio -async def test_get_volume_async_from_dict(): - await test_get_volume_async(request_type=dict) - - def test_get_volume_field_headers(): client = NetAppClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4820,8 +4845,8 @@ async def test_get_volume_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_volume.CreateVolumeRequest, - dict, + gcn_volume.CreateVolumeRequest(), + {}, ], ) def test_create_volume(request_type, transport: str = "grpc"): @@ -4832,7 +4857,7 @@ def test_create_volume(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_volume), "__call__") as call: @@ -4874,10 +4899,11 @@ def test_create_volume_non_empty_request_with_auto_populated_field(): client.create_volume(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_volume.CreateVolumeRequest( + request_msg = gcn_volume.CreateVolumeRequest( parent="parent_value", volume_id="volume_id_value", ) + assert args[0] == request_msg def test_create_volume_use_cached_wrapped_rpc(): @@ -4968,9 +4994,14 @@ async def test_create_volume_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_volume_async( - transport: str = "grpc_asyncio", request_type=gcn_volume.CreateVolumeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcn_volume.CreateVolumeRequest(), + {}, + ], +) +async def test_create_volume_async(request_type, transport: str = "grpc_asyncio"): client = NetAppAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4978,7 +5009,7 @@ async def test_create_volume_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_volume), "__call__") as call: @@ -4998,11 +5029,6 @@ async def test_create_volume_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_volume_async_from_dict(): - await test_create_volume_async(request_type=dict) - - def test_create_volume_field_headers(): client = NetAppClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5169,8 +5195,8 @@ async def test_create_volume_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_volume.UpdateVolumeRequest, - dict, + gcn_volume.UpdateVolumeRequest(), + {}, ], ) def test_update_volume(request_type, transport: str = "grpc"): @@ -5181,7 +5207,7 @@ def test_update_volume(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_volume), "__call__") as call: @@ -5220,7 +5246,8 @@ def test_update_volume_non_empty_request_with_auto_populated_field(): client.update_volume(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_volume.UpdateVolumeRequest() + request_msg = gcn_volume.UpdateVolumeRequest() + assert args[0] == request_msg def test_update_volume_use_cached_wrapped_rpc(): @@ -5311,9 +5338,14 @@ async def test_update_volume_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_volume_async( - transport: str = "grpc_asyncio", request_type=gcn_volume.UpdateVolumeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcn_volume.UpdateVolumeRequest(), + {}, + ], +) +async def test_update_volume_async(request_type, transport: str = "grpc_asyncio"): client = NetAppAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5321,7 +5353,7 @@ async def test_update_volume_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_volume), "__call__") as call: @@ -5341,11 +5373,6 @@ async def test_update_volume_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_volume_async_from_dict(): - await test_update_volume_async(request_type=dict) - - def test_update_volume_field_headers(): client = NetAppClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5502,8 +5529,8 @@ async def test_update_volume_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - volume.DeleteVolumeRequest, - dict, + volume.DeleteVolumeRequest(), + {}, ], ) def test_delete_volume(request_type, transport: str = "grpc"): @@ -5514,7 +5541,7 @@ def test_delete_volume(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_volume), "__call__") as call: @@ -5555,9 +5582,10 @@ def test_delete_volume_non_empty_request_with_auto_populated_field(): client.delete_volume(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == volume.DeleteVolumeRequest( + request_msg = volume.DeleteVolumeRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_volume_use_cached_wrapped_rpc(): @@ -5648,9 +5676,14 @@ async def test_delete_volume_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_volume_async( - transport: str = "grpc_asyncio", request_type=volume.DeleteVolumeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + volume.DeleteVolumeRequest(), + {}, + ], +) +async def test_delete_volume_async(request_type, transport: str = "grpc_asyncio"): client = NetAppAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5658,7 +5691,7 @@ async def test_delete_volume_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_volume), "__call__") as call: @@ -5678,11 +5711,6 @@ async def test_delete_volume_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_volume_async_from_dict(): - await test_delete_volume_async(request_type=dict) - - def test_delete_volume_field_headers(): client = NetAppClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5829,8 +5857,8 @@ async def test_delete_volume_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - volume.RevertVolumeRequest, - dict, + volume.RevertVolumeRequest(), + {}, ], ) def test_revert_volume(request_type, transport: str = "grpc"): @@ -5841,7 +5869,7 @@ def test_revert_volume(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.revert_volume), "__call__") as call: @@ -5883,10 +5911,11 @@ def test_revert_volume_non_empty_request_with_auto_populated_field(): client.revert_volume(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == volume.RevertVolumeRequest( + request_msg = volume.RevertVolumeRequest( name="name_value", snapshot_id="snapshot_id_value", ) + assert args[0] == request_msg def test_revert_volume_use_cached_wrapped_rpc(): @@ -5977,9 +6006,14 @@ async def test_revert_volume_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_revert_volume_async( - transport: str = "grpc_asyncio", request_type=volume.RevertVolumeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + volume.RevertVolumeRequest(), + {}, + ], +) +async def test_revert_volume_async(request_type, transport: str = "grpc_asyncio"): client = NetAppAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5987,7 +6021,7 @@ async def test_revert_volume_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.revert_volume), "__call__") as call: @@ -6007,11 +6041,6 @@ async def test_revert_volume_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_revert_volume_async_from_dict(): - await test_revert_volume_async(request_type=dict) - - def test_revert_volume_field_headers(): client = NetAppClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6076,8 +6105,8 @@ async def test_revert_volume_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - volume.EstablishVolumePeeringRequest, - dict, + volume.EstablishVolumePeeringRequest(), + {}, ], ) def test_establish_volume_peering(request_type, transport: str = "grpc"): @@ -6088,7 +6117,7 @@ def test_establish_volume_peering(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6136,12 +6165,13 @@ def test_establish_volume_peering_non_empty_request_with_auto_populated_field(): client.establish_volume_peering(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == volume.EstablishVolumePeeringRequest( + request_msg = volume.EstablishVolumePeeringRequest( name="name_value", peer_cluster_name="peer_cluster_name_value", peer_svm_name="peer_svm_name_value", peer_volume_name="peer_volume_name_value", ) + assert args[0] == request_msg def test_establish_volume_peering_use_cached_wrapped_rpc(): @@ -6237,8 +6267,15 @@ async def test_establish_volume_peering_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + volume.EstablishVolumePeeringRequest(), + {}, + ], +) async def test_establish_volume_peering_async( - transport: str = "grpc_asyncio", request_type=volume.EstablishVolumePeeringRequest + request_type, transport: str = "grpc_asyncio" ): client = NetAppAsyncClient( credentials=async_anonymous_credentials(), @@ -6247,7 +6284,7 @@ async def test_establish_volume_peering_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( @@ -6269,11 +6306,6 @@ async def test_establish_volume_peering_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_establish_volume_peering_async_from_dict(): - await test_establish_volume_peering_async(request_type=dict) - - def test_establish_volume_peering_field_headers(): client = NetAppClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6342,8 +6374,8 @@ async def test_establish_volume_peering_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - snapshot.ListSnapshotsRequest, - dict, + snapshot.ListSnapshotsRequest(), + {}, ], ) def test_list_snapshots(request_type, transport: str = "grpc"): @@ -6354,7 +6386,7 @@ def test_list_snapshots(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_snapshots), "__call__") as call: @@ -6403,12 +6435,13 @@ def test_list_snapshots_non_empty_request_with_auto_populated_field(): client.list_snapshots(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == snapshot.ListSnapshotsRequest( + request_msg = snapshot.ListSnapshotsRequest( parent="parent_value", page_token="page_token_value", order_by="order_by_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_snapshots_use_cached_wrapped_rpc(): @@ -6489,9 +6522,14 @@ async def test_list_snapshots_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_snapshots_async( - transport: str = "grpc_asyncio", request_type=snapshot.ListSnapshotsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + snapshot.ListSnapshotsRequest(), + {}, + ], +) +async def test_list_snapshots_async(request_type, transport: str = "grpc_asyncio"): client = NetAppAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6499,7 +6537,7 @@ async def test_list_snapshots_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_snapshots), "__call__") as call: @@ -6524,11 +6562,6 @@ async def test_list_snapshots_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_snapshots_async_from_dict(): - await test_list_snapshots_async(request_type=dict) - - def test_list_snapshots_field_headers(): client = NetAppClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6865,8 +6898,8 @@ async def test_list_snapshots_async_pages(): @pytest.mark.parametrize( "request_type", [ - snapshot.GetSnapshotRequest, - dict, + snapshot.GetSnapshotRequest(), + {}, ], ) def test_get_snapshot(request_type, transport: str = "grpc"): @@ -6877,7 +6910,7 @@ def test_get_snapshot(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_snapshot), "__call__") as call: @@ -6929,9 +6962,10 @@ def test_get_snapshot_non_empty_request_with_auto_populated_field(): client.get_snapshot(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == snapshot.GetSnapshotRequest( + request_msg = snapshot.GetSnapshotRequest( name="name_value", ) + assert args[0] == request_msg def test_get_snapshot_use_cached_wrapped_rpc(): @@ -7012,9 +7046,14 @@ async def test_get_snapshot_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_snapshot_async( - transport: str = "grpc_asyncio", request_type=snapshot.GetSnapshotRequest -): +@pytest.mark.parametrize( + "request_type", + [ + snapshot.GetSnapshotRequest(), + {}, + ], +) +async def test_get_snapshot_async(request_type, transport: str = "grpc_asyncio"): client = NetAppAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7022,7 +7061,7 @@ async def test_get_snapshot_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_snapshot), "__call__") as call: @@ -7053,11 +7092,6 @@ async def test_get_snapshot_async( assert math.isclose(response.used_bytes, 0.10790000000000001, rel_tol=1e-6) -@pytest.mark.asyncio -async def test_get_snapshot_async_from_dict(): - await test_get_snapshot_async(request_type=dict) - - def test_get_snapshot_field_headers(): client = NetAppClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7200,8 +7234,8 @@ async def test_get_snapshot_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_snapshot.CreateSnapshotRequest, - dict, + gcn_snapshot.CreateSnapshotRequest(), + {}, ], ) def test_create_snapshot(request_type, transport: str = "grpc"): @@ -7212,7 +7246,7 @@ def test_create_snapshot(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_snapshot), "__call__") as call: @@ -7254,10 +7288,11 @@ def test_create_snapshot_non_empty_request_with_auto_populated_field(): client.create_snapshot(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_snapshot.CreateSnapshotRequest( + request_msg = gcn_snapshot.CreateSnapshotRequest( parent="parent_value", snapshot_id="snapshot_id_value", ) + assert args[0] == request_msg def test_create_snapshot_use_cached_wrapped_rpc(): @@ -7348,9 +7383,14 @@ async def test_create_snapshot_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_snapshot_async( - transport: str = "grpc_asyncio", request_type=gcn_snapshot.CreateSnapshotRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcn_snapshot.CreateSnapshotRequest(), + {}, + ], +) +async def test_create_snapshot_async(request_type, transport: str = "grpc_asyncio"): client = NetAppAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7358,7 +7398,7 @@ async def test_create_snapshot_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_snapshot), "__call__") as call: @@ -7378,11 +7418,6 @@ async def test_create_snapshot_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_snapshot_async_from_dict(): - await test_create_snapshot_async(request_type=dict) - - def test_create_snapshot_field_headers(): client = NetAppClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7549,8 +7584,8 @@ async def test_create_snapshot_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - snapshot.DeleteSnapshotRequest, - dict, + snapshot.DeleteSnapshotRequest(), + {}, ], ) def test_delete_snapshot(request_type, transport: str = "grpc"): @@ -7561,7 +7596,7 @@ def test_delete_snapshot(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_snapshot), "__call__") as call: @@ -7602,9 +7637,10 @@ def test_delete_snapshot_non_empty_request_with_auto_populated_field(): client.delete_snapshot(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == snapshot.DeleteSnapshotRequest( + request_msg = snapshot.DeleteSnapshotRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_snapshot_use_cached_wrapped_rpc(): @@ -7695,9 +7731,14 @@ async def test_delete_snapshot_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_snapshot_async( - transport: str = "grpc_asyncio", request_type=snapshot.DeleteSnapshotRequest -): +@pytest.mark.parametrize( + "request_type", + [ + snapshot.DeleteSnapshotRequest(), + {}, + ], +) +async def test_delete_snapshot_async(request_type, transport: str = "grpc_asyncio"): client = NetAppAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7705,7 +7746,7 @@ async def test_delete_snapshot_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_snapshot), "__call__") as call: @@ -7725,11 +7766,6 @@ async def test_delete_snapshot_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_snapshot_async_from_dict(): - await test_delete_snapshot_async(request_type=dict) - - def test_delete_snapshot_field_headers(): client = NetAppClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7876,8 +7912,8 @@ async def test_delete_snapshot_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_snapshot.UpdateSnapshotRequest, - dict, + gcn_snapshot.UpdateSnapshotRequest(), + {}, ], ) def test_update_snapshot(request_type, transport: str = "grpc"): @@ -7888,7 +7924,7 @@ def test_update_snapshot(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_snapshot), "__call__") as call: @@ -7927,7 +7963,8 @@ def test_update_snapshot_non_empty_request_with_auto_populated_field(): client.update_snapshot(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_snapshot.UpdateSnapshotRequest() + request_msg = gcn_snapshot.UpdateSnapshotRequest() + assert args[0] == request_msg def test_update_snapshot_use_cached_wrapped_rpc(): @@ -8018,9 +8055,14 @@ async def test_update_snapshot_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_snapshot_async( - transport: str = "grpc_asyncio", request_type=gcn_snapshot.UpdateSnapshotRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcn_snapshot.UpdateSnapshotRequest(), + {}, + ], +) +async def test_update_snapshot_async(request_type, transport: str = "grpc_asyncio"): client = NetAppAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8028,7 +8070,7 @@ async def test_update_snapshot_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_snapshot), "__call__") as call: @@ -8048,11 +8090,6 @@ async def test_update_snapshot_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_snapshot_async_from_dict(): - await test_update_snapshot_async(request_type=dict) - - def test_update_snapshot_field_headers(): client = NetAppClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8209,8 +8246,8 @@ async def test_update_snapshot_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - active_directory.ListActiveDirectoriesRequest, - dict, + active_directory.ListActiveDirectoriesRequest(), + {}, ], ) def test_list_active_directories(request_type, transport: str = "grpc"): @@ -8221,7 +8258,7 @@ def test_list_active_directories(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8274,12 +8311,13 @@ def test_list_active_directories_non_empty_request_with_auto_populated_field(): client.list_active_directories(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == active_directory.ListActiveDirectoriesRequest( + request_msg = active_directory.ListActiveDirectoriesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_active_directories_use_cached_wrapped_rpc(): @@ -8365,9 +8403,15 @@ async def test_list_active_directories_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + active_directory.ListActiveDirectoriesRequest(), + {}, + ], +) async def test_list_active_directories_async( - transport: str = "grpc_asyncio", - request_type=active_directory.ListActiveDirectoriesRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetAppAsyncClient( credentials=async_anonymous_credentials(), @@ -8376,7 +8420,7 @@ async def test_list_active_directories_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( @@ -8403,11 +8447,6 @@ async def test_list_active_directories_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_active_directories_async_from_dict(): - await test_list_active_directories_async(request_type=dict) - - def test_list_active_directories_field_headers(): client = NetAppClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8760,8 +8799,8 @@ async def test_list_active_directories_async_pages(): @pytest.mark.parametrize( "request_type", [ - active_directory.GetActiveDirectoryRequest, - dict, + active_directory.GetActiveDirectoryRequest(), + {}, ], ) def test_get_active_directory(request_type, transport: str = "grpc"): @@ -8772,7 +8811,7 @@ def test_get_active_directory(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8858,9 +8897,10 @@ def test_get_active_directory_non_empty_request_with_auto_populated_field(): client.get_active_directory(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == active_directory.GetActiveDirectoryRequest( + request_msg = active_directory.GetActiveDirectoryRequest( name="name_value", ) + assert args[0] == request_msg def test_get_active_directory_use_cached_wrapped_rpc(): @@ -8945,9 +8985,15 @@ async def test_get_active_directory_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + active_directory.GetActiveDirectoryRequest(), + {}, + ], +) async def test_get_active_directory_async( - transport: str = "grpc_asyncio", - request_type=active_directory.GetActiveDirectoryRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetAppAsyncClient( credentials=async_anonymous_credentials(), @@ -8956,7 +9002,7 @@ async def test_get_active_directory_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( @@ -9019,11 +9065,6 @@ async def test_get_active_directory_async( assert response.state_details == "state_details_value" -@pytest.mark.asyncio -async def test_get_active_directory_async_from_dict(): - await test_get_active_directory_async(request_type=dict) - - def test_get_active_directory_field_headers(): client = NetAppClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9178,8 +9219,8 @@ async def test_get_active_directory_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_active_directory.CreateActiveDirectoryRequest, - dict, + gcn_active_directory.CreateActiveDirectoryRequest(), + {}, ], ) def test_create_active_directory(request_type, transport: str = "grpc"): @@ -9190,7 +9231,7 @@ def test_create_active_directory(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9236,10 +9277,11 @@ def test_create_active_directory_non_empty_request_with_auto_populated_field(): client.create_active_directory(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_active_directory.CreateActiveDirectoryRequest( + request_msg = gcn_active_directory.CreateActiveDirectoryRequest( parent="parent_value", active_directory_id="active_directory_id_value", ) + assert args[0] == request_msg def test_create_active_directory_use_cached_wrapped_rpc(): @@ -9335,9 +9377,15 @@ async def test_create_active_directory_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcn_active_directory.CreateActiveDirectoryRequest(), + {}, + ], +) async def test_create_active_directory_async( - transport: str = "grpc_asyncio", - request_type=gcn_active_directory.CreateActiveDirectoryRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetAppAsyncClient( credentials=async_anonymous_credentials(), @@ -9346,7 +9394,7 @@ async def test_create_active_directory_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( @@ -9368,11 +9416,6 @@ async def test_create_active_directory_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_active_directory_async_from_dict(): - await test_create_active_directory_async(request_type=dict) - - def test_create_active_directory_field_headers(): client = NetAppClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9547,8 +9590,8 @@ async def test_create_active_directory_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_active_directory.UpdateActiveDirectoryRequest, - dict, + gcn_active_directory.UpdateActiveDirectoryRequest(), + {}, ], ) def test_update_active_directory(request_type, transport: str = "grpc"): @@ -9559,7 +9602,7 @@ def test_update_active_directory(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9602,7 +9645,8 @@ def test_update_active_directory_non_empty_request_with_auto_populated_field(): client.update_active_directory(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_active_directory.UpdateActiveDirectoryRequest() + request_msg = gcn_active_directory.UpdateActiveDirectoryRequest() + assert args[0] == request_msg def test_update_active_directory_use_cached_wrapped_rpc(): @@ -9698,9 +9742,15 @@ async def test_update_active_directory_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcn_active_directory.UpdateActiveDirectoryRequest(), + {}, + ], +) async def test_update_active_directory_async( - transport: str = "grpc_asyncio", - request_type=gcn_active_directory.UpdateActiveDirectoryRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetAppAsyncClient( credentials=async_anonymous_credentials(), @@ -9709,7 +9759,7 @@ async def test_update_active_directory_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( @@ -9731,11 +9781,6 @@ async def test_update_active_directory_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_active_directory_async_from_dict(): - await test_update_active_directory_async(request_type=dict) - - def test_update_active_directory_field_headers(): client = NetAppClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9900,8 +9945,8 @@ async def test_update_active_directory_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - active_directory.DeleteActiveDirectoryRequest, - dict, + active_directory.DeleteActiveDirectoryRequest(), + {}, ], ) def test_delete_active_directory(request_type, transport: str = "grpc"): @@ -9912,7 +9957,7 @@ def test_delete_active_directory(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9957,9 +10002,10 @@ def test_delete_active_directory_non_empty_request_with_auto_populated_field(): client.delete_active_directory(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == active_directory.DeleteActiveDirectoryRequest( + request_msg = active_directory.DeleteActiveDirectoryRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_active_directory_use_cached_wrapped_rpc(): @@ -10055,9 +10101,15 @@ async def test_delete_active_directory_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + active_directory.DeleteActiveDirectoryRequest(), + {}, + ], +) async def test_delete_active_directory_async( - transport: str = "grpc_asyncio", - request_type=active_directory.DeleteActiveDirectoryRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetAppAsyncClient( credentials=async_anonymous_credentials(), @@ -10066,7 +10118,7 @@ async def test_delete_active_directory_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( @@ -10088,11 +10140,6 @@ async def test_delete_active_directory_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_active_directory_async_from_dict(): - await test_delete_active_directory_async(request_type=dict) - - def test_delete_active_directory_field_headers(): client = NetAppClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10247,8 +10294,8 @@ async def test_delete_active_directory_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - kms.ListKmsConfigsRequest, - dict, + kms.ListKmsConfigsRequest(), + {}, ], ) def test_list_kms_configs(request_type, transport: str = "grpc"): @@ -10259,7 +10306,7 @@ def test_list_kms_configs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_kms_configs), "__call__") as call: @@ -10308,12 +10355,13 @@ def test_list_kms_configs_non_empty_request_with_auto_populated_field(): client.list_kms_configs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == kms.ListKmsConfigsRequest( + request_msg = kms.ListKmsConfigsRequest( parent="parent_value", page_token="page_token_value", order_by="order_by_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_kms_configs_use_cached_wrapped_rpc(): @@ -10396,9 +10444,14 @@ async def test_list_kms_configs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_kms_configs_async( - transport: str = "grpc_asyncio", request_type=kms.ListKmsConfigsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + kms.ListKmsConfigsRequest(), + {}, + ], +) +async def test_list_kms_configs_async(request_type, transport: str = "grpc_asyncio"): client = NetAppAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10406,7 +10459,7 @@ async def test_list_kms_configs_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_kms_configs), "__call__") as call: @@ -10431,11 +10484,6 @@ async def test_list_kms_configs_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_kms_configs_async_from_dict(): - await test_list_kms_configs_async(request_type=dict) - - def test_list_kms_configs_field_headers(): client = NetAppClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10772,8 +10820,8 @@ async def test_list_kms_configs_async_pages(): @pytest.mark.parametrize( "request_type", [ - kms.CreateKmsConfigRequest, - dict, + kms.CreateKmsConfigRequest(), + {}, ], ) def test_create_kms_config(request_type, transport: str = "grpc"): @@ -10784,7 +10832,7 @@ def test_create_kms_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( @@ -10830,10 +10878,11 @@ def test_create_kms_config_non_empty_request_with_auto_populated_field(): client.create_kms_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == kms.CreateKmsConfigRequest( + request_msg = kms.CreateKmsConfigRequest( parent="parent_value", kms_config_id="kms_config_id_value", ) + assert args[0] == request_msg def test_create_kms_config_use_cached_wrapped_rpc(): @@ -10926,9 +10975,14 @@ async def test_create_kms_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_kms_config_async( - transport: str = "grpc_asyncio", request_type=kms.CreateKmsConfigRequest -): +@pytest.mark.parametrize( + "request_type", + [ + kms.CreateKmsConfigRequest(), + {}, + ], +) +async def test_create_kms_config_async(request_type, transport: str = "grpc_asyncio"): client = NetAppAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10936,7 +10990,7 @@ async def test_create_kms_config_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( @@ -10958,11 +11012,6 @@ async def test_create_kms_config_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_kms_config_async_from_dict(): - await test_create_kms_config_async(request_type=dict) - - def test_create_kms_config_field_headers(): client = NetAppClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11137,8 +11186,8 @@ async def test_create_kms_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - kms.GetKmsConfigRequest, - dict, + kms.GetKmsConfigRequest(), + {}, ], ) def test_get_kms_config(request_type, transport: str = "grpc"): @@ -11149,7 +11198,7 @@ def test_get_kms_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(type(client.transport.get_kms_config), "__call__") as call: @@ -11205,9 +11254,10 @@ def test_get_kms_config_non_empty_request_with_auto_populated_field(): client.get_kms_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == kms.GetKmsConfigRequest( + request_msg = kms.GetKmsConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_kms_config_use_cached_wrapped_rpc(): @@ -11288,9 +11338,14 @@ async def test_get_kms_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_kms_config_async( - transport: str = "grpc_asyncio", request_type=kms.GetKmsConfigRequest -): +@pytest.mark.parametrize( + "request_type", + [ + kms.GetKmsConfigRequest(), + {}, + ], +) +async def test_get_kms_config_async(request_type, transport: str = "grpc_asyncio"): client = NetAppAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11298,7 +11353,7 @@ async def test_get_kms_config_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_kms_config), "__call__") as call: @@ -11333,11 +11388,6 @@ async def test_get_kms_config_async( assert response.service_account == "service_account_value" -@pytest.mark.asyncio -async def test_get_kms_config_async_from_dict(): - await test_get_kms_config_async(request_type=dict) - - def test_get_kms_config_field_headers(): client = NetAppClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11480,8 +11530,8 @@ async def test_get_kms_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - kms.UpdateKmsConfigRequest, - dict, + kms.UpdateKmsConfigRequest(), + {}, ], ) def test_update_kms_config(request_type, transport: str = "grpc"): @@ -11492,7 +11542,7 @@ def test_update_kms_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( @@ -11535,7 +11585,8 @@ def test_update_kms_config_non_empty_request_with_auto_populated_field(): client.update_kms_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == kms.UpdateKmsConfigRequest() + request_msg = kms.UpdateKmsConfigRequest() + assert args[0] == request_msg def test_update_kms_config_use_cached_wrapped_rpc(): @@ -11628,9 +11679,14 @@ async def test_update_kms_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_kms_config_async( - transport: str = "grpc_asyncio", request_type=kms.UpdateKmsConfigRequest -): +@pytest.mark.parametrize( + "request_type", + [ + kms.UpdateKmsConfigRequest(), + {}, + ], +) +async def test_update_kms_config_async(request_type, transport: str = "grpc_asyncio"): client = NetAppAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11638,7 +11694,7 @@ async def test_update_kms_config_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( @@ -11660,11 +11716,6 @@ async def test_update_kms_config_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_kms_config_async_from_dict(): - await test_update_kms_config_async(request_type=dict) - - def test_update_kms_config_field_headers(): client = NetAppClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11829,8 +11880,8 @@ async def test_update_kms_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - kms.EncryptVolumesRequest, - dict, + kms.EncryptVolumesRequest(), + {}, ], ) def test_encrypt_volumes(request_type, transport: str = "grpc"): @@ -11841,7 +11892,7 @@ def test_encrypt_volumes(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.encrypt_volumes), "__call__") as call: @@ -11882,9 +11933,10 @@ def test_encrypt_volumes_non_empty_request_with_auto_populated_field(): client.encrypt_volumes(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == kms.EncryptVolumesRequest( + request_msg = kms.EncryptVolumesRequest( name="name_value", ) + assert args[0] == request_msg def test_encrypt_volumes_use_cached_wrapped_rpc(): @@ -11975,9 +12027,14 @@ async def test_encrypt_volumes_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_encrypt_volumes_async( - transport: str = "grpc_asyncio", request_type=kms.EncryptVolumesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + kms.EncryptVolumesRequest(), + {}, + ], +) +async def test_encrypt_volumes_async(request_type, transport: str = "grpc_asyncio"): client = NetAppAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11985,7 +12042,7 @@ async def test_encrypt_volumes_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.encrypt_volumes), "__call__") as call: @@ -12005,11 +12062,6 @@ async def test_encrypt_volumes_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_encrypt_volumes_async_from_dict(): - await test_encrypt_volumes_async(request_type=dict) - - def test_encrypt_volumes_field_headers(): client = NetAppClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12074,8 +12126,8 @@ async def test_encrypt_volumes_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - kms.VerifyKmsConfigRequest, - dict, + kms.VerifyKmsConfigRequest(), + {}, ], ) def test_verify_kms_config(request_type, transport: str = "grpc"): @@ -12086,7 +12138,7 @@ def test_verify_kms_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( @@ -12138,9 +12190,10 @@ def test_verify_kms_config_non_empty_request_with_auto_populated_field(): client.verify_kms_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == kms.VerifyKmsConfigRequest( + request_msg = kms.VerifyKmsConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_verify_kms_config_use_cached_wrapped_rpc(): @@ -12223,9 +12276,14 @@ async def test_verify_kms_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_verify_kms_config_async( - transport: str = "grpc_asyncio", request_type=kms.VerifyKmsConfigRequest -): +@pytest.mark.parametrize( + "request_type", + [ + kms.VerifyKmsConfigRequest(), + {}, + ], +) +async def test_verify_kms_config_async(request_type, transport: str = "grpc_asyncio"): client = NetAppAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12233,7 +12291,7 @@ async def test_verify_kms_config_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( @@ -12262,11 +12320,6 @@ async def test_verify_kms_config_async( assert response.instructions == "instructions_value" -@pytest.mark.asyncio -async def test_verify_kms_config_async_from_dict(): - await test_verify_kms_config_async(request_type=dict) - - def test_verify_kms_config_field_headers(): client = NetAppClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12335,8 +12388,8 @@ async def test_verify_kms_config_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - kms.DeleteKmsConfigRequest, - dict, + kms.DeleteKmsConfigRequest(), + {}, ], ) def test_delete_kms_config(request_type, transport: str = "grpc"): @@ -12347,7 +12400,7 @@ def test_delete_kms_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( @@ -12392,9 +12445,10 @@ def test_delete_kms_config_non_empty_request_with_auto_populated_field(): client.delete_kms_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == kms.DeleteKmsConfigRequest( + request_msg = kms.DeleteKmsConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_kms_config_use_cached_wrapped_rpc(): @@ -12487,9 +12541,14 @@ async def test_delete_kms_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_kms_config_async( - transport: str = "grpc_asyncio", request_type=kms.DeleteKmsConfigRequest -): +@pytest.mark.parametrize( + "request_type", + [ + kms.DeleteKmsConfigRequest(), + {}, + ], +) +async def test_delete_kms_config_async(request_type, transport: str = "grpc_asyncio"): client = NetAppAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12497,7 +12556,7 @@ async def test_delete_kms_config_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( @@ -12519,11 +12578,6 @@ async def test_delete_kms_config_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_kms_config_async_from_dict(): - await test_delete_kms_config_async(request_type=dict) - - def test_delete_kms_config_field_headers(): client = NetAppClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12678,8 +12732,8 @@ async def test_delete_kms_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - replication.ListReplicationsRequest, - dict, + replication.ListReplicationsRequest(), + {}, ], ) def test_list_replications(request_type, transport: str = "grpc"): @@ -12690,7 +12744,7 @@ def test_list_replications(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -12743,12 +12797,13 @@ def test_list_replications_non_empty_request_with_auto_populated_field(): client.list_replications(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == replication.ListReplicationsRequest( + request_msg = replication.ListReplicationsRequest( parent="parent_value", page_token="page_token_value", order_by="order_by_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_replications_use_cached_wrapped_rpc(): @@ -12831,9 +12886,14 @@ async def test_list_replications_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_replications_async( - transport: str = "grpc_asyncio", request_type=replication.ListReplicationsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + replication.ListReplicationsRequest(), + {}, + ], +) +async def test_list_replications_async(request_type, transport: str = "grpc_asyncio"): client = NetAppAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12841,7 +12901,7 @@ async def test_list_replications_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( @@ -12868,11 +12928,6 @@ async def test_list_replications_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_replications_async_from_dict(): - await test_list_replications_async(request_type=dict) - - def test_list_replications_field_headers(): client = NetAppClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13225,8 +13280,8 @@ async def test_list_replications_async_pages(): @pytest.mark.parametrize( "request_type", [ - replication.GetReplicationRequest, - dict, + replication.GetReplicationRequest(), + {}, ], ) def test_get_replication(request_type, transport: str = "grpc"): @@ -13237,7 +13292,7 @@ def test_get_replication(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_replication), "__call__") as call: @@ -13309,9 +13364,10 @@ def test_get_replication_non_empty_request_with_auto_populated_field(): client.get_replication(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == replication.GetReplicationRequest( + request_msg = replication.GetReplicationRequest( name="name_value", ) + assert args[0] == request_msg def test_get_replication_use_cached_wrapped_rpc(): @@ -13392,9 +13448,14 @@ async def test_get_replication_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_replication_async( - transport: str = "grpc_asyncio", request_type=replication.GetReplicationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + replication.GetReplicationRequest(), + {}, + ], +) +async def test_get_replication_async(request_type, transport: str = "grpc_asyncio"): client = NetAppAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13402,7 +13463,7 @@ async def test_get_replication_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_replication), "__call__") as call: @@ -13453,11 +13514,6 @@ async def test_get_replication_async( ) -@pytest.mark.asyncio -async def test_get_replication_async_from_dict(): - await test_get_replication_async(request_type=dict) - - def test_get_replication_field_headers(): client = NetAppClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13604,8 +13660,8 @@ async def test_get_replication_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_replication.CreateReplicationRequest, - dict, + gcn_replication.CreateReplicationRequest(), + {}, ], ) def test_create_replication(request_type, transport: str = "grpc"): @@ -13616,7 +13672,7 @@ def test_create_replication(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -13662,10 +13718,11 @@ def test_create_replication_non_empty_request_with_auto_populated_field(): client.create_replication(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_replication.CreateReplicationRequest( + request_msg = gcn_replication.CreateReplicationRequest( parent="parent_value", replication_id="replication_id_value", ) + assert args[0] == request_msg def test_create_replication_use_cached_wrapped_rpc(): @@ -13760,10 +13817,14 @@ async def test_create_replication_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_replication_async( - transport: str = "grpc_asyncio", - request_type=gcn_replication.CreateReplicationRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + gcn_replication.CreateReplicationRequest(), + {}, + ], +) +async def test_create_replication_async(request_type, transport: str = "grpc_asyncio"): client = NetAppAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13771,7 +13832,7 @@ async def test_create_replication_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( @@ -13793,11 +13854,6 @@ async def test_create_replication_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_replication_async_from_dict(): - await test_create_replication_async(request_type=dict) - - def test_create_replication_field_headers(): client = NetAppClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13972,8 +14028,8 @@ async def test_create_replication_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - replication.DeleteReplicationRequest, - dict, + replication.DeleteReplicationRequest(), + {}, ], ) def test_delete_replication(request_type, transport: str = "grpc"): @@ -13984,7 +14040,7 @@ def test_delete_replication(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -14029,9 +14085,10 @@ def test_delete_replication_non_empty_request_with_auto_populated_field(): client.delete_replication(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == replication.DeleteReplicationRequest( + request_msg = replication.DeleteReplicationRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_replication_use_cached_wrapped_rpc(): @@ -14126,9 +14183,14 @@ async def test_delete_replication_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_replication_async( - transport: str = "grpc_asyncio", request_type=replication.DeleteReplicationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + replication.DeleteReplicationRequest(), + {}, + ], +) +async def test_delete_replication_async(request_type, transport: str = "grpc_asyncio"): client = NetAppAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14136,7 +14198,7 @@ async def test_delete_replication_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( @@ -14158,11 +14220,6 @@ async def test_delete_replication_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_replication_async_from_dict(): - await test_delete_replication_async(request_type=dict) - - def test_delete_replication_field_headers(): client = NetAppClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14317,8 +14374,8 @@ async def test_delete_replication_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_replication.UpdateReplicationRequest, - dict, + gcn_replication.UpdateReplicationRequest(), + {}, ], ) def test_update_replication(request_type, transport: str = "grpc"): @@ -14329,7 +14386,7 @@ def test_update_replication(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -14372,7 +14429,8 @@ def test_update_replication_non_empty_request_with_auto_populated_field(): client.update_replication(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_replication.UpdateReplicationRequest() + request_msg = gcn_replication.UpdateReplicationRequest() + assert args[0] == request_msg def test_update_replication_use_cached_wrapped_rpc(): @@ -14467,10 +14525,14 @@ async def test_update_replication_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_replication_async( - transport: str = "grpc_asyncio", - request_type=gcn_replication.UpdateReplicationRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + gcn_replication.UpdateReplicationRequest(), + {}, + ], +) +async def test_update_replication_async(request_type, transport: str = "grpc_asyncio"): client = NetAppAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14478,7 +14540,7 @@ async def test_update_replication_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( @@ -14500,11 +14562,6 @@ async def test_update_replication_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_replication_async_from_dict(): - await test_update_replication_async(request_type=dict) - - def test_update_replication_field_headers(): client = NetAppClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14669,8 +14726,8 @@ async def test_update_replication_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - replication.StopReplicationRequest, - dict, + replication.StopReplicationRequest(), + {}, ], ) def test_stop_replication(request_type, transport: str = "grpc"): @@ -14681,7 +14738,7 @@ def test_stop_replication(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.stop_replication), "__call__") as call: @@ -14722,9 +14779,10 @@ def test_stop_replication_non_empty_request_with_auto_populated_field(): client.stop_replication(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == replication.StopReplicationRequest( + request_msg = replication.StopReplicationRequest( name="name_value", ) + assert args[0] == request_msg def test_stop_replication_use_cached_wrapped_rpc(): @@ -14817,9 +14875,14 @@ async def test_stop_replication_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_stop_replication_async( - transport: str = "grpc_asyncio", request_type=replication.StopReplicationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + replication.StopReplicationRequest(), + {}, + ], +) +async def test_stop_replication_async(request_type, transport: str = "grpc_asyncio"): client = NetAppAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14827,7 +14890,7 @@ async def test_stop_replication_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.stop_replication), "__call__") as call: @@ -14847,11 +14910,6 @@ async def test_stop_replication_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_stop_replication_async_from_dict(): - await test_stop_replication_async(request_type=dict) - - def test_stop_replication_field_headers(): client = NetAppClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14916,8 +14974,8 @@ async def test_stop_replication_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - replication.ResumeReplicationRequest, - dict, + replication.ResumeReplicationRequest(), + {}, ], ) def test_resume_replication(request_type, transport: str = "grpc"): @@ -14928,7 +14986,7 @@ def test_resume_replication(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -14973,9 +15031,10 @@ def test_resume_replication_non_empty_request_with_auto_populated_field(): client.resume_replication(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == replication.ResumeReplicationRequest( + request_msg = replication.ResumeReplicationRequest( name="name_value", ) + assert args[0] == request_msg def test_resume_replication_use_cached_wrapped_rpc(): @@ -15070,9 +15129,14 @@ async def test_resume_replication_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_resume_replication_async( - transport: str = "grpc_asyncio", request_type=replication.ResumeReplicationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + replication.ResumeReplicationRequest(), + {}, + ], +) +async def test_resume_replication_async(request_type, transport: str = "grpc_asyncio"): client = NetAppAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -15080,7 +15144,7 @@ async def test_resume_replication_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( @@ -15102,11 +15166,6 @@ async def test_resume_replication_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_resume_replication_async_from_dict(): - await test_resume_replication_async(request_type=dict) - - def test_resume_replication_field_headers(): client = NetAppClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15175,8 +15234,8 @@ async def test_resume_replication_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - replication.ReverseReplicationDirectionRequest, - dict, + replication.ReverseReplicationDirectionRequest(), + {}, ], ) def test_reverse_replication_direction(request_type, transport: str = "grpc"): @@ -15187,7 +15246,7 @@ def test_reverse_replication_direction(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -15232,9 +15291,10 @@ def test_reverse_replication_direction_non_empty_request_with_auto_populated_fie client.reverse_replication_direction(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == replication.ReverseReplicationDirectionRequest( + request_msg = replication.ReverseReplicationDirectionRequest( name="name_value", ) + assert args[0] == request_msg def test_reverse_replication_direction_use_cached_wrapped_rpc(): @@ -15330,9 +15390,15 @@ async def test_reverse_replication_direction_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + replication.ReverseReplicationDirectionRequest(), + {}, + ], +) async def test_reverse_replication_direction_async( - transport: str = "grpc_asyncio", - request_type=replication.ReverseReplicationDirectionRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetAppAsyncClient( credentials=async_anonymous_credentials(), @@ -15341,7 +15407,7 @@ async def test_reverse_replication_direction_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( @@ -15363,11 +15429,6 @@ async def test_reverse_replication_direction_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_reverse_replication_direction_async_from_dict(): - await test_reverse_replication_direction_async(request_type=dict) - - def test_reverse_replication_direction_field_headers(): client = NetAppClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15436,8 +15497,8 @@ async def test_reverse_replication_direction_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - replication.EstablishPeeringRequest, - dict, + replication.EstablishPeeringRequest(), + {}, ], ) def test_establish_peering(request_type, transport: str = "grpc"): @@ -15448,7 +15509,7 @@ def test_establish_peering(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -15496,12 +15557,13 @@ def test_establish_peering_non_empty_request_with_auto_populated_field(): client.establish_peering(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == replication.EstablishPeeringRequest( + request_msg = replication.EstablishPeeringRequest( name="name_value", peer_cluster_name="peer_cluster_name_value", peer_svm_name="peer_svm_name_value", peer_volume_name="peer_volume_name_value", ) + assert args[0] == request_msg def test_establish_peering_use_cached_wrapped_rpc(): @@ -15594,9 +15656,14 @@ async def test_establish_peering_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_establish_peering_async( - transport: str = "grpc_asyncio", request_type=replication.EstablishPeeringRequest -): +@pytest.mark.parametrize( + "request_type", + [ + replication.EstablishPeeringRequest(), + {}, + ], +) +async def test_establish_peering_async(request_type, transport: str = "grpc_asyncio"): client = NetAppAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -15604,7 +15671,7 @@ async def test_establish_peering_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( @@ -15626,11 +15693,6 @@ async def test_establish_peering_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_establish_peering_async_from_dict(): - await test_establish_peering_async(request_type=dict) - - def test_establish_peering_field_headers(): client = NetAppClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15699,8 +15761,8 @@ async def test_establish_peering_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - replication.SyncReplicationRequest, - dict, + replication.SyncReplicationRequest(), + {}, ], ) def test_sync_replication(request_type, transport: str = "grpc"): @@ -15711,7 +15773,7 @@ def test_sync_replication(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.sync_replication), "__call__") as call: @@ -15752,9 +15814,10 @@ def test_sync_replication_non_empty_request_with_auto_populated_field(): client.sync_replication(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == replication.SyncReplicationRequest( + request_msg = replication.SyncReplicationRequest( name="name_value", ) + assert args[0] == request_msg def test_sync_replication_use_cached_wrapped_rpc(): @@ -15847,9 +15910,14 @@ async def test_sync_replication_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_sync_replication_async( - transport: str = "grpc_asyncio", request_type=replication.SyncReplicationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + replication.SyncReplicationRequest(), + {}, + ], +) +async def test_sync_replication_async(request_type, transport: str = "grpc_asyncio"): client = NetAppAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -15857,7 +15925,7 @@ async def test_sync_replication_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.sync_replication), "__call__") as call: @@ -15877,11 +15945,6 @@ async def test_sync_replication_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_sync_replication_async_from_dict(): - await test_sync_replication_async(request_type=dict) - - def test_sync_replication_field_headers(): client = NetAppClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15946,8 +16009,8 @@ async def test_sync_replication_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - gcn_backup_vault.CreateBackupVaultRequest, - dict, + gcn_backup_vault.CreateBackupVaultRequest(), + {}, ], ) def test_create_backup_vault(request_type, transport: str = "grpc"): @@ -15958,7 +16021,7 @@ def test_create_backup_vault(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -16004,10 +16067,11 @@ def test_create_backup_vault_non_empty_request_with_auto_populated_field(): client.create_backup_vault(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_backup_vault.CreateBackupVaultRequest( + request_msg = gcn_backup_vault.CreateBackupVaultRequest( parent="parent_value", backup_vault_id="backup_vault_id_value", ) + assert args[0] == request_msg def test_create_backup_vault_use_cached_wrapped_rpc(): @@ -16102,10 +16166,14 @@ async def test_create_backup_vault_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_backup_vault_async( - transport: str = "grpc_asyncio", - request_type=gcn_backup_vault.CreateBackupVaultRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + gcn_backup_vault.CreateBackupVaultRequest(), + {}, + ], +) +async def test_create_backup_vault_async(request_type, transport: str = "grpc_asyncio"): client = NetAppAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -16113,7 +16181,7 @@ async def test_create_backup_vault_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( @@ -16135,11 +16203,6 @@ async def test_create_backup_vault_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_backup_vault_async_from_dict(): - await test_create_backup_vault_async(request_type=dict) - - def test_create_backup_vault_field_headers(): client = NetAppClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16314,8 +16377,8 @@ async def test_create_backup_vault_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - backup_vault.GetBackupVaultRequest, - dict, + backup_vault.GetBackupVaultRequest(), + {}, ], ) def test_get_backup_vault(request_type, transport: str = "grpc"): @@ -16326,7 +16389,7 @@ def test_get_backup_vault(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_backup_vault), "__call__") as call: @@ -16395,9 +16458,10 @@ def test_get_backup_vault_non_empty_request_with_auto_populated_field(): client.get_backup_vault(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == backup_vault.GetBackupVaultRequest( + request_msg = backup_vault.GetBackupVaultRequest( name="name_value", ) + assert args[0] == request_msg def test_get_backup_vault_use_cached_wrapped_rpc(): @@ -16480,9 +16544,14 @@ async def test_get_backup_vault_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_backup_vault_async( - transport: str = "grpc_asyncio", request_type=backup_vault.GetBackupVaultRequest -): +@pytest.mark.parametrize( + "request_type", + [ + backup_vault.GetBackupVaultRequest(), + {}, + ], +) +async def test_get_backup_vault_async(request_type, transport: str = "grpc_asyncio"): client = NetAppAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -16490,7 +16559,7 @@ async def test_get_backup_vault_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_backup_vault), "__call__") as call: @@ -16538,11 +16607,6 @@ async def test_get_backup_vault_async( assert response.backups_crypto_key_version == "backups_crypto_key_version_value" -@pytest.mark.asyncio -async def test_get_backup_vault_async_from_dict(): - await test_get_backup_vault_async(request_type=dict) - - def test_get_backup_vault_field_headers(): client = NetAppClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16689,8 +16753,8 @@ async def test_get_backup_vault_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - backup_vault.ListBackupVaultsRequest, - dict, + backup_vault.ListBackupVaultsRequest(), + {}, ], ) def test_list_backup_vaults(request_type, transport: str = "grpc"): @@ -16701,7 +16765,7 @@ def test_list_backup_vaults(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -16754,12 +16818,13 @@ def test_list_backup_vaults_non_empty_request_with_auto_populated_field(): client.list_backup_vaults(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == backup_vault.ListBackupVaultsRequest( + request_msg = backup_vault.ListBackupVaultsRequest( parent="parent_value", page_token="page_token_value", order_by="order_by_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_backup_vaults_use_cached_wrapped_rpc(): @@ -16844,9 +16909,14 @@ async def test_list_backup_vaults_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_backup_vaults_async( - transport: str = "grpc_asyncio", request_type=backup_vault.ListBackupVaultsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + backup_vault.ListBackupVaultsRequest(), + {}, + ], +) +async def test_list_backup_vaults_async(request_type, transport: str = "grpc_asyncio"): client = NetAppAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -16854,7 +16924,7 @@ async def test_list_backup_vaults_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( @@ -16881,11 +16951,6 @@ async def test_list_backup_vaults_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_backup_vaults_async_from_dict(): - await test_list_backup_vaults_async(request_type=dict) - - def test_list_backup_vaults_field_headers(): client = NetAppClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17238,8 +17303,8 @@ async def test_list_backup_vaults_async_pages(): @pytest.mark.parametrize( "request_type", [ - gcn_backup_vault.UpdateBackupVaultRequest, - dict, + gcn_backup_vault.UpdateBackupVaultRequest(), + {}, ], ) def test_update_backup_vault(request_type, transport: str = "grpc"): @@ -17250,7 +17315,7 @@ def test_update_backup_vault(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -17293,7 +17358,8 @@ def test_update_backup_vault_non_empty_request_with_auto_populated_field(): client.update_backup_vault(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_backup_vault.UpdateBackupVaultRequest() + request_msg = gcn_backup_vault.UpdateBackupVaultRequest() + assert args[0] == request_msg def test_update_backup_vault_use_cached_wrapped_rpc(): @@ -17388,10 +17454,14 @@ async def test_update_backup_vault_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_backup_vault_async( - transport: str = "grpc_asyncio", - request_type=gcn_backup_vault.UpdateBackupVaultRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + gcn_backup_vault.UpdateBackupVaultRequest(), + {}, + ], +) +async def test_update_backup_vault_async(request_type, transport: str = "grpc_asyncio"): client = NetAppAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -17399,7 +17469,7 @@ async def test_update_backup_vault_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( @@ -17421,11 +17491,6 @@ async def test_update_backup_vault_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_backup_vault_async_from_dict(): - await test_update_backup_vault_async(request_type=dict) - - def test_update_backup_vault_field_headers(): client = NetAppClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17590,8 +17655,8 @@ async def test_update_backup_vault_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - backup_vault.DeleteBackupVaultRequest, - dict, + backup_vault.DeleteBackupVaultRequest(), + {}, ], ) def test_delete_backup_vault(request_type, transport: str = "grpc"): @@ -17602,7 +17667,7 @@ def test_delete_backup_vault(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -17647,9 +17712,10 @@ def test_delete_backup_vault_non_empty_request_with_auto_populated_field(): client.delete_backup_vault(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == backup_vault.DeleteBackupVaultRequest( + request_msg = backup_vault.DeleteBackupVaultRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_backup_vault_use_cached_wrapped_rpc(): @@ -17744,9 +17810,14 @@ async def test_delete_backup_vault_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_backup_vault_async( - transport: str = "grpc_asyncio", request_type=backup_vault.DeleteBackupVaultRequest -): +@pytest.mark.parametrize( + "request_type", + [ + backup_vault.DeleteBackupVaultRequest(), + {}, + ], +) +async def test_delete_backup_vault_async(request_type, transport: str = "grpc_asyncio"): client = NetAppAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -17754,7 +17825,7 @@ async def test_delete_backup_vault_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( @@ -17776,11 +17847,6 @@ async def test_delete_backup_vault_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_backup_vault_async_from_dict(): - await test_delete_backup_vault_async(request_type=dict) - - def test_delete_backup_vault_field_headers(): client = NetAppClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17935,8 +18001,8 @@ async def test_delete_backup_vault_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_backup.CreateBackupRequest, - dict, + gcn_backup.CreateBackupRequest(), + {}, ], ) def test_create_backup(request_type, transport: str = "grpc"): @@ -17947,7 +18013,7 @@ def test_create_backup(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_backup), "__call__") as call: @@ -17989,10 +18055,11 @@ def test_create_backup_non_empty_request_with_auto_populated_field(): client.create_backup(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_backup.CreateBackupRequest( + request_msg = gcn_backup.CreateBackupRequest( parent="parent_value", backup_id="backup_id_value", ) + assert args[0] == request_msg def test_create_backup_use_cached_wrapped_rpc(): @@ -18083,9 +18150,14 @@ async def test_create_backup_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_backup_async( - transport: str = "grpc_asyncio", request_type=gcn_backup.CreateBackupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcn_backup.CreateBackupRequest(), + {}, + ], +) +async def test_create_backup_async(request_type, transport: str = "grpc_asyncio"): client = NetAppAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -18093,7 +18165,7 @@ async def test_create_backup_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_backup), "__call__") as call: @@ -18113,11 +18185,6 @@ async def test_create_backup_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_backup_async_from_dict(): - await test_create_backup_async(request_type=dict) - - def test_create_backup_field_headers(): client = NetAppClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18284,8 +18351,8 @@ async def test_create_backup_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - backup.GetBackupRequest, - dict, + backup.GetBackupRequest(), + {}, ], ) def test_get_backup(request_type, transport: str = "grpc"): @@ -18296,7 +18363,7 @@ def test_get_backup(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_backup), "__call__") as call: @@ -18362,9 +18429,10 @@ def test_get_backup_non_empty_request_with_auto_populated_field(): client.get_backup(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == backup.GetBackupRequest( + request_msg = backup.GetBackupRequest( name="name_value", ) + assert args[0] == request_msg def test_get_backup_use_cached_wrapped_rpc(): @@ -18443,9 +18511,14 @@ async def test_get_backup_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_backup_async( - transport: str = "grpc_asyncio", request_type=backup.GetBackupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + backup.GetBackupRequest(), + {}, + ], +) +async def test_get_backup_async(request_type, transport: str = "grpc_asyncio"): client = NetAppAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -18453,7 +18526,7 @@ async def test_get_backup_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_backup), "__call__") as call: @@ -18498,11 +18571,6 @@ async def test_get_backup_async( assert response.backup_region == "backup_region_value" -@pytest.mark.asyncio -async def test_get_backup_async_from_dict(): - await test_get_backup_async(request_type=dict) - - def test_get_backup_field_headers(): client = NetAppClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18645,8 +18713,8 @@ async def test_get_backup_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - backup.ListBackupsRequest, - dict, + backup.ListBackupsRequest(), + {}, ], ) def test_list_backups(request_type, transport: str = "grpc"): @@ -18657,7 +18725,7 @@ def test_list_backups(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_backups), "__call__") as call: @@ -18706,12 +18774,13 @@ def test_list_backups_non_empty_request_with_auto_populated_field(): client.list_backups(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == backup.ListBackupsRequest( + request_msg = backup.ListBackupsRequest( parent="parent_value", page_token="page_token_value", order_by="order_by_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_backups_use_cached_wrapped_rpc(): @@ -18792,9 +18861,14 @@ async def test_list_backups_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_backups_async( - transport: str = "grpc_asyncio", request_type=backup.ListBackupsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + backup.ListBackupsRequest(), + {}, + ], +) +async def test_list_backups_async(request_type, transport: str = "grpc_asyncio"): client = NetAppAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -18802,7 +18876,7 @@ async def test_list_backups_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_backups), "__call__") as call: @@ -18827,11 +18901,6 @@ async def test_list_backups_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_backups_async_from_dict(): - await test_list_backups_async(request_type=dict) - - def test_list_backups_field_headers(): client = NetAppClient( credentials=ga_credentials.AnonymousCredentials(), @@ -19168,8 +19237,8 @@ async def test_list_backups_async_pages(): @pytest.mark.parametrize( "request_type", [ - backup.DeleteBackupRequest, - dict, + backup.DeleteBackupRequest(), + {}, ], ) def test_delete_backup(request_type, transport: str = "grpc"): @@ -19180,7 +19249,7 @@ def test_delete_backup(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_backup), "__call__") as call: @@ -19221,9 +19290,10 @@ def test_delete_backup_non_empty_request_with_auto_populated_field(): client.delete_backup(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == backup.DeleteBackupRequest( + request_msg = backup.DeleteBackupRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_backup_use_cached_wrapped_rpc(): @@ -19314,9 +19384,14 @@ async def test_delete_backup_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_backup_async( - transport: str = "grpc_asyncio", request_type=backup.DeleteBackupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + backup.DeleteBackupRequest(), + {}, + ], +) +async def test_delete_backup_async(request_type, transport: str = "grpc_asyncio"): client = NetAppAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -19324,7 +19399,7 @@ async def test_delete_backup_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_backup), "__call__") as call: @@ -19344,11 +19419,6 @@ async def test_delete_backup_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_backup_async_from_dict(): - await test_delete_backup_async(request_type=dict) - - def test_delete_backup_field_headers(): client = NetAppClient( credentials=ga_credentials.AnonymousCredentials(), @@ -19495,8 +19565,8 @@ async def test_delete_backup_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_backup.UpdateBackupRequest, - dict, + gcn_backup.UpdateBackupRequest(), + {}, ], ) def test_update_backup(request_type, transport: str = "grpc"): @@ -19507,7 +19577,7 @@ def test_update_backup(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_backup), "__call__") as call: @@ -19546,7 +19616,8 @@ def test_update_backup_non_empty_request_with_auto_populated_field(): client.update_backup(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_backup.UpdateBackupRequest() + request_msg = gcn_backup.UpdateBackupRequest() + assert args[0] == request_msg def test_update_backup_use_cached_wrapped_rpc(): @@ -19637,9 +19708,14 @@ async def test_update_backup_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_backup_async( - transport: str = "grpc_asyncio", request_type=gcn_backup.UpdateBackupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcn_backup.UpdateBackupRequest(), + {}, + ], +) +async def test_update_backup_async(request_type, transport: str = "grpc_asyncio"): client = NetAppAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -19647,7 +19723,7 @@ async def test_update_backup_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_backup), "__call__") as call: @@ -19667,11 +19743,6 @@ async def test_update_backup_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_backup_async_from_dict(): - await test_update_backup_async(request_type=dict) - - def test_update_backup_field_headers(): client = NetAppClient( credentials=ga_credentials.AnonymousCredentials(), @@ -19828,8 +19899,8 @@ async def test_update_backup_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_backup_policy.CreateBackupPolicyRequest, - dict, + gcn_backup_policy.CreateBackupPolicyRequest(), + {}, ], ) def test_create_backup_policy(request_type, transport: str = "grpc"): @@ -19840,7 +19911,7 @@ def test_create_backup_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( @@ -19886,10 +19957,11 @@ def test_create_backup_policy_non_empty_request_with_auto_populated_field(): client.create_backup_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_backup_policy.CreateBackupPolicyRequest( + request_msg = gcn_backup_policy.CreateBackupPolicyRequest( parent="parent_value", backup_policy_id="backup_policy_id_value", ) + assert args[0] == request_msg def test_create_backup_policy_use_cached_wrapped_rpc(): @@ -19984,9 +20056,15 @@ async def test_create_backup_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcn_backup_policy.CreateBackupPolicyRequest(), + {}, + ], +) async def test_create_backup_policy_async( - transport: str = "grpc_asyncio", - request_type=gcn_backup_policy.CreateBackupPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetAppAsyncClient( credentials=async_anonymous_credentials(), @@ -19995,7 +20073,7 @@ async def test_create_backup_policy_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( @@ -20017,11 +20095,6 @@ async def test_create_backup_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_backup_policy_async_from_dict(): - await test_create_backup_policy_async(request_type=dict) - - def test_create_backup_policy_field_headers(): client = NetAppClient( credentials=ga_credentials.AnonymousCredentials(), @@ -20196,8 +20269,8 @@ async def test_create_backup_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - backup_policy.GetBackupPolicyRequest, - dict, + backup_policy.GetBackupPolicyRequest(), + {}, ], ) def test_get_backup_policy(request_type, transport: str = "grpc"): @@ -20208,7 +20281,7 @@ def test_get_backup_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( @@ -20270,9 +20343,10 @@ def test_get_backup_policy_non_empty_request_with_auto_populated_field(): client.get_backup_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == backup_policy.GetBackupPolicyRequest( + request_msg = backup_policy.GetBackupPolicyRequest( name="name_value", ) + assert args[0] == request_msg def test_get_backup_policy_use_cached_wrapped_rpc(): @@ -20355,9 +20429,14 @@ async def test_get_backup_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_backup_policy_async( - transport: str = "grpc_asyncio", request_type=backup_policy.GetBackupPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + backup_policy.GetBackupPolicyRequest(), + {}, + ], +) +async def test_get_backup_policy_async(request_type, transport: str = "grpc_asyncio"): client = NetAppAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -20365,7 +20444,7 @@ async def test_get_backup_policy_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( @@ -20404,11 +20483,6 @@ async def test_get_backup_policy_async( assert response.state == backup_policy.BackupPolicy.State.CREATING -@pytest.mark.asyncio -async def test_get_backup_policy_async_from_dict(): - await test_get_backup_policy_async(request_type=dict) - - def test_get_backup_policy_field_headers(): client = NetAppClient( credentials=ga_credentials.AnonymousCredentials(), @@ -20563,8 +20637,8 @@ async def test_get_backup_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - backup_policy.ListBackupPoliciesRequest, - dict, + backup_policy.ListBackupPoliciesRequest(), + {}, ], ) def test_list_backup_policies(request_type, transport: str = "grpc"): @@ -20575,7 +20649,7 @@ def test_list_backup_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( @@ -20628,12 +20702,13 @@ def test_list_backup_policies_non_empty_request_with_auto_populated_field(): client.list_backup_policies(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == backup_policy.ListBackupPoliciesRequest( + request_msg = backup_policy.ListBackupPoliciesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_backup_policies_use_cached_wrapped_rpc(): @@ -20718,9 +20793,15 @@ async def test_list_backup_policies_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + backup_policy.ListBackupPoliciesRequest(), + {}, + ], +) async def test_list_backup_policies_async( - transport: str = "grpc_asyncio", - request_type=backup_policy.ListBackupPoliciesRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetAppAsyncClient( credentials=async_anonymous_credentials(), @@ -20729,7 +20810,7 @@ async def test_list_backup_policies_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( @@ -20756,11 +20837,6 @@ async def test_list_backup_policies_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_backup_policies_async_from_dict(): - await test_list_backup_policies_async(request_type=dict) - - def test_list_backup_policies_field_headers(): client = NetAppClient( credentials=ga_credentials.AnonymousCredentials(), @@ -21113,8 +21189,8 @@ async def test_list_backup_policies_async_pages(): @pytest.mark.parametrize( "request_type", [ - gcn_backup_policy.UpdateBackupPolicyRequest, - dict, + gcn_backup_policy.UpdateBackupPolicyRequest(), + {}, ], ) def test_update_backup_policy(request_type, transport: str = "grpc"): @@ -21125,7 +21201,7 @@ def test_update_backup_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( @@ -21168,7 +21244,8 @@ def test_update_backup_policy_non_empty_request_with_auto_populated_field(): client.update_backup_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_backup_policy.UpdateBackupPolicyRequest() + request_msg = gcn_backup_policy.UpdateBackupPolicyRequest() + assert args[0] == request_msg def test_update_backup_policy_use_cached_wrapped_rpc(): @@ -21263,9 +21340,15 @@ async def test_update_backup_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcn_backup_policy.UpdateBackupPolicyRequest(), + {}, + ], +) async def test_update_backup_policy_async( - transport: str = "grpc_asyncio", - request_type=gcn_backup_policy.UpdateBackupPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetAppAsyncClient( credentials=async_anonymous_credentials(), @@ -21274,7 +21357,7 @@ async def test_update_backup_policy_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( @@ -21296,11 +21379,6 @@ async def test_update_backup_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_backup_policy_async_from_dict(): - await test_update_backup_policy_async(request_type=dict) - - def test_update_backup_policy_field_headers(): client = NetAppClient( credentials=ga_credentials.AnonymousCredentials(), @@ -21465,8 +21543,8 @@ async def test_update_backup_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - backup_policy.DeleteBackupPolicyRequest, - dict, + backup_policy.DeleteBackupPolicyRequest(), + {}, ], ) def test_delete_backup_policy(request_type, transport: str = "grpc"): @@ -21477,7 +21555,7 @@ def test_delete_backup_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( @@ -21522,9 +21600,10 @@ def test_delete_backup_policy_non_empty_request_with_auto_populated_field(): client.delete_backup_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == backup_policy.DeleteBackupPolicyRequest( + request_msg = backup_policy.DeleteBackupPolicyRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_backup_policy_use_cached_wrapped_rpc(): @@ -21619,9 +21698,15 @@ async def test_delete_backup_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + backup_policy.DeleteBackupPolicyRequest(), + {}, + ], +) async def test_delete_backup_policy_async( - transport: str = "grpc_asyncio", - request_type=backup_policy.DeleteBackupPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetAppAsyncClient( credentials=async_anonymous_credentials(), @@ -21630,7 +21715,7 @@ async def test_delete_backup_policy_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( @@ -21652,11 +21737,6 @@ async def test_delete_backup_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_backup_policy_async_from_dict(): - await test_delete_backup_policy_async(request_type=dict) - - def test_delete_backup_policy_field_headers(): client = NetAppClient( credentials=ga_credentials.AnonymousCredentials(), @@ -21811,8 +21891,8 @@ async def test_delete_backup_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - quota_rule.ListQuotaRulesRequest, - dict, + quota_rule.ListQuotaRulesRequest(), + {}, ], ) def test_list_quota_rules(request_type, transport: str = "grpc"): @@ -21823,7 +21903,7 @@ def test_list_quota_rules(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_quota_rules), "__call__") as call: @@ -21872,12 +21952,13 @@ def test_list_quota_rules_non_empty_request_with_auto_populated_field(): client.list_quota_rules(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == quota_rule.ListQuotaRulesRequest( + request_msg = quota_rule.ListQuotaRulesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_quota_rules_use_cached_wrapped_rpc(): @@ -21960,9 +22041,14 @@ async def test_list_quota_rules_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_quota_rules_async( - transport: str = "grpc_asyncio", request_type=quota_rule.ListQuotaRulesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + quota_rule.ListQuotaRulesRequest(), + {}, + ], +) +async def test_list_quota_rules_async(request_type, transport: str = "grpc_asyncio"): client = NetAppAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -21970,7 +22056,7 @@ async def test_list_quota_rules_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_quota_rules), "__call__") as call: @@ -21995,11 +22081,6 @@ async def test_list_quota_rules_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_quota_rules_async_from_dict(): - await test_list_quota_rules_async(request_type=dict) - - def test_list_quota_rules_field_headers(): client = NetAppClient( credentials=ga_credentials.AnonymousCredentials(), @@ -22336,8 +22417,8 @@ async def test_list_quota_rules_async_pages(): @pytest.mark.parametrize( "request_type", [ - quota_rule.GetQuotaRuleRequest, - dict, + quota_rule.GetQuotaRuleRequest(), + {}, ], ) def test_get_quota_rule(request_type, transport: str = "grpc"): @@ -22348,7 +22429,7 @@ def test_get_quota_rule(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_quota_rule), "__call__") as call: @@ -22404,9 +22485,10 @@ def test_get_quota_rule_non_empty_request_with_auto_populated_field(): client.get_quota_rule(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == quota_rule.GetQuotaRuleRequest( + request_msg = quota_rule.GetQuotaRuleRequest( name="name_value", ) + assert args[0] == request_msg def test_get_quota_rule_use_cached_wrapped_rpc(): @@ -22487,9 +22569,14 @@ async def test_get_quota_rule_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_quota_rule_async( - transport: str = "grpc_asyncio", request_type=quota_rule.GetQuotaRuleRequest -): +@pytest.mark.parametrize( + "request_type", + [ + quota_rule.GetQuotaRuleRequest(), + {}, + ], +) +async def test_get_quota_rule_async(request_type, transport: str = "grpc_asyncio"): client = NetAppAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -22497,7 +22584,7 @@ async def test_get_quota_rule_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_quota_rule), "__call__") as call: @@ -22532,11 +22619,6 @@ async def test_get_quota_rule_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_get_quota_rule_async_from_dict(): - await test_get_quota_rule_async(request_type=dict) - - def test_get_quota_rule_field_headers(): client = NetAppClient( credentials=ga_credentials.AnonymousCredentials(), @@ -22683,8 +22765,8 @@ async def test_get_quota_rule_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_quota_rule.CreateQuotaRuleRequest, - dict, + gcn_quota_rule.CreateQuotaRuleRequest(), + {}, ], ) def test_create_quota_rule(request_type, transport: str = "grpc"): @@ -22695,7 +22777,7 @@ def test_create_quota_rule(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -22741,10 +22823,11 @@ def test_create_quota_rule_non_empty_request_with_auto_populated_field(): client.create_quota_rule(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_quota_rule.CreateQuotaRuleRequest( + request_msg = gcn_quota_rule.CreateQuotaRuleRequest( parent="parent_value", quota_rule_id="quota_rule_id_value", ) + assert args[0] == request_msg def test_create_quota_rule_use_cached_wrapped_rpc(): @@ -22837,9 +22920,14 @@ async def test_create_quota_rule_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_quota_rule_async( - transport: str = "grpc_asyncio", request_type=gcn_quota_rule.CreateQuotaRuleRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcn_quota_rule.CreateQuotaRuleRequest(), + {}, + ], +) +async def test_create_quota_rule_async(request_type, transport: str = "grpc_asyncio"): client = NetAppAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -22847,7 +22935,7 @@ async def test_create_quota_rule_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( @@ -22869,11 +22957,6 @@ async def test_create_quota_rule_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_quota_rule_async_from_dict(): - await test_create_quota_rule_async(request_type=dict) - - def test_create_quota_rule_field_headers(): client = NetAppClient( credentials=ga_credentials.AnonymousCredentials(), @@ -23048,8 +23131,8 @@ async def test_create_quota_rule_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_quota_rule.UpdateQuotaRuleRequest, - dict, + gcn_quota_rule.UpdateQuotaRuleRequest(), + {}, ], ) def test_update_quota_rule(request_type, transport: str = "grpc"): @@ -23060,7 +23143,7 @@ def test_update_quota_rule(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -23103,7 +23186,8 @@ def test_update_quota_rule_non_empty_request_with_auto_populated_field(): client.update_quota_rule(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_quota_rule.UpdateQuotaRuleRequest() + request_msg = gcn_quota_rule.UpdateQuotaRuleRequest() + assert args[0] == request_msg def test_update_quota_rule_use_cached_wrapped_rpc(): @@ -23196,9 +23280,14 @@ async def test_update_quota_rule_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_quota_rule_async( - transport: str = "grpc_asyncio", request_type=gcn_quota_rule.UpdateQuotaRuleRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcn_quota_rule.UpdateQuotaRuleRequest(), + {}, + ], +) +async def test_update_quota_rule_async(request_type, transport: str = "grpc_asyncio"): client = NetAppAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -23206,7 +23295,7 @@ async def test_update_quota_rule_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( @@ -23228,11 +23317,6 @@ async def test_update_quota_rule_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_quota_rule_async_from_dict(): - await test_update_quota_rule_async(request_type=dict) - - def test_update_quota_rule_field_headers(): client = NetAppClient( credentials=ga_credentials.AnonymousCredentials(), @@ -23397,8 +23481,8 @@ async def test_update_quota_rule_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - quota_rule.DeleteQuotaRuleRequest, - dict, + quota_rule.DeleteQuotaRuleRequest(), + {}, ], ) def test_delete_quota_rule(request_type, transport: str = "grpc"): @@ -23409,7 +23493,7 @@ def test_delete_quota_rule(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -23454,9 +23538,10 @@ def test_delete_quota_rule_non_empty_request_with_auto_populated_field(): client.delete_quota_rule(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == quota_rule.DeleteQuotaRuleRequest( + request_msg = quota_rule.DeleteQuotaRuleRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_quota_rule_use_cached_wrapped_rpc(): @@ -23549,9 +23634,14 @@ async def test_delete_quota_rule_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_quota_rule_async( - transport: str = "grpc_asyncio", request_type=quota_rule.DeleteQuotaRuleRequest -): +@pytest.mark.parametrize( + "request_type", + [ + quota_rule.DeleteQuotaRuleRequest(), + {}, + ], +) +async def test_delete_quota_rule_async(request_type, transport: str = "grpc_asyncio"): client = NetAppAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -23559,7 +23649,7 @@ async def test_delete_quota_rule_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( @@ -23581,11 +23671,6 @@ async def test_delete_quota_rule_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_quota_rule_async_from_dict(): - await test_delete_quota_rule_async(request_type=dict) - - def test_delete_quota_rule_field_headers(): client = NetAppClient( credentials=ga_credentials.AnonymousCredentials(), @@ -23740,8 +23825,8 @@ async def test_delete_quota_rule_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - volume.RestoreBackupFilesRequest, - dict, + volume.RestoreBackupFilesRequest(), + {}, ], ) def test_restore_backup_files(request_type, transport: str = "grpc"): @@ -23752,7 +23837,7 @@ def test_restore_backup_files(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -23799,11 +23884,12 @@ def test_restore_backup_files_non_empty_request_with_auto_populated_field(): client.restore_backup_files(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == volume.RestoreBackupFilesRequest( + request_msg = volume.RestoreBackupFilesRequest( name="name_value", backup="backup_value", restore_destination_path="restore_destination_path_value", ) + assert args[0] == request_msg def test_restore_backup_files_use_cached_wrapped_rpc(): @@ -23898,8 +23984,15 @@ async def test_restore_backup_files_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + volume.RestoreBackupFilesRequest(), + {}, + ], +) async def test_restore_backup_files_async( - transport: str = "grpc_asyncio", request_type=volume.RestoreBackupFilesRequest + request_type, transport: str = "grpc_asyncio" ): client = NetAppAsyncClient( credentials=async_anonymous_credentials(), @@ -23908,7 +24001,7 @@ async def test_restore_backup_files_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( @@ -23930,11 +24023,6 @@ async def test_restore_backup_files_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_restore_backup_files_async_from_dict(): - await test_restore_backup_files_async(request_type=dict) - - def test_restore_backup_files_field_headers(): client = NetAppClient( credentials=ga_credentials.AnonymousCredentials(), @@ -24003,8 +24091,8 @@ async def test_restore_backup_files_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - host_group.ListHostGroupsRequest, - dict, + host_group.ListHostGroupsRequest(), + {}, ], ) def test_list_host_groups(request_type, transport: str = "grpc"): @@ -24015,7 +24103,7 @@ def test_list_host_groups(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_host_groups), "__call__") as call: @@ -24064,12 +24152,13 @@ def test_list_host_groups_non_empty_request_with_auto_populated_field(): client.list_host_groups(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == host_group.ListHostGroupsRequest( + request_msg = host_group.ListHostGroupsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_host_groups_use_cached_wrapped_rpc(): @@ -24152,9 +24241,14 @@ async def test_list_host_groups_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_host_groups_async( - transport: str = "grpc_asyncio", request_type=host_group.ListHostGroupsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + host_group.ListHostGroupsRequest(), + {}, + ], +) +async def test_list_host_groups_async(request_type, transport: str = "grpc_asyncio"): client = NetAppAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -24162,7 +24256,7 @@ async def test_list_host_groups_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_host_groups), "__call__") as call: @@ -24187,11 +24281,6 @@ async def test_list_host_groups_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_host_groups_async_from_dict(): - await test_list_host_groups_async(request_type=dict) - - def test_list_host_groups_field_headers(): client = NetAppClient( credentials=ga_credentials.AnonymousCredentials(), @@ -24528,8 +24617,8 @@ async def test_list_host_groups_async_pages(): @pytest.mark.parametrize( "request_type", [ - host_group.GetHostGroupRequest, - dict, + host_group.GetHostGroupRequest(), + {}, ], ) def test_get_host_group(request_type, transport: str = "grpc"): @@ -24540,7 +24629,7 @@ def test_get_host_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_host_group), "__call__") as call: @@ -24594,9 +24683,10 @@ def test_get_host_group_non_empty_request_with_auto_populated_field(): client.get_host_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == host_group.GetHostGroupRequest( + request_msg = host_group.GetHostGroupRequest( name="name_value", ) + assert args[0] == request_msg def test_get_host_group_use_cached_wrapped_rpc(): @@ -24677,9 +24767,14 @@ async def test_get_host_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_host_group_async( - transport: str = "grpc_asyncio", request_type=host_group.GetHostGroupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + host_group.GetHostGroupRequest(), + {}, + ], +) +async def test_get_host_group_async(request_type, transport: str = "grpc_asyncio"): client = NetAppAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -24687,7 +24782,7 @@ async def test_get_host_group_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_host_group), "__call__") as call: @@ -24720,11 +24815,6 @@ async def test_get_host_group_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_get_host_group_async_from_dict(): - await test_get_host_group_async(request_type=dict) - - def test_get_host_group_field_headers(): client = NetAppClient( credentials=ga_credentials.AnonymousCredentials(), @@ -24871,8 +24961,8 @@ async def test_get_host_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_host_group.CreateHostGroupRequest, - dict, + gcn_host_group.CreateHostGroupRequest(), + {}, ], ) def test_create_host_group(request_type, transport: str = "grpc"): @@ -24883,7 +24973,7 @@ def test_create_host_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -24929,10 +25019,11 @@ def test_create_host_group_non_empty_request_with_auto_populated_field(): client.create_host_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_host_group.CreateHostGroupRequest( + request_msg = gcn_host_group.CreateHostGroupRequest( parent="parent_value", host_group_id="host_group_id_value", ) + assert args[0] == request_msg def test_create_host_group_use_cached_wrapped_rpc(): @@ -25025,9 +25116,14 @@ async def test_create_host_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_host_group_async( - transport: str = "grpc_asyncio", request_type=gcn_host_group.CreateHostGroupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcn_host_group.CreateHostGroupRequest(), + {}, + ], +) +async def test_create_host_group_async(request_type, transport: str = "grpc_asyncio"): client = NetAppAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -25035,7 +25131,7 @@ async def test_create_host_group_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( @@ -25057,11 +25153,6 @@ async def test_create_host_group_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_host_group_async_from_dict(): - await test_create_host_group_async(request_type=dict) - - def test_create_host_group_field_headers(): client = NetAppClient( credentials=ga_credentials.AnonymousCredentials(), @@ -25236,8 +25327,8 @@ async def test_create_host_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_host_group.UpdateHostGroupRequest, - dict, + gcn_host_group.UpdateHostGroupRequest(), + {}, ], ) def test_update_host_group(request_type, transport: str = "grpc"): @@ -25248,7 +25339,7 @@ def test_update_host_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -25291,7 +25382,8 @@ def test_update_host_group_non_empty_request_with_auto_populated_field(): client.update_host_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_host_group.UpdateHostGroupRequest() + request_msg = gcn_host_group.UpdateHostGroupRequest() + assert args[0] == request_msg def test_update_host_group_use_cached_wrapped_rpc(): @@ -25384,9 +25476,14 @@ async def test_update_host_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_host_group_async( - transport: str = "grpc_asyncio", request_type=gcn_host_group.UpdateHostGroupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcn_host_group.UpdateHostGroupRequest(), + {}, + ], +) +async def test_update_host_group_async(request_type, transport: str = "grpc_asyncio"): client = NetAppAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -25394,7 +25491,7 @@ async def test_update_host_group_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( @@ -25416,11 +25513,6 @@ async def test_update_host_group_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_host_group_async_from_dict(): - await test_update_host_group_async(request_type=dict) - - def test_update_host_group_field_headers(): client = NetAppClient( credentials=ga_credentials.AnonymousCredentials(), @@ -25585,8 +25677,8 @@ async def test_update_host_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - host_group.DeleteHostGroupRequest, - dict, + host_group.DeleteHostGroupRequest(), + {}, ], ) def test_delete_host_group(request_type, transport: str = "grpc"): @@ -25597,7 +25689,7 @@ def test_delete_host_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -25642,9 +25734,10 @@ def test_delete_host_group_non_empty_request_with_auto_populated_field(): client.delete_host_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == host_group.DeleteHostGroupRequest( + request_msg = host_group.DeleteHostGroupRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_host_group_use_cached_wrapped_rpc(): @@ -25737,9 +25830,14 @@ async def test_delete_host_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_host_group_async( - transport: str = "grpc_asyncio", request_type=host_group.DeleteHostGroupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + host_group.DeleteHostGroupRequest(), + {}, + ], +) +async def test_delete_host_group_async(request_type, transport: str = "grpc_asyncio"): client = NetAppAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -25747,7 +25845,7 @@ async def test_delete_host_group_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( @@ -25769,11 +25867,6 @@ async def test_delete_host_group_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_host_group_async_from_dict(): - await test_delete_host_group_async(request_type=dict) - - def test_delete_host_group_field_headers(): client = NetAppClient( credentials=ga_credentials.AnonymousCredentials(), @@ -25928,8 +26021,8 @@ async def test_delete_host_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - ontap.ExecuteOntapPostRequest, - dict, + ontap.ExecuteOntapPostRequest(), + {}, ], ) def test_execute_ontap_post(request_type, transport: str = "grpc"): @@ -25940,7 +26033,7 @@ def test_execute_ontap_post(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -25985,9 +26078,10 @@ def test_execute_ontap_post_non_empty_request_with_auto_populated_field(): client.execute_ontap_post(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == ontap.ExecuteOntapPostRequest( + request_msg = ontap.ExecuteOntapPostRequest( ontap_path="ontap_path_value", ) + assert args[0] == request_msg def test_execute_ontap_post_use_cached_wrapped_rpc(): @@ -26072,9 +26166,14 @@ async def test_execute_ontap_post_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_execute_ontap_post_async( - transport: str = "grpc_asyncio", request_type=ontap.ExecuteOntapPostRequest -): +@pytest.mark.parametrize( + "request_type", + [ + ontap.ExecuteOntapPostRequest(), + {}, + ], +) +async def test_execute_ontap_post_async(request_type, transport: str = "grpc_asyncio"): client = NetAppAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -26082,7 +26181,7 @@ async def test_execute_ontap_post_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( @@ -26104,11 +26203,6 @@ async def test_execute_ontap_post_async( assert isinstance(response, ontap.ExecuteOntapPostResponse) -@pytest.mark.asyncio -async def test_execute_ontap_post_async_from_dict(): - await test_execute_ontap_post_async(request_type=dict) - - def test_execute_ontap_post_field_headers(): client = NetAppClient( credentials=ga_credentials.AnonymousCredentials(), @@ -26177,8 +26271,8 @@ async def test_execute_ontap_post_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - ontap.ExecuteOntapGetRequest, - dict, + ontap.ExecuteOntapGetRequest(), + {}, ], ) def test_execute_ontap_get(request_type, transport: str = "grpc"): @@ -26189,7 +26283,7 @@ def test_execute_ontap_get(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -26234,9 +26328,10 @@ def test_execute_ontap_get_non_empty_request_with_auto_populated_field(): client.execute_ontap_get(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == ontap.ExecuteOntapGetRequest( + request_msg = ontap.ExecuteOntapGetRequest( ontap_path="ontap_path_value", ) + assert args[0] == request_msg def test_execute_ontap_get_use_cached_wrapped_rpc(): @@ -26319,9 +26414,14 @@ async def test_execute_ontap_get_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_execute_ontap_get_async( - transport: str = "grpc_asyncio", request_type=ontap.ExecuteOntapGetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + ontap.ExecuteOntapGetRequest(), + {}, + ], +) +async def test_execute_ontap_get_async(request_type, transport: str = "grpc_asyncio"): client = NetAppAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -26329,7 +26429,7 @@ async def test_execute_ontap_get_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( @@ -26351,11 +26451,6 @@ async def test_execute_ontap_get_async( assert isinstance(response, ontap.ExecuteOntapGetResponse) -@pytest.mark.asyncio -async def test_execute_ontap_get_async_from_dict(): - await test_execute_ontap_get_async(request_type=dict) - - def test_execute_ontap_get_field_headers(): client = NetAppClient( credentials=ga_credentials.AnonymousCredentials(), @@ -26424,8 +26519,8 @@ async def test_execute_ontap_get_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - ontap.ExecuteOntapDeleteRequest, - dict, + ontap.ExecuteOntapDeleteRequest(), + {}, ], ) def test_execute_ontap_delete(request_type, transport: str = "grpc"): @@ -26436,7 +26531,7 @@ def test_execute_ontap_delete(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -26481,9 +26576,10 @@ def test_execute_ontap_delete_non_empty_request_with_auto_populated_field(): client.execute_ontap_delete(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == ontap.ExecuteOntapDeleteRequest( + request_msg = ontap.ExecuteOntapDeleteRequest( ontap_path="ontap_path_value", ) + assert args[0] == request_msg def test_execute_ontap_delete_use_cached_wrapped_rpc(): @@ -26568,8 +26664,15 @@ async def test_execute_ontap_delete_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + ontap.ExecuteOntapDeleteRequest(), + {}, + ], +) async def test_execute_ontap_delete_async( - transport: str = "grpc_asyncio", request_type=ontap.ExecuteOntapDeleteRequest + request_type, transport: str = "grpc_asyncio" ): client = NetAppAsyncClient( credentials=async_anonymous_credentials(), @@ -26578,7 +26681,7 @@ async def test_execute_ontap_delete_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( @@ -26600,11 +26703,6 @@ async def test_execute_ontap_delete_async( assert isinstance(response, ontap.ExecuteOntapDeleteResponse) -@pytest.mark.asyncio -async def test_execute_ontap_delete_async_from_dict(): - await test_execute_ontap_delete_async(request_type=dict) - - def test_execute_ontap_delete_field_headers(): client = NetAppClient( credentials=ga_credentials.AnonymousCredentials(), @@ -26673,8 +26771,8 @@ async def test_execute_ontap_delete_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - ontap.ExecuteOntapPatchRequest, - dict, + ontap.ExecuteOntapPatchRequest(), + {}, ], ) def test_execute_ontap_patch(request_type, transport: str = "grpc"): @@ -26685,7 +26783,7 @@ def test_execute_ontap_patch(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -26730,9 +26828,10 @@ def test_execute_ontap_patch_non_empty_request_with_auto_populated_field(): client.execute_ontap_patch(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == ontap.ExecuteOntapPatchRequest( + request_msg = ontap.ExecuteOntapPatchRequest( ontap_path="ontap_path_value", ) + assert args[0] == request_msg def test_execute_ontap_patch_use_cached_wrapped_rpc(): @@ -26817,9 +26916,14 @@ async def test_execute_ontap_patch_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_execute_ontap_patch_async( - transport: str = "grpc_asyncio", request_type=ontap.ExecuteOntapPatchRequest -): +@pytest.mark.parametrize( + "request_type", + [ + ontap.ExecuteOntapPatchRequest(), + {}, + ], +) +async def test_execute_ontap_patch_async(request_type, transport: str = "grpc_asyncio"): client = NetAppAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -26827,7 +26931,7 @@ async def test_execute_ontap_patch_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( @@ -26849,11 +26953,6 @@ async def test_execute_ontap_patch_async( assert isinstance(response, ontap.ExecuteOntapPatchResponse) -@pytest.mark.asyncio -async def test_execute_ontap_patch_async_from_dict(): - await test_execute_ontap_patch_async(request_type=dict) - - def test_execute_ontap_patch_field_headers(): client = NetAppClient( credentials=ga_credentials.AnonymousCredentials(), @@ -40360,7 +40459,6 @@ def test_list_storage_pools_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage_pool.ListStoragePoolsRequest() - assert args[0] == request_msg @@ -40383,7 +40481,6 @@ def test_create_storage_pool_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_storage_pool.CreateStoragePoolRequest() - assert args[0] == request_msg @@ -40404,7 +40501,6 @@ def test_get_storage_pool_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage_pool.GetStoragePoolRequest() - assert args[0] == request_msg @@ -40427,7 +40523,6 @@ def test_update_storage_pool_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_storage_pool.UpdateStoragePoolRequest() - assert args[0] == request_msg @@ -40450,7 +40545,6 @@ def test_delete_storage_pool_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage_pool.DeleteStoragePoolRequest() - assert args[0] == request_msg @@ -40473,7 +40567,6 @@ def test_validate_directory_service_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage_pool.ValidateDirectoryServiceRequest() - assert args[0] == request_msg @@ -40496,7 +40589,6 @@ def test_switch_active_replica_zone_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage_pool.SwitchActiveReplicaZoneRequest() - assert args[0] == request_msg @@ -40517,7 +40609,6 @@ def test_list_volumes_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = volume.ListVolumesRequest() - assert args[0] == request_msg @@ -40538,7 +40629,6 @@ def test_get_volume_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = volume.GetVolumeRequest() - assert args[0] == request_msg @@ -40559,7 +40649,6 @@ def test_create_volume_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_volume.CreateVolumeRequest() - assert args[0] == request_msg @@ -40580,7 +40669,6 @@ def test_update_volume_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_volume.UpdateVolumeRequest() - assert args[0] == request_msg @@ -40601,7 +40689,6 @@ def test_delete_volume_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = volume.DeleteVolumeRequest() - assert args[0] == request_msg @@ -40622,7 +40709,6 @@ def test_revert_volume_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = volume.RevertVolumeRequest() - assert args[0] == request_msg @@ -40645,7 +40731,6 @@ def test_establish_volume_peering_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = volume.EstablishVolumePeeringRequest() - assert args[0] == request_msg @@ -40666,7 +40751,6 @@ def test_list_snapshots_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = snapshot.ListSnapshotsRequest() - assert args[0] == request_msg @@ -40687,7 +40771,6 @@ def test_get_snapshot_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = snapshot.GetSnapshotRequest() - assert args[0] == request_msg @@ -40708,7 +40791,6 @@ def test_create_snapshot_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_snapshot.CreateSnapshotRequest() - assert args[0] == request_msg @@ -40729,7 +40811,6 @@ def test_delete_snapshot_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = snapshot.DeleteSnapshotRequest() - assert args[0] == request_msg @@ -40750,7 +40831,6 @@ def test_update_snapshot_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_snapshot.UpdateSnapshotRequest() - assert args[0] == request_msg @@ -40773,7 +40853,6 @@ def test_list_active_directories_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = active_directory.ListActiveDirectoriesRequest() - assert args[0] == request_msg @@ -40796,7 +40875,6 @@ def test_get_active_directory_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = active_directory.GetActiveDirectoryRequest() - assert args[0] == request_msg @@ -40819,7 +40897,6 @@ def test_create_active_directory_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_active_directory.CreateActiveDirectoryRequest() - assert args[0] == request_msg @@ -40842,7 +40919,6 @@ def test_update_active_directory_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_active_directory.UpdateActiveDirectoryRequest() - assert args[0] == request_msg @@ -40865,7 +40941,6 @@ def test_delete_active_directory_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = active_directory.DeleteActiveDirectoryRequest() - assert args[0] == request_msg @@ -40886,7 +40961,6 @@ def test_list_kms_configs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = kms.ListKmsConfigsRequest() - assert args[0] == request_msg @@ -40909,7 +40983,6 @@ def test_create_kms_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = kms.CreateKmsConfigRequest() - assert args[0] == request_msg @@ -40930,7 +41003,6 @@ def test_get_kms_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = kms.GetKmsConfigRequest() - assert args[0] == request_msg @@ -40953,7 +41025,6 @@ def test_update_kms_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = kms.UpdateKmsConfigRequest() - assert args[0] == request_msg @@ -40974,7 +41045,6 @@ def test_encrypt_volumes_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = kms.EncryptVolumesRequest() - assert args[0] == request_msg @@ -40997,7 +41067,6 @@ def test_verify_kms_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = kms.VerifyKmsConfigRequest() - assert args[0] == request_msg @@ -41020,7 +41089,6 @@ def test_delete_kms_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = kms.DeleteKmsConfigRequest() - assert args[0] == request_msg @@ -41043,7 +41111,6 @@ def test_list_replications_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = replication.ListReplicationsRequest() - assert args[0] == request_msg @@ -41064,7 +41131,6 @@ def test_get_replication_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = replication.GetReplicationRequest() - assert args[0] == request_msg @@ -41087,7 +41153,6 @@ def test_create_replication_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_replication.CreateReplicationRequest() - assert args[0] == request_msg @@ -41110,7 +41175,6 @@ def test_delete_replication_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = replication.DeleteReplicationRequest() - assert args[0] == request_msg @@ -41133,7 +41197,6 @@ def test_update_replication_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_replication.UpdateReplicationRequest() - assert args[0] == request_msg @@ -41154,7 +41217,6 @@ def test_stop_replication_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = replication.StopReplicationRequest() - assert args[0] == request_msg @@ -41177,7 +41239,6 @@ def test_resume_replication_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = replication.ResumeReplicationRequest() - assert args[0] == request_msg @@ -41200,7 +41261,6 @@ def test_reverse_replication_direction_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = replication.ReverseReplicationDirectionRequest() - assert args[0] == request_msg @@ -41223,7 +41283,6 @@ def test_establish_peering_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = replication.EstablishPeeringRequest() - assert args[0] == request_msg @@ -41244,7 +41303,6 @@ def test_sync_replication_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = replication.SyncReplicationRequest() - assert args[0] == request_msg @@ -41267,7 +41325,6 @@ def test_create_backup_vault_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_backup_vault.CreateBackupVaultRequest() - assert args[0] == request_msg @@ -41288,7 +41345,6 @@ def test_get_backup_vault_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backup_vault.GetBackupVaultRequest() - assert args[0] == request_msg @@ -41311,7 +41367,6 @@ def test_list_backup_vaults_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backup_vault.ListBackupVaultsRequest() - assert args[0] == request_msg @@ -41334,7 +41389,6 @@ def test_update_backup_vault_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_backup_vault.UpdateBackupVaultRequest() - assert args[0] == request_msg @@ -41357,7 +41411,6 @@ def test_delete_backup_vault_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backup_vault.DeleteBackupVaultRequest() - assert args[0] == request_msg @@ -41378,7 +41431,6 @@ def test_create_backup_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_backup.CreateBackupRequest() - assert args[0] == request_msg @@ -41399,7 +41451,6 @@ def test_get_backup_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backup.GetBackupRequest() - assert args[0] == request_msg @@ -41420,7 +41471,6 @@ def test_list_backups_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backup.ListBackupsRequest() - assert args[0] == request_msg @@ -41441,7 +41491,6 @@ def test_delete_backup_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backup.DeleteBackupRequest() - assert args[0] == request_msg @@ -41462,7 +41511,6 @@ def test_update_backup_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_backup.UpdateBackupRequest() - assert args[0] == request_msg @@ -41485,7 +41533,6 @@ def test_create_backup_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_backup_policy.CreateBackupPolicyRequest() - assert args[0] == request_msg @@ -41508,7 +41555,6 @@ def test_get_backup_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backup_policy.GetBackupPolicyRequest() - assert args[0] == request_msg @@ -41531,7 +41577,6 @@ def test_list_backup_policies_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backup_policy.ListBackupPoliciesRequest() - assert args[0] == request_msg @@ -41554,7 +41599,6 @@ def test_update_backup_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_backup_policy.UpdateBackupPolicyRequest() - assert args[0] == request_msg @@ -41577,7 +41621,6 @@ def test_delete_backup_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backup_policy.DeleteBackupPolicyRequest() - assert args[0] == request_msg @@ -41598,7 +41641,6 @@ def test_list_quota_rules_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = quota_rule.ListQuotaRulesRequest() - assert args[0] == request_msg @@ -41619,7 +41661,6 @@ def test_get_quota_rule_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = quota_rule.GetQuotaRuleRequest() - assert args[0] == request_msg @@ -41642,7 +41683,6 @@ def test_create_quota_rule_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_quota_rule.CreateQuotaRuleRequest() - assert args[0] == request_msg @@ -41665,7 +41705,6 @@ def test_update_quota_rule_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_quota_rule.UpdateQuotaRuleRequest() - assert args[0] == request_msg @@ -41688,7 +41727,6 @@ def test_delete_quota_rule_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = quota_rule.DeleteQuotaRuleRequest() - assert args[0] == request_msg @@ -41711,7 +41749,6 @@ def test_restore_backup_files_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = volume.RestoreBackupFilesRequest() - assert args[0] == request_msg @@ -41732,7 +41769,6 @@ def test_list_host_groups_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = host_group.ListHostGroupsRequest() - assert args[0] == request_msg @@ -41753,7 +41789,6 @@ def test_get_host_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = host_group.GetHostGroupRequest() - assert args[0] == request_msg @@ -41776,7 +41811,6 @@ def test_create_host_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_host_group.CreateHostGroupRequest() - assert args[0] == request_msg @@ -41799,7 +41833,6 @@ def test_update_host_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_host_group.UpdateHostGroupRequest() - assert args[0] == request_msg @@ -41822,7 +41855,6 @@ def test_delete_host_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = host_group.DeleteHostGroupRequest() - assert args[0] == request_msg @@ -41845,7 +41877,6 @@ def test_execute_ontap_post_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ontap.ExecuteOntapPostRequest() - assert args[0] == request_msg @@ -41868,7 +41899,6 @@ def test_execute_ontap_get_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ontap.ExecuteOntapGetRequest() - assert args[0] == request_msg @@ -41891,7 +41921,6 @@ def test_execute_ontap_delete_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ontap.ExecuteOntapDeleteRequest() - assert args[0] == request_msg @@ -41914,7 +41943,6 @@ def test_execute_ontap_patch_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ontap.ExecuteOntapPatchRequest() - assert args[0] == request_msg @@ -41958,7 +41986,6 @@ async def test_list_storage_pools_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage_pool.ListStoragePoolsRequest() - assert args[0] == request_msg @@ -41985,7 +42012,6 @@ async def test_create_storage_pool_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_storage_pool.CreateStoragePoolRequest() - assert args[0] == request_msg @@ -42043,7 +42069,6 @@ async def test_get_storage_pool_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage_pool.GetStoragePoolRequest() - assert args[0] == request_msg @@ -42070,7 +42095,6 @@ async def test_update_storage_pool_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_storage_pool.UpdateStoragePoolRequest() - assert args[0] == request_msg @@ -42097,7 +42121,6 @@ async def test_delete_storage_pool_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage_pool.DeleteStoragePoolRequest() - assert args[0] == request_msg @@ -42124,7 +42147,6 @@ async def test_validate_directory_service_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage_pool.ValidateDirectoryServiceRequest() - assert args[0] == request_msg @@ -42151,7 +42173,6 @@ async def test_switch_active_replica_zone_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage_pool.SwitchActiveReplicaZoneRequest() - assert args[0] == request_msg @@ -42179,7 +42200,6 @@ async def test_list_volumes_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = volume.ListVolumesRequest() - assert args[0] == request_msg @@ -42236,7 +42256,6 @@ async def test_get_volume_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = volume.GetVolumeRequest() - assert args[0] == request_msg @@ -42261,7 +42280,6 @@ async def test_create_volume_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_volume.CreateVolumeRequest() - assert args[0] == request_msg @@ -42286,7 +42304,6 @@ async def test_update_volume_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_volume.UpdateVolumeRequest() - assert args[0] == request_msg @@ -42311,7 +42328,6 @@ async def test_delete_volume_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = volume.DeleteVolumeRequest() - assert args[0] == request_msg @@ -42336,7 +42352,6 @@ async def test_revert_volume_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = volume.RevertVolumeRequest() - assert args[0] == request_msg @@ -42363,7 +42378,6 @@ async def test_establish_volume_peering_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = volume.EstablishVolumePeeringRequest() - assert args[0] == request_msg @@ -42391,7 +42405,6 @@ async def test_list_snapshots_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = snapshot.ListSnapshotsRequest() - assert args[0] == request_msg @@ -42422,7 +42435,6 @@ async def test_get_snapshot_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = snapshot.GetSnapshotRequest() - assert args[0] == request_msg @@ -42447,7 +42459,6 @@ async def test_create_snapshot_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_snapshot.CreateSnapshotRequest() - assert args[0] == request_msg @@ -42472,7 +42483,6 @@ async def test_delete_snapshot_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = snapshot.DeleteSnapshotRequest() - assert args[0] == request_msg @@ -42497,7 +42507,6 @@ async def test_update_snapshot_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_snapshot.UpdateSnapshotRequest() - assert args[0] == request_msg @@ -42527,7 +42536,6 @@ async def test_list_active_directories_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = active_directory.ListActiveDirectoriesRequest() - assert args[0] == request_msg @@ -42575,7 +42583,6 @@ async def test_get_active_directory_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = active_directory.GetActiveDirectoryRequest() - assert args[0] == request_msg @@ -42602,7 +42609,6 @@ async def test_create_active_directory_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_active_directory.CreateActiveDirectoryRequest() - assert args[0] == request_msg @@ -42629,7 +42635,6 @@ async def test_update_active_directory_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_active_directory.UpdateActiveDirectoryRequest() - assert args[0] == request_msg @@ -42656,7 +42661,6 @@ async def test_delete_active_directory_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = active_directory.DeleteActiveDirectoryRequest() - assert args[0] == request_msg @@ -42684,7 +42688,6 @@ async def test_list_kms_configs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = kms.ListKmsConfigsRequest() - assert args[0] == request_msg @@ -42711,7 +42714,6 @@ async def test_create_kms_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = kms.CreateKmsConfigRequest() - assert args[0] == request_msg @@ -42744,7 +42746,6 @@ async def test_get_kms_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = kms.GetKmsConfigRequest() - assert args[0] == request_msg @@ -42771,7 +42772,6 @@ async def test_update_kms_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = kms.UpdateKmsConfigRequest() - assert args[0] == request_msg @@ -42796,7 +42796,6 @@ async def test_encrypt_volumes_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = kms.EncryptVolumesRequest() - assert args[0] == request_msg @@ -42827,7 +42826,6 @@ async def test_verify_kms_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = kms.VerifyKmsConfigRequest() - assert args[0] == request_msg @@ -42854,7 +42852,6 @@ async def test_delete_kms_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = kms.DeleteKmsConfigRequest() - assert args[0] == request_msg @@ -42884,7 +42881,6 @@ async def test_list_replications_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = replication.ListReplicationsRequest() - assert args[0] == request_msg @@ -42922,7 +42918,6 @@ async def test_get_replication_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = replication.GetReplicationRequest() - assert args[0] == request_msg @@ -42949,7 +42944,6 @@ async def test_create_replication_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_replication.CreateReplicationRequest() - assert args[0] == request_msg @@ -42976,7 +42970,6 @@ async def test_delete_replication_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = replication.DeleteReplicationRequest() - assert args[0] == request_msg @@ -43003,7 +42996,6 @@ async def test_update_replication_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_replication.UpdateReplicationRequest() - assert args[0] == request_msg @@ -43028,7 +43020,6 @@ async def test_stop_replication_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = replication.StopReplicationRequest() - assert args[0] == request_msg @@ -43055,7 +43046,6 @@ async def test_resume_replication_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = replication.ResumeReplicationRequest() - assert args[0] == request_msg @@ -43082,7 +43072,6 @@ async def test_reverse_replication_direction_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = replication.ReverseReplicationDirectionRequest() - assert args[0] == request_msg @@ -43109,7 +43098,6 @@ async def test_establish_peering_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = replication.EstablishPeeringRequest() - assert args[0] == request_msg @@ -43134,7 +43122,6 @@ async def test_sync_replication_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = replication.SyncReplicationRequest() - assert args[0] == request_msg @@ -43161,7 +43148,6 @@ async def test_create_backup_vault_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_backup_vault.CreateBackupVaultRequest() - assert args[0] == request_msg @@ -43198,7 +43184,6 @@ async def test_get_backup_vault_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backup_vault.GetBackupVaultRequest() - assert args[0] == request_msg @@ -43228,7 +43213,6 @@ async def test_list_backup_vaults_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backup_vault.ListBackupVaultsRequest() - assert args[0] == request_msg @@ -43255,7 +43239,6 @@ async def test_update_backup_vault_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_backup_vault.UpdateBackupVaultRequest() - assert args[0] == request_msg @@ -43282,7 +43265,6 @@ async def test_delete_backup_vault_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backup_vault.DeleteBackupVaultRequest() - assert args[0] == request_msg @@ -43307,7 +43289,6 @@ async def test_create_backup_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_backup.CreateBackupRequest() - assert args[0] == request_msg @@ -43345,7 +43326,6 @@ async def test_get_backup_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backup.GetBackupRequest() - assert args[0] == request_msg @@ -43373,7 +43353,6 @@ async def test_list_backups_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backup.ListBackupsRequest() - assert args[0] == request_msg @@ -43398,7 +43377,6 @@ async def test_delete_backup_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backup.DeleteBackupRequest() - assert args[0] == request_msg @@ -43423,7 +43401,6 @@ async def test_update_backup_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_backup.UpdateBackupRequest() - assert args[0] == request_msg @@ -43450,7 +43427,6 @@ async def test_create_backup_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_backup_policy.CreateBackupPolicyRequest() - assert args[0] == request_msg @@ -43486,7 +43462,6 @@ async def test_get_backup_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backup_policy.GetBackupPolicyRequest() - assert args[0] == request_msg @@ -43516,7 +43491,6 @@ async def test_list_backup_policies_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backup_policy.ListBackupPoliciesRequest() - assert args[0] == request_msg @@ -43543,7 +43517,6 @@ async def test_update_backup_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_backup_policy.UpdateBackupPolicyRequest() - assert args[0] == request_msg @@ -43570,7 +43543,6 @@ async def test_delete_backup_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backup_policy.DeleteBackupPolicyRequest() - assert args[0] == request_msg @@ -43598,7 +43570,6 @@ async def test_list_quota_rules_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = quota_rule.ListQuotaRulesRequest() - assert args[0] == request_msg @@ -43631,7 +43602,6 @@ async def test_get_quota_rule_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = quota_rule.GetQuotaRuleRequest() - assert args[0] == request_msg @@ -43658,7 +43628,6 @@ async def test_create_quota_rule_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_quota_rule.CreateQuotaRuleRequest() - assert args[0] == request_msg @@ -43685,7 +43654,6 @@ async def test_update_quota_rule_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_quota_rule.UpdateQuotaRuleRequest() - assert args[0] == request_msg @@ -43712,7 +43680,6 @@ async def test_delete_quota_rule_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = quota_rule.DeleteQuotaRuleRequest() - assert args[0] == request_msg @@ -43739,7 +43706,6 @@ async def test_restore_backup_files_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = volume.RestoreBackupFilesRequest() - assert args[0] == request_msg @@ -43767,7 +43733,6 @@ async def test_list_host_groups_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = host_group.ListHostGroupsRequest() - assert args[0] == request_msg @@ -43799,7 +43764,6 @@ async def test_get_host_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = host_group.GetHostGroupRequest() - assert args[0] == request_msg @@ -43826,7 +43790,6 @@ async def test_create_host_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_host_group.CreateHostGroupRequest() - assert args[0] == request_msg @@ -43853,7 +43816,6 @@ async def test_update_host_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_host_group.UpdateHostGroupRequest() - assert args[0] == request_msg @@ -43880,7 +43842,6 @@ async def test_delete_host_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = host_group.DeleteHostGroupRequest() - assert args[0] == request_msg @@ -43907,7 +43868,6 @@ async def test_execute_ontap_post_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ontap.ExecuteOntapPostRequest() - assert args[0] == request_msg @@ -43934,7 +43894,6 @@ async def test_execute_ontap_get_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ontap.ExecuteOntapGetRequest() - assert args[0] == request_msg @@ -43961,7 +43920,6 @@ async def test_execute_ontap_delete_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ontap.ExecuteOntapDeleteRequest() - assert args[0] == request_msg @@ -43988,7 +43946,6 @@ async def test_execute_ontap_patch_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ontap.ExecuteOntapPatchRequest() - assert args[0] == request_msg @@ -55858,7 +55815,6 @@ def test_list_storage_pools_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage_pool.ListStoragePoolsRequest() - assert args[0] == request_msg @@ -55880,7 +55836,6 @@ def test_create_storage_pool_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_storage_pool.CreateStoragePoolRequest() - assert args[0] == request_msg @@ -55900,7 +55855,6 @@ def test_get_storage_pool_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage_pool.GetStoragePoolRequest() - assert args[0] == request_msg @@ -55922,7 +55876,6 @@ def test_update_storage_pool_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_storage_pool.UpdateStoragePoolRequest() - assert args[0] == request_msg @@ -55944,7 +55897,6 @@ def test_delete_storage_pool_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage_pool.DeleteStoragePoolRequest() - assert args[0] == request_msg @@ -55966,7 +55918,6 @@ def test_validate_directory_service_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage_pool.ValidateDirectoryServiceRequest() - assert args[0] == request_msg @@ -55988,7 +55939,6 @@ def test_switch_active_replica_zone_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage_pool.SwitchActiveReplicaZoneRequest() - assert args[0] == request_msg @@ -56008,7 +55958,6 @@ def test_list_volumes_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = volume.ListVolumesRequest() - assert args[0] == request_msg @@ -56028,7 +55977,6 @@ def test_get_volume_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = volume.GetVolumeRequest() - assert args[0] == request_msg @@ -56048,7 +55996,6 @@ def test_create_volume_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_volume.CreateVolumeRequest() - assert args[0] == request_msg @@ -56068,7 +56015,6 @@ def test_update_volume_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_volume.UpdateVolumeRequest() - assert args[0] == request_msg @@ -56088,7 +56034,6 @@ def test_delete_volume_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = volume.DeleteVolumeRequest() - assert args[0] == request_msg @@ -56108,7 +56053,6 @@ def test_revert_volume_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = volume.RevertVolumeRequest() - assert args[0] == request_msg @@ -56130,7 +56074,6 @@ def test_establish_volume_peering_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = volume.EstablishVolumePeeringRequest() - assert args[0] == request_msg @@ -56150,7 +56093,6 @@ def test_list_snapshots_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = snapshot.ListSnapshotsRequest() - assert args[0] == request_msg @@ -56170,7 +56112,6 @@ def test_get_snapshot_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = snapshot.GetSnapshotRequest() - assert args[0] == request_msg @@ -56190,7 +56131,6 @@ def test_create_snapshot_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_snapshot.CreateSnapshotRequest() - assert args[0] == request_msg @@ -56210,7 +56150,6 @@ def test_delete_snapshot_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = snapshot.DeleteSnapshotRequest() - assert args[0] == request_msg @@ -56230,7 +56169,6 @@ def test_update_snapshot_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_snapshot.UpdateSnapshotRequest() - assert args[0] == request_msg @@ -56252,7 +56190,6 @@ def test_list_active_directories_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = active_directory.ListActiveDirectoriesRequest() - assert args[0] == request_msg @@ -56274,7 +56211,6 @@ def test_get_active_directory_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = active_directory.GetActiveDirectoryRequest() - assert args[0] == request_msg @@ -56296,7 +56232,6 @@ def test_create_active_directory_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_active_directory.CreateActiveDirectoryRequest() - assert args[0] == request_msg @@ -56318,7 +56253,6 @@ def test_update_active_directory_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_active_directory.UpdateActiveDirectoryRequest() - assert args[0] == request_msg @@ -56340,7 +56274,6 @@ def test_delete_active_directory_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = active_directory.DeleteActiveDirectoryRequest() - assert args[0] == request_msg @@ -56360,7 +56293,6 @@ def test_list_kms_configs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = kms.ListKmsConfigsRequest() - assert args[0] == request_msg @@ -56382,7 +56314,6 @@ def test_create_kms_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = kms.CreateKmsConfigRequest() - assert args[0] == request_msg @@ -56402,7 +56333,6 @@ def test_get_kms_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = kms.GetKmsConfigRequest() - assert args[0] == request_msg @@ -56424,7 +56354,6 @@ def test_update_kms_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = kms.UpdateKmsConfigRequest() - assert args[0] == request_msg @@ -56444,7 +56373,6 @@ def test_encrypt_volumes_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = kms.EncryptVolumesRequest() - assert args[0] == request_msg @@ -56466,7 +56394,6 @@ def test_verify_kms_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = kms.VerifyKmsConfigRequest() - assert args[0] == request_msg @@ -56488,7 +56415,6 @@ def test_delete_kms_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = kms.DeleteKmsConfigRequest() - assert args[0] == request_msg @@ -56510,7 +56436,6 @@ def test_list_replications_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = replication.ListReplicationsRequest() - assert args[0] == request_msg @@ -56530,7 +56455,6 @@ def test_get_replication_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = replication.GetReplicationRequest() - assert args[0] == request_msg @@ -56552,7 +56476,6 @@ def test_create_replication_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_replication.CreateReplicationRequest() - assert args[0] == request_msg @@ -56574,7 +56497,6 @@ def test_delete_replication_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = replication.DeleteReplicationRequest() - assert args[0] == request_msg @@ -56596,7 +56518,6 @@ def test_update_replication_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_replication.UpdateReplicationRequest() - assert args[0] == request_msg @@ -56616,7 +56537,6 @@ def test_stop_replication_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = replication.StopReplicationRequest() - assert args[0] == request_msg @@ -56638,7 +56558,6 @@ def test_resume_replication_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = replication.ResumeReplicationRequest() - assert args[0] == request_msg @@ -56660,7 +56579,6 @@ def test_reverse_replication_direction_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = replication.ReverseReplicationDirectionRequest() - assert args[0] == request_msg @@ -56682,7 +56600,6 @@ def test_establish_peering_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = replication.EstablishPeeringRequest() - assert args[0] == request_msg @@ -56702,7 +56619,6 @@ def test_sync_replication_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = replication.SyncReplicationRequest() - assert args[0] == request_msg @@ -56724,7 +56640,6 @@ def test_create_backup_vault_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_backup_vault.CreateBackupVaultRequest() - assert args[0] == request_msg @@ -56744,7 +56659,6 @@ def test_get_backup_vault_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backup_vault.GetBackupVaultRequest() - assert args[0] == request_msg @@ -56766,7 +56680,6 @@ def test_list_backup_vaults_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backup_vault.ListBackupVaultsRequest() - assert args[0] == request_msg @@ -56788,7 +56701,6 @@ def test_update_backup_vault_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_backup_vault.UpdateBackupVaultRequest() - assert args[0] == request_msg @@ -56810,7 +56722,6 @@ def test_delete_backup_vault_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backup_vault.DeleteBackupVaultRequest() - assert args[0] == request_msg @@ -56830,7 +56741,6 @@ def test_create_backup_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_backup.CreateBackupRequest() - assert args[0] == request_msg @@ -56850,7 +56760,6 @@ def test_get_backup_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backup.GetBackupRequest() - assert args[0] == request_msg @@ -56870,7 +56779,6 @@ def test_list_backups_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backup.ListBackupsRequest() - assert args[0] == request_msg @@ -56890,7 +56798,6 @@ def test_delete_backup_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backup.DeleteBackupRequest() - assert args[0] == request_msg @@ -56910,7 +56817,6 @@ def test_update_backup_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_backup.UpdateBackupRequest() - assert args[0] == request_msg @@ -56932,7 +56838,6 @@ def test_create_backup_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_backup_policy.CreateBackupPolicyRequest() - assert args[0] == request_msg @@ -56954,7 +56859,6 @@ def test_get_backup_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backup_policy.GetBackupPolicyRequest() - assert args[0] == request_msg @@ -56976,7 +56880,6 @@ def test_list_backup_policies_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backup_policy.ListBackupPoliciesRequest() - assert args[0] == request_msg @@ -56998,7 +56901,6 @@ def test_update_backup_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_backup_policy.UpdateBackupPolicyRequest() - assert args[0] == request_msg @@ -57020,7 +56922,6 @@ def test_delete_backup_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backup_policy.DeleteBackupPolicyRequest() - assert args[0] == request_msg @@ -57040,7 +56941,6 @@ def test_list_quota_rules_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = quota_rule.ListQuotaRulesRequest() - assert args[0] == request_msg @@ -57060,7 +56960,6 @@ def test_get_quota_rule_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = quota_rule.GetQuotaRuleRequest() - assert args[0] == request_msg @@ -57082,7 +56981,6 @@ def test_create_quota_rule_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_quota_rule.CreateQuotaRuleRequest() - assert args[0] == request_msg @@ -57104,7 +57002,6 @@ def test_update_quota_rule_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_quota_rule.UpdateQuotaRuleRequest() - assert args[0] == request_msg @@ -57126,7 +57023,6 @@ def test_delete_quota_rule_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = quota_rule.DeleteQuotaRuleRequest() - assert args[0] == request_msg @@ -57148,7 +57044,6 @@ def test_restore_backup_files_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = volume.RestoreBackupFilesRequest() - assert args[0] == request_msg @@ -57168,7 +57063,6 @@ def test_list_host_groups_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = host_group.ListHostGroupsRequest() - assert args[0] == request_msg @@ -57188,7 +57082,6 @@ def test_get_host_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = host_group.GetHostGroupRequest() - assert args[0] == request_msg @@ -57210,7 +57103,6 @@ def test_create_host_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_host_group.CreateHostGroupRequest() - assert args[0] == request_msg @@ -57232,7 +57124,6 @@ def test_update_host_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_host_group.UpdateHostGroupRequest() - assert args[0] == request_msg @@ -57254,7 +57145,6 @@ def test_delete_host_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = host_group.DeleteHostGroupRequest() - assert args[0] == request_msg @@ -57276,7 +57166,6 @@ def test_execute_ontap_post_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ontap.ExecuteOntapPostRequest() - assert args[0] == request_msg @@ -57298,7 +57187,6 @@ def test_execute_ontap_get_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ontap.ExecuteOntapGetRequest() - assert args[0] == request_msg @@ -57320,7 +57208,6 @@ def test_execute_ontap_delete_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ontap.ExecuteOntapDeleteRequest() - assert args[0] == request_msg @@ -57342,7 +57229,6 @@ def test_execute_ontap_patch_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = ontap.ExecuteOntapPatchRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-network-connectivity/noxfile.py b/packages/google-cloud-network-connectivity/noxfile.py index 64d07e45811e..52a57bff4416 100644 --- a/packages/google-cloud-network-connectivity/noxfile.py +++ b/packages/google-cloud-network-connectivity/noxfile.py @@ -47,7 +47,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-network-connectivity" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-network-connectivity/setup.py b/packages/google-cloud-network-connectivity/setup.py index c1329f3ef9c2..de8d11e404f4 100644 --- a/packages/google-cloud-network-connectivity/setup.py +++ b/packages/google-cloud-network-connectivity/setup.py @@ -45,7 +45,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/google-cloud-network-connectivity/testing/constraints-3.10.txt b/packages/google-cloud-network-connectivity/testing/constraints-3.10.txt index a92801e1c8e2..b39cd54634f9 100644 --- a/packages/google-cloud-network-connectivity/testing/constraints-3.10.txt +++ b/packages/google-cloud-network-connectivity/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/google-cloud-network-connectivity/tests/unit/gapic/networkconnectivity_v1/test_cross_network_automation_service.py b/packages/google-cloud-network-connectivity/tests/unit/gapic/networkconnectivity_v1/test_cross_network_automation_service.py index 8ad79da8feaf..7e1a2e9cfd40 100644 --- a/packages/google-cloud-network-connectivity/tests/unit/gapic/networkconnectivity_v1/test_cross_network_automation_service.py +++ b/packages/google-cloud-network-connectivity/tests/unit/gapic/networkconnectivity_v1/test_cross_network_automation_service.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 @@ -121,6 +122,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" @@ -1402,8 +1418,8 @@ def test_cross_network_automation_service_client_create_channel_credentials_file @pytest.mark.parametrize( "request_type", [ - cross_network_automation.ListServiceConnectionMapsRequest, - dict, + cross_network_automation.ListServiceConnectionMapsRequest(), + {}, ], ) def test_list_service_connection_maps(request_type, transport: str = "grpc"): @@ -1414,7 +1430,7 @@ def test_list_service_connection_maps(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1467,12 +1483,13 @@ def test_list_service_connection_maps_non_empty_request_with_auto_populated_fiel client.list_service_connection_maps(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cross_network_automation.ListServiceConnectionMapsRequest( + request_msg = cross_network_automation.ListServiceConnectionMapsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_service_connection_maps_use_cached_wrapped_rpc(): @@ -1558,9 +1575,15 @@ async def test_list_service_connection_maps_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cross_network_automation.ListServiceConnectionMapsRequest(), + {}, + ], +) async def test_list_service_connection_maps_async( - transport: str = "grpc_asyncio", - request_type=cross_network_automation.ListServiceConnectionMapsRequest, + request_type, transport: str = "grpc_asyncio" ): client = CrossNetworkAutomationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1569,7 +1592,7 @@ async def test_list_service_connection_maps_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( @@ -1596,11 +1619,6 @@ async def test_list_service_connection_maps_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_service_connection_maps_async_from_dict(): - await test_list_service_connection_maps_async(request_type=dict) - - def test_list_service_connection_maps_field_headers(): client = CrossNetworkAutomationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1963,8 +1981,8 @@ async def test_list_service_connection_maps_async_pages(): @pytest.mark.parametrize( "request_type", [ - cross_network_automation.GetServiceConnectionMapRequest, - dict, + cross_network_automation.GetServiceConnectionMapRequest(), + {}, ], ) def test_get_service_connection_map(request_type, transport: str = "grpc"): @@ -1975,7 +1993,7 @@ def test_get_service_connection_map(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2035,9 +2053,10 @@ def test_get_service_connection_map_non_empty_request_with_auto_populated_field( client.get_service_connection_map(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cross_network_automation.GetServiceConnectionMapRequest( + request_msg = cross_network_automation.GetServiceConnectionMapRequest( name="name_value", ) + assert args[0] == request_msg def test_get_service_connection_map_use_cached_wrapped_rpc(): @@ -2123,9 +2142,15 @@ async def test_get_service_connection_map_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cross_network_automation.GetServiceConnectionMapRequest(), + {}, + ], +) async def test_get_service_connection_map_async( - transport: str = "grpc_asyncio", - request_type=cross_network_automation.GetServiceConnectionMapRequest, + request_type, transport: str = "grpc_asyncio" ): client = CrossNetworkAutomationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2134,7 +2159,7 @@ async def test_get_service_connection_map_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( @@ -2171,11 +2196,6 @@ async def test_get_service_connection_map_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_service_connection_map_async_from_dict(): - await test_get_service_connection_map_async(request_type=dict) - - def test_get_service_connection_map_field_headers(): client = CrossNetworkAutomationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2330,8 +2350,8 @@ async def test_get_service_connection_map_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cross_network_automation.CreateServiceConnectionMapRequest, - dict, + cross_network_automation.CreateServiceConnectionMapRequest(), + {}, ], ) def test_create_service_connection_map(request_type, transport: str = "grpc"): @@ -2342,7 +2362,7 @@ def test_create_service_connection_map(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2389,11 +2409,12 @@ def test_create_service_connection_map_non_empty_request_with_auto_populated_fie client.create_service_connection_map(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cross_network_automation.CreateServiceConnectionMapRequest( + request_msg = cross_network_automation.CreateServiceConnectionMapRequest( parent="parent_value", service_connection_map_id="service_connection_map_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_service_connection_map_use_cached_wrapped_rpc(): @@ -2489,9 +2510,15 @@ async def test_create_service_connection_map_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cross_network_automation.CreateServiceConnectionMapRequest(), + {}, + ], +) async def test_create_service_connection_map_async( - transport: str = "grpc_asyncio", - request_type=cross_network_automation.CreateServiceConnectionMapRequest, + request_type, transport: str = "grpc_asyncio" ): client = CrossNetworkAutomationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2500,7 +2527,7 @@ async def test_create_service_connection_map_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( @@ -2522,11 +2549,6 @@ async def test_create_service_connection_map_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_service_connection_map_async_from_dict(): - await test_create_service_connection_map_async(request_type=dict) - - def test_create_service_connection_map_field_headers(): client = CrossNetworkAutomationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2709,8 +2731,8 @@ async def test_create_service_connection_map_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cross_network_automation.UpdateServiceConnectionMapRequest, - dict, + cross_network_automation.UpdateServiceConnectionMapRequest(), + {}, ], ) def test_update_service_connection_map(request_type, transport: str = "grpc"): @@ -2721,7 +2743,7 @@ def test_update_service_connection_map(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2766,9 +2788,10 @@ def test_update_service_connection_map_non_empty_request_with_auto_populated_fie client.update_service_connection_map(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cross_network_automation.UpdateServiceConnectionMapRequest( + request_msg = cross_network_automation.UpdateServiceConnectionMapRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_service_connection_map_use_cached_wrapped_rpc(): @@ -2864,9 +2887,15 @@ async def test_update_service_connection_map_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cross_network_automation.UpdateServiceConnectionMapRequest(), + {}, + ], +) async def test_update_service_connection_map_async( - transport: str = "grpc_asyncio", - request_type=cross_network_automation.UpdateServiceConnectionMapRequest, + request_type, transport: str = "grpc_asyncio" ): client = CrossNetworkAutomationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2875,7 +2904,7 @@ async def test_update_service_connection_map_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( @@ -2897,11 +2926,6 @@ async def test_update_service_connection_map_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_service_connection_map_async_from_dict(): - await test_update_service_connection_map_async(request_type=dict) - - def test_update_service_connection_map_field_headers(): client = CrossNetworkAutomationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3074,8 +3098,8 @@ async def test_update_service_connection_map_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cross_network_automation.DeleteServiceConnectionMapRequest, - dict, + cross_network_automation.DeleteServiceConnectionMapRequest(), + {}, ], ) def test_delete_service_connection_map(request_type, transport: str = "grpc"): @@ -3086,7 +3110,7 @@ def test_delete_service_connection_map(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3133,11 +3157,12 @@ def test_delete_service_connection_map_non_empty_request_with_auto_populated_fie client.delete_service_connection_map(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cross_network_automation.DeleteServiceConnectionMapRequest( + request_msg = cross_network_automation.DeleteServiceConnectionMapRequest( name="name_value", request_id="request_id_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_service_connection_map_use_cached_wrapped_rpc(): @@ -3233,9 +3258,15 @@ async def test_delete_service_connection_map_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cross_network_automation.DeleteServiceConnectionMapRequest(), + {}, + ], +) async def test_delete_service_connection_map_async( - transport: str = "grpc_asyncio", - request_type=cross_network_automation.DeleteServiceConnectionMapRequest, + request_type, transport: str = "grpc_asyncio" ): client = CrossNetworkAutomationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3244,7 +3275,7 @@ async def test_delete_service_connection_map_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( @@ -3266,11 +3297,6 @@ async def test_delete_service_connection_map_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_service_connection_map_async_from_dict(): - await test_delete_service_connection_map_async(request_type=dict) - - def test_delete_service_connection_map_field_headers(): client = CrossNetworkAutomationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3425,8 +3451,8 @@ async def test_delete_service_connection_map_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cross_network_automation.ListServiceConnectionPoliciesRequest, - dict, + cross_network_automation.ListServiceConnectionPoliciesRequest(), + {}, ], ) def test_list_service_connection_policies(request_type, transport: str = "grpc"): @@ -3437,7 +3463,7 @@ def test_list_service_connection_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( @@ -3492,12 +3518,13 @@ def test_list_service_connection_policies_non_empty_request_with_auto_populated_ client.list_service_connection_policies(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cross_network_automation.ListServiceConnectionPoliciesRequest( + request_msg = cross_network_automation.ListServiceConnectionPoliciesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_service_connection_policies_use_cached_wrapped_rpc(): @@ -3583,9 +3610,15 @@ async def test_list_service_connection_policies_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cross_network_automation.ListServiceConnectionPoliciesRequest(), + {}, + ], +) async def test_list_service_connection_policies_async( - transport: str = "grpc_asyncio", - request_type=cross_network_automation.ListServiceConnectionPoliciesRequest, + request_type, transport: str = "grpc_asyncio" ): client = CrossNetworkAutomationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3594,7 +3627,7 @@ async def test_list_service_connection_policies_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( @@ -3621,11 +3654,6 @@ async def test_list_service_connection_policies_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_service_connection_policies_async_from_dict(): - await test_list_service_connection_policies_async(request_type=dict) - - def test_list_service_connection_policies_field_headers(): client = CrossNetworkAutomationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3994,8 +4022,8 @@ async def test_list_service_connection_policies_async_pages(): @pytest.mark.parametrize( "request_type", [ - cross_network_automation.GetServiceConnectionPolicyRequest, - dict, + cross_network_automation.GetServiceConnectionPolicyRequest(), + {}, ], ) def test_get_service_connection_policy(request_type, transport: str = "grpc"): @@ -4006,7 +4034,7 @@ def test_get_service_connection_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( @@ -4064,9 +4092,10 @@ def test_get_service_connection_policy_non_empty_request_with_auto_populated_fie client.get_service_connection_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cross_network_automation.GetServiceConnectionPolicyRequest( + request_msg = cross_network_automation.GetServiceConnectionPolicyRequest( name="name_value", ) + assert args[0] == request_msg def test_get_service_connection_policy_use_cached_wrapped_rpc(): @@ -4152,9 +4181,15 @@ async def test_get_service_connection_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cross_network_automation.GetServiceConnectionPolicyRequest(), + {}, + ], +) async def test_get_service_connection_policy_async( - transport: str = "grpc_asyncio", - request_type=cross_network_automation.GetServiceConnectionPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = CrossNetworkAutomationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4163,7 +4198,7 @@ async def test_get_service_connection_policy_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( @@ -4198,11 +4233,6 @@ async def test_get_service_connection_policy_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_service_connection_policy_async_from_dict(): - await test_get_service_connection_policy_async(request_type=dict) - - def test_get_service_connection_policy_field_headers(): client = CrossNetworkAutomationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4357,8 +4387,8 @@ async def test_get_service_connection_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cross_network_automation.CreateServiceConnectionPolicyRequest, - dict, + cross_network_automation.CreateServiceConnectionPolicyRequest(), + {}, ], ) def test_create_service_connection_policy(request_type, transport: str = "grpc"): @@ -4369,7 +4399,7 @@ def test_create_service_connection_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( @@ -4416,11 +4446,12 @@ def test_create_service_connection_policy_non_empty_request_with_auto_populated_ client.create_service_connection_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cross_network_automation.CreateServiceConnectionPolicyRequest( + request_msg = cross_network_automation.CreateServiceConnectionPolicyRequest( parent="parent_value", service_connection_policy_id="service_connection_policy_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_service_connection_policy_use_cached_wrapped_rpc(): @@ -4516,9 +4547,15 @@ async def test_create_service_connection_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cross_network_automation.CreateServiceConnectionPolicyRequest(), + {}, + ], +) async def test_create_service_connection_policy_async( - transport: str = "grpc_asyncio", - request_type=cross_network_automation.CreateServiceConnectionPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = CrossNetworkAutomationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4527,7 +4564,7 @@ async def test_create_service_connection_policy_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( @@ -4549,11 +4586,6 @@ async def test_create_service_connection_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_service_connection_policy_async_from_dict(): - await test_create_service_connection_policy_async(request_type=dict) - - def test_create_service_connection_policy_field_headers(): client = CrossNetworkAutomationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4736,8 +4768,8 @@ async def test_create_service_connection_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cross_network_automation.UpdateServiceConnectionPolicyRequest, - dict, + cross_network_automation.UpdateServiceConnectionPolicyRequest(), + {}, ], ) def test_update_service_connection_policy(request_type, transport: str = "grpc"): @@ -4748,7 +4780,7 @@ def test_update_service_connection_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( @@ -4793,9 +4825,10 @@ def test_update_service_connection_policy_non_empty_request_with_auto_populated_ client.update_service_connection_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cross_network_automation.UpdateServiceConnectionPolicyRequest( + request_msg = cross_network_automation.UpdateServiceConnectionPolicyRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_service_connection_policy_use_cached_wrapped_rpc(): @@ -4891,9 +4924,15 @@ async def test_update_service_connection_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cross_network_automation.UpdateServiceConnectionPolicyRequest(), + {}, + ], +) async def test_update_service_connection_policy_async( - transport: str = "grpc_asyncio", - request_type=cross_network_automation.UpdateServiceConnectionPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = CrossNetworkAutomationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4902,7 +4941,7 @@ async def test_update_service_connection_policy_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( @@ -4924,11 +4963,6 @@ async def test_update_service_connection_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_service_connection_policy_async_from_dict(): - await test_update_service_connection_policy_async(request_type=dict) - - def test_update_service_connection_policy_field_headers(): client = CrossNetworkAutomationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5101,8 +5135,8 @@ async def test_update_service_connection_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cross_network_automation.DeleteServiceConnectionPolicyRequest, - dict, + cross_network_automation.DeleteServiceConnectionPolicyRequest(), + {}, ], ) def test_delete_service_connection_policy(request_type, transport: str = "grpc"): @@ -5113,7 +5147,7 @@ def test_delete_service_connection_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( @@ -5160,11 +5194,12 @@ def test_delete_service_connection_policy_non_empty_request_with_auto_populated_ client.delete_service_connection_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cross_network_automation.DeleteServiceConnectionPolicyRequest( + request_msg = cross_network_automation.DeleteServiceConnectionPolicyRequest( name="name_value", request_id="request_id_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_service_connection_policy_use_cached_wrapped_rpc(): @@ -5260,9 +5295,15 @@ async def test_delete_service_connection_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cross_network_automation.DeleteServiceConnectionPolicyRequest(), + {}, + ], +) async def test_delete_service_connection_policy_async( - transport: str = "grpc_asyncio", - request_type=cross_network_automation.DeleteServiceConnectionPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = CrossNetworkAutomationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5271,7 +5312,7 @@ async def test_delete_service_connection_policy_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( @@ -5293,11 +5334,6 @@ async def test_delete_service_connection_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_service_connection_policy_async_from_dict(): - await test_delete_service_connection_policy_async(request_type=dict) - - def test_delete_service_connection_policy_field_headers(): client = CrossNetworkAutomationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5452,8 +5488,8 @@ async def test_delete_service_connection_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cross_network_automation.ListServiceClassesRequest, - dict, + cross_network_automation.ListServiceClassesRequest(), + {}, ], ) def test_list_service_classes(request_type, transport: str = "grpc"): @@ -5464,7 +5500,7 @@ def test_list_service_classes(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5517,12 +5553,13 @@ def test_list_service_classes_non_empty_request_with_auto_populated_field(): client.list_service_classes(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cross_network_automation.ListServiceClassesRequest( + request_msg = cross_network_automation.ListServiceClassesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_service_classes_use_cached_wrapped_rpc(): @@ -5607,9 +5644,15 @@ async def test_list_service_classes_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cross_network_automation.ListServiceClassesRequest(), + {}, + ], +) async def test_list_service_classes_async( - transport: str = "grpc_asyncio", - request_type=cross_network_automation.ListServiceClassesRequest, + request_type, transport: str = "grpc_asyncio" ): client = CrossNetworkAutomationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5618,7 +5661,7 @@ async def test_list_service_classes_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( @@ -5645,11 +5688,6 @@ async def test_list_service_classes_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_service_classes_async_from_dict(): - await test_list_service_classes_async(request_type=dict) - - def test_list_service_classes_field_headers(): client = CrossNetworkAutomationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6006,8 +6044,8 @@ async def test_list_service_classes_async_pages(): @pytest.mark.parametrize( "request_type", [ - cross_network_automation.GetServiceClassRequest, - dict, + cross_network_automation.GetServiceClassRequest(), + {}, ], ) def test_get_service_class(request_type, transport: str = "grpc"): @@ -6018,7 +6056,7 @@ def test_get_service_class(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6072,9 +6110,10 @@ def test_get_service_class_non_empty_request_with_auto_populated_field(): client.get_service_class(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cross_network_automation.GetServiceClassRequest( + request_msg = cross_network_automation.GetServiceClassRequest( name="name_value", ) + assert args[0] == request_msg def test_get_service_class_use_cached_wrapped_rpc(): @@ -6157,10 +6196,14 @@ async def test_get_service_class_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_service_class_async( - transport: str = "grpc_asyncio", - request_type=cross_network_automation.GetServiceClassRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + cross_network_automation.GetServiceClassRequest(), + {}, + ], +) +async def test_get_service_class_async(request_type, transport: str = "grpc_asyncio"): client = CrossNetworkAutomationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6168,7 +6211,7 @@ async def test_get_service_class_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( @@ -6199,11 +6242,6 @@ async def test_get_service_class_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_service_class_async_from_dict(): - await test_get_service_class_async(request_type=dict) - - def test_get_service_class_field_headers(): client = CrossNetworkAutomationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6358,8 +6396,8 @@ async def test_get_service_class_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cross_network_automation.UpdateServiceClassRequest, - dict, + cross_network_automation.UpdateServiceClassRequest(), + {}, ], ) def test_update_service_class(request_type, transport: str = "grpc"): @@ -6370,7 +6408,7 @@ def test_update_service_class(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6415,9 +6453,10 @@ def test_update_service_class_non_empty_request_with_auto_populated_field(): client.update_service_class(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cross_network_automation.UpdateServiceClassRequest( + request_msg = cross_network_automation.UpdateServiceClassRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_service_class_use_cached_wrapped_rpc(): @@ -6512,9 +6551,15 @@ async def test_update_service_class_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cross_network_automation.UpdateServiceClassRequest(), + {}, + ], +) async def test_update_service_class_async( - transport: str = "grpc_asyncio", - request_type=cross_network_automation.UpdateServiceClassRequest, + request_type, transport: str = "grpc_asyncio" ): client = CrossNetworkAutomationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -6523,7 +6568,7 @@ async def test_update_service_class_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( @@ -6545,11 +6590,6 @@ async def test_update_service_class_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_service_class_async_from_dict(): - await test_update_service_class_async(request_type=dict) - - def test_update_service_class_field_headers(): client = CrossNetworkAutomationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6714,8 +6754,8 @@ async def test_update_service_class_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cross_network_automation.DeleteServiceClassRequest, - dict, + cross_network_automation.DeleteServiceClassRequest(), + {}, ], ) def test_delete_service_class(request_type, transport: str = "grpc"): @@ -6726,7 +6766,7 @@ def test_delete_service_class(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6773,11 +6813,12 @@ def test_delete_service_class_non_empty_request_with_auto_populated_field(): client.delete_service_class(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cross_network_automation.DeleteServiceClassRequest( + request_msg = cross_network_automation.DeleteServiceClassRequest( name="name_value", request_id="request_id_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_service_class_use_cached_wrapped_rpc(): @@ -6872,9 +6913,15 @@ async def test_delete_service_class_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cross_network_automation.DeleteServiceClassRequest(), + {}, + ], +) async def test_delete_service_class_async( - transport: str = "grpc_asyncio", - request_type=cross_network_automation.DeleteServiceClassRequest, + request_type, transport: str = "grpc_asyncio" ): client = CrossNetworkAutomationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -6883,7 +6930,7 @@ async def test_delete_service_class_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( @@ -6905,11 +6952,6 @@ async def test_delete_service_class_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_service_class_async_from_dict(): - await test_delete_service_class_async(request_type=dict) - - def test_delete_service_class_field_headers(): client = CrossNetworkAutomationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7064,8 +7106,8 @@ async def test_delete_service_class_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cross_network_automation.GetServiceConnectionTokenRequest, - dict, + cross_network_automation.GetServiceConnectionTokenRequest(), + {}, ], ) def test_get_service_connection_token(request_type, transport: str = "grpc"): @@ -7076,7 +7118,7 @@ def test_get_service_connection_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( @@ -7132,9 +7174,10 @@ def test_get_service_connection_token_non_empty_request_with_auto_populated_fiel client.get_service_connection_token(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cross_network_automation.GetServiceConnectionTokenRequest( + request_msg = cross_network_automation.GetServiceConnectionTokenRequest( name="name_value", ) + assert args[0] == request_msg def test_get_service_connection_token_use_cached_wrapped_rpc(): @@ -7220,9 +7263,15 @@ async def test_get_service_connection_token_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cross_network_automation.GetServiceConnectionTokenRequest(), + {}, + ], +) async def test_get_service_connection_token_async( - transport: str = "grpc_asyncio", - request_type=cross_network_automation.GetServiceConnectionTokenRequest, + request_type, transport: str = "grpc_asyncio" ): client = CrossNetworkAutomationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -7231,7 +7280,7 @@ async def test_get_service_connection_token_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( @@ -7264,11 +7313,6 @@ async def test_get_service_connection_token_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_service_connection_token_async_from_dict(): - await test_get_service_connection_token_async(request_type=dict) - - def test_get_service_connection_token_field_headers(): client = CrossNetworkAutomationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7423,8 +7467,8 @@ async def test_get_service_connection_token_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cross_network_automation.ListServiceConnectionTokensRequest, - dict, + cross_network_automation.ListServiceConnectionTokensRequest(), + {}, ], ) def test_list_service_connection_tokens(request_type, transport: str = "grpc"): @@ -7435,7 +7479,7 @@ def test_list_service_connection_tokens(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7490,12 +7534,13 @@ def test_list_service_connection_tokens_non_empty_request_with_auto_populated_fi client.list_service_connection_tokens(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cross_network_automation.ListServiceConnectionTokensRequest( + request_msg = cross_network_automation.ListServiceConnectionTokensRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_service_connection_tokens_use_cached_wrapped_rpc(): @@ -7581,9 +7626,15 @@ async def test_list_service_connection_tokens_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cross_network_automation.ListServiceConnectionTokensRequest(), + {}, + ], +) async def test_list_service_connection_tokens_async( - transport: str = "grpc_asyncio", - request_type=cross_network_automation.ListServiceConnectionTokensRequest, + request_type, transport: str = "grpc_asyncio" ): client = CrossNetworkAutomationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -7592,7 +7643,7 @@ async def test_list_service_connection_tokens_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( @@ -7619,11 +7670,6 @@ async def test_list_service_connection_tokens_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_service_connection_tokens_async_from_dict(): - await test_list_service_connection_tokens_async(request_type=dict) - - def test_list_service_connection_tokens_field_headers(): client = CrossNetworkAutomationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7992,8 +8038,8 @@ async def test_list_service_connection_tokens_async_pages(): @pytest.mark.parametrize( "request_type", [ - cross_network_automation.CreateServiceConnectionTokenRequest, - dict, + cross_network_automation.CreateServiceConnectionTokenRequest(), + {}, ], ) def test_create_service_connection_token(request_type, transport: str = "grpc"): @@ -8004,7 +8050,7 @@ def test_create_service_connection_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( @@ -8051,11 +8097,12 @@ def test_create_service_connection_token_non_empty_request_with_auto_populated_f client.create_service_connection_token(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cross_network_automation.CreateServiceConnectionTokenRequest( + request_msg = cross_network_automation.CreateServiceConnectionTokenRequest( parent="parent_value", service_connection_token_id="service_connection_token_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_service_connection_token_use_cached_wrapped_rpc(): @@ -8151,9 +8198,15 @@ async def test_create_service_connection_token_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cross_network_automation.CreateServiceConnectionTokenRequest(), + {}, + ], +) async def test_create_service_connection_token_async( - transport: str = "grpc_asyncio", - request_type=cross_network_automation.CreateServiceConnectionTokenRequest, + request_type, transport: str = "grpc_asyncio" ): client = CrossNetworkAutomationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -8162,7 +8215,7 @@ async def test_create_service_connection_token_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( @@ -8184,11 +8237,6 @@ async def test_create_service_connection_token_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_service_connection_token_async_from_dict(): - await test_create_service_connection_token_async(request_type=dict) - - def test_create_service_connection_token_field_headers(): client = CrossNetworkAutomationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8371,8 +8419,8 @@ async def test_create_service_connection_token_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cross_network_automation.DeleteServiceConnectionTokenRequest, - dict, + cross_network_automation.DeleteServiceConnectionTokenRequest(), + {}, ], ) def test_delete_service_connection_token(request_type, transport: str = "grpc"): @@ -8383,7 +8431,7 @@ def test_delete_service_connection_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( @@ -8430,11 +8478,12 @@ def test_delete_service_connection_token_non_empty_request_with_auto_populated_f client.delete_service_connection_token(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cross_network_automation.DeleteServiceConnectionTokenRequest( + request_msg = cross_network_automation.DeleteServiceConnectionTokenRequest( name="name_value", request_id="request_id_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_service_connection_token_use_cached_wrapped_rpc(): @@ -8530,9 +8579,15 @@ async def test_delete_service_connection_token_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cross_network_automation.DeleteServiceConnectionTokenRequest(), + {}, + ], +) async def test_delete_service_connection_token_async( - transport: str = "grpc_asyncio", - request_type=cross_network_automation.DeleteServiceConnectionTokenRequest, + request_type, transport: str = "grpc_asyncio" ): client = CrossNetworkAutomationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -8541,7 +8596,7 @@ async def test_delete_service_connection_token_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( @@ -8563,11 +8618,6 @@ async def test_delete_service_connection_token_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_service_connection_token_async_from_dict(): - await test_delete_service_connection_token_async(request_type=dict) - - def test_delete_service_connection_token_field_headers(): client = CrossNetworkAutomationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8843,7 +8893,6 @@ def test_list_service_connection_maps_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cross_network_automation.ListServiceConnectionMapsRequest() - assert args[0] == request_msg @@ -8866,7 +8915,6 @@ def test_get_service_connection_map_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cross_network_automation.GetServiceConnectionMapRequest() - assert args[0] == request_msg @@ -8889,7 +8937,6 @@ def test_create_service_connection_map_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cross_network_automation.CreateServiceConnectionMapRequest() - assert args[0] == request_msg @@ -8912,7 +8959,6 @@ def test_update_service_connection_map_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cross_network_automation.UpdateServiceConnectionMapRequest() - assert args[0] == request_msg @@ -8935,7 +8981,6 @@ def test_delete_service_connection_map_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cross_network_automation.DeleteServiceConnectionMapRequest() - assert args[0] == request_msg @@ -8960,7 +9005,6 @@ def test_list_service_connection_policies_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cross_network_automation.ListServiceConnectionPoliciesRequest() - assert args[0] == request_msg @@ -8983,7 +9027,6 @@ def test_get_service_connection_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cross_network_automation.GetServiceConnectionPolicyRequest() - assert args[0] == request_msg @@ -9006,7 +9049,6 @@ def test_create_service_connection_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cross_network_automation.CreateServiceConnectionPolicyRequest() - assert args[0] == request_msg @@ -9029,7 +9071,6 @@ def test_update_service_connection_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cross_network_automation.UpdateServiceConnectionPolicyRequest() - assert args[0] == request_msg @@ -9052,7 +9093,6 @@ def test_delete_service_connection_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cross_network_automation.DeleteServiceConnectionPolicyRequest() - assert args[0] == request_msg @@ -9075,7 +9115,6 @@ def test_list_service_classes_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cross_network_automation.ListServiceClassesRequest() - assert args[0] == request_msg @@ -9098,7 +9137,6 @@ def test_get_service_class_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cross_network_automation.GetServiceClassRequest() - assert args[0] == request_msg @@ -9121,7 +9159,6 @@ def test_update_service_class_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cross_network_automation.UpdateServiceClassRequest() - assert args[0] == request_msg @@ -9144,7 +9181,6 @@ def test_delete_service_class_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cross_network_automation.DeleteServiceClassRequest() - assert args[0] == request_msg @@ -9167,7 +9203,6 @@ def test_get_service_connection_token_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cross_network_automation.GetServiceConnectionTokenRequest() - assert args[0] == request_msg @@ -9192,7 +9227,6 @@ def test_list_service_connection_tokens_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cross_network_automation.ListServiceConnectionTokensRequest() - assert args[0] == request_msg @@ -9215,7 +9249,6 @@ def test_create_service_connection_token_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cross_network_automation.CreateServiceConnectionTokenRequest() - assert args[0] == request_msg @@ -9238,7 +9271,6 @@ def test_delete_service_connection_token_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cross_network_automation.DeleteServiceConnectionTokenRequest() - assert args[0] == request_msg @@ -9282,7 +9314,6 @@ async def test_list_service_connection_maps_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cross_network_automation.ListServiceConnectionMapsRequest() - assert args[0] == request_msg @@ -9317,7 +9348,6 @@ async def test_get_service_connection_map_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cross_network_automation.GetServiceConnectionMapRequest() - assert args[0] == request_msg @@ -9344,7 +9374,6 @@ async def test_create_service_connection_map_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cross_network_automation.CreateServiceConnectionMapRequest() - assert args[0] == request_msg @@ -9371,7 +9400,6 @@ async def test_update_service_connection_map_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cross_network_automation.UpdateServiceConnectionMapRequest() - assert args[0] == request_msg @@ -9398,7 +9426,6 @@ async def test_delete_service_connection_map_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cross_network_automation.DeleteServiceConnectionMapRequest() - assert args[0] == request_msg @@ -9428,7 +9455,6 @@ async def test_list_service_connection_policies_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cross_network_automation.ListServiceConnectionPoliciesRequest() - assert args[0] == request_msg @@ -9462,7 +9488,6 @@ async def test_get_service_connection_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cross_network_automation.GetServiceConnectionPolicyRequest() - assert args[0] == request_msg @@ -9489,7 +9514,6 @@ async def test_create_service_connection_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cross_network_automation.CreateServiceConnectionPolicyRequest() - assert args[0] == request_msg @@ -9516,7 +9540,6 @@ async def test_update_service_connection_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cross_network_automation.UpdateServiceConnectionPolicyRequest() - assert args[0] == request_msg @@ -9543,7 +9566,6 @@ async def test_delete_service_connection_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cross_network_automation.DeleteServiceConnectionPolicyRequest() - assert args[0] == request_msg @@ -9573,7 +9595,6 @@ async def test_list_service_classes_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cross_network_automation.ListServiceClassesRequest() - assert args[0] == request_msg @@ -9605,7 +9626,6 @@ async def test_get_service_class_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cross_network_automation.GetServiceClassRequest() - assert args[0] == request_msg @@ -9632,7 +9652,6 @@ async def test_update_service_class_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cross_network_automation.UpdateServiceClassRequest() - assert args[0] == request_msg @@ -9659,7 +9678,6 @@ async def test_delete_service_class_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cross_network_automation.DeleteServiceClassRequest() - assert args[0] == request_msg @@ -9692,7 +9710,6 @@ async def test_get_service_connection_token_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cross_network_automation.GetServiceConnectionTokenRequest() - assert args[0] == request_msg @@ -9722,7 +9739,6 @@ async def test_list_service_connection_tokens_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cross_network_automation.ListServiceConnectionTokensRequest() - assert args[0] == request_msg @@ -9749,7 +9765,6 @@ async def test_create_service_connection_token_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cross_network_automation.CreateServiceConnectionTokenRequest() - assert args[0] == request_msg @@ -9776,7 +9791,6 @@ async def test_delete_service_connection_token_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cross_network_automation.DeleteServiceConnectionTokenRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-network-connectivity/tests/unit/gapic/networkconnectivity_v1/test_data_transfer_service.py b/packages/google-cloud-network-connectivity/tests/unit/gapic/networkconnectivity_v1/test_data_transfer_service.py index 2ed6cc839c0e..0a64b3c632bf 100644 --- a/packages/google-cloud-network-connectivity/tests/unit/gapic/networkconnectivity_v1/test_data_transfer_service.py +++ b/packages/google-cloud-network-connectivity/tests/unit/gapic/networkconnectivity_v1/test_data_transfer_service.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 @@ -118,6 +119,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" @@ -1341,8 +1357,8 @@ def test_data_transfer_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - data_transfer.ListMulticloudDataTransferConfigsRequest, - dict, + data_transfer.ListMulticloudDataTransferConfigsRequest(), + {}, ], ) def test_list_multicloud_data_transfer_configs(request_type, transport: str = "grpc"): @@ -1353,7 +1369,7 @@ def test_list_multicloud_data_transfer_configs(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( @@ -1406,12 +1422,13 @@ def test_list_multicloud_data_transfer_configs_non_empty_request_with_auto_popul client.list_multicloud_data_transfer_configs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_transfer.ListMulticloudDataTransferConfigsRequest( + request_msg = data_transfer.ListMulticloudDataTransferConfigsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_multicloud_data_transfer_configs_use_cached_wrapped_rpc(): @@ -1497,9 +1514,15 @@ async def test_list_multicloud_data_transfer_configs_async_use_cached_wrapped_rp @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_transfer.ListMulticloudDataTransferConfigsRequest(), + {}, + ], +) async def test_list_multicloud_data_transfer_configs_async( - transport: str = "grpc_asyncio", - request_type=data_transfer.ListMulticloudDataTransferConfigsRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataTransferServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1508,7 +1531,7 @@ async def test_list_multicloud_data_transfer_configs_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( @@ -1535,11 +1558,6 @@ async def test_list_multicloud_data_transfer_configs_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_multicloud_data_transfer_configs_async_from_dict(): - await test_list_multicloud_data_transfer_configs_async(request_type=dict) - - def test_list_multicloud_data_transfer_configs_field_headers(): client = DataTransferServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1900,8 +1918,8 @@ async def test_list_multicloud_data_transfer_configs_async_pages(): @pytest.mark.parametrize( "request_type", [ - data_transfer.GetMulticloudDataTransferConfigRequest, - dict, + data_transfer.GetMulticloudDataTransferConfigRequest(), + {}, ], ) def test_get_multicloud_data_transfer_config(request_type, transport: str = "grpc"): @@ -1912,7 +1930,7 @@ def test_get_multicloud_data_transfer_config(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( @@ -1970,9 +1988,10 @@ def test_get_multicloud_data_transfer_config_non_empty_request_with_auto_populat client.get_multicloud_data_transfer_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_transfer.GetMulticloudDataTransferConfigRequest( + request_msg = data_transfer.GetMulticloudDataTransferConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_multicloud_data_transfer_config_use_cached_wrapped_rpc(): @@ -2058,9 +2077,15 @@ async def test_get_multicloud_data_transfer_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_transfer.GetMulticloudDataTransferConfigRequest(), + {}, + ], +) async def test_get_multicloud_data_transfer_config_async( - transport: str = "grpc_asyncio", - request_type=data_transfer.GetMulticloudDataTransferConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataTransferServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2069,7 +2094,7 @@ async def test_get_multicloud_data_transfer_config_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( @@ -2104,11 +2129,6 @@ async def test_get_multicloud_data_transfer_config_async( assert response.uid == "uid_value" -@pytest.mark.asyncio -async def test_get_multicloud_data_transfer_config_async_from_dict(): - await test_get_multicloud_data_transfer_config_async(request_type=dict) - - def test_get_multicloud_data_transfer_config_field_headers(): client = DataTransferServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2263,8 +2283,8 @@ async def test_get_multicloud_data_transfer_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_transfer.CreateMulticloudDataTransferConfigRequest, - dict, + data_transfer.CreateMulticloudDataTransferConfigRequest(), + {}, ], ) def test_create_multicloud_data_transfer_config(request_type, transport: str = "grpc"): @@ -2275,7 +2295,7 @@ def test_create_multicloud_data_transfer_config(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( @@ -2321,10 +2341,11 @@ def test_create_multicloud_data_transfer_config_non_empty_request_with_auto_popu client.create_multicloud_data_transfer_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_transfer.CreateMulticloudDataTransferConfigRequest( + request_msg = data_transfer.CreateMulticloudDataTransferConfigRequest( parent="parent_value", multicloud_data_transfer_config_id="multicloud_data_transfer_config_id_value", ) + assert args[0] == request_msg def test_create_multicloud_data_transfer_config_use_cached_wrapped_rpc(): @@ -2420,9 +2441,15 @@ async def test_create_multicloud_data_transfer_config_async_use_cached_wrapped_r @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_transfer.CreateMulticloudDataTransferConfigRequest(), + {}, + ], +) async def test_create_multicloud_data_transfer_config_async( - transport: str = "grpc_asyncio", - request_type=data_transfer.CreateMulticloudDataTransferConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataTransferServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2431,7 +2458,7 @@ async def test_create_multicloud_data_transfer_config_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( @@ -2453,11 +2480,6 @@ async def test_create_multicloud_data_transfer_config_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_multicloud_data_transfer_config_async_from_dict(): - await test_create_multicloud_data_transfer_config_async(request_type=dict) - - def test_create_multicloud_data_transfer_config_field_headers(): client = DataTransferServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2640,8 +2662,8 @@ async def test_create_multicloud_data_transfer_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_transfer.UpdateMulticloudDataTransferConfigRequest, - dict, + data_transfer.UpdateMulticloudDataTransferConfigRequest(), + {}, ], ) def test_update_multicloud_data_transfer_config(request_type, transport: str = "grpc"): @@ -2652,7 +2674,7 @@ def test_update_multicloud_data_transfer_config(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( @@ -2695,7 +2717,8 @@ def test_update_multicloud_data_transfer_config_non_empty_request_with_auto_popu client.update_multicloud_data_transfer_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_transfer.UpdateMulticloudDataTransferConfigRequest() + request_msg = data_transfer.UpdateMulticloudDataTransferConfigRequest() + assert args[0] == request_msg def test_update_multicloud_data_transfer_config_use_cached_wrapped_rpc(): @@ -2791,9 +2814,15 @@ async def test_update_multicloud_data_transfer_config_async_use_cached_wrapped_r @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_transfer.UpdateMulticloudDataTransferConfigRequest(), + {}, + ], +) async def test_update_multicloud_data_transfer_config_async( - transport: str = "grpc_asyncio", - request_type=data_transfer.UpdateMulticloudDataTransferConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataTransferServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2802,7 +2831,7 @@ async def test_update_multicloud_data_transfer_config_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( @@ -2824,11 +2853,6 @@ async def test_update_multicloud_data_transfer_config_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_multicloud_data_transfer_config_async_from_dict(): - await test_update_multicloud_data_transfer_config_async(request_type=dict) - - def test_update_multicloud_data_transfer_config_field_headers(): client = DataTransferServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3001,8 +3025,8 @@ async def test_update_multicloud_data_transfer_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_transfer.DeleteMulticloudDataTransferConfigRequest, - dict, + data_transfer.DeleteMulticloudDataTransferConfigRequest(), + {}, ], ) def test_delete_multicloud_data_transfer_config(request_type, transport: str = "grpc"): @@ -3013,7 +3037,7 @@ def test_delete_multicloud_data_transfer_config(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( @@ -3059,10 +3083,11 @@ def test_delete_multicloud_data_transfer_config_non_empty_request_with_auto_popu client.delete_multicloud_data_transfer_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_transfer.DeleteMulticloudDataTransferConfigRequest( + request_msg = data_transfer.DeleteMulticloudDataTransferConfigRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_multicloud_data_transfer_config_use_cached_wrapped_rpc(): @@ -3158,9 +3183,15 @@ async def test_delete_multicloud_data_transfer_config_async_use_cached_wrapped_r @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_transfer.DeleteMulticloudDataTransferConfigRequest(), + {}, + ], +) async def test_delete_multicloud_data_transfer_config_async( - transport: str = "grpc_asyncio", - request_type=data_transfer.DeleteMulticloudDataTransferConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataTransferServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3169,7 +3200,7 @@ async def test_delete_multicloud_data_transfer_config_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( @@ -3191,11 +3222,6 @@ async def test_delete_multicloud_data_transfer_config_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_multicloud_data_transfer_config_async_from_dict(): - await test_delete_multicloud_data_transfer_config_async(request_type=dict) - - def test_delete_multicloud_data_transfer_config_field_headers(): client = DataTransferServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3350,8 +3376,8 @@ async def test_delete_multicloud_data_transfer_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_transfer.ListDestinationsRequest, - dict, + data_transfer.ListDestinationsRequest(), + {}, ], ) def test_list_destinations(request_type, transport: str = "grpc"): @@ -3362,7 +3388,7 @@ def test_list_destinations(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3415,12 +3441,13 @@ def test_list_destinations_non_empty_request_with_auto_populated_field(): client.list_destinations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_transfer.ListDestinationsRequest( + request_msg = data_transfer.ListDestinationsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_destinations_use_cached_wrapped_rpc(): @@ -3503,9 +3530,14 @@ async def test_list_destinations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_destinations_async( - transport: str = "grpc_asyncio", request_type=data_transfer.ListDestinationsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + data_transfer.ListDestinationsRequest(), + {}, + ], +) +async def test_list_destinations_async(request_type, transport: str = "grpc_asyncio"): client = DataTransferServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3513,7 +3545,7 @@ async def test_list_destinations_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( @@ -3540,11 +3572,6 @@ async def test_list_destinations_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_destinations_async_from_dict(): - await test_list_destinations_async(request_type=dict) - - def test_list_destinations_field_headers(): client = DataTransferServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3897,8 +3924,8 @@ async def test_list_destinations_async_pages(): @pytest.mark.parametrize( "request_type", [ - data_transfer.GetDestinationRequest, - dict, + data_transfer.GetDestinationRequest(), + {}, ], ) def test_get_destination(request_type, transport: str = "grpc"): @@ -3909,7 +3936,7 @@ def test_get_destination(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_destination), "__call__") as call: @@ -3961,9 +3988,10 @@ def test_get_destination_non_empty_request_with_auto_populated_field(): client.get_destination(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_transfer.GetDestinationRequest( + request_msg = data_transfer.GetDestinationRequest( name="name_value", ) + assert args[0] == request_msg def test_get_destination_use_cached_wrapped_rpc(): @@ -4044,9 +4072,14 @@ async def test_get_destination_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_destination_async( - transport: str = "grpc_asyncio", request_type=data_transfer.GetDestinationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + data_transfer.GetDestinationRequest(), + {}, + ], +) +async def test_get_destination_async(request_type, transport: str = "grpc_asyncio"): client = DataTransferServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4054,7 +4087,7 @@ async def test_get_destination_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_destination), "__call__") as call: @@ -4085,11 +4118,6 @@ async def test_get_destination_async( assert response.uid == "uid_value" -@pytest.mark.asyncio -async def test_get_destination_async_from_dict(): - await test_get_destination_async(request_type=dict) - - def test_get_destination_field_headers(): client = DataTransferServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4236,8 +4264,8 @@ async def test_get_destination_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_transfer.CreateDestinationRequest, - dict, + data_transfer.CreateDestinationRequest(), + {}, ], ) def test_create_destination(request_type, transport: str = "grpc"): @@ -4248,7 +4276,7 @@ def test_create_destination(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4294,10 +4322,11 @@ def test_create_destination_non_empty_request_with_auto_populated_field(): client.create_destination(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_transfer.CreateDestinationRequest( + request_msg = data_transfer.CreateDestinationRequest( parent="parent_value", destination_id="destination_id_value", ) + assert args[0] == request_msg def test_create_destination_use_cached_wrapped_rpc(): @@ -4392,9 +4421,14 @@ async def test_create_destination_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_destination_async( - transport: str = "grpc_asyncio", request_type=data_transfer.CreateDestinationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + data_transfer.CreateDestinationRequest(), + {}, + ], +) +async def test_create_destination_async(request_type, transport: str = "grpc_asyncio"): client = DataTransferServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4402,7 +4436,7 @@ async def test_create_destination_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( @@ -4424,11 +4458,6 @@ async def test_create_destination_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_destination_async_from_dict(): - await test_create_destination_async(request_type=dict) - - def test_create_destination_field_headers(): client = DataTransferServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4603,8 +4632,8 @@ async def test_create_destination_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_transfer.UpdateDestinationRequest, - dict, + data_transfer.UpdateDestinationRequest(), + {}, ], ) def test_update_destination(request_type, transport: str = "grpc"): @@ -4615,7 +4644,7 @@ def test_update_destination(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4658,7 +4687,8 @@ def test_update_destination_non_empty_request_with_auto_populated_field(): client.update_destination(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_transfer.UpdateDestinationRequest() + request_msg = data_transfer.UpdateDestinationRequest() + assert args[0] == request_msg def test_update_destination_use_cached_wrapped_rpc(): @@ -4753,9 +4783,14 @@ async def test_update_destination_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_destination_async( - transport: str = "grpc_asyncio", request_type=data_transfer.UpdateDestinationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + data_transfer.UpdateDestinationRequest(), + {}, + ], +) +async def test_update_destination_async(request_type, transport: str = "grpc_asyncio"): client = DataTransferServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4763,7 +4798,7 @@ async def test_update_destination_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( @@ -4785,11 +4820,6 @@ async def test_update_destination_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_destination_async_from_dict(): - await test_update_destination_async(request_type=dict) - - def test_update_destination_field_headers(): client = DataTransferServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4954,8 +4984,8 @@ async def test_update_destination_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_transfer.DeleteDestinationRequest, - dict, + data_transfer.DeleteDestinationRequest(), + {}, ], ) def test_delete_destination(request_type, transport: str = "grpc"): @@ -4966,7 +4996,7 @@ def test_delete_destination(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5012,10 +5042,11 @@ def test_delete_destination_non_empty_request_with_auto_populated_field(): client.delete_destination(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_transfer.DeleteDestinationRequest( + request_msg = data_transfer.DeleteDestinationRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_destination_use_cached_wrapped_rpc(): @@ -5110,9 +5141,14 @@ async def test_delete_destination_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_destination_async( - transport: str = "grpc_asyncio", request_type=data_transfer.DeleteDestinationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + data_transfer.DeleteDestinationRequest(), + {}, + ], +) +async def test_delete_destination_async(request_type, transport: str = "grpc_asyncio"): client = DataTransferServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5120,7 +5156,7 @@ async def test_delete_destination_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( @@ -5142,11 +5178,6 @@ async def test_delete_destination_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_destination_async_from_dict(): - await test_delete_destination_async(request_type=dict) - - def test_delete_destination_field_headers(): client = DataTransferServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5301,8 +5332,8 @@ async def test_delete_destination_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_transfer.GetMulticloudDataTransferSupportedServiceRequest, - dict, + data_transfer.GetMulticloudDataTransferSupportedServiceRequest(), + {}, ], ) def test_get_multicloud_data_transfer_supported_service( @@ -5315,7 +5346,7 @@ def test_get_multicloud_data_transfer_supported_service( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5365,11 +5396,10 @@ def test_get_multicloud_data_transfer_supported_service_non_empty_request_with_a client.get_multicloud_data_transfer_supported_service(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == data_transfer.GetMulticloudDataTransferSupportedServiceRequest( + request_msg = data_transfer.GetMulticloudDataTransferSupportedServiceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_multicloud_data_transfer_supported_service_use_cached_wrapped_rpc(): @@ -5455,9 +5485,15 @@ async def test_get_multicloud_data_transfer_supported_service_async_use_cached_w @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_transfer.GetMulticloudDataTransferSupportedServiceRequest(), + {}, + ], +) async def test_get_multicloud_data_transfer_supported_service_async( - transport: str = "grpc_asyncio", - request_type=data_transfer.GetMulticloudDataTransferSupportedServiceRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataTransferServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5466,7 +5502,7 @@ async def test_get_multicloud_data_transfer_supported_service_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( @@ -5492,11 +5528,6 @@ async def test_get_multicloud_data_transfer_supported_service_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_multicloud_data_transfer_supported_service_async_from_dict(): - await test_get_multicloud_data_transfer_supported_service_async(request_type=dict) - - def test_get_multicloud_data_transfer_supported_service_field_headers(): client = DataTransferServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5655,8 +5686,8 @@ async def test_get_multicloud_data_transfer_supported_service_flattened_error_as @pytest.mark.parametrize( "request_type", [ - data_transfer.ListMulticloudDataTransferSupportedServicesRequest, - dict, + data_transfer.ListMulticloudDataTransferSupportedServicesRequest(), + {}, ], ) def test_list_multicloud_data_transfer_supported_services( @@ -5669,7 +5700,7 @@ def test_list_multicloud_data_transfer_supported_services( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5722,12 +5753,11 @@ def test_list_multicloud_data_transfer_supported_services_non_empty_request_with client.list_multicloud_data_transfer_supported_services(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == data_transfer.ListMulticloudDataTransferSupportedServicesRequest( + request_msg = data_transfer.ListMulticloudDataTransferSupportedServicesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_multicloud_data_transfer_supported_services_use_cached_wrapped_rpc(): @@ -5813,9 +5843,15 @@ async def test_list_multicloud_data_transfer_supported_services_async_use_cached @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_transfer.ListMulticloudDataTransferSupportedServicesRequest(), + {}, + ], +) async def test_list_multicloud_data_transfer_supported_services_async( - transport: str = "grpc_asyncio", - request_type=data_transfer.ListMulticloudDataTransferSupportedServicesRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataTransferServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5824,7 +5860,7 @@ async def test_list_multicloud_data_transfer_supported_services_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( @@ -5854,11 +5890,6 @@ async def test_list_multicloud_data_transfer_supported_services_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_multicloud_data_transfer_supported_services_async_from_dict(): - await test_list_multicloud_data_transfer_supported_services_async(request_type=dict) - - def test_list_multicloud_data_transfer_supported_services_field_headers(): client = DataTransferServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6360,7 +6391,6 @@ def test_list_multicloud_data_transfer_configs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_transfer.ListMulticloudDataTransferConfigsRequest() - assert args[0] == request_msg @@ -6383,7 +6413,6 @@ def test_get_multicloud_data_transfer_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_transfer.GetMulticloudDataTransferConfigRequest() - assert args[0] == request_msg @@ -6406,7 +6435,6 @@ def test_create_multicloud_data_transfer_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_transfer.CreateMulticloudDataTransferConfigRequest() - assert args[0] == request_msg @@ -6429,7 +6457,6 @@ def test_update_multicloud_data_transfer_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_transfer.UpdateMulticloudDataTransferConfigRequest() - assert args[0] == request_msg @@ -6452,7 +6479,6 @@ def test_delete_multicloud_data_transfer_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_transfer.DeleteMulticloudDataTransferConfigRequest() - assert args[0] == request_msg @@ -6475,7 +6501,6 @@ def test_list_destinations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_transfer.ListDestinationsRequest() - assert args[0] == request_msg @@ -6496,7 +6521,6 @@ def test_get_destination_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_transfer.GetDestinationRequest() - assert args[0] == request_msg @@ -6519,7 +6543,6 @@ def test_create_destination_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_transfer.CreateDestinationRequest() - assert args[0] == request_msg @@ -6542,7 +6565,6 @@ def test_update_destination_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_transfer.UpdateDestinationRequest() - assert args[0] == request_msg @@ -6565,7 +6587,6 @@ def test_delete_destination_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_transfer.DeleteDestinationRequest() - assert args[0] == request_msg @@ -6589,7 +6610,6 @@ def test_get_multicloud_data_transfer_supported_service_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_transfer.GetMulticloudDataTransferSupportedServiceRequest() - assert args[0] == request_msg @@ -6615,7 +6635,6 @@ def test_list_multicloud_data_transfer_supported_services_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_transfer.ListMulticloudDataTransferSupportedServicesRequest() - assert args[0] == request_msg @@ -6659,7 +6678,6 @@ async def test_list_multicloud_data_transfer_configs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_transfer.ListMulticloudDataTransferConfigsRequest() - assert args[0] == request_msg @@ -6693,7 +6711,6 @@ async def test_get_multicloud_data_transfer_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_transfer.GetMulticloudDataTransferConfigRequest() - assert args[0] == request_msg @@ -6720,7 +6737,6 @@ async def test_create_multicloud_data_transfer_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_transfer.CreateMulticloudDataTransferConfigRequest() - assert args[0] == request_msg @@ -6747,7 +6763,6 @@ async def test_update_multicloud_data_transfer_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_transfer.UpdateMulticloudDataTransferConfigRequest() - assert args[0] == request_msg @@ -6774,7 +6789,6 @@ async def test_delete_multicloud_data_transfer_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_transfer.DeleteMulticloudDataTransferConfigRequest() - assert args[0] == request_msg @@ -6804,7 +6818,6 @@ async def test_list_destinations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_transfer.ListDestinationsRequest() - assert args[0] == request_msg @@ -6835,7 +6848,6 @@ async def test_get_destination_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_transfer.GetDestinationRequest() - assert args[0] == request_msg @@ -6862,7 +6874,6 @@ async def test_create_destination_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_transfer.CreateDestinationRequest() - assert args[0] == request_msg @@ -6889,7 +6900,6 @@ async def test_update_destination_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_transfer.UpdateDestinationRequest() - assert args[0] == request_msg @@ -6916,7 +6926,6 @@ async def test_delete_destination_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_transfer.DeleteDestinationRequest() - assert args[0] == request_msg @@ -6946,7 +6955,6 @@ async def test_get_multicloud_data_transfer_supported_service_empty_call_grpc_as call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_transfer.GetMulticloudDataTransferSupportedServiceRequest() - assert args[0] == request_msg @@ -6976,7 +6984,6 @@ async def test_list_multicloud_data_transfer_supported_services_empty_call_grpc_ call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_transfer.ListMulticloudDataTransferSupportedServicesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-network-connectivity/tests/unit/gapic/networkconnectivity_v1/test_hub_service.py b/packages/google-cloud-network-connectivity/tests/unit/gapic/networkconnectivity_v1/test_hub_service.py index 682949153182..104bb8c11b14 100644 --- a/packages/google-cloud-network-connectivity/tests/unit/gapic/networkconnectivity_v1/test_hub_service.py +++ b/packages/google-cloud-network-connectivity/tests/unit/gapic/networkconnectivity_v1/test_hub_service.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 @@ -119,6 +120,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" @@ -1263,8 +1279,8 @@ def test_hub_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - hub.ListHubsRequest, - dict, + hub.ListHubsRequest(), + {}, ], ) def test_list_hubs(request_type, transport: str = "grpc"): @@ -1275,7 +1291,7 @@ def test_list_hubs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_hubs), "__call__") as call: @@ -1324,12 +1340,13 @@ def test_list_hubs_non_empty_request_with_auto_populated_field(): client.list_hubs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hub.ListHubsRequest( + request_msg = hub.ListHubsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_hubs_use_cached_wrapped_rpc(): @@ -1408,9 +1425,14 @@ async def test_list_hubs_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_list_hubs_async( - transport: str = "grpc_asyncio", request_type=hub.ListHubsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + hub.ListHubsRequest(), + {}, + ], +) +async def test_list_hubs_async(request_type, transport: str = "grpc_asyncio"): client = HubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1418,7 +1440,7 @@ async def test_list_hubs_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_hubs), "__call__") as call: @@ -1443,11 +1465,6 @@ async def test_list_hubs_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_hubs_async_from_dict(): - await test_list_hubs_async(request_type=dict) - - def test_list_hubs_field_headers(): client = HubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1784,8 +1801,8 @@ async def test_list_hubs_async_pages(): @pytest.mark.parametrize( "request_type", [ - hub.GetHubRequest, - dict, + hub.GetHubRequest(), + {}, ], ) def test_get_hub(request_type, transport: str = "grpc"): @@ -1796,7 +1813,7 @@ def test_get_hub(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_hub), "__call__") as call: @@ -1854,9 +1871,10 @@ def test_get_hub_non_empty_request_with_auto_populated_field(): client.get_hub(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hub.GetHubRequest( + request_msg = hub.GetHubRequest( name="name_value", ) + assert args[0] == request_msg def test_get_hub_use_cached_wrapped_rpc(): @@ -1935,9 +1953,14 @@ async def test_get_hub_async_use_cached_wrapped_rpc(transport: str = "grpc_async @pytest.mark.asyncio -async def test_get_hub_async( - transport: str = "grpc_asyncio", request_type=hub.GetHubRequest -): +@pytest.mark.parametrize( + "request_type", + [ + hub.GetHubRequest(), + {}, + ], +) +async def test_get_hub_async(request_type, transport: str = "grpc_asyncio"): client = HubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1945,7 +1968,7 @@ async def test_get_hub_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_hub), "__call__") as call: @@ -1982,11 +2005,6 @@ async def test_get_hub_async( assert response.export_psc is True -@pytest.mark.asyncio -async def test_get_hub_async_from_dict(): - await test_get_hub_async(request_type=dict) - - def test_get_hub_field_headers(): client = HubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2129,8 +2147,8 @@ async def test_get_hub_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_hub.CreateHubRequest, - dict, + gcn_hub.CreateHubRequest(), + {}, ], ) def test_create_hub(request_type, transport: str = "grpc"): @@ -2141,7 +2159,7 @@ def test_create_hub(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_hub), "__call__") as call: @@ -2184,11 +2202,12 @@ def test_create_hub_non_empty_request_with_auto_populated_field(): client.create_hub(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_hub.CreateHubRequest( + request_msg = gcn_hub.CreateHubRequest( parent="parent_value", hub_id="hub_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_hub_use_cached_wrapped_rpc(): @@ -2277,9 +2296,14 @@ async def test_create_hub_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_create_hub_async( - transport: str = "grpc_asyncio", request_type=gcn_hub.CreateHubRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcn_hub.CreateHubRequest(), + {}, + ], +) +async def test_create_hub_async(request_type, transport: str = "grpc_asyncio"): client = HubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2287,7 +2311,7 @@ async def test_create_hub_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_hub), "__call__") as call: @@ -2307,11 +2331,6 @@ async def test_create_hub_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_hub_async_from_dict(): - await test_create_hub_async(request_type=dict) - - def test_create_hub_field_headers(): client = HubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2478,8 +2497,8 @@ async def test_create_hub_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_hub.UpdateHubRequest, - dict, + gcn_hub.UpdateHubRequest(), + {}, ], ) def test_update_hub(request_type, transport: str = "grpc"): @@ -2490,7 +2509,7 @@ def test_update_hub(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_hub), "__call__") as call: @@ -2531,9 +2550,10 @@ def test_update_hub_non_empty_request_with_auto_populated_field(): client.update_hub(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_hub.UpdateHubRequest( + request_msg = gcn_hub.UpdateHubRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_hub_use_cached_wrapped_rpc(): @@ -2622,9 +2642,14 @@ async def test_update_hub_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_update_hub_async( - transport: str = "grpc_asyncio", request_type=gcn_hub.UpdateHubRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcn_hub.UpdateHubRequest(), + {}, + ], +) +async def test_update_hub_async(request_type, transport: str = "grpc_asyncio"): client = HubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2632,7 +2657,7 @@ async def test_update_hub_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_hub), "__call__") as call: @@ -2652,11 +2677,6 @@ async def test_update_hub_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_hub_async_from_dict(): - await test_update_hub_async(request_type=dict) - - def test_update_hub_field_headers(): client = HubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2813,8 +2833,8 @@ async def test_update_hub_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - hub.DeleteHubRequest, - dict, + hub.DeleteHubRequest(), + {}, ], ) def test_delete_hub(request_type, transport: str = "grpc"): @@ -2825,7 +2845,7 @@ def test_delete_hub(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_hub), "__call__") as call: @@ -2867,10 +2887,11 @@ def test_delete_hub_non_empty_request_with_auto_populated_field(): client.delete_hub(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hub.DeleteHubRequest( + request_msg = hub.DeleteHubRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_hub_use_cached_wrapped_rpc(): @@ -2959,9 +2980,14 @@ async def test_delete_hub_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_delete_hub_async( - transport: str = "grpc_asyncio", request_type=hub.DeleteHubRequest -): +@pytest.mark.parametrize( + "request_type", + [ + hub.DeleteHubRequest(), + {}, + ], +) +async def test_delete_hub_async(request_type, transport: str = "grpc_asyncio"): client = HubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2969,7 +2995,7 @@ async def test_delete_hub_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_hub), "__call__") as call: @@ -2989,11 +3015,6 @@ async def test_delete_hub_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_hub_async_from_dict(): - await test_delete_hub_async(request_type=dict) - - def test_delete_hub_field_headers(): client = HubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3140,8 +3161,8 @@ async def test_delete_hub_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - hub.ListHubSpokesRequest, - dict, + hub.ListHubSpokesRequest(), + {}, ], ) def test_list_hub_spokes(request_type, transport: str = "grpc"): @@ -3152,7 +3173,7 @@ def test_list_hub_spokes(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_hub_spokes), "__call__") as call: @@ -3201,12 +3222,13 @@ def test_list_hub_spokes_non_empty_request_with_auto_populated_field(): client.list_hub_spokes(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hub.ListHubSpokesRequest( + request_msg = hub.ListHubSpokesRequest( name="name_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_hub_spokes_use_cached_wrapped_rpc(): @@ -3287,9 +3309,14 @@ async def test_list_hub_spokes_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_hub_spokes_async( - transport: str = "grpc_asyncio", request_type=hub.ListHubSpokesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + hub.ListHubSpokesRequest(), + {}, + ], +) +async def test_list_hub_spokes_async(request_type, transport: str = "grpc_asyncio"): client = HubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3297,7 +3324,7 @@ async def test_list_hub_spokes_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_hub_spokes), "__call__") as call: @@ -3322,11 +3349,6 @@ async def test_list_hub_spokes_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_hub_spokes_async_from_dict(): - await test_list_hub_spokes_async(request_type=dict) - - def test_list_hub_spokes_field_headers(): client = HubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3663,8 +3685,8 @@ async def test_list_hub_spokes_async_pages(): @pytest.mark.parametrize( "request_type", [ - hub.QueryHubStatusRequest, - dict, + hub.QueryHubStatusRequest(), + {}, ], ) def test_query_hub_status(request_type, transport: str = "grpc"): @@ -3675,7 +3697,7 @@ def test_query_hub_status(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.query_hub_status), "__call__") as call: @@ -3723,13 +3745,14 @@ def test_query_hub_status_non_empty_request_with_auto_populated_field(): client.query_hub_status(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hub.QueryHubStatusRequest( + request_msg = hub.QueryHubStatusRequest( name="name_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", group_by="group_by_value", ) + assert args[0] == request_msg def test_query_hub_status_use_cached_wrapped_rpc(): @@ -3812,9 +3835,14 @@ async def test_query_hub_status_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_query_hub_status_async( - transport: str = "grpc_asyncio", request_type=hub.QueryHubStatusRequest -): +@pytest.mark.parametrize( + "request_type", + [ + hub.QueryHubStatusRequest(), + {}, + ], +) +async def test_query_hub_status_async(request_type, transport: str = "grpc_asyncio"): client = HubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3822,7 +3850,7 @@ async def test_query_hub_status_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.query_hub_status), "__call__") as call: @@ -3845,11 +3873,6 @@ async def test_query_hub_status_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_query_hub_status_async_from_dict(): - await test_query_hub_status_async(request_type=dict) - - def test_query_hub_status_field_headers(): client = HubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4186,8 +4209,8 @@ async def test_query_hub_status_async_pages(): @pytest.mark.parametrize( "request_type", [ - hub.ListSpokesRequest, - dict, + hub.ListSpokesRequest(), + {}, ], ) def test_list_spokes(request_type, transport: str = "grpc"): @@ -4198,7 +4221,7 @@ def test_list_spokes(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_spokes), "__call__") as call: @@ -4247,12 +4270,13 @@ def test_list_spokes_non_empty_request_with_auto_populated_field(): client.list_spokes(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hub.ListSpokesRequest( + request_msg = hub.ListSpokesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_spokes_use_cached_wrapped_rpc(): @@ -4333,9 +4357,14 @@ async def test_list_spokes_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_spokes_async( - transport: str = "grpc_asyncio", request_type=hub.ListSpokesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + hub.ListSpokesRequest(), + {}, + ], +) +async def test_list_spokes_async(request_type, transport: str = "grpc_asyncio"): client = HubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4343,7 +4372,7 @@ async def test_list_spokes_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_spokes), "__call__") as call: @@ -4368,11 +4397,6 @@ async def test_list_spokes_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_spokes_async_from_dict(): - await test_list_spokes_async(request_type=dict) - - def test_list_spokes_field_headers(): client = HubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4709,8 +4733,8 @@ async def test_list_spokes_async_pages(): @pytest.mark.parametrize( "request_type", [ - hub.GetSpokeRequest, - dict, + hub.GetSpokeRequest(), + {}, ], ) def test_get_spoke(request_type, transport: str = "grpc"): @@ -4721,7 +4745,7 @@ def test_get_spoke(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_spoke), "__call__") as call: @@ -4781,9 +4805,10 @@ def test_get_spoke_non_empty_request_with_auto_populated_field(): client.get_spoke(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hub.GetSpokeRequest( + request_msg = hub.GetSpokeRequest( name="name_value", ) + assert args[0] == request_msg def test_get_spoke_use_cached_wrapped_rpc(): @@ -4862,9 +4887,14 @@ async def test_get_spoke_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_spoke_async( - transport: str = "grpc_asyncio", request_type=hub.GetSpokeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + hub.GetSpokeRequest(), + {}, + ], +) +async def test_get_spoke_async(request_type, transport: str = "grpc_asyncio"): client = HubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4872,7 +4902,7 @@ async def test_get_spoke_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_spoke), "__call__") as call: @@ -4911,11 +4941,6 @@ async def test_get_spoke_async( assert response.field_paths_pending_update == ["field_paths_pending_update_value"] -@pytest.mark.asyncio -async def test_get_spoke_async_from_dict(): - await test_get_spoke_async(request_type=dict) - - def test_get_spoke_field_headers(): client = HubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5058,8 +5083,8 @@ async def test_get_spoke_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - hub.CreateSpokeRequest, - dict, + hub.CreateSpokeRequest(), + {}, ], ) def test_create_spoke(request_type, transport: str = "grpc"): @@ -5070,7 +5095,7 @@ def test_create_spoke(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_spoke), "__call__") as call: @@ -5113,11 +5138,12 @@ def test_create_spoke_non_empty_request_with_auto_populated_field(): client.create_spoke(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hub.CreateSpokeRequest( + request_msg = hub.CreateSpokeRequest( parent="parent_value", spoke_id="spoke_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_spoke_use_cached_wrapped_rpc(): @@ -5208,9 +5234,14 @@ async def test_create_spoke_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_spoke_async( - transport: str = "grpc_asyncio", request_type=hub.CreateSpokeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + hub.CreateSpokeRequest(), + {}, + ], +) +async def test_create_spoke_async(request_type, transport: str = "grpc_asyncio"): client = HubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5218,7 +5249,7 @@ async def test_create_spoke_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_spoke), "__call__") as call: @@ -5238,11 +5269,6 @@ async def test_create_spoke_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_spoke_async_from_dict(): - await test_create_spoke_async(request_type=dict) - - def test_create_spoke_field_headers(): client = HubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5409,8 +5435,8 @@ async def test_create_spoke_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - hub.UpdateSpokeRequest, - dict, + hub.UpdateSpokeRequest(), + {}, ], ) def test_update_spoke(request_type, transport: str = "grpc"): @@ -5421,7 +5447,7 @@ def test_update_spoke(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_spoke), "__call__") as call: @@ -5462,9 +5488,10 @@ def test_update_spoke_non_empty_request_with_auto_populated_field(): client.update_spoke(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hub.UpdateSpokeRequest( + request_msg = hub.UpdateSpokeRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_spoke_use_cached_wrapped_rpc(): @@ -5555,9 +5582,14 @@ async def test_update_spoke_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_spoke_async( - transport: str = "grpc_asyncio", request_type=hub.UpdateSpokeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + hub.UpdateSpokeRequest(), + {}, + ], +) +async def test_update_spoke_async(request_type, transport: str = "grpc_asyncio"): client = HubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5565,7 +5597,7 @@ async def test_update_spoke_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_spoke), "__call__") as call: @@ -5585,11 +5617,6 @@ async def test_update_spoke_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_spoke_async_from_dict(): - await test_update_spoke_async(request_type=dict) - - def test_update_spoke_field_headers(): client = HubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5746,8 +5773,8 @@ async def test_update_spoke_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - hub.RejectHubSpokeRequest, - dict, + hub.RejectHubSpokeRequest(), + {}, ], ) def test_reject_hub_spoke(request_type, transport: str = "grpc"): @@ -5758,7 +5785,7 @@ def test_reject_hub_spoke(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.reject_hub_spoke), "__call__") as call: @@ -5802,12 +5829,13 @@ def test_reject_hub_spoke_non_empty_request_with_auto_populated_field(): client.reject_hub_spoke(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hub.RejectHubSpokeRequest( + request_msg = hub.RejectHubSpokeRequest( name="name_value", spoke_uri="spoke_uri_value", request_id="request_id_value", details="details_value", ) + assert args[0] == request_msg def test_reject_hub_spoke_use_cached_wrapped_rpc(): @@ -5900,9 +5928,14 @@ async def test_reject_hub_spoke_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_reject_hub_spoke_async( - transport: str = "grpc_asyncio", request_type=hub.RejectHubSpokeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + hub.RejectHubSpokeRequest(), + {}, + ], +) +async def test_reject_hub_spoke_async(request_type, transport: str = "grpc_asyncio"): client = HubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5910,7 +5943,7 @@ async def test_reject_hub_spoke_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.reject_hub_spoke), "__call__") as call: @@ -5930,11 +5963,6 @@ async def test_reject_hub_spoke_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_reject_hub_spoke_async_from_dict(): - await test_reject_hub_spoke_async(request_type=dict) - - def test_reject_hub_spoke_field_headers(): client = HubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6091,8 +6119,8 @@ async def test_reject_hub_spoke_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - hub.AcceptHubSpokeRequest, - dict, + hub.AcceptHubSpokeRequest(), + {}, ], ) def test_accept_hub_spoke(request_type, transport: str = "grpc"): @@ -6103,7 +6131,7 @@ def test_accept_hub_spoke(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.accept_hub_spoke), "__call__") as call: @@ -6146,11 +6174,12 @@ def test_accept_hub_spoke_non_empty_request_with_auto_populated_field(): client.accept_hub_spoke(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hub.AcceptHubSpokeRequest( + request_msg = hub.AcceptHubSpokeRequest( name="name_value", spoke_uri="spoke_uri_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_accept_hub_spoke_use_cached_wrapped_rpc(): @@ -6243,9 +6272,14 @@ async def test_accept_hub_spoke_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_accept_hub_spoke_async( - transport: str = "grpc_asyncio", request_type=hub.AcceptHubSpokeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + hub.AcceptHubSpokeRequest(), + {}, + ], +) +async def test_accept_hub_spoke_async(request_type, transport: str = "grpc_asyncio"): client = HubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6253,7 +6287,7 @@ async def test_accept_hub_spoke_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.accept_hub_spoke), "__call__") as call: @@ -6273,11 +6307,6 @@ async def test_accept_hub_spoke_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_accept_hub_spoke_async_from_dict(): - await test_accept_hub_spoke_async(request_type=dict) - - def test_accept_hub_spoke_field_headers(): client = HubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6434,8 +6463,8 @@ async def test_accept_hub_spoke_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - hub.AcceptSpokeUpdateRequest, - dict, + hub.AcceptSpokeUpdateRequest(), + {}, ], ) def test_accept_spoke_update(request_type, transport: str = "grpc"): @@ -6446,7 +6475,7 @@ def test_accept_spoke_update(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6493,11 +6522,12 @@ def test_accept_spoke_update_non_empty_request_with_auto_populated_field(): client.accept_spoke_update(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hub.AcceptSpokeUpdateRequest( + request_msg = hub.AcceptSpokeUpdateRequest( name="name_value", spoke_uri="spoke_uri_value", spoke_etag="spoke_etag_value", ) + assert args[0] == request_msg def test_accept_spoke_update_use_cached_wrapped_rpc(): @@ -6592,9 +6622,14 @@ async def test_accept_spoke_update_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_accept_spoke_update_async( - transport: str = "grpc_asyncio", request_type=hub.AcceptSpokeUpdateRequest -): +@pytest.mark.parametrize( + "request_type", + [ + hub.AcceptSpokeUpdateRequest(), + {}, + ], +) +async def test_accept_spoke_update_async(request_type, transport: str = "grpc_asyncio"): client = HubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6602,7 +6637,7 @@ async def test_accept_spoke_update_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( @@ -6624,11 +6659,6 @@ async def test_accept_spoke_update_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_accept_spoke_update_async_from_dict(): - await test_accept_spoke_update_async(request_type=dict) - - def test_accept_spoke_update_field_headers(): client = HubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6803,8 +6833,8 @@ async def test_accept_spoke_update_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - hub.RejectSpokeUpdateRequest, - dict, + hub.RejectSpokeUpdateRequest(), + {}, ], ) def test_reject_spoke_update(request_type, transport: str = "grpc"): @@ -6815,7 +6845,7 @@ def test_reject_spoke_update(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6863,12 +6893,13 @@ def test_reject_spoke_update_non_empty_request_with_auto_populated_field(): client.reject_spoke_update(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hub.RejectSpokeUpdateRequest( + request_msg = hub.RejectSpokeUpdateRequest( name="name_value", spoke_uri="spoke_uri_value", spoke_etag="spoke_etag_value", details="details_value", ) + assert args[0] == request_msg def test_reject_spoke_update_use_cached_wrapped_rpc(): @@ -6963,9 +6994,14 @@ async def test_reject_spoke_update_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_reject_spoke_update_async( - transport: str = "grpc_asyncio", request_type=hub.RejectSpokeUpdateRequest -): +@pytest.mark.parametrize( + "request_type", + [ + hub.RejectSpokeUpdateRequest(), + {}, + ], +) +async def test_reject_spoke_update_async(request_type, transport: str = "grpc_asyncio"): client = HubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6973,7 +7009,7 @@ async def test_reject_spoke_update_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( @@ -6995,11 +7031,6 @@ async def test_reject_spoke_update_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_reject_spoke_update_async_from_dict(): - await test_reject_spoke_update_async(request_type=dict) - - def test_reject_spoke_update_field_headers(): client = HubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7174,8 +7205,8 @@ async def test_reject_spoke_update_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - hub.DeleteSpokeRequest, - dict, + hub.DeleteSpokeRequest(), + {}, ], ) def test_delete_spoke(request_type, transport: str = "grpc"): @@ -7186,7 +7217,7 @@ def test_delete_spoke(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_spoke), "__call__") as call: @@ -7228,10 +7259,11 @@ def test_delete_spoke_non_empty_request_with_auto_populated_field(): client.delete_spoke(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hub.DeleteSpokeRequest( + request_msg = hub.DeleteSpokeRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_spoke_use_cached_wrapped_rpc(): @@ -7322,9 +7354,14 @@ async def test_delete_spoke_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_spoke_async( - transport: str = "grpc_asyncio", request_type=hub.DeleteSpokeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + hub.DeleteSpokeRequest(), + {}, + ], +) +async def test_delete_spoke_async(request_type, transport: str = "grpc_asyncio"): client = HubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7332,7 +7369,7 @@ async def test_delete_spoke_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_spoke), "__call__") as call: @@ -7352,11 +7389,6 @@ async def test_delete_spoke_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_spoke_async_from_dict(): - await test_delete_spoke_async(request_type=dict) - - def test_delete_spoke_field_headers(): client = HubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7503,8 +7535,8 @@ async def test_delete_spoke_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - hub.GetRouteTableRequest, - dict, + hub.GetRouteTableRequest(), + {}, ], ) def test_get_route_table(request_type, transport: str = "grpc"): @@ -7515,7 +7547,7 @@ def test_get_route_table(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_route_table), "__call__") as call: @@ -7565,9 +7597,10 @@ def test_get_route_table_non_empty_request_with_auto_populated_field(): client.get_route_table(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hub.GetRouteTableRequest( + request_msg = hub.GetRouteTableRequest( name="name_value", ) + assert args[0] == request_msg def test_get_route_table_use_cached_wrapped_rpc(): @@ -7648,9 +7681,14 @@ async def test_get_route_table_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_route_table_async( - transport: str = "grpc_asyncio", request_type=hub.GetRouteTableRequest -): +@pytest.mark.parametrize( + "request_type", + [ + hub.GetRouteTableRequest(), + {}, + ], +) +async def test_get_route_table_async(request_type, transport: str = "grpc_asyncio"): client = HubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7658,7 +7696,7 @@ async def test_get_route_table_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_route_table), "__call__") as call: @@ -7687,11 +7725,6 @@ async def test_get_route_table_async( assert response.state == hub.State.CREATING -@pytest.mark.asyncio -async def test_get_route_table_async_from_dict(): - await test_get_route_table_async(request_type=dict) - - def test_get_route_table_field_headers(): client = HubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7834,8 +7867,8 @@ async def test_get_route_table_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - hub.GetRouteRequest, - dict, + hub.GetRouteRequest(), + {}, ], ) def test_get_route(request_type, transport: str = "grpc"): @@ -7846,7 +7879,7 @@ def test_get_route(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_route), "__call__") as call: @@ -7906,9 +7939,10 @@ def test_get_route_non_empty_request_with_auto_populated_field(): client.get_route(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hub.GetRouteRequest( + request_msg = hub.GetRouteRequest( name="name_value", ) + assert args[0] == request_msg def test_get_route_use_cached_wrapped_rpc(): @@ -7987,9 +8021,14 @@ async def test_get_route_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_route_async( - transport: str = "grpc_asyncio", request_type=hub.GetRouteRequest -): +@pytest.mark.parametrize( + "request_type", + [ + hub.GetRouteRequest(), + {}, + ], +) +async def test_get_route_async(request_type, transport: str = "grpc_asyncio"): client = HubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7997,7 +8036,7 @@ async def test_get_route_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_route), "__call__") as call: @@ -8036,11 +8075,6 @@ async def test_get_route_async( assert response.priority == 898 -@pytest.mark.asyncio -async def test_get_route_async_from_dict(): - await test_get_route_async(request_type=dict) - - def test_get_route_field_headers(): client = HubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8183,8 +8217,8 @@ async def test_get_route_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - hub.ListRoutesRequest, - dict, + hub.ListRoutesRequest(), + {}, ], ) def test_list_routes(request_type, transport: str = "grpc"): @@ -8195,7 +8229,7 @@ def test_list_routes(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_routes), "__call__") as call: @@ -8244,12 +8278,13 @@ def test_list_routes_non_empty_request_with_auto_populated_field(): client.list_routes(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hub.ListRoutesRequest( + request_msg = hub.ListRoutesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_routes_use_cached_wrapped_rpc(): @@ -8330,9 +8365,14 @@ async def test_list_routes_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_routes_async( - transport: str = "grpc_asyncio", request_type=hub.ListRoutesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + hub.ListRoutesRequest(), + {}, + ], +) +async def test_list_routes_async(request_type, transport: str = "grpc_asyncio"): client = HubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8340,7 +8380,7 @@ async def test_list_routes_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_routes), "__call__") as call: @@ -8365,11 +8405,6 @@ async def test_list_routes_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_routes_async_from_dict(): - await test_list_routes_async(request_type=dict) - - def test_list_routes_field_headers(): client = HubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8706,8 +8741,8 @@ async def test_list_routes_async_pages(): @pytest.mark.parametrize( "request_type", [ - hub.ListRouteTablesRequest, - dict, + hub.ListRouteTablesRequest(), + {}, ], ) def test_list_route_tables(request_type, transport: str = "grpc"): @@ -8718,7 +8753,7 @@ def test_list_route_tables(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8771,12 +8806,13 @@ def test_list_route_tables_non_empty_request_with_auto_populated_field(): client.list_route_tables(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hub.ListRouteTablesRequest( + request_msg = hub.ListRouteTablesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_route_tables_use_cached_wrapped_rpc(): @@ -8859,9 +8895,14 @@ async def test_list_route_tables_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_route_tables_async( - transport: str = "grpc_asyncio", request_type=hub.ListRouteTablesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + hub.ListRouteTablesRequest(), + {}, + ], +) +async def test_list_route_tables_async(request_type, transport: str = "grpc_asyncio"): client = HubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8869,7 +8910,7 @@ async def test_list_route_tables_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( @@ -8896,11 +8937,6 @@ async def test_list_route_tables_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_route_tables_async_from_dict(): - await test_list_route_tables_async(request_type=dict) - - def test_list_route_tables_field_headers(): client = HubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9253,8 +9289,8 @@ async def test_list_route_tables_async_pages(): @pytest.mark.parametrize( "request_type", [ - hub.GetGroupRequest, - dict, + hub.GetGroupRequest(), + {}, ], ) def test_get_group(request_type, transport: str = "grpc"): @@ -9265,7 +9301,7 @@ def test_get_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_group), "__call__") as call: @@ -9317,9 +9353,10 @@ def test_get_group_non_empty_request_with_auto_populated_field(): client.get_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hub.GetGroupRequest( + request_msg = hub.GetGroupRequest( name="name_value", ) + assert args[0] == request_msg def test_get_group_use_cached_wrapped_rpc(): @@ -9398,9 +9435,14 @@ async def test_get_group_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_group_async( - transport: str = "grpc_asyncio", request_type=hub.GetGroupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + hub.GetGroupRequest(), + {}, + ], +) +async def test_get_group_async(request_type, transport: str = "grpc_asyncio"): client = HubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9408,7 +9450,7 @@ async def test_get_group_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_group), "__call__") as call: @@ -9439,11 +9481,6 @@ async def test_get_group_async( assert response.route_table == "route_table_value" -@pytest.mark.asyncio -async def test_get_group_async_from_dict(): - await test_get_group_async(request_type=dict) - - def test_get_group_field_headers(): client = HubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9586,8 +9623,8 @@ async def test_get_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - hub.ListGroupsRequest, - dict, + hub.ListGroupsRequest(), + {}, ], ) def test_list_groups(request_type, transport: str = "grpc"): @@ -9598,7 +9635,7 @@ def test_list_groups(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_groups), "__call__") as call: @@ -9647,12 +9684,13 @@ def test_list_groups_non_empty_request_with_auto_populated_field(): client.list_groups(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hub.ListGroupsRequest( + request_msg = hub.ListGroupsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_groups_use_cached_wrapped_rpc(): @@ -9733,9 +9771,14 @@ async def test_list_groups_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_groups_async( - transport: str = "grpc_asyncio", request_type=hub.ListGroupsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + hub.ListGroupsRequest(), + {}, + ], +) +async def test_list_groups_async(request_type, transport: str = "grpc_asyncio"): client = HubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9743,7 +9786,7 @@ async def test_list_groups_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_groups), "__call__") as call: @@ -9768,11 +9811,6 @@ async def test_list_groups_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_groups_async_from_dict(): - await test_list_groups_async(request_type=dict) - - def test_list_groups_field_headers(): client = HubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10109,8 +10147,8 @@ async def test_list_groups_async_pages(): @pytest.mark.parametrize( "request_type", [ - hub.UpdateGroupRequest, - dict, + hub.UpdateGroupRequest(), + {}, ], ) def test_update_group(request_type, transport: str = "grpc"): @@ -10121,7 +10159,7 @@ def test_update_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_group), "__call__") as call: @@ -10162,9 +10200,10 @@ def test_update_group_non_empty_request_with_auto_populated_field(): client.update_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hub.UpdateGroupRequest( + request_msg = hub.UpdateGroupRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_group_use_cached_wrapped_rpc(): @@ -10255,9 +10294,14 @@ async def test_update_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_group_async( - transport: str = "grpc_asyncio", request_type=hub.UpdateGroupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + hub.UpdateGroupRequest(), + {}, + ], +) +async def test_update_group_async(request_type, transport: str = "grpc_asyncio"): client = HubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10265,7 +10309,7 @@ async def test_update_group_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_group), "__call__") as call: @@ -10285,11 +10329,6 @@ async def test_update_group_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_group_async_from_dict(): - await test_update_group_async(request_type=dict) - - def test_update_group_field_headers(): client = HubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10565,7 +10604,6 @@ def test_list_hubs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.ListHubsRequest() - assert args[0] == request_msg @@ -10586,7 +10624,6 @@ def test_get_hub_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.GetHubRequest() - assert args[0] == request_msg @@ -10607,7 +10644,6 @@ def test_create_hub_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_hub.CreateHubRequest() - assert args[0] == request_msg @@ -10628,7 +10664,6 @@ def test_update_hub_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_hub.UpdateHubRequest() - assert args[0] == request_msg @@ -10649,7 +10684,6 @@ def test_delete_hub_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.DeleteHubRequest() - assert args[0] == request_msg @@ -10670,7 +10704,6 @@ def test_list_hub_spokes_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.ListHubSpokesRequest() - assert args[0] == request_msg @@ -10691,7 +10724,6 @@ def test_query_hub_status_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.QueryHubStatusRequest() - assert args[0] == request_msg @@ -10712,7 +10744,6 @@ def test_list_spokes_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.ListSpokesRequest() - assert args[0] == request_msg @@ -10733,7 +10764,6 @@ def test_get_spoke_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.GetSpokeRequest() - assert args[0] == request_msg @@ -10754,7 +10784,6 @@ def test_create_spoke_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.CreateSpokeRequest() - assert args[0] == request_msg @@ -10775,7 +10804,6 @@ def test_update_spoke_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.UpdateSpokeRequest() - assert args[0] == request_msg @@ -10796,7 +10824,6 @@ def test_reject_hub_spoke_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.RejectHubSpokeRequest() - assert args[0] == request_msg @@ -10817,7 +10844,6 @@ def test_accept_hub_spoke_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.AcceptHubSpokeRequest() - assert args[0] == request_msg @@ -10840,7 +10866,6 @@ def test_accept_spoke_update_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.AcceptSpokeUpdateRequest() - assert args[0] == request_msg @@ -10863,7 +10888,6 @@ def test_reject_spoke_update_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.RejectSpokeUpdateRequest() - assert args[0] == request_msg @@ -10884,7 +10908,6 @@ def test_delete_spoke_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.DeleteSpokeRequest() - assert args[0] == request_msg @@ -10905,7 +10928,6 @@ def test_get_route_table_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.GetRouteTableRequest() - assert args[0] == request_msg @@ -10926,7 +10948,6 @@ def test_get_route_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.GetRouteRequest() - assert args[0] == request_msg @@ -10947,7 +10968,6 @@ def test_list_routes_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.ListRoutesRequest() - assert args[0] == request_msg @@ -10970,7 +10990,6 @@ def test_list_route_tables_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.ListRouteTablesRequest() - assert args[0] == request_msg @@ -10991,7 +11010,6 @@ def test_get_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.GetGroupRequest() - assert args[0] == request_msg @@ -11012,7 +11030,6 @@ def test_list_groups_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.ListGroupsRequest() - assert args[0] == request_msg @@ -11033,7 +11050,6 @@ def test_update_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.UpdateGroupRequest() - assert args[0] == request_msg @@ -11075,7 +11091,6 @@ async def test_list_hubs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.ListHubsRequest() - assert args[0] == request_msg @@ -11109,7 +11124,6 @@ async def test_get_hub_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.GetHubRequest() - assert args[0] == request_msg @@ -11134,7 +11148,6 @@ async def test_create_hub_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_hub.CreateHubRequest() - assert args[0] == request_msg @@ -11159,7 +11172,6 @@ async def test_update_hub_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_hub.UpdateHubRequest() - assert args[0] == request_msg @@ -11184,7 +11196,6 @@ async def test_delete_hub_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.DeleteHubRequest() - assert args[0] == request_msg @@ -11212,7 +11223,6 @@ async def test_list_hub_spokes_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.ListHubSpokesRequest() - assert args[0] == request_msg @@ -11239,7 +11249,6 @@ async def test_query_hub_status_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.QueryHubStatusRequest() - assert args[0] == request_msg @@ -11267,7 +11276,6 @@ async def test_list_spokes_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.ListSpokesRequest() - assert args[0] == request_msg @@ -11302,7 +11310,6 @@ async def test_get_spoke_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.GetSpokeRequest() - assert args[0] == request_msg @@ -11327,7 +11334,6 @@ async def test_create_spoke_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.CreateSpokeRequest() - assert args[0] == request_msg @@ -11352,7 +11358,6 @@ async def test_update_spoke_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.UpdateSpokeRequest() - assert args[0] == request_msg @@ -11377,7 +11382,6 @@ async def test_reject_hub_spoke_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.RejectHubSpokeRequest() - assert args[0] == request_msg @@ -11402,7 +11406,6 @@ async def test_accept_hub_spoke_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.AcceptHubSpokeRequest() - assert args[0] == request_msg @@ -11429,7 +11432,6 @@ async def test_accept_spoke_update_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.AcceptSpokeUpdateRequest() - assert args[0] == request_msg @@ -11456,7 +11458,6 @@ async def test_reject_spoke_update_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.RejectSpokeUpdateRequest() - assert args[0] == request_msg @@ -11481,7 +11482,6 @@ async def test_delete_spoke_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.DeleteSpokeRequest() - assert args[0] == request_msg @@ -11511,7 +11511,6 @@ async def test_get_route_table_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.GetRouteTableRequest() - assert args[0] == request_msg @@ -11546,7 +11545,6 @@ async def test_get_route_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.GetRouteRequest() - assert args[0] == request_msg @@ -11574,7 +11572,6 @@ async def test_list_routes_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.ListRoutesRequest() - assert args[0] == request_msg @@ -11604,7 +11601,6 @@ async def test_list_route_tables_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.ListRouteTablesRequest() - assert args[0] == request_msg @@ -11635,7 +11631,6 @@ async def test_get_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.GetGroupRequest() - assert args[0] == request_msg @@ -11663,7 +11658,6 @@ async def test_list_groups_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.ListGroupsRequest() - assert args[0] == request_msg @@ -11688,7 +11682,6 @@ async def test_update_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.UpdateGroupRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-network-connectivity/tests/unit/gapic/networkconnectivity_v1/test_internal_range_service.py b/packages/google-cloud-network-connectivity/tests/unit/gapic/networkconnectivity_v1/test_internal_range_service.py index 61f12432719f..96b7c7a62a17 100644 --- a/packages/google-cloud-network-connectivity/tests/unit/gapic/networkconnectivity_v1/test_internal_range_service.py +++ b/packages/google-cloud-network-connectivity/tests/unit/gapic/networkconnectivity_v1/test_internal_range_service.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 @@ -121,6 +122,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" @@ -1344,8 +1360,8 @@ def test_internal_range_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - internal_range.ListInternalRangesRequest, - dict, + internal_range.ListInternalRangesRequest(), + {}, ], ) def test_list_internal_ranges(request_type, transport: str = "grpc"): @@ -1356,7 +1372,7 @@ def test_list_internal_ranges(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1409,12 +1425,13 @@ def test_list_internal_ranges_non_empty_request_with_auto_populated_field(): client.list_internal_ranges(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == internal_range.ListInternalRangesRequest( + request_msg = internal_range.ListInternalRangesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_internal_ranges_use_cached_wrapped_rpc(): @@ -1499,9 +1516,15 @@ async def test_list_internal_ranges_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + internal_range.ListInternalRangesRequest(), + {}, + ], +) async def test_list_internal_ranges_async( - transport: str = "grpc_asyncio", - request_type=internal_range.ListInternalRangesRequest, + request_type, transport: str = "grpc_asyncio" ): client = InternalRangeServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1510,7 +1533,7 @@ async def test_list_internal_ranges_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( @@ -1537,11 +1560,6 @@ async def test_list_internal_ranges_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_internal_ranges_async_from_dict(): - await test_list_internal_ranges_async(request_type=dict) - - def test_list_internal_ranges_field_headers(): client = InternalRangeServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1894,8 +1912,8 @@ async def test_list_internal_ranges_async_pages(): @pytest.mark.parametrize( "request_type", [ - internal_range.GetInternalRangeRequest, - dict, + internal_range.GetInternalRangeRequest(), + {}, ], ) def test_get_internal_range(request_type, transport: str = "grpc"): @@ -1906,7 +1924,7 @@ def test_get_internal_range(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1978,9 +1996,10 @@ def test_get_internal_range_non_empty_request_with_auto_populated_field(): client.get_internal_range(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == internal_range.GetInternalRangeRequest( + request_msg = internal_range.GetInternalRangeRequest( name="name_value", ) + assert args[0] == request_msg def test_get_internal_range_use_cached_wrapped_rpc(): @@ -2065,9 +2084,14 @@ async def test_get_internal_range_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_internal_range_async( - transport: str = "grpc_asyncio", request_type=internal_range.GetInternalRangeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + internal_range.GetInternalRangeRequest(), + {}, + ], +) +async def test_get_internal_range_async(request_type, transport: str = "grpc_asyncio"): client = InternalRangeServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2075,7 +2099,7 @@ async def test_get_internal_range_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( @@ -2124,11 +2148,6 @@ async def test_get_internal_range_async( assert response.exclude_cidr_ranges == ["exclude_cidr_ranges_value"] -@pytest.mark.asyncio -async def test_get_internal_range_async_from_dict(): - await test_get_internal_range_async(request_type=dict) - - def test_get_internal_range_field_headers(): client = InternalRangeServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2283,8 +2302,8 @@ async def test_get_internal_range_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_internal_range.CreateInternalRangeRequest, - dict, + gcn_internal_range.CreateInternalRangeRequest(), + {}, ], ) def test_create_internal_range(request_type, transport: str = "grpc"): @@ -2295,7 +2314,7 @@ def test_create_internal_range(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2342,11 +2361,12 @@ def test_create_internal_range_non_empty_request_with_auto_populated_field(): client.create_internal_range(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_internal_range.CreateInternalRangeRequest( + request_msg = gcn_internal_range.CreateInternalRangeRequest( parent="parent_value", internal_range_id="internal_range_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_internal_range_use_cached_wrapped_rpc(): @@ -2442,9 +2462,15 @@ async def test_create_internal_range_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcn_internal_range.CreateInternalRangeRequest(), + {}, + ], +) async def test_create_internal_range_async( - transport: str = "grpc_asyncio", - request_type=gcn_internal_range.CreateInternalRangeRequest, + request_type, transport: str = "grpc_asyncio" ): client = InternalRangeServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2453,7 +2479,7 @@ async def test_create_internal_range_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( @@ -2475,11 +2501,6 @@ async def test_create_internal_range_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_internal_range_async_from_dict(): - await test_create_internal_range_async(request_type=dict) - - def test_create_internal_range_field_headers(): client = InternalRangeServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2654,8 +2675,8 @@ async def test_create_internal_range_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_internal_range.UpdateInternalRangeRequest, - dict, + gcn_internal_range.UpdateInternalRangeRequest(), + {}, ], ) def test_update_internal_range(request_type, transport: str = "grpc"): @@ -2666,7 +2687,7 @@ def test_update_internal_range(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2711,9 +2732,10 @@ def test_update_internal_range_non_empty_request_with_auto_populated_field(): client.update_internal_range(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_internal_range.UpdateInternalRangeRequest( + request_msg = gcn_internal_range.UpdateInternalRangeRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_internal_range_use_cached_wrapped_rpc(): @@ -2809,9 +2831,15 @@ async def test_update_internal_range_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcn_internal_range.UpdateInternalRangeRequest(), + {}, + ], +) async def test_update_internal_range_async( - transport: str = "grpc_asyncio", - request_type=gcn_internal_range.UpdateInternalRangeRequest, + request_type, transport: str = "grpc_asyncio" ): client = InternalRangeServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2820,7 +2848,7 @@ async def test_update_internal_range_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( @@ -2842,11 +2870,6 @@ async def test_update_internal_range_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_internal_range_async_from_dict(): - await test_update_internal_range_async(request_type=dict) - - def test_update_internal_range_field_headers(): client = InternalRangeServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3011,8 +3034,8 @@ async def test_update_internal_range_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - internal_range.DeleteInternalRangeRequest, - dict, + internal_range.DeleteInternalRangeRequest(), + {}, ], ) def test_delete_internal_range(request_type, transport: str = "grpc"): @@ -3023,7 +3046,7 @@ def test_delete_internal_range(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3069,10 +3092,11 @@ def test_delete_internal_range_non_empty_request_with_auto_populated_field(): client.delete_internal_range(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == internal_range.DeleteInternalRangeRequest( + request_msg = internal_range.DeleteInternalRangeRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_internal_range_use_cached_wrapped_rpc(): @@ -3168,9 +3192,15 @@ async def test_delete_internal_range_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + internal_range.DeleteInternalRangeRequest(), + {}, + ], +) async def test_delete_internal_range_async( - transport: str = "grpc_asyncio", - request_type=internal_range.DeleteInternalRangeRequest, + request_type, transport: str = "grpc_asyncio" ): client = InternalRangeServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3179,7 +3209,7 @@ async def test_delete_internal_range_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( @@ -3201,11 +3231,6 @@ async def test_delete_internal_range_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_internal_range_async_from_dict(): - await test_delete_internal_range_async(request_type=dict) - - def test_delete_internal_range_field_headers(): client = InternalRangeServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3481,7 +3506,6 @@ def test_list_internal_ranges_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = internal_range.ListInternalRangesRequest() - assert args[0] == request_msg @@ -3504,7 +3528,6 @@ def test_get_internal_range_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = internal_range.GetInternalRangeRequest() - assert args[0] == request_msg @@ -3527,7 +3550,6 @@ def test_create_internal_range_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_internal_range.CreateInternalRangeRequest() - assert args[0] == request_msg @@ -3550,7 +3572,6 @@ def test_update_internal_range_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_internal_range.UpdateInternalRangeRequest() - assert args[0] == request_msg @@ -3573,7 +3594,6 @@ def test_delete_internal_range_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = internal_range.DeleteInternalRangeRequest() - assert args[0] == request_msg @@ -3617,7 +3637,6 @@ async def test_list_internal_ranges_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = internal_range.ListInternalRangesRequest() - assert args[0] == request_msg @@ -3657,7 +3676,6 @@ async def test_get_internal_range_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = internal_range.GetInternalRangeRequest() - assert args[0] == request_msg @@ -3684,7 +3702,6 @@ async def test_create_internal_range_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_internal_range.CreateInternalRangeRequest() - assert args[0] == request_msg @@ -3711,7 +3728,6 @@ async def test_update_internal_range_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_internal_range.UpdateInternalRangeRequest() - assert args[0] == request_msg @@ -3738,7 +3754,6 @@ async def test_delete_internal_range_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = internal_range.DeleteInternalRangeRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-network-connectivity/tests/unit/gapic/networkconnectivity_v1/test_policy_based_routing_service.py b/packages/google-cloud-network-connectivity/tests/unit/gapic/networkconnectivity_v1/test_policy_based_routing_service.py index 2df24719e738..9629bdcc0d60 100644 --- a/packages/google-cloud-network-connectivity/tests/unit/gapic/networkconnectivity_v1/test_policy_based_routing_service.py +++ b/packages/google-cloud-network-connectivity/tests/unit/gapic/networkconnectivity_v1/test_policy_based_routing_service.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 @@ -117,6 +118,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" @@ -1359,8 +1375,8 @@ def test_policy_based_routing_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - policy_based_routing.ListPolicyBasedRoutesRequest, - dict, + policy_based_routing.ListPolicyBasedRoutesRequest(), + {}, ], ) def test_list_policy_based_routes(request_type, transport: str = "grpc"): @@ -1371,7 +1387,7 @@ def test_list_policy_based_routes(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1424,12 +1440,13 @@ def test_list_policy_based_routes_non_empty_request_with_auto_populated_field(): client.list_policy_based_routes(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == policy_based_routing.ListPolicyBasedRoutesRequest( + request_msg = policy_based_routing.ListPolicyBasedRoutesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_policy_based_routes_use_cached_wrapped_rpc(): @@ -1515,9 +1532,15 @@ async def test_list_policy_based_routes_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + policy_based_routing.ListPolicyBasedRoutesRequest(), + {}, + ], +) async def test_list_policy_based_routes_async( - transport: str = "grpc_asyncio", - request_type=policy_based_routing.ListPolicyBasedRoutesRequest, + request_type, transport: str = "grpc_asyncio" ): client = PolicyBasedRoutingServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1526,7 +1549,7 @@ async def test_list_policy_based_routes_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( @@ -1553,11 +1576,6 @@ async def test_list_policy_based_routes_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_policy_based_routes_async_from_dict(): - await test_list_policy_based_routes_async(request_type=dict) - - def test_list_policy_based_routes_field_headers(): client = PolicyBasedRoutingServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1916,8 +1934,8 @@ async def test_list_policy_based_routes_async_pages(): @pytest.mark.parametrize( "request_type", [ - policy_based_routing.GetPolicyBasedRouteRequest, - dict, + policy_based_routing.GetPolicyBasedRouteRequest(), + {}, ], ) def test_get_policy_based_route(request_type, transport: str = "grpc"): @@ -1928,7 +1946,7 @@ def test_get_policy_based_route(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1987,9 +2005,10 @@ def test_get_policy_based_route_non_empty_request_with_auto_populated_field(): client.get_policy_based_route(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == policy_based_routing.GetPolicyBasedRouteRequest( + request_msg = policy_based_routing.GetPolicyBasedRouteRequest( name="name_value", ) + assert args[0] == request_msg def test_get_policy_based_route_use_cached_wrapped_rpc(): @@ -2075,9 +2094,15 @@ async def test_get_policy_based_route_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + policy_based_routing.GetPolicyBasedRouteRequest(), + {}, + ], +) async def test_get_policy_based_route_async( - transport: str = "grpc_asyncio", - request_type=policy_based_routing.GetPolicyBasedRouteRequest, + request_type, transport: str = "grpc_asyncio" ): client = PolicyBasedRoutingServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2086,7 +2111,7 @@ async def test_get_policy_based_route_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( @@ -2121,11 +2146,6 @@ async def test_get_policy_based_route_async( assert response.kind == "kind_value" -@pytest.mark.asyncio -async def test_get_policy_based_route_async_from_dict(): - await test_get_policy_based_route_async(request_type=dict) - - def test_get_policy_based_route_field_headers(): client = PolicyBasedRoutingServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2280,8 +2300,8 @@ async def test_get_policy_based_route_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - policy_based_routing.CreatePolicyBasedRouteRequest, - dict, + policy_based_routing.CreatePolicyBasedRouteRequest(), + {}, ], ) def test_create_policy_based_route(request_type, transport: str = "grpc"): @@ -2292,7 +2312,7 @@ def test_create_policy_based_route(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2339,11 +2359,12 @@ def test_create_policy_based_route_non_empty_request_with_auto_populated_field() client.create_policy_based_route(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == policy_based_routing.CreatePolicyBasedRouteRequest( + request_msg = policy_based_routing.CreatePolicyBasedRouteRequest( parent="parent_value", policy_based_route_id="policy_based_route_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_policy_based_route_use_cached_wrapped_rpc(): @@ -2439,9 +2460,15 @@ async def test_create_policy_based_route_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + policy_based_routing.CreatePolicyBasedRouteRequest(), + {}, + ], +) async def test_create_policy_based_route_async( - transport: str = "grpc_asyncio", - request_type=policy_based_routing.CreatePolicyBasedRouteRequest, + request_type, transport: str = "grpc_asyncio" ): client = PolicyBasedRoutingServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2450,7 +2477,7 @@ async def test_create_policy_based_route_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( @@ -2472,11 +2499,6 @@ async def test_create_policy_based_route_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_policy_based_route_async_from_dict(): - await test_create_policy_based_route_async(request_type=dict) - - def test_create_policy_based_route_field_headers(): client = PolicyBasedRoutingServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2675,8 +2697,8 @@ async def test_create_policy_based_route_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - policy_based_routing.DeletePolicyBasedRouteRequest, - dict, + policy_based_routing.DeletePolicyBasedRouteRequest(), + {}, ], ) def test_delete_policy_based_route(request_type, transport: str = "grpc"): @@ -2687,7 +2709,7 @@ def test_delete_policy_based_route(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2733,10 +2755,11 @@ def test_delete_policy_based_route_non_empty_request_with_auto_populated_field() client.delete_policy_based_route(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == policy_based_routing.DeletePolicyBasedRouteRequest( + request_msg = policy_based_routing.DeletePolicyBasedRouteRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_policy_based_route_use_cached_wrapped_rpc(): @@ -2832,9 +2855,15 @@ async def test_delete_policy_based_route_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + policy_based_routing.DeletePolicyBasedRouteRequest(), + {}, + ], +) async def test_delete_policy_based_route_async( - transport: str = "grpc_asyncio", - request_type=policy_based_routing.DeletePolicyBasedRouteRequest, + request_type, transport: str = "grpc_asyncio" ): client = PolicyBasedRoutingServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2843,7 +2872,7 @@ async def test_delete_policy_based_route_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( @@ -2865,11 +2894,6 @@ async def test_delete_policy_based_route_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_policy_based_route_async_from_dict(): - await test_delete_policy_based_route_async(request_type=dict) - - def test_delete_policy_based_route_field_headers(): client = PolicyBasedRoutingServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3145,7 +3169,6 @@ def test_list_policy_based_routes_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policy_based_routing.ListPolicyBasedRoutesRequest() - assert args[0] == request_msg @@ -3168,7 +3191,6 @@ def test_get_policy_based_route_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policy_based_routing.GetPolicyBasedRouteRequest() - assert args[0] == request_msg @@ -3191,7 +3213,6 @@ def test_create_policy_based_route_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policy_based_routing.CreatePolicyBasedRouteRequest() - assert args[0] == request_msg @@ -3214,7 +3235,6 @@ def test_delete_policy_based_route_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policy_based_routing.DeletePolicyBasedRouteRequest() - assert args[0] == request_msg @@ -3258,7 +3278,6 @@ async def test_list_policy_based_routes_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policy_based_routing.ListPolicyBasedRoutesRequest() - assert args[0] == request_msg @@ -3292,7 +3311,6 @@ async def test_get_policy_based_route_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policy_based_routing.GetPolicyBasedRouteRequest() - assert args[0] == request_msg @@ -3319,7 +3337,6 @@ async def test_create_policy_based_route_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policy_based_routing.CreatePolicyBasedRouteRequest() - assert args[0] == request_msg @@ -3346,7 +3363,6 @@ async def test_delete_policy_based_route_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policy_based_routing.DeletePolicyBasedRouteRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-network-connectivity/tests/unit/gapic/networkconnectivity_v1alpha1/test_hub_service.py b/packages/google-cloud-network-connectivity/tests/unit/gapic/networkconnectivity_v1alpha1/test_hub_service.py index 26b418e0c853..d8e84d1b887a 100644 --- a/packages/google-cloud-network-connectivity/tests/unit/gapic/networkconnectivity_v1alpha1/test_hub_service.py +++ b/packages/google-cloud-network-connectivity/tests/unit/gapic/networkconnectivity_v1alpha1/test_hub_service.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 @@ -113,6 +114,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" @@ -1257,8 +1273,8 @@ def test_hub_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - hub.ListHubsRequest, - dict, + hub.ListHubsRequest(), + {}, ], ) def test_list_hubs(request_type, transport: str = "grpc"): @@ -1269,7 +1285,7 @@ def test_list_hubs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_hubs), "__call__") as call: @@ -1318,12 +1334,13 @@ def test_list_hubs_non_empty_request_with_auto_populated_field(): client.list_hubs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hub.ListHubsRequest( + request_msg = hub.ListHubsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_hubs_use_cached_wrapped_rpc(): @@ -1402,9 +1419,14 @@ async def test_list_hubs_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_list_hubs_async( - transport: str = "grpc_asyncio", request_type=hub.ListHubsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + hub.ListHubsRequest(), + {}, + ], +) +async def test_list_hubs_async(request_type, transport: str = "grpc_asyncio"): client = HubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1412,7 +1434,7 @@ async def test_list_hubs_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_hubs), "__call__") as call: @@ -1437,11 +1459,6 @@ async def test_list_hubs_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_hubs_async_from_dict(): - await test_list_hubs_async(request_type=dict) - - def test_list_hubs_field_headers(): client = HubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1778,8 +1795,8 @@ async def test_list_hubs_async_pages(): @pytest.mark.parametrize( "request_type", [ - hub.GetHubRequest, - dict, + hub.GetHubRequest(), + {}, ], ) def test_get_hub(request_type, transport: str = "grpc"): @@ -1790,7 +1807,7 @@ def test_get_hub(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_hub), "__call__") as call: @@ -1842,9 +1859,10 @@ def test_get_hub_non_empty_request_with_auto_populated_field(): client.get_hub(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hub.GetHubRequest( + request_msg = hub.GetHubRequest( name="name_value", ) + assert args[0] == request_msg def test_get_hub_use_cached_wrapped_rpc(): @@ -1923,9 +1941,14 @@ async def test_get_hub_async_use_cached_wrapped_rpc(transport: str = "grpc_async @pytest.mark.asyncio -async def test_get_hub_async( - transport: str = "grpc_asyncio", request_type=hub.GetHubRequest -): +@pytest.mark.parametrize( + "request_type", + [ + hub.GetHubRequest(), + {}, + ], +) +async def test_get_hub_async(request_type, transport: str = "grpc_asyncio"): client = HubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1933,7 +1956,7 @@ async def test_get_hub_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_hub), "__call__") as call: @@ -1964,11 +1987,6 @@ async def test_get_hub_async( assert response.state == hub.State.CREATING -@pytest.mark.asyncio -async def test_get_hub_async_from_dict(): - await test_get_hub_async(request_type=dict) - - def test_get_hub_field_headers(): client = HubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2111,8 +2129,8 @@ async def test_get_hub_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_hub.CreateHubRequest, - dict, + gcn_hub.CreateHubRequest(), + {}, ], ) def test_create_hub(request_type, transport: str = "grpc"): @@ -2123,7 +2141,7 @@ def test_create_hub(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_hub), "__call__") as call: @@ -2166,11 +2184,12 @@ def test_create_hub_non_empty_request_with_auto_populated_field(): client.create_hub(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_hub.CreateHubRequest( + request_msg = gcn_hub.CreateHubRequest( parent="parent_value", hub_id="hub_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_hub_use_cached_wrapped_rpc(): @@ -2259,9 +2278,14 @@ async def test_create_hub_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_create_hub_async( - transport: str = "grpc_asyncio", request_type=gcn_hub.CreateHubRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcn_hub.CreateHubRequest(), + {}, + ], +) +async def test_create_hub_async(request_type, transport: str = "grpc_asyncio"): client = HubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2269,7 +2293,7 @@ async def test_create_hub_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_hub), "__call__") as call: @@ -2289,11 +2313,6 @@ async def test_create_hub_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_hub_async_from_dict(): - await test_create_hub_async(request_type=dict) - - def test_create_hub_field_headers(): client = HubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2460,8 +2479,8 @@ async def test_create_hub_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_hub.UpdateHubRequest, - dict, + gcn_hub.UpdateHubRequest(), + {}, ], ) def test_update_hub(request_type, transport: str = "grpc"): @@ -2472,7 +2491,7 @@ def test_update_hub(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_hub), "__call__") as call: @@ -2513,9 +2532,10 @@ def test_update_hub_non_empty_request_with_auto_populated_field(): client.update_hub(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_hub.UpdateHubRequest( + request_msg = gcn_hub.UpdateHubRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_hub_use_cached_wrapped_rpc(): @@ -2604,9 +2624,14 @@ async def test_update_hub_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_update_hub_async( - transport: str = "grpc_asyncio", request_type=gcn_hub.UpdateHubRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcn_hub.UpdateHubRequest(), + {}, + ], +) +async def test_update_hub_async(request_type, transport: str = "grpc_asyncio"): client = HubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2614,7 +2639,7 @@ async def test_update_hub_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_hub), "__call__") as call: @@ -2634,11 +2659,6 @@ async def test_update_hub_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_hub_async_from_dict(): - await test_update_hub_async(request_type=dict) - - def test_update_hub_field_headers(): client = HubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2795,8 +2815,8 @@ async def test_update_hub_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - hub.DeleteHubRequest, - dict, + hub.DeleteHubRequest(), + {}, ], ) def test_delete_hub(request_type, transport: str = "grpc"): @@ -2807,7 +2827,7 @@ def test_delete_hub(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_hub), "__call__") as call: @@ -2849,10 +2869,11 @@ def test_delete_hub_non_empty_request_with_auto_populated_field(): client.delete_hub(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hub.DeleteHubRequest( + request_msg = hub.DeleteHubRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_hub_use_cached_wrapped_rpc(): @@ -2941,9 +2962,14 @@ async def test_delete_hub_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_delete_hub_async( - transport: str = "grpc_asyncio", request_type=hub.DeleteHubRequest -): +@pytest.mark.parametrize( + "request_type", + [ + hub.DeleteHubRequest(), + {}, + ], +) +async def test_delete_hub_async(request_type, transport: str = "grpc_asyncio"): client = HubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2951,7 +2977,7 @@ async def test_delete_hub_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_hub), "__call__") as call: @@ -2971,11 +2997,6 @@ async def test_delete_hub_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_hub_async_from_dict(): - await test_delete_hub_async(request_type=dict) - - def test_delete_hub_field_headers(): client = HubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3122,8 +3143,8 @@ async def test_delete_hub_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - hub.ListSpokesRequest, - dict, + hub.ListSpokesRequest(), + {}, ], ) def test_list_spokes(request_type, transport: str = "grpc"): @@ -3134,7 +3155,7 @@ def test_list_spokes(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_spokes), "__call__") as call: @@ -3183,12 +3204,13 @@ def test_list_spokes_non_empty_request_with_auto_populated_field(): client.list_spokes(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hub.ListSpokesRequest( + request_msg = hub.ListSpokesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_spokes_use_cached_wrapped_rpc(): @@ -3269,9 +3291,14 @@ async def test_list_spokes_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_spokes_async( - transport: str = "grpc_asyncio", request_type=hub.ListSpokesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + hub.ListSpokesRequest(), + {}, + ], +) +async def test_list_spokes_async(request_type, transport: str = "grpc_asyncio"): client = HubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3279,7 +3306,7 @@ async def test_list_spokes_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_spokes), "__call__") as call: @@ -3304,11 +3331,6 @@ async def test_list_spokes_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_spokes_async_from_dict(): - await test_list_spokes_async(request_type=dict) - - def test_list_spokes_field_headers(): client = HubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3645,8 +3667,8 @@ async def test_list_spokes_async_pages(): @pytest.mark.parametrize( "request_type", [ - hub.GetSpokeRequest, - dict, + hub.GetSpokeRequest(), + {}, ], ) def test_get_spoke(request_type, transport: str = "grpc"): @@ -3657,7 +3679,7 @@ def test_get_spoke(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_spoke), "__call__") as call: @@ -3715,9 +3737,10 @@ def test_get_spoke_non_empty_request_with_auto_populated_field(): client.get_spoke(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hub.GetSpokeRequest( + request_msg = hub.GetSpokeRequest( name="name_value", ) + assert args[0] == request_msg def test_get_spoke_use_cached_wrapped_rpc(): @@ -3796,9 +3819,14 @@ async def test_get_spoke_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_spoke_async( - transport: str = "grpc_asyncio", request_type=hub.GetSpokeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + hub.GetSpokeRequest(), + {}, + ], +) +async def test_get_spoke_async(request_type, transport: str = "grpc_asyncio"): client = HubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3806,7 +3834,7 @@ async def test_get_spoke_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_spoke), "__call__") as call: @@ -3845,11 +3873,6 @@ async def test_get_spoke_async( assert response.state == hub.State.CREATING -@pytest.mark.asyncio -async def test_get_spoke_async_from_dict(): - await test_get_spoke_async(request_type=dict) - - def test_get_spoke_field_headers(): client = HubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3992,8 +4015,8 @@ async def test_get_spoke_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - hub.CreateSpokeRequest, - dict, + hub.CreateSpokeRequest(), + {}, ], ) def test_create_spoke(request_type, transport: str = "grpc"): @@ -4004,7 +4027,7 @@ def test_create_spoke(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_spoke), "__call__") as call: @@ -4047,11 +4070,12 @@ def test_create_spoke_non_empty_request_with_auto_populated_field(): client.create_spoke(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hub.CreateSpokeRequest( + request_msg = hub.CreateSpokeRequest( parent="parent_value", spoke_id="spoke_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_spoke_use_cached_wrapped_rpc(): @@ -4142,9 +4166,14 @@ async def test_create_spoke_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_spoke_async( - transport: str = "grpc_asyncio", request_type=hub.CreateSpokeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + hub.CreateSpokeRequest(), + {}, + ], +) +async def test_create_spoke_async(request_type, transport: str = "grpc_asyncio"): client = HubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4152,7 +4181,7 @@ async def test_create_spoke_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_spoke), "__call__") as call: @@ -4172,11 +4201,6 @@ async def test_create_spoke_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_spoke_async_from_dict(): - await test_create_spoke_async(request_type=dict) - - def test_create_spoke_field_headers(): client = HubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4343,8 +4367,8 @@ async def test_create_spoke_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - hub.UpdateSpokeRequest, - dict, + hub.UpdateSpokeRequest(), + {}, ], ) def test_update_spoke(request_type, transport: str = "grpc"): @@ -4355,7 +4379,7 @@ def test_update_spoke(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_spoke), "__call__") as call: @@ -4396,9 +4420,10 @@ def test_update_spoke_non_empty_request_with_auto_populated_field(): client.update_spoke(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hub.UpdateSpokeRequest( + request_msg = hub.UpdateSpokeRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_spoke_use_cached_wrapped_rpc(): @@ -4489,9 +4514,14 @@ async def test_update_spoke_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_spoke_async( - transport: str = "grpc_asyncio", request_type=hub.UpdateSpokeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + hub.UpdateSpokeRequest(), + {}, + ], +) +async def test_update_spoke_async(request_type, transport: str = "grpc_asyncio"): client = HubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4499,7 +4529,7 @@ async def test_update_spoke_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_spoke), "__call__") as call: @@ -4519,11 +4549,6 @@ async def test_update_spoke_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_spoke_async_from_dict(): - await test_update_spoke_async(request_type=dict) - - def test_update_spoke_field_headers(): client = HubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4680,8 +4705,8 @@ async def test_update_spoke_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - hub.DeleteSpokeRequest, - dict, + hub.DeleteSpokeRequest(), + {}, ], ) def test_delete_spoke(request_type, transport: str = "grpc"): @@ -4692,7 +4717,7 @@ def test_delete_spoke(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_spoke), "__call__") as call: @@ -4734,10 +4759,11 @@ def test_delete_spoke_non_empty_request_with_auto_populated_field(): client.delete_spoke(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hub.DeleteSpokeRequest( + request_msg = hub.DeleteSpokeRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_spoke_use_cached_wrapped_rpc(): @@ -4828,9 +4854,14 @@ async def test_delete_spoke_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_spoke_async( - transport: str = "grpc_asyncio", request_type=hub.DeleteSpokeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + hub.DeleteSpokeRequest(), + {}, + ], +) +async def test_delete_spoke_async(request_type, transport: str = "grpc_asyncio"): client = HubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4838,7 +4869,7 @@ async def test_delete_spoke_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_spoke), "__call__") as call: @@ -4858,11 +4889,6 @@ async def test_delete_spoke_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_spoke_async_from_dict(): - await test_delete_spoke_async(request_type=dict) - - def test_delete_spoke_field_headers(): client = HubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5128,7 +5154,6 @@ def test_list_hubs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.ListHubsRequest() - assert args[0] == request_msg @@ -5149,7 +5174,6 @@ def test_get_hub_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.GetHubRequest() - assert args[0] == request_msg @@ -5170,7 +5194,6 @@ def test_create_hub_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_hub.CreateHubRequest() - assert args[0] == request_msg @@ -5191,7 +5214,6 @@ def test_update_hub_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_hub.UpdateHubRequest() - assert args[0] == request_msg @@ -5212,7 +5234,6 @@ def test_delete_hub_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.DeleteHubRequest() - assert args[0] == request_msg @@ -5233,7 +5254,6 @@ def test_list_spokes_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.ListSpokesRequest() - assert args[0] == request_msg @@ -5254,7 +5274,6 @@ def test_get_spoke_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.GetSpokeRequest() - assert args[0] == request_msg @@ -5275,7 +5294,6 @@ def test_create_spoke_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.CreateSpokeRequest() - assert args[0] == request_msg @@ -5296,7 +5314,6 @@ def test_update_spoke_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.UpdateSpokeRequest() - assert args[0] == request_msg @@ -5317,7 +5334,6 @@ def test_delete_spoke_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.DeleteSpokeRequest() - assert args[0] == request_msg @@ -5359,7 +5375,6 @@ async def test_list_hubs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.ListHubsRequest() - assert args[0] == request_msg @@ -5390,7 +5405,6 @@ async def test_get_hub_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.GetHubRequest() - assert args[0] == request_msg @@ -5415,7 +5429,6 @@ async def test_create_hub_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_hub.CreateHubRequest() - assert args[0] == request_msg @@ -5440,7 +5453,6 @@ async def test_update_hub_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_hub.UpdateHubRequest() - assert args[0] == request_msg @@ -5465,7 +5477,6 @@ async def test_delete_hub_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.DeleteHubRequest() - assert args[0] == request_msg @@ -5493,7 +5504,6 @@ async def test_list_spokes_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.ListSpokesRequest() - assert args[0] == request_msg @@ -5528,7 +5538,6 @@ async def test_get_spoke_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.GetSpokeRequest() - assert args[0] == request_msg @@ -5553,7 +5562,6 @@ async def test_create_spoke_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.CreateSpokeRequest() - assert args[0] == request_msg @@ -5578,7 +5586,6 @@ async def test_update_spoke_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.UpdateSpokeRequest() - assert args[0] == request_msg @@ -5603,7 +5610,6 @@ async def test_delete_spoke_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.DeleteSpokeRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-network-connectivity/tests/unit/gapic/networkconnectivity_v1beta/test_data_transfer_service.py b/packages/google-cloud-network-connectivity/tests/unit/gapic/networkconnectivity_v1beta/test_data_transfer_service.py index abec62c88c20..dee377fb348c 100644 --- a/packages/google-cloud-network-connectivity/tests/unit/gapic/networkconnectivity_v1beta/test_data_transfer_service.py +++ b/packages/google-cloud-network-connectivity/tests/unit/gapic/networkconnectivity_v1beta/test_data_transfer_service.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 @@ -118,6 +119,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" @@ -1341,8 +1357,8 @@ def test_data_transfer_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - data_transfer.ListMulticloudDataTransferConfigsRequest, - dict, + data_transfer.ListMulticloudDataTransferConfigsRequest(), + {}, ], ) def test_list_multicloud_data_transfer_configs(request_type, transport: str = "grpc"): @@ -1353,7 +1369,7 @@ def test_list_multicloud_data_transfer_configs(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( @@ -1406,12 +1422,13 @@ def test_list_multicloud_data_transfer_configs_non_empty_request_with_auto_popul client.list_multicloud_data_transfer_configs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_transfer.ListMulticloudDataTransferConfigsRequest( + request_msg = data_transfer.ListMulticloudDataTransferConfigsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_multicloud_data_transfer_configs_use_cached_wrapped_rpc(): @@ -1497,9 +1514,15 @@ async def test_list_multicloud_data_transfer_configs_async_use_cached_wrapped_rp @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_transfer.ListMulticloudDataTransferConfigsRequest(), + {}, + ], +) async def test_list_multicloud_data_transfer_configs_async( - transport: str = "grpc_asyncio", - request_type=data_transfer.ListMulticloudDataTransferConfigsRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataTransferServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1508,7 +1531,7 @@ async def test_list_multicloud_data_transfer_configs_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( @@ -1535,11 +1558,6 @@ async def test_list_multicloud_data_transfer_configs_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_multicloud_data_transfer_configs_async_from_dict(): - await test_list_multicloud_data_transfer_configs_async(request_type=dict) - - def test_list_multicloud_data_transfer_configs_field_headers(): client = DataTransferServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1900,8 +1918,8 @@ async def test_list_multicloud_data_transfer_configs_async_pages(): @pytest.mark.parametrize( "request_type", [ - data_transfer.GetMulticloudDataTransferConfigRequest, - dict, + data_transfer.GetMulticloudDataTransferConfigRequest(), + {}, ], ) def test_get_multicloud_data_transfer_config(request_type, transport: str = "grpc"): @@ -1912,7 +1930,7 @@ def test_get_multicloud_data_transfer_config(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( @@ -1970,9 +1988,10 @@ def test_get_multicloud_data_transfer_config_non_empty_request_with_auto_populat client.get_multicloud_data_transfer_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_transfer.GetMulticloudDataTransferConfigRequest( + request_msg = data_transfer.GetMulticloudDataTransferConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_multicloud_data_transfer_config_use_cached_wrapped_rpc(): @@ -2058,9 +2077,15 @@ async def test_get_multicloud_data_transfer_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_transfer.GetMulticloudDataTransferConfigRequest(), + {}, + ], +) async def test_get_multicloud_data_transfer_config_async( - transport: str = "grpc_asyncio", - request_type=data_transfer.GetMulticloudDataTransferConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataTransferServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2069,7 +2094,7 @@ async def test_get_multicloud_data_transfer_config_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( @@ -2104,11 +2129,6 @@ async def test_get_multicloud_data_transfer_config_async( assert response.uid == "uid_value" -@pytest.mark.asyncio -async def test_get_multicloud_data_transfer_config_async_from_dict(): - await test_get_multicloud_data_transfer_config_async(request_type=dict) - - def test_get_multicloud_data_transfer_config_field_headers(): client = DataTransferServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2263,8 +2283,8 @@ async def test_get_multicloud_data_transfer_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_transfer.CreateMulticloudDataTransferConfigRequest, - dict, + data_transfer.CreateMulticloudDataTransferConfigRequest(), + {}, ], ) def test_create_multicloud_data_transfer_config(request_type, transport: str = "grpc"): @@ -2275,7 +2295,7 @@ def test_create_multicloud_data_transfer_config(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( @@ -2321,10 +2341,11 @@ def test_create_multicloud_data_transfer_config_non_empty_request_with_auto_popu client.create_multicloud_data_transfer_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_transfer.CreateMulticloudDataTransferConfigRequest( + request_msg = data_transfer.CreateMulticloudDataTransferConfigRequest( parent="parent_value", multicloud_data_transfer_config_id="multicloud_data_transfer_config_id_value", ) + assert args[0] == request_msg def test_create_multicloud_data_transfer_config_use_cached_wrapped_rpc(): @@ -2420,9 +2441,15 @@ async def test_create_multicloud_data_transfer_config_async_use_cached_wrapped_r @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_transfer.CreateMulticloudDataTransferConfigRequest(), + {}, + ], +) async def test_create_multicloud_data_transfer_config_async( - transport: str = "grpc_asyncio", - request_type=data_transfer.CreateMulticloudDataTransferConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataTransferServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2431,7 +2458,7 @@ async def test_create_multicloud_data_transfer_config_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( @@ -2453,11 +2480,6 @@ async def test_create_multicloud_data_transfer_config_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_multicloud_data_transfer_config_async_from_dict(): - await test_create_multicloud_data_transfer_config_async(request_type=dict) - - def test_create_multicloud_data_transfer_config_field_headers(): client = DataTransferServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2640,8 +2662,8 @@ async def test_create_multicloud_data_transfer_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_transfer.UpdateMulticloudDataTransferConfigRequest, - dict, + data_transfer.UpdateMulticloudDataTransferConfigRequest(), + {}, ], ) def test_update_multicloud_data_transfer_config(request_type, transport: str = "grpc"): @@ -2652,7 +2674,7 @@ def test_update_multicloud_data_transfer_config(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( @@ -2695,7 +2717,8 @@ def test_update_multicloud_data_transfer_config_non_empty_request_with_auto_popu client.update_multicloud_data_transfer_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_transfer.UpdateMulticloudDataTransferConfigRequest() + request_msg = data_transfer.UpdateMulticloudDataTransferConfigRequest() + assert args[0] == request_msg def test_update_multicloud_data_transfer_config_use_cached_wrapped_rpc(): @@ -2791,9 +2814,15 @@ async def test_update_multicloud_data_transfer_config_async_use_cached_wrapped_r @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_transfer.UpdateMulticloudDataTransferConfigRequest(), + {}, + ], +) async def test_update_multicloud_data_transfer_config_async( - transport: str = "grpc_asyncio", - request_type=data_transfer.UpdateMulticloudDataTransferConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataTransferServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2802,7 +2831,7 @@ async def test_update_multicloud_data_transfer_config_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( @@ -2824,11 +2853,6 @@ async def test_update_multicloud_data_transfer_config_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_multicloud_data_transfer_config_async_from_dict(): - await test_update_multicloud_data_transfer_config_async(request_type=dict) - - def test_update_multicloud_data_transfer_config_field_headers(): client = DataTransferServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3001,8 +3025,8 @@ async def test_update_multicloud_data_transfer_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_transfer.DeleteMulticloudDataTransferConfigRequest, - dict, + data_transfer.DeleteMulticloudDataTransferConfigRequest(), + {}, ], ) def test_delete_multicloud_data_transfer_config(request_type, transport: str = "grpc"): @@ -3013,7 +3037,7 @@ def test_delete_multicloud_data_transfer_config(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( @@ -3059,10 +3083,11 @@ def test_delete_multicloud_data_transfer_config_non_empty_request_with_auto_popu client.delete_multicloud_data_transfer_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_transfer.DeleteMulticloudDataTransferConfigRequest( + request_msg = data_transfer.DeleteMulticloudDataTransferConfigRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_multicloud_data_transfer_config_use_cached_wrapped_rpc(): @@ -3158,9 +3183,15 @@ async def test_delete_multicloud_data_transfer_config_async_use_cached_wrapped_r @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_transfer.DeleteMulticloudDataTransferConfigRequest(), + {}, + ], +) async def test_delete_multicloud_data_transfer_config_async( - transport: str = "grpc_asyncio", - request_type=data_transfer.DeleteMulticloudDataTransferConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataTransferServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3169,7 +3200,7 @@ async def test_delete_multicloud_data_transfer_config_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( @@ -3191,11 +3222,6 @@ async def test_delete_multicloud_data_transfer_config_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_multicloud_data_transfer_config_async_from_dict(): - await test_delete_multicloud_data_transfer_config_async(request_type=dict) - - def test_delete_multicloud_data_transfer_config_field_headers(): client = DataTransferServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3350,8 +3376,8 @@ async def test_delete_multicloud_data_transfer_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_transfer.ListDestinationsRequest, - dict, + data_transfer.ListDestinationsRequest(), + {}, ], ) def test_list_destinations(request_type, transport: str = "grpc"): @@ -3362,7 +3388,7 @@ def test_list_destinations(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3415,12 +3441,13 @@ def test_list_destinations_non_empty_request_with_auto_populated_field(): client.list_destinations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_transfer.ListDestinationsRequest( + request_msg = data_transfer.ListDestinationsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_destinations_use_cached_wrapped_rpc(): @@ -3503,9 +3530,14 @@ async def test_list_destinations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_destinations_async( - transport: str = "grpc_asyncio", request_type=data_transfer.ListDestinationsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + data_transfer.ListDestinationsRequest(), + {}, + ], +) +async def test_list_destinations_async(request_type, transport: str = "grpc_asyncio"): client = DataTransferServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3513,7 +3545,7 @@ async def test_list_destinations_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( @@ -3540,11 +3572,6 @@ async def test_list_destinations_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_destinations_async_from_dict(): - await test_list_destinations_async(request_type=dict) - - def test_list_destinations_field_headers(): client = DataTransferServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3897,8 +3924,8 @@ async def test_list_destinations_async_pages(): @pytest.mark.parametrize( "request_type", [ - data_transfer.GetDestinationRequest, - dict, + data_transfer.GetDestinationRequest(), + {}, ], ) def test_get_destination(request_type, transport: str = "grpc"): @@ -3909,7 +3936,7 @@ def test_get_destination(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_destination), "__call__") as call: @@ -3961,9 +3988,10 @@ def test_get_destination_non_empty_request_with_auto_populated_field(): client.get_destination(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_transfer.GetDestinationRequest( + request_msg = data_transfer.GetDestinationRequest( name="name_value", ) + assert args[0] == request_msg def test_get_destination_use_cached_wrapped_rpc(): @@ -4044,9 +4072,14 @@ async def test_get_destination_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_destination_async( - transport: str = "grpc_asyncio", request_type=data_transfer.GetDestinationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + data_transfer.GetDestinationRequest(), + {}, + ], +) +async def test_get_destination_async(request_type, transport: str = "grpc_asyncio"): client = DataTransferServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4054,7 +4087,7 @@ async def test_get_destination_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_destination), "__call__") as call: @@ -4085,11 +4118,6 @@ async def test_get_destination_async( assert response.uid == "uid_value" -@pytest.mark.asyncio -async def test_get_destination_async_from_dict(): - await test_get_destination_async(request_type=dict) - - def test_get_destination_field_headers(): client = DataTransferServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4236,8 +4264,8 @@ async def test_get_destination_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_transfer.CreateDestinationRequest, - dict, + data_transfer.CreateDestinationRequest(), + {}, ], ) def test_create_destination(request_type, transport: str = "grpc"): @@ -4248,7 +4276,7 @@ def test_create_destination(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4294,10 +4322,11 @@ def test_create_destination_non_empty_request_with_auto_populated_field(): client.create_destination(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_transfer.CreateDestinationRequest( + request_msg = data_transfer.CreateDestinationRequest( parent="parent_value", destination_id="destination_id_value", ) + assert args[0] == request_msg def test_create_destination_use_cached_wrapped_rpc(): @@ -4392,9 +4421,14 @@ async def test_create_destination_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_destination_async( - transport: str = "grpc_asyncio", request_type=data_transfer.CreateDestinationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + data_transfer.CreateDestinationRequest(), + {}, + ], +) +async def test_create_destination_async(request_type, transport: str = "grpc_asyncio"): client = DataTransferServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4402,7 +4436,7 @@ async def test_create_destination_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( @@ -4424,11 +4458,6 @@ async def test_create_destination_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_destination_async_from_dict(): - await test_create_destination_async(request_type=dict) - - def test_create_destination_field_headers(): client = DataTransferServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4603,8 +4632,8 @@ async def test_create_destination_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_transfer.UpdateDestinationRequest, - dict, + data_transfer.UpdateDestinationRequest(), + {}, ], ) def test_update_destination(request_type, transport: str = "grpc"): @@ -4615,7 +4644,7 @@ def test_update_destination(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4658,7 +4687,8 @@ def test_update_destination_non_empty_request_with_auto_populated_field(): client.update_destination(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_transfer.UpdateDestinationRequest() + request_msg = data_transfer.UpdateDestinationRequest() + assert args[0] == request_msg def test_update_destination_use_cached_wrapped_rpc(): @@ -4753,9 +4783,14 @@ async def test_update_destination_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_destination_async( - transport: str = "grpc_asyncio", request_type=data_transfer.UpdateDestinationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + data_transfer.UpdateDestinationRequest(), + {}, + ], +) +async def test_update_destination_async(request_type, transport: str = "grpc_asyncio"): client = DataTransferServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4763,7 +4798,7 @@ async def test_update_destination_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( @@ -4785,11 +4820,6 @@ async def test_update_destination_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_destination_async_from_dict(): - await test_update_destination_async(request_type=dict) - - def test_update_destination_field_headers(): client = DataTransferServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4954,8 +4984,8 @@ async def test_update_destination_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_transfer.DeleteDestinationRequest, - dict, + data_transfer.DeleteDestinationRequest(), + {}, ], ) def test_delete_destination(request_type, transport: str = "grpc"): @@ -4966,7 +4996,7 @@ def test_delete_destination(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5012,10 +5042,11 @@ def test_delete_destination_non_empty_request_with_auto_populated_field(): client.delete_destination(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_transfer.DeleteDestinationRequest( + request_msg = data_transfer.DeleteDestinationRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_destination_use_cached_wrapped_rpc(): @@ -5110,9 +5141,14 @@ async def test_delete_destination_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_destination_async( - transport: str = "grpc_asyncio", request_type=data_transfer.DeleteDestinationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + data_transfer.DeleteDestinationRequest(), + {}, + ], +) +async def test_delete_destination_async(request_type, transport: str = "grpc_asyncio"): client = DataTransferServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5120,7 +5156,7 @@ async def test_delete_destination_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( @@ -5142,11 +5178,6 @@ async def test_delete_destination_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_destination_async_from_dict(): - await test_delete_destination_async(request_type=dict) - - def test_delete_destination_field_headers(): client = DataTransferServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5301,8 +5332,8 @@ async def test_delete_destination_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_transfer.GetMulticloudDataTransferSupportedServiceRequest, - dict, + data_transfer.GetMulticloudDataTransferSupportedServiceRequest(), + {}, ], ) def test_get_multicloud_data_transfer_supported_service( @@ -5315,7 +5346,7 @@ def test_get_multicloud_data_transfer_supported_service( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5365,11 +5396,10 @@ def test_get_multicloud_data_transfer_supported_service_non_empty_request_with_a client.get_multicloud_data_transfer_supported_service(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == data_transfer.GetMulticloudDataTransferSupportedServiceRequest( + request_msg = data_transfer.GetMulticloudDataTransferSupportedServiceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_multicloud_data_transfer_supported_service_use_cached_wrapped_rpc(): @@ -5455,9 +5485,15 @@ async def test_get_multicloud_data_transfer_supported_service_async_use_cached_w @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_transfer.GetMulticloudDataTransferSupportedServiceRequest(), + {}, + ], +) async def test_get_multicloud_data_transfer_supported_service_async( - transport: str = "grpc_asyncio", - request_type=data_transfer.GetMulticloudDataTransferSupportedServiceRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataTransferServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5466,7 +5502,7 @@ async def test_get_multicloud_data_transfer_supported_service_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( @@ -5492,11 +5528,6 @@ async def test_get_multicloud_data_transfer_supported_service_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_multicloud_data_transfer_supported_service_async_from_dict(): - await test_get_multicloud_data_transfer_supported_service_async(request_type=dict) - - def test_get_multicloud_data_transfer_supported_service_field_headers(): client = DataTransferServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5655,8 +5686,8 @@ async def test_get_multicloud_data_transfer_supported_service_flattened_error_as @pytest.mark.parametrize( "request_type", [ - data_transfer.ListMulticloudDataTransferSupportedServicesRequest, - dict, + data_transfer.ListMulticloudDataTransferSupportedServicesRequest(), + {}, ], ) def test_list_multicloud_data_transfer_supported_services( @@ -5669,7 +5700,7 @@ def test_list_multicloud_data_transfer_supported_services( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5722,12 +5753,11 @@ def test_list_multicloud_data_transfer_supported_services_non_empty_request_with client.list_multicloud_data_transfer_supported_services(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == data_transfer.ListMulticloudDataTransferSupportedServicesRequest( + request_msg = data_transfer.ListMulticloudDataTransferSupportedServicesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_multicloud_data_transfer_supported_services_use_cached_wrapped_rpc(): @@ -5813,9 +5843,15 @@ async def test_list_multicloud_data_transfer_supported_services_async_use_cached @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_transfer.ListMulticloudDataTransferSupportedServicesRequest(), + {}, + ], +) async def test_list_multicloud_data_transfer_supported_services_async( - transport: str = "grpc_asyncio", - request_type=data_transfer.ListMulticloudDataTransferSupportedServicesRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataTransferServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5824,7 +5860,7 @@ async def test_list_multicloud_data_transfer_supported_services_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( @@ -5854,11 +5890,6 @@ async def test_list_multicloud_data_transfer_supported_services_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_multicloud_data_transfer_supported_services_async_from_dict(): - await test_list_multicloud_data_transfer_supported_services_async(request_type=dict) - - def test_list_multicloud_data_transfer_supported_services_field_headers(): client = DataTransferServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6360,7 +6391,6 @@ def test_list_multicloud_data_transfer_configs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_transfer.ListMulticloudDataTransferConfigsRequest() - assert args[0] == request_msg @@ -6383,7 +6413,6 @@ def test_get_multicloud_data_transfer_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_transfer.GetMulticloudDataTransferConfigRequest() - assert args[0] == request_msg @@ -6406,7 +6435,6 @@ def test_create_multicloud_data_transfer_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_transfer.CreateMulticloudDataTransferConfigRequest() - assert args[0] == request_msg @@ -6429,7 +6457,6 @@ def test_update_multicloud_data_transfer_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_transfer.UpdateMulticloudDataTransferConfigRequest() - assert args[0] == request_msg @@ -6452,7 +6479,6 @@ def test_delete_multicloud_data_transfer_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_transfer.DeleteMulticloudDataTransferConfigRequest() - assert args[0] == request_msg @@ -6475,7 +6501,6 @@ def test_list_destinations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_transfer.ListDestinationsRequest() - assert args[0] == request_msg @@ -6496,7 +6521,6 @@ def test_get_destination_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_transfer.GetDestinationRequest() - assert args[0] == request_msg @@ -6519,7 +6543,6 @@ def test_create_destination_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_transfer.CreateDestinationRequest() - assert args[0] == request_msg @@ -6542,7 +6565,6 @@ def test_update_destination_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_transfer.UpdateDestinationRequest() - assert args[0] == request_msg @@ -6565,7 +6587,6 @@ def test_delete_destination_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_transfer.DeleteDestinationRequest() - assert args[0] == request_msg @@ -6589,7 +6610,6 @@ def test_get_multicloud_data_transfer_supported_service_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_transfer.GetMulticloudDataTransferSupportedServiceRequest() - assert args[0] == request_msg @@ -6615,7 +6635,6 @@ def test_list_multicloud_data_transfer_supported_services_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_transfer.ListMulticloudDataTransferSupportedServicesRequest() - assert args[0] == request_msg @@ -6659,7 +6678,6 @@ async def test_list_multicloud_data_transfer_configs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_transfer.ListMulticloudDataTransferConfigsRequest() - assert args[0] == request_msg @@ -6693,7 +6711,6 @@ async def test_get_multicloud_data_transfer_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_transfer.GetMulticloudDataTransferConfigRequest() - assert args[0] == request_msg @@ -6720,7 +6737,6 @@ async def test_create_multicloud_data_transfer_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_transfer.CreateMulticloudDataTransferConfigRequest() - assert args[0] == request_msg @@ -6747,7 +6763,6 @@ async def test_update_multicloud_data_transfer_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_transfer.UpdateMulticloudDataTransferConfigRequest() - assert args[0] == request_msg @@ -6774,7 +6789,6 @@ async def test_delete_multicloud_data_transfer_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_transfer.DeleteMulticloudDataTransferConfigRequest() - assert args[0] == request_msg @@ -6804,7 +6818,6 @@ async def test_list_destinations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_transfer.ListDestinationsRequest() - assert args[0] == request_msg @@ -6835,7 +6848,6 @@ async def test_get_destination_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_transfer.GetDestinationRequest() - assert args[0] == request_msg @@ -6862,7 +6874,6 @@ async def test_create_destination_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_transfer.CreateDestinationRequest() - assert args[0] == request_msg @@ -6889,7 +6900,6 @@ async def test_update_destination_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_transfer.UpdateDestinationRequest() - assert args[0] == request_msg @@ -6916,7 +6926,6 @@ async def test_delete_destination_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_transfer.DeleteDestinationRequest() - assert args[0] == request_msg @@ -6946,7 +6955,6 @@ async def test_get_multicloud_data_transfer_supported_service_empty_call_grpc_as call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_transfer.GetMulticloudDataTransferSupportedServiceRequest() - assert args[0] == request_msg @@ -6976,7 +6984,6 @@ async def test_list_multicloud_data_transfer_supported_services_empty_call_grpc_ call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_transfer.ListMulticloudDataTransferSupportedServicesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-network-connectivity/tests/unit/gapic/networkconnectivity_v1beta/test_hub_service.py b/packages/google-cloud-network-connectivity/tests/unit/gapic/networkconnectivity_v1beta/test_hub_service.py index e28548dc8b83..06ac9858d920 100644 --- a/packages/google-cloud-network-connectivity/tests/unit/gapic/networkconnectivity_v1beta/test_hub_service.py +++ b/packages/google-cloud-network-connectivity/tests/unit/gapic/networkconnectivity_v1beta/test_hub_service.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 @@ -119,6 +120,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" @@ -1263,8 +1279,8 @@ def test_hub_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - hub.ListHubsRequest, - dict, + hub.ListHubsRequest(), + {}, ], ) def test_list_hubs(request_type, transport: str = "grpc"): @@ -1275,7 +1291,7 @@ def test_list_hubs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_hubs), "__call__") as call: @@ -1324,12 +1340,13 @@ def test_list_hubs_non_empty_request_with_auto_populated_field(): client.list_hubs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hub.ListHubsRequest( + request_msg = hub.ListHubsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_hubs_use_cached_wrapped_rpc(): @@ -1408,9 +1425,14 @@ async def test_list_hubs_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_list_hubs_async( - transport: str = "grpc_asyncio", request_type=hub.ListHubsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + hub.ListHubsRequest(), + {}, + ], +) +async def test_list_hubs_async(request_type, transport: str = "grpc_asyncio"): client = HubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1418,7 +1440,7 @@ async def test_list_hubs_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_hubs), "__call__") as call: @@ -1443,11 +1465,6 @@ async def test_list_hubs_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_hubs_async_from_dict(): - await test_list_hubs_async(request_type=dict) - - def test_list_hubs_field_headers(): client = HubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1784,8 +1801,8 @@ async def test_list_hubs_async_pages(): @pytest.mark.parametrize( "request_type", [ - hub.GetHubRequest, - dict, + hub.GetHubRequest(), + {}, ], ) def test_get_hub(request_type, transport: str = "grpc"): @@ -1796,7 +1813,7 @@ def test_get_hub(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_hub), "__call__") as call: @@ -1854,9 +1871,10 @@ def test_get_hub_non_empty_request_with_auto_populated_field(): client.get_hub(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hub.GetHubRequest( + request_msg = hub.GetHubRequest( name="name_value", ) + assert args[0] == request_msg def test_get_hub_use_cached_wrapped_rpc(): @@ -1935,9 +1953,14 @@ async def test_get_hub_async_use_cached_wrapped_rpc(transport: str = "grpc_async @pytest.mark.asyncio -async def test_get_hub_async( - transport: str = "grpc_asyncio", request_type=hub.GetHubRequest -): +@pytest.mark.parametrize( + "request_type", + [ + hub.GetHubRequest(), + {}, + ], +) +async def test_get_hub_async(request_type, transport: str = "grpc_asyncio"): client = HubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1945,7 +1968,7 @@ async def test_get_hub_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_hub), "__call__") as call: @@ -1982,11 +2005,6 @@ async def test_get_hub_async( assert response.export_psc is True -@pytest.mark.asyncio -async def test_get_hub_async_from_dict(): - await test_get_hub_async(request_type=dict) - - def test_get_hub_field_headers(): client = HubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2129,8 +2147,8 @@ async def test_get_hub_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_hub.CreateHubRequest, - dict, + gcn_hub.CreateHubRequest(), + {}, ], ) def test_create_hub(request_type, transport: str = "grpc"): @@ -2141,7 +2159,7 @@ def test_create_hub(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_hub), "__call__") as call: @@ -2184,11 +2202,12 @@ def test_create_hub_non_empty_request_with_auto_populated_field(): client.create_hub(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_hub.CreateHubRequest( + request_msg = gcn_hub.CreateHubRequest( parent="parent_value", hub_id="hub_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_hub_use_cached_wrapped_rpc(): @@ -2277,9 +2296,14 @@ async def test_create_hub_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_create_hub_async( - transport: str = "grpc_asyncio", request_type=gcn_hub.CreateHubRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcn_hub.CreateHubRequest(), + {}, + ], +) +async def test_create_hub_async(request_type, transport: str = "grpc_asyncio"): client = HubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2287,7 +2311,7 @@ async def test_create_hub_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_hub), "__call__") as call: @@ -2307,11 +2331,6 @@ async def test_create_hub_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_hub_async_from_dict(): - await test_create_hub_async(request_type=dict) - - def test_create_hub_field_headers(): client = HubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2478,8 +2497,8 @@ async def test_create_hub_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_hub.UpdateHubRequest, - dict, + gcn_hub.UpdateHubRequest(), + {}, ], ) def test_update_hub(request_type, transport: str = "grpc"): @@ -2490,7 +2509,7 @@ def test_update_hub(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_hub), "__call__") as call: @@ -2531,9 +2550,10 @@ def test_update_hub_non_empty_request_with_auto_populated_field(): client.update_hub(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_hub.UpdateHubRequest( + request_msg = gcn_hub.UpdateHubRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_hub_use_cached_wrapped_rpc(): @@ -2622,9 +2642,14 @@ async def test_update_hub_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_update_hub_async( - transport: str = "grpc_asyncio", request_type=gcn_hub.UpdateHubRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcn_hub.UpdateHubRequest(), + {}, + ], +) +async def test_update_hub_async(request_type, transport: str = "grpc_asyncio"): client = HubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2632,7 +2657,7 @@ async def test_update_hub_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_hub), "__call__") as call: @@ -2652,11 +2677,6 @@ async def test_update_hub_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_hub_async_from_dict(): - await test_update_hub_async(request_type=dict) - - def test_update_hub_field_headers(): client = HubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2813,8 +2833,8 @@ async def test_update_hub_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - hub.DeleteHubRequest, - dict, + hub.DeleteHubRequest(), + {}, ], ) def test_delete_hub(request_type, transport: str = "grpc"): @@ -2825,7 +2845,7 @@ def test_delete_hub(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_hub), "__call__") as call: @@ -2867,10 +2887,11 @@ def test_delete_hub_non_empty_request_with_auto_populated_field(): client.delete_hub(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hub.DeleteHubRequest( + request_msg = hub.DeleteHubRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_hub_use_cached_wrapped_rpc(): @@ -2959,9 +2980,14 @@ async def test_delete_hub_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_delete_hub_async( - transport: str = "grpc_asyncio", request_type=hub.DeleteHubRequest -): +@pytest.mark.parametrize( + "request_type", + [ + hub.DeleteHubRequest(), + {}, + ], +) +async def test_delete_hub_async(request_type, transport: str = "grpc_asyncio"): client = HubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2969,7 +2995,7 @@ async def test_delete_hub_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_hub), "__call__") as call: @@ -2989,11 +3015,6 @@ async def test_delete_hub_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_hub_async_from_dict(): - await test_delete_hub_async(request_type=dict) - - def test_delete_hub_field_headers(): client = HubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3140,8 +3161,8 @@ async def test_delete_hub_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - hub.ListHubSpokesRequest, - dict, + hub.ListHubSpokesRequest(), + {}, ], ) def test_list_hub_spokes(request_type, transport: str = "grpc"): @@ -3152,7 +3173,7 @@ def test_list_hub_spokes(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_hub_spokes), "__call__") as call: @@ -3201,12 +3222,13 @@ def test_list_hub_spokes_non_empty_request_with_auto_populated_field(): client.list_hub_spokes(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hub.ListHubSpokesRequest( + request_msg = hub.ListHubSpokesRequest( name="name_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_hub_spokes_use_cached_wrapped_rpc(): @@ -3287,9 +3309,14 @@ async def test_list_hub_spokes_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_hub_spokes_async( - transport: str = "grpc_asyncio", request_type=hub.ListHubSpokesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + hub.ListHubSpokesRequest(), + {}, + ], +) +async def test_list_hub_spokes_async(request_type, transport: str = "grpc_asyncio"): client = HubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3297,7 +3324,7 @@ async def test_list_hub_spokes_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_hub_spokes), "__call__") as call: @@ -3322,11 +3349,6 @@ async def test_list_hub_spokes_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_hub_spokes_async_from_dict(): - await test_list_hub_spokes_async(request_type=dict) - - def test_list_hub_spokes_field_headers(): client = HubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3663,8 +3685,8 @@ async def test_list_hub_spokes_async_pages(): @pytest.mark.parametrize( "request_type", [ - hub.QueryHubStatusRequest, - dict, + hub.QueryHubStatusRequest(), + {}, ], ) def test_query_hub_status(request_type, transport: str = "grpc"): @@ -3675,7 +3697,7 @@ def test_query_hub_status(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.query_hub_status), "__call__") as call: @@ -3723,13 +3745,14 @@ def test_query_hub_status_non_empty_request_with_auto_populated_field(): client.query_hub_status(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hub.QueryHubStatusRequest( + request_msg = hub.QueryHubStatusRequest( name="name_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", group_by="group_by_value", ) + assert args[0] == request_msg def test_query_hub_status_use_cached_wrapped_rpc(): @@ -3812,9 +3835,14 @@ async def test_query_hub_status_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_query_hub_status_async( - transport: str = "grpc_asyncio", request_type=hub.QueryHubStatusRequest -): +@pytest.mark.parametrize( + "request_type", + [ + hub.QueryHubStatusRequest(), + {}, + ], +) +async def test_query_hub_status_async(request_type, transport: str = "grpc_asyncio"): client = HubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3822,7 +3850,7 @@ async def test_query_hub_status_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.query_hub_status), "__call__") as call: @@ -3845,11 +3873,6 @@ async def test_query_hub_status_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_query_hub_status_async_from_dict(): - await test_query_hub_status_async(request_type=dict) - - def test_query_hub_status_field_headers(): client = HubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4186,8 +4209,8 @@ async def test_query_hub_status_async_pages(): @pytest.mark.parametrize( "request_type", [ - hub.ListSpokesRequest, - dict, + hub.ListSpokesRequest(), + {}, ], ) def test_list_spokes(request_type, transport: str = "grpc"): @@ -4198,7 +4221,7 @@ def test_list_spokes(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_spokes), "__call__") as call: @@ -4247,12 +4270,13 @@ def test_list_spokes_non_empty_request_with_auto_populated_field(): client.list_spokes(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hub.ListSpokesRequest( + request_msg = hub.ListSpokesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_spokes_use_cached_wrapped_rpc(): @@ -4333,9 +4357,14 @@ async def test_list_spokes_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_spokes_async( - transport: str = "grpc_asyncio", request_type=hub.ListSpokesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + hub.ListSpokesRequest(), + {}, + ], +) +async def test_list_spokes_async(request_type, transport: str = "grpc_asyncio"): client = HubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4343,7 +4372,7 @@ async def test_list_spokes_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_spokes), "__call__") as call: @@ -4368,11 +4397,6 @@ async def test_list_spokes_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_spokes_async_from_dict(): - await test_list_spokes_async(request_type=dict) - - def test_list_spokes_field_headers(): client = HubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4709,8 +4733,8 @@ async def test_list_spokes_async_pages(): @pytest.mark.parametrize( "request_type", [ - hub.GetSpokeRequest, - dict, + hub.GetSpokeRequest(), + {}, ], ) def test_get_spoke(request_type, transport: str = "grpc"): @@ -4721,7 +4745,7 @@ def test_get_spoke(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_spoke), "__call__") as call: @@ -4781,9 +4805,10 @@ def test_get_spoke_non_empty_request_with_auto_populated_field(): client.get_spoke(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hub.GetSpokeRequest( + request_msg = hub.GetSpokeRequest( name="name_value", ) + assert args[0] == request_msg def test_get_spoke_use_cached_wrapped_rpc(): @@ -4862,9 +4887,14 @@ async def test_get_spoke_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_spoke_async( - transport: str = "grpc_asyncio", request_type=hub.GetSpokeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + hub.GetSpokeRequest(), + {}, + ], +) +async def test_get_spoke_async(request_type, transport: str = "grpc_asyncio"): client = HubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4872,7 +4902,7 @@ async def test_get_spoke_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_spoke), "__call__") as call: @@ -4911,11 +4941,6 @@ async def test_get_spoke_async( assert response.field_paths_pending_update == ["field_paths_pending_update_value"] -@pytest.mark.asyncio -async def test_get_spoke_async_from_dict(): - await test_get_spoke_async(request_type=dict) - - def test_get_spoke_field_headers(): client = HubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5058,8 +5083,8 @@ async def test_get_spoke_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - hub.CreateSpokeRequest, - dict, + hub.CreateSpokeRequest(), + {}, ], ) def test_create_spoke(request_type, transport: str = "grpc"): @@ -5070,7 +5095,7 @@ def test_create_spoke(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_spoke), "__call__") as call: @@ -5113,11 +5138,12 @@ def test_create_spoke_non_empty_request_with_auto_populated_field(): client.create_spoke(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hub.CreateSpokeRequest( + request_msg = hub.CreateSpokeRequest( parent="parent_value", spoke_id="spoke_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_spoke_use_cached_wrapped_rpc(): @@ -5208,9 +5234,14 @@ async def test_create_spoke_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_spoke_async( - transport: str = "grpc_asyncio", request_type=hub.CreateSpokeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + hub.CreateSpokeRequest(), + {}, + ], +) +async def test_create_spoke_async(request_type, transport: str = "grpc_asyncio"): client = HubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5218,7 +5249,7 @@ async def test_create_spoke_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_spoke), "__call__") as call: @@ -5238,11 +5269,6 @@ async def test_create_spoke_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_spoke_async_from_dict(): - await test_create_spoke_async(request_type=dict) - - def test_create_spoke_field_headers(): client = HubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5409,8 +5435,8 @@ async def test_create_spoke_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - hub.UpdateSpokeRequest, - dict, + hub.UpdateSpokeRequest(), + {}, ], ) def test_update_spoke(request_type, transport: str = "grpc"): @@ -5421,7 +5447,7 @@ def test_update_spoke(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_spoke), "__call__") as call: @@ -5462,9 +5488,10 @@ def test_update_spoke_non_empty_request_with_auto_populated_field(): client.update_spoke(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hub.UpdateSpokeRequest( + request_msg = hub.UpdateSpokeRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_spoke_use_cached_wrapped_rpc(): @@ -5555,9 +5582,14 @@ async def test_update_spoke_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_spoke_async( - transport: str = "grpc_asyncio", request_type=hub.UpdateSpokeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + hub.UpdateSpokeRequest(), + {}, + ], +) +async def test_update_spoke_async(request_type, transport: str = "grpc_asyncio"): client = HubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5565,7 +5597,7 @@ async def test_update_spoke_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_spoke), "__call__") as call: @@ -5585,11 +5617,6 @@ async def test_update_spoke_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_spoke_async_from_dict(): - await test_update_spoke_async(request_type=dict) - - def test_update_spoke_field_headers(): client = HubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5746,8 +5773,8 @@ async def test_update_spoke_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - hub.RejectHubSpokeRequest, - dict, + hub.RejectHubSpokeRequest(), + {}, ], ) def test_reject_hub_spoke(request_type, transport: str = "grpc"): @@ -5758,7 +5785,7 @@ def test_reject_hub_spoke(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.reject_hub_spoke), "__call__") as call: @@ -5802,12 +5829,13 @@ def test_reject_hub_spoke_non_empty_request_with_auto_populated_field(): client.reject_hub_spoke(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hub.RejectHubSpokeRequest( + request_msg = hub.RejectHubSpokeRequest( name="name_value", spoke_uri="spoke_uri_value", request_id="request_id_value", details="details_value", ) + assert args[0] == request_msg def test_reject_hub_spoke_use_cached_wrapped_rpc(): @@ -5900,9 +5928,14 @@ async def test_reject_hub_spoke_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_reject_hub_spoke_async( - transport: str = "grpc_asyncio", request_type=hub.RejectHubSpokeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + hub.RejectHubSpokeRequest(), + {}, + ], +) +async def test_reject_hub_spoke_async(request_type, transport: str = "grpc_asyncio"): client = HubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5910,7 +5943,7 @@ async def test_reject_hub_spoke_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.reject_hub_spoke), "__call__") as call: @@ -5930,11 +5963,6 @@ async def test_reject_hub_spoke_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_reject_hub_spoke_async_from_dict(): - await test_reject_hub_spoke_async(request_type=dict) - - def test_reject_hub_spoke_field_headers(): client = HubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6091,8 +6119,8 @@ async def test_reject_hub_spoke_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - hub.AcceptHubSpokeRequest, - dict, + hub.AcceptHubSpokeRequest(), + {}, ], ) def test_accept_hub_spoke(request_type, transport: str = "grpc"): @@ -6103,7 +6131,7 @@ def test_accept_hub_spoke(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.accept_hub_spoke), "__call__") as call: @@ -6146,11 +6174,12 @@ def test_accept_hub_spoke_non_empty_request_with_auto_populated_field(): client.accept_hub_spoke(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hub.AcceptHubSpokeRequest( + request_msg = hub.AcceptHubSpokeRequest( name="name_value", spoke_uri="spoke_uri_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_accept_hub_spoke_use_cached_wrapped_rpc(): @@ -6243,9 +6272,14 @@ async def test_accept_hub_spoke_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_accept_hub_spoke_async( - transport: str = "grpc_asyncio", request_type=hub.AcceptHubSpokeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + hub.AcceptHubSpokeRequest(), + {}, + ], +) +async def test_accept_hub_spoke_async(request_type, transport: str = "grpc_asyncio"): client = HubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6253,7 +6287,7 @@ async def test_accept_hub_spoke_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.accept_hub_spoke), "__call__") as call: @@ -6273,11 +6307,6 @@ async def test_accept_hub_spoke_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_accept_hub_spoke_async_from_dict(): - await test_accept_hub_spoke_async(request_type=dict) - - def test_accept_hub_spoke_field_headers(): client = HubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6434,8 +6463,8 @@ async def test_accept_hub_spoke_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - hub.AcceptSpokeUpdateRequest, - dict, + hub.AcceptSpokeUpdateRequest(), + {}, ], ) def test_accept_spoke_update(request_type, transport: str = "grpc"): @@ -6446,7 +6475,7 @@ def test_accept_spoke_update(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6493,11 +6522,12 @@ def test_accept_spoke_update_non_empty_request_with_auto_populated_field(): client.accept_spoke_update(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hub.AcceptSpokeUpdateRequest( + request_msg = hub.AcceptSpokeUpdateRequest( name="name_value", spoke_uri="spoke_uri_value", spoke_etag="spoke_etag_value", ) + assert args[0] == request_msg def test_accept_spoke_update_use_cached_wrapped_rpc(): @@ -6592,9 +6622,14 @@ async def test_accept_spoke_update_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_accept_spoke_update_async( - transport: str = "grpc_asyncio", request_type=hub.AcceptSpokeUpdateRequest -): +@pytest.mark.parametrize( + "request_type", + [ + hub.AcceptSpokeUpdateRequest(), + {}, + ], +) +async def test_accept_spoke_update_async(request_type, transport: str = "grpc_asyncio"): client = HubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6602,7 +6637,7 @@ async def test_accept_spoke_update_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( @@ -6624,11 +6659,6 @@ async def test_accept_spoke_update_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_accept_spoke_update_async_from_dict(): - await test_accept_spoke_update_async(request_type=dict) - - def test_accept_spoke_update_field_headers(): client = HubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6803,8 +6833,8 @@ async def test_accept_spoke_update_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - hub.RejectSpokeUpdateRequest, - dict, + hub.RejectSpokeUpdateRequest(), + {}, ], ) def test_reject_spoke_update(request_type, transport: str = "grpc"): @@ -6815,7 +6845,7 @@ def test_reject_spoke_update(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6863,12 +6893,13 @@ def test_reject_spoke_update_non_empty_request_with_auto_populated_field(): client.reject_spoke_update(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hub.RejectSpokeUpdateRequest( + request_msg = hub.RejectSpokeUpdateRequest( name="name_value", spoke_uri="spoke_uri_value", spoke_etag="spoke_etag_value", details="details_value", ) + assert args[0] == request_msg def test_reject_spoke_update_use_cached_wrapped_rpc(): @@ -6963,9 +6994,14 @@ async def test_reject_spoke_update_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_reject_spoke_update_async( - transport: str = "grpc_asyncio", request_type=hub.RejectSpokeUpdateRequest -): +@pytest.mark.parametrize( + "request_type", + [ + hub.RejectSpokeUpdateRequest(), + {}, + ], +) +async def test_reject_spoke_update_async(request_type, transport: str = "grpc_asyncio"): client = HubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6973,7 +7009,7 @@ async def test_reject_spoke_update_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( @@ -6995,11 +7031,6 @@ async def test_reject_spoke_update_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_reject_spoke_update_async_from_dict(): - await test_reject_spoke_update_async(request_type=dict) - - def test_reject_spoke_update_field_headers(): client = HubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7174,8 +7205,8 @@ async def test_reject_spoke_update_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - hub.DeleteSpokeRequest, - dict, + hub.DeleteSpokeRequest(), + {}, ], ) def test_delete_spoke(request_type, transport: str = "grpc"): @@ -7186,7 +7217,7 @@ def test_delete_spoke(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_spoke), "__call__") as call: @@ -7228,10 +7259,11 @@ def test_delete_spoke_non_empty_request_with_auto_populated_field(): client.delete_spoke(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hub.DeleteSpokeRequest( + request_msg = hub.DeleteSpokeRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_spoke_use_cached_wrapped_rpc(): @@ -7322,9 +7354,14 @@ async def test_delete_spoke_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_spoke_async( - transport: str = "grpc_asyncio", request_type=hub.DeleteSpokeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + hub.DeleteSpokeRequest(), + {}, + ], +) +async def test_delete_spoke_async(request_type, transport: str = "grpc_asyncio"): client = HubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7332,7 +7369,7 @@ async def test_delete_spoke_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_spoke), "__call__") as call: @@ -7352,11 +7389,6 @@ async def test_delete_spoke_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_spoke_async_from_dict(): - await test_delete_spoke_async(request_type=dict) - - def test_delete_spoke_field_headers(): client = HubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7503,8 +7535,8 @@ async def test_delete_spoke_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - hub.GetRouteTableRequest, - dict, + hub.GetRouteTableRequest(), + {}, ], ) def test_get_route_table(request_type, transport: str = "grpc"): @@ -7515,7 +7547,7 @@ def test_get_route_table(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_route_table), "__call__") as call: @@ -7565,9 +7597,10 @@ def test_get_route_table_non_empty_request_with_auto_populated_field(): client.get_route_table(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hub.GetRouteTableRequest( + request_msg = hub.GetRouteTableRequest( name="name_value", ) + assert args[0] == request_msg def test_get_route_table_use_cached_wrapped_rpc(): @@ -7648,9 +7681,14 @@ async def test_get_route_table_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_route_table_async( - transport: str = "grpc_asyncio", request_type=hub.GetRouteTableRequest -): +@pytest.mark.parametrize( + "request_type", + [ + hub.GetRouteTableRequest(), + {}, + ], +) +async def test_get_route_table_async(request_type, transport: str = "grpc_asyncio"): client = HubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7658,7 +7696,7 @@ async def test_get_route_table_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_route_table), "__call__") as call: @@ -7687,11 +7725,6 @@ async def test_get_route_table_async( assert response.state == hub.State.CREATING -@pytest.mark.asyncio -async def test_get_route_table_async_from_dict(): - await test_get_route_table_async(request_type=dict) - - def test_get_route_table_field_headers(): client = HubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7834,8 +7867,8 @@ async def test_get_route_table_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - hub.GetRouteRequest, - dict, + hub.GetRouteRequest(), + {}, ], ) def test_get_route(request_type, transport: str = "grpc"): @@ -7846,7 +7879,7 @@ def test_get_route(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_route), "__call__") as call: @@ -7906,9 +7939,10 @@ def test_get_route_non_empty_request_with_auto_populated_field(): client.get_route(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hub.GetRouteRequest( + request_msg = hub.GetRouteRequest( name="name_value", ) + assert args[0] == request_msg def test_get_route_use_cached_wrapped_rpc(): @@ -7987,9 +8021,14 @@ async def test_get_route_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_route_async( - transport: str = "grpc_asyncio", request_type=hub.GetRouteRequest -): +@pytest.mark.parametrize( + "request_type", + [ + hub.GetRouteRequest(), + {}, + ], +) +async def test_get_route_async(request_type, transport: str = "grpc_asyncio"): client = HubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7997,7 +8036,7 @@ async def test_get_route_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_route), "__call__") as call: @@ -8036,11 +8075,6 @@ async def test_get_route_async( assert response.priority == 898 -@pytest.mark.asyncio -async def test_get_route_async_from_dict(): - await test_get_route_async(request_type=dict) - - def test_get_route_field_headers(): client = HubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8183,8 +8217,8 @@ async def test_get_route_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - hub.ListRoutesRequest, - dict, + hub.ListRoutesRequest(), + {}, ], ) def test_list_routes(request_type, transport: str = "grpc"): @@ -8195,7 +8229,7 @@ def test_list_routes(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_routes), "__call__") as call: @@ -8244,12 +8278,13 @@ def test_list_routes_non_empty_request_with_auto_populated_field(): client.list_routes(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hub.ListRoutesRequest( + request_msg = hub.ListRoutesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_routes_use_cached_wrapped_rpc(): @@ -8330,9 +8365,14 @@ async def test_list_routes_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_routes_async( - transport: str = "grpc_asyncio", request_type=hub.ListRoutesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + hub.ListRoutesRequest(), + {}, + ], +) +async def test_list_routes_async(request_type, transport: str = "grpc_asyncio"): client = HubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8340,7 +8380,7 @@ async def test_list_routes_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_routes), "__call__") as call: @@ -8365,11 +8405,6 @@ async def test_list_routes_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_routes_async_from_dict(): - await test_list_routes_async(request_type=dict) - - def test_list_routes_field_headers(): client = HubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8706,8 +8741,8 @@ async def test_list_routes_async_pages(): @pytest.mark.parametrize( "request_type", [ - hub.ListRouteTablesRequest, - dict, + hub.ListRouteTablesRequest(), + {}, ], ) def test_list_route_tables(request_type, transport: str = "grpc"): @@ -8718,7 +8753,7 @@ def test_list_route_tables(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8771,12 +8806,13 @@ def test_list_route_tables_non_empty_request_with_auto_populated_field(): client.list_route_tables(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hub.ListRouteTablesRequest( + request_msg = hub.ListRouteTablesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_route_tables_use_cached_wrapped_rpc(): @@ -8859,9 +8895,14 @@ async def test_list_route_tables_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_route_tables_async( - transport: str = "grpc_asyncio", request_type=hub.ListRouteTablesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + hub.ListRouteTablesRequest(), + {}, + ], +) +async def test_list_route_tables_async(request_type, transport: str = "grpc_asyncio"): client = HubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8869,7 +8910,7 @@ async def test_list_route_tables_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( @@ -8896,11 +8937,6 @@ async def test_list_route_tables_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_route_tables_async_from_dict(): - await test_list_route_tables_async(request_type=dict) - - def test_list_route_tables_field_headers(): client = HubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9253,8 +9289,8 @@ async def test_list_route_tables_async_pages(): @pytest.mark.parametrize( "request_type", [ - hub.GetGroupRequest, - dict, + hub.GetGroupRequest(), + {}, ], ) def test_get_group(request_type, transport: str = "grpc"): @@ -9265,7 +9301,7 @@ def test_get_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_group), "__call__") as call: @@ -9317,9 +9353,10 @@ def test_get_group_non_empty_request_with_auto_populated_field(): client.get_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hub.GetGroupRequest( + request_msg = hub.GetGroupRequest( name="name_value", ) + assert args[0] == request_msg def test_get_group_use_cached_wrapped_rpc(): @@ -9398,9 +9435,14 @@ async def test_get_group_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_group_async( - transport: str = "grpc_asyncio", request_type=hub.GetGroupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + hub.GetGroupRequest(), + {}, + ], +) +async def test_get_group_async(request_type, transport: str = "grpc_asyncio"): client = HubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9408,7 +9450,7 @@ async def test_get_group_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_group), "__call__") as call: @@ -9439,11 +9481,6 @@ async def test_get_group_async( assert response.route_table == "route_table_value" -@pytest.mark.asyncio -async def test_get_group_async_from_dict(): - await test_get_group_async(request_type=dict) - - def test_get_group_field_headers(): client = HubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9586,8 +9623,8 @@ async def test_get_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - hub.ListGroupsRequest, - dict, + hub.ListGroupsRequest(), + {}, ], ) def test_list_groups(request_type, transport: str = "grpc"): @@ -9598,7 +9635,7 @@ def test_list_groups(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_groups), "__call__") as call: @@ -9647,12 +9684,13 @@ def test_list_groups_non_empty_request_with_auto_populated_field(): client.list_groups(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hub.ListGroupsRequest( + request_msg = hub.ListGroupsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_groups_use_cached_wrapped_rpc(): @@ -9733,9 +9771,14 @@ async def test_list_groups_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_groups_async( - transport: str = "grpc_asyncio", request_type=hub.ListGroupsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + hub.ListGroupsRequest(), + {}, + ], +) +async def test_list_groups_async(request_type, transport: str = "grpc_asyncio"): client = HubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9743,7 +9786,7 @@ async def test_list_groups_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_groups), "__call__") as call: @@ -9768,11 +9811,6 @@ async def test_list_groups_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_groups_async_from_dict(): - await test_list_groups_async(request_type=dict) - - def test_list_groups_field_headers(): client = HubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10109,8 +10147,8 @@ async def test_list_groups_async_pages(): @pytest.mark.parametrize( "request_type", [ - hub.UpdateGroupRequest, - dict, + hub.UpdateGroupRequest(), + {}, ], ) def test_update_group(request_type, transport: str = "grpc"): @@ -10121,7 +10159,7 @@ def test_update_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_group), "__call__") as call: @@ -10162,9 +10200,10 @@ def test_update_group_non_empty_request_with_auto_populated_field(): client.update_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hub.UpdateGroupRequest( + request_msg = hub.UpdateGroupRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_group_use_cached_wrapped_rpc(): @@ -10255,9 +10294,14 @@ async def test_update_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_group_async( - transport: str = "grpc_asyncio", request_type=hub.UpdateGroupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + hub.UpdateGroupRequest(), + {}, + ], +) +async def test_update_group_async(request_type, transport: str = "grpc_asyncio"): client = HubServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10265,7 +10309,7 @@ async def test_update_group_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_group), "__call__") as call: @@ -10285,11 +10329,6 @@ async def test_update_group_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_group_async_from_dict(): - await test_update_group_async(request_type=dict) - - def test_update_group_field_headers(): client = HubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10446,8 +10485,8 @@ async def test_update_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - hub.CreateGatewayAdvertisedRouteRequest, - dict, + hub.CreateGatewayAdvertisedRouteRequest(), + {}, ], ) def test_create_gateway_advertised_route(request_type, transport: str = "grpc"): @@ -10458,7 +10497,7 @@ def test_create_gateway_advertised_route(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10504,10 +10543,11 @@ def test_create_gateway_advertised_route_non_empty_request_with_auto_populated_f client.create_gateway_advertised_route(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hub.CreateGatewayAdvertisedRouteRequest( + request_msg = hub.CreateGatewayAdvertisedRouteRequest( parent="parent_value", gateway_advertised_route_id="gateway_advertised_route_id_value", ) + assert args[0] == request_msg def test_create_gateway_advertised_route_use_cached_wrapped_rpc(): @@ -10603,9 +10643,15 @@ async def test_create_gateway_advertised_route_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + hub.CreateGatewayAdvertisedRouteRequest(), + {}, + ], +) async def test_create_gateway_advertised_route_async( - transport: str = "grpc_asyncio", - request_type=hub.CreateGatewayAdvertisedRouteRequest, + request_type, transport: str = "grpc_asyncio" ): client = HubServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -10614,7 +10660,7 @@ async def test_create_gateway_advertised_route_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( @@ -10636,11 +10682,6 @@ async def test_create_gateway_advertised_route_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_gateway_advertised_route_async_from_dict(): - await test_create_gateway_advertised_route_async(request_type=dict) - - def test_create_gateway_advertised_route_field_headers(): client = HubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10815,8 +10856,8 @@ async def test_create_gateway_advertised_route_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - hub.GetGatewayAdvertisedRouteRequest, - dict, + hub.GetGatewayAdvertisedRouteRequest(), + {}, ], ) def test_get_gateway_advertised_route(request_type, transport: str = "grpc"): @@ -10827,7 +10868,7 @@ def test_get_gateway_advertised_route(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10887,9 +10928,10 @@ def test_get_gateway_advertised_route_non_empty_request_with_auto_populated_fiel client.get_gateway_advertised_route(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hub.GetGatewayAdvertisedRouteRequest( + request_msg = hub.GetGatewayAdvertisedRouteRequest( name="name_value", ) + assert args[0] == request_msg def test_get_gateway_advertised_route_use_cached_wrapped_rpc(): @@ -10975,8 +11017,15 @@ async def test_get_gateway_advertised_route_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + hub.GetGatewayAdvertisedRouteRequest(), + {}, + ], +) async def test_get_gateway_advertised_route_async( - transport: str = "grpc_asyncio", request_type=hub.GetGatewayAdvertisedRouteRequest + request_type, transport: str = "grpc_asyncio" ): client = HubServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -10985,7 +11034,7 @@ async def test_get_gateway_advertised_route_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( @@ -11022,11 +11071,6 @@ async def test_get_gateway_advertised_route_async( assert response.recipient == hub.GatewayAdvertisedRoute.Recipient.ADVERTISE_TO_HUB -@pytest.mark.asyncio -async def test_get_gateway_advertised_route_async_from_dict(): - await test_get_gateway_advertised_route_async(request_type=dict) - - def test_get_gateway_advertised_route_field_headers(): client = HubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11181,8 +11225,8 @@ async def test_get_gateway_advertised_route_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - hub.ListGatewayAdvertisedRoutesRequest, - dict, + hub.ListGatewayAdvertisedRoutesRequest(), + {}, ], ) def test_list_gateway_advertised_routes(request_type, transport: str = "grpc"): @@ -11193,7 +11237,7 @@ def test_list_gateway_advertised_routes(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11246,12 +11290,13 @@ def test_list_gateway_advertised_routes_non_empty_request_with_auto_populated_fi client.list_gateway_advertised_routes(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hub.ListGatewayAdvertisedRoutesRequest( + request_msg = hub.ListGatewayAdvertisedRoutesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_gateway_advertised_routes_use_cached_wrapped_rpc(): @@ -11337,8 +11382,15 @@ async def test_list_gateway_advertised_routes_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + hub.ListGatewayAdvertisedRoutesRequest(), + {}, + ], +) async def test_list_gateway_advertised_routes_async( - transport: str = "grpc_asyncio", request_type=hub.ListGatewayAdvertisedRoutesRequest + request_type, transport: str = "grpc_asyncio" ): client = HubServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -11347,7 +11399,7 @@ async def test_list_gateway_advertised_routes_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( @@ -11374,11 +11426,6 @@ async def test_list_gateway_advertised_routes_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_gateway_advertised_routes_async_from_dict(): - await test_list_gateway_advertised_routes_async(request_type=dict) - - def test_list_gateway_advertised_routes_field_headers(): client = HubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11735,8 +11782,8 @@ async def test_list_gateway_advertised_routes_async_pages(): @pytest.mark.parametrize( "request_type", [ - hub.UpdateGatewayAdvertisedRouteRequest, - dict, + hub.UpdateGatewayAdvertisedRouteRequest(), + {}, ], ) def test_update_gateway_advertised_route(request_type, transport: str = "grpc"): @@ -11747,7 +11794,7 @@ def test_update_gateway_advertised_route(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11790,7 +11837,8 @@ def test_update_gateway_advertised_route_non_empty_request_with_auto_populated_f client.update_gateway_advertised_route(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hub.UpdateGatewayAdvertisedRouteRequest() + request_msg = hub.UpdateGatewayAdvertisedRouteRequest() + assert args[0] == request_msg def test_update_gateway_advertised_route_use_cached_wrapped_rpc(): @@ -11886,9 +11934,15 @@ async def test_update_gateway_advertised_route_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + hub.UpdateGatewayAdvertisedRouteRequest(), + {}, + ], +) async def test_update_gateway_advertised_route_async( - transport: str = "grpc_asyncio", - request_type=hub.UpdateGatewayAdvertisedRouteRequest, + request_type, transport: str = "grpc_asyncio" ): client = HubServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -11897,7 +11951,7 @@ async def test_update_gateway_advertised_route_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( @@ -11919,11 +11973,6 @@ async def test_update_gateway_advertised_route_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_gateway_advertised_route_async_from_dict(): - await test_update_gateway_advertised_route_async(request_type=dict) - - def test_update_gateway_advertised_route_field_headers(): client = HubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12088,8 +12137,8 @@ async def test_update_gateway_advertised_route_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - hub.DeleteGatewayAdvertisedRouteRequest, - dict, + hub.DeleteGatewayAdvertisedRouteRequest(), + {}, ], ) def test_delete_gateway_advertised_route(request_type, transport: str = "grpc"): @@ -12100,7 +12149,7 @@ def test_delete_gateway_advertised_route(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -12145,9 +12194,10 @@ def test_delete_gateway_advertised_route_non_empty_request_with_auto_populated_f client.delete_gateway_advertised_route(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == hub.DeleteGatewayAdvertisedRouteRequest( + request_msg = hub.DeleteGatewayAdvertisedRouteRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_gateway_advertised_route_use_cached_wrapped_rpc(): @@ -12243,9 +12293,15 @@ async def test_delete_gateway_advertised_route_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + hub.DeleteGatewayAdvertisedRouteRequest(), + {}, + ], +) async def test_delete_gateway_advertised_route_async( - transport: str = "grpc_asyncio", - request_type=hub.DeleteGatewayAdvertisedRouteRequest, + request_type, transport: str = "grpc_asyncio" ): client = HubServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -12254,7 +12310,7 @@ async def test_delete_gateway_advertised_route_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( @@ -12276,11 +12332,6 @@ async def test_delete_gateway_advertised_route_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_gateway_advertised_route_async_from_dict(): - await test_delete_gateway_advertised_route_async(request_type=dict) - - def test_delete_gateway_advertised_route_field_headers(): client = HubServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12554,7 +12605,6 @@ def test_list_hubs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.ListHubsRequest() - assert args[0] == request_msg @@ -12575,7 +12625,6 @@ def test_get_hub_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.GetHubRequest() - assert args[0] == request_msg @@ -12596,7 +12645,6 @@ def test_create_hub_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_hub.CreateHubRequest() - assert args[0] == request_msg @@ -12617,7 +12665,6 @@ def test_update_hub_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_hub.UpdateHubRequest() - assert args[0] == request_msg @@ -12638,7 +12685,6 @@ def test_delete_hub_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.DeleteHubRequest() - assert args[0] == request_msg @@ -12659,7 +12705,6 @@ def test_list_hub_spokes_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.ListHubSpokesRequest() - assert args[0] == request_msg @@ -12680,7 +12725,6 @@ def test_query_hub_status_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.QueryHubStatusRequest() - assert args[0] == request_msg @@ -12701,7 +12745,6 @@ def test_list_spokes_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.ListSpokesRequest() - assert args[0] == request_msg @@ -12722,7 +12765,6 @@ def test_get_spoke_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.GetSpokeRequest() - assert args[0] == request_msg @@ -12743,7 +12785,6 @@ def test_create_spoke_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.CreateSpokeRequest() - assert args[0] == request_msg @@ -12764,7 +12805,6 @@ def test_update_spoke_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.UpdateSpokeRequest() - assert args[0] == request_msg @@ -12785,7 +12825,6 @@ def test_reject_hub_spoke_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.RejectHubSpokeRequest() - assert args[0] == request_msg @@ -12806,7 +12845,6 @@ def test_accept_hub_spoke_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.AcceptHubSpokeRequest() - assert args[0] == request_msg @@ -12829,7 +12867,6 @@ def test_accept_spoke_update_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.AcceptSpokeUpdateRequest() - assert args[0] == request_msg @@ -12852,7 +12889,6 @@ def test_reject_spoke_update_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.RejectSpokeUpdateRequest() - assert args[0] == request_msg @@ -12873,7 +12909,6 @@ def test_delete_spoke_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.DeleteSpokeRequest() - assert args[0] == request_msg @@ -12894,7 +12929,6 @@ def test_get_route_table_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.GetRouteTableRequest() - assert args[0] == request_msg @@ -12915,7 +12949,6 @@ def test_get_route_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.GetRouteRequest() - assert args[0] == request_msg @@ -12936,7 +12969,6 @@ def test_list_routes_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.ListRoutesRequest() - assert args[0] == request_msg @@ -12959,7 +12991,6 @@ def test_list_route_tables_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.ListRouteTablesRequest() - assert args[0] == request_msg @@ -12980,7 +13011,6 @@ def test_get_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.GetGroupRequest() - assert args[0] == request_msg @@ -13001,7 +13031,6 @@ def test_list_groups_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.ListGroupsRequest() - assert args[0] == request_msg @@ -13022,7 +13051,6 @@ def test_update_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.UpdateGroupRequest() - assert args[0] == request_msg @@ -13045,7 +13073,6 @@ def test_create_gateway_advertised_route_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.CreateGatewayAdvertisedRouteRequest() - assert args[0] == request_msg @@ -13068,7 +13095,6 @@ def test_get_gateway_advertised_route_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.GetGatewayAdvertisedRouteRequest() - assert args[0] == request_msg @@ -13091,7 +13117,6 @@ def test_list_gateway_advertised_routes_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.ListGatewayAdvertisedRoutesRequest() - assert args[0] == request_msg @@ -13114,7 +13139,6 @@ def test_update_gateway_advertised_route_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.UpdateGatewayAdvertisedRouteRequest() - assert args[0] == request_msg @@ -13137,7 +13161,6 @@ def test_delete_gateway_advertised_route_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.DeleteGatewayAdvertisedRouteRequest() - assert args[0] == request_msg @@ -13179,7 +13202,6 @@ async def test_list_hubs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.ListHubsRequest() - assert args[0] == request_msg @@ -13213,7 +13235,6 @@ async def test_get_hub_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.GetHubRequest() - assert args[0] == request_msg @@ -13238,7 +13259,6 @@ async def test_create_hub_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_hub.CreateHubRequest() - assert args[0] == request_msg @@ -13263,7 +13283,6 @@ async def test_update_hub_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_hub.UpdateHubRequest() - assert args[0] == request_msg @@ -13288,7 +13307,6 @@ async def test_delete_hub_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.DeleteHubRequest() - assert args[0] == request_msg @@ -13316,7 +13334,6 @@ async def test_list_hub_spokes_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.ListHubSpokesRequest() - assert args[0] == request_msg @@ -13343,7 +13360,6 @@ async def test_query_hub_status_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.QueryHubStatusRequest() - assert args[0] == request_msg @@ -13371,7 +13387,6 @@ async def test_list_spokes_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.ListSpokesRequest() - assert args[0] == request_msg @@ -13406,7 +13421,6 @@ async def test_get_spoke_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.GetSpokeRequest() - assert args[0] == request_msg @@ -13431,7 +13445,6 @@ async def test_create_spoke_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.CreateSpokeRequest() - assert args[0] == request_msg @@ -13456,7 +13469,6 @@ async def test_update_spoke_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.UpdateSpokeRequest() - assert args[0] == request_msg @@ -13481,7 +13493,6 @@ async def test_reject_hub_spoke_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.RejectHubSpokeRequest() - assert args[0] == request_msg @@ -13506,7 +13517,6 @@ async def test_accept_hub_spoke_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.AcceptHubSpokeRequest() - assert args[0] == request_msg @@ -13533,7 +13543,6 @@ async def test_accept_spoke_update_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.AcceptSpokeUpdateRequest() - assert args[0] == request_msg @@ -13560,7 +13569,6 @@ async def test_reject_spoke_update_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.RejectSpokeUpdateRequest() - assert args[0] == request_msg @@ -13585,7 +13593,6 @@ async def test_delete_spoke_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.DeleteSpokeRequest() - assert args[0] == request_msg @@ -13615,7 +13622,6 @@ async def test_get_route_table_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.GetRouteTableRequest() - assert args[0] == request_msg @@ -13650,7 +13656,6 @@ async def test_get_route_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.GetRouteRequest() - assert args[0] == request_msg @@ -13678,7 +13683,6 @@ async def test_list_routes_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.ListRoutesRequest() - assert args[0] == request_msg @@ -13708,7 +13712,6 @@ async def test_list_route_tables_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.ListRouteTablesRequest() - assert args[0] == request_msg @@ -13739,7 +13742,6 @@ async def test_get_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.GetGroupRequest() - assert args[0] == request_msg @@ -13767,7 +13769,6 @@ async def test_list_groups_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.ListGroupsRequest() - assert args[0] == request_msg @@ -13792,7 +13793,6 @@ async def test_update_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.UpdateGroupRequest() - assert args[0] == request_msg @@ -13819,7 +13819,6 @@ async def test_create_gateway_advertised_route_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.CreateGatewayAdvertisedRouteRequest() - assert args[0] == request_msg @@ -13854,7 +13853,6 @@ async def test_get_gateway_advertised_route_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.GetGatewayAdvertisedRouteRequest() - assert args[0] == request_msg @@ -13884,7 +13882,6 @@ async def test_list_gateway_advertised_routes_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.ListGatewayAdvertisedRoutesRequest() - assert args[0] == request_msg @@ -13911,7 +13908,6 @@ async def test_update_gateway_advertised_route_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.UpdateGatewayAdvertisedRouteRequest() - assert args[0] == request_msg @@ -13938,7 +13934,6 @@ async def test_delete_gateway_advertised_route_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = hub.DeleteGatewayAdvertisedRouteRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-network-connectivity/tests/unit/gapic/networkconnectivity_v1beta/test_policy_based_routing_service.py b/packages/google-cloud-network-connectivity/tests/unit/gapic/networkconnectivity_v1beta/test_policy_based_routing_service.py index 70d95b0c20ab..ab91baaba747 100644 --- a/packages/google-cloud-network-connectivity/tests/unit/gapic/networkconnectivity_v1beta/test_policy_based_routing_service.py +++ b/packages/google-cloud-network-connectivity/tests/unit/gapic/networkconnectivity_v1beta/test_policy_based_routing_service.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 @@ -117,6 +118,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" @@ -1359,8 +1375,8 @@ def test_policy_based_routing_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - policy_based_routing.ListPolicyBasedRoutesRequest, - dict, + policy_based_routing.ListPolicyBasedRoutesRequest(), + {}, ], ) def test_list_policy_based_routes(request_type, transport: str = "grpc"): @@ -1371,7 +1387,7 @@ def test_list_policy_based_routes(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1424,12 +1440,13 @@ def test_list_policy_based_routes_non_empty_request_with_auto_populated_field(): client.list_policy_based_routes(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == policy_based_routing.ListPolicyBasedRoutesRequest( + request_msg = policy_based_routing.ListPolicyBasedRoutesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_policy_based_routes_use_cached_wrapped_rpc(): @@ -1515,9 +1532,15 @@ async def test_list_policy_based_routes_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + policy_based_routing.ListPolicyBasedRoutesRequest(), + {}, + ], +) async def test_list_policy_based_routes_async( - transport: str = "grpc_asyncio", - request_type=policy_based_routing.ListPolicyBasedRoutesRequest, + request_type, transport: str = "grpc_asyncio" ): client = PolicyBasedRoutingServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1526,7 +1549,7 @@ async def test_list_policy_based_routes_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( @@ -1553,11 +1576,6 @@ async def test_list_policy_based_routes_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_policy_based_routes_async_from_dict(): - await test_list_policy_based_routes_async(request_type=dict) - - def test_list_policy_based_routes_field_headers(): client = PolicyBasedRoutingServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1916,8 +1934,8 @@ async def test_list_policy_based_routes_async_pages(): @pytest.mark.parametrize( "request_type", [ - policy_based_routing.GetPolicyBasedRouteRequest, - dict, + policy_based_routing.GetPolicyBasedRouteRequest(), + {}, ], ) def test_get_policy_based_route(request_type, transport: str = "grpc"): @@ -1928,7 +1946,7 @@ def test_get_policy_based_route(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1987,9 +2005,10 @@ def test_get_policy_based_route_non_empty_request_with_auto_populated_field(): client.get_policy_based_route(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == policy_based_routing.GetPolicyBasedRouteRequest( + request_msg = policy_based_routing.GetPolicyBasedRouteRequest( name="name_value", ) + assert args[0] == request_msg def test_get_policy_based_route_use_cached_wrapped_rpc(): @@ -2075,9 +2094,15 @@ async def test_get_policy_based_route_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + policy_based_routing.GetPolicyBasedRouteRequest(), + {}, + ], +) async def test_get_policy_based_route_async( - transport: str = "grpc_asyncio", - request_type=policy_based_routing.GetPolicyBasedRouteRequest, + request_type, transport: str = "grpc_asyncio" ): client = PolicyBasedRoutingServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2086,7 +2111,7 @@ async def test_get_policy_based_route_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( @@ -2121,11 +2146,6 @@ async def test_get_policy_based_route_async( assert response.kind == "kind_value" -@pytest.mark.asyncio -async def test_get_policy_based_route_async_from_dict(): - await test_get_policy_based_route_async(request_type=dict) - - def test_get_policy_based_route_field_headers(): client = PolicyBasedRoutingServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2280,8 +2300,8 @@ async def test_get_policy_based_route_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - policy_based_routing.CreatePolicyBasedRouteRequest, - dict, + policy_based_routing.CreatePolicyBasedRouteRequest(), + {}, ], ) def test_create_policy_based_route(request_type, transport: str = "grpc"): @@ -2292,7 +2312,7 @@ def test_create_policy_based_route(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2339,11 +2359,12 @@ def test_create_policy_based_route_non_empty_request_with_auto_populated_field() client.create_policy_based_route(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == policy_based_routing.CreatePolicyBasedRouteRequest( + request_msg = policy_based_routing.CreatePolicyBasedRouteRequest( parent="parent_value", policy_based_route_id="policy_based_route_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_policy_based_route_use_cached_wrapped_rpc(): @@ -2439,9 +2460,15 @@ async def test_create_policy_based_route_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + policy_based_routing.CreatePolicyBasedRouteRequest(), + {}, + ], +) async def test_create_policy_based_route_async( - transport: str = "grpc_asyncio", - request_type=policy_based_routing.CreatePolicyBasedRouteRequest, + request_type, transport: str = "grpc_asyncio" ): client = PolicyBasedRoutingServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2450,7 +2477,7 @@ async def test_create_policy_based_route_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( @@ -2472,11 +2499,6 @@ async def test_create_policy_based_route_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_policy_based_route_async_from_dict(): - await test_create_policy_based_route_async(request_type=dict) - - def test_create_policy_based_route_field_headers(): client = PolicyBasedRoutingServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2675,8 +2697,8 @@ async def test_create_policy_based_route_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - policy_based_routing.DeletePolicyBasedRouteRequest, - dict, + policy_based_routing.DeletePolicyBasedRouteRequest(), + {}, ], ) def test_delete_policy_based_route(request_type, transport: str = "grpc"): @@ -2687,7 +2709,7 @@ def test_delete_policy_based_route(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2733,10 +2755,11 @@ def test_delete_policy_based_route_non_empty_request_with_auto_populated_field() client.delete_policy_based_route(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == policy_based_routing.DeletePolicyBasedRouteRequest( + request_msg = policy_based_routing.DeletePolicyBasedRouteRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_policy_based_route_use_cached_wrapped_rpc(): @@ -2832,9 +2855,15 @@ async def test_delete_policy_based_route_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + policy_based_routing.DeletePolicyBasedRouteRequest(), + {}, + ], +) async def test_delete_policy_based_route_async( - transport: str = "grpc_asyncio", - request_type=policy_based_routing.DeletePolicyBasedRouteRequest, + request_type, transport: str = "grpc_asyncio" ): client = PolicyBasedRoutingServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2843,7 +2872,7 @@ async def test_delete_policy_based_route_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( @@ -2865,11 +2894,6 @@ async def test_delete_policy_based_route_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_policy_based_route_async_from_dict(): - await test_delete_policy_based_route_async(request_type=dict) - - def test_delete_policy_based_route_field_headers(): client = PolicyBasedRoutingServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3145,7 +3169,6 @@ def test_list_policy_based_routes_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policy_based_routing.ListPolicyBasedRoutesRequest() - assert args[0] == request_msg @@ -3168,7 +3191,6 @@ def test_get_policy_based_route_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policy_based_routing.GetPolicyBasedRouteRequest() - assert args[0] == request_msg @@ -3191,7 +3213,6 @@ def test_create_policy_based_route_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policy_based_routing.CreatePolicyBasedRouteRequest() - assert args[0] == request_msg @@ -3214,7 +3235,6 @@ def test_delete_policy_based_route_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policy_based_routing.DeletePolicyBasedRouteRequest() - assert args[0] == request_msg @@ -3258,7 +3278,6 @@ async def test_list_policy_based_routes_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policy_based_routing.ListPolicyBasedRoutesRequest() - assert args[0] == request_msg @@ -3292,7 +3311,6 @@ async def test_get_policy_based_route_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policy_based_routing.GetPolicyBasedRouteRequest() - assert args[0] == request_msg @@ -3319,7 +3337,6 @@ async def test_create_policy_based_route_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policy_based_routing.CreatePolicyBasedRouteRequest() - assert args[0] == request_msg @@ -3346,7 +3363,6 @@ async def test_delete_policy_based_route_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = policy_based_routing.DeletePolicyBasedRouteRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-network-connectivity/tests/unit/gapic/networkconnectivity_v1beta/test_transport_manager.py b/packages/google-cloud-network-connectivity/tests/unit/gapic/networkconnectivity_v1beta/test_transport_manager.py index 7cd1eaa94aa5..305e3427cd9e 100644 --- a/packages/google-cloud-network-connectivity/tests/unit/gapic/networkconnectivity_v1beta/test_transport_manager.py +++ b/packages/google-cloud-network-connectivity/tests/unit/gapic/networkconnectivity_v1beta/test_transport_manager.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 @@ -118,6 +119,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" @@ -1319,8 +1335,8 @@ def test_transport_manager_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - transport_manager.ListRemoteTransportProfilesRequest, - dict, + transport_manager.ListRemoteTransportProfilesRequest(), + {}, ], ) def test_list_remote_transport_profiles(request_type, transport: str = "grpc"): @@ -1331,7 +1347,7 @@ def test_list_remote_transport_profiles(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1384,12 +1400,13 @@ def test_list_remote_transport_profiles_non_empty_request_with_auto_populated_fi client.list_remote_transport_profiles(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == transport_manager.ListRemoteTransportProfilesRequest( + request_msg = transport_manager.ListRemoteTransportProfilesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_remote_transport_profiles_use_cached_wrapped_rpc(): @@ -1475,9 +1492,15 @@ async def test_list_remote_transport_profiles_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + transport_manager.ListRemoteTransportProfilesRequest(), + {}, + ], +) async def test_list_remote_transport_profiles_async( - transport: str = "grpc_asyncio", - request_type=transport_manager.ListRemoteTransportProfilesRequest, + request_type, transport: str = "grpc_asyncio" ): client = TransportManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -1486,7 +1509,7 @@ async def test_list_remote_transport_profiles_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( @@ -1513,11 +1536,6 @@ async def test_list_remote_transport_profiles_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_remote_transport_profiles_async_from_dict(): - await test_list_remote_transport_profiles_async(request_type=dict) - - def test_list_remote_transport_profiles_field_headers(): client = TransportManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1878,8 +1896,8 @@ async def test_list_remote_transport_profiles_async_pages(): @pytest.mark.parametrize( "request_type", [ - transport_manager.GetRemoteTransportProfileRequest, - dict, + transport_manager.GetRemoteTransportProfileRequest(), + {}, ], ) def test_get_remote_transport_profile(request_type, transport: str = "grpc"): @@ -1890,7 +1908,7 @@ def test_get_remote_transport_profile(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1964,9 +1982,10 @@ def test_get_remote_transport_profile_non_empty_request_with_auto_populated_fiel client.get_remote_transport_profile(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == transport_manager.GetRemoteTransportProfileRequest( + request_msg = transport_manager.GetRemoteTransportProfileRequest( name="name_value", ) + assert args[0] == request_msg def test_get_remote_transport_profile_use_cached_wrapped_rpc(): @@ -2052,9 +2071,15 @@ async def test_get_remote_transport_profile_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + transport_manager.GetRemoteTransportProfileRequest(), + {}, + ], +) async def test_get_remote_transport_profile_async( - transport: str = "grpc_asyncio", - request_type=transport_manager.GetRemoteTransportProfileRequest, + request_type, transport: str = "grpc_asyncio" ): client = TransportManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -2063,7 +2088,7 @@ async def test_get_remote_transport_profile_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( @@ -2114,11 +2139,6 @@ async def test_get_remote_transport_profile_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_get_remote_transport_profile_async_from_dict(): - await test_get_remote_transport_profile_async(request_type=dict) - - def test_get_remote_transport_profile_field_headers(): client = TransportManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2273,8 +2293,8 @@ async def test_get_remote_transport_profile_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - transport_manager.ListTransportsRequest, - dict, + transport_manager.ListTransportsRequest(), + {}, ], ) def test_list_transports(request_type, transport: str = "grpc"): @@ -2285,7 +2305,7 @@ def test_list_transports(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_transports), "__call__") as call: @@ -2334,12 +2354,13 @@ def test_list_transports_non_empty_request_with_auto_populated_field(): client.list_transports(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == transport_manager.ListTransportsRequest( + request_msg = transport_manager.ListTransportsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_transports_use_cached_wrapped_rpc(): @@ -2420,10 +2441,14 @@ async def test_list_transports_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_transports_async( - transport: str = "grpc_asyncio", - request_type=transport_manager.ListTransportsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + transport_manager.ListTransportsRequest(), + {}, + ], +) +async def test_list_transports_async(request_type, transport: str = "grpc_asyncio"): client = TransportManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2431,7 +2456,7 @@ async def test_list_transports_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_transports), "__call__") as call: @@ -2456,11 +2481,6 @@ async def test_list_transports_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_transports_async_from_dict(): - await test_list_transports_async(request_type=dict) - - def test_list_transports_field_headers(): client = TransportManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2797,8 +2817,8 @@ async def test_list_transports_async_pages(): @pytest.mark.parametrize( "request_type", [ - transport_manager.GetTransportRequest, - dict, + transport_manager.GetTransportRequest(), + {}, ], ) def test_get_transport(request_type, transport: str = "grpc"): @@ -2809,7 +2829,7 @@ def test_get_transport(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_transport), "__call__") as call: @@ -2879,9 +2899,10 @@ def test_get_transport_non_empty_request_with_auto_populated_field(): client.get_transport(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == transport_manager.GetTransportRequest( + request_msg = transport_manager.GetTransportRequest( name="name_value", ) + assert args[0] == request_msg def test_get_transport_use_cached_wrapped_rpc(): @@ -2962,9 +2983,14 @@ async def test_get_transport_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_transport_async( - transport: str = "grpc_asyncio", request_type=transport_manager.GetTransportRequest -): +@pytest.mark.parametrize( + "request_type", + [ + transport_manager.GetTransportRequest(), + {}, + ], +) +async def test_get_transport_async(request_type, transport: str = "grpc_asyncio"): client = TransportManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2972,7 +2998,7 @@ async def test_get_transport_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_transport), "__call__") as call: @@ -3021,11 +3047,6 @@ async def test_get_transport_async( assert response.peering_network == "peering_network_value" -@pytest.mark.asyncio -async def test_get_transport_async_from_dict(): - await test_get_transport_async(request_type=dict) - - def test_get_transport_field_headers(): client = TransportManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3172,8 +3193,8 @@ async def test_get_transport_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - transport_manager.GetStatusRequest, - dict, + transport_manager.GetStatusRequest(), + {}, ], ) def test_get_status(request_type, transport: str = "grpc"): @@ -3184,7 +3205,7 @@ def test_get_status(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_status), "__call__") as call: @@ -3246,9 +3267,10 @@ def test_get_status_non_empty_request_with_auto_populated_field(): client.get_status(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == transport_manager.GetStatusRequest( + request_msg = transport_manager.GetStatusRequest( name="name_value", ) + assert args[0] == request_msg def test_get_status_use_cached_wrapped_rpc(): @@ -3327,9 +3349,14 @@ async def test_get_status_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_status_async( - transport: str = "grpc_asyncio", request_type=transport_manager.GetStatusRequest -): +@pytest.mark.parametrize( + "request_type", + [ + transport_manager.GetStatusRequest(), + {}, + ], +) +async def test_get_status_async(request_type, transport: str = "grpc_asyncio"): client = TransportManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3337,7 +3364,7 @@ async def test_get_status_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_status), "__call__") as call: @@ -3378,11 +3405,6 @@ async def test_get_status_async( ) -@pytest.mark.asyncio -async def test_get_status_async_from_dict(): - await test_get_status_async(request_type=dict) - - def test_get_status_field_headers(): client = TransportManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3529,8 +3551,8 @@ async def test_get_status_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - transport_manager.CreateTransportRequest, - dict, + transport_manager.CreateTransportRequest(), + {}, ], ) def test_create_transport(request_type, transport: str = "grpc"): @@ -3541,7 +3563,7 @@ def test_create_transport(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_transport), "__call__") as call: @@ -3583,10 +3605,11 @@ def test_create_transport_non_empty_request_with_auto_populated_field(): client.create_transport(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == transport_manager.CreateTransportRequest( + request_msg = transport_manager.CreateTransportRequest( parent="parent_value", transport_id="transport_id_value", ) + assert args[0] == request_msg def test_create_transport_use_cached_wrapped_rpc(): @@ -3679,10 +3702,14 @@ async def test_create_transport_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_transport_async( - transport: str = "grpc_asyncio", - request_type=transport_manager.CreateTransportRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + transport_manager.CreateTransportRequest(), + {}, + ], +) +async def test_create_transport_async(request_type, transport: str = "grpc_asyncio"): client = TransportManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3690,7 +3717,7 @@ async def test_create_transport_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_transport), "__call__") as call: @@ -3710,11 +3737,6 @@ async def test_create_transport_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_transport_async_from_dict(): - await test_create_transport_async(request_type=dict) - - def test_create_transport_field_headers(): client = TransportManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3881,8 +3903,8 @@ async def test_create_transport_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - transport_manager.UpdateTransportRequest, - dict, + transport_manager.UpdateTransportRequest(), + {}, ], ) def test_update_transport(request_type, transport: str = "grpc"): @@ -3893,7 +3915,7 @@ def test_update_transport(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_transport), "__call__") as call: @@ -3932,7 +3954,8 @@ def test_update_transport_non_empty_request_with_auto_populated_field(): client.update_transport(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == transport_manager.UpdateTransportRequest() + request_msg = transport_manager.UpdateTransportRequest() + assert args[0] == request_msg def test_update_transport_use_cached_wrapped_rpc(): @@ -4025,10 +4048,14 @@ async def test_update_transport_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_transport_async( - transport: str = "grpc_asyncio", - request_type=transport_manager.UpdateTransportRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + transport_manager.UpdateTransportRequest(), + {}, + ], +) +async def test_update_transport_async(request_type, transport: str = "grpc_asyncio"): client = TransportManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4036,7 +4063,7 @@ async def test_update_transport_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_transport), "__call__") as call: @@ -4056,11 +4083,6 @@ async def test_update_transport_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_transport_async_from_dict(): - await test_update_transport_async(request_type=dict) - - def test_update_transport_field_headers(): client = TransportManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4217,8 +4239,8 @@ async def test_update_transport_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - transport_manager.DeleteTransportRequest, - dict, + transport_manager.DeleteTransportRequest(), + {}, ], ) def test_delete_transport(request_type, transport: str = "grpc"): @@ -4229,7 +4251,7 @@ def test_delete_transport(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_transport), "__call__") as call: @@ -4270,9 +4292,10 @@ def test_delete_transport_non_empty_request_with_auto_populated_field(): client.delete_transport(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == transport_manager.DeleteTransportRequest( + request_msg = transport_manager.DeleteTransportRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_transport_use_cached_wrapped_rpc(): @@ -4365,10 +4388,14 @@ async def test_delete_transport_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_transport_async( - transport: str = "grpc_asyncio", - request_type=transport_manager.DeleteTransportRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + transport_manager.DeleteTransportRequest(), + {}, + ], +) +async def test_delete_transport_async(request_type, transport: str = "grpc_asyncio"): client = TransportManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4376,7 +4403,7 @@ async def test_delete_transport_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_transport), "__call__") as call: @@ -4396,11 +4423,6 @@ async def test_delete_transport_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_transport_async_from_dict(): - await test_delete_transport_async(request_type=dict) - - def test_delete_transport_field_headers(): client = TransportManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4668,7 +4690,6 @@ def test_list_remote_transport_profiles_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transport_manager.ListRemoteTransportProfilesRequest() - assert args[0] == request_msg @@ -4691,7 +4712,6 @@ def test_get_remote_transport_profile_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transport_manager.GetRemoteTransportProfileRequest() - assert args[0] == request_msg @@ -4712,7 +4732,6 @@ def test_list_transports_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transport_manager.ListTransportsRequest() - assert args[0] == request_msg @@ -4733,7 +4752,6 @@ def test_get_transport_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transport_manager.GetTransportRequest() - assert args[0] == request_msg @@ -4754,7 +4772,6 @@ def test_get_status_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transport_manager.GetStatusRequest() - assert args[0] == request_msg @@ -4775,7 +4792,6 @@ def test_create_transport_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transport_manager.CreateTransportRequest() - assert args[0] == request_msg @@ -4796,7 +4812,6 @@ def test_update_transport_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transport_manager.UpdateTransportRequest() - assert args[0] == request_msg @@ -4817,7 +4832,6 @@ def test_delete_transport_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transport_manager.DeleteTransportRequest() - assert args[0] == request_msg @@ -4861,7 +4875,6 @@ async def test_list_remote_transport_profiles_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transport_manager.ListRemoteTransportProfilesRequest() - assert args[0] == request_msg @@ -4900,7 +4913,6 @@ async def test_get_remote_transport_profile_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transport_manager.GetRemoteTransportProfileRequest() - assert args[0] == request_msg @@ -4928,7 +4940,6 @@ async def test_list_transports_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transport_manager.ListTransportsRequest() - assert args[0] == request_msg @@ -4968,7 +4979,6 @@ async def test_get_transport_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transport_manager.GetTransportRequest() - assert args[0] == request_msg @@ -4998,7 +5008,6 @@ async def test_get_status_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transport_manager.GetStatusRequest() - assert args[0] == request_msg @@ -5023,7 +5032,6 @@ async def test_create_transport_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transport_manager.CreateTransportRequest() - assert args[0] == request_msg @@ -5048,7 +5056,6 @@ async def test_update_transport_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transport_manager.UpdateTransportRequest() - assert args[0] == request_msg @@ -5073,7 +5080,6 @@ async def test_delete_transport_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transport_manager.DeleteTransportRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-network-management/noxfile.py b/packages/google-cloud-network-management/noxfile.py index 4258833b5316..c30a6b93d952 100644 --- a/packages/google-cloud-network-management/noxfile.py +++ b/packages/google-cloud-network-management/noxfile.py @@ -47,7 +47,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-network-management" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-network-management/setup.py b/packages/google-cloud-network-management/setup.py index 5dc5b8f30703..8af6d1192eee 100644 --- a/packages/google-cloud-network-management/setup.py +++ b/packages/google-cloud-network-management/setup.py @@ -45,7 +45,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/google-cloud-network-management/testing/constraints-3.10.txt b/packages/google-cloud-network-management/testing/constraints-3.10.txt index a92801e1c8e2..b39cd54634f9 100644 --- a/packages/google-cloud-network-management/testing/constraints-3.10.txt +++ b/packages/google-cloud-network-management/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/google-cloud-network-management/tests/unit/gapic/network_management_v1/test_organization_vpc_flow_logs_service.py b/packages/google-cloud-network-management/tests/unit/gapic/network_management_v1/test_organization_vpc_flow_logs_service.py index a7cd3e29416b..3b0f312c9d47 100644 --- a/packages/google-cloud-network-management/tests/unit/gapic/network_management_v1/test_organization_vpc_flow_logs_service.py +++ b/packages/google-cloud-network-management/tests/unit/gapic/network_management_v1/test_organization_vpc_flow_logs_service.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 @@ -128,6 +129,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" @@ -1456,8 +1472,8 @@ def test_organization_vpc_flow_logs_service_client_create_channel_credentials_fi @pytest.mark.parametrize( "request_type", [ - vpc_flow_logs.ListVpcFlowLogsConfigsRequest, - dict, + vpc_flow_logs.ListVpcFlowLogsConfigsRequest(), + {}, ], ) def test_list_vpc_flow_logs_configs(request_type, transport: str = "grpc"): @@ -1468,7 +1484,7 @@ def test_list_vpc_flow_logs_configs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1521,12 +1537,13 @@ def test_list_vpc_flow_logs_configs_non_empty_request_with_auto_populated_field( client.list_vpc_flow_logs_configs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vpc_flow_logs.ListVpcFlowLogsConfigsRequest( + request_msg = vpc_flow_logs.ListVpcFlowLogsConfigsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_vpc_flow_logs_configs_use_cached_wrapped_rpc(): @@ -1612,9 +1629,15 @@ async def test_list_vpc_flow_logs_configs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vpc_flow_logs.ListVpcFlowLogsConfigsRequest(), + {}, + ], +) async def test_list_vpc_flow_logs_configs_async( - transport: str = "grpc_asyncio", - request_type=vpc_flow_logs.ListVpcFlowLogsConfigsRequest, + request_type, transport: str = "grpc_asyncio" ): client = OrganizationVpcFlowLogsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1623,7 +1646,7 @@ async def test_list_vpc_flow_logs_configs_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( @@ -1650,11 +1673,6 @@ async def test_list_vpc_flow_logs_configs_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_vpc_flow_logs_configs_async_from_dict(): - await test_list_vpc_flow_logs_configs_async(request_type=dict) - - def test_list_vpc_flow_logs_configs_field_headers(): client = OrganizationVpcFlowLogsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2013,8 +2031,8 @@ async def test_list_vpc_flow_logs_configs_async_pages(): @pytest.mark.parametrize( "request_type", [ - vpc_flow_logs.GetVpcFlowLogsConfigRequest, - dict, + vpc_flow_logs.GetVpcFlowLogsConfigRequest(), + {}, ], ) def test_get_vpc_flow_logs_config(request_type, transport: str = "grpc"): @@ -2025,7 +2043,7 @@ def test_get_vpc_flow_logs_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( @@ -2104,9 +2122,10 @@ def test_get_vpc_flow_logs_config_non_empty_request_with_auto_populated_field(): client.get_vpc_flow_logs_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vpc_flow_logs.GetVpcFlowLogsConfigRequest( + request_msg = vpc_flow_logs.GetVpcFlowLogsConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_vpc_flow_logs_config_use_cached_wrapped_rpc(): @@ -2192,9 +2211,15 @@ async def test_get_vpc_flow_logs_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vpc_flow_logs.GetVpcFlowLogsConfigRequest(), + {}, + ], +) async def test_get_vpc_flow_logs_config_async( - transport: str = "grpc_asyncio", - request_type=vpc_flow_logs.GetVpcFlowLogsConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = OrganizationVpcFlowLogsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2203,7 +2228,7 @@ async def test_get_vpc_flow_logs_config_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( @@ -2258,11 +2283,6 @@ async def test_get_vpc_flow_logs_config_async( ) -@pytest.mark.asyncio -async def test_get_vpc_flow_logs_config_async_from_dict(): - await test_get_vpc_flow_logs_config_async(request_type=dict) - - def test_get_vpc_flow_logs_config_field_headers(): client = OrganizationVpcFlowLogsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2417,8 +2437,8 @@ async def test_get_vpc_flow_logs_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vpc_flow_logs.CreateVpcFlowLogsConfigRequest, - dict, + vpc_flow_logs.CreateVpcFlowLogsConfigRequest(), + {}, ], ) def test_create_vpc_flow_logs_config(request_type, transport: str = "grpc"): @@ -2429,7 +2449,7 @@ def test_create_vpc_flow_logs_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( @@ -2475,10 +2495,11 @@ def test_create_vpc_flow_logs_config_non_empty_request_with_auto_populated_field client.create_vpc_flow_logs_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vpc_flow_logs.CreateVpcFlowLogsConfigRequest( + request_msg = vpc_flow_logs.CreateVpcFlowLogsConfigRequest( parent="parent_value", vpc_flow_logs_config_id="vpc_flow_logs_config_id_value", ) + assert args[0] == request_msg def test_create_vpc_flow_logs_config_use_cached_wrapped_rpc(): @@ -2574,9 +2595,15 @@ async def test_create_vpc_flow_logs_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vpc_flow_logs.CreateVpcFlowLogsConfigRequest(), + {}, + ], +) async def test_create_vpc_flow_logs_config_async( - transport: str = "grpc_asyncio", - request_type=vpc_flow_logs.CreateVpcFlowLogsConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = OrganizationVpcFlowLogsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2585,7 +2612,7 @@ async def test_create_vpc_flow_logs_config_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( @@ -2607,11 +2634,6 @@ async def test_create_vpc_flow_logs_config_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_vpc_flow_logs_config_async_from_dict(): - await test_create_vpc_flow_logs_config_async(request_type=dict) - - def test_create_vpc_flow_logs_config_field_headers(): client = OrganizationVpcFlowLogsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2794,8 +2816,8 @@ async def test_create_vpc_flow_logs_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vpc_flow_logs.UpdateVpcFlowLogsConfigRequest, - dict, + vpc_flow_logs.UpdateVpcFlowLogsConfigRequest(), + {}, ], ) def test_update_vpc_flow_logs_config(request_type, transport: str = "grpc"): @@ -2806,7 +2828,7 @@ def test_update_vpc_flow_logs_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( @@ -2849,7 +2871,8 @@ def test_update_vpc_flow_logs_config_non_empty_request_with_auto_populated_field client.update_vpc_flow_logs_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vpc_flow_logs.UpdateVpcFlowLogsConfigRequest() + request_msg = vpc_flow_logs.UpdateVpcFlowLogsConfigRequest() + assert args[0] == request_msg def test_update_vpc_flow_logs_config_use_cached_wrapped_rpc(): @@ -2945,9 +2968,15 @@ async def test_update_vpc_flow_logs_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vpc_flow_logs.UpdateVpcFlowLogsConfigRequest(), + {}, + ], +) async def test_update_vpc_flow_logs_config_async( - transport: str = "grpc_asyncio", - request_type=vpc_flow_logs.UpdateVpcFlowLogsConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = OrganizationVpcFlowLogsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2956,7 +2985,7 @@ async def test_update_vpc_flow_logs_config_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( @@ -2978,11 +3007,6 @@ async def test_update_vpc_flow_logs_config_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_vpc_flow_logs_config_async_from_dict(): - await test_update_vpc_flow_logs_config_async(request_type=dict) - - def test_update_vpc_flow_logs_config_field_headers(): client = OrganizationVpcFlowLogsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3155,8 +3179,8 @@ async def test_update_vpc_flow_logs_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vpc_flow_logs.DeleteVpcFlowLogsConfigRequest, - dict, + vpc_flow_logs.DeleteVpcFlowLogsConfigRequest(), + {}, ], ) def test_delete_vpc_flow_logs_config(request_type, transport: str = "grpc"): @@ -3167,7 +3191,7 @@ def test_delete_vpc_flow_logs_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( @@ -3212,9 +3236,10 @@ def test_delete_vpc_flow_logs_config_non_empty_request_with_auto_populated_field client.delete_vpc_flow_logs_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vpc_flow_logs.DeleteVpcFlowLogsConfigRequest( + request_msg = vpc_flow_logs.DeleteVpcFlowLogsConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_vpc_flow_logs_config_use_cached_wrapped_rpc(): @@ -3310,9 +3335,15 @@ async def test_delete_vpc_flow_logs_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vpc_flow_logs.DeleteVpcFlowLogsConfigRequest(), + {}, + ], +) async def test_delete_vpc_flow_logs_config_async( - transport: str = "grpc_asyncio", - request_type=vpc_flow_logs.DeleteVpcFlowLogsConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = OrganizationVpcFlowLogsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3321,7 +3352,7 @@ async def test_delete_vpc_flow_logs_config_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( @@ -3343,11 +3374,6 @@ async def test_delete_vpc_flow_logs_config_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_vpc_flow_logs_config_async_from_dict(): - await test_delete_vpc_flow_logs_config_async(request_type=dict) - - def test_delete_vpc_flow_logs_config_field_headers(): client = OrganizationVpcFlowLogsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4676,7 +4702,6 @@ def test_list_vpc_flow_logs_configs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vpc_flow_logs.ListVpcFlowLogsConfigsRequest() - assert args[0] == request_msg @@ -4699,7 +4724,6 @@ def test_get_vpc_flow_logs_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vpc_flow_logs.GetVpcFlowLogsConfigRequest() - assert args[0] == request_msg @@ -4722,7 +4746,6 @@ def test_create_vpc_flow_logs_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vpc_flow_logs.CreateVpcFlowLogsConfigRequest() - assert args[0] == request_msg @@ -4745,7 +4768,6 @@ def test_update_vpc_flow_logs_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vpc_flow_logs.UpdateVpcFlowLogsConfigRequest() - assert args[0] == request_msg @@ -4768,7 +4790,6 @@ def test_delete_vpc_flow_logs_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vpc_flow_logs.DeleteVpcFlowLogsConfigRequest() - assert args[0] == request_msg @@ -4812,7 +4833,6 @@ async def test_list_vpc_flow_logs_configs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vpc_flow_logs.ListVpcFlowLogsConfigsRequest() - assert args[0] == request_msg @@ -4850,7 +4870,6 @@ async def test_get_vpc_flow_logs_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vpc_flow_logs.GetVpcFlowLogsConfigRequest() - assert args[0] == request_msg @@ -4877,7 +4896,6 @@ async def test_create_vpc_flow_logs_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vpc_flow_logs.CreateVpcFlowLogsConfigRequest() - assert args[0] == request_msg @@ -4904,7 +4922,6 @@ async def test_update_vpc_flow_logs_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vpc_flow_logs.UpdateVpcFlowLogsConfigRequest() - assert args[0] == request_msg @@ -4931,7 +4948,6 @@ async def test_delete_vpc_flow_logs_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vpc_flow_logs.DeleteVpcFlowLogsConfigRequest() - assert args[0] == request_msg @@ -6428,7 +6444,6 @@ def test_list_vpc_flow_logs_configs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vpc_flow_logs.ListVpcFlowLogsConfigsRequest() - assert args[0] == request_msg @@ -6450,7 +6465,6 @@ def test_get_vpc_flow_logs_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vpc_flow_logs.GetVpcFlowLogsConfigRequest() - assert args[0] == request_msg @@ -6472,7 +6486,6 @@ def test_create_vpc_flow_logs_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vpc_flow_logs.CreateVpcFlowLogsConfigRequest() - assert args[0] == request_msg @@ -6494,7 +6507,6 @@ def test_update_vpc_flow_logs_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vpc_flow_logs.UpdateVpcFlowLogsConfigRequest() - assert args[0] == request_msg @@ -6516,7 +6528,6 @@ def test_delete_vpc_flow_logs_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vpc_flow_logs.DeleteVpcFlowLogsConfigRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-network-management/tests/unit/gapic/network_management_v1/test_reachability_service.py b/packages/google-cloud-network-management/tests/unit/gapic/network_management_v1/test_reachability_service.py index 66fb1986974c..dce67ab60307 100644 --- a/packages/google-cloud-network-management/tests/unit/gapic/network_management_v1/test_reachability_service.py +++ b/packages/google-cloud-network-management/tests/unit/gapic/network_management_v1/test_reachability_service.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 @@ -127,6 +128,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" @@ -1390,8 +1406,8 @@ def test_reachability_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - reachability.ListConnectivityTestsRequest, - dict, + reachability.ListConnectivityTestsRequest(), + {}, ], ) def test_list_connectivity_tests(request_type, transport: str = "grpc"): @@ -1402,7 +1418,7 @@ def test_list_connectivity_tests(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1455,12 +1471,13 @@ def test_list_connectivity_tests_non_empty_request_with_auto_populated_field(): client.list_connectivity_tests(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == reachability.ListConnectivityTestsRequest( + request_msg = reachability.ListConnectivityTestsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_connectivity_tests_use_cached_wrapped_rpc(): @@ -1546,9 +1563,15 @@ async def test_list_connectivity_tests_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + reachability.ListConnectivityTestsRequest(), + {}, + ], +) async def test_list_connectivity_tests_async( - transport: str = "grpc_asyncio", - request_type=reachability.ListConnectivityTestsRequest, + request_type, transport: str = "grpc_asyncio" ): client = ReachabilityServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1557,7 +1580,7 @@ async def test_list_connectivity_tests_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( @@ -1584,11 +1607,6 @@ async def test_list_connectivity_tests_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_connectivity_tests_async_from_dict(): - await test_list_connectivity_tests_async(request_type=dict) - - def test_list_connectivity_tests_field_headers(): client = ReachabilityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1941,8 +1959,8 @@ async def test_list_connectivity_tests_async_pages(): @pytest.mark.parametrize( "request_type", [ - reachability.GetConnectivityTestRequest, - dict, + reachability.GetConnectivityTestRequest(), + {}, ], ) def test_get_connectivity_test(request_type, transport: str = "grpc"): @@ -1953,7 +1971,7 @@ def test_get_connectivity_test(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2013,9 +2031,10 @@ def test_get_connectivity_test_non_empty_request_with_auto_populated_field(): client.get_connectivity_test(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == reachability.GetConnectivityTestRequest( + request_msg = reachability.GetConnectivityTestRequest( name="name_value", ) + assert args[0] == request_msg def test_get_connectivity_test_use_cached_wrapped_rpc(): @@ -2101,9 +2120,15 @@ async def test_get_connectivity_test_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + reachability.GetConnectivityTestRequest(), + {}, + ], +) async def test_get_connectivity_test_async( - transport: str = "grpc_asyncio", - request_type=reachability.GetConnectivityTestRequest, + request_type, transport: str = "grpc_asyncio" ): client = ReachabilityServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2112,7 +2137,7 @@ async def test_get_connectivity_test_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( @@ -2149,11 +2174,6 @@ async def test_get_connectivity_test_async( assert response.bypass_firewall_checks is True -@pytest.mark.asyncio -async def test_get_connectivity_test_async_from_dict(): - await test_get_connectivity_test_async(request_type=dict) - - def test_get_connectivity_test_field_headers(): client = ReachabilityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2308,8 +2328,8 @@ async def test_get_connectivity_test_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - reachability.CreateConnectivityTestRequest, - dict, + reachability.CreateConnectivityTestRequest(), + {}, ], ) def test_create_connectivity_test(request_type, transport: str = "grpc"): @@ -2320,7 +2340,7 @@ def test_create_connectivity_test(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2366,10 +2386,11 @@ def test_create_connectivity_test_non_empty_request_with_auto_populated_field(): client.create_connectivity_test(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == reachability.CreateConnectivityTestRequest( + request_msg = reachability.CreateConnectivityTestRequest( parent="parent_value", test_id="test_id_value", ) + assert args[0] == request_msg def test_create_connectivity_test_use_cached_wrapped_rpc(): @@ -2465,9 +2486,15 @@ async def test_create_connectivity_test_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + reachability.CreateConnectivityTestRequest(), + {}, + ], +) async def test_create_connectivity_test_async( - transport: str = "grpc_asyncio", - request_type=reachability.CreateConnectivityTestRequest, + request_type, transport: str = "grpc_asyncio" ): client = ReachabilityServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2476,7 +2503,7 @@ async def test_create_connectivity_test_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( @@ -2498,11 +2525,6 @@ async def test_create_connectivity_test_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_connectivity_test_async_from_dict(): - await test_create_connectivity_test_async(request_type=dict) - - def test_create_connectivity_test_field_headers(): client = ReachabilityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2677,8 +2699,8 @@ async def test_create_connectivity_test_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - reachability.UpdateConnectivityTestRequest, - dict, + reachability.UpdateConnectivityTestRequest(), + {}, ], ) def test_update_connectivity_test(request_type, transport: str = "grpc"): @@ -2689,7 +2711,7 @@ def test_update_connectivity_test(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2732,7 +2754,8 @@ def test_update_connectivity_test_non_empty_request_with_auto_populated_field(): client.update_connectivity_test(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == reachability.UpdateConnectivityTestRequest() + request_msg = reachability.UpdateConnectivityTestRequest() + assert args[0] == request_msg def test_update_connectivity_test_use_cached_wrapped_rpc(): @@ -2828,9 +2851,15 @@ async def test_update_connectivity_test_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + reachability.UpdateConnectivityTestRequest(), + {}, + ], +) async def test_update_connectivity_test_async( - transport: str = "grpc_asyncio", - request_type=reachability.UpdateConnectivityTestRequest, + request_type, transport: str = "grpc_asyncio" ): client = ReachabilityServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2839,7 +2868,7 @@ async def test_update_connectivity_test_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( @@ -2861,11 +2890,6 @@ async def test_update_connectivity_test_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_connectivity_test_async_from_dict(): - await test_update_connectivity_test_async(request_type=dict) - - def test_update_connectivity_test_field_headers(): client = ReachabilityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3030,8 +3054,8 @@ async def test_update_connectivity_test_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - reachability.RerunConnectivityTestRequest, - dict, + reachability.RerunConnectivityTestRequest(), + {}, ], ) def test_rerun_connectivity_test(request_type, transport: str = "grpc"): @@ -3042,7 +3066,7 @@ def test_rerun_connectivity_test(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3087,9 +3111,10 @@ def test_rerun_connectivity_test_non_empty_request_with_auto_populated_field(): client.rerun_connectivity_test(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == reachability.RerunConnectivityTestRequest( + request_msg = reachability.RerunConnectivityTestRequest( name="name_value", ) + assert args[0] == request_msg def test_rerun_connectivity_test_use_cached_wrapped_rpc(): @@ -3185,9 +3210,15 @@ async def test_rerun_connectivity_test_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + reachability.RerunConnectivityTestRequest(), + {}, + ], +) async def test_rerun_connectivity_test_async( - transport: str = "grpc_asyncio", - request_type=reachability.RerunConnectivityTestRequest, + request_type, transport: str = "grpc_asyncio" ): client = ReachabilityServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3196,7 +3227,7 @@ async def test_rerun_connectivity_test_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( @@ -3218,11 +3249,6 @@ async def test_rerun_connectivity_test_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_rerun_connectivity_test_async_from_dict(): - await test_rerun_connectivity_test_async(request_type=dict) - - def test_rerun_connectivity_test_field_headers(): client = ReachabilityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3291,8 +3317,8 @@ async def test_rerun_connectivity_test_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - reachability.DeleteConnectivityTestRequest, - dict, + reachability.DeleteConnectivityTestRequest(), + {}, ], ) def test_delete_connectivity_test(request_type, transport: str = "grpc"): @@ -3303,7 +3329,7 @@ def test_delete_connectivity_test(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3348,9 +3374,10 @@ def test_delete_connectivity_test_non_empty_request_with_auto_populated_field(): client.delete_connectivity_test(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == reachability.DeleteConnectivityTestRequest( + request_msg = reachability.DeleteConnectivityTestRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_connectivity_test_use_cached_wrapped_rpc(): @@ -3446,9 +3473,15 @@ async def test_delete_connectivity_test_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + reachability.DeleteConnectivityTestRequest(), + {}, + ], +) async def test_delete_connectivity_test_async( - transport: str = "grpc_asyncio", - request_type=reachability.DeleteConnectivityTestRequest, + request_type, transport: str = "grpc_asyncio" ): client = ReachabilityServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3457,7 +3490,7 @@ async def test_delete_connectivity_test_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( @@ -3479,11 +3512,6 @@ async def test_delete_connectivity_test_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_connectivity_test_async_from_dict(): - await test_delete_connectivity_test_async(request_type=dict) - - def test_delete_connectivity_test_field_headers(): client = ReachabilityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4926,7 +4954,6 @@ def test_list_connectivity_tests_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reachability.ListConnectivityTestsRequest() - assert args[0] == request_msg @@ -4949,7 +4976,6 @@ def test_get_connectivity_test_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reachability.GetConnectivityTestRequest() - assert args[0] == request_msg @@ -4972,7 +4998,6 @@ def test_create_connectivity_test_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reachability.CreateConnectivityTestRequest() - assert args[0] == request_msg @@ -4995,7 +5020,6 @@ def test_update_connectivity_test_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reachability.UpdateConnectivityTestRequest() - assert args[0] == request_msg @@ -5018,7 +5042,6 @@ def test_rerun_connectivity_test_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reachability.RerunConnectivityTestRequest() - assert args[0] == request_msg @@ -5041,7 +5064,6 @@ def test_delete_connectivity_test_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reachability.DeleteConnectivityTestRequest() - assert args[0] == request_msg @@ -5085,7 +5107,6 @@ async def test_list_connectivity_tests_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reachability.ListConnectivityTestsRequest() - assert args[0] == request_msg @@ -5120,7 +5141,6 @@ async def test_get_connectivity_test_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reachability.GetConnectivityTestRequest() - assert args[0] == request_msg @@ -5147,7 +5167,6 @@ async def test_create_connectivity_test_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reachability.CreateConnectivityTestRequest() - assert args[0] == request_msg @@ -5174,7 +5193,6 @@ async def test_update_connectivity_test_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reachability.UpdateConnectivityTestRequest() - assert args[0] == request_msg @@ -5201,7 +5219,6 @@ async def test_rerun_connectivity_test_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reachability.RerunConnectivityTestRequest() - assert args[0] == request_msg @@ -5228,7 +5245,6 @@ async def test_delete_connectivity_test_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reachability.DeleteConnectivityTestRequest() - assert args[0] == request_msg @@ -7603,7 +7619,6 @@ def test_list_connectivity_tests_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reachability.ListConnectivityTestsRequest() - assert args[0] == request_msg @@ -7625,7 +7640,6 @@ def test_get_connectivity_test_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reachability.GetConnectivityTestRequest() - assert args[0] == request_msg @@ -7647,7 +7661,6 @@ def test_create_connectivity_test_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reachability.CreateConnectivityTestRequest() - assert args[0] == request_msg @@ -7669,7 +7682,6 @@ def test_update_connectivity_test_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reachability.UpdateConnectivityTestRequest() - assert args[0] == request_msg @@ -7691,7 +7703,6 @@ def test_rerun_connectivity_test_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reachability.RerunConnectivityTestRequest() - assert args[0] == request_msg @@ -7713,7 +7724,6 @@ def test_delete_connectivity_test_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reachability.DeleteConnectivityTestRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-network-management/tests/unit/gapic/network_management_v1/test_vpc_flow_logs_service.py b/packages/google-cloud-network-management/tests/unit/gapic/network_management_v1/test_vpc_flow_logs_service.py index c601301b232b..0c306760e0ed 100644 --- a/packages/google-cloud-network-management/tests/unit/gapic/network_management_v1/test_vpc_flow_logs_service.py +++ b/packages/google-cloud-network-management/tests/unit/gapic/network_management_v1/test_vpc_flow_logs_service.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 @@ -128,6 +129,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" @@ -1373,8 +1389,8 @@ def test_vpc_flow_logs_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - vpc_flow_logs.ListVpcFlowLogsConfigsRequest, - dict, + vpc_flow_logs.ListVpcFlowLogsConfigsRequest(), + {}, ], ) def test_list_vpc_flow_logs_configs(request_type, transport: str = "grpc"): @@ -1385,7 +1401,7 @@ def test_list_vpc_flow_logs_configs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1438,12 +1454,13 @@ def test_list_vpc_flow_logs_configs_non_empty_request_with_auto_populated_field( client.list_vpc_flow_logs_configs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vpc_flow_logs.ListVpcFlowLogsConfigsRequest( + request_msg = vpc_flow_logs.ListVpcFlowLogsConfigsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_vpc_flow_logs_configs_use_cached_wrapped_rpc(): @@ -1529,9 +1546,15 @@ async def test_list_vpc_flow_logs_configs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vpc_flow_logs.ListVpcFlowLogsConfigsRequest(), + {}, + ], +) async def test_list_vpc_flow_logs_configs_async( - transport: str = "grpc_asyncio", - request_type=vpc_flow_logs.ListVpcFlowLogsConfigsRequest, + request_type, transport: str = "grpc_asyncio" ): client = VpcFlowLogsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1540,7 +1563,7 @@ async def test_list_vpc_flow_logs_configs_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( @@ -1567,11 +1590,6 @@ async def test_list_vpc_flow_logs_configs_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_vpc_flow_logs_configs_async_from_dict(): - await test_list_vpc_flow_logs_configs_async(request_type=dict) - - def test_list_vpc_flow_logs_configs_field_headers(): client = VpcFlowLogsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1930,8 +1948,8 @@ async def test_list_vpc_flow_logs_configs_async_pages(): @pytest.mark.parametrize( "request_type", [ - vpc_flow_logs.GetVpcFlowLogsConfigRequest, - dict, + vpc_flow_logs.GetVpcFlowLogsConfigRequest(), + {}, ], ) def test_get_vpc_flow_logs_config(request_type, transport: str = "grpc"): @@ -1942,7 +1960,7 @@ def test_get_vpc_flow_logs_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( @@ -2021,9 +2039,10 @@ def test_get_vpc_flow_logs_config_non_empty_request_with_auto_populated_field(): client.get_vpc_flow_logs_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vpc_flow_logs.GetVpcFlowLogsConfigRequest( + request_msg = vpc_flow_logs.GetVpcFlowLogsConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_vpc_flow_logs_config_use_cached_wrapped_rpc(): @@ -2109,9 +2128,15 @@ async def test_get_vpc_flow_logs_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vpc_flow_logs.GetVpcFlowLogsConfigRequest(), + {}, + ], +) async def test_get_vpc_flow_logs_config_async( - transport: str = "grpc_asyncio", - request_type=vpc_flow_logs.GetVpcFlowLogsConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = VpcFlowLogsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2120,7 +2145,7 @@ async def test_get_vpc_flow_logs_config_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( @@ -2175,11 +2200,6 @@ async def test_get_vpc_flow_logs_config_async( ) -@pytest.mark.asyncio -async def test_get_vpc_flow_logs_config_async_from_dict(): - await test_get_vpc_flow_logs_config_async(request_type=dict) - - def test_get_vpc_flow_logs_config_field_headers(): client = VpcFlowLogsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2334,8 +2354,8 @@ async def test_get_vpc_flow_logs_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vpc_flow_logs.CreateVpcFlowLogsConfigRequest, - dict, + vpc_flow_logs.CreateVpcFlowLogsConfigRequest(), + {}, ], ) def test_create_vpc_flow_logs_config(request_type, transport: str = "grpc"): @@ -2346,7 +2366,7 @@ def test_create_vpc_flow_logs_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( @@ -2392,10 +2412,11 @@ def test_create_vpc_flow_logs_config_non_empty_request_with_auto_populated_field client.create_vpc_flow_logs_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vpc_flow_logs.CreateVpcFlowLogsConfigRequest( + request_msg = vpc_flow_logs.CreateVpcFlowLogsConfigRequest( parent="parent_value", vpc_flow_logs_config_id="vpc_flow_logs_config_id_value", ) + assert args[0] == request_msg def test_create_vpc_flow_logs_config_use_cached_wrapped_rpc(): @@ -2491,9 +2512,15 @@ async def test_create_vpc_flow_logs_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vpc_flow_logs.CreateVpcFlowLogsConfigRequest(), + {}, + ], +) async def test_create_vpc_flow_logs_config_async( - transport: str = "grpc_asyncio", - request_type=vpc_flow_logs.CreateVpcFlowLogsConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = VpcFlowLogsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2502,7 +2529,7 @@ async def test_create_vpc_flow_logs_config_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( @@ -2524,11 +2551,6 @@ async def test_create_vpc_flow_logs_config_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_vpc_flow_logs_config_async_from_dict(): - await test_create_vpc_flow_logs_config_async(request_type=dict) - - def test_create_vpc_flow_logs_config_field_headers(): client = VpcFlowLogsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2711,8 +2733,8 @@ async def test_create_vpc_flow_logs_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vpc_flow_logs.UpdateVpcFlowLogsConfigRequest, - dict, + vpc_flow_logs.UpdateVpcFlowLogsConfigRequest(), + {}, ], ) def test_update_vpc_flow_logs_config(request_type, transport: str = "grpc"): @@ -2723,7 +2745,7 @@ def test_update_vpc_flow_logs_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( @@ -2766,7 +2788,8 @@ def test_update_vpc_flow_logs_config_non_empty_request_with_auto_populated_field client.update_vpc_flow_logs_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vpc_flow_logs.UpdateVpcFlowLogsConfigRequest() + request_msg = vpc_flow_logs.UpdateVpcFlowLogsConfigRequest() + assert args[0] == request_msg def test_update_vpc_flow_logs_config_use_cached_wrapped_rpc(): @@ -2862,9 +2885,15 @@ async def test_update_vpc_flow_logs_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vpc_flow_logs.UpdateVpcFlowLogsConfigRequest(), + {}, + ], +) async def test_update_vpc_flow_logs_config_async( - transport: str = "grpc_asyncio", - request_type=vpc_flow_logs.UpdateVpcFlowLogsConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = VpcFlowLogsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2873,7 +2902,7 @@ async def test_update_vpc_flow_logs_config_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( @@ -2895,11 +2924,6 @@ async def test_update_vpc_flow_logs_config_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_vpc_flow_logs_config_async_from_dict(): - await test_update_vpc_flow_logs_config_async(request_type=dict) - - def test_update_vpc_flow_logs_config_field_headers(): client = VpcFlowLogsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3072,8 +3096,8 @@ async def test_update_vpc_flow_logs_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vpc_flow_logs.DeleteVpcFlowLogsConfigRequest, - dict, + vpc_flow_logs.DeleteVpcFlowLogsConfigRequest(), + {}, ], ) def test_delete_vpc_flow_logs_config(request_type, transport: str = "grpc"): @@ -3084,7 +3108,7 @@ def test_delete_vpc_flow_logs_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( @@ -3129,9 +3153,10 @@ def test_delete_vpc_flow_logs_config_non_empty_request_with_auto_populated_field client.delete_vpc_flow_logs_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vpc_flow_logs.DeleteVpcFlowLogsConfigRequest( + request_msg = vpc_flow_logs.DeleteVpcFlowLogsConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_vpc_flow_logs_config_use_cached_wrapped_rpc(): @@ -3227,9 +3252,15 @@ async def test_delete_vpc_flow_logs_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vpc_flow_logs.DeleteVpcFlowLogsConfigRequest(), + {}, + ], +) async def test_delete_vpc_flow_logs_config_async( - transport: str = "grpc_asyncio", - request_type=vpc_flow_logs.DeleteVpcFlowLogsConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = VpcFlowLogsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3238,7 +3269,7 @@ async def test_delete_vpc_flow_logs_config_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( @@ -3260,11 +3291,6 @@ async def test_delete_vpc_flow_logs_config_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_vpc_flow_logs_config_async_from_dict(): - await test_delete_vpc_flow_logs_config_async(request_type=dict) - - def test_delete_vpc_flow_logs_config_field_headers(): client = VpcFlowLogsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3419,8 +3445,8 @@ async def test_delete_vpc_flow_logs_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vpc_flow_logs.QueryOrgVpcFlowLogsConfigsRequest, - dict, + vpc_flow_logs.QueryOrgVpcFlowLogsConfigsRequest(), + {}, ], ) def test_query_org_vpc_flow_logs_configs(request_type, transport: str = "grpc"): @@ -3431,7 +3457,7 @@ def test_query_org_vpc_flow_logs_configs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3483,11 +3509,12 @@ def test_query_org_vpc_flow_logs_configs_non_empty_request_with_auto_populated_f client.query_org_vpc_flow_logs_configs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vpc_flow_logs.QueryOrgVpcFlowLogsConfigsRequest( + request_msg = vpc_flow_logs.QueryOrgVpcFlowLogsConfigsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_query_org_vpc_flow_logs_configs_use_cached_wrapped_rpc(): @@ -3573,9 +3600,15 @@ async def test_query_org_vpc_flow_logs_configs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vpc_flow_logs.QueryOrgVpcFlowLogsConfigsRequest(), + {}, + ], +) async def test_query_org_vpc_flow_logs_configs_async( - transport: str = "grpc_asyncio", - request_type=vpc_flow_logs.QueryOrgVpcFlowLogsConfigsRequest, + request_type, transport: str = "grpc_asyncio" ): client = VpcFlowLogsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3584,7 +3617,7 @@ async def test_query_org_vpc_flow_logs_configs_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( @@ -3611,11 +3644,6 @@ async def test_query_org_vpc_flow_logs_configs_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_query_org_vpc_flow_logs_configs_async_from_dict(): - await test_query_org_vpc_flow_logs_configs_async(request_type=dict) - - def test_query_org_vpc_flow_logs_configs_field_headers(): client = VpcFlowLogsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3890,8 +3918,8 @@ async def test_query_org_vpc_flow_logs_configs_async_pages(): @pytest.mark.parametrize( "request_type", [ - vpc_flow_logs.ShowEffectiveFlowLogsConfigsRequest, - dict, + vpc_flow_logs.ShowEffectiveFlowLogsConfigsRequest(), + {}, ], ) def test_show_effective_flow_logs_configs(request_type, transport: str = "grpc"): @@ -3902,7 +3930,7 @@ def test_show_effective_flow_logs_configs(request_type, transport: str = "grpc") # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3955,12 +3983,13 @@ def test_show_effective_flow_logs_configs_non_empty_request_with_auto_populated_ client.show_effective_flow_logs_configs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vpc_flow_logs.ShowEffectiveFlowLogsConfigsRequest( + request_msg = vpc_flow_logs.ShowEffectiveFlowLogsConfigsRequest( parent="parent_value", resource="resource_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_show_effective_flow_logs_configs_use_cached_wrapped_rpc(): @@ -4046,9 +4075,15 @@ async def test_show_effective_flow_logs_configs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vpc_flow_logs.ShowEffectiveFlowLogsConfigsRequest(), + {}, + ], +) async def test_show_effective_flow_logs_configs_async( - transport: str = "grpc_asyncio", - request_type=vpc_flow_logs.ShowEffectiveFlowLogsConfigsRequest, + request_type, transport: str = "grpc_asyncio" ): client = VpcFlowLogsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4057,7 +4092,7 @@ async def test_show_effective_flow_logs_configs_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( @@ -4084,11 +4119,6 @@ async def test_show_effective_flow_logs_configs_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_show_effective_flow_logs_configs_async_from_dict(): - await test_show_effective_flow_logs_configs_async(request_type=dict) - - def test_show_effective_flow_logs_configs_field_headers(): client = VpcFlowLogsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5988,7 +6018,6 @@ def test_list_vpc_flow_logs_configs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vpc_flow_logs.ListVpcFlowLogsConfigsRequest() - assert args[0] == request_msg @@ -6011,7 +6040,6 @@ def test_get_vpc_flow_logs_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vpc_flow_logs.GetVpcFlowLogsConfigRequest() - assert args[0] == request_msg @@ -6034,7 +6062,6 @@ def test_create_vpc_flow_logs_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vpc_flow_logs.CreateVpcFlowLogsConfigRequest() - assert args[0] == request_msg @@ -6057,7 +6084,6 @@ def test_update_vpc_flow_logs_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vpc_flow_logs.UpdateVpcFlowLogsConfigRequest() - assert args[0] == request_msg @@ -6080,7 +6106,6 @@ def test_delete_vpc_flow_logs_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vpc_flow_logs.DeleteVpcFlowLogsConfigRequest() - assert args[0] == request_msg @@ -6103,7 +6128,6 @@ def test_query_org_vpc_flow_logs_configs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vpc_flow_logs.QueryOrgVpcFlowLogsConfigsRequest() - assert args[0] == request_msg @@ -6126,7 +6150,6 @@ def test_show_effective_flow_logs_configs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vpc_flow_logs.ShowEffectiveFlowLogsConfigsRequest() - assert args[0] == request_msg @@ -6170,7 +6193,6 @@ async def test_list_vpc_flow_logs_configs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vpc_flow_logs.ListVpcFlowLogsConfigsRequest() - assert args[0] == request_msg @@ -6208,7 +6230,6 @@ async def test_get_vpc_flow_logs_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vpc_flow_logs.GetVpcFlowLogsConfigRequest() - assert args[0] == request_msg @@ -6235,7 +6256,6 @@ async def test_create_vpc_flow_logs_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vpc_flow_logs.CreateVpcFlowLogsConfigRequest() - assert args[0] == request_msg @@ -6262,7 +6282,6 @@ async def test_update_vpc_flow_logs_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vpc_flow_logs.UpdateVpcFlowLogsConfigRequest() - assert args[0] == request_msg @@ -6289,7 +6308,6 @@ async def test_delete_vpc_flow_logs_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vpc_flow_logs.DeleteVpcFlowLogsConfigRequest() - assert args[0] == request_msg @@ -6319,7 +6337,6 @@ async def test_query_org_vpc_flow_logs_configs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vpc_flow_logs.QueryOrgVpcFlowLogsConfigsRequest() - assert args[0] == request_msg @@ -6349,7 +6366,6 @@ async def test_show_effective_flow_logs_configs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vpc_flow_logs.ShowEffectiveFlowLogsConfigsRequest() - assert args[0] == request_msg @@ -8127,7 +8143,6 @@ def test_list_vpc_flow_logs_configs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vpc_flow_logs.ListVpcFlowLogsConfigsRequest() - assert args[0] == request_msg @@ -8149,7 +8164,6 @@ def test_get_vpc_flow_logs_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vpc_flow_logs.GetVpcFlowLogsConfigRequest() - assert args[0] == request_msg @@ -8171,7 +8185,6 @@ def test_create_vpc_flow_logs_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vpc_flow_logs.CreateVpcFlowLogsConfigRequest() - assert args[0] == request_msg @@ -8193,7 +8206,6 @@ def test_update_vpc_flow_logs_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vpc_flow_logs.UpdateVpcFlowLogsConfigRequest() - assert args[0] == request_msg @@ -8215,7 +8227,6 @@ def test_delete_vpc_flow_logs_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vpc_flow_logs.DeleteVpcFlowLogsConfigRequest() - assert args[0] == request_msg @@ -8237,7 +8248,6 @@ def test_query_org_vpc_flow_logs_configs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vpc_flow_logs.QueryOrgVpcFlowLogsConfigsRequest() - assert args[0] == request_msg @@ -8259,7 +8269,6 @@ def test_show_effective_flow_logs_configs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vpc_flow_logs.ShowEffectiveFlowLogsConfigsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-network-security/noxfile.py b/packages/google-cloud-network-security/noxfile.py index bf36ee8a0113..14d2cb6a6f53 100644 --- a/packages/google-cloud-network-security/noxfile.py +++ b/packages/google-cloud-network-security/noxfile.py @@ -47,7 +47,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-network-security" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-network-security/setup.py b/packages/google-cloud-network-security/setup.py index 53578cb0eecb..0c5a80731f77 100644 --- a/packages/google-cloud-network-security/setup.py +++ b/packages/google-cloud-network-security/setup.py @@ -45,7 +45,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/google-cloud-network-security/testing/constraints-3.10.txt b/packages/google-cloud-network-security/testing/constraints-3.10.txt index a92801e1c8e2..b39cd54634f9 100644 --- a/packages/google-cloud-network-security/testing/constraints-3.10.txt +++ b/packages/google-cloud-network-security/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/google-cloud-network-security/tests/unit/gapic/network_security_v1/test_address_group_service.py b/packages/google-cloud-network-security/tests/unit/gapic/network_security_v1/test_address_group_service.py index d80d1867a5c5..f58a3efd15f2 100644 --- a/packages/google-cloud-network-security/tests/unit/gapic/network_security_v1/test_address_group_service.py +++ b/packages/google-cloud-network-security/tests/unit/gapic/network_security_v1/test_address_group_service.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 @@ -122,6 +123,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" @@ -1385,8 +1401,8 @@ def test_address_group_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - address_group.ListAddressGroupsRequest, - dict, + address_group.ListAddressGroupsRequest(), + {}, ], ) def test_list_address_groups(request_type, transport: str = "grpc"): @@ -1397,7 +1413,7 @@ def test_list_address_groups(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1448,10 +1464,11 @@ def test_list_address_groups_non_empty_request_with_auto_populated_field(): client.list_address_groups(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == address_group.ListAddressGroupsRequest( + request_msg = address_group.ListAddressGroupsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_address_groups_use_cached_wrapped_rpc(): @@ -1536,9 +1553,14 @@ async def test_list_address_groups_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_address_groups_async( - transport: str = "grpc_asyncio", request_type=address_group.ListAddressGroupsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + address_group.ListAddressGroupsRequest(), + {}, + ], +) +async def test_list_address_groups_async(request_type, transport: str = "grpc_asyncio"): client = AddressGroupServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1546,7 +1568,7 @@ async def test_list_address_groups_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( @@ -1573,11 +1595,6 @@ async def test_list_address_groups_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_address_groups_async_from_dict(): - await test_list_address_groups_async(request_type=dict) - - def test_list_address_groups_field_headers(): client = AddressGroupServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1930,8 +1947,8 @@ async def test_list_address_groups_async_pages(): @pytest.mark.parametrize( "request_type", [ - address_group.GetAddressGroupRequest, - dict, + address_group.GetAddressGroupRequest(), + {}, ], ) def test_get_address_group(request_type, transport: str = "grpc"): @@ -1942,7 +1959,7 @@ def test_get_address_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2002,9 +2019,10 @@ def test_get_address_group_non_empty_request_with_auto_populated_field(): client.get_address_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == address_group.GetAddressGroupRequest( + request_msg = address_group.GetAddressGroupRequest( name="name_value", ) + assert args[0] == request_msg def test_get_address_group_use_cached_wrapped_rpc(): @@ -2087,9 +2105,14 @@ async def test_get_address_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_address_group_async( - transport: str = "grpc_asyncio", request_type=address_group.GetAddressGroupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + address_group.GetAddressGroupRequest(), + {}, + ], +) +async def test_get_address_group_async(request_type, transport: str = "grpc_asyncio"): client = AddressGroupServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2097,7 +2120,7 @@ async def test_get_address_group_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( @@ -2134,11 +2157,6 @@ async def test_get_address_group_async( assert response.purpose == [address_group.AddressGroup.Purpose.DEFAULT] -@pytest.mark.asyncio -async def test_get_address_group_async_from_dict(): - await test_get_address_group_async(request_type=dict) - - def test_get_address_group_field_headers(): client = AddressGroupServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2293,8 +2311,8 @@ async def test_get_address_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_address_group.CreateAddressGroupRequest, - dict, + gcn_address_group.CreateAddressGroupRequest(), + {}, ], ) def test_create_address_group(request_type, transport: str = "grpc"): @@ -2305,7 +2323,7 @@ def test_create_address_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2352,11 +2370,12 @@ def test_create_address_group_non_empty_request_with_auto_populated_field(): client.create_address_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_address_group.CreateAddressGroupRequest( + request_msg = gcn_address_group.CreateAddressGroupRequest( parent="parent_value", address_group_id="address_group_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_address_group_use_cached_wrapped_rpc(): @@ -2451,9 +2470,15 @@ async def test_create_address_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcn_address_group.CreateAddressGroupRequest(), + {}, + ], +) async def test_create_address_group_async( - transport: str = "grpc_asyncio", - request_type=gcn_address_group.CreateAddressGroupRequest, + request_type, transport: str = "grpc_asyncio" ): client = AddressGroupServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2462,7 +2487,7 @@ async def test_create_address_group_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( @@ -2484,11 +2509,6 @@ async def test_create_address_group_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_address_group_async_from_dict(): - await test_create_address_group_async(request_type=dict) - - def test_create_address_group_field_headers(): client = AddressGroupServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2663,8 +2683,8 @@ async def test_create_address_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_address_group.UpdateAddressGroupRequest, - dict, + gcn_address_group.UpdateAddressGroupRequest(), + {}, ], ) def test_update_address_group(request_type, transport: str = "grpc"): @@ -2675,7 +2695,7 @@ def test_update_address_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,9 +2740,10 @@ def test_update_address_group_non_empty_request_with_auto_populated_field(): client.update_address_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_address_group.UpdateAddressGroupRequest( + request_msg = gcn_address_group.UpdateAddressGroupRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_address_group_use_cached_wrapped_rpc(): @@ -2817,9 +2838,15 @@ async def test_update_address_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcn_address_group.UpdateAddressGroupRequest(), + {}, + ], +) async def test_update_address_group_async( - transport: str = "grpc_asyncio", - request_type=gcn_address_group.UpdateAddressGroupRequest, + request_type, transport: str = "grpc_asyncio" ): client = AddressGroupServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2828,7 +2855,7 @@ async def test_update_address_group_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( @@ -2850,11 +2877,6 @@ async def test_update_address_group_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_address_group_async_from_dict(): - await test_update_address_group_async(request_type=dict) - - def test_update_address_group_field_headers(): client = AddressGroupServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3019,8 +3041,8 @@ async def test_update_address_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_address_group.AddAddressGroupItemsRequest, - dict, + gcn_address_group.AddAddressGroupItemsRequest(), + {}, ], ) def test_add_address_group_items(request_type, transport: str = "grpc"): @@ -3031,7 +3053,7 @@ def test_add_address_group_items(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3077,10 +3099,11 @@ def test_add_address_group_items_non_empty_request_with_auto_populated_field(): client.add_address_group_items(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_address_group.AddAddressGroupItemsRequest( + request_msg = gcn_address_group.AddAddressGroupItemsRequest( address_group="address_group_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_add_address_group_items_use_cached_wrapped_rpc(): @@ -3176,9 +3199,15 @@ async def test_add_address_group_items_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcn_address_group.AddAddressGroupItemsRequest(), + {}, + ], +) async def test_add_address_group_items_async( - transport: str = "grpc_asyncio", - request_type=gcn_address_group.AddAddressGroupItemsRequest, + request_type, transport: str = "grpc_asyncio" ): client = AddressGroupServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3187,7 +3216,7 @@ async def test_add_address_group_items_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( @@ -3209,11 +3238,6 @@ async def test_add_address_group_items_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_add_address_group_items_async_from_dict(): - await test_add_address_group_items_async(request_type=dict) - - def test_add_address_group_items_field_headers(): client = AddressGroupServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3378,8 +3402,8 @@ async def test_add_address_group_items_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_address_group.RemoveAddressGroupItemsRequest, - dict, + gcn_address_group.RemoveAddressGroupItemsRequest(), + {}, ], ) def test_remove_address_group_items(request_type, transport: str = "grpc"): @@ -3390,7 +3414,7 @@ def test_remove_address_group_items(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3436,10 +3460,11 @@ def test_remove_address_group_items_non_empty_request_with_auto_populated_field( client.remove_address_group_items(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_address_group.RemoveAddressGroupItemsRequest( + request_msg = gcn_address_group.RemoveAddressGroupItemsRequest( address_group="address_group_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_remove_address_group_items_use_cached_wrapped_rpc(): @@ -3535,9 +3560,15 @@ async def test_remove_address_group_items_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcn_address_group.RemoveAddressGroupItemsRequest(), + {}, + ], +) async def test_remove_address_group_items_async( - transport: str = "grpc_asyncio", - request_type=gcn_address_group.RemoveAddressGroupItemsRequest, + request_type, transport: str = "grpc_asyncio" ): client = AddressGroupServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3546,7 +3577,7 @@ async def test_remove_address_group_items_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( @@ -3568,11 +3599,6 @@ async def test_remove_address_group_items_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_remove_address_group_items_async_from_dict(): - await test_remove_address_group_items_async(request_type=dict) - - def test_remove_address_group_items_field_headers(): client = AddressGroupServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3737,8 +3763,8 @@ async def test_remove_address_group_items_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_address_group.CloneAddressGroupItemsRequest, - dict, + gcn_address_group.CloneAddressGroupItemsRequest(), + {}, ], ) def test_clone_address_group_items(request_type, transport: str = "grpc"): @@ -3749,7 +3775,7 @@ def test_clone_address_group_items(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3796,11 +3822,12 @@ def test_clone_address_group_items_non_empty_request_with_auto_populated_field() client.clone_address_group_items(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_address_group.CloneAddressGroupItemsRequest( + request_msg = gcn_address_group.CloneAddressGroupItemsRequest( address_group="address_group_value", source_address_group="source_address_group_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_clone_address_group_items_use_cached_wrapped_rpc(): @@ -3896,9 +3923,15 @@ async def test_clone_address_group_items_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcn_address_group.CloneAddressGroupItemsRequest(), + {}, + ], +) async def test_clone_address_group_items_async( - transport: str = "grpc_asyncio", - request_type=gcn_address_group.CloneAddressGroupItemsRequest, + request_type, transport: str = "grpc_asyncio" ): client = AddressGroupServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3907,7 +3940,7 @@ async def test_clone_address_group_items_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( @@ -3929,11 +3962,6 @@ async def test_clone_address_group_items_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_clone_address_group_items_async_from_dict(): - await test_clone_address_group_items_async(request_type=dict) - - def test_clone_address_group_items_field_headers(): client = AddressGroupServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4098,8 +4126,8 @@ async def test_clone_address_group_items_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - address_group.DeleteAddressGroupRequest, - dict, + address_group.DeleteAddressGroupRequest(), + {}, ], ) def test_delete_address_group(request_type, transport: str = "grpc"): @@ -4110,7 +4138,7 @@ def test_delete_address_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4156,10 +4184,11 @@ def test_delete_address_group_non_empty_request_with_auto_populated_field(): client.delete_address_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == address_group.DeleteAddressGroupRequest( + request_msg = address_group.DeleteAddressGroupRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_address_group_use_cached_wrapped_rpc(): @@ -4254,9 +4283,15 @@ async def test_delete_address_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + address_group.DeleteAddressGroupRequest(), + {}, + ], +) async def test_delete_address_group_async( - transport: str = "grpc_asyncio", - request_type=address_group.DeleteAddressGroupRequest, + request_type, transport: str = "grpc_asyncio" ): client = AddressGroupServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4265,7 +4300,7 @@ async def test_delete_address_group_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( @@ -4287,11 +4322,6 @@ async def test_delete_address_group_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_address_group_async_from_dict(): - await test_delete_address_group_async(request_type=dict) - - def test_delete_address_group_field_headers(): client = AddressGroupServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4446,8 +4476,8 @@ async def test_delete_address_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_address_group.ListAddressGroupReferencesRequest, - dict, + gcn_address_group.ListAddressGroupReferencesRequest(), + {}, ], ) def test_list_address_group_references(request_type, transport: str = "grpc"): @@ -4458,7 +4488,7 @@ def test_list_address_group_references(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4507,10 +4537,11 @@ def test_list_address_group_references_non_empty_request_with_auto_populated_fie client.list_address_group_references(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_address_group.ListAddressGroupReferencesRequest( + request_msg = gcn_address_group.ListAddressGroupReferencesRequest( address_group="address_group_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_address_group_references_use_cached_wrapped_rpc(): @@ -4596,9 +4627,15 @@ async def test_list_address_group_references_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcn_address_group.ListAddressGroupReferencesRequest(), + {}, + ], +) async def test_list_address_group_references_async( - transport: str = "grpc_asyncio", - request_type=gcn_address_group.ListAddressGroupReferencesRequest, + request_type, transport: str = "grpc_asyncio" ): client = AddressGroupServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4607,7 +4644,7 @@ async def test_list_address_group_references_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( @@ -4632,11 +4669,6 @@ async def test_list_address_group_references_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_address_group_references_async_from_dict(): - await test_list_address_group_references_async(request_type=dict) - - def test_list_address_group_references_field_headers(): client = AddressGroupServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7049,7 +7081,6 @@ def test_list_address_groups_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = address_group.ListAddressGroupsRequest() - assert args[0] == request_msg @@ -7072,7 +7103,6 @@ def test_get_address_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = address_group.GetAddressGroupRequest() - assert args[0] == request_msg @@ -7095,7 +7125,6 @@ def test_create_address_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_address_group.CreateAddressGroupRequest() - assert args[0] == request_msg @@ -7118,7 +7147,6 @@ def test_update_address_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_address_group.UpdateAddressGroupRequest() - assert args[0] == request_msg @@ -7141,7 +7169,6 @@ def test_add_address_group_items_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_address_group.AddAddressGroupItemsRequest() - assert args[0] == request_msg @@ -7164,7 +7191,6 @@ def test_remove_address_group_items_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_address_group.RemoveAddressGroupItemsRequest() - assert args[0] == request_msg @@ -7187,7 +7213,6 @@ def test_clone_address_group_items_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_address_group.CloneAddressGroupItemsRequest() - assert args[0] == request_msg @@ -7210,7 +7235,6 @@ def test_delete_address_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = address_group.DeleteAddressGroupRequest() - assert args[0] == request_msg @@ -7233,7 +7257,6 @@ def test_list_address_group_references_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_address_group.ListAddressGroupReferencesRequest() - assert args[0] == request_msg @@ -7277,7 +7300,6 @@ async def test_list_address_groups_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = address_group.ListAddressGroupsRequest() - assert args[0] == request_msg @@ -7312,7 +7334,6 @@ async def test_get_address_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = address_group.GetAddressGroupRequest() - assert args[0] == request_msg @@ -7339,7 +7360,6 @@ async def test_create_address_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_address_group.CreateAddressGroupRequest() - assert args[0] == request_msg @@ -7366,7 +7386,6 @@ async def test_update_address_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_address_group.UpdateAddressGroupRequest() - assert args[0] == request_msg @@ -7393,7 +7412,6 @@ async def test_add_address_group_items_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_address_group.AddAddressGroupItemsRequest() - assert args[0] == request_msg @@ -7420,7 +7438,6 @@ async def test_remove_address_group_items_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_address_group.RemoveAddressGroupItemsRequest() - assert args[0] == request_msg @@ -7447,7 +7464,6 @@ async def test_clone_address_group_items_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_address_group.CloneAddressGroupItemsRequest() - assert args[0] == request_msg @@ -7474,7 +7490,6 @@ async def test_delete_address_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = address_group.DeleteAddressGroupRequest() - assert args[0] == request_msg @@ -7503,7 +7518,6 @@ async def test_list_address_group_references_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_address_group.ListAddressGroupReferencesRequest() - assert args[0] == request_msg @@ -9479,7 +9493,6 @@ def test_list_address_groups_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = address_group.ListAddressGroupsRequest() - assert args[0] == request_msg @@ -9501,7 +9514,6 @@ def test_get_address_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = address_group.GetAddressGroupRequest() - assert args[0] == request_msg @@ -9523,7 +9535,6 @@ def test_create_address_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_address_group.CreateAddressGroupRequest() - assert args[0] == request_msg @@ -9545,7 +9556,6 @@ def test_update_address_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_address_group.UpdateAddressGroupRequest() - assert args[0] == request_msg @@ -9567,7 +9577,6 @@ def test_add_address_group_items_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_address_group.AddAddressGroupItemsRequest() - assert args[0] == request_msg @@ -9589,7 +9598,6 @@ def test_remove_address_group_items_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_address_group.RemoveAddressGroupItemsRequest() - assert args[0] == request_msg @@ -9611,7 +9619,6 @@ def test_clone_address_group_items_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_address_group.CloneAddressGroupItemsRequest() - assert args[0] == request_msg @@ -9633,7 +9640,6 @@ def test_delete_address_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = address_group.DeleteAddressGroupRequest() - assert args[0] == request_msg @@ -9655,7 +9661,6 @@ def test_list_address_group_references_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_address_group.ListAddressGroupReferencesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-network-security/tests/unit/gapic/network_security_v1/test_dns_threat_detector_service.py b/packages/google-cloud-network-security/tests/unit/gapic/network_security_v1/test_dns_threat_detector_service.py index 5e838be4d079..18032c8d6dd6 100644 --- a/packages/google-cloud-network-security/tests/unit/gapic/network_security_v1/test_dns_threat_detector_service.py +++ b/packages/google-cloud-network-security/tests/unit/gapic/network_security_v1/test_dns_threat_detector_service.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 @@ -119,6 +120,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" @@ -1394,8 +1410,8 @@ def test_dns_threat_detector_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - dns_threat_detector.ListDnsThreatDetectorsRequest, - dict, + dns_threat_detector.ListDnsThreatDetectorsRequest(), + {}, ], ) def test_list_dns_threat_detectors(request_type, transport: str = "grpc"): @@ -1406,7 +1422,7 @@ def test_list_dns_threat_detectors(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1457,10 +1473,11 @@ def test_list_dns_threat_detectors_non_empty_request_with_auto_populated_field() client.list_dns_threat_detectors(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dns_threat_detector.ListDnsThreatDetectorsRequest( + request_msg = dns_threat_detector.ListDnsThreatDetectorsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_dns_threat_detectors_use_cached_wrapped_rpc(): @@ -1546,9 +1563,15 @@ async def test_list_dns_threat_detectors_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dns_threat_detector.ListDnsThreatDetectorsRequest(), + {}, + ], +) async def test_list_dns_threat_detectors_async( - transport: str = "grpc_asyncio", - request_type=dns_threat_detector.ListDnsThreatDetectorsRequest, + request_type, transport: str = "grpc_asyncio" ): client = DnsThreatDetectorServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1557,7 +1580,7 @@ async def test_list_dns_threat_detectors_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( @@ -1584,11 +1607,6 @@ async def test_list_dns_threat_detectors_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_dns_threat_detectors_async_from_dict(): - await test_list_dns_threat_detectors_async(request_type=dict) - - def test_list_dns_threat_detectors_field_headers(): client = DnsThreatDetectorServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1947,8 +1965,8 @@ async def test_list_dns_threat_detectors_async_pages(): @pytest.mark.parametrize( "request_type", [ - dns_threat_detector.GetDnsThreatDetectorRequest, - dict, + dns_threat_detector.GetDnsThreatDetectorRequest(), + {}, ], ) def test_get_dns_threat_detector(request_type, transport: str = "grpc"): @@ -1959,7 +1977,7 @@ def test_get_dns_threat_detector(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2011,9 +2029,10 @@ def test_get_dns_threat_detector_non_empty_request_with_auto_populated_field(): client.get_dns_threat_detector(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dns_threat_detector.GetDnsThreatDetectorRequest( + request_msg = dns_threat_detector.GetDnsThreatDetectorRequest( name="name_value", ) + assert args[0] == request_msg def test_get_dns_threat_detector_use_cached_wrapped_rpc(): @@ -2099,9 +2118,15 @@ async def test_get_dns_threat_detector_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dns_threat_detector.GetDnsThreatDetectorRequest(), + {}, + ], +) async def test_get_dns_threat_detector_async( - transport: str = "grpc_asyncio", - request_type=dns_threat_detector.GetDnsThreatDetectorRequest, + request_type, transport: str = "grpc_asyncio" ): client = DnsThreatDetectorServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2110,7 +2135,7 @@ async def test_get_dns_threat_detector_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( @@ -2139,11 +2164,6 @@ async def test_get_dns_threat_detector_async( assert response.provider == dns_threat_detector.DnsThreatDetector.Provider.INFOBLOX -@pytest.mark.asyncio -async def test_get_dns_threat_detector_async_from_dict(): - await test_get_dns_threat_detector_async(request_type=dict) - - def test_get_dns_threat_detector_field_headers(): client = DnsThreatDetectorServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2298,8 +2318,8 @@ async def test_get_dns_threat_detector_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_dns_threat_detector.CreateDnsThreatDetectorRequest, - dict, + gcn_dns_threat_detector.CreateDnsThreatDetectorRequest(), + {}, ], ) def test_create_dns_threat_detector(request_type, transport: str = "grpc"): @@ -2310,7 +2330,7 @@ def test_create_dns_threat_detector(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2365,10 +2385,11 @@ def test_create_dns_threat_detector_non_empty_request_with_auto_populated_field( client.create_dns_threat_detector(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_dns_threat_detector.CreateDnsThreatDetectorRequest( + request_msg = gcn_dns_threat_detector.CreateDnsThreatDetectorRequest( parent="parent_value", dns_threat_detector_id="dns_threat_detector_id_value", ) + assert args[0] == request_msg def test_create_dns_threat_detector_use_cached_wrapped_rpc(): @@ -2454,9 +2475,15 @@ async def test_create_dns_threat_detector_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcn_dns_threat_detector.CreateDnsThreatDetectorRequest(), + {}, + ], +) async def test_create_dns_threat_detector_async( - transport: str = "grpc_asyncio", - request_type=gcn_dns_threat_detector.CreateDnsThreatDetectorRequest, + request_type, transport: str = "grpc_asyncio" ): client = DnsThreatDetectorServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2465,7 +2492,7 @@ async def test_create_dns_threat_detector_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( @@ -2496,11 +2523,6 @@ async def test_create_dns_threat_detector_async( ) -@pytest.mark.asyncio -async def test_create_dns_threat_detector_async_from_dict(): - await test_create_dns_threat_detector_async(request_type=dict) - - def test_create_dns_threat_detector_field_headers(): client = DnsThreatDetectorServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2683,8 +2705,8 @@ async def test_create_dns_threat_detector_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_dns_threat_detector.UpdateDnsThreatDetectorRequest, - dict, + gcn_dns_threat_detector.UpdateDnsThreatDetectorRequest(), + {}, ], ) def test_update_dns_threat_detector(request_type, transport: str = "grpc"): @@ -2695,7 +2717,7 @@ def test_update_dns_threat_detector(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2747,7 +2769,8 @@ def test_update_dns_threat_detector_non_empty_request_with_auto_populated_field( client.update_dns_threat_detector(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_dns_threat_detector.UpdateDnsThreatDetectorRequest() + request_msg = gcn_dns_threat_detector.UpdateDnsThreatDetectorRequest() + assert args[0] == request_msg def test_update_dns_threat_detector_use_cached_wrapped_rpc(): @@ -2833,9 +2856,15 @@ async def test_update_dns_threat_detector_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcn_dns_threat_detector.UpdateDnsThreatDetectorRequest(), + {}, + ], +) async def test_update_dns_threat_detector_async( - transport: str = "grpc_asyncio", - request_type=gcn_dns_threat_detector.UpdateDnsThreatDetectorRequest, + request_type, transport: str = "grpc_asyncio" ): client = DnsThreatDetectorServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2844,7 +2873,7 @@ async def test_update_dns_threat_detector_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( @@ -2875,11 +2904,6 @@ async def test_update_dns_threat_detector_async( ) -@pytest.mark.asyncio -async def test_update_dns_threat_detector_async_from_dict(): - await test_update_dns_threat_detector_async(request_type=dict) - - def test_update_dns_threat_detector_field_headers(): client = DnsThreatDetectorServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3052,8 +3076,8 @@ async def test_update_dns_threat_detector_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dns_threat_detector.DeleteDnsThreatDetectorRequest, - dict, + dns_threat_detector.DeleteDnsThreatDetectorRequest(), + {}, ], ) def test_delete_dns_threat_detector(request_type, transport: str = "grpc"): @@ -3064,7 +3088,7 @@ def test_delete_dns_threat_detector(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3109,9 +3133,10 @@ def test_delete_dns_threat_detector_non_empty_request_with_auto_populated_field( client.delete_dns_threat_detector(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dns_threat_detector.DeleteDnsThreatDetectorRequest( + request_msg = dns_threat_detector.DeleteDnsThreatDetectorRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_dns_threat_detector_use_cached_wrapped_rpc(): @@ -3197,9 +3222,15 @@ async def test_delete_dns_threat_detector_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dns_threat_detector.DeleteDnsThreatDetectorRequest(), + {}, + ], +) async def test_delete_dns_threat_detector_async( - transport: str = "grpc_asyncio", - request_type=dns_threat_detector.DeleteDnsThreatDetectorRequest, + request_type, transport: str = "grpc_asyncio" ): client = DnsThreatDetectorServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3208,7 +3239,7 @@ async def test_delete_dns_threat_detector_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( @@ -3228,11 +3259,6 @@ async def test_delete_dns_threat_detector_async( assert response is None -@pytest.mark.asyncio -async def test_delete_dns_threat_detector_async_from_dict(): - await test_delete_dns_threat_detector_async(request_type=dict) - - def test_delete_dns_threat_detector_field_headers(): client = DnsThreatDetectorServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4531,7 +4557,6 @@ def test_list_dns_threat_detectors_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dns_threat_detector.ListDnsThreatDetectorsRequest() - assert args[0] == request_msg @@ -4554,7 +4579,6 @@ def test_get_dns_threat_detector_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dns_threat_detector.GetDnsThreatDetectorRequest() - assert args[0] == request_msg @@ -4577,7 +4601,6 @@ def test_create_dns_threat_detector_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_dns_threat_detector.CreateDnsThreatDetectorRequest() - assert args[0] == request_msg @@ -4600,7 +4623,6 @@ def test_update_dns_threat_detector_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_dns_threat_detector.UpdateDnsThreatDetectorRequest() - assert args[0] == request_msg @@ -4623,7 +4645,6 @@ def test_delete_dns_threat_detector_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dns_threat_detector.DeleteDnsThreatDetectorRequest() - assert args[0] == request_msg @@ -4667,7 +4688,6 @@ async def test_list_dns_threat_detectors_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dns_threat_detector.ListDnsThreatDetectorsRequest() - assert args[0] == request_msg @@ -4698,7 +4718,6 @@ async def test_get_dns_threat_detector_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dns_threat_detector.GetDnsThreatDetectorRequest() - assert args[0] == request_msg @@ -4729,7 +4748,6 @@ async def test_create_dns_threat_detector_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_dns_threat_detector.CreateDnsThreatDetectorRequest() - assert args[0] == request_msg @@ -4760,7 +4778,6 @@ async def test_update_dns_threat_detector_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_dns_threat_detector.UpdateDnsThreatDetectorRequest() - assert args[0] == request_msg @@ -4785,7 +4802,6 @@ async def test_delete_dns_threat_detector_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dns_threat_detector.DeleteDnsThreatDetectorRequest() - assert args[0] == request_msg @@ -6246,7 +6262,6 @@ def test_list_dns_threat_detectors_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dns_threat_detector.ListDnsThreatDetectorsRequest() - assert args[0] == request_msg @@ -6268,7 +6283,6 @@ def test_get_dns_threat_detector_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dns_threat_detector.GetDnsThreatDetectorRequest() - assert args[0] == request_msg @@ -6290,7 +6304,6 @@ def test_create_dns_threat_detector_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_dns_threat_detector.CreateDnsThreatDetectorRequest() - assert args[0] == request_msg @@ -6312,7 +6325,6 @@ def test_update_dns_threat_detector_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_dns_threat_detector.UpdateDnsThreatDetectorRequest() - assert args[0] == request_msg @@ -6334,7 +6346,6 @@ def test_delete_dns_threat_detector_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dns_threat_detector.DeleteDnsThreatDetectorRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-network-security/tests/unit/gapic/network_security_v1/test_firewall_activation.py b/packages/google-cloud-network-security/tests/unit/gapic/network_security_v1/test_firewall_activation.py index 19977ddc92c1..8e6a5a4dd6a1 100644 --- a/packages/google-cloud-network-security/tests/unit/gapic/network_security_v1/test_firewall_activation.py +++ b/packages/google-cloud-network-security/tests/unit/gapic/network_security_v1/test_firewall_activation.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 @@ -121,6 +122,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" @@ -1366,8 +1382,8 @@ def test_firewall_activation_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - firewall_activation.ListFirewallEndpointsRequest, - dict, + firewall_activation.ListFirewallEndpointsRequest(), + {}, ], ) def test_list_firewall_endpoints(request_type, transport: str = "grpc"): @@ -1378,7 +1394,7 @@ def test_list_firewall_endpoints(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1431,12 +1447,13 @@ def test_list_firewall_endpoints_non_empty_request_with_auto_populated_field(): client.list_firewall_endpoints(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == firewall_activation.ListFirewallEndpointsRequest( + request_msg = firewall_activation.ListFirewallEndpointsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_firewall_endpoints_use_cached_wrapped_rpc(): @@ -1522,9 +1539,15 @@ async def test_list_firewall_endpoints_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + firewall_activation.ListFirewallEndpointsRequest(), + {}, + ], +) async def test_list_firewall_endpoints_async( - transport: str = "grpc_asyncio", - request_type=firewall_activation.ListFirewallEndpointsRequest, + request_type, transport: str = "grpc_asyncio" ): client = FirewallActivationAsyncClient( credentials=async_anonymous_credentials(), @@ -1533,7 +1556,7 @@ async def test_list_firewall_endpoints_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( @@ -1560,11 +1583,6 @@ async def test_list_firewall_endpoints_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_firewall_endpoints_async_from_dict(): - await test_list_firewall_endpoints_async(request_type=dict) - - def test_list_firewall_endpoints_field_headers(): client = FirewallActivationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1919,8 +1937,8 @@ async def test_list_firewall_endpoints_async_pages(): @pytest.mark.parametrize( "request_type", [ - firewall_activation.GetFirewallEndpointRequest, - dict, + firewall_activation.GetFirewallEndpointRequest(), + {}, ], ) def test_get_firewall_endpoint(request_type, transport: str = "grpc"): @@ -1931,7 +1949,7 @@ def test_get_firewall_endpoint(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1993,9 +2011,10 @@ def test_get_firewall_endpoint_non_empty_request_with_auto_populated_field(): client.get_firewall_endpoint(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == firewall_activation.GetFirewallEndpointRequest( + request_msg = firewall_activation.GetFirewallEndpointRequest( name="name_value", ) + assert args[0] == request_msg def test_get_firewall_endpoint_use_cached_wrapped_rpc(): @@ -2081,9 +2100,15 @@ async def test_get_firewall_endpoint_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + firewall_activation.GetFirewallEndpointRequest(), + {}, + ], +) async def test_get_firewall_endpoint_async( - transport: str = "grpc_asyncio", - request_type=firewall_activation.GetFirewallEndpointRequest, + request_type, transport: str = "grpc_asyncio" ): client = FirewallActivationAsyncClient( credentials=async_anonymous_credentials(), @@ -2092,7 +2117,7 @@ async def test_get_firewall_endpoint_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( @@ -2131,11 +2156,6 @@ async def test_get_firewall_endpoint_async( assert response.billing_project_id == "billing_project_id_value" -@pytest.mark.asyncio -async def test_get_firewall_endpoint_async_from_dict(): - await test_get_firewall_endpoint_async(request_type=dict) - - def test_get_firewall_endpoint_field_headers(): client = FirewallActivationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2290,8 +2310,8 @@ async def test_get_firewall_endpoint_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - firewall_activation.CreateFirewallEndpointRequest, - dict, + firewall_activation.CreateFirewallEndpointRequest(), + {}, ], ) def test_create_firewall_endpoint(request_type, transport: str = "grpc"): @@ -2302,7 +2322,7 @@ def test_create_firewall_endpoint(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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 +2369,12 @@ def test_create_firewall_endpoint_non_empty_request_with_auto_populated_field(): client.create_firewall_endpoint(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == firewall_activation.CreateFirewallEndpointRequest( + request_msg = firewall_activation.CreateFirewallEndpointRequest( parent="parent_value", firewall_endpoint_id="firewall_endpoint_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_firewall_endpoint_use_cached_wrapped_rpc(): @@ -2449,9 +2470,15 @@ async def test_create_firewall_endpoint_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + firewall_activation.CreateFirewallEndpointRequest(), + {}, + ], +) async def test_create_firewall_endpoint_async( - transport: str = "grpc_asyncio", - request_type=firewall_activation.CreateFirewallEndpointRequest, + request_type, transport: str = "grpc_asyncio" ): client = FirewallActivationAsyncClient( credentials=async_anonymous_credentials(), @@ -2460,7 +2487,7 @@ async def test_create_firewall_endpoint_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( @@ -2482,11 +2509,6 @@ async def test_create_firewall_endpoint_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_firewall_endpoint_async_from_dict(): - await test_create_firewall_endpoint_async(request_type=dict) - - def test_create_firewall_endpoint_field_headers(): client = FirewallActivationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2661,8 +2683,8 @@ async def test_create_firewall_endpoint_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - firewall_activation.DeleteFirewallEndpointRequest, - dict, + firewall_activation.DeleteFirewallEndpointRequest(), + {}, ], ) def test_delete_firewall_endpoint(request_type, transport: str = "grpc"): @@ -2673,7 +2695,7 @@ def test_delete_firewall_endpoint(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2719,10 +2741,11 @@ def test_delete_firewall_endpoint_non_empty_request_with_auto_populated_field(): client.delete_firewall_endpoint(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == firewall_activation.DeleteFirewallEndpointRequest( + request_msg = firewall_activation.DeleteFirewallEndpointRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_firewall_endpoint_use_cached_wrapped_rpc(): @@ -2818,9 +2841,15 @@ async def test_delete_firewall_endpoint_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + firewall_activation.DeleteFirewallEndpointRequest(), + {}, + ], +) async def test_delete_firewall_endpoint_async( - transport: str = "grpc_asyncio", - request_type=firewall_activation.DeleteFirewallEndpointRequest, + request_type, transport: str = "grpc_asyncio" ): client = FirewallActivationAsyncClient( credentials=async_anonymous_credentials(), @@ -2829,7 +2858,7 @@ async def test_delete_firewall_endpoint_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( @@ -2851,11 +2880,6 @@ async def test_delete_firewall_endpoint_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_firewall_endpoint_async_from_dict(): - await test_delete_firewall_endpoint_async(request_type=dict) - - def test_delete_firewall_endpoint_field_headers(): client = FirewallActivationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3010,8 +3034,8 @@ async def test_delete_firewall_endpoint_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - firewall_activation.UpdateFirewallEndpointRequest, - dict, + firewall_activation.UpdateFirewallEndpointRequest(), + {}, ], ) def test_update_firewall_endpoint(request_type, transport: str = "grpc"): @@ -3022,7 +3046,7 @@ def test_update_firewall_endpoint(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3067,9 +3091,10 @@ def test_update_firewall_endpoint_non_empty_request_with_auto_populated_field(): client.update_firewall_endpoint(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == firewall_activation.UpdateFirewallEndpointRequest( + request_msg = firewall_activation.UpdateFirewallEndpointRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_firewall_endpoint_use_cached_wrapped_rpc(): @@ -3165,9 +3190,15 @@ async def test_update_firewall_endpoint_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + firewall_activation.UpdateFirewallEndpointRequest(), + {}, + ], +) async def test_update_firewall_endpoint_async( - transport: str = "grpc_asyncio", - request_type=firewall_activation.UpdateFirewallEndpointRequest, + request_type, transport: str = "grpc_asyncio" ): client = FirewallActivationAsyncClient( credentials=async_anonymous_credentials(), @@ -3176,7 +3207,7 @@ async def test_update_firewall_endpoint_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( @@ -3198,11 +3229,6 @@ async def test_update_firewall_endpoint_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_firewall_endpoint_async_from_dict(): - await test_update_firewall_endpoint_async(request_type=dict) - - def test_update_firewall_endpoint_field_headers(): client = FirewallActivationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3367,8 +3393,8 @@ async def test_update_firewall_endpoint_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - firewall_activation.ListFirewallEndpointAssociationsRequest, - dict, + firewall_activation.ListFirewallEndpointAssociationsRequest(), + {}, ], ) def test_list_firewall_endpoint_associations(request_type, transport: str = "grpc"): @@ -3379,7 +3405,7 @@ def test_list_firewall_endpoint_associations(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( @@ -3434,12 +3460,13 @@ def test_list_firewall_endpoint_associations_non_empty_request_with_auto_populat client.list_firewall_endpoint_associations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == firewall_activation.ListFirewallEndpointAssociationsRequest( + request_msg = firewall_activation.ListFirewallEndpointAssociationsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_firewall_endpoint_associations_use_cached_wrapped_rpc(): @@ -3525,9 +3552,15 @@ async def test_list_firewall_endpoint_associations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + firewall_activation.ListFirewallEndpointAssociationsRequest(), + {}, + ], +) async def test_list_firewall_endpoint_associations_async( - transport: str = "grpc_asyncio", - request_type=firewall_activation.ListFirewallEndpointAssociationsRequest, + request_type, transport: str = "grpc_asyncio" ): client = FirewallActivationAsyncClient( credentials=async_anonymous_credentials(), @@ -3536,7 +3569,7 @@ async def test_list_firewall_endpoint_associations_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( @@ -3563,11 +3596,6 @@ async def test_list_firewall_endpoint_associations_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_firewall_endpoint_associations_async_from_dict(): - await test_list_firewall_endpoint_associations_async(request_type=dict) - - def test_list_firewall_endpoint_associations_field_headers(): client = FirewallActivationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3936,8 +3964,8 @@ async def test_list_firewall_endpoint_associations_async_pages(): @pytest.mark.parametrize( "request_type", [ - firewall_activation.GetFirewallEndpointAssociationRequest, - dict, + firewall_activation.GetFirewallEndpointAssociationRequest(), + {}, ], ) def test_get_firewall_endpoint_association(request_type, transport: str = "grpc"): @@ -3948,7 +3976,7 @@ def test_get_firewall_endpoint_association(request_type, transport: str = "grpc" # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4010,9 +4038,10 @@ def test_get_firewall_endpoint_association_non_empty_request_with_auto_populated client.get_firewall_endpoint_association(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == firewall_activation.GetFirewallEndpointAssociationRequest( + request_msg = firewall_activation.GetFirewallEndpointAssociationRequest( name="name_value", ) + assert args[0] == request_msg def test_get_firewall_endpoint_association_use_cached_wrapped_rpc(): @@ -4098,9 +4127,15 @@ async def test_get_firewall_endpoint_association_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + firewall_activation.GetFirewallEndpointAssociationRequest(), + {}, + ], +) async def test_get_firewall_endpoint_association_async( - transport: str = "grpc_asyncio", - request_type=firewall_activation.GetFirewallEndpointAssociationRequest, + request_type, transport: str = "grpc_asyncio" ): client = FirewallActivationAsyncClient( credentials=async_anonymous_credentials(), @@ -4109,7 +4144,7 @@ async def test_get_firewall_endpoint_association_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( @@ -4148,11 +4183,6 @@ async def test_get_firewall_endpoint_association_async( assert response.disabled is True -@pytest.mark.asyncio -async def test_get_firewall_endpoint_association_async_from_dict(): - await test_get_firewall_endpoint_association_async(request_type=dict) - - def test_get_firewall_endpoint_association_field_headers(): client = FirewallActivationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4307,8 +4337,8 @@ async def test_get_firewall_endpoint_association_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - firewall_activation.CreateFirewallEndpointAssociationRequest, - dict, + firewall_activation.CreateFirewallEndpointAssociationRequest(), + {}, ], ) def test_create_firewall_endpoint_association(request_type, transport: str = "grpc"): @@ -4319,7 +4349,7 @@ def test_create_firewall_endpoint_association(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( @@ -4366,11 +4396,12 @@ def test_create_firewall_endpoint_association_non_empty_request_with_auto_popula client.create_firewall_endpoint_association(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == firewall_activation.CreateFirewallEndpointAssociationRequest( + request_msg = firewall_activation.CreateFirewallEndpointAssociationRequest( parent="parent_value", firewall_endpoint_association_id="firewall_endpoint_association_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_firewall_endpoint_association_use_cached_wrapped_rpc(): @@ -4466,9 +4497,15 @@ async def test_create_firewall_endpoint_association_async_use_cached_wrapped_rpc @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + firewall_activation.CreateFirewallEndpointAssociationRequest(), + {}, + ], +) async def test_create_firewall_endpoint_association_async( - transport: str = "grpc_asyncio", - request_type=firewall_activation.CreateFirewallEndpointAssociationRequest, + request_type, transport: str = "grpc_asyncio" ): client = FirewallActivationAsyncClient( credentials=async_anonymous_credentials(), @@ -4477,7 +4514,7 @@ async def test_create_firewall_endpoint_association_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( @@ -4499,11 +4536,6 @@ async def test_create_firewall_endpoint_association_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_firewall_endpoint_association_async_from_dict(): - await test_create_firewall_endpoint_association_async(request_type=dict) - - def test_create_firewall_endpoint_association_field_headers(): client = FirewallActivationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4686,8 +4718,8 @@ async def test_create_firewall_endpoint_association_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - firewall_activation.DeleteFirewallEndpointAssociationRequest, - dict, + firewall_activation.DeleteFirewallEndpointAssociationRequest(), + {}, ], ) def test_delete_firewall_endpoint_association(request_type, transport: str = "grpc"): @@ -4698,7 +4730,7 @@ def test_delete_firewall_endpoint_association(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( @@ -4744,10 +4776,11 @@ def test_delete_firewall_endpoint_association_non_empty_request_with_auto_popula client.delete_firewall_endpoint_association(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == firewall_activation.DeleteFirewallEndpointAssociationRequest( + request_msg = firewall_activation.DeleteFirewallEndpointAssociationRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_firewall_endpoint_association_use_cached_wrapped_rpc(): @@ -4843,9 +4876,15 @@ async def test_delete_firewall_endpoint_association_async_use_cached_wrapped_rpc @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + firewall_activation.DeleteFirewallEndpointAssociationRequest(), + {}, + ], +) async def test_delete_firewall_endpoint_association_async( - transport: str = "grpc_asyncio", - request_type=firewall_activation.DeleteFirewallEndpointAssociationRequest, + request_type, transport: str = "grpc_asyncio" ): client = FirewallActivationAsyncClient( credentials=async_anonymous_credentials(), @@ -4854,7 +4893,7 @@ async def test_delete_firewall_endpoint_association_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( @@ -4876,11 +4915,6 @@ async def test_delete_firewall_endpoint_association_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_firewall_endpoint_association_async_from_dict(): - await test_delete_firewall_endpoint_association_async(request_type=dict) - - def test_delete_firewall_endpoint_association_field_headers(): client = FirewallActivationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5035,8 +5069,8 @@ async def test_delete_firewall_endpoint_association_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - firewall_activation.UpdateFirewallEndpointAssociationRequest, - dict, + firewall_activation.UpdateFirewallEndpointAssociationRequest(), + {}, ], ) def test_update_firewall_endpoint_association(request_type, transport: str = "grpc"): @@ -5047,7 +5081,7 @@ def test_update_firewall_endpoint_association(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( @@ -5092,9 +5126,10 @@ def test_update_firewall_endpoint_association_non_empty_request_with_auto_popula client.update_firewall_endpoint_association(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == firewall_activation.UpdateFirewallEndpointAssociationRequest( + request_msg = firewall_activation.UpdateFirewallEndpointAssociationRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_firewall_endpoint_association_use_cached_wrapped_rpc(): @@ -5190,9 +5225,15 @@ async def test_update_firewall_endpoint_association_async_use_cached_wrapped_rpc @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + firewall_activation.UpdateFirewallEndpointAssociationRequest(), + {}, + ], +) async def test_update_firewall_endpoint_association_async( - transport: str = "grpc_asyncio", - request_type=firewall_activation.UpdateFirewallEndpointAssociationRequest, + request_type, transport: str = "grpc_asyncio" ): client = FirewallActivationAsyncClient( credentials=async_anonymous_credentials(), @@ -5201,7 +5242,7 @@ async def test_update_firewall_endpoint_association_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( @@ -5223,11 +5264,6 @@ async def test_update_firewall_endpoint_association_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_firewall_endpoint_association_async_from_dict(): - await test_update_firewall_endpoint_association_async(request_type=dict) - - def test_update_firewall_endpoint_association_field_headers(): client = FirewallActivationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7679,7 +7715,6 @@ def test_list_firewall_endpoints_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firewall_activation.ListFirewallEndpointsRequest() - assert args[0] == request_msg @@ -7702,7 +7737,6 @@ def test_get_firewall_endpoint_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firewall_activation.GetFirewallEndpointRequest() - assert args[0] == request_msg @@ -7725,7 +7759,6 @@ def test_create_firewall_endpoint_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firewall_activation.CreateFirewallEndpointRequest() - assert args[0] == request_msg @@ -7748,7 +7781,6 @@ def test_delete_firewall_endpoint_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firewall_activation.DeleteFirewallEndpointRequest() - assert args[0] == request_msg @@ -7771,7 +7803,6 @@ def test_update_firewall_endpoint_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firewall_activation.UpdateFirewallEndpointRequest() - assert args[0] == request_msg @@ -7796,7 +7827,6 @@ def test_list_firewall_endpoint_associations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firewall_activation.ListFirewallEndpointAssociationsRequest() - assert args[0] == request_msg @@ -7819,7 +7849,6 @@ def test_get_firewall_endpoint_association_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firewall_activation.GetFirewallEndpointAssociationRequest() - assert args[0] == request_msg @@ -7842,7 +7871,6 @@ def test_create_firewall_endpoint_association_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firewall_activation.CreateFirewallEndpointAssociationRequest() - assert args[0] == request_msg @@ -7865,7 +7893,6 @@ def test_delete_firewall_endpoint_association_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firewall_activation.DeleteFirewallEndpointAssociationRequest() - assert args[0] == request_msg @@ -7888,7 +7915,6 @@ def test_update_firewall_endpoint_association_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firewall_activation.UpdateFirewallEndpointAssociationRequest() - assert args[0] == request_msg @@ -7932,7 +7958,6 @@ async def test_list_firewall_endpoints_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firewall_activation.ListFirewallEndpointsRequest() - assert args[0] == request_msg @@ -7968,7 +7993,6 @@ async def test_get_firewall_endpoint_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firewall_activation.GetFirewallEndpointRequest() - assert args[0] == request_msg @@ -7995,7 +8019,6 @@ async def test_create_firewall_endpoint_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firewall_activation.CreateFirewallEndpointRequest() - assert args[0] == request_msg @@ -8022,7 +8045,6 @@ async def test_delete_firewall_endpoint_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firewall_activation.DeleteFirewallEndpointRequest() - assert args[0] == request_msg @@ -8049,7 +8071,6 @@ async def test_update_firewall_endpoint_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firewall_activation.UpdateFirewallEndpointRequest() - assert args[0] == request_msg @@ -8079,7 +8100,6 @@ async def test_list_firewall_endpoint_associations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firewall_activation.ListFirewallEndpointAssociationsRequest() - assert args[0] == request_msg @@ -8114,7 +8134,6 @@ async def test_get_firewall_endpoint_association_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firewall_activation.GetFirewallEndpointAssociationRequest() - assert args[0] == request_msg @@ -8141,7 +8160,6 @@ async def test_create_firewall_endpoint_association_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firewall_activation.CreateFirewallEndpointAssociationRequest() - assert args[0] == request_msg @@ -8168,7 +8186,6 @@ async def test_delete_firewall_endpoint_association_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firewall_activation.DeleteFirewallEndpointAssociationRequest() - assert args[0] == request_msg @@ -8195,7 +8212,6 @@ async def test_update_firewall_endpoint_association_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firewall_activation.UpdateFirewallEndpointAssociationRequest() - assert args[0] == request_msg @@ -10540,7 +10556,6 @@ def test_list_firewall_endpoints_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firewall_activation.ListFirewallEndpointsRequest() - assert args[0] == request_msg @@ -10562,7 +10577,6 @@ def test_get_firewall_endpoint_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firewall_activation.GetFirewallEndpointRequest() - assert args[0] == request_msg @@ -10584,7 +10598,6 @@ def test_create_firewall_endpoint_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firewall_activation.CreateFirewallEndpointRequest() - assert args[0] == request_msg @@ -10606,7 +10619,6 @@ def test_delete_firewall_endpoint_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firewall_activation.DeleteFirewallEndpointRequest() - assert args[0] == request_msg @@ -10628,7 +10640,6 @@ def test_update_firewall_endpoint_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firewall_activation.UpdateFirewallEndpointRequest() - assert args[0] == request_msg @@ -10650,7 +10661,6 @@ def test_list_firewall_endpoint_associations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firewall_activation.ListFirewallEndpointAssociationsRequest() - assert args[0] == request_msg @@ -10672,7 +10682,6 @@ def test_get_firewall_endpoint_association_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firewall_activation.GetFirewallEndpointAssociationRequest() - assert args[0] == request_msg @@ -10694,7 +10703,6 @@ def test_create_firewall_endpoint_association_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firewall_activation.CreateFirewallEndpointAssociationRequest() - assert args[0] == request_msg @@ -10716,7 +10724,6 @@ def test_delete_firewall_endpoint_association_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firewall_activation.DeleteFirewallEndpointAssociationRequest() - assert args[0] == request_msg @@ -10738,7 +10745,6 @@ def test_update_firewall_endpoint_association_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firewall_activation.UpdateFirewallEndpointAssociationRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-network-security/tests/unit/gapic/network_security_v1/test_intercept.py b/packages/google-cloud-network-security/tests/unit/gapic/network_security_v1/test_intercept.py index 10c318910758..0bcde8b5fa8c 100644 --- a/packages/google-cloud-network-security/tests/unit/gapic/network_security_v1/test_intercept.py +++ b/packages/google-cloud-network-security/tests/unit/gapic/network_security_v1/test_intercept.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 @@ -121,6 +122,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" @@ -1278,8 +1294,8 @@ def test_intercept_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - intercept.ListInterceptEndpointGroupsRequest, - dict, + intercept.ListInterceptEndpointGroupsRequest(), + {}, ], ) def test_list_intercept_endpoint_groups(request_type, transport: str = "grpc"): @@ -1290,7 +1306,7 @@ def test_list_intercept_endpoint_groups(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1341,12 +1357,13 @@ def test_list_intercept_endpoint_groups_non_empty_request_with_auto_populated_fi client.list_intercept_endpoint_groups(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == intercept.ListInterceptEndpointGroupsRequest( + request_msg = intercept.ListInterceptEndpointGroupsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_intercept_endpoint_groups_use_cached_wrapped_rpc(): @@ -1432,9 +1449,15 @@ async def test_list_intercept_endpoint_groups_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + intercept.ListInterceptEndpointGroupsRequest(), + {}, + ], +) async def test_list_intercept_endpoint_groups_async( - transport: str = "grpc_asyncio", - request_type=intercept.ListInterceptEndpointGroupsRequest, + request_type, transport: str = "grpc_asyncio" ): client = InterceptAsyncClient( credentials=async_anonymous_credentials(), @@ -1443,7 +1466,7 @@ async def test_list_intercept_endpoint_groups_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( @@ -1468,11 +1491,6 @@ async def test_list_intercept_endpoint_groups_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_intercept_endpoint_groups_async_from_dict(): - await test_list_intercept_endpoint_groups_async(request_type=dict) - - def test_list_intercept_endpoint_groups_field_headers(): client = InterceptClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1829,8 +1847,8 @@ async def test_list_intercept_endpoint_groups_async_pages(): @pytest.mark.parametrize( "request_type", [ - intercept.GetInterceptEndpointGroupRequest, - dict, + intercept.GetInterceptEndpointGroupRequest(), + {}, ], ) def test_get_intercept_endpoint_group(request_type, transport: str = "grpc"): @@ -1841,7 +1859,7 @@ def test_get_intercept_endpoint_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1897,9 +1915,10 @@ def test_get_intercept_endpoint_group_non_empty_request_with_auto_populated_fiel client.get_intercept_endpoint_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == intercept.GetInterceptEndpointGroupRequest( + request_msg = intercept.GetInterceptEndpointGroupRequest( name="name_value", ) + assert args[0] == request_msg def test_get_intercept_endpoint_group_use_cached_wrapped_rpc(): @@ -1985,9 +2004,15 @@ async def test_get_intercept_endpoint_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + intercept.GetInterceptEndpointGroupRequest(), + {}, + ], +) async def test_get_intercept_endpoint_group_async( - transport: str = "grpc_asyncio", - request_type=intercept.GetInterceptEndpointGroupRequest, + request_type, transport: str = "grpc_asyncio" ): client = InterceptAsyncClient( credentials=async_anonymous_credentials(), @@ -1996,7 +2021,7 @@ async def test_get_intercept_endpoint_group_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( @@ -2029,11 +2054,6 @@ async def test_get_intercept_endpoint_group_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_get_intercept_endpoint_group_async_from_dict(): - await test_get_intercept_endpoint_group_async(request_type=dict) - - def test_get_intercept_endpoint_group_field_headers(): client = InterceptClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2188,8 +2208,8 @@ async def test_get_intercept_endpoint_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - intercept.CreateInterceptEndpointGroupRequest, - dict, + intercept.CreateInterceptEndpointGroupRequest(), + {}, ], ) def test_create_intercept_endpoint_group(request_type, transport: str = "grpc"): @@ -2200,7 +2220,7 @@ def test_create_intercept_endpoint_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2246,10 +2266,11 @@ def test_create_intercept_endpoint_group_non_empty_request_with_auto_populated_f client.create_intercept_endpoint_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == intercept.CreateInterceptEndpointGroupRequest( + request_msg = intercept.CreateInterceptEndpointGroupRequest( parent="parent_value", intercept_endpoint_group_id="intercept_endpoint_group_id_value", ) + assert args[0] == request_msg def test_create_intercept_endpoint_group_use_cached_wrapped_rpc(): @@ -2345,9 +2366,15 @@ async def test_create_intercept_endpoint_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + intercept.CreateInterceptEndpointGroupRequest(), + {}, + ], +) async def test_create_intercept_endpoint_group_async( - transport: str = "grpc_asyncio", - request_type=intercept.CreateInterceptEndpointGroupRequest, + request_type, transport: str = "grpc_asyncio" ): client = InterceptAsyncClient( credentials=async_anonymous_credentials(), @@ -2356,7 +2383,7 @@ async def test_create_intercept_endpoint_group_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( @@ -2378,11 +2405,6 @@ async def test_create_intercept_endpoint_group_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_intercept_endpoint_group_async_from_dict(): - await test_create_intercept_endpoint_group_async(request_type=dict) - - def test_create_intercept_endpoint_group_field_headers(): client = InterceptClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2565,8 +2587,8 @@ async def test_create_intercept_endpoint_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - intercept.UpdateInterceptEndpointGroupRequest, - dict, + intercept.UpdateInterceptEndpointGroupRequest(), + {}, ], ) def test_update_intercept_endpoint_group(request_type, transport: str = "grpc"): @@ -2577,7 +2599,7 @@ def test_update_intercept_endpoint_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,7 +2642,8 @@ def test_update_intercept_endpoint_group_non_empty_request_with_auto_populated_f client.update_intercept_endpoint_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == intercept.UpdateInterceptEndpointGroupRequest() + request_msg = intercept.UpdateInterceptEndpointGroupRequest() + assert args[0] == request_msg def test_update_intercept_endpoint_group_use_cached_wrapped_rpc(): @@ -2716,9 +2739,15 @@ async def test_update_intercept_endpoint_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + intercept.UpdateInterceptEndpointGroupRequest(), + {}, + ], +) async def test_update_intercept_endpoint_group_async( - transport: str = "grpc_asyncio", - request_type=intercept.UpdateInterceptEndpointGroupRequest, + request_type, transport: str = "grpc_asyncio" ): client = InterceptAsyncClient( credentials=async_anonymous_credentials(), @@ -2727,7 +2756,7 @@ async def test_update_intercept_endpoint_group_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( @@ -2749,11 +2778,6 @@ async def test_update_intercept_endpoint_group_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_intercept_endpoint_group_async_from_dict(): - await test_update_intercept_endpoint_group_async(request_type=dict) - - def test_update_intercept_endpoint_group_field_headers(): client = InterceptClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2926,8 +2950,8 @@ async def test_update_intercept_endpoint_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - intercept.DeleteInterceptEndpointGroupRequest, - dict, + intercept.DeleteInterceptEndpointGroupRequest(), + {}, ], ) def test_delete_intercept_endpoint_group(request_type, transport: str = "grpc"): @@ -2938,7 +2962,7 @@ def test_delete_intercept_endpoint_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2983,9 +3007,10 @@ def test_delete_intercept_endpoint_group_non_empty_request_with_auto_populated_f client.delete_intercept_endpoint_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == intercept.DeleteInterceptEndpointGroupRequest( + request_msg = intercept.DeleteInterceptEndpointGroupRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_intercept_endpoint_group_use_cached_wrapped_rpc(): @@ -3081,9 +3106,15 @@ async def test_delete_intercept_endpoint_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + intercept.DeleteInterceptEndpointGroupRequest(), + {}, + ], +) async def test_delete_intercept_endpoint_group_async( - transport: str = "grpc_asyncio", - request_type=intercept.DeleteInterceptEndpointGroupRequest, + request_type, transport: str = "grpc_asyncio" ): client = InterceptAsyncClient( credentials=async_anonymous_credentials(), @@ -3092,7 +3123,7 @@ async def test_delete_intercept_endpoint_group_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( @@ -3114,11 +3145,6 @@ async def test_delete_intercept_endpoint_group_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_intercept_endpoint_group_async_from_dict(): - await test_delete_intercept_endpoint_group_async(request_type=dict) - - def test_delete_intercept_endpoint_group_field_headers(): client = InterceptClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3273,8 +3299,8 @@ async def test_delete_intercept_endpoint_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - intercept.ListInterceptEndpointGroupAssociationsRequest, - dict, + intercept.ListInterceptEndpointGroupAssociationsRequest(), + {}, ], ) def test_list_intercept_endpoint_group_associations( @@ -3287,7 +3313,7 @@ def test_list_intercept_endpoint_group_associations( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3338,12 +3364,13 @@ def test_list_intercept_endpoint_group_associations_non_empty_request_with_auto_ client.list_intercept_endpoint_group_associations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == intercept.ListInterceptEndpointGroupAssociationsRequest( + request_msg = intercept.ListInterceptEndpointGroupAssociationsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_intercept_endpoint_group_associations_use_cached_wrapped_rpc(): @@ -3429,9 +3456,15 @@ async def test_list_intercept_endpoint_group_associations_async_use_cached_wrapp @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + intercept.ListInterceptEndpointGroupAssociationsRequest(), + {}, + ], +) async def test_list_intercept_endpoint_group_associations_async( - transport: str = "grpc_asyncio", - request_type=intercept.ListInterceptEndpointGroupAssociationsRequest, + request_type, transport: str = "grpc_asyncio" ): client = InterceptAsyncClient( credentials=async_anonymous_credentials(), @@ -3440,7 +3473,7 @@ async def test_list_intercept_endpoint_group_associations_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( @@ -3465,11 +3498,6 @@ async def test_list_intercept_endpoint_group_associations_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_intercept_endpoint_group_associations_async_from_dict(): - await test_list_intercept_endpoint_group_associations_async(request_type=dict) - - def test_list_intercept_endpoint_group_associations_field_headers(): client = InterceptClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3833,8 +3861,8 @@ async def test_list_intercept_endpoint_group_associations_async_pages(): @pytest.mark.parametrize( "request_type", [ - intercept.GetInterceptEndpointGroupAssociationRequest, - dict, + intercept.GetInterceptEndpointGroupAssociationRequest(), + {}, ], ) def test_get_intercept_endpoint_group_association( @@ -3847,7 +3875,7 @@ def test_get_intercept_endpoint_group_association( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3905,9 +3933,10 @@ def test_get_intercept_endpoint_group_association_non_empty_request_with_auto_po client.get_intercept_endpoint_group_association(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == intercept.GetInterceptEndpointGroupAssociationRequest( + request_msg = intercept.GetInterceptEndpointGroupAssociationRequest( name="name_value", ) + assert args[0] == request_msg def test_get_intercept_endpoint_group_association_use_cached_wrapped_rpc(): @@ -3993,9 +4022,15 @@ async def test_get_intercept_endpoint_group_association_async_use_cached_wrapped @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + intercept.GetInterceptEndpointGroupAssociationRequest(), + {}, + ], +) async def test_get_intercept_endpoint_group_association_async( - transport: str = "grpc_asyncio", - request_type=intercept.GetInterceptEndpointGroupAssociationRequest, + request_type, transport: str = "grpc_asyncio" ): client = InterceptAsyncClient( credentials=async_anonymous_credentials(), @@ -4004,7 +4039,7 @@ async def test_get_intercept_endpoint_group_association_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( @@ -4039,11 +4074,6 @@ async def test_get_intercept_endpoint_group_association_async( assert response.network_cookie == 1507 -@pytest.mark.asyncio -async def test_get_intercept_endpoint_group_association_async_from_dict(): - await test_get_intercept_endpoint_group_association_async(request_type=dict) - - def test_get_intercept_endpoint_group_association_field_headers(): client = InterceptClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4198,8 +4228,8 @@ async def test_get_intercept_endpoint_group_association_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - intercept.CreateInterceptEndpointGroupAssociationRequest, - dict, + intercept.CreateInterceptEndpointGroupAssociationRequest(), + {}, ], ) def test_create_intercept_endpoint_group_association( @@ -4212,7 +4242,7 @@ def test_create_intercept_endpoint_group_association( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4258,10 +4288,11 @@ def test_create_intercept_endpoint_group_association_non_empty_request_with_auto client.create_intercept_endpoint_group_association(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == intercept.CreateInterceptEndpointGroupAssociationRequest( + request_msg = intercept.CreateInterceptEndpointGroupAssociationRequest( parent="parent_value", intercept_endpoint_group_association_id="intercept_endpoint_group_association_id_value", ) + assert args[0] == request_msg def test_create_intercept_endpoint_group_association_use_cached_wrapped_rpc(): @@ -4357,9 +4388,15 @@ async def test_create_intercept_endpoint_group_association_async_use_cached_wrap @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + intercept.CreateInterceptEndpointGroupAssociationRequest(), + {}, + ], +) async def test_create_intercept_endpoint_group_association_async( - transport: str = "grpc_asyncio", - request_type=intercept.CreateInterceptEndpointGroupAssociationRequest, + request_type, transport: str = "grpc_asyncio" ): client = InterceptAsyncClient( credentials=async_anonymous_credentials(), @@ -4368,7 +4405,7 @@ async def test_create_intercept_endpoint_group_association_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( @@ -4390,11 +4427,6 @@ async def test_create_intercept_endpoint_group_association_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_intercept_endpoint_group_association_async_from_dict(): - await test_create_intercept_endpoint_group_association_async(request_type=dict) - - def test_create_intercept_endpoint_group_association_field_headers(): client = InterceptClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4577,8 +4609,8 @@ async def test_create_intercept_endpoint_group_association_flattened_error_async @pytest.mark.parametrize( "request_type", [ - intercept.UpdateInterceptEndpointGroupAssociationRequest, - dict, + intercept.UpdateInterceptEndpointGroupAssociationRequest(), + {}, ], ) def test_update_intercept_endpoint_group_association( @@ -4591,7 +4623,7 @@ def test_update_intercept_endpoint_group_association( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4634,7 +4666,8 @@ def test_update_intercept_endpoint_group_association_non_empty_request_with_auto client.update_intercept_endpoint_group_association(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == intercept.UpdateInterceptEndpointGroupAssociationRequest() + request_msg = intercept.UpdateInterceptEndpointGroupAssociationRequest() + assert args[0] == request_msg def test_update_intercept_endpoint_group_association_use_cached_wrapped_rpc(): @@ -4730,9 +4763,15 @@ async def test_update_intercept_endpoint_group_association_async_use_cached_wrap @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + intercept.UpdateInterceptEndpointGroupAssociationRequest(), + {}, + ], +) async def test_update_intercept_endpoint_group_association_async( - transport: str = "grpc_asyncio", - request_type=intercept.UpdateInterceptEndpointGroupAssociationRequest, + request_type, transport: str = "grpc_asyncio" ): client = InterceptAsyncClient( credentials=async_anonymous_credentials(), @@ -4741,7 +4780,7 @@ async def test_update_intercept_endpoint_group_association_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( @@ -4763,11 +4802,6 @@ async def test_update_intercept_endpoint_group_association_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_intercept_endpoint_group_association_async_from_dict(): - await test_update_intercept_endpoint_group_association_async(request_type=dict) - - def test_update_intercept_endpoint_group_association_field_headers(): client = InterceptClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4940,8 +4974,8 @@ async def test_update_intercept_endpoint_group_association_flattened_error_async @pytest.mark.parametrize( "request_type", [ - intercept.DeleteInterceptEndpointGroupAssociationRequest, - dict, + intercept.DeleteInterceptEndpointGroupAssociationRequest(), + {}, ], ) def test_delete_intercept_endpoint_group_association( @@ -4954,7 +4988,7 @@ def test_delete_intercept_endpoint_group_association( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4999,9 +5033,10 @@ def test_delete_intercept_endpoint_group_association_non_empty_request_with_auto client.delete_intercept_endpoint_group_association(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == intercept.DeleteInterceptEndpointGroupAssociationRequest( + request_msg = intercept.DeleteInterceptEndpointGroupAssociationRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_intercept_endpoint_group_association_use_cached_wrapped_rpc(): @@ -5097,9 +5132,15 @@ async def test_delete_intercept_endpoint_group_association_async_use_cached_wrap @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + intercept.DeleteInterceptEndpointGroupAssociationRequest(), + {}, + ], +) async def test_delete_intercept_endpoint_group_association_async( - transport: str = "grpc_asyncio", - request_type=intercept.DeleteInterceptEndpointGroupAssociationRequest, + request_type, transport: str = "grpc_asyncio" ): client = InterceptAsyncClient( credentials=async_anonymous_credentials(), @@ -5108,7 +5149,7 @@ async def test_delete_intercept_endpoint_group_association_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( @@ -5130,11 +5171,6 @@ async def test_delete_intercept_endpoint_group_association_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_intercept_endpoint_group_association_async_from_dict(): - await test_delete_intercept_endpoint_group_association_async(request_type=dict) - - def test_delete_intercept_endpoint_group_association_field_headers(): client = InterceptClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5289,8 +5325,8 @@ async def test_delete_intercept_endpoint_group_association_flattened_error_async @pytest.mark.parametrize( "request_type", [ - intercept.ListInterceptDeploymentGroupsRequest, - dict, + intercept.ListInterceptDeploymentGroupsRequest(), + {}, ], ) def test_list_intercept_deployment_groups(request_type, transport: str = "grpc"): @@ -5301,7 +5337,7 @@ def test_list_intercept_deployment_groups(request_type, transport: str = "grpc") # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5352,12 +5388,13 @@ def test_list_intercept_deployment_groups_non_empty_request_with_auto_populated_ client.list_intercept_deployment_groups(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == intercept.ListInterceptDeploymentGroupsRequest( + request_msg = intercept.ListInterceptDeploymentGroupsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_intercept_deployment_groups_use_cached_wrapped_rpc(): @@ -5443,9 +5480,15 @@ async def test_list_intercept_deployment_groups_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + intercept.ListInterceptDeploymentGroupsRequest(), + {}, + ], +) async def test_list_intercept_deployment_groups_async( - transport: str = "grpc_asyncio", - request_type=intercept.ListInterceptDeploymentGroupsRequest, + request_type, transport: str = "grpc_asyncio" ): client = InterceptAsyncClient( credentials=async_anonymous_credentials(), @@ -5454,7 +5497,7 @@ async def test_list_intercept_deployment_groups_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( @@ -5479,11 +5522,6 @@ async def test_list_intercept_deployment_groups_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_intercept_deployment_groups_async_from_dict(): - await test_list_intercept_deployment_groups_async(request_type=dict) - - def test_list_intercept_deployment_groups_field_headers(): client = InterceptClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5840,8 +5878,8 @@ async def test_list_intercept_deployment_groups_async_pages(): @pytest.mark.parametrize( "request_type", [ - intercept.GetInterceptDeploymentGroupRequest, - dict, + intercept.GetInterceptDeploymentGroupRequest(), + {}, ], ) def test_get_intercept_deployment_group(request_type, transport: str = "grpc"): @@ -5852,7 +5890,7 @@ def test_get_intercept_deployment_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5908,9 +5946,10 @@ def test_get_intercept_deployment_group_non_empty_request_with_auto_populated_fi client.get_intercept_deployment_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == intercept.GetInterceptDeploymentGroupRequest( + request_msg = intercept.GetInterceptDeploymentGroupRequest( name="name_value", ) + assert args[0] == request_msg def test_get_intercept_deployment_group_use_cached_wrapped_rpc(): @@ -5996,9 +6035,15 @@ async def test_get_intercept_deployment_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + intercept.GetInterceptDeploymentGroupRequest(), + {}, + ], +) async def test_get_intercept_deployment_group_async( - transport: str = "grpc_asyncio", - request_type=intercept.GetInterceptDeploymentGroupRequest, + request_type, transport: str = "grpc_asyncio" ): client = InterceptAsyncClient( credentials=async_anonymous_credentials(), @@ -6007,7 +6052,7 @@ async def test_get_intercept_deployment_group_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( @@ -6040,11 +6085,6 @@ async def test_get_intercept_deployment_group_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_get_intercept_deployment_group_async_from_dict(): - await test_get_intercept_deployment_group_async(request_type=dict) - - def test_get_intercept_deployment_group_field_headers(): client = InterceptClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6199,8 +6239,8 @@ async def test_get_intercept_deployment_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - intercept.CreateInterceptDeploymentGroupRequest, - dict, + intercept.CreateInterceptDeploymentGroupRequest(), + {}, ], ) def test_create_intercept_deployment_group(request_type, transport: str = "grpc"): @@ -6211,7 +6251,7 @@ def test_create_intercept_deployment_group(request_type, transport: str = "grpc" # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6257,10 +6297,11 @@ def test_create_intercept_deployment_group_non_empty_request_with_auto_populated client.create_intercept_deployment_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == intercept.CreateInterceptDeploymentGroupRequest( + request_msg = intercept.CreateInterceptDeploymentGroupRequest( parent="parent_value", intercept_deployment_group_id="intercept_deployment_group_id_value", ) + assert args[0] == request_msg def test_create_intercept_deployment_group_use_cached_wrapped_rpc(): @@ -6356,9 +6397,15 @@ async def test_create_intercept_deployment_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + intercept.CreateInterceptDeploymentGroupRequest(), + {}, + ], +) async def test_create_intercept_deployment_group_async( - transport: str = "grpc_asyncio", - request_type=intercept.CreateInterceptDeploymentGroupRequest, + request_type, transport: str = "grpc_asyncio" ): client = InterceptAsyncClient( credentials=async_anonymous_credentials(), @@ -6367,7 +6414,7 @@ async def test_create_intercept_deployment_group_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( @@ -6389,11 +6436,6 @@ async def test_create_intercept_deployment_group_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_intercept_deployment_group_async_from_dict(): - await test_create_intercept_deployment_group_async(request_type=dict) - - def test_create_intercept_deployment_group_field_headers(): client = InterceptClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6576,8 +6618,8 @@ async def test_create_intercept_deployment_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - intercept.UpdateInterceptDeploymentGroupRequest, - dict, + intercept.UpdateInterceptDeploymentGroupRequest(), + {}, ], ) def test_update_intercept_deployment_group(request_type, transport: str = "grpc"): @@ -6588,7 +6630,7 @@ def test_update_intercept_deployment_group(request_type, transport: str = "grpc" # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6631,7 +6673,8 @@ def test_update_intercept_deployment_group_non_empty_request_with_auto_populated client.update_intercept_deployment_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == intercept.UpdateInterceptDeploymentGroupRequest() + request_msg = intercept.UpdateInterceptDeploymentGroupRequest() + assert args[0] == request_msg def test_update_intercept_deployment_group_use_cached_wrapped_rpc(): @@ -6727,9 +6770,15 @@ async def test_update_intercept_deployment_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + intercept.UpdateInterceptDeploymentGroupRequest(), + {}, + ], +) async def test_update_intercept_deployment_group_async( - transport: str = "grpc_asyncio", - request_type=intercept.UpdateInterceptDeploymentGroupRequest, + request_type, transport: str = "grpc_asyncio" ): client = InterceptAsyncClient( credentials=async_anonymous_credentials(), @@ -6738,7 +6787,7 @@ async def test_update_intercept_deployment_group_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( @@ -6760,11 +6809,6 @@ async def test_update_intercept_deployment_group_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_intercept_deployment_group_async_from_dict(): - await test_update_intercept_deployment_group_async(request_type=dict) - - def test_update_intercept_deployment_group_field_headers(): client = InterceptClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6937,8 +6981,8 @@ async def test_update_intercept_deployment_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - intercept.DeleteInterceptDeploymentGroupRequest, - dict, + intercept.DeleteInterceptDeploymentGroupRequest(), + {}, ], ) def test_delete_intercept_deployment_group(request_type, transport: str = "grpc"): @@ -6949,7 +6993,7 @@ def test_delete_intercept_deployment_group(request_type, transport: str = "grpc" # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6994,9 +7038,10 @@ def test_delete_intercept_deployment_group_non_empty_request_with_auto_populated client.delete_intercept_deployment_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == intercept.DeleteInterceptDeploymentGroupRequest( + request_msg = intercept.DeleteInterceptDeploymentGroupRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_intercept_deployment_group_use_cached_wrapped_rpc(): @@ -7092,9 +7137,15 @@ async def test_delete_intercept_deployment_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + intercept.DeleteInterceptDeploymentGroupRequest(), + {}, + ], +) async def test_delete_intercept_deployment_group_async( - transport: str = "grpc_asyncio", - request_type=intercept.DeleteInterceptDeploymentGroupRequest, + request_type, transport: str = "grpc_asyncio" ): client = InterceptAsyncClient( credentials=async_anonymous_credentials(), @@ -7103,7 +7154,7 @@ async def test_delete_intercept_deployment_group_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( @@ -7125,11 +7176,6 @@ async def test_delete_intercept_deployment_group_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_intercept_deployment_group_async_from_dict(): - await test_delete_intercept_deployment_group_async(request_type=dict) - - def test_delete_intercept_deployment_group_field_headers(): client = InterceptClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7284,8 +7330,8 @@ async def test_delete_intercept_deployment_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - intercept.ListInterceptDeploymentsRequest, - dict, + intercept.ListInterceptDeploymentsRequest(), + {}, ], ) def test_list_intercept_deployments(request_type, transport: str = "grpc"): @@ -7296,7 +7342,7 @@ def test_list_intercept_deployments(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7349,12 +7395,13 @@ def test_list_intercept_deployments_non_empty_request_with_auto_populated_field( client.list_intercept_deployments(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == intercept.ListInterceptDeploymentsRequest( + request_msg = intercept.ListInterceptDeploymentsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_intercept_deployments_use_cached_wrapped_rpc(): @@ -7440,9 +7487,15 @@ async def test_list_intercept_deployments_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + intercept.ListInterceptDeploymentsRequest(), + {}, + ], +) async def test_list_intercept_deployments_async( - transport: str = "grpc_asyncio", - request_type=intercept.ListInterceptDeploymentsRequest, + request_type, transport: str = "grpc_asyncio" ): client = InterceptAsyncClient( credentials=async_anonymous_credentials(), @@ -7451,7 +7504,7 @@ async def test_list_intercept_deployments_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( @@ -7478,11 +7531,6 @@ async def test_list_intercept_deployments_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_intercept_deployments_async_from_dict(): - await test_list_intercept_deployments_async(request_type=dict) - - def test_list_intercept_deployments_field_headers(): client = InterceptClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7837,8 +7885,8 @@ async def test_list_intercept_deployments_async_pages(): @pytest.mark.parametrize( "request_type", [ - intercept.GetInterceptDeploymentRequest, - dict, + intercept.GetInterceptDeploymentRequest(), + {}, ], ) def test_get_intercept_deployment(request_type, transport: str = "grpc"): @@ -7849,7 +7897,7 @@ def test_get_intercept_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7907,9 +7955,10 @@ def test_get_intercept_deployment_non_empty_request_with_auto_populated_field(): client.get_intercept_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == intercept.GetInterceptDeploymentRequest( + request_msg = intercept.GetInterceptDeploymentRequest( name="name_value", ) + assert args[0] == request_msg def test_get_intercept_deployment_use_cached_wrapped_rpc(): @@ -7995,9 +8044,15 @@ async def test_get_intercept_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + intercept.GetInterceptDeploymentRequest(), + {}, + ], +) async def test_get_intercept_deployment_async( - transport: str = "grpc_asyncio", - request_type=intercept.GetInterceptDeploymentRequest, + request_type, transport: str = "grpc_asyncio" ): client = InterceptAsyncClient( credentials=async_anonymous_credentials(), @@ -8006,7 +8061,7 @@ async def test_get_intercept_deployment_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( @@ -8041,11 +8096,6 @@ async def test_get_intercept_deployment_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_get_intercept_deployment_async_from_dict(): - await test_get_intercept_deployment_async(request_type=dict) - - def test_get_intercept_deployment_field_headers(): client = InterceptClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8200,8 +8250,8 @@ async def test_get_intercept_deployment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - intercept.CreateInterceptDeploymentRequest, - dict, + intercept.CreateInterceptDeploymentRequest(), + {}, ], ) def test_create_intercept_deployment(request_type, transport: str = "grpc"): @@ -8212,7 +8262,7 @@ def test_create_intercept_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8258,10 +8308,11 @@ def test_create_intercept_deployment_non_empty_request_with_auto_populated_field client.create_intercept_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == intercept.CreateInterceptDeploymentRequest( + request_msg = intercept.CreateInterceptDeploymentRequest( parent="parent_value", intercept_deployment_id="intercept_deployment_id_value", ) + assert args[0] == request_msg def test_create_intercept_deployment_use_cached_wrapped_rpc(): @@ -8357,9 +8408,15 @@ async def test_create_intercept_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + intercept.CreateInterceptDeploymentRequest(), + {}, + ], +) async def test_create_intercept_deployment_async( - transport: str = "grpc_asyncio", - request_type=intercept.CreateInterceptDeploymentRequest, + request_type, transport: str = "grpc_asyncio" ): client = InterceptAsyncClient( credentials=async_anonymous_credentials(), @@ -8368,7 +8425,7 @@ async def test_create_intercept_deployment_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( @@ -8390,11 +8447,6 @@ async def test_create_intercept_deployment_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_intercept_deployment_async_from_dict(): - await test_create_intercept_deployment_async(request_type=dict) - - def test_create_intercept_deployment_field_headers(): client = InterceptClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8569,8 +8621,8 @@ async def test_create_intercept_deployment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - intercept.UpdateInterceptDeploymentRequest, - dict, + intercept.UpdateInterceptDeploymentRequest(), + {}, ], ) def test_update_intercept_deployment(request_type, transport: str = "grpc"): @@ -8581,7 +8633,7 @@ def test_update_intercept_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8624,7 +8676,8 @@ def test_update_intercept_deployment_non_empty_request_with_auto_populated_field client.update_intercept_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == intercept.UpdateInterceptDeploymentRequest() + request_msg = intercept.UpdateInterceptDeploymentRequest() + assert args[0] == request_msg def test_update_intercept_deployment_use_cached_wrapped_rpc(): @@ -8720,9 +8773,15 @@ async def test_update_intercept_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + intercept.UpdateInterceptDeploymentRequest(), + {}, + ], +) async def test_update_intercept_deployment_async( - transport: str = "grpc_asyncio", - request_type=intercept.UpdateInterceptDeploymentRequest, + request_type, transport: str = "grpc_asyncio" ): client = InterceptAsyncClient( credentials=async_anonymous_credentials(), @@ -8731,7 +8790,7 @@ async def test_update_intercept_deployment_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( @@ -8753,11 +8812,6 @@ async def test_update_intercept_deployment_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_intercept_deployment_async_from_dict(): - await test_update_intercept_deployment_async(request_type=dict) - - def test_update_intercept_deployment_field_headers(): client = InterceptClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8922,8 +8976,8 @@ async def test_update_intercept_deployment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - intercept.DeleteInterceptDeploymentRequest, - dict, + intercept.DeleteInterceptDeploymentRequest(), + {}, ], ) def test_delete_intercept_deployment(request_type, transport: str = "grpc"): @@ -8934,7 +8988,7 @@ def test_delete_intercept_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8979,9 +9033,10 @@ def test_delete_intercept_deployment_non_empty_request_with_auto_populated_field client.delete_intercept_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == intercept.DeleteInterceptDeploymentRequest( + request_msg = intercept.DeleteInterceptDeploymentRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_intercept_deployment_use_cached_wrapped_rpc(): @@ -9077,9 +9132,15 @@ async def test_delete_intercept_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + intercept.DeleteInterceptDeploymentRequest(), + {}, + ], +) async def test_delete_intercept_deployment_async( - transport: str = "grpc_asyncio", - request_type=intercept.DeleteInterceptDeploymentRequest, + request_type, transport: str = "grpc_asyncio" ): client = InterceptAsyncClient( credentials=async_anonymous_credentials(), @@ -9088,7 +9149,7 @@ async def test_delete_intercept_deployment_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( @@ -9110,11 +9171,6 @@ async def test_delete_intercept_deployment_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_intercept_deployment_async_from_dict(): - await test_delete_intercept_deployment_async(request_type=dict) - - def test_delete_intercept_deployment_field_headers(): client = InterceptClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13731,7 +13787,6 @@ def test_list_intercept_endpoint_groups_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.ListInterceptEndpointGroupsRequest() - assert args[0] == request_msg @@ -13754,7 +13809,6 @@ def test_get_intercept_endpoint_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.GetInterceptEndpointGroupRequest() - assert args[0] == request_msg @@ -13777,7 +13831,6 @@ def test_create_intercept_endpoint_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.CreateInterceptEndpointGroupRequest() - assert args[0] == request_msg @@ -13800,7 +13853,6 @@ def test_update_intercept_endpoint_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.UpdateInterceptEndpointGroupRequest() - assert args[0] == request_msg @@ -13823,7 +13875,6 @@ def test_delete_intercept_endpoint_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.DeleteInterceptEndpointGroupRequest() - assert args[0] == request_msg @@ -13846,7 +13897,6 @@ def test_list_intercept_endpoint_group_associations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.ListInterceptEndpointGroupAssociationsRequest() - assert args[0] == request_msg @@ -13869,7 +13919,6 @@ def test_get_intercept_endpoint_group_association_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.GetInterceptEndpointGroupAssociationRequest() - assert args[0] == request_msg @@ -13892,7 +13941,6 @@ def test_create_intercept_endpoint_group_association_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.CreateInterceptEndpointGroupAssociationRequest() - assert args[0] == request_msg @@ -13915,7 +13963,6 @@ def test_update_intercept_endpoint_group_association_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.UpdateInterceptEndpointGroupAssociationRequest() - assert args[0] == request_msg @@ -13938,7 +13985,6 @@ def test_delete_intercept_endpoint_group_association_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.DeleteInterceptEndpointGroupAssociationRequest() - assert args[0] == request_msg @@ -13961,7 +14007,6 @@ def test_list_intercept_deployment_groups_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.ListInterceptDeploymentGroupsRequest() - assert args[0] == request_msg @@ -13984,7 +14029,6 @@ def test_get_intercept_deployment_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.GetInterceptDeploymentGroupRequest() - assert args[0] == request_msg @@ -14007,7 +14051,6 @@ def test_create_intercept_deployment_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.CreateInterceptDeploymentGroupRequest() - assert args[0] == request_msg @@ -14030,7 +14073,6 @@ def test_update_intercept_deployment_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.UpdateInterceptDeploymentGroupRequest() - assert args[0] == request_msg @@ -14053,7 +14095,6 @@ def test_delete_intercept_deployment_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.DeleteInterceptDeploymentGroupRequest() - assert args[0] == request_msg @@ -14076,7 +14117,6 @@ def test_list_intercept_deployments_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.ListInterceptDeploymentsRequest() - assert args[0] == request_msg @@ -14099,7 +14139,6 @@ def test_get_intercept_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.GetInterceptDeploymentRequest() - assert args[0] == request_msg @@ -14122,7 +14161,6 @@ def test_create_intercept_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.CreateInterceptDeploymentRequest() - assert args[0] == request_msg @@ -14145,7 +14183,6 @@ def test_update_intercept_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.UpdateInterceptDeploymentRequest() - assert args[0] == request_msg @@ -14168,7 +14205,6 @@ def test_delete_intercept_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.DeleteInterceptDeploymentRequest() - assert args[0] == request_msg @@ -14211,7 +14247,6 @@ async def test_list_intercept_endpoint_groups_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.ListInterceptEndpointGroupsRequest() - assert args[0] == request_msg @@ -14244,7 +14279,6 @@ async def test_get_intercept_endpoint_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.GetInterceptEndpointGroupRequest() - assert args[0] == request_msg @@ -14271,7 +14305,6 @@ async def test_create_intercept_endpoint_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.CreateInterceptEndpointGroupRequest() - assert args[0] == request_msg @@ -14298,7 +14331,6 @@ async def test_update_intercept_endpoint_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.UpdateInterceptEndpointGroupRequest() - assert args[0] == request_msg @@ -14325,7 +14357,6 @@ async def test_delete_intercept_endpoint_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.DeleteInterceptEndpointGroupRequest() - assert args[0] == request_msg @@ -14354,7 +14385,6 @@ async def test_list_intercept_endpoint_group_associations_empty_call_grpc_asynci call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.ListInterceptEndpointGroupAssociationsRequest() - assert args[0] == request_msg @@ -14388,7 +14418,6 @@ async def test_get_intercept_endpoint_group_association_empty_call_grpc_asyncio( call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.GetInterceptEndpointGroupAssociationRequest() - assert args[0] == request_msg @@ -14415,7 +14444,6 @@ async def test_create_intercept_endpoint_group_association_empty_call_grpc_async call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.CreateInterceptEndpointGroupAssociationRequest() - assert args[0] == request_msg @@ -14442,7 +14470,6 @@ async def test_update_intercept_endpoint_group_association_empty_call_grpc_async call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.UpdateInterceptEndpointGroupAssociationRequest() - assert args[0] == request_msg @@ -14469,7 +14496,6 @@ async def test_delete_intercept_endpoint_group_association_empty_call_grpc_async call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.DeleteInterceptEndpointGroupAssociationRequest() - assert args[0] == request_msg @@ -14498,7 +14524,6 @@ async def test_list_intercept_deployment_groups_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.ListInterceptDeploymentGroupsRequest() - assert args[0] == request_msg @@ -14531,7 +14556,6 @@ async def test_get_intercept_deployment_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.GetInterceptDeploymentGroupRequest() - assert args[0] == request_msg @@ -14558,7 +14582,6 @@ async def test_create_intercept_deployment_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.CreateInterceptDeploymentGroupRequest() - assert args[0] == request_msg @@ -14585,7 +14608,6 @@ async def test_update_intercept_deployment_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.UpdateInterceptDeploymentGroupRequest() - assert args[0] == request_msg @@ -14612,7 +14634,6 @@ async def test_delete_intercept_deployment_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.DeleteInterceptDeploymentGroupRequest() - assert args[0] == request_msg @@ -14642,7 +14663,6 @@ async def test_list_intercept_deployments_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.ListInterceptDeploymentsRequest() - assert args[0] == request_msg @@ -14676,7 +14696,6 @@ async def test_get_intercept_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.GetInterceptDeploymentRequest() - assert args[0] == request_msg @@ -14703,7 +14722,6 @@ async def test_create_intercept_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.CreateInterceptDeploymentRequest() - assert args[0] == request_msg @@ -14730,7 +14748,6 @@ async def test_update_intercept_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.UpdateInterceptDeploymentRequest() - assert args[0] == request_msg @@ -14757,7 +14774,6 @@ async def test_delete_intercept_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.DeleteInterceptDeploymentRequest() - assert args[0] == request_msg @@ -18731,7 +18747,6 @@ def test_list_intercept_endpoint_groups_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.ListInterceptEndpointGroupsRequest() - assert args[0] == request_msg @@ -18753,7 +18768,6 @@ def test_get_intercept_endpoint_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.GetInterceptEndpointGroupRequest() - assert args[0] == request_msg @@ -18775,7 +18789,6 @@ def test_create_intercept_endpoint_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.CreateInterceptEndpointGroupRequest() - assert args[0] == request_msg @@ -18797,7 +18810,6 @@ def test_update_intercept_endpoint_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.UpdateInterceptEndpointGroupRequest() - assert args[0] == request_msg @@ -18819,7 +18831,6 @@ def test_delete_intercept_endpoint_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.DeleteInterceptEndpointGroupRequest() - assert args[0] == request_msg @@ -18841,7 +18852,6 @@ def test_list_intercept_endpoint_group_associations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.ListInterceptEndpointGroupAssociationsRequest() - assert args[0] == request_msg @@ -18863,7 +18873,6 @@ def test_get_intercept_endpoint_group_association_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.GetInterceptEndpointGroupAssociationRequest() - assert args[0] == request_msg @@ -18885,7 +18894,6 @@ def test_create_intercept_endpoint_group_association_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.CreateInterceptEndpointGroupAssociationRequest() - assert args[0] == request_msg @@ -18907,7 +18915,6 @@ def test_update_intercept_endpoint_group_association_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.UpdateInterceptEndpointGroupAssociationRequest() - assert args[0] == request_msg @@ -18929,7 +18936,6 @@ def test_delete_intercept_endpoint_group_association_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.DeleteInterceptEndpointGroupAssociationRequest() - assert args[0] == request_msg @@ -18951,7 +18957,6 @@ def test_list_intercept_deployment_groups_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.ListInterceptDeploymentGroupsRequest() - assert args[0] == request_msg @@ -18973,7 +18978,6 @@ def test_get_intercept_deployment_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.GetInterceptDeploymentGroupRequest() - assert args[0] == request_msg @@ -18995,7 +18999,6 @@ def test_create_intercept_deployment_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.CreateInterceptDeploymentGroupRequest() - assert args[0] == request_msg @@ -19017,7 +19020,6 @@ def test_update_intercept_deployment_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.UpdateInterceptDeploymentGroupRequest() - assert args[0] == request_msg @@ -19039,7 +19041,6 @@ def test_delete_intercept_deployment_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.DeleteInterceptDeploymentGroupRequest() - assert args[0] == request_msg @@ -19061,7 +19062,6 @@ def test_list_intercept_deployments_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.ListInterceptDeploymentsRequest() - assert args[0] == request_msg @@ -19083,7 +19083,6 @@ def test_get_intercept_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.GetInterceptDeploymentRequest() - assert args[0] == request_msg @@ -19105,7 +19104,6 @@ def test_create_intercept_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.CreateInterceptDeploymentRequest() - assert args[0] == request_msg @@ -19127,7 +19125,6 @@ def test_update_intercept_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.UpdateInterceptDeploymentRequest() - assert args[0] == request_msg @@ -19149,7 +19146,6 @@ def test_delete_intercept_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.DeleteInterceptDeploymentRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-network-security/tests/unit/gapic/network_security_v1/test_mirroring.py b/packages/google-cloud-network-security/tests/unit/gapic/network_security_v1/test_mirroring.py index 3db1b27ea7fa..28313473c292 100644 --- a/packages/google-cloud-network-security/tests/unit/gapic/network_security_v1/test_mirroring.py +++ b/packages/google-cloud-network-security/tests/unit/gapic/network_security_v1/test_mirroring.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 @@ -121,6 +122,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" @@ -1278,8 +1294,8 @@ def test_mirroring_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - mirroring.ListMirroringEndpointGroupsRequest, - dict, + mirroring.ListMirroringEndpointGroupsRequest(), + {}, ], ) def test_list_mirroring_endpoint_groups(request_type, transport: str = "grpc"): @@ -1290,7 +1306,7 @@ def test_list_mirroring_endpoint_groups(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1341,12 +1357,13 @@ def test_list_mirroring_endpoint_groups_non_empty_request_with_auto_populated_fi client.list_mirroring_endpoint_groups(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == mirroring.ListMirroringEndpointGroupsRequest( + request_msg = mirroring.ListMirroringEndpointGroupsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_mirroring_endpoint_groups_use_cached_wrapped_rpc(): @@ -1432,9 +1449,15 @@ async def test_list_mirroring_endpoint_groups_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + mirroring.ListMirroringEndpointGroupsRequest(), + {}, + ], +) async def test_list_mirroring_endpoint_groups_async( - transport: str = "grpc_asyncio", - request_type=mirroring.ListMirroringEndpointGroupsRequest, + request_type, transport: str = "grpc_asyncio" ): client = MirroringAsyncClient( credentials=async_anonymous_credentials(), @@ -1443,7 +1466,7 @@ async def test_list_mirroring_endpoint_groups_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( @@ -1468,11 +1491,6 @@ async def test_list_mirroring_endpoint_groups_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_mirroring_endpoint_groups_async_from_dict(): - await test_list_mirroring_endpoint_groups_async(request_type=dict) - - def test_list_mirroring_endpoint_groups_field_headers(): client = MirroringClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1829,8 +1847,8 @@ async def test_list_mirroring_endpoint_groups_async_pages(): @pytest.mark.parametrize( "request_type", [ - mirroring.GetMirroringEndpointGroupRequest, - dict, + mirroring.GetMirroringEndpointGroupRequest(), + {}, ], ) def test_get_mirroring_endpoint_group(request_type, transport: str = "grpc"): @@ -1841,7 +1859,7 @@ def test_get_mirroring_endpoint_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1899,9 +1917,10 @@ def test_get_mirroring_endpoint_group_non_empty_request_with_auto_populated_fiel client.get_mirroring_endpoint_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == mirroring.GetMirroringEndpointGroupRequest( + request_msg = mirroring.GetMirroringEndpointGroupRequest( name="name_value", ) + assert args[0] == request_msg def test_get_mirroring_endpoint_group_use_cached_wrapped_rpc(): @@ -1987,9 +2006,15 @@ async def test_get_mirroring_endpoint_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + mirroring.GetMirroringEndpointGroupRequest(), + {}, + ], +) async def test_get_mirroring_endpoint_group_async( - transport: str = "grpc_asyncio", - request_type=mirroring.GetMirroringEndpointGroupRequest, + request_type, transport: str = "grpc_asyncio" ): client = MirroringAsyncClient( credentials=async_anonymous_credentials(), @@ -1998,7 +2023,7 @@ async def test_get_mirroring_endpoint_group_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( @@ -2033,11 +2058,6 @@ async def test_get_mirroring_endpoint_group_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_get_mirroring_endpoint_group_async_from_dict(): - await test_get_mirroring_endpoint_group_async(request_type=dict) - - def test_get_mirroring_endpoint_group_field_headers(): client = MirroringClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2192,8 +2212,8 @@ async def test_get_mirroring_endpoint_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - mirroring.CreateMirroringEndpointGroupRequest, - dict, + mirroring.CreateMirroringEndpointGroupRequest(), + {}, ], ) def test_create_mirroring_endpoint_group(request_type, transport: str = "grpc"): @@ -2204,7 +2224,7 @@ def test_create_mirroring_endpoint_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2250,10 +2270,11 @@ def test_create_mirroring_endpoint_group_non_empty_request_with_auto_populated_f client.create_mirroring_endpoint_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == mirroring.CreateMirroringEndpointGroupRequest( + request_msg = mirroring.CreateMirroringEndpointGroupRequest( parent="parent_value", mirroring_endpoint_group_id="mirroring_endpoint_group_id_value", ) + assert args[0] == request_msg def test_create_mirroring_endpoint_group_use_cached_wrapped_rpc(): @@ -2349,9 +2370,15 @@ async def test_create_mirroring_endpoint_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + mirroring.CreateMirroringEndpointGroupRequest(), + {}, + ], +) async def test_create_mirroring_endpoint_group_async( - transport: str = "grpc_asyncio", - request_type=mirroring.CreateMirroringEndpointGroupRequest, + request_type, transport: str = "grpc_asyncio" ): client = MirroringAsyncClient( credentials=async_anonymous_credentials(), @@ -2360,7 +2387,7 @@ async def test_create_mirroring_endpoint_group_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( @@ -2382,11 +2409,6 @@ async def test_create_mirroring_endpoint_group_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_mirroring_endpoint_group_async_from_dict(): - await test_create_mirroring_endpoint_group_async(request_type=dict) - - def test_create_mirroring_endpoint_group_field_headers(): client = MirroringClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2569,8 +2591,8 @@ async def test_create_mirroring_endpoint_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - mirroring.UpdateMirroringEndpointGroupRequest, - dict, + mirroring.UpdateMirroringEndpointGroupRequest(), + {}, ], ) def test_update_mirroring_endpoint_group(request_type, transport: str = "grpc"): @@ -2581,7 +2603,7 @@ def test_update_mirroring_endpoint_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2624,7 +2646,8 @@ def test_update_mirroring_endpoint_group_non_empty_request_with_auto_populated_f client.update_mirroring_endpoint_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == mirroring.UpdateMirroringEndpointGroupRequest() + request_msg = mirroring.UpdateMirroringEndpointGroupRequest() + assert args[0] == request_msg def test_update_mirroring_endpoint_group_use_cached_wrapped_rpc(): @@ -2720,9 +2743,15 @@ async def test_update_mirroring_endpoint_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + mirroring.UpdateMirroringEndpointGroupRequest(), + {}, + ], +) async def test_update_mirroring_endpoint_group_async( - transport: str = "grpc_asyncio", - request_type=mirroring.UpdateMirroringEndpointGroupRequest, + request_type, transport: str = "grpc_asyncio" ): client = MirroringAsyncClient( credentials=async_anonymous_credentials(), @@ -2731,7 +2760,7 @@ async def test_update_mirroring_endpoint_group_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( @@ -2753,11 +2782,6 @@ async def test_update_mirroring_endpoint_group_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_mirroring_endpoint_group_async_from_dict(): - await test_update_mirroring_endpoint_group_async(request_type=dict) - - def test_update_mirroring_endpoint_group_field_headers(): client = MirroringClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2930,8 +2954,8 @@ async def test_update_mirroring_endpoint_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - mirroring.DeleteMirroringEndpointGroupRequest, - dict, + mirroring.DeleteMirroringEndpointGroupRequest(), + {}, ], ) def test_delete_mirroring_endpoint_group(request_type, transport: str = "grpc"): @@ -2942,7 +2966,7 @@ def test_delete_mirroring_endpoint_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2987,9 +3011,10 @@ def test_delete_mirroring_endpoint_group_non_empty_request_with_auto_populated_f client.delete_mirroring_endpoint_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == mirroring.DeleteMirroringEndpointGroupRequest( + request_msg = mirroring.DeleteMirroringEndpointGroupRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_mirroring_endpoint_group_use_cached_wrapped_rpc(): @@ -3085,9 +3110,15 @@ async def test_delete_mirroring_endpoint_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + mirroring.DeleteMirroringEndpointGroupRequest(), + {}, + ], +) async def test_delete_mirroring_endpoint_group_async( - transport: str = "grpc_asyncio", - request_type=mirroring.DeleteMirroringEndpointGroupRequest, + request_type, transport: str = "grpc_asyncio" ): client = MirroringAsyncClient( credentials=async_anonymous_credentials(), @@ -3096,7 +3127,7 @@ async def test_delete_mirroring_endpoint_group_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( @@ -3118,11 +3149,6 @@ async def test_delete_mirroring_endpoint_group_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_mirroring_endpoint_group_async_from_dict(): - await test_delete_mirroring_endpoint_group_async(request_type=dict) - - def test_delete_mirroring_endpoint_group_field_headers(): client = MirroringClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3277,8 +3303,8 @@ async def test_delete_mirroring_endpoint_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - mirroring.ListMirroringEndpointGroupAssociationsRequest, - dict, + mirroring.ListMirroringEndpointGroupAssociationsRequest(), + {}, ], ) def test_list_mirroring_endpoint_group_associations( @@ -3291,7 +3317,7 @@ def test_list_mirroring_endpoint_group_associations( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3342,12 +3368,13 @@ def test_list_mirroring_endpoint_group_associations_non_empty_request_with_auto_ client.list_mirroring_endpoint_group_associations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == mirroring.ListMirroringEndpointGroupAssociationsRequest( + request_msg = mirroring.ListMirroringEndpointGroupAssociationsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_mirroring_endpoint_group_associations_use_cached_wrapped_rpc(): @@ -3433,9 +3460,15 @@ async def test_list_mirroring_endpoint_group_associations_async_use_cached_wrapp @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + mirroring.ListMirroringEndpointGroupAssociationsRequest(), + {}, + ], +) async def test_list_mirroring_endpoint_group_associations_async( - transport: str = "grpc_asyncio", - request_type=mirroring.ListMirroringEndpointGroupAssociationsRequest, + request_type, transport: str = "grpc_asyncio" ): client = MirroringAsyncClient( credentials=async_anonymous_credentials(), @@ -3444,7 +3477,7 @@ async def test_list_mirroring_endpoint_group_associations_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( @@ -3469,11 +3502,6 @@ async def test_list_mirroring_endpoint_group_associations_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_mirroring_endpoint_group_associations_async_from_dict(): - await test_list_mirroring_endpoint_group_associations_async(request_type=dict) - - def test_list_mirroring_endpoint_group_associations_field_headers(): client = MirroringClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3837,8 +3865,8 @@ async def test_list_mirroring_endpoint_group_associations_async_pages(): @pytest.mark.parametrize( "request_type", [ - mirroring.GetMirroringEndpointGroupAssociationRequest, - dict, + mirroring.GetMirroringEndpointGroupAssociationRequest(), + {}, ], ) def test_get_mirroring_endpoint_group_association( @@ -3851,7 +3879,7 @@ def test_get_mirroring_endpoint_group_association( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3907,9 +3935,10 @@ def test_get_mirroring_endpoint_group_association_non_empty_request_with_auto_po client.get_mirroring_endpoint_group_association(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == mirroring.GetMirroringEndpointGroupAssociationRequest( + request_msg = mirroring.GetMirroringEndpointGroupAssociationRequest( name="name_value", ) + assert args[0] == request_msg def test_get_mirroring_endpoint_group_association_use_cached_wrapped_rpc(): @@ -3995,9 +4024,15 @@ async def test_get_mirroring_endpoint_group_association_async_use_cached_wrapped @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + mirroring.GetMirroringEndpointGroupAssociationRequest(), + {}, + ], +) async def test_get_mirroring_endpoint_group_association_async( - transport: str = "grpc_asyncio", - request_type=mirroring.GetMirroringEndpointGroupAssociationRequest, + request_type, transport: str = "grpc_asyncio" ): client = MirroringAsyncClient( credentials=async_anonymous_credentials(), @@ -4006,7 +4041,7 @@ async def test_get_mirroring_endpoint_group_association_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( @@ -4039,11 +4074,6 @@ async def test_get_mirroring_endpoint_group_association_async( assert response.reconciling is True -@pytest.mark.asyncio -async def test_get_mirroring_endpoint_group_association_async_from_dict(): - await test_get_mirroring_endpoint_group_association_async(request_type=dict) - - def test_get_mirroring_endpoint_group_association_field_headers(): client = MirroringClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4198,8 +4228,8 @@ async def test_get_mirroring_endpoint_group_association_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - mirroring.CreateMirroringEndpointGroupAssociationRequest, - dict, + mirroring.CreateMirroringEndpointGroupAssociationRequest(), + {}, ], ) def test_create_mirroring_endpoint_group_association( @@ -4212,7 +4242,7 @@ def test_create_mirroring_endpoint_group_association( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4258,10 +4288,11 @@ def test_create_mirroring_endpoint_group_association_non_empty_request_with_auto client.create_mirroring_endpoint_group_association(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == mirroring.CreateMirroringEndpointGroupAssociationRequest( + request_msg = mirroring.CreateMirroringEndpointGroupAssociationRequest( parent="parent_value", mirroring_endpoint_group_association_id="mirroring_endpoint_group_association_id_value", ) + assert args[0] == request_msg def test_create_mirroring_endpoint_group_association_use_cached_wrapped_rpc(): @@ -4357,9 +4388,15 @@ async def test_create_mirroring_endpoint_group_association_async_use_cached_wrap @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + mirroring.CreateMirroringEndpointGroupAssociationRequest(), + {}, + ], +) async def test_create_mirroring_endpoint_group_association_async( - transport: str = "grpc_asyncio", - request_type=mirroring.CreateMirroringEndpointGroupAssociationRequest, + request_type, transport: str = "grpc_asyncio" ): client = MirroringAsyncClient( credentials=async_anonymous_credentials(), @@ -4368,7 +4405,7 @@ async def test_create_mirroring_endpoint_group_association_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( @@ -4390,11 +4427,6 @@ async def test_create_mirroring_endpoint_group_association_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_mirroring_endpoint_group_association_async_from_dict(): - await test_create_mirroring_endpoint_group_association_async(request_type=dict) - - def test_create_mirroring_endpoint_group_association_field_headers(): client = MirroringClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4577,8 +4609,8 @@ async def test_create_mirroring_endpoint_group_association_flattened_error_async @pytest.mark.parametrize( "request_type", [ - mirroring.UpdateMirroringEndpointGroupAssociationRequest, - dict, + mirroring.UpdateMirroringEndpointGroupAssociationRequest(), + {}, ], ) def test_update_mirroring_endpoint_group_association( @@ -4591,7 +4623,7 @@ def test_update_mirroring_endpoint_group_association( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4634,7 +4666,8 @@ def test_update_mirroring_endpoint_group_association_non_empty_request_with_auto client.update_mirroring_endpoint_group_association(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == mirroring.UpdateMirroringEndpointGroupAssociationRequest() + request_msg = mirroring.UpdateMirroringEndpointGroupAssociationRequest() + assert args[0] == request_msg def test_update_mirroring_endpoint_group_association_use_cached_wrapped_rpc(): @@ -4730,9 +4763,15 @@ async def test_update_mirroring_endpoint_group_association_async_use_cached_wrap @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + mirroring.UpdateMirroringEndpointGroupAssociationRequest(), + {}, + ], +) async def test_update_mirroring_endpoint_group_association_async( - transport: str = "grpc_asyncio", - request_type=mirroring.UpdateMirroringEndpointGroupAssociationRequest, + request_type, transport: str = "grpc_asyncio" ): client = MirroringAsyncClient( credentials=async_anonymous_credentials(), @@ -4741,7 +4780,7 @@ async def test_update_mirroring_endpoint_group_association_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( @@ -4763,11 +4802,6 @@ async def test_update_mirroring_endpoint_group_association_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_mirroring_endpoint_group_association_async_from_dict(): - await test_update_mirroring_endpoint_group_association_async(request_type=dict) - - def test_update_mirroring_endpoint_group_association_field_headers(): client = MirroringClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4940,8 +4974,8 @@ async def test_update_mirroring_endpoint_group_association_flattened_error_async @pytest.mark.parametrize( "request_type", [ - mirroring.DeleteMirroringEndpointGroupAssociationRequest, - dict, + mirroring.DeleteMirroringEndpointGroupAssociationRequest(), + {}, ], ) def test_delete_mirroring_endpoint_group_association( @@ -4954,7 +4988,7 @@ def test_delete_mirroring_endpoint_group_association( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4999,9 +5033,10 @@ def test_delete_mirroring_endpoint_group_association_non_empty_request_with_auto client.delete_mirroring_endpoint_group_association(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == mirroring.DeleteMirroringEndpointGroupAssociationRequest( + request_msg = mirroring.DeleteMirroringEndpointGroupAssociationRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_mirroring_endpoint_group_association_use_cached_wrapped_rpc(): @@ -5097,9 +5132,15 @@ async def test_delete_mirroring_endpoint_group_association_async_use_cached_wrap @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + mirroring.DeleteMirroringEndpointGroupAssociationRequest(), + {}, + ], +) async def test_delete_mirroring_endpoint_group_association_async( - transport: str = "grpc_asyncio", - request_type=mirroring.DeleteMirroringEndpointGroupAssociationRequest, + request_type, transport: str = "grpc_asyncio" ): client = MirroringAsyncClient( credentials=async_anonymous_credentials(), @@ -5108,7 +5149,7 @@ async def test_delete_mirroring_endpoint_group_association_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( @@ -5130,11 +5171,6 @@ async def test_delete_mirroring_endpoint_group_association_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_mirroring_endpoint_group_association_async_from_dict(): - await test_delete_mirroring_endpoint_group_association_async(request_type=dict) - - def test_delete_mirroring_endpoint_group_association_field_headers(): client = MirroringClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5289,8 +5325,8 @@ async def test_delete_mirroring_endpoint_group_association_flattened_error_async @pytest.mark.parametrize( "request_type", [ - mirroring.ListMirroringDeploymentGroupsRequest, - dict, + mirroring.ListMirroringDeploymentGroupsRequest(), + {}, ], ) def test_list_mirroring_deployment_groups(request_type, transport: str = "grpc"): @@ -5301,7 +5337,7 @@ def test_list_mirroring_deployment_groups(request_type, transport: str = "grpc") # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5352,12 +5388,13 @@ def test_list_mirroring_deployment_groups_non_empty_request_with_auto_populated_ client.list_mirroring_deployment_groups(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == mirroring.ListMirroringDeploymentGroupsRequest( + request_msg = mirroring.ListMirroringDeploymentGroupsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_mirroring_deployment_groups_use_cached_wrapped_rpc(): @@ -5443,9 +5480,15 @@ async def test_list_mirroring_deployment_groups_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + mirroring.ListMirroringDeploymentGroupsRequest(), + {}, + ], +) async def test_list_mirroring_deployment_groups_async( - transport: str = "grpc_asyncio", - request_type=mirroring.ListMirroringDeploymentGroupsRequest, + request_type, transport: str = "grpc_asyncio" ): client = MirroringAsyncClient( credentials=async_anonymous_credentials(), @@ -5454,7 +5497,7 @@ async def test_list_mirroring_deployment_groups_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( @@ -5479,11 +5522,6 @@ async def test_list_mirroring_deployment_groups_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_mirroring_deployment_groups_async_from_dict(): - await test_list_mirroring_deployment_groups_async(request_type=dict) - - def test_list_mirroring_deployment_groups_field_headers(): client = MirroringClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5840,8 +5878,8 @@ async def test_list_mirroring_deployment_groups_async_pages(): @pytest.mark.parametrize( "request_type", [ - mirroring.GetMirroringDeploymentGroupRequest, - dict, + mirroring.GetMirroringDeploymentGroupRequest(), + {}, ], ) def test_get_mirroring_deployment_group(request_type, transport: str = "grpc"): @@ -5852,7 +5890,7 @@ def test_get_mirroring_deployment_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5908,9 +5946,10 @@ def test_get_mirroring_deployment_group_non_empty_request_with_auto_populated_fi client.get_mirroring_deployment_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == mirroring.GetMirroringDeploymentGroupRequest( + request_msg = mirroring.GetMirroringDeploymentGroupRequest( name="name_value", ) + assert args[0] == request_msg def test_get_mirroring_deployment_group_use_cached_wrapped_rpc(): @@ -5996,9 +6035,15 @@ async def test_get_mirroring_deployment_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + mirroring.GetMirroringDeploymentGroupRequest(), + {}, + ], +) async def test_get_mirroring_deployment_group_async( - transport: str = "grpc_asyncio", - request_type=mirroring.GetMirroringDeploymentGroupRequest, + request_type, transport: str = "grpc_asyncio" ): client = MirroringAsyncClient( credentials=async_anonymous_credentials(), @@ -6007,7 +6052,7 @@ async def test_get_mirroring_deployment_group_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( @@ -6040,11 +6085,6 @@ async def test_get_mirroring_deployment_group_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_get_mirroring_deployment_group_async_from_dict(): - await test_get_mirroring_deployment_group_async(request_type=dict) - - def test_get_mirroring_deployment_group_field_headers(): client = MirroringClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6199,8 +6239,8 @@ async def test_get_mirroring_deployment_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - mirroring.CreateMirroringDeploymentGroupRequest, - dict, + mirroring.CreateMirroringDeploymentGroupRequest(), + {}, ], ) def test_create_mirroring_deployment_group(request_type, transport: str = "grpc"): @@ -6211,7 +6251,7 @@ def test_create_mirroring_deployment_group(request_type, transport: str = "grpc" # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6257,10 +6297,11 @@ def test_create_mirroring_deployment_group_non_empty_request_with_auto_populated client.create_mirroring_deployment_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == mirroring.CreateMirroringDeploymentGroupRequest( + request_msg = mirroring.CreateMirroringDeploymentGroupRequest( parent="parent_value", mirroring_deployment_group_id="mirroring_deployment_group_id_value", ) + assert args[0] == request_msg def test_create_mirroring_deployment_group_use_cached_wrapped_rpc(): @@ -6356,9 +6397,15 @@ async def test_create_mirroring_deployment_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + mirroring.CreateMirroringDeploymentGroupRequest(), + {}, + ], +) async def test_create_mirroring_deployment_group_async( - transport: str = "grpc_asyncio", - request_type=mirroring.CreateMirroringDeploymentGroupRequest, + request_type, transport: str = "grpc_asyncio" ): client = MirroringAsyncClient( credentials=async_anonymous_credentials(), @@ -6367,7 +6414,7 @@ async def test_create_mirroring_deployment_group_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( @@ -6389,11 +6436,6 @@ async def test_create_mirroring_deployment_group_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_mirroring_deployment_group_async_from_dict(): - await test_create_mirroring_deployment_group_async(request_type=dict) - - def test_create_mirroring_deployment_group_field_headers(): client = MirroringClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6576,8 +6618,8 @@ async def test_create_mirroring_deployment_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - mirroring.UpdateMirroringDeploymentGroupRequest, - dict, + mirroring.UpdateMirroringDeploymentGroupRequest(), + {}, ], ) def test_update_mirroring_deployment_group(request_type, transport: str = "grpc"): @@ -6588,7 +6630,7 @@ def test_update_mirroring_deployment_group(request_type, transport: str = "grpc" # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6631,7 +6673,8 @@ def test_update_mirroring_deployment_group_non_empty_request_with_auto_populated client.update_mirroring_deployment_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == mirroring.UpdateMirroringDeploymentGroupRequest() + request_msg = mirroring.UpdateMirroringDeploymentGroupRequest() + assert args[0] == request_msg def test_update_mirroring_deployment_group_use_cached_wrapped_rpc(): @@ -6727,9 +6770,15 @@ async def test_update_mirroring_deployment_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + mirroring.UpdateMirroringDeploymentGroupRequest(), + {}, + ], +) async def test_update_mirroring_deployment_group_async( - transport: str = "grpc_asyncio", - request_type=mirroring.UpdateMirroringDeploymentGroupRequest, + request_type, transport: str = "grpc_asyncio" ): client = MirroringAsyncClient( credentials=async_anonymous_credentials(), @@ -6738,7 +6787,7 @@ async def test_update_mirroring_deployment_group_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( @@ -6760,11 +6809,6 @@ async def test_update_mirroring_deployment_group_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_mirroring_deployment_group_async_from_dict(): - await test_update_mirroring_deployment_group_async(request_type=dict) - - def test_update_mirroring_deployment_group_field_headers(): client = MirroringClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6937,8 +6981,8 @@ async def test_update_mirroring_deployment_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - mirroring.DeleteMirroringDeploymentGroupRequest, - dict, + mirroring.DeleteMirroringDeploymentGroupRequest(), + {}, ], ) def test_delete_mirroring_deployment_group(request_type, transport: str = "grpc"): @@ -6949,7 +6993,7 @@ def test_delete_mirroring_deployment_group(request_type, transport: str = "grpc" # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6994,9 +7038,10 @@ def test_delete_mirroring_deployment_group_non_empty_request_with_auto_populated client.delete_mirroring_deployment_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == mirroring.DeleteMirroringDeploymentGroupRequest( + request_msg = mirroring.DeleteMirroringDeploymentGroupRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_mirroring_deployment_group_use_cached_wrapped_rpc(): @@ -7092,9 +7137,15 @@ async def test_delete_mirroring_deployment_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + mirroring.DeleteMirroringDeploymentGroupRequest(), + {}, + ], +) async def test_delete_mirroring_deployment_group_async( - transport: str = "grpc_asyncio", - request_type=mirroring.DeleteMirroringDeploymentGroupRequest, + request_type, transport: str = "grpc_asyncio" ): client = MirroringAsyncClient( credentials=async_anonymous_credentials(), @@ -7103,7 +7154,7 @@ async def test_delete_mirroring_deployment_group_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( @@ -7125,11 +7176,6 @@ async def test_delete_mirroring_deployment_group_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_mirroring_deployment_group_async_from_dict(): - await test_delete_mirroring_deployment_group_async(request_type=dict) - - def test_delete_mirroring_deployment_group_field_headers(): client = MirroringClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7284,8 +7330,8 @@ async def test_delete_mirroring_deployment_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - mirroring.ListMirroringDeploymentsRequest, - dict, + mirroring.ListMirroringDeploymentsRequest(), + {}, ], ) def test_list_mirroring_deployments(request_type, transport: str = "grpc"): @@ -7296,7 +7342,7 @@ def test_list_mirroring_deployments(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7349,12 +7395,13 @@ def test_list_mirroring_deployments_non_empty_request_with_auto_populated_field( client.list_mirroring_deployments(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == mirroring.ListMirroringDeploymentsRequest( + request_msg = mirroring.ListMirroringDeploymentsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_mirroring_deployments_use_cached_wrapped_rpc(): @@ -7440,9 +7487,15 @@ async def test_list_mirroring_deployments_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + mirroring.ListMirroringDeploymentsRequest(), + {}, + ], +) async def test_list_mirroring_deployments_async( - transport: str = "grpc_asyncio", - request_type=mirroring.ListMirroringDeploymentsRequest, + request_type, transport: str = "grpc_asyncio" ): client = MirroringAsyncClient( credentials=async_anonymous_credentials(), @@ -7451,7 +7504,7 @@ async def test_list_mirroring_deployments_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( @@ -7478,11 +7531,6 @@ async def test_list_mirroring_deployments_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_mirroring_deployments_async_from_dict(): - await test_list_mirroring_deployments_async(request_type=dict) - - def test_list_mirroring_deployments_field_headers(): client = MirroringClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7837,8 +7885,8 @@ async def test_list_mirroring_deployments_async_pages(): @pytest.mark.parametrize( "request_type", [ - mirroring.GetMirroringDeploymentRequest, - dict, + mirroring.GetMirroringDeploymentRequest(), + {}, ], ) def test_get_mirroring_deployment(request_type, transport: str = "grpc"): @@ -7849,7 +7897,7 @@ def test_get_mirroring_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7907,9 +7955,10 @@ def test_get_mirroring_deployment_non_empty_request_with_auto_populated_field(): client.get_mirroring_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == mirroring.GetMirroringDeploymentRequest( + request_msg = mirroring.GetMirroringDeploymentRequest( name="name_value", ) + assert args[0] == request_msg def test_get_mirroring_deployment_use_cached_wrapped_rpc(): @@ -7995,9 +8044,15 @@ async def test_get_mirroring_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + mirroring.GetMirroringDeploymentRequest(), + {}, + ], +) async def test_get_mirroring_deployment_async( - transport: str = "grpc_asyncio", - request_type=mirroring.GetMirroringDeploymentRequest, + request_type, transport: str = "grpc_asyncio" ): client = MirroringAsyncClient( credentials=async_anonymous_credentials(), @@ -8006,7 +8061,7 @@ async def test_get_mirroring_deployment_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( @@ -8041,11 +8096,6 @@ async def test_get_mirroring_deployment_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_get_mirroring_deployment_async_from_dict(): - await test_get_mirroring_deployment_async(request_type=dict) - - def test_get_mirroring_deployment_field_headers(): client = MirroringClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8200,8 +8250,8 @@ async def test_get_mirroring_deployment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - mirroring.CreateMirroringDeploymentRequest, - dict, + mirroring.CreateMirroringDeploymentRequest(), + {}, ], ) def test_create_mirroring_deployment(request_type, transport: str = "grpc"): @@ -8212,7 +8262,7 @@ def test_create_mirroring_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8258,10 +8308,11 @@ def test_create_mirroring_deployment_non_empty_request_with_auto_populated_field client.create_mirroring_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == mirroring.CreateMirroringDeploymentRequest( + request_msg = mirroring.CreateMirroringDeploymentRequest( parent="parent_value", mirroring_deployment_id="mirroring_deployment_id_value", ) + assert args[0] == request_msg def test_create_mirroring_deployment_use_cached_wrapped_rpc(): @@ -8357,9 +8408,15 @@ async def test_create_mirroring_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + mirroring.CreateMirroringDeploymentRequest(), + {}, + ], +) async def test_create_mirroring_deployment_async( - transport: str = "grpc_asyncio", - request_type=mirroring.CreateMirroringDeploymentRequest, + request_type, transport: str = "grpc_asyncio" ): client = MirroringAsyncClient( credentials=async_anonymous_credentials(), @@ -8368,7 +8425,7 @@ async def test_create_mirroring_deployment_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( @@ -8390,11 +8447,6 @@ async def test_create_mirroring_deployment_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_mirroring_deployment_async_from_dict(): - await test_create_mirroring_deployment_async(request_type=dict) - - def test_create_mirroring_deployment_field_headers(): client = MirroringClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8569,8 +8621,8 @@ async def test_create_mirroring_deployment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - mirroring.UpdateMirroringDeploymentRequest, - dict, + mirroring.UpdateMirroringDeploymentRequest(), + {}, ], ) def test_update_mirroring_deployment(request_type, transport: str = "grpc"): @@ -8581,7 +8633,7 @@ def test_update_mirroring_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8624,7 +8676,8 @@ def test_update_mirroring_deployment_non_empty_request_with_auto_populated_field client.update_mirroring_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == mirroring.UpdateMirroringDeploymentRequest() + request_msg = mirroring.UpdateMirroringDeploymentRequest() + assert args[0] == request_msg def test_update_mirroring_deployment_use_cached_wrapped_rpc(): @@ -8720,9 +8773,15 @@ async def test_update_mirroring_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + mirroring.UpdateMirroringDeploymentRequest(), + {}, + ], +) async def test_update_mirroring_deployment_async( - transport: str = "grpc_asyncio", - request_type=mirroring.UpdateMirroringDeploymentRequest, + request_type, transport: str = "grpc_asyncio" ): client = MirroringAsyncClient( credentials=async_anonymous_credentials(), @@ -8731,7 +8790,7 @@ async def test_update_mirroring_deployment_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( @@ -8753,11 +8812,6 @@ async def test_update_mirroring_deployment_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_mirroring_deployment_async_from_dict(): - await test_update_mirroring_deployment_async(request_type=dict) - - def test_update_mirroring_deployment_field_headers(): client = MirroringClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8922,8 +8976,8 @@ async def test_update_mirroring_deployment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - mirroring.DeleteMirroringDeploymentRequest, - dict, + mirroring.DeleteMirroringDeploymentRequest(), + {}, ], ) def test_delete_mirroring_deployment(request_type, transport: str = "grpc"): @@ -8934,7 +8988,7 @@ def test_delete_mirroring_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8979,9 +9033,10 @@ def test_delete_mirroring_deployment_non_empty_request_with_auto_populated_field client.delete_mirroring_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == mirroring.DeleteMirroringDeploymentRequest( + request_msg = mirroring.DeleteMirroringDeploymentRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_mirroring_deployment_use_cached_wrapped_rpc(): @@ -9077,9 +9132,15 @@ async def test_delete_mirroring_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + mirroring.DeleteMirroringDeploymentRequest(), + {}, + ], +) async def test_delete_mirroring_deployment_async( - transport: str = "grpc_asyncio", - request_type=mirroring.DeleteMirroringDeploymentRequest, + request_type, transport: str = "grpc_asyncio" ): client = MirroringAsyncClient( credentials=async_anonymous_credentials(), @@ -9088,7 +9149,7 @@ async def test_delete_mirroring_deployment_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( @@ -9110,11 +9171,6 @@ async def test_delete_mirroring_deployment_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_mirroring_deployment_async_from_dict(): - await test_delete_mirroring_deployment_async(request_type=dict) - - def test_delete_mirroring_deployment_field_headers(): client = MirroringClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13731,7 +13787,6 @@ def test_list_mirroring_endpoint_groups_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.ListMirroringEndpointGroupsRequest() - assert args[0] == request_msg @@ -13754,7 +13809,6 @@ def test_get_mirroring_endpoint_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.GetMirroringEndpointGroupRequest() - assert args[0] == request_msg @@ -13777,7 +13831,6 @@ def test_create_mirroring_endpoint_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.CreateMirroringEndpointGroupRequest() - assert args[0] == request_msg @@ -13800,7 +13853,6 @@ def test_update_mirroring_endpoint_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.UpdateMirroringEndpointGroupRequest() - assert args[0] == request_msg @@ -13823,7 +13875,6 @@ def test_delete_mirroring_endpoint_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.DeleteMirroringEndpointGroupRequest() - assert args[0] == request_msg @@ -13846,7 +13897,6 @@ def test_list_mirroring_endpoint_group_associations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.ListMirroringEndpointGroupAssociationsRequest() - assert args[0] == request_msg @@ -13869,7 +13919,6 @@ def test_get_mirroring_endpoint_group_association_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.GetMirroringEndpointGroupAssociationRequest() - assert args[0] == request_msg @@ -13892,7 +13941,6 @@ def test_create_mirroring_endpoint_group_association_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.CreateMirroringEndpointGroupAssociationRequest() - assert args[0] == request_msg @@ -13915,7 +13963,6 @@ def test_update_mirroring_endpoint_group_association_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.UpdateMirroringEndpointGroupAssociationRequest() - assert args[0] == request_msg @@ -13938,7 +13985,6 @@ def test_delete_mirroring_endpoint_group_association_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.DeleteMirroringEndpointGroupAssociationRequest() - assert args[0] == request_msg @@ -13961,7 +14007,6 @@ def test_list_mirroring_deployment_groups_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.ListMirroringDeploymentGroupsRequest() - assert args[0] == request_msg @@ -13984,7 +14029,6 @@ def test_get_mirroring_deployment_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.GetMirroringDeploymentGroupRequest() - assert args[0] == request_msg @@ -14007,7 +14051,6 @@ def test_create_mirroring_deployment_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.CreateMirroringDeploymentGroupRequest() - assert args[0] == request_msg @@ -14030,7 +14073,6 @@ def test_update_mirroring_deployment_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.UpdateMirroringDeploymentGroupRequest() - assert args[0] == request_msg @@ -14053,7 +14095,6 @@ def test_delete_mirroring_deployment_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.DeleteMirroringDeploymentGroupRequest() - assert args[0] == request_msg @@ -14076,7 +14117,6 @@ def test_list_mirroring_deployments_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.ListMirroringDeploymentsRequest() - assert args[0] == request_msg @@ -14099,7 +14139,6 @@ def test_get_mirroring_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.GetMirroringDeploymentRequest() - assert args[0] == request_msg @@ -14122,7 +14161,6 @@ def test_create_mirroring_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.CreateMirroringDeploymentRequest() - assert args[0] == request_msg @@ -14145,7 +14183,6 @@ def test_update_mirroring_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.UpdateMirroringDeploymentRequest() - assert args[0] == request_msg @@ -14168,7 +14205,6 @@ def test_delete_mirroring_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.DeleteMirroringDeploymentRequest() - assert args[0] == request_msg @@ -14211,7 +14247,6 @@ async def test_list_mirroring_endpoint_groups_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.ListMirroringEndpointGroupsRequest() - assert args[0] == request_msg @@ -14245,7 +14280,6 @@ async def test_get_mirroring_endpoint_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.GetMirroringEndpointGroupRequest() - assert args[0] == request_msg @@ -14272,7 +14306,6 @@ async def test_create_mirroring_endpoint_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.CreateMirroringEndpointGroupRequest() - assert args[0] == request_msg @@ -14299,7 +14332,6 @@ async def test_update_mirroring_endpoint_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.UpdateMirroringEndpointGroupRequest() - assert args[0] == request_msg @@ -14326,7 +14358,6 @@ async def test_delete_mirroring_endpoint_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.DeleteMirroringEndpointGroupRequest() - assert args[0] == request_msg @@ -14355,7 +14386,6 @@ async def test_list_mirroring_endpoint_group_associations_empty_call_grpc_asynci call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.ListMirroringEndpointGroupAssociationsRequest() - assert args[0] == request_msg @@ -14388,7 +14418,6 @@ async def test_get_mirroring_endpoint_group_association_empty_call_grpc_asyncio( call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.GetMirroringEndpointGroupAssociationRequest() - assert args[0] == request_msg @@ -14415,7 +14444,6 @@ async def test_create_mirroring_endpoint_group_association_empty_call_grpc_async call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.CreateMirroringEndpointGroupAssociationRequest() - assert args[0] == request_msg @@ -14442,7 +14470,6 @@ async def test_update_mirroring_endpoint_group_association_empty_call_grpc_async call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.UpdateMirroringEndpointGroupAssociationRequest() - assert args[0] == request_msg @@ -14469,7 +14496,6 @@ async def test_delete_mirroring_endpoint_group_association_empty_call_grpc_async call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.DeleteMirroringEndpointGroupAssociationRequest() - assert args[0] == request_msg @@ -14498,7 +14524,6 @@ async def test_list_mirroring_deployment_groups_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.ListMirroringDeploymentGroupsRequest() - assert args[0] == request_msg @@ -14531,7 +14556,6 @@ async def test_get_mirroring_deployment_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.GetMirroringDeploymentGroupRequest() - assert args[0] == request_msg @@ -14558,7 +14582,6 @@ async def test_create_mirroring_deployment_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.CreateMirroringDeploymentGroupRequest() - assert args[0] == request_msg @@ -14585,7 +14608,6 @@ async def test_update_mirroring_deployment_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.UpdateMirroringDeploymentGroupRequest() - assert args[0] == request_msg @@ -14612,7 +14634,6 @@ async def test_delete_mirroring_deployment_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.DeleteMirroringDeploymentGroupRequest() - assert args[0] == request_msg @@ -14642,7 +14663,6 @@ async def test_list_mirroring_deployments_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.ListMirroringDeploymentsRequest() - assert args[0] == request_msg @@ -14676,7 +14696,6 @@ async def test_get_mirroring_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.GetMirroringDeploymentRequest() - assert args[0] == request_msg @@ -14703,7 +14722,6 @@ async def test_create_mirroring_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.CreateMirroringDeploymentRequest() - assert args[0] == request_msg @@ -14730,7 +14748,6 @@ async def test_update_mirroring_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.UpdateMirroringDeploymentRequest() - assert args[0] == request_msg @@ -14757,7 +14774,6 @@ async def test_delete_mirroring_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.DeleteMirroringDeploymentRequest() - assert args[0] == request_msg @@ -18735,7 +18751,6 @@ def test_list_mirroring_endpoint_groups_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.ListMirroringEndpointGroupsRequest() - assert args[0] == request_msg @@ -18757,7 +18772,6 @@ def test_get_mirroring_endpoint_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.GetMirroringEndpointGroupRequest() - assert args[0] == request_msg @@ -18779,7 +18793,6 @@ def test_create_mirroring_endpoint_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.CreateMirroringEndpointGroupRequest() - assert args[0] == request_msg @@ -18801,7 +18814,6 @@ def test_update_mirroring_endpoint_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.UpdateMirroringEndpointGroupRequest() - assert args[0] == request_msg @@ -18823,7 +18835,6 @@ def test_delete_mirroring_endpoint_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.DeleteMirroringEndpointGroupRequest() - assert args[0] == request_msg @@ -18845,7 +18856,6 @@ def test_list_mirroring_endpoint_group_associations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.ListMirroringEndpointGroupAssociationsRequest() - assert args[0] == request_msg @@ -18867,7 +18877,6 @@ def test_get_mirroring_endpoint_group_association_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.GetMirroringEndpointGroupAssociationRequest() - assert args[0] == request_msg @@ -18889,7 +18898,6 @@ def test_create_mirroring_endpoint_group_association_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.CreateMirroringEndpointGroupAssociationRequest() - assert args[0] == request_msg @@ -18911,7 +18919,6 @@ def test_update_mirroring_endpoint_group_association_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.UpdateMirroringEndpointGroupAssociationRequest() - assert args[0] == request_msg @@ -18933,7 +18940,6 @@ def test_delete_mirroring_endpoint_group_association_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.DeleteMirroringEndpointGroupAssociationRequest() - assert args[0] == request_msg @@ -18955,7 +18961,6 @@ def test_list_mirroring_deployment_groups_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.ListMirroringDeploymentGroupsRequest() - assert args[0] == request_msg @@ -18977,7 +18982,6 @@ def test_get_mirroring_deployment_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.GetMirroringDeploymentGroupRequest() - assert args[0] == request_msg @@ -18999,7 +19003,6 @@ def test_create_mirroring_deployment_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.CreateMirroringDeploymentGroupRequest() - assert args[0] == request_msg @@ -19021,7 +19024,6 @@ def test_update_mirroring_deployment_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.UpdateMirroringDeploymentGroupRequest() - assert args[0] == request_msg @@ -19043,7 +19045,6 @@ def test_delete_mirroring_deployment_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.DeleteMirroringDeploymentGroupRequest() - assert args[0] == request_msg @@ -19065,7 +19066,6 @@ def test_list_mirroring_deployments_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.ListMirroringDeploymentsRequest() - assert args[0] == request_msg @@ -19087,7 +19087,6 @@ def test_get_mirroring_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.GetMirroringDeploymentRequest() - assert args[0] == request_msg @@ -19109,7 +19108,6 @@ def test_create_mirroring_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.CreateMirroringDeploymentRequest() - assert args[0] == request_msg @@ -19131,7 +19129,6 @@ def test_update_mirroring_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.UpdateMirroringDeploymentRequest() - assert args[0] == request_msg @@ -19153,7 +19150,6 @@ def test_delete_mirroring_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.DeleteMirroringDeploymentRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-network-security/tests/unit/gapic/network_security_v1/test_network_security.py b/packages/google-cloud-network-security/tests/unit/gapic/network_security_v1/test_network_security.py index 46674d3d842e..54b7308c3d7a 100644 --- a/packages/google-cloud-network-security/tests/unit/gapic/network_security_v1/test_network_security.py +++ b/packages/google-cloud-network-security/tests/unit/gapic/network_security_v1/test_network_security.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 @@ -156,6 +157,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" @@ -1383,8 +1399,8 @@ def test_network_security_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - authorization_policy.ListAuthorizationPoliciesRequest, - dict, + authorization_policy.ListAuthorizationPoliciesRequest(), + {}, ], ) def test_list_authorization_policies(request_type, transport: str = "grpc"): @@ -1395,7 +1411,7 @@ def test_list_authorization_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( @@ -1444,10 +1460,11 @@ def test_list_authorization_policies_non_empty_request_with_auto_populated_field client.list_authorization_policies(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == authorization_policy.ListAuthorizationPoliciesRequest( + request_msg = authorization_policy.ListAuthorizationPoliciesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_authorization_policies_use_cached_wrapped_rpc(): @@ -1533,9 +1550,15 @@ async def test_list_authorization_policies_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + authorization_policy.ListAuthorizationPoliciesRequest(), + {}, + ], +) async def test_list_authorization_policies_async( - transport: str = "grpc_asyncio", - request_type=authorization_policy.ListAuthorizationPoliciesRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -1544,7 +1567,7 @@ async def test_list_authorization_policies_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( @@ -1569,11 +1592,6 @@ async def test_list_authorization_policies_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_authorization_policies_async_from_dict(): - await test_list_authorization_policies_async(request_type=dict) - - def test_list_authorization_policies_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1932,8 +1950,8 @@ async def test_list_authorization_policies_async_pages(): @pytest.mark.parametrize( "request_type", [ - authorization_policy.GetAuthorizationPolicyRequest, - dict, + authorization_policy.GetAuthorizationPolicyRequest(), + {}, ], ) def test_get_authorization_policy(request_type, transport: str = "grpc"): @@ -1944,7 +1962,7 @@ def test_get_authorization_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( @@ -1996,9 +2014,10 @@ def test_get_authorization_policy_non_empty_request_with_auto_populated_field(): client.get_authorization_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == authorization_policy.GetAuthorizationPolicyRequest( + request_msg = authorization_policy.GetAuthorizationPolicyRequest( name="name_value", ) + assert args[0] == request_msg def test_get_authorization_policy_use_cached_wrapped_rpc(): @@ -2084,9 +2103,15 @@ async def test_get_authorization_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + authorization_policy.GetAuthorizationPolicyRequest(), + {}, + ], +) async def test_get_authorization_policy_async( - transport: str = "grpc_asyncio", - request_type=authorization_policy.GetAuthorizationPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -2095,7 +2120,7 @@ async def test_get_authorization_policy_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( @@ -2124,11 +2149,6 @@ async def test_get_authorization_policy_async( assert response.action == authorization_policy.AuthorizationPolicy.Action.ALLOW -@pytest.mark.asyncio -async def test_get_authorization_policy_async_from_dict(): - await test_get_authorization_policy_async(request_type=dict) - - def test_get_authorization_policy_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2283,8 +2303,8 @@ async def test_get_authorization_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_authorization_policy.CreateAuthorizationPolicyRequest, - dict, + gcn_authorization_policy.CreateAuthorizationPolicyRequest(), + {}, ], ) def test_create_authorization_policy(request_type, transport: str = "grpc"): @@ -2295,7 +2315,7 @@ def test_create_authorization_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( @@ -2341,10 +2361,11 @@ def test_create_authorization_policy_non_empty_request_with_auto_populated_field client.create_authorization_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_authorization_policy.CreateAuthorizationPolicyRequest( + request_msg = gcn_authorization_policy.CreateAuthorizationPolicyRequest( parent="parent_value", authorization_policy_id="authorization_policy_id_value", ) + assert args[0] == request_msg def test_create_authorization_policy_use_cached_wrapped_rpc(): @@ -2440,9 +2461,15 @@ async def test_create_authorization_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcn_authorization_policy.CreateAuthorizationPolicyRequest(), + {}, + ], +) async def test_create_authorization_policy_async( - transport: str = "grpc_asyncio", - request_type=gcn_authorization_policy.CreateAuthorizationPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -2451,7 +2478,7 @@ async def test_create_authorization_policy_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( @@ -2473,11 +2500,6 @@ async def test_create_authorization_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_authorization_policy_async_from_dict(): - await test_create_authorization_policy_async(request_type=dict) - - def test_create_authorization_policy_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2660,8 +2682,8 @@ async def test_create_authorization_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_authorization_policy.UpdateAuthorizationPolicyRequest, - dict, + gcn_authorization_policy.UpdateAuthorizationPolicyRequest(), + {}, ], ) def test_update_authorization_policy(request_type, transport: str = "grpc"): @@ -2672,7 +2694,7 @@ def test_update_authorization_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( @@ -2715,7 +2737,8 @@ def test_update_authorization_policy_non_empty_request_with_auto_populated_field client.update_authorization_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_authorization_policy.UpdateAuthorizationPolicyRequest() + request_msg = gcn_authorization_policy.UpdateAuthorizationPolicyRequest() + assert args[0] == request_msg def test_update_authorization_policy_use_cached_wrapped_rpc(): @@ -2811,9 +2834,15 @@ async def test_update_authorization_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcn_authorization_policy.UpdateAuthorizationPolicyRequest(), + {}, + ], +) async def test_update_authorization_policy_async( - transport: str = "grpc_asyncio", - request_type=gcn_authorization_policy.UpdateAuthorizationPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -2822,7 +2851,7 @@ async def test_update_authorization_policy_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( @@ -2844,11 +2873,6 @@ async def test_update_authorization_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_authorization_policy_async_from_dict(): - await test_update_authorization_policy_async(request_type=dict) - - def test_update_authorization_policy_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3021,8 +3045,8 @@ async def test_update_authorization_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - authorization_policy.DeleteAuthorizationPolicyRequest, - dict, + authorization_policy.DeleteAuthorizationPolicyRequest(), + {}, ], ) def test_delete_authorization_policy(request_type, transport: str = "grpc"): @@ -3033,7 +3057,7 @@ def test_delete_authorization_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( @@ -3078,9 +3102,10 @@ def test_delete_authorization_policy_non_empty_request_with_auto_populated_field client.delete_authorization_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == authorization_policy.DeleteAuthorizationPolicyRequest( + request_msg = authorization_policy.DeleteAuthorizationPolicyRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_authorization_policy_use_cached_wrapped_rpc(): @@ -3176,9 +3201,15 @@ async def test_delete_authorization_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + authorization_policy.DeleteAuthorizationPolicyRequest(), + {}, + ], +) async def test_delete_authorization_policy_async( - transport: str = "grpc_asyncio", - request_type=authorization_policy.DeleteAuthorizationPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -3187,7 +3218,7 @@ async def test_delete_authorization_policy_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( @@ -3209,11 +3240,6 @@ async def test_delete_authorization_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_authorization_policy_async_from_dict(): - await test_delete_authorization_policy_async(request_type=dict) - - def test_delete_authorization_policy_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3368,8 +3394,8 @@ async def test_delete_authorization_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - backend_authentication_config.ListBackendAuthenticationConfigsRequest, - dict, + backend_authentication_config.ListBackendAuthenticationConfigsRequest(), + {}, ], ) def test_list_backend_authentication_configs(request_type, transport: str = "grpc"): @@ -3380,7 +3406,7 @@ def test_list_backend_authentication_configs(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( @@ -3435,12 +3461,13 @@ def test_list_backend_authentication_configs_non_empty_request_with_auto_populat client.list_backend_authentication_configs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == backend_authentication_config.ListBackendAuthenticationConfigsRequest( - parent="parent_value", - page_token="page_token_value", + request_msg = ( + backend_authentication_config.ListBackendAuthenticationConfigsRequest( + parent="parent_value", + page_token="page_token_value", + ) ) + assert args[0] == request_msg def test_list_backend_authentication_configs_use_cached_wrapped_rpc(): @@ -3526,9 +3553,15 @@ async def test_list_backend_authentication_configs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + backend_authentication_config.ListBackendAuthenticationConfigsRequest(), + {}, + ], +) async def test_list_backend_authentication_configs_async( - transport: str = "grpc_asyncio", - request_type=backend_authentication_config.ListBackendAuthenticationConfigsRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -3537,7 +3570,7 @@ async def test_list_backend_authentication_configs_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( @@ -3566,11 +3599,6 @@ async def test_list_backend_authentication_configs_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_backend_authentication_configs_async_from_dict(): - await test_list_backend_authentication_configs_async(request_type=dict) - - def test_list_backend_authentication_configs_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3939,8 +3967,8 @@ async def test_list_backend_authentication_configs_async_pages(): @pytest.mark.parametrize( "request_type", [ - backend_authentication_config.GetBackendAuthenticationConfigRequest, - dict, + backend_authentication_config.GetBackendAuthenticationConfigRequest(), + {}, ], ) def test_get_backend_authentication_config(request_type, transport: str = "grpc"): @@ -3951,7 +3979,7 @@ def test_get_backend_authentication_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( @@ -4014,11 +4042,12 @@ def test_get_backend_authentication_config_non_empty_request_with_auto_populated client.get_backend_authentication_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == backend_authentication_config.GetBackendAuthenticationConfigRequest( - name="name_value", + request_msg = ( + backend_authentication_config.GetBackendAuthenticationConfigRequest( + name="name_value", + ) ) + assert args[0] == request_msg def test_get_backend_authentication_config_use_cached_wrapped_rpc(): @@ -4104,9 +4133,15 @@ async def test_get_backend_authentication_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + backend_authentication_config.GetBackendAuthenticationConfigRequest(), + {}, + ], +) async def test_get_backend_authentication_config_async( - transport: str = "grpc_asyncio", - request_type=backend_authentication_config.GetBackendAuthenticationConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -4115,7 +4150,7 @@ async def test_get_backend_authentication_config_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( @@ -4155,11 +4190,6 @@ async def test_get_backend_authentication_config_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_backend_authentication_config_async_from_dict(): - await test_get_backend_authentication_config_async(request_type=dict) - - def test_get_backend_authentication_config_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4314,8 +4344,8 @@ async def test_get_backend_authentication_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_backend_authentication_config.CreateBackendAuthenticationConfigRequest, - dict, + gcn_backend_authentication_config.CreateBackendAuthenticationConfigRequest(), + {}, ], ) def test_create_backend_authentication_config(request_type, transport: str = "grpc"): @@ -4326,7 +4356,7 @@ def test_create_backend_authentication_config(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( @@ -4376,12 +4406,11 @@ def test_create_backend_authentication_config_non_empty_request_with_auto_popula client.create_backend_authentication_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == gcn_backend_authentication_config.CreateBackendAuthenticationConfigRequest( + request_msg = gcn_backend_authentication_config.CreateBackendAuthenticationConfigRequest( parent="parent_value", backend_authentication_config_id="backend_authentication_config_id_value", ) + assert args[0] == request_msg def test_create_backend_authentication_config_use_cached_wrapped_rpc(): @@ -4477,9 +4506,15 @@ async def test_create_backend_authentication_config_async_use_cached_wrapped_rpc @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcn_backend_authentication_config.CreateBackendAuthenticationConfigRequest(), + {}, + ], +) async def test_create_backend_authentication_config_async( - transport: str = "grpc_asyncio", - request_type=gcn_backend_authentication_config.CreateBackendAuthenticationConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -4488,7 +4523,7 @@ async def test_create_backend_authentication_config_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( @@ -4512,11 +4547,6 @@ async def test_create_backend_authentication_config_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_backend_authentication_config_async_from_dict(): - await test_create_backend_authentication_config_async(request_type=dict) - - def test_create_backend_authentication_config_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4707,8 +4737,8 @@ async def test_create_backend_authentication_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_backend_authentication_config.UpdateBackendAuthenticationConfigRequest, - dict, + gcn_backend_authentication_config.UpdateBackendAuthenticationConfigRequest(), + {}, ], ) def test_update_backend_authentication_config(request_type, transport: str = "grpc"): @@ -4719,7 +4749,7 @@ def test_update_backend_authentication_config(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( @@ -4766,10 +4796,10 @@ def test_update_backend_authentication_config_non_empty_request_with_auto_popula client.update_backend_authentication_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert ( - args[0] - == gcn_backend_authentication_config.UpdateBackendAuthenticationConfigRequest() + request_msg = ( + gcn_backend_authentication_config.UpdateBackendAuthenticationConfigRequest() ) + assert args[0] == request_msg def test_update_backend_authentication_config_use_cached_wrapped_rpc(): @@ -4865,9 +4895,15 @@ async def test_update_backend_authentication_config_async_use_cached_wrapped_rpc @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcn_backend_authentication_config.UpdateBackendAuthenticationConfigRequest(), + {}, + ], +) async def test_update_backend_authentication_config_async( - transport: str = "grpc_asyncio", - request_type=gcn_backend_authentication_config.UpdateBackendAuthenticationConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -4876,7 +4912,7 @@ async def test_update_backend_authentication_config_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( @@ -4900,11 +4936,6 @@ async def test_update_backend_authentication_config_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_backend_authentication_config_async_from_dict(): - await test_update_backend_authentication_config_async(request_type=dict) - - def test_update_backend_authentication_config_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5085,8 +5116,8 @@ async def test_update_backend_authentication_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - backend_authentication_config.DeleteBackendAuthenticationConfigRequest, - dict, + backend_authentication_config.DeleteBackendAuthenticationConfigRequest(), + {}, ], ) def test_delete_backend_authentication_config(request_type, transport: str = "grpc"): @@ -5097,7 +5128,7 @@ def test_delete_backend_authentication_config(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( @@ -5145,12 +5176,13 @@ def test_delete_backend_authentication_config_non_empty_request_with_auto_popula client.delete_backend_authentication_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == backend_authentication_config.DeleteBackendAuthenticationConfigRequest( - name="name_value", - etag="etag_value", + request_msg = ( + backend_authentication_config.DeleteBackendAuthenticationConfigRequest( + name="name_value", + etag="etag_value", + ) ) + assert args[0] == request_msg def test_delete_backend_authentication_config_use_cached_wrapped_rpc(): @@ -5246,9 +5278,15 @@ async def test_delete_backend_authentication_config_async_use_cached_wrapped_rpc @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + backend_authentication_config.DeleteBackendAuthenticationConfigRequest(), + {}, + ], +) async def test_delete_backend_authentication_config_async( - transport: str = "grpc_asyncio", - request_type=backend_authentication_config.DeleteBackendAuthenticationConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -5257,7 +5295,7 @@ async def test_delete_backend_authentication_config_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( @@ -5281,11 +5319,6 @@ async def test_delete_backend_authentication_config_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_backend_authentication_config_async_from_dict(): - await test_delete_backend_authentication_config_async(request_type=dict) - - def test_delete_backend_authentication_config_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5440,8 +5473,8 @@ async def test_delete_backend_authentication_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - server_tls_policy.ListServerTlsPoliciesRequest, - dict, + server_tls_policy.ListServerTlsPoliciesRequest(), + {}, ], ) def test_list_server_tls_policies(request_type, transport: str = "grpc"): @@ -5452,7 +5485,7 @@ def test_list_server_tls_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( @@ -5503,10 +5536,11 @@ def test_list_server_tls_policies_non_empty_request_with_auto_populated_field(): client.list_server_tls_policies(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == server_tls_policy.ListServerTlsPoliciesRequest( + request_msg = server_tls_policy.ListServerTlsPoliciesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_server_tls_policies_use_cached_wrapped_rpc(): @@ -5592,9 +5626,15 @@ async def test_list_server_tls_policies_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + server_tls_policy.ListServerTlsPoliciesRequest(), + {}, + ], +) async def test_list_server_tls_policies_async( - transport: str = "grpc_asyncio", - request_type=server_tls_policy.ListServerTlsPoliciesRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -5603,7 +5643,7 @@ async def test_list_server_tls_policies_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( @@ -5630,11 +5670,6 @@ async def test_list_server_tls_policies_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_server_tls_policies_async_from_dict(): - await test_list_server_tls_policies_async(request_type=dict) - - def test_list_server_tls_policies_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5989,8 +6024,8 @@ async def test_list_server_tls_policies_async_pages(): @pytest.mark.parametrize( "request_type", [ - server_tls_policy.GetServerTlsPolicyRequest, - dict, + server_tls_policy.GetServerTlsPolicyRequest(), + {}, ], ) def test_get_server_tls_policy(request_type, transport: str = "grpc"): @@ -6001,7 +6036,7 @@ def test_get_server_tls_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( @@ -6053,9 +6088,10 @@ def test_get_server_tls_policy_non_empty_request_with_auto_populated_field(): client.get_server_tls_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == server_tls_policy.GetServerTlsPolicyRequest( + request_msg = server_tls_policy.GetServerTlsPolicyRequest( name="name_value", ) + assert args[0] == request_msg def test_get_server_tls_policy_use_cached_wrapped_rpc(): @@ -6141,9 +6177,15 @@ async def test_get_server_tls_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + server_tls_policy.GetServerTlsPolicyRequest(), + {}, + ], +) async def test_get_server_tls_policy_async( - transport: str = "grpc_asyncio", - request_type=server_tls_policy.GetServerTlsPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -6152,7 +6194,7 @@ async def test_get_server_tls_policy_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( @@ -6181,11 +6223,6 @@ async def test_get_server_tls_policy_async( assert response.allow_open is True -@pytest.mark.asyncio -async def test_get_server_tls_policy_async_from_dict(): - await test_get_server_tls_policy_async(request_type=dict) - - def test_get_server_tls_policy_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6340,8 +6377,8 @@ async def test_get_server_tls_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_server_tls_policy.CreateServerTlsPolicyRequest, - dict, + gcn_server_tls_policy.CreateServerTlsPolicyRequest(), + {}, ], ) def test_create_server_tls_policy(request_type, transport: str = "grpc"): @@ -6352,7 +6389,7 @@ def test_create_server_tls_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( @@ -6398,10 +6435,11 @@ def test_create_server_tls_policy_non_empty_request_with_auto_populated_field(): client.create_server_tls_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_server_tls_policy.CreateServerTlsPolicyRequest( + request_msg = gcn_server_tls_policy.CreateServerTlsPolicyRequest( parent="parent_value", server_tls_policy_id="server_tls_policy_id_value", ) + assert args[0] == request_msg def test_create_server_tls_policy_use_cached_wrapped_rpc(): @@ -6497,9 +6535,15 @@ async def test_create_server_tls_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcn_server_tls_policy.CreateServerTlsPolicyRequest(), + {}, + ], +) async def test_create_server_tls_policy_async( - transport: str = "grpc_asyncio", - request_type=gcn_server_tls_policy.CreateServerTlsPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -6508,7 +6552,7 @@ async def test_create_server_tls_policy_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( @@ -6530,11 +6574,6 @@ async def test_create_server_tls_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_server_tls_policy_async_from_dict(): - await test_create_server_tls_policy_async(request_type=dict) - - def test_create_server_tls_policy_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6709,8 +6748,8 @@ async def test_create_server_tls_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_server_tls_policy.UpdateServerTlsPolicyRequest, - dict, + gcn_server_tls_policy.UpdateServerTlsPolicyRequest(), + {}, ], ) def test_update_server_tls_policy(request_type, transport: str = "grpc"): @@ -6721,7 +6760,7 @@ def test_update_server_tls_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( @@ -6764,7 +6803,8 @@ def test_update_server_tls_policy_non_empty_request_with_auto_populated_field(): client.update_server_tls_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_server_tls_policy.UpdateServerTlsPolicyRequest() + request_msg = gcn_server_tls_policy.UpdateServerTlsPolicyRequest() + assert args[0] == request_msg def test_update_server_tls_policy_use_cached_wrapped_rpc(): @@ -6860,9 +6900,15 @@ async def test_update_server_tls_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcn_server_tls_policy.UpdateServerTlsPolicyRequest(), + {}, + ], +) async def test_update_server_tls_policy_async( - transport: str = "grpc_asyncio", - request_type=gcn_server_tls_policy.UpdateServerTlsPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -6871,7 +6917,7 @@ async def test_update_server_tls_policy_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( @@ -6893,11 +6939,6 @@ async def test_update_server_tls_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_server_tls_policy_async_from_dict(): - await test_update_server_tls_policy_async(request_type=dict) - - def test_update_server_tls_policy_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7062,8 +7103,8 @@ async def test_update_server_tls_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - server_tls_policy.DeleteServerTlsPolicyRequest, - dict, + server_tls_policy.DeleteServerTlsPolicyRequest(), + {}, ], ) def test_delete_server_tls_policy(request_type, transport: str = "grpc"): @@ -7074,7 +7115,7 @@ def test_delete_server_tls_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( @@ -7119,9 +7160,10 @@ def test_delete_server_tls_policy_non_empty_request_with_auto_populated_field(): client.delete_server_tls_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == server_tls_policy.DeleteServerTlsPolicyRequest( + request_msg = server_tls_policy.DeleteServerTlsPolicyRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_server_tls_policy_use_cached_wrapped_rpc(): @@ -7217,9 +7259,15 @@ async def test_delete_server_tls_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + server_tls_policy.DeleteServerTlsPolicyRequest(), + {}, + ], +) async def test_delete_server_tls_policy_async( - transport: str = "grpc_asyncio", - request_type=server_tls_policy.DeleteServerTlsPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -7228,7 +7276,7 @@ async def test_delete_server_tls_policy_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( @@ -7250,11 +7298,6 @@ async def test_delete_server_tls_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_server_tls_policy_async_from_dict(): - await test_delete_server_tls_policy_async(request_type=dict) - - def test_delete_server_tls_policy_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7409,8 +7452,8 @@ async def test_delete_server_tls_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - client_tls_policy.ListClientTlsPoliciesRequest, - dict, + client_tls_policy.ListClientTlsPoliciesRequest(), + {}, ], ) def test_list_client_tls_policies(request_type, transport: str = "grpc"): @@ -7421,7 +7464,7 @@ def test_list_client_tls_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( @@ -7470,10 +7513,11 @@ def test_list_client_tls_policies_non_empty_request_with_auto_populated_field(): client.list_client_tls_policies(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == client_tls_policy.ListClientTlsPoliciesRequest( + request_msg = client_tls_policy.ListClientTlsPoliciesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_client_tls_policies_use_cached_wrapped_rpc(): @@ -7559,9 +7603,15 @@ async def test_list_client_tls_policies_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + client_tls_policy.ListClientTlsPoliciesRequest(), + {}, + ], +) async def test_list_client_tls_policies_async( - transport: str = "grpc_asyncio", - request_type=client_tls_policy.ListClientTlsPoliciesRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -7570,7 +7620,7 @@ async def test_list_client_tls_policies_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( @@ -7595,11 +7645,6 @@ async def test_list_client_tls_policies_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_client_tls_policies_async_from_dict(): - await test_list_client_tls_policies_async(request_type=dict) - - def test_list_client_tls_policies_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7954,8 +7999,8 @@ async def test_list_client_tls_policies_async_pages(): @pytest.mark.parametrize( "request_type", [ - client_tls_policy.GetClientTlsPolicyRequest, - dict, + client_tls_policy.GetClientTlsPolicyRequest(), + {}, ], ) def test_get_client_tls_policy(request_type, transport: str = "grpc"): @@ -7966,7 +8011,7 @@ def test_get_client_tls_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( @@ -8018,9 +8063,10 @@ def test_get_client_tls_policy_non_empty_request_with_auto_populated_field(): client.get_client_tls_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == client_tls_policy.GetClientTlsPolicyRequest( + request_msg = client_tls_policy.GetClientTlsPolicyRequest( name="name_value", ) + assert args[0] == request_msg def test_get_client_tls_policy_use_cached_wrapped_rpc(): @@ -8106,9 +8152,15 @@ async def test_get_client_tls_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + client_tls_policy.GetClientTlsPolicyRequest(), + {}, + ], +) async def test_get_client_tls_policy_async( - transport: str = "grpc_asyncio", - request_type=client_tls_policy.GetClientTlsPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -8117,7 +8169,7 @@ async def test_get_client_tls_policy_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( @@ -8146,11 +8198,6 @@ async def test_get_client_tls_policy_async( assert response.sni == "sni_value" -@pytest.mark.asyncio -async def test_get_client_tls_policy_async_from_dict(): - await test_get_client_tls_policy_async(request_type=dict) - - def test_get_client_tls_policy_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8305,8 +8352,8 @@ async def test_get_client_tls_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_client_tls_policy.CreateClientTlsPolicyRequest, - dict, + gcn_client_tls_policy.CreateClientTlsPolicyRequest(), + {}, ], ) def test_create_client_tls_policy(request_type, transport: str = "grpc"): @@ -8317,7 +8364,7 @@ def test_create_client_tls_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( @@ -8363,10 +8410,11 @@ def test_create_client_tls_policy_non_empty_request_with_auto_populated_field(): client.create_client_tls_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_client_tls_policy.CreateClientTlsPolicyRequest( + request_msg = gcn_client_tls_policy.CreateClientTlsPolicyRequest( parent="parent_value", client_tls_policy_id="client_tls_policy_id_value", ) + assert args[0] == request_msg def test_create_client_tls_policy_use_cached_wrapped_rpc(): @@ -8462,9 +8510,15 @@ async def test_create_client_tls_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcn_client_tls_policy.CreateClientTlsPolicyRequest(), + {}, + ], +) async def test_create_client_tls_policy_async( - transport: str = "grpc_asyncio", - request_type=gcn_client_tls_policy.CreateClientTlsPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -8473,7 +8527,7 @@ async def test_create_client_tls_policy_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( @@ -8495,11 +8549,6 @@ async def test_create_client_tls_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_client_tls_policy_async_from_dict(): - await test_create_client_tls_policy_async(request_type=dict) - - def test_create_client_tls_policy_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8674,8 +8723,8 @@ async def test_create_client_tls_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_client_tls_policy.UpdateClientTlsPolicyRequest, - dict, + gcn_client_tls_policy.UpdateClientTlsPolicyRequest(), + {}, ], ) def test_update_client_tls_policy(request_type, transport: str = "grpc"): @@ -8686,7 +8735,7 @@ def test_update_client_tls_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( @@ -8729,7 +8778,8 @@ def test_update_client_tls_policy_non_empty_request_with_auto_populated_field(): client.update_client_tls_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_client_tls_policy.UpdateClientTlsPolicyRequest() + request_msg = gcn_client_tls_policy.UpdateClientTlsPolicyRequest() + assert args[0] == request_msg def test_update_client_tls_policy_use_cached_wrapped_rpc(): @@ -8825,9 +8875,15 @@ async def test_update_client_tls_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcn_client_tls_policy.UpdateClientTlsPolicyRequest(), + {}, + ], +) async def test_update_client_tls_policy_async( - transport: str = "grpc_asyncio", - request_type=gcn_client_tls_policy.UpdateClientTlsPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -8836,7 +8892,7 @@ async def test_update_client_tls_policy_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( @@ -8858,11 +8914,6 @@ async def test_update_client_tls_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_client_tls_policy_async_from_dict(): - await test_update_client_tls_policy_async(request_type=dict) - - def test_update_client_tls_policy_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9027,8 +9078,8 @@ async def test_update_client_tls_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - client_tls_policy.DeleteClientTlsPolicyRequest, - dict, + client_tls_policy.DeleteClientTlsPolicyRequest(), + {}, ], ) def test_delete_client_tls_policy(request_type, transport: str = "grpc"): @@ -9039,7 +9090,7 @@ def test_delete_client_tls_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( @@ -9084,9 +9135,10 @@ def test_delete_client_tls_policy_non_empty_request_with_auto_populated_field(): client.delete_client_tls_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == client_tls_policy.DeleteClientTlsPolicyRequest( + request_msg = client_tls_policy.DeleteClientTlsPolicyRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_client_tls_policy_use_cached_wrapped_rpc(): @@ -9182,9 +9234,15 @@ async def test_delete_client_tls_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + client_tls_policy.DeleteClientTlsPolicyRequest(), + {}, + ], +) async def test_delete_client_tls_policy_async( - transport: str = "grpc_asyncio", - request_type=client_tls_policy.DeleteClientTlsPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -9193,7 +9251,7 @@ async def test_delete_client_tls_policy_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( @@ -9215,11 +9273,6 @@ async def test_delete_client_tls_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_client_tls_policy_async_from_dict(): - await test_delete_client_tls_policy_async(request_type=dict) - - def test_delete_client_tls_policy_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9374,8 +9427,8 @@ async def test_delete_client_tls_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gateway_security_policy.ListGatewaySecurityPoliciesRequest, - dict, + gateway_security_policy.ListGatewaySecurityPoliciesRequest(), + {}, ], ) def test_list_gateway_security_policies(request_type, transport: str = "grpc"): @@ -9386,7 +9439,7 @@ def test_list_gateway_security_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( @@ -9437,10 +9490,11 @@ def test_list_gateway_security_policies_non_empty_request_with_auto_populated_fi client.list_gateway_security_policies(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gateway_security_policy.ListGatewaySecurityPoliciesRequest( + request_msg = gateway_security_policy.ListGatewaySecurityPoliciesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_gateway_security_policies_use_cached_wrapped_rpc(): @@ -9526,9 +9580,15 @@ async def test_list_gateway_security_policies_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gateway_security_policy.ListGatewaySecurityPoliciesRequest(), + {}, + ], +) async def test_list_gateway_security_policies_async( - transport: str = "grpc_asyncio", - request_type=gateway_security_policy.ListGatewaySecurityPoliciesRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -9537,7 +9597,7 @@ async def test_list_gateway_security_policies_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( @@ -9564,11 +9624,6 @@ async def test_list_gateway_security_policies_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_gateway_security_policies_async_from_dict(): - await test_list_gateway_security_policies_async(request_type=dict) - - def test_list_gateway_security_policies_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9937,8 +9992,8 @@ async def test_list_gateway_security_policies_async_pages(): @pytest.mark.parametrize( "request_type", [ - gateway_security_policy.GetGatewaySecurityPolicyRequest, - dict, + gateway_security_policy.GetGatewaySecurityPolicyRequest(), + {}, ], ) def test_get_gateway_security_policy(request_type, transport: str = "grpc"): @@ -9949,7 +10004,7 @@ def test_get_gateway_security_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( @@ -10001,9 +10056,10 @@ def test_get_gateway_security_policy_non_empty_request_with_auto_populated_field client.get_gateway_security_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gateway_security_policy.GetGatewaySecurityPolicyRequest( + request_msg = gateway_security_policy.GetGatewaySecurityPolicyRequest( name="name_value", ) + assert args[0] == request_msg def test_get_gateway_security_policy_use_cached_wrapped_rpc(): @@ -10089,9 +10145,15 @@ async def test_get_gateway_security_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gateway_security_policy.GetGatewaySecurityPolicyRequest(), + {}, + ], +) async def test_get_gateway_security_policy_async( - transport: str = "grpc_asyncio", - request_type=gateway_security_policy.GetGatewaySecurityPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -10100,7 +10162,7 @@ async def test_get_gateway_security_policy_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( @@ -10129,11 +10191,6 @@ async def test_get_gateway_security_policy_async( assert response.tls_inspection_policy == "tls_inspection_policy_value" -@pytest.mark.asyncio -async def test_get_gateway_security_policy_async_from_dict(): - await test_get_gateway_security_policy_async(request_type=dict) - - def test_get_gateway_security_policy_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10288,8 +10345,8 @@ async def test_get_gateway_security_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_gateway_security_policy.CreateGatewaySecurityPolicyRequest, - dict, + gcn_gateway_security_policy.CreateGatewaySecurityPolicyRequest(), + {}, ], ) def test_create_gateway_security_policy(request_type, transport: str = "grpc"): @@ -10300,7 +10357,7 @@ def test_create_gateway_security_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( @@ -10346,12 +10403,11 @@ def test_create_gateway_security_policy_non_empty_request_with_auto_populated_fi client.create_gateway_security_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == gcn_gateway_security_policy.CreateGatewaySecurityPolicyRequest( + request_msg = gcn_gateway_security_policy.CreateGatewaySecurityPolicyRequest( parent="parent_value", gateway_security_policy_id="gateway_security_policy_id_value", ) + assert args[0] == request_msg def test_create_gateway_security_policy_use_cached_wrapped_rpc(): @@ -10447,9 +10503,15 @@ async def test_create_gateway_security_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcn_gateway_security_policy.CreateGatewaySecurityPolicyRequest(), + {}, + ], +) async def test_create_gateway_security_policy_async( - transport: str = "grpc_asyncio", - request_type=gcn_gateway_security_policy.CreateGatewaySecurityPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -10458,7 +10520,7 @@ async def test_create_gateway_security_policy_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( @@ -10480,11 +10542,6 @@ async def test_create_gateway_security_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_gateway_security_policy_async_from_dict(): - await test_create_gateway_security_policy_async(request_type=dict) - - def test_create_gateway_security_policy_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10667,8 +10724,8 @@ async def test_create_gateway_security_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_gateway_security_policy.UpdateGatewaySecurityPolicyRequest, - dict, + gcn_gateway_security_policy.UpdateGatewaySecurityPolicyRequest(), + {}, ], ) def test_update_gateway_security_policy(request_type, transport: str = "grpc"): @@ -10679,7 +10736,7 @@ def test_update_gateway_security_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( @@ -10722,9 +10779,8 @@ def test_update_gateway_security_policy_non_empty_request_with_auto_populated_fi client.update_gateway_security_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert ( - args[0] == gcn_gateway_security_policy.UpdateGatewaySecurityPolicyRequest() - ) + request_msg = gcn_gateway_security_policy.UpdateGatewaySecurityPolicyRequest() + assert args[0] == request_msg def test_update_gateway_security_policy_use_cached_wrapped_rpc(): @@ -10820,9 +10876,15 @@ async def test_update_gateway_security_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcn_gateway_security_policy.UpdateGatewaySecurityPolicyRequest(), + {}, + ], +) async def test_update_gateway_security_policy_async( - transport: str = "grpc_asyncio", - request_type=gcn_gateway_security_policy.UpdateGatewaySecurityPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -10831,7 +10893,7 @@ async def test_update_gateway_security_policy_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( @@ -10853,11 +10915,6 @@ async def test_update_gateway_security_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_gateway_security_policy_async_from_dict(): - await test_update_gateway_security_policy_async(request_type=dict) - - def test_update_gateway_security_policy_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11030,8 +11087,8 @@ async def test_update_gateway_security_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gateway_security_policy.DeleteGatewaySecurityPolicyRequest, - dict, + gateway_security_policy.DeleteGatewaySecurityPolicyRequest(), + {}, ], ) def test_delete_gateway_security_policy(request_type, transport: str = "grpc"): @@ -11042,7 +11099,7 @@ def test_delete_gateway_security_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( @@ -11087,9 +11144,10 @@ def test_delete_gateway_security_policy_non_empty_request_with_auto_populated_fi client.delete_gateway_security_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gateway_security_policy.DeleteGatewaySecurityPolicyRequest( + request_msg = gateway_security_policy.DeleteGatewaySecurityPolicyRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_gateway_security_policy_use_cached_wrapped_rpc(): @@ -11185,9 +11243,15 @@ async def test_delete_gateway_security_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gateway_security_policy.DeleteGatewaySecurityPolicyRequest(), + {}, + ], +) async def test_delete_gateway_security_policy_async( - transport: str = "grpc_asyncio", - request_type=gateway_security_policy.DeleteGatewaySecurityPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -11196,7 +11260,7 @@ async def test_delete_gateway_security_policy_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( @@ -11218,11 +11282,6 @@ async def test_delete_gateway_security_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_gateway_security_policy_async_from_dict(): - await test_delete_gateway_security_policy_async(request_type=dict) - - def test_delete_gateway_security_policy_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11377,8 +11436,8 @@ async def test_delete_gateway_security_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gateway_security_policy_rule.ListGatewaySecurityPolicyRulesRequest, - dict, + gateway_security_policy_rule.ListGatewaySecurityPolicyRulesRequest(), + {}, ], ) def test_list_gateway_security_policy_rules(request_type, transport: str = "grpc"): @@ -11389,7 +11448,7 @@ def test_list_gateway_security_policy_rules(request_type, transport: str = "grpc # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11442,12 +11501,13 @@ def test_list_gateway_security_policy_rules_non_empty_request_with_auto_populate client.list_gateway_security_policy_rules(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == gateway_security_policy_rule.ListGatewaySecurityPolicyRulesRequest( - parent="parent_value", - page_token="page_token_value", + request_msg = ( + gateway_security_policy_rule.ListGatewaySecurityPolicyRulesRequest( + parent="parent_value", + page_token="page_token_value", + ) ) + assert args[0] == request_msg def test_list_gateway_security_policy_rules_use_cached_wrapped_rpc(): @@ -11533,9 +11593,15 @@ async def test_list_gateway_security_policy_rules_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gateway_security_policy_rule.ListGatewaySecurityPolicyRulesRequest(), + {}, + ], +) async def test_list_gateway_security_policy_rules_async( - transport: str = "grpc_asyncio", - request_type=gateway_security_policy_rule.ListGatewaySecurityPolicyRulesRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -11544,7 +11610,7 @@ async def test_list_gateway_security_policy_rules_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( @@ -11571,11 +11637,6 @@ async def test_list_gateway_security_policy_rules_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_gateway_security_policy_rules_async_from_dict(): - await test_list_gateway_security_policy_rules_async(request_type=dict) - - def test_list_gateway_security_policy_rules_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11944,8 +12005,8 @@ async def test_list_gateway_security_policy_rules_async_pages(): @pytest.mark.parametrize( "request_type", [ - gateway_security_policy_rule.GetGatewaySecurityPolicyRuleRequest, - dict, + gateway_security_policy_rule.GetGatewaySecurityPolicyRuleRequest(), + {}, ], ) def test_get_gateway_security_policy_rule(request_type, transport: str = "grpc"): @@ -11956,7 +12017,7 @@ def test_get_gateway_security_policy_rule(request_type, transport: str = "grpc") # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -12017,11 +12078,10 @@ def test_get_gateway_security_policy_rule_non_empty_request_with_auto_populated_ client.get_gateway_security_policy_rule(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == gateway_security_policy_rule.GetGatewaySecurityPolicyRuleRequest( + request_msg = gateway_security_policy_rule.GetGatewaySecurityPolicyRuleRequest( name="name_value", ) + assert args[0] == request_msg def test_get_gateway_security_policy_rule_use_cached_wrapped_rpc(): @@ -12107,9 +12167,15 @@ async def test_get_gateway_security_policy_rule_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gateway_security_policy_rule.GetGatewaySecurityPolicyRuleRequest(), + {}, + ], +) async def test_get_gateway_security_policy_rule_async( - transport: str = "grpc_asyncio", - request_type=gateway_security_policy_rule.GetGatewaySecurityPolicyRuleRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -12118,7 +12184,7 @@ async def test_get_gateway_security_policy_rule_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( @@ -12155,11 +12221,6 @@ async def test_get_gateway_security_policy_rule_async( assert response.tls_inspection_enabled is True -@pytest.mark.asyncio -async def test_get_gateway_security_policy_rule_async_from_dict(): - await test_get_gateway_security_policy_rule_async(request_type=dict) - - def test_get_gateway_security_policy_rule_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12314,8 +12375,8 @@ async def test_get_gateway_security_policy_rule_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_gateway_security_policy_rule.CreateGatewaySecurityPolicyRuleRequest, - dict, + gcn_gateway_security_policy_rule.CreateGatewaySecurityPolicyRuleRequest(), + {}, ], ) def test_create_gateway_security_policy_rule(request_type, transport: str = "grpc"): @@ -12326,7 +12387,7 @@ def test_create_gateway_security_policy_rule(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( @@ -12374,12 +12435,13 @@ def test_create_gateway_security_policy_rule_non_empty_request_with_auto_populat client.create_gateway_security_policy_rule(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == gcn_gateway_security_policy_rule.CreateGatewaySecurityPolicyRuleRequest( - parent="parent_value", - gateway_security_policy_rule_id="gateway_security_policy_rule_id_value", + request_msg = ( + gcn_gateway_security_policy_rule.CreateGatewaySecurityPolicyRuleRequest( + parent="parent_value", + gateway_security_policy_rule_id="gateway_security_policy_rule_id_value", + ) ) + assert args[0] == request_msg def test_create_gateway_security_policy_rule_use_cached_wrapped_rpc(): @@ -12475,9 +12537,15 @@ async def test_create_gateway_security_policy_rule_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcn_gateway_security_policy_rule.CreateGatewaySecurityPolicyRuleRequest(), + {}, + ], +) async def test_create_gateway_security_policy_rule_async( - transport: str = "grpc_asyncio", - request_type=gcn_gateway_security_policy_rule.CreateGatewaySecurityPolicyRuleRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -12486,7 +12554,7 @@ async def test_create_gateway_security_policy_rule_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( @@ -12510,11 +12578,6 @@ async def test_create_gateway_security_policy_rule_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_gateway_security_policy_rule_async_from_dict(): - await test_create_gateway_security_policy_rule_async(request_type=dict) - - def test_create_gateway_security_policy_rule_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12701,8 +12764,8 @@ async def test_create_gateway_security_policy_rule_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_gateway_security_policy_rule.UpdateGatewaySecurityPolicyRuleRequest, - dict, + gcn_gateway_security_policy_rule.UpdateGatewaySecurityPolicyRuleRequest(), + {}, ], ) def test_update_gateway_security_policy_rule(request_type, transport: str = "grpc"): @@ -12713,7 +12776,7 @@ def test_update_gateway_security_policy_rule(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( @@ -12758,10 +12821,10 @@ def test_update_gateway_security_policy_rule_non_empty_request_with_auto_populat client.update_gateway_security_policy_rule(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert ( - args[0] - == gcn_gateway_security_policy_rule.UpdateGatewaySecurityPolicyRuleRequest() + request_msg = ( + gcn_gateway_security_policy_rule.UpdateGatewaySecurityPolicyRuleRequest() ) + assert args[0] == request_msg def test_update_gateway_security_policy_rule_use_cached_wrapped_rpc(): @@ -12857,9 +12920,15 @@ async def test_update_gateway_security_policy_rule_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcn_gateway_security_policy_rule.UpdateGatewaySecurityPolicyRuleRequest(), + {}, + ], +) async def test_update_gateway_security_policy_rule_async( - transport: str = "grpc_asyncio", - request_type=gcn_gateway_security_policy_rule.UpdateGatewaySecurityPolicyRuleRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -12868,7 +12937,7 @@ async def test_update_gateway_security_policy_rule_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( @@ -12892,11 +12961,6 @@ async def test_update_gateway_security_policy_rule_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_gateway_security_policy_rule_async_from_dict(): - await test_update_gateway_security_policy_rule_async(request_type=dict) - - def test_update_gateway_security_policy_rule_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13073,8 +13137,8 @@ async def test_update_gateway_security_policy_rule_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gateway_security_policy_rule.DeleteGatewaySecurityPolicyRuleRequest, - dict, + gateway_security_policy_rule.DeleteGatewaySecurityPolicyRuleRequest(), + {}, ], ) def test_delete_gateway_security_policy_rule(request_type, transport: str = "grpc"): @@ -13085,7 +13149,7 @@ def test_delete_gateway_security_policy_rule(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( @@ -13130,11 +13194,12 @@ def test_delete_gateway_security_policy_rule_non_empty_request_with_auto_populat client.delete_gateway_security_policy_rule(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == gateway_security_policy_rule.DeleteGatewaySecurityPolicyRuleRequest( - name="name_value", + request_msg = ( + gateway_security_policy_rule.DeleteGatewaySecurityPolicyRuleRequest( + name="name_value", + ) ) + assert args[0] == request_msg def test_delete_gateway_security_policy_rule_use_cached_wrapped_rpc(): @@ -13230,9 +13295,15 @@ async def test_delete_gateway_security_policy_rule_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gateway_security_policy_rule.DeleteGatewaySecurityPolicyRuleRequest(), + {}, + ], +) async def test_delete_gateway_security_policy_rule_async( - transport: str = "grpc_asyncio", - request_type=gateway_security_policy_rule.DeleteGatewaySecurityPolicyRuleRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -13241,7 +13312,7 @@ async def test_delete_gateway_security_policy_rule_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( @@ -13263,11 +13334,6 @@ async def test_delete_gateway_security_policy_rule_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_gateway_security_policy_rule_async_from_dict(): - await test_delete_gateway_security_policy_rule_async(request_type=dict) - - def test_delete_gateway_security_policy_rule_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13422,8 +13488,8 @@ async def test_delete_gateway_security_policy_rule_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - url_list.ListUrlListsRequest, - dict, + url_list.ListUrlListsRequest(), + {}, ], ) def test_list_url_lists(request_type, transport: str = "grpc"): @@ -13434,7 +13500,7 @@ def test_list_url_lists(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_url_lists), "__call__") as call: @@ -13481,10 +13547,11 @@ def test_list_url_lists_non_empty_request_with_auto_populated_field(): client.list_url_lists(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == url_list.ListUrlListsRequest( + request_msg = url_list.ListUrlListsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_url_lists_use_cached_wrapped_rpc(): @@ -13565,9 +13632,14 @@ async def test_list_url_lists_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_url_lists_async( - transport: str = "grpc_asyncio", request_type=url_list.ListUrlListsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + url_list.ListUrlListsRequest(), + {}, + ], +) +async def test_list_url_lists_async(request_type, transport: str = "grpc_asyncio"): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13575,7 +13647,7 @@ async def test_list_url_lists_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_url_lists), "__call__") as call: @@ -13600,11 +13672,6 @@ async def test_list_url_lists_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_url_lists_async_from_dict(): - await test_list_url_lists_async(request_type=dict) - - def test_list_url_lists_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13941,8 +14008,8 @@ async def test_list_url_lists_async_pages(): @pytest.mark.parametrize( "request_type", [ - url_list.GetUrlListRequest, - dict, + url_list.GetUrlListRequest(), + {}, ], ) def test_get_url_list(request_type, transport: str = "grpc"): @@ -13953,7 +14020,7 @@ def test_get_url_list(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_url_list), "__call__") as call: @@ -14001,9 +14068,10 @@ def test_get_url_list_non_empty_request_with_auto_populated_field(): client.get_url_list(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == url_list.GetUrlListRequest( + request_msg = url_list.GetUrlListRequest( name="name_value", ) + assert args[0] == request_msg def test_get_url_list_use_cached_wrapped_rpc(): @@ -14084,9 +14152,14 @@ async def test_get_url_list_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_url_list_async( - transport: str = "grpc_asyncio", request_type=url_list.GetUrlListRequest -): +@pytest.mark.parametrize( + "request_type", + [ + url_list.GetUrlListRequest(), + {}, + ], +) +async def test_get_url_list_async(request_type, transport: str = "grpc_asyncio"): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14094,7 +14167,7 @@ async def test_get_url_list_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_url_list), "__call__") as call: @@ -14121,11 +14194,6 @@ async def test_get_url_list_async( assert response.values == ["values_value"] -@pytest.mark.asyncio -async def test_get_url_list_async_from_dict(): - await test_get_url_list_async(request_type=dict) - - def test_get_url_list_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14268,8 +14336,8 @@ async def test_get_url_list_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_url_list.CreateUrlListRequest, - dict, + gcn_url_list.CreateUrlListRequest(), + {}, ], ) def test_create_url_list(request_type, transport: str = "grpc"): @@ -14280,7 +14348,7 @@ def test_create_url_list(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_url_list), "__call__") as call: @@ -14322,10 +14390,11 @@ def test_create_url_list_non_empty_request_with_auto_populated_field(): client.create_url_list(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_url_list.CreateUrlListRequest( + request_msg = gcn_url_list.CreateUrlListRequest( parent="parent_value", url_list_id="url_list_id_value", ) + assert args[0] == request_msg def test_create_url_list_use_cached_wrapped_rpc(): @@ -14416,9 +14485,14 @@ async def test_create_url_list_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_url_list_async( - transport: str = "grpc_asyncio", request_type=gcn_url_list.CreateUrlListRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcn_url_list.CreateUrlListRequest(), + {}, + ], +) +async def test_create_url_list_async(request_type, transport: str = "grpc_asyncio"): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14426,7 +14500,7 @@ async def test_create_url_list_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_url_list), "__call__") as call: @@ -14446,11 +14520,6 @@ async def test_create_url_list_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_url_list_async_from_dict(): - await test_create_url_list_async(request_type=dict) - - def test_create_url_list_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14617,8 +14686,8 @@ async def test_create_url_list_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_url_list.UpdateUrlListRequest, - dict, + gcn_url_list.UpdateUrlListRequest(), + {}, ], ) def test_update_url_list(request_type, transport: str = "grpc"): @@ -14629,7 +14698,7 @@ def test_update_url_list(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_url_list), "__call__") as call: @@ -14668,7 +14737,8 @@ def test_update_url_list_non_empty_request_with_auto_populated_field(): client.update_url_list(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_url_list.UpdateUrlListRequest() + request_msg = gcn_url_list.UpdateUrlListRequest() + assert args[0] == request_msg def test_update_url_list_use_cached_wrapped_rpc(): @@ -14759,9 +14829,14 @@ async def test_update_url_list_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_url_list_async( - transport: str = "grpc_asyncio", request_type=gcn_url_list.UpdateUrlListRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcn_url_list.UpdateUrlListRequest(), + {}, + ], +) +async def test_update_url_list_async(request_type, transport: str = "grpc_asyncio"): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14769,7 +14844,7 @@ async def test_update_url_list_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_url_list), "__call__") as call: @@ -14789,11 +14864,6 @@ async def test_update_url_list_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_url_list_async_from_dict(): - await test_update_url_list_async(request_type=dict) - - def test_update_url_list_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14950,8 +15020,8 @@ async def test_update_url_list_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - url_list.DeleteUrlListRequest, - dict, + url_list.DeleteUrlListRequest(), + {}, ], ) def test_delete_url_list(request_type, transport: str = "grpc"): @@ -14962,7 +15032,7 @@ def test_delete_url_list(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_url_list), "__call__") as call: @@ -15003,9 +15073,10 @@ def test_delete_url_list_non_empty_request_with_auto_populated_field(): client.delete_url_list(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == url_list.DeleteUrlListRequest( + request_msg = url_list.DeleteUrlListRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_url_list_use_cached_wrapped_rpc(): @@ -15096,9 +15167,14 @@ async def test_delete_url_list_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_url_list_async( - transport: str = "grpc_asyncio", request_type=url_list.DeleteUrlListRequest -): +@pytest.mark.parametrize( + "request_type", + [ + url_list.DeleteUrlListRequest(), + {}, + ], +) +async def test_delete_url_list_async(request_type, transport: str = "grpc_asyncio"): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -15106,7 +15182,7 @@ async def test_delete_url_list_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_url_list), "__call__") as call: @@ -15126,11 +15202,6 @@ async def test_delete_url_list_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_url_list_async_from_dict(): - await test_delete_url_list_async(request_type=dict) - - def test_delete_url_list_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15277,8 +15348,8 @@ async def test_delete_url_list_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - tls_inspection_policy.ListTlsInspectionPoliciesRequest, - dict, + tls_inspection_policy.ListTlsInspectionPoliciesRequest(), + {}, ], ) def test_list_tls_inspection_policies(request_type, transport: str = "grpc"): @@ -15289,7 +15360,7 @@ def test_list_tls_inspection_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( @@ -15340,10 +15411,11 @@ def test_list_tls_inspection_policies_non_empty_request_with_auto_populated_fiel client.list_tls_inspection_policies(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tls_inspection_policy.ListTlsInspectionPoliciesRequest( + request_msg = tls_inspection_policy.ListTlsInspectionPoliciesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_tls_inspection_policies_use_cached_wrapped_rpc(): @@ -15429,9 +15501,15 @@ async def test_list_tls_inspection_policies_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + tls_inspection_policy.ListTlsInspectionPoliciesRequest(), + {}, + ], +) async def test_list_tls_inspection_policies_async( - transport: str = "grpc_asyncio", - request_type=tls_inspection_policy.ListTlsInspectionPoliciesRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -15440,7 +15518,7 @@ async def test_list_tls_inspection_policies_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( @@ -15467,11 +15545,6 @@ async def test_list_tls_inspection_policies_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_tls_inspection_policies_async_from_dict(): - await test_list_tls_inspection_policies_async(request_type=dict) - - def test_list_tls_inspection_policies_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15832,8 +15905,8 @@ async def test_list_tls_inspection_policies_async_pages(): @pytest.mark.parametrize( "request_type", [ - tls_inspection_policy.GetTlsInspectionPolicyRequest, - dict, + tls_inspection_policy.GetTlsInspectionPolicyRequest(), + {}, ], ) def test_get_tls_inspection_policy(request_type, transport: str = "grpc"): @@ -15844,7 +15917,7 @@ def test_get_tls_inspection_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( @@ -15912,9 +15985,10 @@ def test_get_tls_inspection_policy_non_empty_request_with_auto_populated_field() client.get_tls_inspection_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tls_inspection_policy.GetTlsInspectionPolicyRequest( + request_msg = tls_inspection_policy.GetTlsInspectionPolicyRequest( name="name_value", ) + assert args[0] == request_msg def test_get_tls_inspection_policy_use_cached_wrapped_rpc(): @@ -16000,9 +16074,15 @@ async def test_get_tls_inspection_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + tls_inspection_policy.GetTlsInspectionPolicyRequest(), + {}, + ], +) async def test_get_tls_inspection_policy_async( - transport: str = "grpc_asyncio", - request_type=tls_inspection_policy.GetTlsInspectionPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -16011,7 +16091,7 @@ async def test_get_tls_inspection_policy_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( @@ -16056,11 +16136,6 @@ async def test_get_tls_inspection_policy_async( assert response.custom_tls_features == ["custom_tls_features_value"] -@pytest.mark.asyncio -async def test_get_tls_inspection_policy_async_from_dict(): - await test_get_tls_inspection_policy_async(request_type=dict) - - def test_get_tls_inspection_policy_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16215,8 +16290,8 @@ async def test_get_tls_inspection_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_tls_inspection_policy.CreateTlsInspectionPolicyRequest, - dict, + gcn_tls_inspection_policy.CreateTlsInspectionPolicyRequest(), + {}, ], ) def test_create_tls_inspection_policy(request_type, transport: str = "grpc"): @@ -16227,7 +16302,7 @@ def test_create_tls_inspection_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( @@ -16273,10 +16348,11 @@ def test_create_tls_inspection_policy_non_empty_request_with_auto_populated_fiel client.create_tls_inspection_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_tls_inspection_policy.CreateTlsInspectionPolicyRequest( + request_msg = gcn_tls_inspection_policy.CreateTlsInspectionPolicyRequest( parent="parent_value", tls_inspection_policy_id="tls_inspection_policy_id_value", ) + assert args[0] == request_msg def test_create_tls_inspection_policy_use_cached_wrapped_rpc(): @@ -16372,9 +16448,15 @@ async def test_create_tls_inspection_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcn_tls_inspection_policy.CreateTlsInspectionPolicyRequest(), + {}, + ], +) async def test_create_tls_inspection_policy_async( - transport: str = "grpc_asyncio", - request_type=gcn_tls_inspection_policy.CreateTlsInspectionPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -16383,7 +16465,7 @@ async def test_create_tls_inspection_policy_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( @@ -16405,11 +16487,6 @@ async def test_create_tls_inspection_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_tls_inspection_policy_async_from_dict(): - await test_create_tls_inspection_policy_async(request_type=dict) - - def test_create_tls_inspection_policy_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16592,8 +16669,8 @@ async def test_create_tls_inspection_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_tls_inspection_policy.UpdateTlsInspectionPolicyRequest, - dict, + gcn_tls_inspection_policy.UpdateTlsInspectionPolicyRequest(), + {}, ], ) def test_update_tls_inspection_policy(request_type, transport: str = "grpc"): @@ -16604,7 +16681,7 @@ def test_update_tls_inspection_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( @@ -16647,7 +16724,8 @@ def test_update_tls_inspection_policy_non_empty_request_with_auto_populated_fiel client.update_tls_inspection_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_tls_inspection_policy.UpdateTlsInspectionPolicyRequest() + request_msg = gcn_tls_inspection_policy.UpdateTlsInspectionPolicyRequest() + assert args[0] == request_msg def test_update_tls_inspection_policy_use_cached_wrapped_rpc(): @@ -16743,9 +16821,15 @@ async def test_update_tls_inspection_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcn_tls_inspection_policy.UpdateTlsInspectionPolicyRequest(), + {}, + ], +) async def test_update_tls_inspection_policy_async( - transport: str = "grpc_asyncio", - request_type=gcn_tls_inspection_policy.UpdateTlsInspectionPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -16754,7 +16838,7 @@ async def test_update_tls_inspection_policy_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( @@ -16776,11 +16860,6 @@ async def test_update_tls_inspection_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_tls_inspection_policy_async_from_dict(): - await test_update_tls_inspection_policy_async(request_type=dict) - - def test_update_tls_inspection_policy_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16953,8 +17032,8 @@ async def test_update_tls_inspection_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - tls_inspection_policy.DeleteTlsInspectionPolicyRequest, - dict, + tls_inspection_policy.DeleteTlsInspectionPolicyRequest(), + {}, ], ) def test_delete_tls_inspection_policy(request_type, transport: str = "grpc"): @@ -16965,7 +17044,7 @@ def test_delete_tls_inspection_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( @@ -17010,9 +17089,10 @@ def test_delete_tls_inspection_policy_non_empty_request_with_auto_populated_fiel client.delete_tls_inspection_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tls_inspection_policy.DeleteTlsInspectionPolicyRequest( + request_msg = tls_inspection_policy.DeleteTlsInspectionPolicyRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_tls_inspection_policy_use_cached_wrapped_rpc(): @@ -17108,9 +17188,15 @@ async def test_delete_tls_inspection_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + tls_inspection_policy.DeleteTlsInspectionPolicyRequest(), + {}, + ], +) async def test_delete_tls_inspection_policy_async( - transport: str = "grpc_asyncio", - request_type=tls_inspection_policy.DeleteTlsInspectionPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -17119,7 +17205,7 @@ async def test_delete_tls_inspection_policy_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( @@ -17141,11 +17227,6 @@ async def test_delete_tls_inspection_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_tls_inspection_policy_async_from_dict(): - await test_delete_tls_inspection_policy_async(request_type=dict) - - def test_delete_tls_inspection_policy_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17300,8 +17381,8 @@ async def test_delete_tls_inspection_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - authz_policy.ListAuthzPoliciesRequest, - dict, + authz_policy.ListAuthzPoliciesRequest(), + {}, ], ) def test_list_authz_policies(request_type, transport: str = "grpc"): @@ -17312,7 +17393,7 @@ def test_list_authz_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( @@ -17365,12 +17446,13 @@ def test_list_authz_policies_non_empty_request_with_auto_populated_field(): client.list_authz_policies(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == authz_policy.ListAuthzPoliciesRequest( + request_msg = authz_policy.ListAuthzPoliciesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_authz_policies_use_cached_wrapped_rpc(): @@ -17455,9 +17537,14 @@ async def test_list_authz_policies_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_authz_policies_async( - transport: str = "grpc_asyncio", request_type=authz_policy.ListAuthzPoliciesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + authz_policy.ListAuthzPoliciesRequest(), + {}, + ], +) +async def test_list_authz_policies_async(request_type, transport: str = "grpc_asyncio"): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -17465,7 +17552,7 @@ async def test_list_authz_policies_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( @@ -17492,11 +17579,6 @@ async def test_list_authz_policies_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_authz_policies_async_from_dict(): - await test_list_authz_policies_async(request_type=dict) - - def test_list_authz_policies_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17849,8 +17931,8 @@ async def test_list_authz_policies_async_pages(): @pytest.mark.parametrize( "request_type", [ - authz_policy.GetAuthzPolicyRequest, - dict, + authz_policy.GetAuthzPolicyRequest(), + {}, ], ) def test_get_authz_policy(request_type, transport: str = "grpc"): @@ -17861,7 +17943,7 @@ def test_get_authz_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(type(client.transport.get_authz_policy), "__call__") as call: @@ -17913,9 +17995,10 @@ def test_get_authz_policy_non_empty_request_with_auto_populated_field(): client.get_authz_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == authz_policy.GetAuthzPolicyRequest( + request_msg = authz_policy.GetAuthzPolicyRequest( name="name_value", ) + assert args[0] == request_msg def test_get_authz_policy_use_cached_wrapped_rpc(): @@ -17998,9 +18081,14 @@ async def test_get_authz_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_authz_policy_async( - transport: str = "grpc_asyncio", request_type=authz_policy.GetAuthzPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + authz_policy.GetAuthzPolicyRequest(), + {}, + ], +) +async def test_get_authz_policy_async(request_type, transport: str = "grpc_asyncio"): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -18008,7 +18096,7 @@ async def test_get_authz_policy_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_authz_policy), "__call__") as call: @@ -18039,11 +18127,6 @@ async def test_get_authz_policy_async( ) -@pytest.mark.asyncio -async def test_get_authz_policy_async_from_dict(): - await test_get_authz_policy_async(request_type=dict) - - def test_get_authz_policy_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18190,8 +18273,8 @@ async def test_get_authz_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_authz_policy.CreateAuthzPolicyRequest, - dict, + gcn_authz_policy.CreateAuthzPolicyRequest(), + {}, ], ) def test_create_authz_policy(request_type, transport: str = "grpc"): @@ -18202,7 +18285,7 @@ def test_create_authz_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( @@ -18248,10 +18331,11 @@ def test_create_authz_policy_non_empty_request_with_auto_populated_field(): client.create_authz_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_authz_policy.CreateAuthzPolicyRequest( + request_msg = gcn_authz_policy.CreateAuthzPolicyRequest( parent="parent_value", authz_policy_id="authz_policy_id_value", ) + assert args[0] == request_msg def test_create_authz_policy_use_cached_wrapped_rpc(): @@ -18346,10 +18430,14 @@ async def test_create_authz_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_authz_policy_async( - transport: str = "grpc_asyncio", - request_type=gcn_authz_policy.CreateAuthzPolicyRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + gcn_authz_policy.CreateAuthzPolicyRequest(), + {}, + ], +) +async def test_create_authz_policy_async(request_type, transport: str = "grpc_asyncio"): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -18357,7 +18445,7 @@ async def test_create_authz_policy_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( @@ -18379,11 +18467,6 @@ async def test_create_authz_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_authz_policy_async_from_dict(): - await test_create_authz_policy_async(request_type=dict) - - def test_create_authz_policy_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18558,8 +18641,8 @@ async def test_create_authz_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_authz_policy.UpdateAuthzPolicyRequest, - dict, + gcn_authz_policy.UpdateAuthzPolicyRequest(), + {}, ], ) def test_update_authz_policy(request_type, transport: str = "grpc"): @@ -18570,7 +18653,7 @@ def test_update_authz_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( @@ -18613,7 +18696,8 @@ def test_update_authz_policy_non_empty_request_with_auto_populated_field(): client.update_authz_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_authz_policy.UpdateAuthzPolicyRequest() + request_msg = gcn_authz_policy.UpdateAuthzPolicyRequest() + assert args[0] == request_msg def test_update_authz_policy_use_cached_wrapped_rpc(): @@ -18708,10 +18792,14 @@ async def test_update_authz_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_authz_policy_async( - transport: str = "grpc_asyncio", - request_type=gcn_authz_policy.UpdateAuthzPolicyRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + gcn_authz_policy.UpdateAuthzPolicyRequest(), + {}, + ], +) +async def test_update_authz_policy_async(request_type, transport: str = "grpc_asyncio"): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -18719,7 +18807,7 @@ async def test_update_authz_policy_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( @@ -18741,11 +18829,6 @@ async def test_update_authz_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_authz_policy_async_from_dict(): - await test_update_authz_policy_async(request_type=dict) - - def test_update_authz_policy_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18910,8 +18993,8 @@ async def test_update_authz_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - authz_policy.DeleteAuthzPolicyRequest, - dict, + authz_policy.DeleteAuthzPolicyRequest(), + {}, ], ) def test_delete_authz_policy(request_type, transport: str = "grpc"): @@ -18922,7 +19005,7 @@ def test_delete_authz_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( @@ -18967,9 +19050,10 @@ def test_delete_authz_policy_non_empty_request_with_auto_populated_field(): client.delete_authz_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == authz_policy.DeleteAuthzPolicyRequest( + request_msg = authz_policy.DeleteAuthzPolicyRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_authz_policy_use_cached_wrapped_rpc(): @@ -19064,9 +19148,14 @@ async def test_delete_authz_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_authz_policy_async( - transport: str = "grpc_asyncio", request_type=authz_policy.DeleteAuthzPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + authz_policy.DeleteAuthzPolicyRequest(), + {}, + ], +) +async def test_delete_authz_policy_async(request_type, transport: str = "grpc_asyncio"): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -19074,7 +19163,7 @@ async def test_delete_authz_policy_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( @@ -19096,11 +19185,6 @@ async def test_delete_authz_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_authz_policy_async_from_dict(): - await test_delete_authz_policy_async(request_type=dict) - - def test_delete_authz_policy_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -28796,7 +28880,6 @@ def test_list_authorization_policies_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = authorization_policy.ListAuthorizationPoliciesRequest() - assert args[0] == request_msg @@ -28819,7 +28902,6 @@ def test_get_authorization_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = authorization_policy.GetAuthorizationPolicyRequest() - assert args[0] == request_msg @@ -28842,7 +28924,6 @@ def test_create_authorization_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_authorization_policy.CreateAuthorizationPolicyRequest() - assert args[0] == request_msg @@ -28865,7 +28946,6 @@ def test_update_authorization_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_authorization_policy.UpdateAuthorizationPolicyRequest() - assert args[0] == request_msg @@ -28888,7 +28968,6 @@ def test_delete_authorization_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = authorization_policy.DeleteAuthorizationPolicyRequest() - assert args[0] == request_msg @@ -28915,7 +28994,6 @@ def test_list_backend_authentication_configs_empty_call_grpc(): request_msg = ( backend_authentication_config.ListBackendAuthenticationConfigsRequest() ) - assert args[0] == request_msg @@ -28940,7 +29018,6 @@ def test_get_backend_authentication_config_empty_call_grpc(): request_msg = ( backend_authentication_config.GetBackendAuthenticationConfigRequest() ) - assert args[0] == request_msg @@ -28965,7 +29042,6 @@ def test_create_backend_authentication_config_empty_call_grpc(): request_msg = ( gcn_backend_authentication_config.CreateBackendAuthenticationConfigRequest() ) - assert args[0] == request_msg @@ -28990,7 +29066,6 @@ def test_update_backend_authentication_config_empty_call_grpc(): request_msg = ( gcn_backend_authentication_config.UpdateBackendAuthenticationConfigRequest() ) - assert args[0] == request_msg @@ -29015,7 +29090,6 @@ def test_delete_backend_authentication_config_empty_call_grpc(): request_msg = ( backend_authentication_config.DeleteBackendAuthenticationConfigRequest() ) - assert args[0] == request_msg @@ -29038,7 +29112,6 @@ def test_list_server_tls_policies_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = server_tls_policy.ListServerTlsPoliciesRequest() - assert args[0] == request_msg @@ -29061,7 +29134,6 @@ def test_get_server_tls_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = server_tls_policy.GetServerTlsPolicyRequest() - assert args[0] == request_msg @@ -29084,7 +29156,6 @@ def test_create_server_tls_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_server_tls_policy.CreateServerTlsPolicyRequest() - assert args[0] == request_msg @@ -29107,7 +29178,6 @@ def test_update_server_tls_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_server_tls_policy.UpdateServerTlsPolicyRequest() - assert args[0] == request_msg @@ -29130,7 +29200,6 @@ def test_delete_server_tls_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = server_tls_policy.DeleteServerTlsPolicyRequest() - assert args[0] == request_msg @@ -29153,7 +29222,6 @@ def test_list_client_tls_policies_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = client_tls_policy.ListClientTlsPoliciesRequest() - assert args[0] == request_msg @@ -29176,7 +29244,6 @@ def test_get_client_tls_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = client_tls_policy.GetClientTlsPolicyRequest() - assert args[0] == request_msg @@ -29199,7 +29266,6 @@ def test_create_client_tls_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_client_tls_policy.CreateClientTlsPolicyRequest() - assert args[0] == request_msg @@ -29222,7 +29288,6 @@ def test_update_client_tls_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_client_tls_policy.UpdateClientTlsPolicyRequest() - assert args[0] == request_msg @@ -29245,7 +29310,6 @@ def test_delete_client_tls_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = client_tls_policy.DeleteClientTlsPolicyRequest() - assert args[0] == request_msg @@ -29270,7 +29334,6 @@ def test_list_gateway_security_policies_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gateway_security_policy.ListGatewaySecurityPoliciesRequest() - assert args[0] == request_msg @@ -29293,7 +29356,6 @@ def test_get_gateway_security_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gateway_security_policy.GetGatewaySecurityPolicyRequest() - assert args[0] == request_msg @@ -29316,7 +29378,6 @@ def test_create_gateway_security_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_gateway_security_policy.CreateGatewaySecurityPolicyRequest() - assert args[0] == request_msg @@ -29339,7 +29400,6 @@ def test_update_gateway_security_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_gateway_security_policy.UpdateGatewaySecurityPolicyRequest() - assert args[0] == request_msg @@ -29362,7 +29422,6 @@ def test_delete_gateway_security_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gateway_security_policy.DeleteGatewaySecurityPolicyRequest() - assert args[0] == request_msg @@ -29389,7 +29448,6 @@ def test_list_gateway_security_policy_rules_empty_call_grpc(): request_msg = ( gateway_security_policy_rule.ListGatewaySecurityPolicyRulesRequest() ) - assert args[0] == request_msg @@ -29412,7 +29470,6 @@ def test_get_gateway_security_policy_rule_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gateway_security_policy_rule.GetGatewaySecurityPolicyRuleRequest() - assert args[0] == request_msg @@ -29437,7 +29494,6 @@ def test_create_gateway_security_policy_rule_empty_call_grpc(): request_msg = ( gcn_gateway_security_policy_rule.CreateGatewaySecurityPolicyRuleRequest() ) - assert args[0] == request_msg @@ -29462,7 +29518,6 @@ def test_update_gateway_security_policy_rule_empty_call_grpc(): request_msg = ( gcn_gateway_security_policy_rule.UpdateGatewaySecurityPolicyRuleRequest() ) - assert args[0] == request_msg @@ -29487,7 +29542,6 @@ def test_delete_gateway_security_policy_rule_empty_call_grpc(): request_msg = ( gateway_security_policy_rule.DeleteGatewaySecurityPolicyRuleRequest() ) - assert args[0] == request_msg @@ -29508,7 +29562,6 @@ def test_list_url_lists_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = url_list.ListUrlListsRequest() - assert args[0] == request_msg @@ -29529,7 +29582,6 @@ def test_get_url_list_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = url_list.GetUrlListRequest() - assert args[0] == request_msg @@ -29550,7 +29602,6 @@ def test_create_url_list_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_url_list.CreateUrlListRequest() - assert args[0] == request_msg @@ -29571,7 +29622,6 @@ def test_update_url_list_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_url_list.UpdateUrlListRequest() - assert args[0] == request_msg @@ -29592,7 +29642,6 @@ def test_delete_url_list_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = url_list.DeleteUrlListRequest() - assert args[0] == request_msg @@ -29615,7 +29664,6 @@ def test_list_tls_inspection_policies_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tls_inspection_policy.ListTlsInspectionPoliciesRequest() - assert args[0] == request_msg @@ -29638,7 +29686,6 @@ def test_get_tls_inspection_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tls_inspection_policy.GetTlsInspectionPolicyRequest() - assert args[0] == request_msg @@ -29661,7 +29708,6 @@ def test_create_tls_inspection_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_tls_inspection_policy.CreateTlsInspectionPolicyRequest() - assert args[0] == request_msg @@ -29684,7 +29730,6 @@ def test_update_tls_inspection_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_tls_inspection_policy.UpdateTlsInspectionPolicyRequest() - assert args[0] == request_msg @@ -29707,7 +29752,6 @@ def test_delete_tls_inspection_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tls_inspection_policy.DeleteTlsInspectionPolicyRequest() - assert args[0] == request_msg @@ -29730,7 +29774,6 @@ def test_list_authz_policies_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = authz_policy.ListAuthzPoliciesRequest() - assert args[0] == request_msg @@ -29751,7 +29794,6 @@ def test_get_authz_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = authz_policy.GetAuthzPolicyRequest() - assert args[0] == request_msg @@ -29774,7 +29816,6 @@ def test_create_authz_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_authz_policy.CreateAuthzPolicyRequest() - assert args[0] == request_msg @@ -29797,7 +29838,6 @@ def test_update_authz_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_authz_policy.UpdateAuthzPolicyRequest() - assert args[0] == request_msg @@ -29820,7 +29860,6 @@ def test_delete_authz_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = authz_policy.DeleteAuthzPolicyRequest() - assert args[0] == request_msg @@ -29863,7 +29902,6 @@ async def test_list_authorization_policies_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = authorization_policy.ListAuthorizationPoliciesRequest() - assert args[0] == request_msg @@ -29894,7 +29932,6 @@ async def test_get_authorization_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = authorization_policy.GetAuthorizationPolicyRequest() - assert args[0] == request_msg @@ -29921,7 +29958,6 @@ async def test_create_authorization_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_authorization_policy.CreateAuthorizationPolicyRequest() - assert args[0] == request_msg @@ -29948,7 +29984,6 @@ async def test_update_authorization_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_authorization_policy.UpdateAuthorizationPolicyRequest() - assert args[0] == request_msg @@ -29975,7 +30010,6 @@ async def test_delete_authorization_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = authorization_policy.DeleteAuthorizationPolicyRequest() - assert args[0] == request_msg @@ -30007,7 +30041,6 @@ async def test_list_backend_authentication_configs_empty_call_grpc_asyncio(): request_msg = ( backend_authentication_config.ListBackendAuthenticationConfigsRequest() ) - assert args[0] == request_msg @@ -30043,7 +30076,6 @@ async def test_get_backend_authentication_config_empty_call_grpc_asyncio(): request_msg = ( backend_authentication_config.GetBackendAuthenticationConfigRequest() ) - assert args[0] == request_msg @@ -30072,7 +30104,6 @@ async def test_create_backend_authentication_config_empty_call_grpc_asyncio(): request_msg = ( gcn_backend_authentication_config.CreateBackendAuthenticationConfigRequest() ) - assert args[0] == request_msg @@ -30101,7 +30132,6 @@ async def test_update_backend_authentication_config_empty_call_grpc_asyncio(): request_msg = ( gcn_backend_authentication_config.UpdateBackendAuthenticationConfigRequest() ) - assert args[0] == request_msg @@ -30130,7 +30160,6 @@ async def test_delete_backend_authentication_config_empty_call_grpc_asyncio(): request_msg = ( backend_authentication_config.DeleteBackendAuthenticationConfigRequest() ) - assert args[0] == request_msg @@ -30160,7 +30189,6 @@ async def test_list_server_tls_policies_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = server_tls_policy.ListServerTlsPoliciesRequest() - assert args[0] == request_msg @@ -30191,7 +30219,6 @@ async def test_get_server_tls_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = server_tls_policy.GetServerTlsPolicyRequest() - assert args[0] == request_msg @@ -30218,7 +30245,6 @@ async def test_create_server_tls_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_server_tls_policy.CreateServerTlsPolicyRequest() - assert args[0] == request_msg @@ -30245,7 +30271,6 @@ async def test_update_server_tls_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_server_tls_policy.UpdateServerTlsPolicyRequest() - assert args[0] == request_msg @@ -30272,7 +30297,6 @@ async def test_delete_server_tls_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = server_tls_policy.DeleteServerTlsPolicyRequest() - assert args[0] == request_msg @@ -30301,7 +30325,6 @@ async def test_list_client_tls_policies_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = client_tls_policy.ListClientTlsPoliciesRequest() - assert args[0] == request_msg @@ -30332,7 +30355,6 @@ async def test_get_client_tls_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = client_tls_policy.GetClientTlsPolicyRequest() - assert args[0] == request_msg @@ -30359,7 +30381,6 @@ async def test_create_client_tls_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_client_tls_policy.CreateClientTlsPolicyRequest() - assert args[0] == request_msg @@ -30386,7 +30407,6 @@ async def test_update_client_tls_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_client_tls_policy.UpdateClientTlsPolicyRequest() - assert args[0] == request_msg @@ -30413,7 +30433,6 @@ async def test_delete_client_tls_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = client_tls_policy.DeleteClientTlsPolicyRequest() - assert args[0] == request_msg @@ -30443,7 +30462,6 @@ async def test_list_gateway_security_policies_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gateway_security_policy.ListGatewaySecurityPoliciesRequest() - assert args[0] == request_msg @@ -30474,7 +30492,6 @@ async def test_get_gateway_security_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gateway_security_policy.GetGatewaySecurityPolicyRequest() - assert args[0] == request_msg @@ -30501,7 +30518,6 @@ async def test_create_gateway_security_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_gateway_security_policy.CreateGatewaySecurityPolicyRequest() - assert args[0] == request_msg @@ -30528,7 +30544,6 @@ async def test_update_gateway_security_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_gateway_security_policy.UpdateGatewaySecurityPolicyRequest() - assert args[0] == request_msg @@ -30555,7 +30570,6 @@ async def test_delete_gateway_security_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gateway_security_policy.DeleteGatewaySecurityPolicyRequest() - assert args[0] == request_msg @@ -30587,7 +30601,6 @@ async def test_list_gateway_security_policy_rules_empty_call_grpc_asyncio(): request_msg = ( gateway_security_policy_rule.ListGatewaySecurityPolicyRulesRequest() ) - assert args[0] == request_msg @@ -30622,7 +30635,6 @@ async def test_get_gateway_security_policy_rule_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gateway_security_policy_rule.GetGatewaySecurityPolicyRuleRequest() - assert args[0] == request_msg @@ -30651,7 +30663,6 @@ async def test_create_gateway_security_policy_rule_empty_call_grpc_asyncio(): request_msg = ( gcn_gateway_security_policy_rule.CreateGatewaySecurityPolicyRuleRequest() ) - assert args[0] == request_msg @@ -30680,7 +30691,6 @@ async def test_update_gateway_security_policy_rule_empty_call_grpc_asyncio(): request_msg = ( gcn_gateway_security_policy_rule.UpdateGatewaySecurityPolicyRuleRequest() ) - assert args[0] == request_msg @@ -30709,7 +30719,6 @@ async def test_delete_gateway_security_policy_rule_empty_call_grpc_asyncio(): request_msg = ( gateway_security_policy_rule.DeleteGatewaySecurityPolicyRuleRequest() ) - assert args[0] == request_msg @@ -30737,7 +30746,6 @@ async def test_list_url_lists_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = url_list.ListUrlListsRequest() - assert args[0] == request_msg @@ -30766,7 +30774,6 @@ async def test_get_url_list_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = url_list.GetUrlListRequest() - assert args[0] == request_msg @@ -30791,7 +30798,6 @@ async def test_create_url_list_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_url_list.CreateUrlListRequest() - assert args[0] == request_msg @@ -30816,7 +30822,6 @@ async def test_update_url_list_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_url_list.UpdateUrlListRequest() - assert args[0] == request_msg @@ -30841,7 +30846,6 @@ async def test_delete_url_list_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = url_list.DeleteUrlListRequest() - assert args[0] == request_msg @@ -30871,7 +30875,6 @@ async def test_list_tls_inspection_policies_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tls_inspection_policy.ListTlsInspectionPoliciesRequest() - assert args[0] == request_msg @@ -30907,7 +30910,6 @@ async def test_get_tls_inspection_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tls_inspection_policy.GetTlsInspectionPolicyRequest() - assert args[0] == request_msg @@ -30934,7 +30936,6 @@ async def test_create_tls_inspection_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_tls_inspection_policy.CreateTlsInspectionPolicyRequest() - assert args[0] == request_msg @@ -30961,7 +30962,6 @@ async def test_update_tls_inspection_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_tls_inspection_policy.UpdateTlsInspectionPolicyRequest() - assert args[0] == request_msg @@ -30988,7 +30988,6 @@ async def test_delete_tls_inspection_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tls_inspection_policy.DeleteTlsInspectionPolicyRequest() - assert args[0] == request_msg @@ -31018,7 +31017,6 @@ async def test_list_authz_policies_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = authz_policy.ListAuthzPoliciesRequest() - assert args[0] == request_msg @@ -31048,7 +31046,6 @@ async def test_get_authz_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = authz_policy.GetAuthzPolicyRequest() - assert args[0] == request_msg @@ -31075,7 +31072,6 @@ async def test_create_authz_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_authz_policy.CreateAuthzPolicyRequest() - assert args[0] == request_msg @@ -31102,7 +31098,6 @@ async def test_update_authz_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_authz_policy.UpdateAuthzPolicyRequest() - assert args[0] == request_msg @@ -31129,7 +31124,6 @@ async def test_delete_authz_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = authz_policy.DeleteAuthzPolicyRequest() - assert args[0] == request_msg @@ -39514,7 +39508,6 @@ def test_list_authorization_policies_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = authorization_policy.ListAuthorizationPoliciesRequest() - assert args[0] == request_msg @@ -39536,7 +39529,6 @@ def test_get_authorization_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = authorization_policy.GetAuthorizationPolicyRequest() - assert args[0] == request_msg @@ -39558,7 +39550,6 @@ def test_create_authorization_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_authorization_policy.CreateAuthorizationPolicyRequest() - assert args[0] == request_msg @@ -39580,7 +39571,6 @@ def test_update_authorization_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_authorization_policy.UpdateAuthorizationPolicyRequest() - assert args[0] == request_msg @@ -39602,7 +39592,6 @@ def test_delete_authorization_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = authorization_policy.DeleteAuthorizationPolicyRequest() - assert args[0] == request_msg @@ -39626,7 +39615,6 @@ def test_list_backend_authentication_configs_empty_call_rest(): request_msg = ( backend_authentication_config.ListBackendAuthenticationConfigsRequest() ) - assert args[0] == request_msg @@ -39650,7 +39638,6 @@ def test_get_backend_authentication_config_empty_call_rest(): request_msg = ( backend_authentication_config.GetBackendAuthenticationConfigRequest() ) - assert args[0] == request_msg @@ -39674,7 +39661,6 @@ def test_create_backend_authentication_config_empty_call_rest(): request_msg = ( gcn_backend_authentication_config.CreateBackendAuthenticationConfigRequest() ) - assert args[0] == request_msg @@ -39698,7 +39684,6 @@ def test_update_backend_authentication_config_empty_call_rest(): request_msg = ( gcn_backend_authentication_config.UpdateBackendAuthenticationConfigRequest() ) - assert args[0] == request_msg @@ -39722,7 +39707,6 @@ def test_delete_backend_authentication_config_empty_call_rest(): request_msg = ( backend_authentication_config.DeleteBackendAuthenticationConfigRequest() ) - assert args[0] == request_msg @@ -39744,7 +39728,6 @@ def test_list_server_tls_policies_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = server_tls_policy.ListServerTlsPoliciesRequest() - assert args[0] == request_msg @@ -39766,7 +39749,6 @@ def test_get_server_tls_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = server_tls_policy.GetServerTlsPolicyRequest() - assert args[0] == request_msg @@ -39788,7 +39770,6 @@ def test_create_server_tls_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_server_tls_policy.CreateServerTlsPolicyRequest() - assert args[0] == request_msg @@ -39810,7 +39791,6 @@ def test_update_server_tls_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_server_tls_policy.UpdateServerTlsPolicyRequest() - assert args[0] == request_msg @@ -39832,7 +39812,6 @@ def test_delete_server_tls_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = server_tls_policy.DeleteServerTlsPolicyRequest() - assert args[0] == request_msg @@ -39854,7 +39833,6 @@ def test_list_client_tls_policies_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = client_tls_policy.ListClientTlsPoliciesRequest() - assert args[0] == request_msg @@ -39876,7 +39854,6 @@ def test_get_client_tls_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = client_tls_policy.GetClientTlsPolicyRequest() - assert args[0] == request_msg @@ -39898,7 +39875,6 @@ def test_create_client_tls_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_client_tls_policy.CreateClientTlsPolicyRequest() - assert args[0] == request_msg @@ -39920,7 +39896,6 @@ def test_update_client_tls_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_client_tls_policy.UpdateClientTlsPolicyRequest() - assert args[0] == request_msg @@ -39942,7 +39917,6 @@ def test_delete_client_tls_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = client_tls_policy.DeleteClientTlsPolicyRequest() - assert args[0] == request_msg @@ -39964,7 +39938,6 @@ def test_list_gateway_security_policies_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gateway_security_policy.ListGatewaySecurityPoliciesRequest() - assert args[0] == request_msg @@ -39986,7 +39959,6 @@ def test_get_gateway_security_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gateway_security_policy.GetGatewaySecurityPolicyRequest() - assert args[0] == request_msg @@ -40008,7 +39980,6 @@ def test_create_gateway_security_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_gateway_security_policy.CreateGatewaySecurityPolicyRequest() - assert args[0] == request_msg @@ -40030,7 +40001,6 @@ def test_update_gateway_security_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_gateway_security_policy.UpdateGatewaySecurityPolicyRequest() - assert args[0] == request_msg @@ -40052,7 +40022,6 @@ def test_delete_gateway_security_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gateway_security_policy.DeleteGatewaySecurityPolicyRequest() - assert args[0] == request_msg @@ -40076,7 +40045,6 @@ def test_list_gateway_security_policy_rules_empty_call_rest(): request_msg = ( gateway_security_policy_rule.ListGatewaySecurityPolicyRulesRequest() ) - assert args[0] == request_msg @@ -40098,7 +40066,6 @@ def test_get_gateway_security_policy_rule_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gateway_security_policy_rule.GetGatewaySecurityPolicyRuleRequest() - assert args[0] == request_msg @@ -40122,7 +40089,6 @@ def test_create_gateway_security_policy_rule_empty_call_rest(): request_msg = ( gcn_gateway_security_policy_rule.CreateGatewaySecurityPolicyRuleRequest() ) - assert args[0] == request_msg @@ -40146,7 +40112,6 @@ def test_update_gateway_security_policy_rule_empty_call_rest(): request_msg = ( gcn_gateway_security_policy_rule.UpdateGatewaySecurityPolicyRuleRequest() ) - assert args[0] == request_msg @@ -40170,7 +40135,6 @@ def test_delete_gateway_security_policy_rule_empty_call_rest(): request_msg = ( gateway_security_policy_rule.DeleteGatewaySecurityPolicyRuleRequest() ) - assert args[0] == request_msg @@ -40190,7 +40154,6 @@ def test_list_url_lists_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = url_list.ListUrlListsRequest() - assert args[0] == request_msg @@ -40210,7 +40173,6 @@ def test_get_url_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = url_list.GetUrlListRequest() - assert args[0] == request_msg @@ -40230,7 +40192,6 @@ def test_create_url_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_url_list.CreateUrlListRequest() - assert args[0] == request_msg @@ -40250,7 +40211,6 @@ def test_update_url_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_url_list.UpdateUrlListRequest() - assert args[0] == request_msg @@ -40270,7 +40230,6 @@ def test_delete_url_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = url_list.DeleteUrlListRequest() - assert args[0] == request_msg @@ -40292,7 +40251,6 @@ def test_list_tls_inspection_policies_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tls_inspection_policy.ListTlsInspectionPoliciesRequest() - assert args[0] == request_msg @@ -40314,7 +40272,6 @@ def test_get_tls_inspection_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tls_inspection_policy.GetTlsInspectionPolicyRequest() - assert args[0] == request_msg @@ -40336,7 +40293,6 @@ def test_create_tls_inspection_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_tls_inspection_policy.CreateTlsInspectionPolicyRequest() - assert args[0] == request_msg @@ -40358,7 +40314,6 @@ def test_update_tls_inspection_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_tls_inspection_policy.UpdateTlsInspectionPolicyRequest() - assert args[0] == request_msg @@ -40380,7 +40335,6 @@ def test_delete_tls_inspection_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tls_inspection_policy.DeleteTlsInspectionPolicyRequest() - assert args[0] == request_msg @@ -40402,7 +40356,6 @@ def test_list_authz_policies_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = authz_policy.ListAuthzPoliciesRequest() - assert args[0] == request_msg @@ -40422,7 +40375,6 @@ def test_get_authz_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = authz_policy.GetAuthzPolicyRequest() - assert args[0] == request_msg @@ -40444,7 +40396,6 @@ def test_create_authz_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_authz_policy.CreateAuthzPolicyRequest() - assert args[0] == request_msg @@ -40466,7 +40417,6 @@ def test_update_authz_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_authz_policy.UpdateAuthzPolicyRequest() - assert args[0] == request_msg @@ -40488,7 +40438,6 @@ def test_delete_authz_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = authz_policy.DeleteAuthzPolicyRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-network-security/tests/unit/gapic/network_security_v1/test_organization_address_group_service.py b/packages/google-cloud-network-security/tests/unit/gapic/network_security_v1/test_organization_address_group_service.py index d5eb4ef89a86..15b1e9af7622 100644 --- a/packages/google-cloud-network-security/tests/unit/gapic/network_security_v1/test_organization_address_group_service.py +++ b/packages/google-cloud-network-security/tests/unit/gapic/network_security_v1/test_organization_address_group_service.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 @@ -122,6 +123,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" @@ -1459,8 +1475,8 @@ def test_organization_address_group_service_client_create_channel_credentials_fi @pytest.mark.parametrize( "request_type", [ - address_group.ListAddressGroupsRequest, - dict, + address_group.ListAddressGroupsRequest(), + {}, ], ) def test_list_address_groups(request_type, transport: str = "grpc"): @@ -1471,7 +1487,7 @@ def test_list_address_groups(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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 +1538,11 @@ def test_list_address_groups_non_empty_request_with_auto_populated_field(): client.list_address_groups(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == address_group.ListAddressGroupsRequest( + request_msg = address_group.ListAddressGroupsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_address_groups_use_cached_wrapped_rpc(): @@ -1610,9 +1627,14 @@ async def test_list_address_groups_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_address_groups_async( - transport: str = "grpc_asyncio", request_type=address_group.ListAddressGroupsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + address_group.ListAddressGroupsRequest(), + {}, + ], +) +async def test_list_address_groups_async(request_type, transport: str = "grpc_asyncio"): client = OrganizationAddressGroupServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1620,7 +1642,7 @@ async def test_list_address_groups_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( @@ -1647,11 +1669,6 @@ async def test_list_address_groups_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_address_groups_async_from_dict(): - await test_list_address_groups_async(request_type=dict) - - def test_list_address_groups_field_headers(): client = OrganizationAddressGroupServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2004,8 +2021,8 @@ async def test_list_address_groups_async_pages(): @pytest.mark.parametrize( "request_type", [ - address_group.GetAddressGroupRequest, - dict, + address_group.GetAddressGroupRequest(), + {}, ], ) def test_get_address_group(request_type, transport: str = "grpc"): @@ -2016,7 +2033,7 @@ def test_get_address_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2076,9 +2093,10 @@ def test_get_address_group_non_empty_request_with_auto_populated_field(): client.get_address_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == address_group.GetAddressGroupRequest( + request_msg = address_group.GetAddressGroupRequest( name="name_value", ) + assert args[0] == request_msg def test_get_address_group_use_cached_wrapped_rpc(): @@ -2161,9 +2179,14 @@ async def test_get_address_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_address_group_async( - transport: str = "grpc_asyncio", request_type=address_group.GetAddressGroupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + address_group.GetAddressGroupRequest(), + {}, + ], +) +async def test_get_address_group_async(request_type, transport: str = "grpc_asyncio"): client = OrganizationAddressGroupServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2171,7 +2194,7 @@ async def test_get_address_group_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( @@ -2208,11 +2231,6 @@ async def test_get_address_group_async( assert response.purpose == [address_group.AddressGroup.Purpose.DEFAULT] -@pytest.mark.asyncio -async def test_get_address_group_async_from_dict(): - await test_get_address_group_async(request_type=dict) - - def test_get_address_group_field_headers(): client = OrganizationAddressGroupServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2367,8 +2385,8 @@ async def test_get_address_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_address_group.CreateAddressGroupRequest, - dict, + gcn_address_group.CreateAddressGroupRequest(), + {}, ], ) def test_create_address_group(request_type, transport: str = "grpc"): @@ -2379,7 +2397,7 @@ def test_create_address_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2426,11 +2444,12 @@ def test_create_address_group_non_empty_request_with_auto_populated_field(): client.create_address_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_address_group.CreateAddressGroupRequest( + request_msg = gcn_address_group.CreateAddressGroupRequest( parent="parent_value", address_group_id="address_group_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_address_group_use_cached_wrapped_rpc(): @@ -2525,9 +2544,15 @@ async def test_create_address_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcn_address_group.CreateAddressGroupRequest(), + {}, + ], +) async def test_create_address_group_async( - transport: str = "grpc_asyncio", - request_type=gcn_address_group.CreateAddressGroupRequest, + request_type, transport: str = "grpc_asyncio" ): client = OrganizationAddressGroupServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2536,7 +2561,7 @@ async def test_create_address_group_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 +2583,6 @@ async def test_create_address_group_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_address_group_async_from_dict(): - await test_create_address_group_async(request_type=dict) - - def test_create_address_group_field_headers(): client = OrganizationAddressGroupServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2737,8 +2757,8 @@ async def test_create_address_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_address_group.UpdateAddressGroupRequest, - dict, + gcn_address_group.UpdateAddressGroupRequest(), + {}, ], ) def test_update_address_group(request_type, transport: str = "grpc"): @@ -2749,7 +2769,7 @@ def test_update_address_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2794,9 +2814,10 @@ def test_update_address_group_non_empty_request_with_auto_populated_field(): client.update_address_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_address_group.UpdateAddressGroupRequest( + request_msg = gcn_address_group.UpdateAddressGroupRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_address_group_use_cached_wrapped_rpc(): @@ -2891,9 +2912,15 @@ async def test_update_address_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcn_address_group.UpdateAddressGroupRequest(), + {}, + ], +) async def test_update_address_group_async( - transport: str = "grpc_asyncio", - request_type=gcn_address_group.UpdateAddressGroupRequest, + request_type, transport: str = "grpc_asyncio" ): client = OrganizationAddressGroupServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2902,7 +2929,7 @@ async def test_update_address_group_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( @@ -2924,11 +2951,6 @@ async def test_update_address_group_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_address_group_async_from_dict(): - await test_update_address_group_async(request_type=dict) - - def test_update_address_group_field_headers(): client = OrganizationAddressGroupServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3093,8 +3115,8 @@ async def test_update_address_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_address_group.AddAddressGroupItemsRequest, - dict, + gcn_address_group.AddAddressGroupItemsRequest(), + {}, ], ) def test_add_address_group_items(request_type, transport: str = "grpc"): @@ -3105,7 +3127,7 @@ def test_add_address_group_items(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3151,10 +3173,11 @@ def test_add_address_group_items_non_empty_request_with_auto_populated_field(): client.add_address_group_items(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_address_group.AddAddressGroupItemsRequest( + request_msg = gcn_address_group.AddAddressGroupItemsRequest( address_group="address_group_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_add_address_group_items_use_cached_wrapped_rpc(): @@ -3250,9 +3273,15 @@ async def test_add_address_group_items_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcn_address_group.AddAddressGroupItemsRequest(), + {}, + ], +) async def test_add_address_group_items_async( - transport: str = "grpc_asyncio", - request_type=gcn_address_group.AddAddressGroupItemsRequest, + request_type, transport: str = "grpc_asyncio" ): client = OrganizationAddressGroupServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3261,7 +3290,7 @@ async def test_add_address_group_items_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( @@ -3283,11 +3312,6 @@ async def test_add_address_group_items_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_add_address_group_items_async_from_dict(): - await test_add_address_group_items_async(request_type=dict) - - def test_add_address_group_items_field_headers(): client = OrganizationAddressGroupServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3452,8 +3476,8 @@ async def test_add_address_group_items_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_address_group.RemoveAddressGroupItemsRequest, - dict, + gcn_address_group.RemoveAddressGroupItemsRequest(), + {}, ], ) def test_remove_address_group_items(request_type, transport: str = "grpc"): @@ -3464,7 +3488,7 @@ def test_remove_address_group_items(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3510,10 +3534,11 @@ def test_remove_address_group_items_non_empty_request_with_auto_populated_field( client.remove_address_group_items(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_address_group.RemoveAddressGroupItemsRequest( + request_msg = gcn_address_group.RemoveAddressGroupItemsRequest( address_group="address_group_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_remove_address_group_items_use_cached_wrapped_rpc(): @@ -3609,9 +3634,15 @@ async def test_remove_address_group_items_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcn_address_group.RemoveAddressGroupItemsRequest(), + {}, + ], +) async def test_remove_address_group_items_async( - transport: str = "grpc_asyncio", - request_type=gcn_address_group.RemoveAddressGroupItemsRequest, + request_type, transport: str = "grpc_asyncio" ): client = OrganizationAddressGroupServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3620,7 +3651,7 @@ async def test_remove_address_group_items_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( @@ -3642,11 +3673,6 @@ async def test_remove_address_group_items_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_remove_address_group_items_async_from_dict(): - await test_remove_address_group_items_async(request_type=dict) - - def test_remove_address_group_items_field_headers(): client = OrganizationAddressGroupServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3811,8 +3837,8 @@ async def test_remove_address_group_items_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_address_group.CloneAddressGroupItemsRequest, - dict, + gcn_address_group.CloneAddressGroupItemsRequest(), + {}, ], ) def test_clone_address_group_items(request_type, transport: str = "grpc"): @@ -3823,7 +3849,7 @@ def test_clone_address_group_items(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3870,11 +3896,12 @@ def test_clone_address_group_items_non_empty_request_with_auto_populated_field() client.clone_address_group_items(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_address_group.CloneAddressGroupItemsRequest( + request_msg = gcn_address_group.CloneAddressGroupItemsRequest( address_group="address_group_value", source_address_group="source_address_group_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_clone_address_group_items_use_cached_wrapped_rpc(): @@ -3970,9 +3997,15 @@ async def test_clone_address_group_items_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcn_address_group.CloneAddressGroupItemsRequest(), + {}, + ], +) async def test_clone_address_group_items_async( - transport: str = "grpc_asyncio", - request_type=gcn_address_group.CloneAddressGroupItemsRequest, + request_type, transport: str = "grpc_asyncio" ): client = OrganizationAddressGroupServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3981,7 +4014,7 @@ async def test_clone_address_group_items_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( @@ -4003,11 +4036,6 @@ async def test_clone_address_group_items_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_clone_address_group_items_async_from_dict(): - await test_clone_address_group_items_async(request_type=dict) - - def test_clone_address_group_items_field_headers(): client = OrganizationAddressGroupServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4172,8 +4200,8 @@ async def test_clone_address_group_items_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - address_group.DeleteAddressGroupRequest, - dict, + address_group.DeleteAddressGroupRequest(), + {}, ], ) def test_delete_address_group(request_type, transport: str = "grpc"): @@ -4184,7 +4212,7 @@ def test_delete_address_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4230,10 +4258,11 @@ def test_delete_address_group_non_empty_request_with_auto_populated_field(): client.delete_address_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == address_group.DeleteAddressGroupRequest( + request_msg = address_group.DeleteAddressGroupRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_address_group_use_cached_wrapped_rpc(): @@ -4328,9 +4357,15 @@ async def test_delete_address_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + address_group.DeleteAddressGroupRequest(), + {}, + ], +) async def test_delete_address_group_async( - transport: str = "grpc_asyncio", - request_type=address_group.DeleteAddressGroupRequest, + request_type, transport: str = "grpc_asyncio" ): client = OrganizationAddressGroupServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4339,7 +4374,7 @@ async def test_delete_address_group_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( @@ -4361,11 +4396,6 @@ async def test_delete_address_group_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_address_group_async_from_dict(): - await test_delete_address_group_async(request_type=dict) - - def test_delete_address_group_field_headers(): client = OrganizationAddressGroupServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4520,8 +4550,8 @@ async def test_delete_address_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_address_group.ListAddressGroupReferencesRequest, - dict, + gcn_address_group.ListAddressGroupReferencesRequest(), + {}, ], ) def test_list_address_group_references(request_type, transport: str = "grpc"): @@ -4532,7 +4562,7 @@ def test_list_address_group_references(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4581,10 +4611,11 @@ def test_list_address_group_references_non_empty_request_with_auto_populated_fie client.list_address_group_references(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_address_group.ListAddressGroupReferencesRequest( + request_msg = gcn_address_group.ListAddressGroupReferencesRequest( address_group="address_group_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_address_group_references_use_cached_wrapped_rpc(): @@ -4670,9 +4701,15 @@ async def test_list_address_group_references_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcn_address_group.ListAddressGroupReferencesRequest(), + {}, + ], +) async def test_list_address_group_references_async( - transport: str = "grpc_asyncio", - request_type=gcn_address_group.ListAddressGroupReferencesRequest, + request_type, transport: str = "grpc_asyncio" ): client = OrganizationAddressGroupServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4681,7 +4718,7 @@ async def test_list_address_group_references_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( @@ -4706,11 +4743,6 @@ async def test_list_address_group_references_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_address_group_references_async_from_dict(): - await test_list_address_group_references_async(request_type=dict) - - def test_list_address_group_references_field_headers(): client = OrganizationAddressGroupServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7123,7 +7155,6 @@ def test_list_address_groups_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = address_group.ListAddressGroupsRequest() - assert args[0] == request_msg @@ -7146,7 +7177,6 @@ def test_get_address_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = address_group.GetAddressGroupRequest() - assert args[0] == request_msg @@ -7169,7 +7199,6 @@ def test_create_address_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_address_group.CreateAddressGroupRequest() - assert args[0] == request_msg @@ -7192,7 +7221,6 @@ def test_update_address_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_address_group.UpdateAddressGroupRequest() - assert args[0] == request_msg @@ -7215,7 +7243,6 @@ def test_add_address_group_items_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_address_group.AddAddressGroupItemsRequest() - assert args[0] == request_msg @@ -7238,7 +7265,6 @@ def test_remove_address_group_items_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_address_group.RemoveAddressGroupItemsRequest() - assert args[0] == request_msg @@ -7261,7 +7287,6 @@ def test_clone_address_group_items_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_address_group.CloneAddressGroupItemsRequest() - assert args[0] == request_msg @@ -7284,7 +7309,6 @@ def test_delete_address_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = address_group.DeleteAddressGroupRequest() - assert args[0] == request_msg @@ -7307,7 +7331,6 @@ def test_list_address_group_references_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_address_group.ListAddressGroupReferencesRequest() - assert args[0] == request_msg @@ -7351,7 +7374,6 @@ async def test_list_address_groups_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = address_group.ListAddressGroupsRequest() - assert args[0] == request_msg @@ -7386,7 +7408,6 @@ async def test_get_address_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = address_group.GetAddressGroupRequest() - assert args[0] == request_msg @@ -7413,7 +7434,6 @@ async def test_create_address_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_address_group.CreateAddressGroupRequest() - assert args[0] == request_msg @@ -7440,7 +7460,6 @@ async def test_update_address_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_address_group.UpdateAddressGroupRequest() - assert args[0] == request_msg @@ -7467,7 +7486,6 @@ async def test_add_address_group_items_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_address_group.AddAddressGroupItemsRequest() - assert args[0] == request_msg @@ -7494,7 +7512,6 @@ async def test_remove_address_group_items_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_address_group.RemoveAddressGroupItemsRequest() - assert args[0] == request_msg @@ -7521,7 +7538,6 @@ async def test_clone_address_group_items_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_address_group.CloneAddressGroupItemsRequest() - assert args[0] == request_msg @@ -7548,7 +7564,6 @@ async def test_delete_address_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = address_group.DeleteAddressGroupRequest() - assert args[0] == request_msg @@ -7577,7 +7592,6 @@ async def test_list_address_group_references_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_address_group.ListAddressGroupReferencesRequest() - assert args[0] == request_msg @@ -9572,7 +9586,6 @@ def test_list_address_groups_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = address_group.ListAddressGroupsRequest() - assert args[0] == request_msg @@ -9594,7 +9607,6 @@ def test_get_address_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = address_group.GetAddressGroupRequest() - assert args[0] == request_msg @@ -9616,7 +9628,6 @@ def test_create_address_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_address_group.CreateAddressGroupRequest() - assert args[0] == request_msg @@ -9638,7 +9649,6 @@ def test_update_address_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_address_group.UpdateAddressGroupRequest() - assert args[0] == request_msg @@ -9660,7 +9670,6 @@ def test_add_address_group_items_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_address_group.AddAddressGroupItemsRequest() - assert args[0] == request_msg @@ -9682,7 +9691,6 @@ def test_remove_address_group_items_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_address_group.RemoveAddressGroupItemsRequest() - assert args[0] == request_msg @@ -9704,7 +9712,6 @@ def test_clone_address_group_items_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_address_group.CloneAddressGroupItemsRequest() - assert args[0] == request_msg @@ -9726,7 +9733,6 @@ def test_delete_address_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = address_group.DeleteAddressGroupRequest() - assert args[0] == request_msg @@ -9748,7 +9754,6 @@ def test_list_address_group_references_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_address_group.ListAddressGroupReferencesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-network-security/tests/unit/gapic/network_security_v1/test_organization_security_profile_group_service.py b/packages/google-cloud-network-security/tests/unit/gapic/network_security_v1/test_organization_security_profile_group_service.py index c4710b76dd1f..3ecf09474077 100644 --- a/packages/google-cloud-network-security/tests/unit/gapic/network_security_v1/test_organization_security_profile_group_service.py +++ b/packages/google-cloud-network-security/tests/unit/gapic/network_security_v1/test_organization_security_profile_group_service.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 @@ -132,6 +133,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" @@ -1487,8 +1503,8 @@ def test_organization_security_profile_group_service_client_create_channel_crede @pytest.mark.parametrize( "request_type", [ - security_profile_group_service.ListSecurityProfileGroupsRequest, - dict, + security_profile_group_service.ListSecurityProfileGroupsRequest(), + {}, ], ) def test_list_security_profile_groups(request_type, transport: str = "grpc"): @@ -1499,7 +1515,7 @@ def test_list_security_profile_groups(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1550,12 +1566,11 @@ def test_list_security_profile_groups_non_empty_request_with_auto_populated_fiel client.list_security_profile_groups(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == security_profile_group_service.ListSecurityProfileGroupsRequest( + request_msg = security_profile_group_service.ListSecurityProfileGroupsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_security_profile_groups_use_cached_wrapped_rpc(): @@ -1641,9 +1656,15 @@ async def test_list_security_profile_groups_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + security_profile_group_service.ListSecurityProfileGroupsRequest(), + {}, + ], +) async def test_list_security_profile_groups_async( - transport: str = "grpc_asyncio", - request_type=security_profile_group_service.ListSecurityProfileGroupsRequest, + request_type, transport: str = "grpc_asyncio" ): client = OrganizationSecurityProfileGroupServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1652,7 +1673,7 @@ async def test_list_security_profile_groups_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( @@ -1677,11 +1698,6 @@ async def test_list_security_profile_groups_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_security_profile_groups_async_from_dict(): - await test_list_security_profile_groups_async(request_type=dict) - - def test_list_security_profile_groups_field_headers(): client = OrganizationSecurityProfileGroupServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2049,8 +2065,8 @@ async def test_list_security_profile_groups_async_pages(): @pytest.mark.parametrize( "request_type", [ - security_profile_group_service.GetSecurityProfileGroupRequest, - dict, + security_profile_group_service.GetSecurityProfileGroupRequest(), + {}, ], ) def test_get_security_profile_group(request_type, transport: str = "grpc"): @@ -2061,7 +2077,7 @@ def test_get_security_profile_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2123,9 +2139,10 @@ def test_get_security_profile_group_non_empty_request_with_auto_populated_field( client.get_security_profile_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == security_profile_group_service.GetSecurityProfileGroupRequest( + request_msg = security_profile_group_service.GetSecurityProfileGroupRequest( name="name_value", ) + assert args[0] == request_msg def test_get_security_profile_group_use_cached_wrapped_rpc(): @@ -2211,9 +2228,15 @@ async def test_get_security_profile_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + security_profile_group_service.GetSecurityProfileGroupRequest(), + {}, + ], +) async def test_get_security_profile_group_async( - transport: str = "grpc_asyncio", - request_type=security_profile_group_service.GetSecurityProfileGroupRequest, + request_type, transport: str = "grpc_asyncio" ): client = OrganizationSecurityProfileGroupServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2222,7 +2245,7 @@ async def test_get_security_profile_group_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( @@ -2261,11 +2284,6 @@ async def test_get_security_profile_group_async( assert response.url_filtering_profile == "url_filtering_profile_value" -@pytest.mark.asyncio -async def test_get_security_profile_group_async_from_dict(): - await test_get_security_profile_group_async(request_type=dict) - - def test_get_security_profile_group_field_headers(): client = OrganizationSecurityProfileGroupServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2420,8 +2438,8 @@ async def test_get_security_profile_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - security_profile_group_service.CreateSecurityProfileGroupRequest, - dict, + security_profile_group_service.CreateSecurityProfileGroupRequest(), + {}, ], ) def test_create_security_profile_group(request_type, transport: str = "grpc"): @@ -2432,7 +2450,7 @@ def test_create_security_profile_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2478,12 +2496,11 @@ def test_create_security_profile_group_non_empty_request_with_auto_populated_fie client.create_security_profile_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == security_profile_group_service.CreateSecurityProfileGroupRequest( + request_msg = security_profile_group_service.CreateSecurityProfileGroupRequest( parent="parent_value", security_profile_group_id="security_profile_group_id_value", ) + assert args[0] == request_msg def test_create_security_profile_group_use_cached_wrapped_rpc(): @@ -2579,9 +2596,15 @@ async def test_create_security_profile_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + security_profile_group_service.CreateSecurityProfileGroupRequest(), + {}, + ], +) async def test_create_security_profile_group_async( - transport: str = "grpc_asyncio", - request_type=security_profile_group_service.CreateSecurityProfileGroupRequest, + request_type, transport: str = "grpc_asyncio" ): client = OrganizationSecurityProfileGroupServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2590,7 +2613,7 @@ async def test_create_security_profile_group_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( @@ -2612,11 +2635,6 @@ async def test_create_security_profile_group_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_security_profile_group_async_from_dict(): - await test_create_security_profile_group_async(request_type=dict) - - def test_create_security_profile_group_field_headers(): client = OrganizationSecurityProfileGroupServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2799,8 +2817,8 @@ async def test_create_security_profile_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - security_profile_group_service.UpdateSecurityProfileGroupRequest, - dict, + security_profile_group_service.UpdateSecurityProfileGroupRequest(), + {}, ], ) def test_update_security_profile_group(request_type, transport: str = "grpc"): @@ -2811,7 +2829,7 @@ def test_update_security_profile_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2854,10 +2872,8 @@ def test_update_security_profile_group_non_empty_request_with_auto_populated_fie client.update_security_profile_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert ( - args[0] - == security_profile_group_service.UpdateSecurityProfileGroupRequest() - ) + request_msg = security_profile_group_service.UpdateSecurityProfileGroupRequest() + assert args[0] == request_msg def test_update_security_profile_group_use_cached_wrapped_rpc(): @@ -2953,9 +2969,15 @@ async def test_update_security_profile_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + security_profile_group_service.UpdateSecurityProfileGroupRequest(), + {}, + ], +) async def test_update_security_profile_group_async( - transport: str = "grpc_asyncio", - request_type=security_profile_group_service.UpdateSecurityProfileGroupRequest, + request_type, transport: str = "grpc_asyncio" ): client = OrganizationSecurityProfileGroupServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2964,7 +2986,7 @@ async def test_update_security_profile_group_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( @@ -2986,11 +3008,6 @@ async def test_update_security_profile_group_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_security_profile_group_async_from_dict(): - await test_update_security_profile_group_async(request_type=dict) - - def test_update_security_profile_group_field_headers(): client = OrganizationSecurityProfileGroupServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3163,8 +3180,8 @@ async def test_update_security_profile_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - security_profile_group_service.DeleteSecurityProfileGroupRequest, - dict, + security_profile_group_service.DeleteSecurityProfileGroupRequest(), + {}, ], ) def test_delete_security_profile_group(request_type, transport: str = "grpc"): @@ -3175,7 +3192,7 @@ def test_delete_security_profile_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3221,12 +3238,11 @@ def test_delete_security_profile_group_non_empty_request_with_auto_populated_fie client.delete_security_profile_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == security_profile_group_service.DeleteSecurityProfileGroupRequest( + request_msg = security_profile_group_service.DeleteSecurityProfileGroupRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_security_profile_group_use_cached_wrapped_rpc(): @@ -3322,9 +3338,15 @@ async def test_delete_security_profile_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + security_profile_group_service.DeleteSecurityProfileGroupRequest(), + {}, + ], +) async def test_delete_security_profile_group_async( - transport: str = "grpc_asyncio", - request_type=security_profile_group_service.DeleteSecurityProfileGroupRequest, + request_type, transport: str = "grpc_asyncio" ): client = OrganizationSecurityProfileGroupServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3333,7 +3355,7 @@ async def test_delete_security_profile_group_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( @@ -3355,11 +3377,6 @@ async def test_delete_security_profile_group_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_security_profile_group_async_from_dict(): - await test_delete_security_profile_group_async(request_type=dict) - - def test_delete_security_profile_group_field_headers(): client = OrganizationSecurityProfileGroupServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3514,8 +3531,8 @@ async def test_delete_security_profile_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - security_profile_group_service.ListSecurityProfilesRequest, - dict, + security_profile_group_service.ListSecurityProfilesRequest(), + {}, ], ) def test_list_security_profiles(request_type, transport: str = "grpc"): @@ -3526,7 +3543,7 @@ def test_list_security_profiles(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3575,10 +3592,11 @@ def test_list_security_profiles_non_empty_request_with_auto_populated_field(): client.list_security_profiles(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == security_profile_group_service.ListSecurityProfilesRequest( + request_msg = security_profile_group_service.ListSecurityProfilesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_security_profiles_use_cached_wrapped_rpc(): @@ -3664,9 +3682,15 @@ async def test_list_security_profiles_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + security_profile_group_service.ListSecurityProfilesRequest(), + {}, + ], +) async def test_list_security_profiles_async( - transport: str = "grpc_asyncio", - request_type=security_profile_group_service.ListSecurityProfilesRequest, + request_type, transport: str = "grpc_asyncio" ): client = OrganizationSecurityProfileGroupServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3675,7 +3699,7 @@ async def test_list_security_profiles_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( @@ -3700,11 +3724,6 @@ async def test_list_security_profiles_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_security_profiles_async_from_dict(): - await test_list_security_profiles_async(request_type=dict) - - def test_list_security_profiles_field_headers(): client = OrganizationSecurityProfileGroupServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4067,8 +4086,8 @@ async def test_list_security_profiles_async_pages(): @pytest.mark.parametrize( "request_type", [ - security_profile_group_service.GetSecurityProfileRequest, - dict, + security_profile_group_service.GetSecurityProfileRequest(), + {}, ], ) def test_get_security_profile(request_type, transport: str = "grpc"): @@ -4079,7 +4098,7 @@ def test_get_security_profile(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4136,9 +4155,10 @@ def test_get_security_profile_non_empty_request_with_auto_populated_field(): client.get_security_profile(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == security_profile_group_service.GetSecurityProfileRequest( + request_msg = security_profile_group_service.GetSecurityProfileRequest( name="name_value", ) + assert args[0] == request_msg def test_get_security_profile_use_cached_wrapped_rpc(): @@ -4223,9 +4243,15 @@ async def test_get_security_profile_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + security_profile_group_service.GetSecurityProfileRequest(), + {}, + ], +) async def test_get_security_profile_async( - transport: str = "grpc_asyncio", - request_type=security_profile_group_service.GetSecurityProfileRequest, + request_type, transport: str = "grpc_asyncio" ): client = OrganizationSecurityProfileGroupServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4234,7 +4260,7 @@ async def test_get_security_profile_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( @@ -4268,11 +4294,6 @@ async def test_get_security_profile_async( ) -@pytest.mark.asyncio -async def test_get_security_profile_async_from_dict(): - await test_get_security_profile_async(request_type=dict) - - def test_get_security_profile_field_headers(): client = OrganizationSecurityProfileGroupServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4427,8 +4448,8 @@ async def test_get_security_profile_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - security_profile_group_service.CreateSecurityProfileRequest, - dict, + security_profile_group_service.CreateSecurityProfileRequest(), + {}, ], ) def test_create_security_profile(request_type, transport: str = "grpc"): @@ -4439,7 +4460,7 @@ def test_create_security_profile(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4485,10 +4506,11 @@ def test_create_security_profile_non_empty_request_with_auto_populated_field(): client.create_security_profile(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == security_profile_group_service.CreateSecurityProfileRequest( + request_msg = security_profile_group_service.CreateSecurityProfileRequest( parent="parent_value", security_profile_id="security_profile_id_value", ) + assert args[0] == request_msg def test_create_security_profile_use_cached_wrapped_rpc(): @@ -4584,9 +4606,15 @@ async def test_create_security_profile_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + security_profile_group_service.CreateSecurityProfileRequest(), + {}, + ], +) async def test_create_security_profile_async( - transport: str = "grpc_asyncio", - request_type=security_profile_group_service.CreateSecurityProfileRequest, + request_type, transport: str = "grpc_asyncio" ): client = OrganizationSecurityProfileGroupServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4595,7 +4623,7 @@ async def test_create_security_profile_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( @@ -4617,11 +4645,6 @@ async def test_create_security_profile_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_security_profile_async_from_dict(): - await test_create_security_profile_async(request_type=dict) - - def test_create_security_profile_field_headers(): client = OrganizationSecurityProfileGroupServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4844,8 +4867,8 @@ async def test_create_security_profile_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - security_profile_group_service.UpdateSecurityProfileRequest, - dict, + security_profile_group_service.UpdateSecurityProfileRequest(), + {}, ], ) def test_update_security_profile(request_type, transport: str = "grpc"): @@ -4856,7 +4879,7 @@ def test_update_security_profile(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4899,7 +4922,8 @@ def test_update_security_profile_non_empty_request_with_auto_populated_field(): client.update_security_profile(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == security_profile_group_service.UpdateSecurityProfileRequest() + request_msg = security_profile_group_service.UpdateSecurityProfileRequest() + assert args[0] == request_msg def test_update_security_profile_use_cached_wrapped_rpc(): @@ -4995,9 +5019,15 @@ async def test_update_security_profile_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + security_profile_group_service.UpdateSecurityProfileRequest(), + {}, + ], +) async def test_update_security_profile_async( - transport: str = "grpc_asyncio", - request_type=security_profile_group_service.UpdateSecurityProfileRequest, + request_type, transport: str = "grpc_asyncio" ): client = OrganizationSecurityProfileGroupServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5006,7 +5036,7 @@ async def test_update_security_profile_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( @@ -5028,11 +5058,6 @@ async def test_update_security_profile_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_security_profile_async_from_dict(): - await test_update_security_profile_async(request_type=dict) - - def test_update_security_profile_field_headers(): client = OrganizationSecurityProfileGroupServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5245,8 +5270,8 @@ async def test_update_security_profile_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - security_profile_group_service.DeleteSecurityProfileRequest, - dict, + security_profile_group_service.DeleteSecurityProfileRequest(), + {}, ], ) def test_delete_security_profile(request_type, transport: str = "grpc"): @@ -5257,7 +5282,7 @@ def test_delete_security_profile(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5303,10 +5328,11 @@ def test_delete_security_profile_non_empty_request_with_auto_populated_field(): client.delete_security_profile(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == security_profile_group_service.DeleteSecurityProfileRequest( + request_msg = security_profile_group_service.DeleteSecurityProfileRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_security_profile_use_cached_wrapped_rpc(): @@ -5402,9 +5428,15 @@ async def test_delete_security_profile_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + security_profile_group_service.DeleteSecurityProfileRequest(), + {}, + ], +) async def test_delete_security_profile_async( - transport: str = "grpc_asyncio", - request_type=security_profile_group_service.DeleteSecurityProfileRequest, + request_type, transport: str = "grpc_asyncio" ): client = OrganizationSecurityProfileGroupServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5413,7 +5445,7 @@ async def test_delete_security_profile_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( @@ -5435,11 +5467,6 @@ async def test_delete_security_profile_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_security_profile_async_from_dict(): - await test_delete_security_profile_async(request_type=dict) - - def test_delete_security_profile_field_headers(): client = OrganizationSecurityProfileGroupServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7864,7 +7891,6 @@ def test_list_security_profile_groups_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_profile_group_service.ListSecurityProfileGroupsRequest() - assert args[0] == request_msg @@ -7887,7 +7913,6 @@ def test_get_security_profile_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_profile_group_service.GetSecurityProfileGroupRequest() - assert args[0] == request_msg @@ -7910,7 +7935,6 @@ def test_create_security_profile_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_profile_group_service.CreateSecurityProfileGroupRequest() - assert args[0] == request_msg @@ -7933,7 +7957,6 @@ def test_update_security_profile_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_profile_group_service.UpdateSecurityProfileGroupRequest() - assert args[0] == request_msg @@ -7956,7 +7979,6 @@ def test_delete_security_profile_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_profile_group_service.DeleteSecurityProfileGroupRequest() - assert args[0] == request_msg @@ -7981,7 +8003,6 @@ def test_list_security_profiles_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_profile_group_service.ListSecurityProfilesRequest() - assert args[0] == request_msg @@ -8004,7 +8025,6 @@ def test_get_security_profile_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_profile_group_service.GetSecurityProfileRequest() - assert args[0] == request_msg @@ -8027,7 +8047,6 @@ def test_create_security_profile_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_profile_group_service.CreateSecurityProfileRequest() - assert args[0] == request_msg @@ -8050,7 +8069,6 @@ def test_update_security_profile_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_profile_group_service.UpdateSecurityProfileRequest() - assert args[0] == request_msg @@ -8073,7 +8091,6 @@ def test_delete_security_profile_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_profile_group_service.DeleteSecurityProfileRequest() - assert args[0] == request_msg @@ -8116,7 +8133,6 @@ async def test_list_security_profile_groups_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_profile_group_service.ListSecurityProfileGroupsRequest() - assert args[0] == request_msg @@ -8152,7 +8168,6 @@ async def test_get_security_profile_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_profile_group_service.GetSecurityProfileGroupRequest() - assert args[0] == request_msg @@ -8179,7 +8194,6 @@ async def test_create_security_profile_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_profile_group_service.CreateSecurityProfileGroupRequest() - assert args[0] == request_msg @@ -8206,7 +8220,6 @@ async def test_update_security_profile_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_profile_group_service.UpdateSecurityProfileGroupRequest() - assert args[0] == request_msg @@ -8233,7 +8246,6 @@ async def test_delete_security_profile_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_profile_group_service.DeleteSecurityProfileGroupRequest() - assert args[0] == request_msg @@ -8262,7 +8274,6 @@ async def test_list_security_profiles_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_profile_group_service.ListSecurityProfilesRequest() - assert args[0] == request_msg @@ -8294,7 +8305,6 @@ async def test_get_security_profile_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_profile_group_service.GetSecurityProfileRequest() - assert args[0] == request_msg @@ -8321,7 +8331,6 @@ async def test_create_security_profile_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_profile_group_service.CreateSecurityProfileRequest() - assert args[0] == request_msg @@ -8348,7 +8357,6 @@ async def test_update_security_profile_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_profile_group_service.UpdateSecurityProfileRequest() - assert args[0] == request_msg @@ -8375,7 +8383,6 @@ async def test_delete_security_profile_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_profile_group_service.DeleteSecurityProfileRequest() - assert args[0] == request_msg @@ -10754,7 +10761,6 @@ def test_list_security_profile_groups_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_profile_group_service.ListSecurityProfileGroupsRequest() - assert args[0] == request_msg @@ -10776,7 +10782,6 @@ def test_get_security_profile_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_profile_group_service.GetSecurityProfileGroupRequest() - assert args[0] == request_msg @@ -10798,7 +10803,6 @@ def test_create_security_profile_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_profile_group_service.CreateSecurityProfileGroupRequest() - assert args[0] == request_msg @@ -10820,7 +10824,6 @@ def test_update_security_profile_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_profile_group_service.UpdateSecurityProfileGroupRequest() - assert args[0] == request_msg @@ -10842,7 +10845,6 @@ def test_delete_security_profile_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_profile_group_service.DeleteSecurityProfileGroupRequest() - assert args[0] == request_msg @@ -10864,7 +10866,6 @@ def test_list_security_profiles_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_profile_group_service.ListSecurityProfilesRequest() - assert args[0] == request_msg @@ -10886,7 +10887,6 @@ def test_get_security_profile_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_profile_group_service.GetSecurityProfileRequest() - assert args[0] == request_msg @@ -10908,7 +10908,6 @@ def test_create_security_profile_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_profile_group_service.CreateSecurityProfileRequest() - assert args[0] == request_msg @@ -10930,7 +10929,6 @@ def test_update_security_profile_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_profile_group_service.UpdateSecurityProfileRequest() - assert args[0] == request_msg @@ -10952,7 +10950,6 @@ def test_delete_security_profile_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_profile_group_service.DeleteSecurityProfileRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-network-security/tests/unit/gapic/network_security_v1alpha1/test_dns_threat_detector_service.py b/packages/google-cloud-network-security/tests/unit/gapic/network_security_v1alpha1/test_dns_threat_detector_service.py index da85186984f9..41d5b28acb7d 100644 --- a/packages/google-cloud-network-security/tests/unit/gapic/network_security_v1alpha1/test_dns_threat_detector_service.py +++ b/packages/google-cloud-network-security/tests/unit/gapic/network_security_v1alpha1/test_dns_threat_detector_service.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 @@ -119,6 +120,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" @@ -1394,8 +1410,8 @@ def test_dns_threat_detector_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - dns_threat_detector.ListDnsThreatDetectorsRequest, - dict, + dns_threat_detector.ListDnsThreatDetectorsRequest(), + {}, ], ) def test_list_dns_threat_detectors(request_type, transport: str = "grpc"): @@ -1406,7 +1422,7 @@ def test_list_dns_threat_detectors(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1457,10 +1473,11 @@ def test_list_dns_threat_detectors_non_empty_request_with_auto_populated_field() client.list_dns_threat_detectors(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dns_threat_detector.ListDnsThreatDetectorsRequest( + request_msg = dns_threat_detector.ListDnsThreatDetectorsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_dns_threat_detectors_use_cached_wrapped_rpc(): @@ -1546,9 +1563,15 @@ async def test_list_dns_threat_detectors_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dns_threat_detector.ListDnsThreatDetectorsRequest(), + {}, + ], +) async def test_list_dns_threat_detectors_async( - transport: str = "grpc_asyncio", - request_type=dns_threat_detector.ListDnsThreatDetectorsRequest, + request_type, transport: str = "grpc_asyncio" ): client = DnsThreatDetectorServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1557,7 +1580,7 @@ async def test_list_dns_threat_detectors_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( @@ -1584,11 +1607,6 @@ async def test_list_dns_threat_detectors_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_dns_threat_detectors_async_from_dict(): - await test_list_dns_threat_detectors_async(request_type=dict) - - def test_list_dns_threat_detectors_field_headers(): client = DnsThreatDetectorServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1947,8 +1965,8 @@ async def test_list_dns_threat_detectors_async_pages(): @pytest.mark.parametrize( "request_type", [ - dns_threat_detector.GetDnsThreatDetectorRequest, - dict, + dns_threat_detector.GetDnsThreatDetectorRequest(), + {}, ], ) def test_get_dns_threat_detector(request_type, transport: str = "grpc"): @@ -1959,7 +1977,7 @@ def test_get_dns_threat_detector(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2011,9 +2029,10 @@ def test_get_dns_threat_detector_non_empty_request_with_auto_populated_field(): client.get_dns_threat_detector(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dns_threat_detector.GetDnsThreatDetectorRequest( + request_msg = dns_threat_detector.GetDnsThreatDetectorRequest( name="name_value", ) + assert args[0] == request_msg def test_get_dns_threat_detector_use_cached_wrapped_rpc(): @@ -2099,9 +2118,15 @@ async def test_get_dns_threat_detector_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dns_threat_detector.GetDnsThreatDetectorRequest(), + {}, + ], +) async def test_get_dns_threat_detector_async( - transport: str = "grpc_asyncio", - request_type=dns_threat_detector.GetDnsThreatDetectorRequest, + request_type, transport: str = "grpc_asyncio" ): client = DnsThreatDetectorServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2110,7 +2135,7 @@ async def test_get_dns_threat_detector_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( @@ -2139,11 +2164,6 @@ async def test_get_dns_threat_detector_async( assert response.provider == dns_threat_detector.DnsThreatDetector.Provider.INFOBLOX -@pytest.mark.asyncio -async def test_get_dns_threat_detector_async_from_dict(): - await test_get_dns_threat_detector_async(request_type=dict) - - def test_get_dns_threat_detector_field_headers(): client = DnsThreatDetectorServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2298,8 +2318,8 @@ async def test_get_dns_threat_detector_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_dns_threat_detector.CreateDnsThreatDetectorRequest, - dict, + gcn_dns_threat_detector.CreateDnsThreatDetectorRequest(), + {}, ], ) def test_create_dns_threat_detector(request_type, transport: str = "grpc"): @@ -2310,7 +2330,7 @@ def test_create_dns_threat_detector(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2365,10 +2385,11 @@ def test_create_dns_threat_detector_non_empty_request_with_auto_populated_field( client.create_dns_threat_detector(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_dns_threat_detector.CreateDnsThreatDetectorRequest( + request_msg = gcn_dns_threat_detector.CreateDnsThreatDetectorRequest( parent="parent_value", dns_threat_detector_id="dns_threat_detector_id_value", ) + assert args[0] == request_msg def test_create_dns_threat_detector_use_cached_wrapped_rpc(): @@ -2454,9 +2475,15 @@ async def test_create_dns_threat_detector_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcn_dns_threat_detector.CreateDnsThreatDetectorRequest(), + {}, + ], +) async def test_create_dns_threat_detector_async( - transport: str = "grpc_asyncio", - request_type=gcn_dns_threat_detector.CreateDnsThreatDetectorRequest, + request_type, transport: str = "grpc_asyncio" ): client = DnsThreatDetectorServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2465,7 +2492,7 @@ async def test_create_dns_threat_detector_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( @@ -2496,11 +2523,6 @@ async def test_create_dns_threat_detector_async( ) -@pytest.mark.asyncio -async def test_create_dns_threat_detector_async_from_dict(): - await test_create_dns_threat_detector_async(request_type=dict) - - def test_create_dns_threat_detector_field_headers(): client = DnsThreatDetectorServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2683,8 +2705,8 @@ async def test_create_dns_threat_detector_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_dns_threat_detector.UpdateDnsThreatDetectorRequest, - dict, + gcn_dns_threat_detector.UpdateDnsThreatDetectorRequest(), + {}, ], ) def test_update_dns_threat_detector(request_type, transport: str = "grpc"): @@ -2695,7 +2717,7 @@ def test_update_dns_threat_detector(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2747,7 +2769,8 @@ def test_update_dns_threat_detector_non_empty_request_with_auto_populated_field( client.update_dns_threat_detector(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_dns_threat_detector.UpdateDnsThreatDetectorRequest() + request_msg = gcn_dns_threat_detector.UpdateDnsThreatDetectorRequest() + assert args[0] == request_msg def test_update_dns_threat_detector_use_cached_wrapped_rpc(): @@ -2833,9 +2856,15 @@ async def test_update_dns_threat_detector_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcn_dns_threat_detector.UpdateDnsThreatDetectorRequest(), + {}, + ], +) async def test_update_dns_threat_detector_async( - transport: str = "grpc_asyncio", - request_type=gcn_dns_threat_detector.UpdateDnsThreatDetectorRequest, + request_type, transport: str = "grpc_asyncio" ): client = DnsThreatDetectorServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2844,7 +2873,7 @@ async def test_update_dns_threat_detector_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( @@ -2875,11 +2904,6 @@ async def test_update_dns_threat_detector_async( ) -@pytest.mark.asyncio -async def test_update_dns_threat_detector_async_from_dict(): - await test_update_dns_threat_detector_async(request_type=dict) - - def test_update_dns_threat_detector_field_headers(): client = DnsThreatDetectorServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3052,8 +3076,8 @@ async def test_update_dns_threat_detector_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dns_threat_detector.DeleteDnsThreatDetectorRequest, - dict, + dns_threat_detector.DeleteDnsThreatDetectorRequest(), + {}, ], ) def test_delete_dns_threat_detector(request_type, transport: str = "grpc"): @@ -3064,7 +3088,7 @@ def test_delete_dns_threat_detector(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3109,9 +3133,10 @@ def test_delete_dns_threat_detector_non_empty_request_with_auto_populated_field( client.delete_dns_threat_detector(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dns_threat_detector.DeleteDnsThreatDetectorRequest( + request_msg = dns_threat_detector.DeleteDnsThreatDetectorRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_dns_threat_detector_use_cached_wrapped_rpc(): @@ -3197,9 +3222,15 @@ async def test_delete_dns_threat_detector_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dns_threat_detector.DeleteDnsThreatDetectorRequest(), + {}, + ], +) async def test_delete_dns_threat_detector_async( - transport: str = "grpc_asyncio", - request_type=dns_threat_detector.DeleteDnsThreatDetectorRequest, + request_type, transport: str = "grpc_asyncio" ): client = DnsThreatDetectorServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3208,7 +3239,7 @@ async def test_delete_dns_threat_detector_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( @@ -3228,11 +3259,6 @@ async def test_delete_dns_threat_detector_async( assert response is None -@pytest.mark.asyncio -async def test_delete_dns_threat_detector_async_from_dict(): - await test_delete_dns_threat_detector_async(request_type=dict) - - def test_delete_dns_threat_detector_field_headers(): client = DnsThreatDetectorServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4531,7 +4557,6 @@ def test_list_dns_threat_detectors_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dns_threat_detector.ListDnsThreatDetectorsRequest() - assert args[0] == request_msg @@ -4554,7 +4579,6 @@ def test_get_dns_threat_detector_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dns_threat_detector.GetDnsThreatDetectorRequest() - assert args[0] == request_msg @@ -4577,7 +4601,6 @@ def test_create_dns_threat_detector_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_dns_threat_detector.CreateDnsThreatDetectorRequest() - assert args[0] == request_msg @@ -4600,7 +4623,6 @@ def test_update_dns_threat_detector_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_dns_threat_detector.UpdateDnsThreatDetectorRequest() - assert args[0] == request_msg @@ -4623,7 +4645,6 @@ def test_delete_dns_threat_detector_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dns_threat_detector.DeleteDnsThreatDetectorRequest() - assert args[0] == request_msg @@ -4667,7 +4688,6 @@ async def test_list_dns_threat_detectors_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dns_threat_detector.ListDnsThreatDetectorsRequest() - assert args[0] == request_msg @@ -4698,7 +4718,6 @@ async def test_get_dns_threat_detector_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dns_threat_detector.GetDnsThreatDetectorRequest() - assert args[0] == request_msg @@ -4729,7 +4748,6 @@ async def test_create_dns_threat_detector_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_dns_threat_detector.CreateDnsThreatDetectorRequest() - assert args[0] == request_msg @@ -4760,7 +4778,6 @@ async def test_update_dns_threat_detector_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_dns_threat_detector.UpdateDnsThreatDetectorRequest() - assert args[0] == request_msg @@ -4785,7 +4802,6 @@ async def test_delete_dns_threat_detector_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dns_threat_detector.DeleteDnsThreatDetectorRequest() - assert args[0] == request_msg @@ -6252,7 +6268,6 @@ def test_list_dns_threat_detectors_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dns_threat_detector.ListDnsThreatDetectorsRequest() - assert args[0] == request_msg @@ -6274,7 +6289,6 @@ def test_get_dns_threat_detector_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dns_threat_detector.GetDnsThreatDetectorRequest() - assert args[0] == request_msg @@ -6296,7 +6310,6 @@ def test_create_dns_threat_detector_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_dns_threat_detector.CreateDnsThreatDetectorRequest() - assert args[0] == request_msg @@ -6318,7 +6331,6 @@ def test_update_dns_threat_detector_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_dns_threat_detector.UpdateDnsThreatDetectorRequest() - assert args[0] == request_msg @@ -6340,7 +6352,6 @@ def test_delete_dns_threat_detector_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dns_threat_detector.DeleteDnsThreatDetectorRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-network-security/tests/unit/gapic/network_security_v1alpha1/test_firewall_activation.py b/packages/google-cloud-network-security/tests/unit/gapic/network_security_v1alpha1/test_firewall_activation.py index eb7636323304..519217c695e4 100644 --- a/packages/google-cloud-network-security/tests/unit/gapic/network_security_v1alpha1/test_firewall_activation.py +++ b/packages/google-cloud-network-security/tests/unit/gapic/network_security_v1alpha1/test_firewall_activation.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 @@ -121,6 +122,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" @@ -1366,8 +1382,8 @@ def test_firewall_activation_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - firewall_activation.ListFirewallEndpointsRequest, - dict, + firewall_activation.ListFirewallEndpointsRequest(), + {}, ], ) def test_list_firewall_endpoints(request_type, transport: str = "grpc"): @@ -1378,7 +1394,7 @@ def test_list_firewall_endpoints(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1431,12 +1447,13 @@ def test_list_firewall_endpoints_non_empty_request_with_auto_populated_field(): client.list_firewall_endpoints(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == firewall_activation.ListFirewallEndpointsRequest( + request_msg = firewall_activation.ListFirewallEndpointsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_firewall_endpoints_use_cached_wrapped_rpc(): @@ -1522,9 +1539,15 @@ async def test_list_firewall_endpoints_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + firewall_activation.ListFirewallEndpointsRequest(), + {}, + ], +) async def test_list_firewall_endpoints_async( - transport: str = "grpc_asyncio", - request_type=firewall_activation.ListFirewallEndpointsRequest, + request_type, transport: str = "grpc_asyncio" ): client = FirewallActivationAsyncClient( credentials=async_anonymous_credentials(), @@ -1533,7 +1556,7 @@ async def test_list_firewall_endpoints_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( @@ -1560,11 +1583,6 @@ async def test_list_firewall_endpoints_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_firewall_endpoints_async_from_dict(): - await test_list_firewall_endpoints_async(request_type=dict) - - def test_list_firewall_endpoints_field_headers(): client = FirewallActivationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1919,8 +1937,8 @@ async def test_list_firewall_endpoints_async_pages(): @pytest.mark.parametrize( "request_type", [ - firewall_activation.GetFirewallEndpointRequest, - dict, + firewall_activation.GetFirewallEndpointRequest(), + {}, ], ) def test_get_firewall_endpoint(request_type, transport: str = "grpc"): @@ -1931,7 +1949,7 @@ def test_get_firewall_endpoint(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1993,9 +2011,10 @@ def test_get_firewall_endpoint_non_empty_request_with_auto_populated_field(): client.get_firewall_endpoint(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == firewall_activation.GetFirewallEndpointRequest( + request_msg = firewall_activation.GetFirewallEndpointRequest( name="name_value", ) + assert args[0] == request_msg def test_get_firewall_endpoint_use_cached_wrapped_rpc(): @@ -2081,9 +2100,15 @@ async def test_get_firewall_endpoint_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + firewall_activation.GetFirewallEndpointRequest(), + {}, + ], +) async def test_get_firewall_endpoint_async( - transport: str = "grpc_asyncio", - request_type=firewall_activation.GetFirewallEndpointRequest, + request_type, transport: str = "grpc_asyncio" ): client = FirewallActivationAsyncClient( credentials=async_anonymous_credentials(), @@ -2092,7 +2117,7 @@ async def test_get_firewall_endpoint_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( @@ -2131,11 +2156,6 @@ async def test_get_firewall_endpoint_async( assert response.billing_project_id == "billing_project_id_value" -@pytest.mark.asyncio -async def test_get_firewall_endpoint_async_from_dict(): - await test_get_firewall_endpoint_async(request_type=dict) - - def test_get_firewall_endpoint_field_headers(): client = FirewallActivationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2290,8 +2310,8 @@ async def test_get_firewall_endpoint_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - firewall_activation.CreateFirewallEndpointRequest, - dict, + firewall_activation.CreateFirewallEndpointRequest(), + {}, ], ) def test_create_firewall_endpoint(request_type, transport: str = "grpc"): @@ -2302,7 +2322,7 @@ def test_create_firewall_endpoint(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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 +2369,12 @@ def test_create_firewall_endpoint_non_empty_request_with_auto_populated_field(): client.create_firewall_endpoint(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == firewall_activation.CreateFirewallEndpointRequest( + request_msg = firewall_activation.CreateFirewallEndpointRequest( parent="parent_value", firewall_endpoint_id="firewall_endpoint_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_firewall_endpoint_use_cached_wrapped_rpc(): @@ -2449,9 +2470,15 @@ async def test_create_firewall_endpoint_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + firewall_activation.CreateFirewallEndpointRequest(), + {}, + ], +) async def test_create_firewall_endpoint_async( - transport: str = "grpc_asyncio", - request_type=firewall_activation.CreateFirewallEndpointRequest, + request_type, transport: str = "grpc_asyncio" ): client = FirewallActivationAsyncClient( credentials=async_anonymous_credentials(), @@ -2460,7 +2487,7 @@ async def test_create_firewall_endpoint_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( @@ -2482,11 +2509,6 @@ async def test_create_firewall_endpoint_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_firewall_endpoint_async_from_dict(): - await test_create_firewall_endpoint_async(request_type=dict) - - def test_create_firewall_endpoint_field_headers(): client = FirewallActivationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2661,8 +2683,8 @@ async def test_create_firewall_endpoint_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - firewall_activation.DeleteFirewallEndpointRequest, - dict, + firewall_activation.DeleteFirewallEndpointRequest(), + {}, ], ) def test_delete_firewall_endpoint(request_type, transport: str = "grpc"): @@ -2673,7 +2695,7 @@ def test_delete_firewall_endpoint(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2719,10 +2741,11 @@ def test_delete_firewall_endpoint_non_empty_request_with_auto_populated_field(): client.delete_firewall_endpoint(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == firewall_activation.DeleteFirewallEndpointRequest( + request_msg = firewall_activation.DeleteFirewallEndpointRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_firewall_endpoint_use_cached_wrapped_rpc(): @@ -2818,9 +2841,15 @@ async def test_delete_firewall_endpoint_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + firewall_activation.DeleteFirewallEndpointRequest(), + {}, + ], +) async def test_delete_firewall_endpoint_async( - transport: str = "grpc_asyncio", - request_type=firewall_activation.DeleteFirewallEndpointRequest, + request_type, transport: str = "grpc_asyncio" ): client = FirewallActivationAsyncClient( credentials=async_anonymous_credentials(), @@ -2829,7 +2858,7 @@ async def test_delete_firewall_endpoint_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( @@ -2851,11 +2880,6 @@ async def test_delete_firewall_endpoint_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_firewall_endpoint_async_from_dict(): - await test_delete_firewall_endpoint_async(request_type=dict) - - def test_delete_firewall_endpoint_field_headers(): client = FirewallActivationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3010,8 +3034,8 @@ async def test_delete_firewall_endpoint_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - firewall_activation.UpdateFirewallEndpointRequest, - dict, + firewall_activation.UpdateFirewallEndpointRequest(), + {}, ], ) def test_update_firewall_endpoint(request_type, transport: str = "grpc"): @@ -3022,7 +3046,7 @@ def test_update_firewall_endpoint(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3067,9 +3091,10 @@ def test_update_firewall_endpoint_non_empty_request_with_auto_populated_field(): client.update_firewall_endpoint(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == firewall_activation.UpdateFirewallEndpointRequest( + request_msg = firewall_activation.UpdateFirewallEndpointRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_firewall_endpoint_use_cached_wrapped_rpc(): @@ -3165,9 +3190,15 @@ async def test_update_firewall_endpoint_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + firewall_activation.UpdateFirewallEndpointRequest(), + {}, + ], +) async def test_update_firewall_endpoint_async( - transport: str = "grpc_asyncio", - request_type=firewall_activation.UpdateFirewallEndpointRequest, + request_type, transport: str = "grpc_asyncio" ): client = FirewallActivationAsyncClient( credentials=async_anonymous_credentials(), @@ -3176,7 +3207,7 @@ async def test_update_firewall_endpoint_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( @@ -3198,11 +3229,6 @@ async def test_update_firewall_endpoint_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_firewall_endpoint_async_from_dict(): - await test_update_firewall_endpoint_async(request_type=dict) - - def test_update_firewall_endpoint_field_headers(): client = FirewallActivationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3367,8 +3393,8 @@ async def test_update_firewall_endpoint_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - firewall_activation.ListFirewallEndpointAssociationsRequest, - dict, + firewall_activation.ListFirewallEndpointAssociationsRequest(), + {}, ], ) def test_list_firewall_endpoint_associations(request_type, transport: str = "grpc"): @@ -3379,7 +3405,7 @@ def test_list_firewall_endpoint_associations(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( @@ -3434,12 +3460,13 @@ def test_list_firewall_endpoint_associations_non_empty_request_with_auto_populat client.list_firewall_endpoint_associations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == firewall_activation.ListFirewallEndpointAssociationsRequest( + request_msg = firewall_activation.ListFirewallEndpointAssociationsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_firewall_endpoint_associations_use_cached_wrapped_rpc(): @@ -3525,9 +3552,15 @@ async def test_list_firewall_endpoint_associations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + firewall_activation.ListFirewallEndpointAssociationsRequest(), + {}, + ], +) async def test_list_firewall_endpoint_associations_async( - transport: str = "grpc_asyncio", - request_type=firewall_activation.ListFirewallEndpointAssociationsRequest, + request_type, transport: str = "grpc_asyncio" ): client = FirewallActivationAsyncClient( credentials=async_anonymous_credentials(), @@ -3536,7 +3569,7 @@ async def test_list_firewall_endpoint_associations_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( @@ -3563,11 +3596,6 @@ async def test_list_firewall_endpoint_associations_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_firewall_endpoint_associations_async_from_dict(): - await test_list_firewall_endpoint_associations_async(request_type=dict) - - def test_list_firewall_endpoint_associations_field_headers(): client = FirewallActivationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3936,8 +3964,8 @@ async def test_list_firewall_endpoint_associations_async_pages(): @pytest.mark.parametrize( "request_type", [ - firewall_activation.GetFirewallEndpointAssociationRequest, - dict, + firewall_activation.GetFirewallEndpointAssociationRequest(), + {}, ], ) def test_get_firewall_endpoint_association(request_type, transport: str = "grpc"): @@ -3948,7 +3976,7 @@ def test_get_firewall_endpoint_association(request_type, transport: str = "grpc" # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4010,9 +4038,10 @@ def test_get_firewall_endpoint_association_non_empty_request_with_auto_populated client.get_firewall_endpoint_association(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == firewall_activation.GetFirewallEndpointAssociationRequest( + request_msg = firewall_activation.GetFirewallEndpointAssociationRequest( name="name_value", ) + assert args[0] == request_msg def test_get_firewall_endpoint_association_use_cached_wrapped_rpc(): @@ -4098,9 +4127,15 @@ async def test_get_firewall_endpoint_association_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + firewall_activation.GetFirewallEndpointAssociationRequest(), + {}, + ], +) async def test_get_firewall_endpoint_association_async( - transport: str = "grpc_asyncio", - request_type=firewall_activation.GetFirewallEndpointAssociationRequest, + request_type, transport: str = "grpc_asyncio" ): client = FirewallActivationAsyncClient( credentials=async_anonymous_credentials(), @@ -4109,7 +4144,7 @@ async def test_get_firewall_endpoint_association_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( @@ -4148,11 +4183,6 @@ async def test_get_firewall_endpoint_association_async( assert response.disabled is True -@pytest.mark.asyncio -async def test_get_firewall_endpoint_association_async_from_dict(): - await test_get_firewall_endpoint_association_async(request_type=dict) - - def test_get_firewall_endpoint_association_field_headers(): client = FirewallActivationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4307,8 +4337,8 @@ async def test_get_firewall_endpoint_association_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - firewall_activation.CreateFirewallEndpointAssociationRequest, - dict, + firewall_activation.CreateFirewallEndpointAssociationRequest(), + {}, ], ) def test_create_firewall_endpoint_association(request_type, transport: str = "grpc"): @@ -4319,7 +4349,7 @@ def test_create_firewall_endpoint_association(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( @@ -4366,11 +4396,12 @@ def test_create_firewall_endpoint_association_non_empty_request_with_auto_popula client.create_firewall_endpoint_association(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == firewall_activation.CreateFirewallEndpointAssociationRequest( + request_msg = firewall_activation.CreateFirewallEndpointAssociationRequest( parent="parent_value", firewall_endpoint_association_id="firewall_endpoint_association_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_firewall_endpoint_association_use_cached_wrapped_rpc(): @@ -4466,9 +4497,15 @@ async def test_create_firewall_endpoint_association_async_use_cached_wrapped_rpc @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + firewall_activation.CreateFirewallEndpointAssociationRequest(), + {}, + ], +) async def test_create_firewall_endpoint_association_async( - transport: str = "grpc_asyncio", - request_type=firewall_activation.CreateFirewallEndpointAssociationRequest, + request_type, transport: str = "grpc_asyncio" ): client = FirewallActivationAsyncClient( credentials=async_anonymous_credentials(), @@ -4477,7 +4514,7 @@ async def test_create_firewall_endpoint_association_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( @@ -4499,11 +4536,6 @@ async def test_create_firewall_endpoint_association_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_firewall_endpoint_association_async_from_dict(): - await test_create_firewall_endpoint_association_async(request_type=dict) - - def test_create_firewall_endpoint_association_field_headers(): client = FirewallActivationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4686,8 +4718,8 @@ async def test_create_firewall_endpoint_association_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - firewall_activation.DeleteFirewallEndpointAssociationRequest, - dict, + firewall_activation.DeleteFirewallEndpointAssociationRequest(), + {}, ], ) def test_delete_firewall_endpoint_association(request_type, transport: str = "grpc"): @@ -4698,7 +4730,7 @@ def test_delete_firewall_endpoint_association(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( @@ -4744,10 +4776,11 @@ def test_delete_firewall_endpoint_association_non_empty_request_with_auto_popula client.delete_firewall_endpoint_association(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == firewall_activation.DeleteFirewallEndpointAssociationRequest( + request_msg = firewall_activation.DeleteFirewallEndpointAssociationRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_firewall_endpoint_association_use_cached_wrapped_rpc(): @@ -4843,9 +4876,15 @@ async def test_delete_firewall_endpoint_association_async_use_cached_wrapped_rpc @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + firewall_activation.DeleteFirewallEndpointAssociationRequest(), + {}, + ], +) async def test_delete_firewall_endpoint_association_async( - transport: str = "grpc_asyncio", - request_type=firewall_activation.DeleteFirewallEndpointAssociationRequest, + request_type, transport: str = "grpc_asyncio" ): client = FirewallActivationAsyncClient( credentials=async_anonymous_credentials(), @@ -4854,7 +4893,7 @@ async def test_delete_firewall_endpoint_association_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( @@ -4876,11 +4915,6 @@ async def test_delete_firewall_endpoint_association_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_firewall_endpoint_association_async_from_dict(): - await test_delete_firewall_endpoint_association_async(request_type=dict) - - def test_delete_firewall_endpoint_association_field_headers(): client = FirewallActivationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5035,8 +5069,8 @@ async def test_delete_firewall_endpoint_association_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - firewall_activation.UpdateFirewallEndpointAssociationRequest, - dict, + firewall_activation.UpdateFirewallEndpointAssociationRequest(), + {}, ], ) def test_update_firewall_endpoint_association(request_type, transport: str = "grpc"): @@ -5047,7 +5081,7 @@ def test_update_firewall_endpoint_association(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( @@ -5092,9 +5126,10 @@ def test_update_firewall_endpoint_association_non_empty_request_with_auto_popula client.update_firewall_endpoint_association(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == firewall_activation.UpdateFirewallEndpointAssociationRequest( + request_msg = firewall_activation.UpdateFirewallEndpointAssociationRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_firewall_endpoint_association_use_cached_wrapped_rpc(): @@ -5190,9 +5225,15 @@ async def test_update_firewall_endpoint_association_async_use_cached_wrapped_rpc @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + firewall_activation.UpdateFirewallEndpointAssociationRequest(), + {}, + ], +) async def test_update_firewall_endpoint_association_async( - transport: str = "grpc_asyncio", - request_type=firewall_activation.UpdateFirewallEndpointAssociationRequest, + request_type, transport: str = "grpc_asyncio" ): client = FirewallActivationAsyncClient( credentials=async_anonymous_credentials(), @@ -5201,7 +5242,7 @@ async def test_update_firewall_endpoint_association_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( @@ -5223,11 +5264,6 @@ async def test_update_firewall_endpoint_association_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_firewall_endpoint_association_async_from_dict(): - await test_update_firewall_endpoint_association_async(request_type=dict) - - def test_update_firewall_endpoint_association_field_headers(): client = FirewallActivationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7679,7 +7715,6 @@ def test_list_firewall_endpoints_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firewall_activation.ListFirewallEndpointsRequest() - assert args[0] == request_msg @@ -7702,7 +7737,6 @@ def test_get_firewall_endpoint_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firewall_activation.GetFirewallEndpointRequest() - assert args[0] == request_msg @@ -7725,7 +7759,6 @@ def test_create_firewall_endpoint_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firewall_activation.CreateFirewallEndpointRequest() - assert args[0] == request_msg @@ -7748,7 +7781,6 @@ def test_delete_firewall_endpoint_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firewall_activation.DeleteFirewallEndpointRequest() - assert args[0] == request_msg @@ -7771,7 +7803,6 @@ def test_update_firewall_endpoint_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firewall_activation.UpdateFirewallEndpointRequest() - assert args[0] == request_msg @@ -7796,7 +7827,6 @@ def test_list_firewall_endpoint_associations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firewall_activation.ListFirewallEndpointAssociationsRequest() - assert args[0] == request_msg @@ -7819,7 +7849,6 @@ def test_get_firewall_endpoint_association_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firewall_activation.GetFirewallEndpointAssociationRequest() - assert args[0] == request_msg @@ -7842,7 +7871,6 @@ def test_create_firewall_endpoint_association_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firewall_activation.CreateFirewallEndpointAssociationRequest() - assert args[0] == request_msg @@ -7865,7 +7893,6 @@ def test_delete_firewall_endpoint_association_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firewall_activation.DeleteFirewallEndpointAssociationRequest() - assert args[0] == request_msg @@ -7888,7 +7915,6 @@ def test_update_firewall_endpoint_association_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firewall_activation.UpdateFirewallEndpointAssociationRequest() - assert args[0] == request_msg @@ -7932,7 +7958,6 @@ async def test_list_firewall_endpoints_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firewall_activation.ListFirewallEndpointsRequest() - assert args[0] == request_msg @@ -7968,7 +7993,6 @@ async def test_get_firewall_endpoint_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firewall_activation.GetFirewallEndpointRequest() - assert args[0] == request_msg @@ -7995,7 +8019,6 @@ async def test_create_firewall_endpoint_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firewall_activation.CreateFirewallEndpointRequest() - assert args[0] == request_msg @@ -8022,7 +8045,6 @@ async def test_delete_firewall_endpoint_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firewall_activation.DeleteFirewallEndpointRequest() - assert args[0] == request_msg @@ -8049,7 +8071,6 @@ async def test_update_firewall_endpoint_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firewall_activation.UpdateFirewallEndpointRequest() - assert args[0] == request_msg @@ -8079,7 +8100,6 @@ async def test_list_firewall_endpoint_associations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firewall_activation.ListFirewallEndpointAssociationsRequest() - assert args[0] == request_msg @@ -8114,7 +8134,6 @@ async def test_get_firewall_endpoint_association_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firewall_activation.GetFirewallEndpointAssociationRequest() - assert args[0] == request_msg @@ -8141,7 +8160,6 @@ async def test_create_firewall_endpoint_association_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firewall_activation.CreateFirewallEndpointAssociationRequest() - assert args[0] == request_msg @@ -8168,7 +8186,6 @@ async def test_delete_firewall_endpoint_association_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firewall_activation.DeleteFirewallEndpointAssociationRequest() - assert args[0] == request_msg @@ -8195,7 +8212,6 @@ async def test_update_firewall_endpoint_association_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firewall_activation.UpdateFirewallEndpointAssociationRequest() - assert args[0] == request_msg @@ -10546,7 +10562,6 @@ def test_list_firewall_endpoints_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firewall_activation.ListFirewallEndpointsRequest() - assert args[0] == request_msg @@ -10568,7 +10583,6 @@ def test_get_firewall_endpoint_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firewall_activation.GetFirewallEndpointRequest() - assert args[0] == request_msg @@ -10590,7 +10604,6 @@ def test_create_firewall_endpoint_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firewall_activation.CreateFirewallEndpointRequest() - assert args[0] == request_msg @@ -10612,7 +10625,6 @@ def test_delete_firewall_endpoint_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firewall_activation.DeleteFirewallEndpointRequest() - assert args[0] == request_msg @@ -10634,7 +10646,6 @@ def test_update_firewall_endpoint_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firewall_activation.UpdateFirewallEndpointRequest() - assert args[0] == request_msg @@ -10656,7 +10667,6 @@ def test_list_firewall_endpoint_associations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firewall_activation.ListFirewallEndpointAssociationsRequest() - assert args[0] == request_msg @@ -10678,7 +10688,6 @@ def test_get_firewall_endpoint_association_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firewall_activation.GetFirewallEndpointAssociationRequest() - assert args[0] == request_msg @@ -10700,7 +10709,6 @@ def test_create_firewall_endpoint_association_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firewall_activation.CreateFirewallEndpointAssociationRequest() - assert args[0] == request_msg @@ -10722,7 +10730,6 @@ def test_delete_firewall_endpoint_association_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firewall_activation.DeleteFirewallEndpointAssociationRequest() - assert args[0] == request_msg @@ -10744,7 +10751,6 @@ def test_update_firewall_endpoint_association_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = firewall_activation.UpdateFirewallEndpointAssociationRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-network-security/tests/unit/gapic/network_security_v1alpha1/test_intercept.py b/packages/google-cloud-network-security/tests/unit/gapic/network_security_v1alpha1/test_intercept.py index f19f0685fb18..0090974f7574 100644 --- a/packages/google-cloud-network-security/tests/unit/gapic/network_security_v1alpha1/test_intercept.py +++ b/packages/google-cloud-network-security/tests/unit/gapic/network_security_v1alpha1/test_intercept.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 @@ -121,6 +122,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" @@ -1278,8 +1294,8 @@ def test_intercept_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - intercept.ListInterceptEndpointGroupsRequest, - dict, + intercept.ListInterceptEndpointGroupsRequest(), + {}, ], ) def test_list_intercept_endpoint_groups(request_type, transport: str = "grpc"): @@ -1290,7 +1306,7 @@ def test_list_intercept_endpoint_groups(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1341,12 +1357,13 @@ def test_list_intercept_endpoint_groups_non_empty_request_with_auto_populated_fi client.list_intercept_endpoint_groups(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == intercept.ListInterceptEndpointGroupsRequest( + request_msg = intercept.ListInterceptEndpointGroupsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_intercept_endpoint_groups_use_cached_wrapped_rpc(): @@ -1432,9 +1449,15 @@ async def test_list_intercept_endpoint_groups_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + intercept.ListInterceptEndpointGroupsRequest(), + {}, + ], +) async def test_list_intercept_endpoint_groups_async( - transport: str = "grpc_asyncio", - request_type=intercept.ListInterceptEndpointGroupsRequest, + request_type, transport: str = "grpc_asyncio" ): client = InterceptAsyncClient( credentials=async_anonymous_credentials(), @@ -1443,7 +1466,7 @@ async def test_list_intercept_endpoint_groups_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( @@ -1468,11 +1491,6 @@ async def test_list_intercept_endpoint_groups_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_intercept_endpoint_groups_async_from_dict(): - await test_list_intercept_endpoint_groups_async(request_type=dict) - - def test_list_intercept_endpoint_groups_field_headers(): client = InterceptClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1829,8 +1847,8 @@ async def test_list_intercept_endpoint_groups_async_pages(): @pytest.mark.parametrize( "request_type", [ - intercept.GetInterceptEndpointGroupRequest, - dict, + intercept.GetInterceptEndpointGroupRequest(), + {}, ], ) def test_get_intercept_endpoint_group(request_type, transport: str = "grpc"): @@ -1841,7 +1859,7 @@ def test_get_intercept_endpoint_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1897,9 +1915,10 @@ def test_get_intercept_endpoint_group_non_empty_request_with_auto_populated_fiel client.get_intercept_endpoint_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == intercept.GetInterceptEndpointGroupRequest( + request_msg = intercept.GetInterceptEndpointGroupRequest( name="name_value", ) + assert args[0] == request_msg def test_get_intercept_endpoint_group_use_cached_wrapped_rpc(): @@ -1985,9 +2004,15 @@ async def test_get_intercept_endpoint_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + intercept.GetInterceptEndpointGroupRequest(), + {}, + ], +) async def test_get_intercept_endpoint_group_async( - transport: str = "grpc_asyncio", - request_type=intercept.GetInterceptEndpointGroupRequest, + request_type, transport: str = "grpc_asyncio" ): client = InterceptAsyncClient( credentials=async_anonymous_credentials(), @@ -1996,7 +2021,7 @@ async def test_get_intercept_endpoint_group_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( @@ -2029,11 +2054,6 @@ async def test_get_intercept_endpoint_group_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_get_intercept_endpoint_group_async_from_dict(): - await test_get_intercept_endpoint_group_async(request_type=dict) - - def test_get_intercept_endpoint_group_field_headers(): client = InterceptClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2188,8 +2208,8 @@ async def test_get_intercept_endpoint_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - intercept.CreateInterceptEndpointGroupRequest, - dict, + intercept.CreateInterceptEndpointGroupRequest(), + {}, ], ) def test_create_intercept_endpoint_group(request_type, transport: str = "grpc"): @@ -2200,7 +2220,7 @@ def test_create_intercept_endpoint_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2246,10 +2266,11 @@ def test_create_intercept_endpoint_group_non_empty_request_with_auto_populated_f client.create_intercept_endpoint_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == intercept.CreateInterceptEndpointGroupRequest( + request_msg = intercept.CreateInterceptEndpointGroupRequest( parent="parent_value", intercept_endpoint_group_id="intercept_endpoint_group_id_value", ) + assert args[0] == request_msg def test_create_intercept_endpoint_group_use_cached_wrapped_rpc(): @@ -2345,9 +2366,15 @@ async def test_create_intercept_endpoint_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + intercept.CreateInterceptEndpointGroupRequest(), + {}, + ], +) async def test_create_intercept_endpoint_group_async( - transport: str = "grpc_asyncio", - request_type=intercept.CreateInterceptEndpointGroupRequest, + request_type, transport: str = "grpc_asyncio" ): client = InterceptAsyncClient( credentials=async_anonymous_credentials(), @@ -2356,7 +2383,7 @@ async def test_create_intercept_endpoint_group_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( @@ -2378,11 +2405,6 @@ async def test_create_intercept_endpoint_group_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_intercept_endpoint_group_async_from_dict(): - await test_create_intercept_endpoint_group_async(request_type=dict) - - def test_create_intercept_endpoint_group_field_headers(): client = InterceptClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2565,8 +2587,8 @@ async def test_create_intercept_endpoint_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - intercept.UpdateInterceptEndpointGroupRequest, - dict, + intercept.UpdateInterceptEndpointGroupRequest(), + {}, ], ) def test_update_intercept_endpoint_group(request_type, transport: str = "grpc"): @@ -2577,7 +2599,7 @@ def test_update_intercept_endpoint_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,7 +2642,8 @@ def test_update_intercept_endpoint_group_non_empty_request_with_auto_populated_f client.update_intercept_endpoint_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == intercept.UpdateInterceptEndpointGroupRequest() + request_msg = intercept.UpdateInterceptEndpointGroupRequest() + assert args[0] == request_msg def test_update_intercept_endpoint_group_use_cached_wrapped_rpc(): @@ -2716,9 +2739,15 @@ async def test_update_intercept_endpoint_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + intercept.UpdateInterceptEndpointGroupRequest(), + {}, + ], +) async def test_update_intercept_endpoint_group_async( - transport: str = "grpc_asyncio", - request_type=intercept.UpdateInterceptEndpointGroupRequest, + request_type, transport: str = "grpc_asyncio" ): client = InterceptAsyncClient( credentials=async_anonymous_credentials(), @@ -2727,7 +2756,7 @@ async def test_update_intercept_endpoint_group_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( @@ -2749,11 +2778,6 @@ async def test_update_intercept_endpoint_group_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_intercept_endpoint_group_async_from_dict(): - await test_update_intercept_endpoint_group_async(request_type=dict) - - def test_update_intercept_endpoint_group_field_headers(): client = InterceptClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2926,8 +2950,8 @@ async def test_update_intercept_endpoint_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - intercept.DeleteInterceptEndpointGroupRequest, - dict, + intercept.DeleteInterceptEndpointGroupRequest(), + {}, ], ) def test_delete_intercept_endpoint_group(request_type, transport: str = "grpc"): @@ -2938,7 +2962,7 @@ def test_delete_intercept_endpoint_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2983,9 +3007,10 @@ def test_delete_intercept_endpoint_group_non_empty_request_with_auto_populated_f client.delete_intercept_endpoint_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == intercept.DeleteInterceptEndpointGroupRequest( + request_msg = intercept.DeleteInterceptEndpointGroupRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_intercept_endpoint_group_use_cached_wrapped_rpc(): @@ -3081,9 +3106,15 @@ async def test_delete_intercept_endpoint_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + intercept.DeleteInterceptEndpointGroupRequest(), + {}, + ], +) async def test_delete_intercept_endpoint_group_async( - transport: str = "grpc_asyncio", - request_type=intercept.DeleteInterceptEndpointGroupRequest, + request_type, transport: str = "grpc_asyncio" ): client = InterceptAsyncClient( credentials=async_anonymous_credentials(), @@ -3092,7 +3123,7 @@ async def test_delete_intercept_endpoint_group_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( @@ -3114,11 +3145,6 @@ async def test_delete_intercept_endpoint_group_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_intercept_endpoint_group_async_from_dict(): - await test_delete_intercept_endpoint_group_async(request_type=dict) - - def test_delete_intercept_endpoint_group_field_headers(): client = InterceptClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3273,8 +3299,8 @@ async def test_delete_intercept_endpoint_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - intercept.ListInterceptEndpointGroupAssociationsRequest, - dict, + intercept.ListInterceptEndpointGroupAssociationsRequest(), + {}, ], ) def test_list_intercept_endpoint_group_associations( @@ -3287,7 +3313,7 @@ def test_list_intercept_endpoint_group_associations( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3338,12 +3364,13 @@ def test_list_intercept_endpoint_group_associations_non_empty_request_with_auto_ client.list_intercept_endpoint_group_associations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == intercept.ListInterceptEndpointGroupAssociationsRequest( + request_msg = intercept.ListInterceptEndpointGroupAssociationsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_intercept_endpoint_group_associations_use_cached_wrapped_rpc(): @@ -3429,9 +3456,15 @@ async def test_list_intercept_endpoint_group_associations_async_use_cached_wrapp @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + intercept.ListInterceptEndpointGroupAssociationsRequest(), + {}, + ], +) async def test_list_intercept_endpoint_group_associations_async( - transport: str = "grpc_asyncio", - request_type=intercept.ListInterceptEndpointGroupAssociationsRequest, + request_type, transport: str = "grpc_asyncio" ): client = InterceptAsyncClient( credentials=async_anonymous_credentials(), @@ -3440,7 +3473,7 @@ async def test_list_intercept_endpoint_group_associations_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( @@ -3465,11 +3498,6 @@ async def test_list_intercept_endpoint_group_associations_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_intercept_endpoint_group_associations_async_from_dict(): - await test_list_intercept_endpoint_group_associations_async(request_type=dict) - - def test_list_intercept_endpoint_group_associations_field_headers(): client = InterceptClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3833,8 +3861,8 @@ async def test_list_intercept_endpoint_group_associations_async_pages(): @pytest.mark.parametrize( "request_type", [ - intercept.GetInterceptEndpointGroupAssociationRequest, - dict, + intercept.GetInterceptEndpointGroupAssociationRequest(), + {}, ], ) def test_get_intercept_endpoint_group_association( @@ -3847,7 +3875,7 @@ def test_get_intercept_endpoint_group_association( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3903,9 +3931,10 @@ def test_get_intercept_endpoint_group_association_non_empty_request_with_auto_po client.get_intercept_endpoint_group_association(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == intercept.GetInterceptEndpointGroupAssociationRequest( + request_msg = intercept.GetInterceptEndpointGroupAssociationRequest( name="name_value", ) + assert args[0] == request_msg def test_get_intercept_endpoint_group_association_use_cached_wrapped_rpc(): @@ -3991,9 +4020,15 @@ async def test_get_intercept_endpoint_group_association_async_use_cached_wrapped @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + intercept.GetInterceptEndpointGroupAssociationRequest(), + {}, + ], +) async def test_get_intercept_endpoint_group_association_async( - transport: str = "grpc_asyncio", - request_type=intercept.GetInterceptEndpointGroupAssociationRequest, + request_type, transport: str = "grpc_asyncio" ): client = InterceptAsyncClient( credentials=async_anonymous_credentials(), @@ -4002,7 +4037,7 @@ async def test_get_intercept_endpoint_group_association_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( @@ -4035,11 +4070,6 @@ async def test_get_intercept_endpoint_group_association_async( assert response.reconciling is True -@pytest.mark.asyncio -async def test_get_intercept_endpoint_group_association_async_from_dict(): - await test_get_intercept_endpoint_group_association_async(request_type=dict) - - def test_get_intercept_endpoint_group_association_field_headers(): client = InterceptClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4194,8 +4224,8 @@ async def test_get_intercept_endpoint_group_association_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - intercept.CreateInterceptEndpointGroupAssociationRequest, - dict, + intercept.CreateInterceptEndpointGroupAssociationRequest(), + {}, ], ) def test_create_intercept_endpoint_group_association( @@ -4208,7 +4238,7 @@ def test_create_intercept_endpoint_group_association( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4254,10 +4284,11 @@ def test_create_intercept_endpoint_group_association_non_empty_request_with_auto client.create_intercept_endpoint_group_association(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == intercept.CreateInterceptEndpointGroupAssociationRequest( + request_msg = intercept.CreateInterceptEndpointGroupAssociationRequest( parent="parent_value", intercept_endpoint_group_association_id="intercept_endpoint_group_association_id_value", ) + assert args[0] == request_msg def test_create_intercept_endpoint_group_association_use_cached_wrapped_rpc(): @@ -4353,9 +4384,15 @@ async def test_create_intercept_endpoint_group_association_async_use_cached_wrap @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + intercept.CreateInterceptEndpointGroupAssociationRequest(), + {}, + ], +) async def test_create_intercept_endpoint_group_association_async( - transport: str = "grpc_asyncio", - request_type=intercept.CreateInterceptEndpointGroupAssociationRequest, + request_type, transport: str = "grpc_asyncio" ): client = InterceptAsyncClient( credentials=async_anonymous_credentials(), @@ -4364,7 +4401,7 @@ async def test_create_intercept_endpoint_group_association_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( @@ -4386,11 +4423,6 @@ async def test_create_intercept_endpoint_group_association_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_intercept_endpoint_group_association_async_from_dict(): - await test_create_intercept_endpoint_group_association_async(request_type=dict) - - def test_create_intercept_endpoint_group_association_field_headers(): client = InterceptClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4573,8 +4605,8 @@ async def test_create_intercept_endpoint_group_association_flattened_error_async @pytest.mark.parametrize( "request_type", [ - intercept.UpdateInterceptEndpointGroupAssociationRequest, - dict, + intercept.UpdateInterceptEndpointGroupAssociationRequest(), + {}, ], ) def test_update_intercept_endpoint_group_association( @@ -4587,7 +4619,7 @@ def test_update_intercept_endpoint_group_association( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,7 +4662,8 @@ def test_update_intercept_endpoint_group_association_non_empty_request_with_auto client.update_intercept_endpoint_group_association(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == intercept.UpdateInterceptEndpointGroupAssociationRequest() + request_msg = intercept.UpdateInterceptEndpointGroupAssociationRequest() + assert args[0] == request_msg def test_update_intercept_endpoint_group_association_use_cached_wrapped_rpc(): @@ -4726,9 +4759,15 @@ async def test_update_intercept_endpoint_group_association_async_use_cached_wrap @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + intercept.UpdateInterceptEndpointGroupAssociationRequest(), + {}, + ], +) async def test_update_intercept_endpoint_group_association_async( - transport: str = "grpc_asyncio", - request_type=intercept.UpdateInterceptEndpointGroupAssociationRequest, + request_type, transport: str = "grpc_asyncio" ): client = InterceptAsyncClient( credentials=async_anonymous_credentials(), @@ -4737,7 +4776,7 @@ async def test_update_intercept_endpoint_group_association_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( @@ -4759,11 +4798,6 @@ async def test_update_intercept_endpoint_group_association_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_intercept_endpoint_group_association_async_from_dict(): - await test_update_intercept_endpoint_group_association_async(request_type=dict) - - def test_update_intercept_endpoint_group_association_field_headers(): client = InterceptClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4936,8 +4970,8 @@ async def test_update_intercept_endpoint_group_association_flattened_error_async @pytest.mark.parametrize( "request_type", [ - intercept.DeleteInterceptEndpointGroupAssociationRequest, - dict, + intercept.DeleteInterceptEndpointGroupAssociationRequest(), + {}, ], ) def test_delete_intercept_endpoint_group_association( @@ -4950,7 +4984,7 @@ def test_delete_intercept_endpoint_group_association( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4995,9 +5029,10 @@ def test_delete_intercept_endpoint_group_association_non_empty_request_with_auto client.delete_intercept_endpoint_group_association(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == intercept.DeleteInterceptEndpointGroupAssociationRequest( + request_msg = intercept.DeleteInterceptEndpointGroupAssociationRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_intercept_endpoint_group_association_use_cached_wrapped_rpc(): @@ -5093,9 +5128,15 @@ async def test_delete_intercept_endpoint_group_association_async_use_cached_wrap @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + intercept.DeleteInterceptEndpointGroupAssociationRequest(), + {}, + ], +) async def test_delete_intercept_endpoint_group_association_async( - transport: str = "grpc_asyncio", - request_type=intercept.DeleteInterceptEndpointGroupAssociationRequest, + request_type, transport: str = "grpc_asyncio" ): client = InterceptAsyncClient( credentials=async_anonymous_credentials(), @@ -5104,7 +5145,7 @@ async def test_delete_intercept_endpoint_group_association_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( @@ -5126,11 +5167,6 @@ async def test_delete_intercept_endpoint_group_association_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_intercept_endpoint_group_association_async_from_dict(): - await test_delete_intercept_endpoint_group_association_async(request_type=dict) - - def test_delete_intercept_endpoint_group_association_field_headers(): client = InterceptClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5285,8 +5321,8 @@ async def test_delete_intercept_endpoint_group_association_flattened_error_async @pytest.mark.parametrize( "request_type", [ - intercept.ListInterceptDeploymentGroupsRequest, - dict, + intercept.ListInterceptDeploymentGroupsRequest(), + {}, ], ) def test_list_intercept_deployment_groups(request_type, transport: str = "grpc"): @@ -5297,7 +5333,7 @@ def test_list_intercept_deployment_groups(request_type, transport: str = "grpc") # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5348,12 +5384,13 @@ def test_list_intercept_deployment_groups_non_empty_request_with_auto_populated_ client.list_intercept_deployment_groups(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == intercept.ListInterceptDeploymentGroupsRequest( + request_msg = intercept.ListInterceptDeploymentGroupsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_intercept_deployment_groups_use_cached_wrapped_rpc(): @@ -5439,9 +5476,15 @@ async def test_list_intercept_deployment_groups_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + intercept.ListInterceptDeploymentGroupsRequest(), + {}, + ], +) async def test_list_intercept_deployment_groups_async( - transport: str = "grpc_asyncio", - request_type=intercept.ListInterceptDeploymentGroupsRequest, + request_type, transport: str = "grpc_asyncio" ): client = InterceptAsyncClient( credentials=async_anonymous_credentials(), @@ -5450,7 +5493,7 @@ async def test_list_intercept_deployment_groups_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( @@ -5475,11 +5518,6 @@ async def test_list_intercept_deployment_groups_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_intercept_deployment_groups_async_from_dict(): - await test_list_intercept_deployment_groups_async(request_type=dict) - - def test_list_intercept_deployment_groups_field_headers(): client = InterceptClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5836,8 +5874,8 @@ async def test_list_intercept_deployment_groups_async_pages(): @pytest.mark.parametrize( "request_type", [ - intercept.GetInterceptDeploymentGroupRequest, - dict, + intercept.GetInterceptDeploymentGroupRequest(), + {}, ], ) def test_get_intercept_deployment_group(request_type, transport: str = "grpc"): @@ -5848,7 +5886,7 @@ def test_get_intercept_deployment_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5904,9 +5942,10 @@ def test_get_intercept_deployment_group_non_empty_request_with_auto_populated_fi client.get_intercept_deployment_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == intercept.GetInterceptDeploymentGroupRequest( + request_msg = intercept.GetInterceptDeploymentGroupRequest( name="name_value", ) + assert args[0] == request_msg def test_get_intercept_deployment_group_use_cached_wrapped_rpc(): @@ -5992,9 +6031,15 @@ async def test_get_intercept_deployment_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + intercept.GetInterceptDeploymentGroupRequest(), + {}, + ], +) async def test_get_intercept_deployment_group_async( - transport: str = "grpc_asyncio", - request_type=intercept.GetInterceptDeploymentGroupRequest, + request_type, transport: str = "grpc_asyncio" ): client = InterceptAsyncClient( credentials=async_anonymous_credentials(), @@ -6003,7 +6048,7 @@ async def test_get_intercept_deployment_group_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( @@ -6036,11 +6081,6 @@ async def test_get_intercept_deployment_group_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_get_intercept_deployment_group_async_from_dict(): - await test_get_intercept_deployment_group_async(request_type=dict) - - def test_get_intercept_deployment_group_field_headers(): client = InterceptClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6195,8 +6235,8 @@ async def test_get_intercept_deployment_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - intercept.CreateInterceptDeploymentGroupRequest, - dict, + intercept.CreateInterceptDeploymentGroupRequest(), + {}, ], ) def test_create_intercept_deployment_group(request_type, transport: str = "grpc"): @@ -6207,7 +6247,7 @@ def test_create_intercept_deployment_group(request_type, transport: str = "grpc" # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6253,10 +6293,11 @@ def test_create_intercept_deployment_group_non_empty_request_with_auto_populated client.create_intercept_deployment_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == intercept.CreateInterceptDeploymentGroupRequest( + request_msg = intercept.CreateInterceptDeploymentGroupRequest( parent="parent_value", intercept_deployment_group_id="intercept_deployment_group_id_value", ) + assert args[0] == request_msg def test_create_intercept_deployment_group_use_cached_wrapped_rpc(): @@ -6352,9 +6393,15 @@ async def test_create_intercept_deployment_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + intercept.CreateInterceptDeploymentGroupRequest(), + {}, + ], +) async def test_create_intercept_deployment_group_async( - transport: str = "grpc_asyncio", - request_type=intercept.CreateInterceptDeploymentGroupRequest, + request_type, transport: str = "grpc_asyncio" ): client = InterceptAsyncClient( credentials=async_anonymous_credentials(), @@ -6363,7 +6410,7 @@ async def test_create_intercept_deployment_group_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( @@ -6385,11 +6432,6 @@ async def test_create_intercept_deployment_group_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_intercept_deployment_group_async_from_dict(): - await test_create_intercept_deployment_group_async(request_type=dict) - - def test_create_intercept_deployment_group_field_headers(): client = InterceptClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6572,8 +6614,8 @@ async def test_create_intercept_deployment_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - intercept.UpdateInterceptDeploymentGroupRequest, - dict, + intercept.UpdateInterceptDeploymentGroupRequest(), + {}, ], ) def test_update_intercept_deployment_group(request_type, transport: str = "grpc"): @@ -6584,7 +6626,7 @@ def test_update_intercept_deployment_group(request_type, transport: str = "grpc" # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6627,7 +6669,8 @@ def test_update_intercept_deployment_group_non_empty_request_with_auto_populated client.update_intercept_deployment_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == intercept.UpdateInterceptDeploymentGroupRequest() + request_msg = intercept.UpdateInterceptDeploymentGroupRequest() + assert args[0] == request_msg def test_update_intercept_deployment_group_use_cached_wrapped_rpc(): @@ -6723,9 +6766,15 @@ async def test_update_intercept_deployment_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + intercept.UpdateInterceptDeploymentGroupRequest(), + {}, + ], +) async def test_update_intercept_deployment_group_async( - transport: str = "grpc_asyncio", - request_type=intercept.UpdateInterceptDeploymentGroupRequest, + request_type, transport: str = "grpc_asyncio" ): client = InterceptAsyncClient( credentials=async_anonymous_credentials(), @@ -6734,7 +6783,7 @@ async def test_update_intercept_deployment_group_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( @@ -6756,11 +6805,6 @@ async def test_update_intercept_deployment_group_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_intercept_deployment_group_async_from_dict(): - await test_update_intercept_deployment_group_async(request_type=dict) - - def test_update_intercept_deployment_group_field_headers(): client = InterceptClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6933,8 +6977,8 @@ async def test_update_intercept_deployment_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - intercept.DeleteInterceptDeploymentGroupRequest, - dict, + intercept.DeleteInterceptDeploymentGroupRequest(), + {}, ], ) def test_delete_intercept_deployment_group(request_type, transport: str = "grpc"): @@ -6945,7 +6989,7 @@ def test_delete_intercept_deployment_group(request_type, transport: str = "grpc" # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6990,9 +7034,10 @@ def test_delete_intercept_deployment_group_non_empty_request_with_auto_populated client.delete_intercept_deployment_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == intercept.DeleteInterceptDeploymentGroupRequest( + request_msg = intercept.DeleteInterceptDeploymentGroupRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_intercept_deployment_group_use_cached_wrapped_rpc(): @@ -7088,9 +7133,15 @@ async def test_delete_intercept_deployment_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + intercept.DeleteInterceptDeploymentGroupRequest(), + {}, + ], +) async def test_delete_intercept_deployment_group_async( - transport: str = "grpc_asyncio", - request_type=intercept.DeleteInterceptDeploymentGroupRequest, + request_type, transport: str = "grpc_asyncio" ): client = InterceptAsyncClient( credentials=async_anonymous_credentials(), @@ -7099,7 +7150,7 @@ async def test_delete_intercept_deployment_group_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( @@ -7121,11 +7172,6 @@ async def test_delete_intercept_deployment_group_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_intercept_deployment_group_async_from_dict(): - await test_delete_intercept_deployment_group_async(request_type=dict) - - def test_delete_intercept_deployment_group_field_headers(): client = InterceptClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7280,8 +7326,8 @@ async def test_delete_intercept_deployment_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - intercept.ListInterceptDeploymentsRequest, - dict, + intercept.ListInterceptDeploymentsRequest(), + {}, ], ) def test_list_intercept_deployments(request_type, transport: str = "grpc"): @@ -7292,7 +7338,7 @@ def test_list_intercept_deployments(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7345,12 +7391,13 @@ def test_list_intercept_deployments_non_empty_request_with_auto_populated_field( client.list_intercept_deployments(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == intercept.ListInterceptDeploymentsRequest( + request_msg = intercept.ListInterceptDeploymentsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_intercept_deployments_use_cached_wrapped_rpc(): @@ -7436,9 +7483,15 @@ async def test_list_intercept_deployments_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + intercept.ListInterceptDeploymentsRequest(), + {}, + ], +) async def test_list_intercept_deployments_async( - transport: str = "grpc_asyncio", - request_type=intercept.ListInterceptDeploymentsRequest, + request_type, transport: str = "grpc_asyncio" ): client = InterceptAsyncClient( credentials=async_anonymous_credentials(), @@ -7447,7 +7500,7 @@ async def test_list_intercept_deployments_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( @@ -7474,11 +7527,6 @@ async def test_list_intercept_deployments_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_intercept_deployments_async_from_dict(): - await test_list_intercept_deployments_async(request_type=dict) - - def test_list_intercept_deployments_field_headers(): client = InterceptClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7833,8 +7881,8 @@ async def test_list_intercept_deployments_async_pages(): @pytest.mark.parametrize( "request_type", [ - intercept.GetInterceptDeploymentRequest, - dict, + intercept.GetInterceptDeploymentRequest(), + {}, ], ) def test_get_intercept_deployment(request_type, transport: str = "grpc"): @@ -7845,7 +7893,7 @@ def test_get_intercept_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7903,9 +7951,10 @@ def test_get_intercept_deployment_non_empty_request_with_auto_populated_field(): client.get_intercept_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == intercept.GetInterceptDeploymentRequest( + request_msg = intercept.GetInterceptDeploymentRequest( name="name_value", ) + assert args[0] == request_msg def test_get_intercept_deployment_use_cached_wrapped_rpc(): @@ -7991,9 +8040,15 @@ async def test_get_intercept_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + intercept.GetInterceptDeploymentRequest(), + {}, + ], +) async def test_get_intercept_deployment_async( - transport: str = "grpc_asyncio", - request_type=intercept.GetInterceptDeploymentRequest, + request_type, transport: str = "grpc_asyncio" ): client = InterceptAsyncClient( credentials=async_anonymous_credentials(), @@ -8002,7 +8057,7 @@ async def test_get_intercept_deployment_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( @@ -8037,11 +8092,6 @@ async def test_get_intercept_deployment_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_get_intercept_deployment_async_from_dict(): - await test_get_intercept_deployment_async(request_type=dict) - - def test_get_intercept_deployment_field_headers(): client = InterceptClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8196,8 +8246,8 @@ async def test_get_intercept_deployment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - intercept.CreateInterceptDeploymentRequest, - dict, + intercept.CreateInterceptDeploymentRequest(), + {}, ], ) def test_create_intercept_deployment(request_type, transport: str = "grpc"): @@ -8208,7 +8258,7 @@ def test_create_intercept_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8254,10 +8304,11 @@ def test_create_intercept_deployment_non_empty_request_with_auto_populated_field client.create_intercept_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == intercept.CreateInterceptDeploymentRequest( + request_msg = intercept.CreateInterceptDeploymentRequest( parent="parent_value", intercept_deployment_id="intercept_deployment_id_value", ) + assert args[0] == request_msg def test_create_intercept_deployment_use_cached_wrapped_rpc(): @@ -8353,9 +8404,15 @@ async def test_create_intercept_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + intercept.CreateInterceptDeploymentRequest(), + {}, + ], +) async def test_create_intercept_deployment_async( - transport: str = "grpc_asyncio", - request_type=intercept.CreateInterceptDeploymentRequest, + request_type, transport: str = "grpc_asyncio" ): client = InterceptAsyncClient( credentials=async_anonymous_credentials(), @@ -8364,7 +8421,7 @@ async def test_create_intercept_deployment_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( @@ -8386,11 +8443,6 @@ async def test_create_intercept_deployment_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_intercept_deployment_async_from_dict(): - await test_create_intercept_deployment_async(request_type=dict) - - def test_create_intercept_deployment_field_headers(): client = InterceptClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8565,8 +8617,8 @@ async def test_create_intercept_deployment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - intercept.UpdateInterceptDeploymentRequest, - dict, + intercept.UpdateInterceptDeploymentRequest(), + {}, ], ) def test_update_intercept_deployment(request_type, transport: str = "grpc"): @@ -8577,7 +8629,7 @@ def test_update_intercept_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8620,7 +8672,8 @@ def test_update_intercept_deployment_non_empty_request_with_auto_populated_field client.update_intercept_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == intercept.UpdateInterceptDeploymentRequest() + request_msg = intercept.UpdateInterceptDeploymentRequest() + assert args[0] == request_msg def test_update_intercept_deployment_use_cached_wrapped_rpc(): @@ -8716,9 +8769,15 @@ async def test_update_intercept_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + intercept.UpdateInterceptDeploymentRequest(), + {}, + ], +) async def test_update_intercept_deployment_async( - transport: str = "grpc_asyncio", - request_type=intercept.UpdateInterceptDeploymentRequest, + request_type, transport: str = "grpc_asyncio" ): client = InterceptAsyncClient( credentials=async_anonymous_credentials(), @@ -8727,7 +8786,7 @@ async def test_update_intercept_deployment_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( @@ -8749,11 +8808,6 @@ async def test_update_intercept_deployment_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_intercept_deployment_async_from_dict(): - await test_update_intercept_deployment_async(request_type=dict) - - def test_update_intercept_deployment_field_headers(): client = InterceptClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8918,8 +8972,8 @@ async def test_update_intercept_deployment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - intercept.DeleteInterceptDeploymentRequest, - dict, + intercept.DeleteInterceptDeploymentRequest(), + {}, ], ) def test_delete_intercept_deployment(request_type, transport: str = "grpc"): @@ -8930,7 +8984,7 @@ def test_delete_intercept_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8975,9 +9029,10 @@ def test_delete_intercept_deployment_non_empty_request_with_auto_populated_field client.delete_intercept_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == intercept.DeleteInterceptDeploymentRequest( + request_msg = intercept.DeleteInterceptDeploymentRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_intercept_deployment_use_cached_wrapped_rpc(): @@ -9073,9 +9128,15 @@ async def test_delete_intercept_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + intercept.DeleteInterceptDeploymentRequest(), + {}, + ], +) async def test_delete_intercept_deployment_async( - transport: str = "grpc_asyncio", - request_type=intercept.DeleteInterceptDeploymentRequest, + request_type, transport: str = "grpc_asyncio" ): client = InterceptAsyncClient( credentials=async_anonymous_credentials(), @@ -9084,7 +9145,7 @@ async def test_delete_intercept_deployment_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( @@ -9106,11 +9167,6 @@ async def test_delete_intercept_deployment_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_intercept_deployment_async_from_dict(): - await test_delete_intercept_deployment_async(request_type=dict) - - def test_delete_intercept_deployment_field_headers(): client = InterceptClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13727,7 +13783,6 @@ def test_list_intercept_endpoint_groups_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.ListInterceptEndpointGroupsRequest() - assert args[0] == request_msg @@ -13750,7 +13805,6 @@ def test_get_intercept_endpoint_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.GetInterceptEndpointGroupRequest() - assert args[0] == request_msg @@ -13773,7 +13827,6 @@ def test_create_intercept_endpoint_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.CreateInterceptEndpointGroupRequest() - assert args[0] == request_msg @@ -13796,7 +13849,6 @@ def test_update_intercept_endpoint_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.UpdateInterceptEndpointGroupRequest() - assert args[0] == request_msg @@ -13819,7 +13871,6 @@ def test_delete_intercept_endpoint_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.DeleteInterceptEndpointGroupRequest() - assert args[0] == request_msg @@ -13842,7 +13893,6 @@ def test_list_intercept_endpoint_group_associations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.ListInterceptEndpointGroupAssociationsRequest() - assert args[0] == request_msg @@ -13865,7 +13915,6 @@ def test_get_intercept_endpoint_group_association_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.GetInterceptEndpointGroupAssociationRequest() - assert args[0] == request_msg @@ -13888,7 +13937,6 @@ def test_create_intercept_endpoint_group_association_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.CreateInterceptEndpointGroupAssociationRequest() - assert args[0] == request_msg @@ -13911,7 +13959,6 @@ def test_update_intercept_endpoint_group_association_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.UpdateInterceptEndpointGroupAssociationRequest() - assert args[0] == request_msg @@ -13934,7 +13981,6 @@ def test_delete_intercept_endpoint_group_association_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.DeleteInterceptEndpointGroupAssociationRequest() - assert args[0] == request_msg @@ -13957,7 +14003,6 @@ def test_list_intercept_deployment_groups_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.ListInterceptDeploymentGroupsRequest() - assert args[0] == request_msg @@ -13980,7 +14025,6 @@ def test_get_intercept_deployment_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.GetInterceptDeploymentGroupRequest() - assert args[0] == request_msg @@ -14003,7 +14047,6 @@ def test_create_intercept_deployment_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.CreateInterceptDeploymentGroupRequest() - assert args[0] == request_msg @@ -14026,7 +14069,6 @@ def test_update_intercept_deployment_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.UpdateInterceptDeploymentGroupRequest() - assert args[0] == request_msg @@ -14049,7 +14091,6 @@ def test_delete_intercept_deployment_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.DeleteInterceptDeploymentGroupRequest() - assert args[0] == request_msg @@ -14072,7 +14113,6 @@ def test_list_intercept_deployments_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.ListInterceptDeploymentsRequest() - assert args[0] == request_msg @@ -14095,7 +14135,6 @@ def test_get_intercept_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.GetInterceptDeploymentRequest() - assert args[0] == request_msg @@ -14118,7 +14157,6 @@ def test_create_intercept_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.CreateInterceptDeploymentRequest() - assert args[0] == request_msg @@ -14141,7 +14179,6 @@ def test_update_intercept_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.UpdateInterceptDeploymentRequest() - assert args[0] == request_msg @@ -14164,7 +14201,6 @@ def test_delete_intercept_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.DeleteInterceptDeploymentRequest() - assert args[0] == request_msg @@ -14207,7 +14243,6 @@ async def test_list_intercept_endpoint_groups_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.ListInterceptEndpointGroupsRequest() - assert args[0] == request_msg @@ -14240,7 +14275,6 @@ async def test_get_intercept_endpoint_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.GetInterceptEndpointGroupRequest() - assert args[0] == request_msg @@ -14267,7 +14301,6 @@ async def test_create_intercept_endpoint_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.CreateInterceptEndpointGroupRequest() - assert args[0] == request_msg @@ -14294,7 +14327,6 @@ async def test_update_intercept_endpoint_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.UpdateInterceptEndpointGroupRequest() - assert args[0] == request_msg @@ -14321,7 +14353,6 @@ async def test_delete_intercept_endpoint_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.DeleteInterceptEndpointGroupRequest() - assert args[0] == request_msg @@ -14350,7 +14381,6 @@ async def test_list_intercept_endpoint_group_associations_empty_call_grpc_asynci call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.ListInterceptEndpointGroupAssociationsRequest() - assert args[0] == request_msg @@ -14383,7 +14413,6 @@ async def test_get_intercept_endpoint_group_association_empty_call_grpc_asyncio( call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.GetInterceptEndpointGroupAssociationRequest() - assert args[0] == request_msg @@ -14410,7 +14439,6 @@ async def test_create_intercept_endpoint_group_association_empty_call_grpc_async call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.CreateInterceptEndpointGroupAssociationRequest() - assert args[0] == request_msg @@ -14437,7 +14465,6 @@ async def test_update_intercept_endpoint_group_association_empty_call_grpc_async call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.UpdateInterceptEndpointGroupAssociationRequest() - assert args[0] == request_msg @@ -14464,7 +14491,6 @@ async def test_delete_intercept_endpoint_group_association_empty_call_grpc_async call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.DeleteInterceptEndpointGroupAssociationRequest() - assert args[0] == request_msg @@ -14493,7 +14519,6 @@ async def test_list_intercept_deployment_groups_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.ListInterceptDeploymentGroupsRequest() - assert args[0] == request_msg @@ -14526,7 +14551,6 @@ async def test_get_intercept_deployment_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.GetInterceptDeploymentGroupRequest() - assert args[0] == request_msg @@ -14553,7 +14577,6 @@ async def test_create_intercept_deployment_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.CreateInterceptDeploymentGroupRequest() - assert args[0] == request_msg @@ -14580,7 +14603,6 @@ async def test_update_intercept_deployment_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.UpdateInterceptDeploymentGroupRequest() - assert args[0] == request_msg @@ -14607,7 +14629,6 @@ async def test_delete_intercept_deployment_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.DeleteInterceptDeploymentGroupRequest() - assert args[0] == request_msg @@ -14637,7 +14658,6 @@ async def test_list_intercept_deployments_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.ListInterceptDeploymentsRequest() - assert args[0] == request_msg @@ -14671,7 +14691,6 @@ async def test_get_intercept_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.GetInterceptDeploymentRequest() - assert args[0] == request_msg @@ -14698,7 +14717,6 @@ async def test_create_intercept_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.CreateInterceptDeploymentRequest() - assert args[0] == request_msg @@ -14725,7 +14743,6 @@ async def test_update_intercept_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.UpdateInterceptDeploymentRequest() - assert args[0] == request_msg @@ -14752,7 +14769,6 @@ async def test_delete_intercept_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.DeleteInterceptDeploymentRequest() - assert args[0] == request_msg @@ -18728,7 +18744,6 @@ def test_list_intercept_endpoint_groups_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.ListInterceptEndpointGroupsRequest() - assert args[0] == request_msg @@ -18750,7 +18765,6 @@ def test_get_intercept_endpoint_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.GetInterceptEndpointGroupRequest() - assert args[0] == request_msg @@ -18772,7 +18786,6 @@ def test_create_intercept_endpoint_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.CreateInterceptEndpointGroupRequest() - assert args[0] == request_msg @@ -18794,7 +18807,6 @@ def test_update_intercept_endpoint_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.UpdateInterceptEndpointGroupRequest() - assert args[0] == request_msg @@ -18816,7 +18828,6 @@ def test_delete_intercept_endpoint_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.DeleteInterceptEndpointGroupRequest() - assert args[0] == request_msg @@ -18838,7 +18849,6 @@ def test_list_intercept_endpoint_group_associations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.ListInterceptEndpointGroupAssociationsRequest() - assert args[0] == request_msg @@ -18860,7 +18870,6 @@ def test_get_intercept_endpoint_group_association_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.GetInterceptEndpointGroupAssociationRequest() - assert args[0] == request_msg @@ -18882,7 +18891,6 @@ def test_create_intercept_endpoint_group_association_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.CreateInterceptEndpointGroupAssociationRequest() - assert args[0] == request_msg @@ -18904,7 +18912,6 @@ def test_update_intercept_endpoint_group_association_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.UpdateInterceptEndpointGroupAssociationRequest() - assert args[0] == request_msg @@ -18926,7 +18933,6 @@ def test_delete_intercept_endpoint_group_association_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.DeleteInterceptEndpointGroupAssociationRequest() - assert args[0] == request_msg @@ -18948,7 +18954,6 @@ def test_list_intercept_deployment_groups_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.ListInterceptDeploymentGroupsRequest() - assert args[0] == request_msg @@ -18970,7 +18975,6 @@ def test_get_intercept_deployment_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.GetInterceptDeploymentGroupRequest() - assert args[0] == request_msg @@ -18992,7 +18996,6 @@ def test_create_intercept_deployment_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.CreateInterceptDeploymentGroupRequest() - assert args[0] == request_msg @@ -19014,7 +19017,6 @@ def test_update_intercept_deployment_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.UpdateInterceptDeploymentGroupRequest() - assert args[0] == request_msg @@ -19036,7 +19038,6 @@ def test_delete_intercept_deployment_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.DeleteInterceptDeploymentGroupRequest() - assert args[0] == request_msg @@ -19058,7 +19059,6 @@ def test_list_intercept_deployments_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.ListInterceptDeploymentsRequest() - assert args[0] == request_msg @@ -19080,7 +19080,6 @@ def test_get_intercept_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.GetInterceptDeploymentRequest() - assert args[0] == request_msg @@ -19102,7 +19101,6 @@ def test_create_intercept_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.CreateInterceptDeploymentRequest() - assert args[0] == request_msg @@ -19124,7 +19122,6 @@ def test_update_intercept_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.UpdateInterceptDeploymentRequest() - assert args[0] == request_msg @@ -19146,7 +19143,6 @@ def test_delete_intercept_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = intercept.DeleteInterceptDeploymentRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-network-security/tests/unit/gapic/network_security_v1alpha1/test_mirroring.py b/packages/google-cloud-network-security/tests/unit/gapic/network_security_v1alpha1/test_mirroring.py index ba1424cd9f44..4ada030e95fa 100644 --- a/packages/google-cloud-network-security/tests/unit/gapic/network_security_v1alpha1/test_mirroring.py +++ b/packages/google-cloud-network-security/tests/unit/gapic/network_security_v1alpha1/test_mirroring.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 @@ -121,6 +122,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" @@ -1278,8 +1294,8 @@ def test_mirroring_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - mirroring.ListMirroringEndpointGroupsRequest, - dict, + mirroring.ListMirroringEndpointGroupsRequest(), + {}, ], ) def test_list_mirroring_endpoint_groups(request_type, transport: str = "grpc"): @@ -1290,7 +1306,7 @@ def test_list_mirroring_endpoint_groups(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1341,12 +1357,13 @@ def test_list_mirroring_endpoint_groups_non_empty_request_with_auto_populated_fi client.list_mirroring_endpoint_groups(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == mirroring.ListMirroringEndpointGroupsRequest( + request_msg = mirroring.ListMirroringEndpointGroupsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_mirroring_endpoint_groups_use_cached_wrapped_rpc(): @@ -1432,9 +1449,15 @@ async def test_list_mirroring_endpoint_groups_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + mirroring.ListMirroringEndpointGroupsRequest(), + {}, + ], +) async def test_list_mirroring_endpoint_groups_async( - transport: str = "grpc_asyncio", - request_type=mirroring.ListMirroringEndpointGroupsRequest, + request_type, transport: str = "grpc_asyncio" ): client = MirroringAsyncClient( credentials=async_anonymous_credentials(), @@ -1443,7 +1466,7 @@ async def test_list_mirroring_endpoint_groups_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( @@ -1468,11 +1491,6 @@ async def test_list_mirroring_endpoint_groups_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_mirroring_endpoint_groups_async_from_dict(): - await test_list_mirroring_endpoint_groups_async(request_type=dict) - - def test_list_mirroring_endpoint_groups_field_headers(): client = MirroringClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1829,8 +1847,8 @@ async def test_list_mirroring_endpoint_groups_async_pages(): @pytest.mark.parametrize( "request_type", [ - mirroring.GetMirroringEndpointGroupRequest, - dict, + mirroring.GetMirroringEndpointGroupRequest(), + {}, ], ) def test_get_mirroring_endpoint_group(request_type, transport: str = "grpc"): @@ -1841,7 +1859,7 @@ def test_get_mirroring_endpoint_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1899,9 +1917,10 @@ def test_get_mirroring_endpoint_group_non_empty_request_with_auto_populated_fiel client.get_mirroring_endpoint_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == mirroring.GetMirroringEndpointGroupRequest( + request_msg = mirroring.GetMirroringEndpointGroupRequest( name="name_value", ) + assert args[0] == request_msg def test_get_mirroring_endpoint_group_use_cached_wrapped_rpc(): @@ -1987,9 +2006,15 @@ async def test_get_mirroring_endpoint_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + mirroring.GetMirroringEndpointGroupRequest(), + {}, + ], +) async def test_get_mirroring_endpoint_group_async( - transport: str = "grpc_asyncio", - request_type=mirroring.GetMirroringEndpointGroupRequest, + request_type, transport: str = "grpc_asyncio" ): client = MirroringAsyncClient( credentials=async_anonymous_credentials(), @@ -1998,7 +2023,7 @@ async def test_get_mirroring_endpoint_group_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( @@ -2033,11 +2058,6 @@ async def test_get_mirroring_endpoint_group_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_get_mirroring_endpoint_group_async_from_dict(): - await test_get_mirroring_endpoint_group_async(request_type=dict) - - def test_get_mirroring_endpoint_group_field_headers(): client = MirroringClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2192,8 +2212,8 @@ async def test_get_mirroring_endpoint_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - mirroring.CreateMirroringEndpointGroupRequest, - dict, + mirroring.CreateMirroringEndpointGroupRequest(), + {}, ], ) def test_create_mirroring_endpoint_group(request_type, transport: str = "grpc"): @@ -2204,7 +2224,7 @@ def test_create_mirroring_endpoint_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2250,10 +2270,11 @@ def test_create_mirroring_endpoint_group_non_empty_request_with_auto_populated_f client.create_mirroring_endpoint_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == mirroring.CreateMirroringEndpointGroupRequest( + request_msg = mirroring.CreateMirroringEndpointGroupRequest( parent="parent_value", mirroring_endpoint_group_id="mirroring_endpoint_group_id_value", ) + assert args[0] == request_msg def test_create_mirroring_endpoint_group_use_cached_wrapped_rpc(): @@ -2349,9 +2370,15 @@ async def test_create_mirroring_endpoint_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + mirroring.CreateMirroringEndpointGroupRequest(), + {}, + ], +) async def test_create_mirroring_endpoint_group_async( - transport: str = "grpc_asyncio", - request_type=mirroring.CreateMirroringEndpointGroupRequest, + request_type, transport: str = "grpc_asyncio" ): client = MirroringAsyncClient( credentials=async_anonymous_credentials(), @@ -2360,7 +2387,7 @@ async def test_create_mirroring_endpoint_group_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( @@ -2382,11 +2409,6 @@ async def test_create_mirroring_endpoint_group_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_mirroring_endpoint_group_async_from_dict(): - await test_create_mirroring_endpoint_group_async(request_type=dict) - - def test_create_mirroring_endpoint_group_field_headers(): client = MirroringClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2569,8 +2591,8 @@ async def test_create_mirroring_endpoint_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - mirroring.UpdateMirroringEndpointGroupRequest, - dict, + mirroring.UpdateMirroringEndpointGroupRequest(), + {}, ], ) def test_update_mirroring_endpoint_group(request_type, transport: str = "grpc"): @@ -2581,7 +2603,7 @@ def test_update_mirroring_endpoint_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2624,7 +2646,8 @@ def test_update_mirroring_endpoint_group_non_empty_request_with_auto_populated_f client.update_mirroring_endpoint_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == mirroring.UpdateMirroringEndpointGroupRequest() + request_msg = mirroring.UpdateMirroringEndpointGroupRequest() + assert args[0] == request_msg def test_update_mirroring_endpoint_group_use_cached_wrapped_rpc(): @@ -2720,9 +2743,15 @@ async def test_update_mirroring_endpoint_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + mirroring.UpdateMirroringEndpointGroupRequest(), + {}, + ], +) async def test_update_mirroring_endpoint_group_async( - transport: str = "grpc_asyncio", - request_type=mirroring.UpdateMirroringEndpointGroupRequest, + request_type, transport: str = "grpc_asyncio" ): client = MirroringAsyncClient( credentials=async_anonymous_credentials(), @@ -2731,7 +2760,7 @@ async def test_update_mirroring_endpoint_group_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( @@ -2753,11 +2782,6 @@ async def test_update_mirroring_endpoint_group_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_mirroring_endpoint_group_async_from_dict(): - await test_update_mirroring_endpoint_group_async(request_type=dict) - - def test_update_mirroring_endpoint_group_field_headers(): client = MirroringClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2930,8 +2954,8 @@ async def test_update_mirroring_endpoint_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - mirroring.DeleteMirroringEndpointGroupRequest, - dict, + mirroring.DeleteMirroringEndpointGroupRequest(), + {}, ], ) def test_delete_mirroring_endpoint_group(request_type, transport: str = "grpc"): @@ -2942,7 +2966,7 @@ def test_delete_mirroring_endpoint_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2987,9 +3011,10 @@ def test_delete_mirroring_endpoint_group_non_empty_request_with_auto_populated_f client.delete_mirroring_endpoint_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == mirroring.DeleteMirroringEndpointGroupRequest( + request_msg = mirroring.DeleteMirroringEndpointGroupRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_mirroring_endpoint_group_use_cached_wrapped_rpc(): @@ -3085,9 +3110,15 @@ async def test_delete_mirroring_endpoint_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + mirroring.DeleteMirroringEndpointGroupRequest(), + {}, + ], +) async def test_delete_mirroring_endpoint_group_async( - transport: str = "grpc_asyncio", - request_type=mirroring.DeleteMirroringEndpointGroupRequest, + request_type, transport: str = "grpc_asyncio" ): client = MirroringAsyncClient( credentials=async_anonymous_credentials(), @@ -3096,7 +3127,7 @@ async def test_delete_mirroring_endpoint_group_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( @@ -3118,11 +3149,6 @@ async def test_delete_mirroring_endpoint_group_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_mirroring_endpoint_group_async_from_dict(): - await test_delete_mirroring_endpoint_group_async(request_type=dict) - - def test_delete_mirroring_endpoint_group_field_headers(): client = MirroringClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3277,8 +3303,8 @@ async def test_delete_mirroring_endpoint_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - mirroring.ListMirroringEndpointGroupAssociationsRequest, - dict, + mirroring.ListMirroringEndpointGroupAssociationsRequest(), + {}, ], ) def test_list_mirroring_endpoint_group_associations( @@ -3291,7 +3317,7 @@ def test_list_mirroring_endpoint_group_associations( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3342,12 +3368,13 @@ def test_list_mirroring_endpoint_group_associations_non_empty_request_with_auto_ client.list_mirroring_endpoint_group_associations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == mirroring.ListMirroringEndpointGroupAssociationsRequest( + request_msg = mirroring.ListMirroringEndpointGroupAssociationsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_mirroring_endpoint_group_associations_use_cached_wrapped_rpc(): @@ -3433,9 +3460,15 @@ async def test_list_mirroring_endpoint_group_associations_async_use_cached_wrapp @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + mirroring.ListMirroringEndpointGroupAssociationsRequest(), + {}, + ], +) async def test_list_mirroring_endpoint_group_associations_async( - transport: str = "grpc_asyncio", - request_type=mirroring.ListMirroringEndpointGroupAssociationsRequest, + request_type, transport: str = "grpc_asyncio" ): client = MirroringAsyncClient( credentials=async_anonymous_credentials(), @@ -3444,7 +3477,7 @@ async def test_list_mirroring_endpoint_group_associations_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( @@ -3469,11 +3502,6 @@ async def test_list_mirroring_endpoint_group_associations_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_mirroring_endpoint_group_associations_async_from_dict(): - await test_list_mirroring_endpoint_group_associations_async(request_type=dict) - - def test_list_mirroring_endpoint_group_associations_field_headers(): client = MirroringClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3837,8 +3865,8 @@ async def test_list_mirroring_endpoint_group_associations_async_pages(): @pytest.mark.parametrize( "request_type", [ - mirroring.GetMirroringEndpointGroupAssociationRequest, - dict, + mirroring.GetMirroringEndpointGroupAssociationRequest(), + {}, ], ) def test_get_mirroring_endpoint_group_association( @@ -3851,7 +3879,7 @@ def test_get_mirroring_endpoint_group_association( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3907,9 +3935,10 @@ def test_get_mirroring_endpoint_group_association_non_empty_request_with_auto_po client.get_mirroring_endpoint_group_association(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == mirroring.GetMirroringEndpointGroupAssociationRequest( + request_msg = mirroring.GetMirroringEndpointGroupAssociationRequest( name="name_value", ) + assert args[0] == request_msg def test_get_mirroring_endpoint_group_association_use_cached_wrapped_rpc(): @@ -3995,9 +4024,15 @@ async def test_get_mirroring_endpoint_group_association_async_use_cached_wrapped @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + mirroring.GetMirroringEndpointGroupAssociationRequest(), + {}, + ], +) async def test_get_mirroring_endpoint_group_association_async( - transport: str = "grpc_asyncio", - request_type=mirroring.GetMirroringEndpointGroupAssociationRequest, + request_type, transport: str = "grpc_asyncio" ): client = MirroringAsyncClient( credentials=async_anonymous_credentials(), @@ -4006,7 +4041,7 @@ async def test_get_mirroring_endpoint_group_association_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( @@ -4039,11 +4074,6 @@ async def test_get_mirroring_endpoint_group_association_async( assert response.reconciling is True -@pytest.mark.asyncio -async def test_get_mirroring_endpoint_group_association_async_from_dict(): - await test_get_mirroring_endpoint_group_association_async(request_type=dict) - - def test_get_mirroring_endpoint_group_association_field_headers(): client = MirroringClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4198,8 +4228,8 @@ async def test_get_mirroring_endpoint_group_association_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - mirroring.CreateMirroringEndpointGroupAssociationRequest, - dict, + mirroring.CreateMirroringEndpointGroupAssociationRequest(), + {}, ], ) def test_create_mirroring_endpoint_group_association( @@ -4212,7 +4242,7 @@ def test_create_mirroring_endpoint_group_association( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4258,10 +4288,11 @@ def test_create_mirroring_endpoint_group_association_non_empty_request_with_auto client.create_mirroring_endpoint_group_association(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == mirroring.CreateMirroringEndpointGroupAssociationRequest( + request_msg = mirroring.CreateMirroringEndpointGroupAssociationRequest( parent="parent_value", mirroring_endpoint_group_association_id="mirroring_endpoint_group_association_id_value", ) + assert args[0] == request_msg def test_create_mirroring_endpoint_group_association_use_cached_wrapped_rpc(): @@ -4357,9 +4388,15 @@ async def test_create_mirroring_endpoint_group_association_async_use_cached_wrap @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + mirroring.CreateMirroringEndpointGroupAssociationRequest(), + {}, + ], +) async def test_create_mirroring_endpoint_group_association_async( - transport: str = "grpc_asyncio", - request_type=mirroring.CreateMirroringEndpointGroupAssociationRequest, + request_type, transport: str = "grpc_asyncio" ): client = MirroringAsyncClient( credentials=async_anonymous_credentials(), @@ -4368,7 +4405,7 @@ async def test_create_mirroring_endpoint_group_association_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( @@ -4390,11 +4427,6 @@ async def test_create_mirroring_endpoint_group_association_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_mirroring_endpoint_group_association_async_from_dict(): - await test_create_mirroring_endpoint_group_association_async(request_type=dict) - - def test_create_mirroring_endpoint_group_association_field_headers(): client = MirroringClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4577,8 +4609,8 @@ async def test_create_mirroring_endpoint_group_association_flattened_error_async @pytest.mark.parametrize( "request_type", [ - mirroring.UpdateMirroringEndpointGroupAssociationRequest, - dict, + mirroring.UpdateMirroringEndpointGroupAssociationRequest(), + {}, ], ) def test_update_mirroring_endpoint_group_association( @@ -4591,7 +4623,7 @@ def test_update_mirroring_endpoint_group_association( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4634,7 +4666,8 @@ def test_update_mirroring_endpoint_group_association_non_empty_request_with_auto client.update_mirroring_endpoint_group_association(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == mirroring.UpdateMirroringEndpointGroupAssociationRequest() + request_msg = mirroring.UpdateMirroringEndpointGroupAssociationRequest() + assert args[0] == request_msg def test_update_mirroring_endpoint_group_association_use_cached_wrapped_rpc(): @@ -4730,9 +4763,15 @@ async def test_update_mirroring_endpoint_group_association_async_use_cached_wrap @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + mirroring.UpdateMirroringEndpointGroupAssociationRequest(), + {}, + ], +) async def test_update_mirroring_endpoint_group_association_async( - transport: str = "grpc_asyncio", - request_type=mirroring.UpdateMirroringEndpointGroupAssociationRequest, + request_type, transport: str = "grpc_asyncio" ): client = MirroringAsyncClient( credentials=async_anonymous_credentials(), @@ -4741,7 +4780,7 @@ async def test_update_mirroring_endpoint_group_association_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( @@ -4763,11 +4802,6 @@ async def test_update_mirroring_endpoint_group_association_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_mirroring_endpoint_group_association_async_from_dict(): - await test_update_mirroring_endpoint_group_association_async(request_type=dict) - - def test_update_mirroring_endpoint_group_association_field_headers(): client = MirroringClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4940,8 +4974,8 @@ async def test_update_mirroring_endpoint_group_association_flattened_error_async @pytest.mark.parametrize( "request_type", [ - mirroring.DeleteMirroringEndpointGroupAssociationRequest, - dict, + mirroring.DeleteMirroringEndpointGroupAssociationRequest(), + {}, ], ) def test_delete_mirroring_endpoint_group_association( @@ -4954,7 +4988,7 @@ def test_delete_mirroring_endpoint_group_association( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4999,9 +5033,10 @@ def test_delete_mirroring_endpoint_group_association_non_empty_request_with_auto client.delete_mirroring_endpoint_group_association(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == mirroring.DeleteMirroringEndpointGroupAssociationRequest( + request_msg = mirroring.DeleteMirroringEndpointGroupAssociationRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_mirroring_endpoint_group_association_use_cached_wrapped_rpc(): @@ -5097,9 +5132,15 @@ async def test_delete_mirroring_endpoint_group_association_async_use_cached_wrap @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + mirroring.DeleteMirroringEndpointGroupAssociationRequest(), + {}, + ], +) async def test_delete_mirroring_endpoint_group_association_async( - transport: str = "grpc_asyncio", - request_type=mirroring.DeleteMirroringEndpointGroupAssociationRequest, + request_type, transport: str = "grpc_asyncio" ): client = MirroringAsyncClient( credentials=async_anonymous_credentials(), @@ -5108,7 +5149,7 @@ async def test_delete_mirroring_endpoint_group_association_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( @@ -5130,11 +5171,6 @@ async def test_delete_mirroring_endpoint_group_association_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_mirroring_endpoint_group_association_async_from_dict(): - await test_delete_mirroring_endpoint_group_association_async(request_type=dict) - - def test_delete_mirroring_endpoint_group_association_field_headers(): client = MirroringClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5289,8 +5325,8 @@ async def test_delete_mirroring_endpoint_group_association_flattened_error_async @pytest.mark.parametrize( "request_type", [ - mirroring.ListMirroringDeploymentGroupsRequest, - dict, + mirroring.ListMirroringDeploymentGroupsRequest(), + {}, ], ) def test_list_mirroring_deployment_groups(request_type, transport: str = "grpc"): @@ -5301,7 +5337,7 @@ def test_list_mirroring_deployment_groups(request_type, transport: str = "grpc") # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5352,12 +5388,13 @@ def test_list_mirroring_deployment_groups_non_empty_request_with_auto_populated_ client.list_mirroring_deployment_groups(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == mirroring.ListMirroringDeploymentGroupsRequest( + request_msg = mirroring.ListMirroringDeploymentGroupsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_mirroring_deployment_groups_use_cached_wrapped_rpc(): @@ -5443,9 +5480,15 @@ async def test_list_mirroring_deployment_groups_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + mirroring.ListMirroringDeploymentGroupsRequest(), + {}, + ], +) async def test_list_mirroring_deployment_groups_async( - transport: str = "grpc_asyncio", - request_type=mirroring.ListMirroringDeploymentGroupsRequest, + request_type, transport: str = "grpc_asyncio" ): client = MirroringAsyncClient( credentials=async_anonymous_credentials(), @@ -5454,7 +5497,7 @@ async def test_list_mirroring_deployment_groups_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( @@ -5479,11 +5522,6 @@ async def test_list_mirroring_deployment_groups_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_mirroring_deployment_groups_async_from_dict(): - await test_list_mirroring_deployment_groups_async(request_type=dict) - - def test_list_mirroring_deployment_groups_field_headers(): client = MirroringClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5840,8 +5878,8 @@ async def test_list_mirroring_deployment_groups_async_pages(): @pytest.mark.parametrize( "request_type", [ - mirroring.GetMirroringDeploymentGroupRequest, - dict, + mirroring.GetMirroringDeploymentGroupRequest(), + {}, ], ) def test_get_mirroring_deployment_group(request_type, transport: str = "grpc"): @@ -5852,7 +5890,7 @@ def test_get_mirroring_deployment_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5908,9 +5946,10 @@ def test_get_mirroring_deployment_group_non_empty_request_with_auto_populated_fi client.get_mirroring_deployment_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == mirroring.GetMirroringDeploymentGroupRequest( + request_msg = mirroring.GetMirroringDeploymentGroupRequest( name="name_value", ) + assert args[0] == request_msg def test_get_mirroring_deployment_group_use_cached_wrapped_rpc(): @@ -5996,9 +6035,15 @@ async def test_get_mirroring_deployment_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + mirroring.GetMirroringDeploymentGroupRequest(), + {}, + ], +) async def test_get_mirroring_deployment_group_async( - transport: str = "grpc_asyncio", - request_type=mirroring.GetMirroringDeploymentGroupRequest, + request_type, transport: str = "grpc_asyncio" ): client = MirroringAsyncClient( credentials=async_anonymous_credentials(), @@ -6007,7 +6052,7 @@ async def test_get_mirroring_deployment_group_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( @@ -6040,11 +6085,6 @@ async def test_get_mirroring_deployment_group_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_get_mirroring_deployment_group_async_from_dict(): - await test_get_mirroring_deployment_group_async(request_type=dict) - - def test_get_mirroring_deployment_group_field_headers(): client = MirroringClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6199,8 +6239,8 @@ async def test_get_mirroring_deployment_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - mirroring.CreateMirroringDeploymentGroupRequest, - dict, + mirroring.CreateMirroringDeploymentGroupRequest(), + {}, ], ) def test_create_mirroring_deployment_group(request_type, transport: str = "grpc"): @@ -6211,7 +6251,7 @@ def test_create_mirroring_deployment_group(request_type, transport: str = "grpc" # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6257,10 +6297,11 @@ def test_create_mirroring_deployment_group_non_empty_request_with_auto_populated client.create_mirroring_deployment_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == mirroring.CreateMirroringDeploymentGroupRequest( + request_msg = mirroring.CreateMirroringDeploymentGroupRequest( parent="parent_value", mirroring_deployment_group_id="mirroring_deployment_group_id_value", ) + assert args[0] == request_msg def test_create_mirroring_deployment_group_use_cached_wrapped_rpc(): @@ -6356,9 +6397,15 @@ async def test_create_mirroring_deployment_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + mirroring.CreateMirroringDeploymentGroupRequest(), + {}, + ], +) async def test_create_mirroring_deployment_group_async( - transport: str = "grpc_asyncio", - request_type=mirroring.CreateMirroringDeploymentGroupRequest, + request_type, transport: str = "grpc_asyncio" ): client = MirroringAsyncClient( credentials=async_anonymous_credentials(), @@ -6367,7 +6414,7 @@ async def test_create_mirroring_deployment_group_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( @@ -6389,11 +6436,6 @@ async def test_create_mirroring_deployment_group_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_mirroring_deployment_group_async_from_dict(): - await test_create_mirroring_deployment_group_async(request_type=dict) - - def test_create_mirroring_deployment_group_field_headers(): client = MirroringClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6576,8 +6618,8 @@ async def test_create_mirroring_deployment_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - mirroring.UpdateMirroringDeploymentGroupRequest, - dict, + mirroring.UpdateMirroringDeploymentGroupRequest(), + {}, ], ) def test_update_mirroring_deployment_group(request_type, transport: str = "grpc"): @@ -6588,7 +6630,7 @@ def test_update_mirroring_deployment_group(request_type, transport: str = "grpc" # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6631,7 +6673,8 @@ def test_update_mirroring_deployment_group_non_empty_request_with_auto_populated client.update_mirroring_deployment_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == mirroring.UpdateMirroringDeploymentGroupRequest() + request_msg = mirroring.UpdateMirroringDeploymentGroupRequest() + assert args[0] == request_msg def test_update_mirroring_deployment_group_use_cached_wrapped_rpc(): @@ -6727,9 +6770,15 @@ async def test_update_mirroring_deployment_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + mirroring.UpdateMirroringDeploymentGroupRequest(), + {}, + ], +) async def test_update_mirroring_deployment_group_async( - transport: str = "grpc_asyncio", - request_type=mirroring.UpdateMirroringDeploymentGroupRequest, + request_type, transport: str = "grpc_asyncio" ): client = MirroringAsyncClient( credentials=async_anonymous_credentials(), @@ -6738,7 +6787,7 @@ async def test_update_mirroring_deployment_group_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( @@ -6760,11 +6809,6 @@ async def test_update_mirroring_deployment_group_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_mirroring_deployment_group_async_from_dict(): - await test_update_mirroring_deployment_group_async(request_type=dict) - - def test_update_mirroring_deployment_group_field_headers(): client = MirroringClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6937,8 +6981,8 @@ async def test_update_mirroring_deployment_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - mirroring.DeleteMirroringDeploymentGroupRequest, - dict, + mirroring.DeleteMirroringDeploymentGroupRequest(), + {}, ], ) def test_delete_mirroring_deployment_group(request_type, transport: str = "grpc"): @@ -6949,7 +6993,7 @@ def test_delete_mirroring_deployment_group(request_type, transport: str = "grpc" # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6994,9 +7038,10 @@ def test_delete_mirroring_deployment_group_non_empty_request_with_auto_populated client.delete_mirroring_deployment_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == mirroring.DeleteMirroringDeploymentGroupRequest( + request_msg = mirroring.DeleteMirroringDeploymentGroupRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_mirroring_deployment_group_use_cached_wrapped_rpc(): @@ -7092,9 +7137,15 @@ async def test_delete_mirroring_deployment_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + mirroring.DeleteMirroringDeploymentGroupRequest(), + {}, + ], +) async def test_delete_mirroring_deployment_group_async( - transport: str = "grpc_asyncio", - request_type=mirroring.DeleteMirroringDeploymentGroupRequest, + request_type, transport: str = "grpc_asyncio" ): client = MirroringAsyncClient( credentials=async_anonymous_credentials(), @@ -7103,7 +7154,7 @@ async def test_delete_mirroring_deployment_group_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( @@ -7125,11 +7176,6 @@ async def test_delete_mirroring_deployment_group_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_mirroring_deployment_group_async_from_dict(): - await test_delete_mirroring_deployment_group_async(request_type=dict) - - def test_delete_mirroring_deployment_group_field_headers(): client = MirroringClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7284,8 +7330,8 @@ async def test_delete_mirroring_deployment_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - mirroring.ListMirroringDeploymentsRequest, - dict, + mirroring.ListMirroringDeploymentsRequest(), + {}, ], ) def test_list_mirroring_deployments(request_type, transport: str = "grpc"): @@ -7296,7 +7342,7 @@ def test_list_mirroring_deployments(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7349,12 +7395,13 @@ def test_list_mirroring_deployments_non_empty_request_with_auto_populated_field( client.list_mirroring_deployments(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == mirroring.ListMirroringDeploymentsRequest( + request_msg = mirroring.ListMirroringDeploymentsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_mirroring_deployments_use_cached_wrapped_rpc(): @@ -7440,9 +7487,15 @@ async def test_list_mirroring_deployments_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + mirroring.ListMirroringDeploymentsRequest(), + {}, + ], +) async def test_list_mirroring_deployments_async( - transport: str = "grpc_asyncio", - request_type=mirroring.ListMirroringDeploymentsRequest, + request_type, transport: str = "grpc_asyncio" ): client = MirroringAsyncClient( credentials=async_anonymous_credentials(), @@ -7451,7 +7504,7 @@ async def test_list_mirroring_deployments_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( @@ -7478,11 +7531,6 @@ async def test_list_mirroring_deployments_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_mirroring_deployments_async_from_dict(): - await test_list_mirroring_deployments_async(request_type=dict) - - def test_list_mirroring_deployments_field_headers(): client = MirroringClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7837,8 +7885,8 @@ async def test_list_mirroring_deployments_async_pages(): @pytest.mark.parametrize( "request_type", [ - mirroring.GetMirroringDeploymentRequest, - dict, + mirroring.GetMirroringDeploymentRequest(), + {}, ], ) def test_get_mirroring_deployment(request_type, transport: str = "grpc"): @@ -7849,7 +7897,7 @@ def test_get_mirroring_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7907,9 +7955,10 @@ def test_get_mirroring_deployment_non_empty_request_with_auto_populated_field(): client.get_mirroring_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == mirroring.GetMirroringDeploymentRequest( + request_msg = mirroring.GetMirroringDeploymentRequest( name="name_value", ) + assert args[0] == request_msg def test_get_mirroring_deployment_use_cached_wrapped_rpc(): @@ -7995,9 +8044,15 @@ async def test_get_mirroring_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + mirroring.GetMirroringDeploymentRequest(), + {}, + ], +) async def test_get_mirroring_deployment_async( - transport: str = "grpc_asyncio", - request_type=mirroring.GetMirroringDeploymentRequest, + request_type, transport: str = "grpc_asyncio" ): client = MirroringAsyncClient( credentials=async_anonymous_credentials(), @@ -8006,7 +8061,7 @@ async def test_get_mirroring_deployment_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( @@ -8041,11 +8096,6 @@ async def test_get_mirroring_deployment_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_get_mirroring_deployment_async_from_dict(): - await test_get_mirroring_deployment_async(request_type=dict) - - def test_get_mirroring_deployment_field_headers(): client = MirroringClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8200,8 +8250,8 @@ async def test_get_mirroring_deployment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - mirroring.CreateMirroringDeploymentRequest, - dict, + mirroring.CreateMirroringDeploymentRequest(), + {}, ], ) def test_create_mirroring_deployment(request_type, transport: str = "grpc"): @@ -8212,7 +8262,7 @@ def test_create_mirroring_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8258,10 +8308,11 @@ def test_create_mirroring_deployment_non_empty_request_with_auto_populated_field client.create_mirroring_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == mirroring.CreateMirroringDeploymentRequest( + request_msg = mirroring.CreateMirroringDeploymentRequest( parent="parent_value", mirroring_deployment_id="mirroring_deployment_id_value", ) + assert args[0] == request_msg def test_create_mirroring_deployment_use_cached_wrapped_rpc(): @@ -8357,9 +8408,15 @@ async def test_create_mirroring_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + mirroring.CreateMirroringDeploymentRequest(), + {}, + ], +) async def test_create_mirroring_deployment_async( - transport: str = "grpc_asyncio", - request_type=mirroring.CreateMirroringDeploymentRequest, + request_type, transport: str = "grpc_asyncio" ): client = MirroringAsyncClient( credentials=async_anonymous_credentials(), @@ -8368,7 +8425,7 @@ async def test_create_mirroring_deployment_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( @@ -8390,11 +8447,6 @@ async def test_create_mirroring_deployment_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_mirroring_deployment_async_from_dict(): - await test_create_mirroring_deployment_async(request_type=dict) - - def test_create_mirroring_deployment_field_headers(): client = MirroringClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8569,8 +8621,8 @@ async def test_create_mirroring_deployment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - mirroring.UpdateMirroringDeploymentRequest, - dict, + mirroring.UpdateMirroringDeploymentRequest(), + {}, ], ) def test_update_mirroring_deployment(request_type, transport: str = "grpc"): @@ -8581,7 +8633,7 @@ def test_update_mirroring_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8624,7 +8676,8 @@ def test_update_mirroring_deployment_non_empty_request_with_auto_populated_field client.update_mirroring_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == mirroring.UpdateMirroringDeploymentRequest() + request_msg = mirroring.UpdateMirroringDeploymentRequest() + assert args[0] == request_msg def test_update_mirroring_deployment_use_cached_wrapped_rpc(): @@ -8720,9 +8773,15 @@ async def test_update_mirroring_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + mirroring.UpdateMirroringDeploymentRequest(), + {}, + ], +) async def test_update_mirroring_deployment_async( - transport: str = "grpc_asyncio", - request_type=mirroring.UpdateMirroringDeploymentRequest, + request_type, transport: str = "grpc_asyncio" ): client = MirroringAsyncClient( credentials=async_anonymous_credentials(), @@ -8731,7 +8790,7 @@ async def test_update_mirroring_deployment_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( @@ -8753,11 +8812,6 @@ async def test_update_mirroring_deployment_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_mirroring_deployment_async_from_dict(): - await test_update_mirroring_deployment_async(request_type=dict) - - def test_update_mirroring_deployment_field_headers(): client = MirroringClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8922,8 +8976,8 @@ async def test_update_mirroring_deployment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - mirroring.DeleteMirroringDeploymentRequest, - dict, + mirroring.DeleteMirroringDeploymentRequest(), + {}, ], ) def test_delete_mirroring_deployment(request_type, transport: str = "grpc"): @@ -8934,7 +8988,7 @@ def test_delete_mirroring_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8979,9 +9033,10 @@ def test_delete_mirroring_deployment_non_empty_request_with_auto_populated_field client.delete_mirroring_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == mirroring.DeleteMirroringDeploymentRequest( + request_msg = mirroring.DeleteMirroringDeploymentRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_mirroring_deployment_use_cached_wrapped_rpc(): @@ -9077,9 +9132,15 @@ async def test_delete_mirroring_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + mirroring.DeleteMirroringDeploymentRequest(), + {}, + ], +) async def test_delete_mirroring_deployment_async( - transport: str = "grpc_asyncio", - request_type=mirroring.DeleteMirroringDeploymentRequest, + request_type, transport: str = "grpc_asyncio" ): client = MirroringAsyncClient( credentials=async_anonymous_credentials(), @@ -9088,7 +9149,7 @@ async def test_delete_mirroring_deployment_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( @@ -9110,11 +9171,6 @@ async def test_delete_mirroring_deployment_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_mirroring_deployment_async_from_dict(): - await test_delete_mirroring_deployment_async(request_type=dict) - - def test_delete_mirroring_deployment_field_headers(): client = MirroringClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13731,7 +13787,6 @@ def test_list_mirroring_endpoint_groups_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.ListMirroringEndpointGroupsRequest() - assert args[0] == request_msg @@ -13754,7 +13809,6 @@ def test_get_mirroring_endpoint_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.GetMirroringEndpointGroupRequest() - assert args[0] == request_msg @@ -13777,7 +13831,6 @@ def test_create_mirroring_endpoint_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.CreateMirroringEndpointGroupRequest() - assert args[0] == request_msg @@ -13800,7 +13853,6 @@ def test_update_mirroring_endpoint_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.UpdateMirroringEndpointGroupRequest() - assert args[0] == request_msg @@ -13823,7 +13875,6 @@ def test_delete_mirroring_endpoint_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.DeleteMirroringEndpointGroupRequest() - assert args[0] == request_msg @@ -13846,7 +13897,6 @@ def test_list_mirroring_endpoint_group_associations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.ListMirroringEndpointGroupAssociationsRequest() - assert args[0] == request_msg @@ -13869,7 +13919,6 @@ def test_get_mirroring_endpoint_group_association_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.GetMirroringEndpointGroupAssociationRequest() - assert args[0] == request_msg @@ -13892,7 +13941,6 @@ def test_create_mirroring_endpoint_group_association_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.CreateMirroringEndpointGroupAssociationRequest() - assert args[0] == request_msg @@ -13915,7 +13963,6 @@ def test_update_mirroring_endpoint_group_association_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.UpdateMirroringEndpointGroupAssociationRequest() - assert args[0] == request_msg @@ -13938,7 +13985,6 @@ def test_delete_mirroring_endpoint_group_association_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.DeleteMirroringEndpointGroupAssociationRequest() - assert args[0] == request_msg @@ -13961,7 +14007,6 @@ def test_list_mirroring_deployment_groups_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.ListMirroringDeploymentGroupsRequest() - assert args[0] == request_msg @@ -13984,7 +14029,6 @@ def test_get_mirroring_deployment_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.GetMirroringDeploymentGroupRequest() - assert args[0] == request_msg @@ -14007,7 +14051,6 @@ def test_create_mirroring_deployment_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.CreateMirroringDeploymentGroupRequest() - assert args[0] == request_msg @@ -14030,7 +14073,6 @@ def test_update_mirroring_deployment_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.UpdateMirroringDeploymentGroupRequest() - assert args[0] == request_msg @@ -14053,7 +14095,6 @@ def test_delete_mirroring_deployment_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.DeleteMirroringDeploymentGroupRequest() - assert args[0] == request_msg @@ -14076,7 +14117,6 @@ def test_list_mirroring_deployments_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.ListMirroringDeploymentsRequest() - assert args[0] == request_msg @@ -14099,7 +14139,6 @@ def test_get_mirroring_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.GetMirroringDeploymentRequest() - assert args[0] == request_msg @@ -14122,7 +14161,6 @@ def test_create_mirroring_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.CreateMirroringDeploymentRequest() - assert args[0] == request_msg @@ -14145,7 +14183,6 @@ def test_update_mirroring_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.UpdateMirroringDeploymentRequest() - assert args[0] == request_msg @@ -14168,7 +14205,6 @@ def test_delete_mirroring_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.DeleteMirroringDeploymentRequest() - assert args[0] == request_msg @@ -14211,7 +14247,6 @@ async def test_list_mirroring_endpoint_groups_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.ListMirroringEndpointGroupsRequest() - assert args[0] == request_msg @@ -14245,7 +14280,6 @@ async def test_get_mirroring_endpoint_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.GetMirroringEndpointGroupRequest() - assert args[0] == request_msg @@ -14272,7 +14306,6 @@ async def test_create_mirroring_endpoint_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.CreateMirroringEndpointGroupRequest() - assert args[0] == request_msg @@ -14299,7 +14332,6 @@ async def test_update_mirroring_endpoint_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.UpdateMirroringEndpointGroupRequest() - assert args[0] == request_msg @@ -14326,7 +14358,6 @@ async def test_delete_mirroring_endpoint_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.DeleteMirroringEndpointGroupRequest() - assert args[0] == request_msg @@ -14355,7 +14386,6 @@ async def test_list_mirroring_endpoint_group_associations_empty_call_grpc_asynci call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.ListMirroringEndpointGroupAssociationsRequest() - assert args[0] == request_msg @@ -14388,7 +14418,6 @@ async def test_get_mirroring_endpoint_group_association_empty_call_grpc_asyncio( call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.GetMirroringEndpointGroupAssociationRequest() - assert args[0] == request_msg @@ -14415,7 +14444,6 @@ async def test_create_mirroring_endpoint_group_association_empty_call_grpc_async call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.CreateMirroringEndpointGroupAssociationRequest() - assert args[0] == request_msg @@ -14442,7 +14470,6 @@ async def test_update_mirroring_endpoint_group_association_empty_call_grpc_async call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.UpdateMirroringEndpointGroupAssociationRequest() - assert args[0] == request_msg @@ -14469,7 +14496,6 @@ async def test_delete_mirroring_endpoint_group_association_empty_call_grpc_async call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.DeleteMirroringEndpointGroupAssociationRequest() - assert args[0] == request_msg @@ -14498,7 +14524,6 @@ async def test_list_mirroring_deployment_groups_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.ListMirroringDeploymentGroupsRequest() - assert args[0] == request_msg @@ -14531,7 +14556,6 @@ async def test_get_mirroring_deployment_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.GetMirroringDeploymentGroupRequest() - assert args[0] == request_msg @@ -14558,7 +14582,6 @@ async def test_create_mirroring_deployment_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.CreateMirroringDeploymentGroupRequest() - assert args[0] == request_msg @@ -14585,7 +14608,6 @@ async def test_update_mirroring_deployment_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.UpdateMirroringDeploymentGroupRequest() - assert args[0] == request_msg @@ -14612,7 +14634,6 @@ async def test_delete_mirroring_deployment_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.DeleteMirroringDeploymentGroupRequest() - assert args[0] == request_msg @@ -14642,7 +14663,6 @@ async def test_list_mirroring_deployments_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.ListMirroringDeploymentsRequest() - assert args[0] == request_msg @@ -14676,7 +14696,6 @@ async def test_get_mirroring_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.GetMirroringDeploymentRequest() - assert args[0] == request_msg @@ -14703,7 +14722,6 @@ async def test_create_mirroring_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.CreateMirroringDeploymentRequest() - assert args[0] == request_msg @@ -14730,7 +14748,6 @@ async def test_update_mirroring_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.UpdateMirroringDeploymentRequest() - assert args[0] == request_msg @@ -14757,7 +14774,6 @@ async def test_delete_mirroring_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.DeleteMirroringDeploymentRequest() - assert args[0] == request_msg @@ -18741,7 +18757,6 @@ def test_list_mirroring_endpoint_groups_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.ListMirroringEndpointGroupsRequest() - assert args[0] == request_msg @@ -18763,7 +18778,6 @@ def test_get_mirroring_endpoint_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.GetMirroringEndpointGroupRequest() - assert args[0] == request_msg @@ -18785,7 +18799,6 @@ def test_create_mirroring_endpoint_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.CreateMirroringEndpointGroupRequest() - assert args[0] == request_msg @@ -18807,7 +18820,6 @@ def test_update_mirroring_endpoint_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.UpdateMirroringEndpointGroupRequest() - assert args[0] == request_msg @@ -18829,7 +18841,6 @@ def test_delete_mirroring_endpoint_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.DeleteMirroringEndpointGroupRequest() - assert args[0] == request_msg @@ -18851,7 +18862,6 @@ def test_list_mirroring_endpoint_group_associations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.ListMirroringEndpointGroupAssociationsRequest() - assert args[0] == request_msg @@ -18873,7 +18883,6 @@ def test_get_mirroring_endpoint_group_association_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.GetMirroringEndpointGroupAssociationRequest() - assert args[0] == request_msg @@ -18895,7 +18904,6 @@ def test_create_mirroring_endpoint_group_association_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.CreateMirroringEndpointGroupAssociationRequest() - assert args[0] == request_msg @@ -18917,7 +18925,6 @@ def test_update_mirroring_endpoint_group_association_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.UpdateMirroringEndpointGroupAssociationRequest() - assert args[0] == request_msg @@ -18939,7 +18946,6 @@ def test_delete_mirroring_endpoint_group_association_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.DeleteMirroringEndpointGroupAssociationRequest() - assert args[0] == request_msg @@ -18961,7 +18967,6 @@ def test_list_mirroring_deployment_groups_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.ListMirroringDeploymentGroupsRequest() - assert args[0] == request_msg @@ -18983,7 +18988,6 @@ def test_get_mirroring_deployment_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.GetMirroringDeploymentGroupRequest() - assert args[0] == request_msg @@ -19005,7 +19009,6 @@ def test_create_mirroring_deployment_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.CreateMirroringDeploymentGroupRequest() - assert args[0] == request_msg @@ -19027,7 +19030,6 @@ def test_update_mirroring_deployment_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.UpdateMirroringDeploymentGroupRequest() - assert args[0] == request_msg @@ -19049,7 +19051,6 @@ def test_delete_mirroring_deployment_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.DeleteMirroringDeploymentGroupRequest() - assert args[0] == request_msg @@ -19071,7 +19072,6 @@ def test_list_mirroring_deployments_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.ListMirroringDeploymentsRequest() - assert args[0] == request_msg @@ -19093,7 +19093,6 @@ def test_get_mirroring_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.GetMirroringDeploymentRequest() - assert args[0] == request_msg @@ -19115,7 +19114,6 @@ def test_create_mirroring_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.CreateMirroringDeploymentRequest() - assert args[0] == request_msg @@ -19137,7 +19135,6 @@ def test_update_mirroring_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.UpdateMirroringDeploymentRequest() - assert args[0] == request_msg @@ -19159,7 +19156,6 @@ def test_delete_mirroring_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mirroring.DeleteMirroringDeploymentRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-network-security/tests/unit/gapic/network_security_v1alpha1/test_network_security.py b/packages/google-cloud-network-security/tests/unit/gapic/network_security_v1alpha1/test_network_security.py index 3ed45efa74a8..8593999c9031 100644 --- a/packages/google-cloud-network-security/tests/unit/gapic/network_security_v1alpha1/test_network_security.py +++ b/packages/google-cloud-network-security/tests/unit/gapic/network_security_v1alpha1/test_network_security.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 @@ -158,6 +159,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" @@ -1385,8 +1401,8 @@ def test_network_security_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - authorization_policy.ListAuthorizationPoliciesRequest, - dict, + authorization_policy.ListAuthorizationPoliciesRequest(), + {}, ], ) def test_list_authorization_policies(request_type, transport: str = "grpc"): @@ -1397,7 +1413,7 @@ def test_list_authorization_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( @@ -1446,10 +1462,11 @@ def test_list_authorization_policies_non_empty_request_with_auto_populated_field client.list_authorization_policies(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == authorization_policy.ListAuthorizationPoliciesRequest( + request_msg = authorization_policy.ListAuthorizationPoliciesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_authorization_policies_use_cached_wrapped_rpc(): @@ -1535,9 +1552,15 @@ async def test_list_authorization_policies_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + authorization_policy.ListAuthorizationPoliciesRequest(), + {}, + ], +) async def test_list_authorization_policies_async( - transport: str = "grpc_asyncio", - request_type=authorization_policy.ListAuthorizationPoliciesRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -1546,7 +1569,7 @@ async def test_list_authorization_policies_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( @@ -1571,11 +1594,6 @@ async def test_list_authorization_policies_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_authorization_policies_async_from_dict(): - await test_list_authorization_policies_async(request_type=dict) - - def test_list_authorization_policies_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1934,8 +1952,8 @@ async def test_list_authorization_policies_async_pages(): @pytest.mark.parametrize( "request_type", [ - authorization_policy.GetAuthorizationPolicyRequest, - dict, + authorization_policy.GetAuthorizationPolicyRequest(), + {}, ], ) def test_get_authorization_policy(request_type, transport: str = "grpc"): @@ -1946,7 +1964,7 @@ def test_get_authorization_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( @@ -1998,9 +2016,10 @@ def test_get_authorization_policy_non_empty_request_with_auto_populated_field(): client.get_authorization_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == authorization_policy.GetAuthorizationPolicyRequest( + request_msg = authorization_policy.GetAuthorizationPolicyRequest( name="name_value", ) + assert args[0] == request_msg def test_get_authorization_policy_use_cached_wrapped_rpc(): @@ -2086,9 +2105,15 @@ async def test_get_authorization_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + authorization_policy.GetAuthorizationPolicyRequest(), + {}, + ], +) async def test_get_authorization_policy_async( - transport: str = "grpc_asyncio", - request_type=authorization_policy.GetAuthorizationPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -2097,7 +2122,7 @@ async def test_get_authorization_policy_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( @@ -2126,11 +2151,6 @@ async def test_get_authorization_policy_async( assert response.action == authorization_policy.AuthorizationPolicy.Action.ALLOW -@pytest.mark.asyncio -async def test_get_authorization_policy_async_from_dict(): - await test_get_authorization_policy_async(request_type=dict) - - def test_get_authorization_policy_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2285,8 +2305,8 @@ async def test_get_authorization_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_authorization_policy.CreateAuthorizationPolicyRequest, - dict, + gcn_authorization_policy.CreateAuthorizationPolicyRequest(), + {}, ], ) def test_create_authorization_policy(request_type, transport: str = "grpc"): @@ -2297,7 +2317,7 @@ def test_create_authorization_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( @@ -2343,10 +2363,11 @@ def test_create_authorization_policy_non_empty_request_with_auto_populated_field client.create_authorization_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_authorization_policy.CreateAuthorizationPolicyRequest( + request_msg = gcn_authorization_policy.CreateAuthorizationPolicyRequest( parent="parent_value", authorization_policy_id="authorization_policy_id_value", ) + assert args[0] == request_msg def test_create_authorization_policy_use_cached_wrapped_rpc(): @@ -2442,9 +2463,15 @@ async def test_create_authorization_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcn_authorization_policy.CreateAuthorizationPolicyRequest(), + {}, + ], +) async def test_create_authorization_policy_async( - transport: str = "grpc_asyncio", - request_type=gcn_authorization_policy.CreateAuthorizationPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -2453,7 +2480,7 @@ async def test_create_authorization_policy_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( @@ -2475,11 +2502,6 @@ async def test_create_authorization_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_authorization_policy_async_from_dict(): - await test_create_authorization_policy_async(request_type=dict) - - def test_create_authorization_policy_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2662,8 +2684,8 @@ async def test_create_authorization_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_authorization_policy.UpdateAuthorizationPolicyRequest, - dict, + gcn_authorization_policy.UpdateAuthorizationPolicyRequest(), + {}, ], ) def test_update_authorization_policy(request_type, transport: str = "grpc"): @@ -2674,7 +2696,7 @@ def test_update_authorization_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( @@ -2717,7 +2739,8 @@ def test_update_authorization_policy_non_empty_request_with_auto_populated_field client.update_authorization_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_authorization_policy.UpdateAuthorizationPolicyRequest() + request_msg = gcn_authorization_policy.UpdateAuthorizationPolicyRequest() + assert args[0] == request_msg def test_update_authorization_policy_use_cached_wrapped_rpc(): @@ -2813,9 +2836,15 @@ async def test_update_authorization_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcn_authorization_policy.UpdateAuthorizationPolicyRequest(), + {}, + ], +) async def test_update_authorization_policy_async( - transport: str = "grpc_asyncio", - request_type=gcn_authorization_policy.UpdateAuthorizationPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -2824,7 +2853,7 @@ async def test_update_authorization_policy_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( @@ -2846,11 +2875,6 @@ async def test_update_authorization_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_authorization_policy_async_from_dict(): - await test_update_authorization_policy_async(request_type=dict) - - def test_update_authorization_policy_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3023,8 +3047,8 @@ async def test_update_authorization_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - authorization_policy.DeleteAuthorizationPolicyRequest, - dict, + authorization_policy.DeleteAuthorizationPolicyRequest(), + {}, ], ) def test_delete_authorization_policy(request_type, transport: str = "grpc"): @@ -3035,7 +3059,7 @@ def test_delete_authorization_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( @@ -3080,9 +3104,10 @@ def test_delete_authorization_policy_non_empty_request_with_auto_populated_field client.delete_authorization_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == authorization_policy.DeleteAuthorizationPolicyRequest( + request_msg = authorization_policy.DeleteAuthorizationPolicyRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_authorization_policy_use_cached_wrapped_rpc(): @@ -3178,9 +3203,15 @@ async def test_delete_authorization_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + authorization_policy.DeleteAuthorizationPolicyRequest(), + {}, + ], +) async def test_delete_authorization_policy_async( - transport: str = "grpc_asyncio", - request_type=authorization_policy.DeleteAuthorizationPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -3189,7 +3220,7 @@ async def test_delete_authorization_policy_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( @@ -3211,11 +3242,6 @@ async def test_delete_authorization_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_authorization_policy_async_from_dict(): - await test_delete_authorization_policy_async(request_type=dict) - - def test_delete_authorization_policy_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3370,8 +3396,8 @@ async def test_delete_authorization_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - backend_authentication_config.ListBackendAuthenticationConfigsRequest, - dict, + backend_authentication_config.ListBackendAuthenticationConfigsRequest(), + {}, ], ) def test_list_backend_authentication_configs(request_type, transport: str = "grpc"): @@ -3382,7 +3408,7 @@ def test_list_backend_authentication_configs(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( @@ -3437,12 +3463,13 @@ def test_list_backend_authentication_configs_non_empty_request_with_auto_populat client.list_backend_authentication_configs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == backend_authentication_config.ListBackendAuthenticationConfigsRequest( - parent="parent_value", - page_token="page_token_value", + request_msg = ( + backend_authentication_config.ListBackendAuthenticationConfigsRequest( + parent="parent_value", + page_token="page_token_value", + ) ) + assert args[0] == request_msg def test_list_backend_authentication_configs_use_cached_wrapped_rpc(): @@ -3528,9 +3555,15 @@ async def test_list_backend_authentication_configs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + backend_authentication_config.ListBackendAuthenticationConfigsRequest(), + {}, + ], +) async def test_list_backend_authentication_configs_async( - transport: str = "grpc_asyncio", - request_type=backend_authentication_config.ListBackendAuthenticationConfigsRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -3539,7 +3572,7 @@ async def test_list_backend_authentication_configs_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( @@ -3568,11 +3601,6 @@ async def test_list_backend_authentication_configs_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_backend_authentication_configs_async_from_dict(): - await test_list_backend_authentication_configs_async(request_type=dict) - - def test_list_backend_authentication_configs_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3941,8 +3969,8 @@ async def test_list_backend_authentication_configs_async_pages(): @pytest.mark.parametrize( "request_type", [ - backend_authentication_config.GetBackendAuthenticationConfigRequest, - dict, + backend_authentication_config.GetBackendAuthenticationConfigRequest(), + {}, ], ) def test_get_backend_authentication_config(request_type, transport: str = "grpc"): @@ -3953,7 +3981,7 @@ def test_get_backend_authentication_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( @@ -4016,11 +4044,12 @@ def test_get_backend_authentication_config_non_empty_request_with_auto_populated client.get_backend_authentication_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == backend_authentication_config.GetBackendAuthenticationConfigRequest( - name="name_value", + request_msg = ( + backend_authentication_config.GetBackendAuthenticationConfigRequest( + name="name_value", + ) ) + assert args[0] == request_msg def test_get_backend_authentication_config_use_cached_wrapped_rpc(): @@ -4106,9 +4135,15 @@ async def test_get_backend_authentication_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + backend_authentication_config.GetBackendAuthenticationConfigRequest(), + {}, + ], +) async def test_get_backend_authentication_config_async( - transport: str = "grpc_asyncio", - request_type=backend_authentication_config.GetBackendAuthenticationConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -4117,7 +4152,7 @@ async def test_get_backend_authentication_config_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( @@ -4157,11 +4192,6 @@ async def test_get_backend_authentication_config_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_backend_authentication_config_async_from_dict(): - await test_get_backend_authentication_config_async(request_type=dict) - - def test_get_backend_authentication_config_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4316,8 +4346,8 @@ async def test_get_backend_authentication_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_backend_authentication_config.CreateBackendAuthenticationConfigRequest, - dict, + gcn_backend_authentication_config.CreateBackendAuthenticationConfigRequest(), + {}, ], ) def test_create_backend_authentication_config(request_type, transport: str = "grpc"): @@ -4328,7 +4358,7 @@ def test_create_backend_authentication_config(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( @@ -4378,12 +4408,11 @@ def test_create_backend_authentication_config_non_empty_request_with_auto_popula client.create_backend_authentication_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == gcn_backend_authentication_config.CreateBackendAuthenticationConfigRequest( + request_msg = gcn_backend_authentication_config.CreateBackendAuthenticationConfigRequest( parent="parent_value", backend_authentication_config_id="backend_authentication_config_id_value", ) + assert args[0] == request_msg def test_create_backend_authentication_config_use_cached_wrapped_rpc(): @@ -4479,9 +4508,15 @@ async def test_create_backend_authentication_config_async_use_cached_wrapped_rpc @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcn_backend_authentication_config.CreateBackendAuthenticationConfigRequest(), + {}, + ], +) async def test_create_backend_authentication_config_async( - transport: str = "grpc_asyncio", - request_type=gcn_backend_authentication_config.CreateBackendAuthenticationConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -4490,7 +4525,7 @@ async def test_create_backend_authentication_config_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( @@ -4514,11 +4549,6 @@ async def test_create_backend_authentication_config_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_backend_authentication_config_async_from_dict(): - await test_create_backend_authentication_config_async(request_type=dict) - - def test_create_backend_authentication_config_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4709,8 +4739,8 @@ async def test_create_backend_authentication_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_backend_authentication_config.UpdateBackendAuthenticationConfigRequest, - dict, + gcn_backend_authentication_config.UpdateBackendAuthenticationConfigRequest(), + {}, ], ) def test_update_backend_authentication_config(request_type, transport: str = "grpc"): @@ -4721,7 +4751,7 @@ def test_update_backend_authentication_config(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( @@ -4768,10 +4798,10 @@ def test_update_backend_authentication_config_non_empty_request_with_auto_popula client.update_backend_authentication_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert ( - args[0] - == gcn_backend_authentication_config.UpdateBackendAuthenticationConfigRequest() + request_msg = ( + gcn_backend_authentication_config.UpdateBackendAuthenticationConfigRequest() ) + assert args[0] == request_msg def test_update_backend_authentication_config_use_cached_wrapped_rpc(): @@ -4867,9 +4897,15 @@ async def test_update_backend_authentication_config_async_use_cached_wrapped_rpc @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcn_backend_authentication_config.UpdateBackendAuthenticationConfigRequest(), + {}, + ], +) async def test_update_backend_authentication_config_async( - transport: str = "grpc_asyncio", - request_type=gcn_backend_authentication_config.UpdateBackendAuthenticationConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -4878,7 +4914,7 @@ async def test_update_backend_authentication_config_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( @@ -4902,11 +4938,6 @@ async def test_update_backend_authentication_config_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_backend_authentication_config_async_from_dict(): - await test_update_backend_authentication_config_async(request_type=dict) - - def test_update_backend_authentication_config_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5087,8 +5118,8 @@ async def test_update_backend_authentication_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - backend_authentication_config.DeleteBackendAuthenticationConfigRequest, - dict, + backend_authentication_config.DeleteBackendAuthenticationConfigRequest(), + {}, ], ) def test_delete_backend_authentication_config(request_type, transport: str = "grpc"): @@ -5099,7 +5130,7 @@ def test_delete_backend_authentication_config(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( @@ -5147,12 +5178,13 @@ def test_delete_backend_authentication_config_non_empty_request_with_auto_popula client.delete_backend_authentication_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == backend_authentication_config.DeleteBackendAuthenticationConfigRequest( - name="name_value", - etag="etag_value", + request_msg = ( + backend_authentication_config.DeleteBackendAuthenticationConfigRequest( + name="name_value", + etag="etag_value", + ) ) + assert args[0] == request_msg def test_delete_backend_authentication_config_use_cached_wrapped_rpc(): @@ -5248,9 +5280,15 @@ async def test_delete_backend_authentication_config_async_use_cached_wrapped_rpc @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + backend_authentication_config.DeleteBackendAuthenticationConfigRequest(), + {}, + ], +) async def test_delete_backend_authentication_config_async( - transport: str = "grpc_asyncio", - request_type=backend_authentication_config.DeleteBackendAuthenticationConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -5259,7 +5297,7 @@ async def test_delete_backend_authentication_config_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( @@ -5283,11 +5321,6 @@ async def test_delete_backend_authentication_config_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_backend_authentication_config_async_from_dict(): - await test_delete_backend_authentication_config_async(request_type=dict) - - def test_delete_backend_authentication_config_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5442,8 +5475,8 @@ async def test_delete_backend_authentication_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - server_tls_policy.ListServerTlsPoliciesRequest, - dict, + server_tls_policy.ListServerTlsPoliciesRequest(), + {}, ], ) def test_list_server_tls_policies(request_type, transport: str = "grpc"): @@ -5454,7 +5487,7 @@ def test_list_server_tls_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( @@ -5505,10 +5538,11 @@ def test_list_server_tls_policies_non_empty_request_with_auto_populated_field(): client.list_server_tls_policies(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == server_tls_policy.ListServerTlsPoliciesRequest( + request_msg = server_tls_policy.ListServerTlsPoliciesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_server_tls_policies_use_cached_wrapped_rpc(): @@ -5594,9 +5628,15 @@ async def test_list_server_tls_policies_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + server_tls_policy.ListServerTlsPoliciesRequest(), + {}, + ], +) async def test_list_server_tls_policies_async( - transport: str = "grpc_asyncio", - request_type=server_tls_policy.ListServerTlsPoliciesRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -5605,7 +5645,7 @@ async def test_list_server_tls_policies_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( @@ -5632,11 +5672,6 @@ async def test_list_server_tls_policies_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_server_tls_policies_async_from_dict(): - await test_list_server_tls_policies_async(request_type=dict) - - def test_list_server_tls_policies_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5991,8 +6026,8 @@ async def test_list_server_tls_policies_async_pages(): @pytest.mark.parametrize( "request_type", [ - server_tls_policy.GetServerTlsPolicyRequest, - dict, + server_tls_policy.GetServerTlsPolicyRequest(), + {}, ], ) def test_get_server_tls_policy(request_type, transport: str = "grpc"): @@ -6003,7 +6038,7 @@ def test_get_server_tls_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( @@ -6055,9 +6090,10 @@ def test_get_server_tls_policy_non_empty_request_with_auto_populated_field(): client.get_server_tls_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == server_tls_policy.GetServerTlsPolicyRequest( + request_msg = server_tls_policy.GetServerTlsPolicyRequest( name="name_value", ) + assert args[0] == request_msg def test_get_server_tls_policy_use_cached_wrapped_rpc(): @@ -6143,9 +6179,15 @@ async def test_get_server_tls_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + server_tls_policy.GetServerTlsPolicyRequest(), + {}, + ], +) async def test_get_server_tls_policy_async( - transport: str = "grpc_asyncio", - request_type=server_tls_policy.GetServerTlsPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -6154,7 +6196,7 @@ async def test_get_server_tls_policy_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( @@ -6183,11 +6225,6 @@ async def test_get_server_tls_policy_async( assert response.allow_open is True -@pytest.mark.asyncio -async def test_get_server_tls_policy_async_from_dict(): - await test_get_server_tls_policy_async(request_type=dict) - - def test_get_server_tls_policy_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6342,8 +6379,8 @@ async def test_get_server_tls_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_server_tls_policy.CreateServerTlsPolicyRequest, - dict, + gcn_server_tls_policy.CreateServerTlsPolicyRequest(), + {}, ], ) def test_create_server_tls_policy(request_type, transport: str = "grpc"): @@ -6354,7 +6391,7 @@ def test_create_server_tls_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( @@ -6400,10 +6437,11 @@ def test_create_server_tls_policy_non_empty_request_with_auto_populated_field(): client.create_server_tls_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_server_tls_policy.CreateServerTlsPolicyRequest( + request_msg = gcn_server_tls_policy.CreateServerTlsPolicyRequest( parent="parent_value", server_tls_policy_id="server_tls_policy_id_value", ) + assert args[0] == request_msg def test_create_server_tls_policy_use_cached_wrapped_rpc(): @@ -6499,9 +6537,15 @@ async def test_create_server_tls_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcn_server_tls_policy.CreateServerTlsPolicyRequest(), + {}, + ], +) async def test_create_server_tls_policy_async( - transport: str = "grpc_asyncio", - request_type=gcn_server_tls_policy.CreateServerTlsPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -6510,7 +6554,7 @@ async def test_create_server_tls_policy_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( @@ -6532,11 +6576,6 @@ async def test_create_server_tls_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_server_tls_policy_async_from_dict(): - await test_create_server_tls_policy_async(request_type=dict) - - def test_create_server_tls_policy_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6711,8 +6750,8 @@ async def test_create_server_tls_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_server_tls_policy.UpdateServerTlsPolicyRequest, - dict, + gcn_server_tls_policy.UpdateServerTlsPolicyRequest(), + {}, ], ) def test_update_server_tls_policy(request_type, transport: str = "grpc"): @@ -6723,7 +6762,7 @@ def test_update_server_tls_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( @@ -6766,7 +6805,8 @@ def test_update_server_tls_policy_non_empty_request_with_auto_populated_field(): client.update_server_tls_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_server_tls_policy.UpdateServerTlsPolicyRequest() + request_msg = gcn_server_tls_policy.UpdateServerTlsPolicyRequest() + assert args[0] == request_msg def test_update_server_tls_policy_use_cached_wrapped_rpc(): @@ -6862,9 +6902,15 @@ async def test_update_server_tls_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcn_server_tls_policy.UpdateServerTlsPolicyRequest(), + {}, + ], +) async def test_update_server_tls_policy_async( - transport: str = "grpc_asyncio", - request_type=gcn_server_tls_policy.UpdateServerTlsPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -6873,7 +6919,7 @@ async def test_update_server_tls_policy_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( @@ -6895,11 +6941,6 @@ async def test_update_server_tls_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_server_tls_policy_async_from_dict(): - await test_update_server_tls_policy_async(request_type=dict) - - def test_update_server_tls_policy_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7064,8 +7105,8 @@ async def test_update_server_tls_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - server_tls_policy.DeleteServerTlsPolicyRequest, - dict, + server_tls_policy.DeleteServerTlsPolicyRequest(), + {}, ], ) def test_delete_server_tls_policy(request_type, transport: str = "grpc"): @@ -7076,7 +7117,7 @@ def test_delete_server_tls_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( @@ -7121,9 +7162,10 @@ def test_delete_server_tls_policy_non_empty_request_with_auto_populated_field(): client.delete_server_tls_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == server_tls_policy.DeleteServerTlsPolicyRequest( + request_msg = server_tls_policy.DeleteServerTlsPolicyRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_server_tls_policy_use_cached_wrapped_rpc(): @@ -7219,9 +7261,15 @@ async def test_delete_server_tls_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + server_tls_policy.DeleteServerTlsPolicyRequest(), + {}, + ], +) async def test_delete_server_tls_policy_async( - transport: str = "grpc_asyncio", - request_type=server_tls_policy.DeleteServerTlsPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -7230,7 +7278,7 @@ async def test_delete_server_tls_policy_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( @@ -7252,11 +7300,6 @@ async def test_delete_server_tls_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_server_tls_policy_async_from_dict(): - await test_delete_server_tls_policy_async(request_type=dict) - - def test_delete_server_tls_policy_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7411,8 +7454,8 @@ async def test_delete_server_tls_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - client_tls_policy.ListClientTlsPoliciesRequest, - dict, + client_tls_policy.ListClientTlsPoliciesRequest(), + {}, ], ) def test_list_client_tls_policies(request_type, transport: str = "grpc"): @@ -7423,7 +7466,7 @@ def test_list_client_tls_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( @@ -7472,10 +7515,11 @@ def test_list_client_tls_policies_non_empty_request_with_auto_populated_field(): client.list_client_tls_policies(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == client_tls_policy.ListClientTlsPoliciesRequest( + request_msg = client_tls_policy.ListClientTlsPoliciesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_client_tls_policies_use_cached_wrapped_rpc(): @@ -7561,9 +7605,15 @@ async def test_list_client_tls_policies_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + client_tls_policy.ListClientTlsPoliciesRequest(), + {}, + ], +) async def test_list_client_tls_policies_async( - transport: str = "grpc_asyncio", - request_type=client_tls_policy.ListClientTlsPoliciesRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -7572,7 +7622,7 @@ async def test_list_client_tls_policies_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( @@ -7597,11 +7647,6 @@ async def test_list_client_tls_policies_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_client_tls_policies_async_from_dict(): - await test_list_client_tls_policies_async(request_type=dict) - - def test_list_client_tls_policies_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7956,8 +8001,8 @@ async def test_list_client_tls_policies_async_pages(): @pytest.mark.parametrize( "request_type", [ - client_tls_policy.GetClientTlsPolicyRequest, - dict, + client_tls_policy.GetClientTlsPolicyRequest(), + {}, ], ) def test_get_client_tls_policy(request_type, transport: str = "grpc"): @@ -7968,7 +8013,7 @@ def test_get_client_tls_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( @@ -8020,9 +8065,10 @@ def test_get_client_tls_policy_non_empty_request_with_auto_populated_field(): client.get_client_tls_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == client_tls_policy.GetClientTlsPolicyRequest( + request_msg = client_tls_policy.GetClientTlsPolicyRequest( name="name_value", ) + assert args[0] == request_msg def test_get_client_tls_policy_use_cached_wrapped_rpc(): @@ -8108,9 +8154,15 @@ async def test_get_client_tls_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + client_tls_policy.GetClientTlsPolicyRequest(), + {}, + ], +) async def test_get_client_tls_policy_async( - transport: str = "grpc_asyncio", - request_type=client_tls_policy.GetClientTlsPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -8119,7 +8171,7 @@ async def test_get_client_tls_policy_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( @@ -8148,11 +8200,6 @@ async def test_get_client_tls_policy_async( assert response.sni == "sni_value" -@pytest.mark.asyncio -async def test_get_client_tls_policy_async_from_dict(): - await test_get_client_tls_policy_async(request_type=dict) - - def test_get_client_tls_policy_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8307,8 +8354,8 @@ async def test_get_client_tls_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_client_tls_policy.CreateClientTlsPolicyRequest, - dict, + gcn_client_tls_policy.CreateClientTlsPolicyRequest(), + {}, ], ) def test_create_client_tls_policy(request_type, transport: str = "grpc"): @@ -8319,7 +8366,7 @@ def test_create_client_tls_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( @@ -8365,10 +8412,11 @@ def test_create_client_tls_policy_non_empty_request_with_auto_populated_field(): client.create_client_tls_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_client_tls_policy.CreateClientTlsPolicyRequest( + request_msg = gcn_client_tls_policy.CreateClientTlsPolicyRequest( parent="parent_value", client_tls_policy_id="client_tls_policy_id_value", ) + assert args[0] == request_msg def test_create_client_tls_policy_use_cached_wrapped_rpc(): @@ -8464,9 +8512,15 @@ async def test_create_client_tls_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcn_client_tls_policy.CreateClientTlsPolicyRequest(), + {}, + ], +) async def test_create_client_tls_policy_async( - transport: str = "grpc_asyncio", - request_type=gcn_client_tls_policy.CreateClientTlsPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -8475,7 +8529,7 @@ async def test_create_client_tls_policy_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( @@ -8497,11 +8551,6 @@ async def test_create_client_tls_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_client_tls_policy_async_from_dict(): - await test_create_client_tls_policy_async(request_type=dict) - - def test_create_client_tls_policy_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8676,8 +8725,8 @@ async def test_create_client_tls_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_client_tls_policy.UpdateClientTlsPolicyRequest, - dict, + gcn_client_tls_policy.UpdateClientTlsPolicyRequest(), + {}, ], ) def test_update_client_tls_policy(request_type, transport: str = "grpc"): @@ -8688,7 +8737,7 @@ def test_update_client_tls_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( @@ -8731,7 +8780,8 @@ def test_update_client_tls_policy_non_empty_request_with_auto_populated_field(): client.update_client_tls_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_client_tls_policy.UpdateClientTlsPolicyRequest() + request_msg = gcn_client_tls_policy.UpdateClientTlsPolicyRequest() + assert args[0] == request_msg def test_update_client_tls_policy_use_cached_wrapped_rpc(): @@ -8827,9 +8877,15 @@ async def test_update_client_tls_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcn_client_tls_policy.UpdateClientTlsPolicyRequest(), + {}, + ], +) async def test_update_client_tls_policy_async( - transport: str = "grpc_asyncio", - request_type=gcn_client_tls_policy.UpdateClientTlsPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -8838,7 +8894,7 @@ async def test_update_client_tls_policy_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( @@ -8860,11 +8916,6 @@ async def test_update_client_tls_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_client_tls_policy_async_from_dict(): - await test_update_client_tls_policy_async(request_type=dict) - - def test_update_client_tls_policy_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9029,8 +9080,8 @@ async def test_update_client_tls_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - client_tls_policy.DeleteClientTlsPolicyRequest, - dict, + client_tls_policy.DeleteClientTlsPolicyRequest(), + {}, ], ) def test_delete_client_tls_policy(request_type, transport: str = "grpc"): @@ -9041,7 +9092,7 @@ def test_delete_client_tls_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( @@ -9086,9 +9137,10 @@ def test_delete_client_tls_policy_non_empty_request_with_auto_populated_field(): client.delete_client_tls_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == client_tls_policy.DeleteClientTlsPolicyRequest( + request_msg = client_tls_policy.DeleteClientTlsPolicyRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_client_tls_policy_use_cached_wrapped_rpc(): @@ -9184,9 +9236,15 @@ async def test_delete_client_tls_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + client_tls_policy.DeleteClientTlsPolicyRequest(), + {}, + ], +) async def test_delete_client_tls_policy_async( - transport: str = "grpc_asyncio", - request_type=client_tls_policy.DeleteClientTlsPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -9195,7 +9253,7 @@ async def test_delete_client_tls_policy_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( @@ -9217,11 +9275,6 @@ async def test_delete_client_tls_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_client_tls_policy_async_from_dict(): - await test_delete_client_tls_policy_async(request_type=dict) - - def test_delete_client_tls_policy_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9376,8 +9429,8 @@ async def test_delete_client_tls_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gateway_security_policy.ListGatewaySecurityPoliciesRequest, - dict, + gateway_security_policy.ListGatewaySecurityPoliciesRequest(), + {}, ], ) def test_list_gateway_security_policies(request_type, transport: str = "grpc"): @@ -9388,7 +9441,7 @@ def test_list_gateway_security_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( @@ -9439,10 +9492,11 @@ def test_list_gateway_security_policies_non_empty_request_with_auto_populated_fi client.list_gateway_security_policies(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gateway_security_policy.ListGatewaySecurityPoliciesRequest( + request_msg = gateway_security_policy.ListGatewaySecurityPoliciesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_gateway_security_policies_use_cached_wrapped_rpc(): @@ -9528,9 +9582,15 @@ async def test_list_gateway_security_policies_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gateway_security_policy.ListGatewaySecurityPoliciesRequest(), + {}, + ], +) async def test_list_gateway_security_policies_async( - transport: str = "grpc_asyncio", - request_type=gateway_security_policy.ListGatewaySecurityPoliciesRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -9539,7 +9599,7 @@ async def test_list_gateway_security_policies_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( @@ -9566,11 +9626,6 @@ async def test_list_gateway_security_policies_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_gateway_security_policies_async_from_dict(): - await test_list_gateway_security_policies_async(request_type=dict) - - def test_list_gateway_security_policies_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9939,8 +9994,8 @@ async def test_list_gateway_security_policies_async_pages(): @pytest.mark.parametrize( "request_type", [ - gateway_security_policy.GetGatewaySecurityPolicyRequest, - dict, + gateway_security_policy.GetGatewaySecurityPolicyRequest(), + {}, ], ) def test_get_gateway_security_policy(request_type, transport: str = "grpc"): @@ -9951,7 +10006,7 @@ def test_get_gateway_security_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( @@ -10003,9 +10058,10 @@ def test_get_gateway_security_policy_non_empty_request_with_auto_populated_field client.get_gateway_security_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gateway_security_policy.GetGatewaySecurityPolicyRequest( + request_msg = gateway_security_policy.GetGatewaySecurityPolicyRequest( name="name_value", ) + assert args[0] == request_msg def test_get_gateway_security_policy_use_cached_wrapped_rpc(): @@ -10091,9 +10147,15 @@ async def test_get_gateway_security_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gateway_security_policy.GetGatewaySecurityPolicyRequest(), + {}, + ], +) async def test_get_gateway_security_policy_async( - transport: str = "grpc_asyncio", - request_type=gateway_security_policy.GetGatewaySecurityPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -10102,7 +10164,7 @@ async def test_get_gateway_security_policy_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( @@ -10131,11 +10193,6 @@ async def test_get_gateway_security_policy_async( assert response.tls_inspection_policy == "tls_inspection_policy_value" -@pytest.mark.asyncio -async def test_get_gateway_security_policy_async_from_dict(): - await test_get_gateway_security_policy_async(request_type=dict) - - def test_get_gateway_security_policy_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10290,8 +10347,8 @@ async def test_get_gateway_security_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_gateway_security_policy.CreateGatewaySecurityPolicyRequest, - dict, + gcn_gateway_security_policy.CreateGatewaySecurityPolicyRequest(), + {}, ], ) def test_create_gateway_security_policy(request_type, transport: str = "grpc"): @@ -10302,7 +10359,7 @@ def test_create_gateway_security_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( @@ -10348,12 +10405,11 @@ def test_create_gateway_security_policy_non_empty_request_with_auto_populated_fi client.create_gateway_security_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == gcn_gateway_security_policy.CreateGatewaySecurityPolicyRequest( + request_msg = gcn_gateway_security_policy.CreateGatewaySecurityPolicyRequest( parent="parent_value", gateway_security_policy_id="gateway_security_policy_id_value", ) + assert args[0] == request_msg def test_create_gateway_security_policy_use_cached_wrapped_rpc(): @@ -10449,9 +10505,15 @@ async def test_create_gateway_security_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcn_gateway_security_policy.CreateGatewaySecurityPolicyRequest(), + {}, + ], +) async def test_create_gateway_security_policy_async( - transport: str = "grpc_asyncio", - request_type=gcn_gateway_security_policy.CreateGatewaySecurityPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -10460,7 +10522,7 @@ async def test_create_gateway_security_policy_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( @@ -10482,11 +10544,6 @@ async def test_create_gateway_security_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_gateway_security_policy_async_from_dict(): - await test_create_gateway_security_policy_async(request_type=dict) - - def test_create_gateway_security_policy_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10669,8 +10726,8 @@ async def test_create_gateway_security_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_gateway_security_policy.UpdateGatewaySecurityPolicyRequest, - dict, + gcn_gateway_security_policy.UpdateGatewaySecurityPolicyRequest(), + {}, ], ) def test_update_gateway_security_policy(request_type, transport: str = "grpc"): @@ -10681,7 +10738,7 @@ def test_update_gateway_security_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( @@ -10724,9 +10781,8 @@ def test_update_gateway_security_policy_non_empty_request_with_auto_populated_fi client.update_gateway_security_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert ( - args[0] == gcn_gateway_security_policy.UpdateGatewaySecurityPolicyRequest() - ) + request_msg = gcn_gateway_security_policy.UpdateGatewaySecurityPolicyRequest() + assert args[0] == request_msg def test_update_gateway_security_policy_use_cached_wrapped_rpc(): @@ -10822,9 +10878,15 @@ async def test_update_gateway_security_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcn_gateway_security_policy.UpdateGatewaySecurityPolicyRequest(), + {}, + ], +) async def test_update_gateway_security_policy_async( - transport: str = "grpc_asyncio", - request_type=gcn_gateway_security_policy.UpdateGatewaySecurityPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -10833,7 +10895,7 @@ async def test_update_gateway_security_policy_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( @@ -10855,11 +10917,6 @@ async def test_update_gateway_security_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_gateway_security_policy_async_from_dict(): - await test_update_gateway_security_policy_async(request_type=dict) - - def test_update_gateway_security_policy_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11032,8 +11089,8 @@ async def test_update_gateway_security_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gateway_security_policy.DeleteGatewaySecurityPolicyRequest, - dict, + gateway_security_policy.DeleteGatewaySecurityPolicyRequest(), + {}, ], ) def test_delete_gateway_security_policy(request_type, transport: str = "grpc"): @@ -11044,7 +11101,7 @@ def test_delete_gateway_security_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( @@ -11089,9 +11146,10 @@ def test_delete_gateway_security_policy_non_empty_request_with_auto_populated_fi client.delete_gateway_security_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gateway_security_policy.DeleteGatewaySecurityPolicyRequest( + request_msg = gateway_security_policy.DeleteGatewaySecurityPolicyRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_gateway_security_policy_use_cached_wrapped_rpc(): @@ -11187,9 +11245,15 @@ async def test_delete_gateway_security_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gateway_security_policy.DeleteGatewaySecurityPolicyRequest(), + {}, + ], +) async def test_delete_gateway_security_policy_async( - transport: str = "grpc_asyncio", - request_type=gateway_security_policy.DeleteGatewaySecurityPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -11198,7 +11262,7 @@ async def test_delete_gateway_security_policy_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( @@ -11220,11 +11284,6 @@ async def test_delete_gateway_security_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_gateway_security_policy_async_from_dict(): - await test_delete_gateway_security_policy_async(request_type=dict) - - def test_delete_gateway_security_policy_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11379,8 +11438,8 @@ async def test_delete_gateway_security_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gateway_security_policy_rule.ListGatewaySecurityPolicyRulesRequest, - dict, + gateway_security_policy_rule.ListGatewaySecurityPolicyRulesRequest(), + {}, ], ) def test_list_gateway_security_policy_rules(request_type, transport: str = "grpc"): @@ -11391,7 +11450,7 @@ def test_list_gateway_security_policy_rules(request_type, transport: str = "grpc # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11444,12 +11503,13 @@ def test_list_gateway_security_policy_rules_non_empty_request_with_auto_populate client.list_gateway_security_policy_rules(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == gateway_security_policy_rule.ListGatewaySecurityPolicyRulesRequest( - parent="parent_value", - page_token="page_token_value", + request_msg = ( + gateway_security_policy_rule.ListGatewaySecurityPolicyRulesRequest( + parent="parent_value", + page_token="page_token_value", + ) ) + assert args[0] == request_msg def test_list_gateway_security_policy_rules_use_cached_wrapped_rpc(): @@ -11535,9 +11595,15 @@ async def test_list_gateway_security_policy_rules_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gateway_security_policy_rule.ListGatewaySecurityPolicyRulesRequest(), + {}, + ], +) async def test_list_gateway_security_policy_rules_async( - transport: str = "grpc_asyncio", - request_type=gateway_security_policy_rule.ListGatewaySecurityPolicyRulesRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -11546,7 +11612,7 @@ async def test_list_gateway_security_policy_rules_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( @@ -11573,11 +11639,6 @@ async def test_list_gateway_security_policy_rules_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_gateway_security_policy_rules_async_from_dict(): - await test_list_gateway_security_policy_rules_async(request_type=dict) - - def test_list_gateway_security_policy_rules_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11946,8 +12007,8 @@ async def test_list_gateway_security_policy_rules_async_pages(): @pytest.mark.parametrize( "request_type", [ - gateway_security_policy_rule.GetGatewaySecurityPolicyRuleRequest, - dict, + gateway_security_policy_rule.GetGatewaySecurityPolicyRuleRequest(), + {}, ], ) def test_get_gateway_security_policy_rule(request_type, transport: str = "grpc"): @@ -11958,7 +12019,7 @@ def test_get_gateway_security_policy_rule(request_type, transport: str = "grpc") # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -12019,11 +12080,10 @@ def test_get_gateway_security_policy_rule_non_empty_request_with_auto_populated_ client.get_gateway_security_policy_rule(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == gateway_security_policy_rule.GetGatewaySecurityPolicyRuleRequest( + request_msg = gateway_security_policy_rule.GetGatewaySecurityPolicyRuleRequest( name="name_value", ) + assert args[0] == request_msg def test_get_gateway_security_policy_rule_use_cached_wrapped_rpc(): @@ -12109,9 +12169,15 @@ async def test_get_gateway_security_policy_rule_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gateway_security_policy_rule.GetGatewaySecurityPolicyRuleRequest(), + {}, + ], +) async def test_get_gateway_security_policy_rule_async( - transport: str = "grpc_asyncio", - request_type=gateway_security_policy_rule.GetGatewaySecurityPolicyRuleRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -12120,7 +12186,7 @@ async def test_get_gateway_security_policy_rule_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( @@ -12157,11 +12223,6 @@ async def test_get_gateway_security_policy_rule_async( assert response.tls_inspection_enabled is True -@pytest.mark.asyncio -async def test_get_gateway_security_policy_rule_async_from_dict(): - await test_get_gateway_security_policy_rule_async(request_type=dict) - - def test_get_gateway_security_policy_rule_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12316,8 +12377,8 @@ async def test_get_gateway_security_policy_rule_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_gateway_security_policy_rule.CreateGatewaySecurityPolicyRuleRequest, - dict, + gcn_gateway_security_policy_rule.CreateGatewaySecurityPolicyRuleRequest(), + {}, ], ) def test_create_gateway_security_policy_rule(request_type, transport: str = "grpc"): @@ -12328,7 +12389,7 @@ def test_create_gateway_security_policy_rule(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( @@ -12376,12 +12437,13 @@ def test_create_gateway_security_policy_rule_non_empty_request_with_auto_populat client.create_gateway_security_policy_rule(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == gcn_gateway_security_policy_rule.CreateGatewaySecurityPolicyRuleRequest( - parent="parent_value", - gateway_security_policy_rule_id="gateway_security_policy_rule_id_value", + request_msg = ( + gcn_gateway_security_policy_rule.CreateGatewaySecurityPolicyRuleRequest( + parent="parent_value", + gateway_security_policy_rule_id="gateway_security_policy_rule_id_value", + ) ) + assert args[0] == request_msg def test_create_gateway_security_policy_rule_use_cached_wrapped_rpc(): @@ -12477,9 +12539,15 @@ async def test_create_gateway_security_policy_rule_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcn_gateway_security_policy_rule.CreateGatewaySecurityPolicyRuleRequest(), + {}, + ], +) async def test_create_gateway_security_policy_rule_async( - transport: str = "grpc_asyncio", - request_type=gcn_gateway_security_policy_rule.CreateGatewaySecurityPolicyRuleRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -12488,7 +12556,7 @@ async def test_create_gateway_security_policy_rule_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( @@ -12512,11 +12580,6 @@ async def test_create_gateway_security_policy_rule_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_gateway_security_policy_rule_async_from_dict(): - await test_create_gateway_security_policy_rule_async(request_type=dict) - - def test_create_gateway_security_policy_rule_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12703,8 +12766,8 @@ async def test_create_gateway_security_policy_rule_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_gateway_security_policy_rule.UpdateGatewaySecurityPolicyRuleRequest, - dict, + gcn_gateway_security_policy_rule.UpdateGatewaySecurityPolicyRuleRequest(), + {}, ], ) def test_update_gateway_security_policy_rule(request_type, transport: str = "grpc"): @@ -12715,7 +12778,7 @@ def test_update_gateway_security_policy_rule(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( @@ -12760,10 +12823,10 @@ def test_update_gateway_security_policy_rule_non_empty_request_with_auto_populat client.update_gateway_security_policy_rule(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert ( - args[0] - == gcn_gateway_security_policy_rule.UpdateGatewaySecurityPolicyRuleRequest() + request_msg = ( + gcn_gateway_security_policy_rule.UpdateGatewaySecurityPolicyRuleRequest() ) + assert args[0] == request_msg def test_update_gateway_security_policy_rule_use_cached_wrapped_rpc(): @@ -12859,9 +12922,15 @@ async def test_update_gateway_security_policy_rule_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcn_gateway_security_policy_rule.UpdateGatewaySecurityPolicyRuleRequest(), + {}, + ], +) async def test_update_gateway_security_policy_rule_async( - transport: str = "grpc_asyncio", - request_type=gcn_gateway_security_policy_rule.UpdateGatewaySecurityPolicyRuleRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -12870,7 +12939,7 @@ async def test_update_gateway_security_policy_rule_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( @@ -12894,11 +12963,6 @@ async def test_update_gateway_security_policy_rule_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_gateway_security_policy_rule_async_from_dict(): - await test_update_gateway_security_policy_rule_async(request_type=dict) - - def test_update_gateway_security_policy_rule_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13075,8 +13139,8 @@ async def test_update_gateway_security_policy_rule_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gateway_security_policy_rule.DeleteGatewaySecurityPolicyRuleRequest, - dict, + gateway_security_policy_rule.DeleteGatewaySecurityPolicyRuleRequest(), + {}, ], ) def test_delete_gateway_security_policy_rule(request_type, transport: str = "grpc"): @@ -13087,7 +13151,7 @@ def test_delete_gateway_security_policy_rule(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( @@ -13132,11 +13196,12 @@ def test_delete_gateway_security_policy_rule_non_empty_request_with_auto_populat client.delete_gateway_security_policy_rule(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == gateway_security_policy_rule.DeleteGatewaySecurityPolicyRuleRequest( - name="name_value", + request_msg = ( + gateway_security_policy_rule.DeleteGatewaySecurityPolicyRuleRequest( + name="name_value", + ) ) + assert args[0] == request_msg def test_delete_gateway_security_policy_rule_use_cached_wrapped_rpc(): @@ -13232,9 +13297,15 @@ async def test_delete_gateway_security_policy_rule_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gateway_security_policy_rule.DeleteGatewaySecurityPolicyRuleRequest(), + {}, + ], +) async def test_delete_gateway_security_policy_rule_async( - transport: str = "grpc_asyncio", - request_type=gateway_security_policy_rule.DeleteGatewaySecurityPolicyRuleRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -13243,7 +13314,7 @@ async def test_delete_gateway_security_policy_rule_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( @@ -13265,11 +13336,6 @@ async def test_delete_gateway_security_policy_rule_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_gateway_security_policy_rule_async_from_dict(): - await test_delete_gateway_security_policy_rule_async(request_type=dict) - - def test_delete_gateway_security_policy_rule_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13424,8 +13490,8 @@ async def test_delete_gateway_security_policy_rule_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - url_list.ListUrlListsRequest, - dict, + url_list.ListUrlListsRequest(), + {}, ], ) def test_list_url_lists(request_type, transport: str = "grpc"): @@ -13436,7 +13502,7 @@ def test_list_url_lists(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_url_lists), "__call__") as call: @@ -13483,10 +13549,11 @@ def test_list_url_lists_non_empty_request_with_auto_populated_field(): client.list_url_lists(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == url_list.ListUrlListsRequest( + request_msg = url_list.ListUrlListsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_url_lists_use_cached_wrapped_rpc(): @@ -13567,9 +13634,14 @@ async def test_list_url_lists_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_url_lists_async( - transport: str = "grpc_asyncio", request_type=url_list.ListUrlListsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + url_list.ListUrlListsRequest(), + {}, + ], +) +async def test_list_url_lists_async(request_type, transport: str = "grpc_asyncio"): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13577,7 +13649,7 @@ async def test_list_url_lists_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_url_lists), "__call__") as call: @@ -13602,11 +13674,6 @@ async def test_list_url_lists_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_url_lists_async_from_dict(): - await test_list_url_lists_async(request_type=dict) - - def test_list_url_lists_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13943,8 +14010,8 @@ async def test_list_url_lists_async_pages(): @pytest.mark.parametrize( "request_type", [ - url_list.GetUrlListRequest, - dict, + url_list.GetUrlListRequest(), + {}, ], ) def test_get_url_list(request_type, transport: str = "grpc"): @@ -13955,7 +14022,7 @@ def test_get_url_list(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_url_list), "__call__") as call: @@ -14003,9 +14070,10 @@ def test_get_url_list_non_empty_request_with_auto_populated_field(): client.get_url_list(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == url_list.GetUrlListRequest( + request_msg = url_list.GetUrlListRequest( name="name_value", ) + assert args[0] == request_msg def test_get_url_list_use_cached_wrapped_rpc(): @@ -14086,9 +14154,14 @@ async def test_get_url_list_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_url_list_async( - transport: str = "grpc_asyncio", request_type=url_list.GetUrlListRequest -): +@pytest.mark.parametrize( + "request_type", + [ + url_list.GetUrlListRequest(), + {}, + ], +) +async def test_get_url_list_async(request_type, transport: str = "grpc_asyncio"): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14096,7 +14169,7 @@ async def test_get_url_list_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_url_list), "__call__") as call: @@ -14123,11 +14196,6 @@ async def test_get_url_list_async( assert response.values == ["values_value"] -@pytest.mark.asyncio -async def test_get_url_list_async_from_dict(): - await test_get_url_list_async(request_type=dict) - - def test_get_url_list_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14270,8 +14338,8 @@ async def test_get_url_list_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_url_list.CreateUrlListRequest, - dict, + gcn_url_list.CreateUrlListRequest(), + {}, ], ) def test_create_url_list(request_type, transport: str = "grpc"): @@ -14282,7 +14350,7 @@ def test_create_url_list(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_url_list), "__call__") as call: @@ -14324,10 +14392,11 @@ def test_create_url_list_non_empty_request_with_auto_populated_field(): client.create_url_list(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_url_list.CreateUrlListRequest( + request_msg = gcn_url_list.CreateUrlListRequest( parent="parent_value", url_list_id="url_list_id_value", ) + assert args[0] == request_msg def test_create_url_list_use_cached_wrapped_rpc(): @@ -14418,9 +14487,14 @@ async def test_create_url_list_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_url_list_async( - transport: str = "grpc_asyncio", request_type=gcn_url_list.CreateUrlListRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcn_url_list.CreateUrlListRequest(), + {}, + ], +) +async def test_create_url_list_async(request_type, transport: str = "grpc_asyncio"): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14428,7 +14502,7 @@ async def test_create_url_list_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_url_list), "__call__") as call: @@ -14448,11 +14522,6 @@ async def test_create_url_list_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_url_list_async_from_dict(): - await test_create_url_list_async(request_type=dict) - - def test_create_url_list_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14619,8 +14688,8 @@ async def test_create_url_list_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_url_list.UpdateUrlListRequest, - dict, + gcn_url_list.UpdateUrlListRequest(), + {}, ], ) def test_update_url_list(request_type, transport: str = "grpc"): @@ -14631,7 +14700,7 @@ def test_update_url_list(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_url_list), "__call__") as call: @@ -14670,7 +14739,8 @@ def test_update_url_list_non_empty_request_with_auto_populated_field(): client.update_url_list(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_url_list.UpdateUrlListRequest() + request_msg = gcn_url_list.UpdateUrlListRequest() + assert args[0] == request_msg def test_update_url_list_use_cached_wrapped_rpc(): @@ -14761,9 +14831,14 @@ async def test_update_url_list_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_url_list_async( - transport: str = "grpc_asyncio", request_type=gcn_url_list.UpdateUrlListRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcn_url_list.UpdateUrlListRequest(), + {}, + ], +) +async def test_update_url_list_async(request_type, transport: str = "grpc_asyncio"): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14771,7 +14846,7 @@ async def test_update_url_list_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_url_list), "__call__") as call: @@ -14791,11 +14866,6 @@ async def test_update_url_list_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_url_list_async_from_dict(): - await test_update_url_list_async(request_type=dict) - - def test_update_url_list_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14952,8 +15022,8 @@ async def test_update_url_list_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - url_list.DeleteUrlListRequest, - dict, + url_list.DeleteUrlListRequest(), + {}, ], ) def test_delete_url_list(request_type, transport: str = "grpc"): @@ -14964,7 +15034,7 @@ def test_delete_url_list(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_url_list), "__call__") as call: @@ -15005,9 +15075,10 @@ def test_delete_url_list_non_empty_request_with_auto_populated_field(): client.delete_url_list(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == url_list.DeleteUrlListRequest( + request_msg = url_list.DeleteUrlListRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_url_list_use_cached_wrapped_rpc(): @@ -15098,9 +15169,14 @@ async def test_delete_url_list_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_url_list_async( - transport: str = "grpc_asyncio", request_type=url_list.DeleteUrlListRequest -): +@pytest.mark.parametrize( + "request_type", + [ + url_list.DeleteUrlListRequest(), + {}, + ], +) +async def test_delete_url_list_async(request_type, transport: str = "grpc_asyncio"): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -15108,7 +15184,7 @@ async def test_delete_url_list_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_url_list), "__call__") as call: @@ -15128,11 +15204,6 @@ async def test_delete_url_list_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_url_list_async_from_dict(): - await test_delete_url_list_async(request_type=dict) - - def test_delete_url_list_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15279,8 +15350,8 @@ async def test_delete_url_list_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - tls_inspection_policy.ListTlsInspectionPoliciesRequest, - dict, + tls_inspection_policy.ListTlsInspectionPoliciesRequest(), + {}, ], ) def test_list_tls_inspection_policies(request_type, transport: str = "grpc"): @@ -15291,7 +15362,7 @@ def test_list_tls_inspection_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( @@ -15342,10 +15413,11 @@ def test_list_tls_inspection_policies_non_empty_request_with_auto_populated_fiel client.list_tls_inspection_policies(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tls_inspection_policy.ListTlsInspectionPoliciesRequest( + request_msg = tls_inspection_policy.ListTlsInspectionPoliciesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_tls_inspection_policies_use_cached_wrapped_rpc(): @@ -15431,9 +15503,15 @@ async def test_list_tls_inspection_policies_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + tls_inspection_policy.ListTlsInspectionPoliciesRequest(), + {}, + ], +) async def test_list_tls_inspection_policies_async( - transport: str = "grpc_asyncio", - request_type=tls_inspection_policy.ListTlsInspectionPoliciesRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -15442,7 +15520,7 @@ async def test_list_tls_inspection_policies_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( @@ -15469,11 +15547,6 @@ async def test_list_tls_inspection_policies_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_tls_inspection_policies_async_from_dict(): - await test_list_tls_inspection_policies_async(request_type=dict) - - def test_list_tls_inspection_policies_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15834,8 +15907,8 @@ async def test_list_tls_inspection_policies_async_pages(): @pytest.mark.parametrize( "request_type", [ - tls_inspection_policy.GetTlsInspectionPolicyRequest, - dict, + tls_inspection_policy.GetTlsInspectionPolicyRequest(), + {}, ], ) def test_get_tls_inspection_policy(request_type, transport: str = "grpc"): @@ -15846,7 +15919,7 @@ def test_get_tls_inspection_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( @@ -15914,9 +15987,10 @@ def test_get_tls_inspection_policy_non_empty_request_with_auto_populated_field() client.get_tls_inspection_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tls_inspection_policy.GetTlsInspectionPolicyRequest( + request_msg = tls_inspection_policy.GetTlsInspectionPolicyRequest( name="name_value", ) + assert args[0] == request_msg def test_get_tls_inspection_policy_use_cached_wrapped_rpc(): @@ -16002,9 +16076,15 @@ async def test_get_tls_inspection_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + tls_inspection_policy.GetTlsInspectionPolicyRequest(), + {}, + ], +) async def test_get_tls_inspection_policy_async( - transport: str = "grpc_asyncio", - request_type=tls_inspection_policy.GetTlsInspectionPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -16013,7 +16093,7 @@ async def test_get_tls_inspection_policy_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( @@ -16058,11 +16138,6 @@ async def test_get_tls_inspection_policy_async( assert response.custom_tls_features == ["custom_tls_features_value"] -@pytest.mark.asyncio -async def test_get_tls_inspection_policy_async_from_dict(): - await test_get_tls_inspection_policy_async(request_type=dict) - - def test_get_tls_inspection_policy_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16217,8 +16292,8 @@ async def test_get_tls_inspection_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_tls_inspection_policy.CreateTlsInspectionPolicyRequest, - dict, + gcn_tls_inspection_policy.CreateTlsInspectionPolicyRequest(), + {}, ], ) def test_create_tls_inspection_policy(request_type, transport: str = "grpc"): @@ -16229,7 +16304,7 @@ def test_create_tls_inspection_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( @@ -16275,10 +16350,11 @@ def test_create_tls_inspection_policy_non_empty_request_with_auto_populated_fiel client.create_tls_inspection_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_tls_inspection_policy.CreateTlsInspectionPolicyRequest( + request_msg = gcn_tls_inspection_policy.CreateTlsInspectionPolicyRequest( parent="parent_value", tls_inspection_policy_id="tls_inspection_policy_id_value", ) + assert args[0] == request_msg def test_create_tls_inspection_policy_use_cached_wrapped_rpc(): @@ -16374,9 +16450,15 @@ async def test_create_tls_inspection_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcn_tls_inspection_policy.CreateTlsInspectionPolicyRequest(), + {}, + ], +) async def test_create_tls_inspection_policy_async( - transport: str = "grpc_asyncio", - request_type=gcn_tls_inspection_policy.CreateTlsInspectionPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -16385,7 +16467,7 @@ async def test_create_tls_inspection_policy_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( @@ -16407,11 +16489,6 @@ async def test_create_tls_inspection_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_tls_inspection_policy_async_from_dict(): - await test_create_tls_inspection_policy_async(request_type=dict) - - def test_create_tls_inspection_policy_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16594,8 +16671,8 @@ async def test_create_tls_inspection_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_tls_inspection_policy.UpdateTlsInspectionPolicyRequest, - dict, + gcn_tls_inspection_policy.UpdateTlsInspectionPolicyRequest(), + {}, ], ) def test_update_tls_inspection_policy(request_type, transport: str = "grpc"): @@ -16606,7 +16683,7 @@ def test_update_tls_inspection_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( @@ -16649,7 +16726,8 @@ def test_update_tls_inspection_policy_non_empty_request_with_auto_populated_fiel client.update_tls_inspection_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_tls_inspection_policy.UpdateTlsInspectionPolicyRequest() + request_msg = gcn_tls_inspection_policy.UpdateTlsInspectionPolicyRequest() + assert args[0] == request_msg def test_update_tls_inspection_policy_use_cached_wrapped_rpc(): @@ -16745,9 +16823,15 @@ async def test_update_tls_inspection_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcn_tls_inspection_policy.UpdateTlsInspectionPolicyRequest(), + {}, + ], +) async def test_update_tls_inspection_policy_async( - transport: str = "grpc_asyncio", - request_type=gcn_tls_inspection_policy.UpdateTlsInspectionPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -16756,7 +16840,7 @@ async def test_update_tls_inspection_policy_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( @@ -16778,11 +16862,6 @@ async def test_update_tls_inspection_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_tls_inspection_policy_async_from_dict(): - await test_update_tls_inspection_policy_async(request_type=dict) - - def test_update_tls_inspection_policy_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16955,8 +17034,8 @@ async def test_update_tls_inspection_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - tls_inspection_policy.DeleteTlsInspectionPolicyRequest, - dict, + tls_inspection_policy.DeleteTlsInspectionPolicyRequest(), + {}, ], ) def test_delete_tls_inspection_policy(request_type, transport: str = "grpc"): @@ -16967,7 +17046,7 @@ def test_delete_tls_inspection_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( @@ -17012,9 +17091,10 @@ def test_delete_tls_inspection_policy_non_empty_request_with_auto_populated_fiel client.delete_tls_inspection_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tls_inspection_policy.DeleteTlsInspectionPolicyRequest( + request_msg = tls_inspection_policy.DeleteTlsInspectionPolicyRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_tls_inspection_policy_use_cached_wrapped_rpc(): @@ -17110,9 +17190,15 @@ async def test_delete_tls_inspection_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + tls_inspection_policy.DeleteTlsInspectionPolicyRequest(), + {}, + ], +) async def test_delete_tls_inspection_policy_async( - transport: str = "grpc_asyncio", - request_type=tls_inspection_policy.DeleteTlsInspectionPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -17121,7 +17207,7 @@ async def test_delete_tls_inspection_policy_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( @@ -17143,11 +17229,6 @@ async def test_delete_tls_inspection_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_tls_inspection_policy_async_from_dict(): - await test_delete_tls_inspection_policy_async(request_type=dict) - - def test_delete_tls_inspection_policy_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17302,8 +17383,8 @@ async def test_delete_tls_inspection_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - authz_policy.ListAuthzPoliciesRequest, - dict, + authz_policy.ListAuthzPoliciesRequest(), + {}, ], ) def test_list_authz_policies(request_type, transport: str = "grpc"): @@ -17314,7 +17395,7 @@ def test_list_authz_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( @@ -17367,12 +17448,13 @@ def test_list_authz_policies_non_empty_request_with_auto_populated_field(): client.list_authz_policies(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == authz_policy.ListAuthzPoliciesRequest( + request_msg = authz_policy.ListAuthzPoliciesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_authz_policies_use_cached_wrapped_rpc(): @@ -17457,9 +17539,14 @@ async def test_list_authz_policies_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_authz_policies_async( - transport: str = "grpc_asyncio", request_type=authz_policy.ListAuthzPoliciesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + authz_policy.ListAuthzPoliciesRequest(), + {}, + ], +) +async def test_list_authz_policies_async(request_type, transport: str = "grpc_asyncio"): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -17467,7 +17554,7 @@ async def test_list_authz_policies_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( @@ -17494,11 +17581,6 @@ async def test_list_authz_policies_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_authz_policies_async_from_dict(): - await test_list_authz_policies_async(request_type=dict) - - def test_list_authz_policies_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17851,8 +17933,8 @@ async def test_list_authz_policies_async_pages(): @pytest.mark.parametrize( "request_type", [ - authz_policy.GetAuthzPolicyRequest, - dict, + authz_policy.GetAuthzPolicyRequest(), + {}, ], ) def test_get_authz_policy(request_type, transport: str = "grpc"): @@ -17863,7 +17945,7 @@ def test_get_authz_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(type(client.transport.get_authz_policy), "__call__") as call: @@ -17911,9 +17993,10 @@ def test_get_authz_policy_non_empty_request_with_auto_populated_field(): client.get_authz_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == authz_policy.GetAuthzPolicyRequest( + request_msg = authz_policy.GetAuthzPolicyRequest( name="name_value", ) + assert args[0] == request_msg def test_get_authz_policy_use_cached_wrapped_rpc(): @@ -17996,9 +18079,14 @@ async def test_get_authz_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_authz_policy_async( - transport: str = "grpc_asyncio", request_type=authz_policy.GetAuthzPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + authz_policy.GetAuthzPolicyRequest(), + {}, + ], +) +async def test_get_authz_policy_async(request_type, transport: str = "grpc_asyncio"): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -18006,7 +18094,7 @@ async def test_get_authz_policy_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_authz_policy), "__call__") as call: @@ -18033,11 +18121,6 @@ async def test_get_authz_policy_async( assert response.action == authz_policy.AuthzPolicy.AuthzAction.ALLOW -@pytest.mark.asyncio -async def test_get_authz_policy_async_from_dict(): - await test_get_authz_policy_async(request_type=dict) - - def test_get_authz_policy_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18184,8 +18267,8 @@ async def test_get_authz_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_authz_policy.CreateAuthzPolicyRequest, - dict, + gcn_authz_policy.CreateAuthzPolicyRequest(), + {}, ], ) def test_create_authz_policy(request_type, transport: str = "grpc"): @@ -18196,7 +18279,7 @@ def test_create_authz_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( @@ -18242,10 +18325,11 @@ def test_create_authz_policy_non_empty_request_with_auto_populated_field(): client.create_authz_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_authz_policy.CreateAuthzPolicyRequest( + request_msg = gcn_authz_policy.CreateAuthzPolicyRequest( parent="parent_value", authz_policy_id="authz_policy_id_value", ) + assert args[0] == request_msg def test_create_authz_policy_use_cached_wrapped_rpc(): @@ -18340,10 +18424,14 @@ async def test_create_authz_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_authz_policy_async( - transport: str = "grpc_asyncio", - request_type=gcn_authz_policy.CreateAuthzPolicyRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + gcn_authz_policy.CreateAuthzPolicyRequest(), + {}, + ], +) +async def test_create_authz_policy_async(request_type, transport: str = "grpc_asyncio"): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -18351,7 +18439,7 @@ async def test_create_authz_policy_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( @@ -18373,11 +18461,6 @@ async def test_create_authz_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_authz_policy_async_from_dict(): - await test_create_authz_policy_async(request_type=dict) - - def test_create_authz_policy_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18552,8 +18635,8 @@ async def test_create_authz_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_authz_policy.UpdateAuthzPolicyRequest, - dict, + gcn_authz_policy.UpdateAuthzPolicyRequest(), + {}, ], ) def test_update_authz_policy(request_type, transport: str = "grpc"): @@ -18564,7 +18647,7 @@ def test_update_authz_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( @@ -18607,7 +18690,8 @@ def test_update_authz_policy_non_empty_request_with_auto_populated_field(): client.update_authz_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_authz_policy.UpdateAuthzPolicyRequest() + request_msg = gcn_authz_policy.UpdateAuthzPolicyRequest() + assert args[0] == request_msg def test_update_authz_policy_use_cached_wrapped_rpc(): @@ -18702,10 +18786,14 @@ async def test_update_authz_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_authz_policy_async( - transport: str = "grpc_asyncio", - request_type=gcn_authz_policy.UpdateAuthzPolicyRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + gcn_authz_policy.UpdateAuthzPolicyRequest(), + {}, + ], +) +async def test_update_authz_policy_async(request_type, transport: str = "grpc_asyncio"): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -18713,7 +18801,7 @@ async def test_update_authz_policy_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( @@ -18735,11 +18823,6 @@ async def test_update_authz_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_authz_policy_async_from_dict(): - await test_update_authz_policy_async(request_type=dict) - - def test_update_authz_policy_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18904,8 +18987,8 @@ async def test_update_authz_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - authz_policy.DeleteAuthzPolicyRequest, - dict, + authz_policy.DeleteAuthzPolicyRequest(), + {}, ], ) def test_delete_authz_policy(request_type, transport: str = "grpc"): @@ -18916,7 +18999,7 @@ def test_delete_authz_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( @@ -18961,9 +19044,10 @@ def test_delete_authz_policy_non_empty_request_with_auto_populated_field(): client.delete_authz_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == authz_policy.DeleteAuthzPolicyRequest( + request_msg = authz_policy.DeleteAuthzPolicyRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_authz_policy_use_cached_wrapped_rpc(): @@ -19058,9 +19142,14 @@ async def test_delete_authz_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_authz_policy_async( - transport: str = "grpc_asyncio", request_type=authz_policy.DeleteAuthzPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + authz_policy.DeleteAuthzPolicyRequest(), + {}, + ], +) +async def test_delete_authz_policy_async(request_type, transport: str = "grpc_asyncio"): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -19068,7 +19157,7 @@ async def test_delete_authz_policy_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( @@ -19090,11 +19179,6 @@ async def test_delete_authz_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_authz_policy_async_from_dict(): - await test_delete_authz_policy_async(request_type=dict) - - def test_delete_authz_policy_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -28794,7 +28878,6 @@ def test_list_authorization_policies_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = authorization_policy.ListAuthorizationPoliciesRequest() - assert args[0] == request_msg @@ -28817,7 +28900,6 @@ def test_get_authorization_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = authorization_policy.GetAuthorizationPolicyRequest() - assert args[0] == request_msg @@ -28840,7 +28922,6 @@ def test_create_authorization_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_authorization_policy.CreateAuthorizationPolicyRequest() - assert args[0] == request_msg @@ -28863,7 +28944,6 @@ def test_update_authorization_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_authorization_policy.UpdateAuthorizationPolicyRequest() - assert args[0] == request_msg @@ -28886,7 +28966,6 @@ def test_delete_authorization_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = authorization_policy.DeleteAuthorizationPolicyRequest() - assert args[0] == request_msg @@ -28913,7 +28992,6 @@ def test_list_backend_authentication_configs_empty_call_grpc(): request_msg = ( backend_authentication_config.ListBackendAuthenticationConfigsRequest() ) - assert args[0] == request_msg @@ -28938,7 +29016,6 @@ def test_get_backend_authentication_config_empty_call_grpc(): request_msg = ( backend_authentication_config.GetBackendAuthenticationConfigRequest() ) - assert args[0] == request_msg @@ -28963,7 +29040,6 @@ def test_create_backend_authentication_config_empty_call_grpc(): request_msg = ( gcn_backend_authentication_config.CreateBackendAuthenticationConfigRequest() ) - assert args[0] == request_msg @@ -28988,7 +29064,6 @@ def test_update_backend_authentication_config_empty_call_grpc(): request_msg = ( gcn_backend_authentication_config.UpdateBackendAuthenticationConfigRequest() ) - assert args[0] == request_msg @@ -29013,7 +29088,6 @@ def test_delete_backend_authentication_config_empty_call_grpc(): request_msg = ( backend_authentication_config.DeleteBackendAuthenticationConfigRequest() ) - assert args[0] == request_msg @@ -29036,7 +29110,6 @@ def test_list_server_tls_policies_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = server_tls_policy.ListServerTlsPoliciesRequest() - assert args[0] == request_msg @@ -29059,7 +29132,6 @@ def test_get_server_tls_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = server_tls_policy.GetServerTlsPolicyRequest() - assert args[0] == request_msg @@ -29082,7 +29154,6 @@ def test_create_server_tls_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_server_tls_policy.CreateServerTlsPolicyRequest() - assert args[0] == request_msg @@ -29105,7 +29176,6 @@ def test_update_server_tls_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_server_tls_policy.UpdateServerTlsPolicyRequest() - assert args[0] == request_msg @@ -29128,7 +29198,6 @@ def test_delete_server_tls_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = server_tls_policy.DeleteServerTlsPolicyRequest() - assert args[0] == request_msg @@ -29151,7 +29220,6 @@ def test_list_client_tls_policies_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = client_tls_policy.ListClientTlsPoliciesRequest() - assert args[0] == request_msg @@ -29174,7 +29242,6 @@ def test_get_client_tls_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = client_tls_policy.GetClientTlsPolicyRequest() - assert args[0] == request_msg @@ -29197,7 +29264,6 @@ def test_create_client_tls_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_client_tls_policy.CreateClientTlsPolicyRequest() - assert args[0] == request_msg @@ -29220,7 +29286,6 @@ def test_update_client_tls_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_client_tls_policy.UpdateClientTlsPolicyRequest() - assert args[0] == request_msg @@ -29243,7 +29308,6 @@ def test_delete_client_tls_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = client_tls_policy.DeleteClientTlsPolicyRequest() - assert args[0] == request_msg @@ -29268,7 +29332,6 @@ def test_list_gateway_security_policies_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gateway_security_policy.ListGatewaySecurityPoliciesRequest() - assert args[0] == request_msg @@ -29291,7 +29354,6 @@ def test_get_gateway_security_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gateway_security_policy.GetGatewaySecurityPolicyRequest() - assert args[0] == request_msg @@ -29314,7 +29376,6 @@ def test_create_gateway_security_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_gateway_security_policy.CreateGatewaySecurityPolicyRequest() - assert args[0] == request_msg @@ -29337,7 +29398,6 @@ def test_update_gateway_security_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_gateway_security_policy.UpdateGatewaySecurityPolicyRequest() - assert args[0] == request_msg @@ -29360,7 +29420,6 @@ def test_delete_gateway_security_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gateway_security_policy.DeleteGatewaySecurityPolicyRequest() - assert args[0] == request_msg @@ -29387,7 +29446,6 @@ def test_list_gateway_security_policy_rules_empty_call_grpc(): request_msg = ( gateway_security_policy_rule.ListGatewaySecurityPolicyRulesRequest() ) - assert args[0] == request_msg @@ -29410,7 +29468,6 @@ def test_get_gateway_security_policy_rule_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gateway_security_policy_rule.GetGatewaySecurityPolicyRuleRequest() - assert args[0] == request_msg @@ -29435,7 +29492,6 @@ def test_create_gateway_security_policy_rule_empty_call_grpc(): request_msg = ( gcn_gateway_security_policy_rule.CreateGatewaySecurityPolicyRuleRequest() ) - assert args[0] == request_msg @@ -29460,7 +29516,6 @@ def test_update_gateway_security_policy_rule_empty_call_grpc(): request_msg = ( gcn_gateway_security_policy_rule.UpdateGatewaySecurityPolicyRuleRequest() ) - assert args[0] == request_msg @@ -29485,7 +29540,6 @@ def test_delete_gateway_security_policy_rule_empty_call_grpc(): request_msg = ( gateway_security_policy_rule.DeleteGatewaySecurityPolicyRuleRequest() ) - assert args[0] == request_msg @@ -29506,7 +29560,6 @@ def test_list_url_lists_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = url_list.ListUrlListsRequest() - assert args[0] == request_msg @@ -29527,7 +29580,6 @@ def test_get_url_list_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = url_list.GetUrlListRequest() - assert args[0] == request_msg @@ -29548,7 +29600,6 @@ def test_create_url_list_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_url_list.CreateUrlListRequest() - assert args[0] == request_msg @@ -29569,7 +29620,6 @@ def test_update_url_list_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_url_list.UpdateUrlListRequest() - assert args[0] == request_msg @@ -29590,7 +29640,6 @@ def test_delete_url_list_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = url_list.DeleteUrlListRequest() - assert args[0] == request_msg @@ -29613,7 +29662,6 @@ def test_list_tls_inspection_policies_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tls_inspection_policy.ListTlsInspectionPoliciesRequest() - assert args[0] == request_msg @@ -29636,7 +29684,6 @@ def test_get_tls_inspection_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tls_inspection_policy.GetTlsInspectionPolicyRequest() - assert args[0] == request_msg @@ -29659,7 +29706,6 @@ def test_create_tls_inspection_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_tls_inspection_policy.CreateTlsInspectionPolicyRequest() - assert args[0] == request_msg @@ -29682,7 +29728,6 @@ def test_update_tls_inspection_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_tls_inspection_policy.UpdateTlsInspectionPolicyRequest() - assert args[0] == request_msg @@ -29705,7 +29750,6 @@ def test_delete_tls_inspection_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tls_inspection_policy.DeleteTlsInspectionPolicyRequest() - assert args[0] == request_msg @@ -29728,7 +29772,6 @@ def test_list_authz_policies_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = authz_policy.ListAuthzPoliciesRequest() - assert args[0] == request_msg @@ -29749,7 +29792,6 @@ def test_get_authz_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = authz_policy.GetAuthzPolicyRequest() - assert args[0] == request_msg @@ -29772,7 +29814,6 @@ def test_create_authz_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_authz_policy.CreateAuthzPolicyRequest() - assert args[0] == request_msg @@ -29795,7 +29836,6 @@ def test_update_authz_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_authz_policy.UpdateAuthzPolicyRequest() - assert args[0] == request_msg @@ -29818,7 +29858,6 @@ def test_delete_authz_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = authz_policy.DeleteAuthzPolicyRequest() - assert args[0] == request_msg @@ -29861,7 +29900,6 @@ async def test_list_authorization_policies_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = authorization_policy.ListAuthorizationPoliciesRequest() - assert args[0] == request_msg @@ -29892,7 +29930,6 @@ async def test_get_authorization_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = authorization_policy.GetAuthorizationPolicyRequest() - assert args[0] == request_msg @@ -29919,7 +29956,6 @@ async def test_create_authorization_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_authorization_policy.CreateAuthorizationPolicyRequest() - assert args[0] == request_msg @@ -29946,7 +29982,6 @@ async def test_update_authorization_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_authorization_policy.UpdateAuthorizationPolicyRequest() - assert args[0] == request_msg @@ -29973,7 +30008,6 @@ async def test_delete_authorization_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = authorization_policy.DeleteAuthorizationPolicyRequest() - assert args[0] == request_msg @@ -30005,7 +30039,6 @@ async def test_list_backend_authentication_configs_empty_call_grpc_asyncio(): request_msg = ( backend_authentication_config.ListBackendAuthenticationConfigsRequest() ) - assert args[0] == request_msg @@ -30041,7 +30074,6 @@ async def test_get_backend_authentication_config_empty_call_grpc_asyncio(): request_msg = ( backend_authentication_config.GetBackendAuthenticationConfigRequest() ) - assert args[0] == request_msg @@ -30070,7 +30102,6 @@ async def test_create_backend_authentication_config_empty_call_grpc_asyncio(): request_msg = ( gcn_backend_authentication_config.CreateBackendAuthenticationConfigRequest() ) - assert args[0] == request_msg @@ -30099,7 +30130,6 @@ async def test_update_backend_authentication_config_empty_call_grpc_asyncio(): request_msg = ( gcn_backend_authentication_config.UpdateBackendAuthenticationConfigRequest() ) - assert args[0] == request_msg @@ -30128,7 +30158,6 @@ async def test_delete_backend_authentication_config_empty_call_grpc_asyncio(): request_msg = ( backend_authentication_config.DeleteBackendAuthenticationConfigRequest() ) - assert args[0] == request_msg @@ -30158,7 +30187,6 @@ async def test_list_server_tls_policies_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = server_tls_policy.ListServerTlsPoliciesRequest() - assert args[0] == request_msg @@ -30189,7 +30217,6 @@ async def test_get_server_tls_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = server_tls_policy.GetServerTlsPolicyRequest() - assert args[0] == request_msg @@ -30216,7 +30243,6 @@ async def test_create_server_tls_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_server_tls_policy.CreateServerTlsPolicyRequest() - assert args[0] == request_msg @@ -30243,7 +30269,6 @@ async def test_update_server_tls_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_server_tls_policy.UpdateServerTlsPolicyRequest() - assert args[0] == request_msg @@ -30270,7 +30295,6 @@ async def test_delete_server_tls_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = server_tls_policy.DeleteServerTlsPolicyRequest() - assert args[0] == request_msg @@ -30299,7 +30323,6 @@ async def test_list_client_tls_policies_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = client_tls_policy.ListClientTlsPoliciesRequest() - assert args[0] == request_msg @@ -30330,7 +30353,6 @@ async def test_get_client_tls_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = client_tls_policy.GetClientTlsPolicyRequest() - assert args[0] == request_msg @@ -30357,7 +30379,6 @@ async def test_create_client_tls_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_client_tls_policy.CreateClientTlsPolicyRequest() - assert args[0] == request_msg @@ -30384,7 +30405,6 @@ async def test_update_client_tls_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_client_tls_policy.UpdateClientTlsPolicyRequest() - assert args[0] == request_msg @@ -30411,7 +30431,6 @@ async def test_delete_client_tls_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = client_tls_policy.DeleteClientTlsPolicyRequest() - assert args[0] == request_msg @@ -30441,7 +30460,6 @@ async def test_list_gateway_security_policies_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gateway_security_policy.ListGatewaySecurityPoliciesRequest() - assert args[0] == request_msg @@ -30472,7 +30490,6 @@ async def test_get_gateway_security_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gateway_security_policy.GetGatewaySecurityPolicyRequest() - assert args[0] == request_msg @@ -30499,7 +30516,6 @@ async def test_create_gateway_security_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_gateway_security_policy.CreateGatewaySecurityPolicyRequest() - assert args[0] == request_msg @@ -30526,7 +30542,6 @@ async def test_update_gateway_security_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_gateway_security_policy.UpdateGatewaySecurityPolicyRequest() - assert args[0] == request_msg @@ -30553,7 +30568,6 @@ async def test_delete_gateway_security_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gateway_security_policy.DeleteGatewaySecurityPolicyRequest() - assert args[0] == request_msg @@ -30585,7 +30599,6 @@ async def test_list_gateway_security_policy_rules_empty_call_grpc_asyncio(): request_msg = ( gateway_security_policy_rule.ListGatewaySecurityPolicyRulesRequest() ) - assert args[0] == request_msg @@ -30620,7 +30633,6 @@ async def test_get_gateway_security_policy_rule_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gateway_security_policy_rule.GetGatewaySecurityPolicyRuleRequest() - assert args[0] == request_msg @@ -30649,7 +30661,6 @@ async def test_create_gateway_security_policy_rule_empty_call_grpc_asyncio(): request_msg = ( gcn_gateway_security_policy_rule.CreateGatewaySecurityPolicyRuleRequest() ) - assert args[0] == request_msg @@ -30678,7 +30689,6 @@ async def test_update_gateway_security_policy_rule_empty_call_grpc_asyncio(): request_msg = ( gcn_gateway_security_policy_rule.UpdateGatewaySecurityPolicyRuleRequest() ) - assert args[0] == request_msg @@ -30707,7 +30717,6 @@ async def test_delete_gateway_security_policy_rule_empty_call_grpc_asyncio(): request_msg = ( gateway_security_policy_rule.DeleteGatewaySecurityPolicyRuleRequest() ) - assert args[0] == request_msg @@ -30735,7 +30744,6 @@ async def test_list_url_lists_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = url_list.ListUrlListsRequest() - assert args[0] == request_msg @@ -30764,7 +30772,6 @@ async def test_get_url_list_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = url_list.GetUrlListRequest() - assert args[0] == request_msg @@ -30789,7 +30796,6 @@ async def test_create_url_list_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_url_list.CreateUrlListRequest() - assert args[0] == request_msg @@ -30814,7 +30820,6 @@ async def test_update_url_list_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_url_list.UpdateUrlListRequest() - assert args[0] == request_msg @@ -30839,7 +30844,6 @@ async def test_delete_url_list_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = url_list.DeleteUrlListRequest() - assert args[0] == request_msg @@ -30869,7 +30873,6 @@ async def test_list_tls_inspection_policies_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tls_inspection_policy.ListTlsInspectionPoliciesRequest() - assert args[0] == request_msg @@ -30905,7 +30908,6 @@ async def test_get_tls_inspection_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tls_inspection_policy.GetTlsInspectionPolicyRequest() - assert args[0] == request_msg @@ -30932,7 +30934,6 @@ async def test_create_tls_inspection_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_tls_inspection_policy.CreateTlsInspectionPolicyRequest() - assert args[0] == request_msg @@ -30959,7 +30960,6 @@ async def test_update_tls_inspection_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_tls_inspection_policy.UpdateTlsInspectionPolicyRequest() - assert args[0] == request_msg @@ -30986,7 +30986,6 @@ async def test_delete_tls_inspection_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tls_inspection_policy.DeleteTlsInspectionPolicyRequest() - assert args[0] == request_msg @@ -31016,7 +31015,6 @@ async def test_list_authz_policies_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = authz_policy.ListAuthzPoliciesRequest() - assert args[0] == request_msg @@ -31045,7 +31043,6 @@ async def test_get_authz_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = authz_policy.GetAuthzPolicyRequest() - assert args[0] == request_msg @@ -31072,7 +31069,6 @@ async def test_create_authz_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_authz_policy.CreateAuthzPolicyRequest() - assert args[0] == request_msg @@ -31099,7 +31095,6 @@ async def test_update_authz_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_authz_policy.UpdateAuthzPolicyRequest() - assert args[0] == request_msg @@ -31126,7 +31121,6 @@ async def test_delete_authz_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = authz_policy.DeleteAuthzPolicyRequest() - assert args[0] == request_msg @@ -39535,7 +39529,6 @@ def test_list_authorization_policies_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = authorization_policy.ListAuthorizationPoliciesRequest() - assert args[0] == request_msg @@ -39557,7 +39550,6 @@ def test_get_authorization_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = authorization_policy.GetAuthorizationPolicyRequest() - assert args[0] == request_msg @@ -39579,7 +39571,6 @@ def test_create_authorization_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_authorization_policy.CreateAuthorizationPolicyRequest() - assert args[0] == request_msg @@ -39601,7 +39592,6 @@ def test_update_authorization_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_authorization_policy.UpdateAuthorizationPolicyRequest() - assert args[0] == request_msg @@ -39623,7 +39613,6 @@ def test_delete_authorization_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = authorization_policy.DeleteAuthorizationPolicyRequest() - assert args[0] == request_msg @@ -39647,7 +39636,6 @@ def test_list_backend_authentication_configs_empty_call_rest(): request_msg = ( backend_authentication_config.ListBackendAuthenticationConfigsRequest() ) - assert args[0] == request_msg @@ -39671,7 +39659,6 @@ def test_get_backend_authentication_config_empty_call_rest(): request_msg = ( backend_authentication_config.GetBackendAuthenticationConfigRequest() ) - assert args[0] == request_msg @@ -39695,7 +39682,6 @@ def test_create_backend_authentication_config_empty_call_rest(): request_msg = ( gcn_backend_authentication_config.CreateBackendAuthenticationConfigRequest() ) - assert args[0] == request_msg @@ -39719,7 +39705,6 @@ def test_update_backend_authentication_config_empty_call_rest(): request_msg = ( gcn_backend_authentication_config.UpdateBackendAuthenticationConfigRequest() ) - assert args[0] == request_msg @@ -39743,7 +39728,6 @@ def test_delete_backend_authentication_config_empty_call_rest(): request_msg = ( backend_authentication_config.DeleteBackendAuthenticationConfigRequest() ) - assert args[0] == request_msg @@ -39765,7 +39749,6 @@ def test_list_server_tls_policies_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = server_tls_policy.ListServerTlsPoliciesRequest() - assert args[0] == request_msg @@ -39787,7 +39770,6 @@ def test_get_server_tls_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = server_tls_policy.GetServerTlsPolicyRequest() - assert args[0] == request_msg @@ -39809,7 +39791,6 @@ def test_create_server_tls_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_server_tls_policy.CreateServerTlsPolicyRequest() - assert args[0] == request_msg @@ -39831,7 +39812,6 @@ def test_update_server_tls_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_server_tls_policy.UpdateServerTlsPolicyRequest() - assert args[0] == request_msg @@ -39853,7 +39833,6 @@ def test_delete_server_tls_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = server_tls_policy.DeleteServerTlsPolicyRequest() - assert args[0] == request_msg @@ -39875,7 +39854,6 @@ def test_list_client_tls_policies_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = client_tls_policy.ListClientTlsPoliciesRequest() - assert args[0] == request_msg @@ -39897,7 +39875,6 @@ def test_get_client_tls_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = client_tls_policy.GetClientTlsPolicyRequest() - assert args[0] == request_msg @@ -39919,7 +39896,6 @@ def test_create_client_tls_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_client_tls_policy.CreateClientTlsPolicyRequest() - assert args[0] == request_msg @@ -39941,7 +39917,6 @@ def test_update_client_tls_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_client_tls_policy.UpdateClientTlsPolicyRequest() - assert args[0] == request_msg @@ -39963,7 +39938,6 @@ def test_delete_client_tls_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = client_tls_policy.DeleteClientTlsPolicyRequest() - assert args[0] == request_msg @@ -39985,7 +39959,6 @@ def test_list_gateway_security_policies_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gateway_security_policy.ListGatewaySecurityPoliciesRequest() - assert args[0] == request_msg @@ -40007,7 +39980,6 @@ def test_get_gateway_security_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gateway_security_policy.GetGatewaySecurityPolicyRequest() - assert args[0] == request_msg @@ -40029,7 +40001,6 @@ def test_create_gateway_security_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_gateway_security_policy.CreateGatewaySecurityPolicyRequest() - assert args[0] == request_msg @@ -40051,7 +40022,6 @@ def test_update_gateway_security_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_gateway_security_policy.UpdateGatewaySecurityPolicyRequest() - assert args[0] == request_msg @@ -40073,7 +40043,6 @@ def test_delete_gateway_security_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gateway_security_policy.DeleteGatewaySecurityPolicyRequest() - assert args[0] == request_msg @@ -40097,7 +40066,6 @@ def test_list_gateway_security_policy_rules_empty_call_rest(): request_msg = ( gateway_security_policy_rule.ListGatewaySecurityPolicyRulesRequest() ) - assert args[0] == request_msg @@ -40119,7 +40087,6 @@ def test_get_gateway_security_policy_rule_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gateway_security_policy_rule.GetGatewaySecurityPolicyRuleRequest() - assert args[0] == request_msg @@ -40143,7 +40110,6 @@ def test_create_gateway_security_policy_rule_empty_call_rest(): request_msg = ( gcn_gateway_security_policy_rule.CreateGatewaySecurityPolicyRuleRequest() ) - assert args[0] == request_msg @@ -40167,7 +40133,6 @@ def test_update_gateway_security_policy_rule_empty_call_rest(): request_msg = ( gcn_gateway_security_policy_rule.UpdateGatewaySecurityPolicyRuleRequest() ) - assert args[0] == request_msg @@ -40191,7 +40156,6 @@ def test_delete_gateway_security_policy_rule_empty_call_rest(): request_msg = ( gateway_security_policy_rule.DeleteGatewaySecurityPolicyRuleRequest() ) - assert args[0] == request_msg @@ -40211,7 +40175,6 @@ def test_list_url_lists_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = url_list.ListUrlListsRequest() - assert args[0] == request_msg @@ -40231,7 +40194,6 @@ def test_get_url_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = url_list.GetUrlListRequest() - assert args[0] == request_msg @@ -40251,7 +40213,6 @@ def test_create_url_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_url_list.CreateUrlListRequest() - assert args[0] == request_msg @@ -40271,7 +40232,6 @@ def test_update_url_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_url_list.UpdateUrlListRequest() - assert args[0] == request_msg @@ -40291,7 +40251,6 @@ def test_delete_url_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = url_list.DeleteUrlListRequest() - assert args[0] == request_msg @@ -40313,7 +40272,6 @@ def test_list_tls_inspection_policies_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tls_inspection_policy.ListTlsInspectionPoliciesRequest() - assert args[0] == request_msg @@ -40335,7 +40293,6 @@ def test_get_tls_inspection_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tls_inspection_policy.GetTlsInspectionPolicyRequest() - assert args[0] == request_msg @@ -40357,7 +40314,6 @@ def test_create_tls_inspection_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_tls_inspection_policy.CreateTlsInspectionPolicyRequest() - assert args[0] == request_msg @@ -40379,7 +40335,6 @@ def test_update_tls_inspection_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_tls_inspection_policy.UpdateTlsInspectionPolicyRequest() - assert args[0] == request_msg @@ -40401,7 +40356,6 @@ def test_delete_tls_inspection_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tls_inspection_policy.DeleteTlsInspectionPolicyRequest() - assert args[0] == request_msg @@ -40423,7 +40377,6 @@ def test_list_authz_policies_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = authz_policy.ListAuthzPoliciesRequest() - assert args[0] == request_msg @@ -40443,7 +40396,6 @@ def test_get_authz_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = authz_policy.GetAuthzPolicyRequest() - assert args[0] == request_msg @@ -40465,7 +40417,6 @@ def test_create_authz_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_authz_policy.CreateAuthzPolicyRequest() - assert args[0] == request_msg @@ -40487,7 +40438,6 @@ def test_update_authz_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_authz_policy.UpdateAuthzPolicyRequest() - assert args[0] == request_msg @@ -40509,7 +40459,6 @@ def test_delete_authz_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = authz_policy.DeleteAuthzPolicyRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-network-security/tests/unit/gapic/network_security_v1alpha1/test_organization_security_profile_group_service.py b/packages/google-cloud-network-security/tests/unit/gapic/network_security_v1alpha1/test_organization_security_profile_group_service.py index b0912ccb85b3..c6422b8298b2 100644 --- a/packages/google-cloud-network-security/tests/unit/gapic/network_security_v1alpha1/test_organization_security_profile_group_service.py +++ b/packages/google-cloud-network-security/tests/unit/gapic/network_security_v1alpha1/test_organization_security_profile_group_service.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 @@ -132,6 +133,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" @@ -1487,8 +1503,8 @@ def test_organization_security_profile_group_service_client_create_channel_crede @pytest.mark.parametrize( "request_type", [ - security_profile_group_service.ListSecurityProfileGroupsRequest, - dict, + security_profile_group_service.ListSecurityProfileGroupsRequest(), + {}, ], ) def test_list_security_profile_groups(request_type, transport: str = "grpc"): @@ -1499,7 +1515,7 @@ def test_list_security_profile_groups(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1550,12 +1566,11 @@ def test_list_security_profile_groups_non_empty_request_with_auto_populated_fiel client.list_security_profile_groups(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == security_profile_group_service.ListSecurityProfileGroupsRequest( + request_msg = security_profile_group_service.ListSecurityProfileGroupsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_security_profile_groups_use_cached_wrapped_rpc(): @@ -1641,9 +1656,15 @@ async def test_list_security_profile_groups_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + security_profile_group_service.ListSecurityProfileGroupsRequest(), + {}, + ], +) async def test_list_security_profile_groups_async( - transport: str = "grpc_asyncio", - request_type=security_profile_group_service.ListSecurityProfileGroupsRequest, + request_type, transport: str = "grpc_asyncio" ): client = OrganizationSecurityProfileGroupServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1652,7 +1673,7 @@ async def test_list_security_profile_groups_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( @@ -1677,11 +1698,6 @@ async def test_list_security_profile_groups_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_security_profile_groups_async_from_dict(): - await test_list_security_profile_groups_async(request_type=dict) - - def test_list_security_profile_groups_field_headers(): client = OrganizationSecurityProfileGroupServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2049,8 +2065,8 @@ async def test_list_security_profile_groups_async_pages(): @pytest.mark.parametrize( "request_type", [ - security_profile_group_service.GetSecurityProfileGroupRequest, - dict, + security_profile_group_service.GetSecurityProfileGroupRequest(), + {}, ], ) def test_get_security_profile_group(request_type, transport: str = "grpc"): @@ -2061,7 +2077,7 @@ def test_get_security_profile_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2123,9 +2139,10 @@ def test_get_security_profile_group_non_empty_request_with_auto_populated_field( client.get_security_profile_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == security_profile_group_service.GetSecurityProfileGroupRequest( + request_msg = security_profile_group_service.GetSecurityProfileGroupRequest( name="name_value", ) + assert args[0] == request_msg def test_get_security_profile_group_use_cached_wrapped_rpc(): @@ -2211,9 +2228,15 @@ async def test_get_security_profile_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + security_profile_group_service.GetSecurityProfileGroupRequest(), + {}, + ], +) async def test_get_security_profile_group_async( - transport: str = "grpc_asyncio", - request_type=security_profile_group_service.GetSecurityProfileGroupRequest, + request_type, transport: str = "grpc_asyncio" ): client = OrganizationSecurityProfileGroupServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2222,7 +2245,7 @@ async def test_get_security_profile_group_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( @@ -2261,11 +2284,6 @@ async def test_get_security_profile_group_async( assert response.url_filtering_profile == "url_filtering_profile_value" -@pytest.mark.asyncio -async def test_get_security_profile_group_async_from_dict(): - await test_get_security_profile_group_async(request_type=dict) - - def test_get_security_profile_group_field_headers(): client = OrganizationSecurityProfileGroupServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2420,8 +2438,8 @@ async def test_get_security_profile_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - security_profile_group_service.CreateSecurityProfileGroupRequest, - dict, + security_profile_group_service.CreateSecurityProfileGroupRequest(), + {}, ], ) def test_create_security_profile_group(request_type, transport: str = "grpc"): @@ -2432,7 +2450,7 @@ def test_create_security_profile_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2478,12 +2496,11 @@ def test_create_security_profile_group_non_empty_request_with_auto_populated_fie client.create_security_profile_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == security_profile_group_service.CreateSecurityProfileGroupRequest( + request_msg = security_profile_group_service.CreateSecurityProfileGroupRequest( parent="parent_value", security_profile_group_id="security_profile_group_id_value", ) + assert args[0] == request_msg def test_create_security_profile_group_use_cached_wrapped_rpc(): @@ -2579,9 +2596,15 @@ async def test_create_security_profile_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + security_profile_group_service.CreateSecurityProfileGroupRequest(), + {}, + ], +) async def test_create_security_profile_group_async( - transport: str = "grpc_asyncio", - request_type=security_profile_group_service.CreateSecurityProfileGroupRequest, + request_type, transport: str = "grpc_asyncio" ): client = OrganizationSecurityProfileGroupServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2590,7 +2613,7 @@ async def test_create_security_profile_group_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( @@ -2612,11 +2635,6 @@ async def test_create_security_profile_group_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_security_profile_group_async_from_dict(): - await test_create_security_profile_group_async(request_type=dict) - - def test_create_security_profile_group_field_headers(): client = OrganizationSecurityProfileGroupServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2799,8 +2817,8 @@ async def test_create_security_profile_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - security_profile_group_service.UpdateSecurityProfileGroupRequest, - dict, + security_profile_group_service.UpdateSecurityProfileGroupRequest(), + {}, ], ) def test_update_security_profile_group(request_type, transport: str = "grpc"): @@ -2811,7 +2829,7 @@ def test_update_security_profile_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2854,10 +2872,8 @@ def test_update_security_profile_group_non_empty_request_with_auto_populated_fie client.update_security_profile_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert ( - args[0] - == security_profile_group_service.UpdateSecurityProfileGroupRequest() - ) + request_msg = security_profile_group_service.UpdateSecurityProfileGroupRequest() + assert args[0] == request_msg def test_update_security_profile_group_use_cached_wrapped_rpc(): @@ -2953,9 +2969,15 @@ async def test_update_security_profile_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + security_profile_group_service.UpdateSecurityProfileGroupRequest(), + {}, + ], +) async def test_update_security_profile_group_async( - transport: str = "grpc_asyncio", - request_type=security_profile_group_service.UpdateSecurityProfileGroupRequest, + request_type, transport: str = "grpc_asyncio" ): client = OrganizationSecurityProfileGroupServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2964,7 +2986,7 @@ async def test_update_security_profile_group_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( @@ -2986,11 +3008,6 @@ async def test_update_security_profile_group_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_security_profile_group_async_from_dict(): - await test_update_security_profile_group_async(request_type=dict) - - def test_update_security_profile_group_field_headers(): client = OrganizationSecurityProfileGroupServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3163,8 +3180,8 @@ async def test_update_security_profile_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - security_profile_group_service.DeleteSecurityProfileGroupRequest, - dict, + security_profile_group_service.DeleteSecurityProfileGroupRequest(), + {}, ], ) def test_delete_security_profile_group(request_type, transport: str = "grpc"): @@ -3175,7 +3192,7 @@ def test_delete_security_profile_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3221,12 +3238,11 @@ def test_delete_security_profile_group_non_empty_request_with_auto_populated_fie client.delete_security_profile_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == security_profile_group_service.DeleteSecurityProfileGroupRequest( + request_msg = security_profile_group_service.DeleteSecurityProfileGroupRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_security_profile_group_use_cached_wrapped_rpc(): @@ -3322,9 +3338,15 @@ async def test_delete_security_profile_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + security_profile_group_service.DeleteSecurityProfileGroupRequest(), + {}, + ], +) async def test_delete_security_profile_group_async( - transport: str = "grpc_asyncio", - request_type=security_profile_group_service.DeleteSecurityProfileGroupRequest, + request_type, transport: str = "grpc_asyncio" ): client = OrganizationSecurityProfileGroupServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3333,7 +3355,7 @@ async def test_delete_security_profile_group_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( @@ -3355,11 +3377,6 @@ async def test_delete_security_profile_group_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_security_profile_group_async_from_dict(): - await test_delete_security_profile_group_async(request_type=dict) - - def test_delete_security_profile_group_field_headers(): client = OrganizationSecurityProfileGroupServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3514,8 +3531,8 @@ async def test_delete_security_profile_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - security_profile_group_service.ListSecurityProfilesRequest, - dict, + security_profile_group_service.ListSecurityProfilesRequest(), + {}, ], ) def test_list_security_profiles(request_type, transport: str = "grpc"): @@ -3526,7 +3543,7 @@ def test_list_security_profiles(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3575,10 +3592,11 @@ def test_list_security_profiles_non_empty_request_with_auto_populated_field(): client.list_security_profiles(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == security_profile_group_service.ListSecurityProfilesRequest( + request_msg = security_profile_group_service.ListSecurityProfilesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_security_profiles_use_cached_wrapped_rpc(): @@ -3664,9 +3682,15 @@ async def test_list_security_profiles_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + security_profile_group_service.ListSecurityProfilesRequest(), + {}, + ], +) async def test_list_security_profiles_async( - transport: str = "grpc_asyncio", - request_type=security_profile_group_service.ListSecurityProfilesRequest, + request_type, transport: str = "grpc_asyncio" ): client = OrganizationSecurityProfileGroupServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3675,7 +3699,7 @@ async def test_list_security_profiles_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( @@ -3700,11 +3724,6 @@ async def test_list_security_profiles_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_security_profiles_async_from_dict(): - await test_list_security_profiles_async(request_type=dict) - - def test_list_security_profiles_field_headers(): client = OrganizationSecurityProfileGroupServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4067,8 +4086,8 @@ async def test_list_security_profiles_async_pages(): @pytest.mark.parametrize( "request_type", [ - security_profile_group_service.GetSecurityProfileRequest, - dict, + security_profile_group_service.GetSecurityProfileRequest(), + {}, ], ) def test_get_security_profile(request_type, transport: str = "grpc"): @@ -4079,7 +4098,7 @@ def test_get_security_profile(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4136,9 +4155,10 @@ def test_get_security_profile_non_empty_request_with_auto_populated_field(): client.get_security_profile(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == security_profile_group_service.GetSecurityProfileRequest( + request_msg = security_profile_group_service.GetSecurityProfileRequest( name="name_value", ) + assert args[0] == request_msg def test_get_security_profile_use_cached_wrapped_rpc(): @@ -4223,9 +4243,15 @@ async def test_get_security_profile_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + security_profile_group_service.GetSecurityProfileRequest(), + {}, + ], +) async def test_get_security_profile_async( - transport: str = "grpc_asyncio", - request_type=security_profile_group_service.GetSecurityProfileRequest, + request_type, transport: str = "grpc_asyncio" ): client = OrganizationSecurityProfileGroupServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4234,7 +4260,7 @@ async def test_get_security_profile_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( @@ -4268,11 +4294,6 @@ async def test_get_security_profile_async( ) -@pytest.mark.asyncio -async def test_get_security_profile_async_from_dict(): - await test_get_security_profile_async(request_type=dict) - - def test_get_security_profile_field_headers(): client = OrganizationSecurityProfileGroupServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4427,8 +4448,8 @@ async def test_get_security_profile_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - security_profile_group_service.CreateSecurityProfileRequest, - dict, + security_profile_group_service.CreateSecurityProfileRequest(), + {}, ], ) def test_create_security_profile(request_type, transport: str = "grpc"): @@ -4439,7 +4460,7 @@ def test_create_security_profile(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4485,10 +4506,11 @@ def test_create_security_profile_non_empty_request_with_auto_populated_field(): client.create_security_profile(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == security_profile_group_service.CreateSecurityProfileRequest( + request_msg = security_profile_group_service.CreateSecurityProfileRequest( parent="parent_value", security_profile_id="security_profile_id_value", ) + assert args[0] == request_msg def test_create_security_profile_use_cached_wrapped_rpc(): @@ -4584,9 +4606,15 @@ async def test_create_security_profile_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + security_profile_group_service.CreateSecurityProfileRequest(), + {}, + ], +) async def test_create_security_profile_async( - transport: str = "grpc_asyncio", - request_type=security_profile_group_service.CreateSecurityProfileRequest, + request_type, transport: str = "grpc_asyncio" ): client = OrganizationSecurityProfileGroupServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4595,7 +4623,7 @@ async def test_create_security_profile_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( @@ -4617,11 +4645,6 @@ async def test_create_security_profile_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_security_profile_async_from_dict(): - await test_create_security_profile_async(request_type=dict) - - def test_create_security_profile_field_headers(): client = OrganizationSecurityProfileGroupServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4844,8 +4867,8 @@ async def test_create_security_profile_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - security_profile_group_service.UpdateSecurityProfileRequest, - dict, + security_profile_group_service.UpdateSecurityProfileRequest(), + {}, ], ) def test_update_security_profile(request_type, transport: str = "grpc"): @@ -4856,7 +4879,7 @@ def test_update_security_profile(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4899,7 +4922,8 @@ def test_update_security_profile_non_empty_request_with_auto_populated_field(): client.update_security_profile(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == security_profile_group_service.UpdateSecurityProfileRequest() + request_msg = security_profile_group_service.UpdateSecurityProfileRequest() + assert args[0] == request_msg def test_update_security_profile_use_cached_wrapped_rpc(): @@ -4995,9 +5019,15 @@ async def test_update_security_profile_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + security_profile_group_service.UpdateSecurityProfileRequest(), + {}, + ], +) async def test_update_security_profile_async( - transport: str = "grpc_asyncio", - request_type=security_profile_group_service.UpdateSecurityProfileRequest, + request_type, transport: str = "grpc_asyncio" ): client = OrganizationSecurityProfileGroupServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5006,7 +5036,7 @@ async def test_update_security_profile_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( @@ -5028,11 +5058,6 @@ async def test_update_security_profile_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_security_profile_async_from_dict(): - await test_update_security_profile_async(request_type=dict) - - def test_update_security_profile_field_headers(): client = OrganizationSecurityProfileGroupServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5245,8 +5270,8 @@ async def test_update_security_profile_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - security_profile_group_service.DeleteSecurityProfileRequest, - dict, + security_profile_group_service.DeleteSecurityProfileRequest(), + {}, ], ) def test_delete_security_profile(request_type, transport: str = "grpc"): @@ -5257,7 +5282,7 @@ def test_delete_security_profile(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5303,10 +5328,11 @@ def test_delete_security_profile_non_empty_request_with_auto_populated_field(): client.delete_security_profile(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == security_profile_group_service.DeleteSecurityProfileRequest( + request_msg = security_profile_group_service.DeleteSecurityProfileRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_security_profile_use_cached_wrapped_rpc(): @@ -5402,9 +5428,15 @@ async def test_delete_security_profile_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + security_profile_group_service.DeleteSecurityProfileRequest(), + {}, + ], +) async def test_delete_security_profile_async( - transport: str = "grpc_asyncio", - request_type=security_profile_group_service.DeleteSecurityProfileRequest, + request_type, transport: str = "grpc_asyncio" ): client = OrganizationSecurityProfileGroupServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5413,7 +5445,7 @@ async def test_delete_security_profile_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( @@ -5435,11 +5467,6 @@ async def test_delete_security_profile_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_security_profile_async_from_dict(): - await test_delete_security_profile_async(request_type=dict) - - def test_delete_security_profile_field_headers(): client = OrganizationSecurityProfileGroupServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7864,7 +7891,6 @@ def test_list_security_profile_groups_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_profile_group_service.ListSecurityProfileGroupsRequest() - assert args[0] == request_msg @@ -7887,7 +7913,6 @@ def test_get_security_profile_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_profile_group_service.GetSecurityProfileGroupRequest() - assert args[0] == request_msg @@ -7910,7 +7935,6 @@ def test_create_security_profile_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_profile_group_service.CreateSecurityProfileGroupRequest() - assert args[0] == request_msg @@ -7933,7 +7957,6 @@ def test_update_security_profile_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_profile_group_service.UpdateSecurityProfileGroupRequest() - assert args[0] == request_msg @@ -7956,7 +7979,6 @@ def test_delete_security_profile_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_profile_group_service.DeleteSecurityProfileGroupRequest() - assert args[0] == request_msg @@ -7981,7 +8003,6 @@ def test_list_security_profiles_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_profile_group_service.ListSecurityProfilesRequest() - assert args[0] == request_msg @@ -8004,7 +8025,6 @@ def test_get_security_profile_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_profile_group_service.GetSecurityProfileRequest() - assert args[0] == request_msg @@ -8027,7 +8047,6 @@ def test_create_security_profile_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_profile_group_service.CreateSecurityProfileRequest() - assert args[0] == request_msg @@ -8050,7 +8069,6 @@ def test_update_security_profile_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_profile_group_service.UpdateSecurityProfileRequest() - assert args[0] == request_msg @@ -8073,7 +8091,6 @@ def test_delete_security_profile_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_profile_group_service.DeleteSecurityProfileRequest() - assert args[0] == request_msg @@ -8116,7 +8133,6 @@ async def test_list_security_profile_groups_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_profile_group_service.ListSecurityProfileGroupsRequest() - assert args[0] == request_msg @@ -8152,7 +8168,6 @@ async def test_get_security_profile_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_profile_group_service.GetSecurityProfileGroupRequest() - assert args[0] == request_msg @@ -8179,7 +8194,6 @@ async def test_create_security_profile_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_profile_group_service.CreateSecurityProfileGroupRequest() - assert args[0] == request_msg @@ -8206,7 +8220,6 @@ async def test_update_security_profile_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_profile_group_service.UpdateSecurityProfileGroupRequest() - assert args[0] == request_msg @@ -8233,7 +8246,6 @@ async def test_delete_security_profile_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_profile_group_service.DeleteSecurityProfileGroupRequest() - assert args[0] == request_msg @@ -8262,7 +8274,6 @@ async def test_list_security_profiles_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_profile_group_service.ListSecurityProfilesRequest() - assert args[0] == request_msg @@ -8294,7 +8305,6 @@ async def test_get_security_profile_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_profile_group_service.GetSecurityProfileRequest() - assert args[0] == request_msg @@ -8321,7 +8331,6 @@ async def test_create_security_profile_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_profile_group_service.CreateSecurityProfileRequest() - assert args[0] == request_msg @@ -8348,7 +8357,6 @@ async def test_update_security_profile_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_profile_group_service.UpdateSecurityProfileRequest() - assert args[0] == request_msg @@ -8375,7 +8383,6 @@ async def test_delete_security_profile_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_profile_group_service.DeleteSecurityProfileRequest() - assert args[0] == request_msg @@ -10760,7 +10767,6 @@ def test_list_security_profile_groups_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_profile_group_service.ListSecurityProfileGroupsRequest() - assert args[0] == request_msg @@ -10782,7 +10788,6 @@ def test_get_security_profile_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_profile_group_service.GetSecurityProfileGroupRequest() - assert args[0] == request_msg @@ -10804,7 +10809,6 @@ def test_create_security_profile_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_profile_group_service.CreateSecurityProfileGroupRequest() - assert args[0] == request_msg @@ -10826,7 +10830,6 @@ def test_update_security_profile_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_profile_group_service.UpdateSecurityProfileGroupRequest() - assert args[0] == request_msg @@ -10848,7 +10851,6 @@ def test_delete_security_profile_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_profile_group_service.DeleteSecurityProfileGroupRequest() - assert args[0] == request_msg @@ -10870,7 +10872,6 @@ def test_list_security_profiles_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_profile_group_service.ListSecurityProfilesRequest() - assert args[0] == request_msg @@ -10892,7 +10893,6 @@ def test_get_security_profile_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_profile_group_service.GetSecurityProfileRequest() - assert args[0] == request_msg @@ -10914,7 +10914,6 @@ def test_create_security_profile_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_profile_group_service.CreateSecurityProfileRequest() - assert args[0] == request_msg @@ -10936,7 +10935,6 @@ def test_update_security_profile_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_profile_group_service.UpdateSecurityProfileRequest() - assert args[0] == request_msg @@ -10958,7 +10956,6 @@ def test_delete_security_profile_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_profile_group_service.DeleteSecurityProfileRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-network-security/tests/unit/gapic/network_security_v1alpha1/test_sse_gateway_service.py b/packages/google-cloud-network-security/tests/unit/gapic/network_security_v1alpha1/test_sse_gateway_service.py index 7141cfba5f7f..95e8b5c37df4 100644 --- a/packages/google-cloud-network-security/tests/unit/gapic/network_security_v1alpha1/test_sse_gateway_service.py +++ b/packages/google-cloud-network-security/tests/unit/gapic/network_security_v1alpha1/test_sse_gateway_service.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 @@ -121,6 +122,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" @@ -1362,8 +1378,8 @@ def test_sse_gateway_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - sse_gateway.ListPartnerSSEGatewaysRequest, - dict, + sse_gateway.ListPartnerSSEGatewaysRequest(), + {}, ], ) def test_list_partner_sse_gateways(request_type, transport: str = "grpc"): @@ -1374,7 +1390,7 @@ def test_list_partner_sse_gateways(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1427,12 +1443,13 @@ def test_list_partner_sse_gateways_non_empty_request_with_auto_populated_field() client.list_partner_sse_gateways(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == sse_gateway.ListPartnerSSEGatewaysRequest( + request_msg = sse_gateway.ListPartnerSSEGatewaysRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_partner_sse_gateways_use_cached_wrapped_rpc(): @@ -1518,9 +1535,15 @@ async def test_list_partner_sse_gateways_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + sse_gateway.ListPartnerSSEGatewaysRequest(), + {}, + ], +) async def test_list_partner_sse_gateways_async( - transport: str = "grpc_asyncio", - request_type=sse_gateway.ListPartnerSSEGatewaysRequest, + request_type, transport: str = "grpc_asyncio" ): client = SSEGatewayServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1529,7 +1552,7 @@ async def test_list_partner_sse_gateways_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( @@ -1556,11 +1579,6 @@ async def test_list_partner_sse_gateways_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_partner_sse_gateways_async_from_dict(): - await test_list_partner_sse_gateways_async(request_type=dict) - - def test_list_partner_sse_gateways_field_headers(): client = SSEGatewayServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1915,8 +1933,8 @@ async def test_list_partner_sse_gateways_async_pages(): @pytest.mark.parametrize( "request_type", [ - sse_gateway.GetPartnerSSEGatewayRequest, - dict, + sse_gateway.GetPartnerSSEGatewayRequest(), + {}, ], ) def test_get_partner_sse_gateway(request_type, transport: str = "grpc"): @@ -1927,7 +1945,7 @@ def test_get_partner_sse_gateway(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2013,9 +2031,10 @@ def test_get_partner_sse_gateway_non_empty_request_with_auto_populated_field(): client.get_partner_sse_gateway(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == sse_gateway.GetPartnerSSEGatewayRequest( + request_msg = sse_gateway.GetPartnerSSEGatewayRequest( name="name_value", ) + assert args[0] == request_msg def test_get_partner_sse_gateway_use_cached_wrapped_rpc(): @@ -2101,9 +2120,15 @@ async def test_get_partner_sse_gateway_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + sse_gateway.GetPartnerSSEGatewayRequest(), + {}, + ], +) async def test_get_partner_sse_gateway_async( - transport: str = "grpc_asyncio", - request_type=sse_gateway.GetPartnerSSEGatewayRequest, + request_type, transport: str = "grpc_asyncio" ): client = SSEGatewayServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2112,7 +2137,7 @@ async def test_get_partner_sse_gateway_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( @@ -2175,11 +2200,6 @@ async def test_get_partner_sse_gateway_async( assert response.prober_subnet_ranges == ["prober_subnet_ranges_value"] -@pytest.mark.asyncio -async def test_get_partner_sse_gateway_async_from_dict(): - await test_get_partner_sse_gateway_async(request_type=dict) - - def test_get_partner_sse_gateway_field_headers(): client = SSEGatewayServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2334,8 +2354,8 @@ async def test_get_partner_sse_gateway_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - sse_gateway.CreatePartnerSSEGatewayRequest, - dict, + sse_gateway.CreatePartnerSSEGatewayRequest(), + {}, ], ) def test_create_partner_sse_gateway(request_type, transport: str = "grpc"): @@ -2346,7 +2366,7 @@ def test_create_partner_sse_gateway(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2393,11 +2413,12 @@ def test_create_partner_sse_gateway_non_empty_request_with_auto_populated_field( client.create_partner_sse_gateway(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == sse_gateway.CreatePartnerSSEGatewayRequest( + request_msg = sse_gateway.CreatePartnerSSEGatewayRequest( parent="parent_value", partner_sse_gateway_id="partner_sse_gateway_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_partner_sse_gateway_use_cached_wrapped_rpc(): @@ -2493,9 +2514,15 @@ async def test_create_partner_sse_gateway_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + sse_gateway.CreatePartnerSSEGatewayRequest(), + {}, + ], +) async def test_create_partner_sse_gateway_async( - transport: str = "grpc_asyncio", - request_type=sse_gateway.CreatePartnerSSEGatewayRequest, + request_type, transport: str = "grpc_asyncio" ): client = SSEGatewayServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2504,7 +2531,7 @@ async def test_create_partner_sse_gateway_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( @@ -2526,11 +2553,6 @@ async def test_create_partner_sse_gateway_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_partner_sse_gateway_async_from_dict(): - await test_create_partner_sse_gateway_async(request_type=dict) - - def test_create_partner_sse_gateway_field_headers(): client = SSEGatewayServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2705,8 +2727,8 @@ async def test_create_partner_sse_gateway_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - sse_gateway.DeletePartnerSSEGatewayRequest, - dict, + sse_gateway.DeletePartnerSSEGatewayRequest(), + {}, ], ) def test_delete_partner_sse_gateway(request_type, transport: str = "grpc"): @@ -2717,7 +2739,7 @@ def test_delete_partner_sse_gateway(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2763,10 +2785,11 @@ def test_delete_partner_sse_gateway_non_empty_request_with_auto_populated_field( client.delete_partner_sse_gateway(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == sse_gateway.DeletePartnerSSEGatewayRequest( + request_msg = sse_gateway.DeletePartnerSSEGatewayRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_partner_sse_gateway_use_cached_wrapped_rpc(): @@ -2862,9 +2885,15 @@ async def test_delete_partner_sse_gateway_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + sse_gateway.DeletePartnerSSEGatewayRequest(), + {}, + ], +) async def test_delete_partner_sse_gateway_async( - transport: str = "grpc_asyncio", - request_type=sse_gateway.DeletePartnerSSEGatewayRequest, + request_type, transport: str = "grpc_asyncio" ): client = SSEGatewayServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2873,7 +2902,7 @@ async def test_delete_partner_sse_gateway_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( @@ -2895,11 +2924,6 @@ async def test_delete_partner_sse_gateway_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_partner_sse_gateway_async_from_dict(): - await test_delete_partner_sse_gateway_async(request_type=dict) - - def test_delete_partner_sse_gateway_field_headers(): client = SSEGatewayServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3054,8 +3078,8 @@ async def test_delete_partner_sse_gateway_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - sse_gateway.UpdatePartnerSSEGatewayRequest, - dict, + sse_gateway.UpdatePartnerSSEGatewayRequest(), + {}, ], ) def test_update_partner_sse_gateway(request_type, transport: str = "grpc"): @@ -3066,7 +3090,7 @@ def test_update_partner_sse_gateway(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3111,9 +3135,10 @@ def test_update_partner_sse_gateway_non_empty_request_with_auto_populated_field( client.update_partner_sse_gateway(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == sse_gateway.UpdatePartnerSSEGatewayRequest( + request_msg = sse_gateway.UpdatePartnerSSEGatewayRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_partner_sse_gateway_use_cached_wrapped_rpc(): @@ -3209,9 +3234,15 @@ async def test_update_partner_sse_gateway_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + sse_gateway.UpdatePartnerSSEGatewayRequest(), + {}, + ], +) async def test_update_partner_sse_gateway_async( - transport: str = "grpc_asyncio", - request_type=sse_gateway.UpdatePartnerSSEGatewayRequest, + request_type, transport: str = "grpc_asyncio" ): client = SSEGatewayServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3220,7 +3251,7 @@ async def test_update_partner_sse_gateway_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( @@ -3242,11 +3273,6 @@ async def test_update_partner_sse_gateway_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_partner_sse_gateway_async_from_dict(): - await test_update_partner_sse_gateway_async(request_type=dict) - - def test_update_partner_sse_gateway_field_headers(): client = SSEGatewayServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3411,8 +3437,8 @@ async def test_update_partner_sse_gateway_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - sse_gateway.ListSSEGatewayReferencesRequest, - dict, + sse_gateway.ListSSEGatewayReferencesRequest(), + {}, ], ) def test_list_sse_gateway_references(request_type, transport: str = "grpc"): @@ -3423,7 +3449,7 @@ def test_list_sse_gateway_references(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3476,12 +3502,13 @@ def test_list_sse_gateway_references_non_empty_request_with_auto_populated_field client.list_sse_gateway_references(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == sse_gateway.ListSSEGatewayReferencesRequest( + request_msg = sse_gateway.ListSSEGatewayReferencesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_sse_gateway_references_use_cached_wrapped_rpc(): @@ -3567,9 +3594,15 @@ async def test_list_sse_gateway_references_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + sse_gateway.ListSSEGatewayReferencesRequest(), + {}, + ], +) async def test_list_sse_gateway_references_async( - transport: str = "grpc_asyncio", - request_type=sse_gateway.ListSSEGatewayReferencesRequest, + request_type, transport: str = "grpc_asyncio" ): client = SSEGatewayServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3578,7 +3611,7 @@ async def test_list_sse_gateway_references_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( @@ -3605,11 +3638,6 @@ async def test_list_sse_gateway_references_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_sse_gateway_references_async_from_dict(): - await test_list_sse_gateway_references_async(request_type=dict) - - def test_list_sse_gateway_references_field_headers(): client = SSEGatewayServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3964,8 +3992,8 @@ async def test_list_sse_gateway_references_async_pages(): @pytest.mark.parametrize( "request_type", [ - sse_gateway.GetSSEGatewayReferenceRequest, - dict, + sse_gateway.GetSSEGatewayReferenceRequest(), + {}, ], ) def test_get_sse_gateway_reference(request_type, transport: str = "grpc"): @@ -3976,7 +4004,7 @@ def test_get_sse_gateway_reference(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4028,9 +4056,10 @@ def test_get_sse_gateway_reference_non_empty_request_with_auto_populated_field() client.get_sse_gateway_reference(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == sse_gateway.GetSSEGatewayReferenceRequest( + request_msg = sse_gateway.GetSSEGatewayReferenceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_sse_gateway_reference_use_cached_wrapped_rpc(): @@ -4116,9 +4145,15 @@ async def test_get_sse_gateway_reference_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + sse_gateway.GetSSEGatewayReferenceRequest(), + {}, + ], +) async def test_get_sse_gateway_reference_async( - transport: str = "grpc_asyncio", - request_type=sse_gateway.GetSSEGatewayReferenceRequest, + request_type, transport: str = "grpc_asyncio" ): client = SSEGatewayServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4127,7 +4162,7 @@ async def test_get_sse_gateway_reference_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( @@ -4156,11 +4191,6 @@ async def test_get_sse_gateway_reference_async( assert response.prober_subnet_ranges == ["prober_subnet_ranges_value"] -@pytest.mark.asyncio -async def test_get_sse_gateway_reference_async_from_dict(): - await test_get_sse_gateway_reference_async(request_type=dict) - - def test_get_sse_gateway_reference_field_headers(): client = SSEGatewayServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5946,7 +5976,6 @@ def test_list_partner_sse_gateways_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sse_gateway.ListPartnerSSEGatewaysRequest() - assert args[0] == request_msg @@ -5969,7 +5998,6 @@ def test_get_partner_sse_gateway_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sse_gateway.GetPartnerSSEGatewayRequest() - assert args[0] == request_msg @@ -5992,7 +6020,6 @@ def test_create_partner_sse_gateway_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sse_gateway.CreatePartnerSSEGatewayRequest() - assert args[0] == request_msg @@ -6015,7 +6042,6 @@ def test_delete_partner_sse_gateway_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sse_gateway.DeletePartnerSSEGatewayRequest() - assert args[0] == request_msg @@ -6038,7 +6064,6 @@ def test_update_partner_sse_gateway_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sse_gateway.UpdatePartnerSSEGatewayRequest() - assert args[0] == request_msg @@ -6061,7 +6086,6 @@ def test_list_sse_gateway_references_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sse_gateway.ListSSEGatewayReferencesRequest() - assert args[0] == request_msg @@ -6084,7 +6108,6 @@ def test_get_sse_gateway_reference_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sse_gateway.GetSSEGatewayReferenceRequest() - assert args[0] == request_msg @@ -6128,7 +6151,6 @@ async def test_list_partner_sse_gateways_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sse_gateway.ListPartnerSSEGatewaysRequest() - assert args[0] == request_msg @@ -6176,7 +6198,6 @@ async def test_get_partner_sse_gateway_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sse_gateway.GetPartnerSSEGatewayRequest() - assert args[0] == request_msg @@ -6203,7 +6224,6 @@ async def test_create_partner_sse_gateway_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sse_gateway.CreatePartnerSSEGatewayRequest() - assert args[0] == request_msg @@ -6230,7 +6250,6 @@ async def test_delete_partner_sse_gateway_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sse_gateway.DeletePartnerSSEGatewayRequest() - assert args[0] == request_msg @@ -6257,7 +6276,6 @@ async def test_update_partner_sse_gateway_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sse_gateway.UpdatePartnerSSEGatewayRequest() - assert args[0] == request_msg @@ -6287,7 +6305,6 @@ async def test_list_sse_gateway_references_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sse_gateway.ListSSEGatewayReferencesRequest() - assert args[0] == request_msg @@ -6318,7 +6335,6 @@ async def test_get_sse_gateway_reference_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sse_gateway.GetSSEGatewayReferenceRequest() - assert args[0] == request_msg @@ -8128,7 +8144,6 @@ def test_list_partner_sse_gateways_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sse_gateway.ListPartnerSSEGatewaysRequest() - assert args[0] == request_msg @@ -8150,7 +8165,6 @@ def test_get_partner_sse_gateway_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sse_gateway.GetPartnerSSEGatewayRequest() - assert args[0] == request_msg @@ -8172,7 +8186,6 @@ def test_create_partner_sse_gateway_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sse_gateway.CreatePartnerSSEGatewayRequest() - assert args[0] == request_msg @@ -8194,7 +8207,6 @@ def test_delete_partner_sse_gateway_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sse_gateway.DeletePartnerSSEGatewayRequest() - assert args[0] == request_msg @@ -8216,7 +8228,6 @@ def test_update_partner_sse_gateway_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sse_gateway.UpdatePartnerSSEGatewayRequest() - assert args[0] == request_msg @@ -8238,7 +8249,6 @@ def test_list_sse_gateway_references_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sse_gateway.ListSSEGatewayReferencesRequest() - assert args[0] == request_msg @@ -8260,7 +8270,6 @@ def test_get_sse_gateway_reference_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sse_gateway.GetSSEGatewayReferenceRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-network-security/tests/unit/gapic/network_security_v1alpha1/test_sse_realm_service.py b/packages/google-cloud-network-security/tests/unit/gapic/network_security_v1alpha1/test_sse_realm_service.py index a4d2ae31e362..b7be4a1f904f 100644 --- a/packages/google-cloud-network-security/tests/unit/gapic/network_security_v1alpha1/test_sse_realm_service.py +++ b/packages/google-cloud-network-security/tests/unit/gapic/network_security_v1alpha1/test_sse_realm_service.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 @@ -120,6 +121,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" @@ -1347,8 +1363,8 @@ def test_sse_realm_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - sse_realm.ListSACRealmsRequest, - dict, + sse_realm.ListSACRealmsRequest(), + {}, ], ) def test_list_sac_realms(request_type, transport: str = "grpc"): @@ -1359,7 +1375,7 @@ def test_list_sac_realms(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_sac_realms), "__call__") as call: @@ -1408,12 +1424,13 @@ def test_list_sac_realms_non_empty_request_with_auto_populated_field(): client.list_sac_realms(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == sse_realm.ListSACRealmsRequest( + request_msg = sse_realm.ListSACRealmsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_sac_realms_use_cached_wrapped_rpc(): @@ -1494,9 +1511,14 @@ async def test_list_sac_realms_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_sac_realms_async( - transport: str = "grpc_asyncio", request_type=sse_realm.ListSACRealmsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + sse_realm.ListSACRealmsRequest(), + {}, + ], +) +async def test_list_sac_realms_async(request_type, transport: str = "grpc_asyncio"): client = SSERealmServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1504,7 +1526,7 @@ async def test_list_sac_realms_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_sac_realms), "__call__") as call: @@ -1529,11 +1551,6 @@ async def test_list_sac_realms_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_sac_realms_async_from_dict(): - await test_list_sac_realms_async(request_type=dict) - - def test_list_sac_realms_field_headers(): client = SSERealmServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1870,8 +1887,8 @@ async def test_list_sac_realms_async_pages(): @pytest.mark.parametrize( "request_type", [ - sse_realm.GetSACRealmRequest, - dict, + sse_realm.GetSACRealmRequest(), + {}, ], ) def test_get_sac_realm(request_type, transport: str = "grpc"): @@ -1882,7 +1899,7 @@ def test_get_sac_realm(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_sac_realm), "__call__") as call: @@ -1933,9 +1950,10 @@ def test_get_sac_realm_non_empty_request_with_auto_populated_field(): client.get_sac_realm(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == sse_realm.GetSACRealmRequest( + request_msg = sse_realm.GetSACRealmRequest( name="name_value", ) + assert args[0] == request_msg def test_get_sac_realm_use_cached_wrapped_rpc(): @@ -2016,9 +2034,14 @@ async def test_get_sac_realm_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_sac_realm_async( - transport: str = "grpc_asyncio", request_type=sse_realm.GetSACRealmRequest -): +@pytest.mark.parametrize( + "request_type", + [ + sse_realm.GetSACRealmRequest(), + {}, + ], +) +async def test_get_sac_realm_async(request_type, transport: str = "grpc_asyncio"): client = SSERealmServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2026,7 +2049,7 @@ async def test_get_sac_realm_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_sac_realm), "__call__") as call: @@ -2056,11 +2079,6 @@ async def test_get_sac_realm_async( assert response.state == sse_realm.SACRealm.State.PENDING_PARTNER_ATTACHMENT -@pytest.mark.asyncio -async def test_get_sac_realm_async_from_dict(): - await test_get_sac_realm_async(request_type=dict) - - def test_get_sac_realm_field_headers(): client = SSERealmServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2203,8 +2221,8 @@ async def test_get_sac_realm_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - sse_realm.CreateSACRealmRequest, - dict, + sse_realm.CreateSACRealmRequest(), + {}, ], ) def test_create_sac_realm(request_type, transport: str = "grpc"): @@ -2215,7 +2233,7 @@ def test_create_sac_realm(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_sac_realm), "__call__") as call: @@ -2257,10 +2275,11 @@ def test_create_sac_realm_non_empty_request_with_auto_populated_field(): client.create_sac_realm(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == sse_realm.CreateSACRealmRequest( + request_msg = sse_realm.CreateSACRealmRequest( parent="parent_value", sac_realm_id="sac_realm_id_value", ) + assert args[0] == request_msg def test_create_sac_realm_use_cached_wrapped_rpc(): @@ -2353,9 +2372,14 @@ async def test_create_sac_realm_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_sac_realm_async( - transport: str = "grpc_asyncio", request_type=sse_realm.CreateSACRealmRequest -): +@pytest.mark.parametrize( + "request_type", + [ + sse_realm.CreateSACRealmRequest(), + {}, + ], +) +async def test_create_sac_realm_async(request_type, transport: str = "grpc_asyncio"): client = SSERealmServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2363,7 +2387,7 @@ async def test_create_sac_realm_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_sac_realm), "__call__") as call: @@ -2383,11 +2407,6 @@ async def test_create_sac_realm_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_sac_realm_async_from_dict(): - await test_create_sac_realm_async(request_type=dict) - - def test_create_sac_realm_field_headers(): client = SSERealmServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2554,8 +2573,8 @@ async def test_create_sac_realm_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - sse_realm.DeleteSACRealmRequest, - dict, + sse_realm.DeleteSACRealmRequest(), + {}, ], ) def test_delete_sac_realm(request_type, transport: str = "grpc"): @@ -2566,7 +2585,7 @@ def test_delete_sac_realm(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_sac_realm), "__call__") as call: @@ -2607,9 +2626,10 @@ def test_delete_sac_realm_non_empty_request_with_auto_populated_field(): client.delete_sac_realm(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == sse_realm.DeleteSACRealmRequest( + request_msg = sse_realm.DeleteSACRealmRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_sac_realm_use_cached_wrapped_rpc(): @@ -2702,9 +2722,14 @@ async def test_delete_sac_realm_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_sac_realm_async( - transport: str = "grpc_asyncio", request_type=sse_realm.DeleteSACRealmRequest -): +@pytest.mark.parametrize( + "request_type", + [ + sse_realm.DeleteSACRealmRequest(), + {}, + ], +) +async def test_delete_sac_realm_async(request_type, transport: str = "grpc_asyncio"): client = SSERealmServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2712,7 +2737,7 @@ async def test_delete_sac_realm_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_sac_realm), "__call__") as call: @@ -2732,11 +2757,6 @@ async def test_delete_sac_realm_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_sac_realm_async_from_dict(): - await test_delete_sac_realm_async(request_type=dict) - - def test_delete_sac_realm_field_headers(): client = SSERealmServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2883,8 +2903,8 @@ async def test_delete_sac_realm_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - sse_realm.ListSACAttachmentsRequest, - dict, + sse_realm.ListSACAttachmentsRequest(), + {}, ], ) def test_list_sac_attachments(request_type, transport: str = "grpc"): @@ -2895,7 +2915,7 @@ def test_list_sac_attachments(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2948,12 +2968,13 @@ def test_list_sac_attachments_non_empty_request_with_auto_populated_field(): client.list_sac_attachments(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == sse_realm.ListSACAttachmentsRequest( + request_msg = sse_realm.ListSACAttachmentsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_sac_attachments_use_cached_wrapped_rpc(): @@ -3038,8 +3059,15 @@ async def test_list_sac_attachments_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + sse_realm.ListSACAttachmentsRequest(), + {}, + ], +) async def test_list_sac_attachments_async( - transport: str = "grpc_asyncio", request_type=sse_realm.ListSACAttachmentsRequest + request_type, transport: str = "grpc_asyncio" ): client = SSERealmServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3048,7 +3076,7 @@ async def test_list_sac_attachments_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( @@ -3075,11 +3103,6 @@ async def test_list_sac_attachments_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_sac_attachments_async_from_dict(): - await test_list_sac_attachments_async(request_type=dict) - - def test_list_sac_attachments_field_headers(): client = SSERealmServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3432,8 +3455,8 @@ async def test_list_sac_attachments_async_pages(): @pytest.mark.parametrize( "request_type", [ - sse_realm.GetSACAttachmentRequest, - dict, + sse_realm.GetSACAttachmentRequest(), + {}, ], ) def test_get_sac_attachment(request_type, transport: str = "grpc"): @@ -3444,7 +3467,7 @@ def test_get_sac_attachment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3502,9 +3525,10 @@ def test_get_sac_attachment_non_empty_request_with_auto_populated_field(): client.get_sac_attachment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == sse_realm.GetSACAttachmentRequest( + request_msg = sse_realm.GetSACAttachmentRequest( name="name_value", ) + assert args[0] == request_msg def test_get_sac_attachment_use_cached_wrapped_rpc(): @@ -3589,9 +3613,14 @@ async def test_get_sac_attachment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_sac_attachment_async( - transport: str = "grpc_asyncio", request_type=sse_realm.GetSACAttachmentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + sse_realm.GetSACAttachmentRequest(), + {}, + ], +) +async def test_get_sac_attachment_async(request_type, transport: str = "grpc_asyncio"): client = SSERealmServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3599,7 +3628,7 @@ async def test_get_sac_attachment_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( @@ -3634,11 +3663,6 @@ async def test_get_sac_attachment_async( assert response.state == sse_realm.SACAttachment.State.PENDING_PARTNER_ATTACHMENT -@pytest.mark.asyncio -async def test_get_sac_attachment_async_from_dict(): - await test_get_sac_attachment_async(request_type=dict) - - def test_get_sac_attachment_field_headers(): client = SSERealmServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3793,8 +3817,8 @@ async def test_get_sac_attachment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - sse_realm.CreateSACAttachmentRequest, - dict, + sse_realm.CreateSACAttachmentRequest(), + {}, ], ) def test_create_sac_attachment(request_type, transport: str = "grpc"): @@ -3805,7 +3829,7 @@ def test_create_sac_attachment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3851,10 +3875,11 @@ def test_create_sac_attachment_non_empty_request_with_auto_populated_field(): client.create_sac_attachment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == sse_realm.CreateSACAttachmentRequest( + request_msg = sse_realm.CreateSACAttachmentRequest( parent="parent_value", sac_attachment_id="sac_attachment_id_value", ) + assert args[0] == request_msg def test_create_sac_attachment_use_cached_wrapped_rpc(): @@ -3950,8 +3975,15 @@ async def test_create_sac_attachment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + sse_realm.CreateSACAttachmentRequest(), + {}, + ], +) async def test_create_sac_attachment_async( - transport: str = "grpc_asyncio", request_type=sse_realm.CreateSACAttachmentRequest + request_type, transport: str = "grpc_asyncio" ): client = SSERealmServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3960,7 +3992,7 @@ async def test_create_sac_attachment_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( @@ -3982,11 +4014,6 @@ async def test_create_sac_attachment_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_sac_attachment_async_from_dict(): - await test_create_sac_attachment_async(request_type=dict) - - def test_create_sac_attachment_field_headers(): client = SSERealmServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4161,8 +4188,8 @@ async def test_create_sac_attachment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - sse_realm.DeleteSACAttachmentRequest, - dict, + sse_realm.DeleteSACAttachmentRequest(), + {}, ], ) def test_delete_sac_attachment(request_type, transport: str = "grpc"): @@ -4173,7 +4200,7 @@ def test_delete_sac_attachment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,9 +4245,10 @@ def test_delete_sac_attachment_non_empty_request_with_auto_populated_field(): client.delete_sac_attachment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == sse_realm.DeleteSACAttachmentRequest( + request_msg = sse_realm.DeleteSACAttachmentRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_sac_attachment_use_cached_wrapped_rpc(): @@ -4316,8 +4344,15 @@ async def test_delete_sac_attachment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + sse_realm.DeleteSACAttachmentRequest(), + {}, + ], +) async def test_delete_sac_attachment_async( - transport: str = "grpc_asyncio", request_type=sse_realm.DeleteSACAttachmentRequest + request_type, transport: str = "grpc_asyncio" ): client = SSERealmServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4326,7 +4361,7 @@ async def test_delete_sac_attachment_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( @@ -4348,11 +4383,6 @@ async def test_delete_sac_attachment_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_sac_attachment_async_from_dict(): - await test_delete_sac_attachment_async(request_type=dict) - - def test_delete_sac_attachment_field_headers(): client = SSERealmServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4507,8 +4537,8 @@ async def test_delete_sac_attachment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - sse_realm.ListPartnerSSERealmsRequest, - dict, + sse_realm.ListPartnerSSERealmsRequest(), + {}, ], ) def test_list_partner_sse_realms(request_type, transport: str = "grpc"): @@ -4519,7 +4549,7 @@ def test_list_partner_sse_realms(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4572,12 +4602,13 @@ def test_list_partner_sse_realms_non_empty_request_with_auto_populated_field(): client.list_partner_sse_realms(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == sse_realm.ListPartnerSSERealmsRequest( + request_msg = sse_realm.ListPartnerSSERealmsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_partner_sse_realms_use_cached_wrapped_rpc(): @@ -4663,8 +4694,15 @@ async def test_list_partner_sse_realms_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + sse_realm.ListPartnerSSERealmsRequest(), + {}, + ], +) async def test_list_partner_sse_realms_async( - transport: str = "grpc_asyncio", request_type=sse_realm.ListPartnerSSERealmsRequest + request_type, transport: str = "grpc_asyncio" ): client = SSERealmServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4673,7 +4711,7 @@ async def test_list_partner_sse_realms_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( @@ -4700,11 +4738,6 @@ async def test_list_partner_sse_realms_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_partner_sse_realms_async_from_dict(): - await test_list_partner_sse_realms_async(request_type=dict) - - def test_list_partner_sse_realms_field_headers(): client = SSERealmServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5057,8 +5090,8 @@ async def test_list_partner_sse_realms_async_pages(): @pytest.mark.parametrize( "request_type", [ - sse_realm.GetPartnerSSERealmRequest, - dict, + sse_realm.GetPartnerSSERealmRequest(), + {}, ], ) def test_get_partner_sse_realm(request_type, transport: str = "grpc"): @@ -5069,7 +5102,7 @@ def test_get_partner_sse_realm(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5133,9 +5166,10 @@ def test_get_partner_sse_realm_non_empty_request_with_auto_populated_field(): client.get_partner_sse_realm(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == sse_realm.GetPartnerSSERealmRequest( + request_msg = sse_realm.GetPartnerSSERealmRequest( name="name_value", ) + assert args[0] == request_msg def test_get_partner_sse_realm_use_cached_wrapped_rpc(): @@ -5221,8 +5255,15 @@ async def test_get_partner_sse_realm_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + sse_realm.GetPartnerSSERealmRequest(), + {}, + ], +) async def test_get_partner_sse_realm_async( - transport: str = "grpc_asyncio", request_type=sse_realm.GetPartnerSSERealmRequest + request_type, transport: str = "grpc_asyncio" ): client = SSERealmServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5231,7 +5272,7 @@ async def test_get_partner_sse_realm_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( @@ -5272,11 +5313,6 @@ async def test_get_partner_sse_realm_async( assert response.sse_project_number == 1929 -@pytest.mark.asyncio -async def test_get_partner_sse_realm_async_from_dict(): - await test_get_partner_sse_realm_async(request_type=dict) - - def test_get_partner_sse_realm_field_headers(): client = SSERealmServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5431,8 +5467,8 @@ async def test_get_partner_sse_realm_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - sse_realm.CreatePartnerSSERealmRequest, - dict, + sse_realm.CreatePartnerSSERealmRequest(), + {}, ], ) def test_create_partner_sse_realm(request_type, transport: str = "grpc"): @@ -5443,7 +5479,7 @@ def test_create_partner_sse_realm(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5490,11 +5526,12 @@ def test_create_partner_sse_realm_non_empty_request_with_auto_populated_field(): client.create_partner_sse_realm(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == sse_realm.CreatePartnerSSERealmRequest( + request_msg = sse_realm.CreatePartnerSSERealmRequest( parent="parent_value", partner_sse_realm_id="partner_sse_realm_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_partner_sse_realm_use_cached_wrapped_rpc(): @@ -5590,8 +5627,15 @@ async def test_create_partner_sse_realm_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + sse_realm.CreatePartnerSSERealmRequest(), + {}, + ], +) async def test_create_partner_sse_realm_async( - transport: str = "grpc_asyncio", request_type=sse_realm.CreatePartnerSSERealmRequest + request_type, transport: str = "grpc_asyncio" ): client = SSERealmServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5600,7 +5644,7 @@ async def test_create_partner_sse_realm_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( @@ -5622,11 +5666,6 @@ async def test_create_partner_sse_realm_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_partner_sse_realm_async_from_dict(): - await test_create_partner_sse_realm_async(request_type=dict) - - def test_create_partner_sse_realm_field_headers(): client = SSERealmServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5801,8 +5840,8 @@ async def test_create_partner_sse_realm_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - sse_realm.DeletePartnerSSERealmRequest, - dict, + sse_realm.DeletePartnerSSERealmRequest(), + {}, ], ) def test_delete_partner_sse_realm(request_type, transport: str = "grpc"): @@ -5813,7 +5852,7 @@ def test_delete_partner_sse_realm(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5859,10 +5898,11 @@ def test_delete_partner_sse_realm_non_empty_request_with_auto_populated_field(): client.delete_partner_sse_realm(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == sse_realm.DeletePartnerSSERealmRequest( + request_msg = sse_realm.DeletePartnerSSERealmRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_partner_sse_realm_use_cached_wrapped_rpc(): @@ -5958,8 +5998,15 @@ async def test_delete_partner_sse_realm_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + sse_realm.DeletePartnerSSERealmRequest(), + {}, + ], +) async def test_delete_partner_sse_realm_async( - transport: str = "grpc_asyncio", request_type=sse_realm.DeletePartnerSSERealmRequest + request_type, transport: str = "grpc_asyncio" ): client = SSERealmServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5968,7 +6015,7 @@ async def test_delete_partner_sse_realm_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( @@ -5990,11 +6037,6 @@ async def test_delete_partner_sse_realm_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_partner_sse_realm_async_from_dict(): - await test_delete_partner_sse_realm_async(request_type=dict) - - def test_delete_partner_sse_realm_field_headers(): client = SSERealmServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8820,7 +8862,6 @@ def test_list_sac_realms_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sse_realm.ListSACRealmsRequest() - assert args[0] == request_msg @@ -8841,7 +8882,6 @@ def test_get_sac_realm_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sse_realm.GetSACRealmRequest() - assert args[0] == request_msg @@ -8862,7 +8902,6 @@ def test_create_sac_realm_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sse_realm.CreateSACRealmRequest() - assert args[0] == request_msg @@ -8883,7 +8922,6 @@ def test_delete_sac_realm_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sse_realm.DeleteSACRealmRequest() - assert args[0] == request_msg @@ -8906,7 +8944,6 @@ def test_list_sac_attachments_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sse_realm.ListSACAttachmentsRequest() - assert args[0] == request_msg @@ -8929,7 +8966,6 @@ def test_get_sac_attachment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sse_realm.GetSACAttachmentRequest() - assert args[0] == request_msg @@ -8952,7 +8988,6 @@ def test_create_sac_attachment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sse_realm.CreateSACAttachmentRequest() - assert args[0] == request_msg @@ -8975,7 +9010,6 @@ def test_delete_sac_attachment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sse_realm.DeleteSACAttachmentRequest() - assert args[0] == request_msg @@ -8998,7 +9032,6 @@ def test_list_partner_sse_realms_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sse_realm.ListPartnerSSERealmsRequest() - assert args[0] == request_msg @@ -9021,7 +9054,6 @@ def test_get_partner_sse_realm_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sse_realm.GetPartnerSSERealmRequest() - assert args[0] == request_msg @@ -9044,7 +9076,6 @@ def test_create_partner_sse_realm_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sse_realm.CreatePartnerSSERealmRequest() - assert args[0] == request_msg @@ -9067,7 +9098,6 @@ def test_delete_partner_sse_realm_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sse_realm.DeletePartnerSSERealmRequest() - assert args[0] == request_msg @@ -9109,7 +9139,6 @@ async def test_list_sac_realms_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sse_realm.ListSACRealmsRequest() - assert args[0] == request_msg @@ -9138,7 +9167,6 @@ async def test_get_sac_realm_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sse_realm.GetSACRealmRequest() - assert args[0] == request_msg @@ -9163,7 +9191,6 @@ async def test_create_sac_realm_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sse_realm.CreateSACRealmRequest() - assert args[0] == request_msg @@ -9188,7 +9215,6 @@ async def test_delete_sac_realm_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sse_realm.DeleteSACRealmRequest() - assert args[0] == request_msg @@ -9218,7 +9244,6 @@ async def test_list_sac_attachments_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sse_realm.ListSACAttachmentsRequest() - assert args[0] == request_msg @@ -9252,7 +9277,6 @@ async def test_get_sac_attachment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sse_realm.GetSACAttachmentRequest() - assert args[0] == request_msg @@ -9279,7 +9303,6 @@ async def test_create_sac_attachment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sse_realm.CreateSACAttachmentRequest() - assert args[0] == request_msg @@ -9306,7 +9329,6 @@ async def test_delete_sac_attachment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sse_realm.DeleteSACAttachmentRequest() - assert args[0] == request_msg @@ -9336,7 +9358,6 @@ async def test_list_partner_sse_realms_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sse_realm.ListPartnerSSERealmsRequest() - assert args[0] == request_msg @@ -9373,7 +9394,6 @@ async def test_get_partner_sse_realm_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sse_realm.GetPartnerSSERealmRequest() - assert args[0] == request_msg @@ -9400,7 +9420,6 @@ async def test_create_partner_sse_realm_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sse_realm.CreatePartnerSSERealmRequest() - assert args[0] == request_msg @@ -9427,7 +9446,6 @@ async def test_delete_partner_sse_realm_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sse_realm.DeletePartnerSSERealmRequest() - assert args[0] == request_msg @@ -11883,7 +11901,6 @@ def test_list_sac_realms_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sse_realm.ListSACRealmsRequest() - assert args[0] == request_msg @@ -11903,7 +11920,6 @@ def test_get_sac_realm_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sse_realm.GetSACRealmRequest() - assert args[0] == request_msg @@ -11923,7 +11939,6 @@ def test_create_sac_realm_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sse_realm.CreateSACRealmRequest() - assert args[0] == request_msg @@ -11943,7 +11958,6 @@ def test_delete_sac_realm_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sse_realm.DeleteSACRealmRequest() - assert args[0] == request_msg @@ -11965,7 +11979,6 @@ def test_list_sac_attachments_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sse_realm.ListSACAttachmentsRequest() - assert args[0] == request_msg @@ -11987,7 +12000,6 @@ def test_get_sac_attachment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sse_realm.GetSACAttachmentRequest() - assert args[0] == request_msg @@ -12009,7 +12021,6 @@ def test_create_sac_attachment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sse_realm.CreateSACAttachmentRequest() - assert args[0] == request_msg @@ -12031,7 +12042,6 @@ def test_delete_sac_attachment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sse_realm.DeleteSACAttachmentRequest() - assert args[0] == request_msg @@ -12053,7 +12063,6 @@ def test_list_partner_sse_realms_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sse_realm.ListPartnerSSERealmsRequest() - assert args[0] == request_msg @@ -12075,7 +12084,6 @@ def test_get_partner_sse_realm_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sse_realm.GetPartnerSSERealmRequest() - assert args[0] == request_msg @@ -12097,7 +12105,6 @@ def test_create_partner_sse_realm_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sse_realm.CreatePartnerSSERealmRequest() - assert args[0] == request_msg @@ -12119,7 +12126,6 @@ def test_delete_partner_sse_realm_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = sse_realm.DeletePartnerSSERealmRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-network-security/tests/unit/gapic/network_security_v1beta1/test_dns_threat_detector_service.py b/packages/google-cloud-network-security/tests/unit/gapic/network_security_v1beta1/test_dns_threat_detector_service.py index 6e153a7f0bf8..90d600924cbd 100644 --- a/packages/google-cloud-network-security/tests/unit/gapic/network_security_v1beta1/test_dns_threat_detector_service.py +++ b/packages/google-cloud-network-security/tests/unit/gapic/network_security_v1beta1/test_dns_threat_detector_service.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 @@ -119,6 +120,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" @@ -1394,8 +1410,8 @@ def test_dns_threat_detector_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - dns_threat_detector.ListDnsThreatDetectorsRequest, - dict, + dns_threat_detector.ListDnsThreatDetectorsRequest(), + {}, ], ) def test_list_dns_threat_detectors(request_type, transport: str = "grpc"): @@ -1406,7 +1422,7 @@ def test_list_dns_threat_detectors(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1457,10 +1473,11 @@ def test_list_dns_threat_detectors_non_empty_request_with_auto_populated_field() client.list_dns_threat_detectors(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dns_threat_detector.ListDnsThreatDetectorsRequest( + request_msg = dns_threat_detector.ListDnsThreatDetectorsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_dns_threat_detectors_use_cached_wrapped_rpc(): @@ -1546,9 +1563,15 @@ async def test_list_dns_threat_detectors_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dns_threat_detector.ListDnsThreatDetectorsRequest(), + {}, + ], +) async def test_list_dns_threat_detectors_async( - transport: str = "grpc_asyncio", - request_type=dns_threat_detector.ListDnsThreatDetectorsRequest, + request_type, transport: str = "grpc_asyncio" ): client = DnsThreatDetectorServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1557,7 +1580,7 @@ async def test_list_dns_threat_detectors_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( @@ -1584,11 +1607,6 @@ async def test_list_dns_threat_detectors_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_dns_threat_detectors_async_from_dict(): - await test_list_dns_threat_detectors_async(request_type=dict) - - def test_list_dns_threat_detectors_field_headers(): client = DnsThreatDetectorServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1947,8 +1965,8 @@ async def test_list_dns_threat_detectors_async_pages(): @pytest.mark.parametrize( "request_type", [ - dns_threat_detector.GetDnsThreatDetectorRequest, - dict, + dns_threat_detector.GetDnsThreatDetectorRequest(), + {}, ], ) def test_get_dns_threat_detector(request_type, transport: str = "grpc"): @@ -1959,7 +1977,7 @@ def test_get_dns_threat_detector(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2011,9 +2029,10 @@ def test_get_dns_threat_detector_non_empty_request_with_auto_populated_field(): client.get_dns_threat_detector(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dns_threat_detector.GetDnsThreatDetectorRequest( + request_msg = dns_threat_detector.GetDnsThreatDetectorRequest( name="name_value", ) + assert args[0] == request_msg def test_get_dns_threat_detector_use_cached_wrapped_rpc(): @@ -2099,9 +2118,15 @@ async def test_get_dns_threat_detector_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dns_threat_detector.GetDnsThreatDetectorRequest(), + {}, + ], +) async def test_get_dns_threat_detector_async( - transport: str = "grpc_asyncio", - request_type=dns_threat_detector.GetDnsThreatDetectorRequest, + request_type, transport: str = "grpc_asyncio" ): client = DnsThreatDetectorServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2110,7 +2135,7 @@ async def test_get_dns_threat_detector_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( @@ -2139,11 +2164,6 @@ async def test_get_dns_threat_detector_async( assert response.provider == dns_threat_detector.DnsThreatDetector.Provider.INFOBLOX -@pytest.mark.asyncio -async def test_get_dns_threat_detector_async_from_dict(): - await test_get_dns_threat_detector_async(request_type=dict) - - def test_get_dns_threat_detector_field_headers(): client = DnsThreatDetectorServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2298,8 +2318,8 @@ async def test_get_dns_threat_detector_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_dns_threat_detector.CreateDnsThreatDetectorRequest, - dict, + gcn_dns_threat_detector.CreateDnsThreatDetectorRequest(), + {}, ], ) def test_create_dns_threat_detector(request_type, transport: str = "grpc"): @@ -2310,7 +2330,7 @@ def test_create_dns_threat_detector(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2365,10 +2385,11 @@ def test_create_dns_threat_detector_non_empty_request_with_auto_populated_field( client.create_dns_threat_detector(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_dns_threat_detector.CreateDnsThreatDetectorRequest( + request_msg = gcn_dns_threat_detector.CreateDnsThreatDetectorRequest( parent="parent_value", dns_threat_detector_id="dns_threat_detector_id_value", ) + assert args[0] == request_msg def test_create_dns_threat_detector_use_cached_wrapped_rpc(): @@ -2454,9 +2475,15 @@ async def test_create_dns_threat_detector_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcn_dns_threat_detector.CreateDnsThreatDetectorRequest(), + {}, + ], +) async def test_create_dns_threat_detector_async( - transport: str = "grpc_asyncio", - request_type=gcn_dns_threat_detector.CreateDnsThreatDetectorRequest, + request_type, transport: str = "grpc_asyncio" ): client = DnsThreatDetectorServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2465,7 +2492,7 @@ async def test_create_dns_threat_detector_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( @@ -2496,11 +2523,6 @@ async def test_create_dns_threat_detector_async( ) -@pytest.mark.asyncio -async def test_create_dns_threat_detector_async_from_dict(): - await test_create_dns_threat_detector_async(request_type=dict) - - def test_create_dns_threat_detector_field_headers(): client = DnsThreatDetectorServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2683,8 +2705,8 @@ async def test_create_dns_threat_detector_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_dns_threat_detector.UpdateDnsThreatDetectorRequest, - dict, + gcn_dns_threat_detector.UpdateDnsThreatDetectorRequest(), + {}, ], ) def test_update_dns_threat_detector(request_type, transport: str = "grpc"): @@ -2695,7 +2717,7 @@ def test_update_dns_threat_detector(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2747,7 +2769,8 @@ def test_update_dns_threat_detector_non_empty_request_with_auto_populated_field( client.update_dns_threat_detector(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_dns_threat_detector.UpdateDnsThreatDetectorRequest() + request_msg = gcn_dns_threat_detector.UpdateDnsThreatDetectorRequest() + assert args[0] == request_msg def test_update_dns_threat_detector_use_cached_wrapped_rpc(): @@ -2833,9 +2856,15 @@ async def test_update_dns_threat_detector_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcn_dns_threat_detector.UpdateDnsThreatDetectorRequest(), + {}, + ], +) async def test_update_dns_threat_detector_async( - transport: str = "grpc_asyncio", - request_type=gcn_dns_threat_detector.UpdateDnsThreatDetectorRequest, + request_type, transport: str = "grpc_asyncio" ): client = DnsThreatDetectorServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2844,7 +2873,7 @@ async def test_update_dns_threat_detector_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( @@ -2875,11 +2904,6 @@ async def test_update_dns_threat_detector_async( ) -@pytest.mark.asyncio -async def test_update_dns_threat_detector_async_from_dict(): - await test_update_dns_threat_detector_async(request_type=dict) - - def test_update_dns_threat_detector_field_headers(): client = DnsThreatDetectorServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3052,8 +3076,8 @@ async def test_update_dns_threat_detector_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dns_threat_detector.DeleteDnsThreatDetectorRequest, - dict, + dns_threat_detector.DeleteDnsThreatDetectorRequest(), + {}, ], ) def test_delete_dns_threat_detector(request_type, transport: str = "grpc"): @@ -3064,7 +3088,7 @@ def test_delete_dns_threat_detector(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3109,9 +3133,10 @@ def test_delete_dns_threat_detector_non_empty_request_with_auto_populated_field( client.delete_dns_threat_detector(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dns_threat_detector.DeleteDnsThreatDetectorRequest( + request_msg = dns_threat_detector.DeleteDnsThreatDetectorRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_dns_threat_detector_use_cached_wrapped_rpc(): @@ -3197,9 +3222,15 @@ async def test_delete_dns_threat_detector_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dns_threat_detector.DeleteDnsThreatDetectorRequest(), + {}, + ], +) async def test_delete_dns_threat_detector_async( - transport: str = "grpc_asyncio", - request_type=dns_threat_detector.DeleteDnsThreatDetectorRequest, + request_type, transport: str = "grpc_asyncio" ): client = DnsThreatDetectorServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3208,7 +3239,7 @@ async def test_delete_dns_threat_detector_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( @@ -3228,11 +3259,6 @@ async def test_delete_dns_threat_detector_async( assert response is None -@pytest.mark.asyncio -async def test_delete_dns_threat_detector_async_from_dict(): - await test_delete_dns_threat_detector_async(request_type=dict) - - def test_delete_dns_threat_detector_field_headers(): client = DnsThreatDetectorServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4531,7 +4557,6 @@ def test_list_dns_threat_detectors_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dns_threat_detector.ListDnsThreatDetectorsRequest() - assert args[0] == request_msg @@ -4554,7 +4579,6 @@ def test_get_dns_threat_detector_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dns_threat_detector.GetDnsThreatDetectorRequest() - assert args[0] == request_msg @@ -4577,7 +4601,6 @@ def test_create_dns_threat_detector_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_dns_threat_detector.CreateDnsThreatDetectorRequest() - assert args[0] == request_msg @@ -4600,7 +4623,6 @@ def test_update_dns_threat_detector_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_dns_threat_detector.UpdateDnsThreatDetectorRequest() - assert args[0] == request_msg @@ -4623,7 +4645,6 @@ def test_delete_dns_threat_detector_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dns_threat_detector.DeleteDnsThreatDetectorRequest() - assert args[0] == request_msg @@ -4667,7 +4688,6 @@ async def test_list_dns_threat_detectors_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dns_threat_detector.ListDnsThreatDetectorsRequest() - assert args[0] == request_msg @@ -4698,7 +4718,6 @@ async def test_get_dns_threat_detector_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dns_threat_detector.GetDnsThreatDetectorRequest() - assert args[0] == request_msg @@ -4729,7 +4748,6 @@ async def test_create_dns_threat_detector_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_dns_threat_detector.CreateDnsThreatDetectorRequest() - assert args[0] == request_msg @@ -4760,7 +4778,6 @@ async def test_update_dns_threat_detector_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_dns_threat_detector.UpdateDnsThreatDetectorRequest() - assert args[0] == request_msg @@ -4785,7 +4802,6 @@ async def test_delete_dns_threat_detector_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dns_threat_detector.DeleteDnsThreatDetectorRequest() - assert args[0] == request_msg @@ -6252,7 +6268,6 @@ def test_list_dns_threat_detectors_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dns_threat_detector.ListDnsThreatDetectorsRequest() - assert args[0] == request_msg @@ -6274,7 +6289,6 @@ def test_get_dns_threat_detector_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dns_threat_detector.GetDnsThreatDetectorRequest() - assert args[0] == request_msg @@ -6296,7 +6310,6 @@ def test_create_dns_threat_detector_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_dns_threat_detector.CreateDnsThreatDetectorRequest() - assert args[0] == request_msg @@ -6318,7 +6331,6 @@ def test_update_dns_threat_detector_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_dns_threat_detector.UpdateDnsThreatDetectorRequest() - assert args[0] == request_msg @@ -6340,7 +6352,6 @@ def test_delete_dns_threat_detector_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dns_threat_detector.DeleteDnsThreatDetectorRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-network-security/tests/unit/gapic/network_security_v1beta1/test_network_security.py b/packages/google-cloud-network-security/tests/unit/gapic/network_security_v1beta1/test_network_security.py index 3e40793680e8..2c1d7f4b17f4 100644 --- a/packages/google-cloud-network-security/tests/unit/gapic/network_security_v1beta1/test_network_security.py +++ b/packages/google-cloud-network-security/tests/unit/gapic/network_security_v1beta1/test_network_security.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 @@ -136,6 +137,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" @@ -1363,8 +1379,8 @@ def test_network_security_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - authorization_policy.ListAuthorizationPoliciesRequest, - dict, + authorization_policy.ListAuthorizationPoliciesRequest(), + {}, ], ) def test_list_authorization_policies(request_type, transport: str = "grpc"): @@ -1375,7 +1391,7 @@ def test_list_authorization_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( @@ -1424,10 +1440,11 @@ def test_list_authorization_policies_non_empty_request_with_auto_populated_field client.list_authorization_policies(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == authorization_policy.ListAuthorizationPoliciesRequest( + request_msg = authorization_policy.ListAuthorizationPoliciesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_authorization_policies_use_cached_wrapped_rpc(): @@ -1513,9 +1530,15 @@ async def test_list_authorization_policies_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + authorization_policy.ListAuthorizationPoliciesRequest(), + {}, + ], +) async def test_list_authorization_policies_async( - transport: str = "grpc_asyncio", - request_type=authorization_policy.ListAuthorizationPoliciesRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -1524,7 +1547,7 @@ async def test_list_authorization_policies_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( @@ -1549,11 +1572,6 @@ async def test_list_authorization_policies_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_authorization_policies_async_from_dict(): - await test_list_authorization_policies_async(request_type=dict) - - def test_list_authorization_policies_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1912,8 +1930,8 @@ async def test_list_authorization_policies_async_pages(): @pytest.mark.parametrize( "request_type", [ - authorization_policy.GetAuthorizationPolicyRequest, - dict, + authorization_policy.GetAuthorizationPolicyRequest(), + {}, ], ) def test_get_authorization_policy(request_type, transport: str = "grpc"): @@ -1924,7 +1942,7 @@ def test_get_authorization_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( @@ -1976,9 +1994,10 @@ def test_get_authorization_policy_non_empty_request_with_auto_populated_field(): client.get_authorization_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == authorization_policy.GetAuthorizationPolicyRequest( + request_msg = authorization_policy.GetAuthorizationPolicyRequest( name="name_value", ) + assert args[0] == request_msg def test_get_authorization_policy_use_cached_wrapped_rpc(): @@ -2064,9 +2083,15 @@ async def test_get_authorization_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + authorization_policy.GetAuthorizationPolicyRequest(), + {}, + ], +) async def test_get_authorization_policy_async( - transport: str = "grpc_asyncio", - request_type=authorization_policy.GetAuthorizationPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -2075,7 +2100,7 @@ async def test_get_authorization_policy_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( @@ -2104,11 +2129,6 @@ async def test_get_authorization_policy_async( assert response.action == authorization_policy.AuthorizationPolicy.Action.ALLOW -@pytest.mark.asyncio -async def test_get_authorization_policy_async_from_dict(): - await test_get_authorization_policy_async(request_type=dict) - - def test_get_authorization_policy_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2263,8 +2283,8 @@ async def test_get_authorization_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_authorization_policy.CreateAuthorizationPolicyRequest, - dict, + gcn_authorization_policy.CreateAuthorizationPolicyRequest(), + {}, ], ) def test_create_authorization_policy(request_type, transport: str = "grpc"): @@ -2275,7 +2295,7 @@ def test_create_authorization_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( @@ -2321,10 +2341,11 @@ def test_create_authorization_policy_non_empty_request_with_auto_populated_field client.create_authorization_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_authorization_policy.CreateAuthorizationPolicyRequest( + request_msg = gcn_authorization_policy.CreateAuthorizationPolicyRequest( parent="parent_value", authorization_policy_id="authorization_policy_id_value", ) + assert args[0] == request_msg def test_create_authorization_policy_use_cached_wrapped_rpc(): @@ -2420,9 +2441,15 @@ async def test_create_authorization_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcn_authorization_policy.CreateAuthorizationPolicyRequest(), + {}, + ], +) async def test_create_authorization_policy_async( - transport: str = "grpc_asyncio", - request_type=gcn_authorization_policy.CreateAuthorizationPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -2431,7 +2458,7 @@ async def test_create_authorization_policy_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( @@ -2453,11 +2480,6 @@ async def test_create_authorization_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_authorization_policy_async_from_dict(): - await test_create_authorization_policy_async(request_type=dict) - - def test_create_authorization_policy_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2640,8 +2662,8 @@ async def test_create_authorization_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_authorization_policy.UpdateAuthorizationPolicyRequest, - dict, + gcn_authorization_policy.UpdateAuthorizationPolicyRequest(), + {}, ], ) def test_update_authorization_policy(request_type, transport: str = "grpc"): @@ -2652,7 +2674,7 @@ def test_update_authorization_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( @@ -2695,7 +2717,8 @@ def test_update_authorization_policy_non_empty_request_with_auto_populated_field client.update_authorization_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_authorization_policy.UpdateAuthorizationPolicyRequest() + request_msg = gcn_authorization_policy.UpdateAuthorizationPolicyRequest() + assert args[0] == request_msg def test_update_authorization_policy_use_cached_wrapped_rpc(): @@ -2791,9 +2814,15 @@ async def test_update_authorization_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcn_authorization_policy.UpdateAuthorizationPolicyRequest(), + {}, + ], +) async def test_update_authorization_policy_async( - transport: str = "grpc_asyncio", - request_type=gcn_authorization_policy.UpdateAuthorizationPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -2802,7 +2831,7 @@ async def test_update_authorization_policy_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( @@ -2824,11 +2853,6 @@ async def test_update_authorization_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_authorization_policy_async_from_dict(): - await test_update_authorization_policy_async(request_type=dict) - - def test_update_authorization_policy_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3001,8 +3025,8 @@ async def test_update_authorization_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - authorization_policy.DeleteAuthorizationPolicyRequest, - dict, + authorization_policy.DeleteAuthorizationPolicyRequest(), + {}, ], ) def test_delete_authorization_policy(request_type, transport: str = "grpc"): @@ -3013,7 +3037,7 @@ def test_delete_authorization_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( @@ -3058,9 +3082,10 @@ def test_delete_authorization_policy_non_empty_request_with_auto_populated_field client.delete_authorization_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == authorization_policy.DeleteAuthorizationPolicyRequest( + request_msg = authorization_policy.DeleteAuthorizationPolicyRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_authorization_policy_use_cached_wrapped_rpc(): @@ -3156,9 +3181,15 @@ async def test_delete_authorization_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + authorization_policy.DeleteAuthorizationPolicyRequest(), + {}, + ], +) async def test_delete_authorization_policy_async( - transport: str = "grpc_asyncio", - request_type=authorization_policy.DeleteAuthorizationPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -3167,7 +3198,7 @@ async def test_delete_authorization_policy_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( @@ -3189,11 +3220,6 @@ async def test_delete_authorization_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_authorization_policy_async_from_dict(): - await test_delete_authorization_policy_async(request_type=dict) - - def test_delete_authorization_policy_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3348,8 +3374,8 @@ async def test_delete_authorization_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - server_tls_policy.ListServerTlsPoliciesRequest, - dict, + server_tls_policy.ListServerTlsPoliciesRequest(), + {}, ], ) def test_list_server_tls_policies(request_type, transport: str = "grpc"): @@ -3360,7 +3386,7 @@ def test_list_server_tls_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( @@ -3409,10 +3435,11 @@ def test_list_server_tls_policies_non_empty_request_with_auto_populated_field(): client.list_server_tls_policies(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == server_tls_policy.ListServerTlsPoliciesRequest( + request_msg = server_tls_policy.ListServerTlsPoliciesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_server_tls_policies_use_cached_wrapped_rpc(): @@ -3498,9 +3525,15 @@ async def test_list_server_tls_policies_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + server_tls_policy.ListServerTlsPoliciesRequest(), + {}, + ], +) async def test_list_server_tls_policies_async( - transport: str = "grpc_asyncio", - request_type=server_tls_policy.ListServerTlsPoliciesRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -3509,7 +3542,7 @@ async def test_list_server_tls_policies_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( @@ -3534,11 +3567,6 @@ async def test_list_server_tls_policies_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_server_tls_policies_async_from_dict(): - await test_list_server_tls_policies_async(request_type=dict) - - def test_list_server_tls_policies_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3893,8 +3921,8 @@ async def test_list_server_tls_policies_async_pages(): @pytest.mark.parametrize( "request_type", [ - server_tls_policy.GetServerTlsPolicyRequest, - dict, + server_tls_policy.GetServerTlsPolicyRequest(), + {}, ], ) def test_get_server_tls_policy(request_type, transport: str = "grpc"): @@ -3905,7 +3933,7 @@ def test_get_server_tls_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( @@ -3957,9 +3985,10 @@ def test_get_server_tls_policy_non_empty_request_with_auto_populated_field(): client.get_server_tls_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == server_tls_policy.GetServerTlsPolicyRequest( + request_msg = server_tls_policy.GetServerTlsPolicyRequest( name="name_value", ) + assert args[0] == request_msg def test_get_server_tls_policy_use_cached_wrapped_rpc(): @@ -4045,9 +4074,15 @@ async def test_get_server_tls_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + server_tls_policy.GetServerTlsPolicyRequest(), + {}, + ], +) async def test_get_server_tls_policy_async( - transport: str = "grpc_asyncio", - request_type=server_tls_policy.GetServerTlsPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -4056,7 +4091,7 @@ async def test_get_server_tls_policy_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( @@ -4085,11 +4120,6 @@ async def test_get_server_tls_policy_async( assert response.allow_open is True -@pytest.mark.asyncio -async def test_get_server_tls_policy_async_from_dict(): - await test_get_server_tls_policy_async(request_type=dict) - - def test_get_server_tls_policy_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4244,8 +4274,8 @@ async def test_get_server_tls_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_server_tls_policy.CreateServerTlsPolicyRequest, - dict, + gcn_server_tls_policy.CreateServerTlsPolicyRequest(), + {}, ], ) def test_create_server_tls_policy(request_type, transport: str = "grpc"): @@ -4256,7 +4286,7 @@ def test_create_server_tls_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( @@ -4302,10 +4332,11 @@ def test_create_server_tls_policy_non_empty_request_with_auto_populated_field(): client.create_server_tls_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_server_tls_policy.CreateServerTlsPolicyRequest( + request_msg = gcn_server_tls_policy.CreateServerTlsPolicyRequest( parent="parent_value", server_tls_policy_id="server_tls_policy_id_value", ) + assert args[0] == request_msg def test_create_server_tls_policy_use_cached_wrapped_rpc(): @@ -4401,9 +4432,15 @@ async def test_create_server_tls_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcn_server_tls_policy.CreateServerTlsPolicyRequest(), + {}, + ], +) async def test_create_server_tls_policy_async( - transport: str = "grpc_asyncio", - request_type=gcn_server_tls_policy.CreateServerTlsPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -4412,7 +4449,7 @@ async def test_create_server_tls_policy_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( @@ -4434,11 +4471,6 @@ async def test_create_server_tls_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_server_tls_policy_async_from_dict(): - await test_create_server_tls_policy_async(request_type=dict) - - def test_create_server_tls_policy_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4613,8 +4645,8 @@ async def test_create_server_tls_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_server_tls_policy.UpdateServerTlsPolicyRequest, - dict, + gcn_server_tls_policy.UpdateServerTlsPolicyRequest(), + {}, ], ) def test_update_server_tls_policy(request_type, transport: str = "grpc"): @@ -4625,7 +4657,7 @@ def test_update_server_tls_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( @@ -4668,7 +4700,8 @@ def test_update_server_tls_policy_non_empty_request_with_auto_populated_field(): client.update_server_tls_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_server_tls_policy.UpdateServerTlsPolicyRequest() + request_msg = gcn_server_tls_policy.UpdateServerTlsPolicyRequest() + assert args[0] == request_msg def test_update_server_tls_policy_use_cached_wrapped_rpc(): @@ -4764,9 +4797,15 @@ async def test_update_server_tls_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcn_server_tls_policy.UpdateServerTlsPolicyRequest(), + {}, + ], +) async def test_update_server_tls_policy_async( - transport: str = "grpc_asyncio", - request_type=gcn_server_tls_policy.UpdateServerTlsPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -4775,7 +4814,7 @@ async def test_update_server_tls_policy_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( @@ -4797,11 +4836,6 @@ async def test_update_server_tls_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_server_tls_policy_async_from_dict(): - await test_update_server_tls_policy_async(request_type=dict) - - def test_update_server_tls_policy_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4966,8 +5000,8 @@ async def test_update_server_tls_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - server_tls_policy.DeleteServerTlsPolicyRequest, - dict, + server_tls_policy.DeleteServerTlsPolicyRequest(), + {}, ], ) def test_delete_server_tls_policy(request_type, transport: str = "grpc"): @@ -4978,7 +5012,7 @@ def test_delete_server_tls_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( @@ -5023,9 +5057,10 @@ def test_delete_server_tls_policy_non_empty_request_with_auto_populated_field(): client.delete_server_tls_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == server_tls_policy.DeleteServerTlsPolicyRequest( + request_msg = server_tls_policy.DeleteServerTlsPolicyRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_server_tls_policy_use_cached_wrapped_rpc(): @@ -5121,9 +5156,15 @@ async def test_delete_server_tls_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + server_tls_policy.DeleteServerTlsPolicyRequest(), + {}, + ], +) async def test_delete_server_tls_policy_async( - transport: str = "grpc_asyncio", - request_type=server_tls_policy.DeleteServerTlsPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -5132,7 +5173,7 @@ async def test_delete_server_tls_policy_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( @@ -5154,11 +5195,6 @@ async def test_delete_server_tls_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_server_tls_policy_async_from_dict(): - await test_delete_server_tls_policy_async(request_type=dict) - - def test_delete_server_tls_policy_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5313,8 +5349,8 @@ async def test_delete_server_tls_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - client_tls_policy.ListClientTlsPoliciesRequest, - dict, + client_tls_policy.ListClientTlsPoliciesRequest(), + {}, ], ) def test_list_client_tls_policies(request_type, transport: str = "grpc"): @@ -5325,7 +5361,7 @@ def test_list_client_tls_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( @@ -5374,10 +5410,11 @@ def test_list_client_tls_policies_non_empty_request_with_auto_populated_field(): client.list_client_tls_policies(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == client_tls_policy.ListClientTlsPoliciesRequest( + request_msg = client_tls_policy.ListClientTlsPoliciesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_client_tls_policies_use_cached_wrapped_rpc(): @@ -5463,9 +5500,15 @@ async def test_list_client_tls_policies_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + client_tls_policy.ListClientTlsPoliciesRequest(), + {}, + ], +) async def test_list_client_tls_policies_async( - transport: str = "grpc_asyncio", - request_type=client_tls_policy.ListClientTlsPoliciesRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -5474,7 +5517,7 @@ async def test_list_client_tls_policies_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( @@ -5499,11 +5542,6 @@ async def test_list_client_tls_policies_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_client_tls_policies_async_from_dict(): - await test_list_client_tls_policies_async(request_type=dict) - - def test_list_client_tls_policies_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5858,8 +5896,8 @@ async def test_list_client_tls_policies_async_pages(): @pytest.mark.parametrize( "request_type", [ - client_tls_policy.GetClientTlsPolicyRequest, - dict, + client_tls_policy.GetClientTlsPolicyRequest(), + {}, ], ) def test_get_client_tls_policy(request_type, transport: str = "grpc"): @@ -5870,7 +5908,7 @@ def test_get_client_tls_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( @@ -5922,9 +5960,10 @@ def test_get_client_tls_policy_non_empty_request_with_auto_populated_field(): client.get_client_tls_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == client_tls_policy.GetClientTlsPolicyRequest( + request_msg = client_tls_policy.GetClientTlsPolicyRequest( name="name_value", ) + assert args[0] == request_msg def test_get_client_tls_policy_use_cached_wrapped_rpc(): @@ -6010,9 +6049,15 @@ async def test_get_client_tls_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + client_tls_policy.GetClientTlsPolicyRequest(), + {}, + ], +) async def test_get_client_tls_policy_async( - transport: str = "grpc_asyncio", - request_type=client_tls_policy.GetClientTlsPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -6021,7 +6066,7 @@ async def test_get_client_tls_policy_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( @@ -6050,11 +6095,6 @@ async def test_get_client_tls_policy_async( assert response.sni == "sni_value" -@pytest.mark.asyncio -async def test_get_client_tls_policy_async_from_dict(): - await test_get_client_tls_policy_async(request_type=dict) - - def test_get_client_tls_policy_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6209,8 +6249,8 @@ async def test_get_client_tls_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_client_tls_policy.CreateClientTlsPolicyRequest, - dict, + gcn_client_tls_policy.CreateClientTlsPolicyRequest(), + {}, ], ) def test_create_client_tls_policy(request_type, transport: str = "grpc"): @@ -6221,7 +6261,7 @@ def test_create_client_tls_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( @@ -6267,10 +6307,11 @@ def test_create_client_tls_policy_non_empty_request_with_auto_populated_field(): client.create_client_tls_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_client_tls_policy.CreateClientTlsPolicyRequest( + request_msg = gcn_client_tls_policy.CreateClientTlsPolicyRequest( parent="parent_value", client_tls_policy_id="client_tls_policy_id_value", ) + assert args[0] == request_msg def test_create_client_tls_policy_use_cached_wrapped_rpc(): @@ -6366,9 +6407,15 @@ async def test_create_client_tls_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcn_client_tls_policy.CreateClientTlsPolicyRequest(), + {}, + ], +) async def test_create_client_tls_policy_async( - transport: str = "grpc_asyncio", - request_type=gcn_client_tls_policy.CreateClientTlsPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -6377,7 +6424,7 @@ async def test_create_client_tls_policy_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( @@ -6399,11 +6446,6 @@ async def test_create_client_tls_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_client_tls_policy_async_from_dict(): - await test_create_client_tls_policy_async(request_type=dict) - - def test_create_client_tls_policy_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6578,8 +6620,8 @@ async def test_create_client_tls_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_client_tls_policy.UpdateClientTlsPolicyRequest, - dict, + gcn_client_tls_policy.UpdateClientTlsPolicyRequest(), + {}, ], ) def test_update_client_tls_policy(request_type, transport: str = "grpc"): @@ -6590,7 +6632,7 @@ def test_update_client_tls_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( @@ -6633,7 +6675,8 @@ def test_update_client_tls_policy_non_empty_request_with_auto_populated_field(): client.update_client_tls_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_client_tls_policy.UpdateClientTlsPolicyRequest() + request_msg = gcn_client_tls_policy.UpdateClientTlsPolicyRequest() + assert args[0] == request_msg def test_update_client_tls_policy_use_cached_wrapped_rpc(): @@ -6729,9 +6772,15 @@ async def test_update_client_tls_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcn_client_tls_policy.UpdateClientTlsPolicyRequest(), + {}, + ], +) async def test_update_client_tls_policy_async( - transport: str = "grpc_asyncio", - request_type=gcn_client_tls_policy.UpdateClientTlsPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -6740,7 +6789,7 @@ async def test_update_client_tls_policy_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( @@ -6762,11 +6811,6 @@ async def test_update_client_tls_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_client_tls_policy_async_from_dict(): - await test_update_client_tls_policy_async(request_type=dict) - - def test_update_client_tls_policy_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6931,8 +6975,8 @@ async def test_update_client_tls_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - client_tls_policy.DeleteClientTlsPolicyRequest, - dict, + client_tls_policy.DeleteClientTlsPolicyRequest(), + {}, ], ) def test_delete_client_tls_policy(request_type, transport: str = "grpc"): @@ -6943,7 +6987,7 @@ def test_delete_client_tls_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( @@ -6988,9 +7032,10 @@ def test_delete_client_tls_policy_non_empty_request_with_auto_populated_field(): client.delete_client_tls_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == client_tls_policy.DeleteClientTlsPolicyRequest( + request_msg = client_tls_policy.DeleteClientTlsPolicyRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_client_tls_policy_use_cached_wrapped_rpc(): @@ -7086,9 +7131,15 @@ async def test_delete_client_tls_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + client_tls_policy.DeleteClientTlsPolicyRequest(), + {}, + ], +) async def test_delete_client_tls_policy_async( - transport: str = "grpc_asyncio", - request_type=client_tls_policy.DeleteClientTlsPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkSecurityAsyncClient( credentials=async_anonymous_credentials(), @@ -7097,7 +7148,7 @@ async def test_delete_client_tls_policy_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( @@ -7119,11 +7170,6 @@ async def test_delete_client_tls_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_client_tls_policy_async_from_dict(): - await test_delete_client_tls_policy_async(request_type=dict) - - def test_delete_client_tls_policy_field_headers(): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10507,7 +10553,6 @@ def test_list_authorization_policies_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = authorization_policy.ListAuthorizationPoliciesRequest() - assert args[0] == request_msg @@ -10530,7 +10575,6 @@ def test_get_authorization_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = authorization_policy.GetAuthorizationPolicyRequest() - assert args[0] == request_msg @@ -10553,7 +10597,6 @@ def test_create_authorization_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_authorization_policy.CreateAuthorizationPolicyRequest() - assert args[0] == request_msg @@ -10576,7 +10619,6 @@ def test_update_authorization_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_authorization_policy.UpdateAuthorizationPolicyRequest() - assert args[0] == request_msg @@ -10599,7 +10641,6 @@ def test_delete_authorization_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = authorization_policy.DeleteAuthorizationPolicyRequest() - assert args[0] == request_msg @@ -10622,7 +10663,6 @@ def test_list_server_tls_policies_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = server_tls_policy.ListServerTlsPoliciesRequest() - assert args[0] == request_msg @@ -10645,7 +10685,6 @@ def test_get_server_tls_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = server_tls_policy.GetServerTlsPolicyRequest() - assert args[0] == request_msg @@ -10668,7 +10707,6 @@ def test_create_server_tls_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_server_tls_policy.CreateServerTlsPolicyRequest() - assert args[0] == request_msg @@ -10691,7 +10729,6 @@ def test_update_server_tls_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_server_tls_policy.UpdateServerTlsPolicyRequest() - assert args[0] == request_msg @@ -10714,7 +10751,6 @@ def test_delete_server_tls_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = server_tls_policy.DeleteServerTlsPolicyRequest() - assert args[0] == request_msg @@ -10737,7 +10773,6 @@ def test_list_client_tls_policies_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = client_tls_policy.ListClientTlsPoliciesRequest() - assert args[0] == request_msg @@ -10760,7 +10795,6 @@ def test_get_client_tls_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = client_tls_policy.GetClientTlsPolicyRequest() - assert args[0] == request_msg @@ -10783,7 +10817,6 @@ def test_create_client_tls_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_client_tls_policy.CreateClientTlsPolicyRequest() - assert args[0] == request_msg @@ -10806,7 +10839,6 @@ def test_update_client_tls_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_client_tls_policy.UpdateClientTlsPolicyRequest() - assert args[0] == request_msg @@ -10829,7 +10861,6 @@ def test_delete_client_tls_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = client_tls_policy.DeleteClientTlsPolicyRequest() - assert args[0] == request_msg @@ -10872,7 +10903,6 @@ async def test_list_authorization_policies_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = authorization_policy.ListAuthorizationPoliciesRequest() - assert args[0] == request_msg @@ -10903,7 +10933,6 @@ async def test_get_authorization_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = authorization_policy.GetAuthorizationPolicyRequest() - assert args[0] == request_msg @@ -10930,7 +10959,6 @@ async def test_create_authorization_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_authorization_policy.CreateAuthorizationPolicyRequest() - assert args[0] == request_msg @@ -10957,7 +10985,6 @@ async def test_update_authorization_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_authorization_policy.UpdateAuthorizationPolicyRequest() - assert args[0] == request_msg @@ -10984,7 +11011,6 @@ async def test_delete_authorization_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = authorization_policy.DeleteAuthorizationPolicyRequest() - assert args[0] == request_msg @@ -11013,7 +11039,6 @@ async def test_list_server_tls_policies_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = server_tls_policy.ListServerTlsPoliciesRequest() - assert args[0] == request_msg @@ -11044,7 +11069,6 @@ async def test_get_server_tls_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = server_tls_policy.GetServerTlsPolicyRequest() - assert args[0] == request_msg @@ -11071,7 +11095,6 @@ async def test_create_server_tls_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_server_tls_policy.CreateServerTlsPolicyRequest() - assert args[0] == request_msg @@ -11098,7 +11121,6 @@ async def test_update_server_tls_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_server_tls_policy.UpdateServerTlsPolicyRequest() - assert args[0] == request_msg @@ -11125,7 +11147,6 @@ async def test_delete_server_tls_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = server_tls_policy.DeleteServerTlsPolicyRequest() - assert args[0] == request_msg @@ -11154,7 +11175,6 @@ async def test_list_client_tls_policies_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = client_tls_policy.ListClientTlsPoliciesRequest() - assert args[0] == request_msg @@ -11185,7 +11205,6 @@ async def test_get_client_tls_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = client_tls_policy.GetClientTlsPolicyRequest() - assert args[0] == request_msg @@ -11212,7 +11231,6 @@ async def test_create_client_tls_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_client_tls_policy.CreateClientTlsPolicyRequest() - assert args[0] == request_msg @@ -11239,7 +11257,6 @@ async def test_update_client_tls_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_client_tls_policy.UpdateClientTlsPolicyRequest() - assert args[0] == request_msg @@ -11266,7 +11283,6 @@ async def test_delete_client_tls_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = client_tls_policy.DeleteClientTlsPolicyRequest() - assert args[0] == request_msg @@ -14438,7 +14454,6 @@ def test_list_authorization_policies_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = authorization_policy.ListAuthorizationPoliciesRequest() - assert args[0] == request_msg @@ -14460,7 +14475,6 @@ def test_get_authorization_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = authorization_policy.GetAuthorizationPolicyRequest() - assert args[0] == request_msg @@ -14482,7 +14496,6 @@ def test_create_authorization_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_authorization_policy.CreateAuthorizationPolicyRequest() - assert args[0] == request_msg @@ -14504,7 +14517,6 @@ def test_update_authorization_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_authorization_policy.UpdateAuthorizationPolicyRequest() - assert args[0] == request_msg @@ -14526,7 +14538,6 @@ def test_delete_authorization_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = authorization_policy.DeleteAuthorizationPolicyRequest() - assert args[0] == request_msg @@ -14548,7 +14559,6 @@ def test_list_server_tls_policies_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = server_tls_policy.ListServerTlsPoliciesRequest() - assert args[0] == request_msg @@ -14570,7 +14580,6 @@ def test_get_server_tls_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = server_tls_policy.GetServerTlsPolicyRequest() - assert args[0] == request_msg @@ -14592,7 +14601,6 @@ def test_create_server_tls_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_server_tls_policy.CreateServerTlsPolicyRequest() - assert args[0] == request_msg @@ -14614,7 +14622,6 @@ def test_update_server_tls_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_server_tls_policy.UpdateServerTlsPolicyRequest() - assert args[0] == request_msg @@ -14636,7 +14643,6 @@ def test_delete_server_tls_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = server_tls_policy.DeleteServerTlsPolicyRequest() - assert args[0] == request_msg @@ -14658,7 +14664,6 @@ def test_list_client_tls_policies_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = client_tls_policy.ListClientTlsPoliciesRequest() - assert args[0] == request_msg @@ -14680,7 +14685,6 @@ def test_get_client_tls_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = client_tls_policy.GetClientTlsPolicyRequest() - assert args[0] == request_msg @@ -14702,7 +14706,6 @@ def test_create_client_tls_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_client_tls_policy.CreateClientTlsPolicyRequest() - assert args[0] == request_msg @@ -14724,7 +14727,6 @@ def test_update_client_tls_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_client_tls_policy.UpdateClientTlsPolicyRequest() - assert args[0] == request_msg @@ -14746,7 +14748,6 @@ def test_delete_client_tls_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = client_tls_policy.DeleteClientTlsPolicyRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-network-services/noxfile.py b/packages/google-cloud-network-services/noxfile.py index beccf7a83be4..7061cef385ac 100644 --- a/packages/google-cloud-network-services/noxfile.py +++ b/packages/google-cloud-network-services/noxfile.py @@ -47,7 +47,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-network-services" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-network-services/setup.py b/packages/google-cloud-network-services/setup.py index 777bd47900a1..8a72208f46e3 100644 --- a/packages/google-cloud-network-services/setup.py +++ b/packages/google-cloud-network-services/setup.py @@ -45,7 +45,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/google-cloud-network-services/testing/constraints-3.10.txt b/packages/google-cloud-network-services/testing/constraints-3.10.txt index a92801e1c8e2..b39cd54634f9 100644 --- a/packages/google-cloud-network-services/testing/constraints-3.10.txt +++ b/packages/google-cloud-network-services/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/google-cloud-network-services/tests/unit/gapic/network_services_v1/test_dep_service.py b/packages/google-cloud-network-services/tests/unit/gapic/network_services_v1/test_dep_service.py index 7a9002b129b8..662b5f55a83a 100644 --- a/packages/google-cloud-network-services/tests/unit/gapic/network_services_v1/test_dep_service.py +++ b/packages/google-cloud-network-services/tests/unit/gapic/network_services_v1/test_dep_service.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 @@ -123,6 +124,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" @@ -1284,8 +1300,8 @@ def test_dep_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - dep.ListLbTrafficExtensionsRequest, - dict, + dep.ListLbTrafficExtensionsRequest(), + {}, ], ) def test_list_lb_traffic_extensions(request_type, transport: str = "grpc"): @@ -1296,7 +1312,7 @@ def test_list_lb_traffic_extensions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1349,12 +1365,13 @@ def test_list_lb_traffic_extensions_non_empty_request_with_auto_populated_field( client.list_lb_traffic_extensions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dep.ListLbTrafficExtensionsRequest( + request_msg = dep.ListLbTrafficExtensionsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_lb_traffic_extensions_use_cached_wrapped_rpc(): @@ -1440,8 +1457,15 @@ async def test_list_lb_traffic_extensions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dep.ListLbTrafficExtensionsRequest(), + {}, + ], +) async def test_list_lb_traffic_extensions_async( - transport: str = "grpc_asyncio", request_type=dep.ListLbTrafficExtensionsRequest + request_type, transport: str = "grpc_asyncio" ): client = DepServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1450,7 +1474,7 @@ async def test_list_lb_traffic_extensions_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( @@ -1477,11 +1501,6 @@ async def test_list_lb_traffic_extensions_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_lb_traffic_extensions_async_from_dict(): - await test_list_lb_traffic_extensions_async(request_type=dict) - - def test_list_lb_traffic_extensions_field_headers(): client = DepServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1836,8 +1855,8 @@ async def test_list_lb_traffic_extensions_async_pages(): @pytest.mark.parametrize( "request_type", [ - dep.GetLbTrafficExtensionRequest, - dict, + dep.GetLbTrafficExtensionRequest(), + {}, ], ) def test_get_lb_traffic_extension(request_type, transport: str = "grpc"): @@ -1848,7 +1867,7 @@ def test_get_lb_traffic_extension(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1902,9 +1921,10 @@ def test_get_lb_traffic_extension_non_empty_request_with_auto_populated_field(): client.get_lb_traffic_extension(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dep.GetLbTrafficExtensionRequest( + request_msg = dep.GetLbTrafficExtensionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_lb_traffic_extension_use_cached_wrapped_rpc(): @@ -1990,8 +2010,15 @@ async def test_get_lb_traffic_extension_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dep.GetLbTrafficExtensionRequest(), + {}, + ], +) async def test_get_lb_traffic_extension_async( - transport: str = "grpc_asyncio", request_type=dep.GetLbTrafficExtensionRequest + request_type, transport: str = "grpc_asyncio" ): client = DepServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2000,7 +2027,7 @@ async def test_get_lb_traffic_extension_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( @@ -2031,11 +2058,6 @@ async def test_get_lb_traffic_extension_async( assert response.load_balancing_scheme == dep.LoadBalancingScheme.INTERNAL_MANAGED -@pytest.mark.asyncio -async def test_get_lb_traffic_extension_async_from_dict(): - await test_get_lb_traffic_extension_async(request_type=dict) - - def test_get_lb_traffic_extension_field_headers(): client = DepServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2190,8 +2212,8 @@ async def test_get_lb_traffic_extension_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dep.CreateLbTrafficExtensionRequest, - dict, + dep.CreateLbTrafficExtensionRequest(), + {}, ], ) def test_create_lb_traffic_extension(request_type, transport: str = "grpc"): @@ -2202,7 +2224,7 @@ def test_create_lb_traffic_extension(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,10 +2270,11 @@ def test_create_lb_traffic_extension_non_empty_request_with_auto_populated_field client.create_lb_traffic_extension(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dep.CreateLbTrafficExtensionRequest( + request_msg = dep.CreateLbTrafficExtensionRequest( parent="parent_value", lb_traffic_extension_id="lb_traffic_extension_id_value", ) + assert args[0] == request_msg def test_create_lb_traffic_extension_use_cached_wrapped_rpc(): @@ -2347,8 +2370,15 @@ async def test_create_lb_traffic_extension_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dep.CreateLbTrafficExtensionRequest(), + {}, + ], +) async def test_create_lb_traffic_extension_async( - transport: str = "grpc_asyncio", request_type=dep.CreateLbTrafficExtensionRequest + request_type, transport: str = "grpc_asyncio" ): client = DepServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2357,7 +2387,7 @@ async def test_create_lb_traffic_extension_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( @@ -2379,11 +2409,6 @@ async def test_create_lb_traffic_extension_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_lb_traffic_extension_async_from_dict(): - await test_create_lb_traffic_extension_async(request_type=dict) - - def test_create_lb_traffic_extension_field_headers(): client = DepServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2558,8 +2583,8 @@ async def test_create_lb_traffic_extension_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dep.UpdateLbTrafficExtensionRequest, - dict, + dep.UpdateLbTrafficExtensionRequest(), + {}, ], ) def test_update_lb_traffic_extension(request_type, transport: str = "grpc"): @@ -2570,7 +2595,7 @@ def test_update_lb_traffic_extension(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2613,7 +2638,8 @@ def test_update_lb_traffic_extension_non_empty_request_with_auto_populated_field client.update_lb_traffic_extension(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dep.UpdateLbTrafficExtensionRequest() + request_msg = dep.UpdateLbTrafficExtensionRequest() + assert args[0] == request_msg def test_update_lb_traffic_extension_use_cached_wrapped_rpc(): @@ -2709,8 +2735,15 @@ async def test_update_lb_traffic_extension_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dep.UpdateLbTrafficExtensionRequest(), + {}, + ], +) async def test_update_lb_traffic_extension_async( - transport: str = "grpc_asyncio", request_type=dep.UpdateLbTrafficExtensionRequest + request_type, transport: str = "grpc_asyncio" ): client = DepServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2719,7 +2752,7 @@ async def test_update_lb_traffic_extension_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( @@ -2741,11 +2774,6 @@ async def test_update_lb_traffic_extension_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_lb_traffic_extension_async_from_dict(): - await test_update_lb_traffic_extension_async(request_type=dict) - - def test_update_lb_traffic_extension_field_headers(): client = DepServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2910,8 +2938,8 @@ async def test_update_lb_traffic_extension_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dep.DeleteLbTrafficExtensionRequest, - dict, + dep.DeleteLbTrafficExtensionRequest(), + {}, ], ) def test_delete_lb_traffic_extension(request_type, transport: str = "grpc"): @@ -2922,7 +2950,7 @@ def test_delete_lb_traffic_extension(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2967,9 +2995,10 @@ def test_delete_lb_traffic_extension_non_empty_request_with_auto_populated_field client.delete_lb_traffic_extension(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dep.DeleteLbTrafficExtensionRequest( + request_msg = dep.DeleteLbTrafficExtensionRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_lb_traffic_extension_use_cached_wrapped_rpc(): @@ -3065,8 +3094,15 @@ async def test_delete_lb_traffic_extension_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dep.DeleteLbTrafficExtensionRequest(), + {}, + ], +) async def test_delete_lb_traffic_extension_async( - transport: str = "grpc_asyncio", request_type=dep.DeleteLbTrafficExtensionRequest + request_type, transport: str = "grpc_asyncio" ): client = DepServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3075,7 +3111,7 @@ async def test_delete_lb_traffic_extension_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( @@ -3097,11 +3133,6 @@ async def test_delete_lb_traffic_extension_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_lb_traffic_extension_async_from_dict(): - await test_delete_lb_traffic_extension_async(request_type=dict) - - def test_delete_lb_traffic_extension_field_headers(): client = DepServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3256,8 +3287,8 @@ async def test_delete_lb_traffic_extension_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dep.ListLbRouteExtensionsRequest, - dict, + dep.ListLbRouteExtensionsRequest(), + {}, ], ) def test_list_lb_route_extensions(request_type, transport: str = "grpc"): @@ -3268,7 +3299,7 @@ def test_list_lb_route_extensions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3321,12 +3352,13 @@ def test_list_lb_route_extensions_non_empty_request_with_auto_populated_field(): client.list_lb_route_extensions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dep.ListLbRouteExtensionsRequest( + request_msg = dep.ListLbRouteExtensionsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_lb_route_extensions_use_cached_wrapped_rpc(): @@ -3412,8 +3444,15 @@ async def test_list_lb_route_extensions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dep.ListLbRouteExtensionsRequest(), + {}, + ], +) async def test_list_lb_route_extensions_async( - transport: str = "grpc_asyncio", request_type=dep.ListLbRouteExtensionsRequest + request_type, transport: str = "grpc_asyncio" ): client = DepServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3422,7 +3461,7 @@ async def test_list_lb_route_extensions_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( @@ -3449,11 +3488,6 @@ async def test_list_lb_route_extensions_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_lb_route_extensions_async_from_dict(): - await test_list_lb_route_extensions_async(request_type=dict) - - def test_list_lb_route_extensions_field_headers(): client = DepServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3808,8 +3842,8 @@ async def test_list_lb_route_extensions_async_pages(): @pytest.mark.parametrize( "request_type", [ - dep.GetLbRouteExtensionRequest, - dict, + dep.GetLbRouteExtensionRequest(), + {}, ], ) def test_get_lb_route_extension(request_type, transport: str = "grpc"): @@ -3820,7 +3854,7 @@ def test_get_lb_route_extension(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3874,9 +3908,10 @@ def test_get_lb_route_extension_non_empty_request_with_auto_populated_field(): client.get_lb_route_extension(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dep.GetLbRouteExtensionRequest( + request_msg = dep.GetLbRouteExtensionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_lb_route_extension_use_cached_wrapped_rpc(): @@ -3962,8 +3997,15 @@ async def test_get_lb_route_extension_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dep.GetLbRouteExtensionRequest(), + {}, + ], +) async def test_get_lb_route_extension_async( - transport: str = "grpc_asyncio", request_type=dep.GetLbRouteExtensionRequest + request_type, transport: str = "grpc_asyncio" ): client = DepServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3972,7 +4014,7 @@ async def test_get_lb_route_extension_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( @@ -4003,11 +4045,6 @@ async def test_get_lb_route_extension_async( assert response.load_balancing_scheme == dep.LoadBalancingScheme.INTERNAL_MANAGED -@pytest.mark.asyncio -async def test_get_lb_route_extension_async_from_dict(): - await test_get_lb_route_extension_async(request_type=dict) - - def test_get_lb_route_extension_field_headers(): client = DepServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4162,8 +4199,8 @@ async def test_get_lb_route_extension_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dep.CreateLbRouteExtensionRequest, - dict, + dep.CreateLbRouteExtensionRequest(), + {}, ], ) def test_create_lb_route_extension(request_type, transport: str = "grpc"): @@ -4174,7 +4211,7 @@ def test_create_lb_route_extension(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4220,10 +4257,11 @@ def test_create_lb_route_extension_non_empty_request_with_auto_populated_field() client.create_lb_route_extension(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dep.CreateLbRouteExtensionRequest( + request_msg = dep.CreateLbRouteExtensionRequest( parent="parent_value", lb_route_extension_id="lb_route_extension_id_value", ) + assert args[0] == request_msg def test_create_lb_route_extension_use_cached_wrapped_rpc(): @@ -4319,8 +4357,15 @@ async def test_create_lb_route_extension_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dep.CreateLbRouteExtensionRequest(), + {}, + ], +) async def test_create_lb_route_extension_async( - transport: str = "grpc_asyncio", request_type=dep.CreateLbRouteExtensionRequest + request_type, transport: str = "grpc_asyncio" ): client = DepServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4329,7 +4374,7 @@ async def test_create_lb_route_extension_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( @@ -4351,11 +4396,6 @@ async def test_create_lb_route_extension_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_lb_route_extension_async_from_dict(): - await test_create_lb_route_extension_async(request_type=dict) - - def test_create_lb_route_extension_field_headers(): client = DepServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4530,8 +4570,8 @@ async def test_create_lb_route_extension_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dep.UpdateLbRouteExtensionRequest, - dict, + dep.UpdateLbRouteExtensionRequest(), + {}, ], ) def test_update_lb_route_extension(request_type, transport: str = "grpc"): @@ -4542,7 +4582,7 @@ def test_update_lb_route_extension(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4585,7 +4625,8 @@ def test_update_lb_route_extension_non_empty_request_with_auto_populated_field() client.update_lb_route_extension(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dep.UpdateLbRouteExtensionRequest() + request_msg = dep.UpdateLbRouteExtensionRequest() + assert args[0] == request_msg def test_update_lb_route_extension_use_cached_wrapped_rpc(): @@ -4681,8 +4722,15 @@ async def test_update_lb_route_extension_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dep.UpdateLbRouteExtensionRequest(), + {}, + ], +) async def test_update_lb_route_extension_async( - transport: str = "grpc_asyncio", request_type=dep.UpdateLbRouteExtensionRequest + request_type, transport: str = "grpc_asyncio" ): client = DepServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4691,7 +4739,7 @@ async def test_update_lb_route_extension_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( @@ -4713,11 +4761,6 @@ async def test_update_lb_route_extension_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_lb_route_extension_async_from_dict(): - await test_update_lb_route_extension_async(request_type=dict) - - def test_update_lb_route_extension_field_headers(): client = DepServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4882,8 +4925,8 @@ async def test_update_lb_route_extension_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dep.DeleteLbRouteExtensionRequest, - dict, + dep.DeleteLbRouteExtensionRequest(), + {}, ], ) def test_delete_lb_route_extension(request_type, transport: str = "grpc"): @@ -4894,7 +4937,7 @@ def test_delete_lb_route_extension(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4939,9 +4982,10 @@ def test_delete_lb_route_extension_non_empty_request_with_auto_populated_field() client.delete_lb_route_extension(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dep.DeleteLbRouteExtensionRequest( + request_msg = dep.DeleteLbRouteExtensionRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_lb_route_extension_use_cached_wrapped_rpc(): @@ -5037,8 +5081,15 @@ async def test_delete_lb_route_extension_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dep.DeleteLbRouteExtensionRequest(), + {}, + ], +) async def test_delete_lb_route_extension_async( - transport: str = "grpc_asyncio", request_type=dep.DeleteLbRouteExtensionRequest + request_type, transport: str = "grpc_asyncio" ): client = DepServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5047,7 +5098,7 @@ async def test_delete_lb_route_extension_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( @@ -5069,11 +5120,6 @@ async def test_delete_lb_route_extension_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_lb_route_extension_async_from_dict(): - await test_delete_lb_route_extension_async(request_type=dict) - - def test_delete_lb_route_extension_field_headers(): client = DepServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5228,8 +5274,8 @@ async def test_delete_lb_route_extension_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dep.ListLbEdgeExtensionsRequest, - dict, + dep.ListLbEdgeExtensionsRequest(), + {}, ], ) def test_list_lb_edge_extensions(request_type, transport: str = "grpc"): @@ -5240,7 +5286,7 @@ def test_list_lb_edge_extensions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5293,12 +5339,13 @@ def test_list_lb_edge_extensions_non_empty_request_with_auto_populated_field(): client.list_lb_edge_extensions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dep.ListLbEdgeExtensionsRequest( + request_msg = dep.ListLbEdgeExtensionsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_lb_edge_extensions_use_cached_wrapped_rpc(): @@ -5384,8 +5431,15 @@ async def test_list_lb_edge_extensions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dep.ListLbEdgeExtensionsRequest(), + {}, + ], +) async def test_list_lb_edge_extensions_async( - transport: str = "grpc_asyncio", request_type=dep.ListLbEdgeExtensionsRequest + request_type, transport: str = "grpc_asyncio" ): client = DepServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5394,7 +5448,7 @@ async def test_list_lb_edge_extensions_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( @@ -5421,11 +5475,6 @@ async def test_list_lb_edge_extensions_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_lb_edge_extensions_async_from_dict(): - await test_list_lb_edge_extensions_async(request_type=dict) - - def test_list_lb_edge_extensions_field_headers(): client = DepServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5778,8 +5827,8 @@ async def test_list_lb_edge_extensions_async_pages(): @pytest.mark.parametrize( "request_type", [ - dep.GetLbEdgeExtensionRequest, - dict, + dep.GetLbEdgeExtensionRequest(), + {}, ], ) def test_get_lb_edge_extension(request_type, transport: str = "grpc"): @@ -5790,7 +5839,7 @@ def test_get_lb_edge_extension(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5844,9 +5893,10 @@ def test_get_lb_edge_extension_non_empty_request_with_auto_populated_field(): client.get_lb_edge_extension(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dep.GetLbEdgeExtensionRequest( + request_msg = dep.GetLbEdgeExtensionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_lb_edge_extension_use_cached_wrapped_rpc(): @@ -5932,8 +5982,15 @@ async def test_get_lb_edge_extension_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dep.GetLbEdgeExtensionRequest(), + {}, + ], +) async def test_get_lb_edge_extension_async( - transport: str = "grpc_asyncio", request_type=dep.GetLbEdgeExtensionRequest + request_type, transport: str = "grpc_asyncio" ): client = DepServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5942,7 +5999,7 @@ async def test_get_lb_edge_extension_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( @@ -5973,11 +6030,6 @@ async def test_get_lb_edge_extension_async( assert response.load_balancing_scheme == dep.LoadBalancingScheme.INTERNAL_MANAGED -@pytest.mark.asyncio -async def test_get_lb_edge_extension_async_from_dict(): - await test_get_lb_edge_extension_async(request_type=dict) - - def test_get_lb_edge_extension_field_headers(): client = DepServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6128,8 +6180,8 @@ async def test_get_lb_edge_extension_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dep.CreateLbEdgeExtensionRequest, - dict, + dep.CreateLbEdgeExtensionRequest(), + {}, ], ) def test_create_lb_edge_extension(request_type, transport: str = "grpc"): @@ -6140,7 +6192,7 @@ def test_create_lb_edge_extension(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6186,10 +6238,11 @@ def test_create_lb_edge_extension_non_empty_request_with_auto_populated_field(): client.create_lb_edge_extension(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dep.CreateLbEdgeExtensionRequest( + request_msg = dep.CreateLbEdgeExtensionRequest( parent="parent_value", lb_edge_extension_id="lb_edge_extension_id_value", ) + assert args[0] == request_msg def test_create_lb_edge_extension_use_cached_wrapped_rpc(): @@ -6285,8 +6338,15 @@ async def test_create_lb_edge_extension_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dep.CreateLbEdgeExtensionRequest(), + {}, + ], +) async def test_create_lb_edge_extension_async( - transport: str = "grpc_asyncio", request_type=dep.CreateLbEdgeExtensionRequest + request_type, transport: str = "grpc_asyncio" ): client = DepServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -6295,7 +6355,7 @@ async def test_create_lb_edge_extension_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( @@ -6317,11 +6377,6 @@ async def test_create_lb_edge_extension_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_lb_edge_extension_async_from_dict(): - await test_create_lb_edge_extension_async(request_type=dict) - - def test_create_lb_edge_extension_field_headers(): client = DepServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6496,8 +6551,8 @@ async def test_create_lb_edge_extension_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dep.UpdateLbEdgeExtensionRequest, - dict, + dep.UpdateLbEdgeExtensionRequest(), + {}, ], ) def test_update_lb_edge_extension(request_type, transport: str = "grpc"): @@ -6508,7 +6563,7 @@ def test_update_lb_edge_extension(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6551,7 +6606,8 @@ def test_update_lb_edge_extension_non_empty_request_with_auto_populated_field(): client.update_lb_edge_extension(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dep.UpdateLbEdgeExtensionRequest() + request_msg = dep.UpdateLbEdgeExtensionRequest() + assert args[0] == request_msg def test_update_lb_edge_extension_use_cached_wrapped_rpc(): @@ -6647,8 +6703,15 @@ async def test_update_lb_edge_extension_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dep.UpdateLbEdgeExtensionRequest(), + {}, + ], +) async def test_update_lb_edge_extension_async( - transport: str = "grpc_asyncio", request_type=dep.UpdateLbEdgeExtensionRequest + request_type, transport: str = "grpc_asyncio" ): client = DepServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -6657,7 +6720,7 @@ async def test_update_lb_edge_extension_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( @@ -6679,11 +6742,6 @@ async def test_update_lb_edge_extension_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_lb_edge_extension_async_from_dict(): - await test_update_lb_edge_extension_async(request_type=dict) - - def test_update_lb_edge_extension_field_headers(): client = DepServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6848,8 +6906,8 @@ async def test_update_lb_edge_extension_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dep.DeleteLbEdgeExtensionRequest, - dict, + dep.DeleteLbEdgeExtensionRequest(), + {}, ], ) def test_delete_lb_edge_extension(request_type, transport: str = "grpc"): @@ -6860,7 +6918,7 @@ def test_delete_lb_edge_extension(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6905,9 +6963,10 @@ def test_delete_lb_edge_extension_non_empty_request_with_auto_populated_field(): client.delete_lb_edge_extension(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dep.DeleteLbEdgeExtensionRequest( + request_msg = dep.DeleteLbEdgeExtensionRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_lb_edge_extension_use_cached_wrapped_rpc(): @@ -7003,8 +7062,15 @@ async def test_delete_lb_edge_extension_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dep.DeleteLbEdgeExtensionRequest(), + {}, + ], +) async def test_delete_lb_edge_extension_async( - transport: str = "grpc_asyncio", request_type=dep.DeleteLbEdgeExtensionRequest + request_type, transport: str = "grpc_asyncio" ): client = DepServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -7013,7 +7079,7 @@ async def test_delete_lb_edge_extension_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( @@ -7035,11 +7101,6 @@ async def test_delete_lb_edge_extension_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_lb_edge_extension_async_from_dict(): - await test_delete_lb_edge_extension_async(request_type=dict) - - def test_delete_lb_edge_extension_field_headers(): client = DepServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7194,8 +7255,8 @@ async def test_delete_lb_edge_extension_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dep.ListAuthzExtensionsRequest, - dict, + dep.ListAuthzExtensionsRequest(), + {}, ], ) def test_list_authz_extensions(request_type, transport: str = "grpc"): @@ -7206,7 +7267,7 @@ def test_list_authz_extensions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,12 +7320,13 @@ def test_list_authz_extensions_non_empty_request_with_auto_populated_field(): client.list_authz_extensions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dep.ListAuthzExtensionsRequest( + request_msg = dep.ListAuthzExtensionsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_authz_extensions_use_cached_wrapped_rpc(): @@ -7350,8 +7412,15 @@ async def test_list_authz_extensions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dep.ListAuthzExtensionsRequest(), + {}, + ], +) async def test_list_authz_extensions_async( - transport: str = "grpc_asyncio", request_type=dep.ListAuthzExtensionsRequest + request_type, transport: str = "grpc_asyncio" ): client = DepServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -7360,7 +7429,7 @@ async def test_list_authz_extensions_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( @@ -7387,11 +7456,6 @@ async def test_list_authz_extensions_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_authz_extensions_async_from_dict(): - await test_list_authz_extensions_async(request_type=dict) - - def test_list_authz_extensions_field_headers(): client = DepServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7744,8 +7808,8 @@ async def test_list_authz_extensions_async_pages(): @pytest.mark.parametrize( "request_type", [ - dep.GetAuthzExtensionRequest, - dict, + dep.GetAuthzExtensionRequest(), + {}, ], ) def test_get_authz_extension(request_type, transport: str = "grpc"): @@ -7756,7 +7820,7 @@ def test_get_authz_extension(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7818,9 +7882,10 @@ def test_get_authz_extension_non_empty_request_with_auto_populated_field(): client.get_authz_extension(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dep.GetAuthzExtensionRequest( + request_msg = dep.GetAuthzExtensionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_authz_extension_use_cached_wrapped_rpc(): @@ -7905,9 +7970,14 @@ async def test_get_authz_extension_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_authz_extension_async( - transport: str = "grpc_asyncio", request_type=dep.GetAuthzExtensionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + dep.GetAuthzExtensionRequest(), + {}, + ], +) +async def test_get_authz_extension_async(request_type, transport: str = "grpc_asyncio"): client = DepServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7915,7 +7985,7 @@ async def test_get_authz_extension_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( @@ -7954,11 +8024,6 @@ async def test_get_authz_extension_async( assert response.wire_format == dep.WireFormat.EXT_PROC_GRPC -@pytest.mark.asyncio -async def test_get_authz_extension_async_from_dict(): - await test_get_authz_extension_async(request_type=dict) - - def test_get_authz_extension_field_headers(): client = DepServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8109,8 +8174,8 @@ async def test_get_authz_extension_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dep.CreateAuthzExtensionRequest, - dict, + dep.CreateAuthzExtensionRequest(), + {}, ], ) def test_create_authz_extension(request_type, transport: str = "grpc"): @@ -8121,7 +8186,7 @@ def test_create_authz_extension(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8167,10 +8232,11 @@ def test_create_authz_extension_non_empty_request_with_auto_populated_field(): client.create_authz_extension(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dep.CreateAuthzExtensionRequest( + request_msg = dep.CreateAuthzExtensionRequest( parent="parent_value", authz_extension_id="authz_extension_id_value", ) + assert args[0] == request_msg def test_create_authz_extension_use_cached_wrapped_rpc(): @@ -8266,8 +8332,15 @@ async def test_create_authz_extension_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dep.CreateAuthzExtensionRequest(), + {}, + ], +) async def test_create_authz_extension_async( - transport: str = "grpc_asyncio", request_type=dep.CreateAuthzExtensionRequest + request_type, transport: str = "grpc_asyncio" ): client = DepServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -8276,7 +8349,7 @@ async def test_create_authz_extension_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( @@ -8298,11 +8371,6 @@ async def test_create_authz_extension_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_authz_extension_async_from_dict(): - await test_create_authz_extension_async(request_type=dict) - - def test_create_authz_extension_field_headers(): client = DepServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8477,8 +8545,8 @@ async def test_create_authz_extension_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dep.UpdateAuthzExtensionRequest, - dict, + dep.UpdateAuthzExtensionRequest(), + {}, ], ) def test_update_authz_extension(request_type, transport: str = "grpc"): @@ -8489,7 +8557,7 @@ def test_update_authz_extension(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8532,7 +8600,8 @@ def test_update_authz_extension_non_empty_request_with_auto_populated_field(): client.update_authz_extension(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dep.UpdateAuthzExtensionRequest() + request_msg = dep.UpdateAuthzExtensionRequest() + assert args[0] == request_msg def test_update_authz_extension_use_cached_wrapped_rpc(): @@ -8628,8 +8697,15 @@ async def test_update_authz_extension_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dep.UpdateAuthzExtensionRequest(), + {}, + ], +) async def test_update_authz_extension_async( - transport: str = "grpc_asyncio", request_type=dep.UpdateAuthzExtensionRequest + request_type, transport: str = "grpc_asyncio" ): client = DepServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -8638,7 +8714,7 @@ async def test_update_authz_extension_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( @@ -8660,11 +8736,6 @@ async def test_update_authz_extension_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_authz_extension_async_from_dict(): - await test_update_authz_extension_async(request_type=dict) - - def test_update_authz_extension_field_headers(): client = DepServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8829,8 +8900,8 @@ async def test_update_authz_extension_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - dep.DeleteAuthzExtensionRequest, - dict, + dep.DeleteAuthzExtensionRequest(), + {}, ], ) def test_delete_authz_extension(request_type, transport: str = "grpc"): @@ -8841,7 +8912,7 @@ def test_delete_authz_extension(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,9 +8957,10 @@ def test_delete_authz_extension_non_empty_request_with_auto_populated_field(): client.delete_authz_extension(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == dep.DeleteAuthzExtensionRequest( + request_msg = dep.DeleteAuthzExtensionRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_authz_extension_use_cached_wrapped_rpc(): @@ -8984,8 +9056,15 @@ async def test_delete_authz_extension_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + dep.DeleteAuthzExtensionRequest(), + {}, + ], +) async def test_delete_authz_extension_async( - transport: str = "grpc_asyncio", request_type=dep.DeleteAuthzExtensionRequest + request_type, transport: str = "grpc_asyncio" ): client = DepServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -8994,7 +9073,7 @@ async def test_delete_authz_extension_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( @@ -9016,11 +9095,6 @@ async def test_delete_authz_extension_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_authz_extension_async_from_dict(): - await test_delete_authz_extension_async(request_type=dict) - - def test_delete_authz_extension_field_headers(): client = DepServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13526,7 +13600,6 @@ def test_list_lb_traffic_extensions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dep.ListLbTrafficExtensionsRequest() - assert args[0] == request_msg @@ -13549,7 +13622,6 @@ def test_get_lb_traffic_extension_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dep.GetLbTrafficExtensionRequest() - assert args[0] == request_msg @@ -13572,7 +13644,6 @@ def test_create_lb_traffic_extension_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dep.CreateLbTrafficExtensionRequest() - assert args[0] == request_msg @@ -13595,7 +13666,6 @@ def test_update_lb_traffic_extension_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dep.UpdateLbTrafficExtensionRequest() - assert args[0] == request_msg @@ -13618,7 +13688,6 @@ def test_delete_lb_traffic_extension_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dep.DeleteLbTrafficExtensionRequest() - assert args[0] == request_msg @@ -13641,7 +13710,6 @@ def test_list_lb_route_extensions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dep.ListLbRouteExtensionsRequest() - assert args[0] == request_msg @@ -13664,7 +13732,6 @@ def test_get_lb_route_extension_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dep.GetLbRouteExtensionRequest() - assert args[0] == request_msg @@ -13687,7 +13754,6 @@ def test_create_lb_route_extension_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dep.CreateLbRouteExtensionRequest() - assert args[0] == request_msg @@ -13710,7 +13776,6 @@ def test_update_lb_route_extension_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dep.UpdateLbRouteExtensionRequest() - assert args[0] == request_msg @@ -13733,7 +13798,6 @@ def test_delete_lb_route_extension_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dep.DeleteLbRouteExtensionRequest() - assert args[0] == request_msg @@ -13756,7 +13820,6 @@ def test_list_lb_edge_extensions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dep.ListLbEdgeExtensionsRequest() - assert args[0] == request_msg @@ -13779,7 +13842,6 @@ def test_get_lb_edge_extension_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dep.GetLbEdgeExtensionRequest() - assert args[0] == request_msg @@ -13802,7 +13864,6 @@ def test_create_lb_edge_extension_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dep.CreateLbEdgeExtensionRequest() - assert args[0] == request_msg @@ -13825,7 +13886,6 @@ def test_update_lb_edge_extension_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dep.UpdateLbEdgeExtensionRequest() - assert args[0] == request_msg @@ -13848,7 +13908,6 @@ def test_delete_lb_edge_extension_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dep.DeleteLbEdgeExtensionRequest() - assert args[0] == request_msg @@ -13871,7 +13930,6 @@ def test_list_authz_extensions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dep.ListAuthzExtensionsRequest() - assert args[0] == request_msg @@ -13894,7 +13952,6 @@ def test_get_authz_extension_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dep.GetAuthzExtensionRequest() - assert args[0] == request_msg @@ -13917,7 +13974,6 @@ def test_create_authz_extension_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dep.CreateAuthzExtensionRequest() - assert args[0] == request_msg @@ -13940,7 +13996,6 @@ def test_update_authz_extension_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dep.UpdateAuthzExtensionRequest() - assert args[0] == request_msg @@ -13963,7 +14018,6 @@ def test_delete_authz_extension_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dep.DeleteAuthzExtensionRequest() - assert args[0] == request_msg @@ -14007,7 +14061,6 @@ async def test_list_lb_traffic_extensions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dep.ListLbTrafficExtensionsRequest() - assert args[0] == request_msg @@ -14039,7 +14092,6 @@ async def test_get_lb_traffic_extension_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dep.GetLbTrafficExtensionRequest() - assert args[0] == request_msg @@ -14066,7 +14118,6 @@ async def test_create_lb_traffic_extension_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dep.CreateLbTrafficExtensionRequest() - assert args[0] == request_msg @@ -14093,7 +14144,6 @@ async def test_update_lb_traffic_extension_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dep.UpdateLbTrafficExtensionRequest() - assert args[0] == request_msg @@ -14120,7 +14170,6 @@ async def test_delete_lb_traffic_extension_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dep.DeleteLbTrafficExtensionRequest() - assert args[0] == request_msg @@ -14150,7 +14199,6 @@ async def test_list_lb_route_extensions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dep.ListLbRouteExtensionsRequest() - assert args[0] == request_msg @@ -14182,7 +14230,6 @@ async def test_get_lb_route_extension_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dep.GetLbRouteExtensionRequest() - assert args[0] == request_msg @@ -14209,7 +14256,6 @@ async def test_create_lb_route_extension_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dep.CreateLbRouteExtensionRequest() - assert args[0] == request_msg @@ -14236,7 +14282,6 @@ async def test_update_lb_route_extension_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dep.UpdateLbRouteExtensionRequest() - assert args[0] == request_msg @@ -14263,7 +14308,6 @@ async def test_delete_lb_route_extension_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dep.DeleteLbRouteExtensionRequest() - assert args[0] == request_msg @@ -14293,7 +14337,6 @@ async def test_list_lb_edge_extensions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dep.ListLbEdgeExtensionsRequest() - assert args[0] == request_msg @@ -14325,7 +14368,6 @@ async def test_get_lb_edge_extension_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dep.GetLbEdgeExtensionRequest() - assert args[0] == request_msg @@ -14352,7 +14394,6 @@ async def test_create_lb_edge_extension_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dep.CreateLbEdgeExtensionRequest() - assert args[0] == request_msg @@ -14379,7 +14420,6 @@ async def test_update_lb_edge_extension_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dep.UpdateLbEdgeExtensionRequest() - assert args[0] == request_msg @@ -14406,7 +14446,6 @@ async def test_delete_lb_edge_extension_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dep.DeleteLbEdgeExtensionRequest() - assert args[0] == request_msg @@ -14436,7 +14475,6 @@ async def test_list_authz_extensions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dep.ListAuthzExtensionsRequest() - assert args[0] == request_msg @@ -14472,7 +14510,6 @@ async def test_get_authz_extension_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dep.GetAuthzExtensionRequest() - assert args[0] == request_msg @@ -14499,7 +14536,6 @@ async def test_create_authz_extension_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dep.CreateAuthzExtensionRequest() - assert args[0] == request_msg @@ -14526,7 +14562,6 @@ async def test_update_authz_extension_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dep.UpdateAuthzExtensionRequest() - assert args[0] == request_msg @@ -14553,7 +14588,6 @@ async def test_delete_authz_extension_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dep.DeleteAuthzExtensionRequest() - assert args[0] == request_msg @@ -18582,7 +18616,6 @@ def test_list_lb_traffic_extensions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dep.ListLbTrafficExtensionsRequest() - assert args[0] == request_msg @@ -18604,7 +18637,6 @@ def test_get_lb_traffic_extension_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dep.GetLbTrafficExtensionRequest() - assert args[0] == request_msg @@ -18626,7 +18658,6 @@ def test_create_lb_traffic_extension_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dep.CreateLbTrafficExtensionRequest() - assert args[0] == request_msg @@ -18648,7 +18679,6 @@ def test_update_lb_traffic_extension_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dep.UpdateLbTrafficExtensionRequest() - assert args[0] == request_msg @@ -18670,7 +18700,6 @@ def test_delete_lb_traffic_extension_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dep.DeleteLbTrafficExtensionRequest() - assert args[0] == request_msg @@ -18692,7 +18721,6 @@ def test_list_lb_route_extensions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dep.ListLbRouteExtensionsRequest() - assert args[0] == request_msg @@ -18714,7 +18742,6 @@ def test_get_lb_route_extension_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dep.GetLbRouteExtensionRequest() - assert args[0] == request_msg @@ -18736,7 +18763,6 @@ def test_create_lb_route_extension_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dep.CreateLbRouteExtensionRequest() - assert args[0] == request_msg @@ -18758,7 +18784,6 @@ def test_update_lb_route_extension_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dep.UpdateLbRouteExtensionRequest() - assert args[0] == request_msg @@ -18780,7 +18805,6 @@ def test_delete_lb_route_extension_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dep.DeleteLbRouteExtensionRequest() - assert args[0] == request_msg @@ -18802,7 +18826,6 @@ def test_list_lb_edge_extensions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dep.ListLbEdgeExtensionsRequest() - assert args[0] == request_msg @@ -18824,7 +18847,6 @@ def test_get_lb_edge_extension_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dep.GetLbEdgeExtensionRequest() - assert args[0] == request_msg @@ -18846,7 +18868,6 @@ def test_create_lb_edge_extension_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dep.CreateLbEdgeExtensionRequest() - assert args[0] == request_msg @@ -18868,7 +18889,6 @@ def test_update_lb_edge_extension_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dep.UpdateLbEdgeExtensionRequest() - assert args[0] == request_msg @@ -18890,7 +18910,6 @@ def test_delete_lb_edge_extension_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dep.DeleteLbEdgeExtensionRequest() - assert args[0] == request_msg @@ -18912,7 +18931,6 @@ def test_list_authz_extensions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dep.ListAuthzExtensionsRequest() - assert args[0] == request_msg @@ -18934,7 +18952,6 @@ def test_get_authz_extension_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dep.GetAuthzExtensionRequest() - assert args[0] == request_msg @@ -18956,7 +18973,6 @@ def test_create_authz_extension_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dep.CreateAuthzExtensionRequest() - assert args[0] == request_msg @@ -18978,7 +18994,6 @@ def test_update_authz_extension_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dep.UpdateAuthzExtensionRequest() - assert args[0] == request_msg @@ -19000,7 +19015,6 @@ def test_delete_authz_extension_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = dep.DeleteAuthzExtensionRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-network-services/tests/unit/gapic/network_services_v1/test_network_services.py b/packages/google-cloud-network-services/tests/unit/gapic/network_services_v1/test_network_services.py index 1ed3ba153ba0..6847a6781589 100644 --- a/packages/google-cloud-network-services/tests/unit/gapic/network_services_v1/test_network_services.py +++ b/packages/google-cloud-network-services/tests/unit/gapic/network_services_v1/test_network_services.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 @@ -150,6 +151,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" @@ -1377,8 +1393,8 @@ def test_network_services_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - endpoint_policy.ListEndpointPoliciesRequest, - dict, + endpoint_policy.ListEndpointPoliciesRequest(), + {}, ], ) def test_list_endpoint_policies(request_type, transport: str = "grpc"): @@ -1389,7 +1405,7 @@ def test_list_endpoint_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( @@ -1440,10 +1456,11 @@ def test_list_endpoint_policies_non_empty_request_with_auto_populated_field(): client.list_endpoint_policies(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == endpoint_policy.ListEndpointPoliciesRequest( + request_msg = endpoint_policy.ListEndpointPoliciesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_endpoint_policies_use_cached_wrapped_rpc(): @@ -1529,9 +1546,15 @@ async def test_list_endpoint_policies_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + endpoint_policy.ListEndpointPoliciesRequest(), + {}, + ], +) async def test_list_endpoint_policies_async( - transport: str = "grpc_asyncio", - request_type=endpoint_policy.ListEndpointPoliciesRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkServicesAsyncClient( credentials=async_anonymous_credentials(), @@ -1540,7 +1563,7 @@ async def test_list_endpoint_policies_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( @@ -1567,11 +1590,6 @@ async def test_list_endpoint_policies_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_endpoint_policies_async_from_dict(): - await test_list_endpoint_policies_async(request_type=dict) - - def test_list_endpoint_policies_field_headers(): client = NetworkServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1924,8 +1942,8 @@ async def test_list_endpoint_policies_async_pages(): @pytest.mark.parametrize( "request_type", [ - endpoint_policy.GetEndpointPolicyRequest, - dict, + endpoint_policy.GetEndpointPolicyRequest(), + {}, ], ) def test_get_endpoint_policy(request_type, transport: str = "grpc"): @@ -1936,7 +1954,7 @@ def test_get_endpoint_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( @@ -1997,9 +2015,10 @@ def test_get_endpoint_policy_non_empty_request_with_auto_populated_field(): client.get_endpoint_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == endpoint_policy.GetEndpointPolicyRequest( + request_msg = endpoint_policy.GetEndpointPolicyRequest( name="name_value", ) + assert args[0] == request_msg def test_get_endpoint_policy_use_cached_wrapped_rpc(): @@ -2084,10 +2103,14 @@ async def test_get_endpoint_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_endpoint_policy_async( - transport: str = "grpc_asyncio", - request_type=endpoint_policy.GetEndpointPolicyRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + endpoint_policy.GetEndpointPolicyRequest(), + {}, + ], +) +async def test_get_endpoint_policy_async(request_type, transport: str = "grpc_asyncio"): client = NetworkServicesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2095,7 +2118,7 @@ async def test_get_endpoint_policy_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( @@ -2133,11 +2156,6 @@ async def test_get_endpoint_policy_async( assert response.client_tls_policy == "client_tls_policy_value" -@pytest.mark.asyncio -async def test_get_endpoint_policy_async_from_dict(): - await test_get_endpoint_policy_async(request_type=dict) - - def test_get_endpoint_policy_field_headers(): client = NetworkServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2292,8 +2310,8 @@ async def test_get_endpoint_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_endpoint_policy.CreateEndpointPolicyRequest, - dict, + gcn_endpoint_policy.CreateEndpointPolicyRequest(), + {}, ], ) def test_create_endpoint_policy(request_type, transport: str = "grpc"): @@ -2304,7 +2322,7 @@ def test_create_endpoint_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( @@ -2350,10 +2368,11 @@ def test_create_endpoint_policy_non_empty_request_with_auto_populated_field(): client.create_endpoint_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_endpoint_policy.CreateEndpointPolicyRequest( + request_msg = gcn_endpoint_policy.CreateEndpointPolicyRequest( parent="parent_value", endpoint_policy_id="endpoint_policy_id_value", ) + assert args[0] == request_msg def test_create_endpoint_policy_use_cached_wrapped_rpc(): @@ -2449,9 +2468,15 @@ async def test_create_endpoint_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcn_endpoint_policy.CreateEndpointPolicyRequest(), + {}, + ], +) async def test_create_endpoint_policy_async( - transport: str = "grpc_asyncio", - request_type=gcn_endpoint_policy.CreateEndpointPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkServicesAsyncClient( credentials=async_anonymous_credentials(), @@ -2460,7 +2485,7 @@ async def test_create_endpoint_policy_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( @@ -2482,11 +2507,6 @@ async def test_create_endpoint_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_endpoint_policy_async_from_dict(): - await test_create_endpoint_policy_async(request_type=dict) - - def test_create_endpoint_policy_field_headers(): client = NetworkServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2661,8 +2681,8 @@ async def test_create_endpoint_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_endpoint_policy.UpdateEndpointPolicyRequest, - dict, + gcn_endpoint_policy.UpdateEndpointPolicyRequest(), + {}, ], ) def test_update_endpoint_policy(request_type, transport: str = "grpc"): @@ -2673,7 +2693,7 @@ def test_update_endpoint_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( @@ -2716,7 +2736,8 @@ def test_update_endpoint_policy_non_empty_request_with_auto_populated_field(): client.update_endpoint_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_endpoint_policy.UpdateEndpointPolicyRequest() + request_msg = gcn_endpoint_policy.UpdateEndpointPolicyRequest() + assert args[0] == request_msg def test_update_endpoint_policy_use_cached_wrapped_rpc(): @@ -2812,9 +2833,15 @@ async def test_update_endpoint_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcn_endpoint_policy.UpdateEndpointPolicyRequest(), + {}, + ], +) async def test_update_endpoint_policy_async( - transport: str = "grpc_asyncio", - request_type=gcn_endpoint_policy.UpdateEndpointPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkServicesAsyncClient( credentials=async_anonymous_credentials(), @@ -2823,7 +2850,7 @@ async def test_update_endpoint_policy_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( @@ -2845,11 +2872,6 @@ async def test_update_endpoint_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_endpoint_policy_async_from_dict(): - await test_update_endpoint_policy_async(request_type=dict) - - def test_update_endpoint_policy_field_headers(): client = NetworkServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3014,8 +3036,8 @@ async def test_update_endpoint_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - endpoint_policy.DeleteEndpointPolicyRequest, - dict, + endpoint_policy.DeleteEndpointPolicyRequest(), + {}, ], ) def test_delete_endpoint_policy(request_type, transport: str = "grpc"): @@ -3026,7 +3048,7 @@ def test_delete_endpoint_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( @@ -3071,9 +3093,10 @@ def test_delete_endpoint_policy_non_empty_request_with_auto_populated_field(): client.delete_endpoint_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == endpoint_policy.DeleteEndpointPolicyRequest( + request_msg = endpoint_policy.DeleteEndpointPolicyRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_endpoint_policy_use_cached_wrapped_rpc(): @@ -3169,9 +3192,15 @@ async def test_delete_endpoint_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + endpoint_policy.DeleteEndpointPolicyRequest(), + {}, + ], +) async def test_delete_endpoint_policy_async( - transport: str = "grpc_asyncio", - request_type=endpoint_policy.DeleteEndpointPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkServicesAsyncClient( credentials=async_anonymous_credentials(), @@ -3180,7 +3209,7 @@ async def test_delete_endpoint_policy_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( @@ -3202,11 +3231,6 @@ async def test_delete_endpoint_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_endpoint_policy_async_from_dict(): - await test_delete_endpoint_policy_async(request_type=dict) - - def test_delete_endpoint_policy_field_headers(): client = NetworkServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3361,8 +3385,8 @@ async def test_delete_endpoint_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - extensibility.ListWasmPluginVersionsRequest, - dict, + extensibility.ListWasmPluginVersionsRequest(), + {}, ], ) def test_list_wasm_plugin_versions(request_type, transport: str = "grpc"): @@ -3373,7 +3397,7 @@ def test_list_wasm_plugin_versions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3424,10 +3448,11 @@ def test_list_wasm_plugin_versions_non_empty_request_with_auto_populated_field() client.list_wasm_plugin_versions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == extensibility.ListWasmPluginVersionsRequest( + request_msg = extensibility.ListWasmPluginVersionsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_wasm_plugin_versions_use_cached_wrapped_rpc(): @@ -3513,9 +3538,15 @@ async def test_list_wasm_plugin_versions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + extensibility.ListWasmPluginVersionsRequest(), + {}, + ], +) async def test_list_wasm_plugin_versions_async( - transport: str = "grpc_asyncio", - request_type=extensibility.ListWasmPluginVersionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkServicesAsyncClient( credentials=async_anonymous_credentials(), @@ -3524,7 +3555,7 @@ async def test_list_wasm_plugin_versions_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( @@ -3551,11 +3582,6 @@ async def test_list_wasm_plugin_versions_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_wasm_plugin_versions_async_from_dict(): - await test_list_wasm_plugin_versions_async(request_type=dict) - - def test_list_wasm_plugin_versions_field_headers(): client = NetworkServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3910,8 +3936,8 @@ async def test_list_wasm_plugin_versions_async_pages(): @pytest.mark.parametrize( "request_type", [ - extensibility.GetWasmPluginVersionRequest, - dict, + extensibility.GetWasmPluginVersionRequest(), + {}, ], ) def test_get_wasm_plugin_version(request_type, transport: str = "grpc"): @@ -3922,7 +3948,7 @@ def test_get_wasm_plugin_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3979,9 +4005,10 @@ def test_get_wasm_plugin_version_non_empty_request_with_auto_populated_field(): client.get_wasm_plugin_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == extensibility.GetWasmPluginVersionRequest( + request_msg = extensibility.GetWasmPluginVersionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_wasm_plugin_version_use_cached_wrapped_rpc(): @@ -4067,9 +4094,15 @@ async def test_get_wasm_plugin_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + extensibility.GetWasmPluginVersionRequest(), + {}, + ], +) async def test_get_wasm_plugin_version_async( - transport: str = "grpc_asyncio", - request_type=extensibility.GetWasmPluginVersionRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkServicesAsyncClient( credentials=async_anonymous_credentials(), @@ -4078,7 +4111,7 @@ async def test_get_wasm_plugin_version_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( @@ -4111,11 +4144,6 @@ async def test_get_wasm_plugin_version_async( assert response.plugin_config_digest == "plugin_config_digest_value" -@pytest.mark.asyncio -async def test_get_wasm_plugin_version_async_from_dict(): - await test_get_wasm_plugin_version_async(request_type=dict) - - def test_get_wasm_plugin_version_field_headers(): client = NetworkServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4270,8 +4298,8 @@ async def test_get_wasm_plugin_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - extensibility.CreateWasmPluginVersionRequest, - dict, + extensibility.CreateWasmPluginVersionRequest(), + {}, ], ) def test_create_wasm_plugin_version(request_type, transport: str = "grpc"): @@ -4282,7 +4310,7 @@ def test_create_wasm_plugin_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4328,10 +4356,11 @@ def test_create_wasm_plugin_version_non_empty_request_with_auto_populated_field( client.create_wasm_plugin_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == extensibility.CreateWasmPluginVersionRequest( + request_msg = extensibility.CreateWasmPluginVersionRequest( parent="parent_value", wasm_plugin_version_id="wasm_plugin_version_id_value", ) + assert args[0] == request_msg def test_create_wasm_plugin_version_use_cached_wrapped_rpc(): @@ -4427,9 +4456,15 @@ async def test_create_wasm_plugin_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + extensibility.CreateWasmPluginVersionRequest(), + {}, + ], +) async def test_create_wasm_plugin_version_async( - transport: str = "grpc_asyncio", - request_type=extensibility.CreateWasmPluginVersionRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkServicesAsyncClient( credentials=async_anonymous_credentials(), @@ -4438,7 +4473,7 @@ async def test_create_wasm_plugin_version_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( @@ -4460,11 +4495,6 @@ async def test_create_wasm_plugin_version_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_wasm_plugin_version_async_from_dict(): - await test_create_wasm_plugin_version_async(request_type=dict) - - def test_create_wasm_plugin_version_field_headers(): client = NetworkServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4651,8 +4681,8 @@ async def test_create_wasm_plugin_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - extensibility.DeleteWasmPluginVersionRequest, - dict, + extensibility.DeleteWasmPluginVersionRequest(), + {}, ], ) def test_delete_wasm_plugin_version(request_type, transport: str = "grpc"): @@ -4663,7 +4693,7 @@ def test_delete_wasm_plugin_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4708,9 +4738,10 @@ def test_delete_wasm_plugin_version_non_empty_request_with_auto_populated_field( client.delete_wasm_plugin_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == extensibility.DeleteWasmPluginVersionRequest( + request_msg = extensibility.DeleteWasmPluginVersionRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_wasm_plugin_version_use_cached_wrapped_rpc(): @@ -4806,9 +4837,15 @@ async def test_delete_wasm_plugin_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + extensibility.DeleteWasmPluginVersionRequest(), + {}, + ], +) async def test_delete_wasm_plugin_version_async( - transport: str = "grpc_asyncio", - request_type=extensibility.DeleteWasmPluginVersionRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkServicesAsyncClient( credentials=async_anonymous_credentials(), @@ -4817,7 +4854,7 @@ async def test_delete_wasm_plugin_version_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( @@ -4839,11 +4876,6 @@ async def test_delete_wasm_plugin_version_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_wasm_plugin_version_async_from_dict(): - await test_delete_wasm_plugin_version_async(request_type=dict) - - def test_delete_wasm_plugin_version_field_headers(): client = NetworkServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4998,8 +5030,8 @@ async def test_delete_wasm_plugin_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - extensibility.ListWasmPluginsRequest, - dict, + extensibility.ListWasmPluginsRequest(), + {}, ], ) def test_list_wasm_plugins(request_type, transport: str = "grpc"): @@ -5010,7 +5042,7 @@ def test_list_wasm_plugins(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5061,10 +5093,11 @@ def test_list_wasm_plugins_non_empty_request_with_auto_populated_field(): client.list_wasm_plugins(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == extensibility.ListWasmPluginsRequest( + request_msg = extensibility.ListWasmPluginsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_wasm_plugins_use_cached_wrapped_rpc(): @@ -5147,9 +5180,14 @@ async def test_list_wasm_plugins_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_wasm_plugins_async( - transport: str = "grpc_asyncio", request_type=extensibility.ListWasmPluginsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + extensibility.ListWasmPluginsRequest(), + {}, + ], +) +async def test_list_wasm_plugins_async(request_type, transport: str = "grpc_asyncio"): client = NetworkServicesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5157,7 +5195,7 @@ async def test_list_wasm_plugins_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( @@ -5184,11 +5222,6 @@ async def test_list_wasm_plugins_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_wasm_plugins_async_from_dict(): - await test_list_wasm_plugins_async(request_type=dict) - - def test_list_wasm_plugins_field_headers(): client = NetworkServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5541,8 +5574,8 @@ async def test_list_wasm_plugins_async_pages(): @pytest.mark.parametrize( "request_type", [ - extensibility.GetWasmPluginRequest, - dict, + extensibility.GetWasmPluginRequest(), + {}, ], ) def test_get_wasm_plugin(request_type, transport: str = "grpc"): @@ -5553,7 +5586,7 @@ def test_get_wasm_plugin(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_wasm_plugin), "__call__") as call: @@ -5601,9 +5634,10 @@ def test_get_wasm_plugin_non_empty_request_with_auto_populated_field(): client.get_wasm_plugin(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == extensibility.GetWasmPluginRequest( + request_msg = extensibility.GetWasmPluginRequest( name="name_value", ) + assert args[0] == request_msg def test_get_wasm_plugin_use_cached_wrapped_rpc(): @@ -5684,9 +5718,14 @@ async def test_get_wasm_plugin_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_wasm_plugin_async( - transport: str = "grpc_asyncio", request_type=extensibility.GetWasmPluginRequest -): +@pytest.mark.parametrize( + "request_type", + [ + extensibility.GetWasmPluginRequest(), + {}, + ], +) +async def test_get_wasm_plugin_async(request_type, transport: str = "grpc_asyncio"): client = NetworkServicesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5694,7 +5733,7 @@ async def test_get_wasm_plugin_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_wasm_plugin), "__call__") as call: @@ -5721,11 +5760,6 @@ async def test_get_wasm_plugin_async( assert response.main_version_id == "main_version_id_value" -@pytest.mark.asyncio -async def test_get_wasm_plugin_async_from_dict(): - await test_get_wasm_plugin_async(request_type=dict) - - def test_get_wasm_plugin_field_headers(): client = NetworkServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5872,8 +5906,8 @@ async def test_get_wasm_plugin_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - extensibility.CreateWasmPluginRequest, - dict, + extensibility.CreateWasmPluginRequest(), + {}, ], ) def test_create_wasm_plugin(request_type, transport: str = "grpc"): @@ -5884,7 +5918,7 @@ def test_create_wasm_plugin(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5930,10 +5964,11 @@ def test_create_wasm_plugin_non_empty_request_with_auto_populated_field(): client.create_wasm_plugin(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == extensibility.CreateWasmPluginRequest( + request_msg = extensibility.CreateWasmPluginRequest( parent="parent_value", wasm_plugin_id="wasm_plugin_id_value", ) + assert args[0] == request_msg def test_create_wasm_plugin_use_cached_wrapped_rpc(): @@ -6028,9 +6063,14 @@ async def test_create_wasm_plugin_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_wasm_plugin_async( - transport: str = "grpc_asyncio", request_type=extensibility.CreateWasmPluginRequest -): +@pytest.mark.parametrize( + "request_type", + [ + extensibility.CreateWasmPluginRequest(), + {}, + ], +) +async def test_create_wasm_plugin_async(request_type, transport: str = "grpc_asyncio"): client = NetworkServicesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6038,7 +6078,7 @@ async def test_create_wasm_plugin_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( @@ -6060,11 +6100,6 @@ async def test_create_wasm_plugin_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_wasm_plugin_async_from_dict(): - await test_create_wasm_plugin_async(request_type=dict) - - def test_create_wasm_plugin_field_headers(): client = NetworkServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6239,8 +6274,8 @@ async def test_create_wasm_plugin_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - extensibility.UpdateWasmPluginRequest, - dict, + extensibility.UpdateWasmPluginRequest(), + {}, ], ) def test_update_wasm_plugin(request_type, transport: str = "grpc"): @@ -6251,7 +6286,7 @@ def test_update_wasm_plugin(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6294,7 +6329,8 @@ def test_update_wasm_plugin_non_empty_request_with_auto_populated_field(): client.update_wasm_plugin(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == extensibility.UpdateWasmPluginRequest() + request_msg = extensibility.UpdateWasmPluginRequest() + assert args[0] == request_msg def test_update_wasm_plugin_use_cached_wrapped_rpc(): @@ -6389,9 +6425,14 @@ async def test_update_wasm_plugin_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_wasm_plugin_async( - transport: str = "grpc_asyncio", request_type=extensibility.UpdateWasmPluginRequest -): +@pytest.mark.parametrize( + "request_type", + [ + extensibility.UpdateWasmPluginRequest(), + {}, + ], +) +async def test_update_wasm_plugin_async(request_type, transport: str = "grpc_asyncio"): client = NetworkServicesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6399,7 +6440,7 @@ async def test_update_wasm_plugin_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( @@ -6421,11 +6462,6 @@ async def test_update_wasm_plugin_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_wasm_plugin_async_from_dict(): - await test_update_wasm_plugin_async(request_type=dict) - - def test_update_wasm_plugin_field_headers(): client = NetworkServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6590,8 +6626,8 @@ async def test_update_wasm_plugin_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - extensibility.DeleteWasmPluginRequest, - dict, + extensibility.DeleteWasmPluginRequest(), + {}, ], ) def test_delete_wasm_plugin(request_type, transport: str = "grpc"): @@ -6602,7 +6638,7 @@ def test_delete_wasm_plugin(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6647,9 +6683,10 @@ def test_delete_wasm_plugin_non_empty_request_with_auto_populated_field(): client.delete_wasm_plugin(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == extensibility.DeleteWasmPluginRequest( + request_msg = extensibility.DeleteWasmPluginRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_wasm_plugin_use_cached_wrapped_rpc(): @@ -6744,9 +6781,14 @@ async def test_delete_wasm_plugin_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_wasm_plugin_async( - transport: str = "grpc_asyncio", request_type=extensibility.DeleteWasmPluginRequest -): +@pytest.mark.parametrize( + "request_type", + [ + extensibility.DeleteWasmPluginRequest(), + {}, + ], +) +async def test_delete_wasm_plugin_async(request_type, transport: str = "grpc_asyncio"): client = NetworkServicesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6754,7 +6796,7 @@ async def test_delete_wasm_plugin_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( @@ -6776,11 +6818,6 @@ async def test_delete_wasm_plugin_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_wasm_plugin_async_from_dict(): - await test_delete_wasm_plugin_async(request_type=dict) - - def test_delete_wasm_plugin_field_headers(): client = NetworkServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6935,8 +6972,8 @@ async def test_delete_wasm_plugin_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gateway.ListGatewaysRequest, - dict, + gateway.ListGatewaysRequest(), + {}, ], ) def test_list_gateways(request_type, transport: str = "grpc"): @@ -6947,7 +6984,7 @@ def test_list_gateways(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_gateways), "__call__") as call: @@ -6994,10 +7031,11 @@ def test_list_gateways_non_empty_request_with_auto_populated_field(): client.list_gateways(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gateway.ListGatewaysRequest( + request_msg = gateway.ListGatewaysRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_gateways_use_cached_wrapped_rpc(): @@ -7078,9 +7116,14 @@ async def test_list_gateways_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_gateways_async( - transport: str = "grpc_asyncio", request_type=gateway.ListGatewaysRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gateway.ListGatewaysRequest(), + {}, + ], +) +async def test_list_gateways_async(request_type, transport: str = "grpc_asyncio"): client = NetworkServicesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7088,7 +7131,7 @@ async def test_list_gateways_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_gateways), "__call__") as call: @@ -7113,11 +7156,6 @@ async def test_list_gateways_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_gateways_async_from_dict(): - await test_list_gateways_async(request_type=dict) - - def test_list_gateways_field_headers(): client = NetworkServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7454,8 +7492,8 @@ async def test_list_gateways_async_pages(): @pytest.mark.parametrize( "request_type", [ - gateway.GetGatewayRequest, - dict, + gateway.GetGatewayRequest(), + {}, ], ) def test_get_gateway(request_type, transport: str = "grpc"): @@ -7466,7 +7504,7 @@ def test_get_gateway(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_gateway), "__call__") as call: @@ -7538,9 +7576,10 @@ def test_get_gateway_non_empty_request_with_auto_populated_field(): client.get_gateway(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gateway.GetGatewayRequest( + request_msg = gateway.GetGatewayRequest( name="name_value", ) + assert args[0] == request_msg def test_get_gateway_use_cached_wrapped_rpc(): @@ -7621,9 +7660,14 @@ async def test_get_gateway_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_gateway_async( - transport: str = "grpc_asyncio", request_type=gateway.GetGatewayRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gateway.GetGatewayRequest(), + {}, + ], +) +async def test_get_gateway_async(request_type, transport: str = "grpc_asyncio"): client = NetworkServicesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7631,7 +7675,7 @@ async def test_get_gateway_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_gateway), "__call__") as call: @@ -7682,11 +7726,6 @@ async def test_get_gateway_async( assert response.routing_mode == gateway.Gateway.RoutingMode.NEXT_HOP_ROUTING_MODE -@pytest.mark.asyncio -async def test_get_gateway_async_from_dict(): - await test_get_gateway_async(request_type=dict) - - def test_get_gateway_field_headers(): client = NetworkServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7829,8 +7868,8 @@ async def test_get_gateway_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_gateway.CreateGatewayRequest, - dict, + gcn_gateway.CreateGatewayRequest(), + {}, ], ) def test_create_gateway(request_type, transport: str = "grpc"): @@ -7841,7 +7880,7 @@ def test_create_gateway(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_gateway), "__call__") as call: @@ -7883,10 +7922,11 @@ def test_create_gateway_non_empty_request_with_auto_populated_field(): client.create_gateway(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_gateway.CreateGatewayRequest( + request_msg = gcn_gateway.CreateGatewayRequest( parent="parent_value", gateway_id="gateway_id_value", ) + assert args[0] == request_msg def test_create_gateway_use_cached_wrapped_rpc(): @@ -7977,9 +8017,14 @@ async def test_create_gateway_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_gateway_async( - transport: str = "grpc_asyncio", request_type=gcn_gateway.CreateGatewayRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcn_gateway.CreateGatewayRequest(), + {}, + ], +) +async def test_create_gateway_async(request_type, transport: str = "grpc_asyncio"): client = NetworkServicesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7987,7 +8032,7 @@ async def test_create_gateway_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_gateway), "__call__") as call: @@ -8007,11 +8052,6 @@ async def test_create_gateway_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_gateway_async_from_dict(): - await test_create_gateway_async(request_type=dict) - - def test_create_gateway_field_headers(): client = NetworkServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8178,8 +8218,8 @@ async def test_create_gateway_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_gateway.UpdateGatewayRequest, - dict, + gcn_gateway.UpdateGatewayRequest(), + {}, ], ) def test_update_gateway(request_type, transport: str = "grpc"): @@ -8190,7 +8230,7 @@ def test_update_gateway(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_gateway), "__call__") as call: @@ -8229,7 +8269,8 @@ def test_update_gateway_non_empty_request_with_auto_populated_field(): client.update_gateway(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_gateway.UpdateGatewayRequest() + request_msg = gcn_gateway.UpdateGatewayRequest() + assert args[0] == request_msg def test_update_gateway_use_cached_wrapped_rpc(): @@ -8320,9 +8361,14 @@ async def test_update_gateway_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_gateway_async( - transport: str = "grpc_asyncio", request_type=gcn_gateway.UpdateGatewayRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcn_gateway.UpdateGatewayRequest(), + {}, + ], +) +async def test_update_gateway_async(request_type, transport: str = "grpc_asyncio"): client = NetworkServicesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8330,7 +8376,7 @@ async def test_update_gateway_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_gateway), "__call__") as call: @@ -8350,11 +8396,6 @@ async def test_update_gateway_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_gateway_async_from_dict(): - await test_update_gateway_async(request_type=dict) - - def test_update_gateway_field_headers(): client = NetworkServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8511,8 +8552,8 @@ async def test_update_gateway_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gateway.DeleteGatewayRequest, - dict, + gateway.DeleteGatewayRequest(), + {}, ], ) def test_delete_gateway(request_type, transport: str = "grpc"): @@ -8523,7 +8564,7 @@ def test_delete_gateway(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_gateway), "__call__") as call: @@ -8564,9 +8605,10 @@ def test_delete_gateway_non_empty_request_with_auto_populated_field(): client.delete_gateway(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gateway.DeleteGatewayRequest( + request_msg = gateway.DeleteGatewayRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_gateway_use_cached_wrapped_rpc(): @@ -8657,9 +8699,14 @@ async def test_delete_gateway_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_gateway_async( - transport: str = "grpc_asyncio", request_type=gateway.DeleteGatewayRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gateway.DeleteGatewayRequest(), + {}, + ], +) +async def test_delete_gateway_async(request_type, transport: str = "grpc_asyncio"): client = NetworkServicesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8667,7 +8714,7 @@ async def test_delete_gateway_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_gateway), "__call__") as call: @@ -8687,11 +8734,6 @@ async def test_delete_gateway_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_gateway_async_from_dict(): - await test_delete_gateway_async(request_type=dict) - - def test_delete_gateway_field_headers(): client = NetworkServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8838,8 +8880,8 @@ async def test_delete_gateway_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - grpc_route.ListGrpcRoutesRequest, - dict, + grpc_route.ListGrpcRoutesRequest(), + {}, ], ) def test_list_grpc_routes(request_type, transport: str = "grpc"): @@ -8850,7 +8892,7 @@ def test_list_grpc_routes(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_grpc_routes), "__call__") as call: @@ -8897,10 +8939,11 @@ def test_list_grpc_routes_non_empty_request_with_auto_populated_field(): client.list_grpc_routes(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == grpc_route.ListGrpcRoutesRequest( + request_msg = grpc_route.ListGrpcRoutesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_grpc_routes_use_cached_wrapped_rpc(): @@ -8983,9 +9026,14 @@ async def test_list_grpc_routes_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_grpc_routes_async( - transport: str = "grpc_asyncio", request_type=grpc_route.ListGrpcRoutesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + grpc_route.ListGrpcRoutesRequest(), + {}, + ], +) +async def test_list_grpc_routes_async(request_type, transport: str = "grpc_asyncio"): client = NetworkServicesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8993,7 +9041,7 @@ async def test_list_grpc_routes_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_grpc_routes), "__call__") as call: @@ -9018,11 +9066,6 @@ async def test_list_grpc_routes_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_grpc_routes_async_from_dict(): - await test_list_grpc_routes_async(request_type=dict) - - def test_list_grpc_routes_field_headers(): client = NetworkServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9359,8 +9402,8 @@ async def test_list_grpc_routes_async_pages(): @pytest.mark.parametrize( "request_type", [ - grpc_route.GetGrpcRouteRequest, - dict, + grpc_route.GetGrpcRouteRequest(), + {}, ], ) def test_get_grpc_route(request_type, transport: str = "grpc"): @@ -9371,7 +9414,7 @@ def test_get_grpc_route(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_grpc_route), "__call__") as call: @@ -9425,9 +9468,10 @@ def test_get_grpc_route_non_empty_request_with_auto_populated_field(): client.get_grpc_route(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == grpc_route.GetGrpcRouteRequest( + request_msg = grpc_route.GetGrpcRouteRequest( name="name_value", ) + assert args[0] == request_msg def test_get_grpc_route_use_cached_wrapped_rpc(): @@ -9508,9 +9552,14 @@ async def test_get_grpc_route_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_grpc_route_async( - transport: str = "grpc_asyncio", request_type=grpc_route.GetGrpcRouteRequest -): +@pytest.mark.parametrize( + "request_type", + [ + grpc_route.GetGrpcRouteRequest(), + {}, + ], +) +async def test_get_grpc_route_async(request_type, transport: str = "grpc_asyncio"): client = NetworkServicesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9518,7 +9567,7 @@ async def test_get_grpc_route_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_grpc_route), "__call__") as call: @@ -9551,11 +9600,6 @@ async def test_get_grpc_route_async( assert response.gateways == ["gateways_value"] -@pytest.mark.asyncio -async def test_get_grpc_route_async_from_dict(): - await test_get_grpc_route_async(request_type=dict) - - def test_get_grpc_route_field_headers(): client = NetworkServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9702,8 +9746,8 @@ async def test_get_grpc_route_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_grpc_route.CreateGrpcRouteRequest, - dict, + gcn_grpc_route.CreateGrpcRouteRequest(), + {}, ], ) def test_create_grpc_route(request_type, transport: str = "grpc"): @@ -9714,7 +9758,7 @@ def test_create_grpc_route(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9760,10 +9804,11 @@ def test_create_grpc_route_non_empty_request_with_auto_populated_field(): client.create_grpc_route(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_grpc_route.CreateGrpcRouteRequest( + request_msg = gcn_grpc_route.CreateGrpcRouteRequest( parent="parent_value", grpc_route_id="grpc_route_id_value", ) + assert args[0] == request_msg def test_create_grpc_route_use_cached_wrapped_rpc(): @@ -9856,9 +9901,14 @@ async def test_create_grpc_route_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_grpc_route_async( - transport: str = "grpc_asyncio", request_type=gcn_grpc_route.CreateGrpcRouteRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcn_grpc_route.CreateGrpcRouteRequest(), + {}, + ], +) +async def test_create_grpc_route_async(request_type, transport: str = "grpc_asyncio"): client = NetworkServicesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9866,7 +9916,7 @@ async def test_create_grpc_route_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( @@ -9888,11 +9938,6 @@ async def test_create_grpc_route_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_grpc_route_async_from_dict(): - await test_create_grpc_route_async(request_type=dict) - - def test_create_grpc_route_field_headers(): client = NetworkServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10067,8 +10112,8 @@ async def test_create_grpc_route_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_grpc_route.UpdateGrpcRouteRequest, - dict, + gcn_grpc_route.UpdateGrpcRouteRequest(), + {}, ], ) def test_update_grpc_route(request_type, transport: str = "grpc"): @@ -10079,7 +10124,7 @@ def test_update_grpc_route(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10122,7 +10167,8 @@ def test_update_grpc_route_non_empty_request_with_auto_populated_field(): client.update_grpc_route(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_grpc_route.UpdateGrpcRouteRequest() + request_msg = gcn_grpc_route.UpdateGrpcRouteRequest() + assert args[0] == request_msg def test_update_grpc_route_use_cached_wrapped_rpc(): @@ -10215,9 +10261,14 @@ async def test_update_grpc_route_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_grpc_route_async( - transport: str = "grpc_asyncio", request_type=gcn_grpc_route.UpdateGrpcRouteRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcn_grpc_route.UpdateGrpcRouteRequest(), + {}, + ], +) +async def test_update_grpc_route_async(request_type, transport: str = "grpc_asyncio"): client = NetworkServicesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10225,7 +10276,7 @@ async def test_update_grpc_route_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( @@ -10247,11 +10298,6 @@ async def test_update_grpc_route_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_grpc_route_async_from_dict(): - await test_update_grpc_route_async(request_type=dict) - - def test_update_grpc_route_field_headers(): client = NetworkServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10416,8 +10462,8 @@ async def test_update_grpc_route_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - grpc_route.DeleteGrpcRouteRequest, - dict, + grpc_route.DeleteGrpcRouteRequest(), + {}, ], ) def test_delete_grpc_route(request_type, transport: str = "grpc"): @@ -10428,7 +10474,7 @@ def test_delete_grpc_route(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10473,9 +10519,10 @@ def test_delete_grpc_route_non_empty_request_with_auto_populated_field(): client.delete_grpc_route(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == grpc_route.DeleteGrpcRouteRequest( + request_msg = grpc_route.DeleteGrpcRouteRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_grpc_route_use_cached_wrapped_rpc(): @@ -10568,9 +10615,14 @@ async def test_delete_grpc_route_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_grpc_route_async( - transport: str = "grpc_asyncio", request_type=grpc_route.DeleteGrpcRouteRequest -): +@pytest.mark.parametrize( + "request_type", + [ + grpc_route.DeleteGrpcRouteRequest(), + {}, + ], +) +async def test_delete_grpc_route_async(request_type, transport: str = "grpc_asyncio"): client = NetworkServicesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10578,7 +10630,7 @@ async def test_delete_grpc_route_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( @@ -10600,11 +10652,6 @@ async def test_delete_grpc_route_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_grpc_route_async_from_dict(): - await test_delete_grpc_route_async(request_type=dict) - - def test_delete_grpc_route_field_headers(): client = NetworkServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10759,8 +10806,8 @@ async def test_delete_grpc_route_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - http_route.ListHttpRoutesRequest, - dict, + http_route.ListHttpRoutesRequest(), + {}, ], ) def test_list_http_routes(request_type, transport: str = "grpc"): @@ -10771,7 +10818,7 @@ def test_list_http_routes(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_http_routes), "__call__") as call: @@ -10818,10 +10865,11 @@ def test_list_http_routes_non_empty_request_with_auto_populated_field(): client.list_http_routes(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == http_route.ListHttpRoutesRequest( + request_msg = http_route.ListHttpRoutesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_http_routes_use_cached_wrapped_rpc(): @@ -10904,9 +10952,14 @@ async def test_list_http_routes_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_http_routes_async( - transport: str = "grpc_asyncio", request_type=http_route.ListHttpRoutesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + http_route.ListHttpRoutesRequest(), + {}, + ], +) +async def test_list_http_routes_async(request_type, transport: str = "grpc_asyncio"): client = NetworkServicesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10914,7 +10967,7 @@ async def test_list_http_routes_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_http_routes), "__call__") as call: @@ -10939,11 +10992,6 @@ async def test_list_http_routes_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_http_routes_async_from_dict(): - await test_list_http_routes_async(request_type=dict) - - def test_list_http_routes_field_headers(): client = NetworkServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11280,8 +11328,8 @@ async def test_list_http_routes_async_pages(): @pytest.mark.parametrize( "request_type", [ - http_route.GetHttpRouteRequest, - dict, + http_route.GetHttpRouteRequest(), + {}, ], ) def test_get_http_route(request_type, transport: str = "grpc"): @@ -11292,7 +11340,7 @@ def test_get_http_route(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_http_route), "__call__") as call: @@ -11346,9 +11394,10 @@ def test_get_http_route_non_empty_request_with_auto_populated_field(): client.get_http_route(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == http_route.GetHttpRouteRequest( + request_msg = http_route.GetHttpRouteRequest( name="name_value", ) + assert args[0] == request_msg def test_get_http_route_use_cached_wrapped_rpc(): @@ -11429,9 +11478,14 @@ async def test_get_http_route_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_http_route_async( - transport: str = "grpc_asyncio", request_type=http_route.GetHttpRouteRequest -): +@pytest.mark.parametrize( + "request_type", + [ + http_route.GetHttpRouteRequest(), + {}, + ], +) +async def test_get_http_route_async(request_type, transport: str = "grpc_asyncio"): client = NetworkServicesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11439,7 +11493,7 @@ async def test_get_http_route_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_http_route), "__call__") as call: @@ -11472,11 +11526,6 @@ async def test_get_http_route_async( assert response.gateways == ["gateways_value"] -@pytest.mark.asyncio -async def test_get_http_route_async_from_dict(): - await test_get_http_route_async(request_type=dict) - - def test_get_http_route_field_headers(): client = NetworkServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11623,8 +11672,8 @@ async def test_get_http_route_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_http_route.CreateHttpRouteRequest, - dict, + gcn_http_route.CreateHttpRouteRequest(), + {}, ], ) def test_create_http_route(request_type, transport: str = "grpc"): @@ -11635,7 +11684,7 @@ def test_create_http_route(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11681,10 +11730,11 @@ def test_create_http_route_non_empty_request_with_auto_populated_field(): client.create_http_route(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_http_route.CreateHttpRouteRequest( + request_msg = gcn_http_route.CreateHttpRouteRequest( parent="parent_value", http_route_id="http_route_id_value", ) + assert args[0] == request_msg def test_create_http_route_use_cached_wrapped_rpc(): @@ -11777,9 +11827,14 @@ async def test_create_http_route_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_http_route_async( - transport: str = "grpc_asyncio", request_type=gcn_http_route.CreateHttpRouteRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcn_http_route.CreateHttpRouteRequest(), + {}, + ], +) +async def test_create_http_route_async(request_type, transport: str = "grpc_asyncio"): client = NetworkServicesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11787,7 +11842,7 @@ async def test_create_http_route_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( @@ -11809,11 +11864,6 @@ async def test_create_http_route_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_http_route_async_from_dict(): - await test_create_http_route_async(request_type=dict) - - def test_create_http_route_field_headers(): client = NetworkServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11988,8 +12038,8 @@ async def test_create_http_route_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_http_route.UpdateHttpRouteRequest, - dict, + gcn_http_route.UpdateHttpRouteRequest(), + {}, ], ) def test_update_http_route(request_type, transport: str = "grpc"): @@ -12000,7 +12050,7 @@ def test_update_http_route(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -12043,7 +12093,8 @@ def test_update_http_route_non_empty_request_with_auto_populated_field(): client.update_http_route(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_http_route.UpdateHttpRouteRequest() + request_msg = gcn_http_route.UpdateHttpRouteRequest() + assert args[0] == request_msg def test_update_http_route_use_cached_wrapped_rpc(): @@ -12136,9 +12187,14 @@ async def test_update_http_route_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_http_route_async( - transport: str = "grpc_asyncio", request_type=gcn_http_route.UpdateHttpRouteRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcn_http_route.UpdateHttpRouteRequest(), + {}, + ], +) +async def test_update_http_route_async(request_type, transport: str = "grpc_asyncio"): client = NetworkServicesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12146,7 +12202,7 @@ async def test_update_http_route_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( @@ -12168,11 +12224,6 @@ async def test_update_http_route_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_http_route_async_from_dict(): - await test_update_http_route_async(request_type=dict) - - def test_update_http_route_field_headers(): client = NetworkServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12337,8 +12388,8 @@ async def test_update_http_route_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - http_route.DeleteHttpRouteRequest, - dict, + http_route.DeleteHttpRouteRequest(), + {}, ], ) def test_delete_http_route(request_type, transport: str = "grpc"): @@ -12349,7 +12400,7 @@ def test_delete_http_route(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -12394,9 +12445,10 @@ def test_delete_http_route_non_empty_request_with_auto_populated_field(): client.delete_http_route(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == http_route.DeleteHttpRouteRequest( + request_msg = http_route.DeleteHttpRouteRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_http_route_use_cached_wrapped_rpc(): @@ -12489,9 +12541,14 @@ async def test_delete_http_route_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_http_route_async( - transport: str = "grpc_asyncio", request_type=http_route.DeleteHttpRouteRequest -): +@pytest.mark.parametrize( + "request_type", + [ + http_route.DeleteHttpRouteRequest(), + {}, + ], +) +async def test_delete_http_route_async(request_type, transport: str = "grpc_asyncio"): client = NetworkServicesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12499,7 +12556,7 @@ async def test_delete_http_route_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( @@ -12521,11 +12578,6 @@ async def test_delete_http_route_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_http_route_async_from_dict(): - await test_delete_http_route_async(request_type=dict) - - def test_delete_http_route_field_headers(): client = NetworkServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12680,8 +12732,8 @@ async def test_delete_http_route_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - tcp_route.ListTcpRoutesRequest, - dict, + tcp_route.ListTcpRoutesRequest(), + {}, ], ) def test_list_tcp_routes(request_type, transport: str = "grpc"): @@ -12692,7 +12744,7 @@ def test_list_tcp_routes(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tcp_routes), "__call__") as call: @@ -12739,10 +12791,11 @@ def test_list_tcp_routes_non_empty_request_with_auto_populated_field(): client.list_tcp_routes(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tcp_route.ListTcpRoutesRequest( + request_msg = tcp_route.ListTcpRoutesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_tcp_routes_use_cached_wrapped_rpc(): @@ -12823,9 +12876,14 @@ async def test_list_tcp_routes_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_tcp_routes_async( - transport: str = "grpc_asyncio", request_type=tcp_route.ListTcpRoutesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tcp_route.ListTcpRoutesRequest(), + {}, + ], +) +async def test_list_tcp_routes_async(request_type, transport: str = "grpc_asyncio"): client = NetworkServicesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12833,7 +12891,7 @@ async def test_list_tcp_routes_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_tcp_routes), "__call__") as call: @@ -12858,11 +12916,6 @@ async def test_list_tcp_routes_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_tcp_routes_async_from_dict(): - await test_list_tcp_routes_async(request_type=dict) - - def test_list_tcp_routes_field_headers(): client = NetworkServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13199,8 +13252,8 @@ async def test_list_tcp_routes_async_pages(): @pytest.mark.parametrize( "request_type", [ - tcp_route.GetTcpRouteRequest, - dict, + tcp_route.GetTcpRouteRequest(), + {}, ], ) def test_get_tcp_route(request_type, transport: str = "grpc"): @@ -13211,7 +13264,7 @@ def test_get_tcp_route(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tcp_route), "__call__") as call: @@ -13263,9 +13316,10 @@ def test_get_tcp_route_non_empty_request_with_auto_populated_field(): client.get_tcp_route(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tcp_route.GetTcpRouteRequest( + request_msg = tcp_route.GetTcpRouteRequest( name="name_value", ) + assert args[0] == request_msg def test_get_tcp_route_use_cached_wrapped_rpc(): @@ -13346,9 +13400,14 @@ async def test_get_tcp_route_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_tcp_route_async( - transport: str = "grpc_asyncio", request_type=tcp_route.GetTcpRouteRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tcp_route.GetTcpRouteRequest(), + {}, + ], +) +async def test_get_tcp_route_async(request_type, transport: str = "grpc_asyncio"): client = NetworkServicesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13356,7 +13415,7 @@ async def test_get_tcp_route_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_tcp_route), "__call__") as call: @@ -13387,11 +13446,6 @@ async def test_get_tcp_route_async( assert response.gateways == ["gateways_value"] -@pytest.mark.asyncio -async def test_get_tcp_route_async_from_dict(): - await test_get_tcp_route_async(request_type=dict) - - def test_get_tcp_route_field_headers(): client = NetworkServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13534,8 +13588,8 @@ async def test_get_tcp_route_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_tcp_route.CreateTcpRouteRequest, - dict, + gcn_tcp_route.CreateTcpRouteRequest(), + {}, ], ) def test_create_tcp_route(request_type, transport: str = "grpc"): @@ -13546,7 +13600,7 @@ def test_create_tcp_route(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tcp_route), "__call__") as call: @@ -13588,10 +13642,11 @@ def test_create_tcp_route_non_empty_request_with_auto_populated_field(): client.create_tcp_route(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_tcp_route.CreateTcpRouteRequest( + request_msg = gcn_tcp_route.CreateTcpRouteRequest( parent="parent_value", tcp_route_id="tcp_route_id_value", ) + assert args[0] == request_msg def test_create_tcp_route_use_cached_wrapped_rpc(): @@ -13684,9 +13739,14 @@ async def test_create_tcp_route_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_tcp_route_async( - transport: str = "grpc_asyncio", request_type=gcn_tcp_route.CreateTcpRouteRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcn_tcp_route.CreateTcpRouteRequest(), + {}, + ], +) +async def test_create_tcp_route_async(request_type, transport: str = "grpc_asyncio"): client = NetworkServicesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13694,7 +13754,7 @@ async def test_create_tcp_route_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_tcp_route), "__call__") as call: @@ -13714,11 +13774,6 @@ async def test_create_tcp_route_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_tcp_route_async_from_dict(): - await test_create_tcp_route_async(request_type=dict) - - def test_create_tcp_route_field_headers(): client = NetworkServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13885,8 +13940,8 @@ async def test_create_tcp_route_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_tcp_route.UpdateTcpRouteRequest, - dict, + gcn_tcp_route.UpdateTcpRouteRequest(), + {}, ], ) def test_update_tcp_route(request_type, transport: str = "grpc"): @@ -13897,7 +13952,7 @@ def test_update_tcp_route(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tcp_route), "__call__") as call: @@ -13936,7 +13991,8 @@ def test_update_tcp_route_non_empty_request_with_auto_populated_field(): client.update_tcp_route(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_tcp_route.UpdateTcpRouteRequest() + request_msg = gcn_tcp_route.UpdateTcpRouteRequest() + assert args[0] == request_msg def test_update_tcp_route_use_cached_wrapped_rpc(): @@ -14029,9 +14085,14 @@ async def test_update_tcp_route_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_tcp_route_async( - transport: str = "grpc_asyncio", request_type=gcn_tcp_route.UpdateTcpRouteRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcn_tcp_route.UpdateTcpRouteRequest(), + {}, + ], +) +async def test_update_tcp_route_async(request_type, transport: str = "grpc_asyncio"): client = NetworkServicesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14039,7 +14100,7 @@ async def test_update_tcp_route_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_tcp_route), "__call__") as call: @@ -14059,11 +14120,6 @@ async def test_update_tcp_route_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_tcp_route_async_from_dict(): - await test_update_tcp_route_async(request_type=dict) - - def test_update_tcp_route_field_headers(): client = NetworkServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14220,8 +14276,8 @@ async def test_update_tcp_route_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - tcp_route.DeleteTcpRouteRequest, - dict, + tcp_route.DeleteTcpRouteRequest(), + {}, ], ) def test_delete_tcp_route(request_type, transport: str = "grpc"): @@ -14232,7 +14288,7 @@ def test_delete_tcp_route(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tcp_route), "__call__") as call: @@ -14273,9 +14329,10 @@ def test_delete_tcp_route_non_empty_request_with_auto_populated_field(): client.delete_tcp_route(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tcp_route.DeleteTcpRouteRequest( + request_msg = tcp_route.DeleteTcpRouteRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_tcp_route_use_cached_wrapped_rpc(): @@ -14368,9 +14425,14 @@ async def test_delete_tcp_route_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_tcp_route_async( - transport: str = "grpc_asyncio", request_type=tcp_route.DeleteTcpRouteRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tcp_route.DeleteTcpRouteRequest(), + {}, + ], +) +async def test_delete_tcp_route_async(request_type, transport: str = "grpc_asyncio"): client = NetworkServicesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14378,7 +14440,7 @@ async def test_delete_tcp_route_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_tcp_route), "__call__") as call: @@ -14398,11 +14460,6 @@ async def test_delete_tcp_route_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_tcp_route_async_from_dict(): - await test_delete_tcp_route_async(request_type=dict) - - def test_delete_tcp_route_field_headers(): client = NetworkServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14549,8 +14606,8 @@ async def test_delete_tcp_route_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - tls_route.ListTlsRoutesRequest, - dict, + tls_route.ListTlsRoutesRequest(), + {}, ], ) def test_list_tls_routes(request_type, transport: str = "grpc"): @@ -14561,7 +14618,7 @@ def test_list_tls_routes(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tls_routes), "__call__") as call: @@ -14608,10 +14665,11 @@ def test_list_tls_routes_non_empty_request_with_auto_populated_field(): client.list_tls_routes(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tls_route.ListTlsRoutesRequest( + request_msg = tls_route.ListTlsRoutesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_tls_routes_use_cached_wrapped_rpc(): @@ -14692,9 +14750,14 @@ async def test_list_tls_routes_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_tls_routes_async( - transport: str = "grpc_asyncio", request_type=tls_route.ListTlsRoutesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tls_route.ListTlsRoutesRequest(), + {}, + ], +) +async def test_list_tls_routes_async(request_type, transport: str = "grpc_asyncio"): client = NetworkServicesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14702,7 +14765,7 @@ async def test_list_tls_routes_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_tls_routes), "__call__") as call: @@ -14727,11 +14790,6 @@ async def test_list_tls_routes_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_tls_routes_async_from_dict(): - await test_list_tls_routes_async(request_type=dict) - - def test_list_tls_routes_field_headers(): client = NetworkServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15068,8 +15126,8 @@ async def test_list_tls_routes_async_pages(): @pytest.mark.parametrize( "request_type", [ - tls_route.GetTlsRouteRequest, - dict, + tls_route.GetTlsRouteRequest(), + {}, ], ) def test_get_tls_route(request_type, transport: str = "grpc"): @@ -15080,7 +15138,7 @@ def test_get_tls_route(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tls_route), "__call__") as call: @@ -15132,9 +15190,10 @@ def test_get_tls_route_non_empty_request_with_auto_populated_field(): client.get_tls_route(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tls_route.GetTlsRouteRequest( + request_msg = tls_route.GetTlsRouteRequest( name="name_value", ) + assert args[0] == request_msg def test_get_tls_route_use_cached_wrapped_rpc(): @@ -15215,9 +15274,14 @@ async def test_get_tls_route_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_tls_route_async( - transport: str = "grpc_asyncio", request_type=tls_route.GetTlsRouteRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tls_route.GetTlsRouteRequest(), + {}, + ], +) +async def test_get_tls_route_async(request_type, transport: str = "grpc_asyncio"): client = NetworkServicesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -15225,7 +15289,7 @@ async def test_get_tls_route_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_tls_route), "__call__") as call: @@ -15256,11 +15320,6 @@ async def test_get_tls_route_async( assert response.gateways == ["gateways_value"] -@pytest.mark.asyncio -async def test_get_tls_route_async_from_dict(): - await test_get_tls_route_async(request_type=dict) - - def test_get_tls_route_field_headers(): client = NetworkServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15403,8 +15462,8 @@ async def test_get_tls_route_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_tls_route.CreateTlsRouteRequest, - dict, + gcn_tls_route.CreateTlsRouteRequest(), + {}, ], ) def test_create_tls_route(request_type, transport: str = "grpc"): @@ -15415,7 +15474,7 @@ def test_create_tls_route(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tls_route), "__call__") as call: @@ -15457,10 +15516,11 @@ def test_create_tls_route_non_empty_request_with_auto_populated_field(): client.create_tls_route(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_tls_route.CreateTlsRouteRequest( + request_msg = gcn_tls_route.CreateTlsRouteRequest( parent="parent_value", tls_route_id="tls_route_id_value", ) + assert args[0] == request_msg def test_create_tls_route_use_cached_wrapped_rpc(): @@ -15553,9 +15613,14 @@ async def test_create_tls_route_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_tls_route_async( - transport: str = "grpc_asyncio", request_type=gcn_tls_route.CreateTlsRouteRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcn_tls_route.CreateTlsRouteRequest(), + {}, + ], +) +async def test_create_tls_route_async(request_type, transport: str = "grpc_asyncio"): client = NetworkServicesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -15563,7 +15628,7 @@ async def test_create_tls_route_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_tls_route), "__call__") as call: @@ -15583,11 +15648,6 @@ async def test_create_tls_route_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_tls_route_async_from_dict(): - await test_create_tls_route_async(request_type=dict) - - def test_create_tls_route_field_headers(): client = NetworkServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15754,8 +15814,8 @@ async def test_create_tls_route_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_tls_route.UpdateTlsRouteRequest, - dict, + gcn_tls_route.UpdateTlsRouteRequest(), + {}, ], ) def test_update_tls_route(request_type, transport: str = "grpc"): @@ -15766,7 +15826,7 @@ def test_update_tls_route(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tls_route), "__call__") as call: @@ -15805,7 +15865,8 @@ def test_update_tls_route_non_empty_request_with_auto_populated_field(): client.update_tls_route(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_tls_route.UpdateTlsRouteRequest() + request_msg = gcn_tls_route.UpdateTlsRouteRequest() + assert args[0] == request_msg def test_update_tls_route_use_cached_wrapped_rpc(): @@ -15898,9 +15959,14 @@ async def test_update_tls_route_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_tls_route_async( - transport: str = "grpc_asyncio", request_type=gcn_tls_route.UpdateTlsRouteRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcn_tls_route.UpdateTlsRouteRequest(), + {}, + ], +) +async def test_update_tls_route_async(request_type, transport: str = "grpc_asyncio"): client = NetworkServicesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -15908,7 +15974,7 @@ async def test_update_tls_route_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_tls_route), "__call__") as call: @@ -15928,11 +15994,6 @@ async def test_update_tls_route_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_tls_route_async_from_dict(): - await test_update_tls_route_async(request_type=dict) - - def test_update_tls_route_field_headers(): client = NetworkServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16089,8 +16150,8 @@ async def test_update_tls_route_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - tls_route.DeleteTlsRouteRequest, - dict, + tls_route.DeleteTlsRouteRequest(), + {}, ], ) def test_delete_tls_route(request_type, transport: str = "grpc"): @@ -16101,7 +16162,7 @@ def test_delete_tls_route(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tls_route), "__call__") as call: @@ -16142,9 +16203,10 @@ def test_delete_tls_route_non_empty_request_with_auto_populated_field(): client.delete_tls_route(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tls_route.DeleteTlsRouteRequest( + request_msg = tls_route.DeleteTlsRouteRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_tls_route_use_cached_wrapped_rpc(): @@ -16237,9 +16299,14 @@ async def test_delete_tls_route_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_tls_route_async( - transport: str = "grpc_asyncio", request_type=tls_route.DeleteTlsRouteRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tls_route.DeleteTlsRouteRequest(), + {}, + ], +) +async def test_delete_tls_route_async(request_type, transport: str = "grpc_asyncio"): client = NetworkServicesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -16247,7 +16314,7 @@ async def test_delete_tls_route_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_tls_route), "__call__") as call: @@ -16267,11 +16334,6 @@ async def test_delete_tls_route_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_tls_route_async_from_dict(): - await test_delete_tls_route_async(request_type=dict) - - def test_delete_tls_route_field_headers(): client = NetworkServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16418,8 +16480,8 @@ async def test_delete_tls_route_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service_binding.ListServiceBindingsRequest, - dict, + service_binding.ListServiceBindingsRequest(), + {}, ], ) def test_list_service_bindings(request_type, transport: str = "grpc"): @@ -16430,7 +16492,7 @@ def test_list_service_bindings(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -16481,10 +16543,11 @@ def test_list_service_bindings_non_empty_request_with_auto_populated_field(): client.list_service_bindings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service_binding.ListServiceBindingsRequest( + request_msg = service_binding.ListServiceBindingsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_service_bindings_use_cached_wrapped_rpc(): @@ -16570,9 +16633,15 @@ async def test_list_service_bindings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service_binding.ListServiceBindingsRequest(), + {}, + ], +) async def test_list_service_bindings_async( - transport: str = "grpc_asyncio", - request_type=service_binding.ListServiceBindingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkServicesAsyncClient( credentials=async_anonymous_credentials(), @@ -16581,7 +16650,7 @@ async def test_list_service_bindings_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( @@ -16608,11 +16677,6 @@ async def test_list_service_bindings_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_service_bindings_async_from_dict(): - await test_list_service_bindings_async(request_type=dict) - - def test_list_service_bindings_field_headers(): client = NetworkServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16965,8 +17029,8 @@ async def test_list_service_bindings_async_pages(): @pytest.mark.parametrize( "request_type", [ - service_binding.GetServiceBindingRequest, - dict, + service_binding.GetServiceBindingRequest(), + {}, ], ) def test_get_service_binding(request_type, transport: str = "grpc"): @@ -16977,7 +17041,7 @@ def test_get_service_binding(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -17031,9 +17095,10 @@ def test_get_service_binding_non_empty_request_with_auto_populated_field(): client.get_service_binding(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service_binding.GetServiceBindingRequest( + request_msg = service_binding.GetServiceBindingRequest( name="name_value", ) + assert args[0] == request_msg def test_get_service_binding_use_cached_wrapped_rpc(): @@ -17118,10 +17183,14 @@ async def test_get_service_binding_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_service_binding_async( - transport: str = "grpc_asyncio", - request_type=service_binding.GetServiceBindingRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + service_binding.GetServiceBindingRequest(), + {}, + ], +) +async def test_get_service_binding_async(request_type, transport: str = "grpc_asyncio"): client = NetworkServicesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -17129,7 +17198,7 @@ async def test_get_service_binding_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( @@ -17160,11 +17229,6 @@ async def test_get_service_binding_async( assert response.service_id == "service_id_value" -@pytest.mark.asyncio -async def test_get_service_binding_async_from_dict(): - await test_get_service_binding_async(request_type=dict) - - def test_get_service_binding_field_headers(): client = NetworkServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17319,8 +17383,8 @@ async def test_get_service_binding_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_service_binding.CreateServiceBindingRequest, - dict, + gcn_service_binding.CreateServiceBindingRequest(), + {}, ], ) def test_create_service_binding(request_type, transport: str = "grpc"): @@ -17331,7 +17395,7 @@ def test_create_service_binding(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -17377,10 +17441,11 @@ def test_create_service_binding_non_empty_request_with_auto_populated_field(): client.create_service_binding(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_service_binding.CreateServiceBindingRequest( + request_msg = gcn_service_binding.CreateServiceBindingRequest( parent="parent_value", service_binding_id="service_binding_id_value", ) + assert args[0] == request_msg def test_create_service_binding_use_cached_wrapped_rpc(): @@ -17476,9 +17541,15 @@ async def test_create_service_binding_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcn_service_binding.CreateServiceBindingRequest(), + {}, + ], +) async def test_create_service_binding_async( - transport: str = "grpc_asyncio", - request_type=gcn_service_binding.CreateServiceBindingRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkServicesAsyncClient( credentials=async_anonymous_credentials(), @@ -17487,7 +17558,7 @@ async def test_create_service_binding_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( @@ -17509,11 +17580,6 @@ async def test_create_service_binding_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_service_binding_async_from_dict(): - await test_create_service_binding_async(request_type=dict) - - def test_create_service_binding_field_headers(): client = NetworkServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17688,8 +17754,8 @@ async def test_create_service_binding_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_service_binding.UpdateServiceBindingRequest, - dict, + gcn_service_binding.UpdateServiceBindingRequest(), + {}, ], ) def test_update_service_binding(request_type, transport: str = "grpc"): @@ -17700,7 +17766,7 @@ def test_update_service_binding(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -17743,7 +17809,8 @@ def test_update_service_binding_non_empty_request_with_auto_populated_field(): client.update_service_binding(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_service_binding.UpdateServiceBindingRequest() + request_msg = gcn_service_binding.UpdateServiceBindingRequest() + assert args[0] == request_msg def test_update_service_binding_use_cached_wrapped_rpc(): @@ -17839,9 +17906,15 @@ async def test_update_service_binding_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcn_service_binding.UpdateServiceBindingRequest(), + {}, + ], +) async def test_update_service_binding_async( - transport: str = "grpc_asyncio", - request_type=gcn_service_binding.UpdateServiceBindingRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkServicesAsyncClient( credentials=async_anonymous_credentials(), @@ -17850,7 +17923,7 @@ async def test_update_service_binding_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( @@ -17872,11 +17945,6 @@ async def test_update_service_binding_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_service_binding_async_from_dict(): - await test_update_service_binding_async(request_type=dict) - - def test_update_service_binding_field_headers(): client = NetworkServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18041,8 +18109,8 @@ async def test_update_service_binding_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service_binding.DeleteServiceBindingRequest, - dict, + service_binding.DeleteServiceBindingRequest(), + {}, ], ) def test_delete_service_binding(request_type, transport: str = "grpc"): @@ -18053,7 +18121,7 @@ def test_delete_service_binding(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -18098,9 +18166,10 @@ def test_delete_service_binding_non_empty_request_with_auto_populated_field(): client.delete_service_binding(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service_binding.DeleteServiceBindingRequest( + request_msg = service_binding.DeleteServiceBindingRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_service_binding_use_cached_wrapped_rpc(): @@ -18196,9 +18265,15 @@ async def test_delete_service_binding_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service_binding.DeleteServiceBindingRequest(), + {}, + ], +) async def test_delete_service_binding_async( - transport: str = "grpc_asyncio", - request_type=service_binding.DeleteServiceBindingRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkServicesAsyncClient( credentials=async_anonymous_credentials(), @@ -18207,7 +18282,7 @@ async def test_delete_service_binding_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( @@ -18229,11 +18304,6 @@ async def test_delete_service_binding_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_service_binding_async_from_dict(): - await test_delete_service_binding_async(request_type=dict) - - def test_delete_service_binding_field_headers(): client = NetworkServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18388,8 +18458,8 @@ async def test_delete_service_binding_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - mesh.ListMeshesRequest, - dict, + mesh.ListMeshesRequest(), + {}, ], ) def test_list_meshes(request_type, transport: str = "grpc"): @@ -18400,7 +18470,7 @@ def test_list_meshes(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_meshes), "__call__") as call: @@ -18447,10 +18517,11 @@ def test_list_meshes_non_empty_request_with_auto_populated_field(): client.list_meshes(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == mesh.ListMeshesRequest( + request_msg = mesh.ListMeshesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_meshes_use_cached_wrapped_rpc(): @@ -18531,9 +18602,14 @@ async def test_list_meshes_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_meshes_async( - transport: str = "grpc_asyncio", request_type=mesh.ListMeshesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + mesh.ListMeshesRequest(), + {}, + ], +) +async def test_list_meshes_async(request_type, transport: str = "grpc_asyncio"): client = NetworkServicesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -18541,7 +18617,7 @@ async def test_list_meshes_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_meshes), "__call__") as call: @@ -18566,11 +18642,6 @@ async def test_list_meshes_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_meshes_async_from_dict(): - await test_list_meshes_async(request_type=dict) - - def test_list_meshes_field_headers(): client = NetworkServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18907,8 +18978,8 @@ async def test_list_meshes_async_pages(): @pytest.mark.parametrize( "request_type", [ - mesh.GetMeshRequest, - dict, + mesh.GetMeshRequest(), + {}, ], ) def test_get_mesh(request_type, transport: str = "grpc"): @@ -18919,7 +18990,7 @@ def test_get_mesh(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_mesh), "__call__") as call: @@ -18971,9 +19042,10 @@ def test_get_mesh_non_empty_request_with_auto_populated_field(): client.get_mesh(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == mesh.GetMeshRequest( + request_msg = mesh.GetMeshRequest( name="name_value", ) + assert args[0] == request_msg def test_get_mesh_use_cached_wrapped_rpc(): @@ -19052,9 +19124,14 @@ async def test_get_mesh_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn @pytest.mark.asyncio -async def test_get_mesh_async( - transport: str = "grpc_asyncio", request_type=mesh.GetMeshRequest -): +@pytest.mark.parametrize( + "request_type", + [ + mesh.GetMeshRequest(), + {}, + ], +) +async def test_get_mesh_async(request_type, transport: str = "grpc_asyncio"): client = NetworkServicesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -19062,7 +19139,7 @@ async def test_get_mesh_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_mesh), "__call__") as call: @@ -19093,11 +19170,6 @@ async def test_get_mesh_async( assert response.envoy_headers == common.EnvoyHeaders.NONE -@pytest.mark.asyncio -async def test_get_mesh_async_from_dict(): - await test_get_mesh_async(request_type=dict) - - def test_get_mesh_field_headers(): client = NetworkServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -19240,8 +19312,8 @@ async def test_get_mesh_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_mesh.CreateMeshRequest, - dict, + gcn_mesh.CreateMeshRequest(), + {}, ], ) def test_create_mesh(request_type, transport: str = "grpc"): @@ -19252,7 +19324,7 @@ def test_create_mesh(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_mesh), "__call__") as call: @@ -19294,10 +19366,11 @@ def test_create_mesh_non_empty_request_with_auto_populated_field(): client.create_mesh(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_mesh.CreateMeshRequest( + request_msg = gcn_mesh.CreateMeshRequest( parent="parent_value", mesh_id="mesh_id_value", ) + assert args[0] == request_msg def test_create_mesh_use_cached_wrapped_rpc(): @@ -19388,9 +19461,14 @@ async def test_create_mesh_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_mesh_async( - transport: str = "grpc_asyncio", request_type=gcn_mesh.CreateMeshRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcn_mesh.CreateMeshRequest(), + {}, + ], +) +async def test_create_mesh_async(request_type, transport: str = "grpc_asyncio"): client = NetworkServicesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -19398,7 +19476,7 @@ async def test_create_mesh_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_mesh), "__call__") as call: @@ -19418,11 +19496,6 @@ async def test_create_mesh_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_mesh_async_from_dict(): - await test_create_mesh_async(request_type=dict) - - def test_create_mesh_field_headers(): client = NetworkServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -19589,8 +19662,8 @@ async def test_create_mesh_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_mesh.UpdateMeshRequest, - dict, + gcn_mesh.UpdateMeshRequest(), + {}, ], ) def test_update_mesh(request_type, transport: str = "grpc"): @@ -19601,7 +19674,7 @@ def test_update_mesh(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_mesh), "__call__") as call: @@ -19640,7 +19713,8 @@ def test_update_mesh_non_empty_request_with_auto_populated_field(): client.update_mesh(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_mesh.UpdateMeshRequest() + request_msg = gcn_mesh.UpdateMeshRequest() + assert args[0] == request_msg def test_update_mesh_use_cached_wrapped_rpc(): @@ -19731,9 +19805,14 @@ async def test_update_mesh_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_mesh_async( - transport: str = "grpc_asyncio", request_type=gcn_mesh.UpdateMeshRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcn_mesh.UpdateMeshRequest(), + {}, + ], +) +async def test_update_mesh_async(request_type, transport: str = "grpc_asyncio"): client = NetworkServicesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -19741,7 +19820,7 @@ async def test_update_mesh_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_mesh), "__call__") as call: @@ -19761,11 +19840,6 @@ async def test_update_mesh_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_mesh_async_from_dict(): - await test_update_mesh_async(request_type=dict) - - def test_update_mesh_field_headers(): client = NetworkServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -19922,8 +19996,8 @@ async def test_update_mesh_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - mesh.DeleteMeshRequest, - dict, + mesh.DeleteMeshRequest(), + {}, ], ) def test_delete_mesh(request_type, transport: str = "grpc"): @@ -19934,7 +20008,7 @@ def test_delete_mesh(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_mesh), "__call__") as call: @@ -19975,9 +20049,10 @@ def test_delete_mesh_non_empty_request_with_auto_populated_field(): client.delete_mesh(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == mesh.DeleteMeshRequest( + request_msg = mesh.DeleteMeshRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_mesh_use_cached_wrapped_rpc(): @@ -20068,9 +20143,14 @@ async def test_delete_mesh_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_mesh_async( - transport: str = "grpc_asyncio", request_type=mesh.DeleteMeshRequest -): +@pytest.mark.parametrize( + "request_type", + [ + mesh.DeleteMeshRequest(), + {}, + ], +) +async def test_delete_mesh_async(request_type, transport: str = "grpc_asyncio"): client = NetworkServicesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -20078,7 +20158,7 @@ async def test_delete_mesh_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_mesh), "__call__") as call: @@ -20098,11 +20178,6 @@ async def test_delete_mesh_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_mesh_async_from_dict(): - await test_delete_mesh_async(request_type=dict) - - def test_delete_mesh_field_headers(): client = NetworkServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -20249,8 +20324,8 @@ async def test_delete_mesh_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service_lb_policy.ListServiceLbPoliciesRequest, - dict, + service_lb_policy.ListServiceLbPoliciesRequest(), + {}, ], ) def test_list_service_lb_policies(request_type, transport: str = "grpc"): @@ -20261,7 +20336,7 @@ def test_list_service_lb_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( @@ -20312,10 +20387,11 @@ def test_list_service_lb_policies_non_empty_request_with_auto_populated_field(): client.list_service_lb_policies(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service_lb_policy.ListServiceLbPoliciesRequest( + request_msg = service_lb_policy.ListServiceLbPoliciesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_service_lb_policies_use_cached_wrapped_rpc(): @@ -20401,9 +20477,15 @@ async def test_list_service_lb_policies_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service_lb_policy.ListServiceLbPoliciesRequest(), + {}, + ], +) async def test_list_service_lb_policies_async( - transport: str = "grpc_asyncio", - request_type=service_lb_policy.ListServiceLbPoliciesRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkServicesAsyncClient( credentials=async_anonymous_credentials(), @@ -20412,7 +20494,7 @@ async def test_list_service_lb_policies_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( @@ -20439,11 +20521,6 @@ async def test_list_service_lb_policies_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_service_lb_policies_async_from_dict(): - await test_list_service_lb_policies_async(request_type=dict) - - def test_list_service_lb_policies_field_headers(): client = NetworkServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -20798,8 +20875,8 @@ async def test_list_service_lb_policies_async_pages(): @pytest.mark.parametrize( "request_type", [ - service_lb_policy.GetServiceLbPolicyRequest, - dict, + service_lb_policy.GetServiceLbPolicyRequest(), + {}, ], ) def test_get_service_lb_policy(request_type, transport: str = "grpc"): @@ -20810,7 +20887,7 @@ def test_get_service_lb_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( @@ -20865,9 +20942,10 @@ def test_get_service_lb_policy_non_empty_request_with_auto_populated_field(): client.get_service_lb_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service_lb_policy.GetServiceLbPolicyRequest( + request_msg = service_lb_policy.GetServiceLbPolicyRequest( name="name_value", ) + assert args[0] == request_msg def test_get_service_lb_policy_use_cached_wrapped_rpc(): @@ -20953,9 +21031,15 @@ async def test_get_service_lb_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service_lb_policy.GetServiceLbPolicyRequest(), + {}, + ], +) async def test_get_service_lb_policy_async( - transport: str = "grpc_asyncio", - request_type=service_lb_policy.GetServiceLbPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkServicesAsyncClient( credentials=async_anonymous_credentials(), @@ -20964,7 +21048,7 @@ async def test_get_service_lb_policy_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( @@ -20996,11 +21080,6 @@ async def test_get_service_lb_policy_async( ) -@pytest.mark.asyncio -async def test_get_service_lb_policy_async_from_dict(): - await test_get_service_lb_policy_async(request_type=dict) - - def test_get_service_lb_policy_field_headers(): client = NetworkServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -21155,8 +21234,8 @@ async def test_get_service_lb_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_service_lb_policy.CreateServiceLbPolicyRequest, - dict, + gcn_service_lb_policy.CreateServiceLbPolicyRequest(), + {}, ], ) def test_create_service_lb_policy(request_type, transport: str = "grpc"): @@ -21167,7 +21246,7 @@ def test_create_service_lb_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( @@ -21213,10 +21292,11 @@ def test_create_service_lb_policy_non_empty_request_with_auto_populated_field(): client.create_service_lb_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_service_lb_policy.CreateServiceLbPolicyRequest( + request_msg = gcn_service_lb_policy.CreateServiceLbPolicyRequest( parent="parent_value", service_lb_policy_id="service_lb_policy_id_value", ) + assert args[0] == request_msg def test_create_service_lb_policy_use_cached_wrapped_rpc(): @@ -21312,9 +21392,15 @@ async def test_create_service_lb_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcn_service_lb_policy.CreateServiceLbPolicyRequest(), + {}, + ], +) async def test_create_service_lb_policy_async( - transport: str = "grpc_asyncio", - request_type=gcn_service_lb_policy.CreateServiceLbPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkServicesAsyncClient( credentials=async_anonymous_credentials(), @@ -21323,7 +21409,7 @@ async def test_create_service_lb_policy_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( @@ -21345,11 +21431,6 @@ async def test_create_service_lb_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_service_lb_policy_async_from_dict(): - await test_create_service_lb_policy_async(request_type=dict) - - def test_create_service_lb_policy_field_headers(): client = NetworkServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -21524,8 +21605,8 @@ async def test_create_service_lb_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcn_service_lb_policy.UpdateServiceLbPolicyRequest, - dict, + gcn_service_lb_policy.UpdateServiceLbPolicyRequest(), + {}, ], ) def test_update_service_lb_policy(request_type, transport: str = "grpc"): @@ -21536,7 +21617,7 @@ def test_update_service_lb_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( @@ -21579,7 +21660,8 @@ def test_update_service_lb_policy_non_empty_request_with_auto_populated_field(): client.update_service_lb_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcn_service_lb_policy.UpdateServiceLbPolicyRequest() + request_msg = gcn_service_lb_policy.UpdateServiceLbPolicyRequest() + assert args[0] == request_msg def test_update_service_lb_policy_use_cached_wrapped_rpc(): @@ -21675,9 +21757,15 @@ async def test_update_service_lb_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcn_service_lb_policy.UpdateServiceLbPolicyRequest(), + {}, + ], +) async def test_update_service_lb_policy_async( - transport: str = "grpc_asyncio", - request_type=gcn_service_lb_policy.UpdateServiceLbPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkServicesAsyncClient( credentials=async_anonymous_credentials(), @@ -21686,7 +21774,7 @@ async def test_update_service_lb_policy_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( @@ -21708,11 +21796,6 @@ async def test_update_service_lb_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_service_lb_policy_async_from_dict(): - await test_update_service_lb_policy_async(request_type=dict) - - def test_update_service_lb_policy_field_headers(): client = NetworkServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -21877,8 +21960,8 @@ async def test_update_service_lb_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service_lb_policy.DeleteServiceLbPolicyRequest, - dict, + service_lb_policy.DeleteServiceLbPolicyRequest(), + {}, ], ) def test_delete_service_lb_policy(request_type, transport: str = "grpc"): @@ -21889,7 +21972,7 @@ def test_delete_service_lb_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( @@ -21934,9 +22017,10 @@ def test_delete_service_lb_policy_non_empty_request_with_auto_populated_field(): client.delete_service_lb_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service_lb_policy.DeleteServiceLbPolicyRequest( + request_msg = service_lb_policy.DeleteServiceLbPolicyRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_service_lb_policy_use_cached_wrapped_rpc(): @@ -22032,9 +22116,15 @@ async def test_delete_service_lb_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service_lb_policy.DeleteServiceLbPolicyRequest(), + {}, + ], +) async def test_delete_service_lb_policy_async( - transport: str = "grpc_asyncio", - request_type=service_lb_policy.DeleteServiceLbPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkServicesAsyncClient( credentials=async_anonymous_credentials(), @@ -22043,7 +22133,7 @@ async def test_delete_service_lb_policy_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( @@ -22065,11 +22155,6 @@ async def test_delete_service_lb_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_service_lb_policy_async_from_dict(): - await test_delete_service_lb_policy_async(request_type=dict) - - def test_delete_service_lb_policy_field_headers(): client = NetworkServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -22224,8 +22309,8 @@ async def test_delete_service_lb_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - route_view.GetGatewayRouteViewRequest, - dict, + route_view.GetGatewayRouteViewRequest(), + {}, ], ) def test_get_gateway_route_view(request_type, transport: str = "grpc"): @@ -22236,7 +22321,7 @@ def test_get_gateway_route_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( @@ -22292,9 +22377,10 @@ def test_get_gateway_route_view_non_empty_request_with_auto_populated_field(): client.get_gateway_route_view(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == route_view.GetGatewayRouteViewRequest( + request_msg = route_view.GetGatewayRouteViewRequest( name="name_value", ) + assert args[0] == request_msg def test_get_gateway_route_view_use_cached_wrapped_rpc(): @@ -22380,8 +22466,15 @@ async def test_get_gateway_route_view_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + route_view.GetGatewayRouteViewRequest(), + {}, + ], +) async def test_get_gateway_route_view_async( - transport: str = "grpc_asyncio", request_type=route_view.GetGatewayRouteViewRequest + request_type, transport: str = "grpc_asyncio" ): client = NetworkServicesAsyncClient( credentials=async_anonymous_credentials(), @@ -22390,7 +22483,7 @@ async def test_get_gateway_route_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( @@ -22423,11 +22516,6 @@ async def test_get_gateway_route_view_async( assert response.route_id == "route_id_value" -@pytest.mark.asyncio -async def test_get_gateway_route_view_async_from_dict(): - await test_get_gateway_route_view_async(request_type=dict) - - def test_get_gateway_route_view_field_headers(): client = NetworkServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -22582,8 +22670,8 @@ async def test_get_gateway_route_view_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - route_view.GetMeshRouteViewRequest, - dict, + route_view.GetMeshRouteViewRequest(), + {}, ], ) def test_get_mesh_route_view(request_type, transport: str = "grpc"): @@ -22594,7 +22682,7 @@ def test_get_mesh_route_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( @@ -22650,9 +22738,10 @@ def test_get_mesh_route_view_non_empty_request_with_auto_populated_field(): client.get_mesh_route_view(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == route_view.GetMeshRouteViewRequest( + request_msg = route_view.GetMeshRouteViewRequest( name="name_value", ) + assert args[0] == request_msg def test_get_mesh_route_view_use_cached_wrapped_rpc(): @@ -22737,9 +22826,14 @@ async def test_get_mesh_route_view_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_mesh_route_view_async( - transport: str = "grpc_asyncio", request_type=route_view.GetMeshRouteViewRequest -): +@pytest.mark.parametrize( + "request_type", + [ + route_view.GetMeshRouteViewRequest(), + {}, + ], +) +async def test_get_mesh_route_view_async(request_type, transport: str = "grpc_asyncio"): client = NetworkServicesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -22747,7 +22841,7 @@ async def test_get_mesh_route_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( @@ -22780,11 +22874,6 @@ async def test_get_mesh_route_view_async( assert response.route_id == "route_id_value" -@pytest.mark.asyncio -async def test_get_mesh_route_view_async_from_dict(): - await test_get_mesh_route_view_async(request_type=dict) - - def test_get_mesh_route_view_field_headers(): client = NetworkServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -22939,8 +23028,8 @@ async def test_get_mesh_route_view_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - route_view.ListGatewayRouteViewsRequest, - dict, + route_view.ListGatewayRouteViewsRequest(), + {}, ], ) def test_list_gateway_route_views(request_type, transport: str = "grpc"): @@ -22951,7 +23040,7 @@ def test_list_gateway_route_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( @@ -23002,10 +23091,11 @@ def test_list_gateway_route_views_non_empty_request_with_auto_populated_field(): client.list_gateway_route_views(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == route_view.ListGatewayRouteViewsRequest( + request_msg = route_view.ListGatewayRouteViewsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_gateway_route_views_use_cached_wrapped_rpc(): @@ -23091,9 +23181,15 @@ async def test_list_gateway_route_views_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + route_view.ListGatewayRouteViewsRequest(), + {}, + ], +) async def test_list_gateway_route_views_async( - transport: str = "grpc_asyncio", - request_type=route_view.ListGatewayRouteViewsRequest, + request_type, transport: str = "grpc_asyncio" ): client = NetworkServicesAsyncClient( credentials=async_anonymous_credentials(), @@ -23102,7 +23198,7 @@ async def test_list_gateway_route_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( @@ -23129,11 +23225,6 @@ async def test_list_gateway_route_views_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_gateway_route_views_async_from_dict(): - await test_list_gateway_route_views_async(request_type=dict) - - def test_list_gateway_route_views_field_headers(): client = NetworkServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -23488,8 +23579,8 @@ async def test_list_gateway_route_views_async_pages(): @pytest.mark.parametrize( "request_type", [ - route_view.ListMeshRouteViewsRequest, - dict, + route_view.ListMeshRouteViewsRequest(), + {}, ], ) def test_list_mesh_route_views(request_type, transport: str = "grpc"): @@ -23500,7 +23591,7 @@ def test_list_mesh_route_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( @@ -23551,10 +23642,11 @@ def test_list_mesh_route_views_non_empty_request_with_auto_populated_field(): client.list_mesh_route_views(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == route_view.ListMeshRouteViewsRequest( + request_msg = route_view.ListMeshRouteViewsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_mesh_route_views_use_cached_wrapped_rpc(): @@ -23640,8 +23732,15 @@ async def test_list_mesh_route_views_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + route_view.ListMeshRouteViewsRequest(), + {}, + ], +) async def test_list_mesh_route_views_async( - transport: str = "grpc_asyncio", request_type=route_view.ListMeshRouteViewsRequest + request_type, transport: str = "grpc_asyncio" ): client = NetworkServicesAsyncClient( credentials=async_anonymous_credentials(), @@ -23650,7 +23749,7 @@ async def test_list_mesh_route_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( @@ -23677,11 +23776,6 @@ async def test_list_mesh_route_views_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_mesh_route_views_async_from_dict(): - await test_list_mesh_route_views_async(request_type=dict) - - def test_list_mesh_route_views_field_headers(): client = NetworkServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -35990,7 +36084,6 @@ def test_list_endpoint_policies_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = endpoint_policy.ListEndpointPoliciesRequest() - assert args[0] == request_msg @@ -36013,7 +36106,6 @@ def test_get_endpoint_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = endpoint_policy.GetEndpointPolicyRequest() - assert args[0] == request_msg @@ -36036,7 +36128,6 @@ def test_create_endpoint_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_endpoint_policy.CreateEndpointPolicyRequest() - assert args[0] == request_msg @@ -36059,7 +36150,6 @@ def test_update_endpoint_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_endpoint_policy.UpdateEndpointPolicyRequest() - assert args[0] == request_msg @@ -36082,7 +36172,6 @@ def test_delete_endpoint_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = endpoint_policy.DeleteEndpointPolicyRequest() - assert args[0] == request_msg @@ -36105,7 +36194,6 @@ def test_list_wasm_plugin_versions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = extensibility.ListWasmPluginVersionsRequest() - assert args[0] == request_msg @@ -36128,7 +36216,6 @@ def test_get_wasm_plugin_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = extensibility.GetWasmPluginVersionRequest() - assert args[0] == request_msg @@ -36151,7 +36238,6 @@ def test_create_wasm_plugin_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = extensibility.CreateWasmPluginVersionRequest() - assert args[0] == request_msg @@ -36174,7 +36260,6 @@ def test_delete_wasm_plugin_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = extensibility.DeleteWasmPluginVersionRequest() - assert args[0] == request_msg @@ -36197,7 +36282,6 @@ def test_list_wasm_plugins_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = extensibility.ListWasmPluginsRequest() - assert args[0] == request_msg @@ -36218,7 +36302,6 @@ def test_get_wasm_plugin_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = extensibility.GetWasmPluginRequest() - assert args[0] == request_msg @@ -36241,7 +36324,6 @@ def test_create_wasm_plugin_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = extensibility.CreateWasmPluginRequest() - assert args[0] == request_msg @@ -36264,7 +36346,6 @@ def test_update_wasm_plugin_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = extensibility.UpdateWasmPluginRequest() - assert args[0] == request_msg @@ -36287,7 +36368,6 @@ def test_delete_wasm_plugin_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = extensibility.DeleteWasmPluginRequest() - assert args[0] == request_msg @@ -36308,7 +36388,6 @@ def test_list_gateways_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gateway.ListGatewaysRequest() - assert args[0] == request_msg @@ -36329,7 +36408,6 @@ def test_get_gateway_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gateway.GetGatewayRequest() - assert args[0] == request_msg @@ -36350,7 +36428,6 @@ def test_create_gateway_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_gateway.CreateGatewayRequest() - assert args[0] == request_msg @@ -36371,7 +36448,6 @@ def test_update_gateway_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_gateway.UpdateGatewayRequest() - assert args[0] == request_msg @@ -36392,7 +36468,6 @@ def test_delete_gateway_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gateway.DeleteGatewayRequest() - assert args[0] == request_msg @@ -36413,7 +36488,6 @@ def test_list_grpc_routes_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = grpc_route.ListGrpcRoutesRequest() - assert args[0] == request_msg @@ -36434,7 +36508,6 @@ def test_get_grpc_route_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = grpc_route.GetGrpcRouteRequest() - assert args[0] == request_msg @@ -36457,7 +36530,6 @@ def test_create_grpc_route_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_grpc_route.CreateGrpcRouteRequest() - assert args[0] == request_msg @@ -36480,7 +36552,6 @@ def test_update_grpc_route_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_grpc_route.UpdateGrpcRouteRequest() - assert args[0] == request_msg @@ -36503,7 +36574,6 @@ def test_delete_grpc_route_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = grpc_route.DeleteGrpcRouteRequest() - assert args[0] == request_msg @@ -36524,7 +36594,6 @@ def test_list_http_routes_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = http_route.ListHttpRoutesRequest() - assert args[0] == request_msg @@ -36545,7 +36614,6 @@ def test_get_http_route_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = http_route.GetHttpRouteRequest() - assert args[0] == request_msg @@ -36568,7 +36636,6 @@ def test_create_http_route_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_http_route.CreateHttpRouteRequest() - assert args[0] == request_msg @@ -36591,7 +36658,6 @@ def test_update_http_route_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_http_route.UpdateHttpRouteRequest() - assert args[0] == request_msg @@ -36614,7 +36680,6 @@ def test_delete_http_route_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = http_route.DeleteHttpRouteRequest() - assert args[0] == request_msg @@ -36635,7 +36700,6 @@ def test_list_tcp_routes_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tcp_route.ListTcpRoutesRequest() - assert args[0] == request_msg @@ -36656,7 +36720,6 @@ def test_get_tcp_route_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tcp_route.GetTcpRouteRequest() - assert args[0] == request_msg @@ -36677,7 +36740,6 @@ def test_create_tcp_route_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_tcp_route.CreateTcpRouteRequest() - assert args[0] == request_msg @@ -36698,7 +36760,6 @@ def test_update_tcp_route_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_tcp_route.UpdateTcpRouteRequest() - assert args[0] == request_msg @@ -36719,7 +36780,6 @@ def test_delete_tcp_route_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tcp_route.DeleteTcpRouteRequest() - assert args[0] == request_msg @@ -36740,7 +36800,6 @@ def test_list_tls_routes_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tls_route.ListTlsRoutesRequest() - assert args[0] == request_msg @@ -36761,7 +36820,6 @@ def test_get_tls_route_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tls_route.GetTlsRouteRequest() - assert args[0] == request_msg @@ -36782,7 +36840,6 @@ def test_create_tls_route_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_tls_route.CreateTlsRouteRequest() - assert args[0] == request_msg @@ -36803,7 +36860,6 @@ def test_update_tls_route_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_tls_route.UpdateTlsRouteRequest() - assert args[0] == request_msg @@ -36824,7 +36880,6 @@ def test_delete_tls_route_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tls_route.DeleteTlsRouteRequest() - assert args[0] == request_msg @@ -36847,7 +36902,6 @@ def test_list_service_bindings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service_binding.ListServiceBindingsRequest() - assert args[0] == request_msg @@ -36870,7 +36924,6 @@ def test_get_service_binding_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service_binding.GetServiceBindingRequest() - assert args[0] == request_msg @@ -36893,7 +36946,6 @@ def test_create_service_binding_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_service_binding.CreateServiceBindingRequest() - assert args[0] == request_msg @@ -36916,7 +36968,6 @@ def test_update_service_binding_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_service_binding.UpdateServiceBindingRequest() - assert args[0] == request_msg @@ -36939,7 +36990,6 @@ def test_delete_service_binding_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service_binding.DeleteServiceBindingRequest() - assert args[0] == request_msg @@ -36960,7 +37010,6 @@ def test_list_meshes_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mesh.ListMeshesRequest() - assert args[0] == request_msg @@ -36981,7 +37030,6 @@ def test_get_mesh_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mesh.GetMeshRequest() - assert args[0] == request_msg @@ -37002,7 +37050,6 @@ def test_create_mesh_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_mesh.CreateMeshRequest() - assert args[0] == request_msg @@ -37023,7 +37070,6 @@ def test_update_mesh_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_mesh.UpdateMeshRequest() - assert args[0] == request_msg @@ -37044,7 +37090,6 @@ def test_delete_mesh_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mesh.DeleteMeshRequest() - assert args[0] == request_msg @@ -37067,7 +37112,6 @@ def test_list_service_lb_policies_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service_lb_policy.ListServiceLbPoliciesRequest() - assert args[0] == request_msg @@ -37090,7 +37134,6 @@ def test_get_service_lb_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service_lb_policy.GetServiceLbPolicyRequest() - assert args[0] == request_msg @@ -37113,7 +37156,6 @@ def test_create_service_lb_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_service_lb_policy.CreateServiceLbPolicyRequest() - assert args[0] == request_msg @@ -37136,7 +37178,6 @@ def test_update_service_lb_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_service_lb_policy.UpdateServiceLbPolicyRequest() - assert args[0] == request_msg @@ -37159,7 +37200,6 @@ def test_delete_service_lb_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service_lb_policy.DeleteServiceLbPolicyRequest() - assert args[0] == request_msg @@ -37182,7 +37222,6 @@ def test_get_gateway_route_view_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = route_view.GetGatewayRouteViewRequest() - assert args[0] == request_msg @@ -37205,7 +37244,6 @@ def test_get_mesh_route_view_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = route_view.GetMeshRouteViewRequest() - assert args[0] == request_msg @@ -37228,7 +37266,6 @@ def test_list_gateway_route_views_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = route_view.ListGatewayRouteViewsRequest() - assert args[0] == request_msg @@ -37251,7 +37288,6 @@ def test_list_mesh_route_views_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = route_view.ListMeshRouteViewsRequest() - assert args[0] == request_msg @@ -37295,7 +37331,6 @@ async def test_list_endpoint_policies_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = endpoint_policy.ListEndpointPoliciesRequest() - assert args[0] == request_msg @@ -37329,7 +37364,6 @@ async def test_get_endpoint_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = endpoint_policy.GetEndpointPolicyRequest() - assert args[0] == request_msg @@ -37356,7 +37390,6 @@ async def test_create_endpoint_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_endpoint_policy.CreateEndpointPolicyRequest() - assert args[0] == request_msg @@ -37383,7 +37416,6 @@ async def test_update_endpoint_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_endpoint_policy.UpdateEndpointPolicyRequest() - assert args[0] == request_msg @@ -37410,7 +37442,6 @@ async def test_delete_endpoint_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = endpoint_policy.DeleteEndpointPolicyRequest() - assert args[0] == request_msg @@ -37440,7 +37471,6 @@ async def test_list_wasm_plugin_versions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = extensibility.ListWasmPluginVersionsRequest() - assert args[0] == request_msg @@ -37473,7 +37503,6 @@ async def test_get_wasm_plugin_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = extensibility.GetWasmPluginVersionRequest() - assert args[0] == request_msg @@ -37500,7 +37529,6 @@ async def test_create_wasm_plugin_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = extensibility.CreateWasmPluginVersionRequest() - assert args[0] == request_msg @@ -37527,7 +37555,6 @@ async def test_delete_wasm_plugin_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = extensibility.DeleteWasmPluginVersionRequest() - assert args[0] == request_msg @@ -37557,7 +37584,6 @@ async def test_list_wasm_plugins_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = extensibility.ListWasmPluginsRequest() - assert args[0] == request_msg @@ -37586,7 +37612,6 @@ async def test_get_wasm_plugin_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = extensibility.GetWasmPluginRequest() - assert args[0] == request_msg @@ -37613,7 +37638,6 @@ async def test_create_wasm_plugin_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = extensibility.CreateWasmPluginRequest() - assert args[0] == request_msg @@ -37640,7 +37664,6 @@ async def test_update_wasm_plugin_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = extensibility.UpdateWasmPluginRequest() - assert args[0] == request_msg @@ -37667,7 +37690,6 @@ async def test_delete_wasm_plugin_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = extensibility.DeleteWasmPluginRequest() - assert args[0] == request_msg @@ -37695,7 +37717,6 @@ async def test_list_gateways_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gateway.ListGatewaysRequest() - assert args[0] == request_msg @@ -37736,7 +37757,6 @@ async def test_get_gateway_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gateway.GetGatewayRequest() - assert args[0] == request_msg @@ -37761,7 +37781,6 @@ async def test_create_gateway_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_gateway.CreateGatewayRequest() - assert args[0] == request_msg @@ -37786,7 +37805,6 @@ async def test_update_gateway_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_gateway.UpdateGatewayRequest() - assert args[0] == request_msg @@ -37811,7 +37829,6 @@ async def test_delete_gateway_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gateway.DeleteGatewayRequest() - assert args[0] == request_msg @@ -37839,7 +37856,6 @@ async def test_list_grpc_routes_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = grpc_route.ListGrpcRoutesRequest() - assert args[0] == request_msg @@ -37871,7 +37887,6 @@ async def test_get_grpc_route_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = grpc_route.GetGrpcRouteRequest() - assert args[0] == request_msg @@ -37898,7 +37913,6 @@ async def test_create_grpc_route_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_grpc_route.CreateGrpcRouteRequest() - assert args[0] == request_msg @@ -37925,7 +37939,6 @@ async def test_update_grpc_route_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_grpc_route.UpdateGrpcRouteRequest() - assert args[0] == request_msg @@ -37952,7 +37965,6 @@ async def test_delete_grpc_route_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = grpc_route.DeleteGrpcRouteRequest() - assert args[0] == request_msg @@ -37980,7 +37992,6 @@ async def test_list_http_routes_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = http_route.ListHttpRoutesRequest() - assert args[0] == request_msg @@ -38012,7 +38023,6 @@ async def test_get_http_route_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = http_route.GetHttpRouteRequest() - assert args[0] == request_msg @@ -38039,7 +38049,6 @@ async def test_create_http_route_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_http_route.CreateHttpRouteRequest() - assert args[0] == request_msg @@ -38066,7 +38075,6 @@ async def test_update_http_route_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_http_route.UpdateHttpRouteRequest() - assert args[0] == request_msg @@ -38093,7 +38101,6 @@ async def test_delete_http_route_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = http_route.DeleteHttpRouteRequest() - assert args[0] == request_msg @@ -38121,7 +38128,6 @@ async def test_list_tcp_routes_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tcp_route.ListTcpRoutesRequest() - assert args[0] == request_msg @@ -38152,7 +38158,6 @@ async def test_get_tcp_route_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tcp_route.GetTcpRouteRequest() - assert args[0] == request_msg @@ -38177,7 +38182,6 @@ async def test_create_tcp_route_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_tcp_route.CreateTcpRouteRequest() - assert args[0] == request_msg @@ -38202,7 +38206,6 @@ async def test_update_tcp_route_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_tcp_route.UpdateTcpRouteRequest() - assert args[0] == request_msg @@ -38227,7 +38230,6 @@ async def test_delete_tcp_route_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tcp_route.DeleteTcpRouteRequest() - assert args[0] == request_msg @@ -38255,7 +38257,6 @@ async def test_list_tls_routes_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tls_route.ListTlsRoutesRequest() - assert args[0] == request_msg @@ -38286,7 +38287,6 @@ async def test_get_tls_route_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tls_route.GetTlsRouteRequest() - assert args[0] == request_msg @@ -38311,7 +38311,6 @@ async def test_create_tls_route_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_tls_route.CreateTlsRouteRequest() - assert args[0] == request_msg @@ -38336,7 +38335,6 @@ async def test_update_tls_route_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_tls_route.UpdateTlsRouteRequest() - assert args[0] == request_msg @@ -38361,7 +38359,6 @@ async def test_delete_tls_route_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tls_route.DeleteTlsRouteRequest() - assert args[0] == request_msg @@ -38391,7 +38388,6 @@ async def test_list_service_bindings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service_binding.ListServiceBindingsRequest() - assert args[0] == request_msg @@ -38423,7 +38419,6 @@ async def test_get_service_binding_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service_binding.GetServiceBindingRequest() - assert args[0] == request_msg @@ -38450,7 +38445,6 @@ async def test_create_service_binding_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_service_binding.CreateServiceBindingRequest() - assert args[0] == request_msg @@ -38477,7 +38471,6 @@ async def test_update_service_binding_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_service_binding.UpdateServiceBindingRequest() - assert args[0] == request_msg @@ -38504,7 +38497,6 @@ async def test_delete_service_binding_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service_binding.DeleteServiceBindingRequest() - assert args[0] == request_msg @@ -38532,7 +38524,6 @@ async def test_list_meshes_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mesh.ListMeshesRequest() - assert args[0] == request_msg @@ -38563,7 +38554,6 @@ async def test_get_mesh_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mesh.GetMeshRequest() - assert args[0] == request_msg @@ -38588,7 +38578,6 @@ async def test_create_mesh_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_mesh.CreateMeshRequest() - assert args[0] == request_msg @@ -38613,7 +38602,6 @@ async def test_update_mesh_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_mesh.UpdateMeshRequest() - assert args[0] == request_msg @@ -38638,7 +38626,6 @@ async def test_delete_mesh_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mesh.DeleteMeshRequest() - assert args[0] == request_msg @@ -38668,7 +38655,6 @@ async def test_list_service_lb_policies_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service_lb_policy.ListServiceLbPoliciesRequest() - assert args[0] == request_msg @@ -38699,7 +38685,6 @@ async def test_get_service_lb_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service_lb_policy.GetServiceLbPolicyRequest() - assert args[0] == request_msg @@ -38726,7 +38711,6 @@ async def test_create_service_lb_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_service_lb_policy.CreateServiceLbPolicyRequest() - assert args[0] == request_msg @@ -38753,7 +38737,6 @@ async def test_update_service_lb_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_service_lb_policy.UpdateServiceLbPolicyRequest() - assert args[0] == request_msg @@ -38780,7 +38763,6 @@ async def test_delete_service_lb_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service_lb_policy.DeleteServiceLbPolicyRequest() - assert args[0] == request_msg @@ -38813,7 +38795,6 @@ async def test_get_gateway_route_view_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = route_view.GetGatewayRouteViewRequest() - assert args[0] == request_msg @@ -38846,7 +38827,6 @@ async def test_get_mesh_route_view_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = route_view.GetMeshRouteViewRequest() - assert args[0] == request_msg @@ -38876,7 +38856,6 @@ async def test_list_gateway_route_views_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = route_view.ListGatewayRouteViewsRequest() - assert args[0] == request_msg @@ -38906,7 +38885,6 @@ async def test_list_mesh_route_views_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = route_view.ListMeshRouteViewsRequest() - assert args[0] == request_msg @@ -49235,7 +49213,6 @@ def test_list_endpoint_policies_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = endpoint_policy.ListEndpointPoliciesRequest() - assert args[0] == request_msg @@ -49257,7 +49234,6 @@ def test_get_endpoint_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = endpoint_policy.GetEndpointPolicyRequest() - assert args[0] == request_msg @@ -49279,7 +49255,6 @@ def test_create_endpoint_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_endpoint_policy.CreateEndpointPolicyRequest() - assert args[0] == request_msg @@ -49301,7 +49276,6 @@ def test_update_endpoint_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_endpoint_policy.UpdateEndpointPolicyRequest() - assert args[0] == request_msg @@ -49323,7 +49297,6 @@ def test_delete_endpoint_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = endpoint_policy.DeleteEndpointPolicyRequest() - assert args[0] == request_msg @@ -49345,7 +49318,6 @@ def test_list_wasm_plugin_versions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = extensibility.ListWasmPluginVersionsRequest() - assert args[0] == request_msg @@ -49367,7 +49339,6 @@ def test_get_wasm_plugin_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = extensibility.GetWasmPluginVersionRequest() - assert args[0] == request_msg @@ -49389,7 +49360,6 @@ def test_create_wasm_plugin_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = extensibility.CreateWasmPluginVersionRequest() - assert args[0] == request_msg @@ -49411,7 +49381,6 @@ def test_delete_wasm_plugin_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = extensibility.DeleteWasmPluginVersionRequest() - assert args[0] == request_msg @@ -49433,7 +49402,6 @@ def test_list_wasm_plugins_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = extensibility.ListWasmPluginsRequest() - assert args[0] == request_msg @@ -49453,7 +49421,6 @@ def test_get_wasm_plugin_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = extensibility.GetWasmPluginRequest() - assert args[0] == request_msg @@ -49475,7 +49442,6 @@ def test_create_wasm_plugin_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = extensibility.CreateWasmPluginRequest() - assert args[0] == request_msg @@ -49497,7 +49463,6 @@ def test_update_wasm_plugin_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = extensibility.UpdateWasmPluginRequest() - assert args[0] == request_msg @@ -49519,7 +49484,6 @@ def test_delete_wasm_plugin_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = extensibility.DeleteWasmPluginRequest() - assert args[0] == request_msg @@ -49539,7 +49503,6 @@ def test_list_gateways_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gateway.ListGatewaysRequest() - assert args[0] == request_msg @@ -49559,7 +49522,6 @@ def test_get_gateway_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gateway.GetGatewayRequest() - assert args[0] == request_msg @@ -49579,7 +49541,6 @@ def test_create_gateway_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_gateway.CreateGatewayRequest() - assert args[0] == request_msg @@ -49599,7 +49560,6 @@ def test_update_gateway_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_gateway.UpdateGatewayRequest() - assert args[0] == request_msg @@ -49619,7 +49579,6 @@ def test_delete_gateway_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gateway.DeleteGatewayRequest() - assert args[0] == request_msg @@ -49639,7 +49598,6 @@ def test_list_grpc_routes_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = grpc_route.ListGrpcRoutesRequest() - assert args[0] == request_msg @@ -49659,7 +49617,6 @@ def test_get_grpc_route_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = grpc_route.GetGrpcRouteRequest() - assert args[0] == request_msg @@ -49681,7 +49638,6 @@ def test_create_grpc_route_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_grpc_route.CreateGrpcRouteRequest() - assert args[0] == request_msg @@ -49703,7 +49659,6 @@ def test_update_grpc_route_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_grpc_route.UpdateGrpcRouteRequest() - assert args[0] == request_msg @@ -49725,7 +49680,6 @@ def test_delete_grpc_route_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = grpc_route.DeleteGrpcRouteRequest() - assert args[0] == request_msg @@ -49745,7 +49699,6 @@ def test_list_http_routes_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = http_route.ListHttpRoutesRequest() - assert args[0] == request_msg @@ -49765,7 +49718,6 @@ def test_get_http_route_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = http_route.GetHttpRouteRequest() - assert args[0] == request_msg @@ -49787,7 +49739,6 @@ def test_create_http_route_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_http_route.CreateHttpRouteRequest() - assert args[0] == request_msg @@ -49809,7 +49760,6 @@ def test_update_http_route_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_http_route.UpdateHttpRouteRequest() - assert args[0] == request_msg @@ -49831,7 +49781,6 @@ def test_delete_http_route_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = http_route.DeleteHttpRouteRequest() - assert args[0] == request_msg @@ -49851,7 +49800,6 @@ def test_list_tcp_routes_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tcp_route.ListTcpRoutesRequest() - assert args[0] == request_msg @@ -49871,7 +49819,6 @@ def test_get_tcp_route_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tcp_route.GetTcpRouteRequest() - assert args[0] == request_msg @@ -49891,7 +49838,6 @@ def test_create_tcp_route_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_tcp_route.CreateTcpRouteRequest() - assert args[0] == request_msg @@ -49911,7 +49857,6 @@ def test_update_tcp_route_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_tcp_route.UpdateTcpRouteRequest() - assert args[0] == request_msg @@ -49931,7 +49876,6 @@ def test_delete_tcp_route_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tcp_route.DeleteTcpRouteRequest() - assert args[0] == request_msg @@ -49951,7 +49895,6 @@ def test_list_tls_routes_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tls_route.ListTlsRoutesRequest() - assert args[0] == request_msg @@ -49971,7 +49914,6 @@ def test_get_tls_route_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tls_route.GetTlsRouteRequest() - assert args[0] == request_msg @@ -49991,7 +49933,6 @@ def test_create_tls_route_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_tls_route.CreateTlsRouteRequest() - assert args[0] == request_msg @@ -50011,7 +49952,6 @@ def test_update_tls_route_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_tls_route.UpdateTlsRouteRequest() - assert args[0] == request_msg @@ -50031,7 +49971,6 @@ def test_delete_tls_route_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tls_route.DeleteTlsRouteRequest() - assert args[0] == request_msg @@ -50053,7 +49992,6 @@ def test_list_service_bindings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service_binding.ListServiceBindingsRequest() - assert args[0] == request_msg @@ -50075,7 +50013,6 @@ def test_get_service_binding_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service_binding.GetServiceBindingRequest() - assert args[0] == request_msg @@ -50097,7 +50034,6 @@ def test_create_service_binding_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_service_binding.CreateServiceBindingRequest() - assert args[0] == request_msg @@ -50119,7 +50055,6 @@ def test_update_service_binding_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_service_binding.UpdateServiceBindingRequest() - assert args[0] == request_msg @@ -50141,7 +50076,6 @@ def test_delete_service_binding_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service_binding.DeleteServiceBindingRequest() - assert args[0] == request_msg @@ -50161,7 +50095,6 @@ def test_list_meshes_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mesh.ListMeshesRequest() - assert args[0] == request_msg @@ -50181,7 +50114,6 @@ def test_get_mesh_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mesh.GetMeshRequest() - assert args[0] == request_msg @@ -50201,7 +50133,6 @@ def test_create_mesh_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_mesh.CreateMeshRequest() - assert args[0] == request_msg @@ -50221,7 +50152,6 @@ def test_update_mesh_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_mesh.UpdateMeshRequest() - assert args[0] == request_msg @@ -50241,7 +50171,6 @@ def test_delete_mesh_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = mesh.DeleteMeshRequest() - assert args[0] == request_msg @@ -50263,7 +50192,6 @@ def test_list_service_lb_policies_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service_lb_policy.ListServiceLbPoliciesRequest() - assert args[0] == request_msg @@ -50285,7 +50213,6 @@ def test_get_service_lb_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service_lb_policy.GetServiceLbPolicyRequest() - assert args[0] == request_msg @@ -50307,7 +50234,6 @@ def test_create_service_lb_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_service_lb_policy.CreateServiceLbPolicyRequest() - assert args[0] == request_msg @@ -50329,7 +50255,6 @@ def test_update_service_lb_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcn_service_lb_policy.UpdateServiceLbPolicyRequest() - assert args[0] == request_msg @@ -50351,7 +50276,6 @@ def test_delete_service_lb_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service_lb_policy.DeleteServiceLbPolicyRequest() - assert args[0] == request_msg @@ -50373,7 +50297,6 @@ def test_get_gateway_route_view_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = route_view.GetGatewayRouteViewRequest() - assert args[0] == request_msg @@ -50395,7 +50318,6 @@ def test_get_mesh_route_view_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = route_view.GetMeshRouteViewRequest() - assert args[0] == request_msg @@ -50417,7 +50339,6 @@ def test_list_gateway_route_views_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = route_view.ListGatewayRouteViewsRequest() - assert args[0] == request_msg @@ -50439,7 +50360,6 @@ def test_list_mesh_route_views_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = route_view.ListMeshRouteViewsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-notebooks/noxfile.py b/packages/google-cloud-notebooks/noxfile.py index e8de460c9672..215850a5af4b 100644 --- a/packages/google-cloud-notebooks/noxfile.py +++ b/packages/google-cloud-notebooks/noxfile.py @@ -47,7 +47,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-notebooks" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-notebooks/setup.py b/packages/google-cloud-notebooks/setup.py index 0620f5372848..1d4d559b4a37 100644 --- a/packages/google-cloud-notebooks/setup.py +++ b/packages/google-cloud-notebooks/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/google-cloud-notebooks/testing/constraints-3.10.txt b/packages/google-cloud-notebooks/testing/constraints-3.10.txt index a92801e1c8e2..b39cd54634f9 100644 --- a/packages/google-cloud-notebooks/testing/constraints-3.10.txt +++ b/packages/google-cloud-notebooks/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/google-cloud-notebooks/tests/unit/gapic/notebooks_v1/test_managed_notebook_service.py b/packages/google-cloud-notebooks/tests/unit/gapic/notebooks_v1/test_managed_notebook_service.py index 7a6bac275bc1..fe7a75835244 100644 --- a/packages/google-cloud-notebooks/tests/unit/gapic/notebooks_v1/test_managed_notebook_service.py +++ b/packages/google-cloud-notebooks/tests/unit/gapic/notebooks_v1/test_managed_notebook_service.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 @@ -126,6 +127,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" @@ -1355,8 +1371,8 @@ def test_managed_notebook_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - managed_service.ListRuntimesRequest, - dict, + managed_service.ListRuntimesRequest(), + {}, ], ) def test_list_runtimes(request_type, transport: str = "grpc"): @@ -1367,7 +1383,7 @@ def test_list_runtimes(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_runtimes), "__call__") as call: @@ -1414,10 +1430,11 @@ def test_list_runtimes_non_empty_request_with_auto_populated_field(): client.list_runtimes(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == managed_service.ListRuntimesRequest( + request_msg = managed_service.ListRuntimesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_runtimes_use_cached_wrapped_rpc(): @@ -1498,9 +1515,14 @@ async def test_list_runtimes_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_runtimes_async( - transport: str = "grpc_asyncio", request_type=managed_service.ListRuntimesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + managed_service.ListRuntimesRequest(), + {}, + ], +) +async def test_list_runtimes_async(request_type, transport: str = "grpc_asyncio"): client = ManagedNotebookServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1508,7 +1530,7 @@ async def test_list_runtimes_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_runtimes), "__call__") as call: @@ -1533,11 +1555,6 @@ async def test_list_runtimes_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_runtimes_async_from_dict(): - await test_list_runtimes_async(request_type=dict) - - def test_list_runtimes_field_headers(): client = ManagedNotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1874,8 +1891,8 @@ async def test_list_runtimes_async_pages(): @pytest.mark.parametrize( "request_type", [ - managed_service.GetRuntimeRequest, - dict, + managed_service.GetRuntimeRequest(), + {}, ], ) def test_get_runtime(request_type, transport: str = "grpc"): @@ -1886,7 +1903,7 @@ def test_get_runtime(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_runtime), "__call__") as call: @@ -1934,9 +1951,10 @@ def test_get_runtime_non_empty_request_with_auto_populated_field(): client.get_runtime(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == managed_service.GetRuntimeRequest( + request_msg = managed_service.GetRuntimeRequest( name="name_value", ) + assert args[0] == request_msg def test_get_runtime_use_cached_wrapped_rpc(): @@ -2017,9 +2035,14 @@ async def test_get_runtime_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_runtime_async( - transport: str = "grpc_asyncio", request_type=managed_service.GetRuntimeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + managed_service.GetRuntimeRequest(), + {}, + ], +) +async def test_get_runtime_async(request_type, transport: str = "grpc_asyncio"): client = ManagedNotebookServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2027,7 +2050,7 @@ async def test_get_runtime_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_runtime), "__call__") as call: @@ -2054,11 +2077,6 @@ async def test_get_runtime_async( assert response.health_state == runtime.Runtime.HealthState.HEALTHY -@pytest.mark.asyncio -async def test_get_runtime_async_from_dict(): - await test_get_runtime_async(request_type=dict) - - def test_get_runtime_field_headers(): client = ManagedNotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2201,8 +2219,8 @@ async def test_get_runtime_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - managed_service.CreateRuntimeRequest, - dict, + managed_service.CreateRuntimeRequest(), + {}, ], ) def test_create_runtime(request_type, transport: str = "grpc"): @@ -2213,7 +2231,7 @@ def test_create_runtime(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_runtime), "__call__") as call: @@ -2256,11 +2274,12 @@ def test_create_runtime_non_empty_request_with_auto_populated_field(): client.create_runtime(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == managed_service.CreateRuntimeRequest( + request_msg = managed_service.CreateRuntimeRequest( parent="parent_value", runtime_id="runtime_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_runtime_use_cached_wrapped_rpc(): @@ -2351,9 +2370,14 @@ async def test_create_runtime_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_runtime_async( - transport: str = "grpc_asyncio", request_type=managed_service.CreateRuntimeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + managed_service.CreateRuntimeRequest(), + {}, + ], +) +async def test_create_runtime_async(request_type, transport: str = "grpc_asyncio"): client = ManagedNotebookServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2361,7 +2385,7 @@ async def test_create_runtime_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_runtime), "__call__") as call: @@ -2381,11 +2405,6 @@ async def test_create_runtime_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_runtime_async_from_dict(): - await test_create_runtime_async(request_type=dict) - - def test_create_runtime_field_headers(): client = ManagedNotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2552,8 +2571,8 @@ async def test_create_runtime_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - managed_service.UpdateRuntimeRequest, - dict, + managed_service.UpdateRuntimeRequest(), + {}, ], ) def test_update_runtime(request_type, transport: str = "grpc"): @@ -2564,7 +2583,7 @@ def test_update_runtime(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_runtime), "__call__") as call: @@ -2605,9 +2624,10 @@ def test_update_runtime_non_empty_request_with_auto_populated_field(): client.update_runtime(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == managed_service.UpdateRuntimeRequest( + request_msg = managed_service.UpdateRuntimeRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_runtime_use_cached_wrapped_rpc(): @@ -2698,9 +2718,14 @@ async def test_update_runtime_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_runtime_async( - transport: str = "grpc_asyncio", request_type=managed_service.UpdateRuntimeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + managed_service.UpdateRuntimeRequest(), + {}, + ], +) +async def test_update_runtime_async(request_type, transport: str = "grpc_asyncio"): client = ManagedNotebookServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2708,7 +2733,7 @@ async def test_update_runtime_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_runtime), "__call__") as call: @@ -2728,11 +2753,6 @@ async def test_update_runtime_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_runtime_async_from_dict(): - await test_update_runtime_async(request_type=dict) - - def test_update_runtime_field_headers(): client = ManagedNotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2889,8 +2909,8 @@ async def test_update_runtime_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - managed_service.DeleteRuntimeRequest, - dict, + managed_service.DeleteRuntimeRequest(), + {}, ], ) def test_delete_runtime(request_type, transport: str = "grpc"): @@ -2901,7 +2921,7 @@ def test_delete_runtime(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_runtime), "__call__") as call: @@ -2943,10 +2963,11 @@ def test_delete_runtime_non_empty_request_with_auto_populated_field(): client.delete_runtime(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == managed_service.DeleteRuntimeRequest( + request_msg = managed_service.DeleteRuntimeRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_runtime_use_cached_wrapped_rpc(): @@ -3037,9 +3058,14 @@ async def test_delete_runtime_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_runtime_async( - transport: str = "grpc_asyncio", request_type=managed_service.DeleteRuntimeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + managed_service.DeleteRuntimeRequest(), + {}, + ], +) +async def test_delete_runtime_async(request_type, transport: str = "grpc_asyncio"): client = ManagedNotebookServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3047,7 +3073,7 @@ async def test_delete_runtime_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_runtime), "__call__") as call: @@ -3067,11 +3093,6 @@ async def test_delete_runtime_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_runtime_async_from_dict(): - await test_delete_runtime_async(request_type=dict) - - def test_delete_runtime_field_headers(): client = ManagedNotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3218,8 +3239,8 @@ async def test_delete_runtime_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - managed_service.StartRuntimeRequest, - dict, + managed_service.StartRuntimeRequest(), + {}, ], ) def test_start_runtime(request_type, transport: str = "grpc"): @@ -3230,7 +3251,7 @@ def test_start_runtime(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.start_runtime), "__call__") as call: @@ -3272,10 +3293,11 @@ def test_start_runtime_non_empty_request_with_auto_populated_field(): client.start_runtime(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == managed_service.StartRuntimeRequest( + request_msg = managed_service.StartRuntimeRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_start_runtime_use_cached_wrapped_rpc(): @@ -3366,9 +3388,14 @@ async def test_start_runtime_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_start_runtime_async( - transport: str = "grpc_asyncio", request_type=managed_service.StartRuntimeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + managed_service.StartRuntimeRequest(), + {}, + ], +) +async def test_start_runtime_async(request_type, transport: str = "grpc_asyncio"): client = ManagedNotebookServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3376,7 +3403,7 @@ async def test_start_runtime_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.start_runtime), "__call__") as call: @@ -3396,11 +3423,6 @@ async def test_start_runtime_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_start_runtime_async_from_dict(): - await test_start_runtime_async(request_type=dict) - - def test_start_runtime_field_headers(): client = ManagedNotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3547,8 +3569,8 @@ async def test_start_runtime_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - managed_service.StopRuntimeRequest, - dict, + managed_service.StopRuntimeRequest(), + {}, ], ) def test_stop_runtime(request_type, transport: str = "grpc"): @@ -3559,7 +3581,7 @@ def test_stop_runtime(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.stop_runtime), "__call__") as call: @@ -3601,10 +3623,11 @@ def test_stop_runtime_non_empty_request_with_auto_populated_field(): client.stop_runtime(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == managed_service.StopRuntimeRequest( + request_msg = managed_service.StopRuntimeRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_stop_runtime_use_cached_wrapped_rpc(): @@ -3695,9 +3718,14 @@ async def test_stop_runtime_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_stop_runtime_async( - transport: str = "grpc_asyncio", request_type=managed_service.StopRuntimeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + managed_service.StopRuntimeRequest(), + {}, + ], +) +async def test_stop_runtime_async(request_type, transport: str = "grpc_asyncio"): client = ManagedNotebookServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3705,7 +3733,7 @@ async def test_stop_runtime_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.stop_runtime), "__call__") as call: @@ -3725,11 +3753,6 @@ async def test_stop_runtime_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_stop_runtime_async_from_dict(): - await test_stop_runtime_async(request_type=dict) - - def test_stop_runtime_field_headers(): client = ManagedNotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3876,8 +3899,8 @@ async def test_stop_runtime_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - managed_service.SwitchRuntimeRequest, - dict, + managed_service.SwitchRuntimeRequest(), + {}, ], ) def test_switch_runtime(request_type, transport: str = "grpc"): @@ -3888,7 +3911,7 @@ def test_switch_runtime(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.switch_runtime), "__call__") as call: @@ -3931,11 +3954,12 @@ def test_switch_runtime_non_empty_request_with_auto_populated_field(): client.switch_runtime(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == managed_service.SwitchRuntimeRequest( + request_msg = managed_service.SwitchRuntimeRequest( name="name_value", machine_type="machine_type_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_switch_runtime_use_cached_wrapped_rpc(): @@ -4026,9 +4050,14 @@ async def test_switch_runtime_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_switch_runtime_async( - transport: str = "grpc_asyncio", request_type=managed_service.SwitchRuntimeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + managed_service.SwitchRuntimeRequest(), + {}, + ], +) +async def test_switch_runtime_async(request_type, transport: str = "grpc_asyncio"): client = ManagedNotebookServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4036,7 +4065,7 @@ async def test_switch_runtime_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.switch_runtime), "__call__") as call: @@ -4056,11 +4085,6 @@ async def test_switch_runtime_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_switch_runtime_async_from_dict(): - await test_switch_runtime_async(request_type=dict) - - def test_switch_runtime_field_headers(): client = ManagedNotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4207,8 +4231,8 @@ async def test_switch_runtime_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - managed_service.ResetRuntimeRequest, - dict, + managed_service.ResetRuntimeRequest(), + {}, ], ) def test_reset_runtime(request_type, transport: str = "grpc"): @@ -4219,7 +4243,7 @@ def test_reset_runtime(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.reset_runtime), "__call__") as call: @@ -4261,10 +4285,11 @@ def test_reset_runtime_non_empty_request_with_auto_populated_field(): client.reset_runtime(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == managed_service.ResetRuntimeRequest( + request_msg = managed_service.ResetRuntimeRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_reset_runtime_use_cached_wrapped_rpc(): @@ -4355,9 +4380,14 @@ async def test_reset_runtime_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_reset_runtime_async( - transport: str = "grpc_asyncio", request_type=managed_service.ResetRuntimeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + managed_service.ResetRuntimeRequest(), + {}, + ], +) +async def test_reset_runtime_async(request_type, transport: str = "grpc_asyncio"): client = ManagedNotebookServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4365,7 +4395,7 @@ async def test_reset_runtime_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.reset_runtime), "__call__") as call: @@ -4385,11 +4415,6 @@ async def test_reset_runtime_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_reset_runtime_async_from_dict(): - await test_reset_runtime_async(request_type=dict) - - def test_reset_runtime_field_headers(): client = ManagedNotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4536,8 +4561,8 @@ async def test_reset_runtime_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - managed_service.UpgradeRuntimeRequest, - dict, + managed_service.UpgradeRuntimeRequest(), + {}, ], ) def test_upgrade_runtime(request_type, transport: str = "grpc"): @@ -4548,7 +4573,7 @@ def test_upgrade_runtime(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.upgrade_runtime), "__call__") as call: @@ -4590,10 +4615,11 @@ def test_upgrade_runtime_non_empty_request_with_auto_populated_field(): client.upgrade_runtime(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == managed_service.UpgradeRuntimeRequest( + request_msg = managed_service.UpgradeRuntimeRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_upgrade_runtime_use_cached_wrapped_rpc(): @@ -4684,9 +4710,14 @@ async def test_upgrade_runtime_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_upgrade_runtime_async( - transport: str = "grpc_asyncio", request_type=managed_service.UpgradeRuntimeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + managed_service.UpgradeRuntimeRequest(), + {}, + ], +) +async def test_upgrade_runtime_async(request_type, transport: str = "grpc_asyncio"): client = ManagedNotebookServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4694,7 +4725,7 @@ async def test_upgrade_runtime_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.upgrade_runtime), "__call__") as call: @@ -4714,11 +4745,6 @@ async def test_upgrade_runtime_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_upgrade_runtime_async_from_dict(): - await test_upgrade_runtime_async(request_type=dict) - - def test_upgrade_runtime_field_headers(): client = ManagedNotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4865,8 +4891,8 @@ async def test_upgrade_runtime_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - managed_service.ReportRuntimeEventRequest, - dict, + managed_service.ReportRuntimeEventRequest(), + {}, ], ) def test_report_runtime_event(request_type, transport: str = "grpc"): @@ -4877,7 +4903,7 @@ def test_report_runtime_event(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4923,10 +4949,11 @@ def test_report_runtime_event_non_empty_request_with_auto_populated_field(): client.report_runtime_event(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == managed_service.ReportRuntimeEventRequest( + request_msg = managed_service.ReportRuntimeEventRequest( name="name_value", vm_id="vm_id_value", ) + assert args[0] == request_msg def test_report_runtime_event_use_cached_wrapped_rpc(): @@ -5021,9 +5048,15 @@ async def test_report_runtime_event_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + managed_service.ReportRuntimeEventRequest(), + {}, + ], +) async def test_report_runtime_event_async( - transport: str = "grpc_asyncio", - request_type=managed_service.ReportRuntimeEventRequest, + request_type, transport: str = "grpc_asyncio" ): client = ManagedNotebookServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5032,7 +5065,7 @@ async def test_report_runtime_event_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( @@ -5054,11 +5087,6 @@ async def test_report_runtime_event_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_report_runtime_event_async_from_dict(): - await test_report_runtime_event_async(request_type=dict) - - def test_report_runtime_event_field_headers(): client = ManagedNotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5213,8 +5241,8 @@ async def test_report_runtime_event_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - managed_service.RefreshRuntimeTokenInternalRequest, - dict, + managed_service.RefreshRuntimeTokenInternalRequest(), + {}, ], ) def test_refresh_runtime_token_internal(request_type, transport: str = "grpc"): @@ -5225,7 +5253,7 @@ def test_refresh_runtime_token_internal(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5274,10 +5302,11 @@ def test_refresh_runtime_token_internal_non_empty_request_with_auto_populated_fi client.refresh_runtime_token_internal(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == managed_service.RefreshRuntimeTokenInternalRequest( + request_msg = managed_service.RefreshRuntimeTokenInternalRequest( name="name_value", vm_id="vm_id_value", ) + assert args[0] == request_msg def test_refresh_runtime_token_internal_use_cached_wrapped_rpc(): @@ -5363,9 +5392,15 @@ async def test_refresh_runtime_token_internal_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + managed_service.RefreshRuntimeTokenInternalRequest(), + {}, + ], +) async def test_refresh_runtime_token_internal_async( - transport: str = "grpc_asyncio", - request_type=managed_service.RefreshRuntimeTokenInternalRequest, + request_type, transport: str = "grpc_asyncio" ): client = ManagedNotebookServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5374,7 +5409,7 @@ async def test_refresh_runtime_token_internal_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( @@ -5399,11 +5434,6 @@ async def test_refresh_runtime_token_internal_async( assert response.access_token == "access_token_value" -@pytest.mark.asyncio -async def test_refresh_runtime_token_internal_async_from_dict(): - await test_refresh_runtime_token_internal_async(request_type=dict) - - def test_refresh_runtime_token_internal_field_headers(): client = ManagedNotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5568,8 +5598,8 @@ async def test_refresh_runtime_token_internal_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - managed_service.DiagnoseRuntimeRequest, - dict, + managed_service.DiagnoseRuntimeRequest(), + {}, ], ) def test_diagnose_runtime(request_type, transport: str = "grpc"): @@ -5580,7 +5610,7 @@ def test_diagnose_runtime(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.diagnose_runtime), "__call__") as call: @@ -5621,9 +5651,10 @@ def test_diagnose_runtime_non_empty_request_with_auto_populated_field(): client.diagnose_runtime(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == managed_service.DiagnoseRuntimeRequest( + request_msg = managed_service.DiagnoseRuntimeRequest( name="name_value", ) + assert args[0] == request_msg def test_diagnose_runtime_use_cached_wrapped_rpc(): @@ -5716,9 +5747,14 @@ async def test_diagnose_runtime_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_diagnose_runtime_async( - transport: str = "grpc_asyncio", request_type=managed_service.DiagnoseRuntimeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + managed_service.DiagnoseRuntimeRequest(), + {}, + ], +) +async def test_diagnose_runtime_async(request_type, transport: str = "grpc_asyncio"): client = ManagedNotebookServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5726,7 +5762,7 @@ async def test_diagnose_runtime_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.diagnose_runtime), "__call__") as call: @@ -5746,11 +5782,6 @@ async def test_diagnose_runtime_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_diagnose_runtime_async_from_dict(): - await test_diagnose_runtime_async(request_type=dict) - - def test_diagnose_runtime_field_headers(): client = ManagedNotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6034,7 +6065,6 @@ def test_list_runtimes_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_service.ListRuntimesRequest() - assert args[0] == request_msg @@ -6055,7 +6085,6 @@ def test_get_runtime_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_service.GetRuntimeRequest() - assert args[0] == request_msg @@ -6076,7 +6105,6 @@ def test_create_runtime_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_service.CreateRuntimeRequest() - assert args[0] == request_msg @@ -6097,7 +6125,6 @@ def test_update_runtime_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_service.UpdateRuntimeRequest() - assert args[0] == request_msg @@ -6118,7 +6145,6 @@ def test_delete_runtime_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_service.DeleteRuntimeRequest() - assert args[0] == request_msg @@ -6139,7 +6165,6 @@ def test_start_runtime_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_service.StartRuntimeRequest() - assert args[0] == request_msg @@ -6160,7 +6185,6 @@ def test_stop_runtime_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_service.StopRuntimeRequest() - assert args[0] == request_msg @@ -6181,7 +6205,6 @@ def test_switch_runtime_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_service.SwitchRuntimeRequest() - assert args[0] == request_msg @@ -6202,7 +6225,6 @@ def test_reset_runtime_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_service.ResetRuntimeRequest() - assert args[0] == request_msg @@ -6223,7 +6245,6 @@ def test_upgrade_runtime_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_service.UpgradeRuntimeRequest() - assert args[0] == request_msg @@ -6246,7 +6267,6 @@ def test_report_runtime_event_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_service.ReportRuntimeEventRequest() - assert args[0] == request_msg @@ -6269,7 +6289,6 @@ def test_refresh_runtime_token_internal_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_service.RefreshRuntimeTokenInternalRequest() - assert args[0] == request_msg @@ -6290,7 +6309,6 @@ def test_diagnose_runtime_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_service.DiagnoseRuntimeRequest() - assert args[0] == request_msg @@ -6332,7 +6350,6 @@ async def test_list_runtimes_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_service.ListRuntimesRequest() - assert args[0] == request_msg @@ -6361,7 +6378,6 @@ async def test_get_runtime_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_service.GetRuntimeRequest() - assert args[0] == request_msg @@ -6386,7 +6402,6 @@ async def test_create_runtime_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_service.CreateRuntimeRequest() - assert args[0] == request_msg @@ -6411,7 +6426,6 @@ async def test_update_runtime_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_service.UpdateRuntimeRequest() - assert args[0] == request_msg @@ -6436,7 +6450,6 @@ async def test_delete_runtime_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_service.DeleteRuntimeRequest() - assert args[0] == request_msg @@ -6461,7 +6474,6 @@ async def test_start_runtime_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_service.StartRuntimeRequest() - assert args[0] == request_msg @@ -6486,7 +6498,6 @@ async def test_stop_runtime_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_service.StopRuntimeRequest() - assert args[0] == request_msg @@ -6511,7 +6522,6 @@ async def test_switch_runtime_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_service.SwitchRuntimeRequest() - assert args[0] == request_msg @@ -6536,7 +6546,6 @@ async def test_reset_runtime_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_service.ResetRuntimeRequest() - assert args[0] == request_msg @@ -6561,7 +6570,6 @@ async def test_upgrade_runtime_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_service.UpgradeRuntimeRequest() - assert args[0] == request_msg @@ -6588,7 +6596,6 @@ async def test_report_runtime_event_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_service.ReportRuntimeEventRequest() - assert args[0] == request_msg @@ -6617,7 +6624,6 @@ async def test_refresh_runtime_token_internal_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_service.RefreshRuntimeTokenInternalRequest() - assert args[0] == request_msg @@ -6642,7 +6648,6 @@ async def test_diagnose_runtime_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = managed_service.DiagnoseRuntimeRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-notebooks/tests/unit/gapic/notebooks_v1/test_notebook_service.py b/packages/google-cloud-notebooks/tests/unit/gapic/notebooks_v1/test_notebook_service.py index 51599c894502..97953af079cb 100644 --- a/packages/google-cloud-notebooks/tests/unit/gapic/notebooks_v1/test_notebook_service.py +++ b/packages/google-cloud-notebooks/tests/unit/gapic/notebooks_v1/test_notebook_service.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 @@ -129,6 +130,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" @@ -1329,8 +1345,8 @@ def test_notebook_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - service.ListInstancesRequest, - dict, + service.ListInstancesRequest(), + {}, ], ) def test_list_instances(request_type, transport: str = "grpc"): @@ -1341,7 +1357,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(type(client.transport.list_instances), "__call__") as call: @@ -1388,10 +1404,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] == service.ListInstancesRequest( + request_msg = service.ListInstancesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_instances_use_cached_wrapped_rpc(): @@ -1472,9 +1489,14 @@ async def test_list_instances_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_instances_async( - transport: str = "grpc_asyncio", request_type=service.ListInstancesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListInstancesRequest(), + {}, + ], +) +async def test_list_instances_async(request_type, transport: str = "grpc_asyncio"): client = NotebookServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1482,7 +1504,7 @@ async def test_list_instances_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_instances), "__call__") as call: @@ -1507,11 +1529,6 @@ async def test_list_instances_async( 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 = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1848,8 +1865,8 @@ async def test_list_instances_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetInstanceRequest, - dict, + service.GetInstanceRequest(), + {}, ], ) def test_get_instance(request_type, transport: str = "grpc"): @@ -1860,7 +1877,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(type(client.transport.get_instance), "__call__") as call: @@ -1952,9 +1969,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] == service.GetInstanceRequest( + request_msg = service.GetInstanceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_instance_use_cached_wrapped_rpc(): @@ -2035,9 +2053,14 @@ async def test_get_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_instance_async( - transport: str = "grpc_asyncio", request_type=service.GetInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetInstanceRequest(), + {}, + ], +) +async def test_get_instance_async(request_type, transport: str = "grpc_asyncio"): client = NotebookServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2045,7 +2068,7 @@ async def test_get_instance_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_instance), "__call__") as call: @@ -2116,11 +2139,6 @@ async def test_get_instance_async( assert response.can_ip_forward is True -@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 = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2263,8 +2281,8 @@ async def test_get_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.CreateInstanceRequest, - dict, + service.CreateInstanceRequest(), + {}, ], ) def test_create_instance(request_type, transport: str = "grpc"): @@ -2275,7 +2293,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(type(client.transport.create_instance), "__call__") as call: @@ -2317,10 +2335,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] == service.CreateInstanceRequest( + request_msg = service.CreateInstanceRequest( parent="parent_value", instance_id="instance_id_value", ) + assert args[0] == request_msg def test_create_instance_use_cached_wrapped_rpc(): @@ -2411,9 +2430,14 @@ async def test_create_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_instance_async( - transport: str = "grpc_asyncio", request_type=service.CreateInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CreateInstanceRequest(), + {}, + ], +) +async def test_create_instance_async(request_type, transport: str = "grpc_asyncio"): client = NotebookServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2421,7 +2445,7 @@ async def test_create_instance_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_instance), "__call__") as call: @@ -2441,11 +2465,6 @@ async def test_create_instance_async( 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 = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2612,8 +2631,8 @@ async def test_create_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.RegisterInstanceRequest, - dict, + service.RegisterInstanceRequest(), + {}, ], ) def test_register_instance(request_type, transport: str = "grpc"): @@ -2624,7 +2643,7 @@ def test_register_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( @@ -2670,10 +2689,11 @@ def test_register_instance_non_empty_request_with_auto_populated_field(): client.register_instance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.RegisterInstanceRequest( + request_msg = service.RegisterInstanceRequest( parent="parent_value", instance_id="instance_id_value", ) + assert args[0] == request_msg def test_register_instance_use_cached_wrapped_rpc(): @@ -2766,9 +2786,14 @@ async def test_register_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_register_instance_async( - transport: str = "grpc_asyncio", request_type=service.RegisterInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.RegisterInstanceRequest(), + {}, + ], +) +async def test_register_instance_async(request_type, transport: str = "grpc_asyncio"): client = NotebookServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2776,7 +2801,7 @@ async def test_register_instance_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( @@ -2798,11 +2823,6 @@ async def test_register_instance_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_register_instance_async_from_dict(): - await test_register_instance_async(request_type=dict) - - def test_register_instance_field_headers(): client = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2871,8 +2891,8 @@ async def test_register_instance_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.SetInstanceAcceleratorRequest, - dict, + service.SetInstanceAcceleratorRequest(), + {}, ], ) def test_set_instance_accelerator(request_type, transport: str = "grpc"): @@ -2883,7 +2903,7 @@ def test_set_instance_accelerator(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2928,9 +2948,10 @@ def test_set_instance_accelerator_non_empty_request_with_auto_populated_field(): client.set_instance_accelerator(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.SetInstanceAcceleratorRequest( + request_msg = service.SetInstanceAcceleratorRequest( name="name_value", ) + assert args[0] == request_msg def test_set_instance_accelerator_use_cached_wrapped_rpc(): @@ -3026,8 +3047,15 @@ async def test_set_instance_accelerator_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.SetInstanceAcceleratorRequest(), + {}, + ], +) async def test_set_instance_accelerator_async( - transport: str = "grpc_asyncio", request_type=service.SetInstanceAcceleratorRequest + request_type, transport: str = "grpc_asyncio" ): client = NotebookServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3036,7 +3064,7 @@ async def test_set_instance_accelerator_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( @@ -3058,11 +3086,6 @@ async def test_set_instance_accelerator_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_set_instance_accelerator_async_from_dict(): - await test_set_instance_accelerator_async(request_type=dict) - - def test_set_instance_accelerator_field_headers(): client = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3131,8 +3154,8 @@ async def test_set_instance_accelerator_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.SetInstanceMachineTypeRequest, - dict, + service.SetInstanceMachineTypeRequest(), + {}, ], ) def test_set_instance_machine_type(request_type, transport: str = "grpc"): @@ -3143,7 +3166,7 @@ def test_set_instance_machine_type(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3189,10 +3212,11 @@ def test_set_instance_machine_type_non_empty_request_with_auto_populated_field() client.set_instance_machine_type(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.SetInstanceMachineTypeRequest( + request_msg = service.SetInstanceMachineTypeRequest( name="name_value", machine_type="machine_type_value", ) + assert args[0] == request_msg def test_set_instance_machine_type_use_cached_wrapped_rpc(): @@ -3288,8 +3312,15 @@ async def test_set_instance_machine_type_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.SetInstanceMachineTypeRequest(), + {}, + ], +) async def test_set_instance_machine_type_async( - transport: str = "grpc_asyncio", request_type=service.SetInstanceMachineTypeRequest + request_type, transport: str = "grpc_asyncio" ): client = NotebookServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3298,7 +3329,7 @@ async def test_set_instance_machine_type_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( @@ -3320,11 +3351,6 @@ async def test_set_instance_machine_type_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_set_instance_machine_type_async_from_dict(): - await test_set_instance_machine_type_async(request_type=dict) - - def test_set_instance_machine_type_field_headers(): client = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3393,8 +3419,8 @@ async def test_set_instance_machine_type_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdateInstanceConfigRequest, - dict, + service.UpdateInstanceConfigRequest(), + {}, ], ) def test_update_instance_config(request_type, transport: str = "grpc"): @@ -3405,7 +3431,7 @@ def test_update_instance_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( @@ -3450,9 +3476,10 @@ def test_update_instance_config_non_empty_request_with_auto_populated_field(): client.update_instance_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateInstanceConfigRequest( + request_msg = service.UpdateInstanceConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_update_instance_config_use_cached_wrapped_rpc(): @@ -3548,8 +3575,15 @@ async def test_update_instance_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateInstanceConfigRequest(), + {}, + ], +) async def test_update_instance_config_async( - transport: str = "grpc_asyncio", request_type=service.UpdateInstanceConfigRequest + request_type, transport: str = "grpc_asyncio" ): client = NotebookServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3558,7 +3592,7 @@ async def test_update_instance_config_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( @@ -3580,11 +3614,6 @@ async def test_update_instance_config_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_instance_config_async_from_dict(): - await test_update_instance_config_async(request_type=dict) - - def test_update_instance_config_field_headers(): client = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3653,8 +3682,8 @@ async def test_update_instance_config_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdateShieldedInstanceConfigRequest, - dict, + service.UpdateShieldedInstanceConfigRequest(), + {}, ], ) def test_update_shielded_instance_config(request_type, transport: str = "grpc"): @@ -3665,7 +3694,7 @@ def test_update_shielded_instance_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( @@ -3710,9 +3739,10 @@ def test_update_shielded_instance_config_non_empty_request_with_auto_populated_f client.update_shielded_instance_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateShieldedInstanceConfigRequest( + request_msg = service.UpdateShieldedInstanceConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_update_shielded_instance_config_use_cached_wrapped_rpc(): @@ -3808,9 +3838,15 @@ async def test_update_shielded_instance_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateShieldedInstanceConfigRequest(), + {}, + ], +) async def test_update_shielded_instance_config_async( - transport: str = "grpc_asyncio", - request_type=service.UpdateShieldedInstanceConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = NotebookServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3819,7 +3855,7 @@ async def test_update_shielded_instance_config_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( @@ -3841,11 +3877,6 @@ async def test_update_shielded_instance_config_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_shielded_instance_config_async_from_dict(): - await test_update_shielded_instance_config_async(request_type=dict) - - def test_update_shielded_instance_config_field_headers(): client = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3914,8 +3945,8 @@ async def test_update_shielded_instance_config_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.SetInstanceLabelsRequest, - dict, + service.SetInstanceLabelsRequest(), + {}, ], ) def test_set_instance_labels(request_type, transport: str = "grpc"): @@ -3926,7 +3957,7 @@ def test_set_instance_labels(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3971,9 +4002,10 @@ def test_set_instance_labels_non_empty_request_with_auto_populated_field(): client.set_instance_labels(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.SetInstanceLabelsRequest( + request_msg = service.SetInstanceLabelsRequest( name="name_value", ) + assert args[0] == request_msg def test_set_instance_labels_use_cached_wrapped_rpc(): @@ -4068,9 +4100,14 @@ async def test_set_instance_labels_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_instance_labels_async( - transport: str = "grpc_asyncio", request_type=service.SetInstanceLabelsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.SetInstanceLabelsRequest(), + {}, + ], +) +async def test_set_instance_labels_async(request_type, transport: str = "grpc_asyncio"): client = NotebookServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4078,7 +4115,7 @@ async def test_set_instance_labels_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( @@ -4100,11 +4137,6 @@ async def test_set_instance_labels_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_set_instance_labels_async_from_dict(): - await test_set_instance_labels_async(request_type=dict) - - def test_set_instance_labels_field_headers(): client = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4173,8 +4205,8 @@ async def test_set_instance_labels_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdateInstanceMetadataItemsRequest, - dict, + service.UpdateInstanceMetadataItemsRequest(), + {}, ], ) def test_update_instance_metadata_items(request_type, transport: str = "grpc"): @@ -4185,7 +4217,7 @@ def test_update_instance_metadata_items(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4230,9 +4262,10 @@ def test_update_instance_metadata_items_non_empty_request_with_auto_populated_fi client.update_instance_metadata_items(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateInstanceMetadataItemsRequest( + request_msg = service.UpdateInstanceMetadataItemsRequest( name="name_value", ) + assert args[0] == request_msg def test_update_instance_metadata_items_use_cached_wrapped_rpc(): @@ -4318,9 +4351,15 @@ async def test_update_instance_metadata_items_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateInstanceMetadataItemsRequest(), + {}, + ], +) async def test_update_instance_metadata_items_async( - transport: str = "grpc_asyncio", - request_type=service.UpdateInstanceMetadataItemsRequest, + request_type, transport: str = "grpc_asyncio" ): client = NotebookServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4329,7 +4368,7 @@ async def test_update_instance_metadata_items_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( @@ -4351,11 +4390,6 @@ async def test_update_instance_metadata_items_async( assert isinstance(response, service.UpdateInstanceMetadataItemsResponse) -@pytest.mark.asyncio -async def test_update_instance_metadata_items_async_from_dict(): - await test_update_instance_metadata_items_async(request_type=dict) - - def test_update_instance_metadata_items_field_headers(): client = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4424,8 +4458,8 @@ async def test_update_instance_metadata_items_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.DeleteInstanceRequest, - dict, + service.DeleteInstanceRequest(), + {}, ], ) def test_delete_instance(request_type, transport: str = "grpc"): @@ -4436,7 +4470,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(type(client.transport.delete_instance), "__call__") as call: @@ -4477,9 +4511,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] == service.DeleteInstanceRequest( + request_msg = service.DeleteInstanceRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_instance_use_cached_wrapped_rpc(): @@ -4570,9 +4605,14 @@ async def test_delete_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_instance_async( - transport: str = "grpc_asyncio", request_type=service.DeleteInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteInstanceRequest(), + {}, + ], +) +async def test_delete_instance_async(request_type, transport: str = "grpc_asyncio"): client = NotebookServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4580,7 +4620,7 @@ async def test_delete_instance_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_instance), "__call__") as call: @@ -4600,11 +4640,6 @@ async def test_delete_instance_async( 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 = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4751,8 +4786,8 @@ async def test_delete_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.StartInstanceRequest, - dict, + service.StartInstanceRequest(), + {}, ], ) def test_start_instance(request_type, transport: str = "grpc"): @@ -4763,7 +4798,7 @@ def test_start_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(type(client.transport.start_instance), "__call__") as call: @@ -4804,9 +4839,10 @@ def test_start_instance_non_empty_request_with_auto_populated_field(): client.start_instance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.StartInstanceRequest( + request_msg = service.StartInstanceRequest( name="name_value", ) + assert args[0] == request_msg def test_start_instance_use_cached_wrapped_rpc(): @@ -4897,9 +4933,14 @@ async def test_start_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_start_instance_async( - transport: str = "grpc_asyncio", request_type=service.StartInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.StartInstanceRequest(), + {}, + ], +) +async def test_start_instance_async(request_type, transport: str = "grpc_asyncio"): client = NotebookServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4907,7 +4948,7 @@ async def test_start_instance_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.start_instance), "__call__") as call: @@ -4927,11 +4968,6 @@ async def test_start_instance_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_start_instance_async_from_dict(): - await test_start_instance_async(request_type=dict) - - def test_start_instance_field_headers(): client = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4996,8 +5032,8 @@ async def test_start_instance_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.StopInstanceRequest, - dict, + service.StopInstanceRequest(), + {}, ], ) def test_stop_instance(request_type, transport: str = "grpc"): @@ -5008,7 +5044,7 @@ def test_stop_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(type(client.transport.stop_instance), "__call__") as call: @@ -5049,9 +5085,10 @@ def test_stop_instance_non_empty_request_with_auto_populated_field(): client.stop_instance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.StopInstanceRequest( + request_msg = service.StopInstanceRequest( name="name_value", ) + assert args[0] == request_msg def test_stop_instance_use_cached_wrapped_rpc(): @@ -5142,9 +5179,14 @@ async def test_stop_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_stop_instance_async( - transport: str = "grpc_asyncio", request_type=service.StopInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.StopInstanceRequest(), + {}, + ], +) +async def test_stop_instance_async(request_type, transport: str = "grpc_asyncio"): client = NotebookServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5152,7 +5194,7 @@ async def test_stop_instance_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.stop_instance), "__call__") as call: @@ -5172,11 +5214,6 @@ async def test_stop_instance_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_stop_instance_async_from_dict(): - await test_stop_instance_async(request_type=dict) - - def test_stop_instance_field_headers(): client = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5241,8 +5278,8 @@ async def test_stop_instance_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.ResetInstanceRequest, - dict, + service.ResetInstanceRequest(), + {}, ], ) def test_reset_instance(request_type, transport: str = "grpc"): @@ -5253,7 +5290,7 @@ def test_reset_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(type(client.transport.reset_instance), "__call__") as call: @@ -5294,9 +5331,10 @@ def test_reset_instance_non_empty_request_with_auto_populated_field(): client.reset_instance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ResetInstanceRequest( + request_msg = service.ResetInstanceRequest( name="name_value", ) + assert args[0] == request_msg def test_reset_instance_use_cached_wrapped_rpc(): @@ -5387,9 +5425,14 @@ async def test_reset_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_reset_instance_async( - transport: str = "grpc_asyncio", request_type=service.ResetInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ResetInstanceRequest(), + {}, + ], +) +async def test_reset_instance_async(request_type, transport: str = "grpc_asyncio"): client = NotebookServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5397,7 +5440,7 @@ async def test_reset_instance_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.reset_instance), "__call__") as call: @@ -5417,11 +5460,6 @@ async def test_reset_instance_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_reset_instance_async_from_dict(): - await test_reset_instance_async(request_type=dict) - - def test_reset_instance_field_headers(): client = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5486,8 +5524,8 @@ async def test_reset_instance_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.ReportInstanceInfoRequest, - dict, + service.ReportInstanceInfoRequest(), + {}, ], ) def test_report_instance_info(request_type, transport: str = "grpc"): @@ -5498,7 +5536,7 @@ def test_report_instance_info(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5544,10 +5582,11 @@ def test_report_instance_info_non_empty_request_with_auto_populated_field(): client.report_instance_info(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ReportInstanceInfoRequest( + request_msg = service.ReportInstanceInfoRequest( name="name_value", vm_id="vm_id_value", ) + assert args[0] == request_msg def test_report_instance_info_use_cached_wrapped_rpc(): @@ -5642,8 +5681,15 @@ async def test_report_instance_info_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.ReportInstanceInfoRequest(), + {}, + ], +) async def test_report_instance_info_async( - transport: str = "grpc_asyncio", request_type=service.ReportInstanceInfoRequest + request_type, transport: str = "grpc_asyncio" ): client = NotebookServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5652,7 +5698,7 @@ async def test_report_instance_info_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( @@ -5674,11 +5720,6 @@ async def test_report_instance_info_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_report_instance_info_async_from_dict(): - await test_report_instance_info_async(request_type=dict) - - def test_report_instance_info_field_headers(): client = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5747,8 +5788,8 @@ async def test_report_instance_info_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.IsInstanceUpgradeableRequest, - dict, + service.IsInstanceUpgradeableRequest(), + {}, ], ) def test_is_instance_upgradeable(request_type, transport: str = "grpc"): @@ -5759,7 +5800,7 @@ def test_is_instance_upgradeable(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5813,9 +5854,10 @@ def test_is_instance_upgradeable_non_empty_request_with_auto_populated_field(): client.is_instance_upgradeable(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.IsInstanceUpgradeableRequest( + request_msg = service.IsInstanceUpgradeableRequest( notebook_instance="notebook_instance_value", ) + assert args[0] == request_msg def test_is_instance_upgradeable_use_cached_wrapped_rpc(): @@ -5901,8 +5943,15 @@ async def test_is_instance_upgradeable_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.IsInstanceUpgradeableRequest(), + {}, + ], +) async def test_is_instance_upgradeable_async( - transport: str = "grpc_asyncio", request_type=service.IsInstanceUpgradeableRequest + request_type, transport: str = "grpc_asyncio" ): client = NotebookServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5911,7 +5960,7 @@ async def test_is_instance_upgradeable_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( @@ -5942,11 +5991,6 @@ async def test_is_instance_upgradeable_async( assert response.upgrade_image == "upgrade_image_value" -@pytest.mark.asyncio -async def test_is_instance_upgradeable_async_from_dict(): - await test_is_instance_upgradeable_async(request_type=dict) - - def test_is_instance_upgradeable_field_headers(): client = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6015,8 +6059,8 @@ async def test_is_instance_upgradeable_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.GetInstanceHealthRequest, - dict, + service.GetInstanceHealthRequest(), + {}, ], ) def test_get_instance_health(request_type, transport: str = "grpc"): @@ -6027,7 +6071,7 @@ def test_get_instance_health(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6077,9 +6121,10 @@ def test_get_instance_health_non_empty_request_with_auto_populated_field(): client.get_instance_health(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetInstanceHealthRequest( + request_msg = service.GetInstanceHealthRequest( name="name_value", ) + assert args[0] == request_msg def test_get_instance_health_use_cached_wrapped_rpc(): @@ -6164,9 +6209,14 @@ async def test_get_instance_health_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_instance_health_async( - transport: str = "grpc_asyncio", request_type=service.GetInstanceHealthRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetInstanceHealthRequest(), + {}, + ], +) +async def test_get_instance_health_async(request_type, transport: str = "grpc_asyncio"): client = NotebookServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6174,7 +6224,7 @@ async def test_get_instance_health_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( @@ -6201,11 +6251,6 @@ async def test_get_instance_health_async( ) -@pytest.mark.asyncio -async def test_get_instance_health_async_from_dict(): - await test_get_instance_health_async(request_type=dict) - - def test_get_instance_health_field_headers(): client = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6360,8 +6405,8 @@ async def test_get_instance_health_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.UpgradeInstanceRequest, - dict, + service.UpgradeInstanceRequest(), + {}, ], ) def test_upgrade_instance(request_type, transport: str = "grpc"): @@ -6372,7 +6417,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(type(client.transport.upgrade_instance), "__call__") as call: @@ -6413,9 +6458,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] - assert args[0] == service.UpgradeInstanceRequest( + request_msg = service.UpgradeInstanceRequest( name="name_value", ) + assert args[0] == request_msg def test_upgrade_instance_use_cached_wrapped_rpc(): @@ -6508,9 +6554,14 @@ async def test_upgrade_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_upgrade_instance_async( - transport: str = "grpc_asyncio", request_type=service.UpgradeInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.UpgradeInstanceRequest(), + {}, + ], +) +async def test_upgrade_instance_async(request_type, transport: str = "grpc_asyncio"): client = NotebookServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6518,7 +6569,7 @@ async def test_upgrade_instance_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.upgrade_instance), "__call__") as call: @@ -6538,11 +6589,6 @@ async def test_upgrade_instance_async( 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 = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6607,8 +6653,8 @@ async def test_upgrade_instance_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.RollbackInstanceRequest, - dict, + service.RollbackInstanceRequest(), + {}, ], ) def test_rollback_instance(request_type, transport: str = "grpc"): @@ -6619,7 +6665,7 @@ def test_rollback_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( @@ -6665,10 +6711,11 @@ def test_rollback_instance_non_empty_request_with_auto_populated_field(): client.rollback_instance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.RollbackInstanceRequest( + request_msg = service.RollbackInstanceRequest( name="name_value", target_snapshot="target_snapshot_value", ) + assert args[0] == request_msg def test_rollback_instance_use_cached_wrapped_rpc(): @@ -6761,9 +6808,14 @@ async def test_rollback_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_rollback_instance_async( - transport: str = "grpc_asyncio", request_type=service.RollbackInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.RollbackInstanceRequest(), + {}, + ], +) +async def test_rollback_instance_async(request_type, transport: str = "grpc_asyncio"): client = NotebookServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6771,7 +6823,7 @@ async def test_rollback_instance_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( @@ -6793,11 +6845,6 @@ async def test_rollback_instance_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_rollback_instance_async_from_dict(): - await test_rollback_instance_async(request_type=dict) - - def test_rollback_instance_field_headers(): client = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6866,8 +6913,8 @@ async def test_rollback_instance_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.DiagnoseInstanceRequest, - dict, + service.DiagnoseInstanceRequest(), + {}, ], ) def test_diagnose_instance(request_type, transport: str = "grpc"): @@ -6878,7 +6925,7 @@ def test_diagnose_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( @@ -6923,9 +6970,10 @@ def test_diagnose_instance_non_empty_request_with_auto_populated_field(): client.diagnose_instance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DiagnoseInstanceRequest( + request_msg = service.DiagnoseInstanceRequest( name="name_value", ) + assert args[0] == request_msg def test_diagnose_instance_use_cached_wrapped_rpc(): @@ -7018,9 +7066,14 @@ async def test_diagnose_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_diagnose_instance_async( - transport: str = "grpc_asyncio", request_type=service.DiagnoseInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.DiagnoseInstanceRequest(), + {}, + ], +) +async def test_diagnose_instance_async(request_type, transport: str = "grpc_asyncio"): client = NotebookServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7028,7 +7081,7 @@ async def test_diagnose_instance_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( @@ -7050,11 +7103,6 @@ async def test_diagnose_instance_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_diagnose_instance_async_from_dict(): - await test_diagnose_instance_async(request_type=dict) - - def test_diagnose_instance_field_headers(): client = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7227,8 +7275,8 @@ async def test_diagnose_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.UpgradeInstanceInternalRequest, - dict, + service.UpgradeInstanceInternalRequest(), + {}, ], ) def test_upgrade_instance_internal(request_type, transport: str = "grpc"): @@ -7239,7 +7287,7 @@ def test_upgrade_instance_internal(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7285,10 +7333,11 @@ def test_upgrade_instance_internal_non_empty_request_with_auto_populated_field() client.upgrade_instance_internal(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpgradeInstanceInternalRequest( + request_msg = service.UpgradeInstanceInternalRequest( name="name_value", vm_id="vm_id_value", ) + assert args[0] == request_msg def test_upgrade_instance_internal_use_cached_wrapped_rpc(): @@ -7384,8 +7433,15 @@ async def test_upgrade_instance_internal_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.UpgradeInstanceInternalRequest(), + {}, + ], +) async def test_upgrade_instance_internal_async( - transport: str = "grpc_asyncio", request_type=service.UpgradeInstanceInternalRequest + request_type, transport: str = "grpc_asyncio" ): client = NotebookServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -7394,7 +7450,7 @@ async def test_upgrade_instance_internal_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( @@ -7416,11 +7472,6 @@ async def test_upgrade_instance_internal_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_upgrade_instance_internal_async_from_dict(): - await test_upgrade_instance_internal_async(request_type=dict) - - def test_upgrade_instance_internal_field_headers(): client = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7489,8 +7540,8 @@ async def test_upgrade_instance_internal_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.ListEnvironmentsRequest, - dict, + service.ListEnvironmentsRequest(), + {}, ], ) def test_list_environments(request_type, transport: str = "grpc"): @@ -7501,7 +7552,7 @@ def test_list_environments(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7552,10 +7603,11 @@ def test_list_environments_non_empty_request_with_auto_populated_field(): client.list_environments(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListEnvironmentsRequest( + request_msg = service.ListEnvironmentsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_environments_use_cached_wrapped_rpc(): @@ -7638,9 +7690,14 @@ async def test_list_environments_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_environments_async( - transport: str = "grpc_asyncio", request_type=service.ListEnvironmentsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListEnvironmentsRequest(), + {}, + ], +) +async def test_list_environments_async(request_type, transport: str = "grpc_asyncio"): client = NotebookServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7648,7 +7705,7 @@ async def test_list_environments_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( @@ -7675,11 +7732,6 @@ async def test_list_environments_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_environments_async_from_dict(): - await test_list_environments_async(request_type=dict) - - def test_list_environments_field_headers(): client = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8032,8 +8084,8 @@ async def test_list_environments_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetEnvironmentRequest, - dict, + service.GetEnvironmentRequest(), + {}, ], ) def test_get_environment(request_type, transport: str = "grpc"): @@ -8044,7 +8096,7 @@ def test_get_environment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_environment), "__call__") as call: @@ -8094,9 +8146,10 @@ def test_get_environment_non_empty_request_with_auto_populated_field(): client.get_environment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetEnvironmentRequest( + request_msg = service.GetEnvironmentRequest( name="name_value", ) + assert args[0] == request_msg def test_get_environment_use_cached_wrapped_rpc(): @@ -8177,9 +8230,14 @@ async def test_get_environment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_environment_async( - transport: str = "grpc_asyncio", request_type=service.GetEnvironmentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetEnvironmentRequest(), + {}, + ], +) +async def test_get_environment_async(request_type, transport: str = "grpc_asyncio"): client = NotebookServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8187,7 +8245,7 @@ async def test_get_environment_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_environment), "__call__") as call: @@ -8216,11 +8274,6 @@ async def test_get_environment_async( assert response.post_startup_script == "post_startup_script_value" -@pytest.mark.asyncio -async def test_get_environment_async_from_dict(): - await test_get_environment_async(request_type=dict) - - def test_get_environment_field_headers(): client = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8367,8 +8420,8 @@ async def test_get_environment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.CreateEnvironmentRequest, - dict, + service.CreateEnvironmentRequest(), + {}, ], ) def test_create_environment(request_type, transport: str = "grpc"): @@ -8379,7 +8432,7 @@ def test_create_environment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8425,10 +8478,11 @@ def test_create_environment_non_empty_request_with_auto_populated_field(): client.create_environment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateEnvironmentRequest( + request_msg = service.CreateEnvironmentRequest( parent="parent_value", environment_id="environment_id_value", ) + assert args[0] == request_msg def test_create_environment_use_cached_wrapped_rpc(): @@ -8523,9 +8577,14 @@ async def test_create_environment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_environment_async( - transport: str = "grpc_asyncio", request_type=service.CreateEnvironmentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CreateEnvironmentRequest(), + {}, + ], +) +async def test_create_environment_async(request_type, transport: str = "grpc_asyncio"): client = NotebookServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8533,7 +8592,7 @@ async def test_create_environment_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( @@ -8555,11 +8614,6 @@ async def test_create_environment_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_environment_async_from_dict(): - await test_create_environment_async(request_type=dict) - - def test_create_environment_field_headers(): client = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8734,8 +8788,8 @@ async def test_create_environment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DeleteEnvironmentRequest, - dict, + service.DeleteEnvironmentRequest(), + {}, ], ) def test_delete_environment(request_type, transport: str = "grpc"): @@ -8746,7 +8800,7 @@ def test_delete_environment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8791,9 +8845,10 @@ def test_delete_environment_non_empty_request_with_auto_populated_field(): client.delete_environment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteEnvironmentRequest( + request_msg = service.DeleteEnvironmentRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_environment_use_cached_wrapped_rpc(): @@ -8888,9 +8943,14 @@ async def test_delete_environment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_environment_async( - transport: str = "grpc_asyncio", request_type=service.DeleteEnvironmentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteEnvironmentRequest(), + {}, + ], +) +async def test_delete_environment_async(request_type, transport: str = "grpc_asyncio"): client = NotebookServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8898,7 +8958,7 @@ async def test_delete_environment_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( @@ -8920,11 +8980,6 @@ async def test_delete_environment_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_environment_async_from_dict(): - await test_delete_environment_async(request_type=dict) - - def test_delete_environment_field_headers(): client = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9079,8 +9134,8 @@ async def test_delete_environment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListSchedulesRequest, - dict, + service.ListSchedulesRequest(), + {}, ], ) def test_list_schedules(request_type, transport: str = "grpc"): @@ -9091,7 +9146,7 @@ def test_list_schedules(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_schedules), "__call__") as call: @@ -9140,12 +9195,13 @@ def test_list_schedules_non_empty_request_with_auto_populated_field(): client.list_schedules(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListSchedulesRequest( + request_msg = service.ListSchedulesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_schedules_use_cached_wrapped_rpc(): @@ -9226,9 +9282,14 @@ async def test_list_schedules_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_schedules_async( - transport: str = "grpc_asyncio", request_type=service.ListSchedulesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListSchedulesRequest(), + {}, + ], +) +async def test_list_schedules_async(request_type, transport: str = "grpc_asyncio"): client = NotebookServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9236,7 +9297,7 @@ async def test_list_schedules_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_schedules), "__call__") as call: @@ -9261,11 +9322,6 @@ async def test_list_schedules_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_schedules_async_from_dict(): - await test_list_schedules_async(request_type=dict) - - def test_list_schedules_field_headers(): client = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9602,8 +9658,8 @@ async def test_list_schedules_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetScheduleRequest, - dict, + service.GetScheduleRequest(), + {}, ], ) def test_get_schedule(request_type, transport: str = "grpc"): @@ -9614,7 +9670,7 @@ def test_get_schedule(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_schedule), "__call__") as call: @@ -9668,9 +9724,10 @@ def test_get_schedule_non_empty_request_with_auto_populated_field(): client.get_schedule(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetScheduleRequest( + request_msg = service.GetScheduleRequest( name="name_value", ) + assert args[0] == request_msg def test_get_schedule_use_cached_wrapped_rpc(): @@ -9751,9 +9808,14 @@ async def test_get_schedule_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_schedule_async( - transport: str = "grpc_asyncio", request_type=service.GetScheduleRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetScheduleRequest(), + {}, + ], +) +async def test_get_schedule_async(request_type, transport: str = "grpc_asyncio"): client = NotebookServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9761,7 +9823,7 @@ async def test_get_schedule_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_schedule), "__call__") as call: @@ -9794,11 +9856,6 @@ async def test_get_schedule_async( assert response.time_zone == "time_zone_value" -@pytest.mark.asyncio -async def test_get_schedule_async_from_dict(): - await test_get_schedule_async(request_type=dict) - - def test_get_schedule_field_headers(): client = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9941,8 +9998,8 @@ async def test_get_schedule_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DeleteScheduleRequest, - dict, + service.DeleteScheduleRequest(), + {}, ], ) def test_delete_schedule(request_type, transport: str = "grpc"): @@ -9953,7 +10010,7 @@ def test_delete_schedule(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_schedule), "__call__") as call: @@ -9994,9 +10051,10 @@ def test_delete_schedule_non_empty_request_with_auto_populated_field(): client.delete_schedule(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteScheduleRequest( + request_msg = service.DeleteScheduleRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_schedule_use_cached_wrapped_rpc(): @@ -10087,9 +10145,14 @@ async def test_delete_schedule_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_schedule_async( - transport: str = "grpc_asyncio", request_type=service.DeleteScheduleRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteScheduleRequest(), + {}, + ], +) +async def test_delete_schedule_async(request_type, transport: str = "grpc_asyncio"): client = NotebookServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10097,7 +10160,7 @@ async def test_delete_schedule_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_schedule), "__call__") as call: @@ -10117,11 +10180,6 @@ async def test_delete_schedule_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_schedule_async_from_dict(): - await test_delete_schedule_async(request_type=dict) - - def test_delete_schedule_field_headers(): client = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10268,8 +10326,8 @@ async def test_delete_schedule_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.CreateScheduleRequest, - dict, + service.CreateScheduleRequest(), + {}, ], ) def test_create_schedule(request_type, transport: str = "grpc"): @@ -10280,7 +10338,7 @@ def test_create_schedule(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_schedule), "__call__") as call: @@ -10322,10 +10380,11 @@ def test_create_schedule_non_empty_request_with_auto_populated_field(): client.create_schedule(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateScheduleRequest( + request_msg = service.CreateScheduleRequest( parent="parent_value", schedule_id="schedule_id_value", ) + assert args[0] == request_msg def test_create_schedule_use_cached_wrapped_rpc(): @@ -10416,9 +10475,14 @@ async def test_create_schedule_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_schedule_async( - transport: str = "grpc_asyncio", request_type=service.CreateScheduleRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CreateScheduleRequest(), + {}, + ], +) +async def test_create_schedule_async(request_type, transport: str = "grpc_asyncio"): client = NotebookServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10426,7 +10490,7 @@ async def test_create_schedule_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_schedule), "__call__") as call: @@ -10446,11 +10510,6 @@ async def test_create_schedule_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_schedule_async_from_dict(): - await test_create_schedule_async(request_type=dict) - - def test_create_schedule_field_headers(): client = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10617,8 +10676,8 @@ async def test_create_schedule_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.TriggerScheduleRequest, - dict, + service.TriggerScheduleRequest(), + {}, ], ) def test_trigger_schedule(request_type, transport: str = "grpc"): @@ -10629,7 +10688,7 @@ def test_trigger_schedule(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.trigger_schedule), "__call__") as call: @@ -10670,9 +10729,10 @@ def test_trigger_schedule_non_empty_request_with_auto_populated_field(): client.trigger_schedule(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.TriggerScheduleRequest( + request_msg = service.TriggerScheduleRequest( name="name_value", ) + assert args[0] == request_msg def test_trigger_schedule_use_cached_wrapped_rpc(): @@ -10765,9 +10825,14 @@ async def test_trigger_schedule_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_trigger_schedule_async( - transport: str = "grpc_asyncio", request_type=service.TriggerScheduleRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.TriggerScheduleRequest(), + {}, + ], +) +async def test_trigger_schedule_async(request_type, transport: str = "grpc_asyncio"): client = NotebookServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10775,7 +10840,7 @@ async def test_trigger_schedule_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.trigger_schedule), "__call__") as call: @@ -10795,11 +10860,6 @@ async def test_trigger_schedule_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_trigger_schedule_async_from_dict(): - await test_trigger_schedule_async(request_type=dict) - - def test_trigger_schedule_field_headers(): client = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10864,8 +10924,8 @@ async def test_trigger_schedule_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.ListExecutionsRequest, - dict, + service.ListExecutionsRequest(), + {}, ], ) def test_list_executions(request_type, transport: str = "grpc"): @@ -10876,7 +10936,7 @@ def test_list_executions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_executions), "__call__") as call: @@ -10925,12 +10985,13 @@ def test_list_executions_non_empty_request_with_auto_populated_field(): client.list_executions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListExecutionsRequest( + request_msg = service.ListExecutionsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_executions_use_cached_wrapped_rpc(): @@ -11011,9 +11072,14 @@ async def test_list_executions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_executions_async( - transport: str = "grpc_asyncio", request_type=service.ListExecutionsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListExecutionsRequest(), + {}, + ], +) +async def test_list_executions_async(request_type, transport: str = "grpc_asyncio"): client = NotebookServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11021,7 +11087,7 @@ async def test_list_executions_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_executions), "__call__") as call: @@ -11046,11 +11112,6 @@ async def test_list_executions_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_executions_async_from_dict(): - await test_list_executions_async(request_type=dict) - - def test_list_executions_field_headers(): client = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11387,8 +11448,8 @@ async def test_list_executions_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetExecutionRequest, - dict, + service.GetExecutionRequest(), + {}, ], ) def test_get_execution(request_type, transport: str = "grpc"): @@ -11399,7 +11460,7 @@ def test_get_execution(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_execution), "__call__") as call: @@ -11453,9 +11514,10 @@ def test_get_execution_non_empty_request_with_auto_populated_field(): client.get_execution(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetExecutionRequest( + request_msg = service.GetExecutionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_execution_use_cached_wrapped_rpc(): @@ -11536,9 +11598,14 @@ async def test_get_execution_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_execution_async( - transport: str = "grpc_asyncio", request_type=service.GetExecutionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetExecutionRequest(), + {}, + ], +) +async def test_get_execution_async(request_type, transport: str = "grpc_asyncio"): client = NotebookServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11546,7 +11613,7 @@ async def test_get_execution_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_execution), "__call__") as call: @@ -11579,11 +11646,6 @@ async def test_get_execution_async( assert response.job_uri == "job_uri_value" -@pytest.mark.asyncio -async def test_get_execution_async_from_dict(): - await test_get_execution_async(request_type=dict) - - def test_get_execution_field_headers(): client = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11726,8 +11788,8 @@ async def test_get_execution_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DeleteExecutionRequest, - dict, + service.DeleteExecutionRequest(), + {}, ], ) def test_delete_execution(request_type, transport: str = "grpc"): @@ -11738,7 +11800,7 @@ def test_delete_execution(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_execution), "__call__") as call: @@ -11779,9 +11841,10 @@ def test_delete_execution_non_empty_request_with_auto_populated_field(): client.delete_execution(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteExecutionRequest( + request_msg = service.DeleteExecutionRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_execution_use_cached_wrapped_rpc(): @@ -11874,9 +11937,14 @@ async def test_delete_execution_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_execution_async( - transport: str = "grpc_asyncio", request_type=service.DeleteExecutionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteExecutionRequest(), + {}, + ], +) +async def test_delete_execution_async(request_type, transport: str = "grpc_asyncio"): client = NotebookServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11884,7 +11952,7 @@ async def test_delete_execution_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_execution), "__call__") as call: @@ -11904,11 +11972,6 @@ async def test_delete_execution_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_execution_async_from_dict(): - await test_delete_execution_async(request_type=dict) - - def test_delete_execution_field_headers(): client = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12055,8 +12118,8 @@ async def test_delete_execution_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.CreateExecutionRequest, - dict, + service.CreateExecutionRequest(), + {}, ], ) def test_create_execution(request_type, transport: str = "grpc"): @@ -12067,7 +12130,7 @@ def test_create_execution(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_execution), "__call__") as call: @@ -12109,10 +12172,11 @@ def test_create_execution_non_empty_request_with_auto_populated_field(): client.create_execution(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateExecutionRequest( + request_msg = service.CreateExecutionRequest( parent="parent_value", execution_id="execution_id_value", ) + assert args[0] == request_msg def test_create_execution_use_cached_wrapped_rpc(): @@ -12205,9 +12269,14 @@ async def test_create_execution_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_execution_async( - transport: str = "grpc_asyncio", request_type=service.CreateExecutionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CreateExecutionRequest(), + {}, + ], +) +async def test_create_execution_async(request_type, transport: str = "grpc_asyncio"): client = NotebookServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12215,7 +12284,7 @@ async def test_create_execution_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_execution), "__call__") as call: @@ -12235,11 +12304,6 @@ async def test_create_execution_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_execution_async_from_dict(): - await test_create_execution_async(request_type=dict) - - def test_create_execution_field_headers(): client = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12549,7 +12613,6 @@ def test_list_instances_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListInstancesRequest() - assert args[0] == request_msg @@ -12570,7 +12633,6 @@ def test_get_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetInstanceRequest() - assert args[0] == request_msg @@ -12591,7 +12653,6 @@ def test_create_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateInstanceRequest() - assert args[0] == request_msg @@ -12614,7 +12675,6 @@ def test_register_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.RegisterInstanceRequest() - assert args[0] == request_msg @@ -12637,7 +12697,6 @@ def test_set_instance_accelerator_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.SetInstanceAcceleratorRequest() - assert args[0] == request_msg @@ -12660,7 +12719,6 @@ def test_set_instance_machine_type_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.SetInstanceMachineTypeRequest() - assert args[0] == request_msg @@ -12683,7 +12741,6 @@ def test_update_instance_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateInstanceConfigRequest() - assert args[0] == request_msg @@ -12706,7 +12763,6 @@ def test_update_shielded_instance_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateShieldedInstanceConfigRequest() - assert args[0] == request_msg @@ -12729,7 +12785,6 @@ def test_set_instance_labels_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.SetInstanceLabelsRequest() - assert args[0] == request_msg @@ -12752,7 +12807,6 @@ def test_update_instance_metadata_items_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateInstanceMetadataItemsRequest() - assert args[0] == request_msg @@ -12773,7 +12827,6 @@ def test_delete_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteInstanceRequest() - assert args[0] == request_msg @@ -12794,7 +12847,6 @@ def test_start_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.StartInstanceRequest() - assert args[0] == request_msg @@ -12815,7 +12867,6 @@ def test_stop_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.StopInstanceRequest() - assert args[0] == request_msg @@ -12836,7 +12887,6 @@ def test_reset_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ResetInstanceRequest() - assert args[0] == request_msg @@ -12859,7 +12909,6 @@ def test_report_instance_info_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ReportInstanceInfoRequest() - assert args[0] == request_msg @@ -12882,7 +12931,6 @@ def test_is_instance_upgradeable_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.IsInstanceUpgradeableRequest() - assert args[0] == request_msg @@ -12905,7 +12953,6 @@ def test_get_instance_health_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetInstanceHealthRequest() - assert args[0] == request_msg @@ -12926,7 +12973,6 @@ def test_upgrade_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpgradeInstanceRequest() - assert args[0] == request_msg @@ -12949,7 +12995,6 @@ def test_rollback_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.RollbackInstanceRequest() - assert args[0] == request_msg @@ -12972,7 +13017,6 @@ def test_diagnose_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DiagnoseInstanceRequest() - assert args[0] == request_msg @@ -12995,7 +13039,6 @@ def test_upgrade_instance_internal_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpgradeInstanceInternalRequest() - assert args[0] == request_msg @@ -13018,7 +13061,6 @@ def test_list_environments_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListEnvironmentsRequest() - assert args[0] == request_msg @@ -13039,7 +13081,6 @@ def test_get_environment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetEnvironmentRequest() - assert args[0] == request_msg @@ -13062,7 +13103,6 @@ def test_create_environment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateEnvironmentRequest() - assert args[0] == request_msg @@ -13085,7 +13125,6 @@ def test_delete_environment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteEnvironmentRequest() - assert args[0] == request_msg @@ -13106,7 +13145,6 @@ def test_list_schedules_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListSchedulesRequest() - assert args[0] == request_msg @@ -13127,7 +13165,6 @@ def test_get_schedule_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetScheduleRequest() - assert args[0] == request_msg @@ -13148,7 +13185,6 @@ def test_delete_schedule_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteScheduleRequest() - assert args[0] == request_msg @@ -13169,7 +13205,6 @@ def test_create_schedule_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateScheduleRequest() - assert args[0] == request_msg @@ -13190,7 +13225,6 @@ def test_trigger_schedule_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.TriggerScheduleRequest() - assert args[0] == request_msg @@ -13211,7 +13245,6 @@ def test_list_executions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListExecutionsRequest() - assert args[0] == request_msg @@ -13232,7 +13265,6 @@ def test_get_execution_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetExecutionRequest() - assert args[0] == request_msg @@ -13253,7 +13285,6 @@ def test_delete_execution_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteExecutionRequest() - assert args[0] == request_msg @@ -13274,7 +13305,6 @@ def test_create_execution_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateExecutionRequest() - assert args[0] == request_msg @@ -13316,7 +13346,6 @@ async def test_list_instances_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListInstancesRequest() - assert args[0] == request_msg @@ -13367,7 +13396,6 @@ async def test_get_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetInstanceRequest() - assert args[0] == request_msg @@ -13392,7 +13420,6 @@ async def test_create_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateInstanceRequest() - assert args[0] == request_msg @@ -13419,7 +13446,6 @@ async def test_register_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.RegisterInstanceRequest() - assert args[0] == request_msg @@ -13446,7 +13472,6 @@ async def test_set_instance_accelerator_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.SetInstanceAcceleratorRequest() - assert args[0] == request_msg @@ -13473,7 +13498,6 @@ async def test_set_instance_machine_type_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.SetInstanceMachineTypeRequest() - assert args[0] == request_msg @@ -13500,7 +13524,6 @@ async def test_update_instance_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateInstanceConfigRequest() - assert args[0] == request_msg @@ -13527,7 +13550,6 @@ async def test_update_shielded_instance_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateShieldedInstanceConfigRequest() - assert args[0] == request_msg @@ -13554,7 +13576,6 @@ async def test_set_instance_labels_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.SetInstanceLabelsRequest() - assert args[0] == request_msg @@ -13581,7 +13602,6 @@ async def test_update_instance_metadata_items_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateInstanceMetadataItemsRequest() - assert args[0] == request_msg @@ -13606,7 +13626,6 @@ async def test_delete_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteInstanceRequest() - assert args[0] == request_msg @@ -13631,7 +13650,6 @@ async def test_start_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.StartInstanceRequest() - assert args[0] == request_msg @@ -13656,7 +13674,6 @@ async def test_stop_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.StopInstanceRequest() - assert args[0] == request_msg @@ -13681,7 +13698,6 @@ async def test_reset_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ResetInstanceRequest() - assert args[0] == request_msg @@ -13708,7 +13724,6 @@ async def test_report_instance_info_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ReportInstanceInfoRequest() - assert args[0] == request_msg @@ -13740,7 +13755,6 @@ async def test_is_instance_upgradeable_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.IsInstanceUpgradeableRequest() - assert args[0] == request_msg @@ -13769,7 +13783,6 @@ async def test_get_instance_health_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetInstanceHealthRequest() - assert args[0] == request_msg @@ -13794,7 +13807,6 @@ async def test_upgrade_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpgradeInstanceRequest() - assert args[0] == request_msg @@ -13821,7 +13833,6 @@ async def test_rollback_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.RollbackInstanceRequest() - assert args[0] == request_msg @@ -13848,7 +13859,6 @@ async def test_diagnose_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DiagnoseInstanceRequest() - assert args[0] == request_msg @@ -13875,7 +13885,6 @@ async def test_upgrade_instance_internal_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpgradeInstanceInternalRequest() - assert args[0] == request_msg @@ -13905,7 +13914,6 @@ async def test_list_environments_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListEnvironmentsRequest() - assert args[0] == request_msg @@ -13935,7 +13943,6 @@ async def test_get_environment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetEnvironmentRequest() - assert args[0] == request_msg @@ -13962,7 +13969,6 @@ async def test_create_environment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateEnvironmentRequest() - assert args[0] == request_msg @@ -13989,7 +13995,6 @@ async def test_delete_environment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteEnvironmentRequest() - assert args[0] == request_msg @@ -14017,7 +14022,6 @@ async def test_list_schedules_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListSchedulesRequest() - assert args[0] == request_msg @@ -14049,7 +14053,6 @@ async def test_get_schedule_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetScheduleRequest() - assert args[0] == request_msg @@ -14074,7 +14077,6 @@ async def test_delete_schedule_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteScheduleRequest() - assert args[0] == request_msg @@ -14099,7 +14101,6 @@ async def test_create_schedule_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateScheduleRequest() - assert args[0] == request_msg @@ -14124,7 +14125,6 @@ async def test_trigger_schedule_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.TriggerScheduleRequest() - assert args[0] == request_msg @@ -14152,7 +14152,6 @@ async def test_list_executions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListExecutionsRequest() - assert args[0] == request_msg @@ -14184,7 +14183,6 @@ async def test_get_execution_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetExecutionRequest() - assert args[0] == request_msg @@ -14209,7 +14207,6 @@ async def test_delete_execution_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteExecutionRequest() - assert args[0] == request_msg @@ -14234,7 +14231,6 @@ async def test_create_execution_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateExecutionRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-notebooks/tests/unit/gapic/notebooks_v1beta1/test_notebook_service.py b/packages/google-cloud-notebooks/tests/unit/gapic/notebooks_v1beta1/test_notebook_service.py index db0de638290c..90349faa2aa6 100644 --- a/packages/google-cloud-notebooks/tests/unit/gapic/notebooks_v1beta1/test_notebook_service.py +++ b/packages/google-cloud-notebooks/tests/unit/gapic/notebooks_v1beta1/test_notebook_service.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 @@ -120,6 +121,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" @@ -1347,8 +1363,8 @@ def test_notebook_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - service.ListInstancesRequest, - dict, + service.ListInstancesRequest(), + {}, ], ) def test_list_instances(request_type, transport: str = "grpc"): @@ -1359,7 +1375,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(type(client.transport.list_instances), "__call__") as call: @@ -1406,10 +1422,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] == service.ListInstancesRequest( + request_msg = service.ListInstancesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_instances_use_cached_wrapped_rpc(): @@ -1490,9 +1507,14 @@ async def test_list_instances_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_instances_async( - transport: str = "grpc_asyncio", request_type=service.ListInstancesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListInstancesRequest(), + {}, + ], +) +async def test_list_instances_async(request_type, transport: str = "grpc_asyncio"): client = NotebookServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1500,7 +1522,7 @@ async def test_list_instances_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_instances), "__call__") as call: @@ -1525,11 +1547,6 @@ async def test_list_instances_async( 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 = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1784,8 +1801,8 @@ async def test_list_instances_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetInstanceRequest, - dict, + service.GetInstanceRequest(), + {}, ], ) def test_get_instance(request_type, transport: str = "grpc"): @@ -1796,7 +1813,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(type(client.transport.get_instance), "__call__") as call: @@ -1882,9 +1899,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] == service.GetInstanceRequest( + request_msg = service.GetInstanceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_instance_use_cached_wrapped_rpc(): @@ -1965,9 +1983,14 @@ async def test_get_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_instance_async( - transport: str = "grpc_asyncio", request_type=service.GetInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetInstanceRequest(), + {}, + ], +) +async def test_get_instance_async(request_type, transport: str = "grpc_asyncio"): client = NotebookServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1975,7 +1998,7 @@ async def test_get_instance_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_instance), "__call__") as call: @@ -2040,11 +2063,6 @@ async def test_get_instance_async( assert response.can_ip_forward is True -@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 = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2107,8 +2125,8 @@ async def test_get_instance_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.CreateInstanceRequest, - dict, + service.CreateInstanceRequest(), + {}, ], ) def test_create_instance(request_type, transport: str = "grpc"): @@ -2119,7 +2137,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(type(client.transport.create_instance), "__call__") as call: @@ -2161,10 +2179,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] == service.CreateInstanceRequest( + request_msg = service.CreateInstanceRequest( parent="parent_value", instance_id="instance_id_value", ) + assert args[0] == request_msg def test_create_instance_use_cached_wrapped_rpc(): @@ -2255,9 +2274,14 @@ async def test_create_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_instance_async( - transport: str = "grpc_asyncio", request_type=service.CreateInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CreateInstanceRequest(), + {}, + ], +) +async def test_create_instance_async(request_type, transport: str = "grpc_asyncio"): client = NotebookServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2265,7 +2289,7 @@ async def test_create_instance_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_instance), "__call__") as call: @@ -2285,11 +2309,6 @@ async def test_create_instance_async( 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 = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2354,8 +2373,8 @@ async def test_create_instance_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.RegisterInstanceRequest, - dict, + service.RegisterInstanceRequest(), + {}, ], ) def test_register_instance(request_type, transport: str = "grpc"): @@ -2366,7 +2385,7 @@ def test_register_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( @@ -2412,10 +2431,11 @@ def test_register_instance_non_empty_request_with_auto_populated_field(): client.register_instance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.RegisterInstanceRequest( + request_msg = service.RegisterInstanceRequest( parent="parent_value", instance_id="instance_id_value", ) + assert args[0] == request_msg def test_register_instance_use_cached_wrapped_rpc(): @@ -2508,9 +2528,14 @@ async def test_register_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_register_instance_async( - transport: str = "grpc_asyncio", request_type=service.RegisterInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.RegisterInstanceRequest(), + {}, + ], +) +async def test_register_instance_async(request_type, transport: str = "grpc_asyncio"): client = NotebookServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2518,7 +2543,7 @@ async def test_register_instance_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( @@ -2540,11 +2565,6 @@ async def test_register_instance_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_register_instance_async_from_dict(): - await test_register_instance_async(request_type=dict) - - def test_register_instance_field_headers(): client = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2613,8 +2633,8 @@ async def test_register_instance_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.SetInstanceAcceleratorRequest, - dict, + service.SetInstanceAcceleratorRequest(), + {}, ], ) def test_set_instance_accelerator(request_type, transport: str = "grpc"): @@ -2625,7 +2645,7 @@ def test_set_instance_accelerator(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2670,9 +2690,10 @@ def test_set_instance_accelerator_non_empty_request_with_auto_populated_field(): client.set_instance_accelerator(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.SetInstanceAcceleratorRequest( + request_msg = service.SetInstanceAcceleratorRequest( name="name_value", ) + assert args[0] == request_msg def test_set_instance_accelerator_use_cached_wrapped_rpc(): @@ -2768,8 +2789,15 @@ async def test_set_instance_accelerator_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.SetInstanceAcceleratorRequest(), + {}, + ], +) async def test_set_instance_accelerator_async( - transport: str = "grpc_asyncio", request_type=service.SetInstanceAcceleratorRequest + request_type, transport: str = "grpc_asyncio" ): client = NotebookServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2778,7 +2806,7 @@ async def test_set_instance_accelerator_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( @@ -2800,11 +2828,6 @@ async def test_set_instance_accelerator_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_set_instance_accelerator_async_from_dict(): - await test_set_instance_accelerator_async(request_type=dict) - - def test_set_instance_accelerator_field_headers(): client = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2873,8 +2896,8 @@ async def test_set_instance_accelerator_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.SetInstanceMachineTypeRequest, - dict, + service.SetInstanceMachineTypeRequest(), + {}, ], ) def test_set_instance_machine_type(request_type, transport: str = "grpc"): @@ -2885,7 +2908,7 @@ def test_set_instance_machine_type(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2931,10 +2954,11 @@ def test_set_instance_machine_type_non_empty_request_with_auto_populated_field() client.set_instance_machine_type(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.SetInstanceMachineTypeRequest( + request_msg = service.SetInstanceMachineTypeRequest( name="name_value", machine_type="machine_type_value", ) + assert args[0] == request_msg def test_set_instance_machine_type_use_cached_wrapped_rpc(): @@ -3030,8 +3054,15 @@ async def test_set_instance_machine_type_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.SetInstanceMachineTypeRequest(), + {}, + ], +) async def test_set_instance_machine_type_async( - transport: str = "grpc_asyncio", request_type=service.SetInstanceMachineTypeRequest + request_type, transport: str = "grpc_asyncio" ): client = NotebookServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3040,7 +3071,7 @@ async def test_set_instance_machine_type_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( @@ -3062,11 +3093,6 @@ async def test_set_instance_machine_type_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_set_instance_machine_type_async_from_dict(): - await test_set_instance_machine_type_async(request_type=dict) - - def test_set_instance_machine_type_field_headers(): client = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3135,8 +3161,8 @@ async def test_set_instance_machine_type_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.SetInstanceLabelsRequest, - dict, + service.SetInstanceLabelsRequest(), + {}, ], ) def test_set_instance_labels(request_type, transport: str = "grpc"): @@ -3147,7 +3173,7 @@ def test_set_instance_labels(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3192,9 +3218,10 @@ def test_set_instance_labels_non_empty_request_with_auto_populated_field(): client.set_instance_labels(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.SetInstanceLabelsRequest( + request_msg = service.SetInstanceLabelsRequest( name="name_value", ) + assert args[0] == request_msg def test_set_instance_labels_use_cached_wrapped_rpc(): @@ -3289,9 +3316,14 @@ async def test_set_instance_labels_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_instance_labels_async( - transport: str = "grpc_asyncio", request_type=service.SetInstanceLabelsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.SetInstanceLabelsRequest(), + {}, + ], +) +async def test_set_instance_labels_async(request_type, transport: str = "grpc_asyncio"): client = NotebookServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3299,7 +3331,7 @@ async def test_set_instance_labels_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( @@ -3321,11 +3353,6 @@ async def test_set_instance_labels_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_set_instance_labels_async_from_dict(): - await test_set_instance_labels_async(request_type=dict) - - def test_set_instance_labels_field_headers(): client = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3394,8 +3421,8 @@ async def test_set_instance_labels_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.DeleteInstanceRequest, - dict, + service.DeleteInstanceRequest(), + {}, ], ) def test_delete_instance(request_type, transport: str = "grpc"): @@ -3406,7 +3433,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(type(client.transport.delete_instance), "__call__") as call: @@ -3447,9 +3474,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] == service.DeleteInstanceRequest( + request_msg = service.DeleteInstanceRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_instance_use_cached_wrapped_rpc(): @@ -3540,9 +3568,14 @@ async def test_delete_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_instance_async( - transport: str = "grpc_asyncio", request_type=service.DeleteInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteInstanceRequest(), + {}, + ], +) +async def test_delete_instance_async(request_type, transport: str = "grpc_asyncio"): client = NotebookServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3550,7 +3583,7 @@ async def test_delete_instance_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_instance), "__call__") as call: @@ -3570,11 +3603,6 @@ async def test_delete_instance_async( 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 = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3639,8 +3667,8 @@ async def test_delete_instance_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.StartInstanceRequest, - dict, + service.StartInstanceRequest(), + {}, ], ) def test_start_instance(request_type, transport: str = "grpc"): @@ -3651,7 +3679,7 @@ def test_start_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(type(client.transport.start_instance), "__call__") as call: @@ -3692,9 +3720,10 @@ def test_start_instance_non_empty_request_with_auto_populated_field(): client.start_instance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.StartInstanceRequest( + request_msg = service.StartInstanceRequest( name="name_value", ) + assert args[0] == request_msg def test_start_instance_use_cached_wrapped_rpc(): @@ -3785,9 +3814,14 @@ async def test_start_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_start_instance_async( - transport: str = "grpc_asyncio", request_type=service.StartInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.StartInstanceRequest(), + {}, + ], +) +async def test_start_instance_async(request_type, transport: str = "grpc_asyncio"): client = NotebookServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3795,7 +3829,7 @@ async def test_start_instance_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.start_instance), "__call__") as call: @@ -3815,11 +3849,6 @@ async def test_start_instance_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_start_instance_async_from_dict(): - await test_start_instance_async(request_type=dict) - - def test_start_instance_field_headers(): client = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3884,8 +3913,8 @@ async def test_start_instance_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.StopInstanceRequest, - dict, + service.StopInstanceRequest(), + {}, ], ) def test_stop_instance(request_type, transport: str = "grpc"): @@ -3896,7 +3925,7 @@ def test_stop_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(type(client.transport.stop_instance), "__call__") as call: @@ -3937,9 +3966,10 @@ def test_stop_instance_non_empty_request_with_auto_populated_field(): client.stop_instance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.StopInstanceRequest( + request_msg = service.StopInstanceRequest( name="name_value", ) + assert args[0] == request_msg def test_stop_instance_use_cached_wrapped_rpc(): @@ -4030,9 +4060,14 @@ async def test_stop_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_stop_instance_async( - transport: str = "grpc_asyncio", request_type=service.StopInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.StopInstanceRequest(), + {}, + ], +) +async def test_stop_instance_async(request_type, transport: str = "grpc_asyncio"): client = NotebookServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4040,7 +4075,7 @@ async def test_stop_instance_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.stop_instance), "__call__") as call: @@ -4060,11 +4095,6 @@ async def test_stop_instance_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_stop_instance_async_from_dict(): - await test_stop_instance_async(request_type=dict) - - def test_stop_instance_field_headers(): client = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4129,8 +4159,8 @@ async def test_stop_instance_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.ResetInstanceRequest, - dict, + service.ResetInstanceRequest(), + {}, ], ) def test_reset_instance(request_type, transport: str = "grpc"): @@ -4141,7 +4171,7 @@ def test_reset_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(type(client.transport.reset_instance), "__call__") as call: @@ -4182,9 +4212,10 @@ def test_reset_instance_non_empty_request_with_auto_populated_field(): client.reset_instance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ResetInstanceRequest( + request_msg = service.ResetInstanceRequest( name="name_value", ) + assert args[0] == request_msg def test_reset_instance_use_cached_wrapped_rpc(): @@ -4275,9 +4306,14 @@ async def test_reset_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_reset_instance_async( - transport: str = "grpc_asyncio", request_type=service.ResetInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ResetInstanceRequest(), + {}, + ], +) +async def test_reset_instance_async(request_type, transport: str = "grpc_asyncio"): client = NotebookServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4285,7 +4321,7 @@ async def test_reset_instance_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.reset_instance), "__call__") as call: @@ -4305,11 +4341,6 @@ async def test_reset_instance_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_reset_instance_async_from_dict(): - await test_reset_instance_async(request_type=dict) - - def test_reset_instance_field_headers(): client = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4374,8 +4405,8 @@ async def test_reset_instance_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.ReportInstanceInfoRequest, - dict, + service.ReportInstanceInfoRequest(), + {}, ], ) def test_report_instance_info(request_type, transport: str = "grpc"): @@ -4386,7 +4417,7 @@ def test_report_instance_info(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4432,10 +4463,11 @@ def test_report_instance_info_non_empty_request_with_auto_populated_field(): client.report_instance_info(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ReportInstanceInfoRequest( + request_msg = service.ReportInstanceInfoRequest( name="name_value", vm_id="vm_id_value", ) + assert args[0] == request_msg def test_report_instance_info_use_cached_wrapped_rpc(): @@ -4530,8 +4562,15 @@ async def test_report_instance_info_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.ReportInstanceInfoRequest(), + {}, + ], +) async def test_report_instance_info_async( - transport: str = "grpc_asyncio", request_type=service.ReportInstanceInfoRequest + request_type, transport: str = "grpc_asyncio" ): client = NotebookServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4540,7 +4579,7 @@ async def test_report_instance_info_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( @@ -4562,11 +4601,6 @@ async def test_report_instance_info_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_report_instance_info_async_from_dict(): - await test_report_instance_info_async(request_type=dict) - - def test_report_instance_info_field_headers(): client = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4635,8 +4669,8 @@ async def test_report_instance_info_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.IsInstanceUpgradeableRequest, - dict, + service.IsInstanceUpgradeableRequest(), + {}, ], ) def test_is_instance_upgradeable(request_type, transport: str = "grpc"): @@ -4647,7 +4681,7 @@ def test_is_instance_upgradeable(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4701,9 +4735,10 @@ def test_is_instance_upgradeable_non_empty_request_with_auto_populated_field(): client.is_instance_upgradeable(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.IsInstanceUpgradeableRequest( + request_msg = service.IsInstanceUpgradeableRequest( notebook_instance="notebook_instance_value", ) + assert args[0] == request_msg def test_is_instance_upgradeable_use_cached_wrapped_rpc(): @@ -4789,8 +4824,15 @@ async def test_is_instance_upgradeable_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.IsInstanceUpgradeableRequest(), + {}, + ], +) async def test_is_instance_upgradeable_async( - transport: str = "grpc_asyncio", request_type=service.IsInstanceUpgradeableRequest + request_type, transport: str = "grpc_asyncio" ): client = NotebookServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4799,7 +4841,7 @@ async def test_is_instance_upgradeable_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( @@ -4830,11 +4872,6 @@ async def test_is_instance_upgradeable_async( assert response.upgrade_image == "upgrade_image_value" -@pytest.mark.asyncio -async def test_is_instance_upgradeable_async_from_dict(): - await test_is_instance_upgradeable_async(request_type=dict) - - def test_is_instance_upgradeable_field_headers(): client = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4903,8 +4940,8 @@ async def test_is_instance_upgradeable_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.UpgradeInstanceRequest, - dict, + service.UpgradeInstanceRequest(), + {}, ], ) def test_upgrade_instance(request_type, transport: str = "grpc"): @@ -4915,7 +4952,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(type(client.transport.upgrade_instance), "__call__") as call: @@ -4956,9 +4993,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] - assert args[0] == service.UpgradeInstanceRequest( + request_msg = service.UpgradeInstanceRequest( name="name_value", ) + assert args[0] == request_msg def test_upgrade_instance_use_cached_wrapped_rpc(): @@ -5051,9 +5089,14 @@ async def test_upgrade_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_upgrade_instance_async( - transport: str = "grpc_asyncio", request_type=service.UpgradeInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.UpgradeInstanceRequest(), + {}, + ], +) +async def test_upgrade_instance_async(request_type, transport: str = "grpc_asyncio"): client = NotebookServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5061,7 +5104,7 @@ async def test_upgrade_instance_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.upgrade_instance), "__call__") as call: @@ -5081,11 +5124,6 @@ async def test_upgrade_instance_async( 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 = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5150,8 +5188,8 @@ async def test_upgrade_instance_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.UpgradeInstanceInternalRequest, - dict, + service.UpgradeInstanceInternalRequest(), + {}, ], ) def test_upgrade_instance_internal(request_type, transport: str = "grpc"): @@ -5162,7 +5200,7 @@ def test_upgrade_instance_internal(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5208,10 +5246,11 @@ def test_upgrade_instance_internal_non_empty_request_with_auto_populated_field() client.upgrade_instance_internal(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpgradeInstanceInternalRequest( + request_msg = service.UpgradeInstanceInternalRequest( name="name_value", vm_id="vm_id_value", ) + assert args[0] == request_msg def test_upgrade_instance_internal_use_cached_wrapped_rpc(): @@ -5307,8 +5346,15 @@ async def test_upgrade_instance_internal_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.UpgradeInstanceInternalRequest(), + {}, + ], +) async def test_upgrade_instance_internal_async( - transport: str = "grpc_asyncio", request_type=service.UpgradeInstanceInternalRequest + request_type, transport: str = "grpc_asyncio" ): client = NotebookServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5317,7 +5363,7 @@ async def test_upgrade_instance_internal_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( @@ -5339,11 +5385,6 @@ async def test_upgrade_instance_internal_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_upgrade_instance_internal_async_from_dict(): - await test_upgrade_instance_internal_async(request_type=dict) - - def test_upgrade_instance_internal_field_headers(): client = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5412,8 +5453,8 @@ async def test_upgrade_instance_internal_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.ListEnvironmentsRequest, - dict, + service.ListEnvironmentsRequest(), + {}, ], ) def test_list_environments(request_type, transport: str = "grpc"): @@ -5424,7 +5465,7 @@ def test_list_environments(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5475,10 +5516,11 @@ def test_list_environments_non_empty_request_with_auto_populated_field(): client.list_environments(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListEnvironmentsRequest( + request_msg = service.ListEnvironmentsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_environments_use_cached_wrapped_rpc(): @@ -5561,9 +5603,14 @@ async def test_list_environments_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_environments_async( - transport: str = "grpc_asyncio", request_type=service.ListEnvironmentsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListEnvironmentsRequest(), + {}, + ], +) +async def test_list_environments_async(request_type, transport: str = "grpc_asyncio"): client = NotebookServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5571,7 +5618,7 @@ async def test_list_environments_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( @@ -5598,11 +5645,6 @@ async def test_list_environments_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_environments_async_from_dict(): - await test_list_environments_async(request_type=dict) - - def test_list_environments_field_headers(): client = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5869,8 +5911,8 @@ async def test_list_environments_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetEnvironmentRequest, - dict, + service.GetEnvironmentRequest(), + {}, ], ) def test_get_environment(request_type, transport: str = "grpc"): @@ -5881,7 +5923,7 @@ def test_get_environment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_environment), "__call__") as call: @@ -5931,9 +5973,10 @@ def test_get_environment_non_empty_request_with_auto_populated_field(): client.get_environment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetEnvironmentRequest( + request_msg = service.GetEnvironmentRequest( name="name_value", ) + assert args[0] == request_msg def test_get_environment_use_cached_wrapped_rpc(): @@ -6014,9 +6057,14 @@ async def test_get_environment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_environment_async( - transport: str = "grpc_asyncio", request_type=service.GetEnvironmentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetEnvironmentRequest(), + {}, + ], +) +async def test_get_environment_async(request_type, transport: str = "grpc_asyncio"): client = NotebookServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6024,7 +6072,7 @@ async def test_get_environment_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_environment), "__call__") as call: @@ -6053,11 +6101,6 @@ async def test_get_environment_async( assert response.post_startup_script == "post_startup_script_value" -@pytest.mark.asyncio -async def test_get_environment_async_from_dict(): - await test_get_environment_async(request_type=dict) - - def test_get_environment_field_headers(): client = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6122,8 +6165,8 @@ async def test_get_environment_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.CreateEnvironmentRequest, - dict, + service.CreateEnvironmentRequest(), + {}, ], ) def test_create_environment(request_type, transport: str = "grpc"): @@ -6134,7 +6177,7 @@ def test_create_environment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6180,10 +6223,11 @@ def test_create_environment_non_empty_request_with_auto_populated_field(): client.create_environment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateEnvironmentRequest( + request_msg = service.CreateEnvironmentRequest( parent="parent_value", environment_id="environment_id_value", ) + assert args[0] == request_msg def test_create_environment_use_cached_wrapped_rpc(): @@ -6278,9 +6322,14 @@ async def test_create_environment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_environment_async( - transport: str = "grpc_asyncio", request_type=service.CreateEnvironmentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CreateEnvironmentRequest(), + {}, + ], +) +async def test_create_environment_async(request_type, transport: str = "grpc_asyncio"): client = NotebookServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6288,7 +6337,7 @@ async def test_create_environment_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( @@ -6310,11 +6359,6 @@ async def test_create_environment_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_environment_async_from_dict(): - await test_create_environment_async(request_type=dict) - - def test_create_environment_field_headers(): client = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6383,8 +6427,8 @@ async def test_create_environment_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.DeleteEnvironmentRequest, - dict, + service.DeleteEnvironmentRequest(), + {}, ], ) def test_delete_environment(request_type, transport: str = "grpc"): @@ -6395,7 +6439,7 @@ def test_delete_environment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6440,9 +6484,10 @@ def test_delete_environment_non_empty_request_with_auto_populated_field(): client.delete_environment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteEnvironmentRequest( + request_msg = service.DeleteEnvironmentRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_environment_use_cached_wrapped_rpc(): @@ -6537,9 +6582,14 @@ async def test_delete_environment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_environment_async( - transport: str = "grpc_asyncio", request_type=service.DeleteEnvironmentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteEnvironmentRequest(), + {}, + ], +) +async def test_delete_environment_async(request_type, transport: str = "grpc_asyncio"): client = NotebookServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6547,7 +6597,7 @@ async def test_delete_environment_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( @@ -6569,11 +6619,6 @@ async def test_delete_environment_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_environment_async_from_dict(): - await test_delete_environment_async(request_type=dict) - - def test_delete_environment_field_headers(): client = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9361,7 +9406,6 @@ def test_list_instances_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListInstancesRequest() - assert args[0] == request_msg @@ -9382,7 +9426,6 @@ def test_get_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetInstanceRequest() - assert args[0] == request_msg @@ -9403,7 +9446,6 @@ def test_create_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateInstanceRequest() - assert args[0] == request_msg @@ -9426,7 +9468,6 @@ def test_register_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.RegisterInstanceRequest() - assert args[0] == request_msg @@ -9449,7 +9490,6 @@ def test_set_instance_accelerator_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.SetInstanceAcceleratorRequest() - assert args[0] == request_msg @@ -9472,7 +9512,6 @@ def test_set_instance_machine_type_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.SetInstanceMachineTypeRequest() - assert args[0] == request_msg @@ -9495,7 +9534,6 @@ def test_set_instance_labels_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.SetInstanceLabelsRequest() - assert args[0] == request_msg @@ -9516,7 +9554,6 @@ def test_delete_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteInstanceRequest() - assert args[0] == request_msg @@ -9537,7 +9574,6 @@ def test_start_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.StartInstanceRequest() - assert args[0] == request_msg @@ -9558,7 +9594,6 @@ def test_stop_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.StopInstanceRequest() - assert args[0] == request_msg @@ -9579,7 +9614,6 @@ def test_reset_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ResetInstanceRequest() - assert args[0] == request_msg @@ -9602,7 +9636,6 @@ def test_report_instance_info_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ReportInstanceInfoRequest() - assert args[0] == request_msg @@ -9625,7 +9658,6 @@ def test_is_instance_upgradeable_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.IsInstanceUpgradeableRequest() - assert args[0] == request_msg @@ -9646,7 +9678,6 @@ def test_upgrade_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpgradeInstanceRequest() - assert args[0] == request_msg @@ -9669,7 +9700,6 @@ def test_upgrade_instance_internal_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpgradeInstanceInternalRequest() - assert args[0] == request_msg @@ -9692,7 +9722,6 @@ def test_list_environments_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListEnvironmentsRequest() - assert args[0] == request_msg @@ -9713,7 +9742,6 @@ def test_get_environment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetEnvironmentRequest() - assert args[0] == request_msg @@ -9736,7 +9764,6 @@ def test_create_environment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateEnvironmentRequest() - assert args[0] == request_msg @@ -9759,7 +9786,6 @@ def test_delete_environment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteEnvironmentRequest() - assert args[0] == request_msg @@ -9801,7 +9827,6 @@ async def test_list_instances_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListInstancesRequest() - assert args[0] == request_msg @@ -9849,7 +9874,6 @@ async def test_get_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetInstanceRequest() - assert args[0] == request_msg @@ -9874,7 +9898,6 @@ async def test_create_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateInstanceRequest() - assert args[0] == request_msg @@ -9901,7 +9924,6 @@ async def test_register_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.RegisterInstanceRequest() - assert args[0] == request_msg @@ -9928,7 +9950,6 @@ async def test_set_instance_accelerator_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.SetInstanceAcceleratorRequest() - assert args[0] == request_msg @@ -9955,7 +9976,6 @@ async def test_set_instance_machine_type_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.SetInstanceMachineTypeRequest() - assert args[0] == request_msg @@ -9982,7 +10002,6 @@ async def test_set_instance_labels_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.SetInstanceLabelsRequest() - assert args[0] == request_msg @@ -10007,7 +10026,6 @@ async def test_delete_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteInstanceRequest() - assert args[0] == request_msg @@ -10032,7 +10050,6 @@ async def test_start_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.StartInstanceRequest() - assert args[0] == request_msg @@ -10057,7 +10074,6 @@ async def test_stop_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.StopInstanceRequest() - assert args[0] == request_msg @@ -10082,7 +10098,6 @@ async def test_reset_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ResetInstanceRequest() - assert args[0] == request_msg @@ -10109,7 +10124,6 @@ async def test_report_instance_info_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ReportInstanceInfoRequest() - assert args[0] == request_msg @@ -10141,7 +10155,6 @@ async def test_is_instance_upgradeable_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.IsInstanceUpgradeableRequest() - assert args[0] == request_msg @@ -10166,7 +10179,6 @@ async def test_upgrade_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpgradeInstanceRequest() - assert args[0] == request_msg @@ -10193,7 +10205,6 @@ async def test_upgrade_instance_internal_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpgradeInstanceInternalRequest() - assert args[0] == request_msg @@ -10223,7 +10234,6 @@ async def test_list_environments_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListEnvironmentsRequest() - assert args[0] == request_msg @@ -10253,7 +10263,6 @@ async def test_get_environment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetEnvironmentRequest() - assert args[0] == request_msg @@ -10280,7 +10289,6 @@ async def test_create_environment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateEnvironmentRequest() - assert args[0] == request_msg @@ -10307,7 +10315,6 @@ async def test_delete_environment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteEnvironmentRequest() - assert args[0] == request_msg @@ -13544,7 +13551,6 @@ def test_list_instances_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListInstancesRequest() - assert args[0] == request_msg @@ -13564,7 +13570,6 @@ def test_get_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetInstanceRequest() - assert args[0] == request_msg @@ -13584,7 +13589,6 @@ def test_create_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateInstanceRequest() - assert args[0] == request_msg @@ -13606,7 +13610,6 @@ def test_register_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.RegisterInstanceRequest() - assert args[0] == request_msg @@ -13628,7 +13631,6 @@ def test_set_instance_accelerator_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.SetInstanceAcceleratorRequest() - assert args[0] == request_msg @@ -13650,7 +13652,6 @@ def test_set_instance_machine_type_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.SetInstanceMachineTypeRequest() - assert args[0] == request_msg @@ -13672,7 +13673,6 @@ def test_set_instance_labels_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.SetInstanceLabelsRequest() - assert args[0] == request_msg @@ -13692,7 +13692,6 @@ def test_delete_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteInstanceRequest() - assert args[0] == request_msg @@ -13712,7 +13711,6 @@ def test_start_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.StartInstanceRequest() - assert args[0] == request_msg @@ -13732,7 +13730,6 @@ def test_stop_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.StopInstanceRequest() - assert args[0] == request_msg @@ -13752,7 +13749,6 @@ def test_reset_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ResetInstanceRequest() - assert args[0] == request_msg @@ -13774,7 +13770,6 @@ def test_report_instance_info_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ReportInstanceInfoRequest() - assert args[0] == request_msg @@ -13796,7 +13791,6 @@ def test_is_instance_upgradeable_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.IsInstanceUpgradeableRequest() - assert args[0] == request_msg @@ -13816,7 +13810,6 @@ def test_upgrade_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpgradeInstanceRequest() - assert args[0] == request_msg @@ -13838,7 +13831,6 @@ def test_upgrade_instance_internal_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpgradeInstanceInternalRequest() - assert args[0] == request_msg @@ -13860,7 +13852,6 @@ def test_list_environments_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListEnvironmentsRequest() - assert args[0] == request_msg @@ -13880,7 +13871,6 @@ def test_get_environment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetEnvironmentRequest() - assert args[0] == request_msg @@ -13902,7 +13892,6 @@ def test_create_environment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateEnvironmentRequest() - assert args[0] == request_msg @@ -13924,7 +13913,6 @@ def test_delete_environment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteEnvironmentRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-notebooks/tests/unit/gapic/notebooks_v2/test_notebook_service.py b/packages/google-cloud-notebooks/tests/unit/gapic/notebooks_v2/test_notebook_service.py index 27c0cb729f83..32a2efc44346 100644 --- a/packages/google-cloud-notebooks/tests/unit/gapic/notebooks_v2/test_notebook_service.py +++ b/packages/google-cloud-notebooks/tests/unit/gapic/notebooks_v2/test_notebook_service.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 @@ -123,6 +124,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" @@ -1350,8 +1366,8 @@ def test_notebook_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - service.ListInstancesRequest, - dict, + service.ListInstancesRequest(), + {}, ], ) def test_list_instances(request_type, transport: str = "grpc"): @@ -1362,7 +1378,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(type(client.transport.list_instances), "__call__") as call: @@ -1411,12 +1427,13 @@ 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] == service.ListInstancesRequest( + request_msg = service.ListInstancesRequest( parent="parent_value", page_token="page_token_value", order_by="order_by_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_instances_use_cached_wrapped_rpc(): @@ -1497,9 +1514,14 @@ async def test_list_instances_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_instances_async( - transport: str = "grpc_asyncio", request_type=service.ListInstancesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListInstancesRequest(), + {}, + ], +) +async def test_list_instances_async(request_type, transport: str = "grpc_asyncio"): client = NotebookServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1507,7 +1529,7 @@ async def test_list_instances_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_instances), "__call__") as call: @@ -1532,11 +1554,6 @@ async def test_list_instances_async( 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 = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1873,8 +1890,8 @@ async def test_list_instances_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetInstanceRequest, - dict, + service.GetInstanceRequest(), + {}, ], ) def test_get_instance(request_type, transport: str = "grpc"): @@ -1885,7 +1902,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(type(client.transport.get_instance), "__call__") as call: @@ -1943,9 +1960,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] == service.GetInstanceRequest( + request_msg = service.GetInstanceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_instance_use_cached_wrapped_rpc(): @@ -2026,9 +2044,14 @@ async def test_get_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_instance_async( - transport: str = "grpc_asyncio", request_type=service.GetInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetInstanceRequest(), + {}, + ], +) +async def test_get_instance_async(request_type, transport: str = "grpc_asyncio"): client = NotebookServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2036,7 +2059,7 @@ async def test_get_instance_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_instance), "__call__") as call: @@ -2073,11 +2096,6 @@ async def test_get_instance_async( assert response.disable_proxy_access is True -@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 = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2220,8 +2238,8 @@ async def test_get_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.CreateInstanceRequest, - dict, + service.CreateInstanceRequest(), + {}, ], ) def test_create_instance(request_type, transport: str = "grpc"): @@ -2232,7 +2250,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(type(client.transport.create_instance), "__call__") as call: @@ -2275,11 +2293,12 @@ 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] == service.CreateInstanceRequest( + request_msg = service.CreateInstanceRequest( parent="parent_value", instance_id="instance_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_instance_use_cached_wrapped_rpc(): @@ -2370,9 +2389,14 @@ async def test_create_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_instance_async( - transport: str = "grpc_asyncio", request_type=service.CreateInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CreateInstanceRequest(), + {}, + ], +) +async def test_create_instance_async(request_type, transport: str = "grpc_asyncio"): client = NotebookServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2380,7 +2404,7 @@ async def test_create_instance_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_instance), "__call__") as call: @@ -2400,11 +2424,6 @@ async def test_create_instance_async( 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 = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2571,8 +2590,8 @@ async def test_create_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdateInstanceRequest, - dict, + service.UpdateInstanceRequest(), + {}, ], ) def test_update_instance(request_type, transport: str = "grpc"): @@ -2583,7 +2602,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(type(client.transport.update_instance), "__call__") as call: @@ -2624,9 +2643,10 @@ 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] == service.UpdateInstanceRequest( + request_msg = service.UpdateInstanceRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_instance_use_cached_wrapped_rpc(): @@ -2717,9 +2737,14 @@ async def test_update_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_instance_async( - transport: str = "grpc_asyncio", request_type=service.UpdateInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateInstanceRequest(), + {}, + ], +) +async def test_update_instance_async(request_type, transport: str = "grpc_asyncio"): client = NotebookServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2727,7 +2752,7 @@ async def test_update_instance_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_instance), "__call__") as call: @@ -2747,11 +2772,6 @@ async def test_update_instance_async( 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 = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2908,8 +2928,8 @@ async def test_update_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DeleteInstanceRequest, - dict, + service.DeleteInstanceRequest(), + {}, ], ) def test_delete_instance(request_type, transport: str = "grpc"): @@ -2920,7 +2940,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(type(client.transport.delete_instance), "__call__") as call: @@ -2962,10 +2982,11 @@ 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] == service.DeleteInstanceRequest( + request_msg = service.DeleteInstanceRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_instance_use_cached_wrapped_rpc(): @@ -3056,9 +3077,14 @@ async def test_delete_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_instance_async( - transport: str = "grpc_asyncio", request_type=service.DeleteInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteInstanceRequest(), + {}, + ], +) +async def test_delete_instance_async(request_type, transport: str = "grpc_asyncio"): client = NotebookServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3066,7 +3092,7 @@ async def test_delete_instance_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_instance), "__call__") as call: @@ -3086,11 +3112,6 @@ async def test_delete_instance_async( 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 = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3237,8 +3258,8 @@ async def test_delete_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.StartInstanceRequest, - dict, + service.StartInstanceRequest(), + {}, ], ) def test_start_instance(request_type, transport: str = "grpc"): @@ -3249,7 +3270,7 @@ def test_start_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(type(client.transport.start_instance), "__call__") as call: @@ -3290,9 +3311,10 @@ def test_start_instance_non_empty_request_with_auto_populated_field(): client.start_instance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.StartInstanceRequest( + request_msg = service.StartInstanceRequest( name="name_value", ) + assert args[0] == request_msg def test_start_instance_use_cached_wrapped_rpc(): @@ -3383,9 +3405,14 @@ async def test_start_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_start_instance_async( - transport: str = "grpc_asyncio", request_type=service.StartInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.StartInstanceRequest(), + {}, + ], +) +async def test_start_instance_async(request_type, transport: str = "grpc_asyncio"): client = NotebookServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3393,7 +3420,7 @@ async def test_start_instance_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.start_instance), "__call__") as call: @@ -3413,11 +3440,6 @@ async def test_start_instance_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_start_instance_async_from_dict(): - await test_start_instance_async(request_type=dict) - - def test_start_instance_field_headers(): client = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3482,8 +3504,8 @@ async def test_start_instance_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.StopInstanceRequest, - dict, + service.StopInstanceRequest(), + {}, ], ) def test_stop_instance(request_type, transport: str = "grpc"): @@ -3494,7 +3516,7 @@ def test_stop_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(type(client.transport.stop_instance), "__call__") as call: @@ -3535,9 +3557,10 @@ def test_stop_instance_non_empty_request_with_auto_populated_field(): client.stop_instance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.StopInstanceRequest( + request_msg = service.StopInstanceRequest( name="name_value", ) + assert args[0] == request_msg def test_stop_instance_use_cached_wrapped_rpc(): @@ -3628,9 +3651,14 @@ async def test_stop_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_stop_instance_async( - transport: str = "grpc_asyncio", request_type=service.StopInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.StopInstanceRequest(), + {}, + ], +) +async def test_stop_instance_async(request_type, transport: str = "grpc_asyncio"): client = NotebookServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3638,7 +3666,7 @@ async def test_stop_instance_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.stop_instance), "__call__") as call: @@ -3658,11 +3686,6 @@ async def test_stop_instance_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_stop_instance_async_from_dict(): - await test_stop_instance_async(request_type=dict) - - def test_stop_instance_field_headers(): client = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3727,8 +3750,8 @@ async def test_stop_instance_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.ResetInstanceRequest, - dict, + service.ResetInstanceRequest(), + {}, ], ) def test_reset_instance(request_type, transport: str = "grpc"): @@ -3739,7 +3762,7 @@ def test_reset_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(type(client.transport.reset_instance), "__call__") as call: @@ -3780,9 +3803,10 @@ def test_reset_instance_non_empty_request_with_auto_populated_field(): client.reset_instance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ResetInstanceRequest( + request_msg = service.ResetInstanceRequest( name="name_value", ) + assert args[0] == request_msg def test_reset_instance_use_cached_wrapped_rpc(): @@ -3873,9 +3897,14 @@ async def test_reset_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_reset_instance_async( - transport: str = "grpc_asyncio", request_type=service.ResetInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ResetInstanceRequest(), + {}, + ], +) +async def test_reset_instance_async(request_type, transport: str = "grpc_asyncio"): client = NotebookServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3883,7 +3912,7 @@ async def test_reset_instance_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.reset_instance), "__call__") as call: @@ -3903,11 +3932,6 @@ async def test_reset_instance_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_reset_instance_async_from_dict(): - await test_reset_instance_async(request_type=dict) - - def test_reset_instance_field_headers(): client = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3972,8 +3996,8 @@ async def test_reset_instance_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.CheckInstanceUpgradabilityRequest, - dict, + service.CheckInstanceUpgradabilityRequest(), + {}, ], ) def test_check_instance_upgradability(request_type, transport: str = "grpc"): @@ -3984,7 +4008,7 @@ def test_check_instance_upgradability(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,9 +4062,10 @@ def test_check_instance_upgradability_non_empty_request_with_auto_populated_fiel client.check_instance_upgradability(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CheckInstanceUpgradabilityRequest( + request_msg = service.CheckInstanceUpgradabilityRequest( notebook_instance="notebook_instance_value", ) + assert args[0] == request_msg def test_check_instance_upgradability_use_cached_wrapped_rpc(): @@ -4126,9 +4151,15 @@ async def test_check_instance_upgradability_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.CheckInstanceUpgradabilityRequest(), + {}, + ], +) async def test_check_instance_upgradability_async( - transport: str = "grpc_asyncio", - request_type=service.CheckInstanceUpgradabilityRequest, + request_type, transport: str = "grpc_asyncio" ): client = NotebookServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4137,7 +4168,7 @@ async def test_check_instance_upgradability_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( @@ -4168,11 +4199,6 @@ async def test_check_instance_upgradability_async( assert response.upgrade_image == "upgrade_image_value" -@pytest.mark.asyncio -async def test_check_instance_upgradability_async_from_dict(): - await test_check_instance_upgradability_async(request_type=dict) - - def test_check_instance_upgradability_field_headers(): client = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4241,8 +4267,8 @@ async def test_check_instance_upgradability_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.UpgradeInstanceRequest, - dict, + service.UpgradeInstanceRequest(), + {}, ], ) def test_upgrade_instance(request_type, transport: str = "grpc"): @@ -4253,7 +4279,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(type(client.transport.upgrade_instance), "__call__") as call: @@ -4294,9 +4320,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] - assert args[0] == service.UpgradeInstanceRequest( + request_msg = service.UpgradeInstanceRequest( name="name_value", ) + assert args[0] == request_msg def test_upgrade_instance_use_cached_wrapped_rpc(): @@ -4389,9 +4416,14 @@ async def test_upgrade_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_upgrade_instance_async( - transport: str = "grpc_asyncio", request_type=service.UpgradeInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.UpgradeInstanceRequest(), + {}, + ], +) +async def test_upgrade_instance_async(request_type, transport: str = "grpc_asyncio"): client = NotebookServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4399,7 +4431,7 @@ async def test_upgrade_instance_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.upgrade_instance), "__call__") as call: @@ -4419,11 +4451,6 @@ async def test_upgrade_instance_async( 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 = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4488,8 +4515,8 @@ async def test_upgrade_instance_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.RollbackInstanceRequest, - dict, + service.RollbackInstanceRequest(), + {}, ], ) def test_rollback_instance(request_type, transport: str = "grpc"): @@ -4500,7 +4527,7 @@ def test_rollback_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( @@ -4547,11 +4574,12 @@ def test_rollback_instance_non_empty_request_with_auto_populated_field(): client.rollback_instance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.RollbackInstanceRequest( + request_msg = service.RollbackInstanceRequest( name="name_value", target_snapshot="target_snapshot_value", revision_id="revision_id_value", ) + assert args[0] == request_msg def test_rollback_instance_use_cached_wrapped_rpc(): @@ -4644,9 +4672,14 @@ async def test_rollback_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_rollback_instance_async( - transport: str = "grpc_asyncio", request_type=service.RollbackInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.RollbackInstanceRequest(), + {}, + ], +) +async def test_rollback_instance_async(request_type, transport: str = "grpc_asyncio"): client = NotebookServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4654,7 +4687,7 @@ async def test_rollback_instance_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( @@ -4676,11 +4709,6 @@ async def test_rollback_instance_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_rollback_instance_async_from_dict(): - await test_rollback_instance_async(request_type=dict) - - def test_rollback_instance_field_headers(): client = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4749,8 +4777,8 @@ async def test_rollback_instance_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service.DiagnoseInstanceRequest, - dict, + service.DiagnoseInstanceRequest(), + {}, ], ) def test_diagnose_instance(request_type, transport: str = "grpc"): @@ -4761,7 +4789,7 @@ def test_diagnose_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( @@ -4806,9 +4834,10 @@ def test_diagnose_instance_non_empty_request_with_auto_populated_field(): client.diagnose_instance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DiagnoseInstanceRequest( + request_msg = service.DiagnoseInstanceRequest( name="name_value", ) + assert args[0] == request_msg def test_diagnose_instance_use_cached_wrapped_rpc(): @@ -4901,9 +4930,14 @@ async def test_diagnose_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_diagnose_instance_async( - transport: str = "grpc_asyncio", request_type=service.DiagnoseInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.DiagnoseInstanceRequest(), + {}, + ], +) +async def test_diagnose_instance_async(request_type, transport: str = "grpc_asyncio"): client = NotebookServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4911,7 +4945,7 @@ async def test_diagnose_instance_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( @@ -4933,11 +4967,6 @@ async def test_diagnose_instance_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_diagnose_instance_async_from_dict(): - await test_diagnose_instance_async(request_type=dict) - - def test_diagnose_instance_field_headers(): client = NotebookServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7200,7 +7229,6 @@ def test_list_instances_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListInstancesRequest() - assert args[0] == request_msg @@ -7221,7 +7249,6 @@ def test_get_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetInstanceRequest() - assert args[0] == request_msg @@ -7242,7 +7269,6 @@ def test_create_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateInstanceRequest() - assert args[0] == request_msg @@ -7263,7 +7289,6 @@ def test_update_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateInstanceRequest() - assert args[0] == request_msg @@ -7284,7 +7309,6 @@ def test_delete_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteInstanceRequest() - assert args[0] == request_msg @@ -7305,7 +7329,6 @@ def test_start_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.StartInstanceRequest() - assert args[0] == request_msg @@ -7326,7 +7349,6 @@ def test_stop_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.StopInstanceRequest() - assert args[0] == request_msg @@ -7347,7 +7369,6 @@ def test_reset_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ResetInstanceRequest() - assert args[0] == request_msg @@ -7370,7 +7391,6 @@ def test_check_instance_upgradability_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CheckInstanceUpgradabilityRequest() - assert args[0] == request_msg @@ -7391,7 +7411,6 @@ def test_upgrade_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpgradeInstanceRequest() - assert args[0] == request_msg @@ -7414,7 +7433,6 @@ def test_rollback_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.RollbackInstanceRequest() - assert args[0] == request_msg @@ -7437,7 +7455,6 @@ def test_diagnose_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DiagnoseInstanceRequest() - assert args[0] == request_msg @@ -7479,7 +7496,6 @@ async def test_list_instances_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListInstancesRequest() - assert args[0] == request_msg @@ -7513,7 +7529,6 @@ async def test_get_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetInstanceRequest() - assert args[0] == request_msg @@ -7538,7 +7553,6 @@ async def test_create_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateInstanceRequest() - assert args[0] == request_msg @@ -7563,7 +7577,6 @@ async def test_update_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateInstanceRequest() - assert args[0] == request_msg @@ -7588,7 +7601,6 @@ async def test_delete_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteInstanceRequest() - assert args[0] == request_msg @@ -7613,7 +7625,6 @@ async def test_start_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.StartInstanceRequest() - assert args[0] == request_msg @@ -7638,7 +7649,6 @@ async def test_stop_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.StopInstanceRequest() - assert args[0] == request_msg @@ -7663,7 +7673,6 @@ async def test_reset_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ResetInstanceRequest() - assert args[0] == request_msg @@ -7695,7 +7704,6 @@ async def test_check_instance_upgradability_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CheckInstanceUpgradabilityRequest() - assert args[0] == request_msg @@ -7720,7 +7728,6 @@ async def test_upgrade_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpgradeInstanceRequest() - assert args[0] == request_msg @@ -7747,7 +7754,6 @@ async def test_rollback_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.RollbackInstanceRequest() - assert args[0] == request_msg @@ -7774,7 +7780,6 @@ async def test_diagnose_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DiagnoseInstanceRequest() - assert args[0] == request_msg @@ -10174,7 +10179,6 @@ def test_list_instances_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListInstancesRequest() - assert args[0] == request_msg @@ -10194,7 +10198,6 @@ def test_get_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetInstanceRequest() - assert args[0] == request_msg @@ -10214,7 +10217,6 @@ def test_create_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateInstanceRequest() - assert args[0] == request_msg @@ -10234,7 +10236,6 @@ def test_update_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateInstanceRequest() - assert args[0] == request_msg @@ -10254,7 +10255,6 @@ def test_delete_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteInstanceRequest() - assert args[0] == request_msg @@ -10274,7 +10274,6 @@ def test_start_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.StartInstanceRequest() - assert args[0] == request_msg @@ -10294,7 +10293,6 @@ def test_stop_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.StopInstanceRequest() - assert args[0] == request_msg @@ -10314,7 +10312,6 @@ def test_reset_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ResetInstanceRequest() - assert args[0] == request_msg @@ -10336,7 +10333,6 @@ def test_check_instance_upgradability_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CheckInstanceUpgradabilityRequest() - assert args[0] == request_msg @@ -10356,7 +10352,6 @@ def test_upgrade_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpgradeInstanceRequest() - assert args[0] == request_msg @@ -10378,7 +10373,6 @@ def test_rollback_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.RollbackInstanceRequest() - assert args[0] == request_msg @@ -10400,7 +10394,6 @@ def test_diagnose_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DiagnoseInstanceRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-optimization/noxfile.py b/packages/google-cloud-optimization/noxfile.py index 8a4e66fbaa81..b023be356097 100644 --- a/packages/google-cloud-optimization/noxfile.py +++ b/packages/google-cloud-optimization/noxfile.py @@ -47,7 +47,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-optimization" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-optimization/setup.py b/packages/google-cloud-optimization/setup.py index 2ef4b82fa156..c29d9b8b6cd2 100644 --- a/packages/google-cloud-optimization/setup.py +++ b/packages/google-cloud-optimization/setup.py @@ -45,7 +45,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/google-cloud-optimization/testing/constraints-3.10.txt b/packages/google-cloud-optimization/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-optimization/testing/constraints-3.10.txt +++ b/packages/google-cloud-optimization/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-optimization/tests/unit/gapic/optimization_v1/test_fleet_routing.py b/packages/google-cloud-optimization/tests/unit/gapic/optimization_v1/test_fleet_routing.py index 75ef846ac276..c6080579b6e8 100644 --- a/packages/google-cloud-optimization/tests/unit/gapic/optimization_v1/test_fleet_routing.py +++ b/packages/google-cloud-optimization/tests/unit/gapic/optimization_v1/test_fleet_routing.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 @@ -114,6 +115,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" @@ -1294,8 +1310,8 @@ def test_fleet_routing_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - fleet_routing.OptimizeToursRequest, - dict, + fleet_routing.OptimizeToursRequest(), + {}, ], ) def test_optimize_tours(request_type, transport: str = "grpc"): @@ -1306,7 +1322,7 @@ def test_optimize_tours(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.optimize_tours), "__call__") as call: @@ -1353,10 +1369,11 @@ def test_optimize_tours_non_empty_request_with_auto_populated_field(): client.optimize_tours(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == fleet_routing.OptimizeToursRequest( + request_msg = fleet_routing.OptimizeToursRequest( parent="parent_value", label="label_value", ) + assert args[0] == request_msg def test_optimize_tours_use_cached_wrapped_rpc(): @@ -1437,9 +1454,14 @@ async def test_optimize_tours_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_optimize_tours_async( - transport: str = "grpc_asyncio", request_type=fleet_routing.OptimizeToursRequest -): +@pytest.mark.parametrize( + "request_type", + [ + fleet_routing.OptimizeToursRequest(), + {}, + ], +) +async def test_optimize_tours_async(request_type, transport: str = "grpc_asyncio"): client = FleetRoutingAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1447,7 +1469,7 @@ async def test_optimize_tours_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.optimize_tours), "__call__") as call: @@ -1472,11 +1494,6 @@ async def test_optimize_tours_async( assert math.isclose(response.total_cost, 0.10840000000000001, rel_tol=1e-6) -@pytest.mark.asyncio -async def test_optimize_tours_async_from_dict(): - await test_optimize_tours_async(request_type=dict) - - def test_optimize_tours_field_headers(): client = FleetRoutingClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1541,8 +1558,8 @@ async def test_optimize_tours_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - fleet_routing.BatchOptimizeToursRequest, - dict, + fleet_routing.BatchOptimizeToursRequest(), + {}, ], ) def test_batch_optimize_tours(request_type, transport: str = "grpc"): @@ -1553,7 +1570,7 @@ def test_batch_optimize_tours(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1598,9 +1615,10 @@ def test_batch_optimize_tours_non_empty_request_with_auto_populated_field(): client.batch_optimize_tours(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == fleet_routing.BatchOptimizeToursRequest( + request_msg = fleet_routing.BatchOptimizeToursRequest( parent="parent_value", ) + assert args[0] == request_msg def test_batch_optimize_tours_use_cached_wrapped_rpc(): @@ -1695,9 +1713,15 @@ async def test_batch_optimize_tours_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + fleet_routing.BatchOptimizeToursRequest(), + {}, + ], +) async def test_batch_optimize_tours_async( - transport: str = "grpc_asyncio", - request_type=fleet_routing.BatchOptimizeToursRequest, + request_type, transport: str = "grpc_asyncio" ): client = FleetRoutingAsyncClient( credentials=async_anonymous_credentials(), @@ -1706,7 +1730,7 @@ async def test_batch_optimize_tours_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( @@ -1728,11 +1752,6 @@ async def test_batch_optimize_tours_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_batch_optimize_tours_async_from_dict(): - await test_batch_optimize_tours_async(request_type=dict) - - def test_batch_optimize_tours_field_headers(): client = FleetRoutingClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2176,7 +2195,6 @@ def test_optimize_tours_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = fleet_routing.OptimizeToursRequest() - assert args[0] == request_msg @@ -2199,7 +2217,6 @@ def test_batch_optimize_tours_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = fleet_routing.BatchOptimizeToursRequest() - assert args[0] == request_msg @@ -2241,7 +2258,6 @@ async def test_optimize_tours_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = fleet_routing.OptimizeToursRequest() - assert args[0] == request_msg @@ -2268,7 +2284,6 @@ async def test_batch_optimize_tours_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = fleet_routing.BatchOptimizeToursRequest() - assert args[0] == request_msg @@ -2628,7 +2643,6 @@ def test_optimize_tours_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = fleet_routing.OptimizeToursRequest() - assert args[0] == request_msg @@ -2650,7 +2664,6 @@ def test_batch_optimize_tours_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = fleet_routing.BatchOptimizeToursRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-oracledatabase/noxfile.py b/packages/google-cloud-oracledatabase/noxfile.py index fcd3cd802f25..22a47f0fa4ff 100644 --- a/packages/google-cloud-oracledatabase/noxfile.py +++ b/packages/google-cloud-oracledatabase/noxfile.py @@ -47,7 +47,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-oracledatabase" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-oracledatabase/setup.py b/packages/google-cloud-oracledatabase/setup.py index 456dc4ccbacd..46d329fbff77 100644 --- a/packages/google-cloud-oracledatabase/setup.py +++ b/packages/google-cloud-oracledatabase/setup.py @@ -45,7 +45,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/google-cloud-oracledatabase/testing/constraints-3.10.txt b/packages/google-cloud-oracledatabase/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-oracledatabase/testing/constraints-3.10.txt +++ b/packages/google-cloud-oracledatabase/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-oracledatabase/tests/unit/gapic/oracledatabase_v1/test_oracle_database.py b/packages/google-cloud-oracledatabase/tests/unit/gapic/oracledatabase_v1/test_oracle_database.py index 282aa49c87b6..22add9db76df 100644 --- a/packages/google-cloud-oracledatabase/tests/unit/gapic/oracledatabase_v1/test_oracle_database.py +++ b/packages/google-cloud-oracledatabase/tests/unit/gapic/oracledatabase_v1/test_oracle_database.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 @@ -158,6 +159,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" @@ -1361,8 +1377,8 @@ def test_oracle_database_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - oracledatabase.ListCloudExadataInfrastructuresRequest, - dict, + oracledatabase.ListCloudExadataInfrastructuresRequest(), + {}, ], ) def test_list_cloud_exadata_infrastructures(request_type, transport: str = "grpc"): @@ -1373,7 +1389,7 @@ def test_list_cloud_exadata_infrastructures(request_type, transport: str = "grpc # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1424,12 +1440,13 @@ def test_list_cloud_exadata_infrastructures_non_empty_request_with_auto_populate client.list_cloud_exadata_infrastructures(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == oracledatabase.ListCloudExadataInfrastructuresRequest( + request_msg = oracledatabase.ListCloudExadataInfrastructuresRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_cloud_exadata_infrastructures_use_cached_wrapped_rpc(): @@ -1515,9 +1532,15 @@ async def test_list_cloud_exadata_infrastructures_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + oracledatabase.ListCloudExadataInfrastructuresRequest(), + {}, + ], +) async def test_list_cloud_exadata_infrastructures_async( - transport: str = "grpc_asyncio", - request_type=oracledatabase.ListCloudExadataInfrastructuresRequest, + request_type, transport: str = "grpc_asyncio" ): client = OracleDatabaseAsyncClient( credentials=async_anonymous_credentials(), @@ -1526,7 +1549,7 @@ async def test_list_cloud_exadata_infrastructures_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( @@ -1551,11 +1574,6 @@ async def test_list_cloud_exadata_infrastructures_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_cloud_exadata_infrastructures_async_from_dict(): - await test_list_cloud_exadata_infrastructures_async(request_type=dict) - - def test_list_cloud_exadata_infrastructures_field_headers(): client = OracleDatabaseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1916,8 +1934,8 @@ async def test_list_cloud_exadata_infrastructures_async_pages(): @pytest.mark.parametrize( "request_type", [ - oracledatabase.GetCloudExadataInfrastructureRequest, - dict, + oracledatabase.GetCloudExadataInfrastructureRequest(), + {}, ], ) def test_get_cloud_exadata_infrastructure(request_type, transport: str = "grpc"): @@ -1928,7 +1946,7 @@ def test_get_cloud_exadata_infrastructure(request_type, transport: str = "grpc") # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1982,9 +2000,10 @@ def test_get_cloud_exadata_infrastructure_non_empty_request_with_auto_populated_ client.get_cloud_exadata_infrastructure(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == oracledatabase.GetCloudExadataInfrastructureRequest( + request_msg = oracledatabase.GetCloudExadataInfrastructureRequest( name="name_value", ) + assert args[0] == request_msg def test_get_cloud_exadata_infrastructure_use_cached_wrapped_rpc(): @@ -2070,9 +2089,15 @@ async def test_get_cloud_exadata_infrastructure_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + oracledatabase.GetCloudExadataInfrastructureRequest(), + {}, + ], +) async def test_get_cloud_exadata_infrastructure_async( - transport: str = "grpc_asyncio", - request_type=oracledatabase.GetCloudExadataInfrastructureRequest, + request_type, transport: str = "grpc_asyncio" ): client = OracleDatabaseAsyncClient( credentials=async_anonymous_credentials(), @@ -2081,7 +2106,7 @@ async def test_get_cloud_exadata_infrastructure_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( @@ -2112,11 +2137,6 @@ async def test_get_cloud_exadata_infrastructure_async( assert response.entitlement_id == "entitlement_id_value" -@pytest.mark.asyncio -async def test_get_cloud_exadata_infrastructure_async_from_dict(): - await test_get_cloud_exadata_infrastructure_async(request_type=dict) - - def test_get_cloud_exadata_infrastructure_field_headers(): client = OracleDatabaseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2271,8 +2291,8 @@ async def test_get_cloud_exadata_infrastructure_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - oracledatabase.CreateCloudExadataInfrastructureRequest, - dict, + oracledatabase.CreateCloudExadataInfrastructureRequest(), + {}, ], ) def test_create_cloud_exadata_infrastructure(request_type, transport: str = "grpc"): @@ -2283,7 +2303,7 @@ def test_create_cloud_exadata_infrastructure(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( @@ -2329,10 +2349,11 @@ def test_create_cloud_exadata_infrastructure_non_empty_request_with_auto_populat client.create_cloud_exadata_infrastructure(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == oracledatabase.CreateCloudExadataInfrastructureRequest( + request_msg = oracledatabase.CreateCloudExadataInfrastructureRequest( parent="parent_value", cloud_exadata_infrastructure_id="cloud_exadata_infrastructure_id_value", ) + assert args[0] == request_msg def test_create_cloud_exadata_infrastructure_use_cached_wrapped_rpc(): @@ -2428,9 +2449,15 @@ async def test_create_cloud_exadata_infrastructure_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + oracledatabase.CreateCloudExadataInfrastructureRequest(), + {}, + ], +) async def test_create_cloud_exadata_infrastructure_async( - transport: str = "grpc_asyncio", - request_type=oracledatabase.CreateCloudExadataInfrastructureRequest, + request_type, transport: str = "grpc_asyncio" ): client = OracleDatabaseAsyncClient( credentials=async_anonymous_credentials(), @@ -2439,7 +2466,7 @@ async def test_create_cloud_exadata_infrastructure_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( @@ -2461,11 +2488,6 @@ async def test_create_cloud_exadata_infrastructure_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_cloud_exadata_infrastructure_async_from_dict(): - await test_create_cloud_exadata_infrastructure_async(request_type=dict) - - def test_create_cloud_exadata_infrastructure_field_headers(): client = OracleDatabaseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2648,8 +2670,8 @@ async def test_create_cloud_exadata_infrastructure_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - oracledatabase.DeleteCloudExadataInfrastructureRequest, - dict, + oracledatabase.DeleteCloudExadataInfrastructureRequest(), + {}, ], ) def test_delete_cloud_exadata_infrastructure(request_type, transport: str = "grpc"): @@ -2660,7 +2682,7 @@ def test_delete_cloud_exadata_infrastructure(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( @@ -2705,9 +2727,10 @@ def test_delete_cloud_exadata_infrastructure_non_empty_request_with_auto_populat client.delete_cloud_exadata_infrastructure(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == oracledatabase.DeleteCloudExadataInfrastructureRequest( + request_msg = oracledatabase.DeleteCloudExadataInfrastructureRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_cloud_exadata_infrastructure_use_cached_wrapped_rpc(): @@ -2803,9 +2826,15 @@ async def test_delete_cloud_exadata_infrastructure_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + oracledatabase.DeleteCloudExadataInfrastructureRequest(), + {}, + ], +) async def test_delete_cloud_exadata_infrastructure_async( - transport: str = "grpc_asyncio", - request_type=oracledatabase.DeleteCloudExadataInfrastructureRequest, + request_type, transport: str = "grpc_asyncio" ): client = OracleDatabaseAsyncClient( credentials=async_anonymous_credentials(), @@ -2814,7 +2843,7 @@ async def test_delete_cloud_exadata_infrastructure_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( @@ -2836,11 +2865,6 @@ async def test_delete_cloud_exadata_infrastructure_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_cloud_exadata_infrastructure_async_from_dict(): - await test_delete_cloud_exadata_infrastructure_async(request_type=dict) - - def test_delete_cloud_exadata_infrastructure_field_headers(): client = OracleDatabaseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2995,8 +3019,8 @@ async def test_delete_cloud_exadata_infrastructure_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - oracledatabase.ListCloudVmClustersRequest, - dict, + oracledatabase.ListCloudVmClustersRequest(), + {}, ], ) def test_list_cloud_vm_clusters(request_type, transport: str = "grpc"): @@ -3007,7 +3031,7 @@ def test_list_cloud_vm_clusters(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3057,11 +3081,12 @@ def test_list_cloud_vm_clusters_non_empty_request_with_auto_populated_field(): client.list_cloud_vm_clusters(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == oracledatabase.ListCloudVmClustersRequest( + request_msg = oracledatabase.ListCloudVmClustersRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_cloud_vm_clusters_use_cached_wrapped_rpc(): @@ -3147,9 +3172,15 @@ async def test_list_cloud_vm_clusters_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + oracledatabase.ListCloudVmClustersRequest(), + {}, + ], +) async def test_list_cloud_vm_clusters_async( - transport: str = "grpc_asyncio", - request_type=oracledatabase.ListCloudVmClustersRequest, + request_type, transport: str = "grpc_asyncio" ): client = OracleDatabaseAsyncClient( credentials=async_anonymous_credentials(), @@ -3158,7 +3189,7 @@ async def test_list_cloud_vm_clusters_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( @@ -3183,11 +3214,6 @@ async def test_list_cloud_vm_clusters_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_cloud_vm_clusters_async_from_dict(): - await test_list_cloud_vm_clusters_async(request_type=dict) - - def test_list_cloud_vm_clusters_field_headers(): client = OracleDatabaseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3540,8 +3566,8 @@ async def test_list_cloud_vm_clusters_async_pages(): @pytest.mark.parametrize( "request_type", [ - oracledatabase.GetCloudVmClusterRequest, - dict, + oracledatabase.GetCloudVmClusterRequest(), + {}, ], ) def test_get_cloud_vm_cluster(request_type, transport: str = "grpc"): @@ -3552,7 +3578,7 @@ def test_get_cloud_vm_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3618,9 +3644,10 @@ def test_get_cloud_vm_cluster_non_empty_request_with_auto_populated_field(): client.get_cloud_vm_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == oracledatabase.GetCloudVmClusterRequest( + request_msg = oracledatabase.GetCloudVmClusterRequest( name="name_value", ) + assert args[0] == request_msg def test_get_cloud_vm_cluster_use_cached_wrapped_rpc(): @@ -3705,9 +3732,15 @@ async def test_get_cloud_vm_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + oracledatabase.GetCloudVmClusterRequest(), + {}, + ], +) async def test_get_cloud_vm_cluster_async( - transport: str = "grpc_asyncio", - request_type=oracledatabase.GetCloudVmClusterRequest, + request_type, transport: str = "grpc_asyncio" ): client = OracleDatabaseAsyncClient( credentials=async_anonymous_credentials(), @@ -3716,7 +3749,7 @@ async def test_get_cloud_vm_cluster_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( @@ -3759,11 +3792,6 @@ async def test_get_cloud_vm_cluster_async( assert response.backup_odb_subnet == "backup_odb_subnet_value" -@pytest.mark.asyncio -async def test_get_cloud_vm_cluster_async_from_dict(): - await test_get_cloud_vm_cluster_async(request_type=dict) - - def test_get_cloud_vm_cluster_field_headers(): client = OracleDatabaseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3918,8 +3946,8 @@ async def test_get_cloud_vm_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - oracledatabase.CreateCloudVmClusterRequest, - dict, + oracledatabase.CreateCloudVmClusterRequest(), + {}, ], ) def test_create_cloud_vm_cluster(request_type, transport: str = "grpc"): @@ -3930,7 +3958,7 @@ def test_create_cloud_vm_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3976,10 +4004,11 @@ def test_create_cloud_vm_cluster_non_empty_request_with_auto_populated_field(): client.create_cloud_vm_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == oracledatabase.CreateCloudVmClusterRequest( + request_msg = oracledatabase.CreateCloudVmClusterRequest( parent="parent_value", cloud_vm_cluster_id="cloud_vm_cluster_id_value", ) + assert args[0] == request_msg def test_create_cloud_vm_cluster_use_cached_wrapped_rpc(): @@ -4075,9 +4104,15 @@ async def test_create_cloud_vm_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + oracledatabase.CreateCloudVmClusterRequest(), + {}, + ], +) async def test_create_cloud_vm_cluster_async( - transport: str = "grpc_asyncio", - request_type=oracledatabase.CreateCloudVmClusterRequest, + request_type, transport: str = "grpc_asyncio" ): client = OracleDatabaseAsyncClient( credentials=async_anonymous_credentials(), @@ -4086,7 +4121,7 @@ async def test_create_cloud_vm_cluster_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( @@ -4108,11 +4143,6 @@ async def test_create_cloud_vm_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_cloud_vm_cluster_async_from_dict(): - await test_create_cloud_vm_cluster_async(request_type=dict) - - def test_create_cloud_vm_cluster_field_headers(): client = OracleDatabaseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4287,8 +4317,8 @@ async def test_create_cloud_vm_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - oracledatabase.DeleteCloudVmClusterRequest, - dict, + oracledatabase.DeleteCloudVmClusterRequest(), + {}, ], ) def test_delete_cloud_vm_cluster(request_type, transport: str = "grpc"): @@ -4299,7 +4329,7 @@ def test_delete_cloud_vm_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4344,9 +4374,10 @@ def test_delete_cloud_vm_cluster_non_empty_request_with_auto_populated_field(): client.delete_cloud_vm_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == oracledatabase.DeleteCloudVmClusterRequest( + request_msg = oracledatabase.DeleteCloudVmClusterRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_cloud_vm_cluster_use_cached_wrapped_rpc(): @@ -4442,9 +4473,15 @@ async def test_delete_cloud_vm_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + oracledatabase.DeleteCloudVmClusterRequest(), + {}, + ], +) async def test_delete_cloud_vm_cluster_async( - transport: str = "grpc_asyncio", - request_type=oracledatabase.DeleteCloudVmClusterRequest, + request_type, transport: str = "grpc_asyncio" ): client = OracleDatabaseAsyncClient( credentials=async_anonymous_credentials(), @@ -4453,7 +4490,7 @@ async def test_delete_cloud_vm_cluster_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( @@ -4475,11 +4512,6 @@ async def test_delete_cloud_vm_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_cloud_vm_cluster_async_from_dict(): - await test_delete_cloud_vm_cluster_async(request_type=dict) - - def test_delete_cloud_vm_cluster_field_headers(): client = OracleDatabaseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4634,8 +4666,8 @@ async def test_delete_cloud_vm_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - oracledatabase.ListEntitlementsRequest, - dict, + oracledatabase.ListEntitlementsRequest(), + {}, ], ) def test_list_entitlements(request_type, transport: str = "grpc"): @@ -4646,7 +4678,7 @@ def test_list_entitlements(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4695,10 +4727,11 @@ def test_list_entitlements_non_empty_request_with_auto_populated_field(): client.list_entitlements(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == oracledatabase.ListEntitlementsRequest( + request_msg = oracledatabase.ListEntitlementsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_entitlements_use_cached_wrapped_rpc(): @@ -4781,9 +4814,14 @@ async def test_list_entitlements_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_entitlements_async( - transport: str = "grpc_asyncio", request_type=oracledatabase.ListEntitlementsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + oracledatabase.ListEntitlementsRequest(), + {}, + ], +) +async def test_list_entitlements_async(request_type, transport: str = "grpc_asyncio"): client = OracleDatabaseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4791,7 +4829,7 @@ async def test_list_entitlements_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( @@ -4816,11 +4854,6 @@ async def test_list_entitlements_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_entitlements_async_from_dict(): - await test_list_entitlements_async(request_type=dict) - - def test_list_entitlements_field_headers(): client = OracleDatabaseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5173,8 +5206,8 @@ async def test_list_entitlements_async_pages(): @pytest.mark.parametrize( "request_type", [ - oracledatabase.ListDbServersRequest, - dict, + oracledatabase.ListDbServersRequest(), + {}, ], ) def test_list_db_servers(request_type, transport: str = "grpc"): @@ -5185,7 +5218,7 @@ def test_list_db_servers(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_db_servers), "__call__") as call: @@ -5230,10 +5263,11 @@ def test_list_db_servers_non_empty_request_with_auto_populated_field(): client.list_db_servers(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == oracledatabase.ListDbServersRequest( + request_msg = oracledatabase.ListDbServersRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_db_servers_use_cached_wrapped_rpc(): @@ -5314,9 +5348,14 @@ async def test_list_db_servers_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_db_servers_async( - transport: str = "grpc_asyncio", request_type=oracledatabase.ListDbServersRequest -): +@pytest.mark.parametrize( + "request_type", + [ + oracledatabase.ListDbServersRequest(), + {}, + ], +) +async def test_list_db_servers_async(request_type, transport: str = "grpc_asyncio"): client = OracleDatabaseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5324,7 +5363,7 @@ async def test_list_db_servers_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_db_servers), "__call__") as call: @@ -5347,11 +5386,6 @@ async def test_list_db_servers_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_db_servers_async_from_dict(): - await test_list_db_servers_async(request_type=dict) - - def test_list_db_servers_field_headers(): client = OracleDatabaseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5688,8 +5722,8 @@ async def test_list_db_servers_async_pages(): @pytest.mark.parametrize( "request_type", [ - oracledatabase.ListDbNodesRequest, - dict, + oracledatabase.ListDbNodesRequest(), + {}, ], ) def test_list_db_nodes(request_type, transport: str = "grpc"): @@ -5700,7 +5734,7 @@ def test_list_db_nodes(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_db_nodes), "__call__") as call: @@ -5745,10 +5779,11 @@ def test_list_db_nodes_non_empty_request_with_auto_populated_field(): client.list_db_nodes(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == oracledatabase.ListDbNodesRequest( + request_msg = oracledatabase.ListDbNodesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_db_nodes_use_cached_wrapped_rpc(): @@ -5829,9 +5864,14 @@ async def test_list_db_nodes_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_db_nodes_async( - transport: str = "grpc_asyncio", request_type=oracledatabase.ListDbNodesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + oracledatabase.ListDbNodesRequest(), + {}, + ], +) +async def test_list_db_nodes_async(request_type, transport: str = "grpc_asyncio"): client = OracleDatabaseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5839,7 +5879,7 @@ async def test_list_db_nodes_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_db_nodes), "__call__") as call: @@ -5862,11 +5902,6 @@ async def test_list_db_nodes_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_db_nodes_async_from_dict(): - await test_list_db_nodes_async(request_type=dict) - - def test_list_db_nodes_field_headers(): client = OracleDatabaseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6203,8 +6238,8 @@ async def test_list_db_nodes_async_pages(): @pytest.mark.parametrize( "request_type", [ - oracledatabase.ListGiVersionsRequest, - dict, + oracledatabase.ListGiVersionsRequest(), + {}, ], ) def test_list_gi_versions(request_type, transport: str = "grpc"): @@ -6215,7 +6250,7 @@ def test_list_gi_versions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_gi_versions), "__call__") as call: @@ -6261,11 +6296,12 @@ def test_list_gi_versions_non_empty_request_with_auto_populated_field(): client.list_gi_versions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == oracledatabase.ListGiVersionsRequest( + request_msg = oracledatabase.ListGiVersionsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_gi_versions_use_cached_wrapped_rpc(): @@ -6348,9 +6384,14 @@ async def test_list_gi_versions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_gi_versions_async( - transport: str = "grpc_asyncio", request_type=oracledatabase.ListGiVersionsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + oracledatabase.ListGiVersionsRequest(), + {}, + ], +) +async def test_list_gi_versions_async(request_type, transport: str = "grpc_asyncio"): client = OracleDatabaseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6358,7 +6399,7 @@ async def test_list_gi_versions_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_gi_versions), "__call__") as call: @@ -6381,11 +6422,6 @@ async def test_list_gi_versions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_gi_versions_async_from_dict(): - await test_list_gi_versions_async(request_type=dict) - - def test_list_gi_versions_field_headers(): client = OracleDatabaseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6722,8 +6758,8 @@ async def test_list_gi_versions_async_pages(): @pytest.mark.parametrize( "request_type", [ - minor_version.ListMinorVersionsRequest, - dict, + minor_version.ListMinorVersionsRequest(), + {}, ], ) def test_list_minor_versions(request_type, transport: str = "grpc"): @@ -6734,7 +6770,7 @@ def test_list_minor_versions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6784,11 +6820,12 @@ def test_list_minor_versions_non_empty_request_with_auto_populated_field(): client.list_minor_versions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == minor_version.ListMinorVersionsRequest( + request_msg = minor_version.ListMinorVersionsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_minor_versions_use_cached_wrapped_rpc(): @@ -6873,9 +6910,14 @@ async def test_list_minor_versions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_minor_versions_async( - transport: str = "grpc_asyncio", request_type=minor_version.ListMinorVersionsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + minor_version.ListMinorVersionsRequest(), + {}, + ], +) +async def test_list_minor_versions_async(request_type, transport: str = "grpc_asyncio"): client = OracleDatabaseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6883,7 +6925,7 @@ async def test_list_minor_versions_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( @@ -6908,11 +6950,6 @@ async def test_list_minor_versions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_minor_versions_async_from_dict(): - await test_list_minor_versions_async(request_type=dict) - - def test_list_minor_versions_field_headers(): client = OracleDatabaseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7265,8 +7302,8 @@ async def test_list_minor_versions_async_pages(): @pytest.mark.parametrize( "request_type", [ - oracledatabase.ListDbSystemShapesRequest, - dict, + oracledatabase.ListDbSystemShapesRequest(), + {}, ], ) def test_list_db_system_shapes(request_type, transport: str = "grpc"): @@ -7277,7 +7314,7 @@ def test_list_db_system_shapes(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7327,11 +7364,12 @@ def test_list_db_system_shapes_non_empty_request_with_auto_populated_field(): client.list_db_system_shapes(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == oracledatabase.ListDbSystemShapesRequest( + request_msg = oracledatabase.ListDbSystemShapesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_db_system_shapes_use_cached_wrapped_rpc(): @@ -7417,9 +7455,15 @@ async def test_list_db_system_shapes_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + oracledatabase.ListDbSystemShapesRequest(), + {}, + ], +) async def test_list_db_system_shapes_async( - transport: str = "grpc_asyncio", - request_type=oracledatabase.ListDbSystemShapesRequest, + request_type, transport: str = "grpc_asyncio" ): client = OracleDatabaseAsyncClient( credentials=async_anonymous_credentials(), @@ -7428,7 +7472,7 @@ async def test_list_db_system_shapes_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( @@ -7453,11 +7497,6 @@ async def test_list_db_system_shapes_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_db_system_shapes_async_from_dict(): - await test_list_db_system_shapes_async(request_type=dict) - - def test_list_db_system_shapes_field_headers(): client = OracleDatabaseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7810,8 +7849,8 @@ async def test_list_db_system_shapes_async_pages(): @pytest.mark.parametrize( "request_type", [ - oracledatabase.ListAutonomousDatabasesRequest, - dict, + oracledatabase.ListAutonomousDatabasesRequest(), + {}, ], ) def test_list_autonomous_databases(request_type, transport: str = "grpc"): @@ -7822,7 +7861,7 @@ def test_list_autonomous_databases(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7873,12 +7912,13 @@ def test_list_autonomous_databases_non_empty_request_with_auto_populated_field() client.list_autonomous_databases(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == oracledatabase.ListAutonomousDatabasesRequest( + request_msg = oracledatabase.ListAutonomousDatabasesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_autonomous_databases_use_cached_wrapped_rpc(): @@ -7964,9 +8004,15 @@ async def test_list_autonomous_databases_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + oracledatabase.ListAutonomousDatabasesRequest(), + {}, + ], +) async def test_list_autonomous_databases_async( - transport: str = "grpc_asyncio", - request_type=oracledatabase.ListAutonomousDatabasesRequest, + request_type, transport: str = "grpc_asyncio" ): client = OracleDatabaseAsyncClient( credentials=async_anonymous_credentials(), @@ -7975,7 +8021,7 @@ async def test_list_autonomous_databases_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( @@ -8000,11 +8046,6 @@ async def test_list_autonomous_databases_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_autonomous_databases_async_from_dict(): - await test_list_autonomous_databases_async(request_type=dict) - - def test_list_autonomous_databases_field_headers(): client = OracleDatabaseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8363,8 +8404,8 @@ async def test_list_autonomous_databases_async_pages(): @pytest.mark.parametrize( "request_type", [ - oracledatabase.GetAutonomousDatabaseRequest, - dict, + oracledatabase.GetAutonomousDatabaseRequest(), + {}, ], ) def test_get_autonomous_database(request_type, transport: str = "grpc"): @@ -8375,7 +8416,7 @@ def test_get_autonomous_database(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8447,9 +8488,10 @@ def test_get_autonomous_database_non_empty_request_with_auto_populated_field(): client.get_autonomous_database(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == oracledatabase.GetAutonomousDatabaseRequest( + request_msg = oracledatabase.GetAutonomousDatabaseRequest( name="name_value", ) + assert args[0] == request_msg def test_get_autonomous_database_use_cached_wrapped_rpc(): @@ -8535,9 +8577,15 @@ async def test_get_autonomous_database_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + oracledatabase.GetAutonomousDatabaseRequest(), + {}, + ], +) async def test_get_autonomous_database_async( - transport: str = "grpc_asyncio", - request_type=oracledatabase.GetAutonomousDatabaseRequest, + request_type, transport: str = "grpc_asyncio" ): client = OracleDatabaseAsyncClient( credentials=async_anonymous_credentials(), @@ -8546,7 +8594,7 @@ async def test_get_autonomous_database_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( @@ -8595,11 +8643,6 @@ async def test_get_autonomous_database_async( ] -@pytest.mark.asyncio -async def test_get_autonomous_database_async_from_dict(): - await test_get_autonomous_database_async(request_type=dict) - - def test_get_autonomous_database_field_headers(): client = OracleDatabaseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8754,8 +8797,8 @@ async def test_get_autonomous_database_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - oracledatabase.CreateAutonomousDatabaseRequest, - dict, + oracledatabase.CreateAutonomousDatabaseRequest(), + {}, ], ) def test_create_autonomous_database(request_type, transport: str = "grpc"): @@ -8766,7 +8809,7 @@ def test_create_autonomous_database(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8812,10 +8855,11 @@ def test_create_autonomous_database_non_empty_request_with_auto_populated_field( client.create_autonomous_database(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == oracledatabase.CreateAutonomousDatabaseRequest( + request_msg = oracledatabase.CreateAutonomousDatabaseRequest( parent="parent_value", autonomous_database_id="autonomous_database_id_value", ) + assert args[0] == request_msg def test_create_autonomous_database_use_cached_wrapped_rpc(): @@ -8911,9 +8955,15 @@ async def test_create_autonomous_database_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + oracledatabase.CreateAutonomousDatabaseRequest(), + {}, + ], +) async def test_create_autonomous_database_async( - transport: str = "grpc_asyncio", - request_type=oracledatabase.CreateAutonomousDatabaseRequest, + request_type, transport: str = "grpc_asyncio" ): client = OracleDatabaseAsyncClient( credentials=async_anonymous_credentials(), @@ -8922,7 +8972,7 @@ async def test_create_autonomous_database_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( @@ -8944,11 +8994,6 @@ async def test_create_autonomous_database_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_autonomous_database_async_from_dict(): - await test_create_autonomous_database_async(request_type=dict) - - def test_create_autonomous_database_field_headers(): client = OracleDatabaseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9131,8 +9176,8 @@ async def test_create_autonomous_database_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - oracledatabase.UpdateAutonomousDatabaseRequest, - dict, + oracledatabase.UpdateAutonomousDatabaseRequest(), + {}, ], ) def test_update_autonomous_database(request_type, transport: str = "grpc"): @@ -9143,7 +9188,7 @@ def test_update_autonomous_database(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9186,7 +9231,8 @@ def test_update_autonomous_database_non_empty_request_with_auto_populated_field( client.update_autonomous_database(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == oracledatabase.UpdateAutonomousDatabaseRequest() + request_msg = oracledatabase.UpdateAutonomousDatabaseRequest() + assert args[0] == request_msg def test_update_autonomous_database_use_cached_wrapped_rpc(): @@ -9282,9 +9328,15 @@ async def test_update_autonomous_database_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + oracledatabase.UpdateAutonomousDatabaseRequest(), + {}, + ], +) async def test_update_autonomous_database_async( - transport: str = "grpc_asyncio", - request_type=oracledatabase.UpdateAutonomousDatabaseRequest, + request_type, transport: str = "grpc_asyncio" ): client = OracleDatabaseAsyncClient( credentials=async_anonymous_credentials(), @@ -9293,7 +9345,7 @@ async def test_update_autonomous_database_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( @@ -9315,11 +9367,6 @@ async def test_update_autonomous_database_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_autonomous_database_async_from_dict(): - await test_update_autonomous_database_async(request_type=dict) - - def test_update_autonomous_database_field_headers(): client = OracleDatabaseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9492,8 +9539,8 @@ async def test_update_autonomous_database_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - oracledatabase.DeleteAutonomousDatabaseRequest, - dict, + oracledatabase.DeleteAutonomousDatabaseRequest(), + {}, ], ) def test_delete_autonomous_database(request_type, transport: str = "grpc"): @@ -9504,7 +9551,7 @@ def test_delete_autonomous_database(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9549,9 +9596,10 @@ def test_delete_autonomous_database_non_empty_request_with_auto_populated_field( client.delete_autonomous_database(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == oracledatabase.DeleteAutonomousDatabaseRequest( + request_msg = oracledatabase.DeleteAutonomousDatabaseRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_autonomous_database_use_cached_wrapped_rpc(): @@ -9647,9 +9695,15 @@ async def test_delete_autonomous_database_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + oracledatabase.DeleteAutonomousDatabaseRequest(), + {}, + ], +) async def test_delete_autonomous_database_async( - transport: str = "grpc_asyncio", - request_type=oracledatabase.DeleteAutonomousDatabaseRequest, + request_type, transport: str = "grpc_asyncio" ): client = OracleDatabaseAsyncClient( credentials=async_anonymous_credentials(), @@ -9658,7 +9712,7 @@ async def test_delete_autonomous_database_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( @@ -9680,11 +9734,6 @@ async def test_delete_autonomous_database_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_autonomous_database_async_from_dict(): - await test_delete_autonomous_database_async(request_type=dict) - - def test_delete_autonomous_database_field_headers(): client = OracleDatabaseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9839,8 +9888,8 @@ async def test_delete_autonomous_database_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - oracledatabase.RestoreAutonomousDatabaseRequest, - dict, + oracledatabase.RestoreAutonomousDatabaseRequest(), + {}, ], ) def test_restore_autonomous_database(request_type, transport: str = "grpc"): @@ -9851,7 +9900,7 @@ def test_restore_autonomous_database(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9896,9 +9945,10 @@ def test_restore_autonomous_database_non_empty_request_with_auto_populated_field client.restore_autonomous_database(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == oracledatabase.RestoreAutonomousDatabaseRequest( + request_msg = oracledatabase.RestoreAutonomousDatabaseRequest( name="name_value", ) + assert args[0] == request_msg def test_restore_autonomous_database_use_cached_wrapped_rpc(): @@ -9994,9 +10044,15 @@ async def test_restore_autonomous_database_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + oracledatabase.RestoreAutonomousDatabaseRequest(), + {}, + ], +) async def test_restore_autonomous_database_async( - transport: str = "grpc_asyncio", - request_type=oracledatabase.RestoreAutonomousDatabaseRequest, + request_type, transport: str = "grpc_asyncio" ): client = OracleDatabaseAsyncClient( credentials=async_anonymous_credentials(), @@ -10005,7 +10061,7 @@ async def test_restore_autonomous_database_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( @@ -10027,11 +10083,6 @@ async def test_restore_autonomous_database_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_restore_autonomous_database_async_from_dict(): - await test_restore_autonomous_database_async(request_type=dict) - - def test_restore_autonomous_database_field_headers(): client = OracleDatabaseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10196,8 +10247,8 @@ async def test_restore_autonomous_database_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - oracledatabase.GenerateAutonomousDatabaseWalletRequest, - dict, + oracledatabase.GenerateAutonomousDatabaseWalletRequest(), + {}, ], ) def test_generate_autonomous_database_wallet(request_type, transport: str = "grpc"): @@ -10208,7 +10259,7 @@ def test_generate_autonomous_database_wallet(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( @@ -10257,10 +10308,11 @@ def test_generate_autonomous_database_wallet_non_empty_request_with_auto_populat client.generate_autonomous_database_wallet(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == oracledatabase.GenerateAutonomousDatabaseWalletRequest( + request_msg = oracledatabase.GenerateAutonomousDatabaseWalletRequest( name="name_value", password="password_value", ) + assert args[0] == request_msg def test_generate_autonomous_database_wallet_use_cached_wrapped_rpc(): @@ -10346,9 +10398,15 @@ async def test_generate_autonomous_database_wallet_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + oracledatabase.GenerateAutonomousDatabaseWalletRequest(), + {}, + ], +) async def test_generate_autonomous_database_wallet_async( - transport: str = "grpc_asyncio", - request_type=oracledatabase.GenerateAutonomousDatabaseWalletRequest, + request_type, transport: str = "grpc_asyncio" ): client = OracleDatabaseAsyncClient( credentials=async_anonymous_credentials(), @@ -10357,7 +10415,7 @@ async def test_generate_autonomous_database_wallet_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( @@ -10382,11 +10440,6 @@ async def test_generate_autonomous_database_wallet_async( assert response.archive_content == b"archive_content_blob" -@pytest.mark.asyncio -async def test_generate_autonomous_database_wallet_async_from_dict(): - await test_generate_autonomous_database_wallet_async(request_type=dict) - - def test_generate_autonomous_database_wallet_field_headers(): client = OracleDatabaseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10571,8 +10624,8 @@ async def test_generate_autonomous_database_wallet_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - oracledatabase.ListAutonomousDbVersionsRequest, - dict, + oracledatabase.ListAutonomousDbVersionsRequest(), + {}, ], ) def test_list_autonomous_db_versions(request_type, transport: str = "grpc"): @@ -10583,7 +10636,7 @@ def test_list_autonomous_db_versions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10632,10 +10685,11 @@ def test_list_autonomous_db_versions_non_empty_request_with_auto_populated_field client.list_autonomous_db_versions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == oracledatabase.ListAutonomousDbVersionsRequest( + request_msg = oracledatabase.ListAutonomousDbVersionsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_autonomous_db_versions_use_cached_wrapped_rpc(): @@ -10721,9 +10775,15 @@ async def test_list_autonomous_db_versions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + oracledatabase.ListAutonomousDbVersionsRequest(), + {}, + ], +) async def test_list_autonomous_db_versions_async( - transport: str = "grpc_asyncio", - request_type=oracledatabase.ListAutonomousDbVersionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = OracleDatabaseAsyncClient( credentials=async_anonymous_credentials(), @@ -10732,7 +10792,7 @@ async def test_list_autonomous_db_versions_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( @@ -10757,11 +10817,6 @@ async def test_list_autonomous_db_versions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_autonomous_db_versions_async_from_dict(): - await test_list_autonomous_db_versions_async(request_type=dict) - - def test_list_autonomous_db_versions_field_headers(): client = OracleDatabaseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11120,8 +11175,8 @@ async def test_list_autonomous_db_versions_async_pages(): @pytest.mark.parametrize( "request_type", [ - oracledatabase.ListAutonomousDatabaseCharacterSetsRequest, - dict, + oracledatabase.ListAutonomousDatabaseCharacterSetsRequest(), + {}, ], ) def test_list_autonomous_database_character_sets(request_type, transport: str = "grpc"): @@ -11132,7 +11187,7 @@ def test_list_autonomous_database_character_sets(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( @@ -11182,11 +11237,12 @@ def test_list_autonomous_database_character_sets_non_empty_request_with_auto_pop client.list_autonomous_database_character_sets(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == oracledatabase.ListAutonomousDatabaseCharacterSetsRequest( + request_msg = oracledatabase.ListAutonomousDatabaseCharacterSetsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_autonomous_database_character_sets_use_cached_wrapped_rpc(): @@ -11272,9 +11328,15 @@ async def test_list_autonomous_database_character_sets_async_use_cached_wrapped_ @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + oracledatabase.ListAutonomousDatabaseCharacterSetsRequest(), + {}, + ], +) async def test_list_autonomous_database_character_sets_async( - transport: str = "grpc_asyncio", - request_type=oracledatabase.ListAutonomousDatabaseCharacterSetsRequest, + request_type, transport: str = "grpc_asyncio" ): client = OracleDatabaseAsyncClient( credentials=async_anonymous_credentials(), @@ -11283,7 +11345,7 @@ async def test_list_autonomous_database_character_sets_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( @@ -11308,11 +11370,6 @@ async def test_list_autonomous_database_character_sets_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_autonomous_database_character_sets_async_from_dict(): - await test_list_autonomous_database_character_sets_async(request_type=dict) - - def test_list_autonomous_database_character_sets_field_headers(): client = OracleDatabaseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11679,8 +11736,8 @@ async def test_list_autonomous_database_character_sets_async_pages(): @pytest.mark.parametrize( "request_type", [ - oracledatabase.ListAutonomousDatabaseBackupsRequest, - dict, + oracledatabase.ListAutonomousDatabaseBackupsRequest(), + {}, ], ) def test_list_autonomous_database_backups(request_type, transport: str = "grpc"): @@ -11691,7 +11748,7 @@ def test_list_autonomous_database_backups(request_type, transport: str = "grpc") # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11741,11 +11798,12 @@ def test_list_autonomous_database_backups_non_empty_request_with_auto_populated_ client.list_autonomous_database_backups(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == oracledatabase.ListAutonomousDatabaseBackupsRequest( + request_msg = oracledatabase.ListAutonomousDatabaseBackupsRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_autonomous_database_backups_use_cached_wrapped_rpc(): @@ -11831,9 +11889,15 @@ async def test_list_autonomous_database_backups_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + oracledatabase.ListAutonomousDatabaseBackupsRequest(), + {}, + ], +) async def test_list_autonomous_database_backups_async( - transport: str = "grpc_asyncio", - request_type=oracledatabase.ListAutonomousDatabaseBackupsRequest, + request_type, transport: str = "grpc_asyncio" ): client = OracleDatabaseAsyncClient( credentials=async_anonymous_credentials(), @@ -11842,7 +11906,7 @@ async def test_list_autonomous_database_backups_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( @@ -11867,11 +11931,6 @@ async def test_list_autonomous_database_backups_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_autonomous_database_backups_async_from_dict(): - await test_list_autonomous_database_backups_async(request_type=dict) - - def test_list_autonomous_database_backups_field_headers(): client = OracleDatabaseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12234,8 +12293,8 @@ async def test_list_autonomous_database_backups_async_pages(): @pytest.mark.parametrize( "request_type", [ - oracledatabase.StopAutonomousDatabaseRequest, - dict, + oracledatabase.StopAutonomousDatabaseRequest(), + {}, ], ) def test_stop_autonomous_database(request_type, transport: str = "grpc"): @@ -12246,7 +12305,7 @@ def test_stop_autonomous_database(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -12291,9 +12350,10 @@ def test_stop_autonomous_database_non_empty_request_with_auto_populated_field(): client.stop_autonomous_database(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == oracledatabase.StopAutonomousDatabaseRequest( + request_msg = oracledatabase.StopAutonomousDatabaseRequest( name="name_value", ) + assert args[0] == request_msg def test_stop_autonomous_database_use_cached_wrapped_rpc(): @@ -12389,9 +12449,15 @@ async def test_stop_autonomous_database_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + oracledatabase.StopAutonomousDatabaseRequest(), + {}, + ], +) async def test_stop_autonomous_database_async( - transport: str = "grpc_asyncio", - request_type=oracledatabase.StopAutonomousDatabaseRequest, + request_type, transport: str = "grpc_asyncio" ): client = OracleDatabaseAsyncClient( credentials=async_anonymous_credentials(), @@ -12400,7 +12466,7 @@ async def test_stop_autonomous_database_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( @@ -12422,11 +12488,6 @@ async def test_stop_autonomous_database_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_stop_autonomous_database_async_from_dict(): - await test_stop_autonomous_database_async(request_type=dict) - - def test_stop_autonomous_database_field_headers(): client = OracleDatabaseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12581,8 +12642,8 @@ async def test_stop_autonomous_database_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - oracledatabase.StartAutonomousDatabaseRequest, - dict, + oracledatabase.StartAutonomousDatabaseRequest(), + {}, ], ) def test_start_autonomous_database(request_type, transport: str = "grpc"): @@ -12593,7 +12654,7 @@ def test_start_autonomous_database(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -12638,9 +12699,10 @@ def test_start_autonomous_database_non_empty_request_with_auto_populated_field() client.start_autonomous_database(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == oracledatabase.StartAutonomousDatabaseRequest( + request_msg = oracledatabase.StartAutonomousDatabaseRequest( name="name_value", ) + assert args[0] == request_msg def test_start_autonomous_database_use_cached_wrapped_rpc(): @@ -12736,9 +12798,15 @@ async def test_start_autonomous_database_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + oracledatabase.StartAutonomousDatabaseRequest(), + {}, + ], +) async def test_start_autonomous_database_async( - transport: str = "grpc_asyncio", - request_type=oracledatabase.StartAutonomousDatabaseRequest, + request_type, transport: str = "grpc_asyncio" ): client = OracleDatabaseAsyncClient( credentials=async_anonymous_credentials(), @@ -12747,7 +12815,7 @@ async def test_start_autonomous_database_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( @@ -12769,11 +12837,6 @@ async def test_start_autonomous_database_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_start_autonomous_database_async_from_dict(): - await test_start_autonomous_database_async(request_type=dict) - - def test_start_autonomous_database_field_headers(): client = OracleDatabaseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12928,8 +12991,8 @@ async def test_start_autonomous_database_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - oracledatabase.RestartAutonomousDatabaseRequest, - dict, + oracledatabase.RestartAutonomousDatabaseRequest(), + {}, ], ) def test_restart_autonomous_database(request_type, transport: str = "grpc"): @@ -12940,7 +13003,7 @@ def test_restart_autonomous_database(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -12985,9 +13048,10 @@ def test_restart_autonomous_database_non_empty_request_with_auto_populated_field client.restart_autonomous_database(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == oracledatabase.RestartAutonomousDatabaseRequest( + request_msg = oracledatabase.RestartAutonomousDatabaseRequest( name="name_value", ) + assert args[0] == request_msg def test_restart_autonomous_database_use_cached_wrapped_rpc(): @@ -13083,9 +13147,15 @@ async def test_restart_autonomous_database_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + oracledatabase.RestartAutonomousDatabaseRequest(), + {}, + ], +) async def test_restart_autonomous_database_async( - transport: str = "grpc_asyncio", - request_type=oracledatabase.RestartAutonomousDatabaseRequest, + request_type, transport: str = "grpc_asyncio" ): client = OracleDatabaseAsyncClient( credentials=async_anonymous_credentials(), @@ -13094,7 +13164,7 @@ async def test_restart_autonomous_database_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( @@ -13116,11 +13186,6 @@ async def test_restart_autonomous_database_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_restart_autonomous_database_async_from_dict(): - await test_restart_autonomous_database_async(request_type=dict) - - def test_restart_autonomous_database_field_headers(): client = OracleDatabaseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13275,8 +13340,8 @@ async def test_restart_autonomous_database_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - oracledatabase.SwitchoverAutonomousDatabaseRequest, - dict, + oracledatabase.SwitchoverAutonomousDatabaseRequest(), + {}, ], ) def test_switchover_autonomous_database(request_type, transport: str = "grpc"): @@ -13287,7 +13352,7 @@ def test_switchover_autonomous_database(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -13333,10 +13398,11 @@ def test_switchover_autonomous_database_non_empty_request_with_auto_populated_fi client.switchover_autonomous_database(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == oracledatabase.SwitchoverAutonomousDatabaseRequest( + request_msg = oracledatabase.SwitchoverAutonomousDatabaseRequest( name="name_value", peer_autonomous_database="peer_autonomous_database_value", ) + assert args[0] == request_msg def test_switchover_autonomous_database_use_cached_wrapped_rpc(): @@ -13432,9 +13498,15 @@ async def test_switchover_autonomous_database_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + oracledatabase.SwitchoverAutonomousDatabaseRequest(), + {}, + ], +) async def test_switchover_autonomous_database_async( - transport: str = "grpc_asyncio", - request_type=oracledatabase.SwitchoverAutonomousDatabaseRequest, + request_type, transport: str = "grpc_asyncio" ): client = OracleDatabaseAsyncClient( credentials=async_anonymous_credentials(), @@ -13443,7 +13515,7 @@ async def test_switchover_autonomous_database_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( @@ -13465,11 +13537,6 @@ async def test_switchover_autonomous_database_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_switchover_autonomous_database_async_from_dict(): - await test_switchover_autonomous_database_async(request_type=dict) - - def test_switchover_autonomous_database_field_headers(): client = OracleDatabaseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13634,8 +13701,8 @@ async def test_switchover_autonomous_database_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - oracledatabase.FailoverAutonomousDatabaseRequest, - dict, + oracledatabase.FailoverAutonomousDatabaseRequest(), + {}, ], ) def test_failover_autonomous_database(request_type, transport: str = "grpc"): @@ -13646,7 +13713,7 @@ def test_failover_autonomous_database(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -13692,10 +13759,11 @@ def test_failover_autonomous_database_non_empty_request_with_auto_populated_fiel client.failover_autonomous_database(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == oracledatabase.FailoverAutonomousDatabaseRequest( + request_msg = oracledatabase.FailoverAutonomousDatabaseRequest( name="name_value", peer_autonomous_database="peer_autonomous_database_value", ) + assert args[0] == request_msg def test_failover_autonomous_database_use_cached_wrapped_rpc(): @@ -13791,9 +13859,15 @@ async def test_failover_autonomous_database_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + oracledatabase.FailoverAutonomousDatabaseRequest(), + {}, + ], +) async def test_failover_autonomous_database_async( - transport: str = "grpc_asyncio", - request_type=oracledatabase.FailoverAutonomousDatabaseRequest, + request_type, transport: str = "grpc_asyncio" ): client = OracleDatabaseAsyncClient( credentials=async_anonymous_credentials(), @@ -13802,7 +13876,7 @@ async def test_failover_autonomous_database_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( @@ -13824,11 +13898,6 @@ async def test_failover_autonomous_database_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_failover_autonomous_database_async_from_dict(): - await test_failover_autonomous_database_async(request_type=dict) - - def test_failover_autonomous_database_field_headers(): client = OracleDatabaseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13993,8 +14062,8 @@ async def test_failover_autonomous_database_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - odb_network.ListOdbNetworksRequest, - dict, + odb_network.ListOdbNetworksRequest(), + {}, ], ) def test_list_odb_networks(request_type, transport: str = "grpc"): @@ -14005,7 +14074,7 @@ def test_list_odb_networks(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -14058,12 +14127,13 @@ def test_list_odb_networks_non_empty_request_with_auto_populated_field(): client.list_odb_networks(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == odb_network.ListOdbNetworksRequest( + request_msg = odb_network.ListOdbNetworksRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_odb_networks_use_cached_wrapped_rpc(): @@ -14146,9 +14216,14 @@ async def test_list_odb_networks_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_odb_networks_async( - transport: str = "grpc_asyncio", request_type=odb_network.ListOdbNetworksRequest -): +@pytest.mark.parametrize( + "request_type", + [ + odb_network.ListOdbNetworksRequest(), + {}, + ], +) +async def test_list_odb_networks_async(request_type, transport: str = "grpc_asyncio"): client = OracleDatabaseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14156,7 +14231,7 @@ async def test_list_odb_networks_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( @@ -14183,11 +14258,6 @@ async def test_list_odb_networks_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_odb_networks_async_from_dict(): - await test_list_odb_networks_async(request_type=dict) - - def test_list_odb_networks_field_headers(): client = OracleDatabaseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14540,8 +14610,8 @@ async def test_list_odb_networks_async_pages(): @pytest.mark.parametrize( "request_type", [ - odb_network.GetOdbNetworkRequest, - dict, + odb_network.GetOdbNetworkRequest(), + {}, ], ) def test_get_odb_network(request_type, transport: str = "grpc"): @@ -14552,7 +14622,7 @@ def test_get_odb_network(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_odb_network), "__call__") as call: @@ -14604,9 +14674,10 @@ def test_get_odb_network_non_empty_request_with_auto_populated_field(): client.get_odb_network(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == odb_network.GetOdbNetworkRequest( + request_msg = odb_network.GetOdbNetworkRequest( name="name_value", ) + assert args[0] == request_msg def test_get_odb_network_use_cached_wrapped_rpc(): @@ -14687,9 +14758,14 @@ async def test_get_odb_network_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_odb_network_async( - transport: str = "grpc_asyncio", request_type=odb_network.GetOdbNetworkRequest -): +@pytest.mark.parametrize( + "request_type", + [ + odb_network.GetOdbNetworkRequest(), + {}, + ], +) +async def test_get_odb_network_async(request_type, transport: str = "grpc_asyncio"): client = OracleDatabaseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14697,7 +14773,7 @@ async def test_get_odb_network_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_odb_network), "__call__") as call: @@ -14728,11 +14804,6 @@ async def test_get_odb_network_async( assert response.gcp_oracle_zone == "gcp_oracle_zone_value" -@pytest.mark.asyncio -async def test_get_odb_network_async_from_dict(): - await test_get_odb_network_async(request_type=dict) - - def test_get_odb_network_field_headers(): client = OracleDatabaseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14879,8 +14950,8 @@ async def test_get_odb_network_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gco_odb_network.CreateOdbNetworkRequest, - dict, + gco_odb_network.CreateOdbNetworkRequest(), + {}, ], ) def test_create_odb_network(request_type, transport: str = "grpc"): @@ -14891,7 +14962,7 @@ def test_create_odb_network(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -14937,10 +15008,11 @@ def test_create_odb_network_non_empty_request_with_auto_populated_field(): client.create_odb_network(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gco_odb_network.CreateOdbNetworkRequest( + request_msg = gco_odb_network.CreateOdbNetworkRequest( parent="parent_value", odb_network_id="odb_network_id_value", ) + assert args[0] == request_msg def test_create_odb_network_use_cached_wrapped_rpc(): @@ -15035,10 +15107,14 @@ async def test_create_odb_network_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_odb_network_async( - transport: str = "grpc_asyncio", - request_type=gco_odb_network.CreateOdbNetworkRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + gco_odb_network.CreateOdbNetworkRequest(), + {}, + ], +) +async def test_create_odb_network_async(request_type, transport: str = "grpc_asyncio"): client = OracleDatabaseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -15046,7 +15122,7 @@ async def test_create_odb_network_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( @@ -15068,11 +15144,6 @@ async def test_create_odb_network_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_odb_network_async_from_dict(): - await test_create_odb_network_async(request_type=dict) - - def test_create_odb_network_field_headers(): client = OracleDatabaseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15247,8 +15318,8 @@ async def test_create_odb_network_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - odb_network.DeleteOdbNetworkRequest, - dict, + odb_network.DeleteOdbNetworkRequest(), + {}, ], ) def test_delete_odb_network(request_type, transport: str = "grpc"): @@ -15259,7 +15330,7 @@ def test_delete_odb_network(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -15304,9 +15375,10 @@ def test_delete_odb_network_non_empty_request_with_auto_populated_field(): client.delete_odb_network(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == odb_network.DeleteOdbNetworkRequest( + request_msg = odb_network.DeleteOdbNetworkRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_odb_network_use_cached_wrapped_rpc(): @@ -15401,9 +15473,14 @@ async def test_delete_odb_network_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_odb_network_async( - transport: str = "grpc_asyncio", request_type=odb_network.DeleteOdbNetworkRequest -): +@pytest.mark.parametrize( + "request_type", + [ + odb_network.DeleteOdbNetworkRequest(), + {}, + ], +) +async def test_delete_odb_network_async(request_type, transport: str = "grpc_asyncio"): client = OracleDatabaseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -15411,7 +15488,7 @@ async def test_delete_odb_network_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( @@ -15433,11 +15510,6 @@ async def test_delete_odb_network_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_odb_network_async_from_dict(): - await test_delete_odb_network_async(request_type=dict) - - def test_delete_odb_network_field_headers(): client = OracleDatabaseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15592,8 +15664,8 @@ async def test_delete_odb_network_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - odb_subnet.ListOdbSubnetsRequest, - dict, + odb_subnet.ListOdbSubnetsRequest(), + {}, ], ) def test_list_odb_subnets(request_type, transport: str = "grpc"): @@ -15604,7 +15676,7 @@ def test_list_odb_subnets(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_odb_subnets), "__call__") as call: @@ -15653,12 +15725,13 @@ def test_list_odb_subnets_non_empty_request_with_auto_populated_field(): client.list_odb_subnets(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == odb_subnet.ListOdbSubnetsRequest( + request_msg = odb_subnet.ListOdbSubnetsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_odb_subnets_use_cached_wrapped_rpc(): @@ -15741,9 +15814,14 @@ async def test_list_odb_subnets_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_odb_subnets_async( - transport: str = "grpc_asyncio", request_type=odb_subnet.ListOdbSubnetsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + odb_subnet.ListOdbSubnetsRequest(), + {}, + ], +) +async def test_list_odb_subnets_async(request_type, transport: str = "grpc_asyncio"): client = OracleDatabaseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -15751,7 +15829,7 @@ async def test_list_odb_subnets_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_odb_subnets), "__call__") as call: @@ -15776,11 +15854,6 @@ async def test_list_odb_subnets_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_odb_subnets_async_from_dict(): - await test_list_odb_subnets_async(request_type=dict) - - def test_list_odb_subnets_field_headers(): client = OracleDatabaseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16117,8 +16190,8 @@ async def test_list_odb_subnets_async_pages(): @pytest.mark.parametrize( "request_type", [ - odb_subnet.GetOdbSubnetRequest, - dict, + odb_subnet.GetOdbSubnetRequest(), + {}, ], ) def test_get_odb_subnet(request_type, transport: str = "grpc"): @@ -16129,7 +16202,7 @@ def test_get_odb_subnet(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_odb_subnet), "__call__") as call: @@ -16179,9 +16252,10 @@ def test_get_odb_subnet_non_empty_request_with_auto_populated_field(): client.get_odb_subnet(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == odb_subnet.GetOdbSubnetRequest( + request_msg = odb_subnet.GetOdbSubnetRequest( name="name_value", ) + assert args[0] == request_msg def test_get_odb_subnet_use_cached_wrapped_rpc(): @@ -16262,9 +16336,14 @@ async def test_get_odb_subnet_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_odb_subnet_async( - transport: str = "grpc_asyncio", request_type=odb_subnet.GetOdbSubnetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + odb_subnet.GetOdbSubnetRequest(), + {}, + ], +) +async def test_get_odb_subnet_async(request_type, transport: str = "grpc_asyncio"): client = OracleDatabaseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -16272,7 +16351,7 @@ async def test_get_odb_subnet_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_odb_subnet), "__call__") as call: @@ -16301,11 +16380,6 @@ async def test_get_odb_subnet_async( assert response.state == odb_subnet.OdbSubnet.State.PROVISIONING -@pytest.mark.asyncio -async def test_get_odb_subnet_async_from_dict(): - await test_get_odb_subnet_async(request_type=dict) - - def test_get_odb_subnet_field_headers(): client = OracleDatabaseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16452,8 +16526,8 @@ async def test_get_odb_subnet_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gco_odb_subnet.CreateOdbSubnetRequest, - dict, + gco_odb_subnet.CreateOdbSubnetRequest(), + {}, ], ) def test_create_odb_subnet(request_type, transport: str = "grpc"): @@ -16464,7 +16538,7 @@ def test_create_odb_subnet(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -16510,10 +16584,11 @@ def test_create_odb_subnet_non_empty_request_with_auto_populated_field(): client.create_odb_subnet(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gco_odb_subnet.CreateOdbSubnetRequest( + request_msg = gco_odb_subnet.CreateOdbSubnetRequest( parent="parent_value", odb_subnet_id="odb_subnet_id_value", ) + assert args[0] == request_msg def test_create_odb_subnet_use_cached_wrapped_rpc(): @@ -16606,9 +16681,14 @@ async def test_create_odb_subnet_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_odb_subnet_async( - transport: str = "grpc_asyncio", request_type=gco_odb_subnet.CreateOdbSubnetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gco_odb_subnet.CreateOdbSubnetRequest(), + {}, + ], +) +async def test_create_odb_subnet_async(request_type, transport: str = "grpc_asyncio"): client = OracleDatabaseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -16616,7 +16696,7 @@ async def test_create_odb_subnet_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( @@ -16638,11 +16718,6 @@ async def test_create_odb_subnet_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_odb_subnet_async_from_dict(): - await test_create_odb_subnet_async(request_type=dict) - - def test_create_odb_subnet_field_headers(): client = OracleDatabaseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16817,8 +16892,8 @@ async def test_create_odb_subnet_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - odb_subnet.DeleteOdbSubnetRequest, - dict, + odb_subnet.DeleteOdbSubnetRequest(), + {}, ], ) def test_delete_odb_subnet(request_type, transport: str = "grpc"): @@ -16829,7 +16904,7 @@ def test_delete_odb_subnet(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -16874,9 +16949,10 @@ def test_delete_odb_subnet_non_empty_request_with_auto_populated_field(): client.delete_odb_subnet(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == odb_subnet.DeleteOdbSubnetRequest( + request_msg = odb_subnet.DeleteOdbSubnetRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_odb_subnet_use_cached_wrapped_rpc(): @@ -16969,9 +17045,14 @@ async def test_delete_odb_subnet_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_odb_subnet_async( - transport: str = "grpc_asyncio", request_type=odb_subnet.DeleteOdbSubnetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + odb_subnet.DeleteOdbSubnetRequest(), + {}, + ], +) +async def test_delete_odb_subnet_async(request_type, transport: str = "grpc_asyncio"): client = OracleDatabaseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -16979,7 +17060,7 @@ async def test_delete_odb_subnet_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( @@ -17001,11 +17082,6 @@ async def test_delete_odb_subnet_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_odb_subnet_async_from_dict(): - await test_delete_odb_subnet_async(request_type=dict) - - def test_delete_odb_subnet_field_headers(): client = OracleDatabaseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17160,8 +17236,8 @@ async def test_delete_odb_subnet_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - oracledatabase.ListExadbVmClustersRequest, - dict, + oracledatabase.ListExadbVmClustersRequest(), + {}, ], ) def test_list_exadb_vm_clusters(request_type, transport: str = "grpc"): @@ -17172,7 +17248,7 @@ def test_list_exadb_vm_clusters(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -17223,12 +17299,13 @@ def test_list_exadb_vm_clusters_non_empty_request_with_auto_populated_field(): client.list_exadb_vm_clusters(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == oracledatabase.ListExadbVmClustersRequest( + request_msg = oracledatabase.ListExadbVmClustersRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_exadb_vm_clusters_use_cached_wrapped_rpc(): @@ -17314,9 +17391,15 @@ async def test_list_exadb_vm_clusters_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + oracledatabase.ListExadbVmClustersRequest(), + {}, + ], +) async def test_list_exadb_vm_clusters_async( - transport: str = "grpc_asyncio", - request_type=oracledatabase.ListExadbVmClustersRequest, + request_type, transport: str = "grpc_asyncio" ): client = OracleDatabaseAsyncClient( credentials=async_anonymous_credentials(), @@ -17325,7 +17408,7 @@ async def test_list_exadb_vm_clusters_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( @@ -17350,11 +17433,6 @@ async def test_list_exadb_vm_clusters_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_exadb_vm_clusters_async_from_dict(): - await test_list_exadb_vm_clusters_async(request_type=dict) - - def test_list_exadb_vm_clusters_field_headers(): client = OracleDatabaseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17707,8 +17785,8 @@ async def test_list_exadb_vm_clusters_async_pages(): @pytest.mark.parametrize( "request_type", [ - oracledatabase.GetExadbVmClusterRequest, - dict, + oracledatabase.GetExadbVmClusterRequest(), + {}, ], ) def test_get_exadb_vm_cluster(request_type, transport: str = "grpc"): @@ -17719,7 +17797,7 @@ def test_get_exadb_vm_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -17779,9 +17857,10 @@ def test_get_exadb_vm_cluster_non_empty_request_with_auto_populated_field(): client.get_exadb_vm_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == oracledatabase.GetExadbVmClusterRequest( + request_msg = oracledatabase.GetExadbVmClusterRequest( name="name_value", ) + assert args[0] == request_msg def test_get_exadb_vm_cluster_use_cached_wrapped_rpc(): @@ -17866,9 +17945,15 @@ async def test_get_exadb_vm_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + oracledatabase.GetExadbVmClusterRequest(), + {}, + ], +) async def test_get_exadb_vm_cluster_async( - transport: str = "grpc_asyncio", - request_type=oracledatabase.GetExadbVmClusterRequest, + request_type, transport: str = "grpc_asyncio" ): client = OracleDatabaseAsyncClient( credentials=async_anonymous_credentials(), @@ -17877,7 +17962,7 @@ async def test_get_exadb_vm_cluster_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( @@ -17914,11 +17999,6 @@ async def test_get_exadb_vm_cluster_async( assert response.entitlement_id == "entitlement_id_value" -@pytest.mark.asyncio -async def test_get_exadb_vm_cluster_async_from_dict(): - await test_get_exadb_vm_cluster_async(request_type=dict) - - def test_get_exadb_vm_cluster_field_headers(): client = OracleDatabaseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18073,8 +18153,8 @@ async def test_get_exadb_vm_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - oracledatabase.CreateExadbVmClusterRequest, - dict, + oracledatabase.CreateExadbVmClusterRequest(), + {}, ], ) def test_create_exadb_vm_cluster(request_type, transport: str = "grpc"): @@ -18085,7 +18165,7 @@ def test_create_exadb_vm_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -18131,10 +18211,11 @@ def test_create_exadb_vm_cluster_non_empty_request_with_auto_populated_field(): client.create_exadb_vm_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == oracledatabase.CreateExadbVmClusterRequest( + request_msg = oracledatabase.CreateExadbVmClusterRequest( parent="parent_value", exadb_vm_cluster_id="exadb_vm_cluster_id_value", ) + assert args[0] == request_msg def test_create_exadb_vm_cluster_use_cached_wrapped_rpc(): @@ -18230,9 +18311,15 @@ async def test_create_exadb_vm_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + oracledatabase.CreateExadbVmClusterRequest(), + {}, + ], +) async def test_create_exadb_vm_cluster_async( - transport: str = "grpc_asyncio", - request_type=oracledatabase.CreateExadbVmClusterRequest, + request_type, transport: str = "grpc_asyncio" ): client = OracleDatabaseAsyncClient( credentials=async_anonymous_credentials(), @@ -18241,7 +18328,7 @@ async def test_create_exadb_vm_cluster_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( @@ -18263,11 +18350,6 @@ async def test_create_exadb_vm_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_exadb_vm_cluster_async_from_dict(): - await test_create_exadb_vm_cluster_async(request_type=dict) - - def test_create_exadb_vm_cluster_field_headers(): client = OracleDatabaseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18442,8 +18524,8 @@ async def test_create_exadb_vm_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - oracledatabase.DeleteExadbVmClusterRequest, - dict, + oracledatabase.DeleteExadbVmClusterRequest(), + {}, ], ) def test_delete_exadb_vm_cluster(request_type, transport: str = "grpc"): @@ -18454,7 +18536,7 @@ def test_delete_exadb_vm_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -18499,9 +18581,10 @@ def test_delete_exadb_vm_cluster_non_empty_request_with_auto_populated_field(): client.delete_exadb_vm_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == oracledatabase.DeleteExadbVmClusterRequest( + request_msg = oracledatabase.DeleteExadbVmClusterRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_exadb_vm_cluster_use_cached_wrapped_rpc(): @@ -18597,9 +18680,15 @@ async def test_delete_exadb_vm_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + oracledatabase.DeleteExadbVmClusterRequest(), + {}, + ], +) async def test_delete_exadb_vm_cluster_async( - transport: str = "grpc_asyncio", - request_type=oracledatabase.DeleteExadbVmClusterRequest, + request_type, transport: str = "grpc_asyncio" ): client = OracleDatabaseAsyncClient( credentials=async_anonymous_credentials(), @@ -18608,7 +18697,7 @@ async def test_delete_exadb_vm_cluster_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( @@ -18630,11 +18719,6 @@ async def test_delete_exadb_vm_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_exadb_vm_cluster_async_from_dict(): - await test_delete_exadb_vm_cluster_async(request_type=dict) - - def test_delete_exadb_vm_cluster_field_headers(): client = OracleDatabaseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18789,8 +18873,8 @@ async def test_delete_exadb_vm_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - oracledatabase.UpdateExadbVmClusterRequest, - dict, + oracledatabase.UpdateExadbVmClusterRequest(), + {}, ], ) def test_update_exadb_vm_cluster(request_type, transport: str = "grpc"): @@ -18801,7 +18885,7 @@ def test_update_exadb_vm_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -18844,7 +18928,8 @@ def test_update_exadb_vm_cluster_non_empty_request_with_auto_populated_field(): client.update_exadb_vm_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == oracledatabase.UpdateExadbVmClusterRequest() + request_msg = oracledatabase.UpdateExadbVmClusterRequest() + assert args[0] == request_msg def test_update_exadb_vm_cluster_use_cached_wrapped_rpc(): @@ -18940,9 +19025,15 @@ async def test_update_exadb_vm_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + oracledatabase.UpdateExadbVmClusterRequest(), + {}, + ], +) async def test_update_exadb_vm_cluster_async( - transport: str = "grpc_asyncio", - request_type=oracledatabase.UpdateExadbVmClusterRequest, + request_type, transport: str = "grpc_asyncio" ): client = OracleDatabaseAsyncClient( credentials=async_anonymous_credentials(), @@ -18951,7 +19042,7 @@ async def test_update_exadb_vm_cluster_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( @@ -18973,11 +19064,6 @@ async def test_update_exadb_vm_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_exadb_vm_cluster_async_from_dict(): - await test_update_exadb_vm_cluster_async(request_type=dict) - - def test_update_exadb_vm_cluster_field_headers(): client = OracleDatabaseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -19142,8 +19228,8 @@ async def test_update_exadb_vm_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - oracledatabase.RemoveVirtualMachineExadbVmClusterRequest, - dict, + oracledatabase.RemoveVirtualMachineExadbVmClusterRequest(), + {}, ], ) def test_remove_virtual_machine_exadb_vm_cluster(request_type, transport: str = "grpc"): @@ -19154,7 +19240,7 @@ def test_remove_virtual_machine_exadb_vm_cluster(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( @@ -19199,9 +19285,10 @@ def test_remove_virtual_machine_exadb_vm_cluster_non_empty_request_with_auto_pop client.remove_virtual_machine_exadb_vm_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == oracledatabase.RemoveVirtualMachineExadbVmClusterRequest( + request_msg = oracledatabase.RemoveVirtualMachineExadbVmClusterRequest( name="name_value", ) + assert args[0] == request_msg def test_remove_virtual_machine_exadb_vm_cluster_use_cached_wrapped_rpc(): @@ -19297,9 +19384,15 @@ async def test_remove_virtual_machine_exadb_vm_cluster_async_use_cached_wrapped_ @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + oracledatabase.RemoveVirtualMachineExadbVmClusterRequest(), + {}, + ], +) async def test_remove_virtual_machine_exadb_vm_cluster_async( - transport: str = "grpc_asyncio", - request_type=oracledatabase.RemoveVirtualMachineExadbVmClusterRequest, + request_type, transport: str = "grpc_asyncio" ): client = OracleDatabaseAsyncClient( credentials=async_anonymous_credentials(), @@ -19308,7 +19401,7 @@ async def test_remove_virtual_machine_exadb_vm_cluster_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( @@ -19330,11 +19423,6 @@ async def test_remove_virtual_machine_exadb_vm_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_remove_virtual_machine_exadb_vm_cluster_async_from_dict(): - await test_remove_virtual_machine_exadb_vm_cluster_async(request_type=dict) - - def test_remove_virtual_machine_exadb_vm_cluster_field_headers(): client = OracleDatabaseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -19499,8 +19587,8 @@ async def test_remove_virtual_machine_exadb_vm_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - exascale_db_storage_vault.ListExascaleDbStorageVaultsRequest, - dict, + exascale_db_storage_vault.ListExascaleDbStorageVaultsRequest(), + {}, ], ) def test_list_exascale_db_storage_vaults(request_type, transport: str = "grpc"): @@ -19511,7 +19599,7 @@ def test_list_exascale_db_storage_vaults(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -19564,12 +19652,13 @@ def test_list_exascale_db_storage_vaults_non_empty_request_with_auto_populated_f client.list_exascale_db_storage_vaults(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == exascale_db_storage_vault.ListExascaleDbStorageVaultsRequest( + request_msg = exascale_db_storage_vault.ListExascaleDbStorageVaultsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_exascale_db_storage_vaults_use_cached_wrapped_rpc(): @@ -19655,9 +19744,15 @@ async def test_list_exascale_db_storage_vaults_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + exascale_db_storage_vault.ListExascaleDbStorageVaultsRequest(), + {}, + ], +) async def test_list_exascale_db_storage_vaults_async( - transport: str = "grpc_asyncio", - request_type=exascale_db_storage_vault.ListExascaleDbStorageVaultsRequest, + request_type, transport: str = "grpc_asyncio" ): client = OracleDatabaseAsyncClient( credentials=async_anonymous_credentials(), @@ -19666,7 +19761,7 @@ async def test_list_exascale_db_storage_vaults_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( @@ -19691,11 +19786,6 @@ async def test_list_exascale_db_storage_vaults_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_exascale_db_storage_vaults_async_from_dict(): - await test_list_exascale_db_storage_vaults_async(request_type=dict) - - def test_list_exascale_db_storage_vaults_field_headers(): client = OracleDatabaseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -20064,8 +20154,8 @@ async def test_list_exascale_db_storage_vaults_async_pages(): @pytest.mark.parametrize( "request_type", [ - exascale_db_storage_vault.GetExascaleDbStorageVaultRequest, - dict, + exascale_db_storage_vault.GetExascaleDbStorageVaultRequest(), + {}, ], ) def test_get_exascale_db_storage_vault(request_type, transport: str = "grpc"): @@ -20076,7 +20166,7 @@ def test_get_exascale_db_storage_vault(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -20130,9 +20220,10 @@ def test_get_exascale_db_storage_vault_non_empty_request_with_auto_populated_fie client.get_exascale_db_storage_vault(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == exascale_db_storage_vault.GetExascaleDbStorageVaultRequest( + request_msg = exascale_db_storage_vault.GetExascaleDbStorageVaultRequest( name="name_value", ) + assert args[0] == request_msg def test_get_exascale_db_storage_vault_use_cached_wrapped_rpc(): @@ -20218,9 +20309,15 @@ async def test_get_exascale_db_storage_vault_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + exascale_db_storage_vault.GetExascaleDbStorageVaultRequest(), + {}, + ], +) async def test_get_exascale_db_storage_vault_async( - transport: str = "grpc_asyncio", - request_type=exascale_db_storage_vault.GetExascaleDbStorageVaultRequest, + request_type, transport: str = "grpc_asyncio" ): client = OracleDatabaseAsyncClient( credentials=async_anonymous_credentials(), @@ -20229,7 +20326,7 @@ async def test_get_exascale_db_storage_vault_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( @@ -20260,11 +20357,6 @@ async def test_get_exascale_db_storage_vault_async( assert response.entitlement_id == "entitlement_id_value" -@pytest.mark.asyncio -async def test_get_exascale_db_storage_vault_async_from_dict(): - await test_get_exascale_db_storage_vault_async(request_type=dict) - - def test_get_exascale_db_storage_vault_field_headers(): client = OracleDatabaseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -20419,8 +20511,8 @@ async def test_get_exascale_db_storage_vault_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gco_exascale_db_storage_vault.CreateExascaleDbStorageVaultRequest, - dict, + gco_exascale_db_storage_vault.CreateExascaleDbStorageVaultRequest(), + {}, ], ) def test_create_exascale_db_storage_vault(request_type, transport: str = "grpc"): @@ -20431,7 +20523,7 @@ def test_create_exascale_db_storage_vault(request_type, transport: str = "grpc") # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -20477,12 +20569,11 @@ def test_create_exascale_db_storage_vault_non_empty_request_with_auto_populated_ client.create_exascale_db_storage_vault(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == gco_exascale_db_storage_vault.CreateExascaleDbStorageVaultRequest( + request_msg = gco_exascale_db_storage_vault.CreateExascaleDbStorageVaultRequest( parent="parent_value", exascale_db_storage_vault_id="exascale_db_storage_vault_id_value", ) + assert args[0] == request_msg def test_create_exascale_db_storage_vault_use_cached_wrapped_rpc(): @@ -20578,9 +20669,15 @@ async def test_create_exascale_db_storage_vault_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gco_exascale_db_storage_vault.CreateExascaleDbStorageVaultRequest(), + {}, + ], +) async def test_create_exascale_db_storage_vault_async( - transport: str = "grpc_asyncio", - request_type=gco_exascale_db_storage_vault.CreateExascaleDbStorageVaultRequest, + request_type, transport: str = "grpc_asyncio" ): client = OracleDatabaseAsyncClient( credentials=async_anonymous_credentials(), @@ -20589,7 +20686,7 @@ async def test_create_exascale_db_storage_vault_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( @@ -20611,11 +20708,6 @@ async def test_create_exascale_db_storage_vault_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_exascale_db_storage_vault_async_from_dict(): - await test_create_exascale_db_storage_vault_async(request_type=dict) - - def test_create_exascale_db_storage_vault_field_headers(): client = OracleDatabaseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -20802,8 +20894,8 @@ async def test_create_exascale_db_storage_vault_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - exascale_db_storage_vault.DeleteExascaleDbStorageVaultRequest, - dict, + exascale_db_storage_vault.DeleteExascaleDbStorageVaultRequest(), + {}, ], ) def test_delete_exascale_db_storage_vault(request_type, transport: str = "grpc"): @@ -20814,7 +20906,7 @@ def test_delete_exascale_db_storage_vault(request_type, transport: str = "grpc") # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -20859,9 +20951,10 @@ def test_delete_exascale_db_storage_vault_non_empty_request_with_auto_populated_ client.delete_exascale_db_storage_vault(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == exascale_db_storage_vault.DeleteExascaleDbStorageVaultRequest( + request_msg = exascale_db_storage_vault.DeleteExascaleDbStorageVaultRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_exascale_db_storage_vault_use_cached_wrapped_rpc(): @@ -20957,9 +21050,15 @@ async def test_delete_exascale_db_storage_vault_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + exascale_db_storage_vault.DeleteExascaleDbStorageVaultRequest(), + {}, + ], +) async def test_delete_exascale_db_storage_vault_async( - transport: str = "grpc_asyncio", - request_type=exascale_db_storage_vault.DeleteExascaleDbStorageVaultRequest, + request_type, transport: str = "grpc_asyncio" ): client = OracleDatabaseAsyncClient( credentials=async_anonymous_credentials(), @@ -20968,7 +21067,7 @@ async def test_delete_exascale_db_storage_vault_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( @@ -20990,11 +21089,6 @@ async def test_delete_exascale_db_storage_vault_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_exascale_db_storage_vault_async_from_dict(): - await test_delete_exascale_db_storage_vault_async(request_type=dict) - - def test_delete_exascale_db_storage_vault_field_headers(): client = OracleDatabaseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -21149,8 +21243,8 @@ async def test_delete_exascale_db_storage_vault_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - db_system_initial_storage_size.ListDbSystemInitialStorageSizesRequest, - dict, + db_system_initial_storage_size.ListDbSystemInitialStorageSizesRequest(), + {}, ], ) def test_list_db_system_initial_storage_sizes(request_type, transport: str = "grpc"): @@ -21161,7 +21255,7 @@ def test_list_db_system_initial_storage_sizes(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( @@ -21214,12 +21308,13 @@ def test_list_db_system_initial_storage_sizes_non_empty_request_with_auto_popula client.list_db_system_initial_storage_sizes(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == db_system_initial_storage_size.ListDbSystemInitialStorageSizesRequest( - parent="parent_value", - page_token="page_token_value", + request_msg = ( + db_system_initial_storage_size.ListDbSystemInitialStorageSizesRequest( + parent="parent_value", + page_token="page_token_value", + ) ) + assert args[0] == request_msg def test_list_db_system_initial_storage_sizes_use_cached_wrapped_rpc(): @@ -21305,9 +21400,15 @@ async def test_list_db_system_initial_storage_sizes_async_use_cached_wrapped_rpc @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + db_system_initial_storage_size.ListDbSystemInitialStorageSizesRequest(), + {}, + ], +) async def test_list_db_system_initial_storage_sizes_async( - transport: str = "grpc_asyncio", - request_type=db_system_initial_storage_size.ListDbSystemInitialStorageSizesRequest, + request_type, transport: str = "grpc_asyncio" ): client = OracleDatabaseAsyncClient( credentials=async_anonymous_credentials(), @@ -21316,7 +21417,7 @@ async def test_list_db_system_initial_storage_sizes_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( @@ -21343,11 +21444,6 @@ async def test_list_db_system_initial_storage_sizes_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_db_system_initial_storage_sizes_async_from_dict(): - await test_list_db_system_initial_storage_sizes_async(request_type=dict) - - def test_list_db_system_initial_storage_sizes_field_headers(): client = OracleDatabaseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -21716,8 +21812,8 @@ async def test_list_db_system_initial_storage_sizes_async_pages(): @pytest.mark.parametrize( "request_type", [ - database.ListDatabasesRequest, - dict, + database.ListDatabasesRequest(), + {}, ], ) def test_list_databases(request_type, transport: str = "grpc"): @@ -21728,7 +21824,7 @@ def test_list_databases(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_databases), "__call__") as call: @@ -21774,11 +21870,12 @@ def test_list_databases_non_empty_request_with_auto_populated_field(): client.list_databases(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == database.ListDatabasesRequest( + request_msg = database.ListDatabasesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_databases_use_cached_wrapped_rpc(): @@ -21859,9 +21956,14 @@ async def test_list_databases_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_databases_async( - transport: str = "grpc_asyncio", request_type=database.ListDatabasesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + database.ListDatabasesRequest(), + {}, + ], +) +async def test_list_databases_async(request_type, transport: str = "grpc_asyncio"): client = OracleDatabaseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -21869,7 +21971,7 @@ async def test_list_databases_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_databases), "__call__") as call: @@ -21892,11 +21994,6 @@ async def test_list_databases_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_databases_async_from_dict(): - await test_list_databases_async(request_type=dict) - - def test_list_databases_field_headers(): client = OracleDatabaseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -22233,8 +22330,8 @@ async def test_list_databases_async_pages(): @pytest.mark.parametrize( "request_type", [ - database.GetDatabaseRequest, - dict, + database.GetDatabaseRequest(), + {}, ], ) def test_get_database(request_type, transport: str = "grpc"): @@ -22245,7 +22342,7 @@ def test_get_database(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_database), "__call__") as call: @@ -22314,9 +22411,10 @@ def test_get_database_non_empty_request_with_auto_populated_field(): client.get_database(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == database.GetDatabaseRequest( + request_msg = database.GetDatabaseRequest( name="name_value", ) + assert args[0] == request_msg def test_get_database_use_cached_wrapped_rpc(): @@ -22397,9 +22495,14 @@ async def test_get_database_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_database_async( - transport: str = "grpc_asyncio", request_type=database.GetDatabaseRequest -): +@pytest.mark.parametrize( + "request_type", + [ + database.GetDatabaseRequest(), + {}, + ], +) +async def test_get_database_async(request_type, transport: str = "grpc_asyncio"): client = OracleDatabaseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -22407,7 +22510,7 @@ async def test_get_database_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_database), "__call__") as call: @@ -22455,11 +22558,6 @@ async def test_get_database_async( ) -@pytest.mark.asyncio -async def test_get_database_async_from_dict(): - await test_get_database_async(request_type=dict) - - def test_get_database_field_headers(): client = OracleDatabaseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -22602,8 +22700,8 @@ async def test_get_database_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - pluggable_database.ListPluggableDatabasesRequest, - dict, + pluggable_database.ListPluggableDatabasesRequest(), + {}, ], ) def test_list_pluggable_databases(request_type, transport: str = "grpc"): @@ -22614,7 +22712,7 @@ def test_list_pluggable_databases(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -22664,11 +22762,12 @@ def test_list_pluggable_databases_non_empty_request_with_auto_populated_field(): client.list_pluggable_databases(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == pluggable_database.ListPluggableDatabasesRequest( + request_msg = pluggable_database.ListPluggableDatabasesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_pluggable_databases_use_cached_wrapped_rpc(): @@ -22754,9 +22853,15 @@ async def test_list_pluggable_databases_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + pluggable_database.ListPluggableDatabasesRequest(), + {}, + ], +) async def test_list_pluggable_databases_async( - transport: str = "grpc_asyncio", - request_type=pluggable_database.ListPluggableDatabasesRequest, + request_type, transport: str = "grpc_asyncio" ): client = OracleDatabaseAsyncClient( credentials=async_anonymous_credentials(), @@ -22765,7 +22870,7 @@ async def test_list_pluggable_databases_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( @@ -22790,11 +22895,6 @@ async def test_list_pluggable_databases_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_pluggable_databases_async_from_dict(): - await test_list_pluggable_databases_async(request_type=dict) - - def test_list_pluggable_databases_field_headers(): client = OracleDatabaseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -23151,8 +23251,8 @@ async def test_list_pluggable_databases_async_pages(): @pytest.mark.parametrize( "request_type", [ - pluggable_database.GetPluggableDatabaseRequest, - dict, + pluggable_database.GetPluggableDatabaseRequest(), + {}, ], ) def test_get_pluggable_database(request_type, transport: str = "grpc"): @@ -23163,7 +23263,7 @@ def test_get_pluggable_database(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -23213,9 +23313,10 @@ def test_get_pluggable_database_non_empty_request_with_auto_populated_field(): client.get_pluggable_database(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == pluggable_database.GetPluggableDatabaseRequest( + request_msg = pluggable_database.GetPluggableDatabaseRequest( name="name_value", ) + assert args[0] == request_msg def test_get_pluggable_database_use_cached_wrapped_rpc(): @@ -23301,9 +23402,15 @@ async def test_get_pluggable_database_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + pluggable_database.GetPluggableDatabaseRequest(), + {}, + ], +) async def test_get_pluggable_database_async( - transport: str = "grpc_asyncio", - request_type=pluggable_database.GetPluggableDatabaseRequest, + request_type, transport: str = "grpc_asyncio" ): client = OracleDatabaseAsyncClient( credentials=async_anonymous_credentials(), @@ -23312,7 +23419,7 @@ async def test_get_pluggable_database_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( @@ -23339,11 +23446,6 @@ async def test_get_pluggable_database_async( assert response.oci_url == "oci_url_value" -@pytest.mark.asyncio -async def test_get_pluggable_database_async_from_dict(): - await test_get_pluggable_database_async(request_type=dict) - - def test_get_pluggable_database_field_headers(): client = OracleDatabaseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -23498,8 +23600,8 @@ async def test_get_pluggable_database_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - db_system.ListDbSystemsRequest, - dict, + db_system.ListDbSystemsRequest(), + {}, ], ) def test_list_db_systems(request_type, transport: str = "grpc"): @@ -23510,7 +23612,7 @@ def test_list_db_systems(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_db_systems), "__call__") as call: @@ -23557,12 +23659,13 @@ def test_list_db_systems_non_empty_request_with_auto_populated_field(): client.list_db_systems(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == db_system.ListDbSystemsRequest( + request_msg = db_system.ListDbSystemsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_db_systems_use_cached_wrapped_rpc(): @@ -23643,9 +23746,14 @@ async def test_list_db_systems_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_db_systems_async( - transport: str = "grpc_asyncio", request_type=db_system.ListDbSystemsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + db_system.ListDbSystemsRequest(), + {}, + ], +) +async def test_list_db_systems_async(request_type, transport: str = "grpc_asyncio"): client = OracleDatabaseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -23653,7 +23761,7 @@ async def test_list_db_systems_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_db_systems), "__call__") as call: @@ -23676,11 +23784,6 @@ async def test_list_db_systems_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_db_systems_async_from_dict(): - await test_list_db_systems_async(request_type=dict) - - def test_list_db_systems_field_headers(): client = OracleDatabaseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -24017,8 +24120,8 @@ async def test_list_db_systems_async_pages(): @pytest.mark.parametrize( "request_type", [ - db_system.GetDbSystemRequest, - dict, + db_system.GetDbSystemRequest(), + {}, ], ) def test_get_db_system(request_type, transport: str = "grpc"): @@ -24029,7 +24132,7 @@ def test_get_db_system(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_db_system), "__call__") as call: @@ -24085,9 +24188,10 @@ def test_get_db_system_non_empty_request_with_auto_populated_field(): client.get_db_system(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == db_system.GetDbSystemRequest( + request_msg = db_system.GetDbSystemRequest( name="name_value", ) + assert args[0] == request_msg def test_get_db_system_use_cached_wrapped_rpc(): @@ -24168,9 +24272,14 @@ async def test_get_db_system_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_db_system_async( - transport: str = "grpc_asyncio", request_type=db_system.GetDbSystemRequest -): +@pytest.mark.parametrize( + "request_type", + [ + db_system.GetDbSystemRequest(), + {}, + ], +) +async def test_get_db_system_async(request_type, transport: str = "grpc_asyncio"): client = OracleDatabaseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -24178,7 +24287,7 @@ async def test_get_db_system_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_db_system), "__call__") as call: @@ -24213,11 +24322,6 @@ async def test_get_db_system_async( assert response.oci_url == "oci_url_value" -@pytest.mark.asyncio -async def test_get_db_system_async_from_dict(): - await test_get_db_system_async(request_type=dict) - - def test_get_db_system_field_headers(): client = OracleDatabaseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -24360,8 +24464,8 @@ async def test_get_db_system_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gco_db_system.CreateDbSystemRequest, - dict, + gco_db_system.CreateDbSystemRequest(), + {}, ], ) def test_create_db_system(request_type, transport: str = "grpc"): @@ -24372,7 +24476,7 @@ def test_create_db_system(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_db_system), "__call__") as call: @@ -24414,10 +24518,11 @@ def test_create_db_system_non_empty_request_with_auto_populated_field(): client.create_db_system(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gco_db_system.CreateDbSystemRequest( + request_msg = gco_db_system.CreateDbSystemRequest( parent="parent_value", db_system_id="db_system_id_value", ) + assert args[0] == request_msg def test_create_db_system_use_cached_wrapped_rpc(): @@ -24510,9 +24615,14 @@ async def test_create_db_system_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_db_system_async( - transport: str = "grpc_asyncio", request_type=gco_db_system.CreateDbSystemRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gco_db_system.CreateDbSystemRequest(), + {}, + ], +) +async def test_create_db_system_async(request_type, transport: str = "grpc_asyncio"): client = OracleDatabaseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -24520,7 +24630,7 @@ async def test_create_db_system_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_db_system), "__call__") as call: @@ -24540,11 +24650,6 @@ async def test_create_db_system_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_db_system_async_from_dict(): - await test_create_db_system_async(request_type=dict) - - def test_create_db_system_field_headers(): client = OracleDatabaseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -24711,8 +24816,8 @@ async def test_create_db_system_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - db_system.DeleteDbSystemRequest, - dict, + db_system.DeleteDbSystemRequest(), + {}, ], ) def test_delete_db_system(request_type, transport: str = "grpc"): @@ -24723,7 +24828,7 @@ def test_delete_db_system(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_db_system), "__call__") as call: @@ -24764,9 +24869,10 @@ def test_delete_db_system_non_empty_request_with_auto_populated_field(): client.delete_db_system(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == db_system.DeleteDbSystemRequest( + request_msg = db_system.DeleteDbSystemRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_db_system_use_cached_wrapped_rpc(): @@ -24859,9 +24965,14 @@ async def test_delete_db_system_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_db_system_async( - transport: str = "grpc_asyncio", request_type=db_system.DeleteDbSystemRequest -): +@pytest.mark.parametrize( + "request_type", + [ + db_system.DeleteDbSystemRequest(), + {}, + ], +) +async def test_delete_db_system_async(request_type, transport: str = "grpc_asyncio"): client = OracleDatabaseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -24869,7 +24980,7 @@ async def test_delete_db_system_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_db_system), "__call__") as call: @@ -24889,11 +25000,6 @@ async def test_delete_db_system_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_db_system_async_from_dict(): - await test_delete_db_system_async(request_type=dict) - - def test_delete_db_system_field_headers(): client = OracleDatabaseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -25040,8 +25146,8 @@ async def test_delete_db_system_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - db_version.ListDbVersionsRequest, - dict, + db_version.ListDbVersionsRequest(), + {}, ], ) def test_list_db_versions(request_type, transport: str = "grpc"): @@ -25052,7 +25158,7 @@ def test_list_db_versions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_db_versions), "__call__") as call: @@ -25098,11 +25204,12 @@ def test_list_db_versions_non_empty_request_with_auto_populated_field(): client.list_db_versions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == db_version.ListDbVersionsRequest( + request_msg = db_version.ListDbVersionsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_db_versions_use_cached_wrapped_rpc(): @@ -25185,9 +25292,14 @@ async def test_list_db_versions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_db_versions_async( - transport: str = "grpc_asyncio", request_type=db_version.ListDbVersionsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + db_version.ListDbVersionsRequest(), + {}, + ], +) +async def test_list_db_versions_async(request_type, transport: str = "grpc_asyncio"): client = OracleDatabaseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -25195,7 +25307,7 @@ async def test_list_db_versions_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_db_versions), "__call__") as call: @@ -25218,11 +25330,6 @@ async def test_list_db_versions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_db_versions_async_from_dict(): - await test_list_db_versions_async(request_type=dict) - - def test_list_db_versions_field_headers(): client = OracleDatabaseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -25559,8 +25666,8 @@ async def test_list_db_versions_async_pages(): @pytest.mark.parametrize( "request_type", [ - database_character_set.ListDatabaseCharacterSetsRequest, - dict, + database_character_set.ListDatabaseCharacterSetsRequest(), + {}, ], ) def test_list_database_character_sets(request_type, transport: str = "grpc"): @@ -25571,7 +25678,7 @@ def test_list_database_character_sets(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -25621,11 +25728,12 @@ def test_list_database_character_sets_non_empty_request_with_auto_populated_fiel client.list_database_character_sets(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == database_character_set.ListDatabaseCharacterSetsRequest( + request_msg = database_character_set.ListDatabaseCharacterSetsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_database_character_sets_use_cached_wrapped_rpc(): @@ -25711,9 +25819,15 @@ async def test_list_database_character_sets_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + database_character_set.ListDatabaseCharacterSetsRequest(), + {}, + ], +) async def test_list_database_character_sets_async( - transport: str = "grpc_asyncio", - request_type=database_character_set.ListDatabaseCharacterSetsRequest, + request_type, transport: str = "grpc_asyncio" ): client = OracleDatabaseAsyncClient( credentials=async_anonymous_credentials(), @@ -25722,7 +25836,7 @@ async def test_list_database_character_sets_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( @@ -25747,11 +25861,6 @@ async def test_list_database_character_sets_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_database_character_sets_async_from_dict(): - await test_list_database_character_sets_async(request_type=dict) - - def test_list_database_character_sets_field_headers(): client = OracleDatabaseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -39208,7 +39317,6 @@ def test_list_cloud_exadata_infrastructures_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.ListCloudExadataInfrastructuresRequest() - assert args[0] == request_msg @@ -39231,7 +39339,6 @@ def test_get_cloud_exadata_infrastructure_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.GetCloudExadataInfrastructureRequest() - assert args[0] == request_msg @@ -39254,7 +39361,6 @@ def test_create_cloud_exadata_infrastructure_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.CreateCloudExadataInfrastructureRequest() - assert args[0] == request_msg @@ -39277,7 +39383,6 @@ def test_delete_cloud_exadata_infrastructure_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.DeleteCloudExadataInfrastructureRequest() - assert args[0] == request_msg @@ -39300,7 +39405,6 @@ def test_list_cloud_vm_clusters_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.ListCloudVmClustersRequest() - assert args[0] == request_msg @@ -39323,7 +39427,6 @@ def test_get_cloud_vm_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.GetCloudVmClusterRequest() - assert args[0] == request_msg @@ -39346,7 +39449,6 @@ def test_create_cloud_vm_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.CreateCloudVmClusterRequest() - assert args[0] == request_msg @@ -39369,7 +39471,6 @@ def test_delete_cloud_vm_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.DeleteCloudVmClusterRequest() - assert args[0] == request_msg @@ -39392,7 +39493,6 @@ def test_list_entitlements_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.ListEntitlementsRequest() - assert args[0] == request_msg @@ -39413,7 +39513,6 @@ def test_list_db_servers_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.ListDbServersRequest() - assert args[0] == request_msg @@ -39434,7 +39533,6 @@ def test_list_db_nodes_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.ListDbNodesRequest() - assert args[0] == request_msg @@ -39455,7 +39553,6 @@ def test_list_gi_versions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.ListGiVersionsRequest() - assert args[0] == request_msg @@ -39478,7 +39575,6 @@ def test_list_minor_versions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = minor_version.ListMinorVersionsRequest() - assert args[0] == request_msg @@ -39501,7 +39597,6 @@ def test_list_db_system_shapes_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.ListDbSystemShapesRequest() - assert args[0] == request_msg @@ -39524,7 +39619,6 @@ def test_list_autonomous_databases_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.ListAutonomousDatabasesRequest() - assert args[0] == request_msg @@ -39547,7 +39641,6 @@ def test_get_autonomous_database_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.GetAutonomousDatabaseRequest() - assert args[0] == request_msg @@ -39570,7 +39663,6 @@ def test_create_autonomous_database_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.CreateAutonomousDatabaseRequest() - assert args[0] == request_msg @@ -39593,7 +39685,6 @@ def test_update_autonomous_database_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.UpdateAutonomousDatabaseRequest() - assert args[0] == request_msg @@ -39616,7 +39707,6 @@ def test_delete_autonomous_database_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.DeleteAutonomousDatabaseRequest() - assert args[0] == request_msg @@ -39639,7 +39729,6 @@ def test_restore_autonomous_database_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.RestoreAutonomousDatabaseRequest() - assert args[0] == request_msg @@ -39662,7 +39751,6 @@ def test_generate_autonomous_database_wallet_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.GenerateAutonomousDatabaseWalletRequest() - assert args[0] == request_msg @@ -39685,7 +39773,6 @@ def test_list_autonomous_db_versions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.ListAutonomousDbVersionsRequest() - assert args[0] == request_msg @@ -39708,7 +39795,6 @@ def test_list_autonomous_database_character_sets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.ListAutonomousDatabaseCharacterSetsRequest() - assert args[0] == request_msg @@ -39731,7 +39817,6 @@ def test_list_autonomous_database_backups_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.ListAutonomousDatabaseBackupsRequest() - assert args[0] == request_msg @@ -39754,7 +39839,6 @@ def test_stop_autonomous_database_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.StopAutonomousDatabaseRequest() - assert args[0] == request_msg @@ -39777,7 +39861,6 @@ def test_start_autonomous_database_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.StartAutonomousDatabaseRequest() - assert args[0] == request_msg @@ -39800,7 +39883,6 @@ def test_restart_autonomous_database_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.RestartAutonomousDatabaseRequest() - assert args[0] == request_msg @@ -39823,7 +39905,6 @@ def test_switchover_autonomous_database_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.SwitchoverAutonomousDatabaseRequest() - assert args[0] == request_msg @@ -39846,7 +39927,6 @@ def test_failover_autonomous_database_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.FailoverAutonomousDatabaseRequest() - assert args[0] == request_msg @@ -39869,7 +39949,6 @@ def test_list_odb_networks_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = odb_network.ListOdbNetworksRequest() - assert args[0] == request_msg @@ -39890,7 +39969,6 @@ def test_get_odb_network_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = odb_network.GetOdbNetworkRequest() - assert args[0] == request_msg @@ -39913,7 +39991,6 @@ def test_create_odb_network_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gco_odb_network.CreateOdbNetworkRequest() - assert args[0] == request_msg @@ -39936,7 +40013,6 @@ def test_delete_odb_network_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = odb_network.DeleteOdbNetworkRequest() - assert args[0] == request_msg @@ -39957,7 +40033,6 @@ def test_list_odb_subnets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = odb_subnet.ListOdbSubnetsRequest() - assert args[0] == request_msg @@ -39978,7 +40053,6 @@ def test_get_odb_subnet_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = odb_subnet.GetOdbSubnetRequest() - assert args[0] == request_msg @@ -40001,7 +40075,6 @@ def test_create_odb_subnet_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gco_odb_subnet.CreateOdbSubnetRequest() - assert args[0] == request_msg @@ -40024,7 +40097,6 @@ def test_delete_odb_subnet_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = odb_subnet.DeleteOdbSubnetRequest() - assert args[0] == request_msg @@ -40047,7 +40119,6 @@ def test_list_exadb_vm_clusters_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.ListExadbVmClustersRequest() - assert args[0] == request_msg @@ -40070,7 +40141,6 @@ def test_get_exadb_vm_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.GetExadbVmClusterRequest() - assert args[0] == request_msg @@ -40093,7 +40163,6 @@ def test_create_exadb_vm_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.CreateExadbVmClusterRequest() - assert args[0] == request_msg @@ -40116,7 +40185,6 @@ def test_delete_exadb_vm_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.DeleteExadbVmClusterRequest() - assert args[0] == request_msg @@ -40139,7 +40207,6 @@ def test_update_exadb_vm_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.UpdateExadbVmClusterRequest() - assert args[0] == request_msg @@ -40162,7 +40229,6 @@ def test_remove_virtual_machine_exadb_vm_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.RemoveVirtualMachineExadbVmClusterRequest() - assert args[0] == request_msg @@ -40187,7 +40253,6 @@ def test_list_exascale_db_storage_vaults_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = exascale_db_storage_vault.ListExascaleDbStorageVaultsRequest() - assert args[0] == request_msg @@ -40210,7 +40275,6 @@ def test_get_exascale_db_storage_vault_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = exascale_db_storage_vault.GetExascaleDbStorageVaultRequest() - assert args[0] == request_msg @@ -40235,7 +40299,6 @@ def test_create_exascale_db_storage_vault_empty_call_grpc(): request_msg = ( gco_exascale_db_storage_vault.CreateExascaleDbStorageVaultRequest() ) - assert args[0] == request_msg @@ -40258,7 +40321,6 @@ def test_delete_exascale_db_storage_vault_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = exascale_db_storage_vault.DeleteExascaleDbStorageVaultRequest() - assert args[0] == request_msg @@ -40285,7 +40347,6 @@ def test_list_db_system_initial_storage_sizes_empty_call_grpc(): request_msg = ( db_system_initial_storage_size.ListDbSystemInitialStorageSizesRequest() ) - assert args[0] == request_msg @@ -40306,7 +40367,6 @@ def test_list_databases_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = database.ListDatabasesRequest() - assert args[0] == request_msg @@ -40327,7 +40387,6 @@ def test_get_database_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = database.GetDatabaseRequest() - assert args[0] == request_msg @@ -40350,7 +40409,6 @@ def test_list_pluggable_databases_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pluggable_database.ListPluggableDatabasesRequest() - assert args[0] == request_msg @@ -40373,7 +40431,6 @@ def test_get_pluggable_database_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pluggable_database.GetPluggableDatabaseRequest() - assert args[0] == request_msg @@ -40394,7 +40451,6 @@ def test_list_db_systems_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = db_system.ListDbSystemsRequest() - assert args[0] == request_msg @@ -40415,7 +40471,6 @@ def test_get_db_system_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = db_system.GetDbSystemRequest() - assert args[0] == request_msg @@ -40436,7 +40491,6 @@ def test_create_db_system_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gco_db_system.CreateDbSystemRequest() - assert args[0] == request_msg @@ -40457,7 +40511,6 @@ def test_delete_db_system_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = db_system.DeleteDbSystemRequest() - assert args[0] == request_msg @@ -40478,7 +40531,6 @@ def test_list_db_versions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = db_version.ListDbVersionsRequest() - assert args[0] == request_msg @@ -40501,7 +40553,6 @@ def test_list_database_character_sets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = database_character_set.ListDatabaseCharacterSetsRequest() - assert args[0] == request_msg @@ -40544,7 +40595,6 @@ async def test_list_cloud_exadata_infrastructures_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.ListCloudExadataInfrastructuresRequest() - assert args[0] == request_msg @@ -40576,7 +40626,6 @@ async def test_get_cloud_exadata_infrastructure_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.GetCloudExadataInfrastructureRequest() - assert args[0] == request_msg @@ -40603,7 +40652,6 @@ async def test_create_cloud_exadata_infrastructure_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.CreateCloudExadataInfrastructureRequest() - assert args[0] == request_msg @@ -40630,7 +40678,6 @@ async def test_delete_cloud_exadata_infrastructure_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.DeleteCloudExadataInfrastructureRequest() - assert args[0] == request_msg @@ -40659,7 +40706,6 @@ async def test_list_cloud_vm_clusters_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.ListCloudVmClustersRequest() - assert args[0] == request_msg @@ -40697,7 +40743,6 @@ async def test_get_cloud_vm_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.GetCloudVmClusterRequest() - assert args[0] == request_msg @@ -40724,7 +40769,6 @@ async def test_create_cloud_vm_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.CreateCloudVmClusterRequest() - assert args[0] == request_msg @@ -40751,7 +40795,6 @@ async def test_delete_cloud_vm_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.DeleteCloudVmClusterRequest() - assert args[0] == request_msg @@ -40780,7 +40823,6 @@ async def test_list_entitlements_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.ListEntitlementsRequest() - assert args[0] == request_msg @@ -40807,7 +40849,6 @@ async def test_list_db_servers_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.ListDbServersRequest() - assert args[0] == request_msg @@ -40834,7 +40875,6 @@ async def test_list_db_nodes_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.ListDbNodesRequest() - assert args[0] == request_msg @@ -40861,7 +40901,6 @@ async def test_list_gi_versions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.ListGiVersionsRequest() - assert args[0] == request_msg @@ -40890,7 +40929,6 @@ async def test_list_minor_versions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = minor_version.ListMinorVersionsRequest() - assert args[0] == request_msg @@ -40919,7 +40957,6 @@ async def test_list_db_system_shapes_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.ListDbSystemShapesRequest() - assert args[0] == request_msg @@ -40948,7 +40985,6 @@ async def test_list_autonomous_databases_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.ListAutonomousDatabasesRequest() - assert args[0] == request_msg @@ -40989,7 +41025,6 @@ async def test_get_autonomous_database_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.GetAutonomousDatabaseRequest() - assert args[0] == request_msg @@ -41016,7 +41051,6 @@ async def test_create_autonomous_database_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.CreateAutonomousDatabaseRequest() - assert args[0] == request_msg @@ -41043,7 +41077,6 @@ async def test_update_autonomous_database_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.UpdateAutonomousDatabaseRequest() - assert args[0] == request_msg @@ -41070,7 +41103,6 @@ async def test_delete_autonomous_database_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.DeleteAutonomousDatabaseRequest() - assert args[0] == request_msg @@ -41097,7 +41129,6 @@ async def test_restore_autonomous_database_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.RestoreAutonomousDatabaseRequest() - assert args[0] == request_msg @@ -41126,7 +41157,6 @@ async def test_generate_autonomous_database_wallet_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.GenerateAutonomousDatabaseWalletRequest() - assert args[0] == request_msg @@ -41155,7 +41185,6 @@ async def test_list_autonomous_db_versions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.ListAutonomousDbVersionsRequest() - assert args[0] == request_msg @@ -41184,7 +41213,6 @@ async def test_list_autonomous_database_character_sets_empty_call_grpc_asyncio() call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.ListAutonomousDatabaseCharacterSetsRequest() - assert args[0] == request_msg @@ -41213,7 +41241,6 @@ async def test_list_autonomous_database_backups_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.ListAutonomousDatabaseBackupsRequest() - assert args[0] == request_msg @@ -41240,7 +41267,6 @@ async def test_stop_autonomous_database_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.StopAutonomousDatabaseRequest() - assert args[0] == request_msg @@ -41267,7 +41293,6 @@ async def test_start_autonomous_database_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.StartAutonomousDatabaseRequest() - assert args[0] == request_msg @@ -41294,7 +41319,6 @@ async def test_restart_autonomous_database_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.RestartAutonomousDatabaseRequest() - assert args[0] == request_msg @@ -41321,7 +41345,6 @@ async def test_switchover_autonomous_database_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.SwitchoverAutonomousDatabaseRequest() - assert args[0] == request_msg @@ -41348,7 +41371,6 @@ async def test_failover_autonomous_database_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.FailoverAutonomousDatabaseRequest() - assert args[0] == request_msg @@ -41378,7 +41400,6 @@ async def test_list_odb_networks_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = odb_network.ListOdbNetworksRequest() - assert args[0] == request_msg @@ -41409,7 +41430,6 @@ async def test_get_odb_network_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = odb_network.GetOdbNetworkRequest() - assert args[0] == request_msg @@ -41436,7 +41456,6 @@ async def test_create_odb_network_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gco_odb_network.CreateOdbNetworkRequest() - assert args[0] == request_msg @@ -41463,7 +41482,6 @@ async def test_delete_odb_network_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = odb_network.DeleteOdbNetworkRequest() - assert args[0] == request_msg @@ -41491,7 +41509,6 @@ async def test_list_odb_subnets_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = odb_subnet.ListOdbSubnetsRequest() - assert args[0] == request_msg @@ -41521,7 +41538,6 @@ async def test_get_odb_subnet_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = odb_subnet.GetOdbSubnetRequest() - assert args[0] == request_msg @@ -41548,7 +41564,6 @@ async def test_create_odb_subnet_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gco_odb_subnet.CreateOdbSubnetRequest() - assert args[0] == request_msg @@ -41575,7 +41590,6 @@ async def test_delete_odb_subnet_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = odb_subnet.DeleteOdbSubnetRequest() - assert args[0] == request_msg @@ -41604,7 +41618,6 @@ async def test_list_exadb_vm_clusters_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.ListExadbVmClustersRequest() - assert args[0] == request_msg @@ -41639,7 +41652,6 @@ async def test_get_exadb_vm_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.GetExadbVmClusterRequest() - assert args[0] == request_msg @@ -41666,7 +41678,6 @@ async def test_create_exadb_vm_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.CreateExadbVmClusterRequest() - assert args[0] == request_msg @@ -41693,7 +41704,6 @@ async def test_delete_exadb_vm_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.DeleteExadbVmClusterRequest() - assert args[0] == request_msg @@ -41720,7 +41730,6 @@ async def test_update_exadb_vm_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.UpdateExadbVmClusterRequest() - assert args[0] == request_msg @@ -41747,7 +41756,6 @@ async def test_remove_virtual_machine_exadb_vm_cluster_empty_call_grpc_asyncio() call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.RemoveVirtualMachineExadbVmClusterRequest() - assert args[0] == request_msg @@ -41776,7 +41784,6 @@ async def test_list_exascale_db_storage_vaults_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = exascale_db_storage_vault.ListExascaleDbStorageVaultsRequest() - assert args[0] == request_msg @@ -41808,7 +41815,6 @@ async def test_get_exascale_db_storage_vault_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = exascale_db_storage_vault.GetExascaleDbStorageVaultRequest() - assert args[0] == request_msg @@ -41837,7 +41843,6 @@ async def test_create_exascale_db_storage_vault_empty_call_grpc_asyncio(): request_msg = ( gco_exascale_db_storage_vault.CreateExascaleDbStorageVaultRequest() ) - assert args[0] == request_msg @@ -41864,7 +41869,6 @@ async def test_delete_exascale_db_storage_vault_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = exascale_db_storage_vault.DeleteExascaleDbStorageVaultRequest() - assert args[0] == request_msg @@ -41895,7 +41899,6 @@ async def test_list_db_system_initial_storage_sizes_empty_call_grpc_asyncio(): request_msg = ( db_system_initial_storage_size.ListDbSystemInitialStorageSizesRequest() ) - assert args[0] == request_msg @@ -41922,7 +41925,6 @@ async def test_list_databases_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = database.ListDatabasesRequest() - assert args[0] == request_msg @@ -41960,7 +41962,6 @@ async def test_get_database_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = database.GetDatabaseRequest() - assert args[0] == request_msg @@ -41989,7 +41990,6 @@ async def test_list_pluggable_databases_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pluggable_database.ListPluggableDatabasesRequest() - assert args[0] == request_msg @@ -42019,7 +42019,6 @@ async def test_get_pluggable_database_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pluggable_database.GetPluggableDatabaseRequest() - assert args[0] == request_msg @@ -42046,7 +42045,6 @@ async def test_list_db_systems_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = db_system.ListDbSystemsRequest() - assert args[0] == request_msg @@ -42079,7 +42077,6 @@ async def test_get_db_system_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = db_system.GetDbSystemRequest() - assert args[0] == request_msg @@ -42104,7 +42101,6 @@ async def test_create_db_system_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gco_db_system.CreateDbSystemRequest() - assert args[0] == request_msg @@ -42129,7 +42125,6 @@ async def test_delete_db_system_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = db_system.DeleteDbSystemRequest() - assert args[0] == request_msg @@ -42156,7 +42151,6 @@ async def test_list_db_versions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = db_version.ListDbVersionsRequest() - assert args[0] == request_msg @@ -42185,7 +42179,6 @@ async def test_list_database_character_sets_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = database_character_set.ListDatabaseCharacterSetsRequest() - assert args[0] == request_msg @@ -51747,7 +51740,6 @@ def test_list_cloud_exadata_infrastructures_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.ListCloudExadataInfrastructuresRequest() - assert args[0] == request_msg @@ -51769,7 +51761,6 @@ def test_get_cloud_exadata_infrastructure_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.GetCloudExadataInfrastructureRequest() - assert args[0] == request_msg @@ -51791,7 +51782,6 @@ def test_create_cloud_exadata_infrastructure_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.CreateCloudExadataInfrastructureRequest() - assert args[0] == request_msg @@ -51813,7 +51803,6 @@ def test_delete_cloud_exadata_infrastructure_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.DeleteCloudExadataInfrastructureRequest() - assert args[0] == request_msg @@ -51835,7 +51824,6 @@ def test_list_cloud_vm_clusters_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.ListCloudVmClustersRequest() - assert args[0] == request_msg @@ -51857,7 +51845,6 @@ def test_get_cloud_vm_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.GetCloudVmClusterRequest() - assert args[0] == request_msg @@ -51879,7 +51866,6 @@ def test_create_cloud_vm_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.CreateCloudVmClusterRequest() - assert args[0] == request_msg @@ -51901,7 +51887,6 @@ def test_delete_cloud_vm_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.DeleteCloudVmClusterRequest() - assert args[0] == request_msg @@ -51923,7 +51908,6 @@ def test_list_entitlements_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.ListEntitlementsRequest() - assert args[0] == request_msg @@ -51943,7 +51927,6 @@ def test_list_db_servers_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.ListDbServersRequest() - assert args[0] == request_msg @@ -51963,7 +51946,6 @@ def test_list_db_nodes_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.ListDbNodesRequest() - assert args[0] == request_msg @@ -51983,7 +51965,6 @@ def test_list_gi_versions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.ListGiVersionsRequest() - assert args[0] == request_msg @@ -52005,7 +51986,6 @@ def test_list_minor_versions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = minor_version.ListMinorVersionsRequest() - assert args[0] == request_msg @@ -52027,7 +52007,6 @@ def test_list_db_system_shapes_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.ListDbSystemShapesRequest() - assert args[0] == request_msg @@ -52049,7 +52028,6 @@ def test_list_autonomous_databases_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.ListAutonomousDatabasesRequest() - assert args[0] == request_msg @@ -52071,7 +52049,6 @@ def test_get_autonomous_database_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.GetAutonomousDatabaseRequest() - assert args[0] == request_msg @@ -52093,7 +52070,6 @@ def test_create_autonomous_database_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.CreateAutonomousDatabaseRequest() - assert args[0] == request_msg @@ -52115,7 +52091,6 @@ def test_update_autonomous_database_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.UpdateAutonomousDatabaseRequest() - assert args[0] == request_msg @@ -52137,7 +52112,6 @@ def test_delete_autonomous_database_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.DeleteAutonomousDatabaseRequest() - assert args[0] == request_msg @@ -52159,7 +52133,6 @@ def test_restore_autonomous_database_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.RestoreAutonomousDatabaseRequest() - assert args[0] == request_msg @@ -52181,7 +52154,6 @@ def test_generate_autonomous_database_wallet_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.GenerateAutonomousDatabaseWalletRequest() - assert args[0] == request_msg @@ -52203,7 +52175,6 @@ def test_list_autonomous_db_versions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.ListAutonomousDbVersionsRequest() - assert args[0] == request_msg @@ -52225,7 +52196,6 @@ def test_list_autonomous_database_character_sets_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.ListAutonomousDatabaseCharacterSetsRequest() - assert args[0] == request_msg @@ -52247,7 +52217,6 @@ def test_list_autonomous_database_backups_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.ListAutonomousDatabaseBackupsRequest() - assert args[0] == request_msg @@ -52269,7 +52238,6 @@ def test_stop_autonomous_database_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.StopAutonomousDatabaseRequest() - assert args[0] == request_msg @@ -52291,7 +52259,6 @@ def test_start_autonomous_database_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.StartAutonomousDatabaseRequest() - assert args[0] == request_msg @@ -52313,7 +52280,6 @@ def test_restart_autonomous_database_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.RestartAutonomousDatabaseRequest() - assert args[0] == request_msg @@ -52335,7 +52301,6 @@ def test_switchover_autonomous_database_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.SwitchoverAutonomousDatabaseRequest() - assert args[0] == request_msg @@ -52357,7 +52322,6 @@ def test_failover_autonomous_database_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.FailoverAutonomousDatabaseRequest() - assert args[0] == request_msg @@ -52379,7 +52343,6 @@ def test_list_odb_networks_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = odb_network.ListOdbNetworksRequest() - assert args[0] == request_msg @@ -52399,7 +52362,6 @@ def test_get_odb_network_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = odb_network.GetOdbNetworkRequest() - assert args[0] == request_msg @@ -52421,7 +52383,6 @@ def test_create_odb_network_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gco_odb_network.CreateOdbNetworkRequest() - assert args[0] == request_msg @@ -52443,7 +52404,6 @@ def test_delete_odb_network_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = odb_network.DeleteOdbNetworkRequest() - assert args[0] == request_msg @@ -52463,7 +52423,6 @@ def test_list_odb_subnets_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = odb_subnet.ListOdbSubnetsRequest() - assert args[0] == request_msg @@ -52483,7 +52442,6 @@ def test_get_odb_subnet_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = odb_subnet.GetOdbSubnetRequest() - assert args[0] == request_msg @@ -52505,7 +52463,6 @@ def test_create_odb_subnet_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gco_odb_subnet.CreateOdbSubnetRequest() - assert args[0] == request_msg @@ -52527,7 +52484,6 @@ def test_delete_odb_subnet_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = odb_subnet.DeleteOdbSubnetRequest() - assert args[0] == request_msg @@ -52549,7 +52505,6 @@ def test_list_exadb_vm_clusters_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.ListExadbVmClustersRequest() - assert args[0] == request_msg @@ -52571,7 +52526,6 @@ def test_get_exadb_vm_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.GetExadbVmClusterRequest() - assert args[0] == request_msg @@ -52593,7 +52547,6 @@ def test_create_exadb_vm_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.CreateExadbVmClusterRequest() - assert args[0] == request_msg @@ -52615,7 +52568,6 @@ def test_delete_exadb_vm_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.DeleteExadbVmClusterRequest() - assert args[0] == request_msg @@ -52637,7 +52589,6 @@ def test_update_exadb_vm_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.UpdateExadbVmClusterRequest() - assert args[0] == request_msg @@ -52659,7 +52610,6 @@ def test_remove_virtual_machine_exadb_vm_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oracledatabase.RemoveVirtualMachineExadbVmClusterRequest() - assert args[0] == request_msg @@ -52681,7 +52631,6 @@ def test_list_exascale_db_storage_vaults_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = exascale_db_storage_vault.ListExascaleDbStorageVaultsRequest() - assert args[0] == request_msg @@ -52703,7 +52652,6 @@ def test_get_exascale_db_storage_vault_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = exascale_db_storage_vault.GetExascaleDbStorageVaultRequest() - assert args[0] == request_msg @@ -52727,7 +52675,6 @@ def test_create_exascale_db_storage_vault_empty_call_rest(): request_msg = ( gco_exascale_db_storage_vault.CreateExascaleDbStorageVaultRequest() ) - assert args[0] == request_msg @@ -52749,7 +52696,6 @@ def test_delete_exascale_db_storage_vault_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = exascale_db_storage_vault.DeleteExascaleDbStorageVaultRequest() - assert args[0] == request_msg @@ -52773,7 +52719,6 @@ def test_list_db_system_initial_storage_sizes_empty_call_rest(): request_msg = ( db_system_initial_storage_size.ListDbSystemInitialStorageSizesRequest() ) - assert args[0] == request_msg @@ -52793,7 +52738,6 @@ def test_list_databases_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = database.ListDatabasesRequest() - assert args[0] == request_msg @@ -52813,7 +52757,6 @@ def test_get_database_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = database.GetDatabaseRequest() - assert args[0] == request_msg @@ -52835,7 +52778,6 @@ def test_list_pluggable_databases_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pluggable_database.ListPluggableDatabasesRequest() - assert args[0] == request_msg @@ -52857,7 +52799,6 @@ def test_get_pluggable_database_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pluggable_database.GetPluggableDatabaseRequest() - assert args[0] == request_msg @@ -52877,7 +52818,6 @@ def test_list_db_systems_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = db_system.ListDbSystemsRequest() - assert args[0] == request_msg @@ -52897,7 +52837,6 @@ def test_get_db_system_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = db_system.GetDbSystemRequest() - assert args[0] == request_msg @@ -52917,7 +52856,6 @@ def test_create_db_system_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gco_db_system.CreateDbSystemRequest() - assert args[0] == request_msg @@ -52937,7 +52875,6 @@ def test_delete_db_system_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = db_system.DeleteDbSystemRequest() - assert args[0] == request_msg @@ -52957,7 +52894,6 @@ def test_list_db_versions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = db_version.ListDbVersionsRequest() - assert args[0] == request_msg @@ -52979,7 +52915,6 @@ def test_list_database_character_sets_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = database_character_set.ListDatabaseCharacterSetsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-orchestration-airflow/noxfile.py b/packages/google-cloud-orchestration-airflow/noxfile.py index 6dd4b2127348..0d1aed8f2c70 100644 --- a/packages/google-cloud-orchestration-airflow/noxfile.py +++ b/packages/google-cloud-orchestration-airflow/noxfile.py @@ -47,7 +47,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-orchestration-airflow" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-orchestration-airflow/setup.py b/packages/google-cloud-orchestration-airflow/setup.py index 0bed24c62919..d695956c7ffe 100644 --- a/packages/google-cloud-orchestration-airflow/setup.py +++ b/packages/google-cloud-orchestration-airflow/setup.py @@ -47,7 +47,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/google-cloud-orchestration-airflow/testing/constraints-3.10.txt b/packages/google-cloud-orchestration-airflow/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-orchestration-airflow/testing/constraints-3.10.txt +++ b/packages/google-cloud-orchestration-airflow/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-orchestration-airflow/tests/unit/gapic/service_v1/test_environments.py b/packages/google-cloud-orchestration-airflow/tests/unit/gapic/service_v1/test_environments.py index 8c09f93b4ee4..4167b75f5709 100644 --- a/packages/google-cloud-orchestration-airflow/tests/unit/gapic/service_v1/test_environments.py +++ b/packages/google-cloud-orchestration-airflow/tests/unit/gapic/service_v1/test_environments.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 @@ -115,6 +116,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" @@ -1295,8 +1311,8 @@ def test_environments_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - environments.CreateEnvironmentRequest, - dict, + environments.CreateEnvironmentRequest(), + {}, ], ) def test_create_environment(request_type, transport: str = "grpc"): @@ -1307,7 +1323,7 @@ def test_create_environment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,9 +1368,10 @@ def test_create_environment_non_empty_request_with_auto_populated_field(): client.create_environment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environments.CreateEnvironmentRequest( + request_msg = environments.CreateEnvironmentRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_environment_use_cached_wrapped_rpc(): @@ -1449,9 +1466,14 @@ async def test_create_environment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_environment_async( - transport: str = "grpc_asyncio", request_type=environments.CreateEnvironmentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + environments.CreateEnvironmentRequest(), + {}, + ], +) +async def test_create_environment_async(request_type, transport: str = "grpc_asyncio"): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1459,7 +1481,7 @@ async def test_create_environment_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( @@ -1481,11 +1503,6 @@ async def test_create_environment_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_environment_async_from_dict(): - await test_create_environment_async(request_type=dict) - - def test_create_environment_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1650,8 +1667,8 @@ async def test_create_environment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - environments.GetEnvironmentRequest, - dict, + environments.GetEnvironmentRequest(), + {}, ], ) def test_get_environment(request_type, transport: str = "grpc"): @@ -1662,7 +1679,7 @@ def test_get_environment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_environment), "__call__") as call: @@ -1714,9 +1731,10 @@ def test_get_environment_non_empty_request_with_auto_populated_field(): client.get_environment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environments.GetEnvironmentRequest( + request_msg = environments.GetEnvironmentRequest( name="name_value", ) + assert args[0] == request_msg def test_get_environment_use_cached_wrapped_rpc(): @@ -1797,9 +1815,14 @@ async def test_get_environment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_environment_async( - transport: str = "grpc_asyncio", request_type=environments.GetEnvironmentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + environments.GetEnvironmentRequest(), + {}, + ], +) +async def test_get_environment_async(request_type, transport: str = "grpc_asyncio"): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1807,7 +1830,7 @@ async def test_get_environment_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_environment), "__call__") as call: @@ -1838,11 +1861,6 @@ async def test_get_environment_async( assert response.satisfies_pzi is True -@pytest.mark.asyncio -async def test_get_environment_async_from_dict(): - await test_get_environment_async(request_type=dict) - - def test_get_environment_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1989,8 +2007,8 @@ async def test_get_environment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - environments.ListEnvironmentsRequest, - dict, + environments.ListEnvironmentsRequest(), + {}, ], ) def test_list_environments(request_type, transport: str = "grpc"): @@ -2001,7 +2019,7 @@ def test_list_environments(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2050,10 +2068,11 @@ def test_list_environments_non_empty_request_with_auto_populated_field(): client.list_environments(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environments.ListEnvironmentsRequest( + request_msg = environments.ListEnvironmentsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_environments_use_cached_wrapped_rpc(): @@ -2136,9 +2155,14 @@ async def test_list_environments_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_environments_async( - transport: str = "grpc_asyncio", request_type=environments.ListEnvironmentsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + environments.ListEnvironmentsRequest(), + {}, + ], +) +async def test_list_environments_async(request_type, transport: str = "grpc_asyncio"): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2146,7 +2170,7 @@ async def test_list_environments_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( @@ -2171,11 +2195,6 @@ async def test_list_environments_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_environments_async_from_dict(): - await test_list_environments_async(request_type=dict) - - def test_list_environments_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2528,8 +2547,8 @@ async def test_list_environments_async_pages(): @pytest.mark.parametrize( "request_type", [ - environments.UpdateEnvironmentRequest, - dict, + environments.UpdateEnvironmentRequest(), + {}, ], ) def test_update_environment(request_type, transport: str = "grpc"): @@ -2540,7 +2559,7 @@ def test_update_environment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2585,9 +2604,10 @@ def test_update_environment_non_empty_request_with_auto_populated_field(): client.update_environment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environments.UpdateEnvironmentRequest( + request_msg = environments.UpdateEnvironmentRequest( name="name_value", ) + assert args[0] == request_msg def test_update_environment_use_cached_wrapped_rpc(): @@ -2682,9 +2702,14 @@ async def test_update_environment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_environment_async( - transport: str = "grpc_asyncio", request_type=environments.UpdateEnvironmentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + environments.UpdateEnvironmentRequest(), + {}, + ], +) +async def test_update_environment_async(request_type, transport: str = "grpc_asyncio"): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2692,7 +2717,7 @@ async def test_update_environment_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( @@ -2714,11 +2739,6 @@ async def test_update_environment_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_environment_async_from_dict(): - await test_update_environment_async(request_type=dict) - - def test_update_environment_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2893,8 +2913,8 @@ async def test_update_environment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - environments.DeleteEnvironmentRequest, - dict, + environments.DeleteEnvironmentRequest(), + {}, ], ) def test_delete_environment(request_type, transport: str = "grpc"): @@ -2905,7 +2925,7 @@ def test_delete_environment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2950,9 +2970,10 @@ def test_delete_environment_non_empty_request_with_auto_populated_field(): client.delete_environment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environments.DeleteEnvironmentRequest( + request_msg = environments.DeleteEnvironmentRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_environment_use_cached_wrapped_rpc(): @@ -3047,9 +3068,14 @@ async def test_delete_environment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_environment_async( - transport: str = "grpc_asyncio", request_type=environments.DeleteEnvironmentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + environments.DeleteEnvironmentRequest(), + {}, + ], +) +async def test_delete_environment_async(request_type, transport: str = "grpc_asyncio"): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3057,7 +3083,7 @@ async def test_delete_environment_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( @@ -3079,11 +3105,6 @@ async def test_delete_environment_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_environment_async_from_dict(): - await test_delete_environment_async(request_type=dict) - - def test_delete_environment_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3238,8 +3259,8 @@ async def test_delete_environment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - environments.ExecuteAirflowCommandRequest, - dict, + environments.ExecuteAirflowCommandRequest(), + {}, ], ) def test_execute_airflow_command(request_type, transport: str = "grpc"): @@ -3250,7 +3271,7 @@ def test_execute_airflow_command(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3306,11 +3327,12 @@ def test_execute_airflow_command_non_empty_request_with_auto_populated_field(): client.execute_airflow_command(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environments.ExecuteAirflowCommandRequest( + request_msg = environments.ExecuteAirflowCommandRequest( environment="environment_value", command="command_value", subcommand="subcommand_value", ) + assert args[0] == request_msg def test_execute_airflow_command_use_cached_wrapped_rpc(): @@ -3396,9 +3418,15 @@ async def test_execute_airflow_command_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + environments.ExecuteAirflowCommandRequest(), + {}, + ], +) async def test_execute_airflow_command_async( - transport: str = "grpc_asyncio", - request_type=environments.ExecuteAirflowCommandRequest, + request_type, transport: str = "grpc_asyncio" ): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), @@ -3407,7 +3435,7 @@ async def test_execute_airflow_command_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( @@ -3438,11 +3466,6 @@ async def test_execute_airflow_command_async( assert response.error == "error_value" -@pytest.mark.asyncio -async def test_execute_airflow_command_async_from_dict(): - await test_execute_airflow_command_async(request_type=dict) - - def test_execute_airflow_command_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3511,8 +3534,8 @@ async def test_execute_airflow_command_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - environments.StopAirflowCommandRequest, - dict, + environments.StopAirflowCommandRequest(), + {}, ], ) def test_stop_airflow_command(request_type, transport: str = "grpc"): @@ -3523,7 +3546,7 @@ def test_stop_airflow_command(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3576,12 +3599,13 @@ def test_stop_airflow_command_non_empty_request_with_auto_populated_field(): client.stop_airflow_command(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environments.StopAirflowCommandRequest( + request_msg = environments.StopAirflowCommandRequest( environment="environment_value", execution_id="execution_id_value", pod="pod_value", pod_namespace="pod_namespace_value", ) + assert args[0] == request_msg def test_stop_airflow_command_use_cached_wrapped_rpc(): @@ -3666,8 +3690,15 @@ async def test_stop_airflow_command_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + environments.StopAirflowCommandRequest(), + {}, + ], +) async def test_stop_airflow_command_async( - transport: str = "grpc_asyncio", request_type=environments.StopAirflowCommandRequest + request_type, transport: str = "grpc_asyncio" ): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), @@ -3676,7 +3707,7 @@ async def test_stop_airflow_command_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( @@ -3703,11 +3734,6 @@ async def test_stop_airflow_command_async( assert response.output == ["output_value"] -@pytest.mark.asyncio -async def test_stop_airflow_command_async_from_dict(): - await test_stop_airflow_command_async(request_type=dict) - - def test_stop_airflow_command_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3776,8 +3802,8 @@ async def test_stop_airflow_command_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - environments.PollAirflowCommandRequest, - dict, + environments.PollAirflowCommandRequest(), + {}, ], ) def test_poll_airflow_command(request_type, transport: str = "grpc"): @@ -3788,7 +3814,7 @@ def test_poll_airflow_command(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3839,12 +3865,13 @@ def test_poll_airflow_command_non_empty_request_with_auto_populated_field(): client.poll_airflow_command(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environments.PollAirflowCommandRequest( + request_msg = environments.PollAirflowCommandRequest( environment="environment_value", execution_id="execution_id_value", pod="pod_value", pod_namespace="pod_namespace_value", ) + assert args[0] == request_msg def test_poll_airflow_command_use_cached_wrapped_rpc(): @@ -3929,8 +3956,15 @@ async def test_poll_airflow_command_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + environments.PollAirflowCommandRequest(), + {}, + ], +) async def test_poll_airflow_command_async( - transport: str = "grpc_asyncio", request_type=environments.PollAirflowCommandRequest + request_type, transport: str = "grpc_asyncio" ): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), @@ -3939,7 +3973,7 @@ async def test_poll_airflow_command_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( @@ -3964,11 +3998,6 @@ async def test_poll_airflow_command_async( assert response.output_end is True -@pytest.mark.asyncio -async def test_poll_airflow_command_async_from_dict(): - await test_poll_airflow_command_async(request_type=dict) - - def test_poll_airflow_command_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4037,8 +4066,8 @@ async def test_poll_airflow_command_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - environments.ListWorkloadsRequest, - dict, + environments.ListWorkloadsRequest(), + {}, ], ) def test_list_workloads(request_type, transport: str = "grpc"): @@ -4049,7 +4078,7 @@ def test_list_workloads(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_workloads), "__call__") as call: @@ -4095,11 +4124,12 @@ def test_list_workloads_non_empty_request_with_auto_populated_field(): client.list_workloads(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environments.ListWorkloadsRequest( + request_msg = environments.ListWorkloadsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_workloads_use_cached_wrapped_rpc(): @@ -4180,9 +4210,14 @@ async def test_list_workloads_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_workloads_async( - transport: str = "grpc_asyncio", request_type=environments.ListWorkloadsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + environments.ListWorkloadsRequest(), + {}, + ], +) +async def test_list_workloads_async(request_type, transport: str = "grpc_asyncio"): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4190,7 +4225,7 @@ async def test_list_workloads_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_workloads), "__call__") as call: @@ -4213,11 +4248,6 @@ async def test_list_workloads_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_workloads_async_from_dict(): - await test_list_workloads_async(request_type=dict) - - def test_list_workloads_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4560,8 +4590,8 @@ async def test_list_workloads_async_pages(): @pytest.mark.parametrize( "request_type", [ - environments.CheckUpgradeRequest, - dict, + environments.CheckUpgradeRequest(), + {}, ], ) def test_check_upgrade(request_type, transport: str = "grpc"): @@ -4572,7 +4602,7 @@ def test_check_upgrade(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.check_upgrade), "__call__") as call: @@ -4614,10 +4644,11 @@ def test_check_upgrade_non_empty_request_with_auto_populated_field(): client.check_upgrade(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environments.CheckUpgradeRequest( + request_msg = environments.CheckUpgradeRequest( environment="environment_value", image_version="image_version_value", ) + assert args[0] == request_msg def test_check_upgrade_use_cached_wrapped_rpc(): @@ -4708,9 +4739,14 @@ async def test_check_upgrade_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_check_upgrade_async( - transport: str = "grpc_asyncio", request_type=environments.CheckUpgradeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + environments.CheckUpgradeRequest(), + {}, + ], +) +async def test_check_upgrade_async(request_type, transport: str = "grpc_asyncio"): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4718,7 +4754,7 @@ async def test_check_upgrade_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.check_upgrade), "__call__") as call: @@ -4738,11 +4774,6 @@ async def test_check_upgrade_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_check_upgrade_async_from_dict(): - await test_check_upgrade_async(request_type=dict) - - def test_check_upgrade_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4807,8 +4838,8 @@ async def test_check_upgrade_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - environments.CreateUserWorkloadsSecretRequest, - dict, + environments.CreateUserWorkloadsSecretRequest(), + {}, ], ) def test_create_user_workloads_secret(request_type, transport: str = "grpc"): @@ -4819,7 +4850,7 @@ def test_create_user_workloads_secret(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4867,9 +4898,10 @@ def test_create_user_workloads_secret_non_empty_request_with_auto_populated_fiel client.create_user_workloads_secret(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environments.CreateUserWorkloadsSecretRequest( + request_msg = environments.CreateUserWorkloadsSecretRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_user_workloads_secret_use_cached_wrapped_rpc(): @@ -4955,9 +4987,15 @@ async def test_create_user_workloads_secret_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + environments.CreateUserWorkloadsSecretRequest(), + {}, + ], +) async def test_create_user_workloads_secret_async( - transport: str = "grpc_asyncio", - request_type=environments.CreateUserWorkloadsSecretRequest, + request_type, transport: str = "grpc_asyncio" ): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), @@ -4966,7 +5004,7 @@ async def test_create_user_workloads_secret_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( @@ -4991,11 +5029,6 @@ async def test_create_user_workloads_secret_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_create_user_workloads_secret_async_from_dict(): - await test_create_user_workloads_secret_async(request_type=dict) - - def test_create_user_workloads_secret_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5160,8 +5193,8 @@ async def test_create_user_workloads_secret_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - environments.GetUserWorkloadsSecretRequest, - dict, + environments.GetUserWorkloadsSecretRequest(), + {}, ], ) def test_get_user_workloads_secret(request_type, transport: str = "grpc"): @@ -5172,7 +5205,7 @@ def test_get_user_workloads_secret(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5220,9 +5253,10 @@ def test_get_user_workloads_secret_non_empty_request_with_auto_populated_field() client.get_user_workloads_secret(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environments.GetUserWorkloadsSecretRequest( + request_msg = environments.GetUserWorkloadsSecretRequest( name="name_value", ) + assert args[0] == request_msg def test_get_user_workloads_secret_use_cached_wrapped_rpc(): @@ -5308,9 +5342,15 @@ async def test_get_user_workloads_secret_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + environments.GetUserWorkloadsSecretRequest(), + {}, + ], +) async def test_get_user_workloads_secret_async( - transport: str = "grpc_asyncio", - request_type=environments.GetUserWorkloadsSecretRequest, + request_type, transport: str = "grpc_asyncio" ): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), @@ -5319,7 +5359,7 @@ async def test_get_user_workloads_secret_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( @@ -5344,11 +5384,6 @@ async def test_get_user_workloads_secret_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_user_workloads_secret_async_from_dict(): - await test_get_user_workloads_secret_async(request_type=dict) - - def test_get_user_workloads_secret_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5503,8 +5538,8 @@ async def test_get_user_workloads_secret_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - environments.ListUserWorkloadsSecretsRequest, - dict, + environments.ListUserWorkloadsSecretsRequest(), + {}, ], ) def test_list_user_workloads_secrets(request_type, transport: str = "grpc"): @@ -5515,7 +5550,7 @@ def test_list_user_workloads_secrets(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5564,10 +5599,11 @@ def test_list_user_workloads_secrets_non_empty_request_with_auto_populated_field client.list_user_workloads_secrets(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environments.ListUserWorkloadsSecretsRequest( + request_msg = environments.ListUserWorkloadsSecretsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_user_workloads_secrets_use_cached_wrapped_rpc(): @@ -5653,9 +5689,15 @@ async def test_list_user_workloads_secrets_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + environments.ListUserWorkloadsSecretsRequest(), + {}, + ], +) async def test_list_user_workloads_secrets_async( - transport: str = "grpc_asyncio", - request_type=environments.ListUserWorkloadsSecretsRequest, + request_type, transport: str = "grpc_asyncio" ): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), @@ -5664,7 +5706,7 @@ async def test_list_user_workloads_secrets_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( @@ -5689,11 +5731,6 @@ async def test_list_user_workloads_secrets_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_user_workloads_secrets_async_from_dict(): - await test_list_user_workloads_secrets_async(request_type=dict) - - def test_list_user_workloads_secrets_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6048,8 +6085,8 @@ async def test_list_user_workloads_secrets_async_pages(): @pytest.mark.parametrize( "request_type", [ - environments.UpdateUserWorkloadsSecretRequest, - dict, + environments.UpdateUserWorkloadsSecretRequest(), + {}, ], ) def test_update_user_workloads_secret(request_type, transport: str = "grpc"): @@ -6060,7 +6097,7 @@ def test_update_user_workloads_secret(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6106,7 +6143,8 @@ def test_update_user_workloads_secret_non_empty_request_with_auto_populated_fiel client.update_user_workloads_secret(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environments.UpdateUserWorkloadsSecretRequest() + request_msg = environments.UpdateUserWorkloadsSecretRequest() + assert args[0] == request_msg def test_update_user_workloads_secret_use_cached_wrapped_rpc(): @@ -6192,9 +6230,15 @@ async def test_update_user_workloads_secret_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + environments.UpdateUserWorkloadsSecretRequest(), + {}, + ], +) async def test_update_user_workloads_secret_async( - transport: str = "grpc_asyncio", - request_type=environments.UpdateUserWorkloadsSecretRequest, + request_type, transport: str = "grpc_asyncio" ): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), @@ -6203,7 +6247,7 @@ async def test_update_user_workloads_secret_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( @@ -6228,11 +6272,6 @@ async def test_update_user_workloads_secret_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_update_user_workloads_secret_async_from_dict(): - await test_update_user_workloads_secret_async(request_type=dict) - - def test_update_user_workloads_secret_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6387,8 +6426,8 @@ async def test_update_user_workloads_secret_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - environments.DeleteUserWorkloadsSecretRequest, - dict, + environments.DeleteUserWorkloadsSecretRequest(), + {}, ], ) def test_delete_user_workloads_secret(request_type, transport: str = "grpc"): @@ -6399,7 +6438,7 @@ def test_delete_user_workloads_secret(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6444,9 +6483,10 @@ def test_delete_user_workloads_secret_non_empty_request_with_auto_populated_fiel client.delete_user_workloads_secret(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environments.DeleteUserWorkloadsSecretRequest( + request_msg = environments.DeleteUserWorkloadsSecretRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_user_workloads_secret_use_cached_wrapped_rpc(): @@ -6532,9 +6572,15 @@ async def test_delete_user_workloads_secret_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + environments.DeleteUserWorkloadsSecretRequest(), + {}, + ], +) async def test_delete_user_workloads_secret_async( - transport: str = "grpc_asyncio", - request_type=environments.DeleteUserWorkloadsSecretRequest, + request_type, transport: str = "grpc_asyncio" ): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), @@ -6543,7 +6589,7 @@ async def test_delete_user_workloads_secret_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( @@ -6563,11 +6609,6 @@ async def test_delete_user_workloads_secret_async( assert response is None -@pytest.mark.asyncio -async def test_delete_user_workloads_secret_async_from_dict(): - await test_delete_user_workloads_secret_async(request_type=dict) - - def test_delete_user_workloads_secret_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6718,8 +6759,8 @@ async def test_delete_user_workloads_secret_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - environments.CreateUserWorkloadsConfigMapRequest, - dict, + environments.CreateUserWorkloadsConfigMapRequest(), + {}, ], ) def test_create_user_workloads_config_map(request_type, transport: str = "grpc"): @@ -6730,7 +6771,7 @@ def test_create_user_workloads_config_map(request_type, transport: str = "grpc") # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6778,9 +6819,10 @@ def test_create_user_workloads_config_map_non_empty_request_with_auto_populated_ client.create_user_workloads_config_map(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environments.CreateUserWorkloadsConfigMapRequest( + request_msg = environments.CreateUserWorkloadsConfigMapRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_user_workloads_config_map_use_cached_wrapped_rpc(): @@ -6866,9 +6908,15 @@ async def test_create_user_workloads_config_map_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + environments.CreateUserWorkloadsConfigMapRequest(), + {}, + ], +) async def test_create_user_workloads_config_map_async( - transport: str = "grpc_asyncio", - request_type=environments.CreateUserWorkloadsConfigMapRequest, + request_type, transport: str = "grpc_asyncio" ): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), @@ -6877,7 +6925,7 @@ async def test_create_user_workloads_config_map_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( @@ -6902,11 +6950,6 @@ async def test_create_user_workloads_config_map_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_create_user_workloads_config_map_async_from_dict(): - await test_create_user_workloads_config_map_async(request_type=dict) - - def test_create_user_workloads_config_map_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7079,8 +7122,8 @@ async def test_create_user_workloads_config_map_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - environments.GetUserWorkloadsConfigMapRequest, - dict, + environments.GetUserWorkloadsConfigMapRequest(), + {}, ], ) def test_get_user_workloads_config_map(request_type, transport: str = "grpc"): @@ -7091,7 +7134,7 @@ def test_get_user_workloads_config_map(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7139,9 +7182,10 @@ def test_get_user_workloads_config_map_non_empty_request_with_auto_populated_fie client.get_user_workloads_config_map(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environments.GetUserWorkloadsConfigMapRequest( + request_msg = environments.GetUserWorkloadsConfigMapRequest( name="name_value", ) + assert args[0] == request_msg def test_get_user_workloads_config_map_use_cached_wrapped_rpc(): @@ -7227,9 +7271,15 @@ async def test_get_user_workloads_config_map_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + environments.GetUserWorkloadsConfigMapRequest(), + {}, + ], +) async def test_get_user_workloads_config_map_async( - transport: str = "grpc_asyncio", - request_type=environments.GetUserWorkloadsConfigMapRequest, + request_type, transport: str = "grpc_asyncio" ): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), @@ -7238,7 +7288,7 @@ async def test_get_user_workloads_config_map_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( @@ -7263,11 +7313,6 @@ async def test_get_user_workloads_config_map_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_user_workloads_config_map_async_from_dict(): - await test_get_user_workloads_config_map_async(request_type=dict) - - def test_get_user_workloads_config_map_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7422,8 +7467,8 @@ async def test_get_user_workloads_config_map_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - environments.ListUserWorkloadsConfigMapsRequest, - dict, + environments.ListUserWorkloadsConfigMapsRequest(), + {}, ], ) def test_list_user_workloads_config_maps(request_type, transport: str = "grpc"): @@ -7434,7 +7479,7 @@ def test_list_user_workloads_config_maps(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7483,10 +7528,11 @@ def test_list_user_workloads_config_maps_non_empty_request_with_auto_populated_f client.list_user_workloads_config_maps(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environments.ListUserWorkloadsConfigMapsRequest( + request_msg = environments.ListUserWorkloadsConfigMapsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_user_workloads_config_maps_use_cached_wrapped_rpc(): @@ -7572,9 +7618,15 @@ async def test_list_user_workloads_config_maps_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + environments.ListUserWorkloadsConfigMapsRequest(), + {}, + ], +) async def test_list_user_workloads_config_maps_async( - transport: str = "grpc_asyncio", - request_type=environments.ListUserWorkloadsConfigMapsRequest, + request_type, transport: str = "grpc_asyncio" ): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), @@ -7583,7 +7635,7 @@ async def test_list_user_workloads_config_maps_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( @@ -7608,11 +7660,6 @@ async def test_list_user_workloads_config_maps_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_user_workloads_config_maps_async_from_dict(): - await test_list_user_workloads_config_maps_async(request_type=dict) - - def test_list_user_workloads_config_maps_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7971,8 +8018,8 @@ async def test_list_user_workloads_config_maps_async_pages(): @pytest.mark.parametrize( "request_type", [ - environments.UpdateUserWorkloadsConfigMapRequest, - dict, + environments.UpdateUserWorkloadsConfigMapRequest(), + {}, ], ) def test_update_user_workloads_config_map(request_type, transport: str = "grpc"): @@ -7983,7 +8030,7 @@ def test_update_user_workloads_config_map(request_type, transport: str = "grpc") # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8029,7 +8076,8 @@ def test_update_user_workloads_config_map_non_empty_request_with_auto_populated_ client.update_user_workloads_config_map(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environments.UpdateUserWorkloadsConfigMapRequest() + request_msg = environments.UpdateUserWorkloadsConfigMapRequest() + assert args[0] == request_msg def test_update_user_workloads_config_map_use_cached_wrapped_rpc(): @@ -8115,9 +8163,15 @@ async def test_update_user_workloads_config_map_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + environments.UpdateUserWorkloadsConfigMapRequest(), + {}, + ], +) async def test_update_user_workloads_config_map_async( - transport: str = "grpc_asyncio", - request_type=environments.UpdateUserWorkloadsConfigMapRequest, + request_type, transport: str = "grpc_asyncio" ): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), @@ -8126,7 +8180,7 @@ async def test_update_user_workloads_config_map_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( @@ -8151,11 +8205,6 @@ async def test_update_user_workloads_config_map_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_update_user_workloads_config_map_async_from_dict(): - await test_update_user_workloads_config_map_async(request_type=dict) - - def test_update_user_workloads_config_map_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8318,8 +8367,8 @@ async def test_update_user_workloads_config_map_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - environments.DeleteUserWorkloadsConfigMapRequest, - dict, + environments.DeleteUserWorkloadsConfigMapRequest(), + {}, ], ) def test_delete_user_workloads_config_map(request_type, transport: str = "grpc"): @@ -8330,7 +8379,7 @@ def test_delete_user_workloads_config_map(request_type, transport: str = "grpc") # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8375,9 +8424,10 @@ def test_delete_user_workloads_config_map_non_empty_request_with_auto_populated_ client.delete_user_workloads_config_map(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environments.DeleteUserWorkloadsConfigMapRequest( + request_msg = environments.DeleteUserWorkloadsConfigMapRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_user_workloads_config_map_use_cached_wrapped_rpc(): @@ -8463,9 +8513,15 @@ async def test_delete_user_workloads_config_map_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + environments.DeleteUserWorkloadsConfigMapRequest(), + {}, + ], +) async def test_delete_user_workloads_config_map_async( - transport: str = "grpc_asyncio", - request_type=environments.DeleteUserWorkloadsConfigMapRequest, + request_type, transport: str = "grpc_asyncio" ): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), @@ -8474,7 +8530,7 @@ async def test_delete_user_workloads_config_map_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( @@ -8494,11 +8550,6 @@ async def test_delete_user_workloads_config_map_async( assert response is None -@pytest.mark.asyncio -async def test_delete_user_workloads_config_map_async_from_dict(): - await test_delete_user_workloads_config_map_async(request_type=dict) - - def test_delete_user_workloads_config_map_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8649,8 +8700,8 @@ async def test_delete_user_workloads_config_map_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - environments.SaveSnapshotRequest, - dict, + environments.SaveSnapshotRequest(), + {}, ], ) def test_save_snapshot(request_type, transport: str = "grpc"): @@ -8661,7 +8712,7 @@ def test_save_snapshot(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.save_snapshot), "__call__") as call: @@ -8703,10 +8754,11 @@ def test_save_snapshot_non_empty_request_with_auto_populated_field(): client.save_snapshot(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environments.SaveSnapshotRequest( + request_msg = environments.SaveSnapshotRequest( environment="environment_value", snapshot_location="snapshot_location_value", ) + assert args[0] == request_msg def test_save_snapshot_use_cached_wrapped_rpc(): @@ -8797,9 +8849,14 @@ async def test_save_snapshot_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_save_snapshot_async( - transport: str = "grpc_asyncio", request_type=environments.SaveSnapshotRequest -): +@pytest.mark.parametrize( + "request_type", + [ + environments.SaveSnapshotRequest(), + {}, + ], +) +async def test_save_snapshot_async(request_type, transport: str = "grpc_asyncio"): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8807,7 +8864,7 @@ async def test_save_snapshot_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.save_snapshot), "__call__") as call: @@ -8827,11 +8884,6 @@ async def test_save_snapshot_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_save_snapshot_async_from_dict(): - await test_save_snapshot_async(request_type=dict) - - def test_save_snapshot_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8896,8 +8948,8 @@ async def test_save_snapshot_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - environments.LoadSnapshotRequest, - dict, + environments.LoadSnapshotRequest(), + {}, ], ) def test_load_snapshot(request_type, transport: str = "grpc"): @@ -8908,7 +8960,7 @@ def test_load_snapshot(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.load_snapshot), "__call__") as call: @@ -8950,10 +9002,11 @@ def test_load_snapshot_non_empty_request_with_auto_populated_field(): client.load_snapshot(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environments.LoadSnapshotRequest( + request_msg = environments.LoadSnapshotRequest( environment="environment_value", snapshot_path="snapshot_path_value", ) + assert args[0] == request_msg def test_load_snapshot_use_cached_wrapped_rpc(): @@ -9044,9 +9097,14 @@ async def test_load_snapshot_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_load_snapshot_async( - transport: str = "grpc_asyncio", request_type=environments.LoadSnapshotRequest -): +@pytest.mark.parametrize( + "request_type", + [ + environments.LoadSnapshotRequest(), + {}, + ], +) +async def test_load_snapshot_async(request_type, transport: str = "grpc_asyncio"): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9054,7 +9112,7 @@ async def test_load_snapshot_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.load_snapshot), "__call__") as call: @@ -9074,11 +9132,6 @@ async def test_load_snapshot_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_load_snapshot_async_from_dict(): - await test_load_snapshot_async(request_type=dict) - - def test_load_snapshot_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9143,8 +9196,8 @@ async def test_load_snapshot_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - environments.DatabaseFailoverRequest, - dict, + environments.DatabaseFailoverRequest(), + {}, ], ) def test_database_failover(request_type, transport: str = "grpc"): @@ -9155,7 +9208,7 @@ def test_database_failover(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9200,9 +9253,10 @@ def test_database_failover_non_empty_request_with_auto_populated_field(): client.database_failover(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environments.DatabaseFailoverRequest( + request_msg = environments.DatabaseFailoverRequest( environment="environment_value", ) + assert args[0] == request_msg def test_database_failover_use_cached_wrapped_rpc(): @@ -9295,9 +9349,14 @@ async def test_database_failover_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_database_failover_async( - transport: str = "grpc_asyncio", request_type=environments.DatabaseFailoverRequest -): +@pytest.mark.parametrize( + "request_type", + [ + environments.DatabaseFailoverRequest(), + {}, + ], +) +async def test_database_failover_async(request_type, transport: str = "grpc_asyncio"): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9305,7 +9364,7 @@ async def test_database_failover_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( @@ -9327,11 +9386,6 @@ async def test_database_failover_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_database_failover_async_from_dict(): - await test_database_failover_async(request_type=dict) - - def test_database_failover_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9400,8 +9454,8 @@ async def test_database_failover_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - environments.FetchDatabasePropertiesRequest, - dict, + environments.FetchDatabasePropertiesRequest(), + {}, ], ) def test_fetch_database_properties(request_type, transport: str = "grpc"): @@ -9412,7 +9466,7 @@ def test_fetch_database_properties(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9464,9 +9518,10 @@ def test_fetch_database_properties_non_empty_request_with_auto_populated_field() client.fetch_database_properties(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environments.FetchDatabasePropertiesRequest( + request_msg = environments.FetchDatabasePropertiesRequest( environment="environment_value", ) + assert args[0] == request_msg def test_fetch_database_properties_use_cached_wrapped_rpc(): @@ -9552,9 +9607,15 @@ async def test_fetch_database_properties_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + environments.FetchDatabasePropertiesRequest(), + {}, + ], +) async def test_fetch_database_properties_async( - transport: str = "grpc_asyncio", - request_type=environments.FetchDatabasePropertiesRequest, + request_type, transport: str = "grpc_asyncio" ): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), @@ -9563,7 +9624,7 @@ async def test_fetch_database_properties_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( @@ -9592,11 +9653,6 @@ async def test_fetch_database_properties_async( assert response.is_failover_replica_available is True -@pytest.mark.asyncio -async def test_fetch_database_properties_async_from_dict(): - await test_fetch_database_properties_async(request_type=dict) - - def test_fetch_database_properties_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12988,7 +13044,6 @@ def test_create_environment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.CreateEnvironmentRequest() - assert args[0] == request_msg @@ -13009,7 +13064,6 @@ def test_get_environment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.GetEnvironmentRequest() - assert args[0] == request_msg @@ -13032,7 +13086,6 @@ def test_list_environments_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.ListEnvironmentsRequest() - assert args[0] == request_msg @@ -13055,7 +13108,6 @@ def test_update_environment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.UpdateEnvironmentRequest() - assert args[0] == request_msg @@ -13078,7 +13130,6 @@ def test_delete_environment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.DeleteEnvironmentRequest() - assert args[0] == request_msg @@ -13101,7 +13152,6 @@ def test_execute_airflow_command_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.ExecuteAirflowCommandRequest() - assert args[0] == request_msg @@ -13124,7 +13174,6 @@ def test_stop_airflow_command_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.StopAirflowCommandRequest() - assert args[0] == request_msg @@ -13147,7 +13196,6 @@ def test_poll_airflow_command_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.PollAirflowCommandRequest() - assert args[0] == request_msg @@ -13168,7 +13216,6 @@ def test_list_workloads_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.ListWorkloadsRequest() - assert args[0] == request_msg @@ -13189,7 +13236,6 @@ def test_check_upgrade_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.CheckUpgradeRequest() - assert args[0] == request_msg @@ -13212,7 +13258,6 @@ def test_create_user_workloads_secret_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.CreateUserWorkloadsSecretRequest() - assert args[0] == request_msg @@ -13235,7 +13280,6 @@ def test_get_user_workloads_secret_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.GetUserWorkloadsSecretRequest() - assert args[0] == request_msg @@ -13258,7 +13302,6 @@ def test_list_user_workloads_secrets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.ListUserWorkloadsSecretsRequest() - assert args[0] == request_msg @@ -13281,7 +13324,6 @@ def test_update_user_workloads_secret_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.UpdateUserWorkloadsSecretRequest() - assert args[0] == request_msg @@ -13304,7 +13346,6 @@ def test_delete_user_workloads_secret_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.DeleteUserWorkloadsSecretRequest() - assert args[0] == request_msg @@ -13327,7 +13368,6 @@ def test_create_user_workloads_config_map_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.CreateUserWorkloadsConfigMapRequest() - assert args[0] == request_msg @@ -13350,7 +13390,6 @@ def test_get_user_workloads_config_map_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.GetUserWorkloadsConfigMapRequest() - assert args[0] == request_msg @@ -13373,7 +13412,6 @@ def test_list_user_workloads_config_maps_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.ListUserWorkloadsConfigMapsRequest() - assert args[0] == request_msg @@ -13396,7 +13434,6 @@ def test_update_user_workloads_config_map_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.UpdateUserWorkloadsConfigMapRequest() - assert args[0] == request_msg @@ -13419,7 +13456,6 @@ def test_delete_user_workloads_config_map_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.DeleteUserWorkloadsConfigMapRequest() - assert args[0] == request_msg @@ -13440,7 +13476,6 @@ def test_save_snapshot_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.SaveSnapshotRequest() - assert args[0] == request_msg @@ -13461,7 +13496,6 @@ def test_load_snapshot_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.LoadSnapshotRequest() - assert args[0] == request_msg @@ -13484,7 +13518,6 @@ def test_database_failover_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.DatabaseFailoverRequest() - assert args[0] == request_msg @@ -13507,7 +13540,6 @@ def test_fetch_database_properties_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.FetchDatabasePropertiesRequest() - assert args[0] == request_msg @@ -13548,7 +13580,6 @@ async def test_create_environment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.CreateEnvironmentRequest() - assert args[0] == request_msg @@ -13579,7 +13610,6 @@ async def test_get_environment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.GetEnvironmentRequest() - assert args[0] == request_msg @@ -13608,7 +13638,6 @@ async def test_list_environments_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.ListEnvironmentsRequest() - assert args[0] == request_msg @@ -13635,7 +13664,6 @@ async def test_update_environment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.UpdateEnvironmentRequest() - assert args[0] == request_msg @@ -13662,7 +13690,6 @@ async def test_delete_environment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.DeleteEnvironmentRequest() - assert args[0] == request_msg @@ -13694,7 +13721,6 @@ async def test_execute_airflow_command_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.ExecuteAirflowCommandRequest() - assert args[0] == request_msg @@ -13724,7 +13750,6 @@ async def test_stop_airflow_command_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.StopAirflowCommandRequest() - assert args[0] == request_msg @@ -13753,7 +13778,6 @@ async def test_poll_airflow_command_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.PollAirflowCommandRequest() - assert args[0] == request_msg @@ -13780,7 +13804,6 @@ async def test_list_workloads_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.ListWorkloadsRequest() - assert args[0] == request_msg @@ -13805,7 +13828,6 @@ async def test_check_upgrade_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.CheckUpgradeRequest() - assert args[0] == request_msg @@ -13834,7 +13856,6 @@ async def test_create_user_workloads_secret_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.CreateUserWorkloadsSecretRequest() - assert args[0] == request_msg @@ -13863,7 +13884,6 @@ async def test_get_user_workloads_secret_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.GetUserWorkloadsSecretRequest() - assert args[0] == request_msg @@ -13892,7 +13912,6 @@ async def test_list_user_workloads_secrets_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.ListUserWorkloadsSecretsRequest() - assert args[0] == request_msg @@ -13921,7 +13940,6 @@ async def test_update_user_workloads_secret_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.UpdateUserWorkloadsSecretRequest() - assert args[0] == request_msg @@ -13946,7 +13964,6 @@ async def test_delete_user_workloads_secret_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.DeleteUserWorkloadsSecretRequest() - assert args[0] == request_msg @@ -13975,7 +13992,6 @@ async def test_create_user_workloads_config_map_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.CreateUserWorkloadsConfigMapRequest() - assert args[0] == request_msg @@ -14004,7 +14020,6 @@ async def test_get_user_workloads_config_map_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.GetUserWorkloadsConfigMapRequest() - assert args[0] == request_msg @@ -14033,7 +14048,6 @@ async def test_list_user_workloads_config_maps_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.ListUserWorkloadsConfigMapsRequest() - assert args[0] == request_msg @@ -14062,7 +14076,6 @@ async def test_update_user_workloads_config_map_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.UpdateUserWorkloadsConfigMapRequest() - assert args[0] == request_msg @@ -14087,7 +14100,6 @@ async def test_delete_user_workloads_config_map_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.DeleteUserWorkloadsConfigMapRequest() - assert args[0] == request_msg @@ -14112,7 +14124,6 @@ async def test_save_snapshot_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.SaveSnapshotRequest() - assert args[0] == request_msg @@ -14137,7 +14148,6 @@ async def test_load_snapshot_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.LoadSnapshotRequest() - assert args[0] == request_msg @@ -14164,7 +14174,6 @@ async def test_database_failover_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.DatabaseFailoverRequest() - assert args[0] == request_msg @@ -14195,7 +14204,6 @@ async def test_fetch_database_properties_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.FetchDatabasePropertiesRequest() - assert args[0] == request_msg @@ -18317,7 +18325,6 @@ def test_create_environment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.CreateEnvironmentRequest() - assert args[0] == request_msg @@ -18337,7 +18344,6 @@ def test_get_environment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.GetEnvironmentRequest() - assert args[0] == request_msg @@ -18359,7 +18365,6 @@ def test_list_environments_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.ListEnvironmentsRequest() - assert args[0] == request_msg @@ -18381,7 +18386,6 @@ def test_update_environment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.UpdateEnvironmentRequest() - assert args[0] == request_msg @@ -18403,7 +18407,6 @@ def test_delete_environment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.DeleteEnvironmentRequest() - assert args[0] == request_msg @@ -18425,7 +18428,6 @@ def test_execute_airflow_command_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.ExecuteAirflowCommandRequest() - assert args[0] == request_msg @@ -18447,7 +18449,6 @@ def test_stop_airflow_command_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.StopAirflowCommandRequest() - assert args[0] == request_msg @@ -18469,7 +18470,6 @@ def test_poll_airflow_command_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.PollAirflowCommandRequest() - assert args[0] == request_msg @@ -18489,7 +18489,6 @@ def test_list_workloads_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.ListWorkloadsRequest() - assert args[0] == request_msg @@ -18509,7 +18508,6 @@ def test_check_upgrade_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.CheckUpgradeRequest() - assert args[0] == request_msg @@ -18531,7 +18529,6 @@ def test_create_user_workloads_secret_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.CreateUserWorkloadsSecretRequest() - assert args[0] == request_msg @@ -18553,7 +18550,6 @@ def test_get_user_workloads_secret_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.GetUserWorkloadsSecretRequest() - assert args[0] == request_msg @@ -18575,7 +18571,6 @@ def test_list_user_workloads_secrets_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.ListUserWorkloadsSecretsRequest() - assert args[0] == request_msg @@ -18597,7 +18592,6 @@ def test_update_user_workloads_secret_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.UpdateUserWorkloadsSecretRequest() - assert args[0] == request_msg @@ -18619,7 +18613,6 @@ def test_delete_user_workloads_secret_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.DeleteUserWorkloadsSecretRequest() - assert args[0] == request_msg @@ -18641,7 +18634,6 @@ def test_create_user_workloads_config_map_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.CreateUserWorkloadsConfigMapRequest() - assert args[0] == request_msg @@ -18663,7 +18655,6 @@ def test_get_user_workloads_config_map_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.GetUserWorkloadsConfigMapRequest() - assert args[0] == request_msg @@ -18685,7 +18676,6 @@ def test_list_user_workloads_config_maps_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.ListUserWorkloadsConfigMapsRequest() - assert args[0] == request_msg @@ -18707,7 +18697,6 @@ def test_update_user_workloads_config_map_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.UpdateUserWorkloadsConfigMapRequest() - assert args[0] == request_msg @@ -18729,7 +18718,6 @@ def test_delete_user_workloads_config_map_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.DeleteUserWorkloadsConfigMapRequest() - assert args[0] == request_msg @@ -18749,7 +18737,6 @@ def test_save_snapshot_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.SaveSnapshotRequest() - assert args[0] == request_msg @@ -18769,7 +18756,6 @@ def test_load_snapshot_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.LoadSnapshotRequest() - assert args[0] == request_msg @@ -18791,7 +18777,6 @@ def test_database_failover_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.DatabaseFailoverRequest() - assert args[0] == request_msg @@ -18813,7 +18798,6 @@ def test_fetch_database_properties_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.FetchDatabasePropertiesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-orchestration-airflow/tests/unit/gapic/service_v1/test_image_versions.py b/packages/google-cloud-orchestration-airflow/tests/unit/gapic/service_v1/test_image_versions.py index 12fc0c8aa761..716c5daf3443 100644 --- a/packages/google-cloud-orchestration-airflow/tests/unit/gapic/service_v1/test_image_versions.py +++ b/packages/google-cloud-orchestration-airflow/tests/unit/gapic/service_v1/test_image_versions.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 @@ -108,6 +109,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" @@ -1307,8 +1323,8 @@ def test_image_versions_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - image_versions.ListImageVersionsRequest, - dict, + image_versions.ListImageVersionsRequest(), + {}, ], ) def test_list_image_versions(request_type, transport: str = "grpc"): @@ -1319,7 +1335,7 @@ def test_list_image_versions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1368,10 +1384,11 @@ def test_list_image_versions_non_empty_request_with_auto_populated_field(): client.list_image_versions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == image_versions.ListImageVersionsRequest( + request_msg = image_versions.ListImageVersionsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_image_versions_use_cached_wrapped_rpc(): @@ -1456,10 +1473,14 @@ async def test_list_image_versions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_image_versions_async( - transport: str = "grpc_asyncio", - request_type=image_versions.ListImageVersionsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + image_versions.ListImageVersionsRequest(), + {}, + ], +) +async def test_list_image_versions_async(request_type, transport: str = "grpc_asyncio"): client = ImageVersionsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1467,7 +1488,7 @@ async def test_list_image_versions_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( @@ -1492,11 +1513,6 @@ async def test_list_image_versions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_image_versions_async_from_dict(): - await test_list_image_versions_async(request_type=dict) - - def test_list_image_versions_field_headers(): client = ImageVersionsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2132,7 +2148,6 @@ def test_list_image_versions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = image_versions.ListImageVersionsRequest() - assert args[0] == request_msg @@ -2175,7 +2190,6 @@ async def test_list_image_versions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = image_versions.ListImageVersionsRequest() - assert args[0] == request_msg @@ -2536,7 +2550,6 @@ def test_list_image_versions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = image_versions.ListImageVersionsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-orchestration-airflow/tests/unit/gapic/service_v1beta1/test_environments.py b/packages/google-cloud-orchestration-airflow/tests/unit/gapic/service_v1beta1/test_environments.py index 938564b6e3e6..d5c6b7a473c3 100644 --- a/packages/google-cloud-orchestration-airflow/tests/unit/gapic/service_v1beta1/test_environments.py +++ b/packages/google-cloud-orchestration-airflow/tests/unit/gapic/service_v1beta1/test_environments.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 @@ -118,6 +119,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" @@ -1298,8 +1314,8 @@ def test_environments_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - environments.CreateEnvironmentRequest, - dict, + environments.CreateEnvironmentRequest(), + {}, ], ) def test_create_environment(request_type, transport: str = "grpc"): @@ -1310,7 +1326,7 @@ def test_create_environment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1355,9 +1371,10 @@ def test_create_environment_non_empty_request_with_auto_populated_field(): client.create_environment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environments.CreateEnvironmentRequest( + request_msg = environments.CreateEnvironmentRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_environment_use_cached_wrapped_rpc(): @@ -1452,9 +1469,14 @@ async def test_create_environment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_environment_async( - transport: str = "grpc_asyncio", request_type=environments.CreateEnvironmentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + environments.CreateEnvironmentRequest(), + {}, + ], +) +async def test_create_environment_async(request_type, transport: str = "grpc_asyncio"): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1462,7 +1484,7 @@ async def test_create_environment_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( @@ -1484,11 +1506,6 @@ async def test_create_environment_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_environment_async_from_dict(): - await test_create_environment_async(request_type=dict) - - def test_create_environment_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1653,8 +1670,8 @@ async def test_create_environment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - environments.GetEnvironmentRequest, - dict, + environments.GetEnvironmentRequest(), + {}, ], ) def test_get_environment(request_type, transport: str = "grpc"): @@ -1665,7 +1682,7 @@ def test_get_environment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_environment), "__call__") as call: @@ -1717,9 +1734,10 @@ def test_get_environment_non_empty_request_with_auto_populated_field(): client.get_environment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environments.GetEnvironmentRequest( + request_msg = environments.GetEnvironmentRequest( name="name_value", ) + assert args[0] == request_msg def test_get_environment_use_cached_wrapped_rpc(): @@ -1800,9 +1818,14 @@ async def test_get_environment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_environment_async( - transport: str = "grpc_asyncio", request_type=environments.GetEnvironmentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + environments.GetEnvironmentRequest(), + {}, + ], +) +async def test_get_environment_async(request_type, transport: str = "grpc_asyncio"): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1810,7 +1833,7 @@ async def test_get_environment_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_environment), "__call__") as call: @@ -1841,11 +1864,6 @@ async def test_get_environment_async( assert response.satisfies_pzi is True -@pytest.mark.asyncio -async def test_get_environment_async_from_dict(): - await test_get_environment_async(request_type=dict) - - def test_get_environment_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1992,8 +2010,8 @@ async def test_get_environment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - environments.ListEnvironmentsRequest, - dict, + environments.ListEnvironmentsRequest(), + {}, ], ) def test_list_environments(request_type, transport: str = "grpc"): @@ -2004,7 +2022,7 @@ def test_list_environments(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2053,10 +2071,11 @@ def test_list_environments_non_empty_request_with_auto_populated_field(): client.list_environments(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environments.ListEnvironmentsRequest( + request_msg = environments.ListEnvironmentsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_environments_use_cached_wrapped_rpc(): @@ -2139,9 +2158,14 @@ async def test_list_environments_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_environments_async( - transport: str = "grpc_asyncio", request_type=environments.ListEnvironmentsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + environments.ListEnvironmentsRequest(), + {}, + ], +) +async def test_list_environments_async(request_type, transport: str = "grpc_asyncio"): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2149,7 +2173,7 @@ async def test_list_environments_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( @@ -2174,11 +2198,6 @@ async def test_list_environments_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_environments_async_from_dict(): - await test_list_environments_async(request_type=dict) - - def test_list_environments_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2531,8 +2550,8 @@ async def test_list_environments_async_pages(): @pytest.mark.parametrize( "request_type", [ - environments.UpdateEnvironmentRequest, - dict, + environments.UpdateEnvironmentRequest(), + {}, ], ) def test_update_environment(request_type, transport: str = "grpc"): @@ -2543,7 +2562,7 @@ def test_update_environment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2588,9 +2607,10 @@ def test_update_environment_non_empty_request_with_auto_populated_field(): client.update_environment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environments.UpdateEnvironmentRequest( + request_msg = environments.UpdateEnvironmentRequest( name="name_value", ) + assert args[0] == request_msg def test_update_environment_use_cached_wrapped_rpc(): @@ -2685,9 +2705,14 @@ async def test_update_environment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_environment_async( - transport: str = "grpc_asyncio", request_type=environments.UpdateEnvironmentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + environments.UpdateEnvironmentRequest(), + {}, + ], +) +async def test_update_environment_async(request_type, transport: str = "grpc_asyncio"): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2695,7 +2720,7 @@ async def test_update_environment_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( @@ -2717,11 +2742,6 @@ async def test_update_environment_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_environment_async_from_dict(): - await test_update_environment_async(request_type=dict) - - def test_update_environment_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2896,8 +2916,8 @@ async def test_update_environment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - environments.DeleteEnvironmentRequest, - dict, + environments.DeleteEnvironmentRequest(), + {}, ], ) def test_delete_environment(request_type, transport: str = "grpc"): @@ -2908,7 +2928,7 @@ def test_delete_environment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2953,9 +2973,10 @@ def test_delete_environment_non_empty_request_with_auto_populated_field(): client.delete_environment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environments.DeleteEnvironmentRequest( + request_msg = environments.DeleteEnvironmentRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_environment_use_cached_wrapped_rpc(): @@ -3050,9 +3071,14 @@ async def test_delete_environment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_environment_async( - transport: str = "grpc_asyncio", request_type=environments.DeleteEnvironmentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + environments.DeleteEnvironmentRequest(), + {}, + ], +) +async def test_delete_environment_async(request_type, transport: str = "grpc_asyncio"): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3060,7 +3086,7 @@ async def test_delete_environment_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( @@ -3082,11 +3108,6 @@ async def test_delete_environment_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_environment_async_from_dict(): - await test_delete_environment_async(request_type=dict) - - def test_delete_environment_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3241,8 +3262,8 @@ async def test_delete_environment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - environments.RestartWebServerRequest, - dict, + environments.RestartWebServerRequest(), + {}, ], ) def test_restart_web_server(request_type, transport: str = "grpc"): @@ -3253,7 +3274,7 @@ def test_restart_web_server(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3298,9 +3319,10 @@ def test_restart_web_server_non_empty_request_with_auto_populated_field(): client.restart_web_server(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environments.RestartWebServerRequest( + request_msg = environments.RestartWebServerRequest( name="name_value", ) + assert args[0] == request_msg def test_restart_web_server_use_cached_wrapped_rpc(): @@ -3395,9 +3417,14 @@ async def test_restart_web_server_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_restart_web_server_async( - transport: str = "grpc_asyncio", request_type=environments.RestartWebServerRequest -): +@pytest.mark.parametrize( + "request_type", + [ + environments.RestartWebServerRequest(), + {}, + ], +) +async def test_restart_web_server_async(request_type, transport: str = "grpc_asyncio"): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3405,7 +3432,7 @@ async def test_restart_web_server_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( @@ -3427,11 +3454,6 @@ async def test_restart_web_server_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_restart_web_server_async_from_dict(): - await test_restart_web_server_async(request_type=dict) - - def test_restart_web_server_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3500,8 +3522,8 @@ async def test_restart_web_server_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - environments.CheckUpgradeRequest, - dict, + environments.CheckUpgradeRequest(), + {}, ], ) def test_check_upgrade(request_type, transport: str = "grpc"): @@ -3512,7 +3534,7 @@ def test_check_upgrade(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.check_upgrade), "__call__") as call: @@ -3554,10 +3576,11 @@ def test_check_upgrade_non_empty_request_with_auto_populated_field(): client.check_upgrade(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environments.CheckUpgradeRequest( + request_msg = environments.CheckUpgradeRequest( environment="environment_value", image_version="image_version_value", ) + assert args[0] == request_msg def test_check_upgrade_use_cached_wrapped_rpc(): @@ -3648,9 +3671,14 @@ async def test_check_upgrade_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_check_upgrade_async( - transport: str = "grpc_asyncio", request_type=environments.CheckUpgradeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + environments.CheckUpgradeRequest(), + {}, + ], +) +async def test_check_upgrade_async(request_type, transport: str = "grpc_asyncio"): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3658,7 +3686,7 @@ async def test_check_upgrade_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.check_upgrade), "__call__") as call: @@ -3678,11 +3706,6 @@ async def test_check_upgrade_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_check_upgrade_async_from_dict(): - await test_check_upgrade_async(request_type=dict) - - def test_check_upgrade_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3747,8 +3770,8 @@ async def test_check_upgrade_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - environments.ExecuteAirflowCommandRequest, - dict, + environments.ExecuteAirflowCommandRequest(), + {}, ], ) def test_execute_airflow_command(request_type, transport: str = "grpc"): @@ -3759,7 +3782,7 @@ def test_execute_airflow_command(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3815,11 +3838,12 @@ def test_execute_airflow_command_non_empty_request_with_auto_populated_field(): client.execute_airflow_command(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environments.ExecuteAirflowCommandRequest( + request_msg = environments.ExecuteAirflowCommandRequest( environment="environment_value", command="command_value", subcommand="subcommand_value", ) + assert args[0] == request_msg def test_execute_airflow_command_use_cached_wrapped_rpc(): @@ -3905,9 +3929,15 @@ async def test_execute_airflow_command_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + environments.ExecuteAirflowCommandRequest(), + {}, + ], +) async def test_execute_airflow_command_async( - transport: str = "grpc_asyncio", - request_type=environments.ExecuteAirflowCommandRequest, + request_type, transport: str = "grpc_asyncio" ): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), @@ -3916,7 +3946,7 @@ async def test_execute_airflow_command_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( @@ -3947,11 +3977,6 @@ async def test_execute_airflow_command_async( assert response.error == "error_value" -@pytest.mark.asyncio -async def test_execute_airflow_command_async_from_dict(): - await test_execute_airflow_command_async(request_type=dict) - - def test_execute_airflow_command_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4020,8 +4045,8 @@ async def test_execute_airflow_command_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - environments.StopAirflowCommandRequest, - dict, + environments.StopAirflowCommandRequest(), + {}, ], ) def test_stop_airflow_command(request_type, transport: str = "grpc"): @@ -4032,7 +4057,7 @@ def test_stop_airflow_command(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4085,12 +4110,13 @@ def test_stop_airflow_command_non_empty_request_with_auto_populated_field(): client.stop_airflow_command(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environments.StopAirflowCommandRequest( + request_msg = environments.StopAirflowCommandRequest( environment="environment_value", execution_id="execution_id_value", pod="pod_value", pod_namespace="pod_namespace_value", ) + assert args[0] == request_msg def test_stop_airflow_command_use_cached_wrapped_rpc(): @@ -4175,8 +4201,15 @@ async def test_stop_airflow_command_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + environments.StopAirflowCommandRequest(), + {}, + ], +) async def test_stop_airflow_command_async( - transport: str = "grpc_asyncio", request_type=environments.StopAirflowCommandRequest + request_type, transport: str = "grpc_asyncio" ): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), @@ -4185,7 +4218,7 @@ async def test_stop_airflow_command_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( @@ -4212,11 +4245,6 @@ async def test_stop_airflow_command_async( assert response.output == ["output_value"] -@pytest.mark.asyncio -async def test_stop_airflow_command_async_from_dict(): - await test_stop_airflow_command_async(request_type=dict) - - def test_stop_airflow_command_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4285,8 +4313,8 @@ async def test_stop_airflow_command_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - environments.PollAirflowCommandRequest, - dict, + environments.PollAirflowCommandRequest(), + {}, ], ) def test_poll_airflow_command(request_type, transport: str = "grpc"): @@ -4297,7 +4325,7 @@ def test_poll_airflow_command(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4348,12 +4376,13 @@ def test_poll_airflow_command_non_empty_request_with_auto_populated_field(): client.poll_airflow_command(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environments.PollAirflowCommandRequest( + request_msg = environments.PollAirflowCommandRequest( environment="environment_value", execution_id="execution_id_value", pod="pod_value", pod_namespace="pod_namespace_value", ) + assert args[0] == request_msg def test_poll_airflow_command_use_cached_wrapped_rpc(): @@ -4438,8 +4467,15 @@ async def test_poll_airflow_command_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + environments.PollAirflowCommandRequest(), + {}, + ], +) async def test_poll_airflow_command_async( - transport: str = "grpc_asyncio", request_type=environments.PollAirflowCommandRequest + request_type, transport: str = "grpc_asyncio" ): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), @@ -4448,7 +4484,7 @@ async def test_poll_airflow_command_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( @@ -4473,11 +4509,6 @@ async def test_poll_airflow_command_async( assert response.output_end is True -@pytest.mark.asyncio -async def test_poll_airflow_command_async_from_dict(): - await test_poll_airflow_command_async(request_type=dict) - - def test_poll_airflow_command_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4546,8 +4577,8 @@ async def test_poll_airflow_command_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - environments.ListWorkloadsRequest, - dict, + environments.ListWorkloadsRequest(), + {}, ], ) def test_list_workloads(request_type, transport: str = "grpc"): @@ -4558,7 +4589,7 @@ def test_list_workloads(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_workloads), "__call__") as call: @@ -4604,11 +4635,12 @@ def test_list_workloads_non_empty_request_with_auto_populated_field(): client.list_workloads(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environments.ListWorkloadsRequest( + request_msg = environments.ListWorkloadsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_workloads_use_cached_wrapped_rpc(): @@ -4689,9 +4721,14 @@ async def test_list_workloads_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_workloads_async( - transport: str = "grpc_asyncio", request_type=environments.ListWorkloadsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + environments.ListWorkloadsRequest(), + {}, + ], +) +async def test_list_workloads_async(request_type, transport: str = "grpc_asyncio"): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4699,7 +4736,7 @@ async def test_list_workloads_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_workloads), "__call__") as call: @@ -4722,11 +4759,6 @@ async def test_list_workloads_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_workloads_async_from_dict(): - await test_list_workloads_async(request_type=dict) - - def test_list_workloads_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5069,8 +5101,8 @@ async def test_list_workloads_async_pages(): @pytest.mark.parametrize( "request_type", [ - environments.CreateUserWorkloadsSecretRequest, - dict, + environments.CreateUserWorkloadsSecretRequest(), + {}, ], ) def test_create_user_workloads_secret(request_type, transport: str = "grpc"): @@ -5081,7 +5113,7 @@ def test_create_user_workloads_secret(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5129,9 +5161,10 @@ def test_create_user_workloads_secret_non_empty_request_with_auto_populated_fiel client.create_user_workloads_secret(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environments.CreateUserWorkloadsSecretRequest( + request_msg = environments.CreateUserWorkloadsSecretRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_user_workloads_secret_use_cached_wrapped_rpc(): @@ -5217,9 +5250,15 @@ async def test_create_user_workloads_secret_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + environments.CreateUserWorkloadsSecretRequest(), + {}, + ], +) async def test_create_user_workloads_secret_async( - transport: str = "grpc_asyncio", - request_type=environments.CreateUserWorkloadsSecretRequest, + request_type, transport: str = "grpc_asyncio" ): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), @@ -5228,7 +5267,7 @@ async def test_create_user_workloads_secret_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( @@ -5253,11 +5292,6 @@ async def test_create_user_workloads_secret_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_create_user_workloads_secret_async_from_dict(): - await test_create_user_workloads_secret_async(request_type=dict) - - def test_create_user_workloads_secret_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5422,8 +5456,8 @@ async def test_create_user_workloads_secret_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - environments.GetUserWorkloadsSecretRequest, - dict, + environments.GetUserWorkloadsSecretRequest(), + {}, ], ) def test_get_user_workloads_secret(request_type, transport: str = "grpc"): @@ -5434,7 +5468,7 @@ def test_get_user_workloads_secret(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5482,9 +5516,10 @@ def test_get_user_workloads_secret_non_empty_request_with_auto_populated_field() client.get_user_workloads_secret(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environments.GetUserWorkloadsSecretRequest( + request_msg = environments.GetUserWorkloadsSecretRequest( name="name_value", ) + assert args[0] == request_msg def test_get_user_workloads_secret_use_cached_wrapped_rpc(): @@ -5570,9 +5605,15 @@ async def test_get_user_workloads_secret_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + environments.GetUserWorkloadsSecretRequest(), + {}, + ], +) async def test_get_user_workloads_secret_async( - transport: str = "grpc_asyncio", - request_type=environments.GetUserWorkloadsSecretRequest, + request_type, transport: str = "grpc_asyncio" ): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), @@ -5581,7 +5622,7 @@ async def test_get_user_workloads_secret_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( @@ -5606,11 +5647,6 @@ async def test_get_user_workloads_secret_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_user_workloads_secret_async_from_dict(): - await test_get_user_workloads_secret_async(request_type=dict) - - def test_get_user_workloads_secret_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5765,8 +5801,8 @@ async def test_get_user_workloads_secret_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - environments.ListUserWorkloadsSecretsRequest, - dict, + environments.ListUserWorkloadsSecretsRequest(), + {}, ], ) def test_list_user_workloads_secrets(request_type, transport: str = "grpc"): @@ -5777,7 +5813,7 @@ def test_list_user_workloads_secrets(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5826,10 +5862,11 @@ def test_list_user_workloads_secrets_non_empty_request_with_auto_populated_field client.list_user_workloads_secrets(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environments.ListUserWorkloadsSecretsRequest( + request_msg = environments.ListUserWorkloadsSecretsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_user_workloads_secrets_use_cached_wrapped_rpc(): @@ -5915,9 +5952,15 @@ async def test_list_user_workloads_secrets_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + environments.ListUserWorkloadsSecretsRequest(), + {}, + ], +) async def test_list_user_workloads_secrets_async( - transport: str = "grpc_asyncio", - request_type=environments.ListUserWorkloadsSecretsRequest, + request_type, transport: str = "grpc_asyncio" ): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), @@ -5926,7 +5969,7 @@ async def test_list_user_workloads_secrets_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( @@ -5951,11 +5994,6 @@ async def test_list_user_workloads_secrets_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_user_workloads_secrets_async_from_dict(): - await test_list_user_workloads_secrets_async(request_type=dict) - - def test_list_user_workloads_secrets_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6310,8 +6348,8 @@ async def test_list_user_workloads_secrets_async_pages(): @pytest.mark.parametrize( "request_type", [ - environments.UpdateUserWorkloadsSecretRequest, - dict, + environments.UpdateUserWorkloadsSecretRequest(), + {}, ], ) def test_update_user_workloads_secret(request_type, transport: str = "grpc"): @@ -6322,7 +6360,7 @@ def test_update_user_workloads_secret(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6368,7 +6406,8 @@ def test_update_user_workloads_secret_non_empty_request_with_auto_populated_fiel client.update_user_workloads_secret(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environments.UpdateUserWorkloadsSecretRequest() + request_msg = environments.UpdateUserWorkloadsSecretRequest() + assert args[0] == request_msg def test_update_user_workloads_secret_use_cached_wrapped_rpc(): @@ -6454,9 +6493,15 @@ async def test_update_user_workloads_secret_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + environments.UpdateUserWorkloadsSecretRequest(), + {}, + ], +) async def test_update_user_workloads_secret_async( - transport: str = "grpc_asyncio", - request_type=environments.UpdateUserWorkloadsSecretRequest, + request_type, transport: str = "grpc_asyncio" ): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), @@ -6465,7 +6510,7 @@ async def test_update_user_workloads_secret_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( @@ -6490,11 +6535,6 @@ async def test_update_user_workloads_secret_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_update_user_workloads_secret_async_from_dict(): - await test_update_user_workloads_secret_async(request_type=dict) - - def test_update_user_workloads_secret_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6649,8 +6689,8 @@ async def test_update_user_workloads_secret_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - environments.DeleteUserWorkloadsSecretRequest, - dict, + environments.DeleteUserWorkloadsSecretRequest(), + {}, ], ) def test_delete_user_workloads_secret(request_type, transport: str = "grpc"): @@ -6661,7 +6701,7 @@ def test_delete_user_workloads_secret(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6706,9 +6746,10 @@ def test_delete_user_workloads_secret_non_empty_request_with_auto_populated_fiel client.delete_user_workloads_secret(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environments.DeleteUserWorkloadsSecretRequest( + request_msg = environments.DeleteUserWorkloadsSecretRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_user_workloads_secret_use_cached_wrapped_rpc(): @@ -6794,9 +6835,15 @@ async def test_delete_user_workloads_secret_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + environments.DeleteUserWorkloadsSecretRequest(), + {}, + ], +) async def test_delete_user_workloads_secret_async( - transport: str = "grpc_asyncio", - request_type=environments.DeleteUserWorkloadsSecretRequest, + request_type, transport: str = "grpc_asyncio" ): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), @@ -6805,7 +6852,7 @@ async def test_delete_user_workloads_secret_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( @@ -6825,11 +6872,6 @@ async def test_delete_user_workloads_secret_async( assert response is None -@pytest.mark.asyncio -async def test_delete_user_workloads_secret_async_from_dict(): - await test_delete_user_workloads_secret_async(request_type=dict) - - def test_delete_user_workloads_secret_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6980,8 +7022,8 @@ async def test_delete_user_workloads_secret_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - environments.CreateUserWorkloadsConfigMapRequest, - dict, + environments.CreateUserWorkloadsConfigMapRequest(), + {}, ], ) def test_create_user_workloads_config_map(request_type, transport: str = "grpc"): @@ -6992,7 +7034,7 @@ def test_create_user_workloads_config_map(request_type, transport: str = "grpc") # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7040,9 +7082,10 @@ def test_create_user_workloads_config_map_non_empty_request_with_auto_populated_ client.create_user_workloads_config_map(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environments.CreateUserWorkloadsConfigMapRequest( + request_msg = environments.CreateUserWorkloadsConfigMapRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_user_workloads_config_map_use_cached_wrapped_rpc(): @@ -7128,9 +7171,15 @@ async def test_create_user_workloads_config_map_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + environments.CreateUserWorkloadsConfigMapRequest(), + {}, + ], +) async def test_create_user_workloads_config_map_async( - transport: str = "grpc_asyncio", - request_type=environments.CreateUserWorkloadsConfigMapRequest, + request_type, transport: str = "grpc_asyncio" ): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), @@ -7139,7 +7188,7 @@ async def test_create_user_workloads_config_map_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( @@ -7164,11 +7213,6 @@ async def test_create_user_workloads_config_map_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_create_user_workloads_config_map_async_from_dict(): - await test_create_user_workloads_config_map_async(request_type=dict) - - def test_create_user_workloads_config_map_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7341,8 +7385,8 @@ async def test_create_user_workloads_config_map_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - environments.GetUserWorkloadsConfigMapRequest, - dict, + environments.GetUserWorkloadsConfigMapRequest(), + {}, ], ) def test_get_user_workloads_config_map(request_type, transport: str = "grpc"): @@ -7353,7 +7397,7 @@ def test_get_user_workloads_config_map(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7401,9 +7445,10 @@ def test_get_user_workloads_config_map_non_empty_request_with_auto_populated_fie client.get_user_workloads_config_map(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environments.GetUserWorkloadsConfigMapRequest( + request_msg = environments.GetUserWorkloadsConfigMapRequest( name="name_value", ) + assert args[0] == request_msg def test_get_user_workloads_config_map_use_cached_wrapped_rpc(): @@ -7489,9 +7534,15 @@ async def test_get_user_workloads_config_map_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + environments.GetUserWorkloadsConfigMapRequest(), + {}, + ], +) async def test_get_user_workloads_config_map_async( - transport: str = "grpc_asyncio", - request_type=environments.GetUserWorkloadsConfigMapRequest, + request_type, transport: str = "grpc_asyncio" ): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), @@ -7500,7 +7551,7 @@ async def test_get_user_workloads_config_map_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( @@ -7525,11 +7576,6 @@ async def test_get_user_workloads_config_map_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_user_workloads_config_map_async_from_dict(): - await test_get_user_workloads_config_map_async(request_type=dict) - - def test_get_user_workloads_config_map_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7684,8 +7730,8 @@ async def test_get_user_workloads_config_map_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - environments.ListUserWorkloadsConfigMapsRequest, - dict, + environments.ListUserWorkloadsConfigMapsRequest(), + {}, ], ) def test_list_user_workloads_config_maps(request_type, transport: str = "grpc"): @@ -7696,7 +7742,7 @@ def test_list_user_workloads_config_maps(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7745,10 +7791,11 @@ def test_list_user_workloads_config_maps_non_empty_request_with_auto_populated_f client.list_user_workloads_config_maps(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environments.ListUserWorkloadsConfigMapsRequest( + request_msg = environments.ListUserWorkloadsConfigMapsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_user_workloads_config_maps_use_cached_wrapped_rpc(): @@ -7834,9 +7881,15 @@ async def test_list_user_workloads_config_maps_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + environments.ListUserWorkloadsConfigMapsRequest(), + {}, + ], +) async def test_list_user_workloads_config_maps_async( - transport: str = "grpc_asyncio", - request_type=environments.ListUserWorkloadsConfigMapsRequest, + request_type, transport: str = "grpc_asyncio" ): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), @@ -7845,7 +7898,7 @@ async def test_list_user_workloads_config_maps_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( @@ -7870,11 +7923,6 @@ async def test_list_user_workloads_config_maps_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_user_workloads_config_maps_async_from_dict(): - await test_list_user_workloads_config_maps_async(request_type=dict) - - def test_list_user_workloads_config_maps_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8233,8 +8281,8 @@ async def test_list_user_workloads_config_maps_async_pages(): @pytest.mark.parametrize( "request_type", [ - environments.UpdateUserWorkloadsConfigMapRequest, - dict, + environments.UpdateUserWorkloadsConfigMapRequest(), + {}, ], ) def test_update_user_workloads_config_map(request_type, transport: str = "grpc"): @@ -8245,7 +8293,7 @@ def test_update_user_workloads_config_map(request_type, transport: str = "grpc") # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8291,7 +8339,8 @@ def test_update_user_workloads_config_map_non_empty_request_with_auto_populated_ client.update_user_workloads_config_map(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environments.UpdateUserWorkloadsConfigMapRequest() + request_msg = environments.UpdateUserWorkloadsConfigMapRequest() + assert args[0] == request_msg def test_update_user_workloads_config_map_use_cached_wrapped_rpc(): @@ -8377,9 +8426,15 @@ async def test_update_user_workloads_config_map_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + environments.UpdateUserWorkloadsConfigMapRequest(), + {}, + ], +) async def test_update_user_workloads_config_map_async( - transport: str = "grpc_asyncio", - request_type=environments.UpdateUserWorkloadsConfigMapRequest, + request_type, transport: str = "grpc_asyncio" ): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), @@ -8388,7 +8443,7 @@ async def test_update_user_workloads_config_map_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( @@ -8413,11 +8468,6 @@ async def test_update_user_workloads_config_map_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_update_user_workloads_config_map_async_from_dict(): - await test_update_user_workloads_config_map_async(request_type=dict) - - def test_update_user_workloads_config_map_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8580,8 +8630,8 @@ async def test_update_user_workloads_config_map_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - environments.DeleteUserWorkloadsConfigMapRequest, - dict, + environments.DeleteUserWorkloadsConfigMapRequest(), + {}, ], ) def test_delete_user_workloads_config_map(request_type, transport: str = "grpc"): @@ -8592,7 +8642,7 @@ def test_delete_user_workloads_config_map(request_type, transport: str = "grpc") # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8637,9 +8687,10 @@ def test_delete_user_workloads_config_map_non_empty_request_with_auto_populated_ client.delete_user_workloads_config_map(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environments.DeleteUserWorkloadsConfigMapRequest( + request_msg = environments.DeleteUserWorkloadsConfigMapRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_user_workloads_config_map_use_cached_wrapped_rpc(): @@ -8725,9 +8776,15 @@ async def test_delete_user_workloads_config_map_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + environments.DeleteUserWorkloadsConfigMapRequest(), + {}, + ], +) async def test_delete_user_workloads_config_map_async( - transport: str = "grpc_asyncio", - request_type=environments.DeleteUserWorkloadsConfigMapRequest, + request_type, transport: str = "grpc_asyncio" ): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), @@ -8736,7 +8793,7 @@ async def test_delete_user_workloads_config_map_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( @@ -8756,11 +8813,6 @@ async def test_delete_user_workloads_config_map_async( assert response is None -@pytest.mark.asyncio -async def test_delete_user_workloads_config_map_async_from_dict(): - await test_delete_user_workloads_config_map_async(request_type=dict) - - def test_delete_user_workloads_config_map_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8911,8 +8963,8 @@ async def test_delete_user_workloads_config_map_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - environments.SaveSnapshotRequest, - dict, + environments.SaveSnapshotRequest(), + {}, ], ) def test_save_snapshot(request_type, transport: str = "grpc"): @@ -8923,7 +8975,7 @@ def test_save_snapshot(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.save_snapshot), "__call__") as call: @@ -8965,10 +9017,11 @@ def test_save_snapshot_non_empty_request_with_auto_populated_field(): client.save_snapshot(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environments.SaveSnapshotRequest( + request_msg = environments.SaveSnapshotRequest( environment="environment_value", snapshot_location="snapshot_location_value", ) + assert args[0] == request_msg def test_save_snapshot_use_cached_wrapped_rpc(): @@ -9059,9 +9112,14 @@ async def test_save_snapshot_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_save_snapshot_async( - transport: str = "grpc_asyncio", request_type=environments.SaveSnapshotRequest -): +@pytest.mark.parametrize( + "request_type", + [ + environments.SaveSnapshotRequest(), + {}, + ], +) +async def test_save_snapshot_async(request_type, transport: str = "grpc_asyncio"): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9069,7 +9127,7 @@ async def test_save_snapshot_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.save_snapshot), "__call__") as call: @@ -9089,11 +9147,6 @@ async def test_save_snapshot_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_save_snapshot_async_from_dict(): - await test_save_snapshot_async(request_type=dict) - - def test_save_snapshot_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9158,8 +9211,8 @@ async def test_save_snapshot_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - environments.LoadSnapshotRequest, - dict, + environments.LoadSnapshotRequest(), + {}, ], ) def test_load_snapshot(request_type, transport: str = "grpc"): @@ -9170,7 +9223,7 @@ def test_load_snapshot(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.load_snapshot), "__call__") as call: @@ -9212,10 +9265,11 @@ def test_load_snapshot_non_empty_request_with_auto_populated_field(): client.load_snapshot(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environments.LoadSnapshotRequest( + request_msg = environments.LoadSnapshotRequest( environment="environment_value", snapshot_path="snapshot_path_value", ) + assert args[0] == request_msg def test_load_snapshot_use_cached_wrapped_rpc(): @@ -9306,9 +9360,14 @@ async def test_load_snapshot_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_load_snapshot_async( - transport: str = "grpc_asyncio", request_type=environments.LoadSnapshotRequest -): +@pytest.mark.parametrize( + "request_type", + [ + environments.LoadSnapshotRequest(), + {}, + ], +) +async def test_load_snapshot_async(request_type, transport: str = "grpc_asyncio"): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9316,7 +9375,7 @@ async def test_load_snapshot_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.load_snapshot), "__call__") as call: @@ -9336,11 +9395,6 @@ async def test_load_snapshot_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_load_snapshot_async_from_dict(): - await test_load_snapshot_async(request_type=dict) - - def test_load_snapshot_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9405,8 +9459,8 @@ async def test_load_snapshot_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - environments.DatabaseFailoverRequest, - dict, + environments.DatabaseFailoverRequest(), + {}, ], ) def test_database_failover(request_type, transport: str = "grpc"): @@ -9417,7 +9471,7 @@ def test_database_failover(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9462,9 +9516,10 @@ def test_database_failover_non_empty_request_with_auto_populated_field(): client.database_failover(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environments.DatabaseFailoverRequest( + request_msg = environments.DatabaseFailoverRequest( environment="environment_value", ) + assert args[0] == request_msg def test_database_failover_use_cached_wrapped_rpc(): @@ -9557,9 +9612,14 @@ async def test_database_failover_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_database_failover_async( - transport: str = "grpc_asyncio", request_type=environments.DatabaseFailoverRequest -): +@pytest.mark.parametrize( + "request_type", + [ + environments.DatabaseFailoverRequest(), + {}, + ], +) +async def test_database_failover_async(request_type, transport: str = "grpc_asyncio"): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9567,7 +9627,7 @@ async def test_database_failover_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( @@ -9589,11 +9649,6 @@ async def test_database_failover_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_database_failover_async_from_dict(): - await test_database_failover_async(request_type=dict) - - def test_database_failover_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9662,8 +9717,8 @@ async def test_database_failover_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - environments.FetchDatabasePropertiesRequest, - dict, + environments.FetchDatabasePropertiesRequest(), + {}, ], ) def test_fetch_database_properties(request_type, transport: str = "grpc"): @@ -9674,7 +9729,7 @@ def test_fetch_database_properties(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9726,9 +9781,10 @@ def test_fetch_database_properties_non_empty_request_with_auto_populated_field() client.fetch_database_properties(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == environments.FetchDatabasePropertiesRequest( + request_msg = environments.FetchDatabasePropertiesRequest( environment="environment_value", ) + assert args[0] == request_msg def test_fetch_database_properties_use_cached_wrapped_rpc(): @@ -9814,9 +9870,15 @@ async def test_fetch_database_properties_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + environments.FetchDatabasePropertiesRequest(), + {}, + ], +) async def test_fetch_database_properties_async( - transport: str = "grpc_asyncio", - request_type=environments.FetchDatabasePropertiesRequest, + request_type, transport: str = "grpc_asyncio" ): client = EnvironmentsAsyncClient( credentials=async_anonymous_credentials(), @@ -9825,7 +9887,7 @@ async def test_fetch_database_properties_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( @@ -9854,11 +9916,6 @@ async def test_fetch_database_properties_async( assert response.is_failover_replica_available is True -@pytest.mark.asyncio -async def test_fetch_database_properties_async_from_dict(): - await test_fetch_database_properties_async(request_type=dict) - - def test_fetch_database_properties_field_headers(): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13291,7 +13348,6 @@ def test_create_environment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.CreateEnvironmentRequest() - assert args[0] == request_msg @@ -13312,7 +13368,6 @@ def test_get_environment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.GetEnvironmentRequest() - assert args[0] == request_msg @@ -13335,7 +13390,6 @@ def test_list_environments_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.ListEnvironmentsRequest() - assert args[0] == request_msg @@ -13358,7 +13412,6 @@ def test_update_environment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.UpdateEnvironmentRequest() - assert args[0] == request_msg @@ -13381,7 +13434,6 @@ def test_delete_environment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.DeleteEnvironmentRequest() - assert args[0] == request_msg @@ -13404,7 +13456,6 @@ def test_restart_web_server_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.RestartWebServerRequest() - assert args[0] == request_msg @@ -13425,7 +13476,6 @@ def test_check_upgrade_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.CheckUpgradeRequest() - assert args[0] == request_msg @@ -13448,7 +13498,6 @@ def test_execute_airflow_command_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.ExecuteAirflowCommandRequest() - assert args[0] == request_msg @@ -13471,7 +13520,6 @@ def test_stop_airflow_command_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.StopAirflowCommandRequest() - assert args[0] == request_msg @@ -13494,7 +13542,6 @@ def test_poll_airflow_command_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.PollAirflowCommandRequest() - assert args[0] == request_msg @@ -13515,7 +13562,6 @@ def test_list_workloads_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.ListWorkloadsRequest() - assert args[0] == request_msg @@ -13538,7 +13584,6 @@ def test_create_user_workloads_secret_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.CreateUserWorkloadsSecretRequest() - assert args[0] == request_msg @@ -13561,7 +13606,6 @@ def test_get_user_workloads_secret_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.GetUserWorkloadsSecretRequest() - assert args[0] == request_msg @@ -13584,7 +13628,6 @@ def test_list_user_workloads_secrets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.ListUserWorkloadsSecretsRequest() - assert args[0] == request_msg @@ -13607,7 +13650,6 @@ def test_update_user_workloads_secret_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.UpdateUserWorkloadsSecretRequest() - assert args[0] == request_msg @@ -13630,7 +13672,6 @@ def test_delete_user_workloads_secret_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.DeleteUserWorkloadsSecretRequest() - assert args[0] == request_msg @@ -13653,7 +13694,6 @@ def test_create_user_workloads_config_map_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.CreateUserWorkloadsConfigMapRequest() - assert args[0] == request_msg @@ -13676,7 +13716,6 @@ def test_get_user_workloads_config_map_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.GetUserWorkloadsConfigMapRequest() - assert args[0] == request_msg @@ -13699,7 +13738,6 @@ def test_list_user_workloads_config_maps_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.ListUserWorkloadsConfigMapsRequest() - assert args[0] == request_msg @@ -13722,7 +13760,6 @@ def test_update_user_workloads_config_map_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.UpdateUserWorkloadsConfigMapRequest() - assert args[0] == request_msg @@ -13745,7 +13782,6 @@ def test_delete_user_workloads_config_map_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.DeleteUserWorkloadsConfigMapRequest() - assert args[0] == request_msg @@ -13766,7 +13802,6 @@ def test_save_snapshot_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.SaveSnapshotRequest() - assert args[0] == request_msg @@ -13787,7 +13822,6 @@ def test_load_snapshot_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.LoadSnapshotRequest() - assert args[0] == request_msg @@ -13810,7 +13844,6 @@ def test_database_failover_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.DatabaseFailoverRequest() - assert args[0] == request_msg @@ -13833,7 +13866,6 @@ def test_fetch_database_properties_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.FetchDatabasePropertiesRequest() - assert args[0] == request_msg @@ -13874,7 +13906,6 @@ async def test_create_environment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.CreateEnvironmentRequest() - assert args[0] == request_msg @@ -13905,7 +13936,6 @@ async def test_get_environment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.GetEnvironmentRequest() - assert args[0] == request_msg @@ -13934,7 +13964,6 @@ async def test_list_environments_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.ListEnvironmentsRequest() - assert args[0] == request_msg @@ -13961,7 +13990,6 @@ async def test_update_environment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.UpdateEnvironmentRequest() - assert args[0] == request_msg @@ -13988,7 +14016,6 @@ async def test_delete_environment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.DeleteEnvironmentRequest() - assert args[0] == request_msg @@ -14015,7 +14042,6 @@ async def test_restart_web_server_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.RestartWebServerRequest() - assert args[0] == request_msg @@ -14040,7 +14066,6 @@ async def test_check_upgrade_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.CheckUpgradeRequest() - assert args[0] == request_msg @@ -14072,7 +14097,6 @@ async def test_execute_airflow_command_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.ExecuteAirflowCommandRequest() - assert args[0] == request_msg @@ -14102,7 +14126,6 @@ async def test_stop_airflow_command_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.StopAirflowCommandRequest() - assert args[0] == request_msg @@ -14131,7 +14154,6 @@ async def test_poll_airflow_command_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.PollAirflowCommandRequest() - assert args[0] == request_msg @@ -14158,7 +14180,6 @@ async def test_list_workloads_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.ListWorkloadsRequest() - assert args[0] == request_msg @@ -14187,7 +14208,6 @@ async def test_create_user_workloads_secret_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.CreateUserWorkloadsSecretRequest() - assert args[0] == request_msg @@ -14216,7 +14236,6 @@ async def test_get_user_workloads_secret_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.GetUserWorkloadsSecretRequest() - assert args[0] == request_msg @@ -14245,7 +14264,6 @@ async def test_list_user_workloads_secrets_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.ListUserWorkloadsSecretsRequest() - assert args[0] == request_msg @@ -14274,7 +14292,6 @@ async def test_update_user_workloads_secret_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.UpdateUserWorkloadsSecretRequest() - assert args[0] == request_msg @@ -14299,7 +14316,6 @@ async def test_delete_user_workloads_secret_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.DeleteUserWorkloadsSecretRequest() - assert args[0] == request_msg @@ -14328,7 +14344,6 @@ async def test_create_user_workloads_config_map_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.CreateUserWorkloadsConfigMapRequest() - assert args[0] == request_msg @@ -14357,7 +14372,6 @@ async def test_get_user_workloads_config_map_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.GetUserWorkloadsConfigMapRequest() - assert args[0] == request_msg @@ -14386,7 +14400,6 @@ async def test_list_user_workloads_config_maps_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.ListUserWorkloadsConfigMapsRequest() - assert args[0] == request_msg @@ -14415,7 +14428,6 @@ async def test_update_user_workloads_config_map_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.UpdateUserWorkloadsConfigMapRequest() - assert args[0] == request_msg @@ -14440,7 +14452,6 @@ async def test_delete_user_workloads_config_map_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.DeleteUserWorkloadsConfigMapRequest() - assert args[0] == request_msg @@ -14465,7 +14476,6 @@ async def test_save_snapshot_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.SaveSnapshotRequest() - assert args[0] == request_msg @@ -14490,7 +14500,6 @@ async def test_load_snapshot_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.LoadSnapshotRequest() - assert args[0] == request_msg @@ -14517,7 +14526,6 @@ async def test_database_failover_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.DatabaseFailoverRequest() - assert args[0] == request_msg @@ -14548,7 +14556,6 @@ async def test_fetch_database_properties_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.FetchDatabasePropertiesRequest() - assert args[0] == request_msg @@ -18800,7 +18807,6 @@ def test_create_environment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.CreateEnvironmentRequest() - assert args[0] == request_msg @@ -18820,7 +18826,6 @@ def test_get_environment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.GetEnvironmentRequest() - assert args[0] == request_msg @@ -18842,7 +18847,6 @@ def test_list_environments_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.ListEnvironmentsRequest() - assert args[0] == request_msg @@ -18864,7 +18868,6 @@ def test_update_environment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.UpdateEnvironmentRequest() - assert args[0] == request_msg @@ -18886,7 +18889,6 @@ def test_delete_environment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.DeleteEnvironmentRequest() - assert args[0] == request_msg @@ -18908,7 +18910,6 @@ def test_restart_web_server_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.RestartWebServerRequest() - assert args[0] == request_msg @@ -18928,7 +18929,6 @@ def test_check_upgrade_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.CheckUpgradeRequest() - assert args[0] == request_msg @@ -18950,7 +18950,6 @@ def test_execute_airflow_command_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.ExecuteAirflowCommandRequest() - assert args[0] == request_msg @@ -18972,7 +18971,6 @@ def test_stop_airflow_command_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.StopAirflowCommandRequest() - assert args[0] == request_msg @@ -18994,7 +18992,6 @@ def test_poll_airflow_command_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.PollAirflowCommandRequest() - assert args[0] == request_msg @@ -19014,7 +19011,6 @@ def test_list_workloads_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.ListWorkloadsRequest() - assert args[0] == request_msg @@ -19036,7 +19032,6 @@ def test_create_user_workloads_secret_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.CreateUserWorkloadsSecretRequest() - assert args[0] == request_msg @@ -19058,7 +19053,6 @@ def test_get_user_workloads_secret_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.GetUserWorkloadsSecretRequest() - assert args[0] == request_msg @@ -19080,7 +19074,6 @@ def test_list_user_workloads_secrets_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.ListUserWorkloadsSecretsRequest() - assert args[0] == request_msg @@ -19102,7 +19095,6 @@ def test_update_user_workloads_secret_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.UpdateUserWorkloadsSecretRequest() - assert args[0] == request_msg @@ -19124,7 +19116,6 @@ def test_delete_user_workloads_secret_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.DeleteUserWorkloadsSecretRequest() - assert args[0] == request_msg @@ -19146,7 +19137,6 @@ def test_create_user_workloads_config_map_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.CreateUserWorkloadsConfigMapRequest() - assert args[0] == request_msg @@ -19168,7 +19158,6 @@ def test_get_user_workloads_config_map_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.GetUserWorkloadsConfigMapRequest() - assert args[0] == request_msg @@ -19190,7 +19179,6 @@ def test_list_user_workloads_config_maps_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.ListUserWorkloadsConfigMapsRequest() - assert args[0] == request_msg @@ -19212,7 +19200,6 @@ def test_update_user_workloads_config_map_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.UpdateUserWorkloadsConfigMapRequest() - assert args[0] == request_msg @@ -19234,7 +19221,6 @@ def test_delete_user_workloads_config_map_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.DeleteUserWorkloadsConfigMapRequest() - assert args[0] == request_msg @@ -19254,7 +19240,6 @@ def test_save_snapshot_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.SaveSnapshotRequest() - assert args[0] == request_msg @@ -19274,7 +19259,6 @@ def test_load_snapshot_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.LoadSnapshotRequest() - assert args[0] == request_msg @@ -19296,7 +19280,6 @@ def test_database_failover_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.DatabaseFailoverRequest() - assert args[0] == request_msg @@ -19318,7 +19301,6 @@ def test_fetch_database_properties_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = environments.FetchDatabasePropertiesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-orchestration-airflow/tests/unit/gapic/service_v1beta1/test_image_versions.py b/packages/google-cloud-orchestration-airflow/tests/unit/gapic/service_v1beta1/test_image_versions.py index e79e7c090809..3abcde1c199d 100644 --- a/packages/google-cloud-orchestration-airflow/tests/unit/gapic/service_v1beta1/test_image_versions.py +++ b/packages/google-cloud-orchestration-airflow/tests/unit/gapic/service_v1beta1/test_image_versions.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 @@ -108,6 +109,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" @@ -1307,8 +1323,8 @@ def test_image_versions_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - image_versions.ListImageVersionsRequest, - dict, + image_versions.ListImageVersionsRequest(), + {}, ], ) def test_list_image_versions(request_type, transport: str = "grpc"): @@ -1319,7 +1335,7 @@ def test_list_image_versions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1368,10 +1384,11 @@ def test_list_image_versions_non_empty_request_with_auto_populated_field(): client.list_image_versions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == image_versions.ListImageVersionsRequest( + request_msg = image_versions.ListImageVersionsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_image_versions_use_cached_wrapped_rpc(): @@ -1456,10 +1473,14 @@ async def test_list_image_versions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_image_versions_async( - transport: str = "grpc_asyncio", - request_type=image_versions.ListImageVersionsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + image_versions.ListImageVersionsRequest(), + {}, + ], +) +async def test_list_image_versions_async(request_type, transport: str = "grpc_asyncio"): client = ImageVersionsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1467,7 +1488,7 @@ async def test_list_image_versions_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( @@ -1492,11 +1513,6 @@ async def test_list_image_versions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_image_versions_async_from_dict(): - await test_list_image_versions_async(request_type=dict) - - def test_list_image_versions_field_headers(): client = ImageVersionsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2132,7 +2148,6 @@ def test_list_image_versions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = image_versions.ListImageVersionsRequest() - assert args[0] == request_msg @@ -2175,7 +2190,6 @@ async def test_list_image_versions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = image_versions.ListImageVersionsRequest() - assert args[0] == request_msg @@ -2536,7 +2550,6 @@ def test_list_image_versions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = image_versions.ListImageVersionsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-org-policy/noxfile.py b/packages/google-cloud-org-policy/noxfile.py index d8e9d39f22bf..6cf84cb47c03 100644 --- a/packages/google-cloud-org-policy/noxfile.py +++ b/packages/google-cloud-org-policy/noxfile.py @@ -47,7 +47,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-org-policy" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-org-policy/setup.py b/packages/google-cloud-org-policy/setup.py index 9b947ac38359..eeeb8c23b623 100644 --- a/packages/google-cloud-org-policy/setup.py +++ b/packages/google-cloud-org-policy/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/google-cloud-org-policy/testing/constraints-3.10.txt b/packages/google-cloud-org-policy/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-org-policy/testing/constraints-3.10.txt +++ b/packages/google-cloud-org-policy/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-org-policy/tests/unit/gapic/orgpolicy_v2/test_org_policy.py b/packages/google-cloud-org-policy/tests/unit/gapic/orgpolicy_v2/test_org_policy.py index 9dcbd3a88ec7..0ec48246ed6c 100644 --- a/packages/google-cloud-org-policy/tests/unit/gapic/orgpolicy_v2/test_org_policy.py +++ b/packages/google-cloud-org-policy/tests/unit/gapic/orgpolicy_v2/test_org_policy.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" @@ -1270,8 +1286,8 @@ def test_org_policy_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - orgpolicy.ListConstraintsRequest, - dict, + orgpolicy.ListConstraintsRequest(), + {}, ], ) def test_list_constraints(request_type, transport: str = "grpc"): @@ -1282,7 +1298,7 @@ def test_list_constraints(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_constraints), "__call__") as call: @@ -1327,10 +1343,11 @@ def test_list_constraints_non_empty_request_with_auto_populated_field(): client.list_constraints(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == orgpolicy.ListConstraintsRequest( + request_msg = orgpolicy.ListConstraintsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_constraints_use_cached_wrapped_rpc(): @@ -1413,9 +1430,14 @@ async def test_list_constraints_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_constraints_async( - transport: str = "grpc_asyncio", request_type=orgpolicy.ListConstraintsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + orgpolicy.ListConstraintsRequest(), + {}, + ], +) +async def test_list_constraints_async(request_type, transport: str = "grpc_asyncio"): client = OrgPolicyAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1423,7 +1445,7 @@ async def test_list_constraints_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_constraints), "__call__") as call: @@ -1446,11 +1468,6 @@ async def test_list_constraints_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_constraints_async_from_dict(): - await test_list_constraints_async(request_type=dict) - - def test_list_constraints_field_headers(): client = OrgPolicyClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1787,8 +1804,8 @@ async def test_list_constraints_async_pages(): @pytest.mark.parametrize( "request_type", [ - orgpolicy.ListPoliciesRequest, - dict, + orgpolicy.ListPoliciesRequest(), + {}, ], ) def test_list_policies(request_type, transport: str = "grpc"): @@ -1799,7 +1816,7 @@ def test_list_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(type(client.transport.list_policies), "__call__") as call: @@ -1844,10 +1861,11 @@ def test_list_policies_non_empty_request_with_auto_populated_field(): client.list_policies(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == orgpolicy.ListPoliciesRequest( + request_msg = orgpolicy.ListPoliciesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_policies_use_cached_wrapped_rpc(): @@ -1928,9 +1946,14 @@ async def test_list_policies_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_policies_async( - transport: str = "grpc_asyncio", request_type=orgpolicy.ListPoliciesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + orgpolicy.ListPoliciesRequest(), + {}, + ], +) +async def test_list_policies_async(request_type, transport: str = "grpc_asyncio"): client = OrgPolicyAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1938,7 +1961,7 @@ async def test_list_policies_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_policies), "__call__") as call: @@ -1961,11 +1984,6 @@ async def test_list_policies_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_policies_async_from_dict(): - await test_list_policies_async(request_type=dict) - - def test_list_policies_field_headers(): client = OrgPolicyClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2302,8 +2320,8 @@ async def test_list_policies_async_pages(): @pytest.mark.parametrize( "request_type", [ - orgpolicy.GetPolicyRequest, - dict, + orgpolicy.GetPolicyRequest(), + {}, ], ) def test_get_policy(request_type, transport: str = "grpc"): @@ -2314,7 +2332,7 @@ def test_get_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(type(client.transport.get_policy), "__call__") as call: @@ -2360,9 +2378,10 @@ def test_get_policy_non_empty_request_with_auto_populated_field(): client.get_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == orgpolicy.GetPolicyRequest( + request_msg = orgpolicy.GetPolicyRequest( name="name_value", ) + assert args[0] == request_msg def test_get_policy_use_cached_wrapped_rpc(): @@ -2441,9 +2460,14 @@ async def test_get_policy_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_policy_async( - transport: str = "grpc_asyncio", request_type=orgpolicy.GetPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + orgpolicy.GetPolicyRequest(), + {}, + ], +) +async def test_get_policy_async(request_type, transport: str = "grpc_asyncio"): client = OrgPolicyAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2451,7 +2475,7 @@ async def test_get_policy_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_policy), "__call__") as call: @@ -2476,11 +2500,6 @@ async def test_get_policy_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_policy_async_from_dict(): - await test_get_policy_async(request_type=dict) - - def test_get_policy_field_headers(): client = OrgPolicyClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2623,8 +2642,8 @@ async def test_get_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - orgpolicy.GetEffectivePolicyRequest, - dict, + orgpolicy.GetEffectivePolicyRequest(), + {}, ], ) def test_get_effective_policy(request_type, transport: str = "grpc"): @@ -2635,7 +2654,7 @@ def test_get_effective_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( @@ -2685,9 +2704,10 @@ def test_get_effective_policy_non_empty_request_with_auto_populated_field(): client.get_effective_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == orgpolicy.GetEffectivePolicyRequest( + request_msg = orgpolicy.GetEffectivePolicyRequest( name="name_value", ) + assert args[0] == request_msg def test_get_effective_policy_use_cached_wrapped_rpc(): @@ -2772,8 +2792,15 @@ async def test_get_effective_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + orgpolicy.GetEffectivePolicyRequest(), + {}, + ], +) async def test_get_effective_policy_async( - transport: str = "grpc_asyncio", request_type=orgpolicy.GetEffectivePolicyRequest + request_type, transport: str = "grpc_asyncio" ): client = OrgPolicyAsyncClient( credentials=async_anonymous_credentials(), @@ -2782,7 +2809,7 @@ async def test_get_effective_policy_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( @@ -2809,11 +2836,6 @@ async def test_get_effective_policy_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_effective_policy_async_from_dict(): - await test_get_effective_policy_async(request_type=dict) - - def test_get_effective_policy_field_headers(): client = OrgPolicyClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2964,8 +2986,8 @@ async def test_get_effective_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - orgpolicy.CreatePolicyRequest, - dict, + orgpolicy.CreatePolicyRequest(), + {}, ], ) def test_create_policy(request_type, transport: str = "grpc"): @@ -2976,7 +2998,7 @@ def test_create_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(type(client.transport.create_policy), "__call__") as call: @@ -3022,9 +3044,10 @@ def test_create_policy_non_empty_request_with_auto_populated_field(): client.create_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == orgpolicy.CreatePolicyRequest( + request_msg = orgpolicy.CreatePolicyRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_policy_use_cached_wrapped_rpc(): @@ -3105,9 +3128,14 @@ async def test_create_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_policy_async( - transport: str = "grpc_asyncio", request_type=orgpolicy.CreatePolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + orgpolicy.CreatePolicyRequest(), + {}, + ], +) +async def test_create_policy_async(request_type, transport: str = "grpc_asyncio"): client = OrgPolicyAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3115,7 +3143,7 @@ async def test_create_policy_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_policy), "__call__") as call: @@ -3140,11 +3168,6 @@ async def test_create_policy_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_create_policy_async_from_dict(): - await test_create_policy_async(request_type=dict) - - def test_create_policy_field_headers(): client = OrgPolicyClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3297,8 +3320,8 @@ async def test_create_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - orgpolicy.UpdatePolicyRequest, - dict, + orgpolicy.UpdatePolicyRequest(), + {}, ], ) def test_update_policy(request_type, transport: str = "grpc"): @@ -3309,7 +3332,7 @@ def test_update_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(type(client.transport.update_policy), "__call__") as call: @@ -3353,7 +3376,8 @@ def test_update_policy_non_empty_request_with_auto_populated_field(): client.update_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == orgpolicy.UpdatePolicyRequest() + request_msg = orgpolicy.UpdatePolicyRequest() + assert args[0] == request_msg def test_update_policy_use_cached_wrapped_rpc(): @@ -3434,9 +3458,14 @@ async def test_update_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_policy_async( - transport: str = "grpc_asyncio", request_type=orgpolicy.UpdatePolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + orgpolicy.UpdatePolicyRequest(), + {}, + ], +) +async def test_update_policy_async(request_type, transport: str = "grpc_asyncio"): client = OrgPolicyAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3444,7 +3473,7 @@ async def test_update_policy_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_policy), "__call__") as call: @@ -3469,11 +3498,6 @@ async def test_update_policy_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_update_policy_async_from_dict(): - await test_update_policy_async(request_type=dict) - - def test_update_policy_field_headers(): client = OrgPolicyClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3616,8 +3640,8 @@ async def test_update_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - orgpolicy.DeletePolicyRequest, - dict, + orgpolicy.DeletePolicyRequest(), + {}, ], ) def test_delete_policy(request_type, transport: str = "grpc"): @@ -3628,7 +3652,7 @@ def test_delete_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(type(client.transport.delete_policy), "__call__") as call: @@ -3670,10 +3694,11 @@ def test_delete_policy_non_empty_request_with_auto_populated_field(): client.delete_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == orgpolicy.DeletePolicyRequest( + request_msg = orgpolicy.DeletePolicyRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_policy_use_cached_wrapped_rpc(): @@ -3754,9 +3779,14 @@ async def test_delete_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_policy_async( - transport: str = "grpc_asyncio", request_type=orgpolicy.DeletePolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + orgpolicy.DeletePolicyRequest(), + {}, + ], +) +async def test_delete_policy_async(request_type, transport: str = "grpc_asyncio"): client = OrgPolicyAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3764,7 +3794,7 @@ async def test_delete_policy_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_policy), "__call__") as call: @@ -3782,11 +3812,6 @@ async def test_delete_policy_async( assert response is None -@pytest.mark.asyncio -async def test_delete_policy_async_from_dict(): - await test_delete_policy_async(request_type=dict) - - def test_delete_policy_field_headers(): client = OrgPolicyClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3929,8 +3954,8 @@ async def test_delete_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - orgpolicy.CreateCustomConstraintRequest, - dict, + orgpolicy.CreateCustomConstraintRequest(), + {}, ], ) def test_create_custom_constraint(request_type, transport: str = "grpc"): @@ -3941,7 +3966,7 @@ def test_create_custom_constraint(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4001,9 +4026,10 @@ def test_create_custom_constraint_non_empty_request_with_auto_populated_field(): client.create_custom_constraint(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == orgpolicy.CreateCustomConstraintRequest( + request_msg = orgpolicy.CreateCustomConstraintRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_custom_constraint_use_cached_wrapped_rpc(): @@ -4089,9 +4115,15 @@ async def test_create_custom_constraint_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + orgpolicy.CreateCustomConstraintRequest(), + {}, + ], +) async def test_create_custom_constraint_async( - transport: str = "grpc_asyncio", - request_type=orgpolicy.CreateCustomConstraintRequest, + request_type, transport: str = "grpc_asyncio" ): client = OrgPolicyAsyncClient( credentials=async_anonymous_credentials(), @@ -4100,7 +4132,7 @@ async def test_create_custom_constraint_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( @@ -4137,11 +4169,6 @@ async def test_create_custom_constraint_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_create_custom_constraint_async_from_dict(): - await test_create_custom_constraint_async(request_type=dict) - - def test_create_custom_constraint_field_headers(): client = OrgPolicyClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4306,8 +4333,8 @@ async def test_create_custom_constraint_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - orgpolicy.UpdateCustomConstraintRequest, - dict, + orgpolicy.UpdateCustomConstraintRequest(), + {}, ], ) def test_update_custom_constraint(request_type, transport: str = "grpc"): @@ -4318,7 +4345,7 @@ def test_update_custom_constraint(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4376,7 +4403,8 @@ def test_update_custom_constraint_non_empty_request_with_auto_populated_field(): client.update_custom_constraint(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == orgpolicy.UpdateCustomConstraintRequest() + request_msg = orgpolicy.UpdateCustomConstraintRequest() + assert args[0] == request_msg def test_update_custom_constraint_use_cached_wrapped_rpc(): @@ -4462,9 +4490,15 @@ async def test_update_custom_constraint_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + orgpolicy.UpdateCustomConstraintRequest(), + {}, + ], +) async def test_update_custom_constraint_async( - transport: str = "grpc_asyncio", - request_type=orgpolicy.UpdateCustomConstraintRequest, + request_type, transport: str = "grpc_asyncio" ): client = OrgPolicyAsyncClient( credentials=async_anonymous_credentials(), @@ -4473,7 +4507,7 @@ async def test_update_custom_constraint_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( @@ -4510,11 +4544,6 @@ async def test_update_custom_constraint_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_update_custom_constraint_async_from_dict(): - await test_update_custom_constraint_async(request_type=dict) - - def test_update_custom_constraint_field_headers(): client = OrgPolicyClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4669,8 +4698,8 @@ async def test_update_custom_constraint_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - orgpolicy.GetCustomConstraintRequest, - dict, + orgpolicy.GetCustomConstraintRequest(), + {}, ], ) def test_get_custom_constraint(request_type, transport: str = "grpc"): @@ -4681,7 +4710,7 @@ def test_get_custom_constraint(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4741,9 +4770,10 @@ def test_get_custom_constraint_non_empty_request_with_auto_populated_field(): client.get_custom_constraint(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == orgpolicy.GetCustomConstraintRequest( + request_msg = orgpolicy.GetCustomConstraintRequest( name="name_value", ) + assert args[0] == request_msg def test_get_custom_constraint_use_cached_wrapped_rpc(): @@ -4829,8 +4859,15 @@ async def test_get_custom_constraint_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + orgpolicy.GetCustomConstraintRequest(), + {}, + ], +) async def test_get_custom_constraint_async( - transport: str = "grpc_asyncio", request_type=orgpolicy.GetCustomConstraintRequest + request_type, transport: str = "grpc_asyncio" ): client = OrgPolicyAsyncClient( credentials=async_anonymous_credentials(), @@ -4839,7 +4876,7 @@ async def test_get_custom_constraint_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( @@ -4876,11 +4913,6 @@ async def test_get_custom_constraint_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_get_custom_constraint_async_from_dict(): - await test_get_custom_constraint_async(request_type=dict) - - def test_get_custom_constraint_field_headers(): client = OrgPolicyClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5035,8 +5067,8 @@ async def test_get_custom_constraint_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - orgpolicy.ListCustomConstraintsRequest, - dict, + orgpolicy.ListCustomConstraintsRequest(), + {}, ], ) def test_list_custom_constraints(request_type, transport: str = "grpc"): @@ -5047,7 +5079,7 @@ def test_list_custom_constraints(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5096,10 +5128,11 @@ def test_list_custom_constraints_non_empty_request_with_auto_populated_field(): client.list_custom_constraints(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == orgpolicy.ListCustomConstraintsRequest( + request_msg = orgpolicy.ListCustomConstraintsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_custom_constraints_use_cached_wrapped_rpc(): @@ -5185,8 +5218,15 @@ async def test_list_custom_constraints_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + orgpolicy.ListCustomConstraintsRequest(), + {}, + ], +) async def test_list_custom_constraints_async( - transport: str = "grpc_asyncio", request_type=orgpolicy.ListCustomConstraintsRequest + request_type, transport: str = "grpc_asyncio" ): client = OrgPolicyAsyncClient( credentials=async_anonymous_credentials(), @@ -5195,7 +5235,7 @@ async def test_list_custom_constraints_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( @@ -5220,11 +5260,6 @@ async def test_list_custom_constraints_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_custom_constraints_async_from_dict(): - await test_list_custom_constraints_async(request_type=dict) - - def test_list_custom_constraints_field_headers(): client = OrgPolicyClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5577,8 +5612,8 @@ async def test_list_custom_constraints_async_pages(): @pytest.mark.parametrize( "request_type", [ - orgpolicy.DeleteCustomConstraintRequest, - dict, + orgpolicy.DeleteCustomConstraintRequest(), + {}, ], ) def test_delete_custom_constraint(request_type, transport: str = "grpc"): @@ -5589,7 +5624,7 @@ def test_delete_custom_constraint(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5634,9 +5669,10 @@ def test_delete_custom_constraint_non_empty_request_with_auto_populated_field(): client.delete_custom_constraint(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == orgpolicy.DeleteCustomConstraintRequest( + request_msg = orgpolicy.DeleteCustomConstraintRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_custom_constraint_use_cached_wrapped_rpc(): @@ -5722,9 +5758,15 @@ async def test_delete_custom_constraint_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + orgpolicy.DeleteCustomConstraintRequest(), + {}, + ], +) async def test_delete_custom_constraint_async( - transport: str = "grpc_asyncio", - request_type=orgpolicy.DeleteCustomConstraintRequest, + request_type, transport: str = "grpc_asyncio" ): client = OrgPolicyAsyncClient( credentials=async_anonymous_credentials(), @@ -5733,7 +5775,7 @@ async def test_delete_custom_constraint_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( @@ -5753,11 +5795,6 @@ async def test_delete_custom_constraint_async( assert response is None -@pytest.mark.asyncio -async def test_delete_custom_constraint_async_from_dict(): - await test_delete_custom_constraint_async(request_type=dict) - - def test_delete_custom_constraint_field_headers(): client = OrgPolicyClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8412,7 +8449,6 @@ def test_list_constraints_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = orgpolicy.ListConstraintsRequest() - assert args[0] == request_msg @@ -8433,7 +8469,6 @@ def test_list_policies_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = orgpolicy.ListPoliciesRequest() - assert args[0] == request_msg @@ -8454,7 +8489,6 @@ def test_get_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = orgpolicy.GetPolicyRequest() - assert args[0] == request_msg @@ -8477,7 +8511,6 @@ def test_get_effective_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = orgpolicy.GetEffectivePolicyRequest() - assert args[0] == request_msg @@ -8498,7 +8531,6 @@ def test_create_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = orgpolicy.CreatePolicyRequest() - assert args[0] == request_msg @@ -8519,7 +8551,6 @@ def test_update_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = orgpolicy.UpdatePolicyRequest() - assert args[0] == request_msg @@ -8540,7 +8571,6 @@ def test_delete_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = orgpolicy.DeletePolicyRequest() - assert args[0] == request_msg @@ -8563,7 +8593,6 @@ def test_create_custom_constraint_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = orgpolicy.CreateCustomConstraintRequest() - assert args[0] == request_msg @@ -8586,7 +8615,6 @@ def test_update_custom_constraint_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = orgpolicy.UpdateCustomConstraintRequest() - assert args[0] == request_msg @@ -8609,7 +8637,6 @@ def test_get_custom_constraint_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = orgpolicy.GetCustomConstraintRequest() - assert args[0] == request_msg @@ -8632,7 +8659,6 @@ def test_list_custom_constraints_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = orgpolicy.ListCustomConstraintsRequest() - assert args[0] == request_msg @@ -8655,7 +8681,6 @@ def test_delete_custom_constraint_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = orgpolicy.DeleteCustomConstraintRequest() - assert args[0] == request_msg @@ -8696,7 +8721,6 @@ async def test_list_constraints_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = orgpolicy.ListConstraintsRequest() - assert args[0] == request_msg @@ -8723,7 +8747,6 @@ async def test_list_policies_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = orgpolicy.ListPoliciesRequest() - assert args[0] == request_msg @@ -8751,7 +8774,6 @@ async def test_get_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = orgpolicy.GetPolicyRequest() - assert args[0] == request_msg @@ -8781,7 +8803,6 @@ async def test_get_effective_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = orgpolicy.GetEffectivePolicyRequest() - assert args[0] == request_msg @@ -8809,7 +8830,6 @@ async def test_create_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = orgpolicy.CreatePolicyRequest() - assert args[0] == request_msg @@ -8837,7 +8857,6 @@ async def test_update_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = orgpolicy.UpdatePolicyRequest() - assert args[0] == request_msg @@ -8860,7 +8879,6 @@ async def test_delete_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = orgpolicy.DeletePolicyRequest() - assert args[0] == request_msg @@ -8895,7 +8913,6 @@ async def test_create_custom_constraint_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = orgpolicy.CreateCustomConstraintRequest() - assert args[0] == request_msg @@ -8930,7 +8947,6 @@ async def test_update_custom_constraint_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = orgpolicy.UpdateCustomConstraintRequest() - assert args[0] == request_msg @@ -8965,7 +8981,6 @@ async def test_get_custom_constraint_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = orgpolicy.GetCustomConstraintRequest() - assert args[0] == request_msg @@ -8994,7 +9009,6 @@ async def test_list_custom_constraints_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = orgpolicy.ListCustomConstraintsRequest() - assert args[0] == request_msg @@ -9019,7 +9033,6 @@ async def test_delete_custom_constraint_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = orgpolicy.DeleteCustomConstraintRequest() - assert args[0] == request_msg @@ -10959,7 +10972,6 @@ def test_list_constraints_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = orgpolicy.ListConstraintsRequest() - assert args[0] == request_msg @@ -10979,7 +10991,6 @@ def test_list_policies_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = orgpolicy.ListPoliciesRequest() - assert args[0] == request_msg @@ -10999,7 +11010,6 @@ def test_get_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = orgpolicy.GetPolicyRequest() - assert args[0] == request_msg @@ -11021,7 +11031,6 @@ def test_get_effective_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = orgpolicy.GetEffectivePolicyRequest() - assert args[0] == request_msg @@ -11041,7 +11050,6 @@ def test_create_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = orgpolicy.CreatePolicyRequest() - assert args[0] == request_msg @@ -11061,7 +11069,6 @@ def test_update_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = orgpolicy.UpdatePolicyRequest() - assert args[0] == request_msg @@ -11081,7 +11088,6 @@ def test_delete_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = orgpolicy.DeletePolicyRequest() - assert args[0] == request_msg @@ -11103,7 +11109,6 @@ def test_create_custom_constraint_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = orgpolicy.CreateCustomConstraintRequest() - assert args[0] == request_msg @@ -11125,7 +11130,6 @@ def test_update_custom_constraint_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = orgpolicy.UpdateCustomConstraintRequest() - assert args[0] == request_msg @@ -11147,7 +11151,6 @@ def test_get_custom_constraint_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = orgpolicy.GetCustomConstraintRequest() - assert args[0] == request_msg @@ -11169,7 +11172,6 @@ def test_list_custom_constraints_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = orgpolicy.ListCustomConstraintsRequest() - assert args[0] == request_msg @@ -11191,7 +11193,6 @@ def test_delete_custom_constraint_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = orgpolicy.DeleteCustomConstraintRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-os-config/noxfile.py b/packages/google-cloud-os-config/noxfile.py index eed72ef99055..5a23e3023a8b 100644 --- a/packages/google-cloud-os-config/noxfile.py +++ b/packages/google-cloud-os-config/noxfile.py @@ -47,7 +47,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-os-config" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-os-config/setup.py b/packages/google-cloud-os-config/setup.py index 45956481bb8b..8e3a7eabbf6e 100644 --- a/packages/google-cloud-os-config/setup.py +++ b/packages/google-cloud-os-config/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/google-cloud-os-config/testing/constraints-3.10.txt b/packages/google-cloud-os-config/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-os-config/testing/constraints-3.10.txt +++ b/packages/google-cloud-os-config/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-os-config/tests/unit/gapic/osconfig_v1/test_os_config_service.py b/packages/google-cloud-os-config/tests/unit/gapic/osconfig_v1/test_os_config_service.py index a386ddc4cef7..6cd822121c19 100644 --- a/packages/google-cloud-os-config/tests/unit/gapic/osconfig_v1/test_os_config_service.py +++ b/packages/google-cloud-os-config/tests/unit/gapic/osconfig_v1/test_os_config_service.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 @@ -117,6 +118,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" @@ -1344,8 +1360,8 @@ def test_os_config_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - patch_jobs.ExecutePatchJobRequest, - dict, + patch_jobs.ExecutePatchJobRequest(), + {}, ], ) def test_execute_patch_job(request_type, transport: str = "grpc"): @@ -1356,7 +1372,7 @@ def test_execute_patch_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( @@ -1420,11 +1436,12 @@ def test_execute_patch_job_non_empty_request_with_auto_populated_field(): client.execute_patch_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == patch_jobs.ExecutePatchJobRequest( + request_msg = patch_jobs.ExecutePatchJobRequest( parent="parent_value", description="description_value", display_name="display_name_value", ) + assert args[0] == request_msg def test_execute_patch_job_use_cached_wrapped_rpc(): @@ -1507,9 +1524,14 @@ async def test_execute_patch_job_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_execute_patch_job_async( - transport: str = "grpc_asyncio", request_type=patch_jobs.ExecutePatchJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + patch_jobs.ExecutePatchJobRequest(), + {}, + ], +) +async def test_execute_patch_job_async(request_type, transport: str = "grpc_asyncio"): client = OsConfigServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1517,7 +1539,7 @@ async def test_execute_patch_job_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( @@ -1556,11 +1578,6 @@ async def test_execute_patch_job_async( assert response.patch_deployment == "patch_deployment_value" -@pytest.mark.asyncio -async def test_execute_patch_job_async_from_dict(): - await test_execute_patch_job_async(request_type=dict) - - def test_execute_patch_job_field_headers(): client = OsConfigServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1627,8 +1644,8 @@ async def test_execute_patch_job_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - patch_jobs.GetPatchJobRequest, - dict, + patch_jobs.GetPatchJobRequest(), + {}, ], ) def test_get_patch_job(request_type, transport: str = "grpc"): @@ -1639,7 +1656,7 @@ def test_get_patch_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(type(client.transport.get_patch_job), "__call__") as call: @@ -1697,9 +1714,10 @@ def test_get_patch_job_non_empty_request_with_auto_populated_field(): client.get_patch_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == patch_jobs.GetPatchJobRequest( + request_msg = patch_jobs.GetPatchJobRequest( name="name_value", ) + assert args[0] == request_msg def test_get_patch_job_use_cached_wrapped_rpc(): @@ -1780,9 +1798,14 @@ async def test_get_patch_job_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_patch_job_async( - transport: str = "grpc_asyncio", request_type=patch_jobs.GetPatchJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + patch_jobs.GetPatchJobRequest(), + {}, + ], +) +async def test_get_patch_job_async(request_type, transport: str = "grpc_asyncio"): client = OsConfigServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1790,7 +1813,7 @@ async def test_get_patch_job_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_patch_job), "__call__") as call: @@ -1827,11 +1850,6 @@ async def test_get_patch_job_async( assert response.patch_deployment == "patch_deployment_value" -@pytest.mark.asyncio -async def test_get_patch_job_async_from_dict(): - await test_get_patch_job_async(request_type=dict) - - def test_get_patch_job_field_headers(): client = OsConfigServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1974,8 +1992,8 @@ async def test_get_patch_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - patch_jobs.CancelPatchJobRequest, - dict, + patch_jobs.CancelPatchJobRequest(), + {}, ], ) def test_cancel_patch_job(request_type, transport: str = "grpc"): @@ -1986,7 +2004,7 @@ def test_cancel_patch_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(type(client.transport.cancel_patch_job), "__call__") as call: @@ -2044,9 +2062,10 @@ def test_cancel_patch_job_non_empty_request_with_auto_populated_field(): client.cancel_patch_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == patch_jobs.CancelPatchJobRequest( + request_msg = patch_jobs.CancelPatchJobRequest( name="name_value", ) + assert args[0] == request_msg def test_cancel_patch_job_use_cached_wrapped_rpc(): @@ -2129,9 +2148,14 @@ async def test_cancel_patch_job_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_cancel_patch_job_async( - transport: str = "grpc_asyncio", request_type=patch_jobs.CancelPatchJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + patch_jobs.CancelPatchJobRequest(), + {}, + ], +) +async def test_cancel_patch_job_async(request_type, transport: str = "grpc_asyncio"): client = OsConfigServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2139,7 +2163,7 @@ async def test_cancel_patch_job_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.cancel_patch_job), "__call__") as call: @@ -2176,11 +2200,6 @@ async def test_cancel_patch_job_async( assert response.patch_deployment == "patch_deployment_value" -@pytest.mark.asyncio -async def test_cancel_patch_job_async_from_dict(): - await test_cancel_patch_job_async(request_type=dict) - - def test_cancel_patch_job_field_headers(): client = OsConfigServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2243,8 +2262,8 @@ async def test_cancel_patch_job_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - patch_jobs.ListPatchJobsRequest, - dict, + patch_jobs.ListPatchJobsRequest(), + {}, ], ) def test_list_patch_jobs(request_type, transport: str = "grpc"): @@ -2255,7 +2274,7 @@ def test_list_patch_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(type(client.transport.list_patch_jobs), "__call__") as call: @@ -2301,11 +2320,12 @@ def test_list_patch_jobs_non_empty_request_with_auto_populated_field(): client.list_patch_jobs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == patch_jobs.ListPatchJobsRequest( + request_msg = patch_jobs.ListPatchJobsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_patch_jobs_use_cached_wrapped_rpc(): @@ -2386,9 +2406,14 @@ async def test_list_patch_jobs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_patch_jobs_async( - transport: str = "grpc_asyncio", request_type=patch_jobs.ListPatchJobsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + patch_jobs.ListPatchJobsRequest(), + {}, + ], +) +async def test_list_patch_jobs_async(request_type, transport: str = "grpc_asyncio"): client = OsConfigServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2396,7 +2421,7 @@ async def test_list_patch_jobs_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_patch_jobs), "__call__") as call: @@ -2419,11 +2444,6 @@ async def test_list_patch_jobs_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_patch_jobs_async_from_dict(): - await test_list_patch_jobs_async(request_type=dict) - - def test_list_patch_jobs_field_headers(): client = OsConfigServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2760,8 +2780,8 @@ async def test_list_patch_jobs_async_pages(): @pytest.mark.parametrize( "request_type", [ - patch_jobs.ListPatchJobInstanceDetailsRequest, - dict, + patch_jobs.ListPatchJobInstanceDetailsRequest(), + {}, ], ) def test_list_patch_job_instance_details(request_type, transport: str = "grpc"): @@ -2772,7 +2792,7 @@ def test_list_patch_job_instance_details(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2822,11 +2842,12 @@ def test_list_patch_job_instance_details_non_empty_request_with_auto_populated_f client.list_patch_job_instance_details(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == patch_jobs.ListPatchJobInstanceDetailsRequest( + request_msg = patch_jobs.ListPatchJobInstanceDetailsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_patch_job_instance_details_use_cached_wrapped_rpc(): @@ -2912,9 +2933,15 @@ async def test_list_patch_job_instance_details_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + patch_jobs.ListPatchJobInstanceDetailsRequest(), + {}, + ], +) async def test_list_patch_job_instance_details_async( - transport: str = "grpc_asyncio", - request_type=patch_jobs.ListPatchJobInstanceDetailsRequest, + request_type, transport: str = "grpc_asyncio" ): client = OsConfigServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2923,7 +2950,7 @@ async def test_list_patch_job_instance_details_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( @@ -2948,11 +2975,6 @@ async def test_list_patch_job_instance_details_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_patch_job_instance_details_async_from_dict(): - await test_list_patch_job_instance_details_async(request_type=dict) - - def test_list_patch_job_instance_details_field_headers(): client = OsConfigServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3309,8 +3331,8 @@ async def test_list_patch_job_instance_details_async_pages(): @pytest.mark.parametrize( "request_type", [ - patch_deployments.CreatePatchDeploymentRequest, - dict, + patch_deployments.CreatePatchDeploymentRequest(), + {}, ], ) def test_create_patch_deployment(request_type, transport: str = "grpc"): @@ -3321,7 +3343,7 @@ def test_create_patch_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,10 +3396,11 @@ def test_create_patch_deployment_non_empty_request_with_auto_populated_field(): client.create_patch_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == patch_deployments.CreatePatchDeploymentRequest( + request_msg = patch_deployments.CreatePatchDeploymentRequest( parent="parent_value", patch_deployment_id="patch_deployment_id_value", ) + assert args[0] == request_msg def test_create_patch_deployment_use_cached_wrapped_rpc(): @@ -3463,9 +3486,15 @@ async def test_create_patch_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + patch_deployments.CreatePatchDeploymentRequest(), + {}, + ], +) async def test_create_patch_deployment_async( - transport: str = "grpc_asyncio", - request_type=patch_deployments.CreatePatchDeploymentRequest, + request_type, transport: str = "grpc_asyncio" ): client = OsConfigServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3474,7 +3503,7 @@ async def test_create_patch_deployment_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( @@ -3503,11 +3532,6 @@ async def test_create_patch_deployment_async( assert response.state == patch_deployments.PatchDeployment.State.ACTIVE -@pytest.mark.asyncio -async def test_create_patch_deployment_async_from_dict(): - await test_create_patch_deployment_async(request_type=dict) - - def test_create_patch_deployment_field_headers(): client = OsConfigServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3682,8 +3706,8 @@ async def test_create_patch_deployment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - patch_deployments.GetPatchDeploymentRequest, - dict, + patch_deployments.GetPatchDeploymentRequest(), + {}, ], ) def test_get_patch_deployment(request_type, transport: str = "grpc"): @@ -3694,7 +3718,7 @@ def test_get_patch_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3746,9 +3770,10 @@ def test_get_patch_deployment_non_empty_request_with_auto_populated_field(): client.get_patch_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == patch_deployments.GetPatchDeploymentRequest( + request_msg = patch_deployments.GetPatchDeploymentRequest( name="name_value", ) + assert args[0] == request_msg def test_get_patch_deployment_use_cached_wrapped_rpc(): @@ -3833,9 +3858,15 @@ async def test_get_patch_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + patch_deployments.GetPatchDeploymentRequest(), + {}, + ], +) async def test_get_patch_deployment_async( - transport: str = "grpc_asyncio", - request_type=patch_deployments.GetPatchDeploymentRequest, + request_type, transport: str = "grpc_asyncio" ): client = OsConfigServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3844,7 +3875,7 @@ async def test_get_patch_deployment_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( @@ -3873,11 +3904,6 @@ async def test_get_patch_deployment_async( assert response.state == patch_deployments.PatchDeployment.State.ACTIVE -@pytest.mark.asyncio -async def test_get_patch_deployment_async_from_dict(): - await test_get_patch_deployment_async(request_type=dict) - - def test_get_patch_deployment_field_headers(): client = OsConfigServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4032,8 +4058,8 @@ async def test_get_patch_deployment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - patch_deployments.ListPatchDeploymentsRequest, - dict, + patch_deployments.ListPatchDeploymentsRequest(), + {}, ], ) def test_list_patch_deployments(request_type, transport: str = "grpc"): @@ -4044,7 +4070,7 @@ def test_list_patch_deployments(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4093,10 +4119,11 @@ def test_list_patch_deployments_non_empty_request_with_auto_populated_field(): client.list_patch_deployments(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == patch_deployments.ListPatchDeploymentsRequest( + request_msg = patch_deployments.ListPatchDeploymentsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_patch_deployments_use_cached_wrapped_rpc(): @@ -4182,9 +4209,15 @@ async def test_list_patch_deployments_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + patch_deployments.ListPatchDeploymentsRequest(), + {}, + ], +) async def test_list_patch_deployments_async( - transport: str = "grpc_asyncio", - request_type=patch_deployments.ListPatchDeploymentsRequest, + request_type, transport: str = "grpc_asyncio" ): client = OsConfigServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4193,7 +4226,7 @@ async def test_list_patch_deployments_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( @@ -4218,11 +4251,6 @@ async def test_list_patch_deployments_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_patch_deployments_async_from_dict(): - await test_list_patch_deployments_async(request_type=dict) - - def test_list_patch_deployments_field_headers(): client = OsConfigServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4575,8 +4603,8 @@ async def test_list_patch_deployments_async_pages(): @pytest.mark.parametrize( "request_type", [ - patch_deployments.DeletePatchDeploymentRequest, - dict, + patch_deployments.DeletePatchDeploymentRequest(), + {}, ], ) def test_delete_patch_deployment(request_type, transport: str = "grpc"): @@ -4587,7 +4615,7 @@ def test_delete_patch_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4632,9 +4660,10 @@ def test_delete_patch_deployment_non_empty_request_with_auto_populated_field(): client.delete_patch_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == patch_deployments.DeletePatchDeploymentRequest( + request_msg = patch_deployments.DeletePatchDeploymentRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_patch_deployment_use_cached_wrapped_rpc(): @@ -4720,9 +4749,15 @@ async def test_delete_patch_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + patch_deployments.DeletePatchDeploymentRequest(), + {}, + ], +) async def test_delete_patch_deployment_async( - transport: str = "grpc_asyncio", - request_type=patch_deployments.DeletePatchDeploymentRequest, + request_type, transport: str = "grpc_asyncio" ): client = OsConfigServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4731,7 +4766,7 @@ async def test_delete_patch_deployment_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( @@ -4751,11 +4786,6 @@ async def test_delete_patch_deployment_async( assert response is None -@pytest.mark.asyncio -async def test_delete_patch_deployment_async_from_dict(): - await test_delete_patch_deployment_async(request_type=dict) - - def test_delete_patch_deployment_field_headers(): client = OsConfigServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4906,8 +4936,8 @@ async def test_delete_patch_deployment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - patch_deployments.UpdatePatchDeploymentRequest, - dict, + patch_deployments.UpdatePatchDeploymentRequest(), + {}, ], ) def test_update_patch_deployment(request_type, transport: str = "grpc"): @@ -4918,7 +4948,7 @@ def test_update_patch_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4968,7 +4998,8 @@ def test_update_patch_deployment_non_empty_request_with_auto_populated_field(): client.update_patch_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == patch_deployments.UpdatePatchDeploymentRequest() + request_msg = patch_deployments.UpdatePatchDeploymentRequest() + assert args[0] == request_msg def test_update_patch_deployment_use_cached_wrapped_rpc(): @@ -5054,9 +5085,15 @@ async def test_update_patch_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + patch_deployments.UpdatePatchDeploymentRequest(), + {}, + ], +) async def test_update_patch_deployment_async( - transport: str = "grpc_asyncio", - request_type=patch_deployments.UpdatePatchDeploymentRequest, + request_type, transport: str = "grpc_asyncio" ): client = OsConfigServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5065,7 +5102,7 @@ async def test_update_patch_deployment_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( @@ -5094,11 +5131,6 @@ async def test_update_patch_deployment_async( assert response.state == patch_deployments.PatchDeployment.State.ACTIVE -@pytest.mark.asyncio -async def test_update_patch_deployment_async_from_dict(): - await test_update_patch_deployment_async(request_type=dict) - - def test_update_patch_deployment_field_headers(): client = OsConfigServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5263,8 +5295,8 @@ async def test_update_patch_deployment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - patch_deployments.PausePatchDeploymentRequest, - dict, + patch_deployments.PausePatchDeploymentRequest(), + {}, ], ) def test_pause_patch_deployment(request_type, transport: str = "grpc"): @@ -5275,7 +5307,7 @@ def test_pause_patch_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5327,9 +5359,10 @@ def test_pause_patch_deployment_non_empty_request_with_auto_populated_field(): client.pause_patch_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == patch_deployments.PausePatchDeploymentRequest( + request_msg = patch_deployments.PausePatchDeploymentRequest( name="name_value", ) + assert args[0] == request_msg def test_pause_patch_deployment_use_cached_wrapped_rpc(): @@ -5415,9 +5448,15 @@ async def test_pause_patch_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + patch_deployments.PausePatchDeploymentRequest(), + {}, + ], +) async def test_pause_patch_deployment_async( - transport: str = "grpc_asyncio", - request_type=patch_deployments.PausePatchDeploymentRequest, + request_type, transport: str = "grpc_asyncio" ): client = OsConfigServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5426,7 +5465,7 @@ async def test_pause_patch_deployment_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( @@ -5455,11 +5494,6 @@ async def test_pause_patch_deployment_async( assert response.state == patch_deployments.PatchDeployment.State.ACTIVE -@pytest.mark.asyncio -async def test_pause_patch_deployment_async_from_dict(): - await test_pause_patch_deployment_async(request_type=dict) - - def test_pause_patch_deployment_field_headers(): client = OsConfigServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5614,8 +5648,8 @@ async def test_pause_patch_deployment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - patch_deployments.ResumePatchDeploymentRequest, - dict, + patch_deployments.ResumePatchDeploymentRequest(), + {}, ], ) def test_resume_patch_deployment(request_type, transport: str = "grpc"): @@ -5626,7 +5660,7 @@ def test_resume_patch_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5678,9 +5712,10 @@ def test_resume_patch_deployment_non_empty_request_with_auto_populated_field(): client.resume_patch_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == patch_deployments.ResumePatchDeploymentRequest( + request_msg = patch_deployments.ResumePatchDeploymentRequest( name="name_value", ) + assert args[0] == request_msg def test_resume_patch_deployment_use_cached_wrapped_rpc(): @@ -5766,9 +5801,15 @@ async def test_resume_patch_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + patch_deployments.ResumePatchDeploymentRequest(), + {}, + ], +) async def test_resume_patch_deployment_async( - transport: str = "grpc_asyncio", - request_type=patch_deployments.ResumePatchDeploymentRequest, + request_type, transport: str = "grpc_asyncio" ): client = OsConfigServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5777,7 +5818,7 @@ async def test_resume_patch_deployment_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( @@ -5806,11 +5847,6 @@ async def test_resume_patch_deployment_async( assert response.state == patch_deployments.PatchDeployment.State.ACTIVE -@pytest.mark.asyncio -async def test_resume_patch_deployment_async_from_dict(): - await test_resume_patch_deployment_async(request_type=dict) - - def test_resume_patch_deployment_field_headers(): client = OsConfigServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8421,7 +8457,6 @@ def test_execute_patch_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = patch_jobs.ExecutePatchJobRequest() - assert args[0] == request_msg @@ -8442,7 +8477,6 @@ def test_get_patch_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = patch_jobs.GetPatchJobRequest() - assert args[0] == request_msg @@ -8463,7 +8497,6 @@ def test_cancel_patch_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = patch_jobs.CancelPatchJobRequest() - assert args[0] == request_msg @@ -8484,7 +8517,6 @@ def test_list_patch_jobs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = patch_jobs.ListPatchJobsRequest() - assert args[0] == request_msg @@ -8507,7 +8539,6 @@ def test_list_patch_job_instance_details_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = patch_jobs.ListPatchJobInstanceDetailsRequest() - assert args[0] == request_msg @@ -8530,7 +8561,6 @@ def test_create_patch_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = patch_deployments.CreatePatchDeploymentRequest() - assert args[0] == request_msg @@ -8553,7 +8583,6 @@ def test_get_patch_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = patch_deployments.GetPatchDeploymentRequest() - assert args[0] == request_msg @@ -8576,7 +8605,6 @@ def test_list_patch_deployments_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = patch_deployments.ListPatchDeploymentsRequest() - assert args[0] == request_msg @@ -8599,7 +8627,6 @@ def test_delete_patch_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = patch_deployments.DeletePatchDeploymentRequest() - assert args[0] == request_msg @@ -8622,7 +8649,6 @@ def test_update_patch_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = patch_deployments.UpdatePatchDeploymentRequest() - assert args[0] == request_msg @@ -8645,7 +8671,6 @@ def test_pause_patch_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = patch_deployments.PausePatchDeploymentRequest() - assert args[0] == request_msg @@ -8668,7 +8693,6 @@ def test_resume_patch_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = patch_deployments.ResumePatchDeploymentRequest() - assert args[0] == request_msg @@ -8718,7 +8742,6 @@ async def test_execute_patch_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = patch_jobs.ExecutePatchJobRequest() - assert args[0] == request_msg @@ -8752,7 +8775,6 @@ async def test_get_patch_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = patch_jobs.GetPatchJobRequest() - assert args[0] == request_msg @@ -8786,7 +8808,6 @@ async def test_cancel_patch_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = patch_jobs.CancelPatchJobRequest() - assert args[0] == request_msg @@ -8813,7 +8834,6 @@ async def test_list_patch_jobs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = patch_jobs.ListPatchJobsRequest() - assert args[0] == request_msg @@ -8842,7 +8862,6 @@ async def test_list_patch_job_instance_details_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = patch_jobs.ListPatchJobInstanceDetailsRequest() - assert args[0] == request_msg @@ -8873,7 +8892,6 @@ async def test_create_patch_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = patch_deployments.CreatePatchDeploymentRequest() - assert args[0] == request_msg @@ -8904,7 +8922,6 @@ async def test_get_patch_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = patch_deployments.GetPatchDeploymentRequest() - assert args[0] == request_msg @@ -8933,7 +8950,6 @@ async def test_list_patch_deployments_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = patch_deployments.ListPatchDeploymentsRequest() - assert args[0] == request_msg @@ -8958,7 +8974,6 @@ async def test_delete_patch_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = patch_deployments.DeletePatchDeploymentRequest() - assert args[0] == request_msg @@ -8989,7 +9004,6 @@ async def test_update_patch_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = patch_deployments.UpdatePatchDeploymentRequest() - assert args[0] == request_msg @@ -9020,7 +9034,6 @@ async def test_pause_patch_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = patch_deployments.PausePatchDeploymentRequest() - assert args[0] == request_msg @@ -9051,7 +9064,6 @@ async def test_resume_patch_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = patch_deployments.ResumePatchDeploymentRequest() - assert args[0] == request_msg @@ -11048,7 +11060,6 @@ def test_execute_patch_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = patch_jobs.ExecutePatchJobRequest() - assert args[0] == request_msg @@ -11068,7 +11079,6 @@ def test_get_patch_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = patch_jobs.GetPatchJobRequest() - assert args[0] == request_msg @@ -11088,7 +11098,6 @@ def test_cancel_patch_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = patch_jobs.CancelPatchJobRequest() - assert args[0] == request_msg @@ -11108,7 +11117,6 @@ def test_list_patch_jobs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = patch_jobs.ListPatchJobsRequest() - assert args[0] == request_msg @@ -11130,7 +11138,6 @@ def test_list_patch_job_instance_details_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = patch_jobs.ListPatchJobInstanceDetailsRequest() - assert args[0] == request_msg @@ -11152,7 +11159,6 @@ def test_create_patch_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = patch_deployments.CreatePatchDeploymentRequest() - assert args[0] == request_msg @@ -11174,7 +11180,6 @@ def test_get_patch_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = patch_deployments.GetPatchDeploymentRequest() - assert args[0] == request_msg @@ -11196,7 +11201,6 @@ def test_list_patch_deployments_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = patch_deployments.ListPatchDeploymentsRequest() - assert args[0] == request_msg @@ -11218,7 +11222,6 @@ def test_delete_patch_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = patch_deployments.DeletePatchDeploymentRequest() - assert args[0] == request_msg @@ -11240,7 +11243,6 @@ def test_update_patch_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = patch_deployments.UpdatePatchDeploymentRequest() - assert args[0] == request_msg @@ -11262,7 +11264,6 @@ def test_pause_patch_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = patch_deployments.PausePatchDeploymentRequest() - assert args[0] == request_msg @@ -11284,7 +11285,6 @@ def test_resume_patch_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = patch_deployments.ResumePatchDeploymentRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-os-config/tests/unit/gapic/osconfig_v1/test_os_config_zonal_service.py b/packages/google-cloud-os-config/tests/unit/gapic/osconfig_v1/test_os_config_zonal_service.py index f4a163b42587..54e094026d0c 100644 --- a/packages/google-cloud-os-config/tests/unit/gapic/osconfig_v1/test_os_config_zonal_service.py +++ b/packages/google-cloud-os-config/tests/unit/gapic/osconfig_v1/test_os_config_zonal_service.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 @@ -123,6 +124,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" @@ -1386,8 +1402,8 @@ def test_os_config_zonal_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - os_policy_assignments.CreateOSPolicyAssignmentRequest, - dict, + os_policy_assignments.CreateOSPolicyAssignmentRequest(), + {}, ], ) def test_create_os_policy_assignment(request_type, transport: str = "grpc"): @@ -1398,7 +1414,7 @@ def test_create_os_policy_assignment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1444,10 +1460,11 @@ def test_create_os_policy_assignment_non_empty_request_with_auto_populated_field client.create_os_policy_assignment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == os_policy_assignments.CreateOSPolicyAssignmentRequest( + request_msg = os_policy_assignments.CreateOSPolicyAssignmentRequest( parent="parent_value", os_policy_assignment_id="os_policy_assignment_id_value", ) + assert args[0] == request_msg def test_create_os_policy_assignment_use_cached_wrapped_rpc(): @@ -1543,9 +1560,15 @@ async def test_create_os_policy_assignment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + os_policy_assignments.CreateOSPolicyAssignmentRequest(), + {}, + ], +) async def test_create_os_policy_assignment_async( - transport: str = "grpc_asyncio", - request_type=os_policy_assignments.CreateOSPolicyAssignmentRequest, + request_type, transport: str = "grpc_asyncio" ): client = OsConfigZonalServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1554,7 +1577,7 @@ async def test_create_os_policy_assignment_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( @@ -1576,11 +1599,6 @@ async def test_create_os_policy_assignment_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_os_policy_assignment_async_from_dict(): - await test_create_os_policy_assignment_async(request_type=dict) - - def test_create_os_policy_assignment_field_headers(): client = OsConfigZonalServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1763,8 +1781,8 @@ async def test_create_os_policy_assignment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - os_policy_assignments.UpdateOSPolicyAssignmentRequest, - dict, + os_policy_assignments.UpdateOSPolicyAssignmentRequest(), + {}, ], ) def test_update_os_policy_assignment(request_type, transport: str = "grpc"): @@ -1775,7 +1793,7 @@ def test_update_os_policy_assignment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,7 +1836,8 @@ def test_update_os_policy_assignment_non_empty_request_with_auto_populated_field client.update_os_policy_assignment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == os_policy_assignments.UpdateOSPolicyAssignmentRequest() + request_msg = os_policy_assignments.UpdateOSPolicyAssignmentRequest() + assert args[0] == request_msg def test_update_os_policy_assignment_use_cached_wrapped_rpc(): @@ -1914,9 +1933,15 @@ async def test_update_os_policy_assignment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + os_policy_assignments.UpdateOSPolicyAssignmentRequest(), + {}, + ], +) async def test_update_os_policy_assignment_async( - transport: str = "grpc_asyncio", - request_type=os_policy_assignments.UpdateOSPolicyAssignmentRequest, + request_type, transport: str = "grpc_asyncio" ): client = OsConfigZonalServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1925,7 +1950,7 @@ async def test_update_os_policy_assignment_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( @@ -1947,11 +1972,6 @@ async def test_update_os_policy_assignment_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_os_policy_assignment_async_from_dict(): - await test_update_os_policy_assignment_async(request_type=dict) - - def test_update_os_policy_assignment_field_headers(): client = OsConfigZonalServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2124,8 +2144,8 @@ async def test_update_os_policy_assignment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - os_policy_assignments.GetOSPolicyAssignmentRequest, - dict, + os_policy_assignments.GetOSPolicyAssignmentRequest(), + {}, ], ) def test_get_os_policy_assignment(request_type, transport: str = "grpc"): @@ -2136,7 +2156,7 @@ def test_get_os_policy_assignment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2203,9 +2223,10 @@ def test_get_os_policy_assignment_non_empty_request_with_auto_populated_field(): client.get_os_policy_assignment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == os_policy_assignments.GetOSPolicyAssignmentRequest( + request_msg = os_policy_assignments.GetOSPolicyAssignmentRequest( name="name_value", ) + assert args[0] == request_msg def test_get_os_policy_assignment_use_cached_wrapped_rpc(): @@ -2291,9 +2312,15 @@ async def test_get_os_policy_assignment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + os_policy_assignments.GetOSPolicyAssignmentRequest(), + {}, + ], +) async def test_get_os_policy_assignment_async( - transport: str = "grpc_asyncio", - request_type=os_policy_assignments.GetOSPolicyAssignmentRequest, + request_type, transport: str = "grpc_asyncio" ): client = OsConfigZonalServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2302,7 +2329,7 @@ async def test_get_os_policy_assignment_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( @@ -2346,11 +2373,6 @@ async def test_get_os_policy_assignment_async( assert response.uid == "uid_value" -@pytest.mark.asyncio -async def test_get_os_policy_assignment_async_from_dict(): - await test_get_os_policy_assignment_async(request_type=dict) - - def test_get_os_policy_assignment_field_headers(): client = OsConfigZonalServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2505,8 +2527,8 @@ async def test_get_os_policy_assignment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - os_policy_assignments.ListOSPolicyAssignmentsRequest, - dict, + os_policy_assignments.ListOSPolicyAssignmentsRequest(), + {}, ], ) def test_list_os_policy_assignments(request_type, transport: str = "grpc"): @@ -2517,7 +2539,7 @@ def test_list_os_policy_assignments(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2566,10 +2588,11 @@ def test_list_os_policy_assignments_non_empty_request_with_auto_populated_field( client.list_os_policy_assignments(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == os_policy_assignments.ListOSPolicyAssignmentsRequest( + request_msg = os_policy_assignments.ListOSPolicyAssignmentsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_os_policy_assignments_use_cached_wrapped_rpc(): @@ -2655,9 +2678,15 @@ async def test_list_os_policy_assignments_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + os_policy_assignments.ListOSPolicyAssignmentsRequest(), + {}, + ], +) async def test_list_os_policy_assignments_async( - transport: str = "grpc_asyncio", - request_type=os_policy_assignments.ListOSPolicyAssignmentsRequest, + request_type, transport: str = "grpc_asyncio" ): client = OsConfigZonalServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2666,7 +2695,7 @@ async def test_list_os_policy_assignments_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( @@ -2691,11 +2720,6 @@ async def test_list_os_policy_assignments_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_os_policy_assignments_async_from_dict(): - await test_list_os_policy_assignments_async(request_type=dict) - - def test_list_os_policy_assignments_field_headers(): client = OsConfigZonalServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3054,8 +3078,8 @@ async def test_list_os_policy_assignments_async_pages(): @pytest.mark.parametrize( "request_type", [ - os_policy_assignments.ListOSPolicyAssignmentRevisionsRequest, - dict, + os_policy_assignments.ListOSPolicyAssignmentRevisionsRequest(), + {}, ], ) def test_list_os_policy_assignment_revisions(request_type, transport: str = "grpc"): @@ -3066,7 +3090,7 @@ def test_list_os_policy_assignment_revisions(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( @@ -3117,10 +3141,11 @@ def test_list_os_policy_assignment_revisions_non_empty_request_with_auto_populat client.list_os_policy_assignment_revisions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == os_policy_assignments.ListOSPolicyAssignmentRevisionsRequest( + request_msg = os_policy_assignments.ListOSPolicyAssignmentRevisionsRequest( name="name_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_os_policy_assignment_revisions_use_cached_wrapped_rpc(): @@ -3206,9 +3231,15 @@ async def test_list_os_policy_assignment_revisions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + os_policy_assignments.ListOSPolicyAssignmentRevisionsRequest(), + {}, + ], +) async def test_list_os_policy_assignment_revisions_async( - transport: str = "grpc_asyncio", - request_type=os_policy_assignments.ListOSPolicyAssignmentRevisionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = OsConfigZonalServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3217,7 +3248,7 @@ async def test_list_os_policy_assignment_revisions_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( @@ -3242,11 +3273,6 @@ async def test_list_os_policy_assignment_revisions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_os_policy_assignment_revisions_async_from_dict(): - await test_list_os_policy_assignment_revisions_async(request_type=dict) - - def test_list_os_policy_assignment_revisions_field_headers(): client = OsConfigZonalServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3613,8 +3639,8 @@ async def test_list_os_policy_assignment_revisions_async_pages(): @pytest.mark.parametrize( "request_type", [ - os_policy_assignments.DeleteOSPolicyAssignmentRequest, - dict, + os_policy_assignments.DeleteOSPolicyAssignmentRequest(), + {}, ], ) def test_delete_os_policy_assignment(request_type, transport: str = "grpc"): @@ -3625,7 +3651,7 @@ def test_delete_os_policy_assignment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3670,9 +3696,10 @@ def test_delete_os_policy_assignment_non_empty_request_with_auto_populated_field client.delete_os_policy_assignment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == os_policy_assignments.DeleteOSPolicyAssignmentRequest( + request_msg = os_policy_assignments.DeleteOSPolicyAssignmentRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_os_policy_assignment_use_cached_wrapped_rpc(): @@ -3768,9 +3795,15 @@ async def test_delete_os_policy_assignment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + os_policy_assignments.DeleteOSPolicyAssignmentRequest(), + {}, + ], +) async def test_delete_os_policy_assignment_async( - transport: str = "grpc_asyncio", - request_type=os_policy_assignments.DeleteOSPolicyAssignmentRequest, + request_type, transport: str = "grpc_asyncio" ): client = OsConfigZonalServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3779,7 +3812,7 @@ async def test_delete_os_policy_assignment_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( @@ -3801,11 +3834,6 @@ async def test_delete_os_policy_assignment_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_os_policy_assignment_async_from_dict(): - await test_delete_os_policy_assignment_async(request_type=dict) - - def test_delete_os_policy_assignment_field_headers(): client = OsConfigZonalServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3960,8 +3988,8 @@ async def test_delete_os_policy_assignment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - os_policy_assignment_reports.GetOSPolicyAssignmentReportRequest, - dict, + os_policy_assignment_reports.GetOSPolicyAssignmentReportRequest(), + {}, ], ) def test_get_os_policy_assignment_report(request_type, transport: str = "grpc"): @@ -3972,7 +4000,7 @@ def test_get_os_policy_assignment_report(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4026,11 +4054,10 @@ def test_get_os_policy_assignment_report_non_empty_request_with_auto_populated_f client.get_os_policy_assignment_report(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == os_policy_assignment_reports.GetOSPolicyAssignmentReportRequest( + request_msg = os_policy_assignment_reports.GetOSPolicyAssignmentReportRequest( name="name_value", ) + assert args[0] == request_msg def test_get_os_policy_assignment_report_use_cached_wrapped_rpc(): @@ -4116,9 +4143,15 @@ async def test_get_os_policy_assignment_report_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + os_policy_assignment_reports.GetOSPolicyAssignmentReportRequest(), + {}, + ], +) async def test_get_os_policy_assignment_report_async( - transport: str = "grpc_asyncio", - request_type=os_policy_assignment_reports.GetOSPolicyAssignmentReportRequest, + request_type, transport: str = "grpc_asyncio" ): client = OsConfigZonalServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4127,7 +4160,7 @@ async def test_get_os_policy_assignment_report_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( @@ -4158,11 +4191,6 @@ async def test_get_os_policy_assignment_report_async( assert response.last_run_id == "last_run_id_value" -@pytest.mark.asyncio -async def test_get_os_policy_assignment_report_async_from_dict(): - await test_get_os_policy_assignment_report_async(request_type=dict) - - def test_get_os_policy_assignment_report_field_headers(): client = OsConfigZonalServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4317,8 +4345,8 @@ async def test_get_os_policy_assignment_report_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - os_policy_assignment_reports.ListOSPolicyAssignmentReportsRequest, - dict, + os_policy_assignment_reports.ListOSPolicyAssignmentReportsRequest(), + {}, ], ) def test_list_os_policy_assignment_reports(request_type, transport: str = "grpc"): @@ -4329,7 +4357,7 @@ def test_list_os_policy_assignment_reports(request_type, transport: str = "grpc" # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4381,13 +4409,12 @@ def test_list_os_policy_assignment_reports_non_empty_request_with_auto_populated client.list_os_policy_assignment_reports(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == os_policy_assignment_reports.ListOSPolicyAssignmentReportsRequest( + request_msg = os_policy_assignment_reports.ListOSPolicyAssignmentReportsRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_os_policy_assignment_reports_use_cached_wrapped_rpc(): @@ -4473,9 +4500,15 @@ async def test_list_os_policy_assignment_reports_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + os_policy_assignment_reports.ListOSPolicyAssignmentReportsRequest(), + {}, + ], +) async def test_list_os_policy_assignment_reports_async( - transport: str = "grpc_asyncio", - request_type=os_policy_assignment_reports.ListOSPolicyAssignmentReportsRequest, + request_type, transport: str = "grpc_asyncio" ): client = OsConfigZonalServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4484,7 +4517,7 @@ async def test_list_os_policy_assignment_reports_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( @@ -4509,11 +4542,6 @@ async def test_list_os_policy_assignment_reports_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_os_policy_assignment_reports_async_from_dict(): - await test_list_os_policy_assignment_reports_async(request_type=dict) - - def test_list_os_policy_assignment_reports_field_headers(): client = OsConfigZonalServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4882,8 +4910,8 @@ async def test_list_os_policy_assignment_reports_async_pages(): @pytest.mark.parametrize( "request_type", [ - inventory.GetInventoryRequest, - dict, + inventory.GetInventoryRequest(), + {}, ], ) def test_get_inventory(request_type, transport: str = "grpc"): @@ -4894,7 +4922,7 @@ def test_get_inventory(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_inventory), "__call__") as call: @@ -4938,9 +4966,10 @@ def test_get_inventory_non_empty_request_with_auto_populated_field(): client.get_inventory(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == inventory.GetInventoryRequest( + request_msg = inventory.GetInventoryRequest( name="name_value", ) + assert args[0] == request_msg def test_get_inventory_use_cached_wrapped_rpc(): @@ -5021,9 +5050,14 @@ async def test_get_inventory_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_inventory_async( - transport: str = "grpc_asyncio", request_type=inventory.GetInventoryRequest -): +@pytest.mark.parametrize( + "request_type", + [ + inventory.GetInventoryRequest(), + {}, + ], +) +async def test_get_inventory_async(request_type, transport: str = "grpc_asyncio"): client = OsConfigZonalServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5031,7 +5065,7 @@ async def test_get_inventory_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_inventory), "__call__") as call: @@ -5054,11 +5088,6 @@ async def test_get_inventory_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_inventory_async_from_dict(): - await test_get_inventory_async(request_type=dict) - - def test_get_inventory_field_headers(): client = OsConfigZonalServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5201,8 +5230,8 @@ async def test_get_inventory_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - inventory.ListInventoriesRequest, - dict, + inventory.ListInventoriesRequest(), + {}, ], ) def test_list_inventories(request_type, transport: str = "grpc"): @@ -5213,7 +5242,7 @@ def test_list_inventories(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_inventories), "__call__") as call: @@ -5259,11 +5288,12 @@ def test_list_inventories_non_empty_request_with_auto_populated_field(): client.list_inventories(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == inventory.ListInventoriesRequest( + request_msg = inventory.ListInventoriesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_inventories_use_cached_wrapped_rpc(): @@ -5346,9 +5376,14 @@ async def test_list_inventories_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_inventories_async( - transport: str = "grpc_asyncio", request_type=inventory.ListInventoriesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + inventory.ListInventoriesRequest(), + {}, + ], +) +async def test_list_inventories_async(request_type, transport: str = "grpc_asyncio"): client = OsConfigZonalServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5356,7 +5391,7 @@ async def test_list_inventories_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_inventories), "__call__") as call: @@ -5379,11 +5414,6 @@ async def test_list_inventories_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_inventories_async_from_dict(): - await test_list_inventories_async(request_type=dict) - - def test_list_inventories_field_headers(): client = OsConfigZonalServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5720,8 +5750,8 @@ async def test_list_inventories_async_pages(): @pytest.mark.parametrize( "request_type", [ - vulnerability.GetVulnerabilityReportRequest, - dict, + vulnerability.GetVulnerabilityReportRequest(), + {}, ], ) def test_get_vulnerability_report(request_type, transport: str = "grpc"): @@ -5732,7 +5762,7 @@ def test_get_vulnerability_report(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5785,9 +5815,10 @@ def test_get_vulnerability_report_non_empty_request_with_auto_populated_field(): client.get_vulnerability_report(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vulnerability.GetVulnerabilityReportRequest( + request_msg = vulnerability.GetVulnerabilityReportRequest( name="name_value", ) + assert args[0] == request_msg def test_get_vulnerability_report_use_cached_wrapped_rpc(): @@ -5873,9 +5904,15 @@ async def test_get_vulnerability_report_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vulnerability.GetVulnerabilityReportRequest(), + {}, + ], +) async def test_get_vulnerability_report_async( - transport: str = "grpc_asyncio", - request_type=vulnerability.GetVulnerabilityReportRequest, + request_type, transport: str = "grpc_asyncio" ): client = OsConfigZonalServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5884,7 +5921,7 @@ async def test_get_vulnerability_report_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( @@ -5914,11 +5951,6 @@ async def test_get_vulnerability_report_async( ) -@pytest.mark.asyncio -async def test_get_vulnerability_report_async_from_dict(): - await test_get_vulnerability_report_async(request_type=dict) - - def test_get_vulnerability_report_field_headers(): client = OsConfigZonalServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6073,8 +6105,8 @@ async def test_get_vulnerability_report_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vulnerability.ListVulnerabilityReportsRequest, - dict, + vulnerability.ListVulnerabilityReportsRequest(), + {}, ], ) def test_list_vulnerability_reports(request_type, transport: str = "grpc"): @@ -6085,7 +6117,7 @@ def test_list_vulnerability_reports(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6135,11 +6167,12 @@ def test_list_vulnerability_reports_non_empty_request_with_auto_populated_field( client.list_vulnerability_reports(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vulnerability.ListVulnerabilityReportsRequest( + request_msg = vulnerability.ListVulnerabilityReportsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_vulnerability_reports_use_cached_wrapped_rpc(): @@ -6225,9 +6258,15 @@ async def test_list_vulnerability_reports_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vulnerability.ListVulnerabilityReportsRequest(), + {}, + ], +) async def test_list_vulnerability_reports_async( - transport: str = "grpc_asyncio", - request_type=vulnerability.ListVulnerabilityReportsRequest, + request_type, transport: str = "grpc_asyncio" ): client = OsConfigZonalServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -6236,7 +6275,7 @@ async def test_list_vulnerability_reports_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( @@ -6261,11 +6300,6 @@ async def test_list_vulnerability_reports_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_vulnerability_reports_async_from_dict(): - await test_list_vulnerability_reports_async(request_type=dict) - - def test_list_vulnerability_reports_field_headers(): client = OsConfigZonalServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9445,7 +9479,6 @@ def test_create_os_policy_assignment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = os_policy_assignments.CreateOSPolicyAssignmentRequest() - assert args[0] == request_msg @@ -9468,7 +9501,6 @@ def test_update_os_policy_assignment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = os_policy_assignments.UpdateOSPolicyAssignmentRequest() - assert args[0] == request_msg @@ -9491,7 +9523,6 @@ def test_get_os_policy_assignment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = os_policy_assignments.GetOSPolicyAssignmentRequest() - assert args[0] == request_msg @@ -9514,7 +9545,6 @@ def test_list_os_policy_assignments_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = os_policy_assignments.ListOSPolicyAssignmentsRequest() - assert args[0] == request_msg @@ -9539,7 +9569,6 @@ def test_list_os_policy_assignment_revisions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = os_policy_assignments.ListOSPolicyAssignmentRevisionsRequest() - assert args[0] == request_msg @@ -9562,7 +9591,6 @@ def test_delete_os_policy_assignment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = os_policy_assignments.DeleteOSPolicyAssignmentRequest() - assert args[0] == request_msg @@ -9585,7 +9613,6 @@ def test_get_os_policy_assignment_report_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = os_policy_assignment_reports.GetOSPolicyAssignmentReportRequest() - assert args[0] == request_msg @@ -9612,7 +9639,6 @@ def test_list_os_policy_assignment_reports_empty_call_grpc(): request_msg = ( os_policy_assignment_reports.ListOSPolicyAssignmentReportsRequest() ) - assert args[0] == request_msg @@ -9633,7 +9659,6 @@ def test_get_inventory_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = inventory.GetInventoryRequest() - assert args[0] == request_msg @@ -9654,7 +9679,6 @@ def test_list_inventories_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = inventory.ListInventoriesRequest() - assert args[0] == request_msg @@ -9677,7 +9701,6 @@ def test_get_vulnerability_report_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vulnerability.GetVulnerabilityReportRequest() - assert args[0] == request_msg @@ -9700,7 +9723,6 @@ def test_list_vulnerability_reports_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vulnerability.ListVulnerabilityReportsRequest() - assert args[0] == request_msg @@ -9741,7 +9763,6 @@ async def test_create_os_policy_assignment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = os_policy_assignments.CreateOSPolicyAssignmentRequest() - assert args[0] == request_msg @@ -9768,7 +9789,6 @@ async def test_update_os_policy_assignment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = os_policy_assignments.UpdateOSPolicyAssignmentRequest() - assert args[0] == request_msg @@ -9805,7 +9825,6 @@ async def test_get_os_policy_assignment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = os_policy_assignments.GetOSPolicyAssignmentRequest() - assert args[0] == request_msg @@ -9834,7 +9853,6 @@ async def test_list_os_policy_assignments_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = os_policy_assignments.ListOSPolicyAssignmentsRequest() - assert args[0] == request_msg @@ -9863,7 +9881,6 @@ async def test_list_os_policy_assignment_revisions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = os_policy_assignments.ListOSPolicyAssignmentRevisionsRequest() - assert args[0] == request_msg @@ -9890,7 +9907,6 @@ async def test_delete_os_policy_assignment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = os_policy_assignments.DeleteOSPolicyAssignmentRequest() - assert args[0] == request_msg @@ -9922,7 +9938,6 @@ async def test_get_os_policy_assignment_report_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = os_policy_assignment_reports.GetOSPolicyAssignmentReportRequest() - assert args[0] == request_msg @@ -9953,7 +9968,6 @@ async def test_list_os_policy_assignment_reports_empty_call_grpc_asyncio(): request_msg = ( os_policy_assignment_reports.ListOSPolicyAssignmentReportsRequest() ) - assert args[0] == request_msg @@ -9980,7 +9994,6 @@ async def test_get_inventory_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = inventory.GetInventoryRequest() - assert args[0] == request_msg @@ -10007,7 +10020,6 @@ async def test_list_inventories_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = inventory.ListInventoriesRequest() - assert args[0] == request_msg @@ -10037,7 +10049,6 @@ async def test_get_vulnerability_report_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vulnerability.GetVulnerabilityReportRequest() - assert args[0] == request_msg @@ -10066,7 +10077,6 @@ async def test_list_vulnerability_reports_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vulnerability.ListVulnerabilityReportsRequest() - assert args[0] == request_msg @@ -12197,7 +12207,6 @@ def test_create_os_policy_assignment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = os_policy_assignments.CreateOSPolicyAssignmentRequest() - assert args[0] == request_msg @@ -12219,7 +12228,6 @@ def test_update_os_policy_assignment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = os_policy_assignments.UpdateOSPolicyAssignmentRequest() - assert args[0] == request_msg @@ -12241,7 +12249,6 @@ def test_get_os_policy_assignment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = os_policy_assignments.GetOSPolicyAssignmentRequest() - assert args[0] == request_msg @@ -12263,7 +12270,6 @@ def test_list_os_policy_assignments_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = os_policy_assignments.ListOSPolicyAssignmentsRequest() - assert args[0] == request_msg @@ -12285,7 +12291,6 @@ def test_list_os_policy_assignment_revisions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = os_policy_assignments.ListOSPolicyAssignmentRevisionsRequest() - assert args[0] == request_msg @@ -12307,7 +12312,6 @@ def test_delete_os_policy_assignment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = os_policy_assignments.DeleteOSPolicyAssignmentRequest() - assert args[0] == request_msg @@ -12329,7 +12333,6 @@ def test_get_os_policy_assignment_report_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = os_policy_assignment_reports.GetOSPolicyAssignmentReportRequest() - assert args[0] == request_msg @@ -12353,7 +12356,6 @@ def test_list_os_policy_assignment_reports_empty_call_rest(): request_msg = ( os_policy_assignment_reports.ListOSPolicyAssignmentReportsRequest() ) - assert args[0] == request_msg @@ -12373,7 +12375,6 @@ def test_get_inventory_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = inventory.GetInventoryRequest() - assert args[0] == request_msg @@ -12393,7 +12394,6 @@ def test_list_inventories_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = inventory.ListInventoriesRequest() - assert args[0] == request_msg @@ -12415,7 +12415,6 @@ def test_get_vulnerability_report_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vulnerability.GetVulnerabilityReportRequest() - assert args[0] == request_msg @@ -12437,7 +12436,6 @@ def test_list_vulnerability_reports_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vulnerability.ListVulnerabilityReportsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-os-config/tests/unit/gapic/osconfig_v1alpha/test_os_config_zonal_service.py b/packages/google-cloud-os-config/tests/unit/gapic/osconfig_v1alpha/test_os_config_zonal_service.py index 4800cc0c6146..24d01319d96b 100644 --- a/packages/google-cloud-os-config/tests/unit/gapic/osconfig_v1alpha/test_os_config_zonal_service.py +++ b/packages/google-cloud-os-config/tests/unit/gapic/osconfig_v1alpha/test_os_config_zonal_service.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 @@ -125,6 +126,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" @@ -1388,8 +1404,8 @@ def test_os_config_zonal_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - os_policy_assignments.CreateOSPolicyAssignmentRequest, - dict, + os_policy_assignments.CreateOSPolicyAssignmentRequest(), + {}, ], ) def test_create_os_policy_assignment(request_type, transport: str = "grpc"): @@ -1400,7 +1416,7 @@ def test_create_os_policy_assignment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1446,10 +1462,11 @@ def test_create_os_policy_assignment_non_empty_request_with_auto_populated_field client.create_os_policy_assignment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == os_policy_assignments.CreateOSPolicyAssignmentRequest( + request_msg = os_policy_assignments.CreateOSPolicyAssignmentRequest( parent="parent_value", os_policy_assignment_id="os_policy_assignment_id_value", ) + assert args[0] == request_msg def test_create_os_policy_assignment_use_cached_wrapped_rpc(): @@ -1545,9 +1562,15 @@ async def test_create_os_policy_assignment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + os_policy_assignments.CreateOSPolicyAssignmentRequest(), + {}, + ], +) async def test_create_os_policy_assignment_async( - transport: str = "grpc_asyncio", - request_type=os_policy_assignments.CreateOSPolicyAssignmentRequest, + request_type, transport: str = "grpc_asyncio" ): client = OsConfigZonalServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1556,7 +1579,7 @@ async def test_create_os_policy_assignment_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( @@ -1578,11 +1601,6 @@ async def test_create_os_policy_assignment_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_os_policy_assignment_async_from_dict(): - await test_create_os_policy_assignment_async(request_type=dict) - - def test_create_os_policy_assignment_field_headers(): client = OsConfigZonalServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1765,8 +1783,8 @@ async def test_create_os_policy_assignment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - os_policy_assignments.UpdateOSPolicyAssignmentRequest, - dict, + os_policy_assignments.UpdateOSPolicyAssignmentRequest(), + {}, ], ) def test_update_os_policy_assignment(request_type, transport: str = "grpc"): @@ -1777,7 +1795,7 @@ def test_update_os_policy_assignment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1820,7 +1838,8 @@ def test_update_os_policy_assignment_non_empty_request_with_auto_populated_field client.update_os_policy_assignment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == os_policy_assignments.UpdateOSPolicyAssignmentRequest() + request_msg = os_policy_assignments.UpdateOSPolicyAssignmentRequest() + assert args[0] == request_msg def test_update_os_policy_assignment_use_cached_wrapped_rpc(): @@ -1916,9 +1935,15 @@ async def test_update_os_policy_assignment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + os_policy_assignments.UpdateOSPolicyAssignmentRequest(), + {}, + ], +) async def test_update_os_policy_assignment_async( - transport: str = "grpc_asyncio", - request_type=os_policy_assignments.UpdateOSPolicyAssignmentRequest, + request_type, transport: str = "grpc_asyncio" ): client = OsConfigZonalServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1927,7 +1952,7 @@ async def test_update_os_policy_assignment_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( @@ -1949,11 +1974,6 @@ async def test_update_os_policy_assignment_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_os_policy_assignment_async_from_dict(): - await test_update_os_policy_assignment_async(request_type=dict) - - def test_update_os_policy_assignment_field_headers(): client = OsConfigZonalServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2126,8 +2146,8 @@ async def test_update_os_policy_assignment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - os_policy_assignments.GetOSPolicyAssignmentRequest, - dict, + os_policy_assignments.GetOSPolicyAssignmentRequest(), + {}, ], ) def test_get_os_policy_assignment(request_type, transport: str = "grpc"): @@ -2138,7 +2158,7 @@ def test_get_os_policy_assignment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2205,9 +2225,10 @@ def test_get_os_policy_assignment_non_empty_request_with_auto_populated_field(): client.get_os_policy_assignment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == os_policy_assignments.GetOSPolicyAssignmentRequest( + request_msg = os_policy_assignments.GetOSPolicyAssignmentRequest( name="name_value", ) + assert args[0] == request_msg def test_get_os_policy_assignment_use_cached_wrapped_rpc(): @@ -2293,9 +2314,15 @@ async def test_get_os_policy_assignment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + os_policy_assignments.GetOSPolicyAssignmentRequest(), + {}, + ], +) async def test_get_os_policy_assignment_async( - transport: str = "grpc_asyncio", - request_type=os_policy_assignments.GetOSPolicyAssignmentRequest, + request_type, transport: str = "grpc_asyncio" ): client = OsConfigZonalServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2304,7 +2331,7 @@ async def test_get_os_policy_assignment_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( @@ -2348,11 +2375,6 @@ async def test_get_os_policy_assignment_async( assert response.uid == "uid_value" -@pytest.mark.asyncio -async def test_get_os_policy_assignment_async_from_dict(): - await test_get_os_policy_assignment_async(request_type=dict) - - def test_get_os_policy_assignment_field_headers(): client = OsConfigZonalServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2507,8 +2529,8 @@ async def test_get_os_policy_assignment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - os_policy_assignments.ListOSPolicyAssignmentsRequest, - dict, + os_policy_assignments.ListOSPolicyAssignmentsRequest(), + {}, ], ) def test_list_os_policy_assignments(request_type, transport: str = "grpc"): @@ -2519,7 +2541,7 @@ def test_list_os_policy_assignments(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2568,10 +2590,11 @@ def test_list_os_policy_assignments_non_empty_request_with_auto_populated_field( client.list_os_policy_assignments(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == os_policy_assignments.ListOSPolicyAssignmentsRequest( + request_msg = os_policy_assignments.ListOSPolicyAssignmentsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_os_policy_assignments_use_cached_wrapped_rpc(): @@ -2657,9 +2680,15 @@ async def test_list_os_policy_assignments_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + os_policy_assignments.ListOSPolicyAssignmentsRequest(), + {}, + ], +) async def test_list_os_policy_assignments_async( - transport: str = "grpc_asyncio", - request_type=os_policy_assignments.ListOSPolicyAssignmentsRequest, + request_type, transport: str = "grpc_asyncio" ): client = OsConfigZonalServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2668,7 +2697,7 @@ async def test_list_os_policy_assignments_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( @@ -2693,11 +2722,6 @@ async def test_list_os_policy_assignments_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_os_policy_assignments_async_from_dict(): - await test_list_os_policy_assignments_async(request_type=dict) - - def test_list_os_policy_assignments_field_headers(): client = OsConfigZonalServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3056,8 +3080,8 @@ async def test_list_os_policy_assignments_async_pages(): @pytest.mark.parametrize( "request_type", [ - os_policy_assignments.ListOSPolicyAssignmentRevisionsRequest, - dict, + os_policy_assignments.ListOSPolicyAssignmentRevisionsRequest(), + {}, ], ) def test_list_os_policy_assignment_revisions(request_type, transport: str = "grpc"): @@ -3068,7 +3092,7 @@ def test_list_os_policy_assignment_revisions(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( @@ -3119,10 +3143,11 @@ def test_list_os_policy_assignment_revisions_non_empty_request_with_auto_populat client.list_os_policy_assignment_revisions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == os_policy_assignments.ListOSPolicyAssignmentRevisionsRequest( + request_msg = os_policy_assignments.ListOSPolicyAssignmentRevisionsRequest( name="name_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_os_policy_assignment_revisions_use_cached_wrapped_rpc(): @@ -3208,9 +3233,15 @@ async def test_list_os_policy_assignment_revisions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + os_policy_assignments.ListOSPolicyAssignmentRevisionsRequest(), + {}, + ], +) async def test_list_os_policy_assignment_revisions_async( - transport: str = "grpc_asyncio", - request_type=os_policy_assignments.ListOSPolicyAssignmentRevisionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = OsConfigZonalServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3219,7 +3250,7 @@ async def test_list_os_policy_assignment_revisions_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( @@ -3244,11 +3275,6 @@ async def test_list_os_policy_assignment_revisions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_os_policy_assignment_revisions_async_from_dict(): - await test_list_os_policy_assignment_revisions_async(request_type=dict) - - def test_list_os_policy_assignment_revisions_field_headers(): client = OsConfigZonalServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3615,8 +3641,8 @@ async def test_list_os_policy_assignment_revisions_async_pages(): @pytest.mark.parametrize( "request_type", [ - os_policy_assignments.DeleteOSPolicyAssignmentRequest, - dict, + os_policy_assignments.DeleteOSPolicyAssignmentRequest(), + {}, ], ) def test_delete_os_policy_assignment(request_type, transport: str = "grpc"): @@ -3627,7 +3653,7 @@ def test_delete_os_policy_assignment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3672,9 +3698,10 @@ def test_delete_os_policy_assignment_non_empty_request_with_auto_populated_field client.delete_os_policy_assignment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == os_policy_assignments.DeleteOSPolicyAssignmentRequest( + request_msg = os_policy_assignments.DeleteOSPolicyAssignmentRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_os_policy_assignment_use_cached_wrapped_rpc(): @@ -3770,9 +3797,15 @@ async def test_delete_os_policy_assignment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + os_policy_assignments.DeleteOSPolicyAssignmentRequest(), + {}, + ], +) async def test_delete_os_policy_assignment_async( - transport: str = "grpc_asyncio", - request_type=os_policy_assignments.DeleteOSPolicyAssignmentRequest, + request_type, transport: str = "grpc_asyncio" ): client = OsConfigZonalServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3781,7 +3814,7 @@ async def test_delete_os_policy_assignment_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( @@ -3803,11 +3836,6 @@ async def test_delete_os_policy_assignment_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_os_policy_assignment_async_from_dict(): - await test_delete_os_policy_assignment_async(request_type=dict) - - def test_delete_os_policy_assignment_field_headers(): client = OsConfigZonalServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3962,8 +3990,8 @@ async def test_delete_os_policy_assignment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - instance_os_policies_compliance.GetInstanceOSPoliciesComplianceRequest, - dict, + instance_os_policies_compliance.GetInstanceOSPoliciesComplianceRequest(), + {}, ], ) def test_get_instance_os_policies_compliance(request_type, transport: str = "grpc"): @@ -3974,7 +4002,7 @@ def test_get_instance_os_policies_compliance(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( @@ -4038,11 +4066,12 @@ def test_get_instance_os_policies_compliance_non_empty_request_with_auto_populat client.get_instance_os_policies_compliance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == instance_os_policies_compliance.GetInstanceOSPoliciesComplianceRequest( - name="name_value", + request_msg = ( + instance_os_policies_compliance.GetInstanceOSPoliciesComplianceRequest( + name="name_value", + ) ) + assert args[0] == request_msg def test_get_instance_os_policies_compliance_use_cached_wrapped_rpc(): @@ -4128,9 +4157,15 @@ async def test_get_instance_os_policies_compliance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + instance_os_policies_compliance.GetInstanceOSPoliciesComplianceRequest(), + {}, + ], +) async def test_get_instance_os_policies_compliance_async( - transport: str = "grpc_asyncio", - request_type=instance_os_policies_compliance.GetInstanceOSPoliciesComplianceRequest, + request_type, transport: str = "grpc_asyncio" ): client = OsConfigZonalServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4139,7 +4174,7 @@ async def test_get_instance_os_policies_compliance_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( @@ -4178,11 +4213,6 @@ async def test_get_instance_os_policies_compliance_async( assert response.last_compliance_run_id == "last_compliance_run_id_value" -@pytest.mark.asyncio -async def test_get_instance_os_policies_compliance_async_from_dict(): - await test_get_instance_os_policies_compliance_async(request_type=dict) - - def test_get_instance_os_policies_compliance_field_headers(): client = OsConfigZonalServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4343,8 +4373,8 @@ async def test_get_instance_os_policies_compliance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - instance_os_policies_compliance.ListInstanceOSPoliciesCompliancesRequest, - dict, + instance_os_policies_compliance.ListInstanceOSPoliciesCompliancesRequest(), + {}, ], ) def test_list_instance_os_policies_compliances(request_type, transport: str = "grpc"): @@ -4355,7 +4385,7 @@ def test_list_instance_os_policies_compliances(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( @@ -4409,13 +4439,14 @@ def test_list_instance_os_policies_compliances_non_empty_request_with_auto_popul client.list_instance_os_policies_compliances(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == instance_os_policies_compliance.ListInstanceOSPoliciesCompliancesRequest( - parent="parent_value", - page_token="page_token_value", - filter="filter_value", + request_msg = ( + instance_os_policies_compliance.ListInstanceOSPoliciesCompliancesRequest( + parent="parent_value", + page_token="page_token_value", + filter="filter_value", + ) ) + assert args[0] == request_msg def test_list_instance_os_policies_compliances_use_cached_wrapped_rpc(): @@ -4501,9 +4532,15 @@ async def test_list_instance_os_policies_compliances_async_use_cached_wrapped_rp @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + instance_os_policies_compliance.ListInstanceOSPoliciesCompliancesRequest(), + {}, + ], +) async def test_list_instance_os_policies_compliances_async( - transport: str = "grpc_asyncio", - request_type=instance_os_policies_compliance.ListInstanceOSPoliciesCompliancesRequest, + request_type, transport: str = "grpc_asyncio" ): client = OsConfigZonalServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4512,7 +4549,7 @@ async def test_list_instance_os_policies_compliances_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( @@ -4539,11 +4576,6 @@ async def test_list_instance_os_policies_compliances_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_instance_os_policies_compliances_async_from_dict(): - await test_list_instance_os_policies_compliances_async(request_type=dict) - - def test_list_instance_os_policies_compliances_field_headers(): client = OsConfigZonalServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4912,8 +4944,8 @@ async def test_list_instance_os_policies_compliances_async_pages(): @pytest.mark.parametrize( "request_type", [ - os_policy_assignment_reports.GetOSPolicyAssignmentReportRequest, - dict, + os_policy_assignment_reports.GetOSPolicyAssignmentReportRequest(), + {}, ], ) def test_get_os_policy_assignment_report(request_type, transport: str = "grpc"): @@ -4924,7 +4956,7 @@ def test_get_os_policy_assignment_report(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4978,11 +5010,10 @@ def test_get_os_policy_assignment_report_non_empty_request_with_auto_populated_f client.get_os_policy_assignment_report(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == os_policy_assignment_reports.GetOSPolicyAssignmentReportRequest( + request_msg = os_policy_assignment_reports.GetOSPolicyAssignmentReportRequest( name="name_value", ) + assert args[0] == request_msg def test_get_os_policy_assignment_report_use_cached_wrapped_rpc(): @@ -5068,9 +5099,15 @@ async def test_get_os_policy_assignment_report_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + os_policy_assignment_reports.GetOSPolicyAssignmentReportRequest(), + {}, + ], +) async def test_get_os_policy_assignment_report_async( - transport: str = "grpc_asyncio", - request_type=os_policy_assignment_reports.GetOSPolicyAssignmentReportRequest, + request_type, transport: str = "grpc_asyncio" ): client = OsConfigZonalServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5079,7 +5116,7 @@ async def test_get_os_policy_assignment_report_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( @@ -5110,11 +5147,6 @@ async def test_get_os_policy_assignment_report_async( assert response.last_run_id == "last_run_id_value" -@pytest.mark.asyncio -async def test_get_os_policy_assignment_report_async_from_dict(): - await test_get_os_policy_assignment_report_async(request_type=dict) - - def test_get_os_policy_assignment_report_field_headers(): client = OsConfigZonalServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5269,8 +5301,8 @@ async def test_get_os_policy_assignment_report_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - os_policy_assignment_reports.ListOSPolicyAssignmentReportsRequest, - dict, + os_policy_assignment_reports.ListOSPolicyAssignmentReportsRequest(), + {}, ], ) def test_list_os_policy_assignment_reports(request_type, transport: str = "grpc"): @@ -5281,7 +5313,7 @@ def test_list_os_policy_assignment_reports(request_type, transport: str = "grpc" # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5333,13 +5365,12 @@ def test_list_os_policy_assignment_reports_non_empty_request_with_auto_populated client.list_os_policy_assignment_reports(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == os_policy_assignment_reports.ListOSPolicyAssignmentReportsRequest( + request_msg = os_policy_assignment_reports.ListOSPolicyAssignmentReportsRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_os_policy_assignment_reports_use_cached_wrapped_rpc(): @@ -5425,9 +5456,15 @@ async def test_list_os_policy_assignment_reports_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + os_policy_assignment_reports.ListOSPolicyAssignmentReportsRequest(), + {}, + ], +) async def test_list_os_policy_assignment_reports_async( - transport: str = "grpc_asyncio", - request_type=os_policy_assignment_reports.ListOSPolicyAssignmentReportsRequest, + request_type, transport: str = "grpc_asyncio" ): client = OsConfigZonalServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5436,7 +5473,7 @@ async def test_list_os_policy_assignment_reports_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( @@ -5461,11 +5498,6 @@ async def test_list_os_policy_assignment_reports_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_os_policy_assignment_reports_async_from_dict(): - await test_list_os_policy_assignment_reports_async(request_type=dict) - - def test_list_os_policy_assignment_reports_field_headers(): client = OsConfigZonalServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5834,8 +5866,8 @@ async def test_list_os_policy_assignment_reports_async_pages(): @pytest.mark.parametrize( "request_type", [ - inventory.GetInventoryRequest, - dict, + inventory.GetInventoryRequest(), + {}, ], ) def test_get_inventory(request_type, transport: str = "grpc"): @@ -5846,7 +5878,7 @@ def test_get_inventory(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_inventory), "__call__") as call: @@ -5890,9 +5922,10 @@ def test_get_inventory_non_empty_request_with_auto_populated_field(): client.get_inventory(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == inventory.GetInventoryRequest( + request_msg = inventory.GetInventoryRequest( name="name_value", ) + assert args[0] == request_msg def test_get_inventory_use_cached_wrapped_rpc(): @@ -5973,9 +6006,14 @@ async def test_get_inventory_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_inventory_async( - transport: str = "grpc_asyncio", request_type=inventory.GetInventoryRequest -): +@pytest.mark.parametrize( + "request_type", + [ + inventory.GetInventoryRequest(), + {}, + ], +) +async def test_get_inventory_async(request_type, transport: str = "grpc_asyncio"): client = OsConfigZonalServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5983,7 +6021,7 @@ async def test_get_inventory_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_inventory), "__call__") as call: @@ -6006,11 +6044,6 @@ async def test_get_inventory_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_inventory_async_from_dict(): - await test_get_inventory_async(request_type=dict) - - def test_get_inventory_field_headers(): client = OsConfigZonalServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6153,8 +6186,8 @@ async def test_get_inventory_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - inventory.ListInventoriesRequest, - dict, + inventory.ListInventoriesRequest(), + {}, ], ) def test_list_inventories(request_type, transport: str = "grpc"): @@ -6165,7 +6198,7 @@ def test_list_inventories(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_inventories), "__call__") as call: @@ -6211,11 +6244,12 @@ def test_list_inventories_non_empty_request_with_auto_populated_field(): client.list_inventories(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == inventory.ListInventoriesRequest( + request_msg = inventory.ListInventoriesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_inventories_use_cached_wrapped_rpc(): @@ -6298,9 +6332,14 @@ async def test_list_inventories_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_inventories_async( - transport: str = "grpc_asyncio", request_type=inventory.ListInventoriesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + inventory.ListInventoriesRequest(), + {}, + ], +) +async def test_list_inventories_async(request_type, transport: str = "grpc_asyncio"): client = OsConfigZonalServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6308,7 +6347,7 @@ async def test_list_inventories_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_inventories), "__call__") as call: @@ -6331,11 +6370,6 @@ async def test_list_inventories_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_inventories_async_from_dict(): - await test_list_inventories_async(request_type=dict) - - def test_list_inventories_field_headers(): client = OsConfigZonalServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6672,8 +6706,8 @@ async def test_list_inventories_async_pages(): @pytest.mark.parametrize( "request_type", [ - vulnerability.GetVulnerabilityReportRequest, - dict, + vulnerability.GetVulnerabilityReportRequest(), + {}, ], ) def test_get_vulnerability_report(request_type, transport: str = "grpc"): @@ -6684,7 +6718,7 @@ def test_get_vulnerability_report(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6732,9 +6766,10 @@ def test_get_vulnerability_report_non_empty_request_with_auto_populated_field(): client.get_vulnerability_report(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vulnerability.GetVulnerabilityReportRequest( + request_msg = vulnerability.GetVulnerabilityReportRequest( name="name_value", ) + assert args[0] == request_msg def test_get_vulnerability_report_use_cached_wrapped_rpc(): @@ -6820,9 +6855,15 @@ async def test_get_vulnerability_report_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vulnerability.GetVulnerabilityReportRequest(), + {}, + ], +) async def test_get_vulnerability_report_async( - transport: str = "grpc_asyncio", - request_type=vulnerability.GetVulnerabilityReportRequest, + request_type, transport: str = "grpc_asyncio" ): client = OsConfigZonalServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -6831,7 +6872,7 @@ async def test_get_vulnerability_report_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( @@ -6856,11 +6897,6 @@ async def test_get_vulnerability_report_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_vulnerability_report_async_from_dict(): - await test_get_vulnerability_report_async(request_type=dict) - - def test_get_vulnerability_report_field_headers(): client = OsConfigZonalServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7015,8 +7051,8 @@ async def test_get_vulnerability_report_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vulnerability.ListVulnerabilityReportsRequest, - dict, + vulnerability.ListVulnerabilityReportsRequest(), + {}, ], ) def test_list_vulnerability_reports(request_type, transport: str = "grpc"): @@ -7027,7 +7063,7 @@ def test_list_vulnerability_reports(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7077,11 +7113,12 @@ def test_list_vulnerability_reports_non_empty_request_with_auto_populated_field( client.list_vulnerability_reports(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vulnerability.ListVulnerabilityReportsRequest( + request_msg = vulnerability.ListVulnerabilityReportsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_vulnerability_reports_use_cached_wrapped_rpc(): @@ -7167,9 +7204,15 @@ async def test_list_vulnerability_reports_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vulnerability.ListVulnerabilityReportsRequest(), + {}, + ], +) async def test_list_vulnerability_reports_async( - transport: str = "grpc_asyncio", - request_type=vulnerability.ListVulnerabilityReportsRequest, + request_type, transport: str = "grpc_asyncio" ): client = OsConfigZonalServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -7178,7 +7221,7 @@ async def test_list_vulnerability_reports_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( @@ -7203,11 +7246,6 @@ async def test_list_vulnerability_reports_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_vulnerability_reports_async_from_dict(): - await test_list_vulnerability_reports_async(request_type=dict) - - def test_list_vulnerability_reports_field_headers(): client = OsConfigZonalServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10869,7 +10907,6 @@ def test_create_os_policy_assignment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = os_policy_assignments.CreateOSPolicyAssignmentRequest() - assert args[0] == request_msg @@ -10892,7 +10929,6 @@ def test_update_os_policy_assignment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = os_policy_assignments.UpdateOSPolicyAssignmentRequest() - assert args[0] == request_msg @@ -10915,7 +10951,6 @@ def test_get_os_policy_assignment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = os_policy_assignments.GetOSPolicyAssignmentRequest() - assert args[0] == request_msg @@ -10938,7 +10973,6 @@ def test_list_os_policy_assignments_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = os_policy_assignments.ListOSPolicyAssignmentsRequest() - assert args[0] == request_msg @@ -10963,7 +10997,6 @@ def test_list_os_policy_assignment_revisions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = os_policy_assignments.ListOSPolicyAssignmentRevisionsRequest() - assert args[0] == request_msg @@ -10986,7 +11019,6 @@ def test_delete_os_policy_assignment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = os_policy_assignments.DeleteOSPolicyAssignmentRequest() - assert args[0] == request_msg @@ -11013,7 +11045,6 @@ def test_get_instance_os_policies_compliance_empty_call_grpc(): request_msg = ( instance_os_policies_compliance.GetInstanceOSPoliciesComplianceRequest() ) - assert args[0] == request_msg @@ -11040,7 +11071,6 @@ def test_list_instance_os_policies_compliances_empty_call_grpc(): request_msg = ( instance_os_policies_compliance.ListInstanceOSPoliciesCompliancesRequest() ) - assert args[0] == request_msg @@ -11063,7 +11093,6 @@ def test_get_os_policy_assignment_report_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = os_policy_assignment_reports.GetOSPolicyAssignmentReportRequest() - assert args[0] == request_msg @@ -11090,7 +11119,6 @@ def test_list_os_policy_assignment_reports_empty_call_grpc(): request_msg = ( os_policy_assignment_reports.ListOSPolicyAssignmentReportsRequest() ) - assert args[0] == request_msg @@ -11111,7 +11139,6 @@ def test_get_inventory_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = inventory.GetInventoryRequest() - assert args[0] == request_msg @@ -11132,7 +11159,6 @@ def test_list_inventories_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = inventory.ListInventoriesRequest() - assert args[0] == request_msg @@ -11155,7 +11181,6 @@ def test_get_vulnerability_report_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vulnerability.GetVulnerabilityReportRequest() - assert args[0] == request_msg @@ -11178,7 +11203,6 @@ def test_list_vulnerability_reports_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vulnerability.ListVulnerabilityReportsRequest() - assert args[0] == request_msg @@ -11219,7 +11243,6 @@ async def test_create_os_policy_assignment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = os_policy_assignments.CreateOSPolicyAssignmentRequest() - assert args[0] == request_msg @@ -11246,7 +11269,6 @@ async def test_update_os_policy_assignment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = os_policy_assignments.UpdateOSPolicyAssignmentRequest() - assert args[0] == request_msg @@ -11283,7 +11305,6 @@ async def test_get_os_policy_assignment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = os_policy_assignments.GetOSPolicyAssignmentRequest() - assert args[0] == request_msg @@ -11312,7 +11333,6 @@ async def test_list_os_policy_assignments_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = os_policy_assignments.ListOSPolicyAssignmentsRequest() - assert args[0] == request_msg @@ -11341,7 +11361,6 @@ async def test_list_os_policy_assignment_revisions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = os_policy_assignments.ListOSPolicyAssignmentRevisionsRequest() - assert args[0] == request_msg @@ -11368,7 +11387,6 @@ async def test_delete_os_policy_assignment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = os_policy_assignments.DeleteOSPolicyAssignmentRequest() - assert args[0] == request_msg @@ -11404,7 +11422,6 @@ async def test_get_instance_os_policies_compliance_empty_call_grpc_asyncio(): request_msg = ( instance_os_policies_compliance.GetInstanceOSPoliciesComplianceRequest() ) - assert args[0] == request_msg @@ -11435,7 +11452,6 @@ async def test_list_instance_os_policies_compliances_empty_call_grpc_asyncio(): request_msg = ( instance_os_policies_compliance.ListInstanceOSPoliciesCompliancesRequest() ) - assert args[0] == request_msg @@ -11467,7 +11483,6 @@ async def test_get_os_policy_assignment_report_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = os_policy_assignment_reports.GetOSPolicyAssignmentReportRequest() - assert args[0] == request_msg @@ -11498,7 +11513,6 @@ async def test_list_os_policy_assignment_reports_empty_call_grpc_asyncio(): request_msg = ( os_policy_assignment_reports.ListOSPolicyAssignmentReportsRequest() ) - assert args[0] == request_msg @@ -11525,7 +11539,6 @@ async def test_get_inventory_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = inventory.GetInventoryRequest() - assert args[0] == request_msg @@ -11552,7 +11565,6 @@ async def test_list_inventories_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = inventory.ListInventoriesRequest() - assert args[0] == request_msg @@ -11581,7 +11593,6 @@ async def test_get_vulnerability_report_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vulnerability.GetVulnerabilityReportRequest() - assert args[0] == request_msg @@ -11610,7 +11621,6 @@ async def test_list_vulnerability_reports_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vulnerability.ListVulnerabilityReportsRequest() - assert args[0] == request_msg @@ -14056,7 +14066,6 @@ def test_create_os_policy_assignment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = os_policy_assignments.CreateOSPolicyAssignmentRequest() - assert args[0] == request_msg @@ -14078,7 +14087,6 @@ def test_update_os_policy_assignment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = os_policy_assignments.UpdateOSPolicyAssignmentRequest() - assert args[0] == request_msg @@ -14100,7 +14108,6 @@ def test_get_os_policy_assignment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = os_policy_assignments.GetOSPolicyAssignmentRequest() - assert args[0] == request_msg @@ -14122,7 +14129,6 @@ def test_list_os_policy_assignments_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = os_policy_assignments.ListOSPolicyAssignmentsRequest() - assert args[0] == request_msg @@ -14144,7 +14150,6 @@ def test_list_os_policy_assignment_revisions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = os_policy_assignments.ListOSPolicyAssignmentRevisionsRequest() - assert args[0] == request_msg @@ -14166,7 +14171,6 @@ def test_delete_os_policy_assignment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = os_policy_assignments.DeleteOSPolicyAssignmentRequest() - assert args[0] == request_msg @@ -14190,7 +14194,6 @@ def test_get_instance_os_policies_compliance_empty_call_rest(): request_msg = ( instance_os_policies_compliance.GetInstanceOSPoliciesComplianceRequest() ) - assert args[0] == request_msg @@ -14214,7 +14217,6 @@ def test_list_instance_os_policies_compliances_empty_call_rest(): request_msg = ( instance_os_policies_compliance.ListInstanceOSPoliciesCompliancesRequest() ) - assert args[0] == request_msg @@ -14236,7 +14238,6 @@ def test_get_os_policy_assignment_report_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = os_policy_assignment_reports.GetOSPolicyAssignmentReportRequest() - assert args[0] == request_msg @@ -14260,7 +14261,6 @@ def test_list_os_policy_assignment_reports_empty_call_rest(): request_msg = ( os_policy_assignment_reports.ListOSPolicyAssignmentReportsRequest() ) - assert args[0] == request_msg @@ -14280,7 +14280,6 @@ def test_get_inventory_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = inventory.GetInventoryRequest() - assert args[0] == request_msg @@ -14300,7 +14299,6 @@ def test_list_inventories_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = inventory.ListInventoriesRequest() - assert args[0] == request_msg @@ -14322,7 +14320,6 @@ def test_get_vulnerability_report_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vulnerability.GetVulnerabilityReportRequest() - assert args[0] == request_msg @@ -14344,7 +14341,6 @@ def test_list_vulnerability_reports_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vulnerability.ListVulnerabilityReportsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-os-login/noxfile.py b/packages/google-cloud-os-login/noxfile.py index 861a580f1cbf..8f85dfe7f505 100644 --- a/packages/google-cloud-os-login/noxfile.py +++ b/packages/google-cloud-os-login/noxfile.py @@ -47,7 +47,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-os-login" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-os-login/setup.py b/packages/google-cloud-os-login/setup.py index 188ecca9e3ac..fc9fcd2ffe66 100644 --- a/packages/google-cloud-os-login/setup.py +++ b/packages/google-cloud-os-login/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/google-cloud-os-login/testing/constraints-3.10.txt b/packages/google-cloud-os-login/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-os-login/testing/constraints-3.10.txt +++ b/packages/google-cloud-os-login/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-os-login/tests/unit/gapic/oslogin_v1/test_os_login_service.py b/packages/google-cloud-os-login/tests/unit/gapic/oslogin_v1/test_os_login_service.py index a18dd9bd4b2d..a104d594caab 100644 --- a/packages/google-cloud-os-login/tests/unit/gapic/oslogin_v1/test_os_login_service.py +++ b/packages/google-cloud-os-login/tests/unit/gapic/oslogin_v1/test_os_login_service.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 @@ -108,6 +109,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" @@ -1320,8 +1336,8 @@ def test_os_login_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - oslogin.CreateSshPublicKeyRequest, - dict, + oslogin.CreateSshPublicKeyRequest(), + {}, ], ) def test_create_ssh_public_key(request_type, transport: str = "grpc"): @@ -1332,7 +1348,7 @@ def test_create_ssh_public_key(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1386,9 +1402,10 @@ def test_create_ssh_public_key_non_empty_request_with_auto_populated_field(): client.create_ssh_public_key(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == oslogin.CreateSshPublicKeyRequest( + request_msg = oslogin.CreateSshPublicKeyRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_ssh_public_key_use_cached_wrapped_rpc(): @@ -1474,8 +1491,15 @@ async def test_create_ssh_public_key_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + oslogin.CreateSshPublicKeyRequest(), + {}, + ], +) async def test_create_ssh_public_key_async( - transport: str = "grpc_asyncio", request_type=oslogin.CreateSshPublicKeyRequest + request_type, transport: str = "grpc_asyncio" ): client = OsLoginServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1484,7 +1508,7 @@ async def test_create_ssh_public_key_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( @@ -1515,11 +1539,6 @@ async def test_create_ssh_public_key_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_create_ssh_public_key_async_from_dict(): - await test_create_ssh_public_key_async(request_type=dict) - - def test_create_ssh_public_key_field_headers(): client = OsLoginServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1680,8 +1699,8 @@ async def test_create_ssh_public_key_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - oslogin.DeletePosixAccountRequest, - dict, + oslogin.DeletePosixAccountRequest(), + {}, ], ) def test_delete_posix_account(request_type, transport: str = "grpc"): @@ -1692,7 +1711,7 @@ def test_delete_posix_account(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,9 +1756,10 @@ def test_delete_posix_account_non_empty_request_with_auto_populated_field(): client.delete_posix_account(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == oslogin.DeletePosixAccountRequest( + request_msg = oslogin.DeletePosixAccountRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_posix_account_use_cached_wrapped_rpc(): @@ -1824,8 +1844,15 @@ async def test_delete_posix_account_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + oslogin.DeletePosixAccountRequest(), + {}, + ], +) async def test_delete_posix_account_async( - transport: str = "grpc_asyncio", request_type=oslogin.DeletePosixAccountRequest + request_type, transport: str = "grpc_asyncio" ): client = OsLoginServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1834,7 +1861,7 @@ async def test_delete_posix_account_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( @@ -1854,11 +1881,6 @@ async def test_delete_posix_account_async( assert response is None -@pytest.mark.asyncio -async def test_delete_posix_account_async_from_dict(): - await test_delete_posix_account_async(request_type=dict) - - def test_delete_posix_account_field_headers(): client = OsLoginServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2009,8 +2031,8 @@ async def test_delete_posix_account_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - oslogin.DeleteSshPublicKeyRequest, - dict, + oslogin.DeleteSshPublicKeyRequest(), + {}, ], ) def test_delete_ssh_public_key(request_type, transport: str = "grpc"): @@ -2021,7 +2043,7 @@ def test_delete_ssh_public_key(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2066,9 +2088,10 @@ def test_delete_ssh_public_key_non_empty_request_with_auto_populated_field(): client.delete_ssh_public_key(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == oslogin.DeleteSshPublicKeyRequest( + request_msg = oslogin.DeleteSshPublicKeyRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_ssh_public_key_use_cached_wrapped_rpc(): @@ -2154,8 +2177,15 @@ async def test_delete_ssh_public_key_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + oslogin.DeleteSshPublicKeyRequest(), + {}, + ], +) async def test_delete_ssh_public_key_async( - transport: str = "grpc_asyncio", request_type=oslogin.DeleteSshPublicKeyRequest + request_type, transport: str = "grpc_asyncio" ): client = OsLoginServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2164,7 +2194,7 @@ async def test_delete_ssh_public_key_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( @@ -2184,11 +2214,6 @@ async def test_delete_ssh_public_key_async( assert response is None -@pytest.mark.asyncio -async def test_delete_ssh_public_key_async_from_dict(): - await test_delete_ssh_public_key_async(request_type=dict) - - def test_delete_ssh_public_key_field_headers(): client = OsLoginServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2339,8 +2364,8 @@ async def test_delete_ssh_public_key_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - oslogin.GetLoginProfileRequest, - dict, + oslogin.GetLoginProfileRequest(), + {}, ], ) def test_get_login_profile(request_type, transport: str = "grpc"): @@ -2351,7 +2376,7 @@ def test_get_login_profile(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2401,11 +2426,12 @@ def test_get_login_profile_non_empty_request_with_auto_populated_field(): client.get_login_profile(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == oslogin.GetLoginProfileRequest( + request_msg = oslogin.GetLoginProfileRequest( name="name_value", project_id="project_id_value", system_id="system_id_value", ) + assert args[0] == request_msg def test_get_login_profile_use_cached_wrapped_rpc(): @@ -2488,9 +2514,14 @@ async def test_get_login_profile_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_login_profile_async( - transport: str = "grpc_asyncio", request_type=oslogin.GetLoginProfileRequest -): +@pytest.mark.parametrize( + "request_type", + [ + oslogin.GetLoginProfileRequest(), + {}, + ], +) +async def test_get_login_profile_async(request_type, transport: str = "grpc_asyncio"): client = OsLoginServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2498,7 +2529,7 @@ async def test_get_login_profile_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( @@ -2523,11 +2554,6 @@ async def test_get_login_profile_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_login_profile_async_from_dict(): - await test_get_login_profile_async(request_type=dict) - - def test_get_login_profile_field_headers(): client = OsLoginServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2682,8 +2708,8 @@ async def test_get_login_profile_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - oslogin.GetSshPublicKeyRequest, - dict, + oslogin.GetSshPublicKeyRequest(), + {}, ], ) def test_get_ssh_public_key(request_type, transport: str = "grpc"): @@ -2694,7 +2720,7 @@ def test_get_ssh_public_key(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,9 +2774,10 @@ def test_get_ssh_public_key_non_empty_request_with_auto_populated_field(): client.get_ssh_public_key(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == oslogin.GetSshPublicKeyRequest( + request_msg = oslogin.GetSshPublicKeyRequest( name="name_value", ) + assert args[0] == request_msg def test_get_ssh_public_key_use_cached_wrapped_rpc(): @@ -2835,9 +2862,14 @@ async def test_get_ssh_public_key_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_ssh_public_key_async( - transport: str = "grpc_asyncio", request_type=oslogin.GetSshPublicKeyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + oslogin.GetSshPublicKeyRequest(), + {}, + ], +) +async def test_get_ssh_public_key_async(request_type, transport: str = "grpc_asyncio"): client = OsLoginServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2845,7 +2877,7 @@ async def test_get_ssh_public_key_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( @@ -2876,11 +2908,6 @@ async def test_get_ssh_public_key_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_ssh_public_key_async_from_dict(): - await test_get_ssh_public_key_async(request_type=dict) - - def test_get_ssh_public_key_field_headers(): client = OsLoginServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3031,8 +3058,8 @@ async def test_get_ssh_public_key_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - oslogin.ImportSshPublicKeyRequest, - dict, + oslogin.ImportSshPublicKeyRequest(), + {}, ], ) def test_import_ssh_public_key(request_type, transport: str = "grpc"): @@ -3043,7 +3070,7 @@ def test_import_ssh_public_key(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3092,10 +3119,11 @@ def test_import_ssh_public_key_non_empty_request_with_auto_populated_field(): client.import_ssh_public_key(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == oslogin.ImportSshPublicKeyRequest( + request_msg = oslogin.ImportSshPublicKeyRequest( parent="parent_value", project_id="project_id_value", ) + assert args[0] == request_msg def test_import_ssh_public_key_use_cached_wrapped_rpc(): @@ -3181,8 +3209,15 @@ async def test_import_ssh_public_key_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + oslogin.ImportSshPublicKeyRequest(), + {}, + ], +) async def test_import_ssh_public_key_async( - transport: str = "grpc_asyncio", request_type=oslogin.ImportSshPublicKeyRequest + request_type, transport: str = "grpc_asyncio" ): client = OsLoginServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3191,7 +3226,7 @@ async def test_import_ssh_public_key_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( @@ -3216,11 +3251,6 @@ async def test_import_ssh_public_key_async( assert response.details == "details_value" -@pytest.mark.asyncio -async def test_import_ssh_public_key_async_from_dict(): - await test_import_ssh_public_key_async(request_type=dict) - - def test_import_ssh_public_key_field_headers(): client = OsLoginServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3395,8 +3425,8 @@ async def test_import_ssh_public_key_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - oslogin.UpdateSshPublicKeyRequest, - dict, + oslogin.UpdateSshPublicKeyRequest(), + {}, ], ) def test_update_ssh_public_key(request_type, transport: str = "grpc"): @@ -3407,7 +3437,7 @@ def test_update_ssh_public_key(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3461,9 +3491,10 @@ def test_update_ssh_public_key_non_empty_request_with_auto_populated_field(): client.update_ssh_public_key(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == oslogin.UpdateSshPublicKeyRequest( + request_msg = oslogin.UpdateSshPublicKeyRequest( name="name_value", ) + assert args[0] == request_msg def test_update_ssh_public_key_use_cached_wrapped_rpc(): @@ -3549,8 +3580,15 @@ async def test_update_ssh_public_key_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + oslogin.UpdateSshPublicKeyRequest(), + {}, + ], +) async def test_update_ssh_public_key_async( - transport: str = "grpc_asyncio", request_type=oslogin.UpdateSshPublicKeyRequest + request_type, transport: str = "grpc_asyncio" ): client = OsLoginServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3559,7 +3597,7 @@ async def test_update_ssh_public_key_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( @@ -3590,11 +3628,6 @@ async def test_update_ssh_public_key_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_update_ssh_public_key_async_from_dict(): - await test_update_ssh_public_key_async(request_type=dict) - - def test_update_ssh_public_key_field_headers(): client = OsLoginServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5201,7 +5234,6 @@ def test_create_ssh_public_key_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oslogin.CreateSshPublicKeyRequest() - assert args[0] == request_msg @@ -5224,7 +5256,6 @@ def test_delete_posix_account_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oslogin.DeletePosixAccountRequest() - assert args[0] == request_msg @@ -5247,7 +5278,6 @@ def test_delete_ssh_public_key_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oslogin.DeleteSshPublicKeyRequest() - assert args[0] == request_msg @@ -5270,7 +5300,6 @@ def test_get_login_profile_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oslogin.GetLoginProfileRequest() - assert args[0] == request_msg @@ -5293,7 +5322,6 @@ def test_get_ssh_public_key_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oslogin.GetSshPublicKeyRequest() - assert args[0] == request_msg @@ -5316,7 +5344,6 @@ def test_import_ssh_public_key_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oslogin.ImportSshPublicKeyRequest() - assert args[0] == request_msg @@ -5339,7 +5366,6 @@ def test_update_ssh_public_key_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oslogin.UpdateSshPublicKeyRequest() - assert args[0] == request_msg @@ -5385,7 +5411,6 @@ async def test_create_ssh_public_key_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oslogin.CreateSshPublicKeyRequest() - assert args[0] == request_msg @@ -5410,7 +5435,6 @@ async def test_delete_posix_account_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oslogin.DeletePosixAccountRequest() - assert args[0] == request_msg @@ -5435,7 +5459,6 @@ async def test_delete_ssh_public_key_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oslogin.DeleteSshPublicKeyRequest() - assert args[0] == request_msg @@ -5464,7 +5487,6 @@ async def test_get_login_profile_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oslogin.GetLoginProfileRequest() - assert args[0] == request_msg @@ -5496,7 +5518,6 @@ async def test_get_ssh_public_key_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oslogin.GetSshPublicKeyRequest() - assert args[0] == request_msg @@ -5525,7 +5546,6 @@ async def test_import_ssh_public_key_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oslogin.ImportSshPublicKeyRequest() - assert args[0] == request_msg @@ -5557,7 +5577,6 @@ async def test_update_ssh_public_key_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oslogin.UpdateSshPublicKeyRequest() - assert args[0] == request_msg @@ -6703,7 +6722,6 @@ def test_create_ssh_public_key_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oslogin.CreateSshPublicKeyRequest() - assert args[0] == request_msg @@ -6725,7 +6743,6 @@ def test_delete_posix_account_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oslogin.DeletePosixAccountRequest() - assert args[0] == request_msg @@ -6747,7 +6764,6 @@ def test_delete_ssh_public_key_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oslogin.DeleteSshPublicKeyRequest() - assert args[0] == request_msg @@ -6769,7 +6785,6 @@ def test_get_login_profile_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oslogin.GetLoginProfileRequest() - assert args[0] == request_msg @@ -6791,7 +6806,6 @@ def test_get_ssh_public_key_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oslogin.GetSshPublicKeyRequest() - assert args[0] == request_msg @@ -6813,7 +6827,6 @@ def test_import_ssh_public_key_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oslogin.ImportSshPublicKeyRequest() - assert args[0] == request_msg @@ -6835,7 +6848,6 @@ def test_update_ssh_public_key_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = oslogin.UpdateSshPublicKeyRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-parallelstore/noxfile.py b/packages/google-cloud-parallelstore/noxfile.py index 7a2d1c936037..9797fedc7bb5 100644 --- a/packages/google-cloud-parallelstore/noxfile.py +++ b/packages/google-cloud-parallelstore/noxfile.py @@ -47,7 +47,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-parallelstore" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-parallelstore/setup.py b/packages/google-cloud-parallelstore/setup.py index aaefe74f8778..6ef4df5c52ac 100644 --- a/packages/google-cloud-parallelstore/setup.py +++ b/packages/google-cloud-parallelstore/setup.py @@ -45,7 +45,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/google-cloud-parallelstore/testing/constraints-3.10.txt b/packages/google-cloud-parallelstore/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-parallelstore/testing/constraints-3.10.txt +++ b/packages/google-cloud-parallelstore/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-parallelstore/tests/unit/gapic/parallelstore_v1/test_parallelstore.py b/packages/google-cloud-parallelstore/tests/unit/gapic/parallelstore_v1/test_parallelstore.py index 9d733cf54d82..49dc043c5226 100644 --- a/packages/google-cloud-parallelstore/tests/unit/gapic/parallelstore_v1/test_parallelstore.py +++ b/packages/google-cloud-parallelstore/tests/unit/gapic/parallelstore_v1/test_parallelstore.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 @@ -116,6 +117,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" @@ -1315,8 +1331,8 @@ def test_parallelstore_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - parallelstore.ListInstancesRequest, - dict, + parallelstore.ListInstancesRequest(), + {}, ], ) def test_list_instances(request_type, transport: str = "grpc"): @@ -1327,7 +1343,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(type(client.transport.list_instances), "__call__") as call: @@ -1376,12 +1392,13 @@ 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] == parallelstore.ListInstancesRequest( + request_msg = parallelstore.ListInstancesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_instances_use_cached_wrapped_rpc(): @@ -1462,9 +1479,14 @@ async def test_list_instances_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_instances_async( - transport: str = "grpc_asyncio", request_type=parallelstore.ListInstancesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + parallelstore.ListInstancesRequest(), + {}, + ], +) +async def test_list_instances_async(request_type, transport: str = "grpc_asyncio"): client = ParallelstoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1472,7 +1494,7 @@ async def test_list_instances_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_instances), "__call__") as call: @@ -1497,11 +1519,6 @@ async def test_list_instances_async( 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 = ParallelstoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1838,8 +1855,8 @@ async def test_list_instances_async_pages(): @pytest.mark.parametrize( "request_type", [ - parallelstore.GetInstanceRequest, - dict, + parallelstore.GetInstanceRequest(), + {}, ], ) def test_get_instance(request_type, transport: str = "grpc"): @@ -1850,7 +1867,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(type(client.transport.get_instance), "__call__") as call: @@ -1922,9 +1939,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] == parallelstore.GetInstanceRequest( + request_msg = parallelstore.GetInstanceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_instance_use_cached_wrapped_rpc(): @@ -2005,9 +2023,14 @@ async def test_get_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_instance_async( - transport: str = "grpc_asyncio", request_type=parallelstore.GetInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + parallelstore.GetInstanceRequest(), + {}, + ], +) +async def test_get_instance_async(request_type, transport: str = "grpc_asyncio"): client = ParallelstoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2015,7 +2038,7 @@ async def test_get_instance_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_instance), "__call__") as call: @@ -2066,11 +2089,6 @@ async def test_get_instance_async( assert response.deployment_type == parallelstore.DeploymentType.SCRATCH -@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 = ParallelstoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2217,8 +2235,8 @@ async def test_get_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - parallelstore.CreateInstanceRequest, - dict, + parallelstore.CreateInstanceRequest(), + {}, ], ) def test_create_instance(request_type, transport: str = "grpc"): @@ -2229,7 +2247,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(type(client.transport.create_instance), "__call__") as call: @@ -2272,11 +2290,12 @@ 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] == parallelstore.CreateInstanceRequest( + request_msg = parallelstore.CreateInstanceRequest( parent="parent_value", instance_id="instance_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_instance_use_cached_wrapped_rpc(): @@ -2367,9 +2386,14 @@ async def test_create_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_instance_async( - transport: str = "grpc_asyncio", request_type=parallelstore.CreateInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + parallelstore.CreateInstanceRequest(), + {}, + ], +) +async def test_create_instance_async(request_type, transport: str = "grpc_asyncio"): client = ParallelstoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2377,7 +2401,7 @@ async def test_create_instance_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_instance), "__call__") as call: @@ -2397,11 +2421,6 @@ async def test_create_instance_async( 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 = ParallelstoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2568,8 +2587,8 @@ async def test_create_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - parallelstore.UpdateInstanceRequest, - dict, + parallelstore.UpdateInstanceRequest(), + {}, ], ) def test_update_instance(request_type, transport: str = "grpc"): @@ -2580,7 +2599,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(type(client.transport.update_instance), "__call__") as call: @@ -2621,9 +2640,10 @@ 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] == parallelstore.UpdateInstanceRequest( + request_msg = parallelstore.UpdateInstanceRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_instance_use_cached_wrapped_rpc(): @@ -2714,9 +2734,14 @@ async def test_update_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_instance_async( - transport: str = "grpc_asyncio", request_type=parallelstore.UpdateInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + parallelstore.UpdateInstanceRequest(), + {}, + ], +) +async def test_update_instance_async(request_type, transport: str = "grpc_asyncio"): client = ParallelstoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2724,7 +2749,7 @@ async def test_update_instance_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_instance), "__call__") as call: @@ -2744,11 +2769,6 @@ async def test_update_instance_async( 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 = ParallelstoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2905,8 +2925,8 @@ async def test_update_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - parallelstore.DeleteInstanceRequest, - dict, + parallelstore.DeleteInstanceRequest(), + {}, ], ) def test_delete_instance(request_type, transport: str = "grpc"): @@ -2917,7 +2937,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(type(client.transport.delete_instance), "__call__") as call: @@ -2959,10 +2979,11 @@ 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] == parallelstore.DeleteInstanceRequest( + request_msg = parallelstore.DeleteInstanceRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_instance_use_cached_wrapped_rpc(): @@ -3053,9 +3074,14 @@ async def test_delete_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_instance_async( - transport: str = "grpc_asyncio", request_type=parallelstore.DeleteInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + parallelstore.DeleteInstanceRequest(), + {}, + ], +) +async def test_delete_instance_async(request_type, transport: str = "grpc_asyncio"): client = ParallelstoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3063,7 +3089,7 @@ async def test_delete_instance_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_instance), "__call__") as call: @@ -3083,11 +3109,6 @@ async def test_delete_instance_async( 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 = ParallelstoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3234,8 +3255,8 @@ async def test_delete_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - parallelstore.ImportDataRequest, - dict, + parallelstore.ImportDataRequest(), + {}, ], ) def test_import_data(request_type, transport: str = "grpc"): @@ -3246,7 +3267,7 @@ def test_import_data(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.import_data), "__call__") as call: @@ -3288,10 +3309,11 @@ def test_import_data_non_empty_request_with_auto_populated_field(): client.import_data(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == parallelstore.ImportDataRequest( + request_msg = parallelstore.ImportDataRequest( name="name_value", service_account="service_account_value", ) + assert args[0] == request_msg def test_import_data_use_cached_wrapped_rpc(): @@ -3382,9 +3404,14 @@ async def test_import_data_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_import_data_async( - transport: str = "grpc_asyncio", request_type=parallelstore.ImportDataRequest -): +@pytest.mark.parametrize( + "request_type", + [ + parallelstore.ImportDataRequest(), + {}, + ], +) +async def test_import_data_async(request_type, transport: str = "grpc_asyncio"): client = ParallelstoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3392,7 +3419,7 @@ async def test_import_data_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.import_data), "__call__") as call: @@ -3412,11 +3439,6 @@ async def test_import_data_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_import_data_async_from_dict(): - await test_import_data_async(request_type=dict) - - def test_import_data_field_headers(): client = ParallelstoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3481,8 +3503,8 @@ async def test_import_data_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - parallelstore.ExportDataRequest, - dict, + parallelstore.ExportDataRequest(), + {}, ], ) def test_export_data(request_type, transport: str = "grpc"): @@ -3493,7 +3515,7 @@ def test_export_data(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.export_data), "__call__") as call: @@ -3535,10 +3557,11 @@ def test_export_data_non_empty_request_with_auto_populated_field(): client.export_data(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == parallelstore.ExportDataRequest( + request_msg = parallelstore.ExportDataRequest( name="name_value", service_account="service_account_value", ) + assert args[0] == request_msg def test_export_data_use_cached_wrapped_rpc(): @@ -3629,9 +3652,14 @@ async def test_export_data_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_export_data_async( - transport: str = "grpc_asyncio", request_type=parallelstore.ExportDataRequest -): +@pytest.mark.parametrize( + "request_type", + [ + parallelstore.ExportDataRequest(), + {}, + ], +) +async def test_export_data_async(request_type, transport: str = "grpc_asyncio"): client = ParallelstoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3639,7 +3667,7 @@ async def test_export_data_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.export_data), "__call__") as call: @@ -3659,11 +3687,6 @@ async def test_export_data_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_export_data_async_from_dict(): - await test_export_data_async(request_type=dict) - - def test_export_data_field_headers(): client = ParallelstoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5118,7 +5141,6 @@ def test_list_instances_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = parallelstore.ListInstancesRequest() - assert args[0] == request_msg @@ -5139,7 +5161,6 @@ def test_get_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = parallelstore.GetInstanceRequest() - assert args[0] == request_msg @@ -5160,7 +5181,6 @@ def test_create_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = parallelstore.CreateInstanceRequest() - assert args[0] == request_msg @@ -5181,7 +5201,6 @@ def test_update_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = parallelstore.UpdateInstanceRequest() - assert args[0] == request_msg @@ -5202,7 +5221,6 @@ def test_delete_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = parallelstore.DeleteInstanceRequest() - assert args[0] == request_msg @@ -5223,7 +5241,6 @@ def test_import_data_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = parallelstore.ImportDataRequest() - assert args[0] == request_msg @@ -5244,7 +5261,6 @@ def test_export_data_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = parallelstore.ExportDataRequest() - assert args[0] == request_msg @@ -5286,7 +5302,6 @@ async def test_list_instances_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = parallelstore.ListInstancesRequest() - assert args[0] == request_msg @@ -5324,7 +5339,6 @@ async def test_get_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = parallelstore.GetInstanceRequest() - assert args[0] == request_msg @@ -5349,7 +5363,6 @@ async def test_create_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = parallelstore.CreateInstanceRequest() - assert args[0] == request_msg @@ -5374,7 +5387,6 @@ async def test_update_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = parallelstore.UpdateInstanceRequest() - assert args[0] == request_msg @@ -5399,7 +5411,6 @@ async def test_delete_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = parallelstore.DeleteInstanceRequest() - assert args[0] == request_msg @@ -5424,7 +5435,6 @@ async def test_import_data_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = parallelstore.ImportDataRequest() - assert args[0] == request_msg @@ -5449,7 +5459,6 @@ async def test_export_data_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = parallelstore.ExportDataRequest() - assert args[0] == request_msg @@ -6946,7 +6955,6 @@ def test_list_instances_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = parallelstore.ListInstancesRequest() - assert args[0] == request_msg @@ -6966,7 +6974,6 @@ def test_get_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = parallelstore.GetInstanceRequest() - assert args[0] == request_msg @@ -6986,7 +6993,6 @@ def test_create_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = parallelstore.CreateInstanceRequest() - assert args[0] == request_msg @@ -7006,7 +7012,6 @@ def test_update_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = parallelstore.UpdateInstanceRequest() - assert args[0] == request_msg @@ -7026,7 +7031,6 @@ def test_delete_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = parallelstore.DeleteInstanceRequest() - assert args[0] == request_msg @@ -7046,7 +7050,6 @@ def test_import_data_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = parallelstore.ImportDataRequest() - assert args[0] == request_msg @@ -7066,7 +7069,6 @@ def test_export_data_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = parallelstore.ExportDataRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-parallelstore/tests/unit/gapic/parallelstore_v1beta/test_parallelstore.py b/packages/google-cloud-parallelstore/tests/unit/gapic/parallelstore_v1beta/test_parallelstore.py index 8997900909e5..ca25a9106ab3 100644 --- a/packages/google-cloud-parallelstore/tests/unit/gapic/parallelstore_v1beta/test_parallelstore.py +++ b/packages/google-cloud-parallelstore/tests/unit/gapic/parallelstore_v1beta/test_parallelstore.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 @@ -116,6 +117,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" @@ -1315,8 +1331,8 @@ def test_parallelstore_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - parallelstore.ListInstancesRequest, - dict, + parallelstore.ListInstancesRequest(), + {}, ], ) def test_list_instances(request_type, transport: str = "grpc"): @@ -1327,7 +1343,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(type(client.transport.list_instances), "__call__") as call: @@ -1376,12 +1392,13 @@ 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] == parallelstore.ListInstancesRequest( + request_msg = parallelstore.ListInstancesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_instances_use_cached_wrapped_rpc(): @@ -1462,9 +1479,14 @@ async def test_list_instances_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_instances_async( - transport: str = "grpc_asyncio", request_type=parallelstore.ListInstancesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + parallelstore.ListInstancesRequest(), + {}, + ], +) +async def test_list_instances_async(request_type, transport: str = "grpc_asyncio"): client = ParallelstoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1472,7 +1494,7 @@ async def test_list_instances_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_instances), "__call__") as call: @@ -1497,11 +1519,6 @@ async def test_list_instances_async( 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 = ParallelstoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1838,8 +1855,8 @@ async def test_list_instances_async_pages(): @pytest.mark.parametrize( "request_type", [ - parallelstore.GetInstanceRequest, - dict, + parallelstore.GetInstanceRequest(), + {}, ], ) def test_get_instance(request_type, transport: str = "grpc"): @@ -1850,7 +1867,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(type(client.transport.get_instance), "__call__") as call: @@ -1922,9 +1939,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] == parallelstore.GetInstanceRequest( + request_msg = parallelstore.GetInstanceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_instance_use_cached_wrapped_rpc(): @@ -2005,9 +2023,14 @@ async def test_get_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_instance_async( - transport: str = "grpc_asyncio", request_type=parallelstore.GetInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + parallelstore.GetInstanceRequest(), + {}, + ], +) +async def test_get_instance_async(request_type, transport: str = "grpc_asyncio"): client = ParallelstoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2015,7 +2038,7 @@ async def test_get_instance_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_instance), "__call__") as call: @@ -2066,11 +2089,6 @@ async def test_get_instance_async( assert response.deployment_type == parallelstore.DeploymentType.SCRATCH -@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 = ParallelstoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2217,8 +2235,8 @@ async def test_get_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - parallelstore.CreateInstanceRequest, - dict, + parallelstore.CreateInstanceRequest(), + {}, ], ) def test_create_instance(request_type, transport: str = "grpc"): @@ -2229,7 +2247,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(type(client.transport.create_instance), "__call__") as call: @@ -2272,11 +2290,12 @@ 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] == parallelstore.CreateInstanceRequest( + request_msg = parallelstore.CreateInstanceRequest( parent="parent_value", instance_id="instance_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_instance_use_cached_wrapped_rpc(): @@ -2367,9 +2386,14 @@ async def test_create_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_instance_async( - transport: str = "grpc_asyncio", request_type=parallelstore.CreateInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + parallelstore.CreateInstanceRequest(), + {}, + ], +) +async def test_create_instance_async(request_type, transport: str = "grpc_asyncio"): client = ParallelstoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2377,7 +2401,7 @@ async def test_create_instance_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_instance), "__call__") as call: @@ -2397,11 +2421,6 @@ async def test_create_instance_async( 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 = ParallelstoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2568,8 +2587,8 @@ async def test_create_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - parallelstore.UpdateInstanceRequest, - dict, + parallelstore.UpdateInstanceRequest(), + {}, ], ) def test_update_instance(request_type, transport: str = "grpc"): @@ -2580,7 +2599,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(type(client.transport.update_instance), "__call__") as call: @@ -2621,9 +2640,10 @@ 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] == parallelstore.UpdateInstanceRequest( + request_msg = parallelstore.UpdateInstanceRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_instance_use_cached_wrapped_rpc(): @@ -2714,9 +2734,14 @@ async def test_update_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_instance_async( - transport: str = "grpc_asyncio", request_type=parallelstore.UpdateInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + parallelstore.UpdateInstanceRequest(), + {}, + ], +) +async def test_update_instance_async(request_type, transport: str = "grpc_asyncio"): client = ParallelstoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2724,7 +2749,7 @@ async def test_update_instance_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_instance), "__call__") as call: @@ -2744,11 +2769,6 @@ async def test_update_instance_async( 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 = ParallelstoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2905,8 +2925,8 @@ async def test_update_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - parallelstore.DeleteInstanceRequest, - dict, + parallelstore.DeleteInstanceRequest(), + {}, ], ) def test_delete_instance(request_type, transport: str = "grpc"): @@ -2917,7 +2937,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(type(client.transport.delete_instance), "__call__") as call: @@ -2959,10 +2979,11 @@ 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] == parallelstore.DeleteInstanceRequest( + request_msg = parallelstore.DeleteInstanceRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_instance_use_cached_wrapped_rpc(): @@ -3053,9 +3074,14 @@ async def test_delete_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_instance_async( - transport: str = "grpc_asyncio", request_type=parallelstore.DeleteInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + parallelstore.DeleteInstanceRequest(), + {}, + ], +) +async def test_delete_instance_async(request_type, transport: str = "grpc_asyncio"): client = ParallelstoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3063,7 +3089,7 @@ async def test_delete_instance_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_instance), "__call__") as call: @@ -3083,11 +3109,6 @@ async def test_delete_instance_async( 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 = ParallelstoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3234,8 +3255,8 @@ async def test_delete_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - parallelstore.ImportDataRequest, - dict, + parallelstore.ImportDataRequest(), + {}, ], ) def test_import_data(request_type, transport: str = "grpc"): @@ -3246,7 +3267,7 @@ def test_import_data(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.import_data), "__call__") as call: @@ -3288,10 +3309,11 @@ def test_import_data_non_empty_request_with_auto_populated_field(): client.import_data(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == parallelstore.ImportDataRequest( + request_msg = parallelstore.ImportDataRequest( name="name_value", service_account="service_account_value", ) + assert args[0] == request_msg def test_import_data_use_cached_wrapped_rpc(): @@ -3382,9 +3404,14 @@ async def test_import_data_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_import_data_async( - transport: str = "grpc_asyncio", request_type=parallelstore.ImportDataRequest -): +@pytest.mark.parametrize( + "request_type", + [ + parallelstore.ImportDataRequest(), + {}, + ], +) +async def test_import_data_async(request_type, transport: str = "grpc_asyncio"): client = ParallelstoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3392,7 +3419,7 @@ async def test_import_data_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.import_data), "__call__") as call: @@ -3412,11 +3439,6 @@ async def test_import_data_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_import_data_async_from_dict(): - await test_import_data_async(request_type=dict) - - def test_import_data_field_headers(): client = ParallelstoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3481,8 +3503,8 @@ async def test_import_data_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - parallelstore.ExportDataRequest, - dict, + parallelstore.ExportDataRequest(), + {}, ], ) def test_export_data(request_type, transport: str = "grpc"): @@ -3493,7 +3515,7 @@ def test_export_data(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.export_data), "__call__") as call: @@ -3535,10 +3557,11 @@ def test_export_data_non_empty_request_with_auto_populated_field(): client.export_data(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == parallelstore.ExportDataRequest( + request_msg = parallelstore.ExportDataRequest( name="name_value", service_account="service_account_value", ) + assert args[0] == request_msg def test_export_data_use_cached_wrapped_rpc(): @@ -3629,9 +3652,14 @@ async def test_export_data_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_export_data_async( - transport: str = "grpc_asyncio", request_type=parallelstore.ExportDataRequest -): +@pytest.mark.parametrize( + "request_type", + [ + parallelstore.ExportDataRequest(), + {}, + ], +) +async def test_export_data_async(request_type, transport: str = "grpc_asyncio"): client = ParallelstoreAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3639,7 +3667,7 @@ async def test_export_data_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.export_data), "__call__") as call: @@ -3659,11 +3687,6 @@ async def test_export_data_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_export_data_async_from_dict(): - await test_export_data_async(request_type=dict) - - def test_export_data_field_headers(): client = ParallelstoreClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5122,7 +5145,6 @@ def test_list_instances_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = parallelstore.ListInstancesRequest() - assert args[0] == request_msg @@ -5143,7 +5165,6 @@ def test_get_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = parallelstore.GetInstanceRequest() - assert args[0] == request_msg @@ -5164,7 +5185,6 @@ def test_create_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = parallelstore.CreateInstanceRequest() - assert args[0] == request_msg @@ -5185,7 +5205,6 @@ def test_update_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = parallelstore.UpdateInstanceRequest() - assert args[0] == request_msg @@ -5206,7 +5225,6 @@ def test_delete_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = parallelstore.DeleteInstanceRequest() - assert args[0] == request_msg @@ -5227,7 +5245,6 @@ def test_import_data_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = parallelstore.ImportDataRequest() - assert args[0] == request_msg @@ -5248,7 +5265,6 @@ def test_export_data_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = parallelstore.ExportDataRequest() - assert args[0] == request_msg @@ -5290,7 +5306,6 @@ async def test_list_instances_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = parallelstore.ListInstancesRequest() - assert args[0] == request_msg @@ -5328,7 +5343,6 @@ async def test_get_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = parallelstore.GetInstanceRequest() - assert args[0] == request_msg @@ -5353,7 +5367,6 @@ async def test_create_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = parallelstore.CreateInstanceRequest() - assert args[0] == request_msg @@ -5378,7 +5391,6 @@ async def test_update_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = parallelstore.UpdateInstanceRequest() - assert args[0] == request_msg @@ -5403,7 +5415,6 @@ async def test_delete_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = parallelstore.DeleteInstanceRequest() - assert args[0] == request_msg @@ -5428,7 +5439,6 @@ async def test_import_data_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = parallelstore.ImportDataRequest() - assert args[0] == request_msg @@ -5453,7 +5463,6 @@ async def test_export_data_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = parallelstore.ExportDataRequest() - assert args[0] == request_msg @@ -6950,7 +6959,6 @@ def test_list_instances_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = parallelstore.ListInstancesRequest() - assert args[0] == request_msg @@ -6970,7 +6978,6 @@ def test_get_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = parallelstore.GetInstanceRequest() - assert args[0] == request_msg @@ -6990,7 +6997,6 @@ def test_create_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = parallelstore.CreateInstanceRequest() - assert args[0] == request_msg @@ -7010,7 +7016,6 @@ def test_update_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = parallelstore.UpdateInstanceRequest() - assert args[0] == request_msg @@ -7030,7 +7035,6 @@ def test_delete_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = parallelstore.DeleteInstanceRequest() - assert args[0] == request_msg @@ -7050,7 +7054,6 @@ def test_import_data_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = parallelstore.ImportDataRequest() - assert args[0] == request_msg @@ -7070,7 +7073,6 @@ def test_export_data_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = parallelstore.ExportDataRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-parametermanager/noxfile.py b/packages/google-cloud-parametermanager/noxfile.py index 590151d6b362..7cc0bf8cba28 100644 --- a/packages/google-cloud-parametermanager/noxfile.py +++ b/packages/google-cloud-parametermanager/noxfile.py @@ -47,7 +47,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-parametermanager" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-parametermanager/setup.py b/packages/google-cloud-parametermanager/setup.py index 9c0edc013487..96a75cc8f4ca 100644 --- a/packages/google-cloud-parametermanager/setup.py +++ b/packages/google-cloud-parametermanager/setup.py @@ -45,7 +45,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/google-cloud-parametermanager/testing/constraints-3.10.txt b/packages/google-cloud-parametermanager/testing/constraints-3.10.txt index a92801e1c8e2..b39cd54634f9 100644 --- a/packages/google-cloud-parametermanager/testing/constraints-3.10.txt +++ b/packages/google-cloud-parametermanager/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/google-cloud-parametermanager/tests/unit/gapic/parametermanager_v1/test_parameter_manager.py b/packages/google-cloud-parametermanager/tests/unit/gapic/parametermanager_v1/test_parameter_manager.py index 12b5ca3b6645..7ed3b80a78df 100644 --- a/packages/google-cloud-parametermanager/tests/unit/gapic/parametermanager_v1/test_parameter_manager.py +++ b/packages/google-cloud-parametermanager/tests/unit/gapic/parametermanager_v1/test_parameter_manager.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" @@ -1344,8 +1360,8 @@ def test_parameter_manager_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - service.ListParametersRequest, - dict, + service.ListParametersRequest(), + {}, ], ) def test_list_parameters(request_type, transport: str = "grpc"): @@ -1356,7 +1372,7 @@ def test_list_parameters(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_parameters), "__call__") as call: @@ -1405,12 +1421,13 @@ def test_list_parameters_non_empty_request_with_auto_populated_field(): client.list_parameters(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListParametersRequest( + request_msg = service.ListParametersRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_parameters_use_cached_wrapped_rpc(): @@ -1491,9 +1508,14 @@ async def test_list_parameters_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_parameters_async( - transport: str = "grpc_asyncio", request_type=service.ListParametersRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListParametersRequest(), + {}, + ], +) +async def test_list_parameters_async(request_type, transport: str = "grpc_asyncio"): client = ParameterManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1501,7 +1523,7 @@ async def test_list_parameters_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_parameters), "__call__") as call: @@ -1526,11 +1548,6 @@ async def test_list_parameters_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_parameters_async_from_dict(): - await test_list_parameters_async(request_type=dict) - - def test_list_parameters_field_headers(): client = ParameterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1867,8 +1884,8 @@ async def test_list_parameters_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetParameterRequest, - dict, + service.GetParameterRequest(), + {}, ], ) def test_get_parameter(request_type, transport: str = "grpc"): @@ -1879,7 +1896,7 @@ def test_get_parameter(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_parameter), "__call__") as call: @@ -1927,9 +1944,10 @@ def test_get_parameter_non_empty_request_with_auto_populated_field(): client.get_parameter(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetParameterRequest( + request_msg = service.GetParameterRequest( name="name_value", ) + assert args[0] == request_msg def test_get_parameter_use_cached_wrapped_rpc(): @@ -2010,9 +2028,14 @@ async def test_get_parameter_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_parameter_async( - transport: str = "grpc_asyncio", request_type=service.GetParameterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetParameterRequest(), + {}, + ], +) +async def test_get_parameter_async(request_type, transport: str = "grpc_asyncio"): client = ParameterManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2020,7 +2043,7 @@ async def test_get_parameter_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_parameter), "__call__") as call: @@ -2047,11 +2070,6 @@ async def test_get_parameter_async( assert response.kms_key == "kms_key_value" -@pytest.mark.asyncio -async def test_get_parameter_async_from_dict(): - await test_get_parameter_async(request_type=dict) - - def test_get_parameter_field_headers(): client = ParameterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2194,8 +2212,8 @@ async def test_get_parameter_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.CreateParameterRequest, - dict, + service.CreateParameterRequest(), + {}, ], ) def test_create_parameter(request_type, transport: str = "grpc"): @@ -2206,7 +2224,7 @@ def test_create_parameter(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_parameter), "__call__") as call: @@ -2255,10 +2273,11 @@ def test_create_parameter_non_empty_request_with_auto_populated_field(): client.create_parameter(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateParameterRequest( + request_msg = service.CreateParameterRequest( parent="parent_value", parameter_id="parameter_id_value", ) + assert args[0] == request_msg def test_create_parameter_use_cached_wrapped_rpc(): @@ -2341,9 +2360,14 @@ async def test_create_parameter_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_parameter_async( - transport: str = "grpc_asyncio", request_type=service.CreateParameterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CreateParameterRequest(), + {}, + ], +) +async def test_create_parameter_async(request_type, transport: str = "grpc_asyncio"): client = ParameterManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2351,7 +2375,7 @@ async def test_create_parameter_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_parameter), "__call__") as call: @@ -2378,11 +2402,6 @@ async def test_create_parameter_async( assert response.kms_key == "kms_key_value" -@pytest.mark.asyncio -async def test_create_parameter_async_from_dict(): - await test_create_parameter_async(request_type=dict) - - def test_create_parameter_field_headers(): client = ParameterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2545,8 +2564,8 @@ async def test_create_parameter_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdateParameterRequest, - dict, + service.UpdateParameterRequest(), + {}, ], ) def test_update_parameter(request_type, transport: str = "grpc"): @@ -2557,7 +2576,7 @@ def test_update_parameter(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_parameter), "__call__") as call: @@ -2603,7 +2622,8 @@ def test_update_parameter_non_empty_request_with_auto_populated_field(): client.update_parameter(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateParameterRequest() + request_msg = service.UpdateParameterRequest() + assert args[0] == request_msg def test_update_parameter_use_cached_wrapped_rpc(): @@ -2686,9 +2706,14 @@ async def test_update_parameter_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_parameter_async( - transport: str = "grpc_asyncio", request_type=service.UpdateParameterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateParameterRequest(), + {}, + ], +) +async def test_update_parameter_async(request_type, transport: str = "grpc_asyncio"): client = ParameterManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2696,7 +2721,7 @@ async def test_update_parameter_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_parameter), "__call__") as call: @@ -2723,11 +2748,6 @@ async def test_update_parameter_async( assert response.kms_key == "kms_key_value" -@pytest.mark.asyncio -async def test_update_parameter_async_from_dict(): - await test_update_parameter_async(request_type=dict) - - def test_update_parameter_field_headers(): client = ParameterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2880,8 +2900,8 @@ async def test_update_parameter_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DeleteParameterRequest, - dict, + service.DeleteParameterRequest(), + {}, ], ) def test_delete_parameter(request_type, transport: str = "grpc"): @@ -2892,7 +2912,7 @@ def test_delete_parameter(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_parameter), "__call__") as call: @@ -2933,9 +2953,10 @@ def test_delete_parameter_non_empty_request_with_auto_populated_field(): client.delete_parameter(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteParameterRequest( + request_msg = service.DeleteParameterRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_parameter_use_cached_wrapped_rpc(): @@ -3018,9 +3039,14 @@ async def test_delete_parameter_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_parameter_async( - transport: str = "grpc_asyncio", request_type=service.DeleteParameterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteParameterRequest(), + {}, + ], +) +async def test_delete_parameter_async(request_type, transport: str = "grpc_asyncio"): client = ParameterManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3028,7 +3054,7 @@ async def test_delete_parameter_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_parameter), "__call__") as call: @@ -3046,11 +3072,6 @@ async def test_delete_parameter_async( assert response is None -@pytest.mark.asyncio -async def test_delete_parameter_async_from_dict(): - await test_delete_parameter_async(request_type=dict) - - def test_delete_parameter_field_headers(): client = ParameterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3193,8 +3214,8 @@ async def test_delete_parameter_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListParameterVersionsRequest, - dict, + service.ListParameterVersionsRequest(), + {}, ], ) def test_list_parameter_versions(request_type, transport: str = "grpc"): @@ -3205,7 +3226,7 @@ def test_list_parameter_versions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3258,12 +3279,13 @@ def test_list_parameter_versions_non_empty_request_with_auto_populated_field(): client.list_parameter_versions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListParameterVersionsRequest( + request_msg = service.ListParameterVersionsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_parameter_versions_use_cached_wrapped_rpc(): @@ -3349,8 +3371,15 @@ async def test_list_parameter_versions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.ListParameterVersionsRequest(), + {}, + ], +) async def test_list_parameter_versions_async( - transport: str = "grpc_asyncio", request_type=service.ListParameterVersionsRequest + request_type, transport: str = "grpc_asyncio" ): client = ParameterManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -3359,7 +3388,7 @@ async def test_list_parameter_versions_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( @@ -3386,11 +3415,6 @@ async def test_list_parameter_versions_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_parameter_versions_async_from_dict(): - await test_list_parameter_versions_async(request_type=dict) - - def test_list_parameter_versions_field_headers(): client = ParameterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3743,8 +3767,8 @@ async def test_list_parameter_versions_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetParameterVersionRequest, - dict, + service.GetParameterVersionRequest(), + {}, ], ) def test_get_parameter_version(request_type, transport: str = "grpc"): @@ -3755,7 +3779,7 @@ def test_get_parameter_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3807,9 +3831,10 @@ def test_get_parameter_version_non_empty_request_with_auto_populated_field(): client.get_parameter_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetParameterVersionRequest( + request_msg = service.GetParameterVersionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_parameter_version_use_cached_wrapped_rpc(): @@ -3895,8 +3920,15 @@ async def test_get_parameter_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.GetParameterVersionRequest(), + {}, + ], +) async def test_get_parameter_version_async( - transport: str = "grpc_asyncio", request_type=service.GetParameterVersionRequest + request_type, transport: str = "grpc_asyncio" ): client = ParameterManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -3905,7 +3937,7 @@ async def test_get_parameter_version_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( @@ -3934,11 +3966,6 @@ async def test_get_parameter_version_async( assert response.kms_key_version == "kms_key_version_value" -@pytest.mark.asyncio -async def test_get_parameter_version_async_from_dict(): - await test_get_parameter_version_async(request_type=dict) - - def test_get_parameter_version_field_headers(): client = ParameterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4093,8 +4120,8 @@ async def test_get_parameter_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.RenderParameterVersionRequest, - dict, + service.RenderParameterVersionRequest(), + {}, ], ) def test_render_parameter_version(request_type, transport: str = "grpc"): @@ -4105,7 +4132,7 @@ def test_render_parameter_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4155,9 +4182,10 @@ def test_render_parameter_version_non_empty_request_with_auto_populated_field(): client.render_parameter_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.RenderParameterVersionRequest( + request_msg = service.RenderParameterVersionRequest( name="name_value", ) + assert args[0] == request_msg def test_render_parameter_version_use_cached_wrapped_rpc(): @@ -4243,8 +4271,15 @@ async def test_render_parameter_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.RenderParameterVersionRequest(), + {}, + ], +) async def test_render_parameter_version_async( - transport: str = "grpc_asyncio", request_type=service.RenderParameterVersionRequest + request_type, transport: str = "grpc_asyncio" ): client = ParameterManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -4253,7 +4288,7 @@ async def test_render_parameter_version_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( @@ -4280,11 +4315,6 @@ async def test_render_parameter_version_async( assert response.rendered_payload == b"rendered_payload_blob" -@pytest.mark.asyncio -async def test_render_parameter_version_async_from_dict(): - await test_render_parameter_version_async(request_type=dict) - - def test_render_parameter_version_field_headers(): client = ParameterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4439,8 +4469,8 @@ async def test_render_parameter_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.CreateParameterVersionRequest, - dict, + service.CreateParameterVersionRequest(), + {}, ], ) def test_create_parameter_version(request_type, transport: str = "grpc"): @@ -4451,7 +4481,7 @@ def test_create_parameter_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4504,10 +4534,11 @@ def test_create_parameter_version_non_empty_request_with_auto_populated_field(): client.create_parameter_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateParameterVersionRequest( + request_msg = service.CreateParameterVersionRequest( parent="parent_value", parameter_version_id="parameter_version_id_value", ) + assert args[0] == request_msg def test_create_parameter_version_use_cached_wrapped_rpc(): @@ -4593,8 +4624,15 @@ async def test_create_parameter_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.CreateParameterVersionRequest(), + {}, + ], +) async def test_create_parameter_version_async( - transport: str = "grpc_asyncio", request_type=service.CreateParameterVersionRequest + request_type, transport: str = "grpc_asyncio" ): client = ParameterManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -4603,7 +4641,7 @@ async def test_create_parameter_version_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( @@ -4632,11 +4670,6 @@ async def test_create_parameter_version_async( assert response.kms_key_version == "kms_key_version_value" -@pytest.mark.asyncio -async def test_create_parameter_version_async_from_dict(): - await test_create_parameter_version_async(request_type=dict) - - def test_create_parameter_version_field_headers(): client = ParameterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4811,8 +4844,8 @@ async def test_create_parameter_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdateParameterVersionRequest, - dict, + service.UpdateParameterVersionRequest(), + {}, ], ) def test_update_parameter_version(request_type, transport: str = "grpc"): @@ -4823,7 +4856,7 @@ def test_update_parameter_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4873,7 +4906,8 @@ def test_update_parameter_version_non_empty_request_with_auto_populated_field(): client.update_parameter_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateParameterVersionRequest() + request_msg = service.UpdateParameterVersionRequest() + assert args[0] == request_msg def test_update_parameter_version_use_cached_wrapped_rpc(): @@ -4959,8 +4993,15 @@ async def test_update_parameter_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateParameterVersionRequest(), + {}, + ], +) async def test_update_parameter_version_async( - transport: str = "grpc_asyncio", request_type=service.UpdateParameterVersionRequest + request_type, transport: str = "grpc_asyncio" ): client = ParameterManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -4969,7 +5010,7 @@ async def test_update_parameter_version_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( @@ -4998,11 +5039,6 @@ async def test_update_parameter_version_async( assert response.kms_key_version == "kms_key_version_value" -@pytest.mark.asyncio -async def test_update_parameter_version_async_from_dict(): - await test_update_parameter_version_async(request_type=dict) - - def test_update_parameter_version_field_headers(): client = ParameterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5167,8 +5203,8 @@ async def test_update_parameter_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DeleteParameterVersionRequest, - dict, + service.DeleteParameterVersionRequest(), + {}, ], ) def test_delete_parameter_version(request_type, transport: str = "grpc"): @@ -5179,7 +5215,7 @@ def test_delete_parameter_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5224,9 +5260,10 @@ def test_delete_parameter_version_non_empty_request_with_auto_populated_field(): client.delete_parameter_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteParameterVersionRequest( + request_msg = service.DeleteParameterVersionRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_parameter_version_use_cached_wrapped_rpc(): @@ -5312,8 +5349,15 @@ async def test_delete_parameter_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteParameterVersionRequest(), + {}, + ], +) async def test_delete_parameter_version_async( - transport: str = "grpc_asyncio", request_type=service.DeleteParameterVersionRequest + request_type, transport: str = "grpc_asyncio" ): client = ParameterManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -5322,7 +5366,7 @@ async def test_delete_parameter_version_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( @@ -5342,11 +5386,6 @@ async def test_delete_parameter_version_async( assert response is None -@pytest.mark.asyncio -async def test_delete_parameter_version_async_from_dict(): - await test_delete_parameter_version_async(request_type=dict) - - def test_delete_parameter_version_field_headers(): client = ParameterManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7893,7 +7932,6 @@ def test_list_parameters_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListParametersRequest() - assert args[0] == request_msg @@ -7914,7 +7952,6 @@ def test_get_parameter_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetParameterRequest() - assert args[0] == request_msg @@ -7935,7 +7972,6 @@ def test_create_parameter_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateParameterRequest() - assert args[0] == request_msg @@ -7956,7 +7992,6 @@ def test_update_parameter_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateParameterRequest() - assert args[0] == request_msg @@ -7977,7 +8012,6 @@ def test_delete_parameter_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteParameterRequest() - assert args[0] == request_msg @@ -8000,7 +8034,6 @@ def test_list_parameter_versions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListParameterVersionsRequest() - assert args[0] == request_msg @@ -8023,7 +8056,6 @@ def test_get_parameter_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetParameterVersionRequest() - assert args[0] == request_msg @@ -8046,7 +8078,6 @@ def test_render_parameter_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.RenderParameterVersionRequest() - assert args[0] == request_msg @@ -8069,7 +8100,6 @@ def test_create_parameter_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateParameterVersionRequest() - assert args[0] == request_msg @@ -8092,7 +8122,6 @@ def test_update_parameter_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateParameterVersionRequest() - assert args[0] == request_msg @@ -8115,7 +8144,6 @@ def test_delete_parameter_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteParameterVersionRequest() - assert args[0] == request_msg @@ -8157,7 +8185,6 @@ async def test_list_parameters_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListParametersRequest() - assert args[0] == request_msg @@ -8186,7 +8213,6 @@ async def test_get_parameter_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetParameterRequest() - assert args[0] == request_msg @@ -8215,7 +8241,6 @@ async def test_create_parameter_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateParameterRequest() - assert args[0] == request_msg @@ -8244,7 +8269,6 @@ async def test_update_parameter_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateParameterRequest() - assert args[0] == request_msg @@ -8267,7 +8291,6 @@ async def test_delete_parameter_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteParameterRequest() - assert args[0] == request_msg @@ -8297,7 +8320,6 @@ async def test_list_parameter_versions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListParameterVersionsRequest() - assert args[0] == request_msg @@ -8328,7 +8350,6 @@ async def test_get_parameter_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetParameterVersionRequest() - assert args[0] == request_msg @@ -8358,7 +8379,6 @@ async def test_render_parameter_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.RenderParameterVersionRequest() - assert args[0] == request_msg @@ -8389,7 +8409,6 @@ async def test_create_parameter_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateParameterVersionRequest() - assert args[0] == request_msg @@ -8420,7 +8439,6 @@ async def test_update_parameter_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateParameterVersionRequest() - assert args[0] == request_msg @@ -8445,7 +8463,6 @@ async def test_delete_parameter_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteParameterVersionRequest() - assert args[0] == request_msg @@ -10354,7 +10371,6 @@ def test_list_parameters_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListParametersRequest() - assert args[0] == request_msg @@ -10374,7 +10390,6 @@ def test_get_parameter_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetParameterRequest() - assert args[0] == request_msg @@ -10394,7 +10409,6 @@ def test_create_parameter_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateParameterRequest() - assert args[0] == request_msg @@ -10414,7 +10428,6 @@ def test_update_parameter_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateParameterRequest() - assert args[0] == request_msg @@ -10434,7 +10447,6 @@ def test_delete_parameter_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteParameterRequest() - assert args[0] == request_msg @@ -10456,7 +10468,6 @@ def test_list_parameter_versions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListParameterVersionsRequest() - assert args[0] == request_msg @@ -10478,7 +10489,6 @@ def test_get_parameter_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetParameterVersionRequest() - assert args[0] == request_msg @@ -10500,7 +10510,6 @@ def test_render_parameter_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.RenderParameterVersionRequest() - assert args[0] == request_msg @@ -10522,7 +10531,6 @@ def test_create_parameter_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateParameterVersionRequest() - assert args[0] == request_msg @@ -10544,7 +10552,6 @@ def test_update_parameter_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateParameterVersionRequest() - assert args[0] == request_msg @@ -10566,7 +10573,6 @@ def test_delete_parameter_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteParameterVersionRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-phishing-protection/noxfile.py b/packages/google-cloud-phishing-protection/noxfile.py index d7a35b6c2ecd..26b29d321260 100644 --- a/packages/google-cloud-phishing-protection/noxfile.py +++ b/packages/google-cloud-phishing-protection/noxfile.py @@ -47,7 +47,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-phishing-protection" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-phishing-protection/setup.py b/packages/google-cloud-phishing-protection/setup.py index 82ba88eec4c5..5f84e31c66e3 100644 --- a/packages/google-cloud-phishing-protection/setup.py +++ b/packages/google-cloud-phishing-protection/setup.py @@ -45,7 +45,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/google-cloud-phishing-protection/testing/constraints-3.10.txt b/packages/google-cloud-phishing-protection/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-phishing-protection/testing/constraints-3.10.txt +++ b/packages/google-cloud-phishing-protection/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-phishing-protection/tests/unit/gapic/phishingprotection_v1beta1/test_phishing_protection_service_v1_beta1.py b/packages/google-cloud-phishing-protection/tests/unit/gapic/phishingprotection_v1beta1/test_phishing_protection_service_v1_beta1.py index 044b9fa34d7e..9704b4a5aa62 100644 --- a/packages/google-cloud-phishing-protection/tests/unit/gapic/phishingprotection_v1beta1/test_phishing_protection_service_v1_beta1.py +++ b/packages/google-cloud-phishing-protection/tests/unit/gapic/phishingprotection_v1beta1/test_phishing_protection_service_v1_beta1.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 @@ -106,6 +107,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" @@ -1449,8 +1465,8 @@ def test_phishing_protection_service_v1_beta1_client_create_channel_credentials_ @pytest.mark.parametrize( "request_type", [ - phishingprotection.ReportPhishingRequest, - dict, + phishingprotection.ReportPhishingRequest(), + {}, ], ) def test_report_phishing(request_type, transport: str = "grpc"): @@ -1461,7 +1477,7 @@ def test_report_phishing(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.report_phishing), "__call__") as call: @@ -1503,10 +1519,11 @@ def test_report_phishing_non_empty_request_with_auto_populated_field(): client.report_phishing(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == phishingprotection.ReportPhishingRequest( + request_msg = phishingprotection.ReportPhishingRequest( parent="parent_value", uri="uri_value", ) + assert args[0] == request_msg def test_report_phishing_use_cached_wrapped_rpc(): @@ -1587,10 +1604,14 @@ async def test_report_phishing_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_report_phishing_async( - transport: str = "grpc_asyncio", - request_type=phishingprotection.ReportPhishingRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + phishingprotection.ReportPhishingRequest(), + {}, + ], +) +async def test_report_phishing_async(request_type, transport: str = "grpc_asyncio"): client = PhishingProtectionServiceV1Beta1AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1598,7 +1619,7 @@ async def test_report_phishing_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.report_phishing), "__call__") as call: @@ -1618,11 +1639,6 @@ async def test_report_phishing_async( assert isinstance(response, phishingprotection.ReportPhishingResponse) -@pytest.mark.asyncio -async def test_report_phishing_async_from_dict(): - await test_report_phishing_async(request_type=dict) - - def test_report_phishing_field_headers(): client = PhishingProtectionServiceV1Beta1Client( credentials=ga_credentials.AnonymousCredentials(), @@ -2091,7 +2107,6 @@ def test_report_phishing_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = phishingprotection.ReportPhishingRequest() - assert args[0] == request_msg @@ -2130,7 +2145,6 @@ async def test_report_phishing_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = phishingprotection.ReportPhishingRequest() - assert args[0] == request_msg @@ -2299,7 +2313,6 @@ def test_report_phishing_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = phishingprotection.ReportPhishingRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-policy-troubleshooter/noxfile.py b/packages/google-cloud-policy-troubleshooter/noxfile.py index 1f1839d93e8e..e58bdb90dc5d 100644 --- a/packages/google-cloud-policy-troubleshooter/noxfile.py +++ b/packages/google-cloud-policy-troubleshooter/noxfile.py @@ -47,7 +47,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-policy-troubleshooter" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-policy-troubleshooter/setup.py b/packages/google-cloud-policy-troubleshooter/setup.py index 1db068b0e36c..4b0add742904 100644 --- a/packages/google-cloud-policy-troubleshooter/setup.py +++ b/packages/google-cloud-policy-troubleshooter/setup.py @@ -45,7 +45,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/google-cloud-policy-troubleshooter/testing/constraints-3.10.txt b/packages/google-cloud-policy-troubleshooter/testing/constraints-3.10.txt index a92801e1c8e2..b39cd54634f9 100644 --- a/packages/google-cloud-policy-troubleshooter/testing/constraints-3.10.txt +++ b/packages/google-cloud-policy-troubleshooter/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/google-cloud-policy-troubleshooter/tests/unit/gapic/policytroubleshooter_v1/test_iam_checker.py b/packages/google-cloud-policy-troubleshooter/tests/unit/gapic/policytroubleshooter_v1/test_iam_checker.py index 1b12ee3b6095..42557d6d1e58 100644 --- a/packages/google-cloud-policy-troubleshooter/tests/unit/gapic/policytroubleshooter_v1/test_iam_checker.py +++ b/packages/google-cloud-policy-troubleshooter/tests/unit/gapic/policytroubleshooter_v1/test_iam_checker.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 @@ -107,6 +108,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" @@ -1268,8 +1284,8 @@ def test_iam_checker_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - checker.TroubleshootIamPolicyRequest, - dict, + checker.TroubleshootIamPolicyRequest(), + {}, ], ) def test_troubleshoot_iam_policy(request_type, transport: str = "grpc"): @@ -1280,7 +1296,7 @@ def test_troubleshoot_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( @@ -1326,7 +1342,8 @@ def test_troubleshoot_iam_policy_non_empty_request_with_auto_populated_field(): client.troubleshoot_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == checker.TroubleshootIamPolicyRequest() + request_msg = checker.TroubleshootIamPolicyRequest() + assert args[0] == request_msg def test_troubleshoot_iam_policy_use_cached_wrapped_rpc(): @@ -1412,8 +1429,15 @@ async def test_troubleshoot_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + checker.TroubleshootIamPolicyRequest(), + {}, + ], +) async def test_troubleshoot_iam_policy_async( - transport: str = "grpc_asyncio", request_type=checker.TroubleshootIamPolicyRequest + request_type, transport: str = "grpc_asyncio" ): client = IamCheckerAsyncClient( credentials=async_anonymous_credentials(), @@ -1422,7 +1446,7 @@ async def test_troubleshoot_iam_policy_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( @@ -1447,11 +1471,6 @@ async def test_troubleshoot_iam_policy_async( assert response.access == explanations.AccessState.GRANTED -@pytest.mark.asyncio -async def test_troubleshoot_iam_policy_async_from_dict(): - await test_troubleshoot_iam_policy_async(request_type=dict) - - def test_troubleshoot_iam_policy_rest_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, # instead of constructing them on each call @@ -1618,7 +1637,6 @@ def test_troubleshoot_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = checker.TroubleshootIamPolicyRequest() - assert args[0] == request_msg @@ -1661,7 +1679,6 @@ async def test_troubleshoot_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = checker.TroubleshootIamPolicyRequest() - assert args[0] == request_msg @@ -1833,7 +1850,6 @@ def test_troubleshoot_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = checker.TroubleshootIamPolicyRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-policysimulator/noxfile.py b/packages/google-cloud-policysimulator/noxfile.py index 718d0c8131f7..3d3c18d50ed7 100644 --- a/packages/google-cloud-policysimulator/noxfile.py +++ b/packages/google-cloud-policysimulator/noxfile.py @@ -47,7 +47,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-policysimulator" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-policysimulator/setup.py b/packages/google-cloud-policysimulator/setup.py index 3a31955686a1..2fcef358e8bc 100644 --- a/packages/google-cloud-policysimulator/setup.py +++ b/packages/google-cloud-policysimulator/setup.py @@ -46,7 +46,7 @@ # See https://github.com/googleapis/google-cloud-python/issues/12364 "google-auth >= 2.14.1, <3.0.0,!=2.24.0,!=2.25.0", "google-cloud-org-policy >= 1.11.1, <2.0.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-policysimulator/testing/constraints-3.10.txt b/packages/google-cloud-policysimulator/testing/constraints-3.10.txt index a92801e1c8e2..b39cd54634f9 100644 --- a/packages/google-cloud-policysimulator/testing/constraints-3.10.txt +++ b/packages/google-cloud-policysimulator/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/google-cloud-policysimulator/tests/unit/gapic/policysimulator_v1/test_org_policy_violations_preview_service.py b/packages/google-cloud-policysimulator/tests/unit/gapic/policysimulator_v1/test_org_policy_violations_preview_service.py index 25c482c83dff..e60288ef9eb9 100644 --- a/packages/google-cloud-policysimulator/tests/unit/gapic/policysimulator_v1/test_org_policy_violations_preview_service.py +++ b/packages/google-cloud-policysimulator/tests/unit/gapic/policysimulator_v1/test_org_policy_violations_preview_service.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 @@ -117,6 +118,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" @@ -1456,8 +1472,8 @@ def test_org_policy_violations_preview_service_client_create_channel_credentials @pytest.mark.parametrize( "request_type", [ - gcp_orgpolicy.ListOrgPolicyViolationsPreviewsRequest, - dict, + gcp_orgpolicy.ListOrgPolicyViolationsPreviewsRequest(), + {}, ], ) def test_list_org_policy_violations_previews(request_type, transport: str = "grpc"): @@ -1468,7 +1484,7 @@ def test_list_org_policy_violations_previews(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( @@ -1517,10 +1533,11 @@ def test_list_org_policy_violations_previews_non_empty_request_with_auto_populat client.list_org_policy_violations_previews(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcp_orgpolicy.ListOrgPolicyViolationsPreviewsRequest( + request_msg = gcp_orgpolicy.ListOrgPolicyViolationsPreviewsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_org_policy_violations_previews_use_cached_wrapped_rpc(): @@ -1606,9 +1623,15 @@ async def test_list_org_policy_violations_previews_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcp_orgpolicy.ListOrgPolicyViolationsPreviewsRequest(), + {}, + ], +) async def test_list_org_policy_violations_previews_async( - transport: str = "grpc_asyncio", - request_type=gcp_orgpolicy.ListOrgPolicyViolationsPreviewsRequest, + request_type, transport: str = "grpc_asyncio" ): client = OrgPolicyViolationsPreviewServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1617,7 +1640,7 @@ async def test_list_org_policy_violations_previews_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( @@ -1642,11 +1665,6 @@ async def test_list_org_policy_violations_previews_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_org_policy_violations_previews_async_from_dict(): - await test_list_org_policy_violations_previews_async(request_type=dict) - - def test_list_org_policy_violations_previews_field_headers(): client = OrgPolicyViolationsPreviewServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2007,8 +2025,8 @@ async def test_list_org_policy_violations_previews_async_pages(): @pytest.mark.parametrize( "request_type", [ - gcp_orgpolicy.GetOrgPolicyViolationsPreviewRequest, - dict, + gcp_orgpolicy.GetOrgPolicyViolationsPreviewRequest(), + {}, ], ) def test_get_org_policy_violations_preview(request_type, transport: str = "grpc"): @@ -2019,7 +2037,7 @@ def test_get_org_policy_violations_preview(request_type, transport: str = "grpc" # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2073,9 +2091,10 @@ def test_get_org_policy_violations_preview_non_empty_request_with_auto_populated client.get_org_policy_violations_preview(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcp_orgpolicy.GetOrgPolicyViolationsPreviewRequest( + request_msg = gcp_orgpolicy.GetOrgPolicyViolationsPreviewRequest( name="name_value", ) + assert args[0] == request_msg def test_get_org_policy_violations_preview_use_cached_wrapped_rpc(): @@ -2161,9 +2180,15 @@ async def test_get_org_policy_violations_preview_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcp_orgpolicy.GetOrgPolicyViolationsPreviewRequest(), + {}, + ], +) async def test_get_org_policy_violations_preview_async( - transport: str = "grpc_asyncio", - request_type=gcp_orgpolicy.GetOrgPolicyViolationsPreviewRequest, + request_type, transport: str = "grpc_asyncio" ): client = OrgPolicyViolationsPreviewServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2172,7 +2197,7 @@ async def test_get_org_policy_violations_preview_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( @@ -2203,11 +2228,6 @@ async def test_get_org_policy_violations_preview_async( assert response.custom_constraints == ["custom_constraints_value"] -@pytest.mark.asyncio -async def test_get_org_policy_violations_preview_async_from_dict(): - await test_get_org_policy_violations_preview_async(request_type=dict) - - def test_get_org_policy_violations_preview_field_headers(): client = OrgPolicyViolationsPreviewServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2362,8 +2382,8 @@ async def test_get_org_policy_violations_preview_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcp_orgpolicy.CreateOrgPolicyViolationsPreviewRequest, - dict, + gcp_orgpolicy.CreateOrgPolicyViolationsPreviewRequest(), + {}, ], ) def test_create_org_policy_violations_preview(request_type, transport: str = "grpc"): @@ -2374,7 +2394,7 @@ def test_create_org_policy_violations_preview(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( @@ -2420,10 +2440,11 @@ def test_create_org_policy_violations_preview_non_empty_request_with_auto_popula client.create_org_policy_violations_preview(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcp_orgpolicy.CreateOrgPolicyViolationsPreviewRequest( + request_msg = gcp_orgpolicy.CreateOrgPolicyViolationsPreviewRequest( parent="parent_value", org_policy_violations_preview_id="org_policy_violations_preview_id_value", ) + assert args[0] == request_msg def test_create_org_policy_violations_preview_use_cached_wrapped_rpc(): @@ -2519,9 +2540,15 @@ async def test_create_org_policy_violations_preview_async_use_cached_wrapped_rpc @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcp_orgpolicy.CreateOrgPolicyViolationsPreviewRequest(), + {}, + ], +) async def test_create_org_policy_violations_preview_async( - transport: str = "grpc_asyncio", - request_type=gcp_orgpolicy.CreateOrgPolicyViolationsPreviewRequest, + request_type, transport: str = "grpc_asyncio" ): client = OrgPolicyViolationsPreviewServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2530,7 +2557,7 @@ async def test_create_org_policy_violations_preview_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( @@ -2552,11 +2579,6 @@ async def test_create_org_policy_violations_preview_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_org_policy_violations_preview_async_from_dict(): - await test_create_org_policy_violations_preview_async(request_type=dict) - - def test_create_org_policy_violations_preview_field_headers(): client = OrgPolicyViolationsPreviewServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2739,8 +2761,8 @@ async def test_create_org_policy_violations_preview_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gcp_orgpolicy.ListOrgPolicyViolationsRequest, - dict, + gcp_orgpolicy.ListOrgPolicyViolationsRequest(), + {}, ], ) def test_list_org_policy_violations(request_type, transport: str = "grpc"): @@ -2751,7 +2773,7 @@ def test_list_org_policy_violations(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2800,10 +2822,11 @@ def test_list_org_policy_violations_non_empty_request_with_auto_populated_field( client.list_org_policy_violations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcp_orgpolicy.ListOrgPolicyViolationsRequest( + request_msg = gcp_orgpolicy.ListOrgPolicyViolationsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_org_policy_violations_use_cached_wrapped_rpc(): @@ -2889,9 +2912,15 @@ async def test_list_org_policy_violations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gcp_orgpolicy.ListOrgPolicyViolationsRequest(), + {}, + ], +) async def test_list_org_policy_violations_async( - transport: str = "grpc_asyncio", - request_type=gcp_orgpolicy.ListOrgPolicyViolationsRequest, + request_type, transport: str = "grpc_asyncio" ): client = OrgPolicyViolationsPreviewServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2900,7 +2929,7 @@ async def test_list_org_policy_violations_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( @@ -2925,11 +2954,6 @@ async def test_list_org_policy_violations_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_org_policy_violations_async_from_dict(): - await test_list_org_policy_violations_async(request_type=dict) - - def test_list_org_policy_violations_field_headers(): client = OrgPolicyViolationsPreviewServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4341,7 +4365,6 @@ def test_list_org_policy_violations_previews_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcp_orgpolicy.ListOrgPolicyViolationsPreviewsRequest() - assert args[0] == request_msg @@ -4364,7 +4387,6 @@ def test_get_org_policy_violations_preview_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcp_orgpolicy.GetOrgPolicyViolationsPreviewRequest() - assert args[0] == request_msg @@ -4387,7 +4409,6 @@ def test_create_org_policy_violations_preview_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcp_orgpolicy.CreateOrgPolicyViolationsPreviewRequest() - assert args[0] == request_msg @@ -4410,7 +4431,6 @@ def test_list_org_policy_violations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcp_orgpolicy.ListOrgPolicyViolationsRequest() - assert args[0] == request_msg @@ -4453,7 +4473,6 @@ async def test_list_org_policy_violations_previews_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcp_orgpolicy.ListOrgPolicyViolationsPreviewsRequest() - assert args[0] == request_msg @@ -4485,7 +4504,6 @@ async def test_get_org_policy_violations_preview_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcp_orgpolicy.GetOrgPolicyViolationsPreviewRequest() - assert args[0] == request_msg @@ -4512,7 +4530,6 @@ async def test_create_org_policy_violations_preview_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcp_orgpolicy.CreateOrgPolicyViolationsPreviewRequest() - assert args[0] == request_msg @@ -4541,7 +4558,6 @@ async def test_list_org_policy_violations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcp_orgpolicy.ListOrgPolicyViolationsRequest() - assert args[0] == request_msg @@ -5410,7 +5426,6 @@ def test_list_org_policy_violations_previews_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcp_orgpolicy.ListOrgPolicyViolationsPreviewsRequest() - assert args[0] == request_msg @@ -5432,7 +5447,6 @@ def test_get_org_policy_violations_preview_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcp_orgpolicy.GetOrgPolicyViolationsPreviewRequest() - assert args[0] == request_msg @@ -5454,7 +5468,6 @@ def test_create_org_policy_violations_preview_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcp_orgpolicy.CreateOrgPolicyViolationsPreviewRequest() - assert args[0] == request_msg @@ -5476,7 +5489,6 @@ def test_list_org_policy_violations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcp_orgpolicy.ListOrgPolicyViolationsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-policysimulator/tests/unit/gapic/policysimulator_v1/test_simulator.py b/packages/google-cloud-policysimulator/tests/unit/gapic/policysimulator_v1/test_simulator.py index 8a3cf4f5cf33..de2a7806b844 100644 --- a/packages/google-cloud-policysimulator/tests/unit/gapic/policysimulator_v1/test_simulator.py +++ b/packages/google-cloud-policysimulator/tests/unit/gapic/policysimulator_v1/test_simulator.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 @@ -115,6 +116,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" @@ -1272,8 +1288,8 @@ def test_simulator_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - simulator.GetReplayRequest, - dict, + simulator.GetReplayRequest(), + {}, ], ) def test_get_replay(request_type, transport: str = "grpc"): @@ -1284,7 +1300,7 @@ def test_get_replay(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_replay), "__call__") as call: @@ -1330,9 +1346,10 @@ def test_get_replay_non_empty_request_with_auto_populated_field(): client.get_replay(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == simulator.GetReplayRequest( + request_msg = simulator.GetReplayRequest( name="name_value", ) + assert args[0] == request_msg def test_get_replay_use_cached_wrapped_rpc(): @@ -1411,9 +1428,14 @@ async def test_get_replay_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_replay_async( - transport: str = "grpc_asyncio", request_type=simulator.GetReplayRequest -): +@pytest.mark.parametrize( + "request_type", + [ + simulator.GetReplayRequest(), + {}, + ], +) +async def test_get_replay_async(request_type, transport: str = "grpc_asyncio"): client = SimulatorAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1421,7 +1443,7 @@ async def test_get_replay_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_replay), "__call__") as call: @@ -1446,11 +1468,6 @@ async def test_get_replay_async( assert response.state == simulator.Replay.State.PENDING -@pytest.mark.asyncio -async def test_get_replay_async_from_dict(): - await test_get_replay_async(request_type=dict) - - def test_get_replay_field_headers(): client = SimulatorClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1593,8 +1610,8 @@ async def test_get_replay_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - simulator.CreateReplayRequest, - dict, + simulator.CreateReplayRequest(), + {}, ], ) def test_create_replay(request_type, transport: str = "grpc"): @@ -1605,7 +1622,7 @@ def test_create_replay(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_replay), "__call__") as call: @@ -1646,9 +1663,10 @@ def test_create_replay_non_empty_request_with_auto_populated_field(): client.create_replay(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == simulator.CreateReplayRequest( + request_msg = simulator.CreateReplayRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_replay_use_cached_wrapped_rpc(): @@ -1739,9 +1757,14 @@ async def test_create_replay_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_replay_async( - transport: str = "grpc_asyncio", request_type=simulator.CreateReplayRequest -): +@pytest.mark.parametrize( + "request_type", + [ + simulator.CreateReplayRequest(), + {}, + ], +) +async def test_create_replay_async(request_type, transport: str = "grpc_asyncio"): client = SimulatorAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1749,7 +1772,7 @@ async def test_create_replay_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_replay), "__call__") as call: @@ -1769,11 +1792,6 @@ async def test_create_replay_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_replay_async_from_dict(): - await test_create_replay_async(request_type=dict) - - def test_create_replay_field_headers(): client = SimulatorClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1930,8 +1948,8 @@ async def test_create_replay_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - simulator.ListReplayResultsRequest, - dict, + simulator.ListReplayResultsRequest(), + {}, ], ) def test_list_replay_results(request_type, transport: str = "grpc"): @@ -1942,7 +1960,7 @@ def test_list_replay_results(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1991,10 +2009,11 @@ def test_list_replay_results_non_empty_request_with_auto_populated_field(): client.list_replay_results(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == simulator.ListReplayResultsRequest( + request_msg = simulator.ListReplayResultsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_replay_results_use_cached_wrapped_rpc(): @@ -2079,9 +2098,14 @@ async def test_list_replay_results_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_replay_results_async( - transport: str = "grpc_asyncio", request_type=simulator.ListReplayResultsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + simulator.ListReplayResultsRequest(), + {}, + ], +) +async def test_list_replay_results_async(request_type, transport: str = "grpc_asyncio"): client = SimulatorAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2089,7 +2113,7 @@ async def test_list_replay_results_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( @@ -2114,11 +2138,6 @@ async def test_list_replay_results_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_replay_results_async_from_dict(): - await test_list_replay_results_async(request_type=dict) - - def test_list_replay_results_field_headers(): client = SimulatorClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3215,7 +3234,6 @@ def test_get_replay_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = simulator.GetReplayRequest() - assert args[0] == request_msg @@ -3236,7 +3254,6 @@ def test_create_replay_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = simulator.CreateReplayRequest() - assert args[0] == request_msg @@ -3259,7 +3276,6 @@ def test_list_replay_results_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = simulator.ListReplayResultsRequest() - assert args[0] == request_msg @@ -3301,7 +3317,6 @@ async def test_get_replay_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = simulator.GetReplayRequest() - assert args[0] == request_msg @@ -3326,7 +3341,6 @@ async def test_create_replay_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = simulator.CreateReplayRequest() - assert args[0] == request_msg @@ -3355,7 +3369,6 @@ async def test_list_replay_results_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = simulator.ListReplayResultsRequest() - assert args[0] == request_msg @@ -3968,7 +3981,6 @@ def test_get_replay_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = simulator.GetReplayRequest() - assert args[0] == request_msg @@ -3988,7 +4000,6 @@ def test_create_replay_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = simulator.CreateReplayRequest() - assert args[0] == request_msg @@ -4010,7 +4021,6 @@ def test_list_replay_results_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = simulator.ListReplayResultsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-policytroubleshooter-iam/noxfile.py b/packages/google-cloud-policytroubleshooter-iam/noxfile.py index 894df3aa743e..64b3a1946ab8 100644 --- a/packages/google-cloud-policytroubleshooter-iam/noxfile.py +++ b/packages/google-cloud-policytroubleshooter-iam/noxfile.py @@ -47,7 +47,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-policytroubleshooter-iam" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-policytroubleshooter-iam/setup.py b/packages/google-cloud-policytroubleshooter-iam/setup.py index 09400d541058..304049104b14 100644 --- a/packages/google-cloud-policytroubleshooter-iam/setup.py +++ b/packages/google-cloud-policytroubleshooter-iam/setup.py @@ -45,7 +45,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/google-cloud-policytroubleshooter-iam/testing/constraints-3.10.txt b/packages/google-cloud-policytroubleshooter-iam/testing/constraints-3.10.txt index ab39fd722ce1..674a39705cb1 100644 --- a/packages/google-cloud-policytroubleshooter-iam/testing/constraints-3.10.txt +++ b/packages/google-cloud-policytroubleshooter-iam/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/google-cloud-policytroubleshooter-iam/tests/unit/gapic/policytroubleshooter_iam_v3/test_policy_troubleshooter.py b/packages/google-cloud-policytroubleshooter-iam/tests/unit/gapic/policytroubleshooter_iam_v3/test_policy_troubleshooter.py index 5457093d72ce..f1ec8b4ef037 100644 --- a/packages/google-cloud-policytroubleshooter-iam/tests/unit/gapic/policytroubleshooter_iam_v3/test_policy_troubleshooter.py +++ b/packages/google-cloud-policytroubleshooter-iam/tests/unit/gapic/policytroubleshooter_iam_v3/test_policy_troubleshooter.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 @@ -107,6 +108,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" @@ -1370,8 +1386,8 @@ def test_policy_troubleshooter_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - troubleshooter.TroubleshootIamPolicyRequest, - dict, + troubleshooter.TroubleshootIamPolicyRequest(), + {}, ], ) def test_troubleshoot_iam_policy(request_type, transport: str = "grpc"): @@ -1382,7 +1398,7 @@ def test_troubleshoot_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( @@ -1431,7 +1447,8 @@ def test_troubleshoot_iam_policy_non_empty_request_with_auto_populated_field(): client.troubleshoot_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == troubleshooter.TroubleshootIamPolicyRequest() + request_msg = troubleshooter.TroubleshootIamPolicyRequest() + assert args[0] == request_msg def test_troubleshoot_iam_policy_use_cached_wrapped_rpc(): @@ -1517,9 +1534,15 @@ async def test_troubleshoot_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + troubleshooter.TroubleshootIamPolicyRequest(), + {}, + ], +) async def test_troubleshoot_iam_policy_async( - transport: str = "grpc_asyncio", - request_type=troubleshooter.TroubleshootIamPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = PolicyTroubleshooterAsyncClient( credentials=async_anonymous_credentials(), @@ -1528,7 +1551,7 @@ async def test_troubleshoot_iam_policy_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( @@ -1556,11 +1579,6 @@ async def test_troubleshoot_iam_policy_async( ) -@pytest.mark.asyncio -async def test_troubleshoot_iam_policy_async_from_dict(): - await test_troubleshoot_iam_policy_async(request_type=dict) - - def test_troubleshoot_iam_policy_rest_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, # instead of constructing them on each call @@ -1727,7 +1745,6 @@ def test_troubleshoot_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = troubleshooter.TroubleshootIamPolicyRequest() - assert args[0] == request_msg @@ -1770,7 +1787,6 @@ async def test_troubleshoot_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = troubleshooter.TroubleshootIamPolicyRequest() - assert args[0] == request_msg @@ -1947,7 +1963,6 @@ def test_troubleshoot_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = troubleshooter.TroubleshootIamPolicyRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-private-ca/noxfile.py b/packages/google-cloud-private-ca/noxfile.py index 999bad3cc600..63dbc9f15da1 100644 --- a/packages/google-cloud-private-ca/noxfile.py +++ b/packages/google-cloud-private-ca/noxfile.py @@ -47,7 +47,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-private-ca" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-private-ca/setup.py b/packages/google-cloud-private-ca/setup.py index 750473e03ba4..c11f2d1df881 100644 --- a/packages/google-cloud-private-ca/setup.py +++ b/packages/google-cloud-private-ca/setup.py @@ -45,7 +45,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/google-cloud-private-ca/testing/constraints-3.10.txt b/packages/google-cloud-private-ca/testing/constraints-3.10.txt index a92801e1c8e2..b39cd54634f9 100644 --- a/packages/google-cloud-private-ca/testing/constraints-3.10.txt +++ b/packages/google-cloud-private-ca/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/google-cloud-private-ca/tests/unit/gapic/privateca_v1/test_certificate_authority_service.py b/packages/google-cloud-private-ca/tests/unit/gapic/privateca_v1/test_certificate_authority_service.py index e03203955d96..3768c353dd36 100644 --- a/packages/google-cloud-private-ca/tests/unit/gapic/privateca_v1/test_certificate_authority_service.py +++ b/packages/google-cloud-private-ca/tests/unit/gapic/privateca_v1/test_certificate_authority_service.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 @@ -123,6 +124,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" @@ -1429,8 +1445,8 @@ def test_certificate_authority_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - service.CreateCertificateRequest, - dict, + service.CreateCertificateRequest(), + {}, ], ) def test_create_certificate(request_type, transport: str = "grpc"): @@ -1441,7 +1457,7 @@ def test_create_certificate(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,12 +1519,13 @@ def test_create_certificate_non_empty_request_with_auto_populated_field(): client.create_certificate(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateCertificateRequest( + request_msg = service.CreateCertificateRequest( parent="parent_value", certificate_id="certificate_id_value", request_id="request_id_value", issuing_certificate_authority_id="issuing_certificate_authority_id_value", ) + assert args[0] == request_msg def test_create_certificate_use_cached_wrapped_rpc(): @@ -1593,9 +1610,14 @@ async def test_create_certificate_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_certificate_async( - transport: str = "grpc_asyncio", request_type=service.CreateCertificateRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CreateCertificateRequest(), + {}, + ], +) +async def test_create_certificate_async(request_type, transport: str = "grpc_asyncio"): client = CertificateAuthorityServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1603,7 +1625,7 @@ async def test_create_certificate_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( @@ -1638,11 +1660,6 @@ async def test_create_certificate_async( assert response.pem_certificate_chain == ["pem_certificate_chain_value"] -@pytest.mark.asyncio -async def test_create_certificate_async_from_dict(): - await test_create_certificate_async(request_type=dict) - - def test_create_certificate_field_headers(): client = CertificateAuthorityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1817,8 +1834,8 @@ async def test_create_certificate_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.GetCertificateRequest, - dict, + service.GetCertificateRequest(), + {}, ], ) def test_get_certificate(request_type, transport: str = "grpc"): @@ -1829,7 +1846,7 @@ def test_get_certificate(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_certificate), "__call__") as call: @@ -1884,9 +1901,10 @@ def test_get_certificate_non_empty_request_with_auto_populated_field(): client.get_certificate(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetCertificateRequest( + request_msg = service.GetCertificateRequest( name="name_value", ) + assert args[0] == request_msg def test_get_certificate_use_cached_wrapped_rpc(): @@ -1967,9 +1985,14 @@ async def test_get_certificate_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_certificate_async( - transport: str = "grpc_asyncio", request_type=service.GetCertificateRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetCertificateRequest(), + {}, + ], +) +async def test_get_certificate_async(request_type, transport: str = "grpc_asyncio"): client = CertificateAuthorityServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1977,7 +2000,7 @@ async def test_get_certificate_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_certificate), "__call__") as call: @@ -2010,11 +2033,6 @@ async def test_get_certificate_async( assert response.pem_certificate_chain == ["pem_certificate_chain_value"] -@pytest.mark.asyncio -async def test_get_certificate_async_from_dict(): - await test_get_certificate_async(request_type=dict) - - def test_get_certificate_field_headers(): client = CertificateAuthorityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2161,8 +2179,8 @@ async def test_get_certificate_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListCertificatesRequest, - dict, + service.ListCertificatesRequest(), + {}, ], ) def test_list_certificates(request_type, transport: str = "grpc"): @@ -2173,7 +2191,7 @@ def test_list_certificates(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2226,12 +2244,13 @@ def test_list_certificates_non_empty_request_with_auto_populated_field(): client.list_certificates(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListCertificatesRequest( + request_msg = service.ListCertificatesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_certificates_use_cached_wrapped_rpc(): @@ -2314,9 +2333,14 @@ async def test_list_certificates_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_certificates_async( - transport: str = "grpc_asyncio", request_type=service.ListCertificatesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListCertificatesRequest(), + {}, + ], +) +async def test_list_certificates_async(request_type, transport: str = "grpc_asyncio"): client = CertificateAuthorityServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2324,7 +2348,7 @@ async def test_list_certificates_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( @@ -2351,11 +2375,6 @@ async def test_list_certificates_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_certificates_async_from_dict(): - await test_list_certificates_async(request_type=dict) - - def test_list_certificates_field_headers(): client = CertificateAuthorityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2708,8 +2727,8 @@ async def test_list_certificates_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.RevokeCertificateRequest, - dict, + service.RevokeCertificateRequest(), + {}, ], ) def test_revoke_certificate(request_type, transport: str = "grpc"): @@ -2720,7 +2739,7 @@ def test_revoke_certificate(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2780,10 +2799,11 @@ def test_revoke_certificate_non_empty_request_with_auto_populated_field(): client.revoke_certificate(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.RevokeCertificateRequest( + request_msg = service.RevokeCertificateRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_revoke_certificate_use_cached_wrapped_rpc(): @@ -2868,9 +2888,14 @@ async def test_revoke_certificate_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_revoke_certificate_async( - transport: str = "grpc_asyncio", request_type=service.RevokeCertificateRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.RevokeCertificateRequest(), + {}, + ], +) +async def test_revoke_certificate_async(request_type, transport: str = "grpc_asyncio"): client = CertificateAuthorityServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2878,7 +2903,7 @@ async def test_revoke_certificate_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( @@ -2913,11 +2938,6 @@ async def test_revoke_certificate_async( assert response.pem_certificate_chain == ["pem_certificate_chain_value"] -@pytest.mark.asyncio -async def test_revoke_certificate_async_from_dict(): - await test_revoke_certificate_async(request_type=dict) - - def test_revoke_certificate_field_headers(): client = CertificateAuthorityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3072,8 +3092,8 @@ async def test_revoke_certificate_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdateCertificateRequest, - dict, + service.UpdateCertificateRequest(), + {}, ], ) def test_update_certificate(request_type, transport: str = "grpc"): @@ -3084,7 +3104,7 @@ def test_update_certificate(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3143,9 +3163,10 @@ def test_update_certificate_non_empty_request_with_auto_populated_field(): client.update_certificate(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateCertificateRequest( + request_msg = service.UpdateCertificateRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_certificate_use_cached_wrapped_rpc(): @@ -3230,9 +3251,14 @@ async def test_update_certificate_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_certificate_async( - transport: str = "grpc_asyncio", request_type=service.UpdateCertificateRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateCertificateRequest(), + {}, + ], +) +async def test_update_certificate_async(request_type, transport: str = "grpc_asyncio"): client = CertificateAuthorityServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3240,7 +3266,7 @@ async def test_update_certificate_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( @@ -3275,11 +3301,6 @@ async def test_update_certificate_async( assert response.pem_certificate_chain == ["pem_certificate_chain_value"] -@pytest.mark.asyncio -async def test_update_certificate_async_from_dict(): - await test_update_certificate_async(request_type=dict) - - def test_update_certificate_field_headers(): client = CertificateAuthorityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3444,8 +3465,8 @@ async def test_update_certificate_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ActivateCertificateAuthorityRequest, - dict, + service.ActivateCertificateAuthorityRequest(), + {}, ], ) def test_activate_certificate_authority(request_type, transport: str = "grpc"): @@ -3456,7 +3477,7 @@ def test_activate_certificate_authority(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3502,10 +3523,11 @@ def test_activate_certificate_authority_non_empty_request_with_auto_populated_fi client.activate_certificate_authority(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ActivateCertificateAuthorityRequest( + request_msg = service.ActivateCertificateAuthorityRequest( name="name_value", pem_ca_certificate="pem_ca_certificate_value", ) + assert args[0] == request_msg def test_activate_certificate_authority_use_cached_wrapped_rpc(): @@ -3601,9 +3623,15 @@ async def test_activate_certificate_authority_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.ActivateCertificateAuthorityRequest(), + {}, + ], +) async def test_activate_certificate_authority_async( - transport: str = "grpc_asyncio", - request_type=service.ActivateCertificateAuthorityRequest, + request_type, transport: str = "grpc_asyncio" ): client = CertificateAuthorityServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3612,7 +3640,7 @@ async def test_activate_certificate_authority_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( @@ -3634,11 +3662,6 @@ async def test_activate_certificate_authority_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_activate_certificate_authority_async_from_dict(): - await test_activate_certificate_authority_async(request_type=dict) - - def test_activate_certificate_authority_field_headers(): client = CertificateAuthorityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3793,8 +3816,8 @@ async def test_activate_certificate_authority_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.CreateCertificateAuthorityRequest, - dict, + service.CreateCertificateAuthorityRequest(), + {}, ], ) def test_create_certificate_authority(request_type, transport: str = "grpc"): @@ -3805,7 +3828,7 @@ def test_create_certificate_authority(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3852,11 +3875,12 @@ def test_create_certificate_authority_non_empty_request_with_auto_populated_fiel client.create_certificate_authority(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateCertificateAuthorityRequest( + request_msg = service.CreateCertificateAuthorityRequest( parent="parent_value", certificate_authority_id="certificate_authority_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_certificate_authority_use_cached_wrapped_rpc(): @@ -3952,9 +3976,15 @@ async def test_create_certificate_authority_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.CreateCertificateAuthorityRequest(), + {}, + ], +) async def test_create_certificate_authority_async( - transport: str = "grpc_asyncio", - request_type=service.CreateCertificateAuthorityRequest, + request_type, transport: str = "grpc_asyncio" ): client = CertificateAuthorityServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3963,7 +3993,7 @@ async def test_create_certificate_authority_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( @@ -3985,11 +4015,6 @@ async def test_create_certificate_authority_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_certificate_authority_async_from_dict(): - await test_create_certificate_authority_async(request_type=dict) - - def test_create_certificate_authority_field_headers(): client = CertificateAuthorityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4164,8 +4189,8 @@ async def test_create_certificate_authority_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DisableCertificateAuthorityRequest, - dict, + service.DisableCertificateAuthorityRequest(), + {}, ], ) def test_disable_certificate_authority(request_type, transport: str = "grpc"): @@ -4176,7 +4201,7 @@ def test_disable_certificate_authority(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4221,9 +4246,10 @@ def test_disable_certificate_authority_non_empty_request_with_auto_populated_fie client.disable_certificate_authority(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DisableCertificateAuthorityRequest( + request_msg = service.DisableCertificateAuthorityRequest( name="name_value", ) + assert args[0] == request_msg def test_disable_certificate_authority_use_cached_wrapped_rpc(): @@ -4319,9 +4345,15 @@ async def test_disable_certificate_authority_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.DisableCertificateAuthorityRequest(), + {}, + ], +) async def test_disable_certificate_authority_async( - transport: str = "grpc_asyncio", - request_type=service.DisableCertificateAuthorityRequest, + request_type, transport: str = "grpc_asyncio" ): client = CertificateAuthorityServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4330,7 +4362,7 @@ async def test_disable_certificate_authority_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( @@ -4352,11 +4384,6 @@ async def test_disable_certificate_authority_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_disable_certificate_authority_async_from_dict(): - await test_disable_certificate_authority_async(request_type=dict) - - def test_disable_certificate_authority_field_headers(): client = CertificateAuthorityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4511,8 +4538,8 @@ async def test_disable_certificate_authority_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.EnableCertificateAuthorityRequest, - dict, + service.EnableCertificateAuthorityRequest(), + {}, ], ) def test_enable_certificate_authority(request_type, transport: str = "grpc"): @@ -4523,7 +4550,7 @@ def test_enable_certificate_authority(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4568,9 +4595,10 @@ def test_enable_certificate_authority_non_empty_request_with_auto_populated_fiel client.enable_certificate_authority(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.EnableCertificateAuthorityRequest( + request_msg = service.EnableCertificateAuthorityRequest( name="name_value", ) + assert args[0] == request_msg def test_enable_certificate_authority_use_cached_wrapped_rpc(): @@ -4666,9 +4694,15 @@ async def test_enable_certificate_authority_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.EnableCertificateAuthorityRequest(), + {}, + ], +) async def test_enable_certificate_authority_async( - transport: str = "grpc_asyncio", - request_type=service.EnableCertificateAuthorityRequest, + request_type, transport: str = "grpc_asyncio" ): client = CertificateAuthorityServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4677,7 +4711,7 @@ async def test_enable_certificate_authority_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( @@ -4699,11 +4733,6 @@ async def test_enable_certificate_authority_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_enable_certificate_authority_async_from_dict(): - await test_enable_certificate_authority_async(request_type=dict) - - def test_enable_certificate_authority_field_headers(): client = CertificateAuthorityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4858,8 +4887,8 @@ async def test_enable_certificate_authority_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.FetchCertificateAuthorityCsrRequest, - dict, + service.FetchCertificateAuthorityCsrRequest(), + {}, ], ) def test_fetch_certificate_authority_csr(request_type, transport: str = "grpc"): @@ -4870,7 +4899,7 @@ def test_fetch_certificate_authority_csr(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4918,9 +4947,10 @@ def test_fetch_certificate_authority_csr_non_empty_request_with_auto_populated_f client.fetch_certificate_authority_csr(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.FetchCertificateAuthorityCsrRequest( + request_msg = service.FetchCertificateAuthorityCsrRequest( name="name_value", ) + assert args[0] == request_msg def test_fetch_certificate_authority_csr_use_cached_wrapped_rpc(): @@ -5006,9 +5036,15 @@ async def test_fetch_certificate_authority_csr_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.FetchCertificateAuthorityCsrRequest(), + {}, + ], +) async def test_fetch_certificate_authority_csr_async( - transport: str = "grpc_asyncio", - request_type=service.FetchCertificateAuthorityCsrRequest, + request_type, transport: str = "grpc_asyncio" ): client = CertificateAuthorityServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5017,7 +5053,7 @@ async def test_fetch_certificate_authority_csr_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( @@ -5042,11 +5078,6 @@ async def test_fetch_certificate_authority_csr_async( assert response.pem_csr == "pem_csr_value" -@pytest.mark.asyncio -async def test_fetch_certificate_authority_csr_async_from_dict(): - await test_fetch_certificate_authority_csr_async(request_type=dict) - - def test_fetch_certificate_authority_csr_field_headers(): client = CertificateAuthorityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5201,8 +5232,8 @@ async def test_fetch_certificate_authority_csr_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.GetCertificateAuthorityRequest, - dict, + service.GetCertificateAuthorityRequest(), + {}, ], ) def test_get_certificate_authority(request_type, transport: str = "grpc"): @@ -5213,7 +5244,7 @@ def test_get_certificate_authority(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5275,9 +5306,10 @@ def test_get_certificate_authority_non_empty_request_with_auto_populated_field() client.get_certificate_authority(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetCertificateAuthorityRequest( + request_msg = service.GetCertificateAuthorityRequest( name="name_value", ) + assert args[0] == request_msg def test_get_certificate_authority_use_cached_wrapped_rpc(): @@ -5363,8 +5395,15 @@ async def test_get_certificate_authority_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.GetCertificateAuthorityRequest(), + {}, + ], +) async def test_get_certificate_authority_async( - transport: str = "grpc_asyncio", request_type=service.GetCertificateAuthorityRequest + request_type, transport: str = "grpc_asyncio" ): client = CertificateAuthorityServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5373,7 +5412,7 @@ async def test_get_certificate_authority_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( @@ -5412,11 +5451,6 @@ async def test_get_certificate_authority_async( assert response.satisfies_pzi is True -@pytest.mark.asyncio -async def test_get_certificate_authority_async_from_dict(): - await test_get_certificate_authority_async(request_type=dict) - - def test_get_certificate_authority_field_headers(): client = CertificateAuthorityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5571,8 +5605,8 @@ async def test_get_certificate_authority_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListCertificateAuthoritiesRequest, - dict, + service.ListCertificateAuthoritiesRequest(), + {}, ], ) def test_list_certificate_authorities(request_type, transport: str = "grpc"): @@ -5583,7 +5617,7 @@ def test_list_certificate_authorities(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5636,12 +5670,13 @@ def test_list_certificate_authorities_non_empty_request_with_auto_populated_fiel client.list_certificate_authorities(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListCertificateAuthoritiesRequest( + request_msg = service.ListCertificateAuthoritiesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_certificate_authorities_use_cached_wrapped_rpc(): @@ -5727,9 +5762,15 @@ async def test_list_certificate_authorities_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.ListCertificateAuthoritiesRequest(), + {}, + ], +) async def test_list_certificate_authorities_async( - transport: str = "grpc_asyncio", - request_type=service.ListCertificateAuthoritiesRequest, + request_type, transport: str = "grpc_asyncio" ): client = CertificateAuthorityServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5738,7 +5779,7 @@ async def test_list_certificate_authorities_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( @@ -5765,11 +5806,6 @@ async def test_list_certificate_authorities_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_certificate_authorities_async_from_dict(): - await test_list_certificate_authorities_async(request_type=dict) - - def test_list_certificate_authorities_field_headers(): client = CertificateAuthorityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6126,8 +6162,8 @@ async def test_list_certificate_authorities_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.UndeleteCertificateAuthorityRequest, - dict, + service.UndeleteCertificateAuthorityRequest(), + {}, ], ) def test_undelete_certificate_authority(request_type, transport: str = "grpc"): @@ -6138,7 +6174,7 @@ def test_undelete_certificate_authority(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,9 +6219,10 @@ def test_undelete_certificate_authority_non_empty_request_with_auto_populated_fi client.undelete_certificate_authority(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UndeleteCertificateAuthorityRequest( + request_msg = service.UndeleteCertificateAuthorityRequest( name="name_value", ) + assert args[0] == request_msg def test_undelete_certificate_authority_use_cached_wrapped_rpc(): @@ -6281,9 +6318,15 @@ async def test_undelete_certificate_authority_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.UndeleteCertificateAuthorityRequest(), + {}, + ], +) async def test_undelete_certificate_authority_async( - transport: str = "grpc_asyncio", - request_type=service.UndeleteCertificateAuthorityRequest, + request_type, transport: str = "grpc_asyncio" ): client = CertificateAuthorityServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -6292,7 +6335,7 @@ async def test_undelete_certificate_authority_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( @@ -6314,11 +6357,6 @@ async def test_undelete_certificate_authority_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_undelete_certificate_authority_async_from_dict(): - await test_undelete_certificate_authority_async(request_type=dict) - - def test_undelete_certificate_authority_field_headers(): client = CertificateAuthorityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6473,8 +6511,8 @@ async def test_undelete_certificate_authority_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DeleteCertificateAuthorityRequest, - dict, + service.DeleteCertificateAuthorityRequest(), + {}, ], ) def test_delete_certificate_authority(request_type, transport: str = "grpc"): @@ -6485,7 +6523,7 @@ def test_delete_certificate_authority(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6530,9 +6568,10 @@ def test_delete_certificate_authority_non_empty_request_with_auto_populated_fiel client.delete_certificate_authority(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteCertificateAuthorityRequest( + request_msg = service.DeleteCertificateAuthorityRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_certificate_authority_use_cached_wrapped_rpc(): @@ -6628,9 +6667,15 @@ async def test_delete_certificate_authority_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteCertificateAuthorityRequest(), + {}, + ], +) async def test_delete_certificate_authority_async( - transport: str = "grpc_asyncio", - request_type=service.DeleteCertificateAuthorityRequest, + request_type, transport: str = "grpc_asyncio" ): client = CertificateAuthorityServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -6639,7 +6684,7 @@ async def test_delete_certificate_authority_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( @@ -6661,11 +6706,6 @@ async def test_delete_certificate_authority_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_certificate_authority_async_from_dict(): - await test_delete_certificate_authority_async(request_type=dict) - - def test_delete_certificate_authority_field_headers(): client = CertificateAuthorityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6820,8 +6860,8 @@ async def test_delete_certificate_authority_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdateCertificateAuthorityRequest, - dict, + service.UpdateCertificateAuthorityRequest(), + {}, ], ) def test_update_certificate_authority(request_type, transport: str = "grpc"): @@ -6832,7 +6872,7 @@ def test_update_certificate_authority(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6875,7 +6915,8 @@ def test_update_certificate_authority_non_empty_request_with_auto_populated_fiel client.update_certificate_authority(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateCertificateAuthorityRequest() + request_msg = service.UpdateCertificateAuthorityRequest() + assert args[0] == request_msg def test_update_certificate_authority_use_cached_wrapped_rpc(): @@ -6971,9 +7012,15 @@ async def test_update_certificate_authority_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateCertificateAuthorityRequest(), + {}, + ], +) async def test_update_certificate_authority_async( - transport: str = "grpc_asyncio", - request_type=service.UpdateCertificateAuthorityRequest, + request_type, transport: str = "grpc_asyncio" ): client = CertificateAuthorityServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -6982,7 +7029,7 @@ async def test_update_certificate_authority_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( @@ -7004,11 +7051,6 @@ async def test_update_certificate_authority_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_certificate_authority_async_from_dict(): - await test_update_certificate_authority_async(request_type=dict) - - def test_update_certificate_authority_field_headers(): client = CertificateAuthorityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7173,8 +7215,8 @@ async def test_update_certificate_authority_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.CreateCaPoolRequest, - dict, + service.CreateCaPoolRequest(), + {}, ], ) def test_create_ca_pool(request_type, transport: str = "grpc"): @@ -7185,7 +7227,7 @@ def test_create_ca_pool(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_ca_pool), "__call__") as call: @@ -7227,10 +7269,11 @@ def test_create_ca_pool_non_empty_request_with_auto_populated_field(): client.create_ca_pool(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateCaPoolRequest( + request_msg = service.CreateCaPoolRequest( parent="parent_value", ca_pool_id="ca_pool_id_value", ) + assert args[0] == request_msg def test_create_ca_pool_use_cached_wrapped_rpc(): @@ -7321,9 +7364,14 @@ async def test_create_ca_pool_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_ca_pool_async( - transport: str = "grpc_asyncio", request_type=service.CreateCaPoolRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CreateCaPoolRequest(), + {}, + ], +) +async def test_create_ca_pool_async(request_type, transport: str = "grpc_asyncio"): client = CertificateAuthorityServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7331,7 +7379,7 @@ async def test_create_ca_pool_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_ca_pool), "__call__") as call: @@ -7351,11 +7399,6 @@ async def test_create_ca_pool_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_ca_pool_async_from_dict(): - await test_create_ca_pool_async(request_type=dict) - - def test_create_ca_pool_field_headers(): client = CertificateAuthorityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7522,8 +7565,8 @@ async def test_create_ca_pool_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdateCaPoolRequest, - dict, + service.UpdateCaPoolRequest(), + {}, ], ) def test_update_ca_pool(request_type, transport: str = "grpc"): @@ -7534,7 +7577,7 @@ def test_update_ca_pool(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_ca_pool), "__call__") as call: @@ -7573,7 +7616,8 @@ def test_update_ca_pool_non_empty_request_with_auto_populated_field(): client.update_ca_pool(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateCaPoolRequest() + request_msg = service.UpdateCaPoolRequest() + assert args[0] == request_msg def test_update_ca_pool_use_cached_wrapped_rpc(): @@ -7664,9 +7708,14 @@ async def test_update_ca_pool_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_ca_pool_async( - transport: str = "grpc_asyncio", request_type=service.UpdateCaPoolRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateCaPoolRequest(), + {}, + ], +) +async def test_update_ca_pool_async(request_type, transport: str = "grpc_asyncio"): client = CertificateAuthorityServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7674,7 +7723,7 @@ async def test_update_ca_pool_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_ca_pool), "__call__") as call: @@ -7694,11 +7743,6 @@ async def test_update_ca_pool_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_ca_pool_async_from_dict(): - await test_update_ca_pool_async(request_type=dict) - - def test_update_ca_pool_field_headers(): client = CertificateAuthorityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7855,8 +7899,8 @@ async def test_update_ca_pool_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.GetCaPoolRequest, - dict, + service.GetCaPoolRequest(), + {}, ], ) def test_get_ca_pool(request_type, transport: str = "grpc"): @@ -7867,7 +7911,7 @@ def test_get_ca_pool(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_ca_pool), "__call__") as call: @@ -7913,9 +7957,10 @@ def test_get_ca_pool_non_empty_request_with_auto_populated_field(): client.get_ca_pool(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetCaPoolRequest( + request_msg = service.GetCaPoolRequest( name="name_value", ) + assert args[0] == request_msg def test_get_ca_pool_use_cached_wrapped_rpc(): @@ -7996,9 +8041,14 @@ async def test_get_ca_pool_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_ca_pool_async( - transport: str = "grpc_asyncio", request_type=service.GetCaPoolRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetCaPoolRequest(), + {}, + ], +) +async def test_get_ca_pool_async(request_type, transport: str = "grpc_asyncio"): client = CertificateAuthorityServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8006,7 +8056,7 @@ async def test_get_ca_pool_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_ca_pool), "__call__") as call: @@ -8031,11 +8081,6 @@ async def test_get_ca_pool_async( assert response.tier == resources.CaPool.Tier.ENTERPRISE -@pytest.mark.asyncio -async def test_get_ca_pool_async_from_dict(): - await test_get_ca_pool_async(request_type=dict) - - def test_get_ca_pool_field_headers(): client = CertificateAuthorityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8178,8 +8223,8 @@ async def test_get_ca_pool_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListCaPoolsRequest, - dict, + service.ListCaPoolsRequest(), + {}, ], ) def test_list_ca_pools(request_type, transport: str = "grpc"): @@ -8190,7 +8235,7 @@ def test_list_ca_pools(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_ca_pools), "__call__") as call: @@ -8239,12 +8284,13 @@ def test_list_ca_pools_non_empty_request_with_auto_populated_field(): client.list_ca_pools(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListCaPoolsRequest( + request_msg = service.ListCaPoolsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_ca_pools_use_cached_wrapped_rpc(): @@ -8325,9 +8371,14 @@ async def test_list_ca_pools_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_ca_pools_async( - transport: str = "grpc_asyncio", request_type=service.ListCaPoolsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListCaPoolsRequest(), + {}, + ], +) +async def test_list_ca_pools_async(request_type, transport: str = "grpc_asyncio"): client = CertificateAuthorityServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8335,7 +8386,7 @@ async def test_list_ca_pools_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_ca_pools), "__call__") as call: @@ -8360,11 +8411,6 @@ async def test_list_ca_pools_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_ca_pools_async_from_dict(): - await test_list_ca_pools_async(request_type=dict) - - def test_list_ca_pools_field_headers(): client = CertificateAuthorityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8701,8 +8747,8 @@ async def test_list_ca_pools_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.DeleteCaPoolRequest, - dict, + service.DeleteCaPoolRequest(), + {}, ], ) def test_delete_ca_pool(request_type, transport: str = "grpc"): @@ -8713,7 +8759,7 @@ def test_delete_ca_pool(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_ca_pool), "__call__") as call: @@ -8754,9 +8800,10 @@ def test_delete_ca_pool_non_empty_request_with_auto_populated_field(): client.delete_ca_pool(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteCaPoolRequest( + request_msg = service.DeleteCaPoolRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_ca_pool_use_cached_wrapped_rpc(): @@ -8847,9 +8894,14 @@ async def test_delete_ca_pool_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_ca_pool_async( - transport: str = "grpc_asyncio", request_type=service.DeleteCaPoolRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteCaPoolRequest(), + {}, + ], +) +async def test_delete_ca_pool_async(request_type, transport: str = "grpc_asyncio"): client = CertificateAuthorityServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8857,7 +8909,7 @@ async def test_delete_ca_pool_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_ca_pool), "__call__") as call: @@ -8877,11 +8929,6 @@ async def test_delete_ca_pool_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_ca_pool_async_from_dict(): - await test_delete_ca_pool_async(request_type=dict) - - def test_delete_ca_pool_field_headers(): client = CertificateAuthorityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9028,8 +9075,8 @@ async def test_delete_ca_pool_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.FetchCaCertsRequest, - dict, + service.FetchCaCertsRequest(), + {}, ], ) def test_fetch_ca_certs(request_type, transport: str = "grpc"): @@ -9040,7 +9087,7 @@ def test_fetch_ca_certs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.fetch_ca_certs), "__call__") as call: @@ -9082,10 +9129,11 @@ def test_fetch_ca_certs_non_empty_request_with_auto_populated_field(): client.fetch_ca_certs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.FetchCaCertsRequest( + request_msg = service.FetchCaCertsRequest( ca_pool="ca_pool_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_fetch_ca_certs_use_cached_wrapped_rpc(): @@ -9166,9 +9214,14 @@ async def test_fetch_ca_certs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_fetch_ca_certs_async( - transport: str = "grpc_asyncio", request_type=service.FetchCaCertsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.FetchCaCertsRequest(), + {}, + ], +) +async def test_fetch_ca_certs_async(request_type, transport: str = "grpc_asyncio"): client = CertificateAuthorityServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9176,7 +9229,7 @@ async def test_fetch_ca_certs_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.fetch_ca_certs), "__call__") as call: @@ -9196,11 +9249,6 @@ async def test_fetch_ca_certs_async( assert isinstance(response, service.FetchCaCertsResponse) -@pytest.mark.asyncio -async def test_fetch_ca_certs_async_from_dict(): - await test_fetch_ca_certs_async(request_type=dict) - - def test_fetch_ca_certs_field_headers(): client = CertificateAuthorityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9347,8 +9395,8 @@ async def test_fetch_ca_certs_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.GetCertificateRevocationListRequest, - dict, + service.GetCertificateRevocationListRequest(), + {}, ], ) def test_get_certificate_revocation_list(request_type, transport: str = "grpc"): @@ -9359,7 +9407,7 @@ def test_get_certificate_revocation_list(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9417,9 +9465,10 @@ def test_get_certificate_revocation_list_non_empty_request_with_auto_populated_f client.get_certificate_revocation_list(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetCertificateRevocationListRequest( + request_msg = service.GetCertificateRevocationListRequest( name="name_value", ) + assert args[0] == request_msg def test_get_certificate_revocation_list_use_cached_wrapped_rpc(): @@ -9505,9 +9554,15 @@ async def test_get_certificate_revocation_list_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.GetCertificateRevocationListRequest(), + {}, + ], +) async def test_get_certificate_revocation_list_async( - transport: str = "grpc_asyncio", - request_type=service.GetCertificateRevocationListRequest, + request_type, transport: str = "grpc_asyncio" ): client = CertificateAuthorityServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -9516,7 +9571,7 @@ async def test_get_certificate_revocation_list_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( @@ -9551,11 +9606,6 @@ async def test_get_certificate_revocation_list_async( assert response.revision_id == "revision_id_value" -@pytest.mark.asyncio -async def test_get_certificate_revocation_list_async_from_dict(): - await test_get_certificate_revocation_list_async(request_type=dict) - - def test_get_certificate_revocation_list_field_headers(): client = CertificateAuthorityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9710,8 +9760,8 @@ async def test_get_certificate_revocation_list_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListCertificateRevocationListsRequest, - dict, + service.ListCertificateRevocationListsRequest(), + {}, ], ) def test_list_certificate_revocation_lists(request_type, transport: str = "grpc"): @@ -9722,7 +9772,7 @@ def test_list_certificate_revocation_lists(request_type, transport: str = "grpc" # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9775,12 +9825,13 @@ def test_list_certificate_revocation_lists_non_empty_request_with_auto_populated client.list_certificate_revocation_lists(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListCertificateRevocationListsRequest( + request_msg = service.ListCertificateRevocationListsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_certificate_revocation_lists_use_cached_wrapped_rpc(): @@ -9866,9 +9917,15 @@ async def test_list_certificate_revocation_lists_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.ListCertificateRevocationListsRequest(), + {}, + ], +) async def test_list_certificate_revocation_lists_async( - transport: str = "grpc_asyncio", - request_type=service.ListCertificateRevocationListsRequest, + request_type, transport: str = "grpc_asyncio" ): client = CertificateAuthorityServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -9877,7 +9934,7 @@ async def test_list_certificate_revocation_lists_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( @@ -9904,11 +9961,6 @@ async def test_list_certificate_revocation_lists_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_certificate_revocation_lists_async_from_dict(): - await test_list_certificate_revocation_lists_async(request_type=dict) - - def test_list_certificate_revocation_lists_field_headers(): client = CertificateAuthorityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10267,8 +10319,8 @@ async def test_list_certificate_revocation_lists_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.UpdateCertificateRevocationListRequest, - dict, + service.UpdateCertificateRevocationListRequest(), + {}, ], ) def test_update_certificate_revocation_list(request_type, transport: str = "grpc"): @@ -10279,7 +10331,7 @@ def test_update_certificate_revocation_list(request_type, transport: str = "grpc # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10324,9 +10376,10 @@ def test_update_certificate_revocation_list_non_empty_request_with_auto_populate client.update_certificate_revocation_list(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateCertificateRevocationListRequest( + request_msg = service.UpdateCertificateRevocationListRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_certificate_revocation_list_use_cached_wrapped_rpc(): @@ -10422,9 +10475,15 @@ async def test_update_certificate_revocation_list_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateCertificateRevocationListRequest(), + {}, + ], +) async def test_update_certificate_revocation_list_async( - transport: str = "grpc_asyncio", - request_type=service.UpdateCertificateRevocationListRequest, + request_type, transport: str = "grpc_asyncio" ): client = CertificateAuthorityServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -10433,7 +10492,7 @@ async def test_update_certificate_revocation_list_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( @@ -10455,11 +10514,6 @@ async def test_update_certificate_revocation_list_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_certificate_revocation_list_async_from_dict(): - await test_update_certificate_revocation_list_async(request_type=dict) - - def test_update_certificate_revocation_list_field_headers(): client = CertificateAuthorityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10632,8 +10686,8 @@ async def test_update_certificate_revocation_list_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.CreateCertificateTemplateRequest, - dict, + service.CreateCertificateTemplateRequest(), + {}, ], ) def test_create_certificate_template(request_type, transport: str = "grpc"): @@ -10644,7 +10698,7 @@ def test_create_certificate_template(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10690,10 +10744,11 @@ def test_create_certificate_template_non_empty_request_with_auto_populated_field client.create_certificate_template(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateCertificateTemplateRequest( + request_msg = service.CreateCertificateTemplateRequest( parent="parent_value", certificate_template_id="certificate_template_id_value", ) + assert args[0] == request_msg def test_create_certificate_template_use_cached_wrapped_rpc(): @@ -10789,9 +10844,15 @@ async def test_create_certificate_template_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.CreateCertificateTemplateRequest(), + {}, + ], +) async def test_create_certificate_template_async( - transport: str = "grpc_asyncio", - request_type=service.CreateCertificateTemplateRequest, + request_type, transport: str = "grpc_asyncio" ): client = CertificateAuthorityServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -10800,7 +10861,7 @@ async def test_create_certificate_template_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( @@ -10822,11 +10883,6 @@ async def test_create_certificate_template_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_certificate_template_async_from_dict(): - await test_create_certificate_template_async(request_type=dict) - - def test_create_certificate_template_field_headers(): client = CertificateAuthorityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11001,8 +11057,8 @@ async def test_create_certificate_template_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DeleteCertificateTemplateRequest, - dict, + service.DeleteCertificateTemplateRequest(), + {}, ], ) def test_delete_certificate_template(request_type, transport: str = "grpc"): @@ -11013,7 +11069,7 @@ def test_delete_certificate_template(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11058,9 +11114,10 @@ def test_delete_certificate_template_non_empty_request_with_auto_populated_field client.delete_certificate_template(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteCertificateTemplateRequest( + request_msg = service.DeleteCertificateTemplateRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_certificate_template_use_cached_wrapped_rpc(): @@ -11156,9 +11213,15 @@ async def test_delete_certificate_template_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteCertificateTemplateRequest(), + {}, + ], +) async def test_delete_certificate_template_async( - transport: str = "grpc_asyncio", - request_type=service.DeleteCertificateTemplateRequest, + request_type, transport: str = "grpc_asyncio" ): client = CertificateAuthorityServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -11167,7 +11230,7 @@ async def test_delete_certificate_template_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( @@ -11189,11 +11252,6 @@ async def test_delete_certificate_template_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_certificate_template_async_from_dict(): - await test_delete_certificate_template_async(request_type=dict) - - def test_delete_certificate_template_field_headers(): client = CertificateAuthorityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11348,8 +11406,8 @@ async def test_delete_certificate_template_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.GetCertificateTemplateRequest, - dict, + service.GetCertificateTemplateRequest(), + {}, ], ) def test_get_certificate_template(request_type, transport: str = "grpc"): @@ -11360,7 +11418,7 @@ def test_get_certificate_template(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11410,9 +11468,10 @@ def test_get_certificate_template_non_empty_request_with_auto_populated_field(): client.get_certificate_template(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetCertificateTemplateRequest( + request_msg = service.GetCertificateTemplateRequest( name="name_value", ) + assert args[0] == request_msg def test_get_certificate_template_use_cached_wrapped_rpc(): @@ -11498,8 +11557,15 @@ async def test_get_certificate_template_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.GetCertificateTemplateRequest(), + {}, + ], +) async def test_get_certificate_template_async( - transport: str = "grpc_asyncio", request_type=service.GetCertificateTemplateRequest + request_type, transport: str = "grpc_asyncio" ): client = CertificateAuthorityServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -11508,7 +11574,7 @@ async def test_get_certificate_template_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( @@ -11535,11 +11601,6 @@ async def test_get_certificate_template_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_get_certificate_template_async_from_dict(): - await test_get_certificate_template_async(request_type=dict) - - def test_get_certificate_template_field_headers(): client = CertificateAuthorityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11694,8 +11755,8 @@ async def test_get_certificate_template_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListCertificateTemplatesRequest, - dict, + service.ListCertificateTemplatesRequest(), + {}, ], ) def test_list_certificate_templates(request_type, transport: str = "grpc"): @@ -11706,7 +11767,7 @@ def test_list_certificate_templates(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11759,12 +11820,13 @@ def test_list_certificate_templates_non_empty_request_with_auto_populated_field( client.list_certificate_templates(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListCertificateTemplatesRequest( + request_msg = service.ListCertificateTemplatesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_certificate_templates_use_cached_wrapped_rpc(): @@ -11850,9 +11912,15 @@ async def test_list_certificate_templates_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.ListCertificateTemplatesRequest(), + {}, + ], +) async def test_list_certificate_templates_async( - transport: str = "grpc_asyncio", - request_type=service.ListCertificateTemplatesRequest, + request_type, transport: str = "grpc_asyncio" ): client = CertificateAuthorityServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -11861,7 +11929,7 @@ async def test_list_certificate_templates_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( @@ -11888,11 +11956,6 @@ async def test_list_certificate_templates_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_certificate_templates_async_from_dict(): - await test_list_certificate_templates_async(request_type=dict) - - def test_list_certificate_templates_field_headers(): client = CertificateAuthorityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12247,8 +12310,8 @@ async def test_list_certificate_templates_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.UpdateCertificateTemplateRequest, - dict, + service.UpdateCertificateTemplateRequest(), + {}, ], ) def test_update_certificate_template(request_type, transport: str = "grpc"): @@ -12259,7 +12322,7 @@ def test_update_certificate_template(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -12302,7 +12365,8 @@ def test_update_certificate_template_non_empty_request_with_auto_populated_field client.update_certificate_template(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateCertificateTemplateRequest() + request_msg = service.UpdateCertificateTemplateRequest() + assert args[0] == request_msg def test_update_certificate_template_use_cached_wrapped_rpc(): @@ -12398,9 +12462,15 @@ async def test_update_certificate_template_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateCertificateTemplateRequest(), + {}, + ], +) async def test_update_certificate_template_async( - transport: str = "grpc_asyncio", - request_type=service.UpdateCertificateTemplateRequest, + request_type, transport: str = "grpc_asyncio" ): client = CertificateAuthorityServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -12409,7 +12479,7 @@ async def test_update_certificate_template_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( @@ -12431,11 +12501,6 @@ async def test_update_certificate_template_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_certificate_template_async_from_dict(): - await test_update_certificate_template_async(request_type=dict) - - def test_update_certificate_template_field_headers(): client = CertificateAuthorityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18757,7 +18822,6 @@ def test_create_certificate_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateCertificateRequest() - assert args[0] == request_msg @@ -18778,7 +18842,6 @@ def test_get_certificate_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetCertificateRequest() - assert args[0] == request_msg @@ -18801,7 +18864,6 @@ def test_list_certificates_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListCertificatesRequest() - assert args[0] == request_msg @@ -18824,7 +18886,6 @@ def test_revoke_certificate_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.RevokeCertificateRequest() - assert args[0] == request_msg @@ -18847,7 +18908,6 @@ def test_update_certificate_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateCertificateRequest() - assert args[0] == request_msg @@ -18870,7 +18930,6 @@ def test_activate_certificate_authority_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ActivateCertificateAuthorityRequest() - assert args[0] == request_msg @@ -18893,7 +18952,6 @@ def test_create_certificate_authority_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateCertificateAuthorityRequest() - assert args[0] == request_msg @@ -18916,7 +18974,6 @@ def test_disable_certificate_authority_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DisableCertificateAuthorityRequest() - assert args[0] == request_msg @@ -18939,7 +18996,6 @@ def test_enable_certificate_authority_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.EnableCertificateAuthorityRequest() - assert args[0] == request_msg @@ -18962,7 +19018,6 @@ def test_fetch_certificate_authority_csr_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.FetchCertificateAuthorityCsrRequest() - assert args[0] == request_msg @@ -18985,7 +19040,6 @@ def test_get_certificate_authority_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetCertificateAuthorityRequest() - assert args[0] == request_msg @@ -19008,7 +19062,6 @@ def test_list_certificate_authorities_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListCertificateAuthoritiesRequest() - assert args[0] == request_msg @@ -19031,7 +19084,6 @@ def test_undelete_certificate_authority_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UndeleteCertificateAuthorityRequest() - assert args[0] == request_msg @@ -19054,7 +19106,6 @@ def test_delete_certificate_authority_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteCertificateAuthorityRequest() - assert args[0] == request_msg @@ -19077,7 +19128,6 @@ def test_update_certificate_authority_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateCertificateAuthorityRequest() - assert args[0] == request_msg @@ -19098,7 +19148,6 @@ def test_create_ca_pool_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateCaPoolRequest() - assert args[0] == request_msg @@ -19119,7 +19168,6 @@ def test_update_ca_pool_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateCaPoolRequest() - assert args[0] == request_msg @@ -19140,7 +19188,6 @@ def test_get_ca_pool_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetCaPoolRequest() - assert args[0] == request_msg @@ -19161,7 +19208,6 @@ def test_list_ca_pools_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListCaPoolsRequest() - assert args[0] == request_msg @@ -19182,7 +19228,6 @@ def test_delete_ca_pool_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteCaPoolRequest() - assert args[0] == request_msg @@ -19203,7 +19248,6 @@ def test_fetch_ca_certs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.FetchCaCertsRequest() - assert args[0] == request_msg @@ -19226,7 +19270,6 @@ def test_get_certificate_revocation_list_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetCertificateRevocationListRequest() - assert args[0] == request_msg @@ -19249,7 +19292,6 @@ def test_list_certificate_revocation_lists_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListCertificateRevocationListsRequest() - assert args[0] == request_msg @@ -19272,7 +19314,6 @@ def test_update_certificate_revocation_list_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateCertificateRevocationListRequest() - assert args[0] == request_msg @@ -19295,7 +19336,6 @@ def test_create_certificate_template_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateCertificateTemplateRequest() - assert args[0] == request_msg @@ -19318,7 +19358,6 @@ def test_delete_certificate_template_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteCertificateTemplateRequest() - assert args[0] == request_msg @@ -19341,7 +19380,6 @@ def test_get_certificate_template_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetCertificateTemplateRequest() - assert args[0] == request_msg @@ -19364,7 +19402,6 @@ def test_list_certificate_templates_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListCertificateTemplatesRequest() - assert args[0] == request_msg @@ -19387,7 +19424,6 @@ def test_update_certificate_template_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateCertificateTemplateRequest() - assert args[0] == request_msg @@ -19435,7 +19471,6 @@ async def test_create_certificate_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateCertificateRequest() - assert args[0] == request_msg @@ -19467,7 +19502,6 @@ async def test_get_certificate_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetCertificateRequest() - assert args[0] == request_msg @@ -19497,7 +19531,6 @@ async def test_list_certificates_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListCertificatesRequest() - assert args[0] == request_msg @@ -19531,7 +19564,6 @@ async def test_revoke_certificate_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.RevokeCertificateRequest() - assert args[0] == request_msg @@ -19565,7 +19597,6 @@ async def test_update_certificate_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateCertificateRequest() - assert args[0] == request_msg @@ -19592,7 +19623,6 @@ async def test_activate_certificate_authority_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ActivateCertificateAuthorityRequest() - assert args[0] == request_msg @@ -19619,7 +19649,6 @@ async def test_create_certificate_authority_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateCertificateAuthorityRequest() - assert args[0] == request_msg @@ -19646,7 +19675,6 @@ async def test_disable_certificate_authority_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DisableCertificateAuthorityRequest() - assert args[0] == request_msg @@ -19673,7 +19701,6 @@ async def test_enable_certificate_authority_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.EnableCertificateAuthorityRequest() - assert args[0] == request_msg @@ -19702,7 +19729,6 @@ async def test_fetch_certificate_authority_csr_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.FetchCertificateAuthorityCsrRequest() - assert args[0] == request_msg @@ -19738,7 +19764,6 @@ async def test_get_certificate_authority_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetCertificateAuthorityRequest() - assert args[0] == request_msg @@ -19768,7 +19793,6 @@ async def test_list_certificate_authorities_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListCertificateAuthoritiesRequest() - assert args[0] == request_msg @@ -19795,7 +19819,6 @@ async def test_undelete_certificate_authority_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UndeleteCertificateAuthorityRequest() - assert args[0] == request_msg @@ -19822,7 +19845,6 @@ async def test_delete_certificate_authority_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteCertificateAuthorityRequest() - assert args[0] == request_msg @@ -19849,7 +19871,6 @@ async def test_update_certificate_authority_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateCertificateAuthorityRequest() - assert args[0] == request_msg @@ -19874,7 +19895,6 @@ async def test_create_ca_pool_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateCaPoolRequest() - assert args[0] == request_msg @@ -19899,7 +19919,6 @@ async def test_update_ca_pool_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateCaPoolRequest() - assert args[0] == request_msg @@ -19927,7 +19946,6 @@ async def test_get_ca_pool_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetCaPoolRequest() - assert args[0] == request_msg @@ -19955,7 +19973,6 @@ async def test_list_ca_pools_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListCaPoolsRequest() - assert args[0] == request_msg @@ -19980,7 +19997,6 @@ async def test_delete_ca_pool_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteCaPoolRequest() - assert args[0] == request_msg @@ -20005,7 +20021,6 @@ async def test_fetch_ca_certs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.FetchCaCertsRequest() - assert args[0] == request_msg @@ -20039,7 +20054,6 @@ async def test_get_certificate_revocation_list_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetCertificateRevocationListRequest() - assert args[0] == request_msg @@ -20069,7 +20083,6 @@ async def test_list_certificate_revocation_lists_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListCertificateRevocationListsRequest() - assert args[0] == request_msg @@ -20096,7 +20109,6 @@ async def test_update_certificate_revocation_list_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateCertificateRevocationListRequest() - assert args[0] == request_msg @@ -20123,7 +20135,6 @@ async def test_create_certificate_template_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateCertificateTemplateRequest() - assert args[0] == request_msg @@ -20150,7 +20161,6 @@ async def test_delete_certificate_template_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteCertificateTemplateRequest() - assert args[0] == request_msg @@ -20180,7 +20190,6 @@ async def test_get_certificate_template_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetCertificateTemplateRequest() - assert args[0] == request_msg @@ -20210,7 +20219,6 @@ async def test_list_certificate_templates_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListCertificateTemplatesRequest() - assert args[0] == request_msg @@ -20237,7 +20245,6 @@ async def test_update_certificate_template_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateCertificateTemplateRequest() - assert args[0] == request_msg @@ -26429,7 +26436,6 @@ def test_create_certificate_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateCertificateRequest() - assert args[0] == request_msg @@ -26449,7 +26455,6 @@ def test_get_certificate_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetCertificateRequest() - assert args[0] == request_msg @@ -26471,7 +26476,6 @@ def test_list_certificates_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListCertificatesRequest() - assert args[0] == request_msg @@ -26493,7 +26497,6 @@ def test_revoke_certificate_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.RevokeCertificateRequest() - assert args[0] == request_msg @@ -26515,7 +26518,6 @@ def test_update_certificate_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateCertificateRequest() - assert args[0] == request_msg @@ -26537,7 +26539,6 @@ def test_activate_certificate_authority_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ActivateCertificateAuthorityRequest() - assert args[0] == request_msg @@ -26559,7 +26560,6 @@ def test_create_certificate_authority_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateCertificateAuthorityRequest() - assert args[0] == request_msg @@ -26581,7 +26581,6 @@ def test_disable_certificate_authority_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DisableCertificateAuthorityRequest() - assert args[0] == request_msg @@ -26603,7 +26602,6 @@ def test_enable_certificate_authority_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.EnableCertificateAuthorityRequest() - assert args[0] == request_msg @@ -26625,7 +26623,6 @@ def test_fetch_certificate_authority_csr_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.FetchCertificateAuthorityCsrRequest() - assert args[0] == request_msg @@ -26647,7 +26644,6 @@ def test_get_certificate_authority_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetCertificateAuthorityRequest() - assert args[0] == request_msg @@ -26669,7 +26665,6 @@ def test_list_certificate_authorities_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListCertificateAuthoritiesRequest() - assert args[0] == request_msg @@ -26691,7 +26686,6 @@ def test_undelete_certificate_authority_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UndeleteCertificateAuthorityRequest() - assert args[0] == request_msg @@ -26713,7 +26707,6 @@ def test_delete_certificate_authority_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteCertificateAuthorityRequest() - assert args[0] == request_msg @@ -26735,7 +26728,6 @@ def test_update_certificate_authority_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateCertificateAuthorityRequest() - assert args[0] == request_msg @@ -26755,7 +26747,6 @@ def test_create_ca_pool_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateCaPoolRequest() - assert args[0] == request_msg @@ -26775,7 +26766,6 @@ def test_update_ca_pool_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateCaPoolRequest() - assert args[0] == request_msg @@ -26795,7 +26785,6 @@ def test_get_ca_pool_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetCaPoolRequest() - assert args[0] == request_msg @@ -26815,7 +26804,6 @@ def test_list_ca_pools_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListCaPoolsRequest() - assert args[0] == request_msg @@ -26835,7 +26823,6 @@ def test_delete_ca_pool_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteCaPoolRequest() - assert args[0] == request_msg @@ -26855,7 +26842,6 @@ def test_fetch_ca_certs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.FetchCaCertsRequest() - assert args[0] == request_msg @@ -26877,7 +26863,6 @@ def test_get_certificate_revocation_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetCertificateRevocationListRequest() - assert args[0] == request_msg @@ -26899,7 +26884,6 @@ def test_list_certificate_revocation_lists_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListCertificateRevocationListsRequest() - assert args[0] == request_msg @@ -26921,7 +26905,6 @@ def test_update_certificate_revocation_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateCertificateRevocationListRequest() - assert args[0] == request_msg @@ -26943,7 +26926,6 @@ def test_create_certificate_template_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateCertificateTemplateRequest() - assert args[0] == request_msg @@ -26965,7 +26947,6 @@ def test_delete_certificate_template_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteCertificateTemplateRequest() - assert args[0] == request_msg @@ -26987,7 +26968,6 @@ def test_get_certificate_template_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetCertificateTemplateRequest() - assert args[0] == request_msg @@ -27009,7 +26989,6 @@ def test_list_certificate_templates_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListCertificateTemplatesRequest() - assert args[0] == request_msg @@ -27031,7 +27010,6 @@ def test_update_certificate_template_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateCertificateTemplateRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-private-ca/tests/unit/gapic/privateca_v1beta1/test_certificate_authority_service.py b/packages/google-cloud-private-ca/tests/unit/gapic/privateca_v1beta1/test_certificate_authority_service.py index e6826595cc65..e28eb8887c7a 100644 --- a/packages/google-cloud-private-ca/tests/unit/gapic/privateca_v1beta1/test_certificate_authority_service.py +++ b/packages/google-cloud-private-ca/tests/unit/gapic/privateca_v1beta1/test_certificate_authority_service.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 @@ -116,6 +117,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" @@ -1422,8 +1438,8 @@ def test_certificate_authority_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - service.CreateCertificateRequest, - dict, + service.CreateCertificateRequest(), + {}, ], ) def test_create_certificate(request_type, transport: str = "grpc"): @@ -1434,7 +1450,7 @@ def test_create_certificate(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1489,11 +1505,12 @@ def test_create_certificate_non_empty_request_with_auto_populated_field(): client.create_certificate(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateCertificateRequest( + request_msg = service.CreateCertificateRequest( parent="parent_value", certificate_id="certificate_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_certificate_use_cached_wrapped_rpc(): @@ -1578,9 +1595,14 @@ async def test_create_certificate_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_certificate_async( - transport: str = "grpc_asyncio", request_type=service.CreateCertificateRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CreateCertificateRequest(), + {}, + ], +) +async def test_create_certificate_async(request_type, transport: str = "grpc_asyncio"): client = CertificateAuthorityServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1588,7 +1610,7 @@ async def test_create_certificate_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( @@ -1617,11 +1639,6 @@ async def test_create_certificate_async( assert response.pem_certificate_chain == ["pem_certificate_chain_value"] -@pytest.mark.asyncio -async def test_create_certificate_async_from_dict(): - await test_create_certificate_async(request_type=dict) - - def test_create_certificate_field_headers(): client = CertificateAuthorityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1796,8 +1813,8 @@ async def test_create_certificate_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.GetCertificateRequest, - dict, + service.GetCertificateRequest(), + {}, ], ) def test_get_certificate(request_type, transport: str = "grpc"): @@ -1808,7 +1825,7 @@ def test_get_certificate(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_certificate), "__call__") as call: @@ -1857,9 +1874,10 @@ def test_get_certificate_non_empty_request_with_auto_populated_field(): client.get_certificate(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetCertificateRequest( + request_msg = service.GetCertificateRequest( name="name_value", ) + assert args[0] == request_msg def test_get_certificate_use_cached_wrapped_rpc(): @@ -1940,9 +1958,14 @@ async def test_get_certificate_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_certificate_async( - transport: str = "grpc_asyncio", request_type=service.GetCertificateRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetCertificateRequest(), + {}, + ], +) +async def test_get_certificate_async(request_type, transport: str = "grpc_asyncio"): client = CertificateAuthorityServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1950,7 +1973,7 @@ async def test_get_certificate_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_certificate), "__call__") as call: @@ -1977,11 +2000,6 @@ async def test_get_certificate_async( assert response.pem_certificate_chain == ["pem_certificate_chain_value"] -@pytest.mark.asyncio -async def test_get_certificate_async_from_dict(): - await test_get_certificate_async(request_type=dict) - - def test_get_certificate_field_headers(): client = CertificateAuthorityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2128,8 +2146,8 @@ async def test_get_certificate_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListCertificatesRequest, - dict, + service.ListCertificatesRequest(), + {}, ], ) def test_list_certificates(request_type, transport: str = "grpc"): @@ -2140,7 +2158,7 @@ def test_list_certificates(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2193,12 +2211,13 @@ def test_list_certificates_non_empty_request_with_auto_populated_field(): client.list_certificates(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListCertificatesRequest( + request_msg = service.ListCertificatesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_certificates_use_cached_wrapped_rpc(): @@ -2281,9 +2300,14 @@ async def test_list_certificates_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_certificates_async( - transport: str = "grpc_asyncio", request_type=service.ListCertificatesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListCertificatesRequest(), + {}, + ], +) +async def test_list_certificates_async(request_type, transport: str = "grpc_asyncio"): client = CertificateAuthorityServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2291,7 +2315,7 @@ async def test_list_certificates_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( @@ -2318,11 +2342,6 @@ async def test_list_certificates_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_certificates_async_from_dict(): - await test_list_certificates_async(request_type=dict) - - def test_list_certificates_field_headers(): client = CertificateAuthorityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2675,8 +2694,8 @@ async def test_list_certificates_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.RevokeCertificateRequest, - dict, + service.RevokeCertificateRequest(), + {}, ], ) def test_revoke_certificate(request_type, transport: str = "grpc"): @@ -2687,7 +2706,7 @@ def test_revoke_certificate(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2741,10 +2760,11 @@ def test_revoke_certificate_non_empty_request_with_auto_populated_field(): client.revoke_certificate(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.RevokeCertificateRequest( + request_msg = service.RevokeCertificateRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_revoke_certificate_use_cached_wrapped_rpc(): @@ -2829,9 +2849,14 @@ async def test_revoke_certificate_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_revoke_certificate_async( - transport: str = "grpc_asyncio", request_type=service.RevokeCertificateRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.RevokeCertificateRequest(), + {}, + ], +) +async def test_revoke_certificate_async(request_type, transport: str = "grpc_asyncio"): client = CertificateAuthorityServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2839,7 +2864,7 @@ async def test_revoke_certificate_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( @@ -2868,11 +2893,6 @@ async def test_revoke_certificate_async( assert response.pem_certificate_chain == ["pem_certificate_chain_value"] -@pytest.mark.asyncio -async def test_revoke_certificate_async_from_dict(): - await test_revoke_certificate_async(request_type=dict) - - def test_revoke_certificate_field_headers(): client = CertificateAuthorityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3027,8 +3047,8 @@ async def test_revoke_certificate_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdateCertificateRequest, - dict, + service.UpdateCertificateRequest(), + {}, ], ) def test_update_certificate(request_type, transport: str = "grpc"): @@ -3039,7 +3059,7 @@ def test_update_certificate(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3092,9 +3112,10 @@ def test_update_certificate_non_empty_request_with_auto_populated_field(): client.update_certificate(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateCertificateRequest( + request_msg = service.UpdateCertificateRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_certificate_use_cached_wrapped_rpc(): @@ -3179,9 +3200,14 @@ async def test_update_certificate_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_certificate_async( - transport: str = "grpc_asyncio", request_type=service.UpdateCertificateRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateCertificateRequest(), + {}, + ], +) +async def test_update_certificate_async(request_type, transport: str = "grpc_asyncio"): client = CertificateAuthorityServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3189,7 +3215,7 @@ async def test_update_certificate_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( @@ -3218,11 +3244,6 @@ async def test_update_certificate_async( assert response.pem_certificate_chain == ["pem_certificate_chain_value"] -@pytest.mark.asyncio -async def test_update_certificate_async_from_dict(): - await test_update_certificate_async(request_type=dict) - - def test_update_certificate_field_headers(): client = CertificateAuthorityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3387,8 +3408,8 @@ async def test_update_certificate_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ActivateCertificateAuthorityRequest, - dict, + service.ActivateCertificateAuthorityRequest(), + {}, ], ) def test_activate_certificate_authority(request_type, transport: str = "grpc"): @@ -3399,7 +3420,7 @@ def test_activate_certificate_authority(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3446,11 +3467,12 @@ def test_activate_certificate_authority_non_empty_request_with_auto_populated_fi client.activate_certificate_authority(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ActivateCertificateAuthorityRequest( + request_msg = service.ActivateCertificateAuthorityRequest( name="name_value", pem_ca_certificate="pem_ca_certificate_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_activate_certificate_authority_use_cached_wrapped_rpc(): @@ -3546,9 +3568,15 @@ async def test_activate_certificate_authority_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.ActivateCertificateAuthorityRequest(), + {}, + ], +) async def test_activate_certificate_authority_async( - transport: str = "grpc_asyncio", - request_type=service.ActivateCertificateAuthorityRequest, + request_type, transport: str = "grpc_asyncio" ): client = CertificateAuthorityServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3557,7 +3585,7 @@ async def test_activate_certificate_authority_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( @@ -3579,11 +3607,6 @@ async def test_activate_certificate_authority_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_activate_certificate_authority_async_from_dict(): - await test_activate_certificate_authority_async(request_type=dict) - - def test_activate_certificate_authority_field_headers(): client = CertificateAuthorityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3738,8 +3761,8 @@ async def test_activate_certificate_authority_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.CreateCertificateAuthorityRequest, - dict, + service.CreateCertificateAuthorityRequest(), + {}, ], ) def test_create_certificate_authority(request_type, transport: str = "grpc"): @@ -3750,7 +3773,7 @@ def test_create_certificate_authority(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3797,11 +3820,12 @@ def test_create_certificate_authority_non_empty_request_with_auto_populated_fiel client.create_certificate_authority(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateCertificateAuthorityRequest( + request_msg = service.CreateCertificateAuthorityRequest( parent="parent_value", certificate_authority_id="certificate_authority_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_certificate_authority_use_cached_wrapped_rpc(): @@ -3897,9 +3921,15 @@ async def test_create_certificate_authority_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.CreateCertificateAuthorityRequest(), + {}, + ], +) async def test_create_certificate_authority_async( - transport: str = "grpc_asyncio", - request_type=service.CreateCertificateAuthorityRequest, + request_type, transport: str = "grpc_asyncio" ): client = CertificateAuthorityServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3908,7 +3938,7 @@ async def test_create_certificate_authority_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( @@ -3930,11 +3960,6 @@ async def test_create_certificate_authority_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_certificate_authority_async_from_dict(): - await test_create_certificate_authority_async(request_type=dict) - - def test_create_certificate_authority_field_headers(): client = CertificateAuthorityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4109,8 +4134,8 @@ async def test_create_certificate_authority_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DisableCertificateAuthorityRequest, - dict, + service.DisableCertificateAuthorityRequest(), + {}, ], ) def test_disable_certificate_authority(request_type, transport: str = "grpc"): @@ -4121,7 +4146,7 @@ def test_disable_certificate_authority(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4167,10 +4192,11 @@ def test_disable_certificate_authority_non_empty_request_with_auto_populated_fie client.disable_certificate_authority(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DisableCertificateAuthorityRequest( + request_msg = service.DisableCertificateAuthorityRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_disable_certificate_authority_use_cached_wrapped_rpc(): @@ -4266,9 +4292,15 @@ async def test_disable_certificate_authority_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.DisableCertificateAuthorityRequest(), + {}, + ], +) async def test_disable_certificate_authority_async( - transport: str = "grpc_asyncio", - request_type=service.DisableCertificateAuthorityRequest, + request_type, transport: str = "grpc_asyncio" ): client = CertificateAuthorityServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4277,7 +4309,7 @@ async def test_disable_certificate_authority_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( @@ -4299,11 +4331,6 @@ async def test_disable_certificate_authority_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_disable_certificate_authority_async_from_dict(): - await test_disable_certificate_authority_async(request_type=dict) - - def test_disable_certificate_authority_field_headers(): client = CertificateAuthorityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4458,8 +4485,8 @@ async def test_disable_certificate_authority_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.EnableCertificateAuthorityRequest, - dict, + service.EnableCertificateAuthorityRequest(), + {}, ], ) def test_enable_certificate_authority(request_type, transport: str = "grpc"): @@ -4470,7 +4497,7 @@ def test_enable_certificate_authority(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4516,10 +4543,11 @@ def test_enable_certificate_authority_non_empty_request_with_auto_populated_fiel client.enable_certificate_authority(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.EnableCertificateAuthorityRequest( + request_msg = service.EnableCertificateAuthorityRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_enable_certificate_authority_use_cached_wrapped_rpc(): @@ -4615,9 +4643,15 @@ async def test_enable_certificate_authority_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.EnableCertificateAuthorityRequest(), + {}, + ], +) async def test_enable_certificate_authority_async( - transport: str = "grpc_asyncio", - request_type=service.EnableCertificateAuthorityRequest, + request_type, transport: str = "grpc_asyncio" ): client = CertificateAuthorityServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4626,7 +4660,7 @@ async def test_enable_certificate_authority_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( @@ -4648,11 +4682,6 @@ async def test_enable_certificate_authority_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_enable_certificate_authority_async_from_dict(): - await test_enable_certificate_authority_async(request_type=dict) - - def test_enable_certificate_authority_field_headers(): client = CertificateAuthorityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4807,8 +4836,8 @@ async def test_enable_certificate_authority_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.FetchCertificateAuthorityCsrRequest, - dict, + service.FetchCertificateAuthorityCsrRequest(), + {}, ], ) def test_fetch_certificate_authority_csr(request_type, transport: str = "grpc"): @@ -4819,7 +4848,7 @@ def test_fetch_certificate_authority_csr(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4867,9 +4896,10 @@ def test_fetch_certificate_authority_csr_non_empty_request_with_auto_populated_f client.fetch_certificate_authority_csr(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.FetchCertificateAuthorityCsrRequest( + request_msg = service.FetchCertificateAuthorityCsrRequest( name="name_value", ) + assert args[0] == request_msg def test_fetch_certificate_authority_csr_use_cached_wrapped_rpc(): @@ -4955,9 +4985,15 @@ async def test_fetch_certificate_authority_csr_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.FetchCertificateAuthorityCsrRequest(), + {}, + ], +) async def test_fetch_certificate_authority_csr_async( - transport: str = "grpc_asyncio", - request_type=service.FetchCertificateAuthorityCsrRequest, + request_type, transport: str = "grpc_asyncio" ): client = CertificateAuthorityServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4966,7 +5002,7 @@ async def test_fetch_certificate_authority_csr_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( @@ -4991,11 +5027,6 @@ async def test_fetch_certificate_authority_csr_async( assert response.pem_csr == "pem_csr_value" -@pytest.mark.asyncio -async def test_fetch_certificate_authority_csr_async_from_dict(): - await test_fetch_certificate_authority_csr_async(request_type=dict) - - def test_fetch_certificate_authority_csr_field_headers(): client = CertificateAuthorityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5150,8 +5181,8 @@ async def test_fetch_certificate_authority_csr_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.GetCertificateAuthorityRequest, - dict, + service.GetCertificateAuthorityRequest(), + {}, ], ) def test_get_certificate_authority(request_type, transport: str = "grpc"): @@ -5162,7 +5193,7 @@ def test_get_certificate_authority(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5220,9 +5251,10 @@ def test_get_certificate_authority_non_empty_request_with_auto_populated_field() client.get_certificate_authority(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetCertificateAuthorityRequest( + request_msg = service.GetCertificateAuthorityRequest( name="name_value", ) + assert args[0] == request_msg def test_get_certificate_authority_use_cached_wrapped_rpc(): @@ -5308,8 +5340,15 @@ async def test_get_certificate_authority_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.GetCertificateAuthorityRequest(), + {}, + ], +) async def test_get_certificate_authority_async( - transport: str = "grpc_asyncio", request_type=service.GetCertificateAuthorityRequest + request_type, transport: str = "grpc_asyncio" ): client = CertificateAuthorityServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5318,7 +5357,7 @@ async def test_get_certificate_authority_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( @@ -5353,11 +5392,6 @@ async def test_get_certificate_authority_async( assert response.gcs_bucket == "gcs_bucket_value" -@pytest.mark.asyncio -async def test_get_certificate_authority_async_from_dict(): - await test_get_certificate_authority_async(request_type=dict) - - def test_get_certificate_authority_field_headers(): client = CertificateAuthorityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5512,8 +5546,8 @@ async def test_get_certificate_authority_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListCertificateAuthoritiesRequest, - dict, + service.ListCertificateAuthoritiesRequest(), + {}, ], ) def test_list_certificate_authorities(request_type, transport: str = "grpc"): @@ -5524,7 +5558,7 @@ def test_list_certificate_authorities(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5577,12 +5611,13 @@ def test_list_certificate_authorities_non_empty_request_with_auto_populated_fiel client.list_certificate_authorities(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListCertificateAuthoritiesRequest( + request_msg = service.ListCertificateAuthoritiesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_certificate_authorities_use_cached_wrapped_rpc(): @@ -5668,9 +5703,15 @@ async def test_list_certificate_authorities_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.ListCertificateAuthoritiesRequest(), + {}, + ], +) async def test_list_certificate_authorities_async( - transport: str = "grpc_asyncio", - request_type=service.ListCertificateAuthoritiesRequest, + request_type, transport: str = "grpc_asyncio" ): client = CertificateAuthorityServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5679,7 +5720,7 @@ async def test_list_certificate_authorities_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( @@ -5706,11 +5747,6 @@ async def test_list_certificate_authorities_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_certificate_authorities_async_from_dict(): - await test_list_certificate_authorities_async(request_type=dict) - - def test_list_certificate_authorities_field_headers(): client = CertificateAuthorityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6067,8 +6103,8 @@ async def test_list_certificate_authorities_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.RestoreCertificateAuthorityRequest, - dict, + service.RestoreCertificateAuthorityRequest(), + {}, ], ) def test_restore_certificate_authority(request_type, transport: str = "grpc"): @@ -6079,7 +6115,7 @@ def test_restore_certificate_authority(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6125,10 +6161,11 @@ def test_restore_certificate_authority_non_empty_request_with_auto_populated_fie client.restore_certificate_authority(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.RestoreCertificateAuthorityRequest( + request_msg = service.RestoreCertificateAuthorityRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_restore_certificate_authority_use_cached_wrapped_rpc(): @@ -6224,9 +6261,15 @@ async def test_restore_certificate_authority_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.RestoreCertificateAuthorityRequest(), + {}, + ], +) async def test_restore_certificate_authority_async( - transport: str = "grpc_asyncio", - request_type=service.RestoreCertificateAuthorityRequest, + request_type, transport: str = "grpc_asyncio" ): client = CertificateAuthorityServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -6235,7 +6278,7 @@ async def test_restore_certificate_authority_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( @@ -6257,11 +6300,6 @@ async def test_restore_certificate_authority_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_restore_certificate_authority_async_from_dict(): - await test_restore_certificate_authority_async(request_type=dict) - - def test_restore_certificate_authority_field_headers(): client = CertificateAuthorityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6416,8 +6454,8 @@ async def test_restore_certificate_authority_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ScheduleDeleteCertificateAuthorityRequest, - dict, + service.ScheduleDeleteCertificateAuthorityRequest(), + {}, ], ) def test_schedule_delete_certificate_authority(request_type, transport: str = "grpc"): @@ -6428,7 +6466,7 @@ def test_schedule_delete_certificate_authority(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( @@ -6474,10 +6512,11 @@ def test_schedule_delete_certificate_authority_non_empty_request_with_auto_popul client.schedule_delete_certificate_authority(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ScheduleDeleteCertificateAuthorityRequest( + request_msg = service.ScheduleDeleteCertificateAuthorityRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_schedule_delete_certificate_authority_use_cached_wrapped_rpc(): @@ -6573,9 +6612,15 @@ async def test_schedule_delete_certificate_authority_async_use_cached_wrapped_rp @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.ScheduleDeleteCertificateAuthorityRequest(), + {}, + ], +) async def test_schedule_delete_certificate_authority_async( - transport: str = "grpc_asyncio", - request_type=service.ScheduleDeleteCertificateAuthorityRequest, + request_type, transport: str = "grpc_asyncio" ): client = CertificateAuthorityServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -6584,7 +6629,7 @@ async def test_schedule_delete_certificate_authority_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( @@ -6606,11 +6651,6 @@ async def test_schedule_delete_certificate_authority_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_schedule_delete_certificate_authority_async_from_dict(): - await test_schedule_delete_certificate_authority_async(request_type=dict) - - def test_schedule_delete_certificate_authority_field_headers(): client = CertificateAuthorityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6765,8 +6805,8 @@ async def test_schedule_delete_certificate_authority_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdateCertificateAuthorityRequest, - dict, + service.UpdateCertificateAuthorityRequest(), + {}, ], ) def test_update_certificate_authority(request_type, transport: str = "grpc"): @@ -6777,7 +6817,7 @@ def test_update_certificate_authority(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6822,9 +6862,10 @@ def test_update_certificate_authority_non_empty_request_with_auto_populated_fiel client.update_certificate_authority(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateCertificateAuthorityRequest( + request_msg = service.UpdateCertificateAuthorityRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_certificate_authority_use_cached_wrapped_rpc(): @@ -6920,9 +6961,15 @@ async def test_update_certificate_authority_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateCertificateAuthorityRequest(), + {}, + ], +) async def test_update_certificate_authority_async( - transport: str = "grpc_asyncio", - request_type=service.UpdateCertificateAuthorityRequest, + request_type, transport: str = "grpc_asyncio" ): client = CertificateAuthorityServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -6931,7 +6978,7 @@ async def test_update_certificate_authority_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( @@ -6953,11 +7000,6 @@ async def test_update_certificate_authority_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_certificate_authority_async_from_dict(): - await test_update_certificate_authority_async(request_type=dict) - - def test_update_certificate_authority_field_headers(): client = CertificateAuthorityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7122,8 +7164,8 @@ async def test_update_certificate_authority_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.GetCertificateRevocationListRequest, - dict, + service.GetCertificateRevocationListRequest(), + {}, ], ) def test_get_certificate_revocation_list(request_type, transport: str = "grpc"): @@ -7134,7 +7176,7 @@ def test_get_certificate_revocation_list(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7190,9 +7232,10 @@ def test_get_certificate_revocation_list_non_empty_request_with_auto_populated_f client.get_certificate_revocation_list(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetCertificateRevocationListRequest( + request_msg = service.GetCertificateRevocationListRequest( name="name_value", ) + assert args[0] == request_msg def test_get_certificate_revocation_list_use_cached_wrapped_rpc(): @@ -7278,9 +7321,15 @@ async def test_get_certificate_revocation_list_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.GetCertificateRevocationListRequest(), + {}, + ], +) async def test_get_certificate_revocation_list_async( - transport: str = "grpc_asyncio", - request_type=service.GetCertificateRevocationListRequest, + request_type, transport: str = "grpc_asyncio" ): client = CertificateAuthorityServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -7289,7 +7338,7 @@ async def test_get_certificate_revocation_list_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( @@ -7322,11 +7371,6 @@ async def test_get_certificate_revocation_list_async( assert response.state == resources.CertificateRevocationList.State.ACTIVE -@pytest.mark.asyncio -async def test_get_certificate_revocation_list_async_from_dict(): - await test_get_certificate_revocation_list_async(request_type=dict) - - def test_get_certificate_revocation_list_field_headers(): client = CertificateAuthorityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7481,8 +7525,8 @@ async def test_get_certificate_revocation_list_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListCertificateRevocationListsRequest, - dict, + service.ListCertificateRevocationListsRequest(), + {}, ], ) def test_list_certificate_revocation_lists(request_type, transport: str = "grpc"): @@ -7493,7 +7537,7 @@ def test_list_certificate_revocation_lists(request_type, transport: str = "grpc" # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7546,12 +7590,13 @@ def test_list_certificate_revocation_lists_non_empty_request_with_auto_populated client.list_certificate_revocation_lists(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListCertificateRevocationListsRequest( + request_msg = service.ListCertificateRevocationListsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_certificate_revocation_lists_use_cached_wrapped_rpc(): @@ -7637,9 +7682,15 @@ async def test_list_certificate_revocation_lists_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.ListCertificateRevocationListsRequest(), + {}, + ], +) async def test_list_certificate_revocation_lists_async( - transport: str = "grpc_asyncio", - request_type=service.ListCertificateRevocationListsRequest, + request_type, transport: str = "grpc_asyncio" ): client = CertificateAuthorityServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -7648,7 +7699,7 @@ async def test_list_certificate_revocation_lists_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( @@ -7675,11 +7726,6 @@ async def test_list_certificate_revocation_lists_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_certificate_revocation_lists_async_from_dict(): - await test_list_certificate_revocation_lists_async(request_type=dict) - - def test_list_certificate_revocation_lists_field_headers(): client = CertificateAuthorityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8038,8 +8084,8 @@ async def test_list_certificate_revocation_lists_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.UpdateCertificateRevocationListRequest, - dict, + service.UpdateCertificateRevocationListRequest(), + {}, ], ) def test_update_certificate_revocation_list(request_type, transport: str = "grpc"): @@ -8050,7 +8096,7 @@ def test_update_certificate_revocation_list(request_type, transport: str = "grpc # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8095,9 +8141,10 @@ def test_update_certificate_revocation_list_non_empty_request_with_auto_populate client.update_certificate_revocation_list(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateCertificateRevocationListRequest( + request_msg = service.UpdateCertificateRevocationListRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_certificate_revocation_list_use_cached_wrapped_rpc(): @@ -8193,9 +8240,15 @@ async def test_update_certificate_revocation_list_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateCertificateRevocationListRequest(), + {}, + ], +) async def test_update_certificate_revocation_list_async( - transport: str = "grpc_asyncio", - request_type=service.UpdateCertificateRevocationListRequest, + request_type, transport: str = "grpc_asyncio" ): client = CertificateAuthorityServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -8204,7 +8257,7 @@ async def test_update_certificate_revocation_list_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( @@ -8226,11 +8279,6 @@ async def test_update_certificate_revocation_list_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_certificate_revocation_list_async_from_dict(): - await test_update_certificate_revocation_list_async(request_type=dict) - - def test_update_certificate_revocation_list_field_headers(): client = CertificateAuthorityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8403,8 +8451,8 @@ async def test_update_certificate_revocation_list_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.GetReusableConfigRequest, - dict, + service.GetReusableConfigRequest(), + {}, ], ) def test_get_reusable_config(request_type, transport: str = "grpc"): @@ -8415,7 +8463,7 @@ def test_get_reusable_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( @@ -8465,9 +8513,10 @@ def test_get_reusable_config_non_empty_request_with_auto_populated_field(): client.get_reusable_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetReusableConfigRequest( + request_msg = service.GetReusableConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_reusable_config_use_cached_wrapped_rpc(): @@ -8552,9 +8601,14 @@ async def test_get_reusable_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_reusable_config_async( - transport: str = "grpc_asyncio", request_type=service.GetReusableConfigRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetReusableConfigRequest(), + {}, + ], +) +async def test_get_reusable_config_async(request_type, transport: str = "grpc_asyncio"): client = CertificateAuthorityServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8562,7 +8616,7 @@ async def test_get_reusable_config_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( @@ -8589,11 +8643,6 @@ async def test_get_reusable_config_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_get_reusable_config_async_from_dict(): - await test_get_reusable_config_async(request_type=dict) - - def test_get_reusable_config_field_headers(): client = CertificateAuthorityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8748,8 +8797,8 @@ async def test_get_reusable_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListReusableConfigsRequest, - dict, + service.ListReusableConfigsRequest(), + {}, ], ) def test_list_reusable_configs(request_type, transport: str = "grpc"): @@ -8760,7 +8809,7 @@ def test_list_reusable_configs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,12 +8862,13 @@ def test_list_reusable_configs_non_empty_request_with_auto_populated_field(): client.list_reusable_configs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListReusableConfigsRequest( + request_msg = service.ListReusableConfigsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_reusable_configs_use_cached_wrapped_rpc(): @@ -8904,8 +8954,15 @@ async def test_list_reusable_configs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.ListReusableConfigsRequest(), + {}, + ], +) async def test_list_reusable_configs_async( - transport: str = "grpc_asyncio", request_type=service.ListReusableConfigsRequest + request_type, transport: str = "grpc_asyncio" ): client = CertificateAuthorityServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -8914,7 +8971,7 @@ async def test_list_reusable_configs_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( @@ -8941,11 +8998,6 @@ async def test_list_reusable_configs_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_reusable_configs_async_from_dict(): - await test_list_reusable_configs_async(request_type=dict) - - def test_list_reusable_configs_field_headers(): client = CertificateAuthorityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13614,7 +13666,6 @@ def test_create_certificate_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateCertificateRequest() - assert args[0] == request_msg @@ -13635,7 +13686,6 @@ def test_get_certificate_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetCertificateRequest() - assert args[0] == request_msg @@ -13658,7 +13708,6 @@ def test_list_certificates_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListCertificatesRequest() - assert args[0] == request_msg @@ -13681,7 +13730,6 @@ def test_revoke_certificate_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.RevokeCertificateRequest() - assert args[0] == request_msg @@ -13704,7 +13752,6 @@ def test_update_certificate_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateCertificateRequest() - assert args[0] == request_msg @@ -13727,7 +13774,6 @@ def test_activate_certificate_authority_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ActivateCertificateAuthorityRequest() - assert args[0] == request_msg @@ -13750,7 +13796,6 @@ def test_create_certificate_authority_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateCertificateAuthorityRequest() - assert args[0] == request_msg @@ -13773,7 +13818,6 @@ def test_disable_certificate_authority_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DisableCertificateAuthorityRequest() - assert args[0] == request_msg @@ -13796,7 +13840,6 @@ def test_enable_certificate_authority_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.EnableCertificateAuthorityRequest() - assert args[0] == request_msg @@ -13819,7 +13862,6 @@ def test_fetch_certificate_authority_csr_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.FetchCertificateAuthorityCsrRequest() - assert args[0] == request_msg @@ -13842,7 +13884,6 @@ def test_get_certificate_authority_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetCertificateAuthorityRequest() - assert args[0] == request_msg @@ -13865,7 +13906,6 @@ def test_list_certificate_authorities_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListCertificateAuthoritiesRequest() - assert args[0] == request_msg @@ -13888,7 +13928,6 @@ def test_restore_certificate_authority_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.RestoreCertificateAuthorityRequest() - assert args[0] == request_msg @@ -13911,7 +13950,6 @@ def test_schedule_delete_certificate_authority_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ScheduleDeleteCertificateAuthorityRequest() - assert args[0] == request_msg @@ -13934,7 +13972,6 @@ def test_update_certificate_authority_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateCertificateAuthorityRequest() - assert args[0] == request_msg @@ -13957,7 +13994,6 @@ def test_get_certificate_revocation_list_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetCertificateRevocationListRequest() - assert args[0] == request_msg @@ -13980,7 +14016,6 @@ def test_list_certificate_revocation_lists_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListCertificateRevocationListsRequest() - assert args[0] == request_msg @@ -14003,7 +14038,6 @@ def test_update_certificate_revocation_list_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateCertificateRevocationListRequest() - assert args[0] == request_msg @@ -14026,7 +14060,6 @@ def test_get_reusable_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetReusableConfigRequest() - assert args[0] == request_msg @@ -14049,7 +14082,6 @@ def test_list_reusable_configs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListReusableConfigsRequest() - assert args[0] == request_msg @@ -14094,7 +14126,6 @@ async def test_create_certificate_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateCertificateRequest() - assert args[0] == request_msg @@ -14123,7 +14154,6 @@ async def test_get_certificate_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetCertificateRequest() - assert args[0] == request_msg @@ -14153,7 +14183,6 @@ async def test_list_certificates_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListCertificatesRequest() - assert args[0] == request_msg @@ -14184,7 +14213,6 @@ async def test_revoke_certificate_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.RevokeCertificateRequest() - assert args[0] == request_msg @@ -14215,7 +14243,6 @@ async def test_update_certificate_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateCertificateRequest() - assert args[0] == request_msg @@ -14242,7 +14269,6 @@ async def test_activate_certificate_authority_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ActivateCertificateAuthorityRequest() - assert args[0] == request_msg @@ -14269,7 +14295,6 @@ async def test_create_certificate_authority_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateCertificateAuthorityRequest() - assert args[0] == request_msg @@ -14296,7 +14321,6 @@ async def test_disable_certificate_authority_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DisableCertificateAuthorityRequest() - assert args[0] == request_msg @@ -14323,7 +14347,6 @@ async def test_enable_certificate_authority_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.EnableCertificateAuthorityRequest() - assert args[0] == request_msg @@ -14352,7 +14375,6 @@ async def test_fetch_certificate_authority_csr_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.FetchCertificateAuthorityCsrRequest() - assert args[0] == request_msg @@ -14386,7 +14408,6 @@ async def test_get_certificate_authority_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetCertificateAuthorityRequest() - assert args[0] == request_msg @@ -14416,7 +14437,6 @@ async def test_list_certificate_authorities_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListCertificateAuthoritiesRequest() - assert args[0] == request_msg @@ -14443,7 +14463,6 @@ async def test_restore_certificate_authority_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.RestoreCertificateAuthorityRequest() - assert args[0] == request_msg @@ -14470,7 +14489,6 @@ async def test_schedule_delete_certificate_authority_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ScheduleDeleteCertificateAuthorityRequest() - assert args[0] == request_msg @@ -14497,7 +14515,6 @@ async def test_update_certificate_authority_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateCertificateAuthorityRequest() - assert args[0] == request_msg @@ -14530,7 +14547,6 @@ async def test_get_certificate_revocation_list_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetCertificateRevocationListRequest() - assert args[0] == request_msg @@ -14560,7 +14576,6 @@ async def test_list_certificate_revocation_lists_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListCertificateRevocationListsRequest() - assert args[0] == request_msg @@ -14587,7 +14602,6 @@ async def test_update_certificate_revocation_list_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateCertificateRevocationListRequest() - assert args[0] == request_msg @@ -14617,7 +14631,6 @@ async def test_get_reusable_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetReusableConfigRequest() - assert args[0] == request_msg @@ -14647,7 +14660,6 @@ async def test_list_reusable_configs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListReusableConfigsRequest() - assert args[0] == request_msg @@ -18357,7 +18369,6 @@ def test_create_certificate_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateCertificateRequest() - assert args[0] == request_msg @@ -18377,7 +18388,6 @@ def test_get_certificate_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetCertificateRequest() - assert args[0] == request_msg @@ -18399,7 +18409,6 @@ def test_list_certificates_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListCertificatesRequest() - assert args[0] == request_msg @@ -18421,7 +18430,6 @@ def test_revoke_certificate_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.RevokeCertificateRequest() - assert args[0] == request_msg @@ -18443,7 +18451,6 @@ def test_update_certificate_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateCertificateRequest() - assert args[0] == request_msg @@ -18465,7 +18472,6 @@ def test_activate_certificate_authority_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ActivateCertificateAuthorityRequest() - assert args[0] == request_msg @@ -18487,7 +18493,6 @@ def test_create_certificate_authority_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateCertificateAuthorityRequest() - assert args[0] == request_msg @@ -18509,7 +18514,6 @@ def test_disable_certificate_authority_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DisableCertificateAuthorityRequest() - assert args[0] == request_msg @@ -18531,7 +18535,6 @@ def test_enable_certificate_authority_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.EnableCertificateAuthorityRequest() - assert args[0] == request_msg @@ -18553,7 +18556,6 @@ def test_fetch_certificate_authority_csr_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.FetchCertificateAuthorityCsrRequest() - assert args[0] == request_msg @@ -18575,7 +18577,6 @@ def test_get_certificate_authority_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetCertificateAuthorityRequest() - assert args[0] == request_msg @@ -18597,7 +18598,6 @@ def test_list_certificate_authorities_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListCertificateAuthoritiesRequest() - assert args[0] == request_msg @@ -18619,7 +18619,6 @@ def test_restore_certificate_authority_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.RestoreCertificateAuthorityRequest() - assert args[0] == request_msg @@ -18641,7 +18640,6 @@ def test_schedule_delete_certificate_authority_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ScheduleDeleteCertificateAuthorityRequest() - assert args[0] == request_msg @@ -18663,7 +18661,6 @@ def test_update_certificate_authority_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateCertificateAuthorityRequest() - assert args[0] == request_msg @@ -18685,7 +18682,6 @@ def test_get_certificate_revocation_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetCertificateRevocationListRequest() - assert args[0] == request_msg @@ -18707,7 +18703,6 @@ def test_list_certificate_revocation_lists_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListCertificateRevocationListsRequest() - assert args[0] == request_msg @@ -18729,7 +18724,6 @@ def test_update_certificate_revocation_list_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateCertificateRevocationListRequest() - assert args[0] == request_msg @@ -18751,7 +18745,6 @@ def test_get_reusable_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetReusableConfigRequest() - assert args[0] == request_msg @@ -18773,7 +18766,6 @@ def test_list_reusable_configs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListReusableConfigsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-private-catalog/noxfile.py b/packages/google-cloud-private-catalog/noxfile.py index 02262809d3da..6c62e204bc2c 100644 --- a/packages/google-cloud-private-catalog/noxfile.py +++ b/packages/google-cloud-private-catalog/noxfile.py @@ -47,7 +47,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-private-catalog" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-private-catalog/setup.py b/packages/google-cloud-private-catalog/setup.py index 2e16e7df2ef2..37ec2442c612 100644 --- a/packages/google-cloud-private-catalog/setup.py +++ b/packages/google-cloud-private-catalog/setup.py @@ -45,7 +45,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/google-cloud-private-catalog/testing/constraints-3.10.txt b/packages/google-cloud-private-catalog/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-private-catalog/testing/constraints-3.10.txt +++ b/packages/google-cloud-private-catalog/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-private-catalog/tests/unit/gapic/privatecatalog_v1beta1/test_private_catalog.py b/packages/google-cloud-private-catalog/tests/unit/gapic/privatecatalog_v1beta1/test_private_catalog.py index f731939ab9bb..b7ae450d5a33 100644 --- a/packages/google-cloud-private-catalog/tests/unit/gapic/privatecatalog_v1beta1/test_private_catalog.py +++ b/packages/google-cloud-private-catalog/tests/unit/gapic/privatecatalog_v1beta1/test_private_catalog.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 @@ -107,6 +108,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" @@ -1310,8 +1326,8 @@ def test_private_catalog_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - private_catalog.SearchCatalogsRequest, - dict, + private_catalog.SearchCatalogsRequest(), + {}, ], ) def test_search_catalogs(request_type, transport: str = "grpc"): @@ -1322,7 +1338,7 @@ def test_search_catalogs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.search_catalogs), "__call__") as call: @@ -1368,11 +1384,12 @@ def test_search_catalogs_non_empty_request_with_auto_populated_field(): client.search_catalogs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == private_catalog.SearchCatalogsRequest( + request_msg = private_catalog.SearchCatalogsRequest( resource="resource_value", query="query_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_search_catalogs_use_cached_wrapped_rpc(): @@ -1453,9 +1470,14 @@ async def test_search_catalogs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_search_catalogs_async( - transport: str = "grpc_asyncio", request_type=private_catalog.SearchCatalogsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + private_catalog.SearchCatalogsRequest(), + {}, + ], +) +async def test_search_catalogs_async(request_type, transport: str = "grpc_asyncio"): client = PrivateCatalogAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1463,7 +1485,7 @@ async def test_search_catalogs_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.search_catalogs), "__call__") as call: @@ -1486,11 +1508,6 @@ async def test_search_catalogs_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_search_catalogs_async_from_dict(): - await test_search_catalogs_async(request_type=dict) - - def test_search_catalogs_field_headers(): client = PrivateCatalogClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1745,8 +1762,8 @@ async def test_search_catalogs_async_pages(): @pytest.mark.parametrize( "request_type", [ - private_catalog.SearchProductsRequest, - dict, + private_catalog.SearchProductsRequest(), + {}, ], ) def test_search_products(request_type, transport: str = "grpc"): @@ -1757,7 +1774,7 @@ def test_search_products(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.search_products), "__call__") as call: @@ -1803,11 +1820,12 @@ def test_search_products_non_empty_request_with_auto_populated_field(): client.search_products(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == private_catalog.SearchProductsRequest( + request_msg = private_catalog.SearchProductsRequest( resource="resource_value", query="query_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_search_products_use_cached_wrapped_rpc(): @@ -1888,9 +1906,14 @@ async def test_search_products_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_search_products_async( - transport: str = "grpc_asyncio", request_type=private_catalog.SearchProductsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + private_catalog.SearchProductsRequest(), + {}, + ], +) +async def test_search_products_async(request_type, transport: str = "grpc_asyncio"): client = PrivateCatalogAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1898,7 +1921,7 @@ async def test_search_products_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.search_products), "__call__") as call: @@ -1921,11 +1944,6 @@ async def test_search_products_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_search_products_async_from_dict(): - await test_search_products_async(request_type=dict) - - def test_search_products_field_headers(): client = PrivateCatalogClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2180,8 +2198,8 @@ async def test_search_products_async_pages(): @pytest.mark.parametrize( "request_type", [ - private_catalog.SearchVersionsRequest, - dict, + private_catalog.SearchVersionsRequest(), + {}, ], ) def test_search_versions(request_type, transport: str = "grpc"): @@ -2192,7 +2210,7 @@ def test_search_versions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.search_versions), "__call__") as call: @@ -2238,11 +2256,12 @@ def test_search_versions_non_empty_request_with_auto_populated_field(): client.search_versions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == private_catalog.SearchVersionsRequest( + request_msg = private_catalog.SearchVersionsRequest( resource="resource_value", query="query_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_search_versions_use_cached_wrapped_rpc(): @@ -2323,9 +2342,14 @@ async def test_search_versions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_search_versions_async( - transport: str = "grpc_asyncio", request_type=private_catalog.SearchVersionsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + private_catalog.SearchVersionsRequest(), + {}, + ], +) +async def test_search_versions_async(request_type, transport: str = "grpc_asyncio"): client = PrivateCatalogAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2333,7 +2357,7 @@ async def test_search_versions_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.search_versions), "__call__") as call: @@ -2356,11 +2380,6 @@ async def test_search_versions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_search_versions_async_from_dict(): - await test_search_versions_async(request_type=dict) - - def test_search_versions_field_headers(): client = PrivateCatalogClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3353,7 +3372,6 @@ def test_search_catalogs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = private_catalog.SearchCatalogsRequest() - assert args[0] == request_msg @@ -3374,7 +3392,6 @@ def test_search_products_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = private_catalog.SearchProductsRequest() - assert args[0] == request_msg @@ -3395,7 +3412,6 @@ def test_search_versions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = private_catalog.SearchVersionsRequest() - assert args[0] == request_msg @@ -3436,7 +3452,6 @@ async def test_search_catalogs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = private_catalog.SearchCatalogsRequest() - assert args[0] == request_msg @@ -3463,7 +3478,6 @@ async def test_search_products_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = private_catalog.SearchProductsRequest() - assert args[0] == request_msg @@ -3490,7 +3504,6 @@ async def test_search_versions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = private_catalog.SearchVersionsRequest() - assert args[0] == request_msg @@ -3932,7 +3945,6 @@ def test_search_catalogs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = private_catalog.SearchCatalogsRequest() - assert args[0] == request_msg @@ -3952,7 +3964,6 @@ def test_search_products_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = private_catalog.SearchProductsRequest() - assert args[0] == request_msg @@ -3972,7 +3983,6 @@ def test_search_versions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = private_catalog.SearchVersionsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-privilegedaccessmanager/noxfile.py b/packages/google-cloud-privilegedaccessmanager/noxfile.py index 189688b6a981..59636262695a 100644 --- a/packages/google-cloud-privilegedaccessmanager/noxfile.py +++ b/packages/google-cloud-privilegedaccessmanager/noxfile.py @@ -47,7 +47,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-privilegedaccessmanager" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-privilegedaccessmanager/setup.py b/packages/google-cloud-privilegedaccessmanager/setup.py index e2a96c3433eb..e2bbe8c24c01 100644 --- a/packages/google-cloud-privilegedaccessmanager/setup.py +++ b/packages/google-cloud-privilegedaccessmanager/setup.py @@ -45,7 +45,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/google-cloud-privilegedaccessmanager/testing/constraints-3.10.txt b/packages/google-cloud-privilegedaccessmanager/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-privilegedaccessmanager/testing/constraints-3.10.txt +++ b/packages/google-cloud-privilegedaccessmanager/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-privilegedaccessmanager/tests/unit/gapic/privilegedaccessmanager_v1/test_privileged_access_manager.py b/packages/google-cloud-privilegedaccessmanager/tests/unit/gapic/privilegedaccessmanager_v1/test_privileged_access_manager.py index 53fde1431327..8f8a5ce964c9 100644 --- a/packages/google-cloud-privilegedaccessmanager/tests/unit/gapic/privilegedaccessmanager_v1/test_privileged_access_manager.py +++ b/packages/google-cloud-privilegedaccessmanager/tests/unit/gapic/privilegedaccessmanager_v1/test_privileged_access_manager.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 @@ -118,6 +119,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" @@ -1387,8 +1403,8 @@ def test_privileged_access_manager_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - privilegedaccessmanager.CheckOnboardingStatusRequest, - dict, + privilegedaccessmanager.CheckOnboardingStatusRequest(), + {}, ], ) def test_check_onboarding_status(request_type, transport: str = "grpc"): @@ -1399,7 +1415,7 @@ def test_check_onboarding_status(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1447,9 +1463,10 @@ def test_check_onboarding_status_non_empty_request_with_auto_populated_field(): client.check_onboarding_status(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == privilegedaccessmanager.CheckOnboardingStatusRequest( + request_msg = privilegedaccessmanager.CheckOnboardingStatusRequest( parent="parent_value", ) + assert args[0] == request_msg def test_check_onboarding_status_use_cached_wrapped_rpc(): @@ -1535,9 +1552,15 @@ async def test_check_onboarding_status_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + privilegedaccessmanager.CheckOnboardingStatusRequest(), + {}, + ], +) async def test_check_onboarding_status_async( - transport: str = "grpc_asyncio", - request_type=privilegedaccessmanager.CheckOnboardingStatusRequest, + request_type, transport: str = "grpc_asyncio" ): client = PrivilegedAccessManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -1546,7 +1569,7 @@ async def test_check_onboarding_status_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( @@ -1571,11 +1594,6 @@ async def test_check_onboarding_status_async( assert response.service_account == "service_account_value" -@pytest.mark.asyncio -async def test_check_onboarding_status_async_from_dict(): - await test_check_onboarding_status_async(request_type=dict) - - def test_check_onboarding_status_field_headers(): client = PrivilegedAccessManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1644,8 +1662,8 @@ async def test_check_onboarding_status_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - privilegedaccessmanager.ListEntitlementsRequest, - dict, + privilegedaccessmanager.ListEntitlementsRequest(), + {}, ], ) def test_list_entitlements(request_type, transport: str = "grpc"): @@ -1656,7 +1674,7 @@ def test_list_entitlements(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1709,12 +1727,13 @@ def test_list_entitlements_non_empty_request_with_auto_populated_field(): client.list_entitlements(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == privilegedaccessmanager.ListEntitlementsRequest( + request_msg = privilegedaccessmanager.ListEntitlementsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_entitlements_use_cached_wrapped_rpc(): @@ -1797,10 +1816,14 @@ async def test_list_entitlements_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_entitlements_async( - transport: str = "grpc_asyncio", - request_type=privilegedaccessmanager.ListEntitlementsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + privilegedaccessmanager.ListEntitlementsRequest(), + {}, + ], +) +async def test_list_entitlements_async(request_type, transport: str = "grpc_asyncio"): client = PrivilegedAccessManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1808,7 +1831,7 @@ async def test_list_entitlements_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( @@ -1835,11 +1858,6 @@ async def test_list_entitlements_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_entitlements_async_from_dict(): - await test_list_entitlements_async(request_type=dict) - - def test_list_entitlements_field_headers(): client = PrivilegedAccessManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2194,8 +2212,8 @@ async def test_list_entitlements_async_pages(): @pytest.mark.parametrize( "request_type", [ - privilegedaccessmanager.SearchEntitlementsRequest, - dict, + privilegedaccessmanager.SearchEntitlementsRequest(), + {}, ], ) def test_search_entitlements(request_type, transport: str = "grpc"): @@ -2206,7 +2224,7 @@ def test_search_entitlements(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2256,11 +2274,12 @@ def test_search_entitlements_non_empty_request_with_auto_populated_field(): client.search_entitlements(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == privilegedaccessmanager.SearchEntitlementsRequest( + request_msg = privilegedaccessmanager.SearchEntitlementsRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_search_entitlements_use_cached_wrapped_rpc(): @@ -2345,10 +2364,14 @@ async def test_search_entitlements_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_search_entitlements_async( - transport: str = "grpc_asyncio", - request_type=privilegedaccessmanager.SearchEntitlementsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + privilegedaccessmanager.SearchEntitlementsRequest(), + {}, + ], +) +async def test_search_entitlements_async(request_type, transport: str = "grpc_asyncio"): client = PrivilegedAccessManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2356,7 +2379,7 @@ async def test_search_entitlements_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( @@ -2381,11 +2404,6 @@ async def test_search_entitlements_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_search_entitlements_async_from_dict(): - await test_search_entitlements_async(request_type=dict) - - def test_search_entitlements_field_headers(): client = PrivilegedAccessManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2654,8 +2672,8 @@ async def test_search_entitlements_async_pages(): @pytest.mark.parametrize( "request_type", [ - privilegedaccessmanager.GetEntitlementRequest, - dict, + privilegedaccessmanager.GetEntitlementRequest(), + {}, ], ) def test_get_entitlement(request_type, transport: str = "grpc"): @@ -2666,7 +2684,7 @@ def test_get_entitlement(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_entitlement), "__call__") as call: @@ -2714,9 +2732,10 @@ def test_get_entitlement_non_empty_request_with_auto_populated_field(): client.get_entitlement(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == privilegedaccessmanager.GetEntitlementRequest( + request_msg = privilegedaccessmanager.GetEntitlementRequest( name="name_value", ) + assert args[0] == request_msg def test_get_entitlement_use_cached_wrapped_rpc(): @@ -2797,10 +2816,14 @@ async def test_get_entitlement_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_entitlement_async( - transport: str = "grpc_asyncio", - request_type=privilegedaccessmanager.GetEntitlementRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + privilegedaccessmanager.GetEntitlementRequest(), + {}, + ], +) +async def test_get_entitlement_async(request_type, transport: str = "grpc_asyncio"): client = PrivilegedAccessManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2808,7 +2831,7 @@ async def test_get_entitlement_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_entitlement), "__call__") as call: @@ -2835,11 +2858,6 @@ async def test_get_entitlement_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_entitlement_async_from_dict(): - await test_get_entitlement_async(request_type=dict) - - def test_get_entitlement_field_headers(): client = PrivilegedAccessManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2986,8 +3004,8 @@ async def test_get_entitlement_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - privilegedaccessmanager.CreateEntitlementRequest, - dict, + privilegedaccessmanager.CreateEntitlementRequest(), + {}, ], ) def test_create_entitlement(request_type, transport: str = "grpc"): @@ -2998,7 +3016,7 @@ def test_create_entitlement(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3045,11 +3063,12 @@ def test_create_entitlement_non_empty_request_with_auto_populated_field(): client.create_entitlement(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == privilegedaccessmanager.CreateEntitlementRequest( + request_msg = privilegedaccessmanager.CreateEntitlementRequest( parent="parent_value", entitlement_id="entitlement_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_entitlement_use_cached_wrapped_rpc(): @@ -3144,10 +3163,14 @@ async def test_create_entitlement_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_entitlement_async( - transport: str = "grpc_asyncio", - request_type=privilegedaccessmanager.CreateEntitlementRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + privilegedaccessmanager.CreateEntitlementRequest(), + {}, + ], +) +async def test_create_entitlement_async(request_type, transport: str = "grpc_asyncio"): client = PrivilegedAccessManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3155,7 +3178,7 @@ async def test_create_entitlement_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( @@ -3177,11 +3200,6 @@ async def test_create_entitlement_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_entitlement_async_from_dict(): - await test_create_entitlement_async(request_type=dict) - - def test_create_entitlement_field_headers(): client = PrivilegedAccessManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3356,8 +3374,8 @@ async def test_create_entitlement_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - privilegedaccessmanager.DeleteEntitlementRequest, - dict, + privilegedaccessmanager.DeleteEntitlementRequest(), + {}, ], ) def test_delete_entitlement(request_type, transport: str = "grpc"): @@ -3368,7 +3386,7 @@ def test_delete_entitlement(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3414,10 +3432,11 @@ def test_delete_entitlement_non_empty_request_with_auto_populated_field(): client.delete_entitlement(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == privilegedaccessmanager.DeleteEntitlementRequest( + request_msg = privilegedaccessmanager.DeleteEntitlementRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_entitlement_use_cached_wrapped_rpc(): @@ -3512,10 +3531,14 @@ async def test_delete_entitlement_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_entitlement_async( - transport: str = "grpc_asyncio", - request_type=privilegedaccessmanager.DeleteEntitlementRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + privilegedaccessmanager.DeleteEntitlementRequest(), + {}, + ], +) +async def test_delete_entitlement_async(request_type, transport: str = "grpc_asyncio"): client = PrivilegedAccessManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3523,7 +3546,7 @@ async def test_delete_entitlement_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( @@ -3545,11 +3568,6 @@ async def test_delete_entitlement_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_entitlement_async_from_dict(): - await test_delete_entitlement_async(request_type=dict) - - def test_delete_entitlement_field_headers(): client = PrivilegedAccessManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3704,8 +3722,8 @@ async def test_delete_entitlement_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - privilegedaccessmanager.UpdateEntitlementRequest, - dict, + privilegedaccessmanager.UpdateEntitlementRequest(), + {}, ], ) def test_update_entitlement(request_type, transport: str = "grpc"): @@ -3716,7 +3734,7 @@ def test_update_entitlement(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3759,7 +3777,8 @@ def test_update_entitlement_non_empty_request_with_auto_populated_field(): client.update_entitlement(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == privilegedaccessmanager.UpdateEntitlementRequest() + request_msg = privilegedaccessmanager.UpdateEntitlementRequest() + assert args[0] == request_msg def test_update_entitlement_use_cached_wrapped_rpc(): @@ -3854,10 +3873,14 @@ async def test_update_entitlement_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_entitlement_async( - transport: str = "grpc_asyncio", - request_type=privilegedaccessmanager.UpdateEntitlementRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + privilegedaccessmanager.UpdateEntitlementRequest(), + {}, + ], +) +async def test_update_entitlement_async(request_type, transport: str = "grpc_asyncio"): client = PrivilegedAccessManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3865,7 +3888,7 @@ async def test_update_entitlement_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( @@ -3887,11 +3910,6 @@ async def test_update_entitlement_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_entitlement_async_from_dict(): - await test_update_entitlement_async(request_type=dict) - - def test_update_entitlement_field_headers(): client = PrivilegedAccessManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4056,8 +4074,8 @@ async def test_update_entitlement_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - privilegedaccessmanager.ListGrantsRequest, - dict, + privilegedaccessmanager.ListGrantsRequest(), + {}, ], ) def test_list_grants(request_type, transport: str = "grpc"): @@ -4068,7 +4086,7 @@ def test_list_grants(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_grants), "__call__") as call: @@ -4117,12 +4135,13 @@ def test_list_grants_non_empty_request_with_auto_populated_field(): client.list_grants(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == privilegedaccessmanager.ListGrantsRequest( + request_msg = privilegedaccessmanager.ListGrantsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_grants_use_cached_wrapped_rpc(): @@ -4203,10 +4222,14 @@ async def test_list_grants_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_grants_async( - transport: str = "grpc_asyncio", - request_type=privilegedaccessmanager.ListGrantsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + privilegedaccessmanager.ListGrantsRequest(), + {}, + ], +) +async def test_list_grants_async(request_type, transport: str = "grpc_asyncio"): client = PrivilegedAccessManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4214,7 +4237,7 @@ async def test_list_grants_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_grants), "__call__") as call: @@ -4239,11 +4262,6 @@ async def test_list_grants_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_grants_async_from_dict(): - await test_list_grants_async(request_type=dict) - - def test_list_grants_field_headers(): client = PrivilegedAccessManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4580,8 +4598,8 @@ async def test_list_grants_async_pages(): @pytest.mark.parametrize( "request_type", [ - privilegedaccessmanager.SearchGrantsRequest, - dict, + privilegedaccessmanager.SearchGrantsRequest(), + {}, ], ) def test_search_grants(request_type, transport: str = "grpc"): @@ -4592,7 +4610,7 @@ def test_search_grants(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.search_grants), "__call__") as call: @@ -4638,11 +4656,12 @@ def test_search_grants_non_empty_request_with_auto_populated_field(): client.search_grants(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == privilegedaccessmanager.SearchGrantsRequest( + request_msg = privilegedaccessmanager.SearchGrantsRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_search_grants_use_cached_wrapped_rpc(): @@ -4723,10 +4742,14 @@ async def test_search_grants_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_search_grants_async( - transport: str = "grpc_asyncio", - request_type=privilegedaccessmanager.SearchGrantsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + privilegedaccessmanager.SearchGrantsRequest(), + {}, + ], +) +async def test_search_grants_async(request_type, transport: str = "grpc_asyncio"): client = PrivilegedAccessManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4734,7 +4757,7 @@ async def test_search_grants_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.search_grants), "__call__") as call: @@ -4757,11 +4780,6 @@ async def test_search_grants_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_search_grants_async_from_dict(): - await test_search_grants_async(request_type=dict) - - def test_search_grants_field_headers(): client = PrivilegedAccessManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5016,8 +5034,8 @@ async def test_search_grants_async_pages(): @pytest.mark.parametrize( "request_type", [ - privilegedaccessmanager.GetGrantRequest, - dict, + privilegedaccessmanager.GetGrantRequest(), + {}, ], ) def test_get_grant(request_type, transport: str = "grpc"): @@ -5028,7 +5046,7 @@ def test_get_grant(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_grant), "__call__") as call: @@ -5080,9 +5098,10 @@ def test_get_grant_non_empty_request_with_auto_populated_field(): client.get_grant(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == privilegedaccessmanager.GetGrantRequest( + request_msg = privilegedaccessmanager.GetGrantRequest( name="name_value", ) + assert args[0] == request_msg def test_get_grant_use_cached_wrapped_rpc(): @@ -5161,10 +5180,14 @@ async def test_get_grant_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_grant_async( - transport: str = "grpc_asyncio", - request_type=privilegedaccessmanager.GetGrantRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + privilegedaccessmanager.GetGrantRequest(), + {}, + ], +) +async def test_get_grant_async(request_type, transport: str = "grpc_asyncio"): client = PrivilegedAccessManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5172,7 +5195,7 @@ async def test_get_grant_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_grant), "__call__") as call: @@ -5203,11 +5226,6 @@ async def test_get_grant_async( assert response.externally_modified is True -@pytest.mark.asyncio -async def test_get_grant_async_from_dict(): - await test_get_grant_async(request_type=dict) - - def test_get_grant_field_headers(): client = PrivilegedAccessManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5354,8 +5372,8 @@ async def test_get_grant_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - privilegedaccessmanager.CreateGrantRequest, - dict, + privilegedaccessmanager.CreateGrantRequest(), + {}, ], ) def test_create_grant(request_type, transport: str = "grpc"): @@ -5366,7 +5384,7 @@ def test_create_grant(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_grant), "__call__") as call: @@ -5419,10 +5437,11 @@ def test_create_grant_non_empty_request_with_auto_populated_field(): client.create_grant(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == privilegedaccessmanager.CreateGrantRequest( + request_msg = privilegedaccessmanager.CreateGrantRequest( parent="parent_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_grant_use_cached_wrapped_rpc(): @@ -5503,10 +5522,14 @@ async def test_create_grant_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_grant_async( - transport: str = "grpc_asyncio", - request_type=privilegedaccessmanager.CreateGrantRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + privilegedaccessmanager.CreateGrantRequest(), + {}, + ], +) +async def test_create_grant_async(request_type, transport: str = "grpc_asyncio"): client = PrivilegedAccessManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5514,7 +5537,7 @@ async def test_create_grant_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_grant), "__call__") as call: @@ -5545,11 +5568,6 @@ async def test_create_grant_async( assert response.externally_modified is True -@pytest.mark.asyncio -async def test_create_grant_async_from_dict(): - await test_create_grant_async(request_type=dict) - - def test_create_grant_field_headers(): client = PrivilegedAccessManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5706,8 +5724,8 @@ async def test_create_grant_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - privilegedaccessmanager.ApproveGrantRequest, - dict, + privilegedaccessmanager.ApproveGrantRequest(), + {}, ], ) def test_approve_grant(request_type, transport: str = "grpc"): @@ -5718,7 +5736,7 @@ def test_approve_grant(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.approve_grant), "__call__") as call: @@ -5771,10 +5789,11 @@ def test_approve_grant_non_empty_request_with_auto_populated_field(): client.approve_grant(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == privilegedaccessmanager.ApproveGrantRequest( + request_msg = privilegedaccessmanager.ApproveGrantRequest( name="name_value", reason="reason_value", ) + assert args[0] == request_msg def test_approve_grant_use_cached_wrapped_rpc(): @@ -5855,10 +5874,14 @@ async def test_approve_grant_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_approve_grant_async( - transport: str = "grpc_asyncio", - request_type=privilegedaccessmanager.ApproveGrantRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + privilegedaccessmanager.ApproveGrantRequest(), + {}, + ], +) +async def test_approve_grant_async(request_type, transport: str = "grpc_asyncio"): client = PrivilegedAccessManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5866,7 +5889,7 @@ async def test_approve_grant_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.approve_grant), "__call__") as call: @@ -5897,11 +5920,6 @@ async def test_approve_grant_async( assert response.externally_modified is True -@pytest.mark.asyncio -async def test_approve_grant_async_from_dict(): - await test_approve_grant_async(request_type=dict) - - def test_approve_grant_field_headers(): client = PrivilegedAccessManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5966,8 +5984,8 @@ async def test_approve_grant_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - privilegedaccessmanager.DenyGrantRequest, - dict, + privilegedaccessmanager.DenyGrantRequest(), + {}, ], ) def test_deny_grant(request_type, transport: str = "grpc"): @@ -5978,7 +5996,7 @@ def test_deny_grant(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.deny_grant), "__call__") as call: @@ -6031,10 +6049,11 @@ def test_deny_grant_non_empty_request_with_auto_populated_field(): client.deny_grant(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == privilegedaccessmanager.DenyGrantRequest( + request_msg = privilegedaccessmanager.DenyGrantRequest( name="name_value", reason="reason_value", ) + assert args[0] == request_msg def test_deny_grant_use_cached_wrapped_rpc(): @@ -6113,10 +6132,14 @@ async def test_deny_grant_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_deny_grant_async( - transport: str = "grpc_asyncio", - request_type=privilegedaccessmanager.DenyGrantRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + privilegedaccessmanager.DenyGrantRequest(), + {}, + ], +) +async def test_deny_grant_async(request_type, transport: str = "grpc_asyncio"): client = PrivilegedAccessManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6124,7 +6147,7 @@ async def test_deny_grant_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.deny_grant), "__call__") as call: @@ -6155,11 +6178,6 @@ async def test_deny_grant_async( assert response.externally_modified is True -@pytest.mark.asyncio -async def test_deny_grant_async_from_dict(): - await test_deny_grant_async(request_type=dict) - - def test_deny_grant_field_headers(): client = PrivilegedAccessManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6224,8 +6242,8 @@ async def test_deny_grant_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - privilegedaccessmanager.RevokeGrantRequest, - dict, + privilegedaccessmanager.RevokeGrantRequest(), + {}, ], ) def test_revoke_grant(request_type, transport: str = "grpc"): @@ -6236,7 +6254,7 @@ def test_revoke_grant(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.revoke_grant), "__call__") as call: @@ -6278,10 +6296,11 @@ def test_revoke_grant_non_empty_request_with_auto_populated_field(): client.revoke_grant(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == privilegedaccessmanager.RevokeGrantRequest( + request_msg = privilegedaccessmanager.RevokeGrantRequest( name="name_value", reason="reason_value", ) + assert args[0] == request_msg def test_revoke_grant_use_cached_wrapped_rpc(): @@ -6372,10 +6391,14 @@ async def test_revoke_grant_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_revoke_grant_async( - transport: str = "grpc_asyncio", - request_type=privilegedaccessmanager.RevokeGrantRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + privilegedaccessmanager.RevokeGrantRequest(), + {}, + ], +) +async def test_revoke_grant_async(request_type, transport: str = "grpc_asyncio"): client = PrivilegedAccessManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6383,7 +6406,7 @@ async def test_revoke_grant_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.revoke_grant), "__call__") as call: @@ -6403,11 +6426,6 @@ async def test_revoke_grant_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_revoke_grant_async_from_dict(): - await test_revoke_grant_async(request_type=dict) - - def test_revoke_grant_field_headers(): client = PrivilegedAccessManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9201,7 +9219,6 @@ def test_check_onboarding_status_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = privilegedaccessmanager.CheckOnboardingStatusRequest() - assert args[0] == request_msg @@ -9224,7 +9241,6 @@ def test_list_entitlements_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = privilegedaccessmanager.ListEntitlementsRequest() - assert args[0] == request_msg @@ -9247,7 +9263,6 @@ def test_search_entitlements_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = privilegedaccessmanager.SearchEntitlementsRequest() - assert args[0] == request_msg @@ -9268,7 +9283,6 @@ def test_get_entitlement_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = privilegedaccessmanager.GetEntitlementRequest() - assert args[0] == request_msg @@ -9291,7 +9305,6 @@ def test_create_entitlement_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = privilegedaccessmanager.CreateEntitlementRequest() - assert args[0] == request_msg @@ -9314,7 +9327,6 @@ def test_delete_entitlement_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = privilegedaccessmanager.DeleteEntitlementRequest() - assert args[0] == request_msg @@ -9337,7 +9349,6 @@ def test_update_entitlement_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = privilegedaccessmanager.UpdateEntitlementRequest() - assert args[0] == request_msg @@ -9358,7 +9369,6 @@ def test_list_grants_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = privilegedaccessmanager.ListGrantsRequest() - assert args[0] == request_msg @@ -9379,7 +9389,6 @@ def test_search_grants_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = privilegedaccessmanager.SearchGrantsRequest() - assert args[0] == request_msg @@ -9400,7 +9409,6 @@ def test_get_grant_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = privilegedaccessmanager.GetGrantRequest() - assert args[0] == request_msg @@ -9421,7 +9429,6 @@ def test_create_grant_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = privilegedaccessmanager.CreateGrantRequest() - assert args[0] == request_msg @@ -9442,7 +9449,6 @@ def test_approve_grant_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = privilegedaccessmanager.ApproveGrantRequest() - assert args[0] == request_msg @@ -9463,7 +9469,6 @@ def test_deny_grant_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = privilegedaccessmanager.DenyGrantRequest() - assert args[0] == request_msg @@ -9484,7 +9489,6 @@ def test_revoke_grant_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = privilegedaccessmanager.RevokeGrantRequest() - assert args[0] == request_msg @@ -9527,7 +9531,6 @@ async def test_check_onboarding_status_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = privilegedaccessmanager.CheckOnboardingStatusRequest() - assert args[0] == request_msg @@ -9557,7 +9560,6 @@ async def test_list_entitlements_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = privilegedaccessmanager.ListEntitlementsRequest() - assert args[0] == request_msg @@ -9586,7 +9588,6 @@ async def test_search_entitlements_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = privilegedaccessmanager.SearchEntitlementsRequest() - assert args[0] == request_msg @@ -9615,7 +9616,6 @@ async def test_get_entitlement_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = privilegedaccessmanager.GetEntitlementRequest() - assert args[0] == request_msg @@ -9642,7 +9642,6 @@ async def test_create_entitlement_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = privilegedaccessmanager.CreateEntitlementRequest() - assert args[0] == request_msg @@ -9669,7 +9668,6 @@ async def test_delete_entitlement_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = privilegedaccessmanager.DeleteEntitlementRequest() - assert args[0] == request_msg @@ -9696,7 +9694,6 @@ async def test_update_entitlement_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = privilegedaccessmanager.UpdateEntitlementRequest() - assert args[0] == request_msg @@ -9724,7 +9721,6 @@ async def test_list_grants_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = privilegedaccessmanager.ListGrantsRequest() - assert args[0] == request_msg @@ -9751,7 +9747,6 @@ async def test_search_grants_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = privilegedaccessmanager.SearchGrantsRequest() - assert args[0] == request_msg @@ -9782,7 +9777,6 @@ async def test_get_grant_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = privilegedaccessmanager.GetGrantRequest() - assert args[0] == request_msg @@ -9813,7 +9807,6 @@ async def test_create_grant_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = privilegedaccessmanager.CreateGrantRequest() - assert args[0] == request_msg @@ -9844,7 +9837,6 @@ async def test_approve_grant_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = privilegedaccessmanager.ApproveGrantRequest() - assert args[0] == request_msg @@ -9875,7 +9867,6 @@ async def test_deny_grant_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = privilegedaccessmanager.DenyGrantRequest() - assert args[0] == request_msg @@ -9900,7 +9891,6 @@ async def test_revoke_grant_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = privilegedaccessmanager.RevokeGrantRequest() - assert args[0] == request_msg @@ -12527,7 +12517,6 @@ def test_check_onboarding_status_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = privilegedaccessmanager.CheckOnboardingStatusRequest() - assert args[0] == request_msg @@ -12549,7 +12538,6 @@ def test_list_entitlements_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = privilegedaccessmanager.ListEntitlementsRequest() - assert args[0] == request_msg @@ -12571,7 +12559,6 @@ def test_search_entitlements_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = privilegedaccessmanager.SearchEntitlementsRequest() - assert args[0] == request_msg @@ -12591,7 +12578,6 @@ def test_get_entitlement_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = privilegedaccessmanager.GetEntitlementRequest() - assert args[0] == request_msg @@ -12613,7 +12599,6 @@ def test_create_entitlement_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = privilegedaccessmanager.CreateEntitlementRequest() - assert args[0] == request_msg @@ -12635,7 +12620,6 @@ def test_delete_entitlement_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = privilegedaccessmanager.DeleteEntitlementRequest() - assert args[0] == request_msg @@ -12657,7 +12641,6 @@ def test_update_entitlement_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = privilegedaccessmanager.UpdateEntitlementRequest() - assert args[0] == request_msg @@ -12677,7 +12660,6 @@ def test_list_grants_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = privilegedaccessmanager.ListGrantsRequest() - assert args[0] == request_msg @@ -12697,7 +12679,6 @@ def test_search_grants_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = privilegedaccessmanager.SearchGrantsRequest() - assert args[0] == request_msg @@ -12717,7 +12698,6 @@ def test_get_grant_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = privilegedaccessmanager.GetGrantRequest() - assert args[0] == request_msg @@ -12737,7 +12717,6 @@ def test_create_grant_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = privilegedaccessmanager.CreateGrantRequest() - assert args[0] == request_msg @@ -12757,7 +12736,6 @@ def test_approve_grant_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = privilegedaccessmanager.ApproveGrantRequest() - assert args[0] == request_msg @@ -12777,7 +12755,6 @@ def test_deny_grant_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = privilegedaccessmanager.DenyGrantRequest() - assert args[0] == request_msg @@ -12797,7 +12774,6 @@ def test_revoke_grant_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = privilegedaccessmanager.RevokeGrantRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-pubsub/noxfile.py b/packages/google-cloud-pubsub/noxfile.py index 48697148adf5..fb01bc8d1105 100644 --- a/packages/google-cloud-pubsub/noxfile.py +++ b/packages/google-cloud-pubsub/noxfile.py @@ -47,7 +47,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-pubsub" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -516,14 +521,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-pubsub/tests/unit/gapic/pubsub_v1/test_publisher.py b/packages/google-cloud-pubsub/tests/unit/gapic/pubsub_v1/test_publisher.py index 6cdb9c081b3f..35e2de8bb251 100644 --- a/packages/google-cloud-pubsub/tests/unit/gapic/pubsub_v1/test_publisher.py +++ b/packages/google-cloud-pubsub/tests/unit/gapic/pubsub_v1/test_publisher.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 @@ -116,6 +117,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" @@ -1278,8 +1294,8 @@ def test_publisher_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - pubsub.Topic, - dict, + pubsub.Topic(), + {}, ], ) def test_create_topic(request_type, transport: str = "grpc"): @@ -1290,7 +1306,7 @@ def test_create_topic(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_topic), "__call__") as call: @@ -1341,10 +1357,11 @@ def test_create_topic_non_empty_request_with_auto_populated_field(): client.create_topic(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == pubsub.Topic( + request_msg = pubsub.Topic( name="name_value", kms_key_name="kms_key_name_value", ) + assert args[0] == request_msg def test_create_topic_use_cached_wrapped_rpc(): @@ -1425,9 +1442,14 @@ async def test_create_topic_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_topic_async( - transport: str = "grpc_asyncio", request_type=pubsub.Topic -): +@pytest.mark.parametrize( + "request_type", + [ + pubsub.Topic(), + {}, + ], +) +async def test_create_topic_async(request_type, transport: str = "grpc_asyncio"): client = PublisherAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1435,7 +1457,7 @@ async def test_create_topic_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_topic), "__call__") as call: @@ -1464,11 +1486,6 @@ async def test_create_topic_async( assert response.state == pubsub.Topic.State.ACTIVE -@pytest.mark.asyncio -async def test_create_topic_async_from_dict(): - await test_create_topic_async(request_type=dict) - - def test_create_topic_field_headers(): client = PublisherClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1611,8 +1628,8 @@ async def test_create_topic_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - pubsub.UpdateTopicRequest, - dict, + pubsub.UpdateTopicRequest(), + {}, ], ) def test_update_topic(request_type, transport: str = "grpc"): @@ -1623,7 +1640,7 @@ def test_update_topic(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_topic), "__call__") as call: @@ -1671,7 +1688,8 @@ def test_update_topic_non_empty_request_with_auto_populated_field(): client.update_topic(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == pubsub.UpdateTopicRequest() + request_msg = pubsub.UpdateTopicRequest() + assert args[0] == request_msg def test_update_topic_use_cached_wrapped_rpc(): @@ -1752,9 +1770,14 @@ async def test_update_topic_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_topic_async( - transport: str = "grpc_asyncio", request_type=pubsub.UpdateTopicRequest -): +@pytest.mark.parametrize( + "request_type", + [ + pubsub.UpdateTopicRequest(), + {}, + ], +) +async def test_update_topic_async(request_type, transport: str = "grpc_asyncio"): client = PublisherAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1762,7 +1785,7 @@ async def test_update_topic_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_topic), "__call__") as call: @@ -1791,11 +1814,6 @@ async def test_update_topic_async( assert response.state == pubsub.Topic.State.ACTIVE -@pytest.mark.asyncio -async def test_update_topic_async_from_dict(): - await test_update_topic_async(request_type=dict) - - def test_update_topic_field_headers(): client = PublisherClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1948,8 +1966,8 @@ async def test_update_topic_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - pubsub.PublishRequest, - dict, + pubsub.PublishRequest(), + {}, ], ) def test_publish(request_type, transport: str = "grpc"): @@ -1960,7 +1978,7 @@ def test_publish(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.publish), "__call__") as call: @@ -2004,9 +2022,10 @@ def test_publish_non_empty_request_with_auto_populated_field(): client.publish(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == pubsub.PublishRequest( + request_msg = pubsub.PublishRequest( topic="topic_value", ) + assert args[0] == request_msg def test_publish_use_cached_wrapped_rpc(): @@ -2085,9 +2104,14 @@ async def test_publish_async_use_cached_wrapped_rpc(transport: str = "grpc_async @pytest.mark.asyncio -async def test_publish_async( - transport: str = "grpc_asyncio", request_type=pubsub.PublishRequest -): +@pytest.mark.parametrize( + "request_type", + [ + pubsub.PublishRequest(), + {}, + ], +) +async def test_publish_async(request_type, transport: str = "grpc_asyncio"): client = PublisherAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2095,7 +2119,7 @@ async def test_publish_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.publish), "__call__") as call: @@ -2118,11 +2142,6 @@ async def test_publish_async( assert response.message_ids == ["message_ids_value"] -@pytest.mark.asyncio -async def test_publish_async_from_dict(): - await test_publish_async(request_type=dict) - - def test_publish_field_headers(): client = PublisherClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2279,8 +2298,8 @@ async def test_publish_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - pubsub.GetTopicRequest, - dict, + pubsub.GetTopicRequest(), + {}, ], ) def test_get_topic(request_type, transport: str = "grpc"): @@ -2291,7 +2310,7 @@ def test_get_topic(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_topic), "__call__") as call: @@ -2341,9 +2360,10 @@ def test_get_topic_non_empty_request_with_auto_populated_field(): client.get_topic(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == pubsub.GetTopicRequest( + request_msg = pubsub.GetTopicRequest( topic="topic_value", ) + assert args[0] == request_msg def test_get_topic_use_cached_wrapped_rpc(): @@ -2422,9 +2442,14 @@ async def test_get_topic_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_topic_async( - transport: str = "grpc_asyncio", request_type=pubsub.GetTopicRequest -): +@pytest.mark.parametrize( + "request_type", + [ + pubsub.GetTopicRequest(), + {}, + ], +) +async def test_get_topic_async(request_type, transport: str = "grpc_asyncio"): client = PublisherAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2432,7 +2457,7 @@ async def test_get_topic_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_topic), "__call__") as call: @@ -2461,11 +2486,6 @@ async def test_get_topic_async( assert response.state == pubsub.Topic.State.ACTIVE -@pytest.mark.asyncio -async def test_get_topic_async_from_dict(): - await test_get_topic_async(request_type=dict) - - def test_get_topic_field_headers(): client = PublisherClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2608,8 +2628,8 @@ async def test_get_topic_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - pubsub.ListTopicsRequest, - dict, + pubsub.ListTopicsRequest(), + {}, ], ) def test_list_topics(request_type, transport: str = "grpc"): @@ -2620,7 +2640,7 @@ def test_list_topics(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_topics), "__call__") as call: @@ -2665,10 +2685,11 @@ def test_list_topics_non_empty_request_with_auto_populated_field(): client.list_topics(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == pubsub.ListTopicsRequest( + request_msg = pubsub.ListTopicsRequest( project="project_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_topics_use_cached_wrapped_rpc(): @@ -2749,9 +2770,14 @@ async def test_list_topics_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_topics_async( - transport: str = "grpc_asyncio", request_type=pubsub.ListTopicsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + pubsub.ListTopicsRequest(), + {}, + ], +) +async def test_list_topics_async(request_type, transport: str = "grpc_asyncio"): client = PublisherAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2759,7 +2785,7 @@ async def test_list_topics_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_topics), "__call__") as call: @@ -2782,11 +2808,6 @@ async def test_list_topics_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_topics_async_from_dict(): - await test_list_topics_async(request_type=dict) - - def test_list_topics_field_headers(): client = PublisherClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3123,8 +3144,8 @@ async def test_list_topics_async_pages(): @pytest.mark.parametrize( "request_type", [ - pubsub.ListTopicSubscriptionsRequest, - dict, + pubsub.ListTopicSubscriptionsRequest(), + {}, ], ) def test_list_topic_subscriptions(request_type, transport: str = "grpc"): @@ -3135,7 +3156,7 @@ def test_list_topic_subscriptions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3186,10 +3207,11 @@ def test_list_topic_subscriptions_non_empty_request_with_auto_populated_field(): client.list_topic_subscriptions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == pubsub.ListTopicSubscriptionsRequest( + request_msg = pubsub.ListTopicSubscriptionsRequest( topic="topic_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_topic_subscriptions_use_cached_wrapped_rpc(): @@ -3275,8 +3297,15 @@ async def test_list_topic_subscriptions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + pubsub.ListTopicSubscriptionsRequest(), + {}, + ], +) async def test_list_topic_subscriptions_async( - transport: str = "grpc_asyncio", request_type=pubsub.ListTopicSubscriptionsRequest + request_type, transport: str = "grpc_asyncio" ): client = PublisherAsyncClient( credentials=async_anonymous_credentials(), @@ -3285,7 +3314,7 @@ async def test_list_topic_subscriptions_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( @@ -3312,11 +3341,6 @@ async def test_list_topic_subscriptions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_topic_subscriptions_async_from_dict(): - await test_list_topic_subscriptions_async(request_type=dict) - - def test_list_topic_subscriptions_field_headers(): client = PublisherClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3671,8 +3695,8 @@ async def test_list_topic_subscriptions_async_pages(): @pytest.mark.parametrize( "request_type", [ - pubsub.ListTopicSnapshotsRequest, - dict, + pubsub.ListTopicSnapshotsRequest(), + {}, ], ) def test_list_topic_snapshots(request_type, transport: str = "grpc"): @@ -3683,7 +3707,7 @@ def test_list_topic_snapshots(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3734,10 +3758,11 @@ def test_list_topic_snapshots_non_empty_request_with_auto_populated_field(): client.list_topic_snapshots(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == pubsub.ListTopicSnapshotsRequest( + request_msg = pubsub.ListTopicSnapshotsRequest( topic="topic_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_topic_snapshots_use_cached_wrapped_rpc(): @@ -3822,8 +3847,15 @@ async def test_list_topic_snapshots_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + pubsub.ListTopicSnapshotsRequest(), + {}, + ], +) async def test_list_topic_snapshots_async( - transport: str = "grpc_asyncio", request_type=pubsub.ListTopicSnapshotsRequest + request_type, transport: str = "grpc_asyncio" ): client = PublisherAsyncClient( credentials=async_anonymous_credentials(), @@ -3832,7 +3864,7 @@ async def test_list_topic_snapshots_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( @@ -3859,11 +3891,6 @@ async def test_list_topic_snapshots_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_topic_snapshots_async_from_dict(): - await test_list_topic_snapshots_async(request_type=dict) - - def test_list_topic_snapshots_field_headers(): client = PublisherClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4216,8 +4243,8 @@ async def test_list_topic_snapshots_async_pages(): @pytest.mark.parametrize( "request_type", [ - pubsub.DeleteTopicRequest, - dict, + pubsub.DeleteTopicRequest(), + {}, ], ) def test_delete_topic(request_type, transport: str = "grpc"): @@ -4228,7 +4255,7 @@ def test_delete_topic(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_topic), "__call__") as call: @@ -4269,9 +4296,10 @@ def test_delete_topic_non_empty_request_with_auto_populated_field(): client.delete_topic(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == pubsub.DeleteTopicRequest( + request_msg = pubsub.DeleteTopicRequest( topic="topic_value", ) + assert args[0] == request_msg def test_delete_topic_use_cached_wrapped_rpc(): @@ -4352,9 +4380,14 @@ async def test_delete_topic_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_topic_async( - transport: str = "grpc_asyncio", request_type=pubsub.DeleteTopicRequest -): +@pytest.mark.parametrize( + "request_type", + [ + pubsub.DeleteTopicRequest(), + {}, + ], +) +async def test_delete_topic_async(request_type, transport: str = "grpc_asyncio"): client = PublisherAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4362,7 +4395,7 @@ async def test_delete_topic_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_topic), "__call__") as call: @@ -4380,11 +4413,6 @@ async def test_delete_topic_async( assert response is None -@pytest.mark.asyncio -async def test_delete_topic_async_from_dict(): - await test_delete_topic_async(request_type=dict) - - def test_delete_topic_field_headers(): client = PublisherClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4527,8 +4555,8 @@ async def test_delete_topic_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - pubsub.DetachSubscriptionRequest, - dict, + pubsub.DetachSubscriptionRequest(), + {}, ], ) def test_detach_subscription(request_type, transport: str = "grpc"): @@ -4539,7 +4567,7 @@ def test_detach_subscription(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4584,9 +4612,10 @@ def test_detach_subscription_non_empty_request_with_auto_populated_field(): client.detach_subscription(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == pubsub.DetachSubscriptionRequest( + request_msg = pubsub.DetachSubscriptionRequest( subscription="subscription_value", ) + assert args[0] == request_msg def test_detach_subscription_use_cached_wrapped_rpc(): @@ -4671,9 +4700,14 @@ async def test_detach_subscription_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_detach_subscription_async( - transport: str = "grpc_asyncio", request_type=pubsub.DetachSubscriptionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + pubsub.DetachSubscriptionRequest(), + {}, + ], +) +async def test_detach_subscription_async(request_type, transport: str = "grpc_asyncio"): client = PublisherAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4681,7 +4715,7 @@ async def test_detach_subscription_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( @@ -4703,11 +4737,6 @@ async def test_detach_subscription_async( assert isinstance(response, pubsub.DetachSubscriptionResponse) -@pytest.mark.asyncio -async def test_detach_subscription_async_from_dict(): - await test_detach_subscription_async(request_type=dict) - - def test_detach_subscription_field_headers(): client = PublisherClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6671,7 +6700,6 @@ def test_create_topic_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pubsub.Topic() - assert args[0] == request_msg @@ -6692,7 +6720,6 @@ def test_update_topic_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pubsub.UpdateTopicRequest() - assert args[0] == request_msg @@ -6713,7 +6740,6 @@ def test_publish_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pubsub.PublishRequest() - assert args[0] == request_msg @@ -6734,7 +6760,6 @@ def test_get_topic_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pubsub.GetTopicRequest() - assert args[0] == request_msg @@ -6755,7 +6780,6 @@ def test_list_topics_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pubsub.ListTopicsRequest() - assert args[0] == request_msg @@ -6778,7 +6802,6 @@ def test_list_topic_subscriptions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pubsub.ListTopicSubscriptionsRequest() - assert args[0] == request_msg @@ -6801,7 +6824,6 @@ def test_list_topic_snapshots_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pubsub.ListTopicSnapshotsRequest() - assert args[0] == request_msg @@ -6822,7 +6844,6 @@ def test_delete_topic_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pubsub.DeleteTopicRequest() - assert args[0] == request_msg @@ -6845,7 +6866,6 @@ def test_detach_subscription_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pubsub.DetachSubscriptionRequest() - assert args[0] == request_msg @@ -6889,7 +6909,6 @@ async def test_create_topic_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pubsub.Topic() - assert args[0] == request_msg @@ -6919,7 +6938,6 @@ async def test_update_topic_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pubsub.UpdateTopicRequest() - assert args[0] == request_msg @@ -6946,7 +6964,6 @@ async def test_publish_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pubsub.PublishRequest() - assert args[0] == request_msg @@ -6976,7 +6993,6 @@ async def test_get_topic_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pubsub.GetTopicRequest() - assert args[0] == request_msg @@ -7003,7 +7019,6 @@ async def test_list_topics_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pubsub.ListTopicsRequest() - assert args[0] == request_msg @@ -7033,7 +7048,6 @@ async def test_list_topic_subscriptions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pubsub.ListTopicSubscriptionsRequest() - assert args[0] == request_msg @@ -7063,7 +7077,6 @@ async def test_list_topic_snapshots_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pubsub.ListTopicSnapshotsRequest() - assert args[0] == request_msg @@ -7086,7 +7099,6 @@ async def test_delete_topic_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pubsub.DeleteTopicRequest() - assert args[0] == request_msg @@ -7113,7 +7125,6 @@ async def test_detach_subscription_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pubsub.DetachSubscriptionRequest() - assert args[0] == request_msg @@ -8469,7 +8480,6 @@ def test_create_topic_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pubsub.Topic() - assert args[0] == request_msg @@ -8489,7 +8499,6 @@ def test_update_topic_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pubsub.UpdateTopicRequest() - assert args[0] == request_msg @@ -8509,7 +8518,6 @@ def test_publish_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pubsub.PublishRequest() - assert args[0] == request_msg @@ -8529,7 +8537,6 @@ def test_get_topic_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pubsub.GetTopicRequest() - assert args[0] == request_msg @@ -8549,7 +8556,6 @@ def test_list_topics_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pubsub.ListTopicsRequest() - assert args[0] == request_msg @@ -8571,7 +8577,6 @@ def test_list_topic_subscriptions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pubsub.ListTopicSubscriptionsRequest() - assert args[0] == request_msg @@ -8593,7 +8598,6 @@ def test_list_topic_snapshots_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pubsub.ListTopicSnapshotsRequest() - assert args[0] == request_msg @@ -8613,7 +8617,6 @@ def test_delete_topic_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pubsub.DeleteTopicRequest() - assert args[0] == request_msg @@ -8635,7 +8638,6 @@ def test_detach_subscription_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pubsub.DetachSubscriptionRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-pubsub/tests/unit/gapic/pubsub_v1/test_schema_service.py b/packages/google-cloud-pubsub/tests/unit/gapic/pubsub_v1/test_schema_service.py index 59323f8b1adf..a40ff4c08fe3 100644 --- a/packages/google-cloud-pubsub/tests/unit/gapic/pubsub_v1/test_schema_service.py +++ b/packages/google-cloud-pubsub/tests/unit/gapic/pubsub_v1/test_schema_service.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 @@ -114,6 +115,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" @@ -1318,8 +1334,8 @@ def test_schema_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - gp_schema.CreateSchemaRequest, - dict, + gp_schema.CreateSchemaRequest(), + {}, ], ) def test_create_schema(request_type, transport: str = "grpc"): @@ -1330,7 +1346,7 @@ def test_create_schema(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_schema), "__call__") as call: @@ -1381,10 +1397,11 @@ def test_create_schema_non_empty_request_with_auto_populated_field(): client.create_schema(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gp_schema.CreateSchemaRequest( + request_msg = gp_schema.CreateSchemaRequest( parent="parent_value", schema_id="schema_id_value", ) + assert args[0] == request_msg def test_create_schema_use_cached_wrapped_rpc(): @@ -1465,9 +1482,14 @@ async def test_create_schema_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_schema_async( - transport: str = "grpc_asyncio", request_type=gp_schema.CreateSchemaRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gp_schema.CreateSchemaRequest(), + {}, + ], +) +async def test_create_schema_async(request_type, transport: str = "grpc_asyncio"): client = SchemaServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1475,7 +1497,7 @@ async def test_create_schema_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_schema), "__call__") as call: @@ -1504,11 +1526,6 @@ async def test_create_schema_async( assert response.revision_id == "revision_id_value" -@pytest.mark.asyncio -async def test_create_schema_async_from_dict(): - await test_create_schema_async(request_type=dict) - - def test_create_schema_field_headers(): client = SchemaServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1671,8 +1688,8 @@ async def test_create_schema_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - schema.GetSchemaRequest, - dict, + schema.GetSchemaRequest(), + {}, ], ) def test_get_schema(request_type, transport: str = "grpc"): @@ -1683,7 +1700,7 @@ def test_get_schema(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_schema), "__call__") as call: @@ -1733,9 +1750,10 @@ def test_get_schema_non_empty_request_with_auto_populated_field(): client.get_schema(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == schema.GetSchemaRequest( + request_msg = schema.GetSchemaRequest( name="name_value", ) + assert args[0] == request_msg def test_get_schema_use_cached_wrapped_rpc(): @@ -1814,9 +1832,14 @@ async def test_get_schema_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_schema_async( - transport: str = "grpc_asyncio", request_type=schema.GetSchemaRequest -): +@pytest.mark.parametrize( + "request_type", + [ + schema.GetSchemaRequest(), + {}, + ], +) +async def test_get_schema_async(request_type, transport: str = "grpc_asyncio"): client = SchemaServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1824,7 +1847,7 @@ async def test_get_schema_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_schema), "__call__") as call: @@ -1853,11 +1876,6 @@ async def test_get_schema_async( assert response.revision_id == "revision_id_value" -@pytest.mark.asyncio -async def test_get_schema_async_from_dict(): - await test_get_schema_async(request_type=dict) - - def test_get_schema_field_headers(): client = SchemaServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2000,8 +2018,8 @@ async def test_get_schema_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - schema.ListSchemasRequest, - dict, + schema.ListSchemasRequest(), + {}, ], ) def test_list_schemas(request_type, transport: str = "grpc"): @@ -2012,7 +2030,7 @@ def test_list_schemas(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_schemas), "__call__") as call: @@ -2057,10 +2075,11 @@ def test_list_schemas_non_empty_request_with_auto_populated_field(): client.list_schemas(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == schema.ListSchemasRequest( + request_msg = schema.ListSchemasRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_schemas_use_cached_wrapped_rpc(): @@ -2141,9 +2160,14 @@ async def test_list_schemas_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_schemas_async( - transport: str = "grpc_asyncio", request_type=schema.ListSchemasRequest -): +@pytest.mark.parametrize( + "request_type", + [ + schema.ListSchemasRequest(), + {}, + ], +) +async def test_list_schemas_async(request_type, transport: str = "grpc_asyncio"): client = SchemaServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2151,7 +2175,7 @@ async def test_list_schemas_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_schemas), "__call__") as call: @@ -2174,11 +2198,6 @@ async def test_list_schemas_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_schemas_async_from_dict(): - await test_list_schemas_async(request_type=dict) - - def test_list_schemas_field_headers(): client = SchemaServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2515,8 +2534,8 @@ async def test_list_schemas_async_pages(): @pytest.mark.parametrize( "request_type", [ - schema.ListSchemaRevisionsRequest, - dict, + schema.ListSchemaRevisionsRequest(), + {}, ], ) def test_list_schema_revisions(request_type, transport: str = "grpc"): @@ -2527,7 +2546,7 @@ def test_list_schema_revisions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2576,10 +2595,11 @@ def test_list_schema_revisions_non_empty_request_with_auto_populated_field(): client.list_schema_revisions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == schema.ListSchemaRevisionsRequest( + request_msg = schema.ListSchemaRevisionsRequest( name="name_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_schema_revisions_use_cached_wrapped_rpc(): @@ -2665,8 +2685,15 @@ async def test_list_schema_revisions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + schema.ListSchemaRevisionsRequest(), + {}, + ], +) async def test_list_schema_revisions_async( - transport: str = "grpc_asyncio", request_type=schema.ListSchemaRevisionsRequest + request_type, transport: str = "grpc_asyncio" ): client = SchemaServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2675,7 +2702,7 @@ async def test_list_schema_revisions_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( @@ -2700,11 +2727,6 @@ async def test_list_schema_revisions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_schema_revisions_async_from_dict(): - await test_list_schema_revisions_async(request_type=dict) - - def test_list_schema_revisions_field_headers(): client = SchemaServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3057,8 +3079,8 @@ async def test_list_schema_revisions_async_pages(): @pytest.mark.parametrize( "request_type", [ - gp_schema.CommitSchemaRequest, - dict, + gp_schema.CommitSchemaRequest(), + {}, ], ) def test_commit_schema(request_type, transport: str = "grpc"): @@ -3069,7 +3091,7 @@ def test_commit_schema(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.commit_schema), "__call__") as call: @@ -3119,9 +3141,10 @@ def test_commit_schema_non_empty_request_with_auto_populated_field(): client.commit_schema(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gp_schema.CommitSchemaRequest( + request_msg = gp_schema.CommitSchemaRequest( name="name_value", ) + assert args[0] == request_msg def test_commit_schema_use_cached_wrapped_rpc(): @@ -3202,9 +3225,14 @@ async def test_commit_schema_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_commit_schema_async( - transport: str = "grpc_asyncio", request_type=gp_schema.CommitSchemaRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gp_schema.CommitSchemaRequest(), + {}, + ], +) +async def test_commit_schema_async(request_type, transport: str = "grpc_asyncio"): client = SchemaServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3212,7 +3240,7 @@ async def test_commit_schema_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.commit_schema), "__call__") as call: @@ -3241,11 +3269,6 @@ async def test_commit_schema_async( assert response.revision_id == "revision_id_value" -@pytest.mark.asyncio -async def test_commit_schema_async_from_dict(): - await test_commit_schema_async(request_type=dict) - - def test_commit_schema_field_headers(): client = SchemaServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3398,8 +3421,8 @@ async def test_commit_schema_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - schema.RollbackSchemaRequest, - dict, + schema.RollbackSchemaRequest(), + {}, ], ) def test_rollback_schema(request_type, transport: str = "grpc"): @@ -3410,7 +3433,7 @@ def test_rollback_schema(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.rollback_schema), "__call__") as call: @@ -3461,10 +3484,11 @@ def test_rollback_schema_non_empty_request_with_auto_populated_field(): client.rollback_schema(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == schema.RollbackSchemaRequest( + request_msg = schema.RollbackSchemaRequest( name="name_value", revision_id="revision_id_value", ) + assert args[0] == request_msg def test_rollback_schema_use_cached_wrapped_rpc(): @@ -3545,9 +3569,14 @@ async def test_rollback_schema_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_rollback_schema_async( - transport: str = "grpc_asyncio", request_type=schema.RollbackSchemaRequest -): +@pytest.mark.parametrize( + "request_type", + [ + schema.RollbackSchemaRequest(), + {}, + ], +) +async def test_rollback_schema_async(request_type, transport: str = "grpc_asyncio"): client = SchemaServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3555,7 +3584,7 @@ async def test_rollback_schema_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.rollback_schema), "__call__") as call: @@ -3584,11 +3613,6 @@ async def test_rollback_schema_async( assert response.revision_id == "revision_id_value" -@pytest.mark.asyncio -async def test_rollback_schema_async_from_dict(): - await test_rollback_schema_async(request_type=dict) - - def test_rollback_schema_field_headers(): client = SchemaServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3741,8 +3765,8 @@ async def test_rollback_schema_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - schema.DeleteSchemaRevisionRequest, - dict, + schema.DeleteSchemaRevisionRequest(), + {}, ], ) def test_delete_schema_revision(request_type, transport: str = "grpc"): @@ -3753,7 +3777,7 @@ def test_delete_schema_revision(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3808,10 +3832,11 @@ def test_delete_schema_revision_non_empty_request_with_auto_populated_field(): client.delete_schema_revision(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == schema.DeleteSchemaRevisionRequest( + request_msg = schema.DeleteSchemaRevisionRequest( name="name_value", revision_id="revision_id_value", ) + assert args[0] == request_msg def test_delete_schema_revision_use_cached_wrapped_rpc(): @@ -3897,8 +3922,15 @@ async def test_delete_schema_revision_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + schema.DeleteSchemaRevisionRequest(), + {}, + ], +) async def test_delete_schema_revision_async( - transport: str = "grpc_asyncio", request_type=schema.DeleteSchemaRevisionRequest + request_type, transport: str = "grpc_asyncio" ): client = SchemaServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3907,7 +3939,7 @@ async def test_delete_schema_revision_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( @@ -3938,11 +3970,6 @@ async def test_delete_schema_revision_async( assert response.revision_id == "revision_id_value" -@pytest.mark.asyncio -async def test_delete_schema_revision_async_from_dict(): - await test_delete_schema_revision_async(request_type=dict) - - def test_delete_schema_revision_field_headers(): client = SchemaServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4103,8 +4130,8 @@ async def test_delete_schema_revision_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - schema.DeleteSchemaRequest, - dict, + schema.DeleteSchemaRequest(), + {}, ], ) def test_delete_schema(request_type, transport: str = "grpc"): @@ -4115,7 +4142,7 @@ def test_delete_schema(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_schema), "__call__") as call: @@ -4156,9 +4183,10 @@ def test_delete_schema_non_empty_request_with_auto_populated_field(): client.delete_schema(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == schema.DeleteSchemaRequest( + request_msg = schema.DeleteSchemaRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_schema_use_cached_wrapped_rpc(): @@ -4239,9 +4267,14 @@ async def test_delete_schema_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_schema_async( - transport: str = "grpc_asyncio", request_type=schema.DeleteSchemaRequest -): +@pytest.mark.parametrize( + "request_type", + [ + schema.DeleteSchemaRequest(), + {}, + ], +) +async def test_delete_schema_async(request_type, transport: str = "grpc_asyncio"): client = SchemaServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4249,7 +4282,7 @@ async def test_delete_schema_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_schema), "__call__") as call: @@ -4267,11 +4300,6 @@ async def test_delete_schema_async( assert response is None -@pytest.mark.asyncio -async def test_delete_schema_async_from_dict(): - await test_delete_schema_async(request_type=dict) - - def test_delete_schema_field_headers(): client = SchemaServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4414,8 +4442,8 @@ async def test_delete_schema_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gp_schema.ValidateSchemaRequest, - dict, + gp_schema.ValidateSchemaRequest(), + {}, ], ) def test_validate_schema(request_type, transport: str = "grpc"): @@ -4426,7 +4454,7 @@ def test_validate_schema(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.validate_schema), "__call__") as call: @@ -4467,9 +4495,10 @@ def test_validate_schema_non_empty_request_with_auto_populated_field(): client.validate_schema(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gp_schema.ValidateSchemaRequest( + request_msg = gp_schema.ValidateSchemaRequest( parent="parent_value", ) + assert args[0] == request_msg def test_validate_schema_use_cached_wrapped_rpc(): @@ -4550,9 +4579,14 @@ async def test_validate_schema_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_validate_schema_async( - transport: str = "grpc_asyncio", request_type=gp_schema.ValidateSchemaRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gp_schema.ValidateSchemaRequest(), + {}, + ], +) +async def test_validate_schema_async(request_type, transport: str = "grpc_asyncio"): client = SchemaServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4560,7 +4594,7 @@ async def test_validate_schema_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.validate_schema), "__call__") as call: @@ -4580,11 +4614,6 @@ async def test_validate_schema_async( assert isinstance(response, gp_schema.ValidateSchemaResponse) -@pytest.mark.asyncio -async def test_validate_schema_async_from_dict(): - await test_validate_schema_async(request_type=dict) - - def test_validate_schema_field_headers(): client = SchemaServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4741,8 +4770,8 @@ async def test_validate_schema_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - schema.ValidateMessageRequest, - dict, + schema.ValidateMessageRequest(), + {}, ], ) def test_validate_message(request_type, transport: str = "grpc"): @@ -4753,7 +4782,7 @@ def test_validate_message(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.validate_message), "__call__") as call: @@ -4795,10 +4824,11 @@ def test_validate_message_non_empty_request_with_auto_populated_field(): client.validate_message(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == schema.ValidateMessageRequest( + request_msg = schema.ValidateMessageRequest( parent="parent_value", name="name_value", ) + assert args[0] == request_msg def test_validate_message_use_cached_wrapped_rpc(): @@ -4881,9 +4911,14 @@ async def test_validate_message_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_validate_message_async( - transport: str = "grpc_asyncio", request_type=schema.ValidateMessageRequest -): +@pytest.mark.parametrize( + "request_type", + [ + schema.ValidateMessageRequest(), + {}, + ], +) +async def test_validate_message_async(request_type, transport: str = "grpc_asyncio"): client = SchemaServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4891,7 +4926,7 @@ async def test_validate_message_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.validate_message), "__call__") as call: @@ -4911,11 +4946,6 @@ async def test_validate_message_async( assert isinstance(response, schema.ValidateMessageResponse) -@pytest.mark.asyncio -async def test_validate_message_async_from_dict(): - await test_validate_message_async(request_type=dict) - - def test_validate_message_field_headers(): client = SchemaServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7022,7 +7052,6 @@ def test_create_schema_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gp_schema.CreateSchemaRequest() - assert args[0] == request_msg @@ -7043,7 +7072,6 @@ def test_get_schema_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema.GetSchemaRequest() - assert args[0] == request_msg @@ -7064,7 +7092,6 @@ def test_list_schemas_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema.ListSchemasRequest() - assert args[0] == request_msg @@ -7087,7 +7114,6 @@ def test_list_schema_revisions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema.ListSchemaRevisionsRequest() - assert args[0] == request_msg @@ -7108,7 +7134,6 @@ def test_commit_schema_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gp_schema.CommitSchemaRequest() - assert args[0] == request_msg @@ -7129,7 +7154,6 @@ def test_rollback_schema_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema.RollbackSchemaRequest() - assert args[0] == request_msg @@ -7152,7 +7176,6 @@ def test_delete_schema_revision_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema.DeleteSchemaRevisionRequest() - assert args[0] == request_msg @@ -7173,7 +7196,6 @@ def test_delete_schema_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema.DeleteSchemaRequest() - assert args[0] == request_msg @@ -7194,7 +7216,6 @@ def test_validate_schema_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gp_schema.ValidateSchemaRequest() - assert args[0] == request_msg @@ -7215,7 +7236,6 @@ def test_validate_message_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema.ValidateMessageRequest() - assert args[0] == request_msg @@ -7259,7 +7279,6 @@ async def test_create_schema_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gp_schema.CreateSchemaRequest() - assert args[0] == request_msg @@ -7289,7 +7308,6 @@ async def test_get_schema_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema.GetSchemaRequest() - assert args[0] == request_msg @@ -7316,7 +7334,6 @@ async def test_list_schemas_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema.ListSchemasRequest() - assert args[0] == request_msg @@ -7345,7 +7362,6 @@ async def test_list_schema_revisions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema.ListSchemaRevisionsRequest() - assert args[0] == request_msg @@ -7375,7 +7391,6 @@ async def test_commit_schema_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gp_schema.CommitSchemaRequest() - assert args[0] == request_msg @@ -7405,7 +7420,6 @@ async def test_rollback_schema_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema.RollbackSchemaRequest() - assert args[0] == request_msg @@ -7437,7 +7451,6 @@ async def test_delete_schema_revision_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema.DeleteSchemaRevisionRequest() - assert args[0] == request_msg @@ -7460,7 +7473,6 @@ async def test_delete_schema_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema.DeleteSchemaRequest() - assert args[0] == request_msg @@ -7485,7 +7497,6 @@ async def test_validate_schema_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gp_schema.ValidateSchemaRequest() - assert args[0] == request_msg @@ -7510,7 +7521,6 @@ async def test_validate_message_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema.ValidateMessageRequest() - assert args[0] == request_msg @@ -9092,7 +9102,6 @@ def test_create_schema_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gp_schema.CreateSchemaRequest() - assert args[0] == request_msg @@ -9112,7 +9121,6 @@ def test_get_schema_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema.GetSchemaRequest() - assert args[0] == request_msg @@ -9132,7 +9140,6 @@ def test_list_schemas_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema.ListSchemasRequest() - assert args[0] == request_msg @@ -9154,7 +9161,6 @@ def test_list_schema_revisions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema.ListSchemaRevisionsRequest() - assert args[0] == request_msg @@ -9174,7 +9180,6 @@ def test_commit_schema_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gp_schema.CommitSchemaRequest() - assert args[0] == request_msg @@ -9194,7 +9199,6 @@ def test_rollback_schema_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema.RollbackSchemaRequest() - assert args[0] == request_msg @@ -9216,7 +9220,6 @@ def test_delete_schema_revision_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema.DeleteSchemaRevisionRequest() - assert args[0] == request_msg @@ -9236,7 +9239,6 @@ def test_delete_schema_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema.DeleteSchemaRequest() - assert args[0] == request_msg @@ -9256,7 +9258,6 @@ def test_validate_schema_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gp_schema.ValidateSchemaRequest() - assert args[0] == request_msg @@ -9276,7 +9277,6 @@ def test_validate_message_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = schema.ValidateMessageRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-pubsub/tests/unit/gapic/pubsub_v1/test_subscriber.py b/packages/google-cloud-pubsub/tests/unit/gapic/pubsub_v1/test_subscriber.py index ca250e0b68c4..2404d2db8ce5 100644 --- a/packages/google-cloud-pubsub/tests/unit/gapic/pubsub_v1/test_subscriber.py +++ b/packages/google-cloud-pubsub/tests/unit/gapic/pubsub_v1/test_subscriber.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 @@ -116,6 +117,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" @@ -1282,8 +1298,8 @@ def test_subscriber_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - pubsub.Subscription, - dict, + pubsub.Subscription(), + {}, ], ) def test_create_subscription(request_type, transport: str = "grpc"): @@ -1294,7 +1310,7 @@ def test_create_subscription(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1360,11 +1376,12 @@ def test_create_subscription_non_empty_request_with_auto_populated_field(): client.create_subscription(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == pubsub.Subscription( + request_msg = pubsub.Subscription( name="name_value", topic="topic_value", filter="filter_value", ) + assert args[0] == request_msg def test_create_subscription_use_cached_wrapped_rpc(): @@ -1449,9 +1466,14 @@ async def test_create_subscription_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_subscription_async( - transport: str = "grpc_asyncio", request_type=pubsub.Subscription -): +@pytest.mark.parametrize( + "request_type", + [ + pubsub.Subscription(), + {}, + ], +) +async def test_create_subscription_async(request_type, transport: str = "grpc_asyncio"): client = SubscriberAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1459,7 +1481,7 @@ async def test_create_subscription_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( @@ -1500,11 +1522,6 @@ async def test_create_subscription_async( assert response.state == pubsub.Subscription.State.ACTIVE -@pytest.mark.asyncio -async def test_create_subscription_async_from_dict(): - await test_create_subscription_async(request_type=dict) - - def test_create_subscription_field_headers(): client = SubscriberClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1685,8 +1702,8 @@ async def test_create_subscription_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - pubsub.GetSubscriptionRequest, - dict, + pubsub.GetSubscriptionRequest(), + {}, ], ) def test_get_subscription(request_type, transport: str = "grpc"): @@ -1697,7 +1714,7 @@ def test_get_subscription(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_subscription), "__call__") as call: @@ -1757,9 +1774,10 @@ def test_get_subscription_non_empty_request_with_auto_populated_field(): client.get_subscription(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == pubsub.GetSubscriptionRequest( + request_msg = pubsub.GetSubscriptionRequest( subscription="subscription_value", ) + assert args[0] == request_msg def test_get_subscription_use_cached_wrapped_rpc(): @@ -1842,9 +1860,14 @@ async def test_get_subscription_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_subscription_async( - transport: str = "grpc_asyncio", request_type=pubsub.GetSubscriptionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + pubsub.GetSubscriptionRequest(), + {}, + ], +) +async def test_get_subscription_async(request_type, transport: str = "grpc_asyncio"): client = SubscriberAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1852,7 +1875,7 @@ async def test_get_subscription_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_subscription), "__call__") as call: @@ -1891,11 +1914,6 @@ async def test_get_subscription_async( assert response.state == pubsub.Subscription.State.ACTIVE -@pytest.mark.asyncio -async def test_get_subscription_async_from_dict(): - await test_get_subscription_async(request_type=dict) - - def test_get_subscription_field_headers(): client = SubscriberClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2038,8 +2056,8 @@ async def test_get_subscription_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - pubsub.UpdateSubscriptionRequest, - dict, + pubsub.UpdateSubscriptionRequest(), + {}, ], ) def test_update_subscription(request_type, transport: str = "grpc"): @@ -2050,7 +2068,7 @@ def test_update_subscription(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,7 +2130,8 @@ def test_update_subscription_non_empty_request_with_auto_populated_field(): client.update_subscription(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == pubsub.UpdateSubscriptionRequest() + request_msg = pubsub.UpdateSubscriptionRequest() + assert args[0] == request_msg def test_update_subscription_use_cached_wrapped_rpc(): @@ -2197,9 +2216,14 @@ async def test_update_subscription_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_subscription_async( - transport: str = "grpc_asyncio", request_type=pubsub.UpdateSubscriptionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + pubsub.UpdateSubscriptionRequest(), + {}, + ], +) +async def test_update_subscription_async(request_type, transport: str = "grpc_asyncio"): client = SubscriberAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2207,7 +2231,7 @@ async def test_update_subscription_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( @@ -2248,11 +2272,6 @@ async def test_update_subscription_async( assert response.state == pubsub.Subscription.State.ACTIVE -@pytest.mark.asyncio -async def test_update_subscription_async_from_dict(): - await test_update_subscription_async(request_type=dict) - - def test_update_subscription_field_headers(): client = SubscriberClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2413,8 +2432,8 @@ async def test_update_subscription_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - pubsub.ListSubscriptionsRequest, - dict, + pubsub.ListSubscriptionsRequest(), + {}, ], ) def test_list_subscriptions(request_type, transport: str = "grpc"): @@ -2425,7 +2444,7 @@ def test_list_subscriptions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2474,10 +2493,11 @@ def test_list_subscriptions_non_empty_request_with_auto_populated_field(): client.list_subscriptions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == pubsub.ListSubscriptionsRequest( + request_msg = pubsub.ListSubscriptionsRequest( project="project_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_subscriptions_use_cached_wrapped_rpc(): @@ -2562,9 +2582,14 @@ async def test_list_subscriptions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_subscriptions_async( - transport: str = "grpc_asyncio", request_type=pubsub.ListSubscriptionsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + pubsub.ListSubscriptionsRequest(), + {}, + ], +) +async def test_list_subscriptions_async(request_type, transport: str = "grpc_asyncio"): client = SubscriberAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2572,7 +2597,7 @@ async def test_list_subscriptions_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( @@ -2597,11 +2622,6 @@ async def test_list_subscriptions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_subscriptions_async_from_dict(): - await test_list_subscriptions_async(request_type=dict) - - def test_list_subscriptions_field_headers(): client = SubscriberClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2954,8 +2974,8 @@ async def test_list_subscriptions_async_pages(): @pytest.mark.parametrize( "request_type", [ - pubsub.DeleteSubscriptionRequest, - dict, + pubsub.DeleteSubscriptionRequest(), + {}, ], ) def test_delete_subscription(request_type, transport: str = "grpc"): @@ -2966,7 +2986,7 @@ def test_delete_subscription(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3011,9 +3031,10 @@ def test_delete_subscription_non_empty_request_with_auto_populated_field(): client.delete_subscription(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == pubsub.DeleteSubscriptionRequest( + request_msg = pubsub.DeleteSubscriptionRequest( subscription="subscription_value", ) + assert args[0] == request_msg def test_delete_subscription_use_cached_wrapped_rpc(): @@ -3098,9 +3119,14 @@ async def test_delete_subscription_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_subscription_async( - transport: str = "grpc_asyncio", request_type=pubsub.DeleteSubscriptionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + pubsub.DeleteSubscriptionRequest(), + {}, + ], +) +async def test_delete_subscription_async(request_type, transport: str = "grpc_asyncio"): client = SubscriberAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3108,7 +3134,7 @@ async def test_delete_subscription_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( @@ -3128,11 +3154,6 @@ async def test_delete_subscription_async( assert response is None -@pytest.mark.asyncio -async def test_delete_subscription_async_from_dict(): - await test_delete_subscription_async(request_type=dict) - - def test_delete_subscription_field_headers(): client = SubscriberClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3283,8 +3304,8 @@ async def test_delete_subscription_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - pubsub.ModifyAckDeadlineRequest, - dict, + pubsub.ModifyAckDeadlineRequest(), + {}, ], ) def test_modify_ack_deadline(request_type, transport: str = "grpc"): @@ -3295,7 +3316,7 @@ def test_modify_ack_deadline(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3340,9 +3361,10 @@ def test_modify_ack_deadline_non_empty_request_with_auto_populated_field(): client.modify_ack_deadline(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == pubsub.ModifyAckDeadlineRequest( + request_msg = pubsub.ModifyAckDeadlineRequest( subscription="subscription_value", ) + assert args[0] == request_msg def test_modify_ack_deadline_use_cached_wrapped_rpc(): @@ -3427,9 +3449,14 @@ async def test_modify_ack_deadline_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_modify_ack_deadline_async( - transport: str = "grpc_asyncio", request_type=pubsub.ModifyAckDeadlineRequest -): +@pytest.mark.parametrize( + "request_type", + [ + pubsub.ModifyAckDeadlineRequest(), + {}, + ], +) +async def test_modify_ack_deadline_async(request_type, transport: str = "grpc_asyncio"): client = SubscriberAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3437,7 +3464,7 @@ async def test_modify_ack_deadline_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( @@ -3457,11 +3484,6 @@ async def test_modify_ack_deadline_async( assert response is None -@pytest.mark.asyncio -async def test_modify_ack_deadline_async_from_dict(): - await test_modify_ack_deadline_async(request_type=dict) - - def test_modify_ack_deadline_field_headers(): client = SubscriberClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3632,8 +3654,8 @@ async def test_modify_ack_deadline_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - pubsub.AcknowledgeRequest, - dict, + pubsub.AcknowledgeRequest(), + {}, ], ) def test_acknowledge(request_type, transport: str = "grpc"): @@ -3644,7 +3666,7 @@ def test_acknowledge(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.acknowledge), "__call__") as call: @@ -3685,9 +3707,10 @@ def test_acknowledge_non_empty_request_with_auto_populated_field(): client.acknowledge(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == pubsub.AcknowledgeRequest( + request_msg = pubsub.AcknowledgeRequest( subscription="subscription_value", ) + assert args[0] == request_msg def test_acknowledge_use_cached_wrapped_rpc(): @@ -3768,9 +3791,14 @@ async def test_acknowledge_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_acknowledge_async( - transport: str = "grpc_asyncio", request_type=pubsub.AcknowledgeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + pubsub.AcknowledgeRequest(), + {}, + ], +) +async def test_acknowledge_async(request_type, transport: str = "grpc_asyncio"): client = SubscriberAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3778,7 +3806,7 @@ async def test_acknowledge_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.acknowledge), "__call__") as call: @@ -3796,11 +3824,6 @@ async def test_acknowledge_async( assert response is None -@pytest.mark.asyncio -async def test_acknowledge_async_from_dict(): - await test_acknowledge_async(request_type=dict) - - def test_acknowledge_field_headers(): client = SubscriberClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3953,8 +3976,8 @@ async def test_acknowledge_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - pubsub.PullRequest, - dict, + pubsub.PullRequest(), + {}, ], ) def test_pull(request_type, transport: str = "grpc"): @@ -3965,7 +3988,7 @@ def test_pull(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.pull), "__call__") as call: @@ -4006,9 +4029,10 @@ def test_pull_non_empty_request_with_auto_populated_field(): client.pull(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == pubsub.PullRequest( + request_msg = pubsub.PullRequest( subscription="subscription_value", ) + assert args[0] == request_msg def test_pull_use_cached_wrapped_rpc(): @@ -4086,9 +4110,14 @@ async def test_pull_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio" @pytest.mark.asyncio -async def test_pull_async( - transport: str = "grpc_asyncio", request_type=pubsub.PullRequest -): +@pytest.mark.parametrize( + "request_type", + [ + pubsub.PullRequest(), + {}, + ], +) +async def test_pull_async(request_type, transport: str = "grpc_asyncio"): client = SubscriberAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4096,7 +4125,7 @@ async def test_pull_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.pull), "__call__") as call: @@ -4114,11 +4143,6 @@ async def test_pull_async( assert isinstance(response, pubsub.PullResponse) -@pytest.mark.asyncio -async def test_pull_async_from_dict(): - await test_pull_async(request_type=dict) - - def test_pull_field_headers(): client = SubscriberClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4281,8 +4305,8 @@ async def test_pull_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - pubsub.StreamingPullRequest, - dict, + pubsub.StreamingPullRequest(), + {}, ], ) def test_streaming_pull(request_type, transport: str = "grpc"): @@ -4293,7 +4317,7 @@ def test_streaming_pull(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as 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. @@ -4390,9 +4414,14 @@ async def test_streaming_pull_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_streaming_pull_async( - transport: str = "grpc_asyncio", request_type=pubsub.StreamingPullRequest -): +@pytest.mark.parametrize( + "request_type", + [ + pubsub.StreamingPullRequest(), + {}, + ], +) +async def test_streaming_pull_async(request_type, transport: str = "grpc_asyncio"): client = SubscriberAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4400,7 +4429,7 @@ async def test_streaming_pull_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. @@ -4422,16 +4451,11 @@ async def test_streaming_pull_async( assert isinstance(message, pubsub.StreamingPullResponse) -@pytest.mark.asyncio -async def test_streaming_pull_async_from_dict(): - await test_streaming_pull_async(request_type=dict) - - @pytest.mark.parametrize( "request_type", [ - pubsub.ModifyPushConfigRequest, - dict, + pubsub.ModifyPushConfigRequest(), + {}, ], ) def test_modify_push_config(request_type, transport: str = "grpc"): @@ -4442,7 +4466,7 @@ def test_modify_push_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( @@ -4487,9 +4511,10 @@ def test_modify_push_config_non_empty_request_with_auto_populated_field(): client.modify_push_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == pubsub.ModifyPushConfigRequest( + request_msg = pubsub.ModifyPushConfigRequest( subscription="subscription_value", ) + assert args[0] == request_msg def test_modify_push_config_use_cached_wrapped_rpc(): @@ -4574,9 +4599,14 @@ async def test_modify_push_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_modify_push_config_async( - transport: str = "grpc_asyncio", request_type=pubsub.ModifyPushConfigRequest -): +@pytest.mark.parametrize( + "request_type", + [ + pubsub.ModifyPushConfigRequest(), + {}, + ], +) +async def test_modify_push_config_async(request_type, transport: str = "grpc_asyncio"): client = SubscriberAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4584,7 +4614,7 @@ async def test_modify_push_config_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( @@ -4604,11 +4634,6 @@ async def test_modify_push_config_async( assert response is None -@pytest.mark.asyncio -async def test_modify_push_config_async_from_dict(): - await test_modify_push_config_async(request_type=dict) - - def test_modify_push_config_field_headers(): client = SubscriberClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4769,8 +4794,8 @@ async def test_modify_push_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - pubsub.GetSnapshotRequest, - dict, + pubsub.GetSnapshotRequest(), + {}, ], ) def test_get_snapshot(request_type, transport: str = "grpc"): @@ -4781,7 +4806,7 @@ def test_get_snapshot(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_snapshot), "__call__") as call: @@ -4827,9 +4852,10 @@ def test_get_snapshot_non_empty_request_with_auto_populated_field(): client.get_snapshot(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == pubsub.GetSnapshotRequest( + request_msg = pubsub.GetSnapshotRequest( snapshot="snapshot_value", ) + assert args[0] == request_msg def test_get_snapshot_use_cached_wrapped_rpc(): @@ -4910,9 +4936,14 @@ async def test_get_snapshot_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_snapshot_async( - transport: str = "grpc_asyncio", request_type=pubsub.GetSnapshotRequest -): +@pytest.mark.parametrize( + "request_type", + [ + pubsub.GetSnapshotRequest(), + {}, + ], +) +async def test_get_snapshot_async(request_type, transport: str = "grpc_asyncio"): client = SubscriberAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4920,7 +4951,7 @@ async def test_get_snapshot_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_snapshot), "__call__") as call: @@ -4945,11 +4976,6 @@ async def test_get_snapshot_async( assert response.topic == "topic_value" -@pytest.mark.asyncio -async def test_get_snapshot_async_from_dict(): - await test_get_snapshot_async(request_type=dict) - - def test_get_snapshot_field_headers(): client = SubscriberClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5092,8 +5118,8 @@ async def test_get_snapshot_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - pubsub.ListSnapshotsRequest, - dict, + pubsub.ListSnapshotsRequest(), + {}, ], ) def test_list_snapshots(request_type, transport: str = "grpc"): @@ -5104,7 +5130,7 @@ def test_list_snapshots(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_snapshots), "__call__") as call: @@ -5149,10 +5175,11 @@ def test_list_snapshots_non_empty_request_with_auto_populated_field(): client.list_snapshots(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == pubsub.ListSnapshotsRequest( + request_msg = pubsub.ListSnapshotsRequest( project="project_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_snapshots_use_cached_wrapped_rpc(): @@ -5233,9 +5260,14 @@ async def test_list_snapshots_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_snapshots_async( - transport: str = "grpc_asyncio", request_type=pubsub.ListSnapshotsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + pubsub.ListSnapshotsRequest(), + {}, + ], +) +async def test_list_snapshots_async(request_type, transport: str = "grpc_asyncio"): client = SubscriberAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5243,7 +5275,7 @@ async def test_list_snapshots_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_snapshots), "__call__") as call: @@ -5266,11 +5298,6 @@ async def test_list_snapshots_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_snapshots_async_from_dict(): - await test_list_snapshots_async(request_type=dict) - - def test_list_snapshots_field_headers(): client = SubscriberClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5607,8 +5634,8 @@ async def test_list_snapshots_async_pages(): @pytest.mark.parametrize( "request_type", [ - pubsub.CreateSnapshotRequest, - dict, + pubsub.CreateSnapshotRequest(), + {}, ], ) def test_create_snapshot(request_type, transport: str = "grpc"): @@ -5619,7 +5646,7 @@ def test_create_snapshot(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_snapshot), "__call__") as call: @@ -5666,10 +5693,11 @@ def test_create_snapshot_non_empty_request_with_auto_populated_field(): client.create_snapshot(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == pubsub.CreateSnapshotRequest( + request_msg = pubsub.CreateSnapshotRequest( name="name_value", subscription="subscription_value", ) + assert args[0] == request_msg def test_create_snapshot_use_cached_wrapped_rpc(): @@ -5750,9 +5778,14 @@ async def test_create_snapshot_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_snapshot_async( - transport: str = "grpc_asyncio", request_type=pubsub.CreateSnapshotRequest -): +@pytest.mark.parametrize( + "request_type", + [ + pubsub.CreateSnapshotRequest(), + {}, + ], +) +async def test_create_snapshot_async(request_type, transport: str = "grpc_asyncio"): client = SubscriberAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5760,7 +5793,7 @@ async def test_create_snapshot_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_snapshot), "__call__") as call: @@ -5785,11 +5818,6 @@ async def test_create_snapshot_async( assert response.topic == "topic_value" -@pytest.mark.asyncio -async def test_create_snapshot_async_from_dict(): - await test_create_snapshot_async(request_type=dict) - - def test_create_snapshot_field_headers(): client = SubscriberClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5942,8 +5970,8 @@ async def test_create_snapshot_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - pubsub.UpdateSnapshotRequest, - dict, + pubsub.UpdateSnapshotRequest(), + {}, ], ) def test_update_snapshot(request_type, transport: str = "grpc"): @@ -5954,7 +5982,7 @@ def test_update_snapshot(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_snapshot), "__call__") as call: @@ -5998,7 +6026,8 @@ def test_update_snapshot_non_empty_request_with_auto_populated_field(): client.update_snapshot(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == pubsub.UpdateSnapshotRequest() + request_msg = pubsub.UpdateSnapshotRequest() + assert args[0] == request_msg def test_update_snapshot_use_cached_wrapped_rpc(): @@ -6079,9 +6108,14 @@ async def test_update_snapshot_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_snapshot_async( - transport: str = "grpc_asyncio", request_type=pubsub.UpdateSnapshotRequest -): +@pytest.mark.parametrize( + "request_type", + [ + pubsub.UpdateSnapshotRequest(), + {}, + ], +) +async def test_update_snapshot_async(request_type, transport: str = "grpc_asyncio"): client = SubscriberAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6089,7 +6123,7 @@ async def test_update_snapshot_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_snapshot), "__call__") as call: @@ -6114,11 +6148,6 @@ async def test_update_snapshot_async( assert response.topic == "topic_value" -@pytest.mark.asyncio -async def test_update_snapshot_async_from_dict(): - await test_update_snapshot_async(request_type=dict) - - def test_update_snapshot_field_headers(): client = SubscriberClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6271,8 +6300,8 @@ async def test_update_snapshot_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - pubsub.DeleteSnapshotRequest, - dict, + pubsub.DeleteSnapshotRequest(), + {}, ], ) def test_delete_snapshot(request_type, transport: str = "grpc"): @@ -6283,7 +6312,7 @@ def test_delete_snapshot(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_snapshot), "__call__") as call: @@ -6324,9 +6353,10 @@ def test_delete_snapshot_non_empty_request_with_auto_populated_field(): client.delete_snapshot(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == pubsub.DeleteSnapshotRequest( + request_msg = pubsub.DeleteSnapshotRequest( snapshot="snapshot_value", ) + assert args[0] == request_msg def test_delete_snapshot_use_cached_wrapped_rpc(): @@ -6407,9 +6437,14 @@ async def test_delete_snapshot_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_snapshot_async( - transport: str = "grpc_asyncio", request_type=pubsub.DeleteSnapshotRequest -): +@pytest.mark.parametrize( + "request_type", + [ + pubsub.DeleteSnapshotRequest(), + {}, + ], +) +async def test_delete_snapshot_async(request_type, transport: str = "grpc_asyncio"): client = SubscriberAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6417,7 +6452,7 @@ async def test_delete_snapshot_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_snapshot), "__call__") as call: @@ -6435,11 +6470,6 @@ async def test_delete_snapshot_async( assert response is None -@pytest.mark.asyncio -async def test_delete_snapshot_async_from_dict(): - await test_delete_snapshot_async(request_type=dict) - - def test_delete_snapshot_field_headers(): client = SubscriberClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6582,8 +6612,8 @@ async def test_delete_snapshot_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - pubsub.SeekRequest, - dict, + pubsub.SeekRequest(), + {}, ], ) def test_seek(request_type, transport: str = "grpc"): @@ -6594,7 +6624,7 @@ def test_seek(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.seek), "__call__") as call: @@ -6636,10 +6666,11 @@ def test_seek_non_empty_request_with_auto_populated_field(): client.seek(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == pubsub.SeekRequest( + request_msg = pubsub.SeekRequest( subscription="subscription_value", snapshot="snapshot_value", ) + assert args[0] == request_msg def test_seek_use_cached_wrapped_rpc(): @@ -6717,9 +6748,14 @@ async def test_seek_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio" @pytest.mark.asyncio -async def test_seek_async( - transport: str = "grpc_asyncio", request_type=pubsub.SeekRequest -): +@pytest.mark.parametrize( + "request_type", + [ + pubsub.SeekRequest(), + {}, + ], +) +async def test_seek_async(request_type, transport: str = "grpc_asyncio"): client = SubscriberAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6727,7 +6763,7 @@ async def test_seek_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.seek), "__call__") as call: @@ -6745,11 +6781,6 @@ async def test_seek_async( assert isinstance(response, pubsub.SeekResponse) -@pytest.mark.asyncio -async def test_seek_async_from_dict(): - await test_seek_async(request_type=dict) - - def test_seek_field_headers(): client = SubscriberClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9810,7 +9841,6 @@ def test_create_subscription_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pubsub.Subscription() - assert args[0] == request_msg @@ -9831,7 +9861,6 @@ def test_get_subscription_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pubsub.GetSubscriptionRequest() - assert args[0] == request_msg @@ -9854,7 +9883,6 @@ def test_update_subscription_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pubsub.UpdateSubscriptionRequest() - assert args[0] == request_msg @@ -9877,7 +9905,6 @@ def test_list_subscriptions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pubsub.ListSubscriptionsRequest() - assert args[0] == request_msg @@ -9900,7 +9927,6 @@ def test_delete_subscription_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pubsub.DeleteSubscriptionRequest() - assert args[0] == request_msg @@ -9923,7 +9949,6 @@ def test_modify_ack_deadline_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pubsub.ModifyAckDeadlineRequest() - assert args[0] == request_msg @@ -9944,7 +9969,6 @@ def test_acknowledge_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pubsub.AcknowledgeRequest() - assert args[0] == request_msg @@ -9965,7 +9989,6 @@ def test_pull_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pubsub.PullRequest() - assert args[0] == request_msg @@ -9988,7 +10011,6 @@ def test_modify_push_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pubsub.ModifyPushConfigRequest() - assert args[0] == request_msg @@ -10009,7 +10031,6 @@ def test_get_snapshot_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pubsub.GetSnapshotRequest() - assert args[0] == request_msg @@ -10030,7 +10051,6 @@ def test_list_snapshots_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pubsub.ListSnapshotsRequest() - assert args[0] == request_msg @@ -10051,7 +10071,6 @@ def test_create_snapshot_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pubsub.CreateSnapshotRequest() - assert args[0] == request_msg @@ -10072,7 +10091,6 @@ def test_update_snapshot_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pubsub.UpdateSnapshotRequest() - assert args[0] == request_msg @@ -10093,7 +10111,6 @@ def test_delete_snapshot_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pubsub.DeleteSnapshotRequest() - assert args[0] == request_msg @@ -10114,7 +10131,6 @@ def test_seek_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pubsub.SeekRequest() - assert args[0] == request_msg @@ -10165,7 +10181,6 @@ async def test_create_subscription_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pubsub.Subscription() - assert args[0] == request_msg @@ -10200,7 +10215,6 @@ async def test_get_subscription_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pubsub.GetSubscriptionRequest() - assert args[0] == request_msg @@ -10237,7 +10251,6 @@ async def test_update_subscription_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pubsub.UpdateSubscriptionRequest() - assert args[0] == request_msg @@ -10266,7 +10279,6 @@ async def test_list_subscriptions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pubsub.ListSubscriptionsRequest() - assert args[0] == request_msg @@ -10291,7 +10303,6 @@ async def test_delete_subscription_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pubsub.DeleteSubscriptionRequest() - assert args[0] == request_msg @@ -10316,7 +10327,6 @@ async def test_modify_ack_deadline_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pubsub.ModifyAckDeadlineRequest() - assert args[0] == request_msg @@ -10339,7 +10349,6 @@ async def test_acknowledge_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pubsub.AcknowledgeRequest() - assert args[0] == request_msg @@ -10362,7 +10371,6 @@ async def test_pull_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pubsub.PullRequest() - assert args[0] == request_msg @@ -10387,7 +10395,6 @@ async def test_modify_push_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pubsub.ModifyPushConfigRequest() - assert args[0] == request_msg @@ -10415,7 +10422,6 @@ async def test_get_snapshot_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pubsub.GetSnapshotRequest() - assert args[0] == request_msg @@ -10442,7 +10448,6 @@ async def test_list_snapshots_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pubsub.ListSnapshotsRequest() - assert args[0] == request_msg @@ -10470,7 +10475,6 @@ async def test_create_snapshot_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pubsub.CreateSnapshotRequest() - assert args[0] == request_msg @@ -10498,7 +10502,6 @@ async def test_update_snapshot_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pubsub.UpdateSnapshotRequest() - assert args[0] == request_msg @@ -10521,7 +10524,6 @@ async def test_delete_snapshot_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pubsub.DeleteSnapshotRequest() - assert args[0] == request_msg @@ -10544,7 +10546,6 @@ async def test_seek_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pubsub.SeekRequest() - assert args[0] == request_msg @@ -12636,7 +12637,6 @@ def test_create_subscription_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pubsub.Subscription() - assert args[0] == request_msg @@ -12656,7 +12656,6 @@ def test_get_subscription_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pubsub.GetSubscriptionRequest() - assert args[0] == request_msg @@ -12678,7 +12677,6 @@ def test_update_subscription_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pubsub.UpdateSubscriptionRequest() - assert args[0] == request_msg @@ -12700,7 +12698,6 @@ def test_list_subscriptions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pubsub.ListSubscriptionsRequest() - assert args[0] == request_msg @@ -12722,7 +12719,6 @@ def test_delete_subscription_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pubsub.DeleteSubscriptionRequest() - assert args[0] == request_msg @@ -12744,7 +12740,6 @@ def test_modify_ack_deadline_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pubsub.ModifyAckDeadlineRequest() - assert args[0] == request_msg @@ -12764,7 +12759,6 @@ def test_acknowledge_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pubsub.AcknowledgeRequest() - assert args[0] == request_msg @@ -12784,7 +12778,6 @@ def test_pull_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pubsub.PullRequest() - assert args[0] == request_msg @@ -12806,7 +12799,6 @@ def test_modify_push_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pubsub.ModifyPushConfigRequest() - assert args[0] == request_msg @@ -12826,7 +12818,6 @@ def test_get_snapshot_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pubsub.GetSnapshotRequest() - assert args[0] == request_msg @@ -12846,7 +12837,6 @@ def test_list_snapshots_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pubsub.ListSnapshotsRequest() - assert args[0] == request_msg @@ -12866,7 +12856,6 @@ def test_create_snapshot_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pubsub.CreateSnapshotRequest() - assert args[0] == request_msg @@ -12886,7 +12875,6 @@ def test_update_snapshot_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pubsub.UpdateSnapshotRequest() - assert args[0] == request_msg @@ -12906,7 +12894,6 @@ def test_delete_snapshot_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pubsub.DeleteSnapshotRequest() - assert args[0] == request_msg @@ -12926,7 +12913,6 @@ def test_seek_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = pubsub.SeekRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-quotas/noxfile.py b/packages/google-cloud-quotas/noxfile.py index 617da3a8f640..53416e6741d4 100644 --- a/packages/google-cloud-quotas/noxfile.py +++ b/packages/google-cloud-quotas/noxfile.py @@ -47,7 +47,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-quotas" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-quotas/setup.py b/packages/google-cloud-quotas/setup.py index 34ac8e380675..511993a5d9e8 100644 --- a/packages/google-cloud-quotas/setup.py +++ b/packages/google-cloud-quotas/setup.py @@ -45,7 +45,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/google-cloud-quotas/testing/constraints-3.10.txt b/packages/google-cloud-quotas/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-quotas/testing/constraints-3.10.txt +++ b/packages/google-cloud-quotas/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-quotas/tests/unit/gapic/cloudquotas_v1/test_cloud_quotas.py b/packages/google-cloud-quotas/tests/unit/gapic/cloudquotas_v1/test_cloud_quotas.py index e7fab48820b2..335385d75085 100644 --- a/packages/google-cloud-quotas/tests/unit/gapic/cloudquotas_v1/test_cloud_quotas.py +++ b/packages/google-cloud-quotas/tests/unit/gapic/cloudquotas_v1/test_cloud_quotas.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 @@ -110,6 +111,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" @@ -1275,8 +1291,8 @@ def test_cloud_quotas_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - cloudquotas.ListQuotaInfosRequest, - dict, + cloudquotas.ListQuotaInfosRequest(), + {}, ], ) def test_list_quota_infos(request_type, transport: str = "grpc"): @@ -1287,7 +1303,7 @@ def test_list_quota_infos(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_quota_infos), "__call__") as call: @@ -1332,10 +1348,11 @@ def test_list_quota_infos_non_empty_request_with_auto_populated_field(): client.list_quota_infos(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudquotas.ListQuotaInfosRequest( + request_msg = cloudquotas.ListQuotaInfosRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_quota_infos_use_cached_wrapped_rpc(): @@ -1418,9 +1435,14 @@ async def test_list_quota_infos_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_quota_infos_async( - transport: str = "grpc_asyncio", request_type=cloudquotas.ListQuotaInfosRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudquotas.ListQuotaInfosRequest(), + {}, + ], +) +async def test_list_quota_infos_async(request_type, transport: str = "grpc_asyncio"): client = CloudQuotasAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1428,7 +1450,7 @@ async def test_list_quota_infos_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_quota_infos), "__call__") as call: @@ -1451,11 +1473,6 @@ async def test_list_quota_infos_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_quota_infos_async_from_dict(): - await test_list_quota_infos_async(request_type=dict) - - def test_list_quota_infos_field_headers(): client = CloudQuotasClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1792,8 +1809,8 @@ async def test_list_quota_infos_async_pages(): @pytest.mark.parametrize( "request_type", [ - cloudquotas.GetQuotaInfoRequest, - dict, + cloudquotas.GetQuotaInfoRequest(), + {}, ], ) def test_get_quota_info(request_type, transport: str = "grpc"): @@ -1804,7 +1821,7 @@ def test_get_quota_info(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_quota_info), "__call__") as call: @@ -1874,9 +1891,10 @@ def test_get_quota_info_non_empty_request_with_auto_populated_field(): client.get_quota_info(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudquotas.GetQuotaInfoRequest( + request_msg = cloudquotas.GetQuotaInfoRequest( name="name_value", ) + assert args[0] == request_msg def test_get_quota_info_use_cached_wrapped_rpc(): @@ -1957,9 +1975,14 @@ async def test_get_quota_info_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_quota_info_async( - transport: str = "grpc_asyncio", request_type=cloudquotas.GetQuotaInfoRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudquotas.GetQuotaInfoRequest(), + {}, + ], +) +async def test_get_quota_info_async(request_type, transport: str = "grpc_asyncio"): client = CloudQuotasAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1967,7 +1990,7 @@ async def test_get_quota_info_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_quota_info), "__call__") as call: @@ -2016,11 +2039,6 @@ async def test_get_quota_info_async( assert response.service_request_quota_uri == "service_request_quota_uri_value" -@pytest.mark.asyncio -async def test_get_quota_info_async_from_dict(): - await test_get_quota_info_async(request_type=dict) - - def test_get_quota_info_field_headers(): client = CloudQuotasClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2163,8 +2181,8 @@ async def test_get_quota_info_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloudquotas.ListQuotaPreferencesRequest, - dict, + cloudquotas.ListQuotaPreferencesRequest(), + {}, ], ) def test_list_quota_preferences(request_type, transport: str = "grpc"): @@ -2175,7 +2193,7 @@ def test_list_quota_preferences(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2228,12 +2246,13 @@ def test_list_quota_preferences_non_empty_request_with_auto_populated_field(): client.list_quota_preferences(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudquotas.ListQuotaPreferencesRequest( + request_msg = cloudquotas.ListQuotaPreferencesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_quota_preferences_use_cached_wrapped_rpc(): @@ -2319,9 +2338,15 @@ async def test_list_quota_preferences_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloudquotas.ListQuotaPreferencesRequest(), + {}, + ], +) async def test_list_quota_preferences_async( - transport: str = "grpc_asyncio", - request_type=cloudquotas.ListQuotaPreferencesRequest, + request_type, transport: str = "grpc_asyncio" ): client = CloudQuotasAsyncClient( credentials=async_anonymous_credentials(), @@ -2330,7 +2355,7 @@ async def test_list_quota_preferences_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( @@ -2357,11 +2382,6 @@ async def test_list_quota_preferences_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_quota_preferences_async_from_dict(): - await test_list_quota_preferences_async(request_type=dict) - - def test_list_quota_preferences_field_headers(): client = CloudQuotasClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2714,8 +2734,8 @@ async def test_list_quota_preferences_async_pages(): @pytest.mark.parametrize( "request_type", [ - cloudquotas.GetQuotaPreferenceRequest, - dict, + cloudquotas.GetQuotaPreferenceRequest(), + {}, ], ) def test_get_quota_preference(request_type, transport: str = "grpc"): @@ -2726,7 +2746,7 @@ def test_get_quota_preference(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2786,9 +2806,10 @@ def test_get_quota_preference_non_empty_request_with_auto_populated_field(): client.get_quota_preference(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudquotas.GetQuotaPreferenceRequest( + request_msg = cloudquotas.GetQuotaPreferenceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_quota_preference_use_cached_wrapped_rpc(): @@ -2873,8 +2894,15 @@ async def test_get_quota_preference_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloudquotas.GetQuotaPreferenceRequest(), + {}, + ], +) async def test_get_quota_preference_async( - transport: str = "grpc_asyncio", request_type=cloudquotas.GetQuotaPreferenceRequest + request_type, transport: str = "grpc_asyncio" ): client = CloudQuotasAsyncClient( credentials=async_anonymous_credentials(), @@ -2883,7 +2911,7 @@ async def test_get_quota_preference_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( @@ -2920,11 +2948,6 @@ async def test_get_quota_preference_async( assert response.contact_email == "contact_email_value" -@pytest.mark.asyncio -async def test_get_quota_preference_async_from_dict(): - await test_get_quota_preference_async(request_type=dict) - - def test_get_quota_preference_field_headers(): client = CloudQuotasClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3079,8 +3102,8 @@ async def test_get_quota_preference_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloudquotas.CreateQuotaPreferenceRequest, - dict, + cloudquotas.CreateQuotaPreferenceRequest(), + {}, ], ) def test_create_quota_preference(request_type, transport: str = "grpc"): @@ -3091,7 +3114,7 @@ def test_create_quota_preference(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3152,10 +3175,11 @@ def test_create_quota_preference_non_empty_request_with_auto_populated_field(): client.create_quota_preference(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudquotas.CreateQuotaPreferenceRequest( + request_msg = cloudquotas.CreateQuotaPreferenceRequest( parent="parent_value", quota_preference_id="quota_preference_id_value", ) + assert args[0] == request_msg def test_create_quota_preference_use_cached_wrapped_rpc(): @@ -3241,9 +3265,15 @@ async def test_create_quota_preference_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloudquotas.CreateQuotaPreferenceRequest(), + {}, + ], +) async def test_create_quota_preference_async( - transport: str = "grpc_asyncio", - request_type=cloudquotas.CreateQuotaPreferenceRequest, + request_type, transport: str = "grpc_asyncio" ): client = CloudQuotasAsyncClient( credentials=async_anonymous_credentials(), @@ -3252,7 +3282,7 @@ async def test_create_quota_preference_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( @@ -3289,11 +3319,6 @@ async def test_create_quota_preference_async( assert response.contact_email == "contact_email_value" -@pytest.mark.asyncio -async def test_create_quota_preference_async_from_dict(): - await test_create_quota_preference_async(request_type=dict) - - def test_create_quota_preference_field_headers(): client = CloudQuotasClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3468,8 +3493,8 @@ async def test_create_quota_preference_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloudquotas.UpdateQuotaPreferenceRequest, - dict, + cloudquotas.UpdateQuotaPreferenceRequest(), + {}, ], ) def test_update_quota_preference(request_type, transport: str = "grpc"): @@ -3480,7 +3505,7 @@ def test_update_quota_preference(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3538,7 +3563,8 @@ def test_update_quota_preference_non_empty_request_with_auto_populated_field(): client.update_quota_preference(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudquotas.UpdateQuotaPreferenceRequest() + request_msg = cloudquotas.UpdateQuotaPreferenceRequest() + assert args[0] == request_msg def test_update_quota_preference_use_cached_wrapped_rpc(): @@ -3624,9 +3650,15 @@ async def test_update_quota_preference_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloudquotas.UpdateQuotaPreferenceRequest(), + {}, + ], +) async def test_update_quota_preference_async( - transport: str = "grpc_asyncio", - request_type=cloudquotas.UpdateQuotaPreferenceRequest, + request_type, transport: str = "grpc_asyncio" ): client = CloudQuotasAsyncClient( credentials=async_anonymous_credentials(), @@ -3635,7 +3667,7 @@ async def test_update_quota_preference_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( @@ -3672,11 +3704,6 @@ async def test_update_quota_preference_async( assert response.contact_email == "contact_email_value" -@pytest.mark.asyncio -async def test_update_quota_preference_async_from_dict(): - await test_update_quota_preference_async(request_type=dict) - - def test_update_quota_preference_field_headers(): client = CloudQuotasClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5264,7 +5291,6 @@ def test_list_quota_infos_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudquotas.ListQuotaInfosRequest() - assert args[0] == request_msg @@ -5285,7 +5311,6 @@ def test_get_quota_info_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudquotas.GetQuotaInfoRequest() - assert args[0] == request_msg @@ -5308,7 +5333,6 @@ def test_list_quota_preferences_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudquotas.ListQuotaPreferencesRequest() - assert args[0] == request_msg @@ -5331,7 +5355,6 @@ def test_get_quota_preference_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudquotas.GetQuotaPreferenceRequest() - assert args[0] == request_msg @@ -5354,7 +5377,6 @@ def test_create_quota_preference_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudquotas.CreateQuotaPreferenceRequest() - assert args[0] == request_msg @@ -5377,7 +5399,6 @@ def test_update_quota_preference_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudquotas.UpdateQuotaPreferenceRequest() - assert args[0] == request_msg @@ -5418,7 +5439,6 @@ async def test_list_quota_infos_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudquotas.ListQuotaInfosRequest() - assert args[0] == request_msg @@ -5458,7 +5478,6 @@ async def test_get_quota_info_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudquotas.GetQuotaInfoRequest() - assert args[0] == request_msg @@ -5488,7 +5507,6 @@ async def test_list_quota_preferences_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudquotas.ListQuotaPreferencesRequest() - assert args[0] == request_msg @@ -5523,7 +5541,6 @@ async def test_get_quota_preference_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudquotas.GetQuotaPreferenceRequest() - assert args[0] == request_msg @@ -5558,7 +5575,6 @@ async def test_create_quota_preference_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudquotas.CreateQuotaPreferenceRequest() - assert args[0] == request_msg @@ -5593,7 +5609,6 @@ async def test_update_quota_preference_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudquotas.UpdateQuotaPreferenceRequest() - assert args[0] == request_msg @@ -6674,7 +6689,6 @@ def test_list_quota_infos_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudquotas.ListQuotaInfosRequest() - assert args[0] == request_msg @@ -6694,7 +6708,6 @@ def test_get_quota_info_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudquotas.GetQuotaInfoRequest() - assert args[0] == request_msg @@ -6716,7 +6729,6 @@ def test_list_quota_preferences_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudquotas.ListQuotaPreferencesRequest() - assert args[0] == request_msg @@ -6738,7 +6750,6 @@ def test_get_quota_preference_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudquotas.GetQuotaPreferenceRequest() - assert args[0] == request_msg @@ -6760,7 +6771,6 @@ def test_create_quota_preference_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudquotas.CreateQuotaPreferenceRequest() - assert args[0] == request_msg @@ -6782,7 +6792,6 @@ def test_update_quota_preference_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudquotas.UpdateQuotaPreferenceRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-quotas/tests/unit/gapic/cloudquotas_v1beta/test_cloud_quotas.py b/packages/google-cloud-quotas/tests/unit/gapic/cloudquotas_v1beta/test_cloud_quotas.py index 3b6998a4f359..b62cce5a951a 100644 --- a/packages/google-cloud-quotas/tests/unit/gapic/cloudquotas_v1beta/test_cloud_quotas.py +++ b/packages/google-cloud-quotas/tests/unit/gapic/cloudquotas_v1beta/test_cloud_quotas.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 @@ -110,6 +111,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" @@ -1275,8 +1291,8 @@ def test_cloud_quotas_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - cloudquotas.ListQuotaInfosRequest, - dict, + cloudquotas.ListQuotaInfosRequest(), + {}, ], ) def test_list_quota_infos(request_type, transport: str = "grpc"): @@ -1287,7 +1303,7 @@ def test_list_quota_infos(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_quota_infos), "__call__") as call: @@ -1332,10 +1348,11 @@ def test_list_quota_infos_non_empty_request_with_auto_populated_field(): client.list_quota_infos(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudquotas.ListQuotaInfosRequest( + request_msg = cloudquotas.ListQuotaInfosRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_quota_infos_use_cached_wrapped_rpc(): @@ -1418,9 +1435,14 @@ async def test_list_quota_infos_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_quota_infos_async( - transport: str = "grpc_asyncio", request_type=cloudquotas.ListQuotaInfosRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudquotas.ListQuotaInfosRequest(), + {}, + ], +) +async def test_list_quota_infos_async(request_type, transport: str = "grpc_asyncio"): client = CloudQuotasAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1428,7 +1450,7 @@ async def test_list_quota_infos_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_quota_infos), "__call__") as call: @@ -1451,11 +1473,6 @@ async def test_list_quota_infos_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_quota_infos_async_from_dict(): - await test_list_quota_infos_async(request_type=dict) - - def test_list_quota_infos_field_headers(): client = CloudQuotasClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1792,8 +1809,8 @@ async def test_list_quota_infos_async_pages(): @pytest.mark.parametrize( "request_type", [ - cloudquotas.GetQuotaInfoRequest, - dict, + cloudquotas.GetQuotaInfoRequest(), + {}, ], ) def test_get_quota_info(request_type, transport: str = "grpc"): @@ -1804,7 +1821,7 @@ def test_get_quota_info(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_quota_info), "__call__") as call: @@ -1874,9 +1891,10 @@ def test_get_quota_info_non_empty_request_with_auto_populated_field(): client.get_quota_info(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudquotas.GetQuotaInfoRequest( + request_msg = cloudquotas.GetQuotaInfoRequest( name="name_value", ) + assert args[0] == request_msg def test_get_quota_info_use_cached_wrapped_rpc(): @@ -1957,9 +1975,14 @@ async def test_get_quota_info_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_quota_info_async( - transport: str = "grpc_asyncio", request_type=cloudquotas.GetQuotaInfoRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudquotas.GetQuotaInfoRequest(), + {}, + ], +) +async def test_get_quota_info_async(request_type, transport: str = "grpc_asyncio"): client = CloudQuotasAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1967,7 +1990,7 @@ async def test_get_quota_info_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_quota_info), "__call__") as call: @@ -2016,11 +2039,6 @@ async def test_get_quota_info_async( assert response.service_request_quota_uri == "service_request_quota_uri_value" -@pytest.mark.asyncio -async def test_get_quota_info_async_from_dict(): - await test_get_quota_info_async(request_type=dict) - - def test_get_quota_info_field_headers(): client = CloudQuotasClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2163,8 +2181,8 @@ async def test_get_quota_info_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloudquotas.ListQuotaPreferencesRequest, - dict, + cloudquotas.ListQuotaPreferencesRequest(), + {}, ], ) def test_list_quota_preferences(request_type, transport: str = "grpc"): @@ -2175,7 +2193,7 @@ def test_list_quota_preferences(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2228,12 +2246,13 @@ def test_list_quota_preferences_non_empty_request_with_auto_populated_field(): client.list_quota_preferences(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudquotas.ListQuotaPreferencesRequest( + request_msg = cloudquotas.ListQuotaPreferencesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_quota_preferences_use_cached_wrapped_rpc(): @@ -2319,9 +2338,15 @@ async def test_list_quota_preferences_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloudquotas.ListQuotaPreferencesRequest(), + {}, + ], +) async def test_list_quota_preferences_async( - transport: str = "grpc_asyncio", - request_type=cloudquotas.ListQuotaPreferencesRequest, + request_type, transport: str = "grpc_asyncio" ): client = CloudQuotasAsyncClient( credentials=async_anonymous_credentials(), @@ -2330,7 +2355,7 @@ async def test_list_quota_preferences_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( @@ -2357,11 +2382,6 @@ async def test_list_quota_preferences_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_quota_preferences_async_from_dict(): - await test_list_quota_preferences_async(request_type=dict) - - def test_list_quota_preferences_field_headers(): client = CloudQuotasClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2714,8 +2734,8 @@ async def test_list_quota_preferences_async_pages(): @pytest.mark.parametrize( "request_type", [ - cloudquotas.GetQuotaPreferenceRequest, - dict, + cloudquotas.GetQuotaPreferenceRequest(), + {}, ], ) def test_get_quota_preference(request_type, transport: str = "grpc"): @@ -2726,7 +2746,7 @@ def test_get_quota_preference(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2786,9 +2806,10 @@ def test_get_quota_preference_non_empty_request_with_auto_populated_field(): client.get_quota_preference(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudquotas.GetQuotaPreferenceRequest( + request_msg = cloudquotas.GetQuotaPreferenceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_quota_preference_use_cached_wrapped_rpc(): @@ -2873,8 +2894,15 @@ async def test_get_quota_preference_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloudquotas.GetQuotaPreferenceRequest(), + {}, + ], +) async def test_get_quota_preference_async( - transport: str = "grpc_asyncio", request_type=cloudquotas.GetQuotaPreferenceRequest + request_type, transport: str = "grpc_asyncio" ): client = CloudQuotasAsyncClient( credentials=async_anonymous_credentials(), @@ -2883,7 +2911,7 @@ async def test_get_quota_preference_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( @@ -2920,11 +2948,6 @@ async def test_get_quota_preference_async( assert response.contact_email == "contact_email_value" -@pytest.mark.asyncio -async def test_get_quota_preference_async_from_dict(): - await test_get_quota_preference_async(request_type=dict) - - def test_get_quota_preference_field_headers(): client = CloudQuotasClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3079,8 +3102,8 @@ async def test_get_quota_preference_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloudquotas.CreateQuotaPreferenceRequest, - dict, + cloudquotas.CreateQuotaPreferenceRequest(), + {}, ], ) def test_create_quota_preference(request_type, transport: str = "grpc"): @@ -3091,7 +3114,7 @@ def test_create_quota_preference(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3152,10 +3175,11 @@ def test_create_quota_preference_non_empty_request_with_auto_populated_field(): client.create_quota_preference(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudquotas.CreateQuotaPreferenceRequest( + request_msg = cloudquotas.CreateQuotaPreferenceRequest( parent="parent_value", quota_preference_id="quota_preference_id_value", ) + assert args[0] == request_msg def test_create_quota_preference_use_cached_wrapped_rpc(): @@ -3241,9 +3265,15 @@ async def test_create_quota_preference_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloudquotas.CreateQuotaPreferenceRequest(), + {}, + ], +) async def test_create_quota_preference_async( - transport: str = "grpc_asyncio", - request_type=cloudquotas.CreateQuotaPreferenceRequest, + request_type, transport: str = "grpc_asyncio" ): client = CloudQuotasAsyncClient( credentials=async_anonymous_credentials(), @@ -3252,7 +3282,7 @@ async def test_create_quota_preference_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( @@ -3289,11 +3319,6 @@ async def test_create_quota_preference_async( assert response.contact_email == "contact_email_value" -@pytest.mark.asyncio -async def test_create_quota_preference_async_from_dict(): - await test_create_quota_preference_async(request_type=dict) - - def test_create_quota_preference_field_headers(): client = CloudQuotasClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3468,8 +3493,8 @@ async def test_create_quota_preference_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloudquotas.UpdateQuotaPreferenceRequest, - dict, + cloudquotas.UpdateQuotaPreferenceRequest(), + {}, ], ) def test_update_quota_preference(request_type, transport: str = "grpc"): @@ -3480,7 +3505,7 @@ def test_update_quota_preference(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3538,7 +3563,8 @@ def test_update_quota_preference_non_empty_request_with_auto_populated_field(): client.update_quota_preference(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudquotas.UpdateQuotaPreferenceRequest() + request_msg = cloudquotas.UpdateQuotaPreferenceRequest() + assert args[0] == request_msg def test_update_quota_preference_use_cached_wrapped_rpc(): @@ -3624,9 +3650,15 @@ async def test_update_quota_preference_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloudquotas.UpdateQuotaPreferenceRequest(), + {}, + ], +) async def test_update_quota_preference_async( - transport: str = "grpc_asyncio", - request_type=cloudquotas.UpdateQuotaPreferenceRequest, + request_type, transport: str = "grpc_asyncio" ): client = CloudQuotasAsyncClient( credentials=async_anonymous_credentials(), @@ -3635,7 +3667,7 @@ async def test_update_quota_preference_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( @@ -3672,11 +3704,6 @@ async def test_update_quota_preference_async( assert response.contact_email == "contact_email_value" -@pytest.mark.asyncio -async def test_update_quota_preference_async_from_dict(): - await test_update_quota_preference_async(request_type=dict) - - def test_update_quota_preference_field_headers(): client = CloudQuotasClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5264,7 +5291,6 @@ def test_list_quota_infos_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudquotas.ListQuotaInfosRequest() - assert args[0] == request_msg @@ -5285,7 +5311,6 @@ def test_get_quota_info_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudquotas.GetQuotaInfoRequest() - assert args[0] == request_msg @@ -5308,7 +5333,6 @@ def test_list_quota_preferences_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudquotas.ListQuotaPreferencesRequest() - assert args[0] == request_msg @@ -5331,7 +5355,6 @@ def test_get_quota_preference_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudquotas.GetQuotaPreferenceRequest() - assert args[0] == request_msg @@ -5354,7 +5377,6 @@ def test_create_quota_preference_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudquotas.CreateQuotaPreferenceRequest() - assert args[0] == request_msg @@ -5377,7 +5399,6 @@ def test_update_quota_preference_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudquotas.UpdateQuotaPreferenceRequest() - assert args[0] == request_msg @@ -5418,7 +5439,6 @@ async def test_list_quota_infos_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudquotas.ListQuotaInfosRequest() - assert args[0] == request_msg @@ -5458,7 +5478,6 @@ async def test_get_quota_info_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudquotas.GetQuotaInfoRequest() - assert args[0] == request_msg @@ -5488,7 +5507,6 @@ async def test_list_quota_preferences_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudquotas.ListQuotaPreferencesRequest() - assert args[0] == request_msg @@ -5523,7 +5541,6 @@ async def test_get_quota_preference_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudquotas.GetQuotaPreferenceRequest() - assert args[0] == request_msg @@ -5558,7 +5575,6 @@ async def test_create_quota_preference_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudquotas.CreateQuotaPreferenceRequest() - assert args[0] == request_msg @@ -5593,7 +5609,6 @@ async def test_update_quota_preference_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudquotas.UpdateQuotaPreferenceRequest() - assert args[0] == request_msg @@ -6674,7 +6689,6 @@ def test_list_quota_infos_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudquotas.ListQuotaInfosRequest() - assert args[0] == request_msg @@ -6694,7 +6708,6 @@ def test_get_quota_info_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudquotas.GetQuotaInfoRequest() - assert args[0] == request_msg @@ -6716,7 +6729,6 @@ def test_list_quota_preferences_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudquotas.ListQuotaPreferencesRequest() - assert args[0] == request_msg @@ -6738,7 +6750,6 @@ def test_get_quota_preference_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudquotas.GetQuotaPreferenceRequest() - assert args[0] == request_msg @@ -6760,7 +6771,6 @@ def test_create_quota_preference_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudquotas.CreateQuotaPreferenceRequest() - assert args[0] == request_msg @@ -6782,7 +6792,6 @@ def test_update_quota_preference_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudquotas.UpdateQuotaPreferenceRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-quotas/tests/unit/gapic/cloudquotas_v1beta/test_quota_adjuster_settings_manager.py b/packages/google-cloud-quotas/tests/unit/gapic/cloudquotas_v1beta/test_quota_adjuster_settings_manager.py index 5780b64fb0cc..f7c1911700ed 100644 --- a/packages/google-cloud-quotas/tests/unit/gapic/cloudquotas_v1beta/test_quota_adjuster_settings_manager.py +++ b/packages/google-cloud-quotas/tests/unit/gapic/cloudquotas_v1beta/test_quota_adjuster_settings_manager.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" @@ -1421,8 +1437,8 @@ def test_quota_adjuster_settings_manager_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - gac_quota_adjuster_settings.UpdateQuotaAdjusterSettingsRequest, - dict, + gac_quota_adjuster_settings.UpdateQuotaAdjusterSettingsRequest(), + {}, ], ) def test_update_quota_adjuster_settings(request_type, transport: str = "grpc"): @@ -1433,7 +1449,7 @@ def test_update_quota_adjuster_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( @@ -1490,9 +1506,8 @@ def test_update_quota_adjuster_settings_non_empty_request_with_auto_populated_fi client.update_quota_adjuster_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert ( - args[0] == gac_quota_adjuster_settings.UpdateQuotaAdjusterSettingsRequest() - ) + request_msg = gac_quota_adjuster_settings.UpdateQuotaAdjusterSettingsRequest() + assert args[0] == request_msg def test_update_quota_adjuster_settings_use_cached_wrapped_rpc(): @@ -1578,9 +1593,15 @@ async def test_update_quota_adjuster_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gac_quota_adjuster_settings.UpdateQuotaAdjusterSettingsRequest(), + {}, + ], +) async def test_update_quota_adjuster_settings_async( - transport: str = "grpc_asyncio", - request_type=gac_quota_adjuster_settings.UpdateQuotaAdjusterSettingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = QuotaAdjusterSettingsManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -1589,7 +1610,7 @@ async def test_update_quota_adjuster_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( @@ -1625,11 +1646,6 @@ async def test_update_quota_adjuster_settings_async( assert response.inherited_from == "inherited_from_value" -@pytest.mark.asyncio -async def test_update_quota_adjuster_settings_async_from_dict(): - await test_update_quota_adjuster_settings_async(request_type=dict) - - def test_update_quota_adjuster_settings_field_headers(): client = QuotaAdjusterSettingsManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1802,8 +1818,8 @@ async def test_update_quota_adjuster_settings_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - quota_adjuster_settings.GetQuotaAdjusterSettingsRequest, - dict, + quota_adjuster_settings.GetQuotaAdjusterSettingsRequest(), + {}, ], ) def test_get_quota_adjuster_settings(request_type, transport: str = "grpc"): @@ -1814,7 +1830,7 @@ def test_get_quota_adjuster_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( @@ -1873,9 +1889,10 @@ def test_get_quota_adjuster_settings_non_empty_request_with_auto_populated_field client.get_quota_adjuster_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == quota_adjuster_settings.GetQuotaAdjusterSettingsRequest( + request_msg = quota_adjuster_settings.GetQuotaAdjusterSettingsRequest( name="name_value", ) + assert args[0] == request_msg def test_get_quota_adjuster_settings_use_cached_wrapped_rpc(): @@ -1961,9 +1978,15 @@ async def test_get_quota_adjuster_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + quota_adjuster_settings.GetQuotaAdjusterSettingsRequest(), + {}, + ], +) async def test_get_quota_adjuster_settings_async( - transport: str = "grpc_asyncio", - request_type=quota_adjuster_settings.GetQuotaAdjusterSettingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = QuotaAdjusterSettingsManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -1972,7 +1995,7 @@ async def test_get_quota_adjuster_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( @@ -2008,11 +2031,6 @@ async def test_get_quota_adjuster_settings_async( assert response.inherited_from == "inherited_from_value" -@pytest.mark.asyncio -async def test_get_quota_adjuster_settings_async_from_dict(): - await test_get_quota_adjuster_settings_async(request_type=dict) - - def test_get_quota_adjuster_settings_field_headers(): client = QuotaAdjusterSettingsManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2686,7 +2704,6 @@ def test_update_quota_adjuster_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gac_quota_adjuster_settings.UpdateQuotaAdjusterSettingsRequest() - assert args[0] == request_msg @@ -2709,7 +2726,6 @@ def test_get_quota_adjuster_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = quota_adjuster_settings.GetQuotaAdjusterSettingsRequest() - assert args[0] == request_msg @@ -2756,7 +2772,6 @@ async def test_update_quota_adjuster_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gac_quota_adjuster_settings.UpdateQuotaAdjusterSettingsRequest() - assert args[0] == request_msg @@ -2789,7 +2804,6 @@ async def test_get_quota_adjuster_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = quota_adjuster_settings.GetQuotaAdjusterSettingsRequest() - assert args[0] == request_msg @@ -3214,7 +3228,6 @@ def test_update_quota_adjuster_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gac_quota_adjuster_settings.UpdateQuotaAdjusterSettingsRequest() - assert args[0] == request_msg @@ -3236,7 +3249,6 @@ def test_get_quota_adjuster_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = quota_adjuster_settings.GetQuotaAdjusterSettingsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-rapidmigrationassessment/noxfile.py b/packages/google-cloud-rapidmigrationassessment/noxfile.py index a6e55b644260..7963a1ae7b82 100644 --- a/packages/google-cloud-rapidmigrationassessment/noxfile.py +++ b/packages/google-cloud-rapidmigrationassessment/noxfile.py @@ -47,7 +47,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-rapidmigrationassessment" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-rapidmigrationassessment/setup.py b/packages/google-cloud-rapidmigrationassessment/setup.py index 7f031f6a3d4e..eaac50568810 100644 --- a/packages/google-cloud-rapidmigrationassessment/setup.py +++ b/packages/google-cloud-rapidmigrationassessment/setup.py @@ -45,7 +45,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/google-cloud-rapidmigrationassessment/testing/constraints-3.10.txt b/packages/google-cloud-rapidmigrationassessment/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-rapidmigrationassessment/testing/constraints-3.10.txt +++ b/packages/google-cloud-rapidmigrationassessment/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-rapidmigrationassessment/tests/unit/gapic/rapidmigrationassessment_v1/test_rapid_migration_assessment.py b/packages/google-cloud-rapidmigrationassessment/tests/unit/gapic/rapidmigrationassessment_v1/test_rapid_migration_assessment.py index c32fd136a726..e8089320c9fb 100644 --- a/packages/google-cloud-rapidmigrationassessment/tests/unit/gapic/rapidmigrationassessment_v1/test_rapid_migration_assessment.py +++ b/packages/google-cloud-rapidmigrationassessment/tests/unit/gapic/rapidmigrationassessment_v1/test_rapid_migration_assessment.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 @@ -118,6 +119,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" @@ -1393,8 +1409,8 @@ def test_rapid_migration_assessment_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - rapidmigrationassessment.CreateCollectorRequest, - dict, + rapidmigrationassessment.CreateCollectorRequest(), + {}, ], ) def test_create_collector(request_type, transport: str = "grpc"): @@ -1405,7 +1421,7 @@ def test_create_collector(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_collector), "__call__") as call: @@ -1448,11 +1464,12 @@ def test_create_collector_non_empty_request_with_auto_populated_field(): client.create_collector(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == rapidmigrationassessment.CreateCollectorRequest( + request_msg = rapidmigrationassessment.CreateCollectorRequest( parent="parent_value", collector_id="collector_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_collector_use_cached_wrapped_rpc(): @@ -1545,10 +1562,14 @@ async def test_create_collector_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_collector_async( - transport: str = "grpc_asyncio", - request_type=rapidmigrationassessment.CreateCollectorRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + rapidmigrationassessment.CreateCollectorRequest(), + {}, + ], +) +async def test_create_collector_async(request_type, transport: str = "grpc_asyncio"): client = RapidMigrationAssessmentAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1556,7 +1577,7 @@ async def test_create_collector_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_collector), "__call__") as call: @@ -1576,11 +1597,6 @@ async def test_create_collector_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_collector_async_from_dict(): - await test_create_collector_async(request_type=dict) - - def test_create_collector_field_headers(): client = RapidMigrationAssessmentClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1747,8 +1763,8 @@ async def test_create_collector_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - rapidmigrationassessment.CreateAnnotationRequest, - dict, + rapidmigrationassessment.CreateAnnotationRequest(), + {}, ], ) def test_create_annotation(request_type, transport: str = "grpc"): @@ -1759,7 +1775,7 @@ def test_create_annotation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1805,10 +1821,11 @@ def test_create_annotation_non_empty_request_with_auto_populated_field(): client.create_annotation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == rapidmigrationassessment.CreateAnnotationRequest( + request_msg = rapidmigrationassessment.CreateAnnotationRequest( parent="parent_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_annotation_use_cached_wrapped_rpc(): @@ -1901,10 +1918,14 @@ async def test_create_annotation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_annotation_async( - transport: str = "grpc_asyncio", - request_type=rapidmigrationassessment.CreateAnnotationRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + rapidmigrationassessment.CreateAnnotationRequest(), + {}, + ], +) +async def test_create_annotation_async(request_type, transport: str = "grpc_asyncio"): client = RapidMigrationAssessmentAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1912,7 +1933,7 @@ async def test_create_annotation_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( @@ -1934,11 +1955,6 @@ async def test_create_annotation_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_annotation_async_from_dict(): - await test_create_annotation_async(request_type=dict) - - def test_create_annotation_field_headers(): client = RapidMigrationAssessmentClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2103,8 +2119,8 @@ async def test_create_annotation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - rapidmigrationassessment.GetAnnotationRequest, - dict, + rapidmigrationassessment.GetAnnotationRequest(), + {}, ], ) def test_get_annotation(request_type, transport: str = "grpc"): @@ -2115,7 +2131,7 @@ def test_get_annotation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_annotation), "__call__") as call: @@ -2161,9 +2177,10 @@ def test_get_annotation_non_empty_request_with_auto_populated_field(): client.get_annotation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == rapidmigrationassessment.GetAnnotationRequest( + request_msg = rapidmigrationassessment.GetAnnotationRequest( name="name_value", ) + assert args[0] == request_msg def test_get_annotation_use_cached_wrapped_rpc(): @@ -2244,10 +2261,14 @@ async def test_get_annotation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_annotation_async( - transport: str = "grpc_asyncio", - request_type=rapidmigrationassessment.GetAnnotationRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + rapidmigrationassessment.GetAnnotationRequest(), + {}, + ], +) +async def test_get_annotation_async(request_type, transport: str = "grpc_asyncio"): client = RapidMigrationAssessmentAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2255,7 +2276,7 @@ async def test_get_annotation_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_annotation), "__call__") as call: @@ -2280,11 +2301,6 @@ async def test_get_annotation_async( assert response.type_ == api_entities.Annotation.Type.TYPE_LEGACY_EXPORT_CONSENT -@pytest.mark.asyncio -async def test_get_annotation_async_from_dict(): - await test_get_annotation_async(request_type=dict) - - def test_get_annotation_field_headers(): client = RapidMigrationAssessmentClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2431,8 +2447,8 @@ async def test_get_annotation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - rapidmigrationassessment.ListCollectorsRequest, - dict, + rapidmigrationassessment.ListCollectorsRequest(), + {}, ], ) def test_list_collectors(request_type, transport: str = "grpc"): @@ -2443,7 +2459,7 @@ def test_list_collectors(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_collectors), "__call__") as call: @@ -2492,12 +2508,13 @@ def test_list_collectors_non_empty_request_with_auto_populated_field(): client.list_collectors(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == rapidmigrationassessment.ListCollectorsRequest( + request_msg = rapidmigrationassessment.ListCollectorsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_collectors_use_cached_wrapped_rpc(): @@ -2578,10 +2595,14 @@ async def test_list_collectors_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_collectors_async( - transport: str = "grpc_asyncio", - request_type=rapidmigrationassessment.ListCollectorsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + rapidmigrationassessment.ListCollectorsRequest(), + {}, + ], +) +async def test_list_collectors_async(request_type, transport: str = "grpc_asyncio"): client = RapidMigrationAssessmentAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2589,7 +2610,7 @@ async def test_list_collectors_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_collectors), "__call__") as call: @@ -2614,11 +2635,6 @@ async def test_list_collectors_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_collectors_async_from_dict(): - await test_list_collectors_async(request_type=dict) - - def test_list_collectors_field_headers(): client = RapidMigrationAssessmentClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2955,8 +2971,8 @@ async def test_list_collectors_async_pages(): @pytest.mark.parametrize( "request_type", [ - rapidmigrationassessment.GetCollectorRequest, - dict, + rapidmigrationassessment.GetCollectorRequest(), + {}, ], ) def test_get_collector(request_type, transport: str = "grpc"): @@ -2967,7 +2983,7 @@ def test_get_collector(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_collector), "__call__") as call: @@ -3029,9 +3045,10 @@ def test_get_collector_non_empty_request_with_auto_populated_field(): client.get_collector(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == rapidmigrationassessment.GetCollectorRequest( + request_msg = rapidmigrationassessment.GetCollectorRequest( name="name_value", ) + assert args[0] == request_msg def test_get_collector_use_cached_wrapped_rpc(): @@ -3112,10 +3129,14 @@ async def test_get_collector_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_collector_async( - transport: str = "grpc_asyncio", - request_type=rapidmigrationassessment.GetCollectorRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + rapidmigrationassessment.GetCollectorRequest(), + {}, + ], +) +async def test_get_collector_async(request_type, transport: str = "grpc_asyncio"): client = RapidMigrationAssessmentAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3123,7 +3144,7 @@ async def test_get_collector_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_collector), "__call__") as call: @@ -3164,11 +3185,6 @@ async def test_get_collector_async( assert response.eula_uri == "eula_uri_value" -@pytest.mark.asyncio -async def test_get_collector_async_from_dict(): - await test_get_collector_async(request_type=dict) - - def test_get_collector_field_headers(): client = RapidMigrationAssessmentClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3315,8 +3331,8 @@ async def test_get_collector_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - rapidmigrationassessment.UpdateCollectorRequest, - dict, + rapidmigrationassessment.UpdateCollectorRequest(), + {}, ], ) def test_update_collector(request_type, transport: str = "grpc"): @@ -3327,7 +3343,7 @@ def test_update_collector(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_collector), "__call__") as call: @@ -3368,9 +3384,10 @@ def test_update_collector_non_empty_request_with_auto_populated_field(): client.update_collector(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == rapidmigrationassessment.UpdateCollectorRequest( + request_msg = rapidmigrationassessment.UpdateCollectorRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_collector_use_cached_wrapped_rpc(): @@ -3463,10 +3480,14 @@ async def test_update_collector_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_collector_async( - transport: str = "grpc_asyncio", - request_type=rapidmigrationassessment.UpdateCollectorRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + rapidmigrationassessment.UpdateCollectorRequest(), + {}, + ], +) +async def test_update_collector_async(request_type, transport: str = "grpc_asyncio"): client = RapidMigrationAssessmentAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3474,7 +3495,7 @@ async def test_update_collector_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_collector), "__call__") as call: @@ -3494,11 +3515,6 @@ async def test_update_collector_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_collector_async_from_dict(): - await test_update_collector_async(request_type=dict) - - def test_update_collector_field_headers(): client = RapidMigrationAssessmentClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3655,8 +3671,8 @@ async def test_update_collector_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - rapidmigrationassessment.DeleteCollectorRequest, - dict, + rapidmigrationassessment.DeleteCollectorRequest(), + {}, ], ) def test_delete_collector(request_type, transport: str = "grpc"): @@ -3667,7 +3683,7 @@ def test_delete_collector(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_collector), "__call__") as call: @@ -3709,10 +3725,11 @@ def test_delete_collector_non_empty_request_with_auto_populated_field(): client.delete_collector(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == rapidmigrationassessment.DeleteCollectorRequest( + request_msg = rapidmigrationassessment.DeleteCollectorRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_collector_use_cached_wrapped_rpc(): @@ -3805,10 +3822,14 @@ async def test_delete_collector_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_collector_async( - transport: str = "grpc_asyncio", - request_type=rapidmigrationassessment.DeleteCollectorRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + rapidmigrationassessment.DeleteCollectorRequest(), + {}, + ], +) +async def test_delete_collector_async(request_type, transport: str = "grpc_asyncio"): client = RapidMigrationAssessmentAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3816,7 +3837,7 @@ async def test_delete_collector_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_collector), "__call__") as call: @@ -3836,11 +3857,6 @@ async def test_delete_collector_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_collector_async_from_dict(): - await test_delete_collector_async(request_type=dict) - - def test_delete_collector_field_headers(): client = RapidMigrationAssessmentClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3987,8 +4003,8 @@ async def test_delete_collector_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - rapidmigrationassessment.ResumeCollectorRequest, - dict, + rapidmigrationassessment.ResumeCollectorRequest(), + {}, ], ) def test_resume_collector(request_type, transport: str = "grpc"): @@ -3999,7 +4015,7 @@ def test_resume_collector(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.resume_collector), "__call__") as call: @@ -4041,10 +4057,11 @@ def test_resume_collector_non_empty_request_with_auto_populated_field(): client.resume_collector(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == rapidmigrationassessment.ResumeCollectorRequest( + request_msg = rapidmigrationassessment.ResumeCollectorRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_resume_collector_use_cached_wrapped_rpc(): @@ -4137,10 +4154,14 @@ async def test_resume_collector_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_resume_collector_async( - transport: str = "grpc_asyncio", - request_type=rapidmigrationassessment.ResumeCollectorRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + rapidmigrationassessment.ResumeCollectorRequest(), + {}, + ], +) +async def test_resume_collector_async(request_type, transport: str = "grpc_asyncio"): client = RapidMigrationAssessmentAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4148,7 +4169,7 @@ async def test_resume_collector_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.resume_collector), "__call__") as call: @@ -4168,11 +4189,6 @@ async def test_resume_collector_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_resume_collector_async_from_dict(): - await test_resume_collector_async(request_type=dict) - - def test_resume_collector_field_headers(): client = RapidMigrationAssessmentClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4319,8 +4335,8 @@ async def test_resume_collector_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - rapidmigrationassessment.RegisterCollectorRequest, - dict, + rapidmigrationassessment.RegisterCollectorRequest(), + {}, ], ) def test_register_collector(request_type, transport: str = "grpc"): @@ -4331,7 +4347,7 @@ def test_register_collector(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4377,10 +4393,11 @@ def test_register_collector_non_empty_request_with_auto_populated_field(): client.register_collector(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == rapidmigrationassessment.RegisterCollectorRequest( + request_msg = rapidmigrationassessment.RegisterCollectorRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_register_collector_use_cached_wrapped_rpc(): @@ -4475,10 +4492,14 @@ async def test_register_collector_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_register_collector_async( - transport: str = "grpc_asyncio", - request_type=rapidmigrationassessment.RegisterCollectorRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + rapidmigrationassessment.RegisterCollectorRequest(), + {}, + ], +) +async def test_register_collector_async(request_type, transport: str = "grpc_asyncio"): client = RapidMigrationAssessmentAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4486,7 +4507,7 @@ async def test_register_collector_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( @@ -4508,11 +4529,6 @@ async def test_register_collector_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_register_collector_async_from_dict(): - await test_register_collector_async(request_type=dict) - - def test_register_collector_field_headers(): client = RapidMigrationAssessmentClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4667,8 +4683,8 @@ async def test_register_collector_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - rapidmigrationassessment.PauseCollectorRequest, - dict, + rapidmigrationassessment.PauseCollectorRequest(), + {}, ], ) def test_pause_collector(request_type, transport: str = "grpc"): @@ -4679,7 +4695,7 @@ def test_pause_collector(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.pause_collector), "__call__") as call: @@ -4721,10 +4737,11 @@ def test_pause_collector_non_empty_request_with_auto_populated_field(): client.pause_collector(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == rapidmigrationassessment.PauseCollectorRequest( + request_msg = rapidmigrationassessment.PauseCollectorRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_pause_collector_use_cached_wrapped_rpc(): @@ -4815,10 +4832,14 @@ async def test_pause_collector_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_pause_collector_async( - transport: str = "grpc_asyncio", - request_type=rapidmigrationassessment.PauseCollectorRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + rapidmigrationassessment.PauseCollectorRequest(), + {}, + ], +) +async def test_pause_collector_async(request_type, transport: str = "grpc_asyncio"): client = RapidMigrationAssessmentAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4826,7 +4847,7 @@ async def test_pause_collector_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.pause_collector), "__call__") as call: @@ -4846,11 +4867,6 @@ async def test_pause_collector_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_pause_collector_async_from_dict(): - await test_pause_collector_async(request_type=dict) - - def test_pause_collector_field_headers(): client = RapidMigrationAssessmentClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7075,7 +7091,6 @@ def test_create_collector_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rapidmigrationassessment.CreateCollectorRequest() - assert args[0] == request_msg @@ -7098,7 +7113,6 @@ def test_create_annotation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rapidmigrationassessment.CreateAnnotationRequest() - assert args[0] == request_msg @@ -7119,7 +7133,6 @@ def test_get_annotation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rapidmigrationassessment.GetAnnotationRequest() - assert args[0] == request_msg @@ -7140,7 +7153,6 @@ def test_list_collectors_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rapidmigrationassessment.ListCollectorsRequest() - assert args[0] == request_msg @@ -7161,7 +7173,6 @@ def test_get_collector_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rapidmigrationassessment.GetCollectorRequest() - assert args[0] == request_msg @@ -7182,7 +7193,6 @@ def test_update_collector_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rapidmigrationassessment.UpdateCollectorRequest() - assert args[0] == request_msg @@ -7203,7 +7213,6 @@ def test_delete_collector_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rapidmigrationassessment.DeleteCollectorRequest() - assert args[0] == request_msg @@ -7224,7 +7233,6 @@ def test_resume_collector_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rapidmigrationassessment.ResumeCollectorRequest() - assert args[0] == request_msg @@ -7247,7 +7255,6 @@ def test_register_collector_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rapidmigrationassessment.RegisterCollectorRequest() - assert args[0] == request_msg @@ -7268,7 +7275,6 @@ def test_pause_collector_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rapidmigrationassessment.PauseCollectorRequest() - assert args[0] == request_msg @@ -7307,7 +7313,6 @@ async def test_create_collector_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rapidmigrationassessment.CreateCollectorRequest() - assert args[0] == request_msg @@ -7334,7 +7339,6 @@ async def test_create_annotation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rapidmigrationassessment.CreateAnnotationRequest() - assert args[0] == request_msg @@ -7362,7 +7366,6 @@ async def test_get_annotation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rapidmigrationassessment.GetAnnotationRequest() - assert args[0] == request_msg @@ -7390,7 +7393,6 @@ async def test_list_collectors_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rapidmigrationassessment.ListCollectorsRequest() - assert args[0] == request_msg @@ -7426,7 +7428,6 @@ async def test_get_collector_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rapidmigrationassessment.GetCollectorRequest() - assert args[0] == request_msg @@ -7451,7 +7452,6 @@ async def test_update_collector_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rapidmigrationassessment.UpdateCollectorRequest() - assert args[0] == request_msg @@ -7476,7 +7476,6 @@ async def test_delete_collector_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rapidmigrationassessment.DeleteCollectorRequest() - assert args[0] == request_msg @@ -7501,7 +7500,6 @@ async def test_resume_collector_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rapidmigrationassessment.ResumeCollectorRequest() - assert args[0] == request_msg @@ -7528,7 +7526,6 @@ async def test_register_collector_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rapidmigrationassessment.RegisterCollectorRequest() - assert args[0] == request_msg @@ -7553,7 +7550,6 @@ async def test_pause_collector_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rapidmigrationassessment.PauseCollectorRequest() - assert args[0] == request_msg @@ -9516,7 +9512,6 @@ def test_create_collector_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rapidmigrationassessment.CreateCollectorRequest() - assert args[0] == request_msg @@ -9538,7 +9533,6 @@ def test_create_annotation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rapidmigrationassessment.CreateAnnotationRequest() - assert args[0] == request_msg @@ -9558,7 +9552,6 @@ def test_get_annotation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rapidmigrationassessment.GetAnnotationRequest() - assert args[0] == request_msg @@ -9578,7 +9571,6 @@ def test_list_collectors_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rapidmigrationassessment.ListCollectorsRequest() - assert args[0] == request_msg @@ -9598,7 +9590,6 @@ def test_get_collector_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rapidmigrationassessment.GetCollectorRequest() - assert args[0] == request_msg @@ -9618,7 +9609,6 @@ def test_update_collector_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rapidmigrationassessment.UpdateCollectorRequest() - assert args[0] == request_msg @@ -9638,7 +9628,6 @@ def test_delete_collector_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rapidmigrationassessment.DeleteCollectorRequest() - assert args[0] == request_msg @@ -9658,7 +9647,6 @@ def test_resume_collector_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rapidmigrationassessment.ResumeCollectorRequest() - assert args[0] == request_msg @@ -9680,7 +9668,6 @@ def test_register_collector_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rapidmigrationassessment.RegisterCollectorRequest() - assert args[0] == request_msg @@ -9700,7 +9687,6 @@ def test_pause_collector_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rapidmigrationassessment.PauseCollectorRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-recaptcha-enterprise/noxfile.py b/packages/google-cloud-recaptcha-enterprise/noxfile.py index c8cf67493770..cc7f5fec5d0c 100644 --- a/packages/google-cloud-recaptcha-enterprise/noxfile.py +++ b/packages/google-cloud-recaptcha-enterprise/noxfile.py @@ -47,7 +47,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-recaptcha-enterprise" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-recaptcha-enterprise/setup.py b/packages/google-cloud-recaptcha-enterprise/setup.py index c196d054b9bf..8c7c85c164f7 100644 --- a/packages/google-cloud-recaptcha-enterprise/setup.py +++ b/packages/google-cloud-recaptcha-enterprise/setup.py @@ -45,7 +45,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/google-cloud-recaptcha-enterprise/testing/constraints-3.10.txt b/packages/google-cloud-recaptcha-enterprise/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-recaptcha-enterprise/testing/constraints-3.10.txt +++ b/packages/google-cloud-recaptcha-enterprise/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-recaptcha-enterprise/tests/unit/gapic/recaptchaenterprise_v1/test_recaptcha_enterprise_service.py b/packages/google-cloud-recaptcha-enterprise/tests/unit/gapic/recaptchaenterprise_v1/test_recaptcha_enterprise_service.py index 11eed48613fc..59988393300f 100644 --- a/packages/google-cloud-recaptcha-enterprise/tests/unit/gapic/recaptchaenterprise_v1/test_recaptcha_enterprise_service.py +++ b/packages/google-cloud-recaptcha-enterprise/tests/unit/gapic/recaptchaenterprise_v1/test_recaptcha_enterprise_service.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 @@ -108,6 +109,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" @@ -1362,8 +1378,8 @@ def test_recaptcha_enterprise_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - recaptchaenterprise.CreateAssessmentRequest, - dict, + recaptchaenterprise.CreateAssessmentRequest(), + {}, ], ) def test_create_assessment(request_type, transport: str = "grpc"): @@ -1374,7 +1390,7 @@ def test_create_assessment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1422,9 +1438,10 @@ def test_create_assessment_non_empty_request_with_auto_populated_field(): client.create_assessment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == recaptchaenterprise.CreateAssessmentRequest( + request_msg = recaptchaenterprise.CreateAssessmentRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_assessment_use_cached_wrapped_rpc(): @@ -1507,10 +1524,14 @@ async def test_create_assessment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_assessment_async( - transport: str = "grpc_asyncio", - request_type=recaptchaenterprise.CreateAssessmentRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + recaptchaenterprise.CreateAssessmentRequest(), + {}, + ], +) +async def test_create_assessment_async(request_type, transport: str = "grpc_asyncio"): client = RecaptchaEnterpriseServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1518,7 +1539,7 @@ async def test_create_assessment_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( @@ -1543,11 +1564,6 @@ async def test_create_assessment_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_create_assessment_async_from_dict(): - await test_create_assessment_async(request_type=dict) - - def test_create_assessment_field_headers(): client = RecaptchaEnterpriseServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1712,8 +1728,8 @@ async def test_create_assessment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - recaptchaenterprise.AnnotateAssessmentRequest, - dict, + recaptchaenterprise.AnnotateAssessmentRequest(), + {}, ], ) def test_annotate_assessment(request_type, transport: str = "grpc"): @@ -1724,7 +1740,7 @@ def test_annotate_assessment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1770,10 +1786,11 @@ def test_annotate_assessment_non_empty_request_with_auto_populated_field(): client.annotate_assessment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == recaptchaenterprise.AnnotateAssessmentRequest( + request_msg = recaptchaenterprise.AnnotateAssessmentRequest( name="name_value", account_id="account_id_value", ) + assert args[0] == request_msg def test_annotate_assessment_use_cached_wrapped_rpc(): @@ -1858,10 +1875,14 @@ async def test_annotate_assessment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_annotate_assessment_async( - transport: str = "grpc_asyncio", - request_type=recaptchaenterprise.AnnotateAssessmentRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + recaptchaenterprise.AnnotateAssessmentRequest(), + {}, + ], +) +async def test_annotate_assessment_async(request_type, transport: str = "grpc_asyncio"): client = RecaptchaEnterpriseServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1869,7 +1890,7 @@ async def test_annotate_assessment_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( @@ -1891,11 +1912,6 @@ async def test_annotate_assessment_async( assert isinstance(response, recaptchaenterprise.AnnotateAssessmentResponse) -@pytest.mark.asyncio -async def test_annotate_assessment_async_from_dict(): - await test_annotate_assessment_async(request_type=dict) - - def test_annotate_assessment_field_headers(): client = RecaptchaEnterpriseServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2060,8 +2076,8 @@ async def test_annotate_assessment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - recaptchaenterprise.CreateKeyRequest, - dict, + recaptchaenterprise.CreateKeyRequest(), + {}, ], ) def test_create_key(request_type, transport: str = "grpc"): @@ -2072,7 +2088,7 @@ def test_create_key(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_key), "__call__") as call: @@ -2118,9 +2134,10 @@ def test_create_key_non_empty_request_with_auto_populated_field(): client.create_key(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == recaptchaenterprise.CreateKeyRequest( + request_msg = recaptchaenterprise.CreateKeyRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_key_use_cached_wrapped_rpc(): @@ -2199,9 +2216,14 @@ async def test_create_key_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_create_key_async( - transport: str = "grpc_asyncio", request_type=recaptchaenterprise.CreateKeyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + recaptchaenterprise.CreateKeyRequest(), + {}, + ], +) +async def test_create_key_async(request_type, transport: str = "grpc_asyncio"): client = RecaptchaEnterpriseServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2209,7 +2231,7 @@ async def test_create_key_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_key), "__call__") as call: @@ -2234,11 +2256,6 @@ async def test_create_key_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_create_key_async_from_dict(): - await test_create_key_async(request_type=dict) - - def test_create_key_field_headers(): client = RecaptchaEnterpriseServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2395,8 +2412,8 @@ async def test_create_key_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - recaptchaenterprise.ListKeysRequest, - dict, + recaptchaenterprise.ListKeysRequest(), + {}, ], ) def test_list_keys(request_type, transport: str = "grpc"): @@ -2407,7 +2424,7 @@ def test_list_keys(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_keys), "__call__") as call: @@ -2452,10 +2469,11 @@ def test_list_keys_non_empty_request_with_auto_populated_field(): client.list_keys(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == recaptchaenterprise.ListKeysRequest( + request_msg = recaptchaenterprise.ListKeysRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_keys_use_cached_wrapped_rpc(): @@ -2534,9 +2552,14 @@ async def test_list_keys_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_list_keys_async( - transport: str = "grpc_asyncio", request_type=recaptchaenterprise.ListKeysRequest -): +@pytest.mark.parametrize( + "request_type", + [ + recaptchaenterprise.ListKeysRequest(), + {}, + ], +) +async def test_list_keys_async(request_type, transport: str = "grpc_asyncio"): client = RecaptchaEnterpriseServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2544,7 +2567,7 @@ async def test_list_keys_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_keys), "__call__") as call: @@ -2567,11 +2590,6 @@ async def test_list_keys_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_keys_async_from_dict(): - await test_list_keys_async(request_type=dict) - - def test_list_keys_field_headers(): client = RecaptchaEnterpriseServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2908,8 +2926,8 @@ async def test_list_keys_async_pages(): @pytest.mark.parametrize( "request_type", [ - recaptchaenterprise.RetrieveLegacySecretKeyRequest, - dict, + recaptchaenterprise.RetrieveLegacySecretKeyRequest(), + {}, ], ) def test_retrieve_legacy_secret_key(request_type, transport: str = "grpc"): @@ -2920,7 +2938,7 @@ def test_retrieve_legacy_secret_key(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2968,9 +2986,10 @@ def test_retrieve_legacy_secret_key_non_empty_request_with_auto_populated_field( client.retrieve_legacy_secret_key(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == recaptchaenterprise.RetrieveLegacySecretKeyRequest( + request_msg = recaptchaenterprise.RetrieveLegacySecretKeyRequest( key="key_value", ) + assert args[0] == request_msg def test_retrieve_legacy_secret_key_use_cached_wrapped_rpc(): @@ -3056,9 +3075,15 @@ async def test_retrieve_legacy_secret_key_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + recaptchaenterprise.RetrieveLegacySecretKeyRequest(), + {}, + ], +) async def test_retrieve_legacy_secret_key_async( - transport: str = "grpc_asyncio", - request_type=recaptchaenterprise.RetrieveLegacySecretKeyRequest, + request_type, transport: str = "grpc_asyncio" ): client = RecaptchaEnterpriseServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3067,7 +3092,7 @@ async def test_retrieve_legacy_secret_key_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( @@ -3092,11 +3117,6 @@ async def test_retrieve_legacy_secret_key_async( assert response.legacy_secret_key == "legacy_secret_key_value" -@pytest.mark.asyncio -async def test_retrieve_legacy_secret_key_async_from_dict(): - await test_retrieve_legacy_secret_key_async(request_type=dict) - - def test_retrieve_legacy_secret_key_field_headers(): client = RecaptchaEnterpriseServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3251,8 +3271,8 @@ async def test_retrieve_legacy_secret_key_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - recaptchaenterprise.GetKeyRequest, - dict, + recaptchaenterprise.GetKeyRequest(), + {}, ], ) def test_get_key(request_type, transport: str = "grpc"): @@ -3263,7 +3283,7 @@ def test_get_key(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_key), "__call__") as call: @@ -3309,9 +3329,10 @@ def test_get_key_non_empty_request_with_auto_populated_field(): client.get_key(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == recaptchaenterprise.GetKeyRequest( + request_msg = recaptchaenterprise.GetKeyRequest( name="name_value", ) + assert args[0] == request_msg def test_get_key_use_cached_wrapped_rpc(): @@ -3390,9 +3411,14 @@ async def test_get_key_async_use_cached_wrapped_rpc(transport: str = "grpc_async @pytest.mark.asyncio -async def test_get_key_async( - transport: str = "grpc_asyncio", request_type=recaptchaenterprise.GetKeyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + recaptchaenterprise.GetKeyRequest(), + {}, + ], +) +async def test_get_key_async(request_type, transport: str = "grpc_asyncio"): client = RecaptchaEnterpriseServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3400,7 +3426,7 @@ async def test_get_key_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_key), "__call__") as call: @@ -3425,11 +3451,6 @@ async def test_get_key_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_get_key_async_from_dict(): - await test_get_key_async(request_type=dict) - - def test_get_key_field_headers(): client = RecaptchaEnterpriseServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3576,8 +3597,8 @@ async def test_get_key_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - recaptchaenterprise.UpdateKeyRequest, - dict, + recaptchaenterprise.UpdateKeyRequest(), + {}, ], ) def test_update_key(request_type, transport: str = "grpc"): @@ -3588,7 +3609,7 @@ def test_update_key(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_key), "__call__") as call: @@ -3632,7 +3653,8 @@ def test_update_key_non_empty_request_with_auto_populated_field(): client.update_key(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == recaptchaenterprise.UpdateKeyRequest() + request_msg = recaptchaenterprise.UpdateKeyRequest() + assert args[0] == request_msg def test_update_key_use_cached_wrapped_rpc(): @@ -3711,9 +3733,14 @@ async def test_update_key_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_update_key_async( - transport: str = "grpc_asyncio", request_type=recaptchaenterprise.UpdateKeyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + recaptchaenterprise.UpdateKeyRequest(), + {}, + ], +) +async def test_update_key_async(request_type, transport: str = "grpc_asyncio"): client = RecaptchaEnterpriseServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3721,7 +3748,7 @@ async def test_update_key_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_key), "__call__") as call: @@ -3746,11 +3773,6 @@ async def test_update_key_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_update_key_async_from_dict(): - await test_update_key_async(request_type=dict) - - def test_update_key_field_headers(): client = RecaptchaEnterpriseServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3907,8 +3929,8 @@ async def test_update_key_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - recaptchaenterprise.DeleteKeyRequest, - dict, + recaptchaenterprise.DeleteKeyRequest(), + {}, ], ) def test_delete_key(request_type, transport: str = "grpc"): @@ -3919,7 +3941,7 @@ def test_delete_key(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_key), "__call__") as call: @@ -3960,9 +3982,10 @@ def test_delete_key_non_empty_request_with_auto_populated_field(): client.delete_key(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == recaptchaenterprise.DeleteKeyRequest( + request_msg = recaptchaenterprise.DeleteKeyRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_key_use_cached_wrapped_rpc(): @@ -4041,9 +4064,14 @@ async def test_delete_key_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_delete_key_async( - transport: str = "grpc_asyncio", request_type=recaptchaenterprise.DeleteKeyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + recaptchaenterprise.DeleteKeyRequest(), + {}, + ], +) +async def test_delete_key_async(request_type, transport: str = "grpc_asyncio"): client = RecaptchaEnterpriseServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4051,7 +4079,7 @@ async def test_delete_key_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_key), "__call__") as call: @@ -4069,11 +4097,6 @@ async def test_delete_key_async( assert response is None -@pytest.mark.asyncio -async def test_delete_key_async_from_dict(): - await test_delete_key_async(request_type=dict) - - def test_delete_key_field_headers(): client = RecaptchaEnterpriseServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4216,8 +4239,8 @@ async def test_delete_key_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - recaptchaenterprise.MigrateKeyRequest, - dict, + recaptchaenterprise.MigrateKeyRequest(), + {}, ], ) def test_migrate_key(request_type, transport: str = "grpc"): @@ -4228,7 +4251,7 @@ def test_migrate_key(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.migrate_key), "__call__") as call: @@ -4274,9 +4297,10 @@ def test_migrate_key_non_empty_request_with_auto_populated_field(): client.migrate_key(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == recaptchaenterprise.MigrateKeyRequest( + request_msg = recaptchaenterprise.MigrateKeyRequest( name="name_value", ) + assert args[0] == request_msg def test_migrate_key_use_cached_wrapped_rpc(): @@ -4357,9 +4381,14 @@ async def test_migrate_key_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_migrate_key_async( - transport: str = "grpc_asyncio", request_type=recaptchaenterprise.MigrateKeyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + recaptchaenterprise.MigrateKeyRequest(), + {}, + ], +) +async def test_migrate_key_async(request_type, transport: str = "grpc_asyncio"): client = RecaptchaEnterpriseServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4367,7 +4396,7 @@ async def test_migrate_key_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.migrate_key), "__call__") as call: @@ -4392,11 +4421,6 @@ async def test_migrate_key_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_migrate_key_async_from_dict(): - await test_migrate_key_async(request_type=dict) - - def test_migrate_key_field_headers(): client = RecaptchaEnterpriseServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4461,8 +4485,8 @@ async def test_migrate_key_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - recaptchaenterprise.AddIpOverrideRequest, - dict, + recaptchaenterprise.AddIpOverrideRequest(), + {}, ], ) def test_add_ip_override(request_type, transport: str = "grpc"): @@ -4473,7 +4497,7 @@ def test_add_ip_override(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.add_ip_override), "__call__") as call: @@ -4514,9 +4538,10 @@ def test_add_ip_override_non_empty_request_with_auto_populated_field(): client.add_ip_override(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == recaptchaenterprise.AddIpOverrideRequest( + request_msg = recaptchaenterprise.AddIpOverrideRequest( name="name_value", ) + assert args[0] == request_msg def test_add_ip_override_use_cached_wrapped_rpc(): @@ -4597,10 +4622,14 @@ async def test_add_ip_override_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_add_ip_override_async( - transport: str = "grpc_asyncio", - request_type=recaptchaenterprise.AddIpOverrideRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + recaptchaenterprise.AddIpOverrideRequest(), + {}, + ], +) +async def test_add_ip_override_async(request_type, transport: str = "grpc_asyncio"): client = RecaptchaEnterpriseServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4608,7 +4637,7 @@ async def test_add_ip_override_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.add_ip_override), "__call__") as call: @@ -4628,11 +4657,6 @@ async def test_add_ip_override_async( assert isinstance(response, recaptchaenterprise.AddIpOverrideResponse) -@pytest.mark.asyncio -async def test_add_ip_override_async_from_dict(): - await test_add_ip_override_async(request_type=dict) - - def test_add_ip_override_field_headers(): client = RecaptchaEnterpriseServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4789,8 +4813,8 @@ async def test_add_ip_override_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - recaptchaenterprise.RemoveIpOverrideRequest, - dict, + recaptchaenterprise.RemoveIpOverrideRequest(), + {}, ], ) def test_remove_ip_override(request_type, transport: str = "grpc"): @@ -4801,7 +4825,7 @@ def test_remove_ip_override(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4846,9 +4870,10 @@ def test_remove_ip_override_non_empty_request_with_auto_populated_field(): client.remove_ip_override(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == recaptchaenterprise.RemoveIpOverrideRequest( + request_msg = recaptchaenterprise.RemoveIpOverrideRequest( name="name_value", ) + assert args[0] == request_msg def test_remove_ip_override_use_cached_wrapped_rpc(): @@ -4933,10 +4958,14 @@ async def test_remove_ip_override_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_remove_ip_override_async( - transport: str = "grpc_asyncio", - request_type=recaptchaenterprise.RemoveIpOverrideRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + recaptchaenterprise.RemoveIpOverrideRequest(), + {}, + ], +) +async def test_remove_ip_override_async(request_type, transport: str = "grpc_asyncio"): client = RecaptchaEnterpriseServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4944,7 +4973,7 @@ async def test_remove_ip_override_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( @@ -4966,11 +4995,6 @@ async def test_remove_ip_override_async( assert isinstance(response, recaptchaenterprise.RemoveIpOverrideResponse) -@pytest.mark.asyncio -async def test_remove_ip_override_async_from_dict(): - await test_remove_ip_override_async(request_type=dict) - - def test_remove_ip_override_field_headers(): client = RecaptchaEnterpriseServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5135,8 +5159,8 @@ async def test_remove_ip_override_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - recaptchaenterprise.ListIpOverridesRequest, - dict, + recaptchaenterprise.ListIpOverridesRequest(), + {}, ], ) def test_list_ip_overrides(request_type, transport: str = "grpc"): @@ -5147,7 +5171,7 @@ def test_list_ip_overrides(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5196,10 +5220,11 @@ def test_list_ip_overrides_non_empty_request_with_auto_populated_field(): client.list_ip_overrides(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == recaptchaenterprise.ListIpOverridesRequest( + request_msg = recaptchaenterprise.ListIpOverridesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_ip_overrides_use_cached_wrapped_rpc(): @@ -5282,10 +5307,14 @@ async def test_list_ip_overrides_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_ip_overrides_async( - transport: str = "grpc_asyncio", - request_type=recaptchaenterprise.ListIpOverridesRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + recaptchaenterprise.ListIpOverridesRequest(), + {}, + ], +) +async def test_list_ip_overrides_async(request_type, transport: str = "grpc_asyncio"): client = RecaptchaEnterpriseServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5293,7 +5322,7 @@ async def test_list_ip_overrides_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( @@ -5318,11 +5347,6 @@ async def test_list_ip_overrides_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_ip_overrides_async_from_dict(): - await test_list_ip_overrides_async(request_type=dict) - - def test_list_ip_overrides_field_headers(): client = RecaptchaEnterpriseServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5675,8 +5699,8 @@ async def test_list_ip_overrides_async_pages(): @pytest.mark.parametrize( "request_type", [ - recaptchaenterprise.GetMetricsRequest, - dict, + recaptchaenterprise.GetMetricsRequest(), + {}, ], ) def test_get_metrics(request_type, transport: str = "grpc"): @@ -5687,7 +5711,7 @@ def test_get_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.get_metrics), "__call__") as call: @@ -5731,9 +5755,10 @@ def test_get_metrics_non_empty_request_with_auto_populated_field(): client.get_metrics(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == recaptchaenterprise.GetMetricsRequest( + request_msg = recaptchaenterprise.GetMetricsRequest( name="name_value", ) + assert args[0] == request_msg def test_get_metrics_use_cached_wrapped_rpc(): @@ -5814,9 +5839,14 @@ async def test_get_metrics_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_metrics_async( - transport: str = "grpc_asyncio", request_type=recaptchaenterprise.GetMetricsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + recaptchaenterprise.GetMetricsRequest(), + {}, + ], +) +async def test_get_metrics_async(request_type, transport: str = "grpc_asyncio"): client = RecaptchaEnterpriseServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5824,7 +5854,7 @@ async def test_get_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.get_metrics), "__call__") as call: @@ -5847,11 +5877,6 @@ async def test_get_metrics_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_metrics_async_from_dict(): - await test_get_metrics_async(request_type=dict) - - def test_get_metrics_field_headers(): client = RecaptchaEnterpriseServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5998,8 +6023,8 @@ async def test_get_metrics_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - recaptchaenterprise.CreateFirewallPolicyRequest, - dict, + recaptchaenterprise.CreateFirewallPolicyRequest(), + {}, ], ) def test_create_firewall_policy(request_type, transport: str = "grpc"): @@ -6010,7 +6035,7 @@ def test_create_firewall_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( @@ -6064,9 +6089,10 @@ def test_create_firewall_policy_non_empty_request_with_auto_populated_field(): client.create_firewall_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == recaptchaenterprise.CreateFirewallPolicyRequest( + request_msg = recaptchaenterprise.CreateFirewallPolicyRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_firewall_policy_use_cached_wrapped_rpc(): @@ -6152,9 +6178,15 @@ async def test_create_firewall_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + recaptchaenterprise.CreateFirewallPolicyRequest(), + {}, + ], +) async def test_create_firewall_policy_async( - transport: str = "grpc_asyncio", - request_type=recaptchaenterprise.CreateFirewallPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = RecaptchaEnterpriseServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -6163,7 +6195,7 @@ async def test_create_firewall_policy_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( @@ -6194,11 +6226,6 @@ async def test_create_firewall_policy_async( assert response.condition == "condition_value" -@pytest.mark.asyncio -async def test_create_firewall_policy_async_from_dict(): - await test_create_firewall_policy_async(request_type=dict) - - def test_create_firewall_policy_field_headers(): client = RecaptchaEnterpriseServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6363,8 +6390,8 @@ async def test_create_firewall_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - recaptchaenterprise.ListFirewallPoliciesRequest, - dict, + recaptchaenterprise.ListFirewallPoliciesRequest(), + {}, ], ) def test_list_firewall_policies(request_type, transport: str = "grpc"): @@ -6375,7 +6402,7 @@ def test_list_firewall_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( @@ -6424,10 +6451,11 @@ def test_list_firewall_policies_non_empty_request_with_auto_populated_field(): client.list_firewall_policies(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == recaptchaenterprise.ListFirewallPoliciesRequest( + request_msg = recaptchaenterprise.ListFirewallPoliciesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_firewall_policies_use_cached_wrapped_rpc(): @@ -6513,9 +6541,15 @@ async def test_list_firewall_policies_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + recaptchaenterprise.ListFirewallPoliciesRequest(), + {}, + ], +) async def test_list_firewall_policies_async( - transport: str = "grpc_asyncio", - request_type=recaptchaenterprise.ListFirewallPoliciesRequest, + request_type, transport: str = "grpc_asyncio" ): client = RecaptchaEnterpriseServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -6524,7 +6558,7 @@ async def test_list_firewall_policies_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( @@ -6549,11 +6583,6 @@ async def test_list_firewall_policies_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_firewall_policies_async_from_dict(): - await test_list_firewall_policies_async(request_type=dict) - - def test_list_firewall_policies_field_headers(): client = RecaptchaEnterpriseServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6906,8 +6935,8 @@ async def test_list_firewall_policies_async_pages(): @pytest.mark.parametrize( "request_type", [ - recaptchaenterprise.GetFirewallPolicyRequest, - dict, + recaptchaenterprise.GetFirewallPolicyRequest(), + {}, ], ) def test_get_firewall_policy(request_type, transport: str = "grpc"): @@ -6918,7 +6947,7 @@ def test_get_firewall_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( @@ -6972,9 +7001,10 @@ def test_get_firewall_policy_non_empty_request_with_auto_populated_field(): client.get_firewall_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == recaptchaenterprise.GetFirewallPolicyRequest( + request_msg = recaptchaenterprise.GetFirewallPolicyRequest( name="name_value", ) + assert args[0] == request_msg def test_get_firewall_policy_use_cached_wrapped_rpc(): @@ -7059,10 +7089,14 @@ async def test_get_firewall_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_firewall_policy_async( - transport: str = "grpc_asyncio", - request_type=recaptchaenterprise.GetFirewallPolicyRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + recaptchaenterprise.GetFirewallPolicyRequest(), + {}, + ], +) +async def test_get_firewall_policy_async(request_type, transport: str = "grpc_asyncio"): client = RecaptchaEnterpriseServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7070,7 +7104,7 @@ async def test_get_firewall_policy_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( @@ -7101,11 +7135,6 @@ async def test_get_firewall_policy_async( assert response.condition == "condition_value" -@pytest.mark.asyncio -async def test_get_firewall_policy_async_from_dict(): - await test_get_firewall_policy_async(request_type=dict) - - def test_get_firewall_policy_field_headers(): client = RecaptchaEnterpriseServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7260,8 +7289,8 @@ async def test_get_firewall_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - recaptchaenterprise.UpdateFirewallPolicyRequest, - dict, + recaptchaenterprise.UpdateFirewallPolicyRequest(), + {}, ], ) def test_update_firewall_policy(request_type, transport: str = "grpc"): @@ -7272,7 +7301,7 @@ def test_update_firewall_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( @@ -7324,7 +7353,8 @@ def test_update_firewall_policy_non_empty_request_with_auto_populated_field(): client.update_firewall_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == recaptchaenterprise.UpdateFirewallPolicyRequest() + request_msg = recaptchaenterprise.UpdateFirewallPolicyRequest() + assert args[0] == request_msg def test_update_firewall_policy_use_cached_wrapped_rpc(): @@ -7410,9 +7440,15 @@ async def test_update_firewall_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + recaptchaenterprise.UpdateFirewallPolicyRequest(), + {}, + ], +) async def test_update_firewall_policy_async( - transport: str = "grpc_asyncio", - request_type=recaptchaenterprise.UpdateFirewallPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = RecaptchaEnterpriseServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -7421,7 +7457,7 @@ async def test_update_firewall_policy_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( @@ -7452,11 +7488,6 @@ async def test_update_firewall_policy_async( assert response.condition == "condition_value" -@pytest.mark.asyncio -async def test_update_firewall_policy_async_from_dict(): - await test_update_firewall_policy_async(request_type=dict) - - def test_update_firewall_policy_field_headers(): client = RecaptchaEnterpriseServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7621,8 +7652,8 @@ async def test_update_firewall_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - recaptchaenterprise.DeleteFirewallPolicyRequest, - dict, + recaptchaenterprise.DeleteFirewallPolicyRequest(), + {}, ], ) def test_delete_firewall_policy(request_type, transport: str = "grpc"): @@ -7633,7 +7664,7 @@ def test_delete_firewall_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( @@ -7678,9 +7709,10 @@ def test_delete_firewall_policy_non_empty_request_with_auto_populated_field(): client.delete_firewall_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == recaptchaenterprise.DeleteFirewallPolicyRequest( + request_msg = recaptchaenterprise.DeleteFirewallPolicyRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_firewall_policy_use_cached_wrapped_rpc(): @@ -7766,9 +7798,15 @@ async def test_delete_firewall_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + recaptchaenterprise.DeleteFirewallPolicyRequest(), + {}, + ], +) async def test_delete_firewall_policy_async( - transport: str = "grpc_asyncio", - request_type=recaptchaenterprise.DeleteFirewallPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = RecaptchaEnterpriseServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -7777,7 +7815,7 @@ async def test_delete_firewall_policy_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( @@ -7797,11 +7835,6 @@ async def test_delete_firewall_policy_async( assert response is None -@pytest.mark.asyncio -async def test_delete_firewall_policy_async_from_dict(): - await test_delete_firewall_policy_async(request_type=dict) - - def test_delete_firewall_policy_field_headers(): client = RecaptchaEnterpriseServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7952,8 +7985,8 @@ async def test_delete_firewall_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - recaptchaenterprise.ReorderFirewallPoliciesRequest, - dict, + recaptchaenterprise.ReorderFirewallPoliciesRequest(), + {}, ], ) def test_reorder_firewall_policies(request_type, transport: str = "grpc"): @@ -7964,7 +7997,7 @@ def test_reorder_firewall_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( @@ -8009,9 +8042,10 @@ def test_reorder_firewall_policies_non_empty_request_with_auto_populated_field() client.reorder_firewall_policies(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == recaptchaenterprise.ReorderFirewallPoliciesRequest( + request_msg = recaptchaenterprise.ReorderFirewallPoliciesRequest( parent="parent_value", ) + assert args[0] == request_msg def test_reorder_firewall_policies_use_cached_wrapped_rpc(): @@ -8097,9 +8131,15 @@ async def test_reorder_firewall_policies_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + recaptchaenterprise.ReorderFirewallPoliciesRequest(), + {}, + ], +) async def test_reorder_firewall_policies_async( - transport: str = "grpc_asyncio", - request_type=recaptchaenterprise.ReorderFirewallPoliciesRequest, + request_type, transport: str = "grpc_asyncio" ): client = RecaptchaEnterpriseServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -8108,7 +8148,7 @@ async def test_reorder_firewall_policies_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( @@ -8130,11 +8170,6 @@ async def test_reorder_firewall_policies_async( assert isinstance(response, recaptchaenterprise.ReorderFirewallPoliciesResponse) -@pytest.mark.asyncio -async def test_reorder_firewall_policies_async_from_dict(): - await test_reorder_firewall_policies_async(request_type=dict) - - def test_reorder_firewall_policies_field_headers(): client = RecaptchaEnterpriseServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8299,8 +8334,8 @@ async def test_reorder_firewall_policies_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - recaptchaenterprise.ListRelatedAccountGroupsRequest, - dict, + recaptchaenterprise.ListRelatedAccountGroupsRequest(), + {}, ], ) def test_list_related_account_groups(request_type, transport: str = "grpc"): @@ -8311,7 +8346,7 @@ def test_list_related_account_groups(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8360,10 +8395,11 @@ def test_list_related_account_groups_non_empty_request_with_auto_populated_field client.list_related_account_groups(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == recaptchaenterprise.ListRelatedAccountGroupsRequest( + request_msg = recaptchaenterprise.ListRelatedAccountGroupsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_related_account_groups_use_cached_wrapped_rpc(): @@ -8449,9 +8485,15 @@ async def test_list_related_account_groups_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + recaptchaenterprise.ListRelatedAccountGroupsRequest(), + {}, + ], +) async def test_list_related_account_groups_async( - transport: str = "grpc_asyncio", - request_type=recaptchaenterprise.ListRelatedAccountGroupsRequest, + request_type, transport: str = "grpc_asyncio" ): client = RecaptchaEnterpriseServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -8460,7 +8502,7 @@ async def test_list_related_account_groups_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( @@ -8485,11 +8527,6 @@ async def test_list_related_account_groups_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_related_account_groups_async_from_dict(): - await test_list_related_account_groups_async(request_type=dict) - - def test_list_related_account_groups_field_headers(): client = RecaptchaEnterpriseServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8848,8 +8885,8 @@ async def test_list_related_account_groups_async_pages(): @pytest.mark.parametrize( "request_type", [ - recaptchaenterprise.ListRelatedAccountGroupMembershipsRequest, - dict, + recaptchaenterprise.ListRelatedAccountGroupMembershipsRequest(), + {}, ], ) def test_list_related_account_group_memberships(request_type, transport: str = "grpc"): @@ -8860,7 +8897,7 @@ def test_list_related_account_group_memberships(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( @@ -8911,10 +8948,11 @@ def test_list_related_account_group_memberships_non_empty_request_with_auto_popu client.list_related_account_group_memberships(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == recaptchaenterprise.ListRelatedAccountGroupMembershipsRequest( + request_msg = recaptchaenterprise.ListRelatedAccountGroupMembershipsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_related_account_group_memberships_use_cached_wrapped_rpc(): @@ -9000,9 +9038,15 @@ async def test_list_related_account_group_memberships_async_use_cached_wrapped_r @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + recaptchaenterprise.ListRelatedAccountGroupMembershipsRequest(), + {}, + ], +) async def test_list_related_account_group_memberships_async( - transport: str = "grpc_asyncio", - request_type=recaptchaenterprise.ListRelatedAccountGroupMembershipsRequest, + request_type, transport: str = "grpc_asyncio" ): client = RecaptchaEnterpriseServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -9011,7 +9055,7 @@ async def test_list_related_account_group_memberships_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( @@ -9036,11 +9080,6 @@ async def test_list_related_account_group_memberships_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_related_account_group_memberships_async_from_dict(): - await test_list_related_account_group_memberships_async(request_type=dict) - - def test_list_related_account_group_memberships_field_headers(): client = RecaptchaEnterpriseServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9409,8 +9448,8 @@ async def test_list_related_account_group_memberships_async_pages(): @pytest.mark.parametrize( "request_type", [ - recaptchaenterprise.SearchRelatedAccountGroupMembershipsRequest, - dict, + recaptchaenterprise.SearchRelatedAccountGroupMembershipsRequest(), + {}, ], ) def test_search_related_account_group_memberships( @@ -9423,7 +9462,7 @@ def test_search_related_account_group_memberships( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,13 +9514,12 @@ def test_search_related_account_group_memberships_non_empty_request_with_auto_po client.search_related_account_group_memberships(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == recaptchaenterprise.SearchRelatedAccountGroupMembershipsRequest( + request_msg = recaptchaenterprise.SearchRelatedAccountGroupMembershipsRequest( project="project_value", account_id="account_id_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_search_related_account_group_memberships_use_cached_wrapped_rpc(): @@ -9567,9 +9605,15 @@ async def test_search_related_account_group_memberships_async_use_cached_wrapped @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + recaptchaenterprise.SearchRelatedAccountGroupMembershipsRequest(), + {}, + ], +) async def test_search_related_account_group_memberships_async( - transport: str = "grpc_asyncio", - request_type=recaptchaenterprise.SearchRelatedAccountGroupMembershipsRequest, + request_type, transport: str = "grpc_asyncio" ): client = RecaptchaEnterpriseServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -9578,7 +9622,7 @@ async def test_search_related_account_group_memberships_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( @@ -9603,11 +9647,6 @@ async def test_search_related_account_group_memberships_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_search_related_account_group_memberships_async_from_dict(): - await test_search_related_account_group_memberships_async(request_type=dict) - - def test_search_related_account_group_memberships_field_headers(): client = RecaptchaEnterpriseServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10107,7 +10146,6 @@ def test_create_assessment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recaptchaenterprise.CreateAssessmentRequest() - assert args[0] == request_msg @@ -10130,7 +10168,6 @@ def test_annotate_assessment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recaptchaenterprise.AnnotateAssessmentRequest() - assert args[0] == request_msg @@ -10151,7 +10188,6 @@ def test_create_key_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recaptchaenterprise.CreateKeyRequest() - assert args[0] == request_msg @@ -10172,7 +10208,6 @@ def test_list_keys_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recaptchaenterprise.ListKeysRequest() - assert args[0] == request_msg @@ -10195,7 +10230,6 @@ def test_retrieve_legacy_secret_key_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recaptchaenterprise.RetrieveLegacySecretKeyRequest() - assert args[0] == request_msg @@ -10216,7 +10250,6 @@ def test_get_key_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recaptchaenterprise.GetKeyRequest() - assert args[0] == request_msg @@ -10237,7 +10270,6 @@ def test_update_key_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recaptchaenterprise.UpdateKeyRequest() - assert args[0] == request_msg @@ -10258,7 +10290,6 @@ def test_delete_key_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recaptchaenterprise.DeleteKeyRequest() - assert args[0] == request_msg @@ -10279,7 +10310,6 @@ def test_migrate_key_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recaptchaenterprise.MigrateKeyRequest() - assert args[0] == request_msg @@ -10300,7 +10330,6 @@ def test_add_ip_override_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recaptchaenterprise.AddIpOverrideRequest() - assert args[0] == request_msg @@ -10323,7 +10352,6 @@ def test_remove_ip_override_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recaptchaenterprise.RemoveIpOverrideRequest() - assert args[0] == request_msg @@ -10346,7 +10374,6 @@ def test_list_ip_overrides_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recaptchaenterprise.ListIpOverridesRequest() - assert args[0] == request_msg @@ -10367,7 +10394,6 @@ def test_get_metrics_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recaptchaenterprise.GetMetricsRequest() - assert args[0] == request_msg @@ -10390,7 +10416,6 @@ def test_create_firewall_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recaptchaenterprise.CreateFirewallPolicyRequest() - assert args[0] == request_msg @@ -10413,7 +10438,6 @@ def test_list_firewall_policies_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recaptchaenterprise.ListFirewallPoliciesRequest() - assert args[0] == request_msg @@ -10436,7 +10460,6 @@ def test_get_firewall_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recaptchaenterprise.GetFirewallPolicyRequest() - assert args[0] == request_msg @@ -10459,7 +10482,6 @@ def test_update_firewall_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recaptchaenterprise.UpdateFirewallPolicyRequest() - assert args[0] == request_msg @@ -10482,7 +10504,6 @@ def test_delete_firewall_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recaptchaenterprise.DeleteFirewallPolicyRequest() - assert args[0] == request_msg @@ -10505,7 +10526,6 @@ def test_reorder_firewall_policies_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recaptchaenterprise.ReorderFirewallPoliciesRequest() - assert args[0] == request_msg @@ -10528,7 +10548,6 @@ def test_list_related_account_groups_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recaptchaenterprise.ListRelatedAccountGroupsRequest() - assert args[0] == request_msg @@ -10553,7 +10572,6 @@ def test_list_related_account_group_memberships_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recaptchaenterprise.ListRelatedAccountGroupMembershipsRequest() - assert args[0] == request_msg @@ -10578,7 +10596,6 @@ def test_search_related_account_group_memberships_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recaptchaenterprise.SearchRelatedAccountGroupMembershipsRequest() - assert args[0] == request_msg @@ -10621,7 +10638,6 @@ async def test_create_assessment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recaptchaenterprise.CreateAssessmentRequest() - assert args[0] == request_msg @@ -10648,7 +10664,6 @@ async def test_annotate_assessment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recaptchaenterprise.AnnotateAssessmentRequest() - assert args[0] == request_msg @@ -10676,7 +10691,6 @@ async def test_create_key_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recaptchaenterprise.CreateKeyRequest() - assert args[0] == request_msg @@ -10703,7 +10717,6 @@ async def test_list_keys_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recaptchaenterprise.ListKeysRequest() - assert args[0] == request_msg @@ -10732,7 +10745,6 @@ async def test_retrieve_legacy_secret_key_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recaptchaenterprise.RetrieveLegacySecretKeyRequest() - assert args[0] == request_msg @@ -10760,7 +10772,6 @@ async def test_get_key_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recaptchaenterprise.GetKeyRequest() - assert args[0] == request_msg @@ -10788,7 +10799,6 @@ async def test_update_key_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recaptchaenterprise.UpdateKeyRequest() - assert args[0] == request_msg @@ -10811,7 +10821,6 @@ async def test_delete_key_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recaptchaenterprise.DeleteKeyRequest() - assert args[0] == request_msg @@ -10839,7 +10848,6 @@ async def test_migrate_key_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recaptchaenterprise.MigrateKeyRequest() - assert args[0] == request_msg @@ -10864,7 +10872,6 @@ async def test_add_ip_override_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recaptchaenterprise.AddIpOverrideRequest() - assert args[0] == request_msg @@ -10891,7 +10898,6 @@ async def test_remove_ip_override_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recaptchaenterprise.RemoveIpOverrideRequest() - assert args[0] == request_msg @@ -10920,7 +10926,6 @@ async def test_list_ip_overrides_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recaptchaenterprise.ListIpOverridesRequest() - assert args[0] == request_msg @@ -10947,7 +10952,6 @@ async def test_get_metrics_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recaptchaenterprise.GetMetricsRequest() - assert args[0] == request_msg @@ -10979,7 +10983,6 @@ async def test_create_firewall_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recaptchaenterprise.CreateFirewallPolicyRequest() - assert args[0] == request_msg @@ -11008,7 +11011,6 @@ async def test_list_firewall_policies_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recaptchaenterprise.ListFirewallPoliciesRequest() - assert args[0] == request_msg @@ -11040,7 +11042,6 @@ async def test_get_firewall_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recaptchaenterprise.GetFirewallPolicyRequest() - assert args[0] == request_msg @@ -11072,7 +11073,6 @@ async def test_update_firewall_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recaptchaenterprise.UpdateFirewallPolicyRequest() - assert args[0] == request_msg @@ -11097,7 +11097,6 @@ async def test_delete_firewall_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recaptchaenterprise.DeleteFirewallPolicyRequest() - assert args[0] == request_msg @@ -11124,7 +11123,6 @@ async def test_reorder_firewall_policies_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recaptchaenterprise.ReorderFirewallPoliciesRequest() - assert args[0] == request_msg @@ -11153,7 +11151,6 @@ async def test_list_related_account_groups_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recaptchaenterprise.ListRelatedAccountGroupsRequest() - assert args[0] == request_msg @@ -11182,7 +11179,6 @@ async def test_list_related_account_group_memberships_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recaptchaenterprise.ListRelatedAccountGroupMembershipsRequest() - assert args[0] == request_msg @@ -11211,7 +11207,6 @@ async def test_search_related_account_group_memberships_empty_call_grpc_asyncio( call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recaptchaenterprise.SearchRelatedAccountGroupMembershipsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-recommendations-ai/noxfile.py b/packages/google-cloud-recommendations-ai/noxfile.py index f147d8e2a65b..1b1048928076 100644 --- a/packages/google-cloud-recommendations-ai/noxfile.py +++ b/packages/google-cloud-recommendations-ai/noxfile.py @@ -47,7 +47,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-recommendations-ai" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-recommendations-ai/setup.py b/packages/google-cloud-recommendations-ai/setup.py index 47034d15bb1a..6a3d2c00be48 100644 --- a/packages/google-cloud-recommendations-ai/setup.py +++ b/packages/google-cloud-recommendations-ai/setup.py @@ -45,7 +45,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/google-cloud-recommendations-ai/testing/constraints-3.10.txt b/packages/google-cloud-recommendations-ai/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-recommendations-ai/testing/constraints-3.10.txt +++ b/packages/google-cloud-recommendations-ai/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-recommendations-ai/tests/unit/gapic/recommendationengine_v1beta1/test_catalog_service.py b/packages/google-cloud-recommendations-ai/tests/unit/gapic/recommendationengine_v1beta1/test_catalog_service.py index d2e2c554d83f..da63df29571d 100644 --- a/packages/google-cloud-recommendations-ai/tests/unit/gapic/recommendationengine_v1beta1/test_catalog_service.py +++ b/packages/google-cloud-recommendations-ai/tests/unit/gapic/recommendationengine_v1beta1/test_catalog_service.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 @@ -120,6 +121,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" @@ -1323,8 +1339,8 @@ def test_catalog_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - catalog_service.CreateCatalogItemRequest, - dict, + catalog_service.CreateCatalogItemRequest(), + {}, ], ) def test_create_catalog_item(request_type, transport: str = "grpc"): @@ -1335,7 +1351,7 @@ def test_create_catalog_item(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1393,9 +1409,10 @@ def test_create_catalog_item_non_empty_request_with_auto_populated_field(): client.create_catalog_item(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog_service.CreateCatalogItemRequest( + request_msg = catalog_service.CreateCatalogItemRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_catalog_item_use_cached_wrapped_rpc(): @@ -1480,10 +1497,14 @@ async def test_create_catalog_item_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_catalog_item_async( - transport: str = "grpc_asyncio", - request_type=catalog_service.CreateCatalogItemRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + catalog_service.CreateCatalogItemRequest(), + {}, + ], +) +async def test_create_catalog_item_async(request_type, transport: str = "grpc_asyncio"): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1491,7 +1512,7 @@ async def test_create_catalog_item_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( @@ -1526,11 +1547,6 @@ async def test_create_catalog_item_async( assert response.item_group_id == "item_group_id_value" -@pytest.mark.asyncio -async def test_create_catalog_item_async_from_dict(): - await test_create_catalog_item_async(request_type=dict) - - def test_create_catalog_item_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1691,8 +1707,8 @@ async def test_create_catalog_item_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - catalog_service.GetCatalogItemRequest, - dict, + catalog_service.GetCatalogItemRequest(), + {}, ], ) def test_get_catalog_item(request_type, transport: str = "grpc"): @@ -1703,7 +1719,7 @@ def test_get_catalog_item(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_catalog_item), "__call__") as call: @@ -1757,9 +1773,10 @@ def test_get_catalog_item_non_empty_request_with_auto_populated_field(): client.get_catalog_item(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog_service.GetCatalogItemRequest( + request_msg = catalog_service.GetCatalogItemRequest( name="name_value", ) + assert args[0] == request_msg def test_get_catalog_item_use_cached_wrapped_rpc(): @@ -1842,9 +1859,14 @@ async def test_get_catalog_item_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_catalog_item_async( - transport: str = "grpc_asyncio", request_type=catalog_service.GetCatalogItemRequest -): +@pytest.mark.parametrize( + "request_type", + [ + catalog_service.GetCatalogItemRequest(), + {}, + ], +) +async def test_get_catalog_item_async(request_type, transport: str = "grpc_asyncio"): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1852,7 +1874,7 @@ async def test_get_catalog_item_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_catalog_item), "__call__") as call: @@ -1885,11 +1907,6 @@ async def test_get_catalog_item_async( assert response.item_group_id == "item_group_id_value" -@pytest.mark.asyncio -async def test_get_catalog_item_async_from_dict(): - await test_get_catalog_item_async(request_type=dict) - - def test_get_catalog_item_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2032,8 +2049,8 @@ async def test_get_catalog_item_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - catalog_service.ListCatalogItemsRequest, - dict, + catalog_service.ListCatalogItemsRequest(), + {}, ], ) def test_list_catalog_items(request_type, transport: str = "grpc"): @@ -2044,7 +2061,7 @@ def test_list_catalog_items(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2094,11 +2111,12 @@ def test_list_catalog_items_non_empty_request_with_auto_populated_field(): client.list_catalog_items(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog_service.ListCatalogItemsRequest( + request_msg = catalog_service.ListCatalogItemsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_catalog_items_use_cached_wrapped_rpc(): @@ -2183,10 +2201,14 @@ async def test_list_catalog_items_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_catalog_items_async( - transport: str = "grpc_asyncio", - request_type=catalog_service.ListCatalogItemsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + catalog_service.ListCatalogItemsRequest(), + {}, + ], +) +async def test_list_catalog_items_async(request_type, transport: str = "grpc_asyncio"): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2194,7 +2216,7 @@ async def test_list_catalog_items_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( @@ -2219,11 +2241,6 @@ async def test_list_catalog_items_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_catalog_items_async_from_dict(): - await test_list_catalog_items_async(request_type=dict) - - def test_list_catalog_items_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2586,8 +2603,8 @@ async def test_list_catalog_items_async_pages(): @pytest.mark.parametrize( "request_type", [ - catalog_service.UpdateCatalogItemRequest, - dict, + catalog_service.UpdateCatalogItemRequest(), + {}, ], ) def test_update_catalog_item(request_type, transport: str = "grpc"): @@ -2598,7 +2615,7 @@ def test_update_catalog_item(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2656,9 +2673,10 @@ def test_update_catalog_item_non_empty_request_with_auto_populated_field(): client.update_catalog_item(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog_service.UpdateCatalogItemRequest( + request_msg = catalog_service.UpdateCatalogItemRequest( name="name_value", ) + assert args[0] == request_msg def test_update_catalog_item_use_cached_wrapped_rpc(): @@ -2743,10 +2761,14 @@ async def test_update_catalog_item_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_catalog_item_async( - transport: str = "grpc_asyncio", - request_type=catalog_service.UpdateCatalogItemRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + catalog_service.UpdateCatalogItemRequest(), + {}, + ], +) +async def test_update_catalog_item_async(request_type, transport: str = "grpc_asyncio"): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2754,7 +2776,7 @@ async def test_update_catalog_item_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( @@ -2789,11 +2811,6 @@ async def test_update_catalog_item_async( assert response.item_group_id == "item_group_id_value" -@pytest.mark.asyncio -async def test_update_catalog_item_async_from_dict(): - await test_update_catalog_item_async(request_type=dict) - - def test_update_catalog_item_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2964,8 +2981,8 @@ async def test_update_catalog_item_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - catalog_service.DeleteCatalogItemRequest, - dict, + catalog_service.DeleteCatalogItemRequest(), + {}, ], ) def test_delete_catalog_item(request_type, transport: str = "grpc"): @@ -2976,7 +2993,7 @@ def test_delete_catalog_item(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3021,9 +3038,10 @@ def test_delete_catalog_item_non_empty_request_with_auto_populated_field(): client.delete_catalog_item(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog_service.DeleteCatalogItemRequest( + request_msg = catalog_service.DeleteCatalogItemRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_catalog_item_use_cached_wrapped_rpc(): @@ -3108,10 +3126,14 @@ async def test_delete_catalog_item_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_catalog_item_async( - transport: str = "grpc_asyncio", - request_type=catalog_service.DeleteCatalogItemRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + catalog_service.DeleteCatalogItemRequest(), + {}, + ], +) +async def test_delete_catalog_item_async(request_type, transport: str = "grpc_asyncio"): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3119,7 +3141,7 @@ async def test_delete_catalog_item_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( @@ -3139,11 +3161,6 @@ async def test_delete_catalog_item_async( assert response is None -@pytest.mark.asyncio -async def test_delete_catalog_item_async_from_dict(): - await test_delete_catalog_item_async(request_type=dict) - - def test_delete_catalog_item_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3294,8 +3311,8 @@ async def test_delete_catalog_item_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - import_.ImportCatalogItemsRequest, - dict, + import_.ImportCatalogItemsRequest(), + {}, ], ) def test_import_catalog_items(request_type, transport: str = "grpc"): @@ -3306,7 +3323,7 @@ def test_import_catalog_items(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3352,10 +3369,11 @@ def test_import_catalog_items_non_empty_request_with_auto_populated_field(): client.import_catalog_items(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == import_.ImportCatalogItemsRequest( + request_msg = import_.ImportCatalogItemsRequest( parent="parent_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_import_catalog_items_use_cached_wrapped_rpc(): @@ -3450,8 +3468,15 @@ async def test_import_catalog_items_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + import_.ImportCatalogItemsRequest(), + {}, + ], +) async def test_import_catalog_items_async( - transport: str = "grpc_asyncio", request_type=import_.ImportCatalogItemsRequest + request_type, transport: str = "grpc_asyncio" ): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3460,7 +3485,7 @@ async def test_import_catalog_items_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( @@ -3482,11 +3507,6 @@ async def test_import_catalog_items_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_import_catalog_items_async_from_dict(): - await test_import_catalog_items_async(request_type=dict) - - def test_import_catalog_items_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5046,7 +5066,6 @@ def test_create_catalog_item_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.CreateCatalogItemRequest() - assert args[0] == request_msg @@ -5067,7 +5086,6 @@ def test_get_catalog_item_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.GetCatalogItemRequest() - assert args[0] == request_msg @@ -5090,7 +5108,6 @@ def test_list_catalog_items_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.ListCatalogItemsRequest() - assert args[0] == request_msg @@ -5113,7 +5130,6 @@ def test_update_catalog_item_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.UpdateCatalogItemRequest() - assert args[0] == request_msg @@ -5136,7 +5152,6 @@ def test_delete_catalog_item_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.DeleteCatalogItemRequest() - assert args[0] == request_msg @@ -5159,7 +5174,6 @@ def test_import_catalog_items_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_.ImportCatalogItemsRequest() - assert args[0] == request_msg @@ -5207,7 +5221,6 @@ async def test_create_catalog_item_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.CreateCatalogItemRequest() - assert args[0] == request_msg @@ -5239,7 +5252,6 @@ async def test_get_catalog_item_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.GetCatalogItemRequest() - assert args[0] == request_msg @@ -5268,7 +5280,6 @@ async def test_list_catalog_items_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.ListCatalogItemsRequest() - assert args[0] == request_msg @@ -5302,7 +5313,6 @@ async def test_update_catalog_item_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.UpdateCatalogItemRequest() - assert args[0] == request_msg @@ -5327,7 +5337,6 @@ async def test_delete_catalog_item_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.DeleteCatalogItemRequest() - assert args[0] == request_msg @@ -5354,7 +5363,6 @@ async def test_import_catalog_items_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_.ImportCatalogItemsRequest() - assert args[0] == request_msg @@ -6375,7 +6383,6 @@ def test_create_catalog_item_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.CreateCatalogItemRequest() - assert args[0] == request_msg @@ -6395,7 +6402,6 @@ def test_get_catalog_item_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.GetCatalogItemRequest() - assert args[0] == request_msg @@ -6417,7 +6423,6 @@ def test_list_catalog_items_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.ListCatalogItemsRequest() - assert args[0] == request_msg @@ -6439,7 +6444,6 @@ def test_update_catalog_item_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.UpdateCatalogItemRequest() - assert args[0] == request_msg @@ -6461,7 +6465,6 @@ def test_delete_catalog_item_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.DeleteCatalogItemRequest() - assert args[0] == request_msg @@ -6483,7 +6486,6 @@ def test_import_catalog_items_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_.ImportCatalogItemsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-recommendations-ai/tests/unit/gapic/recommendationengine_v1beta1/test_prediction_api_key_registry.py b/packages/google-cloud-recommendations-ai/tests/unit/gapic/recommendationengine_v1beta1/test_prediction_api_key_registry.py index 1006e6eb5312..2220306abb54 100644 --- a/packages/google-cloud-recommendations-ai/tests/unit/gapic/recommendationengine_v1beta1/test_prediction_api_key_registry.py +++ b/packages/google-cloud-recommendations-ai/tests/unit/gapic/recommendationengine_v1beta1/test_prediction_api_key_registry.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 @@ -109,6 +110,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" @@ -1384,8 +1400,8 @@ def test_prediction_api_key_registry_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - prediction_apikey_registry_service.CreatePredictionApiKeyRegistrationRequest, - dict, + prediction_apikey_registry_service.CreatePredictionApiKeyRegistrationRequest(), + {}, ], ) def test_create_prediction_api_key_registration(request_type, transport: str = "grpc"): @@ -1396,7 +1412,7 @@ def test_create_prediction_api_key_registration(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( @@ -1450,12 +1466,10 @@ def test_create_prediction_api_key_registration_non_empty_request_with_auto_popu client.create_prediction_api_key_registration(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert ( - args[0] - == prediction_apikey_registry_service.CreatePredictionApiKeyRegistrationRequest( - parent="parent_value", - ) + request_msg = prediction_apikey_registry_service.CreatePredictionApiKeyRegistrationRequest( + parent="parent_value", ) + assert args[0] == request_msg def test_create_prediction_api_key_registration_use_cached_wrapped_rpc(): @@ -1541,9 +1555,15 @@ async def test_create_prediction_api_key_registration_async_use_cached_wrapped_r @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + prediction_apikey_registry_service.CreatePredictionApiKeyRegistrationRequest(), + {}, + ], +) async def test_create_prediction_api_key_registration_async( - transport: str = "grpc_asyncio", - request_type=prediction_apikey_registry_service.CreatePredictionApiKeyRegistrationRequest, + request_type, transport: str = "grpc_asyncio" ): client = PredictionApiKeyRegistryAsyncClient( credentials=async_anonymous_credentials(), @@ -1552,7 +1572,7 @@ async def test_create_prediction_api_key_registration_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( @@ -1579,11 +1599,6 @@ async def test_create_prediction_api_key_registration_async( assert response.api_key == "api_key_value" -@pytest.mark.asyncio -async def test_create_prediction_api_key_registration_async_from_dict(): - await test_create_prediction_api_key_registration_async(request_type=dict) - - def test_create_prediction_api_key_registration_field_headers(): client = PredictionApiKeyRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1770,8 +1785,8 @@ async def test_create_prediction_api_key_registration_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - prediction_apikey_registry_service.ListPredictionApiKeyRegistrationsRequest, - dict, + prediction_apikey_registry_service.ListPredictionApiKeyRegistrationsRequest(), + {}, ], ) def test_list_prediction_api_key_registrations(request_type, transport: str = "grpc"): @@ -1782,7 +1797,7 @@ def test_list_prediction_api_key_registrations(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( @@ -1833,13 +1848,13 @@ def test_list_prediction_api_key_registrations_non_empty_request_with_auto_popul client.list_prediction_api_key_registrations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert ( - args[0] - == prediction_apikey_registry_service.ListPredictionApiKeyRegistrationsRequest( + request_msg = ( + prediction_apikey_registry_service.ListPredictionApiKeyRegistrationsRequest( parent="parent_value", page_token="page_token_value", ) ) + assert args[0] == request_msg def test_list_prediction_api_key_registrations_use_cached_wrapped_rpc(): @@ -1925,9 +1940,15 @@ async def test_list_prediction_api_key_registrations_async_use_cached_wrapped_rp @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + prediction_apikey_registry_service.ListPredictionApiKeyRegistrationsRequest(), + {}, + ], +) async def test_list_prediction_api_key_registrations_async( - transport: str = "grpc_asyncio", - request_type=prediction_apikey_registry_service.ListPredictionApiKeyRegistrationsRequest, + request_type, transport: str = "grpc_asyncio" ): client = PredictionApiKeyRegistryAsyncClient( credentials=async_anonymous_credentials(), @@ -1936,7 +1957,7 @@ async def test_list_prediction_api_key_registrations_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( @@ -1961,11 +1982,6 @@ async def test_list_prediction_api_key_registrations_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_prediction_api_key_registrations_async_from_dict(): - await test_list_prediction_api_key_registrations_async(request_type=dict) - - def test_list_prediction_api_key_registrations_field_headers(): client = PredictionApiKeyRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2336,8 +2352,8 @@ async def test_list_prediction_api_key_registrations_async_pages(): @pytest.mark.parametrize( "request_type", [ - prediction_apikey_registry_service.DeletePredictionApiKeyRegistrationRequest, - dict, + prediction_apikey_registry_service.DeletePredictionApiKeyRegistrationRequest(), + {}, ], ) def test_delete_prediction_api_key_registration(request_type, transport: str = "grpc"): @@ -2348,7 +2364,7 @@ def test_delete_prediction_api_key_registration(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( @@ -2395,12 +2411,10 @@ def test_delete_prediction_api_key_registration_non_empty_request_with_auto_popu client.delete_prediction_api_key_registration(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert ( - args[0] - == prediction_apikey_registry_service.DeletePredictionApiKeyRegistrationRequest( - name="name_value", - ) + request_msg = prediction_apikey_registry_service.DeletePredictionApiKeyRegistrationRequest( + name="name_value", ) + assert args[0] == request_msg def test_delete_prediction_api_key_registration_use_cached_wrapped_rpc(): @@ -2486,9 +2500,15 @@ async def test_delete_prediction_api_key_registration_async_use_cached_wrapped_r @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + prediction_apikey_registry_service.DeletePredictionApiKeyRegistrationRequest(), + {}, + ], +) async def test_delete_prediction_api_key_registration_async( - transport: str = "grpc_asyncio", - request_type=prediction_apikey_registry_service.DeletePredictionApiKeyRegistrationRequest, + request_type, transport: str = "grpc_asyncio" ): client = PredictionApiKeyRegistryAsyncClient( credentials=async_anonymous_credentials(), @@ -2497,7 +2517,7 @@ async def test_delete_prediction_api_key_registration_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( @@ -2517,11 +2537,6 @@ async def test_delete_prediction_api_key_registration_async( assert response is None -@pytest.mark.asyncio -async def test_delete_prediction_api_key_registration_async_from_dict(): - await test_delete_prediction_api_key_registration_async(request_type=dict) - - def test_delete_prediction_api_key_registration_field_headers(): client = PredictionApiKeyRegistryClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3493,7 +3508,6 @@ def test_create_prediction_api_key_registration_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = prediction_apikey_registry_service.CreatePredictionApiKeyRegistrationRequest() - assert args[0] == request_msg @@ -3516,7 +3530,6 @@ def test_list_prediction_api_key_registrations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = prediction_apikey_registry_service.ListPredictionApiKeyRegistrationsRequest() - assert args[0] == request_msg @@ -3539,7 +3552,6 @@ def test_delete_prediction_api_key_registration_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = prediction_apikey_registry_service.DeletePredictionApiKeyRegistrationRequest() - assert args[0] == request_msg @@ -3582,7 +3594,6 @@ async def test_create_prediction_api_key_registration_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = prediction_apikey_registry_service.CreatePredictionApiKeyRegistrationRequest() - assert args[0] == request_msg @@ -3611,7 +3622,6 @@ async def test_list_prediction_api_key_registrations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = prediction_apikey_registry_service.ListPredictionApiKeyRegistrationsRequest() - assert args[0] == request_msg @@ -3636,7 +3646,6 @@ async def test_delete_prediction_api_key_registration_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = prediction_apikey_registry_service.DeletePredictionApiKeyRegistrationRequest() - assert args[0] == request_msg @@ -4083,7 +4092,6 @@ def test_create_prediction_api_key_registration_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = prediction_apikey_registry_service.CreatePredictionApiKeyRegistrationRequest() - assert args[0] == request_msg @@ -4105,7 +4113,6 @@ def test_list_prediction_api_key_registrations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = prediction_apikey_registry_service.ListPredictionApiKeyRegistrationsRequest() - assert args[0] == request_msg @@ -4127,7 +4134,6 @@ def test_delete_prediction_api_key_registration_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = prediction_apikey_registry_service.DeletePredictionApiKeyRegistrationRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-recommendations-ai/tests/unit/gapic/recommendationengine_v1beta1/test_prediction_service.py b/packages/google-cloud-recommendations-ai/tests/unit/gapic/recommendationengine_v1beta1/test_prediction_service.py index cffb28d0d42d..ff9949422091 100644 --- a/packages/google-cloud-recommendations-ai/tests/unit/gapic/recommendationengine_v1beta1/test_prediction_service.py +++ b/packages/google-cloud-recommendations-ai/tests/unit/gapic/recommendationengine_v1beta1/test_prediction_service.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 @@ -114,6 +115,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" @@ -1355,8 +1371,8 @@ def test_prediction_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - prediction_service.PredictRequest, - dict, + prediction_service.PredictRequest(), + {}, ], ) def test_predict(request_type, transport: str = "grpc"): @@ -1367,7 +1383,7 @@ def test_predict(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.predict), "__call__") as call: @@ -1419,11 +1435,12 @@ def test_predict_non_empty_request_with_auto_populated_field(): client.predict(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == prediction_service.PredictRequest( + request_msg = prediction_service.PredictRequest( name="name_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_predict_use_cached_wrapped_rpc(): @@ -1502,9 +1519,14 @@ async def test_predict_async_use_cached_wrapped_rpc(transport: str = "grpc_async @pytest.mark.asyncio -async def test_predict_async( - transport: str = "grpc_asyncio", request_type=prediction_service.PredictRequest -): +@pytest.mark.parametrize( + "request_type", + [ + prediction_service.PredictRequest(), + {}, + ], +) +async def test_predict_async(request_type, transport: str = "grpc_asyncio"): client = PredictionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1512,7 +1534,7 @@ async def test_predict_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.predict), "__call__") as call: @@ -1541,11 +1563,6 @@ async def test_predict_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_predict_async_from_dict(): - await test_predict_async(request_type=dict) - - def test_predict_field_headers(): client = PredictionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2275,7 +2292,6 @@ def test_predict_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = prediction_service.PredictRequest() - assert args[0] == request_msg @@ -2319,7 +2335,6 @@ async def test_predict_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = prediction_service.PredictRequest() - assert args[0] == request_msg @@ -2493,7 +2508,6 @@ def test_predict_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = prediction_service.PredictRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-recommendations-ai/tests/unit/gapic/recommendationengine_v1beta1/test_user_event_service.py b/packages/google-cloud-recommendations-ai/tests/unit/gapic/recommendationengine_v1beta1/test_user_event_service.py index c8f7a06b6151..9d7352e5473e 100644 --- a/packages/google-cloud-recommendations-ai/tests/unit/gapic/recommendationengine_v1beta1/test_user_event_service.py +++ b/packages/google-cloud-recommendations-ai/tests/unit/gapic/recommendationengine_v1beta1/test_user_event_service.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 @@ -122,6 +123,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" @@ -1355,8 +1371,8 @@ def test_user_event_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - user_event_service.WriteUserEventRequest, - dict, + user_event_service.WriteUserEventRequest(), + {}, ], ) def test_write_user_event(request_type, transport: str = "grpc"): @@ -1367,7 +1383,7 @@ def test_write_user_event(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.write_user_event), "__call__") as call: @@ -1413,9 +1429,10 @@ def test_write_user_event_non_empty_request_with_auto_populated_field(): client.write_user_event(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == user_event_service.WriteUserEventRequest( + request_msg = user_event_service.WriteUserEventRequest( parent="parent_value", ) + assert args[0] == request_msg def test_write_user_event_use_cached_wrapped_rpc(): @@ -1498,10 +1515,14 @@ async def test_write_user_event_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_write_user_event_async( - transport: str = "grpc_asyncio", - request_type=user_event_service.WriteUserEventRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + user_event_service.WriteUserEventRequest(), + {}, + ], +) +async def test_write_user_event_async(request_type, transport: str = "grpc_asyncio"): client = UserEventServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1509,7 +1530,7 @@ async def test_write_user_event_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.write_user_event), "__call__") as call: @@ -1534,11 +1555,6 @@ async def test_write_user_event_async( assert response.event_source == gcr_user_event.UserEvent.EventSource.AUTOML -@pytest.mark.asyncio -async def test_write_user_event_async_from_dict(): - await test_write_user_event_async(request_type=dict) - - def test_write_user_event_field_headers(): client = UserEventServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1695,8 +1711,8 @@ async def test_write_user_event_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - user_event_service.CollectUserEventRequest, - dict, + user_event_service.CollectUserEventRequest(), + {}, ], ) def test_collect_user_event(request_type, transport: str = "grpc"): @@ -1707,7 +1723,7 @@ def test_collect_user_event(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1759,11 +1775,12 @@ def test_collect_user_event_non_empty_request_with_auto_populated_field(): client.collect_user_event(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == user_event_service.CollectUserEventRequest( + request_msg = user_event_service.CollectUserEventRequest( parent="parent_value", user_event="user_event_value", uri="uri_value", ) + assert args[0] == request_msg def test_collect_user_event_use_cached_wrapped_rpc(): @@ -1848,10 +1865,14 @@ async def test_collect_user_event_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_collect_user_event_async( - transport: str = "grpc_asyncio", - request_type=user_event_service.CollectUserEventRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + user_event_service.CollectUserEventRequest(), + {}, + ], +) +async def test_collect_user_event_async(request_type, transport: str = "grpc_asyncio"): client = UserEventServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1859,7 +1880,7 @@ async def test_collect_user_event_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( @@ -1886,11 +1907,6 @@ async def test_collect_user_event_async( assert response.data == b"data_blob" -@pytest.mark.asyncio -async def test_collect_user_event_async_from_dict(): - await test_collect_user_event_async(request_type=dict) - - def test_collect_user_event_field_headers(): client = UserEventServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2075,8 +2091,8 @@ async def test_collect_user_event_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - user_event_service.ListUserEventsRequest, - dict, + user_event_service.ListUserEventsRequest(), + {}, ], ) def test_list_user_events(request_type, transport: str = "grpc"): @@ -2087,7 +2103,7 @@ def test_list_user_events(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_user_events), "__call__") as call: @@ -2133,11 +2149,12 @@ def test_list_user_events_non_empty_request_with_auto_populated_field(): client.list_user_events(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == user_event_service.ListUserEventsRequest( + request_msg = user_event_service.ListUserEventsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_user_events_use_cached_wrapped_rpc(): @@ -2220,10 +2237,14 @@ async def test_list_user_events_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_user_events_async( - transport: str = "grpc_asyncio", - request_type=user_event_service.ListUserEventsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + user_event_service.ListUserEventsRequest(), + {}, + ], +) +async def test_list_user_events_async(request_type, transport: str = "grpc_asyncio"): client = UserEventServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2231,7 +2252,7 @@ async def test_list_user_events_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_user_events), "__call__") as call: @@ -2254,11 +2275,6 @@ async def test_list_user_events_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_user_events_async_from_dict(): - await test_list_user_events_async(request_type=dict) - - def test_list_user_events_field_headers(): client = UserEventServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2605,8 +2621,8 @@ async def test_list_user_events_async_pages(): @pytest.mark.parametrize( "request_type", [ - user_event_service.PurgeUserEventsRequest, - dict, + user_event_service.PurgeUserEventsRequest(), + {}, ], ) def test_purge_user_events(request_type, transport: str = "grpc"): @@ -2617,7 +2633,7 @@ def test_purge_user_events(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2663,10 +2679,11 @@ def test_purge_user_events_non_empty_request_with_auto_populated_field(): client.purge_user_events(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == user_event_service.PurgeUserEventsRequest( + request_msg = user_event_service.PurgeUserEventsRequest( parent="parent_value", filter="filter_value", ) + assert args[0] == request_msg def test_purge_user_events_use_cached_wrapped_rpc(): @@ -2759,10 +2776,14 @@ async def test_purge_user_events_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_purge_user_events_async( - transport: str = "grpc_asyncio", - request_type=user_event_service.PurgeUserEventsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + user_event_service.PurgeUserEventsRequest(), + {}, + ], +) +async def test_purge_user_events_async(request_type, transport: str = "grpc_asyncio"): client = UserEventServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2770,7 +2791,7 @@ async def test_purge_user_events_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( @@ -2792,11 +2813,6 @@ async def test_purge_user_events_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_purge_user_events_async_from_dict(): - await test_purge_user_events_async(request_type=dict) - - def test_purge_user_events_field_headers(): client = UserEventServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2971,8 +2987,8 @@ async def test_purge_user_events_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - import_.ImportUserEventsRequest, - dict, + import_.ImportUserEventsRequest(), + {}, ], ) def test_import_user_events(request_type, transport: str = "grpc"): @@ -2983,7 +2999,7 @@ def test_import_user_events(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3029,10 +3045,11 @@ def test_import_user_events_non_empty_request_with_auto_populated_field(): client.import_user_events(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == import_.ImportUserEventsRequest( + request_msg = import_.ImportUserEventsRequest( parent="parent_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_import_user_events_use_cached_wrapped_rpc(): @@ -3127,9 +3144,14 @@ async def test_import_user_events_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_import_user_events_async( - transport: str = "grpc_asyncio", request_type=import_.ImportUserEventsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + import_.ImportUserEventsRequest(), + {}, + ], +) +async def test_import_user_events_async(request_type, transport: str = "grpc_asyncio"): client = UserEventServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3137,7 +3159,7 @@ async def test_import_user_events_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( @@ -3159,11 +3181,6 @@ async def test_import_user_events_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_import_user_events_async_from_dict(): - await test_import_user_events_async(request_type=dict) - - def test_import_user_events_field_headers(): client = UserEventServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4576,7 +4593,6 @@ def test_write_user_event_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_event_service.WriteUserEventRequest() - assert args[0] == request_msg @@ -4599,7 +4615,6 @@ def test_collect_user_event_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_event_service.CollectUserEventRequest() - assert args[0] == request_msg @@ -4620,7 +4635,6 @@ def test_list_user_events_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_event_service.ListUserEventsRequest() - assert args[0] == request_msg @@ -4643,7 +4657,6 @@ def test_purge_user_events_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_event_service.PurgeUserEventsRequest() - assert args[0] == request_msg @@ -4666,7 +4679,6 @@ def test_import_user_events_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_.ImportUserEventsRequest() - assert args[0] == request_msg @@ -4708,7 +4720,6 @@ async def test_write_user_event_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_event_service.WriteUserEventRequest() - assert args[0] == request_msg @@ -4738,7 +4749,6 @@ async def test_collect_user_event_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_event_service.CollectUserEventRequest() - assert args[0] == request_msg @@ -4765,7 +4775,6 @@ async def test_list_user_events_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_event_service.ListUserEventsRequest() - assert args[0] == request_msg @@ -4792,7 +4801,6 @@ async def test_purge_user_events_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_event_service.PurgeUserEventsRequest() - assert args[0] == request_msg @@ -4819,7 +4827,6 @@ async def test_import_user_events_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_.ImportUserEventsRequest() - assert args[0] == request_msg @@ -5638,7 +5645,6 @@ def test_write_user_event_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_event_service.WriteUserEventRequest() - assert args[0] == request_msg @@ -5660,7 +5666,6 @@ def test_collect_user_event_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_event_service.CollectUserEventRequest() - assert args[0] == request_msg @@ -5680,7 +5685,6 @@ def test_list_user_events_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_event_service.ListUserEventsRequest() - assert args[0] == request_msg @@ -5702,7 +5706,6 @@ def test_purge_user_events_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_event_service.PurgeUserEventsRequest() - assert args[0] == request_msg @@ -5724,7 +5727,6 @@ def test_import_user_events_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_.ImportUserEventsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-recommender/noxfile.py b/packages/google-cloud-recommender/noxfile.py index 4075f0f6e131..144f17361952 100644 --- a/packages/google-cloud-recommender/noxfile.py +++ b/packages/google-cloud-recommender/noxfile.py @@ -47,7 +47,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-recommender" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-recommender/setup.py b/packages/google-cloud-recommender/setup.py index 0a78a0e22f4c..54e16ef9de61 100644 --- a/packages/google-cloud-recommender/setup.py +++ b/packages/google-cloud-recommender/setup.py @@ -45,7 +45,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/google-cloud-recommender/testing/constraints-3.10.txt b/packages/google-cloud-recommender/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-recommender/testing/constraints-3.10.txt +++ b/packages/google-cloud-recommender/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-recommender/tests/unit/gapic/recommender_v1/test_recommender.py b/packages/google-cloud-recommender/tests/unit/gapic/recommender_v1/test_recommender.py index ca112925c7a8..7072b64e113a 100644 --- a/packages/google-cloud-recommender/tests/unit/gapic/recommender_v1/test_recommender.py +++ b/packages/google-cloud-recommender/tests/unit/gapic/recommender_v1/test_recommender.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 @@ -123,6 +124,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" @@ -1288,8 +1304,8 @@ def test_recommender_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - recommender_service.ListInsightsRequest, - dict, + recommender_service.ListInsightsRequest(), + {}, ], ) def test_list_insights(request_type, transport: str = "grpc"): @@ -1300,7 +1316,7 @@ def test_list_insights(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_insights), "__call__") as call: @@ -1346,11 +1362,12 @@ def test_list_insights_non_empty_request_with_auto_populated_field(): client.list_insights(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == recommender_service.ListInsightsRequest( + request_msg = recommender_service.ListInsightsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_insights_use_cached_wrapped_rpc(): @@ -1431,10 +1448,14 @@ async def test_list_insights_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_insights_async( - transport: str = "grpc_asyncio", - request_type=recommender_service.ListInsightsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + recommender_service.ListInsightsRequest(), + {}, + ], +) +async def test_list_insights_async(request_type, transport: str = "grpc_asyncio"): client = RecommenderAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1442,7 +1463,7 @@ async def test_list_insights_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_insights), "__call__") as call: @@ -1465,11 +1486,6 @@ async def test_list_insights_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_insights_async_from_dict(): - await test_list_insights_async(request_type=dict) - - def test_list_insights_field_headers(): client = RecommenderClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1806,8 +1822,8 @@ async def test_list_insights_async_pages(): @pytest.mark.parametrize( "request_type", [ - recommender_service.GetInsightRequest, - dict, + recommender_service.GetInsightRequest(), + {}, ], ) def test_get_insight(request_type, transport: str = "grpc"): @@ -1818,7 +1834,7 @@ def test_get_insight(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_insight), "__call__") as call: @@ -1874,9 +1890,10 @@ def test_get_insight_non_empty_request_with_auto_populated_field(): client.get_insight(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == recommender_service.GetInsightRequest( + request_msg = recommender_service.GetInsightRequest( name="name_value", ) + assert args[0] == request_msg def test_get_insight_use_cached_wrapped_rpc(): @@ -1957,9 +1974,14 @@ async def test_get_insight_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_insight_async( - transport: str = "grpc_asyncio", request_type=recommender_service.GetInsightRequest -): +@pytest.mark.parametrize( + "request_type", + [ + recommender_service.GetInsightRequest(), + {}, + ], +) +async def test_get_insight_async(request_type, transport: str = "grpc_asyncio"): client = RecommenderAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1967,7 +1989,7 @@ async def test_get_insight_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_insight), "__call__") as call: @@ -2002,11 +2024,6 @@ async def test_get_insight_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_insight_async_from_dict(): - await test_get_insight_async(request_type=dict) - - def test_get_insight_field_headers(): client = RecommenderClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2149,8 +2166,8 @@ async def test_get_insight_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - recommender_service.MarkInsightAcceptedRequest, - dict, + recommender_service.MarkInsightAcceptedRequest(), + {}, ], ) def test_mark_insight_accepted(request_type, transport: str = "grpc"): @@ -2161,7 +2178,7 @@ def test_mark_insight_accepted(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2222,10 +2239,11 @@ def test_mark_insight_accepted_non_empty_request_with_auto_populated_field(): client.mark_insight_accepted(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == recommender_service.MarkInsightAcceptedRequest( + request_msg = recommender_service.MarkInsightAcceptedRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_mark_insight_accepted_use_cached_wrapped_rpc(): @@ -2311,9 +2329,15 @@ async def test_mark_insight_accepted_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + recommender_service.MarkInsightAcceptedRequest(), + {}, + ], +) async def test_mark_insight_accepted_async( - transport: str = "grpc_asyncio", - request_type=recommender_service.MarkInsightAcceptedRequest, + request_type, transport: str = "grpc_asyncio" ): client = RecommenderAsyncClient( credentials=async_anonymous_credentials(), @@ -2322,7 +2346,7 @@ async def test_mark_insight_accepted_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( @@ -2359,11 +2383,6 @@ async def test_mark_insight_accepted_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_mark_insight_accepted_async_from_dict(): - await test_mark_insight_accepted_async(request_type=dict) - - def test_mark_insight_accepted_field_headers(): client = RecommenderClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2534,8 +2553,8 @@ async def test_mark_insight_accepted_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - recommender_service.ListRecommendationsRequest, - dict, + recommender_service.ListRecommendationsRequest(), + {}, ], ) def test_list_recommendations(request_type, transport: str = "grpc"): @@ -2546,7 +2565,7 @@ def test_list_recommendations(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2596,11 +2615,12 @@ def test_list_recommendations_non_empty_request_with_auto_populated_field(): client.list_recommendations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == recommender_service.ListRecommendationsRequest( + request_msg = recommender_service.ListRecommendationsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_recommendations_use_cached_wrapped_rpc(): @@ -2685,9 +2705,15 @@ async def test_list_recommendations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + recommender_service.ListRecommendationsRequest(), + {}, + ], +) async def test_list_recommendations_async( - transport: str = "grpc_asyncio", - request_type=recommender_service.ListRecommendationsRequest, + request_type, transport: str = "grpc_asyncio" ): client = RecommenderAsyncClient( credentials=async_anonymous_credentials(), @@ -2696,7 +2722,7 @@ async def test_list_recommendations_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( @@ -2721,11 +2747,6 @@ async def test_list_recommendations_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_recommendations_async_from_dict(): - await test_list_recommendations_async(request_type=dict) - - def test_list_recommendations_field_headers(): client = RecommenderClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3088,8 +3109,8 @@ async def test_list_recommendations_async_pages(): @pytest.mark.parametrize( "request_type", [ - recommender_service.GetRecommendationRequest, - dict, + recommender_service.GetRecommendationRequest(), + {}, ], ) def test_get_recommendation(request_type, transport: str = "grpc"): @@ -3100,7 +3121,7 @@ def test_get_recommendation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3158,9 +3179,10 @@ def test_get_recommendation_non_empty_request_with_auto_populated_field(): client.get_recommendation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == recommender_service.GetRecommendationRequest( + request_msg = recommender_service.GetRecommendationRequest( name="name_value", ) + assert args[0] == request_msg def test_get_recommendation_use_cached_wrapped_rpc(): @@ -3245,10 +3267,14 @@ async def test_get_recommendation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_recommendation_async( - transport: str = "grpc_asyncio", - request_type=recommender_service.GetRecommendationRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + recommender_service.GetRecommendationRequest(), + {}, + ], +) +async def test_get_recommendation_async(request_type, transport: str = "grpc_asyncio"): client = RecommenderAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3256,7 +3282,7 @@ async def test_get_recommendation_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( @@ -3291,11 +3317,6 @@ async def test_get_recommendation_async( assert response.xor_group_id == "xor_group_id_value" -@pytest.mark.asyncio -async def test_get_recommendation_async_from_dict(): - await test_get_recommendation_async(request_type=dict) - - def test_get_recommendation_field_headers(): client = RecommenderClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3450,8 +3471,8 @@ async def test_get_recommendation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - recommender_service.MarkRecommendationDismissedRequest, - dict, + recommender_service.MarkRecommendationDismissedRequest(), + {}, ], ) def test_mark_recommendation_dismissed(request_type, transport: str = "grpc"): @@ -3462,7 +3483,7 @@ def test_mark_recommendation_dismissed(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3521,10 +3542,11 @@ def test_mark_recommendation_dismissed_non_empty_request_with_auto_populated_fie client.mark_recommendation_dismissed(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == recommender_service.MarkRecommendationDismissedRequest( + request_msg = recommender_service.MarkRecommendationDismissedRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_mark_recommendation_dismissed_use_cached_wrapped_rpc(): @@ -3610,9 +3632,15 @@ async def test_mark_recommendation_dismissed_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + recommender_service.MarkRecommendationDismissedRequest(), + {}, + ], +) async def test_mark_recommendation_dismissed_async( - transport: str = "grpc_asyncio", - request_type=recommender_service.MarkRecommendationDismissedRequest, + request_type, transport: str = "grpc_asyncio" ): client = RecommenderAsyncClient( credentials=async_anonymous_credentials(), @@ -3621,7 +3649,7 @@ async def test_mark_recommendation_dismissed_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( @@ -3656,11 +3684,6 @@ async def test_mark_recommendation_dismissed_async( assert response.xor_group_id == "xor_group_id_value" -@pytest.mark.asyncio -async def test_mark_recommendation_dismissed_async_from_dict(): - await test_mark_recommendation_dismissed_async(request_type=dict) - - def test_mark_recommendation_dismissed_field_headers(): client = RecommenderClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3729,8 +3752,8 @@ async def test_mark_recommendation_dismissed_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - recommender_service.MarkRecommendationClaimedRequest, - dict, + recommender_service.MarkRecommendationClaimedRequest(), + {}, ], ) def test_mark_recommendation_claimed(request_type, transport: str = "grpc"): @@ -3741,7 +3764,7 @@ def test_mark_recommendation_claimed(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3800,10 +3823,11 @@ def test_mark_recommendation_claimed_non_empty_request_with_auto_populated_field client.mark_recommendation_claimed(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == recommender_service.MarkRecommendationClaimedRequest( + request_msg = recommender_service.MarkRecommendationClaimedRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_mark_recommendation_claimed_use_cached_wrapped_rpc(): @@ -3889,9 +3913,15 @@ async def test_mark_recommendation_claimed_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + recommender_service.MarkRecommendationClaimedRequest(), + {}, + ], +) async def test_mark_recommendation_claimed_async( - transport: str = "grpc_asyncio", - request_type=recommender_service.MarkRecommendationClaimedRequest, + request_type, transport: str = "grpc_asyncio" ): client = RecommenderAsyncClient( credentials=async_anonymous_credentials(), @@ -3900,7 +3930,7 @@ async def test_mark_recommendation_claimed_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( @@ -3935,11 +3965,6 @@ async def test_mark_recommendation_claimed_async( assert response.xor_group_id == "xor_group_id_value" -@pytest.mark.asyncio -async def test_mark_recommendation_claimed_async_from_dict(): - await test_mark_recommendation_claimed_async(request_type=dict) - - def test_mark_recommendation_claimed_field_headers(): client = RecommenderClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4114,8 +4139,8 @@ async def test_mark_recommendation_claimed_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - recommender_service.MarkRecommendationSucceededRequest, - dict, + recommender_service.MarkRecommendationSucceededRequest(), + {}, ], ) def test_mark_recommendation_succeeded(request_type, transport: str = "grpc"): @@ -4126,7 +4151,7 @@ def test_mark_recommendation_succeeded(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4185,10 +4210,11 @@ def test_mark_recommendation_succeeded_non_empty_request_with_auto_populated_fie client.mark_recommendation_succeeded(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == recommender_service.MarkRecommendationSucceededRequest( + request_msg = recommender_service.MarkRecommendationSucceededRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_mark_recommendation_succeeded_use_cached_wrapped_rpc(): @@ -4274,9 +4300,15 @@ async def test_mark_recommendation_succeeded_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + recommender_service.MarkRecommendationSucceededRequest(), + {}, + ], +) async def test_mark_recommendation_succeeded_async( - transport: str = "grpc_asyncio", - request_type=recommender_service.MarkRecommendationSucceededRequest, + request_type, transport: str = "grpc_asyncio" ): client = RecommenderAsyncClient( credentials=async_anonymous_credentials(), @@ -4285,7 +4317,7 @@ async def test_mark_recommendation_succeeded_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( @@ -4320,11 +4352,6 @@ async def test_mark_recommendation_succeeded_async( assert response.xor_group_id == "xor_group_id_value" -@pytest.mark.asyncio -async def test_mark_recommendation_succeeded_async_from_dict(): - await test_mark_recommendation_succeeded_async(request_type=dict) - - def test_mark_recommendation_succeeded_field_headers(): client = RecommenderClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4499,8 +4526,8 @@ async def test_mark_recommendation_succeeded_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - recommender_service.MarkRecommendationFailedRequest, - dict, + recommender_service.MarkRecommendationFailedRequest(), + {}, ], ) def test_mark_recommendation_failed(request_type, transport: str = "grpc"): @@ -4511,7 +4538,7 @@ def test_mark_recommendation_failed(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4570,10 +4597,11 @@ def test_mark_recommendation_failed_non_empty_request_with_auto_populated_field( client.mark_recommendation_failed(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == recommender_service.MarkRecommendationFailedRequest( + request_msg = recommender_service.MarkRecommendationFailedRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_mark_recommendation_failed_use_cached_wrapped_rpc(): @@ -4659,9 +4687,15 @@ async def test_mark_recommendation_failed_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + recommender_service.MarkRecommendationFailedRequest(), + {}, + ], +) async def test_mark_recommendation_failed_async( - transport: str = "grpc_asyncio", - request_type=recommender_service.MarkRecommendationFailedRequest, + request_type, transport: str = "grpc_asyncio" ): client = RecommenderAsyncClient( credentials=async_anonymous_credentials(), @@ -4670,7 +4704,7 @@ async def test_mark_recommendation_failed_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( @@ -4705,11 +4739,6 @@ async def test_mark_recommendation_failed_async( assert response.xor_group_id == "xor_group_id_value" -@pytest.mark.asyncio -async def test_mark_recommendation_failed_async_from_dict(): - await test_mark_recommendation_failed_async(request_type=dict) - - def test_mark_recommendation_failed_field_headers(): client = RecommenderClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4884,8 +4913,8 @@ async def test_mark_recommendation_failed_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - recommender_service.GetRecommenderConfigRequest, - dict, + recommender_service.GetRecommenderConfigRequest(), + {}, ], ) def test_get_recommender_config(request_type, transport: str = "grpc"): @@ -4896,7 +4925,7 @@ def test_get_recommender_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( @@ -4950,9 +4979,10 @@ def test_get_recommender_config_non_empty_request_with_auto_populated_field(): client.get_recommender_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == recommender_service.GetRecommenderConfigRequest( + request_msg = recommender_service.GetRecommenderConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_recommender_config_use_cached_wrapped_rpc(): @@ -5038,9 +5068,15 @@ async def test_get_recommender_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + recommender_service.GetRecommenderConfigRequest(), + {}, + ], +) async def test_get_recommender_config_async( - transport: str = "grpc_asyncio", - request_type=recommender_service.GetRecommenderConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = RecommenderAsyncClient( credentials=async_anonymous_credentials(), @@ -5049,7 +5085,7 @@ async def test_get_recommender_config_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( @@ -5080,11 +5116,6 @@ async def test_get_recommender_config_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_get_recommender_config_async_from_dict(): - await test_get_recommender_config_async(request_type=dict) - - def test_get_recommender_config_field_headers(): client = RecommenderClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5239,8 +5270,8 @@ async def test_get_recommender_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - recommender_service.UpdateRecommenderConfigRequest, - dict, + recommender_service.UpdateRecommenderConfigRequest(), + {}, ], ) def test_update_recommender_config(request_type, transport: str = "grpc"): @@ -5251,7 +5282,7 @@ def test_update_recommender_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( @@ -5303,7 +5334,8 @@ def test_update_recommender_config_non_empty_request_with_auto_populated_field() client.update_recommender_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == recommender_service.UpdateRecommenderConfigRequest() + request_msg = recommender_service.UpdateRecommenderConfigRequest() + assert args[0] == request_msg def test_update_recommender_config_use_cached_wrapped_rpc(): @@ -5389,9 +5421,15 @@ async def test_update_recommender_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + recommender_service.UpdateRecommenderConfigRequest(), + {}, + ], +) async def test_update_recommender_config_async( - transport: str = "grpc_asyncio", - request_type=recommender_service.UpdateRecommenderConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = RecommenderAsyncClient( credentials=async_anonymous_credentials(), @@ -5400,7 +5438,7 @@ async def test_update_recommender_config_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( @@ -5431,11 +5469,6 @@ async def test_update_recommender_config_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_update_recommender_config_async_from_dict(): - await test_update_recommender_config_async(request_type=dict) - - def test_update_recommender_config_field_headers(): client = RecommenderClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5608,8 +5641,8 @@ async def test_update_recommender_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - recommender_service.GetInsightTypeConfigRequest, - dict, + recommender_service.GetInsightTypeConfigRequest(), + {}, ], ) def test_get_insight_type_config(request_type, transport: str = "grpc"): @@ -5620,7 +5653,7 @@ def test_get_insight_type_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( @@ -5674,9 +5707,10 @@ def test_get_insight_type_config_non_empty_request_with_auto_populated_field(): client.get_insight_type_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == recommender_service.GetInsightTypeConfigRequest( + request_msg = recommender_service.GetInsightTypeConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_insight_type_config_use_cached_wrapped_rpc(): @@ -5762,9 +5796,15 @@ async def test_get_insight_type_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + recommender_service.GetInsightTypeConfigRequest(), + {}, + ], +) async def test_get_insight_type_config_async( - transport: str = "grpc_asyncio", - request_type=recommender_service.GetInsightTypeConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = RecommenderAsyncClient( credentials=async_anonymous_credentials(), @@ -5773,7 +5813,7 @@ async def test_get_insight_type_config_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( @@ -5804,11 +5844,6 @@ async def test_get_insight_type_config_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_get_insight_type_config_async_from_dict(): - await test_get_insight_type_config_async(request_type=dict) - - def test_get_insight_type_config_field_headers(): client = RecommenderClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5963,8 +5998,8 @@ async def test_get_insight_type_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - recommender_service.UpdateInsightTypeConfigRequest, - dict, + recommender_service.UpdateInsightTypeConfigRequest(), + {}, ], ) def test_update_insight_type_config(request_type, transport: str = "grpc"): @@ -5975,7 +6010,7 @@ def test_update_insight_type_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( @@ -6027,7 +6062,8 @@ def test_update_insight_type_config_non_empty_request_with_auto_populated_field( client.update_insight_type_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == recommender_service.UpdateInsightTypeConfigRequest() + request_msg = recommender_service.UpdateInsightTypeConfigRequest() + assert args[0] == request_msg def test_update_insight_type_config_use_cached_wrapped_rpc(): @@ -6113,9 +6149,15 @@ async def test_update_insight_type_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + recommender_service.UpdateInsightTypeConfigRequest(), + {}, + ], +) async def test_update_insight_type_config_async( - transport: str = "grpc_asyncio", - request_type=recommender_service.UpdateInsightTypeConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = RecommenderAsyncClient( credentials=async_anonymous_credentials(), @@ -6124,7 +6166,7 @@ async def test_update_insight_type_config_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( @@ -6155,11 +6197,6 @@ async def test_update_insight_type_config_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_update_insight_type_config_async_from_dict(): - await test_update_insight_type_config_async(request_type=dict) - - def test_update_insight_type_config_field_headers(): client = RecommenderClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9064,7 +9101,6 @@ def test_list_insights_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.ListInsightsRequest() - assert args[0] == request_msg @@ -9085,7 +9121,6 @@ def test_get_insight_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.GetInsightRequest() - assert args[0] == request_msg @@ -9108,7 +9143,6 @@ def test_mark_insight_accepted_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.MarkInsightAcceptedRequest() - assert args[0] == request_msg @@ -9131,7 +9165,6 @@ def test_list_recommendations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.ListRecommendationsRequest() - assert args[0] == request_msg @@ -9154,7 +9187,6 @@ def test_get_recommendation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.GetRecommendationRequest() - assert args[0] == request_msg @@ -9177,7 +9209,6 @@ def test_mark_recommendation_dismissed_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.MarkRecommendationDismissedRequest() - assert args[0] == request_msg @@ -9200,7 +9231,6 @@ def test_mark_recommendation_claimed_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.MarkRecommendationClaimedRequest() - assert args[0] == request_msg @@ -9223,7 +9253,6 @@ def test_mark_recommendation_succeeded_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.MarkRecommendationSucceededRequest() - assert args[0] == request_msg @@ -9246,7 +9275,6 @@ def test_mark_recommendation_failed_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.MarkRecommendationFailedRequest() - assert args[0] == request_msg @@ -9269,7 +9297,6 @@ def test_get_recommender_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.GetRecommenderConfigRequest() - assert args[0] == request_msg @@ -9292,7 +9319,6 @@ def test_update_recommender_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.UpdateRecommenderConfigRequest() - assert args[0] == request_msg @@ -9315,7 +9341,6 @@ def test_get_insight_type_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.GetInsightTypeConfigRequest() - assert args[0] == request_msg @@ -9338,7 +9363,6 @@ def test_update_insight_type_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.UpdateInsightTypeConfigRequest() - assert args[0] == request_msg @@ -9379,7 +9403,6 @@ async def test_list_insights_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.ListInsightsRequest() - assert args[0] == request_msg @@ -9412,7 +9435,6 @@ async def test_get_insight_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.GetInsightRequest() - assert args[0] == request_msg @@ -9447,7 +9469,6 @@ async def test_mark_insight_accepted_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.MarkInsightAcceptedRequest() - assert args[0] == request_msg @@ -9476,7 +9497,6 @@ async def test_list_recommendations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.ListRecommendationsRequest() - assert args[0] == request_msg @@ -9510,7 +9530,6 @@ async def test_get_recommendation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.GetRecommendationRequest() - assert args[0] == request_msg @@ -9544,7 +9563,6 @@ async def test_mark_recommendation_dismissed_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.MarkRecommendationDismissedRequest() - assert args[0] == request_msg @@ -9578,7 +9596,6 @@ async def test_mark_recommendation_claimed_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.MarkRecommendationClaimedRequest() - assert args[0] == request_msg @@ -9612,7 +9629,6 @@ async def test_mark_recommendation_succeeded_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.MarkRecommendationSucceededRequest() - assert args[0] == request_msg @@ -9646,7 +9662,6 @@ async def test_mark_recommendation_failed_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.MarkRecommendationFailedRequest() - assert args[0] == request_msg @@ -9678,7 +9693,6 @@ async def test_get_recommender_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.GetRecommenderConfigRequest() - assert args[0] == request_msg @@ -9710,7 +9724,6 @@ async def test_update_recommender_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.UpdateRecommenderConfigRequest() - assert args[0] == request_msg @@ -9742,7 +9755,6 @@ async def test_get_insight_type_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.GetInsightTypeConfigRequest() - assert args[0] == request_msg @@ -9774,7 +9786,6 @@ async def test_update_insight_type_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.UpdateInsightTypeConfigRequest() - assert args[0] == request_msg @@ -11855,7 +11866,6 @@ def test_list_insights_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.ListInsightsRequest() - assert args[0] == request_msg @@ -11875,7 +11885,6 @@ def test_get_insight_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.GetInsightRequest() - assert args[0] == request_msg @@ -11897,7 +11906,6 @@ def test_mark_insight_accepted_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.MarkInsightAcceptedRequest() - assert args[0] == request_msg @@ -11919,7 +11927,6 @@ def test_list_recommendations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.ListRecommendationsRequest() - assert args[0] == request_msg @@ -11941,7 +11948,6 @@ def test_get_recommendation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.GetRecommendationRequest() - assert args[0] == request_msg @@ -11963,7 +11969,6 @@ def test_mark_recommendation_dismissed_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.MarkRecommendationDismissedRequest() - assert args[0] == request_msg @@ -11985,7 +11990,6 @@ def test_mark_recommendation_claimed_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.MarkRecommendationClaimedRequest() - assert args[0] == request_msg @@ -12007,7 +12011,6 @@ def test_mark_recommendation_succeeded_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.MarkRecommendationSucceededRequest() - assert args[0] == request_msg @@ -12029,7 +12032,6 @@ def test_mark_recommendation_failed_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.MarkRecommendationFailedRequest() - assert args[0] == request_msg @@ -12051,7 +12053,6 @@ def test_get_recommender_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.GetRecommenderConfigRequest() - assert args[0] == request_msg @@ -12073,7 +12074,6 @@ def test_update_recommender_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.UpdateRecommenderConfigRequest() - assert args[0] == request_msg @@ -12095,7 +12095,6 @@ def test_get_insight_type_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.GetInsightTypeConfigRequest() - assert args[0] == request_msg @@ -12117,7 +12116,6 @@ def test_update_insight_type_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.UpdateInsightTypeConfigRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-recommender/tests/unit/gapic/recommender_v1beta1/test_recommender.py b/packages/google-cloud-recommender/tests/unit/gapic/recommender_v1beta1/test_recommender.py index 4c3e45fd9617..9ff26baf34cc 100644 --- a/packages/google-cloud-recommender/tests/unit/gapic/recommender_v1beta1/test_recommender.py +++ b/packages/google-cloud-recommender/tests/unit/gapic/recommender_v1beta1/test_recommender.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 @@ -123,6 +124,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" @@ -1288,8 +1304,8 @@ def test_recommender_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - recommender_service.ListInsightsRequest, - dict, + recommender_service.ListInsightsRequest(), + {}, ], ) def test_list_insights(request_type, transport: str = "grpc"): @@ -1300,7 +1316,7 @@ def test_list_insights(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_insights), "__call__") as call: @@ -1346,11 +1362,12 @@ def test_list_insights_non_empty_request_with_auto_populated_field(): client.list_insights(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == recommender_service.ListInsightsRequest( + request_msg = recommender_service.ListInsightsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_insights_use_cached_wrapped_rpc(): @@ -1431,10 +1448,14 @@ async def test_list_insights_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_insights_async( - transport: str = "grpc_asyncio", - request_type=recommender_service.ListInsightsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + recommender_service.ListInsightsRequest(), + {}, + ], +) +async def test_list_insights_async(request_type, transport: str = "grpc_asyncio"): client = RecommenderAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1442,7 +1463,7 @@ async def test_list_insights_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_insights), "__call__") as call: @@ -1465,11 +1486,6 @@ async def test_list_insights_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_insights_async_from_dict(): - await test_list_insights_async(request_type=dict) - - def test_list_insights_field_headers(): client = RecommenderClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1806,8 +1822,8 @@ async def test_list_insights_async_pages(): @pytest.mark.parametrize( "request_type", [ - recommender_service.GetInsightRequest, - dict, + recommender_service.GetInsightRequest(), + {}, ], ) def test_get_insight(request_type, transport: str = "grpc"): @@ -1818,7 +1834,7 @@ def test_get_insight(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_insight), "__call__") as call: @@ -1874,9 +1890,10 @@ def test_get_insight_non_empty_request_with_auto_populated_field(): client.get_insight(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == recommender_service.GetInsightRequest( + request_msg = recommender_service.GetInsightRequest( name="name_value", ) + assert args[0] == request_msg def test_get_insight_use_cached_wrapped_rpc(): @@ -1957,9 +1974,14 @@ async def test_get_insight_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_insight_async( - transport: str = "grpc_asyncio", request_type=recommender_service.GetInsightRequest -): +@pytest.mark.parametrize( + "request_type", + [ + recommender_service.GetInsightRequest(), + {}, + ], +) +async def test_get_insight_async(request_type, transport: str = "grpc_asyncio"): client = RecommenderAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1967,7 +1989,7 @@ async def test_get_insight_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_insight), "__call__") as call: @@ -2002,11 +2024,6 @@ async def test_get_insight_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_insight_async_from_dict(): - await test_get_insight_async(request_type=dict) - - def test_get_insight_field_headers(): client = RecommenderClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2149,8 +2166,8 @@ async def test_get_insight_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - recommender_service.MarkInsightAcceptedRequest, - dict, + recommender_service.MarkInsightAcceptedRequest(), + {}, ], ) def test_mark_insight_accepted(request_type, transport: str = "grpc"): @@ -2161,7 +2178,7 @@ def test_mark_insight_accepted(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2222,10 +2239,11 @@ def test_mark_insight_accepted_non_empty_request_with_auto_populated_field(): client.mark_insight_accepted(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == recommender_service.MarkInsightAcceptedRequest( + request_msg = recommender_service.MarkInsightAcceptedRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_mark_insight_accepted_use_cached_wrapped_rpc(): @@ -2311,9 +2329,15 @@ async def test_mark_insight_accepted_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + recommender_service.MarkInsightAcceptedRequest(), + {}, + ], +) async def test_mark_insight_accepted_async( - transport: str = "grpc_asyncio", - request_type=recommender_service.MarkInsightAcceptedRequest, + request_type, transport: str = "grpc_asyncio" ): client = RecommenderAsyncClient( credentials=async_anonymous_credentials(), @@ -2322,7 +2346,7 @@ async def test_mark_insight_accepted_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( @@ -2359,11 +2383,6 @@ async def test_mark_insight_accepted_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_mark_insight_accepted_async_from_dict(): - await test_mark_insight_accepted_async(request_type=dict) - - def test_mark_insight_accepted_field_headers(): client = RecommenderClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2534,8 +2553,8 @@ async def test_mark_insight_accepted_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - recommender_service.ListRecommendationsRequest, - dict, + recommender_service.ListRecommendationsRequest(), + {}, ], ) def test_list_recommendations(request_type, transport: str = "grpc"): @@ -2546,7 +2565,7 @@ def test_list_recommendations(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2596,11 +2615,12 @@ def test_list_recommendations_non_empty_request_with_auto_populated_field(): client.list_recommendations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == recommender_service.ListRecommendationsRequest( + request_msg = recommender_service.ListRecommendationsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_recommendations_use_cached_wrapped_rpc(): @@ -2685,9 +2705,15 @@ async def test_list_recommendations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + recommender_service.ListRecommendationsRequest(), + {}, + ], +) async def test_list_recommendations_async( - transport: str = "grpc_asyncio", - request_type=recommender_service.ListRecommendationsRequest, + request_type, transport: str = "grpc_asyncio" ): client = RecommenderAsyncClient( credentials=async_anonymous_credentials(), @@ -2696,7 +2722,7 @@ async def test_list_recommendations_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( @@ -2721,11 +2747,6 @@ async def test_list_recommendations_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_recommendations_async_from_dict(): - await test_list_recommendations_async(request_type=dict) - - def test_list_recommendations_field_headers(): client = RecommenderClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3088,8 +3109,8 @@ async def test_list_recommendations_async_pages(): @pytest.mark.parametrize( "request_type", [ - recommender_service.GetRecommendationRequest, - dict, + recommender_service.GetRecommendationRequest(), + {}, ], ) def test_get_recommendation(request_type, transport: str = "grpc"): @@ -3100,7 +3121,7 @@ def test_get_recommendation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3158,9 +3179,10 @@ def test_get_recommendation_non_empty_request_with_auto_populated_field(): client.get_recommendation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == recommender_service.GetRecommendationRequest( + request_msg = recommender_service.GetRecommendationRequest( name="name_value", ) + assert args[0] == request_msg def test_get_recommendation_use_cached_wrapped_rpc(): @@ -3245,10 +3267,14 @@ async def test_get_recommendation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_recommendation_async( - transport: str = "grpc_asyncio", - request_type=recommender_service.GetRecommendationRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + recommender_service.GetRecommendationRequest(), + {}, + ], +) +async def test_get_recommendation_async(request_type, transport: str = "grpc_asyncio"): client = RecommenderAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3256,7 +3282,7 @@ async def test_get_recommendation_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( @@ -3291,11 +3317,6 @@ async def test_get_recommendation_async( assert response.xor_group_id == "xor_group_id_value" -@pytest.mark.asyncio -async def test_get_recommendation_async_from_dict(): - await test_get_recommendation_async(request_type=dict) - - def test_get_recommendation_field_headers(): client = RecommenderClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3450,8 +3471,8 @@ async def test_get_recommendation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - recommender_service.MarkRecommendationClaimedRequest, - dict, + recommender_service.MarkRecommendationClaimedRequest(), + {}, ], ) def test_mark_recommendation_claimed(request_type, transport: str = "grpc"): @@ -3462,7 +3483,7 @@ def test_mark_recommendation_claimed(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3521,10 +3542,11 @@ def test_mark_recommendation_claimed_non_empty_request_with_auto_populated_field client.mark_recommendation_claimed(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == recommender_service.MarkRecommendationClaimedRequest( + request_msg = recommender_service.MarkRecommendationClaimedRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_mark_recommendation_claimed_use_cached_wrapped_rpc(): @@ -3610,9 +3632,15 @@ async def test_mark_recommendation_claimed_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + recommender_service.MarkRecommendationClaimedRequest(), + {}, + ], +) async def test_mark_recommendation_claimed_async( - transport: str = "grpc_asyncio", - request_type=recommender_service.MarkRecommendationClaimedRequest, + request_type, transport: str = "grpc_asyncio" ): client = RecommenderAsyncClient( credentials=async_anonymous_credentials(), @@ -3621,7 +3649,7 @@ async def test_mark_recommendation_claimed_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( @@ -3656,11 +3684,6 @@ async def test_mark_recommendation_claimed_async( assert response.xor_group_id == "xor_group_id_value" -@pytest.mark.asyncio -async def test_mark_recommendation_claimed_async_from_dict(): - await test_mark_recommendation_claimed_async(request_type=dict) - - def test_mark_recommendation_claimed_field_headers(): client = RecommenderClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3835,8 +3858,8 @@ async def test_mark_recommendation_claimed_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - recommender_service.MarkRecommendationSucceededRequest, - dict, + recommender_service.MarkRecommendationSucceededRequest(), + {}, ], ) def test_mark_recommendation_succeeded(request_type, transport: str = "grpc"): @@ -3847,7 +3870,7 @@ def test_mark_recommendation_succeeded(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3906,10 +3929,11 @@ def test_mark_recommendation_succeeded_non_empty_request_with_auto_populated_fie client.mark_recommendation_succeeded(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == recommender_service.MarkRecommendationSucceededRequest( + request_msg = recommender_service.MarkRecommendationSucceededRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_mark_recommendation_succeeded_use_cached_wrapped_rpc(): @@ -3995,9 +4019,15 @@ async def test_mark_recommendation_succeeded_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + recommender_service.MarkRecommendationSucceededRequest(), + {}, + ], +) async def test_mark_recommendation_succeeded_async( - transport: str = "grpc_asyncio", - request_type=recommender_service.MarkRecommendationSucceededRequest, + request_type, transport: str = "grpc_asyncio" ): client = RecommenderAsyncClient( credentials=async_anonymous_credentials(), @@ -4006,7 +4036,7 @@ async def test_mark_recommendation_succeeded_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( @@ -4041,11 +4071,6 @@ async def test_mark_recommendation_succeeded_async( assert response.xor_group_id == "xor_group_id_value" -@pytest.mark.asyncio -async def test_mark_recommendation_succeeded_async_from_dict(): - await test_mark_recommendation_succeeded_async(request_type=dict) - - def test_mark_recommendation_succeeded_field_headers(): client = RecommenderClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4220,8 +4245,8 @@ async def test_mark_recommendation_succeeded_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - recommender_service.MarkRecommendationFailedRequest, - dict, + recommender_service.MarkRecommendationFailedRequest(), + {}, ], ) def test_mark_recommendation_failed(request_type, transport: str = "grpc"): @@ -4232,7 +4257,7 @@ def test_mark_recommendation_failed(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4291,10 +4316,11 @@ def test_mark_recommendation_failed_non_empty_request_with_auto_populated_field( client.mark_recommendation_failed(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == recommender_service.MarkRecommendationFailedRequest( + request_msg = recommender_service.MarkRecommendationFailedRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_mark_recommendation_failed_use_cached_wrapped_rpc(): @@ -4380,9 +4406,15 @@ async def test_mark_recommendation_failed_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + recommender_service.MarkRecommendationFailedRequest(), + {}, + ], +) async def test_mark_recommendation_failed_async( - transport: str = "grpc_asyncio", - request_type=recommender_service.MarkRecommendationFailedRequest, + request_type, transport: str = "grpc_asyncio" ): client = RecommenderAsyncClient( credentials=async_anonymous_credentials(), @@ -4391,7 +4423,7 @@ async def test_mark_recommendation_failed_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( @@ -4426,11 +4458,6 @@ async def test_mark_recommendation_failed_async( assert response.xor_group_id == "xor_group_id_value" -@pytest.mark.asyncio -async def test_mark_recommendation_failed_async_from_dict(): - await test_mark_recommendation_failed_async(request_type=dict) - - def test_mark_recommendation_failed_field_headers(): client = RecommenderClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4605,8 +4632,8 @@ async def test_mark_recommendation_failed_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - recommender_service.GetRecommenderConfigRequest, - dict, + recommender_service.GetRecommenderConfigRequest(), + {}, ], ) def test_get_recommender_config(request_type, transport: str = "grpc"): @@ -4617,7 +4644,7 @@ def test_get_recommender_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( @@ -4671,9 +4698,10 @@ def test_get_recommender_config_non_empty_request_with_auto_populated_field(): client.get_recommender_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == recommender_service.GetRecommenderConfigRequest( + request_msg = recommender_service.GetRecommenderConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_recommender_config_use_cached_wrapped_rpc(): @@ -4759,9 +4787,15 @@ async def test_get_recommender_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + recommender_service.GetRecommenderConfigRequest(), + {}, + ], +) async def test_get_recommender_config_async( - transport: str = "grpc_asyncio", - request_type=recommender_service.GetRecommenderConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = RecommenderAsyncClient( credentials=async_anonymous_credentials(), @@ -4770,7 +4804,7 @@ async def test_get_recommender_config_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( @@ -4801,11 +4835,6 @@ async def test_get_recommender_config_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_get_recommender_config_async_from_dict(): - await test_get_recommender_config_async(request_type=dict) - - def test_get_recommender_config_field_headers(): client = RecommenderClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4960,8 +4989,8 @@ async def test_get_recommender_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - recommender_service.UpdateRecommenderConfigRequest, - dict, + recommender_service.UpdateRecommenderConfigRequest(), + {}, ], ) def test_update_recommender_config(request_type, transport: str = "grpc"): @@ -4972,7 +5001,7 @@ def test_update_recommender_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( @@ -5024,7 +5053,8 @@ def test_update_recommender_config_non_empty_request_with_auto_populated_field() client.update_recommender_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == recommender_service.UpdateRecommenderConfigRequest() + request_msg = recommender_service.UpdateRecommenderConfigRequest() + assert args[0] == request_msg def test_update_recommender_config_use_cached_wrapped_rpc(): @@ -5110,9 +5140,15 @@ async def test_update_recommender_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + recommender_service.UpdateRecommenderConfigRequest(), + {}, + ], +) async def test_update_recommender_config_async( - transport: str = "grpc_asyncio", - request_type=recommender_service.UpdateRecommenderConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = RecommenderAsyncClient( credentials=async_anonymous_credentials(), @@ -5121,7 +5157,7 @@ async def test_update_recommender_config_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( @@ -5152,11 +5188,6 @@ async def test_update_recommender_config_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_update_recommender_config_async_from_dict(): - await test_update_recommender_config_async(request_type=dict) - - def test_update_recommender_config_field_headers(): client = RecommenderClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5329,8 +5360,8 @@ async def test_update_recommender_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - recommender_service.GetInsightTypeConfigRequest, - dict, + recommender_service.GetInsightTypeConfigRequest(), + {}, ], ) def test_get_insight_type_config(request_type, transport: str = "grpc"): @@ -5341,7 +5372,7 @@ def test_get_insight_type_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( @@ -5395,9 +5426,10 @@ def test_get_insight_type_config_non_empty_request_with_auto_populated_field(): client.get_insight_type_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == recommender_service.GetInsightTypeConfigRequest( + request_msg = recommender_service.GetInsightTypeConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_insight_type_config_use_cached_wrapped_rpc(): @@ -5483,9 +5515,15 @@ async def test_get_insight_type_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + recommender_service.GetInsightTypeConfigRequest(), + {}, + ], +) async def test_get_insight_type_config_async( - transport: str = "grpc_asyncio", - request_type=recommender_service.GetInsightTypeConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = RecommenderAsyncClient( credentials=async_anonymous_credentials(), @@ -5494,7 +5532,7 @@ async def test_get_insight_type_config_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( @@ -5525,11 +5563,6 @@ async def test_get_insight_type_config_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_get_insight_type_config_async_from_dict(): - await test_get_insight_type_config_async(request_type=dict) - - def test_get_insight_type_config_field_headers(): client = RecommenderClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5684,8 +5717,8 @@ async def test_get_insight_type_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - recommender_service.UpdateInsightTypeConfigRequest, - dict, + recommender_service.UpdateInsightTypeConfigRequest(), + {}, ], ) def test_update_insight_type_config(request_type, transport: str = "grpc"): @@ -5696,7 +5729,7 @@ def test_update_insight_type_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( @@ -5748,7 +5781,8 @@ def test_update_insight_type_config_non_empty_request_with_auto_populated_field( client.update_insight_type_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == recommender_service.UpdateInsightTypeConfigRequest() + request_msg = recommender_service.UpdateInsightTypeConfigRequest() + assert args[0] == request_msg def test_update_insight_type_config_use_cached_wrapped_rpc(): @@ -5834,9 +5868,15 @@ async def test_update_insight_type_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + recommender_service.UpdateInsightTypeConfigRequest(), + {}, + ], +) async def test_update_insight_type_config_async( - transport: str = "grpc_asyncio", - request_type=recommender_service.UpdateInsightTypeConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = RecommenderAsyncClient( credentials=async_anonymous_credentials(), @@ -5845,7 +5885,7 @@ async def test_update_insight_type_config_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( @@ -5876,11 +5916,6 @@ async def test_update_insight_type_config_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_update_insight_type_config_async_from_dict(): - await test_update_insight_type_config_async(request_type=dict) - - def test_update_insight_type_config_field_headers(): client = RecommenderClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6053,8 +6088,8 @@ async def test_update_insight_type_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - recommender_service.ListRecommendersRequest, - dict, + recommender_service.ListRecommendersRequest(), + {}, ], ) def test_list_recommenders(request_type, transport: str = "grpc"): @@ -6065,7 +6100,7 @@ def test_list_recommenders(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6113,9 +6148,10 @@ def test_list_recommenders_non_empty_request_with_auto_populated_field(): client.list_recommenders(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == recommender_service.ListRecommendersRequest( + request_msg = recommender_service.ListRecommendersRequest( page_token="page_token_value", ) + assert args[0] == request_msg def test_list_recommenders_use_cached_wrapped_rpc(): @@ -6198,10 +6234,14 @@ async def test_list_recommenders_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_recommenders_async( - transport: str = "grpc_asyncio", - request_type=recommender_service.ListRecommendersRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + recommender_service.ListRecommendersRequest(), + {}, + ], +) +async def test_list_recommenders_async(request_type, transport: str = "grpc_asyncio"): client = RecommenderAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6209,7 +6249,7 @@ async def test_list_recommenders_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( @@ -6234,11 +6274,6 @@ async def test_list_recommenders_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_recommenders_async_from_dict(): - await test_list_recommenders_async(request_type=dict) - - def test_list_recommenders_pager(transport_name: str = "grpc"): client = RecommenderClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6437,8 +6472,8 @@ async def test_list_recommenders_async_pages(): @pytest.mark.parametrize( "request_type", [ - recommender_service.ListInsightTypesRequest, - dict, + recommender_service.ListInsightTypesRequest(), + {}, ], ) def test_list_insight_types(request_type, transport: str = "grpc"): @@ -6449,7 +6484,7 @@ def test_list_insight_types(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6497,9 +6532,10 @@ def test_list_insight_types_non_empty_request_with_auto_populated_field(): client.list_insight_types(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == recommender_service.ListInsightTypesRequest( + request_msg = recommender_service.ListInsightTypesRequest( page_token="page_token_value", ) + assert args[0] == request_msg def test_list_insight_types_use_cached_wrapped_rpc(): @@ -6584,10 +6620,14 @@ async def test_list_insight_types_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_insight_types_async( - transport: str = "grpc_asyncio", - request_type=recommender_service.ListInsightTypesRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + recommender_service.ListInsightTypesRequest(), + {}, + ], +) +async def test_list_insight_types_async(request_type, transport: str = "grpc_asyncio"): client = RecommenderAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6595,7 +6635,7 @@ async def test_list_insight_types_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( @@ -6620,11 +6660,6 @@ async def test_list_insight_types_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_insight_types_async_from_dict(): - await test_list_insight_types_async(request_type=dict) - - def test_list_insight_types_pager(transport_name: str = "grpc"): client = RecommenderClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9631,7 +9666,6 @@ def test_list_insights_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.ListInsightsRequest() - assert args[0] == request_msg @@ -9652,7 +9686,6 @@ def test_get_insight_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.GetInsightRequest() - assert args[0] == request_msg @@ -9675,7 +9708,6 @@ def test_mark_insight_accepted_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.MarkInsightAcceptedRequest() - assert args[0] == request_msg @@ -9698,7 +9730,6 @@ def test_list_recommendations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.ListRecommendationsRequest() - assert args[0] == request_msg @@ -9721,7 +9752,6 @@ def test_get_recommendation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.GetRecommendationRequest() - assert args[0] == request_msg @@ -9744,7 +9774,6 @@ def test_mark_recommendation_claimed_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.MarkRecommendationClaimedRequest() - assert args[0] == request_msg @@ -9767,7 +9796,6 @@ def test_mark_recommendation_succeeded_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.MarkRecommendationSucceededRequest() - assert args[0] == request_msg @@ -9790,7 +9818,6 @@ def test_mark_recommendation_failed_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.MarkRecommendationFailedRequest() - assert args[0] == request_msg @@ -9813,7 +9840,6 @@ def test_get_recommender_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.GetRecommenderConfigRequest() - assert args[0] == request_msg @@ -9836,7 +9862,6 @@ def test_update_recommender_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.UpdateRecommenderConfigRequest() - assert args[0] == request_msg @@ -9859,7 +9884,6 @@ def test_get_insight_type_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.GetInsightTypeConfigRequest() - assert args[0] == request_msg @@ -9882,7 +9906,6 @@ def test_update_insight_type_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.UpdateInsightTypeConfigRequest() - assert args[0] == request_msg @@ -9905,7 +9928,6 @@ def test_list_recommenders_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.ListRecommendersRequest() - assert args[0] == request_msg @@ -9928,7 +9950,6 @@ def test_list_insight_types_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.ListInsightTypesRequest() - assert args[0] == request_msg @@ -9969,7 +9990,6 @@ async def test_list_insights_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.ListInsightsRequest() - assert args[0] == request_msg @@ -10002,7 +10022,6 @@ async def test_get_insight_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.GetInsightRequest() - assert args[0] == request_msg @@ -10037,7 +10056,6 @@ async def test_mark_insight_accepted_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.MarkInsightAcceptedRequest() - assert args[0] == request_msg @@ -10066,7 +10084,6 @@ async def test_list_recommendations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.ListRecommendationsRequest() - assert args[0] == request_msg @@ -10100,7 +10117,6 @@ async def test_get_recommendation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.GetRecommendationRequest() - assert args[0] == request_msg @@ -10134,7 +10150,6 @@ async def test_mark_recommendation_claimed_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.MarkRecommendationClaimedRequest() - assert args[0] == request_msg @@ -10168,7 +10183,6 @@ async def test_mark_recommendation_succeeded_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.MarkRecommendationSucceededRequest() - assert args[0] == request_msg @@ -10202,7 +10216,6 @@ async def test_mark_recommendation_failed_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.MarkRecommendationFailedRequest() - assert args[0] == request_msg @@ -10234,7 +10247,6 @@ async def test_get_recommender_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.GetRecommenderConfigRequest() - assert args[0] == request_msg @@ -10266,7 +10278,6 @@ async def test_update_recommender_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.UpdateRecommenderConfigRequest() - assert args[0] == request_msg @@ -10298,7 +10309,6 @@ async def test_get_insight_type_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.GetInsightTypeConfigRequest() - assert args[0] == request_msg @@ -10330,7 +10340,6 @@ async def test_update_insight_type_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.UpdateInsightTypeConfigRequest() - assert args[0] == request_msg @@ -10359,7 +10368,6 @@ async def test_list_recommenders_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.ListRecommendersRequest() - assert args[0] == request_msg @@ -10388,7 +10396,6 @@ async def test_list_insight_types_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.ListInsightTypesRequest() - assert args[0] == request_msg @@ -12594,7 +12601,6 @@ def test_list_insights_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.ListInsightsRequest() - assert args[0] == request_msg @@ -12614,7 +12620,6 @@ def test_get_insight_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.GetInsightRequest() - assert args[0] == request_msg @@ -12636,7 +12641,6 @@ def test_mark_insight_accepted_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.MarkInsightAcceptedRequest() - assert args[0] == request_msg @@ -12658,7 +12662,6 @@ def test_list_recommendations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.ListRecommendationsRequest() - assert args[0] == request_msg @@ -12680,7 +12683,6 @@ def test_get_recommendation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.GetRecommendationRequest() - assert args[0] == request_msg @@ -12702,7 +12704,6 @@ def test_mark_recommendation_claimed_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.MarkRecommendationClaimedRequest() - assert args[0] == request_msg @@ -12724,7 +12725,6 @@ def test_mark_recommendation_succeeded_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.MarkRecommendationSucceededRequest() - assert args[0] == request_msg @@ -12746,7 +12746,6 @@ def test_mark_recommendation_failed_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.MarkRecommendationFailedRequest() - assert args[0] == request_msg @@ -12768,7 +12767,6 @@ def test_get_recommender_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.GetRecommenderConfigRequest() - assert args[0] == request_msg @@ -12790,7 +12788,6 @@ def test_update_recommender_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.UpdateRecommenderConfigRequest() - assert args[0] == request_msg @@ -12812,7 +12809,6 @@ def test_get_insight_type_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.GetInsightTypeConfigRequest() - assert args[0] == request_msg @@ -12834,7 +12830,6 @@ def test_update_insight_type_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.UpdateInsightTypeConfigRequest() - assert args[0] == request_msg @@ -12856,7 +12851,6 @@ def test_list_recommenders_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.ListRecommendersRequest() - assert args[0] == request_msg @@ -12878,7 +12872,6 @@ def test_list_insight_types_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = recommender_service.ListInsightTypesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-redis-cluster/noxfile.py b/packages/google-cloud-redis-cluster/noxfile.py index 28b5ff4b013d..04445b2b2ed8 100644 --- a/packages/google-cloud-redis-cluster/noxfile.py +++ b/packages/google-cloud-redis-cluster/noxfile.py @@ -47,7 +47,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-cluster" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-redis-cluster/setup.py b/packages/google-cloud-redis-cluster/setup.py index 77c9bfba18a7..9c6a891cd9fb 100644 --- a/packages/google-cloud-redis-cluster/setup.py +++ b/packages/google-cloud-redis-cluster/setup.py @@ -45,7 +45,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/google-cloud-redis-cluster/testing/constraints-3.10.txt b/packages/google-cloud-redis-cluster/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-redis-cluster/testing/constraints-3.10.txt +++ b/packages/google-cloud-redis-cluster/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-redis-cluster/tests/unit/gapic/redis_cluster_v1/test_cloud_redis_cluster.py b/packages/google-cloud-redis-cluster/tests/unit/gapic/redis_cluster_v1/test_cloud_redis_cluster.py index eb89daed6ede..9a91218de446 100644 --- a/packages/google-cloud-redis-cluster/tests/unit/gapic/redis_cluster_v1/test_cloud_redis_cluster.py +++ b/packages/google-cloud-redis-cluster/tests/unit/gapic/redis_cluster_v1/test_cloud_redis_cluster.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 @@ -120,6 +121,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" @@ -1361,8 +1377,8 @@ def test_cloud_redis_cluster_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - cloud_redis_cluster.ListClustersRequest, - dict, + cloud_redis_cluster.ListClustersRequest(), + {}, ], ) def test_list_clusters(request_type, transport: str = "grpc"): @@ -1373,7 +1389,7 @@ def test_list_clusters(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_clusters), "__call__") as call: @@ -1420,10 +1436,11 @@ def test_list_clusters_non_empty_request_with_auto_populated_field(): client.list_clusters(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_redis_cluster.ListClustersRequest( + request_msg = cloud_redis_cluster.ListClustersRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_clusters_use_cached_wrapped_rpc(): @@ -1504,10 +1521,14 @@ async def test_list_clusters_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_clusters_async( - transport: str = "grpc_asyncio", - request_type=cloud_redis_cluster.ListClustersRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_redis_cluster.ListClustersRequest(), + {}, + ], +) +async def test_list_clusters_async(request_type, transport: str = "grpc_asyncio"): client = CloudRedisClusterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1515,7 +1536,7 @@ async def test_list_clusters_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_clusters), "__call__") as call: @@ -1540,11 +1561,6 @@ async def test_list_clusters_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_clusters_async_from_dict(): - await test_list_clusters_async(request_type=dict) - - def test_list_clusters_field_headers(): client = CloudRedisClusterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1881,8 +1897,8 @@ async def test_list_clusters_async_pages(): @pytest.mark.parametrize( "request_type", [ - cloud_redis_cluster.GetClusterRequest, - dict, + cloud_redis_cluster.GetClusterRequest(), + {}, ], ) def test_get_cluster(request_type, transport: str = "grpc"): @@ -1893,7 +1909,7 @@ def test_get_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_cluster), "__call__") as call: @@ -1976,9 +1992,10 @@ def test_get_cluster_non_empty_request_with_auto_populated_field(): client.get_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_redis_cluster.GetClusterRequest( + request_msg = cloud_redis_cluster.GetClusterRequest( name="name_value", ) + assert args[0] == request_msg def test_get_cluster_use_cached_wrapped_rpc(): @@ -2059,9 +2076,14 @@ async def test_get_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_cluster_async( - transport: str = "grpc_asyncio", request_type=cloud_redis_cluster.GetClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_redis_cluster.GetClusterRequest(), + {}, + ], +) +async def test_get_cluster_async(request_type, transport: str = "grpc_asyncio"): client = CloudRedisClusterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2069,7 +2091,7 @@ async def test_get_cluster_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_cluster), "__call__") as call: @@ -2131,11 +2153,6 @@ async def test_get_cluster_async( assert response.rotate_server_certificate is True -@pytest.mark.asyncio -async def test_get_cluster_async_from_dict(): - await test_get_cluster_async(request_type=dict) - - def test_get_cluster_field_headers(): client = CloudRedisClusterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2282,8 +2299,8 @@ async def test_get_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_redis_cluster.UpdateClusterRequest, - dict, + cloud_redis_cluster.UpdateClusterRequest(), + {}, ], ) def test_update_cluster(request_type, transport: str = "grpc"): @@ -2294,7 +2311,7 @@ def test_update_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_cluster), "__call__") as call: @@ -2335,9 +2352,10 @@ def test_update_cluster_non_empty_request_with_auto_populated_field(): client.update_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_redis_cluster.UpdateClusterRequest( + request_msg = cloud_redis_cluster.UpdateClusterRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_cluster_use_cached_wrapped_rpc(): @@ -2428,10 +2446,14 @@ async def test_update_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_cluster_async( - transport: str = "grpc_asyncio", - request_type=cloud_redis_cluster.UpdateClusterRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_redis_cluster.UpdateClusterRequest(), + {}, + ], +) +async def test_update_cluster_async(request_type, transport: str = "grpc_asyncio"): client = CloudRedisClusterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2439,7 +2461,7 @@ async def test_update_cluster_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_cluster), "__call__") as call: @@ -2459,11 +2481,6 @@ async def test_update_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_cluster_async_from_dict(): - await test_update_cluster_async(request_type=dict) - - def test_update_cluster_field_headers(): client = CloudRedisClusterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2640,8 +2657,8 @@ async def test_update_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_redis_cluster.DeleteClusterRequest, - dict, + cloud_redis_cluster.DeleteClusterRequest(), + {}, ], ) def test_delete_cluster(request_type, transport: str = "grpc"): @@ -2652,7 +2669,7 @@ def test_delete_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_cluster), "__call__") as call: @@ -2694,10 +2711,11 @@ def test_delete_cluster_non_empty_request_with_auto_populated_field(): client.delete_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_redis_cluster.DeleteClusterRequest( + request_msg = cloud_redis_cluster.DeleteClusterRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_cluster_use_cached_wrapped_rpc(): @@ -2788,10 +2806,14 @@ async def test_delete_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_cluster_async( - transport: str = "grpc_asyncio", - request_type=cloud_redis_cluster.DeleteClusterRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_redis_cluster.DeleteClusterRequest(), + {}, + ], +) +async def test_delete_cluster_async(request_type, transport: str = "grpc_asyncio"): client = CloudRedisClusterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2799,7 +2821,7 @@ async def test_delete_cluster_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_cluster), "__call__") as call: @@ -2819,11 +2841,6 @@ async def test_delete_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_cluster_async_from_dict(): - await test_delete_cluster_async(request_type=dict) - - def test_delete_cluster_field_headers(): client = CloudRedisClusterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2970,8 +2987,8 @@ async def test_delete_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_redis_cluster.CreateClusterRequest, - dict, + cloud_redis_cluster.CreateClusterRequest(), + {}, ], ) def test_create_cluster(request_type, transport: str = "grpc"): @@ -2982,7 +2999,7 @@ def test_create_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_cluster), "__call__") as call: @@ -3025,11 +3042,12 @@ def test_create_cluster_non_empty_request_with_auto_populated_field(): client.create_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_redis_cluster.CreateClusterRequest( + request_msg = cloud_redis_cluster.CreateClusterRequest( parent="parent_value", cluster_id="cluster_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_cluster_use_cached_wrapped_rpc(): @@ -3120,10 +3138,14 @@ async def test_create_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_cluster_async( - transport: str = "grpc_asyncio", - request_type=cloud_redis_cluster.CreateClusterRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_redis_cluster.CreateClusterRequest(), + {}, + ], +) +async def test_create_cluster_async(request_type, transport: str = "grpc_asyncio"): client = CloudRedisClusterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3131,7 +3153,7 @@ async def test_create_cluster_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_cluster), "__call__") as call: @@ -3151,11 +3173,6 @@ async def test_create_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_cluster_async_from_dict(): - await test_create_cluster_async(request_type=dict) - - def test_create_cluster_field_headers(): client = CloudRedisClusterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3342,8 +3359,8 @@ async def test_create_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_redis_cluster.GetClusterCertificateAuthorityRequest, - dict, + cloud_redis_cluster.GetClusterCertificateAuthorityRequest(), + {}, ], ) def test_get_cluster_certificate_authority(request_type, transport: str = "grpc"): @@ -3354,7 +3371,7 @@ def test_get_cluster_certificate_authority(request_type, transport: str = "grpc" # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3402,9 +3419,10 @@ def test_get_cluster_certificate_authority_non_empty_request_with_auto_populated client.get_cluster_certificate_authority(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_redis_cluster.GetClusterCertificateAuthorityRequest( + request_msg = cloud_redis_cluster.GetClusterCertificateAuthorityRequest( name="name_value", ) + assert args[0] == request_msg def test_get_cluster_certificate_authority_use_cached_wrapped_rpc(): @@ -3490,9 +3508,15 @@ async def test_get_cluster_certificate_authority_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloud_redis_cluster.GetClusterCertificateAuthorityRequest(), + {}, + ], +) async def test_get_cluster_certificate_authority_async( - transport: str = "grpc_asyncio", - request_type=cloud_redis_cluster.GetClusterCertificateAuthorityRequest, + request_type, transport: str = "grpc_asyncio" ): client = CloudRedisClusterAsyncClient( credentials=async_anonymous_credentials(), @@ -3501,7 +3525,7 @@ async def test_get_cluster_certificate_authority_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( @@ -3526,11 +3550,6 @@ async def test_get_cluster_certificate_authority_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_cluster_certificate_authority_async_from_dict(): - await test_get_cluster_certificate_authority_async(request_type=dict) - - def test_get_cluster_certificate_authority_field_headers(): client = CloudRedisClusterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3685,8 +3704,8 @@ async def test_get_cluster_certificate_authority_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_redis_cluster.GetSharedRegionalCertificateAuthorityRequest, - dict, + cloud_redis_cluster.GetSharedRegionalCertificateAuthorityRequest(), + {}, ], ) def test_get_shared_regional_certificate_authority( @@ -3699,7 +3718,7 @@ def test_get_shared_regional_certificate_authority( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3747,11 +3766,10 @@ def test_get_shared_regional_certificate_authority_non_empty_request_with_auto_p client.get_shared_regional_certificate_authority(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == cloud_redis_cluster.GetSharedRegionalCertificateAuthorityRequest( + request_msg = cloud_redis_cluster.GetSharedRegionalCertificateAuthorityRequest( name="name_value", ) + assert args[0] == request_msg def test_get_shared_regional_certificate_authority_use_cached_wrapped_rpc(): @@ -3837,9 +3855,15 @@ async def test_get_shared_regional_certificate_authority_async_use_cached_wrappe @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloud_redis_cluster.GetSharedRegionalCertificateAuthorityRequest(), + {}, + ], +) async def test_get_shared_regional_certificate_authority_async( - transport: str = "grpc_asyncio", - request_type=cloud_redis_cluster.GetSharedRegionalCertificateAuthorityRequest, + request_type, transport: str = "grpc_asyncio" ): client = CloudRedisClusterAsyncClient( credentials=async_anonymous_credentials(), @@ -3848,7 +3872,7 @@ async def test_get_shared_regional_certificate_authority_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( @@ -3873,11 +3897,6 @@ async def test_get_shared_regional_certificate_authority_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_shared_regional_certificate_authority_async_from_dict(): - await test_get_shared_regional_certificate_authority_async(request_type=dict) - - def test_get_shared_regional_certificate_authority_field_headers(): client = CloudRedisClusterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4032,8 +4051,8 @@ async def test_get_shared_regional_certificate_authority_flattened_error_async() @pytest.mark.parametrize( "request_type", [ - cloud_redis_cluster.RescheduleClusterMaintenanceRequest, - dict, + cloud_redis_cluster.RescheduleClusterMaintenanceRequest(), + {}, ], ) def test_reschedule_cluster_maintenance(request_type, transport: str = "grpc"): @@ -4044,7 +4063,7 @@ def test_reschedule_cluster_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( @@ -4089,9 +4108,10 @@ def test_reschedule_cluster_maintenance_non_empty_request_with_auto_populated_fi client.reschedule_cluster_maintenance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_redis_cluster.RescheduleClusterMaintenanceRequest( + request_msg = cloud_redis_cluster.RescheduleClusterMaintenanceRequest( name="name_value", ) + assert args[0] == request_msg def test_reschedule_cluster_maintenance_use_cached_wrapped_rpc(): @@ -4187,9 +4207,15 @@ async def test_reschedule_cluster_maintenance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloud_redis_cluster.RescheduleClusterMaintenanceRequest(), + {}, + ], +) async def test_reschedule_cluster_maintenance_async( - transport: str = "grpc_asyncio", - request_type=cloud_redis_cluster.RescheduleClusterMaintenanceRequest, + request_type, transport: str = "grpc_asyncio" ): client = CloudRedisClusterAsyncClient( credentials=async_anonymous_credentials(), @@ -4198,7 +4224,7 @@ async def test_reschedule_cluster_maintenance_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( @@ -4220,11 +4246,6 @@ async def test_reschedule_cluster_maintenance_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_reschedule_cluster_maintenance_async_from_dict(): - await test_reschedule_cluster_maintenance_async(request_type=dict) - - def test_reschedule_cluster_maintenance_field_headers(): client = CloudRedisClusterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4399,8 +4420,8 @@ async def test_reschedule_cluster_maintenance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_redis_cluster.ListBackupCollectionsRequest, - dict, + cloud_redis_cluster.ListBackupCollectionsRequest(), + {}, ], ) def test_list_backup_collections(request_type, transport: str = "grpc"): @@ -4411,7 +4432,7 @@ def test_list_backup_collections(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4462,10 +4483,11 @@ def test_list_backup_collections_non_empty_request_with_auto_populated_field(): client.list_backup_collections(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_redis_cluster.ListBackupCollectionsRequest( + request_msg = cloud_redis_cluster.ListBackupCollectionsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_backup_collections_use_cached_wrapped_rpc(): @@ -4551,9 +4573,15 @@ async def test_list_backup_collections_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloud_redis_cluster.ListBackupCollectionsRequest(), + {}, + ], +) async def test_list_backup_collections_async( - transport: str = "grpc_asyncio", - request_type=cloud_redis_cluster.ListBackupCollectionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = CloudRedisClusterAsyncClient( credentials=async_anonymous_credentials(), @@ -4562,7 +4590,7 @@ async def test_list_backup_collections_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( @@ -4589,11 +4617,6 @@ async def test_list_backup_collections_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_backup_collections_async_from_dict(): - await test_list_backup_collections_async(request_type=dict) - - def test_list_backup_collections_field_headers(): client = CloudRedisClusterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4948,8 +4971,8 @@ async def test_list_backup_collections_async_pages(): @pytest.mark.parametrize( "request_type", [ - cloud_redis_cluster.GetBackupCollectionRequest, - dict, + cloud_redis_cluster.GetBackupCollectionRequest(), + {}, ], ) def test_get_backup_collection(request_type, transport: str = "grpc"): @@ -4960,7 +4983,7 @@ def test_get_backup_collection(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5016,9 +5039,10 @@ def test_get_backup_collection_non_empty_request_with_auto_populated_field(): client.get_backup_collection(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_redis_cluster.GetBackupCollectionRequest( + request_msg = cloud_redis_cluster.GetBackupCollectionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_backup_collection_use_cached_wrapped_rpc(): @@ -5104,9 +5128,15 @@ async def test_get_backup_collection_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloud_redis_cluster.GetBackupCollectionRequest(), + {}, + ], +) async def test_get_backup_collection_async( - transport: str = "grpc_asyncio", - request_type=cloud_redis_cluster.GetBackupCollectionRequest, + request_type, transport: str = "grpc_asyncio" ): client = CloudRedisClusterAsyncClient( credentials=async_anonymous_credentials(), @@ -5115,7 +5145,7 @@ async def test_get_backup_collection_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( @@ -5148,11 +5178,6 @@ async def test_get_backup_collection_async( assert response.uid == "uid_value" -@pytest.mark.asyncio -async def test_get_backup_collection_async_from_dict(): - await test_get_backup_collection_async(request_type=dict) - - def test_get_backup_collection_field_headers(): client = CloudRedisClusterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5307,8 +5332,8 @@ async def test_get_backup_collection_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_redis_cluster.ListBackupsRequest, - dict, + cloud_redis_cluster.ListBackupsRequest(), + {}, ], ) def test_list_backups(request_type, transport: str = "grpc"): @@ -5319,7 +5344,7 @@ def test_list_backups(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_backups), "__call__") as call: @@ -5366,10 +5391,11 @@ def test_list_backups_non_empty_request_with_auto_populated_field(): client.list_backups(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_redis_cluster.ListBackupsRequest( + request_msg = cloud_redis_cluster.ListBackupsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_backups_use_cached_wrapped_rpc(): @@ -5450,9 +5476,14 @@ async def test_list_backups_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_backups_async( - transport: str = "grpc_asyncio", request_type=cloud_redis_cluster.ListBackupsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_redis_cluster.ListBackupsRequest(), + {}, + ], +) +async def test_list_backups_async(request_type, transport: str = "grpc_asyncio"): client = CloudRedisClusterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5460,7 +5491,7 @@ async def test_list_backups_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_backups), "__call__") as call: @@ -5485,11 +5516,6 @@ async def test_list_backups_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_backups_async_from_dict(): - await test_list_backups_async(request_type=dict) - - def test_list_backups_field_headers(): client = CloudRedisClusterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5826,8 +5852,8 @@ async def test_list_backups_async_pages(): @pytest.mark.parametrize( "request_type", [ - cloud_redis_cluster.GetBackupRequest, - dict, + cloud_redis_cluster.GetBackupRequest(), + {}, ], ) def test_get_backup(request_type, transport: str = "grpc"): @@ -5838,7 +5864,7 @@ def test_get_backup(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_backup), "__call__") as call: @@ -5902,9 +5928,10 @@ def test_get_backup_non_empty_request_with_auto_populated_field(): client.get_backup(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_redis_cluster.GetBackupRequest( + request_msg = cloud_redis_cluster.GetBackupRequest( name="name_value", ) + assert args[0] == request_msg def test_get_backup_use_cached_wrapped_rpc(): @@ -5983,9 +6010,14 @@ async def test_get_backup_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_backup_async( - transport: str = "grpc_asyncio", request_type=cloud_redis_cluster.GetBackupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_redis_cluster.GetBackupRequest(), + {}, + ], +) +async def test_get_backup_async(request_type, transport: str = "grpc_asyncio"): client = CloudRedisClusterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5993,7 +6025,7 @@ async def test_get_backup_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_backup), "__call__") as call: @@ -6036,11 +6068,6 @@ async def test_get_backup_async( assert response.uid == "uid_value" -@pytest.mark.asyncio -async def test_get_backup_async_from_dict(): - await test_get_backup_async(request_type=dict) - - def test_get_backup_field_headers(): client = CloudRedisClusterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6187,8 +6214,8 @@ async def test_get_backup_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_redis_cluster.DeleteBackupRequest, - dict, + cloud_redis_cluster.DeleteBackupRequest(), + {}, ], ) def test_delete_backup(request_type, transport: str = "grpc"): @@ -6199,7 +6226,7 @@ def test_delete_backup(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_backup), "__call__") as call: @@ -6240,9 +6267,10 @@ def test_delete_backup_non_empty_request_with_auto_populated_field(): client.delete_backup(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_redis_cluster.DeleteBackupRequest( + request_msg = cloud_redis_cluster.DeleteBackupRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_backup_use_cached_wrapped_rpc(): @@ -6333,10 +6361,14 @@ async def test_delete_backup_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_backup_async( - transport: str = "grpc_asyncio", - request_type=cloud_redis_cluster.DeleteBackupRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_redis_cluster.DeleteBackupRequest(), + {}, + ], +) +async def test_delete_backup_async(request_type, transport: str = "grpc_asyncio"): client = CloudRedisClusterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6344,7 +6376,7 @@ async def test_delete_backup_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_backup), "__call__") as call: @@ -6364,11 +6396,6 @@ async def test_delete_backup_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_backup_async_from_dict(): - await test_delete_backup_async(request_type=dict) - - def test_delete_backup_field_headers(): client = CloudRedisClusterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6515,8 +6542,8 @@ async def test_delete_backup_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_redis_cluster.ExportBackupRequest, - dict, + cloud_redis_cluster.ExportBackupRequest(), + {}, ], ) def test_export_backup(request_type, transport: str = "grpc"): @@ -6527,7 +6554,7 @@ def test_export_backup(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.export_backup), "__call__") as call: @@ -6569,10 +6596,11 @@ def test_export_backup_non_empty_request_with_auto_populated_field(): client.export_backup(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_redis_cluster.ExportBackupRequest( + request_msg = cloud_redis_cluster.ExportBackupRequest( gcs_bucket="gcs_bucket_value", name="name_value", ) + assert args[0] == request_msg def test_export_backup_use_cached_wrapped_rpc(): @@ -6663,10 +6691,14 @@ async def test_export_backup_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_export_backup_async( - transport: str = "grpc_asyncio", - request_type=cloud_redis_cluster.ExportBackupRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_redis_cluster.ExportBackupRequest(), + {}, + ], +) +async def test_export_backup_async(request_type, transport: str = "grpc_asyncio"): client = CloudRedisClusterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6674,7 +6706,7 @@ async def test_export_backup_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.export_backup), "__call__") as call: @@ -6694,11 +6726,6 @@ async def test_export_backup_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_export_backup_async_from_dict(): - await test_export_backup_async(request_type=dict) - - def test_export_backup_field_headers(): client = CloudRedisClusterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6763,8 +6790,8 @@ async def test_export_backup_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - cloud_redis_cluster.BackupClusterRequest, - dict, + cloud_redis_cluster.BackupClusterRequest(), + {}, ], ) def test_backup_cluster(request_type, transport: str = "grpc"): @@ -6775,7 +6802,7 @@ def test_backup_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.backup_cluster), "__call__") as call: @@ -6817,10 +6844,11 @@ def test_backup_cluster_non_empty_request_with_auto_populated_field(): client.backup_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_redis_cluster.BackupClusterRequest( + request_msg = cloud_redis_cluster.BackupClusterRequest( name="name_value", backup_id="backup_id_value", ) + assert args[0] == request_msg def test_backup_cluster_use_cached_wrapped_rpc(): @@ -6911,10 +6939,14 @@ async def test_backup_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_backup_cluster_async( - transport: str = "grpc_asyncio", - request_type=cloud_redis_cluster.BackupClusterRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_redis_cluster.BackupClusterRequest(), + {}, + ], +) +async def test_backup_cluster_async(request_type, transport: str = "grpc_asyncio"): client = CloudRedisClusterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6922,7 +6954,7 @@ async def test_backup_cluster_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.backup_cluster), "__call__") as call: @@ -6942,11 +6974,6 @@ async def test_backup_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_backup_cluster_async_from_dict(): - await test_backup_cluster_async(request_type=dict) - - def test_backup_cluster_field_headers(): client = CloudRedisClusterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10208,7 +10235,6 @@ def test_list_clusters_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.ListClustersRequest() - assert args[0] == request_msg @@ -10229,7 +10255,6 @@ def test_get_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.GetClusterRequest() - assert args[0] == request_msg @@ -10250,7 +10275,6 @@ def test_update_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.UpdateClusterRequest() - assert args[0] == request_msg @@ -10271,7 +10295,6 @@ def test_delete_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.DeleteClusterRequest() - assert args[0] == request_msg @@ -10292,7 +10315,6 @@ def test_create_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.CreateClusterRequest() - assert args[0] == request_msg @@ -10315,7 +10337,6 @@ def test_get_cluster_certificate_authority_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.GetClusterCertificateAuthorityRequest() - assert args[0] == request_msg @@ -10338,7 +10359,6 @@ def test_get_shared_regional_certificate_authority_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.GetSharedRegionalCertificateAuthorityRequest() - assert args[0] == request_msg @@ -10361,7 +10381,6 @@ def test_reschedule_cluster_maintenance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.RescheduleClusterMaintenanceRequest() - assert args[0] == request_msg @@ -10384,7 +10403,6 @@ def test_list_backup_collections_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.ListBackupCollectionsRequest() - assert args[0] == request_msg @@ -10407,7 +10425,6 @@ def test_get_backup_collection_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.GetBackupCollectionRequest() - assert args[0] == request_msg @@ -10428,7 +10445,6 @@ def test_list_backups_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.ListBackupsRequest() - assert args[0] == request_msg @@ -10449,7 +10465,6 @@ def test_get_backup_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.GetBackupRequest() - assert args[0] == request_msg @@ -10470,7 +10485,6 @@ def test_delete_backup_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.DeleteBackupRequest() - assert args[0] == request_msg @@ -10491,7 +10505,6 @@ def test_export_backup_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.ExportBackupRequest() - assert args[0] == request_msg @@ -10512,7 +10525,6 @@ def test_backup_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.BackupClusterRequest() - assert args[0] == request_msg @@ -10554,7 +10566,6 @@ async def test_list_clusters_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.ListClustersRequest() - assert args[0] == request_msg @@ -10596,7 +10607,6 @@ async def test_get_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.GetClusterRequest() - assert args[0] == request_msg @@ -10621,7 +10631,6 @@ async def test_update_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.UpdateClusterRequest() - assert args[0] == request_msg @@ -10646,7 +10655,6 @@ async def test_delete_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.DeleteClusterRequest() - assert args[0] == request_msg @@ -10671,7 +10679,6 @@ async def test_create_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.CreateClusterRequest() - assert args[0] == request_msg @@ -10700,7 +10707,6 @@ async def test_get_cluster_certificate_authority_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.GetClusterCertificateAuthorityRequest() - assert args[0] == request_msg @@ -10729,7 +10735,6 @@ async def test_get_shared_regional_certificate_authority_empty_call_grpc_asyncio call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.GetSharedRegionalCertificateAuthorityRequest() - assert args[0] == request_msg @@ -10756,7 +10761,6 @@ async def test_reschedule_cluster_maintenance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.RescheduleClusterMaintenanceRequest() - assert args[0] == request_msg @@ -10786,7 +10790,6 @@ async def test_list_backup_collections_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.ListBackupCollectionsRequest() - assert args[0] == request_msg @@ -10819,7 +10822,6 @@ async def test_get_backup_collection_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.GetBackupCollectionRequest() - assert args[0] == request_msg @@ -10847,7 +10849,6 @@ async def test_list_backups_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.ListBackupsRequest() - assert args[0] == request_msg @@ -10884,7 +10885,6 @@ async def test_get_backup_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.GetBackupRequest() - assert args[0] == request_msg @@ -10909,7 +10909,6 @@ async def test_delete_backup_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.DeleteBackupRequest() - assert args[0] == request_msg @@ -10934,7 +10933,6 @@ async def test_export_backup_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.ExportBackupRequest() - assert args[0] == request_msg @@ -10959,7 +10957,6 @@ async def test_backup_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.BackupClusterRequest() - assert args[0] == request_msg @@ -13783,7 +13780,6 @@ def test_list_clusters_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.ListClustersRequest() - assert args[0] == request_msg @@ -13803,7 +13799,6 @@ def test_get_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.GetClusterRequest() - assert args[0] == request_msg @@ -13823,7 +13818,6 @@ def test_update_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.UpdateClusterRequest() - assert args[0] == request_msg @@ -13843,7 +13837,6 @@ def test_delete_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.DeleteClusterRequest() - assert args[0] == request_msg @@ -13863,7 +13856,6 @@ def test_create_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.CreateClusterRequest() - assert args[0] == request_msg @@ -13885,7 +13877,6 @@ def test_get_cluster_certificate_authority_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.GetClusterCertificateAuthorityRequest() - assert args[0] == request_msg @@ -13907,7 +13898,6 @@ def test_get_shared_regional_certificate_authority_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.GetSharedRegionalCertificateAuthorityRequest() - assert args[0] == request_msg @@ -13929,7 +13919,6 @@ def test_reschedule_cluster_maintenance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.RescheduleClusterMaintenanceRequest() - assert args[0] == request_msg @@ -13951,7 +13940,6 @@ def test_list_backup_collections_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.ListBackupCollectionsRequest() - assert args[0] == request_msg @@ -13973,7 +13961,6 @@ def test_get_backup_collection_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.GetBackupCollectionRequest() - assert args[0] == request_msg @@ -13993,7 +13980,6 @@ def test_list_backups_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.ListBackupsRequest() - assert args[0] == request_msg @@ -14013,7 +13999,6 @@ def test_get_backup_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.GetBackupRequest() - assert args[0] == request_msg @@ -14033,7 +14018,6 @@ def test_delete_backup_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.DeleteBackupRequest() - assert args[0] == request_msg @@ -14053,7 +14037,6 @@ def test_export_backup_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.ExportBackupRequest() - assert args[0] == request_msg @@ -14073,7 +14056,6 @@ def test_backup_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.BackupClusterRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-redis-cluster/tests/unit/gapic/redis_cluster_v1beta1/test_cloud_redis_cluster.py b/packages/google-cloud-redis-cluster/tests/unit/gapic/redis_cluster_v1beta1/test_cloud_redis_cluster.py index bbf549860abd..041db6f18949 100644 --- a/packages/google-cloud-redis-cluster/tests/unit/gapic/redis_cluster_v1beta1/test_cloud_redis_cluster.py +++ b/packages/google-cloud-redis-cluster/tests/unit/gapic/redis_cluster_v1beta1/test_cloud_redis_cluster.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 @@ -120,6 +121,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" @@ -1361,8 +1377,8 @@ def test_cloud_redis_cluster_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - cloud_redis_cluster.ListClustersRequest, - dict, + cloud_redis_cluster.ListClustersRequest(), + {}, ], ) def test_list_clusters(request_type, transport: str = "grpc"): @@ -1373,7 +1389,7 @@ def test_list_clusters(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_clusters), "__call__") as call: @@ -1420,10 +1436,11 @@ def test_list_clusters_non_empty_request_with_auto_populated_field(): client.list_clusters(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_redis_cluster.ListClustersRequest( + request_msg = cloud_redis_cluster.ListClustersRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_clusters_use_cached_wrapped_rpc(): @@ -1504,10 +1521,14 @@ async def test_list_clusters_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_clusters_async( - transport: str = "grpc_asyncio", - request_type=cloud_redis_cluster.ListClustersRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_redis_cluster.ListClustersRequest(), + {}, + ], +) +async def test_list_clusters_async(request_type, transport: str = "grpc_asyncio"): client = CloudRedisClusterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1515,7 +1536,7 @@ async def test_list_clusters_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_clusters), "__call__") as call: @@ -1540,11 +1561,6 @@ async def test_list_clusters_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_clusters_async_from_dict(): - await test_list_clusters_async(request_type=dict) - - def test_list_clusters_field_headers(): client = CloudRedisClusterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1881,8 +1897,8 @@ async def test_list_clusters_async_pages(): @pytest.mark.parametrize( "request_type", [ - cloud_redis_cluster.GetClusterRequest, - dict, + cloud_redis_cluster.GetClusterRequest(), + {}, ], ) def test_get_cluster(request_type, transport: str = "grpc"): @@ -1893,7 +1909,7 @@ def test_get_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_cluster), "__call__") as call: @@ -1976,9 +1992,10 @@ def test_get_cluster_non_empty_request_with_auto_populated_field(): client.get_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_redis_cluster.GetClusterRequest( + request_msg = cloud_redis_cluster.GetClusterRequest( name="name_value", ) + assert args[0] == request_msg def test_get_cluster_use_cached_wrapped_rpc(): @@ -2059,9 +2076,14 @@ async def test_get_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_cluster_async( - transport: str = "grpc_asyncio", request_type=cloud_redis_cluster.GetClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_redis_cluster.GetClusterRequest(), + {}, + ], +) +async def test_get_cluster_async(request_type, transport: str = "grpc_asyncio"): client = CloudRedisClusterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2069,7 +2091,7 @@ async def test_get_cluster_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_cluster), "__call__") as call: @@ -2131,11 +2153,6 @@ async def test_get_cluster_async( assert response.rotate_server_certificate is True -@pytest.mark.asyncio -async def test_get_cluster_async_from_dict(): - await test_get_cluster_async(request_type=dict) - - def test_get_cluster_field_headers(): client = CloudRedisClusterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2282,8 +2299,8 @@ async def test_get_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_redis_cluster.UpdateClusterRequest, - dict, + cloud_redis_cluster.UpdateClusterRequest(), + {}, ], ) def test_update_cluster(request_type, transport: str = "grpc"): @@ -2294,7 +2311,7 @@ def test_update_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_cluster), "__call__") as call: @@ -2335,9 +2352,10 @@ def test_update_cluster_non_empty_request_with_auto_populated_field(): client.update_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_redis_cluster.UpdateClusterRequest( + request_msg = cloud_redis_cluster.UpdateClusterRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_cluster_use_cached_wrapped_rpc(): @@ -2428,10 +2446,14 @@ async def test_update_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_cluster_async( - transport: str = "grpc_asyncio", - request_type=cloud_redis_cluster.UpdateClusterRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_redis_cluster.UpdateClusterRequest(), + {}, + ], +) +async def test_update_cluster_async(request_type, transport: str = "grpc_asyncio"): client = CloudRedisClusterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2439,7 +2461,7 @@ async def test_update_cluster_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_cluster), "__call__") as call: @@ -2459,11 +2481,6 @@ async def test_update_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_cluster_async_from_dict(): - await test_update_cluster_async(request_type=dict) - - def test_update_cluster_field_headers(): client = CloudRedisClusterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2640,8 +2657,8 @@ async def test_update_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_redis_cluster.DeleteClusterRequest, - dict, + cloud_redis_cluster.DeleteClusterRequest(), + {}, ], ) def test_delete_cluster(request_type, transport: str = "grpc"): @@ -2652,7 +2669,7 @@ def test_delete_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_cluster), "__call__") as call: @@ -2694,10 +2711,11 @@ def test_delete_cluster_non_empty_request_with_auto_populated_field(): client.delete_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_redis_cluster.DeleteClusterRequest( + request_msg = cloud_redis_cluster.DeleteClusterRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_cluster_use_cached_wrapped_rpc(): @@ -2788,10 +2806,14 @@ async def test_delete_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_cluster_async( - transport: str = "grpc_asyncio", - request_type=cloud_redis_cluster.DeleteClusterRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_redis_cluster.DeleteClusterRequest(), + {}, + ], +) +async def test_delete_cluster_async(request_type, transport: str = "grpc_asyncio"): client = CloudRedisClusterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2799,7 +2821,7 @@ async def test_delete_cluster_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_cluster), "__call__") as call: @@ -2819,11 +2841,6 @@ async def test_delete_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_cluster_async_from_dict(): - await test_delete_cluster_async(request_type=dict) - - def test_delete_cluster_field_headers(): client = CloudRedisClusterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2970,8 +2987,8 @@ async def test_delete_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_redis_cluster.CreateClusterRequest, - dict, + cloud_redis_cluster.CreateClusterRequest(), + {}, ], ) def test_create_cluster(request_type, transport: str = "grpc"): @@ -2982,7 +2999,7 @@ def test_create_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_cluster), "__call__") as call: @@ -3025,11 +3042,12 @@ def test_create_cluster_non_empty_request_with_auto_populated_field(): client.create_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_redis_cluster.CreateClusterRequest( + request_msg = cloud_redis_cluster.CreateClusterRequest( parent="parent_value", cluster_id="cluster_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_cluster_use_cached_wrapped_rpc(): @@ -3120,10 +3138,14 @@ async def test_create_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_cluster_async( - transport: str = "grpc_asyncio", - request_type=cloud_redis_cluster.CreateClusterRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_redis_cluster.CreateClusterRequest(), + {}, + ], +) +async def test_create_cluster_async(request_type, transport: str = "grpc_asyncio"): client = CloudRedisClusterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3131,7 +3153,7 @@ async def test_create_cluster_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_cluster), "__call__") as call: @@ -3151,11 +3173,6 @@ async def test_create_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_cluster_async_from_dict(): - await test_create_cluster_async(request_type=dict) - - def test_create_cluster_field_headers(): client = CloudRedisClusterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3342,8 +3359,8 @@ async def test_create_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_redis_cluster.GetClusterCertificateAuthorityRequest, - dict, + cloud_redis_cluster.GetClusterCertificateAuthorityRequest(), + {}, ], ) def test_get_cluster_certificate_authority(request_type, transport: str = "grpc"): @@ -3354,7 +3371,7 @@ def test_get_cluster_certificate_authority(request_type, transport: str = "grpc" # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3402,9 +3419,10 @@ def test_get_cluster_certificate_authority_non_empty_request_with_auto_populated client.get_cluster_certificate_authority(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_redis_cluster.GetClusterCertificateAuthorityRequest( + request_msg = cloud_redis_cluster.GetClusterCertificateAuthorityRequest( name="name_value", ) + assert args[0] == request_msg def test_get_cluster_certificate_authority_use_cached_wrapped_rpc(): @@ -3490,9 +3508,15 @@ async def test_get_cluster_certificate_authority_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloud_redis_cluster.GetClusterCertificateAuthorityRequest(), + {}, + ], +) async def test_get_cluster_certificate_authority_async( - transport: str = "grpc_asyncio", - request_type=cloud_redis_cluster.GetClusterCertificateAuthorityRequest, + request_type, transport: str = "grpc_asyncio" ): client = CloudRedisClusterAsyncClient( credentials=async_anonymous_credentials(), @@ -3501,7 +3525,7 @@ async def test_get_cluster_certificate_authority_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( @@ -3526,11 +3550,6 @@ async def test_get_cluster_certificate_authority_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_cluster_certificate_authority_async_from_dict(): - await test_get_cluster_certificate_authority_async(request_type=dict) - - def test_get_cluster_certificate_authority_field_headers(): client = CloudRedisClusterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3685,8 +3704,8 @@ async def test_get_cluster_certificate_authority_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_redis_cluster.GetSharedRegionalCertificateAuthorityRequest, - dict, + cloud_redis_cluster.GetSharedRegionalCertificateAuthorityRequest(), + {}, ], ) def test_get_shared_regional_certificate_authority( @@ -3699,7 +3718,7 @@ def test_get_shared_regional_certificate_authority( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3747,11 +3766,10 @@ def test_get_shared_regional_certificate_authority_non_empty_request_with_auto_p client.get_shared_regional_certificate_authority(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == cloud_redis_cluster.GetSharedRegionalCertificateAuthorityRequest( + request_msg = cloud_redis_cluster.GetSharedRegionalCertificateAuthorityRequest( name="name_value", ) + assert args[0] == request_msg def test_get_shared_regional_certificate_authority_use_cached_wrapped_rpc(): @@ -3837,9 +3855,15 @@ async def test_get_shared_regional_certificate_authority_async_use_cached_wrappe @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloud_redis_cluster.GetSharedRegionalCertificateAuthorityRequest(), + {}, + ], +) async def test_get_shared_regional_certificate_authority_async( - transport: str = "grpc_asyncio", - request_type=cloud_redis_cluster.GetSharedRegionalCertificateAuthorityRequest, + request_type, transport: str = "grpc_asyncio" ): client = CloudRedisClusterAsyncClient( credentials=async_anonymous_credentials(), @@ -3848,7 +3872,7 @@ async def test_get_shared_regional_certificate_authority_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( @@ -3873,11 +3897,6 @@ async def test_get_shared_regional_certificate_authority_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_shared_regional_certificate_authority_async_from_dict(): - await test_get_shared_regional_certificate_authority_async(request_type=dict) - - def test_get_shared_regional_certificate_authority_field_headers(): client = CloudRedisClusterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4032,8 +4051,8 @@ async def test_get_shared_regional_certificate_authority_flattened_error_async() @pytest.mark.parametrize( "request_type", [ - cloud_redis_cluster.RescheduleClusterMaintenanceRequest, - dict, + cloud_redis_cluster.RescheduleClusterMaintenanceRequest(), + {}, ], ) def test_reschedule_cluster_maintenance(request_type, transport: str = "grpc"): @@ -4044,7 +4063,7 @@ def test_reschedule_cluster_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( @@ -4089,9 +4108,10 @@ def test_reschedule_cluster_maintenance_non_empty_request_with_auto_populated_fi client.reschedule_cluster_maintenance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_redis_cluster.RescheduleClusterMaintenanceRequest( + request_msg = cloud_redis_cluster.RescheduleClusterMaintenanceRequest( name="name_value", ) + assert args[0] == request_msg def test_reschedule_cluster_maintenance_use_cached_wrapped_rpc(): @@ -4187,9 +4207,15 @@ async def test_reschedule_cluster_maintenance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloud_redis_cluster.RescheduleClusterMaintenanceRequest(), + {}, + ], +) async def test_reschedule_cluster_maintenance_async( - transport: str = "grpc_asyncio", - request_type=cloud_redis_cluster.RescheduleClusterMaintenanceRequest, + request_type, transport: str = "grpc_asyncio" ): client = CloudRedisClusterAsyncClient( credentials=async_anonymous_credentials(), @@ -4198,7 +4224,7 @@ async def test_reschedule_cluster_maintenance_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( @@ -4220,11 +4246,6 @@ async def test_reschedule_cluster_maintenance_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_reschedule_cluster_maintenance_async_from_dict(): - await test_reschedule_cluster_maintenance_async(request_type=dict) - - def test_reschedule_cluster_maintenance_field_headers(): client = CloudRedisClusterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4399,8 +4420,8 @@ async def test_reschedule_cluster_maintenance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_redis_cluster.ListBackupCollectionsRequest, - dict, + cloud_redis_cluster.ListBackupCollectionsRequest(), + {}, ], ) def test_list_backup_collections(request_type, transport: str = "grpc"): @@ -4411,7 +4432,7 @@ def test_list_backup_collections(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4462,10 +4483,11 @@ def test_list_backup_collections_non_empty_request_with_auto_populated_field(): client.list_backup_collections(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_redis_cluster.ListBackupCollectionsRequest( + request_msg = cloud_redis_cluster.ListBackupCollectionsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_backup_collections_use_cached_wrapped_rpc(): @@ -4551,9 +4573,15 @@ async def test_list_backup_collections_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloud_redis_cluster.ListBackupCollectionsRequest(), + {}, + ], +) async def test_list_backup_collections_async( - transport: str = "grpc_asyncio", - request_type=cloud_redis_cluster.ListBackupCollectionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = CloudRedisClusterAsyncClient( credentials=async_anonymous_credentials(), @@ -4562,7 +4590,7 @@ async def test_list_backup_collections_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( @@ -4589,11 +4617,6 @@ async def test_list_backup_collections_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_backup_collections_async_from_dict(): - await test_list_backup_collections_async(request_type=dict) - - def test_list_backup_collections_field_headers(): client = CloudRedisClusterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4948,8 +4971,8 @@ async def test_list_backup_collections_async_pages(): @pytest.mark.parametrize( "request_type", [ - cloud_redis_cluster.GetBackupCollectionRequest, - dict, + cloud_redis_cluster.GetBackupCollectionRequest(), + {}, ], ) def test_get_backup_collection(request_type, transport: str = "grpc"): @@ -4960,7 +4983,7 @@ def test_get_backup_collection(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5016,9 +5039,10 @@ def test_get_backup_collection_non_empty_request_with_auto_populated_field(): client.get_backup_collection(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_redis_cluster.GetBackupCollectionRequest( + request_msg = cloud_redis_cluster.GetBackupCollectionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_backup_collection_use_cached_wrapped_rpc(): @@ -5104,9 +5128,15 @@ async def test_get_backup_collection_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloud_redis_cluster.GetBackupCollectionRequest(), + {}, + ], +) async def test_get_backup_collection_async( - transport: str = "grpc_asyncio", - request_type=cloud_redis_cluster.GetBackupCollectionRequest, + request_type, transport: str = "grpc_asyncio" ): client = CloudRedisClusterAsyncClient( credentials=async_anonymous_credentials(), @@ -5115,7 +5145,7 @@ async def test_get_backup_collection_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( @@ -5148,11 +5178,6 @@ async def test_get_backup_collection_async( assert response.uid == "uid_value" -@pytest.mark.asyncio -async def test_get_backup_collection_async_from_dict(): - await test_get_backup_collection_async(request_type=dict) - - def test_get_backup_collection_field_headers(): client = CloudRedisClusterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5307,8 +5332,8 @@ async def test_get_backup_collection_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_redis_cluster.ListBackupsRequest, - dict, + cloud_redis_cluster.ListBackupsRequest(), + {}, ], ) def test_list_backups(request_type, transport: str = "grpc"): @@ -5319,7 +5344,7 @@ def test_list_backups(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_backups), "__call__") as call: @@ -5366,10 +5391,11 @@ def test_list_backups_non_empty_request_with_auto_populated_field(): client.list_backups(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_redis_cluster.ListBackupsRequest( + request_msg = cloud_redis_cluster.ListBackupsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_backups_use_cached_wrapped_rpc(): @@ -5450,9 +5476,14 @@ async def test_list_backups_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_backups_async( - transport: str = "grpc_asyncio", request_type=cloud_redis_cluster.ListBackupsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_redis_cluster.ListBackupsRequest(), + {}, + ], +) +async def test_list_backups_async(request_type, transport: str = "grpc_asyncio"): client = CloudRedisClusterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5460,7 +5491,7 @@ async def test_list_backups_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_backups), "__call__") as call: @@ -5485,11 +5516,6 @@ async def test_list_backups_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_backups_async_from_dict(): - await test_list_backups_async(request_type=dict) - - def test_list_backups_field_headers(): client = CloudRedisClusterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5826,8 +5852,8 @@ async def test_list_backups_async_pages(): @pytest.mark.parametrize( "request_type", [ - cloud_redis_cluster.GetBackupRequest, - dict, + cloud_redis_cluster.GetBackupRequest(), + {}, ], ) def test_get_backup(request_type, transport: str = "grpc"): @@ -5838,7 +5864,7 @@ def test_get_backup(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_backup), "__call__") as call: @@ -5902,9 +5928,10 @@ def test_get_backup_non_empty_request_with_auto_populated_field(): client.get_backup(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_redis_cluster.GetBackupRequest( + request_msg = cloud_redis_cluster.GetBackupRequest( name="name_value", ) + assert args[0] == request_msg def test_get_backup_use_cached_wrapped_rpc(): @@ -5983,9 +6010,14 @@ async def test_get_backup_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_backup_async( - transport: str = "grpc_asyncio", request_type=cloud_redis_cluster.GetBackupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_redis_cluster.GetBackupRequest(), + {}, + ], +) +async def test_get_backup_async(request_type, transport: str = "grpc_asyncio"): client = CloudRedisClusterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5993,7 +6025,7 @@ async def test_get_backup_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_backup), "__call__") as call: @@ -6036,11 +6068,6 @@ async def test_get_backup_async( assert response.uid == "uid_value" -@pytest.mark.asyncio -async def test_get_backup_async_from_dict(): - await test_get_backup_async(request_type=dict) - - def test_get_backup_field_headers(): client = CloudRedisClusterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6187,8 +6214,8 @@ async def test_get_backup_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_redis_cluster.DeleteBackupRequest, - dict, + cloud_redis_cluster.DeleteBackupRequest(), + {}, ], ) def test_delete_backup(request_type, transport: str = "grpc"): @@ -6199,7 +6226,7 @@ def test_delete_backup(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_backup), "__call__") as call: @@ -6240,9 +6267,10 @@ def test_delete_backup_non_empty_request_with_auto_populated_field(): client.delete_backup(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_redis_cluster.DeleteBackupRequest( + request_msg = cloud_redis_cluster.DeleteBackupRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_backup_use_cached_wrapped_rpc(): @@ -6333,10 +6361,14 @@ async def test_delete_backup_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_backup_async( - transport: str = "grpc_asyncio", - request_type=cloud_redis_cluster.DeleteBackupRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_redis_cluster.DeleteBackupRequest(), + {}, + ], +) +async def test_delete_backup_async(request_type, transport: str = "grpc_asyncio"): client = CloudRedisClusterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6344,7 +6376,7 @@ async def test_delete_backup_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_backup), "__call__") as call: @@ -6364,11 +6396,6 @@ async def test_delete_backup_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_backup_async_from_dict(): - await test_delete_backup_async(request_type=dict) - - def test_delete_backup_field_headers(): client = CloudRedisClusterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6515,8 +6542,8 @@ async def test_delete_backup_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_redis_cluster.ExportBackupRequest, - dict, + cloud_redis_cluster.ExportBackupRequest(), + {}, ], ) def test_export_backup(request_type, transport: str = "grpc"): @@ -6527,7 +6554,7 @@ def test_export_backup(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.export_backup), "__call__") as call: @@ -6569,10 +6596,11 @@ def test_export_backup_non_empty_request_with_auto_populated_field(): client.export_backup(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_redis_cluster.ExportBackupRequest( + request_msg = cloud_redis_cluster.ExportBackupRequest( gcs_bucket="gcs_bucket_value", name="name_value", ) + assert args[0] == request_msg def test_export_backup_use_cached_wrapped_rpc(): @@ -6663,10 +6691,14 @@ async def test_export_backup_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_export_backup_async( - transport: str = "grpc_asyncio", - request_type=cloud_redis_cluster.ExportBackupRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_redis_cluster.ExportBackupRequest(), + {}, + ], +) +async def test_export_backup_async(request_type, transport: str = "grpc_asyncio"): client = CloudRedisClusterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6674,7 +6706,7 @@ async def test_export_backup_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.export_backup), "__call__") as call: @@ -6694,11 +6726,6 @@ async def test_export_backup_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_export_backup_async_from_dict(): - await test_export_backup_async(request_type=dict) - - def test_export_backup_field_headers(): client = CloudRedisClusterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6763,8 +6790,8 @@ async def test_export_backup_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - cloud_redis_cluster.BackupClusterRequest, - dict, + cloud_redis_cluster.BackupClusterRequest(), + {}, ], ) def test_backup_cluster(request_type, transport: str = "grpc"): @@ -6775,7 +6802,7 @@ def test_backup_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.backup_cluster), "__call__") as call: @@ -6817,10 +6844,11 @@ def test_backup_cluster_non_empty_request_with_auto_populated_field(): client.backup_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_redis_cluster.BackupClusterRequest( + request_msg = cloud_redis_cluster.BackupClusterRequest( name="name_value", backup_id="backup_id_value", ) + assert args[0] == request_msg def test_backup_cluster_use_cached_wrapped_rpc(): @@ -6911,10 +6939,14 @@ async def test_backup_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_backup_cluster_async( - transport: str = "grpc_asyncio", - request_type=cloud_redis_cluster.BackupClusterRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_redis_cluster.BackupClusterRequest(), + {}, + ], +) +async def test_backup_cluster_async(request_type, transport: str = "grpc_asyncio"): client = CloudRedisClusterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6922,7 +6954,7 @@ async def test_backup_cluster_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.backup_cluster), "__call__") as call: @@ -6942,11 +6974,6 @@ async def test_backup_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_backup_cluster_async_from_dict(): - await test_backup_cluster_async(request_type=dict) - - def test_backup_cluster_field_headers(): client = CloudRedisClusterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10212,7 +10239,6 @@ def test_list_clusters_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.ListClustersRequest() - assert args[0] == request_msg @@ -10233,7 +10259,6 @@ def test_get_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.GetClusterRequest() - assert args[0] == request_msg @@ -10254,7 +10279,6 @@ def test_update_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.UpdateClusterRequest() - assert args[0] == request_msg @@ -10275,7 +10299,6 @@ def test_delete_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.DeleteClusterRequest() - assert args[0] == request_msg @@ -10296,7 +10319,6 @@ def test_create_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.CreateClusterRequest() - assert args[0] == request_msg @@ -10319,7 +10341,6 @@ def test_get_cluster_certificate_authority_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.GetClusterCertificateAuthorityRequest() - assert args[0] == request_msg @@ -10342,7 +10363,6 @@ def test_get_shared_regional_certificate_authority_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.GetSharedRegionalCertificateAuthorityRequest() - assert args[0] == request_msg @@ -10365,7 +10385,6 @@ def test_reschedule_cluster_maintenance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.RescheduleClusterMaintenanceRequest() - assert args[0] == request_msg @@ -10388,7 +10407,6 @@ def test_list_backup_collections_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.ListBackupCollectionsRequest() - assert args[0] == request_msg @@ -10411,7 +10429,6 @@ def test_get_backup_collection_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.GetBackupCollectionRequest() - assert args[0] == request_msg @@ -10432,7 +10449,6 @@ def test_list_backups_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.ListBackupsRequest() - assert args[0] == request_msg @@ -10453,7 +10469,6 @@ def test_get_backup_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.GetBackupRequest() - assert args[0] == request_msg @@ -10474,7 +10489,6 @@ def test_delete_backup_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.DeleteBackupRequest() - assert args[0] == request_msg @@ -10495,7 +10509,6 @@ def test_export_backup_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.ExportBackupRequest() - assert args[0] == request_msg @@ -10516,7 +10529,6 @@ def test_backup_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.BackupClusterRequest() - assert args[0] == request_msg @@ -10558,7 +10570,6 @@ async def test_list_clusters_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.ListClustersRequest() - assert args[0] == request_msg @@ -10600,7 +10611,6 @@ async def test_get_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.GetClusterRequest() - assert args[0] == request_msg @@ -10625,7 +10635,6 @@ async def test_update_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.UpdateClusterRequest() - assert args[0] == request_msg @@ -10650,7 +10659,6 @@ async def test_delete_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.DeleteClusterRequest() - assert args[0] == request_msg @@ -10675,7 +10683,6 @@ async def test_create_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.CreateClusterRequest() - assert args[0] == request_msg @@ -10704,7 +10711,6 @@ async def test_get_cluster_certificate_authority_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.GetClusterCertificateAuthorityRequest() - assert args[0] == request_msg @@ -10733,7 +10739,6 @@ async def test_get_shared_regional_certificate_authority_empty_call_grpc_asyncio call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.GetSharedRegionalCertificateAuthorityRequest() - assert args[0] == request_msg @@ -10760,7 +10765,6 @@ async def test_reschedule_cluster_maintenance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.RescheduleClusterMaintenanceRequest() - assert args[0] == request_msg @@ -10790,7 +10794,6 @@ async def test_list_backup_collections_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.ListBackupCollectionsRequest() - assert args[0] == request_msg @@ -10823,7 +10826,6 @@ async def test_get_backup_collection_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.GetBackupCollectionRequest() - assert args[0] == request_msg @@ -10851,7 +10853,6 @@ async def test_list_backups_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.ListBackupsRequest() - assert args[0] == request_msg @@ -10888,7 +10889,6 @@ async def test_get_backup_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.GetBackupRequest() - assert args[0] == request_msg @@ -10913,7 +10913,6 @@ async def test_delete_backup_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.DeleteBackupRequest() - assert args[0] == request_msg @@ -10938,7 +10937,6 @@ async def test_export_backup_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.ExportBackupRequest() - assert args[0] == request_msg @@ -10963,7 +10961,6 @@ async def test_backup_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.BackupClusterRequest() - assert args[0] == request_msg @@ -13787,7 +13784,6 @@ def test_list_clusters_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.ListClustersRequest() - assert args[0] == request_msg @@ -13807,7 +13803,6 @@ def test_get_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.GetClusterRequest() - assert args[0] == request_msg @@ -13827,7 +13822,6 @@ def test_update_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.UpdateClusterRequest() - assert args[0] == request_msg @@ -13847,7 +13841,6 @@ def test_delete_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.DeleteClusterRequest() - assert args[0] == request_msg @@ -13867,7 +13860,6 @@ def test_create_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.CreateClusterRequest() - assert args[0] == request_msg @@ -13889,7 +13881,6 @@ def test_get_cluster_certificate_authority_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.GetClusterCertificateAuthorityRequest() - assert args[0] == request_msg @@ -13911,7 +13902,6 @@ def test_get_shared_regional_certificate_authority_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.GetSharedRegionalCertificateAuthorityRequest() - assert args[0] == request_msg @@ -13933,7 +13923,6 @@ def test_reschedule_cluster_maintenance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.RescheduleClusterMaintenanceRequest() - assert args[0] == request_msg @@ -13955,7 +13944,6 @@ def test_list_backup_collections_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.ListBackupCollectionsRequest() - assert args[0] == request_msg @@ -13977,7 +13965,6 @@ def test_get_backup_collection_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.GetBackupCollectionRequest() - assert args[0] == request_msg @@ -13997,7 +13984,6 @@ def test_list_backups_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.ListBackupsRequest() - assert args[0] == request_msg @@ -14017,7 +14003,6 @@ def test_get_backup_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.GetBackupRequest() - assert args[0] == request_msg @@ -14037,7 +14022,6 @@ def test_delete_backup_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.DeleteBackupRequest() - assert args[0] == request_msg @@ -14057,7 +14041,6 @@ def test_export_backup_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.ExportBackupRequest() - assert args[0] == request_msg @@ -14077,7 +14060,6 @@ def test_backup_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis_cluster.BackupClusterRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-redis/noxfile.py b/packages/google-cloud-redis/noxfile.py index ef7812d2bec8..1aaaa5ee824f 100644 --- a/packages/google-cloud-redis/noxfile.py +++ b/packages/google-cloud-redis/noxfile.py @@ -47,7 +47,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 = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-redis/setup.py b/packages/google-cloud-redis/setup.py index eaf0f2185b07..85c6bfd22bd7 100644 --- a/packages/google-cloud-redis/setup.py +++ b/packages/google-cloud-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/google-cloud-redis/testing/constraints-3.10.txt b/packages/google-cloud-redis/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-redis/testing/constraints-3.10.txt +++ b/packages/google-cloud-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/google-cloud-redis/tests/unit/gapic/redis_v1/test_cloud_redis.py b/packages/google-cloud-redis/tests/unit/gapic/redis_v1/test_cloud_redis.py index 4dc534cc4f73..4932f0a10965 100644 --- a/packages/google-cloud-redis/tests/unit/gapic/redis_v1/test_cloud_redis.py +++ b/packages/google-cloud-redis/tests/unit/gapic/redis_v1/test_cloud_redis.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 @@ -119,6 +120,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" @@ -1280,8 +1296,8 @@ def test_cloud_redis_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - cloud_redis.ListInstancesRequest, - dict, + cloud_redis.ListInstancesRequest(), + {}, ], ) def test_list_instances(request_type, transport: str = "grpc"): @@ -1292,7 +1308,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(type(client.transport.list_instances), "__call__") as call: @@ -1339,10 +1355,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(): @@ -1423,9 +1440,14 @@ async def test_list_instances_async_use_cached_wrapped_rpc( @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, @@ -1433,7 +1455,7 @@ async def test_list_instances_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_instances), "__call__") as call: @@ -1458,11 +1480,6 @@ async def test_list_instances_async( 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(), @@ -1799,8 +1816,8 @@ async def test_list_instances_async_pages(): @pytest.mark.parametrize( "request_type", [ - cloud_redis.GetInstanceRequest, - dict, + cloud_redis.GetInstanceRequest(), + {}, ], ) def test_get_instance(request_type, transport: str = "grpc"): @@ -1811,7 +1828,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(type(client.transport.get_instance), "__call__") as call: @@ -1919,9 +1936,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(): @@ -2002,9 +2020,14 @@ async def test_get_instance_async_use_cached_wrapped_rpc( @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, @@ -2012,7 +2035,7 @@ async def test_get_instance_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_instance), "__call__") as call: @@ -2099,11 +2122,6 @@ async def test_get_instance_async( ] -@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(), @@ -2250,8 +2268,8 @@ 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"): @@ -2262,7 +2280,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( @@ -2310,9 +2328,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(): @@ -2398,9 +2417,15 @@ async def test_get_instance_auth_string_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloud_redis.GetInstanceAuthStringRequest(), + {}, + ], +) async def test_get_instance_auth_string_async( - transport: str = "grpc_asyncio", - request_type=cloud_redis.GetInstanceAuthStringRequest, + request_type, transport: str = "grpc_asyncio" ): client = CloudRedisAsyncClient( credentials=async_anonymous_credentials(), @@ -2409,7 +2434,7 @@ async def test_get_instance_auth_string_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( @@ -2434,11 +2459,6 @@ async def test_get_instance_auth_string_async( 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(), @@ -2593,8 +2613,8 @@ 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"): @@ -2605,7 +2625,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(type(client.transport.create_instance), "__call__") as call: @@ -2647,10 +2667,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(): @@ -2741,9 +2762,14 @@ async def test_create_instance_async_use_cached_wrapped_rpc( @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, @@ -2751,7 +2777,7 @@ async def test_create_instance_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_instance), "__call__") as call: @@ -2771,11 +2797,6 @@ async def test_create_instance_async( 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(), @@ -2942,8 +2963,8 @@ 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"): @@ -2954,7 +2975,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(type(client.transport.update_instance), "__call__") as call: @@ -2993,7 +3014,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] - assert args[0] == cloud_redis.UpdateInstanceRequest() + request_msg = cloud_redis.UpdateInstanceRequest() + assert args[0] == request_msg def test_update_instance_use_cached_wrapped_rpc(): @@ -3084,9 +3106,14 @@ async def test_update_instance_async_use_cached_wrapped_rpc( @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, @@ -3094,7 +3121,7 @@ async def test_update_instance_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_instance), "__call__") as call: @@ -3114,11 +3141,6 @@ async def test_update_instance_async( 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(), @@ -3275,8 +3297,8 @@ 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"): @@ -3287,7 +3309,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(type(client.transport.upgrade_instance), "__call__") as call: @@ -3329,10 +3351,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(): @@ -3425,9 +3448,14 @@ async def test_upgrade_instance_async_use_cached_wrapped_rpc( @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, @@ -3435,7 +3463,7 @@ async def test_upgrade_instance_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.upgrade_instance), "__call__") as call: @@ -3455,11 +3483,6 @@ async def test_upgrade_instance_async( 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(), @@ -3616,8 +3639,8 @@ 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"): @@ -3628,7 +3651,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(type(client.transport.import_instance), "__call__") as call: @@ -3669,9 +3692,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(): @@ -3762,9 +3786,14 @@ async def test_import_instance_async_use_cached_wrapped_rpc( @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, @@ -3772,7 +3801,7 @@ async def test_import_instance_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.import_instance), "__call__") as call: @@ -3792,11 +3821,6 @@ async def test_import_instance_async( 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(), @@ -3965,8 +3989,8 @@ 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"): @@ -3977,7 +4001,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(type(client.transport.export_instance), "__call__") as call: @@ -4018,9 +4042,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(): @@ -4111,9 +4136,14 @@ async def test_export_instance_async_use_cached_wrapped_rpc( @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, @@ -4121,7 +4151,7 @@ async def test_export_instance_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.export_instance), "__call__") as call: @@ -4141,11 +4171,6 @@ async def test_export_instance_async( 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(), @@ -4314,8 +4339,8 @@ 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"): @@ -4326,7 +4351,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( @@ -4371,9 +4396,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(): @@ -4466,9 +4492,14 @@ async def test_failover_instance_async_use_cached_wrapped_rpc( @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, @@ -4476,7 +4507,7 @@ async def test_failover_instance_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( @@ -4498,11 +4529,6 @@ async def test_failover_instance_async( 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(), @@ -4671,8 +4697,8 @@ 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"): @@ -4683,7 +4709,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(type(client.transport.delete_instance), "__call__") as call: @@ -4724,9 +4750,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(): @@ -4817,9 +4844,14 @@ async def test_delete_instance_async_use_cached_wrapped_rpc( @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, @@ -4827,7 +4859,7 @@ async def test_delete_instance_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_instance), "__call__") as call: @@ -4847,11 +4879,6 @@ async def test_delete_instance_async( 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(), @@ -4998,8 +5025,8 @@ 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"): @@ -5010,7 +5037,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( @@ -5055,9 +5082,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(): @@ -5153,9 +5181,15 @@ async def test_reschedule_maintenance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloud_redis.RescheduleMaintenanceRequest(), + {}, + ], +) async def test_reschedule_maintenance_async( - transport: str = "grpc_asyncio", - request_type=cloud_redis.RescheduleMaintenanceRequest, + request_type, transport: str = "grpc_asyncio" ): client = CloudRedisAsyncClient( credentials=async_anonymous_credentials(), @@ -5164,7 +5198,7 @@ async def test_reschedule_maintenance_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( @@ -5186,11 +5220,6 @@ async def test_reschedule_maintenance_async( 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(), @@ -7635,7 +7664,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 @@ -7656,7 +7684,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 @@ -7679,7 +7706,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 @@ -7700,7 +7726,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 @@ -7721,7 +7746,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 @@ -7742,7 +7766,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 @@ -7763,7 +7786,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 @@ -7784,7 +7806,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 @@ -7807,7 +7828,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 @@ -7828,7 +7848,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 @@ -7851,7 +7870,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 @@ -7893,7 +7911,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 @@ -7948,7 +7965,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 @@ -7977,7 +7993,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 @@ -8002,7 +8017,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 @@ -8027,7 +8041,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 @@ -8052,7 +8065,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 @@ -8077,7 +8089,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 @@ -8102,7 +8113,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 @@ -8129,7 +8139,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 @@ -8154,7 +8163,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 @@ -8181,7 +8189,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 @@ -10331,7 +10338,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 @@ -10351,7 +10357,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 @@ -10373,7 +10378,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 @@ -10393,7 +10397,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 @@ -10413,7 +10416,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 @@ -10433,7 +10435,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 @@ -10453,7 +10454,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 @@ -10473,7 +10473,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 @@ -10495,7 +10494,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 @@ -10515,7 +10513,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 @@ -10537,7 +10534,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 diff --git a/packages/google-cloud-redis/tests/unit/gapic/redis_v1beta1/test_cloud_redis.py b/packages/google-cloud-redis/tests/unit/gapic/redis_v1beta1/test_cloud_redis.py index d8528e521f45..a24a8ef61eb4 100644 --- a/packages/google-cloud-redis/tests/unit/gapic/redis_v1beta1/test_cloud_redis.py +++ b/packages/google-cloud-redis/tests/unit/gapic/redis_v1beta1/test_cloud_redis.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 @@ -119,6 +120,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" @@ -1280,8 +1296,8 @@ def test_cloud_redis_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - cloud_redis.ListInstancesRequest, - dict, + cloud_redis.ListInstancesRequest(), + {}, ], ) def test_list_instances(request_type, transport: str = "grpc"): @@ -1292,7 +1308,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(type(client.transport.list_instances), "__call__") as call: @@ -1339,10 +1355,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(): @@ -1423,9 +1440,14 @@ async def test_list_instances_async_use_cached_wrapped_rpc( @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, @@ -1433,7 +1455,7 @@ async def test_list_instances_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_instances), "__call__") as call: @@ -1458,11 +1480,6 @@ async def test_list_instances_async( 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(), @@ -1799,8 +1816,8 @@ async def test_list_instances_async_pages(): @pytest.mark.parametrize( "request_type", [ - cloud_redis.GetInstanceRequest, - dict, + cloud_redis.GetInstanceRequest(), + {}, ], ) def test_get_instance(request_type, transport: str = "grpc"): @@ -1811,7 +1828,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(type(client.transport.get_instance), "__call__") as call: @@ -1905,9 +1922,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(): @@ -1988,9 +2006,14 @@ async def test_get_instance_async_use_cached_wrapped_rpc( @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, @@ -1998,7 +2021,7 @@ async def test_get_instance_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_instance), "__call__") as call: @@ -2071,11 +2094,6 @@ async def test_get_instance_async( ) -@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(), @@ -2222,8 +2240,8 @@ 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"): @@ -2234,7 +2252,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( @@ -2282,9 +2300,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(): @@ -2370,9 +2389,15 @@ async def test_get_instance_auth_string_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloud_redis.GetInstanceAuthStringRequest(), + {}, + ], +) async def test_get_instance_auth_string_async( - transport: str = "grpc_asyncio", - request_type=cloud_redis.GetInstanceAuthStringRequest, + request_type, transport: str = "grpc_asyncio" ): client = CloudRedisAsyncClient( credentials=async_anonymous_credentials(), @@ -2381,7 +2406,7 @@ async def test_get_instance_auth_string_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( @@ -2406,11 +2431,6 @@ async def test_get_instance_auth_string_async( 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(), @@ -2565,8 +2585,8 @@ 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"): @@ -2577,7 +2597,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(type(client.transport.create_instance), "__call__") as call: @@ -2619,10 +2639,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(): @@ -2713,9 +2734,14 @@ async def test_create_instance_async_use_cached_wrapped_rpc( @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, @@ -2723,7 +2749,7 @@ async def test_create_instance_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_instance), "__call__") as call: @@ -2743,11 +2769,6 @@ async def test_create_instance_async( 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(), @@ -2914,8 +2935,8 @@ 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"): @@ -2926,7 +2947,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(type(client.transport.update_instance), "__call__") as call: @@ -2965,7 +2986,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] - assert args[0] == cloud_redis.UpdateInstanceRequest() + request_msg = cloud_redis.UpdateInstanceRequest() + assert args[0] == request_msg def test_update_instance_use_cached_wrapped_rpc(): @@ -3056,9 +3078,14 @@ async def test_update_instance_async_use_cached_wrapped_rpc( @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, @@ -3066,7 +3093,7 @@ async def test_update_instance_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_instance), "__call__") as call: @@ -3086,11 +3113,6 @@ async def test_update_instance_async( 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(), @@ -3247,8 +3269,8 @@ 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"): @@ -3259,7 +3281,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(type(client.transport.upgrade_instance), "__call__") as call: @@ -3301,10 +3323,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(): @@ -3397,9 +3420,14 @@ async def test_upgrade_instance_async_use_cached_wrapped_rpc( @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, @@ -3407,7 +3435,7 @@ async def test_upgrade_instance_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.upgrade_instance), "__call__") as call: @@ -3427,11 +3455,6 @@ async def test_upgrade_instance_async( 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(), @@ -3588,8 +3611,8 @@ 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"): @@ -3600,7 +3623,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(type(client.transport.import_instance), "__call__") as call: @@ -3641,9 +3664,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(): @@ -3734,9 +3758,14 @@ async def test_import_instance_async_use_cached_wrapped_rpc( @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, @@ -3744,7 +3773,7 @@ async def test_import_instance_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.import_instance), "__call__") as call: @@ -3764,11 +3793,6 @@ async def test_import_instance_async( 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(), @@ -3937,8 +3961,8 @@ 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"): @@ -3949,7 +3973,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(type(client.transport.export_instance), "__call__") as call: @@ -3990,9 +4014,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(): @@ -4083,9 +4108,14 @@ async def test_export_instance_async_use_cached_wrapped_rpc( @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, @@ -4093,7 +4123,7 @@ async def test_export_instance_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.export_instance), "__call__") as call: @@ -4113,11 +4143,6 @@ async def test_export_instance_async( 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(), @@ -4286,8 +4311,8 @@ 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"): @@ -4298,7 +4323,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( @@ -4343,9 +4368,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(): @@ -4438,9 +4464,14 @@ async def test_failover_instance_async_use_cached_wrapped_rpc( @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, @@ -4448,7 +4479,7 @@ async def test_failover_instance_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( @@ -4470,11 +4501,6 @@ async def test_failover_instance_async( 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(), @@ -4643,8 +4669,8 @@ 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"): @@ -4655,7 +4681,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(type(client.transport.delete_instance), "__call__") as call: @@ -4696,9 +4722,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(): @@ -4789,9 +4816,14 @@ async def test_delete_instance_async_use_cached_wrapped_rpc( @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, @@ -4799,7 +4831,7 @@ async def test_delete_instance_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_instance), "__call__") as call: @@ -4819,11 +4851,6 @@ async def test_delete_instance_async( 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(), @@ -4970,8 +4997,8 @@ 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"): @@ -4982,7 +5009,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( @@ -5027,9 +5054,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(): @@ -5125,9 +5153,15 @@ async def test_reschedule_maintenance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloud_redis.RescheduleMaintenanceRequest(), + {}, + ], +) async def test_reschedule_maintenance_async( - transport: str = "grpc_asyncio", - request_type=cloud_redis.RescheduleMaintenanceRequest, + request_type, transport: str = "grpc_asyncio" ): client = CloudRedisAsyncClient( credentials=async_anonymous_credentials(), @@ -5136,7 +5170,7 @@ async def test_reschedule_maintenance_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( @@ -5158,11 +5192,6 @@ async def test_reschedule_maintenance_async( 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(), @@ -7611,7 +7640,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 @@ -7632,7 +7660,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 @@ -7655,7 +7682,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 @@ -7676,7 +7702,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 @@ -7697,7 +7722,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 @@ -7718,7 +7742,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 @@ -7739,7 +7762,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 @@ -7760,7 +7782,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 @@ -7783,7 +7804,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 @@ -7804,7 +7824,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 @@ -7827,7 +7846,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 @@ -7869,7 +7887,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 @@ -7918,7 +7935,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 @@ -7947,7 +7963,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 @@ -7972,7 +7987,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 @@ -7997,7 +8011,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 @@ -8022,7 +8035,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 @@ -8047,7 +8059,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 @@ -8072,7 +8083,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 @@ -8099,7 +8109,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 @@ -8124,7 +8133,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 @@ -8151,7 +8159,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 @@ -9899,7 +9906,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 @@ -9919,7 +9925,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 @@ -9941,7 +9946,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 @@ -9961,7 +9965,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 @@ -9981,7 +9984,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 @@ -10001,7 +10003,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 @@ -10021,7 +10022,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 @@ -10041,7 +10041,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 @@ -10063,7 +10062,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 @@ -10083,7 +10081,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 @@ -10105,7 +10102,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 diff --git a/packages/google-cloud-resource-manager/noxfile.py b/packages/google-cloud-resource-manager/noxfile.py index a0f615c15f75..d767a44baff2 100644 --- a/packages/google-cloud-resource-manager/noxfile.py +++ b/packages/google-cloud-resource-manager/noxfile.py @@ -47,7 +47,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-resource-manager" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-resource-manager/setup.py b/packages/google-cloud-resource-manager/setup.py index 341698810ad1..7e406112d4c0 100644 --- a/packages/google-cloud-resource-manager/setup.py +++ b/packages/google-cloud-resource-manager/setup.py @@ -45,7 +45,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/google-cloud-resource-manager/testing/constraints-3.10.txt b/packages/google-cloud-resource-manager/testing/constraints-3.10.txt index a92801e1c8e2..b39cd54634f9 100644 --- a/packages/google-cloud-resource-manager/testing/constraints-3.10.txt +++ b/packages/google-cloud-resource-manager/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/google-cloud-resource-manager/tests/unit/gapic/resourcemanager_v3/test_folders.py b/packages/google-cloud-resource-manager/tests/unit/gapic/resourcemanager_v3/test_folders.py index 126bcadbb37a..cfab6d067299 100644 --- a/packages/google-cloud-resource-manager/tests/unit/gapic/resourcemanager_v3/test_folders.py +++ b/packages/google-cloud-resource-manager/tests/unit/gapic/resourcemanager_v3/test_folders.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 @@ -118,6 +119,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" @@ -1254,8 +1270,8 @@ def test_folders_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - folders.GetFolderRequest, - dict, + folders.GetFolderRequest(), + {}, ], ) def test_get_folder(request_type, transport: str = "grpc"): @@ -1266,7 +1282,7 @@ def test_get_folder(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_folder), "__call__") as call: @@ -1318,9 +1334,10 @@ def test_get_folder_non_empty_request_with_auto_populated_field(): client.get_folder(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == folders.GetFolderRequest( + request_msg = folders.GetFolderRequest( name="name_value", ) + assert args[0] == request_msg def test_get_folder_use_cached_wrapped_rpc(): @@ -1399,9 +1416,14 @@ async def test_get_folder_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_folder_async( - transport: str = "grpc_asyncio", request_type=folders.GetFolderRequest -): +@pytest.mark.parametrize( + "request_type", + [ + folders.GetFolderRequest(), + {}, + ], +) +async def test_get_folder_async(request_type, transport: str = "grpc_asyncio"): client = FoldersAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1409,7 +1431,7 @@ async def test_get_folder_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_folder), "__call__") as call: @@ -1440,11 +1462,6 @@ async def test_get_folder_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_folder_async_from_dict(): - await test_get_folder_async(request_type=dict) - - def test_get_folder_field_headers(): client = FoldersClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1587,8 +1604,8 @@ async def test_get_folder_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - folders.ListFoldersRequest, - dict, + folders.ListFoldersRequest(), + {}, ], ) def test_list_folders(request_type, transport: str = "grpc"): @@ -1599,7 +1616,7 @@ def test_list_folders(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_folders), "__call__") as call: @@ -1644,10 +1661,11 @@ def test_list_folders_non_empty_request_with_auto_populated_field(): client.list_folders(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == folders.ListFoldersRequest( + request_msg = folders.ListFoldersRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_folders_use_cached_wrapped_rpc(): @@ -1728,9 +1746,14 @@ async def test_list_folders_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_folders_async( - transport: str = "grpc_asyncio", request_type=folders.ListFoldersRequest -): +@pytest.mark.parametrize( + "request_type", + [ + folders.ListFoldersRequest(), + {}, + ], +) +async def test_list_folders_async(request_type, transport: str = "grpc_asyncio"): client = FoldersAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1738,7 +1761,7 @@ async def test_list_folders_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_folders), "__call__") as call: @@ -1761,11 +1784,6 @@ async def test_list_folders_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_folders_async_from_dict(): - await test_list_folders_async(request_type=dict) - - def test_list_folders_flattened(): client = FoldersClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2038,8 +2056,8 @@ async def test_list_folders_async_pages(): @pytest.mark.parametrize( "request_type", [ - folders.SearchFoldersRequest, - dict, + folders.SearchFoldersRequest(), + {}, ], ) def test_search_folders(request_type, transport: str = "grpc"): @@ -2050,7 +2068,7 @@ def test_search_folders(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.search_folders), "__call__") as call: @@ -2095,10 +2113,11 @@ def test_search_folders_non_empty_request_with_auto_populated_field(): client.search_folders(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == folders.SearchFoldersRequest( + request_msg = folders.SearchFoldersRequest( page_token="page_token_value", query="query_value", ) + assert args[0] == request_msg def test_search_folders_use_cached_wrapped_rpc(): @@ -2179,9 +2198,14 @@ async def test_search_folders_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_search_folders_async( - transport: str = "grpc_asyncio", request_type=folders.SearchFoldersRequest -): +@pytest.mark.parametrize( + "request_type", + [ + folders.SearchFoldersRequest(), + {}, + ], +) +async def test_search_folders_async(request_type, transport: str = "grpc_asyncio"): client = FoldersAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2189,7 +2213,7 @@ async def test_search_folders_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.search_folders), "__call__") as call: @@ -2212,11 +2236,6 @@ async def test_search_folders_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_search_folders_async_from_dict(): - await test_search_folders_async(request_type=dict) - - def test_search_folders_flattened(): client = FoldersClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2489,8 +2508,8 @@ async def test_search_folders_async_pages(): @pytest.mark.parametrize( "request_type", [ - folders.CreateFolderRequest, - dict, + folders.CreateFolderRequest(), + {}, ], ) def test_create_folder(request_type, transport: str = "grpc"): @@ -2501,7 +2520,7 @@ def test_create_folder(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_folder), "__call__") as call: @@ -2540,7 +2559,8 @@ def test_create_folder_non_empty_request_with_auto_populated_field(): client.create_folder(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == folders.CreateFolderRequest() + request_msg = folders.CreateFolderRequest() + assert args[0] == request_msg def test_create_folder_use_cached_wrapped_rpc(): @@ -2631,9 +2651,14 @@ async def test_create_folder_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_folder_async( - transport: str = "grpc_asyncio", request_type=folders.CreateFolderRequest -): +@pytest.mark.parametrize( + "request_type", + [ + folders.CreateFolderRequest(), + {}, + ], +) +async def test_create_folder_async(request_type, transport: str = "grpc_asyncio"): client = FoldersAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2641,7 +2666,7 @@ async def test_create_folder_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_folder), "__call__") as call: @@ -2661,11 +2686,6 @@ async def test_create_folder_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_folder_async_from_dict(): - await test_create_folder_async(request_type=dict) - - def test_create_folder_flattened(): client = FoldersClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2751,8 +2771,8 @@ async def test_create_folder_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - folders.UpdateFolderRequest, - dict, + folders.UpdateFolderRequest(), + {}, ], ) def test_update_folder(request_type, transport: str = "grpc"): @@ -2763,7 +2783,7 @@ def test_update_folder(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_folder), "__call__") as call: @@ -2802,7 +2822,8 @@ def test_update_folder_non_empty_request_with_auto_populated_field(): client.update_folder(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == folders.UpdateFolderRequest() + request_msg = folders.UpdateFolderRequest() + assert args[0] == request_msg def test_update_folder_use_cached_wrapped_rpc(): @@ -2893,9 +2914,14 @@ async def test_update_folder_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_folder_async( - transport: str = "grpc_asyncio", request_type=folders.UpdateFolderRequest -): +@pytest.mark.parametrize( + "request_type", + [ + folders.UpdateFolderRequest(), + {}, + ], +) +async def test_update_folder_async(request_type, transport: str = "grpc_asyncio"): client = FoldersAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2903,7 +2929,7 @@ async def test_update_folder_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_folder), "__call__") as call: @@ -2923,11 +2949,6 @@ async def test_update_folder_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_folder_async_from_dict(): - await test_update_folder_async(request_type=dict) - - def test_update_folder_field_headers(): client = FoldersClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3084,8 +3105,8 @@ async def test_update_folder_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - folders.MoveFolderRequest, - dict, + folders.MoveFolderRequest(), + {}, ], ) def test_move_folder(request_type, transport: str = "grpc"): @@ -3096,7 +3117,7 @@ def test_move_folder(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.move_folder), "__call__") as call: @@ -3138,10 +3159,11 @@ def test_move_folder_non_empty_request_with_auto_populated_field(): client.move_folder(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == folders.MoveFolderRequest( + request_msg = folders.MoveFolderRequest( name="name_value", destination_parent="destination_parent_value", ) + assert args[0] == request_msg def test_move_folder_use_cached_wrapped_rpc(): @@ -3232,9 +3254,14 @@ async def test_move_folder_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_move_folder_async( - transport: str = "grpc_asyncio", request_type=folders.MoveFolderRequest -): +@pytest.mark.parametrize( + "request_type", + [ + folders.MoveFolderRequest(), + {}, + ], +) +async def test_move_folder_async(request_type, transport: str = "grpc_asyncio"): client = FoldersAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3242,7 +3269,7 @@ async def test_move_folder_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.move_folder), "__call__") as call: @@ -3262,11 +3289,6 @@ async def test_move_folder_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_move_folder_async_from_dict(): - await test_move_folder_async(request_type=dict) - - def test_move_folder_field_headers(): client = FoldersClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3423,8 +3445,8 @@ async def test_move_folder_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - folders.DeleteFolderRequest, - dict, + folders.DeleteFolderRequest(), + {}, ], ) def test_delete_folder(request_type, transport: str = "grpc"): @@ -3435,7 +3457,7 @@ def test_delete_folder(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_folder), "__call__") as call: @@ -3476,9 +3498,10 @@ def test_delete_folder_non_empty_request_with_auto_populated_field(): client.delete_folder(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == folders.DeleteFolderRequest( + request_msg = folders.DeleteFolderRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_folder_use_cached_wrapped_rpc(): @@ -3569,9 +3592,14 @@ async def test_delete_folder_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_folder_async( - transport: str = "grpc_asyncio", request_type=folders.DeleteFolderRequest -): +@pytest.mark.parametrize( + "request_type", + [ + folders.DeleteFolderRequest(), + {}, + ], +) +async def test_delete_folder_async(request_type, transport: str = "grpc_asyncio"): client = FoldersAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3579,7 +3607,7 @@ async def test_delete_folder_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_folder), "__call__") as call: @@ -3599,11 +3627,6 @@ async def test_delete_folder_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_folder_async_from_dict(): - await test_delete_folder_async(request_type=dict) - - def test_delete_folder_field_headers(): client = FoldersClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3750,8 +3773,8 @@ async def test_delete_folder_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - folders.UndeleteFolderRequest, - dict, + folders.UndeleteFolderRequest(), + {}, ], ) def test_undelete_folder(request_type, transport: str = "grpc"): @@ -3762,7 +3785,7 @@ def test_undelete_folder(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_folder), "__call__") as call: @@ -3803,9 +3826,10 @@ def test_undelete_folder_non_empty_request_with_auto_populated_field(): client.undelete_folder(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == folders.UndeleteFolderRequest( + request_msg = folders.UndeleteFolderRequest( name="name_value", ) + assert args[0] == request_msg def test_undelete_folder_use_cached_wrapped_rpc(): @@ -3896,9 +3920,14 @@ async def test_undelete_folder_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_undelete_folder_async( - transport: str = "grpc_asyncio", request_type=folders.UndeleteFolderRequest -): +@pytest.mark.parametrize( + "request_type", + [ + folders.UndeleteFolderRequest(), + {}, + ], +) +async def test_undelete_folder_async(request_type, transport: str = "grpc_asyncio"): client = FoldersAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3906,7 +3935,7 @@ async def test_undelete_folder_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_folder), "__call__") as call: @@ -3926,11 +3955,6 @@ async def test_undelete_folder_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_undelete_folder_async_from_dict(): - await test_undelete_folder_async(request_type=dict) - - def test_undelete_folder_field_headers(): client = FoldersClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4077,8 +4101,8 @@ async def test_undelete_folder_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.GetIamPolicyRequest, - dict, + iam_policy_pb2.GetIamPolicyRequest(), + {}, ], ) def test_get_iam_policy(request_type, transport: str = "grpc"): @@ -4089,7 +4113,7 @@ def test_get_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(type(client.transport.get_iam_policy), "__call__") as call: @@ -4135,9 +4159,10 @@ def test_get_iam_policy_non_empty_request_with_auto_populated_field(): client.get_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.GetIamPolicyRequest( + request_msg = iam_policy_pb2.GetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_get_iam_policy_use_cached_wrapped_rpc(): @@ -4218,9 +4243,14 @@ async def test_get_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.GetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.GetIamPolicyRequest(), + {}, + ], +) +async def test_get_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = FoldersAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4228,7 +4258,7 @@ async def test_get_iam_policy_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_iam_policy), "__call__") as call: @@ -4253,11 +4283,6 @@ async def test_get_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_get_iam_policy_async_from_dict(): - await test_get_iam_policy_async(request_type=dict) - - def test_get_iam_policy_field_headers(): client = FoldersClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4417,8 +4442,8 @@ async def test_get_iam_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.SetIamPolicyRequest, - dict, + iam_policy_pb2.SetIamPolicyRequest(), + {}, ], ) def test_set_iam_policy(request_type, transport: str = "grpc"): @@ -4429,7 +4454,7 @@ def test_set_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(type(client.transport.set_iam_policy), "__call__") as call: @@ -4475,9 +4500,10 @@ def test_set_iam_policy_non_empty_request_with_auto_populated_field(): client.set_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.SetIamPolicyRequest( + request_msg = iam_policy_pb2.SetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_set_iam_policy_use_cached_wrapped_rpc(): @@ -4558,9 +4584,14 @@ async def test_set_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.SetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.SetIamPolicyRequest(), + {}, + ], +) +async def test_set_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = FoldersAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4568,7 +4599,7 @@ async def test_set_iam_policy_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.set_iam_policy), "__call__") as call: @@ -4593,11 +4624,6 @@ async def test_set_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_set_iam_policy_async_from_dict(): - await test_set_iam_policy_async(request_type=dict) - - def test_set_iam_policy_field_headers(): client = FoldersClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4758,8 +4784,8 @@ async def test_set_iam_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.TestIamPermissionsRequest, - dict, + iam_policy_pb2.TestIamPermissionsRequest(), + {}, ], ) def test_test_iam_permissions(request_type, transport: str = "grpc"): @@ -4770,7 +4796,7 @@ def test_test_iam_permissions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4818,9 +4844,10 @@ def test_test_iam_permissions_non_empty_request_with_auto_populated_field(): client.test_iam_permissions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.TestIamPermissionsRequest( + request_msg = iam_policy_pb2.TestIamPermissionsRequest( resource="resource_value", ) + assert args[0] == request_msg def test_test_iam_permissions_use_cached_wrapped_rpc(): @@ -4905,9 +4932,15 @@ async def test_test_iam_permissions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.TestIamPermissionsRequest(), + {}, + ], +) async def test_test_iam_permissions_async( - transport: str = "grpc_asyncio", - request_type=iam_policy_pb2.TestIamPermissionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = FoldersAsyncClient( credentials=async_anonymous_credentials(), @@ -4916,7 +4949,7 @@ async def test_test_iam_permissions_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( @@ -4941,11 +4974,6 @@ async def test_test_iam_permissions_async( assert response.permissions == ["permissions_value"] -@pytest.mark.asyncio -async def test_test_iam_permissions_async_from_dict(): - await test_test_iam_permissions_async(request_type=dict) - - def test_test_iam_permissions_field_headers(): client = FoldersClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7268,7 +7296,6 @@ def test_get_folder_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = folders.GetFolderRequest() - assert args[0] == request_msg @@ -7289,7 +7316,6 @@ def test_list_folders_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = folders.ListFoldersRequest() - assert args[0] == request_msg @@ -7310,7 +7336,6 @@ def test_search_folders_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = folders.SearchFoldersRequest() - assert args[0] == request_msg @@ -7331,7 +7356,6 @@ def test_create_folder_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = folders.CreateFolderRequest() - assert args[0] == request_msg @@ -7352,7 +7376,6 @@ def test_update_folder_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = folders.UpdateFolderRequest() - assert args[0] == request_msg @@ -7373,7 +7396,6 @@ def test_move_folder_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = folders.MoveFolderRequest() - assert args[0] == request_msg @@ -7394,7 +7416,6 @@ def test_delete_folder_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = folders.DeleteFolderRequest() - assert args[0] == request_msg @@ -7415,7 +7436,6 @@ def test_undelete_folder_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = folders.UndeleteFolderRequest() - assert args[0] == request_msg @@ -7436,7 +7456,6 @@ def test_get_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -7457,7 +7476,6 @@ def test_set_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -7480,7 +7498,6 @@ def test_test_iam_permissions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -7525,7 +7542,6 @@ async def test_get_folder_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = folders.GetFolderRequest() - assert args[0] == request_msg @@ -7552,7 +7568,6 @@ async def test_list_folders_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = folders.ListFoldersRequest() - assert args[0] == request_msg @@ -7579,7 +7594,6 @@ async def test_search_folders_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = folders.SearchFoldersRequest() - assert args[0] == request_msg @@ -7604,7 +7618,6 @@ async def test_create_folder_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = folders.CreateFolderRequest() - assert args[0] == request_msg @@ -7629,7 +7642,6 @@ async def test_update_folder_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = folders.UpdateFolderRequest() - assert args[0] == request_msg @@ -7654,7 +7666,6 @@ async def test_move_folder_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = folders.MoveFolderRequest() - assert args[0] == request_msg @@ -7679,7 +7690,6 @@ async def test_delete_folder_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = folders.DeleteFolderRequest() - assert args[0] == request_msg @@ -7704,7 +7714,6 @@ async def test_undelete_folder_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = folders.UndeleteFolderRequest() - assert args[0] == request_msg @@ -7732,7 +7741,6 @@ async def test_get_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -7760,7 +7768,6 @@ async def test_set_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -7789,7 +7796,6 @@ async def test_test_iam_permissions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -9387,7 +9393,6 @@ def test_get_folder_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = folders.GetFolderRequest() - assert args[0] == request_msg @@ -9407,7 +9412,6 @@ def test_list_folders_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = folders.ListFoldersRequest() - assert args[0] == request_msg @@ -9427,7 +9431,6 @@ def test_search_folders_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = folders.SearchFoldersRequest() - assert args[0] == request_msg @@ -9447,7 +9450,6 @@ def test_create_folder_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = folders.CreateFolderRequest() - assert args[0] == request_msg @@ -9467,7 +9469,6 @@ def test_update_folder_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = folders.UpdateFolderRequest() - assert args[0] == request_msg @@ -9487,7 +9488,6 @@ def test_move_folder_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = folders.MoveFolderRequest() - assert args[0] == request_msg @@ -9507,7 +9507,6 @@ def test_delete_folder_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = folders.DeleteFolderRequest() - assert args[0] == request_msg @@ -9527,7 +9526,6 @@ def test_undelete_folder_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = folders.UndeleteFolderRequest() - assert args[0] == request_msg @@ -9547,7 +9545,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -9567,7 +9564,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -9589,7 +9585,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-resource-manager/tests/unit/gapic/resourcemanager_v3/test_organizations.py b/packages/google-cloud-resource-manager/tests/unit/gapic/resourcemanager_v3/test_organizations.py index f14efe6c13de..a0bc568c3486 100644 --- a/packages/google-cloud-resource-manager/tests/unit/gapic/resourcemanager_v3/test_organizations.py +++ b/packages/google-cloud-resource-manager/tests/unit/gapic/resourcemanager_v3/test_organizations.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 @@ -114,6 +115,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" @@ -1316,8 +1332,8 @@ def test_organizations_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - organizations.GetOrganizationRequest, - dict, + organizations.GetOrganizationRequest(), + {}, ], ) def test_get_organization(request_type, transport: str = "grpc"): @@ -1328,7 +1344,7 @@ def test_get_organization(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_organization), "__call__") as call: @@ -1379,9 +1395,10 @@ def test_get_organization_non_empty_request_with_auto_populated_field(): client.get_organization(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == organizations.GetOrganizationRequest( + request_msg = organizations.GetOrganizationRequest( name="name_value", ) + assert args[0] == request_msg def test_get_organization_use_cached_wrapped_rpc(): @@ -1464,9 +1481,14 @@ async def test_get_organization_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_organization_async( - transport: str = "grpc_asyncio", request_type=organizations.GetOrganizationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + organizations.GetOrganizationRequest(), + {}, + ], +) +async def test_get_organization_async(request_type, transport: str = "grpc_asyncio"): client = OrganizationsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1474,7 +1496,7 @@ async def test_get_organization_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_organization), "__call__") as call: @@ -1503,11 +1525,6 @@ async def test_get_organization_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_organization_async_from_dict(): - await test_get_organization_async(request_type=dict) - - def test_get_organization_field_headers(): client = OrganizationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1654,8 +1671,8 @@ async def test_get_organization_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - organizations.SearchOrganizationsRequest, - dict, + organizations.SearchOrganizationsRequest(), + {}, ], ) def test_search_organizations(request_type, transport: str = "grpc"): @@ -1666,7 +1683,7 @@ def test_search_organizations(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1715,10 +1732,11 @@ def test_search_organizations_non_empty_request_with_auto_populated_field(): client.search_organizations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == organizations.SearchOrganizationsRequest( + request_msg = organizations.SearchOrganizationsRequest( page_token="page_token_value", query="query_value", ) + assert args[0] == request_msg def test_search_organizations_use_cached_wrapped_rpc(): @@ -1803,9 +1821,15 @@ async def test_search_organizations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + organizations.SearchOrganizationsRequest(), + {}, + ], +) async def test_search_organizations_async( - transport: str = "grpc_asyncio", - request_type=organizations.SearchOrganizationsRequest, + request_type, transport: str = "grpc_asyncio" ): client = OrganizationsAsyncClient( credentials=async_anonymous_credentials(), @@ -1814,7 +1838,7 @@ async def test_search_organizations_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( @@ -1839,11 +1863,6 @@ async def test_search_organizations_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_search_organizations_async_from_dict(): - await test_search_organizations_async(request_type=dict) - - def test_search_organizations_flattened(): client = OrganizationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2128,8 +2147,8 @@ async def test_search_organizations_async_pages(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.GetIamPolicyRequest, - dict, + iam_policy_pb2.GetIamPolicyRequest(), + {}, ], ) def test_get_iam_policy(request_type, transport: str = "grpc"): @@ -2140,7 +2159,7 @@ def test_get_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(type(client.transport.get_iam_policy), "__call__") as call: @@ -2186,9 +2205,10 @@ def test_get_iam_policy_non_empty_request_with_auto_populated_field(): client.get_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.GetIamPolicyRequest( + request_msg = iam_policy_pb2.GetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_get_iam_policy_use_cached_wrapped_rpc(): @@ -2269,9 +2289,14 @@ async def test_get_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.GetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.GetIamPolicyRequest(), + {}, + ], +) +async def test_get_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = OrganizationsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2279,7 +2304,7 @@ async def test_get_iam_policy_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_iam_policy), "__call__") as call: @@ -2304,11 +2329,6 @@ async def test_get_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_get_iam_policy_async_from_dict(): - await test_get_iam_policy_async(request_type=dict) - - def test_get_iam_policy_field_headers(): client = OrganizationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2468,8 +2488,8 @@ async def test_get_iam_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.SetIamPolicyRequest, - dict, + iam_policy_pb2.SetIamPolicyRequest(), + {}, ], ) def test_set_iam_policy(request_type, transport: str = "grpc"): @@ -2480,7 +2500,7 @@ def test_set_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(type(client.transport.set_iam_policy), "__call__") as call: @@ -2526,9 +2546,10 @@ def test_set_iam_policy_non_empty_request_with_auto_populated_field(): client.set_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.SetIamPolicyRequest( + request_msg = iam_policy_pb2.SetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_set_iam_policy_use_cached_wrapped_rpc(): @@ -2609,9 +2630,14 @@ async def test_set_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.SetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.SetIamPolicyRequest(), + {}, + ], +) +async def test_set_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = OrganizationsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2619,7 +2645,7 @@ async def test_set_iam_policy_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.set_iam_policy), "__call__") as call: @@ -2644,11 +2670,6 @@ async def test_set_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_set_iam_policy_async_from_dict(): - await test_set_iam_policy_async(request_type=dict) - - def test_set_iam_policy_field_headers(): client = OrganizationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2809,8 +2830,8 @@ async def test_set_iam_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.TestIamPermissionsRequest, - dict, + iam_policy_pb2.TestIamPermissionsRequest(), + {}, ], ) def test_test_iam_permissions(request_type, transport: str = "grpc"): @@ -2821,7 +2842,7 @@ def test_test_iam_permissions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,9 +2890,10 @@ def test_test_iam_permissions_non_empty_request_with_auto_populated_field(): client.test_iam_permissions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.TestIamPermissionsRequest( + request_msg = iam_policy_pb2.TestIamPermissionsRequest( resource="resource_value", ) + assert args[0] == request_msg def test_test_iam_permissions_use_cached_wrapped_rpc(): @@ -2956,9 +2978,15 @@ async def test_test_iam_permissions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.TestIamPermissionsRequest(), + {}, + ], +) async def test_test_iam_permissions_async( - transport: str = "grpc_asyncio", - request_type=iam_policy_pb2.TestIamPermissionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = OrganizationsAsyncClient( credentials=async_anonymous_credentials(), @@ -2967,7 +2995,7 @@ async def test_test_iam_permissions_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( @@ -2992,11 +3020,6 @@ async def test_test_iam_permissions_async( assert response.permissions == ["permissions_value"] -@pytest.mark.asyncio -async def test_test_iam_permissions_async_from_dict(): - await test_test_iam_permissions_async(request_type=dict) - - def test_test_iam_permissions_field_headers(): client = OrganizationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4186,7 +4209,6 @@ def test_get_organization_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = organizations.GetOrganizationRequest() - assert args[0] == request_msg @@ -4209,7 +4231,6 @@ def test_search_organizations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = organizations.SearchOrganizationsRequest() - assert args[0] == request_msg @@ -4230,7 +4251,6 @@ def test_get_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -4251,7 +4271,6 @@ def test_set_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -4274,7 +4293,6 @@ def test_test_iam_permissions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -4318,7 +4336,6 @@ async def test_get_organization_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = organizations.GetOrganizationRequest() - assert args[0] == request_msg @@ -4347,7 +4364,6 @@ async def test_search_organizations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = organizations.SearchOrganizationsRequest() - assert args[0] == request_msg @@ -4375,7 +4391,6 @@ async def test_get_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -4403,7 +4418,6 @@ async def test_set_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -4432,7 +4446,6 @@ async def test_test_iam_permissions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -5186,7 +5199,6 @@ def test_get_organization_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = organizations.GetOrganizationRequest() - assert args[0] == request_msg @@ -5208,7 +5220,6 @@ def test_search_organizations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = organizations.SearchOrganizationsRequest() - assert args[0] == request_msg @@ -5228,7 +5239,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -5248,7 +5258,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -5270,7 +5279,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-resource-manager/tests/unit/gapic/resourcemanager_v3/test_projects.py b/packages/google-cloud-resource-manager/tests/unit/gapic/resourcemanager_v3/test_projects.py index 7fde7252bb7f..f109c521e21b 100644 --- a/packages/google-cloud-resource-manager/tests/unit/gapic/resourcemanager_v3/test_projects.py +++ b/packages/google-cloud-resource-manager/tests/unit/gapic/resourcemanager_v3/test_projects.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 @@ -118,6 +119,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" @@ -1265,8 +1281,8 @@ def test_projects_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - projects.GetProjectRequest, - dict, + projects.GetProjectRequest(), + {}, ], ) def test_get_project(request_type, transport: str = "grpc"): @@ -1277,7 +1293,7 @@ def test_get_project(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_project), "__call__") as call: @@ -1331,9 +1347,10 @@ def test_get_project_non_empty_request_with_auto_populated_field(): client.get_project(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == projects.GetProjectRequest( + request_msg = projects.GetProjectRequest( name="name_value", ) + assert args[0] == request_msg def test_get_project_use_cached_wrapped_rpc(): @@ -1414,9 +1431,14 @@ async def test_get_project_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_project_async( - transport: str = "grpc_asyncio", request_type=projects.GetProjectRequest -): +@pytest.mark.parametrize( + "request_type", + [ + projects.GetProjectRequest(), + {}, + ], +) +async def test_get_project_async(request_type, transport: str = "grpc_asyncio"): client = ProjectsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1424,7 +1446,7 @@ async def test_get_project_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_project), "__call__") as call: @@ -1457,11 +1479,6 @@ async def test_get_project_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_project_async_from_dict(): - await test_get_project_async(request_type=dict) - - def test_get_project_field_headers(): client = ProjectsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1604,8 +1621,8 @@ async def test_get_project_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - projects.ListProjectsRequest, - dict, + projects.ListProjectsRequest(), + {}, ], ) def test_list_projects(request_type, transport: str = "grpc"): @@ -1616,7 +1633,7 @@ def test_list_projects(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_projects), "__call__") as call: @@ -1661,10 +1678,11 @@ def test_list_projects_non_empty_request_with_auto_populated_field(): client.list_projects(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == projects.ListProjectsRequest( + request_msg = projects.ListProjectsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_projects_use_cached_wrapped_rpc(): @@ -1745,9 +1763,14 @@ async def test_list_projects_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_projects_async( - transport: str = "grpc_asyncio", request_type=projects.ListProjectsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + projects.ListProjectsRequest(), + {}, + ], +) +async def test_list_projects_async(request_type, transport: str = "grpc_asyncio"): client = ProjectsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1755,7 +1778,7 @@ async def test_list_projects_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_projects), "__call__") as call: @@ -1778,11 +1801,6 @@ async def test_list_projects_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_projects_async_from_dict(): - await test_list_projects_async(request_type=dict) - - def test_list_projects_flattened(): client = ProjectsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2055,8 +2073,8 @@ async def test_list_projects_async_pages(): @pytest.mark.parametrize( "request_type", [ - projects.SearchProjectsRequest, - dict, + projects.SearchProjectsRequest(), + {}, ], ) def test_search_projects(request_type, transport: str = "grpc"): @@ -2067,7 +2085,7 @@ def test_search_projects(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.search_projects), "__call__") as call: @@ -2112,10 +2130,11 @@ def test_search_projects_non_empty_request_with_auto_populated_field(): client.search_projects(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == projects.SearchProjectsRequest( + request_msg = projects.SearchProjectsRequest( query="query_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_search_projects_use_cached_wrapped_rpc(): @@ -2196,9 +2215,14 @@ async def test_search_projects_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_search_projects_async( - transport: str = "grpc_asyncio", request_type=projects.SearchProjectsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + projects.SearchProjectsRequest(), + {}, + ], +) +async def test_search_projects_async(request_type, transport: str = "grpc_asyncio"): client = ProjectsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2206,7 +2230,7 @@ async def test_search_projects_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.search_projects), "__call__") as call: @@ -2229,11 +2253,6 @@ async def test_search_projects_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_search_projects_async_from_dict(): - await test_search_projects_async(request_type=dict) - - def test_search_projects_flattened(): client = ProjectsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2506,8 +2525,8 @@ async def test_search_projects_async_pages(): @pytest.mark.parametrize( "request_type", [ - projects.CreateProjectRequest, - dict, + projects.CreateProjectRequest(), + {}, ], ) def test_create_project(request_type, transport: str = "grpc"): @@ -2518,7 +2537,7 @@ def test_create_project(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_project), "__call__") as call: @@ -2557,7 +2576,8 @@ def test_create_project_non_empty_request_with_auto_populated_field(): client.create_project(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == projects.CreateProjectRequest() + request_msg = projects.CreateProjectRequest() + assert args[0] == request_msg def test_create_project_use_cached_wrapped_rpc(): @@ -2648,9 +2668,14 @@ async def test_create_project_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_project_async( - transport: str = "grpc_asyncio", request_type=projects.CreateProjectRequest -): +@pytest.mark.parametrize( + "request_type", + [ + projects.CreateProjectRequest(), + {}, + ], +) +async def test_create_project_async(request_type, transport: str = "grpc_asyncio"): client = ProjectsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2658,7 +2683,7 @@ async def test_create_project_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_project), "__call__") as call: @@ -2678,11 +2703,6 @@ async def test_create_project_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_project_async_from_dict(): - await test_create_project_async(request_type=dict) - - def test_create_project_flattened(): client = ProjectsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2768,8 +2788,8 @@ async def test_create_project_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - projects.UpdateProjectRequest, - dict, + projects.UpdateProjectRequest(), + {}, ], ) def test_update_project(request_type, transport: str = "grpc"): @@ -2780,7 +2800,7 @@ def test_update_project(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_project), "__call__") as call: @@ -2819,7 +2839,8 @@ def test_update_project_non_empty_request_with_auto_populated_field(): client.update_project(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == projects.UpdateProjectRequest() + request_msg = projects.UpdateProjectRequest() + assert args[0] == request_msg def test_update_project_use_cached_wrapped_rpc(): @@ -2910,9 +2931,14 @@ async def test_update_project_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_project_async( - transport: str = "grpc_asyncio", request_type=projects.UpdateProjectRequest -): +@pytest.mark.parametrize( + "request_type", + [ + projects.UpdateProjectRequest(), + {}, + ], +) +async def test_update_project_async(request_type, transport: str = "grpc_asyncio"): client = ProjectsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2920,7 +2946,7 @@ async def test_update_project_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_project), "__call__") as call: @@ -2940,11 +2966,6 @@ async def test_update_project_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_project_async_from_dict(): - await test_update_project_async(request_type=dict) - - def test_update_project_field_headers(): client = ProjectsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3101,8 +3122,8 @@ async def test_update_project_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - projects.MoveProjectRequest, - dict, + projects.MoveProjectRequest(), + {}, ], ) def test_move_project(request_type, transport: str = "grpc"): @@ -3113,7 +3134,7 @@ def test_move_project(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.move_project), "__call__") as call: @@ -3155,10 +3176,11 @@ def test_move_project_non_empty_request_with_auto_populated_field(): client.move_project(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == projects.MoveProjectRequest( + request_msg = projects.MoveProjectRequest( name="name_value", destination_parent="destination_parent_value", ) + assert args[0] == request_msg def test_move_project_use_cached_wrapped_rpc(): @@ -3249,9 +3271,14 @@ async def test_move_project_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_move_project_async( - transport: str = "grpc_asyncio", request_type=projects.MoveProjectRequest -): +@pytest.mark.parametrize( + "request_type", + [ + projects.MoveProjectRequest(), + {}, + ], +) +async def test_move_project_async(request_type, transport: str = "grpc_asyncio"): client = ProjectsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3259,7 +3286,7 @@ async def test_move_project_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.move_project), "__call__") as call: @@ -3279,11 +3306,6 @@ async def test_move_project_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_move_project_async_from_dict(): - await test_move_project_async(request_type=dict) - - def test_move_project_field_headers(): client = ProjectsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3440,8 +3462,8 @@ async def test_move_project_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - projects.DeleteProjectRequest, - dict, + projects.DeleteProjectRequest(), + {}, ], ) def test_delete_project(request_type, transport: str = "grpc"): @@ -3452,7 +3474,7 @@ def test_delete_project(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_project), "__call__") as call: @@ -3493,9 +3515,10 @@ def test_delete_project_non_empty_request_with_auto_populated_field(): client.delete_project(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == projects.DeleteProjectRequest( + request_msg = projects.DeleteProjectRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_project_use_cached_wrapped_rpc(): @@ -3586,9 +3609,14 @@ async def test_delete_project_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_project_async( - transport: str = "grpc_asyncio", request_type=projects.DeleteProjectRequest -): +@pytest.mark.parametrize( + "request_type", + [ + projects.DeleteProjectRequest(), + {}, + ], +) +async def test_delete_project_async(request_type, transport: str = "grpc_asyncio"): client = ProjectsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3596,7 +3624,7 @@ async def test_delete_project_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_project), "__call__") as call: @@ -3616,11 +3644,6 @@ async def test_delete_project_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_project_async_from_dict(): - await test_delete_project_async(request_type=dict) - - def test_delete_project_field_headers(): client = ProjectsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3767,8 +3790,8 @@ async def test_delete_project_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - projects.UndeleteProjectRequest, - dict, + projects.UndeleteProjectRequest(), + {}, ], ) def test_undelete_project(request_type, transport: str = "grpc"): @@ -3779,7 +3802,7 @@ def test_undelete_project(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_project), "__call__") as call: @@ -3820,9 +3843,10 @@ def test_undelete_project_non_empty_request_with_auto_populated_field(): client.undelete_project(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == projects.UndeleteProjectRequest( + request_msg = projects.UndeleteProjectRequest( name="name_value", ) + assert args[0] == request_msg def test_undelete_project_use_cached_wrapped_rpc(): @@ -3915,9 +3939,14 @@ async def test_undelete_project_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_undelete_project_async( - transport: str = "grpc_asyncio", request_type=projects.UndeleteProjectRequest -): +@pytest.mark.parametrize( + "request_type", + [ + projects.UndeleteProjectRequest(), + {}, + ], +) +async def test_undelete_project_async(request_type, transport: str = "grpc_asyncio"): client = ProjectsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3925,7 +3954,7 @@ async def test_undelete_project_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_project), "__call__") as call: @@ -3945,11 +3974,6 @@ async def test_undelete_project_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_undelete_project_async_from_dict(): - await test_undelete_project_async(request_type=dict) - - def test_undelete_project_field_headers(): client = ProjectsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4096,8 +4120,8 @@ async def test_undelete_project_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.GetIamPolicyRequest, - dict, + iam_policy_pb2.GetIamPolicyRequest(), + {}, ], ) def test_get_iam_policy(request_type, transport: str = "grpc"): @@ -4108,7 +4132,7 @@ def test_get_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(type(client.transport.get_iam_policy), "__call__") as call: @@ -4154,9 +4178,10 @@ def test_get_iam_policy_non_empty_request_with_auto_populated_field(): client.get_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.GetIamPolicyRequest( + request_msg = iam_policy_pb2.GetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_get_iam_policy_use_cached_wrapped_rpc(): @@ -4237,9 +4262,14 @@ async def test_get_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.GetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.GetIamPolicyRequest(), + {}, + ], +) +async def test_get_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = ProjectsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4247,7 +4277,7 @@ async def test_get_iam_policy_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_iam_policy), "__call__") as call: @@ -4272,11 +4302,6 @@ async def test_get_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_get_iam_policy_async_from_dict(): - await test_get_iam_policy_async(request_type=dict) - - def test_get_iam_policy_field_headers(): client = ProjectsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4436,8 +4461,8 @@ async def test_get_iam_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.SetIamPolicyRequest, - dict, + iam_policy_pb2.SetIamPolicyRequest(), + {}, ], ) def test_set_iam_policy(request_type, transport: str = "grpc"): @@ -4448,7 +4473,7 @@ def test_set_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(type(client.transport.set_iam_policy), "__call__") as call: @@ -4494,9 +4519,10 @@ def test_set_iam_policy_non_empty_request_with_auto_populated_field(): client.set_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.SetIamPolicyRequest( + request_msg = iam_policy_pb2.SetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_set_iam_policy_use_cached_wrapped_rpc(): @@ -4577,9 +4603,14 @@ async def test_set_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.SetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.SetIamPolicyRequest(), + {}, + ], +) +async def test_set_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = ProjectsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4587,7 +4618,7 @@ async def test_set_iam_policy_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.set_iam_policy), "__call__") as call: @@ -4612,11 +4643,6 @@ async def test_set_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_set_iam_policy_async_from_dict(): - await test_set_iam_policy_async(request_type=dict) - - def test_set_iam_policy_field_headers(): client = ProjectsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4777,8 +4803,8 @@ async def test_set_iam_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.TestIamPermissionsRequest, - dict, + iam_policy_pb2.TestIamPermissionsRequest(), + {}, ], ) def test_test_iam_permissions(request_type, transport: str = "grpc"): @@ -4789,7 +4815,7 @@ def test_test_iam_permissions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4837,9 +4863,10 @@ def test_test_iam_permissions_non_empty_request_with_auto_populated_field(): client.test_iam_permissions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.TestIamPermissionsRequest( + request_msg = iam_policy_pb2.TestIamPermissionsRequest( resource="resource_value", ) + assert args[0] == request_msg def test_test_iam_permissions_use_cached_wrapped_rpc(): @@ -4924,9 +4951,15 @@ async def test_test_iam_permissions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.TestIamPermissionsRequest(), + {}, + ], +) async def test_test_iam_permissions_async( - transport: str = "grpc_asyncio", - request_type=iam_policy_pb2.TestIamPermissionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = ProjectsAsyncClient( credentials=async_anonymous_credentials(), @@ -4935,7 +4968,7 @@ async def test_test_iam_permissions_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( @@ -4960,11 +4993,6 @@ async def test_test_iam_permissions_async( assert response.permissions == ["permissions_value"] -@pytest.mark.asyncio -async def test_test_iam_permissions_async_from_dict(): - await test_test_iam_permissions_async(request_type=dict) - - def test_test_iam_permissions_field_headers(): client = ProjectsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7291,7 +7319,6 @@ def test_get_project_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = projects.GetProjectRequest() - assert args[0] == request_msg @@ -7312,7 +7339,6 @@ def test_list_projects_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = projects.ListProjectsRequest() - assert args[0] == request_msg @@ -7333,7 +7359,6 @@ def test_search_projects_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = projects.SearchProjectsRequest() - assert args[0] == request_msg @@ -7354,7 +7379,6 @@ def test_create_project_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = projects.CreateProjectRequest() - assert args[0] == request_msg @@ -7375,7 +7399,6 @@ def test_update_project_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = projects.UpdateProjectRequest() - assert args[0] == request_msg @@ -7396,7 +7419,6 @@ def test_move_project_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = projects.MoveProjectRequest() - assert args[0] == request_msg @@ -7417,7 +7439,6 @@ def test_delete_project_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = projects.DeleteProjectRequest() - assert args[0] == request_msg @@ -7438,7 +7459,6 @@ def test_undelete_project_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = projects.UndeleteProjectRequest() - assert args[0] == request_msg @@ -7459,7 +7479,6 @@ def test_get_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -7480,7 +7499,6 @@ def test_set_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -7503,7 +7521,6 @@ def test_test_iam_permissions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -7549,7 +7566,6 @@ async def test_get_project_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = projects.GetProjectRequest() - assert args[0] == request_msg @@ -7576,7 +7592,6 @@ async def test_list_projects_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = projects.ListProjectsRequest() - assert args[0] == request_msg @@ -7603,7 +7618,6 @@ async def test_search_projects_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = projects.SearchProjectsRequest() - assert args[0] == request_msg @@ -7628,7 +7642,6 @@ async def test_create_project_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = projects.CreateProjectRequest() - assert args[0] == request_msg @@ -7653,7 +7666,6 @@ async def test_update_project_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = projects.UpdateProjectRequest() - assert args[0] == request_msg @@ -7678,7 +7690,6 @@ async def test_move_project_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = projects.MoveProjectRequest() - assert args[0] == request_msg @@ -7703,7 +7714,6 @@ async def test_delete_project_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = projects.DeleteProjectRequest() - assert args[0] == request_msg @@ -7728,7 +7738,6 @@ async def test_undelete_project_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = projects.UndeleteProjectRequest() - assert args[0] == request_msg @@ -7756,7 +7765,6 @@ async def test_get_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -7784,7 +7792,6 @@ async def test_set_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -7813,7 +7820,6 @@ async def test_test_iam_permissions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -9428,7 +9434,6 @@ def test_get_project_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = projects.GetProjectRequest() - assert args[0] == request_msg @@ -9448,7 +9453,6 @@ def test_list_projects_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = projects.ListProjectsRequest() - assert args[0] == request_msg @@ -9468,7 +9472,6 @@ def test_search_projects_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = projects.SearchProjectsRequest() - assert args[0] == request_msg @@ -9488,7 +9491,6 @@ def test_create_project_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = projects.CreateProjectRequest() - assert args[0] == request_msg @@ -9508,7 +9510,6 @@ def test_update_project_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = projects.UpdateProjectRequest() - assert args[0] == request_msg @@ -9528,7 +9529,6 @@ def test_move_project_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = projects.MoveProjectRequest() - assert args[0] == request_msg @@ -9548,7 +9548,6 @@ def test_delete_project_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = projects.DeleteProjectRequest() - assert args[0] == request_msg @@ -9568,7 +9567,6 @@ def test_undelete_project_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = projects.UndeleteProjectRequest() - assert args[0] == request_msg @@ -9588,7 +9586,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -9608,7 +9605,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -9630,7 +9626,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-resource-manager/tests/unit/gapic/resourcemanager_v3/test_tag_bindings.py b/packages/google-cloud-resource-manager/tests/unit/gapic/resourcemanager_v3/test_tag_bindings.py index ae7cd2b8f8cc..18819095ecae 100644 --- a/packages/google-cloud-resource-manager/tests/unit/gapic/resourcemanager_v3/test_tag_bindings.py +++ b/packages/google-cloud-resource-manager/tests/unit/gapic/resourcemanager_v3/test_tag_bindings.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 @@ -113,6 +114,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" @@ -1281,8 +1297,8 @@ def test_tag_bindings_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - tag_bindings.ListTagBindingsRequest, - dict, + tag_bindings.ListTagBindingsRequest(), + {}, ], ) def test_list_tag_bindings(request_type, transport: str = "grpc"): @@ -1293,7 +1309,7 @@ def test_list_tag_bindings(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1342,10 +1358,11 @@ def test_list_tag_bindings_non_empty_request_with_auto_populated_field(): client.list_tag_bindings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tag_bindings.ListTagBindingsRequest( + request_msg = tag_bindings.ListTagBindingsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_tag_bindings_use_cached_wrapped_rpc(): @@ -1428,9 +1445,14 @@ async def test_list_tag_bindings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_tag_bindings_async( - transport: str = "grpc_asyncio", request_type=tag_bindings.ListTagBindingsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tag_bindings.ListTagBindingsRequest(), + {}, + ], +) +async def test_list_tag_bindings_async(request_type, transport: str = "grpc_asyncio"): client = TagBindingsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1438,7 +1460,7 @@ async def test_list_tag_bindings_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( @@ -1463,11 +1485,6 @@ async def test_list_tag_bindings_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_tag_bindings_async_from_dict(): - await test_list_tag_bindings_async(request_type=dict) - - def test_list_tag_bindings_flattened(): client = TagBindingsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1752,8 +1769,8 @@ async def test_list_tag_bindings_async_pages(): @pytest.mark.parametrize( "request_type", [ - tag_bindings.CreateTagBindingRequest, - dict, + tag_bindings.CreateTagBindingRequest(), + {}, ], ) def test_create_tag_binding(request_type, transport: str = "grpc"): @@ -1764,7 +1781,7 @@ def test_create_tag_binding(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1807,7 +1824,8 @@ def test_create_tag_binding_non_empty_request_with_auto_populated_field(): client.create_tag_binding(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tag_bindings.CreateTagBindingRequest() + request_msg = tag_bindings.CreateTagBindingRequest() + assert args[0] == request_msg def test_create_tag_binding_use_cached_wrapped_rpc(): @@ -1902,9 +1920,14 @@ async def test_create_tag_binding_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_tag_binding_async( - transport: str = "grpc_asyncio", request_type=tag_bindings.CreateTagBindingRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tag_bindings.CreateTagBindingRequest(), + {}, + ], +) +async def test_create_tag_binding_async(request_type, transport: str = "grpc_asyncio"): client = TagBindingsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1912,7 +1935,7 @@ async def test_create_tag_binding_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( @@ -1934,11 +1957,6 @@ async def test_create_tag_binding_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_tag_binding_async_from_dict(): - await test_create_tag_binding_async(request_type=dict) - - def test_create_tag_binding_flattened(): client = TagBindingsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2028,8 +2046,8 @@ async def test_create_tag_binding_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - tag_bindings.DeleteTagBindingRequest, - dict, + tag_bindings.DeleteTagBindingRequest(), + {}, ], ) def test_delete_tag_binding(request_type, transport: str = "grpc"): @@ -2040,7 +2058,7 @@ def test_delete_tag_binding(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2085,9 +2103,10 @@ def test_delete_tag_binding_non_empty_request_with_auto_populated_field(): client.delete_tag_binding(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tag_bindings.DeleteTagBindingRequest( + request_msg = tag_bindings.DeleteTagBindingRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_tag_binding_use_cached_wrapped_rpc(): @@ -2182,9 +2201,14 @@ async def test_delete_tag_binding_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_tag_binding_async( - transport: str = "grpc_asyncio", request_type=tag_bindings.DeleteTagBindingRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tag_bindings.DeleteTagBindingRequest(), + {}, + ], +) +async def test_delete_tag_binding_async(request_type, transport: str = "grpc_asyncio"): client = TagBindingsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2192,7 +2216,7 @@ async def test_delete_tag_binding_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( @@ -2214,11 +2238,6 @@ async def test_delete_tag_binding_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_tag_binding_async_from_dict(): - await test_delete_tag_binding_async(request_type=dict) - - def test_delete_tag_binding_field_headers(): client = TagBindingsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2373,8 +2392,8 @@ async def test_delete_tag_binding_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - tag_bindings.ListEffectiveTagsRequest, - dict, + tag_bindings.ListEffectiveTagsRequest(), + {}, ], ) def test_list_effective_tags(request_type, transport: str = "grpc"): @@ -2385,7 +2404,7 @@ def test_list_effective_tags(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2434,10 +2453,11 @@ def test_list_effective_tags_non_empty_request_with_auto_populated_field(): client.list_effective_tags(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tag_bindings.ListEffectiveTagsRequest( + request_msg = tag_bindings.ListEffectiveTagsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_effective_tags_use_cached_wrapped_rpc(): @@ -2522,9 +2542,14 @@ async def test_list_effective_tags_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_effective_tags_async( - transport: str = "grpc_asyncio", request_type=tag_bindings.ListEffectiveTagsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tag_bindings.ListEffectiveTagsRequest(), + {}, + ], +) +async def test_list_effective_tags_async(request_type, transport: str = "grpc_asyncio"): client = TagBindingsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2532,7 +2557,7 @@ async def test_list_effective_tags_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( @@ -2557,11 +2582,6 @@ async def test_list_effective_tags_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_effective_tags_async_from_dict(): - await test_list_effective_tags_async(request_type=dict) - - def test_list_effective_tags_flattened(): client = TagBindingsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3860,7 +3880,6 @@ def test_list_tag_bindings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag_bindings.ListTagBindingsRequest() - assert args[0] == request_msg @@ -3883,7 +3902,6 @@ def test_create_tag_binding_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag_bindings.CreateTagBindingRequest() - assert args[0] == request_msg @@ -3906,7 +3924,6 @@ def test_delete_tag_binding_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag_bindings.DeleteTagBindingRequest() - assert args[0] == request_msg @@ -3929,7 +3946,6 @@ def test_list_effective_tags_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag_bindings.ListEffectiveTagsRequest() - assert args[0] == request_msg @@ -3972,7 +3988,6 @@ async def test_list_tag_bindings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag_bindings.ListTagBindingsRequest() - assert args[0] == request_msg @@ -3999,7 +4014,6 @@ async def test_create_tag_binding_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag_bindings.CreateTagBindingRequest() - assert args[0] == request_msg @@ -4026,7 +4040,6 @@ async def test_delete_tag_binding_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag_bindings.DeleteTagBindingRequest() - assert args[0] == request_msg @@ -4055,7 +4068,6 @@ async def test_list_effective_tags_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag_bindings.ListEffectiveTagsRequest() - assert args[0] == request_msg @@ -4749,7 +4761,6 @@ def test_list_tag_bindings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag_bindings.ListTagBindingsRequest() - assert args[0] == request_msg @@ -4771,7 +4782,6 @@ def test_create_tag_binding_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag_bindings.CreateTagBindingRequest() - assert args[0] == request_msg @@ -4793,7 +4803,6 @@ def test_delete_tag_binding_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag_bindings.DeleteTagBindingRequest() - assert args[0] == request_msg @@ -4815,7 +4824,6 @@ def test_list_effective_tags_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag_bindings.ListEffectiveTagsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-resource-manager/tests/unit/gapic/resourcemanager_v3/test_tag_holds.py b/packages/google-cloud-resource-manager/tests/unit/gapic/resourcemanager_v3/test_tag_holds.py index 90083e60447c..dd7018c66b68 100644 --- a/packages/google-cloud-resource-manager/tests/unit/gapic/resourcemanager_v3/test_tag_holds.py +++ b/packages/google-cloud-resource-manager/tests/unit/gapic/resourcemanager_v3/test_tag_holds.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 @@ -114,6 +115,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" @@ -1261,8 +1277,8 @@ def test_tag_holds_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - tag_holds.CreateTagHoldRequest, - dict, + tag_holds.CreateTagHoldRequest(), + {}, ], ) def test_create_tag_hold(request_type, transport: str = "grpc"): @@ -1273,7 +1289,7 @@ def test_create_tag_hold(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tag_hold), "__call__") as call: @@ -1314,9 +1330,10 @@ def test_create_tag_hold_non_empty_request_with_auto_populated_field(): client.create_tag_hold(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tag_holds.CreateTagHoldRequest( + request_msg = tag_holds.CreateTagHoldRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_tag_hold_use_cached_wrapped_rpc(): @@ -1407,9 +1424,14 @@ async def test_create_tag_hold_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_tag_hold_async( - transport: str = "grpc_asyncio", request_type=tag_holds.CreateTagHoldRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tag_holds.CreateTagHoldRequest(), + {}, + ], +) +async def test_create_tag_hold_async(request_type, transport: str = "grpc_asyncio"): client = TagHoldsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1417,7 +1439,7 @@ async def test_create_tag_hold_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_tag_hold), "__call__") as call: @@ -1437,11 +1459,6 @@ async def test_create_tag_hold_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_tag_hold_async_from_dict(): - await test_create_tag_hold_async(request_type=dict) - - def test_create_tag_hold_field_headers(): client = TagHoldsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1598,8 +1615,8 @@ async def test_create_tag_hold_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - tag_holds.DeleteTagHoldRequest, - dict, + tag_holds.DeleteTagHoldRequest(), + {}, ], ) def test_delete_tag_hold(request_type, transport: str = "grpc"): @@ -1610,7 +1627,7 @@ def test_delete_tag_hold(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tag_hold), "__call__") as call: @@ -1651,9 +1668,10 @@ def test_delete_tag_hold_non_empty_request_with_auto_populated_field(): client.delete_tag_hold(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tag_holds.DeleteTagHoldRequest( + request_msg = tag_holds.DeleteTagHoldRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_tag_hold_use_cached_wrapped_rpc(): @@ -1744,9 +1762,14 @@ async def test_delete_tag_hold_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_tag_hold_async( - transport: str = "grpc_asyncio", request_type=tag_holds.DeleteTagHoldRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tag_holds.DeleteTagHoldRequest(), + {}, + ], +) +async def test_delete_tag_hold_async(request_type, transport: str = "grpc_asyncio"): client = TagHoldsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1754,7 +1777,7 @@ async def test_delete_tag_hold_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_tag_hold), "__call__") as call: @@ -1774,11 +1797,6 @@ async def test_delete_tag_hold_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_tag_hold_async_from_dict(): - await test_delete_tag_hold_async(request_type=dict) - - def test_delete_tag_hold_field_headers(): client = TagHoldsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1925,8 +1943,8 @@ async def test_delete_tag_hold_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - tag_holds.ListTagHoldsRequest, - dict, + tag_holds.ListTagHoldsRequest(), + {}, ], ) def test_list_tag_holds(request_type, transport: str = "grpc"): @@ -1937,7 +1955,7 @@ def test_list_tag_holds(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tag_holds), "__call__") as call: @@ -1983,11 +2001,12 @@ def test_list_tag_holds_non_empty_request_with_auto_populated_field(): client.list_tag_holds(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tag_holds.ListTagHoldsRequest( + request_msg = tag_holds.ListTagHoldsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_tag_holds_use_cached_wrapped_rpc(): @@ -2068,9 +2087,14 @@ async def test_list_tag_holds_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_tag_holds_async( - transport: str = "grpc_asyncio", request_type=tag_holds.ListTagHoldsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tag_holds.ListTagHoldsRequest(), + {}, + ], +) +async def test_list_tag_holds_async(request_type, transport: str = "grpc_asyncio"): client = TagHoldsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2078,7 +2102,7 @@ async def test_list_tag_holds_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_tag_holds), "__call__") as call: @@ -2101,11 +2125,6 @@ async def test_list_tag_holds_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_tag_holds_async_from_dict(): - await test_list_tag_holds_async(request_type=dict) - - def test_list_tag_holds_field_headers(): client = TagHoldsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3181,7 +3200,6 @@ def test_create_tag_hold_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag_holds.CreateTagHoldRequest() - assert args[0] == request_msg @@ -3202,7 +3220,6 @@ def test_delete_tag_hold_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag_holds.DeleteTagHoldRequest() - assert args[0] == request_msg @@ -3223,7 +3240,6 @@ def test_list_tag_holds_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag_holds.ListTagHoldsRequest() - assert args[0] == request_msg @@ -3262,7 +3278,6 @@ async def test_create_tag_hold_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag_holds.CreateTagHoldRequest() - assert args[0] == request_msg @@ -3287,7 +3302,6 @@ async def test_delete_tag_hold_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag_holds.DeleteTagHoldRequest() - assert args[0] == request_msg @@ -3314,7 +3328,6 @@ async def test_list_tag_holds_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag_holds.ListTagHoldsRequest() - assert args[0] == request_msg @@ -3847,7 +3860,6 @@ def test_create_tag_hold_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag_holds.CreateTagHoldRequest() - assert args[0] == request_msg @@ -3867,7 +3879,6 @@ def test_delete_tag_hold_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag_holds.DeleteTagHoldRequest() - assert args[0] == request_msg @@ -3887,7 +3898,6 @@ def test_list_tag_holds_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag_holds.ListTagHoldsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-resource-manager/tests/unit/gapic/resourcemanager_v3/test_tag_keys.py b/packages/google-cloud-resource-manager/tests/unit/gapic/resourcemanager_v3/test_tag_keys.py index 7d9486f9e3a0..a91489a9f67a 100644 --- a/packages/google-cloud-resource-manager/tests/unit/gapic/resourcemanager_v3/test_tag_keys.py +++ b/packages/google-cloud-resource-manager/tests/unit/gapic/resourcemanager_v3/test_tag_keys.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 @@ -118,6 +119,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" @@ -1256,8 +1272,8 @@ def test_tag_keys_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - tag_keys.ListTagKeysRequest, - dict, + tag_keys.ListTagKeysRequest(), + {}, ], ) def test_list_tag_keys(request_type, transport: str = "grpc"): @@ -1268,7 +1284,7 @@ def test_list_tag_keys(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tag_keys), "__call__") as call: @@ -1313,10 +1329,11 @@ def test_list_tag_keys_non_empty_request_with_auto_populated_field(): client.list_tag_keys(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tag_keys.ListTagKeysRequest( + request_msg = tag_keys.ListTagKeysRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_tag_keys_use_cached_wrapped_rpc(): @@ -1397,9 +1414,14 @@ async def test_list_tag_keys_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_tag_keys_async( - transport: str = "grpc_asyncio", request_type=tag_keys.ListTagKeysRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tag_keys.ListTagKeysRequest(), + {}, + ], +) +async def test_list_tag_keys_async(request_type, transport: str = "grpc_asyncio"): client = TagKeysAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1407,7 +1429,7 @@ async def test_list_tag_keys_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_tag_keys), "__call__") as call: @@ -1430,11 +1452,6 @@ async def test_list_tag_keys_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_tag_keys_async_from_dict(): - await test_list_tag_keys_async(request_type=dict) - - def test_list_tag_keys_flattened(): client = TagKeysClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1707,8 +1724,8 @@ async def test_list_tag_keys_async_pages(): @pytest.mark.parametrize( "request_type", [ - tag_keys.GetTagKeyRequest, - dict, + tag_keys.GetTagKeyRequest(), + {}, ], ) def test_get_tag_key(request_type, transport: str = "grpc"): @@ -1719,7 +1736,7 @@ def test_get_tag_key(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tag_key), "__call__") as call: @@ -1775,9 +1792,10 @@ def test_get_tag_key_non_empty_request_with_auto_populated_field(): client.get_tag_key(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tag_keys.GetTagKeyRequest( + request_msg = tag_keys.GetTagKeyRequest( name="name_value", ) + assert args[0] == request_msg def test_get_tag_key_use_cached_wrapped_rpc(): @@ -1858,9 +1876,14 @@ async def test_get_tag_key_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_tag_key_async( - transport: str = "grpc_asyncio", request_type=tag_keys.GetTagKeyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tag_keys.GetTagKeyRequest(), + {}, + ], +) +async def test_get_tag_key_async(request_type, transport: str = "grpc_asyncio"): client = TagKeysAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1868,7 +1891,7 @@ async def test_get_tag_key_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_tag_key), "__call__") as call: @@ -1903,11 +1926,6 @@ async def test_get_tag_key_async( assert response.purpose == tag_keys.Purpose.GCE_FIREWALL -@pytest.mark.asyncio -async def test_get_tag_key_async_from_dict(): - await test_get_tag_key_async(request_type=dict) - - def test_get_tag_key_field_headers(): client = TagKeysClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2050,8 +2068,8 @@ async def test_get_tag_key_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - tag_keys.GetNamespacedTagKeyRequest, - dict, + tag_keys.GetNamespacedTagKeyRequest(), + {}, ], ) def test_get_namespaced_tag_key(request_type, transport: str = "grpc"): @@ -2062,7 +2080,7 @@ def test_get_namespaced_tag_key(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2122,9 +2140,10 @@ def test_get_namespaced_tag_key_non_empty_request_with_auto_populated_field(): client.get_namespaced_tag_key(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tag_keys.GetNamespacedTagKeyRequest( + request_msg = tag_keys.GetNamespacedTagKeyRequest( name="name_value", ) + assert args[0] == request_msg def test_get_namespaced_tag_key_use_cached_wrapped_rpc(): @@ -2210,8 +2229,15 @@ async def test_get_namespaced_tag_key_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + tag_keys.GetNamespacedTagKeyRequest(), + {}, + ], +) async def test_get_namespaced_tag_key_async( - transport: str = "grpc_asyncio", request_type=tag_keys.GetNamespacedTagKeyRequest + request_type, transport: str = "grpc_asyncio" ): client = TagKeysAsyncClient( credentials=async_anonymous_credentials(), @@ -2220,7 +2246,7 @@ async def test_get_namespaced_tag_key_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( @@ -2257,11 +2283,6 @@ async def test_get_namespaced_tag_key_async( assert response.purpose == tag_keys.Purpose.GCE_FIREWALL -@pytest.mark.asyncio -async def test_get_namespaced_tag_key_async_from_dict(): - await test_get_namespaced_tag_key_async(request_type=dict) - - def test_get_namespaced_tag_key_flattened(): client = TagKeysClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2349,8 +2370,8 @@ async def test_get_namespaced_tag_key_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - tag_keys.CreateTagKeyRequest, - dict, + tag_keys.CreateTagKeyRequest(), + {}, ], ) def test_create_tag_key(request_type, transport: str = "grpc"): @@ -2361,7 +2382,7 @@ def test_create_tag_key(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tag_key), "__call__") as call: @@ -2400,7 +2421,8 @@ def test_create_tag_key_non_empty_request_with_auto_populated_field(): client.create_tag_key(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tag_keys.CreateTagKeyRequest() + request_msg = tag_keys.CreateTagKeyRequest() + assert args[0] == request_msg def test_create_tag_key_use_cached_wrapped_rpc(): @@ -2491,9 +2513,14 @@ async def test_create_tag_key_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_tag_key_async( - transport: str = "grpc_asyncio", request_type=tag_keys.CreateTagKeyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tag_keys.CreateTagKeyRequest(), + {}, + ], +) +async def test_create_tag_key_async(request_type, transport: str = "grpc_asyncio"): client = TagKeysAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2501,7 +2528,7 @@ async def test_create_tag_key_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_tag_key), "__call__") as call: @@ -2521,11 +2548,6 @@ async def test_create_tag_key_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_tag_key_async_from_dict(): - await test_create_tag_key_async(request_type=dict) - - def test_create_tag_key_flattened(): client = TagKeysClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2611,8 +2633,8 @@ async def test_create_tag_key_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - tag_keys.UpdateTagKeyRequest, - dict, + tag_keys.UpdateTagKeyRequest(), + {}, ], ) def test_update_tag_key(request_type, transport: str = "grpc"): @@ -2623,7 +2645,7 @@ def test_update_tag_key(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tag_key), "__call__") as call: @@ -2662,7 +2684,8 @@ def test_update_tag_key_non_empty_request_with_auto_populated_field(): client.update_tag_key(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tag_keys.UpdateTagKeyRequest() + request_msg = tag_keys.UpdateTagKeyRequest() + assert args[0] == request_msg def test_update_tag_key_use_cached_wrapped_rpc(): @@ -2753,9 +2776,14 @@ async def test_update_tag_key_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_tag_key_async( - transport: str = "grpc_asyncio", request_type=tag_keys.UpdateTagKeyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tag_keys.UpdateTagKeyRequest(), + {}, + ], +) +async def test_update_tag_key_async(request_type, transport: str = "grpc_asyncio"): client = TagKeysAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2763,7 +2791,7 @@ async def test_update_tag_key_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_tag_key), "__call__") as call: @@ -2783,11 +2811,6 @@ async def test_update_tag_key_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_tag_key_async_from_dict(): - await test_update_tag_key_async(request_type=dict) - - def test_update_tag_key_field_headers(): client = TagKeysClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2944,8 +2967,8 @@ async def test_update_tag_key_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - tag_keys.DeleteTagKeyRequest, - dict, + tag_keys.DeleteTagKeyRequest(), + {}, ], ) def test_delete_tag_key(request_type, transport: str = "grpc"): @@ -2956,7 +2979,7 @@ def test_delete_tag_key(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tag_key), "__call__") as call: @@ -2998,10 +3021,11 @@ def test_delete_tag_key_non_empty_request_with_auto_populated_field(): client.delete_tag_key(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tag_keys.DeleteTagKeyRequest( + request_msg = tag_keys.DeleteTagKeyRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_tag_key_use_cached_wrapped_rpc(): @@ -3092,9 +3116,14 @@ async def test_delete_tag_key_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_tag_key_async( - transport: str = "grpc_asyncio", request_type=tag_keys.DeleteTagKeyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tag_keys.DeleteTagKeyRequest(), + {}, + ], +) +async def test_delete_tag_key_async(request_type, transport: str = "grpc_asyncio"): client = TagKeysAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3102,7 +3131,7 @@ async def test_delete_tag_key_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_tag_key), "__call__") as call: @@ -3122,11 +3151,6 @@ async def test_delete_tag_key_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_tag_key_async_from_dict(): - await test_delete_tag_key_async(request_type=dict) - - def test_delete_tag_key_field_headers(): client = TagKeysClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3273,8 +3297,8 @@ async def test_delete_tag_key_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.GetIamPolicyRequest, - dict, + iam_policy_pb2.GetIamPolicyRequest(), + {}, ], ) def test_get_iam_policy(request_type, transport: str = "grpc"): @@ -3285,7 +3309,7 @@ def test_get_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(type(client.transport.get_iam_policy), "__call__") as call: @@ -3331,9 +3355,10 @@ def test_get_iam_policy_non_empty_request_with_auto_populated_field(): client.get_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.GetIamPolicyRequest( + request_msg = iam_policy_pb2.GetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_get_iam_policy_use_cached_wrapped_rpc(): @@ -3414,9 +3439,14 @@ async def test_get_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.GetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.GetIamPolicyRequest(), + {}, + ], +) +async def test_get_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = TagKeysAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3424,7 +3454,7 @@ async def test_get_iam_policy_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_iam_policy), "__call__") as call: @@ -3449,11 +3479,6 @@ async def test_get_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_get_iam_policy_async_from_dict(): - await test_get_iam_policy_async(request_type=dict) - - def test_get_iam_policy_field_headers(): client = TagKeysClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3613,8 +3638,8 @@ async def test_get_iam_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.SetIamPolicyRequest, - dict, + iam_policy_pb2.SetIamPolicyRequest(), + {}, ], ) def test_set_iam_policy(request_type, transport: str = "grpc"): @@ -3625,7 +3650,7 @@ def test_set_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(type(client.transport.set_iam_policy), "__call__") as call: @@ -3671,9 +3696,10 @@ def test_set_iam_policy_non_empty_request_with_auto_populated_field(): client.set_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.SetIamPolicyRequest( + request_msg = iam_policy_pb2.SetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_set_iam_policy_use_cached_wrapped_rpc(): @@ -3754,9 +3780,14 @@ async def test_set_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.SetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.SetIamPolicyRequest(), + {}, + ], +) +async def test_set_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = TagKeysAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3764,7 +3795,7 @@ async def test_set_iam_policy_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.set_iam_policy), "__call__") as call: @@ -3789,11 +3820,6 @@ async def test_set_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_set_iam_policy_async_from_dict(): - await test_set_iam_policy_async(request_type=dict) - - def test_set_iam_policy_field_headers(): client = TagKeysClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3954,8 +3980,8 @@ async def test_set_iam_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.TestIamPermissionsRequest, - dict, + iam_policy_pb2.TestIamPermissionsRequest(), + {}, ], ) def test_test_iam_permissions(request_type, transport: str = "grpc"): @@ -3966,7 +3992,7 @@ def test_test_iam_permissions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4014,9 +4040,10 @@ def test_test_iam_permissions_non_empty_request_with_auto_populated_field(): client.test_iam_permissions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.TestIamPermissionsRequest( + request_msg = iam_policy_pb2.TestIamPermissionsRequest( resource="resource_value", ) + assert args[0] == request_msg def test_test_iam_permissions_use_cached_wrapped_rpc(): @@ -4101,9 +4128,15 @@ async def test_test_iam_permissions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.TestIamPermissionsRequest(), + {}, + ], +) async def test_test_iam_permissions_async( - transport: str = "grpc_asyncio", - request_type=iam_policy_pb2.TestIamPermissionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = TagKeysAsyncClient( credentials=async_anonymous_credentials(), @@ -4112,7 +4145,7 @@ async def test_test_iam_permissions_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( @@ -4137,11 +4170,6 @@ async def test_test_iam_permissions_async( assert response.permissions == ["permissions_value"] -@pytest.mark.asyncio -async def test_test_iam_permissions_async_from_dict(): - await test_test_iam_permissions_async(request_type=dict) - - def test_test_iam_permissions_field_headers(): client = TagKeysClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6159,7 +6187,6 @@ def test_list_tag_keys_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag_keys.ListTagKeysRequest() - assert args[0] == request_msg @@ -6180,7 +6207,6 @@ def test_get_tag_key_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag_keys.GetTagKeyRequest() - assert args[0] == request_msg @@ -6203,7 +6229,6 @@ def test_get_namespaced_tag_key_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag_keys.GetNamespacedTagKeyRequest() - assert args[0] == request_msg @@ -6224,7 +6249,6 @@ def test_create_tag_key_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag_keys.CreateTagKeyRequest() - assert args[0] == request_msg @@ -6245,7 +6269,6 @@ def test_update_tag_key_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag_keys.UpdateTagKeyRequest() - assert args[0] == request_msg @@ -6266,7 +6289,6 @@ def test_delete_tag_key_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag_keys.DeleteTagKeyRequest() - assert args[0] == request_msg @@ -6287,7 +6309,6 @@ def test_get_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -6308,7 +6329,6 @@ def test_set_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -6331,7 +6351,6 @@ def test_test_iam_permissions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -6372,7 +6391,6 @@ async def test_list_tag_keys_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag_keys.ListTagKeysRequest() - assert args[0] == request_msg @@ -6405,7 +6423,6 @@ async def test_get_tag_key_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag_keys.GetTagKeyRequest() - assert args[0] == request_msg @@ -6440,7 +6457,6 @@ async def test_get_namespaced_tag_key_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag_keys.GetNamespacedTagKeyRequest() - assert args[0] == request_msg @@ -6465,7 +6481,6 @@ async def test_create_tag_key_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag_keys.CreateTagKeyRequest() - assert args[0] == request_msg @@ -6490,7 +6505,6 @@ async def test_update_tag_key_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag_keys.UpdateTagKeyRequest() - assert args[0] == request_msg @@ -6515,7 +6529,6 @@ async def test_delete_tag_key_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag_keys.DeleteTagKeyRequest() - assert args[0] == request_msg @@ -6543,7 +6556,6 @@ async def test_get_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -6571,7 +6583,6 @@ async def test_set_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -6600,7 +6611,6 @@ async def test_test_iam_permissions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -7989,7 +7999,6 @@ def test_list_tag_keys_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag_keys.ListTagKeysRequest() - assert args[0] == request_msg @@ -8009,7 +8018,6 @@ def test_get_tag_key_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag_keys.GetTagKeyRequest() - assert args[0] == request_msg @@ -8031,7 +8039,6 @@ def test_get_namespaced_tag_key_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag_keys.GetNamespacedTagKeyRequest() - assert args[0] == request_msg @@ -8051,7 +8058,6 @@ def test_create_tag_key_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag_keys.CreateTagKeyRequest() - assert args[0] == request_msg @@ -8071,7 +8077,6 @@ def test_update_tag_key_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag_keys.UpdateTagKeyRequest() - assert args[0] == request_msg @@ -8091,7 +8096,6 @@ def test_delete_tag_key_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag_keys.DeleteTagKeyRequest() - assert args[0] == request_msg @@ -8111,7 +8115,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -8131,7 +8134,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -8153,7 +8155,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-resource-manager/tests/unit/gapic/resourcemanager_v3/test_tag_values.py b/packages/google-cloud-resource-manager/tests/unit/gapic/resourcemanager_v3/test_tag_values.py index 82ae0b055029..3f2a2bdd63e7 100644 --- a/packages/google-cloud-resource-manager/tests/unit/gapic/resourcemanager_v3/test_tag_values.py +++ b/packages/google-cloud-resource-manager/tests/unit/gapic/resourcemanager_v3/test_tag_values.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 @@ -118,6 +119,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" @@ -1280,8 +1296,8 @@ def test_tag_values_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - tag_values.ListTagValuesRequest, - dict, + tag_values.ListTagValuesRequest(), + {}, ], ) def test_list_tag_values(request_type, transport: str = "grpc"): @@ -1292,7 +1308,7 @@ def test_list_tag_values(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tag_values), "__call__") as call: @@ -1337,10 +1353,11 @@ def test_list_tag_values_non_empty_request_with_auto_populated_field(): client.list_tag_values(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tag_values.ListTagValuesRequest( + request_msg = tag_values.ListTagValuesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_tag_values_use_cached_wrapped_rpc(): @@ -1421,9 +1438,14 @@ async def test_list_tag_values_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_tag_values_async( - transport: str = "grpc_asyncio", request_type=tag_values.ListTagValuesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tag_values.ListTagValuesRequest(), + {}, + ], +) +async def test_list_tag_values_async(request_type, transport: str = "grpc_asyncio"): client = TagValuesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1431,7 +1453,7 @@ async def test_list_tag_values_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_tag_values), "__call__") as call: @@ -1454,11 +1476,6 @@ async def test_list_tag_values_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_tag_values_async_from_dict(): - await test_list_tag_values_async(request_type=dict) - - def test_list_tag_values_flattened(): client = TagValuesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1731,8 +1748,8 @@ async def test_list_tag_values_async_pages(): @pytest.mark.parametrize( "request_type", [ - tag_values.GetTagValueRequest, - dict, + tag_values.GetTagValueRequest(), + {}, ], ) def test_get_tag_value(request_type, transport: str = "grpc"): @@ -1743,7 +1760,7 @@ def test_get_tag_value(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tag_value), "__call__") as call: @@ -1797,9 +1814,10 @@ def test_get_tag_value_non_empty_request_with_auto_populated_field(): client.get_tag_value(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tag_values.GetTagValueRequest( + request_msg = tag_values.GetTagValueRequest( name="name_value", ) + assert args[0] == request_msg def test_get_tag_value_use_cached_wrapped_rpc(): @@ -1880,9 +1898,14 @@ async def test_get_tag_value_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_tag_value_async( - transport: str = "grpc_asyncio", request_type=tag_values.GetTagValueRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tag_values.GetTagValueRequest(), + {}, + ], +) +async def test_get_tag_value_async(request_type, transport: str = "grpc_asyncio"): client = TagValuesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1890,7 +1913,7 @@ async def test_get_tag_value_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_tag_value), "__call__") as call: @@ -1923,11 +1946,6 @@ async def test_get_tag_value_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_tag_value_async_from_dict(): - await test_get_tag_value_async(request_type=dict) - - def test_get_tag_value_field_headers(): client = TagValuesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2070,8 +2088,8 @@ async def test_get_tag_value_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - tag_values.GetNamespacedTagValueRequest, - dict, + tag_values.GetNamespacedTagValueRequest(), + {}, ], ) def test_get_namespaced_tag_value(request_type, transport: str = "grpc"): @@ -2082,7 +2100,7 @@ def test_get_namespaced_tag_value(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2140,9 +2158,10 @@ def test_get_namespaced_tag_value_non_empty_request_with_auto_populated_field(): client.get_namespaced_tag_value(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tag_values.GetNamespacedTagValueRequest( + request_msg = tag_values.GetNamespacedTagValueRequest( name="name_value", ) + assert args[0] == request_msg def test_get_namespaced_tag_value_use_cached_wrapped_rpc(): @@ -2228,9 +2247,15 @@ async def test_get_namespaced_tag_value_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + tag_values.GetNamespacedTagValueRequest(), + {}, + ], +) async def test_get_namespaced_tag_value_async( - transport: str = "grpc_asyncio", - request_type=tag_values.GetNamespacedTagValueRequest, + request_type, transport: str = "grpc_asyncio" ): client = TagValuesAsyncClient( credentials=async_anonymous_credentials(), @@ -2239,7 +2264,7 @@ async def test_get_namespaced_tag_value_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( @@ -2274,11 +2299,6 @@ async def test_get_namespaced_tag_value_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_namespaced_tag_value_async_from_dict(): - await test_get_namespaced_tag_value_async(request_type=dict) - - def test_get_namespaced_tag_value_flattened(): client = TagValuesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2366,8 +2386,8 @@ async def test_get_namespaced_tag_value_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - tag_values.CreateTagValueRequest, - dict, + tag_values.CreateTagValueRequest(), + {}, ], ) def test_create_tag_value(request_type, transport: str = "grpc"): @@ -2378,7 +2398,7 @@ def test_create_tag_value(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tag_value), "__call__") as call: @@ -2417,7 +2437,8 @@ def test_create_tag_value_non_empty_request_with_auto_populated_field(): client.create_tag_value(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tag_values.CreateTagValueRequest() + request_msg = tag_values.CreateTagValueRequest() + assert args[0] == request_msg def test_create_tag_value_use_cached_wrapped_rpc(): @@ -2510,9 +2531,14 @@ async def test_create_tag_value_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_tag_value_async( - transport: str = "grpc_asyncio", request_type=tag_values.CreateTagValueRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tag_values.CreateTagValueRequest(), + {}, + ], +) +async def test_create_tag_value_async(request_type, transport: str = "grpc_asyncio"): client = TagValuesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2520,7 +2546,7 @@ async def test_create_tag_value_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_tag_value), "__call__") as call: @@ -2540,11 +2566,6 @@ async def test_create_tag_value_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_tag_value_async_from_dict(): - await test_create_tag_value_async(request_type=dict) - - def test_create_tag_value_flattened(): client = TagValuesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2630,8 +2651,8 @@ async def test_create_tag_value_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - tag_values.UpdateTagValueRequest, - dict, + tag_values.UpdateTagValueRequest(), + {}, ], ) def test_update_tag_value(request_type, transport: str = "grpc"): @@ -2642,7 +2663,7 @@ def test_update_tag_value(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tag_value), "__call__") as call: @@ -2681,7 +2702,8 @@ def test_update_tag_value_non_empty_request_with_auto_populated_field(): client.update_tag_value(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tag_values.UpdateTagValueRequest() + request_msg = tag_values.UpdateTagValueRequest() + assert args[0] == request_msg def test_update_tag_value_use_cached_wrapped_rpc(): @@ -2774,9 +2796,14 @@ async def test_update_tag_value_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_tag_value_async( - transport: str = "grpc_asyncio", request_type=tag_values.UpdateTagValueRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tag_values.UpdateTagValueRequest(), + {}, + ], +) +async def test_update_tag_value_async(request_type, transport: str = "grpc_asyncio"): client = TagValuesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2784,7 +2811,7 @@ async def test_update_tag_value_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_tag_value), "__call__") as call: @@ -2804,11 +2831,6 @@ async def test_update_tag_value_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_tag_value_async_from_dict(): - await test_update_tag_value_async(request_type=dict) - - def test_update_tag_value_field_headers(): client = TagValuesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2965,8 +2987,8 @@ async def test_update_tag_value_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - tag_values.DeleteTagValueRequest, - dict, + tag_values.DeleteTagValueRequest(), + {}, ], ) def test_delete_tag_value(request_type, transport: str = "grpc"): @@ -2977,7 +2999,7 @@ def test_delete_tag_value(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tag_value), "__call__") as call: @@ -3019,10 +3041,11 @@ def test_delete_tag_value_non_empty_request_with_auto_populated_field(): client.delete_tag_value(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tag_values.DeleteTagValueRequest( + request_msg = tag_values.DeleteTagValueRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_tag_value_use_cached_wrapped_rpc(): @@ -3115,9 +3138,14 @@ async def test_delete_tag_value_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_tag_value_async( - transport: str = "grpc_asyncio", request_type=tag_values.DeleteTagValueRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tag_values.DeleteTagValueRequest(), + {}, + ], +) +async def test_delete_tag_value_async(request_type, transport: str = "grpc_asyncio"): client = TagValuesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3125,7 +3153,7 @@ async def test_delete_tag_value_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_tag_value), "__call__") as call: @@ -3145,11 +3173,6 @@ async def test_delete_tag_value_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_tag_value_async_from_dict(): - await test_delete_tag_value_async(request_type=dict) - - def test_delete_tag_value_field_headers(): client = TagValuesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3296,8 +3319,8 @@ async def test_delete_tag_value_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.GetIamPolicyRequest, - dict, + iam_policy_pb2.GetIamPolicyRequest(), + {}, ], ) def test_get_iam_policy(request_type, transport: str = "grpc"): @@ -3308,7 +3331,7 @@ def test_get_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(type(client.transport.get_iam_policy), "__call__") as call: @@ -3354,9 +3377,10 @@ def test_get_iam_policy_non_empty_request_with_auto_populated_field(): client.get_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.GetIamPolicyRequest( + request_msg = iam_policy_pb2.GetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_get_iam_policy_use_cached_wrapped_rpc(): @@ -3437,9 +3461,14 @@ async def test_get_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.GetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.GetIamPolicyRequest(), + {}, + ], +) +async def test_get_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = TagValuesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3447,7 +3476,7 @@ async def test_get_iam_policy_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_iam_policy), "__call__") as call: @@ -3472,11 +3501,6 @@ async def test_get_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_get_iam_policy_async_from_dict(): - await test_get_iam_policy_async(request_type=dict) - - def test_get_iam_policy_field_headers(): client = TagValuesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3636,8 +3660,8 @@ async def test_get_iam_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.SetIamPolicyRequest, - dict, + iam_policy_pb2.SetIamPolicyRequest(), + {}, ], ) def test_set_iam_policy(request_type, transport: str = "grpc"): @@ -3648,7 +3672,7 @@ def test_set_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(type(client.transport.set_iam_policy), "__call__") as call: @@ -3694,9 +3718,10 @@ def test_set_iam_policy_non_empty_request_with_auto_populated_field(): client.set_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.SetIamPolicyRequest( + request_msg = iam_policy_pb2.SetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_set_iam_policy_use_cached_wrapped_rpc(): @@ -3777,9 +3802,14 @@ async def test_set_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.SetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.SetIamPolicyRequest(), + {}, + ], +) +async def test_set_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = TagValuesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3787,7 +3817,7 @@ async def test_set_iam_policy_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.set_iam_policy), "__call__") as call: @@ -3812,11 +3842,6 @@ async def test_set_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_set_iam_policy_async_from_dict(): - await test_set_iam_policy_async(request_type=dict) - - def test_set_iam_policy_field_headers(): client = TagValuesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3977,8 +4002,8 @@ async def test_set_iam_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.TestIamPermissionsRequest, - dict, + iam_policy_pb2.TestIamPermissionsRequest(), + {}, ], ) def test_test_iam_permissions(request_type, transport: str = "grpc"): @@ -3989,7 +4014,7 @@ def test_test_iam_permissions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4037,9 +4062,10 @@ def test_test_iam_permissions_non_empty_request_with_auto_populated_field(): client.test_iam_permissions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.TestIamPermissionsRequest( + request_msg = iam_policy_pb2.TestIamPermissionsRequest( resource="resource_value", ) + assert args[0] == request_msg def test_test_iam_permissions_use_cached_wrapped_rpc(): @@ -4124,9 +4150,15 @@ async def test_test_iam_permissions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.TestIamPermissionsRequest(), + {}, + ], +) async def test_test_iam_permissions_async( - transport: str = "grpc_asyncio", - request_type=iam_policy_pb2.TestIamPermissionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = TagValuesAsyncClient( credentials=async_anonymous_credentials(), @@ -4135,7 +4167,7 @@ async def test_test_iam_permissions_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( @@ -4160,11 +4192,6 @@ async def test_test_iam_permissions_async( assert response.permissions == ["permissions_value"] -@pytest.mark.asyncio -async def test_test_iam_permissions_async_from_dict(): - await test_test_iam_permissions_async(request_type=dict) - - def test_test_iam_permissions_field_headers(): client = TagValuesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6202,7 +6229,6 @@ def test_list_tag_values_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag_values.ListTagValuesRequest() - assert args[0] == request_msg @@ -6223,7 +6249,6 @@ def test_get_tag_value_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag_values.GetTagValueRequest() - assert args[0] == request_msg @@ -6246,7 +6271,6 @@ def test_get_namespaced_tag_value_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag_values.GetNamespacedTagValueRequest() - assert args[0] == request_msg @@ -6267,7 +6291,6 @@ def test_create_tag_value_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag_values.CreateTagValueRequest() - assert args[0] == request_msg @@ -6288,7 +6311,6 @@ def test_update_tag_value_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag_values.UpdateTagValueRequest() - assert args[0] == request_msg @@ -6309,7 +6331,6 @@ def test_delete_tag_value_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag_values.DeleteTagValueRequest() - assert args[0] == request_msg @@ -6330,7 +6351,6 @@ def test_get_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -6351,7 +6371,6 @@ def test_set_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -6374,7 +6393,6 @@ def test_test_iam_permissions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -6415,7 +6433,6 @@ async def test_list_tag_values_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag_values.ListTagValuesRequest() - assert args[0] == request_msg @@ -6447,7 +6464,6 @@ async def test_get_tag_value_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag_values.GetTagValueRequest() - assert args[0] == request_msg @@ -6481,7 +6497,6 @@ async def test_get_namespaced_tag_value_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag_values.GetNamespacedTagValueRequest() - assert args[0] == request_msg @@ -6506,7 +6521,6 @@ async def test_create_tag_value_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag_values.CreateTagValueRequest() - assert args[0] == request_msg @@ -6531,7 +6545,6 @@ async def test_update_tag_value_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag_values.UpdateTagValueRequest() - assert args[0] == request_msg @@ -6556,7 +6569,6 @@ async def test_delete_tag_value_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag_values.DeleteTagValueRequest() - assert args[0] == request_msg @@ -6584,7 +6596,6 @@ async def test_get_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -6612,7 +6623,6 @@ async def test_set_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -6641,7 +6651,6 @@ async def test_test_iam_permissions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -8039,7 +8048,6 @@ def test_list_tag_values_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag_values.ListTagValuesRequest() - assert args[0] == request_msg @@ -8059,7 +8067,6 @@ def test_get_tag_value_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag_values.GetTagValueRequest() - assert args[0] == request_msg @@ -8081,7 +8088,6 @@ def test_get_namespaced_tag_value_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag_values.GetNamespacedTagValueRequest() - assert args[0] == request_msg @@ -8101,7 +8107,6 @@ def test_create_tag_value_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag_values.CreateTagValueRequest() - assert args[0] == request_msg @@ -8121,7 +8126,6 @@ def test_update_tag_value_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag_values.UpdateTagValueRequest() - assert args[0] == request_msg @@ -8141,7 +8145,6 @@ def test_delete_tag_value_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tag_values.DeleteTagValueRequest() - assert args[0] == request_msg @@ -8161,7 +8164,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -8181,7 +8183,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -8203,7 +8204,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-retail/noxfile.py b/packages/google-cloud-retail/noxfile.py index 04ebcfcde2ec..fab57e38aee8 100644 --- a/packages/google-cloud-retail/noxfile.py +++ b/packages/google-cloud-retail/noxfile.py @@ -47,7 +47,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-retail" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-retail/setup.py b/packages/google-cloud-retail/setup.py index 2ac0f84dbf7d..d630659866d7 100644 --- a/packages/google-cloud-retail/setup.py +++ b/packages/google-cloud-retail/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/google-cloud-retail/testing/constraints-3.10.txt b/packages/google-cloud-retail/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-retail/testing/constraints-3.10.txt +++ b/packages/google-cloud-retail/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-retail/tests/unit/gapic/retail_v2/test_analytics_service.py b/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_analytics_service.py index 63c355311076..0ce736e1fa3d 100644 --- a/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_analytics_service.py +++ b/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_analytics_service.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" @@ -1345,8 +1361,8 @@ def test_analytics_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - export_config.ExportAnalyticsMetricsRequest, - dict, + export_config.ExportAnalyticsMetricsRequest(), + {}, ], ) def test_export_analytics_metrics(request_type, transport: str = "grpc"): @@ -1357,7 +1373,7 @@ def test_export_analytics_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( @@ -1403,10 +1419,11 @@ def test_export_analytics_metrics_non_empty_request_with_auto_populated_field(): client.export_analytics_metrics(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == export_config.ExportAnalyticsMetricsRequest( + request_msg = export_config.ExportAnalyticsMetricsRequest( catalog="catalog_value", filter="filter_value", ) + assert args[0] == request_msg def test_export_analytics_metrics_use_cached_wrapped_rpc(): @@ -1502,9 +1519,15 @@ async def test_export_analytics_metrics_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + export_config.ExportAnalyticsMetricsRequest(), + {}, + ], +) async def test_export_analytics_metrics_async( - transport: str = "grpc_asyncio", - request_type=export_config.ExportAnalyticsMetricsRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1513,7 +1536,7 @@ async def test_export_analytics_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( @@ -1535,11 +1558,6 @@ async def test_export_analytics_metrics_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_export_analytics_metrics_async_from_dict(): - await test_export_analytics_metrics_async(request_type=dict) - - def test_export_analytics_metrics_field_headers(): client = AnalyticsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1865,7 +1883,6 @@ def test_export_analytics_metrics_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = export_config.ExportAnalyticsMetricsRequest() - assert args[0] == request_msg @@ -1906,7 +1923,6 @@ async def test_export_analytics_metrics_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = export_config.ExportAnalyticsMetricsRequest() - assert args[0] == request_msg @@ -2194,7 +2210,6 @@ def test_export_analytics_metrics_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = export_config.ExportAnalyticsMetricsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_catalog_service.py b/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_catalog_service.py index 1e0cccd681a3..c1261422d1c1 100644 --- a/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_catalog_service.py +++ b/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_catalog_service.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 @@ -113,6 +114,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" @@ -1316,8 +1332,8 @@ def test_catalog_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - catalog_service.ListCatalogsRequest, - dict, + catalog_service.ListCatalogsRequest(), + {}, ], ) def test_list_catalogs(request_type, transport: str = "grpc"): @@ -1328,7 +1344,7 @@ def test_list_catalogs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_catalogs), "__call__") as call: @@ -1373,10 +1389,11 @@ def test_list_catalogs_non_empty_request_with_auto_populated_field(): client.list_catalogs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog_service.ListCatalogsRequest( + request_msg = catalog_service.ListCatalogsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_catalogs_use_cached_wrapped_rpc(): @@ -1457,9 +1474,14 @@ async def test_list_catalogs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_catalogs_async( - transport: str = "grpc_asyncio", request_type=catalog_service.ListCatalogsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + catalog_service.ListCatalogsRequest(), + {}, + ], +) +async def test_list_catalogs_async(request_type, transport: str = "grpc_asyncio"): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1467,7 +1489,7 @@ async def test_list_catalogs_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_catalogs), "__call__") as call: @@ -1490,11 +1512,6 @@ async def test_list_catalogs_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_catalogs_async_from_dict(): - await test_list_catalogs_async(request_type=dict) - - def test_list_catalogs_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1831,8 +1848,8 @@ async def test_list_catalogs_async_pages(): @pytest.mark.parametrize( "request_type", [ - catalog_service.UpdateCatalogRequest, - dict, + catalog_service.UpdateCatalogRequest(), + {}, ], ) def test_update_catalog(request_type, transport: str = "grpc"): @@ -1843,7 +1860,7 @@ def test_update_catalog(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_catalog), "__call__") as call: @@ -1887,7 +1904,8 @@ def test_update_catalog_non_empty_request_with_auto_populated_field(): client.update_catalog(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog_service.UpdateCatalogRequest() + request_msg = catalog_service.UpdateCatalogRequest() + assert args[0] == request_msg def test_update_catalog_use_cached_wrapped_rpc(): @@ -1968,9 +1986,14 @@ async def test_update_catalog_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_catalog_async( - transport: str = "grpc_asyncio", request_type=catalog_service.UpdateCatalogRequest -): +@pytest.mark.parametrize( + "request_type", + [ + catalog_service.UpdateCatalogRequest(), + {}, + ], +) +async def test_update_catalog_async(request_type, transport: str = "grpc_asyncio"): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1978,7 +2001,7 @@ async def test_update_catalog_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_catalog), "__call__") as call: @@ -2003,11 +2026,6 @@ async def test_update_catalog_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_update_catalog_async_from_dict(): - await test_update_catalog_async(request_type=dict) - - def test_update_catalog_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2160,8 +2178,8 @@ async def test_update_catalog_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - catalog_service.SetDefaultBranchRequest, - dict, + catalog_service.SetDefaultBranchRequest(), + {}, ], ) def test_set_default_branch(request_type, transport: str = "grpc"): @@ -2172,7 +2190,7 @@ def test_set_default_branch(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2219,11 +2237,12 @@ def test_set_default_branch_non_empty_request_with_auto_populated_field(): client.set_default_branch(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog_service.SetDefaultBranchRequest( + request_msg = catalog_service.SetDefaultBranchRequest( catalog="catalog_value", branch_id="branch_id_value", note="note_value", ) + assert args[0] == request_msg def test_set_default_branch_use_cached_wrapped_rpc(): @@ -2308,10 +2327,14 @@ async def test_set_default_branch_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_default_branch_async( - transport: str = "grpc_asyncio", - request_type=catalog_service.SetDefaultBranchRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + catalog_service.SetDefaultBranchRequest(), + {}, + ], +) +async def test_set_default_branch_async(request_type, transport: str = "grpc_asyncio"): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2319,7 +2342,7 @@ async def test_set_default_branch_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( @@ -2339,11 +2362,6 @@ async def test_set_default_branch_async( assert response is None -@pytest.mark.asyncio -async def test_set_default_branch_async_from_dict(): - await test_set_default_branch_async(request_type=dict) - - def test_set_default_branch_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2494,8 +2512,8 @@ async def test_set_default_branch_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - catalog_service.GetDefaultBranchRequest, - dict, + catalog_service.GetDefaultBranchRequest(), + {}, ], ) def test_get_default_branch(request_type, transport: str = "grpc"): @@ -2506,7 +2524,7 @@ def test_get_default_branch(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2556,9 +2574,10 @@ def test_get_default_branch_non_empty_request_with_auto_populated_field(): client.get_default_branch(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog_service.GetDefaultBranchRequest( + request_msg = catalog_service.GetDefaultBranchRequest( catalog="catalog_value", ) + assert args[0] == request_msg def test_get_default_branch_use_cached_wrapped_rpc(): @@ -2643,10 +2662,14 @@ async def test_get_default_branch_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_default_branch_async( - transport: str = "grpc_asyncio", - request_type=catalog_service.GetDefaultBranchRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + catalog_service.GetDefaultBranchRequest(), + {}, + ], +) +async def test_get_default_branch_async(request_type, transport: str = "grpc_asyncio"): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2654,7 +2677,7 @@ async def test_get_default_branch_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( @@ -2681,11 +2704,6 @@ async def test_get_default_branch_async( assert response.note == "note_value" -@pytest.mark.asyncio -async def test_get_default_branch_async_from_dict(): - await test_get_default_branch_async(request_type=dict) - - def test_get_default_branch_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2840,8 +2858,8 @@ async def test_get_default_branch_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - catalog_service.GetCompletionConfigRequest, - dict, + catalog_service.GetCompletionConfigRequest(), + {}, ], ) def test_get_completion_config(request_type, transport: str = "grpc"): @@ -2852,7 +2870,7 @@ def test_get_completion_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( @@ -2923,9 +2941,10 @@ def test_get_completion_config_non_empty_request_with_auto_populated_field(): client.get_completion_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog_service.GetCompletionConfigRequest( + request_msg = catalog_service.GetCompletionConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_completion_config_use_cached_wrapped_rpc(): @@ -3011,9 +3030,15 @@ async def test_get_completion_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + catalog_service.GetCompletionConfigRequest(), + {}, + ], +) async def test_get_completion_config_async( - transport: str = "grpc_asyncio", - request_type=catalog_service.GetCompletionConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3022,7 +3047,7 @@ async def test_get_completion_config_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( @@ -3070,11 +3095,6 @@ async def test_get_completion_config_async( ) -@pytest.mark.asyncio -async def test_get_completion_config_async_from_dict(): - await test_get_completion_config_async(request_type=dict) - - def test_get_completion_config_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3229,8 +3249,8 @@ async def test_get_completion_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - catalog_service.UpdateCompletionConfigRequest, - dict, + catalog_service.UpdateCompletionConfigRequest(), + {}, ], ) def test_update_completion_config(request_type, transport: str = "grpc"): @@ -3241,7 +3261,7 @@ def test_update_completion_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( @@ -3310,7 +3330,8 @@ def test_update_completion_config_non_empty_request_with_auto_populated_field(): client.update_completion_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog_service.UpdateCompletionConfigRequest() + request_msg = catalog_service.UpdateCompletionConfigRequest() + assert args[0] == request_msg def test_update_completion_config_use_cached_wrapped_rpc(): @@ -3396,9 +3417,15 @@ async def test_update_completion_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + catalog_service.UpdateCompletionConfigRequest(), + {}, + ], +) async def test_update_completion_config_async( - transport: str = "grpc_asyncio", - request_type=catalog_service.UpdateCompletionConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3407,7 +3434,7 @@ async def test_update_completion_config_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( @@ -3455,11 +3482,6 @@ async def test_update_completion_config_async( ) -@pytest.mark.asyncio -async def test_update_completion_config_async_from_dict(): - await test_update_completion_config_async(request_type=dict) - - def test_update_completion_config_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3624,8 +3646,8 @@ async def test_update_completion_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - catalog_service.GetAttributesConfigRequest, - dict, + catalog_service.GetAttributesConfigRequest(), + {}, ], ) def test_get_attributes_config(request_type, transport: str = "grpc"): @@ -3636,7 +3658,7 @@ def test_get_attributes_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( @@ -3689,9 +3711,10 @@ def test_get_attributes_config_non_empty_request_with_auto_populated_field(): client.get_attributes_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog_service.GetAttributesConfigRequest( + request_msg = catalog_service.GetAttributesConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_attributes_config_use_cached_wrapped_rpc(): @@ -3777,9 +3800,15 @@ async def test_get_attributes_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + catalog_service.GetAttributesConfigRequest(), + {}, + ], +) async def test_get_attributes_config_async( - transport: str = "grpc_asyncio", - request_type=catalog_service.GetAttributesConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3788,7 +3817,7 @@ async def test_get_attributes_config_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( @@ -3818,11 +3847,6 @@ async def test_get_attributes_config_async( ) -@pytest.mark.asyncio -async def test_get_attributes_config_async_from_dict(): - await test_get_attributes_config_async(request_type=dict) - - def test_get_attributes_config_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3977,8 +4001,8 @@ async def test_get_attributes_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - catalog_service.UpdateAttributesConfigRequest, - dict, + catalog_service.UpdateAttributesConfigRequest(), + {}, ], ) def test_update_attributes_config(request_type, transport: str = "grpc"): @@ -3989,7 +4013,7 @@ def test_update_attributes_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( @@ -4040,7 +4064,8 @@ def test_update_attributes_config_non_empty_request_with_auto_populated_field(): client.update_attributes_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog_service.UpdateAttributesConfigRequest() + request_msg = catalog_service.UpdateAttributesConfigRequest() + assert args[0] == request_msg def test_update_attributes_config_use_cached_wrapped_rpc(): @@ -4126,9 +4151,15 @@ async def test_update_attributes_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + catalog_service.UpdateAttributesConfigRequest(), + {}, + ], +) async def test_update_attributes_config_async( - transport: str = "grpc_asyncio", - request_type=catalog_service.UpdateAttributesConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4137,7 +4168,7 @@ async def test_update_attributes_config_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( @@ -4167,11 +4198,6 @@ async def test_update_attributes_config_async( ) -@pytest.mark.asyncio -async def test_update_attributes_config_async_from_dict(): - await test_update_attributes_config_async(request_type=dict) - - def test_update_attributes_config_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4336,8 +4362,8 @@ async def test_update_attributes_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - catalog_service.AddCatalogAttributeRequest, - dict, + catalog_service.AddCatalogAttributeRequest(), + {}, ], ) def test_add_catalog_attribute(request_type, transport: str = "grpc"): @@ -4348,7 +4374,7 @@ def test_add_catalog_attribute(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4401,9 +4427,10 @@ def test_add_catalog_attribute_non_empty_request_with_auto_populated_field(): client.add_catalog_attribute(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog_service.AddCatalogAttributeRequest( + request_msg = catalog_service.AddCatalogAttributeRequest( attributes_config="attributes_config_value", ) + assert args[0] == request_msg def test_add_catalog_attribute_use_cached_wrapped_rpc(): @@ -4489,9 +4516,15 @@ async def test_add_catalog_attribute_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + catalog_service.AddCatalogAttributeRequest(), + {}, + ], +) async def test_add_catalog_attribute_async( - transport: str = "grpc_asyncio", - request_type=catalog_service.AddCatalogAttributeRequest, + request_type, transport: str = "grpc_asyncio" ): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4500,7 +4533,7 @@ async def test_add_catalog_attribute_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( @@ -4530,11 +4563,6 @@ async def test_add_catalog_attribute_async( ) -@pytest.mark.asyncio -async def test_add_catalog_attribute_async_from_dict(): - await test_add_catalog_attribute_async(request_type=dict) - - def test_add_catalog_attribute_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4603,8 +4631,8 @@ async def test_add_catalog_attribute_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - catalog_service.RemoveCatalogAttributeRequest, - dict, + catalog_service.RemoveCatalogAttributeRequest(), + {}, ], ) def test_remove_catalog_attribute(request_type, transport: str = "grpc"): @@ -4615,7 +4643,7 @@ def test_remove_catalog_attribute(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4669,10 +4697,11 @@ def test_remove_catalog_attribute_non_empty_request_with_auto_populated_field(): client.remove_catalog_attribute(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog_service.RemoveCatalogAttributeRequest( + request_msg = catalog_service.RemoveCatalogAttributeRequest( attributes_config="attributes_config_value", key="key_value", ) + assert args[0] == request_msg def test_remove_catalog_attribute_use_cached_wrapped_rpc(): @@ -4758,9 +4787,15 @@ async def test_remove_catalog_attribute_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + catalog_service.RemoveCatalogAttributeRequest(), + {}, + ], +) async def test_remove_catalog_attribute_async( - transport: str = "grpc_asyncio", - request_type=catalog_service.RemoveCatalogAttributeRequest, + request_type, transport: str = "grpc_asyncio" ): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4769,7 +4804,7 @@ async def test_remove_catalog_attribute_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( @@ -4799,11 +4834,6 @@ async def test_remove_catalog_attribute_async( ) -@pytest.mark.asyncio -async def test_remove_catalog_attribute_async_from_dict(): - await test_remove_catalog_attribute_async(request_type=dict) - - def test_remove_catalog_attribute_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4872,8 +4902,8 @@ async def test_remove_catalog_attribute_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - catalog_service.ReplaceCatalogAttributeRequest, - dict, + catalog_service.ReplaceCatalogAttributeRequest(), + {}, ], ) def test_replace_catalog_attribute(request_type, transport: str = "grpc"): @@ -4884,7 +4914,7 @@ def test_replace_catalog_attribute(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4937,9 +4967,10 @@ def test_replace_catalog_attribute_non_empty_request_with_auto_populated_field() client.replace_catalog_attribute(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog_service.ReplaceCatalogAttributeRequest( + request_msg = catalog_service.ReplaceCatalogAttributeRequest( attributes_config="attributes_config_value", ) + assert args[0] == request_msg def test_replace_catalog_attribute_use_cached_wrapped_rpc(): @@ -5025,9 +5056,15 @@ async def test_replace_catalog_attribute_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + catalog_service.ReplaceCatalogAttributeRequest(), + {}, + ], +) async def test_replace_catalog_attribute_async( - transport: str = "grpc_asyncio", - request_type=catalog_service.ReplaceCatalogAttributeRequest, + request_type, transport: str = "grpc_asyncio" ): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5036,7 +5073,7 @@ async def test_replace_catalog_attribute_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( @@ -5066,11 +5103,6 @@ async def test_replace_catalog_attribute_async( ) -@pytest.mark.asyncio -async def test_replace_catalog_attribute_async_from_dict(): - await test_replace_catalog_attribute_async(request_type=dict) - - def test_replace_catalog_attribute_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7042,7 +7074,6 @@ def test_list_catalogs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.ListCatalogsRequest() - assert args[0] == request_msg @@ -7063,7 +7094,6 @@ def test_update_catalog_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.UpdateCatalogRequest() - assert args[0] == request_msg @@ -7086,7 +7116,6 @@ def test_set_default_branch_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.SetDefaultBranchRequest() - assert args[0] == request_msg @@ -7109,7 +7138,6 @@ def test_get_default_branch_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.GetDefaultBranchRequest() - assert args[0] == request_msg @@ -7132,7 +7160,6 @@ def test_get_completion_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.GetCompletionConfigRequest() - assert args[0] == request_msg @@ -7155,7 +7182,6 @@ def test_update_completion_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.UpdateCompletionConfigRequest() - assert args[0] == request_msg @@ -7178,7 +7204,6 @@ def test_get_attributes_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.GetAttributesConfigRequest() - assert args[0] == request_msg @@ -7201,7 +7226,6 @@ def test_update_attributes_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.UpdateAttributesConfigRequest() - assert args[0] == request_msg @@ -7224,7 +7248,6 @@ def test_add_catalog_attribute_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.AddCatalogAttributeRequest() - assert args[0] == request_msg @@ -7247,7 +7270,6 @@ def test_remove_catalog_attribute_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.RemoveCatalogAttributeRequest() - assert args[0] == request_msg @@ -7270,7 +7292,6 @@ def test_replace_catalog_attribute_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.ReplaceCatalogAttributeRequest() - assert args[0] == request_msg @@ -7311,7 +7332,6 @@ async def test_list_catalogs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.ListCatalogsRequest() - assert args[0] == request_msg @@ -7339,7 +7359,6 @@ async def test_update_catalog_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.UpdateCatalogRequest() - assert args[0] == request_msg @@ -7364,7 +7383,6 @@ async def test_set_default_branch_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.SetDefaultBranchRequest() - assert args[0] == request_msg @@ -7394,7 +7412,6 @@ async def test_get_default_branch_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.GetDefaultBranchRequest() - assert args[0] == request_msg @@ -7430,7 +7447,6 @@ async def test_get_completion_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.GetCompletionConfigRequest() - assert args[0] == request_msg @@ -7466,7 +7482,6 @@ async def test_update_completion_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.UpdateCompletionConfigRequest() - assert args[0] == request_msg @@ -7496,7 +7511,6 @@ async def test_get_attributes_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.GetAttributesConfigRequest() - assert args[0] == request_msg @@ -7526,7 +7540,6 @@ async def test_update_attributes_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.UpdateAttributesConfigRequest() - assert args[0] == request_msg @@ -7556,7 +7569,6 @@ async def test_add_catalog_attribute_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.AddCatalogAttributeRequest() - assert args[0] == request_msg @@ -7586,7 +7598,6 @@ async def test_remove_catalog_attribute_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.RemoveCatalogAttributeRequest() - assert args[0] == request_msg @@ -7616,7 +7627,6 @@ async def test_replace_catalog_attribute_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.ReplaceCatalogAttributeRequest() - assert args[0] == request_msg @@ -9560,7 +9570,6 @@ def test_list_catalogs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.ListCatalogsRequest() - assert args[0] == request_msg @@ -9580,7 +9589,6 @@ def test_update_catalog_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.UpdateCatalogRequest() - assert args[0] == request_msg @@ -9602,7 +9610,6 @@ def test_set_default_branch_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.SetDefaultBranchRequest() - assert args[0] == request_msg @@ -9624,7 +9631,6 @@ def test_get_default_branch_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.GetDefaultBranchRequest() - assert args[0] == request_msg @@ -9646,7 +9652,6 @@ def test_get_completion_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.GetCompletionConfigRequest() - assert args[0] == request_msg @@ -9668,7 +9673,6 @@ def test_update_completion_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.UpdateCompletionConfigRequest() - assert args[0] == request_msg @@ -9690,7 +9694,6 @@ def test_get_attributes_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.GetAttributesConfigRequest() - assert args[0] == request_msg @@ -9712,7 +9715,6 @@ def test_update_attributes_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.UpdateAttributesConfigRequest() - assert args[0] == request_msg @@ -9734,7 +9736,6 @@ def test_add_catalog_attribute_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.AddCatalogAttributeRequest() - assert args[0] == request_msg @@ -9756,7 +9757,6 @@ def test_remove_catalog_attribute_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.RemoveCatalogAttributeRequest() - assert args[0] == request_msg @@ -9778,7 +9778,6 @@ def test_replace_catalog_attribute_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.ReplaceCatalogAttributeRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_completion_service.py b/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_completion_service.py index f940e2b6e2b0..4d533807bcec 100644 --- a/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_completion_service.py +++ b/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_completion_service.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 @@ -113,6 +114,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" @@ -1354,8 +1370,8 @@ def test_completion_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - completion_service.CompleteQueryRequest, - dict, + completion_service.CompleteQueryRequest(), + {}, ], ) def test_complete_query(request_type, transport: str = "grpc"): @@ -1366,7 +1382,7 @@ def test_complete_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(type(client.transport.complete_query), "__call__") as call: @@ -1415,7 +1431,7 @@ def test_complete_query_non_empty_request_with_auto_populated_field(): client.complete_query(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == completion_service.CompleteQueryRequest( + request_msg = completion_service.CompleteQueryRequest( catalog="catalog_value", query="query_value", visitor_id="visitor_id_value", @@ -1423,6 +1439,7 @@ def test_complete_query_non_empty_request_with_auto_populated_field(): dataset="dataset_value", entity="entity_value", ) + assert args[0] == request_msg def test_complete_query_use_cached_wrapped_rpc(): @@ -1503,10 +1520,14 @@ async def test_complete_query_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_complete_query_async( - transport: str = "grpc_asyncio", - request_type=completion_service.CompleteQueryRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + completion_service.CompleteQueryRequest(), + {}, + ], +) +async def test_complete_query_async(request_type, transport: str = "grpc_asyncio"): client = CompletionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1514,7 +1535,7 @@ async def test_complete_query_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.complete_query), "__call__") as call: @@ -1537,11 +1558,6 @@ async def test_complete_query_async( assert response.attribution_token == "attribution_token_value" -@pytest.mark.asyncio -async def test_complete_query_async_from_dict(): - await test_complete_query_async(request_type=dict) - - def test_complete_query_field_headers(): client = CompletionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1606,8 +1622,8 @@ async def test_complete_query_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - import_config.ImportCompletionDataRequest, - dict, + import_config.ImportCompletionDataRequest(), + {}, ], ) def test_import_completion_data(request_type, transport: str = "grpc"): @@ -1618,7 +1634,7 @@ def test_import_completion_data(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1664,10 +1680,11 @@ def test_import_completion_data_non_empty_request_with_auto_populated_field(): client.import_completion_data(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == import_config.ImportCompletionDataRequest( + request_msg = import_config.ImportCompletionDataRequest( parent="parent_value", notification_pubsub_topic="notification_pubsub_topic_value", ) + assert args[0] == request_msg def test_import_completion_data_use_cached_wrapped_rpc(): @@ -1763,9 +1780,15 @@ async def test_import_completion_data_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + import_config.ImportCompletionDataRequest(), + {}, + ], +) async def test_import_completion_data_async( - transport: str = "grpc_asyncio", - request_type=import_config.ImportCompletionDataRequest, + request_type, transport: str = "grpc_asyncio" ): client = CompletionServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1774,7 +1797,7 @@ async def test_import_completion_data_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( @@ -1796,11 +1819,6 @@ async def test_import_completion_data_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_import_completion_data_async_from_dict(): - await test_import_completion_data_async(request_type=dict) - - def test_import_completion_data_field_headers(): client = CompletionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2289,7 +2307,6 @@ def test_complete_query_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = completion_service.CompleteQueryRequest() - assert args[0] == request_msg @@ -2312,7 +2329,6 @@ def test_import_completion_data_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_config.ImportCompletionDataRequest() - assert args[0] == request_msg @@ -2353,7 +2369,6 @@ async def test_complete_query_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = completion_service.CompleteQueryRequest() - assert args[0] == request_msg @@ -2380,7 +2395,6 @@ async def test_import_completion_data_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_config.ImportCompletionDataRequest() - assert args[0] == request_msg @@ -2802,7 +2816,6 @@ def test_complete_query_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = completion_service.CompleteQueryRequest() - assert args[0] == request_msg @@ -2824,7 +2837,6 @@ def test_import_completion_data_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_config.ImportCompletionDataRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_control_service.py b/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_control_service.py index c87b741127da..0fe810339de3 100644 --- a/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_control_service.py +++ b/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_control_service.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" @@ -1315,8 +1331,8 @@ def test_control_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - control_service.CreateControlRequest, - dict, + control_service.CreateControlRequest(), + {}, ], ) def test_create_control(request_type, transport: str = "grpc"): @@ -1327,7 +1343,7 @@ def test_create_control(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_control), "__call__") as call: @@ -1386,10 +1402,11 @@ def test_create_control_non_empty_request_with_auto_populated_field(): client.create_control(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == control_service.CreateControlRequest( + request_msg = control_service.CreateControlRequest( parent="parent_value", control_id="control_id_value", ) + assert args[0] == request_msg def test_create_control_use_cached_wrapped_rpc(): @@ -1470,9 +1487,14 @@ async def test_create_control_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_control_async( - transport: str = "grpc_asyncio", request_type=control_service.CreateControlRequest -): +@pytest.mark.parametrize( + "request_type", + [ + control_service.CreateControlRequest(), + {}, + ], +) +async def test_create_control_async(request_type, transport: str = "grpc_asyncio"): client = ControlServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1480,7 +1502,7 @@ async def test_create_control_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_control), "__call__") as call: @@ -1517,11 +1539,6 @@ async def test_create_control_async( ] -@pytest.mark.asyncio -async def test_create_control_async_from_dict(): - await test_create_control_async(request_type=dict) - - def test_create_control_field_headers(): client = ControlServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1696,8 +1713,8 @@ async def test_create_control_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - control_service.DeleteControlRequest, - dict, + control_service.DeleteControlRequest(), + {}, ], ) def test_delete_control(request_type, transport: str = "grpc"): @@ -1708,7 +1725,7 @@ def test_delete_control(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_control), "__call__") as call: @@ -1749,9 +1766,10 @@ def test_delete_control_non_empty_request_with_auto_populated_field(): client.delete_control(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == control_service.DeleteControlRequest( + request_msg = control_service.DeleteControlRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_control_use_cached_wrapped_rpc(): @@ -1832,9 +1850,14 @@ async def test_delete_control_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_control_async( - transport: str = "grpc_asyncio", request_type=control_service.DeleteControlRequest -): +@pytest.mark.parametrize( + "request_type", + [ + control_service.DeleteControlRequest(), + {}, + ], +) +async def test_delete_control_async(request_type, transport: str = "grpc_asyncio"): client = ControlServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1842,7 +1865,7 @@ async def test_delete_control_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_control), "__call__") as call: @@ -1860,11 +1883,6 @@ async def test_delete_control_async( assert response is None -@pytest.mark.asyncio -async def test_delete_control_async_from_dict(): - await test_delete_control_async(request_type=dict) - - def test_delete_control_field_headers(): client = ControlServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2007,8 +2025,8 @@ async def test_delete_control_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - control_service.UpdateControlRequest, - dict, + control_service.UpdateControlRequest(), + {}, ], ) def test_update_control(request_type, transport: str = "grpc"): @@ -2019,7 +2037,7 @@ def test_update_control(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_control), "__call__") as call: @@ -2075,7 +2093,8 @@ def test_update_control_non_empty_request_with_auto_populated_field(): client.update_control(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == control_service.UpdateControlRequest() + request_msg = control_service.UpdateControlRequest() + assert args[0] == request_msg def test_update_control_use_cached_wrapped_rpc(): @@ -2156,9 +2175,14 @@ async def test_update_control_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_control_async( - transport: str = "grpc_asyncio", request_type=control_service.UpdateControlRequest -): +@pytest.mark.parametrize( + "request_type", + [ + control_service.UpdateControlRequest(), + {}, + ], +) +async def test_update_control_async(request_type, transport: str = "grpc_asyncio"): client = ControlServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2166,7 +2190,7 @@ async def test_update_control_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_control), "__call__") as call: @@ -2203,11 +2227,6 @@ async def test_update_control_async( ] -@pytest.mark.asyncio -async def test_update_control_async_from_dict(): - await test_update_control_async(request_type=dict) - - def test_update_control_field_headers(): client = ControlServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2372,8 +2391,8 @@ async def test_update_control_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - control_service.GetControlRequest, - dict, + control_service.GetControlRequest(), + {}, ], ) def test_get_control(request_type, transport: str = "grpc"): @@ -2384,7 +2403,7 @@ def test_get_control(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_control), "__call__") as call: @@ -2442,9 +2461,10 @@ def test_get_control_non_empty_request_with_auto_populated_field(): client.get_control(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == control_service.GetControlRequest( + request_msg = control_service.GetControlRequest( name="name_value", ) + assert args[0] == request_msg def test_get_control_use_cached_wrapped_rpc(): @@ -2525,9 +2545,14 @@ async def test_get_control_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_control_async( - transport: str = "grpc_asyncio", request_type=control_service.GetControlRequest -): +@pytest.mark.parametrize( + "request_type", + [ + control_service.GetControlRequest(), + {}, + ], +) +async def test_get_control_async(request_type, transport: str = "grpc_asyncio"): client = ControlServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2535,7 +2560,7 @@ async def test_get_control_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_control), "__call__") as call: @@ -2572,11 +2597,6 @@ async def test_get_control_async( ] -@pytest.mark.asyncio -async def test_get_control_async_from_dict(): - await test_get_control_async(request_type=dict) - - def test_get_control_field_headers(): client = ControlServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2719,8 +2739,8 @@ async def test_get_control_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - control_service.ListControlsRequest, - dict, + control_service.ListControlsRequest(), + {}, ], ) def test_list_controls(request_type, transport: str = "grpc"): @@ -2731,7 +2751,7 @@ def test_list_controls(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_controls), "__call__") as call: @@ -2777,11 +2797,12 @@ def test_list_controls_non_empty_request_with_auto_populated_field(): client.list_controls(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == control_service.ListControlsRequest( + request_msg = control_service.ListControlsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_controls_use_cached_wrapped_rpc(): @@ -2862,9 +2883,14 @@ async def test_list_controls_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_controls_async( - transport: str = "grpc_asyncio", request_type=control_service.ListControlsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + control_service.ListControlsRequest(), + {}, + ], +) +async def test_list_controls_async(request_type, transport: str = "grpc_asyncio"): client = ControlServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2872,7 +2898,7 @@ async def test_list_controls_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_controls), "__call__") as call: @@ -2895,11 +2921,6 @@ async def test_list_controls_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_controls_async_from_dict(): - await test_list_controls_async(request_type=dict) - - def test_list_controls_field_headers(): client = ControlServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4372,7 +4393,6 @@ def test_create_control_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.CreateControlRequest() - assert args[0] == request_msg @@ -4393,7 +4413,6 @@ def test_delete_control_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.DeleteControlRequest() - assert args[0] == request_msg @@ -4414,7 +4433,6 @@ def test_update_control_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.UpdateControlRequest() - assert args[0] == request_msg @@ -4435,7 +4453,6 @@ def test_get_control_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.GetControlRequest() - assert args[0] == request_msg @@ -4456,7 +4473,6 @@ def test_list_controls_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.ListControlsRequest() - assert args[0] == request_msg @@ -4503,7 +4519,6 @@ async def test_create_control_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.CreateControlRequest() - assert args[0] == request_msg @@ -4526,7 +4541,6 @@ async def test_delete_control_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.DeleteControlRequest() - assert args[0] == request_msg @@ -4559,7 +4573,6 @@ async def test_update_control_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.UpdateControlRequest() - assert args[0] == request_msg @@ -4592,7 +4605,6 @@ async def test_get_control_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.GetControlRequest() - assert args[0] == request_msg @@ -4619,7 +4631,6 @@ async def test_list_controls_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.ListControlsRequest() - assert args[0] == request_msg @@ -5722,7 +5733,6 @@ def test_create_control_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.CreateControlRequest() - assert args[0] == request_msg @@ -5742,7 +5752,6 @@ def test_delete_control_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.DeleteControlRequest() - assert args[0] == request_msg @@ -5762,7 +5771,6 @@ def test_update_control_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.UpdateControlRequest() - assert args[0] == request_msg @@ -5782,7 +5790,6 @@ def test_get_control_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.GetControlRequest() - assert args[0] == request_msg @@ -5802,7 +5809,6 @@ def test_list_controls_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.ListControlsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_conversational_search_service.py b/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_conversational_search_service.py index 28a9edba67e0..35190e1f6512 100644 --- a/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_conversational_search_service.py +++ b/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_conversational_search_service.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 @@ -113,6 +114,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" @@ -1419,8 +1435,8 @@ def test_conversational_search_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - conversational_search_service.ConversationalSearchRequest, - dict, + conversational_search_service.ConversationalSearchRequest(), + {}, ], ) def test_conversational_search(request_type, transport: str = "grpc"): @@ -1431,7 +1447,7 @@ def test_conversational_search(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1485,13 +1501,14 @@ def test_conversational_search_non_empty_request_with_auto_populated_field(): client.conversational_search(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversational_search_service.ConversationalSearchRequest( + request_msg = conversational_search_service.ConversationalSearchRequest( placement="placement_value", branch="branch_value", query="query_value", conversation_id="conversation_id_value", visitor_id="visitor_id_value", ) + assert args[0] == request_msg def test_conversational_search_use_cached_wrapped_rpc(): @@ -1577,9 +1594,15 @@ async def test_conversational_search_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + conversational_search_service.ConversationalSearchRequest(), + {}, + ], +) async def test_conversational_search_async( - transport: str = "grpc_asyncio", - request_type=conversational_search_service.ConversationalSearchRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConversationalSearchServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1588,7 +1611,7 @@ async def test_conversational_search_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( @@ -1614,11 +1637,6 @@ async def test_conversational_search_async( ) -@pytest.mark.asyncio -async def test_conversational_search_async_from_dict(): - await test_conversational_search_async(request_type=dict) - - def test_conversational_search_field_headers(): client = ConversationalSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1964,7 +1982,6 @@ def test_conversational_search_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.ConversationalSearchRequest() - assert args[0] == request_msg @@ -2006,7 +2023,6 @@ async def test_conversational_search_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.ConversationalSearchRequest() - assert args[0] == request_msg @@ -2329,7 +2345,6 @@ def test_conversational_search_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.ConversationalSearchRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_generative_question_service.py b/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_generative_question_service.py index ac186fd135cf..04f120a33522 100644 --- a/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_generative_question_service.py +++ b/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_generative_question_service.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" @@ -1394,8 +1410,8 @@ def test_generative_question_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - generative_question_service.UpdateGenerativeQuestionsFeatureConfigRequest, - dict, + generative_question_service.UpdateGenerativeQuestionsFeatureConfigRequest(), + {}, ], ) def test_update_generative_questions_feature_config( @@ -1408,7 +1424,7 @@ def test_update_generative_questions_feature_config( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1462,10 +1478,10 @@ def test_update_generative_questions_feature_config_non_empty_request_with_auto_ client.update_generative_questions_feature_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert ( - args[0] - == generative_question_service.UpdateGenerativeQuestionsFeatureConfigRequest() + request_msg = ( + generative_question_service.UpdateGenerativeQuestionsFeatureConfigRequest() ) + assert args[0] == request_msg def test_update_generative_questions_feature_config_use_cached_wrapped_rpc(): @@ -1551,9 +1567,15 @@ async def test_update_generative_questions_feature_config_async_use_cached_wrapp @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + generative_question_service.UpdateGenerativeQuestionsFeatureConfigRequest(), + {}, + ], +) async def test_update_generative_questions_feature_config_async( - transport: str = "grpc_asyncio", - request_type=generative_question_service.UpdateGenerativeQuestionsFeatureConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = GenerativeQuestionServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1562,7 +1584,7 @@ async def test_update_generative_questions_feature_config_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( @@ -1593,11 +1615,6 @@ async def test_update_generative_questions_feature_config_async( assert response.minimum_products == 1743 -@pytest.mark.asyncio -async def test_update_generative_questions_feature_config_async_from_dict(): - await test_update_generative_questions_feature_config_async(request_type=dict) - - def test_update_generative_questions_feature_config_field_headers(): client = GenerativeQuestionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1778,8 +1795,8 @@ async def test_update_generative_questions_feature_config_flattened_error_async( @pytest.mark.parametrize( "request_type", [ - generative_question_service.GetGenerativeQuestionsFeatureConfigRequest, - dict, + generative_question_service.GetGenerativeQuestionsFeatureConfigRequest(), + {}, ], ) def test_get_generative_questions_feature_config(request_type, transport: str = "grpc"): @@ -1790,7 +1807,7 @@ def test_get_generative_questions_feature_config(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( @@ -1844,11 +1861,12 @@ def test_get_generative_questions_feature_config_non_empty_request_with_auto_pop client.get_generative_questions_feature_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == generative_question_service.GetGenerativeQuestionsFeatureConfigRequest( - catalog="catalog_value", + request_msg = ( + generative_question_service.GetGenerativeQuestionsFeatureConfigRequest( + catalog="catalog_value", + ) ) + assert args[0] == request_msg def test_get_generative_questions_feature_config_use_cached_wrapped_rpc(): @@ -1934,9 +1952,15 @@ async def test_get_generative_questions_feature_config_async_use_cached_wrapped_ @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + generative_question_service.GetGenerativeQuestionsFeatureConfigRequest(), + {}, + ], +) async def test_get_generative_questions_feature_config_async( - transport: str = "grpc_asyncio", - request_type=generative_question_service.GetGenerativeQuestionsFeatureConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = GenerativeQuestionServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1945,7 +1969,7 @@ async def test_get_generative_questions_feature_config_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( @@ -1976,11 +2000,6 @@ async def test_get_generative_questions_feature_config_async( assert response.minimum_products == 1743 -@pytest.mark.asyncio -async def test_get_generative_questions_feature_config_async_from_dict(): - await test_get_generative_questions_feature_config_async(request_type=dict) - - def test_get_generative_questions_feature_config_field_headers(): client = GenerativeQuestionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2135,8 +2154,8 @@ async def test_get_generative_questions_feature_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - generative_question_service.ListGenerativeQuestionConfigsRequest, - dict, + generative_question_service.ListGenerativeQuestionConfigsRequest(), + {}, ], ) def test_list_generative_question_configs(request_type, transport: str = "grpc"): @@ -2147,7 +2166,7 @@ def test_list_generative_question_configs(request_type, transport: str = "grpc") # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2196,11 +2215,10 @@ def test_list_generative_question_configs_non_empty_request_with_auto_populated_ client.list_generative_question_configs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == generative_question_service.ListGenerativeQuestionConfigsRequest( + request_msg = generative_question_service.ListGenerativeQuestionConfigsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_list_generative_question_configs_use_cached_wrapped_rpc(): @@ -2286,9 +2304,15 @@ async def test_list_generative_question_configs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + generative_question_service.ListGenerativeQuestionConfigsRequest(), + {}, + ], +) async def test_list_generative_question_configs_async( - transport: str = "grpc_asyncio", - request_type=generative_question_service.ListGenerativeQuestionConfigsRequest, + request_type, transport: str = "grpc_asyncio" ): client = GenerativeQuestionServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2297,7 +2321,7 @@ async def test_list_generative_question_configs_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( @@ -2321,11 +2345,6 @@ async def test_list_generative_question_configs_async( ) -@pytest.mark.asyncio -async def test_list_generative_question_configs_async_from_dict(): - await test_list_generative_question_configs_async(request_type=dict) - - def test_list_generative_question_configs_field_headers(): client = GenerativeQuestionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2486,8 +2505,8 @@ async def test_list_generative_question_configs_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - generative_question_service.UpdateGenerativeQuestionConfigRequest, - dict, + generative_question_service.UpdateGenerativeQuestionConfigRequest(), + {}, ], ) def test_update_generative_question_config(request_type, transport: str = "grpc"): @@ -2498,7 +2517,7 @@ def test_update_generative_question_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( @@ -2556,10 +2575,10 @@ def test_update_generative_question_config_non_empty_request_with_auto_populated client.update_generative_question_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert ( - args[0] - == generative_question_service.UpdateGenerativeQuestionConfigRequest() + request_msg = ( + generative_question_service.UpdateGenerativeQuestionConfigRequest() ) + assert args[0] == request_msg def test_update_generative_question_config_use_cached_wrapped_rpc(): @@ -2645,9 +2664,15 @@ async def test_update_generative_question_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + generative_question_service.UpdateGenerativeQuestionConfigRequest(), + {}, + ], +) async def test_update_generative_question_config_async( - transport: str = "grpc_asyncio", - request_type=generative_question_service.UpdateGenerativeQuestionConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = GenerativeQuestionServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2656,7 +2681,7 @@ async def test_update_generative_question_config_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( @@ -2693,11 +2718,6 @@ async def test_update_generative_question_config_async( assert response.allowed_in_conversation is True -@pytest.mark.asyncio -async def test_update_generative_question_config_async_from_dict(): - await test_update_generative_question_config_async(request_type=dict) - - def test_update_generative_question_config_field_headers(): client = GenerativeQuestionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2870,8 +2890,8 @@ async def test_update_generative_question_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - generative_question_service.BatchUpdateGenerativeQuestionConfigsRequest, - dict, + generative_question_service.BatchUpdateGenerativeQuestionConfigsRequest(), + {}, ], ) def test_batch_update_generative_question_configs( @@ -2884,7 +2904,7 @@ def test_batch_update_generative_question_configs( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2936,11 +2956,12 @@ def test_batch_update_generative_question_configs_non_empty_request_with_auto_po client.batch_update_generative_question_configs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == generative_question_service.BatchUpdateGenerativeQuestionConfigsRequest( - parent="parent_value", + request_msg = ( + generative_question_service.BatchUpdateGenerativeQuestionConfigsRequest( + parent="parent_value", + ) ) + assert args[0] == request_msg def test_batch_update_generative_question_configs_use_cached_wrapped_rpc(): @@ -3026,9 +3047,15 @@ async def test_batch_update_generative_question_configs_async_use_cached_wrapped @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + generative_question_service.BatchUpdateGenerativeQuestionConfigsRequest(), + {}, + ], +) async def test_batch_update_generative_question_configs_async( - transport: str = "grpc_asyncio", - request_type=generative_question_service.BatchUpdateGenerativeQuestionConfigsRequest, + request_type, transport: str = "grpc_asyncio" ): client = GenerativeQuestionServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3037,7 +3064,7 @@ async def test_batch_update_generative_question_configs_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( @@ -3064,11 +3091,6 @@ async def test_batch_update_generative_question_configs_async( ) -@pytest.mark.asyncio -async def test_batch_update_generative_question_configs_async_from_dict(): - await test_batch_update_generative_question_configs_async(request_type=dict) - - def test_batch_update_generative_question_configs_field_headers(): client = GenerativeQuestionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4412,7 +4434,6 @@ def test_update_generative_questions_feature_config_empty_call_grpc(): request_msg = ( generative_question_service.UpdateGenerativeQuestionsFeatureConfigRequest() ) - assert args[0] == request_msg @@ -4437,7 +4458,6 @@ def test_get_generative_questions_feature_config_empty_call_grpc(): request_msg = ( generative_question_service.GetGenerativeQuestionsFeatureConfigRequest() ) - assert args[0] == request_msg @@ -4462,7 +4482,6 @@ def test_list_generative_question_configs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generative_question_service.ListGenerativeQuestionConfigsRequest() - assert args[0] == request_msg @@ -4487,7 +4506,6 @@ def test_update_generative_question_config_empty_call_grpc(): request_msg = ( generative_question_service.UpdateGenerativeQuestionConfigRequest() ) - assert args[0] == request_msg @@ -4514,7 +4532,6 @@ def test_batch_update_generative_question_configs_empty_call_grpc(): request_msg = ( generative_question_service.BatchUpdateGenerativeQuestionConfigsRequest() ) - assert args[0] == request_msg @@ -4561,7 +4578,6 @@ async def test_update_generative_questions_feature_config_empty_call_grpc_asynci request_msg = ( generative_question_service.UpdateGenerativeQuestionsFeatureConfigRequest() ) - assert args[0] == request_msg @@ -4594,7 +4610,6 @@ async def test_get_generative_questions_feature_config_empty_call_grpc_asyncio() request_msg = ( generative_question_service.GetGenerativeQuestionsFeatureConfigRequest() ) - assert args[0] == request_msg @@ -4621,7 +4636,6 @@ async def test_list_generative_question_configs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generative_question_service.ListGenerativeQuestionConfigsRequest() - assert args[0] == request_msg @@ -4658,7 +4672,6 @@ async def test_update_generative_question_config_empty_call_grpc_asyncio(): request_msg = ( generative_question_service.UpdateGenerativeQuestionConfigRequest() ) - assert args[0] == request_msg @@ -4687,7 +4700,6 @@ async def test_batch_update_generative_question_configs_empty_call_grpc_asyncio( request_msg = ( generative_question_service.BatchUpdateGenerativeQuestionConfigsRequest() ) - assert args[0] == request_msg @@ -5774,7 +5786,6 @@ def test_update_generative_questions_feature_config_empty_call_rest(): request_msg = ( generative_question_service.UpdateGenerativeQuestionsFeatureConfigRequest() ) - assert args[0] == request_msg @@ -5798,7 +5809,6 @@ def test_get_generative_questions_feature_config_empty_call_rest(): request_msg = ( generative_question_service.GetGenerativeQuestionsFeatureConfigRequest() ) - assert args[0] == request_msg @@ -5820,7 +5830,6 @@ def test_list_generative_question_configs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generative_question_service.ListGenerativeQuestionConfigsRequest() - assert args[0] == request_msg @@ -5844,7 +5853,6 @@ def test_update_generative_question_config_empty_call_rest(): request_msg = ( generative_question_service.UpdateGenerativeQuestionConfigRequest() ) - assert args[0] == request_msg @@ -5868,7 +5876,6 @@ def test_batch_update_generative_question_configs_empty_call_rest(): request_msg = ( generative_question_service.BatchUpdateGenerativeQuestionConfigsRequest() ) - assert args[0] == request_msg diff --git a/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_model_service.py b/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_model_service.py index be6594170091..cc5f8d556dc6 100644 --- a/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_model_service.py +++ b/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_model_service.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 @@ -116,6 +117,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" @@ -1296,8 +1312,8 @@ def test_model_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - model_service.CreateModelRequest, - dict, + model_service.CreateModelRequest(), + {}, ], ) def test_create_model(request_type, transport: str = "grpc"): @@ -1308,7 +1324,7 @@ def test_create_model(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_model), "__call__") as call: @@ -1349,9 +1365,10 @@ def test_create_model_non_empty_request_with_auto_populated_field(): client.create_model(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == model_service.CreateModelRequest( + request_msg = model_service.CreateModelRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_model_use_cached_wrapped_rpc(): @@ -1442,9 +1459,14 @@ async def test_create_model_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_model_async( - transport: str = "grpc_asyncio", request_type=model_service.CreateModelRequest -): +@pytest.mark.parametrize( + "request_type", + [ + model_service.CreateModelRequest(), + {}, + ], +) +async def test_create_model_async(request_type, transport: str = "grpc_asyncio"): client = ModelServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1452,7 +1474,7 @@ async def test_create_model_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_model), "__call__") as call: @@ -1472,11 +1494,6 @@ async def test_create_model_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_model_async_from_dict(): - await test_create_model_async(request_type=dict) - - def test_create_model_field_headers(): client = ModelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1633,8 +1650,8 @@ async def test_create_model_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - model_service.GetModelRequest, - dict, + model_service.GetModelRequest(), + {}, ], ) def test_get_model(request_type, transport: str = "grpc"): @@ -1645,7 +1662,7 @@ def test_get_model(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_model), "__call__") as call: @@ -1713,9 +1730,10 @@ def test_get_model_non_empty_request_with_auto_populated_field(): client.get_model(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == model_service.GetModelRequest( + request_msg = model_service.GetModelRequest( name="name_value", ) + assert args[0] == request_msg def test_get_model_use_cached_wrapped_rpc(): @@ -1794,9 +1812,14 @@ async def test_get_model_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_model_async( - transport: str = "grpc_asyncio", request_type=model_service.GetModelRequest -): +@pytest.mark.parametrize( + "request_type", + [ + model_service.GetModelRequest(), + {}, + ], +) +async def test_get_model_async(request_type, transport: str = "grpc_asyncio"): client = ModelServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1804,7 +1827,7 @@ async def test_get_model_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_model), "__call__") as call: @@ -1851,11 +1874,6 @@ async def test_get_model_async( ) -@pytest.mark.asyncio -async def test_get_model_async_from_dict(): - await test_get_model_async(request_type=dict) - - def test_get_model_field_headers(): client = ModelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1998,8 +2016,8 @@ async def test_get_model_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - model_service.PauseModelRequest, - dict, + model_service.PauseModelRequest(), + {}, ], ) def test_pause_model(request_type, transport: str = "grpc"): @@ -2010,7 +2028,7 @@ def test_pause_model(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.pause_model), "__call__") as call: @@ -2078,9 +2096,10 @@ def test_pause_model_non_empty_request_with_auto_populated_field(): client.pause_model(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == model_service.PauseModelRequest( + request_msg = model_service.PauseModelRequest( name="name_value", ) + assert args[0] == request_msg def test_pause_model_use_cached_wrapped_rpc(): @@ -2161,9 +2180,14 @@ async def test_pause_model_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_pause_model_async( - transport: str = "grpc_asyncio", request_type=model_service.PauseModelRequest -): +@pytest.mark.parametrize( + "request_type", + [ + model_service.PauseModelRequest(), + {}, + ], +) +async def test_pause_model_async(request_type, transport: str = "grpc_asyncio"): client = ModelServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2171,7 +2195,7 @@ async def test_pause_model_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.pause_model), "__call__") as call: @@ -2218,11 +2242,6 @@ async def test_pause_model_async( ) -@pytest.mark.asyncio -async def test_pause_model_async_from_dict(): - await test_pause_model_async(request_type=dict) - - def test_pause_model_field_headers(): client = ModelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2365,8 +2384,8 @@ async def test_pause_model_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - model_service.ResumeModelRequest, - dict, + model_service.ResumeModelRequest(), + {}, ], ) def test_resume_model(request_type, transport: str = "grpc"): @@ -2377,7 +2396,7 @@ def test_resume_model(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.resume_model), "__call__") as call: @@ -2445,9 +2464,10 @@ def test_resume_model_non_empty_request_with_auto_populated_field(): client.resume_model(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == model_service.ResumeModelRequest( + request_msg = model_service.ResumeModelRequest( name="name_value", ) + assert args[0] == request_msg def test_resume_model_use_cached_wrapped_rpc(): @@ -2528,9 +2548,14 @@ async def test_resume_model_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_resume_model_async( - transport: str = "grpc_asyncio", request_type=model_service.ResumeModelRequest -): +@pytest.mark.parametrize( + "request_type", + [ + model_service.ResumeModelRequest(), + {}, + ], +) +async def test_resume_model_async(request_type, transport: str = "grpc_asyncio"): client = ModelServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2538,7 +2563,7 @@ async def test_resume_model_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.resume_model), "__call__") as call: @@ -2585,11 +2610,6 @@ async def test_resume_model_async( ) -@pytest.mark.asyncio -async def test_resume_model_async_from_dict(): - await test_resume_model_async(request_type=dict) - - def test_resume_model_field_headers(): client = ModelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2732,8 +2752,8 @@ async def test_resume_model_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - model_service.DeleteModelRequest, - dict, + model_service.DeleteModelRequest(), + {}, ], ) def test_delete_model(request_type, transport: str = "grpc"): @@ -2744,7 +2764,7 @@ def test_delete_model(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_model), "__call__") as call: @@ -2785,9 +2805,10 @@ def test_delete_model_non_empty_request_with_auto_populated_field(): client.delete_model(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == model_service.DeleteModelRequest( + request_msg = model_service.DeleteModelRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_model_use_cached_wrapped_rpc(): @@ -2868,9 +2889,14 @@ async def test_delete_model_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_model_async( - transport: str = "grpc_asyncio", request_type=model_service.DeleteModelRequest -): +@pytest.mark.parametrize( + "request_type", + [ + model_service.DeleteModelRequest(), + {}, + ], +) +async def test_delete_model_async(request_type, transport: str = "grpc_asyncio"): client = ModelServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2878,7 +2904,7 @@ async def test_delete_model_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_model), "__call__") as call: @@ -2896,11 +2922,6 @@ async def test_delete_model_async( assert response is None -@pytest.mark.asyncio -async def test_delete_model_async_from_dict(): - await test_delete_model_async(request_type=dict) - - def test_delete_model_field_headers(): client = ModelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3043,8 +3064,8 @@ async def test_delete_model_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - model_service.ListModelsRequest, - dict, + model_service.ListModelsRequest(), + {}, ], ) def test_list_models(request_type, transport: str = "grpc"): @@ -3055,7 +3076,7 @@ def test_list_models(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_models), "__call__") as call: @@ -3100,10 +3121,11 @@ def test_list_models_non_empty_request_with_auto_populated_field(): client.list_models(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == model_service.ListModelsRequest( + request_msg = model_service.ListModelsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_models_use_cached_wrapped_rpc(): @@ -3184,9 +3206,14 @@ async def test_list_models_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_models_async( - transport: str = "grpc_asyncio", request_type=model_service.ListModelsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + model_service.ListModelsRequest(), + {}, + ], +) +async def test_list_models_async(request_type, transport: str = "grpc_asyncio"): client = ModelServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3194,7 +3221,7 @@ async def test_list_models_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_models), "__call__") as call: @@ -3217,11 +3244,6 @@ async def test_list_models_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_models_async_from_dict(): - await test_list_models_async(request_type=dict) - - def test_list_models_field_headers(): client = ModelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3558,8 +3580,8 @@ async def test_list_models_async_pages(): @pytest.mark.parametrize( "request_type", [ - model_service.UpdateModelRequest, - dict, + model_service.UpdateModelRequest(), + {}, ], ) def test_update_model(request_type, transport: str = "grpc"): @@ -3570,7 +3592,7 @@ def test_update_model(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_model), "__call__") as call: @@ -3636,7 +3658,8 @@ def test_update_model_non_empty_request_with_auto_populated_field(): client.update_model(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == model_service.UpdateModelRequest() + request_msg = model_service.UpdateModelRequest() + assert args[0] == request_msg def test_update_model_use_cached_wrapped_rpc(): @@ -3717,9 +3740,14 @@ async def test_update_model_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_model_async( - transport: str = "grpc_asyncio", request_type=model_service.UpdateModelRequest -): +@pytest.mark.parametrize( + "request_type", + [ + model_service.UpdateModelRequest(), + {}, + ], +) +async def test_update_model_async(request_type, transport: str = "grpc_asyncio"): client = ModelServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3727,7 +3755,7 @@ async def test_update_model_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_model), "__call__") as call: @@ -3774,11 +3802,6 @@ async def test_update_model_async( ) -@pytest.mark.asyncio -async def test_update_model_async_from_dict(): - await test_update_model_async(request_type=dict) - - def test_update_model_field_headers(): client = ModelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3931,8 +3954,8 @@ async def test_update_model_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - model_service.TuneModelRequest, - dict, + model_service.TuneModelRequest(), + {}, ], ) def test_tune_model(request_type, transport: str = "grpc"): @@ -3943,7 +3966,7 @@ def test_tune_model(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.tune_model), "__call__") as call: @@ -3984,9 +4007,10 @@ def test_tune_model_non_empty_request_with_auto_populated_field(): client.tune_model(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == model_service.TuneModelRequest( + request_msg = model_service.TuneModelRequest( name="name_value", ) + assert args[0] == request_msg def test_tune_model_use_cached_wrapped_rpc(): @@ -4075,9 +4099,14 @@ async def test_tune_model_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_tune_model_async( - transport: str = "grpc_asyncio", request_type=model_service.TuneModelRequest -): +@pytest.mark.parametrize( + "request_type", + [ + model_service.TuneModelRequest(), + {}, + ], +) +async def test_tune_model_async(request_type, transport: str = "grpc_asyncio"): client = ModelServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4085,7 +4114,7 @@ async def test_tune_model_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.tune_model), "__call__") as call: @@ -4105,11 +4134,6 @@ async def test_tune_model_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_tune_model_async_from_dict(): - await test_tune_model_async(request_type=dict) - - def test_tune_model_field_headers(): client = ModelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5897,7 +5921,6 @@ def test_create_model_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.CreateModelRequest() - assert args[0] == request_msg @@ -5918,7 +5941,6 @@ def test_get_model_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.GetModelRequest() - assert args[0] == request_msg @@ -5939,7 +5961,6 @@ def test_pause_model_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.PauseModelRequest() - assert args[0] == request_msg @@ -5960,7 +5981,6 @@ def test_resume_model_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.ResumeModelRequest() - assert args[0] == request_msg @@ -5981,7 +6001,6 @@ def test_delete_model_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.DeleteModelRequest() - assert args[0] == request_msg @@ -6002,7 +6021,6 @@ def test_list_models_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.ListModelsRequest() - assert args[0] == request_msg @@ -6023,7 +6041,6 @@ def test_update_model_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.UpdateModelRequest() - assert args[0] == request_msg @@ -6044,7 +6061,6 @@ def test_tune_model_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.TuneModelRequest() - assert args[0] == request_msg @@ -6083,7 +6099,6 @@ async def test_create_model_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.CreateModelRequest() - assert args[0] == request_msg @@ -6119,7 +6134,6 @@ async def test_get_model_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.GetModelRequest() - assert args[0] == request_msg @@ -6155,7 +6169,6 @@ async def test_pause_model_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.PauseModelRequest() - assert args[0] == request_msg @@ -6191,7 +6204,6 @@ async def test_resume_model_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.ResumeModelRequest() - assert args[0] == request_msg @@ -6214,7 +6226,6 @@ async def test_delete_model_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.DeleteModelRequest() - assert args[0] == request_msg @@ -6241,7 +6252,6 @@ async def test_list_models_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.ListModelsRequest() - assert args[0] == request_msg @@ -6277,7 +6287,6 @@ async def test_update_model_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.UpdateModelRequest() - assert args[0] == request_msg @@ -6302,7 +6311,6 @@ async def test_tune_model_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.TuneModelRequest() - assert args[0] == request_msg @@ -7764,7 +7772,6 @@ def test_create_model_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.CreateModelRequest() - assert args[0] == request_msg @@ -7784,7 +7791,6 @@ def test_get_model_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.GetModelRequest() - assert args[0] == request_msg @@ -7804,7 +7810,6 @@ def test_pause_model_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.PauseModelRequest() - assert args[0] == request_msg @@ -7824,7 +7829,6 @@ def test_resume_model_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.ResumeModelRequest() - assert args[0] == request_msg @@ -7844,7 +7848,6 @@ def test_delete_model_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.DeleteModelRequest() - assert args[0] == request_msg @@ -7864,7 +7867,6 @@ def test_list_models_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.ListModelsRequest() - assert args[0] == request_msg @@ -7884,7 +7886,6 @@ def test_update_model_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.UpdateModelRequest() - assert args[0] == request_msg @@ -7904,7 +7905,6 @@ def test_tune_model_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.TuneModelRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_prediction_service.py b/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_prediction_service.py index 0e5f04cc5808..e4ebe736b5ab 100644 --- a/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_prediction_service.py +++ b/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_prediction_service.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 @@ -119,6 +120,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" @@ -1360,8 +1376,8 @@ def test_prediction_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - prediction_service.PredictRequest, - dict, + prediction_service.PredictRequest(), + {}, ], ) def test_predict(request_type, transport: str = "grpc"): @@ -1372,7 +1388,7 @@ def test_predict(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.predict), "__call__") as call: @@ -1422,11 +1438,12 @@ def test_predict_non_empty_request_with_auto_populated_field(): client.predict(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == prediction_service.PredictRequest( + request_msg = prediction_service.PredictRequest( placement="placement_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_predict_use_cached_wrapped_rpc(): @@ -1505,9 +1522,14 @@ async def test_predict_async_use_cached_wrapped_rpc(transport: str = "grpc_async @pytest.mark.asyncio -async def test_predict_async( - transport: str = "grpc_asyncio", request_type=prediction_service.PredictRequest -): +@pytest.mark.parametrize( + "request_type", + [ + prediction_service.PredictRequest(), + {}, + ], +) +async def test_predict_async(request_type, transport: str = "grpc_asyncio"): client = PredictionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1515,7 +1537,7 @@ async def test_predict_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.predict), "__call__") as call: @@ -1542,11 +1564,6 @@ async def test_predict_async( assert response.validate_only is True -@pytest.mark.asyncio -async def test_predict_async_from_dict(): - await test_predict_async(request_type=dict) - - def test_predict_field_headers(): client = PredictionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1858,7 +1875,6 @@ def test_predict_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = prediction_service.PredictRequest() - assert args[0] == request_msg @@ -1901,7 +1917,6 @@ async def test_predict_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = prediction_service.PredictRequest() - assert args[0] == request_msg @@ -2199,7 +2214,6 @@ def test_predict_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = prediction_service.PredictRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_product_service.py b/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_product_service.py index 9c0ee7593816..999015bcf790 100644 --- a/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_product_service.py +++ b/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_product_service.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 @@ -126,6 +127,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" @@ -1329,8 +1345,8 @@ def test_product_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - product_service.CreateProductRequest, - dict, + product_service.CreateProductRequest(), + {}, ], ) def test_create_product(request_type, transport: str = "grpc"): @@ -1341,7 +1357,7 @@ def test_create_product(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_product), "__call__") as call: @@ -1420,10 +1436,11 @@ def test_create_product_non_empty_request_with_auto_populated_field(): client.create_product(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_service.CreateProductRequest( + request_msg = product_service.CreateProductRequest( parent="parent_value", product_id="product_id_value", ) + assert args[0] == request_msg def test_create_product_use_cached_wrapped_rpc(): @@ -1504,9 +1521,14 @@ async def test_create_product_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_product_async( - transport: str = "grpc_asyncio", request_type=product_service.CreateProductRequest -): +@pytest.mark.parametrize( + "request_type", + [ + product_service.CreateProductRequest(), + {}, + ], +) +async def test_create_product_async(request_type, transport: str = "grpc_asyncio"): client = ProductServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1514,7 +1536,7 @@ async def test_create_product_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_product), "__call__") as call: @@ -1571,11 +1593,6 @@ async def test_create_product_async( assert response.conditions == ["conditions_value"] -@pytest.mark.asyncio -async def test_create_product_async_from_dict(): - await test_create_product_async(request_type=dict) - - def test_create_product_field_headers(): client = ProductServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1746,8 +1763,8 @@ async def test_create_product_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - product_service.GetProductRequest, - dict, + product_service.GetProductRequest(), + {}, ], ) def test_get_product(request_type, transport: str = "grpc"): @@ -1758,7 +1775,7 @@ def test_get_product(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_product), "__call__") as call: @@ -1836,9 +1853,10 @@ def test_get_product_non_empty_request_with_auto_populated_field(): client.get_product(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_service.GetProductRequest( + request_msg = product_service.GetProductRequest( name="name_value", ) + assert args[0] == request_msg def test_get_product_use_cached_wrapped_rpc(): @@ -1919,9 +1937,14 @@ async def test_get_product_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_product_async( - transport: str = "grpc_asyncio", request_type=product_service.GetProductRequest -): +@pytest.mark.parametrize( + "request_type", + [ + product_service.GetProductRequest(), + {}, + ], +) +async def test_get_product_async(request_type, transport: str = "grpc_asyncio"): client = ProductServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1929,7 +1952,7 @@ async def test_get_product_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_product), "__call__") as call: @@ -1986,11 +2009,6 @@ async def test_get_product_async( assert response.conditions == ["conditions_value"] -@pytest.mark.asyncio -async def test_get_product_async_from_dict(): - await test_get_product_async(request_type=dict) - - def test_get_product_field_headers(): client = ProductServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2133,8 +2151,8 @@ async def test_get_product_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - product_service.ListProductsRequest, - dict, + product_service.ListProductsRequest(), + {}, ], ) def test_list_products(request_type, transport: str = "grpc"): @@ -2145,7 +2163,7 @@ def test_list_products(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_products), "__call__") as call: @@ -2191,11 +2209,12 @@ def test_list_products_non_empty_request_with_auto_populated_field(): client.list_products(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_service.ListProductsRequest( + request_msg = product_service.ListProductsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_products_use_cached_wrapped_rpc(): @@ -2276,9 +2295,14 @@ async def test_list_products_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_products_async( - transport: str = "grpc_asyncio", request_type=product_service.ListProductsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + product_service.ListProductsRequest(), + {}, + ], +) +async def test_list_products_async(request_type, transport: str = "grpc_asyncio"): client = ProductServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2286,7 +2310,7 @@ async def test_list_products_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_products), "__call__") as call: @@ -2309,11 +2333,6 @@ async def test_list_products_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_products_async_from_dict(): - await test_list_products_async(request_type=dict) - - def test_list_products_field_headers(): client = ProductServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2650,8 +2669,8 @@ async def test_list_products_async_pages(): @pytest.mark.parametrize( "request_type", [ - product_service.UpdateProductRequest, - dict, + product_service.UpdateProductRequest(), + {}, ], ) def test_update_product(request_type, transport: str = "grpc"): @@ -2662,7 +2681,7 @@ def test_update_product(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_product), "__call__") as call: @@ -2738,7 +2757,8 @@ def test_update_product_non_empty_request_with_auto_populated_field(): client.update_product(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_service.UpdateProductRequest() + request_msg = product_service.UpdateProductRequest() + assert args[0] == request_msg def test_update_product_use_cached_wrapped_rpc(): @@ -2819,9 +2839,14 @@ async def test_update_product_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_product_async( - transport: str = "grpc_asyncio", request_type=product_service.UpdateProductRequest -): +@pytest.mark.parametrize( + "request_type", + [ + product_service.UpdateProductRequest(), + {}, + ], +) +async def test_update_product_async(request_type, transport: str = "grpc_asyncio"): client = ProductServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2829,7 +2854,7 @@ async def test_update_product_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_product), "__call__") as call: @@ -2886,11 +2911,6 @@ async def test_update_product_async( assert response.conditions == ["conditions_value"] -@pytest.mark.asyncio -async def test_update_product_async_from_dict(): - await test_update_product_async(request_type=dict) - - def test_update_product_field_headers(): client = ProductServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3051,8 +3071,8 @@ async def test_update_product_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - product_service.DeleteProductRequest, - dict, + product_service.DeleteProductRequest(), + {}, ], ) def test_delete_product(request_type, transport: str = "grpc"): @@ -3063,7 +3083,7 @@ def test_delete_product(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_product), "__call__") as call: @@ -3104,9 +3124,10 @@ def test_delete_product_non_empty_request_with_auto_populated_field(): client.delete_product(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_service.DeleteProductRequest( + request_msg = product_service.DeleteProductRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_product_use_cached_wrapped_rpc(): @@ -3187,9 +3208,14 @@ async def test_delete_product_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_product_async( - transport: str = "grpc_asyncio", request_type=product_service.DeleteProductRequest -): +@pytest.mark.parametrize( + "request_type", + [ + product_service.DeleteProductRequest(), + {}, + ], +) +async def test_delete_product_async(request_type, transport: str = "grpc_asyncio"): client = ProductServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3197,7 +3223,7 @@ async def test_delete_product_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_product), "__call__") as call: @@ -3215,11 +3241,6 @@ async def test_delete_product_async( assert response is None -@pytest.mark.asyncio -async def test_delete_product_async_from_dict(): - await test_delete_product_async(request_type=dict) - - def test_delete_product_field_headers(): client = ProductServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3362,8 +3383,8 @@ async def test_delete_product_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - purge_config.PurgeProductsRequest, - dict, + purge_config.PurgeProductsRequest(), + {}, ], ) def test_purge_products(request_type, transport: str = "grpc"): @@ -3374,7 +3395,7 @@ def test_purge_products(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.purge_products), "__call__") as call: @@ -3416,10 +3437,11 @@ def test_purge_products_non_empty_request_with_auto_populated_field(): client.purge_products(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == purge_config.PurgeProductsRequest( + request_msg = purge_config.PurgeProductsRequest( parent="parent_value", filter="filter_value", ) + assert args[0] == request_msg def test_purge_products_use_cached_wrapped_rpc(): @@ -3510,9 +3532,14 @@ async def test_purge_products_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_purge_products_async( - transport: str = "grpc_asyncio", request_type=purge_config.PurgeProductsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + purge_config.PurgeProductsRequest(), + {}, + ], +) +async def test_purge_products_async(request_type, transport: str = "grpc_asyncio"): client = ProductServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3520,7 +3547,7 @@ async def test_purge_products_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.purge_products), "__call__") as call: @@ -3540,11 +3567,6 @@ async def test_purge_products_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_purge_products_async_from_dict(): - await test_purge_products_async(request_type=dict) - - def test_purge_products_field_headers(): client = ProductServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3609,8 +3631,8 @@ async def test_purge_products_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - import_config.ImportProductsRequest, - dict, + import_config.ImportProductsRequest(), + {}, ], ) def test_import_products(request_type, transport: str = "grpc"): @@ -3621,7 +3643,7 @@ def test_import_products(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.import_products), "__call__") as call: @@ -3664,11 +3686,12 @@ def test_import_products_non_empty_request_with_auto_populated_field(): client.import_products(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == import_config.ImportProductsRequest( + request_msg = import_config.ImportProductsRequest( parent="parent_value", request_id="request_id_value", notification_pubsub_topic="notification_pubsub_topic_value", ) + assert args[0] == request_msg def test_import_products_use_cached_wrapped_rpc(): @@ -3759,9 +3782,14 @@ async def test_import_products_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_import_products_async( - transport: str = "grpc_asyncio", request_type=import_config.ImportProductsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + import_config.ImportProductsRequest(), + {}, + ], +) +async def test_import_products_async(request_type, transport: str = "grpc_asyncio"): client = ProductServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3769,7 +3797,7 @@ async def test_import_products_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.import_products), "__call__") as call: @@ -3789,11 +3817,6 @@ async def test_import_products_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_import_products_async_from_dict(): - await test_import_products_async(request_type=dict) - - def test_import_products_field_headers(): client = ProductServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3858,8 +3881,8 @@ async def test_import_products_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - product_service.SetInventoryRequest, - dict, + product_service.SetInventoryRequest(), + {}, ], ) def test_set_inventory(request_type, transport: str = "grpc"): @@ -3870,7 +3893,7 @@ def test_set_inventory(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.set_inventory), "__call__") as call: @@ -3909,7 +3932,8 @@ def test_set_inventory_non_empty_request_with_auto_populated_field(): client.set_inventory(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_service.SetInventoryRequest() + request_msg = product_service.SetInventoryRequest() + assert args[0] == request_msg def test_set_inventory_use_cached_wrapped_rpc(): @@ -4000,9 +4024,14 @@ async def test_set_inventory_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_inventory_async( - transport: str = "grpc_asyncio", request_type=product_service.SetInventoryRequest -): +@pytest.mark.parametrize( + "request_type", + [ + product_service.SetInventoryRequest(), + {}, + ], +) +async def test_set_inventory_async(request_type, transport: str = "grpc_asyncio"): client = ProductServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4010,7 +4039,7 @@ async def test_set_inventory_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.set_inventory), "__call__") as call: @@ -4030,11 +4059,6 @@ async def test_set_inventory_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_set_inventory_async_from_dict(): - await test_set_inventory_async(request_type=dict) - - def test_set_inventory_field_headers(): client = ProductServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4191,8 +4215,8 @@ async def test_set_inventory_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - product_service.AddFulfillmentPlacesRequest, - dict, + product_service.AddFulfillmentPlacesRequest(), + {}, ], ) def test_add_fulfillment_places(request_type, transport: str = "grpc"): @@ -4203,7 +4227,7 @@ def test_add_fulfillment_places(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4249,10 +4273,11 @@ def test_add_fulfillment_places_non_empty_request_with_auto_populated_field(): client.add_fulfillment_places(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_service.AddFulfillmentPlacesRequest( + request_msg = product_service.AddFulfillmentPlacesRequest( product="product_value", type_="type__value", ) + assert args[0] == request_msg def test_add_fulfillment_places_use_cached_wrapped_rpc(): @@ -4348,9 +4373,15 @@ async def test_add_fulfillment_places_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + product_service.AddFulfillmentPlacesRequest(), + {}, + ], +) async def test_add_fulfillment_places_async( - transport: str = "grpc_asyncio", - request_type=product_service.AddFulfillmentPlacesRequest, + request_type, transport: str = "grpc_asyncio" ): client = ProductServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4359,7 +4390,7 @@ async def test_add_fulfillment_places_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( @@ -4381,11 +4412,6 @@ async def test_add_fulfillment_places_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_add_fulfillment_places_async_from_dict(): - await test_add_fulfillment_places_async(request_type=dict) - - def test_add_fulfillment_places_field_headers(): client = ProductServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4540,8 +4566,8 @@ async def test_add_fulfillment_places_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - product_service.RemoveFulfillmentPlacesRequest, - dict, + product_service.RemoveFulfillmentPlacesRequest(), + {}, ], ) def test_remove_fulfillment_places(request_type, transport: str = "grpc"): @@ -4552,7 +4578,7 @@ def test_remove_fulfillment_places(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4598,10 +4624,11 @@ def test_remove_fulfillment_places_non_empty_request_with_auto_populated_field() client.remove_fulfillment_places(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_service.RemoveFulfillmentPlacesRequest( + request_msg = product_service.RemoveFulfillmentPlacesRequest( product="product_value", type_="type__value", ) + assert args[0] == request_msg def test_remove_fulfillment_places_use_cached_wrapped_rpc(): @@ -4697,9 +4724,15 @@ async def test_remove_fulfillment_places_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + product_service.RemoveFulfillmentPlacesRequest(), + {}, + ], +) async def test_remove_fulfillment_places_async( - transport: str = "grpc_asyncio", - request_type=product_service.RemoveFulfillmentPlacesRequest, + request_type, transport: str = "grpc_asyncio" ): client = ProductServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4708,7 +4741,7 @@ async def test_remove_fulfillment_places_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( @@ -4730,11 +4763,6 @@ async def test_remove_fulfillment_places_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_remove_fulfillment_places_async_from_dict(): - await test_remove_fulfillment_places_async(request_type=dict) - - def test_remove_fulfillment_places_field_headers(): client = ProductServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4889,8 +4917,8 @@ async def test_remove_fulfillment_places_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - product_service.AddLocalInventoriesRequest, - dict, + product_service.AddLocalInventoriesRequest(), + {}, ], ) def test_add_local_inventories(request_type, transport: str = "grpc"): @@ -4901,7 +4929,7 @@ def test_add_local_inventories(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4946,9 +4974,10 @@ def test_add_local_inventories_non_empty_request_with_auto_populated_field(): client.add_local_inventories(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_service.AddLocalInventoriesRequest( + request_msg = product_service.AddLocalInventoriesRequest( product="product_value", ) + assert args[0] == request_msg def test_add_local_inventories_use_cached_wrapped_rpc(): @@ -5044,9 +5073,15 @@ async def test_add_local_inventories_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + product_service.AddLocalInventoriesRequest(), + {}, + ], +) async def test_add_local_inventories_async( - transport: str = "grpc_asyncio", - request_type=product_service.AddLocalInventoriesRequest, + request_type, transport: str = "grpc_asyncio" ): client = ProductServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5055,7 +5090,7 @@ async def test_add_local_inventories_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( @@ -5077,11 +5112,6 @@ async def test_add_local_inventories_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_add_local_inventories_async_from_dict(): - await test_add_local_inventories_async(request_type=dict) - - def test_add_local_inventories_field_headers(): client = ProductServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5236,8 +5266,8 @@ async def test_add_local_inventories_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - product_service.RemoveLocalInventoriesRequest, - dict, + product_service.RemoveLocalInventoriesRequest(), + {}, ], ) def test_remove_local_inventories(request_type, transport: str = "grpc"): @@ -5248,7 +5278,7 @@ def test_remove_local_inventories(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5293,9 +5323,10 @@ def test_remove_local_inventories_non_empty_request_with_auto_populated_field(): client.remove_local_inventories(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_service.RemoveLocalInventoriesRequest( + request_msg = product_service.RemoveLocalInventoriesRequest( product="product_value", ) + assert args[0] == request_msg def test_remove_local_inventories_use_cached_wrapped_rpc(): @@ -5391,9 +5422,15 @@ async def test_remove_local_inventories_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + product_service.RemoveLocalInventoriesRequest(), + {}, + ], +) async def test_remove_local_inventories_async( - transport: str = "grpc_asyncio", - request_type=product_service.RemoveLocalInventoriesRequest, + request_type, transport: str = "grpc_asyncio" ): client = ProductServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5402,7 +5439,7 @@ async def test_remove_local_inventories_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( @@ -5424,11 +5461,6 @@ async def test_remove_local_inventories_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_remove_local_inventories_async_from_dict(): - await test_remove_local_inventories_async(request_type=dict) - - def test_remove_local_inventories_field_headers(): client = ProductServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7971,7 +8003,6 @@ def test_create_product_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.CreateProductRequest() - assert args[0] == request_msg @@ -7992,7 +8023,6 @@ def test_get_product_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.GetProductRequest() - assert args[0] == request_msg @@ -8013,7 +8043,6 @@ def test_list_products_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.ListProductsRequest() - assert args[0] == request_msg @@ -8034,7 +8063,6 @@ def test_update_product_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.UpdateProductRequest() - assert args[0] == request_msg @@ -8055,7 +8083,6 @@ def test_delete_product_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.DeleteProductRequest() - assert args[0] == request_msg @@ -8076,7 +8103,6 @@ def test_purge_products_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = purge_config.PurgeProductsRequest() - assert args[0] == request_msg @@ -8097,7 +8123,6 @@ def test_import_products_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_config.ImportProductsRequest() - assert args[0] == request_msg @@ -8118,7 +8143,6 @@ def test_set_inventory_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.SetInventoryRequest() - assert args[0] == request_msg @@ -8141,7 +8165,6 @@ def test_add_fulfillment_places_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.AddFulfillmentPlacesRequest() - assert args[0] == request_msg @@ -8164,7 +8187,6 @@ def test_remove_fulfillment_places_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.RemoveFulfillmentPlacesRequest() - assert args[0] == request_msg @@ -8187,7 +8209,6 @@ def test_add_local_inventories_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.AddLocalInventoriesRequest() - assert args[0] == request_msg @@ -8210,7 +8231,6 @@ def test_remove_local_inventories_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.RemoveLocalInventoriesRequest() - assert args[0] == request_msg @@ -8268,7 +8288,6 @@ async def test_create_product_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.CreateProductRequest() - assert args[0] == request_msg @@ -8312,7 +8331,6 @@ async def test_get_product_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.GetProductRequest() - assert args[0] == request_msg @@ -8339,7 +8357,6 @@ async def test_list_products_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.ListProductsRequest() - assert args[0] == request_msg @@ -8383,7 +8400,6 @@ async def test_update_product_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.UpdateProductRequest() - assert args[0] == request_msg @@ -8406,7 +8422,6 @@ async def test_delete_product_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.DeleteProductRequest() - assert args[0] == request_msg @@ -8431,7 +8446,6 @@ async def test_purge_products_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = purge_config.PurgeProductsRequest() - assert args[0] == request_msg @@ -8456,7 +8470,6 @@ async def test_import_products_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_config.ImportProductsRequest() - assert args[0] == request_msg @@ -8481,7 +8494,6 @@ async def test_set_inventory_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.SetInventoryRequest() - assert args[0] == request_msg @@ -8508,7 +8520,6 @@ async def test_add_fulfillment_places_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.AddFulfillmentPlacesRequest() - assert args[0] == request_msg @@ -8535,7 +8546,6 @@ async def test_remove_fulfillment_places_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.RemoveFulfillmentPlacesRequest() - assert args[0] == request_msg @@ -8562,7 +8572,6 @@ async def test_add_local_inventories_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.AddLocalInventoriesRequest() - assert args[0] == request_msg @@ -8589,7 +8598,6 @@ async def test_remove_local_inventories_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.RemoveLocalInventoriesRequest() - assert args[0] == request_msg @@ -10717,7 +10725,6 @@ def test_create_product_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.CreateProductRequest() - assert args[0] == request_msg @@ -10737,7 +10744,6 @@ def test_get_product_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.GetProductRequest() - assert args[0] == request_msg @@ -10757,7 +10763,6 @@ def test_list_products_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.ListProductsRequest() - assert args[0] == request_msg @@ -10777,7 +10782,6 @@ def test_update_product_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.UpdateProductRequest() - assert args[0] == request_msg @@ -10797,7 +10801,6 @@ def test_delete_product_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.DeleteProductRequest() - assert args[0] == request_msg @@ -10817,7 +10820,6 @@ def test_purge_products_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = purge_config.PurgeProductsRequest() - assert args[0] == request_msg @@ -10837,7 +10839,6 @@ def test_import_products_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_config.ImportProductsRequest() - assert args[0] == request_msg @@ -10857,7 +10858,6 @@ def test_set_inventory_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.SetInventoryRequest() - assert args[0] == request_msg @@ -10879,7 +10879,6 @@ def test_add_fulfillment_places_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.AddFulfillmentPlacesRequest() - assert args[0] == request_msg @@ -10901,7 +10900,6 @@ def test_remove_fulfillment_places_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.RemoveFulfillmentPlacesRequest() - assert args[0] == request_msg @@ -10923,7 +10921,6 @@ def test_add_local_inventories_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.AddLocalInventoriesRequest() - assert args[0] == request_msg @@ -10945,7 +10942,6 @@ def test_remove_local_inventories_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.RemoveLocalInventoriesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_search_service.py b/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_search_service.py index 5422b197408f..87d17d1b1705 100644 --- a/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_search_service.py +++ b/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_search_service.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 @@ -109,6 +110,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" @@ -1308,8 +1324,8 @@ def test_search_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - search_service.SearchRequest, - dict, + search_service.SearchRequest(), + {}, ], ) def test_search(request_type, transport: str = "grpc"): @@ -1320,7 +1336,7 @@ def test_search(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.search), "__call__") as call: @@ -1385,7 +1401,7 @@ def test_search_non_empty_request_with_auto_populated_field(): client.search(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == search_service.SearchRequest( + request_msg = search_service.SearchRequest( placement="placement_value", branch="branch_value", query="query_value", @@ -1399,6 +1415,7 @@ def test_search_non_empty_request_with_auto_populated_field(): region_code="region_code_value", place_id="place_id_value", ) + assert args[0] == request_msg def test_search_use_cached_wrapped_rpc(): @@ -1477,9 +1494,14 @@ async def test_search_async_use_cached_wrapped_rpc(transport: str = "grpc_asynci @pytest.mark.asyncio -async def test_search_async( - transport: str = "grpc_asyncio", request_type=search_service.SearchRequest -): +@pytest.mark.parametrize( + "request_type", + [ + search_service.SearchRequest(), + {}, + ], +) +async def test_search_async(request_type, transport: str = "grpc_asyncio"): client = SearchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1487,7 +1509,7 @@ async def test_search_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.search), "__call__") as call: @@ -1520,11 +1542,6 @@ async def test_search_async( assert response.applied_controls == ["applied_controls_value"] -@pytest.mark.asyncio -async def test_search_async_from_dict(): - await test_search_async(request_type=dict) - - def test_search_field_headers(): client = SearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2099,7 +2116,6 @@ def test_search_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = search_service.SearchRequest() - assert args[0] == request_msg @@ -2145,7 +2161,6 @@ async def test_search_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = search_service.SearchRequest() - assert args[0] == request_msg @@ -2445,7 +2460,6 @@ def test_search_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = search_service.SearchRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_serving_config_service.py b/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_serving_config_service.py index a0a3212591d5..129a3a59134f 100644 --- a/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_serving_config_service.py +++ b/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_serving_config_service.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 @@ -116,6 +117,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" @@ -1379,8 +1395,8 @@ def test_serving_config_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - serving_config_service.CreateServingConfigRequest, - dict, + serving_config_service.CreateServingConfigRequest(), + {}, ], ) def test_create_serving_config(request_type, transport: str = "grpc"): @@ -1391,7 +1407,7 @@ def test_create_serving_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( @@ -1479,10 +1495,11 @@ def test_create_serving_config_non_empty_request_with_auto_populated_field(): client.create_serving_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == serving_config_service.CreateServingConfigRequest( + request_msg = serving_config_service.CreateServingConfigRequest( parent="parent_value", serving_config_id="serving_config_id_value", ) + assert args[0] == request_msg def test_create_serving_config_use_cached_wrapped_rpc(): @@ -1568,9 +1585,15 @@ async def test_create_serving_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + serving_config_service.CreateServingConfigRequest(), + {}, + ], +) async def test_create_serving_config_async( - transport: str = "grpc_asyncio", - request_type=serving_config_service.CreateServingConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = ServingConfigServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1579,7 +1602,7 @@ async def test_create_serving_config_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( @@ -1643,11 +1666,6 @@ async def test_create_serving_config_async( assert response.solution_types == [common.SolutionType.SOLUTION_TYPE_RECOMMENDATION] -@pytest.mark.asyncio -async def test_create_serving_config_async_from_dict(): - await test_create_serving_config_async(request_type=dict) - - def test_create_serving_config_field_headers(): client = ServingConfigServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1822,8 +1840,8 @@ async def test_create_serving_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - serving_config_service.DeleteServingConfigRequest, - dict, + serving_config_service.DeleteServingConfigRequest(), + {}, ], ) def test_delete_serving_config(request_type, transport: str = "grpc"): @@ -1834,7 +1852,7 @@ def test_delete_serving_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( @@ -1879,9 +1897,10 @@ def test_delete_serving_config_non_empty_request_with_auto_populated_field(): client.delete_serving_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == serving_config_service.DeleteServingConfigRequest( + request_msg = serving_config_service.DeleteServingConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_serving_config_use_cached_wrapped_rpc(): @@ -1967,9 +1986,15 @@ async def test_delete_serving_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + serving_config_service.DeleteServingConfigRequest(), + {}, + ], +) async def test_delete_serving_config_async( - transport: str = "grpc_asyncio", - request_type=serving_config_service.DeleteServingConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = ServingConfigServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1978,7 +2003,7 @@ async def test_delete_serving_config_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( @@ -1998,11 +2023,6 @@ async def test_delete_serving_config_async( assert response is None -@pytest.mark.asyncio -async def test_delete_serving_config_async_from_dict(): - await test_delete_serving_config_async(request_type=dict) - - def test_delete_serving_config_field_headers(): client = ServingConfigServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2153,8 +2173,8 @@ async def test_delete_serving_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - serving_config_service.UpdateServingConfigRequest, - dict, + serving_config_service.UpdateServingConfigRequest(), + {}, ], ) def test_update_serving_config(request_type, transport: str = "grpc"): @@ -2165,7 +2185,7 @@ def test_update_serving_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( @@ -2250,7 +2270,8 @@ def test_update_serving_config_non_empty_request_with_auto_populated_field(): client.update_serving_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == serving_config_service.UpdateServingConfigRequest() + request_msg = serving_config_service.UpdateServingConfigRequest() + assert args[0] == request_msg def test_update_serving_config_use_cached_wrapped_rpc(): @@ -2336,9 +2357,15 @@ async def test_update_serving_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + serving_config_service.UpdateServingConfigRequest(), + {}, + ], +) async def test_update_serving_config_async( - transport: str = "grpc_asyncio", - request_type=serving_config_service.UpdateServingConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = ServingConfigServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2347,7 +2374,7 @@ async def test_update_serving_config_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( @@ -2411,11 +2438,6 @@ async def test_update_serving_config_async( assert response.solution_types == [common.SolutionType.SOLUTION_TYPE_RECOMMENDATION] -@pytest.mark.asyncio -async def test_update_serving_config_async_from_dict(): - await test_update_serving_config_async(request_type=dict) - - def test_update_serving_config_field_headers(): client = ServingConfigServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2580,8 +2602,8 @@ async def test_update_serving_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - serving_config_service.GetServingConfigRequest, - dict, + serving_config_service.GetServingConfigRequest(), + {}, ], ) def test_get_serving_config(request_type, transport: str = "grpc"): @@ -2592,7 +2614,7 @@ def test_get_serving_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( @@ -2679,9 +2701,10 @@ def test_get_serving_config_non_empty_request_with_auto_populated_field(): client.get_serving_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == serving_config_service.GetServingConfigRequest( + request_msg = serving_config_service.GetServingConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_serving_config_use_cached_wrapped_rpc(): @@ -2766,10 +2789,14 @@ async def test_get_serving_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_serving_config_async( - transport: str = "grpc_asyncio", - request_type=serving_config_service.GetServingConfigRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + serving_config_service.GetServingConfigRequest(), + {}, + ], +) +async def test_get_serving_config_async(request_type, transport: str = "grpc_asyncio"): client = ServingConfigServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2777,7 +2804,7 @@ async def test_get_serving_config_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( @@ -2841,11 +2868,6 @@ async def test_get_serving_config_async( assert response.solution_types == [common.SolutionType.SOLUTION_TYPE_RECOMMENDATION] -@pytest.mark.asyncio -async def test_get_serving_config_async_from_dict(): - await test_get_serving_config_async(request_type=dict) - - def test_get_serving_config_field_headers(): client = ServingConfigServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3000,8 +3022,8 @@ async def test_get_serving_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - serving_config_service.ListServingConfigsRequest, - dict, + serving_config_service.ListServingConfigsRequest(), + {}, ], ) def test_list_serving_configs(request_type, transport: str = "grpc"): @@ -3012,7 +3034,7 @@ def test_list_serving_configs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,10 +3083,11 @@ def test_list_serving_configs_non_empty_request_with_auto_populated_field(): client.list_serving_configs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == serving_config_service.ListServingConfigsRequest( + request_msg = serving_config_service.ListServingConfigsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_serving_configs_use_cached_wrapped_rpc(): @@ -3149,9 +3172,15 @@ async def test_list_serving_configs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + serving_config_service.ListServingConfigsRequest(), + {}, + ], +) async def test_list_serving_configs_async( - transport: str = "grpc_asyncio", - request_type=serving_config_service.ListServingConfigsRequest, + request_type, transport: str = "grpc_asyncio" ): client = ServingConfigServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3160,7 +3189,7 @@ async def test_list_serving_configs_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( @@ -3185,11 +3214,6 @@ async def test_list_serving_configs_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_serving_configs_async_from_dict(): - await test_list_serving_configs_async(request_type=dict) - - def test_list_serving_configs_field_headers(): client = ServingConfigServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3542,8 +3566,8 @@ async def test_list_serving_configs_async_pages(): @pytest.mark.parametrize( "request_type", [ - serving_config_service.AddControlRequest, - dict, + serving_config_service.AddControlRequest(), + {}, ], ) def test_add_control(request_type, transport: str = "grpc"): @@ -3554,7 +3578,7 @@ def test_add_control(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.add_control), "__call__") as call: @@ -3638,10 +3662,11 @@ def test_add_control_non_empty_request_with_auto_populated_field(): client.add_control(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == serving_config_service.AddControlRequest( + request_msg = serving_config_service.AddControlRequest( serving_config="serving_config_value", control_id="control_id_value", ) + assert args[0] == request_msg def test_add_control_use_cached_wrapped_rpc(): @@ -3722,10 +3747,14 @@ async def test_add_control_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_add_control_async( - transport: str = "grpc_asyncio", - request_type=serving_config_service.AddControlRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + serving_config_service.AddControlRequest(), + {}, + ], +) +async def test_add_control_async(request_type, transport: str = "grpc_asyncio"): client = ServingConfigServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3733,7 +3762,7 @@ async def test_add_control_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.add_control), "__call__") as call: @@ -3795,11 +3824,6 @@ async def test_add_control_async( assert response.solution_types == [common.SolutionType.SOLUTION_TYPE_RECOMMENDATION] -@pytest.mark.asyncio -async def test_add_control_async_from_dict(): - await test_add_control_async(request_type=dict) - - def test_add_control_field_headers(): client = ServingConfigServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3946,8 +3970,8 @@ async def test_add_control_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - serving_config_service.RemoveControlRequest, - dict, + serving_config_service.RemoveControlRequest(), + {}, ], ) def test_remove_control(request_type, transport: str = "grpc"): @@ -3958,7 +3982,7 @@ def test_remove_control(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.remove_control), "__call__") as call: @@ -4042,10 +4066,11 @@ def test_remove_control_non_empty_request_with_auto_populated_field(): client.remove_control(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == serving_config_service.RemoveControlRequest( + request_msg = serving_config_service.RemoveControlRequest( serving_config="serving_config_value", control_id="control_id_value", ) + assert args[0] == request_msg def test_remove_control_use_cached_wrapped_rpc(): @@ -4126,10 +4151,14 @@ async def test_remove_control_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_remove_control_async( - transport: str = "grpc_asyncio", - request_type=serving_config_service.RemoveControlRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + serving_config_service.RemoveControlRequest(), + {}, + ], +) +async def test_remove_control_async(request_type, transport: str = "grpc_asyncio"): client = ServingConfigServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4137,7 +4166,7 @@ async def test_remove_control_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.remove_control), "__call__") as call: @@ -4199,11 +4228,6 @@ async def test_remove_control_async( assert response.solution_types == [common.SolutionType.SOLUTION_TYPE_RECOMMENDATION] -@pytest.mark.asyncio -async def test_remove_control_async_from_dict(): - await test_remove_control_async(request_type=dict) - - def test_remove_control_field_headers(): client = ServingConfigServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5892,7 +5916,6 @@ def test_create_serving_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.CreateServingConfigRequest() - assert args[0] == request_msg @@ -5915,7 +5938,6 @@ def test_delete_serving_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.DeleteServingConfigRequest() - assert args[0] == request_msg @@ -5938,7 +5960,6 @@ def test_update_serving_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.UpdateServingConfigRequest() - assert args[0] == request_msg @@ -5961,7 +5982,6 @@ def test_get_serving_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.GetServingConfigRequest() - assert args[0] == request_msg @@ -5984,7 +6004,6 @@ def test_list_serving_configs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.ListServingConfigsRequest() - assert args[0] == request_msg @@ -6005,7 +6024,6 @@ def test_add_control_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.AddControlRequest() - assert args[0] == request_msg @@ -6026,7 +6044,6 @@ def test_remove_control_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.RemoveControlRequest() - assert args[0] == request_msg @@ -6086,7 +6103,6 @@ async def test_create_serving_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.CreateServingConfigRequest() - assert args[0] == request_msg @@ -6111,7 +6127,6 @@ async def test_delete_serving_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.DeleteServingConfigRequest() - assert args[0] == request_msg @@ -6157,7 +6172,6 @@ async def test_update_serving_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.UpdateServingConfigRequest() - assert args[0] == request_msg @@ -6203,7 +6217,6 @@ async def test_get_serving_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.GetServingConfigRequest() - assert args[0] == request_msg @@ -6232,7 +6245,6 @@ async def test_list_serving_configs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.ListServingConfigsRequest() - assert args[0] == request_msg @@ -6276,7 +6288,6 @@ async def test_add_control_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.AddControlRequest() - assert args[0] == request_msg @@ -6320,7 +6331,6 @@ async def test_remove_control_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.RemoveControlRequest() - assert args[0] == request_msg @@ -7838,7 +7848,6 @@ def test_create_serving_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.CreateServingConfigRequest() - assert args[0] == request_msg @@ -7860,7 +7869,6 @@ def test_delete_serving_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.DeleteServingConfigRequest() - assert args[0] == request_msg @@ -7882,7 +7890,6 @@ def test_update_serving_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.UpdateServingConfigRequest() - assert args[0] == request_msg @@ -7904,7 +7911,6 @@ def test_get_serving_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.GetServingConfigRequest() - assert args[0] == request_msg @@ -7926,7 +7932,6 @@ def test_list_serving_configs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.ListServingConfigsRequest() - assert args[0] == request_msg @@ -7946,7 +7951,6 @@ def test_add_control_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.AddControlRequest() - assert args[0] == request_msg @@ -7966,7 +7970,6 @@ def test_remove_control_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.RemoveControlRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_user_event_service.py b/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_user_event_service.py index 19474f782c17..38412875aa8f 100644 --- a/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_user_event_service.py +++ b/packages/google-cloud-retail/tests/unit/gapic/retail_v2/test_user_event_service.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 @@ -127,6 +128,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" @@ -1360,8 +1376,8 @@ def test_user_event_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - user_event_service.WriteUserEventRequest, - dict, + user_event_service.WriteUserEventRequest(), + {}, ], ) def test_write_user_event(request_type, transport: str = "grpc"): @@ -1372,7 +1388,7 @@ def test_write_user_event(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.write_user_event), "__call__") as call: @@ -1444,9 +1460,10 @@ def test_write_user_event_non_empty_request_with_auto_populated_field(): client.write_user_event(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == user_event_service.WriteUserEventRequest( + request_msg = user_event_service.WriteUserEventRequest( parent="parent_value", ) + assert args[0] == request_msg def test_write_user_event_use_cached_wrapped_rpc(): @@ -1529,10 +1546,14 @@ async def test_write_user_event_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_write_user_event_async( - transport: str = "grpc_asyncio", - request_type=user_event_service.WriteUserEventRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + user_event_service.WriteUserEventRequest(), + {}, + ], +) +async def test_write_user_event_async(request_type, transport: str = "grpc_asyncio"): client = UserEventServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1540,7 +1561,7 @@ async def test_write_user_event_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.write_user_event), "__call__") as call: @@ -1591,11 +1612,6 @@ async def test_write_user_event_async( assert response.entity == "entity_value" -@pytest.mark.asyncio -async def test_write_user_event_async_from_dict(): - await test_write_user_event_async(request_type=dict) - - def test_write_user_event_field_headers(): client = UserEventServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1660,8 +1676,8 @@ async def test_write_user_event_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - user_event_service.CollectUserEventRequest, - dict, + user_event_service.CollectUserEventRequest(), + {}, ], ) def test_collect_user_event(request_type, transport: str = "grpc"): @@ -1672,7 +1688,7 @@ def test_collect_user_event(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1726,13 +1742,14 @@ def test_collect_user_event_non_empty_request_with_auto_populated_field(): client.collect_user_event(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == user_event_service.CollectUserEventRequest( + request_msg = user_event_service.CollectUserEventRequest( prebuilt_rule="prebuilt_rule_value", parent="parent_value", user_event="user_event_value", uri="uri_value", raw_json="raw_json_value", ) + assert args[0] == request_msg def test_collect_user_event_use_cached_wrapped_rpc(): @@ -1817,10 +1834,14 @@ async def test_collect_user_event_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_collect_user_event_async( - transport: str = "grpc_asyncio", - request_type=user_event_service.CollectUserEventRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + user_event_service.CollectUserEventRequest(), + {}, + ], +) +async def test_collect_user_event_async(request_type, transport: str = "grpc_asyncio"): client = UserEventServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1828,7 +1849,7 @@ async def test_collect_user_event_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( @@ -1855,11 +1876,6 @@ async def test_collect_user_event_async( assert response.data == b"data_blob" -@pytest.mark.asyncio -async def test_collect_user_event_async_from_dict(): - await test_collect_user_event_async(request_type=dict) - - def test_collect_user_event_field_headers(): client = UserEventServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1928,8 +1944,8 @@ async def test_collect_user_event_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - purge_config.PurgeUserEventsRequest, - dict, + purge_config.PurgeUserEventsRequest(), + {}, ], ) def test_purge_user_events(request_type, transport: str = "grpc"): @@ -1940,7 +1956,7 @@ def test_purge_user_events(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1986,10 +2002,11 @@ def test_purge_user_events_non_empty_request_with_auto_populated_field(): client.purge_user_events(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == purge_config.PurgeUserEventsRequest( + request_msg = purge_config.PurgeUserEventsRequest( parent="parent_value", filter="filter_value", ) + assert args[0] == request_msg def test_purge_user_events_use_cached_wrapped_rpc(): @@ -2082,9 +2099,14 @@ async def test_purge_user_events_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_purge_user_events_async( - transport: str = "grpc_asyncio", request_type=purge_config.PurgeUserEventsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + purge_config.PurgeUserEventsRequest(), + {}, + ], +) +async def test_purge_user_events_async(request_type, transport: str = "grpc_asyncio"): client = UserEventServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2092,7 +2114,7 @@ async def test_purge_user_events_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( @@ -2114,11 +2136,6 @@ async def test_purge_user_events_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_purge_user_events_async_from_dict(): - await test_purge_user_events_async(request_type=dict) - - def test_purge_user_events_field_headers(): client = UserEventServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2187,8 +2204,8 @@ async def test_purge_user_events_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - import_config.ImportUserEventsRequest, - dict, + import_config.ImportUserEventsRequest(), + {}, ], ) def test_import_user_events(request_type, transport: str = "grpc"): @@ -2199,7 +2216,7 @@ def test_import_user_events(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2244,9 +2261,10 @@ def test_import_user_events_non_empty_request_with_auto_populated_field(): client.import_user_events(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == import_config.ImportUserEventsRequest( + request_msg = import_config.ImportUserEventsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_import_user_events_use_cached_wrapped_rpc(): @@ -2341,9 +2359,14 @@ async def test_import_user_events_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_import_user_events_async( - transport: str = "grpc_asyncio", request_type=import_config.ImportUserEventsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + import_config.ImportUserEventsRequest(), + {}, + ], +) +async def test_import_user_events_async(request_type, transport: str = "grpc_asyncio"): client = UserEventServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2351,7 +2374,7 @@ async def test_import_user_events_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( @@ -2373,11 +2396,6 @@ async def test_import_user_events_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_import_user_events_async_from_dict(): - await test_import_user_events_async(request_type=dict) - - def test_import_user_events_field_headers(): client = UserEventServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2446,8 +2464,8 @@ async def test_import_user_events_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - user_event_service.RejoinUserEventsRequest, - dict, + user_event_service.RejoinUserEventsRequest(), + {}, ], ) def test_rejoin_user_events(request_type, transport: str = "grpc"): @@ -2458,7 +2476,7 @@ def test_rejoin_user_events(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2503,9 +2521,10 @@ def test_rejoin_user_events_non_empty_request_with_auto_populated_field(): client.rejoin_user_events(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == user_event_service.RejoinUserEventsRequest( + request_msg = user_event_service.RejoinUserEventsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_rejoin_user_events_use_cached_wrapped_rpc(): @@ -2600,10 +2619,14 @@ async def test_rejoin_user_events_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_rejoin_user_events_async( - transport: str = "grpc_asyncio", - request_type=user_event_service.RejoinUserEventsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + user_event_service.RejoinUserEventsRequest(), + {}, + ], +) +async def test_rejoin_user_events_async(request_type, transport: str = "grpc_asyncio"): client = UserEventServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2611,7 +2634,7 @@ async def test_rejoin_user_events_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( @@ -2633,11 +2656,6 @@ async def test_rejoin_user_events_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_rejoin_user_events_async_from_dict(): - await test_rejoin_user_events_async(request_type=dict) - - def test_rejoin_user_events_field_headers(): client = UserEventServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3516,7 +3534,6 @@ def test_write_user_event_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_event_service.WriteUserEventRequest() - assert args[0] == request_msg @@ -3539,7 +3556,6 @@ def test_collect_user_event_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_event_service.CollectUserEventRequest() - assert args[0] == request_msg @@ -3562,7 +3578,6 @@ def test_purge_user_events_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = purge_config.PurgeUserEventsRequest() - assert args[0] == request_msg @@ -3585,7 +3600,6 @@ def test_import_user_events_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_config.ImportUserEventsRequest() - assert args[0] == request_msg @@ -3608,7 +3622,6 @@ def test_rejoin_user_events_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_event_service.RejoinUserEventsRequest() - assert args[0] == request_msg @@ -3663,7 +3676,6 @@ async def test_write_user_event_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_event_service.WriteUserEventRequest() - assert args[0] == request_msg @@ -3693,7 +3705,6 @@ async def test_collect_user_event_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_event_service.CollectUserEventRequest() - assert args[0] == request_msg @@ -3720,7 +3731,6 @@ async def test_purge_user_events_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = purge_config.PurgeUserEventsRequest() - assert args[0] == request_msg @@ -3747,7 +3757,6 @@ async def test_import_user_events_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_config.ImportUserEventsRequest() - assert args[0] == request_msg @@ -3774,7 +3783,6 @@ async def test_rejoin_user_events_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_event_service.RejoinUserEventsRequest() - assert args[0] == request_msg @@ -4793,7 +4801,6 @@ def test_write_user_event_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_event_service.WriteUserEventRequest() - assert args[0] == request_msg @@ -4815,7 +4822,6 @@ def test_collect_user_event_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_event_service.CollectUserEventRequest() - assert args[0] == request_msg @@ -4837,7 +4843,6 @@ def test_purge_user_events_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = purge_config.PurgeUserEventsRequest() - assert args[0] == request_msg @@ -4859,7 +4864,6 @@ def test_import_user_events_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_config.ImportUserEventsRequest() - assert args[0] == request_msg @@ -4881,7 +4885,6 @@ def test_rejoin_user_events_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_event_service.RejoinUserEventsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_analytics_service.py b/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_analytics_service.py index 5ec4a9aa5525..d6ac56d44223 100644 --- a/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_analytics_service.py +++ b/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_analytics_service.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" @@ -1345,8 +1361,8 @@ def test_analytics_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - export_config.ExportAnalyticsMetricsRequest, - dict, + export_config.ExportAnalyticsMetricsRequest(), + {}, ], ) def test_export_analytics_metrics(request_type, transport: str = "grpc"): @@ -1357,7 +1373,7 @@ def test_export_analytics_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( @@ -1403,10 +1419,11 @@ def test_export_analytics_metrics_non_empty_request_with_auto_populated_field(): client.export_analytics_metrics(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == export_config.ExportAnalyticsMetricsRequest( + request_msg = export_config.ExportAnalyticsMetricsRequest( catalog="catalog_value", filter="filter_value", ) + assert args[0] == request_msg def test_export_analytics_metrics_use_cached_wrapped_rpc(): @@ -1502,9 +1519,15 @@ async def test_export_analytics_metrics_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + export_config.ExportAnalyticsMetricsRequest(), + {}, + ], +) async def test_export_analytics_metrics_async( - transport: str = "grpc_asyncio", - request_type=export_config.ExportAnalyticsMetricsRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1513,7 +1536,7 @@ async def test_export_analytics_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( @@ -1535,11 +1558,6 @@ async def test_export_analytics_metrics_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_export_analytics_metrics_async_from_dict(): - await test_export_analytics_metrics_async(request_type=dict) - - def test_export_analytics_metrics_field_headers(): client = AnalyticsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1865,7 +1883,6 @@ def test_export_analytics_metrics_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = export_config.ExportAnalyticsMetricsRequest() - assert args[0] == request_msg @@ -1906,7 +1923,6 @@ async def test_export_analytics_metrics_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = export_config.ExportAnalyticsMetricsRequest() - assert args[0] == request_msg @@ -2199,7 +2215,6 @@ def test_export_analytics_metrics_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = export_config.ExportAnalyticsMetricsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_branch_service.py b/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_branch_service.py index 32171a7514eb..f3919b3c4d48 100644 --- a/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_branch_service.py +++ b/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_branch_service.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 @@ -109,6 +110,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" @@ -1308,8 +1324,8 @@ def test_branch_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - branch_service.ListBranchesRequest, - dict, + branch_service.ListBranchesRequest(), + {}, ], ) def test_list_branches(request_type, transport: str = "grpc"): @@ -1320,7 +1336,7 @@ def test_list_branches(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_branches), "__call__") as call: @@ -1361,9 +1377,10 @@ def test_list_branches_non_empty_request_with_auto_populated_field(): client.list_branches(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == branch_service.ListBranchesRequest( + request_msg = branch_service.ListBranchesRequest( parent="parent_value", ) + assert args[0] == request_msg def test_list_branches_use_cached_wrapped_rpc(): @@ -1444,9 +1461,14 @@ async def test_list_branches_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_branches_async( - transport: str = "grpc_asyncio", request_type=branch_service.ListBranchesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + branch_service.ListBranchesRequest(), + {}, + ], +) +async def test_list_branches_async(request_type, transport: str = "grpc_asyncio"): client = BranchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1454,7 +1476,7 @@ async def test_list_branches_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_branches), "__call__") as call: @@ -1474,11 +1496,6 @@ async def test_list_branches_async( assert isinstance(response, branch_service.ListBranchesResponse) -@pytest.mark.asyncio -async def test_list_branches_async_from_dict(): - await test_list_branches_async(request_type=dict) - - def test_list_branches_field_headers(): client = BranchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1625,8 +1642,8 @@ async def test_list_branches_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - branch_service.GetBranchRequest, - dict, + branch_service.GetBranchRequest(), + {}, ], ) def test_get_branch(request_type, transport: str = "grpc"): @@ -1637,7 +1654,7 @@ def test_get_branch(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_branch), "__call__") as call: @@ -1685,9 +1702,10 @@ def test_get_branch_non_empty_request_with_auto_populated_field(): client.get_branch(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == branch_service.GetBranchRequest( + request_msg = branch_service.GetBranchRequest( name="name_value", ) + assert args[0] == request_msg def test_get_branch_use_cached_wrapped_rpc(): @@ -1766,9 +1784,14 @@ async def test_get_branch_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_branch_async( - transport: str = "grpc_asyncio", request_type=branch_service.GetBranchRequest -): +@pytest.mark.parametrize( + "request_type", + [ + branch_service.GetBranchRequest(), + {}, + ], +) +async def test_get_branch_async(request_type, transport: str = "grpc_asyncio"): client = BranchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1776,7 +1799,7 @@ async def test_get_branch_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_branch), "__call__") as call: @@ -1803,11 +1826,6 @@ async def test_get_branch_async( assert response.is_default is True -@pytest.mark.asyncio -async def test_get_branch_async_from_dict(): - await test_get_branch_async(request_type=dict) - - def test_get_branch_field_headers(): client = BranchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2432,7 +2450,6 @@ def test_list_branches_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = branch_service.ListBranchesRequest() - assert args[0] == request_msg @@ -2453,7 +2470,6 @@ def test_get_branch_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = branch_service.GetBranchRequest() - assert args[0] == request_msg @@ -2492,7 +2508,6 @@ async def test_list_branches_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = branch_service.ListBranchesRequest() - assert args[0] == request_msg @@ -2521,7 +2536,6 @@ async def test_get_branch_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = branch_service.GetBranchRequest() - assert args[0] == request_msg @@ -2954,7 +2968,6 @@ def test_list_branches_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = branch_service.ListBranchesRequest() - assert args[0] == request_msg @@ -2974,7 +2987,6 @@ def test_get_branch_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = branch_service.GetBranchRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_catalog_service.py b/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_catalog_service.py index b7c3790484d7..5401409bd0dc 100644 --- a/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_catalog_service.py +++ b/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_catalog_service.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 @@ -118,6 +119,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" @@ -1321,8 +1337,8 @@ def test_catalog_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - catalog_service.ListCatalogsRequest, - dict, + catalog_service.ListCatalogsRequest(), + {}, ], ) def test_list_catalogs(request_type, transport: str = "grpc"): @@ -1333,7 +1349,7 @@ def test_list_catalogs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_catalogs), "__call__") as call: @@ -1378,10 +1394,11 @@ def test_list_catalogs_non_empty_request_with_auto_populated_field(): client.list_catalogs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog_service.ListCatalogsRequest( + request_msg = catalog_service.ListCatalogsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_catalogs_use_cached_wrapped_rpc(): @@ -1462,9 +1479,14 @@ async def test_list_catalogs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_catalogs_async( - transport: str = "grpc_asyncio", request_type=catalog_service.ListCatalogsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + catalog_service.ListCatalogsRequest(), + {}, + ], +) +async def test_list_catalogs_async(request_type, transport: str = "grpc_asyncio"): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1472,7 +1494,7 @@ async def test_list_catalogs_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_catalogs), "__call__") as call: @@ -1495,11 +1517,6 @@ async def test_list_catalogs_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_catalogs_async_from_dict(): - await test_list_catalogs_async(request_type=dict) - - def test_list_catalogs_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1836,8 +1853,8 @@ async def test_list_catalogs_async_pages(): @pytest.mark.parametrize( "request_type", [ - catalog_service.UpdateCatalogRequest, - dict, + catalog_service.UpdateCatalogRequest(), + {}, ], ) def test_update_catalog(request_type, transport: str = "grpc"): @@ -1848,7 +1865,7 @@ def test_update_catalog(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_catalog), "__call__") as call: @@ -1892,7 +1909,8 @@ def test_update_catalog_non_empty_request_with_auto_populated_field(): client.update_catalog(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog_service.UpdateCatalogRequest() + request_msg = catalog_service.UpdateCatalogRequest() + assert args[0] == request_msg def test_update_catalog_use_cached_wrapped_rpc(): @@ -1973,9 +1991,14 @@ async def test_update_catalog_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_catalog_async( - transport: str = "grpc_asyncio", request_type=catalog_service.UpdateCatalogRequest -): +@pytest.mark.parametrize( + "request_type", + [ + catalog_service.UpdateCatalogRequest(), + {}, + ], +) +async def test_update_catalog_async(request_type, transport: str = "grpc_asyncio"): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1983,7 +2006,7 @@ async def test_update_catalog_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_catalog), "__call__") as call: @@ -2008,11 +2031,6 @@ async def test_update_catalog_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_update_catalog_async_from_dict(): - await test_update_catalog_async(request_type=dict) - - def test_update_catalog_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2165,8 +2183,8 @@ async def test_update_catalog_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - catalog_service.SetDefaultBranchRequest, - dict, + catalog_service.SetDefaultBranchRequest(), + {}, ], ) def test_set_default_branch(request_type, transport: str = "grpc"): @@ -2177,7 +2195,7 @@ def test_set_default_branch(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2224,11 +2242,12 @@ def test_set_default_branch_non_empty_request_with_auto_populated_field(): client.set_default_branch(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog_service.SetDefaultBranchRequest( + request_msg = catalog_service.SetDefaultBranchRequest( catalog="catalog_value", branch_id="branch_id_value", note="note_value", ) + assert args[0] == request_msg def test_set_default_branch_use_cached_wrapped_rpc(): @@ -2313,10 +2332,14 @@ async def test_set_default_branch_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_default_branch_async( - transport: str = "grpc_asyncio", - request_type=catalog_service.SetDefaultBranchRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + catalog_service.SetDefaultBranchRequest(), + {}, + ], +) +async def test_set_default_branch_async(request_type, transport: str = "grpc_asyncio"): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2324,7 +2347,7 @@ async def test_set_default_branch_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( @@ -2344,11 +2367,6 @@ async def test_set_default_branch_async( assert response is None -@pytest.mark.asyncio -async def test_set_default_branch_async_from_dict(): - await test_set_default_branch_async(request_type=dict) - - def test_set_default_branch_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2499,8 +2517,8 @@ async def test_set_default_branch_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - catalog_service.GetDefaultBranchRequest, - dict, + catalog_service.GetDefaultBranchRequest(), + {}, ], ) def test_get_default_branch(request_type, transport: str = "grpc"): @@ -2511,7 +2529,7 @@ def test_get_default_branch(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2561,9 +2579,10 @@ def test_get_default_branch_non_empty_request_with_auto_populated_field(): client.get_default_branch(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog_service.GetDefaultBranchRequest( + request_msg = catalog_service.GetDefaultBranchRequest( catalog="catalog_value", ) + assert args[0] == request_msg def test_get_default_branch_use_cached_wrapped_rpc(): @@ -2648,10 +2667,14 @@ async def test_get_default_branch_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_default_branch_async( - transport: str = "grpc_asyncio", - request_type=catalog_service.GetDefaultBranchRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + catalog_service.GetDefaultBranchRequest(), + {}, + ], +) +async def test_get_default_branch_async(request_type, transport: str = "grpc_asyncio"): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2659,7 +2682,7 @@ async def test_get_default_branch_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( @@ -2686,11 +2709,6 @@ async def test_get_default_branch_async( assert response.note == "note_value" -@pytest.mark.asyncio -async def test_get_default_branch_async_from_dict(): - await test_get_default_branch_async(request_type=dict) - - def test_get_default_branch_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2845,8 +2863,8 @@ async def test_get_default_branch_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - catalog_service.GetCompletionConfigRequest, - dict, + catalog_service.GetCompletionConfigRequest(), + {}, ], ) def test_get_completion_config(request_type, transport: str = "grpc"): @@ -2857,7 +2875,7 @@ def test_get_completion_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( @@ -2928,9 +2946,10 @@ def test_get_completion_config_non_empty_request_with_auto_populated_field(): client.get_completion_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog_service.GetCompletionConfigRequest( + request_msg = catalog_service.GetCompletionConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_completion_config_use_cached_wrapped_rpc(): @@ -3016,9 +3035,15 @@ async def test_get_completion_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + catalog_service.GetCompletionConfigRequest(), + {}, + ], +) async def test_get_completion_config_async( - transport: str = "grpc_asyncio", - request_type=catalog_service.GetCompletionConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3027,7 +3052,7 @@ async def test_get_completion_config_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( @@ -3075,11 +3100,6 @@ async def test_get_completion_config_async( ) -@pytest.mark.asyncio -async def test_get_completion_config_async_from_dict(): - await test_get_completion_config_async(request_type=dict) - - def test_get_completion_config_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3234,8 +3254,8 @@ async def test_get_completion_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - catalog_service.UpdateCompletionConfigRequest, - dict, + catalog_service.UpdateCompletionConfigRequest(), + {}, ], ) def test_update_completion_config(request_type, transport: str = "grpc"): @@ -3246,7 +3266,7 @@ def test_update_completion_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( @@ -3315,7 +3335,8 @@ def test_update_completion_config_non_empty_request_with_auto_populated_field(): client.update_completion_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog_service.UpdateCompletionConfigRequest() + request_msg = catalog_service.UpdateCompletionConfigRequest() + assert args[0] == request_msg def test_update_completion_config_use_cached_wrapped_rpc(): @@ -3401,9 +3422,15 @@ async def test_update_completion_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + catalog_service.UpdateCompletionConfigRequest(), + {}, + ], +) async def test_update_completion_config_async( - transport: str = "grpc_asyncio", - request_type=catalog_service.UpdateCompletionConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3412,7 +3439,7 @@ async def test_update_completion_config_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( @@ -3460,11 +3487,6 @@ async def test_update_completion_config_async( ) -@pytest.mark.asyncio -async def test_update_completion_config_async_from_dict(): - await test_update_completion_config_async(request_type=dict) - - def test_update_completion_config_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3629,8 +3651,8 @@ async def test_update_completion_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - catalog_service.GetAttributesConfigRequest, - dict, + catalog_service.GetAttributesConfigRequest(), + {}, ], ) def test_get_attributes_config(request_type, transport: str = "grpc"): @@ -3641,7 +3663,7 @@ def test_get_attributes_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( @@ -3694,9 +3716,10 @@ def test_get_attributes_config_non_empty_request_with_auto_populated_field(): client.get_attributes_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog_service.GetAttributesConfigRequest( + request_msg = catalog_service.GetAttributesConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_attributes_config_use_cached_wrapped_rpc(): @@ -3782,9 +3805,15 @@ async def test_get_attributes_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + catalog_service.GetAttributesConfigRequest(), + {}, + ], +) async def test_get_attributes_config_async( - transport: str = "grpc_asyncio", - request_type=catalog_service.GetAttributesConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3793,7 +3822,7 @@ async def test_get_attributes_config_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( @@ -3823,11 +3852,6 @@ async def test_get_attributes_config_async( ) -@pytest.mark.asyncio -async def test_get_attributes_config_async_from_dict(): - await test_get_attributes_config_async(request_type=dict) - - def test_get_attributes_config_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3982,8 +4006,8 @@ async def test_get_attributes_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - catalog_service.UpdateAttributesConfigRequest, - dict, + catalog_service.UpdateAttributesConfigRequest(), + {}, ], ) def test_update_attributes_config(request_type, transport: str = "grpc"): @@ -3994,7 +4018,7 @@ def test_update_attributes_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( @@ -4045,7 +4069,8 @@ def test_update_attributes_config_non_empty_request_with_auto_populated_field(): client.update_attributes_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog_service.UpdateAttributesConfigRequest() + request_msg = catalog_service.UpdateAttributesConfigRequest() + assert args[0] == request_msg def test_update_attributes_config_use_cached_wrapped_rpc(): @@ -4131,9 +4156,15 @@ async def test_update_attributes_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + catalog_service.UpdateAttributesConfigRequest(), + {}, + ], +) async def test_update_attributes_config_async( - transport: str = "grpc_asyncio", - request_type=catalog_service.UpdateAttributesConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4142,7 +4173,7 @@ async def test_update_attributes_config_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( @@ -4172,11 +4203,6 @@ async def test_update_attributes_config_async( ) -@pytest.mark.asyncio -async def test_update_attributes_config_async_from_dict(): - await test_update_attributes_config_async(request_type=dict) - - def test_update_attributes_config_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4341,8 +4367,8 @@ async def test_update_attributes_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - catalog_service.AddCatalogAttributeRequest, - dict, + catalog_service.AddCatalogAttributeRequest(), + {}, ], ) def test_add_catalog_attribute(request_type, transport: str = "grpc"): @@ -4353,7 +4379,7 @@ def test_add_catalog_attribute(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,9 +4432,10 @@ def test_add_catalog_attribute_non_empty_request_with_auto_populated_field(): client.add_catalog_attribute(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog_service.AddCatalogAttributeRequest( + request_msg = catalog_service.AddCatalogAttributeRequest( attributes_config="attributes_config_value", ) + assert args[0] == request_msg def test_add_catalog_attribute_use_cached_wrapped_rpc(): @@ -4494,9 +4521,15 @@ async def test_add_catalog_attribute_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + catalog_service.AddCatalogAttributeRequest(), + {}, + ], +) async def test_add_catalog_attribute_async( - transport: str = "grpc_asyncio", - request_type=catalog_service.AddCatalogAttributeRequest, + request_type, transport: str = "grpc_asyncio" ): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4505,7 +4538,7 @@ async def test_add_catalog_attribute_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( @@ -4535,11 +4568,6 @@ async def test_add_catalog_attribute_async( ) -@pytest.mark.asyncio -async def test_add_catalog_attribute_async_from_dict(): - await test_add_catalog_attribute_async(request_type=dict) - - def test_add_catalog_attribute_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4608,8 +4636,8 @@ async def test_add_catalog_attribute_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - catalog_service.RemoveCatalogAttributeRequest, - dict, + catalog_service.RemoveCatalogAttributeRequest(), + {}, ], ) def test_remove_catalog_attribute(request_type, transport: str = "grpc"): @@ -4620,7 +4648,7 @@ def test_remove_catalog_attribute(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4674,10 +4702,11 @@ def test_remove_catalog_attribute_non_empty_request_with_auto_populated_field(): client.remove_catalog_attribute(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog_service.RemoveCatalogAttributeRequest( + request_msg = catalog_service.RemoveCatalogAttributeRequest( attributes_config="attributes_config_value", key="key_value", ) + assert args[0] == request_msg def test_remove_catalog_attribute_use_cached_wrapped_rpc(): @@ -4763,9 +4792,15 @@ async def test_remove_catalog_attribute_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + catalog_service.RemoveCatalogAttributeRequest(), + {}, + ], +) async def test_remove_catalog_attribute_async( - transport: str = "grpc_asyncio", - request_type=catalog_service.RemoveCatalogAttributeRequest, + request_type, transport: str = "grpc_asyncio" ): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4774,7 +4809,7 @@ async def test_remove_catalog_attribute_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( @@ -4804,11 +4839,6 @@ async def test_remove_catalog_attribute_async( ) -@pytest.mark.asyncio -async def test_remove_catalog_attribute_async_from_dict(): - await test_remove_catalog_attribute_async(request_type=dict) - - def test_remove_catalog_attribute_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4877,8 +4907,8 @@ async def test_remove_catalog_attribute_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - catalog_service.BatchRemoveCatalogAttributesRequest, - dict, + catalog_service.BatchRemoveCatalogAttributesRequest(), + {}, ], ) def test_batch_remove_catalog_attributes(request_type, transport: str = "grpc"): @@ -4889,7 +4919,7 @@ def test_batch_remove_catalog_attributes(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4939,9 +4969,10 @@ def test_batch_remove_catalog_attributes_non_empty_request_with_auto_populated_f client.batch_remove_catalog_attributes(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog_service.BatchRemoveCatalogAttributesRequest( + request_msg = catalog_service.BatchRemoveCatalogAttributesRequest( attributes_config="attributes_config_value", ) + assert args[0] == request_msg def test_batch_remove_catalog_attributes_use_cached_wrapped_rpc(): @@ -5027,9 +5058,15 @@ async def test_batch_remove_catalog_attributes_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + catalog_service.BatchRemoveCatalogAttributesRequest(), + {}, + ], +) async def test_batch_remove_catalog_attributes_async( - transport: str = "grpc_asyncio", - request_type=catalog_service.BatchRemoveCatalogAttributesRequest, + request_type, transport: str = "grpc_asyncio" ): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5038,7 +5075,7 @@ async def test_batch_remove_catalog_attributes_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( @@ -5065,11 +5102,6 @@ async def test_batch_remove_catalog_attributes_async( assert response.reset_catalog_attributes == ["reset_catalog_attributes_value"] -@pytest.mark.asyncio -async def test_batch_remove_catalog_attributes_async_from_dict(): - await test_batch_remove_catalog_attributes_async(request_type=dict) - - def test_batch_remove_catalog_attributes_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5138,8 +5170,8 @@ async def test_batch_remove_catalog_attributes_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - catalog_service.ReplaceCatalogAttributeRequest, - dict, + catalog_service.ReplaceCatalogAttributeRequest(), + {}, ], ) def test_replace_catalog_attribute(request_type, transport: str = "grpc"): @@ -5150,7 +5182,7 @@ def test_replace_catalog_attribute(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5203,9 +5235,10 @@ def test_replace_catalog_attribute_non_empty_request_with_auto_populated_field() client.replace_catalog_attribute(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog_service.ReplaceCatalogAttributeRequest( + request_msg = catalog_service.ReplaceCatalogAttributeRequest( attributes_config="attributes_config_value", ) + assert args[0] == request_msg def test_replace_catalog_attribute_use_cached_wrapped_rpc(): @@ -5291,9 +5324,15 @@ async def test_replace_catalog_attribute_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + catalog_service.ReplaceCatalogAttributeRequest(), + {}, + ], +) async def test_replace_catalog_attribute_async( - transport: str = "grpc_asyncio", - request_type=catalog_service.ReplaceCatalogAttributeRequest, + request_type, transport: str = "grpc_asyncio" ): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5302,7 +5341,7 @@ async def test_replace_catalog_attribute_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( @@ -5332,11 +5371,6 @@ async def test_replace_catalog_attribute_async( ) -@pytest.mark.asyncio -async def test_replace_catalog_attribute_async_from_dict(): - await test_replace_catalog_attribute_async(request_type=dict) - - def test_replace_catalog_attribute_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7451,7 +7485,6 @@ def test_list_catalogs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.ListCatalogsRequest() - assert args[0] == request_msg @@ -7472,7 +7505,6 @@ def test_update_catalog_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.UpdateCatalogRequest() - assert args[0] == request_msg @@ -7495,7 +7527,6 @@ def test_set_default_branch_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.SetDefaultBranchRequest() - assert args[0] == request_msg @@ -7518,7 +7549,6 @@ def test_get_default_branch_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.GetDefaultBranchRequest() - assert args[0] == request_msg @@ -7541,7 +7571,6 @@ def test_get_completion_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.GetCompletionConfigRequest() - assert args[0] == request_msg @@ -7564,7 +7593,6 @@ def test_update_completion_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.UpdateCompletionConfigRequest() - assert args[0] == request_msg @@ -7587,7 +7615,6 @@ def test_get_attributes_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.GetAttributesConfigRequest() - assert args[0] == request_msg @@ -7610,7 +7637,6 @@ def test_update_attributes_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.UpdateAttributesConfigRequest() - assert args[0] == request_msg @@ -7633,7 +7659,6 @@ def test_add_catalog_attribute_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.AddCatalogAttributeRequest() - assert args[0] == request_msg @@ -7656,7 +7681,6 @@ def test_remove_catalog_attribute_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.RemoveCatalogAttributeRequest() - assert args[0] == request_msg @@ -7679,7 +7703,6 @@ def test_batch_remove_catalog_attributes_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.BatchRemoveCatalogAttributesRequest() - assert args[0] == request_msg @@ -7702,7 +7725,6 @@ def test_replace_catalog_attribute_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.ReplaceCatalogAttributeRequest() - assert args[0] == request_msg @@ -7743,7 +7765,6 @@ async def test_list_catalogs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.ListCatalogsRequest() - assert args[0] == request_msg @@ -7771,7 +7792,6 @@ async def test_update_catalog_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.UpdateCatalogRequest() - assert args[0] == request_msg @@ -7796,7 +7816,6 @@ async def test_set_default_branch_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.SetDefaultBranchRequest() - assert args[0] == request_msg @@ -7826,7 +7845,6 @@ async def test_get_default_branch_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.GetDefaultBranchRequest() - assert args[0] == request_msg @@ -7862,7 +7880,6 @@ async def test_get_completion_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.GetCompletionConfigRequest() - assert args[0] == request_msg @@ -7898,7 +7915,6 @@ async def test_update_completion_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.UpdateCompletionConfigRequest() - assert args[0] == request_msg @@ -7928,7 +7944,6 @@ async def test_get_attributes_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.GetAttributesConfigRequest() - assert args[0] == request_msg @@ -7958,7 +7973,6 @@ async def test_update_attributes_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.UpdateAttributesConfigRequest() - assert args[0] == request_msg @@ -7988,7 +8002,6 @@ async def test_add_catalog_attribute_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.AddCatalogAttributeRequest() - assert args[0] == request_msg @@ -8018,7 +8031,6 @@ async def test_remove_catalog_attribute_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.RemoveCatalogAttributeRequest() - assert args[0] == request_msg @@ -8048,7 +8060,6 @@ async def test_batch_remove_catalog_attributes_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.BatchRemoveCatalogAttributesRequest() - assert args[0] == request_msg @@ -8078,7 +8089,6 @@ async def test_replace_catalog_attribute_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.ReplaceCatalogAttributeRequest() - assert args[0] == request_msg @@ -10191,7 +10201,6 @@ def test_list_catalogs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.ListCatalogsRequest() - assert args[0] == request_msg @@ -10211,7 +10220,6 @@ def test_update_catalog_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.UpdateCatalogRequest() - assert args[0] == request_msg @@ -10233,7 +10241,6 @@ def test_set_default_branch_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.SetDefaultBranchRequest() - assert args[0] == request_msg @@ -10255,7 +10262,6 @@ def test_get_default_branch_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.GetDefaultBranchRequest() - assert args[0] == request_msg @@ -10277,7 +10283,6 @@ def test_get_completion_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.GetCompletionConfigRequest() - assert args[0] == request_msg @@ -10299,7 +10304,6 @@ def test_update_completion_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.UpdateCompletionConfigRequest() - assert args[0] == request_msg @@ -10321,7 +10325,6 @@ def test_get_attributes_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.GetAttributesConfigRequest() - assert args[0] == request_msg @@ -10343,7 +10346,6 @@ def test_update_attributes_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.UpdateAttributesConfigRequest() - assert args[0] == request_msg @@ -10365,7 +10367,6 @@ def test_add_catalog_attribute_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.AddCatalogAttributeRequest() - assert args[0] == request_msg @@ -10387,7 +10388,6 @@ def test_remove_catalog_attribute_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.RemoveCatalogAttributeRequest() - assert args[0] == request_msg @@ -10409,7 +10409,6 @@ def test_batch_remove_catalog_attributes_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.BatchRemoveCatalogAttributesRequest() - assert args[0] == request_msg @@ -10431,7 +10430,6 @@ def test_replace_catalog_attribute_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.ReplaceCatalogAttributeRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_completion_service.py b/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_completion_service.py index 2d5a78f0a2dc..242b9497fb05 100644 --- a/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_completion_service.py +++ b/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_completion_service.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 @@ -113,6 +114,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" @@ -1354,8 +1370,8 @@ def test_completion_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - completion_service.CompleteQueryRequest, - dict, + completion_service.CompleteQueryRequest(), + {}, ], ) def test_complete_query(request_type, transport: str = "grpc"): @@ -1366,7 +1382,7 @@ def test_complete_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(type(client.transport.complete_query), "__call__") as call: @@ -1415,7 +1431,7 @@ def test_complete_query_non_empty_request_with_auto_populated_field(): client.complete_query(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == completion_service.CompleteQueryRequest( + request_msg = completion_service.CompleteQueryRequest( catalog="catalog_value", query="query_value", visitor_id="visitor_id_value", @@ -1423,6 +1439,7 @@ def test_complete_query_non_empty_request_with_auto_populated_field(): dataset="dataset_value", entity="entity_value", ) + assert args[0] == request_msg def test_complete_query_use_cached_wrapped_rpc(): @@ -1503,10 +1520,14 @@ async def test_complete_query_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_complete_query_async( - transport: str = "grpc_asyncio", - request_type=completion_service.CompleteQueryRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + completion_service.CompleteQueryRequest(), + {}, + ], +) +async def test_complete_query_async(request_type, transport: str = "grpc_asyncio"): client = CompletionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1514,7 +1535,7 @@ async def test_complete_query_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.complete_query), "__call__") as call: @@ -1537,11 +1558,6 @@ async def test_complete_query_async( assert response.attribution_token == "attribution_token_value" -@pytest.mark.asyncio -async def test_complete_query_async_from_dict(): - await test_complete_query_async(request_type=dict) - - def test_complete_query_field_headers(): client = CompletionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1606,8 +1622,8 @@ async def test_complete_query_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - import_config.ImportCompletionDataRequest, - dict, + import_config.ImportCompletionDataRequest(), + {}, ], ) def test_import_completion_data(request_type, transport: str = "grpc"): @@ -1618,7 +1634,7 @@ def test_import_completion_data(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1664,10 +1680,11 @@ def test_import_completion_data_non_empty_request_with_auto_populated_field(): client.import_completion_data(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == import_config.ImportCompletionDataRequest( + request_msg = import_config.ImportCompletionDataRequest( parent="parent_value", notification_pubsub_topic="notification_pubsub_topic_value", ) + assert args[0] == request_msg def test_import_completion_data_use_cached_wrapped_rpc(): @@ -1763,9 +1780,15 @@ async def test_import_completion_data_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + import_config.ImportCompletionDataRequest(), + {}, + ], +) async def test_import_completion_data_async( - transport: str = "grpc_asyncio", - request_type=import_config.ImportCompletionDataRequest, + request_type, transport: str = "grpc_asyncio" ): client = CompletionServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1774,7 +1797,7 @@ async def test_import_completion_data_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( @@ -1796,11 +1819,6 @@ async def test_import_completion_data_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_import_completion_data_async_from_dict(): - await test_import_completion_data_async(request_type=dict) - - def test_import_completion_data_field_headers(): client = CompletionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2289,7 +2307,6 @@ def test_complete_query_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = completion_service.CompleteQueryRequest() - assert args[0] == request_msg @@ -2312,7 +2329,6 @@ def test_import_completion_data_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_config.ImportCompletionDataRequest() - assert args[0] == request_msg @@ -2353,7 +2369,6 @@ async def test_complete_query_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = completion_service.CompleteQueryRequest() - assert args[0] == request_msg @@ -2380,7 +2395,6 @@ async def test_import_completion_data_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_config.ImportCompletionDataRequest() - assert args[0] == request_msg @@ -2807,7 +2821,6 @@ def test_complete_query_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = completion_service.CompleteQueryRequest() - assert args[0] == request_msg @@ -2829,7 +2842,6 @@ def test_import_completion_data_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_config.ImportCompletionDataRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_control_service.py b/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_control_service.py index 51ace5fd8df0..f1d9bf2ad515 100644 --- a/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_control_service.py +++ b/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_control_service.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 @@ -117,6 +118,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" @@ -1320,8 +1336,8 @@ def test_control_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - control_service.CreateControlRequest, - dict, + control_service.CreateControlRequest(), + {}, ], ) def test_create_control(request_type, transport: str = "grpc"): @@ -1332,7 +1348,7 @@ def test_create_control(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_control), "__call__") as call: @@ -1391,10 +1407,11 @@ def test_create_control_non_empty_request_with_auto_populated_field(): client.create_control(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == control_service.CreateControlRequest( + request_msg = control_service.CreateControlRequest( parent="parent_value", control_id="control_id_value", ) + assert args[0] == request_msg def test_create_control_use_cached_wrapped_rpc(): @@ -1475,9 +1492,14 @@ async def test_create_control_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_control_async( - transport: str = "grpc_asyncio", request_type=control_service.CreateControlRequest -): +@pytest.mark.parametrize( + "request_type", + [ + control_service.CreateControlRequest(), + {}, + ], +) +async def test_create_control_async(request_type, transport: str = "grpc_asyncio"): client = ControlServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1485,7 +1507,7 @@ async def test_create_control_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_control), "__call__") as call: @@ -1522,11 +1544,6 @@ async def test_create_control_async( ] -@pytest.mark.asyncio -async def test_create_control_async_from_dict(): - await test_create_control_async(request_type=dict) - - def test_create_control_field_headers(): client = ControlServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1725,8 +1742,8 @@ async def test_create_control_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - control_service.DeleteControlRequest, - dict, + control_service.DeleteControlRequest(), + {}, ], ) def test_delete_control(request_type, transport: str = "grpc"): @@ -1737,7 +1754,7 @@ def test_delete_control(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_control), "__call__") as call: @@ -1778,9 +1795,10 @@ def test_delete_control_non_empty_request_with_auto_populated_field(): client.delete_control(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == control_service.DeleteControlRequest( + request_msg = control_service.DeleteControlRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_control_use_cached_wrapped_rpc(): @@ -1861,9 +1879,14 @@ async def test_delete_control_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_control_async( - transport: str = "grpc_asyncio", request_type=control_service.DeleteControlRequest -): +@pytest.mark.parametrize( + "request_type", + [ + control_service.DeleteControlRequest(), + {}, + ], +) +async def test_delete_control_async(request_type, transport: str = "grpc_asyncio"): client = ControlServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1871,7 +1894,7 @@ async def test_delete_control_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_control), "__call__") as call: @@ -1889,11 +1912,6 @@ async def test_delete_control_async( assert response is None -@pytest.mark.asyncio -async def test_delete_control_async_from_dict(): - await test_delete_control_async(request_type=dict) - - def test_delete_control_field_headers(): client = ControlServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2036,8 +2054,8 @@ async def test_delete_control_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - control_service.UpdateControlRequest, - dict, + control_service.UpdateControlRequest(), + {}, ], ) def test_update_control(request_type, transport: str = "grpc"): @@ -2048,7 +2066,7 @@ def test_update_control(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_control), "__call__") as call: @@ -2104,7 +2122,8 @@ def test_update_control_non_empty_request_with_auto_populated_field(): client.update_control(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == control_service.UpdateControlRequest() + request_msg = control_service.UpdateControlRequest() + assert args[0] == request_msg def test_update_control_use_cached_wrapped_rpc(): @@ -2185,9 +2204,14 @@ async def test_update_control_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_control_async( - transport: str = "grpc_asyncio", request_type=control_service.UpdateControlRequest -): +@pytest.mark.parametrize( + "request_type", + [ + control_service.UpdateControlRequest(), + {}, + ], +) +async def test_update_control_async(request_type, transport: str = "grpc_asyncio"): client = ControlServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2195,7 +2219,7 @@ async def test_update_control_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_control), "__call__") as call: @@ -2232,11 +2256,6 @@ async def test_update_control_async( ] -@pytest.mark.asyncio -async def test_update_control_async_from_dict(): - await test_update_control_async(request_type=dict) - - def test_update_control_field_headers(): client = ControlServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2425,8 +2444,8 @@ async def test_update_control_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - control_service.GetControlRequest, - dict, + control_service.GetControlRequest(), + {}, ], ) def test_get_control(request_type, transport: str = "grpc"): @@ -2437,7 +2456,7 @@ def test_get_control(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_control), "__call__") as call: @@ -2495,9 +2514,10 @@ def test_get_control_non_empty_request_with_auto_populated_field(): client.get_control(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == control_service.GetControlRequest( + request_msg = control_service.GetControlRequest( name="name_value", ) + assert args[0] == request_msg def test_get_control_use_cached_wrapped_rpc(): @@ -2578,9 +2598,14 @@ async def test_get_control_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_control_async( - transport: str = "grpc_asyncio", request_type=control_service.GetControlRequest -): +@pytest.mark.parametrize( + "request_type", + [ + control_service.GetControlRequest(), + {}, + ], +) +async def test_get_control_async(request_type, transport: str = "grpc_asyncio"): client = ControlServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2588,7 +2613,7 @@ async def test_get_control_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_control), "__call__") as call: @@ -2625,11 +2650,6 @@ async def test_get_control_async( ] -@pytest.mark.asyncio -async def test_get_control_async_from_dict(): - await test_get_control_async(request_type=dict) - - def test_get_control_field_headers(): client = ControlServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2772,8 +2792,8 @@ async def test_get_control_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - control_service.ListControlsRequest, - dict, + control_service.ListControlsRequest(), + {}, ], ) def test_list_controls(request_type, transport: str = "grpc"): @@ -2784,7 +2804,7 @@ def test_list_controls(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_controls), "__call__") as call: @@ -2830,11 +2850,12 @@ def test_list_controls_non_empty_request_with_auto_populated_field(): client.list_controls(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == control_service.ListControlsRequest( + request_msg = control_service.ListControlsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_controls_use_cached_wrapped_rpc(): @@ -2915,9 +2936,14 @@ async def test_list_controls_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_controls_async( - transport: str = "grpc_asyncio", request_type=control_service.ListControlsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + control_service.ListControlsRequest(), + {}, + ], +) +async def test_list_controls_async(request_type, transport: str = "grpc_asyncio"): client = ControlServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2925,7 +2951,7 @@ async def test_list_controls_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_controls), "__call__") as call: @@ -2948,11 +2974,6 @@ async def test_list_controls_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_controls_async_from_dict(): - await test_list_controls_async(request_type=dict) - - def test_list_controls_field_headers(): client = ControlServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4441,7 +4462,6 @@ def test_create_control_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.CreateControlRequest() - assert args[0] == request_msg @@ -4462,7 +4482,6 @@ def test_delete_control_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.DeleteControlRequest() - assert args[0] == request_msg @@ -4483,7 +4502,6 @@ def test_update_control_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.UpdateControlRequest() - assert args[0] == request_msg @@ -4504,7 +4522,6 @@ def test_get_control_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.GetControlRequest() - assert args[0] == request_msg @@ -4525,7 +4542,6 @@ def test_list_controls_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.ListControlsRequest() - assert args[0] == request_msg @@ -4572,7 +4588,6 @@ async def test_create_control_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.CreateControlRequest() - assert args[0] == request_msg @@ -4595,7 +4610,6 @@ async def test_delete_control_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.DeleteControlRequest() - assert args[0] == request_msg @@ -4628,7 +4642,6 @@ async def test_update_control_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.UpdateControlRequest() - assert args[0] == request_msg @@ -4661,7 +4674,6 @@ async def test_get_control_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.GetControlRequest() - assert args[0] == request_msg @@ -4688,7 +4700,6 @@ async def test_list_controls_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.ListControlsRequest() - assert args[0] == request_msg @@ -5854,7 +5865,6 @@ def test_create_control_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.CreateControlRequest() - assert args[0] == request_msg @@ -5874,7 +5884,6 @@ def test_delete_control_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.DeleteControlRequest() - assert args[0] == request_msg @@ -5894,7 +5903,6 @@ def test_update_control_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.UpdateControlRequest() - assert args[0] == request_msg @@ -5914,7 +5922,6 @@ def test_get_control_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.GetControlRequest() - assert args[0] == request_msg @@ -5934,7 +5941,6 @@ def test_list_controls_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.ListControlsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_conversational_search_service.py b/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_conversational_search_service.py index 1c13e4a9f211..bd0c4c59547c 100644 --- a/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_conversational_search_service.py +++ b/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_conversational_search_service.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 @@ -113,6 +114,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" @@ -1419,8 +1435,8 @@ def test_conversational_search_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - conversational_search_service.ConversationalSearchRequest, - dict, + conversational_search_service.ConversationalSearchRequest(), + {}, ], ) def test_conversational_search(request_type, transport: str = "grpc"): @@ -1431,7 +1447,7 @@ def test_conversational_search(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1485,13 +1501,14 @@ def test_conversational_search_non_empty_request_with_auto_populated_field(): client.conversational_search(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversational_search_service.ConversationalSearchRequest( + request_msg = conversational_search_service.ConversationalSearchRequest( placement="placement_value", branch="branch_value", query="query_value", conversation_id="conversation_id_value", visitor_id="visitor_id_value", ) + assert args[0] == request_msg def test_conversational_search_use_cached_wrapped_rpc(): @@ -1577,9 +1594,15 @@ async def test_conversational_search_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + conversational_search_service.ConversationalSearchRequest(), + {}, + ], +) async def test_conversational_search_async( - transport: str = "grpc_asyncio", - request_type=conversational_search_service.ConversationalSearchRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConversationalSearchServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1588,7 +1611,7 @@ async def test_conversational_search_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( @@ -1614,11 +1637,6 @@ async def test_conversational_search_async( ) -@pytest.mark.asyncio -async def test_conversational_search_async_from_dict(): - await test_conversational_search_async(request_type=dict) - - def test_conversational_search_field_headers(): client = ConversationalSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1964,7 +1982,6 @@ def test_conversational_search_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.ConversationalSearchRequest() - assert args[0] == request_msg @@ -2006,7 +2023,6 @@ async def test_conversational_search_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.ConversationalSearchRequest() - assert args[0] == request_msg @@ -2334,7 +2350,6 @@ def test_conversational_search_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.ConversationalSearchRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_generative_question_service.py b/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_generative_question_service.py index 3d87f41d8ba6..7a88ac555490 100644 --- a/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_generative_question_service.py +++ b/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_generative_question_service.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" @@ -1394,8 +1410,8 @@ def test_generative_question_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - generative_question_service.UpdateGenerativeQuestionsFeatureConfigRequest, - dict, + generative_question_service.UpdateGenerativeQuestionsFeatureConfigRequest(), + {}, ], ) def test_update_generative_questions_feature_config( @@ -1408,7 +1424,7 @@ def test_update_generative_questions_feature_config( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1462,10 +1478,10 @@ def test_update_generative_questions_feature_config_non_empty_request_with_auto_ client.update_generative_questions_feature_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert ( - args[0] - == generative_question_service.UpdateGenerativeQuestionsFeatureConfigRequest() + request_msg = ( + generative_question_service.UpdateGenerativeQuestionsFeatureConfigRequest() ) + assert args[0] == request_msg def test_update_generative_questions_feature_config_use_cached_wrapped_rpc(): @@ -1551,9 +1567,15 @@ async def test_update_generative_questions_feature_config_async_use_cached_wrapp @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + generative_question_service.UpdateGenerativeQuestionsFeatureConfigRequest(), + {}, + ], +) async def test_update_generative_questions_feature_config_async( - transport: str = "grpc_asyncio", - request_type=generative_question_service.UpdateGenerativeQuestionsFeatureConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = GenerativeQuestionServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1562,7 +1584,7 @@ async def test_update_generative_questions_feature_config_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( @@ -1593,11 +1615,6 @@ async def test_update_generative_questions_feature_config_async( assert response.minimum_products == 1743 -@pytest.mark.asyncio -async def test_update_generative_questions_feature_config_async_from_dict(): - await test_update_generative_questions_feature_config_async(request_type=dict) - - def test_update_generative_questions_feature_config_field_headers(): client = GenerativeQuestionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1778,8 +1795,8 @@ async def test_update_generative_questions_feature_config_flattened_error_async( @pytest.mark.parametrize( "request_type", [ - generative_question_service.GetGenerativeQuestionsFeatureConfigRequest, - dict, + generative_question_service.GetGenerativeQuestionsFeatureConfigRequest(), + {}, ], ) def test_get_generative_questions_feature_config(request_type, transport: str = "grpc"): @@ -1790,7 +1807,7 @@ def test_get_generative_questions_feature_config(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( @@ -1844,11 +1861,12 @@ def test_get_generative_questions_feature_config_non_empty_request_with_auto_pop client.get_generative_questions_feature_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == generative_question_service.GetGenerativeQuestionsFeatureConfigRequest( - catalog="catalog_value", + request_msg = ( + generative_question_service.GetGenerativeQuestionsFeatureConfigRequest( + catalog="catalog_value", + ) ) + assert args[0] == request_msg def test_get_generative_questions_feature_config_use_cached_wrapped_rpc(): @@ -1934,9 +1952,15 @@ async def test_get_generative_questions_feature_config_async_use_cached_wrapped_ @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + generative_question_service.GetGenerativeQuestionsFeatureConfigRequest(), + {}, + ], +) async def test_get_generative_questions_feature_config_async( - transport: str = "grpc_asyncio", - request_type=generative_question_service.GetGenerativeQuestionsFeatureConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = GenerativeQuestionServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1945,7 +1969,7 @@ async def test_get_generative_questions_feature_config_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( @@ -1976,11 +2000,6 @@ async def test_get_generative_questions_feature_config_async( assert response.minimum_products == 1743 -@pytest.mark.asyncio -async def test_get_generative_questions_feature_config_async_from_dict(): - await test_get_generative_questions_feature_config_async(request_type=dict) - - def test_get_generative_questions_feature_config_field_headers(): client = GenerativeQuestionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2135,8 +2154,8 @@ async def test_get_generative_questions_feature_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - generative_question_service.ListGenerativeQuestionConfigsRequest, - dict, + generative_question_service.ListGenerativeQuestionConfigsRequest(), + {}, ], ) def test_list_generative_question_configs(request_type, transport: str = "grpc"): @@ -2147,7 +2166,7 @@ def test_list_generative_question_configs(request_type, transport: str = "grpc") # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2196,11 +2215,10 @@ def test_list_generative_question_configs_non_empty_request_with_auto_populated_ client.list_generative_question_configs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == generative_question_service.ListGenerativeQuestionConfigsRequest( + request_msg = generative_question_service.ListGenerativeQuestionConfigsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_list_generative_question_configs_use_cached_wrapped_rpc(): @@ -2286,9 +2304,15 @@ async def test_list_generative_question_configs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + generative_question_service.ListGenerativeQuestionConfigsRequest(), + {}, + ], +) async def test_list_generative_question_configs_async( - transport: str = "grpc_asyncio", - request_type=generative_question_service.ListGenerativeQuestionConfigsRequest, + request_type, transport: str = "grpc_asyncio" ): client = GenerativeQuestionServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2297,7 +2321,7 @@ async def test_list_generative_question_configs_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( @@ -2321,11 +2345,6 @@ async def test_list_generative_question_configs_async( ) -@pytest.mark.asyncio -async def test_list_generative_question_configs_async_from_dict(): - await test_list_generative_question_configs_async(request_type=dict) - - def test_list_generative_question_configs_field_headers(): client = GenerativeQuestionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2486,8 +2505,8 @@ async def test_list_generative_question_configs_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - generative_question_service.UpdateGenerativeQuestionConfigRequest, - dict, + generative_question_service.UpdateGenerativeQuestionConfigRequest(), + {}, ], ) def test_update_generative_question_config(request_type, transport: str = "grpc"): @@ -2498,7 +2517,7 @@ def test_update_generative_question_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( @@ -2556,10 +2575,10 @@ def test_update_generative_question_config_non_empty_request_with_auto_populated client.update_generative_question_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert ( - args[0] - == generative_question_service.UpdateGenerativeQuestionConfigRequest() + request_msg = ( + generative_question_service.UpdateGenerativeQuestionConfigRequest() ) + assert args[0] == request_msg def test_update_generative_question_config_use_cached_wrapped_rpc(): @@ -2645,9 +2664,15 @@ async def test_update_generative_question_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + generative_question_service.UpdateGenerativeQuestionConfigRequest(), + {}, + ], +) async def test_update_generative_question_config_async( - transport: str = "grpc_asyncio", - request_type=generative_question_service.UpdateGenerativeQuestionConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = GenerativeQuestionServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2656,7 +2681,7 @@ async def test_update_generative_question_config_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( @@ -2693,11 +2718,6 @@ async def test_update_generative_question_config_async( assert response.allowed_in_conversation is True -@pytest.mark.asyncio -async def test_update_generative_question_config_async_from_dict(): - await test_update_generative_question_config_async(request_type=dict) - - def test_update_generative_question_config_field_headers(): client = GenerativeQuestionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2870,8 +2890,8 @@ async def test_update_generative_question_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - generative_question_service.BatchUpdateGenerativeQuestionConfigsRequest, - dict, + generative_question_service.BatchUpdateGenerativeQuestionConfigsRequest(), + {}, ], ) def test_batch_update_generative_question_configs( @@ -2884,7 +2904,7 @@ def test_batch_update_generative_question_configs( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2936,11 +2956,12 @@ def test_batch_update_generative_question_configs_non_empty_request_with_auto_po client.batch_update_generative_question_configs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == generative_question_service.BatchUpdateGenerativeQuestionConfigsRequest( - parent="parent_value", + request_msg = ( + generative_question_service.BatchUpdateGenerativeQuestionConfigsRequest( + parent="parent_value", + ) ) + assert args[0] == request_msg def test_batch_update_generative_question_configs_use_cached_wrapped_rpc(): @@ -3026,9 +3047,15 @@ async def test_batch_update_generative_question_configs_async_use_cached_wrapped @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + generative_question_service.BatchUpdateGenerativeQuestionConfigsRequest(), + {}, + ], +) async def test_batch_update_generative_question_configs_async( - transport: str = "grpc_asyncio", - request_type=generative_question_service.BatchUpdateGenerativeQuestionConfigsRequest, + request_type, transport: str = "grpc_asyncio" ): client = GenerativeQuestionServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3037,7 +3064,7 @@ async def test_batch_update_generative_question_configs_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( @@ -3064,11 +3091,6 @@ async def test_batch_update_generative_question_configs_async( ) -@pytest.mark.asyncio -async def test_batch_update_generative_question_configs_async_from_dict(): - await test_batch_update_generative_question_configs_async(request_type=dict) - - def test_batch_update_generative_question_configs_field_headers(): client = GenerativeQuestionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4412,7 +4434,6 @@ def test_update_generative_questions_feature_config_empty_call_grpc(): request_msg = ( generative_question_service.UpdateGenerativeQuestionsFeatureConfigRequest() ) - assert args[0] == request_msg @@ -4437,7 +4458,6 @@ def test_get_generative_questions_feature_config_empty_call_grpc(): request_msg = ( generative_question_service.GetGenerativeQuestionsFeatureConfigRequest() ) - assert args[0] == request_msg @@ -4462,7 +4482,6 @@ def test_list_generative_question_configs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generative_question_service.ListGenerativeQuestionConfigsRequest() - assert args[0] == request_msg @@ -4487,7 +4506,6 @@ def test_update_generative_question_config_empty_call_grpc(): request_msg = ( generative_question_service.UpdateGenerativeQuestionConfigRequest() ) - assert args[0] == request_msg @@ -4514,7 +4532,6 @@ def test_batch_update_generative_question_configs_empty_call_grpc(): request_msg = ( generative_question_service.BatchUpdateGenerativeQuestionConfigsRequest() ) - assert args[0] == request_msg @@ -4561,7 +4578,6 @@ async def test_update_generative_questions_feature_config_empty_call_grpc_asynci request_msg = ( generative_question_service.UpdateGenerativeQuestionsFeatureConfigRequest() ) - assert args[0] == request_msg @@ -4594,7 +4610,6 @@ async def test_get_generative_questions_feature_config_empty_call_grpc_asyncio() request_msg = ( generative_question_service.GetGenerativeQuestionsFeatureConfigRequest() ) - assert args[0] == request_msg @@ -4621,7 +4636,6 @@ async def test_list_generative_question_configs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generative_question_service.ListGenerativeQuestionConfigsRequest() - assert args[0] == request_msg @@ -4658,7 +4672,6 @@ async def test_update_generative_question_config_empty_call_grpc_asyncio(): request_msg = ( generative_question_service.UpdateGenerativeQuestionConfigRequest() ) - assert args[0] == request_msg @@ -4687,7 +4700,6 @@ async def test_batch_update_generative_question_configs_empty_call_grpc_asyncio( request_msg = ( generative_question_service.BatchUpdateGenerativeQuestionConfigsRequest() ) - assert args[0] == request_msg @@ -5779,7 +5791,6 @@ def test_update_generative_questions_feature_config_empty_call_rest(): request_msg = ( generative_question_service.UpdateGenerativeQuestionsFeatureConfigRequest() ) - assert args[0] == request_msg @@ -5803,7 +5814,6 @@ def test_get_generative_questions_feature_config_empty_call_rest(): request_msg = ( generative_question_service.GetGenerativeQuestionsFeatureConfigRequest() ) - assert args[0] == request_msg @@ -5825,7 +5835,6 @@ def test_list_generative_question_configs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generative_question_service.ListGenerativeQuestionConfigsRequest() - assert args[0] == request_msg @@ -5849,7 +5858,6 @@ def test_update_generative_question_config_empty_call_rest(): request_msg = ( generative_question_service.UpdateGenerativeQuestionConfigRequest() ) - assert args[0] == request_msg @@ -5873,7 +5881,6 @@ def test_batch_update_generative_question_configs_empty_call_rest(): request_msg = ( generative_question_service.BatchUpdateGenerativeQuestionConfigsRequest() ) - assert args[0] == request_msg diff --git a/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_merchant_center_account_link_service.py b/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_merchant_center_account_link_service.py index cece18c58023..4e912d36378b 100644 --- a/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_merchant_center_account_link_service.py +++ b/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_merchant_center_account_link_service.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 @@ -118,6 +119,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" @@ -1461,8 +1477,8 @@ def test_merchant_center_account_link_service_client_create_channel_credentials_ @pytest.mark.parametrize( "request_type", [ - merchant_center_account_link_service.ListMerchantCenterAccountLinksRequest, - dict, + merchant_center_account_link_service.ListMerchantCenterAccountLinksRequest(), + {}, ], ) def test_list_merchant_center_account_links(request_type, transport: str = "grpc"): @@ -1473,7 +1489,7 @@ def test_list_merchant_center_account_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( @@ -1525,11 +1541,12 @@ def test_list_merchant_center_account_links_non_empty_request_with_auto_populate client.list_merchant_center_account_links(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == merchant_center_account_link_service.ListMerchantCenterAccountLinksRequest( - parent="parent_value", + request_msg = ( + merchant_center_account_link_service.ListMerchantCenterAccountLinksRequest( + parent="parent_value", + ) ) + assert args[0] == request_msg def test_list_merchant_center_account_links_use_cached_wrapped_rpc(): @@ -1615,9 +1632,15 @@ async def test_list_merchant_center_account_links_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + merchant_center_account_link_service.ListMerchantCenterAccountLinksRequest(), + {}, + ], +) async def test_list_merchant_center_account_links_async( - transport: str = "grpc_asyncio", - request_type=merchant_center_account_link_service.ListMerchantCenterAccountLinksRequest, + request_type, transport: str = "grpc_asyncio" ): client = MerchantCenterAccountLinkServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1626,7 +1649,7 @@ async def test_list_merchant_center_account_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( @@ -1653,11 +1676,6 @@ async def test_list_merchant_center_account_links_async( ) -@pytest.mark.asyncio -async def test_list_merchant_center_account_links_async_from_dict(): - await test_list_merchant_center_account_links_async(request_type=dict) - - def test_list_merchant_center_account_links_field_headers(): client = MerchantCenterAccountLinkServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1816,8 +1834,8 @@ async def test_list_merchant_center_account_links_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - merchant_center_account_link_service.CreateMerchantCenterAccountLinkRequest, - dict, + merchant_center_account_link_service.CreateMerchantCenterAccountLinkRequest(), + {}, ], ) def test_create_merchant_center_account_link(request_type, transport: str = "grpc"): @@ -1828,7 +1846,7 @@ def test_create_merchant_center_account_link(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( @@ -1875,12 +1893,12 @@ def test_create_merchant_center_account_link_non_empty_request_with_auto_populat client.create_merchant_center_account_link(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert ( - args[0] - == merchant_center_account_link_service.CreateMerchantCenterAccountLinkRequest( + request_msg = ( + merchant_center_account_link_service.CreateMerchantCenterAccountLinkRequest( parent="parent_value", ) ) + assert args[0] == request_msg def test_create_merchant_center_account_link_use_cached_wrapped_rpc(): @@ -1976,9 +1994,15 @@ async def test_create_merchant_center_account_link_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + merchant_center_account_link_service.CreateMerchantCenterAccountLinkRequest(), + {}, + ], +) async def test_create_merchant_center_account_link_async( - transport: str = "grpc_asyncio", - request_type=merchant_center_account_link_service.CreateMerchantCenterAccountLinkRequest, + request_type, transport: str = "grpc_asyncio" ): client = MerchantCenterAccountLinkServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1987,7 +2011,7 @@ async def test_create_merchant_center_account_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( @@ -2009,11 +2033,6 @@ async def test_create_merchant_center_account_link_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_merchant_center_account_link_async_from_dict(): - await test_create_merchant_center_account_link_async(request_type=dict) - - def test_create_merchant_center_account_link_field_headers(): client = MerchantCenterAccountLinkServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2194,8 +2213,8 @@ async def test_create_merchant_center_account_link_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - merchant_center_account_link_service.DeleteMerchantCenterAccountLinkRequest, - dict, + merchant_center_account_link_service.DeleteMerchantCenterAccountLinkRequest(), + {}, ], ) def test_delete_merchant_center_account_link(request_type, transport: str = "grpc"): @@ -2206,7 +2225,7 @@ def test_delete_merchant_center_account_link(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( @@ -2253,12 +2272,12 @@ def test_delete_merchant_center_account_link_non_empty_request_with_auto_populat client.delete_merchant_center_account_link(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert ( - args[0] - == merchant_center_account_link_service.DeleteMerchantCenterAccountLinkRequest( + request_msg = ( + merchant_center_account_link_service.DeleteMerchantCenterAccountLinkRequest( name="name_value", ) ) + assert args[0] == request_msg def test_delete_merchant_center_account_link_use_cached_wrapped_rpc(): @@ -2344,9 +2363,15 @@ async def test_delete_merchant_center_account_link_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + merchant_center_account_link_service.DeleteMerchantCenterAccountLinkRequest(), + {}, + ], +) async def test_delete_merchant_center_account_link_async( - transport: str = "grpc_asyncio", - request_type=merchant_center_account_link_service.DeleteMerchantCenterAccountLinkRequest, + request_type, transport: str = "grpc_asyncio" ): client = MerchantCenterAccountLinkServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2355,7 +2380,7 @@ async def test_delete_merchant_center_account_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( @@ -2375,11 +2400,6 @@ async def test_delete_merchant_center_account_link_async( assert response is None -@pytest.mark.asyncio -async def test_delete_merchant_center_account_link_async_from_dict(): - await test_delete_merchant_center_account_link_async(request_type=dict) - - def test_delete_merchant_center_account_link_field_headers(): client = MerchantCenterAccountLinkServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3240,7 +3260,6 @@ def test_list_merchant_center_account_links_empty_call_grpc(): request_msg = ( merchant_center_account_link_service.ListMerchantCenterAccountLinksRequest() ) - assert args[0] == request_msg @@ -3263,7 +3282,6 @@ def test_create_merchant_center_account_link_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = merchant_center_account_link_service.CreateMerchantCenterAccountLinkRequest() - assert args[0] == request_msg @@ -3286,7 +3304,6 @@ def test_delete_merchant_center_account_link_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = merchant_center_account_link_service.DeleteMerchantCenterAccountLinkRequest() - assert args[0] == request_msg @@ -3329,7 +3346,6 @@ async def test_list_merchant_center_account_links_empty_call_grpc_asyncio(): request_msg = ( merchant_center_account_link_service.ListMerchantCenterAccountLinksRequest() ) - assert args[0] == request_msg @@ -3356,7 +3372,6 @@ async def test_create_merchant_center_account_link_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = merchant_center_account_link_service.CreateMerchantCenterAccountLinkRequest() - assert args[0] == request_msg @@ -3381,7 +3396,6 @@ async def test_delete_merchant_center_account_link_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = merchant_center_account_link_service.DeleteMerchantCenterAccountLinkRequest() - assert args[0] == request_msg @@ -4026,7 +4040,6 @@ def test_list_merchant_center_account_links_empty_call_rest(): request_msg = ( merchant_center_account_link_service.ListMerchantCenterAccountLinksRequest() ) - assert args[0] == request_msg @@ -4048,7 +4061,6 @@ def test_create_merchant_center_account_link_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = merchant_center_account_link_service.CreateMerchantCenterAccountLinkRequest() - assert args[0] == request_msg @@ -4070,7 +4082,6 @@ def test_delete_merchant_center_account_link_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = merchant_center_account_link_service.DeleteMerchantCenterAccountLinkRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_model_service.py b/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_model_service.py index 94f1e2867668..1b9754f38b98 100644 --- a/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_model_service.py +++ b/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_model_service.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 @@ -116,6 +117,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" @@ -1296,8 +1312,8 @@ def test_model_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - model_service.CreateModelRequest, - dict, + model_service.CreateModelRequest(), + {}, ], ) def test_create_model(request_type, transport: str = "grpc"): @@ -1308,7 +1324,7 @@ def test_create_model(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_model), "__call__") as call: @@ -1349,9 +1365,10 @@ def test_create_model_non_empty_request_with_auto_populated_field(): client.create_model(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == model_service.CreateModelRequest( + request_msg = model_service.CreateModelRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_model_use_cached_wrapped_rpc(): @@ -1442,9 +1459,14 @@ async def test_create_model_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_model_async( - transport: str = "grpc_asyncio", request_type=model_service.CreateModelRequest -): +@pytest.mark.parametrize( + "request_type", + [ + model_service.CreateModelRequest(), + {}, + ], +) +async def test_create_model_async(request_type, transport: str = "grpc_asyncio"): client = ModelServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1452,7 +1474,7 @@ async def test_create_model_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_model), "__call__") as call: @@ -1472,11 +1494,6 @@ async def test_create_model_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_model_async_from_dict(): - await test_create_model_async(request_type=dict) - - def test_create_model_field_headers(): client = ModelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1657,8 +1674,8 @@ async def test_create_model_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - model_service.GetModelRequest, - dict, + model_service.GetModelRequest(), + {}, ], ) def test_get_model(request_type, transport: str = "grpc"): @@ -1669,7 +1686,7 @@ def test_get_model(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_model), "__call__") as call: @@ -1737,9 +1754,10 @@ def test_get_model_non_empty_request_with_auto_populated_field(): client.get_model(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == model_service.GetModelRequest( + request_msg = model_service.GetModelRequest( name="name_value", ) + assert args[0] == request_msg def test_get_model_use_cached_wrapped_rpc(): @@ -1818,9 +1836,14 @@ async def test_get_model_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_model_async( - transport: str = "grpc_asyncio", request_type=model_service.GetModelRequest -): +@pytest.mark.parametrize( + "request_type", + [ + model_service.GetModelRequest(), + {}, + ], +) +async def test_get_model_async(request_type, transport: str = "grpc_asyncio"): client = ModelServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1828,7 +1851,7 @@ async def test_get_model_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_model), "__call__") as call: @@ -1875,11 +1898,6 @@ async def test_get_model_async( ) -@pytest.mark.asyncio -async def test_get_model_async_from_dict(): - await test_get_model_async(request_type=dict) - - def test_get_model_field_headers(): client = ModelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2022,8 +2040,8 @@ async def test_get_model_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - model_service.PauseModelRequest, - dict, + model_service.PauseModelRequest(), + {}, ], ) def test_pause_model(request_type, transport: str = "grpc"): @@ -2034,7 +2052,7 @@ def test_pause_model(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.pause_model), "__call__") as call: @@ -2102,9 +2120,10 @@ def test_pause_model_non_empty_request_with_auto_populated_field(): client.pause_model(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == model_service.PauseModelRequest( + request_msg = model_service.PauseModelRequest( name="name_value", ) + assert args[0] == request_msg def test_pause_model_use_cached_wrapped_rpc(): @@ -2185,9 +2204,14 @@ async def test_pause_model_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_pause_model_async( - transport: str = "grpc_asyncio", request_type=model_service.PauseModelRequest -): +@pytest.mark.parametrize( + "request_type", + [ + model_service.PauseModelRequest(), + {}, + ], +) +async def test_pause_model_async(request_type, transport: str = "grpc_asyncio"): client = ModelServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2195,7 +2219,7 @@ async def test_pause_model_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.pause_model), "__call__") as call: @@ -2242,11 +2266,6 @@ async def test_pause_model_async( ) -@pytest.mark.asyncio -async def test_pause_model_async_from_dict(): - await test_pause_model_async(request_type=dict) - - def test_pause_model_field_headers(): client = ModelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2389,8 +2408,8 @@ async def test_pause_model_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - model_service.ResumeModelRequest, - dict, + model_service.ResumeModelRequest(), + {}, ], ) def test_resume_model(request_type, transport: str = "grpc"): @@ -2401,7 +2420,7 @@ def test_resume_model(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.resume_model), "__call__") as call: @@ -2469,9 +2488,10 @@ def test_resume_model_non_empty_request_with_auto_populated_field(): client.resume_model(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == model_service.ResumeModelRequest( + request_msg = model_service.ResumeModelRequest( name="name_value", ) + assert args[0] == request_msg def test_resume_model_use_cached_wrapped_rpc(): @@ -2552,9 +2572,14 @@ async def test_resume_model_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_resume_model_async( - transport: str = "grpc_asyncio", request_type=model_service.ResumeModelRequest -): +@pytest.mark.parametrize( + "request_type", + [ + model_service.ResumeModelRequest(), + {}, + ], +) +async def test_resume_model_async(request_type, transport: str = "grpc_asyncio"): client = ModelServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2562,7 +2587,7 @@ async def test_resume_model_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.resume_model), "__call__") as call: @@ -2609,11 +2634,6 @@ async def test_resume_model_async( ) -@pytest.mark.asyncio -async def test_resume_model_async_from_dict(): - await test_resume_model_async(request_type=dict) - - def test_resume_model_field_headers(): client = ModelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2756,8 +2776,8 @@ async def test_resume_model_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - model_service.DeleteModelRequest, - dict, + model_service.DeleteModelRequest(), + {}, ], ) def test_delete_model(request_type, transport: str = "grpc"): @@ -2768,7 +2788,7 @@ def test_delete_model(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_model), "__call__") as call: @@ -2809,9 +2829,10 @@ def test_delete_model_non_empty_request_with_auto_populated_field(): client.delete_model(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == model_service.DeleteModelRequest( + request_msg = model_service.DeleteModelRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_model_use_cached_wrapped_rpc(): @@ -2892,9 +2913,14 @@ async def test_delete_model_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_model_async( - transport: str = "grpc_asyncio", request_type=model_service.DeleteModelRequest -): +@pytest.mark.parametrize( + "request_type", + [ + model_service.DeleteModelRequest(), + {}, + ], +) +async def test_delete_model_async(request_type, transport: str = "grpc_asyncio"): client = ModelServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2902,7 +2928,7 @@ async def test_delete_model_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_model), "__call__") as call: @@ -2920,11 +2946,6 @@ async def test_delete_model_async( assert response is None -@pytest.mark.asyncio -async def test_delete_model_async_from_dict(): - await test_delete_model_async(request_type=dict) - - def test_delete_model_field_headers(): client = ModelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3067,8 +3088,8 @@ async def test_delete_model_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - model_service.ListModelsRequest, - dict, + model_service.ListModelsRequest(), + {}, ], ) def test_list_models(request_type, transport: str = "grpc"): @@ -3079,7 +3100,7 @@ def test_list_models(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_models), "__call__") as call: @@ -3124,10 +3145,11 @@ def test_list_models_non_empty_request_with_auto_populated_field(): client.list_models(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == model_service.ListModelsRequest( + request_msg = model_service.ListModelsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_models_use_cached_wrapped_rpc(): @@ -3208,9 +3230,14 @@ async def test_list_models_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_models_async( - transport: str = "grpc_asyncio", request_type=model_service.ListModelsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + model_service.ListModelsRequest(), + {}, + ], +) +async def test_list_models_async(request_type, transport: str = "grpc_asyncio"): client = ModelServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3218,7 +3245,7 @@ async def test_list_models_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_models), "__call__") as call: @@ -3241,11 +3268,6 @@ async def test_list_models_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_models_async_from_dict(): - await test_list_models_async(request_type=dict) - - def test_list_models_field_headers(): client = ModelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3582,8 +3604,8 @@ async def test_list_models_async_pages(): @pytest.mark.parametrize( "request_type", [ - model_service.UpdateModelRequest, - dict, + model_service.UpdateModelRequest(), + {}, ], ) def test_update_model(request_type, transport: str = "grpc"): @@ -3594,7 +3616,7 @@ def test_update_model(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_model), "__call__") as call: @@ -3660,7 +3682,8 @@ def test_update_model_non_empty_request_with_auto_populated_field(): client.update_model(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == model_service.UpdateModelRequest() + request_msg = model_service.UpdateModelRequest() + assert args[0] == request_msg def test_update_model_use_cached_wrapped_rpc(): @@ -3741,9 +3764,14 @@ async def test_update_model_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_model_async( - transport: str = "grpc_asyncio", request_type=model_service.UpdateModelRequest -): +@pytest.mark.parametrize( + "request_type", + [ + model_service.UpdateModelRequest(), + {}, + ], +) +async def test_update_model_async(request_type, transport: str = "grpc_asyncio"): client = ModelServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3751,7 +3779,7 @@ async def test_update_model_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_model), "__call__") as call: @@ -3798,11 +3826,6 @@ async def test_update_model_async( ) -@pytest.mark.asyncio -async def test_update_model_async_from_dict(): - await test_update_model_async(request_type=dict) - - def test_update_model_field_headers(): client = ModelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3979,8 +4002,8 @@ async def test_update_model_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - model_service.TuneModelRequest, - dict, + model_service.TuneModelRequest(), + {}, ], ) def test_tune_model(request_type, transport: str = "grpc"): @@ -3991,7 +4014,7 @@ def test_tune_model(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.tune_model), "__call__") as call: @@ -4032,9 +4055,10 @@ def test_tune_model_non_empty_request_with_auto_populated_field(): client.tune_model(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == model_service.TuneModelRequest( + request_msg = model_service.TuneModelRequest( name="name_value", ) + assert args[0] == request_msg def test_tune_model_use_cached_wrapped_rpc(): @@ -4123,9 +4147,14 @@ async def test_tune_model_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_tune_model_async( - transport: str = "grpc_asyncio", request_type=model_service.TuneModelRequest -): +@pytest.mark.parametrize( + "request_type", + [ + model_service.TuneModelRequest(), + {}, + ], +) +async def test_tune_model_async(request_type, transport: str = "grpc_asyncio"): client = ModelServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4133,7 +4162,7 @@ async def test_tune_model_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.tune_model), "__call__") as call: @@ -4153,11 +4182,6 @@ async def test_tune_model_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_tune_model_async_from_dict(): - await test_tune_model_async(request_type=dict) - - def test_tune_model_field_headers(): client = ModelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5961,7 +5985,6 @@ def test_create_model_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.CreateModelRequest() - assert args[0] == request_msg @@ -5982,7 +6005,6 @@ def test_get_model_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.GetModelRequest() - assert args[0] == request_msg @@ -6003,7 +6025,6 @@ def test_pause_model_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.PauseModelRequest() - assert args[0] == request_msg @@ -6024,7 +6045,6 @@ def test_resume_model_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.ResumeModelRequest() - assert args[0] == request_msg @@ -6045,7 +6065,6 @@ def test_delete_model_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.DeleteModelRequest() - assert args[0] == request_msg @@ -6066,7 +6085,6 @@ def test_list_models_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.ListModelsRequest() - assert args[0] == request_msg @@ -6087,7 +6105,6 @@ def test_update_model_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.UpdateModelRequest() - assert args[0] == request_msg @@ -6108,7 +6125,6 @@ def test_tune_model_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.TuneModelRequest() - assert args[0] == request_msg @@ -6147,7 +6163,6 @@ async def test_create_model_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.CreateModelRequest() - assert args[0] == request_msg @@ -6183,7 +6198,6 @@ async def test_get_model_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.GetModelRequest() - assert args[0] == request_msg @@ -6219,7 +6233,6 @@ async def test_pause_model_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.PauseModelRequest() - assert args[0] == request_msg @@ -6255,7 +6268,6 @@ async def test_resume_model_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.ResumeModelRequest() - assert args[0] == request_msg @@ -6278,7 +6290,6 @@ async def test_delete_model_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.DeleteModelRequest() - assert args[0] == request_msg @@ -6305,7 +6316,6 @@ async def test_list_models_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.ListModelsRequest() - assert args[0] == request_msg @@ -6341,7 +6351,6 @@ async def test_update_model_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.UpdateModelRequest() - assert args[0] == request_msg @@ -6366,7 +6375,6 @@ async def test_tune_model_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.TuneModelRequest() - assert args[0] == request_msg @@ -7855,7 +7863,6 @@ def test_create_model_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.CreateModelRequest() - assert args[0] == request_msg @@ -7875,7 +7882,6 @@ def test_get_model_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.GetModelRequest() - assert args[0] == request_msg @@ -7895,7 +7901,6 @@ def test_pause_model_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.PauseModelRequest() - assert args[0] == request_msg @@ -7915,7 +7920,6 @@ def test_resume_model_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.ResumeModelRequest() - assert args[0] == request_msg @@ -7935,7 +7939,6 @@ def test_delete_model_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.DeleteModelRequest() - assert args[0] == request_msg @@ -7955,7 +7958,6 @@ def test_list_models_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.ListModelsRequest() - assert args[0] == request_msg @@ -7975,7 +7977,6 @@ def test_update_model_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.UpdateModelRequest() - assert args[0] == request_msg @@ -7995,7 +7996,6 @@ def test_tune_model_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.TuneModelRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_prediction_service.py b/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_prediction_service.py index 36bf9519ed85..9febcdffd5f6 100644 --- a/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_prediction_service.py +++ b/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_prediction_service.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 @@ -119,6 +120,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" @@ -1360,8 +1376,8 @@ def test_prediction_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - prediction_service.PredictRequest, - dict, + prediction_service.PredictRequest(), + {}, ], ) def test_predict(request_type, transport: str = "grpc"): @@ -1372,7 +1388,7 @@ def test_predict(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.predict), "__call__") as call: @@ -1422,11 +1438,12 @@ def test_predict_non_empty_request_with_auto_populated_field(): client.predict(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == prediction_service.PredictRequest( + request_msg = prediction_service.PredictRequest( placement="placement_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_predict_use_cached_wrapped_rpc(): @@ -1505,9 +1522,14 @@ async def test_predict_async_use_cached_wrapped_rpc(transport: str = "grpc_async @pytest.mark.asyncio -async def test_predict_async( - transport: str = "grpc_asyncio", request_type=prediction_service.PredictRequest -): +@pytest.mark.parametrize( + "request_type", + [ + prediction_service.PredictRequest(), + {}, + ], +) +async def test_predict_async(request_type, transport: str = "grpc_asyncio"): client = PredictionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1515,7 +1537,7 @@ async def test_predict_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.predict), "__call__") as call: @@ -1542,11 +1564,6 @@ async def test_predict_async( assert response.validate_only is True -@pytest.mark.asyncio -async def test_predict_async_from_dict(): - await test_predict_async(request_type=dict) - - def test_predict_field_headers(): client = PredictionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1858,7 +1875,6 @@ def test_predict_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = prediction_service.PredictRequest() - assert args[0] == request_msg @@ -1901,7 +1917,6 @@ async def test_predict_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = prediction_service.PredictRequest() - assert args[0] == request_msg @@ -2204,7 +2219,6 @@ def test_predict_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = prediction_service.PredictRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_product_service.py b/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_product_service.py index b629479a048b..eae9c4976b3b 100644 --- a/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_product_service.py +++ b/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_product_service.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 @@ -127,6 +128,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" @@ -1330,8 +1346,8 @@ def test_product_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - product_service.CreateProductRequest, - dict, + product_service.CreateProductRequest(), + {}, ], ) def test_create_product(request_type, transport: str = "grpc"): @@ -1342,7 +1358,7 @@ def test_create_product(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_product), "__call__") as call: @@ -1421,10 +1437,11 @@ def test_create_product_non_empty_request_with_auto_populated_field(): client.create_product(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_service.CreateProductRequest( + request_msg = product_service.CreateProductRequest( parent="parent_value", product_id="product_id_value", ) + assert args[0] == request_msg def test_create_product_use_cached_wrapped_rpc(): @@ -1505,9 +1522,14 @@ async def test_create_product_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_product_async( - transport: str = "grpc_asyncio", request_type=product_service.CreateProductRequest -): +@pytest.mark.parametrize( + "request_type", + [ + product_service.CreateProductRequest(), + {}, + ], +) +async def test_create_product_async(request_type, transport: str = "grpc_asyncio"): client = ProductServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1515,7 +1537,7 @@ async def test_create_product_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_product), "__call__") as call: @@ -1572,11 +1594,6 @@ async def test_create_product_async( assert response.conditions == ["conditions_value"] -@pytest.mark.asyncio -async def test_create_product_async_from_dict(): - await test_create_product_async(request_type=dict) - - def test_create_product_field_headers(): client = ProductServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1747,8 +1764,8 @@ async def test_create_product_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - product_service.GetProductRequest, - dict, + product_service.GetProductRequest(), + {}, ], ) def test_get_product(request_type, transport: str = "grpc"): @@ -1759,7 +1776,7 @@ def test_get_product(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_product), "__call__") as call: @@ -1837,9 +1854,10 @@ def test_get_product_non_empty_request_with_auto_populated_field(): client.get_product(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_service.GetProductRequest( + request_msg = product_service.GetProductRequest( name="name_value", ) + assert args[0] == request_msg def test_get_product_use_cached_wrapped_rpc(): @@ -1920,9 +1938,14 @@ async def test_get_product_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_product_async( - transport: str = "grpc_asyncio", request_type=product_service.GetProductRequest -): +@pytest.mark.parametrize( + "request_type", + [ + product_service.GetProductRequest(), + {}, + ], +) +async def test_get_product_async(request_type, transport: str = "grpc_asyncio"): client = ProductServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1930,7 +1953,7 @@ async def test_get_product_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_product), "__call__") as call: @@ -1987,11 +2010,6 @@ async def test_get_product_async( assert response.conditions == ["conditions_value"] -@pytest.mark.asyncio -async def test_get_product_async_from_dict(): - await test_get_product_async(request_type=dict) - - def test_get_product_field_headers(): client = ProductServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2134,8 +2152,8 @@ async def test_get_product_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - product_service.ListProductsRequest, - dict, + product_service.ListProductsRequest(), + {}, ], ) def test_list_products(request_type, transport: str = "grpc"): @@ -2146,7 +2164,7 @@ def test_list_products(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_products), "__call__") as call: @@ -2194,11 +2212,12 @@ def test_list_products_non_empty_request_with_auto_populated_field(): client.list_products(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_service.ListProductsRequest( + request_msg = product_service.ListProductsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_products_use_cached_wrapped_rpc(): @@ -2279,9 +2298,14 @@ async def test_list_products_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_products_async( - transport: str = "grpc_asyncio", request_type=product_service.ListProductsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + product_service.ListProductsRequest(), + {}, + ], +) +async def test_list_products_async(request_type, transport: str = "grpc_asyncio"): client = ProductServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2289,7 +2313,7 @@ async def test_list_products_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_products), "__call__") as call: @@ -2314,11 +2338,6 @@ async def test_list_products_async( assert response.total_size == 1086 -@pytest.mark.asyncio -async def test_list_products_async_from_dict(): - await test_list_products_async(request_type=dict) - - def test_list_products_field_headers(): client = ProductServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2655,8 +2674,8 @@ async def test_list_products_async_pages(): @pytest.mark.parametrize( "request_type", [ - product_service.UpdateProductRequest, - dict, + product_service.UpdateProductRequest(), + {}, ], ) def test_update_product(request_type, transport: str = "grpc"): @@ -2667,7 +2686,7 @@ def test_update_product(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_product), "__call__") as call: @@ -2743,7 +2762,8 @@ def test_update_product_non_empty_request_with_auto_populated_field(): client.update_product(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_service.UpdateProductRequest() + request_msg = product_service.UpdateProductRequest() + assert args[0] == request_msg def test_update_product_use_cached_wrapped_rpc(): @@ -2824,9 +2844,14 @@ async def test_update_product_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_product_async( - transport: str = "grpc_asyncio", request_type=product_service.UpdateProductRequest -): +@pytest.mark.parametrize( + "request_type", + [ + product_service.UpdateProductRequest(), + {}, + ], +) +async def test_update_product_async(request_type, transport: str = "grpc_asyncio"): client = ProductServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2834,7 +2859,7 @@ async def test_update_product_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_product), "__call__") as call: @@ -2891,11 +2916,6 @@ async def test_update_product_async( assert response.conditions == ["conditions_value"] -@pytest.mark.asyncio -async def test_update_product_async_from_dict(): - await test_update_product_async(request_type=dict) - - def test_update_product_field_headers(): client = ProductServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3056,8 +3076,8 @@ async def test_update_product_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - product_service.DeleteProductRequest, - dict, + product_service.DeleteProductRequest(), + {}, ], ) def test_delete_product(request_type, transport: str = "grpc"): @@ -3068,7 +3088,7 @@ def test_delete_product(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_product), "__call__") as call: @@ -3109,9 +3129,10 @@ def test_delete_product_non_empty_request_with_auto_populated_field(): client.delete_product(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_service.DeleteProductRequest( + request_msg = product_service.DeleteProductRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_product_use_cached_wrapped_rpc(): @@ -3192,9 +3213,14 @@ async def test_delete_product_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_product_async( - transport: str = "grpc_asyncio", request_type=product_service.DeleteProductRequest -): +@pytest.mark.parametrize( + "request_type", + [ + product_service.DeleteProductRequest(), + {}, + ], +) +async def test_delete_product_async(request_type, transport: str = "grpc_asyncio"): client = ProductServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3202,7 +3228,7 @@ async def test_delete_product_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_product), "__call__") as call: @@ -3220,11 +3246,6 @@ async def test_delete_product_async( assert response is None -@pytest.mark.asyncio -async def test_delete_product_async_from_dict(): - await test_delete_product_async(request_type=dict) - - def test_delete_product_field_headers(): client = ProductServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3367,8 +3388,8 @@ async def test_delete_product_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - purge_config.PurgeProductsRequest, - dict, + purge_config.PurgeProductsRequest(), + {}, ], ) def test_purge_products(request_type, transport: str = "grpc"): @@ -3379,7 +3400,7 @@ def test_purge_products(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.purge_products), "__call__") as call: @@ -3421,10 +3442,11 @@ def test_purge_products_non_empty_request_with_auto_populated_field(): client.purge_products(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == purge_config.PurgeProductsRequest( + request_msg = purge_config.PurgeProductsRequest( parent="parent_value", filter="filter_value", ) + assert args[0] == request_msg def test_purge_products_use_cached_wrapped_rpc(): @@ -3515,9 +3537,14 @@ async def test_purge_products_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_purge_products_async( - transport: str = "grpc_asyncio", request_type=purge_config.PurgeProductsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + purge_config.PurgeProductsRequest(), + {}, + ], +) +async def test_purge_products_async(request_type, transport: str = "grpc_asyncio"): client = ProductServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3525,7 +3552,7 @@ async def test_purge_products_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.purge_products), "__call__") as call: @@ -3545,11 +3572,6 @@ async def test_purge_products_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_purge_products_async_from_dict(): - await test_purge_products_async(request_type=dict) - - def test_purge_products_field_headers(): client = ProductServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3614,8 +3636,8 @@ async def test_purge_products_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - import_config.ImportProductsRequest, - dict, + import_config.ImportProductsRequest(), + {}, ], ) def test_import_products(request_type, transport: str = "grpc"): @@ -3626,7 +3648,7 @@ def test_import_products(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.import_products), "__call__") as call: @@ -3669,11 +3691,12 @@ def test_import_products_non_empty_request_with_auto_populated_field(): client.import_products(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == import_config.ImportProductsRequest( + request_msg = import_config.ImportProductsRequest( parent="parent_value", request_id="request_id_value", notification_pubsub_topic="notification_pubsub_topic_value", ) + assert args[0] == request_msg def test_import_products_use_cached_wrapped_rpc(): @@ -3764,9 +3787,14 @@ async def test_import_products_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_import_products_async( - transport: str = "grpc_asyncio", request_type=import_config.ImportProductsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + import_config.ImportProductsRequest(), + {}, + ], +) +async def test_import_products_async(request_type, transport: str = "grpc_asyncio"): client = ProductServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3774,7 +3802,7 @@ async def test_import_products_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.import_products), "__call__") as call: @@ -3794,11 +3822,6 @@ async def test_import_products_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_import_products_async_from_dict(): - await test_import_products_async(request_type=dict) - - def test_import_products_field_headers(): client = ProductServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3863,8 +3886,8 @@ async def test_import_products_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - export_config.ExportProductsRequest, - dict, + export_config.ExportProductsRequest(), + {}, ], ) def test_export_products(request_type, transport: str = "grpc"): @@ -3875,7 +3898,7 @@ def test_export_products(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.export_products), "__call__") as call: @@ -3917,10 +3940,11 @@ def test_export_products_non_empty_request_with_auto_populated_field(): client.export_products(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == export_config.ExportProductsRequest( + request_msg = export_config.ExportProductsRequest( parent="parent_value", filter="filter_value", ) + assert args[0] == request_msg def test_export_products_use_cached_wrapped_rpc(): @@ -4011,9 +4035,14 @@ async def test_export_products_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_export_products_async( - transport: str = "grpc_asyncio", request_type=export_config.ExportProductsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + export_config.ExportProductsRequest(), + {}, + ], +) +async def test_export_products_async(request_type, transport: str = "grpc_asyncio"): client = ProductServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4021,7 +4050,7 @@ async def test_export_products_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.export_products), "__call__") as call: @@ -4041,11 +4070,6 @@ async def test_export_products_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_export_products_async_from_dict(): - await test_export_products_async(request_type=dict) - - def test_export_products_field_headers(): client = ProductServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4110,8 +4134,8 @@ async def test_export_products_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - product_service.SetInventoryRequest, - dict, + product_service.SetInventoryRequest(), + {}, ], ) def test_set_inventory(request_type, transport: str = "grpc"): @@ -4122,7 +4146,7 @@ def test_set_inventory(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.set_inventory), "__call__") as call: @@ -4161,7 +4185,8 @@ def test_set_inventory_non_empty_request_with_auto_populated_field(): client.set_inventory(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_service.SetInventoryRequest() + request_msg = product_service.SetInventoryRequest() + assert args[0] == request_msg def test_set_inventory_use_cached_wrapped_rpc(): @@ -4252,9 +4277,14 @@ async def test_set_inventory_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_inventory_async( - transport: str = "grpc_asyncio", request_type=product_service.SetInventoryRequest -): +@pytest.mark.parametrize( + "request_type", + [ + product_service.SetInventoryRequest(), + {}, + ], +) +async def test_set_inventory_async(request_type, transport: str = "grpc_asyncio"): client = ProductServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4262,7 +4292,7 @@ async def test_set_inventory_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.set_inventory), "__call__") as call: @@ -4282,11 +4312,6 @@ async def test_set_inventory_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_set_inventory_async_from_dict(): - await test_set_inventory_async(request_type=dict) - - def test_set_inventory_field_headers(): client = ProductServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4443,8 +4468,8 @@ async def test_set_inventory_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - product_service.AddFulfillmentPlacesRequest, - dict, + product_service.AddFulfillmentPlacesRequest(), + {}, ], ) def test_add_fulfillment_places(request_type, transport: str = "grpc"): @@ -4455,7 +4480,7 @@ def test_add_fulfillment_places(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4501,10 +4526,11 @@ def test_add_fulfillment_places_non_empty_request_with_auto_populated_field(): client.add_fulfillment_places(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_service.AddFulfillmentPlacesRequest( + request_msg = product_service.AddFulfillmentPlacesRequest( product="product_value", type_="type__value", ) + assert args[0] == request_msg def test_add_fulfillment_places_use_cached_wrapped_rpc(): @@ -4600,9 +4626,15 @@ async def test_add_fulfillment_places_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + product_service.AddFulfillmentPlacesRequest(), + {}, + ], +) async def test_add_fulfillment_places_async( - transport: str = "grpc_asyncio", - request_type=product_service.AddFulfillmentPlacesRequest, + request_type, transport: str = "grpc_asyncio" ): client = ProductServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4611,7 +4643,7 @@ async def test_add_fulfillment_places_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( @@ -4633,11 +4665,6 @@ async def test_add_fulfillment_places_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_add_fulfillment_places_async_from_dict(): - await test_add_fulfillment_places_async(request_type=dict) - - def test_add_fulfillment_places_field_headers(): client = ProductServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4792,8 +4819,8 @@ async def test_add_fulfillment_places_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - product_service.RemoveFulfillmentPlacesRequest, - dict, + product_service.RemoveFulfillmentPlacesRequest(), + {}, ], ) def test_remove_fulfillment_places(request_type, transport: str = "grpc"): @@ -4804,7 +4831,7 @@ def test_remove_fulfillment_places(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,10 +4877,11 @@ def test_remove_fulfillment_places_non_empty_request_with_auto_populated_field() client.remove_fulfillment_places(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_service.RemoveFulfillmentPlacesRequest( + request_msg = product_service.RemoveFulfillmentPlacesRequest( product="product_value", type_="type__value", ) + assert args[0] == request_msg def test_remove_fulfillment_places_use_cached_wrapped_rpc(): @@ -4949,9 +4977,15 @@ async def test_remove_fulfillment_places_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + product_service.RemoveFulfillmentPlacesRequest(), + {}, + ], +) async def test_remove_fulfillment_places_async( - transport: str = "grpc_asyncio", - request_type=product_service.RemoveFulfillmentPlacesRequest, + request_type, transport: str = "grpc_asyncio" ): client = ProductServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4960,7 +4994,7 @@ async def test_remove_fulfillment_places_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( @@ -4982,11 +5016,6 @@ async def test_remove_fulfillment_places_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_remove_fulfillment_places_async_from_dict(): - await test_remove_fulfillment_places_async(request_type=dict) - - def test_remove_fulfillment_places_field_headers(): client = ProductServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5141,8 +5170,8 @@ async def test_remove_fulfillment_places_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - product_service.AddLocalInventoriesRequest, - dict, + product_service.AddLocalInventoriesRequest(), + {}, ], ) def test_add_local_inventories(request_type, transport: str = "grpc"): @@ -5153,7 +5182,7 @@ def test_add_local_inventories(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5198,9 +5227,10 @@ def test_add_local_inventories_non_empty_request_with_auto_populated_field(): client.add_local_inventories(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_service.AddLocalInventoriesRequest( + request_msg = product_service.AddLocalInventoriesRequest( product="product_value", ) + assert args[0] == request_msg def test_add_local_inventories_use_cached_wrapped_rpc(): @@ -5296,9 +5326,15 @@ async def test_add_local_inventories_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + product_service.AddLocalInventoriesRequest(), + {}, + ], +) async def test_add_local_inventories_async( - transport: str = "grpc_asyncio", - request_type=product_service.AddLocalInventoriesRequest, + request_type, transport: str = "grpc_asyncio" ): client = ProductServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5307,7 +5343,7 @@ async def test_add_local_inventories_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( @@ -5329,11 +5365,6 @@ async def test_add_local_inventories_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_add_local_inventories_async_from_dict(): - await test_add_local_inventories_async(request_type=dict) - - def test_add_local_inventories_field_headers(): client = ProductServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5488,8 +5519,8 @@ async def test_add_local_inventories_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - product_service.RemoveLocalInventoriesRequest, - dict, + product_service.RemoveLocalInventoriesRequest(), + {}, ], ) def test_remove_local_inventories(request_type, transport: str = "grpc"): @@ -5500,7 +5531,7 @@ def test_remove_local_inventories(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5545,9 +5576,10 @@ def test_remove_local_inventories_non_empty_request_with_auto_populated_field(): client.remove_local_inventories(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_service.RemoveLocalInventoriesRequest( + request_msg = product_service.RemoveLocalInventoriesRequest( product="product_value", ) + assert args[0] == request_msg def test_remove_local_inventories_use_cached_wrapped_rpc(): @@ -5643,9 +5675,15 @@ async def test_remove_local_inventories_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + product_service.RemoveLocalInventoriesRequest(), + {}, + ], +) async def test_remove_local_inventories_async( - transport: str = "grpc_asyncio", - request_type=product_service.RemoveLocalInventoriesRequest, + request_type, transport: str = "grpc_asyncio" ): client = ProductServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5654,7 +5692,7 @@ async def test_remove_local_inventories_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( @@ -5676,11 +5714,6 @@ async def test_remove_local_inventories_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_remove_local_inventories_async_from_dict(): - await test_remove_local_inventories_async(request_type=dict) - - def test_remove_local_inventories_field_headers(): client = ProductServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8357,7 +8390,6 @@ def test_create_product_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.CreateProductRequest() - assert args[0] == request_msg @@ -8378,7 +8410,6 @@ def test_get_product_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.GetProductRequest() - assert args[0] == request_msg @@ -8399,7 +8430,6 @@ def test_list_products_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.ListProductsRequest() - assert args[0] == request_msg @@ -8420,7 +8450,6 @@ def test_update_product_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.UpdateProductRequest() - assert args[0] == request_msg @@ -8441,7 +8470,6 @@ def test_delete_product_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.DeleteProductRequest() - assert args[0] == request_msg @@ -8462,7 +8490,6 @@ def test_purge_products_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = purge_config.PurgeProductsRequest() - assert args[0] == request_msg @@ -8483,7 +8510,6 @@ def test_import_products_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_config.ImportProductsRequest() - assert args[0] == request_msg @@ -8504,7 +8530,6 @@ def test_export_products_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = export_config.ExportProductsRequest() - assert args[0] == request_msg @@ -8525,7 +8550,6 @@ def test_set_inventory_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.SetInventoryRequest() - assert args[0] == request_msg @@ -8548,7 +8572,6 @@ def test_add_fulfillment_places_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.AddFulfillmentPlacesRequest() - assert args[0] == request_msg @@ -8571,7 +8594,6 @@ def test_remove_fulfillment_places_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.RemoveFulfillmentPlacesRequest() - assert args[0] == request_msg @@ -8594,7 +8616,6 @@ def test_add_local_inventories_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.AddLocalInventoriesRequest() - assert args[0] == request_msg @@ -8617,7 +8638,6 @@ def test_remove_local_inventories_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.RemoveLocalInventoriesRequest() - assert args[0] == request_msg @@ -8675,7 +8695,6 @@ async def test_create_product_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.CreateProductRequest() - assert args[0] == request_msg @@ -8719,7 +8738,6 @@ async def test_get_product_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.GetProductRequest() - assert args[0] == request_msg @@ -8747,7 +8765,6 @@ async def test_list_products_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.ListProductsRequest() - assert args[0] == request_msg @@ -8791,7 +8808,6 @@ async def test_update_product_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.UpdateProductRequest() - assert args[0] == request_msg @@ -8814,7 +8830,6 @@ async def test_delete_product_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.DeleteProductRequest() - assert args[0] == request_msg @@ -8839,7 +8854,6 @@ async def test_purge_products_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = purge_config.PurgeProductsRequest() - assert args[0] == request_msg @@ -8864,7 +8878,6 @@ async def test_import_products_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_config.ImportProductsRequest() - assert args[0] == request_msg @@ -8889,7 +8902,6 @@ async def test_export_products_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = export_config.ExportProductsRequest() - assert args[0] == request_msg @@ -8914,7 +8926,6 @@ async def test_set_inventory_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.SetInventoryRequest() - assert args[0] == request_msg @@ -8941,7 +8952,6 @@ async def test_add_fulfillment_places_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.AddFulfillmentPlacesRequest() - assert args[0] == request_msg @@ -8968,7 +8978,6 @@ async def test_remove_fulfillment_places_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.RemoveFulfillmentPlacesRequest() - assert args[0] == request_msg @@ -8995,7 +9004,6 @@ async def test_add_local_inventories_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.AddLocalInventoriesRequest() - assert args[0] == request_msg @@ -9022,7 +9030,6 @@ async def test_remove_local_inventories_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.RemoveLocalInventoriesRequest() - assert args[0] == request_msg @@ -11289,7 +11296,6 @@ def test_create_product_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.CreateProductRequest() - assert args[0] == request_msg @@ -11309,7 +11315,6 @@ def test_get_product_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.GetProductRequest() - assert args[0] == request_msg @@ -11329,7 +11334,6 @@ def test_list_products_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.ListProductsRequest() - assert args[0] == request_msg @@ -11349,7 +11353,6 @@ def test_update_product_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.UpdateProductRequest() - assert args[0] == request_msg @@ -11369,7 +11372,6 @@ def test_delete_product_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.DeleteProductRequest() - assert args[0] == request_msg @@ -11389,7 +11391,6 @@ def test_purge_products_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = purge_config.PurgeProductsRequest() - assert args[0] == request_msg @@ -11409,7 +11410,6 @@ def test_import_products_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_config.ImportProductsRequest() - assert args[0] == request_msg @@ -11429,7 +11429,6 @@ def test_export_products_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = export_config.ExportProductsRequest() - assert args[0] == request_msg @@ -11449,7 +11448,6 @@ def test_set_inventory_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.SetInventoryRequest() - assert args[0] == request_msg @@ -11471,7 +11469,6 @@ def test_add_fulfillment_places_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.AddFulfillmentPlacesRequest() - assert args[0] == request_msg @@ -11493,7 +11490,6 @@ def test_remove_fulfillment_places_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.RemoveFulfillmentPlacesRequest() - assert args[0] == request_msg @@ -11515,7 +11511,6 @@ def test_add_local_inventories_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.AddLocalInventoriesRequest() - assert args[0] == request_msg @@ -11537,7 +11532,6 @@ def test_remove_local_inventories_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.RemoveLocalInventoriesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_project_service.py b/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_project_service.py index 846c4f275a44..865270158fe5 100644 --- a/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_project_service.py +++ b/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_project_service.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 @@ -114,6 +115,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" @@ -1317,8 +1333,8 @@ def test_project_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - project_service.GetProjectRequest, - dict, + project_service.GetProjectRequest(), + {}, ], ) def test_get_project(request_type, transport: str = "grpc"): @@ -1329,7 +1345,7 @@ def test_get_project(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_project), "__call__") as call: @@ -1377,9 +1393,10 @@ def test_get_project_non_empty_request_with_auto_populated_field(): client.get_project(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == project_service.GetProjectRequest( + request_msg = project_service.GetProjectRequest( name="name_value", ) + assert args[0] == request_msg def test_get_project_use_cached_wrapped_rpc(): @@ -1460,9 +1477,14 @@ async def test_get_project_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_project_async( - transport: str = "grpc_asyncio", request_type=project_service.GetProjectRequest -): +@pytest.mark.parametrize( + "request_type", + [ + project_service.GetProjectRequest(), + {}, + ], +) +async def test_get_project_async(request_type, transport: str = "grpc_asyncio"): client = ProjectServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1470,7 +1492,7 @@ async def test_get_project_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_project), "__call__") as call: @@ -1497,11 +1519,6 @@ async def test_get_project_async( ] -@pytest.mark.asyncio -async def test_get_project_async_from_dict(): - await test_get_project_async(request_type=dict) - - def test_get_project_field_headers(): client = ProjectServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1644,8 +1661,8 @@ async def test_get_project_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - project_service.AcceptTermsRequest, - dict, + project_service.AcceptTermsRequest(), + {}, ], ) def test_accept_terms(request_type, transport: str = "grpc"): @@ -1656,7 +1673,7 @@ def test_accept_terms(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.accept_terms), "__call__") as call: @@ -1704,9 +1721,10 @@ def test_accept_terms_non_empty_request_with_auto_populated_field(): client.accept_terms(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == project_service.AcceptTermsRequest( + request_msg = project_service.AcceptTermsRequest( project="project_value", ) + assert args[0] == request_msg def test_accept_terms_use_cached_wrapped_rpc(): @@ -1787,9 +1805,14 @@ async def test_accept_terms_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_accept_terms_async( - transport: str = "grpc_asyncio", request_type=project_service.AcceptTermsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + project_service.AcceptTermsRequest(), + {}, + ], +) +async def test_accept_terms_async(request_type, transport: str = "grpc_asyncio"): client = ProjectServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1797,7 +1820,7 @@ async def test_accept_terms_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.accept_terms), "__call__") as call: @@ -1824,11 +1847,6 @@ async def test_accept_terms_async( ] -@pytest.mark.asyncio -async def test_accept_terms_async_from_dict(): - await test_accept_terms_async(request_type=dict) - - def test_accept_terms_field_headers(): client = ProjectServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1971,8 +1989,8 @@ async def test_accept_terms_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - project_service.EnrollSolutionRequest, - dict, + project_service.EnrollSolutionRequest(), + {}, ], ) def test_enroll_solution(request_type, transport: str = "grpc"): @@ -1983,7 +2001,7 @@ def test_enroll_solution(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.enroll_solution), "__call__") as call: @@ -2024,9 +2042,10 @@ def test_enroll_solution_non_empty_request_with_auto_populated_field(): client.enroll_solution(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == project_service.EnrollSolutionRequest( + request_msg = project_service.EnrollSolutionRequest( project="project_value", ) + assert args[0] == request_msg def test_enroll_solution_use_cached_wrapped_rpc(): @@ -2117,9 +2136,14 @@ async def test_enroll_solution_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_enroll_solution_async( - transport: str = "grpc_asyncio", request_type=project_service.EnrollSolutionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + project_service.EnrollSolutionRequest(), + {}, + ], +) +async def test_enroll_solution_async(request_type, transport: str = "grpc_asyncio"): client = ProjectServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2127,7 +2151,7 @@ async def test_enroll_solution_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.enroll_solution), "__call__") as call: @@ -2147,11 +2171,6 @@ async def test_enroll_solution_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_enroll_solution_async_from_dict(): - await test_enroll_solution_async(request_type=dict) - - def test_enroll_solution_field_headers(): client = ProjectServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2216,8 +2235,8 @@ async def test_enroll_solution_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - project_service.ListEnrolledSolutionsRequest, - dict, + project_service.ListEnrolledSolutionsRequest(), + {}, ], ) def test_list_enrolled_solutions(request_type, transport: str = "grpc"): @@ -2228,7 +2247,7 @@ def test_list_enrolled_solutions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2278,9 +2297,10 @@ def test_list_enrolled_solutions_non_empty_request_with_auto_populated_field(): client.list_enrolled_solutions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == project_service.ListEnrolledSolutionsRequest( + request_msg = project_service.ListEnrolledSolutionsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_list_enrolled_solutions_use_cached_wrapped_rpc(): @@ -2366,9 +2386,15 @@ async def test_list_enrolled_solutions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + project_service.ListEnrolledSolutionsRequest(), + {}, + ], +) async def test_list_enrolled_solutions_async( - transport: str = "grpc_asyncio", - request_type=project_service.ListEnrolledSolutionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = ProjectServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2377,7 +2403,7 @@ async def test_list_enrolled_solutions_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( @@ -2404,11 +2430,6 @@ async def test_list_enrolled_solutions_async( ] -@pytest.mark.asyncio -async def test_list_enrolled_solutions_async_from_dict(): - await test_list_enrolled_solutions_async(request_type=dict) - - def test_list_enrolled_solutions_field_headers(): client = ProjectServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2563,8 +2584,8 @@ async def test_list_enrolled_solutions_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - project_service.GetLoggingConfigRequest, - dict, + project_service.GetLoggingConfigRequest(), + {}, ], ) def test_get_logging_config(request_type, transport: str = "grpc"): @@ -2575,7 +2596,7 @@ def test_get_logging_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( @@ -2623,9 +2644,10 @@ def test_get_logging_config_non_empty_request_with_auto_populated_field(): client.get_logging_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == project_service.GetLoggingConfigRequest( + request_msg = project_service.GetLoggingConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_logging_config_use_cached_wrapped_rpc(): @@ -2710,10 +2732,14 @@ async def test_get_logging_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_logging_config_async( - transport: str = "grpc_asyncio", - request_type=project_service.GetLoggingConfigRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + project_service.GetLoggingConfigRequest(), + {}, + ], +) +async def test_get_logging_config_async(request_type, transport: str = "grpc_asyncio"): client = ProjectServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2721,7 +2747,7 @@ async def test_get_logging_config_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( @@ -2746,11 +2772,6 @@ async def test_get_logging_config_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_logging_config_async_from_dict(): - await test_get_logging_config_async(request_type=dict) - - def test_get_logging_config_field_headers(): client = ProjectServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2905,8 +2926,8 @@ async def test_get_logging_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - project_service.UpdateLoggingConfigRequest, - dict, + project_service.UpdateLoggingConfigRequest(), + {}, ], ) def test_update_logging_config(request_type, transport: str = "grpc"): @@ -2917,7 +2938,7 @@ def test_update_logging_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( @@ -2963,7 +2984,8 @@ def test_update_logging_config_non_empty_request_with_auto_populated_field(): client.update_logging_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == project_service.UpdateLoggingConfigRequest() + request_msg = project_service.UpdateLoggingConfigRequest() + assert args[0] == request_msg def test_update_logging_config_use_cached_wrapped_rpc(): @@ -3049,9 +3071,15 @@ async def test_update_logging_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + project_service.UpdateLoggingConfigRequest(), + {}, + ], +) async def test_update_logging_config_async( - transport: str = "grpc_asyncio", - request_type=project_service.UpdateLoggingConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = ProjectServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3060,7 +3088,7 @@ async def test_update_logging_config_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( @@ -3085,11 +3113,6 @@ async def test_update_logging_config_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_update_logging_config_async_from_dict(): - await test_update_logging_config_async(request_type=dict) - - def test_update_logging_config_field_headers(): client = ProjectServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3254,8 +3277,8 @@ async def test_update_logging_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - project_service.GetAlertConfigRequest, - dict, + project_service.GetAlertConfigRequest(), + {}, ], ) def test_get_alert_config(request_type, transport: str = "grpc"): @@ -3266,7 +3289,7 @@ def test_get_alert_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(type(client.transport.get_alert_config), "__call__") as call: @@ -3310,9 +3333,10 @@ def test_get_alert_config_non_empty_request_with_auto_populated_field(): client.get_alert_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == project_service.GetAlertConfigRequest( + request_msg = project_service.GetAlertConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_alert_config_use_cached_wrapped_rpc(): @@ -3395,9 +3419,14 @@ async def test_get_alert_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_alert_config_async( - transport: str = "grpc_asyncio", request_type=project_service.GetAlertConfigRequest -): +@pytest.mark.parametrize( + "request_type", + [ + project_service.GetAlertConfigRequest(), + {}, + ], +) +async def test_get_alert_config_async(request_type, transport: str = "grpc_asyncio"): client = ProjectServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3405,7 +3434,7 @@ async def test_get_alert_config_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_alert_config), "__call__") as call: @@ -3428,11 +3457,6 @@ async def test_get_alert_config_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_alert_config_async_from_dict(): - await test_get_alert_config_async(request_type=dict) - - def test_get_alert_config_field_headers(): client = ProjectServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3575,8 +3599,8 @@ async def test_get_alert_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - project_service.UpdateAlertConfigRequest, - dict, + project_service.UpdateAlertConfigRequest(), + {}, ], ) def test_update_alert_config(request_type, transport: str = "grpc"): @@ -3587,7 +3611,7 @@ def test_update_alert_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( @@ -3633,7 +3657,8 @@ def test_update_alert_config_non_empty_request_with_auto_populated_field(): client.update_alert_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == project_service.UpdateAlertConfigRequest() + request_msg = project_service.UpdateAlertConfigRequest() + assert args[0] == request_msg def test_update_alert_config_use_cached_wrapped_rpc(): @@ -3718,10 +3743,14 @@ async def test_update_alert_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_alert_config_async( - transport: str = "grpc_asyncio", - request_type=project_service.UpdateAlertConfigRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + project_service.UpdateAlertConfigRequest(), + {}, + ], +) +async def test_update_alert_config_async(request_type, transport: str = "grpc_asyncio"): client = ProjectServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3729,7 +3758,7 @@ async def test_update_alert_config_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( @@ -3754,11 +3783,6 @@ async def test_update_alert_config_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_update_alert_config_async_from_dict(): - await test_update_alert_config_async(request_type=dict) - - def test_update_alert_config_field_headers(): client = ProjectServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5433,7 +5457,6 @@ def test_get_project_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = project_service.GetProjectRequest() - assert args[0] == request_msg @@ -5454,7 +5477,6 @@ def test_accept_terms_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = project_service.AcceptTermsRequest() - assert args[0] == request_msg @@ -5475,7 +5497,6 @@ def test_enroll_solution_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = project_service.EnrollSolutionRequest() - assert args[0] == request_msg @@ -5498,7 +5519,6 @@ def test_list_enrolled_solutions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = project_service.ListEnrolledSolutionsRequest() - assert args[0] == request_msg @@ -5521,7 +5541,6 @@ def test_get_logging_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = project_service.GetLoggingConfigRequest() - assert args[0] == request_msg @@ -5544,7 +5563,6 @@ def test_update_logging_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = project_service.UpdateLoggingConfigRequest() - assert args[0] == request_msg @@ -5565,7 +5583,6 @@ def test_get_alert_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = project_service.GetAlertConfigRequest() - assert args[0] == request_msg @@ -5588,7 +5605,6 @@ def test_update_alert_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = project_service.UpdateAlertConfigRequest() - assert args[0] == request_msg @@ -5630,7 +5646,6 @@ async def test_get_project_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = project_service.GetProjectRequest() - assert args[0] == request_msg @@ -5658,7 +5673,6 @@ async def test_accept_terms_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = project_service.AcceptTermsRequest() - assert args[0] == request_msg @@ -5683,7 +5697,6 @@ async def test_enroll_solution_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = project_service.EnrollSolutionRequest() - assert args[0] == request_msg @@ -5712,7 +5725,6 @@ async def test_list_enrolled_solutions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = project_service.ListEnrolledSolutionsRequest() - assert args[0] == request_msg @@ -5741,7 +5753,6 @@ async def test_get_logging_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = project_service.GetLoggingConfigRequest() - assert args[0] == request_msg @@ -5770,7 +5781,6 @@ async def test_update_logging_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = project_service.UpdateLoggingConfigRequest() - assert args[0] == request_msg @@ -5797,7 +5807,6 @@ async def test_get_alert_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = project_service.GetAlertConfigRequest() - assert args[0] == request_msg @@ -5826,7 +5835,6 @@ async def test_update_alert_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = project_service.UpdateAlertConfigRequest() - assert args[0] == request_msg @@ -7199,7 +7207,6 @@ def test_get_project_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = project_service.GetProjectRequest() - assert args[0] == request_msg @@ -7219,7 +7226,6 @@ def test_accept_terms_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = project_service.AcceptTermsRequest() - assert args[0] == request_msg @@ -7239,7 +7245,6 @@ def test_enroll_solution_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = project_service.EnrollSolutionRequest() - assert args[0] == request_msg @@ -7261,7 +7266,6 @@ def test_list_enrolled_solutions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = project_service.ListEnrolledSolutionsRequest() - assert args[0] == request_msg @@ -7283,7 +7287,6 @@ def test_get_logging_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = project_service.GetLoggingConfigRequest() - assert args[0] == request_msg @@ -7305,7 +7308,6 @@ def test_update_logging_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = project_service.UpdateLoggingConfigRequest() - assert args[0] == request_msg @@ -7325,7 +7327,6 @@ def test_get_alert_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = project_service.GetAlertConfigRequest() - assert args[0] == request_msg @@ -7347,7 +7348,6 @@ def test_update_alert_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = project_service.UpdateAlertConfigRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_search_service.py b/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_search_service.py index bb6c10690df7..b3a80c606463 100644 --- a/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_search_service.py +++ b/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_search_service.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 @@ -109,6 +110,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" @@ -1308,8 +1324,8 @@ def test_search_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - search_service.SearchRequest, - dict, + search_service.SearchRequest(), + {}, ], ) def test_search(request_type, transport: str = "grpc"): @@ -1320,7 +1336,7 @@ def test_search(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.search), "__call__") as call: @@ -1386,7 +1402,7 @@ def test_search_non_empty_request_with_auto_populated_field(): client.search(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == search_service.SearchRequest( + request_msg = search_service.SearchRequest( placement="placement_value", branch="branch_value", query="query_value", @@ -1401,6 +1417,7 @@ def test_search_non_empty_request_with_auto_populated_field(): region_code="region_code_value", place_id="place_id_value", ) + assert args[0] == request_msg def test_search_use_cached_wrapped_rpc(): @@ -1479,9 +1496,14 @@ async def test_search_async_use_cached_wrapped_rpc(transport: str = "grpc_asynci @pytest.mark.asyncio -async def test_search_async( - transport: str = "grpc_asyncio", request_type=search_service.SearchRequest -): +@pytest.mark.parametrize( + "request_type", + [ + search_service.SearchRequest(), + {}, + ], +) +async def test_search_async(request_type, transport: str = "grpc_asyncio"): client = SearchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1489,7 +1511,7 @@ async def test_search_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.search), "__call__") as call: @@ -1522,11 +1544,6 @@ async def test_search_async( assert response.applied_controls == ["applied_controls_value"] -@pytest.mark.asyncio -async def test_search_async_from_dict(): - await test_search_async(request_type=dict) - - def test_search_field_headers(): client = SearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2101,7 +2118,6 @@ def test_search_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = search_service.SearchRequest() - assert args[0] == request_msg @@ -2147,7 +2163,6 @@ async def test_search_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = search_service.SearchRequest() - assert args[0] == request_msg @@ -2452,7 +2467,6 @@ def test_search_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = search_service.SearchRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_serving_config_service.py b/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_serving_config_service.py index cdb0719e9e32..0a97f983ded2 100644 --- a/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_serving_config_service.py +++ b/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_serving_config_service.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 @@ -116,6 +117,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" @@ -1379,8 +1395,8 @@ def test_serving_config_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - serving_config_service.CreateServingConfigRequest, - dict, + serving_config_service.CreateServingConfigRequest(), + {}, ], ) def test_create_serving_config(request_type, transport: str = "grpc"): @@ -1391,7 +1407,7 @@ def test_create_serving_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( @@ -1479,10 +1495,11 @@ def test_create_serving_config_non_empty_request_with_auto_populated_field(): client.create_serving_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == serving_config_service.CreateServingConfigRequest( + request_msg = serving_config_service.CreateServingConfigRequest( parent="parent_value", serving_config_id="serving_config_id_value", ) + assert args[0] == request_msg def test_create_serving_config_use_cached_wrapped_rpc(): @@ -1568,9 +1585,15 @@ async def test_create_serving_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + serving_config_service.CreateServingConfigRequest(), + {}, + ], +) async def test_create_serving_config_async( - transport: str = "grpc_asyncio", - request_type=serving_config_service.CreateServingConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = ServingConfigServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1579,7 +1602,7 @@ async def test_create_serving_config_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( @@ -1643,11 +1666,6 @@ async def test_create_serving_config_async( assert response.solution_types == [common.SolutionType.SOLUTION_TYPE_RECOMMENDATION] -@pytest.mark.asyncio -async def test_create_serving_config_async_from_dict(): - await test_create_serving_config_async(request_type=dict) - - def test_create_serving_config_field_headers(): client = ServingConfigServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1822,8 +1840,8 @@ async def test_create_serving_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - serving_config_service.DeleteServingConfigRequest, - dict, + serving_config_service.DeleteServingConfigRequest(), + {}, ], ) def test_delete_serving_config(request_type, transport: str = "grpc"): @@ -1834,7 +1852,7 @@ def test_delete_serving_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( @@ -1879,9 +1897,10 @@ def test_delete_serving_config_non_empty_request_with_auto_populated_field(): client.delete_serving_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == serving_config_service.DeleteServingConfigRequest( + request_msg = serving_config_service.DeleteServingConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_serving_config_use_cached_wrapped_rpc(): @@ -1967,9 +1986,15 @@ async def test_delete_serving_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + serving_config_service.DeleteServingConfigRequest(), + {}, + ], +) async def test_delete_serving_config_async( - transport: str = "grpc_asyncio", - request_type=serving_config_service.DeleteServingConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = ServingConfigServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1978,7 +2003,7 @@ async def test_delete_serving_config_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( @@ -1998,11 +2023,6 @@ async def test_delete_serving_config_async( assert response is None -@pytest.mark.asyncio -async def test_delete_serving_config_async_from_dict(): - await test_delete_serving_config_async(request_type=dict) - - def test_delete_serving_config_field_headers(): client = ServingConfigServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2153,8 +2173,8 @@ async def test_delete_serving_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - serving_config_service.UpdateServingConfigRequest, - dict, + serving_config_service.UpdateServingConfigRequest(), + {}, ], ) def test_update_serving_config(request_type, transport: str = "grpc"): @@ -2165,7 +2185,7 @@ def test_update_serving_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( @@ -2250,7 +2270,8 @@ def test_update_serving_config_non_empty_request_with_auto_populated_field(): client.update_serving_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == serving_config_service.UpdateServingConfigRequest() + request_msg = serving_config_service.UpdateServingConfigRequest() + assert args[0] == request_msg def test_update_serving_config_use_cached_wrapped_rpc(): @@ -2336,9 +2357,15 @@ async def test_update_serving_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + serving_config_service.UpdateServingConfigRequest(), + {}, + ], +) async def test_update_serving_config_async( - transport: str = "grpc_asyncio", - request_type=serving_config_service.UpdateServingConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = ServingConfigServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2347,7 +2374,7 @@ async def test_update_serving_config_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( @@ -2411,11 +2438,6 @@ async def test_update_serving_config_async( assert response.solution_types == [common.SolutionType.SOLUTION_TYPE_RECOMMENDATION] -@pytest.mark.asyncio -async def test_update_serving_config_async_from_dict(): - await test_update_serving_config_async(request_type=dict) - - def test_update_serving_config_field_headers(): client = ServingConfigServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2580,8 +2602,8 @@ async def test_update_serving_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - serving_config_service.GetServingConfigRequest, - dict, + serving_config_service.GetServingConfigRequest(), + {}, ], ) def test_get_serving_config(request_type, transport: str = "grpc"): @@ -2592,7 +2614,7 @@ def test_get_serving_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( @@ -2679,9 +2701,10 @@ def test_get_serving_config_non_empty_request_with_auto_populated_field(): client.get_serving_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == serving_config_service.GetServingConfigRequest( + request_msg = serving_config_service.GetServingConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_serving_config_use_cached_wrapped_rpc(): @@ -2766,10 +2789,14 @@ async def test_get_serving_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_serving_config_async( - transport: str = "grpc_asyncio", - request_type=serving_config_service.GetServingConfigRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + serving_config_service.GetServingConfigRequest(), + {}, + ], +) +async def test_get_serving_config_async(request_type, transport: str = "grpc_asyncio"): client = ServingConfigServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2777,7 +2804,7 @@ async def test_get_serving_config_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( @@ -2841,11 +2868,6 @@ async def test_get_serving_config_async( assert response.solution_types == [common.SolutionType.SOLUTION_TYPE_RECOMMENDATION] -@pytest.mark.asyncio -async def test_get_serving_config_async_from_dict(): - await test_get_serving_config_async(request_type=dict) - - def test_get_serving_config_field_headers(): client = ServingConfigServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3000,8 +3022,8 @@ async def test_get_serving_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - serving_config_service.ListServingConfigsRequest, - dict, + serving_config_service.ListServingConfigsRequest(), + {}, ], ) def test_list_serving_configs(request_type, transport: str = "grpc"): @@ -3012,7 +3034,7 @@ def test_list_serving_configs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,10 +3083,11 @@ def test_list_serving_configs_non_empty_request_with_auto_populated_field(): client.list_serving_configs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == serving_config_service.ListServingConfigsRequest( + request_msg = serving_config_service.ListServingConfigsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_serving_configs_use_cached_wrapped_rpc(): @@ -3149,9 +3172,15 @@ async def test_list_serving_configs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + serving_config_service.ListServingConfigsRequest(), + {}, + ], +) async def test_list_serving_configs_async( - transport: str = "grpc_asyncio", - request_type=serving_config_service.ListServingConfigsRequest, + request_type, transport: str = "grpc_asyncio" ): client = ServingConfigServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3160,7 +3189,7 @@ async def test_list_serving_configs_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( @@ -3185,11 +3214,6 @@ async def test_list_serving_configs_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_serving_configs_async_from_dict(): - await test_list_serving_configs_async(request_type=dict) - - def test_list_serving_configs_field_headers(): client = ServingConfigServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3542,8 +3566,8 @@ async def test_list_serving_configs_async_pages(): @pytest.mark.parametrize( "request_type", [ - serving_config_service.AddControlRequest, - dict, + serving_config_service.AddControlRequest(), + {}, ], ) def test_add_control(request_type, transport: str = "grpc"): @@ -3554,7 +3578,7 @@ def test_add_control(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.add_control), "__call__") as call: @@ -3638,10 +3662,11 @@ def test_add_control_non_empty_request_with_auto_populated_field(): client.add_control(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == serving_config_service.AddControlRequest( + request_msg = serving_config_service.AddControlRequest( serving_config="serving_config_value", control_id="control_id_value", ) + assert args[0] == request_msg def test_add_control_use_cached_wrapped_rpc(): @@ -3722,10 +3747,14 @@ async def test_add_control_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_add_control_async( - transport: str = "grpc_asyncio", - request_type=serving_config_service.AddControlRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + serving_config_service.AddControlRequest(), + {}, + ], +) +async def test_add_control_async(request_type, transport: str = "grpc_asyncio"): client = ServingConfigServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3733,7 +3762,7 @@ async def test_add_control_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.add_control), "__call__") as call: @@ -3795,11 +3824,6 @@ async def test_add_control_async( assert response.solution_types == [common.SolutionType.SOLUTION_TYPE_RECOMMENDATION] -@pytest.mark.asyncio -async def test_add_control_async_from_dict(): - await test_add_control_async(request_type=dict) - - def test_add_control_field_headers(): client = ServingConfigServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3946,8 +3970,8 @@ async def test_add_control_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - serving_config_service.RemoveControlRequest, - dict, + serving_config_service.RemoveControlRequest(), + {}, ], ) def test_remove_control(request_type, transport: str = "grpc"): @@ -3958,7 +3982,7 @@ def test_remove_control(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.remove_control), "__call__") as call: @@ -4042,10 +4066,11 @@ def test_remove_control_non_empty_request_with_auto_populated_field(): client.remove_control(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == serving_config_service.RemoveControlRequest( + request_msg = serving_config_service.RemoveControlRequest( serving_config="serving_config_value", control_id="control_id_value", ) + assert args[0] == request_msg def test_remove_control_use_cached_wrapped_rpc(): @@ -4126,10 +4151,14 @@ async def test_remove_control_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_remove_control_async( - transport: str = "grpc_asyncio", - request_type=serving_config_service.RemoveControlRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + serving_config_service.RemoveControlRequest(), + {}, + ], +) +async def test_remove_control_async(request_type, transport: str = "grpc_asyncio"): client = ServingConfigServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4137,7 +4166,7 @@ async def test_remove_control_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.remove_control), "__call__") as call: @@ -4199,11 +4228,6 @@ async def test_remove_control_async( assert response.solution_types == [common.SolutionType.SOLUTION_TYPE_RECOMMENDATION] -@pytest.mark.asyncio -async def test_remove_control_async_from_dict(): - await test_remove_control_async(request_type=dict) - - def test_remove_control_field_headers(): client = ServingConfigServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5892,7 +5916,6 @@ def test_create_serving_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.CreateServingConfigRequest() - assert args[0] == request_msg @@ -5915,7 +5938,6 @@ def test_delete_serving_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.DeleteServingConfigRequest() - assert args[0] == request_msg @@ -5938,7 +5960,6 @@ def test_update_serving_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.UpdateServingConfigRequest() - assert args[0] == request_msg @@ -5961,7 +5982,6 @@ def test_get_serving_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.GetServingConfigRequest() - assert args[0] == request_msg @@ -5984,7 +6004,6 @@ def test_list_serving_configs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.ListServingConfigsRequest() - assert args[0] == request_msg @@ -6005,7 +6024,6 @@ def test_add_control_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.AddControlRequest() - assert args[0] == request_msg @@ -6026,7 +6044,6 @@ def test_remove_control_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.RemoveControlRequest() - assert args[0] == request_msg @@ -6086,7 +6103,6 @@ async def test_create_serving_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.CreateServingConfigRequest() - assert args[0] == request_msg @@ -6111,7 +6127,6 @@ async def test_delete_serving_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.DeleteServingConfigRequest() - assert args[0] == request_msg @@ -6157,7 +6172,6 @@ async def test_update_serving_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.UpdateServingConfigRequest() - assert args[0] == request_msg @@ -6203,7 +6217,6 @@ async def test_get_serving_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.GetServingConfigRequest() - assert args[0] == request_msg @@ -6232,7 +6245,6 @@ async def test_list_serving_configs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.ListServingConfigsRequest() - assert args[0] == request_msg @@ -6276,7 +6288,6 @@ async def test_add_control_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.AddControlRequest() - assert args[0] == request_msg @@ -6320,7 +6331,6 @@ async def test_remove_control_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.RemoveControlRequest() - assert args[0] == request_msg @@ -7843,7 +7853,6 @@ def test_create_serving_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.CreateServingConfigRequest() - assert args[0] == request_msg @@ -7865,7 +7874,6 @@ def test_delete_serving_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.DeleteServingConfigRequest() - assert args[0] == request_msg @@ -7887,7 +7895,6 @@ def test_update_serving_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.UpdateServingConfigRequest() - assert args[0] == request_msg @@ -7909,7 +7916,6 @@ def test_get_serving_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.GetServingConfigRequest() - assert args[0] == request_msg @@ -7931,7 +7937,6 @@ def test_list_serving_configs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.ListServingConfigsRequest() - assert args[0] == request_msg @@ -7951,7 +7956,6 @@ def test_add_control_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.AddControlRequest() - assert args[0] == request_msg @@ -7971,7 +7975,6 @@ def test_remove_control_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.RemoveControlRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_user_event_service.py b/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_user_event_service.py index 0b7988f10ac2..dce7ef7ed3e9 100644 --- a/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_user_event_service.py +++ b/packages/google-cloud-retail/tests/unit/gapic/retail_v2alpha/test_user_event_service.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 @@ -128,6 +129,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" @@ -1361,8 +1377,8 @@ def test_user_event_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - user_event_service.WriteUserEventRequest, - dict, + user_event_service.WriteUserEventRequest(), + {}, ], ) def test_write_user_event(request_type, transport: str = "grpc"): @@ -1373,7 +1389,7 @@ def test_write_user_event(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.write_user_event), "__call__") as call: @@ -1445,9 +1461,10 @@ def test_write_user_event_non_empty_request_with_auto_populated_field(): client.write_user_event(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == user_event_service.WriteUserEventRequest( + request_msg = user_event_service.WriteUserEventRequest( parent="parent_value", ) + assert args[0] == request_msg def test_write_user_event_use_cached_wrapped_rpc(): @@ -1530,10 +1547,14 @@ async def test_write_user_event_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_write_user_event_async( - transport: str = "grpc_asyncio", - request_type=user_event_service.WriteUserEventRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + user_event_service.WriteUserEventRequest(), + {}, + ], +) +async def test_write_user_event_async(request_type, transport: str = "grpc_asyncio"): client = UserEventServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1541,7 +1562,7 @@ async def test_write_user_event_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.write_user_event), "__call__") as call: @@ -1592,11 +1613,6 @@ async def test_write_user_event_async( assert response.entity == "entity_value" -@pytest.mark.asyncio -async def test_write_user_event_async_from_dict(): - await test_write_user_event_async(request_type=dict) - - def test_write_user_event_field_headers(): client = UserEventServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1661,8 +1677,8 @@ async def test_write_user_event_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - user_event_service.CollectUserEventRequest, - dict, + user_event_service.CollectUserEventRequest(), + {}, ], ) def test_collect_user_event(request_type, transport: str = "grpc"): @@ -1673,7 +1689,7 @@ def test_collect_user_event(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1727,13 +1743,14 @@ def test_collect_user_event_non_empty_request_with_auto_populated_field(): client.collect_user_event(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == user_event_service.CollectUserEventRequest( + request_msg = user_event_service.CollectUserEventRequest( prebuilt_rule="prebuilt_rule_value", parent="parent_value", user_event="user_event_value", uri="uri_value", raw_json="raw_json_value", ) + assert args[0] == request_msg def test_collect_user_event_use_cached_wrapped_rpc(): @@ -1818,10 +1835,14 @@ async def test_collect_user_event_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_collect_user_event_async( - transport: str = "grpc_asyncio", - request_type=user_event_service.CollectUserEventRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + user_event_service.CollectUserEventRequest(), + {}, + ], +) +async def test_collect_user_event_async(request_type, transport: str = "grpc_asyncio"): client = UserEventServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1829,7 +1850,7 @@ async def test_collect_user_event_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( @@ -1856,11 +1877,6 @@ async def test_collect_user_event_async( assert response.data == b"data_blob" -@pytest.mark.asyncio -async def test_collect_user_event_async_from_dict(): - await test_collect_user_event_async(request_type=dict) - - def test_collect_user_event_field_headers(): client = UserEventServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1929,8 +1945,8 @@ async def test_collect_user_event_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - purge_config.PurgeUserEventsRequest, - dict, + purge_config.PurgeUserEventsRequest(), + {}, ], ) def test_purge_user_events(request_type, transport: str = "grpc"): @@ -1941,7 +1957,7 @@ def test_purge_user_events(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1987,10 +2003,11 @@ def test_purge_user_events_non_empty_request_with_auto_populated_field(): client.purge_user_events(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == purge_config.PurgeUserEventsRequest( + request_msg = purge_config.PurgeUserEventsRequest( parent="parent_value", filter="filter_value", ) + assert args[0] == request_msg def test_purge_user_events_use_cached_wrapped_rpc(): @@ -2083,9 +2100,14 @@ async def test_purge_user_events_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_purge_user_events_async( - transport: str = "grpc_asyncio", request_type=purge_config.PurgeUserEventsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + purge_config.PurgeUserEventsRequest(), + {}, + ], +) +async def test_purge_user_events_async(request_type, transport: str = "grpc_asyncio"): client = UserEventServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2093,7 +2115,7 @@ async def test_purge_user_events_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( @@ -2115,11 +2137,6 @@ async def test_purge_user_events_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_purge_user_events_async_from_dict(): - await test_purge_user_events_async(request_type=dict) - - def test_purge_user_events_field_headers(): client = UserEventServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2188,8 +2205,8 @@ async def test_purge_user_events_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - import_config.ImportUserEventsRequest, - dict, + import_config.ImportUserEventsRequest(), + {}, ], ) def test_import_user_events(request_type, transport: str = "grpc"): @@ -2200,7 +2217,7 @@ def test_import_user_events(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2245,9 +2262,10 @@ def test_import_user_events_non_empty_request_with_auto_populated_field(): client.import_user_events(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == import_config.ImportUserEventsRequest( + request_msg = import_config.ImportUserEventsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_import_user_events_use_cached_wrapped_rpc(): @@ -2342,9 +2360,14 @@ async def test_import_user_events_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_import_user_events_async( - transport: str = "grpc_asyncio", request_type=import_config.ImportUserEventsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + import_config.ImportUserEventsRequest(), + {}, + ], +) +async def test_import_user_events_async(request_type, transport: str = "grpc_asyncio"): client = UserEventServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2352,7 +2375,7 @@ async def test_import_user_events_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( @@ -2374,11 +2397,6 @@ async def test_import_user_events_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_import_user_events_async_from_dict(): - await test_import_user_events_async(request_type=dict) - - def test_import_user_events_field_headers(): client = UserEventServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2447,8 +2465,8 @@ async def test_import_user_events_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - export_config.ExportUserEventsRequest, - dict, + export_config.ExportUserEventsRequest(), + {}, ], ) def test_export_user_events(request_type, transport: str = "grpc"): @@ -2459,7 +2477,7 @@ def test_export_user_events(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2505,10 +2523,11 @@ def test_export_user_events_non_empty_request_with_auto_populated_field(): client.export_user_events(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == export_config.ExportUserEventsRequest( + request_msg = export_config.ExportUserEventsRequest( parent="parent_value", filter="filter_value", ) + assert args[0] == request_msg def test_export_user_events_use_cached_wrapped_rpc(): @@ -2603,9 +2622,14 @@ async def test_export_user_events_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_export_user_events_async( - transport: str = "grpc_asyncio", request_type=export_config.ExportUserEventsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + export_config.ExportUserEventsRequest(), + {}, + ], +) +async def test_export_user_events_async(request_type, transport: str = "grpc_asyncio"): client = UserEventServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2613,7 +2637,7 @@ async def test_export_user_events_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( @@ -2635,11 +2659,6 @@ async def test_export_user_events_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_export_user_events_async_from_dict(): - await test_export_user_events_async(request_type=dict) - - def test_export_user_events_field_headers(): client = UserEventServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2708,8 +2727,8 @@ async def test_export_user_events_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - user_event_service.RejoinUserEventsRequest, - dict, + user_event_service.RejoinUserEventsRequest(), + {}, ], ) def test_rejoin_user_events(request_type, transport: str = "grpc"): @@ -2720,7 +2739,7 @@ def test_rejoin_user_events(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2765,9 +2784,10 @@ def test_rejoin_user_events_non_empty_request_with_auto_populated_field(): client.rejoin_user_events(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == user_event_service.RejoinUserEventsRequest( + request_msg = user_event_service.RejoinUserEventsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_rejoin_user_events_use_cached_wrapped_rpc(): @@ -2862,10 +2882,14 @@ async def test_rejoin_user_events_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_rejoin_user_events_async( - transport: str = "grpc_asyncio", - request_type=user_event_service.RejoinUserEventsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + user_event_service.RejoinUserEventsRequest(), + {}, + ], +) +async def test_rejoin_user_events_async(request_type, transport: str = "grpc_asyncio"): client = UserEventServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2873,7 +2897,7 @@ async def test_rejoin_user_events_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( @@ -2895,11 +2919,6 @@ async def test_rejoin_user_events_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_rejoin_user_events_async_from_dict(): - await test_rejoin_user_events_async(request_type=dict) - - def test_rejoin_user_events_field_headers(): client = UserEventServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3912,7 +3931,6 @@ def test_write_user_event_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_event_service.WriteUserEventRequest() - assert args[0] == request_msg @@ -3935,7 +3953,6 @@ def test_collect_user_event_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_event_service.CollectUserEventRequest() - assert args[0] == request_msg @@ -3958,7 +3975,6 @@ def test_purge_user_events_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = purge_config.PurgeUserEventsRequest() - assert args[0] == request_msg @@ -3981,7 +3997,6 @@ def test_import_user_events_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_config.ImportUserEventsRequest() - assert args[0] == request_msg @@ -4004,7 +4019,6 @@ def test_export_user_events_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = export_config.ExportUserEventsRequest() - assert args[0] == request_msg @@ -4027,7 +4041,6 @@ def test_rejoin_user_events_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_event_service.RejoinUserEventsRequest() - assert args[0] == request_msg @@ -4082,7 +4095,6 @@ async def test_write_user_event_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_event_service.WriteUserEventRequest() - assert args[0] == request_msg @@ -4112,7 +4124,6 @@ async def test_collect_user_event_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_event_service.CollectUserEventRequest() - assert args[0] == request_msg @@ -4139,7 +4150,6 @@ async def test_purge_user_events_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = purge_config.PurgeUserEventsRequest() - assert args[0] == request_msg @@ -4166,7 +4176,6 @@ async def test_import_user_events_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_config.ImportUserEventsRequest() - assert args[0] == request_msg @@ -4193,7 +4202,6 @@ async def test_export_user_events_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = export_config.ExportUserEventsRequest() - assert args[0] == request_msg @@ -4220,7 +4228,6 @@ async def test_rejoin_user_events_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_event_service.RejoinUserEventsRequest() - assert args[0] == request_msg @@ -5371,7 +5378,6 @@ def test_write_user_event_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_event_service.WriteUserEventRequest() - assert args[0] == request_msg @@ -5393,7 +5399,6 @@ def test_collect_user_event_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_event_service.CollectUserEventRequest() - assert args[0] == request_msg @@ -5415,7 +5420,6 @@ def test_purge_user_events_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = purge_config.PurgeUserEventsRequest() - assert args[0] == request_msg @@ -5437,7 +5441,6 @@ def test_import_user_events_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_config.ImportUserEventsRequest() - assert args[0] == request_msg @@ -5459,7 +5462,6 @@ def test_export_user_events_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = export_config.ExportUserEventsRequest() - assert args[0] == request_msg @@ -5481,7 +5483,6 @@ def test_rejoin_user_events_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_event_service.RejoinUserEventsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_analytics_service.py b/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_analytics_service.py index 235f72a6493d..1c7f4994212c 100644 --- a/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_analytics_service.py +++ b/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_analytics_service.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" @@ -1345,8 +1361,8 @@ def test_analytics_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - export_config.ExportAnalyticsMetricsRequest, - dict, + export_config.ExportAnalyticsMetricsRequest(), + {}, ], ) def test_export_analytics_metrics(request_type, transport: str = "grpc"): @@ -1357,7 +1373,7 @@ def test_export_analytics_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( @@ -1403,10 +1419,11 @@ def test_export_analytics_metrics_non_empty_request_with_auto_populated_field(): client.export_analytics_metrics(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == export_config.ExportAnalyticsMetricsRequest( + request_msg = export_config.ExportAnalyticsMetricsRequest( catalog="catalog_value", filter="filter_value", ) + assert args[0] == request_msg def test_export_analytics_metrics_use_cached_wrapped_rpc(): @@ -1502,9 +1519,15 @@ async def test_export_analytics_metrics_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + export_config.ExportAnalyticsMetricsRequest(), + {}, + ], +) async def test_export_analytics_metrics_async( - transport: str = "grpc_asyncio", - request_type=export_config.ExportAnalyticsMetricsRequest, + request_type, transport: str = "grpc_asyncio" ): client = AnalyticsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1513,7 +1536,7 @@ async def test_export_analytics_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( @@ -1535,11 +1558,6 @@ async def test_export_analytics_metrics_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_export_analytics_metrics_async_from_dict(): - await test_export_analytics_metrics_async(request_type=dict) - - def test_export_analytics_metrics_field_headers(): client = AnalyticsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1865,7 +1883,6 @@ def test_export_analytics_metrics_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = export_config.ExportAnalyticsMetricsRequest() - assert args[0] == request_msg @@ -1906,7 +1923,6 @@ async def test_export_analytics_metrics_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = export_config.ExportAnalyticsMetricsRequest() - assert args[0] == request_msg @@ -2199,7 +2215,6 @@ def test_export_analytics_metrics_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = export_config.ExportAnalyticsMetricsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_catalog_service.py b/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_catalog_service.py index 7e358eaf3091..f2e62374802f 100644 --- a/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_catalog_service.py +++ b/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_catalog_service.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 @@ -118,6 +119,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" @@ -1321,8 +1337,8 @@ def test_catalog_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - catalog_service.ListCatalogsRequest, - dict, + catalog_service.ListCatalogsRequest(), + {}, ], ) def test_list_catalogs(request_type, transport: str = "grpc"): @@ -1333,7 +1349,7 @@ def test_list_catalogs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_catalogs), "__call__") as call: @@ -1378,10 +1394,11 @@ def test_list_catalogs_non_empty_request_with_auto_populated_field(): client.list_catalogs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog_service.ListCatalogsRequest( + request_msg = catalog_service.ListCatalogsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_catalogs_use_cached_wrapped_rpc(): @@ -1462,9 +1479,14 @@ async def test_list_catalogs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_catalogs_async( - transport: str = "grpc_asyncio", request_type=catalog_service.ListCatalogsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + catalog_service.ListCatalogsRequest(), + {}, + ], +) +async def test_list_catalogs_async(request_type, transport: str = "grpc_asyncio"): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1472,7 +1494,7 @@ async def test_list_catalogs_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_catalogs), "__call__") as call: @@ -1495,11 +1517,6 @@ async def test_list_catalogs_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_catalogs_async_from_dict(): - await test_list_catalogs_async(request_type=dict) - - def test_list_catalogs_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1836,8 +1853,8 @@ async def test_list_catalogs_async_pages(): @pytest.mark.parametrize( "request_type", [ - catalog_service.UpdateCatalogRequest, - dict, + catalog_service.UpdateCatalogRequest(), + {}, ], ) def test_update_catalog(request_type, transport: str = "grpc"): @@ -1848,7 +1865,7 @@ def test_update_catalog(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_catalog), "__call__") as call: @@ -1892,7 +1909,8 @@ def test_update_catalog_non_empty_request_with_auto_populated_field(): client.update_catalog(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog_service.UpdateCatalogRequest() + request_msg = catalog_service.UpdateCatalogRequest() + assert args[0] == request_msg def test_update_catalog_use_cached_wrapped_rpc(): @@ -1973,9 +1991,14 @@ async def test_update_catalog_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_catalog_async( - transport: str = "grpc_asyncio", request_type=catalog_service.UpdateCatalogRequest -): +@pytest.mark.parametrize( + "request_type", + [ + catalog_service.UpdateCatalogRequest(), + {}, + ], +) +async def test_update_catalog_async(request_type, transport: str = "grpc_asyncio"): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1983,7 +2006,7 @@ async def test_update_catalog_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_catalog), "__call__") as call: @@ -2008,11 +2031,6 @@ async def test_update_catalog_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_update_catalog_async_from_dict(): - await test_update_catalog_async(request_type=dict) - - def test_update_catalog_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2165,8 +2183,8 @@ async def test_update_catalog_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - catalog_service.SetDefaultBranchRequest, - dict, + catalog_service.SetDefaultBranchRequest(), + {}, ], ) def test_set_default_branch(request_type, transport: str = "grpc"): @@ -2177,7 +2195,7 @@ def test_set_default_branch(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2224,11 +2242,12 @@ def test_set_default_branch_non_empty_request_with_auto_populated_field(): client.set_default_branch(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog_service.SetDefaultBranchRequest( + request_msg = catalog_service.SetDefaultBranchRequest( catalog="catalog_value", branch_id="branch_id_value", note="note_value", ) + assert args[0] == request_msg def test_set_default_branch_use_cached_wrapped_rpc(): @@ -2313,10 +2332,14 @@ async def test_set_default_branch_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_default_branch_async( - transport: str = "grpc_asyncio", - request_type=catalog_service.SetDefaultBranchRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + catalog_service.SetDefaultBranchRequest(), + {}, + ], +) +async def test_set_default_branch_async(request_type, transport: str = "grpc_asyncio"): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2324,7 +2347,7 @@ async def test_set_default_branch_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( @@ -2344,11 +2367,6 @@ async def test_set_default_branch_async( assert response is None -@pytest.mark.asyncio -async def test_set_default_branch_async_from_dict(): - await test_set_default_branch_async(request_type=dict) - - def test_set_default_branch_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2499,8 +2517,8 @@ async def test_set_default_branch_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - catalog_service.GetDefaultBranchRequest, - dict, + catalog_service.GetDefaultBranchRequest(), + {}, ], ) def test_get_default_branch(request_type, transport: str = "grpc"): @@ -2511,7 +2529,7 @@ def test_get_default_branch(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2561,9 +2579,10 @@ def test_get_default_branch_non_empty_request_with_auto_populated_field(): client.get_default_branch(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog_service.GetDefaultBranchRequest( + request_msg = catalog_service.GetDefaultBranchRequest( catalog="catalog_value", ) + assert args[0] == request_msg def test_get_default_branch_use_cached_wrapped_rpc(): @@ -2648,10 +2667,14 @@ async def test_get_default_branch_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_default_branch_async( - transport: str = "grpc_asyncio", - request_type=catalog_service.GetDefaultBranchRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + catalog_service.GetDefaultBranchRequest(), + {}, + ], +) +async def test_get_default_branch_async(request_type, transport: str = "grpc_asyncio"): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2659,7 +2682,7 @@ async def test_get_default_branch_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( @@ -2686,11 +2709,6 @@ async def test_get_default_branch_async( assert response.note == "note_value" -@pytest.mark.asyncio -async def test_get_default_branch_async_from_dict(): - await test_get_default_branch_async(request_type=dict) - - def test_get_default_branch_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2845,8 +2863,8 @@ async def test_get_default_branch_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - catalog_service.GetCompletionConfigRequest, - dict, + catalog_service.GetCompletionConfigRequest(), + {}, ], ) def test_get_completion_config(request_type, transport: str = "grpc"): @@ -2857,7 +2875,7 @@ def test_get_completion_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( @@ -2928,9 +2946,10 @@ def test_get_completion_config_non_empty_request_with_auto_populated_field(): client.get_completion_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog_service.GetCompletionConfigRequest( + request_msg = catalog_service.GetCompletionConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_completion_config_use_cached_wrapped_rpc(): @@ -3016,9 +3035,15 @@ async def test_get_completion_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + catalog_service.GetCompletionConfigRequest(), + {}, + ], +) async def test_get_completion_config_async( - transport: str = "grpc_asyncio", - request_type=catalog_service.GetCompletionConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3027,7 +3052,7 @@ async def test_get_completion_config_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( @@ -3075,11 +3100,6 @@ async def test_get_completion_config_async( ) -@pytest.mark.asyncio -async def test_get_completion_config_async_from_dict(): - await test_get_completion_config_async(request_type=dict) - - def test_get_completion_config_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3234,8 +3254,8 @@ async def test_get_completion_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - catalog_service.UpdateCompletionConfigRequest, - dict, + catalog_service.UpdateCompletionConfigRequest(), + {}, ], ) def test_update_completion_config(request_type, transport: str = "grpc"): @@ -3246,7 +3266,7 @@ def test_update_completion_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( @@ -3315,7 +3335,8 @@ def test_update_completion_config_non_empty_request_with_auto_populated_field(): client.update_completion_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog_service.UpdateCompletionConfigRequest() + request_msg = catalog_service.UpdateCompletionConfigRequest() + assert args[0] == request_msg def test_update_completion_config_use_cached_wrapped_rpc(): @@ -3401,9 +3422,15 @@ async def test_update_completion_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + catalog_service.UpdateCompletionConfigRequest(), + {}, + ], +) async def test_update_completion_config_async( - transport: str = "grpc_asyncio", - request_type=catalog_service.UpdateCompletionConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3412,7 +3439,7 @@ async def test_update_completion_config_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( @@ -3460,11 +3487,6 @@ async def test_update_completion_config_async( ) -@pytest.mark.asyncio -async def test_update_completion_config_async_from_dict(): - await test_update_completion_config_async(request_type=dict) - - def test_update_completion_config_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3629,8 +3651,8 @@ async def test_update_completion_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - catalog_service.GetAttributesConfigRequest, - dict, + catalog_service.GetAttributesConfigRequest(), + {}, ], ) def test_get_attributes_config(request_type, transport: str = "grpc"): @@ -3641,7 +3663,7 @@ def test_get_attributes_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( @@ -3694,9 +3716,10 @@ def test_get_attributes_config_non_empty_request_with_auto_populated_field(): client.get_attributes_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog_service.GetAttributesConfigRequest( + request_msg = catalog_service.GetAttributesConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_attributes_config_use_cached_wrapped_rpc(): @@ -3782,9 +3805,15 @@ async def test_get_attributes_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + catalog_service.GetAttributesConfigRequest(), + {}, + ], +) async def test_get_attributes_config_async( - transport: str = "grpc_asyncio", - request_type=catalog_service.GetAttributesConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3793,7 +3822,7 @@ async def test_get_attributes_config_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( @@ -3823,11 +3852,6 @@ async def test_get_attributes_config_async( ) -@pytest.mark.asyncio -async def test_get_attributes_config_async_from_dict(): - await test_get_attributes_config_async(request_type=dict) - - def test_get_attributes_config_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3982,8 +4006,8 @@ async def test_get_attributes_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - catalog_service.UpdateAttributesConfigRequest, - dict, + catalog_service.UpdateAttributesConfigRequest(), + {}, ], ) def test_update_attributes_config(request_type, transport: str = "grpc"): @@ -3994,7 +4018,7 @@ def test_update_attributes_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( @@ -4045,7 +4069,8 @@ def test_update_attributes_config_non_empty_request_with_auto_populated_field(): client.update_attributes_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog_service.UpdateAttributesConfigRequest() + request_msg = catalog_service.UpdateAttributesConfigRequest() + assert args[0] == request_msg def test_update_attributes_config_use_cached_wrapped_rpc(): @@ -4131,9 +4156,15 @@ async def test_update_attributes_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + catalog_service.UpdateAttributesConfigRequest(), + {}, + ], +) async def test_update_attributes_config_async( - transport: str = "grpc_asyncio", - request_type=catalog_service.UpdateAttributesConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4142,7 +4173,7 @@ async def test_update_attributes_config_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( @@ -4172,11 +4203,6 @@ async def test_update_attributes_config_async( ) -@pytest.mark.asyncio -async def test_update_attributes_config_async_from_dict(): - await test_update_attributes_config_async(request_type=dict) - - def test_update_attributes_config_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4341,8 +4367,8 @@ async def test_update_attributes_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - catalog_service.AddCatalogAttributeRequest, - dict, + catalog_service.AddCatalogAttributeRequest(), + {}, ], ) def test_add_catalog_attribute(request_type, transport: str = "grpc"): @@ -4353,7 +4379,7 @@ def test_add_catalog_attribute(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,9 +4432,10 @@ def test_add_catalog_attribute_non_empty_request_with_auto_populated_field(): client.add_catalog_attribute(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog_service.AddCatalogAttributeRequest( + request_msg = catalog_service.AddCatalogAttributeRequest( attributes_config="attributes_config_value", ) + assert args[0] == request_msg def test_add_catalog_attribute_use_cached_wrapped_rpc(): @@ -4494,9 +4521,15 @@ async def test_add_catalog_attribute_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + catalog_service.AddCatalogAttributeRequest(), + {}, + ], +) async def test_add_catalog_attribute_async( - transport: str = "grpc_asyncio", - request_type=catalog_service.AddCatalogAttributeRequest, + request_type, transport: str = "grpc_asyncio" ): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4505,7 +4538,7 @@ async def test_add_catalog_attribute_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( @@ -4535,11 +4568,6 @@ async def test_add_catalog_attribute_async( ) -@pytest.mark.asyncio -async def test_add_catalog_attribute_async_from_dict(): - await test_add_catalog_attribute_async(request_type=dict) - - def test_add_catalog_attribute_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4608,8 +4636,8 @@ async def test_add_catalog_attribute_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - catalog_service.RemoveCatalogAttributeRequest, - dict, + catalog_service.RemoveCatalogAttributeRequest(), + {}, ], ) def test_remove_catalog_attribute(request_type, transport: str = "grpc"): @@ -4620,7 +4648,7 @@ def test_remove_catalog_attribute(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4674,10 +4702,11 @@ def test_remove_catalog_attribute_non_empty_request_with_auto_populated_field(): client.remove_catalog_attribute(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog_service.RemoveCatalogAttributeRequest( + request_msg = catalog_service.RemoveCatalogAttributeRequest( attributes_config="attributes_config_value", key="key_value", ) + assert args[0] == request_msg def test_remove_catalog_attribute_use_cached_wrapped_rpc(): @@ -4763,9 +4792,15 @@ async def test_remove_catalog_attribute_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + catalog_service.RemoveCatalogAttributeRequest(), + {}, + ], +) async def test_remove_catalog_attribute_async( - transport: str = "grpc_asyncio", - request_type=catalog_service.RemoveCatalogAttributeRequest, + request_type, transport: str = "grpc_asyncio" ): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4774,7 +4809,7 @@ async def test_remove_catalog_attribute_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( @@ -4804,11 +4839,6 @@ async def test_remove_catalog_attribute_async( ) -@pytest.mark.asyncio -async def test_remove_catalog_attribute_async_from_dict(): - await test_remove_catalog_attribute_async(request_type=dict) - - def test_remove_catalog_attribute_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4877,8 +4907,8 @@ async def test_remove_catalog_attribute_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - catalog_service.BatchRemoveCatalogAttributesRequest, - dict, + catalog_service.BatchRemoveCatalogAttributesRequest(), + {}, ], ) def test_batch_remove_catalog_attributes(request_type, transport: str = "grpc"): @@ -4889,7 +4919,7 @@ def test_batch_remove_catalog_attributes(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4939,9 +4969,10 @@ def test_batch_remove_catalog_attributes_non_empty_request_with_auto_populated_f client.batch_remove_catalog_attributes(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog_service.BatchRemoveCatalogAttributesRequest( + request_msg = catalog_service.BatchRemoveCatalogAttributesRequest( attributes_config="attributes_config_value", ) + assert args[0] == request_msg def test_batch_remove_catalog_attributes_use_cached_wrapped_rpc(): @@ -5027,9 +5058,15 @@ async def test_batch_remove_catalog_attributes_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + catalog_service.BatchRemoveCatalogAttributesRequest(), + {}, + ], +) async def test_batch_remove_catalog_attributes_async( - transport: str = "grpc_asyncio", - request_type=catalog_service.BatchRemoveCatalogAttributesRequest, + request_type, transport: str = "grpc_asyncio" ): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5038,7 +5075,7 @@ async def test_batch_remove_catalog_attributes_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( @@ -5065,11 +5102,6 @@ async def test_batch_remove_catalog_attributes_async( assert response.reset_catalog_attributes == ["reset_catalog_attributes_value"] -@pytest.mark.asyncio -async def test_batch_remove_catalog_attributes_async_from_dict(): - await test_batch_remove_catalog_attributes_async(request_type=dict) - - def test_batch_remove_catalog_attributes_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5138,8 +5170,8 @@ async def test_batch_remove_catalog_attributes_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - catalog_service.ReplaceCatalogAttributeRequest, - dict, + catalog_service.ReplaceCatalogAttributeRequest(), + {}, ], ) def test_replace_catalog_attribute(request_type, transport: str = "grpc"): @@ -5150,7 +5182,7 @@ def test_replace_catalog_attribute(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5203,9 +5235,10 @@ def test_replace_catalog_attribute_non_empty_request_with_auto_populated_field() client.replace_catalog_attribute(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == catalog_service.ReplaceCatalogAttributeRequest( + request_msg = catalog_service.ReplaceCatalogAttributeRequest( attributes_config="attributes_config_value", ) + assert args[0] == request_msg def test_replace_catalog_attribute_use_cached_wrapped_rpc(): @@ -5291,9 +5324,15 @@ async def test_replace_catalog_attribute_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + catalog_service.ReplaceCatalogAttributeRequest(), + {}, + ], +) async def test_replace_catalog_attribute_async( - transport: str = "grpc_asyncio", - request_type=catalog_service.ReplaceCatalogAttributeRequest, + request_type, transport: str = "grpc_asyncio" ): client = CatalogServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5302,7 +5341,7 @@ async def test_replace_catalog_attribute_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( @@ -5332,11 +5371,6 @@ async def test_replace_catalog_attribute_async( ) -@pytest.mark.asyncio -async def test_replace_catalog_attribute_async_from_dict(): - await test_replace_catalog_attribute_async(request_type=dict) - - def test_replace_catalog_attribute_field_headers(): client = CatalogServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7451,7 +7485,6 @@ def test_list_catalogs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.ListCatalogsRequest() - assert args[0] == request_msg @@ -7472,7 +7505,6 @@ def test_update_catalog_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.UpdateCatalogRequest() - assert args[0] == request_msg @@ -7495,7 +7527,6 @@ def test_set_default_branch_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.SetDefaultBranchRequest() - assert args[0] == request_msg @@ -7518,7 +7549,6 @@ def test_get_default_branch_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.GetDefaultBranchRequest() - assert args[0] == request_msg @@ -7541,7 +7571,6 @@ def test_get_completion_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.GetCompletionConfigRequest() - assert args[0] == request_msg @@ -7564,7 +7593,6 @@ def test_update_completion_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.UpdateCompletionConfigRequest() - assert args[0] == request_msg @@ -7587,7 +7615,6 @@ def test_get_attributes_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.GetAttributesConfigRequest() - assert args[0] == request_msg @@ -7610,7 +7637,6 @@ def test_update_attributes_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.UpdateAttributesConfigRequest() - assert args[0] == request_msg @@ -7633,7 +7659,6 @@ def test_add_catalog_attribute_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.AddCatalogAttributeRequest() - assert args[0] == request_msg @@ -7656,7 +7681,6 @@ def test_remove_catalog_attribute_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.RemoveCatalogAttributeRequest() - assert args[0] == request_msg @@ -7679,7 +7703,6 @@ def test_batch_remove_catalog_attributes_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.BatchRemoveCatalogAttributesRequest() - assert args[0] == request_msg @@ -7702,7 +7725,6 @@ def test_replace_catalog_attribute_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.ReplaceCatalogAttributeRequest() - assert args[0] == request_msg @@ -7743,7 +7765,6 @@ async def test_list_catalogs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.ListCatalogsRequest() - assert args[0] == request_msg @@ -7771,7 +7792,6 @@ async def test_update_catalog_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.UpdateCatalogRequest() - assert args[0] == request_msg @@ -7796,7 +7816,6 @@ async def test_set_default_branch_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.SetDefaultBranchRequest() - assert args[0] == request_msg @@ -7826,7 +7845,6 @@ async def test_get_default_branch_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.GetDefaultBranchRequest() - assert args[0] == request_msg @@ -7862,7 +7880,6 @@ async def test_get_completion_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.GetCompletionConfigRequest() - assert args[0] == request_msg @@ -7898,7 +7915,6 @@ async def test_update_completion_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.UpdateCompletionConfigRequest() - assert args[0] == request_msg @@ -7928,7 +7944,6 @@ async def test_get_attributes_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.GetAttributesConfigRequest() - assert args[0] == request_msg @@ -7958,7 +7973,6 @@ async def test_update_attributes_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.UpdateAttributesConfigRequest() - assert args[0] == request_msg @@ -7988,7 +8002,6 @@ async def test_add_catalog_attribute_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.AddCatalogAttributeRequest() - assert args[0] == request_msg @@ -8018,7 +8031,6 @@ async def test_remove_catalog_attribute_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.RemoveCatalogAttributeRequest() - assert args[0] == request_msg @@ -8048,7 +8060,6 @@ async def test_batch_remove_catalog_attributes_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.BatchRemoveCatalogAttributesRequest() - assert args[0] == request_msg @@ -8078,7 +8089,6 @@ async def test_replace_catalog_attribute_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.ReplaceCatalogAttributeRequest() - assert args[0] == request_msg @@ -10190,7 +10200,6 @@ def test_list_catalogs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.ListCatalogsRequest() - assert args[0] == request_msg @@ -10210,7 +10219,6 @@ def test_update_catalog_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.UpdateCatalogRequest() - assert args[0] == request_msg @@ -10232,7 +10240,6 @@ def test_set_default_branch_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.SetDefaultBranchRequest() - assert args[0] == request_msg @@ -10254,7 +10261,6 @@ def test_get_default_branch_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.GetDefaultBranchRequest() - assert args[0] == request_msg @@ -10276,7 +10282,6 @@ def test_get_completion_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.GetCompletionConfigRequest() - assert args[0] == request_msg @@ -10298,7 +10303,6 @@ def test_update_completion_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.UpdateCompletionConfigRequest() - assert args[0] == request_msg @@ -10320,7 +10324,6 @@ def test_get_attributes_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.GetAttributesConfigRequest() - assert args[0] == request_msg @@ -10342,7 +10345,6 @@ def test_update_attributes_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.UpdateAttributesConfigRequest() - assert args[0] == request_msg @@ -10364,7 +10366,6 @@ def test_add_catalog_attribute_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.AddCatalogAttributeRequest() - assert args[0] == request_msg @@ -10386,7 +10387,6 @@ def test_remove_catalog_attribute_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.RemoveCatalogAttributeRequest() - assert args[0] == request_msg @@ -10408,7 +10408,6 @@ def test_batch_remove_catalog_attributes_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.BatchRemoveCatalogAttributesRequest() - assert args[0] == request_msg @@ -10430,7 +10429,6 @@ def test_replace_catalog_attribute_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = catalog_service.ReplaceCatalogAttributeRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_completion_service.py b/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_completion_service.py index b4bcdb128b74..e131dc52b235 100644 --- a/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_completion_service.py +++ b/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_completion_service.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 @@ -113,6 +114,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" @@ -1354,8 +1370,8 @@ def test_completion_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - completion_service.CompleteQueryRequest, - dict, + completion_service.CompleteQueryRequest(), + {}, ], ) def test_complete_query(request_type, transport: str = "grpc"): @@ -1366,7 +1382,7 @@ def test_complete_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(type(client.transport.complete_query), "__call__") as call: @@ -1415,7 +1431,7 @@ def test_complete_query_non_empty_request_with_auto_populated_field(): client.complete_query(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == completion_service.CompleteQueryRequest( + request_msg = completion_service.CompleteQueryRequest( catalog="catalog_value", query="query_value", visitor_id="visitor_id_value", @@ -1423,6 +1439,7 @@ def test_complete_query_non_empty_request_with_auto_populated_field(): dataset="dataset_value", entity="entity_value", ) + assert args[0] == request_msg def test_complete_query_use_cached_wrapped_rpc(): @@ -1503,10 +1520,14 @@ async def test_complete_query_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_complete_query_async( - transport: str = "grpc_asyncio", - request_type=completion_service.CompleteQueryRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + completion_service.CompleteQueryRequest(), + {}, + ], +) +async def test_complete_query_async(request_type, transport: str = "grpc_asyncio"): client = CompletionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1514,7 +1535,7 @@ async def test_complete_query_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.complete_query), "__call__") as call: @@ -1537,11 +1558,6 @@ async def test_complete_query_async( assert response.attribution_token == "attribution_token_value" -@pytest.mark.asyncio -async def test_complete_query_async_from_dict(): - await test_complete_query_async(request_type=dict) - - def test_complete_query_field_headers(): client = CompletionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1606,8 +1622,8 @@ async def test_complete_query_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - import_config.ImportCompletionDataRequest, - dict, + import_config.ImportCompletionDataRequest(), + {}, ], ) def test_import_completion_data(request_type, transport: str = "grpc"): @@ -1618,7 +1634,7 @@ def test_import_completion_data(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1664,10 +1680,11 @@ def test_import_completion_data_non_empty_request_with_auto_populated_field(): client.import_completion_data(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == import_config.ImportCompletionDataRequest( + request_msg = import_config.ImportCompletionDataRequest( parent="parent_value", notification_pubsub_topic="notification_pubsub_topic_value", ) + assert args[0] == request_msg def test_import_completion_data_use_cached_wrapped_rpc(): @@ -1763,9 +1780,15 @@ async def test_import_completion_data_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + import_config.ImportCompletionDataRequest(), + {}, + ], +) async def test_import_completion_data_async( - transport: str = "grpc_asyncio", - request_type=import_config.ImportCompletionDataRequest, + request_type, transport: str = "grpc_asyncio" ): client = CompletionServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1774,7 +1797,7 @@ async def test_import_completion_data_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( @@ -1796,11 +1819,6 @@ async def test_import_completion_data_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_import_completion_data_async_from_dict(): - await test_import_completion_data_async(request_type=dict) - - def test_import_completion_data_field_headers(): client = CompletionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2289,7 +2307,6 @@ def test_complete_query_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = completion_service.CompleteQueryRequest() - assert args[0] == request_msg @@ -2312,7 +2329,6 @@ def test_import_completion_data_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_config.ImportCompletionDataRequest() - assert args[0] == request_msg @@ -2353,7 +2369,6 @@ async def test_complete_query_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = completion_service.CompleteQueryRequest() - assert args[0] == request_msg @@ -2380,7 +2395,6 @@ async def test_import_completion_data_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_config.ImportCompletionDataRequest() - assert args[0] == request_msg @@ -2807,7 +2821,6 @@ def test_complete_query_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = completion_service.CompleteQueryRequest() - assert args[0] == request_msg @@ -2829,7 +2842,6 @@ def test_import_completion_data_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_config.ImportCompletionDataRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_control_service.py b/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_control_service.py index 27c7949a4b9d..083a01f84f47 100644 --- a/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_control_service.py +++ b/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_control_service.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 @@ -117,6 +118,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" @@ -1320,8 +1336,8 @@ def test_control_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - control_service.CreateControlRequest, - dict, + control_service.CreateControlRequest(), + {}, ], ) def test_create_control(request_type, transport: str = "grpc"): @@ -1332,7 +1348,7 @@ def test_create_control(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_control), "__call__") as call: @@ -1391,10 +1407,11 @@ def test_create_control_non_empty_request_with_auto_populated_field(): client.create_control(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == control_service.CreateControlRequest( + request_msg = control_service.CreateControlRequest( parent="parent_value", control_id="control_id_value", ) + assert args[0] == request_msg def test_create_control_use_cached_wrapped_rpc(): @@ -1475,9 +1492,14 @@ async def test_create_control_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_control_async( - transport: str = "grpc_asyncio", request_type=control_service.CreateControlRequest -): +@pytest.mark.parametrize( + "request_type", + [ + control_service.CreateControlRequest(), + {}, + ], +) +async def test_create_control_async(request_type, transport: str = "grpc_asyncio"): client = ControlServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1485,7 +1507,7 @@ async def test_create_control_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_control), "__call__") as call: @@ -1522,11 +1544,6 @@ async def test_create_control_async( ] -@pytest.mark.asyncio -async def test_create_control_async_from_dict(): - await test_create_control_async(request_type=dict) - - def test_create_control_field_headers(): client = ControlServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1725,8 +1742,8 @@ async def test_create_control_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - control_service.DeleteControlRequest, - dict, + control_service.DeleteControlRequest(), + {}, ], ) def test_delete_control(request_type, transport: str = "grpc"): @@ -1737,7 +1754,7 @@ def test_delete_control(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_control), "__call__") as call: @@ -1778,9 +1795,10 @@ def test_delete_control_non_empty_request_with_auto_populated_field(): client.delete_control(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == control_service.DeleteControlRequest( + request_msg = control_service.DeleteControlRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_control_use_cached_wrapped_rpc(): @@ -1861,9 +1879,14 @@ async def test_delete_control_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_control_async( - transport: str = "grpc_asyncio", request_type=control_service.DeleteControlRequest -): +@pytest.mark.parametrize( + "request_type", + [ + control_service.DeleteControlRequest(), + {}, + ], +) +async def test_delete_control_async(request_type, transport: str = "grpc_asyncio"): client = ControlServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1871,7 +1894,7 @@ async def test_delete_control_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_control), "__call__") as call: @@ -1889,11 +1912,6 @@ async def test_delete_control_async( assert response is None -@pytest.mark.asyncio -async def test_delete_control_async_from_dict(): - await test_delete_control_async(request_type=dict) - - def test_delete_control_field_headers(): client = ControlServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2036,8 +2054,8 @@ async def test_delete_control_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - control_service.UpdateControlRequest, - dict, + control_service.UpdateControlRequest(), + {}, ], ) def test_update_control(request_type, transport: str = "grpc"): @@ -2048,7 +2066,7 @@ def test_update_control(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_control), "__call__") as call: @@ -2104,7 +2122,8 @@ def test_update_control_non_empty_request_with_auto_populated_field(): client.update_control(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == control_service.UpdateControlRequest() + request_msg = control_service.UpdateControlRequest() + assert args[0] == request_msg def test_update_control_use_cached_wrapped_rpc(): @@ -2185,9 +2204,14 @@ async def test_update_control_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_control_async( - transport: str = "grpc_asyncio", request_type=control_service.UpdateControlRequest -): +@pytest.mark.parametrize( + "request_type", + [ + control_service.UpdateControlRequest(), + {}, + ], +) +async def test_update_control_async(request_type, transport: str = "grpc_asyncio"): client = ControlServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2195,7 +2219,7 @@ async def test_update_control_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_control), "__call__") as call: @@ -2232,11 +2256,6 @@ async def test_update_control_async( ] -@pytest.mark.asyncio -async def test_update_control_async_from_dict(): - await test_update_control_async(request_type=dict) - - def test_update_control_field_headers(): client = ControlServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2425,8 +2444,8 @@ async def test_update_control_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - control_service.GetControlRequest, - dict, + control_service.GetControlRequest(), + {}, ], ) def test_get_control(request_type, transport: str = "grpc"): @@ -2437,7 +2456,7 @@ def test_get_control(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_control), "__call__") as call: @@ -2495,9 +2514,10 @@ def test_get_control_non_empty_request_with_auto_populated_field(): client.get_control(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == control_service.GetControlRequest( + request_msg = control_service.GetControlRequest( name="name_value", ) + assert args[0] == request_msg def test_get_control_use_cached_wrapped_rpc(): @@ -2578,9 +2598,14 @@ async def test_get_control_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_control_async( - transport: str = "grpc_asyncio", request_type=control_service.GetControlRequest -): +@pytest.mark.parametrize( + "request_type", + [ + control_service.GetControlRequest(), + {}, + ], +) +async def test_get_control_async(request_type, transport: str = "grpc_asyncio"): client = ControlServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2588,7 +2613,7 @@ async def test_get_control_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_control), "__call__") as call: @@ -2625,11 +2650,6 @@ async def test_get_control_async( ] -@pytest.mark.asyncio -async def test_get_control_async_from_dict(): - await test_get_control_async(request_type=dict) - - def test_get_control_field_headers(): client = ControlServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2772,8 +2792,8 @@ async def test_get_control_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - control_service.ListControlsRequest, - dict, + control_service.ListControlsRequest(), + {}, ], ) def test_list_controls(request_type, transport: str = "grpc"): @@ -2784,7 +2804,7 @@ def test_list_controls(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_controls), "__call__") as call: @@ -2830,11 +2850,12 @@ def test_list_controls_non_empty_request_with_auto_populated_field(): client.list_controls(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == control_service.ListControlsRequest( + request_msg = control_service.ListControlsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_controls_use_cached_wrapped_rpc(): @@ -2915,9 +2936,14 @@ async def test_list_controls_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_controls_async( - transport: str = "grpc_asyncio", request_type=control_service.ListControlsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + control_service.ListControlsRequest(), + {}, + ], +) +async def test_list_controls_async(request_type, transport: str = "grpc_asyncio"): client = ControlServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2925,7 +2951,7 @@ async def test_list_controls_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_controls), "__call__") as call: @@ -2948,11 +2974,6 @@ async def test_list_controls_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_controls_async_from_dict(): - await test_list_controls_async(request_type=dict) - - def test_list_controls_field_headers(): client = ControlServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4441,7 +4462,6 @@ def test_create_control_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.CreateControlRequest() - assert args[0] == request_msg @@ -4462,7 +4482,6 @@ def test_delete_control_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.DeleteControlRequest() - assert args[0] == request_msg @@ -4483,7 +4502,6 @@ def test_update_control_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.UpdateControlRequest() - assert args[0] == request_msg @@ -4504,7 +4522,6 @@ def test_get_control_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.GetControlRequest() - assert args[0] == request_msg @@ -4525,7 +4542,6 @@ def test_list_controls_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.ListControlsRequest() - assert args[0] == request_msg @@ -4572,7 +4588,6 @@ async def test_create_control_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.CreateControlRequest() - assert args[0] == request_msg @@ -4595,7 +4610,6 @@ async def test_delete_control_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.DeleteControlRequest() - assert args[0] == request_msg @@ -4628,7 +4642,6 @@ async def test_update_control_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.UpdateControlRequest() - assert args[0] == request_msg @@ -4661,7 +4674,6 @@ async def test_get_control_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.GetControlRequest() - assert args[0] == request_msg @@ -4688,7 +4700,6 @@ async def test_list_controls_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.ListControlsRequest() - assert args[0] == request_msg @@ -5854,7 +5865,6 @@ def test_create_control_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.CreateControlRequest() - assert args[0] == request_msg @@ -5874,7 +5884,6 @@ def test_delete_control_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.DeleteControlRequest() - assert args[0] == request_msg @@ -5894,7 +5903,6 @@ def test_update_control_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.UpdateControlRequest() - assert args[0] == request_msg @@ -5914,7 +5922,6 @@ def test_get_control_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.GetControlRequest() - assert args[0] == request_msg @@ -5934,7 +5941,6 @@ def test_list_controls_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = control_service.ListControlsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_conversational_search_service.py b/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_conversational_search_service.py index 19fae25fc1fe..eec24a19b151 100644 --- a/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_conversational_search_service.py +++ b/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_conversational_search_service.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 @@ -113,6 +114,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" @@ -1419,8 +1435,8 @@ def test_conversational_search_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - conversational_search_service.ConversationalSearchRequest, - dict, + conversational_search_service.ConversationalSearchRequest(), + {}, ], ) def test_conversational_search(request_type, transport: str = "grpc"): @@ -1431,7 +1447,7 @@ def test_conversational_search(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1485,13 +1501,14 @@ def test_conversational_search_non_empty_request_with_auto_populated_field(): client.conversational_search(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversational_search_service.ConversationalSearchRequest( + request_msg = conversational_search_service.ConversationalSearchRequest( placement="placement_value", branch="branch_value", query="query_value", conversation_id="conversation_id_value", visitor_id="visitor_id_value", ) + assert args[0] == request_msg def test_conversational_search_use_cached_wrapped_rpc(): @@ -1577,9 +1594,15 @@ async def test_conversational_search_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + conversational_search_service.ConversationalSearchRequest(), + {}, + ], +) async def test_conversational_search_async( - transport: str = "grpc_asyncio", - request_type=conversational_search_service.ConversationalSearchRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConversationalSearchServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1588,7 +1611,7 @@ async def test_conversational_search_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( @@ -1614,11 +1637,6 @@ async def test_conversational_search_async( ) -@pytest.mark.asyncio -async def test_conversational_search_async_from_dict(): - await test_conversational_search_async(request_type=dict) - - def test_conversational_search_field_headers(): client = ConversationalSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1964,7 +1982,6 @@ def test_conversational_search_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.ConversationalSearchRequest() - assert args[0] == request_msg @@ -2006,7 +2023,6 @@ async def test_conversational_search_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.ConversationalSearchRequest() - assert args[0] == request_msg @@ -2334,7 +2350,6 @@ def test_conversational_search_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversational_search_service.ConversationalSearchRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_generative_question_service.py b/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_generative_question_service.py index 66b828307a5a..b978181af928 100644 --- a/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_generative_question_service.py +++ b/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_generative_question_service.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" @@ -1394,8 +1410,8 @@ def test_generative_question_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - generative_question_service.UpdateGenerativeQuestionsFeatureConfigRequest, - dict, + generative_question_service.UpdateGenerativeQuestionsFeatureConfigRequest(), + {}, ], ) def test_update_generative_questions_feature_config( @@ -1408,7 +1424,7 @@ def test_update_generative_questions_feature_config( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1462,10 +1478,10 @@ def test_update_generative_questions_feature_config_non_empty_request_with_auto_ client.update_generative_questions_feature_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert ( - args[0] - == generative_question_service.UpdateGenerativeQuestionsFeatureConfigRequest() + request_msg = ( + generative_question_service.UpdateGenerativeQuestionsFeatureConfigRequest() ) + assert args[0] == request_msg def test_update_generative_questions_feature_config_use_cached_wrapped_rpc(): @@ -1551,9 +1567,15 @@ async def test_update_generative_questions_feature_config_async_use_cached_wrapp @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + generative_question_service.UpdateGenerativeQuestionsFeatureConfigRequest(), + {}, + ], +) async def test_update_generative_questions_feature_config_async( - transport: str = "grpc_asyncio", - request_type=generative_question_service.UpdateGenerativeQuestionsFeatureConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = GenerativeQuestionServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1562,7 +1584,7 @@ async def test_update_generative_questions_feature_config_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( @@ -1593,11 +1615,6 @@ async def test_update_generative_questions_feature_config_async( assert response.minimum_products == 1743 -@pytest.mark.asyncio -async def test_update_generative_questions_feature_config_async_from_dict(): - await test_update_generative_questions_feature_config_async(request_type=dict) - - def test_update_generative_questions_feature_config_field_headers(): client = GenerativeQuestionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1778,8 +1795,8 @@ async def test_update_generative_questions_feature_config_flattened_error_async( @pytest.mark.parametrize( "request_type", [ - generative_question_service.GetGenerativeQuestionsFeatureConfigRequest, - dict, + generative_question_service.GetGenerativeQuestionsFeatureConfigRequest(), + {}, ], ) def test_get_generative_questions_feature_config(request_type, transport: str = "grpc"): @@ -1790,7 +1807,7 @@ def test_get_generative_questions_feature_config(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( @@ -1844,11 +1861,12 @@ def test_get_generative_questions_feature_config_non_empty_request_with_auto_pop client.get_generative_questions_feature_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == generative_question_service.GetGenerativeQuestionsFeatureConfigRequest( - catalog="catalog_value", + request_msg = ( + generative_question_service.GetGenerativeQuestionsFeatureConfigRequest( + catalog="catalog_value", + ) ) + assert args[0] == request_msg def test_get_generative_questions_feature_config_use_cached_wrapped_rpc(): @@ -1934,9 +1952,15 @@ async def test_get_generative_questions_feature_config_async_use_cached_wrapped_ @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + generative_question_service.GetGenerativeQuestionsFeatureConfigRequest(), + {}, + ], +) async def test_get_generative_questions_feature_config_async( - transport: str = "grpc_asyncio", - request_type=generative_question_service.GetGenerativeQuestionsFeatureConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = GenerativeQuestionServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1945,7 +1969,7 @@ async def test_get_generative_questions_feature_config_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( @@ -1976,11 +2000,6 @@ async def test_get_generative_questions_feature_config_async( assert response.minimum_products == 1743 -@pytest.mark.asyncio -async def test_get_generative_questions_feature_config_async_from_dict(): - await test_get_generative_questions_feature_config_async(request_type=dict) - - def test_get_generative_questions_feature_config_field_headers(): client = GenerativeQuestionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2135,8 +2154,8 @@ async def test_get_generative_questions_feature_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - generative_question_service.ListGenerativeQuestionConfigsRequest, - dict, + generative_question_service.ListGenerativeQuestionConfigsRequest(), + {}, ], ) def test_list_generative_question_configs(request_type, transport: str = "grpc"): @@ -2147,7 +2166,7 @@ def test_list_generative_question_configs(request_type, transport: str = "grpc") # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2196,11 +2215,10 @@ def test_list_generative_question_configs_non_empty_request_with_auto_populated_ client.list_generative_question_configs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == generative_question_service.ListGenerativeQuestionConfigsRequest( + request_msg = generative_question_service.ListGenerativeQuestionConfigsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_list_generative_question_configs_use_cached_wrapped_rpc(): @@ -2286,9 +2304,15 @@ async def test_list_generative_question_configs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + generative_question_service.ListGenerativeQuestionConfigsRequest(), + {}, + ], +) async def test_list_generative_question_configs_async( - transport: str = "grpc_asyncio", - request_type=generative_question_service.ListGenerativeQuestionConfigsRequest, + request_type, transport: str = "grpc_asyncio" ): client = GenerativeQuestionServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2297,7 +2321,7 @@ async def test_list_generative_question_configs_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( @@ -2321,11 +2345,6 @@ async def test_list_generative_question_configs_async( ) -@pytest.mark.asyncio -async def test_list_generative_question_configs_async_from_dict(): - await test_list_generative_question_configs_async(request_type=dict) - - def test_list_generative_question_configs_field_headers(): client = GenerativeQuestionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2486,8 +2505,8 @@ async def test_list_generative_question_configs_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - generative_question_service.UpdateGenerativeQuestionConfigRequest, - dict, + generative_question_service.UpdateGenerativeQuestionConfigRequest(), + {}, ], ) def test_update_generative_question_config(request_type, transport: str = "grpc"): @@ -2498,7 +2517,7 @@ def test_update_generative_question_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( @@ -2556,10 +2575,10 @@ def test_update_generative_question_config_non_empty_request_with_auto_populated client.update_generative_question_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert ( - args[0] - == generative_question_service.UpdateGenerativeQuestionConfigRequest() + request_msg = ( + generative_question_service.UpdateGenerativeQuestionConfigRequest() ) + assert args[0] == request_msg def test_update_generative_question_config_use_cached_wrapped_rpc(): @@ -2645,9 +2664,15 @@ async def test_update_generative_question_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + generative_question_service.UpdateGenerativeQuestionConfigRequest(), + {}, + ], +) async def test_update_generative_question_config_async( - transport: str = "grpc_asyncio", - request_type=generative_question_service.UpdateGenerativeQuestionConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = GenerativeQuestionServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2656,7 +2681,7 @@ async def test_update_generative_question_config_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( @@ -2693,11 +2718,6 @@ async def test_update_generative_question_config_async( assert response.allowed_in_conversation is True -@pytest.mark.asyncio -async def test_update_generative_question_config_async_from_dict(): - await test_update_generative_question_config_async(request_type=dict) - - def test_update_generative_question_config_field_headers(): client = GenerativeQuestionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2870,8 +2890,8 @@ async def test_update_generative_question_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - generative_question_service.BatchUpdateGenerativeQuestionConfigsRequest, - dict, + generative_question_service.BatchUpdateGenerativeQuestionConfigsRequest(), + {}, ], ) def test_batch_update_generative_question_configs( @@ -2884,7 +2904,7 @@ def test_batch_update_generative_question_configs( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2936,11 +2956,12 @@ def test_batch_update_generative_question_configs_non_empty_request_with_auto_po client.batch_update_generative_question_configs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == generative_question_service.BatchUpdateGenerativeQuestionConfigsRequest( - parent="parent_value", + request_msg = ( + generative_question_service.BatchUpdateGenerativeQuestionConfigsRequest( + parent="parent_value", + ) ) + assert args[0] == request_msg def test_batch_update_generative_question_configs_use_cached_wrapped_rpc(): @@ -3026,9 +3047,15 @@ async def test_batch_update_generative_question_configs_async_use_cached_wrapped @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + generative_question_service.BatchUpdateGenerativeQuestionConfigsRequest(), + {}, + ], +) async def test_batch_update_generative_question_configs_async( - transport: str = "grpc_asyncio", - request_type=generative_question_service.BatchUpdateGenerativeQuestionConfigsRequest, + request_type, transport: str = "grpc_asyncio" ): client = GenerativeQuestionServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3037,7 +3064,7 @@ async def test_batch_update_generative_question_configs_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( @@ -3064,11 +3091,6 @@ async def test_batch_update_generative_question_configs_async( ) -@pytest.mark.asyncio -async def test_batch_update_generative_question_configs_async_from_dict(): - await test_batch_update_generative_question_configs_async(request_type=dict) - - def test_batch_update_generative_question_configs_field_headers(): client = GenerativeQuestionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4412,7 +4434,6 @@ def test_update_generative_questions_feature_config_empty_call_grpc(): request_msg = ( generative_question_service.UpdateGenerativeQuestionsFeatureConfigRequest() ) - assert args[0] == request_msg @@ -4437,7 +4458,6 @@ def test_get_generative_questions_feature_config_empty_call_grpc(): request_msg = ( generative_question_service.GetGenerativeQuestionsFeatureConfigRequest() ) - assert args[0] == request_msg @@ -4462,7 +4482,6 @@ def test_list_generative_question_configs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generative_question_service.ListGenerativeQuestionConfigsRequest() - assert args[0] == request_msg @@ -4487,7 +4506,6 @@ def test_update_generative_question_config_empty_call_grpc(): request_msg = ( generative_question_service.UpdateGenerativeQuestionConfigRequest() ) - assert args[0] == request_msg @@ -4514,7 +4532,6 @@ def test_batch_update_generative_question_configs_empty_call_grpc(): request_msg = ( generative_question_service.BatchUpdateGenerativeQuestionConfigsRequest() ) - assert args[0] == request_msg @@ -4561,7 +4578,6 @@ async def test_update_generative_questions_feature_config_empty_call_grpc_asynci request_msg = ( generative_question_service.UpdateGenerativeQuestionsFeatureConfigRequest() ) - assert args[0] == request_msg @@ -4594,7 +4610,6 @@ async def test_get_generative_questions_feature_config_empty_call_grpc_asyncio() request_msg = ( generative_question_service.GetGenerativeQuestionsFeatureConfigRequest() ) - assert args[0] == request_msg @@ -4621,7 +4636,6 @@ async def test_list_generative_question_configs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generative_question_service.ListGenerativeQuestionConfigsRequest() - assert args[0] == request_msg @@ -4658,7 +4672,6 @@ async def test_update_generative_question_config_empty_call_grpc_asyncio(): request_msg = ( generative_question_service.UpdateGenerativeQuestionConfigRequest() ) - assert args[0] == request_msg @@ -4687,7 +4700,6 @@ async def test_batch_update_generative_question_configs_empty_call_grpc_asyncio( request_msg = ( generative_question_service.BatchUpdateGenerativeQuestionConfigsRequest() ) - assert args[0] == request_msg @@ -5779,7 +5791,6 @@ def test_update_generative_questions_feature_config_empty_call_rest(): request_msg = ( generative_question_service.UpdateGenerativeQuestionsFeatureConfigRequest() ) - assert args[0] == request_msg @@ -5803,7 +5814,6 @@ def test_get_generative_questions_feature_config_empty_call_rest(): request_msg = ( generative_question_service.GetGenerativeQuestionsFeatureConfigRequest() ) - assert args[0] == request_msg @@ -5825,7 +5835,6 @@ def test_list_generative_question_configs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = generative_question_service.ListGenerativeQuestionConfigsRequest() - assert args[0] == request_msg @@ -5849,7 +5858,6 @@ def test_update_generative_question_config_empty_call_rest(): request_msg = ( generative_question_service.UpdateGenerativeQuestionConfigRequest() ) - assert args[0] == request_msg @@ -5873,7 +5881,6 @@ def test_batch_update_generative_question_configs_empty_call_rest(): request_msg = ( generative_question_service.BatchUpdateGenerativeQuestionConfigsRequest() ) - assert args[0] == request_msg diff --git a/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_model_service.py b/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_model_service.py index 23c72e4ff218..05c9cc876d3d 100644 --- a/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_model_service.py +++ b/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_model_service.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 @@ -116,6 +117,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" @@ -1296,8 +1312,8 @@ def test_model_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - model_service.CreateModelRequest, - dict, + model_service.CreateModelRequest(), + {}, ], ) def test_create_model(request_type, transport: str = "grpc"): @@ -1308,7 +1324,7 @@ def test_create_model(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_model), "__call__") as call: @@ -1349,9 +1365,10 @@ def test_create_model_non_empty_request_with_auto_populated_field(): client.create_model(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == model_service.CreateModelRequest( + request_msg = model_service.CreateModelRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_model_use_cached_wrapped_rpc(): @@ -1442,9 +1459,14 @@ async def test_create_model_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_model_async( - transport: str = "grpc_asyncio", request_type=model_service.CreateModelRequest -): +@pytest.mark.parametrize( + "request_type", + [ + model_service.CreateModelRequest(), + {}, + ], +) +async def test_create_model_async(request_type, transport: str = "grpc_asyncio"): client = ModelServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1452,7 +1474,7 @@ async def test_create_model_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_model), "__call__") as call: @@ -1472,11 +1494,6 @@ async def test_create_model_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_model_async_from_dict(): - await test_create_model_async(request_type=dict) - - def test_create_model_field_headers(): client = ModelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1633,8 +1650,8 @@ async def test_create_model_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - model_service.GetModelRequest, - dict, + model_service.GetModelRequest(), + {}, ], ) def test_get_model(request_type, transport: str = "grpc"): @@ -1645,7 +1662,7 @@ def test_get_model(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_model), "__call__") as call: @@ -1713,9 +1730,10 @@ def test_get_model_non_empty_request_with_auto_populated_field(): client.get_model(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == model_service.GetModelRequest( + request_msg = model_service.GetModelRequest( name="name_value", ) + assert args[0] == request_msg def test_get_model_use_cached_wrapped_rpc(): @@ -1794,9 +1812,14 @@ async def test_get_model_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_model_async( - transport: str = "grpc_asyncio", request_type=model_service.GetModelRequest -): +@pytest.mark.parametrize( + "request_type", + [ + model_service.GetModelRequest(), + {}, + ], +) +async def test_get_model_async(request_type, transport: str = "grpc_asyncio"): client = ModelServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1804,7 +1827,7 @@ async def test_get_model_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_model), "__call__") as call: @@ -1851,11 +1874,6 @@ async def test_get_model_async( ) -@pytest.mark.asyncio -async def test_get_model_async_from_dict(): - await test_get_model_async(request_type=dict) - - def test_get_model_field_headers(): client = ModelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1998,8 +2016,8 @@ async def test_get_model_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - model_service.PauseModelRequest, - dict, + model_service.PauseModelRequest(), + {}, ], ) def test_pause_model(request_type, transport: str = "grpc"): @@ -2010,7 +2028,7 @@ def test_pause_model(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.pause_model), "__call__") as call: @@ -2078,9 +2096,10 @@ def test_pause_model_non_empty_request_with_auto_populated_field(): client.pause_model(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == model_service.PauseModelRequest( + request_msg = model_service.PauseModelRequest( name="name_value", ) + assert args[0] == request_msg def test_pause_model_use_cached_wrapped_rpc(): @@ -2161,9 +2180,14 @@ async def test_pause_model_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_pause_model_async( - transport: str = "grpc_asyncio", request_type=model_service.PauseModelRequest -): +@pytest.mark.parametrize( + "request_type", + [ + model_service.PauseModelRequest(), + {}, + ], +) +async def test_pause_model_async(request_type, transport: str = "grpc_asyncio"): client = ModelServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2171,7 +2195,7 @@ async def test_pause_model_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.pause_model), "__call__") as call: @@ -2218,11 +2242,6 @@ async def test_pause_model_async( ) -@pytest.mark.asyncio -async def test_pause_model_async_from_dict(): - await test_pause_model_async(request_type=dict) - - def test_pause_model_field_headers(): client = ModelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2365,8 +2384,8 @@ async def test_pause_model_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - model_service.ResumeModelRequest, - dict, + model_service.ResumeModelRequest(), + {}, ], ) def test_resume_model(request_type, transport: str = "grpc"): @@ -2377,7 +2396,7 @@ def test_resume_model(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.resume_model), "__call__") as call: @@ -2445,9 +2464,10 @@ def test_resume_model_non_empty_request_with_auto_populated_field(): client.resume_model(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == model_service.ResumeModelRequest( + request_msg = model_service.ResumeModelRequest( name="name_value", ) + assert args[0] == request_msg def test_resume_model_use_cached_wrapped_rpc(): @@ -2528,9 +2548,14 @@ async def test_resume_model_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_resume_model_async( - transport: str = "grpc_asyncio", request_type=model_service.ResumeModelRequest -): +@pytest.mark.parametrize( + "request_type", + [ + model_service.ResumeModelRequest(), + {}, + ], +) +async def test_resume_model_async(request_type, transport: str = "grpc_asyncio"): client = ModelServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2538,7 +2563,7 @@ async def test_resume_model_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.resume_model), "__call__") as call: @@ -2585,11 +2610,6 @@ async def test_resume_model_async( ) -@pytest.mark.asyncio -async def test_resume_model_async_from_dict(): - await test_resume_model_async(request_type=dict) - - def test_resume_model_field_headers(): client = ModelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2732,8 +2752,8 @@ async def test_resume_model_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - model_service.DeleteModelRequest, - dict, + model_service.DeleteModelRequest(), + {}, ], ) def test_delete_model(request_type, transport: str = "grpc"): @@ -2744,7 +2764,7 @@ def test_delete_model(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_model), "__call__") as call: @@ -2785,9 +2805,10 @@ def test_delete_model_non_empty_request_with_auto_populated_field(): client.delete_model(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == model_service.DeleteModelRequest( + request_msg = model_service.DeleteModelRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_model_use_cached_wrapped_rpc(): @@ -2868,9 +2889,14 @@ async def test_delete_model_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_model_async( - transport: str = "grpc_asyncio", request_type=model_service.DeleteModelRequest -): +@pytest.mark.parametrize( + "request_type", + [ + model_service.DeleteModelRequest(), + {}, + ], +) +async def test_delete_model_async(request_type, transport: str = "grpc_asyncio"): client = ModelServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2878,7 +2904,7 @@ async def test_delete_model_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_model), "__call__") as call: @@ -2896,11 +2922,6 @@ async def test_delete_model_async( assert response is None -@pytest.mark.asyncio -async def test_delete_model_async_from_dict(): - await test_delete_model_async(request_type=dict) - - def test_delete_model_field_headers(): client = ModelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3043,8 +3064,8 @@ async def test_delete_model_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - model_service.ListModelsRequest, - dict, + model_service.ListModelsRequest(), + {}, ], ) def test_list_models(request_type, transport: str = "grpc"): @@ -3055,7 +3076,7 @@ def test_list_models(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_models), "__call__") as call: @@ -3100,10 +3121,11 @@ def test_list_models_non_empty_request_with_auto_populated_field(): client.list_models(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == model_service.ListModelsRequest( + request_msg = model_service.ListModelsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_models_use_cached_wrapped_rpc(): @@ -3184,9 +3206,14 @@ async def test_list_models_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_models_async( - transport: str = "grpc_asyncio", request_type=model_service.ListModelsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + model_service.ListModelsRequest(), + {}, + ], +) +async def test_list_models_async(request_type, transport: str = "grpc_asyncio"): client = ModelServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3194,7 +3221,7 @@ async def test_list_models_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_models), "__call__") as call: @@ -3217,11 +3244,6 @@ async def test_list_models_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_models_async_from_dict(): - await test_list_models_async(request_type=dict) - - def test_list_models_field_headers(): client = ModelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3558,8 +3580,8 @@ async def test_list_models_async_pages(): @pytest.mark.parametrize( "request_type", [ - model_service.UpdateModelRequest, - dict, + model_service.UpdateModelRequest(), + {}, ], ) def test_update_model(request_type, transport: str = "grpc"): @@ -3570,7 +3592,7 @@ def test_update_model(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_model), "__call__") as call: @@ -3636,7 +3658,8 @@ def test_update_model_non_empty_request_with_auto_populated_field(): client.update_model(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == model_service.UpdateModelRequest() + request_msg = model_service.UpdateModelRequest() + assert args[0] == request_msg def test_update_model_use_cached_wrapped_rpc(): @@ -3717,9 +3740,14 @@ async def test_update_model_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_model_async( - transport: str = "grpc_asyncio", request_type=model_service.UpdateModelRequest -): +@pytest.mark.parametrize( + "request_type", + [ + model_service.UpdateModelRequest(), + {}, + ], +) +async def test_update_model_async(request_type, transport: str = "grpc_asyncio"): client = ModelServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3727,7 +3755,7 @@ async def test_update_model_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_model), "__call__") as call: @@ -3774,11 +3802,6 @@ async def test_update_model_async( ) -@pytest.mark.asyncio -async def test_update_model_async_from_dict(): - await test_update_model_async(request_type=dict) - - def test_update_model_field_headers(): client = ModelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3931,8 +3954,8 @@ async def test_update_model_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - model_service.TuneModelRequest, - dict, + model_service.TuneModelRequest(), + {}, ], ) def test_tune_model(request_type, transport: str = "grpc"): @@ -3943,7 +3966,7 @@ def test_tune_model(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.tune_model), "__call__") as call: @@ -3984,9 +4007,10 @@ def test_tune_model_non_empty_request_with_auto_populated_field(): client.tune_model(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == model_service.TuneModelRequest( + request_msg = model_service.TuneModelRequest( name="name_value", ) + assert args[0] == request_msg def test_tune_model_use_cached_wrapped_rpc(): @@ -4075,9 +4099,14 @@ async def test_tune_model_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_tune_model_async( - transport: str = "grpc_asyncio", request_type=model_service.TuneModelRequest -): +@pytest.mark.parametrize( + "request_type", + [ + model_service.TuneModelRequest(), + {}, + ], +) +async def test_tune_model_async(request_type, transport: str = "grpc_asyncio"): client = ModelServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4085,7 +4114,7 @@ async def test_tune_model_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.tune_model), "__call__") as call: @@ -4105,11 +4134,6 @@ async def test_tune_model_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_tune_model_async_from_dict(): - await test_tune_model_async(request_type=dict) - - def test_tune_model_field_headers(): client = ModelServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5897,7 +5921,6 @@ def test_create_model_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.CreateModelRequest() - assert args[0] == request_msg @@ -5918,7 +5941,6 @@ def test_get_model_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.GetModelRequest() - assert args[0] == request_msg @@ -5939,7 +5961,6 @@ def test_pause_model_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.PauseModelRequest() - assert args[0] == request_msg @@ -5960,7 +5981,6 @@ def test_resume_model_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.ResumeModelRequest() - assert args[0] == request_msg @@ -5981,7 +6001,6 @@ def test_delete_model_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.DeleteModelRequest() - assert args[0] == request_msg @@ -6002,7 +6021,6 @@ def test_list_models_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.ListModelsRequest() - assert args[0] == request_msg @@ -6023,7 +6041,6 @@ def test_update_model_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.UpdateModelRequest() - assert args[0] == request_msg @@ -6044,7 +6061,6 @@ def test_tune_model_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.TuneModelRequest() - assert args[0] == request_msg @@ -6083,7 +6099,6 @@ async def test_create_model_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.CreateModelRequest() - assert args[0] == request_msg @@ -6119,7 +6134,6 @@ async def test_get_model_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.GetModelRequest() - assert args[0] == request_msg @@ -6155,7 +6169,6 @@ async def test_pause_model_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.PauseModelRequest() - assert args[0] == request_msg @@ -6191,7 +6204,6 @@ async def test_resume_model_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.ResumeModelRequest() - assert args[0] == request_msg @@ -6214,7 +6226,6 @@ async def test_delete_model_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.DeleteModelRequest() - assert args[0] == request_msg @@ -6241,7 +6252,6 @@ async def test_list_models_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.ListModelsRequest() - assert args[0] == request_msg @@ -6277,7 +6287,6 @@ async def test_update_model_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.UpdateModelRequest() - assert args[0] == request_msg @@ -6302,7 +6311,6 @@ async def test_tune_model_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.TuneModelRequest() - assert args[0] == request_msg @@ -7769,7 +7777,6 @@ def test_create_model_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.CreateModelRequest() - assert args[0] == request_msg @@ -7789,7 +7796,6 @@ def test_get_model_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.GetModelRequest() - assert args[0] == request_msg @@ -7809,7 +7815,6 @@ def test_pause_model_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.PauseModelRequest() - assert args[0] == request_msg @@ -7829,7 +7834,6 @@ def test_resume_model_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.ResumeModelRequest() - assert args[0] == request_msg @@ -7849,7 +7853,6 @@ def test_delete_model_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.DeleteModelRequest() - assert args[0] == request_msg @@ -7869,7 +7872,6 @@ def test_list_models_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.ListModelsRequest() - assert args[0] == request_msg @@ -7889,7 +7891,6 @@ def test_update_model_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.UpdateModelRequest() - assert args[0] == request_msg @@ -7909,7 +7910,6 @@ def test_tune_model_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = model_service.TuneModelRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_prediction_service.py b/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_prediction_service.py index a31f30e795ab..251acddb333a 100644 --- a/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_prediction_service.py +++ b/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_prediction_service.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 @@ -119,6 +120,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" @@ -1360,8 +1376,8 @@ def test_prediction_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - prediction_service.PredictRequest, - dict, + prediction_service.PredictRequest(), + {}, ], ) def test_predict(request_type, transport: str = "grpc"): @@ -1372,7 +1388,7 @@ def test_predict(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.predict), "__call__") as call: @@ -1422,11 +1438,12 @@ def test_predict_non_empty_request_with_auto_populated_field(): client.predict(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == prediction_service.PredictRequest( + request_msg = prediction_service.PredictRequest( placement="placement_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_predict_use_cached_wrapped_rpc(): @@ -1505,9 +1522,14 @@ async def test_predict_async_use_cached_wrapped_rpc(transport: str = "grpc_async @pytest.mark.asyncio -async def test_predict_async( - transport: str = "grpc_asyncio", request_type=prediction_service.PredictRequest -): +@pytest.mark.parametrize( + "request_type", + [ + prediction_service.PredictRequest(), + {}, + ], +) +async def test_predict_async(request_type, transport: str = "grpc_asyncio"): client = PredictionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1515,7 +1537,7 @@ async def test_predict_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.predict), "__call__") as call: @@ -1542,11 +1564,6 @@ async def test_predict_async( assert response.validate_only is True -@pytest.mark.asyncio -async def test_predict_async_from_dict(): - await test_predict_async(request_type=dict) - - def test_predict_field_headers(): client = PredictionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1858,7 +1875,6 @@ def test_predict_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = prediction_service.PredictRequest() - assert args[0] == request_msg @@ -1901,7 +1917,6 @@ async def test_predict_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = prediction_service.PredictRequest() - assert args[0] == request_msg @@ -2204,7 +2219,6 @@ def test_predict_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = prediction_service.PredictRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_product_service.py b/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_product_service.py index 65aca24ab958..4caa72879351 100644 --- a/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_product_service.py +++ b/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_product_service.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 @@ -127,6 +128,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" @@ -1330,8 +1346,8 @@ def test_product_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - product_service.CreateProductRequest, - dict, + product_service.CreateProductRequest(), + {}, ], ) def test_create_product(request_type, transport: str = "grpc"): @@ -1342,7 +1358,7 @@ def test_create_product(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_product), "__call__") as call: @@ -1421,10 +1437,11 @@ def test_create_product_non_empty_request_with_auto_populated_field(): client.create_product(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_service.CreateProductRequest( + request_msg = product_service.CreateProductRequest( parent="parent_value", product_id="product_id_value", ) + assert args[0] == request_msg def test_create_product_use_cached_wrapped_rpc(): @@ -1505,9 +1522,14 @@ async def test_create_product_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_product_async( - transport: str = "grpc_asyncio", request_type=product_service.CreateProductRequest -): +@pytest.mark.parametrize( + "request_type", + [ + product_service.CreateProductRequest(), + {}, + ], +) +async def test_create_product_async(request_type, transport: str = "grpc_asyncio"): client = ProductServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1515,7 +1537,7 @@ async def test_create_product_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_product), "__call__") as call: @@ -1572,11 +1594,6 @@ async def test_create_product_async( assert response.conditions == ["conditions_value"] -@pytest.mark.asyncio -async def test_create_product_async_from_dict(): - await test_create_product_async(request_type=dict) - - def test_create_product_field_headers(): client = ProductServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1747,8 +1764,8 @@ async def test_create_product_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - product_service.GetProductRequest, - dict, + product_service.GetProductRequest(), + {}, ], ) def test_get_product(request_type, transport: str = "grpc"): @@ -1759,7 +1776,7 @@ def test_get_product(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_product), "__call__") as call: @@ -1837,9 +1854,10 @@ def test_get_product_non_empty_request_with_auto_populated_field(): client.get_product(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_service.GetProductRequest( + request_msg = product_service.GetProductRequest( name="name_value", ) + assert args[0] == request_msg def test_get_product_use_cached_wrapped_rpc(): @@ -1920,9 +1938,14 @@ async def test_get_product_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_product_async( - transport: str = "grpc_asyncio", request_type=product_service.GetProductRequest -): +@pytest.mark.parametrize( + "request_type", + [ + product_service.GetProductRequest(), + {}, + ], +) +async def test_get_product_async(request_type, transport: str = "grpc_asyncio"): client = ProductServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1930,7 +1953,7 @@ async def test_get_product_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_product), "__call__") as call: @@ -1987,11 +2010,6 @@ async def test_get_product_async( assert response.conditions == ["conditions_value"] -@pytest.mark.asyncio -async def test_get_product_async_from_dict(): - await test_get_product_async(request_type=dict) - - def test_get_product_field_headers(): client = ProductServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2134,8 +2152,8 @@ async def test_get_product_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - product_service.ListProductsRequest, - dict, + product_service.ListProductsRequest(), + {}, ], ) def test_list_products(request_type, transport: str = "grpc"): @@ -2146,7 +2164,7 @@ def test_list_products(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_products), "__call__") as call: @@ -2192,11 +2210,12 @@ def test_list_products_non_empty_request_with_auto_populated_field(): client.list_products(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_service.ListProductsRequest( + request_msg = product_service.ListProductsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_products_use_cached_wrapped_rpc(): @@ -2277,9 +2296,14 @@ async def test_list_products_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_products_async( - transport: str = "grpc_asyncio", request_type=product_service.ListProductsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + product_service.ListProductsRequest(), + {}, + ], +) +async def test_list_products_async(request_type, transport: str = "grpc_asyncio"): client = ProductServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2287,7 +2311,7 @@ async def test_list_products_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_products), "__call__") as call: @@ -2310,11 +2334,6 @@ async def test_list_products_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_products_async_from_dict(): - await test_list_products_async(request_type=dict) - - def test_list_products_field_headers(): client = ProductServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2651,8 +2670,8 @@ async def test_list_products_async_pages(): @pytest.mark.parametrize( "request_type", [ - product_service.UpdateProductRequest, - dict, + product_service.UpdateProductRequest(), + {}, ], ) def test_update_product(request_type, transport: str = "grpc"): @@ -2663,7 +2682,7 @@ def test_update_product(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_product), "__call__") as call: @@ -2739,7 +2758,8 @@ def test_update_product_non_empty_request_with_auto_populated_field(): client.update_product(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_service.UpdateProductRequest() + request_msg = product_service.UpdateProductRequest() + assert args[0] == request_msg def test_update_product_use_cached_wrapped_rpc(): @@ -2820,9 +2840,14 @@ async def test_update_product_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_product_async( - transport: str = "grpc_asyncio", request_type=product_service.UpdateProductRequest -): +@pytest.mark.parametrize( + "request_type", + [ + product_service.UpdateProductRequest(), + {}, + ], +) +async def test_update_product_async(request_type, transport: str = "grpc_asyncio"): client = ProductServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2830,7 +2855,7 @@ async def test_update_product_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_product), "__call__") as call: @@ -2887,11 +2912,6 @@ async def test_update_product_async( assert response.conditions == ["conditions_value"] -@pytest.mark.asyncio -async def test_update_product_async_from_dict(): - await test_update_product_async(request_type=dict) - - def test_update_product_field_headers(): client = ProductServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3052,8 +3072,8 @@ async def test_update_product_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - product_service.DeleteProductRequest, - dict, + product_service.DeleteProductRequest(), + {}, ], ) def test_delete_product(request_type, transport: str = "grpc"): @@ -3064,7 +3084,7 @@ def test_delete_product(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_product), "__call__") as call: @@ -3105,9 +3125,10 @@ def test_delete_product_non_empty_request_with_auto_populated_field(): client.delete_product(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_service.DeleteProductRequest( + request_msg = product_service.DeleteProductRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_product_use_cached_wrapped_rpc(): @@ -3188,9 +3209,14 @@ async def test_delete_product_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_product_async( - transport: str = "grpc_asyncio", request_type=product_service.DeleteProductRequest -): +@pytest.mark.parametrize( + "request_type", + [ + product_service.DeleteProductRequest(), + {}, + ], +) +async def test_delete_product_async(request_type, transport: str = "grpc_asyncio"): client = ProductServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3198,7 +3224,7 @@ async def test_delete_product_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_product), "__call__") as call: @@ -3216,11 +3242,6 @@ async def test_delete_product_async( assert response is None -@pytest.mark.asyncio -async def test_delete_product_async_from_dict(): - await test_delete_product_async(request_type=dict) - - def test_delete_product_field_headers(): client = ProductServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3363,8 +3384,8 @@ async def test_delete_product_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - purge_config.PurgeProductsRequest, - dict, + purge_config.PurgeProductsRequest(), + {}, ], ) def test_purge_products(request_type, transport: str = "grpc"): @@ -3375,7 +3396,7 @@ def test_purge_products(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.purge_products), "__call__") as call: @@ -3417,10 +3438,11 @@ def test_purge_products_non_empty_request_with_auto_populated_field(): client.purge_products(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == purge_config.PurgeProductsRequest( + request_msg = purge_config.PurgeProductsRequest( parent="parent_value", filter="filter_value", ) + assert args[0] == request_msg def test_purge_products_use_cached_wrapped_rpc(): @@ -3511,9 +3533,14 @@ async def test_purge_products_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_purge_products_async( - transport: str = "grpc_asyncio", request_type=purge_config.PurgeProductsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + purge_config.PurgeProductsRequest(), + {}, + ], +) +async def test_purge_products_async(request_type, transport: str = "grpc_asyncio"): client = ProductServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3521,7 +3548,7 @@ async def test_purge_products_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.purge_products), "__call__") as call: @@ -3541,11 +3568,6 @@ async def test_purge_products_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_purge_products_async_from_dict(): - await test_purge_products_async(request_type=dict) - - def test_purge_products_field_headers(): client = ProductServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3610,8 +3632,8 @@ async def test_purge_products_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - import_config.ImportProductsRequest, - dict, + import_config.ImportProductsRequest(), + {}, ], ) def test_import_products(request_type, transport: str = "grpc"): @@ -3622,7 +3644,7 @@ def test_import_products(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.import_products), "__call__") as call: @@ -3665,11 +3687,12 @@ def test_import_products_non_empty_request_with_auto_populated_field(): client.import_products(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == import_config.ImportProductsRequest( + request_msg = import_config.ImportProductsRequest( parent="parent_value", request_id="request_id_value", notification_pubsub_topic="notification_pubsub_topic_value", ) + assert args[0] == request_msg def test_import_products_use_cached_wrapped_rpc(): @@ -3760,9 +3783,14 @@ async def test_import_products_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_import_products_async( - transport: str = "grpc_asyncio", request_type=import_config.ImportProductsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + import_config.ImportProductsRequest(), + {}, + ], +) +async def test_import_products_async(request_type, transport: str = "grpc_asyncio"): client = ProductServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3770,7 +3798,7 @@ async def test_import_products_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.import_products), "__call__") as call: @@ -3790,11 +3818,6 @@ async def test_import_products_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_import_products_async_from_dict(): - await test_import_products_async(request_type=dict) - - def test_import_products_field_headers(): client = ProductServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3859,8 +3882,8 @@ async def test_import_products_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - export_config.ExportProductsRequest, - dict, + export_config.ExportProductsRequest(), + {}, ], ) def test_export_products(request_type, transport: str = "grpc"): @@ -3871,7 +3894,7 @@ def test_export_products(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.export_products), "__call__") as call: @@ -3913,10 +3936,11 @@ def test_export_products_non_empty_request_with_auto_populated_field(): client.export_products(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == export_config.ExportProductsRequest( + request_msg = export_config.ExportProductsRequest( parent="parent_value", filter="filter_value", ) + assert args[0] == request_msg def test_export_products_use_cached_wrapped_rpc(): @@ -4007,9 +4031,14 @@ async def test_export_products_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_export_products_async( - transport: str = "grpc_asyncio", request_type=export_config.ExportProductsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + export_config.ExportProductsRequest(), + {}, + ], +) +async def test_export_products_async(request_type, transport: str = "grpc_asyncio"): client = ProductServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4017,7 +4046,7 @@ async def test_export_products_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.export_products), "__call__") as call: @@ -4037,11 +4066,6 @@ async def test_export_products_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_export_products_async_from_dict(): - await test_export_products_async(request_type=dict) - - def test_export_products_field_headers(): client = ProductServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4106,8 +4130,8 @@ async def test_export_products_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - product_service.SetInventoryRequest, - dict, + product_service.SetInventoryRequest(), + {}, ], ) def test_set_inventory(request_type, transport: str = "grpc"): @@ -4118,7 +4142,7 @@ def test_set_inventory(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.set_inventory), "__call__") as call: @@ -4157,7 +4181,8 @@ def test_set_inventory_non_empty_request_with_auto_populated_field(): client.set_inventory(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_service.SetInventoryRequest() + request_msg = product_service.SetInventoryRequest() + assert args[0] == request_msg def test_set_inventory_use_cached_wrapped_rpc(): @@ -4248,9 +4273,14 @@ async def test_set_inventory_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_inventory_async( - transport: str = "grpc_asyncio", request_type=product_service.SetInventoryRequest -): +@pytest.mark.parametrize( + "request_type", + [ + product_service.SetInventoryRequest(), + {}, + ], +) +async def test_set_inventory_async(request_type, transport: str = "grpc_asyncio"): client = ProductServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4258,7 +4288,7 @@ async def test_set_inventory_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.set_inventory), "__call__") as call: @@ -4278,11 +4308,6 @@ async def test_set_inventory_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_set_inventory_async_from_dict(): - await test_set_inventory_async(request_type=dict) - - def test_set_inventory_field_headers(): client = ProductServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4439,8 +4464,8 @@ async def test_set_inventory_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - product_service.AddFulfillmentPlacesRequest, - dict, + product_service.AddFulfillmentPlacesRequest(), + {}, ], ) def test_add_fulfillment_places(request_type, transport: str = "grpc"): @@ -4451,7 +4476,7 @@ def test_add_fulfillment_places(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4497,10 +4522,11 @@ def test_add_fulfillment_places_non_empty_request_with_auto_populated_field(): client.add_fulfillment_places(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_service.AddFulfillmentPlacesRequest( + request_msg = product_service.AddFulfillmentPlacesRequest( product="product_value", type_="type__value", ) + assert args[0] == request_msg def test_add_fulfillment_places_use_cached_wrapped_rpc(): @@ -4596,9 +4622,15 @@ async def test_add_fulfillment_places_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + product_service.AddFulfillmentPlacesRequest(), + {}, + ], +) async def test_add_fulfillment_places_async( - transport: str = "grpc_asyncio", - request_type=product_service.AddFulfillmentPlacesRequest, + request_type, transport: str = "grpc_asyncio" ): client = ProductServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4607,7 +4639,7 @@ async def test_add_fulfillment_places_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( @@ -4629,11 +4661,6 @@ async def test_add_fulfillment_places_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_add_fulfillment_places_async_from_dict(): - await test_add_fulfillment_places_async(request_type=dict) - - def test_add_fulfillment_places_field_headers(): client = ProductServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4788,8 +4815,8 @@ async def test_add_fulfillment_places_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - product_service.RemoveFulfillmentPlacesRequest, - dict, + product_service.RemoveFulfillmentPlacesRequest(), + {}, ], ) def test_remove_fulfillment_places(request_type, transport: str = "grpc"): @@ -4800,7 +4827,7 @@ def test_remove_fulfillment_places(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4846,10 +4873,11 @@ def test_remove_fulfillment_places_non_empty_request_with_auto_populated_field() client.remove_fulfillment_places(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_service.RemoveFulfillmentPlacesRequest( + request_msg = product_service.RemoveFulfillmentPlacesRequest( product="product_value", type_="type__value", ) + assert args[0] == request_msg def test_remove_fulfillment_places_use_cached_wrapped_rpc(): @@ -4945,9 +4973,15 @@ async def test_remove_fulfillment_places_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + product_service.RemoveFulfillmentPlacesRequest(), + {}, + ], +) async def test_remove_fulfillment_places_async( - transport: str = "grpc_asyncio", - request_type=product_service.RemoveFulfillmentPlacesRequest, + request_type, transport: str = "grpc_asyncio" ): client = ProductServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4956,7 +4990,7 @@ async def test_remove_fulfillment_places_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( @@ -4978,11 +5012,6 @@ async def test_remove_fulfillment_places_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_remove_fulfillment_places_async_from_dict(): - await test_remove_fulfillment_places_async(request_type=dict) - - def test_remove_fulfillment_places_field_headers(): client = ProductServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5137,8 +5166,8 @@ async def test_remove_fulfillment_places_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - product_service.AddLocalInventoriesRequest, - dict, + product_service.AddLocalInventoriesRequest(), + {}, ], ) def test_add_local_inventories(request_type, transport: str = "grpc"): @@ -5149,7 +5178,7 @@ def test_add_local_inventories(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5194,9 +5223,10 @@ def test_add_local_inventories_non_empty_request_with_auto_populated_field(): client.add_local_inventories(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_service.AddLocalInventoriesRequest( + request_msg = product_service.AddLocalInventoriesRequest( product="product_value", ) + assert args[0] == request_msg def test_add_local_inventories_use_cached_wrapped_rpc(): @@ -5292,9 +5322,15 @@ async def test_add_local_inventories_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + product_service.AddLocalInventoriesRequest(), + {}, + ], +) async def test_add_local_inventories_async( - transport: str = "grpc_asyncio", - request_type=product_service.AddLocalInventoriesRequest, + request_type, transport: str = "grpc_asyncio" ): client = ProductServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5303,7 +5339,7 @@ async def test_add_local_inventories_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( @@ -5325,11 +5361,6 @@ async def test_add_local_inventories_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_add_local_inventories_async_from_dict(): - await test_add_local_inventories_async(request_type=dict) - - def test_add_local_inventories_field_headers(): client = ProductServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5484,8 +5515,8 @@ async def test_add_local_inventories_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - product_service.RemoveLocalInventoriesRequest, - dict, + product_service.RemoveLocalInventoriesRequest(), + {}, ], ) def test_remove_local_inventories(request_type, transport: str = "grpc"): @@ -5496,7 +5527,7 @@ def test_remove_local_inventories(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5541,9 +5572,10 @@ def test_remove_local_inventories_non_empty_request_with_auto_populated_field(): client.remove_local_inventories(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_service.RemoveLocalInventoriesRequest( + request_msg = product_service.RemoveLocalInventoriesRequest( product="product_value", ) + assert args[0] == request_msg def test_remove_local_inventories_use_cached_wrapped_rpc(): @@ -5639,9 +5671,15 @@ async def test_remove_local_inventories_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + product_service.RemoveLocalInventoriesRequest(), + {}, + ], +) async def test_remove_local_inventories_async( - transport: str = "grpc_asyncio", - request_type=product_service.RemoveLocalInventoriesRequest, + request_type, transport: str = "grpc_asyncio" ): client = ProductServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5650,7 +5688,7 @@ async def test_remove_local_inventories_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( @@ -5672,11 +5710,6 @@ async def test_remove_local_inventories_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_remove_local_inventories_async_from_dict(): - await test_remove_local_inventories_async(request_type=dict) - - def test_remove_local_inventories_field_headers(): client = ProductServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8349,7 +8382,6 @@ def test_create_product_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.CreateProductRequest() - assert args[0] == request_msg @@ -8370,7 +8402,6 @@ def test_get_product_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.GetProductRequest() - assert args[0] == request_msg @@ -8391,7 +8422,6 @@ def test_list_products_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.ListProductsRequest() - assert args[0] == request_msg @@ -8412,7 +8442,6 @@ def test_update_product_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.UpdateProductRequest() - assert args[0] == request_msg @@ -8433,7 +8462,6 @@ def test_delete_product_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.DeleteProductRequest() - assert args[0] == request_msg @@ -8454,7 +8482,6 @@ def test_purge_products_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = purge_config.PurgeProductsRequest() - assert args[0] == request_msg @@ -8475,7 +8502,6 @@ def test_import_products_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_config.ImportProductsRequest() - assert args[0] == request_msg @@ -8496,7 +8522,6 @@ def test_export_products_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = export_config.ExportProductsRequest() - assert args[0] == request_msg @@ -8517,7 +8542,6 @@ def test_set_inventory_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.SetInventoryRequest() - assert args[0] == request_msg @@ -8540,7 +8564,6 @@ def test_add_fulfillment_places_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.AddFulfillmentPlacesRequest() - assert args[0] == request_msg @@ -8563,7 +8586,6 @@ def test_remove_fulfillment_places_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.RemoveFulfillmentPlacesRequest() - assert args[0] == request_msg @@ -8586,7 +8608,6 @@ def test_add_local_inventories_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.AddLocalInventoriesRequest() - assert args[0] == request_msg @@ -8609,7 +8630,6 @@ def test_remove_local_inventories_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.RemoveLocalInventoriesRequest() - assert args[0] == request_msg @@ -8667,7 +8687,6 @@ async def test_create_product_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.CreateProductRequest() - assert args[0] == request_msg @@ -8711,7 +8730,6 @@ async def test_get_product_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.GetProductRequest() - assert args[0] == request_msg @@ -8738,7 +8756,6 @@ async def test_list_products_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.ListProductsRequest() - assert args[0] == request_msg @@ -8782,7 +8799,6 @@ async def test_update_product_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.UpdateProductRequest() - assert args[0] == request_msg @@ -8805,7 +8821,6 @@ async def test_delete_product_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.DeleteProductRequest() - assert args[0] == request_msg @@ -8830,7 +8845,6 @@ async def test_purge_products_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = purge_config.PurgeProductsRequest() - assert args[0] == request_msg @@ -8855,7 +8869,6 @@ async def test_import_products_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_config.ImportProductsRequest() - assert args[0] == request_msg @@ -8880,7 +8893,6 @@ async def test_export_products_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = export_config.ExportProductsRequest() - assert args[0] == request_msg @@ -8905,7 +8917,6 @@ async def test_set_inventory_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.SetInventoryRequest() - assert args[0] == request_msg @@ -8932,7 +8943,6 @@ async def test_add_fulfillment_places_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.AddFulfillmentPlacesRequest() - assert args[0] == request_msg @@ -8959,7 +8969,6 @@ async def test_remove_fulfillment_places_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.RemoveFulfillmentPlacesRequest() - assert args[0] == request_msg @@ -8986,7 +8995,6 @@ async def test_add_local_inventories_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.AddLocalInventoriesRequest() - assert args[0] == request_msg @@ -9013,7 +9021,6 @@ async def test_remove_local_inventories_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.RemoveLocalInventoriesRequest() - assert args[0] == request_msg @@ -11276,7 +11283,6 @@ def test_create_product_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.CreateProductRequest() - assert args[0] == request_msg @@ -11296,7 +11302,6 @@ def test_get_product_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.GetProductRequest() - assert args[0] == request_msg @@ -11316,7 +11321,6 @@ def test_list_products_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.ListProductsRequest() - assert args[0] == request_msg @@ -11336,7 +11340,6 @@ def test_update_product_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.UpdateProductRequest() - assert args[0] == request_msg @@ -11356,7 +11359,6 @@ def test_delete_product_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.DeleteProductRequest() - assert args[0] == request_msg @@ -11376,7 +11378,6 @@ def test_purge_products_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = purge_config.PurgeProductsRequest() - assert args[0] == request_msg @@ -11396,7 +11397,6 @@ def test_import_products_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_config.ImportProductsRequest() - assert args[0] == request_msg @@ -11416,7 +11416,6 @@ def test_export_products_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = export_config.ExportProductsRequest() - assert args[0] == request_msg @@ -11436,7 +11435,6 @@ def test_set_inventory_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.SetInventoryRequest() - assert args[0] == request_msg @@ -11458,7 +11456,6 @@ def test_add_fulfillment_places_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.AddFulfillmentPlacesRequest() - assert args[0] == request_msg @@ -11480,7 +11477,6 @@ def test_remove_fulfillment_places_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.RemoveFulfillmentPlacesRequest() - assert args[0] == request_msg @@ -11502,7 +11498,6 @@ def test_add_local_inventories_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.AddLocalInventoriesRequest() - assert args[0] == request_msg @@ -11524,7 +11519,6 @@ def test_remove_local_inventories_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_service.RemoveLocalInventoriesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_project_service.py b/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_project_service.py index ed38652dcedb..cd441213a451 100644 --- a/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_project_service.py +++ b/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_project_service.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 @@ -109,6 +110,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" @@ -1312,8 +1328,8 @@ def test_project_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - project_service.GetAlertConfigRequest, - dict, + project_service.GetAlertConfigRequest(), + {}, ], ) def test_get_alert_config(request_type, transport: str = "grpc"): @@ -1324,7 +1340,7 @@ def test_get_alert_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(type(client.transport.get_alert_config), "__call__") as call: @@ -1368,9 +1384,10 @@ def test_get_alert_config_non_empty_request_with_auto_populated_field(): client.get_alert_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == project_service.GetAlertConfigRequest( + request_msg = project_service.GetAlertConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_alert_config_use_cached_wrapped_rpc(): @@ -1453,9 +1470,14 @@ async def test_get_alert_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_alert_config_async( - transport: str = "grpc_asyncio", request_type=project_service.GetAlertConfigRequest -): +@pytest.mark.parametrize( + "request_type", + [ + project_service.GetAlertConfigRequest(), + {}, + ], +) +async def test_get_alert_config_async(request_type, transport: str = "grpc_asyncio"): client = ProjectServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1463,7 +1485,7 @@ async def test_get_alert_config_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_alert_config), "__call__") as call: @@ -1486,11 +1508,6 @@ async def test_get_alert_config_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_alert_config_async_from_dict(): - await test_get_alert_config_async(request_type=dict) - - def test_get_alert_config_field_headers(): client = ProjectServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1633,8 +1650,8 @@ async def test_get_alert_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - project_service.UpdateAlertConfigRequest, - dict, + project_service.UpdateAlertConfigRequest(), + {}, ], ) def test_update_alert_config(request_type, transport: str = "grpc"): @@ -1645,7 +1662,7 @@ def test_update_alert_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( @@ -1691,7 +1708,8 @@ def test_update_alert_config_non_empty_request_with_auto_populated_field(): client.update_alert_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == project_service.UpdateAlertConfigRequest() + request_msg = project_service.UpdateAlertConfigRequest() + assert args[0] == request_msg def test_update_alert_config_use_cached_wrapped_rpc(): @@ -1776,10 +1794,14 @@ async def test_update_alert_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_alert_config_async( - transport: str = "grpc_asyncio", - request_type=project_service.UpdateAlertConfigRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + project_service.UpdateAlertConfigRequest(), + {}, + ], +) +async def test_update_alert_config_async(request_type, transport: str = "grpc_asyncio"): client = ProjectServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1787,7 +1809,7 @@ async def test_update_alert_config_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( @@ -1812,11 +1834,6 @@ async def test_update_alert_config_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_update_alert_config_async_from_dict(): - await test_update_alert_config_async(request_type=dict) - - def test_update_alert_config_field_headers(): client = ProjectServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2457,7 +2474,6 @@ def test_get_alert_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = project_service.GetAlertConfigRequest() - assert args[0] == request_msg @@ -2480,7 +2496,6 @@ def test_update_alert_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = project_service.UpdateAlertConfigRequest() - assert args[0] == request_msg @@ -2521,7 +2536,6 @@ async def test_get_alert_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = project_service.GetAlertConfigRequest() - assert args[0] == request_msg @@ -2550,7 +2564,6 @@ async def test_update_alert_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = project_service.UpdateAlertConfigRequest() - assert args[0] == request_msg @@ -3054,7 +3067,6 @@ def test_get_alert_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = project_service.GetAlertConfigRequest() - assert args[0] == request_msg @@ -3076,7 +3088,6 @@ def test_update_alert_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = project_service.UpdateAlertConfigRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_search_service.py b/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_search_service.py index d674e453ca4e..e083b472164a 100644 --- a/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_search_service.py +++ b/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_search_service.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 @@ -109,6 +110,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" @@ -1308,8 +1324,8 @@ def test_search_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - search_service.SearchRequest, - dict, + search_service.SearchRequest(), + {}, ], ) def test_search(request_type, transport: str = "grpc"): @@ -1320,7 +1336,7 @@ def test_search(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.search), "__call__") as call: @@ -1385,7 +1401,7 @@ def test_search_non_empty_request_with_auto_populated_field(): client.search(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == search_service.SearchRequest( + request_msg = search_service.SearchRequest( placement="placement_value", branch="branch_value", query="query_value", @@ -1399,6 +1415,7 @@ def test_search_non_empty_request_with_auto_populated_field(): region_code="region_code_value", place_id="place_id_value", ) + assert args[0] == request_msg def test_search_use_cached_wrapped_rpc(): @@ -1477,9 +1494,14 @@ async def test_search_async_use_cached_wrapped_rpc(transport: str = "grpc_asynci @pytest.mark.asyncio -async def test_search_async( - transport: str = "grpc_asyncio", request_type=search_service.SearchRequest -): +@pytest.mark.parametrize( + "request_type", + [ + search_service.SearchRequest(), + {}, + ], +) +async def test_search_async(request_type, transport: str = "grpc_asyncio"): client = SearchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1487,7 +1509,7 @@ async def test_search_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.search), "__call__") as call: @@ -1520,11 +1542,6 @@ async def test_search_async( assert response.applied_controls == ["applied_controls_value"] -@pytest.mark.asyncio -async def test_search_async_from_dict(): - await test_search_async(request_type=dict) - - def test_search_field_headers(): client = SearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2099,7 +2116,6 @@ def test_search_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = search_service.SearchRequest() - assert args[0] == request_msg @@ -2145,7 +2161,6 @@ async def test_search_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = search_service.SearchRequest() - assert args[0] == request_msg @@ -2450,7 +2465,6 @@ def test_search_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = search_service.SearchRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_serving_config_service.py b/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_serving_config_service.py index ae8bca79c26c..b066b1c7869b 100644 --- a/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_serving_config_service.py +++ b/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_serving_config_service.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 @@ -116,6 +117,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" @@ -1379,8 +1395,8 @@ def test_serving_config_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - serving_config_service.CreateServingConfigRequest, - dict, + serving_config_service.CreateServingConfigRequest(), + {}, ], ) def test_create_serving_config(request_type, transport: str = "grpc"): @@ -1391,7 +1407,7 @@ def test_create_serving_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( @@ -1479,10 +1495,11 @@ def test_create_serving_config_non_empty_request_with_auto_populated_field(): client.create_serving_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == serving_config_service.CreateServingConfigRequest( + request_msg = serving_config_service.CreateServingConfigRequest( parent="parent_value", serving_config_id="serving_config_id_value", ) + assert args[0] == request_msg def test_create_serving_config_use_cached_wrapped_rpc(): @@ -1568,9 +1585,15 @@ async def test_create_serving_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + serving_config_service.CreateServingConfigRequest(), + {}, + ], +) async def test_create_serving_config_async( - transport: str = "grpc_asyncio", - request_type=serving_config_service.CreateServingConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = ServingConfigServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1579,7 +1602,7 @@ async def test_create_serving_config_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( @@ -1643,11 +1666,6 @@ async def test_create_serving_config_async( assert response.solution_types == [common.SolutionType.SOLUTION_TYPE_RECOMMENDATION] -@pytest.mark.asyncio -async def test_create_serving_config_async_from_dict(): - await test_create_serving_config_async(request_type=dict) - - def test_create_serving_config_field_headers(): client = ServingConfigServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1822,8 +1840,8 @@ async def test_create_serving_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - serving_config_service.DeleteServingConfigRequest, - dict, + serving_config_service.DeleteServingConfigRequest(), + {}, ], ) def test_delete_serving_config(request_type, transport: str = "grpc"): @@ -1834,7 +1852,7 @@ def test_delete_serving_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( @@ -1879,9 +1897,10 @@ def test_delete_serving_config_non_empty_request_with_auto_populated_field(): client.delete_serving_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == serving_config_service.DeleteServingConfigRequest( + request_msg = serving_config_service.DeleteServingConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_serving_config_use_cached_wrapped_rpc(): @@ -1967,9 +1986,15 @@ async def test_delete_serving_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + serving_config_service.DeleteServingConfigRequest(), + {}, + ], +) async def test_delete_serving_config_async( - transport: str = "grpc_asyncio", - request_type=serving_config_service.DeleteServingConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = ServingConfigServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1978,7 +2003,7 @@ async def test_delete_serving_config_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( @@ -1998,11 +2023,6 @@ async def test_delete_serving_config_async( assert response is None -@pytest.mark.asyncio -async def test_delete_serving_config_async_from_dict(): - await test_delete_serving_config_async(request_type=dict) - - def test_delete_serving_config_field_headers(): client = ServingConfigServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2153,8 +2173,8 @@ async def test_delete_serving_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - serving_config_service.UpdateServingConfigRequest, - dict, + serving_config_service.UpdateServingConfigRequest(), + {}, ], ) def test_update_serving_config(request_type, transport: str = "grpc"): @@ -2165,7 +2185,7 @@ def test_update_serving_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( @@ -2250,7 +2270,8 @@ def test_update_serving_config_non_empty_request_with_auto_populated_field(): client.update_serving_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == serving_config_service.UpdateServingConfigRequest() + request_msg = serving_config_service.UpdateServingConfigRequest() + assert args[0] == request_msg def test_update_serving_config_use_cached_wrapped_rpc(): @@ -2336,9 +2357,15 @@ async def test_update_serving_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + serving_config_service.UpdateServingConfigRequest(), + {}, + ], +) async def test_update_serving_config_async( - transport: str = "grpc_asyncio", - request_type=serving_config_service.UpdateServingConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = ServingConfigServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2347,7 +2374,7 @@ async def test_update_serving_config_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( @@ -2411,11 +2438,6 @@ async def test_update_serving_config_async( assert response.solution_types == [common.SolutionType.SOLUTION_TYPE_RECOMMENDATION] -@pytest.mark.asyncio -async def test_update_serving_config_async_from_dict(): - await test_update_serving_config_async(request_type=dict) - - def test_update_serving_config_field_headers(): client = ServingConfigServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2580,8 +2602,8 @@ async def test_update_serving_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - serving_config_service.GetServingConfigRequest, - dict, + serving_config_service.GetServingConfigRequest(), + {}, ], ) def test_get_serving_config(request_type, transport: str = "grpc"): @@ -2592,7 +2614,7 @@ def test_get_serving_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( @@ -2679,9 +2701,10 @@ def test_get_serving_config_non_empty_request_with_auto_populated_field(): client.get_serving_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == serving_config_service.GetServingConfigRequest( + request_msg = serving_config_service.GetServingConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_serving_config_use_cached_wrapped_rpc(): @@ -2766,10 +2789,14 @@ async def test_get_serving_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_serving_config_async( - transport: str = "grpc_asyncio", - request_type=serving_config_service.GetServingConfigRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + serving_config_service.GetServingConfigRequest(), + {}, + ], +) +async def test_get_serving_config_async(request_type, transport: str = "grpc_asyncio"): client = ServingConfigServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2777,7 +2804,7 @@ async def test_get_serving_config_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( @@ -2841,11 +2868,6 @@ async def test_get_serving_config_async( assert response.solution_types == [common.SolutionType.SOLUTION_TYPE_RECOMMENDATION] -@pytest.mark.asyncio -async def test_get_serving_config_async_from_dict(): - await test_get_serving_config_async(request_type=dict) - - def test_get_serving_config_field_headers(): client = ServingConfigServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3000,8 +3022,8 @@ async def test_get_serving_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - serving_config_service.ListServingConfigsRequest, - dict, + serving_config_service.ListServingConfigsRequest(), + {}, ], ) def test_list_serving_configs(request_type, transport: str = "grpc"): @@ -3012,7 +3034,7 @@ def test_list_serving_configs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,10 +3083,11 @@ def test_list_serving_configs_non_empty_request_with_auto_populated_field(): client.list_serving_configs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == serving_config_service.ListServingConfigsRequest( + request_msg = serving_config_service.ListServingConfigsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_serving_configs_use_cached_wrapped_rpc(): @@ -3149,9 +3172,15 @@ async def test_list_serving_configs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + serving_config_service.ListServingConfigsRequest(), + {}, + ], +) async def test_list_serving_configs_async( - transport: str = "grpc_asyncio", - request_type=serving_config_service.ListServingConfigsRequest, + request_type, transport: str = "grpc_asyncio" ): client = ServingConfigServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3160,7 +3189,7 @@ async def test_list_serving_configs_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( @@ -3185,11 +3214,6 @@ async def test_list_serving_configs_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_serving_configs_async_from_dict(): - await test_list_serving_configs_async(request_type=dict) - - def test_list_serving_configs_field_headers(): client = ServingConfigServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3542,8 +3566,8 @@ async def test_list_serving_configs_async_pages(): @pytest.mark.parametrize( "request_type", [ - serving_config_service.AddControlRequest, - dict, + serving_config_service.AddControlRequest(), + {}, ], ) def test_add_control(request_type, transport: str = "grpc"): @@ -3554,7 +3578,7 @@ def test_add_control(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.add_control), "__call__") as call: @@ -3638,10 +3662,11 @@ def test_add_control_non_empty_request_with_auto_populated_field(): client.add_control(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == serving_config_service.AddControlRequest( + request_msg = serving_config_service.AddControlRequest( serving_config="serving_config_value", control_id="control_id_value", ) + assert args[0] == request_msg def test_add_control_use_cached_wrapped_rpc(): @@ -3722,10 +3747,14 @@ async def test_add_control_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_add_control_async( - transport: str = "grpc_asyncio", - request_type=serving_config_service.AddControlRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + serving_config_service.AddControlRequest(), + {}, + ], +) +async def test_add_control_async(request_type, transport: str = "grpc_asyncio"): client = ServingConfigServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3733,7 +3762,7 @@ async def test_add_control_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.add_control), "__call__") as call: @@ -3795,11 +3824,6 @@ async def test_add_control_async( assert response.solution_types == [common.SolutionType.SOLUTION_TYPE_RECOMMENDATION] -@pytest.mark.asyncio -async def test_add_control_async_from_dict(): - await test_add_control_async(request_type=dict) - - def test_add_control_field_headers(): client = ServingConfigServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3946,8 +3970,8 @@ async def test_add_control_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - serving_config_service.RemoveControlRequest, - dict, + serving_config_service.RemoveControlRequest(), + {}, ], ) def test_remove_control(request_type, transport: str = "grpc"): @@ -3958,7 +3982,7 @@ def test_remove_control(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.remove_control), "__call__") as call: @@ -4042,10 +4066,11 @@ def test_remove_control_non_empty_request_with_auto_populated_field(): client.remove_control(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == serving_config_service.RemoveControlRequest( + request_msg = serving_config_service.RemoveControlRequest( serving_config="serving_config_value", control_id="control_id_value", ) + assert args[0] == request_msg def test_remove_control_use_cached_wrapped_rpc(): @@ -4126,10 +4151,14 @@ async def test_remove_control_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_remove_control_async( - transport: str = "grpc_asyncio", - request_type=serving_config_service.RemoveControlRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + serving_config_service.RemoveControlRequest(), + {}, + ], +) +async def test_remove_control_async(request_type, transport: str = "grpc_asyncio"): client = ServingConfigServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4137,7 +4166,7 @@ async def test_remove_control_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.remove_control), "__call__") as call: @@ -4199,11 +4228,6 @@ async def test_remove_control_async( assert response.solution_types == [common.SolutionType.SOLUTION_TYPE_RECOMMENDATION] -@pytest.mark.asyncio -async def test_remove_control_async_from_dict(): - await test_remove_control_async(request_type=dict) - - def test_remove_control_field_headers(): client = ServingConfigServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5892,7 +5916,6 @@ def test_create_serving_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.CreateServingConfigRequest() - assert args[0] == request_msg @@ -5915,7 +5938,6 @@ def test_delete_serving_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.DeleteServingConfigRequest() - assert args[0] == request_msg @@ -5938,7 +5960,6 @@ def test_update_serving_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.UpdateServingConfigRequest() - assert args[0] == request_msg @@ -5961,7 +5982,6 @@ def test_get_serving_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.GetServingConfigRequest() - assert args[0] == request_msg @@ -5984,7 +6004,6 @@ def test_list_serving_configs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.ListServingConfigsRequest() - assert args[0] == request_msg @@ -6005,7 +6024,6 @@ def test_add_control_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.AddControlRequest() - assert args[0] == request_msg @@ -6026,7 +6044,6 @@ def test_remove_control_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.RemoveControlRequest() - assert args[0] == request_msg @@ -6086,7 +6103,6 @@ async def test_create_serving_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.CreateServingConfigRequest() - assert args[0] == request_msg @@ -6111,7 +6127,6 @@ async def test_delete_serving_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.DeleteServingConfigRequest() - assert args[0] == request_msg @@ -6157,7 +6172,6 @@ async def test_update_serving_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.UpdateServingConfigRequest() - assert args[0] == request_msg @@ -6203,7 +6217,6 @@ async def test_get_serving_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.GetServingConfigRequest() - assert args[0] == request_msg @@ -6232,7 +6245,6 @@ async def test_list_serving_configs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.ListServingConfigsRequest() - assert args[0] == request_msg @@ -6276,7 +6288,6 @@ async def test_add_control_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.AddControlRequest() - assert args[0] == request_msg @@ -6320,7 +6331,6 @@ async def test_remove_control_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.RemoveControlRequest() - assert args[0] == request_msg @@ -7843,7 +7853,6 @@ def test_create_serving_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.CreateServingConfigRequest() - assert args[0] == request_msg @@ -7865,7 +7874,6 @@ def test_delete_serving_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.DeleteServingConfigRequest() - assert args[0] == request_msg @@ -7887,7 +7895,6 @@ def test_update_serving_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.UpdateServingConfigRequest() - assert args[0] == request_msg @@ -7909,7 +7916,6 @@ def test_get_serving_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.GetServingConfigRequest() - assert args[0] == request_msg @@ -7931,7 +7937,6 @@ def test_list_serving_configs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.ListServingConfigsRequest() - assert args[0] == request_msg @@ -7951,7 +7956,6 @@ def test_add_control_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.AddControlRequest() - assert args[0] == request_msg @@ -7971,7 +7975,6 @@ def test_remove_control_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serving_config_service.RemoveControlRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_user_event_service.py b/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_user_event_service.py index 98269b25cb97..d24e9568a99b 100644 --- a/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_user_event_service.py +++ b/packages/google-cloud-retail/tests/unit/gapic/retail_v2beta/test_user_event_service.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 @@ -128,6 +129,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" @@ -1361,8 +1377,8 @@ def test_user_event_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - user_event_service.WriteUserEventRequest, - dict, + user_event_service.WriteUserEventRequest(), + {}, ], ) def test_write_user_event(request_type, transport: str = "grpc"): @@ -1373,7 +1389,7 @@ def test_write_user_event(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.write_user_event), "__call__") as call: @@ -1445,9 +1461,10 @@ def test_write_user_event_non_empty_request_with_auto_populated_field(): client.write_user_event(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == user_event_service.WriteUserEventRequest( + request_msg = user_event_service.WriteUserEventRequest( parent="parent_value", ) + assert args[0] == request_msg def test_write_user_event_use_cached_wrapped_rpc(): @@ -1530,10 +1547,14 @@ async def test_write_user_event_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_write_user_event_async( - transport: str = "grpc_asyncio", - request_type=user_event_service.WriteUserEventRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + user_event_service.WriteUserEventRequest(), + {}, + ], +) +async def test_write_user_event_async(request_type, transport: str = "grpc_asyncio"): client = UserEventServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1541,7 +1562,7 @@ async def test_write_user_event_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.write_user_event), "__call__") as call: @@ -1592,11 +1613,6 @@ async def test_write_user_event_async( assert response.entity == "entity_value" -@pytest.mark.asyncio -async def test_write_user_event_async_from_dict(): - await test_write_user_event_async(request_type=dict) - - def test_write_user_event_field_headers(): client = UserEventServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1661,8 +1677,8 @@ async def test_write_user_event_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - user_event_service.CollectUserEventRequest, - dict, + user_event_service.CollectUserEventRequest(), + {}, ], ) def test_collect_user_event(request_type, transport: str = "grpc"): @@ -1673,7 +1689,7 @@ def test_collect_user_event(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1727,13 +1743,14 @@ def test_collect_user_event_non_empty_request_with_auto_populated_field(): client.collect_user_event(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == user_event_service.CollectUserEventRequest( + request_msg = user_event_service.CollectUserEventRequest( prebuilt_rule="prebuilt_rule_value", parent="parent_value", user_event="user_event_value", uri="uri_value", raw_json="raw_json_value", ) + assert args[0] == request_msg def test_collect_user_event_use_cached_wrapped_rpc(): @@ -1818,10 +1835,14 @@ async def test_collect_user_event_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_collect_user_event_async( - transport: str = "grpc_asyncio", - request_type=user_event_service.CollectUserEventRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + user_event_service.CollectUserEventRequest(), + {}, + ], +) +async def test_collect_user_event_async(request_type, transport: str = "grpc_asyncio"): client = UserEventServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1829,7 +1850,7 @@ async def test_collect_user_event_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( @@ -1856,11 +1877,6 @@ async def test_collect_user_event_async( assert response.data == b"data_blob" -@pytest.mark.asyncio -async def test_collect_user_event_async_from_dict(): - await test_collect_user_event_async(request_type=dict) - - def test_collect_user_event_field_headers(): client = UserEventServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1929,8 +1945,8 @@ async def test_collect_user_event_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - purge_config.PurgeUserEventsRequest, - dict, + purge_config.PurgeUserEventsRequest(), + {}, ], ) def test_purge_user_events(request_type, transport: str = "grpc"): @@ -1941,7 +1957,7 @@ def test_purge_user_events(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1987,10 +2003,11 @@ def test_purge_user_events_non_empty_request_with_auto_populated_field(): client.purge_user_events(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == purge_config.PurgeUserEventsRequest( + request_msg = purge_config.PurgeUserEventsRequest( parent="parent_value", filter="filter_value", ) + assert args[0] == request_msg def test_purge_user_events_use_cached_wrapped_rpc(): @@ -2083,9 +2100,14 @@ async def test_purge_user_events_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_purge_user_events_async( - transport: str = "grpc_asyncio", request_type=purge_config.PurgeUserEventsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + purge_config.PurgeUserEventsRequest(), + {}, + ], +) +async def test_purge_user_events_async(request_type, transport: str = "grpc_asyncio"): client = UserEventServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2093,7 +2115,7 @@ async def test_purge_user_events_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( @@ -2115,11 +2137,6 @@ async def test_purge_user_events_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_purge_user_events_async_from_dict(): - await test_purge_user_events_async(request_type=dict) - - def test_purge_user_events_field_headers(): client = UserEventServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2188,8 +2205,8 @@ async def test_purge_user_events_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - import_config.ImportUserEventsRequest, - dict, + import_config.ImportUserEventsRequest(), + {}, ], ) def test_import_user_events(request_type, transport: str = "grpc"): @@ -2200,7 +2217,7 @@ def test_import_user_events(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2245,9 +2262,10 @@ def test_import_user_events_non_empty_request_with_auto_populated_field(): client.import_user_events(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == import_config.ImportUserEventsRequest( + request_msg = import_config.ImportUserEventsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_import_user_events_use_cached_wrapped_rpc(): @@ -2342,9 +2360,14 @@ async def test_import_user_events_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_import_user_events_async( - transport: str = "grpc_asyncio", request_type=import_config.ImportUserEventsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + import_config.ImportUserEventsRequest(), + {}, + ], +) +async def test_import_user_events_async(request_type, transport: str = "grpc_asyncio"): client = UserEventServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2352,7 +2375,7 @@ async def test_import_user_events_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( @@ -2374,11 +2397,6 @@ async def test_import_user_events_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_import_user_events_async_from_dict(): - await test_import_user_events_async(request_type=dict) - - def test_import_user_events_field_headers(): client = UserEventServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2447,8 +2465,8 @@ async def test_import_user_events_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - export_config.ExportUserEventsRequest, - dict, + export_config.ExportUserEventsRequest(), + {}, ], ) def test_export_user_events(request_type, transport: str = "grpc"): @@ -2459,7 +2477,7 @@ def test_export_user_events(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2505,10 +2523,11 @@ def test_export_user_events_non_empty_request_with_auto_populated_field(): client.export_user_events(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == export_config.ExportUserEventsRequest( + request_msg = export_config.ExportUserEventsRequest( parent="parent_value", filter="filter_value", ) + assert args[0] == request_msg def test_export_user_events_use_cached_wrapped_rpc(): @@ -2603,9 +2622,14 @@ async def test_export_user_events_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_export_user_events_async( - transport: str = "grpc_asyncio", request_type=export_config.ExportUserEventsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + export_config.ExportUserEventsRequest(), + {}, + ], +) +async def test_export_user_events_async(request_type, transport: str = "grpc_asyncio"): client = UserEventServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2613,7 +2637,7 @@ async def test_export_user_events_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( @@ -2635,11 +2659,6 @@ async def test_export_user_events_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_export_user_events_async_from_dict(): - await test_export_user_events_async(request_type=dict) - - def test_export_user_events_field_headers(): client = UserEventServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2708,8 +2727,8 @@ async def test_export_user_events_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - user_event_service.RejoinUserEventsRequest, - dict, + user_event_service.RejoinUserEventsRequest(), + {}, ], ) def test_rejoin_user_events(request_type, transport: str = "grpc"): @@ -2720,7 +2739,7 @@ def test_rejoin_user_events(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2765,9 +2784,10 @@ def test_rejoin_user_events_non_empty_request_with_auto_populated_field(): client.rejoin_user_events(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == user_event_service.RejoinUserEventsRequest( + request_msg = user_event_service.RejoinUserEventsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_rejoin_user_events_use_cached_wrapped_rpc(): @@ -2862,10 +2882,14 @@ async def test_rejoin_user_events_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_rejoin_user_events_async( - transport: str = "grpc_asyncio", - request_type=user_event_service.RejoinUserEventsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + user_event_service.RejoinUserEventsRequest(), + {}, + ], +) +async def test_rejoin_user_events_async(request_type, transport: str = "grpc_asyncio"): client = UserEventServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2873,7 +2897,7 @@ async def test_rejoin_user_events_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( @@ -2895,11 +2919,6 @@ async def test_rejoin_user_events_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_rejoin_user_events_async_from_dict(): - await test_rejoin_user_events_async(request_type=dict) - - def test_rejoin_user_events_field_headers(): client = UserEventServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3912,7 +3931,6 @@ def test_write_user_event_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_event_service.WriteUserEventRequest() - assert args[0] == request_msg @@ -3935,7 +3953,6 @@ def test_collect_user_event_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_event_service.CollectUserEventRequest() - assert args[0] == request_msg @@ -3958,7 +3975,6 @@ def test_purge_user_events_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = purge_config.PurgeUserEventsRequest() - assert args[0] == request_msg @@ -3981,7 +3997,6 @@ def test_import_user_events_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_config.ImportUserEventsRequest() - assert args[0] == request_msg @@ -4004,7 +4019,6 @@ def test_export_user_events_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = export_config.ExportUserEventsRequest() - assert args[0] == request_msg @@ -4027,7 +4041,6 @@ def test_rejoin_user_events_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_event_service.RejoinUserEventsRequest() - assert args[0] == request_msg @@ -4082,7 +4095,6 @@ async def test_write_user_event_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_event_service.WriteUserEventRequest() - assert args[0] == request_msg @@ -4112,7 +4124,6 @@ async def test_collect_user_event_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_event_service.CollectUserEventRequest() - assert args[0] == request_msg @@ -4139,7 +4150,6 @@ async def test_purge_user_events_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = purge_config.PurgeUserEventsRequest() - assert args[0] == request_msg @@ -4166,7 +4176,6 @@ async def test_import_user_events_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_config.ImportUserEventsRequest() - assert args[0] == request_msg @@ -4193,7 +4202,6 @@ async def test_export_user_events_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = export_config.ExportUserEventsRequest() - assert args[0] == request_msg @@ -4220,7 +4228,6 @@ async def test_rejoin_user_events_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_event_service.RejoinUserEventsRequest() - assert args[0] == request_msg @@ -5370,7 +5377,6 @@ def test_write_user_event_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_event_service.WriteUserEventRequest() - assert args[0] == request_msg @@ -5392,7 +5398,6 @@ def test_collect_user_event_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_event_service.CollectUserEventRequest() - assert args[0] == request_msg @@ -5414,7 +5419,6 @@ def test_purge_user_events_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = purge_config.PurgeUserEventsRequest() - assert args[0] == request_msg @@ -5436,7 +5440,6 @@ def test_import_user_events_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = import_config.ImportUserEventsRequest() - assert args[0] == request_msg @@ -5458,7 +5461,6 @@ def test_export_user_events_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = export_config.ExportUserEventsRequest() - assert args[0] == request_msg @@ -5480,7 +5482,6 @@ def test_rejoin_user_events_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user_event_service.RejoinUserEventsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-run/noxfile.py b/packages/google-cloud-run/noxfile.py index 06ffbf7f9893..4c75b5e990d9 100644 --- a/packages/google-cloud-run/noxfile.py +++ b/packages/google-cloud-run/noxfile.py @@ -47,7 +47,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-run" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-run/setup.py b/packages/google-cloud-run/setup.py index c09f14874677..ff8b20df8c5d 100644 --- a/packages/google-cloud-run/setup.py +++ b/packages/google-cloud-run/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/google-cloud-run/testing/constraints-3.10.txt b/packages/google-cloud-run/testing/constraints-3.10.txt index a92801e1c8e2..b39cd54634f9 100644 --- a/packages/google-cloud-run/testing/constraints-3.10.txt +++ b/packages/google-cloud-run/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/google-cloud-run/tests/unit/gapic/run_v2/test_builds.py b/packages/google-cloud-run/tests/unit/gapic/run_v2/test_builds.py index 3a263df6f67e..994b1312435d 100644 --- a/packages/google-cloud-run/tests/unit/gapic/run_v2/test_builds.py +++ b/packages/google-cloud-run/tests/unit/gapic/run_v2/test_builds.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 @@ -110,6 +111,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" @@ -1242,8 +1258,8 @@ def test_builds_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - build.SubmitBuildRequest, - dict, + build.SubmitBuildRequest(), + {}, ], ) def test_submit_build(request_type, transport: str = "grpc"): @@ -1254,7 +1270,7 @@ def test_submit_build(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.submit_build), "__call__") as call: @@ -1305,7 +1321,7 @@ def test_submit_build_non_empty_request_with_auto_populated_field(): client.submit_build(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == build.SubmitBuildRequest( + request_msg = build.SubmitBuildRequest( parent="parent_value", image_uri="image_uri_value", service_account="service_account_value", @@ -1313,6 +1329,7 @@ def test_submit_build_non_empty_request_with_auto_populated_field(): machine_type="machine_type_value", client="client_value", ) + assert args[0] == request_msg def test_submit_build_use_cached_wrapped_rpc(): @@ -1393,9 +1410,14 @@ async def test_submit_build_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_submit_build_async( - transport: str = "grpc_asyncio", request_type=build.SubmitBuildRequest -): +@pytest.mark.parametrize( + "request_type", + [ + build.SubmitBuildRequest(), + {}, + ], +) +async def test_submit_build_async(request_type, transport: str = "grpc_asyncio"): client = BuildsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1403,7 +1425,7 @@ async def test_submit_build_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.submit_build), "__call__") as call: @@ -1428,11 +1450,6 @@ async def test_submit_build_async( assert response.base_image_warning == "base_image_warning_value" -@pytest.mark.asyncio -async def test_submit_build_async_from_dict(): - await test_submit_build_async(request_type=dict) - - def test_submit_build_field_headers(): client = BuildsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1749,7 +1766,6 @@ def test_submit_build_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = build.SubmitBuildRequest() - assert args[0] == request_msg @@ -1791,7 +1807,6 @@ async def test_submit_build_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = build.SubmitBuildRequest() - assert args[0] == request_msg @@ -2201,7 +2216,6 @@ def test_submit_build_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = build.SubmitBuildRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-run/tests/unit/gapic/run_v2/test_executions.py b/packages/google-cloud-run/tests/unit/gapic/run_v2/test_executions.py index dbd2979b0cd6..2c04c5b68ab4 100644 --- a/packages/google-cloud-run/tests/unit/gapic/run_v2/test_executions.py +++ b/packages/google-cloud-run/tests/unit/gapic/run_v2/test_executions.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 @@ -115,6 +116,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" @@ -1276,8 +1292,8 @@ def test_executions_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - execution.GetExecutionRequest, - dict, + execution.GetExecutionRequest(), + {}, ], ) def test_get_execution(request_type, transport: str = "grpc"): @@ -1288,7 +1304,7 @@ def test_get_execution(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_execution), "__call__") as call: @@ -1366,9 +1382,10 @@ def test_get_execution_non_empty_request_with_auto_populated_field(): client.get_execution(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == execution.GetExecutionRequest( + request_msg = execution.GetExecutionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_execution_use_cached_wrapped_rpc(): @@ -1449,9 +1466,14 @@ async def test_get_execution_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_execution_async( - transport: str = "grpc_asyncio", request_type=execution.GetExecutionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + execution.GetExecutionRequest(), + {}, + ], +) +async def test_get_execution_async(request_type, transport: str = "grpc_asyncio"): client = ExecutionsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1459,7 +1481,7 @@ async def test_get_execution_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_execution), "__call__") as call: @@ -1516,11 +1538,6 @@ async def test_get_execution_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_execution_async_from_dict(): - await test_get_execution_async(request_type=dict) - - def test_get_execution_field_headers(): client = ExecutionsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1663,8 +1680,8 @@ async def test_get_execution_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - execution.ListExecutionsRequest, - dict, + execution.ListExecutionsRequest(), + {}, ], ) def test_list_executions(request_type, transport: str = "grpc"): @@ -1675,7 +1692,7 @@ def test_list_executions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_executions), "__call__") as call: @@ -1720,10 +1737,11 @@ def test_list_executions_non_empty_request_with_auto_populated_field(): client.list_executions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == execution.ListExecutionsRequest( + request_msg = execution.ListExecutionsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_executions_use_cached_wrapped_rpc(): @@ -1804,9 +1822,14 @@ async def test_list_executions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_executions_async( - transport: str = "grpc_asyncio", request_type=execution.ListExecutionsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + execution.ListExecutionsRequest(), + {}, + ], +) +async def test_list_executions_async(request_type, transport: str = "grpc_asyncio"): client = ExecutionsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1814,7 +1837,7 @@ async def test_list_executions_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_executions), "__call__") as call: @@ -1837,11 +1860,6 @@ async def test_list_executions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_executions_async_from_dict(): - await test_list_executions_async(request_type=dict) - - def test_list_executions_field_headers(): client = ExecutionsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2178,8 +2196,8 @@ async def test_list_executions_async_pages(): @pytest.mark.parametrize( "request_type", [ - execution.DeleteExecutionRequest, - dict, + execution.DeleteExecutionRequest(), + {}, ], ) def test_delete_execution(request_type, transport: str = "grpc"): @@ -2190,7 +2208,7 @@ def test_delete_execution(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_execution), "__call__") as call: @@ -2232,10 +2250,11 @@ def test_delete_execution_non_empty_request_with_auto_populated_field(): client.delete_execution(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == execution.DeleteExecutionRequest( + request_msg = execution.DeleteExecutionRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_execution_use_cached_wrapped_rpc(): @@ -2328,9 +2347,14 @@ async def test_delete_execution_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_execution_async( - transport: str = "grpc_asyncio", request_type=execution.DeleteExecutionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + execution.DeleteExecutionRequest(), + {}, + ], +) +async def test_delete_execution_async(request_type, transport: str = "grpc_asyncio"): client = ExecutionsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2338,7 +2362,7 @@ async def test_delete_execution_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_execution), "__call__") as call: @@ -2358,11 +2382,6 @@ async def test_delete_execution_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_execution_async_from_dict(): - await test_delete_execution_async(request_type=dict) - - def test_delete_execution_field_headers(): client = ExecutionsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2509,8 +2528,8 @@ async def test_delete_execution_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - execution.CancelExecutionRequest, - dict, + execution.CancelExecutionRequest(), + {}, ], ) def test_cancel_execution(request_type, transport: str = "grpc"): @@ -2521,7 +2540,7 @@ def test_cancel_execution(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.cancel_execution), "__call__") as call: @@ -2563,10 +2582,11 @@ def test_cancel_execution_non_empty_request_with_auto_populated_field(): client.cancel_execution(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == execution.CancelExecutionRequest( + request_msg = execution.CancelExecutionRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_cancel_execution_use_cached_wrapped_rpc(): @@ -2659,9 +2679,14 @@ async def test_cancel_execution_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_cancel_execution_async( - transport: str = "grpc_asyncio", request_type=execution.CancelExecutionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + execution.CancelExecutionRequest(), + {}, + ], +) +async def test_cancel_execution_async(request_type, transport: str = "grpc_asyncio"): client = ExecutionsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2669,7 +2694,7 @@ async def test_cancel_execution_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.cancel_execution), "__call__") as call: @@ -2689,11 +2714,6 @@ async def test_cancel_execution_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_cancel_execution_async_from_dict(): - await test_cancel_execution_async(request_type=dict) - - def test_cancel_execution_field_headers(): client = ExecutionsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3772,7 +3792,6 @@ def test_get_execution_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = execution.GetExecutionRequest() - assert args[0] == request_msg @@ -3793,7 +3812,6 @@ def test_list_executions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = execution.ListExecutionsRequest() - assert args[0] == request_msg @@ -3814,7 +3832,6 @@ def test_delete_execution_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = execution.DeleteExecutionRequest() - assert args[0] == request_msg @@ -3835,7 +3852,6 @@ def test_cancel_execution_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = execution.CancelExecutionRequest() - assert args[0] == request_msg @@ -3893,7 +3909,6 @@ async def test_get_execution_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = execution.GetExecutionRequest() - assert args[0] == request_msg @@ -3920,7 +3935,6 @@ async def test_list_executions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = execution.ListExecutionsRequest() - assert args[0] == request_msg @@ -3945,7 +3959,6 @@ async def test_delete_execution_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = execution.DeleteExecutionRequest() - assert args[0] == request_msg @@ -3970,7 +3983,6 @@ async def test_cancel_execution_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = execution.CancelExecutionRequest() - assert args[0] == request_msg @@ -4808,7 +4820,6 @@ def test_get_execution_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = execution.GetExecutionRequest() - assert args[0] == request_msg @@ -4828,7 +4839,6 @@ def test_list_executions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = execution.ListExecutionsRequest() - assert args[0] == request_msg @@ -4848,7 +4858,6 @@ def test_delete_execution_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = execution.DeleteExecutionRequest() - assert args[0] == request_msg @@ -4868,7 +4877,6 @@ def test_cancel_execution_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = execution.CancelExecutionRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-run/tests/unit/gapic/run_v2/test_instances.py b/packages/google-cloud-run/tests/unit/gapic/run_v2/test_instances.py index 924a34e74d52..32de2766fefd 100644 --- a/packages/google-cloud-run/tests/unit/gapic/run_v2/test_instances.py +++ b/packages/google-cloud-run/tests/unit/gapic/run_v2/test_instances.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 @@ -123,6 +124,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" @@ -1280,8 +1296,8 @@ def test_instances_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - gcr_instance.CreateInstanceRequest, - dict, + gcr_instance.CreateInstanceRequest(), + {}, ], ) def test_create_instance(request_type, transport: str = "grpc"): @@ -1292,7 +1308,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(type(client.transport.create_instance), "__call__") as call: @@ -1334,10 +1350,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] == gcr_instance.CreateInstanceRequest( + request_msg = gcr_instance.CreateInstanceRequest( parent="parent_value", instance_id="instance_id_value", ) + assert args[0] == request_msg def test_create_instance_use_cached_wrapped_rpc(): @@ -1428,9 +1445,14 @@ async def test_create_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_instance_async( - transport: str = "grpc_asyncio", request_type=gcr_instance.CreateInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcr_instance.CreateInstanceRequest(), + {}, + ], +) +async def test_create_instance_async(request_type, transport: str = "grpc_asyncio"): client = InstancesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1438,7 +1460,7 @@ async def test_create_instance_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_instance), "__call__") as call: @@ -1458,11 +1480,6 @@ async def test_create_instance_async( 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_flattened(): client = InstancesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1558,8 +1575,8 @@ async def test_create_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - instance.DeleteInstanceRequest, - dict, + instance.DeleteInstanceRequest(), + {}, ], ) def test_delete_instance(request_type, transport: str = "grpc"): @@ -1570,7 +1587,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(type(client.transport.delete_instance), "__call__") as call: @@ -1612,10 +1629,11 @@ 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] == instance.DeleteInstanceRequest( + request_msg = instance.DeleteInstanceRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_instance_use_cached_wrapped_rpc(): @@ -1706,9 +1724,14 @@ async def test_delete_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_instance_async( - transport: str = "grpc_asyncio", request_type=instance.DeleteInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + instance.DeleteInstanceRequest(), + {}, + ], +) +async def test_delete_instance_async(request_type, transport: str = "grpc_asyncio"): client = InstancesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1716,7 +1739,7 @@ async def test_delete_instance_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_instance), "__call__") as call: @@ -1736,11 +1759,6 @@ async def test_delete_instance_async( 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_flattened(): client = InstancesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1826,8 +1844,8 @@ async def test_delete_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - instance.GetInstanceRequest, - dict, + instance.GetInstanceRequest(), + {}, ], ) def test_get_instance(request_type, transport: str = "grpc"): @@ -1838,7 +1856,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(type(client.transport.get_instance), "__call__") as call: @@ -1927,9 +1945,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] == instance.GetInstanceRequest( + request_msg = instance.GetInstanceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_instance_use_cached_wrapped_rpc(): @@ -2010,9 +2029,14 @@ async def test_get_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_instance_async( - transport: str = "grpc_asyncio", request_type=instance.GetInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + instance.GetInstanceRequest(), + {}, + ], +) +async def test_get_instance_async(request_type, transport: str = "grpc_asyncio"): client = InstancesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2020,7 +2044,7 @@ async def test_get_instance_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_instance), "__call__") as call: @@ -2088,11 +2112,6 @@ async def test_get_instance_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_instance_async_from_dict(): - await test_get_instance_async(request_type=dict) - - def test_get_instance_flattened(): client = InstancesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2176,8 +2195,8 @@ async def test_get_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - instance.ListInstancesRequest, - dict, + instance.ListInstancesRequest(), + {}, ], ) def test_list_instances(request_type, transport: str = "grpc"): @@ -2188,7 +2207,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(type(client.transport.list_instances), "__call__") as call: @@ -2233,10 +2252,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] == instance.ListInstancesRequest( + request_msg = instance.ListInstancesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_instances_use_cached_wrapped_rpc(): @@ -2317,9 +2337,14 @@ async def test_list_instances_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_instances_async( - transport: str = "grpc_asyncio", request_type=instance.ListInstancesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + instance.ListInstancesRequest(), + {}, + ], +) +async def test_list_instances_async(request_type, transport: str = "grpc_asyncio"): client = InstancesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2327,7 +2352,7 @@ async def test_list_instances_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_instances), "__call__") as call: @@ -2350,11 +2375,6 @@ async def test_list_instances_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_instances_async_from_dict(): - await test_list_instances_async(request_type=dict) - - def test_list_instances_flattened(): client = InstancesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2627,8 +2647,8 @@ async def test_list_instances_async_pages(): @pytest.mark.parametrize( "request_type", [ - instance.StopInstanceRequest, - dict, + instance.StopInstanceRequest(), + {}, ], ) def test_stop_instance(request_type, transport: str = "grpc"): @@ -2639,7 +2659,7 @@ def test_stop_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(type(client.transport.stop_instance), "__call__") as call: @@ -2681,10 +2701,11 @@ def test_stop_instance_non_empty_request_with_auto_populated_field(): client.stop_instance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == instance.StopInstanceRequest( + request_msg = instance.StopInstanceRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_stop_instance_use_cached_wrapped_rpc(): @@ -2775,9 +2796,14 @@ async def test_stop_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_stop_instance_async( - transport: str = "grpc_asyncio", request_type=instance.StopInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + instance.StopInstanceRequest(), + {}, + ], +) +async def test_stop_instance_async(request_type, transport: str = "grpc_asyncio"): client = InstancesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2785,7 +2811,7 @@ async def test_stop_instance_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.stop_instance), "__call__") as call: @@ -2805,11 +2831,6 @@ async def test_stop_instance_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_stop_instance_async_from_dict(): - await test_stop_instance_async(request_type=dict) - - def test_stop_instance_field_headers(): client = InstancesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2956,8 +2977,8 @@ async def test_stop_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - instance.StartInstanceRequest, - dict, + instance.StartInstanceRequest(), + {}, ], ) def test_start_instance(request_type, transport: str = "grpc"): @@ -2968,7 +2989,7 @@ def test_start_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(type(client.transport.start_instance), "__call__") as call: @@ -3010,10 +3031,11 @@ def test_start_instance_non_empty_request_with_auto_populated_field(): client.start_instance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == instance.StartInstanceRequest( + request_msg = instance.StartInstanceRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_start_instance_use_cached_wrapped_rpc(): @@ -3104,9 +3126,14 @@ async def test_start_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_start_instance_async( - transport: str = "grpc_asyncio", request_type=instance.StartInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + instance.StartInstanceRequest(), + {}, + ], +) +async def test_start_instance_async(request_type, transport: str = "grpc_asyncio"): client = InstancesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3114,7 +3141,7 @@ async def test_start_instance_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.start_instance), "__call__") as call: @@ -3134,11 +3161,6 @@ async def test_start_instance_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_start_instance_async_from_dict(): - await test_start_instance_async(request_type=dict) - - def test_start_instance_field_headers(): client = InstancesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4601,7 +4623,6 @@ def test_create_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcr_instance.CreateInstanceRequest() - assert args[0] == request_msg @@ -4622,7 +4643,6 @@ def test_delete_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = instance.DeleteInstanceRequest() - assert args[0] == request_msg @@ -4643,7 +4663,6 @@ def test_get_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = instance.GetInstanceRequest() - assert args[0] == request_msg @@ -4664,7 +4683,6 @@ def test_list_instances_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = instance.ListInstancesRequest() - assert args[0] == request_msg @@ -4685,7 +4703,6 @@ def test_stop_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = instance.StopInstanceRequest() - assert args[0] == request_msg @@ -4706,7 +4723,6 @@ def test_start_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = instance.StartInstanceRequest() - assert args[0] == request_msg @@ -4727,7 +4743,6 @@ def test_create_instance_routing_parameters_request_1_grpc(): request_msg = gcr_instance.CreateInstanceRequest( **{"parent": "projects/sample1/locations/sample2"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -4755,7 +4770,6 @@ def test_delete_instance_routing_parameters_request_1_grpc(): request_msg = instance.DeleteInstanceRequest( **{"name": "projects/sample1/locations/sample2/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -4783,7 +4797,6 @@ def test_get_instance_routing_parameters_request_1_grpc(): request_msg = instance.GetInstanceRequest( **{"name": "projects/sample1/locations/sample2/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -4809,7 +4822,6 @@ def test_list_instances_routing_parameters_request_1_grpc(): request_msg = instance.ListInstancesRequest( **{"parent": "projects/sample1/locations/sample2"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -4853,7 +4865,6 @@ async def test_create_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcr_instance.CreateInstanceRequest() - assert args[0] == request_msg @@ -4878,7 +4889,6 @@ async def test_delete_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = instance.DeleteInstanceRequest() - assert args[0] == request_msg @@ -4926,7 +4936,6 @@ async def test_get_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = instance.GetInstanceRequest() - assert args[0] == request_msg @@ -4953,7 +4962,6 @@ async def test_list_instances_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = instance.ListInstancesRequest() - assert args[0] == request_msg @@ -4978,7 +4986,6 @@ async def test_stop_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = instance.StopInstanceRequest() - assert args[0] == request_msg @@ -5003,7 +5010,6 @@ async def test_start_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = instance.StartInstanceRequest() - assert args[0] == request_msg @@ -5030,7 +5036,6 @@ async def test_create_instance_routing_parameters_request_1_grpc_asyncio(): request_msg = gcr_instance.CreateInstanceRequest( **{"parent": "projects/sample1/locations/sample2"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -5062,7 +5067,6 @@ async def test_delete_instance_routing_parameters_request_1_grpc_asyncio(): request_msg = instance.DeleteInstanceRequest( **{"name": "projects/sample1/locations/sample2/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -5117,7 +5121,6 @@ async def test_get_instance_routing_parameters_request_1_grpc_asyncio(): request_msg = instance.GetInstanceRequest( **{"name": "projects/sample1/locations/sample2/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -5151,7 +5154,6 @@ async def test_list_instances_routing_parameters_request_1_grpc_asyncio(): request_msg = instance.ListInstancesRequest( **{"parent": "projects/sample1/locations/sample2"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -6436,7 +6438,6 @@ def test_create_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcr_instance.CreateInstanceRequest() - assert args[0] == request_msg @@ -6456,7 +6457,6 @@ def test_delete_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = instance.DeleteInstanceRequest() - assert args[0] == request_msg @@ -6476,7 +6476,6 @@ def test_get_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = instance.GetInstanceRequest() - assert args[0] == request_msg @@ -6496,7 +6495,6 @@ def test_list_instances_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = instance.ListInstancesRequest() - assert args[0] == request_msg @@ -6516,7 +6514,6 @@ def test_stop_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = instance.StopInstanceRequest() - assert args[0] == request_msg @@ -6536,7 +6533,6 @@ def test_start_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = instance.StartInstanceRequest() - assert args[0] == request_msg @@ -6556,7 +6552,6 @@ def test_create_instance_routing_parameters_request_1_rest(): request_msg = gcr_instance.CreateInstanceRequest( **{"parent": "projects/sample1/locations/sample2"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -6583,7 +6578,6 @@ def test_delete_instance_routing_parameters_request_1_rest(): request_msg = instance.DeleteInstanceRequest( **{"name": "projects/sample1/locations/sample2/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -6610,7 +6604,6 @@ def test_get_instance_routing_parameters_request_1_rest(): request_msg = instance.GetInstanceRequest( **{"name": "projects/sample1/locations/sample2/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -6635,7 +6628,6 @@ def test_list_instances_routing_parameters_request_1_rest(): request_msg = instance.ListInstancesRequest( **{"parent": "projects/sample1/locations/sample2"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} diff --git a/packages/google-cloud-run/tests/unit/gapic/run_v2/test_jobs.py b/packages/google-cloud-run/tests/unit/gapic/run_v2/test_jobs.py index da3d63abb50d..bb760fda5bde 100644 --- a/packages/google-cloud-run/tests/unit/gapic/run_v2/test_jobs.py +++ b/packages/google-cloud-run/tests/unit/gapic/run_v2/test_jobs.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 @@ -130,6 +131,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" @@ -1243,8 +1259,8 @@ def test_jobs_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - gcr_job.CreateJobRequest, - dict, + gcr_job.CreateJobRequest(), + {}, ], ) def test_create_job(request_type, transport: str = "grpc"): @@ -1255,7 +1271,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() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_job), "__call__") as call: @@ -1297,10 +1313,11 @@ def test_create_job_non_empty_request_with_auto_populated_field(): client.create_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcr_job.CreateJobRequest( + request_msg = gcr_job.CreateJobRequest( parent="parent_value", job_id="job_id_value", ) + assert args[0] == request_msg def test_create_job_use_cached_wrapped_rpc(): @@ -1389,9 +1406,14 @@ async def test_create_job_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_create_job_async( - transport: str = "grpc_asyncio", request_type=gcr_job.CreateJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcr_job.CreateJobRequest(), + {}, + ], +) +async def test_create_job_async(request_type, transport: str = "grpc_asyncio"): client = JobsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1399,7 +1421,7 @@ async def test_create_job_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_job), "__call__") as call: @@ -1419,11 +1441,6 @@ async def test_create_job_async( 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_flattened(): client = JobsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1529,8 +1546,8 @@ async def test_create_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - job.GetJobRequest, - dict, + job.GetJobRequest(), + {}, ], ) def test_get_job(request_type, transport: str = "grpc"): @@ -1541,7 +1558,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(type(client.transport.get_job), "__call__") as call: @@ -1610,9 +1627,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] == job.GetJobRequest( + request_msg = job.GetJobRequest( name="name_value", ) + assert args[0] == request_msg def test_get_job_use_cached_wrapped_rpc(): @@ -1691,9 +1709,14 @@ async def test_get_job_async_use_cached_wrapped_rpc(transport: str = "grpc_async @pytest.mark.asyncio -async def test_get_job_async( - transport: str = "grpc_asyncio", request_type=job.GetJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + job.GetJobRequest(), + {}, + ], +) +async def test_get_job_async(request_type, transport: str = "grpc_asyncio"): client = JobsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1701,7 +1724,7 @@ async def test_get_job_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_job), "__call__") as call: @@ -1748,11 +1771,6 @@ async def test_get_job_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_job_async_from_dict(): - await test_get_job_async(request_type=dict) - - def test_get_job_flattened(): client = JobsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1836,8 +1854,8 @@ async def test_get_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - job.ListJobsRequest, - dict, + job.ListJobsRequest(), + {}, ], ) def test_list_jobs(request_type, transport: str = "grpc"): @@ -1848,7 +1866,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(type(client.transport.list_jobs), "__call__") as call: @@ -1893,10 +1911,11 @@ 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] == job.ListJobsRequest( + request_msg = job.ListJobsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_jobs_use_cached_wrapped_rpc(): @@ -1975,9 +1994,14 @@ async def test_list_jobs_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_list_jobs_async( - transport: str = "grpc_asyncio", request_type=job.ListJobsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + job.ListJobsRequest(), + {}, + ], +) +async def test_list_jobs_async(request_type, transport: str = "grpc_asyncio"): client = JobsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1985,7 +2009,7 @@ async def test_list_jobs_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_jobs), "__call__") as call: @@ -2008,11 +2032,6 @@ async def test_list_jobs_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_jobs_async_from_dict(): - await test_list_jobs_async(request_type=dict) - - def test_list_jobs_flattened(): client = JobsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2285,8 +2304,8 @@ async def test_list_jobs_async_pages(): @pytest.mark.parametrize( "request_type", [ - gcr_job.UpdateJobRequest, - dict, + gcr_job.UpdateJobRequest(), + {}, ], ) def test_update_job(request_type, transport: str = "grpc"): @@ -2297,7 +2316,7 @@ def test_update_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(type(client.transport.update_job), "__call__") as call: @@ -2336,7 +2355,8 @@ def test_update_job_non_empty_request_with_auto_populated_field(): client.update_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcr_job.UpdateJobRequest() + request_msg = gcr_job.UpdateJobRequest() + assert args[0] == request_msg def test_update_job_use_cached_wrapped_rpc(): @@ -2425,9 +2445,14 @@ async def test_update_job_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_update_job_async( - transport: str = "grpc_asyncio", request_type=gcr_job.UpdateJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcr_job.UpdateJobRequest(), + {}, + ], +) +async def test_update_job_async(request_type, transport: str = "grpc_asyncio"): client = JobsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2435,7 +2460,7 @@ async def test_update_job_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_job), "__call__") as call: @@ -2455,11 +2480,6 @@ async def test_update_job_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_job_async_from_dict(): - await test_update_job_async(request_type=dict) - - def test_update_job_flattened(): client = JobsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2545,8 +2565,8 @@ async def test_update_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - job.DeleteJobRequest, - dict, + job.DeleteJobRequest(), + {}, ], ) def test_delete_job(request_type, transport: str = "grpc"): @@ -2557,7 +2577,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() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_job), "__call__") as call: @@ -2599,10 +2619,11 @@ def test_delete_job_non_empty_request_with_auto_populated_field(): client.delete_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == job.DeleteJobRequest( + request_msg = job.DeleteJobRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_job_use_cached_wrapped_rpc(): @@ -2691,9 +2712,14 @@ async def test_delete_job_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_delete_job_async( - transport: str = "grpc_asyncio", request_type=job.DeleteJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + job.DeleteJobRequest(), + {}, + ], +) +async def test_delete_job_async(request_type, transport: str = "grpc_asyncio"): client = JobsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2701,7 +2727,7 @@ async def test_delete_job_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_job), "__call__") as call: @@ -2721,11 +2747,6 @@ async def test_delete_job_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_job_async_from_dict(): - await test_delete_job_async(request_type=dict) - - def test_delete_job_flattened(): client = JobsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2811,8 +2832,8 @@ async def test_delete_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - job.RunJobRequest, - dict, + job.RunJobRequest(), + {}, ], ) def test_run_job(request_type, transport: str = "grpc"): @@ -2823,7 +2844,7 @@ def test_run_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(type(client.transport.run_job), "__call__") as call: @@ -2865,10 +2886,11 @@ def test_run_job_non_empty_request_with_auto_populated_field(): client.run_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == job.RunJobRequest( + request_msg = job.RunJobRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_run_job_use_cached_wrapped_rpc(): @@ -2957,9 +2979,14 @@ async def test_run_job_async_use_cached_wrapped_rpc(transport: str = "grpc_async @pytest.mark.asyncio -async def test_run_job_async( - transport: str = "grpc_asyncio", request_type=job.RunJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + job.RunJobRequest(), + {}, + ], +) +async def test_run_job_async(request_type, transport: str = "grpc_asyncio"): client = JobsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2967,7 +2994,7 @@ async def test_run_job_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.run_job), "__call__") as call: @@ -2987,11 +3014,6 @@ async def test_run_job_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_run_job_async_from_dict(): - await test_run_job_async(request_type=dict) - - def test_run_job_flattened(): client = JobsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3077,8 +3099,8 @@ async def test_run_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.GetIamPolicyRequest, - dict, + iam_policy_pb2.GetIamPolicyRequest(), + {}, ], ) def test_get_iam_policy(request_type, transport: str = "grpc"): @@ -3089,7 +3111,7 @@ def test_get_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(type(client.transport.get_iam_policy), "__call__") as call: @@ -3135,9 +3157,10 @@ def test_get_iam_policy_non_empty_request_with_auto_populated_field(): client.get_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.GetIamPolicyRequest( + request_msg = iam_policy_pb2.GetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_get_iam_policy_use_cached_wrapped_rpc(): @@ -3218,9 +3241,14 @@ async def test_get_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.GetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.GetIamPolicyRequest(), + {}, + ], +) +async def test_get_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = JobsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3228,7 +3256,7 @@ async def test_get_iam_policy_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_iam_policy), "__call__") as call: @@ -3253,11 +3281,6 @@ async def test_get_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_get_iam_policy_async_from_dict(): - await test_get_iam_policy_async(request_type=dict) - - def test_get_iam_policy_field_headers(): client = JobsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3337,8 +3360,8 @@ def test_get_iam_policy_from_dict_foreign(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.SetIamPolicyRequest, - dict, + iam_policy_pb2.SetIamPolicyRequest(), + {}, ], ) def test_set_iam_policy(request_type, transport: str = "grpc"): @@ -3349,7 +3372,7 @@ def test_set_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(type(client.transport.set_iam_policy), "__call__") as call: @@ -3395,9 +3418,10 @@ def test_set_iam_policy_non_empty_request_with_auto_populated_field(): client.set_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.SetIamPolicyRequest( + request_msg = iam_policy_pb2.SetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_set_iam_policy_use_cached_wrapped_rpc(): @@ -3478,9 +3502,14 @@ async def test_set_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.SetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.SetIamPolicyRequest(), + {}, + ], +) +async def test_set_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = JobsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3488,7 +3517,7 @@ async def test_set_iam_policy_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.set_iam_policy), "__call__") as call: @@ -3513,11 +3542,6 @@ async def test_set_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_set_iam_policy_async_from_dict(): - await test_set_iam_policy_async(request_type=dict) - - def test_set_iam_policy_field_headers(): client = JobsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3598,8 +3622,8 @@ def test_set_iam_policy_from_dict_foreign(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.TestIamPermissionsRequest, - dict, + iam_policy_pb2.TestIamPermissionsRequest(), + {}, ], ) def test_test_iam_permissions(request_type, transport: str = "grpc"): @@ -3610,7 +3634,7 @@ def test_test_iam_permissions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3658,9 +3682,10 @@ def test_test_iam_permissions_non_empty_request_with_auto_populated_field(): client.test_iam_permissions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.TestIamPermissionsRequest( + request_msg = iam_policy_pb2.TestIamPermissionsRequest( resource="resource_value", ) + assert args[0] == request_msg def test_test_iam_permissions_use_cached_wrapped_rpc(): @@ -3745,9 +3770,15 @@ async def test_test_iam_permissions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.TestIamPermissionsRequest(), + {}, + ], +) async def test_test_iam_permissions_async( - transport: str = "grpc_asyncio", - request_type=iam_policy_pb2.TestIamPermissionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = JobsAsyncClient( credentials=async_anonymous_credentials(), @@ -3756,7 +3787,7 @@ async def test_test_iam_permissions_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( @@ -3781,11 +3812,6 @@ async def test_test_iam_permissions_async( assert response.permissions == ["permissions_value"] -@pytest.mark.asyncio -async def test_test_iam_permissions_async_from_dict(): - await test_test_iam_permissions_async(request_type=dict) - - def test_test_iam_permissions_field_headers(): client = JobsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5567,7 +5593,6 @@ def test_create_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcr_job.CreateJobRequest() - assert args[0] == request_msg @@ -5588,7 +5613,6 @@ def test_get_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = job.GetJobRequest() - assert args[0] == request_msg @@ -5609,7 +5633,6 @@ def test_list_jobs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = job.ListJobsRequest() - assert args[0] == request_msg @@ -5630,7 +5653,6 @@ def test_update_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcr_job.UpdateJobRequest() - assert args[0] == request_msg @@ -5651,7 +5673,6 @@ def test_delete_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = job.DeleteJobRequest() - assert args[0] == request_msg @@ -5672,7 +5693,6 @@ def test_run_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = job.RunJobRequest() - assert args[0] == request_msg @@ -5693,7 +5713,6 @@ def test_get_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -5714,7 +5733,6 @@ def test_set_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -5737,7 +5755,6 @@ def test_test_iam_permissions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -5758,7 +5775,6 @@ def test_create_job_routing_parameters_request_1_grpc(): request_msg = gcr_job.CreateJobRequest( **{"parent": "projects/sample1/locations/sample2"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -5784,7 +5800,6 @@ def test_get_job_routing_parameters_request_1_grpc(): request_msg = job.GetJobRequest( **{"name": "projects/sample1/locations/sample2/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -5810,7 +5825,6 @@ def test_list_jobs_routing_parameters_request_1_grpc(): request_msg = job.ListJobsRequest( **{"parent": "projects/sample1/locations/sample2"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -5838,7 +5852,6 @@ def test_update_job_routing_parameters_request_1_grpc(): request_msg = gcr_job.UpdateJobRequest( **{"job": {"name": "projects/sample1/locations/sample2/sample3"}} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -5866,7 +5879,6 @@ def test_delete_job_routing_parameters_request_1_grpc(): request_msg = job.DeleteJobRequest( **{"name": "projects/sample1/locations/sample2/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -5892,7 +5904,6 @@ def test_run_job_routing_parameters_request_1_grpc(): request_msg = job.RunJobRequest( **{"name": "projects/sample1/locations/sample2/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -5936,7 +5947,6 @@ async def test_create_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcr_job.CreateJobRequest() - assert args[0] == request_msg @@ -5975,7 +5985,6 @@ async def test_get_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = job.GetJobRequest() - assert args[0] == request_msg @@ -6002,7 +6011,6 @@ async def test_list_jobs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = job.ListJobsRequest() - assert args[0] == request_msg @@ -6027,7 +6035,6 @@ async def test_update_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcr_job.UpdateJobRequest() - assert args[0] == request_msg @@ -6052,7 +6059,6 @@ async def test_delete_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = job.DeleteJobRequest() - assert args[0] == request_msg @@ -6077,7 +6083,6 @@ async def test_run_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = job.RunJobRequest() - assert args[0] == request_msg @@ -6105,7 +6110,6 @@ async def test_get_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -6133,7 +6137,6 @@ async def test_set_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -6162,7 +6165,6 @@ async def test_test_iam_permissions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -6189,7 +6191,6 @@ async def test_create_job_routing_parameters_request_1_grpc_asyncio(): request_msg = gcr_job.CreateJobRequest( **{"parent": "projects/sample1/locations/sample2"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -6235,7 +6236,6 @@ async def test_get_job_routing_parameters_request_1_grpc_asyncio(): request_msg = job.GetJobRequest( **{"name": "projects/sample1/locations/sample2/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -6267,7 +6267,6 @@ async def test_list_jobs_routing_parameters_request_1_grpc_asyncio(): request_msg = job.ListJobsRequest( **{"parent": "projects/sample1/locations/sample2"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -6299,7 +6298,6 @@ async def test_update_job_routing_parameters_request_1_grpc_asyncio(): request_msg = gcr_job.UpdateJobRequest( **{"job": {"name": "projects/sample1/locations/sample2/sample3"}} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -6331,7 +6329,6 @@ async def test_delete_job_routing_parameters_request_1_grpc_asyncio(): request_msg = job.DeleteJobRequest( **{"name": "projects/sample1/locations/sample2/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -6363,7 +6360,6 @@ async def test_run_job_routing_parameters_request_1_grpc_asyncio(): request_msg = job.RunJobRequest( **{"name": "projects/sample1/locations/sample2/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -8225,7 +8221,6 @@ def test_create_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcr_job.CreateJobRequest() - assert args[0] == request_msg @@ -8245,7 +8240,6 @@ def test_get_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = job.GetJobRequest() - assert args[0] == request_msg @@ -8265,7 +8259,6 @@ def test_list_jobs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = job.ListJobsRequest() - assert args[0] == request_msg @@ -8285,7 +8278,6 @@ def test_update_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcr_job.UpdateJobRequest() - assert args[0] == request_msg @@ -8305,7 +8297,6 @@ def test_delete_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = job.DeleteJobRequest() - assert args[0] == request_msg @@ -8325,7 +8316,6 @@ def test_run_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = job.RunJobRequest() - assert args[0] == request_msg @@ -8345,7 +8335,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -8365,7 +8354,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -8387,7 +8375,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -8407,7 +8394,6 @@ def test_create_job_routing_parameters_request_1_rest(): request_msg = gcr_job.CreateJobRequest( **{"parent": "projects/sample1/locations/sample2"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -8432,7 +8418,6 @@ def test_get_job_routing_parameters_request_1_rest(): request_msg = job.GetJobRequest( **{"name": "projects/sample1/locations/sample2/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -8457,7 +8442,6 @@ def test_list_jobs_routing_parameters_request_1_rest(): request_msg = job.ListJobsRequest( **{"parent": "projects/sample1/locations/sample2"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -8484,7 +8468,6 @@ def test_update_job_routing_parameters_request_1_rest(): request_msg = gcr_job.UpdateJobRequest( **{"job": {"name": "projects/sample1/locations/sample2/sample3"}} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -8511,7 +8494,6 @@ def test_delete_job_routing_parameters_request_1_rest(): request_msg = job.DeleteJobRequest( **{"name": "projects/sample1/locations/sample2/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -8536,7 +8518,6 @@ def test_run_job_routing_parameters_request_1_rest(): request_msg = job.RunJobRequest( **{"name": "projects/sample1/locations/sample2/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} diff --git a/packages/google-cloud-run/tests/unit/gapic/run_v2/test_revisions.py b/packages/google-cloud-run/tests/unit/gapic/run_v2/test_revisions.py index 4c4911187f27..936031fe34a0 100644 --- a/packages/google-cloud-run/tests/unit/gapic/run_v2/test_revisions.py +++ b/packages/google-cloud-run/tests/unit/gapic/run_v2/test_revisions.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 @@ -122,6 +123,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" @@ -1279,8 +1295,8 @@ def test_revisions_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - revision.GetRevisionRequest, - dict, + revision.GetRevisionRequest(), + {}, ], ) def test_get_revision(request_type, transport: str = "grpc"): @@ -1291,7 +1307,7 @@ def test_get_revision(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_revision), "__call__") as call: @@ -1375,9 +1391,10 @@ def test_get_revision_non_empty_request_with_auto_populated_field(): client.get_revision(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == revision.GetRevisionRequest( + request_msg = revision.GetRevisionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_revision_use_cached_wrapped_rpc(): @@ -1458,9 +1475,14 @@ async def test_get_revision_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_revision_async( - transport: str = "grpc_asyncio", request_type=revision.GetRevisionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + revision.GetRevisionRequest(), + {}, + ], +) +async def test_get_revision_async(request_type, transport: str = "grpc_asyncio"): client = RevisionsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1468,7 +1490,7 @@ async def test_get_revision_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_revision), "__call__") as call: @@ -1531,11 +1553,6 @@ async def test_get_revision_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_revision_async_from_dict(): - await test_get_revision_async(request_type=dict) - - def test_get_revision_flattened(): client = RevisionsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1619,8 +1636,8 @@ async def test_get_revision_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - revision.ListRevisionsRequest, - dict, + revision.ListRevisionsRequest(), + {}, ], ) def test_list_revisions(request_type, transport: str = "grpc"): @@ -1631,7 +1648,7 @@ def test_list_revisions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_revisions), "__call__") as call: @@ -1676,10 +1693,11 @@ def test_list_revisions_non_empty_request_with_auto_populated_field(): client.list_revisions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == revision.ListRevisionsRequest( + request_msg = revision.ListRevisionsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_revisions_use_cached_wrapped_rpc(): @@ -1760,9 +1778,14 @@ async def test_list_revisions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_revisions_async( - transport: str = "grpc_asyncio", request_type=revision.ListRevisionsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + revision.ListRevisionsRequest(), + {}, + ], +) +async def test_list_revisions_async(request_type, transport: str = "grpc_asyncio"): client = RevisionsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1770,7 +1793,7 @@ async def test_list_revisions_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_revisions), "__call__") as call: @@ -1793,11 +1816,6 @@ async def test_list_revisions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_revisions_async_from_dict(): - await test_list_revisions_async(request_type=dict) - - def test_list_revisions_flattened(): client = RevisionsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2070,8 +2088,8 @@ async def test_list_revisions_async_pages(): @pytest.mark.parametrize( "request_type", [ - revision.DeleteRevisionRequest, - dict, + revision.DeleteRevisionRequest(), + {}, ], ) def test_delete_revision(request_type, transport: str = "grpc"): @@ -2082,7 +2100,7 @@ def test_delete_revision(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_revision), "__call__") as call: @@ -2124,10 +2142,11 @@ def test_delete_revision_non_empty_request_with_auto_populated_field(): client.delete_revision(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == revision.DeleteRevisionRequest( + request_msg = revision.DeleteRevisionRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_revision_use_cached_wrapped_rpc(): @@ -2218,9 +2237,14 @@ async def test_delete_revision_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_revision_async( - transport: str = "grpc_asyncio", request_type=revision.DeleteRevisionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + revision.DeleteRevisionRequest(), + {}, + ], +) +async def test_delete_revision_async(request_type, transport: str = "grpc_asyncio"): client = RevisionsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2228,7 +2252,7 @@ async def test_delete_revision_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_revision), "__call__") as call: @@ -2248,11 +2272,6 @@ async def test_delete_revision_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_revision_async_from_dict(): - await test_delete_revision_async(request_type=dict) - - def test_delete_revision_flattened(): client = RevisionsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3090,7 +3109,6 @@ def test_get_revision_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = revision.GetRevisionRequest() - assert args[0] == request_msg @@ -3111,7 +3129,6 @@ def test_list_revisions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = revision.ListRevisionsRequest() - assert args[0] == request_msg @@ -3132,7 +3149,6 @@ def test_delete_revision_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = revision.DeleteRevisionRequest() - assert args[0] == request_msg @@ -3155,7 +3171,6 @@ def test_get_revision_routing_parameters_request_1_grpc(): request_msg = revision.GetRevisionRequest( **{"name": "projects/sample1/locations/sample2/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -3183,7 +3198,6 @@ def test_list_revisions_routing_parameters_request_1_grpc(): request_msg = revision.ListRevisionsRequest( **{"parent": "projects/sample1/locations/sample2/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -3211,7 +3225,6 @@ def test_delete_revision_routing_parameters_request_1_grpc(): request_msg = revision.DeleteRevisionRequest( **{"name": "projects/sample1/locations/sample2/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -3274,7 +3287,6 @@ async def test_get_revision_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = revision.GetRevisionRequest() - assert args[0] == request_msg @@ -3301,7 +3313,6 @@ async def test_list_revisions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = revision.ListRevisionsRequest() - assert args[0] == request_msg @@ -3326,7 +3337,6 @@ async def test_delete_revision_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = revision.DeleteRevisionRequest() - assert args[0] == request_msg @@ -3372,7 +3382,6 @@ async def test_get_revision_routing_parameters_request_1_grpc_asyncio(): request_msg = revision.GetRevisionRequest( **{"name": "projects/sample1/locations/sample2/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -3406,7 +3415,6 @@ async def test_list_revisions_routing_parameters_request_1_grpc_asyncio(): request_msg = revision.ListRevisionsRequest( **{"parent": "projects/sample1/locations/sample2/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -3438,7 +3446,6 @@ async def test_delete_revision_routing_parameters_request_1_grpc_asyncio(): request_msg = revision.DeleteRevisionRequest( **{"name": "projects/sample1/locations/sample2/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -4146,7 +4153,6 @@ def test_get_revision_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = revision.GetRevisionRequest() - assert args[0] == request_msg @@ -4166,7 +4172,6 @@ def test_list_revisions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = revision.ListRevisionsRequest() - assert args[0] == request_msg @@ -4186,7 +4191,6 @@ def test_delete_revision_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = revision.DeleteRevisionRequest() - assert args[0] == request_msg @@ -4208,7 +4212,6 @@ def test_get_revision_routing_parameters_request_1_rest(): request_msg = revision.GetRevisionRequest( **{"name": "projects/sample1/locations/sample2/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -4235,7 +4238,6 @@ def test_list_revisions_routing_parameters_request_1_rest(): request_msg = revision.ListRevisionsRequest( **{"parent": "projects/sample1/locations/sample2/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -4262,7 +4264,6 @@ def test_delete_revision_routing_parameters_request_1_rest(): request_msg = revision.DeleteRevisionRequest( **{"name": "projects/sample1/locations/sample2/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} diff --git a/packages/google-cloud-run/tests/unit/gapic/run_v2/test_services.py b/packages/google-cloud-run/tests/unit/gapic/run_v2/test_services.py index 2da4325eb13b..2a6cf1960b10 100644 --- a/packages/google-cloud-run/tests/unit/gapic/run_v2/test_services.py +++ b/packages/google-cloud-run/tests/unit/gapic/run_v2/test_services.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 @@ -129,6 +130,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" @@ -1273,8 +1289,8 @@ def test_services_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - gcr_service.CreateServiceRequest, - dict, + gcr_service.CreateServiceRequest(), + {}, ], ) def test_create_service(request_type, transport: str = "grpc"): @@ -1285,7 +1301,7 @@ def test_create_service(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_service), "__call__") as call: @@ -1327,10 +1343,11 @@ def test_create_service_non_empty_request_with_auto_populated_field(): client.create_service(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcr_service.CreateServiceRequest( + request_msg = gcr_service.CreateServiceRequest( parent="parent_value", service_id="service_id_value", ) + assert args[0] == request_msg def test_create_service_use_cached_wrapped_rpc(): @@ -1421,9 +1438,14 @@ async def test_create_service_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_service_async( - transport: str = "grpc_asyncio", request_type=gcr_service.CreateServiceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcr_service.CreateServiceRequest(), + {}, + ], +) +async def test_create_service_async(request_type, transport: str = "grpc_asyncio"): client = ServicesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1431,7 +1453,7 @@ async def test_create_service_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_service), "__call__") as call: @@ -1451,11 +1473,6 @@ async def test_create_service_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_service_async_from_dict(): - await test_create_service_async(request_type=dict) - - def test_create_service_flattened(): client = ServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1561,8 +1578,8 @@ async def test_create_service_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.GetServiceRequest, - dict, + service.GetServiceRequest(), + {}, ], ) def test_get_service(request_type, transport: str = "grpc"): @@ -1573,7 +1590,7 @@ def test_get_service(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_service), "__call__") as call: @@ -1661,9 +1678,10 @@ def test_get_service_non_empty_request_with_auto_populated_field(): client.get_service(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetServiceRequest( + request_msg = service.GetServiceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_service_use_cached_wrapped_rpc(): @@ -1744,9 +1762,14 @@ async def test_get_service_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_service_async( - transport: str = "grpc_asyncio", request_type=service.GetServiceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetServiceRequest(), + {}, + ], +) +async def test_get_service_async(request_type, transport: str = "grpc_asyncio"): client = ServicesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1754,7 +1777,7 @@ async def test_get_service_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_service), "__call__") as call: @@ -1821,11 +1844,6 @@ async def test_get_service_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_service_async_from_dict(): - await test_get_service_async(request_type=dict) - - def test_get_service_flattened(): client = ServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1909,8 +1927,8 @@ async def test_get_service_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListServicesRequest, - dict, + service.ListServicesRequest(), + {}, ], ) def test_list_services(request_type, transport: str = "grpc"): @@ -1921,7 +1939,7 @@ def test_list_services(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_services), "__call__") as call: @@ -1968,10 +1986,11 @@ def test_list_services_non_empty_request_with_auto_populated_field(): client.list_services(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListServicesRequest( + request_msg = service.ListServicesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_services_use_cached_wrapped_rpc(): @@ -2052,9 +2071,14 @@ async def test_list_services_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_services_async( - transport: str = "grpc_asyncio", request_type=service.ListServicesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListServicesRequest(), + {}, + ], +) +async def test_list_services_async(request_type, transport: str = "grpc_asyncio"): client = ServicesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2062,7 +2086,7 @@ async def test_list_services_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_services), "__call__") as call: @@ -2087,11 +2111,6 @@ async def test_list_services_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_services_async_from_dict(): - await test_list_services_async(request_type=dict) - - def test_list_services_flattened(): client = ServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2364,8 +2383,8 @@ async def test_list_services_async_pages(): @pytest.mark.parametrize( "request_type", [ - gcr_service.UpdateServiceRequest, - dict, + gcr_service.UpdateServiceRequest(), + {}, ], ) def test_update_service(request_type, transport: str = "grpc"): @@ -2376,7 +2395,7 @@ def test_update_service(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_service), "__call__") as call: @@ -2415,7 +2434,8 @@ def test_update_service_non_empty_request_with_auto_populated_field(): client.update_service(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcr_service.UpdateServiceRequest() + request_msg = gcr_service.UpdateServiceRequest() + assert args[0] == request_msg def test_update_service_use_cached_wrapped_rpc(): @@ -2506,9 +2526,14 @@ async def test_update_service_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_service_async( - transport: str = "grpc_asyncio", request_type=gcr_service.UpdateServiceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gcr_service.UpdateServiceRequest(), + {}, + ], +) +async def test_update_service_async(request_type, transport: str = "grpc_asyncio"): client = ServicesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2516,7 +2541,7 @@ async def test_update_service_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_service), "__call__") as call: @@ -2536,11 +2561,6 @@ async def test_update_service_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_service_async_from_dict(): - await test_update_service_async(request_type=dict) - - def test_update_service_flattened(): client = ServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2636,8 +2656,8 @@ async def test_update_service_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DeleteServiceRequest, - dict, + service.DeleteServiceRequest(), + {}, ], ) def test_delete_service(request_type, transport: str = "grpc"): @@ -2648,7 +2668,7 @@ def test_delete_service(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_service), "__call__") as call: @@ -2690,10 +2710,11 @@ def test_delete_service_non_empty_request_with_auto_populated_field(): client.delete_service(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteServiceRequest( + request_msg = service.DeleteServiceRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_service_use_cached_wrapped_rpc(): @@ -2784,9 +2805,14 @@ async def test_delete_service_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_service_async( - transport: str = "grpc_asyncio", request_type=service.DeleteServiceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteServiceRequest(), + {}, + ], +) +async def test_delete_service_async(request_type, transport: str = "grpc_asyncio"): client = ServicesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2794,7 +2820,7 @@ async def test_delete_service_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_service), "__call__") as call: @@ -2814,11 +2840,6 @@ async def test_delete_service_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_service_async_from_dict(): - await test_delete_service_async(request_type=dict) - - def test_delete_service_flattened(): client = ServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2904,8 +2925,8 @@ async def test_delete_service_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.GetIamPolicyRequest, - dict, + iam_policy_pb2.GetIamPolicyRequest(), + {}, ], ) def test_get_iam_policy(request_type, transport: str = "grpc"): @@ -2916,7 +2937,7 @@ def test_get_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(type(client.transport.get_iam_policy), "__call__") as call: @@ -2962,9 +2983,10 @@ def test_get_iam_policy_non_empty_request_with_auto_populated_field(): client.get_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.GetIamPolicyRequest( + request_msg = iam_policy_pb2.GetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_get_iam_policy_use_cached_wrapped_rpc(): @@ -3045,9 +3067,14 @@ async def test_get_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.GetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.GetIamPolicyRequest(), + {}, + ], +) +async def test_get_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = ServicesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3055,7 +3082,7 @@ async def test_get_iam_policy_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_iam_policy), "__call__") as call: @@ -3080,11 +3107,6 @@ async def test_get_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_get_iam_policy_async_from_dict(): - await test_get_iam_policy_async(request_type=dict) - - def test_get_iam_policy_field_headers(): client = ServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3164,8 +3186,8 @@ def test_get_iam_policy_from_dict_foreign(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.SetIamPolicyRequest, - dict, + iam_policy_pb2.SetIamPolicyRequest(), + {}, ], ) def test_set_iam_policy(request_type, transport: str = "grpc"): @@ -3176,7 +3198,7 @@ def test_set_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(type(client.transport.set_iam_policy), "__call__") as call: @@ -3222,9 +3244,10 @@ def test_set_iam_policy_non_empty_request_with_auto_populated_field(): client.set_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.SetIamPolicyRequest( + request_msg = iam_policy_pb2.SetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_set_iam_policy_use_cached_wrapped_rpc(): @@ -3305,9 +3328,14 @@ async def test_set_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.SetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.SetIamPolicyRequest(), + {}, + ], +) +async def test_set_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = ServicesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3315,7 +3343,7 @@ async def test_set_iam_policy_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.set_iam_policy), "__call__") as call: @@ -3340,11 +3368,6 @@ async def test_set_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_set_iam_policy_async_from_dict(): - await test_set_iam_policy_async(request_type=dict) - - def test_set_iam_policy_field_headers(): client = ServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3425,8 +3448,8 @@ def test_set_iam_policy_from_dict_foreign(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.TestIamPermissionsRequest, - dict, + iam_policy_pb2.TestIamPermissionsRequest(), + {}, ], ) def test_test_iam_permissions(request_type, transport: str = "grpc"): @@ -3437,7 +3460,7 @@ def test_test_iam_permissions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3485,9 +3508,10 @@ def test_test_iam_permissions_non_empty_request_with_auto_populated_field(): client.test_iam_permissions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.TestIamPermissionsRequest( + request_msg = iam_policy_pb2.TestIamPermissionsRequest( resource="resource_value", ) + assert args[0] == request_msg def test_test_iam_permissions_use_cached_wrapped_rpc(): @@ -3572,9 +3596,15 @@ async def test_test_iam_permissions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.TestIamPermissionsRequest(), + {}, + ], +) async def test_test_iam_permissions_async( - transport: str = "grpc_asyncio", - request_type=iam_policy_pb2.TestIamPermissionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = ServicesAsyncClient( credentials=async_anonymous_credentials(), @@ -3583,7 +3613,7 @@ async def test_test_iam_permissions_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( @@ -3608,11 +3638,6 @@ async def test_test_iam_permissions_async( assert response.permissions == ["permissions_value"] -@pytest.mark.asyncio -async def test_test_iam_permissions_async_from_dict(): - await test_test_iam_permissions_async(request_type=dict) - - def test_test_iam_permissions_field_headers(): client = ServicesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5228,7 +5253,6 @@ def test_create_service_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcr_service.CreateServiceRequest() - assert args[0] == request_msg @@ -5249,7 +5273,6 @@ def test_get_service_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetServiceRequest() - assert args[0] == request_msg @@ -5270,7 +5293,6 @@ def test_list_services_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListServicesRequest() - assert args[0] == request_msg @@ -5291,7 +5313,6 @@ def test_update_service_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcr_service.UpdateServiceRequest() - assert args[0] == request_msg @@ -5312,7 +5333,6 @@ def test_delete_service_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteServiceRequest() - assert args[0] == request_msg @@ -5333,7 +5353,6 @@ def test_get_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -5354,7 +5373,6 @@ def test_set_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -5377,7 +5395,6 @@ def test_test_iam_permissions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -5398,7 +5415,6 @@ def test_create_service_routing_parameters_request_1_grpc(): request_msg = gcr_service.CreateServiceRequest( **{"parent": "projects/sample1/locations/sample2"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -5426,7 +5442,6 @@ def test_get_service_routing_parameters_request_1_grpc(): request_msg = service.GetServiceRequest( **{"name": "projects/sample1/locations/sample2/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -5452,7 +5467,6 @@ def test_list_services_routing_parameters_request_1_grpc(): request_msg = service.ListServicesRequest( **{"parent": "projects/sample1/locations/sample2"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -5480,7 +5494,6 @@ def test_update_service_routing_parameters_request_1_grpc(): request_msg = gcr_service.UpdateServiceRequest( **{"service": {"name": "projects/sample1/locations/sample2/sample3"}} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -5508,7 +5521,6 @@ def test_delete_service_routing_parameters_request_1_grpc(): request_msg = service.DeleteServiceRequest( **{"name": "projects/sample1/locations/sample2/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -5552,7 +5564,6 @@ async def test_create_service_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcr_service.CreateServiceRequest() - assert args[0] == request_msg @@ -5601,7 +5612,6 @@ async def test_get_service_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetServiceRequest() - assert args[0] == request_msg @@ -5629,7 +5639,6 @@ async def test_list_services_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListServicesRequest() - assert args[0] == request_msg @@ -5654,7 +5663,6 @@ async def test_update_service_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcr_service.UpdateServiceRequest() - assert args[0] == request_msg @@ -5679,7 +5687,6 @@ async def test_delete_service_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteServiceRequest() - assert args[0] == request_msg @@ -5707,7 +5714,6 @@ async def test_get_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -5735,7 +5741,6 @@ async def test_set_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -5764,7 +5769,6 @@ async def test_test_iam_permissions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -5791,7 +5795,6 @@ async def test_create_service_routing_parameters_request_1_grpc_asyncio(): request_msg = gcr_service.CreateServiceRequest( **{"parent": "projects/sample1/locations/sample2"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -5847,7 +5850,6 @@ async def test_get_service_routing_parameters_request_1_grpc_asyncio(): request_msg = service.GetServiceRequest( **{"name": "projects/sample1/locations/sample2/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -5882,7 +5884,6 @@ async def test_list_services_routing_parameters_request_1_grpc_asyncio(): request_msg = service.ListServicesRequest( **{"parent": "projects/sample1/locations/sample2"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -5914,7 +5915,6 @@ async def test_update_service_routing_parameters_request_1_grpc_asyncio(): request_msg = gcr_service.UpdateServiceRequest( **{"service": {"name": "projects/sample1/locations/sample2/sample3"}} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -5946,7 +5946,6 @@ async def test_delete_service_routing_parameters_request_1_grpc_asyncio(): request_msg = service.DeleteServiceRequest( **{"name": "projects/sample1/locations/sample2/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -7831,7 +7830,6 @@ def test_create_service_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcr_service.CreateServiceRequest() - assert args[0] == request_msg @@ -7851,7 +7849,6 @@ def test_get_service_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetServiceRequest() - assert args[0] == request_msg @@ -7871,7 +7868,6 @@ def test_list_services_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListServicesRequest() - assert args[0] == request_msg @@ -7891,7 +7887,6 @@ def test_update_service_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcr_service.UpdateServiceRequest() - assert args[0] == request_msg @@ -7911,7 +7906,6 @@ def test_delete_service_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteServiceRequest() - assert args[0] == request_msg @@ -7931,7 +7925,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -7951,7 +7944,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -7973,7 +7965,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -7993,7 +7984,6 @@ def test_create_service_routing_parameters_request_1_rest(): request_msg = gcr_service.CreateServiceRequest( **{"parent": "projects/sample1/locations/sample2"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -8020,7 +8010,6 @@ def test_get_service_routing_parameters_request_1_rest(): request_msg = service.GetServiceRequest( **{"name": "projects/sample1/locations/sample2/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -8045,7 +8034,6 @@ def test_list_services_routing_parameters_request_1_rest(): request_msg = service.ListServicesRequest( **{"parent": "projects/sample1/locations/sample2"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -8072,7 +8060,6 @@ def test_update_service_routing_parameters_request_1_rest(): request_msg = gcr_service.UpdateServiceRequest( **{"service": {"name": "projects/sample1/locations/sample2/sample3"}} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -8099,7 +8086,6 @@ def test_delete_service_routing_parameters_request_1_rest(): request_msg = service.DeleteServiceRequest( **{"name": "projects/sample1/locations/sample2/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} diff --git a/packages/google-cloud-run/tests/unit/gapic/run_v2/test_tasks.py b/packages/google-cloud-run/tests/unit/gapic/run_v2/test_tasks.py index c620ce6c3a01..39b3f1b5e606 100644 --- a/packages/google-cloud-run/tests/unit/gapic/run_v2/test_tasks.py +++ b/packages/google-cloud-run/tests/unit/gapic/run_v2/test_tasks.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" @@ -1239,8 +1255,8 @@ def test_tasks_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - task.GetTaskRequest, - dict, + task.GetTaskRequest(), + {}, ], ) def test_get_task(request_type, transport: str = "grpc"): @@ -1251,7 +1267,7 @@ def test_get_task(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_task), "__call__") as call: @@ -1330,9 +1346,10 @@ def test_get_task_non_empty_request_with_auto_populated_field(): client.get_task(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == task.GetTaskRequest( + request_msg = task.GetTaskRequest( name="name_value", ) + assert args[0] == request_msg def test_get_task_use_cached_wrapped_rpc(): @@ -1411,9 +1428,14 @@ async def test_get_task_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn @pytest.mark.asyncio -async def test_get_task_async( - transport: str = "grpc_asyncio", request_type=task.GetTaskRequest -): +@pytest.mark.parametrize( + "request_type", + [ + task.GetTaskRequest(), + {}, + ], +) +async def test_get_task_async(request_type, transport: str = "grpc_asyncio"): client = TasksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1421,7 +1443,7 @@ async def test_get_task_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_task), "__call__") as call: @@ -1479,11 +1501,6 @@ async def test_get_task_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_task_async_from_dict(): - await test_get_task_async(request_type=dict) - - def test_get_task_field_headers(): client = TasksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1626,8 +1643,8 @@ async def test_get_task_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - task.ListTasksRequest, - dict, + task.ListTasksRequest(), + {}, ], ) def test_list_tasks(request_type, transport: str = "grpc"): @@ -1638,7 +1655,7 @@ def test_list_tasks(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tasks), "__call__") as call: @@ -1683,10 +1700,11 @@ def test_list_tasks_non_empty_request_with_auto_populated_field(): client.list_tasks(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == task.ListTasksRequest( + request_msg = task.ListTasksRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_tasks_use_cached_wrapped_rpc(): @@ -1765,9 +1783,14 @@ async def test_list_tasks_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_list_tasks_async( - transport: str = "grpc_asyncio", request_type=task.ListTasksRequest -): +@pytest.mark.parametrize( + "request_type", + [ + task.ListTasksRequest(), + {}, + ], +) +async def test_list_tasks_async(request_type, transport: str = "grpc_asyncio"): client = TasksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1775,7 +1798,7 @@ async def test_list_tasks_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_tasks), "__call__") as call: @@ -1798,11 +1821,6 @@ async def test_list_tasks_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_tasks_async_from_dict(): - await test_list_tasks_async(request_type=dict) - - def test_list_tasks_field_headers(): client = TasksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2695,7 +2713,6 @@ def test_get_task_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = task.GetTaskRequest() - assert args[0] == request_msg @@ -2716,7 +2733,6 @@ def test_list_tasks_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = task.ListTasksRequest() - assert args[0] == request_msg @@ -2773,7 +2789,6 @@ async def test_get_task_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = task.GetTaskRequest() - assert args[0] == request_msg @@ -2800,7 +2815,6 @@ async def test_list_tasks_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = task.ListTasksRequest() - assert args[0] == request_msg @@ -3369,7 +3383,6 @@ def test_get_task_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = task.GetTaskRequest() - assert args[0] == request_msg @@ -3389,7 +3402,6 @@ def test_list_tasks_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = task.ListTasksRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-run/tests/unit/gapic/run_v2/test_worker_pools.py b/packages/google-cloud-run/tests/unit/gapic/run_v2/test_worker_pools.py index 060111274d82..98b1e3b3c025 100644 --- a/packages/google-cloud-run/tests/unit/gapic/run_v2/test_worker_pools.py +++ b/packages/google-cloud-run/tests/unit/gapic/run_v2/test_worker_pools.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 @@ -129,6 +130,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" @@ -1294,8 +1310,8 @@ def test_worker_pools_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - gcr_worker_pool.CreateWorkerPoolRequest, - dict, + gcr_worker_pool.CreateWorkerPoolRequest(), + {}, ], ) def test_create_worker_pool(request_type, transport: str = "grpc"): @@ -1306,7 +1322,7 @@ def test_create_worker_pool(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,10 +1368,11 @@ def test_create_worker_pool_non_empty_request_with_auto_populated_field(): client.create_worker_pool(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcr_worker_pool.CreateWorkerPoolRequest( + request_msg = gcr_worker_pool.CreateWorkerPoolRequest( parent="parent_value", worker_pool_id="worker_pool_id_value", ) + assert args[0] == request_msg def test_create_worker_pool_use_cached_wrapped_rpc(): @@ -1450,10 +1467,14 @@ async def test_create_worker_pool_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_worker_pool_async( - transport: str = "grpc_asyncio", - request_type=gcr_worker_pool.CreateWorkerPoolRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + gcr_worker_pool.CreateWorkerPoolRequest(), + {}, + ], +) +async def test_create_worker_pool_async(request_type, transport: str = "grpc_asyncio"): client = WorkerPoolsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1461,7 +1482,7 @@ async def test_create_worker_pool_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( @@ -1483,11 +1504,6 @@ async def test_create_worker_pool_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_worker_pool_async_from_dict(): - await test_create_worker_pool_async(request_type=dict) - - def test_create_worker_pool_flattened(): client = WorkerPoolsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1597,8 +1613,8 @@ async def test_create_worker_pool_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - worker_pool.GetWorkerPoolRequest, - dict, + worker_pool.GetWorkerPoolRequest(), + {}, ], ) def test_get_worker_pool(request_type, transport: str = "grpc"): @@ -1609,7 +1625,7 @@ def test_get_worker_pool(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_worker_pool), "__call__") as call: @@ -1685,9 +1701,10 @@ def test_get_worker_pool_non_empty_request_with_auto_populated_field(): client.get_worker_pool(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == worker_pool.GetWorkerPoolRequest( + request_msg = worker_pool.GetWorkerPoolRequest( name="name_value", ) + assert args[0] == request_msg def test_get_worker_pool_use_cached_wrapped_rpc(): @@ -1768,9 +1785,14 @@ async def test_get_worker_pool_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_worker_pool_async( - transport: str = "grpc_asyncio", request_type=worker_pool.GetWorkerPoolRequest -): +@pytest.mark.parametrize( + "request_type", + [ + worker_pool.GetWorkerPoolRequest(), + {}, + ], +) +async def test_get_worker_pool_async(request_type, transport: str = "grpc_asyncio"): client = WorkerPoolsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1778,7 +1800,7 @@ async def test_get_worker_pool_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_worker_pool), "__call__") as call: @@ -1833,11 +1855,6 @@ async def test_get_worker_pool_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_worker_pool_async_from_dict(): - await test_get_worker_pool_async(request_type=dict) - - def test_get_worker_pool_flattened(): client = WorkerPoolsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1923,8 +1940,8 @@ async def test_get_worker_pool_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - worker_pool.ListWorkerPoolsRequest, - dict, + worker_pool.ListWorkerPoolsRequest(), + {}, ], ) def test_list_worker_pools(request_type, transport: str = "grpc"): @@ -1935,7 +1952,7 @@ def test_list_worker_pools(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1984,10 +2001,11 @@ def test_list_worker_pools_non_empty_request_with_auto_populated_field(): client.list_worker_pools(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == worker_pool.ListWorkerPoolsRequest( + request_msg = worker_pool.ListWorkerPoolsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_worker_pools_use_cached_wrapped_rpc(): @@ -2070,9 +2088,14 @@ async def test_list_worker_pools_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_worker_pools_async( - transport: str = "grpc_asyncio", request_type=worker_pool.ListWorkerPoolsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + worker_pool.ListWorkerPoolsRequest(), + {}, + ], +) +async def test_list_worker_pools_async(request_type, transport: str = "grpc_asyncio"): client = WorkerPoolsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2080,7 +2103,7 @@ async def test_list_worker_pools_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( @@ -2105,11 +2128,6 @@ async def test_list_worker_pools_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_worker_pools_async_from_dict(): - await test_list_worker_pools_async(request_type=dict) - - def test_list_worker_pools_flattened(): client = WorkerPoolsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2394,8 +2412,8 @@ async def test_list_worker_pools_async_pages(): @pytest.mark.parametrize( "request_type", [ - gcr_worker_pool.UpdateWorkerPoolRequest, - dict, + gcr_worker_pool.UpdateWorkerPoolRequest(), + {}, ], ) def test_update_worker_pool(request_type, transport: str = "grpc"): @@ -2406,7 +2424,7 @@ def test_update_worker_pool(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2449,7 +2467,8 @@ def test_update_worker_pool_non_empty_request_with_auto_populated_field(): client.update_worker_pool(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gcr_worker_pool.UpdateWorkerPoolRequest() + request_msg = gcr_worker_pool.UpdateWorkerPoolRequest() + assert args[0] == request_msg def test_update_worker_pool_use_cached_wrapped_rpc(): @@ -2544,10 +2563,14 @@ async def test_update_worker_pool_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_worker_pool_async( - transport: str = "grpc_asyncio", - request_type=gcr_worker_pool.UpdateWorkerPoolRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + gcr_worker_pool.UpdateWorkerPoolRequest(), + {}, + ], +) +async def test_update_worker_pool_async(request_type, transport: str = "grpc_asyncio"): client = WorkerPoolsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2555,7 +2578,7 @@ async def test_update_worker_pool_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( @@ -2577,11 +2600,6 @@ async def test_update_worker_pool_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_worker_pool_async_from_dict(): - await test_update_worker_pool_async(request_type=dict) - - def test_update_worker_pool_flattened(): client = WorkerPoolsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2681,8 +2699,8 @@ async def test_update_worker_pool_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - worker_pool.DeleteWorkerPoolRequest, - dict, + worker_pool.DeleteWorkerPoolRequest(), + {}, ], ) def test_delete_worker_pool(request_type, transport: str = "grpc"): @@ -2693,7 +2711,7 @@ def test_delete_worker_pool(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,10 +2757,11 @@ def test_delete_worker_pool_non_empty_request_with_auto_populated_field(): client.delete_worker_pool(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == worker_pool.DeleteWorkerPoolRequest( + request_msg = worker_pool.DeleteWorkerPoolRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_worker_pool_use_cached_wrapped_rpc(): @@ -2837,9 +2856,14 @@ async def test_delete_worker_pool_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_worker_pool_async( - transport: str = "grpc_asyncio", request_type=worker_pool.DeleteWorkerPoolRequest -): +@pytest.mark.parametrize( + "request_type", + [ + worker_pool.DeleteWorkerPoolRequest(), + {}, + ], +) +async def test_delete_worker_pool_async(request_type, transport: str = "grpc_asyncio"): client = WorkerPoolsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2847,7 +2871,7 @@ async def test_delete_worker_pool_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( @@ -2869,11 +2893,6 @@ async def test_delete_worker_pool_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_worker_pool_async_from_dict(): - await test_delete_worker_pool_async(request_type=dict) - - def test_delete_worker_pool_flattened(): client = WorkerPoolsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2963,8 +2982,8 @@ async def test_delete_worker_pool_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.GetIamPolicyRequest, - dict, + iam_policy_pb2.GetIamPolicyRequest(), + {}, ], ) def test_get_iam_policy(request_type, transport: str = "grpc"): @@ -2975,7 +2994,7 @@ def test_get_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(type(client.transport.get_iam_policy), "__call__") as call: @@ -3021,9 +3040,10 @@ def test_get_iam_policy_non_empty_request_with_auto_populated_field(): client.get_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.GetIamPolicyRequest( + request_msg = iam_policy_pb2.GetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_get_iam_policy_use_cached_wrapped_rpc(): @@ -3104,9 +3124,14 @@ async def test_get_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.GetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.GetIamPolicyRequest(), + {}, + ], +) +async def test_get_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = WorkerPoolsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3114,7 +3139,7 @@ async def test_get_iam_policy_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_iam_policy), "__call__") as call: @@ -3139,11 +3164,6 @@ async def test_get_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_get_iam_policy_async_from_dict(): - await test_get_iam_policy_async(request_type=dict) - - def test_get_iam_policy_field_headers(): client = WorkerPoolsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3223,8 +3243,8 @@ def test_get_iam_policy_from_dict_foreign(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.SetIamPolicyRequest, - dict, + iam_policy_pb2.SetIamPolicyRequest(), + {}, ], ) def test_set_iam_policy(request_type, transport: str = "grpc"): @@ -3235,7 +3255,7 @@ def test_set_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(type(client.transport.set_iam_policy), "__call__") as call: @@ -3281,9 +3301,10 @@ def test_set_iam_policy_non_empty_request_with_auto_populated_field(): client.set_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.SetIamPolicyRequest( + request_msg = iam_policy_pb2.SetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_set_iam_policy_use_cached_wrapped_rpc(): @@ -3364,9 +3385,14 @@ async def test_set_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.SetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.SetIamPolicyRequest(), + {}, + ], +) +async def test_set_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = WorkerPoolsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3374,7 +3400,7 @@ async def test_set_iam_policy_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.set_iam_policy), "__call__") as call: @@ -3399,11 +3425,6 @@ async def test_set_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_set_iam_policy_async_from_dict(): - await test_set_iam_policy_async(request_type=dict) - - def test_set_iam_policy_field_headers(): client = WorkerPoolsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3484,8 +3505,8 @@ def test_set_iam_policy_from_dict_foreign(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.TestIamPermissionsRequest, - dict, + iam_policy_pb2.TestIamPermissionsRequest(), + {}, ], ) def test_test_iam_permissions(request_type, transport: str = "grpc"): @@ -3496,7 +3517,7 @@ def test_test_iam_permissions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3544,9 +3565,10 @@ def test_test_iam_permissions_non_empty_request_with_auto_populated_field(): client.test_iam_permissions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.TestIamPermissionsRequest( + request_msg = iam_policy_pb2.TestIamPermissionsRequest( resource="resource_value", ) + assert args[0] == request_msg def test_test_iam_permissions_use_cached_wrapped_rpc(): @@ -3631,9 +3653,15 @@ async def test_test_iam_permissions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.TestIamPermissionsRequest(), + {}, + ], +) async def test_test_iam_permissions_async( - transport: str = "grpc_asyncio", - request_type=iam_policy_pb2.TestIamPermissionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = WorkerPoolsAsyncClient( credentials=async_anonymous_credentials(), @@ -3642,7 +3670,7 @@ async def test_test_iam_permissions_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( @@ -3667,11 +3695,6 @@ async def test_test_iam_permissions_async( assert response.permissions == ["permissions_value"] -@pytest.mark.asyncio -async def test_test_iam_permissions_async_from_dict(): - await test_test_iam_permissions_async(request_type=dict) - - def test_test_iam_permissions_field_headers(): client = WorkerPoolsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5323,7 +5346,6 @@ def test_create_worker_pool_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcr_worker_pool.CreateWorkerPoolRequest() - assert args[0] == request_msg @@ -5344,7 +5366,6 @@ def test_get_worker_pool_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = worker_pool.GetWorkerPoolRequest() - assert args[0] == request_msg @@ -5367,7 +5388,6 @@ def test_list_worker_pools_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = worker_pool.ListWorkerPoolsRequest() - assert args[0] == request_msg @@ -5390,7 +5410,6 @@ def test_update_worker_pool_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcr_worker_pool.UpdateWorkerPoolRequest() - assert args[0] == request_msg @@ -5413,7 +5432,6 @@ def test_delete_worker_pool_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = worker_pool.DeleteWorkerPoolRequest() - assert args[0] == request_msg @@ -5434,7 +5452,6 @@ def test_get_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -5455,7 +5472,6 @@ def test_set_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -5478,7 +5494,6 @@ def test_test_iam_permissions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -5503,7 +5518,6 @@ def test_create_worker_pool_routing_parameters_request_1_grpc(): request_msg = gcr_worker_pool.CreateWorkerPoolRequest( **{"parent": "projects/sample1/locations/sample2"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -5531,7 +5545,6 @@ def test_get_worker_pool_routing_parameters_request_1_grpc(): request_msg = worker_pool.GetWorkerPoolRequest( **{"name": "projects/sample1/locations/sample2/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -5561,7 +5574,6 @@ def test_list_worker_pools_routing_parameters_request_1_grpc(): request_msg = worker_pool.ListWorkerPoolsRequest( **{"parent": "projects/sample1/locations/sample2"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -5593,7 +5605,6 @@ def test_update_worker_pool_routing_parameters_request_1_grpc(): request_msg = gcr_worker_pool.UpdateWorkerPoolRequest( **{"worker_pool": {"name": "projects/sample1/locations/sample2/sample3"}} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -5623,7 +5634,6 @@ def test_delete_worker_pool_routing_parameters_request_1_grpc(): request_msg = worker_pool.DeleteWorkerPoolRequest( **{"name": "projects/sample1/locations/sample2/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -5669,7 +5679,6 @@ async def test_create_worker_pool_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcr_worker_pool.CreateWorkerPoolRequest() - assert args[0] == request_msg @@ -5712,7 +5721,6 @@ async def test_get_worker_pool_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = worker_pool.GetWorkerPoolRequest() - assert args[0] == request_msg @@ -5741,7 +5749,6 @@ async def test_list_worker_pools_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = worker_pool.ListWorkerPoolsRequest() - assert args[0] == request_msg @@ -5768,7 +5775,6 @@ async def test_update_worker_pool_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcr_worker_pool.UpdateWorkerPoolRequest() - assert args[0] == request_msg @@ -5795,7 +5801,6 @@ async def test_delete_worker_pool_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = worker_pool.DeleteWorkerPoolRequest() - assert args[0] == request_msg @@ -5823,7 +5828,6 @@ async def test_get_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -5851,7 +5855,6 @@ async def test_set_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -5880,7 +5883,6 @@ async def test_test_iam_permissions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -5909,7 +5911,6 @@ async def test_create_worker_pool_routing_parameters_request_1_grpc_asyncio(): request_msg = gcr_worker_pool.CreateWorkerPoolRequest( **{"parent": "projects/sample1/locations/sample2"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -5959,7 +5960,6 @@ async def test_get_worker_pool_routing_parameters_request_1_grpc_asyncio(): request_msg = worker_pool.GetWorkerPoolRequest( **{"name": "projects/sample1/locations/sample2/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -5995,7 +5995,6 @@ async def test_list_worker_pools_routing_parameters_request_1_grpc_asyncio(): request_msg = worker_pool.ListWorkerPoolsRequest( **{"parent": "projects/sample1/locations/sample2"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -6031,7 +6030,6 @@ async def test_update_worker_pool_routing_parameters_request_1_grpc_asyncio(): request_msg = gcr_worker_pool.UpdateWorkerPoolRequest( **{"worker_pool": {"name": "projects/sample1/locations/sample2/sample3"}} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -6065,7 +6063,6 @@ async def test_delete_worker_pool_routing_parameters_request_1_grpc_asyncio(): request_msg = worker_pool.DeleteWorkerPoolRequest( **{"name": "projects/sample1/locations/sample2/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -7905,7 +7902,6 @@ def test_create_worker_pool_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcr_worker_pool.CreateWorkerPoolRequest() - assert args[0] == request_msg @@ -7925,7 +7921,6 @@ def test_get_worker_pool_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = worker_pool.GetWorkerPoolRequest() - assert args[0] == request_msg @@ -7947,7 +7942,6 @@ def test_list_worker_pools_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = worker_pool.ListWorkerPoolsRequest() - assert args[0] == request_msg @@ -7969,7 +7963,6 @@ def test_update_worker_pool_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gcr_worker_pool.UpdateWorkerPoolRequest() - assert args[0] == request_msg @@ -7991,7 +7984,6 @@ def test_delete_worker_pool_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = worker_pool.DeleteWorkerPoolRequest() - assert args[0] == request_msg @@ -8011,7 +8003,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -8031,7 +8022,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -8053,7 +8043,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -8077,7 +8066,6 @@ def test_create_worker_pool_routing_parameters_request_1_rest(): request_msg = gcr_worker_pool.CreateWorkerPoolRequest( **{"parent": "projects/sample1/locations/sample2"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -8104,7 +8092,6 @@ def test_get_worker_pool_routing_parameters_request_1_rest(): request_msg = worker_pool.GetWorkerPoolRequest( **{"name": "projects/sample1/locations/sample2/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -8133,7 +8120,6 @@ def test_list_worker_pools_routing_parameters_request_1_rest(): request_msg = worker_pool.ListWorkerPoolsRequest( **{"parent": "projects/sample1/locations/sample2"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -8164,7 +8150,6 @@ def test_update_worker_pool_routing_parameters_request_1_rest(): request_msg = gcr_worker_pool.UpdateWorkerPoolRequest( **{"worker_pool": {"name": "projects/sample1/locations/sample2/sample3"}} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -8193,7 +8178,6 @@ def test_delete_worker_pool_routing_parameters_request_1_rest(): request_msg = worker_pool.DeleteWorkerPoolRequest( **{"name": "projects/sample1/locations/sample2/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} diff --git a/packages/google-cloud-saasplatform-saasservicemgmt/noxfile.py b/packages/google-cloud-saasplatform-saasservicemgmt/noxfile.py index 13bbc897d5fb..554ed2d56036 100644 --- a/packages/google-cloud-saasplatform-saasservicemgmt/noxfile.py +++ b/packages/google-cloud-saasplatform-saasservicemgmt/noxfile.py @@ -47,7 +47,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-saasplatform-saasservicemgmt" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-saasplatform-saasservicemgmt/setup.py b/packages/google-cloud-saasplatform-saasservicemgmt/setup.py index 27575ecd691e..a5201c621115 100644 --- a/packages/google-cloud-saasplatform-saasservicemgmt/setup.py +++ b/packages/google-cloud-saasplatform-saasservicemgmt/setup.py @@ -47,7 +47,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/google-cloud-saasplatform-saasservicemgmt/testing/constraints-3.10.txt b/packages/google-cloud-saasplatform-saasservicemgmt/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-saasplatform-saasservicemgmt/testing/constraints-3.10.txt +++ b/packages/google-cloud-saasplatform-saasservicemgmt/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-saasplatform-saasservicemgmt/tests/unit/gapic/saasplatform_saasservicemgmt_v1beta1/test_saas_deployments.py b/packages/google-cloud-saasplatform-saasservicemgmt/tests/unit/gapic/saasplatform_saasservicemgmt_v1beta1/test_saas_deployments.py index d9ebc08d6454..bd8905d1d35d 100644 --- a/packages/google-cloud-saasplatform-saasservicemgmt/tests/unit/gapic/saasplatform_saasservicemgmt_v1beta1/test_saas_deployments.py +++ b/packages/google-cloud-saasplatform-saasservicemgmt/tests/unit/gapic/saasplatform_saasservicemgmt_v1beta1/test_saas_deployments.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 @@ -115,6 +116,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" @@ -1342,8 +1358,8 @@ def test_saas_deployments_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - deployments_service.ListSaasRequest, - dict, + deployments_service.ListSaasRequest(), + {}, ], ) def test_list_saas(request_type, transport: str = "grpc"): @@ -1354,7 +1370,7 @@ def test_list_saas(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_saas), "__call__") as call: @@ -1403,12 +1419,13 @@ def test_list_saas_non_empty_request_with_auto_populated_field(): client.list_saas(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == deployments_service.ListSaasRequest( + request_msg = deployments_service.ListSaasRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_saas_use_cached_wrapped_rpc(): @@ -1487,9 +1504,14 @@ async def test_list_saas_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_list_saas_async( - transport: str = "grpc_asyncio", request_type=deployments_service.ListSaasRequest -): +@pytest.mark.parametrize( + "request_type", + [ + deployments_service.ListSaasRequest(), + {}, + ], +) +async def test_list_saas_async(request_type, transport: str = "grpc_asyncio"): client = SaasDeploymentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1497,7 +1519,7 @@ async def test_list_saas_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_saas), "__call__") as call: @@ -1522,11 +1544,6 @@ async def test_list_saas_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_saas_async_from_dict(): - await test_list_saas_async(request_type=dict) - - def test_list_saas_field_headers(): client = SaasDeploymentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1863,8 +1880,8 @@ async def test_list_saas_async_pages(): @pytest.mark.parametrize( "request_type", [ - deployments_service.GetSaasRequest, - dict, + deployments_service.GetSaasRequest(), + {}, ], ) def test_get_saas(request_type, transport: str = "grpc"): @@ -1875,7 +1892,7 @@ def test_get_saas(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_saas), "__call__") as call: @@ -1923,9 +1940,10 @@ def test_get_saas_non_empty_request_with_auto_populated_field(): client.get_saas(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == deployments_service.GetSaasRequest( + request_msg = deployments_service.GetSaasRequest( name="name_value", ) + assert args[0] == request_msg def test_get_saas_use_cached_wrapped_rpc(): @@ -2004,9 +2022,14 @@ async def test_get_saas_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn @pytest.mark.asyncio -async def test_get_saas_async( - transport: str = "grpc_asyncio", request_type=deployments_service.GetSaasRequest -): +@pytest.mark.parametrize( + "request_type", + [ + deployments_service.GetSaasRequest(), + {}, + ], +) +async def test_get_saas_async(request_type, transport: str = "grpc_asyncio"): client = SaasDeploymentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2014,7 +2037,7 @@ async def test_get_saas_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_saas), "__call__") as call: @@ -2041,11 +2064,6 @@ async def test_get_saas_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_saas_async_from_dict(): - await test_get_saas_async(request_type=dict) - - def test_get_saas_field_headers(): client = SaasDeploymentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2192,8 +2210,8 @@ async def test_get_saas_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - deployments_service.CreateSaasRequest, - dict, + deployments_service.CreateSaasRequest(), + {}, ], ) def test_create_saas(request_type, transport: str = "grpc"): @@ -2204,7 +2222,7 @@ def test_create_saas(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_saas), "__call__") as call: @@ -2254,11 +2272,12 @@ def test_create_saas_non_empty_request_with_auto_populated_field(): client.create_saas(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == deployments_service.CreateSaasRequest( + request_msg = deployments_service.CreateSaasRequest( parent="parent_value", saas_id="saas_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_saas_use_cached_wrapped_rpc(): @@ -2339,9 +2358,14 @@ async def test_create_saas_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_saas_async( - transport: str = "grpc_asyncio", request_type=deployments_service.CreateSaasRequest -): +@pytest.mark.parametrize( + "request_type", + [ + deployments_service.CreateSaasRequest(), + {}, + ], +) +async def test_create_saas_async(request_type, transport: str = "grpc_asyncio"): client = SaasDeploymentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2349,7 +2373,7 @@ async def test_create_saas_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_saas), "__call__") as call: @@ -2376,11 +2400,6 @@ async def test_create_saas_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_create_saas_async_from_dict(): - await test_create_saas_async(request_type=dict) - - def test_create_saas_field_headers(): client = SaasDeploymentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2547,8 +2566,8 @@ async def test_create_saas_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - deployments_service.UpdateSaasRequest, - dict, + deployments_service.UpdateSaasRequest(), + {}, ], ) def test_update_saas(request_type, transport: str = "grpc"): @@ -2559,7 +2578,7 @@ def test_update_saas(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_saas), "__call__") as call: @@ -2607,9 +2626,10 @@ def test_update_saas_non_empty_request_with_auto_populated_field(): client.update_saas(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == deployments_service.UpdateSaasRequest( + request_msg = deployments_service.UpdateSaasRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_saas_use_cached_wrapped_rpc(): @@ -2690,9 +2710,14 @@ async def test_update_saas_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_saas_async( - transport: str = "grpc_asyncio", request_type=deployments_service.UpdateSaasRequest -): +@pytest.mark.parametrize( + "request_type", + [ + deployments_service.UpdateSaasRequest(), + {}, + ], +) +async def test_update_saas_async(request_type, transport: str = "grpc_asyncio"): client = SaasDeploymentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2700,7 +2725,7 @@ async def test_update_saas_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_saas), "__call__") as call: @@ -2727,11 +2752,6 @@ async def test_update_saas_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_update_saas_async_from_dict(): - await test_update_saas_async(request_type=dict) - - def test_update_saas_field_headers(): client = SaasDeploymentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2888,8 +2908,8 @@ async def test_update_saas_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - deployments_service.DeleteSaasRequest, - dict, + deployments_service.DeleteSaasRequest(), + {}, ], ) def test_delete_saas(request_type, transport: str = "grpc"): @@ -2900,7 +2920,7 @@ def test_delete_saas(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_saas), "__call__") as call: @@ -2943,11 +2963,12 @@ def test_delete_saas_non_empty_request_with_auto_populated_field(): client.delete_saas(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == deployments_service.DeleteSaasRequest( + request_msg = deployments_service.DeleteSaasRequest( name="name_value", etag="etag_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_saas_use_cached_wrapped_rpc(): @@ -3028,9 +3049,14 @@ async def test_delete_saas_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_saas_async( - transport: str = "grpc_asyncio", request_type=deployments_service.DeleteSaasRequest -): +@pytest.mark.parametrize( + "request_type", + [ + deployments_service.DeleteSaasRequest(), + {}, + ], +) +async def test_delete_saas_async(request_type, transport: str = "grpc_asyncio"): client = SaasDeploymentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3038,7 +3064,7 @@ async def test_delete_saas_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_saas), "__call__") as call: @@ -3056,11 +3082,6 @@ async def test_delete_saas_async( assert response is None -@pytest.mark.asyncio -async def test_delete_saas_async_from_dict(): - await test_delete_saas_async(request_type=dict) - - def test_delete_saas_field_headers(): client = SaasDeploymentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3203,8 +3224,8 @@ async def test_delete_saas_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - deployments_service.ListTenantsRequest, - dict, + deployments_service.ListTenantsRequest(), + {}, ], ) def test_list_tenants(request_type, transport: str = "grpc"): @@ -3215,7 +3236,7 @@ def test_list_tenants(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tenants), "__call__") as call: @@ -3264,12 +3285,13 @@ def test_list_tenants_non_empty_request_with_auto_populated_field(): client.list_tenants(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == deployments_service.ListTenantsRequest( + request_msg = deployments_service.ListTenantsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_tenants_use_cached_wrapped_rpc(): @@ -3350,9 +3372,14 @@ async def test_list_tenants_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_tenants_async( - transport: str = "grpc_asyncio", request_type=deployments_service.ListTenantsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + deployments_service.ListTenantsRequest(), + {}, + ], +) +async def test_list_tenants_async(request_type, transport: str = "grpc_asyncio"): client = SaasDeploymentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3360,7 +3387,7 @@ async def test_list_tenants_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_tenants), "__call__") as call: @@ -3385,11 +3412,6 @@ async def test_list_tenants_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_tenants_async_from_dict(): - await test_list_tenants_async(request_type=dict) - - def test_list_tenants_field_headers(): client = SaasDeploymentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3726,8 +3748,8 @@ async def test_list_tenants_async_pages(): @pytest.mark.parametrize( "request_type", [ - deployments_service.GetTenantRequest, - dict, + deployments_service.GetTenantRequest(), + {}, ], ) def test_get_tenant(request_type, transport: str = "grpc"): @@ -3738,7 +3760,7 @@ def test_get_tenant(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tenant), "__call__") as call: @@ -3790,9 +3812,10 @@ def test_get_tenant_non_empty_request_with_auto_populated_field(): client.get_tenant(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == deployments_service.GetTenantRequest( + request_msg = deployments_service.GetTenantRequest( name="name_value", ) + assert args[0] == request_msg def test_get_tenant_use_cached_wrapped_rpc(): @@ -3871,9 +3894,14 @@ async def test_get_tenant_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_tenant_async( - transport: str = "grpc_asyncio", request_type=deployments_service.GetTenantRequest -): +@pytest.mark.parametrize( + "request_type", + [ + deployments_service.GetTenantRequest(), + {}, + ], +) +async def test_get_tenant_async(request_type, transport: str = "grpc_asyncio"): client = SaasDeploymentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3881,7 +3909,7 @@ async def test_get_tenant_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_tenant), "__call__") as call: @@ -3912,11 +3940,6 @@ async def test_get_tenant_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_tenant_async_from_dict(): - await test_get_tenant_async(request_type=dict) - - def test_get_tenant_field_headers(): client = SaasDeploymentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4063,8 +4086,8 @@ async def test_get_tenant_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - deployments_service.CreateTenantRequest, - dict, + deployments_service.CreateTenantRequest(), + {}, ], ) def test_create_tenant(request_type, transport: str = "grpc"): @@ -4075,7 +4098,7 @@ def test_create_tenant(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tenant), "__call__") as call: @@ -4129,11 +4152,12 @@ def test_create_tenant_non_empty_request_with_auto_populated_field(): client.create_tenant(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == deployments_service.CreateTenantRequest( + request_msg = deployments_service.CreateTenantRequest( parent="parent_value", tenant_id="tenant_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_tenant_use_cached_wrapped_rpc(): @@ -4214,10 +4238,14 @@ async def test_create_tenant_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_tenant_async( - transport: str = "grpc_asyncio", - request_type=deployments_service.CreateTenantRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + deployments_service.CreateTenantRequest(), + {}, + ], +) +async def test_create_tenant_async(request_type, transport: str = "grpc_asyncio"): client = SaasDeploymentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4225,7 +4253,7 @@ async def test_create_tenant_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_tenant), "__call__") as call: @@ -4256,11 +4284,6 @@ async def test_create_tenant_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_create_tenant_async_from_dict(): - await test_create_tenant_async(request_type=dict) - - def test_create_tenant_field_headers(): client = SaasDeploymentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4427,8 +4450,8 @@ async def test_create_tenant_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - deployments_service.UpdateTenantRequest, - dict, + deployments_service.UpdateTenantRequest(), + {}, ], ) def test_update_tenant(request_type, transport: str = "grpc"): @@ -4439,7 +4462,7 @@ def test_update_tenant(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tenant), "__call__") as call: @@ -4491,9 +4514,10 @@ def test_update_tenant_non_empty_request_with_auto_populated_field(): client.update_tenant(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == deployments_service.UpdateTenantRequest( + request_msg = deployments_service.UpdateTenantRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_tenant_use_cached_wrapped_rpc(): @@ -4574,10 +4598,14 @@ async def test_update_tenant_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_tenant_async( - transport: str = "grpc_asyncio", - request_type=deployments_service.UpdateTenantRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + deployments_service.UpdateTenantRequest(), + {}, + ], +) +async def test_update_tenant_async(request_type, transport: str = "grpc_asyncio"): client = SaasDeploymentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4585,7 +4613,7 @@ async def test_update_tenant_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_tenant), "__call__") as call: @@ -4616,11 +4644,6 @@ async def test_update_tenant_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_update_tenant_async_from_dict(): - await test_update_tenant_async(request_type=dict) - - def test_update_tenant_field_headers(): client = SaasDeploymentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4777,8 +4800,8 @@ async def test_update_tenant_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - deployments_service.DeleteTenantRequest, - dict, + deployments_service.DeleteTenantRequest(), + {}, ], ) def test_delete_tenant(request_type, transport: str = "grpc"): @@ -4789,7 +4812,7 @@ def test_delete_tenant(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tenant), "__call__") as call: @@ -4832,11 +4855,12 @@ def test_delete_tenant_non_empty_request_with_auto_populated_field(): client.delete_tenant(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == deployments_service.DeleteTenantRequest( + request_msg = deployments_service.DeleteTenantRequest( name="name_value", etag="etag_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_tenant_use_cached_wrapped_rpc(): @@ -4917,10 +4941,14 @@ async def test_delete_tenant_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_tenant_async( - transport: str = "grpc_asyncio", - request_type=deployments_service.DeleteTenantRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + deployments_service.DeleteTenantRequest(), + {}, + ], +) +async def test_delete_tenant_async(request_type, transport: str = "grpc_asyncio"): client = SaasDeploymentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4928,7 +4956,7 @@ async def test_delete_tenant_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_tenant), "__call__") as call: @@ -4946,11 +4974,6 @@ async def test_delete_tenant_async( assert response is None -@pytest.mark.asyncio -async def test_delete_tenant_async_from_dict(): - await test_delete_tenant_async(request_type=dict) - - def test_delete_tenant_field_headers(): client = SaasDeploymentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5093,8 +5116,8 @@ async def test_delete_tenant_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - deployments_service.ListUnitKindsRequest, - dict, + deployments_service.ListUnitKindsRequest(), + {}, ], ) def test_list_unit_kinds(request_type, transport: str = "grpc"): @@ -5105,7 +5128,7 @@ def test_list_unit_kinds(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_unit_kinds), "__call__") as call: @@ -5154,12 +5177,13 @@ def test_list_unit_kinds_non_empty_request_with_auto_populated_field(): client.list_unit_kinds(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == deployments_service.ListUnitKindsRequest( + request_msg = deployments_service.ListUnitKindsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_unit_kinds_use_cached_wrapped_rpc(): @@ -5240,10 +5264,14 @@ async def test_list_unit_kinds_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_unit_kinds_async( - transport: str = "grpc_asyncio", - request_type=deployments_service.ListUnitKindsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + deployments_service.ListUnitKindsRequest(), + {}, + ], +) +async def test_list_unit_kinds_async(request_type, transport: str = "grpc_asyncio"): client = SaasDeploymentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5251,7 +5279,7 @@ async def test_list_unit_kinds_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_unit_kinds), "__call__") as call: @@ -5276,11 +5304,6 @@ async def test_list_unit_kinds_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_unit_kinds_async_from_dict(): - await test_list_unit_kinds_async(request_type=dict) - - def test_list_unit_kinds_field_headers(): client = SaasDeploymentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5617,8 +5640,8 @@ async def test_list_unit_kinds_async_pages(): @pytest.mark.parametrize( "request_type", [ - deployments_service.GetUnitKindRequest, - dict, + deployments_service.GetUnitKindRequest(), + {}, ], ) def test_get_unit_kind(request_type, transport: str = "grpc"): @@ -5629,7 +5652,7 @@ def test_get_unit_kind(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_unit_kind), "__call__") as call: @@ -5681,9 +5704,10 @@ def test_get_unit_kind_non_empty_request_with_auto_populated_field(): client.get_unit_kind(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == deployments_service.GetUnitKindRequest( + request_msg = deployments_service.GetUnitKindRequest( name="name_value", ) + assert args[0] == request_msg def test_get_unit_kind_use_cached_wrapped_rpc(): @@ -5764,9 +5788,14 @@ async def test_get_unit_kind_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_unit_kind_async( - transport: str = "grpc_asyncio", request_type=deployments_service.GetUnitKindRequest -): +@pytest.mark.parametrize( + "request_type", + [ + deployments_service.GetUnitKindRequest(), + {}, + ], +) +async def test_get_unit_kind_async(request_type, transport: str = "grpc_asyncio"): client = SaasDeploymentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5774,7 +5803,7 @@ async def test_get_unit_kind_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_unit_kind), "__call__") as call: @@ -5805,11 +5834,6 @@ async def test_get_unit_kind_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_unit_kind_async_from_dict(): - await test_get_unit_kind_async(request_type=dict) - - def test_get_unit_kind_field_headers(): client = SaasDeploymentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5956,8 +5980,8 @@ async def test_get_unit_kind_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - deployments_service.CreateUnitKindRequest, - dict, + deployments_service.CreateUnitKindRequest(), + {}, ], ) def test_create_unit_kind(request_type, transport: str = "grpc"): @@ -5968,7 +5992,7 @@ def test_create_unit_kind(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_unit_kind), "__call__") as call: @@ -6022,11 +6046,12 @@ def test_create_unit_kind_non_empty_request_with_auto_populated_field(): client.create_unit_kind(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == deployments_service.CreateUnitKindRequest( + request_msg = deployments_service.CreateUnitKindRequest( parent="parent_value", unit_kind_id="unit_kind_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_unit_kind_use_cached_wrapped_rpc(): @@ -6109,10 +6134,14 @@ async def test_create_unit_kind_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_unit_kind_async( - transport: str = "grpc_asyncio", - request_type=deployments_service.CreateUnitKindRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + deployments_service.CreateUnitKindRequest(), + {}, + ], +) +async def test_create_unit_kind_async(request_type, transport: str = "grpc_asyncio"): client = SaasDeploymentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6120,7 +6149,7 @@ async def test_create_unit_kind_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_unit_kind), "__call__") as call: @@ -6151,11 +6180,6 @@ async def test_create_unit_kind_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_create_unit_kind_async_from_dict(): - await test_create_unit_kind_async(request_type=dict) - - def test_create_unit_kind_field_headers(): client = SaasDeploymentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6322,8 +6346,8 @@ async def test_create_unit_kind_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - deployments_service.UpdateUnitKindRequest, - dict, + deployments_service.UpdateUnitKindRequest(), + {}, ], ) def test_update_unit_kind(request_type, transport: str = "grpc"): @@ -6334,7 +6358,7 @@ def test_update_unit_kind(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_unit_kind), "__call__") as call: @@ -6386,9 +6410,10 @@ def test_update_unit_kind_non_empty_request_with_auto_populated_field(): client.update_unit_kind(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == deployments_service.UpdateUnitKindRequest( + request_msg = deployments_service.UpdateUnitKindRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_unit_kind_use_cached_wrapped_rpc(): @@ -6471,10 +6496,14 @@ async def test_update_unit_kind_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_unit_kind_async( - transport: str = "grpc_asyncio", - request_type=deployments_service.UpdateUnitKindRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + deployments_service.UpdateUnitKindRequest(), + {}, + ], +) +async def test_update_unit_kind_async(request_type, transport: str = "grpc_asyncio"): client = SaasDeploymentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6482,7 +6511,7 @@ async def test_update_unit_kind_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_unit_kind), "__call__") as call: @@ -6513,11 +6542,6 @@ async def test_update_unit_kind_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_update_unit_kind_async_from_dict(): - await test_update_unit_kind_async(request_type=dict) - - def test_update_unit_kind_field_headers(): client = SaasDeploymentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6674,8 +6698,8 @@ async def test_update_unit_kind_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - deployments_service.DeleteUnitKindRequest, - dict, + deployments_service.DeleteUnitKindRequest(), + {}, ], ) def test_delete_unit_kind(request_type, transport: str = "grpc"): @@ -6686,7 +6710,7 @@ def test_delete_unit_kind(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_unit_kind), "__call__") as call: @@ -6729,11 +6753,12 @@ def test_delete_unit_kind_non_empty_request_with_auto_populated_field(): client.delete_unit_kind(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == deployments_service.DeleteUnitKindRequest( + request_msg = deployments_service.DeleteUnitKindRequest( name="name_value", etag="etag_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_unit_kind_use_cached_wrapped_rpc(): @@ -6816,10 +6841,14 @@ async def test_delete_unit_kind_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_unit_kind_async( - transport: str = "grpc_asyncio", - request_type=deployments_service.DeleteUnitKindRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + deployments_service.DeleteUnitKindRequest(), + {}, + ], +) +async def test_delete_unit_kind_async(request_type, transport: str = "grpc_asyncio"): client = SaasDeploymentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6827,7 +6856,7 @@ async def test_delete_unit_kind_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_unit_kind), "__call__") as call: @@ -6845,11 +6874,6 @@ async def test_delete_unit_kind_async( assert response is None -@pytest.mark.asyncio -async def test_delete_unit_kind_async_from_dict(): - await test_delete_unit_kind_async(request_type=dict) - - def test_delete_unit_kind_field_headers(): client = SaasDeploymentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6992,8 +7016,8 @@ async def test_delete_unit_kind_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - deployments_service.ListUnitsRequest, - dict, + deployments_service.ListUnitsRequest(), + {}, ], ) def test_list_units(request_type, transport: str = "grpc"): @@ -7004,7 +7028,7 @@ def test_list_units(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_units), "__call__") as call: @@ -7053,12 +7077,13 @@ def test_list_units_non_empty_request_with_auto_populated_field(): client.list_units(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == deployments_service.ListUnitsRequest( + request_msg = deployments_service.ListUnitsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_units_use_cached_wrapped_rpc(): @@ -7137,9 +7162,14 @@ async def test_list_units_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_list_units_async( - transport: str = "grpc_asyncio", request_type=deployments_service.ListUnitsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + deployments_service.ListUnitsRequest(), + {}, + ], +) +async def test_list_units_async(request_type, transport: str = "grpc_asyncio"): client = SaasDeploymentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7147,7 +7177,7 @@ async def test_list_units_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_units), "__call__") as call: @@ -7172,11 +7202,6 @@ async def test_list_units_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_units_async_from_dict(): - await test_list_units_async(request_type=dict) - - def test_list_units_field_headers(): client = SaasDeploymentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7513,8 +7538,8 @@ async def test_list_units_async_pages(): @pytest.mark.parametrize( "request_type", [ - deployments_service.GetUnitRequest, - dict, + deployments_service.GetUnitRequest(), + {}, ], ) def test_get_unit(request_type, transport: str = "grpc"): @@ -7525,7 +7550,7 @@ def test_get_unit(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_unit), "__call__") as call: @@ -7600,9 +7625,10 @@ def test_get_unit_non_empty_request_with_auto_populated_field(): client.get_unit(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == deployments_service.GetUnitRequest( + request_msg = deployments_service.GetUnitRequest( name="name_value", ) + assert args[0] == request_msg def test_get_unit_use_cached_wrapped_rpc(): @@ -7681,9 +7707,14 @@ async def test_get_unit_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn @pytest.mark.asyncio -async def test_get_unit_async( - transport: str = "grpc_asyncio", request_type=deployments_service.GetUnitRequest -): +@pytest.mark.parametrize( + "request_type", + [ + deployments_service.GetUnitRequest(), + {}, + ], +) +async def test_get_unit_async(request_type, transport: str = "grpc_asyncio"): client = SaasDeploymentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7691,7 +7722,7 @@ async def test_get_unit_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_unit), "__call__") as call: @@ -7745,11 +7776,6 @@ async def test_get_unit_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_unit_async_from_dict(): - await test_get_unit_async(request_type=dict) - - def test_get_unit_field_headers(): client = SaasDeploymentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7896,8 +7922,8 @@ async def test_get_unit_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - deployments_service.CreateUnitRequest, - dict, + deployments_service.CreateUnitRequest(), + {}, ], ) def test_create_unit(request_type, transport: str = "grpc"): @@ -7908,7 +7934,7 @@ def test_create_unit(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_unit), "__call__") as call: @@ -7985,11 +8011,12 @@ def test_create_unit_non_empty_request_with_auto_populated_field(): client.create_unit(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == deployments_service.CreateUnitRequest( + request_msg = deployments_service.CreateUnitRequest( parent="parent_value", unit_id="unit_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_unit_use_cached_wrapped_rpc(): @@ -8070,9 +8097,14 @@ async def test_create_unit_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_unit_async( - transport: str = "grpc_asyncio", request_type=deployments_service.CreateUnitRequest -): +@pytest.mark.parametrize( + "request_type", + [ + deployments_service.CreateUnitRequest(), + {}, + ], +) +async def test_create_unit_async(request_type, transport: str = "grpc_asyncio"): client = SaasDeploymentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8080,7 +8112,7 @@ async def test_create_unit_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_unit), "__call__") as call: @@ -8134,11 +8166,6 @@ async def test_create_unit_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_create_unit_async_from_dict(): - await test_create_unit_async(request_type=dict) - - def test_create_unit_field_headers(): client = SaasDeploymentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8305,8 +8332,8 @@ async def test_create_unit_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - deployments_service.UpdateUnitRequest, - dict, + deployments_service.UpdateUnitRequest(), + {}, ], ) def test_update_unit(request_type, transport: str = "grpc"): @@ -8317,7 +8344,7 @@ def test_update_unit(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_unit), "__call__") as call: @@ -8392,9 +8419,10 @@ def test_update_unit_non_empty_request_with_auto_populated_field(): client.update_unit(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == deployments_service.UpdateUnitRequest( + request_msg = deployments_service.UpdateUnitRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_unit_use_cached_wrapped_rpc(): @@ -8475,9 +8503,14 @@ async def test_update_unit_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_unit_async( - transport: str = "grpc_asyncio", request_type=deployments_service.UpdateUnitRequest -): +@pytest.mark.parametrize( + "request_type", + [ + deployments_service.UpdateUnitRequest(), + {}, + ], +) +async def test_update_unit_async(request_type, transport: str = "grpc_asyncio"): client = SaasDeploymentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8485,7 +8518,7 @@ async def test_update_unit_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_unit), "__call__") as call: @@ -8539,11 +8572,6 @@ async def test_update_unit_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_update_unit_async_from_dict(): - await test_update_unit_async(request_type=dict) - - def test_update_unit_field_headers(): client = SaasDeploymentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8700,8 +8728,8 @@ async def test_update_unit_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - deployments_service.DeleteUnitRequest, - dict, + deployments_service.DeleteUnitRequest(), + {}, ], ) def test_delete_unit(request_type, transport: str = "grpc"): @@ -8712,7 +8740,7 @@ def test_delete_unit(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_unit), "__call__") as call: @@ -8755,11 +8783,12 @@ def test_delete_unit_non_empty_request_with_auto_populated_field(): client.delete_unit(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == deployments_service.DeleteUnitRequest( + request_msg = deployments_service.DeleteUnitRequest( name="name_value", etag="etag_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_unit_use_cached_wrapped_rpc(): @@ -8840,9 +8869,14 @@ async def test_delete_unit_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_unit_async( - transport: str = "grpc_asyncio", request_type=deployments_service.DeleteUnitRequest -): +@pytest.mark.parametrize( + "request_type", + [ + deployments_service.DeleteUnitRequest(), + {}, + ], +) +async def test_delete_unit_async(request_type, transport: str = "grpc_asyncio"): client = SaasDeploymentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8850,7 +8884,7 @@ async def test_delete_unit_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_unit), "__call__") as call: @@ -8868,11 +8902,6 @@ async def test_delete_unit_async( assert response is None -@pytest.mark.asyncio -async def test_delete_unit_async_from_dict(): - await test_delete_unit_async(request_type=dict) - - def test_delete_unit_field_headers(): client = SaasDeploymentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9015,8 +9044,8 @@ async def test_delete_unit_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - deployments_service.ListUnitOperationsRequest, - dict, + deployments_service.ListUnitOperationsRequest(), + {}, ], ) def test_list_unit_operations(request_type, transport: str = "grpc"): @@ -9027,7 +9056,7 @@ def test_list_unit_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( @@ -9080,12 +9109,13 @@ def test_list_unit_operations_non_empty_request_with_auto_populated_field(): client.list_unit_operations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == deployments_service.ListUnitOperationsRequest( + request_msg = deployments_service.ListUnitOperationsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_unit_operations_use_cached_wrapped_rpc(): @@ -9170,9 +9200,15 @@ async def test_list_unit_operations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + deployments_service.ListUnitOperationsRequest(), + {}, + ], +) async def test_list_unit_operations_async( - transport: str = "grpc_asyncio", - request_type=deployments_service.ListUnitOperationsRequest, + request_type, transport: str = "grpc_asyncio" ): client = SaasDeploymentsAsyncClient( credentials=async_anonymous_credentials(), @@ -9181,7 +9217,7 @@ async def test_list_unit_operations_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( @@ -9208,11 +9244,6 @@ async def test_list_unit_operations_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_unit_operations_async_from_dict(): - await test_list_unit_operations_async(request_type=dict) - - def test_list_unit_operations_field_headers(): client = SaasDeploymentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9567,8 +9598,8 @@ async def test_list_unit_operations_async_pages(): @pytest.mark.parametrize( "request_type", [ - deployments_service.GetUnitOperationRequest, - dict, + deployments_service.GetUnitOperationRequest(), + {}, ], ) def test_get_unit_operation(request_type, transport: str = "grpc"): @@ -9579,7 +9610,7 @@ def test_get_unit_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( @@ -9648,9 +9679,10 @@ def test_get_unit_operation_non_empty_request_with_auto_populated_field(): client.get_unit_operation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == deployments_service.GetUnitOperationRequest( + request_msg = deployments_service.GetUnitOperationRequest( name="name_value", ) + assert args[0] == request_msg def test_get_unit_operation_use_cached_wrapped_rpc(): @@ -9735,10 +9767,14 @@ async def test_get_unit_operation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_unit_operation_async( - transport: str = "grpc_asyncio", - request_type=deployments_service.GetUnitOperationRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + deployments_service.GetUnitOperationRequest(), + {}, + ], +) +async def test_get_unit_operation_async(request_type, transport: str = "grpc_asyncio"): client = SaasDeploymentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9746,7 +9782,7 @@ async def test_get_unit_operation_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( @@ -9792,11 +9828,6 @@ async def test_get_unit_operation_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_unit_operation_async_from_dict(): - await test_get_unit_operation_async(request_type=dict) - - def test_get_unit_operation_field_headers(): client = SaasDeploymentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9951,8 +9982,8 @@ async def test_get_unit_operation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - deployments_service.CreateUnitOperationRequest, - dict, + deployments_service.CreateUnitOperationRequest(), + {}, ], ) def test_create_unit_operation(request_type, transport: str = "grpc"): @@ -9963,7 +9994,7 @@ def test_create_unit_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( @@ -10034,11 +10065,12 @@ def test_create_unit_operation_non_empty_request_with_auto_populated_field(): client.create_unit_operation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == deployments_service.CreateUnitOperationRequest( + request_msg = deployments_service.CreateUnitOperationRequest( parent="parent_value", unit_operation_id="unit_operation_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_unit_operation_use_cached_wrapped_rpc(): @@ -10124,9 +10156,15 @@ async def test_create_unit_operation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + deployments_service.CreateUnitOperationRequest(), + {}, + ], +) async def test_create_unit_operation_async( - transport: str = "grpc_asyncio", - request_type=deployments_service.CreateUnitOperationRequest, + request_type, transport: str = "grpc_asyncio" ): client = SaasDeploymentsAsyncClient( credentials=async_anonymous_credentials(), @@ -10135,7 +10173,7 @@ async def test_create_unit_operation_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( @@ -10181,11 +10219,6 @@ async def test_create_unit_operation_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_create_unit_operation_async_from_dict(): - await test_create_unit_operation_async(request_type=dict) - - def test_create_unit_operation_field_headers(): client = SaasDeploymentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10372,8 +10405,8 @@ async def test_create_unit_operation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - deployments_service.UpdateUnitOperationRequest, - dict, + deployments_service.UpdateUnitOperationRequest(), + {}, ], ) def test_update_unit_operation(request_type, transport: str = "grpc"): @@ -10384,7 +10417,7 @@ def test_update_unit_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( @@ -10453,9 +10486,10 @@ def test_update_unit_operation_non_empty_request_with_auto_populated_field(): client.update_unit_operation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == deployments_service.UpdateUnitOperationRequest( + request_msg = deployments_service.UpdateUnitOperationRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_unit_operation_use_cached_wrapped_rpc(): @@ -10541,9 +10575,15 @@ async def test_update_unit_operation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + deployments_service.UpdateUnitOperationRequest(), + {}, + ], +) async def test_update_unit_operation_async( - transport: str = "grpc_asyncio", - request_type=deployments_service.UpdateUnitOperationRequest, + request_type, transport: str = "grpc_asyncio" ): client = SaasDeploymentsAsyncClient( credentials=async_anonymous_credentials(), @@ -10552,7 +10592,7 @@ async def test_update_unit_operation_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( @@ -10598,11 +10638,6 @@ async def test_update_unit_operation_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_update_unit_operation_async_from_dict(): - await test_update_unit_operation_async(request_type=dict) - - def test_update_unit_operation_field_headers(): client = SaasDeploymentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10779,8 +10814,8 @@ async def test_update_unit_operation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - deployments_service.DeleteUnitOperationRequest, - dict, + deployments_service.DeleteUnitOperationRequest(), + {}, ], ) def test_delete_unit_operation(request_type, transport: str = "grpc"): @@ -10791,7 +10826,7 @@ def test_delete_unit_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( @@ -10838,11 +10873,12 @@ def test_delete_unit_operation_non_empty_request_with_auto_populated_field(): client.delete_unit_operation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == deployments_service.DeleteUnitOperationRequest( + request_msg = deployments_service.DeleteUnitOperationRequest( name="name_value", etag="etag_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_unit_operation_use_cached_wrapped_rpc(): @@ -10928,9 +10964,15 @@ async def test_delete_unit_operation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + deployments_service.DeleteUnitOperationRequest(), + {}, + ], +) async def test_delete_unit_operation_async( - transport: str = "grpc_asyncio", - request_type=deployments_service.DeleteUnitOperationRequest, + request_type, transport: str = "grpc_asyncio" ): client = SaasDeploymentsAsyncClient( credentials=async_anonymous_credentials(), @@ -10939,7 +10981,7 @@ async def test_delete_unit_operation_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( @@ -10959,11 +11001,6 @@ async def test_delete_unit_operation_async( assert response is None -@pytest.mark.asyncio -async def test_delete_unit_operation_async_from_dict(): - await test_delete_unit_operation_async(request_type=dict) - - def test_delete_unit_operation_field_headers(): client = SaasDeploymentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11114,8 +11151,8 @@ async def test_delete_unit_operation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - deployments_service.ListReleasesRequest, - dict, + deployments_service.ListReleasesRequest(), + {}, ], ) def test_list_releases(request_type, transport: str = "grpc"): @@ -11126,7 +11163,7 @@ def test_list_releases(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_releases), "__call__") as call: @@ -11175,12 +11212,13 @@ def test_list_releases_non_empty_request_with_auto_populated_field(): client.list_releases(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == deployments_service.ListReleasesRequest( + request_msg = deployments_service.ListReleasesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_releases_use_cached_wrapped_rpc(): @@ -11261,10 +11299,14 @@ async def test_list_releases_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_releases_async( - transport: str = "grpc_asyncio", - request_type=deployments_service.ListReleasesRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + deployments_service.ListReleasesRequest(), + {}, + ], +) +async def test_list_releases_async(request_type, transport: str = "grpc_asyncio"): client = SaasDeploymentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11272,7 +11314,7 @@ async def test_list_releases_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_releases), "__call__") as call: @@ -11297,11 +11339,6 @@ async def test_list_releases_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_releases_async_from_dict(): - await test_list_releases_async(request_type=dict) - - def test_list_releases_field_headers(): client = SaasDeploymentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11638,8 +11675,8 @@ async def test_list_releases_async_pages(): @pytest.mark.parametrize( "request_type", [ - deployments_service.GetReleaseRequest, - dict, + deployments_service.GetReleaseRequest(), + {}, ], ) def test_get_release(request_type, transport: str = "grpc"): @@ -11650,7 +11687,7 @@ def test_get_release(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_release), "__call__") as call: @@ -11700,9 +11737,10 @@ def test_get_release_non_empty_request_with_auto_populated_field(): client.get_release(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == deployments_service.GetReleaseRequest( + request_msg = deployments_service.GetReleaseRequest( name="name_value", ) + assert args[0] == request_msg def test_get_release_use_cached_wrapped_rpc(): @@ -11783,9 +11821,14 @@ async def test_get_release_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_release_async( - transport: str = "grpc_asyncio", request_type=deployments_service.GetReleaseRequest -): +@pytest.mark.parametrize( + "request_type", + [ + deployments_service.GetReleaseRequest(), + {}, + ], +) +async def test_get_release_async(request_type, transport: str = "grpc_asyncio"): client = SaasDeploymentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11793,7 +11836,7 @@ async def test_get_release_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_release), "__call__") as call: @@ -11822,11 +11865,6 @@ async def test_get_release_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_release_async_from_dict(): - await test_get_release_async(request_type=dict) - - def test_get_release_field_headers(): client = SaasDeploymentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11973,8 +12011,8 @@ async def test_get_release_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - deployments_service.CreateReleaseRequest, - dict, + deployments_service.CreateReleaseRequest(), + {}, ], ) def test_create_release(request_type, transport: str = "grpc"): @@ -11985,7 +12023,7 @@ def test_create_release(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_release), "__call__") as call: @@ -12037,11 +12075,12 @@ def test_create_release_non_empty_request_with_auto_populated_field(): client.create_release(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == deployments_service.CreateReleaseRequest( + request_msg = deployments_service.CreateReleaseRequest( parent="parent_value", release_id="release_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_release_use_cached_wrapped_rpc(): @@ -12122,10 +12161,14 @@ async def test_create_release_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_release_async( - transport: str = "grpc_asyncio", - request_type=deployments_service.CreateReleaseRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + deployments_service.CreateReleaseRequest(), + {}, + ], +) +async def test_create_release_async(request_type, transport: str = "grpc_asyncio"): client = SaasDeploymentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12133,7 +12176,7 @@ async def test_create_release_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_release), "__call__") as call: @@ -12162,11 +12205,6 @@ async def test_create_release_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_create_release_async_from_dict(): - await test_create_release_async(request_type=dict) - - def test_create_release_field_headers(): client = SaasDeploymentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12333,8 +12371,8 @@ async def test_create_release_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - deployments_service.UpdateReleaseRequest, - dict, + deployments_service.UpdateReleaseRequest(), + {}, ], ) def test_update_release(request_type, transport: str = "grpc"): @@ -12345,7 +12383,7 @@ def test_update_release(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_release), "__call__") as call: @@ -12395,9 +12433,10 @@ def test_update_release_non_empty_request_with_auto_populated_field(): client.update_release(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == deployments_service.UpdateReleaseRequest( + request_msg = deployments_service.UpdateReleaseRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_release_use_cached_wrapped_rpc(): @@ -12478,10 +12517,14 @@ async def test_update_release_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_release_async( - transport: str = "grpc_asyncio", - request_type=deployments_service.UpdateReleaseRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + deployments_service.UpdateReleaseRequest(), + {}, + ], +) +async def test_update_release_async(request_type, transport: str = "grpc_asyncio"): client = SaasDeploymentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12489,7 +12532,7 @@ async def test_update_release_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_release), "__call__") as call: @@ -12518,11 +12561,6 @@ async def test_update_release_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_update_release_async_from_dict(): - await test_update_release_async(request_type=dict) - - def test_update_release_field_headers(): client = SaasDeploymentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12679,8 +12717,8 @@ async def test_update_release_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - deployments_service.DeleteReleaseRequest, - dict, + deployments_service.DeleteReleaseRequest(), + {}, ], ) def test_delete_release(request_type, transport: str = "grpc"): @@ -12691,7 +12729,7 @@ def test_delete_release(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_release), "__call__") as call: @@ -12734,11 +12772,12 @@ def test_delete_release_non_empty_request_with_auto_populated_field(): client.delete_release(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == deployments_service.DeleteReleaseRequest( + request_msg = deployments_service.DeleteReleaseRequest( name="name_value", etag="etag_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_release_use_cached_wrapped_rpc(): @@ -12819,10 +12858,14 @@ async def test_delete_release_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_release_async( - transport: str = "grpc_asyncio", - request_type=deployments_service.DeleteReleaseRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + deployments_service.DeleteReleaseRequest(), + {}, + ], +) +async def test_delete_release_async(request_type, transport: str = "grpc_asyncio"): client = SaasDeploymentsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12830,7 +12873,7 @@ async def test_delete_release_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_release), "__call__") as call: @@ -12848,11 +12891,6 @@ async def test_delete_release_async( assert response is None -@pytest.mark.asyncio -async def test_delete_release_async_from_dict(): - await test_delete_release_async(request_type=dict) - - def test_delete_release_field_headers(): client = SaasDeploymentsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -19406,7 +19444,6 @@ def test_list_saas_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.ListSaasRequest() - assert args[0] == request_msg @@ -19427,7 +19464,6 @@ def test_get_saas_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.GetSaasRequest() - assert args[0] == request_msg @@ -19448,7 +19484,6 @@ def test_create_saas_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.CreateSaasRequest() - assert args[0] == request_msg @@ -19469,7 +19504,6 @@ def test_update_saas_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.UpdateSaasRequest() - assert args[0] == request_msg @@ -19490,7 +19524,6 @@ def test_delete_saas_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.DeleteSaasRequest() - assert args[0] == request_msg @@ -19511,7 +19544,6 @@ def test_list_tenants_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.ListTenantsRequest() - assert args[0] == request_msg @@ -19532,7 +19564,6 @@ def test_get_tenant_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.GetTenantRequest() - assert args[0] == request_msg @@ -19553,7 +19584,6 @@ def test_create_tenant_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.CreateTenantRequest() - assert args[0] == request_msg @@ -19574,7 +19604,6 @@ def test_update_tenant_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.UpdateTenantRequest() - assert args[0] == request_msg @@ -19595,7 +19624,6 @@ def test_delete_tenant_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.DeleteTenantRequest() - assert args[0] == request_msg @@ -19616,7 +19644,6 @@ def test_list_unit_kinds_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.ListUnitKindsRequest() - assert args[0] == request_msg @@ -19637,7 +19664,6 @@ def test_get_unit_kind_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.GetUnitKindRequest() - assert args[0] == request_msg @@ -19658,7 +19684,6 @@ def test_create_unit_kind_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.CreateUnitKindRequest() - assert args[0] == request_msg @@ -19679,7 +19704,6 @@ def test_update_unit_kind_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.UpdateUnitKindRequest() - assert args[0] == request_msg @@ -19700,7 +19724,6 @@ def test_delete_unit_kind_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.DeleteUnitKindRequest() - assert args[0] == request_msg @@ -19721,7 +19744,6 @@ def test_list_units_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.ListUnitsRequest() - assert args[0] == request_msg @@ -19742,7 +19764,6 @@ def test_get_unit_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.GetUnitRequest() - assert args[0] == request_msg @@ -19763,7 +19784,6 @@ def test_create_unit_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.CreateUnitRequest() - assert args[0] == request_msg @@ -19784,7 +19804,6 @@ def test_update_unit_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.UpdateUnitRequest() - assert args[0] == request_msg @@ -19805,7 +19824,6 @@ def test_delete_unit_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.DeleteUnitRequest() - assert args[0] == request_msg @@ -19828,7 +19846,6 @@ def test_list_unit_operations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.ListUnitOperationsRequest() - assert args[0] == request_msg @@ -19851,7 +19868,6 @@ def test_get_unit_operation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.GetUnitOperationRequest() - assert args[0] == request_msg @@ -19874,7 +19890,6 @@ def test_create_unit_operation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.CreateUnitOperationRequest() - assert args[0] == request_msg @@ -19897,7 +19912,6 @@ def test_update_unit_operation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.UpdateUnitOperationRequest() - assert args[0] == request_msg @@ -19920,7 +19934,6 @@ def test_delete_unit_operation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.DeleteUnitOperationRequest() - assert args[0] == request_msg @@ -19941,7 +19954,6 @@ def test_list_releases_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.ListReleasesRequest() - assert args[0] == request_msg @@ -19962,7 +19974,6 @@ def test_get_release_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.GetReleaseRequest() - assert args[0] == request_msg @@ -19983,7 +19994,6 @@ def test_create_release_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.CreateReleaseRequest() - assert args[0] == request_msg @@ -20004,7 +20014,6 @@ def test_update_release_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.UpdateReleaseRequest() - assert args[0] == request_msg @@ -20025,7 +20034,6 @@ def test_delete_release_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.DeleteReleaseRequest() - assert args[0] == request_msg @@ -20067,7 +20075,6 @@ async def test_list_saas_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.ListSaasRequest() - assert args[0] == request_msg @@ -20096,7 +20103,6 @@ async def test_get_saas_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.GetSaasRequest() - assert args[0] == request_msg @@ -20125,7 +20131,6 @@ async def test_create_saas_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.CreateSaasRequest() - assert args[0] == request_msg @@ -20154,7 +20159,6 @@ async def test_update_saas_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.UpdateSaasRequest() - assert args[0] == request_msg @@ -20177,7 +20181,6 @@ async def test_delete_saas_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.DeleteSaasRequest() - assert args[0] == request_msg @@ -20205,7 +20208,6 @@ async def test_list_tenants_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.ListTenantsRequest() - assert args[0] == request_msg @@ -20236,7 +20238,6 @@ async def test_get_tenant_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.GetTenantRequest() - assert args[0] == request_msg @@ -20267,7 +20268,6 @@ async def test_create_tenant_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.CreateTenantRequest() - assert args[0] == request_msg @@ -20298,7 +20298,6 @@ async def test_update_tenant_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.UpdateTenantRequest() - assert args[0] == request_msg @@ -20321,7 +20320,6 @@ async def test_delete_tenant_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.DeleteTenantRequest() - assert args[0] == request_msg @@ -20349,7 +20347,6 @@ async def test_list_unit_kinds_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.ListUnitKindsRequest() - assert args[0] == request_msg @@ -20380,7 +20377,6 @@ async def test_get_unit_kind_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.GetUnitKindRequest() - assert args[0] == request_msg @@ -20411,7 +20407,6 @@ async def test_create_unit_kind_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.CreateUnitKindRequest() - assert args[0] == request_msg @@ -20442,7 +20437,6 @@ async def test_update_unit_kind_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.UpdateUnitKindRequest() - assert args[0] == request_msg @@ -20465,7 +20459,6 @@ async def test_delete_unit_kind_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.DeleteUnitKindRequest() - assert args[0] == request_msg @@ -20493,7 +20486,6 @@ async def test_list_units_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.ListUnitsRequest() - assert args[0] == request_msg @@ -20531,7 +20523,6 @@ async def test_get_unit_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.GetUnitRequest() - assert args[0] == request_msg @@ -20569,7 +20560,6 @@ async def test_create_unit_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.CreateUnitRequest() - assert args[0] == request_msg @@ -20607,7 +20597,6 @@ async def test_update_unit_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.UpdateUnitRequest() - assert args[0] == request_msg @@ -20630,7 +20619,6 @@ async def test_delete_unit_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.DeleteUnitRequest() - assert args[0] == request_msg @@ -20660,7 +20648,6 @@ async def test_list_unit_operations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.ListUnitOperationsRequest() - assert args[0] == request_msg @@ -20698,7 +20685,6 @@ async def test_get_unit_operation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.GetUnitOperationRequest() - assert args[0] == request_msg @@ -20736,7 +20722,6 @@ async def test_create_unit_operation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.CreateUnitOperationRequest() - assert args[0] == request_msg @@ -20774,7 +20759,6 @@ async def test_update_unit_operation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.UpdateUnitOperationRequest() - assert args[0] == request_msg @@ -20799,7 +20783,6 @@ async def test_delete_unit_operation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.DeleteUnitOperationRequest() - assert args[0] == request_msg @@ -20827,7 +20810,6 @@ async def test_list_releases_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.ListReleasesRequest() - assert args[0] == request_msg @@ -20857,7 +20839,6 @@ async def test_get_release_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.GetReleaseRequest() - assert args[0] == request_msg @@ -20887,7 +20868,6 @@ async def test_create_release_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.CreateReleaseRequest() - assert args[0] == request_msg @@ -20917,7 +20897,6 @@ async def test_update_release_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.UpdateReleaseRequest() - assert args[0] == request_msg @@ -20940,7 +20919,6 @@ async def test_delete_release_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.DeleteReleaseRequest() - assert args[0] == request_msg @@ -26324,7 +26302,6 @@ def test_list_saas_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.ListSaasRequest() - assert args[0] == request_msg @@ -26344,7 +26321,6 @@ def test_get_saas_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.GetSaasRequest() - assert args[0] == request_msg @@ -26364,7 +26340,6 @@ def test_create_saas_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.CreateSaasRequest() - assert args[0] == request_msg @@ -26384,7 +26359,6 @@ def test_update_saas_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.UpdateSaasRequest() - assert args[0] == request_msg @@ -26404,7 +26378,6 @@ def test_delete_saas_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.DeleteSaasRequest() - assert args[0] == request_msg @@ -26424,7 +26397,6 @@ def test_list_tenants_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.ListTenantsRequest() - assert args[0] == request_msg @@ -26444,7 +26416,6 @@ def test_get_tenant_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.GetTenantRequest() - assert args[0] == request_msg @@ -26464,7 +26435,6 @@ def test_create_tenant_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.CreateTenantRequest() - assert args[0] == request_msg @@ -26484,7 +26454,6 @@ def test_update_tenant_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.UpdateTenantRequest() - assert args[0] == request_msg @@ -26504,7 +26473,6 @@ def test_delete_tenant_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.DeleteTenantRequest() - assert args[0] == request_msg @@ -26524,7 +26492,6 @@ def test_list_unit_kinds_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.ListUnitKindsRequest() - assert args[0] == request_msg @@ -26544,7 +26511,6 @@ def test_get_unit_kind_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.GetUnitKindRequest() - assert args[0] == request_msg @@ -26564,7 +26530,6 @@ def test_create_unit_kind_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.CreateUnitKindRequest() - assert args[0] == request_msg @@ -26584,7 +26549,6 @@ def test_update_unit_kind_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.UpdateUnitKindRequest() - assert args[0] == request_msg @@ -26604,7 +26568,6 @@ def test_delete_unit_kind_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.DeleteUnitKindRequest() - assert args[0] == request_msg @@ -26624,7 +26587,6 @@ def test_list_units_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.ListUnitsRequest() - assert args[0] == request_msg @@ -26644,7 +26606,6 @@ def test_get_unit_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.GetUnitRequest() - assert args[0] == request_msg @@ -26664,7 +26625,6 @@ def test_create_unit_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.CreateUnitRequest() - assert args[0] == request_msg @@ -26684,7 +26644,6 @@ def test_update_unit_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.UpdateUnitRequest() - assert args[0] == request_msg @@ -26704,7 +26663,6 @@ def test_delete_unit_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.DeleteUnitRequest() - assert args[0] == request_msg @@ -26726,7 +26684,6 @@ def test_list_unit_operations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.ListUnitOperationsRequest() - assert args[0] == request_msg @@ -26748,7 +26705,6 @@ def test_get_unit_operation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.GetUnitOperationRequest() - assert args[0] == request_msg @@ -26770,7 +26726,6 @@ def test_create_unit_operation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.CreateUnitOperationRequest() - assert args[0] == request_msg @@ -26792,7 +26747,6 @@ def test_update_unit_operation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.UpdateUnitOperationRequest() - assert args[0] == request_msg @@ -26814,7 +26768,6 @@ def test_delete_unit_operation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.DeleteUnitOperationRequest() - assert args[0] == request_msg @@ -26834,7 +26787,6 @@ def test_list_releases_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.ListReleasesRequest() - assert args[0] == request_msg @@ -26854,7 +26806,6 @@ def test_get_release_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.GetReleaseRequest() - assert args[0] == request_msg @@ -26874,7 +26825,6 @@ def test_create_release_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.CreateReleaseRequest() - assert args[0] == request_msg @@ -26894,7 +26844,6 @@ def test_update_release_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.UpdateReleaseRequest() - assert args[0] == request_msg @@ -26914,7 +26863,6 @@ def test_delete_release_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = deployments_service.DeleteReleaseRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-saasplatform-saasservicemgmt/tests/unit/gapic/saasplatform_saasservicemgmt_v1beta1/test_saas_rollouts.py b/packages/google-cloud-saasplatform-saasservicemgmt/tests/unit/gapic/saasplatform_saasservicemgmt_v1beta1/test_saas_rollouts.py index 045610f1a0e5..8f3200132cf1 100644 --- a/packages/google-cloud-saasplatform-saasservicemgmt/tests/unit/gapic/saasplatform_saasservicemgmt_v1beta1/test_saas_rollouts.py +++ b/packages/google-cloud-saasplatform-saasservicemgmt/tests/unit/gapic/saasplatform_saasservicemgmt_v1beta1/test_saas_rollouts.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 @@ -115,6 +116,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" @@ -1295,8 +1311,8 @@ def test_saas_rollouts_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - rollouts_service.ListRolloutsRequest, - dict, + rollouts_service.ListRolloutsRequest(), + {}, ], ) def test_list_rollouts(request_type, transport: str = "grpc"): @@ -1307,7 +1323,7 @@ def test_list_rollouts(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_rollouts), "__call__") as call: @@ -1356,12 +1372,13 @@ def test_list_rollouts_non_empty_request_with_auto_populated_field(): client.list_rollouts(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == rollouts_service.ListRolloutsRequest( + request_msg = rollouts_service.ListRolloutsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_rollouts_use_cached_wrapped_rpc(): @@ -1442,9 +1459,14 @@ async def test_list_rollouts_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_rollouts_async( - transport: str = "grpc_asyncio", request_type=rollouts_service.ListRolloutsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + rollouts_service.ListRolloutsRequest(), + {}, + ], +) +async def test_list_rollouts_async(request_type, transport: str = "grpc_asyncio"): client = SaasRolloutsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1452,7 +1474,7 @@ async def test_list_rollouts_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_rollouts), "__call__") as call: @@ -1477,11 +1499,6 @@ async def test_list_rollouts_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_rollouts_async_from_dict(): - await test_list_rollouts_async(request_type=dict) - - def test_list_rollouts_field_headers(): client = SaasRolloutsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1818,8 +1835,8 @@ async def test_list_rollouts_async_pages(): @pytest.mark.parametrize( "request_type", [ - rollouts_service.GetRolloutRequest, - dict, + rollouts_service.GetRolloutRequest(), + {}, ], ) def test_get_rollout(request_type, transport: str = "grpc"): @@ -1830,7 +1847,7 @@ def test_get_rollout(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_rollout), "__call__") as call: @@ -1899,9 +1916,10 @@ def test_get_rollout_non_empty_request_with_auto_populated_field(): client.get_rollout(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == rollouts_service.GetRolloutRequest( + request_msg = rollouts_service.GetRolloutRequest( name="name_value", ) + assert args[0] == request_msg def test_get_rollout_use_cached_wrapped_rpc(): @@ -1982,9 +2000,14 @@ async def test_get_rollout_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_rollout_async( - transport: str = "grpc_asyncio", request_type=rollouts_service.GetRolloutRequest -): +@pytest.mark.parametrize( + "request_type", + [ + rollouts_service.GetRolloutRequest(), + {}, + ], +) +async def test_get_rollout_async(request_type, transport: str = "grpc_asyncio"): client = SaasRolloutsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1992,7 +2015,7 @@ async def test_get_rollout_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_rollout), "__call__") as call: @@ -2040,11 +2063,6 @@ async def test_get_rollout_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_rollout_async_from_dict(): - await test_get_rollout_async(request_type=dict) - - def test_get_rollout_field_headers(): client = SaasRolloutsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2191,8 +2209,8 @@ async def test_get_rollout_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - rollouts_service.CreateRolloutRequest, - dict, + rollouts_service.CreateRolloutRequest(), + {}, ], ) def test_create_rollout(request_type, transport: str = "grpc"): @@ -2203,7 +2221,7 @@ def test_create_rollout(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_rollout), "__call__") as call: @@ -2274,11 +2292,12 @@ def test_create_rollout_non_empty_request_with_auto_populated_field(): client.create_rollout(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == rollouts_service.CreateRolloutRequest( + request_msg = rollouts_service.CreateRolloutRequest( parent="parent_value", rollout_id="rollout_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_rollout_use_cached_wrapped_rpc(): @@ -2359,9 +2378,14 @@ async def test_create_rollout_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_rollout_async( - transport: str = "grpc_asyncio", request_type=rollouts_service.CreateRolloutRequest -): +@pytest.mark.parametrize( + "request_type", + [ + rollouts_service.CreateRolloutRequest(), + {}, + ], +) +async def test_create_rollout_async(request_type, transport: str = "grpc_asyncio"): client = SaasRolloutsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2369,7 +2393,7 @@ async def test_create_rollout_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_rollout), "__call__") as call: @@ -2417,11 +2441,6 @@ async def test_create_rollout_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_create_rollout_async_from_dict(): - await test_create_rollout_async(request_type=dict) - - def test_create_rollout_field_headers(): client = SaasRolloutsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2588,8 +2607,8 @@ async def test_create_rollout_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - rollouts_service.UpdateRolloutRequest, - dict, + rollouts_service.UpdateRolloutRequest(), + {}, ], ) def test_update_rollout(request_type, transport: str = "grpc"): @@ -2600,7 +2619,7 @@ def test_update_rollout(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_rollout), "__call__") as call: @@ -2669,9 +2688,10 @@ def test_update_rollout_non_empty_request_with_auto_populated_field(): client.update_rollout(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == rollouts_service.UpdateRolloutRequest( + request_msg = rollouts_service.UpdateRolloutRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_rollout_use_cached_wrapped_rpc(): @@ -2752,9 +2772,14 @@ async def test_update_rollout_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_rollout_async( - transport: str = "grpc_asyncio", request_type=rollouts_service.UpdateRolloutRequest -): +@pytest.mark.parametrize( + "request_type", + [ + rollouts_service.UpdateRolloutRequest(), + {}, + ], +) +async def test_update_rollout_async(request_type, transport: str = "grpc_asyncio"): client = SaasRolloutsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2762,7 +2787,7 @@ async def test_update_rollout_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_rollout), "__call__") as call: @@ -2810,11 +2835,6 @@ async def test_update_rollout_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_update_rollout_async_from_dict(): - await test_update_rollout_async(request_type=dict) - - def test_update_rollout_field_headers(): client = SaasRolloutsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2971,8 +2991,8 @@ async def test_update_rollout_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - rollouts_service.DeleteRolloutRequest, - dict, + rollouts_service.DeleteRolloutRequest(), + {}, ], ) def test_delete_rollout(request_type, transport: str = "grpc"): @@ -2983,7 +3003,7 @@ def test_delete_rollout(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_rollout), "__call__") as call: @@ -3026,11 +3046,12 @@ def test_delete_rollout_non_empty_request_with_auto_populated_field(): client.delete_rollout(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == rollouts_service.DeleteRolloutRequest( + request_msg = rollouts_service.DeleteRolloutRequest( name="name_value", etag="etag_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_rollout_use_cached_wrapped_rpc(): @@ -3111,9 +3132,14 @@ async def test_delete_rollout_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_rollout_async( - transport: str = "grpc_asyncio", request_type=rollouts_service.DeleteRolloutRequest -): +@pytest.mark.parametrize( + "request_type", + [ + rollouts_service.DeleteRolloutRequest(), + {}, + ], +) +async def test_delete_rollout_async(request_type, transport: str = "grpc_asyncio"): client = SaasRolloutsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3121,7 +3147,7 @@ async def test_delete_rollout_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_rollout), "__call__") as call: @@ -3139,11 +3165,6 @@ async def test_delete_rollout_async( assert response is None -@pytest.mark.asyncio -async def test_delete_rollout_async_from_dict(): - await test_delete_rollout_async(request_type=dict) - - def test_delete_rollout_field_headers(): client = SaasRolloutsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3286,8 +3307,8 @@ async def test_delete_rollout_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - rollouts_service.ListRolloutKindsRequest, - dict, + rollouts_service.ListRolloutKindsRequest(), + {}, ], ) def test_list_rollout_kinds(request_type, transport: str = "grpc"): @@ -3298,7 +3319,7 @@ def test_list_rollout_kinds(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,12 +3372,13 @@ def test_list_rollout_kinds_non_empty_request_with_auto_populated_field(): client.list_rollout_kinds(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == rollouts_service.ListRolloutKindsRequest( + request_msg = rollouts_service.ListRolloutKindsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_rollout_kinds_use_cached_wrapped_rpc(): @@ -3441,10 +3463,14 @@ async def test_list_rollout_kinds_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_rollout_kinds_async( - transport: str = "grpc_asyncio", - request_type=rollouts_service.ListRolloutKindsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + rollouts_service.ListRolloutKindsRequest(), + {}, + ], +) +async def test_list_rollout_kinds_async(request_type, transport: str = "grpc_asyncio"): client = SaasRolloutsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3452,7 +3478,7 @@ async def test_list_rollout_kinds_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( @@ -3479,11 +3505,6 @@ async def test_list_rollout_kinds_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_rollout_kinds_async_from_dict(): - await test_list_rollout_kinds_async(request_type=dict) - - def test_list_rollout_kinds_field_headers(): client = SaasRolloutsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3836,8 +3857,8 @@ async def test_list_rollout_kinds_async_pages(): @pytest.mark.parametrize( "request_type", [ - rollouts_service.GetRolloutKindRequest, - dict, + rollouts_service.GetRolloutKindRequest(), + {}, ], ) def test_get_rollout_kind(request_type, transport: str = "grpc"): @@ -3848,7 +3869,7 @@ def test_get_rollout_kind(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_rollout_kind), "__call__") as call: @@ -3910,9 +3931,10 @@ def test_get_rollout_kind_non_empty_request_with_auto_populated_field(): client.get_rollout_kind(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == rollouts_service.GetRolloutKindRequest( + request_msg = rollouts_service.GetRolloutKindRequest( name="name_value", ) + assert args[0] == request_msg def test_get_rollout_kind_use_cached_wrapped_rpc(): @@ -3995,9 +4017,14 @@ async def test_get_rollout_kind_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_rollout_kind_async( - transport: str = "grpc_asyncio", request_type=rollouts_service.GetRolloutKindRequest -): +@pytest.mark.parametrize( + "request_type", + [ + rollouts_service.GetRolloutKindRequest(), + {}, + ], +) +async def test_get_rollout_kind_async(request_type, transport: str = "grpc_asyncio"): client = SaasRolloutsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4005,7 +4032,7 @@ async def test_get_rollout_kind_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_rollout_kind), "__call__") as call: @@ -4046,11 +4073,6 @@ async def test_get_rollout_kind_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_rollout_kind_async_from_dict(): - await test_get_rollout_kind_async(request_type=dict) - - def test_get_rollout_kind_field_headers(): client = SaasRolloutsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4197,8 +4219,8 @@ async def test_get_rollout_kind_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - rollouts_service.CreateRolloutKindRequest, - dict, + rollouts_service.CreateRolloutKindRequest(), + {}, ], ) def test_create_rollout_kind(request_type, transport: str = "grpc"): @@ -4209,7 +4231,7 @@ def test_create_rollout_kind(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4277,11 +4299,12 @@ def test_create_rollout_kind_non_empty_request_with_auto_populated_field(): client.create_rollout_kind(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == rollouts_service.CreateRolloutKindRequest( + request_msg = rollouts_service.CreateRolloutKindRequest( parent="parent_value", rollout_kind_id="rollout_kind_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_rollout_kind_use_cached_wrapped_rpc(): @@ -4366,10 +4389,14 @@ async def test_create_rollout_kind_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_rollout_kind_async( - transport: str = "grpc_asyncio", - request_type=rollouts_service.CreateRolloutKindRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + rollouts_service.CreateRolloutKindRequest(), + {}, + ], +) +async def test_create_rollout_kind_async(request_type, transport: str = "grpc_asyncio"): client = SaasRolloutsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4377,7 +4404,7 @@ async def test_create_rollout_kind_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( @@ -4420,11 +4447,6 @@ async def test_create_rollout_kind_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_create_rollout_kind_async_from_dict(): - await test_create_rollout_kind_async(request_type=dict) - - def test_create_rollout_kind_field_headers(): client = SaasRolloutsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4599,8 +4621,8 @@ async def test_create_rollout_kind_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - rollouts_service.UpdateRolloutKindRequest, - dict, + rollouts_service.UpdateRolloutKindRequest(), + {}, ], ) def test_update_rollout_kind(request_type, transport: str = "grpc"): @@ -4611,7 +4633,7 @@ def test_update_rollout_kind(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4677,9 +4699,10 @@ def test_update_rollout_kind_non_empty_request_with_auto_populated_field(): client.update_rollout_kind(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == rollouts_service.UpdateRolloutKindRequest( + request_msg = rollouts_service.UpdateRolloutKindRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_rollout_kind_use_cached_wrapped_rpc(): @@ -4764,10 +4787,14 @@ async def test_update_rollout_kind_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_rollout_kind_async( - transport: str = "grpc_asyncio", - request_type=rollouts_service.UpdateRolloutKindRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + rollouts_service.UpdateRolloutKindRequest(), + {}, + ], +) +async def test_update_rollout_kind_async(request_type, transport: str = "grpc_asyncio"): client = SaasRolloutsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4775,7 +4802,7 @@ async def test_update_rollout_kind_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( @@ -4818,11 +4845,6 @@ async def test_update_rollout_kind_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_update_rollout_kind_async_from_dict(): - await test_update_rollout_kind_async(request_type=dict) - - def test_update_rollout_kind_field_headers(): client = SaasRolloutsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4987,8 +5009,8 @@ async def test_update_rollout_kind_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - rollouts_service.DeleteRolloutKindRequest, - dict, + rollouts_service.DeleteRolloutKindRequest(), + {}, ], ) def test_delete_rollout_kind(request_type, transport: str = "grpc"): @@ -4999,7 +5021,7 @@ def test_delete_rollout_kind(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5046,11 +5068,12 @@ def test_delete_rollout_kind_non_empty_request_with_auto_populated_field(): client.delete_rollout_kind(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == rollouts_service.DeleteRolloutKindRequest( + request_msg = rollouts_service.DeleteRolloutKindRequest( name="name_value", etag="etag_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_rollout_kind_use_cached_wrapped_rpc(): @@ -5135,10 +5158,14 @@ async def test_delete_rollout_kind_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_rollout_kind_async( - transport: str = "grpc_asyncio", - request_type=rollouts_service.DeleteRolloutKindRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + rollouts_service.DeleteRolloutKindRequest(), + {}, + ], +) +async def test_delete_rollout_kind_async(request_type, transport: str = "grpc_asyncio"): client = SaasRolloutsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5146,7 +5173,7 @@ async def test_delete_rollout_kind_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( @@ -5166,11 +5193,6 @@ async def test_delete_rollout_kind_async( assert response is None -@pytest.mark.asyncio -async def test_delete_rollout_kind_async_from_dict(): - await test_delete_rollout_kind_async(request_type=dict) - - def test_delete_rollout_kind_field_headers(): client = SaasRolloutsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7549,7 +7571,6 @@ def test_list_rollouts_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rollouts_service.ListRolloutsRequest() - assert args[0] == request_msg @@ -7570,7 +7591,6 @@ def test_get_rollout_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rollouts_service.GetRolloutRequest() - assert args[0] == request_msg @@ -7591,7 +7611,6 @@ def test_create_rollout_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rollouts_service.CreateRolloutRequest() - assert args[0] == request_msg @@ -7612,7 +7631,6 @@ def test_update_rollout_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rollouts_service.UpdateRolloutRequest() - assert args[0] == request_msg @@ -7633,7 +7651,6 @@ def test_delete_rollout_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rollouts_service.DeleteRolloutRequest() - assert args[0] == request_msg @@ -7656,7 +7673,6 @@ def test_list_rollout_kinds_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rollouts_service.ListRolloutKindsRequest() - assert args[0] == request_msg @@ -7677,7 +7693,6 @@ def test_get_rollout_kind_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rollouts_service.GetRolloutKindRequest() - assert args[0] == request_msg @@ -7700,7 +7715,6 @@ def test_create_rollout_kind_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rollouts_service.CreateRolloutKindRequest() - assert args[0] == request_msg @@ -7723,7 +7737,6 @@ def test_update_rollout_kind_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rollouts_service.UpdateRolloutKindRequest() - assert args[0] == request_msg @@ -7746,7 +7759,6 @@ def test_delete_rollout_kind_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rollouts_service.DeleteRolloutKindRequest() - assert args[0] == request_msg @@ -7788,7 +7800,6 @@ async def test_list_rollouts_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rollouts_service.ListRolloutsRequest() - assert args[0] == request_msg @@ -7825,7 +7836,6 @@ async def test_get_rollout_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rollouts_service.GetRolloutRequest() - assert args[0] == request_msg @@ -7862,7 +7872,6 @@ async def test_create_rollout_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rollouts_service.CreateRolloutRequest() - assert args[0] == request_msg @@ -7899,7 +7908,6 @@ async def test_update_rollout_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rollouts_service.UpdateRolloutRequest() - assert args[0] == request_msg @@ -7922,7 +7930,6 @@ async def test_delete_rollout_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rollouts_service.DeleteRolloutRequest() - assert args[0] == request_msg @@ -7952,7 +7959,6 @@ async def test_list_rollout_kinds_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rollouts_service.ListRolloutKindsRequest() - assert args[0] == request_msg @@ -7985,7 +7991,6 @@ async def test_get_rollout_kind_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rollouts_service.GetRolloutKindRequest() - assert args[0] == request_msg @@ -8020,7 +8025,6 @@ async def test_create_rollout_kind_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rollouts_service.CreateRolloutKindRequest() - assert args[0] == request_msg @@ -8055,7 +8059,6 @@ async def test_update_rollout_kind_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rollouts_service.UpdateRolloutKindRequest() - assert args[0] == request_msg @@ -8080,7 +8083,6 @@ async def test_delete_rollout_kind_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rollouts_service.DeleteRolloutKindRequest() - assert args[0] == request_msg @@ -9999,7 +10001,6 @@ def test_list_rollouts_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rollouts_service.ListRolloutsRequest() - assert args[0] == request_msg @@ -10019,7 +10020,6 @@ def test_get_rollout_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rollouts_service.GetRolloutRequest() - assert args[0] == request_msg @@ -10039,7 +10039,6 @@ def test_create_rollout_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rollouts_service.CreateRolloutRequest() - assert args[0] == request_msg @@ -10059,7 +10058,6 @@ def test_update_rollout_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rollouts_service.UpdateRolloutRequest() - assert args[0] == request_msg @@ -10079,7 +10077,6 @@ def test_delete_rollout_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rollouts_service.DeleteRolloutRequest() - assert args[0] == request_msg @@ -10101,7 +10098,6 @@ def test_list_rollout_kinds_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rollouts_service.ListRolloutKindsRequest() - assert args[0] == request_msg @@ -10121,7 +10117,6 @@ def test_get_rollout_kind_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rollouts_service.GetRolloutKindRequest() - assert args[0] == request_msg @@ -10143,7 +10138,6 @@ def test_create_rollout_kind_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rollouts_service.CreateRolloutKindRequest() - assert args[0] == request_msg @@ -10165,7 +10159,6 @@ def test_update_rollout_kind_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rollouts_service.UpdateRolloutKindRequest() - assert args[0] == request_msg @@ -10187,7 +10180,6 @@ def test_delete_rollout_kind_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = rollouts_service.DeleteRolloutKindRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-scheduler/noxfile.py b/packages/google-cloud-scheduler/noxfile.py index 7284bac683be..55917f9775bc 100644 --- a/packages/google-cloud-scheduler/noxfile.py +++ b/packages/google-cloud-scheduler/noxfile.py @@ -47,7 +47,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-scheduler" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-scheduler/setup.py b/packages/google-cloud-scheduler/setup.py index 4abcb52013cd..7209982c00b6 100644 --- a/packages/google-cloud-scheduler/setup.py +++ b/packages/google-cloud-scheduler/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/google-cloud-scheduler/testing/constraints-3.10.txt b/packages/google-cloud-scheduler/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-scheduler/testing/constraints-3.10.txt +++ b/packages/google-cloud-scheduler/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-scheduler/tests/unit/gapic/scheduler_v1/test_cloud_scheduler.py b/packages/google-cloud-scheduler/tests/unit/gapic/scheduler_v1/test_cloud_scheduler.py index fddb0bf4ac27..ef070581c6da 100644 --- a/packages/google-cloud-scheduler/tests/unit/gapic/scheduler_v1/test_cloud_scheduler.py +++ b/packages/google-cloud-scheduler/tests/unit/gapic/scheduler_v1/test_cloud_scheduler.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 @@ -115,6 +116,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" @@ -1318,8 +1334,8 @@ def test_cloud_scheduler_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - cloudscheduler.ListJobsRequest, - dict, + cloudscheduler.ListJobsRequest(), + {}, ], ) def test_list_jobs(request_type, transport: str = "grpc"): @@ -1330,7 +1346,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(type(client.transport.list_jobs), "__call__") as call: @@ -1375,10 +1391,11 @@ 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] == cloudscheduler.ListJobsRequest( + request_msg = cloudscheduler.ListJobsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_jobs_use_cached_wrapped_rpc(): @@ -1457,9 +1474,14 @@ async def test_list_jobs_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_list_jobs_async( - transport: str = "grpc_asyncio", request_type=cloudscheduler.ListJobsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudscheduler.ListJobsRequest(), + {}, + ], +) +async def test_list_jobs_async(request_type, transport: str = "grpc_asyncio"): client = CloudSchedulerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1467,7 +1489,7 @@ async def test_list_jobs_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_jobs), "__call__") as call: @@ -1490,11 +1512,6 @@ async def test_list_jobs_async( assert response.next_page_token == "next_page_token_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 = CloudSchedulerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1831,8 +1848,8 @@ async def test_list_jobs_async_pages(): @pytest.mark.parametrize( "request_type", [ - cloudscheduler.GetJobRequest, - dict, + cloudscheduler.GetJobRequest(), + {}, ], ) def test_get_job(request_type, transport: str = "grpc"): @@ -1843,7 +1860,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(type(client.transport.get_job), "__call__") as call: @@ -1895,9 +1912,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] == cloudscheduler.GetJobRequest( + request_msg = cloudscheduler.GetJobRequest( name="name_value", ) + assert args[0] == request_msg def test_get_job_use_cached_wrapped_rpc(): @@ -1976,9 +1994,14 @@ async def test_get_job_async_use_cached_wrapped_rpc(transport: str = "grpc_async @pytest.mark.asyncio -async def test_get_job_async( - transport: str = "grpc_asyncio", request_type=cloudscheduler.GetJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudscheduler.GetJobRequest(), + {}, + ], +) +async def test_get_job_async(request_type, transport: str = "grpc_asyncio"): client = CloudSchedulerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1986,7 +2009,7 @@ async def test_get_job_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_job), "__call__") as call: @@ -2017,11 +2040,6 @@ async def test_get_job_async( assert response.state == job.Job.State.ENABLED -@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 = CloudSchedulerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2164,8 +2182,8 @@ async def test_get_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloudscheduler.CreateJobRequest, - dict, + cloudscheduler.CreateJobRequest(), + {}, ], ) def test_create_job(request_type, transport: str = "grpc"): @@ -2176,7 +2194,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() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_job), "__call__") as call: @@ -2228,9 +2246,10 @@ def test_create_job_non_empty_request_with_auto_populated_field(): client.create_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudscheduler.CreateJobRequest( + request_msg = cloudscheduler.CreateJobRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_job_use_cached_wrapped_rpc(): @@ -2309,9 +2328,14 @@ async def test_create_job_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_create_job_async( - transport: str = "grpc_asyncio", request_type=cloudscheduler.CreateJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudscheduler.CreateJobRequest(), + {}, + ], +) +async def test_create_job_async(request_type, transport: str = "grpc_asyncio"): client = CloudSchedulerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2319,7 +2343,7 @@ async def test_create_job_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_job), "__call__") as call: @@ -2350,11 +2374,6 @@ async def test_create_job_async( assert response.state == gcs_job.Job.State.ENABLED -@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 = CloudSchedulerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2507,8 +2526,8 @@ async def test_create_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloudscheduler.UpdateJobRequest, - dict, + cloudscheduler.UpdateJobRequest(), + {}, ], ) def test_update_job(request_type, transport: str = "grpc"): @@ -2519,7 +2538,7 @@ def test_update_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(type(client.transport.update_job), "__call__") as call: @@ -2569,7 +2588,8 @@ def test_update_job_non_empty_request_with_auto_populated_field(): client.update_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudscheduler.UpdateJobRequest() + request_msg = cloudscheduler.UpdateJobRequest() + assert args[0] == request_msg def test_update_job_use_cached_wrapped_rpc(): @@ -2648,9 +2668,14 @@ async def test_update_job_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_update_job_async( - transport: str = "grpc_asyncio", request_type=cloudscheduler.UpdateJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudscheduler.UpdateJobRequest(), + {}, + ], +) +async def test_update_job_async(request_type, transport: str = "grpc_asyncio"): client = CloudSchedulerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2658,7 +2683,7 @@ async def test_update_job_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_job), "__call__") as call: @@ -2689,11 +2714,6 @@ async def test_update_job_async( assert response.state == gcs_job.Job.State.ENABLED -@pytest.mark.asyncio -async def test_update_job_async_from_dict(): - await test_update_job_async(request_type=dict) - - def test_update_job_field_headers(): client = CloudSchedulerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2846,8 +2866,8 @@ async def test_update_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloudscheduler.DeleteJobRequest, - dict, + cloudscheduler.DeleteJobRequest(), + {}, ], ) def test_delete_job(request_type, transport: str = "grpc"): @@ -2858,7 +2878,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() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_job), "__call__") as call: @@ -2899,9 +2919,10 @@ def test_delete_job_non_empty_request_with_auto_populated_field(): client.delete_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudscheduler.DeleteJobRequest( + request_msg = cloudscheduler.DeleteJobRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_job_use_cached_wrapped_rpc(): @@ -2980,9 +3001,14 @@ async def test_delete_job_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_delete_job_async( - transport: str = "grpc_asyncio", request_type=cloudscheduler.DeleteJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudscheduler.DeleteJobRequest(), + {}, + ], +) +async def test_delete_job_async(request_type, transport: str = "grpc_asyncio"): client = CloudSchedulerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2990,7 +3016,7 @@ async def test_delete_job_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_job), "__call__") as call: @@ -3008,11 +3034,6 @@ async def test_delete_job_async( 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 = CloudSchedulerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3155,8 +3176,8 @@ async def test_delete_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloudscheduler.PauseJobRequest, - dict, + cloudscheduler.PauseJobRequest(), + {}, ], ) def test_pause_job(request_type, transport: str = "grpc"): @@ -3167,7 +3188,7 @@ def test_pause_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(type(client.transport.pause_job), "__call__") as call: @@ -3219,9 +3240,10 @@ def test_pause_job_non_empty_request_with_auto_populated_field(): client.pause_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudscheduler.PauseJobRequest( + request_msg = cloudscheduler.PauseJobRequest( name="name_value", ) + assert args[0] == request_msg def test_pause_job_use_cached_wrapped_rpc(): @@ -3300,9 +3322,14 @@ async def test_pause_job_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_pause_job_async( - transport: str = "grpc_asyncio", request_type=cloudscheduler.PauseJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudscheduler.PauseJobRequest(), + {}, + ], +) +async def test_pause_job_async(request_type, transport: str = "grpc_asyncio"): client = CloudSchedulerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3310,7 +3337,7 @@ async def test_pause_job_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.pause_job), "__call__") as call: @@ -3341,11 +3368,6 @@ async def test_pause_job_async( assert response.state == job.Job.State.ENABLED -@pytest.mark.asyncio -async def test_pause_job_async_from_dict(): - await test_pause_job_async(request_type=dict) - - def test_pause_job_field_headers(): client = CloudSchedulerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3488,8 +3510,8 @@ async def test_pause_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloudscheduler.ResumeJobRequest, - dict, + cloudscheduler.ResumeJobRequest(), + {}, ], ) def test_resume_job(request_type, transport: str = "grpc"): @@ -3500,7 +3522,7 @@ def test_resume_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(type(client.transport.resume_job), "__call__") as call: @@ -3552,9 +3574,10 @@ def test_resume_job_non_empty_request_with_auto_populated_field(): client.resume_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudscheduler.ResumeJobRequest( + request_msg = cloudscheduler.ResumeJobRequest( name="name_value", ) + assert args[0] == request_msg def test_resume_job_use_cached_wrapped_rpc(): @@ -3633,9 +3656,14 @@ async def test_resume_job_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_resume_job_async( - transport: str = "grpc_asyncio", request_type=cloudscheduler.ResumeJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudscheduler.ResumeJobRequest(), + {}, + ], +) +async def test_resume_job_async(request_type, transport: str = "grpc_asyncio"): client = CloudSchedulerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3643,7 +3671,7 @@ async def test_resume_job_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.resume_job), "__call__") as call: @@ -3674,11 +3702,6 @@ async def test_resume_job_async( assert response.state == job.Job.State.ENABLED -@pytest.mark.asyncio -async def test_resume_job_async_from_dict(): - await test_resume_job_async(request_type=dict) - - def test_resume_job_field_headers(): client = CloudSchedulerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3821,8 +3844,8 @@ async def test_resume_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloudscheduler.RunJobRequest, - dict, + cloudscheduler.RunJobRequest(), + {}, ], ) def test_run_job(request_type, transport: str = "grpc"): @@ -3833,7 +3856,7 @@ def test_run_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(type(client.transport.run_job), "__call__") as call: @@ -3885,9 +3908,10 @@ def test_run_job_non_empty_request_with_auto_populated_field(): client.run_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudscheduler.RunJobRequest( + request_msg = cloudscheduler.RunJobRequest( name="name_value", ) + assert args[0] == request_msg def test_run_job_use_cached_wrapped_rpc(): @@ -3966,9 +3990,14 @@ async def test_run_job_async_use_cached_wrapped_rpc(transport: str = "grpc_async @pytest.mark.asyncio -async def test_run_job_async( - transport: str = "grpc_asyncio", request_type=cloudscheduler.RunJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudscheduler.RunJobRequest(), + {}, + ], +) +async def test_run_job_async(request_type, transport: str = "grpc_asyncio"): client = CloudSchedulerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3976,7 +4005,7 @@ async def test_run_job_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.run_job), "__call__") as call: @@ -4007,11 +4036,6 @@ async def test_run_job_async( assert response.state == job.Job.State.ENABLED -@pytest.mark.asyncio -async def test_run_job_async_from_dict(): - await test_run_job_async(request_type=dict) - - def test_run_job_field_headers(): client = CloudSchedulerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5762,7 +5786,6 @@ def test_list_jobs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudscheduler.ListJobsRequest() - assert args[0] == request_msg @@ -5783,7 +5806,6 @@ def test_get_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudscheduler.GetJobRequest() - assert args[0] == request_msg @@ -5804,7 +5826,6 @@ def test_create_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudscheduler.CreateJobRequest() - assert args[0] == request_msg @@ -5825,7 +5846,6 @@ def test_update_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudscheduler.UpdateJobRequest() - assert args[0] == request_msg @@ -5846,7 +5866,6 @@ def test_delete_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudscheduler.DeleteJobRequest() - assert args[0] == request_msg @@ -5867,7 +5886,6 @@ def test_pause_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudscheduler.PauseJobRequest() - assert args[0] == request_msg @@ -5888,7 +5906,6 @@ def test_resume_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudscheduler.ResumeJobRequest() - assert args[0] == request_msg @@ -5909,7 +5926,6 @@ def test_run_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudscheduler.RunJobRequest() - assert args[0] == request_msg @@ -5950,7 +5966,6 @@ async def test_list_jobs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudscheduler.ListJobsRequest() - assert args[0] == request_msg @@ -5981,7 +5996,6 @@ async def test_get_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudscheduler.GetJobRequest() - assert args[0] == request_msg @@ -6012,7 +6026,6 @@ async def test_create_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudscheduler.CreateJobRequest() - assert args[0] == request_msg @@ -6043,7 +6056,6 @@ async def test_update_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudscheduler.UpdateJobRequest() - assert args[0] == request_msg @@ -6066,7 +6078,6 @@ async def test_delete_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudscheduler.DeleteJobRequest() - assert args[0] == request_msg @@ -6097,7 +6108,6 @@ async def test_pause_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudscheduler.PauseJobRequest() - assert args[0] == request_msg @@ -6128,7 +6138,6 @@ async def test_resume_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudscheduler.ResumeJobRequest() - assert args[0] == request_msg @@ -6159,7 +6168,6 @@ async def test_run_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudscheduler.RunJobRequest() - assert args[0] == request_msg @@ -7613,7 +7621,6 @@ def test_list_jobs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudscheduler.ListJobsRequest() - assert args[0] == request_msg @@ -7633,7 +7640,6 @@ def test_get_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudscheduler.GetJobRequest() - assert args[0] == request_msg @@ -7653,7 +7659,6 @@ def test_create_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudscheduler.CreateJobRequest() - assert args[0] == request_msg @@ -7673,7 +7678,6 @@ def test_update_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudscheduler.UpdateJobRequest() - assert args[0] == request_msg @@ -7693,7 +7697,6 @@ def test_delete_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudscheduler.DeleteJobRequest() - assert args[0] == request_msg @@ -7713,7 +7716,6 @@ def test_pause_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudscheduler.PauseJobRequest() - assert args[0] == request_msg @@ -7733,7 +7735,6 @@ def test_resume_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudscheduler.ResumeJobRequest() - assert args[0] == request_msg @@ -7753,7 +7754,6 @@ def test_run_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudscheduler.RunJobRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-scheduler/tests/unit/gapic/scheduler_v1beta1/test_cloud_scheduler.py b/packages/google-cloud-scheduler/tests/unit/gapic/scheduler_v1beta1/test_cloud_scheduler.py index 3c918f993ca9..18b7fa633510 100644 --- a/packages/google-cloud-scheduler/tests/unit/gapic/scheduler_v1beta1/test_cloud_scheduler.py +++ b/packages/google-cloud-scheduler/tests/unit/gapic/scheduler_v1beta1/test_cloud_scheduler.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 @@ -114,6 +115,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" @@ -1317,8 +1333,8 @@ def test_cloud_scheduler_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - cloudscheduler.ListJobsRequest, - dict, + cloudscheduler.ListJobsRequest(), + {}, ], ) def test_list_jobs(request_type, transport: str = "grpc"): @@ -1329,7 +1345,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(type(client.transport.list_jobs), "__call__") as call: @@ -1375,11 +1391,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] - assert args[0] == cloudscheduler.ListJobsRequest( + request_msg = cloudscheduler.ListJobsRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_jobs_use_cached_wrapped_rpc(): @@ -1458,9 +1475,14 @@ async def test_list_jobs_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_list_jobs_async( - transport: str = "grpc_asyncio", request_type=cloudscheduler.ListJobsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudscheduler.ListJobsRequest(), + {}, + ], +) +async def test_list_jobs_async(request_type, transport: str = "grpc_asyncio"): client = CloudSchedulerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1468,7 +1490,7 @@ async def test_list_jobs_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_jobs), "__call__") as call: @@ -1491,11 +1513,6 @@ async def test_list_jobs_async( assert response.next_page_token == "next_page_token_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 = CloudSchedulerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1832,8 +1849,8 @@ async def test_list_jobs_async_pages(): @pytest.mark.parametrize( "request_type", [ - cloudscheduler.GetJobRequest, - dict, + cloudscheduler.GetJobRequest(), + {}, ], ) def test_get_job(request_type, transport: str = "grpc"): @@ -1844,7 +1861,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(type(client.transport.get_job), "__call__") as call: @@ -1898,9 +1915,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] == cloudscheduler.GetJobRequest( + request_msg = cloudscheduler.GetJobRequest( name="name_value", ) + assert args[0] == request_msg def test_get_job_use_cached_wrapped_rpc(): @@ -1979,9 +1997,14 @@ async def test_get_job_async_use_cached_wrapped_rpc(transport: str = "grpc_async @pytest.mark.asyncio -async def test_get_job_async( - transport: str = "grpc_asyncio", request_type=cloudscheduler.GetJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudscheduler.GetJobRequest(), + {}, + ], +) +async def test_get_job_async(request_type, transport: str = "grpc_asyncio"): client = CloudSchedulerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1989,7 +2012,7 @@ async def test_get_job_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_job), "__call__") as call: @@ -2022,11 +2045,6 @@ async def test_get_job_async( assert response.legacy_app_engine_cron 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 = CloudSchedulerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2169,8 +2187,8 @@ async def test_get_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloudscheduler.CreateJobRequest, - dict, + cloudscheduler.CreateJobRequest(), + {}, ], ) def test_create_job(request_type, transport: str = "grpc"): @@ -2181,7 +2199,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() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_job), "__call__") as call: @@ -2235,9 +2253,10 @@ def test_create_job_non_empty_request_with_auto_populated_field(): client.create_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudscheduler.CreateJobRequest( + request_msg = cloudscheduler.CreateJobRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_job_use_cached_wrapped_rpc(): @@ -2316,9 +2335,14 @@ async def test_create_job_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_create_job_async( - transport: str = "grpc_asyncio", request_type=cloudscheduler.CreateJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudscheduler.CreateJobRequest(), + {}, + ], +) +async def test_create_job_async(request_type, transport: str = "grpc_asyncio"): client = CloudSchedulerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2326,7 +2350,7 @@ async def test_create_job_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_job), "__call__") as call: @@ -2359,11 +2383,6 @@ async def test_create_job_async( assert response.legacy_app_engine_cron is True -@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 = CloudSchedulerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2516,8 +2535,8 @@ async def test_create_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloudscheduler.UpdateJobRequest, - dict, + cloudscheduler.UpdateJobRequest(), + {}, ], ) def test_update_job(request_type, transport: str = "grpc"): @@ -2528,7 +2547,7 @@ def test_update_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(type(client.transport.update_job), "__call__") as call: @@ -2580,7 +2599,8 @@ def test_update_job_non_empty_request_with_auto_populated_field(): client.update_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudscheduler.UpdateJobRequest() + request_msg = cloudscheduler.UpdateJobRequest() + assert args[0] == request_msg def test_update_job_use_cached_wrapped_rpc(): @@ -2659,9 +2679,14 @@ async def test_update_job_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_update_job_async( - transport: str = "grpc_asyncio", request_type=cloudscheduler.UpdateJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudscheduler.UpdateJobRequest(), + {}, + ], +) +async def test_update_job_async(request_type, transport: str = "grpc_asyncio"): client = CloudSchedulerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2669,7 +2694,7 @@ async def test_update_job_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_job), "__call__") as call: @@ -2702,11 +2727,6 @@ async def test_update_job_async( assert response.legacy_app_engine_cron is True -@pytest.mark.asyncio -async def test_update_job_async_from_dict(): - await test_update_job_async(request_type=dict) - - def test_update_job_field_headers(): client = CloudSchedulerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2859,8 +2879,8 @@ async def test_update_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloudscheduler.DeleteJobRequest, - dict, + cloudscheduler.DeleteJobRequest(), + {}, ], ) def test_delete_job(request_type, transport: str = "grpc"): @@ -2871,7 +2891,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() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_job), "__call__") as call: @@ -2912,9 +2932,10 @@ def test_delete_job_non_empty_request_with_auto_populated_field(): client.delete_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudscheduler.DeleteJobRequest( + request_msg = cloudscheduler.DeleteJobRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_job_use_cached_wrapped_rpc(): @@ -2993,9 +3014,14 @@ async def test_delete_job_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_delete_job_async( - transport: str = "grpc_asyncio", request_type=cloudscheduler.DeleteJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudscheduler.DeleteJobRequest(), + {}, + ], +) +async def test_delete_job_async(request_type, transport: str = "grpc_asyncio"): client = CloudSchedulerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3003,7 +3029,7 @@ async def test_delete_job_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_job), "__call__") as call: @@ -3021,11 +3047,6 @@ async def test_delete_job_async( 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 = CloudSchedulerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3168,8 +3189,8 @@ async def test_delete_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloudscheduler.PauseJobRequest, - dict, + cloudscheduler.PauseJobRequest(), + {}, ], ) def test_pause_job(request_type, transport: str = "grpc"): @@ -3180,7 +3201,7 @@ def test_pause_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(type(client.transport.pause_job), "__call__") as call: @@ -3234,9 +3255,10 @@ def test_pause_job_non_empty_request_with_auto_populated_field(): client.pause_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudscheduler.PauseJobRequest( + request_msg = cloudscheduler.PauseJobRequest( name="name_value", ) + assert args[0] == request_msg def test_pause_job_use_cached_wrapped_rpc(): @@ -3315,9 +3337,14 @@ async def test_pause_job_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_pause_job_async( - transport: str = "grpc_asyncio", request_type=cloudscheduler.PauseJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudscheduler.PauseJobRequest(), + {}, + ], +) +async def test_pause_job_async(request_type, transport: str = "grpc_asyncio"): client = CloudSchedulerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3325,7 +3352,7 @@ async def test_pause_job_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.pause_job), "__call__") as call: @@ -3358,11 +3385,6 @@ async def test_pause_job_async( assert response.legacy_app_engine_cron is True -@pytest.mark.asyncio -async def test_pause_job_async_from_dict(): - await test_pause_job_async(request_type=dict) - - def test_pause_job_field_headers(): client = CloudSchedulerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3505,8 +3527,8 @@ async def test_pause_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloudscheduler.ResumeJobRequest, - dict, + cloudscheduler.ResumeJobRequest(), + {}, ], ) def test_resume_job(request_type, transport: str = "grpc"): @@ -3517,7 +3539,7 @@ def test_resume_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(type(client.transport.resume_job), "__call__") as call: @@ -3571,9 +3593,10 @@ def test_resume_job_non_empty_request_with_auto_populated_field(): client.resume_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudscheduler.ResumeJobRequest( + request_msg = cloudscheduler.ResumeJobRequest( name="name_value", ) + assert args[0] == request_msg def test_resume_job_use_cached_wrapped_rpc(): @@ -3652,9 +3675,14 @@ async def test_resume_job_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_resume_job_async( - transport: str = "grpc_asyncio", request_type=cloudscheduler.ResumeJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudscheduler.ResumeJobRequest(), + {}, + ], +) +async def test_resume_job_async(request_type, transport: str = "grpc_asyncio"): client = CloudSchedulerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3662,7 +3690,7 @@ async def test_resume_job_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.resume_job), "__call__") as call: @@ -3695,11 +3723,6 @@ async def test_resume_job_async( assert response.legacy_app_engine_cron is True -@pytest.mark.asyncio -async def test_resume_job_async_from_dict(): - await test_resume_job_async(request_type=dict) - - def test_resume_job_field_headers(): client = CloudSchedulerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3842,8 +3865,8 @@ async def test_resume_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloudscheduler.RunJobRequest, - dict, + cloudscheduler.RunJobRequest(), + {}, ], ) def test_run_job(request_type, transport: str = "grpc"): @@ -3854,7 +3877,7 @@ def test_run_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(type(client.transport.run_job), "__call__") as call: @@ -3908,9 +3931,10 @@ def test_run_job_non_empty_request_with_auto_populated_field(): client.run_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudscheduler.RunJobRequest( + request_msg = cloudscheduler.RunJobRequest( name="name_value", ) + assert args[0] == request_msg def test_run_job_use_cached_wrapped_rpc(): @@ -3989,9 +4013,14 @@ async def test_run_job_async_use_cached_wrapped_rpc(transport: str = "grpc_async @pytest.mark.asyncio -async def test_run_job_async( - transport: str = "grpc_asyncio", request_type=cloudscheduler.RunJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudscheduler.RunJobRequest(), + {}, + ], +) +async def test_run_job_async(request_type, transport: str = "grpc_asyncio"): client = CloudSchedulerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3999,7 +4028,7 @@ async def test_run_job_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.run_job), "__call__") as call: @@ -4032,11 +4061,6 @@ async def test_run_job_async( assert response.legacy_app_engine_cron is True -@pytest.mark.asyncio -async def test_run_job_async_from_dict(): - await test_run_job_async(request_type=dict) - - def test_run_job_field_headers(): client = CloudSchedulerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5796,7 +5820,6 @@ def test_list_jobs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudscheduler.ListJobsRequest() - assert args[0] == request_msg @@ -5817,7 +5840,6 @@ def test_get_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudscheduler.GetJobRequest() - assert args[0] == request_msg @@ -5838,7 +5860,6 @@ def test_create_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudscheduler.CreateJobRequest() - assert args[0] == request_msg @@ -5859,7 +5880,6 @@ def test_update_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudscheduler.UpdateJobRequest() - assert args[0] == request_msg @@ -5880,7 +5900,6 @@ def test_delete_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudscheduler.DeleteJobRequest() - assert args[0] == request_msg @@ -5901,7 +5920,6 @@ def test_pause_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudscheduler.PauseJobRequest() - assert args[0] == request_msg @@ -5922,7 +5940,6 @@ def test_resume_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudscheduler.ResumeJobRequest() - assert args[0] == request_msg @@ -5943,7 +5960,6 @@ def test_run_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudscheduler.RunJobRequest() - assert args[0] == request_msg @@ -5984,7 +6000,6 @@ async def test_list_jobs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudscheduler.ListJobsRequest() - assert args[0] == request_msg @@ -6016,7 +6031,6 @@ async def test_get_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudscheduler.GetJobRequest() - assert args[0] == request_msg @@ -6048,7 +6062,6 @@ async def test_create_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudscheduler.CreateJobRequest() - assert args[0] == request_msg @@ -6080,7 +6093,6 @@ async def test_update_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudscheduler.UpdateJobRequest() - assert args[0] == request_msg @@ -6103,7 +6115,6 @@ async def test_delete_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudscheduler.DeleteJobRequest() - assert args[0] == request_msg @@ -6135,7 +6146,6 @@ async def test_pause_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudscheduler.PauseJobRequest() - assert args[0] == request_msg @@ -6167,7 +6177,6 @@ async def test_resume_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudscheduler.ResumeJobRequest() - assert args[0] == request_msg @@ -6199,7 +6208,6 @@ async def test_run_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudscheduler.RunJobRequest() - assert args[0] == request_msg @@ -7667,7 +7675,6 @@ def test_list_jobs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudscheduler.ListJobsRequest() - assert args[0] == request_msg @@ -7687,7 +7694,6 @@ def test_get_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudscheduler.GetJobRequest() - assert args[0] == request_msg @@ -7707,7 +7713,6 @@ def test_create_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudscheduler.CreateJobRequest() - assert args[0] == request_msg @@ -7727,7 +7732,6 @@ def test_update_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudscheduler.UpdateJobRequest() - assert args[0] == request_msg @@ -7747,7 +7751,6 @@ def test_delete_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudscheduler.DeleteJobRequest() - assert args[0] == request_msg @@ -7767,7 +7770,6 @@ def test_pause_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudscheduler.PauseJobRequest() - assert args[0] == request_msg @@ -7787,7 +7789,6 @@ def test_resume_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudscheduler.ResumeJobRequest() - assert args[0] == request_msg @@ -7807,7 +7808,6 @@ def test_run_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudscheduler.RunJobRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-secret-manager/noxfile.py b/packages/google-cloud-secret-manager/noxfile.py index bea19a4c6e52..3efeca5e9834 100644 --- a/packages/google-cloud-secret-manager/noxfile.py +++ b/packages/google-cloud-secret-manager/noxfile.py @@ -47,7 +47,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-secret-manager" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-secret-manager/setup.py b/packages/google-cloud-secret-manager/setup.py index d56bd9a24ff4..fe1c04e8b58d 100644 --- a/packages/google-cloud-secret-manager/setup.py +++ b/packages/google-cloud-secret-manager/setup.py @@ -45,7 +45,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/google-cloud-secret-manager/testing/constraints-3.10.txt b/packages/google-cloud-secret-manager/testing/constraints-3.10.txt index a92801e1c8e2..b39cd54634f9 100644 --- a/packages/google-cloud-secret-manager/testing/constraints-3.10.txt +++ b/packages/google-cloud-secret-manager/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/google-cloud-secret-manager/tests/unit/gapic/secretmanager_v1/test_secret_manager_service.py b/packages/google-cloud-secret-manager/tests/unit/gapic/secretmanager_v1/test_secret_manager_service.py index ad5e0f8710f4..eeda3aae224e 100644 --- a/packages/google-cloud-secret-manager/tests/unit/gapic/secretmanager_v1/test_secret_manager_service.py +++ b/packages/google-cloud-secret-manager/tests/unit/gapic/secretmanager_v1/test_secret_manager_service.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 @@ -115,6 +116,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" @@ -1378,8 +1394,8 @@ def test_secret_manager_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - service.ListSecretsRequest, - dict, + service.ListSecretsRequest(), + {}, ], ) def test_list_secrets(request_type, transport: str = "grpc"): @@ -1390,7 +1406,7 @@ def test_list_secrets(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_secrets), "__call__") as call: @@ -1438,11 +1454,12 @@ def test_list_secrets_non_empty_request_with_auto_populated_field(): client.list_secrets(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListSecretsRequest( + request_msg = service.ListSecretsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_secrets_use_cached_wrapped_rpc(): @@ -1523,9 +1540,14 @@ async def test_list_secrets_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_secrets_async( - transport: str = "grpc_asyncio", request_type=service.ListSecretsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListSecretsRequest(), + {}, + ], +) +async def test_list_secrets_async(request_type, transport: str = "grpc_asyncio"): client = SecretManagerServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1533,7 +1555,7 @@ async def test_list_secrets_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_secrets), "__call__") as call: @@ -1558,11 +1580,6 @@ async def test_list_secrets_async( assert response.total_size == 1086 -@pytest.mark.asyncio -async def test_list_secrets_async_from_dict(): - await test_list_secrets_async(request_type=dict) - - def test_list_secrets_field_headers(): client = SecretManagerServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1899,8 +1916,8 @@ async def test_list_secrets_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.CreateSecretRequest, - dict, + service.CreateSecretRequest(), + {}, ], ) def test_create_secret(request_type, transport: str = "grpc"): @@ -1911,7 +1928,7 @@ def test_create_secret(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_secret), "__call__") as call: @@ -1958,10 +1975,11 @@ def test_create_secret_non_empty_request_with_auto_populated_field(): client.create_secret(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateSecretRequest( + request_msg = service.CreateSecretRequest( parent="parent_value", secret_id="secret_id_value", ) + assert args[0] == request_msg def test_create_secret_use_cached_wrapped_rpc(): @@ -2042,9 +2060,14 @@ async def test_create_secret_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_secret_async( - transport: str = "grpc_asyncio", request_type=service.CreateSecretRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CreateSecretRequest(), + {}, + ], +) +async def test_create_secret_async(request_type, transport: str = "grpc_asyncio"): client = SecretManagerServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2052,7 +2075,7 @@ async def test_create_secret_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_secret), "__call__") as call: @@ -2077,11 +2100,6 @@ async def test_create_secret_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_create_secret_async_from_dict(): - await test_create_secret_async(request_type=dict) - - def test_create_secret_field_headers(): client = SecretManagerServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2244,8 +2262,8 @@ async def test_create_secret_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.AddSecretVersionRequest, - dict, + service.AddSecretVersionRequest(), + {}, ], ) def test_add_secret_version(request_type, transport: str = "grpc"): @@ -2256,7 +2274,7 @@ def test_add_secret_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2310,9 +2328,10 @@ def test_add_secret_version_non_empty_request_with_auto_populated_field(): client.add_secret_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.AddSecretVersionRequest( + request_msg = service.AddSecretVersionRequest( parent="parent_value", ) + assert args[0] == request_msg def test_add_secret_version_use_cached_wrapped_rpc(): @@ -2397,9 +2416,14 @@ async def test_add_secret_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_add_secret_version_async( - transport: str = "grpc_asyncio", request_type=service.AddSecretVersionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.AddSecretVersionRequest(), + {}, + ], +) +async def test_add_secret_version_async(request_type, transport: str = "grpc_asyncio"): client = SecretManagerServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2407,7 +2431,7 @@ async def test_add_secret_version_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( @@ -2438,11 +2462,6 @@ async def test_add_secret_version_async( assert response.client_specified_payload_checksum is True -@pytest.mark.asyncio -async def test_add_secret_version_async_from_dict(): - await test_add_secret_version_async(request_type=dict) - - def test_add_secret_version_field_headers(): client = SecretManagerServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2607,8 +2626,8 @@ async def test_add_secret_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.GetSecretRequest, - dict, + service.GetSecretRequest(), + {}, ], ) def test_get_secret(request_type, transport: str = "grpc"): @@ -2619,7 +2638,7 @@ def test_get_secret(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_secret), "__call__") as call: @@ -2665,9 +2684,10 @@ def test_get_secret_non_empty_request_with_auto_populated_field(): client.get_secret(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetSecretRequest( + request_msg = service.GetSecretRequest( name="name_value", ) + assert args[0] == request_msg def test_get_secret_use_cached_wrapped_rpc(): @@ -2746,9 +2766,14 @@ async def test_get_secret_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_secret_async( - transport: str = "grpc_asyncio", request_type=service.GetSecretRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetSecretRequest(), + {}, + ], +) +async def test_get_secret_async(request_type, transport: str = "grpc_asyncio"): client = SecretManagerServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2756,7 +2781,7 @@ async def test_get_secret_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_secret), "__call__") as call: @@ -2781,11 +2806,6 @@ async def test_get_secret_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_secret_async_from_dict(): - await test_get_secret_async(request_type=dict) - - def test_get_secret_field_headers(): client = SecretManagerServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2928,8 +2948,8 @@ async def test_get_secret_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdateSecretRequest, - dict, + service.UpdateSecretRequest(), + {}, ], ) def test_update_secret(request_type, transport: str = "grpc"): @@ -2940,7 +2960,7 @@ def test_update_secret(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_secret), "__call__") as call: @@ -2984,7 +3004,8 @@ def test_update_secret_non_empty_request_with_auto_populated_field(): client.update_secret(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateSecretRequest() + request_msg = service.UpdateSecretRequest() + assert args[0] == request_msg def test_update_secret_use_cached_wrapped_rpc(): @@ -3065,9 +3086,14 @@ async def test_update_secret_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_secret_async( - transport: str = "grpc_asyncio", request_type=service.UpdateSecretRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateSecretRequest(), + {}, + ], +) +async def test_update_secret_async(request_type, transport: str = "grpc_asyncio"): client = SecretManagerServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3075,7 +3101,7 @@ async def test_update_secret_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_secret), "__call__") as call: @@ -3100,11 +3126,6 @@ async def test_update_secret_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_update_secret_async_from_dict(): - await test_update_secret_async(request_type=dict) - - def test_update_secret_field_headers(): client = SecretManagerServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3257,8 +3278,8 @@ async def test_update_secret_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DeleteSecretRequest, - dict, + service.DeleteSecretRequest(), + {}, ], ) def test_delete_secret(request_type, transport: str = "grpc"): @@ -3269,7 +3290,7 @@ def test_delete_secret(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_secret), "__call__") as call: @@ -3311,10 +3332,11 @@ def test_delete_secret_non_empty_request_with_auto_populated_field(): client.delete_secret(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteSecretRequest( + request_msg = service.DeleteSecretRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_secret_use_cached_wrapped_rpc(): @@ -3395,9 +3417,14 @@ async def test_delete_secret_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_secret_async( - transport: str = "grpc_asyncio", request_type=service.DeleteSecretRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteSecretRequest(), + {}, + ], +) +async def test_delete_secret_async(request_type, transport: str = "grpc_asyncio"): client = SecretManagerServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3405,7 +3432,7 @@ async def test_delete_secret_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_secret), "__call__") as call: @@ -3423,11 +3450,6 @@ async def test_delete_secret_async( assert response is None -@pytest.mark.asyncio -async def test_delete_secret_async_from_dict(): - await test_delete_secret_async(request_type=dict) - - def test_delete_secret_field_headers(): client = SecretManagerServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3570,8 +3592,8 @@ async def test_delete_secret_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListSecretVersionsRequest, - dict, + service.ListSecretVersionsRequest(), + {}, ], ) def test_list_secret_versions(request_type, transport: str = "grpc"): @@ -3582,7 +3604,7 @@ def test_list_secret_versions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3634,11 +3656,12 @@ def test_list_secret_versions_non_empty_request_with_auto_populated_field(): client.list_secret_versions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListSecretVersionsRequest( + request_msg = service.ListSecretVersionsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_secret_versions_use_cached_wrapped_rpc(): @@ -3723,8 +3746,15 @@ async def test_list_secret_versions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.ListSecretVersionsRequest(), + {}, + ], +) async def test_list_secret_versions_async( - transport: str = "grpc_asyncio", request_type=service.ListSecretVersionsRequest + request_type, transport: str = "grpc_asyncio" ): client = SecretManagerServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3733,7 +3763,7 @@ async def test_list_secret_versions_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( @@ -3760,11 +3790,6 @@ async def test_list_secret_versions_async( assert response.total_size == 1086 -@pytest.mark.asyncio -async def test_list_secret_versions_async_from_dict(): - await test_list_secret_versions_async(request_type=dict) - - def test_list_secret_versions_field_headers(): client = SecretManagerServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4117,8 +4142,8 @@ async def test_list_secret_versions_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetSecretVersionRequest, - dict, + service.GetSecretVersionRequest(), + {}, ], ) def test_get_secret_version(request_type, transport: str = "grpc"): @@ -4129,7 +4154,7 @@ def test_get_secret_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4183,9 +4208,10 @@ def test_get_secret_version_non_empty_request_with_auto_populated_field(): client.get_secret_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetSecretVersionRequest( + request_msg = service.GetSecretVersionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_secret_version_use_cached_wrapped_rpc(): @@ -4270,9 +4296,14 @@ async def test_get_secret_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_secret_version_async( - transport: str = "grpc_asyncio", request_type=service.GetSecretVersionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetSecretVersionRequest(), + {}, + ], +) +async def test_get_secret_version_async(request_type, transport: str = "grpc_asyncio"): client = SecretManagerServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4280,7 +4311,7 @@ async def test_get_secret_version_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( @@ -4311,11 +4342,6 @@ async def test_get_secret_version_async( assert response.client_specified_payload_checksum is True -@pytest.mark.asyncio -async def test_get_secret_version_async_from_dict(): - await test_get_secret_version_async(request_type=dict) - - def test_get_secret_version_field_headers(): client = SecretManagerServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4470,8 +4496,8 @@ async def test_get_secret_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.AccessSecretVersionRequest, - dict, + service.AccessSecretVersionRequest(), + {}, ], ) def test_access_secret_version(request_type, transport: str = "grpc"): @@ -4482,7 +4508,7 @@ def test_access_secret_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4530,9 +4556,10 @@ def test_access_secret_version_non_empty_request_with_auto_populated_field(): client.access_secret_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.AccessSecretVersionRequest( + request_msg = service.AccessSecretVersionRequest( name="name_value", ) + assert args[0] == request_msg def test_access_secret_version_use_cached_wrapped_rpc(): @@ -4618,8 +4645,15 @@ async def test_access_secret_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.AccessSecretVersionRequest(), + {}, + ], +) async def test_access_secret_version_async( - transport: str = "grpc_asyncio", request_type=service.AccessSecretVersionRequest + request_type, transport: str = "grpc_asyncio" ): client = SecretManagerServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4628,7 +4662,7 @@ async def test_access_secret_version_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( @@ -4653,11 +4687,6 @@ async def test_access_secret_version_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_access_secret_version_async_from_dict(): - await test_access_secret_version_async(request_type=dict) - - def test_access_secret_version_field_headers(): client = SecretManagerServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4812,8 +4841,8 @@ async def test_access_secret_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DisableSecretVersionRequest, - dict, + service.DisableSecretVersionRequest(), + {}, ], ) def test_disable_secret_version(request_type, transport: str = "grpc"): @@ -4824,7 +4853,7 @@ def test_disable_secret_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4879,10 +4908,11 @@ def test_disable_secret_version_non_empty_request_with_auto_populated_field(): client.disable_secret_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DisableSecretVersionRequest( + request_msg = service.DisableSecretVersionRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_disable_secret_version_use_cached_wrapped_rpc(): @@ -4968,8 +4998,15 @@ async def test_disable_secret_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.DisableSecretVersionRequest(), + {}, + ], +) async def test_disable_secret_version_async( - transport: str = "grpc_asyncio", request_type=service.DisableSecretVersionRequest + request_type, transport: str = "grpc_asyncio" ): client = SecretManagerServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4978,7 +5015,7 @@ async def test_disable_secret_version_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( @@ -5009,11 +5046,6 @@ async def test_disable_secret_version_async( assert response.client_specified_payload_checksum is True -@pytest.mark.asyncio -async def test_disable_secret_version_async_from_dict(): - await test_disable_secret_version_async(request_type=dict) - - def test_disable_secret_version_field_headers(): client = SecretManagerServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5168,8 +5200,8 @@ async def test_disable_secret_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.EnableSecretVersionRequest, - dict, + service.EnableSecretVersionRequest(), + {}, ], ) def test_enable_secret_version(request_type, transport: str = "grpc"): @@ -5180,7 +5212,7 @@ def test_enable_secret_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5235,10 +5267,11 @@ def test_enable_secret_version_non_empty_request_with_auto_populated_field(): client.enable_secret_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.EnableSecretVersionRequest( + request_msg = service.EnableSecretVersionRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_enable_secret_version_use_cached_wrapped_rpc(): @@ -5324,8 +5357,15 @@ async def test_enable_secret_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.EnableSecretVersionRequest(), + {}, + ], +) async def test_enable_secret_version_async( - transport: str = "grpc_asyncio", request_type=service.EnableSecretVersionRequest + request_type, transport: str = "grpc_asyncio" ): client = SecretManagerServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5334,7 +5374,7 @@ async def test_enable_secret_version_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( @@ -5365,11 +5405,6 @@ async def test_enable_secret_version_async( assert response.client_specified_payload_checksum is True -@pytest.mark.asyncio -async def test_enable_secret_version_async_from_dict(): - await test_enable_secret_version_async(request_type=dict) - - def test_enable_secret_version_field_headers(): client = SecretManagerServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5524,8 +5559,8 @@ async def test_enable_secret_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DestroySecretVersionRequest, - dict, + service.DestroySecretVersionRequest(), + {}, ], ) def test_destroy_secret_version(request_type, transport: str = "grpc"): @@ -5536,7 +5571,7 @@ def test_destroy_secret_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,10 +5626,11 @@ def test_destroy_secret_version_non_empty_request_with_auto_populated_field(): client.destroy_secret_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DestroySecretVersionRequest( + request_msg = service.DestroySecretVersionRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_destroy_secret_version_use_cached_wrapped_rpc(): @@ -5680,8 +5716,15 @@ async def test_destroy_secret_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.DestroySecretVersionRequest(), + {}, + ], +) async def test_destroy_secret_version_async( - transport: str = "grpc_asyncio", request_type=service.DestroySecretVersionRequest + request_type, transport: str = "grpc_asyncio" ): client = SecretManagerServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5690,7 +5733,7 @@ async def test_destroy_secret_version_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( @@ -5721,11 +5764,6 @@ async def test_destroy_secret_version_async( assert response.client_specified_payload_checksum is True -@pytest.mark.asyncio -async def test_destroy_secret_version_async_from_dict(): - await test_destroy_secret_version_async(request_type=dict) - - def test_destroy_secret_version_field_headers(): client = SecretManagerServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5880,8 +5918,8 @@ async def test_destroy_secret_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.SetIamPolicyRequest, - dict, + iam_policy_pb2.SetIamPolicyRequest(), + {}, ], ) def test_set_iam_policy(request_type, transport: str = "grpc"): @@ -5892,7 +5930,7 @@ def test_set_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(type(client.transport.set_iam_policy), "__call__") as call: @@ -5938,9 +5976,10 @@ def test_set_iam_policy_non_empty_request_with_auto_populated_field(): client.set_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.SetIamPolicyRequest( + request_msg = iam_policy_pb2.SetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_set_iam_policy_use_cached_wrapped_rpc(): @@ -6021,9 +6060,14 @@ async def test_set_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.SetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.SetIamPolicyRequest(), + {}, + ], +) +async def test_set_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = SecretManagerServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6031,7 +6075,7 @@ async def test_set_iam_policy_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.set_iam_policy), "__call__") as call: @@ -6056,11 +6100,6 @@ async def test_set_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_set_iam_policy_async_from_dict(): - await test_set_iam_policy_async(request_type=dict) - - def test_set_iam_policy_field_headers(): client = SecretManagerServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6141,8 +6180,8 @@ def test_set_iam_policy_from_dict_foreign(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.GetIamPolicyRequest, - dict, + iam_policy_pb2.GetIamPolicyRequest(), + {}, ], ) def test_get_iam_policy(request_type, transport: str = "grpc"): @@ -6153,7 +6192,7 @@ def test_get_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(type(client.transport.get_iam_policy), "__call__") as call: @@ -6199,9 +6238,10 @@ def test_get_iam_policy_non_empty_request_with_auto_populated_field(): client.get_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.GetIamPolicyRequest( + request_msg = iam_policy_pb2.GetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_get_iam_policy_use_cached_wrapped_rpc(): @@ -6282,9 +6322,14 @@ async def test_get_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.GetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.GetIamPolicyRequest(), + {}, + ], +) +async def test_get_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = SecretManagerServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6292,7 +6337,7 @@ async def test_get_iam_policy_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_iam_policy), "__call__") as call: @@ -6317,11 +6362,6 @@ async def test_get_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_get_iam_policy_async_from_dict(): - await test_get_iam_policy_async(request_type=dict) - - def test_get_iam_policy_field_headers(): client = SecretManagerServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6401,8 +6441,8 @@ def test_get_iam_policy_from_dict_foreign(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.TestIamPermissionsRequest, - dict, + iam_policy_pb2.TestIamPermissionsRequest(), + {}, ], ) def test_test_iam_permissions(request_type, transport: str = "grpc"): @@ -6413,7 +6453,7 @@ def test_test_iam_permissions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6461,9 +6501,10 @@ def test_test_iam_permissions_non_empty_request_with_auto_populated_field(): client.test_iam_permissions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.TestIamPermissionsRequest( + request_msg = iam_policy_pb2.TestIamPermissionsRequest( resource="resource_value", ) + assert args[0] == request_msg def test_test_iam_permissions_use_cached_wrapped_rpc(): @@ -6548,9 +6589,15 @@ async def test_test_iam_permissions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.TestIamPermissionsRequest(), + {}, + ], +) async def test_test_iam_permissions_async( - transport: str = "grpc_asyncio", - request_type=iam_policy_pb2.TestIamPermissionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecretManagerServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -6559,7 +6606,7 @@ async def test_test_iam_permissions_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( @@ -6584,11 +6631,6 @@ async def test_test_iam_permissions_async( assert response.permissions == ["permissions_value"] -@pytest.mark.asyncio -async def test_test_iam_permissions_async_from_dict(): - await test_test_iam_permissions_async(request_type=dict) - - def test_test_iam_permissions_field_headers(): client = SecretManagerServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9529,7 +9571,6 @@ def test_list_secrets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListSecretsRequest() - assert args[0] == request_msg @@ -9550,7 +9591,6 @@ def test_create_secret_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateSecretRequest() - assert args[0] == request_msg @@ -9573,7 +9613,6 @@ def test_add_secret_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.AddSecretVersionRequest() - assert args[0] == request_msg @@ -9594,7 +9633,6 @@ def test_get_secret_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetSecretRequest() - assert args[0] == request_msg @@ -9615,7 +9653,6 @@ def test_update_secret_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateSecretRequest() - assert args[0] == request_msg @@ -9636,7 +9673,6 @@ def test_delete_secret_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteSecretRequest() - assert args[0] == request_msg @@ -9659,7 +9695,6 @@ def test_list_secret_versions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListSecretVersionsRequest() - assert args[0] == request_msg @@ -9682,7 +9717,6 @@ def test_get_secret_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetSecretVersionRequest() - assert args[0] == request_msg @@ -9705,7 +9739,6 @@ def test_access_secret_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.AccessSecretVersionRequest() - assert args[0] == request_msg @@ -9728,7 +9761,6 @@ def test_disable_secret_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DisableSecretVersionRequest() - assert args[0] == request_msg @@ -9751,7 +9783,6 @@ def test_enable_secret_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.EnableSecretVersionRequest() - assert args[0] == request_msg @@ -9774,7 +9805,6 @@ def test_destroy_secret_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DestroySecretVersionRequest() - assert args[0] == request_msg @@ -9795,7 +9825,6 @@ def test_set_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -9816,7 +9845,6 @@ def test_get_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -9839,7 +9867,6 @@ def test_test_iam_permissions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -9881,7 +9908,6 @@ async def test_list_secrets_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListSecretsRequest() - assert args[0] == request_msg @@ -9909,7 +9935,6 @@ async def test_create_secret_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateSecretRequest() - assert args[0] == request_msg @@ -9941,7 +9966,6 @@ async def test_add_secret_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.AddSecretVersionRequest() - assert args[0] == request_msg @@ -9969,7 +9993,6 @@ async def test_get_secret_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetSecretRequest() - assert args[0] == request_msg @@ -9997,7 +10020,6 @@ async def test_update_secret_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateSecretRequest() - assert args[0] == request_msg @@ -10020,7 +10042,6 @@ async def test_delete_secret_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteSecretRequest() - assert args[0] == request_msg @@ -10050,7 +10071,6 @@ async def test_list_secret_versions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListSecretVersionsRequest() - assert args[0] == request_msg @@ -10082,7 +10102,6 @@ async def test_get_secret_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetSecretVersionRequest() - assert args[0] == request_msg @@ -10111,7 +10130,6 @@ async def test_access_secret_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.AccessSecretVersionRequest() - assert args[0] == request_msg @@ -10143,7 +10161,6 @@ async def test_disable_secret_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DisableSecretVersionRequest() - assert args[0] == request_msg @@ -10175,7 +10192,6 @@ async def test_enable_secret_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.EnableSecretVersionRequest() - assert args[0] == request_msg @@ -10207,7 +10223,6 @@ async def test_destroy_secret_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DestroySecretVersionRequest() - assert args[0] == request_msg @@ -10235,7 +10250,6 @@ async def test_set_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -10263,7 +10277,6 @@ async def test_get_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -10292,7 +10305,6 @@ async def test_test_iam_permissions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -12601,7 +12613,6 @@ def test_list_secrets_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListSecretsRequest() - assert args[0] == request_msg @@ -12621,7 +12632,6 @@ def test_create_secret_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateSecretRequest() - assert args[0] == request_msg @@ -12643,7 +12653,6 @@ def test_add_secret_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.AddSecretVersionRequest() - assert args[0] == request_msg @@ -12663,7 +12672,6 @@ def test_get_secret_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetSecretRequest() - assert args[0] == request_msg @@ -12683,7 +12691,6 @@ def test_update_secret_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateSecretRequest() - assert args[0] == request_msg @@ -12703,7 +12710,6 @@ def test_delete_secret_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteSecretRequest() - assert args[0] == request_msg @@ -12725,7 +12731,6 @@ def test_list_secret_versions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListSecretVersionsRequest() - assert args[0] == request_msg @@ -12747,7 +12752,6 @@ def test_get_secret_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetSecretVersionRequest() - assert args[0] == request_msg @@ -12769,7 +12773,6 @@ def test_access_secret_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.AccessSecretVersionRequest() - assert args[0] == request_msg @@ -12791,7 +12794,6 @@ def test_disable_secret_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DisableSecretVersionRequest() - assert args[0] == request_msg @@ -12813,7 +12815,6 @@ def test_enable_secret_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.EnableSecretVersionRequest() - assert args[0] == request_msg @@ -12835,7 +12836,6 @@ def test_destroy_secret_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DestroySecretVersionRequest() - assert args[0] == request_msg @@ -12855,7 +12855,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -12875,7 +12874,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -12897,7 +12895,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-secret-manager/tests/unit/gapic/secretmanager_v1beta1/test_secret_manager_service.py b/packages/google-cloud-secret-manager/tests/unit/gapic/secretmanager_v1beta1/test_secret_manager_service.py index 51e6145e4cee..f0883216a97c 100644 --- a/packages/google-cloud-secret-manager/tests/unit/gapic/secretmanager_v1beta1/test_secret_manager_service.py +++ b/packages/google-cloud-secret-manager/tests/unit/gapic/secretmanager_v1beta1/test_secret_manager_service.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 @@ -114,6 +115,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" @@ -1377,8 +1393,8 @@ def test_secret_manager_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - service.ListSecretsRequest, - dict, + service.ListSecretsRequest(), + {}, ], ) def test_list_secrets(request_type, transport: str = "grpc"): @@ -1389,7 +1405,7 @@ def test_list_secrets(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_secrets), "__call__") as call: @@ -1436,10 +1452,11 @@ def test_list_secrets_non_empty_request_with_auto_populated_field(): client.list_secrets(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListSecretsRequest( + request_msg = service.ListSecretsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_secrets_use_cached_wrapped_rpc(): @@ -1520,9 +1537,14 @@ async def test_list_secrets_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_secrets_async( - transport: str = "grpc_asyncio", request_type=service.ListSecretsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListSecretsRequest(), + {}, + ], +) +async def test_list_secrets_async(request_type, transport: str = "grpc_asyncio"): client = SecretManagerServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1530,7 +1552,7 @@ async def test_list_secrets_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_secrets), "__call__") as call: @@ -1555,11 +1577,6 @@ async def test_list_secrets_async( assert response.total_size == 1086 -@pytest.mark.asyncio -async def test_list_secrets_async_from_dict(): - await test_list_secrets_async(request_type=dict) - - def test_list_secrets_field_headers(): client = SecretManagerServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1896,8 +1913,8 @@ async def test_list_secrets_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.CreateSecretRequest, - dict, + service.CreateSecretRequest(), + {}, ], ) def test_create_secret(request_type, transport: str = "grpc"): @@ -1908,7 +1925,7 @@ def test_create_secret(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_secret), "__call__") as call: @@ -1953,10 +1970,11 @@ def test_create_secret_non_empty_request_with_auto_populated_field(): client.create_secret(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateSecretRequest( + request_msg = service.CreateSecretRequest( parent="parent_value", secret_id="secret_id_value", ) + assert args[0] == request_msg def test_create_secret_use_cached_wrapped_rpc(): @@ -2037,9 +2055,14 @@ async def test_create_secret_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_secret_async( - transport: str = "grpc_asyncio", request_type=service.CreateSecretRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CreateSecretRequest(), + {}, + ], +) +async def test_create_secret_async(request_type, transport: str = "grpc_asyncio"): client = SecretManagerServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2047,7 +2070,7 @@ async def test_create_secret_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_secret), "__call__") as call: @@ -2070,11 +2093,6 @@ async def test_create_secret_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_create_secret_async_from_dict(): - await test_create_secret_async(request_type=dict) - - def test_create_secret_field_headers(): client = SecretManagerServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2237,8 +2255,8 @@ async def test_create_secret_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.AddSecretVersionRequest, - dict, + service.AddSecretVersionRequest(), + {}, ], ) def test_add_secret_version(request_type, transport: str = "grpc"): @@ -2249,7 +2267,7 @@ def test_add_secret_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,9 +2317,10 @@ def test_add_secret_version_non_empty_request_with_auto_populated_field(): client.add_secret_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.AddSecretVersionRequest( + request_msg = service.AddSecretVersionRequest( parent="parent_value", ) + assert args[0] == request_msg def test_add_secret_version_use_cached_wrapped_rpc(): @@ -2386,9 +2405,14 @@ async def test_add_secret_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_add_secret_version_async( - transport: str = "grpc_asyncio", request_type=service.AddSecretVersionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.AddSecretVersionRequest(), + {}, + ], +) +async def test_add_secret_version_async(request_type, transport: str = "grpc_asyncio"): client = SecretManagerServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2396,7 +2420,7 @@ async def test_add_secret_version_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( @@ -2423,11 +2447,6 @@ async def test_add_secret_version_async( assert response.state == resources.SecretVersion.State.ENABLED -@pytest.mark.asyncio -async def test_add_secret_version_async_from_dict(): - await test_add_secret_version_async(request_type=dict) - - def test_add_secret_version_field_headers(): client = SecretManagerServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2592,8 +2611,8 @@ async def test_add_secret_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.GetSecretRequest, - dict, + service.GetSecretRequest(), + {}, ], ) def test_get_secret(request_type, transport: str = "grpc"): @@ -2604,7 +2623,7 @@ def test_get_secret(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_secret), "__call__") as call: @@ -2648,9 +2667,10 @@ def test_get_secret_non_empty_request_with_auto_populated_field(): client.get_secret(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetSecretRequest( + request_msg = service.GetSecretRequest( name="name_value", ) + assert args[0] == request_msg def test_get_secret_use_cached_wrapped_rpc(): @@ -2729,9 +2749,14 @@ async def test_get_secret_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_secret_async( - transport: str = "grpc_asyncio", request_type=service.GetSecretRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetSecretRequest(), + {}, + ], +) +async def test_get_secret_async(request_type, transport: str = "grpc_asyncio"): client = SecretManagerServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2739,7 +2764,7 @@ async def test_get_secret_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_secret), "__call__") as call: @@ -2762,11 +2787,6 @@ async def test_get_secret_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_secret_async_from_dict(): - await test_get_secret_async(request_type=dict) - - def test_get_secret_field_headers(): client = SecretManagerServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2909,8 +2929,8 @@ async def test_get_secret_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdateSecretRequest, - dict, + service.UpdateSecretRequest(), + {}, ], ) def test_update_secret(request_type, transport: str = "grpc"): @@ -2921,7 +2941,7 @@ def test_update_secret(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_secret), "__call__") as call: @@ -2963,7 +2983,8 @@ def test_update_secret_non_empty_request_with_auto_populated_field(): client.update_secret(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateSecretRequest() + request_msg = service.UpdateSecretRequest() + assert args[0] == request_msg def test_update_secret_use_cached_wrapped_rpc(): @@ -3044,9 +3065,14 @@ async def test_update_secret_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_secret_async( - transport: str = "grpc_asyncio", request_type=service.UpdateSecretRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateSecretRequest(), + {}, + ], +) +async def test_update_secret_async(request_type, transport: str = "grpc_asyncio"): client = SecretManagerServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3054,7 +3080,7 @@ async def test_update_secret_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_secret), "__call__") as call: @@ -3077,11 +3103,6 @@ async def test_update_secret_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_update_secret_async_from_dict(): - await test_update_secret_async(request_type=dict) - - def test_update_secret_field_headers(): client = SecretManagerServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3234,8 +3255,8 @@ async def test_update_secret_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DeleteSecretRequest, - dict, + service.DeleteSecretRequest(), + {}, ], ) def test_delete_secret(request_type, transport: str = "grpc"): @@ -3246,7 +3267,7 @@ def test_delete_secret(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_secret), "__call__") as call: @@ -3287,9 +3308,10 @@ def test_delete_secret_non_empty_request_with_auto_populated_field(): client.delete_secret(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteSecretRequest( + request_msg = service.DeleteSecretRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_secret_use_cached_wrapped_rpc(): @@ -3370,9 +3392,14 @@ async def test_delete_secret_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_secret_async( - transport: str = "grpc_asyncio", request_type=service.DeleteSecretRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteSecretRequest(), + {}, + ], +) +async def test_delete_secret_async(request_type, transport: str = "grpc_asyncio"): client = SecretManagerServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3380,7 +3407,7 @@ async def test_delete_secret_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_secret), "__call__") as call: @@ -3398,11 +3425,6 @@ async def test_delete_secret_async( assert response is None -@pytest.mark.asyncio -async def test_delete_secret_async_from_dict(): - await test_delete_secret_async(request_type=dict) - - def test_delete_secret_field_headers(): client = SecretManagerServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3545,8 +3567,8 @@ async def test_delete_secret_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListSecretVersionsRequest, - dict, + service.ListSecretVersionsRequest(), + {}, ], ) def test_list_secret_versions(request_type, transport: str = "grpc"): @@ -3557,7 +3579,7 @@ def test_list_secret_versions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3608,10 +3630,11 @@ def test_list_secret_versions_non_empty_request_with_auto_populated_field(): client.list_secret_versions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListSecretVersionsRequest( + request_msg = service.ListSecretVersionsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_secret_versions_use_cached_wrapped_rpc(): @@ -3696,8 +3719,15 @@ async def test_list_secret_versions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.ListSecretVersionsRequest(), + {}, + ], +) async def test_list_secret_versions_async( - transport: str = "grpc_asyncio", request_type=service.ListSecretVersionsRequest + request_type, transport: str = "grpc_asyncio" ): client = SecretManagerServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3706,7 +3736,7 @@ async def test_list_secret_versions_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( @@ -3733,11 +3763,6 @@ async def test_list_secret_versions_async( assert response.total_size == 1086 -@pytest.mark.asyncio -async def test_list_secret_versions_async_from_dict(): - await test_list_secret_versions_async(request_type=dict) - - def test_list_secret_versions_field_headers(): client = SecretManagerServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4090,8 +4115,8 @@ async def test_list_secret_versions_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetSecretVersionRequest, - dict, + service.GetSecretVersionRequest(), + {}, ], ) def test_get_secret_version(request_type, transport: str = "grpc"): @@ -4102,7 +4127,7 @@ def test_get_secret_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4152,9 +4177,10 @@ def test_get_secret_version_non_empty_request_with_auto_populated_field(): client.get_secret_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetSecretVersionRequest( + request_msg = service.GetSecretVersionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_secret_version_use_cached_wrapped_rpc(): @@ -4239,9 +4265,14 @@ async def test_get_secret_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_secret_version_async( - transport: str = "grpc_asyncio", request_type=service.GetSecretVersionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetSecretVersionRequest(), + {}, + ], +) +async def test_get_secret_version_async(request_type, transport: str = "grpc_asyncio"): client = SecretManagerServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4249,7 +4280,7 @@ async def test_get_secret_version_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( @@ -4276,11 +4307,6 @@ async def test_get_secret_version_async( assert response.state == resources.SecretVersion.State.ENABLED -@pytest.mark.asyncio -async def test_get_secret_version_async_from_dict(): - await test_get_secret_version_async(request_type=dict) - - def test_get_secret_version_field_headers(): client = SecretManagerServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4435,8 +4461,8 @@ async def test_get_secret_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.AccessSecretVersionRequest, - dict, + service.AccessSecretVersionRequest(), + {}, ], ) def test_access_secret_version(request_type, transport: str = "grpc"): @@ -4447,7 +4473,7 @@ def test_access_secret_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4495,9 +4521,10 @@ def test_access_secret_version_non_empty_request_with_auto_populated_field(): client.access_secret_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.AccessSecretVersionRequest( + request_msg = service.AccessSecretVersionRequest( name="name_value", ) + assert args[0] == request_msg def test_access_secret_version_use_cached_wrapped_rpc(): @@ -4583,8 +4610,15 @@ async def test_access_secret_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.AccessSecretVersionRequest(), + {}, + ], +) async def test_access_secret_version_async( - transport: str = "grpc_asyncio", request_type=service.AccessSecretVersionRequest + request_type, transport: str = "grpc_asyncio" ): client = SecretManagerServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4593,7 +4627,7 @@ async def test_access_secret_version_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( @@ -4618,11 +4652,6 @@ async def test_access_secret_version_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_access_secret_version_async_from_dict(): - await test_access_secret_version_async(request_type=dict) - - def test_access_secret_version_field_headers(): client = SecretManagerServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4777,8 +4806,8 @@ async def test_access_secret_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DisableSecretVersionRequest, - dict, + service.DisableSecretVersionRequest(), + {}, ], ) def test_disable_secret_version(request_type, transport: str = "grpc"): @@ -4789,7 +4818,7 @@ def test_disable_secret_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,9 +4868,10 @@ def test_disable_secret_version_non_empty_request_with_auto_populated_field(): client.disable_secret_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DisableSecretVersionRequest( + request_msg = service.DisableSecretVersionRequest( name="name_value", ) + assert args[0] == request_msg def test_disable_secret_version_use_cached_wrapped_rpc(): @@ -4927,8 +4957,15 @@ async def test_disable_secret_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.DisableSecretVersionRequest(), + {}, + ], +) async def test_disable_secret_version_async( - transport: str = "grpc_asyncio", request_type=service.DisableSecretVersionRequest + request_type, transport: str = "grpc_asyncio" ): client = SecretManagerServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4937,7 +4974,7 @@ async def test_disable_secret_version_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 +5001,6 @@ async def test_disable_secret_version_async( assert response.state == resources.SecretVersion.State.ENABLED -@pytest.mark.asyncio -async def test_disable_secret_version_async_from_dict(): - await test_disable_secret_version_async(request_type=dict) - - def test_disable_secret_version_field_headers(): client = SecretManagerServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5123,8 +5155,8 @@ async def test_disable_secret_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.EnableSecretVersionRequest, - dict, + service.EnableSecretVersionRequest(), + {}, ], ) def test_enable_secret_version(request_type, transport: str = "grpc"): @@ -5135,7 +5167,7 @@ def test_enable_secret_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5185,9 +5217,10 @@ def test_enable_secret_version_non_empty_request_with_auto_populated_field(): client.enable_secret_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.EnableSecretVersionRequest( + request_msg = service.EnableSecretVersionRequest( name="name_value", ) + assert args[0] == request_msg def test_enable_secret_version_use_cached_wrapped_rpc(): @@ -5273,8 +5306,15 @@ async def test_enable_secret_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.EnableSecretVersionRequest(), + {}, + ], +) async def test_enable_secret_version_async( - transport: str = "grpc_asyncio", request_type=service.EnableSecretVersionRequest + request_type, transport: str = "grpc_asyncio" ): client = SecretManagerServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5283,7 +5323,7 @@ async def test_enable_secret_version_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( @@ -5310,11 +5350,6 @@ async def test_enable_secret_version_async( assert response.state == resources.SecretVersion.State.ENABLED -@pytest.mark.asyncio -async def test_enable_secret_version_async_from_dict(): - await test_enable_secret_version_async(request_type=dict) - - def test_enable_secret_version_field_headers(): client = SecretManagerServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5469,8 +5504,8 @@ async def test_enable_secret_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DestroySecretVersionRequest, - dict, + service.DestroySecretVersionRequest(), + {}, ], ) def test_destroy_secret_version(request_type, transport: str = "grpc"): @@ -5481,7 +5516,7 @@ def test_destroy_secret_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5531,9 +5566,10 @@ def test_destroy_secret_version_non_empty_request_with_auto_populated_field(): client.destroy_secret_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DestroySecretVersionRequest( + request_msg = service.DestroySecretVersionRequest( name="name_value", ) + assert args[0] == request_msg def test_destroy_secret_version_use_cached_wrapped_rpc(): @@ -5619,8 +5655,15 @@ async def test_destroy_secret_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.DestroySecretVersionRequest(), + {}, + ], +) async def test_destroy_secret_version_async( - transport: str = "grpc_asyncio", request_type=service.DestroySecretVersionRequest + request_type, transport: str = "grpc_asyncio" ): client = SecretManagerServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5629,7 +5672,7 @@ async def test_destroy_secret_version_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( @@ -5656,11 +5699,6 @@ async def test_destroy_secret_version_async( assert response.state == resources.SecretVersion.State.ENABLED -@pytest.mark.asyncio -async def test_destroy_secret_version_async_from_dict(): - await test_destroy_secret_version_async(request_type=dict) - - def test_destroy_secret_version_field_headers(): client = SecretManagerServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5815,8 +5853,8 @@ async def test_destroy_secret_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.SetIamPolicyRequest, - dict, + iam_policy_pb2.SetIamPolicyRequest(), + {}, ], ) def test_set_iam_policy(request_type, transport: str = "grpc"): @@ -5827,7 +5865,7 @@ def test_set_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(type(client.transport.set_iam_policy), "__call__") as call: @@ -5873,9 +5911,10 @@ def test_set_iam_policy_non_empty_request_with_auto_populated_field(): client.set_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.SetIamPolicyRequest( + request_msg = iam_policy_pb2.SetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_set_iam_policy_use_cached_wrapped_rpc(): @@ -5956,9 +5995,14 @@ async def test_set_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.SetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.SetIamPolicyRequest(), + {}, + ], +) +async def test_set_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = SecretManagerServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5966,7 +6010,7 @@ async def test_set_iam_policy_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.set_iam_policy), "__call__") as call: @@ -5991,11 +6035,6 @@ async def test_set_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_set_iam_policy_async_from_dict(): - await test_set_iam_policy_async(request_type=dict) - - def test_set_iam_policy_field_headers(): client = SecretManagerServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6076,8 +6115,8 @@ def test_set_iam_policy_from_dict_foreign(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.GetIamPolicyRequest, - dict, + iam_policy_pb2.GetIamPolicyRequest(), + {}, ], ) def test_get_iam_policy(request_type, transport: str = "grpc"): @@ -6088,7 +6127,7 @@ def test_get_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(type(client.transport.get_iam_policy), "__call__") as call: @@ -6134,9 +6173,10 @@ def test_get_iam_policy_non_empty_request_with_auto_populated_field(): client.get_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.GetIamPolicyRequest( + request_msg = iam_policy_pb2.GetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_get_iam_policy_use_cached_wrapped_rpc(): @@ -6217,9 +6257,14 @@ async def test_get_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.GetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.GetIamPolicyRequest(), + {}, + ], +) +async def test_get_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = SecretManagerServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6227,7 +6272,7 @@ async def test_get_iam_policy_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_iam_policy), "__call__") as call: @@ -6252,11 +6297,6 @@ async def test_get_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_get_iam_policy_async_from_dict(): - await test_get_iam_policy_async(request_type=dict) - - def test_get_iam_policy_field_headers(): client = SecretManagerServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6336,8 +6376,8 @@ def test_get_iam_policy_from_dict_foreign(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.TestIamPermissionsRequest, - dict, + iam_policy_pb2.TestIamPermissionsRequest(), + {}, ], ) def test_test_iam_permissions(request_type, transport: str = "grpc"): @@ -6348,7 +6388,7 @@ def test_test_iam_permissions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6396,9 +6436,10 @@ def test_test_iam_permissions_non_empty_request_with_auto_populated_field(): client.test_iam_permissions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.TestIamPermissionsRequest( + request_msg = iam_policy_pb2.TestIamPermissionsRequest( resource="resource_value", ) + assert args[0] == request_msg def test_test_iam_permissions_use_cached_wrapped_rpc(): @@ -6483,9 +6524,15 @@ async def test_test_iam_permissions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.TestIamPermissionsRequest(), + {}, + ], +) async def test_test_iam_permissions_async( - transport: str = "grpc_asyncio", - request_type=iam_policy_pb2.TestIamPermissionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecretManagerServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -6494,7 +6541,7 @@ async def test_test_iam_permissions_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( @@ -6519,11 +6566,6 @@ async def test_test_iam_permissions_async( assert response.permissions == ["permissions_value"] -@pytest.mark.asyncio -async def test_test_iam_permissions_async_from_dict(): - await test_test_iam_permissions_async(request_type=dict) - - def test_test_iam_permissions_field_headers(): client = SecretManagerServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9462,7 +9504,6 @@ def test_list_secrets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListSecretsRequest() - assert args[0] == request_msg @@ -9483,7 +9524,6 @@ def test_create_secret_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateSecretRequest() - assert args[0] == request_msg @@ -9506,7 +9546,6 @@ def test_add_secret_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.AddSecretVersionRequest() - assert args[0] == request_msg @@ -9527,7 +9566,6 @@ def test_get_secret_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetSecretRequest() - assert args[0] == request_msg @@ -9548,7 +9586,6 @@ def test_update_secret_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateSecretRequest() - assert args[0] == request_msg @@ -9569,7 +9606,6 @@ def test_delete_secret_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteSecretRequest() - assert args[0] == request_msg @@ -9592,7 +9628,6 @@ def test_list_secret_versions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListSecretVersionsRequest() - assert args[0] == request_msg @@ -9615,7 +9650,6 @@ def test_get_secret_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetSecretVersionRequest() - assert args[0] == request_msg @@ -9638,7 +9672,6 @@ def test_access_secret_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.AccessSecretVersionRequest() - assert args[0] == request_msg @@ -9661,7 +9694,6 @@ def test_disable_secret_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DisableSecretVersionRequest() - assert args[0] == request_msg @@ -9684,7 +9716,6 @@ def test_enable_secret_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.EnableSecretVersionRequest() - assert args[0] == request_msg @@ -9707,7 +9738,6 @@ def test_destroy_secret_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DestroySecretVersionRequest() - assert args[0] == request_msg @@ -9728,7 +9758,6 @@ def test_set_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -9749,7 +9778,6 @@ def test_get_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -9772,7 +9800,6 @@ def test_test_iam_permissions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -9814,7 +9841,6 @@ async def test_list_secrets_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListSecretsRequest() - assert args[0] == request_msg @@ -9841,7 +9867,6 @@ async def test_create_secret_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateSecretRequest() - assert args[0] == request_msg @@ -9871,7 +9896,6 @@ async def test_add_secret_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.AddSecretVersionRequest() - assert args[0] == request_msg @@ -9898,7 +9922,6 @@ async def test_get_secret_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetSecretRequest() - assert args[0] == request_msg @@ -9925,7 +9948,6 @@ async def test_update_secret_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateSecretRequest() - assert args[0] == request_msg @@ -9948,7 +9970,6 @@ async def test_delete_secret_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteSecretRequest() - assert args[0] == request_msg @@ -9978,7 +9999,6 @@ async def test_list_secret_versions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListSecretVersionsRequest() - assert args[0] == request_msg @@ -10008,7 +10028,6 @@ async def test_get_secret_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetSecretVersionRequest() - assert args[0] == request_msg @@ -10037,7 +10056,6 @@ async def test_access_secret_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.AccessSecretVersionRequest() - assert args[0] == request_msg @@ -10067,7 +10085,6 @@ async def test_disable_secret_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DisableSecretVersionRequest() - assert args[0] == request_msg @@ -10097,7 +10114,6 @@ async def test_enable_secret_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.EnableSecretVersionRequest() - assert args[0] == request_msg @@ -10127,7 +10143,6 @@ async def test_destroy_secret_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DestroySecretVersionRequest() - assert args[0] == request_msg @@ -10155,7 +10170,6 @@ async def test_set_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -10183,7 +10197,6 @@ async def test_get_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -10212,7 +10225,6 @@ async def test_test_iam_permissions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -12463,7 +12475,6 @@ def test_list_secrets_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListSecretsRequest() - assert args[0] == request_msg @@ -12483,7 +12494,6 @@ def test_create_secret_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateSecretRequest() - assert args[0] == request_msg @@ -12505,7 +12515,6 @@ def test_add_secret_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.AddSecretVersionRequest() - assert args[0] == request_msg @@ -12525,7 +12534,6 @@ def test_get_secret_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetSecretRequest() - assert args[0] == request_msg @@ -12545,7 +12553,6 @@ def test_update_secret_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateSecretRequest() - assert args[0] == request_msg @@ -12565,7 +12572,6 @@ def test_delete_secret_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteSecretRequest() - assert args[0] == request_msg @@ -12587,7 +12593,6 @@ def test_list_secret_versions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListSecretVersionsRequest() - assert args[0] == request_msg @@ -12609,7 +12614,6 @@ def test_get_secret_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetSecretVersionRequest() - assert args[0] == request_msg @@ -12631,7 +12635,6 @@ def test_access_secret_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.AccessSecretVersionRequest() - assert args[0] == request_msg @@ -12653,7 +12656,6 @@ def test_disable_secret_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DisableSecretVersionRequest() - assert args[0] == request_msg @@ -12675,7 +12677,6 @@ def test_enable_secret_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.EnableSecretVersionRequest() - assert args[0] == request_msg @@ -12697,7 +12698,6 @@ def test_destroy_secret_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DestroySecretVersionRequest() - assert args[0] == request_msg @@ -12717,7 +12717,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -12737,7 +12736,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -12759,7 +12757,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-secret-manager/tests/unit/gapic/secretmanager_v1beta2/test_secret_manager_service.py b/packages/google-cloud-secret-manager/tests/unit/gapic/secretmanager_v1beta2/test_secret_manager_service.py index f801b07762aa..a6d9988d3f4b 100644 --- a/packages/google-cloud-secret-manager/tests/unit/gapic/secretmanager_v1beta2/test_secret_manager_service.py +++ b/packages/google-cloud-secret-manager/tests/unit/gapic/secretmanager_v1beta2/test_secret_manager_service.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 @@ -115,6 +116,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" @@ -1378,8 +1394,8 @@ def test_secret_manager_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - service.ListSecretsRequest, - dict, + service.ListSecretsRequest(), + {}, ], ) def test_list_secrets(request_type, transport: str = "grpc"): @@ -1390,7 +1406,7 @@ def test_list_secrets(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_secrets), "__call__") as call: @@ -1438,11 +1454,12 @@ def test_list_secrets_non_empty_request_with_auto_populated_field(): client.list_secrets(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListSecretsRequest( + request_msg = service.ListSecretsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_secrets_use_cached_wrapped_rpc(): @@ -1523,9 +1540,14 @@ async def test_list_secrets_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_secrets_async( - transport: str = "grpc_asyncio", request_type=service.ListSecretsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListSecretsRequest(), + {}, + ], +) +async def test_list_secrets_async(request_type, transport: str = "grpc_asyncio"): client = SecretManagerServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1533,7 +1555,7 @@ async def test_list_secrets_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_secrets), "__call__") as call: @@ -1558,11 +1580,6 @@ async def test_list_secrets_async( assert response.total_size == 1086 -@pytest.mark.asyncio -async def test_list_secrets_async_from_dict(): - await test_list_secrets_async(request_type=dict) - - def test_list_secrets_field_headers(): client = SecretManagerServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1899,8 +1916,8 @@ async def test_list_secrets_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.CreateSecretRequest, - dict, + service.CreateSecretRequest(), + {}, ], ) def test_create_secret(request_type, transport: str = "grpc"): @@ -1911,7 +1928,7 @@ def test_create_secret(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_secret), "__call__") as call: @@ -1958,10 +1975,11 @@ def test_create_secret_non_empty_request_with_auto_populated_field(): client.create_secret(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateSecretRequest( + request_msg = service.CreateSecretRequest( parent="parent_value", secret_id="secret_id_value", ) + assert args[0] == request_msg def test_create_secret_use_cached_wrapped_rpc(): @@ -2042,9 +2060,14 @@ async def test_create_secret_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_secret_async( - transport: str = "grpc_asyncio", request_type=service.CreateSecretRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CreateSecretRequest(), + {}, + ], +) +async def test_create_secret_async(request_type, transport: str = "grpc_asyncio"): client = SecretManagerServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2052,7 +2075,7 @@ async def test_create_secret_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_secret), "__call__") as call: @@ -2077,11 +2100,6 @@ async def test_create_secret_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_create_secret_async_from_dict(): - await test_create_secret_async(request_type=dict) - - def test_create_secret_field_headers(): client = SecretManagerServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2244,8 +2262,8 @@ async def test_create_secret_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.AddSecretVersionRequest, - dict, + service.AddSecretVersionRequest(), + {}, ], ) def test_add_secret_version(request_type, transport: str = "grpc"): @@ -2256,7 +2274,7 @@ def test_add_secret_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2310,9 +2328,10 @@ def test_add_secret_version_non_empty_request_with_auto_populated_field(): client.add_secret_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.AddSecretVersionRequest( + request_msg = service.AddSecretVersionRequest( parent="parent_value", ) + assert args[0] == request_msg def test_add_secret_version_use_cached_wrapped_rpc(): @@ -2397,9 +2416,14 @@ async def test_add_secret_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_add_secret_version_async( - transport: str = "grpc_asyncio", request_type=service.AddSecretVersionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.AddSecretVersionRequest(), + {}, + ], +) +async def test_add_secret_version_async(request_type, transport: str = "grpc_asyncio"): client = SecretManagerServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2407,7 +2431,7 @@ async def test_add_secret_version_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( @@ -2438,11 +2462,6 @@ async def test_add_secret_version_async( assert response.client_specified_payload_checksum is True -@pytest.mark.asyncio -async def test_add_secret_version_async_from_dict(): - await test_add_secret_version_async(request_type=dict) - - def test_add_secret_version_field_headers(): client = SecretManagerServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2607,8 +2626,8 @@ async def test_add_secret_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.GetSecretRequest, - dict, + service.GetSecretRequest(), + {}, ], ) def test_get_secret(request_type, transport: str = "grpc"): @@ -2619,7 +2638,7 @@ def test_get_secret(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_secret), "__call__") as call: @@ -2665,9 +2684,10 @@ def test_get_secret_non_empty_request_with_auto_populated_field(): client.get_secret(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetSecretRequest( + request_msg = service.GetSecretRequest( name="name_value", ) + assert args[0] == request_msg def test_get_secret_use_cached_wrapped_rpc(): @@ -2746,9 +2766,14 @@ async def test_get_secret_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_secret_async( - transport: str = "grpc_asyncio", request_type=service.GetSecretRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetSecretRequest(), + {}, + ], +) +async def test_get_secret_async(request_type, transport: str = "grpc_asyncio"): client = SecretManagerServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2756,7 +2781,7 @@ async def test_get_secret_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_secret), "__call__") as call: @@ -2781,11 +2806,6 @@ async def test_get_secret_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_secret_async_from_dict(): - await test_get_secret_async(request_type=dict) - - def test_get_secret_field_headers(): client = SecretManagerServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2928,8 +2948,8 @@ async def test_get_secret_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdateSecretRequest, - dict, + service.UpdateSecretRequest(), + {}, ], ) def test_update_secret(request_type, transport: str = "grpc"): @@ -2940,7 +2960,7 @@ def test_update_secret(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_secret), "__call__") as call: @@ -2984,7 +3004,8 @@ def test_update_secret_non_empty_request_with_auto_populated_field(): client.update_secret(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateSecretRequest() + request_msg = service.UpdateSecretRequest() + assert args[0] == request_msg def test_update_secret_use_cached_wrapped_rpc(): @@ -3065,9 +3086,14 @@ async def test_update_secret_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_secret_async( - transport: str = "grpc_asyncio", request_type=service.UpdateSecretRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateSecretRequest(), + {}, + ], +) +async def test_update_secret_async(request_type, transport: str = "grpc_asyncio"): client = SecretManagerServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3075,7 +3101,7 @@ async def test_update_secret_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_secret), "__call__") as call: @@ -3100,11 +3126,6 @@ async def test_update_secret_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_update_secret_async_from_dict(): - await test_update_secret_async(request_type=dict) - - def test_update_secret_field_headers(): client = SecretManagerServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3257,8 +3278,8 @@ async def test_update_secret_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DeleteSecretRequest, - dict, + service.DeleteSecretRequest(), + {}, ], ) def test_delete_secret(request_type, transport: str = "grpc"): @@ -3269,7 +3290,7 @@ def test_delete_secret(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_secret), "__call__") as call: @@ -3311,10 +3332,11 @@ def test_delete_secret_non_empty_request_with_auto_populated_field(): client.delete_secret(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteSecretRequest( + request_msg = service.DeleteSecretRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_secret_use_cached_wrapped_rpc(): @@ -3395,9 +3417,14 @@ async def test_delete_secret_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_secret_async( - transport: str = "grpc_asyncio", request_type=service.DeleteSecretRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteSecretRequest(), + {}, + ], +) +async def test_delete_secret_async(request_type, transport: str = "grpc_asyncio"): client = SecretManagerServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3405,7 +3432,7 @@ async def test_delete_secret_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_secret), "__call__") as call: @@ -3423,11 +3450,6 @@ async def test_delete_secret_async( assert response is None -@pytest.mark.asyncio -async def test_delete_secret_async_from_dict(): - await test_delete_secret_async(request_type=dict) - - def test_delete_secret_field_headers(): client = SecretManagerServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3570,8 +3592,8 @@ async def test_delete_secret_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListSecretVersionsRequest, - dict, + service.ListSecretVersionsRequest(), + {}, ], ) def test_list_secret_versions(request_type, transport: str = "grpc"): @@ -3582,7 +3604,7 @@ def test_list_secret_versions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3634,11 +3656,12 @@ def test_list_secret_versions_non_empty_request_with_auto_populated_field(): client.list_secret_versions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListSecretVersionsRequest( + request_msg = service.ListSecretVersionsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_secret_versions_use_cached_wrapped_rpc(): @@ -3723,8 +3746,15 @@ async def test_list_secret_versions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.ListSecretVersionsRequest(), + {}, + ], +) async def test_list_secret_versions_async( - transport: str = "grpc_asyncio", request_type=service.ListSecretVersionsRequest + request_type, transport: str = "grpc_asyncio" ): client = SecretManagerServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3733,7 +3763,7 @@ async def test_list_secret_versions_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( @@ -3760,11 +3790,6 @@ async def test_list_secret_versions_async( assert response.total_size == 1086 -@pytest.mark.asyncio -async def test_list_secret_versions_async_from_dict(): - await test_list_secret_versions_async(request_type=dict) - - def test_list_secret_versions_field_headers(): client = SecretManagerServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4117,8 +4142,8 @@ async def test_list_secret_versions_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetSecretVersionRequest, - dict, + service.GetSecretVersionRequest(), + {}, ], ) def test_get_secret_version(request_type, transport: str = "grpc"): @@ -4129,7 +4154,7 @@ def test_get_secret_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4183,9 +4208,10 @@ def test_get_secret_version_non_empty_request_with_auto_populated_field(): client.get_secret_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetSecretVersionRequest( + request_msg = service.GetSecretVersionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_secret_version_use_cached_wrapped_rpc(): @@ -4270,9 +4296,14 @@ async def test_get_secret_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_secret_version_async( - transport: str = "grpc_asyncio", request_type=service.GetSecretVersionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetSecretVersionRequest(), + {}, + ], +) +async def test_get_secret_version_async(request_type, transport: str = "grpc_asyncio"): client = SecretManagerServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4280,7 +4311,7 @@ async def test_get_secret_version_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( @@ -4311,11 +4342,6 @@ async def test_get_secret_version_async( assert response.client_specified_payload_checksum is True -@pytest.mark.asyncio -async def test_get_secret_version_async_from_dict(): - await test_get_secret_version_async(request_type=dict) - - def test_get_secret_version_field_headers(): client = SecretManagerServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4470,8 +4496,8 @@ async def test_get_secret_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.AccessSecretVersionRequest, - dict, + service.AccessSecretVersionRequest(), + {}, ], ) def test_access_secret_version(request_type, transport: str = "grpc"): @@ -4482,7 +4508,7 @@ def test_access_secret_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4530,9 +4556,10 @@ def test_access_secret_version_non_empty_request_with_auto_populated_field(): client.access_secret_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.AccessSecretVersionRequest( + request_msg = service.AccessSecretVersionRequest( name="name_value", ) + assert args[0] == request_msg def test_access_secret_version_use_cached_wrapped_rpc(): @@ -4618,8 +4645,15 @@ async def test_access_secret_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.AccessSecretVersionRequest(), + {}, + ], +) async def test_access_secret_version_async( - transport: str = "grpc_asyncio", request_type=service.AccessSecretVersionRequest + request_type, transport: str = "grpc_asyncio" ): client = SecretManagerServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4628,7 +4662,7 @@ async def test_access_secret_version_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( @@ -4653,11 +4687,6 @@ async def test_access_secret_version_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_access_secret_version_async_from_dict(): - await test_access_secret_version_async(request_type=dict) - - def test_access_secret_version_field_headers(): client = SecretManagerServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4812,8 +4841,8 @@ async def test_access_secret_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DisableSecretVersionRequest, - dict, + service.DisableSecretVersionRequest(), + {}, ], ) def test_disable_secret_version(request_type, transport: str = "grpc"): @@ -4824,7 +4853,7 @@ def test_disable_secret_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4879,10 +4908,11 @@ def test_disable_secret_version_non_empty_request_with_auto_populated_field(): client.disable_secret_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DisableSecretVersionRequest( + request_msg = service.DisableSecretVersionRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_disable_secret_version_use_cached_wrapped_rpc(): @@ -4968,8 +4998,15 @@ async def test_disable_secret_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.DisableSecretVersionRequest(), + {}, + ], +) async def test_disable_secret_version_async( - transport: str = "grpc_asyncio", request_type=service.DisableSecretVersionRequest + request_type, transport: str = "grpc_asyncio" ): client = SecretManagerServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4978,7 +5015,7 @@ async def test_disable_secret_version_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( @@ -5009,11 +5046,6 @@ async def test_disable_secret_version_async( assert response.client_specified_payload_checksum is True -@pytest.mark.asyncio -async def test_disable_secret_version_async_from_dict(): - await test_disable_secret_version_async(request_type=dict) - - def test_disable_secret_version_field_headers(): client = SecretManagerServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5168,8 +5200,8 @@ async def test_disable_secret_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.EnableSecretVersionRequest, - dict, + service.EnableSecretVersionRequest(), + {}, ], ) def test_enable_secret_version(request_type, transport: str = "grpc"): @@ -5180,7 +5212,7 @@ def test_enable_secret_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5235,10 +5267,11 @@ def test_enable_secret_version_non_empty_request_with_auto_populated_field(): client.enable_secret_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.EnableSecretVersionRequest( + request_msg = service.EnableSecretVersionRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_enable_secret_version_use_cached_wrapped_rpc(): @@ -5324,8 +5357,15 @@ async def test_enable_secret_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.EnableSecretVersionRequest(), + {}, + ], +) async def test_enable_secret_version_async( - transport: str = "grpc_asyncio", request_type=service.EnableSecretVersionRequest + request_type, transport: str = "grpc_asyncio" ): client = SecretManagerServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5334,7 +5374,7 @@ async def test_enable_secret_version_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( @@ -5365,11 +5405,6 @@ async def test_enable_secret_version_async( assert response.client_specified_payload_checksum is True -@pytest.mark.asyncio -async def test_enable_secret_version_async_from_dict(): - await test_enable_secret_version_async(request_type=dict) - - def test_enable_secret_version_field_headers(): client = SecretManagerServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5524,8 +5559,8 @@ async def test_enable_secret_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DestroySecretVersionRequest, - dict, + service.DestroySecretVersionRequest(), + {}, ], ) def test_destroy_secret_version(request_type, transport: str = "grpc"): @@ -5536,7 +5571,7 @@ def test_destroy_secret_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,10 +5626,11 @@ def test_destroy_secret_version_non_empty_request_with_auto_populated_field(): client.destroy_secret_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DestroySecretVersionRequest( + request_msg = service.DestroySecretVersionRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_destroy_secret_version_use_cached_wrapped_rpc(): @@ -5680,8 +5716,15 @@ async def test_destroy_secret_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.DestroySecretVersionRequest(), + {}, + ], +) async def test_destroy_secret_version_async( - transport: str = "grpc_asyncio", request_type=service.DestroySecretVersionRequest + request_type, transport: str = "grpc_asyncio" ): client = SecretManagerServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5690,7 +5733,7 @@ async def test_destroy_secret_version_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( @@ -5721,11 +5764,6 @@ async def test_destroy_secret_version_async( assert response.client_specified_payload_checksum is True -@pytest.mark.asyncio -async def test_destroy_secret_version_async_from_dict(): - await test_destroy_secret_version_async(request_type=dict) - - def test_destroy_secret_version_field_headers(): client = SecretManagerServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5880,8 +5918,8 @@ async def test_destroy_secret_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.SetIamPolicyRequest, - dict, + iam_policy_pb2.SetIamPolicyRequest(), + {}, ], ) def test_set_iam_policy(request_type, transport: str = "grpc"): @@ -5892,7 +5930,7 @@ def test_set_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(type(client.transport.set_iam_policy), "__call__") as call: @@ -5938,9 +5976,10 @@ def test_set_iam_policy_non_empty_request_with_auto_populated_field(): client.set_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.SetIamPolicyRequest( + request_msg = iam_policy_pb2.SetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_set_iam_policy_use_cached_wrapped_rpc(): @@ -6021,9 +6060,14 @@ async def test_set_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.SetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.SetIamPolicyRequest(), + {}, + ], +) +async def test_set_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = SecretManagerServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6031,7 +6075,7 @@ async def test_set_iam_policy_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.set_iam_policy), "__call__") as call: @@ -6056,11 +6100,6 @@ async def test_set_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_set_iam_policy_async_from_dict(): - await test_set_iam_policy_async(request_type=dict) - - def test_set_iam_policy_field_headers(): client = SecretManagerServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6141,8 +6180,8 @@ def test_set_iam_policy_from_dict_foreign(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.GetIamPolicyRequest, - dict, + iam_policy_pb2.GetIamPolicyRequest(), + {}, ], ) def test_get_iam_policy(request_type, transport: str = "grpc"): @@ -6153,7 +6192,7 @@ def test_get_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(type(client.transport.get_iam_policy), "__call__") as call: @@ -6199,9 +6238,10 @@ def test_get_iam_policy_non_empty_request_with_auto_populated_field(): client.get_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.GetIamPolicyRequest( + request_msg = iam_policy_pb2.GetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_get_iam_policy_use_cached_wrapped_rpc(): @@ -6282,9 +6322,14 @@ async def test_get_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.GetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.GetIamPolicyRequest(), + {}, + ], +) +async def test_get_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = SecretManagerServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6292,7 +6337,7 @@ async def test_get_iam_policy_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_iam_policy), "__call__") as call: @@ -6317,11 +6362,6 @@ async def test_get_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_get_iam_policy_async_from_dict(): - await test_get_iam_policy_async(request_type=dict) - - def test_get_iam_policy_field_headers(): client = SecretManagerServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6401,8 +6441,8 @@ def test_get_iam_policy_from_dict_foreign(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.TestIamPermissionsRequest, - dict, + iam_policy_pb2.TestIamPermissionsRequest(), + {}, ], ) def test_test_iam_permissions(request_type, transport: str = "grpc"): @@ -6413,7 +6453,7 @@ def test_test_iam_permissions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6461,9 +6501,10 @@ def test_test_iam_permissions_non_empty_request_with_auto_populated_field(): client.test_iam_permissions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.TestIamPermissionsRequest( + request_msg = iam_policy_pb2.TestIamPermissionsRequest( resource="resource_value", ) + assert args[0] == request_msg def test_test_iam_permissions_use_cached_wrapped_rpc(): @@ -6548,9 +6589,15 @@ async def test_test_iam_permissions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.TestIamPermissionsRequest(), + {}, + ], +) async def test_test_iam_permissions_async( - transport: str = "grpc_asyncio", - request_type=iam_policy_pb2.TestIamPermissionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecretManagerServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -6559,7 +6606,7 @@ async def test_test_iam_permissions_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( @@ -6584,11 +6631,6 @@ async def test_test_iam_permissions_async( assert response.permissions == ["permissions_value"] -@pytest.mark.asyncio -async def test_test_iam_permissions_async_from_dict(): - await test_test_iam_permissions_async(request_type=dict) - - def test_test_iam_permissions_field_headers(): client = SecretManagerServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9533,7 +9575,6 @@ def test_list_secrets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListSecretsRequest() - assert args[0] == request_msg @@ -9554,7 +9595,6 @@ def test_create_secret_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateSecretRequest() - assert args[0] == request_msg @@ -9577,7 +9617,6 @@ def test_add_secret_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.AddSecretVersionRequest() - assert args[0] == request_msg @@ -9598,7 +9637,6 @@ def test_get_secret_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetSecretRequest() - assert args[0] == request_msg @@ -9619,7 +9657,6 @@ def test_update_secret_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateSecretRequest() - assert args[0] == request_msg @@ -9640,7 +9677,6 @@ def test_delete_secret_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteSecretRequest() - assert args[0] == request_msg @@ -9663,7 +9699,6 @@ def test_list_secret_versions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListSecretVersionsRequest() - assert args[0] == request_msg @@ -9686,7 +9721,6 @@ def test_get_secret_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetSecretVersionRequest() - assert args[0] == request_msg @@ -9709,7 +9743,6 @@ def test_access_secret_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.AccessSecretVersionRequest() - assert args[0] == request_msg @@ -9732,7 +9765,6 @@ def test_disable_secret_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DisableSecretVersionRequest() - assert args[0] == request_msg @@ -9755,7 +9787,6 @@ def test_enable_secret_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.EnableSecretVersionRequest() - assert args[0] == request_msg @@ -9778,7 +9809,6 @@ def test_destroy_secret_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DestroySecretVersionRequest() - assert args[0] == request_msg @@ -9799,7 +9829,6 @@ def test_set_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -9820,7 +9849,6 @@ def test_get_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -9843,7 +9871,6 @@ def test_test_iam_permissions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -9885,7 +9912,6 @@ async def test_list_secrets_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListSecretsRequest() - assert args[0] == request_msg @@ -9913,7 +9939,6 @@ async def test_create_secret_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateSecretRequest() - assert args[0] == request_msg @@ -9945,7 +9970,6 @@ async def test_add_secret_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.AddSecretVersionRequest() - assert args[0] == request_msg @@ -9973,7 +9997,6 @@ async def test_get_secret_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetSecretRequest() - assert args[0] == request_msg @@ -10001,7 +10024,6 @@ async def test_update_secret_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateSecretRequest() - assert args[0] == request_msg @@ -10024,7 +10046,6 @@ async def test_delete_secret_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteSecretRequest() - assert args[0] == request_msg @@ -10054,7 +10075,6 @@ async def test_list_secret_versions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListSecretVersionsRequest() - assert args[0] == request_msg @@ -10086,7 +10106,6 @@ async def test_get_secret_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetSecretVersionRequest() - assert args[0] == request_msg @@ -10115,7 +10134,6 @@ async def test_access_secret_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.AccessSecretVersionRequest() - assert args[0] == request_msg @@ -10147,7 +10165,6 @@ async def test_disable_secret_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DisableSecretVersionRequest() - assert args[0] == request_msg @@ -10179,7 +10196,6 @@ async def test_enable_secret_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.EnableSecretVersionRequest() - assert args[0] == request_msg @@ -10211,7 +10227,6 @@ async def test_destroy_secret_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DestroySecretVersionRequest() - assert args[0] == request_msg @@ -10239,7 +10254,6 @@ async def test_set_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -10267,7 +10281,6 @@ async def test_get_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -10296,7 +10309,6 @@ async def test_test_iam_permissions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -12603,7 +12615,6 @@ def test_list_secrets_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListSecretsRequest() - assert args[0] == request_msg @@ -12623,7 +12634,6 @@ def test_create_secret_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateSecretRequest() - assert args[0] == request_msg @@ -12645,7 +12655,6 @@ def test_add_secret_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.AddSecretVersionRequest() - assert args[0] == request_msg @@ -12665,7 +12674,6 @@ def test_get_secret_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetSecretRequest() - assert args[0] == request_msg @@ -12685,7 +12693,6 @@ def test_update_secret_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateSecretRequest() - assert args[0] == request_msg @@ -12705,7 +12712,6 @@ def test_delete_secret_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteSecretRequest() - assert args[0] == request_msg @@ -12727,7 +12733,6 @@ def test_list_secret_versions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListSecretVersionsRequest() - assert args[0] == request_msg @@ -12749,7 +12754,6 @@ def test_get_secret_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetSecretVersionRequest() - assert args[0] == request_msg @@ -12771,7 +12775,6 @@ def test_access_secret_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.AccessSecretVersionRequest() - assert args[0] == request_msg @@ -12793,7 +12796,6 @@ def test_disable_secret_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DisableSecretVersionRequest() - assert args[0] == request_msg @@ -12815,7 +12817,6 @@ def test_enable_secret_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.EnableSecretVersionRequest() - assert args[0] == request_msg @@ -12837,7 +12838,6 @@ def test_destroy_secret_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DestroySecretVersionRequest() - assert args[0] == request_msg @@ -12857,7 +12857,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -12877,7 +12876,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -12899,7 +12897,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-securesourcemanager/noxfile.py b/packages/google-cloud-securesourcemanager/noxfile.py index 82e9ac6e2458..1f33a21f0c23 100644 --- a/packages/google-cloud-securesourcemanager/noxfile.py +++ b/packages/google-cloud-securesourcemanager/noxfile.py @@ -47,7 +47,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-securesourcemanager" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-securesourcemanager/setup.py b/packages/google-cloud-securesourcemanager/setup.py index 44825b62eaae..8531b16d46ab 100644 --- a/packages/google-cloud-securesourcemanager/setup.py +++ b/packages/google-cloud-securesourcemanager/setup.py @@ -45,7 +45,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/google-cloud-securesourcemanager/testing/constraints-3.10.txt b/packages/google-cloud-securesourcemanager/testing/constraints-3.10.txt index a92801e1c8e2..b39cd54634f9 100644 --- a/packages/google-cloud-securesourcemanager/testing/constraints-3.10.txt +++ b/packages/google-cloud-securesourcemanager/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/google-cloud-securesourcemanager/tests/unit/gapic/securesourcemanager_v1/test_secure_source_manager.py b/packages/google-cloud-securesourcemanager/tests/unit/gapic/securesourcemanager_v1/test_secure_source_manager.py index 8de6588fc0fc..3faca52052c5 100644 --- a/packages/google-cloud-securesourcemanager/tests/unit/gapic/securesourcemanager_v1/test_secure_source_manager.py +++ b/packages/google-cloud-securesourcemanager/tests/unit/gapic/securesourcemanager_v1/test_secure_source_manager.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 @@ -125,6 +126,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" @@ -1388,8 +1404,8 @@ def test_secure_source_manager_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - secure_source_manager.ListInstancesRequest, - dict, + secure_source_manager.ListInstancesRequest(), + {}, ], ) def test_list_instances(request_type, transport: str = "grpc"): @@ -1400,7 +1416,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(type(client.transport.list_instances), "__call__") as call: @@ -1449,12 +1465,13 @@ 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] == secure_source_manager.ListInstancesRequest( + request_msg = secure_source_manager.ListInstancesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_instances_use_cached_wrapped_rpc(): @@ -1535,10 +1552,14 @@ async def test_list_instances_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_instances_async( - transport: str = "grpc_asyncio", - request_type=secure_source_manager.ListInstancesRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + secure_source_manager.ListInstancesRequest(), + {}, + ], +) +async def test_list_instances_async(request_type, transport: str = "grpc_asyncio"): client = SecureSourceManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1546,7 +1567,7 @@ async def test_list_instances_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_instances), "__call__") as call: @@ -1571,11 +1592,6 @@ async def test_list_instances_async( 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 = SecureSourceManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1912,8 +1928,8 @@ async def test_list_instances_async_pages(): @pytest.mark.parametrize( "request_type", [ - secure_source_manager.GetInstanceRequest, - dict, + secure_source_manager.GetInstanceRequest(), + {}, ], ) def test_get_instance(request_type, transport: str = "grpc"): @@ -1924,7 +1940,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(type(client.transport.get_instance), "__call__") as call: @@ -1977,9 +1993,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] == secure_source_manager.GetInstanceRequest( + request_msg = secure_source_manager.GetInstanceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_instance_use_cached_wrapped_rpc(): @@ -2060,10 +2077,14 @@ async def test_get_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_instance_async( - transport: str = "grpc_asyncio", - request_type=secure_source_manager.GetInstanceRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + secure_source_manager.GetInstanceRequest(), + {}, + ], +) +async def test_get_instance_async(request_type, transport: str = "grpc_asyncio"): client = SecureSourceManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2071,7 +2092,7 @@ async def test_get_instance_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_instance), "__call__") as call: @@ -2103,11 +2124,6 @@ async def test_get_instance_async( assert response.kms_key == "kms_key_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 = SecureSourceManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2254,8 +2270,8 @@ async def test_get_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - secure_source_manager.CreateInstanceRequest, - dict, + secure_source_manager.CreateInstanceRequest(), + {}, ], ) def test_create_instance(request_type, transport: str = "grpc"): @@ -2266,7 +2282,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(type(client.transport.create_instance), "__call__") as call: @@ -2308,10 +2324,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] == secure_source_manager.CreateInstanceRequest( + request_msg = secure_source_manager.CreateInstanceRequest( parent="parent_value", instance_id="instance_id_value", ) + assert args[0] == request_msg def test_create_instance_use_cached_wrapped_rpc(): @@ -2402,10 +2419,14 @@ async def test_create_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_instance_async( - transport: str = "grpc_asyncio", - request_type=secure_source_manager.CreateInstanceRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + secure_source_manager.CreateInstanceRequest(), + {}, + ], +) +async def test_create_instance_async(request_type, transport: str = "grpc_asyncio"): client = SecureSourceManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2413,7 +2434,7 @@ async def test_create_instance_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_instance), "__call__") as call: @@ -2433,11 +2454,6 @@ async def test_create_instance_async( 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 = SecureSourceManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2604,8 +2620,8 @@ async def test_create_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - secure_source_manager.DeleteInstanceRequest, - dict, + secure_source_manager.DeleteInstanceRequest(), + {}, ], ) def test_delete_instance(request_type, transport: str = "grpc"): @@ -2616,7 +2632,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(type(client.transport.delete_instance), "__call__") as call: @@ -2657,9 +2673,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] == secure_source_manager.DeleteInstanceRequest( + request_msg = secure_source_manager.DeleteInstanceRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_instance_use_cached_wrapped_rpc(): @@ -2750,10 +2767,14 @@ async def test_delete_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_instance_async( - transport: str = "grpc_asyncio", - request_type=secure_source_manager.DeleteInstanceRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + secure_source_manager.DeleteInstanceRequest(), + {}, + ], +) +async def test_delete_instance_async(request_type, transport: str = "grpc_asyncio"): client = SecureSourceManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2761,7 +2782,7 @@ async def test_delete_instance_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_instance), "__call__") as call: @@ -2781,11 +2802,6 @@ async def test_delete_instance_async( 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 = SecureSourceManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2932,8 +2948,8 @@ async def test_delete_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - secure_source_manager.ListRepositoriesRequest, - dict, + secure_source_manager.ListRepositoriesRequest(), + {}, ], ) def test_list_repositories(request_type, transport: str = "grpc"): @@ -2944,7 +2960,7 @@ def test_list_repositories(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2995,12 +3011,13 @@ def test_list_repositories_non_empty_request_with_auto_populated_field(): client.list_repositories(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == secure_source_manager.ListRepositoriesRequest( + request_msg = secure_source_manager.ListRepositoriesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", instance="instance_value", ) + assert args[0] == request_msg def test_list_repositories_use_cached_wrapped_rpc(): @@ -3083,10 +3100,14 @@ async def test_list_repositories_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_repositories_async( - transport: str = "grpc_asyncio", - request_type=secure_source_manager.ListRepositoriesRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + secure_source_manager.ListRepositoriesRequest(), + {}, + ], +) +async def test_list_repositories_async(request_type, transport: str = "grpc_asyncio"): client = SecureSourceManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3094,7 +3115,7 @@ async def test_list_repositories_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( @@ -3119,11 +3140,6 @@ async def test_list_repositories_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_repositories_async_from_dict(): - await test_list_repositories_async(request_type=dict) - - def test_list_repositories_field_headers(): client = SecureSourceManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3476,8 +3492,8 @@ async def test_list_repositories_async_pages(): @pytest.mark.parametrize( "request_type", [ - secure_source_manager.GetRepositoryRequest, - dict, + secure_source_manager.GetRepositoryRequest(), + {}, ], ) def test_get_repository(request_type, transport: str = "grpc"): @@ -3488,7 +3504,7 @@ def test_get_repository(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_repository), "__call__") as call: @@ -3540,9 +3556,10 @@ def test_get_repository_non_empty_request_with_auto_populated_field(): client.get_repository(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == secure_source_manager.GetRepositoryRequest( + request_msg = secure_source_manager.GetRepositoryRequest( name="name_value", ) + assert args[0] == request_msg def test_get_repository_use_cached_wrapped_rpc(): @@ -3623,10 +3640,14 @@ async def test_get_repository_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_repository_async( - transport: str = "grpc_asyncio", - request_type=secure_source_manager.GetRepositoryRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + secure_source_manager.GetRepositoryRequest(), + {}, + ], +) +async def test_get_repository_async(request_type, transport: str = "grpc_asyncio"): client = SecureSourceManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3634,7 +3655,7 @@ async def test_get_repository_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_repository), "__call__") as call: @@ -3665,11 +3686,6 @@ async def test_get_repository_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_repository_async_from_dict(): - await test_get_repository_async(request_type=dict) - - def test_get_repository_field_headers(): client = SecureSourceManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3816,8 +3832,8 @@ async def test_get_repository_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - secure_source_manager.CreateRepositoryRequest, - dict, + secure_source_manager.CreateRepositoryRequest(), + {}, ], ) def test_create_repository(request_type, transport: str = "grpc"): @@ -3828,7 +3844,7 @@ def test_create_repository(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3874,10 +3890,11 @@ def test_create_repository_non_empty_request_with_auto_populated_field(): client.create_repository(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == secure_source_manager.CreateRepositoryRequest( + request_msg = secure_source_manager.CreateRepositoryRequest( parent="parent_value", repository_id="repository_id_value", ) + assert args[0] == request_msg def test_create_repository_use_cached_wrapped_rpc(): @@ -3970,10 +3987,14 @@ async def test_create_repository_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_repository_async( - transport: str = "grpc_asyncio", - request_type=secure_source_manager.CreateRepositoryRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + secure_source_manager.CreateRepositoryRequest(), + {}, + ], +) +async def test_create_repository_async(request_type, transport: str = "grpc_asyncio"): client = SecureSourceManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3981,7 +4002,7 @@ async def test_create_repository_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( @@ -4003,11 +4024,6 @@ async def test_create_repository_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_repository_async_from_dict(): - await test_create_repository_async(request_type=dict) - - def test_create_repository_field_headers(): client = SecureSourceManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4182,8 +4198,8 @@ async def test_create_repository_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - secure_source_manager.UpdateRepositoryRequest, - dict, + secure_source_manager.UpdateRepositoryRequest(), + {}, ], ) def test_update_repository(request_type, transport: str = "grpc"): @@ -4194,7 +4210,7 @@ def test_update_repository(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4237,7 +4253,8 @@ def test_update_repository_non_empty_request_with_auto_populated_field(): client.update_repository(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == secure_source_manager.UpdateRepositoryRequest() + request_msg = secure_source_manager.UpdateRepositoryRequest() + assert args[0] == request_msg def test_update_repository_use_cached_wrapped_rpc(): @@ -4330,10 +4347,14 @@ async def test_update_repository_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_repository_async( - transport: str = "grpc_asyncio", - request_type=secure_source_manager.UpdateRepositoryRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + secure_source_manager.UpdateRepositoryRequest(), + {}, + ], +) +async def test_update_repository_async(request_type, transport: str = "grpc_asyncio"): client = SecureSourceManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4341,7 +4362,7 @@ async def test_update_repository_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( @@ -4363,11 +4384,6 @@ async def test_update_repository_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_repository_async_from_dict(): - await test_update_repository_async(request_type=dict) - - def test_update_repository_field_headers(): client = SecureSourceManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4532,8 +4548,8 @@ async def test_update_repository_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - secure_source_manager.DeleteRepositoryRequest, - dict, + secure_source_manager.DeleteRepositoryRequest(), + {}, ], ) def test_delete_repository(request_type, transport: str = "grpc"): @@ -4544,7 +4560,7 @@ def test_delete_repository(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4589,9 +4605,10 @@ def test_delete_repository_non_empty_request_with_auto_populated_field(): client.delete_repository(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == secure_source_manager.DeleteRepositoryRequest( + request_msg = secure_source_manager.DeleteRepositoryRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_repository_use_cached_wrapped_rpc(): @@ -4684,10 +4701,14 @@ async def test_delete_repository_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_repository_async( - transport: str = "grpc_asyncio", - request_type=secure_source_manager.DeleteRepositoryRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + secure_source_manager.DeleteRepositoryRequest(), + {}, + ], +) +async def test_delete_repository_async(request_type, transport: str = "grpc_asyncio"): client = SecureSourceManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4695,7 +4716,7 @@ async def test_delete_repository_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( @@ -4717,11 +4738,6 @@ async def test_delete_repository_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_repository_async_from_dict(): - await test_delete_repository_async(request_type=dict) - - def test_delete_repository_field_headers(): client = SecureSourceManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4876,8 +4892,8 @@ async def test_delete_repository_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - secure_source_manager.ListHooksRequest, - dict, + secure_source_manager.ListHooksRequest(), + {}, ], ) def test_list_hooks(request_type, transport: str = "grpc"): @@ -4888,7 +4904,7 @@ def test_list_hooks(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_hooks), "__call__") as call: @@ -4933,10 +4949,11 @@ def test_list_hooks_non_empty_request_with_auto_populated_field(): client.list_hooks(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == secure_source_manager.ListHooksRequest( + request_msg = secure_source_manager.ListHooksRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_hooks_use_cached_wrapped_rpc(): @@ -5015,9 +5032,14 @@ async def test_list_hooks_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_list_hooks_async( - transport: str = "grpc_asyncio", request_type=secure_source_manager.ListHooksRequest -): +@pytest.mark.parametrize( + "request_type", + [ + secure_source_manager.ListHooksRequest(), + {}, + ], +) +async def test_list_hooks_async(request_type, transport: str = "grpc_asyncio"): client = SecureSourceManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5025,7 +5047,7 @@ async def test_list_hooks_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_hooks), "__call__") as call: @@ -5048,11 +5070,6 @@ async def test_list_hooks_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_hooks_async_from_dict(): - await test_list_hooks_async(request_type=dict) - - def test_list_hooks_field_headers(): client = SecureSourceManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5389,8 +5406,8 @@ async def test_list_hooks_async_pages(): @pytest.mark.parametrize( "request_type", [ - secure_source_manager.GetHookRequest, - dict, + secure_source_manager.GetHookRequest(), + {}, ], ) def test_get_hook(request_type, transport: str = "grpc"): @@ -5401,7 +5418,7 @@ def test_get_hook(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_hook), "__call__") as call: @@ -5455,9 +5472,10 @@ def test_get_hook_non_empty_request_with_auto_populated_field(): client.get_hook(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == secure_source_manager.GetHookRequest( + request_msg = secure_source_manager.GetHookRequest( name="name_value", ) + assert args[0] == request_msg def test_get_hook_use_cached_wrapped_rpc(): @@ -5536,9 +5554,14 @@ async def test_get_hook_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn @pytest.mark.asyncio -async def test_get_hook_async( - transport: str = "grpc_asyncio", request_type=secure_source_manager.GetHookRequest -): +@pytest.mark.parametrize( + "request_type", + [ + secure_source_manager.GetHookRequest(), + {}, + ], +) +async def test_get_hook_async(request_type, transport: str = "grpc_asyncio"): client = SecureSourceManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5546,7 +5569,7 @@ async def test_get_hook_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_hook), "__call__") as call: @@ -5579,11 +5602,6 @@ async def test_get_hook_async( assert response.sensitive_query_string == "sensitive_query_string_value" -@pytest.mark.asyncio -async def test_get_hook_async_from_dict(): - await test_get_hook_async(request_type=dict) - - def test_get_hook_field_headers(): client = SecureSourceManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5730,8 +5748,8 @@ async def test_get_hook_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - secure_source_manager.CreateHookRequest, - dict, + secure_source_manager.CreateHookRequest(), + {}, ], ) def test_create_hook(request_type, transport: str = "grpc"): @@ -5742,7 +5760,7 @@ def test_create_hook(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_hook), "__call__") as call: @@ -5784,10 +5802,11 @@ def test_create_hook_non_empty_request_with_auto_populated_field(): client.create_hook(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == secure_source_manager.CreateHookRequest( + request_msg = secure_source_manager.CreateHookRequest( parent="parent_value", hook_id="hook_id_value", ) + assert args[0] == request_msg def test_create_hook_use_cached_wrapped_rpc(): @@ -5878,10 +5897,14 @@ async def test_create_hook_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_hook_async( - transport: str = "grpc_asyncio", - request_type=secure_source_manager.CreateHookRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + secure_source_manager.CreateHookRequest(), + {}, + ], +) +async def test_create_hook_async(request_type, transport: str = "grpc_asyncio"): client = SecureSourceManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5889,7 +5912,7 @@ async def test_create_hook_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_hook), "__call__") as call: @@ -5909,11 +5932,6 @@ async def test_create_hook_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_hook_async_from_dict(): - await test_create_hook_async(request_type=dict) - - def test_create_hook_field_headers(): client = SecureSourceManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6080,8 +6098,8 @@ async def test_create_hook_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - secure_source_manager.UpdateHookRequest, - dict, + secure_source_manager.UpdateHookRequest(), + {}, ], ) def test_update_hook(request_type, transport: str = "grpc"): @@ -6092,7 +6110,7 @@ def test_update_hook(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_hook), "__call__") as call: @@ -6131,7 +6149,8 @@ def test_update_hook_non_empty_request_with_auto_populated_field(): client.update_hook(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == secure_source_manager.UpdateHookRequest() + request_msg = secure_source_manager.UpdateHookRequest() + assert args[0] == request_msg def test_update_hook_use_cached_wrapped_rpc(): @@ -6222,10 +6241,14 @@ async def test_update_hook_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_hook_async( - transport: str = "grpc_asyncio", - request_type=secure_source_manager.UpdateHookRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + secure_source_manager.UpdateHookRequest(), + {}, + ], +) +async def test_update_hook_async(request_type, transport: str = "grpc_asyncio"): client = SecureSourceManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6233,7 +6256,7 @@ async def test_update_hook_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_hook), "__call__") as call: @@ -6253,11 +6276,6 @@ async def test_update_hook_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_hook_async_from_dict(): - await test_update_hook_async(request_type=dict) - - def test_update_hook_field_headers(): client = SecureSourceManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6414,8 +6432,8 @@ async def test_update_hook_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - secure_source_manager.DeleteHookRequest, - dict, + secure_source_manager.DeleteHookRequest(), + {}, ], ) def test_delete_hook(request_type, transport: str = "grpc"): @@ -6426,7 +6444,7 @@ def test_delete_hook(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_hook), "__call__") as call: @@ -6467,9 +6485,10 @@ def test_delete_hook_non_empty_request_with_auto_populated_field(): client.delete_hook(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == secure_source_manager.DeleteHookRequest( + request_msg = secure_source_manager.DeleteHookRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_hook_use_cached_wrapped_rpc(): @@ -6560,10 +6579,14 @@ async def test_delete_hook_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_hook_async( - transport: str = "grpc_asyncio", - request_type=secure_source_manager.DeleteHookRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + secure_source_manager.DeleteHookRequest(), + {}, + ], +) +async def test_delete_hook_async(request_type, transport: str = "grpc_asyncio"): client = SecureSourceManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6571,7 +6594,7 @@ async def test_delete_hook_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_hook), "__call__") as call: @@ -6591,11 +6614,6 @@ async def test_delete_hook_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_hook_async_from_dict(): - await test_delete_hook_async(request_type=dict) - - def test_delete_hook_field_headers(): client = SecureSourceManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6742,8 +6760,8 @@ async def test_delete_hook_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.GetIamPolicyRequest, - dict, + iam_policy_pb2.GetIamPolicyRequest(), + {}, ], ) def test_get_iam_policy_repo(request_type, transport: str = "grpc"): @@ -6754,7 +6772,7 @@ def test_get_iam_policy_repo(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6804,9 +6822,10 @@ def test_get_iam_policy_repo_non_empty_request_with_auto_populated_field(): client.get_iam_policy_repo(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.GetIamPolicyRequest( + request_msg = iam_policy_pb2.GetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_get_iam_policy_repo_use_cached_wrapped_rpc(): @@ -6891,9 +6910,14 @@ async def test_get_iam_policy_repo_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_iam_policy_repo_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.GetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.GetIamPolicyRequest(), + {}, + ], +) +async def test_get_iam_policy_repo_async(request_type, transport: str = "grpc_asyncio"): client = SecureSourceManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6901,7 +6925,7 @@ async def test_get_iam_policy_repo_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( @@ -6928,11 +6952,6 @@ async def test_get_iam_policy_repo_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_get_iam_policy_repo_async_from_dict(): - await test_get_iam_policy_repo_async(request_type=dict) - - def test_get_iam_policy_repo_field_headers(): client = SecureSourceManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7102,8 +7121,8 @@ async def test_get_iam_policy_repo_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.SetIamPolicyRequest, - dict, + iam_policy_pb2.SetIamPolicyRequest(), + {}, ], ) def test_set_iam_policy_repo(request_type, transport: str = "grpc"): @@ -7114,7 +7133,7 @@ def test_set_iam_policy_repo(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7164,9 +7183,10 @@ def test_set_iam_policy_repo_non_empty_request_with_auto_populated_field(): client.set_iam_policy_repo(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.SetIamPolicyRequest( + request_msg = iam_policy_pb2.SetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_set_iam_policy_repo_use_cached_wrapped_rpc(): @@ -7251,9 +7271,14 @@ async def test_set_iam_policy_repo_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_iam_policy_repo_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.SetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.SetIamPolicyRequest(), + {}, + ], +) +async def test_set_iam_policy_repo_async(request_type, transport: str = "grpc_asyncio"): client = SecureSourceManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7261,7 +7286,7 @@ async def test_set_iam_policy_repo_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( @@ -7288,11 +7313,6 @@ async def test_set_iam_policy_repo_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_set_iam_policy_repo_async_from_dict(): - await test_set_iam_policy_repo_async(request_type=dict) - - def test_set_iam_policy_repo_field_headers(): client = SecureSourceManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7463,8 +7483,8 @@ async def test_set_iam_policy_repo_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.TestIamPermissionsRequest, - dict, + iam_policy_pb2.TestIamPermissionsRequest(), + {}, ], ) def test_test_iam_permissions_repo(request_type, transport: str = "grpc"): @@ -7475,7 +7495,7 @@ def test_test_iam_permissions_repo(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7523,9 +7543,10 @@ def test_test_iam_permissions_repo_non_empty_request_with_auto_populated_field() client.test_iam_permissions_repo(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.TestIamPermissionsRequest( + request_msg = iam_policy_pb2.TestIamPermissionsRequest( resource="resource_value", ) + assert args[0] == request_msg def test_test_iam_permissions_repo_use_cached_wrapped_rpc(): @@ -7611,9 +7632,15 @@ async def test_test_iam_permissions_repo_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.TestIamPermissionsRequest(), + {}, + ], +) async def test_test_iam_permissions_repo_async( - transport: str = "grpc_asyncio", - request_type=iam_policy_pb2.TestIamPermissionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecureSourceManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -7622,7 +7649,7 @@ async def test_test_iam_permissions_repo_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( @@ -7647,11 +7674,6 @@ async def test_test_iam_permissions_repo_async( assert response.permissions == ["permissions_value"] -@pytest.mark.asyncio -async def test_test_iam_permissions_repo_async_from_dict(): - await test_test_iam_permissions_repo_async(request_type=dict) - - def test_test_iam_permissions_repo_field_headers(): client = SecureSourceManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7825,8 +7847,8 @@ async def test_test_iam_permissions_repo_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - secure_source_manager.CreateBranchRuleRequest, - dict, + secure_source_manager.CreateBranchRuleRequest(), + {}, ], ) def test_create_branch_rule(request_type, transport: str = "grpc"): @@ -7837,7 +7859,7 @@ def test_create_branch_rule(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7883,10 +7905,11 @@ def test_create_branch_rule_non_empty_request_with_auto_populated_field(): client.create_branch_rule(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == secure_source_manager.CreateBranchRuleRequest( + request_msg = secure_source_manager.CreateBranchRuleRequest( parent="parent_value", branch_rule_id="branch_rule_id_value", ) + assert args[0] == request_msg def test_create_branch_rule_use_cached_wrapped_rpc(): @@ -7981,10 +8004,14 @@ async def test_create_branch_rule_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_branch_rule_async( - transport: str = "grpc_asyncio", - request_type=secure_source_manager.CreateBranchRuleRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + secure_source_manager.CreateBranchRuleRequest(), + {}, + ], +) +async def test_create_branch_rule_async(request_type, transport: str = "grpc_asyncio"): client = SecureSourceManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7992,7 +8019,7 @@ async def test_create_branch_rule_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( @@ -8014,11 +8041,6 @@ async def test_create_branch_rule_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_branch_rule_async_from_dict(): - await test_create_branch_rule_async(request_type=dict) - - def test_create_branch_rule_field_headers(): client = SecureSourceManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8193,8 +8215,8 @@ async def test_create_branch_rule_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - secure_source_manager.ListBranchRulesRequest, - dict, + secure_source_manager.ListBranchRulesRequest(), + {}, ], ) def test_list_branch_rules(request_type, transport: str = "grpc"): @@ -8205,7 +8227,7 @@ def test_list_branch_rules(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8254,10 +8276,11 @@ def test_list_branch_rules_non_empty_request_with_auto_populated_field(): client.list_branch_rules(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == secure_source_manager.ListBranchRulesRequest( + request_msg = secure_source_manager.ListBranchRulesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_branch_rules_use_cached_wrapped_rpc(): @@ -8340,10 +8363,14 @@ async def test_list_branch_rules_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_branch_rules_async( - transport: str = "grpc_asyncio", - request_type=secure_source_manager.ListBranchRulesRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + secure_source_manager.ListBranchRulesRequest(), + {}, + ], +) +async def test_list_branch_rules_async(request_type, transport: str = "grpc_asyncio"): client = SecureSourceManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8351,7 +8378,7 @@ async def test_list_branch_rules_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( @@ -8376,11 +8403,6 @@ async def test_list_branch_rules_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_branch_rules_async_from_dict(): - await test_list_branch_rules_async(request_type=dict) - - def test_list_branch_rules_field_headers(): client = SecureSourceManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8733,8 +8755,8 @@ async def test_list_branch_rules_async_pages(): @pytest.mark.parametrize( "request_type", [ - secure_source_manager.GetBranchRuleRequest, - dict, + secure_source_manager.GetBranchRuleRequest(), + {}, ], ) def test_get_branch_rule(request_type, transport: str = "grpc"): @@ -8745,7 +8767,7 @@ def test_get_branch_rule(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_branch_rule), "__call__") as call: @@ -8811,9 +8833,10 @@ def test_get_branch_rule_non_empty_request_with_auto_populated_field(): client.get_branch_rule(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == secure_source_manager.GetBranchRuleRequest( + request_msg = secure_source_manager.GetBranchRuleRequest( name="name_value", ) + assert args[0] == request_msg def test_get_branch_rule_use_cached_wrapped_rpc(): @@ -8894,10 +8917,14 @@ async def test_get_branch_rule_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_branch_rule_async( - transport: str = "grpc_asyncio", - request_type=secure_source_manager.GetBranchRuleRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + secure_source_manager.GetBranchRuleRequest(), + {}, + ], +) +async def test_get_branch_rule_async(request_type, transport: str = "grpc_asyncio"): client = SecureSourceManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8905,7 +8932,7 @@ async def test_get_branch_rule_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_branch_rule), "__call__") as call: @@ -8950,11 +8977,6 @@ async def test_get_branch_rule_async( assert response.require_linear_history is True -@pytest.mark.asyncio -async def test_get_branch_rule_async_from_dict(): - await test_get_branch_rule_async(request_type=dict) - - def test_get_branch_rule_field_headers(): client = SecureSourceManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9101,8 +9123,8 @@ async def test_get_branch_rule_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - secure_source_manager.UpdateBranchRuleRequest, - dict, + secure_source_manager.UpdateBranchRuleRequest(), + {}, ], ) def test_update_branch_rule(request_type, transport: str = "grpc"): @@ -9113,7 +9135,7 @@ def test_update_branch_rule(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9156,7 +9178,8 @@ def test_update_branch_rule_non_empty_request_with_auto_populated_field(): client.update_branch_rule(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == secure_source_manager.UpdateBranchRuleRequest() + request_msg = secure_source_manager.UpdateBranchRuleRequest() + assert args[0] == request_msg def test_update_branch_rule_use_cached_wrapped_rpc(): @@ -9251,10 +9274,14 @@ async def test_update_branch_rule_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_branch_rule_async( - transport: str = "grpc_asyncio", - request_type=secure_source_manager.UpdateBranchRuleRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + secure_source_manager.UpdateBranchRuleRequest(), + {}, + ], +) +async def test_update_branch_rule_async(request_type, transport: str = "grpc_asyncio"): client = SecureSourceManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9262,7 +9289,7 @@ async def test_update_branch_rule_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( @@ -9284,11 +9311,6 @@ async def test_update_branch_rule_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_branch_rule_async_from_dict(): - await test_update_branch_rule_async(request_type=dict) - - def test_update_branch_rule_field_headers(): client = SecureSourceManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9453,8 +9475,8 @@ async def test_update_branch_rule_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - secure_source_manager.DeleteBranchRuleRequest, - dict, + secure_source_manager.DeleteBranchRuleRequest(), + {}, ], ) def test_delete_branch_rule(request_type, transport: str = "grpc"): @@ -9465,7 +9487,7 @@ def test_delete_branch_rule(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,9 +9532,10 @@ def test_delete_branch_rule_non_empty_request_with_auto_populated_field(): client.delete_branch_rule(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == secure_source_manager.DeleteBranchRuleRequest( + request_msg = secure_source_manager.DeleteBranchRuleRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_branch_rule_use_cached_wrapped_rpc(): @@ -9607,10 +9630,14 @@ async def test_delete_branch_rule_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_branch_rule_async( - transport: str = "grpc_asyncio", - request_type=secure_source_manager.DeleteBranchRuleRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + secure_source_manager.DeleteBranchRuleRequest(), + {}, + ], +) +async def test_delete_branch_rule_async(request_type, transport: str = "grpc_asyncio"): client = SecureSourceManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9618,7 +9645,7 @@ async def test_delete_branch_rule_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( @@ -9640,11 +9667,6 @@ async def test_delete_branch_rule_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_branch_rule_async_from_dict(): - await test_delete_branch_rule_async(request_type=dict) - - def test_delete_branch_rule_field_headers(): client = SecureSourceManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9799,8 +9821,8 @@ async def test_delete_branch_rule_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - secure_source_manager.CreatePullRequestRequest, - dict, + secure_source_manager.CreatePullRequestRequest(), + {}, ], ) def test_create_pull_request(request_type, transport: str = "grpc"): @@ -9811,7 +9833,7 @@ def test_create_pull_request(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9856,9 +9878,10 @@ def test_create_pull_request_non_empty_request_with_auto_populated_field(): client.create_pull_request(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == secure_source_manager.CreatePullRequestRequest( + request_msg = secure_source_manager.CreatePullRequestRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_pull_request_use_cached_wrapped_rpc(): @@ -9953,10 +9976,14 @@ async def test_create_pull_request_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_pull_request_async( - transport: str = "grpc_asyncio", - request_type=secure_source_manager.CreatePullRequestRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + secure_source_manager.CreatePullRequestRequest(), + {}, + ], +) +async def test_create_pull_request_async(request_type, transport: str = "grpc_asyncio"): client = SecureSourceManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9964,7 +9991,7 @@ async def test_create_pull_request_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( @@ -9986,11 +10013,6 @@ async def test_create_pull_request_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_pull_request_async_from_dict(): - await test_create_pull_request_async(request_type=dict) - - def test_create_pull_request_field_headers(): client = SecureSourceManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10155,8 +10177,8 @@ async def test_create_pull_request_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - secure_source_manager.GetPullRequestRequest, - dict, + secure_source_manager.GetPullRequestRequest(), + {}, ], ) def test_get_pull_request(request_type, transport: str = "grpc"): @@ -10167,7 +10189,7 @@ def test_get_pull_request(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_pull_request), "__call__") as call: @@ -10217,9 +10239,10 @@ def test_get_pull_request_non_empty_request_with_auto_populated_field(): client.get_pull_request(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == secure_source_manager.GetPullRequestRequest( + request_msg = secure_source_manager.GetPullRequestRequest( name="name_value", ) + assert args[0] == request_msg def test_get_pull_request_use_cached_wrapped_rpc(): @@ -10302,10 +10325,14 @@ async def test_get_pull_request_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_pull_request_async( - transport: str = "grpc_asyncio", - request_type=secure_source_manager.GetPullRequestRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + secure_source_manager.GetPullRequestRequest(), + {}, + ], +) +async def test_get_pull_request_async(request_type, transport: str = "grpc_asyncio"): client = SecureSourceManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10313,7 +10340,7 @@ async def test_get_pull_request_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_pull_request), "__call__") as call: @@ -10342,11 +10369,6 @@ async def test_get_pull_request_async( assert response.state == secure_source_manager.PullRequest.State.OPEN -@pytest.mark.asyncio -async def test_get_pull_request_async_from_dict(): - await test_get_pull_request_async(request_type=dict) - - def test_get_pull_request_field_headers(): client = SecureSourceManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10493,8 +10515,8 @@ async def test_get_pull_request_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - secure_source_manager.ListPullRequestsRequest, - dict, + secure_source_manager.ListPullRequestsRequest(), + {}, ], ) def test_list_pull_requests(request_type, transport: str = "grpc"): @@ -10505,7 +10527,7 @@ def test_list_pull_requests(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10554,10 +10576,11 @@ def test_list_pull_requests_non_empty_request_with_auto_populated_field(): client.list_pull_requests(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == secure_source_manager.ListPullRequestsRequest( + request_msg = secure_source_manager.ListPullRequestsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_pull_requests_use_cached_wrapped_rpc(): @@ -10642,10 +10665,14 @@ async def test_list_pull_requests_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_pull_requests_async( - transport: str = "grpc_asyncio", - request_type=secure_source_manager.ListPullRequestsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + secure_source_manager.ListPullRequestsRequest(), + {}, + ], +) +async def test_list_pull_requests_async(request_type, transport: str = "grpc_asyncio"): client = SecureSourceManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10653,7 +10680,7 @@ async def test_list_pull_requests_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( @@ -10678,11 +10705,6 @@ async def test_list_pull_requests_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_pull_requests_async_from_dict(): - await test_list_pull_requests_async(request_type=dict) - - def test_list_pull_requests_field_headers(): client = SecureSourceManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11035,8 +11057,8 @@ async def test_list_pull_requests_async_pages(): @pytest.mark.parametrize( "request_type", [ - secure_source_manager.UpdatePullRequestRequest, - dict, + secure_source_manager.UpdatePullRequestRequest(), + {}, ], ) def test_update_pull_request(request_type, transport: str = "grpc"): @@ -11047,7 +11069,7 @@ def test_update_pull_request(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11090,7 +11112,8 @@ def test_update_pull_request_non_empty_request_with_auto_populated_field(): client.update_pull_request(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == secure_source_manager.UpdatePullRequestRequest() + request_msg = secure_source_manager.UpdatePullRequestRequest() + assert args[0] == request_msg def test_update_pull_request_use_cached_wrapped_rpc(): @@ -11185,10 +11208,14 @@ async def test_update_pull_request_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_pull_request_async( - transport: str = "grpc_asyncio", - request_type=secure_source_manager.UpdatePullRequestRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + secure_source_manager.UpdatePullRequestRequest(), + {}, + ], +) +async def test_update_pull_request_async(request_type, transport: str = "grpc_asyncio"): client = SecureSourceManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11196,7 +11223,7 @@ async def test_update_pull_request_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( @@ -11218,11 +11245,6 @@ async def test_update_pull_request_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_pull_request_async_from_dict(): - await test_update_pull_request_async(request_type=dict) - - def test_update_pull_request_field_headers(): client = SecureSourceManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11387,8 +11409,8 @@ async def test_update_pull_request_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - secure_source_manager.MergePullRequestRequest, - dict, + secure_source_manager.MergePullRequestRequest(), + {}, ], ) def test_merge_pull_request(request_type, transport: str = "grpc"): @@ -11399,7 +11421,7 @@ def test_merge_pull_request(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11444,9 +11466,10 @@ def test_merge_pull_request_non_empty_request_with_auto_populated_field(): client.merge_pull_request(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == secure_source_manager.MergePullRequestRequest( + request_msg = secure_source_manager.MergePullRequestRequest( name="name_value", ) + assert args[0] == request_msg def test_merge_pull_request_use_cached_wrapped_rpc(): @@ -11541,10 +11564,14 @@ async def test_merge_pull_request_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_merge_pull_request_async( - transport: str = "grpc_asyncio", - request_type=secure_source_manager.MergePullRequestRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + secure_source_manager.MergePullRequestRequest(), + {}, + ], +) +async def test_merge_pull_request_async(request_type, transport: str = "grpc_asyncio"): client = SecureSourceManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11552,7 +11579,7 @@ async def test_merge_pull_request_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( @@ -11574,11 +11601,6 @@ async def test_merge_pull_request_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_merge_pull_request_async_from_dict(): - await test_merge_pull_request_async(request_type=dict) - - def test_merge_pull_request_field_headers(): client = SecureSourceManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11733,8 +11755,8 @@ async def test_merge_pull_request_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - secure_source_manager.OpenPullRequestRequest, - dict, + secure_source_manager.OpenPullRequestRequest(), + {}, ], ) def test_open_pull_request(request_type, transport: str = "grpc"): @@ -11745,7 +11767,7 @@ def test_open_pull_request(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11790,9 +11812,10 @@ def test_open_pull_request_non_empty_request_with_auto_populated_field(): client.open_pull_request(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == secure_source_manager.OpenPullRequestRequest( + request_msg = secure_source_manager.OpenPullRequestRequest( name="name_value", ) + assert args[0] == request_msg def test_open_pull_request_use_cached_wrapped_rpc(): @@ -11885,10 +11908,14 @@ async def test_open_pull_request_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_open_pull_request_async( - transport: str = "grpc_asyncio", - request_type=secure_source_manager.OpenPullRequestRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + secure_source_manager.OpenPullRequestRequest(), + {}, + ], +) +async def test_open_pull_request_async(request_type, transport: str = "grpc_asyncio"): client = SecureSourceManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11896,7 +11923,7 @@ async def test_open_pull_request_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( @@ -11918,11 +11945,6 @@ async def test_open_pull_request_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_open_pull_request_async_from_dict(): - await test_open_pull_request_async(request_type=dict) - - def test_open_pull_request_field_headers(): client = SecureSourceManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12077,8 +12099,8 @@ async def test_open_pull_request_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - secure_source_manager.ClosePullRequestRequest, - dict, + secure_source_manager.ClosePullRequestRequest(), + {}, ], ) def test_close_pull_request(request_type, transport: str = "grpc"): @@ -12089,7 +12111,7 @@ def test_close_pull_request(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -12134,9 +12156,10 @@ def test_close_pull_request_non_empty_request_with_auto_populated_field(): client.close_pull_request(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == secure_source_manager.ClosePullRequestRequest( + request_msg = secure_source_manager.ClosePullRequestRequest( name="name_value", ) + assert args[0] == request_msg def test_close_pull_request_use_cached_wrapped_rpc(): @@ -12231,10 +12254,14 @@ async def test_close_pull_request_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_close_pull_request_async( - transport: str = "grpc_asyncio", - request_type=secure_source_manager.ClosePullRequestRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + secure_source_manager.ClosePullRequestRequest(), + {}, + ], +) +async def test_close_pull_request_async(request_type, transport: str = "grpc_asyncio"): client = SecureSourceManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12242,7 +12269,7 @@ async def test_close_pull_request_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( @@ -12264,11 +12291,6 @@ async def test_close_pull_request_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_close_pull_request_async_from_dict(): - await test_close_pull_request_async(request_type=dict) - - def test_close_pull_request_field_headers(): client = SecureSourceManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12423,8 +12445,8 @@ async def test_close_pull_request_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - secure_source_manager.ListPullRequestFileDiffsRequest, - dict, + secure_source_manager.ListPullRequestFileDiffsRequest(), + {}, ], ) def test_list_pull_request_file_diffs(request_type, transport: str = "grpc"): @@ -12435,7 +12457,7 @@ def test_list_pull_request_file_diffs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -12484,10 +12506,11 @@ def test_list_pull_request_file_diffs_non_empty_request_with_auto_populated_fiel client.list_pull_request_file_diffs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == secure_source_manager.ListPullRequestFileDiffsRequest( + request_msg = secure_source_manager.ListPullRequestFileDiffsRequest( name="name_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_pull_request_file_diffs_use_cached_wrapped_rpc(): @@ -12573,9 +12596,15 @@ async def test_list_pull_request_file_diffs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + secure_source_manager.ListPullRequestFileDiffsRequest(), + {}, + ], +) async def test_list_pull_request_file_diffs_async( - transport: str = "grpc_asyncio", - request_type=secure_source_manager.ListPullRequestFileDiffsRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecureSourceManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -12584,7 +12613,7 @@ async def test_list_pull_request_file_diffs_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( @@ -12609,11 +12638,6 @@ async def test_list_pull_request_file_diffs_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_pull_request_file_diffs_async_from_dict(): - await test_list_pull_request_file_diffs_async(request_type=dict) - - def test_list_pull_request_file_diffs_field_headers(): client = SecureSourceManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12970,8 +12994,8 @@ async def test_list_pull_request_file_diffs_async_pages(): @pytest.mark.parametrize( "request_type", [ - secure_source_manager.FetchTreeRequest, - dict, + secure_source_manager.FetchTreeRequest(), + {}, ], ) def test_fetch_tree(request_type, transport: str = "grpc"): @@ -12982,7 +13006,7 @@ def test_fetch_tree(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.fetch_tree), "__call__") as call: @@ -13028,11 +13052,12 @@ def test_fetch_tree_non_empty_request_with_auto_populated_field(): client.fetch_tree(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == secure_source_manager.FetchTreeRequest( + request_msg = secure_source_manager.FetchTreeRequest( repository="repository_value", ref="ref_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_fetch_tree_use_cached_wrapped_rpc(): @@ -13111,9 +13136,14 @@ async def test_fetch_tree_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_fetch_tree_async( - transport: str = "grpc_asyncio", request_type=secure_source_manager.FetchTreeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + secure_source_manager.FetchTreeRequest(), + {}, + ], +) +async def test_fetch_tree_async(request_type, transport: str = "grpc_asyncio"): client = SecureSourceManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13121,7 +13151,7 @@ async def test_fetch_tree_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.fetch_tree), "__call__") as call: @@ -13144,11 +13174,6 @@ async def test_fetch_tree_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_fetch_tree_async_from_dict(): - await test_fetch_tree_async(request_type=dict) - - def test_fetch_tree_field_headers(): client = SecureSourceManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13403,8 +13428,8 @@ async def test_fetch_tree_async_pages(): @pytest.mark.parametrize( "request_type", [ - secure_source_manager.FetchBlobRequest, - dict, + secure_source_manager.FetchBlobRequest(), + {}, ], ) def test_fetch_blob(request_type, transport: str = "grpc"): @@ -13415,7 +13440,7 @@ def test_fetch_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(type(client.transport.fetch_blob), "__call__") as call: @@ -13462,10 +13487,11 @@ def test_fetch_blob_non_empty_request_with_auto_populated_field(): client.fetch_blob(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == secure_source_manager.FetchBlobRequest( + request_msg = secure_source_manager.FetchBlobRequest( repository="repository_value", sha="sha_value", ) + assert args[0] == request_msg def test_fetch_blob_use_cached_wrapped_rpc(): @@ -13544,9 +13570,14 @@ async def test_fetch_blob_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_fetch_blob_async( - transport: str = "grpc_asyncio", request_type=secure_source_manager.FetchBlobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + secure_source_manager.FetchBlobRequest(), + {}, + ], +) +async def test_fetch_blob_async(request_type, transport: str = "grpc_asyncio"): client = SecureSourceManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13554,7 +13585,7 @@ async def test_fetch_blob_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.fetch_blob), "__call__") as call: @@ -13579,11 +13610,6 @@ async def test_fetch_blob_async( assert response.content == "content_value" -@pytest.mark.asyncio -async def test_fetch_blob_async_from_dict(): - await test_fetch_blob_async(request_type=dict) - - def test_fetch_blob_field_headers(): client = SecureSourceManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13648,8 +13674,8 @@ async def test_fetch_blob_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - secure_source_manager.CreateIssueRequest, - dict, + secure_source_manager.CreateIssueRequest(), + {}, ], ) def test_create_issue(request_type, transport: str = "grpc"): @@ -13660,7 +13686,7 @@ def test_create_issue(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_issue), "__call__") as call: @@ -13701,9 +13727,10 @@ def test_create_issue_non_empty_request_with_auto_populated_field(): client.create_issue(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == secure_source_manager.CreateIssueRequest( + request_msg = secure_source_manager.CreateIssueRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_issue_use_cached_wrapped_rpc(): @@ -13794,10 +13821,14 @@ async def test_create_issue_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_issue_async( - transport: str = "grpc_asyncio", - request_type=secure_source_manager.CreateIssueRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + secure_source_manager.CreateIssueRequest(), + {}, + ], +) +async def test_create_issue_async(request_type, transport: str = "grpc_asyncio"): client = SecureSourceManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13805,7 +13836,7 @@ async def test_create_issue_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_issue), "__call__") as call: @@ -13825,11 +13856,6 @@ async def test_create_issue_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_issue_async_from_dict(): - await test_create_issue_async(request_type=dict) - - def test_create_issue_field_headers(): client = SecureSourceManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13986,8 +14012,8 @@ async def test_create_issue_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - secure_source_manager.GetIssueRequest, - dict, + secure_source_manager.GetIssueRequest(), + {}, ], ) def test_get_issue(request_type, transport: str = "grpc"): @@ -13998,7 +14024,7 @@ def test_get_issue(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_issue), "__call__") as call: @@ -14050,9 +14076,10 @@ def test_get_issue_non_empty_request_with_auto_populated_field(): client.get_issue(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == secure_source_manager.GetIssueRequest( + request_msg = secure_source_manager.GetIssueRequest( name="name_value", ) + assert args[0] == request_msg def test_get_issue_use_cached_wrapped_rpc(): @@ -14131,9 +14158,14 @@ async def test_get_issue_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_issue_async( - transport: str = "grpc_asyncio", request_type=secure_source_manager.GetIssueRequest -): +@pytest.mark.parametrize( + "request_type", + [ + secure_source_manager.GetIssueRequest(), + {}, + ], +) +async def test_get_issue_async(request_type, transport: str = "grpc_asyncio"): client = SecureSourceManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14141,7 +14173,7 @@ async def test_get_issue_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_issue), "__call__") as call: @@ -14172,11 +14204,6 @@ async def test_get_issue_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_issue_async_from_dict(): - await test_get_issue_async(request_type=dict) - - def test_get_issue_field_headers(): client = SecureSourceManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14323,8 +14350,8 @@ async def test_get_issue_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - secure_source_manager.ListIssuesRequest, - dict, + secure_source_manager.ListIssuesRequest(), + {}, ], ) def test_list_issues(request_type, transport: str = "grpc"): @@ -14335,7 +14362,7 @@ def test_list_issues(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_issues), "__call__") as call: @@ -14381,11 +14408,12 @@ def test_list_issues_non_empty_request_with_auto_populated_field(): client.list_issues(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == secure_source_manager.ListIssuesRequest( + request_msg = secure_source_manager.ListIssuesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_issues_use_cached_wrapped_rpc(): @@ -14466,10 +14494,14 @@ async def test_list_issues_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_issues_async( - transport: str = "grpc_asyncio", - request_type=secure_source_manager.ListIssuesRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + secure_source_manager.ListIssuesRequest(), + {}, + ], +) +async def test_list_issues_async(request_type, transport: str = "grpc_asyncio"): client = SecureSourceManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14477,7 +14509,7 @@ async def test_list_issues_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_issues), "__call__") as call: @@ -14500,11 +14532,6 @@ async def test_list_issues_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_issues_async_from_dict(): - await test_list_issues_async(request_type=dict) - - def test_list_issues_field_headers(): client = SecureSourceManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14841,8 +14868,8 @@ async def test_list_issues_async_pages(): @pytest.mark.parametrize( "request_type", [ - secure_source_manager.UpdateIssueRequest, - dict, + secure_source_manager.UpdateIssueRequest(), + {}, ], ) def test_update_issue(request_type, transport: str = "grpc"): @@ -14853,7 +14880,7 @@ def test_update_issue(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_issue), "__call__") as call: @@ -14892,7 +14919,8 @@ def test_update_issue_non_empty_request_with_auto_populated_field(): client.update_issue(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == secure_source_manager.UpdateIssueRequest() + request_msg = secure_source_manager.UpdateIssueRequest() + assert args[0] == request_msg def test_update_issue_use_cached_wrapped_rpc(): @@ -14983,10 +15011,14 @@ async def test_update_issue_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_issue_async( - transport: str = "grpc_asyncio", - request_type=secure_source_manager.UpdateIssueRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + secure_source_manager.UpdateIssueRequest(), + {}, + ], +) +async def test_update_issue_async(request_type, transport: str = "grpc_asyncio"): client = SecureSourceManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14994,7 +15026,7 @@ async def test_update_issue_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_issue), "__call__") as call: @@ -15014,11 +15046,6 @@ async def test_update_issue_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_issue_async_from_dict(): - await test_update_issue_async(request_type=dict) - - def test_update_issue_field_headers(): client = SecureSourceManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15175,8 +15202,8 @@ async def test_update_issue_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - secure_source_manager.DeleteIssueRequest, - dict, + secure_source_manager.DeleteIssueRequest(), + {}, ], ) def test_delete_issue(request_type, transport: str = "grpc"): @@ -15187,7 +15214,7 @@ def test_delete_issue(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_issue), "__call__") as call: @@ -15229,10 +15256,11 @@ def test_delete_issue_non_empty_request_with_auto_populated_field(): client.delete_issue(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == secure_source_manager.DeleteIssueRequest( + request_msg = secure_source_manager.DeleteIssueRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_issue_use_cached_wrapped_rpc(): @@ -15323,10 +15351,14 @@ async def test_delete_issue_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_issue_async( - transport: str = "grpc_asyncio", - request_type=secure_source_manager.DeleteIssueRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + secure_source_manager.DeleteIssueRequest(), + {}, + ], +) +async def test_delete_issue_async(request_type, transport: str = "grpc_asyncio"): client = SecureSourceManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -15334,7 +15366,7 @@ async def test_delete_issue_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_issue), "__call__") as call: @@ -15354,11 +15386,6 @@ async def test_delete_issue_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_issue_async_from_dict(): - await test_delete_issue_async(request_type=dict) - - def test_delete_issue_field_headers(): client = SecureSourceManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15505,8 +15532,8 @@ async def test_delete_issue_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - secure_source_manager.OpenIssueRequest, - dict, + secure_source_manager.OpenIssueRequest(), + {}, ], ) def test_open_issue(request_type, transport: str = "grpc"): @@ -15517,7 +15544,7 @@ def test_open_issue(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.open_issue), "__call__") as call: @@ -15559,10 +15586,11 @@ def test_open_issue_non_empty_request_with_auto_populated_field(): client.open_issue(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == secure_source_manager.OpenIssueRequest( + request_msg = secure_source_manager.OpenIssueRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_open_issue_use_cached_wrapped_rpc(): @@ -15651,9 +15679,14 @@ async def test_open_issue_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_open_issue_async( - transport: str = "grpc_asyncio", request_type=secure_source_manager.OpenIssueRequest -): +@pytest.mark.parametrize( + "request_type", + [ + secure_source_manager.OpenIssueRequest(), + {}, + ], +) +async def test_open_issue_async(request_type, transport: str = "grpc_asyncio"): client = SecureSourceManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -15661,7 +15694,7 @@ async def test_open_issue_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.open_issue), "__call__") as call: @@ -15681,11 +15714,6 @@ async def test_open_issue_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_open_issue_async_from_dict(): - await test_open_issue_async(request_type=dict) - - def test_open_issue_field_headers(): client = SecureSourceManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15832,8 +15860,8 @@ async def test_open_issue_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - secure_source_manager.CloseIssueRequest, - dict, + secure_source_manager.CloseIssueRequest(), + {}, ], ) def test_close_issue(request_type, transport: str = "grpc"): @@ -15844,7 +15872,7 @@ def test_close_issue(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.close_issue), "__call__") as call: @@ -15886,10 +15914,11 @@ def test_close_issue_non_empty_request_with_auto_populated_field(): client.close_issue(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == secure_source_manager.CloseIssueRequest( + request_msg = secure_source_manager.CloseIssueRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_close_issue_use_cached_wrapped_rpc(): @@ -15980,10 +16009,14 @@ async def test_close_issue_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_close_issue_async( - transport: str = "grpc_asyncio", - request_type=secure_source_manager.CloseIssueRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + secure_source_manager.CloseIssueRequest(), + {}, + ], +) +async def test_close_issue_async(request_type, transport: str = "grpc_asyncio"): client = SecureSourceManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -15991,7 +16024,7 @@ async def test_close_issue_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.close_issue), "__call__") as call: @@ -16011,11 +16044,6 @@ async def test_close_issue_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_close_issue_async_from_dict(): - await test_close_issue_async(request_type=dict) - - def test_close_issue_field_headers(): client = SecureSourceManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16162,8 +16190,8 @@ async def test_close_issue_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - secure_source_manager.GetPullRequestCommentRequest, - dict, + secure_source_manager.GetPullRequestCommentRequest(), + {}, ], ) def test_get_pull_request_comment(request_type, transport: str = "grpc"): @@ -16174,7 +16202,7 @@ def test_get_pull_request_comment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -16222,9 +16250,10 @@ def test_get_pull_request_comment_non_empty_request_with_auto_populated_field(): client.get_pull_request_comment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == secure_source_manager.GetPullRequestCommentRequest( + request_msg = secure_source_manager.GetPullRequestCommentRequest( name="name_value", ) + assert args[0] == request_msg def test_get_pull_request_comment_use_cached_wrapped_rpc(): @@ -16310,9 +16339,15 @@ async def test_get_pull_request_comment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + secure_source_manager.GetPullRequestCommentRequest(), + {}, + ], +) async def test_get_pull_request_comment_async( - transport: str = "grpc_asyncio", - request_type=secure_source_manager.GetPullRequestCommentRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecureSourceManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -16321,7 +16356,7 @@ async def test_get_pull_request_comment_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( @@ -16346,11 +16381,6 @@ async def test_get_pull_request_comment_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_pull_request_comment_async_from_dict(): - await test_get_pull_request_comment_async(request_type=dict) - - def test_get_pull_request_comment_field_headers(): client = SecureSourceManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16505,8 +16535,8 @@ async def test_get_pull_request_comment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - secure_source_manager.ListPullRequestCommentsRequest, - dict, + secure_source_manager.ListPullRequestCommentsRequest(), + {}, ], ) def test_list_pull_request_comments(request_type, transport: str = "grpc"): @@ -16517,7 +16547,7 @@ def test_list_pull_request_comments(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -16566,10 +16596,11 @@ def test_list_pull_request_comments_non_empty_request_with_auto_populated_field( client.list_pull_request_comments(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == secure_source_manager.ListPullRequestCommentsRequest( + request_msg = secure_source_manager.ListPullRequestCommentsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_pull_request_comments_use_cached_wrapped_rpc(): @@ -16655,9 +16686,15 @@ async def test_list_pull_request_comments_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + secure_source_manager.ListPullRequestCommentsRequest(), + {}, + ], +) async def test_list_pull_request_comments_async( - transport: str = "grpc_asyncio", - request_type=secure_source_manager.ListPullRequestCommentsRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecureSourceManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -16666,7 +16703,7 @@ async def test_list_pull_request_comments_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( @@ -16691,11 +16728,6 @@ async def test_list_pull_request_comments_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_pull_request_comments_async_from_dict(): - await test_list_pull_request_comments_async(request_type=dict) - - def test_list_pull_request_comments_field_headers(): client = SecureSourceManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17054,8 +17086,8 @@ async def test_list_pull_request_comments_async_pages(): @pytest.mark.parametrize( "request_type", [ - secure_source_manager.CreatePullRequestCommentRequest, - dict, + secure_source_manager.CreatePullRequestCommentRequest(), + {}, ], ) def test_create_pull_request_comment(request_type, transport: str = "grpc"): @@ -17066,7 +17098,7 @@ def test_create_pull_request_comment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -17111,9 +17143,10 @@ def test_create_pull_request_comment_non_empty_request_with_auto_populated_field client.create_pull_request_comment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == secure_source_manager.CreatePullRequestCommentRequest( + request_msg = secure_source_manager.CreatePullRequestCommentRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_pull_request_comment_use_cached_wrapped_rpc(): @@ -17209,9 +17242,15 @@ async def test_create_pull_request_comment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + secure_source_manager.CreatePullRequestCommentRequest(), + {}, + ], +) async def test_create_pull_request_comment_async( - transport: str = "grpc_asyncio", - request_type=secure_source_manager.CreatePullRequestCommentRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecureSourceManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -17220,7 +17259,7 @@ async def test_create_pull_request_comment_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( @@ -17242,11 +17281,6 @@ async def test_create_pull_request_comment_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_pull_request_comment_async_from_dict(): - await test_create_pull_request_comment_async(request_type=dict) - - def test_create_pull_request_comment_field_headers(): client = SecureSourceManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17419,8 +17453,8 @@ async def test_create_pull_request_comment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - secure_source_manager.UpdatePullRequestCommentRequest, - dict, + secure_source_manager.UpdatePullRequestCommentRequest(), + {}, ], ) def test_update_pull_request_comment(request_type, transport: str = "grpc"): @@ -17431,7 +17465,7 @@ def test_update_pull_request_comment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -17474,7 +17508,8 @@ def test_update_pull_request_comment_non_empty_request_with_auto_populated_field client.update_pull_request_comment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == secure_source_manager.UpdatePullRequestCommentRequest() + request_msg = secure_source_manager.UpdatePullRequestCommentRequest() + assert args[0] == request_msg def test_update_pull_request_comment_use_cached_wrapped_rpc(): @@ -17570,9 +17605,15 @@ async def test_update_pull_request_comment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + secure_source_manager.UpdatePullRequestCommentRequest(), + {}, + ], +) async def test_update_pull_request_comment_async( - transport: str = "grpc_asyncio", - request_type=secure_source_manager.UpdatePullRequestCommentRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecureSourceManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -17581,7 +17622,7 @@ async def test_update_pull_request_comment_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( @@ -17603,11 +17644,6 @@ async def test_update_pull_request_comment_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_pull_request_comment_async_from_dict(): - await test_update_pull_request_comment_async(request_type=dict) - - def test_update_pull_request_comment_field_headers(): client = SecureSourceManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17780,8 +17816,8 @@ async def test_update_pull_request_comment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - secure_source_manager.DeletePullRequestCommentRequest, - dict, + secure_source_manager.DeletePullRequestCommentRequest(), + {}, ], ) def test_delete_pull_request_comment(request_type, transport: str = "grpc"): @@ -17792,7 +17828,7 @@ def test_delete_pull_request_comment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -17837,9 +17873,10 @@ def test_delete_pull_request_comment_non_empty_request_with_auto_populated_field client.delete_pull_request_comment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == secure_source_manager.DeletePullRequestCommentRequest( + request_msg = secure_source_manager.DeletePullRequestCommentRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_pull_request_comment_use_cached_wrapped_rpc(): @@ -17935,9 +17972,15 @@ async def test_delete_pull_request_comment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + secure_source_manager.DeletePullRequestCommentRequest(), + {}, + ], +) async def test_delete_pull_request_comment_async( - transport: str = "grpc_asyncio", - request_type=secure_source_manager.DeletePullRequestCommentRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecureSourceManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -17946,7 +17989,7 @@ async def test_delete_pull_request_comment_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( @@ -17968,11 +18011,6 @@ async def test_delete_pull_request_comment_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_pull_request_comment_async_from_dict(): - await test_delete_pull_request_comment_async(request_type=dict) - - def test_delete_pull_request_comment_field_headers(): client = SecureSourceManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18127,8 +18165,8 @@ async def test_delete_pull_request_comment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - secure_source_manager.BatchCreatePullRequestCommentsRequest, - dict, + secure_source_manager.BatchCreatePullRequestCommentsRequest(), + {}, ], ) def test_batch_create_pull_request_comments(request_type, transport: str = "grpc"): @@ -18139,7 +18177,7 @@ def test_batch_create_pull_request_comments(request_type, transport: str = "grpc # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -18184,9 +18222,10 @@ def test_batch_create_pull_request_comments_non_empty_request_with_auto_populate client.batch_create_pull_request_comments(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == secure_source_manager.BatchCreatePullRequestCommentsRequest( + request_msg = secure_source_manager.BatchCreatePullRequestCommentsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_batch_create_pull_request_comments_use_cached_wrapped_rpc(): @@ -18282,9 +18321,15 @@ async def test_batch_create_pull_request_comments_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + secure_source_manager.BatchCreatePullRequestCommentsRequest(), + {}, + ], +) async def test_batch_create_pull_request_comments_async( - transport: str = "grpc_asyncio", - request_type=secure_source_manager.BatchCreatePullRequestCommentsRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecureSourceManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -18293,7 +18338,7 @@ async def test_batch_create_pull_request_comments_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( @@ -18315,11 +18360,6 @@ async def test_batch_create_pull_request_comments_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_batch_create_pull_request_comments_async_from_dict(): - await test_batch_create_pull_request_comments_async(request_type=dict) - - def test_batch_create_pull_request_comments_field_headers(): client = SecureSourceManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18504,8 +18544,8 @@ async def test_batch_create_pull_request_comments_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - secure_source_manager.ResolvePullRequestCommentsRequest, - dict, + secure_source_manager.ResolvePullRequestCommentsRequest(), + {}, ], ) def test_resolve_pull_request_comments(request_type, transport: str = "grpc"): @@ -18516,7 +18556,7 @@ def test_resolve_pull_request_comments(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -18561,9 +18601,10 @@ def test_resolve_pull_request_comments_non_empty_request_with_auto_populated_fie client.resolve_pull_request_comments(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == secure_source_manager.ResolvePullRequestCommentsRequest( + request_msg = secure_source_manager.ResolvePullRequestCommentsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_resolve_pull_request_comments_use_cached_wrapped_rpc(): @@ -18659,9 +18700,15 @@ async def test_resolve_pull_request_comments_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + secure_source_manager.ResolvePullRequestCommentsRequest(), + {}, + ], +) async def test_resolve_pull_request_comments_async( - transport: str = "grpc_asyncio", - request_type=secure_source_manager.ResolvePullRequestCommentsRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecureSourceManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -18670,7 +18717,7 @@ async def test_resolve_pull_request_comments_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( @@ -18692,11 +18739,6 @@ async def test_resolve_pull_request_comments_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_resolve_pull_request_comments_async_from_dict(): - await test_resolve_pull_request_comments_async(request_type=dict) - - def test_resolve_pull_request_comments_field_headers(): client = SecureSourceManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18861,8 +18903,8 @@ async def test_resolve_pull_request_comments_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - secure_source_manager.UnresolvePullRequestCommentsRequest, - dict, + secure_source_manager.UnresolvePullRequestCommentsRequest(), + {}, ], ) def test_unresolve_pull_request_comments(request_type, transport: str = "grpc"): @@ -18873,7 +18915,7 @@ def test_unresolve_pull_request_comments(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -18918,9 +18960,10 @@ def test_unresolve_pull_request_comments_non_empty_request_with_auto_populated_f client.unresolve_pull_request_comments(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == secure_source_manager.UnresolvePullRequestCommentsRequest( + request_msg = secure_source_manager.UnresolvePullRequestCommentsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_unresolve_pull_request_comments_use_cached_wrapped_rpc(): @@ -19016,9 +19059,15 @@ async def test_unresolve_pull_request_comments_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + secure_source_manager.UnresolvePullRequestCommentsRequest(), + {}, + ], +) async def test_unresolve_pull_request_comments_async( - transport: str = "grpc_asyncio", - request_type=secure_source_manager.UnresolvePullRequestCommentsRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecureSourceManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -19027,7 +19076,7 @@ async def test_unresolve_pull_request_comments_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( @@ -19049,11 +19098,6 @@ async def test_unresolve_pull_request_comments_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_unresolve_pull_request_comments_async_from_dict(): - await test_unresolve_pull_request_comments_async(request_type=dict) - - def test_unresolve_pull_request_comments_field_headers(): client = SecureSourceManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -19218,8 +19262,8 @@ async def test_unresolve_pull_request_comments_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - secure_source_manager.CreateIssueCommentRequest, - dict, + secure_source_manager.CreateIssueCommentRequest(), + {}, ], ) def test_create_issue_comment(request_type, transport: str = "grpc"): @@ -19230,7 +19274,7 @@ def test_create_issue_comment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -19275,9 +19319,10 @@ def test_create_issue_comment_non_empty_request_with_auto_populated_field(): client.create_issue_comment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == secure_source_manager.CreateIssueCommentRequest( + request_msg = secure_source_manager.CreateIssueCommentRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_issue_comment_use_cached_wrapped_rpc(): @@ -19372,9 +19417,15 @@ async def test_create_issue_comment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + secure_source_manager.CreateIssueCommentRequest(), + {}, + ], +) async def test_create_issue_comment_async( - transport: str = "grpc_asyncio", - request_type=secure_source_manager.CreateIssueCommentRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecureSourceManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -19383,7 +19434,7 @@ async def test_create_issue_comment_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( @@ -19405,11 +19456,6 @@ async def test_create_issue_comment_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_issue_comment_async_from_dict(): - await test_create_issue_comment_async(request_type=dict) - - def test_create_issue_comment_field_headers(): client = SecureSourceManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -19574,8 +19620,8 @@ async def test_create_issue_comment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - secure_source_manager.GetIssueCommentRequest, - dict, + secure_source_manager.GetIssueCommentRequest(), + {}, ], ) def test_get_issue_comment(request_type, transport: str = "grpc"): @@ -19586,7 +19632,7 @@ def test_get_issue_comment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -19636,9 +19682,10 @@ def test_get_issue_comment_non_empty_request_with_auto_populated_field(): client.get_issue_comment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == secure_source_manager.GetIssueCommentRequest( + request_msg = secure_source_manager.GetIssueCommentRequest( name="name_value", ) + assert args[0] == request_msg def test_get_issue_comment_use_cached_wrapped_rpc(): @@ -19721,10 +19768,14 @@ async def test_get_issue_comment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_issue_comment_async( - transport: str = "grpc_asyncio", - request_type=secure_source_manager.GetIssueCommentRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + secure_source_manager.GetIssueCommentRequest(), + {}, + ], +) +async def test_get_issue_comment_async(request_type, transport: str = "grpc_asyncio"): client = SecureSourceManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -19732,7 +19783,7 @@ async def test_get_issue_comment_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( @@ -19759,11 +19810,6 @@ async def test_get_issue_comment_async( assert response.body == "body_value" -@pytest.mark.asyncio -async def test_get_issue_comment_async_from_dict(): - await test_get_issue_comment_async(request_type=dict) - - def test_get_issue_comment_field_headers(): client = SecureSourceManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -19918,8 +19964,8 @@ async def test_get_issue_comment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - secure_source_manager.ListIssueCommentsRequest, - dict, + secure_source_manager.ListIssueCommentsRequest(), + {}, ], ) def test_list_issue_comments(request_type, transport: str = "grpc"): @@ -19930,7 +19976,7 @@ def test_list_issue_comments(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -19979,10 +20025,11 @@ def test_list_issue_comments_non_empty_request_with_auto_populated_field(): client.list_issue_comments(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == secure_source_manager.ListIssueCommentsRequest( + request_msg = secure_source_manager.ListIssueCommentsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_issue_comments_use_cached_wrapped_rpc(): @@ -20067,10 +20114,14 @@ async def test_list_issue_comments_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_issue_comments_async( - transport: str = "grpc_asyncio", - request_type=secure_source_manager.ListIssueCommentsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + secure_source_manager.ListIssueCommentsRequest(), + {}, + ], +) +async def test_list_issue_comments_async(request_type, transport: str = "grpc_asyncio"): client = SecureSourceManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -20078,7 +20129,7 @@ async def test_list_issue_comments_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( @@ -20103,11 +20154,6 @@ async def test_list_issue_comments_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_issue_comments_async_from_dict(): - await test_list_issue_comments_async(request_type=dict) - - def test_list_issue_comments_field_headers(): client = SecureSourceManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -20460,8 +20506,8 @@ async def test_list_issue_comments_async_pages(): @pytest.mark.parametrize( "request_type", [ - secure_source_manager.UpdateIssueCommentRequest, - dict, + secure_source_manager.UpdateIssueCommentRequest(), + {}, ], ) def test_update_issue_comment(request_type, transport: str = "grpc"): @@ -20472,7 +20518,7 @@ def test_update_issue_comment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -20515,7 +20561,8 @@ def test_update_issue_comment_non_empty_request_with_auto_populated_field(): client.update_issue_comment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == secure_source_manager.UpdateIssueCommentRequest() + request_msg = secure_source_manager.UpdateIssueCommentRequest() + assert args[0] == request_msg def test_update_issue_comment_use_cached_wrapped_rpc(): @@ -20610,9 +20657,15 @@ async def test_update_issue_comment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + secure_source_manager.UpdateIssueCommentRequest(), + {}, + ], +) async def test_update_issue_comment_async( - transport: str = "grpc_asyncio", - request_type=secure_source_manager.UpdateIssueCommentRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecureSourceManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -20621,7 +20674,7 @@ async def test_update_issue_comment_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( @@ -20643,11 +20696,6 @@ async def test_update_issue_comment_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_issue_comment_async_from_dict(): - await test_update_issue_comment_async(request_type=dict) - - def test_update_issue_comment_field_headers(): client = SecureSourceManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -20812,8 +20860,8 @@ async def test_update_issue_comment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - secure_source_manager.DeleteIssueCommentRequest, - dict, + secure_source_manager.DeleteIssueCommentRequest(), + {}, ], ) def test_delete_issue_comment(request_type, transport: str = "grpc"): @@ -20824,7 +20872,7 @@ def test_delete_issue_comment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -20869,9 +20917,10 @@ def test_delete_issue_comment_non_empty_request_with_auto_populated_field(): client.delete_issue_comment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == secure_source_manager.DeleteIssueCommentRequest( + request_msg = secure_source_manager.DeleteIssueCommentRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_issue_comment_use_cached_wrapped_rpc(): @@ -20966,9 +21015,15 @@ async def test_delete_issue_comment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + secure_source_manager.DeleteIssueCommentRequest(), + {}, + ], +) async def test_delete_issue_comment_async( - transport: str = "grpc_asyncio", - request_type=secure_source_manager.DeleteIssueCommentRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecureSourceManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -20977,7 +21032,7 @@ async def test_delete_issue_comment_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( @@ -20999,11 +21054,6 @@ async def test_delete_issue_comment_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_issue_comment_async_from_dict(): - await test_delete_issue_comment_async(request_type=dict) - - def test_delete_issue_comment_field_headers(): client = SecureSourceManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -31764,7 +31814,6 @@ def test_list_instances_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.ListInstancesRequest() - assert args[0] == request_msg @@ -31785,7 +31834,6 @@ def test_get_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.GetInstanceRequest() - assert args[0] == request_msg @@ -31806,7 +31854,6 @@ def test_create_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.CreateInstanceRequest() - assert args[0] == request_msg @@ -31827,7 +31874,6 @@ def test_delete_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.DeleteInstanceRequest() - assert args[0] == request_msg @@ -31850,7 +31896,6 @@ def test_list_repositories_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.ListRepositoriesRequest() - assert args[0] == request_msg @@ -31871,7 +31916,6 @@ def test_get_repository_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.GetRepositoryRequest() - assert args[0] == request_msg @@ -31894,7 +31938,6 @@ def test_create_repository_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.CreateRepositoryRequest() - assert args[0] == request_msg @@ -31917,7 +31960,6 @@ def test_update_repository_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.UpdateRepositoryRequest() - assert args[0] == request_msg @@ -31940,7 +31982,6 @@ def test_delete_repository_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.DeleteRepositoryRequest() - assert args[0] == request_msg @@ -31961,7 +32002,6 @@ def test_list_hooks_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.ListHooksRequest() - assert args[0] == request_msg @@ -31982,7 +32022,6 @@ def test_get_hook_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.GetHookRequest() - assert args[0] == request_msg @@ -32003,7 +32042,6 @@ def test_create_hook_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.CreateHookRequest() - assert args[0] == request_msg @@ -32024,7 +32062,6 @@ def test_update_hook_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.UpdateHookRequest() - assert args[0] == request_msg @@ -32045,7 +32082,6 @@ def test_delete_hook_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.DeleteHookRequest() - assert args[0] == request_msg @@ -32068,7 +32104,6 @@ def test_get_iam_policy_repo_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -32091,7 +32126,6 @@ def test_set_iam_policy_repo_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -32114,7 +32148,6 @@ def test_test_iam_permissions_repo_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -32137,7 +32170,6 @@ def test_create_branch_rule_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.CreateBranchRuleRequest() - assert args[0] == request_msg @@ -32160,7 +32192,6 @@ def test_list_branch_rules_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.ListBranchRulesRequest() - assert args[0] == request_msg @@ -32181,7 +32212,6 @@ def test_get_branch_rule_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.GetBranchRuleRequest() - assert args[0] == request_msg @@ -32204,7 +32234,6 @@ def test_update_branch_rule_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.UpdateBranchRuleRequest() - assert args[0] == request_msg @@ -32227,7 +32256,6 @@ def test_delete_branch_rule_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.DeleteBranchRuleRequest() - assert args[0] == request_msg @@ -32250,7 +32278,6 @@ def test_create_pull_request_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.CreatePullRequestRequest() - assert args[0] == request_msg @@ -32271,7 +32298,6 @@ def test_get_pull_request_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.GetPullRequestRequest() - assert args[0] == request_msg @@ -32294,7 +32320,6 @@ def test_list_pull_requests_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.ListPullRequestsRequest() - assert args[0] == request_msg @@ -32317,7 +32342,6 @@ def test_update_pull_request_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.UpdatePullRequestRequest() - assert args[0] == request_msg @@ -32340,7 +32364,6 @@ def test_merge_pull_request_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.MergePullRequestRequest() - assert args[0] == request_msg @@ -32363,7 +32386,6 @@ def test_open_pull_request_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.OpenPullRequestRequest() - assert args[0] == request_msg @@ -32386,7 +32408,6 @@ def test_close_pull_request_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.ClosePullRequestRequest() - assert args[0] == request_msg @@ -32409,7 +32430,6 @@ def test_list_pull_request_file_diffs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.ListPullRequestFileDiffsRequest() - assert args[0] == request_msg @@ -32430,7 +32450,6 @@ def test_fetch_tree_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.FetchTreeRequest() - assert args[0] == request_msg @@ -32451,7 +32470,6 @@ def test_fetch_blob_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.FetchBlobRequest() - assert args[0] == request_msg @@ -32472,7 +32490,6 @@ def test_create_issue_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.CreateIssueRequest() - assert args[0] == request_msg @@ -32493,7 +32510,6 @@ def test_get_issue_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.GetIssueRequest() - assert args[0] == request_msg @@ -32514,7 +32530,6 @@ def test_list_issues_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.ListIssuesRequest() - assert args[0] == request_msg @@ -32535,7 +32550,6 @@ def test_update_issue_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.UpdateIssueRequest() - assert args[0] == request_msg @@ -32556,7 +32570,6 @@ def test_delete_issue_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.DeleteIssueRequest() - assert args[0] == request_msg @@ -32577,7 +32590,6 @@ def test_open_issue_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.OpenIssueRequest() - assert args[0] == request_msg @@ -32598,7 +32610,6 @@ def test_close_issue_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.CloseIssueRequest() - assert args[0] == request_msg @@ -32621,7 +32632,6 @@ def test_get_pull_request_comment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.GetPullRequestCommentRequest() - assert args[0] == request_msg @@ -32644,7 +32654,6 @@ def test_list_pull_request_comments_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.ListPullRequestCommentsRequest() - assert args[0] == request_msg @@ -32667,7 +32676,6 @@ def test_create_pull_request_comment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.CreatePullRequestCommentRequest() - assert args[0] == request_msg @@ -32690,7 +32698,6 @@ def test_update_pull_request_comment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.UpdatePullRequestCommentRequest() - assert args[0] == request_msg @@ -32713,7 +32720,6 @@ def test_delete_pull_request_comment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.DeletePullRequestCommentRequest() - assert args[0] == request_msg @@ -32736,7 +32742,6 @@ def test_batch_create_pull_request_comments_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.BatchCreatePullRequestCommentsRequest() - assert args[0] == request_msg @@ -32759,7 +32764,6 @@ def test_resolve_pull_request_comments_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.ResolvePullRequestCommentsRequest() - assert args[0] == request_msg @@ -32782,7 +32786,6 @@ def test_unresolve_pull_request_comments_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.UnresolvePullRequestCommentsRequest() - assert args[0] == request_msg @@ -32805,7 +32808,6 @@ def test_create_issue_comment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.CreateIssueCommentRequest() - assert args[0] == request_msg @@ -32828,7 +32830,6 @@ def test_get_issue_comment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.GetIssueCommentRequest() - assert args[0] == request_msg @@ -32851,7 +32852,6 @@ def test_list_issue_comments_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.ListIssueCommentsRequest() - assert args[0] == request_msg @@ -32874,7 +32874,6 @@ def test_update_issue_comment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.UpdateIssueCommentRequest() - assert args[0] == request_msg @@ -32897,7 +32896,6 @@ def test_delete_issue_comment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.DeleteIssueCommentRequest() - assert args[0] == request_msg @@ -32939,7 +32937,6 @@ async def test_list_instances_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.ListInstancesRequest() - assert args[0] == request_msg @@ -32969,7 +32966,6 @@ async def test_get_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.GetInstanceRequest() - assert args[0] == request_msg @@ -32994,7 +32990,6 @@ async def test_create_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.CreateInstanceRequest() - assert args[0] == request_msg @@ -33019,7 +33014,6 @@ async def test_delete_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.DeleteInstanceRequest() - assert args[0] == request_msg @@ -33048,7 +33042,6 @@ async def test_list_repositories_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.ListRepositoriesRequest() - assert args[0] == request_msg @@ -33079,7 +33072,6 @@ async def test_get_repository_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.GetRepositoryRequest() - assert args[0] == request_msg @@ -33106,7 +33098,6 @@ async def test_create_repository_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.CreateRepositoryRequest() - assert args[0] == request_msg @@ -33133,7 +33124,6 @@ async def test_update_repository_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.UpdateRepositoryRequest() - assert args[0] == request_msg @@ -33160,7 +33150,6 @@ async def test_delete_repository_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.DeleteRepositoryRequest() - assert args[0] == request_msg @@ -33187,7 +33176,6 @@ async def test_list_hooks_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.ListHooksRequest() - assert args[0] == request_msg @@ -33219,7 +33207,6 @@ async def test_get_hook_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.GetHookRequest() - assert args[0] == request_msg @@ -33244,7 +33231,6 @@ async def test_create_hook_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.CreateHookRequest() - assert args[0] == request_msg @@ -33269,7 +33255,6 @@ async def test_update_hook_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.UpdateHookRequest() - assert args[0] == request_msg @@ -33294,7 +33279,6 @@ async def test_delete_hook_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.DeleteHookRequest() - assert args[0] == request_msg @@ -33324,7 +33308,6 @@ async def test_get_iam_policy_repo_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -33354,7 +33337,6 @@ async def test_set_iam_policy_repo_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -33383,7 +33365,6 @@ async def test_test_iam_permissions_repo_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -33410,7 +33391,6 @@ async def test_create_branch_rule_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.CreateBranchRuleRequest() - assert args[0] == request_msg @@ -33439,7 +33419,6 @@ async def test_list_branch_rules_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.ListBranchRulesRequest() - assert args[0] == request_msg @@ -33477,7 +33456,6 @@ async def test_get_branch_rule_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.GetBranchRuleRequest() - assert args[0] == request_msg @@ -33504,7 +33482,6 @@ async def test_update_branch_rule_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.UpdateBranchRuleRequest() - assert args[0] == request_msg @@ -33531,7 +33508,6 @@ async def test_delete_branch_rule_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.DeleteBranchRuleRequest() - assert args[0] == request_msg @@ -33558,7 +33534,6 @@ async def test_create_pull_request_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.CreatePullRequestRequest() - assert args[0] == request_msg @@ -33588,7 +33563,6 @@ async def test_get_pull_request_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.GetPullRequestRequest() - assert args[0] == request_msg @@ -33617,7 +33591,6 @@ async def test_list_pull_requests_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.ListPullRequestsRequest() - assert args[0] == request_msg @@ -33644,7 +33617,6 @@ async def test_update_pull_request_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.UpdatePullRequestRequest() - assert args[0] == request_msg @@ -33671,7 +33643,6 @@ async def test_merge_pull_request_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.MergePullRequestRequest() - assert args[0] == request_msg @@ -33698,7 +33669,6 @@ async def test_open_pull_request_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.OpenPullRequestRequest() - assert args[0] == request_msg @@ -33725,7 +33695,6 @@ async def test_close_pull_request_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.ClosePullRequestRequest() - assert args[0] == request_msg @@ -33754,7 +33723,6 @@ async def test_list_pull_request_file_diffs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.ListPullRequestFileDiffsRequest() - assert args[0] == request_msg @@ -33781,7 +33749,6 @@ async def test_fetch_tree_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.FetchTreeRequest() - assert args[0] == request_msg @@ -33809,7 +33776,6 @@ async def test_fetch_blob_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.FetchBlobRequest() - assert args[0] == request_msg @@ -33834,7 +33800,6 @@ async def test_create_issue_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.CreateIssueRequest() - assert args[0] == request_msg @@ -33865,7 +33830,6 @@ async def test_get_issue_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.GetIssueRequest() - assert args[0] == request_msg @@ -33892,7 +33856,6 @@ async def test_list_issues_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.ListIssuesRequest() - assert args[0] == request_msg @@ -33917,7 +33880,6 @@ async def test_update_issue_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.UpdateIssueRequest() - assert args[0] == request_msg @@ -33942,7 +33904,6 @@ async def test_delete_issue_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.DeleteIssueRequest() - assert args[0] == request_msg @@ -33967,7 +33928,6 @@ async def test_open_issue_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.OpenIssueRequest() - assert args[0] == request_msg @@ -33992,7 +33952,6 @@ async def test_close_issue_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.CloseIssueRequest() - assert args[0] == request_msg @@ -34021,7 +33980,6 @@ async def test_get_pull_request_comment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.GetPullRequestCommentRequest() - assert args[0] == request_msg @@ -34050,7 +34008,6 @@ async def test_list_pull_request_comments_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.ListPullRequestCommentsRequest() - assert args[0] == request_msg @@ -34077,7 +34034,6 @@ async def test_create_pull_request_comment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.CreatePullRequestCommentRequest() - assert args[0] == request_msg @@ -34104,7 +34060,6 @@ async def test_update_pull_request_comment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.UpdatePullRequestCommentRequest() - assert args[0] == request_msg @@ -34131,7 +34086,6 @@ async def test_delete_pull_request_comment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.DeletePullRequestCommentRequest() - assert args[0] == request_msg @@ -34158,7 +34112,6 @@ async def test_batch_create_pull_request_comments_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.BatchCreatePullRequestCommentsRequest() - assert args[0] == request_msg @@ -34185,7 +34138,6 @@ async def test_resolve_pull_request_comments_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.ResolvePullRequestCommentsRequest() - assert args[0] == request_msg @@ -34212,7 +34164,6 @@ async def test_unresolve_pull_request_comments_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.UnresolvePullRequestCommentsRequest() - assert args[0] == request_msg @@ -34239,7 +34190,6 @@ async def test_create_issue_comment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.CreateIssueCommentRequest() - assert args[0] == request_msg @@ -34269,7 +34219,6 @@ async def test_get_issue_comment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.GetIssueCommentRequest() - assert args[0] == request_msg @@ -34298,7 +34247,6 @@ async def test_list_issue_comments_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.ListIssueCommentsRequest() - assert args[0] == request_msg @@ -34325,7 +34273,6 @@ async def test_update_issue_comment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.UpdateIssueCommentRequest() - assert args[0] == request_msg @@ -34352,7 +34299,6 @@ async def test_delete_issue_comment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.DeleteIssueCommentRequest() - assert args[0] == request_msg @@ -43184,7 +43130,6 @@ def test_list_instances_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.ListInstancesRequest() - assert args[0] == request_msg @@ -43204,7 +43149,6 @@ def test_get_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.GetInstanceRequest() - assert args[0] == request_msg @@ -43224,7 +43168,6 @@ def test_create_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.CreateInstanceRequest() - assert args[0] == request_msg @@ -43244,7 +43187,6 @@ def test_delete_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.DeleteInstanceRequest() - assert args[0] == request_msg @@ -43266,7 +43208,6 @@ def test_list_repositories_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.ListRepositoriesRequest() - assert args[0] == request_msg @@ -43286,7 +43227,6 @@ def test_get_repository_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.GetRepositoryRequest() - assert args[0] == request_msg @@ -43308,7 +43248,6 @@ def test_create_repository_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.CreateRepositoryRequest() - assert args[0] == request_msg @@ -43330,7 +43269,6 @@ def test_update_repository_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.UpdateRepositoryRequest() - assert args[0] == request_msg @@ -43352,7 +43290,6 @@ def test_delete_repository_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.DeleteRepositoryRequest() - assert args[0] == request_msg @@ -43372,7 +43309,6 @@ def test_list_hooks_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.ListHooksRequest() - assert args[0] == request_msg @@ -43392,7 +43328,6 @@ def test_get_hook_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.GetHookRequest() - assert args[0] == request_msg @@ -43412,7 +43347,6 @@ def test_create_hook_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.CreateHookRequest() - assert args[0] == request_msg @@ -43432,7 +43366,6 @@ def test_update_hook_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.UpdateHookRequest() - assert args[0] == request_msg @@ -43452,7 +43385,6 @@ def test_delete_hook_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.DeleteHookRequest() - assert args[0] == request_msg @@ -43474,7 +43406,6 @@ def test_get_iam_policy_repo_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -43496,7 +43427,6 @@ def test_set_iam_policy_repo_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -43518,7 +43448,6 @@ def test_test_iam_permissions_repo_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -43540,7 +43469,6 @@ def test_create_branch_rule_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.CreateBranchRuleRequest() - assert args[0] == request_msg @@ -43562,7 +43490,6 @@ def test_list_branch_rules_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.ListBranchRulesRequest() - assert args[0] == request_msg @@ -43582,7 +43509,6 @@ def test_get_branch_rule_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.GetBranchRuleRequest() - assert args[0] == request_msg @@ -43604,7 +43530,6 @@ def test_update_branch_rule_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.UpdateBranchRuleRequest() - assert args[0] == request_msg @@ -43626,7 +43551,6 @@ def test_delete_branch_rule_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.DeleteBranchRuleRequest() - assert args[0] == request_msg @@ -43648,7 +43572,6 @@ def test_create_pull_request_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.CreatePullRequestRequest() - assert args[0] == request_msg @@ -43668,7 +43591,6 @@ def test_get_pull_request_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.GetPullRequestRequest() - assert args[0] == request_msg @@ -43690,7 +43612,6 @@ def test_list_pull_requests_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.ListPullRequestsRequest() - assert args[0] == request_msg @@ -43712,7 +43633,6 @@ def test_update_pull_request_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.UpdatePullRequestRequest() - assert args[0] == request_msg @@ -43734,7 +43654,6 @@ def test_merge_pull_request_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.MergePullRequestRequest() - assert args[0] == request_msg @@ -43756,7 +43675,6 @@ def test_open_pull_request_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.OpenPullRequestRequest() - assert args[0] == request_msg @@ -43778,7 +43696,6 @@ def test_close_pull_request_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.ClosePullRequestRequest() - assert args[0] == request_msg @@ -43800,7 +43717,6 @@ def test_list_pull_request_file_diffs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.ListPullRequestFileDiffsRequest() - assert args[0] == request_msg @@ -43820,7 +43736,6 @@ def test_fetch_tree_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.FetchTreeRequest() - assert args[0] == request_msg @@ -43840,7 +43755,6 @@ def test_fetch_blob_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.FetchBlobRequest() - assert args[0] == request_msg @@ -43860,7 +43774,6 @@ def test_create_issue_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.CreateIssueRequest() - assert args[0] == request_msg @@ -43880,7 +43793,6 @@ def test_get_issue_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.GetIssueRequest() - assert args[0] == request_msg @@ -43900,7 +43812,6 @@ def test_list_issues_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.ListIssuesRequest() - assert args[0] == request_msg @@ -43920,7 +43831,6 @@ def test_update_issue_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.UpdateIssueRequest() - assert args[0] == request_msg @@ -43940,7 +43850,6 @@ def test_delete_issue_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.DeleteIssueRequest() - assert args[0] == request_msg @@ -43960,7 +43869,6 @@ def test_open_issue_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.OpenIssueRequest() - assert args[0] == request_msg @@ -43980,7 +43888,6 @@ def test_close_issue_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.CloseIssueRequest() - assert args[0] == request_msg @@ -44002,7 +43909,6 @@ def test_get_pull_request_comment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.GetPullRequestCommentRequest() - assert args[0] == request_msg @@ -44024,7 +43930,6 @@ def test_list_pull_request_comments_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.ListPullRequestCommentsRequest() - assert args[0] == request_msg @@ -44046,7 +43951,6 @@ def test_create_pull_request_comment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.CreatePullRequestCommentRequest() - assert args[0] == request_msg @@ -44068,7 +43972,6 @@ def test_update_pull_request_comment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.UpdatePullRequestCommentRequest() - assert args[0] == request_msg @@ -44090,7 +43993,6 @@ def test_delete_pull_request_comment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.DeletePullRequestCommentRequest() - assert args[0] == request_msg @@ -44112,7 +44014,6 @@ def test_batch_create_pull_request_comments_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.BatchCreatePullRequestCommentsRequest() - assert args[0] == request_msg @@ -44134,7 +44035,6 @@ def test_resolve_pull_request_comments_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.ResolvePullRequestCommentsRequest() - assert args[0] == request_msg @@ -44156,7 +44056,6 @@ def test_unresolve_pull_request_comments_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.UnresolvePullRequestCommentsRequest() - assert args[0] == request_msg @@ -44178,7 +44077,6 @@ def test_create_issue_comment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.CreateIssueCommentRequest() - assert args[0] == request_msg @@ -44200,7 +44098,6 @@ def test_get_issue_comment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.GetIssueCommentRequest() - assert args[0] == request_msg @@ -44222,7 +44119,6 @@ def test_list_issue_comments_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.ListIssueCommentsRequest() - assert args[0] == request_msg @@ -44244,7 +44140,6 @@ def test_update_issue_comment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.UpdateIssueCommentRequest() - assert args[0] == request_msg @@ -44266,7 +44161,6 @@ def test_delete_issue_comment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = secure_source_manager.DeleteIssueCommentRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-security-publicca/noxfile.py b/packages/google-cloud-security-publicca/noxfile.py index a31e0e12fd96..e7c9130eecea 100644 --- a/packages/google-cloud-security-publicca/noxfile.py +++ b/packages/google-cloud-security-publicca/noxfile.py @@ -47,7 +47,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-security-publicca" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-security-publicca/setup.py b/packages/google-cloud-security-publicca/setup.py index 317559136600..432b05c125f6 100644 --- a/packages/google-cloud-security-publicca/setup.py +++ b/packages/google-cloud-security-publicca/setup.py @@ -45,7 +45,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/google-cloud-security-publicca/testing/constraints-3.10.txt b/packages/google-cloud-security-publicca/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-security-publicca/testing/constraints-3.10.txt +++ b/packages/google-cloud-security-publicca/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-security-publicca/tests/unit/gapic/publicca_v1/test_public_certificate_authority_service.py b/packages/google-cloud-security-publicca/tests/unit/gapic/publicca_v1/test_public_certificate_authority_service.py index 5e2db8e07351..1ff6bd1fb228 100644 --- a/packages/google-cloud-security-publicca/tests/unit/gapic/publicca_v1/test_public_certificate_authority_service.py +++ b/packages/google-cloud-security-publicca/tests/unit/gapic/publicca_v1/test_public_certificate_authority_service.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 @@ -106,6 +107,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" @@ -1445,8 +1461,8 @@ def test_public_certificate_authority_service_client_create_channel_credentials_ @pytest.mark.parametrize( "request_type", [ - service.CreateExternalAccountKeyRequest, - dict, + service.CreateExternalAccountKeyRequest(), + {}, ], ) def test_create_external_account_key(request_type, transport: str = "grpc"): @@ -1457,7 +1473,7 @@ def test_create_external_account_key(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1509,9 +1525,10 @@ def test_create_external_account_key_non_empty_request_with_auto_populated_field client.create_external_account_key(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateExternalAccountKeyRequest( + request_msg = service.CreateExternalAccountKeyRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_external_account_key_use_cached_wrapped_rpc(): @@ -1597,9 +1614,15 @@ async def test_create_external_account_key_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.CreateExternalAccountKeyRequest(), + {}, + ], +) async def test_create_external_account_key_async( - transport: str = "grpc_asyncio", - request_type=service.CreateExternalAccountKeyRequest, + request_type, transport: str = "grpc_asyncio" ): client = PublicCertificateAuthorityServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1608,7 +1631,7 @@ async def test_create_external_account_key_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( @@ -1637,11 +1660,6 @@ async def test_create_external_account_key_async( assert response.b64_mac_key == b"b64_mac_key_blob" -@pytest.mark.asyncio -async def test_create_external_account_key_async_from_dict(): - await test_create_external_account_key_async(request_type=dict) - - def test_create_external_account_key_field_headers(): client = PublicCertificateAuthorityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2122,7 +2140,6 @@ def test_create_external_account_key_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateExternalAccountKeyRequest() - assert args[0] == request_msg @@ -2167,7 +2184,6 @@ async def test_create_external_account_key_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateExternalAccountKeyRequest() - assert args[0] == request_msg @@ -2418,7 +2434,6 @@ def test_create_external_account_key_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateExternalAccountKeyRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-security-publicca/tests/unit/gapic/publicca_v1beta1/test_public_certificate_authority_service.py b/packages/google-cloud-security-publicca/tests/unit/gapic/publicca_v1beta1/test_public_certificate_authority_service.py index a6d2e9e27dad..680449986736 100644 --- a/packages/google-cloud-security-publicca/tests/unit/gapic/publicca_v1beta1/test_public_certificate_authority_service.py +++ b/packages/google-cloud-security-publicca/tests/unit/gapic/publicca_v1beta1/test_public_certificate_authority_service.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 @@ -106,6 +107,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" @@ -1445,8 +1461,8 @@ def test_public_certificate_authority_service_client_create_channel_credentials_ @pytest.mark.parametrize( "request_type", [ - service.CreateExternalAccountKeyRequest, - dict, + service.CreateExternalAccountKeyRequest(), + {}, ], ) def test_create_external_account_key(request_type, transport: str = "grpc"): @@ -1457,7 +1473,7 @@ def test_create_external_account_key(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1509,9 +1525,10 @@ def test_create_external_account_key_non_empty_request_with_auto_populated_field client.create_external_account_key(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateExternalAccountKeyRequest( + request_msg = service.CreateExternalAccountKeyRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_external_account_key_use_cached_wrapped_rpc(): @@ -1597,9 +1614,15 @@ async def test_create_external_account_key_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.CreateExternalAccountKeyRequest(), + {}, + ], +) async def test_create_external_account_key_async( - transport: str = "grpc_asyncio", - request_type=service.CreateExternalAccountKeyRequest, + request_type, transport: str = "grpc_asyncio" ): client = PublicCertificateAuthorityServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1608,7 +1631,7 @@ async def test_create_external_account_key_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( @@ -1637,11 +1660,6 @@ async def test_create_external_account_key_async( assert response.b64_mac_key == b"b64_mac_key_blob" -@pytest.mark.asyncio -async def test_create_external_account_key_async_from_dict(): - await test_create_external_account_key_async(request_type=dict) - - def test_create_external_account_key_field_headers(): client = PublicCertificateAuthorityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2122,7 +2140,6 @@ def test_create_external_account_key_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateExternalAccountKeyRequest() - assert args[0] == request_msg @@ -2167,7 +2184,6 @@ async def test_create_external_account_key_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateExternalAccountKeyRequest() - assert args[0] == request_msg @@ -2418,7 +2434,6 @@ def test_create_external_account_key_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateExternalAccountKeyRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-securitycenter/noxfile.py b/packages/google-cloud-securitycenter/noxfile.py index 1a1c67c7a165..f0c5e28a829e 100644 --- a/packages/google-cloud-securitycenter/noxfile.py +++ b/packages/google-cloud-securitycenter/noxfile.py @@ -47,7 +47,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-securitycenter" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-securitycenter/setup.py b/packages/google-cloud-securitycenter/setup.py index 758086ed6104..8bf26ebefc2a 100644 --- a/packages/google-cloud-securitycenter/setup.py +++ b/packages/google-cloud-securitycenter/setup.py @@ -45,7 +45,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/google-cloud-securitycenter/testing/constraints-3.10.txt b/packages/google-cloud-securitycenter/testing/constraints-3.10.txt index a92801e1c8e2..b39cd54634f9 100644 --- a/packages/google-cloud-securitycenter/testing/constraints-3.10.txt +++ b/packages/google-cloud-securitycenter/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/google-cloud-securitycenter/tests/unit/gapic/securitycenter_v1/test_security_center.py b/packages/google-cloud-securitycenter/tests/unit/gapic/securitycenter_v1/test_security_center.py index bcdde00d69c1..8bfe26916f83 100644 --- a/packages/google-cloud-securitycenter/tests/unit/gapic/securitycenter_v1/test_security_center.py +++ b/packages/google-cloud-securitycenter/tests/unit/gapic/securitycenter_v1/test_security_center.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 @@ -194,6 +195,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" @@ -1397,8 +1413,8 @@ def test_security_center_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - securitycenter_service.BulkMuteFindingsRequest, - dict, + securitycenter_service.BulkMuteFindingsRequest(), + {}, ], ) def test_bulk_mute_findings(request_type, transport: str = "grpc"): @@ -1409,7 +1425,7 @@ def test_bulk_mute_findings(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1456,11 +1472,12 @@ def test_bulk_mute_findings_non_empty_request_with_auto_populated_field(): client.bulk_mute_findings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.BulkMuteFindingsRequest( + request_msg = securitycenter_service.BulkMuteFindingsRequest( parent="parent_value", filter="filter_value", mute_annotation="mute_annotation_value", ) + assert args[0] == request_msg def test_bulk_mute_findings_use_cached_wrapped_rpc(): @@ -1555,10 +1572,14 @@ async def test_bulk_mute_findings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_bulk_mute_findings_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.BulkMuteFindingsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.BulkMuteFindingsRequest(), + {}, + ], +) +async def test_bulk_mute_findings_async(request_type, transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1566,7 +1587,7 @@ async def test_bulk_mute_findings_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( @@ -1588,11 +1609,6 @@ async def test_bulk_mute_findings_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_bulk_mute_findings_async_from_dict(): - await test_bulk_mute_findings_async(request_type=dict) - - def test_bulk_mute_findings_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1747,8 +1763,8 @@ async def test_bulk_mute_findings_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.CreateSecurityHealthAnalyticsCustomModuleRequest, - dict, + securitycenter_service.CreateSecurityHealthAnalyticsCustomModuleRequest(), + {}, ], ) def test_create_security_health_analytics_custom_module( @@ -1761,7 +1777,7 @@ def test_create_security_health_analytics_custom_module( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1827,11 +1843,12 @@ def test_create_security_health_analytics_custom_module_non_empty_request_with_a client.create_security_health_analytics_custom_module(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == securitycenter_service.CreateSecurityHealthAnalyticsCustomModuleRequest( - parent="parent_value", + request_msg = ( + securitycenter_service.CreateSecurityHealthAnalyticsCustomModuleRequest( + parent="parent_value", + ) ) + assert args[0] == request_msg def test_create_security_health_analytics_custom_module_use_cached_wrapped_rpc(): @@ -1917,9 +1934,15 @@ async def test_create_security_health_analytics_custom_module_async_use_cached_w @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.CreateSecurityHealthAnalyticsCustomModuleRequest(), + {}, + ], +) async def test_create_security_health_analytics_custom_module_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.CreateSecurityHealthAnalyticsCustomModuleRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -1928,7 +1951,7 @@ async def test_create_security_health_analytics_custom_module_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( @@ -1970,11 +1993,6 @@ async def test_create_security_health_analytics_custom_module_async( assert response.ancestor_module == "ancestor_module_value" -@pytest.mark.asyncio -async def test_create_security_health_analytics_custom_module_async_from_dict(): - await test_create_security_health_analytics_custom_module_async(request_type=dict) - - def test_create_security_health_analytics_custom_module_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2155,8 +2173,8 @@ async def test_create_security_health_analytics_custom_module_flattened_error_as @pytest.mark.parametrize( "request_type", [ - securitycenter_service.CreateSourceRequest, - dict, + securitycenter_service.CreateSourceRequest(), + {}, ], ) def test_create_source(request_type, transport: str = "grpc"): @@ -2167,7 +2185,7 @@ def test_create_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(type(client.transport.create_source), "__call__") as call: @@ -2217,9 +2235,10 @@ def test_create_source_non_empty_request_with_auto_populated_field(): client.create_source(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.CreateSourceRequest( + request_msg = securitycenter_service.CreateSourceRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_source_use_cached_wrapped_rpc(): @@ -2300,10 +2319,14 @@ async def test_create_source_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_source_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.CreateSourceRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.CreateSourceRequest(), + {}, + ], +) +async def test_create_source_async(request_type, transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2311,7 +2334,7 @@ async def test_create_source_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_source), "__call__") as call: @@ -2340,11 +2363,6 @@ async def test_create_source_async( assert response.canonical_name == "canonical_name_value" -@pytest.mark.asyncio -async def test_create_source_async_from_dict(): - await test_create_source_async(request_type=dict) - - def test_create_source_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2497,8 +2515,8 @@ async def test_create_source_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.CreateFindingRequest, - dict, + securitycenter_service.CreateFindingRequest(), + {}, ], ) def test_create_finding(request_type, transport: str = "grpc"): @@ -2509,7 +2527,7 @@ def test_create_finding(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_finding), "__call__") as call: @@ -2582,10 +2600,11 @@ def test_create_finding_non_empty_request_with_auto_populated_field(): client.create_finding(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.CreateFindingRequest( + request_msg = securitycenter_service.CreateFindingRequest( parent="parent_value", finding_id="finding_id_value", ) + assert args[0] == request_msg def test_create_finding_use_cached_wrapped_rpc(): @@ -2666,10 +2685,14 @@ async def test_create_finding_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_finding_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.CreateFindingRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.CreateFindingRequest(), + {}, + ], +) +async def test_create_finding_async(request_type, transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2677,7 +2700,7 @@ async def test_create_finding_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_finding), "__call__") as call: @@ -2728,11 +2751,6 @@ async def test_create_finding_async( assert response.module_name == "module_name_value" -@pytest.mark.asyncio -async def test_create_finding_async_from_dict(): - await test_create_finding_async(request_type=dict) - - def test_create_finding_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2895,8 +2913,8 @@ async def test_create_finding_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.CreateMuteConfigRequest, - dict, + securitycenter_service.CreateMuteConfigRequest(), + {}, ], ) def test_create_mute_config(request_type, transport: str = "grpc"): @@ -2907,7 +2925,7 @@ def test_create_mute_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( @@ -2966,10 +2984,11 @@ def test_create_mute_config_non_empty_request_with_auto_populated_field(): client.create_mute_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.CreateMuteConfigRequest( + request_msg = securitycenter_service.CreateMuteConfigRequest( parent="parent_value", mute_config_id="mute_config_id_value", ) + assert args[0] == request_msg def test_create_mute_config_use_cached_wrapped_rpc(): @@ -3054,10 +3073,14 @@ async def test_create_mute_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_mute_config_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.CreateMuteConfigRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.CreateMuteConfigRequest(), + {}, + ], +) +async def test_create_mute_config_async(request_type, transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3065,7 +3088,7 @@ async def test_create_mute_config_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( @@ -3100,11 +3123,6 @@ async def test_create_mute_config_async( assert response.type_ == gcs_mute_config.MuteConfig.MuteConfigType.STATIC -@pytest.mark.asyncio -async def test_create_mute_config_async_from_dict(): - await test_create_mute_config_async(request_type=dict) - - def test_create_mute_config_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3279,8 +3297,8 @@ async def test_create_mute_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.CreateNotificationConfigRequest, - dict, + securitycenter_service.CreateNotificationConfigRequest(), + {}, ], ) def test_create_notification_config(request_type, transport: str = "grpc"): @@ -3291,7 +3309,7 @@ def test_create_notification_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( @@ -3346,10 +3364,11 @@ def test_create_notification_config_non_empty_request_with_auto_populated_field( client.create_notification_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.CreateNotificationConfigRequest( + request_msg = securitycenter_service.CreateNotificationConfigRequest( parent="parent_value", config_id="config_id_value", ) + assert args[0] == request_msg def test_create_notification_config_use_cached_wrapped_rpc(): @@ -3435,9 +3454,15 @@ async def test_create_notification_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.CreateNotificationConfigRequest(), + {}, + ], +) async def test_create_notification_config_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.CreateNotificationConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -3446,7 +3471,7 @@ async def test_create_notification_config_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( @@ -3477,11 +3502,6 @@ async def test_create_notification_config_async( assert response.service_account == "service_account_value" -@pytest.mark.asyncio -async def test_create_notification_config_async_from_dict(): - await test_create_notification_config_async(request_type=dict) - - def test_create_notification_config_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3664,8 +3684,8 @@ async def test_create_notification_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.DeleteMuteConfigRequest, - dict, + securitycenter_service.DeleteMuteConfigRequest(), + {}, ], ) def test_delete_mute_config(request_type, transport: str = "grpc"): @@ -3676,7 +3696,7 @@ def test_delete_mute_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( @@ -3721,9 +3741,10 @@ def test_delete_mute_config_non_empty_request_with_auto_populated_field(): client.delete_mute_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.DeleteMuteConfigRequest( + request_msg = securitycenter_service.DeleteMuteConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_mute_config_use_cached_wrapped_rpc(): @@ -3808,10 +3829,14 @@ async def test_delete_mute_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_mute_config_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.DeleteMuteConfigRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.DeleteMuteConfigRequest(), + {}, + ], +) +async def test_delete_mute_config_async(request_type, transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3819,7 +3844,7 @@ async def test_delete_mute_config_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( @@ -3839,11 +3864,6 @@ async def test_delete_mute_config_async( assert response is None -@pytest.mark.asyncio -async def test_delete_mute_config_async_from_dict(): - await test_delete_mute_config_async(request_type=dict) - - def test_delete_mute_config_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3994,8 +4014,8 @@ async def test_delete_mute_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.DeleteNotificationConfigRequest, - dict, + securitycenter_service.DeleteNotificationConfigRequest(), + {}, ], ) def test_delete_notification_config(request_type, transport: str = "grpc"): @@ -4006,7 +4026,7 @@ def test_delete_notification_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( @@ -4051,9 +4071,10 @@ def test_delete_notification_config_non_empty_request_with_auto_populated_field( client.delete_notification_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.DeleteNotificationConfigRequest( + request_msg = securitycenter_service.DeleteNotificationConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_notification_config_use_cached_wrapped_rpc(): @@ -4139,9 +4160,15 @@ async def test_delete_notification_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.DeleteNotificationConfigRequest(), + {}, + ], +) async def test_delete_notification_config_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.DeleteNotificationConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -4150,7 +4177,7 @@ async def test_delete_notification_config_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( @@ -4170,11 +4197,6 @@ async def test_delete_notification_config_async( assert response is None -@pytest.mark.asyncio -async def test_delete_notification_config_async_from_dict(): - await test_delete_notification_config_async(request_type=dict) - - def test_delete_notification_config_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4325,8 +4347,8 @@ async def test_delete_notification_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.DeleteSecurityHealthAnalyticsCustomModuleRequest, - dict, + securitycenter_service.DeleteSecurityHealthAnalyticsCustomModuleRequest(), + {}, ], ) def test_delete_security_health_analytics_custom_module( @@ -4339,7 +4361,7 @@ def test_delete_security_health_analytics_custom_module( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4388,11 +4410,12 @@ def test_delete_security_health_analytics_custom_module_non_empty_request_with_a client.delete_security_health_analytics_custom_module(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == securitycenter_service.DeleteSecurityHealthAnalyticsCustomModuleRequest( - name="name_value", + request_msg = ( + securitycenter_service.DeleteSecurityHealthAnalyticsCustomModuleRequest( + name="name_value", + ) ) + assert args[0] == request_msg def test_delete_security_health_analytics_custom_module_use_cached_wrapped_rpc(): @@ -4478,9 +4501,15 @@ async def test_delete_security_health_analytics_custom_module_async_use_cached_w @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.DeleteSecurityHealthAnalyticsCustomModuleRequest(), + {}, + ], +) async def test_delete_security_health_analytics_custom_module_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.DeleteSecurityHealthAnalyticsCustomModuleRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -4489,7 +4518,7 @@ async def test_delete_security_health_analytics_custom_module_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( @@ -4512,11 +4541,6 @@ async def test_delete_security_health_analytics_custom_module_async( assert response is None -@pytest.mark.asyncio -async def test_delete_security_health_analytics_custom_module_async_from_dict(): - await test_delete_security_health_analytics_custom_module_async(request_type=dict) - - def test_delete_security_health_analytics_custom_module_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4671,8 +4695,8 @@ async def test_delete_security_health_analytics_custom_module_flattened_error_as @pytest.mark.parametrize( "request_type", [ - securitycenter_service.GetSimulationRequest, - dict, + securitycenter_service.GetSimulationRequest(), + {}, ], ) def test_get_simulation(request_type, transport: str = "grpc"): @@ -4683,7 +4707,7 @@ def test_get_simulation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_simulation), "__call__") as call: @@ -4729,9 +4753,10 @@ def test_get_simulation_non_empty_request_with_auto_populated_field(): client.get_simulation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.GetSimulationRequest( + request_msg = securitycenter_service.GetSimulationRequest( name="name_value", ) + assert args[0] == request_msg def test_get_simulation_use_cached_wrapped_rpc(): @@ -4812,10 +4837,14 @@ async def test_get_simulation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_simulation_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.GetSimulationRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.GetSimulationRequest(), + {}, + ], +) +async def test_get_simulation_async(request_type, transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4823,7 +4852,7 @@ async def test_get_simulation_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_simulation), "__call__") as call: @@ -4848,11 +4877,6 @@ async def test_get_simulation_async( assert response.cloud_provider == resource.CloudProvider.GOOGLE_CLOUD_PLATFORM -@pytest.mark.asyncio -async def test_get_simulation_async_from_dict(): - await test_get_simulation_async(request_type=dict) - - def test_get_simulation_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4999,8 +5023,8 @@ async def test_get_simulation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.GetValuedResourceRequest, - dict, + securitycenter_service.GetValuedResourceRequest(), + {}, ], ) def test_get_valued_resource(request_type, transport: str = "grpc"): @@ -5011,7 +5035,7 @@ def test_get_valued_resource(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5072,9 +5096,10 @@ def test_get_valued_resource_non_empty_request_with_auto_populated_field(): client.get_valued_resource(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.GetValuedResourceRequest( + request_msg = securitycenter_service.GetValuedResourceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_valued_resource_use_cached_wrapped_rpc(): @@ -5159,10 +5184,14 @@ async def test_get_valued_resource_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_valued_resource_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.GetValuedResourceRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.GetValuedResourceRequest(), + {}, + ], +) +async def test_get_valued_resource_async(request_type, transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5170,7 +5199,7 @@ async def test_get_valued_resource_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( @@ -5208,11 +5237,6 @@ async def test_get_valued_resource_async( assert math.isclose(response.exposed_score, 0.1395, rel_tol=1e-6) -@pytest.mark.asyncio -async def test_get_valued_resource_async_from_dict(): - await test_get_valued_resource_async(request_type=dict) - - def test_get_valued_resource_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5367,8 +5391,8 @@ async def test_get_valued_resource_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.GetBigQueryExportRequest, - dict, + securitycenter_service.GetBigQueryExportRequest(), + {}, ], ) def test_get_big_query_export(request_type, transport: str = "grpc"): @@ -5379,7 +5403,7 @@ def test_get_big_query_export(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5437,9 +5461,10 @@ def test_get_big_query_export_non_empty_request_with_auto_populated_field(): client.get_big_query_export(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.GetBigQueryExportRequest( + request_msg = securitycenter_service.GetBigQueryExportRequest( name="name_value", ) + assert args[0] == request_msg def test_get_big_query_export_use_cached_wrapped_rpc(): @@ -5524,9 +5549,15 @@ async def test_get_big_query_export_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.GetBigQueryExportRequest(), + {}, + ], +) async def test_get_big_query_export_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.GetBigQueryExportRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -5535,7 +5566,7 @@ async def test_get_big_query_export_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( @@ -5570,11 +5601,6 @@ async def test_get_big_query_export_async( assert response.principal == "principal_value" -@pytest.mark.asyncio -async def test_get_big_query_export_async_from_dict(): - await test_get_big_query_export_async(request_type=dict) - - def test_get_big_query_export_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5729,8 +5755,8 @@ async def test_get_big_query_export_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.GetIamPolicyRequest, - dict, + iam_policy_pb2.GetIamPolicyRequest(), + {}, ], ) def test_get_iam_policy(request_type, transport: str = "grpc"): @@ -5741,7 +5767,7 @@ def test_get_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(type(client.transport.get_iam_policy), "__call__") as call: @@ -5787,9 +5813,10 @@ def test_get_iam_policy_non_empty_request_with_auto_populated_field(): client.get_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.GetIamPolicyRequest( + request_msg = iam_policy_pb2.GetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_get_iam_policy_use_cached_wrapped_rpc(): @@ -5870,9 +5897,14 @@ async def test_get_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.GetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.GetIamPolicyRequest(), + {}, + ], +) +async def test_get_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5880,7 +5912,7 @@ async def test_get_iam_policy_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_iam_policy), "__call__") as call: @@ -5905,11 +5937,6 @@ async def test_get_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_get_iam_policy_async_from_dict(): - await test_get_iam_policy_async(request_type=dict) - - def test_get_iam_policy_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6069,8 +6096,8 @@ async def test_get_iam_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.GetMuteConfigRequest, - dict, + securitycenter_service.GetMuteConfigRequest(), + {}, ], ) def test_get_mute_config(request_type, transport: str = "grpc"): @@ -6081,7 +6108,7 @@ def test_get_mute_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(type(client.transport.get_mute_config), "__call__") as call: @@ -6135,9 +6162,10 @@ def test_get_mute_config_non_empty_request_with_auto_populated_field(): client.get_mute_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.GetMuteConfigRequest( + request_msg = securitycenter_service.GetMuteConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_mute_config_use_cached_wrapped_rpc(): @@ -6218,10 +6246,14 @@ async def test_get_mute_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_mute_config_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.GetMuteConfigRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.GetMuteConfigRequest(), + {}, + ], +) +async def test_get_mute_config_async(request_type, transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6229,7 +6261,7 @@ async def test_get_mute_config_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_mute_config), "__call__") as call: @@ -6262,11 +6294,6 @@ async def test_get_mute_config_async( assert response.type_ == mute_config.MuteConfig.MuteConfigType.STATIC -@pytest.mark.asyncio -async def test_get_mute_config_async_from_dict(): - await test_get_mute_config_async(request_type=dict) - - def test_get_mute_config_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6413,8 +6440,8 @@ async def test_get_mute_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.GetNotificationConfigRequest, - dict, + securitycenter_service.GetNotificationConfigRequest(), + {}, ], ) def test_get_notification_config(request_type, transport: str = "grpc"): @@ -6425,7 +6452,7 @@ def test_get_notification_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( @@ -6479,9 +6506,10 @@ def test_get_notification_config_non_empty_request_with_auto_populated_field(): client.get_notification_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.GetNotificationConfigRequest( + request_msg = securitycenter_service.GetNotificationConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_notification_config_use_cached_wrapped_rpc(): @@ -6567,9 +6595,15 @@ async def test_get_notification_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.GetNotificationConfigRequest(), + {}, + ], +) async def test_get_notification_config_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.GetNotificationConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -6578,7 +6612,7 @@ async def test_get_notification_config_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( @@ -6609,11 +6643,6 @@ async def test_get_notification_config_async( assert response.service_account == "service_account_value" -@pytest.mark.asyncio -async def test_get_notification_config_async_from_dict(): - await test_get_notification_config_async(request_type=dict) - - def test_get_notification_config_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6768,8 +6797,8 @@ async def test_get_notification_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.GetOrganizationSettingsRequest, - dict, + securitycenter_service.GetOrganizationSettingsRequest(), + {}, ], ) def test_get_organization_settings(request_type, transport: str = "grpc"): @@ -6780,7 +6809,7 @@ def test_get_organization_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( @@ -6830,9 +6859,10 @@ def test_get_organization_settings_non_empty_request_with_auto_populated_field() client.get_organization_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.GetOrganizationSettingsRequest( + request_msg = securitycenter_service.GetOrganizationSettingsRequest( name="name_value", ) + assert args[0] == request_msg def test_get_organization_settings_use_cached_wrapped_rpc(): @@ -6918,9 +6948,15 @@ async def test_get_organization_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.GetOrganizationSettingsRequest(), + {}, + ], +) async def test_get_organization_settings_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.GetOrganizationSettingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -6929,7 +6965,7 @@ async def test_get_organization_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( @@ -6956,11 +6992,6 @@ async def test_get_organization_settings_async( assert response.enable_asset_discovery is True -@pytest.mark.asyncio -async def test_get_organization_settings_async_from_dict(): - await test_get_organization_settings_async(request_type=dict) - - def test_get_organization_settings_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7115,8 +7146,8 @@ async def test_get_organization_settings_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.GetEffectiveSecurityHealthAnalyticsCustomModuleRequest, - dict, + securitycenter_service.GetEffectiveSecurityHealthAnalyticsCustomModuleRequest(), + {}, ], ) def test_get_effective_security_health_analytics_custom_module( @@ -7129,7 +7160,7 @@ def test_get_effective_security_health_analytics_custom_module( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7191,12 +7222,10 @@ def test_get_effective_security_health_analytics_custom_module_non_empty_request client.get_effective_security_health_analytics_custom_module(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert ( - args[0] - == securitycenter_service.GetEffectiveSecurityHealthAnalyticsCustomModuleRequest( - name="name_value", - ) + request_msg = securitycenter_service.GetEffectiveSecurityHealthAnalyticsCustomModuleRequest( + name="name_value", ) + assert args[0] == request_msg def test_get_effective_security_health_analytics_custom_module_use_cached_wrapped_rpc(): @@ -7282,9 +7311,15 @@ async def test_get_effective_security_health_analytics_custom_module_async_use_c @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.GetEffectiveSecurityHealthAnalyticsCustomModuleRequest(), + {}, + ], +) async def test_get_effective_security_health_analytics_custom_module_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.GetEffectiveSecurityHealthAnalyticsCustomModuleRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -7293,7 +7328,7 @@ async def test_get_effective_security_health_analytics_custom_module_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( @@ -7331,13 +7366,6 @@ async def test_get_effective_security_health_analytics_custom_module_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_get_effective_security_health_analytics_custom_module_async_from_dict(): - await test_get_effective_security_health_analytics_custom_module_async( - request_type=dict - ) - - def test_get_effective_security_health_analytics_custom_module_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7500,8 +7528,8 @@ async def test_get_effective_security_health_analytics_custom_module_flattened_e @pytest.mark.parametrize( "request_type", [ - securitycenter_service.GetSecurityHealthAnalyticsCustomModuleRequest, - dict, + securitycenter_service.GetSecurityHealthAnalyticsCustomModuleRequest(), + {}, ], ) def test_get_security_health_analytics_custom_module( @@ -7514,7 +7542,7 @@ def test_get_security_health_analytics_custom_module( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7576,11 +7604,12 @@ def test_get_security_health_analytics_custom_module_non_empty_request_with_auto client.get_security_health_analytics_custom_module(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == securitycenter_service.GetSecurityHealthAnalyticsCustomModuleRequest( - name="name_value", + request_msg = ( + securitycenter_service.GetSecurityHealthAnalyticsCustomModuleRequest( + name="name_value", + ) ) + assert args[0] == request_msg def test_get_security_health_analytics_custom_module_use_cached_wrapped_rpc(): @@ -7666,9 +7695,15 @@ async def test_get_security_health_analytics_custom_module_async_use_cached_wrap @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.GetSecurityHealthAnalyticsCustomModuleRequest(), + {}, + ], +) async def test_get_security_health_analytics_custom_module_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.GetSecurityHealthAnalyticsCustomModuleRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -7677,7 +7712,7 @@ async def test_get_security_health_analytics_custom_module_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( @@ -7716,11 +7751,6 @@ async def test_get_security_health_analytics_custom_module_async( assert response.ancestor_module == "ancestor_module_value" -@pytest.mark.asyncio -async def test_get_security_health_analytics_custom_module_async_from_dict(): - await test_get_security_health_analytics_custom_module_async(request_type=dict) - - def test_get_security_health_analytics_custom_module_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7875,8 +7905,8 @@ async def test_get_security_health_analytics_custom_module_flattened_error_async @pytest.mark.parametrize( "request_type", [ - securitycenter_service.GetSourceRequest, - dict, + securitycenter_service.GetSourceRequest(), + {}, ], ) def test_get_source(request_type, transport: str = "grpc"): @@ -7887,7 +7917,7 @@ def test_get_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(type(client.transport.get_source), "__call__") as call: @@ -7937,9 +7967,10 @@ def test_get_source_non_empty_request_with_auto_populated_field(): client.get_source(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.GetSourceRequest( + request_msg = securitycenter_service.GetSourceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_source_use_cached_wrapped_rpc(): @@ -8018,10 +8049,14 @@ async def test_get_source_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_source_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.GetSourceRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.GetSourceRequest(), + {}, + ], +) +async def test_get_source_async(request_type, transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8029,7 +8064,7 @@ async def test_get_source_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_source), "__call__") as call: @@ -8058,11 +8093,6 @@ async def test_get_source_async( assert response.canonical_name == "canonical_name_value" -@pytest.mark.asyncio -async def test_get_source_async_from_dict(): - await test_get_source_async(request_type=dict) - - def test_get_source_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8205,8 +8235,8 @@ async def test_get_source_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.GroupAssetsRequest, - dict, + securitycenter_service.GroupAssetsRequest(), + {}, ], ) def test_group_assets(request_type, transport: str = "grpc"): @@ -8217,7 +8247,7 @@ def test_group_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(type(client.transport.group_assets), "__call__") as call: @@ -8266,12 +8296,13 @@ def test_group_assets_non_empty_request_with_auto_populated_field(): client.group_assets(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.GroupAssetsRequest( + request_msg = securitycenter_service.GroupAssetsRequest( parent="parent_value", filter="filter_value", group_by="group_by_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_group_assets_use_cached_wrapped_rpc(): @@ -8352,10 +8383,14 @@ async def test_group_assets_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_group_assets_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.GroupAssetsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.GroupAssetsRequest(), + {}, + ], +) +async def test_group_assets_async(request_type, transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8363,7 +8398,7 @@ async def test_group_assets_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.group_assets), "__call__") as call: @@ -8388,11 +8423,6 @@ async def test_group_assets_async( assert response.total_size == 1086 -@pytest.mark.asyncio -async def test_group_assets_async_from_dict(): - await test_group_assets_async(request_type=dict) - - def test_group_assets_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8647,8 +8677,8 @@ async def test_group_assets_async_pages(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.GroupFindingsRequest, - dict, + securitycenter_service.GroupFindingsRequest(), + {}, ], ) def test_group_findings(request_type, transport: str = "grpc"): @@ -8659,7 +8689,7 @@ def test_group_findings(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.group_findings), "__call__") as call: @@ -8708,12 +8738,13 @@ def test_group_findings_non_empty_request_with_auto_populated_field(): client.group_findings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.GroupFindingsRequest( + request_msg = securitycenter_service.GroupFindingsRequest( parent="parent_value", filter="filter_value", group_by="group_by_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_group_findings_use_cached_wrapped_rpc(): @@ -8794,10 +8825,14 @@ async def test_group_findings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_group_findings_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.GroupFindingsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.GroupFindingsRequest(), + {}, + ], +) +async def test_group_findings_async(request_type, transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8805,7 +8840,7 @@ async def test_group_findings_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.group_findings), "__call__") as call: @@ -8830,11 +8865,6 @@ async def test_group_findings_async( assert response.total_size == 1086 -@pytest.mark.asyncio -async def test_group_findings_async_from_dict(): - await test_group_findings_async(request_type=dict) - - def test_group_findings_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9181,8 +9211,8 @@ async def test_group_findings_async_pages(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.ListAssetsRequest, - dict, + securitycenter_service.ListAssetsRequest(), + {}, ], ) def test_list_assets(request_type, transport: str = "grpc"): @@ -9193,7 +9223,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(type(client.transport.list_assets), "__call__") as call: @@ -9242,12 +9272,13 @@ 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] == securitycenter_service.ListAssetsRequest( + request_msg = securitycenter_service.ListAssetsRequest( parent="parent_value", filter="filter_value", order_by="order_by_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_assets_use_cached_wrapped_rpc(): @@ -9328,10 +9359,14 @@ async def test_list_assets_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_assets_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.ListAssetsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.ListAssetsRequest(), + {}, + ], +) +async def test_list_assets_async(request_type, transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9339,7 +9374,7 @@ async def test_list_assets_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_assets), "__call__") as call: @@ -9364,11 +9399,6 @@ async def test_list_assets_async( assert response.total_size == 1086 -@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 = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9629,8 +9659,8 @@ async def test_list_assets_async_pages(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.ListDescendantSecurityHealthAnalyticsCustomModulesRequest, - dict, + securitycenter_service.ListDescendantSecurityHealthAnalyticsCustomModulesRequest(), + {}, ], ) def test_list_descendant_security_health_analytics_custom_modules( @@ -9643,7 +9673,7 @@ def test_list_descendant_security_health_analytics_custom_modules( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9698,13 +9728,11 @@ def test_list_descendant_security_health_analytics_custom_modules_non_empty_requ client.list_descendant_security_health_analytics_custom_modules(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert ( - args[0] - == securitycenter_service.ListDescendantSecurityHealthAnalyticsCustomModulesRequest( - parent="parent_value", - page_token="page_token_value", - ) + request_msg = securitycenter_service.ListDescendantSecurityHealthAnalyticsCustomModulesRequest( + parent="parent_value", + page_token="page_token_value", ) + assert args[0] == request_msg def test_list_descendant_security_health_analytics_custom_modules_use_cached_wrapped_rpc(): @@ -9790,9 +9818,15 @@ async def test_list_descendant_security_health_analytics_custom_modules_async_us @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.ListDescendantSecurityHealthAnalyticsCustomModulesRequest(), + {}, + ], +) async def test_list_descendant_security_health_analytics_custom_modules_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.ListDescendantSecurityHealthAnalyticsCustomModulesRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -9801,7 +9835,7 @@ async def test_list_descendant_security_health_analytics_custom_modules_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( @@ -9833,13 +9867,6 @@ async def test_list_descendant_security_health_analytics_custom_modules_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_descendant_security_health_analytics_custom_modules_async_from_dict(): - await test_list_descendant_security_health_analytics_custom_modules_async( - request_type=dict - ) - - def test_list_descendant_security_health_analytics_custom_modules_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10228,8 +10255,8 @@ async def test_list_descendant_security_health_analytics_custom_modules_async_pa @pytest.mark.parametrize( "request_type", [ - securitycenter_service.ListFindingsRequest, - dict, + securitycenter_service.ListFindingsRequest(), + {}, ], ) def test_list_findings(request_type, transport: str = "grpc"): @@ -10240,7 +10267,7 @@ def test_list_findings(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_findings), "__call__") as call: @@ -10289,12 +10316,13 @@ def test_list_findings_non_empty_request_with_auto_populated_field(): client.list_findings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.ListFindingsRequest( + request_msg = securitycenter_service.ListFindingsRequest( parent="parent_value", filter="filter_value", order_by="order_by_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_findings_use_cached_wrapped_rpc(): @@ -10375,10 +10403,14 @@ async def test_list_findings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_findings_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.ListFindingsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.ListFindingsRequest(), + {}, + ], +) +async def test_list_findings_async(request_type, transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10386,7 +10418,7 @@ async def test_list_findings_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_findings), "__call__") as call: @@ -10411,11 +10443,6 @@ async def test_list_findings_async( assert response.total_size == 1086 -@pytest.mark.asyncio -async def test_list_findings_async_from_dict(): - await test_list_findings_async(request_type=dict) - - def test_list_findings_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10680,8 +10707,8 @@ async def test_list_findings_async_pages(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.ListMuteConfigsRequest, - dict, + securitycenter_service.ListMuteConfigsRequest(), + {}, ], ) def test_list_mute_configs(request_type, transport: str = "grpc"): @@ -10692,7 +10719,7 @@ def test_list_mute_configs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10741,10 +10768,11 @@ def test_list_mute_configs_non_empty_request_with_auto_populated_field(): client.list_mute_configs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.ListMuteConfigsRequest( + request_msg = securitycenter_service.ListMuteConfigsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_mute_configs_use_cached_wrapped_rpc(): @@ -10827,10 +10855,14 @@ async def test_list_mute_configs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_mute_configs_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.ListMuteConfigsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.ListMuteConfigsRequest(), + {}, + ], +) +async def test_list_mute_configs_async(request_type, transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10838,7 +10870,7 @@ async def test_list_mute_configs_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( @@ -10863,11 +10895,6 @@ async def test_list_mute_configs_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_mute_configs_async_from_dict(): - await test_list_mute_configs_async(request_type=dict) - - def test_list_mute_configs_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11220,8 +11247,8 @@ async def test_list_mute_configs_async_pages(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.ListNotificationConfigsRequest, - dict, + securitycenter_service.ListNotificationConfigsRequest(), + {}, ], ) def test_list_notification_configs(request_type, transport: str = "grpc"): @@ -11232,7 +11259,7 @@ def test_list_notification_configs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11281,10 +11308,11 @@ def test_list_notification_configs_non_empty_request_with_auto_populated_field() client.list_notification_configs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.ListNotificationConfigsRequest( + request_msg = securitycenter_service.ListNotificationConfigsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_notification_configs_use_cached_wrapped_rpc(): @@ -11370,9 +11398,15 @@ async def test_list_notification_configs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.ListNotificationConfigsRequest(), + {}, + ], +) async def test_list_notification_configs_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.ListNotificationConfigsRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -11381,7 +11415,7 @@ async def test_list_notification_configs_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( @@ -11406,11 +11440,6 @@ async def test_list_notification_configs_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_notification_configs_async_from_dict(): - await test_list_notification_configs_async(request_type=dict) - - def test_list_notification_configs_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11769,8 +11798,8 @@ async def test_list_notification_configs_async_pages(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.ListEffectiveSecurityHealthAnalyticsCustomModulesRequest, - dict, + securitycenter_service.ListEffectiveSecurityHealthAnalyticsCustomModulesRequest(), + {}, ], ) def test_list_effective_security_health_analytics_custom_modules( @@ -11783,7 +11812,7 @@ def test_list_effective_security_health_analytics_custom_modules( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11840,13 +11869,11 @@ def test_list_effective_security_health_analytics_custom_modules_non_empty_reque client.list_effective_security_health_analytics_custom_modules(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert ( - args[0] - == securitycenter_service.ListEffectiveSecurityHealthAnalyticsCustomModulesRequest( - parent="parent_value", - page_token="page_token_value", - ) + request_msg = securitycenter_service.ListEffectiveSecurityHealthAnalyticsCustomModulesRequest( + parent="parent_value", + page_token="page_token_value", ) + assert args[0] == request_msg def test_list_effective_security_health_analytics_custom_modules_use_cached_wrapped_rpc(): @@ -11932,9 +11959,15 @@ async def test_list_effective_security_health_analytics_custom_modules_async_use @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.ListEffectiveSecurityHealthAnalyticsCustomModulesRequest(), + {}, + ], +) async def test_list_effective_security_health_analytics_custom_modules_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.ListEffectiveSecurityHealthAnalyticsCustomModulesRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -11943,7 +11976,7 @@ async def test_list_effective_security_health_analytics_custom_modules_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( @@ -11973,13 +12006,6 @@ async def test_list_effective_security_health_analytics_custom_modules_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_effective_security_health_analytics_custom_modules_async_from_dict(): - await test_list_effective_security_health_analytics_custom_modules_async( - request_type=dict - ) - - def test_list_effective_security_health_analytics_custom_modules_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12366,8 +12392,8 @@ async def test_list_effective_security_health_analytics_custom_modules_async_pag @pytest.mark.parametrize( "request_type", [ - securitycenter_service.ListSecurityHealthAnalyticsCustomModulesRequest, - dict, + securitycenter_service.ListSecurityHealthAnalyticsCustomModulesRequest(), + {}, ], ) def test_list_security_health_analytics_custom_modules( @@ -12380,7 +12406,7 @@ def test_list_security_health_analytics_custom_modules( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -12433,12 +12459,13 @@ def test_list_security_health_analytics_custom_modules_non_empty_request_with_au client.list_security_health_analytics_custom_modules(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == securitycenter_service.ListSecurityHealthAnalyticsCustomModulesRequest( - parent="parent_value", - page_token="page_token_value", + request_msg = ( + securitycenter_service.ListSecurityHealthAnalyticsCustomModulesRequest( + parent="parent_value", + page_token="page_token_value", + ) ) + assert args[0] == request_msg def test_list_security_health_analytics_custom_modules_use_cached_wrapped_rpc(): @@ -12524,9 +12551,15 @@ async def test_list_security_health_analytics_custom_modules_async_use_cached_wr @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.ListSecurityHealthAnalyticsCustomModulesRequest(), + {}, + ], +) async def test_list_security_health_analytics_custom_modules_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.ListSecurityHealthAnalyticsCustomModulesRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -12535,7 +12568,7 @@ async def test_list_security_health_analytics_custom_modules_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( @@ -12564,11 +12597,6 @@ async def test_list_security_health_analytics_custom_modules_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_security_health_analytics_custom_modules_async_from_dict(): - await test_list_security_health_analytics_custom_modules_async(request_type=dict) - - def test_list_security_health_analytics_custom_modules_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12949,8 +12977,8 @@ async def test_list_security_health_analytics_custom_modules_async_pages(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.ListSourcesRequest, - dict, + securitycenter_service.ListSourcesRequest(), + {}, ], ) def test_list_sources(request_type, transport: str = "grpc"): @@ -12961,7 +12989,7 @@ def test_list_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(type(client.transport.list_sources), "__call__") as call: @@ -13006,10 +13034,11 @@ def test_list_sources_non_empty_request_with_auto_populated_field(): client.list_sources(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.ListSourcesRequest( + request_msg = securitycenter_service.ListSourcesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_sources_use_cached_wrapped_rpc(): @@ -13090,10 +13119,14 @@ async def test_list_sources_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_sources_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.ListSourcesRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.ListSourcesRequest(), + {}, + ], +) +async def test_list_sources_async(request_type, transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13101,7 +13134,7 @@ async def test_list_sources_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_sources), "__call__") as call: @@ -13124,11 +13157,6 @@ async def test_list_sources_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_sources_async_from_dict(): - await test_list_sources_async(request_type=dict) - - def test_list_sources_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13465,8 +13493,8 @@ async def test_list_sources_async_pages(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.RunAssetDiscoveryRequest, - dict, + securitycenter_service.RunAssetDiscoveryRequest(), + {}, ], ) def test_run_asset_discovery(request_type, transport: str = "grpc"): @@ -13477,7 +13505,7 @@ def test_run_asset_discovery(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -13522,9 +13550,10 @@ def test_run_asset_discovery_non_empty_request_with_auto_populated_field(): client.run_asset_discovery(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.RunAssetDiscoveryRequest( + request_msg = securitycenter_service.RunAssetDiscoveryRequest( parent="parent_value", ) + assert args[0] == request_msg def test_run_asset_discovery_use_cached_wrapped_rpc(): @@ -13619,10 +13648,14 @@ async def test_run_asset_discovery_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_run_asset_discovery_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.RunAssetDiscoveryRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.RunAssetDiscoveryRequest(), + {}, + ], +) +async def test_run_asset_discovery_async(request_type, transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13630,7 +13663,7 @@ async def test_run_asset_discovery_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( @@ -13652,11 +13685,6 @@ async def test_run_asset_discovery_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_run_asset_discovery_async_from_dict(): - await test_run_asset_discovery_async(request_type=dict) - - def test_run_asset_discovery_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13811,8 +13839,8 @@ async def test_run_asset_discovery_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.SetFindingStateRequest, - dict, + securitycenter_service.SetFindingStateRequest(), + {}, ], ) def test_set_finding_state(request_type, transport: str = "grpc"): @@ -13823,7 +13851,7 @@ def test_set_finding_state(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -13899,9 +13927,10 @@ def test_set_finding_state_non_empty_request_with_auto_populated_field(): client.set_finding_state(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.SetFindingStateRequest( + request_msg = securitycenter_service.SetFindingStateRequest( name="name_value", ) + assert args[0] == request_msg def test_set_finding_state_use_cached_wrapped_rpc(): @@ -13984,10 +14013,14 @@ async def test_set_finding_state_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_finding_state_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.SetFindingStateRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.SetFindingStateRequest(), + {}, + ], +) +async def test_set_finding_state_async(request_type, transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13995,7 +14028,7 @@ async def test_set_finding_state_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( @@ -14048,11 +14081,6 @@ async def test_set_finding_state_async( assert response.module_name == "module_name_value" -@pytest.mark.asyncio -async def test_set_finding_state_async_from_dict(): - await test_set_finding_state_async(request_type=dict) - - def test_set_finding_state_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14223,8 +14251,8 @@ async def test_set_finding_state_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.SetMuteRequest, - dict, + securitycenter_service.SetMuteRequest(), + {}, ], ) def test_set_mute(request_type, transport: str = "grpc"): @@ -14235,7 +14263,7 @@ def test_set_mute(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.set_mute), "__call__") as call: @@ -14307,9 +14335,10 @@ def test_set_mute_non_empty_request_with_auto_populated_field(): client.set_mute(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.SetMuteRequest( + request_msg = securitycenter_service.SetMuteRequest( name="name_value", ) + assert args[0] == request_msg def test_set_mute_use_cached_wrapped_rpc(): @@ -14388,9 +14417,14 @@ async def test_set_mute_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn @pytest.mark.asyncio -async def test_set_mute_async( - transport: str = "grpc_asyncio", request_type=securitycenter_service.SetMuteRequest -): +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.SetMuteRequest(), + {}, + ], +) +async def test_set_mute_async(request_type, transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14398,7 +14432,7 @@ async def test_set_mute_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.set_mute), "__call__") as call: @@ -14449,11 +14483,6 @@ async def test_set_mute_async( assert response.module_name == "module_name_value" -@pytest.mark.asyncio -async def test_set_mute_async_from_dict(): - await test_set_mute_async(request_type=dict) - - def test_set_mute_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14606,8 +14635,8 @@ async def test_set_mute_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.SetIamPolicyRequest, - dict, + iam_policy_pb2.SetIamPolicyRequest(), + {}, ], ) def test_set_iam_policy(request_type, transport: str = "grpc"): @@ -14618,7 +14647,7 @@ def test_set_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(type(client.transport.set_iam_policy), "__call__") as call: @@ -14664,9 +14693,10 @@ def test_set_iam_policy_non_empty_request_with_auto_populated_field(): client.set_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.SetIamPolicyRequest( + request_msg = iam_policy_pb2.SetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_set_iam_policy_use_cached_wrapped_rpc(): @@ -14747,9 +14777,14 @@ async def test_set_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.SetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.SetIamPolicyRequest(), + {}, + ], +) +async def test_set_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14757,7 +14792,7 @@ async def test_set_iam_policy_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.set_iam_policy), "__call__") as call: @@ -14782,11 +14817,6 @@ async def test_set_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_set_iam_policy_async_from_dict(): - await test_set_iam_policy_async(request_type=dict) - - def test_set_iam_policy_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14947,8 +14977,8 @@ async def test_set_iam_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.TestIamPermissionsRequest, - dict, + iam_policy_pb2.TestIamPermissionsRequest(), + {}, ], ) def test_test_iam_permissions(request_type, transport: str = "grpc"): @@ -14959,7 +14989,7 @@ def test_test_iam_permissions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -15007,9 +15037,10 @@ def test_test_iam_permissions_non_empty_request_with_auto_populated_field(): client.test_iam_permissions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.TestIamPermissionsRequest( + request_msg = iam_policy_pb2.TestIamPermissionsRequest( resource="resource_value", ) + assert args[0] == request_msg def test_test_iam_permissions_use_cached_wrapped_rpc(): @@ -15094,9 +15125,15 @@ async def test_test_iam_permissions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.TestIamPermissionsRequest(), + {}, + ], +) async def test_test_iam_permissions_async( - transport: str = "grpc_asyncio", - request_type=iam_policy_pb2.TestIamPermissionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -15105,7 +15142,7 @@ async def test_test_iam_permissions_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( @@ -15130,11 +15167,6 @@ async def test_test_iam_permissions_async( assert response.permissions == ["permissions_value"] -@pytest.mark.asyncio -async def test_test_iam_permissions_async_from_dict(): - await test_test_iam_permissions_async(request_type=dict) - - def test_test_iam_permissions_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15318,8 +15350,8 @@ async def test_test_iam_permissions_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.SimulateSecurityHealthAnalyticsCustomModuleRequest, - dict, + securitycenter_service.SimulateSecurityHealthAnalyticsCustomModuleRequest(), + {}, ], ) def test_simulate_security_health_analytics_custom_module( @@ -15332,7 +15364,7 @@ def test_simulate_security_health_analytics_custom_module( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -15386,11 +15418,12 @@ def test_simulate_security_health_analytics_custom_module_non_empty_request_with client.simulate_security_health_analytics_custom_module(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == securitycenter_service.SimulateSecurityHealthAnalyticsCustomModuleRequest( - parent="parent_value", + request_msg = ( + securitycenter_service.SimulateSecurityHealthAnalyticsCustomModuleRequest( + parent="parent_value", + ) ) + assert args[0] == request_msg def test_simulate_security_health_analytics_custom_module_use_cached_wrapped_rpc(): @@ -15476,9 +15509,15 @@ async def test_simulate_security_health_analytics_custom_module_async_use_cached @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.SimulateSecurityHealthAnalyticsCustomModuleRequest(), + {}, + ], +) async def test_simulate_security_health_analytics_custom_module_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.SimulateSecurityHealthAnalyticsCustomModuleRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -15487,7 +15526,7 @@ async def test_simulate_security_health_analytics_custom_module_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( @@ -15517,11 +15556,6 @@ async def test_simulate_security_health_analytics_custom_module_async( ) -@pytest.mark.asyncio -async def test_simulate_security_health_analytics_custom_module_async_from_dict(): - await test_simulate_security_health_analytics_custom_module_async(request_type=dict) - - def test_simulate_security_health_analytics_custom_module_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15734,8 +15768,8 @@ async def test_simulate_security_health_analytics_custom_module_flattened_error_ @pytest.mark.parametrize( "request_type", [ - securitycenter_service.UpdateExternalSystemRequest, - dict, + securitycenter_service.UpdateExternalSystemRequest(), + {}, ], ) def test_update_external_system(request_type, transport: str = "grpc"): @@ -15746,7 +15780,7 @@ def test_update_external_system(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -15802,7 +15836,8 @@ def test_update_external_system_non_empty_request_with_auto_populated_field(): client.update_external_system(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.UpdateExternalSystemRequest() + request_msg = securitycenter_service.UpdateExternalSystemRequest() + assert args[0] == request_msg def test_update_external_system_use_cached_wrapped_rpc(): @@ -15888,9 +15923,15 @@ async def test_update_external_system_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.UpdateExternalSystemRequest(), + {}, + ], +) async def test_update_external_system_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.UpdateExternalSystemRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -15899,7 +15940,7 @@ async def test_update_external_system_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( @@ -15934,11 +15975,6 @@ async def test_update_external_system_async( assert response.case_priority == "case_priority_value" -@pytest.mark.asyncio -async def test_update_external_system_async_from_dict(): - await test_update_external_system_async(request_type=dict) - - def test_update_external_system_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16103,8 +16139,8 @@ async def test_update_external_system_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.UpdateFindingRequest, - dict, + securitycenter_service.UpdateFindingRequest(), + {}, ], ) def test_update_finding(request_type, transport: str = "grpc"): @@ -16115,7 +16151,7 @@ def test_update_finding(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_finding), "__call__") as call: @@ -16185,7 +16221,8 @@ def test_update_finding_non_empty_request_with_auto_populated_field(): client.update_finding(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.UpdateFindingRequest() + request_msg = securitycenter_service.UpdateFindingRequest() + assert args[0] == request_msg def test_update_finding_use_cached_wrapped_rpc(): @@ -16266,10 +16303,14 @@ async def test_update_finding_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_finding_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.UpdateFindingRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.UpdateFindingRequest(), + {}, + ], +) +async def test_update_finding_async(request_type, transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -16277,7 +16318,7 @@ async def test_update_finding_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_finding), "__call__") as call: @@ -16328,11 +16369,6 @@ async def test_update_finding_async( assert response.module_name == "module_name_value" -@pytest.mark.asyncio -async def test_update_finding_async_from_dict(): - await test_update_finding_async(request_type=dict) - - def test_update_finding_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16475,8 +16511,8 @@ async def test_update_finding_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.UpdateMuteConfigRequest, - dict, + securitycenter_service.UpdateMuteConfigRequest(), + {}, ], ) def test_update_mute_config(request_type, transport: str = "grpc"): @@ -16487,7 +16523,7 @@ def test_update_mute_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( @@ -16543,7 +16579,8 @@ def test_update_mute_config_non_empty_request_with_auto_populated_field(): client.update_mute_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.UpdateMuteConfigRequest() + request_msg = securitycenter_service.UpdateMuteConfigRequest() + assert args[0] == request_msg def test_update_mute_config_use_cached_wrapped_rpc(): @@ -16628,10 +16665,14 @@ async def test_update_mute_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_mute_config_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.UpdateMuteConfigRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.UpdateMuteConfigRequest(), + {}, + ], +) +async def test_update_mute_config_async(request_type, transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -16639,7 +16680,7 @@ async def test_update_mute_config_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( @@ -16674,11 +16715,6 @@ async def test_update_mute_config_async( assert response.type_ == gcs_mute_config.MuteConfig.MuteConfigType.STATIC -@pytest.mark.asyncio -async def test_update_mute_config_async_from_dict(): - await test_update_mute_config_async(request_type=dict) - - def test_update_mute_config_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16843,8 +16879,8 @@ async def test_update_mute_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.UpdateNotificationConfigRequest, - dict, + securitycenter_service.UpdateNotificationConfigRequest(), + {}, ], ) def test_update_notification_config(request_type, transport: str = "grpc"): @@ -16855,7 +16891,7 @@ def test_update_notification_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( @@ -16907,7 +16943,8 @@ def test_update_notification_config_non_empty_request_with_auto_populated_field( client.update_notification_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.UpdateNotificationConfigRequest() + request_msg = securitycenter_service.UpdateNotificationConfigRequest() + assert args[0] == request_msg def test_update_notification_config_use_cached_wrapped_rpc(): @@ -16993,9 +17030,15 @@ async def test_update_notification_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.UpdateNotificationConfigRequest(), + {}, + ], +) async def test_update_notification_config_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.UpdateNotificationConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -17004,7 +17047,7 @@ async def test_update_notification_config_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( @@ -17035,11 +17078,6 @@ async def test_update_notification_config_async( assert response.service_account == "service_account_value" -@pytest.mark.asyncio -async def test_update_notification_config_async_from_dict(): - await test_update_notification_config_async(request_type=dict) - - def test_update_notification_config_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17212,8 +17250,8 @@ async def test_update_notification_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.UpdateOrganizationSettingsRequest, - dict, + securitycenter_service.UpdateOrganizationSettingsRequest(), + {}, ], ) def test_update_organization_settings(request_type, transport: str = "grpc"): @@ -17224,7 +17262,7 @@ def test_update_organization_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( @@ -17272,7 +17310,8 @@ def test_update_organization_settings_non_empty_request_with_auto_populated_fiel client.update_organization_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.UpdateOrganizationSettingsRequest() + request_msg = securitycenter_service.UpdateOrganizationSettingsRequest() + assert args[0] == request_msg def test_update_organization_settings_use_cached_wrapped_rpc(): @@ -17358,9 +17397,15 @@ async def test_update_organization_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.UpdateOrganizationSettingsRequest(), + {}, + ], +) async def test_update_organization_settings_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.UpdateOrganizationSettingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -17369,7 +17414,7 @@ async def test_update_organization_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( @@ -17396,11 +17441,6 @@ async def test_update_organization_settings_async( assert response.enable_asset_discovery is True -@pytest.mark.asyncio -async def test_update_organization_settings_async_from_dict(): - await test_update_organization_settings_async(request_type=dict) - - def test_update_organization_settings_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17563,8 +17603,8 @@ async def test_update_organization_settings_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.UpdateSecurityHealthAnalyticsCustomModuleRequest, - dict, + securitycenter_service.UpdateSecurityHealthAnalyticsCustomModuleRequest(), + {}, ], ) def test_update_security_health_analytics_custom_module( @@ -17577,7 +17617,7 @@ def test_update_security_health_analytics_custom_module( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -17641,10 +17681,10 @@ def test_update_security_health_analytics_custom_module_non_empty_request_with_a client.update_security_health_analytics_custom_module(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert ( - args[0] - == securitycenter_service.UpdateSecurityHealthAnalyticsCustomModuleRequest() + request_msg = ( + securitycenter_service.UpdateSecurityHealthAnalyticsCustomModuleRequest() ) + assert args[0] == request_msg def test_update_security_health_analytics_custom_module_use_cached_wrapped_rpc(): @@ -17730,9 +17770,15 @@ async def test_update_security_health_analytics_custom_module_async_use_cached_w @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.UpdateSecurityHealthAnalyticsCustomModuleRequest(), + {}, + ], +) async def test_update_security_health_analytics_custom_module_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.UpdateSecurityHealthAnalyticsCustomModuleRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -17741,7 +17787,7 @@ async def test_update_security_health_analytics_custom_module_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( @@ -17783,11 +17829,6 @@ async def test_update_security_health_analytics_custom_module_async( assert response.ancestor_module == "ancestor_module_value" -@pytest.mark.asyncio -async def test_update_security_health_analytics_custom_module_async_from_dict(): - await test_update_security_health_analytics_custom_module_async(request_type=dict) - - def test_update_security_health_analytics_custom_module_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17968,8 +18009,8 @@ async def test_update_security_health_analytics_custom_module_flattened_error_as @pytest.mark.parametrize( "request_type", [ - securitycenter_service.UpdateSourceRequest, - dict, + securitycenter_service.UpdateSourceRequest(), + {}, ], ) def test_update_source(request_type, transport: str = "grpc"): @@ -17980,7 +18021,7 @@ def test_update_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(type(client.transport.update_source), "__call__") as call: @@ -18028,7 +18069,8 @@ def test_update_source_non_empty_request_with_auto_populated_field(): client.update_source(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.UpdateSourceRequest() + request_msg = securitycenter_service.UpdateSourceRequest() + assert args[0] == request_msg def test_update_source_use_cached_wrapped_rpc(): @@ -18109,10 +18151,14 @@ async def test_update_source_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_source_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.UpdateSourceRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.UpdateSourceRequest(), + {}, + ], +) +async def test_update_source_async(request_type, transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -18120,7 +18166,7 @@ async def test_update_source_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_source), "__call__") as call: @@ -18149,11 +18195,6 @@ async def test_update_source_async( assert response.canonical_name == "canonical_name_value" -@pytest.mark.asyncio -async def test_update_source_async_from_dict(): - await test_update_source_async(request_type=dict) - - def test_update_source_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18296,8 +18337,8 @@ async def test_update_source_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.UpdateSecurityMarksRequest, - dict, + securitycenter_service.UpdateSecurityMarksRequest(), + {}, ], ) def test_update_security_marks(request_type, transport: str = "grpc"): @@ -18308,7 +18349,7 @@ def test_update_security_marks(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -18356,7 +18397,8 @@ def test_update_security_marks_non_empty_request_with_auto_populated_field(): client.update_security_marks(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.UpdateSecurityMarksRequest() + request_msg = securitycenter_service.UpdateSecurityMarksRequest() + assert args[0] == request_msg def test_update_security_marks_use_cached_wrapped_rpc(): @@ -18442,9 +18484,15 @@ async def test_update_security_marks_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.UpdateSecurityMarksRequest(), + {}, + ], +) async def test_update_security_marks_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.UpdateSecurityMarksRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -18453,7 +18501,7 @@ async def test_update_security_marks_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( @@ -18480,11 +18528,6 @@ async def test_update_security_marks_async( assert response.canonical_name == "canonical_name_value" -@pytest.mark.asyncio -async def test_update_security_marks_async_from_dict(): - await test_update_security_marks_async(request_type=dict) - - def test_update_security_marks_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18639,8 +18682,8 @@ async def test_update_security_marks_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.CreateBigQueryExportRequest, - dict, + securitycenter_service.CreateBigQueryExportRequest(), + {}, ], ) def test_create_big_query_export(request_type, transport: str = "grpc"): @@ -18651,7 +18694,7 @@ def test_create_big_query_export(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -18710,10 +18753,11 @@ def test_create_big_query_export_non_empty_request_with_auto_populated_field(): client.create_big_query_export(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.CreateBigQueryExportRequest( + request_msg = securitycenter_service.CreateBigQueryExportRequest( parent="parent_value", big_query_export_id="big_query_export_id_value", ) + assert args[0] == request_msg def test_create_big_query_export_use_cached_wrapped_rpc(): @@ -18799,9 +18843,15 @@ async def test_create_big_query_export_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.CreateBigQueryExportRequest(), + {}, + ], +) async def test_create_big_query_export_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.CreateBigQueryExportRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -18810,7 +18860,7 @@ async def test_create_big_query_export_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( @@ -18845,11 +18895,6 @@ async def test_create_big_query_export_async( assert response.principal == "principal_value" -@pytest.mark.asyncio -async def test_create_big_query_export_async_from_dict(): - await test_create_big_query_export_async(request_type=dict) - - def test_create_big_query_export_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -19024,8 +19069,8 @@ async def test_create_big_query_export_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.DeleteBigQueryExportRequest, - dict, + securitycenter_service.DeleteBigQueryExportRequest(), + {}, ], ) def test_delete_big_query_export(request_type, transport: str = "grpc"): @@ -19036,7 +19081,7 @@ def test_delete_big_query_export(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -19081,9 +19126,10 @@ def test_delete_big_query_export_non_empty_request_with_auto_populated_field(): client.delete_big_query_export(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.DeleteBigQueryExportRequest( + request_msg = securitycenter_service.DeleteBigQueryExportRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_big_query_export_use_cached_wrapped_rpc(): @@ -19169,9 +19215,15 @@ async def test_delete_big_query_export_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.DeleteBigQueryExportRequest(), + {}, + ], +) async def test_delete_big_query_export_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.DeleteBigQueryExportRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -19180,7 +19232,7 @@ async def test_delete_big_query_export_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( @@ -19200,11 +19252,6 @@ async def test_delete_big_query_export_async( assert response is None -@pytest.mark.asyncio -async def test_delete_big_query_export_async_from_dict(): - await test_delete_big_query_export_async(request_type=dict) - - def test_delete_big_query_export_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -19355,8 +19402,8 @@ async def test_delete_big_query_export_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.UpdateBigQueryExportRequest, - dict, + securitycenter_service.UpdateBigQueryExportRequest(), + {}, ], ) def test_update_big_query_export(request_type, transport: str = "grpc"): @@ -19367,7 +19414,7 @@ def test_update_big_query_export(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -19423,7 +19470,8 @@ def test_update_big_query_export_non_empty_request_with_auto_populated_field(): client.update_big_query_export(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.UpdateBigQueryExportRequest() + request_msg = securitycenter_service.UpdateBigQueryExportRequest() + assert args[0] == request_msg def test_update_big_query_export_use_cached_wrapped_rpc(): @@ -19509,9 +19557,15 @@ async def test_update_big_query_export_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.UpdateBigQueryExportRequest(), + {}, + ], +) async def test_update_big_query_export_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.UpdateBigQueryExportRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -19520,7 +19574,7 @@ async def test_update_big_query_export_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( @@ -19555,11 +19609,6 @@ async def test_update_big_query_export_async( assert response.principal == "principal_value" -@pytest.mark.asyncio -async def test_update_big_query_export_async_from_dict(): - await test_update_big_query_export_async(request_type=dict) - - def test_update_big_query_export_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -19724,8 +19773,8 @@ async def test_update_big_query_export_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.ListBigQueryExportsRequest, - dict, + securitycenter_service.ListBigQueryExportsRequest(), + {}, ], ) def test_list_big_query_exports(request_type, transport: str = "grpc"): @@ -19736,7 +19785,7 @@ def test_list_big_query_exports(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -19785,10 +19834,11 @@ def test_list_big_query_exports_non_empty_request_with_auto_populated_field(): client.list_big_query_exports(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.ListBigQueryExportsRequest( + request_msg = securitycenter_service.ListBigQueryExportsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_big_query_exports_use_cached_wrapped_rpc(): @@ -19874,9 +19924,15 @@ async def test_list_big_query_exports_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.ListBigQueryExportsRequest(), + {}, + ], +) async def test_list_big_query_exports_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.ListBigQueryExportsRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -19885,7 +19941,7 @@ async def test_list_big_query_exports_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( @@ -19910,11 +19966,6 @@ async def test_list_big_query_exports_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_big_query_exports_async_from_dict(): - await test_list_big_query_exports_async(request_type=dict) - - def test_list_big_query_exports_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -20267,8 +20318,8 @@ async def test_list_big_query_exports_async_pages(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.CreateEventThreatDetectionCustomModuleRequest, - dict, + securitycenter_service.CreateEventThreatDetectionCustomModuleRequest(), + {}, ], ) def test_create_event_threat_detection_custom_module( @@ -20281,7 +20332,7 @@ def test_create_event_threat_detection_custom_module( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -20347,11 +20398,12 @@ def test_create_event_threat_detection_custom_module_non_empty_request_with_auto client.create_event_threat_detection_custom_module(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == securitycenter_service.CreateEventThreatDetectionCustomModuleRequest( - parent="parent_value", + request_msg = ( + securitycenter_service.CreateEventThreatDetectionCustomModuleRequest( + parent="parent_value", + ) ) + assert args[0] == request_msg def test_create_event_threat_detection_custom_module_use_cached_wrapped_rpc(): @@ -20437,9 +20489,15 @@ async def test_create_event_threat_detection_custom_module_async_use_cached_wrap @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.CreateEventThreatDetectionCustomModuleRequest(), + {}, + ], +) async def test_create_event_threat_detection_custom_module_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.CreateEventThreatDetectionCustomModuleRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -20448,7 +20506,7 @@ async def test_create_event_threat_detection_custom_module_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( @@ -20491,11 +20549,6 @@ async def test_create_event_threat_detection_custom_module_async( assert response.last_editor == "last_editor_value" -@pytest.mark.asyncio -async def test_create_event_threat_detection_custom_module_async_from_dict(): - await test_create_event_threat_detection_custom_module_async(request_type=dict) - - def test_create_event_threat_detection_custom_module_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -20682,8 +20735,8 @@ async def test_create_event_threat_detection_custom_module_flattened_error_async @pytest.mark.parametrize( "request_type", [ - securitycenter_service.DeleteEventThreatDetectionCustomModuleRequest, - dict, + securitycenter_service.DeleteEventThreatDetectionCustomModuleRequest(), + {}, ], ) def test_delete_event_threat_detection_custom_module( @@ -20696,7 +20749,7 @@ def test_delete_event_threat_detection_custom_module( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -20741,11 +20794,12 @@ def test_delete_event_threat_detection_custom_module_non_empty_request_with_auto client.delete_event_threat_detection_custom_module(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == securitycenter_service.DeleteEventThreatDetectionCustomModuleRequest( - name="name_value", + request_msg = ( + securitycenter_service.DeleteEventThreatDetectionCustomModuleRequest( + name="name_value", + ) ) + assert args[0] == request_msg def test_delete_event_threat_detection_custom_module_use_cached_wrapped_rpc(): @@ -20831,9 +20885,15 @@ async def test_delete_event_threat_detection_custom_module_async_use_cached_wrap @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.DeleteEventThreatDetectionCustomModuleRequest(), + {}, + ], +) async def test_delete_event_threat_detection_custom_module_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.DeleteEventThreatDetectionCustomModuleRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -20842,7 +20902,7 @@ async def test_delete_event_threat_detection_custom_module_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( @@ -20862,11 +20922,6 @@ async def test_delete_event_threat_detection_custom_module_async( assert response is None -@pytest.mark.asyncio -async def test_delete_event_threat_detection_custom_module_async_from_dict(): - await test_delete_event_threat_detection_custom_module_async(request_type=dict) - - def test_delete_event_threat_detection_custom_module_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -21017,8 +21072,8 @@ async def test_delete_event_threat_detection_custom_module_flattened_error_async @pytest.mark.parametrize( "request_type", [ - securitycenter_service.GetEventThreatDetectionCustomModuleRequest, - dict, + securitycenter_service.GetEventThreatDetectionCustomModuleRequest(), + {}, ], ) def test_get_event_threat_detection_custom_module( @@ -21031,7 +21086,7 @@ def test_get_event_threat_detection_custom_module( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -21096,11 +21151,10 @@ def test_get_event_threat_detection_custom_module_non_empty_request_with_auto_po client.get_event_threat_detection_custom_module(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == securitycenter_service.GetEventThreatDetectionCustomModuleRequest( + request_msg = securitycenter_service.GetEventThreatDetectionCustomModuleRequest( name="name_value", ) + assert args[0] == request_msg def test_get_event_threat_detection_custom_module_use_cached_wrapped_rpc(): @@ -21186,9 +21240,15 @@ async def test_get_event_threat_detection_custom_module_async_use_cached_wrapped @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.GetEventThreatDetectionCustomModuleRequest(), + {}, + ], +) async def test_get_event_threat_detection_custom_module_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.GetEventThreatDetectionCustomModuleRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -21197,7 +21257,7 @@ async def test_get_event_threat_detection_custom_module_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( @@ -21239,11 +21299,6 @@ async def test_get_event_threat_detection_custom_module_async( assert response.last_editor == "last_editor_value" -@pytest.mark.asyncio -async def test_get_event_threat_detection_custom_module_async_from_dict(): - await test_get_event_threat_detection_custom_module_async(request_type=dict) - - def test_get_event_threat_detection_custom_module_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -21404,8 +21459,8 @@ async def test_get_event_threat_detection_custom_module_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.ListDescendantEventThreatDetectionCustomModulesRequest, - dict, + securitycenter_service.ListDescendantEventThreatDetectionCustomModulesRequest(), + {}, ], ) def test_list_descendant_event_threat_detection_custom_modules( @@ -21418,7 +21473,7 @@ def test_list_descendant_event_threat_detection_custom_modules( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -21473,13 +21528,11 @@ def test_list_descendant_event_threat_detection_custom_modules_non_empty_request client.list_descendant_event_threat_detection_custom_modules(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert ( - args[0] - == securitycenter_service.ListDescendantEventThreatDetectionCustomModulesRequest( - parent="parent_value", - page_token="page_token_value", - ) + request_msg = securitycenter_service.ListDescendantEventThreatDetectionCustomModulesRequest( + parent="parent_value", + page_token="page_token_value", ) + assert args[0] == request_msg def test_list_descendant_event_threat_detection_custom_modules_use_cached_wrapped_rpc(): @@ -21565,9 +21618,15 @@ async def test_list_descendant_event_threat_detection_custom_modules_async_use_c @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.ListDescendantEventThreatDetectionCustomModulesRequest(), + {}, + ], +) async def test_list_descendant_event_threat_detection_custom_modules_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.ListDescendantEventThreatDetectionCustomModulesRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -21576,7 +21635,7 @@ async def test_list_descendant_event_threat_detection_custom_modules_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( @@ -21606,13 +21665,6 @@ async def test_list_descendant_event_threat_detection_custom_modules_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_descendant_event_threat_detection_custom_modules_async_from_dict(): - await test_list_descendant_event_threat_detection_custom_modules_async( - request_type=dict - ) - - def test_list_descendant_event_threat_detection_custom_modules_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -22001,8 +22053,8 @@ async def test_list_descendant_event_threat_detection_custom_modules_async_pages @pytest.mark.parametrize( "request_type", [ - securitycenter_service.ListEventThreatDetectionCustomModulesRequest, - dict, + securitycenter_service.ListEventThreatDetectionCustomModulesRequest(), + {}, ], ) def test_list_event_threat_detection_custom_modules( @@ -22015,7 +22067,7 @@ def test_list_event_threat_detection_custom_modules( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -22066,12 +22118,13 @@ def test_list_event_threat_detection_custom_modules_non_empty_request_with_auto_ client.list_event_threat_detection_custom_modules(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == securitycenter_service.ListEventThreatDetectionCustomModulesRequest( - parent="parent_value", - page_token="page_token_value", + request_msg = ( + securitycenter_service.ListEventThreatDetectionCustomModulesRequest( + parent="parent_value", + page_token="page_token_value", + ) ) + assert args[0] == request_msg def test_list_event_threat_detection_custom_modules_use_cached_wrapped_rpc(): @@ -22157,9 +22210,15 @@ async def test_list_event_threat_detection_custom_modules_async_use_cached_wrapp @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.ListEventThreatDetectionCustomModulesRequest(), + {}, + ], +) async def test_list_event_threat_detection_custom_modules_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.ListEventThreatDetectionCustomModulesRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -22168,7 +22227,7 @@ async def test_list_event_threat_detection_custom_modules_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( @@ -22193,11 +22252,6 @@ async def test_list_event_threat_detection_custom_modules_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_event_threat_detection_custom_modules_async_from_dict(): - await test_list_event_threat_detection_custom_modules_async(request_type=dict) - - def test_list_event_threat_detection_custom_modules_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -22572,8 +22626,8 @@ async def test_list_event_threat_detection_custom_modules_async_pages(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.UpdateEventThreatDetectionCustomModuleRequest, - dict, + securitycenter_service.UpdateEventThreatDetectionCustomModuleRequest(), + {}, ], ) def test_update_event_threat_detection_custom_module( @@ -22586,7 +22640,7 @@ def test_update_event_threat_detection_custom_module( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -22650,10 +22704,10 @@ def test_update_event_threat_detection_custom_module_non_empty_request_with_auto client.update_event_threat_detection_custom_module(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert ( - args[0] - == securitycenter_service.UpdateEventThreatDetectionCustomModuleRequest() + request_msg = ( + securitycenter_service.UpdateEventThreatDetectionCustomModuleRequest() ) + assert args[0] == request_msg def test_update_event_threat_detection_custom_module_use_cached_wrapped_rpc(): @@ -22739,9 +22793,15 @@ async def test_update_event_threat_detection_custom_module_async_use_cached_wrap @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.UpdateEventThreatDetectionCustomModuleRequest(), + {}, + ], +) async def test_update_event_threat_detection_custom_module_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.UpdateEventThreatDetectionCustomModuleRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -22750,7 +22810,7 @@ async def test_update_event_threat_detection_custom_module_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( @@ -22793,11 +22853,6 @@ async def test_update_event_threat_detection_custom_module_async( assert response.last_editor == "last_editor_value" -@pytest.mark.asyncio -async def test_update_event_threat_detection_custom_module_async_from_dict(): - await test_update_event_threat_detection_custom_module_async(request_type=dict) - - def test_update_event_threat_detection_custom_module_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -22984,8 +23039,8 @@ async def test_update_event_threat_detection_custom_module_flattened_error_async @pytest.mark.parametrize( "request_type", [ - securitycenter_service.ValidateEventThreatDetectionCustomModuleRequest, - dict, + securitycenter_service.ValidateEventThreatDetectionCustomModuleRequest(), + {}, ], ) def test_validate_event_threat_detection_custom_module( @@ -22998,7 +23053,7 @@ def test_validate_event_threat_detection_custom_module( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -23052,13 +23107,14 @@ def test_validate_event_threat_detection_custom_module_non_empty_request_with_au client.validate_event_threat_detection_custom_module(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == securitycenter_service.ValidateEventThreatDetectionCustomModuleRequest( - parent="parent_value", - raw_text="raw_text_value", - type_="type__value", + request_msg = ( + securitycenter_service.ValidateEventThreatDetectionCustomModuleRequest( + parent="parent_value", + raw_text="raw_text_value", + type_="type__value", + ) ) + assert args[0] == request_msg def test_validate_event_threat_detection_custom_module_use_cached_wrapped_rpc(): @@ -23144,9 +23200,15 @@ async def test_validate_event_threat_detection_custom_module_async_use_cached_wr @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.ValidateEventThreatDetectionCustomModuleRequest(), + {}, + ], +) async def test_validate_event_threat_detection_custom_module_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.ValidateEventThreatDetectionCustomModuleRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -23155,7 +23217,7 @@ async def test_validate_event_threat_detection_custom_module_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( @@ -23182,11 +23244,6 @@ async def test_validate_event_threat_detection_custom_module_async( ) -@pytest.mark.asyncio -async def test_validate_event_threat_detection_custom_module_async_from_dict(): - await test_validate_event_threat_detection_custom_module_async(request_type=dict) - - def test_validate_event_threat_detection_custom_module_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -23257,8 +23314,8 @@ async def test_validate_event_threat_detection_custom_module_field_headers_async @pytest.mark.parametrize( "request_type", [ - securitycenter_service.GetEffectiveEventThreatDetectionCustomModuleRequest, - dict, + securitycenter_service.GetEffectiveEventThreatDetectionCustomModuleRequest(), + {}, ], ) def test_get_effective_event_threat_detection_custom_module( @@ -23271,7 +23328,7 @@ def test_get_effective_event_threat_detection_custom_module( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -23339,11 +23396,12 @@ def test_get_effective_event_threat_detection_custom_module_non_empty_request_wi client.get_effective_event_threat_detection_custom_module(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == securitycenter_service.GetEffectiveEventThreatDetectionCustomModuleRequest( - name="name_value", + request_msg = ( + securitycenter_service.GetEffectiveEventThreatDetectionCustomModuleRequest( + name="name_value", + ) ) + assert args[0] == request_msg def test_get_effective_event_threat_detection_custom_module_use_cached_wrapped_rpc(): @@ -23429,9 +23487,15 @@ async def test_get_effective_event_threat_detection_custom_module_async_use_cach @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.GetEffectiveEventThreatDetectionCustomModuleRequest(), + {}, + ], +) async def test_get_effective_event_threat_detection_custom_module_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.GetEffectiveEventThreatDetectionCustomModuleRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -23440,7 +23504,7 @@ async def test_get_effective_event_threat_detection_custom_module_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( @@ -23484,13 +23548,6 @@ async def test_get_effective_event_threat_detection_custom_module_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_get_effective_event_threat_detection_custom_module_async_from_dict(): - await test_get_effective_event_threat_detection_custom_module_async( - request_type=dict - ) - - def test_get_effective_event_threat_detection_custom_module_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -23653,8 +23710,8 @@ async def test_get_effective_event_threat_detection_custom_module_flattened_erro @pytest.mark.parametrize( "request_type", [ - securitycenter_service.ListEffectiveEventThreatDetectionCustomModulesRequest, - dict, + securitycenter_service.ListEffectiveEventThreatDetectionCustomModulesRequest(), + {}, ], ) def test_list_effective_event_threat_detection_custom_modules( @@ -23667,7 +23724,7 @@ def test_list_effective_event_threat_detection_custom_modules( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -23722,13 +23779,11 @@ def test_list_effective_event_threat_detection_custom_modules_non_empty_request_ client.list_effective_event_threat_detection_custom_modules(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert ( - args[0] - == securitycenter_service.ListEffectiveEventThreatDetectionCustomModulesRequest( - parent="parent_value", - page_token="page_token_value", - ) + request_msg = securitycenter_service.ListEffectiveEventThreatDetectionCustomModulesRequest( + parent="parent_value", + page_token="page_token_value", ) + assert args[0] == request_msg def test_list_effective_event_threat_detection_custom_modules_use_cached_wrapped_rpc(): @@ -23814,9 +23869,15 @@ async def test_list_effective_event_threat_detection_custom_modules_async_use_ca @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.ListEffectiveEventThreatDetectionCustomModulesRequest(), + {}, + ], +) async def test_list_effective_event_threat_detection_custom_modules_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.ListEffectiveEventThreatDetectionCustomModulesRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -23825,7 +23886,7 @@ async def test_list_effective_event_threat_detection_custom_modules_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( @@ -23855,13 +23916,6 @@ async def test_list_effective_event_threat_detection_custom_modules_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_effective_event_threat_detection_custom_modules_async_from_dict(): - await test_list_effective_event_threat_detection_custom_modules_async( - request_type=dict - ) - - def test_list_effective_event_threat_detection_custom_modules_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -24250,8 +24304,8 @@ async def test_list_effective_event_threat_detection_custom_modules_async_pages( @pytest.mark.parametrize( "request_type", [ - securitycenter_service.BatchCreateResourceValueConfigsRequest, - dict, + securitycenter_service.BatchCreateResourceValueConfigsRequest(), + {}, ], ) def test_batch_create_resource_value_configs(request_type, transport: str = "grpc"): @@ -24262,7 +24316,7 @@ def test_batch_create_resource_value_configs(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( @@ -24311,9 +24365,10 @@ def test_batch_create_resource_value_configs_non_empty_request_with_auto_populat client.batch_create_resource_value_configs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.BatchCreateResourceValueConfigsRequest( + request_msg = securitycenter_service.BatchCreateResourceValueConfigsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_batch_create_resource_value_configs_use_cached_wrapped_rpc(): @@ -24399,9 +24454,15 @@ async def test_batch_create_resource_value_configs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.BatchCreateResourceValueConfigsRequest(), + {}, + ], +) async def test_batch_create_resource_value_configs_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.BatchCreateResourceValueConfigsRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -24410,7 +24471,7 @@ async def test_batch_create_resource_value_configs_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( @@ -24434,11 +24495,6 @@ async def test_batch_create_resource_value_configs_async( ) -@pytest.mark.asyncio -async def test_batch_create_resource_value_configs_async_from_dict(): - await test_batch_create_resource_value_configs_async(request_type=dict) - - def test_batch_create_resource_value_configs_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -24633,8 +24689,8 @@ async def test_batch_create_resource_value_configs_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.DeleteResourceValueConfigRequest, - dict, + securitycenter_service.DeleteResourceValueConfigRequest(), + {}, ], ) def test_delete_resource_value_config(request_type, transport: str = "grpc"): @@ -24645,7 +24701,7 @@ def test_delete_resource_value_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( @@ -24690,9 +24746,10 @@ def test_delete_resource_value_config_non_empty_request_with_auto_populated_fiel client.delete_resource_value_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.DeleteResourceValueConfigRequest( + request_msg = securitycenter_service.DeleteResourceValueConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_resource_value_config_use_cached_wrapped_rpc(): @@ -24778,9 +24835,15 @@ async def test_delete_resource_value_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.DeleteResourceValueConfigRequest(), + {}, + ], +) async def test_delete_resource_value_config_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.DeleteResourceValueConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -24789,7 +24852,7 @@ async def test_delete_resource_value_config_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( @@ -24809,11 +24872,6 @@ async def test_delete_resource_value_config_async( assert response is None -@pytest.mark.asyncio -async def test_delete_resource_value_config_async_from_dict(): - await test_delete_resource_value_config_async(request_type=dict) - - def test_delete_resource_value_config_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -24964,8 +25022,8 @@ async def test_delete_resource_value_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.GetResourceValueConfigRequest, - dict, + securitycenter_service.GetResourceValueConfigRequest(), + {}, ], ) def test_get_resource_value_config(request_type, transport: str = "grpc"): @@ -24976,7 +25034,7 @@ def test_get_resource_value_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( @@ -25036,9 +25094,10 @@ def test_get_resource_value_config_non_empty_request_with_auto_populated_field() client.get_resource_value_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.GetResourceValueConfigRequest( + request_msg = securitycenter_service.GetResourceValueConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_resource_value_config_use_cached_wrapped_rpc(): @@ -25124,9 +25183,15 @@ async def test_get_resource_value_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.GetResourceValueConfigRequest(), + {}, + ], +) async def test_get_resource_value_config_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.GetResourceValueConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -25135,7 +25200,7 @@ async def test_get_resource_value_config_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( @@ -25172,11 +25237,6 @@ async def test_get_resource_value_config_async( assert response.cloud_provider == resource.CloudProvider.GOOGLE_CLOUD_PLATFORM -@pytest.mark.asyncio -async def test_get_resource_value_config_async_from_dict(): - await test_get_resource_value_config_async(request_type=dict) - - def test_get_resource_value_config_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -25331,8 +25391,8 @@ async def test_get_resource_value_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.ListResourceValueConfigsRequest, - dict, + securitycenter_service.ListResourceValueConfigsRequest(), + {}, ], ) def test_list_resource_value_configs(request_type, transport: str = "grpc"): @@ -25343,7 +25403,7 @@ def test_list_resource_value_configs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -25392,10 +25452,11 @@ def test_list_resource_value_configs_non_empty_request_with_auto_populated_field client.list_resource_value_configs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.ListResourceValueConfigsRequest( + request_msg = securitycenter_service.ListResourceValueConfigsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_resource_value_configs_use_cached_wrapped_rpc(): @@ -25481,9 +25542,15 @@ async def test_list_resource_value_configs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.ListResourceValueConfigsRequest(), + {}, + ], +) async def test_list_resource_value_configs_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.ListResourceValueConfigsRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -25492,7 +25559,7 @@ async def test_list_resource_value_configs_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( @@ -25517,11 +25584,6 @@ async def test_list_resource_value_configs_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_resource_value_configs_async_from_dict(): - await test_list_resource_value_configs_async(request_type=dict) - - def test_list_resource_value_configs_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -25880,8 +25942,8 @@ async def test_list_resource_value_configs_async_pages(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.UpdateResourceValueConfigRequest, - dict, + securitycenter_service.UpdateResourceValueConfigRequest(), + {}, ], ) def test_update_resource_value_config(request_type, transport: str = "grpc"): @@ -25892,7 +25954,7 @@ def test_update_resource_value_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( @@ -25950,7 +26012,8 @@ def test_update_resource_value_config_non_empty_request_with_auto_populated_fiel client.update_resource_value_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.UpdateResourceValueConfigRequest() + request_msg = securitycenter_service.UpdateResourceValueConfigRequest() + assert args[0] == request_msg def test_update_resource_value_config_use_cached_wrapped_rpc(): @@ -26036,9 +26099,15 @@ async def test_update_resource_value_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.UpdateResourceValueConfigRequest(), + {}, + ], +) async def test_update_resource_value_config_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.UpdateResourceValueConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -26047,7 +26116,7 @@ async def test_update_resource_value_config_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( @@ -26084,11 +26153,6 @@ async def test_update_resource_value_config_async( assert response.cloud_provider == resource.CloudProvider.GOOGLE_CLOUD_PLATFORM -@pytest.mark.asyncio -async def test_update_resource_value_config_async_from_dict(): - await test_update_resource_value_config_async(request_type=dict) - - def test_update_resource_value_config_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -26261,8 +26325,8 @@ async def test_update_resource_value_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.ListValuedResourcesRequest, - dict, + securitycenter_service.ListValuedResourcesRequest(), + {}, ], ) def test_list_valued_resources(request_type, transport: str = "grpc"): @@ -26273,7 +26337,7 @@ def test_list_valued_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( @@ -26326,12 +26390,13 @@ def test_list_valued_resources_non_empty_request_with_auto_populated_field(): client.list_valued_resources(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.ListValuedResourcesRequest( + request_msg = securitycenter_service.ListValuedResourcesRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_valued_resources_use_cached_wrapped_rpc(): @@ -26417,9 +26482,15 @@ async def test_list_valued_resources_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.ListValuedResourcesRequest(), + {}, + ], +) async def test_list_valued_resources_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.ListValuedResourcesRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -26428,7 +26499,7 @@ async def test_list_valued_resources_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( @@ -26455,11 +26526,6 @@ async def test_list_valued_resources_async( assert response.total_size == 1086 -@pytest.mark.asyncio -async def test_list_valued_resources_async_from_dict(): - await test_list_valued_resources_async(request_type=dict) - - def test_list_valued_resources_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -26812,8 +26878,8 @@ async def test_list_valued_resources_async_pages(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.ListAttackPathsRequest, - dict, + securitycenter_service.ListAttackPathsRequest(), + {}, ], ) def test_list_attack_paths(request_type, transport: str = "grpc"): @@ -26824,7 +26890,7 @@ def test_list_attack_paths(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -26874,11 +26940,12 @@ def test_list_attack_paths_non_empty_request_with_auto_populated_field(): client.list_attack_paths(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.ListAttackPathsRequest( + request_msg = securitycenter_service.ListAttackPathsRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_attack_paths_use_cached_wrapped_rpc(): @@ -26961,10 +27028,14 @@ async def test_list_attack_paths_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_attack_paths_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.ListAttackPathsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.ListAttackPathsRequest(), + {}, + ], +) +async def test_list_attack_paths_async(request_type, transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -26972,7 +27043,7 @@ async def test_list_attack_paths_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( @@ -26997,11 +27068,6 @@ async def test_list_attack_paths_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_attack_paths_async_from_dict(): - await test_list_attack_paths_async(request_type=dict) - - def test_list_attack_paths_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -40767,7 +40833,6 @@ def test_bulk_mute_findings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.BulkMuteFindingsRequest() - assert args[0] == request_msg @@ -40793,7 +40858,6 @@ def test_create_security_health_analytics_custom_module_empty_call_grpc(): request_msg = ( securitycenter_service.CreateSecurityHealthAnalyticsCustomModuleRequest() ) - assert args[0] == request_msg @@ -40814,7 +40878,6 @@ def test_create_source_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.CreateSourceRequest() - assert args[0] == request_msg @@ -40835,7 +40898,6 @@ def test_create_finding_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.CreateFindingRequest() - assert args[0] == request_msg @@ -40858,7 +40920,6 @@ def test_create_mute_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.CreateMuteConfigRequest() - assert args[0] == request_msg @@ -40881,7 +40942,6 @@ def test_create_notification_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.CreateNotificationConfigRequest() - assert args[0] == request_msg @@ -40904,7 +40964,6 @@ def test_delete_mute_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.DeleteMuteConfigRequest() - assert args[0] == request_msg @@ -40927,7 +40986,6 @@ def test_delete_notification_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.DeleteNotificationConfigRequest() - assert args[0] == request_msg @@ -40953,7 +41011,6 @@ def test_delete_security_health_analytics_custom_module_empty_call_grpc(): request_msg = ( securitycenter_service.DeleteSecurityHealthAnalyticsCustomModuleRequest() ) - assert args[0] == request_msg @@ -40974,7 +41031,6 @@ def test_get_simulation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GetSimulationRequest() - assert args[0] == request_msg @@ -40997,7 +41053,6 @@ def test_get_valued_resource_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GetValuedResourceRequest() - assert args[0] == request_msg @@ -41020,7 +41075,6 @@ def test_get_big_query_export_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GetBigQueryExportRequest() - assert args[0] == request_msg @@ -41041,7 +41095,6 @@ def test_get_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -41062,7 +41115,6 @@ def test_get_mute_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GetMuteConfigRequest() - assert args[0] == request_msg @@ -41085,7 +41137,6 @@ def test_get_notification_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GetNotificationConfigRequest() - assert args[0] == request_msg @@ -41108,7 +41159,6 @@ def test_get_organization_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GetOrganizationSettingsRequest() - assert args[0] == request_msg @@ -41132,7 +41182,6 @@ def test_get_effective_security_health_analytics_custom_module_empty_call_grpc() call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GetEffectiveSecurityHealthAnalyticsCustomModuleRequest() - assert args[0] == request_msg @@ -41157,7 +41206,6 @@ def test_get_security_health_analytics_custom_module_empty_call_grpc(): request_msg = ( securitycenter_service.GetSecurityHealthAnalyticsCustomModuleRequest() ) - assert args[0] == request_msg @@ -41178,7 +41226,6 @@ def test_get_source_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GetSourceRequest() - assert args[0] == request_msg @@ -41199,7 +41246,6 @@ def test_group_assets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GroupAssetsRequest() - assert args[0] == request_msg @@ -41220,7 +41266,6 @@ def test_group_findings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GroupFindingsRequest() - assert args[0] == request_msg @@ -41241,7 +41286,6 @@ def test_list_assets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListAssetsRequest() - assert args[0] == request_msg @@ -41265,7 +41309,6 @@ def test_list_descendant_security_health_analytics_custom_modules_empty_call_grp call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListDescendantSecurityHealthAnalyticsCustomModulesRequest() - assert args[0] == request_msg @@ -41286,7 +41329,6 @@ def test_list_findings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListFindingsRequest() - assert args[0] == request_msg @@ -41309,7 +41351,6 @@ def test_list_mute_configs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListMuteConfigsRequest() - assert args[0] == request_msg @@ -41332,7 +41373,6 @@ def test_list_notification_configs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListNotificationConfigsRequest() - assert args[0] == request_msg @@ -41356,7 +41396,6 @@ def test_list_effective_security_health_analytics_custom_modules_empty_call_grpc call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListEffectiveSecurityHealthAnalyticsCustomModulesRequest() - assert args[0] == request_msg @@ -41383,7 +41422,6 @@ def test_list_security_health_analytics_custom_modules_empty_call_grpc(): request_msg = ( securitycenter_service.ListSecurityHealthAnalyticsCustomModulesRequest() ) - assert args[0] == request_msg @@ -41404,7 +41442,6 @@ def test_list_sources_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListSourcesRequest() - assert args[0] == request_msg @@ -41427,7 +41464,6 @@ def test_run_asset_discovery_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.RunAssetDiscoveryRequest() - assert args[0] == request_msg @@ -41450,7 +41486,6 @@ def test_set_finding_state_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.SetFindingStateRequest() - assert args[0] == request_msg @@ -41471,7 +41506,6 @@ def test_set_mute_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.SetMuteRequest() - assert args[0] == request_msg @@ -41492,7 +41526,6 @@ def test_set_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -41515,7 +41548,6 @@ def test_test_iam_permissions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -41543,7 +41575,6 @@ def test_simulate_security_health_analytics_custom_module_empty_call_grpc(): request_msg = ( securitycenter_service.SimulateSecurityHealthAnalyticsCustomModuleRequest() ) - assert args[0] == request_msg @@ -41566,7 +41597,6 @@ def test_update_external_system_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateExternalSystemRequest() - assert args[0] == request_msg @@ -41587,7 +41617,6 @@ def test_update_finding_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateFindingRequest() - assert args[0] == request_msg @@ -41610,7 +41639,6 @@ def test_update_mute_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateMuteConfigRequest() - assert args[0] == request_msg @@ -41633,7 +41661,6 @@ def test_update_notification_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateNotificationConfigRequest() - assert args[0] == request_msg @@ -41656,7 +41683,6 @@ def test_update_organization_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateOrganizationSettingsRequest() - assert args[0] == request_msg @@ -41682,7 +41708,6 @@ def test_update_security_health_analytics_custom_module_empty_call_grpc(): request_msg = ( securitycenter_service.UpdateSecurityHealthAnalyticsCustomModuleRequest() ) - assert args[0] == request_msg @@ -41703,7 +41728,6 @@ def test_update_source_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateSourceRequest() - assert args[0] == request_msg @@ -41726,7 +41750,6 @@ def test_update_security_marks_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateSecurityMarksRequest() - assert args[0] == request_msg @@ -41749,7 +41772,6 @@ def test_create_big_query_export_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.CreateBigQueryExportRequest() - assert args[0] == request_msg @@ -41772,7 +41794,6 @@ def test_delete_big_query_export_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.DeleteBigQueryExportRequest() - assert args[0] == request_msg @@ -41795,7 +41816,6 @@ def test_update_big_query_export_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateBigQueryExportRequest() - assert args[0] == request_msg @@ -41818,7 +41838,6 @@ def test_list_big_query_exports_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListBigQueryExportsRequest() - assert args[0] == request_msg @@ -41845,7 +41864,6 @@ def test_create_event_threat_detection_custom_module_empty_call_grpc(): request_msg = ( securitycenter_service.CreateEventThreatDetectionCustomModuleRequest() ) - assert args[0] == request_msg @@ -41870,7 +41888,6 @@ def test_delete_event_threat_detection_custom_module_empty_call_grpc(): request_msg = ( securitycenter_service.DeleteEventThreatDetectionCustomModuleRequest() ) - assert args[0] == request_msg @@ -41897,7 +41914,6 @@ def test_get_event_threat_detection_custom_module_empty_call_grpc(): request_msg = ( securitycenter_service.GetEventThreatDetectionCustomModuleRequest() ) - assert args[0] == request_msg @@ -41921,7 +41937,6 @@ def test_list_descendant_event_threat_detection_custom_modules_empty_call_grpc() call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListDescendantEventThreatDetectionCustomModulesRequest() - assert args[0] == request_msg @@ -41948,7 +41963,6 @@ def test_list_event_threat_detection_custom_modules_empty_call_grpc(): request_msg = ( securitycenter_service.ListEventThreatDetectionCustomModulesRequest() ) - assert args[0] == request_msg @@ -41975,7 +41989,6 @@ def test_update_event_threat_detection_custom_module_empty_call_grpc(): request_msg = ( securitycenter_service.UpdateEventThreatDetectionCustomModuleRequest() ) - assert args[0] == request_msg @@ -42002,7 +42015,6 @@ def test_validate_event_threat_detection_custom_module_empty_call_grpc(): request_msg = ( securitycenter_service.ValidateEventThreatDetectionCustomModuleRequest() ) - assert args[0] == request_msg @@ -42028,7 +42040,6 @@ def test_get_effective_event_threat_detection_custom_module_empty_call_grpc(): request_msg = ( securitycenter_service.GetEffectiveEventThreatDetectionCustomModuleRequest() ) - assert args[0] == request_msg @@ -42052,7 +42063,6 @@ def test_list_effective_event_threat_detection_custom_modules_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListEffectiveEventThreatDetectionCustomModulesRequest() - assert args[0] == request_msg @@ -42077,7 +42087,6 @@ def test_batch_create_resource_value_configs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.BatchCreateResourceValueConfigsRequest() - assert args[0] == request_msg @@ -42100,7 +42109,6 @@ def test_delete_resource_value_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.DeleteResourceValueConfigRequest() - assert args[0] == request_msg @@ -42123,7 +42131,6 @@ def test_get_resource_value_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GetResourceValueConfigRequest() - assert args[0] == request_msg @@ -42146,7 +42153,6 @@ def test_list_resource_value_configs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListResourceValueConfigsRequest() - assert args[0] == request_msg @@ -42169,7 +42175,6 @@ def test_update_resource_value_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateResourceValueConfigRequest() - assert args[0] == request_msg @@ -42192,7 +42197,6 @@ def test_list_valued_resources_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListValuedResourcesRequest() - assert args[0] == request_msg @@ -42215,7 +42219,6 @@ def test_list_attack_paths_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListAttackPathsRequest() - assert args[0] == request_msg @@ -42256,7 +42259,6 @@ async def test_bulk_mute_findings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.BulkMuteFindingsRequest() - assert args[0] == request_msg @@ -42292,7 +42294,6 @@ async def test_create_security_health_analytics_custom_module_empty_call_grpc_as request_msg = ( securitycenter_service.CreateSecurityHealthAnalyticsCustomModuleRequest() ) - assert args[0] == request_msg @@ -42322,7 +42323,6 @@ async def test_create_source_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.CreateSourceRequest() - assert args[0] == request_msg @@ -42363,7 +42363,6 @@ async def test_create_finding_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.CreateFindingRequest() - assert args[0] == request_msg @@ -42397,7 +42396,6 @@ async def test_create_mute_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.CreateMuteConfigRequest() - assert args[0] == request_msg @@ -42429,7 +42427,6 @@ async def test_create_notification_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.CreateNotificationConfigRequest() - assert args[0] == request_msg @@ -42454,7 +42451,6 @@ async def test_delete_mute_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.DeleteMuteConfigRequest() - assert args[0] == request_msg @@ -42479,7 +42475,6 @@ async def test_delete_notification_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.DeleteNotificationConfigRequest() - assert args[0] == request_msg @@ -42507,7 +42502,6 @@ async def test_delete_security_health_analytics_custom_module_empty_call_grpc_as request_msg = ( securitycenter_service.DeleteSecurityHealthAnalyticsCustomModuleRequest() ) - assert args[0] == request_msg @@ -42535,7 +42529,6 @@ async def test_get_simulation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GetSimulationRequest() - assert args[0] == request_msg @@ -42569,7 +42562,6 @@ async def test_get_valued_resource_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GetValuedResourceRequest() - assert args[0] == request_msg @@ -42603,7 +42595,6 @@ async def test_get_big_query_export_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GetBigQueryExportRequest() - assert args[0] == request_msg @@ -42631,7 +42622,6 @@ async def test_get_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -42663,7 +42653,6 @@ async def test_get_mute_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GetMuteConfigRequest() - assert args[0] == request_msg @@ -42695,7 +42684,6 @@ async def test_get_notification_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GetNotificationConfigRequest() - assert args[0] == request_msg @@ -42725,7 +42713,6 @@ async def test_get_organization_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GetOrganizationSettingsRequest() - assert args[0] == request_msg @@ -42757,7 +42744,6 @@ async def test_get_effective_security_health_analytics_custom_module_empty_call_ call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GetEffectiveSecurityHealthAnalyticsCustomModuleRequest() - assert args[0] == request_msg @@ -42792,7 +42778,6 @@ async def test_get_security_health_analytics_custom_module_empty_call_grpc_async request_msg = ( securitycenter_service.GetSecurityHealthAnalyticsCustomModuleRequest() ) - assert args[0] == request_msg @@ -42822,7 +42807,6 @@ async def test_get_source_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GetSourceRequest() - assert args[0] == request_msg @@ -42850,7 +42834,6 @@ async def test_group_assets_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GroupAssetsRequest() - assert args[0] == request_msg @@ -42878,7 +42861,6 @@ async def test_group_findings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GroupFindingsRequest() - assert args[0] == request_msg @@ -42906,7 +42888,6 @@ async def test_list_assets_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListAssetsRequest() - assert args[0] == request_msg @@ -42938,7 +42919,6 @@ async def test_list_descendant_security_health_analytics_custom_modules_empty_ca call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListDescendantSecurityHealthAnalyticsCustomModulesRequest() - assert args[0] == request_msg @@ -42966,7 +42946,6 @@ async def test_list_findings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListFindingsRequest() - assert args[0] == request_msg @@ -42995,7 +42974,6 @@ async def test_list_mute_configs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListMuteConfigsRequest() - assert args[0] == request_msg @@ -43024,7 +43002,6 @@ async def test_list_notification_configs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListNotificationConfigsRequest() - assert args[0] == request_msg @@ -43056,7 +43033,6 @@ async def test_list_effective_security_health_analytics_custom_modules_empty_cal call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListEffectiveSecurityHealthAnalyticsCustomModulesRequest() - assert args[0] == request_msg @@ -43087,7 +43063,6 @@ async def test_list_security_health_analytics_custom_modules_empty_call_grpc_asy request_msg = ( securitycenter_service.ListSecurityHealthAnalyticsCustomModulesRequest() ) - assert args[0] == request_msg @@ -43114,7 +43089,6 @@ async def test_list_sources_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListSourcesRequest() - assert args[0] == request_msg @@ -43141,7 +43115,6 @@ async def test_run_asset_discovery_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.RunAssetDiscoveryRequest() - assert args[0] == request_msg @@ -43184,7 +43157,6 @@ async def test_set_finding_state_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.SetFindingStateRequest() - assert args[0] == request_msg @@ -43225,7 +43197,6 @@ async def test_set_mute_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.SetMuteRequest() - assert args[0] == request_msg @@ -43253,7 +43224,6 @@ async def test_set_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -43282,7 +43252,6 @@ async def test_test_iam_permissions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -43312,7 +43281,6 @@ async def test_simulate_security_health_analytics_custom_module_empty_call_grpc_ request_msg = ( securitycenter_service.SimulateSecurityHealthAnalyticsCustomModuleRequest() ) - assert args[0] == request_msg @@ -43346,7 +43314,6 @@ async def test_update_external_system_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateExternalSystemRequest() - assert args[0] == request_msg @@ -43387,7 +43354,6 @@ async def test_update_finding_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateFindingRequest() - assert args[0] == request_msg @@ -43421,7 +43387,6 @@ async def test_update_mute_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateMuteConfigRequest() - assert args[0] == request_msg @@ -43453,7 +43418,6 @@ async def test_update_notification_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateNotificationConfigRequest() - assert args[0] == request_msg @@ -43483,7 +43447,6 @@ async def test_update_organization_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateOrganizationSettingsRequest() - assert args[0] == request_msg @@ -43519,7 +43482,6 @@ async def test_update_security_health_analytics_custom_module_empty_call_grpc_as request_msg = ( securitycenter_service.UpdateSecurityHealthAnalyticsCustomModuleRequest() ) - assert args[0] == request_msg @@ -43549,7 +43511,6 @@ async def test_update_source_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateSourceRequest() - assert args[0] == request_msg @@ -43579,7 +43540,6 @@ async def test_update_security_marks_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateSecurityMarksRequest() - assert args[0] == request_msg @@ -43613,7 +43573,6 @@ async def test_create_big_query_export_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.CreateBigQueryExportRequest() - assert args[0] == request_msg @@ -43638,7 +43597,6 @@ async def test_delete_big_query_export_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.DeleteBigQueryExportRequest() - assert args[0] == request_msg @@ -43672,7 +43630,6 @@ async def test_update_big_query_export_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateBigQueryExportRequest() - assert args[0] == request_msg @@ -43701,7 +43658,6 @@ async def test_list_big_query_exports_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListBigQueryExportsRequest() - assert args[0] == request_msg @@ -43738,7 +43694,6 @@ async def test_create_event_threat_detection_custom_module_empty_call_grpc_async request_msg = ( securitycenter_service.CreateEventThreatDetectionCustomModuleRequest() ) - assert args[0] == request_msg @@ -43765,7 +43720,6 @@ async def test_delete_event_threat_detection_custom_module_empty_call_grpc_async request_msg = ( securitycenter_service.DeleteEventThreatDetectionCustomModuleRequest() ) - assert args[0] == request_msg @@ -43802,7 +43756,6 @@ async def test_get_event_threat_detection_custom_module_empty_call_grpc_asyncio( request_msg = ( securitycenter_service.GetEventThreatDetectionCustomModuleRequest() ) - assert args[0] == request_msg @@ -43832,7 +43785,6 @@ async def test_list_descendant_event_threat_detection_custom_modules_empty_call_ call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListDescendantEventThreatDetectionCustomModulesRequest() - assert args[0] == request_msg @@ -43863,7 +43815,6 @@ async def test_list_event_threat_detection_custom_modules_empty_call_grpc_asynci request_msg = ( securitycenter_service.ListEventThreatDetectionCustomModulesRequest() ) - assert args[0] == request_msg @@ -43900,7 +43851,6 @@ async def test_update_event_threat_detection_custom_module_empty_call_grpc_async request_msg = ( securitycenter_service.UpdateEventThreatDetectionCustomModuleRequest() ) - assert args[0] == request_msg @@ -43929,7 +43879,6 @@ async def test_validate_event_threat_detection_custom_module_empty_call_grpc_asy request_msg = ( securitycenter_service.ValidateEventThreatDetectionCustomModuleRequest() ) - assert args[0] == request_msg @@ -43965,7 +43914,6 @@ async def test_get_effective_event_threat_detection_custom_module_empty_call_grp request_msg = ( securitycenter_service.GetEffectiveEventThreatDetectionCustomModuleRequest() ) - assert args[0] == request_msg @@ -43995,7 +43943,6 @@ async def test_list_effective_event_threat_detection_custom_modules_empty_call_g call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListEffectiveEventThreatDetectionCustomModulesRequest() - assert args[0] == request_msg @@ -44022,7 +43969,6 @@ async def test_batch_create_resource_value_configs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.BatchCreateResourceValueConfigsRequest() - assert args[0] == request_msg @@ -44047,7 +43993,6 @@ async def test_delete_resource_value_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.DeleteResourceValueConfigRequest() - assert args[0] == request_msg @@ -44082,7 +44027,6 @@ async def test_get_resource_value_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GetResourceValueConfigRequest() - assert args[0] == request_msg @@ -44111,7 +44055,6 @@ async def test_list_resource_value_configs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListResourceValueConfigsRequest() - assert args[0] == request_msg @@ -44146,7 +44089,6 @@ async def test_update_resource_value_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateResourceValueConfigRequest() - assert args[0] == request_msg @@ -44176,7 +44118,6 @@ async def test_list_valued_resources_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListValuedResourcesRequest() - assert args[0] == request_msg @@ -44205,7 +44146,6 @@ async def test_list_attack_paths_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListAttackPathsRequest() - assert args[0] == request_msg @@ -55614,7 +55554,6 @@ def test_bulk_mute_findings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.BulkMuteFindingsRequest() - assert args[0] == request_msg @@ -55639,7 +55578,6 @@ def test_create_security_health_analytics_custom_module_empty_call_rest(): request_msg = ( securitycenter_service.CreateSecurityHealthAnalyticsCustomModuleRequest() ) - assert args[0] == request_msg @@ -55659,7 +55597,6 @@ def test_create_source_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.CreateSourceRequest() - assert args[0] == request_msg @@ -55679,7 +55616,6 @@ def test_create_finding_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.CreateFindingRequest() - assert args[0] == request_msg @@ -55701,7 +55637,6 @@ def test_create_mute_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.CreateMuteConfigRequest() - assert args[0] == request_msg @@ -55723,7 +55658,6 @@ def test_create_notification_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.CreateNotificationConfigRequest() - assert args[0] == request_msg @@ -55745,7 +55679,6 @@ def test_delete_mute_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.DeleteMuteConfigRequest() - assert args[0] == request_msg @@ -55767,7 +55700,6 @@ def test_delete_notification_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.DeleteNotificationConfigRequest() - assert args[0] == request_msg @@ -55792,7 +55724,6 @@ def test_delete_security_health_analytics_custom_module_empty_call_rest(): request_msg = ( securitycenter_service.DeleteSecurityHealthAnalyticsCustomModuleRequest() ) - assert args[0] == request_msg @@ -55812,7 +55743,6 @@ def test_get_simulation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GetSimulationRequest() - assert args[0] == request_msg @@ -55834,7 +55764,6 @@ def test_get_valued_resource_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GetValuedResourceRequest() - assert args[0] == request_msg @@ -55856,7 +55785,6 @@ def test_get_big_query_export_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GetBigQueryExportRequest() - assert args[0] == request_msg @@ -55876,7 +55804,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -55896,7 +55823,6 @@ def test_get_mute_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GetMuteConfigRequest() - assert args[0] == request_msg @@ -55918,7 +55844,6 @@ def test_get_notification_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GetNotificationConfigRequest() - assert args[0] == request_msg @@ -55940,7 +55865,6 @@ def test_get_organization_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GetOrganizationSettingsRequest() - assert args[0] == request_msg @@ -55963,7 +55887,6 @@ def test_get_effective_security_health_analytics_custom_module_empty_call_rest() call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GetEffectiveSecurityHealthAnalyticsCustomModuleRequest() - assert args[0] == request_msg @@ -55987,7 +55910,6 @@ def test_get_security_health_analytics_custom_module_empty_call_rest(): request_msg = ( securitycenter_service.GetSecurityHealthAnalyticsCustomModuleRequest() ) - assert args[0] == request_msg @@ -56007,7 +55929,6 @@ def test_get_source_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GetSourceRequest() - assert args[0] == request_msg @@ -56027,7 +55948,6 @@ def test_group_assets_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GroupAssetsRequest() - assert args[0] == request_msg @@ -56047,7 +55967,6 @@ def test_group_findings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GroupFindingsRequest() - assert args[0] == request_msg @@ -56067,7 +55986,6 @@ def test_list_assets_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListAssetsRequest() - assert args[0] == request_msg @@ -56090,7 +56008,6 @@ def test_list_descendant_security_health_analytics_custom_modules_empty_call_res call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListDescendantSecurityHealthAnalyticsCustomModulesRequest() - assert args[0] == request_msg @@ -56110,7 +56027,6 @@ def test_list_findings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListFindingsRequest() - assert args[0] == request_msg @@ -56132,7 +56048,6 @@ def test_list_mute_configs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListMuteConfigsRequest() - assert args[0] == request_msg @@ -56154,7 +56069,6 @@ def test_list_notification_configs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListNotificationConfigsRequest() - assert args[0] == request_msg @@ -56177,7 +56091,6 @@ def test_list_effective_security_health_analytics_custom_modules_empty_call_rest call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListEffectiveSecurityHealthAnalyticsCustomModulesRequest() - assert args[0] == request_msg @@ -56201,7 +56114,6 @@ def test_list_security_health_analytics_custom_modules_empty_call_rest(): request_msg = ( securitycenter_service.ListSecurityHealthAnalyticsCustomModulesRequest() ) - assert args[0] == request_msg @@ -56221,7 +56133,6 @@ def test_list_sources_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListSourcesRequest() - assert args[0] == request_msg @@ -56243,7 +56154,6 @@ def test_run_asset_discovery_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.RunAssetDiscoveryRequest() - assert args[0] == request_msg @@ -56265,7 +56175,6 @@ def test_set_finding_state_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.SetFindingStateRequest() - assert args[0] == request_msg @@ -56285,7 +56194,6 @@ def test_set_mute_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.SetMuteRequest() - assert args[0] == request_msg @@ -56305,7 +56213,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -56327,7 +56234,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -56352,7 +56258,6 @@ def test_simulate_security_health_analytics_custom_module_empty_call_rest(): request_msg = ( securitycenter_service.SimulateSecurityHealthAnalyticsCustomModuleRequest() ) - assert args[0] == request_msg @@ -56374,7 +56279,6 @@ def test_update_external_system_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateExternalSystemRequest() - assert args[0] == request_msg @@ -56394,7 +56298,6 @@ def test_update_finding_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateFindingRequest() - assert args[0] == request_msg @@ -56416,7 +56319,6 @@ def test_update_mute_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateMuteConfigRequest() - assert args[0] == request_msg @@ -56438,7 +56340,6 @@ def test_update_notification_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateNotificationConfigRequest() - assert args[0] == request_msg @@ -56460,7 +56361,6 @@ def test_update_organization_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateOrganizationSettingsRequest() - assert args[0] == request_msg @@ -56485,7 +56385,6 @@ def test_update_security_health_analytics_custom_module_empty_call_rest(): request_msg = ( securitycenter_service.UpdateSecurityHealthAnalyticsCustomModuleRequest() ) - assert args[0] == request_msg @@ -56505,7 +56404,6 @@ def test_update_source_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateSourceRequest() - assert args[0] == request_msg @@ -56527,7 +56425,6 @@ def test_update_security_marks_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateSecurityMarksRequest() - assert args[0] == request_msg @@ -56549,7 +56446,6 @@ def test_create_big_query_export_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.CreateBigQueryExportRequest() - assert args[0] == request_msg @@ -56571,7 +56467,6 @@ def test_delete_big_query_export_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.DeleteBigQueryExportRequest() - assert args[0] == request_msg @@ -56593,7 +56488,6 @@ def test_update_big_query_export_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateBigQueryExportRequest() - assert args[0] == request_msg @@ -56615,7 +56509,6 @@ def test_list_big_query_exports_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListBigQueryExportsRequest() - assert args[0] == request_msg @@ -56639,7 +56532,6 @@ def test_create_event_threat_detection_custom_module_empty_call_rest(): request_msg = ( securitycenter_service.CreateEventThreatDetectionCustomModuleRequest() ) - assert args[0] == request_msg @@ -56663,7 +56555,6 @@ def test_delete_event_threat_detection_custom_module_empty_call_rest(): request_msg = ( securitycenter_service.DeleteEventThreatDetectionCustomModuleRequest() ) - assert args[0] == request_msg @@ -56687,7 +56578,6 @@ def test_get_event_threat_detection_custom_module_empty_call_rest(): request_msg = ( securitycenter_service.GetEventThreatDetectionCustomModuleRequest() ) - assert args[0] == request_msg @@ -56710,7 +56600,6 @@ def test_list_descendant_event_threat_detection_custom_modules_empty_call_rest() call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListDescendantEventThreatDetectionCustomModulesRequest() - assert args[0] == request_msg @@ -56734,7 +56623,6 @@ def test_list_event_threat_detection_custom_modules_empty_call_rest(): request_msg = ( securitycenter_service.ListEventThreatDetectionCustomModulesRequest() ) - assert args[0] == request_msg @@ -56758,7 +56646,6 @@ def test_update_event_threat_detection_custom_module_empty_call_rest(): request_msg = ( securitycenter_service.UpdateEventThreatDetectionCustomModuleRequest() ) - assert args[0] == request_msg @@ -56782,7 +56669,6 @@ def test_validate_event_threat_detection_custom_module_empty_call_rest(): request_msg = ( securitycenter_service.ValidateEventThreatDetectionCustomModuleRequest() ) - assert args[0] == request_msg @@ -56807,7 +56693,6 @@ def test_get_effective_event_threat_detection_custom_module_empty_call_rest(): request_msg = ( securitycenter_service.GetEffectiveEventThreatDetectionCustomModuleRequest() ) - assert args[0] == request_msg @@ -56830,7 +56715,6 @@ def test_list_effective_event_threat_detection_custom_modules_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListEffectiveEventThreatDetectionCustomModulesRequest() - assert args[0] == request_msg @@ -56852,7 +56736,6 @@ def test_batch_create_resource_value_configs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.BatchCreateResourceValueConfigsRequest() - assert args[0] == request_msg @@ -56874,7 +56757,6 @@ def test_delete_resource_value_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.DeleteResourceValueConfigRequest() - assert args[0] == request_msg @@ -56896,7 +56778,6 @@ def test_get_resource_value_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GetResourceValueConfigRequest() - assert args[0] == request_msg @@ -56918,7 +56799,6 @@ def test_list_resource_value_configs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListResourceValueConfigsRequest() - assert args[0] == request_msg @@ -56940,7 +56820,6 @@ def test_update_resource_value_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateResourceValueConfigRequest() - assert args[0] == request_msg @@ -56962,7 +56841,6 @@ def test_list_valued_resources_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListValuedResourcesRequest() - assert args[0] == request_msg @@ -56984,7 +56862,6 @@ def test_list_attack_paths_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListAttackPathsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-securitycenter/tests/unit/gapic/securitycenter_v1beta1/test_security_center.py b/packages/google-cloud-securitycenter/tests/unit/gapic/securitycenter_v1beta1/test_security_center.py index 7631227e0424..6dd43982217f 100644 --- a/packages/google-cloud-securitycenter/tests/unit/gapic/securitycenter_v1beta1/test_security_center.py +++ b/packages/google-cloud-securitycenter/tests/unit/gapic/securitycenter_v1beta1/test_security_center.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 @@ -135,6 +136,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" @@ -1338,8 +1354,8 @@ def test_security_center_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - securitycenter_service.CreateSourceRequest, - dict, + securitycenter_service.CreateSourceRequest(), + {}, ], ) def test_create_source(request_type, transport: str = "grpc"): @@ -1350,7 +1366,7 @@ def test_create_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(type(client.transport.create_source), "__call__") as call: @@ -1398,9 +1414,10 @@ def test_create_source_non_empty_request_with_auto_populated_field(): client.create_source(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.CreateSourceRequest( + request_msg = securitycenter_service.CreateSourceRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_source_use_cached_wrapped_rpc(): @@ -1481,10 +1498,14 @@ async def test_create_source_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_source_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.CreateSourceRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.CreateSourceRequest(), + {}, + ], +) +async def test_create_source_async(request_type, transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1492,7 +1513,7 @@ async def test_create_source_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_source), "__call__") as call: @@ -1519,11 +1540,6 @@ async def test_create_source_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_create_source_async_from_dict(): - await test_create_source_async(request_type=dict) - - def test_create_source_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1676,8 +1692,8 @@ async def test_create_source_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.CreateFindingRequest, - dict, + securitycenter_service.CreateFindingRequest(), + {}, ], ) def test_create_finding(request_type, transport: str = "grpc"): @@ -1688,7 +1704,7 @@ def test_create_finding(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_finding), "__call__") as call: @@ -1743,10 +1759,11 @@ def test_create_finding_non_empty_request_with_auto_populated_field(): client.create_finding(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.CreateFindingRequest( + request_msg = securitycenter_service.CreateFindingRequest( parent="parent_value", finding_id="finding_id_value", ) + assert args[0] == request_msg def test_create_finding_use_cached_wrapped_rpc(): @@ -1827,10 +1844,14 @@ async def test_create_finding_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_finding_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.CreateFindingRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.CreateFindingRequest(), + {}, + ], +) +async def test_create_finding_async(request_type, transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1838,7 +1859,7 @@ async def test_create_finding_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_finding), "__call__") as call: @@ -1871,11 +1892,6 @@ async def test_create_finding_async( assert response.external_uri == "external_uri_value" -@pytest.mark.asyncio -async def test_create_finding_async_from_dict(): - await test_create_finding_async(request_type=dict) - - def test_create_finding_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2038,8 +2054,8 @@ async def test_create_finding_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.GetIamPolicyRequest, - dict, + iam_policy_pb2.GetIamPolicyRequest(), + {}, ], ) def test_get_iam_policy(request_type, transport: str = "grpc"): @@ -2050,7 +2066,7 @@ def test_get_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(type(client.transport.get_iam_policy), "__call__") as call: @@ -2096,9 +2112,10 @@ def test_get_iam_policy_non_empty_request_with_auto_populated_field(): client.get_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.GetIamPolicyRequest( + request_msg = iam_policy_pb2.GetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_get_iam_policy_use_cached_wrapped_rpc(): @@ -2179,9 +2196,14 @@ async def test_get_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.GetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.GetIamPolicyRequest(), + {}, + ], +) +async def test_get_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2189,7 +2211,7 @@ async def test_get_iam_policy_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_iam_policy), "__call__") as call: @@ -2214,11 +2236,6 @@ async def test_get_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_get_iam_policy_async_from_dict(): - await test_get_iam_policy_async(request_type=dict) - - def test_get_iam_policy_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2378,8 +2395,8 @@ async def test_get_iam_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.GetOrganizationSettingsRequest, - dict, + securitycenter_service.GetOrganizationSettingsRequest(), + {}, ], ) def test_get_organization_settings(request_type, transport: str = "grpc"): @@ -2390,7 +2407,7 @@ def test_get_organization_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( @@ -2440,9 +2457,10 @@ def test_get_organization_settings_non_empty_request_with_auto_populated_field() client.get_organization_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.GetOrganizationSettingsRequest( + request_msg = securitycenter_service.GetOrganizationSettingsRequest( name="name_value", ) + assert args[0] == request_msg def test_get_organization_settings_use_cached_wrapped_rpc(): @@ -2528,9 +2546,15 @@ async def test_get_organization_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.GetOrganizationSettingsRequest(), + {}, + ], +) async def test_get_organization_settings_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.GetOrganizationSettingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -2539,7 +2563,7 @@ async def test_get_organization_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( @@ -2566,11 +2590,6 @@ async def test_get_organization_settings_async( assert response.enable_asset_discovery is True -@pytest.mark.asyncio -async def test_get_organization_settings_async_from_dict(): - await test_get_organization_settings_async(request_type=dict) - - def test_get_organization_settings_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2725,8 +2744,8 @@ async def test_get_organization_settings_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.GetSourceRequest, - dict, + securitycenter_service.GetSourceRequest(), + {}, ], ) def test_get_source(request_type, transport: str = "grpc"): @@ -2737,7 +2756,7 @@ def test_get_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(type(client.transport.get_source), "__call__") as call: @@ -2785,9 +2804,10 @@ def test_get_source_non_empty_request_with_auto_populated_field(): client.get_source(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.GetSourceRequest( + request_msg = securitycenter_service.GetSourceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_source_use_cached_wrapped_rpc(): @@ -2866,10 +2886,14 @@ async def test_get_source_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_source_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.GetSourceRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.GetSourceRequest(), + {}, + ], +) +async def test_get_source_async(request_type, transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2877,7 +2901,7 @@ async def test_get_source_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_source), "__call__") as call: @@ -2904,11 +2928,6 @@ async def test_get_source_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_get_source_async_from_dict(): - await test_get_source_async(request_type=dict) - - def test_get_source_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3051,8 +3070,8 @@ async def test_get_source_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.GroupAssetsRequest, - dict, + securitycenter_service.GroupAssetsRequest(), + {}, ], ) def test_group_assets(request_type, transport: str = "grpc"): @@ -3063,7 +3082,7 @@ def test_group_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(type(client.transport.group_assets), "__call__") as call: @@ -3110,12 +3129,13 @@ def test_group_assets_non_empty_request_with_auto_populated_field(): client.group_assets(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.GroupAssetsRequest( + request_msg = securitycenter_service.GroupAssetsRequest( parent="parent_value", filter="filter_value", group_by="group_by_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_group_assets_use_cached_wrapped_rpc(): @@ -3196,10 +3216,14 @@ async def test_group_assets_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_group_assets_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.GroupAssetsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.GroupAssetsRequest(), + {}, + ], +) +async def test_group_assets_async(request_type, transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3207,7 +3231,7 @@ async def test_group_assets_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.group_assets), "__call__") as call: @@ -3230,11 +3254,6 @@ async def test_group_assets_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_group_assets_async_from_dict(): - await test_group_assets_async(request_type=dict) - - def test_group_assets_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3489,8 +3508,8 @@ async def test_group_assets_async_pages(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.GroupFindingsRequest, - dict, + securitycenter_service.GroupFindingsRequest(), + {}, ], ) def test_group_findings(request_type, transport: str = "grpc"): @@ -3501,7 +3520,7 @@ def test_group_findings(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.group_findings), "__call__") as call: @@ -3548,12 +3567,13 @@ def test_group_findings_non_empty_request_with_auto_populated_field(): client.group_findings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.GroupFindingsRequest( + request_msg = securitycenter_service.GroupFindingsRequest( parent="parent_value", filter="filter_value", group_by="group_by_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_group_findings_use_cached_wrapped_rpc(): @@ -3634,10 +3654,14 @@ async def test_group_findings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_group_findings_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.GroupFindingsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.GroupFindingsRequest(), + {}, + ], +) +async def test_group_findings_async(request_type, transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3645,7 +3669,7 @@ async def test_group_findings_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.group_findings), "__call__") as call: @@ -3668,11 +3692,6 @@ async def test_group_findings_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_group_findings_async_from_dict(): - await test_group_findings_async(request_type=dict) - - def test_group_findings_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4019,8 +4038,8 @@ async def test_group_findings_async_pages(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.ListAssetsRequest, - dict, + securitycenter_service.ListAssetsRequest(), + {}, ], ) def test_list_assets(request_type, transport: str = "grpc"): @@ -4031,7 +4050,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(type(client.transport.list_assets), "__call__") as call: @@ -4080,12 +4099,13 @@ 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] == securitycenter_service.ListAssetsRequest( + request_msg = securitycenter_service.ListAssetsRequest( parent="parent_value", filter="filter_value", order_by="order_by_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_assets_use_cached_wrapped_rpc(): @@ -4166,10 +4186,14 @@ async def test_list_assets_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_assets_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.ListAssetsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.ListAssetsRequest(), + {}, + ], +) +async def test_list_assets_async(request_type, transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4177,7 +4201,7 @@ async def test_list_assets_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_assets), "__call__") as call: @@ -4202,11 +4226,6 @@ async def test_list_assets_async( assert response.total_size == 1086 -@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 = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4467,8 +4486,8 @@ async def test_list_assets_async_pages(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.ListFindingsRequest, - dict, + securitycenter_service.ListFindingsRequest(), + {}, ], ) def test_list_findings(request_type, transport: str = "grpc"): @@ -4479,7 +4498,7 @@ def test_list_findings(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_findings), "__call__") as call: @@ -4528,12 +4547,13 @@ def test_list_findings_non_empty_request_with_auto_populated_field(): client.list_findings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.ListFindingsRequest( + request_msg = securitycenter_service.ListFindingsRequest( parent="parent_value", filter="filter_value", order_by="order_by_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_findings_use_cached_wrapped_rpc(): @@ -4614,10 +4634,14 @@ async def test_list_findings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_findings_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.ListFindingsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.ListFindingsRequest(), + {}, + ], +) +async def test_list_findings_async(request_type, transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4625,7 +4649,7 @@ async def test_list_findings_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_findings), "__call__") as call: @@ -4650,11 +4674,6 @@ async def test_list_findings_async( assert response.total_size == 1086 -@pytest.mark.asyncio -async def test_list_findings_async_from_dict(): - await test_list_findings_async(request_type=dict) - - def test_list_findings_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4909,8 +4928,8 @@ async def test_list_findings_async_pages(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.ListSourcesRequest, - dict, + securitycenter_service.ListSourcesRequest(), + {}, ], ) def test_list_sources(request_type, transport: str = "grpc"): @@ -4921,7 +4940,7 @@ def test_list_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(type(client.transport.list_sources), "__call__") as call: @@ -4966,10 +4985,11 @@ def test_list_sources_non_empty_request_with_auto_populated_field(): client.list_sources(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.ListSourcesRequest( + request_msg = securitycenter_service.ListSourcesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_sources_use_cached_wrapped_rpc(): @@ -5050,10 +5070,14 @@ async def test_list_sources_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_sources_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.ListSourcesRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.ListSourcesRequest(), + {}, + ], +) +async def test_list_sources_async(request_type, transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5061,7 +5085,7 @@ async def test_list_sources_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_sources), "__call__") as call: @@ -5084,11 +5108,6 @@ async def test_list_sources_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_sources_async_from_dict(): - await test_list_sources_async(request_type=dict) - - def test_list_sources_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5425,8 +5444,8 @@ async def test_list_sources_async_pages(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.RunAssetDiscoveryRequest, - dict, + securitycenter_service.RunAssetDiscoveryRequest(), + {}, ], ) def test_run_asset_discovery(request_type, transport: str = "grpc"): @@ -5437,7 +5456,7 @@ def test_run_asset_discovery(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5482,9 +5501,10 @@ def test_run_asset_discovery_non_empty_request_with_auto_populated_field(): client.run_asset_discovery(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.RunAssetDiscoveryRequest( + request_msg = securitycenter_service.RunAssetDiscoveryRequest( parent="parent_value", ) + assert args[0] == request_msg def test_run_asset_discovery_use_cached_wrapped_rpc(): @@ -5579,10 +5599,14 @@ async def test_run_asset_discovery_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_run_asset_discovery_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.RunAssetDiscoveryRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.RunAssetDiscoveryRequest(), + {}, + ], +) +async def test_run_asset_discovery_async(request_type, transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5590,7 +5614,7 @@ async def test_run_asset_discovery_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( @@ -5612,11 +5636,6 @@ async def test_run_asset_discovery_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_run_asset_discovery_async_from_dict(): - await test_run_asset_discovery_async(request_type=dict) - - def test_run_asset_discovery_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5771,8 +5790,8 @@ async def test_run_asset_discovery_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.SetFindingStateRequest, - dict, + securitycenter_service.SetFindingStateRequest(), + {}, ], ) def test_set_finding_state(request_type, transport: str = "grpc"): @@ -5783,7 +5802,7 @@ def test_set_finding_state(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,9 +5860,10 @@ def test_set_finding_state_non_empty_request_with_auto_populated_field(): client.set_finding_state(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.SetFindingStateRequest( + request_msg = securitycenter_service.SetFindingStateRequest( name="name_value", ) + assert args[0] == request_msg def test_set_finding_state_use_cached_wrapped_rpc(): @@ -5926,10 +5946,14 @@ async def test_set_finding_state_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_finding_state_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.SetFindingStateRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.SetFindingStateRequest(), + {}, + ], +) +async def test_set_finding_state_async(request_type, transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5937,7 +5961,7 @@ async def test_set_finding_state_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( @@ -5972,11 +5996,6 @@ async def test_set_finding_state_async( assert response.external_uri == "external_uri_value" -@pytest.mark.asyncio -async def test_set_finding_state_async_from_dict(): - await test_set_finding_state_async(request_type=dict) - - def test_set_finding_state_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6147,8 +6166,8 @@ async def test_set_finding_state_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.SetIamPolicyRequest, - dict, + iam_policy_pb2.SetIamPolicyRequest(), + {}, ], ) def test_set_iam_policy(request_type, transport: str = "grpc"): @@ -6159,7 +6178,7 @@ def test_set_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(type(client.transport.set_iam_policy), "__call__") as call: @@ -6205,9 +6224,10 @@ def test_set_iam_policy_non_empty_request_with_auto_populated_field(): client.set_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.SetIamPolicyRequest( + request_msg = iam_policy_pb2.SetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_set_iam_policy_use_cached_wrapped_rpc(): @@ -6288,9 +6308,14 @@ async def test_set_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.SetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.SetIamPolicyRequest(), + {}, + ], +) +async def test_set_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6298,7 +6323,7 @@ async def test_set_iam_policy_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.set_iam_policy), "__call__") as call: @@ -6323,11 +6348,6 @@ async def test_set_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_set_iam_policy_async_from_dict(): - await test_set_iam_policy_async(request_type=dict) - - def test_set_iam_policy_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6488,8 +6508,8 @@ async def test_set_iam_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.TestIamPermissionsRequest, - dict, + iam_policy_pb2.TestIamPermissionsRequest(), + {}, ], ) def test_test_iam_permissions(request_type, transport: str = "grpc"): @@ -6500,7 +6520,7 @@ def test_test_iam_permissions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6548,9 +6568,10 @@ def test_test_iam_permissions_non_empty_request_with_auto_populated_field(): client.test_iam_permissions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.TestIamPermissionsRequest( + request_msg = iam_policy_pb2.TestIamPermissionsRequest( resource="resource_value", ) + assert args[0] == request_msg def test_test_iam_permissions_use_cached_wrapped_rpc(): @@ -6635,9 +6656,15 @@ async def test_test_iam_permissions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.TestIamPermissionsRequest(), + {}, + ], +) async def test_test_iam_permissions_async( - transport: str = "grpc_asyncio", - request_type=iam_policy_pb2.TestIamPermissionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -6646,7 +6673,7 @@ async def test_test_iam_permissions_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( @@ -6671,11 +6698,6 @@ async def test_test_iam_permissions_async( assert response.permissions == ["permissions_value"] -@pytest.mark.asyncio -async def test_test_iam_permissions_async_from_dict(): - await test_test_iam_permissions_async(request_type=dict) - - def test_test_iam_permissions_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6859,8 +6881,8 @@ async def test_test_iam_permissions_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.UpdateFindingRequest, - dict, + securitycenter_service.UpdateFindingRequest(), + {}, ], ) def test_update_finding(request_type, transport: str = "grpc"): @@ -6871,7 +6893,7 @@ def test_update_finding(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_finding), "__call__") as call: @@ -6923,7 +6945,8 @@ def test_update_finding_non_empty_request_with_auto_populated_field(): client.update_finding(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.UpdateFindingRequest() + request_msg = securitycenter_service.UpdateFindingRequest() + assert args[0] == request_msg def test_update_finding_use_cached_wrapped_rpc(): @@ -7004,10 +7027,14 @@ async def test_update_finding_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_finding_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.UpdateFindingRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.UpdateFindingRequest(), + {}, + ], +) +async def test_update_finding_async(request_type, transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7015,7 +7042,7 @@ async def test_update_finding_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_finding), "__call__") as call: @@ -7048,11 +7075,6 @@ async def test_update_finding_async( assert response.external_uri == "external_uri_value" -@pytest.mark.asyncio -async def test_update_finding_async_from_dict(): - await test_update_finding_async(request_type=dict) - - def test_update_finding_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7195,8 +7217,8 @@ async def test_update_finding_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.UpdateOrganizationSettingsRequest, - dict, + securitycenter_service.UpdateOrganizationSettingsRequest(), + {}, ], ) def test_update_organization_settings(request_type, transport: str = "grpc"): @@ -7207,7 +7229,7 @@ def test_update_organization_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( @@ -7255,7 +7277,8 @@ def test_update_organization_settings_non_empty_request_with_auto_populated_fiel client.update_organization_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.UpdateOrganizationSettingsRequest() + request_msg = securitycenter_service.UpdateOrganizationSettingsRequest() + assert args[0] == request_msg def test_update_organization_settings_use_cached_wrapped_rpc(): @@ -7341,9 +7364,15 @@ async def test_update_organization_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.UpdateOrganizationSettingsRequest(), + {}, + ], +) async def test_update_organization_settings_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.UpdateOrganizationSettingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -7352,7 +7381,7 @@ async def test_update_organization_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( @@ -7379,11 +7408,6 @@ async def test_update_organization_settings_async( assert response.enable_asset_discovery is True -@pytest.mark.asyncio -async def test_update_organization_settings_async_from_dict(): - await test_update_organization_settings_async(request_type=dict) - - def test_update_organization_settings_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7546,8 +7570,8 @@ async def test_update_organization_settings_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.UpdateSourceRequest, - dict, + securitycenter_service.UpdateSourceRequest(), + {}, ], ) def test_update_source(request_type, transport: str = "grpc"): @@ -7558,7 +7582,7 @@ def test_update_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(type(client.transport.update_source), "__call__") as call: @@ -7604,7 +7628,8 @@ def test_update_source_non_empty_request_with_auto_populated_field(): client.update_source(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.UpdateSourceRequest() + request_msg = securitycenter_service.UpdateSourceRequest() + assert args[0] == request_msg def test_update_source_use_cached_wrapped_rpc(): @@ -7685,10 +7710,14 @@ async def test_update_source_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_source_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.UpdateSourceRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.UpdateSourceRequest(), + {}, + ], +) +async def test_update_source_async(request_type, transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7696,7 +7725,7 @@ async def test_update_source_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_source), "__call__") as call: @@ -7723,11 +7752,6 @@ async def test_update_source_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_update_source_async_from_dict(): - await test_update_source_async(request_type=dict) - - def test_update_source_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7870,8 +7894,8 @@ async def test_update_source_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.UpdateSecurityMarksRequest, - dict, + securitycenter_service.UpdateSecurityMarksRequest(), + {}, ], ) def test_update_security_marks(request_type, transport: str = "grpc"): @@ -7882,7 +7906,7 @@ def test_update_security_marks(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7928,7 +7952,8 @@ def test_update_security_marks_non_empty_request_with_auto_populated_field(): client.update_security_marks(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.UpdateSecurityMarksRequest() + request_msg = securitycenter_service.UpdateSecurityMarksRequest() + assert args[0] == request_msg def test_update_security_marks_use_cached_wrapped_rpc(): @@ -8014,9 +8039,15 @@ async def test_update_security_marks_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.UpdateSecurityMarksRequest(), + {}, + ], +) async def test_update_security_marks_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.UpdateSecurityMarksRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -8025,7 +8056,7 @@ async def test_update_security_marks_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( @@ -8050,11 +8081,6 @@ async def test_update_security_marks_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_update_security_marks_async_from_dict(): - await test_update_security_marks_async(request_type=dict) - - def test_update_security_marks_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11882,7 +11908,6 @@ def test_create_source_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.CreateSourceRequest() - assert args[0] == request_msg @@ -11903,7 +11928,6 @@ def test_create_finding_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.CreateFindingRequest() - assert args[0] == request_msg @@ -11924,7 +11948,6 @@ def test_get_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -11947,7 +11970,6 @@ def test_get_organization_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GetOrganizationSettingsRequest() - assert args[0] == request_msg @@ -11968,7 +11990,6 @@ def test_get_source_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GetSourceRequest() - assert args[0] == request_msg @@ -11989,7 +12010,6 @@ def test_group_assets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GroupAssetsRequest() - assert args[0] == request_msg @@ -12010,7 +12030,6 @@ def test_group_findings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GroupFindingsRequest() - assert args[0] == request_msg @@ -12031,7 +12050,6 @@ def test_list_assets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListAssetsRequest() - assert args[0] == request_msg @@ -12052,7 +12070,6 @@ def test_list_findings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListFindingsRequest() - assert args[0] == request_msg @@ -12073,7 +12090,6 @@ def test_list_sources_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListSourcesRequest() - assert args[0] == request_msg @@ -12096,7 +12112,6 @@ def test_run_asset_discovery_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.RunAssetDiscoveryRequest() - assert args[0] == request_msg @@ -12119,7 +12134,6 @@ def test_set_finding_state_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.SetFindingStateRequest() - assert args[0] == request_msg @@ -12140,7 +12154,6 @@ def test_set_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -12163,7 +12176,6 @@ def test_test_iam_permissions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -12184,7 +12196,6 @@ def test_update_finding_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateFindingRequest() - assert args[0] == request_msg @@ -12207,7 +12218,6 @@ def test_update_organization_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateOrganizationSettingsRequest() - assert args[0] == request_msg @@ -12228,7 +12238,6 @@ def test_update_source_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateSourceRequest() - assert args[0] == request_msg @@ -12251,7 +12260,6 @@ def test_update_security_marks_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateSecurityMarksRequest() - assert args[0] == request_msg @@ -12294,7 +12302,6 @@ async def test_create_source_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.CreateSourceRequest() - assert args[0] == request_msg @@ -12326,7 +12333,6 @@ async def test_create_finding_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.CreateFindingRequest() - assert args[0] == request_msg @@ -12354,7 +12360,6 @@ async def test_get_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -12384,7 +12389,6 @@ async def test_get_organization_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GetOrganizationSettingsRequest() - assert args[0] == request_msg @@ -12413,7 +12417,6 @@ async def test_get_source_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GetSourceRequest() - assert args[0] == request_msg @@ -12440,7 +12443,6 @@ async def test_group_assets_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GroupAssetsRequest() - assert args[0] == request_msg @@ -12467,7 +12469,6 @@ async def test_group_findings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GroupFindingsRequest() - assert args[0] == request_msg @@ -12495,7 +12496,6 @@ async def test_list_assets_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListAssetsRequest() - assert args[0] == request_msg @@ -12523,7 +12523,6 @@ async def test_list_findings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListFindingsRequest() - assert args[0] == request_msg @@ -12550,7 +12549,6 @@ async def test_list_sources_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListSourcesRequest() - assert args[0] == request_msg @@ -12577,7 +12575,6 @@ async def test_run_asset_discovery_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.RunAssetDiscoveryRequest() - assert args[0] == request_msg @@ -12611,7 +12608,6 @@ async def test_set_finding_state_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.SetFindingStateRequest() - assert args[0] == request_msg @@ -12639,7 +12635,6 @@ async def test_set_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -12668,7 +12663,6 @@ async def test_test_iam_permissions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -12700,7 +12694,6 @@ async def test_update_finding_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateFindingRequest() - assert args[0] == request_msg @@ -12730,7 +12723,6 @@ async def test_update_organization_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateOrganizationSettingsRequest() - assert args[0] == request_msg @@ -12759,7 +12751,6 @@ async def test_update_source_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateSourceRequest() - assert args[0] == request_msg @@ -12788,7 +12779,6 @@ async def test_update_security_marks_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateSecurityMarksRequest() - assert args[0] == request_msg @@ -15716,7 +15706,6 @@ def test_create_source_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.CreateSourceRequest() - assert args[0] == request_msg @@ -15736,7 +15725,6 @@ def test_create_finding_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.CreateFindingRequest() - assert args[0] == request_msg @@ -15756,7 +15744,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -15778,7 +15765,6 @@ def test_get_organization_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GetOrganizationSettingsRequest() - assert args[0] == request_msg @@ -15798,7 +15784,6 @@ def test_get_source_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GetSourceRequest() - assert args[0] == request_msg @@ -15818,7 +15803,6 @@ def test_group_assets_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GroupAssetsRequest() - assert args[0] == request_msg @@ -15838,7 +15822,6 @@ def test_group_findings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GroupFindingsRequest() - assert args[0] == request_msg @@ -15858,7 +15841,6 @@ def test_list_assets_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListAssetsRequest() - assert args[0] == request_msg @@ -15878,7 +15860,6 @@ def test_list_findings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListFindingsRequest() - assert args[0] == request_msg @@ -15898,7 +15879,6 @@ def test_list_sources_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListSourcesRequest() - assert args[0] == request_msg @@ -15920,7 +15900,6 @@ def test_run_asset_discovery_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.RunAssetDiscoveryRequest() - assert args[0] == request_msg @@ -15942,7 +15921,6 @@ def test_set_finding_state_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.SetFindingStateRequest() - assert args[0] == request_msg @@ -15962,7 +15940,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -15984,7 +15961,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -16004,7 +15980,6 @@ def test_update_finding_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateFindingRequest() - assert args[0] == request_msg @@ -16026,7 +16001,6 @@ def test_update_organization_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateOrganizationSettingsRequest() - assert args[0] == request_msg @@ -16046,7 +16020,6 @@ def test_update_source_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateSourceRequest() - assert args[0] == request_msg @@ -16068,7 +16041,6 @@ def test_update_security_marks_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateSecurityMarksRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-securitycenter/tests/unit/gapic/securitycenter_v1p1beta1/test_security_center.py b/packages/google-cloud-securitycenter/tests/unit/gapic/securitycenter_v1p1beta1/test_security_center.py index a5cb6134d493..cc706f162579 100644 --- a/packages/google-cloud-securitycenter/tests/unit/gapic/securitycenter_v1p1beta1/test_security_center.py +++ b/packages/google-cloud-securitycenter/tests/unit/gapic/securitycenter_v1p1beta1/test_security_center.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 @@ -140,6 +141,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" @@ -1343,8 +1359,8 @@ def test_security_center_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - securitycenter_service.CreateSourceRequest, - dict, + securitycenter_service.CreateSourceRequest(), + {}, ], ) def test_create_source(request_type, transport: str = "grpc"): @@ -1355,7 +1371,7 @@ def test_create_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(type(client.transport.create_source), "__call__") as call: @@ -1405,9 +1421,10 @@ def test_create_source_non_empty_request_with_auto_populated_field(): client.create_source(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.CreateSourceRequest( + request_msg = securitycenter_service.CreateSourceRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_source_use_cached_wrapped_rpc(): @@ -1488,10 +1505,14 @@ async def test_create_source_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_source_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.CreateSourceRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.CreateSourceRequest(), + {}, + ], +) +async def test_create_source_async(request_type, transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1499,7 +1520,7 @@ async def test_create_source_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_source), "__call__") as call: @@ -1528,11 +1549,6 @@ async def test_create_source_async( assert response.canonical_name == "canonical_name_value" -@pytest.mark.asyncio -async def test_create_source_async_from_dict(): - await test_create_source_async(request_type=dict) - - def test_create_source_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1685,8 +1701,8 @@ async def test_create_source_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.CreateFindingRequest, - dict, + securitycenter_service.CreateFindingRequest(), + {}, ], ) def test_create_finding(request_type, transport: str = "grpc"): @@ -1697,7 +1713,7 @@ def test_create_finding(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_finding), "__call__") as call: @@ -1756,10 +1772,11 @@ def test_create_finding_non_empty_request_with_auto_populated_field(): client.create_finding(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.CreateFindingRequest( + request_msg = securitycenter_service.CreateFindingRequest( parent="parent_value", finding_id="finding_id_value", ) + assert args[0] == request_msg def test_create_finding_use_cached_wrapped_rpc(): @@ -1840,10 +1857,14 @@ async def test_create_finding_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_finding_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.CreateFindingRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.CreateFindingRequest(), + {}, + ], +) +async def test_create_finding_async(request_type, transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1851,7 +1872,7 @@ async def test_create_finding_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_finding), "__call__") as call: @@ -1888,11 +1909,6 @@ async def test_create_finding_async( assert response.canonical_name == "canonical_name_value" -@pytest.mark.asyncio -async def test_create_finding_async_from_dict(): - await test_create_finding_async(request_type=dict) - - def test_create_finding_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2055,8 +2071,8 @@ async def test_create_finding_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.CreateNotificationConfigRequest, - dict, + securitycenter_service.CreateNotificationConfigRequest(), + {}, ], ) def test_create_notification_config(request_type, transport: str = "grpc"): @@ -2067,7 +2083,7 @@ def test_create_notification_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( @@ -2127,10 +2143,11 @@ def test_create_notification_config_non_empty_request_with_auto_populated_field( client.create_notification_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.CreateNotificationConfigRequest( + request_msg = securitycenter_service.CreateNotificationConfigRequest( parent="parent_value", config_id="config_id_value", ) + assert args[0] == request_msg def test_create_notification_config_use_cached_wrapped_rpc(): @@ -2216,9 +2233,15 @@ async def test_create_notification_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.CreateNotificationConfigRequest(), + {}, + ], +) async def test_create_notification_config_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.CreateNotificationConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -2227,7 +2250,7 @@ async def test_create_notification_config_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( @@ -2263,11 +2286,6 @@ async def test_create_notification_config_async( assert response.service_account == "service_account_value" -@pytest.mark.asyncio -async def test_create_notification_config_async_from_dict(): - await test_create_notification_config_async(request_type=dict) - - def test_create_notification_config_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2450,8 +2468,8 @@ async def test_create_notification_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.DeleteNotificationConfigRequest, - dict, + securitycenter_service.DeleteNotificationConfigRequest(), + {}, ], ) def test_delete_notification_config(request_type, transport: str = "grpc"): @@ -2462,7 +2480,7 @@ def test_delete_notification_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( @@ -2507,9 +2525,10 @@ def test_delete_notification_config_non_empty_request_with_auto_populated_field( client.delete_notification_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.DeleteNotificationConfigRequest( + request_msg = securitycenter_service.DeleteNotificationConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_notification_config_use_cached_wrapped_rpc(): @@ -2595,9 +2614,15 @@ async def test_delete_notification_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.DeleteNotificationConfigRequest(), + {}, + ], +) async def test_delete_notification_config_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.DeleteNotificationConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -2606,7 +2631,7 @@ async def test_delete_notification_config_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( @@ -2626,11 +2651,6 @@ async def test_delete_notification_config_async( assert response is None -@pytest.mark.asyncio -async def test_delete_notification_config_async_from_dict(): - await test_delete_notification_config_async(request_type=dict) - - def test_delete_notification_config_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2781,8 +2801,8 @@ async def test_delete_notification_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.GetIamPolicyRequest, - dict, + iam_policy_pb2.GetIamPolicyRequest(), + {}, ], ) def test_get_iam_policy(request_type, transport: str = "grpc"): @@ -2793,7 +2813,7 @@ def test_get_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(type(client.transport.get_iam_policy), "__call__") as call: @@ -2839,9 +2859,10 @@ def test_get_iam_policy_non_empty_request_with_auto_populated_field(): client.get_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.GetIamPolicyRequest( + request_msg = iam_policy_pb2.GetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_get_iam_policy_use_cached_wrapped_rpc(): @@ -2922,9 +2943,14 @@ async def test_get_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.GetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.GetIamPolicyRequest(), + {}, + ], +) +async def test_get_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2932,7 +2958,7 @@ async def test_get_iam_policy_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_iam_policy), "__call__") as call: @@ -2957,11 +2983,6 @@ async def test_get_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_get_iam_policy_async_from_dict(): - await test_get_iam_policy_async(request_type=dict) - - def test_get_iam_policy_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3121,8 +3142,8 @@ async def test_get_iam_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.GetNotificationConfigRequest, - dict, + securitycenter_service.GetNotificationConfigRequest(), + {}, ], ) def test_get_notification_config(request_type, transport: str = "grpc"): @@ -3133,7 +3154,7 @@ def test_get_notification_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( @@ -3191,9 +3212,10 @@ def test_get_notification_config_non_empty_request_with_auto_populated_field(): client.get_notification_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.GetNotificationConfigRequest( + request_msg = securitycenter_service.GetNotificationConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_notification_config_use_cached_wrapped_rpc(): @@ -3279,9 +3301,15 @@ async def test_get_notification_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.GetNotificationConfigRequest(), + {}, + ], +) async def test_get_notification_config_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.GetNotificationConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -3290,7 +3318,7 @@ async def test_get_notification_config_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( @@ -3325,11 +3353,6 @@ async def test_get_notification_config_async( assert response.service_account == "service_account_value" -@pytest.mark.asyncio -async def test_get_notification_config_async_from_dict(): - await test_get_notification_config_async(request_type=dict) - - def test_get_notification_config_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3484,8 +3507,8 @@ async def test_get_notification_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.GetOrganizationSettingsRequest, - dict, + securitycenter_service.GetOrganizationSettingsRequest(), + {}, ], ) def test_get_organization_settings(request_type, transport: str = "grpc"): @@ -3496,7 +3519,7 @@ def test_get_organization_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( @@ -3546,9 +3569,10 @@ def test_get_organization_settings_non_empty_request_with_auto_populated_field() client.get_organization_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.GetOrganizationSettingsRequest( + request_msg = securitycenter_service.GetOrganizationSettingsRequest( name="name_value", ) + assert args[0] == request_msg def test_get_organization_settings_use_cached_wrapped_rpc(): @@ -3634,9 +3658,15 @@ async def test_get_organization_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.GetOrganizationSettingsRequest(), + {}, + ], +) async def test_get_organization_settings_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.GetOrganizationSettingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -3645,7 +3675,7 @@ async def test_get_organization_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( @@ -3672,11 +3702,6 @@ async def test_get_organization_settings_async( assert response.enable_asset_discovery is True -@pytest.mark.asyncio -async def test_get_organization_settings_async_from_dict(): - await test_get_organization_settings_async(request_type=dict) - - def test_get_organization_settings_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3831,8 +3856,8 @@ async def test_get_organization_settings_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.GetSourceRequest, - dict, + securitycenter_service.GetSourceRequest(), + {}, ], ) def test_get_source(request_type, transport: str = "grpc"): @@ -3843,7 +3868,7 @@ def test_get_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(type(client.transport.get_source), "__call__") as call: @@ -3893,9 +3918,10 @@ def test_get_source_non_empty_request_with_auto_populated_field(): client.get_source(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.GetSourceRequest( + request_msg = securitycenter_service.GetSourceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_source_use_cached_wrapped_rpc(): @@ -3974,10 +4000,14 @@ async def test_get_source_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_source_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.GetSourceRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.GetSourceRequest(), + {}, + ], +) +async def test_get_source_async(request_type, transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3985,7 +4015,7 @@ async def test_get_source_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_source), "__call__") as call: @@ -4014,11 +4044,6 @@ async def test_get_source_async( assert response.canonical_name == "canonical_name_value" -@pytest.mark.asyncio -async def test_get_source_async_from_dict(): - await test_get_source_async(request_type=dict) - - def test_get_source_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4161,8 +4186,8 @@ async def test_get_source_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.GroupAssetsRequest, - dict, + securitycenter_service.GroupAssetsRequest(), + {}, ], ) def test_group_assets(request_type, transport: str = "grpc"): @@ -4173,7 +4198,7 @@ def test_group_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(type(client.transport.group_assets), "__call__") as call: @@ -4222,12 +4247,13 @@ def test_group_assets_non_empty_request_with_auto_populated_field(): client.group_assets(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.GroupAssetsRequest( + request_msg = securitycenter_service.GroupAssetsRequest( parent="parent_value", filter="filter_value", group_by="group_by_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_group_assets_use_cached_wrapped_rpc(): @@ -4308,10 +4334,14 @@ async def test_group_assets_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_group_assets_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.GroupAssetsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.GroupAssetsRequest(), + {}, + ], +) +async def test_group_assets_async(request_type, transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4319,7 +4349,7 @@ async def test_group_assets_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.group_assets), "__call__") as call: @@ -4344,11 +4374,6 @@ async def test_group_assets_async( assert response.total_size == 1086 -@pytest.mark.asyncio -async def test_group_assets_async_from_dict(): - await test_group_assets_async(request_type=dict) - - def test_group_assets_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4603,8 +4628,8 @@ async def test_group_assets_async_pages(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.GroupFindingsRequest, - dict, + securitycenter_service.GroupFindingsRequest(), + {}, ], ) def test_group_findings(request_type, transport: str = "grpc"): @@ -4615,7 +4640,7 @@ def test_group_findings(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.group_findings), "__call__") as call: @@ -4664,12 +4689,13 @@ def test_group_findings_non_empty_request_with_auto_populated_field(): client.group_findings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.GroupFindingsRequest( + request_msg = securitycenter_service.GroupFindingsRequest( parent="parent_value", filter="filter_value", group_by="group_by_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_group_findings_use_cached_wrapped_rpc(): @@ -4750,10 +4776,14 @@ async def test_group_findings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_group_findings_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.GroupFindingsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.GroupFindingsRequest(), + {}, + ], +) +async def test_group_findings_async(request_type, transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4761,7 +4791,7 @@ async def test_group_findings_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.group_findings), "__call__") as call: @@ -4786,11 +4816,6 @@ async def test_group_findings_async( assert response.total_size == 1086 -@pytest.mark.asyncio -async def test_group_findings_async_from_dict(): - await test_group_findings_async(request_type=dict) - - def test_group_findings_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5137,8 +5162,8 @@ async def test_group_findings_async_pages(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.ListAssetsRequest, - dict, + securitycenter_service.ListAssetsRequest(), + {}, ], ) def test_list_assets(request_type, transport: str = "grpc"): @@ -5149,7 +5174,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(type(client.transport.list_assets), "__call__") as call: @@ -5198,12 +5223,13 @@ 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] == securitycenter_service.ListAssetsRequest( + request_msg = securitycenter_service.ListAssetsRequest( parent="parent_value", filter="filter_value", order_by="order_by_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_assets_use_cached_wrapped_rpc(): @@ -5284,10 +5310,14 @@ async def test_list_assets_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_assets_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.ListAssetsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.ListAssetsRequest(), + {}, + ], +) +async def test_list_assets_async(request_type, transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5295,7 +5325,7 @@ async def test_list_assets_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_assets), "__call__") as call: @@ -5320,11 +5350,6 @@ async def test_list_assets_async( assert response.total_size == 1086 -@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 = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5667,8 +5692,8 @@ async def test_list_assets_async_pages(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.ListFindingsRequest, - dict, + securitycenter_service.ListFindingsRequest(), + {}, ], ) def test_list_findings(request_type, transport: str = "grpc"): @@ -5679,7 +5704,7 @@ def test_list_findings(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_findings), "__call__") as call: @@ -5728,12 +5753,13 @@ def test_list_findings_non_empty_request_with_auto_populated_field(): client.list_findings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.ListFindingsRequest( + request_msg = securitycenter_service.ListFindingsRequest( parent="parent_value", filter="filter_value", order_by="order_by_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_findings_use_cached_wrapped_rpc(): @@ -5814,10 +5840,14 @@ async def test_list_findings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_findings_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.ListFindingsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.ListFindingsRequest(), + {}, + ], +) +async def test_list_findings_async(request_type, transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5825,7 +5855,7 @@ async def test_list_findings_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_findings), "__call__") as call: @@ -5850,11 +5880,6 @@ async def test_list_findings_async( assert response.total_size == 1086 -@pytest.mark.asyncio -async def test_list_findings_async_from_dict(): - await test_list_findings_async(request_type=dict) - - def test_list_findings_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6201,8 +6226,8 @@ async def test_list_findings_async_pages(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.ListNotificationConfigsRequest, - dict, + securitycenter_service.ListNotificationConfigsRequest(), + {}, ], ) def test_list_notification_configs(request_type, transport: str = "grpc"): @@ -6213,7 +6238,7 @@ def test_list_notification_configs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6262,10 +6287,11 @@ def test_list_notification_configs_non_empty_request_with_auto_populated_field() client.list_notification_configs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.ListNotificationConfigsRequest( + request_msg = securitycenter_service.ListNotificationConfigsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_notification_configs_use_cached_wrapped_rpc(): @@ -6351,9 +6377,15 @@ async def test_list_notification_configs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.ListNotificationConfigsRequest(), + {}, + ], +) async def test_list_notification_configs_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.ListNotificationConfigsRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -6362,7 +6394,7 @@ async def test_list_notification_configs_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( @@ -6387,11 +6419,6 @@ async def test_list_notification_configs_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_notification_configs_async_from_dict(): - await test_list_notification_configs_async(request_type=dict) - - def test_list_notification_configs_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6750,8 +6777,8 @@ async def test_list_notification_configs_async_pages(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.ListSourcesRequest, - dict, + securitycenter_service.ListSourcesRequest(), + {}, ], ) def test_list_sources(request_type, transport: str = "grpc"): @@ -6762,7 +6789,7 @@ def test_list_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(type(client.transport.list_sources), "__call__") as call: @@ -6807,10 +6834,11 @@ def test_list_sources_non_empty_request_with_auto_populated_field(): client.list_sources(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.ListSourcesRequest( + request_msg = securitycenter_service.ListSourcesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_sources_use_cached_wrapped_rpc(): @@ -6891,10 +6919,14 @@ async def test_list_sources_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_sources_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.ListSourcesRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.ListSourcesRequest(), + {}, + ], +) +async def test_list_sources_async(request_type, transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6902,7 +6934,7 @@ async def test_list_sources_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_sources), "__call__") as call: @@ -6925,11 +6957,6 @@ async def test_list_sources_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_sources_async_from_dict(): - await test_list_sources_async(request_type=dict) - - def test_list_sources_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7266,8 +7293,8 @@ async def test_list_sources_async_pages(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.RunAssetDiscoveryRequest, - dict, + securitycenter_service.RunAssetDiscoveryRequest(), + {}, ], ) def test_run_asset_discovery(request_type, transport: str = "grpc"): @@ -7278,7 +7305,7 @@ def test_run_asset_discovery(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7323,9 +7350,10 @@ def test_run_asset_discovery_non_empty_request_with_auto_populated_field(): client.run_asset_discovery(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.RunAssetDiscoveryRequest( + request_msg = securitycenter_service.RunAssetDiscoveryRequest( parent="parent_value", ) + assert args[0] == request_msg def test_run_asset_discovery_use_cached_wrapped_rpc(): @@ -7420,10 +7448,14 @@ async def test_run_asset_discovery_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_run_asset_discovery_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.RunAssetDiscoveryRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.RunAssetDiscoveryRequest(), + {}, + ], +) +async def test_run_asset_discovery_async(request_type, transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7431,7 +7463,7 @@ async def test_run_asset_discovery_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( @@ -7453,11 +7485,6 @@ async def test_run_asset_discovery_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_run_asset_discovery_async_from_dict(): - await test_run_asset_discovery_async(request_type=dict) - - def test_run_asset_discovery_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7612,8 +7639,8 @@ async def test_run_asset_discovery_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.SetFindingStateRequest, - dict, + securitycenter_service.SetFindingStateRequest(), + {}, ], ) def test_set_finding_state(request_type, transport: str = "grpc"): @@ -7624,7 +7651,7 @@ def test_set_finding_state(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7686,9 +7713,10 @@ def test_set_finding_state_non_empty_request_with_auto_populated_field(): client.set_finding_state(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.SetFindingStateRequest( + request_msg = securitycenter_service.SetFindingStateRequest( name="name_value", ) + assert args[0] == request_msg def test_set_finding_state_use_cached_wrapped_rpc(): @@ -7771,10 +7799,14 @@ async def test_set_finding_state_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_finding_state_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.SetFindingStateRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.SetFindingStateRequest(), + {}, + ], +) +async def test_set_finding_state_async(request_type, transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7782,7 +7814,7 @@ async def test_set_finding_state_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( @@ -7821,11 +7853,6 @@ async def test_set_finding_state_async( assert response.canonical_name == "canonical_name_value" -@pytest.mark.asyncio -async def test_set_finding_state_async_from_dict(): - await test_set_finding_state_async(request_type=dict) - - def test_set_finding_state_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7996,8 +8023,8 @@ async def test_set_finding_state_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.SetIamPolicyRequest, - dict, + iam_policy_pb2.SetIamPolicyRequest(), + {}, ], ) def test_set_iam_policy(request_type, transport: str = "grpc"): @@ -8008,7 +8035,7 @@ def test_set_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(type(client.transport.set_iam_policy), "__call__") as call: @@ -8054,9 +8081,10 @@ def test_set_iam_policy_non_empty_request_with_auto_populated_field(): client.set_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.SetIamPolicyRequest( + request_msg = iam_policy_pb2.SetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_set_iam_policy_use_cached_wrapped_rpc(): @@ -8137,9 +8165,14 @@ async def test_set_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.SetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.SetIamPolicyRequest(), + {}, + ], +) +async def test_set_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8147,7 +8180,7 @@ async def test_set_iam_policy_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.set_iam_policy), "__call__") as call: @@ -8172,11 +8205,6 @@ async def test_set_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_set_iam_policy_async_from_dict(): - await test_set_iam_policy_async(request_type=dict) - - def test_set_iam_policy_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8337,8 +8365,8 @@ async def test_set_iam_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.TestIamPermissionsRequest, - dict, + iam_policy_pb2.TestIamPermissionsRequest(), + {}, ], ) def test_test_iam_permissions(request_type, transport: str = "grpc"): @@ -8349,7 +8377,7 @@ def test_test_iam_permissions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8397,9 +8425,10 @@ def test_test_iam_permissions_non_empty_request_with_auto_populated_field(): client.test_iam_permissions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.TestIamPermissionsRequest( + request_msg = iam_policy_pb2.TestIamPermissionsRequest( resource="resource_value", ) + assert args[0] == request_msg def test_test_iam_permissions_use_cached_wrapped_rpc(): @@ -8484,9 +8513,15 @@ async def test_test_iam_permissions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.TestIamPermissionsRequest(), + {}, + ], +) async def test_test_iam_permissions_async( - transport: str = "grpc_asyncio", - request_type=iam_policy_pb2.TestIamPermissionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -8495,7 +8530,7 @@ async def test_test_iam_permissions_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( @@ -8520,11 +8555,6 @@ async def test_test_iam_permissions_async( assert response.permissions == ["permissions_value"] -@pytest.mark.asyncio -async def test_test_iam_permissions_async_from_dict(): - await test_test_iam_permissions_async(request_type=dict) - - def test_test_iam_permissions_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8708,8 +8738,8 @@ async def test_test_iam_permissions_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.UpdateFindingRequest, - dict, + securitycenter_service.UpdateFindingRequest(), + {}, ], ) def test_update_finding(request_type, transport: str = "grpc"): @@ -8720,7 +8750,7 @@ def test_update_finding(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_finding), "__call__") as call: @@ -8776,7 +8806,8 @@ def test_update_finding_non_empty_request_with_auto_populated_field(): client.update_finding(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.UpdateFindingRequest() + request_msg = securitycenter_service.UpdateFindingRequest() + assert args[0] == request_msg def test_update_finding_use_cached_wrapped_rpc(): @@ -8857,10 +8888,14 @@ async def test_update_finding_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_finding_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.UpdateFindingRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.UpdateFindingRequest(), + {}, + ], +) +async def test_update_finding_async(request_type, transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8868,7 +8903,7 @@ async def test_update_finding_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_finding), "__call__") as call: @@ -8905,11 +8940,6 @@ async def test_update_finding_async( assert response.canonical_name == "canonical_name_value" -@pytest.mark.asyncio -async def test_update_finding_async_from_dict(): - await test_update_finding_async(request_type=dict) - - def test_update_finding_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9062,8 +9092,8 @@ async def test_update_finding_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.UpdateNotificationConfigRequest, - dict, + securitycenter_service.UpdateNotificationConfigRequest(), + {}, ], ) def test_update_notification_config(request_type, transport: str = "grpc"): @@ -9074,7 +9104,7 @@ def test_update_notification_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( @@ -9131,7 +9161,8 @@ def test_update_notification_config_non_empty_request_with_auto_populated_field( client.update_notification_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.UpdateNotificationConfigRequest() + request_msg = securitycenter_service.UpdateNotificationConfigRequest() + assert args[0] == request_msg def test_update_notification_config_use_cached_wrapped_rpc(): @@ -9217,9 +9248,15 @@ async def test_update_notification_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.UpdateNotificationConfigRequest(), + {}, + ], +) async def test_update_notification_config_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.UpdateNotificationConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -9228,7 +9265,7 @@ async def test_update_notification_config_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( @@ -9264,11 +9301,6 @@ async def test_update_notification_config_async( assert response.service_account == "service_account_value" -@pytest.mark.asyncio -async def test_update_notification_config_async_from_dict(): - await test_update_notification_config_async(request_type=dict) - - def test_update_notification_config_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9441,8 +9473,8 @@ async def test_update_notification_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.UpdateOrganizationSettingsRequest, - dict, + securitycenter_service.UpdateOrganizationSettingsRequest(), + {}, ], ) def test_update_organization_settings(request_type, transport: str = "grpc"): @@ -9453,7 +9485,7 @@ def test_update_organization_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( @@ -9501,7 +9533,8 @@ def test_update_organization_settings_non_empty_request_with_auto_populated_fiel client.update_organization_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.UpdateOrganizationSettingsRequest() + request_msg = securitycenter_service.UpdateOrganizationSettingsRequest() + assert args[0] == request_msg def test_update_organization_settings_use_cached_wrapped_rpc(): @@ -9587,9 +9620,15 @@ async def test_update_organization_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.UpdateOrganizationSettingsRequest(), + {}, + ], +) async def test_update_organization_settings_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.UpdateOrganizationSettingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -9598,7 +9637,7 @@ async def test_update_organization_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( @@ -9625,11 +9664,6 @@ async def test_update_organization_settings_async( assert response.enable_asset_discovery is True -@pytest.mark.asyncio -async def test_update_organization_settings_async_from_dict(): - await test_update_organization_settings_async(request_type=dict) - - def test_update_organization_settings_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9792,8 +9826,8 @@ async def test_update_organization_settings_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.UpdateSourceRequest, - dict, + securitycenter_service.UpdateSourceRequest(), + {}, ], ) def test_update_source(request_type, transport: str = "grpc"): @@ -9804,7 +9838,7 @@ def test_update_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(type(client.transport.update_source), "__call__") as call: @@ -9852,7 +9886,8 @@ def test_update_source_non_empty_request_with_auto_populated_field(): client.update_source(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.UpdateSourceRequest() + request_msg = securitycenter_service.UpdateSourceRequest() + assert args[0] == request_msg def test_update_source_use_cached_wrapped_rpc(): @@ -9933,10 +9968,14 @@ async def test_update_source_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_source_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.UpdateSourceRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.UpdateSourceRequest(), + {}, + ], +) +async def test_update_source_async(request_type, transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9944,7 +9983,7 @@ async def test_update_source_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_source), "__call__") as call: @@ -9973,11 +10012,6 @@ async def test_update_source_async( assert response.canonical_name == "canonical_name_value" -@pytest.mark.asyncio -async def test_update_source_async_from_dict(): - await test_update_source_async(request_type=dict) - - def test_update_source_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10130,8 +10164,8 @@ async def test_update_source_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.UpdateSecurityMarksRequest, - dict, + securitycenter_service.UpdateSecurityMarksRequest(), + {}, ], ) def test_update_security_marks(request_type, transport: str = "grpc"): @@ -10142,7 +10176,7 @@ def test_update_security_marks(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10190,7 +10224,8 @@ def test_update_security_marks_non_empty_request_with_auto_populated_field(): client.update_security_marks(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.UpdateSecurityMarksRequest() + request_msg = securitycenter_service.UpdateSecurityMarksRequest() + assert args[0] == request_msg def test_update_security_marks_use_cached_wrapped_rpc(): @@ -10276,9 +10311,15 @@ async def test_update_security_marks_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.UpdateSecurityMarksRequest(), + {}, + ], +) async def test_update_security_marks_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.UpdateSecurityMarksRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -10287,7 +10328,7 @@ async def test_update_security_marks_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( @@ -10314,11 +10355,6 @@ async def test_update_security_marks_async( assert response.canonical_name == "canonical_name_value" -@pytest.mark.asyncio -async def test_update_security_marks_async_from_dict(): - await test_update_security_marks_async(request_type=dict) - - def test_update_security_marks_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15320,7 +15356,6 @@ def test_create_source_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.CreateSourceRequest() - assert args[0] == request_msg @@ -15341,7 +15376,6 @@ def test_create_finding_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.CreateFindingRequest() - assert args[0] == request_msg @@ -15364,7 +15398,6 @@ def test_create_notification_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.CreateNotificationConfigRequest() - assert args[0] == request_msg @@ -15387,7 +15420,6 @@ def test_delete_notification_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.DeleteNotificationConfigRequest() - assert args[0] == request_msg @@ -15408,7 +15440,6 @@ def test_get_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -15431,7 +15462,6 @@ def test_get_notification_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GetNotificationConfigRequest() - assert args[0] == request_msg @@ -15454,7 +15484,6 @@ def test_get_organization_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GetOrganizationSettingsRequest() - assert args[0] == request_msg @@ -15475,7 +15504,6 @@ def test_get_source_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GetSourceRequest() - assert args[0] == request_msg @@ -15496,7 +15524,6 @@ def test_group_assets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GroupAssetsRequest() - assert args[0] == request_msg @@ -15517,7 +15544,6 @@ def test_group_findings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GroupFindingsRequest() - assert args[0] == request_msg @@ -15538,7 +15564,6 @@ def test_list_assets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListAssetsRequest() - assert args[0] == request_msg @@ -15559,7 +15584,6 @@ def test_list_findings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListFindingsRequest() - assert args[0] == request_msg @@ -15582,7 +15606,6 @@ def test_list_notification_configs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListNotificationConfigsRequest() - assert args[0] == request_msg @@ -15603,7 +15626,6 @@ def test_list_sources_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListSourcesRequest() - assert args[0] == request_msg @@ -15626,7 +15648,6 @@ def test_run_asset_discovery_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.RunAssetDiscoveryRequest() - assert args[0] == request_msg @@ -15649,7 +15670,6 @@ def test_set_finding_state_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.SetFindingStateRequest() - assert args[0] == request_msg @@ -15670,7 +15690,6 @@ def test_set_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -15693,7 +15712,6 @@ def test_test_iam_permissions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -15714,7 +15732,6 @@ def test_update_finding_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateFindingRequest() - assert args[0] == request_msg @@ -15737,7 +15754,6 @@ def test_update_notification_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateNotificationConfigRequest() - assert args[0] == request_msg @@ -15760,7 +15776,6 @@ def test_update_organization_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateOrganizationSettingsRequest() - assert args[0] == request_msg @@ -15781,7 +15796,6 @@ def test_update_source_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateSourceRequest() - assert args[0] == request_msg @@ -15804,7 +15818,6 @@ def test_update_security_marks_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateSecurityMarksRequest() - assert args[0] == request_msg @@ -15848,7 +15861,6 @@ async def test_create_source_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.CreateSourceRequest() - assert args[0] == request_msg @@ -15882,7 +15894,6 @@ async def test_create_finding_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.CreateFindingRequest() - assert args[0] == request_msg @@ -15915,7 +15926,6 @@ async def test_create_notification_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.CreateNotificationConfigRequest() - assert args[0] == request_msg @@ -15940,7 +15950,6 @@ async def test_delete_notification_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.DeleteNotificationConfigRequest() - assert args[0] == request_msg @@ -15968,7 +15977,6 @@ async def test_get_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -16001,7 +16009,6 @@ async def test_get_notification_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GetNotificationConfigRequest() - assert args[0] == request_msg @@ -16031,7 +16038,6 @@ async def test_get_organization_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GetOrganizationSettingsRequest() - assert args[0] == request_msg @@ -16061,7 +16067,6 @@ async def test_get_source_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GetSourceRequest() - assert args[0] == request_msg @@ -16089,7 +16094,6 @@ async def test_group_assets_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GroupAssetsRequest() - assert args[0] == request_msg @@ -16117,7 +16121,6 @@ async def test_group_findings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GroupFindingsRequest() - assert args[0] == request_msg @@ -16145,7 +16148,6 @@ async def test_list_assets_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListAssetsRequest() - assert args[0] == request_msg @@ -16173,7 +16175,6 @@ async def test_list_findings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListFindingsRequest() - assert args[0] == request_msg @@ -16202,7 +16203,6 @@ async def test_list_notification_configs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListNotificationConfigsRequest() - assert args[0] == request_msg @@ -16229,7 +16229,6 @@ async def test_list_sources_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListSourcesRequest() - assert args[0] == request_msg @@ -16256,7 +16255,6 @@ async def test_run_asset_discovery_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.RunAssetDiscoveryRequest() - assert args[0] == request_msg @@ -16292,7 +16290,6 @@ async def test_set_finding_state_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.SetFindingStateRequest() - assert args[0] == request_msg @@ -16320,7 +16317,6 @@ async def test_set_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -16349,7 +16345,6 @@ async def test_test_iam_permissions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -16383,7 +16378,6 @@ async def test_update_finding_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateFindingRequest() - assert args[0] == request_msg @@ -16416,7 +16410,6 @@ async def test_update_notification_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateNotificationConfigRequest() - assert args[0] == request_msg @@ -16446,7 +16439,6 @@ async def test_update_organization_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateOrganizationSettingsRequest() - assert args[0] == request_msg @@ -16476,7 +16468,6 @@ async def test_update_source_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateSourceRequest() - assert args[0] == request_msg @@ -16506,7 +16497,6 @@ async def test_update_security_marks_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateSecurityMarksRequest() - assert args[0] == request_msg @@ -20324,7 +20314,6 @@ def test_create_source_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.CreateSourceRequest() - assert args[0] == request_msg @@ -20344,7 +20333,6 @@ def test_create_finding_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.CreateFindingRequest() - assert args[0] == request_msg @@ -20366,7 +20354,6 @@ def test_create_notification_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.CreateNotificationConfigRequest() - assert args[0] == request_msg @@ -20388,7 +20375,6 @@ def test_delete_notification_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.DeleteNotificationConfigRequest() - assert args[0] == request_msg @@ -20408,7 +20394,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -20430,7 +20415,6 @@ def test_get_notification_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GetNotificationConfigRequest() - assert args[0] == request_msg @@ -20452,7 +20436,6 @@ def test_get_organization_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GetOrganizationSettingsRequest() - assert args[0] == request_msg @@ -20472,7 +20455,6 @@ def test_get_source_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GetSourceRequest() - assert args[0] == request_msg @@ -20492,7 +20474,6 @@ def test_group_assets_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GroupAssetsRequest() - assert args[0] == request_msg @@ -20512,7 +20493,6 @@ def test_group_findings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GroupFindingsRequest() - assert args[0] == request_msg @@ -20532,7 +20512,6 @@ def test_list_assets_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListAssetsRequest() - assert args[0] == request_msg @@ -20552,7 +20531,6 @@ def test_list_findings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListFindingsRequest() - assert args[0] == request_msg @@ -20574,7 +20552,6 @@ def test_list_notification_configs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListNotificationConfigsRequest() - assert args[0] == request_msg @@ -20594,7 +20571,6 @@ def test_list_sources_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListSourcesRequest() - assert args[0] == request_msg @@ -20616,7 +20592,6 @@ def test_run_asset_discovery_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.RunAssetDiscoveryRequest() - assert args[0] == request_msg @@ -20638,7 +20613,6 @@ def test_set_finding_state_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.SetFindingStateRequest() - assert args[0] == request_msg @@ -20658,7 +20632,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -20680,7 +20653,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -20700,7 +20672,6 @@ def test_update_finding_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateFindingRequest() - assert args[0] == request_msg @@ -20722,7 +20693,6 @@ def test_update_notification_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateNotificationConfigRequest() - assert args[0] == request_msg @@ -20744,7 +20714,6 @@ def test_update_organization_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateOrganizationSettingsRequest() - assert args[0] == request_msg @@ -20764,7 +20733,6 @@ def test_update_source_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateSourceRequest() - assert args[0] == request_msg @@ -20786,7 +20754,6 @@ def test_update_security_marks_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateSecurityMarksRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-securitycenter/tests/unit/gapic/securitycenter_v2/test_security_center.py b/packages/google-cloud-securitycenter/tests/unit/gapic/securitycenter_v2/test_security_center.py index 30f7433a9657..b6bba020e3f1 100644 --- a/packages/google-cloud-securitycenter/tests/unit/gapic/securitycenter_v2/test_security_center.py +++ b/packages/google-cloud-securitycenter/tests/unit/gapic/securitycenter_v2/test_security_center.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 @@ -186,6 +187,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" @@ -1389,8 +1405,8 @@ def test_security_center_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - securitycenter_service.BatchCreateResourceValueConfigsRequest, - dict, + securitycenter_service.BatchCreateResourceValueConfigsRequest(), + {}, ], ) def test_batch_create_resource_value_configs(request_type, transport: str = "grpc"): @@ -1401,7 +1417,7 @@ def test_batch_create_resource_value_configs(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( @@ -1450,9 +1466,10 @@ def test_batch_create_resource_value_configs_non_empty_request_with_auto_populat client.batch_create_resource_value_configs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.BatchCreateResourceValueConfigsRequest( + request_msg = securitycenter_service.BatchCreateResourceValueConfigsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_batch_create_resource_value_configs_use_cached_wrapped_rpc(): @@ -1538,9 +1555,15 @@ async def test_batch_create_resource_value_configs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.BatchCreateResourceValueConfigsRequest(), + {}, + ], +) async def test_batch_create_resource_value_configs_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.BatchCreateResourceValueConfigsRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -1549,7 +1572,7 @@ async def test_batch_create_resource_value_configs_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( @@ -1573,11 +1596,6 @@ async def test_batch_create_resource_value_configs_async( ) -@pytest.mark.asyncio -async def test_batch_create_resource_value_configs_async_from_dict(): - await test_batch_create_resource_value_configs_async(request_type=dict) - - def test_batch_create_resource_value_configs_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1772,8 +1790,8 @@ async def test_batch_create_resource_value_configs_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.BulkMuteFindingsRequest, - dict, + securitycenter_service.BulkMuteFindingsRequest(), + {}, ], ) def test_bulk_mute_findings(request_type, transport: str = "grpc"): @@ -1784,7 +1802,7 @@ def test_bulk_mute_findings(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1830,10 +1848,11 @@ def test_bulk_mute_findings_non_empty_request_with_auto_populated_field(): client.bulk_mute_findings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.BulkMuteFindingsRequest( + request_msg = securitycenter_service.BulkMuteFindingsRequest( parent="parent_value", filter="filter_value", ) + assert args[0] == request_msg def test_bulk_mute_findings_use_cached_wrapped_rpc(): @@ -1928,10 +1947,14 @@ async def test_bulk_mute_findings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_bulk_mute_findings_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.BulkMuteFindingsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.BulkMuteFindingsRequest(), + {}, + ], +) +async def test_bulk_mute_findings_async(request_type, transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1939,7 +1962,7 @@ async def test_bulk_mute_findings_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( @@ -1961,11 +1984,6 @@ async def test_bulk_mute_findings_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_bulk_mute_findings_async_from_dict(): - await test_bulk_mute_findings_async(request_type=dict) - - def test_bulk_mute_findings_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2120,8 +2138,8 @@ async def test_bulk_mute_findings_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.CreateBigQueryExportRequest, - dict, + securitycenter_service.CreateBigQueryExportRequest(), + {}, ], ) def test_create_big_query_export(request_type, transport: str = "grpc"): @@ -2132,7 +2150,7 @@ def test_create_big_query_export(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2191,10 +2209,11 @@ def test_create_big_query_export_non_empty_request_with_auto_populated_field(): client.create_big_query_export(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.CreateBigQueryExportRequest( + request_msg = securitycenter_service.CreateBigQueryExportRequest( parent="parent_value", big_query_export_id="big_query_export_id_value", ) + assert args[0] == request_msg def test_create_big_query_export_use_cached_wrapped_rpc(): @@ -2280,9 +2299,15 @@ async def test_create_big_query_export_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.CreateBigQueryExportRequest(), + {}, + ], +) async def test_create_big_query_export_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.CreateBigQueryExportRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -2291,7 +2316,7 @@ async def test_create_big_query_export_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( @@ -2326,11 +2351,6 @@ async def test_create_big_query_export_async( assert response.principal == "principal_value" -@pytest.mark.asyncio -async def test_create_big_query_export_async_from_dict(): - await test_create_big_query_export_async(request_type=dict) - - def test_create_big_query_export_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2505,8 +2525,8 @@ async def test_create_big_query_export_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.CreateFindingRequest, - dict, + securitycenter_service.CreateFindingRequest(), + {}, ], ) def test_create_finding(request_type, transport: str = "grpc"): @@ -2517,7 +2537,7 @@ def test_create_finding(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_finding), "__call__") as call: @@ -2590,10 +2610,11 @@ def test_create_finding_non_empty_request_with_auto_populated_field(): client.create_finding(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.CreateFindingRequest( + request_msg = securitycenter_service.CreateFindingRequest( parent="parent_value", finding_id="finding_id_value", ) + assert args[0] == request_msg def test_create_finding_use_cached_wrapped_rpc(): @@ -2674,10 +2695,14 @@ async def test_create_finding_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_finding_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.CreateFindingRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.CreateFindingRequest(), + {}, + ], +) +async def test_create_finding_async(request_type, transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2685,7 +2710,7 @@ async def test_create_finding_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_finding), "__call__") as call: @@ -2736,11 +2761,6 @@ async def test_create_finding_async( assert response.module_name == "module_name_value" -@pytest.mark.asyncio -async def test_create_finding_async_from_dict(): - await test_create_finding_async(request_type=dict) - - def test_create_finding_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2903,8 +2923,8 @@ async def test_create_finding_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.CreateMuteConfigRequest, - dict, + securitycenter_service.CreateMuteConfigRequest(), + {}, ], ) def test_create_mute_config(request_type, transport: str = "grpc"): @@ -2915,7 +2935,7 @@ def test_create_mute_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( @@ -2972,10 +2992,11 @@ def test_create_mute_config_non_empty_request_with_auto_populated_field(): client.create_mute_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.CreateMuteConfigRequest( + request_msg = securitycenter_service.CreateMuteConfigRequest( parent="parent_value", mute_config_id="mute_config_id_value", ) + assert args[0] == request_msg def test_create_mute_config_use_cached_wrapped_rpc(): @@ -3060,10 +3081,14 @@ async def test_create_mute_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_mute_config_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.CreateMuteConfigRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.CreateMuteConfigRequest(), + {}, + ], +) +async def test_create_mute_config_async(request_type, transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3071,7 +3096,7 @@ async def test_create_mute_config_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( @@ -3104,11 +3129,6 @@ async def test_create_mute_config_async( assert response.type_ == gcs_mute_config.MuteConfig.MuteConfigType.STATIC -@pytest.mark.asyncio -async def test_create_mute_config_async_from_dict(): - await test_create_mute_config_async(request_type=dict) - - def test_create_mute_config_flattened(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3218,8 +3238,8 @@ async def test_create_mute_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.CreateNotificationConfigRequest, - dict, + securitycenter_service.CreateNotificationConfigRequest(), + {}, ], ) def test_create_notification_config(request_type, transport: str = "grpc"): @@ -3230,7 +3250,7 @@ def test_create_notification_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( @@ -3285,10 +3305,11 @@ def test_create_notification_config_non_empty_request_with_auto_populated_field( client.create_notification_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.CreateNotificationConfigRequest( + request_msg = securitycenter_service.CreateNotificationConfigRequest( parent="parent_value", config_id="config_id_value", ) + assert args[0] == request_msg def test_create_notification_config_use_cached_wrapped_rpc(): @@ -3374,9 +3395,15 @@ async def test_create_notification_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.CreateNotificationConfigRequest(), + {}, + ], +) async def test_create_notification_config_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.CreateNotificationConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -3385,7 +3412,7 @@ async def test_create_notification_config_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( @@ -3416,11 +3443,6 @@ async def test_create_notification_config_async( assert response.service_account == "service_account_value" -@pytest.mark.asyncio -async def test_create_notification_config_async_from_dict(): - await test_create_notification_config_async(request_type=dict) - - def test_create_notification_config_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3603,8 +3625,8 @@ async def test_create_notification_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.CreateSourceRequest, - dict, + securitycenter_service.CreateSourceRequest(), + {}, ], ) def test_create_source(request_type, transport: str = "grpc"): @@ -3615,7 +3637,7 @@ def test_create_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(type(client.transport.create_source), "__call__") as call: @@ -3665,9 +3687,10 @@ def test_create_source_non_empty_request_with_auto_populated_field(): client.create_source(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.CreateSourceRequest( + request_msg = securitycenter_service.CreateSourceRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_source_use_cached_wrapped_rpc(): @@ -3748,10 +3771,14 @@ async def test_create_source_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_source_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.CreateSourceRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.CreateSourceRequest(), + {}, + ], +) +async def test_create_source_async(request_type, transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3759,7 +3786,7 @@ async def test_create_source_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_source), "__call__") as call: @@ -3788,11 +3815,6 @@ async def test_create_source_async( assert response.canonical_name == "canonical_name_value" -@pytest.mark.asyncio -async def test_create_source_async_from_dict(): - await test_create_source_async(request_type=dict) - - def test_create_source_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3945,8 +3967,8 @@ async def test_create_source_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.DeleteBigQueryExportRequest, - dict, + securitycenter_service.DeleteBigQueryExportRequest(), + {}, ], ) def test_delete_big_query_export(request_type, transport: str = "grpc"): @@ -3957,7 +3979,7 @@ def test_delete_big_query_export(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4002,9 +4024,10 @@ def test_delete_big_query_export_non_empty_request_with_auto_populated_field(): client.delete_big_query_export(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.DeleteBigQueryExportRequest( + request_msg = securitycenter_service.DeleteBigQueryExportRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_big_query_export_use_cached_wrapped_rpc(): @@ -4090,9 +4113,15 @@ async def test_delete_big_query_export_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.DeleteBigQueryExportRequest(), + {}, + ], +) async def test_delete_big_query_export_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.DeleteBigQueryExportRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -4101,7 +4130,7 @@ async def test_delete_big_query_export_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( @@ -4121,11 +4150,6 @@ async def test_delete_big_query_export_async( assert response is None -@pytest.mark.asyncio -async def test_delete_big_query_export_async_from_dict(): - await test_delete_big_query_export_async(request_type=dict) - - def test_delete_big_query_export_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4276,8 +4300,8 @@ async def test_delete_big_query_export_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.DeleteMuteConfigRequest, - dict, + securitycenter_service.DeleteMuteConfigRequest(), + {}, ], ) def test_delete_mute_config(request_type, transport: str = "grpc"): @@ -4288,7 +4312,7 @@ def test_delete_mute_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( @@ -4333,9 +4357,10 @@ def test_delete_mute_config_non_empty_request_with_auto_populated_field(): client.delete_mute_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.DeleteMuteConfigRequest( + request_msg = securitycenter_service.DeleteMuteConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_mute_config_use_cached_wrapped_rpc(): @@ -4420,10 +4445,14 @@ async def test_delete_mute_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_mute_config_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.DeleteMuteConfigRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.DeleteMuteConfigRequest(), + {}, + ], +) +async def test_delete_mute_config_async(request_type, transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4431,7 +4460,7 @@ async def test_delete_mute_config_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( @@ -4451,11 +4480,6 @@ async def test_delete_mute_config_async( assert response is None -@pytest.mark.asyncio -async def test_delete_mute_config_async_from_dict(): - await test_delete_mute_config_async(request_type=dict) - - def test_delete_mute_config_flattened(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4543,8 +4567,8 @@ async def test_delete_mute_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.DeleteNotificationConfigRequest, - dict, + securitycenter_service.DeleteNotificationConfigRequest(), + {}, ], ) def test_delete_notification_config(request_type, transport: str = "grpc"): @@ -4555,7 +4579,7 @@ def test_delete_notification_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( @@ -4600,9 +4624,10 @@ def test_delete_notification_config_non_empty_request_with_auto_populated_field( client.delete_notification_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.DeleteNotificationConfigRequest( + request_msg = securitycenter_service.DeleteNotificationConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_notification_config_use_cached_wrapped_rpc(): @@ -4688,9 +4713,15 @@ async def test_delete_notification_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.DeleteNotificationConfigRequest(), + {}, + ], +) async def test_delete_notification_config_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.DeleteNotificationConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -4699,7 +4730,7 @@ async def test_delete_notification_config_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( @@ -4719,11 +4750,6 @@ async def test_delete_notification_config_async( assert response is None -@pytest.mark.asyncio -async def test_delete_notification_config_async_from_dict(): - await test_delete_notification_config_async(request_type=dict) - - def test_delete_notification_config_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4874,8 +4900,8 @@ async def test_delete_notification_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.DeleteResourceValueConfigRequest, - dict, + securitycenter_service.DeleteResourceValueConfigRequest(), + {}, ], ) def test_delete_resource_value_config(request_type, transport: str = "grpc"): @@ -4886,7 +4912,7 @@ def test_delete_resource_value_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( @@ -4931,9 +4957,10 @@ def test_delete_resource_value_config_non_empty_request_with_auto_populated_fiel client.delete_resource_value_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.DeleteResourceValueConfigRequest( + request_msg = securitycenter_service.DeleteResourceValueConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_resource_value_config_use_cached_wrapped_rpc(): @@ -5019,9 +5046,15 @@ async def test_delete_resource_value_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.DeleteResourceValueConfigRequest(), + {}, + ], +) async def test_delete_resource_value_config_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.DeleteResourceValueConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -5030,7 +5063,7 @@ async def test_delete_resource_value_config_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( @@ -5050,11 +5083,6 @@ async def test_delete_resource_value_config_async( assert response is None -@pytest.mark.asyncio -async def test_delete_resource_value_config_async_from_dict(): - await test_delete_resource_value_config_async(request_type=dict) - - def test_delete_resource_value_config_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5205,8 +5233,8 @@ async def test_delete_resource_value_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.GetBigQueryExportRequest, - dict, + securitycenter_service.GetBigQueryExportRequest(), + {}, ], ) def test_get_big_query_export(request_type, transport: str = "grpc"): @@ -5217,7 +5245,7 @@ def test_get_big_query_export(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5275,9 +5303,10 @@ def test_get_big_query_export_non_empty_request_with_auto_populated_field(): client.get_big_query_export(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.GetBigQueryExportRequest( + request_msg = securitycenter_service.GetBigQueryExportRequest( name="name_value", ) + assert args[0] == request_msg def test_get_big_query_export_use_cached_wrapped_rpc(): @@ -5362,9 +5391,15 @@ async def test_get_big_query_export_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.GetBigQueryExportRequest(), + {}, + ], +) async def test_get_big_query_export_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.GetBigQueryExportRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -5373,7 +5408,7 @@ async def test_get_big_query_export_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( @@ -5408,11 +5443,6 @@ async def test_get_big_query_export_async( assert response.principal == "principal_value" -@pytest.mark.asyncio -async def test_get_big_query_export_async_from_dict(): - await test_get_big_query_export_async(request_type=dict) - - def test_get_big_query_export_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5567,8 +5597,8 @@ async def test_get_big_query_export_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.GetSimulationRequest, - dict, + securitycenter_service.GetSimulationRequest(), + {}, ], ) def test_get_simulation(request_type, transport: str = "grpc"): @@ -5579,7 +5609,7 @@ def test_get_simulation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_simulation), "__call__") as call: @@ -5625,9 +5655,10 @@ def test_get_simulation_non_empty_request_with_auto_populated_field(): client.get_simulation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.GetSimulationRequest( + request_msg = securitycenter_service.GetSimulationRequest( name="name_value", ) + assert args[0] == request_msg def test_get_simulation_use_cached_wrapped_rpc(): @@ -5708,10 +5739,14 @@ async def test_get_simulation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_simulation_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.GetSimulationRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.GetSimulationRequest(), + {}, + ], +) +async def test_get_simulation_async(request_type, transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5719,7 +5754,7 @@ async def test_get_simulation_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_simulation), "__call__") as call: @@ -5744,11 +5779,6 @@ async def test_get_simulation_async( assert response.cloud_provider == resource.CloudProvider.GOOGLE_CLOUD_PLATFORM -@pytest.mark.asyncio -async def test_get_simulation_async_from_dict(): - await test_get_simulation_async(request_type=dict) - - def test_get_simulation_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5895,8 +5925,8 @@ async def test_get_simulation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.GetValuedResourceRequest, - dict, + securitycenter_service.GetValuedResourceRequest(), + {}, ], ) def test_get_valued_resource(request_type, transport: str = "grpc"): @@ -5907,7 +5937,7 @@ def test_get_valued_resource(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5968,9 +5998,10 @@ def test_get_valued_resource_non_empty_request_with_auto_populated_field(): client.get_valued_resource(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.GetValuedResourceRequest( + request_msg = securitycenter_service.GetValuedResourceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_valued_resource_use_cached_wrapped_rpc(): @@ -6055,10 +6086,14 @@ async def test_get_valued_resource_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_valued_resource_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.GetValuedResourceRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.GetValuedResourceRequest(), + {}, + ], +) +async def test_get_valued_resource_async(request_type, transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6066,7 +6101,7 @@ async def test_get_valued_resource_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( @@ -6104,11 +6139,6 @@ async def test_get_valued_resource_async( assert math.isclose(response.exposed_score, 0.1395, rel_tol=1e-6) -@pytest.mark.asyncio -async def test_get_valued_resource_async_from_dict(): - await test_get_valued_resource_async(request_type=dict) - - def test_get_valued_resource_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6263,8 +6293,8 @@ async def test_get_valued_resource_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.GetIamPolicyRequest, - dict, + iam_policy_pb2.GetIamPolicyRequest(), + {}, ], ) def test_get_iam_policy(request_type, transport: str = "grpc"): @@ -6275,7 +6305,7 @@ def test_get_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(type(client.transport.get_iam_policy), "__call__") as call: @@ -6321,9 +6351,10 @@ def test_get_iam_policy_non_empty_request_with_auto_populated_field(): client.get_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.GetIamPolicyRequest( + request_msg = iam_policy_pb2.GetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_get_iam_policy_use_cached_wrapped_rpc(): @@ -6404,9 +6435,14 @@ async def test_get_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.GetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.GetIamPolicyRequest(), + {}, + ], +) +async def test_get_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6414,7 +6450,7 @@ async def test_get_iam_policy_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_iam_policy), "__call__") as call: @@ -6439,11 +6475,6 @@ async def test_get_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_get_iam_policy_async_from_dict(): - await test_get_iam_policy_async(request_type=dict) - - def test_get_iam_policy_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6603,8 +6634,8 @@ async def test_get_iam_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.GetMuteConfigRequest, - dict, + securitycenter_service.GetMuteConfigRequest(), + {}, ], ) def test_get_mute_config(request_type, transport: str = "grpc"): @@ -6615,7 +6646,7 @@ def test_get_mute_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(type(client.transport.get_mute_config), "__call__") as call: @@ -6667,9 +6698,10 @@ def test_get_mute_config_non_empty_request_with_auto_populated_field(): client.get_mute_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.GetMuteConfigRequest( + request_msg = securitycenter_service.GetMuteConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_mute_config_use_cached_wrapped_rpc(): @@ -6750,10 +6782,14 @@ async def test_get_mute_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_mute_config_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.GetMuteConfigRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.GetMuteConfigRequest(), + {}, + ], +) +async def test_get_mute_config_async(request_type, transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6761,7 +6797,7 @@ async def test_get_mute_config_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_mute_config), "__call__") as call: @@ -6792,11 +6828,6 @@ async def test_get_mute_config_async( assert response.type_ == mute_config.MuteConfig.MuteConfigType.STATIC -@pytest.mark.asyncio -async def test_get_mute_config_async_from_dict(): - await test_get_mute_config_async(request_type=dict) - - def test_get_mute_config_flattened(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6882,8 +6913,8 @@ async def test_get_mute_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.GetNotificationConfigRequest, - dict, + securitycenter_service.GetNotificationConfigRequest(), + {}, ], ) def test_get_notification_config(request_type, transport: str = "grpc"): @@ -6894,7 +6925,7 @@ def test_get_notification_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( @@ -6948,9 +6979,10 @@ def test_get_notification_config_non_empty_request_with_auto_populated_field(): client.get_notification_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.GetNotificationConfigRequest( + request_msg = securitycenter_service.GetNotificationConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_notification_config_use_cached_wrapped_rpc(): @@ -7036,9 +7068,15 @@ async def test_get_notification_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.GetNotificationConfigRequest(), + {}, + ], +) async def test_get_notification_config_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.GetNotificationConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -7047,7 +7085,7 @@ async def test_get_notification_config_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( @@ -7078,11 +7116,6 @@ async def test_get_notification_config_async( assert response.service_account == "service_account_value" -@pytest.mark.asyncio -async def test_get_notification_config_async_from_dict(): - await test_get_notification_config_async(request_type=dict) - - def test_get_notification_config_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7237,8 +7270,8 @@ async def test_get_notification_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.GetResourceValueConfigRequest, - dict, + securitycenter_service.GetResourceValueConfigRequest(), + {}, ], ) def test_get_resource_value_config(request_type, transport: str = "grpc"): @@ -7249,7 +7282,7 @@ def test_get_resource_value_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( @@ -7309,9 +7342,10 @@ def test_get_resource_value_config_non_empty_request_with_auto_populated_field() client.get_resource_value_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.GetResourceValueConfigRequest( + request_msg = securitycenter_service.GetResourceValueConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_resource_value_config_use_cached_wrapped_rpc(): @@ -7397,9 +7431,15 @@ async def test_get_resource_value_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.GetResourceValueConfigRequest(), + {}, + ], +) async def test_get_resource_value_config_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.GetResourceValueConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -7408,7 +7448,7 @@ async def test_get_resource_value_config_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( @@ -7445,11 +7485,6 @@ async def test_get_resource_value_config_async( assert response.cloud_provider == resource.CloudProvider.GOOGLE_CLOUD_PLATFORM -@pytest.mark.asyncio -async def test_get_resource_value_config_async_from_dict(): - await test_get_resource_value_config_async(request_type=dict) - - def test_get_resource_value_config_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7604,8 +7639,8 @@ async def test_get_resource_value_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.GetSourceRequest, - dict, + securitycenter_service.GetSourceRequest(), + {}, ], ) def test_get_source(request_type, transport: str = "grpc"): @@ -7616,7 +7651,7 @@ def test_get_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(type(client.transport.get_source), "__call__") as call: @@ -7666,9 +7701,10 @@ def test_get_source_non_empty_request_with_auto_populated_field(): client.get_source(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.GetSourceRequest( + request_msg = securitycenter_service.GetSourceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_source_use_cached_wrapped_rpc(): @@ -7747,10 +7783,14 @@ async def test_get_source_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_source_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.GetSourceRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.GetSourceRequest(), + {}, + ], +) +async def test_get_source_async(request_type, transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7758,7 +7798,7 @@ async def test_get_source_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_source), "__call__") as call: @@ -7787,11 +7827,6 @@ async def test_get_source_async( assert response.canonical_name == "canonical_name_value" -@pytest.mark.asyncio -async def test_get_source_async_from_dict(): - await test_get_source_async(request_type=dict) - - def test_get_source_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7934,8 +7969,8 @@ async def test_get_source_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.GroupFindingsRequest, - dict, + securitycenter_service.GroupFindingsRequest(), + {}, ], ) def test_group_findings(request_type, transport: str = "grpc"): @@ -7946,7 +7981,7 @@ def test_group_findings(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.group_findings), "__call__") as call: @@ -7995,12 +8030,13 @@ def test_group_findings_non_empty_request_with_auto_populated_field(): client.group_findings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.GroupFindingsRequest( + request_msg = securitycenter_service.GroupFindingsRequest( parent="parent_value", filter="filter_value", group_by="group_by_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_group_findings_use_cached_wrapped_rpc(): @@ -8081,10 +8117,14 @@ async def test_group_findings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_group_findings_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.GroupFindingsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.GroupFindingsRequest(), + {}, + ], +) +async def test_group_findings_async(request_type, transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8092,7 +8132,7 @@ async def test_group_findings_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.group_findings), "__call__") as call: @@ -8117,11 +8157,6 @@ async def test_group_findings_async( assert response.total_size == 1086 -@pytest.mark.asyncio -async def test_group_findings_async_from_dict(): - await test_group_findings_async(request_type=dict) - - def test_group_findings_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8468,8 +8503,8 @@ async def test_group_findings_async_pages(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.ListAttackPathsRequest, - dict, + securitycenter_service.ListAttackPathsRequest(), + {}, ], ) def test_list_attack_paths(request_type, transport: str = "grpc"): @@ -8480,7 +8515,7 @@ def test_list_attack_paths(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8530,11 +8565,12 @@ def test_list_attack_paths_non_empty_request_with_auto_populated_field(): client.list_attack_paths(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.ListAttackPathsRequest( + request_msg = securitycenter_service.ListAttackPathsRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_attack_paths_use_cached_wrapped_rpc(): @@ -8617,10 +8653,14 @@ async def test_list_attack_paths_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_attack_paths_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.ListAttackPathsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.ListAttackPathsRequest(), + {}, + ], +) +async def test_list_attack_paths_async(request_type, transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8628,7 +8668,7 @@ async def test_list_attack_paths_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( @@ -8653,11 +8693,6 @@ async def test_list_attack_paths_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_attack_paths_async_from_dict(): - await test_list_attack_paths_async(request_type=dict) - - def test_list_attack_paths_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9010,8 +9045,8 @@ async def test_list_attack_paths_async_pages(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.ListBigQueryExportsRequest, - dict, + securitycenter_service.ListBigQueryExportsRequest(), + {}, ], ) def test_list_big_query_exports(request_type, transport: str = "grpc"): @@ -9022,7 +9057,7 @@ def test_list_big_query_exports(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9071,10 +9106,11 @@ def test_list_big_query_exports_non_empty_request_with_auto_populated_field(): client.list_big_query_exports(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.ListBigQueryExportsRequest( + request_msg = securitycenter_service.ListBigQueryExportsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_big_query_exports_use_cached_wrapped_rpc(): @@ -9160,9 +9196,15 @@ async def test_list_big_query_exports_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.ListBigQueryExportsRequest(), + {}, + ], +) async def test_list_big_query_exports_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.ListBigQueryExportsRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -9171,7 +9213,7 @@ async def test_list_big_query_exports_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( @@ -9196,11 +9238,6 @@ async def test_list_big_query_exports_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_big_query_exports_async_from_dict(): - await test_list_big_query_exports_async(request_type=dict) - - def test_list_big_query_exports_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9553,8 +9590,8 @@ async def test_list_big_query_exports_async_pages(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.ListFindingsRequest, - dict, + securitycenter_service.ListFindingsRequest(), + {}, ], ) def test_list_findings(request_type, transport: str = "grpc"): @@ -9565,7 +9602,7 @@ def test_list_findings(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_findings), "__call__") as call: @@ -9614,12 +9651,13 @@ def test_list_findings_non_empty_request_with_auto_populated_field(): client.list_findings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.ListFindingsRequest( + request_msg = securitycenter_service.ListFindingsRequest( parent="parent_value", filter="filter_value", order_by="order_by_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_findings_use_cached_wrapped_rpc(): @@ -9700,10 +9738,14 @@ async def test_list_findings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_findings_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.ListFindingsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.ListFindingsRequest(), + {}, + ], +) +async def test_list_findings_async(request_type, transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9711,7 +9753,7 @@ async def test_list_findings_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_findings), "__call__") as call: @@ -9736,11 +9778,6 @@ async def test_list_findings_async( assert response.total_size == 1086 -@pytest.mark.asyncio -async def test_list_findings_async_from_dict(): - await test_list_findings_async(request_type=dict) - - def test_list_findings_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10087,8 +10124,8 @@ async def test_list_findings_async_pages(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.ListMuteConfigsRequest, - dict, + securitycenter_service.ListMuteConfigsRequest(), + {}, ], ) def test_list_mute_configs(request_type, transport: str = "grpc"): @@ -10099,7 +10136,7 @@ def test_list_mute_configs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10148,10 +10185,11 @@ def test_list_mute_configs_non_empty_request_with_auto_populated_field(): client.list_mute_configs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.ListMuteConfigsRequest( + request_msg = securitycenter_service.ListMuteConfigsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_mute_configs_use_cached_wrapped_rpc(): @@ -10234,10 +10272,14 @@ async def test_list_mute_configs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_mute_configs_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.ListMuteConfigsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.ListMuteConfigsRequest(), + {}, + ], +) +async def test_list_mute_configs_async(request_type, transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10245,7 +10287,7 @@ async def test_list_mute_configs_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( @@ -10270,11 +10312,6 @@ async def test_list_mute_configs_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_mute_configs_async_from_dict(): - await test_list_mute_configs_async(request_type=dict) - - def test_list_mute_configs_flattened(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10559,8 +10596,8 @@ async def test_list_mute_configs_async_pages(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.ListNotificationConfigsRequest, - dict, + securitycenter_service.ListNotificationConfigsRequest(), + {}, ], ) def test_list_notification_configs(request_type, transport: str = "grpc"): @@ -10571,7 +10608,7 @@ def test_list_notification_configs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10620,10 +10657,11 @@ def test_list_notification_configs_non_empty_request_with_auto_populated_field() client.list_notification_configs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.ListNotificationConfigsRequest( + request_msg = securitycenter_service.ListNotificationConfigsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_notification_configs_use_cached_wrapped_rpc(): @@ -10709,9 +10747,15 @@ async def test_list_notification_configs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.ListNotificationConfigsRequest(), + {}, + ], +) async def test_list_notification_configs_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.ListNotificationConfigsRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -10720,7 +10764,7 @@ async def test_list_notification_configs_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( @@ -10745,11 +10789,6 @@ async def test_list_notification_configs_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_notification_configs_async_from_dict(): - await test_list_notification_configs_async(request_type=dict) - - def test_list_notification_configs_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11108,8 +11147,8 @@ async def test_list_notification_configs_async_pages(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.ListResourceValueConfigsRequest, - dict, + securitycenter_service.ListResourceValueConfigsRequest(), + {}, ], ) def test_list_resource_value_configs(request_type, transport: str = "grpc"): @@ -11120,7 +11159,7 @@ def test_list_resource_value_configs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11169,10 +11208,11 @@ def test_list_resource_value_configs_non_empty_request_with_auto_populated_field client.list_resource_value_configs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.ListResourceValueConfigsRequest( + request_msg = securitycenter_service.ListResourceValueConfigsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_resource_value_configs_use_cached_wrapped_rpc(): @@ -11258,9 +11298,15 @@ async def test_list_resource_value_configs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.ListResourceValueConfigsRequest(), + {}, + ], +) async def test_list_resource_value_configs_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.ListResourceValueConfigsRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -11269,7 +11315,7 @@ async def test_list_resource_value_configs_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( @@ -11294,11 +11340,6 @@ async def test_list_resource_value_configs_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_resource_value_configs_async_from_dict(): - await test_list_resource_value_configs_async(request_type=dict) - - def test_list_resource_value_configs_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11657,8 +11698,8 @@ async def test_list_resource_value_configs_async_pages(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.ListSourcesRequest, - dict, + securitycenter_service.ListSourcesRequest(), + {}, ], ) def test_list_sources(request_type, transport: str = "grpc"): @@ -11669,7 +11710,7 @@ def test_list_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(type(client.transport.list_sources), "__call__") as call: @@ -11714,10 +11755,11 @@ def test_list_sources_non_empty_request_with_auto_populated_field(): client.list_sources(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.ListSourcesRequest( + request_msg = securitycenter_service.ListSourcesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_sources_use_cached_wrapped_rpc(): @@ -11798,10 +11840,14 @@ async def test_list_sources_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_sources_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.ListSourcesRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.ListSourcesRequest(), + {}, + ], +) +async def test_list_sources_async(request_type, transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11809,7 +11855,7 @@ async def test_list_sources_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_sources), "__call__") as call: @@ -11832,11 +11878,6 @@ async def test_list_sources_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_sources_async_from_dict(): - await test_list_sources_async(request_type=dict) - - def test_list_sources_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12173,8 +12214,8 @@ async def test_list_sources_async_pages(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.ListValuedResourcesRequest, - dict, + securitycenter_service.ListValuedResourcesRequest(), + {}, ], ) def test_list_valued_resources(request_type, transport: str = "grpc"): @@ -12185,7 +12226,7 @@ def test_list_valued_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( @@ -12238,12 +12279,13 @@ def test_list_valued_resources_non_empty_request_with_auto_populated_field(): client.list_valued_resources(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.ListValuedResourcesRequest( + request_msg = securitycenter_service.ListValuedResourcesRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_valued_resources_use_cached_wrapped_rpc(): @@ -12329,9 +12371,15 @@ async def test_list_valued_resources_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.ListValuedResourcesRequest(), + {}, + ], +) async def test_list_valued_resources_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.ListValuedResourcesRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -12340,7 +12388,7 @@ async def test_list_valued_resources_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( @@ -12367,11 +12415,6 @@ async def test_list_valued_resources_async( assert response.total_size == 1086 -@pytest.mark.asyncio -async def test_list_valued_resources_async_from_dict(): - await test_list_valued_resources_async(request_type=dict) - - def test_list_valued_resources_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12724,8 +12767,8 @@ async def test_list_valued_resources_async_pages(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.SetFindingStateRequest, - dict, + securitycenter_service.SetFindingStateRequest(), + {}, ], ) def test_set_finding_state(request_type, transport: str = "grpc"): @@ -12736,7 +12779,7 @@ def test_set_finding_state(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -12812,9 +12855,10 @@ def test_set_finding_state_non_empty_request_with_auto_populated_field(): client.set_finding_state(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.SetFindingStateRequest( + request_msg = securitycenter_service.SetFindingStateRequest( name="name_value", ) + assert args[0] == request_msg def test_set_finding_state_use_cached_wrapped_rpc(): @@ -12897,10 +12941,14 @@ async def test_set_finding_state_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_finding_state_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.SetFindingStateRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.SetFindingStateRequest(), + {}, + ], +) +async def test_set_finding_state_async(request_type, transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12908,7 +12956,7 @@ async def test_set_finding_state_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( @@ -12961,11 +13009,6 @@ async def test_set_finding_state_async( assert response.module_name == "module_name_value" -@pytest.mark.asyncio -async def test_set_finding_state_async_from_dict(): - await test_set_finding_state_async(request_type=dict) - - def test_set_finding_state_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13126,8 +13169,8 @@ async def test_set_finding_state_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.SetIamPolicyRequest, - dict, + iam_policy_pb2.SetIamPolicyRequest(), + {}, ], ) def test_set_iam_policy(request_type, transport: str = "grpc"): @@ -13138,7 +13181,7 @@ def test_set_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(type(client.transport.set_iam_policy), "__call__") as call: @@ -13184,9 +13227,10 @@ def test_set_iam_policy_non_empty_request_with_auto_populated_field(): client.set_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.SetIamPolicyRequest( + request_msg = iam_policy_pb2.SetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_set_iam_policy_use_cached_wrapped_rpc(): @@ -13267,9 +13311,14 @@ async def test_set_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.SetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.SetIamPolicyRequest(), + {}, + ], +) +async def test_set_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13277,7 +13326,7 @@ async def test_set_iam_policy_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.set_iam_policy), "__call__") as call: @@ -13302,11 +13351,6 @@ async def test_set_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_set_iam_policy_async_from_dict(): - await test_set_iam_policy_async(request_type=dict) - - def test_set_iam_policy_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13467,8 +13511,8 @@ async def test_set_iam_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.SetMuteRequest, - dict, + securitycenter_service.SetMuteRequest(), + {}, ], ) def test_set_mute(request_type, transport: str = "grpc"): @@ -13479,7 +13523,7 @@ def test_set_mute(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.set_mute), "__call__") as call: @@ -13551,9 +13595,10 @@ def test_set_mute_non_empty_request_with_auto_populated_field(): client.set_mute(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.SetMuteRequest( + request_msg = securitycenter_service.SetMuteRequest( name="name_value", ) + assert args[0] == request_msg def test_set_mute_use_cached_wrapped_rpc(): @@ -13632,9 +13677,14 @@ async def test_set_mute_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn @pytest.mark.asyncio -async def test_set_mute_async( - transport: str = "grpc_asyncio", request_type=securitycenter_service.SetMuteRequest -): +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.SetMuteRequest(), + {}, + ], +) +async def test_set_mute_async(request_type, transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13642,7 +13692,7 @@ async def test_set_mute_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.set_mute), "__call__") as call: @@ -13693,11 +13743,6 @@ async def test_set_mute_async( assert response.module_name == "module_name_value" -@pytest.mark.asyncio -async def test_set_mute_async_from_dict(): - await test_set_mute_async(request_type=dict) - - def test_set_mute_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13850,8 +13895,8 @@ async def test_set_mute_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.TestIamPermissionsRequest, - dict, + iam_policy_pb2.TestIamPermissionsRequest(), + {}, ], ) def test_test_iam_permissions(request_type, transport: str = "grpc"): @@ -13862,7 +13907,7 @@ def test_test_iam_permissions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -13910,9 +13955,10 @@ def test_test_iam_permissions_non_empty_request_with_auto_populated_field(): client.test_iam_permissions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.TestIamPermissionsRequest( + request_msg = iam_policy_pb2.TestIamPermissionsRequest( resource="resource_value", ) + assert args[0] == request_msg def test_test_iam_permissions_use_cached_wrapped_rpc(): @@ -13997,9 +14043,15 @@ async def test_test_iam_permissions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.TestIamPermissionsRequest(), + {}, + ], +) async def test_test_iam_permissions_async( - transport: str = "grpc_asyncio", - request_type=iam_policy_pb2.TestIamPermissionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -14008,7 +14060,7 @@ async def test_test_iam_permissions_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( @@ -14033,11 +14085,6 @@ async def test_test_iam_permissions_async( assert response.permissions == ["permissions_value"] -@pytest.mark.asyncio -async def test_test_iam_permissions_async_from_dict(): - await test_test_iam_permissions_async(request_type=dict) - - def test_test_iam_permissions_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14221,8 +14268,8 @@ async def test_test_iam_permissions_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.UpdateBigQueryExportRequest, - dict, + securitycenter_service.UpdateBigQueryExportRequest(), + {}, ], ) def test_update_big_query_export(request_type, transport: str = "grpc"): @@ -14233,7 +14280,7 @@ def test_update_big_query_export(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -14289,7 +14336,8 @@ def test_update_big_query_export_non_empty_request_with_auto_populated_field(): client.update_big_query_export(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.UpdateBigQueryExportRequest() + request_msg = securitycenter_service.UpdateBigQueryExportRequest() + assert args[0] == request_msg def test_update_big_query_export_use_cached_wrapped_rpc(): @@ -14375,9 +14423,15 @@ async def test_update_big_query_export_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.UpdateBigQueryExportRequest(), + {}, + ], +) async def test_update_big_query_export_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.UpdateBigQueryExportRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -14386,7 +14440,7 @@ async def test_update_big_query_export_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( @@ -14421,11 +14475,6 @@ async def test_update_big_query_export_async( assert response.principal == "principal_value" -@pytest.mark.asyncio -async def test_update_big_query_export_async_from_dict(): - await test_update_big_query_export_async(request_type=dict) - - def test_update_big_query_export_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14590,8 +14639,8 @@ async def test_update_big_query_export_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.UpdateExternalSystemRequest, - dict, + securitycenter_service.UpdateExternalSystemRequest(), + {}, ], ) def test_update_external_system(request_type, transport: str = "grpc"): @@ -14602,7 +14651,7 @@ def test_update_external_system(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -14658,7 +14707,8 @@ def test_update_external_system_non_empty_request_with_auto_populated_field(): client.update_external_system(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.UpdateExternalSystemRequest() + request_msg = securitycenter_service.UpdateExternalSystemRequest() + assert args[0] == request_msg def test_update_external_system_use_cached_wrapped_rpc(): @@ -14744,9 +14794,15 @@ async def test_update_external_system_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.UpdateExternalSystemRequest(), + {}, + ], +) async def test_update_external_system_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.UpdateExternalSystemRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -14755,7 +14811,7 @@ async def test_update_external_system_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( @@ -14790,11 +14846,6 @@ async def test_update_external_system_async( assert response.case_priority == "case_priority_value" -@pytest.mark.asyncio -async def test_update_external_system_async_from_dict(): - await test_update_external_system_async(request_type=dict) - - def test_update_external_system_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14959,8 +15010,8 @@ async def test_update_external_system_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.UpdateFindingRequest, - dict, + securitycenter_service.UpdateFindingRequest(), + {}, ], ) def test_update_finding(request_type, transport: str = "grpc"): @@ -14971,7 +15022,7 @@ def test_update_finding(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_finding), "__call__") as call: @@ -15041,7 +15092,8 @@ def test_update_finding_non_empty_request_with_auto_populated_field(): client.update_finding(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.UpdateFindingRequest() + request_msg = securitycenter_service.UpdateFindingRequest() + assert args[0] == request_msg def test_update_finding_use_cached_wrapped_rpc(): @@ -15122,10 +15174,14 @@ async def test_update_finding_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_finding_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.UpdateFindingRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.UpdateFindingRequest(), + {}, + ], +) +async def test_update_finding_async(request_type, transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -15133,7 +15189,7 @@ async def test_update_finding_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_finding), "__call__") as call: @@ -15184,11 +15240,6 @@ async def test_update_finding_async( assert response.module_name == "module_name_value" -@pytest.mark.asyncio -async def test_update_finding_async_from_dict(): - await test_update_finding_async(request_type=dict) - - def test_update_finding_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15341,8 +15392,8 @@ async def test_update_finding_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.UpdateMuteConfigRequest, - dict, + securitycenter_service.UpdateMuteConfigRequest(), + {}, ], ) def test_update_mute_config(request_type, transport: str = "grpc"): @@ -15353,7 +15404,7 @@ def test_update_mute_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( @@ -15407,7 +15458,8 @@ def test_update_mute_config_non_empty_request_with_auto_populated_field(): client.update_mute_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.UpdateMuteConfigRequest() + request_msg = securitycenter_service.UpdateMuteConfigRequest() + assert args[0] == request_msg def test_update_mute_config_use_cached_wrapped_rpc(): @@ -15492,10 +15544,14 @@ async def test_update_mute_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_mute_config_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.UpdateMuteConfigRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.UpdateMuteConfigRequest(), + {}, + ], +) +async def test_update_mute_config_async(request_type, transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -15503,7 +15559,7 @@ async def test_update_mute_config_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( @@ -15536,11 +15592,6 @@ async def test_update_mute_config_async( assert response.type_ == gcs_mute_config.MuteConfig.MuteConfigType.STATIC -@pytest.mark.asyncio -async def test_update_mute_config_async_from_dict(): - await test_update_mute_config_async(request_type=dict) - - def test_update_mute_config_flattened(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15640,8 +15691,8 @@ async def test_update_mute_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.UpdateNotificationConfigRequest, - dict, + securitycenter_service.UpdateNotificationConfigRequest(), + {}, ], ) def test_update_notification_config(request_type, transport: str = "grpc"): @@ -15652,7 +15703,7 @@ def test_update_notification_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( @@ -15704,7 +15755,8 @@ def test_update_notification_config_non_empty_request_with_auto_populated_field( client.update_notification_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.UpdateNotificationConfigRequest() + request_msg = securitycenter_service.UpdateNotificationConfigRequest() + assert args[0] == request_msg def test_update_notification_config_use_cached_wrapped_rpc(): @@ -15790,9 +15842,15 @@ async def test_update_notification_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.UpdateNotificationConfigRequest(), + {}, + ], +) async def test_update_notification_config_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.UpdateNotificationConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -15801,7 +15859,7 @@ async def test_update_notification_config_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( @@ -15832,11 +15890,6 @@ async def test_update_notification_config_async( assert response.service_account == "service_account_value" -@pytest.mark.asyncio -async def test_update_notification_config_async_from_dict(): - await test_update_notification_config_async(request_type=dict) - - def test_update_notification_config_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16009,8 +16062,8 @@ async def test_update_notification_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.UpdateResourceValueConfigRequest, - dict, + securitycenter_service.UpdateResourceValueConfigRequest(), + {}, ], ) def test_update_resource_value_config(request_type, transport: str = "grpc"): @@ -16021,7 +16074,7 @@ def test_update_resource_value_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( @@ -16079,7 +16132,8 @@ def test_update_resource_value_config_non_empty_request_with_auto_populated_fiel client.update_resource_value_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.UpdateResourceValueConfigRequest() + request_msg = securitycenter_service.UpdateResourceValueConfigRequest() + assert args[0] == request_msg def test_update_resource_value_config_use_cached_wrapped_rpc(): @@ -16165,9 +16219,15 @@ async def test_update_resource_value_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.UpdateResourceValueConfigRequest(), + {}, + ], +) async def test_update_resource_value_config_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.UpdateResourceValueConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -16176,7 +16236,7 @@ async def test_update_resource_value_config_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( @@ -16213,11 +16273,6 @@ async def test_update_resource_value_config_async( assert response.cloud_provider == resource.CloudProvider.GOOGLE_CLOUD_PLATFORM -@pytest.mark.asyncio -async def test_update_resource_value_config_async_from_dict(): - await test_update_resource_value_config_async(request_type=dict) - - def test_update_resource_value_config_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16390,8 +16445,8 @@ async def test_update_resource_value_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.UpdateSecurityMarksRequest, - dict, + securitycenter_service.UpdateSecurityMarksRequest(), + {}, ], ) def test_update_security_marks(request_type, transport: str = "grpc"): @@ -16402,7 +16457,7 @@ def test_update_security_marks(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -16450,7 +16505,8 @@ def test_update_security_marks_non_empty_request_with_auto_populated_field(): client.update_security_marks(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.UpdateSecurityMarksRequest() + request_msg = securitycenter_service.UpdateSecurityMarksRequest() + assert args[0] == request_msg def test_update_security_marks_use_cached_wrapped_rpc(): @@ -16536,9 +16592,15 @@ async def test_update_security_marks_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.UpdateSecurityMarksRequest(), + {}, + ], +) async def test_update_security_marks_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.UpdateSecurityMarksRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), @@ -16547,7 +16609,7 @@ async def test_update_security_marks_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( @@ -16574,11 +16636,6 @@ async def test_update_security_marks_async( assert response.canonical_name == "canonical_name_value" -@pytest.mark.asyncio -async def test_update_security_marks_async_from_dict(): - await test_update_security_marks_async(request_type=dict) - - def test_update_security_marks_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16743,8 +16800,8 @@ async def test_update_security_marks_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - securitycenter_service.UpdateSourceRequest, - dict, + securitycenter_service.UpdateSourceRequest(), + {}, ], ) def test_update_source(request_type, transport: str = "grpc"): @@ -16755,7 +16812,7 @@ def test_update_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(type(client.transport.update_source), "__call__") as call: @@ -16803,7 +16860,8 @@ def test_update_source_non_empty_request_with_auto_populated_field(): client.update_source(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == securitycenter_service.UpdateSourceRequest() + request_msg = securitycenter_service.UpdateSourceRequest() + assert args[0] == request_msg def test_update_source_use_cached_wrapped_rpc(): @@ -16884,10 +16942,14 @@ async def test_update_source_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_source_async( - transport: str = "grpc_asyncio", - request_type=securitycenter_service.UpdateSourceRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + securitycenter_service.UpdateSourceRequest(), + {}, + ], +) +async def test_update_source_async(request_type, transport: str = "grpc_asyncio"): client = SecurityCenterAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -16895,7 +16957,7 @@ async def test_update_source_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_source), "__call__") as call: @@ -16924,11 +16986,6 @@ async def test_update_source_async( assert response.canonical_name == "canonical_name_value" -@pytest.mark.asyncio -async def test_update_source_async_from_dict(): - await test_update_source_async(request_type=dict) - - def test_update_source_field_headers(): client = SecurityCenterClient( credentials=ga_credentials.AnonymousCredentials(), @@ -25408,7 +25465,6 @@ def test_batch_create_resource_value_configs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.BatchCreateResourceValueConfigsRequest() - assert args[0] == request_msg @@ -25431,7 +25487,6 @@ def test_bulk_mute_findings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.BulkMuteFindingsRequest() - assert args[0] == request_msg @@ -25454,7 +25509,6 @@ def test_create_big_query_export_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.CreateBigQueryExportRequest() - assert args[0] == request_msg @@ -25475,7 +25529,6 @@ def test_create_finding_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.CreateFindingRequest() - assert args[0] == request_msg @@ -25498,7 +25551,6 @@ def test_create_mute_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.CreateMuteConfigRequest() - assert args[0] == request_msg @@ -25521,7 +25573,6 @@ def test_create_notification_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.CreateNotificationConfigRequest() - assert args[0] == request_msg @@ -25542,7 +25593,6 @@ def test_create_source_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.CreateSourceRequest() - assert args[0] == request_msg @@ -25565,7 +25615,6 @@ def test_delete_big_query_export_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.DeleteBigQueryExportRequest() - assert args[0] == request_msg @@ -25588,7 +25637,6 @@ def test_delete_mute_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.DeleteMuteConfigRequest() - assert args[0] == request_msg @@ -25611,7 +25659,6 @@ def test_delete_notification_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.DeleteNotificationConfigRequest() - assert args[0] == request_msg @@ -25634,7 +25681,6 @@ def test_delete_resource_value_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.DeleteResourceValueConfigRequest() - assert args[0] == request_msg @@ -25657,7 +25703,6 @@ def test_get_big_query_export_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GetBigQueryExportRequest() - assert args[0] == request_msg @@ -25678,7 +25723,6 @@ def test_get_simulation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GetSimulationRequest() - assert args[0] == request_msg @@ -25701,7 +25745,6 @@ def test_get_valued_resource_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GetValuedResourceRequest() - assert args[0] == request_msg @@ -25722,7 +25765,6 @@ def test_get_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -25743,7 +25785,6 @@ def test_get_mute_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GetMuteConfigRequest() - assert args[0] == request_msg @@ -25766,7 +25807,6 @@ def test_get_notification_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GetNotificationConfigRequest() - assert args[0] == request_msg @@ -25789,7 +25829,6 @@ def test_get_resource_value_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GetResourceValueConfigRequest() - assert args[0] == request_msg @@ -25810,7 +25849,6 @@ def test_get_source_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GetSourceRequest() - assert args[0] == request_msg @@ -25831,7 +25869,6 @@ def test_group_findings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GroupFindingsRequest() - assert args[0] == request_msg @@ -25854,7 +25891,6 @@ def test_list_attack_paths_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListAttackPathsRequest() - assert args[0] == request_msg @@ -25877,7 +25913,6 @@ def test_list_big_query_exports_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListBigQueryExportsRequest() - assert args[0] == request_msg @@ -25898,7 +25933,6 @@ def test_list_findings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListFindingsRequest() - assert args[0] == request_msg @@ -25921,7 +25955,6 @@ def test_list_mute_configs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListMuteConfigsRequest() - assert args[0] == request_msg @@ -25944,7 +25977,6 @@ def test_list_notification_configs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListNotificationConfigsRequest() - assert args[0] == request_msg @@ -25967,7 +25999,6 @@ def test_list_resource_value_configs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListResourceValueConfigsRequest() - assert args[0] == request_msg @@ -25988,7 +26019,6 @@ def test_list_sources_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListSourcesRequest() - assert args[0] == request_msg @@ -26011,7 +26041,6 @@ def test_list_valued_resources_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListValuedResourcesRequest() - assert args[0] == request_msg @@ -26034,7 +26063,6 @@ def test_set_finding_state_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.SetFindingStateRequest() - assert args[0] == request_msg @@ -26055,7 +26083,6 @@ def test_set_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -26076,7 +26103,6 @@ def test_set_mute_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.SetMuteRequest() - assert args[0] == request_msg @@ -26099,7 +26125,6 @@ def test_test_iam_permissions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -26122,7 +26147,6 @@ def test_update_big_query_export_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateBigQueryExportRequest() - assert args[0] == request_msg @@ -26145,7 +26169,6 @@ def test_update_external_system_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateExternalSystemRequest() - assert args[0] == request_msg @@ -26166,7 +26189,6 @@ def test_update_finding_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateFindingRequest() - assert args[0] == request_msg @@ -26189,7 +26211,6 @@ def test_update_mute_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateMuteConfigRequest() - assert args[0] == request_msg @@ -26212,7 +26233,6 @@ def test_update_notification_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateNotificationConfigRequest() - assert args[0] == request_msg @@ -26235,7 +26255,6 @@ def test_update_resource_value_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateResourceValueConfigRequest() - assert args[0] == request_msg @@ -26258,7 +26277,6 @@ def test_update_security_marks_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateSecurityMarksRequest() - assert args[0] == request_msg @@ -26279,7 +26297,6 @@ def test_update_source_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateSourceRequest() - assert args[0] == request_msg @@ -26304,7 +26321,6 @@ def test_create_mute_config_routing_parameters_request_1_grpc(): request_msg = securitycenter_service.CreateMuteConfigRequest( **{"parent": "projects/sample1/locations/sample2"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -26334,7 +26350,6 @@ def test_create_mute_config_routing_parameters_request_2_grpc(): request_msg = securitycenter_service.CreateMuteConfigRequest( **{"parent": "organizations/sample1/locations/sample2"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -26364,7 +26379,6 @@ def test_create_mute_config_routing_parameters_request_3_grpc(): request_msg = securitycenter_service.CreateMuteConfigRequest( **{"parent": "folders/sample1/locations/sample2"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -26394,7 +26408,6 @@ def test_delete_mute_config_routing_parameters_request_1_grpc(): request_msg = securitycenter_service.DeleteMuteConfigRequest( **{"name": "projects/sample1/locations/sample2/muteConfigs/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -26426,7 +26439,6 @@ def test_delete_mute_config_routing_parameters_request_2_grpc(): request_msg = securitycenter_service.DeleteMuteConfigRequest( **{"name": "organizations/sample1/locations/sample2/muteConfigs/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -26456,7 +26468,6 @@ def test_delete_mute_config_routing_parameters_request_3_grpc(): request_msg = securitycenter_service.DeleteMuteConfigRequest( **{"name": "folders/sample1/locations/sample2/muteConfigs/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -26484,7 +26495,6 @@ def test_get_mute_config_routing_parameters_request_1_grpc(): request_msg = securitycenter_service.GetMuteConfigRequest( **{"name": "projects/sample1/locations/sample2/muteConfigs/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -26514,7 +26524,6 @@ def test_get_mute_config_routing_parameters_request_2_grpc(): request_msg = securitycenter_service.GetMuteConfigRequest( **{"name": "organizations/sample1/locations/sample2/muteConfigs/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -26542,7 +26551,6 @@ def test_get_mute_config_routing_parameters_request_3_grpc(): request_msg = securitycenter_service.GetMuteConfigRequest( **{"name": "folders/sample1/locations/sample2/muteConfigs/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -26572,7 +26580,6 @@ def test_list_mute_configs_routing_parameters_request_1_grpc(): request_msg = securitycenter_service.ListMuteConfigsRequest( **{"parent": "projects/sample1/locations/sample2/muteConfigs"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -26602,7 +26609,6 @@ def test_list_mute_configs_routing_parameters_request_2_grpc(): request_msg = securitycenter_service.ListMuteConfigsRequest( **{"parent": "organizations/sample1/locations/sample2/muteConfigs"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -26632,7 +26638,6 @@ def test_list_mute_configs_routing_parameters_request_3_grpc(): request_msg = securitycenter_service.ListMuteConfigsRequest( **{"parent": "folders/sample1/locations/sample2/muteConfigs"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -26670,7 +26675,6 @@ def test_update_mute_config_routing_parameters_request_1_grpc(): } } ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -26708,7 +26712,6 @@ def test_update_mute_config_routing_parameters_request_2_grpc(): } } ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -26746,7 +26749,6 @@ def test_update_mute_config_routing_parameters_request_3_grpc(): } } ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -26792,7 +26794,6 @@ async def test_batch_create_resource_value_configs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.BatchCreateResourceValueConfigsRequest() - assert args[0] == request_msg @@ -26819,7 +26820,6 @@ async def test_bulk_mute_findings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.BulkMuteFindingsRequest() - assert args[0] == request_msg @@ -26853,7 +26853,6 @@ async def test_create_big_query_export_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.CreateBigQueryExportRequest() - assert args[0] == request_msg @@ -26894,7 +26893,6 @@ async def test_create_finding_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.CreateFindingRequest() - assert args[0] == request_msg @@ -26927,7 +26925,6 @@ async def test_create_mute_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.CreateMuteConfigRequest() - assert args[0] == request_msg @@ -26959,7 +26956,6 @@ async def test_create_notification_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.CreateNotificationConfigRequest() - assert args[0] == request_msg @@ -26989,7 +26985,6 @@ async def test_create_source_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.CreateSourceRequest() - assert args[0] == request_msg @@ -27014,7 +27009,6 @@ async def test_delete_big_query_export_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.DeleteBigQueryExportRequest() - assert args[0] == request_msg @@ -27039,7 +27033,6 @@ async def test_delete_mute_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.DeleteMuteConfigRequest() - assert args[0] == request_msg @@ -27064,7 +27057,6 @@ async def test_delete_notification_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.DeleteNotificationConfigRequest() - assert args[0] == request_msg @@ -27089,7 +27081,6 @@ async def test_delete_resource_value_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.DeleteResourceValueConfigRequest() - assert args[0] == request_msg @@ -27123,7 +27114,6 @@ async def test_get_big_query_export_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GetBigQueryExportRequest() - assert args[0] == request_msg @@ -27151,7 +27141,6 @@ async def test_get_simulation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GetSimulationRequest() - assert args[0] == request_msg @@ -27185,7 +27174,6 @@ async def test_get_valued_resource_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GetValuedResourceRequest() - assert args[0] == request_msg @@ -27213,7 +27201,6 @@ async def test_get_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -27244,7 +27231,6 @@ async def test_get_mute_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GetMuteConfigRequest() - assert args[0] == request_msg @@ -27276,7 +27262,6 @@ async def test_get_notification_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GetNotificationConfigRequest() - assert args[0] == request_msg @@ -27311,7 +27296,6 @@ async def test_get_resource_value_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GetResourceValueConfigRequest() - assert args[0] == request_msg @@ -27341,7 +27325,6 @@ async def test_get_source_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GetSourceRequest() - assert args[0] == request_msg @@ -27369,7 +27352,6 @@ async def test_group_findings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GroupFindingsRequest() - assert args[0] == request_msg @@ -27398,7 +27380,6 @@ async def test_list_attack_paths_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListAttackPathsRequest() - assert args[0] == request_msg @@ -27427,7 +27408,6 @@ async def test_list_big_query_exports_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListBigQueryExportsRequest() - assert args[0] == request_msg @@ -27455,7 +27435,6 @@ async def test_list_findings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListFindingsRequest() - assert args[0] == request_msg @@ -27484,7 +27463,6 @@ async def test_list_mute_configs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListMuteConfigsRequest() - assert args[0] == request_msg @@ -27513,7 +27491,6 @@ async def test_list_notification_configs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListNotificationConfigsRequest() - assert args[0] == request_msg @@ -27542,7 +27519,6 @@ async def test_list_resource_value_configs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListResourceValueConfigsRequest() - assert args[0] == request_msg @@ -27569,7 +27545,6 @@ async def test_list_sources_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListSourcesRequest() - assert args[0] == request_msg @@ -27599,7 +27574,6 @@ async def test_list_valued_resources_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListValuedResourcesRequest() - assert args[0] == request_msg @@ -27642,7 +27616,6 @@ async def test_set_finding_state_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.SetFindingStateRequest() - assert args[0] == request_msg @@ -27670,7 +27643,6 @@ async def test_set_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -27711,7 +27683,6 @@ async def test_set_mute_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.SetMuteRequest() - assert args[0] == request_msg @@ -27740,7 +27711,6 @@ async def test_test_iam_permissions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -27774,7 +27744,6 @@ async def test_update_big_query_export_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateBigQueryExportRequest() - assert args[0] == request_msg @@ -27808,7 +27777,6 @@ async def test_update_external_system_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateExternalSystemRequest() - assert args[0] == request_msg @@ -27849,7 +27817,6 @@ async def test_update_finding_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateFindingRequest() - assert args[0] == request_msg @@ -27882,7 +27849,6 @@ async def test_update_mute_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateMuteConfigRequest() - assert args[0] == request_msg @@ -27914,7 +27880,6 @@ async def test_update_notification_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateNotificationConfigRequest() - assert args[0] == request_msg @@ -27949,7 +27914,6 @@ async def test_update_resource_value_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateResourceValueConfigRequest() - assert args[0] == request_msg @@ -27979,7 +27943,6 @@ async def test_update_security_marks_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateSecurityMarksRequest() - assert args[0] == request_msg @@ -28009,7 +27972,6 @@ async def test_update_source_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateSourceRequest() - assert args[0] == request_msg @@ -28044,7 +28006,6 @@ async def test_create_mute_config_routing_parameters_request_1_grpc_asyncio(): request_msg = securitycenter_service.CreateMuteConfigRequest( **{"parent": "projects/sample1/locations/sample2"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -28084,7 +28045,6 @@ async def test_create_mute_config_routing_parameters_request_2_grpc_asyncio(): request_msg = securitycenter_service.CreateMuteConfigRequest( **{"parent": "organizations/sample1/locations/sample2"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -28124,7 +28084,6 @@ async def test_create_mute_config_routing_parameters_request_3_grpc_asyncio(): request_msg = securitycenter_service.CreateMuteConfigRequest( **{"parent": "folders/sample1/locations/sample2"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -28156,7 +28115,6 @@ async def test_delete_mute_config_routing_parameters_request_1_grpc_asyncio(): request_msg = securitycenter_service.DeleteMuteConfigRequest( **{"name": "projects/sample1/locations/sample2/muteConfigs/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -28190,7 +28148,6 @@ async def test_delete_mute_config_routing_parameters_request_2_grpc_asyncio(): request_msg = securitycenter_service.DeleteMuteConfigRequest( **{"name": "organizations/sample1/locations/sample2/muteConfigs/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -28222,7 +28179,6 @@ async def test_delete_mute_config_routing_parameters_request_3_grpc_asyncio(): request_msg = securitycenter_service.DeleteMuteConfigRequest( **{"name": "folders/sample1/locations/sample2/muteConfigs/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -28260,7 +28216,6 @@ async def test_get_mute_config_routing_parameters_request_1_grpc_asyncio(): request_msg = securitycenter_service.GetMuteConfigRequest( **{"name": "projects/sample1/locations/sample2/muteConfigs/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -28300,7 +28255,6 @@ async def test_get_mute_config_routing_parameters_request_2_grpc_asyncio(): request_msg = securitycenter_service.GetMuteConfigRequest( **{"name": "organizations/sample1/locations/sample2/muteConfigs/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -28338,7 +28292,6 @@ async def test_get_mute_config_routing_parameters_request_3_grpc_asyncio(): request_msg = securitycenter_service.GetMuteConfigRequest( **{"name": "folders/sample1/locations/sample2/muteConfigs/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -28374,7 +28327,6 @@ async def test_list_mute_configs_routing_parameters_request_1_grpc_asyncio(): request_msg = securitycenter_service.ListMuteConfigsRequest( **{"parent": "projects/sample1/locations/sample2/muteConfigs"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -28410,7 +28362,6 @@ async def test_list_mute_configs_routing_parameters_request_2_grpc_asyncio(): request_msg = securitycenter_service.ListMuteConfigsRequest( **{"parent": "organizations/sample1/locations/sample2/muteConfigs"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -28446,7 +28397,6 @@ async def test_list_mute_configs_routing_parameters_request_3_grpc_asyncio(): request_msg = securitycenter_service.ListMuteConfigsRequest( **{"parent": "folders/sample1/locations/sample2/muteConfigs"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -28494,7 +28444,6 @@ async def test_update_mute_config_routing_parameters_request_1_grpc_asyncio(): } } ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -28542,7 +28491,6 @@ async def test_update_mute_config_routing_parameters_request_2_grpc_asyncio(): } } ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -28590,7 +28538,6 @@ async def test_update_mute_config_routing_parameters_request_3_grpc_asyncio(): } } ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -36256,7 +36203,6 @@ def test_batch_create_resource_value_configs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.BatchCreateResourceValueConfigsRequest() - assert args[0] == request_msg @@ -36278,7 +36224,6 @@ def test_bulk_mute_findings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.BulkMuteFindingsRequest() - assert args[0] == request_msg @@ -36300,7 +36245,6 @@ def test_create_big_query_export_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.CreateBigQueryExportRequest() - assert args[0] == request_msg @@ -36320,7 +36264,6 @@ def test_create_finding_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.CreateFindingRequest() - assert args[0] == request_msg @@ -36342,7 +36285,6 @@ def test_create_mute_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.CreateMuteConfigRequest() - assert args[0] == request_msg @@ -36364,7 +36306,6 @@ def test_create_notification_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.CreateNotificationConfigRequest() - assert args[0] == request_msg @@ -36384,7 +36325,6 @@ def test_create_source_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.CreateSourceRequest() - assert args[0] == request_msg @@ -36406,7 +36346,6 @@ def test_delete_big_query_export_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.DeleteBigQueryExportRequest() - assert args[0] == request_msg @@ -36428,7 +36367,6 @@ def test_delete_mute_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.DeleteMuteConfigRequest() - assert args[0] == request_msg @@ -36450,7 +36388,6 @@ def test_delete_notification_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.DeleteNotificationConfigRequest() - assert args[0] == request_msg @@ -36472,7 +36409,6 @@ def test_delete_resource_value_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.DeleteResourceValueConfigRequest() - assert args[0] == request_msg @@ -36494,7 +36430,6 @@ def test_get_big_query_export_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GetBigQueryExportRequest() - assert args[0] == request_msg @@ -36514,7 +36449,6 @@ def test_get_simulation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GetSimulationRequest() - assert args[0] == request_msg @@ -36536,7 +36470,6 @@ def test_get_valued_resource_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GetValuedResourceRequest() - assert args[0] == request_msg @@ -36556,7 +36489,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -36576,7 +36508,6 @@ def test_get_mute_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GetMuteConfigRequest() - assert args[0] == request_msg @@ -36598,7 +36529,6 @@ def test_get_notification_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GetNotificationConfigRequest() - assert args[0] == request_msg @@ -36620,7 +36550,6 @@ def test_get_resource_value_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GetResourceValueConfigRequest() - assert args[0] == request_msg @@ -36640,7 +36569,6 @@ def test_get_source_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GetSourceRequest() - assert args[0] == request_msg @@ -36660,7 +36588,6 @@ def test_group_findings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.GroupFindingsRequest() - assert args[0] == request_msg @@ -36682,7 +36609,6 @@ def test_list_attack_paths_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListAttackPathsRequest() - assert args[0] == request_msg @@ -36704,7 +36630,6 @@ def test_list_big_query_exports_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListBigQueryExportsRequest() - assert args[0] == request_msg @@ -36724,7 +36649,6 @@ def test_list_findings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListFindingsRequest() - assert args[0] == request_msg @@ -36746,7 +36670,6 @@ def test_list_mute_configs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListMuteConfigsRequest() - assert args[0] == request_msg @@ -36768,7 +36691,6 @@ def test_list_notification_configs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListNotificationConfigsRequest() - assert args[0] == request_msg @@ -36790,7 +36712,6 @@ def test_list_resource_value_configs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListResourceValueConfigsRequest() - assert args[0] == request_msg @@ -36810,7 +36731,6 @@ def test_list_sources_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListSourcesRequest() - assert args[0] == request_msg @@ -36832,7 +36752,6 @@ def test_list_valued_resources_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.ListValuedResourcesRequest() - assert args[0] == request_msg @@ -36854,7 +36773,6 @@ def test_set_finding_state_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.SetFindingStateRequest() - assert args[0] == request_msg @@ -36874,7 +36792,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -36894,7 +36811,6 @@ def test_set_mute_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.SetMuteRequest() - assert args[0] == request_msg @@ -36916,7 +36832,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -36938,7 +36853,6 @@ def test_update_big_query_export_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateBigQueryExportRequest() - assert args[0] == request_msg @@ -36960,7 +36874,6 @@ def test_update_external_system_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateExternalSystemRequest() - assert args[0] == request_msg @@ -36980,7 +36893,6 @@ def test_update_finding_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateFindingRequest() - assert args[0] == request_msg @@ -37002,7 +36914,6 @@ def test_update_mute_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateMuteConfigRequest() - assert args[0] == request_msg @@ -37024,7 +36935,6 @@ def test_update_notification_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateNotificationConfigRequest() - assert args[0] == request_msg @@ -37046,7 +36956,6 @@ def test_update_resource_value_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateResourceValueConfigRequest() - assert args[0] == request_msg @@ -37068,7 +36977,6 @@ def test_update_security_marks_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateSecurityMarksRequest() - assert args[0] == request_msg @@ -37088,7 +36996,6 @@ def test_update_source_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = securitycenter_service.UpdateSourceRequest() - assert args[0] == request_msg @@ -37112,7 +37019,6 @@ def test_create_mute_config_routing_parameters_request_1_rest(): request_msg = securitycenter_service.CreateMuteConfigRequest( **{"parent": "projects/sample1/locations/sample2"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -37141,7 +37047,6 @@ def test_create_mute_config_routing_parameters_request_2_rest(): request_msg = securitycenter_service.CreateMuteConfigRequest( **{"parent": "organizations/sample1/locations/sample2"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -37170,7 +37075,6 @@ def test_create_mute_config_routing_parameters_request_3_rest(): request_msg = securitycenter_service.CreateMuteConfigRequest( **{"parent": "folders/sample1/locations/sample2"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -37199,7 +37103,6 @@ def test_delete_mute_config_routing_parameters_request_1_rest(): request_msg = securitycenter_service.DeleteMuteConfigRequest( **{"name": "projects/sample1/locations/sample2/muteConfigs/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -37230,7 +37133,6 @@ def test_delete_mute_config_routing_parameters_request_2_rest(): request_msg = securitycenter_service.DeleteMuteConfigRequest( **{"name": "organizations/sample1/locations/sample2/muteConfigs/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -37259,7 +37161,6 @@ def test_delete_mute_config_routing_parameters_request_3_rest(): request_msg = securitycenter_service.DeleteMuteConfigRequest( **{"name": "folders/sample1/locations/sample2/muteConfigs/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -37286,7 +37187,6 @@ def test_get_mute_config_routing_parameters_request_1_rest(): request_msg = securitycenter_service.GetMuteConfigRequest( **{"name": "projects/sample1/locations/sample2/muteConfigs/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -37315,7 +37215,6 @@ def test_get_mute_config_routing_parameters_request_2_rest(): request_msg = securitycenter_service.GetMuteConfigRequest( **{"name": "organizations/sample1/locations/sample2/muteConfigs/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -37342,7 +37241,6 @@ def test_get_mute_config_routing_parameters_request_3_rest(): request_msg = securitycenter_service.GetMuteConfigRequest( **{"name": "folders/sample1/locations/sample2/muteConfigs/sample3"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -37371,7 +37269,6 @@ def test_list_mute_configs_routing_parameters_request_1_rest(): request_msg = securitycenter_service.ListMuteConfigsRequest( **{"parent": "projects/sample1/locations/sample2/muteConfigs"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -37400,7 +37297,6 @@ def test_list_mute_configs_routing_parameters_request_2_rest(): request_msg = securitycenter_service.ListMuteConfigsRequest( **{"parent": "organizations/sample1/locations/sample2/muteConfigs"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -37429,7 +37325,6 @@ def test_list_mute_configs_routing_parameters_request_3_rest(): request_msg = securitycenter_service.ListMuteConfigsRequest( **{"parent": "folders/sample1/locations/sample2/muteConfigs"} ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -37466,7 +37361,6 @@ def test_update_mute_config_routing_parameters_request_1_rest(): } } ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -37503,7 +37397,6 @@ def test_update_mute_config_routing_parameters_request_2_rest(): } } ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} @@ -37540,7 +37433,6 @@ def test_update_mute_config_routing_parameters_request_3_rest(): } } ) - assert args[0] == request_msg expected_headers = {"location": "sample2"} diff --git a/packages/google-cloud-securitycentermanagement/noxfile.py b/packages/google-cloud-securitycentermanagement/noxfile.py index 4f4ec7cc6744..6a6d67de2999 100644 --- a/packages/google-cloud-securitycentermanagement/noxfile.py +++ b/packages/google-cloud-securitycentermanagement/noxfile.py @@ -47,7 +47,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-securitycentermanagement" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-securitycentermanagement/setup.py b/packages/google-cloud-securitycentermanagement/setup.py index 0175407e8b03..84e2f6c02601 100644 --- a/packages/google-cloud-securitycentermanagement/setup.py +++ b/packages/google-cloud-securitycentermanagement/setup.py @@ -45,7 +45,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/google-cloud-securitycentermanagement/testing/constraints-3.10.txt b/packages/google-cloud-securitycentermanagement/testing/constraints-3.10.txt index a92801e1c8e2..b39cd54634f9 100644 --- a/packages/google-cloud-securitycentermanagement/testing/constraints-3.10.txt +++ b/packages/google-cloud-securitycentermanagement/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/google-cloud-securitycentermanagement/tests/unit/gapic/securitycentermanagement_v1/test_security_center_management.py b/packages/google-cloud-securitycentermanagement/tests/unit/gapic/securitycentermanagement_v1/test_security_center_management.py index a7ecf8927f4e..5445e6154a0d 100644 --- a/packages/google-cloud-securitycentermanagement/tests/unit/gapic/securitycentermanagement_v1/test_security_center_management.py +++ b/packages/google-cloud-securitycentermanagement/tests/unit/gapic/securitycentermanagement_v1/test_security_center_management.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 @@ -113,6 +114,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" @@ -1388,8 +1404,8 @@ def test_security_center_management_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - security_center_management.ListEffectiveSecurityHealthAnalyticsCustomModulesRequest, - dict, + security_center_management.ListEffectiveSecurityHealthAnalyticsCustomModulesRequest(), + {}, ], ) def test_list_effective_security_health_analytics_custom_modules( @@ -1402,7 +1418,7 @@ def test_list_effective_security_health_analytics_custom_modules( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1457,13 +1473,11 @@ def test_list_effective_security_health_analytics_custom_modules_non_empty_reque client.list_effective_security_health_analytics_custom_modules(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert ( - args[0] - == security_center_management.ListEffectiveSecurityHealthAnalyticsCustomModulesRequest( - parent="parent_value", - page_token="page_token_value", - ) + request_msg = security_center_management.ListEffectiveSecurityHealthAnalyticsCustomModulesRequest( + parent="parent_value", + page_token="page_token_value", ) + assert args[0] == request_msg def test_list_effective_security_health_analytics_custom_modules_use_cached_wrapped_rpc(): @@ -1549,9 +1563,15 @@ async def test_list_effective_security_health_analytics_custom_modules_async_use @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + security_center_management.ListEffectiveSecurityHealthAnalyticsCustomModulesRequest(), + {}, + ], +) async def test_list_effective_security_health_analytics_custom_modules_async( - transport: str = "grpc_asyncio", - request_type=security_center_management.ListEffectiveSecurityHealthAnalyticsCustomModulesRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterManagementAsyncClient( credentials=async_anonymous_credentials(), @@ -1560,7 +1580,7 @@ async def test_list_effective_security_health_analytics_custom_modules_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( @@ -1590,13 +1610,6 @@ async def test_list_effective_security_health_analytics_custom_modules_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_effective_security_health_analytics_custom_modules_async_from_dict(): - await test_list_effective_security_health_analytics_custom_modules_async( - request_type=dict - ) - - def test_list_effective_security_health_analytics_custom_modules_field_headers(): client = SecurityCenterManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1983,8 +1996,8 @@ async def test_list_effective_security_health_analytics_custom_modules_async_pag @pytest.mark.parametrize( "request_type", [ - security_center_management.GetEffectiveSecurityHealthAnalyticsCustomModuleRequest, - dict, + security_center_management.GetEffectiveSecurityHealthAnalyticsCustomModuleRequest(), + {}, ], ) def test_get_effective_security_health_analytics_custom_module( @@ -1997,7 +2010,7 @@ def test_get_effective_security_health_analytics_custom_module( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2057,12 +2070,10 @@ def test_get_effective_security_health_analytics_custom_module_non_empty_request client.get_effective_security_health_analytics_custom_module(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert ( - args[0] - == security_center_management.GetEffectiveSecurityHealthAnalyticsCustomModuleRequest( - name="name_value", - ) + request_msg = security_center_management.GetEffectiveSecurityHealthAnalyticsCustomModuleRequest( + name="name_value", ) + assert args[0] == request_msg def test_get_effective_security_health_analytics_custom_module_use_cached_wrapped_rpc(): @@ -2148,9 +2159,15 @@ async def test_get_effective_security_health_analytics_custom_module_async_use_c @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + security_center_management.GetEffectiveSecurityHealthAnalyticsCustomModuleRequest(), + {}, + ], +) async def test_get_effective_security_health_analytics_custom_module_async( - transport: str = "grpc_asyncio", - request_type=security_center_management.GetEffectiveSecurityHealthAnalyticsCustomModuleRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterManagementAsyncClient( credentials=async_anonymous_credentials(), @@ -2159,7 +2176,7 @@ async def test_get_effective_security_health_analytics_custom_module_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( @@ -2197,13 +2214,6 @@ async def test_get_effective_security_health_analytics_custom_module_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_get_effective_security_health_analytics_custom_module_async_from_dict(): - await test_get_effective_security_health_analytics_custom_module_async( - request_type=dict - ) - - def test_get_effective_security_health_analytics_custom_module_field_headers(): client = SecurityCenterManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2368,8 +2378,8 @@ async def test_get_effective_security_health_analytics_custom_module_flattened_e @pytest.mark.parametrize( "request_type", [ - security_center_management.ListSecurityHealthAnalyticsCustomModulesRequest, - dict, + security_center_management.ListSecurityHealthAnalyticsCustomModulesRequest(), + {}, ], ) def test_list_security_health_analytics_custom_modules( @@ -2382,7 +2392,7 @@ def test_list_security_health_analytics_custom_modules( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2437,12 +2447,13 @@ def test_list_security_health_analytics_custom_modules_non_empty_request_with_au client.list_security_health_analytics_custom_modules(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == security_center_management.ListSecurityHealthAnalyticsCustomModulesRequest( - parent="parent_value", - page_token="page_token_value", + request_msg = ( + security_center_management.ListSecurityHealthAnalyticsCustomModulesRequest( + parent="parent_value", + page_token="page_token_value", + ) ) + assert args[0] == request_msg def test_list_security_health_analytics_custom_modules_use_cached_wrapped_rpc(): @@ -2528,9 +2539,15 @@ async def test_list_security_health_analytics_custom_modules_async_use_cached_wr @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + security_center_management.ListSecurityHealthAnalyticsCustomModulesRequest(), + {}, + ], +) async def test_list_security_health_analytics_custom_modules_async( - transport: str = "grpc_asyncio", - request_type=security_center_management.ListSecurityHealthAnalyticsCustomModulesRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterManagementAsyncClient( credentials=async_anonymous_credentials(), @@ -2539,7 +2556,7 @@ async def test_list_security_health_analytics_custom_modules_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( @@ -2568,11 +2585,6 @@ async def test_list_security_health_analytics_custom_modules_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_security_health_analytics_custom_modules_async_from_dict(): - await test_list_security_health_analytics_custom_modules_async(request_type=dict) - - def test_list_security_health_analytics_custom_modules_field_headers(): client = SecurityCenterManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2949,8 +2961,8 @@ async def test_list_security_health_analytics_custom_modules_async_pages(): @pytest.mark.parametrize( "request_type", [ - security_center_management.ListDescendantSecurityHealthAnalyticsCustomModulesRequest, - dict, + security_center_management.ListDescendantSecurityHealthAnalyticsCustomModulesRequest(), + {}, ], ) def test_list_descendant_security_health_analytics_custom_modules( @@ -2963,7 +2975,7 @@ def test_list_descendant_security_health_analytics_custom_modules( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3018,13 +3030,11 @@ def test_list_descendant_security_health_analytics_custom_modules_non_empty_requ client.list_descendant_security_health_analytics_custom_modules(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert ( - args[0] - == security_center_management.ListDescendantSecurityHealthAnalyticsCustomModulesRequest( - parent="parent_value", - page_token="page_token_value", - ) + request_msg = security_center_management.ListDescendantSecurityHealthAnalyticsCustomModulesRequest( + parent="parent_value", + page_token="page_token_value", ) + assert args[0] == request_msg def test_list_descendant_security_health_analytics_custom_modules_use_cached_wrapped_rpc(): @@ -3110,9 +3120,15 @@ async def test_list_descendant_security_health_analytics_custom_modules_async_us @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + security_center_management.ListDescendantSecurityHealthAnalyticsCustomModulesRequest(), + {}, + ], +) async def test_list_descendant_security_health_analytics_custom_modules_async( - transport: str = "grpc_asyncio", - request_type=security_center_management.ListDescendantSecurityHealthAnalyticsCustomModulesRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterManagementAsyncClient( credentials=async_anonymous_credentials(), @@ -3121,7 +3137,7 @@ async def test_list_descendant_security_health_analytics_custom_modules_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( @@ -3153,13 +3169,6 @@ async def test_list_descendant_security_health_analytics_custom_modules_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_descendant_security_health_analytics_custom_modules_async_from_dict(): - await test_list_descendant_security_health_analytics_custom_modules_async( - request_type=dict - ) - - def test_list_descendant_security_health_analytics_custom_modules_field_headers(): client = SecurityCenterManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3546,8 +3555,8 @@ async def test_list_descendant_security_health_analytics_custom_modules_async_pa @pytest.mark.parametrize( "request_type", [ - security_center_management.GetSecurityHealthAnalyticsCustomModuleRequest, - dict, + security_center_management.GetSecurityHealthAnalyticsCustomModuleRequest(), + {}, ], ) def test_get_security_health_analytics_custom_module( @@ -3560,7 +3569,7 @@ def test_get_security_health_analytics_custom_module( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3623,11 +3632,12 @@ def test_get_security_health_analytics_custom_module_non_empty_request_with_auto client.get_security_health_analytics_custom_module(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == security_center_management.GetSecurityHealthAnalyticsCustomModuleRequest( - name="name_value", + request_msg = ( + security_center_management.GetSecurityHealthAnalyticsCustomModuleRequest( + name="name_value", + ) ) + assert args[0] == request_msg def test_get_security_health_analytics_custom_module_use_cached_wrapped_rpc(): @@ -3713,9 +3723,15 @@ async def test_get_security_health_analytics_custom_module_async_use_cached_wrap @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + security_center_management.GetSecurityHealthAnalyticsCustomModuleRequest(), + {}, + ], +) async def test_get_security_health_analytics_custom_module_async( - transport: str = "grpc_asyncio", - request_type=security_center_management.GetSecurityHealthAnalyticsCustomModuleRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterManagementAsyncClient( credentials=async_anonymous_credentials(), @@ -3724,7 +3740,7 @@ async def test_get_security_health_analytics_custom_module_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( @@ -3764,11 +3780,6 @@ async def test_get_security_health_analytics_custom_module_async( assert response.ancestor_module == "ancestor_module_value" -@pytest.mark.asyncio -async def test_get_security_health_analytics_custom_module_async_from_dict(): - await test_get_security_health_analytics_custom_module_async(request_type=dict) - - def test_get_security_health_analytics_custom_module_field_headers(): client = SecurityCenterManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3929,8 +3940,8 @@ async def test_get_security_health_analytics_custom_module_flattened_error_async @pytest.mark.parametrize( "request_type", [ - security_center_management.CreateSecurityHealthAnalyticsCustomModuleRequest, - dict, + security_center_management.CreateSecurityHealthAnalyticsCustomModuleRequest(), + {}, ], ) def test_create_security_health_analytics_custom_module( @@ -3943,7 +3954,7 @@ def test_create_security_health_analytics_custom_module( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4008,12 +4019,12 @@ def test_create_security_health_analytics_custom_module_non_empty_request_with_a client.create_security_health_analytics_custom_module(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert ( - args[0] - == security_center_management.CreateSecurityHealthAnalyticsCustomModuleRequest( + request_msg = ( + security_center_management.CreateSecurityHealthAnalyticsCustomModuleRequest( parent="parent_value", ) ) + assert args[0] == request_msg def test_create_security_health_analytics_custom_module_use_cached_wrapped_rpc(): @@ -4099,9 +4110,15 @@ async def test_create_security_health_analytics_custom_module_async_use_cached_w @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + security_center_management.CreateSecurityHealthAnalyticsCustomModuleRequest(), + {}, + ], +) async def test_create_security_health_analytics_custom_module_async( - transport: str = "grpc_asyncio", - request_type=security_center_management.CreateSecurityHealthAnalyticsCustomModuleRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterManagementAsyncClient( credentials=async_anonymous_credentials(), @@ -4110,7 +4127,7 @@ async def test_create_security_health_analytics_custom_module_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( @@ -4149,11 +4166,6 @@ async def test_create_security_health_analytics_custom_module_async( assert response.ancestor_module == "ancestor_module_value" -@pytest.mark.asyncio -async def test_create_security_health_analytics_custom_module_async_from_dict(): - await test_create_security_health_analytics_custom_module_async(request_type=dict) - - def test_create_security_health_analytics_custom_module_field_headers(): client = SecurityCenterManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4344,8 +4356,8 @@ async def test_create_security_health_analytics_custom_module_flattened_error_as @pytest.mark.parametrize( "request_type", [ - security_center_management.UpdateSecurityHealthAnalyticsCustomModuleRequest, - dict, + security_center_management.UpdateSecurityHealthAnalyticsCustomModuleRequest(), + {}, ], ) def test_update_security_health_analytics_custom_module( @@ -4358,7 +4370,7 @@ def test_update_security_health_analytics_custom_module( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4421,10 +4433,8 @@ def test_update_security_health_analytics_custom_module_non_empty_request_with_a client.update_security_health_analytics_custom_module(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert ( - args[0] - == security_center_management.UpdateSecurityHealthAnalyticsCustomModuleRequest() - ) + request_msg = security_center_management.UpdateSecurityHealthAnalyticsCustomModuleRequest() + assert args[0] == request_msg def test_update_security_health_analytics_custom_module_use_cached_wrapped_rpc(): @@ -4510,9 +4520,15 @@ async def test_update_security_health_analytics_custom_module_async_use_cached_w @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + security_center_management.UpdateSecurityHealthAnalyticsCustomModuleRequest(), + {}, + ], +) async def test_update_security_health_analytics_custom_module_async( - transport: str = "grpc_asyncio", - request_type=security_center_management.UpdateSecurityHealthAnalyticsCustomModuleRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterManagementAsyncClient( credentials=async_anonymous_credentials(), @@ -4521,7 +4537,7 @@ async def test_update_security_health_analytics_custom_module_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( @@ -4560,11 +4576,6 @@ async def test_update_security_health_analytics_custom_module_async( assert response.ancestor_module == "ancestor_module_value" -@pytest.mark.asyncio -async def test_update_security_health_analytics_custom_module_async_from_dict(): - await test_update_security_health_analytics_custom_module_async(request_type=dict) - - def test_update_security_health_analytics_custom_module_field_headers(): client = SecurityCenterManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4755,8 +4766,8 @@ async def test_update_security_health_analytics_custom_module_flattened_error_as @pytest.mark.parametrize( "request_type", [ - security_center_management.DeleteSecurityHealthAnalyticsCustomModuleRequest, - dict, + security_center_management.DeleteSecurityHealthAnalyticsCustomModuleRequest(), + {}, ], ) def test_delete_security_health_analytics_custom_module( @@ -4769,7 +4780,7 @@ def test_delete_security_health_analytics_custom_module( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4818,12 +4829,12 @@ def test_delete_security_health_analytics_custom_module_non_empty_request_with_a client.delete_security_health_analytics_custom_module(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert ( - args[0] - == security_center_management.DeleteSecurityHealthAnalyticsCustomModuleRequest( + request_msg = ( + security_center_management.DeleteSecurityHealthAnalyticsCustomModuleRequest( name="name_value", ) ) + assert args[0] == request_msg def test_delete_security_health_analytics_custom_module_use_cached_wrapped_rpc(): @@ -4909,9 +4920,15 @@ async def test_delete_security_health_analytics_custom_module_async_use_cached_w @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + security_center_management.DeleteSecurityHealthAnalyticsCustomModuleRequest(), + {}, + ], +) async def test_delete_security_health_analytics_custom_module_async( - transport: str = "grpc_asyncio", - request_type=security_center_management.DeleteSecurityHealthAnalyticsCustomModuleRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterManagementAsyncClient( credentials=async_anonymous_credentials(), @@ -4920,7 +4937,7 @@ async def test_delete_security_health_analytics_custom_module_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( @@ -4941,11 +4958,6 @@ async def test_delete_security_health_analytics_custom_module_async( assert response is None -@pytest.mark.asyncio -async def test_delete_security_health_analytics_custom_module_async_from_dict(): - await test_delete_security_health_analytics_custom_module_async(request_type=dict) - - def test_delete_security_health_analytics_custom_module_field_headers(): client = SecurityCenterManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5104,8 +5116,8 @@ async def test_delete_security_health_analytics_custom_module_flattened_error_as @pytest.mark.parametrize( "request_type", [ - security_center_management.SimulateSecurityHealthAnalyticsCustomModuleRequest, - dict, + security_center_management.SimulateSecurityHealthAnalyticsCustomModuleRequest(), + {}, ], ) def test_simulate_security_health_analytics_custom_module( @@ -5118,7 +5130,7 @@ def test_simulate_security_health_analytics_custom_module( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5170,12 +5182,10 @@ def test_simulate_security_health_analytics_custom_module_non_empty_request_with client.simulate_security_health_analytics_custom_module(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert ( - args[0] - == security_center_management.SimulateSecurityHealthAnalyticsCustomModuleRequest( - parent="parent_value", - ) + request_msg = security_center_management.SimulateSecurityHealthAnalyticsCustomModuleRequest( + parent="parent_value", ) + assert args[0] == request_msg def test_simulate_security_health_analytics_custom_module_use_cached_wrapped_rpc(): @@ -5261,9 +5271,15 @@ async def test_simulate_security_health_analytics_custom_module_async_use_cached @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + security_center_management.SimulateSecurityHealthAnalyticsCustomModuleRequest(), + {}, + ], +) async def test_simulate_security_health_analytics_custom_module_async( - transport: str = "grpc_asyncio", - request_type=security_center_management.SimulateSecurityHealthAnalyticsCustomModuleRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterManagementAsyncClient( credentials=async_anonymous_credentials(), @@ -5272,7 +5288,7 @@ async def test_simulate_security_health_analytics_custom_module_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( @@ -5300,11 +5316,6 @@ async def test_simulate_security_health_analytics_custom_module_async( ) -@pytest.mark.asyncio -async def test_simulate_security_health_analytics_custom_module_async_from_dict(): - await test_simulate_security_health_analytics_custom_module_async(request_type=dict) - - def test_simulate_security_health_analytics_custom_module_field_headers(): client = SecurityCenterManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5511,8 +5522,8 @@ async def test_simulate_security_health_analytics_custom_module_flattened_error_ @pytest.mark.parametrize( "request_type", [ - security_center_management.ListEffectiveEventThreatDetectionCustomModulesRequest, - dict, + security_center_management.ListEffectiveEventThreatDetectionCustomModulesRequest(), + {}, ], ) def test_list_effective_event_threat_detection_custom_modules( @@ -5525,7 +5536,7 @@ def test_list_effective_event_threat_detection_custom_modules( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5578,13 +5589,11 @@ def test_list_effective_event_threat_detection_custom_modules_non_empty_request_ client.list_effective_event_threat_detection_custom_modules(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert ( - args[0] - == security_center_management.ListEffectiveEventThreatDetectionCustomModulesRequest( - parent="parent_value", - page_token="page_token_value", - ) + request_msg = security_center_management.ListEffectiveEventThreatDetectionCustomModulesRequest( + parent="parent_value", + page_token="page_token_value", ) + assert args[0] == request_msg def test_list_effective_event_threat_detection_custom_modules_use_cached_wrapped_rpc(): @@ -5670,9 +5679,15 @@ async def test_list_effective_event_threat_detection_custom_modules_async_use_ca @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + security_center_management.ListEffectiveEventThreatDetectionCustomModulesRequest(), + {}, + ], +) async def test_list_effective_event_threat_detection_custom_modules_async( - transport: str = "grpc_asyncio", - request_type=security_center_management.ListEffectiveEventThreatDetectionCustomModulesRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterManagementAsyncClient( credentials=async_anonymous_credentials(), @@ -5681,7 +5696,7 @@ async def test_list_effective_event_threat_detection_custom_modules_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( @@ -5711,13 +5726,6 @@ async def test_list_effective_event_threat_detection_custom_modules_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_effective_event_threat_detection_custom_modules_async_from_dict(): - await test_list_effective_event_threat_detection_custom_modules_async( - request_type=dict - ) - - def test_list_effective_event_threat_detection_custom_modules_field_headers(): client = SecurityCenterManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6100,8 +6108,8 @@ async def test_list_effective_event_threat_detection_custom_modules_async_pages( @pytest.mark.parametrize( "request_type", [ - security_center_management.GetEffectiveEventThreatDetectionCustomModuleRequest, - dict, + security_center_management.GetEffectiveEventThreatDetectionCustomModuleRequest(), + {}, ], ) def test_get_effective_event_threat_detection_custom_module( @@ -6114,7 +6122,7 @@ def test_get_effective_event_threat_detection_custom_module( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6179,12 +6187,10 @@ def test_get_effective_event_threat_detection_custom_module_non_empty_request_wi client.get_effective_event_threat_detection_custom_module(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert ( - args[0] - == security_center_management.GetEffectiveEventThreatDetectionCustomModuleRequest( - name="name_value", - ) + request_msg = security_center_management.GetEffectiveEventThreatDetectionCustomModuleRequest( + name="name_value", ) + assert args[0] == request_msg def test_get_effective_event_threat_detection_custom_module_use_cached_wrapped_rpc(): @@ -6270,9 +6276,15 @@ async def test_get_effective_event_threat_detection_custom_module_async_use_cach @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + security_center_management.GetEffectiveEventThreatDetectionCustomModuleRequest(), + {}, + ], +) async def test_get_effective_event_threat_detection_custom_module_async( - transport: str = "grpc_asyncio", - request_type=security_center_management.GetEffectiveEventThreatDetectionCustomModuleRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterManagementAsyncClient( credentials=async_anonymous_credentials(), @@ -6281,7 +6293,7 @@ async def test_get_effective_event_threat_detection_custom_module_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( @@ -6322,13 +6334,6 @@ async def test_get_effective_event_threat_detection_custom_module_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_get_effective_event_threat_detection_custom_module_async_from_dict(): - await test_get_effective_event_threat_detection_custom_module_async( - request_type=dict - ) - - def test_get_effective_event_threat_detection_custom_module_field_headers(): client = SecurityCenterManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6497,8 +6502,8 @@ async def test_get_effective_event_threat_detection_custom_module_flattened_erro @pytest.mark.parametrize( "request_type", [ - security_center_management.ListEventThreatDetectionCustomModulesRequest, - dict, + security_center_management.ListEventThreatDetectionCustomModulesRequest(), + {}, ], ) def test_list_event_threat_detection_custom_modules( @@ -6511,7 +6516,7 @@ def test_list_event_threat_detection_custom_modules( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6564,12 +6569,13 @@ def test_list_event_threat_detection_custom_modules_non_empty_request_with_auto_ client.list_event_threat_detection_custom_modules(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == security_center_management.ListEventThreatDetectionCustomModulesRequest( - parent="parent_value", - page_token="page_token_value", + request_msg = ( + security_center_management.ListEventThreatDetectionCustomModulesRequest( + parent="parent_value", + page_token="page_token_value", + ) ) + assert args[0] == request_msg def test_list_event_threat_detection_custom_modules_use_cached_wrapped_rpc(): @@ -6655,9 +6661,15 @@ async def test_list_event_threat_detection_custom_modules_async_use_cached_wrapp @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + security_center_management.ListEventThreatDetectionCustomModulesRequest(), + {}, + ], +) async def test_list_event_threat_detection_custom_modules_async( - transport: str = "grpc_asyncio", - request_type=security_center_management.ListEventThreatDetectionCustomModulesRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterManagementAsyncClient( credentials=async_anonymous_credentials(), @@ -6666,7 +6678,7 @@ async def test_list_event_threat_detection_custom_modules_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( @@ -6693,11 +6705,6 @@ async def test_list_event_threat_detection_custom_modules_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_event_threat_detection_custom_modules_async_from_dict(): - await test_list_event_threat_detection_custom_modules_async(request_type=dict) - - def test_list_event_threat_detection_custom_modules_field_headers(): client = SecurityCenterManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7068,8 +7075,8 @@ async def test_list_event_threat_detection_custom_modules_async_pages(): @pytest.mark.parametrize( "request_type", [ - security_center_management.ListDescendantEventThreatDetectionCustomModulesRequest, - dict, + security_center_management.ListDescendantEventThreatDetectionCustomModulesRequest(), + {}, ], ) def test_list_descendant_event_threat_detection_custom_modules( @@ -7082,7 +7089,7 @@ def test_list_descendant_event_threat_detection_custom_modules( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7135,13 +7142,11 @@ def test_list_descendant_event_threat_detection_custom_modules_non_empty_request client.list_descendant_event_threat_detection_custom_modules(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert ( - args[0] - == security_center_management.ListDescendantEventThreatDetectionCustomModulesRequest( - parent="parent_value", - page_token="page_token_value", - ) + request_msg = security_center_management.ListDescendantEventThreatDetectionCustomModulesRequest( + parent="parent_value", + page_token="page_token_value", ) + assert args[0] == request_msg def test_list_descendant_event_threat_detection_custom_modules_use_cached_wrapped_rpc(): @@ -7227,9 +7232,15 @@ async def test_list_descendant_event_threat_detection_custom_modules_async_use_c @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + security_center_management.ListDescendantEventThreatDetectionCustomModulesRequest(), + {}, + ], +) async def test_list_descendant_event_threat_detection_custom_modules_async( - transport: str = "grpc_asyncio", - request_type=security_center_management.ListDescendantEventThreatDetectionCustomModulesRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterManagementAsyncClient( credentials=async_anonymous_credentials(), @@ -7238,7 +7249,7 @@ async def test_list_descendant_event_threat_detection_custom_modules_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( @@ -7268,13 +7279,6 @@ async def test_list_descendant_event_threat_detection_custom_modules_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_descendant_event_threat_detection_custom_modules_async_from_dict(): - await test_list_descendant_event_threat_detection_custom_modules_async( - request_type=dict - ) - - def test_list_descendant_event_threat_detection_custom_modules_field_headers(): client = SecurityCenterManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7655,8 +7659,8 @@ async def test_list_descendant_event_threat_detection_custom_modules_async_pages @pytest.mark.parametrize( "request_type", [ - security_center_management.GetEventThreatDetectionCustomModuleRequest, - dict, + security_center_management.GetEventThreatDetectionCustomModuleRequest(), + {}, ], ) def test_get_event_threat_detection_custom_module( @@ -7669,7 +7673,7 @@ def test_get_event_threat_detection_custom_module( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7736,11 +7740,12 @@ def test_get_event_threat_detection_custom_module_non_empty_request_with_auto_po client.get_event_threat_detection_custom_module(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == security_center_management.GetEventThreatDetectionCustomModuleRequest( - name="name_value", + request_msg = ( + security_center_management.GetEventThreatDetectionCustomModuleRequest( + name="name_value", + ) ) + assert args[0] == request_msg def test_get_event_threat_detection_custom_module_use_cached_wrapped_rpc(): @@ -7826,9 +7831,15 @@ async def test_get_event_threat_detection_custom_module_async_use_cached_wrapped @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + security_center_management.GetEventThreatDetectionCustomModuleRequest(), + {}, + ], +) async def test_get_event_threat_detection_custom_module_async( - transport: str = "grpc_asyncio", - request_type=security_center_management.GetEventThreatDetectionCustomModuleRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterManagementAsyncClient( credentials=async_anonymous_credentials(), @@ -7837,7 +7848,7 @@ async def test_get_event_threat_detection_custom_module_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( @@ -7881,11 +7892,6 @@ async def test_get_event_threat_detection_custom_module_async( assert response.last_editor == "last_editor_value" -@pytest.mark.asyncio -async def test_get_event_threat_detection_custom_module_async_from_dict(): - await test_get_event_threat_detection_custom_module_async(request_type=dict) - - def test_get_event_threat_detection_custom_module_field_headers(): client = SecurityCenterManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8046,8 +8052,8 @@ async def test_get_event_threat_detection_custom_module_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - security_center_management.CreateEventThreatDetectionCustomModuleRequest, - dict, + security_center_management.CreateEventThreatDetectionCustomModuleRequest(), + {}, ], ) def test_create_event_threat_detection_custom_module( @@ -8060,7 +8066,7 @@ def test_create_event_threat_detection_custom_module( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8127,11 +8133,12 @@ def test_create_event_threat_detection_custom_module_non_empty_request_with_auto client.create_event_threat_detection_custom_module(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == security_center_management.CreateEventThreatDetectionCustomModuleRequest( - parent="parent_value", + request_msg = ( + security_center_management.CreateEventThreatDetectionCustomModuleRequest( + parent="parent_value", + ) ) + assert args[0] == request_msg def test_create_event_threat_detection_custom_module_use_cached_wrapped_rpc(): @@ -8217,9 +8224,15 @@ async def test_create_event_threat_detection_custom_module_async_use_cached_wrap @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + security_center_management.CreateEventThreatDetectionCustomModuleRequest(), + {}, + ], +) async def test_create_event_threat_detection_custom_module_async( - transport: str = "grpc_asyncio", - request_type=security_center_management.CreateEventThreatDetectionCustomModuleRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterManagementAsyncClient( credentials=async_anonymous_credentials(), @@ -8228,7 +8241,7 @@ async def test_create_event_threat_detection_custom_module_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( @@ -8272,11 +8285,6 @@ async def test_create_event_threat_detection_custom_module_async( assert response.last_editor == "last_editor_value" -@pytest.mark.asyncio -async def test_create_event_threat_detection_custom_module_async_from_dict(): - await test_create_event_threat_detection_custom_module_async(request_type=dict) - - def test_create_event_threat_detection_custom_module_field_headers(): client = SecurityCenterManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8459,8 +8467,8 @@ async def test_create_event_threat_detection_custom_module_flattened_error_async @pytest.mark.parametrize( "request_type", [ - security_center_management.UpdateEventThreatDetectionCustomModuleRequest, - dict, + security_center_management.UpdateEventThreatDetectionCustomModuleRequest(), + {}, ], ) def test_update_event_threat_detection_custom_module( @@ -8473,7 +8481,7 @@ def test_update_event_threat_detection_custom_module( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8538,10 +8546,10 @@ def test_update_event_threat_detection_custom_module_non_empty_request_with_auto client.update_event_threat_detection_custom_module(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert ( - args[0] - == security_center_management.UpdateEventThreatDetectionCustomModuleRequest() + request_msg = ( + security_center_management.UpdateEventThreatDetectionCustomModuleRequest() ) + assert args[0] == request_msg def test_update_event_threat_detection_custom_module_use_cached_wrapped_rpc(): @@ -8627,9 +8635,15 @@ async def test_update_event_threat_detection_custom_module_async_use_cached_wrap @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + security_center_management.UpdateEventThreatDetectionCustomModuleRequest(), + {}, + ], +) async def test_update_event_threat_detection_custom_module_async( - transport: str = "grpc_asyncio", - request_type=security_center_management.UpdateEventThreatDetectionCustomModuleRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterManagementAsyncClient( credentials=async_anonymous_credentials(), @@ -8638,7 +8652,7 @@ async def test_update_event_threat_detection_custom_module_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( @@ -8682,11 +8696,6 @@ async def test_update_event_threat_detection_custom_module_async( assert response.last_editor == "last_editor_value" -@pytest.mark.asyncio -async def test_update_event_threat_detection_custom_module_async_from_dict(): - await test_update_event_threat_detection_custom_module_async(request_type=dict) - - def test_update_event_threat_detection_custom_module_field_headers(): client = SecurityCenterManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8869,8 +8878,8 @@ async def test_update_event_threat_detection_custom_module_flattened_error_async @pytest.mark.parametrize( "request_type", [ - security_center_management.DeleteEventThreatDetectionCustomModuleRequest, - dict, + security_center_management.DeleteEventThreatDetectionCustomModuleRequest(), + {}, ], ) def test_delete_event_threat_detection_custom_module( @@ -8883,7 +8892,7 @@ def test_delete_event_threat_detection_custom_module( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8930,11 +8939,12 @@ def test_delete_event_threat_detection_custom_module_non_empty_request_with_auto client.delete_event_threat_detection_custom_module(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == security_center_management.DeleteEventThreatDetectionCustomModuleRequest( - name="name_value", + request_msg = ( + security_center_management.DeleteEventThreatDetectionCustomModuleRequest( + name="name_value", + ) ) + assert args[0] == request_msg def test_delete_event_threat_detection_custom_module_use_cached_wrapped_rpc(): @@ -9020,9 +9030,15 @@ async def test_delete_event_threat_detection_custom_module_async_use_cached_wrap @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + security_center_management.DeleteEventThreatDetectionCustomModuleRequest(), + {}, + ], +) async def test_delete_event_threat_detection_custom_module_async( - transport: str = "grpc_asyncio", - request_type=security_center_management.DeleteEventThreatDetectionCustomModuleRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterManagementAsyncClient( credentials=async_anonymous_credentials(), @@ -9031,7 +9047,7 @@ async def test_delete_event_threat_detection_custom_module_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( @@ -9053,11 +9069,6 @@ async def test_delete_event_threat_detection_custom_module_async( assert response is None -@pytest.mark.asyncio -async def test_delete_event_threat_detection_custom_module_async_from_dict(): - await test_delete_event_threat_detection_custom_module_async(request_type=dict) - - def test_delete_event_threat_detection_custom_module_field_headers(): client = SecurityCenterManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9208,8 +9219,8 @@ async def test_delete_event_threat_detection_custom_module_flattened_error_async @pytest.mark.parametrize( "request_type", [ - security_center_management.ValidateEventThreatDetectionCustomModuleRequest, - dict, + security_center_management.ValidateEventThreatDetectionCustomModuleRequest(), + {}, ], ) def test_validate_event_threat_detection_custom_module( @@ -9222,7 +9233,7 @@ def test_validate_event_threat_detection_custom_module( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9276,13 +9287,14 @@ def test_validate_event_threat_detection_custom_module_non_empty_request_with_au client.validate_event_threat_detection_custom_module(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == security_center_management.ValidateEventThreatDetectionCustomModuleRequest( - parent="parent_value", - raw_text="raw_text_value", - type_="type__value", + request_msg = ( + security_center_management.ValidateEventThreatDetectionCustomModuleRequest( + parent="parent_value", + raw_text="raw_text_value", + type_="type__value", + ) ) + assert args[0] == request_msg def test_validate_event_threat_detection_custom_module_use_cached_wrapped_rpc(): @@ -9368,9 +9380,15 @@ async def test_validate_event_threat_detection_custom_module_async_use_cached_wr @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + security_center_management.ValidateEventThreatDetectionCustomModuleRequest(), + {}, + ], +) async def test_validate_event_threat_detection_custom_module_async( - transport: str = "grpc_asyncio", - request_type=security_center_management.ValidateEventThreatDetectionCustomModuleRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterManagementAsyncClient( credentials=async_anonymous_credentials(), @@ -9379,7 +9397,7 @@ async def test_validate_event_threat_detection_custom_module_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( @@ -9406,11 +9424,6 @@ async def test_validate_event_threat_detection_custom_module_async( ) -@pytest.mark.asyncio -async def test_validate_event_threat_detection_custom_module_async_from_dict(): - await test_validate_event_threat_detection_custom_module_async(request_type=dict) - - def test_validate_event_threat_detection_custom_module_field_headers(): client = SecurityCenterManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9483,8 +9496,8 @@ async def test_validate_event_threat_detection_custom_module_field_headers_async @pytest.mark.parametrize( "request_type", [ - security_center_management.GetSecurityCenterServiceRequest, - dict, + security_center_management.GetSecurityCenterServiceRequest(), + {}, ], ) def test_get_security_center_service(request_type, transport: str = "grpc"): @@ -9495,7 +9508,7 @@ def test_get_security_center_service(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9553,9 +9566,10 @@ def test_get_security_center_service_non_empty_request_with_auto_populated_field client.get_security_center_service(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == security_center_management.GetSecurityCenterServiceRequest( + request_msg = security_center_management.GetSecurityCenterServiceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_security_center_service_use_cached_wrapped_rpc(): @@ -9641,9 +9655,15 @@ async def test_get_security_center_service_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + security_center_management.GetSecurityCenterServiceRequest(), + {}, + ], +) async def test_get_security_center_service_async( - transport: str = "grpc_asyncio", - request_type=security_center_management.GetSecurityCenterServiceRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterManagementAsyncClient( credentials=async_anonymous_credentials(), @@ -9652,7 +9672,7 @@ async def test_get_security_center_service_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( @@ -9687,11 +9707,6 @@ async def test_get_security_center_service_async( ) -@pytest.mark.asyncio -async def test_get_security_center_service_async_from_dict(): - await test_get_security_center_service_async(request_type=dict) - - def test_get_security_center_service_field_headers(): client = SecurityCenterManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9846,8 +9861,8 @@ async def test_get_security_center_service_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - security_center_management.ListSecurityCenterServicesRequest, - dict, + security_center_management.ListSecurityCenterServicesRequest(), + {}, ], ) def test_list_security_center_services(request_type, transport: str = "grpc"): @@ -9858,7 +9873,7 @@ def test_list_security_center_services(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9909,10 +9924,11 @@ def test_list_security_center_services_non_empty_request_with_auto_populated_fie client.list_security_center_services(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == security_center_management.ListSecurityCenterServicesRequest( + request_msg = security_center_management.ListSecurityCenterServicesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_security_center_services_use_cached_wrapped_rpc(): @@ -9998,9 +10014,15 @@ async def test_list_security_center_services_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + security_center_management.ListSecurityCenterServicesRequest(), + {}, + ], +) async def test_list_security_center_services_async( - transport: str = "grpc_asyncio", - request_type=security_center_management.ListSecurityCenterServicesRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterManagementAsyncClient( credentials=async_anonymous_credentials(), @@ -10009,7 +10031,7 @@ async def test_list_security_center_services_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( @@ -10034,11 +10056,6 @@ async def test_list_security_center_services_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_security_center_services_async_from_dict(): - await test_list_security_center_services_async(request_type=dict) - - def test_list_security_center_services_field_headers(): client = SecurityCenterManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10407,8 +10424,8 @@ async def test_list_security_center_services_async_pages(): @pytest.mark.parametrize( "request_type", [ - security_center_management.UpdateSecurityCenterServiceRequest, - dict, + security_center_management.UpdateSecurityCenterServiceRequest(), + {}, ], ) def test_update_security_center_service(request_type, transport: str = "grpc"): @@ -10419,7 +10436,7 @@ def test_update_security_center_service(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10475,9 +10492,8 @@ def test_update_security_center_service_non_empty_request_with_auto_populated_fi client.update_security_center_service(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert ( - args[0] == security_center_management.UpdateSecurityCenterServiceRequest() - ) + request_msg = security_center_management.UpdateSecurityCenterServiceRequest() + assert args[0] == request_msg def test_update_security_center_service_use_cached_wrapped_rpc(): @@ -10563,9 +10579,15 @@ async def test_update_security_center_service_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + security_center_management.UpdateSecurityCenterServiceRequest(), + {}, + ], +) async def test_update_security_center_service_async( - transport: str = "grpc_asyncio", - request_type=security_center_management.UpdateSecurityCenterServiceRequest, + request_type, transport: str = "grpc_asyncio" ): client = SecurityCenterManagementAsyncClient( credentials=async_anonymous_credentials(), @@ -10574,7 +10596,7 @@ async def test_update_security_center_service_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( @@ -10609,11 +10631,6 @@ async def test_update_security_center_service_async( ) -@pytest.mark.asyncio -async def test_update_security_center_service_async_from_dict(): - await test_update_security_center_service_async(request_type=dict) - - def test_update_security_center_service_field_headers(): client = SecurityCenterManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15777,7 +15794,6 @@ def test_list_effective_security_health_analytics_custom_modules_empty_call_grpc call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_center_management.ListEffectiveSecurityHealthAnalyticsCustomModulesRequest() - assert args[0] == request_msg @@ -15803,7 +15819,6 @@ def test_get_effective_security_health_analytics_custom_module_empty_call_grpc() call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_center_management.GetEffectiveSecurityHealthAnalyticsCustomModuleRequest() - assert args[0] == request_msg @@ -15828,7 +15843,6 @@ def test_list_security_health_analytics_custom_modules_empty_call_grpc(): request_msg = ( security_center_management.ListSecurityHealthAnalyticsCustomModulesRequest() ) - assert args[0] == request_msg @@ -15852,7 +15866,6 @@ def test_list_descendant_security_health_analytics_custom_modules_empty_call_grp call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_center_management.ListDescendantSecurityHealthAnalyticsCustomModulesRequest() - assert args[0] == request_msg @@ -15879,7 +15892,6 @@ def test_get_security_health_analytics_custom_module_empty_call_grpc(): request_msg = ( security_center_management.GetSecurityHealthAnalyticsCustomModuleRequest() ) - assert args[0] == request_msg @@ -15905,7 +15917,6 @@ def test_create_security_health_analytics_custom_module_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_center_management.CreateSecurityHealthAnalyticsCustomModuleRequest() - assert args[0] == request_msg @@ -15931,7 +15942,6 @@ def test_update_security_health_analytics_custom_module_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_center_management.UpdateSecurityHealthAnalyticsCustomModuleRequest() - assert args[0] == request_msg @@ -15955,7 +15965,6 @@ def test_delete_security_health_analytics_custom_module_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_center_management.DeleteSecurityHealthAnalyticsCustomModuleRequest() - assert args[0] == request_msg @@ -15979,7 +15988,6 @@ def test_simulate_security_health_analytics_custom_module_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_center_management.SimulateSecurityHealthAnalyticsCustomModuleRequest() - assert args[0] == request_msg @@ -16003,7 +16011,6 @@ def test_list_effective_event_threat_detection_custom_modules_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_center_management.ListEffectiveEventThreatDetectionCustomModulesRequest() - assert args[0] == request_msg @@ -16029,7 +16036,6 @@ def test_get_effective_event_threat_detection_custom_module_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_center_management.GetEffectiveEventThreatDetectionCustomModuleRequest() - assert args[0] == request_msg @@ -16056,7 +16062,6 @@ def test_list_event_threat_detection_custom_modules_empty_call_grpc(): request_msg = ( security_center_management.ListEventThreatDetectionCustomModulesRequest() ) - assert args[0] == request_msg @@ -16080,7 +16085,6 @@ def test_list_descendant_event_threat_detection_custom_modules_empty_call_grpc() call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_center_management.ListDescendantEventThreatDetectionCustomModulesRequest() - assert args[0] == request_msg @@ -16107,7 +16111,6 @@ def test_get_event_threat_detection_custom_module_empty_call_grpc(): request_msg = ( security_center_management.GetEventThreatDetectionCustomModuleRequest() ) - assert args[0] == request_msg @@ -16134,7 +16137,6 @@ def test_create_event_threat_detection_custom_module_empty_call_grpc(): request_msg = ( security_center_management.CreateEventThreatDetectionCustomModuleRequest() ) - assert args[0] == request_msg @@ -16161,7 +16163,6 @@ def test_update_event_threat_detection_custom_module_empty_call_grpc(): request_msg = ( security_center_management.UpdateEventThreatDetectionCustomModuleRequest() ) - assert args[0] == request_msg @@ -16186,7 +16187,6 @@ def test_delete_event_threat_detection_custom_module_empty_call_grpc(): request_msg = ( security_center_management.DeleteEventThreatDetectionCustomModuleRequest() ) - assert args[0] == request_msg @@ -16211,7 +16211,6 @@ def test_validate_event_threat_detection_custom_module_empty_call_grpc(): request_msg = ( security_center_management.ValidateEventThreatDetectionCustomModuleRequest() ) - assert args[0] == request_msg @@ -16234,7 +16233,6 @@ def test_get_security_center_service_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_center_management.GetSecurityCenterServiceRequest() - assert args[0] == request_msg @@ -16259,7 +16257,6 @@ def test_list_security_center_services_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_center_management.ListSecurityCenterServicesRequest() - assert args[0] == request_msg @@ -16282,7 +16279,6 @@ def test_update_security_center_service_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_center_management.UpdateSecurityCenterServiceRequest() - assert args[0] == request_msg @@ -16328,7 +16324,6 @@ async def test_list_effective_security_health_analytics_custom_modules_empty_cal call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_center_management.ListEffectiveSecurityHealthAnalyticsCustomModulesRequest() - assert args[0] == request_msg @@ -16360,7 +16355,6 @@ async def test_get_effective_security_health_analytics_custom_module_empty_call_ call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_center_management.GetEffectiveSecurityHealthAnalyticsCustomModuleRequest() - assert args[0] == request_msg @@ -16391,7 +16385,6 @@ async def test_list_security_health_analytics_custom_modules_empty_call_grpc_asy request_msg = ( security_center_management.ListSecurityHealthAnalyticsCustomModulesRequest() ) - assert args[0] == request_msg @@ -16423,7 +16416,6 @@ async def test_list_descendant_security_health_analytics_custom_modules_empty_ca call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_center_management.ListDescendantSecurityHealthAnalyticsCustomModulesRequest() - assert args[0] == request_msg @@ -16458,7 +16450,6 @@ async def test_get_security_health_analytics_custom_module_empty_call_grpc_async request_msg = ( security_center_management.GetSecurityHealthAnalyticsCustomModuleRequest() ) - assert args[0] == request_msg @@ -16492,7 +16483,6 @@ async def test_create_security_health_analytics_custom_module_empty_call_grpc_as call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_center_management.CreateSecurityHealthAnalyticsCustomModuleRequest() - assert args[0] == request_msg @@ -16526,7 +16516,6 @@ async def test_update_security_health_analytics_custom_module_empty_call_grpc_as call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_center_management.UpdateSecurityHealthAnalyticsCustomModuleRequest() - assert args[0] == request_msg @@ -16552,7 +16541,6 @@ async def test_delete_security_health_analytics_custom_module_empty_call_grpc_as call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_center_management.DeleteSecurityHealthAnalyticsCustomModuleRequest() - assert args[0] == request_msg @@ -16580,7 +16568,6 @@ async def test_simulate_security_health_analytics_custom_module_empty_call_grpc_ call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_center_management.SimulateSecurityHealthAnalyticsCustomModuleRequest() - assert args[0] == request_msg @@ -16610,7 +16597,6 @@ async def test_list_effective_event_threat_detection_custom_modules_empty_call_g call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_center_management.ListEffectiveEventThreatDetectionCustomModulesRequest() - assert args[0] == request_msg @@ -16644,7 +16630,6 @@ async def test_get_effective_event_threat_detection_custom_module_empty_call_grp call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_center_management.GetEffectiveEventThreatDetectionCustomModuleRequest() - assert args[0] == request_msg @@ -16675,7 +16660,6 @@ async def test_list_event_threat_detection_custom_modules_empty_call_grpc_asynci request_msg = ( security_center_management.ListEventThreatDetectionCustomModulesRequest() ) - assert args[0] == request_msg @@ -16705,7 +16689,6 @@ async def test_list_descendant_event_threat_detection_custom_modules_empty_call_ call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_center_management.ListDescendantEventThreatDetectionCustomModulesRequest() - assert args[0] == request_msg @@ -16742,7 +16725,6 @@ async def test_get_event_threat_detection_custom_module_empty_call_grpc_asyncio( request_msg = ( security_center_management.GetEventThreatDetectionCustomModuleRequest() ) - assert args[0] == request_msg @@ -16779,7 +16761,6 @@ async def test_create_event_threat_detection_custom_module_empty_call_grpc_async request_msg = ( security_center_management.CreateEventThreatDetectionCustomModuleRequest() ) - assert args[0] == request_msg @@ -16816,7 +16797,6 @@ async def test_update_event_threat_detection_custom_module_empty_call_grpc_async request_msg = ( security_center_management.UpdateEventThreatDetectionCustomModuleRequest() ) - assert args[0] == request_msg @@ -16843,7 +16823,6 @@ async def test_delete_event_threat_detection_custom_module_empty_call_grpc_async request_msg = ( security_center_management.DeleteEventThreatDetectionCustomModuleRequest() ) - assert args[0] == request_msg @@ -16872,7 +16851,6 @@ async def test_validate_event_threat_detection_custom_module_empty_call_grpc_asy request_msg = ( security_center_management.ValidateEventThreatDetectionCustomModuleRequest() ) - assert args[0] == request_msg @@ -16903,7 +16881,6 @@ async def test_get_security_center_service_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_center_management.GetSecurityCenterServiceRequest() - assert args[0] == request_msg @@ -16932,7 +16909,6 @@ async def test_list_security_center_services_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_center_management.ListSecurityCenterServicesRequest() - assert args[0] == request_msg @@ -16963,7 +16939,6 @@ async def test_update_security_center_service_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_center_management.UpdateSecurityCenterServiceRequest() - assert args[0] == request_msg @@ -20774,7 +20749,6 @@ def test_list_effective_security_health_analytics_custom_modules_empty_call_rest call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_center_management.ListEffectiveSecurityHealthAnalyticsCustomModulesRequest() - assert args[0] == request_msg @@ -20797,7 +20771,6 @@ def test_get_effective_security_health_analytics_custom_module_empty_call_rest() call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_center_management.GetEffectiveSecurityHealthAnalyticsCustomModuleRequest() - assert args[0] == request_msg @@ -20821,7 +20794,6 @@ def test_list_security_health_analytics_custom_modules_empty_call_rest(): request_msg = ( security_center_management.ListSecurityHealthAnalyticsCustomModulesRequest() ) - assert args[0] == request_msg @@ -20844,7 +20816,6 @@ def test_list_descendant_security_health_analytics_custom_modules_empty_call_res call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_center_management.ListDescendantSecurityHealthAnalyticsCustomModulesRequest() - assert args[0] == request_msg @@ -20868,7 +20839,6 @@ def test_get_security_health_analytics_custom_module_empty_call_rest(): request_msg = ( security_center_management.GetSecurityHealthAnalyticsCustomModuleRequest() ) - assert args[0] == request_msg @@ -20891,7 +20861,6 @@ def test_create_security_health_analytics_custom_module_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_center_management.CreateSecurityHealthAnalyticsCustomModuleRequest() - assert args[0] == request_msg @@ -20914,7 +20883,6 @@ def test_update_security_health_analytics_custom_module_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_center_management.UpdateSecurityHealthAnalyticsCustomModuleRequest() - assert args[0] == request_msg @@ -20937,7 +20905,6 @@ def test_delete_security_health_analytics_custom_module_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_center_management.DeleteSecurityHealthAnalyticsCustomModuleRequest() - assert args[0] == request_msg @@ -20960,7 +20927,6 @@ def test_simulate_security_health_analytics_custom_module_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_center_management.SimulateSecurityHealthAnalyticsCustomModuleRequest() - assert args[0] == request_msg @@ -20983,7 +20949,6 @@ def test_list_effective_event_threat_detection_custom_modules_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_center_management.ListEffectiveEventThreatDetectionCustomModulesRequest() - assert args[0] == request_msg @@ -21006,7 +20971,6 @@ def test_get_effective_event_threat_detection_custom_module_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_center_management.GetEffectiveEventThreatDetectionCustomModuleRequest() - assert args[0] == request_msg @@ -21030,7 +20994,6 @@ def test_list_event_threat_detection_custom_modules_empty_call_rest(): request_msg = ( security_center_management.ListEventThreatDetectionCustomModulesRequest() ) - assert args[0] == request_msg @@ -21053,7 +21016,6 @@ def test_list_descendant_event_threat_detection_custom_modules_empty_call_rest() call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_center_management.ListDescendantEventThreatDetectionCustomModulesRequest() - assert args[0] == request_msg @@ -21077,7 +21039,6 @@ def test_get_event_threat_detection_custom_module_empty_call_rest(): request_msg = ( security_center_management.GetEventThreatDetectionCustomModuleRequest() ) - assert args[0] == request_msg @@ -21101,7 +21062,6 @@ def test_create_event_threat_detection_custom_module_empty_call_rest(): request_msg = ( security_center_management.CreateEventThreatDetectionCustomModuleRequest() ) - assert args[0] == request_msg @@ -21125,7 +21085,6 @@ def test_update_event_threat_detection_custom_module_empty_call_rest(): request_msg = ( security_center_management.UpdateEventThreatDetectionCustomModuleRequest() ) - assert args[0] == request_msg @@ -21149,7 +21108,6 @@ def test_delete_event_threat_detection_custom_module_empty_call_rest(): request_msg = ( security_center_management.DeleteEventThreatDetectionCustomModuleRequest() ) - assert args[0] == request_msg @@ -21173,7 +21131,6 @@ def test_validate_event_threat_detection_custom_module_empty_call_rest(): request_msg = ( security_center_management.ValidateEventThreatDetectionCustomModuleRequest() ) - assert args[0] == request_msg @@ -21195,7 +21152,6 @@ def test_get_security_center_service_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_center_management.GetSecurityCenterServiceRequest() - assert args[0] == request_msg @@ -21217,7 +21173,6 @@ def test_list_security_center_services_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_center_management.ListSecurityCenterServicesRequest() - assert args[0] == request_msg @@ -21239,7 +21194,6 @@ def test_update_security_center_service_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = security_center_management.UpdateSecurityCenterServiceRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-service-control/noxfile.py b/packages/google-cloud-service-control/noxfile.py index 7be1fcfc8176..3d3b1d64d329 100644 --- a/packages/google-cloud-service-control/noxfile.py +++ b/packages/google-cloud-service-control/noxfile.py @@ -47,7 +47,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-service-control" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-service-control/setup.py b/packages/google-cloud-service-control/setup.py index 4bd3b091ed1e..805a88f437ca 100644 --- a/packages/google-cloud-service-control/setup.py +++ b/packages/google-cloud-service-control/setup.py @@ -45,7 +45,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/google-cloud-service-control/testing/constraints-3.10.txt b/packages/google-cloud-service-control/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-service-control/testing/constraints-3.10.txt +++ b/packages/google-cloud-service-control/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-service-control/tests/unit/gapic/servicecontrol_v1/test_quota_controller.py b/packages/google-cloud-service-control/tests/unit/gapic/servicecontrol_v1/test_quota_controller.py index 2c03cd30c29a..9e084f97344a 100644 --- a/packages/google-cloud-service-control/tests/unit/gapic/servicecontrol_v1/test_quota_controller.py +++ b/packages/google-cloud-service-control/tests/unit/gapic/servicecontrol_v1/test_quota_controller.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 @@ -110,6 +111,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" @@ -1340,8 +1356,8 @@ def test_quota_controller_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - quota_controller.AllocateQuotaRequest, - dict, + quota_controller.AllocateQuotaRequest(), + {}, ], ) def test_allocate_quota(request_type, transport: str = "grpc"): @@ -1352,7 +1368,7 @@ def test_allocate_quota(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.allocate_quota), "__call__") as call: @@ -1399,10 +1415,11 @@ def test_allocate_quota_non_empty_request_with_auto_populated_field(): client.allocate_quota(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == quota_controller.AllocateQuotaRequest( + request_msg = quota_controller.AllocateQuotaRequest( service_name="service_name_value", service_config_id="service_config_id_value", ) + assert args[0] == request_msg def test_allocate_quota_use_cached_wrapped_rpc(): @@ -1483,9 +1500,14 @@ async def test_allocate_quota_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_allocate_quota_async( - transport: str = "grpc_asyncio", request_type=quota_controller.AllocateQuotaRequest -): +@pytest.mark.parametrize( + "request_type", + [ + quota_controller.AllocateQuotaRequest(), + {}, + ], +) +async def test_allocate_quota_async(request_type, transport: str = "grpc_asyncio"): client = QuotaControllerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1493,7 +1515,7 @@ async def test_allocate_quota_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.allocate_quota), "__call__") as call: @@ -1518,11 +1540,6 @@ async def test_allocate_quota_async( assert response.service_config_id == "service_config_id_value" -@pytest.mark.asyncio -async def test_allocate_quota_async_from_dict(): - await test_allocate_quota_async(request_type=dict) - - def test_allocate_quota_field_headers(): client = QuotaControllerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1743,7 +1760,6 @@ def test_allocate_quota_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = quota_controller.AllocateQuotaRequest() - assert args[0] == request_msg @@ -1785,7 +1801,6 @@ async def test_allocate_quota_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = quota_controller.AllocateQuotaRequest() - assert args[0] == request_msg @@ -1957,7 +1972,6 @@ def test_allocate_quota_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = quota_controller.AllocateQuotaRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-service-control/tests/unit/gapic/servicecontrol_v1/test_service_controller.py b/packages/google-cloud-service-control/tests/unit/gapic/servicecontrol_v1/test_service_controller.py index c28d30530bae..41235306d01a 100644 --- a/packages/google-cloud-service-control/tests/unit/gapic/servicecontrol_v1/test_service_controller.py +++ b/packages/google-cloud-service-control/tests/unit/gapic/servicecontrol_v1/test_service_controller.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 @@ -120,6 +121,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" @@ -1364,8 +1380,8 @@ def test_service_controller_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - service_controller.CheckRequest, - dict, + service_controller.CheckRequest(), + {}, ], ) def test_check(request_type, transport: str = "grpc"): @@ -1376,7 +1392,7 @@ def test_check(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.check), "__call__") as call: @@ -1425,10 +1441,11 @@ def test_check_non_empty_request_with_auto_populated_field(): client.check(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service_controller.CheckRequest( + request_msg = service_controller.CheckRequest( service_name="service_name_value", service_config_id="service_config_id_value", ) + assert args[0] == request_msg def test_check_use_cached_wrapped_rpc(): @@ -1507,9 +1524,14 @@ async def test_check_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio @pytest.mark.asyncio -async def test_check_async( - transport: str = "grpc_asyncio", request_type=service_controller.CheckRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service_controller.CheckRequest(), + {}, + ], +) +async def test_check_async(request_type, transport: str = "grpc_asyncio"): client = ServiceControllerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1517,7 +1539,7 @@ async def test_check_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.check), "__call__") as call: @@ -1544,11 +1566,6 @@ async def test_check_async( assert response.service_rollout_id == "service_rollout_id_value" -@pytest.mark.asyncio -async def test_check_async_from_dict(): - await test_check_async(request_type=dict) - - def test_check_field_headers(): client = ServiceControllerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1613,8 +1630,8 @@ async def test_check_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service_controller.ReportRequest, - dict, + service_controller.ReportRequest(), + {}, ], ) def test_report(request_type, transport: str = "grpc"): @@ -1625,7 +1642,7 @@ def test_report(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.report), "__call__") as call: @@ -1672,10 +1689,11 @@ def test_report_non_empty_request_with_auto_populated_field(): client.report(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service_controller.ReportRequest( + request_msg = service_controller.ReportRequest( service_name="service_name_value", service_config_id="service_config_id_value", ) + assert args[0] == request_msg def test_report_use_cached_wrapped_rpc(): @@ -1754,9 +1772,14 @@ async def test_report_async_use_cached_wrapped_rpc(transport: str = "grpc_asynci @pytest.mark.asyncio -async def test_report_async( - transport: str = "grpc_asyncio", request_type=service_controller.ReportRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service_controller.ReportRequest(), + {}, + ], +) +async def test_report_async(request_type, transport: str = "grpc_asyncio"): client = ServiceControllerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1764,7 +1787,7 @@ async def test_report_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.report), "__call__") as call: @@ -1789,11 +1812,6 @@ async def test_report_async( assert response.service_rollout_id == "service_rollout_id_value" -@pytest.mark.asyncio -async def test_report_async_from_dict(): - await test_report_async(request_type=dict) - - def test_report_field_headers(): client = ServiceControllerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2050,7 +2068,6 @@ def test_check_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service_controller.CheckRequest() - assert args[0] == request_msg @@ -2071,7 +2088,6 @@ def test_report_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service_controller.ReportRequest() - assert args[0] == request_msg @@ -2114,7 +2130,6 @@ async def test_check_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service_controller.CheckRequest() - assert args[0] == request_msg @@ -2142,7 +2157,6 @@ async def test_report_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service_controller.ReportRequest() - assert args[0] == request_msg @@ -2442,7 +2456,6 @@ def test_check_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service_controller.CheckRequest() - assert args[0] == request_msg @@ -2462,7 +2475,6 @@ def test_report_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service_controller.ReportRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-service-control/tests/unit/gapic/servicecontrol_v2/test_service_controller.py b/packages/google-cloud-service-control/tests/unit/gapic/servicecontrol_v2/test_service_controller.py index edfbf11f0204..570cb9acb61e 100644 --- a/packages/google-cloud-service-control/tests/unit/gapic/servicecontrol_v2/test_service_controller.py +++ b/packages/google-cloud-service-control/tests/unit/gapic/servicecontrol_v2/test_service_controller.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" @@ -1356,8 +1372,8 @@ def test_service_controller_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - service_controller.CheckRequest, - dict, + service_controller.CheckRequest(), + {}, ], ) def test_check(request_type, transport: str = "grpc"): @@ -1368,7 +1384,7 @@ def test_check(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.check), "__call__") as call: @@ -1411,11 +1427,12 @@ def test_check_non_empty_request_with_auto_populated_field(): client.check(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service_controller.CheckRequest( + request_msg = service_controller.CheckRequest( service_name="service_name_value", service_config_id="service_config_id_value", flags="flags_value", ) + assert args[0] == request_msg def test_check_use_cached_wrapped_rpc(): @@ -1494,9 +1511,14 @@ async def test_check_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio @pytest.mark.asyncio -async def test_check_async( - transport: str = "grpc_asyncio", request_type=service_controller.CheckRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service_controller.CheckRequest(), + {}, + ], +) +async def test_check_async(request_type, transport: str = "grpc_asyncio"): client = ServiceControllerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1504,7 +1526,7 @@ async def test_check_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.check), "__call__") as call: @@ -1524,11 +1546,6 @@ async def test_check_async( assert isinstance(response, service_controller.CheckResponse) -@pytest.mark.asyncio -async def test_check_async_from_dict(): - await test_check_async(request_type=dict) - - def test_check_field_headers(): client = ServiceControllerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1593,8 +1610,8 @@ async def test_check_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - service_controller.ReportRequest, - dict, + service_controller.ReportRequest(), + {}, ], ) def test_report(request_type, transport: str = "grpc"): @@ -1605,7 +1622,7 @@ def test_report(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.report), "__call__") as call: @@ -1647,10 +1664,11 @@ def test_report_non_empty_request_with_auto_populated_field(): client.report(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service_controller.ReportRequest( + request_msg = service_controller.ReportRequest( service_name="service_name_value", service_config_id="service_config_id_value", ) + assert args[0] == request_msg def test_report_use_cached_wrapped_rpc(): @@ -1729,9 +1747,14 @@ async def test_report_async_use_cached_wrapped_rpc(transport: str = "grpc_asynci @pytest.mark.asyncio -async def test_report_async( - transport: str = "grpc_asyncio", request_type=service_controller.ReportRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service_controller.ReportRequest(), + {}, + ], +) +async def test_report_async(request_type, transport: str = "grpc_asyncio"): client = ServiceControllerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1739,7 +1762,7 @@ async def test_report_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.report), "__call__") as call: @@ -1759,11 +1782,6 @@ async def test_report_async( assert isinstance(response, service_controller.ReportResponse) -@pytest.mark.asyncio -async def test_report_async_from_dict(): - await test_report_async(request_type=dict) - - def test_report_field_headers(): client = ServiceControllerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2020,7 +2038,6 @@ def test_check_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service_controller.CheckRequest() - assert args[0] == request_msg @@ -2041,7 +2058,6 @@ def test_report_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service_controller.ReportRequest() - assert args[0] == request_msg @@ -2080,7 +2096,6 @@ async def test_check_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service_controller.CheckRequest() - assert args[0] == request_msg @@ -2105,7 +2120,6 @@ async def test_report_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service_controller.ReportRequest() - assert args[0] == request_msg @@ -2393,7 +2407,6 @@ def test_check_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service_controller.CheckRequest() - assert args[0] == request_msg @@ -2413,7 +2426,6 @@ def test_report_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service_controller.ReportRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-service-directory/noxfile.py b/packages/google-cloud-service-directory/noxfile.py index 79155d9744e7..70e9c93bbe31 100644 --- a/packages/google-cloud-service-directory/noxfile.py +++ b/packages/google-cloud-service-directory/noxfile.py @@ -47,7 +47,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-service-directory" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-service-directory/setup.py b/packages/google-cloud-service-directory/setup.py index 22811a420a8c..a77b67882b1a 100644 --- a/packages/google-cloud-service-directory/setup.py +++ b/packages/google-cloud-service-directory/setup.py @@ -45,7 +45,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/google-cloud-service-directory/testing/constraints-3.10.txt b/packages/google-cloud-service-directory/testing/constraints-3.10.txt index a92801e1c8e2..b39cd54634f9 100644 --- a/packages/google-cloud-service-directory/testing/constraints-3.10.txt +++ b/packages/google-cloud-service-directory/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/google-cloud-service-directory/tests/unit/gapic/servicedirectory_v1/test_lookup_service.py b/packages/google-cloud-service-directory/tests/unit/gapic/servicedirectory_v1/test_lookup_service.py index a259f68cdda4..759b9619c4a7 100644 --- a/packages/google-cloud-service-directory/tests/unit/gapic/servicedirectory_v1/test_lookup_service.py +++ b/packages/google-cloud-service-directory/tests/unit/gapic/servicedirectory_v1/test_lookup_service.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 @@ -107,6 +108,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" @@ -1306,8 +1322,8 @@ def test_lookup_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - lookup_service.ResolveServiceRequest, - dict, + lookup_service.ResolveServiceRequest(), + {}, ], ) def test_resolve_service(request_type, transport: str = "grpc"): @@ -1318,7 +1334,7 @@ def test_resolve_service(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.resolve_service), "__call__") as call: @@ -1360,10 +1376,11 @@ def test_resolve_service_non_empty_request_with_auto_populated_field(): client.resolve_service(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == lookup_service.ResolveServiceRequest( + request_msg = lookup_service.ResolveServiceRequest( name="name_value", endpoint_filter="endpoint_filter_value", ) + assert args[0] == request_msg def test_resolve_service_use_cached_wrapped_rpc(): @@ -1444,9 +1461,14 @@ async def test_resolve_service_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_resolve_service_async( - transport: str = "grpc_asyncio", request_type=lookup_service.ResolveServiceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + lookup_service.ResolveServiceRequest(), + {}, + ], +) +async def test_resolve_service_async(request_type, transport: str = "grpc_asyncio"): client = LookupServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1454,7 +1476,7 @@ async def test_resolve_service_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.resolve_service), "__call__") as call: @@ -1474,11 +1496,6 @@ async def test_resolve_service_async( assert isinstance(response, lookup_service.ResolveServiceResponse) -@pytest.mark.asyncio -async def test_resolve_service_async_from_dict(): - await test_resolve_service_async(request_type=dict) - - def test_resolve_service_field_headers(): client = LookupServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1784,7 +1801,6 @@ def test_resolve_service_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lookup_service.ResolveServiceRequest() - assert args[0] == request_msg @@ -1823,7 +1839,6 @@ async def test_resolve_service_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lookup_service.ResolveServiceRequest() - assert args[0] == request_msg @@ -2116,7 +2131,6 @@ def test_resolve_service_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lookup_service.ResolveServiceRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-service-directory/tests/unit/gapic/servicedirectory_v1/test_registration_service.py b/packages/google-cloud-service-directory/tests/unit/gapic/servicedirectory_v1/test_registration_service.py index ba6005f18c5a..680670078fe7 100644 --- a/packages/google-cloud-service-directory/tests/unit/gapic/servicedirectory_v1/test_registration_service.py +++ b/packages/google-cloud-service-directory/tests/unit/gapic/servicedirectory_v1/test_registration_service.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 @@ -121,6 +122,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" @@ -1384,8 +1400,8 @@ def test_registration_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - registration_service.CreateNamespaceRequest, - dict, + registration_service.CreateNamespaceRequest(), + {}, ], ) def test_create_namespace(request_type, transport: str = "grpc"): @@ -1396,7 +1412,7 @@ def test_create_namespace(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_namespace), "__call__") as call: @@ -1443,10 +1459,11 @@ def test_create_namespace_non_empty_request_with_auto_populated_field(): client.create_namespace(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == registration_service.CreateNamespaceRequest( + request_msg = registration_service.CreateNamespaceRequest( parent="parent_value", namespace_id="namespace_id_value", ) + assert args[0] == request_msg def test_create_namespace_use_cached_wrapped_rpc(): @@ -1529,10 +1546,14 @@ async def test_create_namespace_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_namespace_async( - transport: str = "grpc_asyncio", - request_type=registration_service.CreateNamespaceRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + registration_service.CreateNamespaceRequest(), + {}, + ], +) +async def test_create_namespace_async(request_type, transport: str = "grpc_asyncio"): client = RegistrationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1540,7 +1561,7 @@ async def test_create_namespace_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_namespace), "__call__") as call: @@ -1565,11 +1586,6 @@ async def test_create_namespace_async( assert response.uid == "uid_value" -@pytest.mark.asyncio -async def test_create_namespace_async_from_dict(): - await test_create_namespace_async(request_type=dict) - - def test_create_namespace_field_headers(): client = RegistrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1736,8 +1752,8 @@ async def test_create_namespace_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - registration_service.ListNamespacesRequest, - dict, + registration_service.ListNamespacesRequest(), + {}, ], ) def test_list_namespaces(request_type, transport: str = "grpc"): @@ -1748,7 +1764,7 @@ def test_list_namespaces(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_namespaces), "__call__") as call: @@ -1795,12 +1811,13 @@ def test_list_namespaces_non_empty_request_with_auto_populated_field(): client.list_namespaces(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == registration_service.ListNamespacesRequest( + request_msg = registration_service.ListNamespacesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_namespaces_use_cached_wrapped_rpc(): @@ -1881,10 +1898,14 @@ async def test_list_namespaces_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_namespaces_async( - transport: str = "grpc_asyncio", - request_type=registration_service.ListNamespacesRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + registration_service.ListNamespacesRequest(), + {}, + ], +) +async def test_list_namespaces_async(request_type, transport: str = "grpc_asyncio"): client = RegistrationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1892,7 +1913,7 @@ async def test_list_namespaces_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_namespaces), "__call__") as call: @@ -1915,11 +1936,6 @@ async def test_list_namespaces_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_namespaces_async_from_dict(): - await test_list_namespaces_async(request_type=dict) - - def test_list_namespaces_field_headers(): client = RegistrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2256,8 +2272,8 @@ async def test_list_namespaces_async_pages(): @pytest.mark.parametrize( "request_type", [ - registration_service.GetNamespaceRequest, - dict, + registration_service.GetNamespaceRequest(), + {}, ], ) def test_get_namespace(request_type, transport: str = "grpc"): @@ -2268,7 +2284,7 @@ def test_get_namespace(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_namespace), "__call__") as call: @@ -2314,9 +2330,10 @@ def test_get_namespace_non_empty_request_with_auto_populated_field(): client.get_namespace(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == registration_service.GetNamespaceRequest( + request_msg = registration_service.GetNamespaceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_namespace_use_cached_wrapped_rpc(): @@ -2397,10 +2414,14 @@ async def test_get_namespace_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_namespace_async( - transport: str = "grpc_asyncio", - request_type=registration_service.GetNamespaceRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + registration_service.GetNamespaceRequest(), + {}, + ], +) +async def test_get_namespace_async(request_type, transport: str = "grpc_asyncio"): client = RegistrationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2408,7 +2429,7 @@ async def test_get_namespace_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_namespace), "__call__") as call: @@ -2433,11 +2454,6 @@ async def test_get_namespace_async( assert response.uid == "uid_value" -@pytest.mark.asyncio -async def test_get_namespace_async_from_dict(): - await test_get_namespace_async(request_type=dict) - - def test_get_namespace_field_headers(): client = RegistrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2580,8 +2596,8 @@ async def test_get_namespace_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - registration_service.UpdateNamespaceRequest, - dict, + registration_service.UpdateNamespaceRequest(), + {}, ], ) def test_update_namespace(request_type, transport: str = "grpc"): @@ -2592,7 +2608,7 @@ def test_update_namespace(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_namespace), "__call__") as call: @@ -2636,7 +2652,8 @@ def test_update_namespace_non_empty_request_with_auto_populated_field(): client.update_namespace(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == registration_service.UpdateNamespaceRequest() + request_msg = registration_service.UpdateNamespaceRequest() + assert args[0] == request_msg def test_update_namespace_use_cached_wrapped_rpc(): @@ -2719,10 +2736,14 @@ async def test_update_namespace_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_namespace_async( - transport: str = "grpc_asyncio", - request_type=registration_service.UpdateNamespaceRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + registration_service.UpdateNamespaceRequest(), + {}, + ], +) +async def test_update_namespace_async(request_type, transport: str = "grpc_asyncio"): client = RegistrationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2730,7 +2751,7 @@ async def test_update_namespace_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_namespace), "__call__") as call: @@ -2755,11 +2776,6 @@ async def test_update_namespace_async( assert response.uid == "uid_value" -@pytest.mark.asyncio -async def test_update_namespace_async_from_dict(): - await test_update_namespace_async(request_type=dict) - - def test_update_namespace_field_headers(): client = RegistrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2916,8 +2932,8 @@ async def test_update_namespace_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - registration_service.DeleteNamespaceRequest, - dict, + registration_service.DeleteNamespaceRequest(), + {}, ], ) def test_delete_namespace(request_type, transport: str = "grpc"): @@ -2928,7 +2944,7 @@ def test_delete_namespace(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_namespace), "__call__") as call: @@ -2969,9 +2985,10 @@ def test_delete_namespace_non_empty_request_with_auto_populated_field(): client.delete_namespace(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == registration_service.DeleteNamespaceRequest( + request_msg = registration_service.DeleteNamespaceRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_namespace_use_cached_wrapped_rpc(): @@ -3054,10 +3071,14 @@ async def test_delete_namespace_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_namespace_async( - transport: str = "grpc_asyncio", - request_type=registration_service.DeleteNamespaceRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + registration_service.DeleteNamespaceRequest(), + {}, + ], +) +async def test_delete_namespace_async(request_type, transport: str = "grpc_asyncio"): client = RegistrationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3065,7 +3086,7 @@ async def test_delete_namespace_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_namespace), "__call__") as call: @@ -3083,11 +3104,6 @@ async def test_delete_namespace_async( assert response is None -@pytest.mark.asyncio -async def test_delete_namespace_async_from_dict(): - await test_delete_namespace_async(request_type=dict) - - def test_delete_namespace_field_headers(): client = RegistrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3230,8 +3246,8 @@ async def test_delete_namespace_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - registration_service.CreateServiceRequest, - dict, + registration_service.CreateServiceRequest(), + {}, ], ) def test_create_service(request_type, transport: str = "grpc"): @@ -3242,7 +3258,7 @@ def test_create_service(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_service), "__call__") as call: @@ -3289,10 +3305,11 @@ def test_create_service_non_empty_request_with_auto_populated_field(): client.create_service(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == registration_service.CreateServiceRequest( + request_msg = registration_service.CreateServiceRequest( parent="parent_value", service_id="service_id_value", ) + assert args[0] == request_msg def test_create_service_use_cached_wrapped_rpc(): @@ -3373,10 +3390,14 @@ async def test_create_service_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_service_async( - transport: str = "grpc_asyncio", - request_type=registration_service.CreateServiceRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + registration_service.CreateServiceRequest(), + {}, + ], +) +async def test_create_service_async(request_type, transport: str = "grpc_asyncio"): client = RegistrationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3384,7 +3405,7 @@ async def test_create_service_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_service), "__call__") as call: @@ -3409,11 +3430,6 @@ async def test_create_service_async( assert response.uid == "uid_value" -@pytest.mark.asyncio -async def test_create_service_async_from_dict(): - await test_create_service_async(request_type=dict) - - def test_create_service_field_headers(): client = RegistrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3576,8 +3592,8 @@ async def test_create_service_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - registration_service.ListServicesRequest, - dict, + registration_service.ListServicesRequest(), + {}, ], ) def test_list_services(request_type, transport: str = "grpc"): @@ -3588,7 +3604,7 @@ def test_list_services(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_services), "__call__") as call: @@ -3635,12 +3651,13 @@ def test_list_services_non_empty_request_with_auto_populated_field(): client.list_services(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == registration_service.ListServicesRequest( + request_msg = registration_service.ListServicesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_services_use_cached_wrapped_rpc(): @@ -3721,10 +3738,14 @@ async def test_list_services_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_services_async( - transport: str = "grpc_asyncio", - request_type=registration_service.ListServicesRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + registration_service.ListServicesRequest(), + {}, + ], +) +async def test_list_services_async(request_type, transport: str = "grpc_asyncio"): client = RegistrationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3732,7 +3753,7 @@ async def test_list_services_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_services), "__call__") as call: @@ -3755,11 +3776,6 @@ async def test_list_services_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_services_async_from_dict(): - await test_list_services_async(request_type=dict) - - def test_list_services_field_headers(): client = RegistrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4096,8 +4112,8 @@ async def test_list_services_async_pages(): @pytest.mark.parametrize( "request_type", [ - registration_service.GetServiceRequest, - dict, + registration_service.GetServiceRequest(), + {}, ], ) def test_get_service(request_type, transport: str = "grpc"): @@ -4108,7 +4124,7 @@ def test_get_service(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_service), "__call__") as call: @@ -4154,9 +4170,10 @@ def test_get_service_non_empty_request_with_auto_populated_field(): client.get_service(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == registration_service.GetServiceRequest( + request_msg = registration_service.GetServiceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_service_use_cached_wrapped_rpc(): @@ -4237,9 +4254,14 @@ async def test_get_service_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_service_async( - transport: str = "grpc_asyncio", request_type=registration_service.GetServiceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + registration_service.GetServiceRequest(), + {}, + ], +) +async def test_get_service_async(request_type, transport: str = "grpc_asyncio"): client = RegistrationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4247,7 +4269,7 @@ async def test_get_service_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_service), "__call__") as call: @@ -4272,11 +4294,6 @@ async def test_get_service_async( assert response.uid == "uid_value" -@pytest.mark.asyncio -async def test_get_service_async_from_dict(): - await test_get_service_async(request_type=dict) - - def test_get_service_field_headers(): client = RegistrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4419,8 +4436,8 @@ async def test_get_service_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - registration_service.UpdateServiceRequest, - dict, + registration_service.UpdateServiceRequest(), + {}, ], ) def test_update_service(request_type, transport: str = "grpc"): @@ -4431,7 +4448,7 @@ def test_update_service(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_service), "__call__") as call: @@ -4475,7 +4492,8 @@ def test_update_service_non_empty_request_with_auto_populated_field(): client.update_service(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == registration_service.UpdateServiceRequest() + request_msg = registration_service.UpdateServiceRequest() + assert args[0] == request_msg def test_update_service_use_cached_wrapped_rpc(): @@ -4556,10 +4574,14 @@ async def test_update_service_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_service_async( - transport: str = "grpc_asyncio", - request_type=registration_service.UpdateServiceRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + registration_service.UpdateServiceRequest(), + {}, + ], +) +async def test_update_service_async(request_type, transport: str = "grpc_asyncio"): client = RegistrationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4567,7 +4589,7 @@ async def test_update_service_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_service), "__call__") as call: @@ -4592,11 +4614,6 @@ async def test_update_service_async( assert response.uid == "uid_value" -@pytest.mark.asyncio -async def test_update_service_async_from_dict(): - await test_update_service_async(request_type=dict) - - def test_update_service_field_headers(): client = RegistrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4749,8 +4766,8 @@ async def test_update_service_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - registration_service.DeleteServiceRequest, - dict, + registration_service.DeleteServiceRequest(), + {}, ], ) def test_delete_service(request_type, transport: str = "grpc"): @@ -4761,7 +4778,7 @@ def test_delete_service(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_service), "__call__") as call: @@ -4802,9 +4819,10 @@ def test_delete_service_non_empty_request_with_auto_populated_field(): client.delete_service(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == registration_service.DeleteServiceRequest( + request_msg = registration_service.DeleteServiceRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_service_use_cached_wrapped_rpc(): @@ -4885,10 +4903,14 @@ async def test_delete_service_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_service_async( - transport: str = "grpc_asyncio", - request_type=registration_service.DeleteServiceRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + registration_service.DeleteServiceRequest(), + {}, + ], +) +async def test_delete_service_async(request_type, transport: str = "grpc_asyncio"): client = RegistrationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4896,7 +4918,7 @@ async def test_delete_service_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_service), "__call__") as call: @@ -4914,11 +4936,6 @@ async def test_delete_service_async( assert response is None -@pytest.mark.asyncio -async def test_delete_service_async_from_dict(): - await test_delete_service_async(request_type=dict) - - def test_delete_service_field_headers(): client = RegistrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5061,8 +5078,8 @@ async def test_delete_service_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - registration_service.CreateEndpointRequest, - dict, + registration_service.CreateEndpointRequest(), + {}, ], ) def test_create_endpoint(request_type, transport: str = "grpc"): @@ -5073,7 +5090,7 @@ def test_create_endpoint(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_endpoint), "__call__") as call: @@ -5126,10 +5143,11 @@ def test_create_endpoint_non_empty_request_with_auto_populated_field(): client.create_endpoint(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == registration_service.CreateEndpointRequest( + request_msg = registration_service.CreateEndpointRequest( parent="parent_value", endpoint_id="endpoint_id_value", ) + assert args[0] == request_msg def test_create_endpoint_use_cached_wrapped_rpc(): @@ -5210,10 +5228,14 @@ async def test_create_endpoint_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_endpoint_async( - transport: str = "grpc_asyncio", - request_type=registration_service.CreateEndpointRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + registration_service.CreateEndpointRequest(), + {}, + ], +) +async def test_create_endpoint_async(request_type, transport: str = "grpc_asyncio"): client = RegistrationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5221,7 +5243,7 @@ async def test_create_endpoint_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_endpoint), "__call__") as call: @@ -5252,11 +5274,6 @@ async def test_create_endpoint_async( assert response.uid == "uid_value" -@pytest.mark.asyncio -async def test_create_endpoint_async_from_dict(): - await test_create_endpoint_async(request_type=dict) - - def test_create_endpoint_field_headers(): client = RegistrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5423,8 +5440,8 @@ async def test_create_endpoint_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - registration_service.ListEndpointsRequest, - dict, + registration_service.ListEndpointsRequest(), + {}, ], ) def test_list_endpoints(request_type, transport: str = "grpc"): @@ -5435,7 +5452,7 @@ def test_list_endpoints(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_endpoints), "__call__") as call: @@ -5482,12 +5499,13 @@ def test_list_endpoints_non_empty_request_with_auto_populated_field(): client.list_endpoints(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == registration_service.ListEndpointsRequest( + request_msg = registration_service.ListEndpointsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_endpoints_use_cached_wrapped_rpc(): @@ -5568,10 +5586,14 @@ async def test_list_endpoints_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_endpoints_async( - transport: str = "grpc_asyncio", - request_type=registration_service.ListEndpointsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + registration_service.ListEndpointsRequest(), + {}, + ], +) +async def test_list_endpoints_async(request_type, transport: str = "grpc_asyncio"): client = RegistrationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5579,7 +5601,7 @@ async def test_list_endpoints_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_endpoints), "__call__") as call: @@ -5602,11 +5624,6 @@ async def test_list_endpoints_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_endpoints_async_from_dict(): - await test_list_endpoints_async(request_type=dict) - - def test_list_endpoints_field_headers(): client = RegistrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5943,8 +5960,8 @@ async def test_list_endpoints_async_pages(): @pytest.mark.parametrize( "request_type", [ - registration_service.GetEndpointRequest, - dict, + registration_service.GetEndpointRequest(), + {}, ], ) def test_get_endpoint(request_type, transport: str = "grpc"): @@ -5955,7 +5972,7 @@ def test_get_endpoint(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_endpoint), "__call__") as call: @@ -6007,9 +6024,10 @@ def test_get_endpoint_non_empty_request_with_auto_populated_field(): client.get_endpoint(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == registration_service.GetEndpointRequest( + request_msg = registration_service.GetEndpointRequest( name="name_value", ) + assert args[0] == request_msg def test_get_endpoint_use_cached_wrapped_rpc(): @@ -6090,10 +6108,14 @@ async def test_get_endpoint_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_endpoint_async( - transport: str = "grpc_asyncio", - request_type=registration_service.GetEndpointRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + registration_service.GetEndpointRequest(), + {}, + ], +) +async def test_get_endpoint_async(request_type, transport: str = "grpc_asyncio"): client = RegistrationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6101,7 +6123,7 @@ async def test_get_endpoint_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_endpoint), "__call__") as call: @@ -6132,11 +6154,6 @@ async def test_get_endpoint_async( assert response.uid == "uid_value" -@pytest.mark.asyncio -async def test_get_endpoint_async_from_dict(): - await test_get_endpoint_async(request_type=dict) - - def test_get_endpoint_field_headers(): client = RegistrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6279,8 +6296,8 @@ async def test_get_endpoint_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - registration_service.UpdateEndpointRequest, - dict, + registration_service.UpdateEndpointRequest(), + {}, ], ) def test_update_endpoint(request_type, transport: str = "grpc"): @@ -6291,7 +6308,7 @@ def test_update_endpoint(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_endpoint), "__call__") as call: @@ -6341,7 +6358,8 @@ def test_update_endpoint_non_empty_request_with_auto_populated_field(): client.update_endpoint(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == registration_service.UpdateEndpointRequest() + request_msg = registration_service.UpdateEndpointRequest() + assert args[0] == request_msg def test_update_endpoint_use_cached_wrapped_rpc(): @@ -6422,10 +6440,14 @@ async def test_update_endpoint_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_endpoint_async( - transport: str = "grpc_asyncio", - request_type=registration_service.UpdateEndpointRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + registration_service.UpdateEndpointRequest(), + {}, + ], +) +async def test_update_endpoint_async(request_type, transport: str = "grpc_asyncio"): client = RegistrationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6433,7 +6455,7 @@ async def test_update_endpoint_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_endpoint), "__call__") as call: @@ -6464,11 +6486,6 @@ async def test_update_endpoint_async( assert response.uid == "uid_value" -@pytest.mark.asyncio -async def test_update_endpoint_async_from_dict(): - await test_update_endpoint_async(request_type=dict) - - def test_update_endpoint_field_headers(): client = RegistrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6625,8 +6642,8 @@ async def test_update_endpoint_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - registration_service.DeleteEndpointRequest, - dict, + registration_service.DeleteEndpointRequest(), + {}, ], ) def test_delete_endpoint(request_type, transport: str = "grpc"): @@ -6637,7 +6654,7 @@ def test_delete_endpoint(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_endpoint), "__call__") as call: @@ -6678,9 +6695,10 @@ def test_delete_endpoint_non_empty_request_with_auto_populated_field(): client.delete_endpoint(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == registration_service.DeleteEndpointRequest( + request_msg = registration_service.DeleteEndpointRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_endpoint_use_cached_wrapped_rpc(): @@ -6761,10 +6779,14 @@ async def test_delete_endpoint_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_endpoint_async( - transport: str = "grpc_asyncio", - request_type=registration_service.DeleteEndpointRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + registration_service.DeleteEndpointRequest(), + {}, + ], +) +async def test_delete_endpoint_async(request_type, transport: str = "grpc_asyncio"): client = RegistrationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6772,7 +6794,7 @@ async def test_delete_endpoint_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_endpoint), "__call__") as call: @@ -6790,11 +6812,6 @@ async def test_delete_endpoint_async( assert response is None -@pytest.mark.asyncio -async def test_delete_endpoint_async_from_dict(): - await test_delete_endpoint_async(request_type=dict) - - def test_delete_endpoint_field_headers(): client = RegistrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6937,8 +6954,8 @@ async def test_delete_endpoint_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.GetIamPolicyRequest, - dict, + iam_policy_pb2.GetIamPolicyRequest(), + {}, ], ) def test_get_iam_policy(request_type, transport: str = "grpc"): @@ -6949,7 +6966,7 @@ def test_get_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(type(client.transport.get_iam_policy), "__call__") as call: @@ -6995,9 +7012,10 @@ def test_get_iam_policy_non_empty_request_with_auto_populated_field(): client.get_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.GetIamPolicyRequest( + request_msg = iam_policy_pb2.GetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_get_iam_policy_use_cached_wrapped_rpc(): @@ -7078,9 +7096,14 @@ async def test_get_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.GetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.GetIamPolicyRequest(), + {}, + ], +) +async def test_get_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = RegistrationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7088,7 +7111,7 @@ async def test_get_iam_policy_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_iam_policy), "__call__") as call: @@ -7113,11 +7136,6 @@ async def test_get_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_get_iam_policy_async_from_dict(): - await test_get_iam_policy_async(request_type=dict) - - def test_get_iam_policy_field_headers(): client = RegistrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7197,8 +7215,8 @@ def test_get_iam_policy_from_dict_foreign(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.SetIamPolicyRequest, - dict, + iam_policy_pb2.SetIamPolicyRequest(), + {}, ], ) def test_set_iam_policy(request_type, transport: str = "grpc"): @@ -7209,7 +7227,7 @@ def test_set_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(type(client.transport.set_iam_policy), "__call__") as call: @@ -7255,9 +7273,10 @@ def test_set_iam_policy_non_empty_request_with_auto_populated_field(): client.set_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.SetIamPolicyRequest( + request_msg = iam_policy_pb2.SetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_set_iam_policy_use_cached_wrapped_rpc(): @@ -7338,9 +7357,14 @@ async def test_set_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.SetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.SetIamPolicyRequest(), + {}, + ], +) +async def test_set_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = RegistrationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7348,7 +7372,7 @@ async def test_set_iam_policy_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.set_iam_policy), "__call__") as call: @@ -7373,11 +7397,6 @@ async def test_set_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_set_iam_policy_async_from_dict(): - await test_set_iam_policy_async(request_type=dict) - - def test_set_iam_policy_field_headers(): client = RegistrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7458,8 +7477,8 @@ def test_set_iam_policy_from_dict_foreign(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.TestIamPermissionsRequest, - dict, + iam_policy_pb2.TestIamPermissionsRequest(), + {}, ], ) def test_test_iam_permissions(request_type, transport: str = "grpc"): @@ -7470,7 +7489,7 @@ def test_test_iam_permissions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7518,9 +7537,10 @@ def test_test_iam_permissions_non_empty_request_with_auto_populated_field(): client.test_iam_permissions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.TestIamPermissionsRequest( + request_msg = iam_policy_pb2.TestIamPermissionsRequest( resource="resource_value", ) + assert args[0] == request_msg def test_test_iam_permissions_use_cached_wrapped_rpc(): @@ -7605,9 +7625,15 @@ async def test_test_iam_permissions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.TestIamPermissionsRequest(), + {}, + ], +) async def test_test_iam_permissions_async( - transport: str = "grpc_asyncio", - request_type=iam_policy_pb2.TestIamPermissionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = RegistrationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -7616,7 +7642,7 @@ async def test_test_iam_permissions_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( @@ -7641,11 +7667,6 @@ async def test_test_iam_permissions_async( assert response.permissions == ["permissions_value"] -@pytest.mark.asyncio -async def test_test_iam_permissions_async_from_dict(): - await test_test_iam_permissions_async(request_type=dict) - - def test_test_iam_permissions_field_headers(): client = RegistrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11284,7 +11305,6 @@ def test_create_namespace_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.CreateNamespaceRequest() - assert args[0] == request_msg @@ -11305,7 +11325,6 @@ def test_list_namespaces_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.ListNamespacesRequest() - assert args[0] == request_msg @@ -11326,7 +11345,6 @@ def test_get_namespace_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.GetNamespaceRequest() - assert args[0] == request_msg @@ -11347,7 +11365,6 @@ def test_update_namespace_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.UpdateNamespaceRequest() - assert args[0] == request_msg @@ -11368,7 +11385,6 @@ def test_delete_namespace_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.DeleteNamespaceRequest() - assert args[0] == request_msg @@ -11389,7 +11405,6 @@ def test_create_service_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.CreateServiceRequest() - assert args[0] == request_msg @@ -11410,7 +11425,6 @@ def test_list_services_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.ListServicesRequest() - assert args[0] == request_msg @@ -11431,7 +11445,6 @@ def test_get_service_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.GetServiceRequest() - assert args[0] == request_msg @@ -11452,7 +11465,6 @@ def test_update_service_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.UpdateServiceRequest() - assert args[0] == request_msg @@ -11473,7 +11485,6 @@ def test_delete_service_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.DeleteServiceRequest() - assert args[0] == request_msg @@ -11494,7 +11505,6 @@ def test_create_endpoint_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.CreateEndpointRequest() - assert args[0] == request_msg @@ -11515,7 +11525,6 @@ def test_list_endpoints_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.ListEndpointsRequest() - assert args[0] == request_msg @@ -11536,7 +11545,6 @@ def test_get_endpoint_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.GetEndpointRequest() - assert args[0] == request_msg @@ -11557,7 +11565,6 @@ def test_update_endpoint_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.UpdateEndpointRequest() - assert args[0] == request_msg @@ -11578,7 +11585,6 @@ def test_delete_endpoint_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.DeleteEndpointRequest() - assert args[0] == request_msg @@ -11599,7 +11605,6 @@ def test_get_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -11620,7 +11625,6 @@ def test_set_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -11643,7 +11647,6 @@ def test_test_iam_permissions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -11685,7 +11688,6 @@ async def test_create_namespace_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.CreateNamespaceRequest() - assert args[0] == request_msg @@ -11712,7 +11714,6 @@ async def test_list_namespaces_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.ListNamespacesRequest() - assert args[0] == request_msg @@ -11740,7 +11741,6 @@ async def test_get_namespace_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.GetNamespaceRequest() - assert args[0] == request_msg @@ -11768,7 +11768,6 @@ async def test_update_namespace_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.UpdateNamespaceRequest() - assert args[0] == request_msg @@ -11791,7 +11790,6 @@ async def test_delete_namespace_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.DeleteNamespaceRequest() - assert args[0] == request_msg @@ -11819,7 +11817,6 @@ async def test_create_service_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.CreateServiceRequest() - assert args[0] == request_msg @@ -11846,7 +11843,6 @@ async def test_list_services_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.ListServicesRequest() - assert args[0] == request_msg @@ -11874,7 +11870,6 @@ async def test_get_service_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.GetServiceRequest() - assert args[0] == request_msg @@ -11902,7 +11897,6 @@ async def test_update_service_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.UpdateServiceRequest() - assert args[0] == request_msg @@ -11925,7 +11919,6 @@ async def test_delete_service_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.DeleteServiceRequest() - assert args[0] == request_msg @@ -11956,7 +11949,6 @@ async def test_create_endpoint_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.CreateEndpointRequest() - assert args[0] == request_msg @@ -11983,7 +11975,6 @@ async def test_list_endpoints_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.ListEndpointsRequest() - assert args[0] == request_msg @@ -12014,7 +12005,6 @@ async def test_get_endpoint_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.GetEndpointRequest() - assert args[0] == request_msg @@ -12045,7 +12035,6 @@ async def test_update_endpoint_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.UpdateEndpointRequest() - assert args[0] == request_msg @@ -12068,7 +12057,6 @@ async def test_delete_endpoint_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.DeleteEndpointRequest() - assert args[0] == request_msg @@ -12096,7 +12084,6 @@ async def test_get_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -12124,7 +12111,6 @@ async def test_set_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -12153,7 +12139,6 @@ async def test_test_iam_permissions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -15147,7 +15132,6 @@ def test_create_namespace_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.CreateNamespaceRequest() - assert args[0] == request_msg @@ -15167,7 +15151,6 @@ def test_list_namespaces_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.ListNamespacesRequest() - assert args[0] == request_msg @@ -15187,7 +15170,6 @@ def test_get_namespace_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.GetNamespaceRequest() - assert args[0] == request_msg @@ -15207,7 +15189,6 @@ def test_update_namespace_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.UpdateNamespaceRequest() - assert args[0] == request_msg @@ -15227,7 +15208,6 @@ def test_delete_namespace_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.DeleteNamespaceRequest() - assert args[0] == request_msg @@ -15247,7 +15227,6 @@ def test_create_service_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.CreateServiceRequest() - assert args[0] == request_msg @@ -15267,7 +15246,6 @@ def test_list_services_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.ListServicesRequest() - assert args[0] == request_msg @@ -15287,7 +15265,6 @@ def test_get_service_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.GetServiceRequest() - assert args[0] == request_msg @@ -15307,7 +15284,6 @@ def test_update_service_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.UpdateServiceRequest() - assert args[0] == request_msg @@ -15327,7 +15303,6 @@ def test_delete_service_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.DeleteServiceRequest() - assert args[0] == request_msg @@ -15347,7 +15322,6 @@ def test_create_endpoint_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.CreateEndpointRequest() - assert args[0] == request_msg @@ -15367,7 +15341,6 @@ def test_list_endpoints_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.ListEndpointsRequest() - assert args[0] == request_msg @@ -15387,7 +15360,6 @@ def test_get_endpoint_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.GetEndpointRequest() - assert args[0] == request_msg @@ -15407,7 +15379,6 @@ def test_update_endpoint_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.UpdateEndpointRequest() - assert args[0] == request_msg @@ -15427,7 +15398,6 @@ def test_delete_endpoint_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.DeleteEndpointRequest() - assert args[0] == request_msg @@ -15447,7 +15417,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -15467,7 +15436,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -15489,7 +15457,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-service-directory/tests/unit/gapic/servicedirectory_v1beta1/test_lookup_service.py b/packages/google-cloud-service-directory/tests/unit/gapic/servicedirectory_v1beta1/test_lookup_service.py index d0df1cdec159..8951e823be48 100644 --- a/packages/google-cloud-service-directory/tests/unit/gapic/servicedirectory_v1beta1/test_lookup_service.py +++ b/packages/google-cloud-service-directory/tests/unit/gapic/servicedirectory_v1beta1/test_lookup_service.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 @@ -107,6 +108,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" @@ -1306,8 +1322,8 @@ def test_lookup_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - lookup_service.ResolveServiceRequest, - dict, + lookup_service.ResolveServiceRequest(), + {}, ], ) def test_resolve_service(request_type, transport: str = "grpc"): @@ -1318,7 +1334,7 @@ def test_resolve_service(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.resolve_service), "__call__") as call: @@ -1360,10 +1376,11 @@ def test_resolve_service_non_empty_request_with_auto_populated_field(): client.resolve_service(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == lookup_service.ResolveServiceRequest( + request_msg = lookup_service.ResolveServiceRequest( name="name_value", endpoint_filter="endpoint_filter_value", ) + assert args[0] == request_msg def test_resolve_service_use_cached_wrapped_rpc(): @@ -1444,9 +1461,14 @@ async def test_resolve_service_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_resolve_service_async( - transport: str = "grpc_asyncio", request_type=lookup_service.ResolveServiceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + lookup_service.ResolveServiceRequest(), + {}, + ], +) +async def test_resolve_service_async(request_type, transport: str = "grpc_asyncio"): client = LookupServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1454,7 +1476,7 @@ async def test_resolve_service_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.resolve_service), "__call__") as call: @@ -1474,11 +1496,6 @@ async def test_resolve_service_async( assert isinstance(response, lookup_service.ResolveServiceResponse) -@pytest.mark.asyncio -async def test_resolve_service_async_from_dict(): - await test_resolve_service_async(request_type=dict) - - def test_resolve_service_field_headers(): client = LookupServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1784,7 +1801,6 @@ def test_resolve_service_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lookup_service.ResolveServiceRequest() - assert args[0] == request_msg @@ -1823,7 +1839,6 @@ async def test_resolve_service_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lookup_service.ResolveServiceRequest() - assert args[0] == request_msg @@ -2116,7 +2131,6 @@ def test_resolve_service_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lookup_service.ResolveServiceRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-service-directory/tests/unit/gapic/servicedirectory_v1beta1/test_registration_service.py b/packages/google-cloud-service-directory/tests/unit/gapic/servicedirectory_v1beta1/test_registration_service.py index efd4891749cf..188a4d4ff6c5 100644 --- a/packages/google-cloud-service-directory/tests/unit/gapic/servicedirectory_v1beta1/test_registration_service.py +++ b/packages/google-cloud-service-directory/tests/unit/gapic/servicedirectory_v1beta1/test_registration_service.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 @@ -122,6 +123,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" @@ -1385,8 +1401,8 @@ def test_registration_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - registration_service.CreateNamespaceRequest, - dict, + registration_service.CreateNamespaceRequest(), + {}, ], ) def test_create_namespace(request_type, transport: str = "grpc"): @@ -1397,7 +1413,7 @@ def test_create_namespace(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_namespace), "__call__") as call: @@ -1444,10 +1460,11 @@ def test_create_namespace_non_empty_request_with_auto_populated_field(): client.create_namespace(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == registration_service.CreateNamespaceRequest( + request_msg = registration_service.CreateNamespaceRequest( parent="parent_value", namespace_id="namespace_id_value", ) + assert args[0] == request_msg def test_create_namespace_use_cached_wrapped_rpc(): @@ -1530,10 +1547,14 @@ async def test_create_namespace_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_namespace_async( - transport: str = "grpc_asyncio", - request_type=registration_service.CreateNamespaceRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + registration_service.CreateNamespaceRequest(), + {}, + ], +) +async def test_create_namespace_async(request_type, transport: str = "grpc_asyncio"): client = RegistrationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1541,7 +1562,7 @@ async def test_create_namespace_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_namespace), "__call__") as call: @@ -1566,11 +1587,6 @@ async def test_create_namespace_async( assert response.uid == "uid_value" -@pytest.mark.asyncio -async def test_create_namespace_async_from_dict(): - await test_create_namespace_async(request_type=dict) - - def test_create_namespace_field_headers(): client = RegistrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1737,8 +1753,8 @@ async def test_create_namespace_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - registration_service.ListNamespacesRequest, - dict, + registration_service.ListNamespacesRequest(), + {}, ], ) def test_list_namespaces(request_type, transport: str = "grpc"): @@ -1749,7 +1765,7 @@ def test_list_namespaces(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_namespaces), "__call__") as call: @@ -1796,12 +1812,13 @@ def test_list_namespaces_non_empty_request_with_auto_populated_field(): client.list_namespaces(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == registration_service.ListNamespacesRequest( + request_msg = registration_service.ListNamespacesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_namespaces_use_cached_wrapped_rpc(): @@ -1882,10 +1899,14 @@ async def test_list_namespaces_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_namespaces_async( - transport: str = "grpc_asyncio", - request_type=registration_service.ListNamespacesRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + registration_service.ListNamespacesRequest(), + {}, + ], +) +async def test_list_namespaces_async(request_type, transport: str = "grpc_asyncio"): client = RegistrationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1893,7 +1914,7 @@ async def test_list_namespaces_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_namespaces), "__call__") as call: @@ -1916,11 +1937,6 @@ async def test_list_namespaces_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_namespaces_async_from_dict(): - await test_list_namespaces_async(request_type=dict) - - def test_list_namespaces_field_headers(): client = RegistrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2257,8 +2273,8 @@ async def test_list_namespaces_async_pages(): @pytest.mark.parametrize( "request_type", [ - registration_service.GetNamespaceRequest, - dict, + registration_service.GetNamespaceRequest(), + {}, ], ) def test_get_namespace(request_type, transport: str = "grpc"): @@ -2269,7 +2285,7 @@ def test_get_namespace(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_namespace), "__call__") as call: @@ -2315,9 +2331,10 @@ def test_get_namespace_non_empty_request_with_auto_populated_field(): client.get_namespace(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == registration_service.GetNamespaceRequest( + request_msg = registration_service.GetNamespaceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_namespace_use_cached_wrapped_rpc(): @@ -2398,10 +2415,14 @@ async def test_get_namespace_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_namespace_async( - transport: str = "grpc_asyncio", - request_type=registration_service.GetNamespaceRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + registration_service.GetNamespaceRequest(), + {}, + ], +) +async def test_get_namespace_async(request_type, transport: str = "grpc_asyncio"): client = RegistrationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2409,7 +2430,7 @@ async def test_get_namespace_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_namespace), "__call__") as call: @@ -2434,11 +2455,6 @@ async def test_get_namespace_async( assert response.uid == "uid_value" -@pytest.mark.asyncio -async def test_get_namespace_async_from_dict(): - await test_get_namespace_async(request_type=dict) - - def test_get_namespace_field_headers(): client = RegistrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2581,8 +2597,8 @@ async def test_get_namespace_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - registration_service.UpdateNamespaceRequest, - dict, + registration_service.UpdateNamespaceRequest(), + {}, ], ) def test_update_namespace(request_type, transport: str = "grpc"): @@ -2593,7 +2609,7 @@ def test_update_namespace(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_namespace), "__call__") as call: @@ -2637,7 +2653,8 @@ def test_update_namespace_non_empty_request_with_auto_populated_field(): client.update_namespace(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == registration_service.UpdateNamespaceRequest() + request_msg = registration_service.UpdateNamespaceRequest() + assert args[0] == request_msg def test_update_namespace_use_cached_wrapped_rpc(): @@ -2720,10 +2737,14 @@ async def test_update_namespace_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_namespace_async( - transport: str = "grpc_asyncio", - request_type=registration_service.UpdateNamespaceRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + registration_service.UpdateNamespaceRequest(), + {}, + ], +) +async def test_update_namespace_async(request_type, transport: str = "grpc_asyncio"): client = RegistrationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2731,7 +2752,7 @@ async def test_update_namespace_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_namespace), "__call__") as call: @@ -2756,11 +2777,6 @@ async def test_update_namespace_async( assert response.uid == "uid_value" -@pytest.mark.asyncio -async def test_update_namespace_async_from_dict(): - await test_update_namespace_async(request_type=dict) - - def test_update_namespace_field_headers(): client = RegistrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2917,8 +2933,8 @@ async def test_update_namespace_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - registration_service.DeleteNamespaceRequest, - dict, + registration_service.DeleteNamespaceRequest(), + {}, ], ) def test_delete_namespace(request_type, transport: str = "grpc"): @@ -2929,7 +2945,7 @@ def test_delete_namespace(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_namespace), "__call__") as call: @@ -2970,9 +2986,10 @@ def test_delete_namespace_non_empty_request_with_auto_populated_field(): client.delete_namespace(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == registration_service.DeleteNamespaceRequest( + request_msg = registration_service.DeleteNamespaceRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_namespace_use_cached_wrapped_rpc(): @@ -3055,10 +3072,14 @@ async def test_delete_namespace_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_namespace_async( - transport: str = "grpc_asyncio", - request_type=registration_service.DeleteNamespaceRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + registration_service.DeleteNamespaceRequest(), + {}, + ], +) +async def test_delete_namespace_async(request_type, transport: str = "grpc_asyncio"): client = RegistrationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3066,7 +3087,7 @@ async def test_delete_namespace_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_namespace), "__call__") as call: @@ -3084,11 +3105,6 @@ async def test_delete_namespace_async( assert response is None -@pytest.mark.asyncio -async def test_delete_namespace_async_from_dict(): - await test_delete_namespace_async(request_type=dict) - - def test_delete_namespace_field_headers(): client = RegistrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3231,8 +3247,8 @@ async def test_delete_namespace_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - registration_service.CreateServiceRequest, - dict, + registration_service.CreateServiceRequest(), + {}, ], ) def test_create_service(request_type, transport: str = "grpc"): @@ -3243,7 +3259,7 @@ def test_create_service(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_service), "__call__") as call: @@ -3290,10 +3306,11 @@ def test_create_service_non_empty_request_with_auto_populated_field(): client.create_service(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == registration_service.CreateServiceRequest( + request_msg = registration_service.CreateServiceRequest( parent="parent_value", service_id="service_id_value", ) + assert args[0] == request_msg def test_create_service_use_cached_wrapped_rpc(): @@ -3374,10 +3391,14 @@ async def test_create_service_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_service_async( - transport: str = "grpc_asyncio", - request_type=registration_service.CreateServiceRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + registration_service.CreateServiceRequest(), + {}, + ], +) +async def test_create_service_async(request_type, transport: str = "grpc_asyncio"): client = RegistrationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3385,7 +3406,7 @@ async def test_create_service_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_service), "__call__") as call: @@ -3410,11 +3431,6 @@ async def test_create_service_async( assert response.uid == "uid_value" -@pytest.mark.asyncio -async def test_create_service_async_from_dict(): - await test_create_service_async(request_type=dict) - - def test_create_service_field_headers(): client = RegistrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3577,8 +3593,8 @@ async def test_create_service_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - registration_service.ListServicesRequest, - dict, + registration_service.ListServicesRequest(), + {}, ], ) def test_list_services(request_type, transport: str = "grpc"): @@ -3589,7 +3605,7 @@ def test_list_services(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_services), "__call__") as call: @@ -3636,12 +3652,13 @@ def test_list_services_non_empty_request_with_auto_populated_field(): client.list_services(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == registration_service.ListServicesRequest( + request_msg = registration_service.ListServicesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_services_use_cached_wrapped_rpc(): @@ -3722,10 +3739,14 @@ async def test_list_services_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_services_async( - transport: str = "grpc_asyncio", - request_type=registration_service.ListServicesRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + registration_service.ListServicesRequest(), + {}, + ], +) +async def test_list_services_async(request_type, transport: str = "grpc_asyncio"): client = RegistrationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3733,7 +3754,7 @@ async def test_list_services_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_services), "__call__") as call: @@ -3756,11 +3777,6 @@ async def test_list_services_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_services_async_from_dict(): - await test_list_services_async(request_type=dict) - - def test_list_services_field_headers(): client = RegistrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4097,8 +4113,8 @@ async def test_list_services_async_pages(): @pytest.mark.parametrize( "request_type", [ - registration_service.GetServiceRequest, - dict, + registration_service.GetServiceRequest(), + {}, ], ) def test_get_service(request_type, transport: str = "grpc"): @@ -4109,7 +4125,7 @@ def test_get_service(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_service), "__call__") as call: @@ -4155,9 +4171,10 @@ def test_get_service_non_empty_request_with_auto_populated_field(): client.get_service(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == registration_service.GetServiceRequest( + request_msg = registration_service.GetServiceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_service_use_cached_wrapped_rpc(): @@ -4238,9 +4255,14 @@ async def test_get_service_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_service_async( - transport: str = "grpc_asyncio", request_type=registration_service.GetServiceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + registration_service.GetServiceRequest(), + {}, + ], +) +async def test_get_service_async(request_type, transport: str = "grpc_asyncio"): client = RegistrationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4248,7 +4270,7 @@ async def test_get_service_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_service), "__call__") as call: @@ -4273,11 +4295,6 @@ async def test_get_service_async( assert response.uid == "uid_value" -@pytest.mark.asyncio -async def test_get_service_async_from_dict(): - await test_get_service_async(request_type=dict) - - def test_get_service_field_headers(): client = RegistrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4420,8 +4437,8 @@ async def test_get_service_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - registration_service.UpdateServiceRequest, - dict, + registration_service.UpdateServiceRequest(), + {}, ], ) def test_update_service(request_type, transport: str = "grpc"): @@ -4432,7 +4449,7 @@ def test_update_service(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_service), "__call__") as call: @@ -4476,7 +4493,8 @@ def test_update_service_non_empty_request_with_auto_populated_field(): client.update_service(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == registration_service.UpdateServiceRequest() + request_msg = registration_service.UpdateServiceRequest() + assert args[0] == request_msg def test_update_service_use_cached_wrapped_rpc(): @@ -4557,10 +4575,14 @@ async def test_update_service_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_service_async( - transport: str = "grpc_asyncio", - request_type=registration_service.UpdateServiceRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + registration_service.UpdateServiceRequest(), + {}, + ], +) +async def test_update_service_async(request_type, transport: str = "grpc_asyncio"): client = RegistrationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4568,7 +4590,7 @@ async def test_update_service_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_service), "__call__") as call: @@ -4593,11 +4615,6 @@ async def test_update_service_async( assert response.uid == "uid_value" -@pytest.mark.asyncio -async def test_update_service_async_from_dict(): - await test_update_service_async(request_type=dict) - - def test_update_service_field_headers(): client = RegistrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4750,8 +4767,8 @@ async def test_update_service_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - registration_service.DeleteServiceRequest, - dict, + registration_service.DeleteServiceRequest(), + {}, ], ) def test_delete_service(request_type, transport: str = "grpc"): @@ -4762,7 +4779,7 @@ def test_delete_service(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_service), "__call__") as call: @@ -4803,9 +4820,10 @@ def test_delete_service_non_empty_request_with_auto_populated_field(): client.delete_service(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == registration_service.DeleteServiceRequest( + request_msg = registration_service.DeleteServiceRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_service_use_cached_wrapped_rpc(): @@ -4886,10 +4904,14 @@ async def test_delete_service_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_service_async( - transport: str = "grpc_asyncio", - request_type=registration_service.DeleteServiceRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + registration_service.DeleteServiceRequest(), + {}, + ], +) +async def test_delete_service_async(request_type, transport: str = "grpc_asyncio"): client = RegistrationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4897,7 +4919,7 @@ async def test_delete_service_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_service), "__call__") as call: @@ -4915,11 +4937,6 @@ async def test_delete_service_async( assert response is None -@pytest.mark.asyncio -async def test_delete_service_async_from_dict(): - await test_delete_service_async(request_type=dict) - - def test_delete_service_field_headers(): client = RegistrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5062,8 +5079,8 @@ async def test_delete_service_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - registration_service.CreateEndpointRequest, - dict, + registration_service.CreateEndpointRequest(), + {}, ], ) def test_create_endpoint(request_type, transport: str = "grpc"): @@ -5074,7 +5091,7 @@ def test_create_endpoint(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_endpoint), "__call__") as call: @@ -5127,10 +5144,11 @@ def test_create_endpoint_non_empty_request_with_auto_populated_field(): client.create_endpoint(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == registration_service.CreateEndpointRequest( + request_msg = registration_service.CreateEndpointRequest( parent="parent_value", endpoint_id="endpoint_id_value", ) + assert args[0] == request_msg def test_create_endpoint_use_cached_wrapped_rpc(): @@ -5211,10 +5229,14 @@ async def test_create_endpoint_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_endpoint_async( - transport: str = "grpc_asyncio", - request_type=registration_service.CreateEndpointRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + registration_service.CreateEndpointRequest(), + {}, + ], +) +async def test_create_endpoint_async(request_type, transport: str = "grpc_asyncio"): client = RegistrationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5222,7 +5244,7 @@ async def test_create_endpoint_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_endpoint), "__call__") as call: @@ -5253,11 +5275,6 @@ async def test_create_endpoint_async( assert response.uid == "uid_value" -@pytest.mark.asyncio -async def test_create_endpoint_async_from_dict(): - await test_create_endpoint_async(request_type=dict) - - def test_create_endpoint_field_headers(): client = RegistrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5424,8 +5441,8 @@ async def test_create_endpoint_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - registration_service.ListEndpointsRequest, - dict, + registration_service.ListEndpointsRequest(), + {}, ], ) def test_list_endpoints(request_type, transport: str = "grpc"): @@ -5436,7 +5453,7 @@ def test_list_endpoints(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_endpoints), "__call__") as call: @@ -5483,12 +5500,13 @@ def test_list_endpoints_non_empty_request_with_auto_populated_field(): client.list_endpoints(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == registration_service.ListEndpointsRequest( + request_msg = registration_service.ListEndpointsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_endpoints_use_cached_wrapped_rpc(): @@ -5569,10 +5587,14 @@ async def test_list_endpoints_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_endpoints_async( - transport: str = "grpc_asyncio", - request_type=registration_service.ListEndpointsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + registration_service.ListEndpointsRequest(), + {}, + ], +) +async def test_list_endpoints_async(request_type, transport: str = "grpc_asyncio"): client = RegistrationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5580,7 +5602,7 @@ async def test_list_endpoints_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_endpoints), "__call__") as call: @@ -5603,11 +5625,6 @@ async def test_list_endpoints_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_endpoints_async_from_dict(): - await test_list_endpoints_async(request_type=dict) - - def test_list_endpoints_field_headers(): client = RegistrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5944,8 +5961,8 @@ async def test_list_endpoints_async_pages(): @pytest.mark.parametrize( "request_type", [ - registration_service.GetEndpointRequest, - dict, + registration_service.GetEndpointRequest(), + {}, ], ) def test_get_endpoint(request_type, transport: str = "grpc"): @@ -5956,7 +5973,7 @@ def test_get_endpoint(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_endpoint), "__call__") as call: @@ -6008,9 +6025,10 @@ def test_get_endpoint_non_empty_request_with_auto_populated_field(): client.get_endpoint(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == registration_service.GetEndpointRequest( + request_msg = registration_service.GetEndpointRequest( name="name_value", ) + assert args[0] == request_msg def test_get_endpoint_use_cached_wrapped_rpc(): @@ -6091,10 +6109,14 @@ async def test_get_endpoint_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_endpoint_async( - transport: str = "grpc_asyncio", - request_type=registration_service.GetEndpointRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + registration_service.GetEndpointRequest(), + {}, + ], +) +async def test_get_endpoint_async(request_type, transport: str = "grpc_asyncio"): client = RegistrationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6102,7 +6124,7 @@ async def test_get_endpoint_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_endpoint), "__call__") as call: @@ -6133,11 +6155,6 @@ async def test_get_endpoint_async( assert response.uid == "uid_value" -@pytest.mark.asyncio -async def test_get_endpoint_async_from_dict(): - await test_get_endpoint_async(request_type=dict) - - def test_get_endpoint_field_headers(): client = RegistrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6280,8 +6297,8 @@ async def test_get_endpoint_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - registration_service.UpdateEndpointRequest, - dict, + registration_service.UpdateEndpointRequest(), + {}, ], ) def test_update_endpoint(request_type, transport: str = "grpc"): @@ -6292,7 +6309,7 @@ def test_update_endpoint(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_endpoint), "__call__") as call: @@ -6342,7 +6359,8 @@ def test_update_endpoint_non_empty_request_with_auto_populated_field(): client.update_endpoint(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == registration_service.UpdateEndpointRequest() + request_msg = registration_service.UpdateEndpointRequest() + assert args[0] == request_msg def test_update_endpoint_use_cached_wrapped_rpc(): @@ -6423,10 +6441,14 @@ async def test_update_endpoint_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_endpoint_async( - transport: str = "grpc_asyncio", - request_type=registration_service.UpdateEndpointRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + registration_service.UpdateEndpointRequest(), + {}, + ], +) +async def test_update_endpoint_async(request_type, transport: str = "grpc_asyncio"): client = RegistrationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6434,7 +6456,7 @@ async def test_update_endpoint_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_endpoint), "__call__") as call: @@ -6465,11 +6487,6 @@ async def test_update_endpoint_async( assert response.uid == "uid_value" -@pytest.mark.asyncio -async def test_update_endpoint_async_from_dict(): - await test_update_endpoint_async(request_type=dict) - - def test_update_endpoint_field_headers(): client = RegistrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6626,8 +6643,8 @@ async def test_update_endpoint_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - registration_service.DeleteEndpointRequest, - dict, + registration_service.DeleteEndpointRequest(), + {}, ], ) def test_delete_endpoint(request_type, transport: str = "grpc"): @@ -6638,7 +6655,7 @@ def test_delete_endpoint(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_endpoint), "__call__") as call: @@ -6679,9 +6696,10 @@ def test_delete_endpoint_non_empty_request_with_auto_populated_field(): client.delete_endpoint(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == registration_service.DeleteEndpointRequest( + request_msg = registration_service.DeleteEndpointRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_endpoint_use_cached_wrapped_rpc(): @@ -6762,10 +6780,14 @@ async def test_delete_endpoint_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_endpoint_async( - transport: str = "grpc_asyncio", - request_type=registration_service.DeleteEndpointRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + registration_service.DeleteEndpointRequest(), + {}, + ], +) +async def test_delete_endpoint_async(request_type, transport: str = "grpc_asyncio"): client = RegistrationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6773,7 +6795,7 @@ async def test_delete_endpoint_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_endpoint), "__call__") as call: @@ -6791,11 +6813,6 @@ async def test_delete_endpoint_async( assert response is None -@pytest.mark.asyncio -async def test_delete_endpoint_async_from_dict(): - await test_delete_endpoint_async(request_type=dict) - - def test_delete_endpoint_field_headers(): client = RegistrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6938,8 +6955,8 @@ async def test_delete_endpoint_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.GetIamPolicyRequest, - dict, + iam_policy_pb2.GetIamPolicyRequest(), + {}, ], ) def test_get_iam_policy(request_type, transport: str = "grpc"): @@ -6950,7 +6967,7 @@ def test_get_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(type(client.transport.get_iam_policy), "__call__") as call: @@ -6996,9 +7013,10 @@ def test_get_iam_policy_non_empty_request_with_auto_populated_field(): client.get_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.GetIamPolicyRequest( + request_msg = iam_policy_pb2.GetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_get_iam_policy_use_cached_wrapped_rpc(): @@ -7079,9 +7097,14 @@ async def test_get_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.GetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.GetIamPolicyRequest(), + {}, + ], +) +async def test_get_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = RegistrationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7089,7 +7112,7 @@ async def test_get_iam_policy_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_iam_policy), "__call__") as call: @@ -7114,11 +7137,6 @@ async def test_get_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_get_iam_policy_async_from_dict(): - await test_get_iam_policy_async(request_type=dict) - - def test_get_iam_policy_field_headers(): client = RegistrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7198,8 +7216,8 @@ def test_get_iam_policy_from_dict_foreign(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.SetIamPolicyRequest, - dict, + iam_policy_pb2.SetIamPolicyRequest(), + {}, ], ) def test_set_iam_policy(request_type, transport: str = "grpc"): @@ -7210,7 +7228,7 @@ def test_set_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(type(client.transport.set_iam_policy), "__call__") as call: @@ -7256,9 +7274,10 @@ def test_set_iam_policy_non_empty_request_with_auto_populated_field(): client.set_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.SetIamPolicyRequest( + request_msg = iam_policy_pb2.SetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_set_iam_policy_use_cached_wrapped_rpc(): @@ -7339,9 +7358,14 @@ async def test_set_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.SetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.SetIamPolicyRequest(), + {}, + ], +) +async def test_set_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = RegistrationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7349,7 +7373,7 @@ async def test_set_iam_policy_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.set_iam_policy), "__call__") as call: @@ -7374,11 +7398,6 @@ async def test_set_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_set_iam_policy_async_from_dict(): - await test_set_iam_policy_async(request_type=dict) - - def test_set_iam_policy_field_headers(): client = RegistrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7459,8 +7478,8 @@ def test_set_iam_policy_from_dict_foreign(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.TestIamPermissionsRequest, - dict, + iam_policy_pb2.TestIamPermissionsRequest(), + {}, ], ) def test_test_iam_permissions(request_type, transport: str = "grpc"): @@ -7471,7 +7490,7 @@ def test_test_iam_permissions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7519,9 +7538,10 @@ def test_test_iam_permissions_non_empty_request_with_auto_populated_field(): client.test_iam_permissions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.TestIamPermissionsRequest( + request_msg = iam_policy_pb2.TestIamPermissionsRequest( resource="resource_value", ) + assert args[0] == request_msg def test_test_iam_permissions_use_cached_wrapped_rpc(): @@ -7606,9 +7626,15 @@ async def test_test_iam_permissions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.TestIamPermissionsRequest(), + {}, + ], +) async def test_test_iam_permissions_async( - transport: str = "grpc_asyncio", - request_type=iam_policy_pb2.TestIamPermissionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = RegistrationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -7617,7 +7643,7 @@ async def test_test_iam_permissions_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( @@ -7642,11 +7668,6 @@ async def test_test_iam_permissions_async( assert response.permissions == ["permissions_value"] -@pytest.mark.asyncio -async def test_test_iam_permissions_async_from_dict(): - await test_test_iam_permissions_async(request_type=dict) - - def test_test_iam_permissions_field_headers(): client = RegistrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11289,7 +11310,6 @@ def test_create_namespace_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.CreateNamespaceRequest() - assert args[0] == request_msg @@ -11310,7 +11330,6 @@ def test_list_namespaces_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.ListNamespacesRequest() - assert args[0] == request_msg @@ -11331,7 +11350,6 @@ def test_get_namespace_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.GetNamespaceRequest() - assert args[0] == request_msg @@ -11352,7 +11370,6 @@ def test_update_namespace_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.UpdateNamespaceRequest() - assert args[0] == request_msg @@ -11373,7 +11390,6 @@ def test_delete_namespace_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.DeleteNamespaceRequest() - assert args[0] == request_msg @@ -11394,7 +11410,6 @@ def test_create_service_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.CreateServiceRequest() - assert args[0] == request_msg @@ -11415,7 +11430,6 @@ def test_list_services_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.ListServicesRequest() - assert args[0] == request_msg @@ -11436,7 +11450,6 @@ def test_get_service_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.GetServiceRequest() - assert args[0] == request_msg @@ -11457,7 +11470,6 @@ def test_update_service_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.UpdateServiceRequest() - assert args[0] == request_msg @@ -11478,7 +11490,6 @@ def test_delete_service_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.DeleteServiceRequest() - assert args[0] == request_msg @@ -11499,7 +11510,6 @@ def test_create_endpoint_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.CreateEndpointRequest() - assert args[0] == request_msg @@ -11520,7 +11530,6 @@ def test_list_endpoints_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.ListEndpointsRequest() - assert args[0] == request_msg @@ -11541,7 +11550,6 @@ def test_get_endpoint_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.GetEndpointRequest() - assert args[0] == request_msg @@ -11562,7 +11570,6 @@ def test_update_endpoint_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.UpdateEndpointRequest() - assert args[0] == request_msg @@ -11583,7 +11590,6 @@ def test_delete_endpoint_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.DeleteEndpointRequest() - assert args[0] == request_msg @@ -11604,7 +11610,6 @@ def test_get_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -11625,7 +11630,6 @@ def test_set_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -11648,7 +11652,6 @@ def test_test_iam_permissions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -11690,7 +11693,6 @@ async def test_create_namespace_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.CreateNamespaceRequest() - assert args[0] == request_msg @@ -11717,7 +11719,6 @@ async def test_list_namespaces_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.ListNamespacesRequest() - assert args[0] == request_msg @@ -11745,7 +11746,6 @@ async def test_get_namespace_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.GetNamespaceRequest() - assert args[0] == request_msg @@ -11773,7 +11773,6 @@ async def test_update_namespace_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.UpdateNamespaceRequest() - assert args[0] == request_msg @@ -11796,7 +11795,6 @@ async def test_delete_namespace_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.DeleteNamespaceRequest() - assert args[0] == request_msg @@ -11824,7 +11822,6 @@ async def test_create_service_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.CreateServiceRequest() - assert args[0] == request_msg @@ -11851,7 +11848,6 @@ async def test_list_services_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.ListServicesRequest() - assert args[0] == request_msg @@ -11879,7 +11875,6 @@ async def test_get_service_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.GetServiceRequest() - assert args[0] == request_msg @@ -11907,7 +11902,6 @@ async def test_update_service_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.UpdateServiceRequest() - assert args[0] == request_msg @@ -11930,7 +11924,6 @@ async def test_delete_service_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.DeleteServiceRequest() - assert args[0] == request_msg @@ -11961,7 +11954,6 @@ async def test_create_endpoint_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.CreateEndpointRequest() - assert args[0] == request_msg @@ -11988,7 +11980,6 @@ async def test_list_endpoints_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.ListEndpointsRequest() - assert args[0] == request_msg @@ -12019,7 +12010,6 @@ async def test_get_endpoint_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.GetEndpointRequest() - assert args[0] == request_msg @@ -12050,7 +12040,6 @@ async def test_update_endpoint_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.UpdateEndpointRequest() - assert args[0] == request_msg @@ -12073,7 +12062,6 @@ async def test_delete_endpoint_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.DeleteEndpointRequest() - assert args[0] == request_msg @@ -12101,7 +12089,6 @@ async def test_get_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -12129,7 +12116,6 @@ async def test_set_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -12158,7 +12144,6 @@ async def test_test_iam_permissions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -15172,7 +15157,6 @@ def test_create_namespace_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.CreateNamespaceRequest() - assert args[0] == request_msg @@ -15192,7 +15176,6 @@ def test_list_namespaces_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.ListNamespacesRequest() - assert args[0] == request_msg @@ -15212,7 +15195,6 @@ def test_get_namespace_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.GetNamespaceRequest() - assert args[0] == request_msg @@ -15232,7 +15214,6 @@ def test_update_namespace_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.UpdateNamespaceRequest() - assert args[0] == request_msg @@ -15252,7 +15233,6 @@ def test_delete_namespace_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.DeleteNamespaceRequest() - assert args[0] == request_msg @@ -15272,7 +15252,6 @@ def test_create_service_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.CreateServiceRequest() - assert args[0] == request_msg @@ -15292,7 +15271,6 @@ def test_list_services_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.ListServicesRequest() - assert args[0] == request_msg @@ -15312,7 +15290,6 @@ def test_get_service_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.GetServiceRequest() - assert args[0] == request_msg @@ -15332,7 +15309,6 @@ def test_update_service_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.UpdateServiceRequest() - assert args[0] == request_msg @@ -15352,7 +15328,6 @@ def test_delete_service_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.DeleteServiceRequest() - assert args[0] == request_msg @@ -15372,7 +15347,6 @@ def test_create_endpoint_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.CreateEndpointRequest() - assert args[0] == request_msg @@ -15392,7 +15366,6 @@ def test_list_endpoints_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.ListEndpointsRequest() - assert args[0] == request_msg @@ -15412,7 +15385,6 @@ def test_get_endpoint_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.GetEndpointRequest() - assert args[0] == request_msg @@ -15432,7 +15404,6 @@ def test_update_endpoint_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.UpdateEndpointRequest() - assert args[0] == request_msg @@ -15452,7 +15423,6 @@ def test_delete_endpoint_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = registration_service.DeleteEndpointRequest() - assert args[0] == request_msg @@ -15472,7 +15442,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -15492,7 +15461,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -15514,7 +15482,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-service-management/noxfile.py b/packages/google-cloud-service-management/noxfile.py index b5f318080862..b647a373a1ed 100644 --- a/packages/google-cloud-service-management/noxfile.py +++ b/packages/google-cloud-service-management/noxfile.py @@ -47,7 +47,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-service-management" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-service-management/setup.py b/packages/google-cloud-service-management/setup.py index e7fb9c1febe4..779085f98aa9 100644 --- a/packages/google-cloud-service-management/setup.py +++ b/packages/google-cloud-service-management/setup.py @@ -45,7 +45,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/google-cloud-service-management/testing/constraints-3.10.txt b/packages/google-cloud-service-management/testing/constraints-3.10.txt index a92801e1c8e2..b39cd54634f9 100644 --- a/packages/google-cloud-service-management/testing/constraints-3.10.txt +++ b/packages/google-cloud-service-management/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/google-cloud-service-management/tests/unit/gapic/servicemanagement_v1/test_service_manager.py b/packages/google-cloud-service-management/tests/unit/gapic/servicemanagement_v1/test_service_manager.py index d4058779f54f..1ee3d6c14642 100644 --- a/packages/google-cloud-service-management/tests/unit/gapic/servicemanagement_v1/test_service_manager.py +++ b/packages/google-cloud-service-management/tests/unit/gapic/servicemanagement_v1/test_service_manager.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 @@ -147,6 +148,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" @@ -1355,8 +1371,8 @@ def test_service_manager_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - servicemanager.ListServicesRequest, - dict, + servicemanager.ListServicesRequest(), + {}, ], ) def test_list_services(request_type, transport: str = "grpc"): @@ -1367,7 +1383,7 @@ def test_list_services(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_services), "__call__") as call: @@ -1413,11 +1429,12 @@ def test_list_services_non_empty_request_with_auto_populated_field(): client.list_services(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == servicemanager.ListServicesRequest( + request_msg = servicemanager.ListServicesRequest( producer_project_id="producer_project_id_value", page_token="page_token_value", consumer_id="consumer_id_value", ) + assert args[0] == request_msg def test_list_services_use_cached_wrapped_rpc(): @@ -1498,9 +1515,14 @@ async def test_list_services_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_services_async( - transport: str = "grpc_asyncio", request_type=servicemanager.ListServicesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + servicemanager.ListServicesRequest(), + {}, + ], +) +async def test_list_services_async(request_type, transport: str = "grpc_asyncio"): client = ServiceManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1508,7 +1530,7 @@ async def test_list_services_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_services), "__call__") as call: @@ -1531,11 +1553,6 @@ async def test_list_services_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_services_async_from_dict(): - await test_list_services_async(request_type=dict) - - def test_list_services_flattened(): client = ServiceManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1818,8 +1835,8 @@ async def test_list_services_async_pages(): @pytest.mark.parametrize( "request_type", [ - servicemanager.GetServiceRequest, - dict, + servicemanager.GetServiceRequest(), + {}, ], ) def test_get_service(request_type, transport: str = "grpc"): @@ -1830,7 +1847,7 @@ def test_get_service(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_service), "__call__") as call: @@ -1876,9 +1893,10 @@ def test_get_service_non_empty_request_with_auto_populated_field(): client.get_service(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == servicemanager.GetServiceRequest( + request_msg = servicemanager.GetServiceRequest( service_name="service_name_value", ) + assert args[0] == request_msg def test_get_service_use_cached_wrapped_rpc(): @@ -1959,9 +1977,14 @@ async def test_get_service_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_service_async( - transport: str = "grpc_asyncio", request_type=servicemanager.GetServiceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + servicemanager.GetServiceRequest(), + {}, + ], +) +async def test_get_service_async(request_type, transport: str = "grpc_asyncio"): client = ServiceManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1969,7 +1992,7 @@ async def test_get_service_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_service), "__call__") as call: @@ -1994,11 +2017,6 @@ async def test_get_service_async( assert response.producer_project_id == "producer_project_id_value" -@pytest.mark.asyncio -async def test_get_service_async_from_dict(): - await test_get_service_async(request_type=dict) - - def test_get_service_field_headers(): client = ServiceManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2145,8 +2163,8 @@ async def test_get_service_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - servicemanager.CreateServiceRequest, - dict, + servicemanager.CreateServiceRequest(), + {}, ], ) def test_create_service(request_type, transport: str = "grpc"): @@ -2157,7 +2175,7 @@ def test_create_service(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_service), "__call__") as call: @@ -2196,7 +2214,8 @@ def test_create_service_non_empty_request_with_auto_populated_field(): client.create_service(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == servicemanager.CreateServiceRequest() + request_msg = servicemanager.CreateServiceRequest() + assert args[0] == request_msg def test_create_service_use_cached_wrapped_rpc(): @@ -2287,9 +2306,14 @@ async def test_create_service_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_service_async( - transport: str = "grpc_asyncio", request_type=servicemanager.CreateServiceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + servicemanager.CreateServiceRequest(), + {}, + ], +) +async def test_create_service_async(request_type, transport: str = "grpc_asyncio"): client = ServiceManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2297,7 +2321,7 @@ async def test_create_service_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_service), "__call__") as call: @@ -2317,11 +2341,6 @@ async def test_create_service_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_service_async_from_dict(): - await test_create_service_async(request_type=dict) - - def test_create_service_flattened(): client = ServiceManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2407,8 +2426,8 @@ async def test_create_service_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - servicemanager.DeleteServiceRequest, - dict, + servicemanager.DeleteServiceRequest(), + {}, ], ) def test_delete_service(request_type, transport: str = "grpc"): @@ -2419,7 +2438,7 @@ def test_delete_service(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_service), "__call__") as call: @@ -2460,9 +2479,10 @@ def test_delete_service_non_empty_request_with_auto_populated_field(): client.delete_service(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == servicemanager.DeleteServiceRequest( + request_msg = servicemanager.DeleteServiceRequest( service_name="service_name_value", ) + assert args[0] == request_msg def test_delete_service_use_cached_wrapped_rpc(): @@ -2553,9 +2573,14 @@ async def test_delete_service_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_service_async( - transport: str = "grpc_asyncio", request_type=servicemanager.DeleteServiceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + servicemanager.DeleteServiceRequest(), + {}, + ], +) +async def test_delete_service_async(request_type, transport: str = "grpc_asyncio"): client = ServiceManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2563,7 +2588,7 @@ async def test_delete_service_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_service), "__call__") as call: @@ -2583,11 +2608,6 @@ async def test_delete_service_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_service_async_from_dict(): - await test_delete_service_async(request_type=dict) - - def test_delete_service_field_headers(): client = ServiceManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2734,8 +2754,8 @@ async def test_delete_service_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - servicemanager.UndeleteServiceRequest, - dict, + servicemanager.UndeleteServiceRequest(), + {}, ], ) def test_undelete_service(request_type, transport: str = "grpc"): @@ -2746,7 +2766,7 @@ def test_undelete_service(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_service), "__call__") as call: @@ -2787,9 +2807,10 @@ def test_undelete_service_non_empty_request_with_auto_populated_field(): client.undelete_service(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == servicemanager.UndeleteServiceRequest( + request_msg = servicemanager.UndeleteServiceRequest( service_name="service_name_value", ) + assert args[0] == request_msg def test_undelete_service_use_cached_wrapped_rpc(): @@ -2882,9 +2903,14 @@ async def test_undelete_service_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_undelete_service_async( - transport: str = "grpc_asyncio", request_type=servicemanager.UndeleteServiceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + servicemanager.UndeleteServiceRequest(), + {}, + ], +) +async def test_undelete_service_async(request_type, transport: str = "grpc_asyncio"): client = ServiceManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2892,7 +2918,7 @@ async def test_undelete_service_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_service), "__call__") as call: @@ -2912,11 +2938,6 @@ async def test_undelete_service_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_undelete_service_async_from_dict(): - await test_undelete_service_async(request_type=dict) - - def test_undelete_service_field_headers(): client = ServiceManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3063,8 +3084,8 @@ async def test_undelete_service_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - servicemanager.ListServiceConfigsRequest, - dict, + servicemanager.ListServiceConfigsRequest(), + {}, ], ) def test_list_service_configs(request_type, transport: str = "grpc"): @@ -3075,7 +3096,7 @@ def test_list_service_configs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3124,10 +3145,11 @@ def test_list_service_configs_non_empty_request_with_auto_populated_field(): client.list_service_configs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == servicemanager.ListServiceConfigsRequest( + request_msg = servicemanager.ListServiceConfigsRequest( service_name="service_name_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_service_configs_use_cached_wrapped_rpc(): @@ -3212,9 +3234,15 @@ async def test_list_service_configs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + servicemanager.ListServiceConfigsRequest(), + {}, + ], +) async def test_list_service_configs_async( - transport: str = "grpc_asyncio", - request_type=servicemanager.ListServiceConfigsRequest, + request_type, transport: str = "grpc_asyncio" ): client = ServiceManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -3223,7 +3251,7 @@ async def test_list_service_configs_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( @@ -3248,11 +3276,6 @@ async def test_list_service_configs_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_service_configs_async_from_dict(): - await test_list_service_configs_async(request_type=dict) - - def test_list_service_configs_field_headers(): client = ServiceManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3605,8 +3628,8 @@ async def test_list_service_configs_async_pages(): @pytest.mark.parametrize( "request_type", [ - servicemanager.GetServiceConfigRequest, - dict, + servicemanager.GetServiceConfigRequest(), + {}, ], ) def test_get_service_config(request_type, transport: str = "grpc"): @@ -3617,7 +3640,7 @@ def test_get_service_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( @@ -3672,10 +3695,11 @@ def test_get_service_config_non_empty_request_with_auto_populated_field(): client.get_service_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == servicemanager.GetServiceConfigRequest( + request_msg = servicemanager.GetServiceConfigRequest( service_name="service_name_value", config_id="config_id_value", ) + assert args[0] == request_msg def test_get_service_config_use_cached_wrapped_rpc(): @@ -3760,9 +3784,14 @@ async def test_get_service_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_service_config_async( - transport: str = "grpc_asyncio", request_type=servicemanager.GetServiceConfigRequest -): +@pytest.mark.parametrize( + "request_type", + [ + servicemanager.GetServiceConfigRequest(), + {}, + ], +) +async def test_get_service_config_async(request_type, transport: str = "grpc_asyncio"): client = ServiceManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3770,7 +3799,7 @@ async def test_get_service_config_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( @@ -3801,11 +3830,6 @@ async def test_get_service_config_async( assert response.id == "id_value" -@pytest.mark.asyncio -async def test_get_service_config_async_from_dict(): - await test_get_service_config_async(request_type=dict) - - def test_get_service_config_field_headers(): client = ServiceManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3978,8 +4002,8 @@ async def test_get_service_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - servicemanager.CreateServiceConfigRequest, - dict, + servicemanager.CreateServiceConfigRequest(), + {}, ], ) def test_create_service_config(request_type, transport: str = "grpc"): @@ -3990,7 +4014,7 @@ def test_create_service_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( @@ -4044,9 +4068,10 @@ def test_create_service_config_non_empty_request_with_auto_populated_field(): client.create_service_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == servicemanager.CreateServiceConfigRequest( + request_msg = servicemanager.CreateServiceConfigRequest( service_name="service_name_value", ) + assert args[0] == request_msg def test_create_service_config_use_cached_wrapped_rpc(): @@ -4132,9 +4157,15 @@ async def test_create_service_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + servicemanager.CreateServiceConfigRequest(), + {}, + ], +) async def test_create_service_config_async( - transport: str = "grpc_asyncio", - request_type=servicemanager.CreateServiceConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = ServiceManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -4143,7 +4174,7 @@ async def test_create_service_config_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( @@ -4174,11 +4205,6 @@ async def test_create_service_config_async( assert response.id == "id_value" -@pytest.mark.asyncio -async def test_create_service_config_async_from_dict(): - await test_create_service_config_async(request_type=dict) - - def test_create_service_config_field_headers(): client = ServiceManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4339,8 +4365,8 @@ async def test_create_service_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - servicemanager.SubmitConfigSourceRequest, - dict, + servicemanager.SubmitConfigSourceRequest(), + {}, ], ) def test_submit_config_source(request_type, transport: str = "grpc"): @@ -4351,7 +4377,7 @@ def test_submit_config_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( @@ -4396,9 +4422,10 @@ def test_submit_config_source_non_empty_request_with_auto_populated_field(): client.submit_config_source(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == servicemanager.SubmitConfigSourceRequest( + request_msg = servicemanager.SubmitConfigSourceRequest( service_name="service_name_value", ) + assert args[0] == request_msg def test_submit_config_source_use_cached_wrapped_rpc(): @@ -4493,9 +4520,15 @@ async def test_submit_config_source_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + servicemanager.SubmitConfigSourceRequest(), + {}, + ], +) async def test_submit_config_source_async( - transport: str = "grpc_asyncio", - request_type=servicemanager.SubmitConfigSourceRequest, + request_type, transport: str = "grpc_asyncio" ): client = ServiceManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -4504,7 +4537,7 @@ async def test_submit_config_source_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( @@ -4526,11 +4559,6 @@ async def test_submit_config_source_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_submit_config_source_async_from_dict(): - await test_submit_config_source_async(request_type=dict) - - def test_submit_config_source_field_headers(): client = ServiceManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4705,8 +4733,8 @@ async def test_submit_config_source_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - servicemanager.ListServiceRolloutsRequest, - dict, + servicemanager.ListServiceRolloutsRequest(), + {}, ], ) def test_list_service_rollouts(request_type, transport: str = "grpc"): @@ -4717,7 +4745,7 @@ def test_list_service_rollouts(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4767,11 +4795,12 @@ def test_list_service_rollouts_non_empty_request_with_auto_populated_field(): client.list_service_rollouts(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == servicemanager.ListServiceRolloutsRequest( + request_msg = servicemanager.ListServiceRolloutsRequest( service_name="service_name_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_service_rollouts_use_cached_wrapped_rpc(): @@ -4857,9 +4886,15 @@ async def test_list_service_rollouts_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + servicemanager.ListServiceRolloutsRequest(), + {}, + ], +) async def test_list_service_rollouts_async( - transport: str = "grpc_asyncio", - request_type=servicemanager.ListServiceRolloutsRequest, + request_type, transport: str = "grpc_asyncio" ): client = ServiceManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -4868,7 +4903,7 @@ async def test_list_service_rollouts_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( @@ -4893,11 +4928,6 @@ async def test_list_service_rollouts_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_service_rollouts_async_from_dict(): - await test_list_service_rollouts_async(request_type=dict) - - def test_list_service_rollouts_field_headers(): client = ServiceManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5260,8 +5290,8 @@ async def test_list_service_rollouts_async_pages(): @pytest.mark.parametrize( "request_type", [ - servicemanager.GetServiceRolloutRequest, - dict, + servicemanager.GetServiceRolloutRequest(), + {}, ], ) def test_get_service_rollout(request_type, transport: str = "grpc"): @@ -5272,7 +5302,7 @@ def test_get_service_rollout(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5327,10 +5357,11 @@ def test_get_service_rollout_non_empty_request_with_auto_populated_field(): client.get_service_rollout(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == servicemanager.GetServiceRolloutRequest( + request_msg = servicemanager.GetServiceRolloutRequest( service_name="service_name_value", rollout_id="rollout_id_value", ) + assert args[0] == request_msg def test_get_service_rollout_use_cached_wrapped_rpc(): @@ -5415,10 +5446,14 @@ async def test_get_service_rollout_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_service_rollout_async( - transport: str = "grpc_asyncio", - request_type=servicemanager.GetServiceRolloutRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + servicemanager.GetServiceRolloutRequest(), + {}, + ], +) +async def test_get_service_rollout_async(request_type, transport: str = "grpc_asyncio"): client = ServiceManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5426,7 +5461,7 @@ async def test_get_service_rollout_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( @@ -5457,11 +5492,6 @@ async def test_get_service_rollout_async( assert response.service_name == "service_name_value" -@pytest.mark.asyncio -async def test_get_service_rollout_async_from_dict(): - await test_get_service_rollout_async(request_type=dict) - - def test_get_service_rollout_field_headers(): client = ServiceManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5624,8 +5654,8 @@ async def test_get_service_rollout_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - servicemanager.CreateServiceRolloutRequest, - dict, + servicemanager.CreateServiceRolloutRequest(), + {}, ], ) def test_create_service_rollout(request_type, transport: str = "grpc"): @@ -5636,7 +5666,7 @@ def test_create_service_rollout(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5681,9 +5711,10 @@ def test_create_service_rollout_non_empty_request_with_auto_populated_field(): client.create_service_rollout(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == servicemanager.CreateServiceRolloutRequest( + request_msg = servicemanager.CreateServiceRolloutRequest( service_name="service_name_value", ) + assert args[0] == request_msg def test_create_service_rollout_use_cached_wrapped_rpc(): @@ -5779,9 +5810,15 @@ async def test_create_service_rollout_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + servicemanager.CreateServiceRolloutRequest(), + {}, + ], +) async def test_create_service_rollout_async( - transport: str = "grpc_asyncio", - request_type=servicemanager.CreateServiceRolloutRequest, + request_type, transport: str = "grpc_asyncio" ): client = ServiceManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -5790,7 +5827,7 @@ async def test_create_service_rollout_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( @@ -5812,11 +5849,6 @@ async def test_create_service_rollout_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_service_rollout_async_from_dict(): - await test_create_service_rollout_async(request_type=dict) - - def test_create_service_rollout_field_headers(): client = ServiceManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5981,8 +6013,8 @@ async def test_create_service_rollout_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - servicemanager.GenerateConfigReportRequest, - dict, + servicemanager.GenerateConfigReportRequest(), + {}, ], ) def test_generate_config_report(request_type, transport: str = "grpc"): @@ -5993,7 +6025,7 @@ def test_generate_config_report(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6041,7 +6073,8 @@ def test_generate_config_report_non_empty_request_with_auto_populated_field(): client.generate_config_report(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == servicemanager.GenerateConfigReportRequest() + request_msg = servicemanager.GenerateConfigReportRequest() + assert args[0] == request_msg def test_generate_config_report_use_cached_wrapped_rpc(): @@ -6127,9 +6160,15 @@ async def test_generate_config_report_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + servicemanager.GenerateConfigReportRequest(), + {}, + ], +) async def test_generate_config_report_async( - transport: str = "grpc_asyncio", - request_type=servicemanager.GenerateConfigReportRequest, + request_type, transport: str = "grpc_asyncio" ): client = ServiceManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -6138,7 +6177,7 @@ async def test_generate_config_report_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( @@ -6165,11 +6204,6 @@ async def test_generate_config_report_async( assert response.id == "id_value" -@pytest.mark.asyncio -async def test_generate_config_report_async_from_dict(): - await test_generate_config_report_async(request_type=dict) - - def test_generate_config_report_flattened(): client = ServiceManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8951,7 +8985,6 @@ def test_list_services_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = servicemanager.ListServicesRequest() - assert args[0] == request_msg @@ -8972,7 +9005,6 @@ def test_get_service_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = servicemanager.GetServiceRequest() - assert args[0] == request_msg @@ -8993,7 +9025,6 @@ def test_create_service_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = servicemanager.CreateServiceRequest() - assert args[0] == request_msg @@ -9014,7 +9045,6 @@ def test_delete_service_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = servicemanager.DeleteServiceRequest() - assert args[0] == request_msg @@ -9035,7 +9065,6 @@ def test_undelete_service_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = servicemanager.UndeleteServiceRequest() - assert args[0] == request_msg @@ -9058,7 +9087,6 @@ def test_list_service_configs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = servicemanager.ListServiceConfigsRequest() - assert args[0] == request_msg @@ -9081,7 +9109,6 @@ def test_get_service_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = servicemanager.GetServiceConfigRequest() - assert args[0] == request_msg @@ -9104,7 +9131,6 @@ def test_create_service_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = servicemanager.CreateServiceConfigRequest() - assert args[0] == request_msg @@ -9127,7 +9153,6 @@ def test_submit_config_source_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = servicemanager.SubmitConfigSourceRequest() - assert args[0] == request_msg @@ -9150,7 +9175,6 @@ def test_list_service_rollouts_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = servicemanager.ListServiceRolloutsRequest() - assert args[0] == request_msg @@ -9173,7 +9197,6 @@ def test_get_service_rollout_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = servicemanager.GetServiceRolloutRequest() - assert args[0] == request_msg @@ -9196,7 +9219,6 @@ def test_create_service_rollout_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = servicemanager.CreateServiceRolloutRequest() - assert args[0] == request_msg @@ -9219,7 +9241,6 @@ def test_generate_config_report_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = servicemanager.GenerateConfigReportRequest() - assert args[0] == request_msg @@ -9260,7 +9281,6 @@ async def test_list_services_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = servicemanager.ListServicesRequest() - assert args[0] == request_msg @@ -9288,7 +9308,6 @@ async def test_get_service_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = servicemanager.GetServiceRequest() - assert args[0] == request_msg @@ -9313,7 +9332,6 @@ async def test_create_service_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = servicemanager.CreateServiceRequest() - assert args[0] == request_msg @@ -9338,7 +9356,6 @@ async def test_delete_service_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = servicemanager.DeleteServiceRequest() - assert args[0] == request_msg @@ -9363,7 +9380,6 @@ async def test_undelete_service_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = servicemanager.UndeleteServiceRequest() - assert args[0] == request_msg @@ -9392,7 +9408,6 @@ async def test_list_service_configs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = servicemanager.ListServiceConfigsRequest() - assert args[0] == request_msg @@ -9424,7 +9439,6 @@ async def test_get_service_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = servicemanager.GetServiceConfigRequest() - assert args[0] == request_msg @@ -9456,7 +9470,6 @@ async def test_create_service_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = servicemanager.CreateServiceConfigRequest() - assert args[0] == request_msg @@ -9483,7 +9496,6 @@ async def test_submit_config_source_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = servicemanager.SubmitConfigSourceRequest() - assert args[0] == request_msg @@ -9512,7 +9524,6 @@ async def test_list_service_rollouts_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = servicemanager.ListServiceRolloutsRequest() - assert args[0] == request_msg @@ -9544,7 +9555,6 @@ async def test_get_service_rollout_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = servicemanager.GetServiceRolloutRequest() - assert args[0] == request_msg @@ -9571,7 +9581,6 @@ async def test_create_service_rollout_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = servicemanager.CreateServiceRolloutRequest() - assert args[0] == request_msg @@ -9601,7 +9610,6 @@ async def test_generate_config_report_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = servicemanager.GenerateConfigReportRequest() - assert args[0] == request_msg @@ -12212,7 +12220,6 @@ def test_list_services_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = servicemanager.ListServicesRequest() - assert args[0] == request_msg @@ -12232,7 +12239,6 @@ def test_get_service_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = servicemanager.GetServiceRequest() - assert args[0] == request_msg @@ -12252,7 +12258,6 @@ def test_create_service_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = servicemanager.CreateServiceRequest() - assert args[0] == request_msg @@ -12272,7 +12277,6 @@ def test_delete_service_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = servicemanager.DeleteServiceRequest() - assert args[0] == request_msg @@ -12292,7 +12296,6 @@ def test_undelete_service_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = servicemanager.UndeleteServiceRequest() - assert args[0] == request_msg @@ -12314,7 +12317,6 @@ def test_list_service_configs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = servicemanager.ListServiceConfigsRequest() - assert args[0] == request_msg @@ -12336,7 +12338,6 @@ def test_get_service_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = servicemanager.GetServiceConfigRequest() - assert args[0] == request_msg @@ -12358,7 +12359,6 @@ def test_create_service_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = servicemanager.CreateServiceConfigRequest() - assert args[0] == request_msg @@ -12380,7 +12380,6 @@ def test_submit_config_source_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = servicemanager.SubmitConfigSourceRequest() - assert args[0] == request_msg @@ -12402,7 +12401,6 @@ def test_list_service_rollouts_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = servicemanager.ListServiceRolloutsRequest() - assert args[0] == request_msg @@ -12424,7 +12422,6 @@ def test_get_service_rollout_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = servicemanager.GetServiceRolloutRequest() - assert args[0] == request_msg @@ -12446,7 +12443,6 @@ def test_create_service_rollout_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = servicemanager.CreateServiceRolloutRequest() - assert args[0] == request_msg @@ -12468,7 +12464,6 @@ def test_generate_config_report_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = servicemanager.GenerateConfigReportRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-service-usage/noxfile.py b/packages/google-cloud-service-usage/noxfile.py index eb5a23d3ceaa..257a0a3d32c2 100644 --- a/packages/google-cloud-service-usage/noxfile.py +++ b/packages/google-cloud-service-usage/noxfile.py @@ -47,7 +47,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-service-usage" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-service-usage/setup.py b/packages/google-cloud-service-usage/setup.py index 7b0b069d12f8..81e525f5379e 100644 --- a/packages/google-cloud-service-usage/setup.py +++ b/packages/google-cloud-service-usage/setup.py @@ -45,7 +45,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/google-cloud-service-usage/testing/constraints-3.10.txt b/packages/google-cloud-service-usage/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-service-usage/testing/constraints-3.10.txt +++ b/packages/google-cloud-service-usage/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-service-usage/tests/unit/gapic/service_usage_v1/test_service_usage.py b/packages/google-cloud-service-usage/tests/unit/gapic/service_usage_v1/test_service_usage.py index 7ffcce85fe7c..ea42b50a15f4 100644 --- a/packages/google-cloud-service-usage/tests/unit/gapic/service_usage_v1/test_service_usage.py +++ b/packages/google-cloud-service-usage/tests/unit/gapic/service_usage_v1/test_service_usage.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" @@ -1296,8 +1312,8 @@ def test_service_usage_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - serviceusage.EnableServiceRequest, - dict, + serviceusage.EnableServiceRequest(), + {}, ], ) def test_enable_service(request_type, transport: str = "grpc"): @@ -1308,7 +1324,7 @@ def test_enable_service(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.enable_service), "__call__") as call: @@ -1349,9 +1365,10 @@ def test_enable_service_non_empty_request_with_auto_populated_field(): client.enable_service(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == serviceusage.EnableServiceRequest( + request_msg = serviceusage.EnableServiceRequest( name="name_value", ) + assert args[0] == request_msg def test_enable_service_use_cached_wrapped_rpc(): @@ -1442,9 +1459,14 @@ async def test_enable_service_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_enable_service_async( - transport: str = "grpc_asyncio", request_type=serviceusage.EnableServiceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + serviceusage.EnableServiceRequest(), + {}, + ], +) +async def test_enable_service_async(request_type, transport: str = "grpc_asyncio"): client = ServiceUsageAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1452,7 +1474,7 @@ async def test_enable_service_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.enable_service), "__call__") as call: @@ -1472,11 +1494,6 @@ async def test_enable_service_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_enable_service_async_from_dict(): - await test_enable_service_async(request_type=dict) - - def test_enable_service_field_headers(): client = ServiceUsageClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1541,8 +1558,8 @@ async def test_enable_service_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - serviceusage.DisableServiceRequest, - dict, + serviceusage.DisableServiceRequest(), + {}, ], ) def test_disable_service(request_type, transport: str = "grpc"): @@ -1553,7 +1570,7 @@ def test_disable_service(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.disable_service), "__call__") as call: @@ -1594,9 +1611,10 @@ def test_disable_service_non_empty_request_with_auto_populated_field(): client.disable_service(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == serviceusage.DisableServiceRequest( + request_msg = serviceusage.DisableServiceRequest( name="name_value", ) + assert args[0] == request_msg def test_disable_service_use_cached_wrapped_rpc(): @@ -1687,9 +1705,14 @@ async def test_disable_service_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_disable_service_async( - transport: str = "grpc_asyncio", request_type=serviceusage.DisableServiceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + serviceusage.DisableServiceRequest(), + {}, + ], +) +async def test_disable_service_async(request_type, transport: str = "grpc_asyncio"): client = ServiceUsageAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1697,7 +1720,7 @@ async def test_disable_service_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.disable_service), "__call__") as call: @@ -1717,11 +1740,6 @@ async def test_disable_service_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_disable_service_async_from_dict(): - await test_disable_service_async(request_type=dict) - - def test_disable_service_field_headers(): client = ServiceUsageClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1786,8 +1804,8 @@ async def test_disable_service_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - serviceusage.GetServiceRequest, - dict, + serviceusage.GetServiceRequest(), + {}, ], ) def test_get_service(request_type, transport: str = "grpc"): @@ -1798,7 +1816,7 @@ def test_get_service(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_service), "__call__") as call: @@ -1846,9 +1864,10 @@ def test_get_service_non_empty_request_with_auto_populated_field(): client.get_service(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == serviceusage.GetServiceRequest( + request_msg = serviceusage.GetServiceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_service_use_cached_wrapped_rpc(): @@ -1929,9 +1948,14 @@ async def test_get_service_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_service_async( - transport: str = "grpc_asyncio", request_type=serviceusage.GetServiceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + serviceusage.GetServiceRequest(), + {}, + ], +) +async def test_get_service_async(request_type, transport: str = "grpc_asyncio"): client = ServiceUsageAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1939,7 +1963,7 @@ async def test_get_service_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_service), "__call__") as call: @@ -1966,11 +1990,6 @@ async def test_get_service_async( assert response.state == resources.State.DISABLED -@pytest.mark.asyncio -async def test_get_service_async_from_dict(): - await test_get_service_async(request_type=dict) - - def test_get_service_field_headers(): client = ServiceUsageClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2033,8 +2052,8 @@ async def test_get_service_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - serviceusage.ListServicesRequest, - dict, + serviceusage.ListServicesRequest(), + {}, ], ) def test_list_services(request_type, transport: str = "grpc"): @@ -2045,7 +2064,7 @@ def test_list_services(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_services), "__call__") as call: @@ -2091,11 +2110,12 @@ def test_list_services_non_empty_request_with_auto_populated_field(): client.list_services(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == serviceusage.ListServicesRequest( + request_msg = serviceusage.ListServicesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_services_use_cached_wrapped_rpc(): @@ -2176,9 +2196,14 @@ async def test_list_services_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_services_async( - transport: str = "grpc_asyncio", request_type=serviceusage.ListServicesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + serviceusage.ListServicesRequest(), + {}, + ], +) +async def test_list_services_async(request_type, transport: str = "grpc_asyncio"): client = ServiceUsageAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2186,7 +2211,7 @@ async def test_list_services_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_services), "__call__") as call: @@ -2209,11 +2234,6 @@ async def test_list_services_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_services_async_from_dict(): - await test_list_services_async(request_type=dict) - - def test_list_services_field_headers(): client = ServiceUsageClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2468,8 +2488,8 @@ async def test_list_services_async_pages(): @pytest.mark.parametrize( "request_type", [ - serviceusage.BatchEnableServicesRequest, - dict, + serviceusage.BatchEnableServicesRequest(), + {}, ], ) def test_batch_enable_services(request_type, transport: str = "grpc"): @@ -2480,7 +2500,7 @@ def test_batch_enable_services(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2525,9 +2545,10 @@ def test_batch_enable_services_non_empty_request_with_auto_populated_field(): client.batch_enable_services(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == serviceusage.BatchEnableServicesRequest( + request_msg = serviceusage.BatchEnableServicesRequest( parent="parent_value", ) + assert args[0] == request_msg def test_batch_enable_services_use_cached_wrapped_rpc(): @@ -2623,9 +2644,15 @@ async def test_batch_enable_services_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + serviceusage.BatchEnableServicesRequest(), + {}, + ], +) async def test_batch_enable_services_async( - transport: str = "grpc_asyncio", - request_type=serviceusage.BatchEnableServicesRequest, + request_type, transport: str = "grpc_asyncio" ): client = ServiceUsageAsyncClient( credentials=async_anonymous_credentials(), @@ -2634,7 +2661,7 @@ async def test_batch_enable_services_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( @@ -2656,11 +2683,6 @@ async def test_batch_enable_services_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_batch_enable_services_async_from_dict(): - await test_batch_enable_services_async(request_type=dict) - - def test_batch_enable_services_field_headers(): client = ServiceUsageClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2729,8 +2751,8 @@ async def test_batch_enable_services_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - serviceusage.BatchGetServicesRequest, - dict, + serviceusage.BatchGetServicesRequest(), + {}, ], ) def test_batch_get_services(request_type, transport: str = "grpc"): @@ -2741,7 +2763,7 @@ def test_batch_get_services(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2786,9 +2808,10 @@ def test_batch_get_services_non_empty_request_with_auto_populated_field(): client.batch_get_services(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == serviceusage.BatchGetServicesRequest( + request_msg = serviceusage.BatchGetServicesRequest( parent="parent_value", ) + assert args[0] == request_msg def test_batch_get_services_use_cached_wrapped_rpc(): @@ -2873,9 +2896,14 @@ async def test_batch_get_services_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_batch_get_services_async( - transport: str = "grpc_asyncio", request_type=serviceusage.BatchGetServicesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + serviceusage.BatchGetServicesRequest(), + {}, + ], +) +async def test_batch_get_services_async(request_type, transport: str = "grpc_asyncio"): client = ServiceUsageAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2883,7 +2911,7 @@ async def test_batch_get_services_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( @@ -2905,11 +2933,6 @@ async def test_batch_get_services_async( assert isinstance(response, serviceusage.BatchGetServicesResponse) -@pytest.mark.asyncio -async def test_batch_get_services_async_from_dict(): - await test_batch_get_services_async(request_type=dict) - - def test_batch_get_services_field_headers(): client = ServiceUsageClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3396,7 +3419,6 @@ def test_enable_service_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serviceusage.EnableServiceRequest() - assert args[0] == request_msg @@ -3417,7 +3439,6 @@ def test_disable_service_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serviceusage.DisableServiceRequest() - assert args[0] == request_msg @@ -3438,7 +3459,6 @@ def test_get_service_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serviceusage.GetServiceRequest() - assert args[0] == request_msg @@ -3459,7 +3479,6 @@ def test_list_services_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serviceusage.ListServicesRequest() - assert args[0] == request_msg @@ -3482,7 +3501,6 @@ def test_batch_enable_services_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serviceusage.BatchEnableServicesRequest() - assert args[0] == request_msg @@ -3505,7 +3523,6 @@ def test_batch_get_services_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serviceusage.BatchGetServicesRequest() - assert args[0] == request_msg @@ -3544,7 +3561,6 @@ async def test_enable_service_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serviceusage.EnableServiceRequest() - assert args[0] == request_msg @@ -3569,7 +3585,6 @@ async def test_disable_service_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serviceusage.DisableServiceRequest() - assert args[0] == request_msg @@ -3598,7 +3613,6 @@ async def test_get_service_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serviceusage.GetServiceRequest() - assert args[0] == request_msg @@ -3625,7 +3639,6 @@ async def test_list_services_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serviceusage.ListServicesRequest() - assert args[0] == request_msg @@ -3652,7 +3665,6 @@ async def test_batch_enable_services_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serviceusage.BatchEnableServicesRequest() - assert args[0] == request_msg @@ -3679,7 +3691,6 @@ async def test_batch_get_services_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serviceusage.BatchGetServicesRequest() - assert args[0] == request_msg @@ -4604,7 +4615,6 @@ def test_enable_service_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serviceusage.EnableServiceRequest() - assert args[0] == request_msg @@ -4624,7 +4634,6 @@ def test_disable_service_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serviceusage.DisableServiceRequest() - assert args[0] == request_msg @@ -4644,7 +4653,6 @@ def test_get_service_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serviceusage.GetServiceRequest() - assert args[0] == request_msg @@ -4664,7 +4672,6 @@ def test_list_services_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serviceusage.ListServicesRequest() - assert args[0] == request_msg @@ -4686,7 +4693,6 @@ def test_batch_enable_services_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serviceusage.BatchEnableServicesRequest() - assert args[0] == request_msg @@ -4708,7 +4714,6 @@ def test_batch_get_services_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = serviceusage.BatchGetServicesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-servicehealth/noxfile.py b/packages/google-cloud-servicehealth/noxfile.py index cc9d9bbc972e..0fc8677b4458 100644 --- a/packages/google-cloud-servicehealth/noxfile.py +++ b/packages/google-cloud-servicehealth/noxfile.py @@ -47,7 +47,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-servicehealth" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-servicehealth/setup.py b/packages/google-cloud-servicehealth/setup.py index 4db73e5ec6ae..48fb14123db0 100644 --- a/packages/google-cloud-servicehealth/setup.py +++ b/packages/google-cloud-servicehealth/setup.py @@ -45,7 +45,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/google-cloud-servicehealth/testing/constraints-3.10.txt b/packages/google-cloud-servicehealth/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-servicehealth/testing/constraints-3.10.txt +++ b/packages/google-cloud-servicehealth/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-servicehealth/tests/unit/gapic/servicehealth_v1/test_service_health.py b/packages/google-cloud-servicehealth/tests/unit/gapic/servicehealth_v1/test_service_health.py index e2994d34fc8b..e77ae0c1e862 100644 --- a/packages/google-cloud-servicehealth/tests/unit/gapic/servicehealth_v1/test_service_health.py +++ b/packages/google-cloud-servicehealth/tests/unit/gapic/servicehealth_v1/test_service_health.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 @@ -109,6 +110,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" @@ -1308,8 +1324,8 @@ def test_service_health_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - event_resources.ListEventsRequest, - dict, + event_resources.ListEventsRequest(), + {}, ], ) def test_list_events(request_type, transport: str = "grpc"): @@ -1320,7 +1336,7 @@ def test_list_events(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_events), "__call__") as call: @@ -1368,11 +1384,12 @@ def test_list_events_non_empty_request_with_auto_populated_field(): client.list_events(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == event_resources.ListEventsRequest( + request_msg = event_resources.ListEventsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_events_use_cached_wrapped_rpc(): @@ -1453,9 +1470,14 @@ async def test_list_events_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_events_async( - transport: str = "grpc_asyncio", request_type=event_resources.ListEventsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + event_resources.ListEventsRequest(), + {}, + ], +) +async def test_list_events_async(request_type, transport: str = "grpc_asyncio"): client = ServiceHealthAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1463,7 +1485,7 @@ async def test_list_events_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_events), "__call__") as call: @@ -1488,11 +1510,6 @@ async def test_list_events_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_events_async_from_dict(): - await test_list_events_async(request_type=dict) - - def test_list_events_field_headers(): client = ServiceHealthClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1829,8 +1846,8 @@ async def test_list_events_async_pages(): @pytest.mark.parametrize( "request_type", [ - event_resources.GetEventRequest, - dict, + event_resources.GetEventRequest(), + {}, ], ) def test_get_event(request_type, transport: str = "grpc"): @@ -1841,7 +1858,7 @@ def test_get_event(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_event), "__call__") as call: @@ -1904,9 +1921,10 @@ def test_get_event_non_empty_request_with_auto_populated_field(): client.get_event(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == event_resources.GetEventRequest( + request_msg = event_resources.GetEventRequest( name="name_value", ) + assert args[0] == request_msg def test_get_event_use_cached_wrapped_rpc(): @@ -1985,9 +2003,14 @@ async def test_get_event_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_event_async( - transport: str = "grpc_asyncio", request_type=event_resources.GetEventRequest -): +@pytest.mark.parametrize( + "request_type", + [ + event_resources.GetEventRequest(), + {}, + ], +) +async def test_get_event_async(request_type, transport: str = "grpc_asyncio"): client = ServiceHealthAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1995,7 +2018,7 @@ async def test_get_event_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_event), "__call__") as call: @@ -2037,11 +2060,6 @@ async def test_get_event_async( assert response.parent_event == "parent_event_value" -@pytest.mark.asyncio -async def test_get_event_async_from_dict(): - await test_get_event_async(request_type=dict) - - def test_get_event_field_headers(): client = ServiceHealthClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2188,8 +2206,8 @@ async def test_get_event_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - event_resources.ListOrganizationEventsRequest, - dict, + event_resources.ListOrganizationEventsRequest(), + {}, ], ) def test_list_organization_events(request_type, transport: str = "grpc"): @@ -2200,7 +2218,7 @@ def test_list_organization_events(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2252,11 +2270,12 @@ def test_list_organization_events_non_empty_request_with_auto_populated_field(): client.list_organization_events(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == event_resources.ListOrganizationEventsRequest( + request_msg = event_resources.ListOrganizationEventsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_organization_events_use_cached_wrapped_rpc(): @@ -2342,9 +2361,15 @@ async def test_list_organization_events_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + event_resources.ListOrganizationEventsRequest(), + {}, + ], +) async def test_list_organization_events_async( - transport: str = "grpc_asyncio", - request_type=event_resources.ListOrganizationEventsRequest, + request_type, transport: str = "grpc_asyncio" ): client = ServiceHealthAsyncClient( credentials=async_anonymous_credentials(), @@ -2353,7 +2378,7 @@ async def test_list_organization_events_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( @@ -2380,11 +2405,6 @@ async def test_list_organization_events_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_organization_events_async_from_dict(): - await test_list_organization_events_async(request_type=dict) - - def test_list_organization_events_field_headers(): client = ServiceHealthClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2739,8 +2759,8 @@ async def test_list_organization_events_async_pages(): @pytest.mark.parametrize( "request_type", [ - event_resources.GetOrganizationEventRequest, - dict, + event_resources.GetOrganizationEventRequest(), + {}, ], ) def test_get_organization_event(request_type, transport: str = "grpc"): @@ -2751,7 +2771,7 @@ def test_get_organization_event(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2819,9 +2839,10 @@ def test_get_organization_event_non_empty_request_with_auto_populated_field(): client.get_organization_event(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == event_resources.GetOrganizationEventRequest( + request_msg = event_resources.GetOrganizationEventRequest( name="name_value", ) + assert args[0] == request_msg def test_get_organization_event_use_cached_wrapped_rpc(): @@ -2907,9 +2928,15 @@ async def test_get_organization_event_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + event_resources.GetOrganizationEventRequest(), + {}, + ], +) async def test_get_organization_event_async( - transport: str = "grpc_asyncio", - request_type=event_resources.GetOrganizationEventRequest, + request_type, transport: str = "grpc_asyncio" ): client = ServiceHealthAsyncClient( credentials=async_anonymous_credentials(), @@ -2918,7 +2945,7 @@ async def test_get_organization_event_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( @@ -2963,11 +2990,6 @@ async def test_get_organization_event_async( assert response.parent_event == "parent_event_value" -@pytest.mark.asyncio -async def test_get_organization_event_async_from_dict(): - await test_get_organization_event_async(request_type=dict) - - def test_get_organization_event_field_headers(): client = ServiceHealthClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3122,8 +3144,8 @@ async def test_get_organization_event_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - event_resources.ListOrganizationImpactsRequest, - dict, + event_resources.ListOrganizationImpactsRequest(), + {}, ], ) def test_list_organization_impacts(request_type, transport: str = "grpc"): @@ -3134,7 +3156,7 @@ def test_list_organization_impacts(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3186,11 +3208,12 @@ def test_list_organization_impacts_non_empty_request_with_auto_populated_field() client.list_organization_impacts(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == event_resources.ListOrganizationImpactsRequest( + request_msg = event_resources.ListOrganizationImpactsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_organization_impacts_use_cached_wrapped_rpc(): @@ -3276,9 +3299,15 @@ async def test_list_organization_impacts_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + event_resources.ListOrganizationImpactsRequest(), + {}, + ], +) async def test_list_organization_impacts_async( - transport: str = "grpc_asyncio", - request_type=event_resources.ListOrganizationImpactsRequest, + request_type, transport: str = "grpc_asyncio" ): client = ServiceHealthAsyncClient( credentials=async_anonymous_credentials(), @@ -3287,7 +3316,7 @@ async def test_list_organization_impacts_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( @@ -3314,11 +3343,6 @@ async def test_list_organization_impacts_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_organization_impacts_async_from_dict(): - await test_list_organization_impacts_async(request_type=dict) - - def test_list_organization_impacts_field_headers(): client = ServiceHealthClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3673,8 +3697,8 @@ async def test_list_organization_impacts_async_pages(): @pytest.mark.parametrize( "request_type", [ - event_resources.GetOrganizationImpactRequest, - dict, + event_resources.GetOrganizationImpactRequest(), + {}, ], ) def test_get_organization_impact(request_type, transport: str = "grpc"): @@ -3685,7 +3709,7 @@ def test_get_organization_impact(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3735,9 +3759,10 @@ def test_get_organization_impact_non_empty_request_with_auto_populated_field(): client.get_organization_impact(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == event_resources.GetOrganizationImpactRequest( + request_msg = event_resources.GetOrganizationImpactRequest( name="name_value", ) + assert args[0] == request_msg def test_get_organization_impact_use_cached_wrapped_rpc(): @@ -3823,9 +3848,15 @@ async def test_get_organization_impact_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + event_resources.GetOrganizationImpactRequest(), + {}, + ], +) async def test_get_organization_impact_async( - transport: str = "grpc_asyncio", - request_type=event_resources.GetOrganizationImpactRequest, + request_type, transport: str = "grpc_asyncio" ): client = ServiceHealthAsyncClient( credentials=async_anonymous_credentials(), @@ -3834,7 +3865,7 @@ async def test_get_organization_impact_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( @@ -3861,11 +3892,6 @@ async def test_get_organization_impact_async( assert response.events == ["events_value"] -@pytest.mark.asyncio -async def test_get_organization_impact_async_from_dict(): - await test_get_organization_impact_async(request_type=dict) - - def test_get_organization_impact_field_headers(): client = ServiceHealthClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5476,7 +5502,6 @@ def test_list_events_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = event_resources.ListEventsRequest() - assert args[0] == request_msg @@ -5497,7 +5522,6 @@ def test_get_event_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = event_resources.GetEventRequest() - assert args[0] == request_msg @@ -5520,7 +5544,6 @@ def test_list_organization_events_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = event_resources.ListOrganizationEventsRequest() - assert args[0] == request_msg @@ -5543,7 +5566,6 @@ def test_get_organization_event_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = event_resources.GetOrganizationEventRequest() - assert args[0] == request_msg @@ -5566,7 +5588,6 @@ def test_list_organization_impacts_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = event_resources.ListOrganizationImpactsRequest() - assert args[0] == request_msg @@ -5589,7 +5610,6 @@ def test_get_organization_impact_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = event_resources.GetOrganizationImpactRequest() - assert args[0] == request_msg @@ -5631,7 +5651,6 @@ async def test_list_events_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = event_resources.ListEventsRequest() - assert args[0] == request_msg @@ -5666,7 +5685,6 @@ async def test_get_event_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = event_resources.GetEventRequest() - assert args[0] == request_msg @@ -5696,7 +5714,6 @@ async def test_list_organization_events_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = event_resources.ListOrganizationEventsRequest() - assert args[0] == request_msg @@ -5732,7 +5749,6 @@ async def test_get_organization_event_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = event_resources.GetOrganizationEventRequest() - assert args[0] == request_msg @@ -5762,7 +5778,6 @@ async def test_list_organization_impacts_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = event_resources.ListOrganizationImpactsRequest() - assert args[0] == request_msg @@ -5792,7 +5807,6 @@ async def test_get_organization_impact_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = event_resources.GetOrganizationImpactRequest() - assert args[0] == request_msg @@ -6799,7 +6813,6 @@ def test_list_events_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = event_resources.ListEventsRequest() - assert args[0] == request_msg @@ -6819,7 +6832,6 @@ def test_get_event_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = event_resources.GetEventRequest() - assert args[0] == request_msg @@ -6841,7 +6853,6 @@ def test_list_organization_events_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = event_resources.ListOrganizationEventsRequest() - assert args[0] == request_msg @@ -6863,7 +6874,6 @@ def test_get_organization_event_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = event_resources.GetOrganizationEventRequest() - assert args[0] == request_msg @@ -6885,7 +6895,6 @@ def test_list_organization_impacts_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = event_resources.ListOrganizationImpactsRequest() - assert args[0] == request_msg @@ -6907,7 +6916,6 @@ def test_get_organization_impact_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = event_resources.GetOrganizationImpactRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-shell/noxfile.py b/packages/google-cloud-shell/noxfile.py index 1e9b9a26ce1c..e28e2365335d 100644 --- a/packages/google-cloud-shell/noxfile.py +++ b/packages/google-cloud-shell/noxfile.py @@ -47,7 +47,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-shell" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-shell/setup.py b/packages/google-cloud-shell/setup.py index 9f1d6eb918cf..268f5e47af1f 100644 --- a/packages/google-cloud-shell/setup.py +++ b/packages/google-cloud-shell/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/google-cloud-shell/testing/constraints-3.10.txt b/packages/google-cloud-shell/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-shell/testing/constraints-3.10.txt +++ b/packages/google-cloud-shell/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-shell/tests/unit/gapic/shell_v1/test_cloud_shell_service.py b/packages/google-cloud-shell/tests/unit/gapic/shell_v1/test_cloud_shell_service.py index 540acbc5db71..aabc9368cc03 100644 --- a/packages/google-cloud-shell/tests/unit/gapic/shell_v1/test_cloud_shell_service.py +++ b/packages/google-cloud-shell/tests/unit/gapic/shell_v1/test_cloud_shell_service.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" @@ -1353,8 +1369,8 @@ def test_cloud_shell_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - cloudshell.GetEnvironmentRequest, - dict, + cloudshell.GetEnvironmentRequest(), + {}, ], ) def test_get_environment(request_type, transport: str = "grpc"): @@ -1365,7 +1381,7 @@ def test_get_environment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_environment), "__call__") as call: @@ -1425,9 +1441,10 @@ def test_get_environment_non_empty_request_with_auto_populated_field(): client.get_environment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudshell.GetEnvironmentRequest( + request_msg = cloudshell.GetEnvironmentRequest( name="name_value", ) + assert args[0] == request_msg def test_get_environment_use_cached_wrapped_rpc(): @@ -1508,9 +1525,14 @@ async def test_get_environment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_environment_async( - transport: str = "grpc_asyncio", request_type=cloudshell.GetEnvironmentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudshell.GetEnvironmentRequest(), + {}, + ], +) +async def test_get_environment_async(request_type, transport: str = "grpc_asyncio"): client = CloudShellServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1518,7 +1540,7 @@ async def test_get_environment_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_environment), "__call__") as call: @@ -1557,11 +1579,6 @@ async def test_get_environment_async( assert response.public_keys == ["public_keys_value"] -@pytest.mark.asyncio -async def test_get_environment_async_from_dict(): - await test_get_environment_async(request_type=dict) - - def test_get_environment_field_headers(): client = CloudShellServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1708,8 +1725,8 @@ async def test_get_environment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloudshell.StartEnvironmentRequest, - dict, + cloudshell.StartEnvironmentRequest(), + {}, ], ) def test_start_environment(request_type, transport: str = "grpc"): @@ -1720,7 +1737,7 @@ def test_start_environment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1766,10 +1783,11 @@ def test_start_environment_non_empty_request_with_auto_populated_field(): client.start_environment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudshell.StartEnvironmentRequest( + request_msg = cloudshell.StartEnvironmentRequest( name="name_value", access_token="access_token_value", ) + assert args[0] == request_msg def test_start_environment_use_cached_wrapped_rpc(): @@ -1862,9 +1880,14 @@ async def test_start_environment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_start_environment_async( - transport: str = "grpc_asyncio", request_type=cloudshell.StartEnvironmentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudshell.StartEnvironmentRequest(), + {}, + ], +) +async def test_start_environment_async(request_type, transport: str = "grpc_asyncio"): client = CloudShellServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1872,7 +1895,7 @@ async def test_start_environment_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( @@ -1894,11 +1917,6 @@ async def test_start_environment_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_start_environment_async_from_dict(): - await test_start_environment_async(request_type=dict) - - def test_start_environment_field_headers(): client = CloudShellServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1967,8 +1985,8 @@ async def test_start_environment_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - cloudshell.AuthorizeEnvironmentRequest, - dict, + cloudshell.AuthorizeEnvironmentRequest(), + {}, ], ) def test_authorize_environment(request_type, transport: str = "grpc"): @@ -1979,7 +1997,7 @@ def test_authorize_environment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2026,11 +2044,12 @@ def test_authorize_environment_non_empty_request_with_auto_populated_field(): client.authorize_environment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudshell.AuthorizeEnvironmentRequest( + request_msg = cloudshell.AuthorizeEnvironmentRequest( name="name_value", access_token="access_token_value", id_token="id_token_value", ) + assert args[0] == request_msg def test_authorize_environment_use_cached_wrapped_rpc(): @@ -2126,8 +2145,15 @@ async def test_authorize_environment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloudshell.AuthorizeEnvironmentRequest(), + {}, + ], +) async def test_authorize_environment_async( - transport: str = "grpc_asyncio", request_type=cloudshell.AuthorizeEnvironmentRequest + request_type, transport: str = "grpc_asyncio" ): client = CloudShellServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2136,7 +2162,7 @@ async def test_authorize_environment_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( @@ -2158,11 +2184,6 @@ async def test_authorize_environment_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_authorize_environment_async_from_dict(): - await test_authorize_environment_async(request_type=dict) - - def test_authorize_environment_field_headers(): client = CloudShellServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2231,8 +2252,8 @@ async def test_authorize_environment_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - cloudshell.AddPublicKeyRequest, - dict, + cloudshell.AddPublicKeyRequest(), + {}, ], ) def test_add_public_key(request_type, transport: str = "grpc"): @@ -2243,7 +2264,7 @@ def test_add_public_key(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.add_public_key), "__call__") as call: @@ -2285,10 +2306,11 @@ def test_add_public_key_non_empty_request_with_auto_populated_field(): client.add_public_key(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudshell.AddPublicKeyRequest( + request_msg = cloudshell.AddPublicKeyRequest( environment="environment_value", key="key_value", ) + assert args[0] == request_msg def test_add_public_key_use_cached_wrapped_rpc(): @@ -2379,9 +2401,14 @@ async def test_add_public_key_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_add_public_key_async( - transport: str = "grpc_asyncio", request_type=cloudshell.AddPublicKeyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudshell.AddPublicKeyRequest(), + {}, + ], +) +async def test_add_public_key_async(request_type, transport: str = "grpc_asyncio"): client = CloudShellServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2389,7 +2416,7 @@ async def test_add_public_key_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.add_public_key), "__call__") as call: @@ -2409,11 +2436,6 @@ async def test_add_public_key_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_add_public_key_async_from_dict(): - await test_add_public_key_async(request_type=dict) - - def test_add_public_key_field_headers(): client = CloudShellServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2478,8 +2500,8 @@ async def test_add_public_key_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - cloudshell.RemovePublicKeyRequest, - dict, + cloudshell.RemovePublicKeyRequest(), + {}, ], ) def test_remove_public_key(request_type, transport: str = "grpc"): @@ -2490,7 +2512,7 @@ def test_remove_public_key(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2536,10 +2558,11 @@ def test_remove_public_key_non_empty_request_with_auto_populated_field(): client.remove_public_key(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudshell.RemovePublicKeyRequest( + request_msg = cloudshell.RemovePublicKeyRequest( environment="environment_value", key="key_value", ) + assert args[0] == request_msg def test_remove_public_key_use_cached_wrapped_rpc(): @@ -2632,9 +2655,14 @@ async def test_remove_public_key_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_remove_public_key_async( - transport: str = "grpc_asyncio", request_type=cloudshell.RemovePublicKeyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudshell.RemovePublicKeyRequest(), + {}, + ], +) +async def test_remove_public_key_async(request_type, transport: str = "grpc_asyncio"): client = CloudShellServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2642,7 +2670,7 @@ async def test_remove_public_key_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( @@ -2664,11 +2692,6 @@ async def test_remove_public_key_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_remove_public_key_async_from_dict(): - await test_remove_public_key_async(request_type=dict) - - def test_remove_public_key_field_headers(): client = CloudShellServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3202,7 +3225,6 @@ def test_get_environment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudshell.GetEnvironmentRequest() - assert args[0] == request_msg @@ -3225,7 +3247,6 @@ def test_start_environment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudshell.StartEnvironmentRequest() - assert args[0] == request_msg @@ -3248,7 +3269,6 @@ def test_authorize_environment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudshell.AuthorizeEnvironmentRequest() - assert args[0] == request_msg @@ -3269,7 +3289,6 @@ def test_add_public_key_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudshell.AddPublicKeyRequest() - assert args[0] == request_msg @@ -3292,7 +3311,6 @@ def test_remove_public_key_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudshell.RemovePublicKeyRequest() - assert args[0] == request_msg @@ -3341,7 +3359,6 @@ async def test_get_environment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudshell.GetEnvironmentRequest() - assert args[0] == request_msg @@ -3368,7 +3385,6 @@ async def test_start_environment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudshell.StartEnvironmentRequest() - assert args[0] == request_msg @@ -3395,7 +3411,6 @@ async def test_authorize_environment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudshell.AuthorizeEnvironmentRequest() - assert args[0] == request_msg @@ -3420,7 +3435,6 @@ async def test_add_public_key_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudshell.AddPublicKeyRequest() - assert args[0] == request_msg @@ -3447,7 +3461,6 @@ async def test_remove_public_key_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudshell.RemovePublicKeyRequest() - assert args[0] == request_msg @@ -4128,7 +4141,6 @@ def test_get_environment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudshell.GetEnvironmentRequest() - assert args[0] == request_msg @@ -4150,7 +4162,6 @@ def test_start_environment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudshell.StartEnvironmentRequest() - assert args[0] == request_msg @@ -4172,7 +4183,6 @@ def test_authorize_environment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudshell.AuthorizeEnvironmentRequest() - assert args[0] == request_msg @@ -4192,7 +4202,6 @@ def test_add_public_key_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudshell.AddPublicKeyRequest() - assert args[0] == request_msg @@ -4214,7 +4223,6 @@ def test_remove_public_key_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudshell.RemovePublicKeyRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-source-context/noxfile.py b/packages/google-cloud-source-context/noxfile.py index eeef37659ce4..6488b4a11907 100644 --- a/packages/google-cloud-source-context/noxfile.py +++ b/packages/google-cloud-source-context/noxfile.py @@ -47,7 +47,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-source-context" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-source-context/setup.py b/packages/google-cloud-source-context/setup.py index 2e5ed7747452..dac66291ccbe 100644 --- a/packages/google-cloud-source-context/setup.py +++ b/packages/google-cloud-source-context/setup.py @@ -45,7 +45,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/google-cloud-source-context/testing/constraints-3.10.txt b/packages/google-cloud-source-context/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-source-context/testing/constraints-3.10.txt +++ b/packages/google-cloud-source-context/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-spanner/noxfile.py b/packages/google-cloud-spanner/noxfile.py index d21d25cc3186..54ead8405fb9 100644 --- a/packages/google-cloud-spanner/noxfile.py +++ b/packages/google-cloud-spanner/noxfile.py @@ -789,14 +789,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-spanner/tests/unit/gapic/spanner_admin_database_v1/test_database_admin.py b/packages/google-cloud-spanner/tests/unit/gapic/spanner_admin_database_v1/test_database_admin.py index 2bc3137327bc..a96f13f36d22 100644 --- a/packages/google-cloud-spanner/tests/unit/gapic/spanner_admin_database_v1/test_database_admin.py +++ b/packages/google-cloud-spanner/tests/unit/gapic/spanner_admin_database_v1/test_database_admin.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 @@ -133,6 +134,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" @@ -1336,8 +1352,8 @@ def test_database_admin_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - spanner_database_admin.ListDatabasesRequest, - dict, + spanner_database_admin.ListDatabasesRequest(), + {}, ], ) def test_list_databases(request_type, transport: str = "grpc"): @@ -1348,7 +1364,7 @@ def test_list_databases(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_databases), "__call__") as call: @@ -1393,10 +1409,11 @@ def test_list_databases_non_empty_request_with_auto_populated_field(): client.list_databases(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == spanner_database_admin.ListDatabasesRequest( + request_msg = spanner_database_admin.ListDatabasesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_databases_use_cached_wrapped_rpc(): @@ -1477,10 +1494,14 @@ async def test_list_databases_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_databases_async( - transport: str = "grpc_asyncio", - request_type=spanner_database_admin.ListDatabasesRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + spanner_database_admin.ListDatabasesRequest(), + {}, + ], +) +async def test_list_databases_async(request_type, transport: str = "grpc_asyncio"): client = DatabaseAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1488,7 +1509,7 @@ async def test_list_databases_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_databases), "__call__") as call: @@ -1511,11 +1532,6 @@ async def test_list_databases_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_databases_async_from_dict(): - await test_list_databases_async(request_type=dict) - - def test_list_databases_field_headers(): client = DatabaseAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1852,8 +1868,8 @@ async def test_list_databases_async_pages(): @pytest.mark.parametrize( "request_type", [ - spanner_database_admin.CreateDatabaseRequest, - dict, + spanner_database_admin.CreateDatabaseRequest(), + {}, ], ) def test_create_database(request_type, transport: str = "grpc"): @@ -1864,7 +1880,7 @@ def test_create_database(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_database), "__call__") as call: @@ -1906,10 +1922,11 @@ def test_create_database_non_empty_request_with_auto_populated_field(): client.create_database(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == spanner_database_admin.CreateDatabaseRequest( + request_msg = spanner_database_admin.CreateDatabaseRequest( parent="parent_value", create_statement="create_statement_value", ) + assert args[0] == request_msg def test_create_database_use_cached_wrapped_rpc(): @@ -2000,10 +2017,14 @@ async def test_create_database_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_database_async( - transport: str = "grpc_asyncio", - request_type=spanner_database_admin.CreateDatabaseRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + spanner_database_admin.CreateDatabaseRequest(), + {}, + ], +) +async def test_create_database_async(request_type, transport: str = "grpc_asyncio"): client = DatabaseAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2011,7 +2032,7 @@ async def test_create_database_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_database), "__call__") as call: @@ -2031,11 +2052,6 @@ async def test_create_database_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_database_async_from_dict(): - await test_create_database_async(request_type=dict) - - def test_create_database_field_headers(): client = DatabaseAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2192,8 +2208,8 @@ async def test_create_database_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - spanner_database_admin.GetDatabaseRequest, - dict, + spanner_database_admin.GetDatabaseRequest(), + {}, ], ) def test_get_database(request_type, transport: str = "grpc"): @@ -2204,7 +2220,7 @@ def test_get_database(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_database), "__call__") as call: @@ -2260,9 +2276,10 @@ def test_get_database_non_empty_request_with_auto_populated_field(): client.get_database(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == spanner_database_admin.GetDatabaseRequest( + request_msg = spanner_database_admin.GetDatabaseRequest( name="name_value", ) + assert args[0] == request_msg def test_get_database_use_cached_wrapped_rpc(): @@ -2343,10 +2360,14 @@ async def test_get_database_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_database_async( - transport: str = "grpc_asyncio", - request_type=spanner_database_admin.GetDatabaseRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + spanner_database_admin.GetDatabaseRequest(), + {}, + ], +) +async def test_get_database_async(request_type, transport: str = "grpc_asyncio"): client = DatabaseAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2354,7 +2375,7 @@ async def test_get_database_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_database), "__call__") as call: @@ -2389,11 +2410,6 @@ async def test_get_database_async( assert response.reconciling is True -@pytest.mark.asyncio -async def test_get_database_async_from_dict(): - await test_get_database_async(request_type=dict) - - def test_get_database_field_headers(): client = DatabaseAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2540,8 +2556,8 @@ async def test_get_database_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - spanner_database_admin.UpdateDatabaseRequest, - dict, + spanner_database_admin.UpdateDatabaseRequest(), + {}, ], ) def test_update_database(request_type, transport: str = "grpc"): @@ -2552,7 +2568,7 @@ def test_update_database(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_database), "__call__") as call: @@ -2591,7 +2607,8 @@ def test_update_database_non_empty_request_with_auto_populated_field(): client.update_database(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == spanner_database_admin.UpdateDatabaseRequest() + request_msg = spanner_database_admin.UpdateDatabaseRequest() + assert args[0] == request_msg def test_update_database_use_cached_wrapped_rpc(): @@ -2682,10 +2699,14 @@ async def test_update_database_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_database_async( - transport: str = "grpc_asyncio", - request_type=spanner_database_admin.UpdateDatabaseRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + spanner_database_admin.UpdateDatabaseRequest(), + {}, + ], +) +async def test_update_database_async(request_type, transport: str = "grpc_asyncio"): client = DatabaseAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2693,7 +2714,7 @@ async def test_update_database_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_database), "__call__") as call: @@ -2713,11 +2734,6 @@ async def test_update_database_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_database_async_from_dict(): - await test_update_database_async(request_type=dict) - - def test_update_database_field_headers(): client = DatabaseAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2874,8 +2890,8 @@ async def test_update_database_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - spanner_database_admin.UpdateDatabaseDdlRequest, - dict, + spanner_database_admin.UpdateDatabaseDdlRequest(), + {}, ], ) def test_update_database_ddl(request_type, transport: str = "grpc"): @@ -2886,7 +2902,7 @@ def test_update_database_ddl(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2932,10 +2948,11 @@ def test_update_database_ddl_non_empty_request_with_auto_populated_field(): client.update_database_ddl(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == spanner_database_admin.UpdateDatabaseDdlRequest( + request_msg = spanner_database_admin.UpdateDatabaseDdlRequest( database="database_value", operation_id="operation_id_value", ) + assert args[0] == request_msg def test_update_database_ddl_use_cached_wrapped_rpc(): @@ -3030,10 +3047,14 @@ async def test_update_database_ddl_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_database_ddl_async( - transport: str = "grpc_asyncio", - request_type=spanner_database_admin.UpdateDatabaseDdlRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + spanner_database_admin.UpdateDatabaseDdlRequest(), + {}, + ], +) +async def test_update_database_ddl_async(request_type, transport: str = "grpc_asyncio"): client = DatabaseAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3041,7 +3062,7 @@ async def test_update_database_ddl_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( @@ -3063,11 +3084,6 @@ async def test_update_database_ddl_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_database_ddl_async_from_dict(): - await test_update_database_ddl_async(request_type=dict) - - def test_update_database_ddl_field_headers(): client = DatabaseAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3232,8 +3248,8 @@ async def test_update_database_ddl_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - spanner_database_admin.DropDatabaseRequest, - dict, + spanner_database_admin.DropDatabaseRequest(), + {}, ], ) def test_drop_database(request_type, transport: str = "grpc"): @@ -3244,7 +3260,7 @@ def test_drop_database(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.drop_database), "__call__") as call: @@ -3285,9 +3301,10 @@ def test_drop_database_non_empty_request_with_auto_populated_field(): client.drop_database(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == spanner_database_admin.DropDatabaseRequest( + request_msg = spanner_database_admin.DropDatabaseRequest( database="database_value", ) + assert args[0] == request_msg def test_drop_database_use_cached_wrapped_rpc(): @@ -3368,10 +3385,14 @@ async def test_drop_database_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_drop_database_async( - transport: str = "grpc_asyncio", - request_type=spanner_database_admin.DropDatabaseRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + spanner_database_admin.DropDatabaseRequest(), + {}, + ], +) +async def test_drop_database_async(request_type, transport: str = "grpc_asyncio"): client = DatabaseAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3379,7 +3400,7 @@ async def test_drop_database_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.drop_database), "__call__") as call: @@ -3397,11 +3418,6 @@ async def test_drop_database_async( assert response is None -@pytest.mark.asyncio -async def test_drop_database_async_from_dict(): - await test_drop_database_async(request_type=dict) - - def test_drop_database_field_headers(): client = DatabaseAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3544,8 +3560,8 @@ async def test_drop_database_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - spanner_database_admin.GetDatabaseDdlRequest, - dict, + spanner_database_admin.GetDatabaseDdlRequest(), + {}, ], ) def test_get_database_ddl(request_type, transport: str = "grpc"): @@ -3556,7 +3572,7 @@ def test_get_database_ddl(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_database_ddl), "__call__") as call: @@ -3602,9 +3618,10 @@ def test_get_database_ddl_non_empty_request_with_auto_populated_field(): client.get_database_ddl(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == spanner_database_admin.GetDatabaseDdlRequest( + request_msg = spanner_database_admin.GetDatabaseDdlRequest( database="database_value", ) + assert args[0] == request_msg def test_get_database_ddl_use_cached_wrapped_rpc(): @@ -3687,10 +3704,14 @@ async def test_get_database_ddl_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_database_ddl_async( - transport: str = "grpc_asyncio", - request_type=spanner_database_admin.GetDatabaseDdlRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + spanner_database_admin.GetDatabaseDdlRequest(), + {}, + ], +) +async def test_get_database_ddl_async(request_type, transport: str = "grpc_asyncio"): client = DatabaseAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3698,7 +3719,7 @@ async def test_get_database_ddl_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_database_ddl), "__call__") as call: @@ -3723,11 +3744,6 @@ async def test_get_database_ddl_async( assert response.proto_descriptors == b"proto_descriptors_blob" -@pytest.mark.asyncio -async def test_get_database_ddl_async_from_dict(): - await test_get_database_ddl_async(request_type=dict) - - def test_get_database_ddl_field_headers(): client = DatabaseAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3874,8 +3890,8 @@ async def test_get_database_ddl_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.SetIamPolicyRequest, - dict, + iam_policy_pb2.SetIamPolicyRequest(), + {}, ], ) def test_set_iam_policy(request_type, transport: str = "grpc"): @@ -3886,7 +3902,7 @@ def test_set_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(type(client.transport.set_iam_policy), "__call__") as call: @@ -3932,9 +3948,10 @@ def test_set_iam_policy_non_empty_request_with_auto_populated_field(): client.set_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.SetIamPolicyRequest( + request_msg = iam_policy_pb2.SetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_set_iam_policy_use_cached_wrapped_rpc(): @@ -4015,9 +4032,14 @@ async def test_set_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.SetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.SetIamPolicyRequest(), + {}, + ], +) +async def test_set_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = DatabaseAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4025,7 +4047,7 @@ async def test_set_iam_policy_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.set_iam_policy), "__call__") as call: @@ -4050,11 +4072,6 @@ async def test_set_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_set_iam_policy_async_from_dict(): - await test_set_iam_policy_async(request_type=dict) - - def test_set_iam_policy_field_headers(): client = DatabaseAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4215,8 +4232,8 @@ async def test_set_iam_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.GetIamPolicyRequest, - dict, + iam_policy_pb2.GetIamPolicyRequest(), + {}, ], ) def test_get_iam_policy(request_type, transport: str = "grpc"): @@ -4227,7 +4244,7 @@ def test_get_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(type(client.transport.get_iam_policy), "__call__") as call: @@ -4273,9 +4290,10 @@ def test_get_iam_policy_non_empty_request_with_auto_populated_field(): client.get_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.GetIamPolicyRequest( + request_msg = iam_policy_pb2.GetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_get_iam_policy_use_cached_wrapped_rpc(): @@ -4356,9 +4374,14 @@ async def test_get_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.GetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.GetIamPolicyRequest(), + {}, + ], +) +async def test_get_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = DatabaseAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4366,7 +4389,7 @@ async def test_get_iam_policy_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_iam_policy), "__call__") as call: @@ -4391,11 +4414,6 @@ async def test_get_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_get_iam_policy_async_from_dict(): - await test_get_iam_policy_async(request_type=dict) - - def test_get_iam_policy_field_headers(): client = DatabaseAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4555,8 +4573,8 @@ async def test_get_iam_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.TestIamPermissionsRequest, - dict, + iam_policy_pb2.TestIamPermissionsRequest(), + {}, ], ) def test_test_iam_permissions(request_type, transport: str = "grpc"): @@ -4567,7 +4585,7 @@ def test_test_iam_permissions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4615,9 +4633,10 @@ def test_test_iam_permissions_non_empty_request_with_auto_populated_field(): client.test_iam_permissions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.TestIamPermissionsRequest( + request_msg = iam_policy_pb2.TestIamPermissionsRequest( resource="resource_value", ) + assert args[0] == request_msg def test_test_iam_permissions_use_cached_wrapped_rpc(): @@ -4702,9 +4721,15 @@ async def test_test_iam_permissions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.TestIamPermissionsRequest(), + {}, + ], +) async def test_test_iam_permissions_async( - transport: str = "grpc_asyncio", - request_type=iam_policy_pb2.TestIamPermissionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = DatabaseAdminAsyncClient( credentials=async_anonymous_credentials(), @@ -4713,7 +4738,7 @@ async def test_test_iam_permissions_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( @@ -4738,11 +4763,6 @@ async def test_test_iam_permissions_async( assert response.permissions == ["permissions_value"] -@pytest.mark.asyncio -async def test_test_iam_permissions_async_from_dict(): - await test_test_iam_permissions_async(request_type=dict) - - def test_test_iam_permissions_field_headers(): client = DatabaseAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4926,8 +4946,8 @@ async def test_test_iam_permissions_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gsad_backup.CreateBackupRequest, - dict, + gsad_backup.CreateBackupRequest(), + {}, ], ) def test_create_backup(request_type, transport: str = "grpc"): @@ -4938,7 +4958,7 @@ def test_create_backup(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_backup), "__call__") as call: @@ -4980,10 +5000,11 @@ def test_create_backup_non_empty_request_with_auto_populated_field(): client.create_backup(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gsad_backup.CreateBackupRequest( + request_msg = gsad_backup.CreateBackupRequest( parent="parent_value", backup_id="backup_id_value", ) + assert args[0] == request_msg def test_create_backup_use_cached_wrapped_rpc(): @@ -5074,9 +5095,14 @@ async def test_create_backup_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_backup_async( - transport: str = "grpc_asyncio", request_type=gsad_backup.CreateBackupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gsad_backup.CreateBackupRequest(), + {}, + ], +) +async def test_create_backup_async(request_type, transport: str = "grpc_asyncio"): client = DatabaseAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5084,7 +5110,7 @@ async def test_create_backup_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_backup), "__call__") as call: @@ -5104,11 +5130,6 @@ async def test_create_backup_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_backup_async_from_dict(): - await test_create_backup_async(request_type=dict) - - def test_create_backup_field_headers(): client = DatabaseAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5275,8 +5296,8 @@ async def test_create_backup_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - backup.CopyBackupRequest, - dict, + backup.CopyBackupRequest(), + {}, ], ) def test_copy_backup(request_type, transport: str = "grpc"): @@ -5287,7 +5308,7 @@ def test_copy_backup(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_backup), "__call__") as call: @@ -5330,11 +5351,12 @@ def test_copy_backup_non_empty_request_with_auto_populated_field(): client.copy_backup(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == backup.CopyBackupRequest( + request_msg = backup.CopyBackupRequest( parent="parent_value", backup_id="backup_id_value", source_backup="source_backup_value", ) + assert args[0] == request_msg def test_copy_backup_use_cached_wrapped_rpc(): @@ -5425,9 +5447,14 @@ async def test_copy_backup_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_copy_backup_async( - transport: str = "grpc_asyncio", request_type=backup.CopyBackupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + backup.CopyBackupRequest(), + {}, + ], +) +async def test_copy_backup_async(request_type, transport: str = "grpc_asyncio"): client = DatabaseAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5435,7 +5462,7 @@ async def test_copy_backup_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_backup), "__call__") as call: @@ -5455,11 +5482,6 @@ async def test_copy_backup_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_copy_backup_async_from_dict(): - await test_copy_backup_async(request_type=dict) - - def test_copy_backup_field_headers(): client = DatabaseAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5636,8 +5658,8 @@ async def test_copy_backup_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - backup.GetBackupRequest, - dict, + backup.GetBackupRequest(), + {}, ], ) def test_get_backup(request_type, transport: str = "grpc"): @@ -5648,7 +5670,7 @@ def test_get_backup(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_backup), "__call__") as call: @@ -5712,9 +5734,10 @@ def test_get_backup_non_empty_request_with_auto_populated_field(): client.get_backup(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == backup.GetBackupRequest( + request_msg = backup.GetBackupRequest( name="name_value", ) + assert args[0] == request_msg def test_get_backup_use_cached_wrapped_rpc(): @@ -5793,9 +5816,14 @@ async def test_get_backup_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_backup_async( - transport: str = "grpc_asyncio", request_type=backup.GetBackupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + backup.GetBackupRequest(), + {}, + ], +) +async def test_get_backup_async(request_type, transport: str = "grpc_asyncio"): client = DatabaseAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5803,7 +5831,7 @@ async def test_get_backup_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_backup), "__call__") as call: @@ -5846,11 +5874,6 @@ async def test_get_backup_async( assert response.incremental_backup_chain_id == "incremental_backup_chain_id_value" -@pytest.mark.asyncio -async def test_get_backup_async_from_dict(): - await test_get_backup_async(request_type=dict) - - def test_get_backup_field_headers(): client = DatabaseAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5993,8 +6016,8 @@ async def test_get_backup_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gsad_backup.UpdateBackupRequest, - dict, + gsad_backup.UpdateBackupRequest(), + {}, ], ) def test_update_backup(request_type, transport: str = "grpc"): @@ -6005,7 +6028,7 @@ def test_update_backup(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_backup), "__call__") as call: @@ -6067,7 +6090,8 @@ def test_update_backup_non_empty_request_with_auto_populated_field(): client.update_backup(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gsad_backup.UpdateBackupRequest() + request_msg = gsad_backup.UpdateBackupRequest() + assert args[0] == request_msg def test_update_backup_use_cached_wrapped_rpc(): @@ -6148,9 +6172,14 @@ async def test_update_backup_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_backup_async( - transport: str = "grpc_asyncio", request_type=gsad_backup.UpdateBackupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gsad_backup.UpdateBackupRequest(), + {}, + ], +) +async def test_update_backup_async(request_type, transport: str = "grpc_asyncio"): client = DatabaseAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6158,7 +6187,7 @@ async def test_update_backup_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_backup), "__call__") as call: @@ -6201,11 +6230,6 @@ async def test_update_backup_async( assert response.incremental_backup_chain_id == "incremental_backup_chain_id_value" -@pytest.mark.asyncio -async def test_update_backup_async_from_dict(): - await test_update_backup_async(request_type=dict) - - def test_update_backup_field_headers(): client = DatabaseAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6358,8 +6382,8 @@ async def test_update_backup_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - backup.DeleteBackupRequest, - dict, + backup.DeleteBackupRequest(), + {}, ], ) def test_delete_backup(request_type, transport: str = "grpc"): @@ -6370,7 +6394,7 @@ def test_delete_backup(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_backup), "__call__") as call: @@ -6411,9 +6435,10 @@ def test_delete_backup_non_empty_request_with_auto_populated_field(): client.delete_backup(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == backup.DeleteBackupRequest( + request_msg = backup.DeleteBackupRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_backup_use_cached_wrapped_rpc(): @@ -6494,9 +6519,14 @@ async def test_delete_backup_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_backup_async( - transport: str = "grpc_asyncio", request_type=backup.DeleteBackupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + backup.DeleteBackupRequest(), + {}, + ], +) +async def test_delete_backup_async(request_type, transport: str = "grpc_asyncio"): client = DatabaseAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6504,7 +6534,7 @@ async def test_delete_backup_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_backup), "__call__") as call: @@ -6522,11 +6552,6 @@ async def test_delete_backup_async( assert response is None -@pytest.mark.asyncio -async def test_delete_backup_async_from_dict(): - await test_delete_backup_async(request_type=dict) - - def test_delete_backup_field_headers(): client = DatabaseAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6669,8 +6694,8 @@ async def test_delete_backup_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - backup.ListBackupsRequest, - dict, + backup.ListBackupsRequest(), + {}, ], ) def test_list_backups(request_type, transport: str = "grpc"): @@ -6681,7 +6706,7 @@ def test_list_backups(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_backups), "__call__") as call: @@ -6727,11 +6752,12 @@ def test_list_backups_non_empty_request_with_auto_populated_field(): client.list_backups(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == backup.ListBackupsRequest( + request_msg = backup.ListBackupsRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_backups_use_cached_wrapped_rpc(): @@ -6812,9 +6838,14 @@ async def test_list_backups_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_backups_async( - transport: str = "grpc_asyncio", request_type=backup.ListBackupsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + backup.ListBackupsRequest(), + {}, + ], +) +async def test_list_backups_async(request_type, transport: str = "grpc_asyncio"): client = DatabaseAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6822,7 +6853,7 @@ async def test_list_backups_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_backups), "__call__") as call: @@ -6845,11 +6876,6 @@ async def test_list_backups_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_backups_async_from_dict(): - await test_list_backups_async(request_type=dict) - - def test_list_backups_field_headers(): client = DatabaseAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7186,8 +7212,8 @@ async def test_list_backups_async_pages(): @pytest.mark.parametrize( "request_type", [ - spanner_database_admin.RestoreDatabaseRequest, - dict, + spanner_database_admin.RestoreDatabaseRequest(), + {}, ], ) def test_restore_database(request_type, transport: str = "grpc"): @@ -7198,7 +7224,7 @@ def test_restore_database(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.restore_database), "__call__") as call: @@ -7241,11 +7267,12 @@ def test_restore_database_non_empty_request_with_auto_populated_field(): client.restore_database(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == spanner_database_admin.RestoreDatabaseRequest( + request_msg = spanner_database_admin.RestoreDatabaseRequest( parent="parent_value", database_id="database_id_value", backup="backup_value", ) + assert args[0] == request_msg def test_restore_database_use_cached_wrapped_rpc(): @@ -7338,10 +7365,14 @@ async def test_restore_database_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_restore_database_async( - transport: str = "grpc_asyncio", - request_type=spanner_database_admin.RestoreDatabaseRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + spanner_database_admin.RestoreDatabaseRequest(), + {}, + ], +) +async def test_restore_database_async(request_type, transport: str = "grpc_asyncio"): client = DatabaseAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7349,7 +7380,7 @@ async def test_restore_database_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.restore_database), "__call__") as call: @@ -7369,11 +7400,6 @@ async def test_restore_database_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_restore_database_async_from_dict(): - await test_restore_database_async(request_type=dict) - - def test_restore_database_field_headers(): client = DatabaseAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7536,8 +7562,8 @@ async def test_restore_database_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - spanner_database_admin.ListDatabaseOperationsRequest, - dict, + spanner_database_admin.ListDatabaseOperationsRequest(), + {}, ], ) def test_list_database_operations(request_type, transport: str = "grpc"): @@ -7548,7 +7574,7 @@ def test_list_database_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( @@ -7598,11 +7624,12 @@ def test_list_database_operations_non_empty_request_with_auto_populated_field(): client.list_database_operations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == spanner_database_admin.ListDatabaseOperationsRequest( + request_msg = spanner_database_admin.ListDatabaseOperationsRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_database_operations_use_cached_wrapped_rpc(): @@ -7688,9 +7715,15 @@ async def test_list_database_operations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + spanner_database_admin.ListDatabaseOperationsRequest(), + {}, + ], +) async def test_list_database_operations_async( - transport: str = "grpc_asyncio", - request_type=spanner_database_admin.ListDatabaseOperationsRequest, + request_type, transport: str = "grpc_asyncio" ): client = DatabaseAdminAsyncClient( credentials=async_anonymous_credentials(), @@ -7699,7 +7732,7 @@ async def test_list_database_operations_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( @@ -7724,11 +7757,6 @@ async def test_list_database_operations_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_database_operations_async_from_dict(): - await test_list_database_operations_async(request_type=dict) - - def test_list_database_operations_field_headers(): client = DatabaseAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8083,8 +8111,8 @@ async def test_list_database_operations_async_pages(): @pytest.mark.parametrize( "request_type", [ - backup.ListBackupOperationsRequest, - dict, + backup.ListBackupOperationsRequest(), + {}, ], ) def test_list_backup_operations(request_type, transport: str = "grpc"): @@ -8095,7 +8123,7 @@ def test_list_backup_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( @@ -8145,11 +8173,12 @@ def test_list_backup_operations_non_empty_request_with_auto_populated_field(): client.list_backup_operations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == backup.ListBackupOperationsRequest( + request_msg = backup.ListBackupOperationsRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_backup_operations_use_cached_wrapped_rpc(): @@ -8235,8 +8264,15 @@ async def test_list_backup_operations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + backup.ListBackupOperationsRequest(), + {}, + ], +) async def test_list_backup_operations_async( - transport: str = "grpc_asyncio", request_type=backup.ListBackupOperationsRequest + request_type, transport: str = "grpc_asyncio" ): client = DatabaseAdminAsyncClient( credentials=async_anonymous_credentials(), @@ -8245,7 +8281,7 @@ async def test_list_backup_operations_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( @@ -8270,11 +8306,6 @@ async def test_list_backup_operations_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_backup_operations_async_from_dict(): - await test_list_backup_operations_async(request_type=dict) - - def test_list_backup_operations_field_headers(): client = DatabaseAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8627,8 +8658,8 @@ async def test_list_backup_operations_async_pages(): @pytest.mark.parametrize( "request_type", [ - spanner_database_admin.ListDatabaseRolesRequest, - dict, + spanner_database_admin.ListDatabaseRolesRequest(), + {}, ], ) def test_list_database_roles(request_type, transport: str = "grpc"): @@ -8639,7 +8670,7 @@ def test_list_database_roles(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8688,10 +8719,11 @@ def test_list_database_roles_non_empty_request_with_auto_populated_field(): client.list_database_roles(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == spanner_database_admin.ListDatabaseRolesRequest( + request_msg = spanner_database_admin.ListDatabaseRolesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_database_roles_use_cached_wrapped_rpc(): @@ -8776,10 +8808,14 @@ async def test_list_database_roles_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_database_roles_async( - transport: str = "grpc_asyncio", - request_type=spanner_database_admin.ListDatabaseRolesRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + spanner_database_admin.ListDatabaseRolesRequest(), + {}, + ], +) +async def test_list_database_roles_async(request_type, transport: str = "grpc_asyncio"): client = DatabaseAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8787,7 +8823,7 @@ async def test_list_database_roles_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( @@ -8812,11 +8848,6 @@ async def test_list_database_roles_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_database_roles_async_from_dict(): - await test_list_database_roles_async(request_type=dict) - - def test_list_database_roles_field_headers(): client = DatabaseAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9171,8 +9202,8 @@ async def test_list_database_roles_async_pages(): @pytest.mark.parametrize( "request_type", [ - spanner_database_admin.AddSplitPointsRequest, - dict, + spanner_database_admin.AddSplitPointsRequest(), + {}, ], ) def test_add_split_points(request_type, transport: str = "grpc"): @@ -9183,7 +9214,7 @@ def test_add_split_points(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.add_split_points), "__call__") as call: @@ -9225,10 +9256,11 @@ def test_add_split_points_non_empty_request_with_auto_populated_field(): client.add_split_points(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == spanner_database_admin.AddSplitPointsRequest( + request_msg = spanner_database_admin.AddSplitPointsRequest( database="database_value", initiator="initiator_value", ) + assert args[0] == request_msg def test_add_split_points_use_cached_wrapped_rpc(): @@ -9311,10 +9343,14 @@ async def test_add_split_points_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_add_split_points_async( - transport: str = "grpc_asyncio", - request_type=spanner_database_admin.AddSplitPointsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + spanner_database_admin.AddSplitPointsRequest(), + {}, + ], +) +async def test_add_split_points_async(request_type, transport: str = "grpc_asyncio"): client = DatabaseAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9322,7 +9358,7 @@ async def test_add_split_points_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.add_split_points), "__call__") as call: @@ -9342,11 +9378,6 @@ async def test_add_split_points_async( assert isinstance(response, spanner_database_admin.AddSplitPointsResponse) -@pytest.mark.asyncio -async def test_add_split_points_async_from_dict(): - await test_add_split_points_async(request_type=dict) - - def test_add_split_points_field_headers(): client = DatabaseAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9503,8 +9534,8 @@ async def test_add_split_points_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gsad_backup_schedule.CreateBackupScheduleRequest, - dict, + gsad_backup_schedule.CreateBackupScheduleRequest(), + {}, ], ) def test_create_backup_schedule(request_type, transport: str = "grpc"): @@ -9515,7 +9546,7 @@ def test_create_backup_schedule(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9564,10 +9595,11 @@ def test_create_backup_schedule_non_empty_request_with_auto_populated_field(): client.create_backup_schedule(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gsad_backup_schedule.CreateBackupScheduleRequest( + request_msg = gsad_backup_schedule.CreateBackupScheduleRequest( parent="parent_value", backup_schedule_id="backup_schedule_id_value", ) + assert args[0] == request_msg def test_create_backup_schedule_use_cached_wrapped_rpc(): @@ -9653,9 +9685,15 @@ async def test_create_backup_schedule_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gsad_backup_schedule.CreateBackupScheduleRequest(), + {}, + ], +) async def test_create_backup_schedule_async( - transport: str = "grpc_asyncio", - request_type=gsad_backup_schedule.CreateBackupScheduleRequest, + request_type, transport: str = "grpc_asyncio" ): client = DatabaseAdminAsyncClient( credentials=async_anonymous_credentials(), @@ -9664,7 +9702,7 @@ async def test_create_backup_schedule_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( @@ -9689,11 +9727,6 @@ async def test_create_backup_schedule_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_create_backup_schedule_async_from_dict(): - await test_create_backup_schedule_async(request_type=dict) - - def test_create_backup_schedule_field_headers(): client = DatabaseAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9868,8 +9901,8 @@ async def test_create_backup_schedule_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - backup_schedule.GetBackupScheduleRequest, - dict, + backup_schedule.GetBackupScheduleRequest(), + {}, ], ) def test_get_backup_schedule(request_type, transport: str = "grpc"): @@ -9880,7 +9913,7 @@ def test_get_backup_schedule(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9928,9 +9961,10 @@ def test_get_backup_schedule_non_empty_request_with_auto_populated_field(): client.get_backup_schedule(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == backup_schedule.GetBackupScheduleRequest( + request_msg = backup_schedule.GetBackupScheduleRequest( name="name_value", ) + assert args[0] == request_msg def test_get_backup_schedule_use_cached_wrapped_rpc(): @@ -10015,10 +10049,14 @@ async def test_get_backup_schedule_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_backup_schedule_async( - transport: str = "grpc_asyncio", - request_type=backup_schedule.GetBackupScheduleRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + backup_schedule.GetBackupScheduleRequest(), + {}, + ], +) +async def test_get_backup_schedule_async(request_type, transport: str = "grpc_asyncio"): client = DatabaseAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10026,7 +10064,7 @@ async def test_get_backup_schedule_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( @@ -10051,11 +10089,6 @@ async def test_get_backup_schedule_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_backup_schedule_async_from_dict(): - await test_get_backup_schedule_async(request_type=dict) - - def test_get_backup_schedule_field_headers(): client = DatabaseAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10210,8 +10243,8 @@ async def test_get_backup_schedule_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gsad_backup_schedule.UpdateBackupScheduleRequest, - dict, + gsad_backup_schedule.UpdateBackupScheduleRequest(), + {}, ], ) def test_update_backup_schedule(request_type, transport: str = "grpc"): @@ -10222,7 +10255,7 @@ def test_update_backup_schedule(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10268,7 +10301,8 @@ def test_update_backup_schedule_non_empty_request_with_auto_populated_field(): client.update_backup_schedule(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gsad_backup_schedule.UpdateBackupScheduleRequest() + request_msg = gsad_backup_schedule.UpdateBackupScheduleRequest() + assert args[0] == request_msg def test_update_backup_schedule_use_cached_wrapped_rpc(): @@ -10354,9 +10388,15 @@ async def test_update_backup_schedule_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gsad_backup_schedule.UpdateBackupScheduleRequest(), + {}, + ], +) async def test_update_backup_schedule_async( - transport: str = "grpc_asyncio", - request_type=gsad_backup_schedule.UpdateBackupScheduleRequest, + request_type, transport: str = "grpc_asyncio" ): client = DatabaseAdminAsyncClient( credentials=async_anonymous_credentials(), @@ -10365,7 +10405,7 @@ async def test_update_backup_schedule_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( @@ -10390,11 +10430,6 @@ async def test_update_backup_schedule_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_update_backup_schedule_async_from_dict(): - await test_update_backup_schedule_async(request_type=dict) - - def test_update_backup_schedule_field_headers(): client = DatabaseAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10559,8 +10594,8 @@ async def test_update_backup_schedule_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - backup_schedule.DeleteBackupScheduleRequest, - dict, + backup_schedule.DeleteBackupScheduleRequest(), + {}, ], ) def test_delete_backup_schedule(request_type, transport: str = "grpc"): @@ -10571,7 +10606,7 @@ def test_delete_backup_schedule(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10616,9 +10651,10 @@ def test_delete_backup_schedule_non_empty_request_with_auto_populated_field(): client.delete_backup_schedule(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == backup_schedule.DeleteBackupScheduleRequest( + request_msg = backup_schedule.DeleteBackupScheduleRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_backup_schedule_use_cached_wrapped_rpc(): @@ -10704,9 +10740,15 @@ async def test_delete_backup_schedule_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + backup_schedule.DeleteBackupScheduleRequest(), + {}, + ], +) async def test_delete_backup_schedule_async( - transport: str = "grpc_asyncio", - request_type=backup_schedule.DeleteBackupScheduleRequest, + request_type, transport: str = "grpc_asyncio" ): client = DatabaseAdminAsyncClient( credentials=async_anonymous_credentials(), @@ -10715,7 +10757,7 @@ async def test_delete_backup_schedule_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( @@ -10735,11 +10777,6 @@ async def test_delete_backup_schedule_async( assert response is None -@pytest.mark.asyncio -async def test_delete_backup_schedule_async_from_dict(): - await test_delete_backup_schedule_async(request_type=dict) - - def test_delete_backup_schedule_field_headers(): client = DatabaseAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10890,8 +10927,8 @@ async def test_delete_backup_schedule_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - backup_schedule.ListBackupSchedulesRequest, - dict, + backup_schedule.ListBackupSchedulesRequest(), + {}, ], ) def test_list_backup_schedules(request_type, transport: str = "grpc"): @@ -10902,7 +10939,7 @@ def test_list_backup_schedules(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10951,10 +10988,11 @@ def test_list_backup_schedules_non_empty_request_with_auto_populated_field(): client.list_backup_schedules(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == backup_schedule.ListBackupSchedulesRequest( + request_msg = backup_schedule.ListBackupSchedulesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_backup_schedules_use_cached_wrapped_rpc(): @@ -11040,9 +11078,15 @@ async def test_list_backup_schedules_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + backup_schedule.ListBackupSchedulesRequest(), + {}, + ], +) async def test_list_backup_schedules_async( - transport: str = "grpc_asyncio", - request_type=backup_schedule.ListBackupSchedulesRequest, + request_type, transport: str = "grpc_asyncio" ): client = DatabaseAdminAsyncClient( credentials=async_anonymous_credentials(), @@ -11051,7 +11095,7 @@ async def test_list_backup_schedules_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( @@ -11076,11 +11120,6 @@ async def test_list_backup_schedules_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_backup_schedules_async_from_dict(): - await test_list_backup_schedules_async(request_type=dict) - - def test_list_backup_schedules_field_headers(): client = DatabaseAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11433,8 +11472,8 @@ async def test_list_backup_schedules_async_pages(): @pytest.mark.parametrize( "request_type", [ - spanner_database_admin.InternalUpdateGraphOperationRequest, - dict, + spanner_database_admin.InternalUpdateGraphOperationRequest(), + {}, ], ) def test_internal_update_graph_operation(request_type, transport: str = "grpc"): @@ -11445,7 +11484,7 @@ def test_internal_update_graph_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( @@ -11496,11 +11535,12 @@ def test_internal_update_graph_operation_non_empty_request_with_auto_populated_f client.internal_update_graph_operation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == spanner_database_admin.InternalUpdateGraphOperationRequest( + request_msg = spanner_database_admin.InternalUpdateGraphOperationRequest( database="database_value", operation_id="operation_id_value", vm_identity_token="vm_identity_token_value", ) + assert args[0] == request_msg def test_internal_update_graph_operation_use_cached_wrapped_rpc(): @@ -11586,9 +11626,15 @@ async def test_internal_update_graph_operation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + spanner_database_admin.InternalUpdateGraphOperationRequest(), + {}, + ], +) async def test_internal_update_graph_operation_async( - transport: str = "grpc_asyncio", - request_type=spanner_database_admin.InternalUpdateGraphOperationRequest, + request_type, transport: str = "grpc_asyncio" ): client = DatabaseAdminAsyncClient( credentials=async_anonymous_credentials(), @@ -11597,7 +11643,7 @@ async def test_internal_update_graph_operation_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( @@ -11621,11 +11667,6 @@ async def test_internal_update_graph_operation_async( ) -@pytest.mark.asyncio -async def test_internal_update_graph_operation_async_from_dict(): - await test_internal_update_graph_operation_async(request_type=dict) - - def test_internal_update_graph_operation_flattened(): client = DatabaseAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17226,7 +17267,6 @@ def test_list_databases_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_database_admin.ListDatabasesRequest() - assert args[0] == request_msg @@ -17247,7 +17287,6 @@ def test_create_database_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_database_admin.CreateDatabaseRequest() - assert args[0] == request_msg @@ -17268,7 +17307,6 @@ def test_get_database_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_database_admin.GetDatabaseRequest() - assert args[0] == request_msg @@ -17289,7 +17327,6 @@ def test_update_database_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_database_admin.UpdateDatabaseRequest() - assert args[0] == request_msg @@ -17312,7 +17349,6 @@ def test_update_database_ddl_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_database_admin.UpdateDatabaseDdlRequest() - assert args[0] == request_msg @@ -17333,7 +17369,6 @@ def test_drop_database_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_database_admin.DropDatabaseRequest() - assert args[0] == request_msg @@ -17354,7 +17389,6 @@ def test_get_database_ddl_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_database_admin.GetDatabaseDdlRequest() - assert args[0] == request_msg @@ -17375,7 +17409,6 @@ def test_set_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -17396,7 +17429,6 @@ def test_get_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -17419,7 +17451,6 @@ def test_test_iam_permissions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -17440,7 +17471,6 @@ def test_create_backup_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gsad_backup.CreateBackupRequest() - assert args[0] == request_msg @@ -17461,7 +17491,6 @@ def test_copy_backup_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backup.CopyBackupRequest() - assert args[0] == request_msg @@ -17482,7 +17511,6 @@ def test_get_backup_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backup.GetBackupRequest() - assert args[0] == request_msg @@ -17503,7 +17531,6 @@ def test_update_backup_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gsad_backup.UpdateBackupRequest() - assert args[0] == request_msg @@ -17524,7 +17551,6 @@ def test_delete_backup_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backup.DeleteBackupRequest() - assert args[0] == request_msg @@ -17545,7 +17571,6 @@ def test_list_backups_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backup.ListBackupsRequest() - assert args[0] == request_msg @@ -17566,7 +17591,6 @@ def test_restore_database_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_database_admin.RestoreDatabaseRequest() - assert args[0] == request_msg @@ -17589,7 +17613,6 @@ def test_list_database_operations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_database_admin.ListDatabaseOperationsRequest() - assert args[0] == request_msg @@ -17612,7 +17635,6 @@ def test_list_backup_operations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backup.ListBackupOperationsRequest() - assert args[0] == request_msg @@ -17635,7 +17657,6 @@ def test_list_database_roles_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_database_admin.ListDatabaseRolesRequest() - assert args[0] == request_msg @@ -17656,7 +17677,6 @@ def test_add_split_points_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_database_admin.AddSplitPointsRequest() - assert args[0] == request_msg @@ -17679,7 +17699,6 @@ def test_create_backup_schedule_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gsad_backup_schedule.CreateBackupScheduleRequest() - assert args[0] == request_msg @@ -17702,7 +17721,6 @@ def test_get_backup_schedule_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backup_schedule.GetBackupScheduleRequest() - assert args[0] == request_msg @@ -17725,7 +17743,6 @@ def test_update_backup_schedule_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gsad_backup_schedule.UpdateBackupScheduleRequest() - assert args[0] == request_msg @@ -17748,7 +17765,6 @@ def test_delete_backup_schedule_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backup_schedule.DeleteBackupScheduleRequest() - assert args[0] == request_msg @@ -17771,7 +17787,6 @@ def test_list_backup_schedules_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backup_schedule.ListBackupSchedulesRequest() - assert args[0] == request_msg @@ -17796,7 +17811,6 @@ def test_internal_update_graph_operation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_database_admin.InternalUpdateGraphOperationRequest() - assert args[0] == request_msg @@ -17837,7 +17851,6 @@ async def test_list_databases_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_database_admin.ListDatabasesRequest() - assert args[0] == request_msg @@ -17862,7 +17875,6 @@ async def test_create_database_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_database_admin.CreateDatabaseRequest() - assert args[0] == request_msg @@ -17895,7 +17907,6 @@ async def test_get_database_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_database_admin.GetDatabaseRequest() - assert args[0] == request_msg @@ -17920,7 +17931,6 @@ async def test_update_database_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_database_admin.UpdateDatabaseRequest() - assert args[0] == request_msg @@ -17947,7 +17957,6 @@ async def test_update_database_ddl_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_database_admin.UpdateDatabaseDdlRequest() - assert args[0] == request_msg @@ -17970,7 +17979,6 @@ async def test_drop_database_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_database_admin.DropDatabaseRequest() - assert args[0] == request_msg @@ -17998,7 +18006,6 @@ async def test_get_database_ddl_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_database_admin.GetDatabaseDdlRequest() - assert args[0] == request_msg @@ -18026,7 +18033,6 @@ async def test_set_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -18054,7 +18060,6 @@ async def test_get_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -18083,7 +18088,6 @@ async def test_test_iam_permissions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -18108,7 +18112,6 @@ async def test_create_backup_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gsad_backup.CreateBackupRequest() - assert args[0] == request_msg @@ -18133,7 +18136,6 @@ async def test_copy_backup_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backup.CopyBackupRequest() - assert args[0] == request_msg @@ -18170,7 +18172,6 @@ async def test_get_backup_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backup.GetBackupRequest() - assert args[0] == request_msg @@ -18207,7 +18208,6 @@ async def test_update_backup_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gsad_backup.UpdateBackupRequest() - assert args[0] == request_msg @@ -18230,7 +18230,6 @@ async def test_delete_backup_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backup.DeleteBackupRequest() - assert args[0] == request_msg @@ -18257,7 +18256,6 @@ async def test_list_backups_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backup.ListBackupsRequest() - assert args[0] == request_msg @@ -18282,7 +18280,6 @@ async def test_restore_database_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_database_admin.RestoreDatabaseRequest() - assert args[0] == request_msg @@ -18311,7 +18308,6 @@ async def test_list_database_operations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_database_admin.ListDatabaseOperationsRequest() - assert args[0] == request_msg @@ -18340,7 +18336,6 @@ async def test_list_backup_operations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backup.ListBackupOperationsRequest() - assert args[0] == request_msg @@ -18369,7 +18364,6 @@ async def test_list_database_roles_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_database_admin.ListDatabaseRolesRequest() - assert args[0] == request_msg @@ -18394,7 +18388,6 @@ async def test_add_split_points_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_database_admin.AddSplitPointsRequest() - assert args[0] == request_msg @@ -18423,7 +18416,6 @@ async def test_create_backup_schedule_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gsad_backup_schedule.CreateBackupScheduleRequest() - assert args[0] == request_msg @@ -18452,7 +18444,6 @@ async def test_get_backup_schedule_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backup_schedule.GetBackupScheduleRequest() - assert args[0] == request_msg @@ -18481,7 +18472,6 @@ async def test_update_backup_schedule_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gsad_backup_schedule.UpdateBackupScheduleRequest() - assert args[0] == request_msg @@ -18506,7 +18496,6 @@ async def test_delete_backup_schedule_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backup_schedule.DeleteBackupScheduleRequest() - assert args[0] == request_msg @@ -18535,7 +18524,6 @@ async def test_list_backup_schedules_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backup_schedule.ListBackupSchedulesRequest() - assert args[0] == request_msg @@ -18562,7 +18550,6 @@ async def test_internal_update_graph_operation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_database_admin.InternalUpdateGraphOperationRequest() - assert args[0] == request_msg @@ -22780,7 +22767,6 @@ def test_list_databases_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_database_admin.ListDatabasesRequest() - assert args[0] == request_msg @@ -22800,7 +22786,6 @@ def test_create_database_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_database_admin.CreateDatabaseRequest() - assert args[0] == request_msg @@ -22820,7 +22805,6 @@ def test_get_database_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_database_admin.GetDatabaseRequest() - assert args[0] == request_msg @@ -22840,7 +22824,6 @@ def test_update_database_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_database_admin.UpdateDatabaseRequest() - assert args[0] == request_msg @@ -22862,7 +22845,6 @@ def test_update_database_ddl_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_database_admin.UpdateDatabaseDdlRequest() - assert args[0] == request_msg @@ -22882,7 +22864,6 @@ def test_drop_database_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_database_admin.DropDatabaseRequest() - assert args[0] == request_msg @@ -22902,7 +22883,6 @@ def test_get_database_ddl_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_database_admin.GetDatabaseDdlRequest() - assert args[0] == request_msg @@ -22922,7 +22902,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -22942,7 +22921,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -22964,7 +22942,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -22984,7 +22961,6 @@ def test_create_backup_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gsad_backup.CreateBackupRequest() - assert args[0] == request_msg @@ -23004,7 +22980,6 @@ def test_copy_backup_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backup.CopyBackupRequest() - assert args[0] == request_msg @@ -23024,7 +22999,6 @@ def test_get_backup_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backup.GetBackupRequest() - assert args[0] == request_msg @@ -23044,7 +23018,6 @@ def test_update_backup_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gsad_backup.UpdateBackupRequest() - assert args[0] == request_msg @@ -23064,7 +23037,6 @@ def test_delete_backup_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backup.DeleteBackupRequest() - assert args[0] == request_msg @@ -23084,7 +23056,6 @@ def test_list_backups_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backup.ListBackupsRequest() - assert args[0] == request_msg @@ -23104,7 +23075,6 @@ def test_restore_database_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_database_admin.RestoreDatabaseRequest() - assert args[0] == request_msg @@ -23126,7 +23096,6 @@ def test_list_database_operations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_database_admin.ListDatabaseOperationsRequest() - assert args[0] == request_msg @@ -23148,7 +23117,6 @@ def test_list_backup_operations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backup.ListBackupOperationsRequest() - assert args[0] == request_msg @@ -23170,7 +23138,6 @@ def test_list_database_roles_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_database_admin.ListDatabaseRolesRequest() - assert args[0] == request_msg @@ -23190,7 +23157,6 @@ def test_add_split_points_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_database_admin.AddSplitPointsRequest() - assert args[0] == request_msg @@ -23212,7 +23178,6 @@ def test_create_backup_schedule_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gsad_backup_schedule.CreateBackupScheduleRequest() - assert args[0] == request_msg @@ -23234,7 +23199,6 @@ def test_get_backup_schedule_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backup_schedule.GetBackupScheduleRequest() - assert args[0] == request_msg @@ -23256,7 +23220,6 @@ def test_update_backup_schedule_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gsad_backup_schedule.UpdateBackupScheduleRequest() - assert args[0] == request_msg @@ -23278,7 +23241,6 @@ def test_delete_backup_schedule_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backup_schedule.DeleteBackupScheduleRequest() - assert args[0] == request_msg @@ -23300,7 +23262,6 @@ def test_list_backup_schedules_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = backup_schedule.ListBackupSchedulesRequest() - assert args[0] == request_msg @@ -23322,7 +23283,6 @@ def test_internal_update_graph_operation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_database_admin.InternalUpdateGraphOperationRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-spanner/tests/unit/gapic/spanner_admin_instance_v1/test_instance_admin.py b/packages/google-cloud-spanner/tests/unit/gapic/spanner_admin_instance_v1/test_instance_admin.py index daab87862d6a..9194e3469916 100644 --- a/packages/google-cloud-spanner/tests/unit/gapic/spanner_admin_instance_v1/test_instance_admin.py +++ b/packages/google-cloud-spanner/tests/unit/gapic/spanner_admin_instance_v1/test_instance_admin.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 @@ -119,6 +120,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" @@ -1322,8 +1338,8 @@ def test_instance_admin_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - spanner_instance_admin.ListInstanceConfigsRequest, - dict, + spanner_instance_admin.ListInstanceConfigsRequest(), + {}, ], ) def test_list_instance_configs(request_type, transport: str = "grpc"): @@ -1334,7 +1350,7 @@ def test_list_instance_configs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1383,10 +1399,11 @@ def test_list_instance_configs_non_empty_request_with_auto_populated_field(): client.list_instance_configs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == spanner_instance_admin.ListInstanceConfigsRequest( + request_msg = spanner_instance_admin.ListInstanceConfigsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_instance_configs_use_cached_wrapped_rpc(): @@ -1472,9 +1489,15 @@ async def test_list_instance_configs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + spanner_instance_admin.ListInstanceConfigsRequest(), + {}, + ], +) async def test_list_instance_configs_async( - transport: str = "grpc_asyncio", - request_type=spanner_instance_admin.ListInstanceConfigsRequest, + request_type, transport: str = "grpc_asyncio" ): client = InstanceAdminAsyncClient( credentials=async_anonymous_credentials(), @@ -1483,7 +1506,7 @@ async def test_list_instance_configs_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( @@ -1508,11 +1531,6 @@ async def test_list_instance_configs_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_instance_configs_async_from_dict(): - await test_list_instance_configs_async(request_type=dict) - - def test_list_instance_configs_field_headers(): client = InstanceAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1869,8 +1887,8 @@ async def test_list_instance_configs_async_pages(): @pytest.mark.parametrize( "request_type", [ - spanner_instance_admin.GetInstanceConfigRequest, - dict, + spanner_instance_admin.GetInstanceConfigRequest(), + {}, ], ) def test_get_instance_config(request_type, transport: str = "grpc"): @@ -1881,7 +1899,7 @@ def test_get_instance_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( @@ -1957,9 +1975,10 @@ def test_get_instance_config_non_empty_request_with_auto_populated_field(): client.get_instance_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == spanner_instance_admin.GetInstanceConfigRequest( + request_msg = spanner_instance_admin.GetInstanceConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_instance_config_use_cached_wrapped_rpc(): @@ -2044,10 +2063,14 @@ async def test_get_instance_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_instance_config_async( - transport: str = "grpc_asyncio", - request_type=spanner_instance_admin.GetInstanceConfigRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + spanner_instance_admin.GetInstanceConfigRequest(), + {}, + ], +) +async def test_get_instance_config_async(request_type, transport: str = "grpc_asyncio"): client = InstanceAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2055,7 +2078,7 @@ async def test_get_instance_config_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( @@ -2108,11 +2131,6 @@ async def test_get_instance_config_async( assert response.storage_limit_per_processing_unit == 3540 -@pytest.mark.asyncio -async def test_get_instance_config_async_from_dict(): - await test_get_instance_config_async(request_type=dict) - - def test_get_instance_config_field_headers(): client = InstanceAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2267,8 +2285,8 @@ async def test_get_instance_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - spanner_instance_admin.CreateInstanceConfigRequest, - dict, + spanner_instance_admin.CreateInstanceConfigRequest(), + {}, ], ) def test_create_instance_config(request_type, transport: str = "grpc"): @@ -2279,7 +2297,7 @@ def test_create_instance_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( @@ -2325,10 +2343,11 @@ def test_create_instance_config_non_empty_request_with_auto_populated_field(): client.create_instance_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == spanner_instance_admin.CreateInstanceConfigRequest( + request_msg = spanner_instance_admin.CreateInstanceConfigRequest( parent="parent_value", instance_config_id="instance_config_id_value", ) + assert args[0] == request_msg def test_create_instance_config_use_cached_wrapped_rpc(): @@ -2424,9 +2443,15 @@ async def test_create_instance_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + spanner_instance_admin.CreateInstanceConfigRequest(), + {}, + ], +) async def test_create_instance_config_async( - transport: str = "grpc_asyncio", - request_type=spanner_instance_admin.CreateInstanceConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = InstanceAdminAsyncClient( credentials=async_anonymous_credentials(), @@ -2435,7 +2460,7 @@ async def test_create_instance_config_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( @@ -2457,11 +2482,6 @@ async def test_create_instance_config_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_instance_config_async_from_dict(): - await test_create_instance_config_async(request_type=dict) - - def test_create_instance_config_field_headers(): client = InstanceAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2636,8 +2656,8 @@ async def test_create_instance_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - spanner_instance_admin.UpdateInstanceConfigRequest, - dict, + spanner_instance_admin.UpdateInstanceConfigRequest(), + {}, ], ) def test_update_instance_config(request_type, transport: str = "grpc"): @@ -2648,7 +2668,7 @@ def test_update_instance_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( @@ -2691,7 +2711,8 @@ def test_update_instance_config_non_empty_request_with_auto_populated_field(): client.update_instance_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == spanner_instance_admin.UpdateInstanceConfigRequest() + request_msg = spanner_instance_admin.UpdateInstanceConfigRequest() + assert args[0] == request_msg def test_update_instance_config_use_cached_wrapped_rpc(): @@ -2787,9 +2808,15 @@ async def test_update_instance_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + spanner_instance_admin.UpdateInstanceConfigRequest(), + {}, + ], +) async def test_update_instance_config_async( - transport: str = "grpc_asyncio", - request_type=spanner_instance_admin.UpdateInstanceConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = InstanceAdminAsyncClient( credentials=async_anonymous_credentials(), @@ -2798,7 +2825,7 @@ async def test_update_instance_config_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( @@ -2820,11 +2847,6 @@ async def test_update_instance_config_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_instance_config_async_from_dict(): - await test_update_instance_config_async(request_type=dict) - - def test_update_instance_config_field_headers(): client = InstanceAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2989,8 +3011,8 @@ async def test_update_instance_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - spanner_instance_admin.DeleteInstanceConfigRequest, - dict, + spanner_instance_admin.DeleteInstanceConfigRequest(), + {}, ], ) def test_delete_instance_config(request_type, transport: str = "grpc"): @@ -3001,7 +3023,7 @@ def test_delete_instance_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( @@ -3047,10 +3069,11 @@ def test_delete_instance_config_non_empty_request_with_auto_populated_field(): client.delete_instance_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == spanner_instance_admin.DeleteInstanceConfigRequest( + request_msg = spanner_instance_admin.DeleteInstanceConfigRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_instance_config_use_cached_wrapped_rpc(): @@ -3136,9 +3159,15 @@ async def test_delete_instance_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + spanner_instance_admin.DeleteInstanceConfigRequest(), + {}, + ], +) async def test_delete_instance_config_async( - transport: str = "grpc_asyncio", - request_type=spanner_instance_admin.DeleteInstanceConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = InstanceAdminAsyncClient( credentials=async_anonymous_credentials(), @@ -3147,7 +3176,7 @@ async def test_delete_instance_config_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( @@ -3167,11 +3196,6 @@ async def test_delete_instance_config_async( assert response is None -@pytest.mark.asyncio -async def test_delete_instance_config_async_from_dict(): - await test_delete_instance_config_async(request_type=dict) - - def test_delete_instance_config_field_headers(): client = InstanceAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3322,8 +3346,8 @@ async def test_delete_instance_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - spanner_instance_admin.ListInstanceConfigOperationsRequest, - dict, + spanner_instance_admin.ListInstanceConfigOperationsRequest(), + {}, ], ) def test_list_instance_config_operations(request_type, transport: str = "grpc"): @@ -3334,7 +3358,7 @@ def test_list_instance_config_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( @@ -3384,11 +3408,12 @@ def test_list_instance_config_operations_non_empty_request_with_auto_populated_f client.list_instance_config_operations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == spanner_instance_admin.ListInstanceConfigOperationsRequest( + request_msg = spanner_instance_admin.ListInstanceConfigOperationsRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_instance_config_operations_use_cached_wrapped_rpc(): @@ -3474,9 +3499,15 @@ async def test_list_instance_config_operations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + spanner_instance_admin.ListInstanceConfigOperationsRequest(), + {}, + ], +) async def test_list_instance_config_operations_async( - transport: str = "grpc_asyncio", - request_type=spanner_instance_admin.ListInstanceConfigOperationsRequest, + request_type, transport: str = "grpc_asyncio" ): client = InstanceAdminAsyncClient( credentials=async_anonymous_credentials(), @@ -3485,7 +3516,7 @@ async def test_list_instance_config_operations_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( @@ -3510,11 +3541,6 @@ async def test_list_instance_config_operations_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_instance_config_operations_async_from_dict(): - await test_list_instance_config_operations_async(request_type=dict) - - def test_list_instance_config_operations_field_headers(): client = InstanceAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3877,8 +3903,8 @@ async def test_list_instance_config_operations_async_pages(): @pytest.mark.parametrize( "request_type", [ - spanner_instance_admin.ListInstancesRequest, - dict, + spanner_instance_admin.ListInstancesRequest(), + {}, ], ) def test_list_instances(request_type, transport: str = "grpc"): @@ -3889,7 +3915,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(type(client.transport.list_instances), "__call__") as call: @@ -3937,11 +3963,12 @@ 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] == spanner_instance_admin.ListInstancesRequest( + request_msg = spanner_instance_admin.ListInstancesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_instances_use_cached_wrapped_rpc(): @@ -4022,10 +4049,14 @@ async def test_list_instances_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_instances_async( - transport: str = "grpc_asyncio", - request_type=spanner_instance_admin.ListInstancesRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + spanner_instance_admin.ListInstancesRequest(), + {}, + ], +) +async def test_list_instances_async(request_type, transport: str = "grpc_asyncio"): client = InstanceAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4033,7 +4064,7 @@ async def test_list_instances_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_instances), "__call__") as call: @@ -4058,11 +4089,6 @@ async def test_list_instances_async( 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 = InstanceAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4399,8 +4425,8 @@ async def test_list_instances_async_pages(): @pytest.mark.parametrize( "request_type", [ - spanner_instance_admin.ListInstancePartitionsRequest, - dict, + spanner_instance_admin.ListInstancePartitionsRequest(), + {}, ], ) def test_list_instance_partitions(request_type, transport: str = "grpc"): @@ -4411,7 +4437,7 @@ def test_list_instance_partitions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4462,10 +4488,11 @@ def test_list_instance_partitions_non_empty_request_with_auto_populated_field(): client.list_instance_partitions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == spanner_instance_admin.ListInstancePartitionsRequest( + request_msg = spanner_instance_admin.ListInstancePartitionsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_instance_partitions_use_cached_wrapped_rpc(): @@ -4551,9 +4578,15 @@ async def test_list_instance_partitions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + spanner_instance_admin.ListInstancePartitionsRequest(), + {}, + ], +) async def test_list_instance_partitions_async( - transport: str = "grpc_asyncio", - request_type=spanner_instance_admin.ListInstancePartitionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = InstanceAdminAsyncClient( credentials=async_anonymous_credentials(), @@ -4562,7 +4595,7 @@ async def test_list_instance_partitions_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( @@ -4589,11 +4622,6 @@ async def test_list_instance_partitions_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_instance_partitions_async_from_dict(): - await test_list_instance_partitions_async(request_type=dict) - - def test_list_instance_partitions_field_headers(): client = InstanceAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4952,8 +4980,8 @@ async def test_list_instance_partitions_async_pages(): @pytest.mark.parametrize( "request_type", [ - spanner_instance_admin.GetInstanceRequest, - dict, + spanner_instance_admin.GetInstanceRequest(), + {}, ], ) def test_get_instance(request_type, transport: str = "grpc"): @@ -4964,7 +4992,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(type(client.transport.get_instance), "__call__") as call: @@ -5032,9 +5060,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] == spanner_instance_admin.GetInstanceRequest( + request_msg = spanner_instance_admin.GetInstanceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_instance_use_cached_wrapped_rpc(): @@ -5115,10 +5144,14 @@ async def test_get_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_instance_async( - transport: str = "grpc_asyncio", - request_type=spanner_instance_admin.GetInstanceRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + spanner_instance_admin.GetInstanceRequest(), + {}, + ], +) +async def test_get_instance_async(request_type, transport: str = "grpc_asyncio"): client = InstanceAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5126,7 +5159,7 @@ async def test_get_instance_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_instance), "__call__") as call: @@ -5173,11 +5206,6 @@ async def test_get_instance_async( ) -@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 = InstanceAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5324,8 +5352,8 @@ async def test_get_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - spanner_instance_admin.CreateInstanceRequest, - dict, + spanner_instance_admin.CreateInstanceRequest(), + {}, ], ) def test_create_instance(request_type, transport: str = "grpc"): @@ -5336,7 +5364,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(type(client.transport.create_instance), "__call__") as call: @@ -5378,10 +5406,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] == spanner_instance_admin.CreateInstanceRequest( + request_msg = spanner_instance_admin.CreateInstanceRequest( parent="parent_value", instance_id="instance_id_value", ) + assert args[0] == request_msg def test_create_instance_use_cached_wrapped_rpc(): @@ -5472,10 +5501,14 @@ async def test_create_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_instance_async( - transport: str = "grpc_asyncio", - request_type=spanner_instance_admin.CreateInstanceRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + spanner_instance_admin.CreateInstanceRequest(), + {}, + ], +) +async def test_create_instance_async(request_type, transport: str = "grpc_asyncio"): client = InstanceAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5483,7 +5516,7 @@ async def test_create_instance_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_instance), "__call__") as call: @@ -5503,11 +5536,6 @@ async def test_create_instance_async( 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 = InstanceAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5674,8 +5702,8 @@ async def test_create_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - spanner_instance_admin.UpdateInstanceRequest, - dict, + spanner_instance_admin.UpdateInstanceRequest(), + {}, ], ) def test_update_instance(request_type, transport: str = "grpc"): @@ -5686,7 +5714,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(type(client.transport.update_instance), "__call__") as call: @@ -5725,7 +5753,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] - assert args[0] == spanner_instance_admin.UpdateInstanceRequest() + request_msg = spanner_instance_admin.UpdateInstanceRequest() + assert args[0] == request_msg def test_update_instance_use_cached_wrapped_rpc(): @@ -5816,10 +5845,14 @@ async def test_update_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_instance_async( - transport: str = "grpc_asyncio", - request_type=spanner_instance_admin.UpdateInstanceRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + spanner_instance_admin.UpdateInstanceRequest(), + {}, + ], +) +async def test_update_instance_async(request_type, transport: str = "grpc_asyncio"): client = InstanceAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5827,7 +5860,7 @@ async def test_update_instance_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_instance), "__call__") as call: @@ -5847,11 +5880,6 @@ async def test_update_instance_async( 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 = InstanceAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6008,8 +6036,8 @@ async def test_update_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - spanner_instance_admin.DeleteInstanceRequest, - dict, + spanner_instance_admin.DeleteInstanceRequest(), + {}, ], ) def test_delete_instance(request_type, transport: str = "grpc"): @@ -6020,7 +6048,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(type(client.transport.delete_instance), "__call__") as call: @@ -6061,9 +6089,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] == spanner_instance_admin.DeleteInstanceRequest( + request_msg = spanner_instance_admin.DeleteInstanceRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_instance_use_cached_wrapped_rpc(): @@ -6144,10 +6173,14 @@ async def test_delete_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_instance_async( - transport: str = "grpc_asyncio", - request_type=spanner_instance_admin.DeleteInstanceRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + spanner_instance_admin.DeleteInstanceRequest(), + {}, + ], +) +async def test_delete_instance_async(request_type, transport: str = "grpc_asyncio"): client = InstanceAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6155,7 +6188,7 @@ async def test_delete_instance_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_instance), "__call__") as call: @@ -6173,11 +6206,6 @@ async def test_delete_instance_async( assert response is None -@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 = InstanceAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6320,8 +6348,8 @@ async def test_delete_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.SetIamPolicyRequest, - dict, + iam_policy_pb2.SetIamPolicyRequest(), + {}, ], ) def test_set_iam_policy(request_type, transport: str = "grpc"): @@ -6332,7 +6360,7 @@ def test_set_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(type(client.transport.set_iam_policy), "__call__") as call: @@ -6378,9 +6406,10 @@ def test_set_iam_policy_non_empty_request_with_auto_populated_field(): client.set_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.SetIamPolicyRequest( + request_msg = iam_policy_pb2.SetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_set_iam_policy_use_cached_wrapped_rpc(): @@ -6461,9 +6490,14 @@ async def test_set_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.SetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.SetIamPolicyRequest(), + {}, + ], +) +async def test_set_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = InstanceAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6471,7 +6505,7 @@ async def test_set_iam_policy_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.set_iam_policy), "__call__") as call: @@ -6496,11 +6530,6 @@ async def test_set_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_set_iam_policy_async_from_dict(): - await test_set_iam_policy_async(request_type=dict) - - def test_set_iam_policy_field_headers(): client = InstanceAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6661,8 +6690,8 @@ async def test_set_iam_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.GetIamPolicyRequest, - dict, + iam_policy_pb2.GetIamPolicyRequest(), + {}, ], ) def test_get_iam_policy(request_type, transport: str = "grpc"): @@ -6673,7 +6702,7 @@ def test_get_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(type(client.transport.get_iam_policy), "__call__") as call: @@ -6719,9 +6748,10 @@ def test_get_iam_policy_non_empty_request_with_auto_populated_field(): client.get_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.GetIamPolicyRequest( + request_msg = iam_policy_pb2.GetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_get_iam_policy_use_cached_wrapped_rpc(): @@ -6802,9 +6832,14 @@ async def test_get_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.GetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.GetIamPolicyRequest(), + {}, + ], +) +async def test_get_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = InstanceAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6812,7 +6847,7 @@ async def test_get_iam_policy_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_iam_policy), "__call__") as call: @@ -6837,11 +6872,6 @@ async def test_get_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_get_iam_policy_async_from_dict(): - await test_get_iam_policy_async(request_type=dict) - - def test_get_iam_policy_field_headers(): client = InstanceAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7001,8 +7031,8 @@ async def test_get_iam_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.TestIamPermissionsRequest, - dict, + iam_policy_pb2.TestIamPermissionsRequest(), + {}, ], ) def test_test_iam_permissions(request_type, transport: str = "grpc"): @@ -7013,7 +7043,7 @@ def test_test_iam_permissions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7061,9 +7091,10 @@ def test_test_iam_permissions_non_empty_request_with_auto_populated_field(): client.test_iam_permissions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.TestIamPermissionsRequest( + request_msg = iam_policy_pb2.TestIamPermissionsRequest( resource="resource_value", ) + assert args[0] == request_msg def test_test_iam_permissions_use_cached_wrapped_rpc(): @@ -7148,9 +7179,15 @@ async def test_test_iam_permissions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.TestIamPermissionsRequest(), + {}, + ], +) async def test_test_iam_permissions_async( - transport: str = "grpc_asyncio", - request_type=iam_policy_pb2.TestIamPermissionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = InstanceAdminAsyncClient( credentials=async_anonymous_credentials(), @@ -7159,7 +7196,7 @@ async def test_test_iam_permissions_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( @@ -7184,11 +7221,6 @@ async def test_test_iam_permissions_async( assert response.permissions == ["permissions_value"] -@pytest.mark.asyncio -async def test_test_iam_permissions_async_from_dict(): - await test_test_iam_permissions_async(request_type=dict) - - def test_test_iam_permissions_field_headers(): client = InstanceAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7372,8 +7404,8 @@ async def test_test_iam_permissions_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - spanner_instance_admin.GetInstancePartitionRequest, - dict, + spanner_instance_admin.GetInstancePartitionRequest(), + {}, ], ) def test_get_instance_partition(request_type, transport: str = "grpc"): @@ -7384,7 +7416,7 @@ def test_get_instance_partition(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7445,9 +7477,10 @@ def test_get_instance_partition_non_empty_request_with_auto_populated_field(): client.get_instance_partition(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == spanner_instance_admin.GetInstancePartitionRequest( + request_msg = spanner_instance_admin.GetInstancePartitionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_instance_partition_use_cached_wrapped_rpc(): @@ -7533,9 +7566,15 @@ async def test_get_instance_partition_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + spanner_instance_admin.GetInstancePartitionRequest(), + {}, + ], +) async def test_get_instance_partition_async( - transport: str = "grpc_asyncio", - request_type=spanner_instance_admin.GetInstancePartitionRequest, + request_type, transport: str = "grpc_asyncio" ): client = InstanceAdminAsyncClient( credentials=async_anonymous_credentials(), @@ -7544,7 +7583,7 @@ async def test_get_instance_partition_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( @@ -7581,11 +7620,6 @@ async def test_get_instance_partition_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_instance_partition_async_from_dict(): - await test_get_instance_partition_async(request_type=dict) - - def test_get_instance_partition_field_headers(): client = InstanceAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7740,8 +7774,8 @@ async def test_get_instance_partition_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - spanner_instance_admin.CreateInstancePartitionRequest, - dict, + spanner_instance_admin.CreateInstancePartitionRequest(), + {}, ], ) def test_create_instance_partition(request_type, transport: str = "grpc"): @@ -7752,7 +7786,7 @@ def test_create_instance_partition(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7798,10 +7832,11 @@ def test_create_instance_partition_non_empty_request_with_auto_populated_field() client.create_instance_partition(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == spanner_instance_admin.CreateInstancePartitionRequest( + request_msg = spanner_instance_admin.CreateInstancePartitionRequest( parent="parent_value", instance_partition_id="instance_partition_id_value", ) + assert args[0] == request_msg def test_create_instance_partition_use_cached_wrapped_rpc(): @@ -7897,9 +7932,15 @@ async def test_create_instance_partition_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + spanner_instance_admin.CreateInstancePartitionRequest(), + {}, + ], +) async def test_create_instance_partition_async( - transport: str = "grpc_asyncio", - request_type=spanner_instance_admin.CreateInstancePartitionRequest, + request_type, transport: str = "grpc_asyncio" ): client = InstanceAdminAsyncClient( credentials=async_anonymous_credentials(), @@ -7908,7 +7949,7 @@ async def test_create_instance_partition_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( @@ -7930,11 +7971,6 @@ async def test_create_instance_partition_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_instance_partition_async_from_dict(): - await test_create_instance_partition_async(request_type=dict) - - def test_create_instance_partition_field_headers(): client = InstanceAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8117,8 +8153,8 @@ async def test_create_instance_partition_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - spanner_instance_admin.DeleteInstancePartitionRequest, - dict, + spanner_instance_admin.DeleteInstancePartitionRequest(), + {}, ], ) def test_delete_instance_partition(request_type, transport: str = "grpc"): @@ -8129,7 +8165,7 @@ def test_delete_instance_partition(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8175,10 +8211,11 @@ def test_delete_instance_partition_non_empty_request_with_auto_populated_field() client.delete_instance_partition(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == spanner_instance_admin.DeleteInstancePartitionRequest( + request_msg = spanner_instance_admin.DeleteInstancePartitionRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_instance_partition_use_cached_wrapped_rpc(): @@ -8264,9 +8301,15 @@ async def test_delete_instance_partition_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + spanner_instance_admin.DeleteInstancePartitionRequest(), + {}, + ], +) async def test_delete_instance_partition_async( - transport: str = "grpc_asyncio", - request_type=spanner_instance_admin.DeleteInstancePartitionRequest, + request_type, transport: str = "grpc_asyncio" ): client = InstanceAdminAsyncClient( credentials=async_anonymous_credentials(), @@ -8275,7 +8318,7 @@ async def test_delete_instance_partition_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( @@ -8295,11 +8338,6 @@ async def test_delete_instance_partition_async( assert response is None -@pytest.mark.asyncio -async def test_delete_instance_partition_async_from_dict(): - await test_delete_instance_partition_async(request_type=dict) - - def test_delete_instance_partition_field_headers(): client = InstanceAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8450,8 +8488,8 @@ async def test_delete_instance_partition_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - spanner_instance_admin.UpdateInstancePartitionRequest, - dict, + spanner_instance_admin.UpdateInstancePartitionRequest(), + {}, ], ) def test_update_instance_partition(request_type, transport: str = "grpc"): @@ -8462,7 +8500,7 @@ def test_update_instance_partition(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8505,7 +8543,8 @@ def test_update_instance_partition_non_empty_request_with_auto_populated_field() client.update_instance_partition(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == spanner_instance_admin.UpdateInstancePartitionRequest() + request_msg = spanner_instance_admin.UpdateInstancePartitionRequest() + assert args[0] == request_msg def test_update_instance_partition_use_cached_wrapped_rpc(): @@ -8601,9 +8640,15 @@ async def test_update_instance_partition_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + spanner_instance_admin.UpdateInstancePartitionRequest(), + {}, + ], +) async def test_update_instance_partition_async( - transport: str = "grpc_asyncio", - request_type=spanner_instance_admin.UpdateInstancePartitionRequest, + request_type, transport: str = "grpc_asyncio" ): client = InstanceAdminAsyncClient( credentials=async_anonymous_credentials(), @@ -8612,7 +8657,7 @@ async def test_update_instance_partition_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( @@ -8634,11 +8679,6 @@ async def test_update_instance_partition_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_instance_partition_async_from_dict(): - await test_update_instance_partition_async(request_type=dict) - - def test_update_instance_partition_field_headers(): client = InstanceAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8811,8 +8851,8 @@ async def test_update_instance_partition_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - spanner_instance_admin.ListInstancePartitionOperationsRequest, - dict, + spanner_instance_admin.ListInstancePartitionOperationsRequest(), + {}, ], ) def test_list_instance_partition_operations(request_type, transport: str = "grpc"): @@ -8823,7 +8863,7 @@ def test_list_instance_partition_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( @@ -8881,11 +8921,12 @@ def test_list_instance_partition_operations_non_empty_request_with_auto_populate client.list_instance_partition_operations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == spanner_instance_admin.ListInstancePartitionOperationsRequest( + request_msg = spanner_instance_admin.ListInstancePartitionOperationsRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_instance_partition_operations_use_cached_wrapped_rpc(): @@ -8971,9 +9012,15 @@ async def test_list_instance_partition_operations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + spanner_instance_admin.ListInstancePartitionOperationsRequest(), + {}, + ], +) async def test_list_instance_partition_operations_async( - transport: str = "grpc_asyncio", - request_type=spanner_instance_admin.ListInstancePartitionOperationsRequest, + request_type, transport: str = "grpc_asyncio" ): client = InstanceAdminAsyncClient( credentials=async_anonymous_credentials(), @@ -8982,7 +9029,7 @@ async def test_list_instance_partition_operations_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( @@ -9013,11 +9060,6 @@ async def test_list_instance_partition_operations_async( ] -@pytest.mark.asyncio -async def test_list_instance_partition_operations_async_from_dict(): - await test_list_instance_partition_operations_async(request_type=dict) - - def test_list_instance_partition_operations_field_headers(): client = InstanceAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9380,8 +9422,8 @@ async def test_list_instance_partition_operations_async_pages(): @pytest.mark.parametrize( "request_type", [ - spanner_instance_admin.MoveInstanceRequest, - dict, + spanner_instance_admin.MoveInstanceRequest(), + {}, ], ) def test_move_instance(request_type, transport: str = "grpc"): @@ -9392,7 +9434,7 @@ def test_move_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(type(client.transport.move_instance), "__call__") as call: @@ -9434,10 +9476,11 @@ def test_move_instance_non_empty_request_with_auto_populated_field(): client.move_instance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == spanner_instance_admin.MoveInstanceRequest( + request_msg = spanner_instance_admin.MoveInstanceRequest( name="name_value", target_config="target_config_value", ) + assert args[0] == request_msg def test_move_instance_use_cached_wrapped_rpc(): @@ -9528,10 +9571,14 @@ async def test_move_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_move_instance_async( - transport: str = "grpc_asyncio", - request_type=spanner_instance_admin.MoveInstanceRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + spanner_instance_admin.MoveInstanceRequest(), + {}, + ], +) +async def test_move_instance_async(request_type, transport: str = "grpc_asyncio"): client = InstanceAdminAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9539,7 +9586,7 @@ async def test_move_instance_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.move_instance), "__call__") as call: @@ -9559,11 +9606,6 @@ async def test_move_instance_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_move_instance_async_from_dict(): - await test_move_instance_async(request_type=dict) - - def test_move_instance_field_headers(): client = InstanceAdminClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14037,7 +14079,6 @@ def test_list_instance_configs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_instance_admin.ListInstanceConfigsRequest() - assert args[0] == request_msg @@ -14060,7 +14101,6 @@ def test_get_instance_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_instance_admin.GetInstanceConfigRequest() - assert args[0] == request_msg @@ -14083,7 +14123,6 @@ def test_create_instance_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_instance_admin.CreateInstanceConfigRequest() - assert args[0] == request_msg @@ -14106,7 +14145,6 @@ def test_update_instance_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_instance_admin.UpdateInstanceConfigRequest() - assert args[0] == request_msg @@ -14129,7 +14167,6 @@ def test_delete_instance_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_instance_admin.DeleteInstanceConfigRequest() - assert args[0] == request_msg @@ -14154,7 +14191,6 @@ def test_list_instance_config_operations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_instance_admin.ListInstanceConfigOperationsRequest() - assert args[0] == request_msg @@ -14175,7 +14211,6 @@ def test_list_instances_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_instance_admin.ListInstancesRequest() - assert args[0] == request_msg @@ -14198,7 +14233,6 @@ def test_list_instance_partitions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_instance_admin.ListInstancePartitionsRequest() - assert args[0] == request_msg @@ -14219,7 +14253,6 @@ def test_get_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_instance_admin.GetInstanceRequest() - assert args[0] == request_msg @@ -14240,7 +14273,6 @@ def test_create_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_instance_admin.CreateInstanceRequest() - assert args[0] == request_msg @@ -14261,7 +14293,6 @@ def test_update_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_instance_admin.UpdateInstanceRequest() - assert args[0] == request_msg @@ -14282,7 +14313,6 @@ def test_delete_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_instance_admin.DeleteInstanceRequest() - assert args[0] == request_msg @@ -14303,7 +14333,6 @@ def test_set_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -14324,7 +14353,6 @@ def test_get_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -14347,7 +14375,6 @@ def test_test_iam_permissions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -14370,7 +14397,6 @@ def test_get_instance_partition_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_instance_admin.GetInstancePartitionRequest() - assert args[0] == request_msg @@ -14393,7 +14419,6 @@ def test_create_instance_partition_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_instance_admin.CreateInstancePartitionRequest() - assert args[0] == request_msg @@ -14416,7 +14441,6 @@ def test_delete_instance_partition_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_instance_admin.DeleteInstancePartitionRequest() - assert args[0] == request_msg @@ -14439,7 +14463,6 @@ def test_update_instance_partition_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_instance_admin.UpdateInstancePartitionRequest() - assert args[0] == request_msg @@ -14464,7 +14487,6 @@ def test_list_instance_partition_operations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_instance_admin.ListInstancePartitionOperationsRequest() - assert args[0] == request_msg @@ -14485,7 +14507,6 @@ def test_move_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_instance_admin.MoveInstanceRequest() - assert args[0] == request_msg @@ -14528,7 +14549,6 @@ async def test_list_instance_configs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_instance_admin.ListInstanceConfigsRequest() - assert args[0] == request_msg @@ -14567,7 +14587,6 @@ async def test_get_instance_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_instance_admin.GetInstanceConfigRequest() - assert args[0] == request_msg @@ -14594,7 +14613,6 @@ async def test_create_instance_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_instance_admin.CreateInstanceConfigRequest() - assert args[0] == request_msg @@ -14621,7 +14639,6 @@ async def test_update_instance_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_instance_admin.UpdateInstanceConfigRequest() - assert args[0] == request_msg @@ -14646,7 +14663,6 @@ async def test_delete_instance_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_instance_admin.DeleteInstanceConfigRequest() - assert args[0] == request_msg @@ -14675,7 +14691,6 @@ async def test_list_instance_config_operations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_instance_admin.ListInstanceConfigOperationsRequest() - assert args[0] == request_msg @@ -14703,7 +14718,6 @@ async def test_list_instances_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_instance_admin.ListInstancesRequest() - assert args[0] == request_msg @@ -14733,7 +14747,6 @@ async def test_list_instance_partitions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_instance_admin.ListInstancePartitionsRequest() - assert args[0] == request_msg @@ -14769,7 +14782,6 @@ async def test_get_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_instance_admin.GetInstanceRequest() - assert args[0] == request_msg @@ -14794,7 +14806,6 @@ async def test_create_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_instance_admin.CreateInstanceRequest() - assert args[0] == request_msg @@ -14819,7 +14830,6 @@ async def test_update_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_instance_admin.UpdateInstanceRequest() - assert args[0] == request_msg @@ -14842,7 +14852,6 @@ async def test_delete_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_instance_admin.DeleteInstanceRequest() - assert args[0] == request_msg @@ -14870,7 +14879,6 @@ async def test_set_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -14898,7 +14906,6 @@ async def test_get_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -14927,7 +14934,6 @@ async def test_test_iam_permissions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -14962,7 +14968,6 @@ async def test_get_instance_partition_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_instance_admin.GetInstancePartitionRequest() - assert args[0] == request_msg @@ -14989,7 +14994,6 @@ async def test_create_instance_partition_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_instance_admin.CreateInstancePartitionRequest() - assert args[0] == request_msg @@ -15014,7 +15018,6 @@ async def test_delete_instance_partition_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_instance_admin.DeleteInstancePartitionRequest() - assert args[0] == request_msg @@ -15041,7 +15044,6 @@ async def test_update_instance_partition_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_instance_admin.UpdateInstancePartitionRequest() - assert args[0] == request_msg @@ -15073,7 +15075,6 @@ async def test_list_instance_partition_operations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_instance_admin.ListInstancePartitionOperationsRequest() - assert args[0] == request_msg @@ -15098,7 +15099,6 @@ async def test_move_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_instance_admin.MoveInstanceRequest() - assert args[0] == request_msg @@ -18198,7 +18198,6 @@ def test_list_instance_configs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_instance_admin.ListInstanceConfigsRequest() - assert args[0] == request_msg @@ -18220,7 +18219,6 @@ def test_get_instance_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_instance_admin.GetInstanceConfigRequest() - assert args[0] == request_msg @@ -18242,7 +18240,6 @@ def test_create_instance_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_instance_admin.CreateInstanceConfigRequest() - assert args[0] == request_msg @@ -18264,7 +18261,6 @@ def test_update_instance_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_instance_admin.UpdateInstanceConfigRequest() - assert args[0] == request_msg @@ -18286,7 +18282,6 @@ def test_delete_instance_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_instance_admin.DeleteInstanceConfigRequest() - assert args[0] == request_msg @@ -18308,7 +18303,6 @@ def test_list_instance_config_operations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_instance_admin.ListInstanceConfigOperationsRequest() - assert args[0] == request_msg @@ -18328,7 +18322,6 @@ def test_list_instances_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_instance_admin.ListInstancesRequest() - assert args[0] == request_msg @@ -18350,7 +18343,6 @@ def test_list_instance_partitions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_instance_admin.ListInstancePartitionsRequest() - assert args[0] == request_msg @@ -18370,7 +18362,6 @@ def test_get_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_instance_admin.GetInstanceRequest() - assert args[0] == request_msg @@ -18390,7 +18381,6 @@ def test_create_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_instance_admin.CreateInstanceRequest() - assert args[0] == request_msg @@ -18410,7 +18400,6 @@ def test_update_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_instance_admin.UpdateInstanceRequest() - assert args[0] == request_msg @@ -18430,7 +18419,6 @@ def test_delete_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_instance_admin.DeleteInstanceRequest() - assert args[0] == request_msg @@ -18450,7 +18438,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -18470,7 +18457,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -18492,7 +18478,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -18514,7 +18499,6 @@ def test_get_instance_partition_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_instance_admin.GetInstancePartitionRequest() - assert args[0] == request_msg @@ -18536,7 +18520,6 @@ def test_create_instance_partition_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_instance_admin.CreateInstancePartitionRequest() - assert args[0] == request_msg @@ -18558,7 +18541,6 @@ def test_delete_instance_partition_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_instance_admin.DeleteInstancePartitionRequest() - assert args[0] == request_msg @@ -18580,7 +18562,6 @@ def test_update_instance_partition_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_instance_admin.UpdateInstancePartitionRequest() - assert args[0] == request_msg @@ -18602,7 +18583,6 @@ def test_list_instance_partition_operations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_instance_admin.ListInstancePartitionOperationsRequest() - assert args[0] == request_msg @@ -18622,7 +18602,6 @@ def test_move_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner_instance_admin.MoveInstanceRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-spanner/tests/unit/gapic/spanner_v1/test_spanner.py b/packages/google-cloud-spanner/tests/unit/gapic/spanner_v1/test_spanner.py index 8e0fb7de7f62..da2281faa1d4 100644 --- a/packages/google-cloud-spanner/tests/unit/gapic/spanner_v1/test_spanner.py +++ b/packages/google-cloud-spanner/tests/unit/gapic/spanner_v1/test_spanner.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 @@ -120,6 +121,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" @@ -1269,8 +1285,8 @@ def test_spanner_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - spanner.CreateSessionRequest, - dict, + spanner.CreateSessionRequest(), + {}, ], ) def test_create_session(request_type, transport: str = "grpc"): @@ -1281,7 +1297,7 @@ def test_create_session(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_session), "__call__") as call: @@ -1329,9 +1345,10 @@ def test_create_session_non_empty_request_with_auto_populated_field(): client.create_session(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == spanner.CreateSessionRequest( + request_msg = spanner.CreateSessionRequest( database="database_value", ) + assert args[0] == request_msg def test_create_session_use_cached_wrapped_rpc(): @@ -1412,9 +1429,14 @@ async def test_create_session_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_session_async( - transport: str = "grpc_asyncio", request_type=spanner.CreateSessionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + spanner.CreateSessionRequest(), + {}, + ], +) +async def test_create_session_async(request_type, transport: str = "grpc_asyncio"): client = SpannerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1422,7 +1444,7 @@ async def test_create_session_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_session), "__call__") as call: @@ -1449,11 +1471,6 @@ async def test_create_session_async( assert response.multiplexed is True -@pytest.mark.asyncio -async def test_create_session_async_from_dict(): - await test_create_session_async(request_type=dict) - - def test_create_session_field_headers(): client = SpannerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1596,8 +1613,8 @@ async def test_create_session_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - spanner.BatchCreateSessionsRequest, - dict, + spanner.BatchCreateSessionsRequest(), + {}, ], ) def test_batch_create_sessions(request_type, transport: str = "grpc"): @@ -1608,7 +1625,7 @@ def test_batch_create_sessions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1653,9 +1670,10 @@ def test_batch_create_sessions_non_empty_request_with_auto_populated_field(): client.batch_create_sessions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == spanner.BatchCreateSessionsRequest( + request_msg = spanner.BatchCreateSessionsRequest( database="database_value", ) + assert args[0] == request_msg def test_batch_create_sessions_use_cached_wrapped_rpc(): @@ -1741,8 +1759,15 @@ async def test_batch_create_sessions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + spanner.BatchCreateSessionsRequest(), + {}, + ], +) async def test_batch_create_sessions_async( - transport: str = "grpc_asyncio", request_type=spanner.BatchCreateSessionsRequest + request_type, transport: str = "grpc_asyncio" ): client = SpannerAsyncClient( credentials=async_anonymous_credentials(), @@ -1751,7 +1776,7 @@ async def test_batch_create_sessions_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( @@ -1773,11 +1798,6 @@ async def test_batch_create_sessions_async( assert isinstance(response, spanner.BatchCreateSessionsResponse) -@pytest.mark.asyncio -async def test_batch_create_sessions_async_from_dict(): - await test_batch_create_sessions_async(request_type=dict) - - def test_batch_create_sessions_field_headers(): client = SpannerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1942,8 +1962,8 @@ async def test_batch_create_sessions_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - spanner.GetSessionRequest, - dict, + spanner.GetSessionRequest(), + {}, ], ) def test_get_session(request_type, transport: str = "grpc"): @@ -1954,7 +1974,7 @@ def test_get_session(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_session), "__call__") as call: @@ -2002,9 +2022,10 @@ def test_get_session_non_empty_request_with_auto_populated_field(): client.get_session(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == spanner.GetSessionRequest( + request_msg = spanner.GetSessionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_session_use_cached_wrapped_rpc(): @@ -2085,9 +2106,14 @@ async def test_get_session_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_session_async( - transport: str = "grpc_asyncio", request_type=spanner.GetSessionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + spanner.GetSessionRequest(), + {}, + ], +) +async def test_get_session_async(request_type, transport: str = "grpc_asyncio"): client = SpannerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2095,7 +2121,7 @@ async def test_get_session_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_session), "__call__") as call: @@ -2122,11 +2148,6 @@ async def test_get_session_async( assert response.multiplexed is True -@pytest.mark.asyncio -async def test_get_session_async_from_dict(): - await test_get_session_async(request_type=dict) - - def test_get_session_field_headers(): client = SpannerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2269,8 +2290,8 @@ async def test_get_session_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - spanner.ListSessionsRequest, - dict, + spanner.ListSessionsRequest(), + {}, ], ) def test_list_sessions(request_type, transport: str = "grpc"): @@ -2281,7 +2302,7 @@ def test_list_sessions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_sessions), "__call__") as call: @@ -2327,11 +2348,12 @@ def test_list_sessions_non_empty_request_with_auto_populated_field(): client.list_sessions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == spanner.ListSessionsRequest( + request_msg = spanner.ListSessionsRequest( database="database_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_sessions_use_cached_wrapped_rpc(): @@ -2412,9 +2434,14 @@ async def test_list_sessions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_sessions_async( - transport: str = "grpc_asyncio", request_type=spanner.ListSessionsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + spanner.ListSessionsRequest(), + {}, + ], +) +async def test_list_sessions_async(request_type, transport: str = "grpc_asyncio"): client = SpannerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2422,7 +2449,7 @@ async def test_list_sessions_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_sessions), "__call__") as call: @@ -2445,11 +2472,6 @@ async def test_list_sessions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_sessions_async_from_dict(): - await test_list_sessions_async(request_type=dict) - - def test_list_sessions_field_headers(): client = SpannerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2786,8 +2808,8 @@ async def test_list_sessions_async_pages(): @pytest.mark.parametrize( "request_type", [ - spanner.DeleteSessionRequest, - dict, + spanner.DeleteSessionRequest(), + {}, ], ) def test_delete_session(request_type, transport: str = "grpc"): @@ -2798,7 +2820,7 @@ def test_delete_session(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_session), "__call__") as call: @@ -2839,9 +2861,10 @@ def test_delete_session_non_empty_request_with_auto_populated_field(): client.delete_session(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == spanner.DeleteSessionRequest( + request_msg = spanner.DeleteSessionRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_session_use_cached_wrapped_rpc(): @@ -2922,9 +2945,14 @@ async def test_delete_session_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_session_async( - transport: str = "grpc_asyncio", request_type=spanner.DeleteSessionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + spanner.DeleteSessionRequest(), + {}, + ], +) +async def test_delete_session_async(request_type, transport: str = "grpc_asyncio"): client = SpannerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2932,7 +2960,7 @@ async def test_delete_session_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_session), "__call__") as call: @@ -2950,11 +2978,6 @@ async def test_delete_session_async( assert response is None -@pytest.mark.asyncio -async def test_delete_session_async_from_dict(): - await test_delete_session_async(request_type=dict) - - def test_delete_session_field_headers(): client = SpannerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3097,8 +3120,8 @@ async def test_delete_session_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - spanner.ExecuteSqlRequest, - dict, + spanner.ExecuteSqlRequest(), + {}, ], ) def test_execute_sql(request_type, transport: str = "grpc"): @@ -3109,7 +3132,7 @@ def test_execute_sql(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.execute_sql), "__call__") as call: @@ -3151,10 +3174,11 @@ def test_execute_sql_non_empty_request_with_auto_populated_field(): client.execute_sql(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == spanner.ExecuteSqlRequest( + request_msg = spanner.ExecuteSqlRequest( session="session_value", sql="sql_value", ) + assert args[0] == request_msg def test_execute_sql_use_cached_wrapped_rpc(): @@ -3235,9 +3259,14 @@ async def test_execute_sql_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_execute_sql_async( - transport: str = "grpc_asyncio", request_type=spanner.ExecuteSqlRequest -): +@pytest.mark.parametrize( + "request_type", + [ + spanner.ExecuteSqlRequest(), + {}, + ], +) +async def test_execute_sql_async(request_type, transport: str = "grpc_asyncio"): client = SpannerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3245,7 +3274,7 @@ async def test_execute_sql_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.execute_sql), "__call__") as call: @@ -3265,11 +3294,6 @@ async def test_execute_sql_async( assert isinstance(response, result_set.ResultSet) -@pytest.mark.asyncio -async def test_execute_sql_async_from_dict(): - await test_execute_sql_async(request_type=dict) - - def test_execute_sql_field_headers(): client = SpannerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3334,8 +3358,8 @@ async def test_execute_sql_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - spanner.ExecuteSqlRequest, - dict, + spanner.ExecuteSqlRequest(), + {}, ], ) def test_execute_streaming_sql(request_type, transport: str = "grpc"): @@ -3346,7 +3370,7 @@ def test_execute_streaming_sql(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3393,10 +3417,11 @@ def test_execute_streaming_sql_non_empty_request_with_auto_populated_field(): client.execute_streaming_sql(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == spanner.ExecuteSqlRequest( + request_msg = spanner.ExecuteSqlRequest( session="session_value", sql="sql_value", ) + assert args[0] == request_msg def test_execute_streaming_sql_use_cached_wrapped_rpc(): @@ -3482,8 +3507,15 @@ async def test_execute_streaming_sql_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + spanner.ExecuteSqlRequest(), + {}, + ], +) async def test_execute_streaming_sql_async( - transport: str = "grpc_asyncio", request_type=spanner.ExecuteSqlRequest + request_type, transport: str = "grpc_asyncio" ): client = SpannerAsyncClient( credentials=async_anonymous_credentials(), @@ -3492,7 +3524,7 @@ async def test_execute_streaming_sql_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( @@ -3516,11 +3548,6 @@ async def test_execute_streaming_sql_async( assert isinstance(message, result_set.PartialResultSet) -@pytest.mark.asyncio -async def test_execute_streaming_sql_async_from_dict(): - await test_execute_streaming_sql_async(request_type=dict) - - def test_execute_streaming_sql_field_headers(): client = SpannerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3590,8 +3617,8 @@ async def test_execute_streaming_sql_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - spanner.ExecuteBatchDmlRequest, - dict, + spanner.ExecuteBatchDmlRequest(), + {}, ], ) def test_execute_batch_dml(request_type, transport: str = "grpc"): @@ -3602,7 +3629,7 @@ def test_execute_batch_dml(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3647,9 +3674,10 @@ def test_execute_batch_dml_non_empty_request_with_auto_populated_field(): client.execute_batch_dml(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == spanner.ExecuteBatchDmlRequest( + request_msg = spanner.ExecuteBatchDmlRequest( session="session_value", ) + assert args[0] == request_msg def test_execute_batch_dml_use_cached_wrapped_rpc(): @@ -3732,9 +3760,14 @@ async def test_execute_batch_dml_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_execute_batch_dml_async( - transport: str = "grpc_asyncio", request_type=spanner.ExecuteBatchDmlRequest -): +@pytest.mark.parametrize( + "request_type", + [ + spanner.ExecuteBatchDmlRequest(), + {}, + ], +) +async def test_execute_batch_dml_async(request_type, transport: str = "grpc_asyncio"): client = SpannerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3742,7 +3775,7 @@ async def test_execute_batch_dml_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( @@ -3764,11 +3797,6 @@ async def test_execute_batch_dml_async( assert isinstance(response, spanner.ExecuteBatchDmlResponse) -@pytest.mark.asyncio -async def test_execute_batch_dml_async_from_dict(): - await test_execute_batch_dml_async(request_type=dict) - - def test_execute_batch_dml_field_headers(): client = SpannerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3837,8 +3865,8 @@ async def test_execute_batch_dml_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - spanner.ReadRequest, - dict, + spanner.ReadRequest(), + {}, ], ) def test_read(request_type, transport: str = "grpc"): @@ -3849,7 +3877,7 @@ def test_read(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.read), "__call__") as call: @@ -3892,11 +3920,12 @@ def test_read_non_empty_request_with_auto_populated_field(): client.read(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == spanner.ReadRequest( + request_msg = spanner.ReadRequest( session="session_value", table="table_value", index="index_value", ) + assert args[0] == request_msg def test_read_use_cached_wrapped_rpc(): @@ -3974,9 +4003,14 @@ async def test_read_async_use_cached_wrapped_rpc(transport: str = "grpc_asyncio" @pytest.mark.asyncio -async def test_read_async( - transport: str = "grpc_asyncio", request_type=spanner.ReadRequest -): +@pytest.mark.parametrize( + "request_type", + [ + spanner.ReadRequest(), + {}, + ], +) +async def test_read_async(request_type, transport: str = "grpc_asyncio"): client = SpannerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3984,7 +4018,7 @@ async def test_read_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.read), "__call__") as call: @@ -4004,11 +4038,6 @@ async def test_read_async( assert isinstance(response, result_set.ResultSet) -@pytest.mark.asyncio -async def test_read_async_from_dict(): - await test_read_async(request_type=dict) - - def test_read_field_headers(): client = SpannerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4073,8 +4102,8 @@ async def test_read_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - spanner.ReadRequest, - dict, + spanner.ReadRequest(), + {}, ], ) def test_streaming_read(request_type, transport: str = "grpc"): @@ -4085,7 +4114,7 @@ def test_streaming_read(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.streaming_read), "__call__") as call: @@ -4129,11 +4158,12 @@ def test_streaming_read_non_empty_request_with_auto_populated_field(): client.streaming_read(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == spanner.ReadRequest( + request_msg = spanner.ReadRequest( session="session_value", table="table_value", index="index_value", ) + assert args[0] == request_msg def test_streaming_read_use_cached_wrapped_rpc(): @@ -4214,9 +4244,14 @@ async def test_streaming_read_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_streaming_read_async( - transport: str = "grpc_asyncio", request_type=spanner.ReadRequest -): +@pytest.mark.parametrize( + "request_type", + [ + spanner.ReadRequest(), + {}, + ], +) +async def test_streaming_read_async(request_type, transport: str = "grpc_asyncio"): client = SpannerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4224,7 +4259,7 @@ async def test_streaming_read_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.streaming_read), "__call__") as call: @@ -4246,11 +4281,6 @@ async def test_streaming_read_async( assert isinstance(message, result_set.PartialResultSet) -@pytest.mark.asyncio -async def test_streaming_read_async_from_dict(): - await test_streaming_read_async(request_type=dict) - - def test_streaming_read_field_headers(): client = SpannerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4316,8 +4346,8 @@ async def test_streaming_read_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - spanner.BeginTransactionRequest, - dict, + spanner.BeginTransactionRequest(), + {}, ], ) def test_begin_transaction(request_type, transport: str = "grpc"): @@ -4328,7 +4358,7 @@ def test_begin_transaction(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4376,9 +4406,10 @@ def test_begin_transaction_non_empty_request_with_auto_populated_field(): client.begin_transaction(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == spanner.BeginTransactionRequest( + request_msg = spanner.BeginTransactionRequest( session="session_value", ) + assert args[0] == request_msg def test_begin_transaction_use_cached_wrapped_rpc(): @@ -4461,9 +4492,14 @@ async def test_begin_transaction_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_begin_transaction_async( - transport: str = "grpc_asyncio", request_type=spanner.BeginTransactionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + spanner.BeginTransactionRequest(), + {}, + ], +) +async def test_begin_transaction_async(request_type, transport: str = "grpc_asyncio"): client = SpannerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4471,7 +4507,7 @@ async def test_begin_transaction_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( @@ -4496,11 +4532,6 @@ async def test_begin_transaction_async( assert response.id == b"id_blob" -@pytest.mark.asyncio -async def test_begin_transaction_async_from_dict(): - await test_begin_transaction_async(request_type=dict) - - def test_begin_transaction_field_headers(): client = SpannerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4689,8 +4720,8 @@ async def test_begin_transaction_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - spanner.CommitRequest, - dict, + spanner.CommitRequest(), + {}, ], ) def test_commit(request_type, transport: str = "grpc"): @@ -4701,7 +4732,7 @@ def test_commit(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.commit), "__call__") as call: @@ -4753,9 +4784,10 @@ def test_commit_non_empty_request_with_auto_populated_field(): client.commit(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == spanner.CommitRequest( + request_msg = spanner.CommitRequest( session="session_value", ) + assert args[0] == request_msg def test_commit_use_cached_wrapped_rpc(): @@ -4834,9 +4866,14 @@ async def test_commit_async_use_cached_wrapped_rpc(transport: str = "grpc_asynci @pytest.mark.asyncio -async def test_commit_async( - transport: str = "grpc_asyncio", request_type=spanner.CommitRequest -): +@pytest.mark.parametrize( + "request_type", + [ + spanner.CommitRequest(), + {}, + ], +) +async def test_commit_async(request_type, transport: str = "grpc_asyncio"): client = SpannerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4844,7 +4881,7 @@ async def test_commit_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.commit), "__call__") as call: @@ -4875,11 +4912,6 @@ async def test_commit_async( ) -@pytest.mark.asyncio -async def test_commit_async_from_dict(): - await test_commit_async(request_type=dict) - - def test_commit_field_headers(): client = SpannerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5082,8 +5114,8 @@ async def test_commit_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - spanner.RollbackRequest, - dict, + spanner.RollbackRequest(), + {}, ], ) def test_rollback(request_type, transport: str = "grpc"): @@ -5094,7 +5126,7 @@ def test_rollback(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.rollback), "__call__") as call: @@ -5135,9 +5167,10 @@ def test_rollback_non_empty_request_with_auto_populated_field(): client.rollback(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == spanner.RollbackRequest( + request_msg = spanner.RollbackRequest( session="session_value", ) + assert args[0] == request_msg def test_rollback_use_cached_wrapped_rpc(): @@ -5216,9 +5249,14 @@ async def test_rollback_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn @pytest.mark.asyncio -async def test_rollback_async( - transport: str = "grpc_asyncio", request_type=spanner.RollbackRequest -): +@pytest.mark.parametrize( + "request_type", + [ + spanner.RollbackRequest(), + {}, + ], +) +async def test_rollback_async(request_type, transport: str = "grpc_asyncio"): client = SpannerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5226,7 +5264,7 @@ async def test_rollback_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.rollback), "__call__") as call: @@ -5244,11 +5282,6 @@ async def test_rollback_async( assert response is None -@pytest.mark.asyncio -async def test_rollback_async_from_dict(): - await test_rollback_async(request_type=dict) - - def test_rollback_field_headers(): client = SpannerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5401,8 +5434,8 @@ async def test_rollback_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - spanner.PartitionQueryRequest, - dict, + spanner.PartitionQueryRequest(), + {}, ], ) def test_partition_query(request_type, transport: str = "grpc"): @@ -5413,7 +5446,7 @@ def test_partition_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(type(client.transport.partition_query), "__call__") as call: @@ -5455,10 +5488,11 @@ def test_partition_query_non_empty_request_with_auto_populated_field(): client.partition_query(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == spanner.PartitionQueryRequest( + request_msg = spanner.PartitionQueryRequest( session="session_value", sql="sql_value", ) + assert args[0] == request_msg def test_partition_query_use_cached_wrapped_rpc(): @@ -5539,9 +5573,14 @@ async def test_partition_query_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_partition_query_async( - transport: str = "grpc_asyncio", request_type=spanner.PartitionQueryRequest -): +@pytest.mark.parametrize( + "request_type", + [ + spanner.PartitionQueryRequest(), + {}, + ], +) +async def test_partition_query_async(request_type, transport: str = "grpc_asyncio"): client = SpannerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5549,7 +5588,7 @@ async def test_partition_query_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.partition_query), "__call__") as call: @@ -5569,11 +5608,6 @@ async def test_partition_query_async( assert isinstance(response, spanner.PartitionResponse) -@pytest.mark.asyncio -async def test_partition_query_async_from_dict(): - await test_partition_query_async(request_type=dict) - - def test_partition_query_field_headers(): client = SpannerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5638,8 +5672,8 @@ async def test_partition_query_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - spanner.PartitionReadRequest, - dict, + spanner.PartitionReadRequest(), + {}, ], ) def test_partition_read(request_type, transport: str = "grpc"): @@ -5650,7 +5684,7 @@ def test_partition_read(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.partition_read), "__call__") as call: @@ -5693,11 +5727,12 @@ def test_partition_read_non_empty_request_with_auto_populated_field(): client.partition_read(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == spanner.PartitionReadRequest( + request_msg = spanner.PartitionReadRequest( session="session_value", table="table_value", index="index_value", ) + assert args[0] == request_msg def test_partition_read_use_cached_wrapped_rpc(): @@ -5778,9 +5813,14 @@ async def test_partition_read_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_partition_read_async( - transport: str = "grpc_asyncio", request_type=spanner.PartitionReadRequest -): +@pytest.mark.parametrize( + "request_type", + [ + spanner.PartitionReadRequest(), + {}, + ], +) +async def test_partition_read_async(request_type, transport: str = "grpc_asyncio"): client = SpannerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5788,7 +5828,7 @@ async def test_partition_read_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.partition_read), "__call__") as call: @@ -5808,11 +5848,6 @@ async def test_partition_read_async( assert isinstance(response, spanner.PartitionResponse) -@pytest.mark.asyncio -async def test_partition_read_async_from_dict(): - await test_partition_read_async(request_type=dict) - - def test_partition_read_field_headers(): client = SpannerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5877,8 +5912,8 @@ async def test_partition_read_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - spanner.BatchWriteRequest, - dict, + spanner.BatchWriteRequest(), + {}, ], ) def test_batch_write(request_type, transport: str = "grpc"): @@ -5889,7 +5924,7 @@ def test_batch_write(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.batch_write), "__call__") as call: @@ -5931,9 +5966,10 @@ def test_batch_write_non_empty_request_with_auto_populated_field(): client.batch_write(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == spanner.BatchWriteRequest( + request_msg = spanner.BatchWriteRequest( session="session_value", ) + assert args[0] == request_msg def test_batch_write_use_cached_wrapped_rpc(): @@ -6014,9 +6050,14 @@ async def test_batch_write_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_batch_write_async( - transport: str = "grpc_asyncio", request_type=spanner.BatchWriteRequest -): +@pytest.mark.parametrize( + "request_type", + [ + spanner.BatchWriteRequest(), + {}, + ], +) +async def test_batch_write_async(request_type, transport: str = "grpc_asyncio"): client = SpannerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6024,7 +6065,7 @@ async def test_batch_write_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.batch_write), "__call__") as call: @@ -6046,11 +6087,6 @@ async def test_batch_write_async( assert isinstance(message, spanner.BatchWriteResponse) -@pytest.mark.asyncio -async def test_batch_write_async_from_dict(): - await test_batch_write_async(request_type=dict) - - def test_batch_write_field_headers(): client = SpannerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6254,8 +6290,8 @@ async def test_batch_write_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - spanner.FetchCacheUpdateRequest, - dict, + spanner.FetchCacheUpdateRequest(), + {}, ], ) def test_fetch_cache_update(request_type, transport: str = "grpc"): @@ -6266,7 +6302,7 @@ def test_fetch_cache_update(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6312,9 +6348,10 @@ def test_fetch_cache_update_non_empty_request_with_auto_populated_field(): client.fetch_cache_update(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == spanner.FetchCacheUpdateRequest( + request_msg = spanner.FetchCacheUpdateRequest( database="database_value", ) + assert args[0] == request_msg def test_fetch_cache_update_use_cached_wrapped_rpc(): @@ -6399,9 +6436,14 @@ async def test_fetch_cache_update_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_fetch_cache_update_async( - transport: str = "grpc_asyncio", request_type=spanner.FetchCacheUpdateRequest -): +@pytest.mark.parametrize( + "request_type", + [ + spanner.FetchCacheUpdateRequest(), + {}, + ], +) +async def test_fetch_cache_update_async(request_type, transport: str = "grpc_asyncio"): client = SpannerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6409,7 +6451,7 @@ async def test_fetch_cache_update_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( @@ -6431,11 +6473,6 @@ async def test_fetch_cache_update_async( assert isinstance(message, location.CacheUpdate) -@pytest.mark.asyncio -async def test_fetch_cache_update_async_from_dict(): - await test_fetch_cache_update_async(request_type=dict) - - def test_fetch_cache_update_field_headers(): client = SpannerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9636,7 +9673,6 @@ def test_create_session_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner.CreateSessionRequest() - assert args[0] == request_msg @@ -9659,7 +9695,6 @@ def test_batch_create_sessions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner.BatchCreateSessionsRequest() - assert args[0] == request_msg @@ -9680,7 +9715,6 @@ def test_get_session_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner.GetSessionRequest() - assert args[0] == request_msg @@ -9701,7 +9735,6 @@ def test_list_sessions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner.ListSessionsRequest() - assert args[0] == request_msg @@ -9722,7 +9755,6 @@ def test_delete_session_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner.DeleteSessionRequest() - assert args[0] == request_msg @@ -9743,7 +9775,6 @@ def test_execute_sql_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner.ExecuteSqlRequest() - assert args[0] == request_msg @@ -9766,7 +9797,6 @@ def test_execute_streaming_sql_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner.ExecuteSqlRequest() - assert args[0] == request_msg @@ -9789,7 +9819,6 @@ def test_execute_batch_dml_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner.ExecuteBatchDmlRequest() - assert args[0] == request_msg @@ -9810,7 +9839,6 @@ def test_read_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner.ReadRequest() - assert args[0] == request_msg @@ -9831,7 +9859,6 @@ def test_streaming_read_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner.ReadRequest() - assert args[0] == request_msg @@ -9854,7 +9881,6 @@ def test_begin_transaction_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner.BeginTransactionRequest() - assert args[0] == request_msg @@ -9875,7 +9901,6 @@ def test_commit_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner.CommitRequest() - assert args[0] == request_msg @@ -9896,7 +9921,6 @@ def test_rollback_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner.RollbackRequest() - assert args[0] == request_msg @@ -9917,7 +9941,6 @@ def test_partition_query_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner.PartitionQueryRequest() - assert args[0] == request_msg @@ -9938,7 +9961,6 @@ def test_partition_read_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner.PartitionReadRequest() - assert args[0] == request_msg @@ -9959,7 +9981,6 @@ def test_batch_write_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner.BatchWriteRequest() - assert args[0] == request_msg @@ -9982,7 +10003,6 @@ def test_fetch_cache_update_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner.FetchCacheUpdateRequest() - assert args[0] == request_msg @@ -10025,7 +10045,6 @@ async def test_create_session_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner.CreateSessionRequest() - assert args[0] == request_msg @@ -10052,7 +10071,6 @@ async def test_batch_create_sessions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner.BatchCreateSessionsRequest() - assert args[0] == request_msg @@ -10081,7 +10099,6 @@ async def test_get_session_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner.GetSessionRequest() - assert args[0] == request_msg @@ -10108,7 +10125,6 @@ async def test_list_sessions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner.ListSessionsRequest() - assert args[0] == request_msg @@ -10131,7 +10147,6 @@ async def test_delete_session_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner.DeleteSessionRequest() - assert args[0] == request_msg @@ -10156,7 +10171,6 @@ async def test_execute_sql_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner.ExecuteSqlRequest() - assert args[0] == request_msg @@ -10184,7 +10198,6 @@ async def test_execute_streaming_sql_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner.ExecuteSqlRequest() - assert args[0] == request_msg @@ -10211,7 +10224,6 @@ async def test_execute_batch_dml_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner.ExecuteBatchDmlRequest() - assert args[0] == request_msg @@ -10236,7 +10248,6 @@ async def test_read_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner.ReadRequest() - assert args[0] == request_msg @@ -10262,7 +10273,6 @@ async def test_streaming_read_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner.ReadRequest() - assert args[0] == request_msg @@ -10291,7 +10301,6 @@ async def test_begin_transaction_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner.BeginTransactionRequest() - assert args[0] == request_msg @@ -10319,7 +10328,6 @@ async def test_commit_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner.CommitRequest() - assert args[0] == request_msg @@ -10342,7 +10350,6 @@ async def test_rollback_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner.RollbackRequest() - assert args[0] == request_msg @@ -10367,7 +10374,6 @@ async def test_partition_query_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner.PartitionQueryRequest() - assert args[0] == request_msg @@ -10392,7 +10398,6 @@ async def test_partition_read_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner.PartitionReadRequest() - assert args[0] == request_msg @@ -10418,7 +10423,6 @@ async def test_batch_write_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner.BatchWriteRequest() - assert args[0] == request_msg @@ -10444,7 +10448,6 @@ async def test_fetch_cache_update_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner.FetchCacheUpdateRequest() - assert args[0] == request_msg @@ -12635,7 +12638,6 @@ def test_create_session_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner.CreateSessionRequest() - assert args[0] == request_msg @@ -12657,7 +12659,6 @@ def test_batch_create_sessions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner.BatchCreateSessionsRequest() - assert args[0] == request_msg @@ -12677,7 +12678,6 @@ def test_get_session_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner.GetSessionRequest() - assert args[0] == request_msg @@ -12697,7 +12697,6 @@ def test_list_sessions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner.ListSessionsRequest() - assert args[0] == request_msg @@ -12717,7 +12716,6 @@ def test_delete_session_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner.DeleteSessionRequest() - assert args[0] == request_msg @@ -12737,7 +12735,6 @@ def test_execute_sql_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner.ExecuteSqlRequest() - assert args[0] == request_msg @@ -12759,7 +12756,6 @@ def test_execute_streaming_sql_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner.ExecuteSqlRequest() - assert args[0] == request_msg @@ -12781,7 +12777,6 @@ def test_execute_batch_dml_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner.ExecuteBatchDmlRequest() - assert args[0] == request_msg @@ -12801,7 +12796,6 @@ def test_read_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner.ReadRequest() - assert args[0] == request_msg @@ -12821,7 +12815,6 @@ def test_streaming_read_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner.ReadRequest() - assert args[0] == request_msg @@ -12843,7 +12836,6 @@ def test_begin_transaction_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner.BeginTransactionRequest() - assert args[0] == request_msg @@ -12863,7 +12855,6 @@ def test_commit_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner.CommitRequest() - assert args[0] == request_msg @@ -12883,7 +12874,6 @@ def test_rollback_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner.RollbackRequest() - assert args[0] == request_msg @@ -12903,7 +12893,6 @@ def test_partition_query_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner.PartitionQueryRequest() - assert args[0] == request_msg @@ -12923,7 +12912,6 @@ def test_partition_read_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner.PartitionReadRequest() - assert args[0] == request_msg @@ -12943,7 +12931,6 @@ def test_batch_write_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner.BatchWriteRequest() - assert args[0] == request_msg @@ -12965,7 +12952,6 @@ def test_fetch_cache_update_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = spanner.FetchCacheUpdateRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-speech/noxfile.py b/packages/google-cloud-speech/noxfile.py index 367a6a95493c..bc07809189ba 100644 --- a/packages/google-cloud-speech/noxfile.py +++ b/packages/google-cloud-speech/noxfile.py @@ -47,7 +47,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-speech" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -468,14 +473,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -587,14 +584,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-speech/setup.py b/packages/google-cloud-speech/setup.py index 4232ca558bc8..46a8b8bc8298 100644 --- a/packages/google-cloud-speech/setup.py +++ b/packages/google-cloud-speech/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/google-cloud-speech/testing/constraints-3.10.txt b/packages/google-cloud-speech/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-speech/testing/constraints-3.10.txt +++ b/packages/google-cloud-speech/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-speech/tests/unit/gapic/speech_v1/test_adaptation.py b/packages/google-cloud-speech/tests/unit/gapic/speech_v1/test_adaptation.py index 70283cf71d57..613ddb49a3ae 100644 --- a/packages/google-cloud-speech/tests/unit/gapic/speech_v1/test_adaptation.py +++ b/packages/google-cloud-speech/tests/unit/gapic/speech_v1/test_adaptation.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 @@ -109,6 +110,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" @@ -1270,8 +1286,8 @@ def test_adaptation_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - cloud_speech_adaptation.CreatePhraseSetRequest, - dict, + cloud_speech_adaptation.CreatePhraseSetRequest(), + {}, ], ) def test_create_phrase_set(request_type, transport: str = "grpc"): @@ -1282,7 +1298,7 @@ def test_create_phrase_set(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1333,10 +1349,11 @@ def test_create_phrase_set_non_empty_request_with_auto_populated_field(): client.create_phrase_set(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_speech_adaptation.CreatePhraseSetRequest( + request_msg = cloud_speech_adaptation.CreatePhraseSetRequest( parent="parent_value", phrase_set_id="phrase_set_id_value", ) + assert args[0] == request_msg def test_create_phrase_set_use_cached_wrapped_rpc(): @@ -1419,10 +1436,14 @@ async def test_create_phrase_set_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_phrase_set_async( - transport: str = "grpc_asyncio", - request_type=cloud_speech_adaptation.CreatePhraseSetRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_speech_adaptation.CreatePhraseSetRequest(), + {}, + ], +) +async def test_create_phrase_set_async(request_type, transport: str = "grpc_asyncio"): client = AdaptationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1430,7 +1451,7 @@ async def test_create_phrase_set_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( @@ -1457,11 +1478,6 @@ async def test_create_phrase_set_async( assert math.isclose(response.boost, 0.551, rel_tol=1e-6) -@pytest.mark.asyncio -async def test_create_phrase_set_async_from_dict(): - await test_create_phrase_set_async(request_type=dict) - - def test_create_phrase_set_field_headers(): client = AdaptationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1632,8 +1648,8 @@ async def test_create_phrase_set_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_speech_adaptation.GetPhraseSetRequest, - dict, + cloud_speech_adaptation.GetPhraseSetRequest(), + {}, ], ) def test_get_phrase_set(request_type, transport: str = "grpc"): @@ -1644,7 +1660,7 @@ def test_get_phrase_set(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_phrase_set), "__call__") as call: @@ -1690,9 +1706,10 @@ def test_get_phrase_set_non_empty_request_with_auto_populated_field(): client.get_phrase_set(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_speech_adaptation.GetPhraseSetRequest( + request_msg = cloud_speech_adaptation.GetPhraseSetRequest( name="name_value", ) + assert args[0] == request_msg def test_get_phrase_set_use_cached_wrapped_rpc(): @@ -1773,10 +1790,14 @@ async def test_get_phrase_set_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_phrase_set_async( - transport: str = "grpc_asyncio", - request_type=cloud_speech_adaptation.GetPhraseSetRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_speech_adaptation.GetPhraseSetRequest(), + {}, + ], +) +async def test_get_phrase_set_async(request_type, transport: str = "grpc_asyncio"): client = AdaptationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1784,7 +1805,7 @@ async def test_get_phrase_set_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_phrase_set), "__call__") as call: @@ -1809,11 +1830,6 @@ async def test_get_phrase_set_async( assert math.isclose(response.boost, 0.551, rel_tol=1e-6) -@pytest.mark.asyncio -async def test_get_phrase_set_async_from_dict(): - await test_get_phrase_set_async(request_type=dict) - - def test_get_phrase_set_field_headers(): client = AdaptationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1956,8 +1972,8 @@ async def test_get_phrase_set_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_speech_adaptation.ListPhraseSetRequest, - dict, + cloud_speech_adaptation.ListPhraseSetRequest(), + {}, ], ) def test_list_phrase_set(request_type, transport: str = "grpc"): @@ -1968,7 +1984,7 @@ def test_list_phrase_set(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_phrase_set), "__call__") as call: @@ -2013,10 +2029,11 @@ def test_list_phrase_set_non_empty_request_with_auto_populated_field(): client.list_phrase_set(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_speech_adaptation.ListPhraseSetRequest( + request_msg = cloud_speech_adaptation.ListPhraseSetRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_phrase_set_use_cached_wrapped_rpc(): @@ -2097,10 +2114,14 @@ async def test_list_phrase_set_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_phrase_set_async( - transport: str = "grpc_asyncio", - request_type=cloud_speech_adaptation.ListPhraseSetRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_speech_adaptation.ListPhraseSetRequest(), + {}, + ], +) +async def test_list_phrase_set_async(request_type, transport: str = "grpc_asyncio"): client = AdaptationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2108,7 +2129,7 @@ async def test_list_phrase_set_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_phrase_set), "__call__") as call: @@ -2131,11 +2152,6 @@ async def test_list_phrase_set_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_phrase_set_async_from_dict(): - await test_list_phrase_set_async(request_type=dict) - - def test_list_phrase_set_field_headers(): client = AdaptationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2472,8 +2488,8 @@ async def test_list_phrase_set_async_pages(): @pytest.mark.parametrize( "request_type", [ - cloud_speech_adaptation.UpdatePhraseSetRequest, - dict, + cloud_speech_adaptation.UpdatePhraseSetRequest(), + {}, ], ) def test_update_phrase_set(request_type, transport: str = "grpc"): @@ -2484,7 +2500,7 @@ def test_update_phrase_set(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,7 +2548,8 @@ def test_update_phrase_set_non_empty_request_with_auto_populated_field(): client.update_phrase_set(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_speech_adaptation.UpdatePhraseSetRequest() + request_msg = cloud_speech_adaptation.UpdatePhraseSetRequest() + assert args[0] == request_msg def test_update_phrase_set_use_cached_wrapped_rpc(): @@ -2615,10 +2632,14 @@ async def test_update_phrase_set_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_phrase_set_async( - transport: str = "grpc_asyncio", - request_type=cloud_speech_adaptation.UpdatePhraseSetRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_speech_adaptation.UpdatePhraseSetRequest(), + {}, + ], +) +async def test_update_phrase_set_async(request_type, transport: str = "grpc_asyncio"): client = AdaptationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2626,7 +2647,7 @@ async def test_update_phrase_set_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( @@ -2653,11 +2674,6 @@ async def test_update_phrase_set_async( assert math.isclose(response.boost, 0.551, rel_tol=1e-6) -@pytest.mark.asyncio -async def test_update_phrase_set_async_from_dict(): - await test_update_phrase_set_async(request_type=dict) - - def test_update_phrase_set_field_headers(): client = AdaptationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2818,8 +2834,8 @@ async def test_update_phrase_set_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_speech_adaptation.DeletePhraseSetRequest, - dict, + cloud_speech_adaptation.DeletePhraseSetRequest(), + {}, ], ) def test_delete_phrase_set(request_type, transport: str = "grpc"): @@ -2830,7 +2846,7 @@ def test_delete_phrase_set(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2875,9 +2891,10 @@ def test_delete_phrase_set_non_empty_request_with_auto_populated_field(): client.delete_phrase_set(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_speech_adaptation.DeletePhraseSetRequest( + request_msg = cloud_speech_adaptation.DeletePhraseSetRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_phrase_set_use_cached_wrapped_rpc(): @@ -2960,10 +2977,14 @@ async def test_delete_phrase_set_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_phrase_set_async( - transport: str = "grpc_asyncio", - request_type=cloud_speech_adaptation.DeletePhraseSetRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_speech_adaptation.DeletePhraseSetRequest(), + {}, + ], +) +async def test_delete_phrase_set_async(request_type, transport: str = "grpc_asyncio"): client = AdaptationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2971,7 +2992,7 @@ async def test_delete_phrase_set_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( @@ -2991,11 +3012,6 @@ async def test_delete_phrase_set_async( assert response is None -@pytest.mark.asyncio -async def test_delete_phrase_set_async_from_dict(): - await test_delete_phrase_set_async(request_type=dict) - - def test_delete_phrase_set_field_headers(): client = AdaptationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3146,8 +3162,8 @@ async def test_delete_phrase_set_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_speech_adaptation.CreateCustomClassRequest, - dict, + cloud_speech_adaptation.CreateCustomClassRequest(), + {}, ], ) def test_create_custom_class(request_type, transport: str = "grpc"): @@ -3158,7 +3174,7 @@ def test_create_custom_class(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3209,10 +3225,11 @@ def test_create_custom_class_non_empty_request_with_auto_populated_field(): client.create_custom_class(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_speech_adaptation.CreateCustomClassRequest( + request_msg = cloud_speech_adaptation.CreateCustomClassRequest( parent="parent_value", custom_class_id="custom_class_id_value", ) + assert args[0] == request_msg def test_create_custom_class_use_cached_wrapped_rpc(): @@ -3297,10 +3314,14 @@ async def test_create_custom_class_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_custom_class_async( - transport: str = "grpc_asyncio", - request_type=cloud_speech_adaptation.CreateCustomClassRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_speech_adaptation.CreateCustomClassRequest(), + {}, + ], +) +async def test_create_custom_class_async(request_type, transport: str = "grpc_asyncio"): client = AdaptationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3308,7 +3329,7 @@ async def test_create_custom_class_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( @@ -3335,11 +3356,6 @@ async def test_create_custom_class_async( assert response.custom_class_id == "custom_class_id_value" -@pytest.mark.asyncio -async def test_create_custom_class_async_from_dict(): - await test_create_custom_class_async(request_type=dict) - - def test_create_custom_class_field_headers(): client = AdaptationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3514,8 +3530,8 @@ async def test_create_custom_class_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_speech_adaptation.GetCustomClassRequest, - dict, + cloud_speech_adaptation.GetCustomClassRequest(), + {}, ], ) def test_get_custom_class(request_type, transport: str = "grpc"): @@ -3526,7 +3542,7 @@ def test_get_custom_class(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_custom_class), "__call__") as call: @@ -3572,9 +3588,10 @@ def test_get_custom_class_non_empty_request_with_auto_populated_field(): client.get_custom_class(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_speech_adaptation.GetCustomClassRequest( + request_msg = cloud_speech_adaptation.GetCustomClassRequest( name="name_value", ) + assert args[0] == request_msg def test_get_custom_class_use_cached_wrapped_rpc(): @@ -3657,10 +3674,14 @@ async def test_get_custom_class_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_custom_class_async( - transport: str = "grpc_asyncio", - request_type=cloud_speech_adaptation.GetCustomClassRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_speech_adaptation.GetCustomClassRequest(), + {}, + ], +) +async def test_get_custom_class_async(request_type, transport: str = "grpc_asyncio"): client = AdaptationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3668,7 +3689,7 @@ async def test_get_custom_class_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_custom_class), "__call__") as call: @@ -3693,11 +3714,6 @@ async def test_get_custom_class_async( assert response.custom_class_id == "custom_class_id_value" -@pytest.mark.asyncio -async def test_get_custom_class_async_from_dict(): - await test_get_custom_class_async(request_type=dict) - - def test_get_custom_class_field_headers(): client = AdaptationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3844,8 +3860,8 @@ async def test_get_custom_class_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_speech_adaptation.ListCustomClassesRequest, - dict, + cloud_speech_adaptation.ListCustomClassesRequest(), + {}, ], ) def test_list_custom_classes(request_type, transport: str = "grpc"): @@ -3856,7 +3872,7 @@ def test_list_custom_classes(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3905,10 +3921,11 @@ def test_list_custom_classes_non_empty_request_with_auto_populated_field(): client.list_custom_classes(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_speech_adaptation.ListCustomClassesRequest( + request_msg = cloud_speech_adaptation.ListCustomClassesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_custom_classes_use_cached_wrapped_rpc(): @@ -3993,10 +4010,14 @@ async def test_list_custom_classes_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_custom_classes_async( - transport: str = "grpc_asyncio", - request_type=cloud_speech_adaptation.ListCustomClassesRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_speech_adaptation.ListCustomClassesRequest(), + {}, + ], +) +async def test_list_custom_classes_async(request_type, transport: str = "grpc_asyncio"): client = AdaptationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4004,7 +4025,7 @@ async def test_list_custom_classes_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( @@ -4029,11 +4050,6 @@ async def test_list_custom_classes_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_custom_classes_async_from_dict(): - await test_list_custom_classes_async(request_type=dict) - - def test_list_custom_classes_field_headers(): client = AdaptationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4386,8 +4402,8 @@ async def test_list_custom_classes_async_pages(): @pytest.mark.parametrize( "request_type", [ - cloud_speech_adaptation.UpdateCustomClassRequest, - dict, + cloud_speech_adaptation.UpdateCustomClassRequest(), + {}, ], ) def test_update_custom_class(request_type, transport: str = "grpc"): @@ -4398,7 +4414,7 @@ def test_update_custom_class(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4446,7 +4462,8 @@ def test_update_custom_class_non_empty_request_with_auto_populated_field(): client.update_custom_class(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_speech_adaptation.UpdateCustomClassRequest() + request_msg = cloud_speech_adaptation.UpdateCustomClassRequest() + assert args[0] == request_msg def test_update_custom_class_use_cached_wrapped_rpc(): @@ -4531,10 +4548,14 @@ async def test_update_custom_class_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_custom_class_async( - transport: str = "grpc_asyncio", - request_type=cloud_speech_adaptation.UpdateCustomClassRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_speech_adaptation.UpdateCustomClassRequest(), + {}, + ], +) +async def test_update_custom_class_async(request_type, transport: str = "grpc_asyncio"): client = AdaptationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4542,7 +4563,7 @@ async def test_update_custom_class_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( @@ -4569,11 +4590,6 @@ async def test_update_custom_class_async( assert response.custom_class_id == "custom_class_id_value" -@pytest.mark.asyncio -async def test_update_custom_class_async_from_dict(): - await test_update_custom_class_async(request_type=dict) - - def test_update_custom_class_field_headers(): client = AdaptationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4738,8 +4754,8 @@ async def test_update_custom_class_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_speech_adaptation.DeleteCustomClassRequest, - dict, + cloud_speech_adaptation.DeleteCustomClassRequest(), + {}, ], ) def test_delete_custom_class(request_type, transport: str = "grpc"): @@ -4750,7 +4766,7 @@ def test_delete_custom_class(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4795,9 +4811,10 @@ def test_delete_custom_class_non_empty_request_with_auto_populated_field(): client.delete_custom_class(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_speech_adaptation.DeleteCustomClassRequest( + request_msg = cloud_speech_adaptation.DeleteCustomClassRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_custom_class_use_cached_wrapped_rpc(): @@ -4882,10 +4899,14 @@ async def test_delete_custom_class_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_custom_class_async( - transport: str = "grpc_asyncio", - request_type=cloud_speech_adaptation.DeleteCustomClassRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_speech_adaptation.DeleteCustomClassRequest(), + {}, + ], +) +async def test_delete_custom_class_async(request_type, transport: str = "grpc_asyncio"): client = AdaptationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4893,7 +4914,7 @@ async def test_delete_custom_class_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( @@ -4913,11 +4934,6 @@ async def test_delete_custom_class_async( assert response is None -@pytest.mark.asyncio -async def test_delete_custom_class_async_from_dict(): - await test_delete_custom_class_async(request_type=dict) - - def test_delete_custom_class_field_headers(): client = AdaptationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7195,7 +7211,6 @@ def test_create_phrase_set_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech_adaptation.CreatePhraseSetRequest() - assert args[0] == request_msg @@ -7216,7 +7231,6 @@ def test_get_phrase_set_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech_adaptation.GetPhraseSetRequest() - assert args[0] == request_msg @@ -7237,7 +7251,6 @@ def test_list_phrase_set_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech_adaptation.ListPhraseSetRequest() - assert args[0] == request_msg @@ -7260,7 +7273,6 @@ def test_update_phrase_set_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech_adaptation.UpdatePhraseSetRequest() - assert args[0] == request_msg @@ -7283,7 +7295,6 @@ def test_delete_phrase_set_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech_adaptation.DeletePhraseSetRequest() - assert args[0] == request_msg @@ -7306,7 +7317,6 @@ def test_create_custom_class_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech_adaptation.CreateCustomClassRequest() - assert args[0] == request_msg @@ -7327,7 +7337,6 @@ def test_get_custom_class_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech_adaptation.GetCustomClassRequest() - assert args[0] == request_msg @@ -7350,7 +7359,6 @@ def test_list_custom_classes_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech_adaptation.ListCustomClassesRequest() - assert args[0] == request_msg @@ -7373,7 +7381,6 @@ def test_update_custom_class_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech_adaptation.UpdateCustomClassRequest() - assert args[0] == request_msg @@ -7396,7 +7403,6 @@ def test_delete_custom_class_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech_adaptation.DeleteCustomClassRequest() - assert args[0] == request_msg @@ -7440,7 +7446,6 @@ async def test_create_phrase_set_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech_adaptation.CreatePhraseSetRequest() - assert args[0] == request_msg @@ -7468,7 +7473,6 @@ async def test_get_phrase_set_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech_adaptation.GetPhraseSetRequest() - assert args[0] == request_msg @@ -7495,7 +7499,6 @@ async def test_list_phrase_set_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech_adaptation.ListPhraseSetRequest() - assert args[0] == request_msg @@ -7525,7 +7528,6 @@ async def test_update_phrase_set_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech_adaptation.UpdatePhraseSetRequest() - assert args[0] == request_msg @@ -7550,7 +7552,6 @@ async def test_delete_phrase_set_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech_adaptation.DeletePhraseSetRequest() - assert args[0] == request_msg @@ -7580,7 +7581,6 @@ async def test_create_custom_class_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech_adaptation.CreateCustomClassRequest() - assert args[0] == request_msg @@ -7608,7 +7608,6 @@ async def test_get_custom_class_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech_adaptation.GetCustomClassRequest() - assert args[0] == request_msg @@ -7637,7 +7636,6 @@ async def test_list_custom_classes_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech_adaptation.ListCustomClassesRequest() - assert args[0] == request_msg @@ -7667,7 +7665,6 @@ async def test_update_custom_class_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech_adaptation.UpdateCustomClassRequest() - assert args[0] == request_msg @@ -7692,7 +7689,6 @@ async def test_delete_custom_class_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech_adaptation.DeleteCustomClassRequest() - assert args[0] == request_msg @@ -9297,7 +9293,6 @@ def test_create_phrase_set_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech_adaptation.CreatePhraseSetRequest() - assert args[0] == request_msg @@ -9317,7 +9312,6 @@ def test_get_phrase_set_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech_adaptation.GetPhraseSetRequest() - assert args[0] == request_msg @@ -9337,7 +9331,6 @@ def test_list_phrase_set_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech_adaptation.ListPhraseSetRequest() - assert args[0] == request_msg @@ -9359,7 +9352,6 @@ def test_update_phrase_set_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech_adaptation.UpdatePhraseSetRequest() - assert args[0] == request_msg @@ -9381,7 +9373,6 @@ def test_delete_phrase_set_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech_adaptation.DeletePhraseSetRequest() - assert args[0] == request_msg @@ -9403,7 +9394,6 @@ def test_create_custom_class_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech_adaptation.CreateCustomClassRequest() - assert args[0] == request_msg @@ -9423,7 +9413,6 @@ def test_get_custom_class_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech_adaptation.GetCustomClassRequest() - assert args[0] == request_msg @@ -9445,7 +9434,6 @@ def test_list_custom_classes_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech_adaptation.ListCustomClassesRequest() - assert args[0] == request_msg @@ -9467,7 +9455,6 @@ def test_update_custom_class_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech_adaptation.UpdateCustomClassRequest() - assert args[0] == request_msg @@ -9489,7 +9476,6 @@ def test_delete_custom_class_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech_adaptation.DeleteCustomClassRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-speech/tests/unit/gapic/speech_v1/test_speech.py b/packages/google-cloud-speech/tests/unit/gapic/speech_v1/test_speech.py index 2017a310408c..bce827cb981b 100644 --- a/packages/google-cloud-speech/tests/unit/gapic/speech_v1/test_speech.py +++ b/packages/google-cloud-speech/tests/unit/gapic/speech_v1/test_speech.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 @@ -114,6 +115,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" @@ -1246,8 +1262,8 @@ def test_speech_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - cloud_speech.RecognizeRequest, - dict, + cloud_speech.RecognizeRequest(), + {}, ], ) def test_recognize(request_type, transport: str = "grpc"): @@ -1258,7 +1274,7 @@ def test_recognize(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.recognize), "__call__") as call: @@ -1300,7 +1316,8 @@ def test_recognize_non_empty_request_with_auto_populated_field(): client.recognize(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_speech.RecognizeRequest() + request_msg = cloud_speech.RecognizeRequest() + assert args[0] == request_msg def test_recognize_use_cached_wrapped_rpc(): @@ -1379,9 +1396,14 @@ async def test_recognize_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_recognize_async( - transport: str = "grpc_asyncio", request_type=cloud_speech.RecognizeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_speech.RecognizeRequest(), + {}, + ], +) +async def test_recognize_async(request_type, transport: str = "grpc_asyncio"): client = SpeechAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1389,7 +1411,7 @@ async def test_recognize_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.recognize), "__call__") as call: @@ -1412,11 +1434,6 @@ async def test_recognize_async( assert response.request_id == 1077 -@pytest.mark.asyncio -async def test_recognize_async_from_dict(): - await test_recognize_async(request_type=dict) - - def test_recognize_flattened(): client = SpeechClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1524,8 +1541,8 @@ async def test_recognize_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_speech.LongRunningRecognizeRequest, - dict, + cloud_speech.LongRunningRecognizeRequest(), + {}, ], ) def test_long_running_recognize(request_type, transport: str = "grpc"): @@ -1536,7 +1553,7 @@ def test_long_running_recognize(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1579,7 +1596,8 @@ def test_long_running_recognize_non_empty_request_with_auto_populated_field(): client.long_running_recognize(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_speech.LongRunningRecognizeRequest() + request_msg = cloud_speech.LongRunningRecognizeRequest() + assert args[0] == request_msg def test_long_running_recognize_use_cached_wrapped_rpc(): @@ -1675,9 +1693,15 @@ async def test_long_running_recognize_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloud_speech.LongRunningRecognizeRequest(), + {}, + ], +) async def test_long_running_recognize_async( - transport: str = "grpc_asyncio", - request_type=cloud_speech.LongRunningRecognizeRequest, + request_type, transport: str = "grpc_asyncio" ): client = SpeechAsyncClient( credentials=async_anonymous_credentials(), @@ -1686,7 +1710,7 @@ async def test_long_running_recognize_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( @@ -1708,11 +1732,6 @@ async def test_long_running_recognize_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_long_running_recognize_async_from_dict(): - await test_long_running_recognize_async(request_type=dict) - - def test_long_running_recognize_flattened(): client = SpeechClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1824,8 +1843,8 @@ async def test_long_running_recognize_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_speech.StreamingRecognizeRequest, - dict, + cloud_speech.StreamingRecognizeRequest(), + {}, ], ) def test_streaming_recognize(request_type, transport: str = "grpc"): @@ -1836,7 +1855,7 @@ def test_streaming_recognize(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as 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. @@ -1939,9 +1958,14 @@ async def test_streaming_recognize_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_streaming_recognize_async( - transport: str = "grpc_asyncio", request_type=cloud_speech.StreamingRecognizeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_speech.StreamingRecognizeRequest(), + {}, + ], +) +async def test_streaming_recognize_async(request_type, transport: str = "grpc_asyncio"): client = SpeechAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1949,7 +1973,7 @@ async def test_streaming_recognize_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. @@ -1973,11 +1997,6 @@ async def test_streaming_recognize_async( assert isinstance(message, cloud_speech.StreamingRecognizeResponse) -@pytest.mark.asyncio -async def test_streaming_recognize_async_from_dict(): - await test_streaming_recognize_async(request_type=dict) - - def test_recognize_rest_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, # instead of constructing them on each call @@ -2499,7 +2518,6 @@ def test_recognize_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.RecognizeRequest() - assert args[0] == request_msg @@ -2522,7 +2540,6 @@ def test_long_running_recognize_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.LongRunningRecognizeRequest() - assert args[0] == request_msg @@ -2563,7 +2580,6 @@ async def test_recognize_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.RecognizeRequest() - assert args[0] == request_msg @@ -2590,7 +2606,6 @@ async def test_long_running_recognize_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.LongRunningRecognizeRequest() - assert args[0] == request_msg @@ -3004,7 +3019,6 @@ def test_recognize_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.RecognizeRequest() - assert args[0] == request_msg @@ -3026,7 +3040,6 @@ def test_long_running_recognize_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.LongRunningRecognizeRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-speech/tests/unit/gapic/speech_v1p1beta1/test_adaptation.py b/packages/google-cloud-speech/tests/unit/gapic/speech_v1p1beta1/test_adaptation.py index 41d7e71cbd98..e50ea155c1e3 100644 --- a/packages/google-cloud-speech/tests/unit/gapic/speech_v1p1beta1/test_adaptation.py +++ b/packages/google-cloud-speech/tests/unit/gapic/speech_v1p1beta1/test_adaptation.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 @@ -110,6 +111,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" @@ -1271,8 +1287,8 @@ def test_adaptation_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - cloud_speech_adaptation.CreatePhraseSetRequest, - dict, + cloud_speech_adaptation.CreatePhraseSetRequest(), + {}, ], ) def test_create_phrase_set(request_type, transport: str = "grpc"): @@ -1283,7 +1299,7 @@ def test_create_phrase_set(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1348,10 +1364,11 @@ def test_create_phrase_set_non_empty_request_with_auto_populated_field(): client.create_phrase_set(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_speech_adaptation.CreatePhraseSetRequest( + request_msg = cloud_speech_adaptation.CreatePhraseSetRequest( parent="parent_value", phrase_set_id="phrase_set_id_value", ) + assert args[0] == request_msg def test_create_phrase_set_use_cached_wrapped_rpc(): @@ -1434,10 +1451,14 @@ async def test_create_phrase_set_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_phrase_set_async( - transport: str = "grpc_asyncio", - request_type=cloud_speech_adaptation.CreatePhraseSetRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_speech_adaptation.CreatePhraseSetRequest(), + {}, + ], +) +async def test_create_phrase_set_async(request_type, transport: str = "grpc_asyncio"): client = AdaptationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1445,7 +1466,7 @@ async def test_create_phrase_set_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( @@ -1486,11 +1507,6 @@ async def test_create_phrase_set_async( assert response.reconciling is True -@pytest.mark.asyncio -async def test_create_phrase_set_async_from_dict(): - await test_create_phrase_set_async(request_type=dict) - - def test_create_phrase_set_field_headers(): client = AdaptationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1661,8 +1677,8 @@ async def test_create_phrase_set_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_speech_adaptation.GetPhraseSetRequest, - dict, + cloud_speech_adaptation.GetPhraseSetRequest(), + {}, ], ) def test_get_phrase_set(request_type, transport: str = "grpc"): @@ -1673,7 +1689,7 @@ def test_get_phrase_set(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_phrase_set), "__call__") as call: @@ -1733,9 +1749,10 @@ def test_get_phrase_set_non_empty_request_with_auto_populated_field(): client.get_phrase_set(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_speech_adaptation.GetPhraseSetRequest( + request_msg = cloud_speech_adaptation.GetPhraseSetRequest( name="name_value", ) + assert args[0] == request_msg def test_get_phrase_set_use_cached_wrapped_rpc(): @@ -1816,10 +1833,14 @@ async def test_get_phrase_set_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_phrase_set_async( - transport: str = "grpc_asyncio", - request_type=cloud_speech_adaptation.GetPhraseSetRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_speech_adaptation.GetPhraseSetRequest(), + {}, + ], +) +async def test_get_phrase_set_async(request_type, transport: str = "grpc_asyncio"): client = AdaptationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1827,7 +1848,7 @@ async def test_get_phrase_set_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_phrase_set), "__call__") as call: @@ -1866,11 +1887,6 @@ async def test_get_phrase_set_async( assert response.reconciling is True -@pytest.mark.asyncio -async def test_get_phrase_set_async_from_dict(): - await test_get_phrase_set_async(request_type=dict) - - def test_get_phrase_set_field_headers(): client = AdaptationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2013,8 +2029,8 @@ async def test_get_phrase_set_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_speech_adaptation.ListPhraseSetRequest, - dict, + cloud_speech_adaptation.ListPhraseSetRequest(), + {}, ], ) def test_list_phrase_set(request_type, transport: str = "grpc"): @@ -2025,7 +2041,7 @@ def test_list_phrase_set(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_phrase_set), "__call__") as call: @@ -2070,10 +2086,11 @@ def test_list_phrase_set_non_empty_request_with_auto_populated_field(): client.list_phrase_set(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_speech_adaptation.ListPhraseSetRequest( + request_msg = cloud_speech_adaptation.ListPhraseSetRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_phrase_set_use_cached_wrapped_rpc(): @@ -2154,10 +2171,14 @@ async def test_list_phrase_set_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_phrase_set_async( - transport: str = "grpc_asyncio", - request_type=cloud_speech_adaptation.ListPhraseSetRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_speech_adaptation.ListPhraseSetRequest(), + {}, + ], +) +async def test_list_phrase_set_async(request_type, transport: str = "grpc_asyncio"): client = AdaptationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2165,7 +2186,7 @@ async def test_list_phrase_set_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_phrase_set), "__call__") as call: @@ -2188,11 +2209,6 @@ async def test_list_phrase_set_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_phrase_set_async_from_dict(): - await test_list_phrase_set_async(request_type=dict) - - def test_list_phrase_set_field_headers(): client = AdaptationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2529,8 +2545,8 @@ async def test_list_phrase_set_async_pages(): @pytest.mark.parametrize( "request_type", [ - cloud_speech_adaptation.UpdatePhraseSetRequest, - dict, + cloud_speech_adaptation.UpdatePhraseSetRequest(), + {}, ], ) def test_update_phrase_set(request_type, transport: str = "grpc"): @@ -2541,7 +2557,7 @@ def test_update_phrase_set(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2603,7 +2619,8 @@ def test_update_phrase_set_non_empty_request_with_auto_populated_field(): client.update_phrase_set(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_speech_adaptation.UpdatePhraseSetRequest() + request_msg = cloud_speech_adaptation.UpdatePhraseSetRequest() + assert args[0] == request_msg def test_update_phrase_set_use_cached_wrapped_rpc(): @@ -2686,10 +2703,14 @@ async def test_update_phrase_set_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_phrase_set_async( - transport: str = "grpc_asyncio", - request_type=cloud_speech_adaptation.UpdatePhraseSetRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_speech_adaptation.UpdatePhraseSetRequest(), + {}, + ], +) +async def test_update_phrase_set_async(request_type, transport: str = "grpc_asyncio"): client = AdaptationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2697,7 +2718,7 @@ async def test_update_phrase_set_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( @@ -2738,11 +2759,6 @@ async def test_update_phrase_set_async( assert response.reconciling is True -@pytest.mark.asyncio -async def test_update_phrase_set_async_from_dict(): - await test_update_phrase_set_async(request_type=dict) - - def test_update_phrase_set_field_headers(): client = AdaptationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2903,8 +2919,8 @@ async def test_update_phrase_set_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_speech_adaptation.DeletePhraseSetRequest, - dict, + cloud_speech_adaptation.DeletePhraseSetRequest(), + {}, ], ) def test_delete_phrase_set(request_type, transport: str = "grpc"): @@ -2915,7 +2931,7 @@ def test_delete_phrase_set(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2960,9 +2976,10 @@ def test_delete_phrase_set_non_empty_request_with_auto_populated_field(): client.delete_phrase_set(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_speech_adaptation.DeletePhraseSetRequest( + request_msg = cloud_speech_adaptation.DeletePhraseSetRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_phrase_set_use_cached_wrapped_rpc(): @@ -3045,10 +3062,14 @@ async def test_delete_phrase_set_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_phrase_set_async( - transport: str = "grpc_asyncio", - request_type=cloud_speech_adaptation.DeletePhraseSetRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_speech_adaptation.DeletePhraseSetRequest(), + {}, + ], +) +async def test_delete_phrase_set_async(request_type, transport: str = "grpc_asyncio"): client = AdaptationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3056,7 +3077,7 @@ async def test_delete_phrase_set_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( @@ -3076,11 +3097,6 @@ async def test_delete_phrase_set_async( assert response is None -@pytest.mark.asyncio -async def test_delete_phrase_set_async_from_dict(): - await test_delete_phrase_set_async(request_type=dict) - - def test_delete_phrase_set_field_headers(): client = AdaptationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3231,8 +3247,8 @@ async def test_delete_phrase_set_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_speech_adaptation.CreateCustomClassRequest, - dict, + cloud_speech_adaptation.CreateCustomClassRequest(), + {}, ], ) def test_create_custom_class(request_type, transport: str = "grpc"): @@ -3243,7 +3259,7 @@ def test_create_custom_class(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3308,10 +3324,11 @@ def test_create_custom_class_non_empty_request_with_auto_populated_field(): client.create_custom_class(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_speech_adaptation.CreateCustomClassRequest( + request_msg = cloud_speech_adaptation.CreateCustomClassRequest( parent="parent_value", custom_class_id="custom_class_id_value", ) + assert args[0] == request_msg def test_create_custom_class_use_cached_wrapped_rpc(): @@ -3396,10 +3413,14 @@ async def test_create_custom_class_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_custom_class_async( - transport: str = "grpc_asyncio", - request_type=cloud_speech_adaptation.CreateCustomClassRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_speech_adaptation.CreateCustomClassRequest(), + {}, + ], +) +async def test_create_custom_class_async(request_type, transport: str = "grpc_asyncio"): client = AdaptationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3407,7 +3428,7 @@ async def test_create_custom_class_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( @@ -3448,11 +3469,6 @@ async def test_create_custom_class_async( assert response.reconciling is True -@pytest.mark.asyncio -async def test_create_custom_class_async_from_dict(): - await test_create_custom_class_async(request_type=dict) - - def test_create_custom_class_field_headers(): client = AdaptationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3627,8 +3643,8 @@ async def test_create_custom_class_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_speech_adaptation.GetCustomClassRequest, - dict, + cloud_speech_adaptation.GetCustomClassRequest(), + {}, ], ) def test_get_custom_class(request_type, transport: str = "grpc"): @@ -3639,7 +3655,7 @@ def test_get_custom_class(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_custom_class), "__call__") as call: @@ -3699,9 +3715,10 @@ def test_get_custom_class_non_empty_request_with_auto_populated_field(): client.get_custom_class(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_speech_adaptation.GetCustomClassRequest( + request_msg = cloud_speech_adaptation.GetCustomClassRequest( name="name_value", ) + assert args[0] == request_msg def test_get_custom_class_use_cached_wrapped_rpc(): @@ -3784,10 +3801,14 @@ async def test_get_custom_class_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_custom_class_async( - transport: str = "grpc_asyncio", - request_type=cloud_speech_adaptation.GetCustomClassRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_speech_adaptation.GetCustomClassRequest(), + {}, + ], +) +async def test_get_custom_class_async(request_type, transport: str = "grpc_asyncio"): client = AdaptationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3795,7 +3816,7 @@ async def test_get_custom_class_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_custom_class), "__call__") as call: @@ -3834,11 +3855,6 @@ async def test_get_custom_class_async( assert response.reconciling is True -@pytest.mark.asyncio -async def test_get_custom_class_async_from_dict(): - await test_get_custom_class_async(request_type=dict) - - def test_get_custom_class_field_headers(): client = AdaptationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3985,8 +4001,8 @@ async def test_get_custom_class_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_speech_adaptation.ListCustomClassesRequest, - dict, + cloud_speech_adaptation.ListCustomClassesRequest(), + {}, ], ) def test_list_custom_classes(request_type, transport: str = "grpc"): @@ -3997,7 +4013,7 @@ def test_list_custom_classes(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4046,10 +4062,11 @@ def test_list_custom_classes_non_empty_request_with_auto_populated_field(): client.list_custom_classes(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_speech_adaptation.ListCustomClassesRequest( + request_msg = cloud_speech_adaptation.ListCustomClassesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_custom_classes_use_cached_wrapped_rpc(): @@ -4134,10 +4151,14 @@ async def test_list_custom_classes_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_custom_classes_async( - transport: str = "grpc_asyncio", - request_type=cloud_speech_adaptation.ListCustomClassesRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_speech_adaptation.ListCustomClassesRequest(), + {}, + ], +) +async def test_list_custom_classes_async(request_type, transport: str = "grpc_asyncio"): client = AdaptationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4145,7 +4166,7 @@ async def test_list_custom_classes_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( @@ -4170,11 +4191,6 @@ async def test_list_custom_classes_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_custom_classes_async_from_dict(): - await test_list_custom_classes_async(request_type=dict) - - def test_list_custom_classes_field_headers(): client = AdaptationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4527,8 +4543,8 @@ async def test_list_custom_classes_async_pages(): @pytest.mark.parametrize( "request_type", [ - cloud_speech_adaptation.UpdateCustomClassRequest, - dict, + cloud_speech_adaptation.UpdateCustomClassRequest(), + {}, ], ) def test_update_custom_class(request_type, transport: str = "grpc"): @@ -4539,7 +4555,7 @@ def test_update_custom_class(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4601,7 +4617,8 @@ def test_update_custom_class_non_empty_request_with_auto_populated_field(): client.update_custom_class(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_speech_adaptation.UpdateCustomClassRequest() + request_msg = cloud_speech_adaptation.UpdateCustomClassRequest() + assert args[0] == request_msg def test_update_custom_class_use_cached_wrapped_rpc(): @@ -4686,10 +4703,14 @@ async def test_update_custom_class_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_custom_class_async( - transport: str = "grpc_asyncio", - request_type=cloud_speech_adaptation.UpdateCustomClassRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_speech_adaptation.UpdateCustomClassRequest(), + {}, + ], +) +async def test_update_custom_class_async(request_type, transport: str = "grpc_asyncio"): client = AdaptationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4697,7 +4718,7 @@ async def test_update_custom_class_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( @@ -4738,11 +4759,6 @@ async def test_update_custom_class_async( assert response.reconciling is True -@pytest.mark.asyncio -async def test_update_custom_class_async_from_dict(): - await test_update_custom_class_async(request_type=dict) - - def test_update_custom_class_field_headers(): client = AdaptationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4907,8 +4923,8 @@ async def test_update_custom_class_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_speech_adaptation.DeleteCustomClassRequest, - dict, + cloud_speech_adaptation.DeleteCustomClassRequest(), + {}, ], ) def test_delete_custom_class(request_type, transport: str = "grpc"): @@ -4919,7 +4935,7 @@ def test_delete_custom_class(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,9 +4980,10 @@ def test_delete_custom_class_non_empty_request_with_auto_populated_field(): client.delete_custom_class(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_speech_adaptation.DeleteCustomClassRequest( + request_msg = cloud_speech_adaptation.DeleteCustomClassRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_custom_class_use_cached_wrapped_rpc(): @@ -5051,10 +5068,14 @@ async def test_delete_custom_class_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_custom_class_async( - transport: str = "grpc_asyncio", - request_type=cloud_speech_adaptation.DeleteCustomClassRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_speech_adaptation.DeleteCustomClassRequest(), + {}, + ], +) +async def test_delete_custom_class_async(request_type, transport: str = "grpc_asyncio"): client = AdaptationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5062,7 +5083,7 @@ async def test_delete_custom_class_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( @@ -5082,11 +5103,6 @@ async def test_delete_custom_class_async( assert response is None -@pytest.mark.asyncio -async def test_delete_custom_class_async_from_dict(): - await test_delete_custom_class_async(request_type=dict) - - def test_delete_custom_class_field_headers(): client = AdaptationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7368,7 +7384,6 @@ def test_create_phrase_set_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech_adaptation.CreatePhraseSetRequest() - assert args[0] == request_msg @@ -7389,7 +7404,6 @@ def test_get_phrase_set_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech_adaptation.GetPhraseSetRequest() - assert args[0] == request_msg @@ -7410,7 +7424,6 @@ def test_list_phrase_set_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech_adaptation.ListPhraseSetRequest() - assert args[0] == request_msg @@ -7433,7 +7446,6 @@ def test_update_phrase_set_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech_adaptation.UpdatePhraseSetRequest() - assert args[0] == request_msg @@ -7456,7 +7468,6 @@ def test_delete_phrase_set_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech_adaptation.DeletePhraseSetRequest() - assert args[0] == request_msg @@ -7479,7 +7490,6 @@ def test_create_custom_class_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech_adaptation.CreateCustomClassRequest() - assert args[0] == request_msg @@ -7500,7 +7510,6 @@ def test_get_custom_class_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech_adaptation.GetCustomClassRequest() - assert args[0] == request_msg @@ -7523,7 +7532,6 @@ def test_list_custom_classes_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech_adaptation.ListCustomClassesRequest() - assert args[0] == request_msg @@ -7546,7 +7554,6 @@ def test_update_custom_class_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech_adaptation.UpdateCustomClassRequest() - assert args[0] == request_msg @@ -7569,7 +7576,6 @@ def test_delete_custom_class_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech_adaptation.DeleteCustomClassRequest() - assert args[0] == request_msg @@ -7620,7 +7626,6 @@ async def test_create_phrase_set_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech_adaptation.CreatePhraseSetRequest() - assert args[0] == request_msg @@ -7655,7 +7660,6 @@ async def test_get_phrase_set_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech_adaptation.GetPhraseSetRequest() - assert args[0] == request_msg @@ -7682,7 +7686,6 @@ async def test_list_phrase_set_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech_adaptation.ListPhraseSetRequest() - assert args[0] == request_msg @@ -7719,7 +7722,6 @@ async def test_update_phrase_set_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech_adaptation.UpdatePhraseSetRequest() - assert args[0] == request_msg @@ -7744,7 +7746,6 @@ async def test_delete_phrase_set_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech_adaptation.DeletePhraseSetRequest() - assert args[0] == request_msg @@ -7781,7 +7782,6 @@ async def test_create_custom_class_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech_adaptation.CreateCustomClassRequest() - assert args[0] == request_msg @@ -7816,7 +7816,6 @@ async def test_get_custom_class_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech_adaptation.GetCustomClassRequest() - assert args[0] == request_msg @@ -7845,7 +7844,6 @@ async def test_list_custom_classes_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech_adaptation.ListCustomClassesRequest() - assert args[0] == request_msg @@ -7882,7 +7880,6 @@ async def test_update_custom_class_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech_adaptation.UpdateCustomClassRequest() - assert args[0] == request_msg @@ -7907,7 +7904,6 @@ async def test_delete_custom_class_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech_adaptation.DeleteCustomClassRequest() - assert args[0] == request_msg @@ -9616,7 +9612,6 @@ def test_create_phrase_set_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech_adaptation.CreatePhraseSetRequest() - assert args[0] == request_msg @@ -9636,7 +9631,6 @@ def test_get_phrase_set_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech_adaptation.GetPhraseSetRequest() - assert args[0] == request_msg @@ -9656,7 +9650,6 @@ def test_list_phrase_set_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech_adaptation.ListPhraseSetRequest() - assert args[0] == request_msg @@ -9678,7 +9671,6 @@ def test_update_phrase_set_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech_adaptation.UpdatePhraseSetRequest() - assert args[0] == request_msg @@ -9700,7 +9692,6 @@ def test_delete_phrase_set_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech_adaptation.DeletePhraseSetRequest() - assert args[0] == request_msg @@ -9722,7 +9713,6 @@ def test_create_custom_class_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech_adaptation.CreateCustomClassRequest() - assert args[0] == request_msg @@ -9742,7 +9732,6 @@ def test_get_custom_class_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech_adaptation.GetCustomClassRequest() - assert args[0] == request_msg @@ -9764,7 +9753,6 @@ def test_list_custom_classes_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech_adaptation.ListCustomClassesRequest() - assert args[0] == request_msg @@ -9786,7 +9774,6 @@ def test_update_custom_class_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech_adaptation.UpdateCustomClassRequest() - assert args[0] == request_msg @@ -9808,7 +9795,6 @@ def test_delete_custom_class_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech_adaptation.DeleteCustomClassRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-speech/tests/unit/gapic/speech_v1p1beta1/test_speech.py b/packages/google-cloud-speech/tests/unit/gapic/speech_v1p1beta1/test_speech.py index abd530061b41..7a640216fe93 100644 --- a/packages/google-cloud-speech/tests/unit/gapic/speech_v1p1beta1/test_speech.py +++ b/packages/google-cloud-speech/tests/unit/gapic/speech_v1p1beta1/test_speech.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 @@ -115,6 +116,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" @@ -1247,8 +1263,8 @@ def test_speech_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - cloud_speech.RecognizeRequest, - dict, + cloud_speech.RecognizeRequest(), + {}, ], ) def test_recognize(request_type, transport: str = "grpc"): @@ -1259,7 +1275,7 @@ def test_recognize(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.recognize), "__call__") as call: @@ -1303,7 +1319,8 @@ def test_recognize_non_empty_request_with_auto_populated_field(): client.recognize(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_speech.RecognizeRequest() + request_msg = cloud_speech.RecognizeRequest() + assert args[0] == request_msg def test_recognize_use_cached_wrapped_rpc(): @@ -1382,9 +1399,14 @@ async def test_recognize_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_recognize_async( - transport: str = "grpc_asyncio", request_type=cloud_speech.RecognizeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_speech.RecognizeRequest(), + {}, + ], +) +async def test_recognize_async(request_type, transport: str = "grpc_asyncio"): client = SpeechAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1392,7 +1414,7 @@ async def test_recognize_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.recognize), "__call__") as call: @@ -1417,11 +1439,6 @@ async def test_recognize_async( assert response.using_legacy_models is True -@pytest.mark.asyncio -async def test_recognize_async_from_dict(): - await test_recognize_async(request_type=dict) - - def test_recognize_flattened(): client = SpeechClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1529,8 +1546,8 @@ async def test_recognize_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_speech.LongRunningRecognizeRequest, - dict, + cloud_speech.LongRunningRecognizeRequest(), + {}, ], ) def test_long_running_recognize(request_type, transport: str = "grpc"): @@ -1541,7 +1558,7 @@ def test_long_running_recognize(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1584,7 +1601,8 @@ def test_long_running_recognize_non_empty_request_with_auto_populated_field(): client.long_running_recognize(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_speech.LongRunningRecognizeRequest() + request_msg = cloud_speech.LongRunningRecognizeRequest() + assert args[0] == request_msg def test_long_running_recognize_use_cached_wrapped_rpc(): @@ -1680,9 +1698,15 @@ async def test_long_running_recognize_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloud_speech.LongRunningRecognizeRequest(), + {}, + ], +) async def test_long_running_recognize_async( - transport: str = "grpc_asyncio", - request_type=cloud_speech.LongRunningRecognizeRequest, + request_type, transport: str = "grpc_asyncio" ): client = SpeechAsyncClient( credentials=async_anonymous_credentials(), @@ -1691,7 +1715,7 @@ async def test_long_running_recognize_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( @@ -1713,11 +1737,6 @@ async def test_long_running_recognize_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_long_running_recognize_async_from_dict(): - await test_long_running_recognize_async(request_type=dict) - - def test_long_running_recognize_flattened(): client = SpeechClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1829,8 +1848,8 @@ async def test_long_running_recognize_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_speech.StreamingRecognizeRequest, - dict, + cloud_speech.StreamingRecognizeRequest(), + {}, ], ) def test_streaming_recognize(request_type, transport: str = "grpc"): @@ -1841,7 +1860,7 @@ def test_streaming_recognize(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as 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. @@ -1944,9 +1963,14 @@ async def test_streaming_recognize_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_streaming_recognize_async( - transport: str = "grpc_asyncio", request_type=cloud_speech.StreamingRecognizeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_speech.StreamingRecognizeRequest(), + {}, + ], +) +async def test_streaming_recognize_async(request_type, transport: str = "grpc_asyncio"): client = SpeechAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1954,7 +1978,7 @@ async def test_streaming_recognize_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. @@ -1978,11 +2002,6 @@ async def test_streaming_recognize_async( assert isinstance(message, cloud_speech.StreamingRecognizeResponse) -@pytest.mark.asyncio -async def test_streaming_recognize_async_from_dict(): - await test_streaming_recognize_async(request_type=dict) - - def test_recognize_rest_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, # instead of constructing them on each call @@ -2504,7 +2523,6 @@ def test_recognize_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.RecognizeRequest() - assert args[0] == request_msg @@ -2527,7 +2545,6 @@ def test_long_running_recognize_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.LongRunningRecognizeRequest() - assert args[0] == request_msg @@ -2569,7 +2586,6 @@ async def test_recognize_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.RecognizeRequest() - assert args[0] == request_msg @@ -2596,7 +2612,6 @@ async def test_long_running_recognize_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.LongRunningRecognizeRequest() - assert args[0] == request_msg @@ -3012,7 +3027,6 @@ def test_recognize_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.RecognizeRequest() - assert args[0] == request_msg @@ -3034,7 +3048,6 @@ def test_long_running_recognize_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.LongRunningRecognizeRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-speech/tests/unit/gapic/speech_v2/test_speech.py b/packages/google-cloud-speech/tests/unit/gapic/speech_v2/test_speech.py index 11ee6baa21df..930e8ed34f28 100644 --- a/packages/google-cloud-speech/tests/unit/gapic/speech_v2/test_speech.py +++ b/packages/google-cloud-speech/tests/unit/gapic/speech_v2/test_speech.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 @@ -116,6 +117,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" @@ -1248,8 +1264,8 @@ def test_speech_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - cloud_speech.CreateRecognizerRequest, - dict, + cloud_speech.CreateRecognizerRequest(), + {}, ], ) def test_create_recognizer(request_type, transport: str = "grpc"): @@ -1260,7 +1276,7 @@ def test_create_recognizer(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1306,10 +1322,11 @@ def test_create_recognizer_non_empty_request_with_auto_populated_field(): client.create_recognizer(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_speech.CreateRecognizerRequest( + request_msg = cloud_speech.CreateRecognizerRequest( recognizer_id="recognizer_id_value", parent="parent_value", ) + assert args[0] == request_msg def test_create_recognizer_use_cached_wrapped_rpc(): @@ -1402,9 +1419,14 @@ async def test_create_recognizer_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_recognizer_async( - transport: str = "grpc_asyncio", request_type=cloud_speech.CreateRecognizerRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_speech.CreateRecognizerRequest(), + {}, + ], +) +async def test_create_recognizer_async(request_type, transport: str = "grpc_asyncio"): client = SpeechAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1412,7 +1434,7 @@ async def test_create_recognizer_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( @@ -1434,11 +1456,6 @@ async def test_create_recognizer_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_recognizer_async_from_dict(): - await test_create_recognizer_async(request_type=dict) - - def test_create_recognizer_field_headers(): client = SpeechClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1613,8 +1630,8 @@ async def test_create_recognizer_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_speech.ListRecognizersRequest, - dict, + cloud_speech.ListRecognizersRequest(), + {}, ], ) def test_list_recognizers(request_type, transport: str = "grpc"): @@ -1625,7 +1642,7 @@ def test_list_recognizers(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_recognizers), "__call__") as call: @@ -1670,10 +1687,11 @@ def test_list_recognizers_non_empty_request_with_auto_populated_field(): client.list_recognizers(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_speech.ListRecognizersRequest( + request_msg = cloud_speech.ListRecognizersRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_recognizers_use_cached_wrapped_rpc(): @@ -1756,9 +1774,14 @@ async def test_list_recognizers_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_recognizers_async( - transport: str = "grpc_asyncio", request_type=cloud_speech.ListRecognizersRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_speech.ListRecognizersRequest(), + {}, + ], +) +async def test_list_recognizers_async(request_type, transport: str = "grpc_asyncio"): client = SpeechAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1766,7 +1789,7 @@ async def test_list_recognizers_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_recognizers), "__call__") as call: @@ -1789,11 +1812,6 @@ async def test_list_recognizers_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_recognizers_async_from_dict(): - await test_list_recognizers_async(request_type=dict) - - def test_list_recognizers_field_headers(): client = SpeechClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2130,8 +2148,8 @@ async def test_list_recognizers_async_pages(): @pytest.mark.parametrize( "request_type", [ - cloud_speech.GetRecognizerRequest, - dict, + cloud_speech.GetRecognizerRequest(), + {}, ], ) def test_get_recognizer(request_type, transport: str = "grpc"): @@ -2142,7 +2160,7 @@ def test_get_recognizer(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_recognizer), "__call__") as call: @@ -2204,9 +2222,10 @@ def test_get_recognizer_non_empty_request_with_auto_populated_field(): client.get_recognizer(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_speech.GetRecognizerRequest( + request_msg = cloud_speech.GetRecognizerRequest( name="name_value", ) + assert args[0] == request_msg def test_get_recognizer_use_cached_wrapped_rpc(): @@ -2287,9 +2306,14 @@ async def test_get_recognizer_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_recognizer_async( - transport: str = "grpc_asyncio", request_type=cloud_speech.GetRecognizerRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_speech.GetRecognizerRequest(), + {}, + ], +) +async def test_get_recognizer_async(request_type, transport: str = "grpc_asyncio"): client = SpeechAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2297,7 +2321,7 @@ async def test_get_recognizer_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_recognizer), "__call__") as call: @@ -2338,11 +2362,6 @@ async def test_get_recognizer_async( assert response.kms_key_version_name == "kms_key_version_name_value" -@pytest.mark.asyncio -async def test_get_recognizer_async_from_dict(): - await test_get_recognizer_async(request_type=dict) - - def test_get_recognizer_field_headers(): client = SpeechClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2489,8 +2508,8 @@ async def test_get_recognizer_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_speech.UpdateRecognizerRequest, - dict, + cloud_speech.UpdateRecognizerRequest(), + {}, ], ) def test_update_recognizer(request_type, transport: str = "grpc"): @@ -2501,7 +2520,7 @@ def test_update_recognizer(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2544,7 +2563,8 @@ def test_update_recognizer_non_empty_request_with_auto_populated_field(): client.update_recognizer(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_speech.UpdateRecognizerRequest() + request_msg = cloud_speech.UpdateRecognizerRequest() + assert args[0] == request_msg def test_update_recognizer_use_cached_wrapped_rpc(): @@ -2637,9 +2657,14 @@ async def test_update_recognizer_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_recognizer_async( - transport: str = "grpc_asyncio", request_type=cloud_speech.UpdateRecognizerRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_speech.UpdateRecognizerRequest(), + {}, + ], +) +async def test_update_recognizer_async(request_type, transport: str = "grpc_asyncio"): client = SpeechAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2647,7 +2672,7 @@ async def test_update_recognizer_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( @@ -2669,11 +2694,6 @@ async def test_update_recognizer_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_recognizer_async_from_dict(): - await test_update_recognizer_async(request_type=dict) - - def test_update_recognizer_field_headers(): client = SpeechClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2838,8 +2858,8 @@ async def test_update_recognizer_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_speech.DeleteRecognizerRequest, - dict, + cloud_speech.DeleteRecognizerRequest(), + {}, ], ) def test_delete_recognizer(request_type, transport: str = "grpc"): @@ -2850,7 +2870,7 @@ def test_delete_recognizer(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2896,10 +2916,11 @@ def test_delete_recognizer_non_empty_request_with_auto_populated_field(): client.delete_recognizer(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_speech.DeleteRecognizerRequest( + request_msg = cloud_speech.DeleteRecognizerRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_recognizer_use_cached_wrapped_rpc(): @@ -2992,9 +3013,14 @@ async def test_delete_recognizer_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_recognizer_async( - transport: str = "grpc_asyncio", request_type=cloud_speech.DeleteRecognizerRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_speech.DeleteRecognizerRequest(), + {}, + ], +) +async def test_delete_recognizer_async(request_type, transport: str = "grpc_asyncio"): client = SpeechAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3002,7 +3028,7 @@ async def test_delete_recognizer_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( @@ -3024,11 +3050,6 @@ async def test_delete_recognizer_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_recognizer_async_from_dict(): - await test_delete_recognizer_async(request_type=dict) - - def test_delete_recognizer_field_headers(): client = SpeechClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3183,8 +3204,8 @@ async def test_delete_recognizer_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_speech.UndeleteRecognizerRequest, - dict, + cloud_speech.UndeleteRecognizerRequest(), + {}, ], ) def test_undelete_recognizer(request_type, transport: str = "grpc"): @@ -3195,7 +3216,7 @@ def test_undelete_recognizer(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3241,10 +3262,11 @@ def test_undelete_recognizer_non_empty_request_with_auto_populated_field(): client.undelete_recognizer(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_speech.UndeleteRecognizerRequest( + request_msg = cloud_speech.UndeleteRecognizerRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_undelete_recognizer_use_cached_wrapped_rpc(): @@ -3339,9 +3361,14 @@ async def test_undelete_recognizer_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_undelete_recognizer_async( - transport: str = "grpc_asyncio", request_type=cloud_speech.UndeleteRecognizerRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_speech.UndeleteRecognizerRequest(), + {}, + ], +) +async def test_undelete_recognizer_async(request_type, transport: str = "grpc_asyncio"): client = SpeechAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3349,7 +3376,7 @@ async def test_undelete_recognizer_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( @@ -3371,11 +3398,6 @@ async def test_undelete_recognizer_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_undelete_recognizer_async_from_dict(): - await test_undelete_recognizer_async(request_type=dict) - - def test_undelete_recognizer_field_headers(): client = SpeechClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3530,8 +3552,8 @@ async def test_undelete_recognizer_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_speech.RecognizeRequest, - dict, + cloud_speech.RecognizeRequest(), + {}, ], ) def test_recognize(request_type, transport: str = "grpc"): @@ -3542,7 +3564,7 @@ def test_recognize(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.recognize), "__call__") as call: @@ -3584,10 +3606,11 @@ def test_recognize_non_empty_request_with_auto_populated_field(): client.recognize(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_speech.RecognizeRequest( + request_msg = cloud_speech.RecognizeRequest( recognizer="recognizer_value", uri="uri_value", ) + assert args[0] == request_msg def test_recognize_use_cached_wrapped_rpc(): @@ -3666,9 +3689,14 @@ async def test_recognize_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_recognize_async( - transport: str = "grpc_asyncio", request_type=cloud_speech.RecognizeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_speech.RecognizeRequest(), + {}, + ], +) +async def test_recognize_async(request_type, transport: str = "grpc_asyncio"): client = SpeechAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3676,7 +3704,7 @@ async def test_recognize_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.recognize), "__call__") as call: @@ -3696,11 +3724,6 @@ async def test_recognize_async( assert isinstance(response, cloud_speech.RecognizeResponse) -@pytest.mark.asyncio -async def test_recognize_async_from_dict(): - await test_recognize_async(request_type=dict) - - def test_recognize_field_headers(): client = SpeechClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3877,8 +3900,8 @@ async def test_recognize_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_speech.StreamingRecognizeRequest, - dict, + cloud_speech.StreamingRecognizeRequest(), + {}, ], ) def test_streaming_recognize(request_type, transport: str = "grpc"): @@ -3889,7 +3912,7 @@ def test_streaming_recognize(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as 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. @@ -3992,9 +4015,14 @@ async def test_streaming_recognize_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_streaming_recognize_async( - transport: str = "grpc_asyncio", request_type=cloud_speech.StreamingRecognizeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_speech.StreamingRecognizeRequest(), + {}, + ], +) +async def test_streaming_recognize_async(request_type, transport: str = "grpc_asyncio"): client = SpeechAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4002,7 +4030,7 @@ async def test_streaming_recognize_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. @@ -4026,16 +4054,11 @@ async def test_streaming_recognize_async( assert isinstance(message, cloud_speech.StreamingRecognizeResponse) -@pytest.mark.asyncio -async def test_streaming_recognize_async_from_dict(): - await test_streaming_recognize_async(request_type=dict) - - @pytest.mark.parametrize( "request_type", [ - cloud_speech.BatchRecognizeRequest, - dict, + cloud_speech.BatchRecognizeRequest(), + {}, ], ) def test_batch_recognize(request_type, transport: str = "grpc"): @@ -4046,7 +4069,7 @@ def test_batch_recognize(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.batch_recognize), "__call__") as call: @@ -4087,9 +4110,10 @@ def test_batch_recognize_non_empty_request_with_auto_populated_field(): client.batch_recognize(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_speech.BatchRecognizeRequest( + request_msg = cloud_speech.BatchRecognizeRequest( recognizer="recognizer_value", ) + assert args[0] == request_msg def test_batch_recognize_use_cached_wrapped_rpc(): @@ -4180,9 +4204,14 @@ async def test_batch_recognize_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_batch_recognize_async( - transport: str = "grpc_asyncio", request_type=cloud_speech.BatchRecognizeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_speech.BatchRecognizeRequest(), + {}, + ], +) +async def test_batch_recognize_async(request_type, transport: str = "grpc_asyncio"): client = SpeechAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4190,7 +4219,7 @@ async def test_batch_recognize_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.batch_recognize), "__call__") as call: @@ -4210,11 +4239,6 @@ async def test_batch_recognize_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_batch_recognize_async_from_dict(): - await test_batch_recognize_async(request_type=dict) - - def test_batch_recognize_field_headers(): client = SpeechClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4391,8 +4415,8 @@ async def test_batch_recognize_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_speech.GetConfigRequest, - dict, + cloud_speech.GetConfigRequest(), + {}, ], ) def test_get_config(request_type, transport: str = "grpc"): @@ -4403,7 +4427,7 @@ def test_get_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(type(client.transport.get_config), "__call__") as call: @@ -4449,9 +4473,10 @@ def test_get_config_non_empty_request_with_auto_populated_field(): client.get_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_speech.GetConfigRequest( + request_msg = cloud_speech.GetConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_config_use_cached_wrapped_rpc(): @@ -4530,9 +4555,14 @@ async def test_get_config_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_config_async( - transport: str = "grpc_asyncio", request_type=cloud_speech.GetConfigRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_speech.GetConfigRequest(), + {}, + ], +) +async def test_get_config_async(request_type, transport: str = "grpc_asyncio"): client = SpeechAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4540,7 +4570,7 @@ async def test_get_config_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_config), "__call__") as call: @@ -4565,11 +4595,6 @@ async def test_get_config_async( assert response.kms_key_name == "kms_key_name_value" -@pytest.mark.asyncio -async def test_get_config_async_from_dict(): - await test_get_config_async(request_type=dict) - - def test_get_config_field_headers(): client = SpeechClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4712,8 +4737,8 @@ async def test_get_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_speech.UpdateConfigRequest, - dict, + cloud_speech.UpdateConfigRequest(), + {}, ], ) def test_update_config(request_type, transport: str = "grpc"): @@ -4724,7 +4749,7 @@ def test_update_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(type(client.transport.update_config), "__call__") as call: @@ -4768,7 +4793,8 @@ def test_update_config_non_empty_request_with_auto_populated_field(): client.update_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_speech.UpdateConfigRequest() + request_msg = cloud_speech.UpdateConfigRequest() + assert args[0] == request_msg def test_update_config_use_cached_wrapped_rpc(): @@ -4849,9 +4875,14 @@ async def test_update_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_config_async( - transport: str = "grpc_asyncio", request_type=cloud_speech.UpdateConfigRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_speech.UpdateConfigRequest(), + {}, + ], +) +async def test_update_config_async(request_type, transport: str = "grpc_asyncio"): client = SpeechAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4859,7 +4890,7 @@ async def test_update_config_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_config), "__call__") as call: @@ -4884,11 +4915,6 @@ async def test_update_config_async( assert response.kms_key_name == "kms_key_name_value" -@pytest.mark.asyncio -async def test_update_config_async_from_dict(): - await test_update_config_async(request_type=dict) - - def test_update_config_field_headers(): client = SpeechClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5041,8 +5067,8 @@ async def test_update_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_speech.CreateCustomClassRequest, - dict, + cloud_speech.CreateCustomClassRequest(), + {}, ], ) def test_create_custom_class(request_type, transport: str = "grpc"): @@ -5053,7 +5079,7 @@ def test_create_custom_class(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,10 +5125,11 @@ def test_create_custom_class_non_empty_request_with_auto_populated_field(): client.create_custom_class(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_speech.CreateCustomClassRequest( + request_msg = cloud_speech.CreateCustomClassRequest( custom_class_id="custom_class_id_value", parent="parent_value", ) + assert args[0] == request_msg def test_create_custom_class_use_cached_wrapped_rpc(): @@ -5197,9 +5224,14 @@ async def test_create_custom_class_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_custom_class_async( - transport: str = "grpc_asyncio", request_type=cloud_speech.CreateCustomClassRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_speech.CreateCustomClassRequest(), + {}, + ], +) +async def test_create_custom_class_async(request_type, transport: str = "grpc_asyncio"): client = SpeechAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5207,7 +5239,7 @@ async def test_create_custom_class_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( @@ -5229,11 +5261,6 @@ async def test_create_custom_class_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_custom_class_async_from_dict(): - await test_create_custom_class_async(request_type=dict) - - def test_create_custom_class_field_headers(): client = SpeechClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5408,8 +5435,8 @@ async def test_create_custom_class_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_speech.ListCustomClassesRequest, - dict, + cloud_speech.ListCustomClassesRequest(), + {}, ], ) def test_list_custom_classes(request_type, transport: str = "grpc"): @@ -5420,7 +5447,7 @@ def test_list_custom_classes(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5469,10 +5496,11 @@ def test_list_custom_classes_non_empty_request_with_auto_populated_field(): client.list_custom_classes(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_speech.ListCustomClassesRequest( + request_msg = cloud_speech.ListCustomClassesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_custom_classes_use_cached_wrapped_rpc(): @@ -5557,9 +5585,14 @@ async def test_list_custom_classes_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_custom_classes_async( - transport: str = "grpc_asyncio", request_type=cloud_speech.ListCustomClassesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_speech.ListCustomClassesRequest(), + {}, + ], +) +async def test_list_custom_classes_async(request_type, transport: str = "grpc_asyncio"): client = SpeechAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5567,7 +5600,7 @@ async def test_list_custom_classes_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( @@ -5592,11 +5625,6 @@ async def test_list_custom_classes_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_custom_classes_async_from_dict(): - await test_list_custom_classes_async(request_type=dict) - - def test_list_custom_classes_field_headers(): client = SpeechClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5949,8 +5977,8 @@ async def test_list_custom_classes_async_pages(): @pytest.mark.parametrize( "request_type", [ - cloud_speech.GetCustomClassRequest, - dict, + cloud_speech.GetCustomClassRequest(), + {}, ], ) def test_get_custom_class(request_type, transport: str = "grpc"): @@ -5961,7 +5989,7 @@ def test_get_custom_class(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_custom_class), "__call__") as call: @@ -6019,9 +6047,10 @@ def test_get_custom_class_non_empty_request_with_auto_populated_field(): client.get_custom_class(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_speech.GetCustomClassRequest( + request_msg = cloud_speech.GetCustomClassRequest( name="name_value", ) + assert args[0] == request_msg def test_get_custom_class_use_cached_wrapped_rpc(): @@ -6104,9 +6133,14 @@ async def test_get_custom_class_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_custom_class_async( - transport: str = "grpc_asyncio", request_type=cloud_speech.GetCustomClassRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_speech.GetCustomClassRequest(), + {}, + ], +) +async def test_get_custom_class_async(request_type, transport: str = "grpc_asyncio"): client = SpeechAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6114,7 +6148,7 @@ async def test_get_custom_class_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_custom_class), "__call__") as call: @@ -6151,11 +6185,6 @@ async def test_get_custom_class_async( assert response.kms_key_version_name == "kms_key_version_name_value" -@pytest.mark.asyncio -async def test_get_custom_class_async_from_dict(): - await test_get_custom_class_async(request_type=dict) - - def test_get_custom_class_field_headers(): client = SpeechClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6302,8 +6331,8 @@ async def test_get_custom_class_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_speech.UpdateCustomClassRequest, - dict, + cloud_speech.UpdateCustomClassRequest(), + {}, ], ) def test_update_custom_class(request_type, transport: str = "grpc"): @@ -6314,7 +6343,7 @@ def test_update_custom_class(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6357,7 +6386,8 @@ def test_update_custom_class_non_empty_request_with_auto_populated_field(): client.update_custom_class(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_speech.UpdateCustomClassRequest() + request_msg = cloud_speech.UpdateCustomClassRequest() + assert args[0] == request_msg def test_update_custom_class_use_cached_wrapped_rpc(): @@ -6452,9 +6482,14 @@ async def test_update_custom_class_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_custom_class_async( - transport: str = "grpc_asyncio", request_type=cloud_speech.UpdateCustomClassRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_speech.UpdateCustomClassRequest(), + {}, + ], +) +async def test_update_custom_class_async(request_type, transport: str = "grpc_asyncio"): client = SpeechAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6462,7 +6497,7 @@ async def test_update_custom_class_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( @@ -6484,11 +6519,6 @@ async def test_update_custom_class_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_custom_class_async_from_dict(): - await test_update_custom_class_async(request_type=dict) - - def test_update_custom_class_field_headers(): client = SpeechClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6653,8 +6683,8 @@ async def test_update_custom_class_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_speech.DeleteCustomClassRequest, - dict, + cloud_speech.DeleteCustomClassRequest(), + {}, ], ) def test_delete_custom_class(request_type, transport: str = "grpc"): @@ -6665,7 +6695,7 @@ def test_delete_custom_class(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6711,10 +6741,11 @@ def test_delete_custom_class_non_empty_request_with_auto_populated_field(): client.delete_custom_class(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_speech.DeleteCustomClassRequest( + request_msg = cloud_speech.DeleteCustomClassRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_custom_class_use_cached_wrapped_rpc(): @@ -6809,9 +6840,14 @@ async def test_delete_custom_class_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_custom_class_async( - transport: str = "grpc_asyncio", request_type=cloud_speech.DeleteCustomClassRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_speech.DeleteCustomClassRequest(), + {}, + ], +) +async def test_delete_custom_class_async(request_type, transport: str = "grpc_asyncio"): client = SpeechAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6819,7 +6855,7 @@ async def test_delete_custom_class_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( @@ -6841,11 +6877,6 @@ async def test_delete_custom_class_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_custom_class_async_from_dict(): - await test_delete_custom_class_async(request_type=dict) - - def test_delete_custom_class_field_headers(): client = SpeechClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7000,8 +7031,8 @@ async def test_delete_custom_class_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_speech.UndeleteCustomClassRequest, - dict, + cloud_speech.UndeleteCustomClassRequest(), + {}, ], ) def test_undelete_custom_class(request_type, transport: str = "grpc"): @@ -7012,7 +7043,7 @@ def test_undelete_custom_class(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7058,10 +7089,11 @@ def test_undelete_custom_class_non_empty_request_with_auto_populated_field(): client.undelete_custom_class(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_speech.UndeleteCustomClassRequest( + request_msg = cloud_speech.UndeleteCustomClassRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_undelete_custom_class_use_cached_wrapped_rpc(): @@ -7157,9 +7189,15 @@ async def test_undelete_custom_class_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloud_speech.UndeleteCustomClassRequest(), + {}, + ], +) async def test_undelete_custom_class_async( - transport: str = "grpc_asyncio", - request_type=cloud_speech.UndeleteCustomClassRequest, + request_type, transport: str = "grpc_asyncio" ): client = SpeechAsyncClient( credentials=async_anonymous_credentials(), @@ -7168,7 +7206,7 @@ async def test_undelete_custom_class_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( @@ -7190,11 +7228,6 @@ async def test_undelete_custom_class_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_undelete_custom_class_async_from_dict(): - await test_undelete_custom_class_async(request_type=dict) - - def test_undelete_custom_class_field_headers(): client = SpeechClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7349,8 +7382,8 @@ async def test_undelete_custom_class_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_speech.CreatePhraseSetRequest, - dict, + cloud_speech.CreatePhraseSetRequest(), + {}, ], ) def test_create_phrase_set(request_type, transport: str = "grpc"): @@ -7361,7 +7394,7 @@ def test_create_phrase_set(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7407,10 +7440,11 @@ def test_create_phrase_set_non_empty_request_with_auto_populated_field(): client.create_phrase_set(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_speech.CreatePhraseSetRequest( + request_msg = cloud_speech.CreatePhraseSetRequest( phrase_set_id="phrase_set_id_value", parent="parent_value", ) + assert args[0] == request_msg def test_create_phrase_set_use_cached_wrapped_rpc(): @@ -7503,9 +7537,14 @@ async def test_create_phrase_set_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_phrase_set_async( - transport: str = "grpc_asyncio", request_type=cloud_speech.CreatePhraseSetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_speech.CreatePhraseSetRequest(), + {}, + ], +) +async def test_create_phrase_set_async(request_type, transport: str = "grpc_asyncio"): client = SpeechAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7513,7 +7552,7 @@ async def test_create_phrase_set_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( @@ -7535,11 +7574,6 @@ async def test_create_phrase_set_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_phrase_set_async_from_dict(): - await test_create_phrase_set_async(request_type=dict) - - def test_create_phrase_set_field_headers(): client = SpeechClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7714,8 +7748,8 @@ async def test_create_phrase_set_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_speech.ListPhraseSetsRequest, - dict, + cloud_speech.ListPhraseSetsRequest(), + {}, ], ) def test_list_phrase_sets(request_type, transport: str = "grpc"): @@ -7726,7 +7760,7 @@ def test_list_phrase_sets(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_phrase_sets), "__call__") as call: @@ -7771,10 +7805,11 @@ def test_list_phrase_sets_non_empty_request_with_auto_populated_field(): client.list_phrase_sets(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_speech.ListPhraseSetsRequest( + request_msg = cloud_speech.ListPhraseSetsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_phrase_sets_use_cached_wrapped_rpc(): @@ -7857,9 +7892,14 @@ async def test_list_phrase_sets_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_phrase_sets_async( - transport: str = "grpc_asyncio", request_type=cloud_speech.ListPhraseSetsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_speech.ListPhraseSetsRequest(), + {}, + ], +) +async def test_list_phrase_sets_async(request_type, transport: str = "grpc_asyncio"): client = SpeechAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7867,7 +7907,7 @@ async def test_list_phrase_sets_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_phrase_sets), "__call__") as call: @@ -7890,11 +7930,6 @@ async def test_list_phrase_sets_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_phrase_sets_async_from_dict(): - await test_list_phrase_sets_async(request_type=dict) - - def test_list_phrase_sets_field_headers(): client = SpeechClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8231,8 +8266,8 @@ async def test_list_phrase_sets_async_pages(): @pytest.mark.parametrize( "request_type", [ - cloud_speech.GetPhraseSetRequest, - dict, + cloud_speech.GetPhraseSetRequest(), + {}, ], ) def test_get_phrase_set(request_type, transport: str = "grpc"): @@ -8243,7 +8278,7 @@ def test_get_phrase_set(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_phrase_set), "__call__") as call: @@ -8303,9 +8338,10 @@ def test_get_phrase_set_non_empty_request_with_auto_populated_field(): client.get_phrase_set(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_speech.GetPhraseSetRequest( + request_msg = cloud_speech.GetPhraseSetRequest( name="name_value", ) + assert args[0] == request_msg def test_get_phrase_set_use_cached_wrapped_rpc(): @@ -8386,9 +8422,14 @@ async def test_get_phrase_set_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_phrase_set_async( - transport: str = "grpc_asyncio", request_type=cloud_speech.GetPhraseSetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_speech.GetPhraseSetRequest(), + {}, + ], +) +async def test_get_phrase_set_async(request_type, transport: str = "grpc_asyncio"): client = SpeechAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8396,7 +8437,7 @@ async def test_get_phrase_set_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_phrase_set), "__call__") as call: @@ -8435,11 +8476,6 @@ async def test_get_phrase_set_async( assert response.kms_key_version_name == "kms_key_version_name_value" -@pytest.mark.asyncio -async def test_get_phrase_set_async_from_dict(): - await test_get_phrase_set_async(request_type=dict) - - def test_get_phrase_set_field_headers(): client = SpeechClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8586,8 +8622,8 @@ async def test_get_phrase_set_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_speech.UpdatePhraseSetRequest, - dict, + cloud_speech.UpdatePhraseSetRequest(), + {}, ], ) def test_update_phrase_set(request_type, transport: str = "grpc"): @@ -8598,7 +8634,7 @@ def test_update_phrase_set(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8641,7 +8677,8 @@ def test_update_phrase_set_non_empty_request_with_auto_populated_field(): client.update_phrase_set(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_speech.UpdatePhraseSetRequest() + request_msg = cloud_speech.UpdatePhraseSetRequest() + assert args[0] == request_msg def test_update_phrase_set_use_cached_wrapped_rpc(): @@ -8734,9 +8771,14 @@ async def test_update_phrase_set_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_phrase_set_async( - transport: str = "grpc_asyncio", request_type=cloud_speech.UpdatePhraseSetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_speech.UpdatePhraseSetRequest(), + {}, + ], +) +async def test_update_phrase_set_async(request_type, transport: str = "grpc_asyncio"): client = SpeechAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8744,7 +8786,7 @@ async def test_update_phrase_set_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( @@ -8766,11 +8808,6 @@ async def test_update_phrase_set_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_phrase_set_async_from_dict(): - await test_update_phrase_set_async(request_type=dict) - - def test_update_phrase_set_field_headers(): client = SpeechClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8935,8 +8972,8 @@ async def test_update_phrase_set_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_speech.DeletePhraseSetRequest, - dict, + cloud_speech.DeletePhraseSetRequest(), + {}, ], ) def test_delete_phrase_set(request_type, transport: str = "grpc"): @@ -8947,7 +8984,7 @@ def test_delete_phrase_set(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8993,10 +9030,11 @@ def test_delete_phrase_set_non_empty_request_with_auto_populated_field(): client.delete_phrase_set(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_speech.DeletePhraseSetRequest( + request_msg = cloud_speech.DeletePhraseSetRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_phrase_set_use_cached_wrapped_rpc(): @@ -9089,9 +9127,14 @@ async def test_delete_phrase_set_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_phrase_set_async( - transport: str = "grpc_asyncio", request_type=cloud_speech.DeletePhraseSetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_speech.DeletePhraseSetRequest(), + {}, + ], +) +async def test_delete_phrase_set_async(request_type, transport: str = "grpc_asyncio"): client = SpeechAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9099,7 +9142,7 @@ async def test_delete_phrase_set_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( @@ -9121,11 +9164,6 @@ async def test_delete_phrase_set_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_phrase_set_async_from_dict(): - await test_delete_phrase_set_async(request_type=dict) - - def test_delete_phrase_set_field_headers(): client = SpeechClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9280,8 +9318,8 @@ async def test_delete_phrase_set_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_speech.UndeletePhraseSetRequest, - dict, + cloud_speech.UndeletePhraseSetRequest(), + {}, ], ) def test_undelete_phrase_set(request_type, transport: str = "grpc"): @@ -9292,7 +9330,7 @@ def test_undelete_phrase_set(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9338,10 +9376,11 @@ def test_undelete_phrase_set_non_empty_request_with_auto_populated_field(): client.undelete_phrase_set(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_speech.UndeletePhraseSetRequest( + request_msg = cloud_speech.UndeletePhraseSetRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_undelete_phrase_set_use_cached_wrapped_rpc(): @@ -9436,9 +9475,14 @@ async def test_undelete_phrase_set_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_undelete_phrase_set_async( - transport: str = "grpc_asyncio", request_type=cloud_speech.UndeletePhraseSetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_speech.UndeletePhraseSetRequest(), + {}, + ], +) +async def test_undelete_phrase_set_async(request_type, transport: str = "grpc_asyncio"): client = SpeechAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9446,7 +9490,7 @@ async def test_undelete_phrase_set_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( @@ -9468,11 +9512,6 @@ async def test_undelete_phrase_set_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_undelete_phrase_set_async_from_dict(): - await test_undelete_phrase_set_async(request_type=dict) - - def test_undelete_phrase_set_field_headers(): client = SpeechClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14172,7 +14211,6 @@ def test_create_recognizer_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.CreateRecognizerRequest() - assert args[0] == request_msg @@ -14193,7 +14231,6 @@ def test_list_recognizers_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.ListRecognizersRequest() - assert args[0] == request_msg @@ -14214,7 +14251,6 @@ def test_get_recognizer_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.GetRecognizerRequest() - assert args[0] == request_msg @@ -14237,7 +14273,6 @@ def test_update_recognizer_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.UpdateRecognizerRequest() - assert args[0] == request_msg @@ -14260,7 +14295,6 @@ def test_delete_recognizer_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.DeleteRecognizerRequest() - assert args[0] == request_msg @@ -14283,7 +14317,6 @@ def test_undelete_recognizer_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.UndeleteRecognizerRequest() - assert args[0] == request_msg @@ -14304,7 +14337,6 @@ def test_recognize_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.RecognizeRequest() - assert args[0] == request_msg @@ -14325,7 +14357,6 @@ def test_batch_recognize_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.BatchRecognizeRequest() - assert args[0] == request_msg @@ -14346,7 +14377,6 @@ def test_get_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.GetConfigRequest() - assert args[0] == request_msg @@ -14367,7 +14397,6 @@ def test_update_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.UpdateConfigRequest() - assert args[0] == request_msg @@ -14390,7 +14419,6 @@ def test_create_custom_class_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.CreateCustomClassRequest() - assert args[0] == request_msg @@ -14413,7 +14441,6 @@ def test_list_custom_classes_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.ListCustomClassesRequest() - assert args[0] == request_msg @@ -14434,7 +14461,6 @@ def test_get_custom_class_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.GetCustomClassRequest() - assert args[0] == request_msg @@ -14457,7 +14483,6 @@ def test_update_custom_class_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.UpdateCustomClassRequest() - assert args[0] == request_msg @@ -14480,7 +14505,6 @@ def test_delete_custom_class_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.DeleteCustomClassRequest() - assert args[0] == request_msg @@ -14503,7 +14527,6 @@ def test_undelete_custom_class_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.UndeleteCustomClassRequest() - assert args[0] == request_msg @@ -14526,7 +14549,6 @@ def test_create_phrase_set_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.CreatePhraseSetRequest() - assert args[0] == request_msg @@ -14547,7 +14569,6 @@ def test_list_phrase_sets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.ListPhraseSetsRequest() - assert args[0] == request_msg @@ -14568,7 +14589,6 @@ def test_get_phrase_set_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.GetPhraseSetRequest() - assert args[0] == request_msg @@ -14591,7 +14611,6 @@ def test_update_phrase_set_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.UpdatePhraseSetRequest() - assert args[0] == request_msg @@ -14614,7 +14633,6 @@ def test_delete_phrase_set_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.DeletePhraseSetRequest() - assert args[0] == request_msg @@ -14637,7 +14655,6 @@ def test_undelete_phrase_set_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.UndeletePhraseSetRequest() - assert args[0] == request_msg @@ -14678,7 +14695,6 @@ async def test_create_recognizer_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.CreateRecognizerRequest() - assert args[0] == request_msg @@ -14705,7 +14721,6 @@ async def test_list_recognizers_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.ListRecognizersRequest() - assert args[0] == request_msg @@ -14741,7 +14756,6 @@ async def test_get_recognizer_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.GetRecognizerRequest() - assert args[0] == request_msg @@ -14768,7 +14782,6 @@ async def test_update_recognizer_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.UpdateRecognizerRequest() - assert args[0] == request_msg @@ -14795,7 +14808,6 @@ async def test_delete_recognizer_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.DeleteRecognizerRequest() - assert args[0] == request_msg @@ -14822,7 +14834,6 @@ async def test_undelete_recognizer_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.UndeleteRecognizerRequest() - assert args[0] == request_msg @@ -14847,7 +14858,6 @@ async def test_recognize_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.RecognizeRequest() - assert args[0] == request_msg @@ -14872,7 +14882,6 @@ async def test_batch_recognize_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.BatchRecognizeRequest() - assert args[0] == request_msg @@ -14900,7 +14909,6 @@ async def test_get_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.GetConfigRequest() - assert args[0] == request_msg @@ -14928,7 +14936,6 @@ async def test_update_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.UpdateConfigRequest() - assert args[0] == request_msg @@ -14955,7 +14962,6 @@ async def test_create_custom_class_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.CreateCustomClassRequest() - assert args[0] == request_msg @@ -14984,7 +14990,6 @@ async def test_list_custom_classes_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.ListCustomClassesRequest() - assert args[0] == request_msg @@ -15018,7 +15023,6 @@ async def test_get_custom_class_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.GetCustomClassRequest() - assert args[0] == request_msg @@ -15045,7 +15049,6 @@ async def test_update_custom_class_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.UpdateCustomClassRequest() - assert args[0] == request_msg @@ -15072,7 +15075,6 @@ async def test_delete_custom_class_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.DeleteCustomClassRequest() - assert args[0] == request_msg @@ -15099,7 +15101,6 @@ async def test_undelete_custom_class_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.UndeleteCustomClassRequest() - assert args[0] == request_msg @@ -15126,7 +15127,6 @@ async def test_create_phrase_set_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.CreatePhraseSetRequest() - assert args[0] == request_msg @@ -15153,7 +15153,6 @@ async def test_list_phrase_sets_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.ListPhraseSetsRequest() - assert args[0] == request_msg @@ -15188,7 +15187,6 @@ async def test_get_phrase_set_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.GetPhraseSetRequest() - assert args[0] == request_msg @@ -15215,7 +15213,6 @@ async def test_update_phrase_set_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.UpdatePhraseSetRequest() - assert args[0] == request_msg @@ -15242,7 +15239,6 @@ async def test_delete_phrase_set_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.DeletePhraseSetRequest() - assert args[0] == request_msg @@ -15269,7 +15265,6 @@ async def test_undelete_phrase_set_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.UndeletePhraseSetRequest() - assert args[0] == request_msg @@ -19246,7 +19241,6 @@ def test_create_recognizer_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.CreateRecognizerRequest() - assert args[0] == request_msg @@ -19266,7 +19260,6 @@ def test_list_recognizers_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.ListRecognizersRequest() - assert args[0] == request_msg @@ -19286,7 +19279,6 @@ def test_get_recognizer_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.GetRecognizerRequest() - assert args[0] == request_msg @@ -19308,7 +19300,6 @@ def test_update_recognizer_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.UpdateRecognizerRequest() - assert args[0] == request_msg @@ -19330,7 +19321,6 @@ def test_delete_recognizer_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.DeleteRecognizerRequest() - assert args[0] == request_msg @@ -19352,7 +19342,6 @@ def test_undelete_recognizer_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.UndeleteRecognizerRequest() - assert args[0] == request_msg @@ -19372,7 +19361,6 @@ def test_recognize_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.RecognizeRequest() - assert args[0] == request_msg @@ -19392,7 +19380,6 @@ def test_batch_recognize_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.BatchRecognizeRequest() - assert args[0] == request_msg @@ -19412,7 +19399,6 @@ def test_get_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.GetConfigRequest() - assert args[0] == request_msg @@ -19432,7 +19418,6 @@ def test_update_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.UpdateConfigRequest() - assert args[0] == request_msg @@ -19454,7 +19439,6 @@ def test_create_custom_class_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.CreateCustomClassRequest() - assert args[0] == request_msg @@ -19476,7 +19460,6 @@ def test_list_custom_classes_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.ListCustomClassesRequest() - assert args[0] == request_msg @@ -19496,7 +19479,6 @@ def test_get_custom_class_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.GetCustomClassRequest() - assert args[0] == request_msg @@ -19518,7 +19500,6 @@ def test_update_custom_class_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.UpdateCustomClassRequest() - assert args[0] == request_msg @@ -19540,7 +19521,6 @@ def test_delete_custom_class_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.DeleteCustomClassRequest() - assert args[0] == request_msg @@ -19562,7 +19542,6 @@ def test_undelete_custom_class_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.UndeleteCustomClassRequest() - assert args[0] == request_msg @@ -19584,7 +19563,6 @@ def test_create_phrase_set_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.CreatePhraseSetRequest() - assert args[0] == request_msg @@ -19604,7 +19582,6 @@ def test_list_phrase_sets_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.ListPhraseSetsRequest() - assert args[0] == request_msg @@ -19624,7 +19601,6 @@ def test_get_phrase_set_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.GetPhraseSetRequest() - assert args[0] == request_msg @@ -19646,7 +19622,6 @@ def test_update_phrase_set_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.UpdatePhraseSetRequest() - assert args[0] == request_msg @@ -19668,7 +19643,6 @@ def test_delete_phrase_set_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.DeletePhraseSetRequest() - assert args[0] == request_msg @@ -19690,7 +19664,6 @@ def test_undelete_phrase_set_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_speech.UndeletePhraseSetRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-storage-control/google/cloud/storage_control_v2/services/storage_control/async_client.py b/packages/google-cloud-storage-control/google/cloud/storage_control_v2/services/storage_control/async_client.py index 7c918011b89d..e3d6317b111e 100644 --- a/packages/google-cloud-storage-control/google/cloud/storage_control_v2/services/storage_control/async_client.py +++ b/packages/google-cloud-storage-control/google/cloud/storage_control_v2/services/storage_control/async_client.py @@ -459,8 +459,7 @@ async def sample_create_folder(): gapic_v1.routing_header.to_grpc_metadata(header_params), ) - 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() @@ -575,8 +574,7 @@ async def sample_delete_folder(): gapic_v1.routing_header.to_grpc_metadata(header_params), ) - 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() @@ -698,8 +696,7 @@ async def sample_get_folder(): gapic_v1.routing_header.to_grpc_metadata(header_params), ) - 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() @@ -976,8 +973,7 @@ async def sample_rename_folder(): gapic_v1.routing_header.to_grpc_metadata(header_params), ) - 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() @@ -1124,8 +1120,7 @@ async def sample_delete_folder_recursive(): gapic_v1.routing_header.to_grpc_metadata(header_params), ) - 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() @@ -1255,8 +1250,7 @@ async def sample_get_storage_layout(): gapic_v1.routing_header.to_grpc_metadata(header_params), ) - 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() @@ -1400,8 +1394,7 @@ async def sample_create_managed_folder(): gapic_v1.routing_header.to_grpc_metadata(header_params), ) - 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() @@ -1515,8 +1508,7 @@ async def sample_delete_managed_folder(): gapic_v1.routing_header.to_grpc_metadata(header_params), ) - 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() @@ -1631,8 +1623,7 @@ async def sample_get_managed_folder(): gapic_v1.routing_header.to_grpc_metadata(header_params), ) - 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() @@ -1758,8 +1749,7 @@ async def sample_list_managed_folders(): gapic_v1.routing_header.to_grpc_metadata(header_params), ) - 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() @@ -1911,8 +1901,7 @@ async def sample_create_anywhere_cache(): gapic_v1.routing_header.to_grpc_metadata(header_params), ) - 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() @@ -2069,8 +2058,7 @@ async def sample_update_anywhere_cache(): gapic_v1.routing_header.to_grpc_metadata(header_params), ) - 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() @@ -2203,8 +2191,7 @@ async def sample_disable_anywhere_cache(): gapic_v1.routing_header.to_grpc_metadata(header_params), ) - 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() @@ -2325,8 +2312,7 @@ async def sample_pause_anywhere_cache(): gapic_v1.routing_header.to_grpc_metadata(header_params), ) - 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() @@ -2447,8 +2433,7 @@ async def sample_resume_anywhere_cache(): gapic_v1.routing_header.to_grpc_metadata(header_params), ) - 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() @@ -2566,8 +2551,7 @@ async def sample_get_anywhere_cache(): gapic_v1.routing_header.to_grpc_metadata(header_params), ) - 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() @@ -2692,8 +2676,7 @@ async def sample_list_anywhere_caches(): gapic_v1.routing_header.to_grpc_metadata(header_params), ) - 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/google-cloud-storage-control/google/cloud/storage_control_v2/services/storage_control/client.py b/packages/google-cloud-storage-control/google/cloud/storage_control_v2/services/storage_control/client.py index b260ebde36b4..91f3ea0ea12b 100644 --- a/packages/google-cloud-storage-control/google/cloud/storage_control_v2/services/storage_control/client.py +++ b/packages/google-cloud-storage-control/google/cloud/storage_control_v2/services/storage_control/client.py @@ -603,6 +603,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 ) -> None: @@ -955,8 +985,7 @@ def sample_create_folder(): gapic_v1.routing_header.to_grpc_metadata(header_params), ) - 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() @@ -1068,8 +1097,7 @@ def sample_delete_folder(): gapic_v1.routing_header.to_grpc_metadata(header_params), ) - 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() @@ -1188,8 +1216,7 @@ def sample_get_folder(): gapic_v1.routing_header.to_grpc_metadata(header_params), ) - 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() @@ -1460,8 +1487,7 @@ def sample_rename_folder(): gapic_v1.routing_header.to_grpc_metadata(header_params), ) - 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() @@ -1605,8 +1631,7 @@ def sample_delete_folder_recursive(): gapic_v1.routing_header.to_grpc_metadata(header_params), ) - 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() @@ -1733,8 +1758,7 @@ def sample_get_storage_layout(): gapic_v1.routing_header.to_grpc_metadata(header_params), ) - 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() @@ -1875,8 +1899,7 @@ def sample_create_managed_folder(): gapic_v1.routing_header.to_grpc_metadata(header_params), ) - 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() @@ -1987,8 +2010,7 @@ def sample_delete_managed_folder(): gapic_v1.routing_header.to_grpc_metadata(header_params), ) - 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() @@ -2100,8 +2122,7 @@ def sample_get_managed_folder(): gapic_v1.routing_header.to_grpc_metadata(header_params), ) - 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() @@ -2224,8 +2245,7 @@ def sample_list_managed_folders(): gapic_v1.routing_header.to_grpc_metadata(header_params), ) - 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() @@ -2374,8 +2394,7 @@ def sample_create_anywhere_cache(): gapic_v1.routing_header.to_grpc_metadata(header_params), ) - 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() @@ -2529,8 +2548,7 @@ def sample_update_anywhere_cache(): gapic_v1.routing_header.to_grpc_metadata(header_params), ) - 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() @@ -2660,8 +2678,7 @@ def sample_disable_anywhere_cache(): gapic_v1.routing_header.to_grpc_metadata(header_params), ) - 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() @@ -2779,8 +2796,7 @@ def sample_pause_anywhere_cache(): gapic_v1.routing_header.to_grpc_metadata(header_params), ) - 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() @@ -2898,8 +2914,7 @@ def sample_resume_anywhere_cache(): gapic_v1.routing_header.to_grpc_metadata(header_params), ) - 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() @@ -3014,8 +3029,7 @@ def sample_get_anywhere_cache(): gapic_v1.routing_header.to_grpc_metadata(header_params), ) - 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() @@ -3137,8 +3151,7 @@ def sample_list_anywhere_caches(): gapic_v1.routing_header.to_grpc_metadata(header_params), ) - 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/google-cloud-storage-control/noxfile.py b/packages/google-cloud-storage-control/noxfile.py index e8e51c4dde75..b4ade172c441 100644 --- a/packages/google-cloud-storage-control/noxfile.py +++ b/packages/google-cloud-storage-control/noxfile.py @@ -47,7 +47,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-storage-control" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-storage-control/setup.py b/packages/google-cloud-storage-control/setup.py index ed9c28e82664..462cddfbec14 100644 --- a/packages/google-cloud-storage-control/setup.py +++ b/packages/google-cloud-storage-control/setup.py @@ -45,7 +45,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/google-cloud-storage-control/testing/constraints-3.10.txt b/packages/google-cloud-storage-control/testing/constraints-3.10.txt index a92801e1c8e2..b39cd54634f9 100644 --- a/packages/google-cloud-storage-control/testing/constraints-3.10.txt +++ b/packages/google-cloud-storage-control/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/google-cloud-storage-control/tests/unit/gapic/storage_control_v2/test_storage_control.py b/packages/google-cloud-storage-control/tests/unit/gapic/storage_control_v2/test_storage_control.py index 10bd12cf2fe3..146876b8f09c 100644 --- a/packages/google-cloud-storage-control/tests/unit/gapic/storage_control_v2/test_storage_control.py +++ b/packages/google-cloud-storage-control/tests/unit/gapic/storage_control_v2/test_storage_control.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 @@ -79,6 +80,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): @@ -121,6 +125,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" @@ -492,6 +511,104 @@ def test__add_cred_info_for_auth_errors_no_get_cred_info(error_code): 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() + StorageControlClient._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") + StorageControlClient._setup_request_id(request, "request_id", True) + assert request.request_id == "already_set" + + # Test with non-proto3 optional field empty + request = MockRequest(request_id="") + StorageControlClient._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") + StorageControlClient._setup_request_id(request, "request_id", False) + assert request.request_id == "already_set" + + # Test with proto3 optional field not in request (MockProtoRequest) + request = MockProtoRequest() + StorageControlClient._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") + StorageControlClient._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() + StorageControlClient._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 = {} + StorageControlClient._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"} + StorageControlClient._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": ""} + StorageControlClient._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"} + StorageControlClient._setup_request_id(request, "request_id", False) + assert request["request_id"] == "already_set" + + @pytest.mark.parametrize( "client_class,transport_name", [ @@ -1330,8 +1447,15 @@ def test_storage_control_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - storage_control.CreateFolderRequest, - dict, + # Pure protobuf messages (non-proto-plus) require keyword arguments. + storage_control.CreateFolderRequest( + **{ + "request_id": "explicit value for autopopulate-able field", + } + ), + { + "request_id": "explicit value for autopopulate-able field", + }, ], ) def test_create_folder(request_type, transport: str = "grpc"): @@ -1342,11 +1466,7 @@ def test_create_folder(request_type, transport: str = "grpc"): # Everything is optional in proto3 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(type(client.transport.create_folder), "__call__") as call: @@ -1394,17 +1514,14 @@ def test_create_folder_non_empty_request_with_auto_populated_field(): client.create_folder(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_control.CreateFolderRequest( + request_msg = storage_control.CreateFolderRequest( parent="parent_value", folder_id="folder_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_folder_use_cached_wrapped_rpc(): @@ -1485,9 +1602,21 @@ async def test_create_folder_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_folder_async( - transport: str = "grpc_asyncio", request_type=storage_control.CreateFolderRequest -): +@pytest.mark.parametrize( + "request_type", + [ + # Pure protobuf messages (non-proto-plus) require keyword arguments. + storage_control.CreateFolderRequest( + **{ + "request_id": "explicit value for autopopulate-able field", + } + ), + { + "request_id": "explicit value for autopopulate-able field", + }, + ], +) +async def test_create_folder_async(request_type, transport: str = "grpc_asyncio"): client = StorageControlAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1495,11 +1624,7 @@ async def test_create_folder_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() - 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(type(client.transport.create_folder), "__call__") as call: @@ -1525,11 +1650,6 @@ async def test_create_folder_async( assert response.metageneration == 1491 -@pytest.mark.asyncio -async def test_create_folder_async_from_dict(): - await test_create_folder_async(request_type=dict) - - def test_create_folder_flattened(): client = StorageControlClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1635,8 +1755,15 @@ async def test_create_folder_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - storage_control.DeleteFolderRequest, - dict, + # Pure protobuf messages (non-proto-plus) require keyword arguments. + storage_control.DeleteFolderRequest( + **{ + "request_id": "explicit value for autopopulate-able field", + } + ), + { + "request_id": "explicit value for autopopulate-able field", + }, ], ) def test_delete_folder(request_type, transport: str = "grpc"): @@ -1647,11 +1774,7 @@ def test_delete_folder(request_type, transport: str = "grpc"): # Everything is optional in proto3 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(type(client.transport.delete_folder), "__call__") as call: @@ -1693,16 +1816,13 @@ def test_delete_folder_non_empty_request_with_auto_populated_field(): client.delete_folder(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_control.DeleteFolderRequest( + request_msg = storage_control.DeleteFolderRequest( 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_folder_use_cached_wrapped_rpc(): @@ -1783,9 +1903,21 @@ async def test_delete_folder_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_folder_async( - transport: str = "grpc_asyncio", request_type=storage_control.DeleteFolderRequest -): +@pytest.mark.parametrize( + "request_type", + [ + # Pure protobuf messages (non-proto-plus) require keyword arguments. + storage_control.DeleteFolderRequest( + **{ + "request_id": "explicit value for autopopulate-able field", + } + ), + { + "request_id": "explicit value for autopopulate-able field", + }, + ], +) +async def test_delete_folder_async(request_type, transport: str = "grpc_asyncio"): client = StorageControlAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1793,11 +1925,7 @@ async def test_delete_folder_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() - 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(type(client.transport.delete_folder), "__call__") as call: @@ -1816,11 +1944,6 @@ async def test_delete_folder_async( assert response is None -@pytest.mark.asyncio -async def test_delete_folder_async_from_dict(): - await test_delete_folder_async(request_type=dict) - - def test_delete_folder_flattened(): client = StorageControlClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1904,8 +2027,15 @@ async def test_delete_folder_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - storage_control.GetFolderRequest, - dict, + # Pure protobuf messages (non-proto-plus) require keyword arguments. + storage_control.GetFolderRequest( + **{ + "request_id": "explicit value for autopopulate-able field", + } + ), + { + "request_id": "explicit value for autopopulate-able field", + }, ], ) def test_get_folder(request_type, transport: str = "grpc"): @@ -1916,11 +2046,7 @@ def test_get_folder(request_type, transport: str = "grpc"): # Everything is optional in proto3 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(type(client.transport.get_folder), "__call__") as call: @@ -1967,16 +2093,13 @@ def test_get_folder_non_empty_request_with_auto_populated_field(): client.get_folder(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_control.GetFolderRequest( + request_msg = storage_control.GetFolderRequest( 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_get_folder_use_cached_wrapped_rpc(): @@ -2055,9 +2178,21 @@ async def test_get_folder_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_folder_async( - transport: str = "grpc_asyncio", request_type=storage_control.GetFolderRequest -): +@pytest.mark.parametrize( + "request_type", + [ + # Pure protobuf messages (non-proto-plus) require keyword arguments. + storage_control.GetFolderRequest( + **{ + "request_id": "explicit value for autopopulate-able field", + } + ), + { + "request_id": "explicit value for autopopulate-able field", + }, + ], +) +async def test_get_folder_async(request_type, transport: str = "grpc_asyncio"): client = StorageControlAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2065,11 +2200,7 @@ async def test_get_folder_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() - 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(type(client.transport.get_folder), "__call__") as call: @@ -2095,11 +2226,6 @@ async def test_get_folder_async( assert response.metageneration == 1491 -@pytest.mark.asyncio -async def test_get_folder_async_from_dict(): - await test_get_folder_async(request_type=dict) - - def test_get_folder_flattened(): client = StorageControlClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2185,8 +2311,8 @@ async def test_get_folder_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - storage_control.ListFoldersRequest, - dict, + storage_control.ListFoldersRequest(), + {}, ], ) def test_list_folders(request_type, transport: str = "grpc"): @@ -2197,7 +2323,7 @@ def test_list_folders(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_folders), "__call__") as call: @@ -2246,7 +2372,7 @@ def test_list_folders_non_empty_request_with_auto_populated_field(): client.list_folders(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == storage_control.ListFoldersRequest( + request_msg = storage_control.ListFoldersRequest( parent="parent_value", page_token="page_token_value", prefix="prefix_value", @@ -2254,6 +2380,7 @@ def test_list_folders_non_empty_request_with_auto_populated_field(): lexicographic_start="lexicographic_start_value", lexicographic_end="lexicographic_end_value", ) + assert args[0] == request_msg def test_list_folders_use_cached_wrapped_rpc(): @@ -2334,9 +2461,14 @@ async def test_list_folders_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_folders_async( - transport: str = "grpc_asyncio", request_type=storage_control.ListFoldersRequest -): +@pytest.mark.parametrize( + "request_type", + [ + storage_control.ListFoldersRequest(), + {}, + ], +) +async def test_list_folders_async(request_type, transport: str = "grpc_asyncio"): client = StorageControlAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2344,7 +2476,7 @@ async def test_list_folders_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_folders), "__call__") as call: @@ -2367,11 +2499,6 @@ async def test_list_folders_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_folders_async_from_dict(): - await test_list_folders_async(request_type=dict) - - def test_list_folders_flattened(): client = StorageControlClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2644,8 +2771,15 @@ async def test_list_folders_async_pages(): @pytest.mark.parametrize( "request_type", [ - storage_control.RenameFolderRequest, - dict, + # Pure protobuf messages (non-proto-plus) require keyword arguments. + storage_control.RenameFolderRequest( + **{ + "request_id": "explicit value for autopopulate-able field", + } + ), + { + "request_id": "explicit value for autopopulate-able field", + }, ], ) def test_rename_folder(request_type, transport: str = "grpc"): @@ -2656,11 +2790,7 @@ def test_rename_folder(request_type, transport: str = "grpc"): # Everything is optional in proto3 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(type(client.transport.rename_folder), "__call__") as call: @@ -2703,17 +2833,14 @@ def test_rename_folder_non_empty_request_with_auto_populated_field(): client.rename_folder(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_control.RenameFolderRequest( + request_msg = storage_control.RenameFolderRequest( name="name_value", destination_folder_id="destination_folder_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_rename_folder_use_cached_wrapped_rpc(): @@ -2804,9 +2931,21 @@ async def test_rename_folder_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_rename_folder_async( - transport: str = "grpc_asyncio", request_type=storage_control.RenameFolderRequest -): +@pytest.mark.parametrize( + "request_type", + [ + # Pure protobuf messages (non-proto-plus) require keyword arguments. + storage_control.RenameFolderRequest( + **{ + "request_id": "explicit value for autopopulate-able field", + } + ), + { + "request_id": "explicit value for autopopulate-able field", + }, + ], +) +async def test_rename_folder_async(request_type, transport: str = "grpc_asyncio"): client = StorageControlAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2814,11 +2953,7 @@ async def test_rename_folder_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() - 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(type(client.transport.rename_folder), "__call__") as call: @@ -2839,11 +2974,6 @@ async def test_rename_folder_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_rename_folder_async_from_dict(): - await test_rename_folder_async(request_type=dict) - - def test_rename_folder_flattened(): client = StorageControlClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2939,8 +3069,15 @@ async def test_rename_folder_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - storage_control.DeleteFolderRecursiveRequest, - dict, + # Pure protobuf messages (non-proto-plus) require keyword arguments. + storage_control.DeleteFolderRecursiveRequest( + **{ + "request_id": "explicit value for autopopulate-able field", + } + ), + { + "request_id": "explicit value for autopopulate-able field", + }, ], ) def test_delete_folder_recursive(request_type, transport: str = "grpc"): @@ -2951,11 +3088,7 @@ def test_delete_folder_recursive(request_type, transport: str = "grpc"): # Everything is optional in proto3 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( @@ -3001,16 +3134,13 @@ def test_delete_folder_recursive_non_empty_request_with_auto_populated_field(): client.delete_folder_recursive(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_control.DeleteFolderRecursiveRequest( + request_msg = storage_control.DeleteFolderRecursiveRequest( 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_folder_recursive_use_cached_wrapped_rpc(): @@ -3106,9 +3236,22 @@ async def test_delete_folder_recursive_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + # Pure protobuf messages (non-proto-plus) require keyword arguments. + storage_control.DeleteFolderRecursiveRequest( + **{ + "request_id": "explicit value for autopopulate-able field", + } + ), + { + "request_id": "explicit value for autopopulate-able field", + }, + ], +) async def test_delete_folder_recursive_async( - transport: str = "grpc_asyncio", - request_type=storage_control.DeleteFolderRecursiveRequest, + request_type, transport: str = "grpc_asyncio" ): client = StorageControlAsyncClient( credentials=async_anonymous_credentials(), @@ -3117,11 +3260,7 @@ async def test_delete_folder_recursive_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() - 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( @@ -3144,11 +3283,6 @@ async def test_delete_folder_recursive_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_folder_recursive_async_from_dict(): - await test_delete_folder_recursive_async(request_type=dict) - - def test_delete_folder_recursive_flattened(): client = StorageControlClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3238,8 +3372,15 @@ async def test_delete_folder_recursive_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - storage_control.GetStorageLayoutRequest, - dict, + # Pure protobuf messages (non-proto-plus) require keyword arguments. + storage_control.GetStorageLayoutRequest( + **{ + "request_id": "explicit value for autopopulate-able field", + } + ), + { + "request_id": "explicit value for autopopulate-able field", + }, ], ) def test_get_storage_layout(request_type, transport: str = "grpc"): @@ -3250,11 +3391,7 @@ def test_get_storage_layout(request_type, transport: str = "grpc"): # Everything is optional in proto3 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( @@ -3308,17 +3445,14 @@ def test_get_storage_layout_non_empty_request_with_auto_populated_field(): client.get_storage_layout(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_control.GetStorageLayoutRequest( + request_msg = storage_control.GetStorageLayoutRequest( name="name_value", prefix="prefix_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_get_storage_layout_use_cached_wrapped_rpc(): @@ -3403,10 +3537,21 @@ async def test_get_storage_layout_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_storage_layout_async( - transport: str = "grpc_asyncio", - request_type=storage_control.GetStorageLayoutRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + # Pure protobuf messages (non-proto-plus) require keyword arguments. + storage_control.GetStorageLayoutRequest( + **{ + "request_id": "explicit value for autopopulate-able field", + } + ), + { + "request_id": "explicit value for autopopulate-able field", + }, + ], +) +async def test_get_storage_layout_async(request_type, transport: str = "grpc_asyncio"): client = StorageControlAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3414,11 +3559,7 @@ async def test_get_storage_layout_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() - 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( @@ -3448,11 +3589,6 @@ async def test_get_storage_layout_async( assert response.location_type == "location_type_value" -@pytest.mark.asyncio -async def test_get_storage_layout_async_from_dict(): - await test_get_storage_layout_async(request_type=dict) - - def test_get_storage_layout_flattened(): client = StorageControlClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3542,8 +3678,15 @@ async def test_get_storage_layout_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - storage_control.CreateManagedFolderRequest, - dict, + # Pure protobuf messages (non-proto-plus) require keyword arguments. + storage_control.CreateManagedFolderRequest( + **{ + "request_id": "explicit value for autopopulate-able field", + } + ), + { + "request_id": "explicit value for autopopulate-able field", + }, ], ) def test_create_managed_folder(request_type, transport: str = "grpc"): @@ -3554,11 +3697,7 @@ def test_create_managed_folder(request_type, transport: str = "grpc"): # Everything is optional in proto3 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( @@ -3610,17 +3749,14 @@ def test_create_managed_folder_non_empty_request_with_auto_populated_field(): client.create_managed_folder(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_control.CreateManagedFolderRequest( + request_msg = storage_control.CreateManagedFolderRequest( parent="parent_value", managed_folder_id="managed_folder_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_managed_folder_use_cached_wrapped_rpc(): @@ -3706,9 +3842,22 @@ async def test_create_managed_folder_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + # Pure protobuf messages (non-proto-plus) require keyword arguments. + storage_control.CreateManagedFolderRequest( + **{ + "request_id": "explicit value for autopopulate-able field", + } + ), + { + "request_id": "explicit value for autopopulate-able field", + }, + ], +) async def test_create_managed_folder_async( - transport: str = "grpc_asyncio", - request_type=storage_control.CreateManagedFolderRequest, + request_type, transport: str = "grpc_asyncio" ): client = StorageControlAsyncClient( credentials=async_anonymous_credentials(), @@ -3717,11 +3866,7 @@ async def test_create_managed_folder_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() - 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( @@ -3749,11 +3894,6 @@ async def test_create_managed_folder_async( assert response.metageneration == 1491 -@pytest.mark.asyncio -async def test_create_managed_folder_async_from_dict(): - await test_create_managed_folder_async(request_type=dict) - - def test_create_managed_folder_flattened(): client = StorageControlClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3863,8 +4003,15 @@ async def test_create_managed_folder_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - storage_control.DeleteManagedFolderRequest, - dict, + # Pure protobuf messages (non-proto-plus) require keyword arguments. + storage_control.DeleteManagedFolderRequest( + **{ + "request_id": "explicit value for autopopulate-able field", + } + ), + { + "request_id": "explicit value for autopopulate-able field", + }, ], ) def test_delete_managed_folder(request_type, transport: str = "grpc"): @@ -3875,11 +4022,7 @@ def test_delete_managed_folder(request_type, transport: str = "grpc"): # Everything is optional in proto3 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( @@ -3925,16 +4068,13 @@ def test_delete_managed_folder_non_empty_request_with_auto_populated_field(): client.delete_managed_folder(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_control.DeleteManagedFolderRequest( + request_msg = storage_control.DeleteManagedFolderRequest( 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_managed_folder_use_cached_wrapped_rpc(): @@ -4020,9 +4160,22 @@ async def test_delete_managed_folder_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + # Pure protobuf messages (non-proto-plus) require keyword arguments. + storage_control.DeleteManagedFolderRequest( + **{ + "request_id": "explicit value for autopopulate-able field", + } + ), + { + "request_id": "explicit value for autopopulate-able field", + }, + ], +) async def test_delete_managed_folder_async( - transport: str = "grpc_asyncio", - request_type=storage_control.DeleteManagedFolderRequest, + request_type, transport: str = "grpc_asyncio" ): client = StorageControlAsyncClient( credentials=async_anonymous_credentials(), @@ -4031,11 +4184,7 @@ async def test_delete_managed_folder_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() - 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( @@ -4056,11 +4205,6 @@ async def test_delete_managed_folder_async( assert response is None -@pytest.mark.asyncio -async def test_delete_managed_folder_async_from_dict(): - await test_delete_managed_folder_async(request_type=dict) - - def test_delete_managed_folder_flattened(): client = StorageControlClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4148,8 +4292,15 @@ async def test_delete_managed_folder_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - storage_control.GetManagedFolderRequest, - dict, + # Pure protobuf messages (non-proto-plus) require keyword arguments. + storage_control.GetManagedFolderRequest( + **{ + "request_id": "explicit value for autopopulate-able field", + } + ), + { + "request_id": "explicit value for autopopulate-able field", + }, ], ) def test_get_managed_folder(request_type, transport: str = "grpc"): @@ -4160,11 +4311,7 @@ def test_get_managed_folder(request_type, transport: str = "grpc"): # Everything is optional in proto3 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( @@ -4215,16 +4362,13 @@ def test_get_managed_folder_non_empty_request_with_auto_populated_field(): client.get_managed_folder(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_control.GetManagedFolderRequest( + request_msg = storage_control.GetManagedFolderRequest( 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_get_managed_folder_use_cached_wrapped_rpc(): @@ -4309,22 +4453,29 @@ async def test_get_managed_folder_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_managed_folder_async( - transport: str = "grpc_asyncio", - request_type=storage_control.GetManagedFolderRequest, -): - client = StorageControlAsyncClient( - credentials=async_anonymous_credentials(), - transport=transport, - ) - +@pytest.mark.parametrize( + "request_type", + [ + # Pure protobuf messages (non-proto-plus) require keyword arguments. + storage_control.GetManagedFolderRequest( + **{ + "request_id": "explicit value for autopopulate-able field", + } + ), + { + "request_id": "explicit value for autopopulate-able field", + }, + ], +) +async def test_get_managed_folder_async(request_type, transport: str = "grpc_asyncio"): + client = StorageControlAsyncClient( + credentials=async_anonymous_credentials(), + transport=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() - 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( @@ -4352,11 +4503,6 @@ async def test_get_managed_folder_async( assert response.metageneration == 1491 -@pytest.mark.asyncio -async def test_get_managed_folder_async_from_dict(): - await test_get_managed_folder_async(request_type=dict) - - def test_get_managed_folder_flattened(): client = StorageControlClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4446,8 +4592,15 @@ async def test_get_managed_folder_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - storage_control.ListManagedFoldersRequest, - dict, + # Pure protobuf messages (non-proto-plus) require keyword arguments. + storage_control.ListManagedFoldersRequest( + **{ + "request_id": "explicit value for autopopulate-able field", + } + ), + { + "request_id": "explicit value for autopopulate-able field", + }, ], ) def test_list_managed_folders(request_type, transport: str = "grpc"): @@ -4458,11 +4611,7 @@ def test_list_managed_folders(request_type, transport: str = "grpc"): # Everything is optional in proto3 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( @@ -4513,18 +4662,15 @@ def test_list_managed_folders_non_empty_request_with_auto_populated_field(): client.list_managed_folders(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_control.ListManagedFoldersRequest( + request_msg = storage_control.ListManagedFoldersRequest( parent="parent_value", page_token="page_token_value", prefix="prefix_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_list_managed_folders_use_cached_wrapped_rpc(): @@ -4609,9 +4755,22 @@ async def test_list_managed_folders_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + # Pure protobuf messages (non-proto-plus) require keyword arguments. + storage_control.ListManagedFoldersRequest( + **{ + "request_id": "explicit value for autopopulate-able field", + } + ), + { + "request_id": "explicit value for autopopulate-able field", + }, + ], +) async def test_list_managed_folders_async( - transport: str = "grpc_asyncio", - request_type=storage_control.ListManagedFoldersRequest, + request_type, transport: str = "grpc_asyncio" ): client = StorageControlAsyncClient( credentials=async_anonymous_credentials(), @@ -4620,11 +4779,7 @@ async def test_list_managed_folders_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() - 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( @@ -4650,11 +4805,6 @@ async def test_list_managed_folders_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_managed_folders_async_from_dict(): - await test_list_managed_folders_async(request_type=dict) - - def test_list_managed_folders_flattened(): client = StorageControlClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4939,8 +5089,15 @@ async def test_list_managed_folders_async_pages(): @pytest.mark.parametrize( "request_type", [ - storage_control.CreateAnywhereCacheRequest, - dict, + # Pure protobuf messages (non-proto-plus) require keyword arguments. + storage_control.CreateAnywhereCacheRequest( + **{ + "request_id": "explicit value for autopopulate-able field", + } + ), + { + "request_id": "explicit value for autopopulate-able field", + }, ], ) def test_create_anywhere_cache(request_type, transport: str = "grpc"): @@ -4951,11 +5108,7 @@ def test_create_anywhere_cache(request_type, transport: str = "grpc"): # Everything is optional in proto3 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( @@ -5001,16 +5154,13 @@ def test_create_anywhere_cache_non_empty_request_with_auto_populated_field(): client.create_anywhere_cache(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_control.CreateAnywhereCacheRequest( + request_msg = storage_control.CreateAnywhereCacheRequest( parent="parent_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_anywhere_cache_use_cached_wrapped_rpc(): @@ -5106,9 +5256,22 @@ async def test_create_anywhere_cache_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + # Pure protobuf messages (non-proto-plus) require keyword arguments. + storage_control.CreateAnywhereCacheRequest( + **{ + "request_id": "explicit value for autopopulate-able field", + } + ), + { + "request_id": "explicit value for autopopulate-able field", + }, + ], +) async def test_create_anywhere_cache_async( - transport: str = "grpc_asyncio", - request_type=storage_control.CreateAnywhereCacheRequest, + request_type, transport: str = "grpc_asyncio" ): client = StorageControlAsyncClient( credentials=async_anonymous_credentials(), @@ -5117,11 +5280,7 @@ async def test_create_anywhere_cache_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() - 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( @@ -5144,11 +5303,6 @@ async def test_create_anywhere_cache_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_anywhere_cache_async_from_dict(): - await test_create_anywhere_cache_async(request_type=dict) - - def test_create_anywhere_cache_flattened(): client = StorageControlClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5248,8 +5402,15 @@ async def test_create_anywhere_cache_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - storage_control.UpdateAnywhereCacheRequest, - dict, + # Pure protobuf messages (non-proto-plus) require keyword arguments. + storage_control.UpdateAnywhereCacheRequest( + **{ + "request_id": "explicit value for autopopulate-able field", + } + ), + { + "request_id": "explicit value for autopopulate-able field", + }, ], ) def test_update_anywhere_cache(request_type, transport: str = "grpc"): @@ -5260,11 +5421,7 @@ def test_update_anywhere_cache(request_type, transport: str = "grpc"): # Everything is optional in proto3 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( @@ -5308,14 +5465,11 @@ def test_update_anywhere_cache_non_empty_request_with_auto_populated_field(): client.update_anywhere_cache(request=request) call.assert_called() _, args, _ = call.mock_calls[0] + request_msg = storage_control.UpdateAnywhereCacheRequest() # 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_control.UpdateAnywhereCacheRequest() + assert _UUID4_RE.fullmatch(args[0].request_id) + request_msg.request_id = args[0].request_id + assert args[0] == request_msg def test_update_anywhere_cache_use_cached_wrapped_rpc(): @@ -5411,9 +5565,22 @@ async def test_update_anywhere_cache_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + # Pure protobuf messages (non-proto-plus) require keyword arguments. + storage_control.UpdateAnywhereCacheRequest( + **{ + "request_id": "explicit value for autopopulate-able field", + } + ), + { + "request_id": "explicit value for autopopulate-able field", + }, + ], +) async def test_update_anywhere_cache_async( - transport: str = "grpc_asyncio", - request_type=storage_control.UpdateAnywhereCacheRequest, + request_type, transport: str = "grpc_asyncio" ): client = StorageControlAsyncClient( credentials=async_anonymous_credentials(), @@ -5422,11 +5589,7 @@ async def test_update_anywhere_cache_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() - 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( @@ -5449,11 +5612,6 @@ async def test_update_anywhere_cache_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_anywhere_cache_async_from_dict(): - await test_update_anywhere_cache_async(request_type=dict) - - def test_update_anywhere_cache_flattened(): client = StorageControlClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5553,8 +5711,15 @@ async def test_update_anywhere_cache_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - storage_control.DisableAnywhereCacheRequest, - dict, + # Pure protobuf messages (non-proto-plus) require keyword arguments. + storage_control.DisableAnywhereCacheRequest( + **{ + "request_id": "explicit value for autopopulate-able field", + } + ), + { + "request_id": "explicit value for autopopulate-able field", + }, ], ) def test_disable_anywhere_cache(request_type, transport: str = "grpc"): @@ -5565,11 +5730,7 @@ def test_disable_anywhere_cache(request_type, transport: str = "grpc"): # Everything is optional in proto3 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( @@ -5626,16 +5787,13 @@ def test_disable_anywhere_cache_non_empty_request_with_auto_populated_field(): client.disable_anywhere_cache(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_control.DisableAnywhereCacheRequest( + request_msg = storage_control.DisableAnywhereCacheRequest( 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_disable_anywhere_cache_use_cached_wrapped_rpc(): @@ -5721,9 +5879,22 @@ async def test_disable_anywhere_cache_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + # Pure protobuf messages (non-proto-plus) require keyword arguments. + storage_control.DisableAnywhereCacheRequest( + **{ + "request_id": "explicit value for autopopulate-able field", + } + ), + { + "request_id": "explicit value for autopopulate-able field", + }, + ], +) async def test_disable_anywhere_cache_async( - transport: str = "grpc_asyncio", - request_type=storage_control.DisableAnywhereCacheRequest, + request_type, transport: str = "grpc_asyncio" ): client = StorageControlAsyncClient( credentials=async_anonymous_credentials(), @@ -5732,11 +5903,7 @@ async def test_disable_anywhere_cache_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() - 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( @@ -5770,11 +5937,6 @@ async def test_disable_anywhere_cache_async( assert response.pending_update is True -@pytest.mark.asyncio -async def test_disable_anywhere_cache_async_from_dict(): - await test_disable_anywhere_cache_async(request_type=dict) - - def test_disable_anywhere_cache_flattened(): client = StorageControlClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5864,8 +6026,15 @@ async def test_disable_anywhere_cache_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - storage_control.PauseAnywhereCacheRequest, - dict, + # Pure protobuf messages (non-proto-plus) require keyword arguments. + storage_control.PauseAnywhereCacheRequest( + **{ + "request_id": "explicit value for autopopulate-able field", + } + ), + { + "request_id": "explicit value for autopopulate-able field", + }, ], ) def test_pause_anywhere_cache(request_type, transport: str = "grpc"): @@ -5876,11 +6045,7 @@ def test_pause_anywhere_cache(request_type, transport: str = "grpc"): # Everything is optional in proto3 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( @@ -5937,16 +6102,13 @@ def test_pause_anywhere_cache_non_empty_request_with_auto_populated_field(): client.pause_anywhere_cache(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_control.PauseAnywhereCacheRequest( + request_msg = storage_control.PauseAnywhereCacheRequest( 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_pause_anywhere_cache_use_cached_wrapped_rpc(): @@ -6031,9 +6193,22 @@ async def test_pause_anywhere_cache_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + # Pure protobuf messages (non-proto-plus) require keyword arguments. + storage_control.PauseAnywhereCacheRequest( + **{ + "request_id": "explicit value for autopopulate-able field", + } + ), + { + "request_id": "explicit value for autopopulate-able field", + }, + ], +) async def test_pause_anywhere_cache_async( - transport: str = "grpc_asyncio", - request_type=storage_control.PauseAnywhereCacheRequest, + request_type, transport: str = "grpc_asyncio" ): client = StorageControlAsyncClient( credentials=async_anonymous_credentials(), @@ -6042,11 +6217,7 @@ async def test_pause_anywhere_cache_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() - 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( @@ -6080,11 +6251,6 @@ async def test_pause_anywhere_cache_async( assert response.pending_update is True -@pytest.mark.asyncio -async def test_pause_anywhere_cache_async_from_dict(): - await test_pause_anywhere_cache_async(request_type=dict) - - def test_pause_anywhere_cache_flattened(): client = StorageControlClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6174,8 +6340,15 @@ async def test_pause_anywhere_cache_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - storage_control.ResumeAnywhereCacheRequest, - dict, + # Pure protobuf messages (non-proto-plus) require keyword arguments. + storage_control.ResumeAnywhereCacheRequest( + **{ + "request_id": "explicit value for autopopulate-able field", + } + ), + { + "request_id": "explicit value for autopopulate-able field", + }, ], ) def test_resume_anywhere_cache(request_type, transport: str = "grpc"): @@ -6186,11 +6359,7 @@ def test_resume_anywhere_cache(request_type, transport: str = "grpc"): # Everything is optional in proto3 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( @@ -6247,16 +6416,13 @@ def test_resume_anywhere_cache_non_empty_request_with_auto_populated_field(): client.resume_anywhere_cache(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_control.ResumeAnywhereCacheRequest( + request_msg = storage_control.ResumeAnywhereCacheRequest( 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_resume_anywhere_cache_use_cached_wrapped_rpc(): @@ -6342,9 +6508,22 @@ async def test_resume_anywhere_cache_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + # Pure protobuf messages (non-proto-plus) require keyword arguments. + storage_control.ResumeAnywhereCacheRequest( + **{ + "request_id": "explicit value for autopopulate-able field", + } + ), + { + "request_id": "explicit value for autopopulate-able field", + }, + ], +) async def test_resume_anywhere_cache_async( - transport: str = "grpc_asyncio", - request_type=storage_control.ResumeAnywhereCacheRequest, + request_type, transport: str = "grpc_asyncio" ): client = StorageControlAsyncClient( credentials=async_anonymous_credentials(), @@ -6353,11 +6532,7 @@ async def test_resume_anywhere_cache_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() - 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( @@ -6391,11 +6566,6 @@ async def test_resume_anywhere_cache_async( assert response.pending_update is True -@pytest.mark.asyncio -async def test_resume_anywhere_cache_async_from_dict(): - await test_resume_anywhere_cache_async(request_type=dict) - - def test_resume_anywhere_cache_flattened(): client = StorageControlClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6485,8 +6655,15 @@ async def test_resume_anywhere_cache_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - storage_control.GetAnywhereCacheRequest, - dict, + # Pure protobuf messages (non-proto-plus) require keyword arguments. + storage_control.GetAnywhereCacheRequest( + **{ + "request_id": "explicit value for autopopulate-able field", + } + ), + { + "request_id": "explicit value for autopopulate-able field", + }, ], ) def test_get_anywhere_cache(request_type, transport: str = "grpc"): @@ -6497,11 +6674,7 @@ def test_get_anywhere_cache(request_type, transport: str = "grpc"): # Everything is optional in proto3 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( @@ -6558,16 +6731,13 @@ def test_get_anywhere_cache_non_empty_request_with_auto_populated_field(): client.get_anywhere_cache(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_control.GetAnywhereCacheRequest( + request_msg = storage_control.GetAnywhereCacheRequest( 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_get_anywhere_cache_use_cached_wrapped_rpc(): @@ -6652,10 +6822,21 @@ async def test_get_anywhere_cache_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_anywhere_cache_async( - transport: str = "grpc_asyncio", - request_type=storage_control.GetAnywhereCacheRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + # Pure protobuf messages (non-proto-plus) require keyword arguments. + storage_control.GetAnywhereCacheRequest( + **{ + "request_id": "explicit value for autopopulate-able field", + } + ), + { + "request_id": "explicit value for autopopulate-able field", + }, + ], +) +async def test_get_anywhere_cache_async(request_type, transport: str = "grpc_asyncio"): client = StorageControlAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6663,11 +6844,7 @@ async def test_get_anywhere_cache_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() - 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( @@ -6701,11 +6878,6 @@ async def test_get_anywhere_cache_async( assert response.pending_update is True -@pytest.mark.asyncio -async def test_get_anywhere_cache_async_from_dict(): - await test_get_anywhere_cache_async(request_type=dict) - - def test_get_anywhere_cache_flattened(): client = StorageControlClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6795,8 +6967,15 @@ async def test_get_anywhere_cache_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - storage_control.ListAnywhereCachesRequest, - dict, + # Pure protobuf messages (non-proto-plus) require keyword arguments. + storage_control.ListAnywhereCachesRequest( + **{ + "request_id": "explicit value for autopopulate-able field", + } + ), + { + "request_id": "explicit value for autopopulate-able field", + }, ], ) def test_list_anywhere_caches(request_type, transport: str = "grpc"): @@ -6807,11 +6986,7 @@ def test_list_anywhere_caches(request_type, transport: str = "grpc"): # Everything is optional in proto3 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( @@ -6861,17 +7036,14 @@ def test_list_anywhere_caches_non_empty_request_with_auto_populated_field(): client.list_anywhere_caches(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_control.ListAnywhereCachesRequest( + request_msg = storage_control.ListAnywhereCachesRequest( parent="parent_value", page_token="page_token_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_list_anywhere_caches_use_cached_wrapped_rpc(): @@ -6956,9 +7128,22 @@ async def test_list_anywhere_caches_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + # Pure protobuf messages (non-proto-plus) require keyword arguments. + storage_control.ListAnywhereCachesRequest( + **{ + "request_id": "explicit value for autopopulate-able field", + } + ), + { + "request_id": "explicit value for autopopulate-able field", + }, + ], +) async def test_list_anywhere_caches_async( - transport: str = "grpc_asyncio", - request_type=storage_control.ListAnywhereCachesRequest, + request_type, transport: str = "grpc_asyncio" ): client = StorageControlAsyncClient( credentials=async_anonymous_credentials(), @@ -6967,11 +7152,7 @@ async def test_list_anywhere_caches_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() - 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( @@ -6997,11 +7178,6 @@ async def test_list_anywhere_caches_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_anywhere_caches_async_from_dict(): - await test_list_anywhere_caches_async(request_type=dict) - - def test_list_anywhere_caches_flattened(): client = StorageControlClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7286,8 +7462,8 @@ async def test_list_anywhere_caches_async_pages(): @pytest.mark.parametrize( "request_type", [ - storage_control.GetProjectIntelligenceConfigRequest, - dict, + storage_control.GetProjectIntelligenceConfigRequest(), + {}, ], ) def test_get_project_intelligence_config(request_type, transport: str = "grpc"): @@ -7298,7 +7474,7 @@ def test_get_project_intelligence_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( @@ -7351,9 +7527,10 @@ def test_get_project_intelligence_config_non_empty_request_with_auto_populated_f client.get_project_intelligence_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == storage_control.GetProjectIntelligenceConfigRequest( + request_msg = storage_control.GetProjectIntelligenceConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_project_intelligence_config_use_cached_wrapped_rpc(): @@ -7439,9 +7616,15 @@ async def test_get_project_intelligence_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + storage_control.GetProjectIntelligenceConfigRequest(), + {}, + ], +) async def test_get_project_intelligence_config_async( - transport: str = "grpc_asyncio", - request_type=storage_control.GetProjectIntelligenceConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = StorageControlAsyncClient( credentials=async_anonymous_credentials(), @@ -7450,7 +7633,7 @@ async def test_get_project_intelligence_config_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( @@ -7480,11 +7663,6 @@ async def test_get_project_intelligence_config_async( ) -@pytest.mark.asyncio -async def test_get_project_intelligence_config_async_from_dict(): - await test_get_project_intelligence_config_async(request_type=dict) - - def test_get_project_intelligence_config_field_headers(): client = StorageControlClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7639,8 +7817,8 @@ async def test_get_project_intelligence_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - storage_control.UpdateProjectIntelligenceConfigRequest, - dict, + storage_control.UpdateProjectIntelligenceConfigRequest(), + {}, ], ) def test_update_project_intelligence_config(request_type, transport: str = "grpc"): @@ -7651,7 +7829,7 @@ def test_update_project_intelligence_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( @@ -7702,7 +7880,8 @@ def test_update_project_intelligence_config_non_empty_request_with_auto_populate client.update_project_intelligence_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == storage_control.UpdateProjectIntelligenceConfigRequest() + request_msg = storage_control.UpdateProjectIntelligenceConfigRequest() + assert args[0] == request_msg def test_update_project_intelligence_config_use_cached_wrapped_rpc(): @@ -7788,9 +7967,15 @@ async def test_update_project_intelligence_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + storage_control.UpdateProjectIntelligenceConfigRequest(), + {}, + ], +) async def test_update_project_intelligence_config_async( - transport: str = "grpc_asyncio", - request_type=storage_control.UpdateProjectIntelligenceConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = StorageControlAsyncClient( credentials=async_anonymous_credentials(), @@ -7799,7 +7984,7 @@ async def test_update_project_intelligence_config_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( @@ -7829,11 +8014,6 @@ async def test_update_project_intelligence_config_async( ) -@pytest.mark.asyncio -async def test_update_project_intelligence_config_async_from_dict(): - await test_update_project_intelligence_config_async(request_type=dict) - - def test_update_project_intelligence_config_field_headers(): client = StorageControlClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7998,8 +8178,8 @@ async def test_update_project_intelligence_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - storage_control.GetFolderIntelligenceConfigRequest, - dict, + storage_control.GetFolderIntelligenceConfigRequest(), + {}, ], ) def test_get_folder_intelligence_config(request_type, transport: str = "grpc"): @@ -8010,7 +8190,7 @@ def test_get_folder_intelligence_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( @@ -8063,9 +8243,10 @@ def test_get_folder_intelligence_config_non_empty_request_with_auto_populated_fi client.get_folder_intelligence_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == storage_control.GetFolderIntelligenceConfigRequest( + request_msg = storage_control.GetFolderIntelligenceConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_folder_intelligence_config_use_cached_wrapped_rpc(): @@ -8151,9 +8332,15 @@ async def test_get_folder_intelligence_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + storage_control.GetFolderIntelligenceConfigRequest(), + {}, + ], +) async def test_get_folder_intelligence_config_async( - transport: str = "grpc_asyncio", - request_type=storage_control.GetFolderIntelligenceConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = StorageControlAsyncClient( credentials=async_anonymous_credentials(), @@ -8162,7 +8349,7 @@ async def test_get_folder_intelligence_config_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( @@ -8192,11 +8379,6 @@ async def test_get_folder_intelligence_config_async( ) -@pytest.mark.asyncio -async def test_get_folder_intelligence_config_async_from_dict(): - await test_get_folder_intelligence_config_async(request_type=dict) - - def test_get_folder_intelligence_config_field_headers(): client = StorageControlClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8351,8 +8533,8 @@ async def test_get_folder_intelligence_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - storage_control.UpdateFolderIntelligenceConfigRequest, - dict, + storage_control.UpdateFolderIntelligenceConfigRequest(), + {}, ], ) def test_update_folder_intelligence_config(request_type, transport: str = "grpc"): @@ -8363,7 +8545,7 @@ def test_update_folder_intelligence_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( @@ -8414,7 +8596,8 @@ def test_update_folder_intelligence_config_non_empty_request_with_auto_populated client.update_folder_intelligence_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == storage_control.UpdateFolderIntelligenceConfigRequest() + request_msg = storage_control.UpdateFolderIntelligenceConfigRequest() + assert args[0] == request_msg def test_update_folder_intelligence_config_use_cached_wrapped_rpc(): @@ -8500,9 +8683,15 @@ async def test_update_folder_intelligence_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + storage_control.UpdateFolderIntelligenceConfigRequest(), + {}, + ], +) async def test_update_folder_intelligence_config_async( - transport: str = "grpc_asyncio", - request_type=storage_control.UpdateFolderIntelligenceConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = StorageControlAsyncClient( credentials=async_anonymous_credentials(), @@ -8511,7 +8700,7 @@ async def test_update_folder_intelligence_config_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( @@ -8541,11 +8730,6 @@ async def test_update_folder_intelligence_config_async( ) -@pytest.mark.asyncio -async def test_update_folder_intelligence_config_async_from_dict(): - await test_update_folder_intelligence_config_async(request_type=dict) - - def test_update_folder_intelligence_config_field_headers(): client = StorageControlClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8710,8 +8894,8 @@ async def test_update_folder_intelligence_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - storage_control.GetOrganizationIntelligenceConfigRequest, - dict, + storage_control.GetOrganizationIntelligenceConfigRequest(), + {}, ], ) def test_get_organization_intelligence_config(request_type, transport: str = "grpc"): @@ -8722,7 +8906,7 @@ def test_get_organization_intelligence_config(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( @@ -8775,9 +8959,10 @@ def test_get_organization_intelligence_config_non_empty_request_with_auto_popula client.get_organization_intelligence_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == storage_control.GetOrganizationIntelligenceConfigRequest( + request_msg = storage_control.GetOrganizationIntelligenceConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_organization_intelligence_config_use_cached_wrapped_rpc(): @@ -8863,9 +9048,15 @@ async def test_get_organization_intelligence_config_async_use_cached_wrapped_rpc @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + storage_control.GetOrganizationIntelligenceConfigRequest(), + {}, + ], +) async def test_get_organization_intelligence_config_async( - transport: str = "grpc_asyncio", - request_type=storage_control.GetOrganizationIntelligenceConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = StorageControlAsyncClient( credentials=async_anonymous_credentials(), @@ -8874,7 +9065,7 @@ async def test_get_organization_intelligence_config_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( @@ -8904,11 +9095,6 @@ async def test_get_organization_intelligence_config_async( ) -@pytest.mark.asyncio -async def test_get_organization_intelligence_config_async_from_dict(): - await test_get_organization_intelligence_config_async(request_type=dict) - - def test_get_organization_intelligence_config_field_headers(): client = StorageControlClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9063,8 +9249,8 @@ async def test_get_organization_intelligence_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - storage_control.UpdateOrganizationIntelligenceConfigRequest, - dict, + storage_control.UpdateOrganizationIntelligenceConfigRequest(), + {}, ], ) def test_update_organization_intelligence_config(request_type, transport: str = "grpc"): @@ -9075,7 +9261,7 @@ def test_update_organization_intelligence_config(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( @@ -9126,7 +9312,8 @@ def test_update_organization_intelligence_config_non_empty_request_with_auto_pop client.update_organization_intelligence_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == storage_control.UpdateOrganizationIntelligenceConfigRequest() + request_msg = storage_control.UpdateOrganizationIntelligenceConfigRequest() + assert args[0] == request_msg def test_update_organization_intelligence_config_use_cached_wrapped_rpc(): @@ -9212,9 +9399,15 @@ async def test_update_organization_intelligence_config_async_use_cached_wrapped_ @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + storage_control.UpdateOrganizationIntelligenceConfigRequest(), + {}, + ], +) async def test_update_organization_intelligence_config_async( - transport: str = "grpc_asyncio", - request_type=storage_control.UpdateOrganizationIntelligenceConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = StorageControlAsyncClient( credentials=async_anonymous_credentials(), @@ -9223,7 +9416,7 @@ async def test_update_organization_intelligence_config_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( @@ -9253,11 +9446,6 @@ async def test_update_organization_intelligence_config_async( ) -@pytest.mark.asyncio -async def test_update_organization_intelligence_config_async_from_dict(): - await test_update_organization_intelligence_config_async(request_type=dict) - - def test_update_organization_intelligence_config_field_headers(): client = StorageControlClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9422,8 +9610,8 @@ async def test_update_organization_intelligence_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.GetIamPolicyRequest, - dict, + iam_policy_pb2.GetIamPolicyRequest(), + {}, ], ) def test_get_iam_policy(request_type, transport: str = "grpc"): @@ -9434,7 +9622,7 @@ def test_get_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(type(client.transport.get_iam_policy), "__call__") as call: @@ -9480,9 +9668,10 @@ def test_get_iam_policy_non_empty_request_with_auto_populated_field(): client.get_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.GetIamPolicyRequest( + request_msg = iam_policy_pb2.GetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_get_iam_policy_use_cached_wrapped_rpc(): @@ -9563,9 +9752,14 @@ async def test_get_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.GetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.GetIamPolicyRequest(), + {}, + ], +) +async def test_get_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = StorageControlAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9573,7 +9767,7 @@ async def test_get_iam_policy_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_iam_policy), "__call__") as call: @@ -9598,11 +9792,6 @@ async def test_get_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_get_iam_policy_async_from_dict(): - await test_get_iam_policy_async(request_type=dict) - - def test_get_iam_policy_from_dict_foreign(): client = StorageControlClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9703,8 +9892,8 @@ async def test_get_iam_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.SetIamPolicyRequest, - dict, + iam_policy_pb2.SetIamPolicyRequest(), + {}, ], ) def test_set_iam_policy(request_type, transport: str = "grpc"): @@ -9715,7 +9904,7 @@ def test_set_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(type(client.transport.set_iam_policy), "__call__") as call: @@ -9761,9 +9950,10 @@ def test_set_iam_policy_non_empty_request_with_auto_populated_field(): client.set_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.SetIamPolicyRequest( + request_msg = iam_policy_pb2.SetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_set_iam_policy_use_cached_wrapped_rpc(): @@ -9844,9 +10034,14 @@ async def test_set_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.SetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.SetIamPolicyRequest(), + {}, + ], +) +async def test_set_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = StorageControlAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9854,7 +10049,7 @@ async def test_set_iam_policy_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.set_iam_policy), "__call__") as call: @@ -9879,11 +10074,6 @@ async def test_set_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_set_iam_policy_async_from_dict(): - await test_set_iam_policy_async(request_type=dict) - - def test_set_iam_policy_from_dict_foreign(): client = StorageControlClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9985,8 +10175,8 @@ async def test_set_iam_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.TestIamPermissionsRequest, - dict, + iam_policy_pb2.TestIamPermissionsRequest(), + {}, ], ) def test_test_iam_permissions(request_type, transport: str = "grpc"): @@ -9997,7 +10187,7 @@ def test_test_iam_permissions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10045,9 +10235,10 @@ def test_test_iam_permissions_non_empty_request_with_auto_populated_field(): client.test_iam_permissions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.TestIamPermissionsRequest( + request_msg = iam_policy_pb2.TestIamPermissionsRequest( resource="resource_value", ) + assert args[0] == request_msg def test_test_iam_permissions_use_cached_wrapped_rpc(): @@ -10132,9 +10323,15 @@ async def test_test_iam_permissions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.TestIamPermissionsRequest(), + {}, + ], +) async def test_test_iam_permissions_async( - transport: str = "grpc_asyncio", - request_type=iam_policy_pb2.TestIamPermissionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = StorageControlAsyncClient( credentials=async_anonymous_credentials(), @@ -10143,7 +10340,7 @@ async def test_test_iam_permissions_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( @@ -10168,11 +10365,6 @@ async def test_test_iam_permissions_async( assert response.permissions == ["permissions_value"] -@pytest.mark.asyncio -async def test_test_iam_permissions_async_from_dict(): - await test_test_iam_permissions_async(request_type=dict) - - def test_test_iam_permissions_from_dict_foreign(): client = StorageControlClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12087,15 +12279,10 @@ def test_create_folder_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_control.CreateFolderRequest() - + # 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 @@ -12115,15 +12302,10 @@ def test_delete_folder_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_control.DeleteFolderRequest() - + # 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 @@ -12143,15 +12325,10 @@ def test_get_folder_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_control.GetFolderRequest() - + # 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 @@ -12172,7 +12349,6 @@ def test_list_folders_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage_control.ListFoldersRequest() - assert args[0] == request_msg @@ -12192,15 +12368,10 @@ def test_rename_folder_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_control.RenameFolderRequest() - + # 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 @@ -12222,15 +12393,10 @@ def test_delete_folder_recursive_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_control.DeleteFolderRecursiveRequest() - + # 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 @@ -12252,15 +12418,10 @@ def test_get_storage_layout_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_control.GetStorageLayoutRequest() - + # 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 @@ -12282,15 +12443,10 @@ def test_create_managed_folder_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_control.CreateManagedFolderRequest() - + # 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 @@ -12312,15 +12468,10 @@ def test_delete_managed_folder_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_control.DeleteManagedFolderRequest() - + # 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 @@ -12342,15 +12493,10 @@ def test_get_managed_folder_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_control.GetManagedFolderRequest() - + # 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 @@ -12372,15 +12518,10 @@ def test_list_managed_folders_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_control.ListManagedFoldersRequest() - + # 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 @@ -12402,15 +12543,10 @@ def test_create_anywhere_cache_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_control.CreateAnywhereCacheRequest() - + # 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 @@ -12432,15 +12568,10 @@ def test_update_anywhere_cache_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_control.UpdateAnywhereCacheRequest() - + # 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 @@ -12462,15 +12593,10 @@ def test_disable_anywhere_cache_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_control.DisableAnywhereCacheRequest() - + # 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 @@ -12492,15 +12618,10 @@ def test_pause_anywhere_cache_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_control.PauseAnywhereCacheRequest() - + # 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 @@ -12522,15 +12643,10 @@ def test_resume_anywhere_cache_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_control.ResumeAnywhereCacheRequest() - + # 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 @@ -12552,15 +12668,10 @@ def test_get_anywhere_cache_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_control.GetAnywhereCacheRequest() - + # 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 @@ -12582,15 +12693,10 @@ def test_list_anywhere_caches_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_control.ListAnywhereCachesRequest() - + # 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 @@ -12613,7 +12719,6 @@ def test_get_project_intelligence_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage_control.GetProjectIntelligenceConfigRequest() - assert args[0] == request_msg @@ -12636,7 +12741,6 @@ def test_update_project_intelligence_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage_control.UpdateProjectIntelligenceConfigRequest() - assert args[0] == request_msg @@ -12659,7 +12763,6 @@ def test_get_folder_intelligence_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage_control.GetFolderIntelligenceConfigRequest() - assert args[0] == request_msg @@ -12682,7 +12785,6 @@ def test_update_folder_intelligence_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage_control.UpdateFolderIntelligenceConfigRequest() - assert args[0] == request_msg @@ -12705,7 +12807,6 @@ def test_get_organization_intelligence_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage_control.GetOrganizationIntelligenceConfigRequest() - assert args[0] == request_msg @@ -12728,7 +12829,6 @@ def test_update_organization_intelligence_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage_control.UpdateOrganizationIntelligenceConfigRequest() - assert args[0] == request_msg @@ -12749,7 +12849,6 @@ def test_get_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -12770,7 +12869,6 @@ def test_set_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -12793,7 +12891,6 @@ def test_test_iam_permissions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -12811,15 +12908,10 @@ def test_create_folder_routing_parameters_request_1_grpc(): # Establish that the underlying stub method was called. call.assert_called() _, args, kw = 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_control.CreateFolderRequest(**{"parent": "sample1"}) - + # 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 expected_headers = {"bucket": "sample1"} @@ -12844,17 +12936,12 @@ def test_delete_folder_routing_parameters_request_1_grpc(): # Establish that the underlying stub method was called. call.assert_called() _, args, kw = 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_control.DeleteFolderRequest( **{"name": "projects/sample1/buckets/sample2/sample3"} ) - + # 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 expected_headers = {"bucket": "projects/sample1/buckets/sample2"} @@ -12877,17 +12964,12 @@ def test_get_folder_routing_parameters_request_1_grpc(): # Establish that the underlying stub method was called. call.assert_called() _, args, kw = 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_control.GetFolderRequest( **{"name": "projects/sample1/buckets/sample2/sample3"} ) - + # 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 expected_headers = {"bucket": "projects/sample1/buckets/sample2"} @@ -12911,7 +12993,6 @@ def test_list_folders_routing_parameters_request_1_grpc(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = storage_control.ListFoldersRequest(**{"parent": "sample1"}) - assert args[0] == request_msg expected_headers = {"bucket": "sample1"} @@ -12936,17 +13017,12 @@ def test_rename_folder_routing_parameters_request_1_grpc(): # Establish that the underlying stub method was called. call.assert_called() _, args, kw = 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_control.RenameFolderRequest( **{"name": "projects/sample1/buckets/sample2/sample3"} ) - + # 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 expected_headers = {"bucket": "projects/sample1/buckets/sample2"} @@ -12973,17 +13049,12 @@ def test_delete_folder_recursive_routing_parameters_request_1_grpc(): # Establish that the underlying stub method was called. call.assert_called() _, args, kw = 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_control.DeleteFolderRecursiveRequest( **{"name": "projects/sample1/buckets/sample2/sample3"} ) - + # 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 expected_headers = {"bucket": "projects/sample1/buckets/sample2"} @@ -13010,17 +13081,12 @@ def test_get_storage_layout_routing_parameters_request_1_grpc(): # Establish that the underlying stub method was called. call.assert_called() _, args, kw = 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_control.GetStorageLayoutRequest( **{"name": "projects/sample1/buckets/sample2/sample3"} ) - + # 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 expected_headers = {"bucket": "projects/sample1/buckets/sample2"} @@ -13045,17 +13111,12 @@ def test_create_managed_folder_routing_parameters_request_1_grpc(): # Establish that the underlying stub method was called. call.assert_called() _, args, kw = 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_control.CreateManagedFolderRequest( **{"parent": "sample1"} ) - + # 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 expected_headers = {"bucket": "sample1"} @@ -13082,17 +13143,12 @@ def test_delete_managed_folder_routing_parameters_request_1_grpc(): # Establish that the underlying stub method was called. call.assert_called() _, args, kw = 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_control.DeleteManagedFolderRequest( **{"name": "projects/sample1/buckets/sample2/sample3"} ) - + # 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 expected_headers = {"bucket": "projects/sample1/buckets/sample2"} @@ -13119,17 +13175,12 @@ def test_get_managed_folder_routing_parameters_request_1_grpc(): # Establish that the underlying stub method was called. call.assert_called() _, args, kw = 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_control.GetManagedFolderRequest( **{"name": "projects/sample1/buckets/sample2/sample3"} ) - + # 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 expected_headers = {"bucket": "projects/sample1/buckets/sample2"} @@ -13154,15 +13205,10 @@ def test_list_managed_folders_routing_parameters_request_1_grpc(): # Establish that the underlying stub method was called. call.assert_called() _, args, kw = 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_control.ListManagedFoldersRequest(**{"parent": "sample1"}) - + # 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 expected_headers = {"bucket": "sample1"} @@ -13187,17 +13233,12 @@ def test_create_anywhere_cache_routing_parameters_request_1_grpc(): # Establish that the underlying stub method was called. call.assert_called() _, args, kw = 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_control.CreateAnywhereCacheRequest( **{"parent": "sample1"} ) - + # 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 expected_headers = {"bucket": "sample1"} @@ -13226,17 +13267,12 @@ def test_update_anywhere_cache_routing_parameters_request_1_grpc(): # Establish that the underlying stub method was called. call.assert_called() _, args, kw = 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_control.UpdateAnywhereCacheRequest( **{"anywhere_cache": {"name": "projects/sample1/buckets/sample2/sample3"}} ) - + # 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 expected_headers = {"bucket": "projects/sample1/buckets/sample2"} @@ -13263,17 +13299,12 @@ def test_disable_anywhere_cache_routing_parameters_request_1_grpc(): # Establish that the underlying stub method was called. call.assert_called() _, args, kw = 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_control.DisableAnywhereCacheRequest( **{"name": "projects/sample1/buckets/sample2/sample3"} ) - + # 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 expected_headers = {"bucket": "projects/sample1/buckets/sample2"} @@ -13300,17 +13331,12 @@ def test_pause_anywhere_cache_routing_parameters_request_1_grpc(): # Establish that the underlying stub method was called. call.assert_called() _, args, kw = 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_control.PauseAnywhereCacheRequest( **{"name": "projects/sample1/buckets/sample2/sample3"} ) - + # 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 expected_headers = {"bucket": "projects/sample1/buckets/sample2"} @@ -13337,17 +13363,12 @@ def test_resume_anywhere_cache_routing_parameters_request_1_grpc(): # Establish that the underlying stub method was called. call.assert_called() _, args, kw = 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_control.ResumeAnywhereCacheRequest( **{"name": "projects/sample1/buckets/sample2/sample3"} ) - + # 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 expected_headers = {"bucket": "projects/sample1/buckets/sample2"} @@ -13374,17 +13395,12 @@ def test_get_anywhere_cache_routing_parameters_request_1_grpc(): # Establish that the underlying stub method was called. call.assert_called() _, args, kw = 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_control.GetAnywhereCacheRequest( **{"name": "projects/sample1/buckets/sample2/sample3"} ) - + # 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 expected_headers = {"bucket": "projects/sample1/buckets/sample2"} @@ -13409,15 +13425,10 @@ def test_list_anywhere_caches_routing_parameters_request_1_grpc(): # Establish that the underlying stub method was called. call.assert_called() _, args, kw = 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_control.ListAnywhereCachesRequest(**{"parent": "sample1"}) - + # 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 expected_headers = {"bucket": "sample1"} @@ -13441,7 +13452,6 @@ def test_get_iam_policy_routing_parameters_request_1_grpc(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest(**{"resource": "sample1"}) - assert args[0] == request_msg expected_headers = {"bucket": "sample1"} @@ -13469,7 +13479,6 @@ def test_get_iam_policy_routing_parameters_request_2_grpc(): request_msg = iam_policy_pb2.GetIamPolicyRequest( **{"resource": "projects/sample1/buckets/sample2/sample3"} ) - assert args[0] == request_msg expected_headers = {"bucket": "projects/sample1/buckets/sample2"} @@ -13493,7 +13502,6 @@ def test_set_iam_policy_routing_parameters_request_1_grpc(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest(**{"resource": "sample1"}) - assert args[0] == request_msg expected_headers = {"bucket": "sample1"} @@ -13521,7 +13529,6 @@ def test_set_iam_policy_routing_parameters_request_2_grpc(): request_msg = iam_policy_pb2.SetIamPolicyRequest( **{"resource": "projects/sample1/buckets/sample2/sample3"} ) - assert args[0] == request_msg expected_headers = {"bucket": "projects/sample1/buckets/sample2"} @@ -13549,7 +13556,6 @@ def test_test_iam_permissions_routing_parameters_request_1_grpc(): request_msg = iam_policy_pb2.TestIamPermissionsRequest( **{"resource": "sample1"} ) - assert args[0] == request_msg expected_headers = {"bucket": "sample1"} @@ -13579,7 +13585,6 @@ def test_test_iam_permissions_routing_parameters_request_2_grpc(): request_msg = iam_policy_pb2.TestIamPermissionsRequest( **{"resource": "projects/sample1/buckets/sample2/objects/sample3"} ) - assert args[0] == request_msg expected_headers = {"bucket": "projects/sample1/buckets/sample2"} @@ -13611,7 +13616,6 @@ def test_test_iam_permissions_routing_parameters_request_3_grpc(): request_msg = iam_policy_pb2.TestIamPermissionsRequest( **{"resource": "projects/sample1/buckets/sample2/managedFolders/sample3"} ) - assert args[0] == request_msg expected_headers = {"bucket": "projects/sample1/buckets/sample2"} @@ -13657,15 +13661,10 @@ async def test_create_folder_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_control.CreateFolderRequest() - + # 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 @@ -13687,15 +13686,10 @@ async def test_delete_folder_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_control.DeleteFolderRequest() - + # 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 @@ -13722,15 +13716,10 @@ async def test_get_folder_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_control.GetFolderRequest() - + # 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 @@ -13757,7 +13746,6 @@ async def test_list_folders_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage_control.ListFoldersRequest() - assert args[0] == request_msg @@ -13781,15 +13769,10 @@ async def test_rename_folder_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_control.RenameFolderRequest() - + # 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 @@ -13815,15 +13798,10 @@ async def test_delete_folder_recursive_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_control.DeleteFolderRecursiveRequest() - + # 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 @@ -13853,15 +13831,10 @@ async def test_get_storage_layout_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_control.GetStorageLayoutRequest() - + # 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 @@ -13890,15 +13863,10 @@ async def test_create_managed_folder_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_control.CreateManagedFolderRequest() - + # 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 @@ -13922,15 +13890,10 @@ async def test_delete_managed_folder_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_control.DeleteManagedFolderRequest() - + # 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 @@ -13959,15 +13922,10 @@ async def test_get_managed_folder_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_control.GetManagedFolderRequest() - + # 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 @@ -13995,15 +13953,10 @@ async def test_list_managed_folders_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_control.ListManagedFoldersRequest() - + # 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 @@ -14029,15 +13982,10 @@ async def test_create_anywhere_cache_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_control.CreateAnywhereCacheRequest() - + # 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 @@ -14063,15 +14011,10 @@ async def test_update_anywhere_cache_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_control.UpdateAnywhereCacheRequest() - + # 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 @@ -14103,15 +14046,10 @@ async def test_disable_anywhere_cache_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_control.DisableAnywhereCacheRequest() - + # 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 @@ -14143,15 +14081,10 @@ async def test_pause_anywhere_cache_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_control.PauseAnywhereCacheRequest() - + # 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 @@ -14183,15 +14116,10 @@ async def test_resume_anywhere_cache_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_control.ResumeAnywhereCacheRequest() - + # 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 @@ -14223,15 +14151,10 @@ async def test_get_anywhere_cache_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_control.GetAnywhereCacheRequest() - + # 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 @@ -14259,15 +14182,10 @@ async def test_list_anywhere_caches_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_control.ListAnywhereCachesRequest() - + # 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 @@ -14297,7 +14215,6 @@ async def test_get_project_intelligence_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage_control.GetProjectIntelligenceConfigRequest() - assert args[0] == request_msg @@ -14327,7 +14244,6 @@ async def test_update_project_intelligence_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage_control.UpdateProjectIntelligenceConfigRequest() - assert args[0] == request_msg @@ -14357,7 +14273,6 @@ async def test_get_folder_intelligence_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage_control.GetFolderIntelligenceConfigRequest() - assert args[0] == request_msg @@ -14387,7 +14302,6 @@ async def test_update_folder_intelligence_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage_control.UpdateFolderIntelligenceConfigRequest() - assert args[0] == request_msg @@ -14417,7 +14331,6 @@ async def test_get_organization_intelligence_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage_control.GetOrganizationIntelligenceConfigRequest() - assert args[0] == request_msg @@ -14447,7 +14360,6 @@ async def test_update_organization_intelligence_config_empty_call_grpc_asyncio() call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage_control.UpdateOrganizationIntelligenceConfigRequest() - assert args[0] == request_msg @@ -14475,7 +14387,6 @@ async def test_get_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -14503,7 +14414,6 @@ async def test_set_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -14532,7 +14442,6 @@ async def test_test_iam_permissions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -14557,15 +14466,10 @@ async def test_create_folder_routing_parameters_request_1_grpc_asyncio(): # Establish that the underlying stub method was called. call.assert_called() _, args, kw = 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_control.CreateFolderRequest(**{"parent": "sample1"}) - + # 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 expected_headers = {"bucket": "sample1"} @@ -14592,17 +14496,12 @@ async def test_delete_folder_routing_parameters_request_1_grpc_asyncio(): # Establish that the underlying stub method was called. call.assert_called() _, args, kw = 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_control.DeleteFolderRequest( **{"name": "projects/sample1/buckets/sample2/sample3"} ) - + # 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 expected_headers = {"bucket": "projects/sample1/buckets/sample2"} @@ -14634,17 +14533,12 @@ async def test_get_folder_routing_parameters_request_1_grpc_asyncio(): # Establish that the underlying stub method was called. call.assert_called() _, args, kw = 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_control.GetFolderRequest( **{"name": "projects/sample1/buckets/sample2/sample3"} ) - + # 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 expected_headers = {"bucket": "projects/sample1/buckets/sample2"} @@ -14674,7 +14568,6 @@ async def test_list_folders_routing_parameters_request_1_grpc_asyncio(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = storage_control.ListFoldersRequest(**{"parent": "sample1"}) - assert args[0] == request_msg expected_headers = {"bucket": "sample1"} @@ -14703,17 +14596,12 @@ async def test_rename_folder_routing_parameters_request_1_grpc_asyncio(): # Establish that the underlying stub method was called. call.assert_called() _, args, kw = 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_control.RenameFolderRequest( **{"name": "projects/sample1/buckets/sample2/sample3"} ) - + # 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 expected_headers = {"bucket": "projects/sample1/buckets/sample2"} @@ -14744,17 +14632,12 @@ async def test_delete_folder_recursive_routing_parameters_request_1_grpc_asyncio # Establish that the underlying stub method was called. call.assert_called() _, args, kw = 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_control.DeleteFolderRecursiveRequest( **{"name": "projects/sample1/buckets/sample2/sample3"} ) - + # 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 expected_headers = {"bucket": "projects/sample1/buckets/sample2"} @@ -14789,17 +14672,12 @@ async def test_get_storage_layout_routing_parameters_request_1_grpc_asyncio(): # Establish that the underlying stub method was called. call.assert_called() _, args, kw = 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_control.GetStorageLayoutRequest( **{"name": "projects/sample1/buckets/sample2/sample3"} ) - + # 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 expected_headers = {"bucket": "projects/sample1/buckets/sample2"} @@ -14831,17 +14709,12 @@ async def test_create_managed_folder_routing_parameters_request_1_grpc_asyncio() # Establish that the underlying stub method was called. call.assert_called() _, args, kw = 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_control.CreateManagedFolderRequest( **{"parent": "sample1"} ) - + # 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 expected_headers = {"bucket": "sample1"} @@ -14870,17 +14743,12 @@ async def test_delete_managed_folder_routing_parameters_request_1_grpc_asyncio() # Establish that the underlying stub method was called. call.assert_called() _, args, kw = 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_control.DeleteManagedFolderRequest( **{"name": "projects/sample1/buckets/sample2/sample3"} ) - + # 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 expected_headers = {"bucket": "projects/sample1/buckets/sample2"} @@ -14914,17 +14782,12 @@ async def test_get_managed_folder_routing_parameters_request_1_grpc_asyncio(): # Establish that the underlying stub method was called. call.assert_called() _, args, kw = 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_control.GetManagedFolderRequest( **{"name": "projects/sample1/buckets/sample2/sample3"} ) - + # 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 expected_headers = {"bucket": "projects/sample1/buckets/sample2"} @@ -14955,15 +14818,10 @@ async def test_list_managed_folders_routing_parameters_request_1_grpc_asyncio(): # Establish that the underlying stub method was called. call.assert_called() _, args, kw = 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_control.ListManagedFoldersRequest(**{"parent": "sample1"}) - + # 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 expected_headers = {"bucket": "sample1"} @@ -14992,17 +14850,12 @@ async def test_create_anywhere_cache_routing_parameters_request_1_grpc_asyncio() # Establish that the underlying stub method was called. call.assert_called() _, args, kw = 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_control.CreateAnywhereCacheRequest( **{"parent": "sample1"} ) - + # 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 expected_headers = {"bucket": "sample1"} @@ -15035,17 +14888,12 @@ async def test_update_anywhere_cache_routing_parameters_request_1_grpc_asyncio() # Establish that the underlying stub method was called. call.assert_called() _, args, kw = 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_control.UpdateAnywhereCacheRequest( **{"anywhere_cache": {"name": "projects/sample1/buckets/sample2/sample3"}} ) - + # 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 expected_headers = {"bucket": "projects/sample1/buckets/sample2"} @@ -15082,17 +14930,12 @@ async def test_disable_anywhere_cache_routing_parameters_request_1_grpc_asyncio( # Establish that the underlying stub method was called. call.assert_called() _, args, kw = 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_control.DisableAnywhereCacheRequest( **{"name": "projects/sample1/buckets/sample2/sample3"} ) - + # 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 expected_headers = {"bucket": "projects/sample1/buckets/sample2"} @@ -15129,17 +14972,12 @@ async def test_pause_anywhere_cache_routing_parameters_request_1_grpc_asyncio(): # Establish that the underlying stub method was called. call.assert_called() _, args, kw = 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_control.PauseAnywhereCacheRequest( **{"name": "projects/sample1/buckets/sample2/sample3"} ) - + # 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 expected_headers = {"bucket": "projects/sample1/buckets/sample2"} @@ -15176,17 +15014,12 @@ async def test_resume_anywhere_cache_routing_parameters_request_1_grpc_asyncio() # Establish that the underlying stub method was called. call.assert_called() _, args, kw = 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_control.ResumeAnywhereCacheRequest( **{"name": "projects/sample1/buckets/sample2/sample3"} ) - + # 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 expected_headers = {"bucket": "projects/sample1/buckets/sample2"} @@ -15223,17 +15056,12 @@ async def test_get_anywhere_cache_routing_parameters_request_1_grpc_asyncio(): # Establish that the underlying stub method was called. call.assert_called() _, args, kw = 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_control.GetAnywhereCacheRequest( **{"name": "projects/sample1/buckets/sample2/sample3"} ) - + # 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 expected_headers = {"bucket": "projects/sample1/buckets/sample2"} @@ -15264,15 +15092,10 @@ async def test_list_anywhere_caches_routing_parameters_request_1_grpc_asyncio(): # Establish that the underlying stub method was called. call.assert_called() _, args, kw = 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_control.ListAnywhereCachesRequest(**{"parent": "sample1"}) - + # 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 expected_headers = {"bucket": "sample1"} @@ -15303,7 +15126,6 @@ async def test_get_iam_policy_routing_parameters_request_1_grpc_asyncio(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest(**{"resource": "sample1"}) - assert args[0] == request_msg expected_headers = {"bucket": "sample1"} @@ -15338,7 +15160,6 @@ async def test_get_iam_policy_routing_parameters_request_2_grpc_asyncio(): request_msg = iam_policy_pb2.GetIamPolicyRequest( **{"resource": "projects/sample1/buckets/sample2/sample3"} ) - assert args[0] == request_msg expected_headers = {"bucket": "projects/sample1/buckets/sample2"} @@ -15369,7 +15190,6 @@ async def test_set_iam_policy_routing_parameters_request_1_grpc_asyncio(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest(**{"resource": "sample1"}) - assert args[0] == request_msg expected_headers = {"bucket": "sample1"} @@ -15404,7 +15224,6 @@ async def test_set_iam_policy_routing_parameters_request_2_grpc_asyncio(): request_msg = iam_policy_pb2.SetIamPolicyRequest( **{"resource": "projects/sample1/buckets/sample2/sample3"} ) - assert args[0] == request_msg expected_headers = {"bucket": "projects/sample1/buckets/sample2"} @@ -15438,7 +15257,6 @@ async def test_test_iam_permissions_routing_parameters_request_1_grpc_asyncio(): request_msg = iam_policy_pb2.TestIamPermissionsRequest( **{"resource": "sample1"} ) - assert args[0] == request_msg expected_headers = {"bucket": "sample1"} @@ -15474,7 +15292,6 @@ async def test_test_iam_permissions_routing_parameters_request_2_grpc_asyncio(): request_msg = iam_policy_pb2.TestIamPermissionsRequest( **{"resource": "projects/sample1/buckets/sample2/objects/sample3"} ) - assert args[0] == request_msg expected_headers = {"bucket": "projects/sample1/buckets/sample2"} @@ -15512,7 +15329,6 @@ async def test_test_iam_permissions_routing_parameters_request_3_grpc_asyncio(): request_msg = iam_policy_pb2.TestIamPermissionsRequest( **{"resource": "projects/sample1/buckets/sample2/managedFolders/sample3"} ) - assert args[0] == request_msg expected_headers = {"bucket": "projects/sample1/buckets/sample2"} @@ -16948,15 +16764,10 @@ def test_create_folder_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_control.CreateFolderRequest() - + # 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 @@ -16975,15 +16786,10 @@ def test_delete_folder_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_control.DeleteFolderRequest() - + # 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 @@ -17002,15 +16808,10 @@ def test_get_folder_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_control.GetFolderRequest() - + # 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 @@ -17030,7 +16831,6 @@ def test_list_folders_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage_control.ListFoldersRequest() - assert args[0] == request_msg @@ -17049,15 +16849,10 @@ def test_rename_folder_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_control.RenameFolderRequest() - + # 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 @@ -17078,15 +16873,10 @@ def test_delete_folder_recursive_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_control.DeleteFolderRecursiveRequest() - + # 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 @@ -17107,15 +16897,10 @@ def test_get_storage_layout_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_control.GetStorageLayoutRequest() - + # 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 @@ -17136,15 +16921,10 @@ def test_create_managed_folder_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_control.CreateManagedFolderRequest() - + # 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 @@ -17165,15 +16945,10 @@ def test_delete_managed_folder_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_control.DeleteManagedFolderRequest() - + # 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 @@ -17194,15 +16969,10 @@ def test_get_managed_folder_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_control.GetManagedFolderRequest() - + # 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 @@ -17223,15 +16993,10 @@ def test_list_managed_folders_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_control.ListManagedFoldersRequest() - + # 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 @@ -17252,15 +17017,10 @@ def test_create_anywhere_cache_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_control.CreateAnywhereCacheRequest() - + # 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 @@ -17281,15 +17041,10 @@ def test_update_anywhere_cache_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_control.UpdateAnywhereCacheRequest() - + # 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 @@ -17310,15 +17065,10 @@ def test_disable_anywhere_cache_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_control.DisableAnywhereCacheRequest() - + # 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 @@ -17339,15 +17089,10 @@ def test_pause_anywhere_cache_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_control.PauseAnywhereCacheRequest() - + # 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 @@ -17368,15 +17113,10 @@ def test_resume_anywhere_cache_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_control.ResumeAnywhereCacheRequest() - + # 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 @@ -17397,15 +17137,10 @@ def test_get_anywhere_cache_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_control.GetAnywhereCacheRequest() - + # 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 @@ -17426,15 +17161,10 @@ def test_list_anywhere_caches_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_control.ListAnywhereCachesRequest() - + # 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 @@ -17456,7 +17186,6 @@ def test_get_project_intelligence_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage_control.GetProjectIntelligenceConfigRequest() - assert args[0] == request_msg @@ -17478,7 +17207,6 @@ def test_update_project_intelligence_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage_control.UpdateProjectIntelligenceConfigRequest() - assert args[0] == request_msg @@ -17500,7 +17228,6 @@ def test_get_folder_intelligence_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage_control.GetFolderIntelligenceConfigRequest() - assert args[0] == request_msg @@ -17522,7 +17249,6 @@ def test_update_folder_intelligence_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage_control.UpdateFolderIntelligenceConfigRequest() - assert args[0] == request_msg @@ -17544,7 +17270,6 @@ def test_get_organization_intelligence_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage_control.GetOrganizationIntelligenceConfigRequest() - assert args[0] == request_msg @@ -17566,7 +17291,6 @@ def test_update_organization_intelligence_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage_control.UpdateOrganizationIntelligenceConfigRequest() - assert args[0] == request_msg @@ -17586,7 +17310,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -17606,7 +17329,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -17628,7 +17350,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -17645,15 +17366,10 @@ def test_create_folder_routing_parameters_request_1_rest(): # Establish that the underlying stub method was called. call.assert_called() _, args, kw = 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_control.CreateFolderRequest(**{"parent": "sample1"}) - + # 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 expected_headers = {"bucket": "sample1"} @@ -17677,17 +17393,12 @@ def test_delete_folder_routing_parameters_request_1_rest(): # Establish that the underlying stub method was called. call.assert_called() _, args, kw = 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_control.DeleteFolderRequest( **{"name": "projects/sample1/buckets/sample2/sample3"} ) - + # 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 expected_headers = {"bucket": "projects/sample1/buckets/sample2"} @@ -17709,17 +17420,12 @@ def test_get_folder_routing_parameters_request_1_rest(): # Establish that the underlying stub method was called. call.assert_called() _, args, kw = 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_control.GetFolderRequest( **{"name": "projects/sample1/buckets/sample2/sample3"} ) - + # 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 expected_headers = {"bucket": "projects/sample1/buckets/sample2"} @@ -17742,7 +17448,6 @@ def test_list_folders_routing_parameters_request_1_rest(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = storage_control.ListFoldersRequest(**{"parent": "sample1"}) - assert args[0] == request_msg expected_headers = {"bucket": "sample1"} @@ -17766,17 +17471,12 @@ def test_rename_folder_routing_parameters_request_1_rest(): # Establish that the underlying stub method was called. call.assert_called() _, args, kw = 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_control.RenameFolderRequest( **{"name": "projects/sample1/buckets/sample2/sample3"} ) - + # 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 expected_headers = {"bucket": "projects/sample1/buckets/sample2"} @@ -17802,17 +17502,12 @@ def test_delete_folder_recursive_routing_parameters_request_1_rest(): # Establish that the underlying stub method was called. call.assert_called() _, args, kw = 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_control.DeleteFolderRecursiveRequest( **{"name": "projects/sample1/buckets/sample2/sample3"} ) - + # 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 expected_headers = {"bucket": "projects/sample1/buckets/sample2"} @@ -17838,17 +17533,12 @@ def test_get_storage_layout_routing_parameters_request_1_rest(): # Establish that the underlying stub method was called. call.assert_called() _, args, kw = 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_control.GetStorageLayoutRequest( **{"name": "projects/sample1/buckets/sample2/sample3"} ) - + # 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 expected_headers = {"bucket": "projects/sample1/buckets/sample2"} @@ -17872,17 +17562,12 @@ def test_create_managed_folder_routing_parameters_request_1_rest(): # Establish that the underlying stub method was called. call.assert_called() _, args, kw = 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_control.CreateManagedFolderRequest( **{"parent": "sample1"} ) - + # 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 expected_headers = {"bucket": "sample1"} @@ -17908,17 +17593,12 @@ def test_delete_managed_folder_routing_parameters_request_1_rest(): # Establish that the underlying stub method was called. call.assert_called() _, args, kw = 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_control.DeleteManagedFolderRequest( **{"name": "projects/sample1/buckets/sample2/sample3"} ) - + # 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 expected_headers = {"bucket": "projects/sample1/buckets/sample2"} @@ -17944,17 +17624,12 @@ def test_get_managed_folder_routing_parameters_request_1_rest(): # Establish that the underlying stub method was called. call.assert_called() _, args, kw = 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_control.GetManagedFolderRequest( **{"name": "projects/sample1/buckets/sample2/sample3"} ) - + # 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 expected_headers = {"bucket": "projects/sample1/buckets/sample2"} @@ -17978,15 +17653,10 @@ def test_list_managed_folders_routing_parameters_request_1_rest(): # Establish that the underlying stub method was called. call.assert_called() _, args, kw = 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_control.ListManagedFoldersRequest(**{"parent": "sample1"}) - + # 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 expected_headers = {"bucket": "sample1"} @@ -18010,17 +17680,12 @@ def test_create_anywhere_cache_routing_parameters_request_1_rest(): # Establish that the underlying stub method was called. call.assert_called() _, args, kw = 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_control.CreateAnywhereCacheRequest( **{"parent": "sample1"} ) - + # 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 expected_headers = {"bucket": "sample1"} @@ -18048,17 +17713,12 @@ def test_update_anywhere_cache_routing_parameters_request_1_rest(): # Establish that the underlying stub method was called. call.assert_called() _, args, kw = 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_control.UpdateAnywhereCacheRequest( **{"anywhere_cache": {"name": "projects/sample1/buckets/sample2/sample3"}} ) - + # 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 expected_headers = {"bucket": "projects/sample1/buckets/sample2"} @@ -18084,17 +17744,12 @@ def test_disable_anywhere_cache_routing_parameters_request_1_rest(): # Establish that the underlying stub method was called. call.assert_called() _, args, kw = 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_control.DisableAnywhereCacheRequest( **{"name": "projects/sample1/buckets/sample2/sample3"} ) - + # 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 expected_headers = {"bucket": "projects/sample1/buckets/sample2"} @@ -18120,17 +17775,12 @@ def test_pause_anywhere_cache_routing_parameters_request_1_rest(): # Establish that the underlying stub method was called. call.assert_called() _, args, kw = 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_control.PauseAnywhereCacheRequest( **{"name": "projects/sample1/buckets/sample2/sample3"} ) - + # 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 expected_headers = {"bucket": "projects/sample1/buckets/sample2"} @@ -18156,17 +17806,12 @@ def test_resume_anywhere_cache_routing_parameters_request_1_rest(): # Establish that the underlying stub method was called. call.assert_called() _, args, kw = 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_control.ResumeAnywhereCacheRequest( **{"name": "projects/sample1/buckets/sample2/sample3"} ) - + # 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 expected_headers = {"bucket": "projects/sample1/buckets/sample2"} @@ -18192,17 +17837,12 @@ def test_get_anywhere_cache_routing_parameters_request_1_rest(): # Establish that the underlying stub method was called. call.assert_called() _, args, kw = 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_control.GetAnywhereCacheRequest( **{"name": "projects/sample1/buckets/sample2/sample3"} ) - + # 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 expected_headers = {"bucket": "projects/sample1/buckets/sample2"} @@ -18226,15 +17866,10 @@ def test_list_anywhere_caches_routing_parameters_request_1_rest(): # Establish that the underlying stub method was called. call.assert_called() _, args, kw = 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_control.ListAnywhereCachesRequest(**{"parent": "sample1"}) - + # 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 expected_headers = {"bucket": "sample1"} @@ -18257,7 +17892,6 @@ def test_get_iam_policy_routing_parameters_request_1_rest(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest(**{"resource": "sample1"}) - assert args[0] == request_msg expected_headers = {"bucket": "sample1"} @@ -18284,7 +17918,6 @@ def test_get_iam_policy_routing_parameters_request_2_rest(): request_msg = iam_policy_pb2.GetIamPolicyRequest( **{"resource": "projects/sample1/buckets/sample2/sample3"} ) - assert args[0] == request_msg expected_headers = {"bucket": "projects/sample1/buckets/sample2"} @@ -18307,7 +17940,6 @@ def test_set_iam_policy_routing_parameters_request_1_rest(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest(**{"resource": "sample1"}) - assert args[0] == request_msg expected_headers = {"bucket": "sample1"} @@ -18334,7 +17966,6 @@ def test_set_iam_policy_routing_parameters_request_2_rest(): request_msg = iam_policy_pb2.SetIamPolicyRequest( **{"resource": "projects/sample1/buckets/sample2/sample3"} ) - assert args[0] == request_msg expected_headers = {"bucket": "projects/sample1/buckets/sample2"} @@ -18361,7 +17992,6 @@ def test_test_iam_permissions_routing_parameters_request_1_rest(): request_msg = iam_policy_pb2.TestIamPermissionsRequest( **{"resource": "sample1"} ) - assert args[0] == request_msg expected_headers = {"bucket": "sample1"} @@ -18390,7 +18020,6 @@ def test_test_iam_permissions_routing_parameters_request_2_rest(): request_msg = iam_policy_pb2.TestIamPermissionsRequest( **{"resource": "projects/sample1/buckets/sample2/objects/sample3"} ) - assert args[0] == request_msg expected_headers = {"bucket": "projects/sample1/buckets/sample2"} @@ -18421,7 +18050,6 @@ def test_test_iam_permissions_routing_parameters_request_3_rest(): request_msg = iam_policy_pb2.TestIamPermissionsRequest( **{"resource": "projects/sample1/buckets/sample2/managedFolders/sample3"} ) - assert args[0] == request_msg expected_headers = {"bucket": "projects/sample1/buckets/sample2"} diff --git a/packages/google-cloud-storage-transfer/noxfile.py b/packages/google-cloud-storage-transfer/noxfile.py index fba0f674a24c..ef9feee7ac3a 100644 --- a/packages/google-cloud-storage-transfer/noxfile.py +++ b/packages/google-cloud-storage-transfer/noxfile.py @@ -47,7 +47,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-storage-transfer" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-storage-transfer/setup.py b/packages/google-cloud-storage-transfer/setup.py index 444043873496..36982fbbe3df 100644 --- a/packages/google-cloud-storage-transfer/setup.py +++ b/packages/google-cloud-storage-transfer/setup.py @@ -45,7 +45,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/google-cloud-storage-transfer/testing/constraints-3.10.txt b/packages/google-cloud-storage-transfer/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-storage-transfer/testing/constraints-3.10.txt +++ b/packages/google-cloud-storage-transfer/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-storage-transfer/tests/unit/gapic/storage_transfer_v1/test_storage_transfer_service.py b/packages/google-cloud-storage-transfer/tests/unit/gapic/storage_transfer_v1/test_storage_transfer_service.py index 2e1382368b62..a164ae3caa2c 100644 --- a/packages/google-cloud-storage-transfer/tests/unit/gapic/storage_transfer_v1/test_storage_transfer_service.py +++ b/packages/google-cloud-storage-transfer/tests/unit/gapic/storage_transfer_v1/test_storage_transfer_service.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 @@ -118,6 +119,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" @@ -1387,8 +1403,8 @@ def test_storage_transfer_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - transfer.GetGoogleServiceAccountRequest, - dict, + transfer.GetGoogleServiceAccountRequest(), + {}, ], ) def test_get_google_service_account(request_type, transport: str = "grpc"): @@ -1399,7 +1415,7 @@ def test_get_google_service_account(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1449,9 +1465,10 @@ def test_get_google_service_account_non_empty_request_with_auto_populated_field( client.get_google_service_account(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == transfer.GetGoogleServiceAccountRequest( + request_msg = transfer.GetGoogleServiceAccountRequest( project_id="project_id_value", ) + assert args[0] == request_msg def test_get_google_service_account_use_cached_wrapped_rpc(): @@ -1537,9 +1554,15 @@ async def test_get_google_service_account_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + transfer.GetGoogleServiceAccountRequest(), + {}, + ], +) async def test_get_google_service_account_async( - transport: str = "grpc_asyncio", - request_type=transfer.GetGoogleServiceAccountRequest, + request_type, transport: str = "grpc_asyncio" ): client = StorageTransferServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1548,7 +1571,7 @@ async def test_get_google_service_account_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( @@ -1575,11 +1598,6 @@ async def test_get_google_service_account_async( assert response.subject_id == "subject_id_value" -@pytest.mark.asyncio -async def test_get_google_service_account_async_from_dict(): - await test_get_google_service_account_async(request_type=dict) - - def test_get_google_service_account_field_headers(): client = StorageTransferServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1648,8 +1666,8 @@ async def test_get_google_service_account_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - transfer.CreateTransferJobRequest, - dict, + transfer.CreateTransferJobRequest(), + {}, ], ) def test_create_transfer_job(request_type, transport: str = "grpc"): @@ -1660,7 +1678,7 @@ def test_create_transfer_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( @@ -1716,7 +1734,8 @@ def test_create_transfer_job_non_empty_request_with_auto_populated_field(): client.create_transfer_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == transfer.CreateTransferJobRequest() + request_msg = transfer.CreateTransferJobRequest() + assert args[0] == request_msg def test_create_transfer_job_use_cached_wrapped_rpc(): @@ -1801,9 +1820,14 @@ async def test_create_transfer_job_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_transfer_job_async( - transport: str = "grpc_asyncio", request_type=transfer.CreateTransferJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + transfer.CreateTransferJobRequest(), + {}, + ], +) +async def test_create_transfer_job_async(request_type, transport: str = "grpc_asyncio"): client = StorageTransferServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1811,7 +1835,7 @@ async def test_create_transfer_job_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( @@ -1846,16 +1870,11 @@ async def test_create_transfer_job_async( assert response.latest_operation_name == "latest_operation_name_value" -@pytest.mark.asyncio -async def test_create_transfer_job_async_from_dict(): - await test_create_transfer_job_async(request_type=dict) - - @pytest.mark.parametrize( "request_type", [ - transfer.UpdateTransferJobRequest, - dict, + transfer.UpdateTransferJobRequest(), + {}, ], ) def test_update_transfer_job(request_type, transport: str = "grpc"): @@ -1866,7 +1885,7 @@ def test_update_transfer_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( @@ -1925,10 +1944,11 @@ def test_update_transfer_job_non_empty_request_with_auto_populated_field(): client.update_transfer_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == transfer.UpdateTransferJobRequest( + request_msg = transfer.UpdateTransferJobRequest( job_name="job_name_value", project_id="project_id_value", ) + assert args[0] == request_msg def test_update_transfer_job_use_cached_wrapped_rpc(): @@ -2013,9 +2033,14 @@ async def test_update_transfer_job_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_transfer_job_async( - transport: str = "grpc_asyncio", request_type=transfer.UpdateTransferJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + transfer.UpdateTransferJobRequest(), + {}, + ], +) +async def test_update_transfer_job_async(request_type, transport: str = "grpc_asyncio"): client = StorageTransferServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2023,7 +2048,7 @@ async def test_update_transfer_job_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( @@ -2058,11 +2083,6 @@ async def test_update_transfer_job_async( assert response.latest_operation_name == "latest_operation_name_value" -@pytest.mark.asyncio -async def test_update_transfer_job_async_from_dict(): - await test_update_transfer_job_async(request_type=dict) - - def test_update_transfer_job_field_headers(): client = StorageTransferServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2131,8 +2151,8 @@ async def test_update_transfer_job_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - transfer.GetTransferJobRequest, - dict, + transfer.GetTransferJobRequest(), + {}, ], ) def test_get_transfer_job(request_type, transport: str = "grpc"): @@ -2143,7 +2163,7 @@ def test_get_transfer_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(type(client.transport.get_transfer_job), "__call__") as call: @@ -2198,10 +2218,11 @@ def test_get_transfer_job_non_empty_request_with_auto_populated_field(): client.get_transfer_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == transfer.GetTransferJobRequest( + request_msg = transfer.GetTransferJobRequest( job_name="job_name_value", project_id="project_id_value", ) + assert args[0] == request_msg def test_get_transfer_job_use_cached_wrapped_rpc(): @@ -2284,9 +2305,14 @@ async def test_get_transfer_job_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_transfer_job_async( - transport: str = "grpc_asyncio", request_type=transfer.GetTransferJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + transfer.GetTransferJobRequest(), + {}, + ], +) +async def test_get_transfer_job_async(request_type, transport: str = "grpc_asyncio"): client = StorageTransferServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2294,7 +2320,7 @@ async def test_get_transfer_job_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_transfer_job), "__call__") as call: @@ -2327,11 +2353,6 @@ async def test_get_transfer_job_async( assert response.latest_operation_name == "latest_operation_name_value" -@pytest.mark.asyncio -async def test_get_transfer_job_async_from_dict(): - await test_get_transfer_job_async(request_type=dict) - - def test_get_transfer_job_field_headers(): client = StorageTransferServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2396,8 +2417,8 @@ async def test_get_transfer_job_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - transfer.ListTransferJobsRequest, - dict, + transfer.ListTransferJobsRequest(), + {}, ], ) def test_list_transfer_jobs(request_type, transport: str = "grpc"): @@ -2408,7 +2429,7 @@ def test_list_transfer_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( @@ -2457,10 +2478,11 @@ def test_list_transfer_jobs_non_empty_request_with_auto_populated_field(): client.list_transfer_jobs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == transfer.ListTransferJobsRequest( + request_msg = transfer.ListTransferJobsRequest( filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_transfer_jobs_use_cached_wrapped_rpc(): @@ -2545,9 +2567,14 @@ async def test_list_transfer_jobs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_transfer_jobs_async( - transport: str = "grpc_asyncio", request_type=transfer.ListTransferJobsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + transfer.ListTransferJobsRequest(), + {}, + ], +) +async def test_list_transfer_jobs_async(request_type, transport: str = "grpc_asyncio"): client = StorageTransferServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2555,7 +2582,7 @@ async def test_list_transfer_jobs_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( @@ -2580,11 +2607,6 @@ async def test_list_transfer_jobs_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_transfer_jobs_async_from_dict(): - await test_list_transfer_jobs_async(request_type=dict) - - def test_list_transfer_jobs_pager(transport_name: str = "grpc"): client = StorageTransferServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2783,8 +2805,8 @@ async def test_list_transfer_jobs_async_pages(): @pytest.mark.parametrize( "request_type", [ - transfer.PauseTransferOperationRequest, - dict, + transfer.PauseTransferOperationRequest(), + {}, ], ) def test_pause_transfer_operation(request_type, transport: str = "grpc"): @@ -2795,7 +2817,7 @@ def test_pause_transfer_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( @@ -2840,9 +2862,10 @@ def test_pause_transfer_operation_non_empty_request_with_auto_populated_field(): client.pause_transfer_operation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == transfer.PauseTransferOperationRequest( + request_msg = transfer.PauseTransferOperationRequest( name="name_value", ) + assert args[0] == request_msg def test_pause_transfer_operation_use_cached_wrapped_rpc(): @@ -2928,8 +2951,15 @@ async def test_pause_transfer_operation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + transfer.PauseTransferOperationRequest(), + {}, + ], +) async def test_pause_transfer_operation_async( - transport: str = "grpc_asyncio", request_type=transfer.PauseTransferOperationRequest + request_type, transport: str = "grpc_asyncio" ): client = StorageTransferServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2938,7 +2968,7 @@ async def test_pause_transfer_operation_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( @@ -2958,11 +2988,6 @@ async def test_pause_transfer_operation_async( assert response is None -@pytest.mark.asyncio -async def test_pause_transfer_operation_async_from_dict(): - await test_pause_transfer_operation_async(request_type=dict) - - def test_pause_transfer_operation_field_headers(): client = StorageTransferServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3029,8 +3054,8 @@ async def test_pause_transfer_operation_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - transfer.ResumeTransferOperationRequest, - dict, + transfer.ResumeTransferOperationRequest(), + {}, ], ) def test_resume_transfer_operation(request_type, transport: str = "grpc"): @@ -3041,7 +3066,7 @@ def test_resume_transfer_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( @@ -3086,9 +3111,10 @@ def test_resume_transfer_operation_non_empty_request_with_auto_populated_field() client.resume_transfer_operation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == transfer.ResumeTransferOperationRequest( + request_msg = transfer.ResumeTransferOperationRequest( name="name_value", ) + assert args[0] == request_msg def test_resume_transfer_operation_use_cached_wrapped_rpc(): @@ -3174,9 +3200,15 @@ async def test_resume_transfer_operation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + transfer.ResumeTransferOperationRequest(), + {}, + ], +) async def test_resume_transfer_operation_async( - transport: str = "grpc_asyncio", - request_type=transfer.ResumeTransferOperationRequest, + request_type, transport: str = "grpc_asyncio" ): client = StorageTransferServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3185,7 +3217,7 @@ async def test_resume_transfer_operation_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( @@ -3205,11 +3237,6 @@ async def test_resume_transfer_operation_async( assert response is None -@pytest.mark.asyncio -async def test_resume_transfer_operation_async_from_dict(): - await test_resume_transfer_operation_async(request_type=dict) - - def test_resume_transfer_operation_field_headers(): client = StorageTransferServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3276,8 +3303,8 @@ async def test_resume_transfer_operation_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - transfer.RunTransferJobRequest, - dict, + transfer.RunTransferJobRequest(), + {}, ], ) def test_run_transfer_job(request_type, transport: str = "grpc"): @@ -3288,7 +3315,7 @@ def test_run_transfer_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(type(client.transport.run_transfer_job), "__call__") as call: @@ -3330,10 +3357,11 @@ def test_run_transfer_job_non_empty_request_with_auto_populated_field(): client.run_transfer_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == transfer.RunTransferJobRequest( + request_msg = transfer.RunTransferJobRequest( job_name="job_name_value", project_id="project_id_value", ) + assert args[0] == request_msg def test_run_transfer_job_use_cached_wrapped_rpc(): @@ -3426,9 +3454,14 @@ async def test_run_transfer_job_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_run_transfer_job_async( - transport: str = "grpc_asyncio", request_type=transfer.RunTransferJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + transfer.RunTransferJobRequest(), + {}, + ], +) +async def test_run_transfer_job_async(request_type, transport: str = "grpc_asyncio"): client = StorageTransferServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3436,7 +3469,7 @@ async def test_run_transfer_job_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.run_transfer_job), "__call__") as call: @@ -3456,11 +3489,6 @@ async def test_run_transfer_job_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_run_transfer_job_async_from_dict(): - await test_run_transfer_job_async(request_type=dict) - - def test_run_transfer_job_field_headers(): client = StorageTransferServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3525,8 +3553,8 @@ async def test_run_transfer_job_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - transfer.DeleteTransferJobRequest, - dict, + transfer.DeleteTransferJobRequest(), + {}, ], ) def test_delete_transfer_job(request_type, transport: str = "grpc"): @@ -3537,7 +3565,7 @@ def test_delete_transfer_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( @@ -3583,10 +3611,11 @@ def test_delete_transfer_job_non_empty_request_with_auto_populated_field(): client.delete_transfer_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == transfer.DeleteTransferJobRequest( + request_msg = transfer.DeleteTransferJobRequest( job_name="job_name_value", project_id="project_id_value", ) + assert args[0] == request_msg def test_delete_transfer_job_use_cached_wrapped_rpc(): @@ -3671,9 +3700,14 @@ async def test_delete_transfer_job_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_transfer_job_async( - transport: str = "grpc_asyncio", request_type=transfer.DeleteTransferJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + transfer.DeleteTransferJobRequest(), + {}, + ], +) +async def test_delete_transfer_job_async(request_type, transport: str = "grpc_asyncio"): client = StorageTransferServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3681,7 +3715,7 @@ async def test_delete_transfer_job_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( @@ -3701,11 +3735,6 @@ async def test_delete_transfer_job_async( assert response is None -@pytest.mark.asyncio -async def test_delete_transfer_job_async_from_dict(): - await test_delete_transfer_job_async(request_type=dict) - - def test_delete_transfer_job_field_headers(): client = StorageTransferServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3772,8 +3801,8 @@ async def test_delete_transfer_job_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - transfer.CreateAgentPoolRequest, - dict, + transfer.CreateAgentPoolRequest(), + {}, ], ) def test_create_agent_pool(request_type, transport: str = "grpc"): @@ -3784,7 +3813,7 @@ def test_create_agent_pool(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3837,10 +3866,11 @@ def test_create_agent_pool_non_empty_request_with_auto_populated_field(): client.create_agent_pool(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == transfer.CreateAgentPoolRequest( + request_msg = transfer.CreateAgentPoolRequest( project_id="project_id_value", agent_pool_id="agent_pool_id_value", ) + assert args[0] == request_msg def test_create_agent_pool_use_cached_wrapped_rpc(): @@ -3923,9 +3953,14 @@ async def test_create_agent_pool_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_agent_pool_async( - transport: str = "grpc_asyncio", request_type=transfer.CreateAgentPoolRequest -): +@pytest.mark.parametrize( + "request_type", + [ + transfer.CreateAgentPoolRequest(), + {}, + ], +) +async def test_create_agent_pool_async(request_type, transport: str = "grpc_asyncio"): client = StorageTransferServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3933,7 +3968,7 @@ async def test_create_agent_pool_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( @@ -3962,11 +3997,6 @@ async def test_create_agent_pool_async( assert response.state == transfer_types.AgentPool.State.CREATING -@pytest.mark.asyncio -async def test_create_agent_pool_async_from_dict(): - await test_create_agent_pool_async(request_type=dict) - - def test_create_agent_pool_field_headers(): client = StorageTransferServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4141,8 +4171,8 @@ async def test_create_agent_pool_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - transfer.UpdateAgentPoolRequest, - dict, + transfer.UpdateAgentPoolRequest(), + {}, ], ) def test_update_agent_pool(request_type, transport: str = "grpc"): @@ -4153,7 +4183,7 @@ def test_update_agent_pool(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4203,7 +4233,8 @@ def test_update_agent_pool_non_empty_request_with_auto_populated_field(): client.update_agent_pool(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == transfer.UpdateAgentPoolRequest() + request_msg = transfer.UpdateAgentPoolRequest() + assert args[0] == request_msg def test_update_agent_pool_use_cached_wrapped_rpc(): @@ -4286,9 +4317,14 @@ async def test_update_agent_pool_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_agent_pool_async( - transport: str = "grpc_asyncio", request_type=transfer.UpdateAgentPoolRequest -): +@pytest.mark.parametrize( + "request_type", + [ + transfer.UpdateAgentPoolRequest(), + {}, + ], +) +async def test_update_agent_pool_async(request_type, transport: str = "grpc_asyncio"): client = StorageTransferServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4296,7 +4332,7 @@ async def test_update_agent_pool_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( @@ -4325,11 +4361,6 @@ async def test_update_agent_pool_async( assert response.state == transfer_types.AgentPool.State.CREATING -@pytest.mark.asyncio -async def test_update_agent_pool_async_from_dict(): - await test_update_agent_pool_async(request_type=dict) - - def test_update_agent_pool_field_headers(): client = StorageTransferServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4494,8 +4525,8 @@ async def test_update_agent_pool_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - transfer.GetAgentPoolRequest, - dict, + transfer.GetAgentPoolRequest(), + {}, ], ) def test_get_agent_pool(request_type, transport: str = "grpc"): @@ -4506,7 +4537,7 @@ def test_get_agent_pool(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_agent_pool), "__call__") as call: @@ -4554,9 +4585,10 @@ def test_get_agent_pool_non_empty_request_with_auto_populated_field(): client.get_agent_pool(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == transfer.GetAgentPoolRequest( + request_msg = transfer.GetAgentPoolRequest( name="name_value", ) + assert args[0] == request_msg def test_get_agent_pool_use_cached_wrapped_rpc(): @@ -4637,9 +4669,14 @@ async def test_get_agent_pool_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_agent_pool_async( - transport: str = "grpc_asyncio", request_type=transfer.GetAgentPoolRequest -): +@pytest.mark.parametrize( + "request_type", + [ + transfer.GetAgentPoolRequest(), + {}, + ], +) +async def test_get_agent_pool_async(request_type, transport: str = "grpc_asyncio"): client = StorageTransferServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4647,7 +4684,7 @@ async def test_get_agent_pool_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_agent_pool), "__call__") as call: @@ -4674,11 +4711,6 @@ async def test_get_agent_pool_async( assert response.state == transfer_types.AgentPool.State.CREATING -@pytest.mark.asyncio -async def test_get_agent_pool_async_from_dict(): - await test_get_agent_pool_async(request_type=dict) - - def test_get_agent_pool_field_headers(): client = StorageTransferServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4825,8 +4857,8 @@ async def test_get_agent_pool_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - transfer.ListAgentPoolsRequest, - dict, + transfer.ListAgentPoolsRequest(), + {}, ], ) def test_list_agent_pools(request_type, transport: str = "grpc"): @@ -4837,7 +4869,7 @@ def test_list_agent_pools(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_agent_pools), "__call__") as call: @@ -4883,11 +4915,12 @@ def test_list_agent_pools_non_empty_request_with_auto_populated_field(): client.list_agent_pools(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == transfer.ListAgentPoolsRequest( + request_msg = transfer.ListAgentPoolsRequest( project_id="project_id_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_agent_pools_use_cached_wrapped_rpc(): @@ -4970,9 +5003,14 @@ async def test_list_agent_pools_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_agent_pools_async( - transport: str = "grpc_asyncio", request_type=transfer.ListAgentPoolsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + transfer.ListAgentPoolsRequest(), + {}, + ], +) +async def test_list_agent_pools_async(request_type, transport: str = "grpc_asyncio"): client = StorageTransferServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4980,7 +5018,7 @@ async def test_list_agent_pools_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_agent_pools), "__call__") as call: @@ -5003,11 +5041,6 @@ async def test_list_agent_pools_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_agent_pools_async_from_dict(): - await test_list_agent_pools_async(request_type=dict) - - def test_list_agent_pools_field_headers(): client = StorageTransferServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5344,8 +5377,8 @@ async def test_list_agent_pools_async_pages(): @pytest.mark.parametrize( "request_type", [ - transfer.DeleteAgentPoolRequest, - dict, + transfer.DeleteAgentPoolRequest(), + {}, ], ) def test_delete_agent_pool(request_type, transport: str = "grpc"): @@ -5356,7 +5389,7 @@ def test_delete_agent_pool(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5401,9 +5434,10 @@ def test_delete_agent_pool_non_empty_request_with_auto_populated_field(): client.delete_agent_pool(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == transfer.DeleteAgentPoolRequest( + request_msg = transfer.DeleteAgentPoolRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_agent_pool_use_cached_wrapped_rpc(): @@ -5486,9 +5520,14 @@ async def test_delete_agent_pool_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_agent_pool_async( - transport: str = "grpc_asyncio", request_type=transfer.DeleteAgentPoolRequest -): +@pytest.mark.parametrize( + "request_type", + [ + transfer.DeleteAgentPoolRequest(), + {}, + ], +) +async def test_delete_agent_pool_async(request_type, transport: str = "grpc_asyncio"): client = StorageTransferServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5496,7 +5535,7 @@ async def test_delete_agent_pool_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( @@ -5516,11 +5555,6 @@ async def test_delete_agent_pool_async( assert response is None -@pytest.mark.asyncio -async def test_delete_agent_pool_async_from_dict(): - await test_delete_agent_pool_async(request_type=dict) - - def test_delete_agent_pool_field_headers(): client = StorageTransferServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8047,7 +8081,6 @@ def test_get_google_service_account_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transfer.GetGoogleServiceAccountRequest() - assert args[0] == request_msg @@ -8070,7 +8103,6 @@ def test_create_transfer_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transfer.CreateTransferJobRequest() - assert args[0] == request_msg @@ -8093,7 +8125,6 @@ def test_update_transfer_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transfer.UpdateTransferJobRequest() - assert args[0] == request_msg @@ -8114,7 +8145,6 @@ def test_get_transfer_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transfer.GetTransferJobRequest() - assert args[0] == request_msg @@ -8137,7 +8167,6 @@ def test_list_transfer_jobs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transfer.ListTransferJobsRequest() - assert args[0] == request_msg @@ -8160,7 +8189,6 @@ def test_pause_transfer_operation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transfer.PauseTransferOperationRequest() - assert args[0] == request_msg @@ -8183,7 +8211,6 @@ def test_resume_transfer_operation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transfer.ResumeTransferOperationRequest() - assert args[0] == request_msg @@ -8204,7 +8231,6 @@ def test_run_transfer_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transfer.RunTransferJobRequest() - assert args[0] == request_msg @@ -8227,7 +8253,6 @@ def test_delete_transfer_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transfer.DeleteTransferJobRequest() - assert args[0] == request_msg @@ -8250,7 +8275,6 @@ def test_create_agent_pool_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transfer.CreateAgentPoolRequest() - assert args[0] == request_msg @@ -8273,7 +8297,6 @@ def test_update_agent_pool_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transfer.UpdateAgentPoolRequest() - assert args[0] == request_msg @@ -8294,7 +8317,6 @@ def test_get_agent_pool_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transfer.GetAgentPoolRequest() - assert args[0] == request_msg @@ -8315,7 +8337,6 @@ def test_list_agent_pools_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transfer.ListAgentPoolsRequest() - assert args[0] == request_msg @@ -8338,7 +8359,6 @@ def test_delete_agent_pool_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transfer.DeleteAgentPoolRequest() - assert args[0] == request_msg @@ -8382,7 +8402,6 @@ async def test_get_google_service_account_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transfer.GetGoogleServiceAccountRequest() - assert args[0] == request_msg @@ -8416,7 +8435,6 @@ async def test_create_transfer_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transfer.CreateTransferJobRequest() - assert args[0] == request_msg @@ -8450,7 +8468,6 @@ async def test_update_transfer_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transfer.UpdateTransferJobRequest() - assert args[0] == request_msg @@ -8482,7 +8499,6 @@ async def test_get_transfer_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transfer.GetTransferJobRequest() - assert args[0] == request_msg @@ -8511,7 +8527,6 @@ async def test_list_transfer_jobs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transfer.ListTransferJobsRequest() - assert args[0] == request_msg @@ -8536,7 +8551,6 @@ async def test_pause_transfer_operation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transfer.PauseTransferOperationRequest() - assert args[0] == request_msg @@ -8561,7 +8575,6 @@ async def test_resume_transfer_operation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transfer.ResumeTransferOperationRequest() - assert args[0] == request_msg @@ -8586,7 +8599,6 @@ async def test_run_transfer_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transfer.RunTransferJobRequest() - assert args[0] == request_msg @@ -8611,7 +8623,6 @@ async def test_delete_transfer_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transfer.DeleteTransferJobRequest() - assert args[0] == request_msg @@ -8642,7 +8653,6 @@ async def test_create_agent_pool_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transfer.CreateAgentPoolRequest() - assert args[0] == request_msg @@ -8673,7 +8683,6 @@ async def test_update_agent_pool_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transfer.UpdateAgentPoolRequest() - assert args[0] == request_msg @@ -8702,7 +8711,6 @@ async def test_get_agent_pool_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transfer.GetAgentPoolRequest() - assert args[0] == request_msg @@ -8729,7 +8737,6 @@ async def test_list_agent_pools_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transfer.ListAgentPoolsRequest() - assert args[0] == request_msg @@ -8754,7 +8761,6 @@ async def test_delete_agent_pool_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transfer.DeleteAgentPoolRequest() - assert args[0] == request_msg @@ -11101,7 +11107,6 @@ def test_get_google_service_account_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transfer.GetGoogleServiceAccountRequest() - assert args[0] == request_msg @@ -11123,7 +11128,6 @@ def test_create_transfer_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transfer.CreateTransferJobRequest() - assert args[0] == request_msg @@ -11145,7 +11149,6 @@ def test_update_transfer_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transfer.UpdateTransferJobRequest() - assert args[0] == request_msg @@ -11165,7 +11168,6 @@ def test_get_transfer_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transfer.GetTransferJobRequest() - assert args[0] == request_msg @@ -11187,7 +11189,6 @@ def test_list_transfer_jobs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transfer.ListTransferJobsRequest() - assert args[0] == request_msg @@ -11209,7 +11210,6 @@ def test_pause_transfer_operation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transfer.PauseTransferOperationRequest() - assert args[0] == request_msg @@ -11231,7 +11231,6 @@ def test_resume_transfer_operation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transfer.ResumeTransferOperationRequest() - assert args[0] == request_msg @@ -11251,7 +11250,6 @@ def test_run_transfer_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transfer.RunTransferJobRequest() - assert args[0] == request_msg @@ -11273,7 +11271,6 @@ def test_delete_transfer_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transfer.DeleteTransferJobRequest() - assert args[0] == request_msg @@ -11295,7 +11292,6 @@ def test_create_agent_pool_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transfer.CreateAgentPoolRequest() - assert args[0] == request_msg @@ -11317,7 +11313,6 @@ def test_update_agent_pool_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transfer.UpdateAgentPoolRequest() - assert args[0] == request_msg @@ -11337,7 +11332,6 @@ def test_get_agent_pool_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transfer.GetAgentPoolRequest() - assert args[0] == request_msg @@ -11357,7 +11351,6 @@ def test_list_agent_pools_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transfer.ListAgentPoolsRequest() - assert args[0] == request_msg @@ -11379,7 +11372,6 @@ def test_delete_agent_pool_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = transfer.DeleteAgentPoolRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-storage/noxfile.py b/packages/google-cloud-storage/noxfile.py index 5dd0c9b11868..6e8d41c60b3d 100644 --- a/packages/google-cloud-storage/noxfile.py +++ b/packages/google-cloud-storage/noxfile.py @@ -47,7 +47,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-storage" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -653,14 +658,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-storage/setup.py b/packages/google-cloud-storage/setup.py index d5c310983ab8..0f339a119486 100644 --- a/packages/google-cloud-storage/setup.py +++ b/packages/google-cloud-storage/setup.py @@ -58,9 +58,9 @@ # experimental in this SDK. More info in b/465352227 "grpc": [ "google-api-core[grpc] >= 2.27.0, < 3.0.0", - "grpcio >= 1.44.0, < 2.0.0; python_version < '3.14'", + "grpcio >= 1.59.0, < 2.0.0; python_version < '3.14'", "grpcio >= 1.75.1, < 2.0.0; python_version >= '3.14'", - "grpcio-status >= 1.44.0, < 2.0.0; python_version < '3.14'", + "grpcio-status >= 1.59.0, < 2.0.0; python_version < '3.14'", "grpcio-status >= 1.75.1, < 2.0.0; python_version >= '3.14'", "proto-plus >= 1.22.3, <2.0.0; python_version < '3.13'", "proto-plus >= 1.25.0, <2.0.0; python_version >= '3.13'", diff --git a/packages/google-cloud-storage/testing/constraints-3.10.txt b/packages/google-cloud-storage/testing/constraints-3.10.txt index 97296ecabb9a..e4294e2f1397 100644 --- a/packages/google-cloud-storage/testing/constraints-3.10.txt +++ b/packages/google-cloud-storage/testing/constraints-3.10.txt @@ -10,8 +10,8 @@ cryptography==38.0.0 google-api-core==2.27.0 google-cloud-core==2.4.2 google-resumable-media==2.7.2 -grpcio==1.44.0 -grpcio-status==1.44.0 +grpcio==1.59.0 +grpcio-status==1.59.0 proto-plus==1.22.3 protobuf==4.25.8 grpc-google-iam-v1==0.14.0 diff --git a/packages/google-cloud-storage/tests/unit/gapic/_storage_v2/test_storage.py b/packages/google-cloud-storage/tests/unit/gapic/_storage_v2/test_storage.py index 7da2d8d2fa53..f8de9bed61d6 100644 --- a/packages/google-cloud-storage/tests/unit/gapic/_storage_v2/test_storage.py +++ b/packages/google-cloud-storage/tests/unit/gapic/_storage_v2/test_storage.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 @@ -113,6 +114,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" @@ -1235,8 +1251,8 @@ def test_storage_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - storage.DeleteBucketRequest, - dict, + storage.DeleteBucketRequest(), + {}, ], ) def test_delete_bucket(request_type, transport: str = "grpc"): @@ -1247,7 +1263,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: @@ -1288,9 +1304,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] == storage.DeleteBucketRequest( + request_msg = storage.DeleteBucketRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_bucket_use_cached_wrapped_rpc(): @@ -1371,9 +1388,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=storage.DeleteBucketRequest -): +@pytest.mark.parametrize( + "request_type", + [ + storage.DeleteBucketRequest(), + {}, + ], +) +async def test_delete_bucket_async(request_type, transport: str = "grpc_asyncio"): client = StorageAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1381,7 +1403,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: @@ -1399,11 +1421,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_flattened(): client = StorageClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1487,8 +1504,8 @@ async def test_delete_bucket_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - storage.GetBucketRequest, - dict, + storage.GetBucketRequest(), + {}, ], ) def test_get_bucket(request_type, transport: str = "grpc"): @@ -1499,7 +1516,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: @@ -1563,9 +1580,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] == storage.GetBucketRequest( + request_msg = storage.GetBucketRequest( name="name_value", ) + assert args[0] == request_msg def test_get_bucket_use_cached_wrapped_rpc(): @@ -1644,9 +1662,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=storage.GetBucketRequest -): +@pytest.mark.parametrize( + "request_type", + [ + storage.GetBucketRequest(), + {}, + ], +) +async def test_get_bucket_async(request_type, transport: str = "grpc_asyncio"): client = StorageAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1654,7 +1677,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: @@ -1697,11 +1720,6 @@ async def test_get_bucket_async( assert response.satisfies_pzs is True -@pytest.mark.asyncio -async def test_get_bucket_async_from_dict(): - await test_get_bucket_async(request_type=dict) - - def test_get_bucket_flattened(): client = StorageClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1785,8 +1803,8 @@ async def test_get_bucket_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - storage.CreateBucketRequest, - dict, + storage.CreateBucketRequest(), + {}, ], ) def test_create_bucket(request_type, transport: str = "grpc"): @@ -1797,7 +1815,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: @@ -1864,12 +1882,13 @@ 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] == storage.CreateBucketRequest( + request_msg = storage.CreateBucketRequest( parent="parent_value", bucket_id="bucket_id_value", predefined_acl="predefined_acl_value", predefined_default_object_acl="predefined_default_object_acl_value", ) + assert args[0] == request_msg def test_create_bucket_use_cached_wrapped_rpc(): @@ -1950,9 +1969,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=storage.CreateBucketRequest -): +@pytest.mark.parametrize( + "request_type", + [ + storage.CreateBucketRequest(), + {}, + ], +) +async def test_create_bucket_async(request_type, transport: str = "grpc_asyncio"): client = StorageAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1960,7 +1984,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: @@ -2003,11 +2027,6 @@ async def test_create_bucket_async( assert response.satisfies_pzs is True -@pytest.mark.asyncio -async def test_create_bucket_async_from_dict(): - await test_create_bucket_async(request_type=dict) - - def test_create_bucket_flattened(): client = StorageClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2111,8 +2130,8 @@ async def test_create_bucket_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - storage.ListBucketsRequest, - dict, + storage.ListBucketsRequest(), + {}, ], ) def test_list_buckets(request_type, transport: str = "grpc"): @@ -2123,7 +2142,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: @@ -2171,11 +2190,12 @@ 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] == storage.ListBucketsRequest( + request_msg = storage.ListBucketsRequest( parent="parent_value", page_token="page_token_value", prefix="prefix_value", ) + assert args[0] == request_msg def test_list_buckets_use_cached_wrapped_rpc(): @@ -2256,9 +2276,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=storage.ListBucketsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + storage.ListBucketsRequest(), + {}, + ], +) +async def test_list_buckets_async(request_type, transport: str = "grpc_asyncio"): client = StorageAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2266,7 +2291,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: @@ -2291,11 +2316,6 @@ async def test_list_buckets_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_buckets_async_from_dict(): - await test_list_buckets_async(request_type=dict) - - def test_list_buckets_flattened(): client = StorageClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2568,8 +2588,8 @@ async def test_list_buckets_async_pages(): @pytest.mark.parametrize( "request_type", [ - storage.LockBucketRetentionPolicyRequest, - dict, + storage.LockBucketRetentionPolicyRequest(), + {}, ], ) def test_lock_bucket_retention_policy(request_type, transport: str = "grpc"): @@ -2580,7 +2600,7 @@ def test_lock_bucket_retention_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( @@ -2648,9 +2668,10 @@ def test_lock_bucket_retention_policy_non_empty_request_with_auto_populated_fiel client.lock_bucket_retention_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == storage.LockBucketRetentionPolicyRequest( + request_msg = storage.LockBucketRetentionPolicyRequest( bucket="bucket_value", ) + assert args[0] == request_msg def test_lock_bucket_retention_policy_use_cached_wrapped_rpc(): @@ -2736,9 +2757,15 @@ async def test_lock_bucket_retention_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + storage.LockBucketRetentionPolicyRequest(), + {}, + ], +) async def test_lock_bucket_retention_policy_async( - transport: str = "grpc_asyncio", - request_type=storage.LockBucketRetentionPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = StorageAsyncClient( credentials=async_anonymous_credentials(), @@ -2747,7 +2774,7 @@ async def test_lock_bucket_retention_policy_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( @@ -2792,11 +2819,6 @@ async def test_lock_bucket_retention_policy_async( assert response.satisfies_pzs is True -@pytest.mark.asyncio -async def test_lock_bucket_retention_policy_async_from_dict(): - await test_lock_bucket_retention_policy_async(request_type=dict) - - def test_lock_bucket_retention_policy_flattened(): client = StorageClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2884,8 +2906,8 @@ async def test_lock_bucket_retention_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.GetIamPolicyRequest, - dict, + iam_policy_pb2.GetIamPolicyRequest(), + {}, ], ) def test_get_iam_policy(request_type, transport: str = "grpc"): @@ -2896,7 +2918,7 @@ def test_get_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(type(client.transport.get_iam_policy), "__call__") as call: @@ -2942,9 +2964,10 @@ def test_get_iam_policy_non_empty_request_with_auto_populated_field(): client.get_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.GetIamPolicyRequest( + request_msg = iam_policy_pb2.GetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_get_iam_policy_use_cached_wrapped_rpc(): @@ -3025,9 +3048,14 @@ async def test_get_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.GetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.GetIamPolicyRequest(), + {}, + ], +) +async def test_get_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = StorageAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3035,7 +3063,7 @@ async def test_get_iam_policy_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_iam_policy), "__call__") as call: @@ -3060,11 +3088,6 @@ async def test_get_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_get_iam_policy_async_from_dict(): - await test_get_iam_policy_async(request_type=dict) - - def test_get_iam_policy_from_dict_foreign(): client = StorageClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3165,8 +3188,8 @@ async def test_get_iam_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.SetIamPolicyRequest, - dict, + iam_policy_pb2.SetIamPolicyRequest(), + {}, ], ) def test_set_iam_policy(request_type, transport: str = "grpc"): @@ -3177,7 +3200,7 @@ def test_set_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(type(client.transport.set_iam_policy), "__call__") as call: @@ -3223,9 +3246,10 @@ def test_set_iam_policy_non_empty_request_with_auto_populated_field(): client.set_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.SetIamPolicyRequest( + request_msg = iam_policy_pb2.SetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_set_iam_policy_use_cached_wrapped_rpc(): @@ -3306,9 +3330,14 @@ async def test_set_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.SetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.SetIamPolicyRequest(), + {}, + ], +) +async def test_set_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = StorageAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3316,7 +3345,7 @@ async def test_set_iam_policy_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.set_iam_policy), "__call__") as call: @@ -3341,11 +3370,6 @@ async def test_set_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_set_iam_policy_async_from_dict(): - await test_set_iam_policy_async(request_type=dict) - - def test_set_iam_policy_from_dict_foreign(): client = StorageClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3447,8 +3471,8 @@ async def test_set_iam_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.TestIamPermissionsRequest, - dict, + iam_policy_pb2.TestIamPermissionsRequest(), + {}, ], ) def test_test_iam_permissions(request_type, transport: str = "grpc"): @@ -3459,7 +3483,7 @@ def test_test_iam_permissions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3507,9 +3531,10 @@ def test_test_iam_permissions_non_empty_request_with_auto_populated_field(): client.test_iam_permissions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.TestIamPermissionsRequest( + request_msg = iam_policy_pb2.TestIamPermissionsRequest( resource="resource_value", ) + assert args[0] == request_msg def test_test_iam_permissions_use_cached_wrapped_rpc(): @@ -3594,9 +3619,15 @@ async def test_test_iam_permissions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.TestIamPermissionsRequest(), + {}, + ], +) async def test_test_iam_permissions_async( - transport: str = "grpc_asyncio", - request_type=iam_policy_pb2.TestIamPermissionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = StorageAsyncClient( credentials=async_anonymous_credentials(), @@ -3605,7 +3636,7 @@ async def test_test_iam_permissions_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( @@ -3630,11 +3661,6 @@ async def test_test_iam_permissions_async( assert response.permissions == ["permissions_value"] -@pytest.mark.asyncio -async def test_test_iam_permissions_async_from_dict(): - await test_test_iam_permissions_async(request_type=dict) - - def test_test_iam_permissions_from_dict_foreign(): client = StorageClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3753,8 +3779,8 @@ async def test_test_iam_permissions_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - storage.UpdateBucketRequest, - dict, + storage.UpdateBucketRequest(), + {}, ], ) def test_update_bucket(request_type, transport: str = "grpc"): @@ -3765,7 +3791,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: @@ -3830,10 +3856,11 @@ 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] == storage.UpdateBucketRequest( + request_msg = storage.UpdateBucketRequest( predefined_acl="predefined_acl_value", predefined_default_object_acl="predefined_default_object_acl_value", ) + assert args[0] == request_msg def test_update_bucket_use_cached_wrapped_rpc(): @@ -3914,9 +3941,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=storage.UpdateBucketRequest -): +@pytest.mark.parametrize( + "request_type", + [ + storage.UpdateBucketRequest(), + {}, + ], +) +async def test_update_bucket_async(request_type, transport: str = "grpc_asyncio"): client = StorageAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3924,7 +3956,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: @@ -3967,11 +3999,6 @@ async def test_update_bucket_async( assert response.satisfies_pzs is True -@pytest.mark.asyncio -async def test_update_bucket_async_from_dict(): - await test_update_bucket_async(request_type=dict) - - def test_update_bucket_flattened(): client = StorageClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4065,8 +4092,8 @@ async def test_update_bucket_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - storage.ComposeObjectRequest, - dict, + storage.ComposeObjectRequest(), + {}, ], ) def test_compose_object(request_type, transport: str = "grpc"): @@ -4077,7 +4104,7 @@ def test_compose_object(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.compose_object), "__call__") as call: @@ -4154,10 +4181,11 @@ def test_compose_object_non_empty_request_with_auto_populated_field(): client.compose_object(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == storage.ComposeObjectRequest( + request_msg = storage.ComposeObjectRequest( destination_predefined_acl="destination_predefined_acl_value", kms_key="kms_key_value", ) + assert args[0] == request_msg def test_compose_object_use_cached_wrapped_rpc(): @@ -4238,9 +4266,14 @@ async def test_compose_object_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_compose_object_async( - transport: str = "grpc_asyncio", request_type=storage.ComposeObjectRequest -): +@pytest.mark.parametrize( + "request_type", + [ + storage.ComposeObjectRequest(), + {}, + ], +) +async def test_compose_object_async(request_type, transport: str = "grpc_asyncio"): client = StorageAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4248,7 +4281,7 @@ async def test_compose_object_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.compose_object), "__call__") as call: @@ -4303,16 +4336,11 @@ async def test_compose_object_async( assert response.event_based_hold is True -@pytest.mark.asyncio -async def test_compose_object_async_from_dict(): - await test_compose_object_async(request_type=dict) - - @pytest.mark.parametrize( "request_type", [ - storage.DeleteObjectRequest, - dict, + storage.DeleteObjectRequest(), + {}, ], ) def test_delete_object(request_type, transport: str = "grpc"): @@ -4323,7 +4351,7 @@ def test_delete_object(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_object), "__call__") as call: @@ -4365,10 +4393,11 @@ def test_delete_object_non_empty_request_with_auto_populated_field(): client.delete_object(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == storage.DeleteObjectRequest( + request_msg = storage.DeleteObjectRequest( bucket="bucket_value", object_="object__value", ) + assert args[0] == request_msg def test_delete_object_use_cached_wrapped_rpc(): @@ -4449,9 +4478,14 @@ async def test_delete_object_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_object_async( - transport: str = "grpc_asyncio", request_type=storage.DeleteObjectRequest -): +@pytest.mark.parametrize( + "request_type", + [ + storage.DeleteObjectRequest(), + {}, + ], +) +async def test_delete_object_async(request_type, transport: str = "grpc_asyncio"): client = StorageAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4459,7 +4493,7 @@ async def test_delete_object_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_object), "__call__") as call: @@ -4477,11 +4511,6 @@ async def test_delete_object_async( assert response is None -@pytest.mark.asyncio -async def test_delete_object_async_from_dict(): - await test_delete_object_async(request_type=dict) - - def test_delete_object_flattened(): client = StorageClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4585,8 +4614,8 @@ async def test_delete_object_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - storage.RestoreObjectRequest, - dict, + storage.RestoreObjectRequest(), + {}, ], ) def test_restore_object(request_type, transport: str = "grpc"): @@ -4597,7 +4626,7 @@ def test_restore_object(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.restore_object), "__call__") as call: @@ -4675,11 +4704,12 @@ def test_restore_object_non_empty_request_with_auto_populated_field(): client.restore_object(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == storage.RestoreObjectRequest( + request_msg = storage.RestoreObjectRequest( bucket="bucket_value", object_="object__value", restore_token="restore_token_value", ) + assert args[0] == request_msg def test_restore_object_use_cached_wrapped_rpc(): @@ -4760,9 +4790,14 @@ async def test_restore_object_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_restore_object_async( - transport: str = "grpc_asyncio", request_type=storage.RestoreObjectRequest -): +@pytest.mark.parametrize( + "request_type", + [ + storage.RestoreObjectRequest(), + {}, + ], +) +async def test_restore_object_async(request_type, transport: str = "grpc_asyncio"): client = StorageAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4770,7 +4805,7 @@ async def test_restore_object_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.restore_object), "__call__") as call: @@ -4825,11 +4860,6 @@ async def test_restore_object_async( assert response.event_based_hold is True -@pytest.mark.asyncio -async def test_restore_object_async_from_dict(): - await test_restore_object_async(request_type=dict) - - def test_restore_object_flattened(): client = StorageClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4933,8 +4963,8 @@ async def test_restore_object_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - storage.CancelResumableWriteRequest, - dict, + storage.CancelResumableWriteRequest(), + {}, ], ) def test_cancel_resumable_write(request_type, transport: str = "grpc"): @@ -4945,7 +4975,7 @@ def test_cancel_resumable_write(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4990,9 +5020,10 @@ def test_cancel_resumable_write_non_empty_request_with_auto_populated_field(): client.cancel_resumable_write(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == storage.CancelResumableWriteRequest( + request_msg = storage.CancelResumableWriteRequest( upload_id="upload_id_value", ) + assert args[0] == request_msg def test_cancel_resumable_write_use_cached_wrapped_rpc(): @@ -5078,8 +5109,15 @@ async def test_cancel_resumable_write_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + storage.CancelResumableWriteRequest(), + {}, + ], +) async def test_cancel_resumable_write_async( - transport: str = "grpc_asyncio", request_type=storage.CancelResumableWriteRequest + request_type, transport: str = "grpc_asyncio" ): client = StorageAsyncClient( credentials=async_anonymous_credentials(), @@ -5088,7 +5126,7 @@ async def test_cancel_resumable_write_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( @@ -5110,11 +5148,6 @@ async def test_cancel_resumable_write_async( assert isinstance(response, storage.CancelResumableWriteResponse) -@pytest.mark.asyncio -async def test_cancel_resumable_write_async_from_dict(): - await test_cancel_resumable_write_async(request_type=dict) - - def test_cancel_resumable_write_flattened(): client = StorageClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5204,8 +5237,8 @@ async def test_cancel_resumable_write_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - storage.GetObjectRequest, - dict, + storage.GetObjectRequest(), + {}, ], ) def test_get_object(request_type, transport: str = "grpc"): @@ -5216,7 +5249,7 @@ def test_get_object(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_object), "__call__") as call: @@ -5294,11 +5327,12 @@ def test_get_object_non_empty_request_with_auto_populated_field(): client.get_object(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == storage.GetObjectRequest( + request_msg = storage.GetObjectRequest( bucket="bucket_value", object_="object__value", restore_token="restore_token_value", ) + assert args[0] == request_msg def test_get_object_use_cached_wrapped_rpc(): @@ -5377,9 +5411,14 @@ async def test_get_object_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_object_async( - transport: str = "grpc_asyncio", request_type=storage.GetObjectRequest -): +@pytest.mark.parametrize( + "request_type", + [ + storage.GetObjectRequest(), + {}, + ], +) +async def test_get_object_async(request_type, transport: str = "grpc_asyncio"): client = StorageAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5387,7 +5426,7 @@ async def test_get_object_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_object), "__call__") as call: @@ -5442,11 +5481,6 @@ async def test_get_object_async( assert response.event_based_hold is True -@pytest.mark.asyncio -async def test_get_object_async_from_dict(): - await test_get_object_async(request_type=dict) - - def test_get_object_flattened(): client = StorageClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5550,8 +5584,8 @@ async def test_get_object_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - storage.ReadObjectRequest, - dict, + storage.ReadObjectRequest(), + {}, ], ) def test_read_object(request_type, transport: str = "grpc"): @@ -5562,7 +5596,7 @@ def test_read_object(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.read_object), "__call__") as call: @@ -5605,10 +5639,11 @@ def test_read_object_non_empty_request_with_auto_populated_field(): client.read_object(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == storage.ReadObjectRequest( + request_msg = storage.ReadObjectRequest( bucket="bucket_value", object_="object__value", ) + assert args[0] == request_msg def test_read_object_use_cached_wrapped_rpc(): @@ -5689,9 +5724,14 @@ async def test_read_object_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_read_object_async( - transport: str = "grpc_asyncio", request_type=storage.ReadObjectRequest -): +@pytest.mark.parametrize( + "request_type", + [ + storage.ReadObjectRequest(), + {}, + ], +) +async def test_read_object_async(request_type, transport: str = "grpc_asyncio"): client = StorageAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5699,7 +5739,7 @@ async def test_read_object_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.read_object), "__call__") as call: @@ -5721,11 +5761,6 @@ async def test_read_object_async( assert isinstance(message, storage.ReadObjectResponse) -@pytest.mark.asyncio -async def test_read_object_async_from_dict(): - await test_read_object_async(request_type=dict) - - def test_read_object_flattened(): client = StorageClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5829,8 +5864,8 @@ async def test_read_object_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - storage.BidiReadObjectRequest, - dict, + storage.BidiReadObjectRequest(), + {}, ], ) def test_bidi_read_object(request_type, transport: str = "grpc"): @@ -5841,7 +5876,7 @@ def test_bidi_read_object(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as 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. @@ -5940,9 +5975,14 @@ async def test_bidi_read_object_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_bidi_read_object_async( - transport: str = "grpc_asyncio", request_type=storage.BidiReadObjectRequest -): +@pytest.mark.parametrize( + "request_type", + [ + storage.BidiReadObjectRequest(), + {}, + ], +) +async def test_bidi_read_object_async(request_type, transport: str = "grpc_asyncio"): client = StorageAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5950,7 +5990,7 @@ async def test_bidi_read_object_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. @@ -5972,16 +6012,11 @@ async def test_bidi_read_object_async( assert isinstance(message, storage.BidiReadObjectResponse) -@pytest.mark.asyncio -async def test_bidi_read_object_async_from_dict(): - await test_bidi_read_object_async(request_type=dict) - - @pytest.mark.parametrize( "request_type", [ - storage.UpdateObjectRequest, - dict, + storage.UpdateObjectRequest(), + {}, ], ) def test_update_object(request_type, transport: str = "grpc"): @@ -5992,7 +6027,7 @@ def test_update_object(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_object), "__call__") as call: @@ -6068,9 +6103,10 @@ def test_update_object_non_empty_request_with_auto_populated_field(): client.update_object(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == storage.UpdateObjectRequest( + request_msg = storage.UpdateObjectRequest( predefined_acl="predefined_acl_value", ) + assert args[0] == request_msg def test_update_object_use_cached_wrapped_rpc(): @@ -6151,9 +6187,14 @@ async def test_update_object_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_object_async( - transport: str = "grpc_asyncio", request_type=storage.UpdateObjectRequest -): +@pytest.mark.parametrize( + "request_type", + [ + storage.UpdateObjectRequest(), + {}, + ], +) +async def test_update_object_async(request_type, transport: str = "grpc_asyncio"): client = StorageAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6161,7 +6202,7 @@ async def test_update_object_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_object), "__call__") as call: @@ -6216,11 +6257,6 @@ async def test_update_object_async( assert response.event_based_hold is True -@pytest.mark.asyncio -async def test_update_object_async_from_dict(): - await test_update_object_async(request_type=dict) - - def test_update_object_flattened(): client = StorageClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6314,8 +6350,8 @@ async def test_update_object_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - storage.WriteObjectRequest, - dict, + storage.WriteObjectRequest(), + {}, ], ) def test_write_object(request_type, transport: str = "grpc"): @@ -6326,7 +6362,7 @@ def test_write_object(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as 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. @@ -6424,9 +6460,14 @@ async def test_write_object_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_write_object_async( - transport: str = "grpc_asyncio", request_type=storage.WriteObjectRequest -): +@pytest.mark.parametrize( + "request_type", + [ + storage.WriteObjectRequest(), + {}, + ], +) +async def test_write_object_async(request_type, transport: str = "grpc_asyncio"): client = StorageAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6434,7 +6475,7 @@ async def test_write_object_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. @@ -6454,16 +6495,11 @@ async def test_write_object_async( assert isinstance(response, storage.WriteObjectResponse) -@pytest.mark.asyncio -async def test_write_object_async_from_dict(): - await test_write_object_async(request_type=dict) - - @pytest.mark.parametrize( "request_type", [ - storage.BidiWriteObjectRequest, - dict, + storage.BidiWriteObjectRequest(), + {}, ], ) def test_bidi_write_object(request_type, transport: str = "grpc"): @@ -6474,7 +6510,7 @@ def test_bidi_write_object(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as 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. @@ -6575,9 +6611,14 @@ async def test_bidi_write_object_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_bidi_write_object_async( - transport: str = "grpc_asyncio", request_type=storage.BidiWriteObjectRequest -): +@pytest.mark.parametrize( + "request_type", + [ + storage.BidiWriteObjectRequest(), + {}, + ], +) +async def test_bidi_write_object_async(request_type, transport: str = "grpc_asyncio"): client = StorageAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6585,7 +6626,7 @@ async def test_bidi_write_object_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. @@ -6609,16 +6650,11 @@ async def test_bidi_write_object_async( assert isinstance(message, storage.BidiWriteObjectResponse) -@pytest.mark.asyncio -async def test_bidi_write_object_async_from_dict(): - await test_bidi_write_object_async(request_type=dict) - - @pytest.mark.parametrize( "request_type", [ - storage.ListObjectsRequest, - dict, + storage.ListObjectsRequest(), + {}, ], ) def test_list_objects(request_type, transport: str = "grpc"): @@ -6629,7 +6665,7 @@ def test_list_objects(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_objects), "__call__") as call: @@ -6682,7 +6718,7 @@ def test_list_objects_non_empty_request_with_auto_populated_field(): client.list_objects(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == storage.ListObjectsRequest( + request_msg = storage.ListObjectsRequest( parent="parent_value", page_token="page_token_value", delimiter="delimiter_value", @@ -6692,6 +6728,7 @@ def test_list_objects_non_empty_request_with_auto_populated_field(): match_glob="match_glob_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_objects_use_cached_wrapped_rpc(): @@ -6772,9 +6809,14 @@ async def test_list_objects_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_objects_async( - transport: str = "grpc_asyncio", request_type=storage.ListObjectsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + storage.ListObjectsRequest(), + {}, + ], +) +async def test_list_objects_async(request_type, transport: str = "grpc_asyncio"): client = StorageAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6782,7 +6824,7 @@ async def test_list_objects_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_objects), "__call__") as call: @@ -6807,11 +6849,6 @@ async def test_list_objects_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_objects_async_from_dict(): - await test_list_objects_async(request_type=dict) - - def test_list_objects_flattened(): client = StorageClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7084,8 +7121,8 @@ async def test_list_objects_async_pages(): @pytest.mark.parametrize( "request_type", [ - storage.RewriteObjectRequest, - dict, + storage.RewriteObjectRequest(), + {}, ], ) def test_rewrite_object(request_type, transport: str = "grpc"): @@ -7096,7 +7133,7 @@ def test_rewrite_object(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.rewrite_object), "__call__") as call: @@ -7153,7 +7190,7 @@ def test_rewrite_object_non_empty_request_with_auto_populated_field(): client.rewrite_object(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == storage.RewriteObjectRequest( + request_msg = storage.RewriteObjectRequest( destination_name="destination_name_value", destination_bucket="destination_bucket_value", destination_kms_key="destination_kms_key_value", @@ -7163,6 +7200,7 @@ def test_rewrite_object_non_empty_request_with_auto_populated_field(): destination_predefined_acl="destination_predefined_acl_value", copy_source_encryption_algorithm="copy_source_encryption_algorithm_value", ) + assert args[0] == request_msg def test_rewrite_object_use_cached_wrapped_rpc(): @@ -7243,9 +7281,14 @@ async def test_rewrite_object_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_rewrite_object_async( - transport: str = "grpc_asyncio", request_type=storage.RewriteObjectRequest -): +@pytest.mark.parametrize( + "request_type", + [ + storage.RewriteObjectRequest(), + {}, + ], +) +async def test_rewrite_object_async(request_type, transport: str = "grpc_asyncio"): client = StorageAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7253,7 +7296,7 @@ async def test_rewrite_object_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.rewrite_object), "__call__") as call: @@ -7282,16 +7325,11 @@ async def test_rewrite_object_async( assert response.rewrite_token == "rewrite_token_value" -@pytest.mark.asyncio -async def test_rewrite_object_async_from_dict(): - await test_rewrite_object_async(request_type=dict) - - @pytest.mark.parametrize( "request_type", [ - storage.StartResumableWriteRequest, - dict, + storage.StartResumableWriteRequest(), + {}, ], ) def test_start_resumable_write(request_type, transport: str = "grpc"): @@ -7302,7 +7340,7 @@ def test_start_resumable_write(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7348,7 +7386,8 @@ def test_start_resumable_write_non_empty_request_with_auto_populated_field(): client.start_resumable_write(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == storage.StartResumableWriteRequest() + request_msg = storage.StartResumableWriteRequest() + assert args[0] == request_msg def test_start_resumable_write_use_cached_wrapped_rpc(): @@ -7434,8 +7473,15 @@ async def test_start_resumable_write_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + storage.StartResumableWriteRequest(), + {}, + ], +) async def test_start_resumable_write_async( - transport: str = "grpc_asyncio", request_type=storage.StartResumableWriteRequest + request_type, transport: str = "grpc_asyncio" ): client = StorageAsyncClient( credentials=async_anonymous_credentials(), @@ -7444,7 +7490,7 @@ async def test_start_resumable_write_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( @@ -7469,16 +7515,11 @@ async def test_start_resumable_write_async( assert response.upload_id == "upload_id_value" -@pytest.mark.asyncio -async def test_start_resumable_write_async_from_dict(): - await test_start_resumable_write_async(request_type=dict) - - @pytest.mark.parametrize( "request_type", [ - storage.QueryWriteStatusRequest, - dict, + storage.QueryWriteStatusRequest(), + {}, ], ) def test_query_write_status(request_type, transport: str = "grpc"): @@ -7489,7 +7530,7 @@ def test_query_write_status(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7536,9 +7577,10 @@ def test_query_write_status_non_empty_request_with_auto_populated_field(): client.query_write_status(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == storage.QueryWriteStatusRequest( + request_msg = storage.QueryWriteStatusRequest( upload_id="upload_id_value", ) + assert args[0] == request_msg def test_query_write_status_use_cached_wrapped_rpc(): @@ -7623,9 +7665,14 @@ async def test_query_write_status_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_query_write_status_async( - transport: str = "grpc_asyncio", request_type=storage.QueryWriteStatusRequest -): +@pytest.mark.parametrize( + "request_type", + [ + storage.QueryWriteStatusRequest(), + {}, + ], +) +async def test_query_write_status_async(request_type, transport: str = "grpc_asyncio"): client = StorageAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7633,7 +7680,7 @@ async def test_query_write_status_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( @@ -7655,11 +7702,6 @@ async def test_query_write_status_async( assert isinstance(response, storage.QueryWriteStatusResponse) -@pytest.mark.asyncio -async def test_query_write_status_async_from_dict(): - await test_query_write_status_async(request_type=dict) - - def test_query_write_status_flattened(): client = StorageClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7749,8 +7791,8 @@ async def test_query_write_status_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - storage.MoveObjectRequest, - dict, + storage.MoveObjectRequest(), + {}, ], ) def test_move_object(request_type, transport: str = "grpc"): @@ -7761,7 +7803,7 @@ def test_move_object(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.move_object), "__call__") as call: @@ -7839,11 +7881,12 @@ def test_move_object_non_empty_request_with_auto_populated_field(): client.move_object(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == storage.MoveObjectRequest( + request_msg = storage.MoveObjectRequest( bucket="bucket_value", source_object="source_object_value", destination_object="destination_object_value", ) + assert args[0] == request_msg def test_move_object_use_cached_wrapped_rpc(): @@ -7924,9 +7967,14 @@ async def test_move_object_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_move_object_async( - transport: str = "grpc_asyncio", request_type=storage.MoveObjectRequest -): +@pytest.mark.parametrize( + "request_type", + [ + storage.MoveObjectRequest(), + {}, + ], +) +async def test_move_object_async(request_type, transport: str = "grpc_asyncio"): client = StorageAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7934,7 +7982,7 @@ async def test_move_object_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.move_object), "__call__") as call: @@ -7989,11 +8037,6 @@ async def test_move_object_async( assert response.event_based_hold is True -@pytest.mark.asyncio -async def test_move_object_async_from_dict(): - await test_move_object_async(request_type=dict) - - def test_move_object_flattened(): client = StorageClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8216,7 +8259,6 @@ def test_delete_bucket_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage.DeleteBucketRequest() - assert args[0] == request_msg @@ -8237,7 +8279,6 @@ def test_get_bucket_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage.GetBucketRequest() - assert args[0] == request_msg @@ -8258,7 +8299,6 @@ def test_create_bucket_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage.CreateBucketRequest() - assert args[0] == request_msg @@ -8279,7 +8319,6 @@ def test_list_buckets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage.ListBucketsRequest() - assert args[0] == request_msg @@ -8302,7 +8341,6 @@ def test_lock_bucket_retention_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage.LockBucketRetentionPolicyRequest() - assert args[0] == request_msg @@ -8323,7 +8361,6 @@ def test_get_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -8344,7 +8381,6 @@ def test_set_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -8367,7 +8403,6 @@ def test_test_iam_permissions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -8388,7 +8423,6 @@ def test_update_bucket_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage.UpdateBucketRequest() - assert args[0] == request_msg @@ -8409,7 +8443,6 @@ def test_compose_object_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage.ComposeObjectRequest() - assert args[0] == request_msg @@ -8430,7 +8463,6 @@ def test_delete_object_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage.DeleteObjectRequest() - assert args[0] == request_msg @@ -8451,7 +8483,6 @@ def test_restore_object_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage.RestoreObjectRequest() - assert args[0] == request_msg @@ -8474,7 +8505,6 @@ def test_cancel_resumable_write_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage.CancelResumableWriteRequest() - assert args[0] == request_msg @@ -8495,7 +8525,6 @@ def test_get_object_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage.GetObjectRequest() - assert args[0] == request_msg @@ -8516,7 +8545,6 @@ def test_read_object_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage.ReadObjectRequest() - assert args[0] == request_msg @@ -8537,7 +8565,6 @@ def test_update_object_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage.UpdateObjectRequest() - assert args[0] == request_msg @@ -8558,7 +8585,6 @@ def test_list_objects_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage.ListObjectsRequest() - assert args[0] == request_msg @@ -8579,7 +8605,6 @@ def test_rewrite_object_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage.RewriteObjectRequest() - assert args[0] == request_msg @@ -8602,7 +8627,6 @@ def test_start_resumable_write_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage.StartResumableWriteRequest() - assert args[0] == request_msg @@ -8625,7 +8649,6 @@ def test_query_write_status_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage.QueryWriteStatusRequest() - assert args[0] == request_msg @@ -8646,7 +8669,6 @@ def test_move_object_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage.MoveObjectRequest() - assert args[0] == request_msg @@ -8665,7 +8687,6 @@ def test_delete_bucket_routing_parameters_request_1_grpc(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = storage.DeleteBucketRequest(**{"name": "sample1"}) - assert args[0] == request_msg expected_headers = {"bucket": "sample1"} @@ -8689,7 +8710,6 @@ def test_get_bucket_routing_parameters_request_1_grpc(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = storage.GetBucketRequest(**{"name": "sample1"}) - assert args[0] == request_msg expected_headers = {"bucket": "sample1"} @@ -8713,7 +8733,6 @@ def test_create_bucket_routing_parameters_request_1_grpc(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = storage.CreateBucketRequest(**{"parent": "sample1"}) - assert args[0] == request_msg expected_headers = {"project": "sample1"} @@ -8737,7 +8756,6 @@ def test_create_bucket_routing_parameters_request_2_grpc(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = storage.CreateBucketRequest(**{"bucket": {"project": "sample1"}}) - assert args[0] == request_msg expected_headers = {"project": "sample1"} @@ -8761,7 +8779,6 @@ def test_list_buckets_routing_parameters_request_1_grpc(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = storage.ListBucketsRequest(**{"parent": "sample1"}) - assert args[0] == request_msg expected_headers = {"project": "sample1"} @@ -8787,7 +8804,6 @@ def test_lock_bucket_retention_policy_routing_parameters_request_1_grpc(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = storage.LockBucketRetentionPolicyRequest(**{"bucket": "sample1"}) - assert args[0] == request_msg expected_headers = {"bucket": "sample1"} @@ -8811,7 +8827,6 @@ def test_get_iam_policy_routing_parameters_request_1_grpc(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest(**{"resource": "sample1"}) - assert args[0] == request_msg expected_headers = {"bucket": "sample1"} @@ -8839,7 +8854,6 @@ def test_get_iam_policy_routing_parameters_request_2_grpc(): request_msg = iam_policy_pb2.GetIamPolicyRequest( **{"resource": "projects/sample1/buckets/sample2/sample3"} ) - assert args[0] == request_msg expected_headers = {"bucket": "projects/sample1/buckets/sample2"} @@ -8863,7 +8877,6 @@ def test_set_iam_policy_routing_parameters_request_1_grpc(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest(**{"resource": "sample1"}) - assert args[0] == request_msg expected_headers = {"bucket": "sample1"} @@ -8891,7 +8904,6 @@ def test_set_iam_policy_routing_parameters_request_2_grpc(): request_msg = iam_policy_pb2.SetIamPolicyRequest( **{"resource": "projects/sample1/buckets/sample2/sample3"} ) - assert args[0] == request_msg expected_headers = {"bucket": "projects/sample1/buckets/sample2"} @@ -8919,7 +8931,6 @@ def test_test_iam_permissions_routing_parameters_request_1_grpc(): request_msg = iam_policy_pb2.TestIamPermissionsRequest( **{"resource": "sample1"} ) - assert args[0] == request_msg expected_headers = {"bucket": "sample1"} @@ -8949,7 +8960,6 @@ def test_test_iam_permissions_routing_parameters_request_2_grpc(): request_msg = iam_policy_pb2.TestIamPermissionsRequest( **{"resource": "projects/sample1/buckets/sample2/objects/sample3"} ) - assert args[0] == request_msg expected_headers = {"bucket": "projects/sample1/buckets/sample2"} @@ -8981,7 +8991,6 @@ def test_test_iam_permissions_routing_parameters_request_3_grpc(): request_msg = iam_policy_pb2.TestIamPermissionsRequest( **{"resource": "projects/sample1/buckets/sample2/managedFolders/sample3"} ) - assert args[0] == request_msg expected_headers = {"bucket": "projects/sample1/buckets/sample2"} @@ -9005,7 +9014,6 @@ def test_update_bucket_routing_parameters_request_1_grpc(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = storage.UpdateBucketRequest(**{"bucket": {"name": "sample1"}}) - assert args[0] == request_msg expected_headers = {"bucket": "sample1"} @@ -9031,7 +9039,6 @@ def test_compose_object_routing_parameters_request_1_grpc(): request_msg = storage.ComposeObjectRequest( **{"destination": {"bucket": "sample1"}} ) - assert args[0] == request_msg expected_headers = {"bucket": "sample1"} @@ -9055,7 +9062,6 @@ def test_delete_object_routing_parameters_request_1_grpc(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = storage.DeleteObjectRequest(**{"bucket": "sample1"}) - assert args[0] == request_msg expected_headers = {"bucket": "sample1"} @@ -9079,7 +9085,6 @@ def test_restore_object_routing_parameters_request_1_grpc(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = storage.RestoreObjectRequest(**{"bucket": "sample1"}) - assert args[0] == request_msg expected_headers = {"bucket": "sample1"} @@ -9109,7 +9114,6 @@ def test_cancel_resumable_write_routing_parameters_request_1_grpc(): request_msg = storage.CancelResumableWriteRequest( **{"upload_id": "projects/sample1/buckets/sample2/sample3"} ) - assert args[0] == request_msg expected_headers = {"bucket": "projects/sample1/buckets/sample2"} @@ -9133,7 +9137,6 @@ def test_get_object_routing_parameters_request_1_grpc(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = storage.GetObjectRequest(**{"bucket": "sample1"}) - assert args[0] == request_msg expected_headers = {"bucket": "sample1"} @@ -9157,7 +9160,6 @@ def test_read_object_routing_parameters_request_1_grpc(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = storage.ReadObjectRequest(**{"bucket": "sample1"}) - assert args[0] == request_msg expected_headers = {"bucket": "sample1"} @@ -9181,7 +9183,6 @@ def test_update_object_routing_parameters_request_1_grpc(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = storage.UpdateObjectRequest(**{"object": {"bucket": "sample1"}}) - assert args[0] == request_msg expected_headers = {"bucket": "sample1"} @@ -9205,7 +9206,6 @@ def test_list_objects_routing_parameters_request_1_grpc(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = storage.ListObjectsRequest(**{"parent": "sample1"}) - assert args[0] == request_msg expected_headers = {"bucket": "sample1"} @@ -9229,7 +9229,6 @@ def test_rewrite_object_routing_parameters_request_1_grpc(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = storage.RewriteObjectRequest(**{"source_bucket": "sample1"}) - assert args[0] == request_msg expected_headers = {"source_bucket": "sample1"} @@ -9253,7 +9252,6 @@ def test_rewrite_object_routing_parameters_request_2_grpc(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = storage.RewriteObjectRequest(**{"destination_bucket": "sample1"}) - assert args[0] == request_msg expected_headers = {"bucket": "sample1"} @@ -9283,7 +9281,6 @@ def test_start_resumable_write_routing_parameters_request_1_grpc(): request_msg = storage.StartResumableWriteRequest( **{"write_object_spec": {"resource": {"bucket": "sample1"}}} ) - assert args[0] == request_msg expected_headers = {"bucket": "sample1"} @@ -9313,7 +9310,6 @@ def test_query_write_status_routing_parameters_request_1_grpc(): request_msg = storage.QueryWriteStatusRequest( **{"upload_id": "projects/sample1/buckets/sample2/sample3"} ) - assert args[0] == request_msg expected_headers = {"bucket": "projects/sample1/buckets/sample2"} @@ -9337,7 +9333,6 @@ def test_move_object_routing_parameters_request_1_grpc(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = storage.MoveObjectRequest(**{"bucket": "sample1"}) - assert args[0] == request_msg expected_headers = {"bucket": "sample1"} @@ -9379,7 +9374,6 @@ async def test_delete_bucket_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage.DeleteBucketRequest() - assert args[0] == request_msg @@ -9416,7 +9410,6 @@ async def test_get_bucket_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage.GetBucketRequest() - assert args[0] == request_msg @@ -9453,7 +9446,6 @@ async def test_create_bucket_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage.CreateBucketRequest() - assert args[0] == request_msg @@ -9481,7 +9473,6 @@ async def test_list_buckets_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage.ListBucketsRequest() - assert args[0] == request_msg @@ -9520,7 +9511,6 @@ async def test_lock_bucket_retention_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage.LockBucketRetentionPolicyRequest() - assert args[0] == request_msg @@ -9548,7 +9538,6 @@ async def test_get_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -9576,7 +9565,6 @@ async def test_set_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -9605,7 +9593,6 @@ async def test_test_iam_permissions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -9642,7 +9629,6 @@ async def test_update_bucket_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage.UpdateBucketRequest() - assert args[0] == request_msg @@ -9685,7 +9671,6 @@ async def test_compose_object_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage.ComposeObjectRequest() - assert args[0] == request_msg @@ -9708,7 +9693,6 @@ async def test_delete_object_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage.DeleteObjectRequest() - assert args[0] == request_msg @@ -9751,7 +9735,6 @@ async def test_restore_object_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage.RestoreObjectRequest() - assert args[0] == request_msg @@ -9778,7 +9761,6 @@ async def test_cancel_resumable_write_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage.CancelResumableWriteRequest() - assert args[0] == request_msg @@ -9821,7 +9803,6 @@ async def test_get_object_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage.GetObjectRequest() - assert args[0] == request_msg @@ -9847,7 +9828,6 @@ async def test_read_object_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage.ReadObjectRequest() - assert args[0] == request_msg @@ -9890,7 +9870,6 @@ async def test_update_object_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage.UpdateObjectRequest() - assert args[0] == request_msg @@ -9918,7 +9897,6 @@ async def test_list_objects_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage.ListObjectsRequest() - assert args[0] == request_msg @@ -9948,7 +9926,6 @@ async def test_rewrite_object_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage.RewriteObjectRequest() - assert args[0] == request_msg @@ -9977,7 +9954,6 @@ async def test_start_resumable_write_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage.StartResumableWriteRequest() - assert args[0] == request_msg @@ -10004,7 +9980,6 @@ async def test_query_write_status_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage.QueryWriteStatusRequest() - assert args[0] == request_msg @@ -10047,7 +10022,6 @@ async def test_move_object_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage.MoveObjectRequest() - assert args[0] == request_msg @@ -10068,7 +10042,6 @@ async def test_delete_bucket_routing_parameters_request_1_grpc_asyncio(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = storage.DeleteBucketRequest(**{"name": "sample1"}) - assert args[0] == request_msg expected_headers = {"bucket": "sample1"} @@ -10108,7 +10081,6 @@ async def test_get_bucket_routing_parameters_request_1_grpc_asyncio(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = storage.GetBucketRequest(**{"name": "sample1"}) - assert args[0] == request_msg expected_headers = {"bucket": "sample1"} @@ -10148,7 +10120,6 @@ async def test_create_bucket_routing_parameters_request_1_grpc_asyncio(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = storage.CreateBucketRequest(**{"parent": "sample1"}) - assert args[0] == request_msg expected_headers = {"project": "sample1"} @@ -10188,7 +10159,6 @@ async def test_create_bucket_routing_parameters_request_2_grpc_asyncio(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = storage.CreateBucketRequest(**{"bucket": {"project": "sample1"}}) - assert args[0] == request_msg expected_headers = {"project": "sample1"} @@ -10219,7 +10189,6 @@ async def test_list_buckets_routing_parameters_request_1_grpc_asyncio(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = storage.ListBucketsRequest(**{"parent": "sample1"}) - assert args[0] == request_msg expected_headers = {"project": "sample1"} @@ -10261,7 +10230,6 @@ async def test_lock_bucket_retention_policy_routing_parameters_request_1_grpc_as call.assert_called() _, args, kw = call.mock_calls[0] request_msg = storage.LockBucketRetentionPolicyRequest(**{"bucket": "sample1"}) - assert args[0] == request_msg expected_headers = {"bucket": "sample1"} @@ -10292,7 +10260,6 @@ async def test_get_iam_policy_routing_parameters_request_1_grpc_asyncio(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest(**{"resource": "sample1"}) - assert args[0] == request_msg expected_headers = {"bucket": "sample1"} @@ -10327,7 +10294,6 @@ async def test_get_iam_policy_routing_parameters_request_2_grpc_asyncio(): request_msg = iam_policy_pb2.GetIamPolicyRequest( **{"resource": "projects/sample1/buckets/sample2/sample3"} ) - assert args[0] == request_msg expected_headers = {"bucket": "projects/sample1/buckets/sample2"} @@ -10358,7 +10324,6 @@ async def test_set_iam_policy_routing_parameters_request_1_grpc_asyncio(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest(**{"resource": "sample1"}) - assert args[0] == request_msg expected_headers = {"bucket": "sample1"} @@ -10393,7 +10358,6 @@ async def test_set_iam_policy_routing_parameters_request_2_grpc_asyncio(): request_msg = iam_policy_pb2.SetIamPolicyRequest( **{"resource": "projects/sample1/buckets/sample2/sample3"} ) - assert args[0] == request_msg expected_headers = {"bucket": "projects/sample1/buckets/sample2"} @@ -10427,7 +10391,6 @@ async def test_test_iam_permissions_routing_parameters_request_1_grpc_asyncio(): request_msg = iam_policy_pb2.TestIamPermissionsRequest( **{"resource": "sample1"} ) - assert args[0] == request_msg expected_headers = {"bucket": "sample1"} @@ -10463,7 +10426,6 @@ async def test_test_iam_permissions_routing_parameters_request_2_grpc_asyncio(): request_msg = iam_policy_pb2.TestIamPermissionsRequest( **{"resource": "projects/sample1/buckets/sample2/objects/sample3"} ) - assert args[0] == request_msg expected_headers = {"bucket": "projects/sample1/buckets/sample2"} @@ -10501,7 +10463,6 @@ async def test_test_iam_permissions_routing_parameters_request_3_grpc_asyncio(): request_msg = iam_policy_pb2.TestIamPermissionsRequest( **{"resource": "projects/sample1/buckets/sample2/managedFolders/sample3"} ) - assert args[0] == request_msg expected_headers = {"bucket": "projects/sample1/buckets/sample2"} @@ -10541,7 +10502,6 @@ async def test_update_bucket_routing_parameters_request_1_grpc_asyncio(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = storage.UpdateBucketRequest(**{"bucket": {"name": "sample1"}}) - assert args[0] == request_msg expected_headers = {"bucket": "sample1"} @@ -10589,7 +10549,6 @@ async def test_compose_object_routing_parameters_request_1_grpc_asyncio(): request_msg = storage.ComposeObjectRequest( **{"destination": {"bucket": "sample1"}} ) - assert args[0] == request_msg expected_headers = {"bucket": "sample1"} @@ -10615,7 +10574,6 @@ async def test_delete_object_routing_parameters_request_1_grpc_asyncio(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = storage.DeleteObjectRequest(**{"bucket": "sample1"}) - assert args[0] == request_msg expected_headers = {"bucket": "sample1"} @@ -10661,7 +10619,6 @@ async def test_restore_object_routing_parameters_request_1_grpc_asyncio(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = storage.RestoreObjectRequest(**{"bucket": "sample1"}) - assert args[0] == request_msg expected_headers = {"bucket": "sample1"} @@ -10695,7 +10652,6 @@ async def test_cancel_resumable_write_routing_parameters_request_1_grpc_asyncio( request_msg = storage.CancelResumableWriteRequest( **{"upload_id": "projects/sample1/buckets/sample2/sample3"} ) - assert args[0] == request_msg expected_headers = {"bucket": "projects/sample1/buckets/sample2"} @@ -10741,7 +10697,6 @@ async def test_get_object_routing_parameters_request_1_grpc_asyncio(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = storage.GetObjectRequest(**{"bucket": "sample1"}) - assert args[0] == request_msg expected_headers = {"bucket": "sample1"} @@ -10770,7 +10725,6 @@ async def test_read_object_routing_parameters_request_1_grpc_asyncio(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = storage.ReadObjectRequest(**{"bucket": "sample1"}) - assert args[0] == request_msg expected_headers = {"bucket": "sample1"} @@ -10816,7 +10770,6 @@ async def test_update_object_routing_parameters_request_1_grpc_asyncio(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = storage.UpdateObjectRequest(**{"object": {"bucket": "sample1"}}) - assert args[0] == request_msg expected_headers = {"bucket": "sample1"} @@ -10847,7 +10800,6 @@ async def test_list_objects_routing_parameters_request_1_grpc_asyncio(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = storage.ListObjectsRequest(**{"parent": "sample1"}) - assert args[0] == request_msg expected_headers = {"bucket": "sample1"} @@ -10880,7 +10832,6 @@ async def test_rewrite_object_routing_parameters_request_1_grpc_asyncio(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = storage.RewriteObjectRequest(**{"source_bucket": "sample1"}) - assert args[0] == request_msg expected_headers = {"source_bucket": "sample1"} @@ -10913,7 +10864,6 @@ async def test_rewrite_object_routing_parameters_request_2_grpc_asyncio(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = storage.RewriteObjectRequest(**{"destination_bucket": "sample1"}) - assert args[0] == request_msg expected_headers = {"bucket": "sample1"} @@ -10949,7 +10899,6 @@ async def test_start_resumable_write_routing_parameters_request_1_grpc_asyncio() request_msg = storage.StartResumableWriteRequest( **{"write_object_spec": {"resource": {"bucket": "sample1"}}} ) - assert args[0] == request_msg expected_headers = {"bucket": "sample1"} @@ -10983,7 +10932,6 @@ async def test_query_write_status_routing_parameters_request_1_grpc_asyncio(): request_msg = storage.QueryWriteStatusRequest( **{"upload_id": "projects/sample1/buckets/sample2/sample3"} ) - assert args[0] == request_msg expected_headers = {"bucket": "projects/sample1/buckets/sample2"} @@ -11029,7 +10977,6 @@ async def test_move_object_routing_parameters_request_1_grpc_asyncio(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = storage.MoveObjectRequest(**{"bucket": "sample1"}) - assert args[0] == request_msg expected_headers = {"bucket": "sample1"} diff --git a/packages/google-cloud-storagebatchoperations/noxfile.py b/packages/google-cloud-storagebatchoperations/noxfile.py index 5b4633f92e4b..dbd49e2ac733 100644 --- a/packages/google-cloud-storagebatchoperations/noxfile.py +++ b/packages/google-cloud-storagebatchoperations/noxfile.py @@ -47,7 +47,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 = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-storagebatchoperations/setup.py b/packages/google-cloud-storagebatchoperations/setup.py index bbcea3862089..a56b82d620e2 100644 --- a/packages/google-cloud-storagebatchoperations/setup.py +++ b/packages/google-cloud-storagebatchoperations/setup.py @@ -45,7 +45,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/google-cloud-storagebatchoperations/testing/constraints-3.10.txt b/packages/google-cloud-storagebatchoperations/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-storagebatchoperations/testing/constraints-3.10.txt +++ b/packages/google-cloud-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 diff --git a/packages/google-cloud-storagebatchoperations/tests/unit/gapic/storagebatchoperations_v1/test_storage_batch_operations.py b/packages/google-cloud-storagebatchoperations/tests/unit/gapic/storagebatchoperations_v1/test_storage_batch_operations.py index 52b8c76f580b..0514513dcc96 100644 --- a/packages/google-cloud-storagebatchoperations/tests/unit/gapic/storagebatchoperations_v1/test_storage_batch_operations.py +++ b/packages/google-cloud-storagebatchoperations/tests/unit/gapic/storagebatchoperations_v1/test_storage_batch_operations.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 @@ -118,6 +119,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" @@ -1387,8 +1403,8 @@ def test_storage_batch_operations_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - storage_batch_operations.ListJobsRequest, - dict, + storage_batch_operations.ListJobsRequest(), + {}, ], ) def test_list_jobs(request_type, transport: str = "grpc"): @@ -1399,7 +1415,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(type(client.transport.list_jobs), "__call__") as call: @@ -1448,12 +1464,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(): @@ -1532,10 +1549,14 @@ async def test_list_jobs_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @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, @@ -1543,7 +1564,7 @@ async def test_list_jobs_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_jobs), "__call__") as call: @@ -1568,11 +1589,6 @@ async def test_list_jobs_async( 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(), @@ -1909,8 +1925,8 @@ async def test_list_jobs_async_pages(): @pytest.mark.parametrize( "request_type", [ - storage_batch_operations.GetJobRequest, - dict, + storage_batch_operations.GetJobRequest(), + {}, ], ) def test_get_job(request_type, transport: str = "grpc"): @@ -1921,7 +1937,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(type(client.transport.get_job), "__call__") as call: @@ -1973,9 +1989,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(): @@ -2054,9 +2071,14 @@ async def test_get_job_async_use_cached_wrapped_rpc(transport: str = "grpc_async @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, @@ -2064,7 +2086,7 @@ async def test_get_job_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_job), "__call__") as call: @@ -2095,11 +2117,6 @@ async def test_get_job_async( 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(), @@ -2246,8 +2263,8 @@ async def test_get_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - storage_batch_operations.CreateJobRequest, - dict, + storage_batch_operations.CreateJobRequest(), + {}, ], ) def test_create_job(request_type, transport: str = "grpc"): @@ -2258,7 +2275,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() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_job), "__call__") as call: @@ -2300,10 +2317,11 @@ def test_create_job_non_empty_request_with_auto_populated_field(): client.create_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == storage_batch_operations.CreateJobRequest( + request_msg = storage_batch_operations.CreateJobRequest( parent="parent_value", job_id="job_id_value", ) + assert args[0] == request_msg def test_create_job_use_cached_wrapped_rpc(): @@ -2392,10 +2410,14 @@ async def test_create_job_async_use_cached_wrapped_rpc(transport: str = "grpc_as @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(), + {}, + ], +) +async def test_create_job_async(request_type, transport: str = "grpc_asyncio"): client = StorageBatchOperationsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2403,7 +2425,7 @@ async def test_create_job_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_job), "__call__") as call: @@ -2423,11 +2445,6 @@ async def test_create_job_async( 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(), @@ -2594,8 +2611,8 @@ async def test_create_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - storage_batch_operations.DeleteJobRequest, - dict, + storage_batch_operations.DeleteJobRequest(), + {}, ], ) def test_delete_job(request_type, transport: str = "grpc"): @@ -2606,7 +2623,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() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_job), "__call__") as call: @@ -2647,9 +2664,10 @@ def test_delete_job_non_empty_request_with_auto_populated_field(): client.delete_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == storage_batch_operations.DeleteJobRequest( + request_msg = storage_batch_operations.DeleteJobRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_job_use_cached_wrapped_rpc(): @@ -2728,10 +2746,14 @@ async def test_delete_job_async_use_cached_wrapped_rpc(transport: str = "grpc_as @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(), + {}, + ], +) +async def test_delete_job_async(request_type, transport: str = "grpc_asyncio"): client = StorageBatchOperationsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2739,7 +2761,7 @@ async def test_delete_job_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_job), "__call__") as call: @@ -2757,11 +2779,6 @@ async def test_delete_job_async( 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(), @@ -2904,8 +2921,8 @@ async def test_delete_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - storage_batch_operations.CancelJobRequest, - dict, + storage_batch_operations.CancelJobRequest(), + {}, ], ) def test_cancel_job(request_type, transport: str = "grpc"): @@ -2916,7 +2933,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() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.cancel_job), "__call__") as call: @@ -2957,9 +2974,10 @@ def test_cancel_job_non_empty_request_with_auto_populated_field(): client.cancel_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == storage_batch_operations.CancelJobRequest( + request_msg = storage_batch_operations.CancelJobRequest( name="name_value", ) + assert args[0] == request_msg def test_cancel_job_use_cached_wrapped_rpc(): @@ -3038,10 +3056,14 @@ async def test_cancel_job_async_use_cached_wrapped_rpc(transport: str = "grpc_as @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(), + {}, + ], +) +async def test_cancel_job_async(request_type, transport: str = "grpc_asyncio"): client = StorageBatchOperationsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3049,7 +3071,7 @@ async def test_cancel_job_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.cancel_job), "__call__") as call: @@ -3069,11 +3091,6 @@ async def test_cancel_job_async( 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(), @@ -3220,8 +3237,8 @@ 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"): @@ -3232,7 +3249,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( @@ -3285,12 +3302,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(): @@ -3376,9 +3394,15 @@ async def test_list_bucket_operations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + storage_batch_operations.ListBucketOperationsRequest(), + {}, + ], +) async def test_list_bucket_operations_async( - transport: str = "grpc_asyncio", - request_type=storage_batch_operations.ListBucketOperationsRequest, + request_type, transport: str = "grpc_asyncio" ): client = StorageBatchOperationsAsyncClient( credentials=async_anonymous_credentials(), @@ -3387,7 +3411,7 @@ async def test_list_bucket_operations_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( @@ -3414,11 +3438,6 @@ async def test_list_bucket_operations_async( 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(), @@ -3777,8 +3796,8 @@ async def test_list_bucket_operations_async_pages(): @pytest.mark.parametrize( "request_type", [ - storage_batch_operations.GetBucketOperationRequest, - dict, + storage_batch_operations.GetBucketOperationRequest(), + {}, ], ) def test_get_bucket_operation(request_type, transport: str = "grpc"): @@ -3789,7 +3808,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( @@ -3841,9 +3860,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(): @@ -3928,9 +3948,15 @@ async def test_get_bucket_operation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + storage_batch_operations.GetBucketOperationRequest(), + {}, + ], +) async def test_get_bucket_operation_async( - transport: str = "grpc_asyncio", - request_type=storage_batch_operations.GetBucketOperationRequest, + request_type, transport: str = "grpc_asyncio" ): client = StorageBatchOperationsAsyncClient( credentials=async_anonymous_credentials(), @@ -3939,7 +3965,7 @@ async def test_get_bucket_operation_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( @@ -3968,11 +3994,6 @@ async def test_get_bucket_operation_async( 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(), @@ -5723,7 +5744,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 @@ -5744,7 +5764,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 @@ -5765,7 +5784,6 @@ def test_create_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage_batch_operations.CreateJobRequest() - assert args[0] == request_msg @@ -5786,7 +5804,6 @@ def test_delete_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage_batch_operations.DeleteJobRequest() - assert args[0] == request_msg @@ -5807,7 +5824,6 @@ def test_cancel_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage_batch_operations.CancelJobRequest() - assert args[0] == request_msg @@ -5830,7 +5846,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 @@ -5853,7 +5868,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 @@ -5895,7 +5909,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 @@ -5926,7 +5939,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 @@ -5951,7 +5963,6 @@ async def test_create_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage_batch_operations.CreateJobRequest() - assert args[0] == request_msg @@ -5974,7 +5985,6 @@ async def test_delete_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage_batch_operations.DeleteJobRequest() - assert args[0] == request_msg @@ -5999,7 +6009,6 @@ async def test_cancel_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage_batch_operations.CancelJobRequest() - assert args[0] == request_msg @@ -6029,7 +6038,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 @@ -6060,7 +6068,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 @@ -7540,7 +7547,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 @@ -7560,7 +7566,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 @@ -7580,7 +7585,6 @@ def test_create_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage_batch_operations.CreateJobRequest() - assert args[0] == request_msg @@ -7600,7 +7604,6 @@ def test_delete_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage_batch_operations.DeleteJobRequest() - assert args[0] == request_msg @@ -7620,7 +7623,6 @@ def test_cancel_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storage_batch_operations.CancelJobRequest() - assert args[0] == request_msg @@ -7642,7 +7644,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 @@ -7664,7 +7665,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 diff --git a/packages/google-cloud-storageinsights/noxfile.py b/packages/google-cloud-storageinsights/noxfile.py index 14c62e140926..dfe9e473684a 100644 --- a/packages/google-cloud-storageinsights/noxfile.py +++ b/packages/google-cloud-storageinsights/noxfile.py @@ -47,7 +47,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-storageinsights" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-storageinsights/setup.py b/packages/google-cloud-storageinsights/setup.py index 35fe1a388be8..875651f634a5 100644 --- a/packages/google-cloud-storageinsights/setup.py +++ b/packages/google-cloud-storageinsights/setup.py @@ -45,7 +45,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/google-cloud-storageinsights/testing/constraints-3.10.txt b/packages/google-cloud-storageinsights/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-storageinsights/testing/constraints-3.10.txt +++ b/packages/google-cloud-storageinsights/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-storageinsights/tests/unit/gapic/storageinsights_v1/test_storage_insights.py b/packages/google-cloud-storageinsights/tests/unit/gapic/storageinsights_v1/test_storage_insights.py index 26a0c64f22a5..cabc75762e43 100644 --- a/packages/google-cloud-storageinsights/tests/unit/gapic/storageinsights_v1/test_storage_insights.py +++ b/packages/google-cloud-storageinsights/tests/unit/gapic/storageinsights_v1/test_storage_insights.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 @@ -120,6 +121,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" @@ -1347,8 +1363,8 @@ def test_storage_insights_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - storageinsights.ListReportConfigsRequest, - dict, + storageinsights.ListReportConfigsRequest(), + {}, ], ) def test_list_report_configs(request_type, transport: str = "grpc"): @@ -1359,7 +1375,7 @@ def test_list_report_configs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1412,12 +1428,13 @@ def test_list_report_configs_non_empty_request_with_auto_populated_field(): client.list_report_configs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == storageinsights.ListReportConfigsRequest( + request_msg = storageinsights.ListReportConfigsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_report_configs_use_cached_wrapped_rpc(): @@ -1502,10 +1519,14 @@ async def test_list_report_configs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_report_configs_async( - transport: str = "grpc_asyncio", - request_type=storageinsights.ListReportConfigsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + storageinsights.ListReportConfigsRequest(), + {}, + ], +) +async def test_list_report_configs_async(request_type, transport: str = "grpc_asyncio"): client = StorageInsightsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1513,7 +1534,7 @@ async def test_list_report_configs_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( @@ -1540,11 +1561,6 @@ async def test_list_report_configs_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_report_configs_async_from_dict(): - await test_list_report_configs_async(request_type=dict) - - def test_list_report_configs_field_headers(): client = StorageInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1897,8 +1913,8 @@ async def test_list_report_configs_async_pages(): @pytest.mark.parametrize( "request_type", [ - storageinsights.GetReportConfigRequest, - dict, + storageinsights.GetReportConfigRequest(), + {}, ], ) def test_get_report_config(request_type, transport: str = "grpc"): @@ -1909,7 +1925,7 @@ def test_get_report_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( @@ -1959,9 +1975,10 @@ def test_get_report_config_non_empty_request_with_auto_populated_field(): client.get_report_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == storageinsights.GetReportConfigRequest( + request_msg = storageinsights.GetReportConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_report_config_use_cached_wrapped_rpc(): @@ -2044,9 +2061,14 @@ async def test_get_report_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_report_config_async( - transport: str = "grpc_asyncio", request_type=storageinsights.GetReportConfigRequest -): +@pytest.mark.parametrize( + "request_type", + [ + storageinsights.GetReportConfigRequest(), + {}, + ], +) +async def test_get_report_config_async(request_type, transport: str = "grpc_asyncio"): client = StorageInsightsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2054,7 +2076,7 @@ async def test_get_report_config_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( @@ -2081,11 +2103,6 @@ async def test_get_report_config_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_get_report_config_async_from_dict(): - await test_get_report_config_async(request_type=dict) - - def test_get_report_config_field_headers(): client = StorageInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2240,8 +2257,8 @@ async def test_get_report_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - storageinsights.CreateReportConfigRequest, - dict, + storageinsights.CreateReportConfigRequest(), + {}, ], ) def test_create_report_config(request_type, transport: str = "grpc"): @@ -2252,7 +2269,7 @@ def test_create_report_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( @@ -2303,10 +2320,11 @@ def test_create_report_config_non_empty_request_with_auto_populated_field(): client.create_report_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == storageinsights.CreateReportConfigRequest( + request_msg = storageinsights.CreateReportConfigRequest( parent="parent_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_report_config_use_cached_wrapped_rpc(): @@ -2391,9 +2409,15 @@ async def test_create_report_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + storageinsights.CreateReportConfigRequest(), + {}, + ], +) async def test_create_report_config_async( - transport: str = "grpc_asyncio", - request_type=storageinsights.CreateReportConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = StorageInsightsAsyncClient( credentials=async_anonymous_credentials(), @@ -2402,7 +2426,7 @@ async def test_create_report_config_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( @@ -2429,11 +2453,6 @@ async def test_create_report_config_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_create_report_config_async_from_dict(): - await test_create_report_config_async(request_type=dict) - - def test_create_report_config_field_headers(): client = StorageInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2598,8 +2617,8 @@ async def test_create_report_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - storageinsights.UpdateReportConfigRequest, - dict, + storageinsights.UpdateReportConfigRequest(), + {}, ], ) def test_update_report_config(request_type, transport: str = "grpc"): @@ -2610,7 +2629,7 @@ def test_update_report_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( @@ -2660,9 +2679,10 @@ def test_update_report_config_non_empty_request_with_auto_populated_field(): client.update_report_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == storageinsights.UpdateReportConfigRequest( + request_msg = storageinsights.UpdateReportConfigRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_report_config_use_cached_wrapped_rpc(): @@ -2747,9 +2767,15 @@ async def test_update_report_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + storageinsights.UpdateReportConfigRequest(), + {}, + ], +) async def test_update_report_config_async( - transport: str = "grpc_asyncio", - request_type=storageinsights.UpdateReportConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = StorageInsightsAsyncClient( credentials=async_anonymous_credentials(), @@ -2758,7 +2784,7 @@ async def test_update_report_config_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( @@ -2785,11 +2811,6 @@ async def test_update_report_config_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_update_report_config_async_from_dict(): - await test_update_report_config_async(request_type=dict) - - def test_update_report_config_field_headers(): client = StorageInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2954,8 +2975,8 @@ async def test_update_report_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - storageinsights.DeleteReportConfigRequest, - dict, + storageinsights.DeleteReportConfigRequest(), + {}, ], ) def test_delete_report_config(request_type, transport: str = "grpc"): @@ -2966,7 +2987,7 @@ def test_delete_report_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( @@ -3012,10 +3033,11 @@ def test_delete_report_config_non_empty_request_with_auto_populated_field(): client.delete_report_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == storageinsights.DeleteReportConfigRequest( + request_msg = storageinsights.DeleteReportConfigRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_report_config_use_cached_wrapped_rpc(): @@ -3100,9 +3122,15 @@ async def test_delete_report_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + storageinsights.DeleteReportConfigRequest(), + {}, + ], +) async def test_delete_report_config_async( - transport: str = "grpc_asyncio", - request_type=storageinsights.DeleteReportConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = StorageInsightsAsyncClient( credentials=async_anonymous_credentials(), @@ -3111,7 +3139,7 @@ async def test_delete_report_config_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( @@ -3131,11 +3159,6 @@ async def test_delete_report_config_async( assert response is None -@pytest.mark.asyncio -async def test_delete_report_config_async_from_dict(): - await test_delete_report_config_async(request_type=dict) - - def test_delete_report_config_field_headers(): client = StorageInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3286,8 +3309,8 @@ async def test_delete_report_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - storageinsights.ListReportDetailsRequest, - dict, + storageinsights.ListReportDetailsRequest(), + {}, ], ) def test_list_report_details(request_type, transport: str = "grpc"): @@ -3298,7 +3321,7 @@ def test_list_report_details(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,12 +3374,13 @@ def test_list_report_details_non_empty_request_with_auto_populated_field(): client.list_report_details(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == storageinsights.ListReportDetailsRequest( + request_msg = storageinsights.ListReportDetailsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_report_details_use_cached_wrapped_rpc(): @@ -3441,10 +3465,14 @@ async def test_list_report_details_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_report_details_async( - transport: str = "grpc_asyncio", - request_type=storageinsights.ListReportDetailsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + storageinsights.ListReportDetailsRequest(), + {}, + ], +) +async def test_list_report_details_async(request_type, transport: str = "grpc_asyncio"): client = StorageInsightsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3452,7 +3480,7 @@ async def test_list_report_details_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( @@ -3479,11 +3507,6 @@ async def test_list_report_details_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_report_details_async_from_dict(): - await test_list_report_details_async(request_type=dict) - - def test_list_report_details_field_headers(): client = StorageInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3836,8 +3859,8 @@ async def test_list_report_details_async_pages(): @pytest.mark.parametrize( "request_type", [ - storageinsights.GetReportDetailRequest, - dict, + storageinsights.GetReportDetailRequest(), + {}, ], ) def test_get_report_detail(request_type, transport: str = "grpc"): @@ -3848,7 +3871,7 @@ def test_get_report_detail(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3900,9 +3923,10 @@ def test_get_report_detail_non_empty_request_with_auto_populated_field(): client.get_report_detail(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == storageinsights.GetReportDetailRequest( + request_msg = storageinsights.GetReportDetailRequest( name="name_value", ) + assert args[0] == request_msg def test_get_report_detail_use_cached_wrapped_rpc(): @@ -3985,9 +4009,14 @@ async def test_get_report_detail_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_report_detail_async( - transport: str = "grpc_asyncio", request_type=storageinsights.GetReportDetailRequest -): +@pytest.mark.parametrize( + "request_type", + [ + storageinsights.GetReportDetailRequest(), + {}, + ], +) +async def test_get_report_detail_async(request_type, transport: str = "grpc_asyncio"): client = StorageInsightsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3995,7 +4024,7 @@ async def test_get_report_detail_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( @@ -4024,11 +4053,6 @@ async def test_get_report_detail_async( assert response.shards_count == 1293 -@pytest.mark.asyncio -async def test_get_report_detail_async_from_dict(): - await test_get_report_detail_async(request_type=dict) - - def test_get_report_detail_field_headers(): client = StorageInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4183,8 +4207,8 @@ async def test_get_report_detail_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - storageinsights.ListDatasetConfigsRequest, - dict, + storageinsights.ListDatasetConfigsRequest(), + {}, ], ) def test_list_dataset_configs(request_type, transport: str = "grpc"): @@ -4195,7 +4219,7 @@ def test_list_dataset_configs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,12 +4272,13 @@ def test_list_dataset_configs_non_empty_request_with_auto_populated_field(): client.list_dataset_configs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == storageinsights.ListDatasetConfigsRequest( + request_msg = storageinsights.ListDatasetConfigsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_dataset_configs_use_cached_wrapped_rpc(): @@ -4338,9 +4363,15 @@ async def test_list_dataset_configs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + storageinsights.ListDatasetConfigsRequest(), + {}, + ], +) async def test_list_dataset_configs_async( - transport: str = "grpc_asyncio", - request_type=storageinsights.ListDatasetConfigsRequest, + request_type, transport: str = "grpc_asyncio" ): client = StorageInsightsAsyncClient( credentials=async_anonymous_credentials(), @@ -4349,7 +4380,7 @@ async def test_list_dataset_configs_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( @@ -4376,11 +4407,6 @@ async def test_list_dataset_configs_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_dataset_configs_async_from_dict(): - await test_list_dataset_configs_async(request_type=dict) - - def test_list_dataset_configs_field_headers(): client = StorageInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4733,8 +4759,8 @@ async def test_list_dataset_configs_async_pages(): @pytest.mark.parametrize( "request_type", [ - storageinsights.GetDatasetConfigRequest, - dict, + storageinsights.GetDatasetConfigRequest(), + {}, ], ) def test_get_dataset_config(request_type, transport: str = "grpc"): @@ -4745,7 +4771,7 @@ def test_get_dataset_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( @@ -4811,9 +4837,10 @@ def test_get_dataset_config_non_empty_request_with_auto_populated_field(): client.get_dataset_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == storageinsights.GetDatasetConfigRequest( + request_msg = storageinsights.GetDatasetConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_dataset_config_use_cached_wrapped_rpc(): @@ -4898,10 +4925,14 @@ async def test_get_dataset_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_dataset_config_async( - transport: str = "grpc_asyncio", - request_type=storageinsights.GetDatasetConfigRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + storageinsights.GetDatasetConfigRequest(), + {}, + ], +) +async def test_get_dataset_config_async(request_type, transport: str = "grpc_asyncio"): client = StorageInsightsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4909,7 +4940,7 @@ async def test_get_dataset_config_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( @@ -4951,11 +4982,6 @@ async def test_get_dataset_config_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_get_dataset_config_async_from_dict(): - await test_get_dataset_config_async(request_type=dict) - - def test_get_dataset_config_field_headers(): client = StorageInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5110,8 +5136,8 @@ async def test_get_dataset_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - storageinsights.CreateDatasetConfigRequest, - dict, + storageinsights.CreateDatasetConfigRequest(), + {}, ], ) def test_create_dataset_config(request_type, transport: str = "grpc"): @@ -5122,7 +5148,7 @@ def test_create_dataset_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( @@ -5169,11 +5195,12 @@ def test_create_dataset_config_non_empty_request_with_auto_populated_field(): client.create_dataset_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == storageinsights.CreateDatasetConfigRequest( + request_msg = storageinsights.CreateDatasetConfigRequest( parent="parent_value", dataset_config_id="dataset_config_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_dataset_config_use_cached_wrapped_rpc(): @@ -5269,9 +5296,15 @@ async def test_create_dataset_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + storageinsights.CreateDatasetConfigRequest(), + {}, + ], +) async def test_create_dataset_config_async( - transport: str = "grpc_asyncio", - request_type=storageinsights.CreateDatasetConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = StorageInsightsAsyncClient( credentials=async_anonymous_credentials(), @@ -5280,7 +5313,7 @@ async def test_create_dataset_config_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( @@ -5302,11 +5335,6 @@ async def test_create_dataset_config_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_dataset_config_async_from_dict(): - await test_create_dataset_config_async(request_type=dict) - - def test_create_dataset_config_field_headers(): client = StorageInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5481,8 +5509,8 @@ async def test_create_dataset_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - storageinsights.UpdateDatasetConfigRequest, - dict, + storageinsights.UpdateDatasetConfigRequest(), + {}, ], ) def test_update_dataset_config(request_type, transport: str = "grpc"): @@ -5493,7 +5521,7 @@ def test_update_dataset_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( @@ -5538,9 +5566,10 @@ def test_update_dataset_config_non_empty_request_with_auto_populated_field(): client.update_dataset_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == storageinsights.UpdateDatasetConfigRequest( + request_msg = storageinsights.UpdateDatasetConfigRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_dataset_config_use_cached_wrapped_rpc(): @@ -5636,9 +5665,15 @@ async def test_update_dataset_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + storageinsights.UpdateDatasetConfigRequest(), + {}, + ], +) async def test_update_dataset_config_async( - transport: str = "grpc_asyncio", - request_type=storageinsights.UpdateDatasetConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = StorageInsightsAsyncClient( credentials=async_anonymous_credentials(), @@ -5647,7 +5682,7 @@ async def test_update_dataset_config_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( @@ -5669,11 +5704,6 @@ async def test_update_dataset_config_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_dataset_config_async_from_dict(): - await test_update_dataset_config_async(request_type=dict) - - def test_update_dataset_config_field_headers(): client = StorageInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5838,8 +5868,8 @@ async def test_update_dataset_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - storageinsights.DeleteDatasetConfigRequest, - dict, + storageinsights.DeleteDatasetConfigRequest(), + {}, ], ) def test_delete_dataset_config(request_type, transport: str = "grpc"): @@ -5850,7 +5880,7 @@ def test_delete_dataset_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( @@ -5896,10 +5926,11 @@ def test_delete_dataset_config_non_empty_request_with_auto_populated_field(): client.delete_dataset_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == storageinsights.DeleteDatasetConfigRequest( + request_msg = storageinsights.DeleteDatasetConfigRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_dataset_config_use_cached_wrapped_rpc(): @@ -5995,9 +6026,15 @@ async def test_delete_dataset_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + storageinsights.DeleteDatasetConfigRequest(), + {}, + ], +) async def test_delete_dataset_config_async( - transport: str = "grpc_asyncio", - request_type=storageinsights.DeleteDatasetConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = StorageInsightsAsyncClient( credentials=async_anonymous_credentials(), @@ -6006,7 +6043,7 @@ async def test_delete_dataset_config_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( @@ -6028,11 +6065,6 @@ async def test_delete_dataset_config_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_dataset_config_async_from_dict(): - await test_delete_dataset_config_async(request_type=dict) - - def test_delete_dataset_config_field_headers(): client = StorageInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6187,8 +6219,8 @@ async def test_delete_dataset_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - storageinsights.LinkDatasetRequest, - dict, + storageinsights.LinkDatasetRequest(), + {}, ], ) def test_link_dataset(request_type, transport: str = "grpc"): @@ -6199,7 +6231,7 @@ def test_link_dataset(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.link_dataset), "__call__") as call: @@ -6240,9 +6272,10 @@ def test_link_dataset_non_empty_request_with_auto_populated_field(): client.link_dataset(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == storageinsights.LinkDatasetRequest( + request_msg = storageinsights.LinkDatasetRequest( name="name_value", ) + assert args[0] == request_msg def test_link_dataset_use_cached_wrapped_rpc(): @@ -6333,9 +6366,14 @@ async def test_link_dataset_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_link_dataset_async( - transport: str = "grpc_asyncio", request_type=storageinsights.LinkDatasetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + storageinsights.LinkDatasetRequest(), + {}, + ], +) +async def test_link_dataset_async(request_type, transport: str = "grpc_asyncio"): client = StorageInsightsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6343,7 +6381,7 @@ async def test_link_dataset_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.link_dataset), "__call__") as call: @@ -6363,11 +6401,6 @@ async def test_link_dataset_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_link_dataset_async_from_dict(): - await test_link_dataset_async(request_type=dict) - - def test_link_dataset_field_headers(): client = StorageInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6514,8 +6547,8 @@ async def test_link_dataset_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - storageinsights.UnlinkDatasetRequest, - dict, + storageinsights.UnlinkDatasetRequest(), + {}, ], ) def test_unlink_dataset(request_type, transport: str = "grpc"): @@ -6526,7 +6559,7 @@ def test_unlink_dataset(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.unlink_dataset), "__call__") as call: @@ -6567,9 +6600,10 @@ def test_unlink_dataset_non_empty_request_with_auto_populated_field(): client.unlink_dataset(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == storageinsights.UnlinkDatasetRequest( + request_msg = storageinsights.UnlinkDatasetRequest( name="name_value", ) + assert args[0] == request_msg def test_unlink_dataset_use_cached_wrapped_rpc(): @@ -6660,9 +6694,14 @@ async def test_unlink_dataset_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_unlink_dataset_async( - transport: str = "grpc_asyncio", request_type=storageinsights.UnlinkDatasetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + storageinsights.UnlinkDatasetRequest(), + {}, + ], +) +async def test_unlink_dataset_async(request_type, transport: str = "grpc_asyncio"): client = StorageInsightsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6670,7 +6709,7 @@ async def test_unlink_dataset_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.unlink_dataset), "__call__") as call: @@ -6690,11 +6729,6 @@ async def test_unlink_dataset_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_unlink_dataset_async_from_dict(): - await test_unlink_dataset_async(request_type=dict) - - def test_unlink_dataset_field_headers(): client = StorageInsightsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9871,7 +9905,6 @@ def test_list_report_configs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storageinsights.ListReportConfigsRequest() - assert args[0] == request_msg @@ -9894,7 +9927,6 @@ def test_get_report_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storageinsights.GetReportConfigRequest() - assert args[0] == request_msg @@ -9917,7 +9949,6 @@ def test_create_report_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storageinsights.CreateReportConfigRequest() - assert args[0] == request_msg @@ -9940,7 +9971,6 @@ def test_update_report_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storageinsights.UpdateReportConfigRequest() - assert args[0] == request_msg @@ -9963,7 +9993,6 @@ def test_delete_report_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storageinsights.DeleteReportConfigRequest() - assert args[0] == request_msg @@ -9986,7 +10015,6 @@ def test_list_report_details_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storageinsights.ListReportDetailsRequest() - assert args[0] == request_msg @@ -10009,7 +10037,6 @@ def test_get_report_detail_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storageinsights.GetReportDetailRequest() - assert args[0] == request_msg @@ -10032,7 +10059,6 @@ def test_list_dataset_configs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storageinsights.ListDatasetConfigsRequest() - assert args[0] == request_msg @@ -10055,7 +10081,6 @@ def test_get_dataset_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storageinsights.GetDatasetConfigRequest() - assert args[0] == request_msg @@ -10078,7 +10103,6 @@ def test_create_dataset_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storageinsights.CreateDatasetConfigRequest() - assert args[0] == request_msg @@ -10101,7 +10125,6 @@ def test_update_dataset_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storageinsights.UpdateDatasetConfigRequest() - assert args[0] == request_msg @@ -10124,7 +10147,6 @@ def test_delete_dataset_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storageinsights.DeleteDatasetConfigRequest() - assert args[0] == request_msg @@ -10145,7 +10167,6 @@ def test_link_dataset_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storageinsights.LinkDatasetRequest() - assert args[0] == request_msg @@ -10166,7 +10187,6 @@ def test_unlink_dataset_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storageinsights.UnlinkDatasetRequest() - assert args[0] == request_msg @@ -10210,7 +10230,6 @@ async def test_list_report_configs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storageinsights.ListReportConfigsRequest() - assert args[0] == request_msg @@ -10240,7 +10259,6 @@ async def test_get_report_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storageinsights.GetReportConfigRequest() - assert args[0] == request_msg @@ -10270,7 +10288,6 @@ async def test_create_report_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storageinsights.CreateReportConfigRequest() - assert args[0] == request_msg @@ -10300,7 +10317,6 @@ async def test_update_report_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storageinsights.UpdateReportConfigRequest() - assert args[0] == request_msg @@ -10325,7 +10341,6 @@ async def test_delete_report_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storageinsights.DeleteReportConfigRequest() - assert args[0] == request_msg @@ -10355,7 +10370,6 @@ async def test_list_report_details_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storageinsights.ListReportDetailsRequest() - assert args[0] == request_msg @@ -10386,7 +10400,6 @@ async def test_get_report_detail_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storageinsights.GetReportDetailRequest() - assert args[0] == request_msg @@ -10416,7 +10429,6 @@ async def test_list_dataset_configs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storageinsights.ListDatasetConfigsRequest() - assert args[0] == request_msg @@ -10452,7 +10464,6 @@ async def test_get_dataset_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storageinsights.GetDatasetConfigRequest() - assert args[0] == request_msg @@ -10479,7 +10490,6 @@ async def test_create_dataset_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storageinsights.CreateDatasetConfigRequest() - assert args[0] == request_msg @@ -10506,7 +10516,6 @@ async def test_update_dataset_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storageinsights.UpdateDatasetConfigRequest() - assert args[0] == request_msg @@ -10533,7 +10542,6 @@ async def test_delete_dataset_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storageinsights.DeleteDatasetConfigRequest() - assert args[0] == request_msg @@ -10558,7 +10566,6 @@ async def test_link_dataset_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storageinsights.LinkDatasetRequest() - assert args[0] == request_msg @@ -10583,7 +10590,6 @@ async def test_unlink_dataset_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storageinsights.UnlinkDatasetRequest() - assert args[0] == request_msg @@ -13269,7 +13275,6 @@ def test_list_report_configs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storageinsights.ListReportConfigsRequest() - assert args[0] == request_msg @@ -13291,7 +13296,6 @@ def test_get_report_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storageinsights.GetReportConfigRequest() - assert args[0] == request_msg @@ -13313,7 +13317,6 @@ def test_create_report_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storageinsights.CreateReportConfigRequest() - assert args[0] == request_msg @@ -13335,7 +13338,6 @@ def test_update_report_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storageinsights.UpdateReportConfigRequest() - assert args[0] == request_msg @@ -13357,7 +13359,6 @@ def test_delete_report_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storageinsights.DeleteReportConfigRequest() - assert args[0] == request_msg @@ -13379,7 +13380,6 @@ def test_list_report_details_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storageinsights.ListReportDetailsRequest() - assert args[0] == request_msg @@ -13401,7 +13401,6 @@ def test_get_report_detail_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storageinsights.GetReportDetailRequest() - assert args[0] == request_msg @@ -13423,7 +13422,6 @@ def test_list_dataset_configs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storageinsights.ListDatasetConfigsRequest() - assert args[0] == request_msg @@ -13445,7 +13443,6 @@ def test_get_dataset_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storageinsights.GetDatasetConfigRequest() - assert args[0] == request_msg @@ -13467,7 +13464,6 @@ def test_create_dataset_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storageinsights.CreateDatasetConfigRequest() - assert args[0] == request_msg @@ -13489,7 +13485,6 @@ def test_update_dataset_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storageinsights.UpdateDatasetConfigRequest() - assert args[0] == request_msg @@ -13511,7 +13506,6 @@ def test_delete_dataset_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storageinsights.DeleteDatasetConfigRequest() - assert args[0] == request_msg @@ -13531,7 +13525,6 @@ def test_link_dataset_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storageinsights.LinkDatasetRequest() - assert args[0] == request_msg @@ -13551,7 +13544,6 @@ def test_unlink_dataset_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = storageinsights.UnlinkDatasetRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-support/noxfile.py b/packages/google-cloud-support/noxfile.py index 7f65d034be20..f5db58067a57 100644 --- a/packages/google-cloud-support/noxfile.py +++ b/packages/google-cloud-support/noxfile.py @@ -47,7 +47,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-support" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-support/setup.py b/packages/google-cloud-support/setup.py index 755d926aae42..85dacdc67f2b 100644 --- a/packages/google-cloud-support/setup.py +++ b/packages/google-cloud-support/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/google-cloud-support/testing/constraints-3.10.txt b/packages/google-cloud-support/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-support/testing/constraints-3.10.txt +++ b/packages/google-cloud-support/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-support/tests/unit/gapic/support_v2/test_case_attachment_service.py b/packages/google-cloud-support/tests/unit/gapic/support_v2/test_case_attachment_service.py index ef9330c89b23..e785de27e8ca 100644 --- a/packages/google-cloud-support/tests/unit/gapic/support_v2/test_case_attachment_service.py +++ b/packages/google-cloud-support/tests/unit/gapic/support_v2/test_case_attachment_service.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 @@ -108,6 +109,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" @@ -1373,8 +1389,8 @@ def test_case_attachment_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - attachment_service.ListAttachmentsRequest, - dict, + attachment_service.ListAttachmentsRequest(), + {}, ], ) def test_list_attachments(request_type, transport: str = "grpc"): @@ -1385,7 +1401,7 @@ def test_list_attachments(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_attachments), "__call__") as call: @@ -1430,10 +1446,11 @@ def test_list_attachments_non_empty_request_with_auto_populated_field(): client.list_attachments(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == attachment_service.ListAttachmentsRequest( + request_msg = attachment_service.ListAttachmentsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_attachments_use_cached_wrapped_rpc(): @@ -1516,10 +1533,14 @@ async def test_list_attachments_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_attachments_async( - transport: str = "grpc_asyncio", - request_type=attachment_service.ListAttachmentsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + attachment_service.ListAttachmentsRequest(), + {}, + ], +) +async def test_list_attachments_async(request_type, transport: str = "grpc_asyncio"): client = CaseAttachmentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1527,7 +1548,7 @@ async def test_list_attachments_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_attachments), "__call__") as call: @@ -1550,11 +1571,6 @@ async def test_list_attachments_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_attachments_async_from_dict(): - await test_list_attachments_async(request_type=dict) - - def test_list_attachments_field_headers(): client = CaseAttachmentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1891,8 +1907,8 @@ async def test_list_attachments_async_pages(): @pytest.mark.parametrize( "request_type", [ - attachment_service.GetAttachmentRequest, - dict, + attachment_service.GetAttachmentRequest(), + {}, ], ) def test_get_attachment(request_type, transport: str = "grpc"): @@ -1903,7 +1919,7 @@ def test_get_attachment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_attachment), "__call__") as call: @@ -1953,9 +1969,10 @@ def test_get_attachment_non_empty_request_with_auto_populated_field(): client.get_attachment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == attachment_service.GetAttachmentRequest( + request_msg = attachment_service.GetAttachmentRequest( name="name_value", ) + assert args[0] == request_msg def test_get_attachment_use_cached_wrapped_rpc(): @@ -2036,10 +2053,14 @@ async def test_get_attachment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_attachment_async( - transport: str = "grpc_asyncio", - request_type=attachment_service.GetAttachmentRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + attachment_service.GetAttachmentRequest(), + {}, + ], +) +async def test_get_attachment_async(request_type, transport: str = "grpc_asyncio"): client = CaseAttachmentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2047,7 +2068,7 @@ async def test_get_attachment_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_attachment), "__call__") as call: @@ -2076,11 +2097,6 @@ async def test_get_attachment_async( assert response.size_bytes == 1089 -@pytest.mark.asyncio -async def test_get_attachment_async_from_dict(): - await test_get_attachment_async(request_type=dict) - - def test_get_attachment_field_headers(): client = CaseAttachmentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2780,7 +2796,6 @@ def test_list_attachments_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = attachment_service.ListAttachmentsRequest() - assert args[0] == request_msg @@ -2801,7 +2816,6 @@ def test_get_attachment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = attachment_service.GetAttachmentRequest() - assert args[0] == request_msg @@ -2842,7 +2856,6 @@ async def test_list_attachments_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = attachment_service.ListAttachmentsRequest() - assert args[0] == request_msg @@ -2872,7 +2885,6 @@ async def test_get_attachment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = attachment_service.GetAttachmentRequest() - assert args[0] == request_msg @@ -3179,7 +3191,6 @@ def test_list_attachments_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = attachment_service.ListAttachmentsRequest() - assert args[0] == request_msg @@ -3199,7 +3210,6 @@ def test_get_attachment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = attachment_service.GetAttachmentRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-support/tests/unit/gapic/support_v2/test_case_service.py b/packages/google-cloud-support/tests/unit/gapic/support_v2/test_case_service.py index bb199efef02b..9e4040368c6c 100644 --- a/packages/google-cloud-support/tests/unit/gapic/support_v2/test_case_service.py +++ b/packages/google-cloud-support/tests/unit/gapic/support_v2/test_case_service.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 @@ -110,6 +111,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" @@ -1275,8 +1291,8 @@ def test_case_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - case_service.GetCaseRequest, - dict, + case_service.GetCaseRequest(), + {}, ], ) def test_get_case(request_type, transport: str = "grpc"): @@ -1287,7 +1303,7 @@ def test_get_case(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_case), "__call__") as call: @@ -1351,9 +1367,10 @@ def test_get_case_non_empty_request_with_auto_populated_field(): client.get_case(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == case_service.GetCaseRequest( + request_msg = case_service.GetCaseRequest( name="name_value", ) + assert args[0] == request_msg def test_get_case_use_cached_wrapped_rpc(): @@ -1432,9 +1449,14 @@ async def test_get_case_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn @pytest.mark.asyncio -async def test_get_case_async( - transport: str = "grpc_asyncio", request_type=case_service.GetCaseRequest -): +@pytest.mark.parametrize( + "request_type", + [ + case_service.GetCaseRequest(), + {}, + ], +) +async def test_get_case_async(request_type, transport: str = "grpc_asyncio"): client = CaseServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1442,7 +1464,7 @@ async def test_get_case_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_case), "__call__") as call: @@ -1485,11 +1507,6 @@ async def test_get_case_async( assert response.priority == case.Case.Priority.P0 -@pytest.mark.asyncio -async def test_get_case_async_from_dict(): - await test_get_case_async(request_type=dict) - - def test_get_case_field_headers(): client = CaseServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1632,8 +1649,8 @@ async def test_get_case_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - case_service.ListCasesRequest, - dict, + case_service.ListCasesRequest(), + {}, ], ) def test_list_cases(request_type, transport: str = "grpc"): @@ -1644,7 +1661,7 @@ def test_list_cases(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_cases), "__call__") as call: @@ -1690,11 +1707,12 @@ def test_list_cases_non_empty_request_with_auto_populated_field(): client.list_cases(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == case_service.ListCasesRequest( + request_msg = case_service.ListCasesRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_cases_use_cached_wrapped_rpc(): @@ -1773,9 +1791,14 @@ async def test_list_cases_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_list_cases_async( - transport: str = "grpc_asyncio", request_type=case_service.ListCasesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + case_service.ListCasesRequest(), + {}, + ], +) +async def test_list_cases_async(request_type, transport: str = "grpc_asyncio"): client = CaseServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1783,7 +1806,7 @@ async def test_list_cases_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_cases), "__call__") as call: @@ -1806,11 +1829,6 @@ async def test_list_cases_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_cases_async_from_dict(): - await test_list_cases_async(request_type=dict) - - def test_list_cases_field_headers(): client = CaseServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2147,8 +2165,8 @@ async def test_list_cases_async_pages(): @pytest.mark.parametrize( "request_type", [ - case_service.SearchCasesRequest, - dict, + case_service.SearchCasesRequest(), + {}, ], ) def test_search_cases(request_type, transport: str = "grpc"): @@ -2159,7 +2177,7 @@ def test_search_cases(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.search_cases), "__call__") as call: @@ -2205,11 +2223,12 @@ def test_search_cases_non_empty_request_with_auto_populated_field(): client.search_cases(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == case_service.SearchCasesRequest( + request_msg = case_service.SearchCasesRequest( parent="parent_value", query="query_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_search_cases_use_cached_wrapped_rpc(): @@ -2290,9 +2309,14 @@ async def test_search_cases_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_search_cases_async( - transport: str = "grpc_asyncio", request_type=case_service.SearchCasesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + case_service.SearchCasesRequest(), + {}, + ], +) +async def test_search_cases_async(request_type, transport: str = "grpc_asyncio"): client = CaseServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2300,7 +2324,7 @@ async def test_search_cases_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.search_cases), "__call__") as call: @@ -2323,11 +2347,6 @@ async def test_search_cases_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_search_cases_async_from_dict(): - await test_search_cases_async(request_type=dict) - - def test_search_cases_field_headers(): client = CaseServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2582,8 +2601,8 @@ async def test_search_cases_async_pages(): @pytest.mark.parametrize( "request_type", [ - case_service.CreateCaseRequest, - dict, + case_service.CreateCaseRequest(), + {}, ], ) def test_create_case(request_type, transport: str = "grpc"): @@ -2594,7 +2613,7 @@ def test_create_case(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_case), "__call__") as call: @@ -2658,9 +2677,10 @@ def test_create_case_non_empty_request_with_auto_populated_field(): client.create_case(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == case_service.CreateCaseRequest( + request_msg = case_service.CreateCaseRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_case_use_cached_wrapped_rpc(): @@ -2741,9 +2761,14 @@ async def test_create_case_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_case_async( - transport: str = "grpc_asyncio", request_type=case_service.CreateCaseRequest -): +@pytest.mark.parametrize( + "request_type", + [ + case_service.CreateCaseRequest(), + {}, + ], +) +async def test_create_case_async(request_type, transport: str = "grpc_asyncio"): client = CaseServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2751,7 +2776,7 @@ async def test_create_case_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_case), "__call__") as call: @@ -2794,11 +2819,6 @@ async def test_create_case_async( assert response.priority == gcs_case.Case.Priority.P0 -@pytest.mark.asyncio -async def test_create_case_async_from_dict(): - await test_create_case_async(request_type=dict) - - def test_create_case_field_headers(): client = CaseServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2951,8 +2971,8 @@ async def test_create_case_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - case_service.UpdateCaseRequest, - dict, + case_service.UpdateCaseRequest(), + {}, ], ) def test_update_case(request_type, transport: str = "grpc"): @@ -2963,7 +2983,7 @@ def test_update_case(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_case), "__call__") as call: @@ -3025,7 +3045,8 @@ def test_update_case_non_empty_request_with_auto_populated_field(): client.update_case(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == case_service.UpdateCaseRequest() + request_msg = case_service.UpdateCaseRequest() + assert args[0] == request_msg def test_update_case_use_cached_wrapped_rpc(): @@ -3106,9 +3127,14 @@ async def test_update_case_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_case_async( - transport: str = "grpc_asyncio", request_type=case_service.UpdateCaseRequest -): +@pytest.mark.parametrize( + "request_type", + [ + case_service.UpdateCaseRequest(), + {}, + ], +) +async def test_update_case_async(request_type, transport: str = "grpc_asyncio"): client = CaseServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3116,7 +3142,7 @@ async def test_update_case_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_case), "__call__") as call: @@ -3159,11 +3185,6 @@ async def test_update_case_async( assert response.priority == gcs_case.Case.Priority.P0 -@pytest.mark.asyncio -async def test_update_case_async_from_dict(): - await test_update_case_async(request_type=dict) - - def test_update_case_field_headers(): client = CaseServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3316,8 +3337,8 @@ async def test_update_case_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - case_service.EscalateCaseRequest, - dict, + case_service.EscalateCaseRequest(), + {}, ], ) def test_escalate_case(request_type, transport: str = "grpc"): @@ -3328,7 +3349,7 @@ def test_escalate_case(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.escalate_case), "__call__") as call: @@ -3392,9 +3413,10 @@ def test_escalate_case_non_empty_request_with_auto_populated_field(): client.escalate_case(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == case_service.EscalateCaseRequest( + request_msg = case_service.EscalateCaseRequest( name="name_value", ) + assert args[0] == request_msg def test_escalate_case_use_cached_wrapped_rpc(): @@ -3475,9 +3497,14 @@ async def test_escalate_case_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_escalate_case_async( - transport: str = "grpc_asyncio", request_type=case_service.EscalateCaseRequest -): +@pytest.mark.parametrize( + "request_type", + [ + case_service.EscalateCaseRequest(), + {}, + ], +) +async def test_escalate_case_async(request_type, transport: str = "grpc_asyncio"): client = CaseServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3485,7 +3512,7 @@ async def test_escalate_case_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.escalate_case), "__call__") as call: @@ -3528,11 +3555,6 @@ async def test_escalate_case_async( assert response.priority == case.Case.Priority.P0 -@pytest.mark.asyncio -async def test_escalate_case_async_from_dict(): - await test_escalate_case_async(request_type=dict) - - def test_escalate_case_field_headers(): client = CaseServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3595,8 +3617,8 @@ async def test_escalate_case_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - case_service.CloseCaseRequest, - dict, + case_service.CloseCaseRequest(), + {}, ], ) def test_close_case(request_type, transport: str = "grpc"): @@ -3607,7 +3629,7 @@ def test_close_case(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.close_case), "__call__") as call: @@ -3671,9 +3693,10 @@ def test_close_case_non_empty_request_with_auto_populated_field(): client.close_case(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == case_service.CloseCaseRequest( + request_msg = case_service.CloseCaseRequest( name="name_value", ) + assert args[0] == request_msg def test_close_case_use_cached_wrapped_rpc(): @@ -3752,9 +3775,14 @@ async def test_close_case_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_close_case_async( - transport: str = "grpc_asyncio", request_type=case_service.CloseCaseRequest -): +@pytest.mark.parametrize( + "request_type", + [ + case_service.CloseCaseRequest(), + {}, + ], +) +async def test_close_case_async(request_type, transport: str = "grpc_asyncio"): client = CaseServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3762,7 +3790,7 @@ async def test_close_case_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.close_case), "__call__") as call: @@ -3805,11 +3833,6 @@ async def test_close_case_async( assert response.priority == case.Case.Priority.P0 -@pytest.mark.asyncio -async def test_close_case_async_from_dict(): - await test_close_case_async(request_type=dict) - - def test_close_case_field_headers(): client = CaseServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3872,8 +3895,8 @@ async def test_close_case_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - case_service.SearchCaseClassificationsRequest, - dict, + case_service.SearchCaseClassificationsRequest(), + {}, ], ) def test_search_case_classifications(request_type, transport: str = "grpc"): @@ -3884,7 +3907,7 @@ def test_search_case_classifications(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3933,10 +3956,11 @@ def test_search_case_classifications_non_empty_request_with_auto_populated_field client.search_case_classifications(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == case_service.SearchCaseClassificationsRequest( + request_msg = case_service.SearchCaseClassificationsRequest( query="query_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_search_case_classifications_use_cached_wrapped_rpc(): @@ -4022,9 +4046,15 @@ async def test_search_case_classifications_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + case_service.SearchCaseClassificationsRequest(), + {}, + ], +) async def test_search_case_classifications_async( - transport: str = "grpc_asyncio", - request_type=case_service.SearchCaseClassificationsRequest, + request_type, transport: str = "grpc_asyncio" ): client = CaseServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4033,7 +4063,7 @@ async def test_search_case_classifications_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( @@ -4058,11 +4088,6 @@ async def test_search_case_classifications_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_search_case_classifications_async_from_dict(): - await test_search_case_classifications_async(request_type=dict) - - def test_search_case_classifications_pager(transport_name: str = "grpc"): client = CaseServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5609,7 +5634,6 @@ def test_get_case_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = case_service.GetCaseRequest() - assert args[0] == request_msg @@ -5630,7 +5654,6 @@ def test_list_cases_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = case_service.ListCasesRequest() - assert args[0] == request_msg @@ -5651,7 +5674,6 @@ def test_search_cases_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = case_service.SearchCasesRequest() - assert args[0] == request_msg @@ -5672,7 +5694,6 @@ def test_create_case_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = case_service.CreateCaseRequest() - assert args[0] == request_msg @@ -5693,7 +5714,6 @@ def test_update_case_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = case_service.UpdateCaseRequest() - assert args[0] == request_msg @@ -5714,7 +5734,6 @@ def test_escalate_case_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = case_service.EscalateCaseRequest() - assert args[0] == request_msg @@ -5735,7 +5754,6 @@ def test_close_case_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = case_service.CloseCaseRequest() - assert args[0] == request_msg @@ -5758,7 +5776,6 @@ def test_search_case_classifications_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = case_service.SearchCaseClassificationsRequest() - assert args[0] == request_msg @@ -5809,7 +5826,6 @@ async def test_get_case_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = case_service.GetCaseRequest() - assert args[0] == request_msg @@ -5836,7 +5852,6 @@ async def test_list_cases_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = case_service.ListCasesRequest() - assert args[0] == request_msg @@ -5863,7 +5878,6 @@ async def test_search_cases_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = case_service.SearchCasesRequest() - assert args[0] == request_msg @@ -5900,7 +5914,6 @@ async def test_create_case_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = case_service.CreateCaseRequest() - assert args[0] == request_msg @@ -5937,7 +5950,6 @@ async def test_update_case_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = case_service.UpdateCaseRequest() - assert args[0] == request_msg @@ -5974,7 +5986,6 @@ async def test_escalate_case_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = case_service.EscalateCaseRequest() - assert args[0] == request_msg @@ -6011,7 +6022,6 @@ async def test_close_case_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = case_service.CloseCaseRequest() - assert args[0] == request_msg @@ -6040,7 +6050,6 @@ async def test_search_case_classifications_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = case_service.SearchCaseClassificationsRequest() - assert args[0] == request_msg @@ -7382,7 +7391,6 @@ def test_get_case_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = case_service.GetCaseRequest() - assert args[0] == request_msg @@ -7402,7 +7410,6 @@ def test_list_cases_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = case_service.ListCasesRequest() - assert args[0] == request_msg @@ -7422,7 +7429,6 @@ def test_search_cases_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = case_service.SearchCasesRequest() - assert args[0] == request_msg @@ -7442,7 +7448,6 @@ def test_create_case_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = case_service.CreateCaseRequest() - assert args[0] == request_msg @@ -7462,7 +7467,6 @@ def test_update_case_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = case_service.UpdateCaseRequest() - assert args[0] == request_msg @@ -7482,7 +7486,6 @@ def test_escalate_case_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = case_service.EscalateCaseRequest() - assert args[0] == request_msg @@ -7502,7 +7505,6 @@ def test_close_case_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = case_service.CloseCaseRequest() - assert args[0] == request_msg @@ -7524,7 +7526,6 @@ def test_search_case_classifications_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = case_service.SearchCaseClassificationsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-support/tests/unit/gapic/support_v2/test_comment_service.py b/packages/google-cloud-support/tests/unit/gapic/support_v2/test_comment_service.py index a4117e70d405..dd63298908a5 100644 --- a/packages/google-cloud-support/tests/unit/gapic/support_v2/test_comment_service.py +++ b/packages/google-cloud-support/tests/unit/gapic/support_v2/test_comment_service.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 @@ -109,6 +110,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" @@ -1312,8 +1328,8 @@ def test_comment_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - comment_service.ListCommentsRequest, - dict, + comment_service.ListCommentsRequest(), + {}, ], ) def test_list_comments(request_type, transport: str = "grpc"): @@ -1324,7 +1340,7 @@ def test_list_comments(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_comments), "__call__") as call: @@ -1369,10 +1385,11 @@ def test_list_comments_non_empty_request_with_auto_populated_field(): client.list_comments(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == comment_service.ListCommentsRequest( + request_msg = comment_service.ListCommentsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_comments_use_cached_wrapped_rpc(): @@ -1453,9 +1470,14 @@ async def test_list_comments_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_comments_async( - transport: str = "grpc_asyncio", request_type=comment_service.ListCommentsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + comment_service.ListCommentsRequest(), + {}, + ], +) +async def test_list_comments_async(request_type, transport: str = "grpc_asyncio"): client = CommentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1463,7 +1485,7 @@ async def test_list_comments_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_comments), "__call__") as call: @@ -1486,11 +1508,6 @@ async def test_list_comments_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_comments_async_from_dict(): - await test_list_comments_async(request_type=dict) - - def test_list_comments_field_headers(): client = CommentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1827,8 +1844,8 @@ async def test_list_comments_async_pages(): @pytest.mark.parametrize( "request_type", [ - comment_service.CreateCommentRequest, - dict, + comment_service.CreateCommentRequest(), + {}, ], ) def test_create_comment(request_type, transport: str = "grpc"): @@ -1839,7 +1856,7 @@ def test_create_comment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_comment), "__call__") as call: @@ -1887,9 +1904,10 @@ def test_create_comment_non_empty_request_with_auto_populated_field(): client.create_comment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == comment_service.CreateCommentRequest( + request_msg = comment_service.CreateCommentRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_comment_use_cached_wrapped_rpc(): @@ -1970,9 +1988,14 @@ async def test_create_comment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_comment_async( - transport: str = "grpc_asyncio", request_type=comment_service.CreateCommentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + comment_service.CreateCommentRequest(), + {}, + ], +) +async def test_create_comment_async(request_type, transport: str = "grpc_asyncio"): client = CommentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1980,7 +2003,7 @@ async def test_create_comment_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_comment), "__call__") as call: @@ -2007,11 +2030,6 @@ async def test_create_comment_async( assert response.plain_text_body == "plain_text_body_value" -@pytest.mark.asyncio -async def test_create_comment_async_from_dict(): - await test_create_comment_async(request_type=dict) - - def test_create_comment_field_headers(): client = CommentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2164,8 +2182,8 @@ async def test_create_comment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - comment_service.GetCommentRequest, - dict, + comment_service.GetCommentRequest(), + {}, ], ) def test_get_comment(request_type, transport: str = "grpc"): @@ -2176,7 +2194,7 @@ def test_get_comment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_comment), "__call__") as call: @@ -2224,9 +2242,10 @@ def test_get_comment_non_empty_request_with_auto_populated_field(): client.get_comment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == comment_service.GetCommentRequest( + request_msg = comment_service.GetCommentRequest( name="name_value", ) + assert args[0] == request_msg def test_get_comment_use_cached_wrapped_rpc(): @@ -2307,9 +2326,14 @@ async def test_get_comment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_comment_async( - transport: str = "grpc_asyncio", request_type=comment_service.GetCommentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + comment_service.GetCommentRequest(), + {}, + ], +) +async def test_get_comment_async(request_type, transport: str = "grpc_asyncio"): client = CommentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2317,7 +2341,7 @@ async def test_get_comment_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_comment), "__call__") as call: @@ -2344,11 +2368,6 @@ async def test_get_comment_async( assert response.plain_text_body == "plain_text_body_value" -@pytest.mark.asyncio -async def test_get_comment_async_from_dict(): - await test_get_comment_async(request_type=dict) - - def test_get_comment_field_headers(): client = CommentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3230,7 +3249,6 @@ def test_list_comments_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = comment_service.ListCommentsRequest() - assert args[0] == request_msg @@ -3251,7 +3269,6 @@ def test_create_comment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = comment_service.CreateCommentRequest() - assert args[0] == request_msg @@ -3272,7 +3289,6 @@ def test_get_comment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = comment_service.GetCommentRequest() - assert args[0] == request_msg @@ -3313,7 +3329,6 @@ async def test_list_comments_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = comment_service.ListCommentsRequest() - assert args[0] == request_msg @@ -3342,7 +3357,6 @@ async def test_create_comment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = comment_service.CreateCommentRequest() - assert args[0] == request_msg @@ -3371,7 +3385,6 @@ async def test_get_comment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = comment_service.GetCommentRequest() - assert args[0] == request_msg @@ -3886,7 +3899,6 @@ def test_list_comments_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = comment_service.ListCommentsRequest() - assert args[0] == request_msg @@ -3906,7 +3918,6 @@ def test_create_comment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = comment_service.CreateCommentRequest() - assert args[0] == request_msg @@ -3926,7 +3937,6 @@ def test_get_comment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = comment_service.GetCommentRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-support/tests/unit/gapic/support_v2beta/test_case_attachment_service.py b/packages/google-cloud-support/tests/unit/gapic/support_v2beta/test_case_attachment_service.py index 4be605276933..02b39583ea81 100644 --- a/packages/google-cloud-support/tests/unit/gapic/support_v2beta/test_case_attachment_service.py +++ b/packages/google-cloud-support/tests/unit/gapic/support_v2beta/test_case_attachment_service.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 @@ -108,6 +109,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" @@ -1373,8 +1389,8 @@ def test_case_attachment_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - attachment_service.ListAttachmentsRequest, - dict, + attachment_service.ListAttachmentsRequest(), + {}, ], ) def test_list_attachments(request_type, transport: str = "grpc"): @@ -1385,7 +1401,7 @@ def test_list_attachments(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_attachments), "__call__") as call: @@ -1430,10 +1446,11 @@ def test_list_attachments_non_empty_request_with_auto_populated_field(): client.list_attachments(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == attachment_service.ListAttachmentsRequest( + request_msg = attachment_service.ListAttachmentsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_attachments_use_cached_wrapped_rpc(): @@ -1516,10 +1533,14 @@ async def test_list_attachments_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_attachments_async( - transport: str = "grpc_asyncio", - request_type=attachment_service.ListAttachmentsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + attachment_service.ListAttachmentsRequest(), + {}, + ], +) +async def test_list_attachments_async(request_type, transport: str = "grpc_asyncio"): client = CaseAttachmentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1527,7 +1548,7 @@ async def test_list_attachments_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_attachments), "__call__") as call: @@ -1550,11 +1571,6 @@ async def test_list_attachments_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_attachments_async_from_dict(): - await test_list_attachments_async(request_type=dict) - - def test_list_attachments_field_headers(): client = CaseAttachmentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1891,8 +1907,8 @@ async def test_list_attachments_async_pages(): @pytest.mark.parametrize( "request_type", [ - attachment_service.GetAttachmentRequest, - dict, + attachment_service.GetAttachmentRequest(), + {}, ], ) def test_get_attachment(request_type, transport: str = "grpc"): @@ -1903,7 +1919,7 @@ def test_get_attachment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_attachment), "__call__") as call: @@ -1953,9 +1969,10 @@ def test_get_attachment_non_empty_request_with_auto_populated_field(): client.get_attachment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == attachment_service.GetAttachmentRequest( + request_msg = attachment_service.GetAttachmentRequest( name="name_value", ) + assert args[0] == request_msg def test_get_attachment_use_cached_wrapped_rpc(): @@ -2036,10 +2053,14 @@ async def test_get_attachment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_attachment_async( - transport: str = "grpc_asyncio", - request_type=attachment_service.GetAttachmentRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + attachment_service.GetAttachmentRequest(), + {}, + ], +) +async def test_get_attachment_async(request_type, transport: str = "grpc_asyncio"): client = CaseAttachmentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2047,7 +2068,7 @@ async def test_get_attachment_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_attachment), "__call__") as call: @@ -2076,11 +2097,6 @@ async def test_get_attachment_async( assert response.size_bytes == 1089 -@pytest.mark.asyncio -async def test_get_attachment_async_from_dict(): - await test_get_attachment_async(request_type=dict) - - def test_get_attachment_field_headers(): client = CaseAttachmentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2782,7 +2798,6 @@ def test_list_attachments_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = attachment_service.ListAttachmentsRequest() - assert args[0] == request_msg @@ -2803,7 +2818,6 @@ def test_get_attachment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = attachment_service.GetAttachmentRequest() - assert args[0] == request_msg @@ -2844,7 +2858,6 @@ async def test_list_attachments_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = attachment_service.ListAttachmentsRequest() - assert args[0] == request_msg @@ -2874,7 +2887,6 @@ async def test_get_attachment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = attachment_service.GetAttachmentRequest() - assert args[0] == request_msg @@ -3181,7 +3193,6 @@ def test_list_attachments_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = attachment_service.ListAttachmentsRequest() - assert args[0] == request_msg @@ -3201,7 +3212,6 @@ def test_get_attachment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = attachment_service.GetAttachmentRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-support/tests/unit/gapic/support_v2beta/test_case_service.py b/packages/google-cloud-support/tests/unit/gapic/support_v2beta/test_case_service.py index 2a3685bd0d2a..61397df0aac0 100644 --- a/packages/google-cloud-support/tests/unit/gapic/support_v2beta/test_case_service.py +++ b/packages/google-cloud-support/tests/unit/gapic/support_v2beta/test_case_service.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 @@ -110,6 +111,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" @@ -1275,8 +1291,8 @@ def test_case_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - case_service.GetCaseRequest, - dict, + case_service.GetCaseRequest(), + {}, ], ) def test_get_case(request_type, transport: str = "grpc"): @@ -1287,7 +1303,7 @@ def test_get_case(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_case), "__call__") as call: @@ -1351,9 +1367,10 @@ def test_get_case_non_empty_request_with_auto_populated_field(): client.get_case(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == case_service.GetCaseRequest( + request_msg = case_service.GetCaseRequest( name="name_value", ) + assert args[0] == request_msg def test_get_case_use_cached_wrapped_rpc(): @@ -1432,9 +1449,14 @@ async def test_get_case_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn @pytest.mark.asyncio -async def test_get_case_async( - transport: str = "grpc_asyncio", request_type=case_service.GetCaseRequest -): +@pytest.mark.parametrize( + "request_type", + [ + case_service.GetCaseRequest(), + {}, + ], +) +async def test_get_case_async(request_type, transport: str = "grpc_asyncio"): client = CaseServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1442,7 +1464,7 @@ async def test_get_case_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_case), "__call__") as call: @@ -1485,11 +1507,6 @@ async def test_get_case_async( assert response.priority == case.Case.Priority.P0 -@pytest.mark.asyncio -async def test_get_case_async_from_dict(): - await test_get_case_async(request_type=dict) - - def test_get_case_field_headers(): client = CaseServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1632,8 +1649,8 @@ async def test_get_case_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - case_service.ListCasesRequest, - dict, + case_service.ListCasesRequest(), + {}, ], ) def test_list_cases(request_type, transport: str = "grpc"): @@ -1644,7 +1661,7 @@ def test_list_cases(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_cases), "__call__") as call: @@ -1690,11 +1707,12 @@ def test_list_cases_non_empty_request_with_auto_populated_field(): client.list_cases(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == case_service.ListCasesRequest( + request_msg = case_service.ListCasesRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_cases_use_cached_wrapped_rpc(): @@ -1773,9 +1791,14 @@ async def test_list_cases_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_list_cases_async( - transport: str = "grpc_asyncio", request_type=case_service.ListCasesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + case_service.ListCasesRequest(), + {}, + ], +) +async def test_list_cases_async(request_type, transport: str = "grpc_asyncio"): client = CaseServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1783,7 +1806,7 @@ async def test_list_cases_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_cases), "__call__") as call: @@ -1806,11 +1829,6 @@ async def test_list_cases_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_cases_async_from_dict(): - await test_list_cases_async(request_type=dict) - - def test_list_cases_field_headers(): client = CaseServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2147,8 +2165,8 @@ async def test_list_cases_async_pages(): @pytest.mark.parametrize( "request_type", [ - case_service.SearchCasesRequest, - dict, + case_service.SearchCasesRequest(), + {}, ], ) def test_search_cases(request_type, transport: str = "grpc"): @@ -2159,7 +2177,7 @@ def test_search_cases(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.search_cases), "__call__") as call: @@ -2205,11 +2223,12 @@ def test_search_cases_non_empty_request_with_auto_populated_field(): client.search_cases(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == case_service.SearchCasesRequest( + request_msg = case_service.SearchCasesRequest( parent="parent_value", query="query_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_search_cases_use_cached_wrapped_rpc(): @@ -2290,9 +2309,14 @@ async def test_search_cases_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_search_cases_async( - transport: str = "grpc_asyncio", request_type=case_service.SearchCasesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + case_service.SearchCasesRequest(), + {}, + ], +) +async def test_search_cases_async(request_type, transport: str = "grpc_asyncio"): client = CaseServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2300,7 +2324,7 @@ async def test_search_cases_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.search_cases), "__call__") as call: @@ -2323,11 +2347,6 @@ async def test_search_cases_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_search_cases_async_from_dict(): - await test_search_cases_async(request_type=dict) - - def test_search_cases_field_headers(): client = CaseServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2582,8 +2601,8 @@ async def test_search_cases_async_pages(): @pytest.mark.parametrize( "request_type", [ - case_service.CreateCaseRequest, - dict, + case_service.CreateCaseRequest(), + {}, ], ) def test_create_case(request_type, transport: str = "grpc"): @@ -2594,7 +2613,7 @@ def test_create_case(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_case), "__call__") as call: @@ -2658,9 +2677,10 @@ def test_create_case_non_empty_request_with_auto_populated_field(): client.create_case(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == case_service.CreateCaseRequest( + request_msg = case_service.CreateCaseRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_case_use_cached_wrapped_rpc(): @@ -2741,9 +2761,14 @@ async def test_create_case_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_case_async( - transport: str = "grpc_asyncio", request_type=case_service.CreateCaseRequest -): +@pytest.mark.parametrize( + "request_type", + [ + case_service.CreateCaseRequest(), + {}, + ], +) +async def test_create_case_async(request_type, transport: str = "grpc_asyncio"): client = CaseServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2751,7 +2776,7 @@ async def test_create_case_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_case), "__call__") as call: @@ -2794,11 +2819,6 @@ async def test_create_case_async( assert response.priority == gcs_case.Case.Priority.P0 -@pytest.mark.asyncio -async def test_create_case_async_from_dict(): - await test_create_case_async(request_type=dict) - - def test_create_case_field_headers(): client = CaseServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2951,8 +2971,8 @@ async def test_create_case_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - case_service.UpdateCaseRequest, - dict, + case_service.UpdateCaseRequest(), + {}, ], ) def test_update_case(request_type, transport: str = "grpc"): @@ -2963,7 +2983,7 @@ def test_update_case(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_case), "__call__") as call: @@ -3025,7 +3045,8 @@ def test_update_case_non_empty_request_with_auto_populated_field(): client.update_case(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == case_service.UpdateCaseRequest() + request_msg = case_service.UpdateCaseRequest() + assert args[0] == request_msg def test_update_case_use_cached_wrapped_rpc(): @@ -3106,9 +3127,14 @@ async def test_update_case_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_case_async( - transport: str = "grpc_asyncio", request_type=case_service.UpdateCaseRequest -): +@pytest.mark.parametrize( + "request_type", + [ + case_service.UpdateCaseRequest(), + {}, + ], +) +async def test_update_case_async(request_type, transport: str = "grpc_asyncio"): client = CaseServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3116,7 +3142,7 @@ async def test_update_case_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_case), "__call__") as call: @@ -3159,11 +3185,6 @@ async def test_update_case_async( assert response.priority == gcs_case.Case.Priority.P0 -@pytest.mark.asyncio -async def test_update_case_async_from_dict(): - await test_update_case_async(request_type=dict) - - def test_update_case_field_headers(): client = CaseServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3316,8 +3337,8 @@ async def test_update_case_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - case_service.EscalateCaseRequest, - dict, + case_service.EscalateCaseRequest(), + {}, ], ) def test_escalate_case(request_type, transport: str = "grpc"): @@ -3328,7 +3349,7 @@ def test_escalate_case(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.escalate_case), "__call__") as call: @@ -3392,9 +3413,10 @@ def test_escalate_case_non_empty_request_with_auto_populated_field(): client.escalate_case(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == case_service.EscalateCaseRequest( + request_msg = case_service.EscalateCaseRequest( name="name_value", ) + assert args[0] == request_msg def test_escalate_case_use_cached_wrapped_rpc(): @@ -3475,9 +3497,14 @@ async def test_escalate_case_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_escalate_case_async( - transport: str = "grpc_asyncio", request_type=case_service.EscalateCaseRequest -): +@pytest.mark.parametrize( + "request_type", + [ + case_service.EscalateCaseRequest(), + {}, + ], +) +async def test_escalate_case_async(request_type, transport: str = "grpc_asyncio"): client = CaseServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3485,7 +3512,7 @@ async def test_escalate_case_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.escalate_case), "__call__") as call: @@ -3528,11 +3555,6 @@ async def test_escalate_case_async( assert response.priority == case.Case.Priority.P0 -@pytest.mark.asyncio -async def test_escalate_case_async_from_dict(): - await test_escalate_case_async(request_type=dict) - - def test_escalate_case_field_headers(): client = CaseServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3595,8 +3617,8 @@ async def test_escalate_case_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - case_service.CloseCaseRequest, - dict, + case_service.CloseCaseRequest(), + {}, ], ) def test_close_case(request_type, transport: str = "grpc"): @@ -3607,7 +3629,7 @@ def test_close_case(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.close_case), "__call__") as call: @@ -3671,9 +3693,10 @@ def test_close_case_non_empty_request_with_auto_populated_field(): client.close_case(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == case_service.CloseCaseRequest( + request_msg = case_service.CloseCaseRequest( name="name_value", ) + assert args[0] == request_msg def test_close_case_use_cached_wrapped_rpc(): @@ -3752,9 +3775,14 @@ async def test_close_case_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_close_case_async( - transport: str = "grpc_asyncio", request_type=case_service.CloseCaseRequest -): +@pytest.mark.parametrize( + "request_type", + [ + case_service.CloseCaseRequest(), + {}, + ], +) +async def test_close_case_async(request_type, transport: str = "grpc_asyncio"): client = CaseServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3762,7 +3790,7 @@ async def test_close_case_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.close_case), "__call__") as call: @@ -3805,11 +3833,6 @@ async def test_close_case_async( assert response.priority == case.Case.Priority.P0 -@pytest.mark.asyncio -async def test_close_case_async_from_dict(): - await test_close_case_async(request_type=dict) - - def test_close_case_field_headers(): client = CaseServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3872,8 +3895,8 @@ async def test_close_case_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - case_service.SearchCaseClassificationsRequest, - dict, + case_service.SearchCaseClassificationsRequest(), + {}, ], ) def test_search_case_classifications(request_type, transport: str = "grpc"): @@ -3884,7 +3907,7 @@ def test_search_case_classifications(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3933,10 +3956,11 @@ def test_search_case_classifications_non_empty_request_with_auto_populated_field client.search_case_classifications(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == case_service.SearchCaseClassificationsRequest( + request_msg = case_service.SearchCaseClassificationsRequest( query="query_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_search_case_classifications_use_cached_wrapped_rpc(): @@ -4022,9 +4046,15 @@ async def test_search_case_classifications_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + case_service.SearchCaseClassificationsRequest(), + {}, + ], +) async def test_search_case_classifications_async( - transport: str = "grpc_asyncio", - request_type=case_service.SearchCaseClassificationsRequest, + request_type, transport: str = "grpc_asyncio" ): client = CaseServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4033,7 +4063,7 @@ async def test_search_case_classifications_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( @@ -4058,11 +4088,6 @@ async def test_search_case_classifications_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_search_case_classifications_async_from_dict(): - await test_search_case_classifications_async(request_type=dict) - - def test_search_case_classifications_pager(transport_name: str = "grpc"): client = CaseServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5611,7 +5636,6 @@ def test_get_case_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = case_service.GetCaseRequest() - assert args[0] == request_msg @@ -5632,7 +5656,6 @@ def test_list_cases_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = case_service.ListCasesRequest() - assert args[0] == request_msg @@ -5653,7 +5676,6 @@ def test_search_cases_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = case_service.SearchCasesRequest() - assert args[0] == request_msg @@ -5674,7 +5696,6 @@ def test_create_case_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = case_service.CreateCaseRequest() - assert args[0] == request_msg @@ -5695,7 +5716,6 @@ def test_update_case_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = case_service.UpdateCaseRequest() - assert args[0] == request_msg @@ -5716,7 +5736,6 @@ def test_escalate_case_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = case_service.EscalateCaseRequest() - assert args[0] == request_msg @@ -5737,7 +5756,6 @@ def test_close_case_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = case_service.CloseCaseRequest() - assert args[0] == request_msg @@ -5760,7 +5778,6 @@ def test_search_case_classifications_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = case_service.SearchCaseClassificationsRequest() - assert args[0] == request_msg @@ -5811,7 +5828,6 @@ async def test_get_case_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = case_service.GetCaseRequest() - assert args[0] == request_msg @@ -5838,7 +5854,6 @@ async def test_list_cases_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = case_service.ListCasesRequest() - assert args[0] == request_msg @@ -5865,7 +5880,6 @@ async def test_search_cases_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = case_service.SearchCasesRequest() - assert args[0] == request_msg @@ -5902,7 +5916,6 @@ async def test_create_case_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = case_service.CreateCaseRequest() - assert args[0] == request_msg @@ -5939,7 +5952,6 @@ async def test_update_case_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = case_service.UpdateCaseRequest() - assert args[0] == request_msg @@ -5976,7 +5988,6 @@ async def test_escalate_case_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = case_service.EscalateCaseRequest() - assert args[0] == request_msg @@ -6013,7 +6024,6 @@ async def test_close_case_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = case_service.CloseCaseRequest() - assert args[0] == request_msg @@ -6042,7 +6052,6 @@ async def test_search_case_classifications_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = case_service.SearchCaseClassificationsRequest() - assert args[0] == request_msg @@ -7392,7 +7401,6 @@ def test_get_case_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = case_service.GetCaseRequest() - assert args[0] == request_msg @@ -7412,7 +7420,6 @@ def test_list_cases_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = case_service.ListCasesRequest() - assert args[0] == request_msg @@ -7432,7 +7439,6 @@ def test_search_cases_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = case_service.SearchCasesRequest() - assert args[0] == request_msg @@ -7452,7 +7458,6 @@ def test_create_case_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = case_service.CreateCaseRequest() - assert args[0] == request_msg @@ -7472,7 +7477,6 @@ def test_update_case_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = case_service.UpdateCaseRequest() - assert args[0] == request_msg @@ -7492,7 +7496,6 @@ def test_escalate_case_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = case_service.EscalateCaseRequest() - assert args[0] == request_msg @@ -7512,7 +7515,6 @@ def test_close_case_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = case_service.CloseCaseRequest() - assert args[0] == request_msg @@ -7534,7 +7536,6 @@ def test_search_case_classifications_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = case_service.SearchCaseClassificationsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-support/tests/unit/gapic/support_v2beta/test_comment_service.py b/packages/google-cloud-support/tests/unit/gapic/support_v2beta/test_comment_service.py index 599fc00daff1..494a823b9ded 100644 --- a/packages/google-cloud-support/tests/unit/gapic/support_v2beta/test_comment_service.py +++ b/packages/google-cloud-support/tests/unit/gapic/support_v2beta/test_comment_service.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 @@ -109,6 +110,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" @@ -1312,8 +1328,8 @@ def test_comment_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - comment_service.ListCommentsRequest, - dict, + comment_service.ListCommentsRequest(), + {}, ], ) def test_list_comments(request_type, transport: str = "grpc"): @@ -1324,7 +1340,7 @@ def test_list_comments(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_comments), "__call__") as call: @@ -1369,10 +1385,11 @@ def test_list_comments_non_empty_request_with_auto_populated_field(): client.list_comments(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == comment_service.ListCommentsRequest( + request_msg = comment_service.ListCommentsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_comments_use_cached_wrapped_rpc(): @@ -1453,9 +1470,14 @@ async def test_list_comments_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_comments_async( - transport: str = "grpc_asyncio", request_type=comment_service.ListCommentsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + comment_service.ListCommentsRequest(), + {}, + ], +) +async def test_list_comments_async(request_type, transport: str = "grpc_asyncio"): client = CommentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1463,7 +1485,7 @@ async def test_list_comments_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_comments), "__call__") as call: @@ -1486,11 +1508,6 @@ async def test_list_comments_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_comments_async_from_dict(): - await test_list_comments_async(request_type=dict) - - def test_list_comments_field_headers(): client = CommentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1827,8 +1844,8 @@ async def test_list_comments_async_pages(): @pytest.mark.parametrize( "request_type", [ - comment_service.CreateCommentRequest, - dict, + comment_service.CreateCommentRequest(), + {}, ], ) def test_create_comment(request_type, transport: str = "grpc"): @@ -1839,7 +1856,7 @@ def test_create_comment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_comment), "__call__") as call: @@ -1887,9 +1904,10 @@ def test_create_comment_non_empty_request_with_auto_populated_field(): client.create_comment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == comment_service.CreateCommentRequest( + request_msg = comment_service.CreateCommentRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_comment_use_cached_wrapped_rpc(): @@ -1970,9 +1988,14 @@ async def test_create_comment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_comment_async( - transport: str = "grpc_asyncio", request_type=comment_service.CreateCommentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + comment_service.CreateCommentRequest(), + {}, + ], +) +async def test_create_comment_async(request_type, transport: str = "grpc_asyncio"): client = CommentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1980,7 +2003,7 @@ async def test_create_comment_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_comment), "__call__") as call: @@ -2007,11 +2030,6 @@ async def test_create_comment_async( assert response.plain_text_body == "plain_text_body_value" -@pytest.mark.asyncio -async def test_create_comment_async_from_dict(): - await test_create_comment_async(request_type=dict) - - def test_create_comment_field_headers(): client = CommentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2164,8 +2182,8 @@ async def test_create_comment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - comment_service.GetCommentRequest, - dict, + comment_service.GetCommentRequest(), + {}, ], ) def test_get_comment(request_type, transport: str = "grpc"): @@ -2176,7 +2194,7 @@ def test_get_comment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_comment), "__call__") as call: @@ -2224,9 +2242,10 @@ def test_get_comment_non_empty_request_with_auto_populated_field(): client.get_comment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == comment_service.GetCommentRequest( + request_msg = comment_service.GetCommentRequest( name="name_value", ) + assert args[0] == request_msg def test_get_comment_use_cached_wrapped_rpc(): @@ -2307,9 +2326,14 @@ async def test_get_comment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_comment_async( - transport: str = "grpc_asyncio", request_type=comment_service.GetCommentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + comment_service.GetCommentRequest(), + {}, + ], +) +async def test_get_comment_async(request_type, transport: str = "grpc_asyncio"): client = CommentServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2317,7 +2341,7 @@ async def test_get_comment_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_comment), "__call__") as call: @@ -2344,11 +2368,6 @@ async def test_get_comment_async( assert response.plain_text_body == "plain_text_body_value" -@pytest.mark.asyncio -async def test_get_comment_async_from_dict(): - await test_get_comment_async(request_type=dict) - - def test_get_comment_field_headers(): client = CommentServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3230,7 +3249,6 @@ def test_list_comments_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = comment_service.ListCommentsRequest() - assert args[0] == request_msg @@ -3251,7 +3269,6 @@ def test_create_comment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = comment_service.CreateCommentRequest() - assert args[0] == request_msg @@ -3272,7 +3289,6 @@ def test_get_comment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = comment_service.GetCommentRequest() - assert args[0] == request_msg @@ -3313,7 +3329,6 @@ async def test_list_comments_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = comment_service.ListCommentsRequest() - assert args[0] == request_msg @@ -3342,7 +3357,6 @@ async def test_create_comment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = comment_service.CreateCommentRequest() - assert args[0] == request_msg @@ -3371,7 +3385,6 @@ async def test_get_comment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = comment_service.GetCommentRequest() - assert args[0] == request_msg @@ -3886,7 +3899,6 @@ def test_list_comments_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = comment_service.ListCommentsRequest() - assert args[0] == request_msg @@ -3906,7 +3918,6 @@ def test_create_comment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = comment_service.CreateCommentRequest() - assert args[0] == request_msg @@ -3926,7 +3937,6 @@ def test_get_comment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = comment_service.GetCommentRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-support/tests/unit/gapic/support_v2beta/test_feed_service.py b/packages/google-cloud-support/tests/unit/gapic/support_v2beta/test_feed_service.py index 142419c7945a..120bf0204ece 100644 --- a/packages/google-cloud-support/tests/unit/gapic/support_v2beta/test_feed_service.py +++ b/packages/google-cloud-support/tests/unit/gapic/support_v2beta/test_feed_service.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 @@ -107,6 +108,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" @@ -1272,8 +1288,8 @@ def test_feed_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - feed_service.ShowFeedRequest, - dict, + feed_service.ShowFeedRequest(), + {}, ], ) def test_show_feed(request_type, transport: str = "grpc"): @@ -1284,7 +1300,7 @@ def test_show_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(type(client.transport.show_feed), "__call__") as call: @@ -1330,11 +1346,12 @@ def test_show_feed_non_empty_request_with_auto_populated_field(): client.show_feed(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == feed_service.ShowFeedRequest( + request_msg = feed_service.ShowFeedRequest( parent="parent_value", order_by="order_by_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_show_feed_use_cached_wrapped_rpc(): @@ -1413,9 +1430,14 @@ async def test_show_feed_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_show_feed_async( - transport: str = "grpc_asyncio", request_type=feed_service.ShowFeedRequest -): +@pytest.mark.parametrize( + "request_type", + [ + feed_service.ShowFeedRequest(), + {}, + ], +) +async def test_show_feed_async(request_type, transport: str = "grpc_asyncio"): client = FeedServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1423,7 +1445,7 @@ async def test_show_feed_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.show_feed), "__call__") as call: @@ -1446,11 +1468,6 @@ async def test_show_feed_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_show_feed_async_from_dict(): - await test_show_feed_async(request_type=dict) - - def test_show_feed_field_headers(): client = FeedServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2160,7 +2177,6 @@ def test_show_feed_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = feed_service.ShowFeedRequest() - assert args[0] == request_msg @@ -2201,7 +2217,6 @@ async def test_show_feed_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = feed_service.ShowFeedRequest() - assert args[0] == request_msg @@ -2363,7 +2378,6 @@ def test_show_feed_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = feed_service.ShowFeedRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-talent/noxfile.py b/packages/google-cloud-talent/noxfile.py index ccfed02ffa0e..c77bb19d1a87 100644 --- a/packages/google-cloud-talent/noxfile.py +++ b/packages/google-cloud-talent/noxfile.py @@ -47,7 +47,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-talent" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-talent/setup.py b/packages/google-cloud-talent/setup.py index a0c3e68e7928..82577fd8b8b8 100644 --- a/packages/google-cloud-talent/setup.py +++ b/packages/google-cloud-talent/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/google-cloud-talent/testing/constraints-3.10.txt b/packages/google-cloud-talent/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-talent/testing/constraints-3.10.txt +++ b/packages/google-cloud-talent/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-talent/tests/unit/gapic/talent_v4/test_company_service.py b/packages/google-cloud-talent/tests/unit/gapic/talent_v4/test_company_service.py index 54984cd52b66..bd63960a8c24 100644 --- a/packages/google-cloud-talent/tests/unit/gapic/talent_v4/test_company_service.py +++ b/packages/google-cloud-talent/tests/unit/gapic/talent_v4/test_company_service.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" @@ -1318,8 +1334,8 @@ def test_company_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - company_service.CreateCompanyRequest, - dict, + company_service.CreateCompanyRequest(), + {}, ], ) def test_create_company(request_type, transport: str = "grpc"): @@ -1330,7 +1346,7 @@ def test_create_company(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_company), "__call__") as call: @@ -1400,9 +1416,10 @@ def test_create_company_non_empty_request_with_auto_populated_field(): client.create_company(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == company_service.CreateCompanyRequest( + request_msg = company_service.CreateCompanyRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_company_use_cached_wrapped_rpc(): @@ -1483,9 +1500,14 @@ async def test_create_company_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_company_async( - transport: str = "grpc_asyncio", request_type=company_service.CreateCompanyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + company_service.CreateCompanyRequest(), + {}, + ], +) +async def test_create_company_async(request_type, transport: str = "grpc_asyncio"): client = CompanyServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1493,7 +1515,7 @@ async def test_create_company_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_company), "__call__") as call: @@ -1542,11 +1564,6 @@ async def test_create_company_async( assert response.suspended is True -@pytest.mark.asyncio -async def test_create_company_async_from_dict(): - await test_create_company_async(request_type=dict) - - def test_create_company_field_headers(): client = CompanyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1699,8 +1716,8 @@ async def test_create_company_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - company_service.GetCompanyRequest, - dict, + company_service.GetCompanyRequest(), + {}, ], ) def test_get_company(request_type, transport: str = "grpc"): @@ -1711,7 +1728,7 @@ def test_get_company(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_company), "__call__") as call: @@ -1781,9 +1798,10 @@ def test_get_company_non_empty_request_with_auto_populated_field(): client.get_company(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == company_service.GetCompanyRequest( + request_msg = company_service.GetCompanyRequest( name="name_value", ) + assert args[0] == request_msg def test_get_company_use_cached_wrapped_rpc(): @@ -1864,9 +1882,14 @@ async def test_get_company_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_company_async( - transport: str = "grpc_asyncio", request_type=company_service.GetCompanyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + company_service.GetCompanyRequest(), + {}, + ], +) +async def test_get_company_async(request_type, transport: str = "grpc_asyncio"): client = CompanyServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1874,7 +1897,7 @@ async def test_get_company_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_company), "__call__") as call: @@ -1923,11 +1946,6 @@ async def test_get_company_async( assert response.suspended is True -@pytest.mark.asyncio -async def test_get_company_async_from_dict(): - await test_get_company_async(request_type=dict) - - def test_get_company_field_headers(): client = CompanyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2070,8 +2088,8 @@ async def test_get_company_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - company_service.UpdateCompanyRequest, - dict, + company_service.UpdateCompanyRequest(), + {}, ], ) def test_update_company(request_type, transport: str = "grpc"): @@ -2082,7 +2100,7 @@ def test_update_company(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_company), "__call__") as call: @@ -2150,7 +2168,8 @@ def test_update_company_non_empty_request_with_auto_populated_field(): client.update_company(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == company_service.UpdateCompanyRequest() + request_msg = company_service.UpdateCompanyRequest() + assert args[0] == request_msg def test_update_company_use_cached_wrapped_rpc(): @@ -2231,9 +2250,14 @@ async def test_update_company_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_company_async( - transport: str = "grpc_asyncio", request_type=company_service.UpdateCompanyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + company_service.UpdateCompanyRequest(), + {}, + ], +) +async def test_update_company_async(request_type, transport: str = "grpc_asyncio"): client = CompanyServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2241,7 +2265,7 @@ async def test_update_company_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_company), "__call__") as call: @@ -2290,11 +2314,6 @@ async def test_update_company_async( assert response.suspended is True -@pytest.mark.asyncio -async def test_update_company_async_from_dict(): - await test_update_company_async(request_type=dict) - - def test_update_company_field_headers(): client = CompanyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2447,8 +2466,8 @@ async def test_update_company_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - company_service.DeleteCompanyRequest, - dict, + company_service.DeleteCompanyRequest(), + {}, ], ) def test_delete_company(request_type, transport: str = "grpc"): @@ -2459,7 +2478,7 @@ def test_delete_company(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_company), "__call__") as call: @@ -2500,9 +2519,10 @@ def test_delete_company_non_empty_request_with_auto_populated_field(): client.delete_company(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == company_service.DeleteCompanyRequest( + request_msg = company_service.DeleteCompanyRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_company_use_cached_wrapped_rpc(): @@ -2583,9 +2603,14 @@ async def test_delete_company_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_company_async( - transport: str = "grpc_asyncio", request_type=company_service.DeleteCompanyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + company_service.DeleteCompanyRequest(), + {}, + ], +) +async def test_delete_company_async(request_type, transport: str = "grpc_asyncio"): client = CompanyServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2593,7 +2618,7 @@ async def test_delete_company_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_company), "__call__") as call: @@ -2611,11 +2636,6 @@ async def test_delete_company_async( assert response is None -@pytest.mark.asyncio -async def test_delete_company_async_from_dict(): - await test_delete_company_async(request_type=dict) - - def test_delete_company_field_headers(): client = CompanyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2758,8 +2778,8 @@ async def test_delete_company_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - company_service.ListCompaniesRequest, - dict, + company_service.ListCompaniesRequest(), + {}, ], ) def test_list_companies(request_type, transport: str = "grpc"): @@ -2770,7 +2790,7 @@ def test_list_companies(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_companies), "__call__") as call: @@ -2815,10 +2835,11 @@ def test_list_companies_non_empty_request_with_auto_populated_field(): client.list_companies(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == company_service.ListCompaniesRequest( + request_msg = company_service.ListCompaniesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_companies_use_cached_wrapped_rpc(): @@ -2899,9 +2920,14 @@ async def test_list_companies_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_companies_async( - transport: str = "grpc_asyncio", request_type=company_service.ListCompaniesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + company_service.ListCompaniesRequest(), + {}, + ], +) +async def test_list_companies_async(request_type, transport: str = "grpc_asyncio"): client = CompanyServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2909,7 +2935,7 @@ async def test_list_companies_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_companies), "__call__") as call: @@ -2932,11 +2958,6 @@ async def test_list_companies_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_companies_async_from_dict(): - await test_list_companies_async(request_type=dict) - - def test_list_companies_field_headers(): client = CompanyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4367,7 +4388,6 @@ def test_create_company_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = company_service.CreateCompanyRequest() - assert args[0] == request_msg @@ -4388,7 +4408,6 @@ def test_get_company_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = company_service.GetCompanyRequest() - assert args[0] == request_msg @@ -4409,7 +4428,6 @@ def test_update_company_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = company_service.UpdateCompanyRequest() - assert args[0] == request_msg @@ -4430,7 +4448,6 @@ def test_delete_company_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = company_service.DeleteCompanyRequest() - assert args[0] == request_msg @@ -4451,7 +4468,6 @@ def test_list_companies_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = company_service.ListCompaniesRequest() - assert args[0] == request_msg @@ -4505,7 +4521,6 @@ async def test_create_company_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = company_service.CreateCompanyRequest() - assert args[0] == request_msg @@ -4545,7 +4560,6 @@ async def test_get_company_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = company_service.GetCompanyRequest() - assert args[0] == request_msg @@ -4585,7 +4599,6 @@ async def test_update_company_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = company_service.UpdateCompanyRequest() - assert args[0] == request_msg @@ -4608,7 +4621,6 @@ async def test_delete_company_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = company_service.DeleteCompanyRequest() - assert args[0] == request_msg @@ -4635,7 +4647,6 @@ async def test_list_companies_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = company_service.ListCompaniesRequest() - assert args[0] == request_msg @@ -5658,7 +5669,6 @@ def test_create_company_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = company_service.CreateCompanyRequest() - assert args[0] == request_msg @@ -5678,7 +5688,6 @@ def test_get_company_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = company_service.GetCompanyRequest() - assert args[0] == request_msg @@ -5698,7 +5707,6 @@ def test_update_company_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = company_service.UpdateCompanyRequest() - assert args[0] == request_msg @@ -5718,7 +5726,6 @@ def test_delete_company_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = company_service.DeleteCompanyRequest() - assert args[0] == request_msg @@ -5738,7 +5745,6 @@ def test_list_companies_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = company_service.ListCompaniesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-talent/tests/unit/gapic/talent_v4/test_completion.py b/packages/google-cloud-talent/tests/unit/gapic/talent_v4/test_completion.py index f910646f455b..13e898ae8de9 100644 --- a/packages/google-cloud-talent/tests/unit/gapic/talent_v4/test_completion.py +++ b/packages/google-cloud-talent/tests/unit/gapic/talent_v4/test_completion.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 @@ -107,6 +108,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" @@ -1271,8 +1287,8 @@ def test_completion_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - completion_service.CompleteQueryRequest, - dict, + completion_service.CompleteQueryRequest(), + {}, ], ) def test_complete_query(request_type, transport: str = "grpc"): @@ -1283,7 +1299,7 @@ def test_complete_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(type(client.transport.complete_query), "__call__") as call: @@ -1326,11 +1342,12 @@ def test_complete_query_non_empty_request_with_auto_populated_field(): client.complete_query(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == completion_service.CompleteQueryRequest( + request_msg = completion_service.CompleteQueryRequest( tenant="tenant_value", query="query_value", company="company_value", ) + assert args[0] == request_msg def test_complete_query_use_cached_wrapped_rpc(): @@ -1411,10 +1428,14 @@ async def test_complete_query_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_complete_query_async( - transport: str = "grpc_asyncio", - request_type=completion_service.CompleteQueryRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + completion_service.CompleteQueryRequest(), + {}, + ], +) +async def test_complete_query_async(request_type, transport: str = "grpc_asyncio"): client = CompletionAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1422,7 +1443,7 @@ async def test_complete_query_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.complete_query), "__call__") as call: @@ -1442,11 +1463,6 @@ async def test_complete_query_async( assert isinstance(response, completion_service.CompleteQueryResponse) -@pytest.mark.asyncio -async def test_complete_query_async_from_dict(): - await test_complete_query_async(request_type=dict) - - def test_complete_query_field_headers(): client = CompletionClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1804,7 +1820,6 @@ def test_complete_query_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = completion_service.CompleteQueryRequest() - assert args[0] == request_msg @@ -1843,7 +1858,6 @@ async def test_complete_query_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = completion_service.CompleteQueryRequest() - assert args[0] == request_msg @@ -2072,7 +2086,6 @@ def test_complete_query_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = completion_service.CompleteQueryRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-talent/tests/unit/gapic/talent_v4/test_event_service.py b/packages/google-cloud-talent/tests/unit/gapic/talent_v4/test_event_service.py index 6270f80a4a9e..2b0f21dcb484 100644 --- a/packages/google-cloud-talent/tests/unit/gapic/talent_v4/test_event_service.py +++ b/packages/google-cloud-talent/tests/unit/gapic/talent_v4/test_event_service.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 @@ -108,6 +109,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" @@ -1291,8 +1307,8 @@ def test_event_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - event_service.CreateClientEventRequest, - dict, + event_service.CreateClientEventRequest(), + {}, ], ) def test_create_client_event(request_type, transport: str = "grpc"): @@ -1303,7 +1319,7 @@ def test_create_client_event(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1355,9 +1371,10 @@ def test_create_client_event_non_empty_request_with_auto_populated_field(): client.create_client_event(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == event_service.CreateClientEventRequest( + request_msg = event_service.CreateClientEventRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_client_event_use_cached_wrapped_rpc(): @@ -1442,9 +1459,14 @@ async def test_create_client_event_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_client_event_async( - transport: str = "grpc_asyncio", request_type=event_service.CreateClientEventRequest -): +@pytest.mark.parametrize( + "request_type", + [ + event_service.CreateClientEventRequest(), + {}, + ], +) +async def test_create_client_event_async(request_type, transport: str = "grpc_asyncio"): client = EventServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1452,7 +1474,7 @@ async def test_create_client_event_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( @@ -1481,11 +1503,6 @@ async def test_create_client_event_async( assert response.event_notes == "event_notes_value" -@pytest.mark.asyncio -async def test_create_client_event_async_from_dict(): - await test_create_client_event_async(request_type=dict) - - def test_create_client_event_field_headers(): client = EventServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1960,7 +1977,6 @@ def test_create_client_event_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = event_service.CreateClientEventRequest() - assert args[0] == request_msg @@ -2005,7 +2021,6 @@ async def test_create_client_event_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = event_service.CreateClientEventRequest() - assert args[0] == request_msg @@ -2313,7 +2328,6 @@ def test_create_client_event_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = event_service.CreateClientEventRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-talent/tests/unit/gapic/talent_v4/test_job_service.py b/packages/google-cloud-talent/tests/unit/gapic/talent_v4/test_job_service.py index 4affc3a84cc9..74bb4d737202 100644 --- a/packages/google-cloud-talent/tests/unit/gapic/talent_v4/test_job_service.py +++ b/packages/google-cloud-talent/tests/unit/gapic/talent_v4/test_job_service.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 @@ -121,6 +122,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" @@ -1285,8 +1301,8 @@ def test_job_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - job_service.CreateJobRequest, - dict, + job_service.CreateJobRequest(), + {}, ], ) def test_create_job(request_type, transport: str = "grpc"): @@ -1297,7 +1313,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() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_job), "__call__") as call: @@ -1377,9 +1393,10 @@ def test_create_job_non_empty_request_with_auto_populated_field(): client.create_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == job_service.CreateJobRequest( + request_msg = job_service.CreateJobRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_job_use_cached_wrapped_rpc(): @@ -1458,9 +1475,14 @@ async def test_create_job_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_create_job_async( - transport: str = "grpc_asyncio", request_type=job_service.CreateJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + job_service.CreateJobRequest(), + {}, + ], +) +async def test_create_job_async(request_type, transport: str = "grpc_asyncio"): client = JobServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1468,7 +1490,7 @@ async def test_create_job_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_job), "__call__") as call: @@ -1527,11 +1549,6 @@ async def test_create_job_async( assert response.company_display_name == "company_display_name_value" -@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 = JobServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1684,8 +1701,8 @@ async def test_create_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - job_service.BatchCreateJobsRequest, - dict, + job_service.BatchCreateJobsRequest(), + {}, ], ) def test_batch_create_jobs(request_type, transport: str = "grpc"): @@ -1696,7 +1713,7 @@ def test_batch_create_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( @@ -1741,9 +1758,10 @@ def test_batch_create_jobs_non_empty_request_with_auto_populated_field(): client.batch_create_jobs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == job_service.BatchCreateJobsRequest( + request_msg = job_service.BatchCreateJobsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_batch_create_jobs_use_cached_wrapped_rpc(): @@ -1836,9 +1854,14 @@ async def test_batch_create_jobs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_batch_create_jobs_async( - transport: str = "grpc_asyncio", request_type=job_service.BatchCreateJobsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + job_service.BatchCreateJobsRequest(), + {}, + ], +) +async def test_batch_create_jobs_async(request_type, transport: str = "grpc_asyncio"): client = JobServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1846,7 +1869,7 @@ async def test_batch_create_jobs_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( @@ -1868,11 +1891,6 @@ async def test_batch_create_jobs_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_batch_create_jobs_async_from_dict(): - await test_batch_create_jobs_async(request_type=dict) - - def test_batch_create_jobs_field_headers(): client = JobServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2037,8 +2055,8 @@ async def test_batch_create_jobs_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - job_service.GetJobRequest, - dict, + job_service.GetJobRequest(), + {}, ], ) def test_get_job(request_type, transport: str = "grpc"): @@ -2049,7 +2067,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(type(client.transport.get_job), "__call__") as call: @@ -2129,9 +2147,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] == job_service.GetJobRequest( + request_msg = job_service.GetJobRequest( name="name_value", ) + assert args[0] == request_msg def test_get_job_use_cached_wrapped_rpc(): @@ -2210,9 +2229,14 @@ async def test_get_job_async_use_cached_wrapped_rpc(transport: str = "grpc_async @pytest.mark.asyncio -async def test_get_job_async( - transport: str = "grpc_asyncio", request_type=job_service.GetJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + job_service.GetJobRequest(), + {}, + ], +) +async def test_get_job_async(request_type, transport: str = "grpc_asyncio"): client = JobServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2220,7 +2244,7 @@ async def test_get_job_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_job), "__call__") as call: @@ -2279,11 +2303,6 @@ async def test_get_job_async( assert response.company_display_name == "company_display_name_value" -@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 = JobServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2426,8 +2445,8 @@ async def test_get_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - job_service.UpdateJobRequest, - dict, + job_service.UpdateJobRequest(), + {}, ], ) def test_update_job(request_type, transport: str = "grpc"): @@ -2438,7 +2457,7 @@ def test_update_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(type(client.transport.update_job), "__call__") as call: @@ -2516,7 +2535,8 @@ def test_update_job_non_empty_request_with_auto_populated_field(): client.update_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == job_service.UpdateJobRequest() + request_msg = job_service.UpdateJobRequest() + assert args[0] == request_msg def test_update_job_use_cached_wrapped_rpc(): @@ -2595,9 +2615,14 @@ async def test_update_job_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_update_job_async( - transport: str = "grpc_asyncio", request_type=job_service.UpdateJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + job_service.UpdateJobRequest(), + {}, + ], +) +async def test_update_job_async(request_type, transport: str = "grpc_asyncio"): client = JobServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2605,7 +2630,7 @@ async def test_update_job_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_job), "__call__") as call: @@ -2664,11 +2689,6 @@ async def test_update_job_async( assert response.company_display_name == "company_display_name_value" -@pytest.mark.asyncio -async def test_update_job_async_from_dict(): - await test_update_job_async(request_type=dict) - - def test_update_job_field_headers(): client = JobServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2821,8 +2841,8 @@ async def test_update_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - job_service.BatchUpdateJobsRequest, - dict, + job_service.BatchUpdateJobsRequest(), + {}, ], ) def test_batch_update_jobs(request_type, transport: str = "grpc"): @@ -2833,7 +2853,7 @@ def test_batch_update_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( @@ -2878,9 +2898,10 @@ def test_batch_update_jobs_non_empty_request_with_auto_populated_field(): client.batch_update_jobs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == job_service.BatchUpdateJobsRequest( + request_msg = job_service.BatchUpdateJobsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_batch_update_jobs_use_cached_wrapped_rpc(): @@ -2973,9 +2994,14 @@ async def test_batch_update_jobs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_batch_update_jobs_async( - transport: str = "grpc_asyncio", request_type=job_service.BatchUpdateJobsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + job_service.BatchUpdateJobsRequest(), + {}, + ], +) +async def test_batch_update_jobs_async(request_type, transport: str = "grpc_asyncio"): client = JobServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2983,7 +3009,7 @@ async def test_batch_update_jobs_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( @@ -3005,11 +3031,6 @@ async def test_batch_update_jobs_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_batch_update_jobs_async_from_dict(): - await test_batch_update_jobs_async(request_type=dict) - - def test_batch_update_jobs_field_headers(): client = JobServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3174,8 +3195,8 @@ async def test_batch_update_jobs_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - job_service.DeleteJobRequest, - dict, + job_service.DeleteJobRequest(), + {}, ], ) def test_delete_job(request_type, transport: str = "grpc"): @@ -3186,7 +3207,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() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_job), "__call__") as call: @@ -3227,9 +3248,10 @@ def test_delete_job_non_empty_request_with_auto_populated_field(): client.delete_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == job_service.DeleteJobRequest( + request_msg = job_service.DeleteJobRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_job_use_cached_wrapped_rpc(): @@ -3308,9 +3330,14 @@ async def test_delete_job_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_delete_job_async( - transport: str = "grpc_asyncio", request_type=job_service.DeleteJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + job_service.DeleteJobRequest(), + {}, + ], +) +async def test_delete_job_async(request_type, transport: str = "grpc_asyncio"): client = JobServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3318,7 +3345,7 @@ async def test_delete_job_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_job), "__call__") as call: @@ -3336,11 +3363,6 @@ async def test_delete_job_async( 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 = JobServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3483,8 +3505,8 @@ async def test_delete_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - job_service.BatchDeleteJobsRequest, - dict, + job_service.BatchDeleteJobsRequest(), + {}, ], ) def test_batch_delete_jobs(request_type, transport: str = "grpc"): @@ -3495,7 +3517,7 @@ def test_batch_delete_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( @@ -3540,9 +3562,10 @@ def test_batch_delete_jobs_non_empty_request_with_auto_populated_field(): client.batch_delete_jobs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == job_service.BatchDeleteJobsRequest( + request_msg = job_service.BatchDeleteJobsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_batch_delete_jobs_use_cached_wrapped_rpc(): @@ -3635,9 +3658,14 @@ async def test_batch_delete_jobs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_batch_delete_jobs_async( - transport: str = "grpc_asyncio", request_type=job_service.BatchDeleteJobsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + job_service.BatchDeleteJobsRequest(), + {}, + ], +) +async def test_batch_delete_jobs_async(request_type, transport: str = "grpc_asyncio"): client = JobServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3645,7 +3673,7 @@ async def test_batch_delete_jobs_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( @@ -3667,11 +3695,6 @@ async def test_batch_delete_jobs_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_batch_delete_jobs_async_from_dict(): - await test_batch_delete_jobs_async(request_type=dict) - - def test_batch_delete_jobs_field_headers(): client = JobServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3836,8 +3859,8 @@ async def test_batch_delete_jobs_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - job_service.ListJobsRequest, - dict, + job_service.ListJobsRequest(), + {}, ], ) def test_list_jobs(request_type, transport: str = "grpc"): @@ -3848,7 +3871,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(type(client.transport.list_jobs), "__call__") as call: @@ -3894,11 +3917,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] - assert args[0] == job_service.ListJobsRequest( + request_msg = job_service.ListJobsRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_jobs_use_cached_wrapped_rpc(): @@ -3977,9 +4001,14 @@ async def test_list_jobs_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_list_jobs_async( - transport: str = "grpc_asyncio", request_type=job_service.ListJobsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + job_service.ListJobsRequest(), + {}, + ], +) +async def test_list_jobs_async(request_type, transport: str = "grpc_asyncio"): client = JobServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3987,7 +4016,7 @@ async def test_list_jobs_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_jobs), "__call__") as call: @@ -4010,11 +4039,6 @@ async def test_list_jobs_async( assert response.next_page_token == "next_page_token_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 = JobServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4361,8 +4385,8 @@ async def test_list_jobs_async_pages(): @pytest.mark.parametrize( "request_type", [ - job_service.SearchJobsRequest, - dict, + job_service.SearchJobsRequest(), + {}, ], ) def test_search_jobs(request_type, transport: str = "grpc"): @@ -4373,7 +4397,7 @@ def test_search_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(type(client.transport.search_jobs), "__call__") as call: @@ -4424,11 +4448,12 @@ def test_search_jobs_non_empty_request_with_auto_populated_field(): client.search_jobs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == job_service.SearchJobsRequest( + request_msg = job_service.SearchJobsRequest( parent="parent_value", page_token="page_token_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_search_jobs_use_cached_wrapped_rpc(): @@ -4509,9 +4534,14 @@ async def test_search_jobs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_search_jobs_async( - transport: str = "grpc_asyncio", request_type=job_service.SearchJobsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + job_service.SearchJobsRequest(), + {}, + ], +) +async def test_search_jobs_async(request_type, transport: str = "grpc_asyncio"): client = JobServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4519,7 +4549,7 @@ async def test_search_jobs_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.search_jobs), "__call__") as call: @@ -4546,11 +4576,6 @@ async def test_search_jobs_async( assert response.broadened_query_jobs_count == 2766 -@pytest.mark.asyncio -async def test_search_jobs_async_from_dict(): - await test_search_jobs_async(request_type=dict) - - def test_search_jobs_field_headers(): client = JobServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4615,8 +4640,8 @@ async def test_search_jobs_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - job_service.SearchJobsRequest, - dict, + job_service.SearchJobsRequest(), + {}, ], ) def test_search_jobs_for_alert(request_type, transport: str = "grpc"): @@ -4627,7 +4652,7 @@ def test_search_jobs_for_alert(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4682,11 +4707,12 @@ def test_search_jobs_for_alert_non_empty_request_with_auto_populated_field(): client.search_jobs_for_alert(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == job_service.SearchJobsRequest( + request_msg = job_service.SearchJobsRequest( parent="parent_value", page_token="page_token_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_search_jobs_for_alert_use_cached_wrapped_rpc(): @@ -4772,8 +4798,15 @@ async def test_search_jobs_for_alert_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + job_service.SearchJobsRequest(), + {}, + ], +) async def test_search_jobs_for_alert_async( - transport: str = "grpc_asyncio", request_type=job_service.SearchJobsRequest + request_type, transport: str = "grpc_asyncio" ): client = JobServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4782,7 +4815,7 @@ async def test_search_jobs_for_alert_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( @@ -4811,11 +4844,6 @@ async def test_search_jobs_for_alert_async( assert response.broadened_query_jobs_count == 2766 -@pytest.mark.asyncio -async def test_search_jobs_for_alert_async_from_dict(): - await test_search_jobs_for_alert_async(request_type=dict) - - def test_search_jobs_for_alert_field_headers(): client = JobServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6806,7 +6834,6 @@ def test_create_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = job_service.CreateJobRequest() - assert args[0] == request_msg @@ -6829,7 +6856,6 @@ def test_batch_create_jobs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = job_service.BatchCreateJobsRequest() - assert args[0] == request_msg @@ -6850,7 +6876,6 @@ def test_get_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = job_service.GetJobRequest() - assert args[0] == request_msg @@ -6871,7 +6896,6 @@ def test_update_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = job_service.UpdateJobRequest() - assert args[0] == request_msg @@ -6894,7 +6918,6 @@ def test_batch_update_jobs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = job_service.BatchUpdateJobsRequest() - assert args[0] == request_msg @@ -6915,7 +6938,6 @@ def test_delete_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = job_service.DeleteJobRequest() - assert args[0] == request_msg @@ -6938,7 +6960,6 @@ def test_batch_delete_jobs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = job_service.BatchDeleteJobsRequest() - assert args[0] == request_msg @@ -6959,7 +6980,6 @@ def test_list_jobs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = job_service.ListJobsRequest() - assert args[0] == request_msg @@ -6980,7 +7000,6 @@ def test_search_jobs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = job_service.SearchJobsRequest() - assert args[0] == request_msg @@ -7003,7 +7022,6 @@ def test_search_jobs_for_alert_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = job_service.SearchJobsRequest() - assert args[0] == request_msg @@ -7062,7 +7080,6 @@ async def test_create_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = job_service.CreateJobRequest() - assert args[0] == request_msg @@ -7089,7 +7106,6 @@ async def test_batch_create_jobs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = job_service.BatchCreateJobsRequest() - assert args[0] == request_msg @@ -7134,7 +7150,6 @@ async def test_get_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = job_service.GetJobRequest() - assert args[0] == request_msg @@ -7179,7 +7194,6 @@ async def test_update_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = job_service.UpdateJobRequest() - assert args[0] == request_msg @@ -7206,7 +7220,6 @@ async def test_batch_update_jobs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = job_service.BatchUpdateJobsRequest() - assert args[0] == request_msg @@ -7229,7 +7242,6 @@ async def test_delete_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = job_service.DeleteJobRequest() - assert args[0] == request_msg @@ -7256,7 +7268,6 @@ async def test_batch_delete_jobs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = job_service.BatchDeleteJobsRequest() - assert args[0] == request_msg @@ -7283,7 +7294,6 @@ async def test_list_jobs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = job_service.ListJobsRequest() - assert args[0] == request_msg @@ -7312,7 +7322,6 @@ async def test_search_jobs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = job_service.SearchJobsRequest() - assert args[0] == request_msg @@ -7343,7 +7352,6 @@ async def test_search_jobs_for_alert_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = job_service.SearchJobsRequest() - assert args[0] == request_msg @@ -9096,7 +9104,6 @@ def test_create_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = job_service.CreateJobRequest() - assert args[0] == request_msg @@ -9118,7 +9125,6 @@ def test_batch_create_jobs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = job_service.BatchCreateJobsRequest() - assert args[0] == request_msg @@ -9138,7 +9144,6 @@ def test_get_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = job_service.GetJobRequest() - assert args[0] == request_msg @@ -9158,7 +9163,6 @@ def test_update_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = job_service.UpdateJobRequest() - assert args[0] == request_msg @@ -9180,7 +9184,6 @@ def test_batch_update_jobs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = job_service.BatchUpdateJobsRequest() - assert args[0] == request_msg @@ -9200,7 +9203,6 @@ def test_delete_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = job_service.DeleteJobRequest() - assert args[0] == request_msg @@ -9222,7 +9224,6 @@ def test_batch_delete_jobs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = job_service.BatchDeleteJobsRequest() - assert args[0] == request_msg @@ -9242,7 +9243,6 @@ def test_list_jobs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = job_service.ListJobsRequest() - assert args[0] == request_msg @@ -9262,7 +9262,6 @@ def test_search_jobs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = job_service.SearchJobsRequest() - assert args[0] == request_msg @@ -9284,7 +9283,6 @@ def test_search_jobs_for_alert_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = job_service.SearchJobsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-talent/tests/unit/gapic/talent_v4/test_tenant_service.py b/packages/google-cloud-talent/tests/unit/gapic/talent_v4/test_tenant_service.py index eda0b2606301..fbf535da05a0 100644 --- a/packages/google-cloud-talent/tests/unit/gapic/talent_v4/test_tenant_service.py +++ b/packages/google-cloud-talent/tests/unit/gapic/talent_v4/test_tenant_service.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 @@ -110,6 +111,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" @@ -1312,8 +1328,8 @@ def test_tenant_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - tenant_service.CreateTenantRequest, - dict, + tenant_service.CreateTenantRequest(), + {}, ], ) def test_create_tenant(request_type, transport: str = "grpc"): @@ -1324,7 +1340,7 @@ def test_create_tenant(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tenant), "__call__") as call: @@ -1370,9 +1386,10 @@ def test_create_tenant_non_empty_request_with_auto_populated_field(): client.create_tenant(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tenant_service.CreateTenantRequest( + request_msg = tenant_service.CreateTenantRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_tenant_use_cached_wrapped_rpc(): @@ -1453,9 +1470,14 @@ async def test_create_tenant_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_tenant_async( - transport: str = "grpc_asyncio", request_type=tenant_service.CreateTenantRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tenant_service.CreateTenantRequest(), + {}, + ], +) +async def test_create_tenant_async(request_type, transport: str = "grpc_asyncio"): client = TenantServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1463,7 +1485,7 @@ async def test_create_tenant_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_tenant), "__call__") as call: @@ -1488,11 +1510,6 @@ async def test_create_tenant_async( assert response.external_id == "external_id_value" -@pytest.mark.asyncio -async def test_create_tenant_async_from_dict(): - await test_create_tenant_async(request_type=dict) - - def test_create_tenant_field_headers(): client = TenantServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1645,8 +1662,8 @@ async def test_create_tenant_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - tenant_service.GetTenantRequest, - dict, + tenant_service.GetTenantRequest(), + {}, ], ) def test_get_tenant(request_type, transport: str = "grpc"): @@ -1657,7 +1674,7 @@ def test_get_tenant(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tenant), "__call__") as call: @@ -1703,9 +1720,10 @@ def test_get_tenant_non_empty_request_with_auto_populated_field(): client.get_tenant(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tenant_service.GetTenantRequest( + request_msg = tenant_service.GetTenantRequest( name="name_value", ) + assert args[0] == request_msg def test_get_tenant_use_cached_wrapped_rpc(): @@ -1784,9 +1802,14 @@ async def test_get_tenant_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_tenant_async( - transport: str = "grpc_asyncio", request_type=tenant_service.GetTenantRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tenant_service.GetTenantRequest(), + {}, + ], +) +async def test_get_tenant_async(request_type, transport: str = "grpc_asyncio"): client = TenantServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1794,7 +1817,7 @@ async def test_get_tenant_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_tenant), "__call__") as call: @@ -1819,11 +1842,6 @@ async def test_get_tenant_async( assert response.external_id == "external_id_value" -@pytest.mark.asyncio -async def test_get_tenant_async_from_dict(): - await test_get_tenant_async(request_type=dict) - - def test_get_tenant_field_headers(): client = TenantServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1966,8 +1984,8 @@ async def test_get_tenant_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - tenant_service.UpdateTenantRequest, - dict, + tenant_service.UpdateTenantRequest(), + {}, ], ) def test_update_tenant(request_type, transport: str = "grpc"): @@ -1978,7 +1996,7 @@ def test_update_tenant(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tenant), "__call__") as call: @@ -2022,7 +2040,8 @@ def test_update_tenant_non_empty_request_with_auto_populated_field(): client.update_tenant(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tenant_service.UpdateTenantRequest() + request_msg = tenant_service.UpdateTenantRequest() + assert args[0] == request_msg def test_update_tenant_use_cached_wrapped_rpc(): @@ -2103,9 +2122,14 @@ async def test_update_tenant_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_tenant_async( - transport: str = "grpc_asyncio", request_type=tenant_service.UpdateTenantRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tenant_service.UpdateTenantRequest(), + {}, + ], +) +async def test_update_tenant_async(request_type, transport: str = "grpc_asyncio"): client = TenantServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2113,7 +2137,7 @@ async def test_update_tenant_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_tenant), "__call__") as call: @@ -2138,11 +2162,6 @@ async def test_update_tenant_async( assert response.external_id == "external_id_value" -@pytest.mark.asyncio -async def test_update_tenant_async_from_dict(): - await test_update_tenant_async(request_type=dict) - - def test_update_tenant_field_headers(): client = TenantServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2295,8 +2314,8 @@ async def test_update_tenant_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - tenant_service.DeleteTenantRequest, - dict, + tenant_service.DeleteTenantRequest(), + {}, ], ) def test_delete_tenant(request_type, transport: str = "grpc"): @@ -2307,7 +2326,7 @@ def test_delete_tenant(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tenant), "__call__") as call: @@ -2348,9 +2367,10 @@ def test_delete_tenant_non_empty_request_with_auto_populated_field(): client.delete_tenant(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tenant_service.DeleteTenantRequest( + request_msg = tenant_service.DeleteTenantRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_tenant_use_cached_wrapped_rpc(): @@ -2431,9 +2451,14 @@ async def test_delete_tenant_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_tenant_async( - transport: str = "grpc_asyncio", request_type=tenant_service.DeleteTenantRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tenant_service.DeleteTenantRequest(), + {}, + ], +) +async def test_delete_tenant_async(request_type, transport: str = "grpc_asyncio"): client = TenantServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2441,7 +2466,7 @@ async def test_delete_tenant_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_tenant), "__call__") as call: @@ -2459,11 +2484,6 @@ async def test_delete_tenant_async( assert response is None -@pytest.mark.asyncio -async def test_delete_tenant_async_from_dict(): - await test_delete_tenant_async(request_type=dict) - - def test_delete_tenant_field_headers(): client = TenantServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2606,8 +2626,8 @@ async def test_delete_tenant_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - tenant_service.ListTenantsRequest, - dict, + tenant_service.ListTenantsRequest(), + {}, ], ) def test_list_tenants(request_type, transport: str = "grpc"): @@ -2618,7 +2638,7 @@ def test_list_tenants(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tenants), "__call__") as call: @@ -2663,10 +2683,11 @@ def test_list_tenants_non_empty_request_with_auto_populated_field(): client.list_tenants(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tenant_service.ListTenantsRequest( + request_msg = tenant_service.ListTenantsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_tenants_use_cached_wrapped_rpc(): @@ -2747,9 +2768,14 @@ async def test_list_tenants_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_tenants_async( - transport: str = "grpc_asyncio", request_type=tenant_service.ListTenantsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tenant_service.ListTenantsRequest(), + {}, + ], +) +async def test_list_tenants_async(request_type, transport: str = "grpc_asyncio"): client = TenantServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2757,7 +2783,7 @@ async def test_list_tenants_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_tenants), "__call__") as call: @@ -2780,11 +2806,6 @@ async def test_list_tenants_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_tenants_async_from_dict(): - await test_list_tenants_async(request_type=dict) - - def test_list_tenants_field_headers(): client = TenantServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4203,7 +4224,6 @@ def test_create_tenant_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tenant_service.CreateTenantRequest() - assert args[0] == request_msg @@ -4224,7 +4244,6 @@ def test_get_tenant_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tenant_service.GetTenantRequest() - assert args[0] == request_msg @@ -4245,7 +4264,6 @@ def test_update_tenant_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tenant_service.UpdateTenantRequest() - assert args[0] == request_msg @@ -4266,7 +4284,6 @@ def test_delete_tenant_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tenant_service.DeleteTenantRequest() - assert args[0] == request_msg @@ -4287,7 +4304,6 @@ def test_list_tenants_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tenant_service.ListTenantsRequest() - assert args[0] == request_msg @@ -4329,7 +4345,6 @@ async def test_create_tenant_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tenant_service.CreateTenantRequest() - assert args[0] == request_msg @@ -4357,7 +4372,6 @@ async def test_get_tenant_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tenant_service.GetTenantRequest() - assert args[0] == request_msg @@ -4385,7 +4399,6 @@ async def test_update_tenant_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tenant_service.UpdateTenantRequest() - assert args[0] == request_msg @@ -4408,7 +4421,6 @@ async def test_delete_tenant_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tenant_service.DeleteTenantRequest() - assert args[0] == request_msg @@ -4435,7 +4447,6 @@ async def test_list_tenants_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tenant_service.ListTenantsRequest() - assert args[0] == request_msg @@ -5305,7 +5316,6 @@ def test_create_tenant_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tenant_service.CreateTenantRequest() - assert args[0] == request_msg @@ -5325,7 +5335,6 @@ def test_get_tenant_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tenant_service.GetTenantRequest() - assert args[0] == request_msg @@ -5345,7 +5354,6 @@ def test_update_tenant_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tenant_service.UpdateTenantRequest() - assert args[0] == request_msg @@ -5365,7 +5373,6 @@ def test_delete_tenant_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tenant_service.DeleteTenantRequest() - assert args[0] == request_msg @@ -5385,7 +5392,6 @@ def test_list_tenants_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tenant_service.ListTenantsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-talent/tests/unit/gapic/talent_v4beta1/test_company_service.py b/packages/google-cloud-talent/tests/unit/gapic/talent_v4beta1/test_company_service.py index f113e6a92dad..2072e51cc8c1 100644 --- a/packages/google-cloud-talent/tests/unit/gapic/talent_v4beta1/test_company_service.py +++ b/packages/google-cloud-talent/tests/unit/gapic/talent_v4beta1/test_company_service.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" @@ -1318,8 +1334,8 @@ def test_company_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - company_service.CreateCompanyRequest, - dict, + company_service.CreateCompanyRequest(), + {}, ], ) def test_create_company(request_type, transport: str = "grpc"): @@ -1330,7 +1346,7 @@ def test_create_company(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_company), "__call__") as call: @@ -1400,9 +1416,10 @@ def test_create_company_non_empty_request_with_auto_populated_field(): client.create_company(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == company_service.CreateCompanyRequest( + request_msg = company_service.CreateCompanyRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_company_use_cached_wrapped_rpc(): @@ -1483,9 +1500,14 @@ async def test_create_company_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_company_async( - transport: str = "grpc_asyncio", request_type=company_service.CreateCompanyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + company_service.CreateCompanyRequest(), + {}, + ], +) +async def test_create_company_async(request_type, transport: str = "grpc_asyncio"): client = CompanyServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1493,7 +1515,7 @@ async def test_create_company_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_company), "__call__") as call: @@ -1542,11 +1564,6 @@ async def test_create_company_async( assert response.suspended is True -@pytest.mark.asyncio -async def test_create_company_async_from_dict(): - await test_create_company_async(request_type=dict) - - def test_create_company_field_headers(): client = CompanyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1699,8 +1716,8 @@ async def test_create_company_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - company_service.GetCompanyRequest, - dict, + company_service.GetCompanyRequest(), + {}, ], ) def test_get_company(request_type, transport: str = "grpc"): @@ -1711,7 +1728,7 @@ def test_get_company(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_company), "__call__") as call: @@ -1781,9 +1798,10 @@ def test_get_company_non_empty_request_with_auto_populated_field(): client.get_company(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == company_service.GetCompanyRequest( + request_msg = company_service.GetCompanyRequest( name="name_value", ) + assert args[0] == request_msg def test_get_company_use_cached_wrapped_rpc(): @@ -1864,9 +1882,14 @@ async def test_get_company_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_company_async( - transport: str = "grpc_asyncio", request_type=company_service.GetCompanyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + company_service.GetCompanyRequest(), + {}, + ], +) +async def test_get_company_async(request_type, transport: str = "grpc_asyncio"): client = CompanyServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1874,7 +1897,7 @@ async def test_get_company_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_company), "__call__") as call: @@ -1923,11 +1946,6 @@ async def test_get_company_async( assert response.suspended is True -@pytest.mark.asyncio -async def test_get_company_async_from_dict(): - await test_get_company_async(request_type=dict) - - def test_get_company_field_headers(): client = CompanyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2070,8 +2088,8 @@ async def test_get_company_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - company_service.UpdateCompanyRequest, - dict, + company_service.UpdateCompanyRequest(), + {}, ], ) def test_update_company(request_type, transport: str = "grpc"): @@ -2082,7 +2100,7 @@ def test_update_company(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_company), "__call__") as call: @@ -2150,7 +2168,8 @@ def test_update_company_non_empty_request_with_auto_populated_field(): client.update_company(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == company_service.UpdateCompanyRequest() + request_msg = company_service.UpdateCompanyRequest() + assert args[0] == request_msg def test_update_company_use_cached_wrapped_rpc(): @@ -2231,9 +2250,14 @@ async def test_update_company_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_company_async( - transport: str = "grpc_asyncio", request_type=company_service.UpdateCompanyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + company_service.UpdateCompanyRequest(), + {}, + ], +) +async def test_update_company_async(request_type, transport: str = "grpc_asyncio"): client = CompanyServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2241,7 +2265,7 @@ async def test_update_company_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_company), "__call__") as call: @@ -2290,11 +2314,6 @@ async def test_update_company_async( assert response.suspended is True -@pytest.mark.asyncio -async def test_update_company_async_from_dict(): - await test_update_company_async(request_type=dict) - - def test_update_company_field_headers(): client = CompanyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2437,8 +2456,8 @@ async def test_update_company_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - company_service.DeleteCompanyRequest, - dict, + company_service.DeleteCompanyRequest(), + {}, ], ) def test_delete_company(request_type, transport: str = "grpc"): @@ -2449,7 +2468,7 @@ def test_delete_company(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_company), "__call__") as call: @@ -2490,9 +2509,10 @@ def test_delete_company_non_empty_request_with_auto_populated_field(): client.delete_company(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == company_service.DeleteCompanyRequest( + request_msg = company_service.DeleteCompanyRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_company_use_cached_wrapped_rpc(): @@ -2573,9 +2593,14 @@ async def test_delete_company_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_company_async( - transport: str = "grpc_asyncio", request_type=company_service.DeleteCompanyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + company_service.DeleteCompanyRequest(), + {}, + ], +) +async def test_delete_company_async(request_type, transport: str = "grpc_asyncio"): client = CompanyServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2583,7 +2608,7 @@ async def test_delete_company_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_company), "__call__") as call: @@ -2601,11 +2626,6 @@ async def test_delete_company_async( assert response is None -@pytest.mark.asyncio -async def test_delete_company_async_from_dict(): - await test_delete_company_async(request_type=dict) - - def test_delete_company_field_headers(): client = CompanyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2748,8 +2768,8 @@ async def test_delete_company_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - company_service.ListCompaniesRequest, - dict, + company_service.ListCompaniesRequest(), + {}, ], ) def test_list_companies(request_type, transport: str = "grpc"): @@ -2760,7 +2780,7 @@ def test_list_companies(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_companies), "__call__") as call: @@ -2805,10 +2825,11 @@ def test_list_companies_non_empty_request_with_auto_populated_field(): client.list_companies(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == company_service.ListCompaniesRequest( + request_msg = company_service.ListCompaniesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_companies_use_cached_wrapped_rpc(): @@ -2889,9 +2910,14 @@ async def test_list_companies_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_companies_async( - transport: str = "grpc_asyncio", request_type=company_service.ListCompaniesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + company_service.ListCompaniesRequest(), + {}, + ], +) +async def test_list_companies_async(request_type, transport: str = "grpc_asyncio"): client = CompanyServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2899,7 +2925,7 @@ async def test_list_companies_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_companies), "__call__") as call: @@ -2922,11 +2948,6 @@ async def test_list_companies_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_companies_async_from_dict(): - await test_list_companies_async(request_type=dict) - - def test_list_companies_field_headers(): client = CompanyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4357,7 +4378,6 @@ def test_create_company_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = company_service.CreateCompanyRequest() - assert args[0] == request_msg @@ -4378,7 +4398,6 @@ def test_get_company_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = company_service.GetCompanyRequest() - assert args[0] == request_msg @@ -4399,7 +4418,6 @@ def test_update_company_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = company_service.UpdateCompanyRequest() - assert args[0] == request_msg @@ -4420,7 +4438,6 @@ def test_delete_company_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = company_service.DeleteCompanyRequest() - assert args[0] == request_msg @@ -4441,7 +4458,6 @@ def test_list_companies_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = company_service.ListCompaniesRequest() - assert args[0] == request_msg @@ -4495,7 +4511,6 @@ async def test_create_company_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = company_service.CreateCompanyRequest() - assert args[0] == request_msg @@ -4535,7 +4550,6 @@ async def test_get_company_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = company_service.GetCompanyRequest() - assert args[0] == request_msg @@ -4575,7 +4589,6 @@ async def test_update_company_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = company_service.UpdateCompanyRequest() - assert args[0] == request_msg @@ -4598,7 +4611,6 @@ async def test_delete_company_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = company_service.DeleteCompanyRequest() - assert args[0] == request_msg @@ -4625,7 +4637,6 @@ async def test_list_companies_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = company_service.ListCompaniesRequest() - assert args[0] == request_msg @@ -5440,7 +5451,6 @@ def test_create_company_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = company_service.CreateCompanyRequest() - assert args[0] == request_msg @@ -5460,7 +5470,6 @@ def test_get_company_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = company_service.GetCompanyRequest() - assert args[0] == request_msg @@ -5480,7 +5489,6 @@ def test_update_company_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = company_service.UpdateCompanyRequest() - assert args[0] == request_msg @@ -5500,7 +5508,6 @@ def test_delete_company_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = company_service.DeleteCompanyRequest() - assert args[0] == request_msg @@ -5520,7 +5527,6 @@ def test_list_companies_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = company_service.ListCompaniesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-talent/tests/unit/gapic/talent_v4beta1/test_completion.py b/packages/google-cloud-talent/tests/unit/gapic/talent_v4beta1/test_completion.py index 845ae0a96c56..26a5ef4fc351 100644 --- a/packages/google-cloud-talent/tests/unit/gapic/talent_v4beta1/test_completion.py +++ b/packages/google-cloud-talent/tests/unit/gapic/talent_v4beta1/test_completion.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 @@ -107,6 +108,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" @@ -1271,8 +1287,8 @@ def test_completion_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - completion_service.CompleteQueryRequest, - dict, + completion_service.CompleteQueryRequest(), + {}, ], ) def test_complete_query(request_type, transport: str = "grpc"): @@ -1283,7 +1299,7 @@ def test_complete_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(type(client.transport.complete_query), "__call__") as call: @@ -1326,11 +1342,12 @@ def test_complete_query_non_empty_request_with_auto_populated_field(): client.complete_query(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == completion_service.CompleteQueryRequest( + request_msg = completion_service.CompleteQueryRequest( parent="parent_value", query="query_value", company="company_value", ) + assert args[0] == request_msg def test_complete_query_use_cached_wrapped_rpc(): @@ -1411,10 +1428,14 @@ async def test_complete_query_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_complete_query_async( - transport: str = "grpc_asyncio", - request_type=completion_service.CompleteQueryRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + completion_service.CompleteQueryRequest(), + {}, + ], +) +async def test_complete_query_async(request_type, transport: str = "grpc_asyncio"): client = CompletionAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1422,7 +1443,7 @@ async def test_complete_query_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.complete_query), "__call__") as call: @@ -1442,11 +1463,6 @@ async def test_complete_query_async( assert isinstance(response, completion_service.CompleteQueryResponse) -@pytest.mark.asyncio -async def test_complete_query_async_from_dict(): - await test_complete_query_async(request_type=dict) - - def test_complete_query_field_headers(): client = CompletionClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1804,7 +1820,6 @@ def test_complete_query_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = completion_service.CompleteQueryRequest() - assert args[0] == request_msg @@ -1843,7 +1858,6 @@ async def test_complete_query_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = completion_service.CompleteQueryRequest() - assert args[0] == request_msg @@ -2072,7 +2086,6 @@ def test_complete_query_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = completion_service.CompleteQueryRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-talent/tests/unit/gapic/talent_v4beta1/test_event_service.py b/packages/google-cloud-talent/tests/unit/gapic/talent_v4beta1/test_event_service.py index 391026e03546..85dbccce9579 100644 --- a/packages/google-cloud-talent/tests/unit/gapic/talent_v4beta1/test_event_service.py +++ b/packages/google-cloud-talent/tests/unit/gapic/talent_v4beta1/test_event_service.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 @@ -108,6 +109,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" @@ -1291,8 +1307,8 @@ def test_event_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - event_service.CreateClientEventRequest, - dict, + event_service.CreateClientEventRequest(), + {}, ], ) def test_create_client_event(request_type, transport: str = "grpc"): @@ -1303,7 +1319,7 @@ def test_create_client_event(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1355,9 +1371,10 @@ def test_create_client_event_non_empty_request_with_auto_populated_field(): client.create_client_event(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == event_service.CreateClientEventRequest( + request_msg = event_service.CreateClientEventRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_client_event_use_cached_wrapped_rpc(): @@ -1442,9 +1459,14 @@ async def test_create_client_event_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_client_event_async( - transport: str = "grpc_asyncio", request_type=event_service.CreateClientEventRequest -): +@pytest.mark.parametrize( + "request_type", + [ + event_service.CreateClientEventRequest(), + {}, + ], +) +async def test_create_client_event_async(request_type, transport: str = "grpc_asyncio"): client = EventServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1452,7 +1474,7 @@ async def test_create_client_event_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( @@ -1481,11 +1503,6 @@ async def test_create_client_event_async( assert response.event_notes == "event_notes_value" -@pytest.mark.asyncio -async def test_create_client_event_async_from_dict(): - await test_create_client_event_async(request_type=dict) - - def test_create_client_event_field_headers(): client = EventServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1961,7 +1978,6 @@ def test_create_client_event_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = event_service.CreateClientEventRequest() - assert args[0] == request_msg @@ -2006,7 +2022,6 @@ async def test_create_client_event_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = event_service.CreateClientEventRequest() - assert args[0] == request_msg @@ -2240,7 +2255,6 @@ def test_create_client_event_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = event_service.CreateClientEventRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-talent/tests/unit/gapic/talent_v4beta1/test_job_service.py b/packages/google-cloud-talent/tests/unit/gapic/talent_v4beta1/test_job_service.py index 97b71c080e26..98ba9352823a 100644 --- a/packages/google-cloud-talent/tests/unit/gapic/talent_v4beta1/test_job_service.py +++ b/packages/google-cloud-talent/tests/unit/gapic/talent_v4beta1/test_job_service.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 @@ -127,6 +128,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" @@ -1291,8 +1307,8 @@ def test_job_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - job_service.CreateJobRequest, - dict, + job_service.CreateJobRequest(), + {}, ], ) def test_create_job(request_type, transport: str = "grpc"): @@ -1303,7 +1319,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() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_job), "__call__") as call: @@ -1383,9 +1399,10 @@ def test_create_job_non_empty_request_with_auto_populated_field(): client.create_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == job_service.CreateJobRequest( + request_msg = job_service.CreateJobRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_job_use_cached_wrapped_rpc(): @@ -1464,9 +1481,14 @@ async def test_create_job_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_create_job_async( - transport: str = "grpc_asyncio", request_type=job_service.CreateJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + job_service.CreateJobRequest(), + {}, + ], +) +async def test_create_job_async(request_type, transport: str = "grpc_asyncio"): client = JobServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1474,7 +1496,7 @@ async def test_create_job_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_job), "__call__") as call: @@ -1533,11 +1555,6 @@ async def test_create_job_async( assert response.company_display_name == "company_display_name_value" -@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 = JobServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1690,8 +1707,8 @@ async def test_create_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - job_service.BatchCreateJobsRequest, - dict, + job_service.BatchCreateJobsRequest(), + {}, ], ) def test_batch_create_jobs(request_type, transport: str = "grpc"): @@ -1702,7 +1719,7 @@ def test_batch_create_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( @@ -1747,9 +1764,10 @@ def test_batch_create_jobs_non_empty_request_with_auto_populated_field(): client.batch_create_jobs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == job_service.BatchCreateJobsRequest( + request_msg = job_service.BatchCreateJobsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_batch_create_jobs_use_cached_wrapped_rpc(): @@ -1842,9 +1860,14 @@ async def test_batch_create_jobs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_batch_create_jobs_async( - transport: str = "grpc_asyncio", request_type=job_service.BatchCreateJobsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + job_service.BatchCreateJobsRequest(), + {}, + ], +) +async def test_batch_create_jobs_async(request_type, transport: str = "grpc_asyncio"): client = JobServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1852,7 +1875,7 @@ async def test_batch_create_jobs_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( @@ -1874,11 +1897,6 @@ async def test_batch_create_jobs_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_batch_create_jobs_async_from_dict(): - await test_batch_create_jobs_async(request_type=dict) - - def test_batch_create_jobs_field_headers(): client = JobServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2043,8 +2061,8 @@ async def test_batch_create_jobs_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - job_service.GetJobRequest, - dict, + job_service.GetJobRequest(), + {}, ], ) def test_get_job(request_type, transport: str = "grpc"): @@ -2055,7 +2073,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(type(client.transport.get_job), "__call__") as call: @@ -2135,9 +2153,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] == job_service.GetJobRequest( + request_msg = job_service.GetJobRequest( name="name_value", ) + assert args[0] == request_msg def test_get_job_use_cached_wrapped_rpc(): @@ -2216,9 +2235,14 @@ async def test_get_job_async_use_cached_wrapped_rpc(transport: str = "grpc_async @pytest.mark.asyncio -async def test_get_job_async( - transport: str = "grpc_asyncio", request_type=job_service.GetJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + job_service.GetJobRequest(), + {}, + ], +) +async def test_get_job_async(request_type, transport: str = "grpc_asyncio"): client = JobServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2226,7 +2250,7 @@ async def test_get_job_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_job), "__call__") as call: @@ -2285,11 +2309,6 @@ async def test_get_job_async( assert response.company_display_name == "company_display_name_value" -@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 = JobServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2432,8 +2451,8 @@ async def test_get_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - job_service.UpdateJobRequest, - dict, + job_service.UpdateJobRequest(), + {}, ], ) def test_update_job(request_type, transport: str = "grpc"): @@ -2444,7 +2463,7 @@ def test_update_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(type(client.transport.update_job), "__call__") as call: @@ -2522,7 +2541,8 @@ def test_update_job_non_empty_request_with_auto_populated_field(): client.update_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == job_service.UpdateJobRequest() + request_msg = job_service.UpdateJobRequest() + assert args[0] == request_msg def test_update_job_use_cached_wrapped_rpc(): @@ -2601,9 +2621,14 @@ async def test_update_job_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_update_job_async( - transport: str = "grpc_asyncio", request_type=job_service.UpdateJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + job_service.UpdateJobRequest(), + {}, + ], +) +async def test_update_job_async(request_type, transport: str = "grpc_asyncio"): client = JobServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2611,7 +2636,7 @@ async def test_update_job_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_job), "__call__") as call: @@ -2670,11 +2695,6 @@ async def test_update_job_async( assert response.company_display_name == "company_display_name_value" -@pytest.mark.asyncio -async def test_update_job_async_from_dict(): - await test_update_job_async(request_type=dict) - - def test_update_job_field_headers(): client = JobServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2817,8 +2837,8 @@ async def test_update_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - job_service.BatchUpdateJobsRequest, - dict, + job_service.BatchUpdateJobsRequest(), + {}, ], ) def test_batch_update_jobs(request_type, transport: str = "grpc"): @@ -2829,7 +2849,7 @@ def test_batch_update_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( @@ -2874,9 +2894,10 @@ def test_batch_update_jobs_non_empty_request_with_auto_populated_field(): client.batch_update_jobs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == job_service.BatchUpdateJobsRequest( + request_msg = job_service.BatchUpdateJobsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_batch_update_jobs_use_cached_wrapped_rpc(): @@ -2969,9 +2990,14 @@ async def test_batch_update_jobs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_batch_update_jobs_async( - transport: str = "grpc_asyncio", request_type=job_service.BatchUpdateJobsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + job_service.BatchUpdateJobsRequest(), + {}, + ], +) +async def test_batch_update_jobs_async(request_type, transport: str = "grpc_asyncio"): client = JobServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2979,7 +3005,7 @@ async def test_batch_update_jobs_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( @@ -3001,11 +3027,6 @@ async def test_batch_update_jobs_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_batch_update_jobs_async_from_dict(): - await test_batch_update_jobs_async(request_type=dict) - - def test_batch_update_jobs_field_headers(): client = JobServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3170,8 +3191,8 @@ async def test_batch_update_jobs_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - job_service.DeleteJobRequest, - dict, + job_service.DeleteJobRequest(), + {}, ], ) def test_delete_job(request_type, transport: str = "grpc"): @@ -3182,7 +3203,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() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_job), "__call__") as call: @@ -3223,9 +3244,10 @@ def test_delete_job_non_empty_request_with_auto_populated_field(): client.delete_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == job_service.DeleteJobRequest( + request_msg = job_service.DeleteJobRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_job_use_cached_wrapped_rpc(): @@ -3304,9 +3326,14 @@ async def test_delete_job_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_delete_job_async( - transport: str = "grpc_asyncio", request_type=job_service.DeleteJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + job_service.DeleteJobRequest(), + {}, + ], +) +async def test_delete_job_async(request_type, transport: str = "grpc_asyncio"): client = JobServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3314,7 +3341,7 @@ async def test_delete_job_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_job), "__call__") as call: @@ -3332,11 +3359,6 @@ async def test_delete_job_async( 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 = JobServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3479,8 +3501,8 @@ async def test_delete_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - job_service.BatchDeleteJobsRequest, - dict, + job_service.BatchDeleteJobsRequest(), + {}, ], ) def test_batch_delete_jobs(request_type, transport: str = "grpc"): @@ -3491,7 +3513,7 @@ def test_batch_delete_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( @@ -3537,10 +3559,11 @@ def test_batch_delete_jobs_non_empty_request_with_auto_populated_field(): client.batch_delete_jobs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == job_service.BatchDeleteJobsRequest( + request_msg = job_service.BatchDeleteJobsRequest( parent="parent_value", filter="filter_value", ) + assert args[0] == request_msg def test_batch_delete_jobs_use_cached_wrapped_rpc(): @@ -3623,9 +3646,14 @@ async def test_batch_delete_jobs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_batch_delete_jobs_async( - transport: str = "grpc_asyncio", request_type=job_service.BatchDeleteJobsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + job_service.BatchDeleteJobsRequest(), + {}, + ], +) +async def test_batch_delete_jobs_async(request_type, transport: str = "grpc_asyncio"): client = JobServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3633,7 +3661,7 @@ async def test_batch_delete_jobs_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( @@ -3653,11 +3681,6 @@ async def test_batch_delete_jobs_async( assert response is None -@pytest.mark.asyncio -async def test_batch_delete_jobs_async_from_dict(): - await test_batch_delete_jobs_async(request_type=dict) - - def test_batch_delete_jobs_field_headers(): client = JobServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3818,8 +3841,8 @@ async def test_batch_delete_jobs_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - job_service.ListJobsRequest, - dict, + job_service.ListJobsRequest(), + {}, ], ) def test_list_jobs(request_type, transport: str = "grpc"): @@ -3830,7 +3853,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(type(client.transport.list_jobs), "__call__") as call: @@ -3876,11 +3899,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] - assert args[0] == job_service.ListJobsRequest( + request_msg = job_service.ListJobsRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_jobs_use_cached_wrapped_rpc(): @@ -3959,9 +3983,14 @@ async def test_list_jobs_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_list_jobs_async( - transport: str = "grpc_asyncio", request_type=job_service.ListJobsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + job_service.ListJobsRequest(), + {}, + ], +) +async def test_list_jobs_async(request_type, transport: str = "grpc_asyncio"): client = JobServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3969,7 +3998,7 @@ async def test_list_jobs_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_jobs), "__call__") as call: @@ -3992,11 +4021,6 @@ async def test_list_jobs_async( assert response.next_page_token == "next_page_token_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 = JobServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4343,8 +4367,8 @@ async def test_list_jobs_async_pages(): @pytest.mark.parametrize( "request_type", [ - job_service.SearchJobsRequest, - dict, + job_service.SearchJobsRequest(), + {}, ], ) def test_search_jobs(request_type, transport: str = "grpc"): @@ -4355,7 +4379,7 @@ def test_search_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(type(client.transport.search_jobs), "__call__") as call: @@ -4407,11 +4431,12 @@ def test_search_jobs_non_empty_request_with_auto_populated_field(): client.search_jobs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == job_service.SearchJobsRequest( + request_msg = job_service.SearchJobsRequest( parent="parent_value", page_token="page_token_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_search_jobs_use_cached_wrapped_rpc(): @@ -4492,9 +4517,14 @@ async def test_search_jobs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_search_jobs_async( - transport: str = "grpc_asyncio", request_type=job_service.SearchJobsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + job_service.SearchJobsRequest(), + {}, + ], +) +async def test_search_jobs_async(request_type, transport: str = "grpc_asyncio"): client = JobServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4502,7 +4532,7 @@ async def test_search_jobs_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.search_jobs), "__call__") as call: @@ -4531,11 +4561,6 @@ async def test_search_jobs_async( assert response.broadened_query_jobs_count == 2766 -@pytest.mark.asyncio -async def test_search_jobs_async_from_dict(): - await test_search_jobs_async(request_type=dict) - - def test_search_jobs_field_headers(): client = JobServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4794,8 +4819,8 @@ async def test_search_jobs_async_pages(): @pytest.mark.parametrize( "request_type", [ - job_service.SearchJobsRequest, - dict, + job_service.SearchJobsRequest(), + {}, ], ) def test_search_jobs_for_alert(request_type, transport: str = "grpc"): @@ -4806,7 +4831,7 @@ def test_search_jobs_for_alert(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,11 +4887,12 @@ def test_search_jobs_for_alert_non_empty_request_with_auto_populated_field(): client.search_jobs_for_alert(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == job_service.SearchJobsRequest( + request_msg = job_service.SearchJobsRequest( parent="parent_value", page_token="page_token_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_search_jobs_for_alert_use_cached_wrapped_rpc(): @@ -4952,8 +4978,15 @@ async def test_search_jobs_for_alert_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + job_service.SearchJobsRequest(), + {}, + ], +) async def test_search_jobs_for_alert_async( - transport: str = "grpc_asyncio", request_type=job_service.SearchJobsRequest + request_type, transport: str = "grpc_asyncio" ): client = JobServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4962,7 +4995,7 @@ async def test_search_jobs_for_alert_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( @@ -4993,11 +5026,6 @@ async def test_search_jobs_for_alert_async( assert response.broadened_query_jobs_count == 2766 -@pytest.mark.asyncio -async def test_search_jobs_for_alert_async_from_dict(): - await test_search_jobs_for_alert_async(request_type=dict) - - def test_search_jobs_for_alert_field_headers(): client = JobServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7325,7 +7353,6 @@ def test_create_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = job_service.CreateJobRequest() - assert args[0] == request_msg @@ -7348,7 +7375,6 @@ def test_batch_create_jobs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = job_service.BatchCreateJobsRequest() - assert args[0] == request_msg @@ -7369,7 +7395,6 @@ def test_get_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = job_service.GetJobRequest() - assert args[0] == request_msg @@ -7390,7 +7415,6 @@ def test_update_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = job_service.UpdateJobRequest() - assert args[0] == request_msg @@ -7413,7 +7437,6 @@ def test_batch_update_jobs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = job_service.BatchUpdateJobsRequest() - assert args[0] == request_msg @@ -7434,7 +7457,6 @@ def test_delete_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = job_service.DeleteJobRequest() - assert args[0] == request_msg @@ -7457,7 +7479,6 @@ def test_batch_delete_jobs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = job_service.BatchDeleteJobsRequest() - assert args[0] == request_msg @@ -7478,7 +7499,6 @@ def test_list_jobs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = job_service.ListJobsRequest() - assert args[0] == request_msg @@ -7499,7 +7519,6 @@ def test_search_jobs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = job_service.SearchJobsRequest() - assert args[0] == request_msg @@ -7522,7 +7541,6 @@ def test_search_jobs_for_alert_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = job_service.SearchJobsRequest() - assert args[0] == request_msg @@ -7581,7 +7599,6 @@ async def test_create_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = job_service.CreateJobRequest() - assert args[0] == request_msg @@ -7608,7 +7625,6 @@ async def test_batch_create_jobs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = job_service.BatchCreateJobsRequest() - assert args[0] == request_msg @@ -7653,7 +7669,6 @@ async def test_get_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = job_service.GetJobRequest() - assert args[0] == request_msg @@ -7698,7 +7713,6 @@ async def test_update_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = job_service.UpdateJobRequest() - assert args[0] == request_msg @@ -7725,7 +7739,6 @@ async def test_batch_update_jobs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = job_service.BatchUpdateJobsRequest() - assert args[0] == request_msg @@ -7748,7 +7761,6 @@ async def test_delete_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = job_service.DeleteJobRequest() - assert args[0] == request_msg @@ -7773,7 +7785,6 @@ async def test_batch_delete_jobs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = job_service.BatchDeleteJobsRequest() - assert args[0] == request_msg @@ -7800,7 +7811,6 @@ async def test_list_jobs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = job_service.ListJobsRequest() - assert args[0] == request_msg @@ -7830,7 +7840,6 @@ async def test_search_jobs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = job_service.SearchJobsRequest() - assert args[0] == request_msg @@ -7862,7 +7871,6 @@ async def test_search_jobs_for_alert_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = job_service.SearchJobsRequest() - assert args[0] == request_msg @@ -9304,7 +9312,6 @@ def test_create_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = job_service.CreateJobRequest() - assert args[0] == request_msg @@ -9326,7 +9333,6 @@ def test_batch_create_jobs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = job_service.BatchCreateJobsRequest() - assert args[0] == request_msg @@ -9346,7 +9352,6 @@ def test_get_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = job_service.GetJobRequest() - assert args[0] == request_msg @@ -9366,7 +9371,6 @@ def test_update_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = job_service.UpdateJobRequest() - assert args[0] == request_msg @@ -9388,7 +9392,6 @@ def test_batch_update_jobs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = job_service.BatchUpdateJobsRequest() - assert args[0] == request_msg @@ -9408,7 +9411,6 @@ def test_delete_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = job_service.DeleteJobRequest() - assert args[0] == request_msg @@ -9430,7 +9432,6 @@ def test_batch_delete_jobs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = job_service.BatchDeleteJobsRequest() - assert args[0] == request_msg @@ -9450,7 +9451,6 @@ def test_list_jobs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = job_service.ListJobsRequest() - assert args[0] == request_msg @@ -9470,7 +9470,6 @@ def test_search_jobs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = job_service.SearchJobsRequest() - assert args[0] == request_msg @@ -9492,7 +9491,6 @@ def test_search_jobs_for_alert_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = job_service.SearchJobsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-talent/tests/unit/gapic/talent_v4beta1/test_tenant_service.py b/packages/google-cloud-talent/tests/unit/gapic/talent_v4beta1/test_tenant_service.py index 55e33250be2a..4c1be12c065d 100644 --- a/packages/google-cloud-talent/tests/unit/gapic/talent_v4beta1/test_tenant_service.py +++ b/packages/google-cloud-talent/tests/unit/gapic/talent_v4beta1/test_tenant_service.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 @@ -110,6 +111,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" @@ -1312,8 +1328,8 @@ def test_tenant_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - tenant_service.CreateTenantRequest, - dict, + tenant_service.CreateTenantRequest(), + {}, ], ) def test_create_tenant(request_type, transport: str = "grpc"): @@ -1324,7 +1340,7 @@ def test_create_tenant(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tenant), "__call__") as call: @@ -1378,9 +1394,10 @@ def test_create_tenant_non_empty_request_with_auto_populated_field(): client.create_tenant(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tenant_service.CreateTenantRequest( + request_msg = tenant_service.CreateTenantRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_tenant_use_cached_wrapped_rpc(): @@ -1461,9 +1478,14 @@ async def test_create_tenant_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_tenant_async( - transport: str = "grpc_asyncio", request_type=tenant_service.CreateTenantRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tenant_service.CreateTenantRequest(), + {}, + ], +) +async def test_create_tenant_async(request_type, transport: str = "grpc_asyncio"): client = TenantServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1471,7 +1493,7 @@ async def test_create_tenant_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_tenant), "__call__") as call: @@ -1504,11 +1526,6 @@ async def test_create_tenant_async( ] -@pytest.mark.asyncio -async def test_create_tenant_async_from_dict(): - await test_create_tenant_async(request_type=dict) - - def test_create_tenant_field_headers(): client = TenantServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1661,8 +1678,8 @@ async def test_create_tenant_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - tenant_service.GetTenantRequest, - dict, + tenant_service.GetTenantRequest(), + {}, ], ) def test_get_tenant(request_type, transport: str = "grpc"): @@ -1673,7 +1690,7 @@ def test_get_tenant(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tenant), "__call__") as call: @@ -1727,9 +1744,10 @@ def test_get_tenant_non_empty_request_with_auto_populated_field(): client.get_tenant(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tenant_service.GetTenantRequest( + request_msg = tenant_service.GetTenantRequest( name="name_value", ) + assert args[0] == request_msg def test_get_tenant_use_cached_wrapped_rpc(): @@ -1808,9 +1826,14 @@ async def test_get_tenant_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_tenant_async( - transport: str = "grpc_asyncio", request_type=tenant_service.GetTenantRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tenant_service.GetTenantRequest(), + {}, + ], +) +async def test_get_tenant_async(request_type, transport: str = "grpc_asyncio"): client = TenantServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1818,7 +1841,7 @@ async def test_get_tenant_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_tenant), "__call__") as call: @@ -1851,11 +1874,6 @@ async def test_get_tenant_async( ] -@pytest.mark.asyncio -async def test_get_tenant_async_from_dict(): - await test_get_tenant_async(request_type=dict) - - def test_get_tenant_field_headers(): client = TenantServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1998,8 +2016,8 @@ async def test_get_tenant_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - tenant_service.UpdateTenantRequest, - dict, + tenant_service.UpdateTenantRequest(), + {}, ], ) def test_update_tenant(request_type, transport: str = "grpc"): @@ -2010,7 +2028,7 @@ def test_update_tenant(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tenant), "__call__") as call: @@ -2062,7 +2080,8 @@ def test_update_tenant_non_empty_request_with_auto_populated_field(): client.update_tenant(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tenant_service.UpdateTenantRequest() + request_msg = tenant_service.UpdateTenantRequest() + assert args[0] == request_msg def test_update_tenant_use_cached_wrapped_rpc(): @@ -2143,9 +2162,14 @@ async def test_update_tenant_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_tenant_async( - transport: str = "grpc_asyncio", request_type=tenant_service.UpdateTenantRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tenant_service.UpdateTenantRequest(), + {}, + ], +) +async def test_update_tenant_async(request_type, transport: str = "grpc_asyncio"): client = TenantServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2153,7 +2177,7 @@ async def test_update_tenant_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_tenant), "__call__") as call: @@ -2186,11 +2210,6 @@ async def test_update_tenant_async( ] -@pytest.mark.asyncio -async def test_update_tenant_async_from_dict(): - await test_update_tenant_async(request_type=dict) - - def test_update_tenant_field_headers(): client = TenantServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2333,8 +2352,8 @@ async def test_update_tenant_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - tenant_service.DeleteTenantRequest, - dict, + tenant_service.DeleteTenantRequest(), + {}, ], ) def test_delete_tenant(request_type, transport: str = "grpc"): @@ -2345,7 +2364,7 @@ def test_delete_tenant(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tenant), "__call__") as call: @@ -2386,9 +2405,10 @@ def test_delete_tenant_non_empty_request_with_auto_populated_field(): client.delete_tenant(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tenant_service.DeleteTenantRequest( + request_msg = tenant_service.DeleteTenantRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_tenant_use_cached_wrapped_rpc(): @@ -2469,9 +2489,14 @@ async def test_delete_tenant_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_tenant_async( - transport: str = "grpc_asyncio", request_type=tenant_service.DeleteTenantRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tenant_service.DeleteTenantRequest(), + {}, + ], +) +async def test_delete_tenant_async(request_type, transport: str = "grpc_asyncio"): client = TenantServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2479,7 +2504,7 @@ async def test_delete_tenant_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_tenant), "__call__") as call: @@ -2497,11 +2522,6 @@ async def test_delete_tenant_async( assert response is None -@pytest.mark.asyncio -async def test_delete_tenant_async_from_dict(): - await test_delete_tenant_async(request_type=dict) - - def test_delete_tenant_field_headers(): client = TenantServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2644,8 +2664,8 @@ async def test_delete_tenant_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - tenant_service.ListTenantsRequest, - dict, + tenant_service.ListTenantsRequest(), + {}, ], ) def test_list_tenants(request_type, transport: str = "grpc"): @@ -2656,7 +2676,7 @@ def test_list_tenants(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tenants), "__call__") as call: @@ -2701,10 +2721,11 @@ def test_list_tenants_non_empty_request_with_auto_populated_field(): client.list_tenants(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tenant_service.ListTenantsRequest( + request_msg = tenant_service.ListTenantsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_tenants_use_cached_wrapped_rpc(): @@ -2785,9 +2806,14 @@ async def test_list_tenants_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_tenants_async( - transport: str = "grpc_asyncio", request_type=tenant_service.ListTenantsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tenant_service.ListTenantsRequest(), + {}, + ], +) +async def test_list_tenants_async(request_type, transport: str = "grpc_asyncio"): client = TenantServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2795,7 +2821,7 @@ async def test_list_tenants_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_tenants), "__call__") as call: @@ -2818,11 +2844,6 @@ async def test_list_tenants_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_tenants_async_from_dict(): - await test_list_tenants_async(request_type=dict) - - def test_list_tenants_field_headers(): client = TenantServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4238,7 +4259,6 @@ def test_create_tenant_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tenant_service.CreateTenantRequest() - assert args[0] == request_msg @@ -4259,7 +4279,6 @@ def test_get_tenant_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tenant_service.GetTenantRequest() - assert args[0] == request_msg @@ -4280,7 +4299,6 @@ def test_update_tenant_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tenant_service.UpdateTenantRequest() - assert args[0] == request_msg @@ -4301,7 +4319,6 @@ def test_delete_tenant_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tenant_service.DeleteTenantRequest() - assert args[0] == request_msg @@ -4322,7 +4339,6 @@ def test_list_tenants_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tenant_service.ListTenantsRequest() - assert args[0] == request_msg @@ -4368,7 +4384,6 @@ async def test_create_tenant_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tenant_service.CreateTenantRequest() - assert args[0] == request_msg @@ -4400,7 +4415,6 @@ async def test_get_tenant_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tenant_service.GetTenantRequest() - assert args[0] == request_msg @@ -4432,7 +4446,6 @@ async def test_update_tenant_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tenant_service.UpdateTenantRequest() - assert args[0] == request_msg @@ -4455,7 +4468,6 @@ async def test_delete_tenant_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tenant_service.DeleteTenantRequest() - assert args[0] == request_msg @@ -4482,7 +4494,6 @@ async def test_list_tenants_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tenant_service.ListTenantsRequest() - assert args[0] == request_msg @@ -5237,7 +5248,6 @@ def test_create_tenant_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tenant_service.CreateTenantRequest() - assert args[0] == request_msg @@ -5257,7 +5267,6 @@ def test_get_tenant_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tenant_service.GetTenantRequest() - assert args[0] == request_msg @@ -5277,7 +5286,6 @@ def test_update_tenant_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tenant_service.UpdateTenantRequest() - assert args[0] == request_msg @@ -5297,7 +5305,6 @@ def test_delete_tenant_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tenant_service.DeleteTenantRequest() - assert args[0] == request_msg @@ -5317,7 +5324,6 @@ def test_list_tenants_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tenant_service.ListTenantsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-tasks/noxfile.py b/packages/google-cloud-tasks/noxfile.py index 88953882770c..5d43c1960802 100644 --- a/packages/google-cloud-tasks/noxfile.py +++ b/packages/google-cloud-tasks/noxfile.py @@ -47,7 +47,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-tasks" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-tasks/setup.py b/packages/google-cloud-tasks/setup.py index 9156cf879944..36fb9a623d04 100644 --- a/packages/google-cloud-tasks/setup.py +++ b/packages/google-cloud-tasks/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/google-cloud-tasks/testing/constraints-3.10.txt b/packages/google-cloud-tasks/testing/constraints-3.10.txt index a92801e1c8e2..b39cd54634f9 100644 --- a/packages/google-cloud-tasks/testing/constraints-3.10.txt +++ b/packages/google-cloud-tasks/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/google-cloud-tasks/tests/unit/gapic/tasks_v2/test_cloud_tasks.py b/packages/google-cloud-tasks/tests/unit/gapic/tasks_v2/test_cloud_tasks.py index 406a4813c28a..25d9a119f929 100644 --- a/packages/google-cloud-tasks/tests/unit/gapic/tasks_v2/test_cloud_tasks.py +++ b/packages/google-cloud-tasks/tests/unit/gapic/tasks_v2/test_cloud_tasks.py @@ -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 @@ -119,6 +120,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" @@ -1280,8 +1296,8 @@ def test_cloud_tasks_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - cloudtasks.ListQueuesRequest, - dict, + cloudtasks.ListQueuesRequest(), + {}, ], ) def test_list_queues(request_type, transport: str = "grpc"): @@ -1292,7 +1308,7 @@ def test_list_queues(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_queues), "__call__") as call: @@ -1338,11 +1354,12 @@ def test_list_queues_non_empty_request_with_auto_populated_field(): client.list_queues(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudtasks.ListQueuesRequest( + request_msg = cloudtasks.ListQueuesRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_queues_use_cached_wrapped_rpc(): @@ -1423,9 +1440,14 @@ async def test_list_queues_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_queues_async( - transport: str = "grpc_asyncio", request_type=cloudtasks.ListQueuesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudtasks.ListQueuesRequest(), + {}, + ], +) +async def test_list_queues_async(request_type, transport: str = "grpc_asyncio"): client = CloudTasksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1433,7 +1455,7 @@ async def test_list_queues_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_queues), "__call__") as call: @@ -1456,11 +1478,6 @@ async def test_list_queues_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_queues_async_from_dict(): - await test_list_queues_async(request_type=dict) - - def test_list_queues_field_headers(): client = CloudTasksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1797,8 +1814,8 @@ async def test_list_queues_async_pages(): @pytest.mark.parametrize( "request_type", [ - cloudtasks.GetQueueRequest, - dict, + cloudtasks.GetQueueRequest(), + {}, ], ) def test_get_queue(request_type, transport: str = "grpc"): @@ -1809,7 +1826,7 @@ def test_get_queue(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_queue), "__call__") as call: @@ -1855,9 +1872,10 @@ def test_get_queue_non_empty_request_with_auto_populated_field(): client.get_queue(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudtasks.GetQueueRequest( + request_msg = cloudtasks.GetQueueRequest( name="name_value", ) + assert args[0] == request_msg def test_get_queue_use_cached_wrapped_rpc(): @@ -1936,9 +1954,14 @@ async def test_get_queue_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_queue_async( - transport: str = "grpc_asyncio", request_type=cloudtasks.GetQueueRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudtasks.GetQueueRequest(), + {}, + ], +) +async def test_get_queue_async(request_type, transport: str = "grpc_asyncio"): client = CloudTasksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1946,7 +1969,7 @@ async def test_get_queue_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_queue), "__call__") as call: @@ -1971,11 +1994,6 @@ async def test_get_queue_async( assert response.state == queue.Queue.State.RUNNING -@pytest.mark.asyncio -async def test_get_queue_async_from_dict(): - await test_get_queue_async(request_type=dict) - - def test_get_queue_field_headers(): client = CloudTasksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2118,8 +2136,8 @@ async def test_get_queue_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloudtasks.CreateQueueRequest, - dict, + cloudtasks.CreateQueueRequest(), + {}, ], ) def test_create_queue(request_type, transport: str = "grpc"): @@ -2130,7 +2148,7 @@ def test_create_queue(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_queue), "__call__") as call: @@ -2176,9 +2194,10 @@ def test_create_queue_non_empty_request_with_auto_populated_field(): client.create_queue(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudtasks.CreateQueueRequest( + request_msg = cloudtasks.CreateQueueRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_queue_use_cached_wrapped_rpc(): @@ -2259,9 +2278,14 @@ async def test_create_queue_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_queue_async( - transport: str = "grpc_asyncio", request_type=cloudtasks.CreateQueueRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudtasks.CreateQueueRequest(), + {}, + ], +) +async def test_create_queue_async(request_type, transport: str = "grpc_asyncio"): client = CloudTasksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2269,7 +2293,7 @@ async def test_create_queue_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_queue), "__call__") as call: @@ -2294,11 +2318,6 @@ async def test_create_queue_async( assert response.state == gct_queue.Queue.State.RUNNING -@pytest.mark.asyncio -async def test_create_queue_async_from_dict(): - await test_create_queue_async(request_type=dict) - - def test_create_queue_field_headers(): client = CloudTasksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2451,8 +2470,8 @@ async def test_create_queue_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloudtasks.UpdateQueueRequest, - dict, + cloudtasks.UpdateQueueRequest(), + {}, ], ) def test_update_queue(request_type, transport: str = "grpc"): @@ -2463,7 +2482,7 @@ def test_update_queue(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_queue), "__call__") as call: @@ -2507,7 +2526,8 @@ def test_update_queue_non_empty_request_with_auto_populated_field(): client.update_queue(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudtasks.UpdateQueueRequest() + request_msg = cloudtasks.UpdateQueueRequest() + assert args[0] == request_msg def test_update_queue_use_cached_wrapped_rpc(): @@ -2588,9 +2608,14 @@ async def test_update_queue_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_queue_async( - transport: str = "grpc_asyncio", request_type=cloudtasks.UpdateQueueRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudtasks.UpdateQueueRequest(), + {}, + ], +) +async def test_update_queue_async(request_type, transport: str = "grpc_asyncio"): client = CloudTasksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2598,7 +2623,7 @@ async def test_update_queue_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_queue), "__call__") as call: @@ -2623,11 +2648,6 @@ async def test_update_queue_async( assert response.state == gct_queue.Queue.State.RUNNING -@pytest.mark.asyncio -async def test_update_queue_async_from_dict(): - await test_update_queue_async(request_type=dict) - - def test_update_queue_field_headers(): client = CloudTasksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2780,8 +2800,8 @@ async def test_update_queue_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloudtasks.DeleteQueueRequest, - dict, + cloudtasks.DeleteQueueRequest(), + {}, ], ) def test_delete_queue(request_type, transport: str = "grpc"): @@ -2792,7 +2812,7 @@ def test_delete_queue(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_queue), "__call__") as call: @@ -2833,9 +2853,10 @@ def test_delete_queue_non_empty_request_with_auto_populated_field(): client.delete_queue(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudtasks.DeleteQueueRequest( + request_msg = cloudtasks.DeleteQueueRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_queue_use_cached_wrapped_rpc(): @@ -2916,9 +2937,14 @@ async def test_delete_queue_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_queue_async( - transport: str = "grpc_asyncio", request_type=cloudtasks.DeleteQueueRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudtasks.DeleteQueueRequest(), + {}, + ], +) +async def test_delete_queue_async(request_type, transport: str = "grpc_asyncio"): client = CloudTasksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2926,7 +2952,7 @@ async def test_delete_queue_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_queue), "__call__") as call: @@ -2944,11 +2970,6 @@ async def test_delete_queue_async( assert response is None -@pytest.mark.asyncio -async def test_delete_queue_async_from_dict(): - await test_delete_queue_async(request_type=dict) - - def test_delete_queue_field_headers(): client = CloudTasksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3091,8 +3112,8 @@ async def test_delete_queue_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloudtasks.PurgeQueueRequest, - dict, + cloudtasks.PurgeQueueRequest(), + {}, ], ) def test_purge_queue(request_type, transport: str = "grpc"): @@ -3103,7 +3124,7 @@ def test_purge_queue(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.purge_queue), "__call__") as call: @@ -3149,9 +3170,10 @@ def test_purge_queue_non_empty_request_with_auto_populated_field(): client.purge_queue(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudtasks.PurgeQueueRequest( + request_msg = cloudtasks.PurgeQueueRequest( name="name_value", ) + assert args[0] == request_msg def test_purge_queue_use_cached_wrapped_rpc(): @@ -3232,9 +3254,14 @@ async def test_purge_queue_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_purge_queue_async( - transport: str = "grpc_asyncio", request_type=cloudtasks.PurgeQueueRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudtasks.PurgeQueueRequest(), + {}, + ], +) +async def test_purge_queue_async(request_type, transport: str = "grpc_asyncio"): client = CloudTasksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3242,7 +3269,7 @@ async def test_purge_queue_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.purge_queue), "__call__") as call: @@ -3267,11 +3294,6 @@ async def test_purge_queue_async( assert response.state == queue.Queue.State.RUNNING -@pytest.mark.asyncio -async def test_purge_queue_async_from_dict(): - await test_purge_queue_async(request_type=dict) - - def test_purge_queue_field_headers(): client = CloudTasksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3414,8 +3436,8 @@ async def test_purge_queue_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloudtasks.PauseQueueRequest, - dict, + cloudtasks.PauseQueueRequest(), + {}, ], ) def test_pause_queue(request_type, transport: str = "grpc"): @@ -3426,7 +3448,7 @@ def test_pause_queue(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.pause_queue), "__call__") as call: @@ -3472,9 +3494,10 @@ def test_pause_queue_non_empty_request_with_auto_populated_field(): client.pause_queue(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudtasks.PauseQueueRequest( + request_msg = cloudtasks.PauseQueueRequest( name="name_value", ) + assert args[0] == request_msg def test_pause_queue_use_cached_wrapped_rpc(): @@ -3555,9 +3578,14 @@ async def test_pause_queue_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_pause_queue_async( - transport: str = "grpc_asyncio", request_type=cloudtasks.PauseQueueRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudtasks.PauseQueueRequest(), + {}, + ], +) +async def test_pause_queue_async(request_type, transport: str = "grpc_asyncio"): client = CloudTasksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3565,7 +3593,7 @@ async def test_pause_queue_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.pause_queue), "__call__") as call: @@ -3590,11 +3618,6 @@ async def test_pause_queue_async( assert response.state == queue.Queue.State.RUNNING -@pytest.mark.asyncio -async def test_pause_queue_async_from_dict(): - await test_pause_queue_async(request_type=dict) - - def test_pause_queue_field_headers(): client = CloudTasksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3737,8 +3760,8 @@ async def test_pause_queue_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloudtasks.ResumeQueueRequest, - dict, + cloudtasks.ResumeQueueRequest(), + {}, ], ) def test_resume_queue(request_type, transport: str = "grpc"): @@ -3749,7 +3772,7 @@ def test_resume_queue(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.resume_queue), "__call__") as call: @@ -3795,9 +3818,10 @@ def test_resume_queue_non_empty_request_with_auto_populated_field(): client.resume_queue(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudtasks.ResumeQueueRequest( + request_msg = cloudtasks.ResumeQueueRequest( name="name_value", ) + assert args[0] == request_msg def test_resume_queue_use_cached_wrapped_rpc(): @@ -3878,9 +3902,14 @@ async def test_resume_queue_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_resume_queue_async( - transport: str = "grpc_asyncio", request_type=cloudtasks.ResumeQueueRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudtasks.ResumeQueueRequest(), + {}, + ], +) +async def test_resume_queue_async(request_type, transport: str = "grpc_asyncio"): client = CloudTasksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3888,7 +3917,7 @@ async def test_resume_queue_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.resume_queue), "__call__") as call: @@ -3913,11 +3942,6 @@ async def test_resume_queue_async( assert response.state == queue.Queue.State.RUNNING -@pytest.mark.asyncio -async def test_resume_queue_async_from_dict(): - await test_resume_queue_async(request_type=dict) - - def test_resume_queue_field_headers(): client = CloudTasksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4060,8 +4084,8 @@ async def test_resume_queue_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.GetIamPolicyRequest, - dict, + iam_policy_pb2.GetIamPolicyRequest(), + {}, ], ) def test_get_iam_policy(request_type, transport: str = "grpc"): @@ -4072,7 +4096,7 @@ def test_get_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(type(client.transport.get_iam_policy), "__call__") as call: @@ -4118,9 +4142,10 @@ def test_get_iam_policy_non_empty_request_with_auto_populated_field(): client.get_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.GetIamPolicyRequest( + request_msg = iam_policy_pb2.GetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_get_iam_policy_use_cached_wrapped_rpc(): @@ -4201,9 +4226,14 @@ async def test_get_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.GetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.GetIamPolicyRequest(), + {}, + ], +) +async def test_get_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = CloudTasksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4211,7 +4241,7 @@ async def test_get_iam_policy_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_iam_policy), "__call__") as call: @@ -4236,11 +4266,6 @@ async def test_get_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_get_iam_policy_async_from_dict(): - await test_get_iam_policy_async(request_type=dict) - - def test_get_iam_policy_field_headers(): client = CloudTasksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4400,8 +4425,8 @@ async def test_get_iam_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.SetIamPolicyRequest, - dict, + iam_policy_pb2.SetIamPolicyRequest(), + {}, ], ) def test_set_iam_policy(request_type, transport: str = "grpc"): @@ -4412,7 +4437,7 @@ def test_set_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(type(client.transport.set_iam_policy), "__call__") as call: @@ -4458,9 +4483,10 @@ def test_set_iam_policy_non_empty_request_with_auto_populated_field(): client.set_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.SetIamPolicyRequest( + request_msg = iam_policy_pb2.SetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_set_iam_policy_use_cached_wrapped_rpc(): @@ -4541,9 +4567,14 @@ async def test_set_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.SetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.SetIamPolicyRequest(), + {}, + ], +) +async def test_set_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = CloudTasksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4551,7 +4582,7 @@ async def test_set_iam_policy_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.set_iam_policy), "__call__") as call: @@ -4576,11 +4607,6 @@ async def test_set_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_set_iam_policy_async_from_dict(): - await test_set_iam_policy_async(request_type=dict) - - def test_set_iam_policy_field_headers(): client = CloudTasksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4741,8 +4767,8 @@ async def test_set_iam_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.TestIamPermissionsRequest, - dict, + iam_policy_pb2.TestIamPermissionsRequest(), + {}, ], ) def test_test_iam_permissions(request_type, transport: str = "grpc"): @@ -4753,7 +4779,7 @@ def test_test_iam_permissions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4801,9 +4827,10 @@ def test_test_iam_permissions_non_empty_request_with_auto_populated_field(): client.test_iam_permissions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.TestIamPermissionsRequest( + request_msg = iam_policy_pb2.TestIamPermissionsRequest( resource="resource_value", ) + assert args[0] == request_msg def test_test_iam_permissions_use_cached_wrapped_rpc(): @@ -4888,9 +4915,15 @@ async def test_test_iam_permissions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.TestIamPermissionsRequest(), + {}, + ], +) async def test_test_iam_permissions_async( - transport: str = "grpc_asyncio", - request_type=iam_policy_pb2.TestIamPermissionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = CloudTasksAsyncClient( credentials=async_anonymous_credentials(), @@ -4899,7 +4932,7 @@ async def test_test_iam_permissions_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( @@ -4924,11 +4957,6 @@ async def test_test_iam_permissions_async( assert response.permissions == ["permissions_value"] -@pytest.mark.asyncio -async def test_test_iam_permissions_async_from_dict(): - await test_test_iam_permissions_async(request_type=dict) - - def test_test_iam_permissions_field_headers(): client = CloudTasksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5112,8 +5140,8 @@ async def test_test_iam_permissions_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloudtasks.ListTasksRequest, - dict, + cloudtasks.ListTasksRequest(), + {}, ], ) def test_list_tasks(request_type, transport: str = "grpc"): @@ -5124,7 +5152,7 @@ def test_list_tasks(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tasks), "__call__") as call: @@ -5169,10 +5197,11 @@ def test_list_tasks_non_empty_request_with_auto_populated_field(): client.list_tasks(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudtasks.ListTasksRequest( + request_msg = cloudtasks.ListTasksRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_tasks_use_cached_wrapped_rpc(): @@ -5251,9 +5280,14 @@ async def test_list_tasks_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_list_tasks_async( - transport: str = "grpc_asyncio", request_type=cloudtasks.ListTasksRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudtasks.ListTasksRequest(), + {}, + ], +) +async def test_list_tasks_async(request_type, transport: str = "grpc_asyncio"): client = CloudTasksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5261,7 +5295,7 @@ async def test_list_tasks_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_tasks), "__call__") as call: @@ -5284,11 +5318,6 @@ async def test_list_tasks_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_tasks_async_from_dict(): - await test_list_tasks_async(request_type=dict) - - def test_list_tasks_field_headers(): client = CloudTasksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5625,8 +5654,8 @@ async def test_list_tasks_async_pages(): @pytest.mark.parametrize( "request_type", [ - cloudtasks.GetTaskRequest, - dict, + cloudtasks.GetTaskRequest(), + {}, ], ) def test_get_task(request_type, transport: str = "grpc"): @@ -5637,7 +5666,7 @@ def test_get_task(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_task), "__call__") as call: @@ -5687,9 +5716,10 @@ def test_get_task_non_empty_request_with_auto_populated_field(): client.get_task(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudtasks.GetTaskRequest( + request_msg = cloudtasks.GetTaskRequest( name="name_value", ) + assert args[0] == request_msg def test_get_task_use_cached_wrapped_rpc(): @@ -5768,9 +5798,14 @@ async def test_get_task_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn @pytest.mark.asyncio -async def test_get_task_async( - transport: str = "grpc_asyncio", request_type=cloudtasks.GetTaskRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudtasks.GetTaskRequest(), + {}, + ], +) +async def test_get_task_async(request_type, transport: str = "grpc_asyncio"): client = CloudTasksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5778,7 +5813,7 @@ async def test_get_task_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_task), "__call__") as call: @@ -5807,11 +5842,6 @@ async def test_get_task_async( assert response.view == task.Task.View.BASIC -@pytest.mark.asyncio -async def test_get_task_async_from_dict(): - await test_get_task_async(request_type=dict) - - def test_get_task_field_headers(): client = CloudTasksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5954,8 +5984,8 @@ async def test_get_task_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloudtasks.CreateTaskRequest, - dict, + cloudtasks.CreateTaskRequest(), + {}, ], ) def test_create_task(request_type, transport: str = "grpc"): @@ -5966,7 +5996,7 @@ def test_create_task(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_task), "__call__") as call: @@ -6016,9 +6046,10 @@ def test_create_task_non_empty_request_with_auto_populated_field(): client.create_task(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudtasks.CreateTaskRequest( + request_msg = cloudtasks.CreateTaskRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_task_use_cached_wrapped_rpc(): @@ -6099,9 +6130,14 @@ async def test_create_task_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_task_async( - transport: str = "grpc_asyncio", request_type=cloudtasks.CreateTaskRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudtasks.CreateTaskRequest(), + {}, + ], +) +async def test_create_task_async(request_type, transport: str = "grpc_asyncio"): client = CloudTasksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6109,7 +6145,7 @@ async def test_create_task_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_task), "__call__") as call: @@ -6138,11 +6174,6 @@ async def test_create_task_async( assert response.view == gct_task.Task.View.BASIC -@pytest.mark.asyncio -async def test_create_task_async_from_dict(): - await test_create_task_async(request_type=dict) - - def test_create_task_field_headers(): client = CloudTasksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6295,8 +6326,8 @@ async def test_create_task_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloudtasks.DeleteTaskRequest, - dict, + cloudtasks.DeleteTaskRequest(), + {}, ], ) def test_delete_task(request_type, transport: str = "grpc"): @@ -6307,7 +6338,7 @@ def test_delete_task(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_task), "__call__") as call: @@ -6348,9 +6379,10 @@ def test_delete_task_non_empty_request_with_auto_populated_field(): client.delete_task(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudtasks.DeleteTaskRequest( + request_msg = cloudtasks.DeleteTaskRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_task_use_cached_wrapped_rpc(): @@ -6431,9 +6463,14 @@ async def test_delete_task_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_task_async( - transport: str = "grpc_asyncio", request_type=cloudtasks.DeleteTaskRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudtasks.DeleteTaskRequest(), + {}, + ], +) +async def test_delete_task_async(request_type, transport: str = "grpc_asyncio"): client = CloudTasksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6441,7 +6478,7 @@ async def test_delete_task_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_task), "__call__") as call: @@ -6459,11 +6496,6 @@ async def test_delete_task_async( assert response is None -@pytest.mark.asyncio -async def test_delete_task_async_from_dict(): - await test_delete_task_async(request_type=dict) - - def test_delete_task_field_headers(): client = CloudTasksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6606,8 +6638,8 @@ async def test_delete_task_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloudtasks.RunTaskRequest, - dict, + cloudtasks.RunTaskRequest(), + {}, ], ) def test_run_task(request_type, transport: str = "grpc"): @@ -6618,7 +6650,7 @@ def test_run_task(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.run_task), "__call__") as call: @@ -6668,9 +6700,10 @@ def test_run_task_non_empty_request_with_auto_populated_field(): client.run_task(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudtasks.RunTaskRequest( + request_msg = cloudtasks.RunTaskRequest( name="name_value", ) + assert args[0] == request_msg def test_run_task_use_cached_wrapped_rpc(): @@ -6749,9 +6782,14 @@ async def test_run_task_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn @pytest.mark.asyncio -async def test_run_task_async( - transport: str = "grpc_asyncio", request_type=cloudtasks.RunTaskRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudtasks.RunTaskRequest(), + {}, + ], +) +async def test_run_task_async(request_type, transport: str = "grpc_asyncio"): client = CloudTasksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6759,7 +6797,7 @@ async def test_run_task_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.run_task), "__call__") as call: @@ -6788,11 +6826,6 @@ async def test_run_task_async( assert response.view == task.Task.View.BASIC -@pytest.mark.asyncio -async def test_run_task_async_from_dict(): - await test_run_task_async(request_type=dict) - - def test_run_task_field_headers(): client = CloudTasksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10078,7 +10111,6 @@ def test_list_queues_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.ListQueuesRequest() - assert args[0] == request_msg @@ -10099,7 +10131,6 @@ def test_get_queue_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.GetQueueRequest() - assert args[0] == request_msg @@ -10120,7 +10151,6 @@ def test_create_queue_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.CreateQueueRequest() - assert args[0] == request_msg @@ -10141,7 +10171,6 @@ def test_update_queue_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.UpdateQueueRequest() - assert args[0] == request_msg @@ -10162,7 +10191,6 @@ def test_delete_queue_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.DeleteQueueRequest() - assert args[0] == request_msg @@ -10183,7 +10211,6 @@ def test_purge_queue_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.PurgeQueueRequest() - assert args[0] == request_msg @@ -10204,7 +10231,6 @@ def test_pause_queue_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.PauseQueueRequest() - assert args[0] == request_msg @@ -10225,7 +10251,6 @@ def test_resume_queue_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.ResumeQueueRequest() - assert args[0] == request_msg @@ -10246,7 +10271,6 @@ def test_get_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -10267,7 +10291,6 @@ def test_set_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -10290,7 +10313,6 @@ def test_test_iam_permissions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -10311,7 +10333,6 @@ def test_list_tasks_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.ListTasksRequest() - assert args[0] == request_msg @@ -10332,7 +10353,6 @@ def test_get_task_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.GetTaskRequest() - assert args[0] == request_msg @@ -10353,7 +10373,6 @@ def test_create_task_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.CreateTaskRequest() - assert args[0] == request_msg @@ -10374,7 +10393,6 @@ def test_delete_task_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.DeleteTaskRequest() - assert args[0] == request_msg @@ -10395,7 +10413,6 @@ def test_run_task_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.RunTaskRequest() - assert args[0] == request_msg @@ -10436,7 +10453,6 @@ async def test_list_queues_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.ListQueuesRequest() - assert args[0] == request_msg @@ -10464,7 +10480,6 @@ async def test_get_queue_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.GetQueueRequest() - assert args[0] == request_msg @@ -10492,7 +10507,6 @@ async def test_create_queue_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.CreateQueueRequest() - assert args[0] == request_msg @@ -10520,7 +10534,6 @@ async def test_update_queue_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.UpdateQueueRequest() - assert args[0] == request_msg @@ -10543,7 +10556,6 @@ async def test_delete_queue_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.DeleteQueueRequest() - assert args[0] == request_msg @@ -10571,7 +10583,6 @@ async def test_purge_queue_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.PurgeQueueRequest() - assert args[0] == request_msg @@ -10599,7 +10610,6 @@ async def test_pause_queue_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.PauseQueueRequest() - assert args[0] == request_msg @@ -10627,7 +10637,6 @@ async def test_resume_queue_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.ResumeQueueRequest() - assert args[0] == request_msg @@ -10655,7 +10664,6 @@ async def test_get_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -10683,7 +10691,6 @@ async def test_set_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -10712,7 +10719,6 @@ async def test_test_iam_permissions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -10739,7 +10745,6 @@ async def test_list_tasks_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.ListTasksRequest() - assert args[0] == request_msg @@ -10769,7 +10774,6 @@ async def test_get_task_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.GetTaskRequest() - assert args[0] == request_msg @@ -10799,7 +10803,6 @@ async def test_create_task_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.CreateTaskRequest() - assert args[0] == request_msg @@ -10822,7 +10825,6 @@ async def test_delete_task_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.DeleteTaskRequest() - assert args[0] == request_msg @@ -10852,7 +10854,6 @@ async def test_run_task_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.RunTaskRequest() - assert args[0] == request_msg @@ -13217,7 +13218,6 @@ def test_list_queues_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.ListQueuesRequest() - assert args[0] == request_msg @@ -13237,7 +13237,6 @@ def test_get_queue_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.GetQueueRequest() - assert args[0] == request_msg @@ -13257,7 +13256,6 @@ def test_create_queue_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.CreateQueueRequest() - assert args[0] == request_msg @@ -13277,7 +13275,6 @@ def test_update_queue_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.UpdateQueueRequest() - assert args[0] == request_msg @@ -13297,7 +13294,6 @@ def test_delete_queue_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.DeleteQueueRequest() - assert args[0] == request_msg @@ -13317,7 +13313,6 @@ def test_purge_queue_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.PurgeQueueRequest() - assert args[0] == request_msg @@ -13337,7 +13332,6 @@ def test_pause_queue_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.PauseQueueRequest() - assert args[0] == request_msg @@ -13357,7 +13351,6 @@ def test_resume_queue_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.ResumeQueueRequest() - assert args[0] == request_msg @@ -13377,7 +13370,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -13397,7 +13389,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -13419,7 +13410,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -13439,7 +13429,6 @@ def test_list_tasks_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.ListTasksRequest() - assert args[0] == request_msg @@ -13459,7 +13448,6 @@ def test_get_task_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.GetTaskRequest() - assert args[0] == request_msg @@ -13479,7 +13467,6 @@ def test_create_task_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.CreateTaskRequest() - assert args[0] == request_msg @@ -13499,7 +13486,6 @@ def test_delete_task_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.DeleteTaskRequest() - assert args[0] == request_msg @@ -13519,7 +13505,6 @@ def test_run_task_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.RunTaskRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-tasks/tests/unit/gapic/tasks_v2beta2/test_cloud_tasks.py b/packages/google-cloud-tasks/tests/unit/gapic/tasks_v2beta2/test_cloud_tasks.py index 90efad328ea2..8a9296aca610 100644 --- a/packages/google-cloud-tasks/tests/unit/gapic/tasks_v2beta2/test_cloud_tasks.py +++ b/packages/google-cloud-tasks/tests/unit/gapic/tasks_v2beta2/test_cloud_tasks.py @@ -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 @@ -120,6 +121,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" @@ -1281,8 +1297,8 @@ def test_cloud_tasks_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - cloudtasks.ListQueuesRequest, - dict, + cloudtasks.ListQueuesRequest(), + {}, ], ) def test_list_queues(request_type, transport: str = "grpc"): @@ -1293,7 +1309,7 @@ def test_list_queues(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_queues), "__call__") as call: @@ -1339,11 +1355,12 @@ def test_list_queues_non_empty_request_with_auto_populated_field(): client.list_queues(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudtasks.ListQueuesRequest( + request_msg = cloudtasks.ListQueuesRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_queues_use_cached_wrapped_rpc(): @@ -1424,9 +1441,14 @@ async def test_list_queues_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_queues_async( - transport: str = "grpc_asyncio", request_type=cloudtasks.ListQueuesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudtasks.ListQueuesRequest(), + {}, + ], +) +async def test_list_queues_async(request_type, transport: str = "grpc_asyncio"): client = CloudTasksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1434,7 +1456,7 @@ async def test_list_queues_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_queues), "__call__") as call: @@ -1457,11 +1479,6 @@ async def test_list_queues_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_queues_async_from_dict(): - await test_list_queues_async(request_type=dict) - - def test_list_queues_field_headers(): client = CloudTasksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1798,8 +1815,8 @@ async def test_list_queues_async_pages(): @pytest.mark.parametrize( "request_type", [ - cloudtasks.GetQueueRequest, - dict, + cloudtasks.GetQueueRequest(), + {}, ], ) def test_get_queue(request_type, transport: str = "grpc"): @@ -1810,7 +1827,7 @@ def test_get_queue(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_queue), "__call__") as call: @@ -1856,9 +1873,10 @@ def test_get_queue_non_empty_request_with_auto_populated_field(): client.get_queue(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudtasks.GetQueueRequest( + request_msg = cloudtasks.GetQueueRequest( name="name_value", ) + assert args[0] == request_msg def test_get_queue_use_cached_wrapped_rpc(): @@ -1937,9 +1955,14 @@ async def test_get_queue_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_queue_async( - transport: str = "grpc_asyncio", request_type=cloudtasks.GetQueueRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudtasks.GetQueueRequest(), + {}, + ], +) +async def test_get_queue_async(request_type, transport: str = "grpc_asyncio"): client = CloudTasksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1947,7 +1970,7 @@ async def test_get_queue_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_queue), "__call__") as call: @@ -1972,11 +1995,6 @@ async def test_get_queue_async( assert response.state == queue.Queue.State.RUNNING -@pytest.mark.asyncio -async def test_get_queue_async_from_dict(): - await test_get_queue_async(request_type=dict) - - def test_get_queue_field_headers(): client = CloudTasksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2119,8 +2137,8 @@ async def test_get_queue_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloudtasks.CreateQueueRequest, - dict, + cloudtasks.CreateQueueRequest(), + {}, ], ) def test_create_queue(request_type, transport: str = "grpc"): @@ -2131,7 +2149,7 @@ def test_create_queue(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_queue), "__call__") as call: @@ -2177,9 +2195,10 @@ def test_create_queue_non_empty_request_with_auto_populated_field(): client.create_queue(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudtasks.CreateQueueRequest( + request_msg = cloudtasks.CreateQueueRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_queue_use_cached_wrapped_rpc(): @@ -2260,9 +2279,14 @@ async def test_create_queue_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_queue_async( - transport: str = "grpc_asyncio", request_type=cloudtasks.CreateQueueRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudtasks.CreateQueueRequest(), + {}, + ], +) +async def test_create_queue_async(request_type, transport: str = "grpc_asyncio"): client = CloudTasksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2270,7 +2294,7 @@ async def test_create_queue_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_queue), "__call__") as call: @@ -2295,11 +2319,6 @@ async def test_create_queue_async( assert response.state == gct_queue.Queue.State.RUNNING -@pytest.mark.asyncio -async def test_create_queue_async_from_dict(): - await test_create_queue_async(request_type=dict) - - def test_create_queue_field_headers(): client = CloudTasksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2452,8 +2471,8 @@ async def test_create_queue_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloudtasks.UpdateQueueRequest, - dict, + cloudtasks.UpdateQueueRequest(), + {}, ], ) def test_update_queue(request_type, transport: str = "grpc"): @@ -2464,7 +2483,7 @@ def test_update_queue(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_queue), "__call__") as call: @@ -2508,7 +2527,8 @@ def test_update_queue_non_empty_request_with_auto_populated_field(): client.update_queue(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudtasks.UpdateQueueRequest() + request_msg = cloudtasks.UpdateQueueRequest() + assert args[0] == request_msg def test_update_queue_use_cached_wrapped_rpc(): @@ -2589,9 +2609,14 @@ async def test_update_queue_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_queue_async( - transport: str = "grpc_asyncio", request_type=cloudtasks.UpdateQueueRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudtasks.UpdateQueueRequest(), + {}, + ], +) +async def test_update_queue_async(request_type, transport: str = "grpc_asyncio"): client = CloudTasksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2599,7 +2624,7 @@ async def test_update_queue_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_queue), "__call__") as call: @@ -2624,11 +2649,6 @@ async def test_update_queue_async( assert response.state == gct_queue.Queue.State.RUNNING -@pytest.mark.asyncio -async def test_update_queue_async_from_dict(): - await test_update_queue_async(request_type=dict) - - def test_update_queue_field_headers(): client = CloudTasksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2781,8 +2801,8 @@ async def test_update_queue_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloudtasks.DeleteQueueRequest, - dict, + cloudtasks.DeleteQueueRequest(), + {}, ], ) def test_delete_queue(request_type, transport: str = "grpc"): @@ -2793,7 +2813,7 @@ def test_delete_queue(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_queue), "__call__") as call: @@ -2834,9 +2854,10 @@ def test_delete_queue_non_empty_request_with_auto_populated_field(): client.delete_queue(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudtasks.DeleteQueueRequest( + request_msg = cloudtasks.DeleteQueueRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_queue_use_cached_wrapped_rpc(): @@ -2917,9 +2938,14 @@ async def test_delete_queue_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_queue_async( - transport: str = "grpc_asyncio", request_type=cloudtasks.DeleteQueueRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudtasks.DeleteQueueRequest(), + {}, + ], +) +async def test_delete_queue_async(request_type, transport: str = "grpc_asyncio"): client = CloudTasksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2927,7 +2953,7 @@ async def test_delete_queue_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_queue), "__call__") as call: @@ -2945,11 +2971,6 @@ async def test_delete_queue_async( assert response is None -@pytest.mark.asyncio -async def test_delete_queue_async_from_dict(): - await test_delete_queue_async(request_type=dict) - - def test_delete_queue_field_headers(): client = CloudTasksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3092,8 +3113,8 @@ async def test_delete_queue_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloudtasks.PurgeQueueRequest, - dict, + cloudtasks.PurgeQueueRequest(), + {}, ], ) def test_purge_queue(request_type, transport: str = "grpc"): @@ -3104,7 +3125,7 @@ def test_purge_queue(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.purge_queue), "__call__") as call: @@ -3150,9 +3171,10 @@ def test_purge_queue_non_empty_request_with_auto_populated_field(): client.purge_queue(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudtasks.PurgeQueueRequest( + request_msg = cloudtasks.PurgeQueueRequest( name="name_value", ) + assert args[0] == request_msg def test_purge_queue_use_cached_wrapped_rpc(): @@ -3233,9 +3255,14 @@ async def test_purge_queue_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_purge_queue_async( - transport: str = "grpc_asyncio", request_type=cloudtasks.PurgeQueueRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudtasks.PurgeQueueRequest(), + {}, + ], +) +async def test_purge_queue_async(request_type, transport: str = "grpc_asyncio"): client = CloudTasksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3243,7 +3270,7 @@ async def test_purge_queue_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.purge_queue), "__call__") as call: @@ -3268,11 +3295,6 @@ async def test_purge_queue_async( assert response.state == queue.Queue.State.RUNNING -@pytest.mark.asyncio -async def test_purge_queue_async_from_dict(): - await test_purge_queue_async(request_type=dict) - - def test_purge_queue_field_headers(): client = CloudTasksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3415,8 +3437,8 @@ async def test_purge_queue_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloudtasks.PauseQueueRequest, - dict, + cloudtasks.PauseQueueRequest(), + {}, ], ) def test_pause_queue(request_type, transport: str = "grpc"): @@ -3427,7 +3449,7 @@ def test_pause_queue(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.pause_queue), "__call__") as call: @@ -3473,9 +3495,10 @@ def test_pause_queue_non_empty_request_with_auto_populated_field(): client.pause_queue(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudtasks.PauseQueueRequest( + request_msg = cloudtasks.PauseQueueRequest( name="name_value", ) + assert args[0] == request_msg def test_pause_queue_use_cached_wrapped_rpc(): @@ -3556,9 +3579,14 @@ async def test_pause_queue_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_pause_queue_async( - transport: str = "grpc_asyncio", request_type=cloudtasks.PauseQueueRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudtasks.PauseQueueRequest(), + {}, + ], +) +async def test_pause_queue_async(request_type, transport: str = "grpc_asyncio"): client = CloudTasksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3566,7 +3594,7 @@ async def test_pause_queue_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.pause_queue), "__call__") as call: @@ -3591,11 +3619,6 @@ async def test_pause_queue_async( assert response.state == queue.Queue.State.RUNNING -@pytest.mark.asyncio -async def test_pause_queue_async_from_dict(): - await test_pause_queue_async(request_type=dict) - - def test_pause_queue_field_headers(): client = CloudTasksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3738,8 +3761,8 @@ async def test_pause_queue_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloudtasks.ResumeQueueRequest, - dict, + cloudtasks.ResumeQueueRequest(), + {}, ], ) def test_resume_queue(request_type, transport: str = "grpc"): @@ -3750,7 +3773,7 @@ def test_resume_queue(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.resume_queue), "__call__") as call: @@ -3796,9 +3819,10 @@ def test_resume_queue_non_empty_request_with_auto_populated_field(): client.resume_queue(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudtasks.ResumeQueueRequest( + request_msg = cloudtasks.ResumeQueueRequest( name="name_value", ) + assert args[0] == request_msg def test_resume_queue_use_cached_wrapped_rpc(): @@ -3879,9 +3903,14 @@ async def test_resume_queue_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_resume_queue_async( - transport: str = "grpc_asyncio", request_type=cloudtasks.ResumeQueueRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudtasks.ResumeQueueRequest(), + {}, + ], +) +async def test_resume_queue_async(request_type, transport: str = "grpc_asyncio"): client = CloudTasksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3889,7 +3918,7 @@ async def test_resume_queue_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.resume_queue), "__call__") as call: @@ -3914,11 +3943,6 @@ async def test_resume_queue_async( assert response.state == queue.Queue.State.RUNNING -@pytest.mark.asyncio -async def test_resume_queue_async_from_dict(): - await test_resume_queue_async(request_type=dict) - - def test_resume_queue_field_headers(): client = CloudTasksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4061,8 +4085,8 @@ async def test_resume_queue_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloudtasks.UploadQueueYamlRequest, - dict, + cloudtasks.UploadQueueYamlRequest(), + {}, ], ) def test_upload_queue_yaml(request_type, transport: str = "grpc"): @@ -4073,7 +4097,7 @@ def test_upload_queue_yaml(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,9 +4142,10 @@ def test_upload_queue_yaml_non_empty_request_with_auto_populated_field(): client.upload_queue_yaml(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudtasks.UploadQueueYamlRequest( + request_msg = cloudtasks.UploadQueueYamlRequest( app_id="app_id_value", ) + assert args[0] == request_msg def test_upload_queue_yaml_use_cached_wrapped_rpc(): @@ -4203,9 +4228,14 @@ async def test_upload_queue_yaml_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_upload_queue_yaml_async( - transport: str = "grpc_asyncio", request_type=cloudtasks.UploadQueueYamlRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudtasks.UploadQueueYamlRequest(), + {}, + ], +) +async def test_upload_queue_yaml_async(request_type, transport: str = "grpc_asyncio"): client = CloudTasksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4213,7 +4243,7 @@ async def test_upload_queue_yaml_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( @@ -4233,16 +4263,11 @@ async def test_upload_queue_yaml_async( assert response is None -@pytest.mark.asyncio -async def test_upload_queue_yaml_async_from_dict(): - await test_upload_queue_yaml_async(request_type=dict) - - @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.GetIamPolicyRequest, - dict, + iam_policy_pb2.GetIamPolicyRequest(), + {}, ], ) def test_get_iam_policy(request_type, transport: str = "grpc"): @@ -4253,7 +4278,7 @@ def test_get_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(type(client.transport.get_iam_policy), "__call__") as call: @@ -4299,9 +4324,10 @@ def test_get_iam_policy_non_empty_request_with_auto_populated_field(): client.get_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.GetIamPolicyRequest( + request_msg = iam_policy_pb2.GetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_get_iam_policy_use_cached_wrapped_rpc(): @@ -4382,9 +4408,14 @@ async def test_get_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.GetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.GetIamPolicyRequest(), + {}, + ], +) +async def test_get_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = CloudTasksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4392,7 +4423,7 @@ async def test_get_iam_policy_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_iam_policy), "__call__") as call: @@ -4417,11 +4448,6 @@ async def test_get_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_get_iam_policy_async_from_dict(): - await test_get_iam_policy_async(request_type=dict) - - def test_get_iam_policy_field_headers(): client = CloudTasksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4581,8 +4607,8 @@ async def test_get_iam_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.SetIamPolicyRequest, - dict, + iam_policy_pb2.SetIamPolicyRequest(), + {}, ], ) def test_set_iam_policy(request_type, transport: str = "grpc"): @@ -4593,7 +4619,7 @@ def test_set_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(type(client.transport.set_iam_policy), "__call__") as call: @@ -4639,9 +4665,10 @@ def test_set_iam_policy_non_empty_request_with_auto_populated_field(): client.set_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.SetIamPolicyRequest( + request_msg = iam_policy_pb2.SetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_set_iam_policy_use_cached_wrapped_rpc(): @@ -4722,9 +4749,14 @@ async def test_set_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.SetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.SetIamPolicyRequest(), + {}, + ], +) +async def test_set_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = CloudTasksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4732,7 +4764,7 @@ async def test_set_iam_policy_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.set_iam_policy), "__call__") as call: @@ -4757,11 +4789,6 @@ async def test_set_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_set_iam_policy_async_from_dict(): - await test_set_iam_policy_async(request_type=dict) - - def test_set_iam_policy_field_headers(): client = CloudTasksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4922,8 +4949,8 @@ async def test_set_iam_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.TestIamPermissionsRequest, - dict, + iam_policy_pb2.TestIamPermissionsRequest(), + {}, ], ) def test_test_iam_permissions(request_type, transport: str = "grpc"): @@ -4934,7 +4961,7 @@ def test_test_iam_permissions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4982,9 +5009,10 @@ def test_test_iam_permissions_non_empty_request_with_auto_populated_field(): client.test_iam_permissions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.TestIamPermissionsRequest( + request_msg = iam_policy_pb2.TestIamPermissionsRequest( resource="resource_value", ) + assert args[0] == request_msg def test_test_iam_permissions_use_cached_wrapped_rpc(): @@ -5069,9 +5097,15 @@ async def test_test_iam_permissions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.TestIamPermissionsRequest(), + {}, + ], +) async def test_test_iam_permissions_async( - transport: str = "grpc_asyncio", - request_type=iam_policy_pb2.TestIamPermissionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = CloudTasksAsyncClient( credentials=async_anonymous_credentials(), @@ -5080,7 +5114,7 @@ async def test_test_iam_permissions_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( @@ -5105,11 +5139,6 @@ async def test_test_iam_permissions_async( assert response.permissions == ["permissions_value"] -@pytest.mark.asyncio -async def test_test_iam_permissions_async_from_dict(): - await test_test_iam_permissions_async(request_type=dict) - - def test_test_iam_permissions_field_headers(): client = CloudTasksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5293,8 +5322,8 @@ async def test_test_iam_permissions_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloudtasks.ListTasksRequest, - dict, + cloudtasks.ListTasksRequest(), + {}, ], ) def test_list_tasks(request_type, transport: str = "grpc"): @@ -5305,7 +5334,7 @@ def test_list_tasks(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tasks), "__call__") as call: @@ -5350,10 +5379,11 @@ def test_list_tasks_non_empty_request_with_auto_populated_field(): client.list_tasks(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudtasks.ListTasksRequest( + request_msg = cloudtasks.ListTasksRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_tasks_use_cached_wrapped_rpc(): @@ -5432,9 +5462,14 @@ async def test_list_tasks_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_list_tasks_async( - transport: str = "grpc_asyncio", request_type=cloudtasks.ListTasksRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudtasks.ListTasksRequest(), + {}, + ], +) +async def test_list_tasks_async(request_type, transport: str = "grpc_asyncio"): client = CloudTasksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5442,7 +5477,7 @@ async def test_list_tasks_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_tasks), "__call__") as call: @@ -5465,11 +5500,6 @@ async def test_list_tasks_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_tasks_async_from_dict(): - await test_list_tasks_async(request_type=dict) - - def test_list_tasks_field_headers(): client = CloudTasksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5806,8 +5836,8 @@ async def test_list_tasks_async_pages(): @pytest.mark.parametrize( "request_type", [ - cloudtasks.GetTaskRequest, - dict, + cloudtasks.GetTaskRequest(), + {}, ], ) def test_get_task(request_type, transport: str = "grpc"): @@ -5818,7 +5848,7 @@ def test_get_task(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_task), "__call__") as call: @@ -5864,9 +5894,10 @@ def test_get_task_non_empty_request_with_auto_populated_field(): client.get_task(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudtasks.GetTaskRequest( + request_msg = cloudtasks.GetTaskRequest( name="name_value", ) + assert args[0] == request_msg def test_get_task_use_cached_wrapped_rpc(): @@ -5945,9 +5976,14 @@ async def test_get_task_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn @pytest.mark.asyncio -async def test_get_task_async( - transport: str = "grpc_asyncio", request_type=cloudtasks.GetTaskRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudtasks.GetTaskRequest(), + {}, + ], +) +async def test_get_task_async(request_type, transport: str = "grpc_asyncio"): client = CloudTasksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5955,7 +5991,7 @@ async def test_get_task_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_task), "__call__") as call: @@ -5980,11 +6016,6 @@ async def test_get_task_async( assert response.view == task.Task.View.BASIC -@pytest.mark.asyncio -async def test_get_task_async_from_dict(): - await test_get_task_async(request_type=dict) - - def test_get_task_field_headers(): client = CloudTasksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6127,8 +6158,8 @@ async def test_get_task_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloudtasks.CreateTaskRequest, - dict, + cloudtasks.CreateTaskRequest(), + {}, ], ) def test_create_task(request_type, transport: str = "grpc"): @@ -6139,7 +6170,7 @@ def test_create_task(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_task), "__call__") as call: @@ -6185,9 +6216,10 @@ def test_create_task_non_empty_request_with_auto_populated_field(): client.create_task(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudtasks.CreateTaskRequest( + request_msg = cloudtasks.CreateTaskRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_task_use_cached_wrapped_rpc(): @@ -6268,9 +6300,14 @@ async def test_create_task_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_task_async( - transport: str = "grpc_asyncio", request_type=cloudtasks.CreateTaskRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudtasks.CreateTaskRequest(), + {}, + ], +) +async def test_create_task_async(request_type, transport: str = "grpc_asyncio"): client = CloudTasksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6278,7 +6315,7 @@ async def test_create_task_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_task), "__call__") as call: @@ -6303,11 +6340,6 @@ async def test_create_task_async( assert response.view == gct_task.Task.View.BASIC -@pytest.mark.asyncio -async def test_create_task_async_from_dict(): - await test_create_task_async(request_type=dict) - - def test_create_task_field_headers(): client = CloudTasksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6460,8 +6492,8 @@ async def test_create_task_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloudtasks.DeleteTaskRequest, - dict, + cloudtasks.DeleteTaskRequest(), + {}, ], ) def test_delete_task(request_type, transport: str = "grpc"): @@ -6472,7 +6504,7 @@ def test_delete_task(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_task), "__call__") as call: @@ -6513,9 +6545,10 @@ def test_delete_task_non_empty_request_with_auto_populated_field(): client.delete_task(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudtasks.DeleteTaskRequest( + request_msg = cloudtasks.DeleteTaskRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_task_use_cached_wrapped_rpc(): @@ -6596,9 +6629,14 @@ async def test_delete_task_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_task_async( - transport: str = "grpc_asyncio", request_type=cloudtasks.DeleteTaskRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudtasks.DeleteTaskRequest(), + {}, + ], +) +async def test_delete_task_async(request_type, transport: str = "grpc_asyncio"): client = CloudTasksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6606,7 +6644,7 @@ async def test_delete_task_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_task), "__call__") as call: @@ -6624,11 +6662,6 @@ async def test_delete_task_async( assert response is None -@pytest.mark.asyncio -async def test_delete_task_async_from_dict(): - await test_delete_task_async(request_type=dict) - - def test_delete_task_field_headers(): client = CloudTasksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6771,8 +6804,8 @@ async def test_delete_task_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloudtasks.LeaseTasksRequest, - dict, + cloudtasks.LeaseTasksRequest(), + {}, ], ) def test_lease_tasks(request_type, transport: str = "grpc"): @@ -6783,7 +6816,7 @@ def test_lease_tasks(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.lease_tasks), "__call__") as call: @@ -6825,10 +6858,11 @@ def test_lease_tasks_non_empty_request_with_auto_populated_field(): client.lease_tasks(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudtasks.LeaseTasksRequest( + request_msg = cloudtasks.LeaseTasksRequest( parent="parent_value", filter="filter_value", ) + assert args[0] == request_msg def test_lease_tasks_use_cached_wrapped_rpc(): @@ -6909,9 +6943,14 @@ async def test_lease_tasks_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_lease_tasks_async( - transport: str = "grpc_asyncio", request_type=cloudtasks.LeaseTasksRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudtasks.LeaseTasksRequest(), + {}, + ], +) +async def test_lease_tasks_async(request_type, transport: str = "grpc_asyncio"): client = CloudTasksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6919,7 +6958,7 @@ async def test_lease_tasks_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.lease_tasks), "__call__") as call: @@ -6939,11 +6978,6 @@ async def test_lease_tasks_async( assert isinstance(response, cloudtasks.LeaseTasksResponse) -@pytest.mark.asyncio -async def test_lease_tasks_async_from_dict(): - await test_lease_tasks_async(request_type=dict) - - def test_lease_tasks_field_headers(): client = CloudTasksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7100,8 +7134,8 @@ async def test_lease_tasks_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloudtasks.AcknowledgeTaskRequest, - dict, + cloudtasks.AcknowledgeTaskRequest(), + {}, ], ) def test_acknowledge_task(request_type, transport: str = "grpc"): @@ -7112,7 +7146,7 @@ def test_acknowledge_task(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.acknowledge_task), "__call__") as call: @@ -7153,9 +7187,10 @@ def test_acknowledge_task_non_empty_request_with_auto_populated_field(): client.acknowledge_task(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudtasks.AcknowledgeTaskRequest( + request_msg = cloudtasks.AcknowledgeTaskRequest( name="name_value", ) + assert args[0] == request_msg def test_acknowledge_task_use_cached_wrapped_rpc(): @@ -7238,9 +7273,14 @@ async def test_acknowledge_task_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_acknowledge_task_async( - transport: str = "grpc_asyncio", request_type=cloudtasks.AcknowledgeTaskRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudtasks.AcknowledgeTaskRequest(), + {}, + ], +) +async def test_acknowledge_task_async(request_type, transport: str = "grpc_asyncio"): client = CloudTasksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7248,7 +7288,7 @@ async def test_acknowledge_task_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.acknowledge_task), "__call__") as call: @@ -7266,11 +7306,6 @@ async def test_acknowledge_task_async( assert response is None -@pytest.mark.asyncio -async def test_acknowledge_task_async_from_dict(): - await test_acknowledge_task_async(request_type=dict) - - def test_acknowledge_task_field_headers(): client = CloudTasksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7423,8 +7458,8 @@ async def test_acknowledge_task_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloudtasks.RenewLeaseRequest, - dict, + cloudtasks.RenewLeaseRequest(), + {}, ], ) def test_renew_lease(request_type, transport: str = "grpc"): @@ -7435,7 +7470,7 @@ def test_renew_lease(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.renew_lease), "__call__") as call: @@ -7481,9 +7516,10 @@ def test_renew_lease_non_empty_request_with_auto_populated_field(): client.renew_lease(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudtasks.RenewLeaseRequest( + request_msg = cloudtasks.RenewLeaseRequest( name="name_value", ) + assert args[0] == request_msg def test_renew_lease_use_cached_wrapped_rpc(): @@ -7564,9 +7600,14 @@ async def test_renew_lease_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_renew_lease_async( - transport: str = "grpc_asyncio", request_type=cloudtasks.RenewLeaseRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudtasks.RenewLeaseRequest(), + {}, + ], +) +async def test_renew_lease_async(request_type, transport: str = "grpc_asyncio"): client = CloudTasksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7574,7 +7615,7 @@ async def test_renew_lease_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.renew_lease), "__call__") as call: @@ -7599,11 +7640,6 @@ async def test_renew_lease_async( assert response.view == task.Task.View.BASIC -@pytest.mark.asyncio -async def test_renew_lease_async_from_dict(): - await test_renew_lease_async(request_type=dict) - - def test_renew_lease_field_headers(): client = CloudTasksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7766,8 +7802,8 @@ async def test_renew_lease_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloudtasks.CancelLeaseRequest, - dict, + cloudtasks.CancelLeaseRequest(), + {}, ], ) def test_cancel_lease(request_type, transport: str = "grpc"): @@ -7778,7 +7814,7 @@ def test_cancel_lease(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.cancel_lease), "__call__") as call: @@ -7824,9 +7860,10 @@ def test_cancel_lease_non_empty_request_with_auto_populated_field(): client.cancel_lease(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudtasks.CancelLeaseRequest( + request_msg = cloudtasks.CancelLeaseRequest( name="name_value", ) + assert args[0] == request_msg def test_cancel_lease_use_cached_wrapped_rpc(): @@ -7907,9 +7944,14 @@ async def test_cancel_lease_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_cancel_lease_async( - transport: str = "grpc_asyncio", request_type=cloudtasks.CancelLeaseRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudtasks.CancelLeaseRequest(), + {}, + ], +) +async def test_cancel_lease_async(request_type, transport: str = "grpc_asyncio"): client = CloudTasksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7917,7 +7959,7 @@ async def test_cancel_lease_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.cancel_lease), "__call__") as call: @@ -7942,11 +7984,6 @@ async def test_cancel_lease_async( assert response.view == task.Task.View.BASIC -@pytest.mark.asyncio -async def test_cancel_lease_async_from_dict(): - await test_cancel_lease_async(request_type=dict) - - def test_cancel_lease_field_headers(): client = CloudTasksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8099,8 +8136,8 @@ async def test_cancel_lease_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloudtasks.RunTaskRequest, - dict, + cloudtasks.RunTaskRequest(), + {}, ], ) def test_run_task(request_type, transport: str = "grpc"): @@ -8111,7 +8148,7 @@ def test_run_task(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.run_task), "__call__") as call: @@ -8157,9 +8194,10 @@ def test_run_task_non_empty_request_with_auto_populated_field(): client.run_task(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudtasks.RunTaskRequest( + request_msg = cloudtasks.RunTaskRequest( name="name_value", ) + assert args[0] == request_msg def test_run_task_use_cached_wrapped_rpc(): @@ -8238,9 +8276,14 @@ async def test_run_task_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn @pytest.mark.asyncio -async def test_run_task_async( - transport: str = "grpc_asyncio", request_type=cloudtasks.RunTaskRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudtasks.RunTaskRequest(), + {}, + ], +) +async def test_run_task_async(request_type, transport: str = "grpc_asyncio"): client = CloudTasksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8248,7 +8291,7 @@ async def test_run_task_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.run_task), "__call__") as call: @@ -8273,11 +8316,6 @@ async def test_run_task_async( assert response.view == task.Task.View.BASIC -@pytest.mark.asyncio -async def test_run_task_async_from_dict(): - await test_run_task_async(request_type=dict) - - def test_run_task_field_headers(): client = CloudTasksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12350,7 +12388,6 @@ def test_list_queues_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.ListQueuesRequest() - assert args[0] == request_msg @@ -12371,7 +12408,6 @@ def test_get_queue_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.GetQueueRequest() - assert args[0] == request_msg @@ -12392,7 +12428,6 @@ def test_create_queue_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.CreateQueueRequest() - assert args[0] == request_msg @@ -12413,7 +12448,6 @@ def test_update_queue_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.UpdateQueueRequest() - assert args[0] == request_msg @@ -12434,7 +12468,6 @@ def test_delete_queue_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.DeleteQueueRequest() - assert args[0] == request_msg @@ -12455,7 +12488,6 @@ def test_purge_queue_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.PurgeQueueRequest() - assert args[0] == request_msg @@ -12476,7 +12508,6 @@ def test_pause_queue_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.PauseQueueRequest() - assert args[0] == request_msg @@ -12497,7 +12528,6 @@ def test_resume_queue_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.ResumeQueueRequest() - assert args[0] == request_msg @@ -12520,7 +12550,6 @@ def test_upload_queue_yaml_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.UploadQueueYamlRequest() - assert args[0] == request_msg @@ -12541,7 +12570,6 @@ def test_get_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -12562,7 +12590,6 @@ def test_set_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -12585,7 +12612,6 @@ def test_test_iam_permissions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -12606,7 +12632,6 @@ def test_list_tasks_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.ListTasksRequest() - assert args[0] == request_msg @@ -12627,7 +12652,6 @@ def test_get_task_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.GetTaskRequest() - assert args[0] == request_msg @@ -12648,7 +12672,6 @@ def test_create_task_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.CreateTaskRequest() - assert args[0] == request_msg @@ -12669,7 +12692,6 @@ def test_delete_task_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.DeleteTaskRequest() - assert args[0] == request_msg @@ -12690,7 +12712,6 @@ def test_lease_tasks_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.LeaseTasksRequest() - assert args[0] == request_msg @@ -12711,7 +12732,6 @@ def test_acknowledge_task_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.AcknowledgeTaskRequest() - assert args[0] == request_msg @@ -12732,7 +12752,6 @@ def test_renew_lease_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.RenewLeaseRequest() - assert args[0] == request_msg @@ -12753,7 +12772,6 @@ def test_cancel_lease_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.CancelLeaseRequest() - assert args[0] == request_msg @@ -12774,7 +12792,6 @@ def test_run_task_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.RunTaskRequest() - assert args[0] == request_msg @@ -12815,7 +12832,6 @@ async def test_list_queues_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.ListQueuesRequest() - assert args[0] == request_msg @@ -12843,7 +12859,6 @@ async def test_get_queue_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.GetQueueRequest() - assert args[0] == request_msg @@ -12871,7 +12886,6 @@ async def test_create_queue_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.CreateQueueRequest() - assert args[0] == request_msg @@ -12899,7 +12913,6 @@ async def test_update_queue_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.UpdateQueueRequest() - assert args[0] == request_msg @@ -12922,7 +12935,6 @@ async def test_delete_queue_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.DeleteQueueRequest() - assert args[0] == request_msg @@ -12950,7 +12962,6 @@ async def test_purge_queue_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.PurgeQueueRequest() - assert args[0] == request_msg @@ -12978,7 +12989,6 @@ async def test_pause_queue_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.PauseQueueRequest() - assert args[0] == request_msg @@ -13006,7 +13016,6 @@ async def test_resume_queue_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.ResumeQueueRequest() - assert args[0] == request_msg @@ -13031,7 +13040,6 @@ async def test_upload_queue_yaml_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.UploadQueueYamlRequest() - assert args[0] == request_msg @@ -13059,7 +13067,6 @@ async def test_get_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -13087,7 +13094,6 @@ async def test_set_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -13116,7 +13122,6 @@ async def test_test_iam_permissions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -13143,7 +13148,6 @@ async def test_list_tasks_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.ListTasksRequest() - assert args[0] == request_msg @@ -13171,7 +13175,6 @@ async def test_get_task_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.GetTaskRequest() - assert args[0] == request_msg @@ -13199,7 +13202,6 @@ async def test_create_task_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.CreateTaskRequest() - assert args[0] == request_msg @@ -13222,7 +13224,6 @@ async def test_delete_task_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.DeleteTaskRequest() - assert args[0] == request_msg @@ -13247,7 +13248,6 @@ async def test_lease_tasks_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.LeaseTasksRequest() - assert args[0] == request_msg @@ -13270,7 +13270,6 @@ async def test_acknowledge_task_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.AcknowledgeTaskRequest() - assert args[0] == request_msg @@ -13298,7 +13297,6 @@ async def test_renew_lease_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.RenewLeaseRequest() - assert args[0] == request_msg @@ -13326,7 +13324,6 @@ async def test_cancel_lease_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.CancelLeaseRequest() - assert args[0] == request_msg @@ -13354,7 +13351,6 @@ async def test_run_task_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.RunTaskRequest() - assert args[0] == request_msg @@ -16290,7 +16286,6 @@ def test_list_queues_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.ListQueuesRequest() - assert args[0] == request_msg @@ -16310,7 +16305,6 @@ def test_get_queue_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.GetQueueRequest() - assert args[0] == request_msg @@ -16330,7 +16324,6 @@ def test_create_queue_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.CreateQueueRequest() - assert args[0] == request_msg @@ -16350,7 +16343,6 @@ def test_update_queue_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.UpdateQueueRequest() - assert args[0] == request_msg @@ -16370,7 +16362,6 @@ def test_delete_queue_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.DeleteQueueRequest() - assert args[0] == request_msg @@ -16390,7 +16381,6 @@ def test_purge_queue_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.PurgeQueueRequest() - assert args[0] == request_msg @@ -16410,7 +16400,6 @@ def test_pause_queue_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.PauseQueueRequest() - assert args[0] == request_msg @@ -16430,7 +16419,6 @@ def test_resume_queue_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.ResumeQueueRequest() - assert args[0] == request_msg @@ -16452,7 +16440,6 @@ def test_upload_queue_yaml_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.UploadQueueYamlRequest() - assert args[0] == request_msg @@ -16472,7 +16459,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -16492,7 +16478,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -16514,7 +16499,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -16534,7 +16518,6 @@ def test_list_tasks_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.ListTasksRequest() - assert args[0] == request_msg @@ -16554,7 +16537,6 @@ def test_get_task_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.GetTaskRequest() - assert args[0] == request_msg @@ -16574,7 +16556,6 @@ def test_create_task_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.CreateTaskRequest() - assert args[0] == request_msg @@ -16594,7 +16575,6 @@ def test_delete_task_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.DeleteTaskRequest() - assert args[0] == request_msg @@ -16614,7 +16594,6 @@ def test_lease_tasks_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.LeaseTasksRequest() - assert args[0] == request_msg @@ -16634,7 +16613,6 @@ def test_acknowledge_task_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.AcknowledgeTaskRequest() - assert args[0] == request_msg @@ -16654,7 +16632,6 @@ def test_renew_lease_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.RenewLeaseRequest() - assert args[0] == request_msg @@ -16674,7 +16651,6 @@ def test_cancel_lease_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.CancelLeaseRequest() - assert args[0] == request_msg @@ -16694,7 +16670,6 @@ def test_run_task_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.RunTaskRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-tasks/tests/unit/gapic/tasks_v2beta3/test_cloud_tasks.py b/packages/google-cloud-tasks/tests/unit/gapic/tasks_v2beta3/test_cloud_tasks.py index ede203ba75de..d7116eb391cf 100644 --- a/packages/google-cloud-tasks/tests/unit/gapic/tasks_v2beta3/test_cloud_tasks.py +++ b/packages/google-cloud-tasks/tests/unit/gapic/tasks_v2beta3/test_cloud_tasks.py @@ -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 @@ -119,6 +120,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" @@ -1280,8 +1296,8 @@ def test_cloud_tasks_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - cloudtasks.ListQueuesRequest, - dict, + cloudtasks.ListQueuesRequest(), + {}, ], ) def test_list_queues(request_type, transport: str = "grpc"): @@ -1292,7 +1308,7 @@ def test_list_queues(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_queues), "__call__") as call: @@ -1338,11 +1354,12 @@ def test_list_queues_non_empty_request_with_auto_populated_field(): client.list_queues(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudtasks.ListQueuesRequest( + request_msg = cloudtasks.ListQueuesRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_queues_use_cached_wrapped_rpc(): @@ -1423,9 +1440,14 @@ async def test_list_queues_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_queues_async( - transport: str = "grpc_asyncio", request_type=cloudtasks.ListQueuesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudtasks.ListQueuesRequest(), + {}, + ], +) +async def test_list_queues_async(request_type, transport: str = "grpc_asyncio"): client = CloudTasksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1433,7 +1455,7 @@ async def test_list_queues_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_queues), "__call__") as call: @@ -1456,11 +1478,6 @@ async def test_list_queues_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_queues_async_from_dict(): - await test_list_queues_async(request_type=dict) - - def test_list_queues_field_headers(): client = CloudTasksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1797,8 +1814,8 @@ async def test_list_queues_async_pages(): @pytest.mark.parametrize( "request_type", [ - cloudtasks.GetQueueRequest, - dict, + cloudtasks.GetQueueRequest(), + {}, ], ) def test_get_queue(request_type, transport: str = "grpc"): @@ -1809,7 +1826,7 @@ def test_get_queue(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_queue), "__call__") as call: @@ -1857,9 +1874,10 @@ def test_get_queue_non_empty_request_with_auto_populated_field(): client.get_queue(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudtasks.GetQueueRequest( + request_msg = cloudtasks.GetQueueRequest( name="name_value", ) + assert args[0] == request_msg def test_get_queue_use_cached_wrapped_rpc(): @@ -1938,9 +1956,14 @@ async def test_get_queue_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_queue_async( - transport: str = "grpc_asyncio", request_type=cloudtasks.GetQueueRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudtasks.GetQueueRequest(), + {}, + ], +) +async def test_get_queue_async(request_type, transport: str = "grpc_asyncio"): client = CloudTasksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1948,7 +1971,7 @@ async def test_get_queue_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_queue), "__call__") as call: @@ -1975,11 +1998,6 @@ async def test_get_queue_async( assert response.type_ == queue.Queue.Type.PULL -@pytest.mark.asyncio -async def test_get_queue_async_from_dict(): - await test_get_queue_async(request_type=dict) - - def test_get_queue_field_headers(): client = CloudTasksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2122,8 +2140,8 @@ async def test_get_queue_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloudtasks.CreateQueueRequest, - dict, + cloudtasks.CreateQueueRequest(), + {}, ], ) def test_create_queue(request_type, transport: str = "grpc"): @@ -2134,7 +2152,7 @@ def test_create_queue(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_queue), "__call__") as call: @@ -2182,9 +2200,10 @@ def test_create_queue_non_empty_request_with_auto_populated_field(): client.create_queue(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudtasks.CreateQueueRequest( + request_msg = cloudtasks.CreateQueueRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_queue_use_cached_wrapped_rpc(): @@ -2265,9 +2284,14 @@ async def test_create_queue_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_queue_async( - transport: str = "grpc_asyncio", request_type=cloudtasks.CreateQueueRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudtasks.CreateQueueRequest(), + {}, + ], +) +async def test_create_queue_async(request_type, transport: str = "grpc_asyncio"): client = CloudTasksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2275,7 +2299,7 @@ async def test_create_queue_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_queue), "__call__") as call: @@ -2302,11 +2326,6 @@ async def test_create_queue_async( assert response.type_ == gct_queue.Queue.Type.PULL -@pytest.mark.asyncio -async def test_create_queue_async_from_dict(): - await test_create_queue_async(request_type=dict) - - def test_create_queue_field_headers(): client = CloudTasksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2459,8 +2478,8 @@ async def test_create_queue_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloudtasks.UpdateQueueRequest, - dict, + cloudtasks.UpdateQueueRequest(), + {}, ], ) def test_update_queue(request_type, transport: str = "grpc"): @@ -2471,7 +2490,7 @@ def test_update_queue(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_queue), "__call__") as call: @@ -2517,7 +2536,8 @@ def test_update_queue_non_empty_request_with_auto_populated_field(): client.update_queue(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudtasks.UpdateQueueRequest() + request_msg = cloudtasks.UpdateQueueRequest() + assert args[0] == request_msg def test_update_queue_use_cached_wrapped_rpc(): @@ -2598,9 +2618,14 @@ async def test_update_queue_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_queue_async( - transport: str = "grpc_asyncio", request_type=cloudtasks.UpdateQueueRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudtasks.UpdateQueueRequest(), + {}, + ], +) +async def test_update_queue_async(request_type, transport: str = "grpc_asyncio"): client = CloudTasksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2608,7 +2633,7 @@ async def test_update_queue_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_queue), "__call__") as call: @@ -2635,11 +2660,6 @@ async def test_update_queue_async( assert response.type_ == gct_queue.Queue.Type.PULL -@pytest.mark.asyncio -async def test_update_queue_async_from_dict(): - await test_update_queue_async(request_type=dict) - - def test_update_queue_field_headers(): client = CloudTasksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2792,8 +2812,8 @@ async def test_update_queue_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloudtasks.DeleteQueueRequest, - dict, + cloudtasks.DeleteQueueRequest(), + {}, ], ) def test_delete_queue(request_type, transport: str = "grpc"): @@ -2804,7 +2824,7 @@ def test_delete_queue(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_queue), "__call__") as call: @@ -2845,9 +2865,10 @@ def test_delete_queue_non_empty_request_with_auto_populated_field(): client.delete_queue(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudtasks.DeleteQueueRequest( + request_msg = cloudtasks.DeleteQueueRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_queue_use_cached_wrapped_rpc(): @@ -2928,9 +2949,14 @@ async def test_delete_queue_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_queue_async( - transport: str = "grpc_asyncio", request_type=cloudtasks.DeleteQueueRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudtasks.DeleteQueueRequest(), + {}, + ], +) +async def test_delete_queue_async(request_type, transport: str = "grpc_asyncio"): client = CloudTasksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2938,7 +2964,7 @@ async def test_delete_queue_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_queue), "__call__") as call: @@ -2956,11 +2982,6 @@ async def test_delete_queue_async( assert response is None -@pytest.mark.asyncio -async def test_delete_queue_async_from_dict(): - await test_delete_queue_async(request_type=dict) - - def test_delete_queue_field_headers(): client = CloudTasksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3103,8 +3124,8 @@ async def test_delete_queue_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloudtasks.PurgeQueueRequest, - dict, + cloudtasks.PurgeQueueRequest(), + {}, ], ) def test_purge_queue(request_type, transport: str = "grpc"): @@ -3115,7 +3136,7 @@ def test_purge_queue(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.purge_queue), "__call__") as call: @@ -3163,9 +3184,10 @@ def test_purge_queue_non_empty_request_with_auto_populated_field(): client.purge_queue(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudtasks.PurgeQueueRequest( + request_msg = cloudtasks.PurgeQueueRequest( name="name_value", ) + assert args[0] == request_msg def test_purge_queue_use_cached_wrapped_rpc(): @@ -3246,9 +3268,14 @@ async def test_purge_queue_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_purge_queue_async( - transport: str = "grpc_asyncio", request_type=cloudtasks.PurgeQueueRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudtasks.PurgeQueueRequest(), + {}, + ], +) +async def test_purge_queue_async(request_type, transport: str = "grpc_asyncio"): client = CloudTasksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3256,7 +3283,7 @@ async def test_purge_queue_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.purge_queue), "__call__") as call: @@ -3283,11 +3310,6 @@ async def test_purge_queue_async( assert response.type_ == queue.Queue.Type.PULL -@pytest.mark.asyncio -async def test_purge_queue_async_from_dict(): - await test_purge_queue_async(request_type=dict) - - def test_purge_queue_field_headers(): client = CloudTasksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3430,8 +3452,8 @@ async def test_purge_queue_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloudtasks.PauseQueueRequest, - dict, + cloudtasks.PauseQueueRequest(), + {}, ], ) def test_pause_queue(request_type, transport: str = "grpc"): @@ -3442,7 +3464,7 @@ def test_pause_queue(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.pause_queue), "__call__") as call: @@ -3490,9 +3512,10 @@ def test_pause_queue_non_empty_request_with_auto_populated_field(): client.pause_queue(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudtasks.PauseQueueRequest( + request_msg = cloudtasks.PauseQueueRequest( name="name_value", ) + assert args[0] == request_msg def test_pause_queue_use_cached_wrapped_rpc(): @@ -3573,9 +3596,14 @@ async def test_pause_queue_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_pause_queue_async( - transport: str = "grpc_asyncio", request_type=cloudtasks.PauseQueueRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudtasks.PauseQueueRequest(), + {}, + ], +) +async def test_pause_queue_async(request_type, transport: str = "grpc_asyncio"): client = CloudTasksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3583,7 +3611,7 @@ async def test_pause_queue_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.pause_queue), "__call__") as call: @@ -3610,11 +3638,6 @@ async def test_pause_queue_async( assert response.type_ == queue.Queue.Type.PULL -@pytest.mark.asyncio -async def test_pause_queue_async_from_dict(): - await test_pause_queue_async(request_type=dict) - - def test_pause_queue_field_headers(): client = CloudTasksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3757,8 +3780,8 @@ async def test_pause_queue_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloudtasks.ResumeQueueRequest, - dict, + cloudtasks.ResumeQueueRequest(), + {}, ], ) def test_resume_queue(request_type, transport: str = "grpc"): @@ -3769,7 +3792,7 @@ def test_resume_queue(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.resume_queue), "__call__") as call: @@ -3817,9 +3840,10 @@ def test_resume_queue_non_empty_request_with_auto_populated_field(): client.resume_queue(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudtasks.ResumeQueueRequest( + request_msg = cloudtasks.ResumeQueueRequest( name="name_value", ) + assert args[0] == request_msg def test_resume_queue_use_cached_wrapped_rpc(): @@ -3900,9 +3924,14 @@ async def test_resume_queue_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_resume_queue_async( - transport: str = "grpc_asyncio", request_type=cloudtasks.ResumeQueueRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudtasks.ResumeQueueRequest(), + {}, + ], +) +async def test_resume_queue_async(request_type, transport: str = "grpc_asyncio"): client = CloudTasksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3910,7 +3939,7 @@ async def test_resume_queue_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.resume_queue), "__call__") as call: @@ -3937,11 +3966,6 @@ async def test_resume_queue_async( assert response.type_ == queue.Queue.Type.PULL -@pytest.mark.asyncio -async def test_resume_queue_async_from_dict(): - await test_resume_queue_async(request_type=dict) - - def test_resume_queue_field_headers(): client = CloudTasksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4084,8 +4108,8 @@ async def test_resume_queue_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.GetIamPolicyRequest, - dict, + iam_policy_pb2.GetIamPolicyRequest(), + {}, ], ) def test_get_iam_policy(request_type, transport: str = "grpc"): @@ -4096,7 +4120,7 @@ def test_get_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(type(client.transport.get_iam_policy), "__call__") as call: @@ -4142,9 +4166,10 @@ def test_get_iam_policy_non_empty_request_with_auto_populated_field(): client.get_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.GetIamPolicyRequest( + request_msg = iam_policy_pb2.GetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_get_iam_policy_use_cached_wrapped_rpc(): @@ -4225,9 +4250,14 @@ async def test_get_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.GetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.GetIamPolicyRequest(), + {}, + ], +) +async def test_get_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = CloudTasksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4235,7 +4265,7 @@ async def test_get_iam_policy_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_iam_policy), "__call__") as call: @@ -4260,11 +4290,6 @@ async def test_get_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_get_iam_policy_async_from_dict(): - await test_get_iam_policy_async(request_type=dict) - - def test_get_iam_policy_field_headers(): client = CloudTasksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4424,8 +4449,8 @@ async def test_get_iam_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.SetIamPolicyRequest, - dict, + iam_policy_pb2.SetIamPolicyRequest(), + {}, ], ) def test_set_iam_policy(request_type, transport: str = "grpc"): @@ -4436,7 +4461,7 @@ def test_set_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(type(client.transport.set_iam_policy), "__call__") as call: @@ -4482,9 +4507,10 @@ def test_set_iam_policy_non_empty_request_with_auto_populated_field(): client.set_iam_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.SetIamPolicyRequest( + request_msg = iam_policy_pb2.SetIamPolicyRequest( resource="resource_value", ) + assert args[0] == request_msg def test_set_iam_policy_use_cached_wrapped_rpc(): @@ -4565,9 +4591,14 @@ async def test_set_iam_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_set_iam_policy_async( - transport: str = "grpc_asyncio", request_type=iam_policy_pb2.SetIamPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.SetIamPolicyRequest(), + {}, + ], +) +async def test_set_iam_policy_async(request_type, transport: str = "grpc_asyncio"): client = CloudTasksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4575,7 +4606,7 @@ async def test_set_iam_policy_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.set_iam_policy), "__call__") as call: @@ -4600,11 +4631,6 @@ async def test_set_iam_policy_async( assert response.etag == b"etag_blob" -@pytest.mark.asyncio -async def test_set_iam_policy_async_from_dict(): - await test_set_iam_policy_async(request_type=dict) - - def test_set_iam_policy_field_headers(): client = CloudTasksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4765,8 +4791,8 @@ async def test_set_iam_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - iam_policy_pb2.TestIamPermissionsRequest, - dict, + iam_policy_pb2.TestIamPermissionsRequest(), + {}, ], ) def test_test_iam_permissions(request_type, transport: str = "grpc"): @@ -4777,7 +4803,7 @@ def test_test_iam_permissions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4825,9 +4851,10 @@ def test_test_iam_permissions_non_empty_request_with_auto_populated_field(): client.test_iam_permissions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == iam_policy_pb2.TestIamPermissionsRequest( + request_msg = iam_policy_pb2.TestIamPermissionsRequest( resource="resource_value", ) + assert args[0] == request_msg def test_test_iam_permissions_use_cached_wrapped_rpc(): @@ -4912,9 +4939,15 @@ async def test_test_iam_permissions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.TestIamPermissionsRequest(), + {}, + ], +) async def test_test_iam_permissions_async( - transport: str = "grpc_asyncio", - request_type=iam_policy_pb2.TestIamPermissionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = CloudTasksAsyncClient( credentials=async_anonymous_credentials(), @@ -4923,7 +4956,7 @@ async def test_test_iam_permissions_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( @@ -4948,11 +4981,6 @@ async def test_test_iam_permissions_async( assert response.permissions == ["permissions_value"] -@pytest.mark.asyncio -async def test_test_iam_permissions_async_from_dict(): - await test_test_iam_permissions_async(request_type=dict) - - def test_test_iam_permissions_field_headers(): client = CloudTasksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5136,8 +5164,8 @@ async def test_test_iam_permissions_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloudtasks.ListTasksRequest, - dict, + cloudtasks.ListTasksRequest(), + {}, ], ) def test_list_tasks(request_type, transport: str = "grpc"): @@ -5148,7 +5176,7 @@ def test_list_tasks(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tasks), "__call__") as call: @@ -5193,10 +5221,11 @@ def test_list_tasks_non_empty_request_with_auto_populated_field(): client.list_tasks(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudtasks.ListTasksRequest( + request_msg = cloudtasks.ListTasksRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_tasks_use_cached_wrapped_rpc(): @@ -5275,9 +5304,14 @@ async def test_list_tasks_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_list_tasks_async( - transport: str = "grpc_asyncio", request_type=cloudtasks.ListTasksRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudtasks.ListTasksRequest(), + {}, + ], +) +async def test_list_tasks_async(request_type, transport: str = "grpc_asyncio"): client = CloudTasksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5285,7 +5319,7 @@ async def test_list_tasks_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_tasks), "__call__") as call: @@ -5308,11 +5342,6 @@ async def test_list_tasks_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_tasks_async_from_dict(): - await test_list_tasks_async(request_type=dict) - - def test_list_tasks_field_headers(): client = CloudTasksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5649,8 +5678,8 @@ async def test_list_tasks_async_pages(): @pytest.mark.parametrize( "request_type", [ - cloudtasks.GetTaskRequest, - dict, + cloudtasks.GetTaskRequest(), + {}, ], ) def test_get_task(request_type, transport: str = "grpc"): @@ -5661,7 +5690,7 @@ def test_get_task(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_task), "__call__") as call: @@ -5711,9 +5740,10 @@ def test_get_task_non_empty_request_with_auto_populated_field(): client.get_task(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudtasks.GetTaskRequest( + request_msg = cloudtasks.GetTaskRequest( name="name_value", ) + assert args[0] == request_msg def test_get_task_use_cached_wrapped_rpc(): @@ -5792,9 +5822,14 @@ async def test_get_task_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn @pytest.mark.asyncio -async def test_get_task_async( - transport: str = "grpc_asyncio", request_type=cloudtasks.GetTaskRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudtasks.GetTaskRequest(), + {}, + ], +) +async def test_get_task_async(request_type, transport: str = "grpc_asyncio"): client = CloudTasksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5802,7 +5837,7 @@ async def test_get_task_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_task), "__call__") as call: @@ -5831,11 +5866,6 @@ async def test_get_task_async( assert response.view == task.Task.View.BASIC -@pytest.mark.asyncio -async def test_get_task_async_from_dict(): - await test_get_task_async(request_type=dict) - - def test_get_task_field_headers(): client = CloudTasksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5978,8 +6008,8 @@ async def test_get_task_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloudtasks.CreateTaskRequest, - dict, + cloudtasks.CreateTaskRequest(), + {}, ], ) def test_create_task(request_type, transport: str = "grpc"): @@ -5990,7 +6020,7 @@ def test_create_task(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_task), "__call__") as call: @@ -6040,9 +6070,10 @@ def test_create_task_non_empty_request_with_auto_populated_field(): client.create_task(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudtasks.CreateTaskRequest( + request_msg = cloudtasks.CreateTaskRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_task_use_cached_wrapped_rpc(): @@ -6123,9 +6154,14 @@ async def test_create_task_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_task_async( - transport: str = "grpc_asyncio", request_type=cloudtasks.CreateTaskRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudtasks.CreateTaskRequest(), + {}, + ], +) +async def test_create_task_async(request_type, transport: str = "grpc_asyncio"): client = CloudTasksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6133,7 +6169,7 @@ async def test_create_task_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_task), "__call__") as call: @@ -6162,11 +6198,6 @@ async def test_create_task_async( assert response.view == gct_task.Task.View.BASIC -@pytest.mark.asyncio -async def test_create_task_async_from_dict(): - await test_create_task_async(request_type=dict) - - def test_create_task_field_headers(): client = CloudTasksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6319,8 +6350,8 @@ async def test_create_task_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloudtasks.DeleteTaskRequest, - dict, + cloudtasks.DeleteTaskRequest(), + {}, ], ) def test_delete_task(request_type, transport: str = "grpc"): @@ -6331,7 +6362,7 @@ def test_delete_task(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_task), "__call__") as call: @@ -6372,9 +6403,10 @@ def test_delete_task_non_empty_request_with_auto_populated_field(): client.delete_task(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudtasks.DeleteTaskRequest( + request_msg = cloudtasks.DeleteTaskRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_task_use_cached_wrapped_rpc(): @@ -6455,9 +6487,14 @@ async def test_delete_task_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_task_async( - transport: str = "grpc_asyncio", request_type=cloudtasks.DeleteTaskRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudtasks.DeleteTaskRequest(), + {}, + ], +) +async def test_delete_task_async(request_type, transport: str = "grpc_asyncio"): client = CloudTasksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6465,7 +6502,7 @@ async def test_delete_task_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_task), "__call__") as call: @@ -6483,11 +6520,6 @@ async def test_delete_task_async( assert response is None -@pytest.mark.asyncio -async def test_delete_task_async_from_dict(): - await test_delete_task_async(request_type=dict) - - def test_delete_task_field_headers(): client = CloudTasksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6630,8 +6662,8 @@ async def test_delete_task_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloudtasks.RunTaskRequest, - dict, + cloudtasks.RunTaskRequest(), + {}, ], ) def test_run_task(request_type, transport: str = "grpc"): @@ -6642,7 +6674,7 @@ def test_run_task(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.run_task), "__call__") as call: @@ -6692,9 +6724,10 @@ def test_run_task_non_empty_request_with_auto_populated_field(): client.run_task(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloudtasks.RunTaskRequest( + request_msg = cloudtasks.RunTaskRequest( name="name_value", ) + assert args[0] == request_msg def test_run_task_use_cached_wrapped_rpc(): @@ -6773,9 +6806,14 @@ async def test_run_task_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn @pytest.mark.asyncio -async def test_run_task_async( - transport: str = "grpc_asyncio", request_type=cloudtasks.RunTaskRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloudtasks.RunTaskRequest(), + {}, + ], +) +async def test_run_task_async(request_type, transport: str = "grpc_asyncio"): client = CloudTasksAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6783,7 +6821,7 @@ async def test_run_task_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.run_task), "__call__") as call: @@ -6812,11 +6850,6 @@ async def test_run_task_async( assert response.view == task.Task.View.BASIC -@pytest.mark.asyncio -async def test_run_task_async_from_dict(): - await test_run_task_async(request_type=dict) - - def test_run_task_field_headers(): client = CloudTasksClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10110,7 +10143,6 @@ def test_list_queues_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.ListQueuesRequest() - assert args[0] == request_msg @@ -10131,7 +10163,6 @@ def test_get_queue_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.GetQueueRequest() - assert args[0] == request_msg @@ -10152,7 +10183,6 @@ def test_create_queue_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.CreateQueueRequest() - assert args[0] == request_msg @@ -10173,7 +10203,6 @@ def test_update_queue_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.UpdateQueueRequest() - assert args[0] == request_msg @@ -10194,7 +10223,6 @@ def test_delete_queue_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.DeleteQueueRequest() - assert args[0] == request_msg @@ -10215,7 +10243,6 @@ def test_purge_queue_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.PurgeQueueRequest() - assert args[0] == request_msg @@ -10236,7 +10263,6 @@ def test_pause_queue_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.PauseQueueRequest() - assert args[0] == request_msg @@ -10257,7 +10283,6 @@ def test_resume_queue_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.ResumeQueueRequest() - assert args[0] == request_msg @@ -10278,7 +10303,6 @@ def test_get_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -10299,7 +10323,6 @@ def test_set_iam_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -10322,7 +10345,6 @@ def test_test_iam_permissions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -10343,7 +10365,6 @@ def test_list_tasks_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.ListTasksRequest() - assert args[0] == request_msg @@ -10364,7 +10385,6 @@ def test_get_task_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.GetTaskRequest() - assert args[0] == request_msg @@ -10385,7 +10405,6 @@ def test_create_task_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.CreateTaskRequest() - assert args[0] == request_msg @@ -10406,7 +10425,6 @@ def test_delete_task_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.DeleteTaskRequest() - assert args[0] == request_msg @@ -10427,7 +10445,6 @@ def test_run_task_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.RunTaskRequest() - assert args[0] == request_msg @@ -10468,7 +10485,6 @@ async def test_list_queues_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.ListQueuesRequest() - assert args[0] == request_msg @@ -10497,7 +10513,6 @@ async def test_get_queue_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.GetQueueRequest() - assert args[0] == request_msg @@ -10526,7 +10541,6 @@ async def test_create_queue_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.CreateQueueRequest() - assert args[0] == request_msg @@ -10555,7 +10569,6 @@ async def test_update_queue_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.UpdateQueueRequest() - assert args[0] == request_msg @@ -10578,7 +10591,6 @@ async def test_delete_queue_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.DeleteQueueRequest() - assert args[0] == request_msg @@ -10607,7 +10619,6 @@ async def test_purge_queue_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.PurgeQueueRequest() - assert args[0] == request_msg @@ -10636,7 +10647,6 @@ async def test_pause_queue_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.PauseQueueRequest() - assert args[0] == request_msg @@ -10665,7 +10675,6 @@ async def test_resume_queue_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.ResumeQueueRequest() - assert args[0] == request_msg @@ -10693,7 +10702,6 @@ async def test_get_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -10721,7 +10729,6 @@ async def test_set_iam_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -10750,7 +10757,6 @@ async def test_test_iam_permissions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -10777,7 +10783,6 @@ async def test_list_tasks_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.ListTasksRequest() - assert args[0] == request_msg @@ -10807,7 +10812,6 @@ async def test_get_task_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.GetTaskRequest() - assert args[0] == request_msg @@ -10837,7 +10841,6 @@ async def test_create_task_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.CreateTaskRequest() - assert args[0] == request_msg @@ -10860,7 +10863,6 @@ async def test_delete_task_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.DeleteTaskRequest() - assert args[0] == request_msg @@ -10890,7 +10892,6 @@ async def test_run_task_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.RunTaskRequest() - assert args[0] == request_msg @@ -13335,7 +13336,6 @@ def test_list_queues_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.ListQueuesRequest() - assert args[0] == request_msg @@ -13355,7 +13355,6 @@ def test_get_queue_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.GetQueueRequest() - assert args[0] == request_msg @@ -13375,7 +13374,6 @@ def test_create_queue_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.CreateQueueRequest() - assert args[0] == request_msg @@ -13395,7 +13393,6 @@ def test_update_queue_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.UpdateQueueRequest() - assert args[0] == request_msg @@ -13415,7 +13412,6 @@ def test_delete_queue_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.DeleteQueueRequest() - assert args[0] == request_msg @@ -13435,7 +13431,6 @@ def test_purge_queue_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.PurgeQueueRequest() - assert args[0] == request_msg @@ -13455,7 +13450,6 @@ def test_pause_queue_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.PauseQueueRequest() - assert args[0] == request_msg @@ -13475,7 +13469,6 @@ def test_resume_queue_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.ResumeQueueRequest() - assert args[0] == request_msg @@ -13495,7 +13488,6 @@ def test_get_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.GetIamPolicyRequest() - assert args[0] == request_msg @@ -13515,7 +13507,6 @@ def test_set_iam_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.SetIamPolicyRequest() - assert args[0] == request_msg @@ -13537,7 +13528,6 @@ def test_test_iam_permissions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = iam_policy_pb2.TestIamPermissionsRequest() - assert args[0] == request_msg @@ -13557,7 +13547,6 @@ def test_list_tasks_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.ListTasksRequest() - assert args[0] == request_msg @@ -13577,7 +13566,6 @@ def test_get_task_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.GetTaskRequest() - assert args[0] == request_msg @@ -13597,7 +13585,6 @@ def test_create_task_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.CreateTaskRequest() - assert args[0] == request_msg @@ -13617,7 +13604,6 @@ def test_delete_task_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.DeleteTaskRequest() - assert args[0] == request_msg @@ -13637,7 +13623,6 @@ def test_run_task_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloudtasks.RunTaskRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-telcoautomation/noxfile.py b/packages/google-cloud-telcoautomation/noxfile.py index 06f257e8b08f..0516d14eba3d 100644 --- a/packages/google-cloud-telcoautomation/noxfile.py +++ b/packages/google-cloud-telcoautomation/noxfile.py @@ -47,7 +47,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-telcoautomation" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-telcoautomation/setup.py b/packages/google-cloud-telcoautomation/setup.py index 4b3a4142c38c..c92bf913c9e8 100644 --- a/packages/google-cloud-telcoautomation/setup.py +++ b/packages/google-cloud-telcoautomation/setup.py @@ -45,7 +45,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/google-cloud-telcoautomation/testing/constraints-3.10.txt b/packages/google-cloud-telcoautomation/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-telcoautomation/testing/constraints-3.10.txt +++ b/packages/google-cloud-telcoautomation/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-telcoautomation/tests/unit/gapic/telcoautomation_v1/test_telco_automation.py b/packages/google-cloud-telcoautomation/tests/unit/gapic/telcoautomation_v1/test_telco_automation.py index cfa370dea895..fda165bd692e 100644 --- a/packages/google-cloud-telcoautomation/tests/unit/gapic/telcoautomation_v1/test_telco_automation.py +++ b/packages/google-cloud-telcoautomation/tests/unit/gapic/telcoautomation_v1/test_telco_automation.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 @@ -116,6 +117,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" @@ -1343,8 +1359,8 @@ def test_telco_automation_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - telcoautomation.ListOrchestrationClustersRequest, - dict, + telcoautomation.ListOrchestrationClustersRequest(), + {}, ], ) def test_list_orchestration_clusters(request_type, transport: str = "grpc"): @@ -1355,7 +1371,7 @@ def test_list_orchestration_clusters(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1408,12 +1424,13 @@ def test_list_orchestration_clusters_non_empty_request_with_auto_populated_field client.list_orchestration_clusters(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == telcoautomation.ListOrchestrationClustersRequest( + request_msg = telcoautomation.ListOrchestrationClustersRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_orchestration_clusters_use_cached_wrapped_rpc(): @@ -1499,9 +1516,15 @@ async def test_list_orchestration_clusters_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + telcoautomation.ListOrchestrationClustersRequest(), + {}, + ], +) async def test_list_orchestration_clusters_async( - transport: str = "grpc_asyncio", - request_type=telcoautomation.ListOrchestrationClustersRequest, + request_type, transport: str = "grpc_asyncio" ): client = TelcoAutomationAsyncClient( credentials=async_anonymous_credentials(), @@ -1510,7 +1533,7 @@ async def test_list_orchestration_clusters_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( @@ -1537,11 +1560,6 @@ async def test_list_orchestration_clusters_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_orchestration_clusters_async_from_dict(): - await test_list_orchestration_clusters_async(request_type=dict) - - def test_list_orchestration_clusters_field_headers(): client = TelcoAutomationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1898,8 +1916,8 @@ async def test_list_orchestration_clusters_async_pages(): @pytest.mark.parametrize( "request_type", [ - telcoautomation.GetOrchestrationClusterRequest, - dict, + telcoautomation.GetOrchestrationClusterRequest(), + {}, ], ) def test_get_orchestration_cluster(request_type, transport: str = "grpc"): @@ -1910,7 +1928,7 @@ def test_get_orchestration_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1962,9 +1980,10 @@ def test_get_orchestration_cluster_non_empty_request_with_auto_populated_field() client.get_orchestration_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == telcoautomation.GetOrchestrationClusterRequest( + request_msg = telcoautomation.GetOrchestrationClusterRequest( name="name_value", ) + assert args[0] == request_msg def test_get_orchestration_cluster_use_cached_wrapped_rpc(): @@ -2050,9 +2069,15 @@ async def test_get_orchestration_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + telcoautomation.GetOrchestrationClusterRequest(), + {}, + ], +) async def test_get_orchestration_cluster_async( - transport: str = "grpc_asyncio", - request_type=telcoautomation.GetOrchestrationClusterRequest, + request_type, transport: str = "grpc_asyncio" ): client = TelcoAutomationAsyncClient( credentials=async_anonymous_credentials(), @@ -2061,7 +2086,7 @@ async def test_get_orchestration_cluster_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( @@ -2090,11 +2115,6 @@ async def test_get_orchestration_cluster_async( assert response.state == telcoautomation.OrchestrationCluster.State.CREATING -@pytest.mark.asyncio -async def test_get_orchestration_cluster_async_from_dict(): - await test_get_orchestration_cluster_async(request_type=dict) - - def test_get_orchestration_cluster_field_headers(): client = TelcoAutomationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2249,8 +2269,8 @@ async def test_get_orchestration_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - telcoautomation.CreateOrchestrationClusterRequest, - dict, + telcoautomation.CreateOrchestrationClusterRequest(), + {}, ], ) def test_create_orchestration_cluster(request_type, transport: str = "grpc"): @@ -2261,7 +2281,7 @@ def test_create_orchestration_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2308,11 +2328,12 @@ def test_create_orchestration_cluster_non_empty_request_with_auto_populated_fiel client.create_orchestration_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == telcoautomation.CreateOrchestrationClusterRequest( + request_msg = telcoautomation.CreateOrchestrationClusterRequest( parent="parent_value", orchestration_cluster_id="orchestration_cluster_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_orchestration_cluster_use_cached_wrapped_rpc(): @@ -2408,9 +2429,15 @@ async def test_create_orchestration_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + telcoautomation.CreateOrchestrationClusterRequest(), + {}, + ], +) async def test_create_orchestration_cluster_async( - transport: str = "grpc_asyncio", - request_type=telcoautomation.CreateOrchestrationClusterRequest, + request_type, transport: str = "grpc_asyncio" ): client = TelcoAutomationAsyncClient( credentials=async_anonymous_credentials(), @@ -2419,7 +2446,7 @@ async def test_create_orchestration_cluster_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( @@ -2441,11 +2468,6 @@ async def test_create_orchestration_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_orchestration_cluster_async_from_dict(): - await test_create_orchestration_cluster_async(request_type=dict) - - def test_create_orchestration_cluster_field_headers(): client = TelcoAutomationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2628,8 +2650,8 @@ async def test_create_orchestration_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - telcoautomation.DeleteOrchestrationClusterRequest, - dict, + telcoautomation.DeleteOrchestrationClusterRequest(), + {}, ], ) def test_delete_orchestration_cluster(request_type, transport: str = "grpc"): @@ -2640,7 +2662,7 @@ def test_delete_orchestration_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2686,10 +2708,11 @@ def test_delete_orchestration_cluster_non_empty_request_with_auto_populated_fiel client.delete_orchestration_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == telcoautomation.DeleteOrchestrationClusterRequest( + request_msg = telcoautomation.DeleteOrchestrationClusterRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_orchestration_cluster_use_cached_wrapped_rpc(): @@ -2785,9 +2808,15 @@ async def test_delete_orchestration_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + telcoautomation.DeleteOrchestrationClusterRequest(), + {}, + ], +) async def test_delete_orchestration_cluster_async( - transport: str = "grpc_asyncio", - request_type=telcoautomation.DeleteOrchestrationClusterRequest, + request_type, transport: str = "grpc_asyncio" ): client = TelcoAutomationAsyncClient( credentials=async_anonymous_credentials(), @@ -2796,7 +2825,7 @@ async def test_delete_orchestration_cluster_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( @@ -2818,11 +2847,6 @@ async def test_delete_orchestration_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_orchestration_cluster_async_from_dict(): - await test_delete_orchestration_cluster_async(request_type=dict) - - def test_delete_orchestration_cluster_field_headers(): client = TelcoAutomationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2977,8 +3001,8 @@ async def test_delete_orchestration_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - telcoautomation.ListEdgeSlmsRequest, - dict, + telcoautomation.ListEdgeSlmsRequest(), + {}, ], ) def test_list_edge_slms(request_type, transport: str = "grpc"): @@ -2989,7 +3013,7 @@ def test_list_edge_slms(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_edge_slms), "__call__") as call: @@ -3038,12 +3062,13 @@ def test_list_edge_slms_non_empty_request_with_auto_populated_field(): client.list_edge_slms(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == telcoautomation.ListEdgeSlmsRequest( + request_msg = telcoautomation.ListEdgeSlmsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_edge_slms_use_cached_wrapped_rpc(): @@ -3124,9 +3149,14 @@ async def test_list_edge_slms_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_edge_slms_async( - transport: str = "grpc_asyncio", request_type=telcoautomation.ListEdgeSlmsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + telcoautomation.ListEdgeSlmsRequest(), + {}, + ], +) +async def test_list_edge_slms_async(request_type, transport: str = "grpc_asyncio"): client = TelcoAutomationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3134,7 +3164,7 @@ async def test_list_edge_slms_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_edge_slms), "__call__") as call: @@ -3159,11 +3189,6 @@ async def test_list_edge_slms_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_edge_slms_async_from_dict(): - await test_list_edge_slms_async(request_type=dict) - - def test_list_edge_slms_field_headers(): client = TelcoAutomationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3500,8 +3525,8 @@ async def test_list_edge_slms_async_pages(): @pytest.mark.parametrize( "request_type", [ - telcoautomation.GetEdgeSlmRequest, - dict, + telcoautomation.GetEdgeSlmRequest(), + {}, ], ) def test_get_edge_slm(request_type, transport: str = "grpc"): @@ -3512,7 +3537,7 @@ def test_get_edge_slm(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_edge_slm), "__call__") as call: @@ -3567,9 +3592,10 @@ def test_get_edge_slm_non_empty_request_with_auto_populated_field(): client.get_edge_slm(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == telcoautomation.GetEdgeSlmRequest( + request_msg = telcoautomation.GetEdgeSlmRequest( name="name_value", ) + assert args[0] == request_msg def test_get_edge_slm_use_cached_wrapped_rpc(): @@ -3650,9 +3676,14 @@ async def test_get_edge_slm_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_edge_slm_async( - transport: str = "grpc_asyncio", request_type=telcoautomation.GetEdgeSlmRequest -): +@pytest.mark.parametrize( + "request_type", + [ + telcoautomation.GetEdgeSlmRequest(), + {}, + ], +) +async def test_get_edge_slm_async(request_type, transport: str = "grpc_asyncio"): client = TelcoAutomationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3660,7 +3691,7 @@ async def test_get_edge_slm_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_edge_slm), "__call__") as call: @@ -3694,11 +3725,6 @@ async def test_get_edge_slm_async( ) -@pytest.mark.asyncio -async def test_get_edge_slm_async_from_dict(): - await test_get_edge_slm_async(request_type=dict) - - def test_get_edge_slm_field_headers(): client = TelcoAutomationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3845,8 +3871,8 @@ async def test_get_edge_slm_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - telcoautomation.CreateEdgeSlmRequest, - dict, + telcoautomation.CreateEdgeSlmRequest(), + {}, ], ) def test_create_edge_slm(request_type, transport: str = "grpc"): @@ -3857,7 +3883,7 @@ def test_create_edge_slm(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_edge_slm), "__call__") as call: @@ -3900,11 +3926,12 @@ def test_create_edge_slm_non_empty_request_with_auto_populated_field(): client.create_edge_slm(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == telcoautomation.CreateEdgeSlmRequest( + request_msg = telcoautomation.CreateEdgeSlmRequest( parent="parent_value", edge_slm_id="edge_slm_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_edge_slm_use_cached_wrapped_rpc(): @@ -3995,9 +4022,14 @@ async def test_create_edge_slm_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_edge_slm_async( - transport: str = "grpc_asyncio", request_type=telcoautomation.CreateEdgeSlmRequest -): +@pytest.mark.parametrize( + "request_type", + [ + telcoautomation.CreateEdgeSlmRequest(), + {}, + ], +) +async def test_create_edge_slm_async(request_type, transport: str = "grpc_asyncio"): client = TelcoAutomationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4005,7 +4037,7 @@ async def test_create_edge_slm_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_edge_slm), "__call__") as call: @@ -4025,11 +4057,6 @@ async def test_create_edge_slm_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_edge_slm_async_from_dict(): - await test_create_edge_slm_async(request_type=dict) - - def test_create_edge_slm_field_headers(): client = TelcoAutomationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4196,8 +4223,8 @@ async def test_create_edge_slm_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - telcoautomation.DeleteEdgeSlmRequest, - dict, + telcoautomation.DeleteEdgeSlmRequest(), + {}, ], ) def test_delete_edge_slm(request_type, transport: str = "grpc"): @@ -4208,7 +4235,7 @@ def test_delete_edge_slm(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_edge_slm), "__call__") as call: @@ -4250,10 +4277,11 @@ def test_delete_edge_slm_non_empty_request_with_auto_populated_field(): client.delete_edge_slm(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == telcoautomation.DeleteEdgeSlmRequest( + request_msg = telcoautomation.DeleteEdgeSlmRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_edge_slm_use_cached_wrapped_rpc(): @@ -4344,9 +4372,14 @@ async def test_delete_edge_slm_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_edge_slm_async( - transport: str = "grpc_asyncio", request_type=telcoautomation.DeleteEdgeSlmRequest -): +@pytest.mark.parametrize( + "request_type", + [ + telcoautomation.DeleteEdgeSlmRequest(), + {}, + ], +) +async def test_delete_edge_slm_async(request_type, transport: str = "grpc_asyncio"): client = TelcoAutomationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4354,7 +4387,7 @@ async def test_delete_edge_slm_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_edge_slm), "__call__") as call: @@ -4374,11 +4407,6 @@ async def test_delete_edge_slm_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_edge_slm_async_from_dict(): - await test_delete_edge_slm_async(request_type=dict) - - def test_delete_edge_slm_field_headers(): client = TelcoAutomationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4525,8 +4553,8 @@ async def test_delete_edge_slm_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - telcoautomation.CreateBlueprintRequest, - dict, + telcoautomation.CreateBlueprintRequest(), + {}, ], ) def test_create_blueprint(request_type, transport: str = "grpc"): @@ -4537,7 +4565,7 @@ def test_create_blueprint(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_blueprint), "__call__") as call: @@ -4598,10 +4626,11 @@ def test_create_blueprint_non_empty_request_with_auto_populated_field(): client.create_blueprint(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == telcoautomation.CreateBlueprintRequest( + request_msg = telcoautomation.CreateBlueprintRequest( parent="parent_value", blueprint_id="blueprint_id_value", ) + assert args[0] == request_msg def test_create_blueprint_use_cached_wrapped_rpc(): @@ -4684,9 +4713,14 @@ async def test_create_blueprint_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_blueprint_async( - transport: str = "grpc_asyncio", request_type=telcoautomation.CreateBlueprintRequest -): +@pytest.mark.parametrize( + "request_type", + [ + telcoautomation.CreateBlueprintRequest(), + {}, + ], +) +async def test_create_blueprint_async(request_type, transport: str = "grpc_asyncio"): client = TelcoAutomationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4694,7 +4728,7 @@ async def test_create_blueprint_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_blueprint), "__call__") as call: @@ -4733,11 +4767,6 @@ async def test_create_blueprint_async( assert response.rollback_support is True -@pytest.mark.asyncio -async def test_create_blueprint_async_from_dict(): - await test_create_blueprint_async(request_type=dict) - - def test_create_blueprint_field_headers(): client = TelcoAutomationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4904,8 +4933,8 @@ async def test_create_blueprint_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - telcoautomation.UpdateBlueprintRequest, - dict, + telcoautomation.UpdateBlueprintRequest(), + {}, ], ) def test_update_blueprint(request_type, transport: str = "grpc"): @@ -4916,7 +4945,7 @@ def test_update_blueprint(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_blueprint), "__call__") as call: @@ -4974,7 +5003,8 @@ def test_update_blueprint_non_empty_request_with_auto_populated_field(): client.update_blueprint(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == telcoautomation.UpdateBlueprintRequest() + request_msg = telcoautomation.UpdateBlueprintRequest() + assert args[0] == request_msg def test_update_blueprint_use_cached_wrapped_rpc(): @@ -5057,9 +5087,14 @@ async def test_update_blueprint_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_blueprint_async( - transport: str = "grpc_asyncio", request_type=telcoautomation.UpdateBlueprintRequest -): +@pytest.mark.parametrize( + "request_type", + [ + telcoautomation.UpdateBlueprintRequest(), + {}, + ], +) +async def test_update_blueprint_async(request_type, transport: str = "grpc_asyncio"): client = TelcoAutomationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5067,7 +5102,7 @@ async def test_update_blueprint_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_blueprint), "__call__") as call: @@ -5106,11 +5141,6 @@ async def test_update_blueprint_async( assert response.rollback_support is True -@pytest.mark.asyncio -async def test_update_blueprint_async_from_dict(): - await test_update_blueprint_async(request_type=dict) - - def test_update_blueprint_field_headers(): client = TelcoAutomationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5267,8 +5297,8 @@ async def test_update_blueprint_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - telcoautomation.GetBlueprintRequest, - dict, + telcoautomation.GetBlueprintRequest(), + {}, ], ) def test_get_blueprint(request_type, transport: str = "grpc"): @@ -5279,7 +5309,7 @@ def test_get_blueprint(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_blueprint), "__call__") as call: @@ -5339,9 +5369,10 @@ def test_get_blueprint_non_empty_request_with_auto_populated_field(): client.get_blueprint(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == telcoautomation.GetBlueprintRequest( + request_msg = telcoautomation.GetBlueprintRequest( name="name_value", ) + assert args[0] == request_msg def test_get_blueprint_use_cached_wrapped_rpc(): @@ -5422,9 +5453,14 @@ async def test_get_blueprint_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_blueprint_async( - transport: str = "grpc_asyncio", request_type=telcoautomation.GetBlueprintRequest -): +@pytest.mark.parametrize( + "request_type", + [ + telcoautomation.GetBlueprintRequest(), + {}, + ], +) +async def test_get_blueprint_async(request_type, transport: str = "grpc_asyncio"): client = TelcoAutomationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5432,7 +5468,7 @@ async def test_get_blueprint_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_blueprint), "__call__") as call: @@ -5471,11 +5507,6 @@ async def test_get_blueprint_async( assert response.rollback_support is True -@pytest.mark.asyncio -async def test_get_blueprint_async_from_dict(): - await test_get_blueprint_async(request_type=dict) - - def test_get_blueprint_field_headers(): client = TelcoAutomationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5622,8 +5653,8 @@ async def test_get_blueprint_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - telcoautomation.DeleteBlueprintRequest, - dict, + telcoautomation.DeleteBlueprintRequest(), + {}, ], ) def test_delete_blueprint(request_type, transport: str = "grpc"): @@ -5634,7 +5665,7 @@ def test_delete_blueprint(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_blueprint), "__call__") as call: @@ -5675,9 +5706,10 @@ def test_delete_blueprint_non_empty_request_with_auto_populated_field(): client.delete_blueprint(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == telcoautomation.DeleteBlueprintRequest( + request_msg = telcoautomation.DeleteBlueprintRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_blueprint_use_cached_wrapped_rpc(): @@ -5760,9 +5792,14 @@ async def test_delete_blueprint_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_blueprint_async( - transport: str = "grpc_asyncio", request_type=telcoautomation.DeleteBlueprintRequest -): +@pytest.mark.parametrize( + "request_type", + [ + telcoautomation.DeleteBlueprintRequest(), + {}, + ], +) +async def test_delete_blueprint_async(request_type, transport: str = "grpc_asyncio"): client = TelcoAutomationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5770,7 +5807,7 @@ async def test_delete_blueprint_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_blueprint), "__call__") as call: @@ -5788,11 +5825,6 @@ async def test_delete_blueprint_async( assert response is None -@pytest.mark.asyncio -async def test_delete_blueprint_async_from_dict(): - await test_delete_blueprint_async(request_type=dict) - - def test_delete_blueprint_field_headers(): client = TelcoAutomationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5935,8 +5967,8 @@ async def test_delete_blueprint_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - telcoautomation.ListBlueprintsRequest, - dict, + telcoautomation.ListBlueprintsRequest(), + {}, ], ) def test_list_blueprints(request_type, transport: str = "grpc"): @@ -5947,7 +5979,7 @@ def test_list_blueprints(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_blueprints), "__call__") as call: @@ -5993,11 +6025,12 @@ def test_list_blueprints_non_empty_request_with_auto_populated_field(): client.list_blueprints(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == telcoautomation.ListBlueprintsRequest( + request_msg = telcoautomation.ListBlueprintsRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_blueprints_use_cached_wrapped_rpc(): @@ -6078,9 +6111,14 @@ async def test_list_blueprints_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_blueprints_async( - transport: str = "grpc_asyncio", request_type=telcoautomation.ListBlueprintsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + telcoautomation.ListBlueprintsRequest(), + {}, + ], +) +async def test_list_blueprints_async(request_type, transport: str = "grpc_asyncio"): client = TelcoAutomationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6088,7 +6126,7 @@ async def test_list_blueprints_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_blueprints), "__call__") as call: @@ -6111,11 +6149,6 @@ async def test_list_blueprints_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_blueprints_async_from_dict(): - await test_list_blueprints_async(request_type=dict) - - def test_list_blueprints_field_headers(): client = TelcoAutomationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6452,8 +6485,8 @@ async def test_list_blueprints_async_pages(): @pytest.mark.parametrize( "request_type", [ - telcoautomation.ApproveBlueprintRequest, - dict, + telcoautomation.ApproveBlueprintRequest(), + {}, ], ) def test_approve_blueprint(request_type, transport: str = "grpc"): @@ -6464,7 +6497,7 @@ def test_approve_blueprint(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6528,9 +6561,10 @@ def test_approve_blueprint_non_empty_request_with_auto_populated_field(): client.approve_blueprint(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == telcoautomation.ApproveBlueprintRequest( + request_msg = telcoautomation.ApproveBlueprintRequest( name="name_value", ) + assert args[0] == request_msg def test_approve_blueprint_use_cached_wrapped_rpc(): @@ -6613,10 +6647,14 @@ async def test_approve_blueprint_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_approve_blueprint_async( - transport: str = "grpc_asyncio", - request_type=telcoautomation.ApproveBlueprintRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + telcoautomation.ApproveBlueprintRequest(), + {}, + ], +) +async def test_approve_blueprint_async(request_type, transport: str = "grpc_asyncio"): client = TelcoAutomationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6624,7 +6662,7 @@ async def test_approve_blueprint_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( @@ -6665,11 +6703,6 @@ async def test_approve_blueprint_async( assert response.rollback_support is True -@pytest.mark.asyncio -async def test_approve_blueprint_async_from_dict(): - await test_approve_blueprint_async(request_type=dict) - - def test_approve_blueprint_field_headers(): client = TelcoAutomationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6824,8 +6857,8 @@ async def test_approve_blueprint_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - telcoautomation.ProposeBlueprintRequest, - dict, + telcoautomation.ProposeBlueprintRequest(), + {}, ], ) def test_propose_blueprint(request_type, transport: str = "grpc"): @@ -6836,7 +6869,7 @@ def test_propose_blueprint(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6900,9 +6933,10 @@ def test_propose_blueprint_non_empty_request_with_auto_populated_field(): client.propose_blueprint(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == telcoautomation.ProposeBlueprintRequest( + request_msg = telcoautomation.ProposeBlueprintRequest( name="name_value", ) + assert args[0] == request_msg def test_propose_blueprint_use_cached_wrapped_rpc(): @@ -6985,10 +7019,14 @@ async def test_propose_blueprint_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_propose_blueprint_async( - transport: str = "grpc_asyncio", - request_type=telcoautomation.ProposeBlueprintRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + telcoautomation.ProposeBlueprintRequest(), + {}, + ], +) +async def test_propose_blueprint_async(request_type, transport: str = "grpc_asyncio"): client = TelcoAutomationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6996,7 +7034,7 @@ async def test_propose_blueprint_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( @@ -7037,11 +7075,6 @@ async def test_propose_blueprint_async( assert response.rollback_support is True -@pytest.mark.asyncio -async def test_propose_blueprint_async_from_dict(): - await test_propose_blueprint_async(request_type=dict) - - def test_propose_blueprint_field_headers(): client = TelcoAutomationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7196,8 +7229,8 @@ async def test_propose_blueprint_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - telcoautomation.RejectBlueprintRequest, - dict, + telcoautomation.RejectBlueprintRequest(), + {}, ], ) def test_reject_blueprint(request_type, transport: str = "grpc"): @@ -7208,7 +7241,7 @@ def test_reject_blueprint(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.reject_blueprint), "__call__") as call: @@ -7268,9 +7301,10 @@ def test_reject_blueprint_non_empty_request_with_auto_populated_field(): client.reject_blueprint(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == telcoautomation.RejectBlueprintRequest( + request_msg = telcoautomation.RejectBlueprintRequest( name="name_value", ) + assert args[0] == request_msg def test_reject_blueprint_use_cached_wrapped_rpc(): @@ -7353,9 +7387,14 @@ async def test_reject_blueprint_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_reject_blueprint_async( - transport: str = "grpc_asyncio", request_type=telcoautomation.RejectBlueprintRequest -): +@pytest.mark.parametrize( + "request_type", + [ + telcoautomation.RejectBlueprintRequest(), + {}, + ], +) +async def test_reject_blueprint_async(request_type, transport: str = "grpc_asyncio"): client = TelcoAutomationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7363,7 +7402,7 @@ async def test_reject_blueprint_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.reject_blueprint), "__call__") as call: @@ -7402,11 +7441,6 @@ async def test_reject_blueprint_async( assert response.rollback_support is True -@pytest.mark.asyncio -async def test_reject_blueprint_async_from_dict(): - await test_reject_blueprint_async(request_type=dict) - - def test_reject_blueprint_field_headers(): client = TelcoAutomationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7553,8 +7587,8 @@ async def test_reject_blueprint_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - telcoautomation.ListBlueprintRevisionsRequest, - dict, + telcoautomation.ListBlueprintRevisionsRequest(), + {}, ], ) def test_list_blueprint_revisions(request_type, transport: str = "grpc"): @@ -7565,7 +7599,7 @@ def test_list_blueprint_revisions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7614,10 +7648,11 @@ def test_list_blueprint_revisions_non_empty_request_with_auto_populated_field(): client.list_blueprint_revisions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == telcoautomation.ListBlueprintRevisionsRequest( + request_msg = telcoautomation.ListBlueprintRevisionsRequest( name="name_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_blueprint_revisions_use_cached_wrapped_rpc(): @@ -7703,9 +7738,15 @@ async def test_list_blueprint_revisions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + telcoautomation.ListBlueprintRevisionsRequest(), + {}, + ], +) async def test_list_blueprint_revisions_async( - transport: str = "grpc_asyncio", - request_type=telcoautomation.ListBlueprintRevisionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = TelcoAutomationAsyncClient( credentials=async_anonymous_credentials(), @@ -7714,7 +7755,7 @@ async def test_list_blueprint_revisions_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( @@ -7739,11 +7780,6 @@ async def test_list_blueprint_revisions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_blueprint_revisions_async_from_dict(): - await test_list_blueprint_revisions_async(request_type=dict) - - def test_list_blueprint_revisions_field_headers(): client = TelcoAutomationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8098,8 +8134,8 @@ async def test_list_blueprint_revisions_async_pages(): @pytest.mark.parametrize( "request_type", [ - telcoautomation.SearchBlueprintRevisionsRequest, - dict, + telcoautomation.SearchBlueprintRevisionsRequest(), + {}, ], ) def test_search_blueprint_revisions(request_type, transport: str = "grpc"): @@ -8110,7 +8146,7 @@ def test_search_blueprint_revisions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8160,11 +8196,12 @@ def test_search_blueprint_revisions_non_empty_request_with_auto_populated_field( client.search_blueprint_revisions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == telcoautomation.SearchBlueprintRevisionsRequest( + request_msg = telcoautomation.SearchBlueprintRevisionsRequest( parent="parent_value", query="query_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_search_blueprint_revisions_use_cached_wrapped_rpc(): @@ -8250,9 +8287,15 @@ async def test_search_blueprint_revisions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + telcoautomation.SearchBlueprintRevisionsRequest(), + {}, + ], +) async def test_search_blueprint_revisions_async( - transport: str = "grpc_asyncio", - request_type=telcoautomation.SearchBlueprintRevisionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = TelcoAutomationAsyncClient( credentials=async_anonymous_credentials(), @@ -8261,7 +8304,7 @@ async def test_search_blueprint_revisions_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( @@ -8286,11 +8329,6 @@ async def test_search_blueprint_revisions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_search_blueprint_revisions_async_from_dict(): - await test_search_blueprint_revisions_async(request_type=dict) - - def test_search_blueprint_revisions_field_headers(): client = TelcoAutomationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8655,8 +8693,8 @@ async def test_search_blueprint_revisions_async_pages(): @pytest.mark.parametrize( "request_type", [ - telcoautomation.SearchDeploymentRevisionsRequest, - dict, + telcoautomation.SearchDeploymentRevisionsRequest(), + {}, ], ) def test_search_deployment_revisions(request_type, transport: str = "grpc"): @@ -8667,7 +8705,7 @@ def test_search_deployment_revisions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8717,11 +8755,12 @@ def test_search_deployment_revisions_non_empty_request_with_auto_populated_field client.search_deployment_revisions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == telcoautomation.SearchDeploymentRevisionsRequest( + request_msg = telcoautomation.SearchDeploymentRevisionsRequest( parent="parent_value", query="query_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_search_deployment_revisions_use_cached_wrapped_rpc(): @@ -8807,9 +8846,15 @@ async def test_search_deployment_revisions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + telcoautomation.SearchDeploymentRevisionsRequest(), + {}, + ], +) async def test_search_deployment_revisions_async( - transport: str = "grpc_asyncio", - request_type=telcoautomation.SearchDeploymentRevisionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = TelcoAutomationAsyncClient( credentials=async_anonymous_credentials(), @@ -8818,7 +8863,7 @@ async def test_search_deployment_revisions_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( @@ -8843,11 +8888,6 @@ async def test_search_deployment_revisions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_search_deployment_revisions_async_from_dict(): - await test_search_deployment_revisions_async(request_type=dict) - - def test_search_deployment_revisions_field_headers(): client = TelcoAutomationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9212,8 +9252,8 @@ async def test_search_deployment_revisions_async_pages(): @pytest.mark.parametrize( "request_type", [ - telcoautomation.DiscardBlueprintChangesRequest, - dict, + telcoautomation.DiscardBlueprintChangesRequest(), + {}, ], ) def test_discard_blueprint_changes(request_type, transport: str = "grpc"): @@ -9224,7 +9264,7 @@ def test_discard_blueprint_changes(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9269,9 +9309,10 @@ def test_discard_blueprint_changes_non_empty_request_with_auto_populated_field() client.discard_blueprint_changes(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == telcoautomation.DiscardBlueprintChangesRequest( + request_msg = telcoautomation.DiscardBlueprintChangesRequest( name="name_value", ) + assert args[0] == request_msg def test_discard_blueprint_changes_use_cached_wrapped_rpc(): @@ -9357,9 +9398,15 @@ async def test_discard_blueprint_changes_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + telcoautomation.DiscardBlueprintChangesRequest(), + {}, + ], +) async def test_discard_blueprint_changes_async( - transport: str = "grpc_asyncio", - request_type=telcoautomation.DiscardBlueprintChangesRequest, + request_type, transport: str = "grpc_asyncio" ): client = TelcoAutomationAsyncClient( credentials=async_anonymous_credentials(), @@ -9368,7 +9415,7 @@ async def test_discard_blueprint_changes_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( @@ -9390,11 +9437,6 @@ async def test_discard_blueprint_changes_async( assert isinstance(response, telcoautomation.DiscardBlueprintChangesResponse) -@pytest.mark.asyncio -async def test_discard_blueprint_changes_async_from_dict(): - await test_discard_blueprint_changes_async(request_type=dict) - - def test_discard_blueprint_changes_field_headers(): client = TelcoAutomationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9549,8 +9591,8 @@ async def test_discard_blueprint_changes_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - telcoautomation.ListPublicBlueprintsRequest, - dict, + telcoautomation.ListPublicBlueprintsRequest(), + {}, ], ) def test_list_public_blueprints(request_type, transport: str = "grpc"): @@ -9561,7 +9603,7 @@ def test_list_public_blueprints(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9610,10 +9652,11 @@ def test_list_public_blueprints_non_empty_request_with_auto_populated_field(): client.list_public_blueprints(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == telcoautomation.ListPublicBlueprintsRequest( + request_msg = telcoautomation.ListPublicBlueprintsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_public_blueprints_use_cached_wrapped_rpc(): @@ -9699,9 +9742,15 @@ async def test_list_public_blueprints_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + telcoautomation.ListPublicBlueprintsRequest(), + {}, + ], +) async def test_list_public_blueprints_async( - transport: str = "grpc_asyncio", - request_type=telcoautomation.ListPublicBlueprintsRequest, + request_type, transport: str = "grpc_asyncio" ): client = TelcoAutomationAsyncClient( credentials=async_anonymous_credentials(), @@ -9710,7 +9759,7 @@ async def test_list_public_blueprints_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( @@ -9735,11 +9784,6 @@ async def test_list_public_blueprints_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_public_blueprints_async_from_dict(): - await test_list_public_blueprints_async(request_type=dict) - - def test_list_public_blueprints_field_headers(): client = TelcoAutomationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10092,8 +10136,8 @@ async def test_list_public_blueprints_async_pages(): @pytest.mark.parametrize( "request_type", [ - telcoautomation.GetPublicBlueprintRequest, - dict, + telcoautomation.GetPublicBlueprintRequest(), + {}, ], ) def test_get_public_blueprint(request_type, transport: str = "grpc"): @@ -10104,7 +10148,7 @@ def test_get_public_blueprint(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10162,9 +10206,10 @@ def test_get_public_blueprint_non_empty_request_with_auto_populated_field(): client.get_public_blueprint(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == telcoautomation.GetPublicBlueprintRequest( + request_msg = telcoautomation.GetPublicBlueprintRequest( name="name_value", ) + assert args[0] == request_msg def test_get_public_blueprint_use_cached_wrapped_rpc(): @@ -10249,9 +10294,15 @@ async def test_get_public_blueprint_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + telcoautomation.GetPublicBlueprintRequest(), + {}, + ], +) async def test_get_public_blueprint_async( - transport: str = "grpc_asyncio", - request_type=telcoautomation.GetPublicBlueprintRequest, + request_type, transport: str = "grpc_asyncio" ): client = TelcoAutomationAsyncClient( credentials=async_anonymous_credentials(), @@ -10260,7 +10311,7 @@ async def test_get_public_blueprint_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( @@ -10295,11 +10346,6 @@ async def test_get_public_blueprint_async( assert response.rollback_support is True -@pytest.mark.asyncio -async def test_get_public_blueprint_async_from_dict(): - await test_get_public_blueprint_async(request_type=dict) - - def test_get_public_blueprint_field_headers(): client = TelcoAutomationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10454,8 +10500,8 @@ async def test_get_public_blueprint_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - telcoautomation.CreateDeploymentRequest, - dict, + telcoautomation.CreateDeploymentRequest(), + {}, ], ) def test_create_deployment(request_type, transport: str = "grpc"): @@ -10466,7 +10512,7 @@ def test_create_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10533,10 +10579,11 @@ def test_create_deployment_non_empty_request_with_auto_populated_field(): client.create_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == telcoautomation.CreateDeploymentRequest( + request_msg = telcoautomation.CreateDeploymentRequest( parent="parent_value", deployment_id="deployment_id_value", ) + assert args[0] == request_msg def test_create_deployment_use_cached_wrapped_rpc(): @@ -10619,10 +10666,14 @@ async def test_create_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_deployment_async( - transport: str = "grpc_asyncio", - request_type=telcoautomation.CreateDeploymentRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + telcoautomation.CreateDeploymentRequest(), + {}, + ], +) +async def test_create_deployment_async(request_type, transport: str = "grpc_asyncio"): client = TelcoAutomationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10630,7 +10681,7 @@ async def test_create_deployment_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( @@ -10673,11 +10724,6 @@ async def test_create_deployment_async( assert response.rollback_support is True -@pytest.mark.asyncio -async def test_create_deployment_async_from_dict(): - await test_create_deployment_async(request_type=dict) - - def test_create_deployment_field_headers(): client = TelcoAutomationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10852,8 +10898,8 @@ async def test_create_deployment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - telcoautomation.UpdateDeploymentRequest, - dict, + telcoautomation.UpdateDeploymentRequest(), + {}, ], ) def test_update_deployment(request_type, transport: str = "grpc"): @@ -10864,7 +10910,7 @@ def test_update_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10928,7 +10974,8 @@ def test_update_deployment_non_empty_request_with_auto_populated_field(): client.update_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == telcoautomation.UpdateDeploymentRequest() + request_msg = telcoautomation.UpdateDeploymentRequest() + assert args[0] == request_msg def test_update_deployment_use_cached_wrapped_rpc(): @@ -11011,10 +11058,14 @@ async def test_update_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_deployment_async( - transport: str = "grpc_asyncio", - request_type=telcoautomation.UpdateDeploymentRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + telcoautomation.UpdateDeploymentRequest(), + {}, + ], +) +async def test_update_deployment_async(request_type, transport: str = "grpc_asyncio"): client = TelcoAutomationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11022,7 +11073,7 @@ async def test_update_deployment_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( @@ -11065,11 +11116,6 @@ async def test_update_deployment_async( assert response.rollback_support is True -@pytest.mark.asyncio -async def test_update_deployment_async_from_dict(): - await test_update_deployment_async(request_type=dict) - - def test_update_deployment_field_headers(): client = TelcoAutomationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11234,8 +11280,8 @@ async def test_update_deployment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - telcoautomation.GetDeploymentRequest, - dict, + telcoautomation.GetDeploymentRequest(), + {}, ], ) def test_get_deployment(request_type, transport: str = "grpc"): @@ -11246,7 +11292,7 @@ def test_get_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_deployment), "__call__") as call: @@ -11308,9 +11354,10 @@ def test_get_deployment_non_empty_request_with_auto_populated_field(): client.get_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == telcoautomation.GetDeploymentRequest( + request_msg = telcoautomation.GetDeploymentRequest( name="name_value", ) + assert args[0] == request_msg def test_get_deployment_use_cached_wrapped_rpc(): @@ -11391,9 +11438,14 @@ async def test_get_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_deployment_async( - transport: str = "grpc_asyncio", request_type=telcoautomation.GetDeploymentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + telcoautomation.GetDeploymentRequest(), + {}, + ], +) +async def test_get_deployment_async(request_type, transport: str = "grpc_asyncio"): client = TelcoAutomationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11401,7 +11453,7 @@ async def test_get_deployment_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_deployment), "__call__") as call: @@ -11442,11 +11494,6 @@ async def test_get_deployment_async( assert response.rollback_support is True -@pytest.mark.asyncio -async def test_get_deployment_async_from_dict(): - await test_get_deployment_async(request_type=dict) - - def test_get_deployment_field_headers(): client = TelcoAutomationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11593,8 +11640,8 @@ async def test_get_deployment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - telcoautomation.RemoveDeploymentRequest, - dict, + telcoautomation.RemoveDeploymentRequest(), + {}, ], ) def test_remove_deployment(request_type, transport: str = "grpc"): @@ -11605,7 +11652,7 @@ def test_remove_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11650,9 +11697,10 @@ def test_remove_deployment_non_empty_request_with_auto_populated_field(): client.remove_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == telcoautomation.RemoveDeploymentRequest( + request_msg = telcoautomation.RemoveDeploymentRequest( name="name_value", ) + assert args[0] == request_msg def test_remove_deployment_use_cached_wrapped_rpc(): @@ -11735,10 +11783,14 @@ async def test_remove_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_remove_deployment_async( - transport: str = "grpc_asyncio", - request_type=telcoautomation.RemoveDeploymentRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + telcoautomation.RemoveDeploymentRequest(), + {}, + ], +) +async def test_remove_deployment_async(request_type, transport: str = "grpc_asyncio"): client = TelcoAutomationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11746,7 +11798,7 @@ async def test_remove_deployment_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( @@ -11766,11 +11818,6 @@ async def test_remove_deployment_async( assert response is None -@pytest.mark.asyncio -async def test_remove_deployment_async_from_dict(): - await test_remove_deployment_async(request_type=dict) - - def test_remove_deployment_field_headers(): client = TelcoAutomationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11921,8 +11968,8 @@ async def test_remove_deployment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - telcoautomation.ListDeploymentsRequest, - dict, + telcoautomation.ListDeploymentsRequest(), + {}, ], ) def test_list_deployments(request_type, transport: str = "grpc"): @@ -11933,7 +11980,7 @@ def test_list_deployments(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_deployments), "__call__") as call: @@ -11979,11 +12026,12 @@ def test_list_deployments_non_empty_request_with_auto_populated_field(): client.list_deployments(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == telcoautomation.ListDeploymentsRequest( + request_msg = telcoautomation.ListDeploymentsRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_deployments_use_cached_wrapped_rpc(): @@ -12066,9 +12114,14 @@ async def test_list_deployments_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_deployments_async( - transport: str = "grpc_asyncio", request_type=telcoautomation.ListDeploymentsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + telcoautomation.ListDeploymentsRequest(), + {}, + ], +) +async def test_list_deployments_async(request_type, transport: str = "grpc_asyncio"): client = TelcoAutomationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12076,7 +12129,7 @@ async def test_list_deployments_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_deployments), "__call__") as call: @@ -12099,11 +12152,6 @@ async def test_list_deployments_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_deployments_async_from_dict(): - await test_list_deployments_async(request_type=dict) - - def test_list_deployments_field_headers(): client = TelcoAutomationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12440,8 +12488,8 @@ async def test_list_deployments_async_pages(): @pytest.mark.parametrize( "request_type", [ - telcoautomation.ListDeploymentRevisionsRequest, - dict, + telcoautomation.ListDeploymentRevisionsRequest(), + {}, ], ) def test_list_deployment_revisions(request_type, transport: str = "grpc"): @@ -12452,7 +12500,7 @@ def test_list_deployment_revisions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -12501,10 +12549,11 @@ def test_list_deployment_revisions_non_empty_request_with_auto_populated_field() client.list_deployment_revisions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == telcoautomation.ListDeploymentRevisionsRequest( + request_msg = telcoautomation.ListDeploymentRevisionsRequest( name="name_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_deployment_revisions_use_cached_wrapped_rpc(): @@ -12590,9 +12639,15 @@ async def test_list_deployment_revisions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + telcoautomation.ListDeploymentRevisionsRequest(), + {}, + ], +) async def test_list_deployment_revisions_async( - transport: str = "grpc_asyncio", - request_type=telcoautomation.ListDeploymentRevisionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = TelcoAutomationAsyncClient( credentials=async_anonymous_credentials(), @@ -12601,7 +12656,7 @@ async def test_list_deployment_revisions_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( @@ -12626,11 +12681,6 @@ async def test_list_deployment_revisions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_deployment_revisions_async_from_dict(): - await test_list_deployment_revisions_async(request_type=dict) - - def test_list_deployment_revisions_field_headers(): client = TelcoAutomationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12985,8 +13035,8 @@ async def test_list_deployment_revisions_async_pages(): @pytest.mark.parametrize( "request_type", [ - telcoautomation.DiscardDeploymentChangesRequest, - dict, + telcoautomation.DiscardDeploymentChangesRequest(), + {}, ], ) def test_discard_deployment_changes(request_type, transport: str = "grpc"): @@ -12997,7 +13047,7 @@ def test_discard_deployment_changes(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -13042,9 +13092,10 @@ def test_discard_deployment_changes_non_empty_request_with_auto_populated_field( client.discard_deployment_changes(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == telcoautomation.DiscardDeploymentChangesRequest( + request_msg = telcoautomation.DiscardDeploymentChangesRequest( name="name_value", ) + assert args[0] == request_msg def test_discard_deployment_changes_use_cached_wrapped_rpc(): @@ -13130,9 +13181,15 @@ async def test_discard_deployment_changes_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + telcoautomation.DiscardDeploymentChangesRequest(), + {}, + ], +) async def test_discard_deployment_changes_async( - transport: str = "grpc_asyncio", - request_type=telcoautomation.DiscardDeploymentChangesRequest, + request_type, transport: str = "grpc_asyncio" ): client = TelcoAutomationAsyncClient( credentials=async_anonymous_credentials(), @@ -13141,7 +13198,7 @@ async def test_discard_deployment_changes_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( @@ -13163,11 +13220,6 @@ async def test_discard_deployment_changes_async( assert isinstance(response, telcoautomation.DiscardDeploymentChangesResponse) -@pytest.mark.asyncio -async def test_discard_deployment_changes_async_from_dict(): - await test_discard_deployment_changes_async(request_type=dict) - - def test_discard_deployment_changes_field_headers(): client = TelcoAutomationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13322,8 +13374,8 @@ async def test_discard_deployment_changes_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - telcoautomation.ApplyDeploymentRequest, - dict, + telcoautomation.ApplyDeploymentRequest(), + {}, ], ) def test_apply_deployment(request_type, transport: str = "grpc"): @@ -13334,7 +13386,7 @@ def test_apply_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.apply_deployment), "__call__") as call: @@ -13396,9 +13448,10 @@ def test_apply_deployment_non_empty_request_with_auto_populated_field(): client.apply_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == telcoautomation.ApplyDeploymentRequest( + request_msg = telcoautomation.ApplyDeploymentRequest( name="name_value", ) + assert args[0] == request_msg def test_apply_deployment_use_cached_wrapped_rpc(): @@ -13481,9 +13534,14 @@ async def test_apply_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_apply_deployment_async( - transport: str = "grpc_asyncio", request_type=telcoautomation.ApplyDeploymentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + telcoautomation.ApplyDeploymentRequest(), + {}, + ], +) +async def test_apply_deployment_async(request_type, transport: str = "grpc_asyncio"): client = TelcoAutomationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13491,7 +13549,7 @@ async def test_apply_deployment_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.apply_deployment), "__call__") as call: @@ -13532,11 +13590,6 @@ async def test_apply_deployment_async( assert response.rollback_support is True -@pytest.mark.asyncio -async def test_apply_deployment_async_from_dict(): - await test_apply_deployment_async(request_type=dict) - - def test_apply_deployment_field_headers(): client = TelcoAutomationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13683,8 +13736,8 @@ async def test_apply_deployment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - telcoautomation.ComputeDeploymentStatusRequest, - dict, + telcoautomation.ComputeDeploymentStatusRequest(), + {}, ], ) def test_compute_deployment_status(request_type, transport: str = "grpc"): @@ -13695,7 +13748,7 @@ def test_compute_deployment_status(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -13745,9 +13798,10 @@ def test_compute_deployment_status_non_empty_request_with_auto_populated_field() client.compute_deployment_status(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == telcoautomation.ComputeDeploymentStatusRequest( + request_msg = telcoautomation.ComputeDeploymentStatusRequest( name="name_value", ) + assert args[0] == request_msg def test_compute_deployment_status_use_cached_wrapped_rpc(): @@ -13833,9 +13887,15 @@ async def test_compute_deployment_status_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + telcoautomation.ComputeDeploymentStatusRequest(), + {}, + ], +) async def test_compute_deployment_status_async( - transport: str = "grpc_asyncio", - request_type=telcoautomation.ComputeDeploymentStatusRequest, + request_type, transport: str = "grpc_asyncio" ): client = TelcoAutomationAsyncClient( credentials=async_anonymous_credentials(), @@ -13844,7 +13904,7 @@ async def test_compute_deployment_status_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( @@ -13871,11 +13931,6 @@ async def test_compute_deployment_status_async( assert response.aggregated_status == telcoautomation.Status.STATUS_IN_PROGRESS -@pytest.mark.asyncio -async def test_compute_deployment_status_async_from_dict(): - await test_compute_deployment_status_async(request_type=dict) - - def test_compute_deployment_status_field_headers(): client = TelcoAutomationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14030,8 +14085,8 @@ async def test_compute_deployment_status_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - telcoautomation.RollbackDeploymentRequest, - dict, + telcoautomation.RollbackDeploymentRequest(), + {}, ], ) def test_rollback_deployment(request_type, transport: str = "grpc"): @@ -14042,7 +14097,7 @@ def test_rollback_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -14109,10 +14164,11 @@ def test_rollback_deployment_non_empty_request_with_auto_populated_field(): client.rollback_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == telcoautomation.RollbackDeploymentRequest( + request_msg = telcoautomation.RollbackDeploymentRequest( name="name_value", revision_id="revision_id_value", ) + assert args[0] == request_msg def test_rollback_deployment_use_cached_wrapped_rpc(): @@ -14197,10 +14253,14 @@ async def test_rollback_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_rollback_deployment_async( - transport: str = "grpc_asyncio", - request_type=telcoautomation.RollbackDeploymentRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + telcoautomation.RollbackDeploymentRequest(), + {}, + ], +) +async def test_rollback_deployment_async(request_type, transport: str = "grpc_asyncio"): client = TelcoAutomationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14208,7 +14268,7 @@ async def test_rollback_deployment_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( @@ -14251,11 +14311,6 @@ async def test_rollback_deployment_async( assert response.rollback_support is True -@pytest.mark.asyncio -async def test_rollback_deployment_async_from_dict(): - await test_rollback_deployment_async(request_type=dict) - - def test_rollback_deployment_field_headers(): client = TelcoAutomationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14420,8 +14475,8 @@ async def test_rollback_deployment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - telcoautomation.GetHydratedDeploymentRequest, - dict, + telcoautomation.GetHydratedDeploymentRequest(), + {}, ], ) def test_get_hydrated_deployment(request_type, transport: str = "grpc"): @@ -14432,7 +14487,7 @@ def test_get_hydrated_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -14484,9 +14539,10 @@ def test_get_hydrated_deployment_non_empty_request_with_auto_populated_field(): client.get_hydrated_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == telcoautomation.GetHydratedDeploymentRequest( + request_msg = telcoautomation.GetHydratedDeploymentRequest( name="name_value", ) + assert args[0] == request_msg def test_get_hydrated_deployment_use_cached_wrapped_rpc(): @@ -14572,9 +14628,15 @@ async def test_get_hydrated_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + telcoautomation.GetHydratedDeploymentRequest(), + {}, + ], +) async def test_get_hydrated_deployment_async( - transport: str = "grpc_asyncio", - request_type=telcoautomation.GetHydratedDeploymentRequest, + request_type, transport: str = "grpc_asyncio" ): client = TelcoAutomationAsyncClient( credentials=async_anonymous_credentials(), @@ -14583,7 +14645,7 @@ async def test_get_hydrated_deployment_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( @@ -14612,11 +14674,6 @@ async def test_get_hydrated_deployment_async( assert response.workload_cluster == "workload_cluster_value" -@pytest.mark.asyncio -async def test_get_hydrated_deployment_async_from_dict(): - await test_get_hydrated_deployment_async(request_type=dict) - - def test_get_hydrated_deployment_field_headers(): client = TelcoAutomationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14771,8 +14828,8 @@ async def test_get_hydrated_deployment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - telcoautomation.ListHydratedDeploymentsRequest, - dict, + telcoautomation.ListHydratedDeploymentsRequest(), + {}, ], ) def test_list_hydrated_deployments(request_type, transport: str = "grpc"): @@ -14783,7 +14840,7 @@ def test_list_hydrated_deployments(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -14832,10 +14889,11 @@ def test_list_hydrated_deployments_non_empty_request_with_auto_populated_field() client.list_hydrated_deployments(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == telcoautomation.ListHydratedDeploymentsRequest( + request_msg = telcoautomation.ListHydratedDeploymentsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_hydrated_deployments_use_cached_wrapped_rpc(): @@ -14921,9 +14979,15 @@ async def test_list_hydrated_deployments_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + telcoautomation.ListHydratedDeploymentsRequest(), + {}, + ], +) async def test_list_hydrated_deployments_async( - transport: str = "grpc_asyncio", - request_type=telcoautomation.ListHydratedDeploymentsRequest, + request_type, transport: str = "grpc_asyncio" ): client = TelcoAutomationAsyncClient( credentials=async_anonymous_credentials(), @@ -14932,7 +14996,7 @@ async def test_list_hydrated_deployments_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( @@ -14957,11 +15021,6 @@ async def test_list_hydrated_deployments_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_hydrated_deployments_async_from_dict(): - await test_list_hydrated_deployments_async(request_type=dict) - - def test_list_hydrated_deployments_field_headers(): client = TelcoAutomationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15316,8 +15375,8 @@ async def test_list_hydrated_deployments_async_pages(): @pytest.mark.parametrize( "request_type", [ - telcoautomation.UpdateHydratedDeploymentRequest, - dict, + telcoautomation.UpdateHydratedDeploymentRequest(), + {}, ], ) def test_update_hydrated_deployment(request_type, transport: str = "grpc"): @@ -15328,7 +15387,7 @@ def test_update_hydrated_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -15378,7 +15437,8 @@ def test_update_hydrated_deployment_non_empty_request_with_auto_populated_field( client.update_hydrated_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == telcoautomation.UpdateHydratedDeploymentRequest() + request_msg = telcoautomation.UpdateHydratedDeploymentRequest() + assert args[0] == request_msg def test_update_hydrated_deployment_use_cached_wrapped_rpc(): @@ -15464,9 +15524,15 @@ async def test_update_hydrated_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + telcoautomation.UpdateHydratedDeploymentRequest(), + {}, + ], +) async def test_update_hydrated_deployment_async( - transport: str = "grpc_asyncio", - request_type=telcoautomation.UpdateHydratedDeploymentRequest, + request_type, transport: str = "grpc_asyncio" ): client = TelcoAutomationAsyncClient( credentials=async_anonymous_credentials(), @@ -15475,7 +15541,7 @@ async def test_update_hydrated_deployment_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( @@ -15504,11 +15570,6 @@ async def test_update_hydrated_deployment_async( assert response.workload_cluster == "workload_cluster_value" -@pytest.mark.asyncio -async def test_update_hydrated_deployment_async_from_dict(): - await test_update_hydrated_deployment_async(request_type=dict) - - def test_update_hydrated_deployment_field_headers(): client = TelcoAutomationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15673,8 +15734,8 @@ async def test_update_hydrated_deployment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - telcoautomation.ApplyHydratedDeploymentRequest, - dict, + telcoautomation.ApplyHydratedDeploymentRequest(), + {}, ], ) def test_apply_hydrated_deployment(request_type, transport: str = "grpc"): @@ -15685,7 +15746,7 @@ def test_apply_hydrated_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -15737,9 +15798,10 @@ def test_apply_hydrated_deployment_non_empty_request_with_auto_populated_field() client.apply_hydrated_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == telcoautomation.ApplyHydratedDeploymentRequest( + request_msg = telcoautomation.ApplyHydratedDeploymentRequest( name="name_value", ) + assert args[0] == request_msg def test_apply_hydrated_deployment_use_cached_wrapped_rpc(): @@ -15825,9 +15887,15 @@ async def test_apply_hydrated_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + telcoautomation.ApplyHydratedDeploymentRequest(), + {}, + ], +) async def test_apply_hydrated_deployment_async( - transport: str = "grpc_asyncio", - request_type=telcoautomation.ApplyHydratedDeploymentRequest, + request_type, transport: str = "grpc_asyncio" ): client = TelcoAutomationAsyncClient( credentials=async_anonymous_credentials(), @@ -15836,7 +15904,7 @@ async def test_apply_hydrated_deployment_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( @@ -15865,11 +15933,6 @@ async def test_apply_hydrated_deployment_async( assert response.workload_cluster == "workload_cluster_value" -@pytest.mark.asyncio -async def test_apply_hydrated_deployment_async_from_dict(): - await test_apply_hydrated_deployment_async(request_type=dict) - - def test_apply_hydrated_deployment_field_headers(): client = TelcoAutomationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -23757,7 +23820,6 @@ def test_list_orchestration_clusters_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ListOrchestrationClustersRequest() - assert args[0] == request_msg @@ -23780,7 +23842,6 @@ def test_get_orchestration_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.GetOrchestrationClusterRequest() - assert args[0] == request_msg @@ -23803,7 +23864,6 @@ def test_create_orchestration_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.CreateOrchestrationClusterRequest() - assert args[0] == request_msg @@ -23826,7 +23886,6 @@ def test_delete_orchestration_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.DeleteOrchestrationClusterRequest() - assert args[0] == request_msg @@ -23847,7 +23906,6 @@ def test_list_edge_slms_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ListEdgeSlmsRequest() - assert args[0] == request_msg @@ -23868,7 +23926,6 @@ def test_get_edge_slm_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.GetEdgeSlmRequest() - assert args[0] == request_msg @@ -23889,7 +23946,6 @@ def test_create_edge_slm_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.CreateEdgeSlmRequest() - assert args[0] == request_msg @@ -23910,7 +23966,6 @@ def test_delete_edge_slm_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.DeleteEdgeSlmRequest() - assert args[0] == request_msg @@ -23931,7 +23986,6 @@ def test_create_blueprint_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.CreateBlueprintRequest() - assert args[0] == request_msg @@ -23952,7 +24006,6 @@ def test_update_blueprint_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.UpdateBlueprintRequest() - assert args[0] == request_msg @@ -23973,7 +24026,6 @@ def test_get_blueprint_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.GetBlueprintRequest() - assert args[0] == request_msg @@ -23994,7 +24046,6 @@ def test_delete_blueprint_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.DeleteBlueprintRequest() - assert args[0] == request_msg @@ -24015,7 +24066,6 @@ def test_list_blueprints_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ListBlueprintsRequest() - assert args[0] == request_msg @@ -24038,7 +24088,6 @@ def test_approve_blueprint_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ApproveBlueprintRequest() - assert args[0] == request_msg @@ -24061,7 +24110,6 @@ def test_propose_blueprint_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ProposeBlueprintRequest() - assert args[0] == request_msg @@ -24082,7 +24130,6 @@ def test_reject_blueprint_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.RejectBlueprintRequest() - assert args[0] == request_msg @@ -24105,7 +24152,6 @@ def test_list_blueprint_revisions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ListBlueprintRevisionsRequest() - assert args[0] == request_msg @@ -24128,7 +24174,6 @@ def test_search_blueprint_revisions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.SearchBlueprintRevisionsRequest() - assert args[0] == request_msg @@ -24151,7 +24196,6 @@ def test_search_deployment_revisions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.SearchDeploymentRevisionsRequest() - assert args[0] == request_msg @@ -24174,7 +24218,6 @@ def test_discard_blueprint_changes_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.DiscardBlueprintChangesRequest() - assert args[0] == request_msg @@ -24197,7 +24240,6 @@ def test_list_public_blueprints_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ListPublicBlueprintsRequest() - assert args[0] == request_msg @@ -24220,7 +24262,6 @@ def test_get_public_blueprint_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.GetPublicBlueprintRequest() - assert args[0] == request_msg @@ -24243,7 +24284,6 @@ def test_create_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.CreateDeploymentRequest() - assert args[0] == request_msg @@ -24266,7 +24306,6 @@ def test_update_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.UpdateDeploymentRequest() - assert args[0] == request_msg @@ -24287,7 +24326,6 @@ def test_get_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.GetDeploymentRequest() - assert args[0] == request_msg @@ -24310,7 +24348,6 @@ def test_remove_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.RemoveDeploymentRequest() - assert args[0] == request_msg @@ -24331,7 +24368,6 @@ def test_list_deployments_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ListDeploymentsRequest() - assert args[0] == request_msg @@ -24354,7 +24390,6 @@ def test_list_deployment_revisions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ListDeploymentRevisionsRequest() - assert args[0] == request_msg @@ -24377,7 +24412,6 @@ def test_discard_deployment_changes_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.DiscardDeploymentChangesRequest() - assert args[0] == request_msg @@ -24398,7 +24432,6 @@ def test_apply_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ApplyDeploymentRequest() - assert args[0] == request_msg @@ -24421,7 +24454,6 @@ def test_compute_deployment_status_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ComputeDeploymentStatusRequest() - assert args[0] == request_msg @@ -24444,7 +24476,6 @@ def test_rollback_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.RollbackDeploymentRequest() - assert args[0] == request_msg @@ -24467,7 +24498,6 @@ def test_get_hydrated_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.GetHydratedDeploymentRequest() - assert args[0] == request_msg @@ -24490,7 +24520,6 @@ def test_list_hydrated_deployments_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ListHydratedDeploymentsRequest() - assert args[0] == request_msg @@ -24513,7 +24542,6 @@ def test_update_hydrated_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.UpdateHydratedDeploymentRequest() - assert args[0] == request_msg @@ -24536,7 +24564,6 @@ def test_apply_hydrated_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ApplyHydratedDeploymentRequest() - assert args[0] == request_msg @@ -24580,7 +24607,6 @@ async def test_list_orchestration_clusters_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ListOrchestrationClustersRequest() - assert args[0] == request_msg @@ -24611,7 +24637,6 @@ async def test_get_orchestration_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.GetOrchestrationClusterRequest() - assert args[0] == request_msg @@ -24638,7 +24663,6 @@ async def test_create_orchestration_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.CreateOrchestrationClusterRequest() - assert args[0] == request_msg @@ -24665,7 +24689,6 @@ async def test_delete_orchestration_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.DeleteOrchestrationClusterRequest() - assert args[0] == request_msg @@ -24693,7 +24716,6 @@ async def test_list_edge_slms_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ListEdgeSlmsRequest() - assert args[0] == request_msg @@ -24724,7 +24746,6 @@ async def test_get_edge_slm_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.GetEdgeSlmRequest() - assert args[0] == request_msg @@ -24749,7 +24770,6 @@ async def test_create_edge_slm_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.CreateEdgeSlmRequest() - assert args[0] == request_msg @@ -24774,7 +24794,6 @@ async def test_delete_edge_slm_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.DeleteEdgeSlmRequest() - assert args[0] == request_msg @@ -24809,7 +24828,6 @@ async def test_create_blueprint_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.CreateBlueprintRequest() - assert args[0] == request_msg @@ -24844,7 +24862,6 @@ async def test_update_blueprint_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.UpdateBlueprintRequest() - assert args[0] == request_msg @@ -24879,7 +24896,6 @@ async def test_get_blueprint_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.GetBlueprintRequest() - assert args[0] == request_msg @@ -24902,7 +24918,6 @@ async def test_delete_blueprint_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.DeleteBlueprintRequest() - assert args[0] == request_msg @@ -24929,7 +24944,6 @@ async def test_list_blueprints_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ListBlueprintsRequest() - assert args[0] == request_msg @@ -24966,7 +24980,6 @@ async def test_approve_blueprint_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ApproveBlueprintRequest() - assert args[0] == request_msg @@ -25003,7 +25016,6 @@ async def test_propose_blueprint_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ProposeBlueprintRequest() - assert args[0] == request_msg @@ -25038,7 +25050,6 @@ async def test_reject_blueprint_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.RejectBlueprintRequest() - assert args[0] == request_msg @@ -25067,7 +25078,6 @@ async def test_list_blueprint_revisions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ListBlueprintRevisionsRequest() - assert args[0] == request_msg @@ -25096,7 +25106,6 @@ async def test_search_blueprint_revisions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.SearchBlueprintRevisionsRequest() - assert args[0] == request_msg @@ -25125,7 +25134,6 @@ async def test_search_deployment_revisions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.SearchDeploymentRevisionsRequest() - assert args[0] == request_msg @@ -25152,7 +25160,6 @@ async def test_discard_blueprint_changes_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.DiscardBlueprintChangesRequest() - assert args[0] == request_msg @@ -25181,7 +25188,6 @@ async def test_list_public_blueprints_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ListPublicBlueprintsRequest() - assert args[0] == request_msg @@ -25215,7 +25221,6 @@ async def test_get_public_blueprint_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.GetPublicBlueprintRequest() - assert args[0] == request_msg @@ -25253,7 +25258,6 @@ async def test_create_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.CreateDeploymentRequest() - assert args[0] == request_msg @@ -25291,7 +25295,6 @@ async def test_update_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.UpdateDeploymentRequest() - assert args[0] == request_msg @@ -25327,7 +25330,6 @@ async def test_get_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.GetDeploymentRequest() - assert args[0] == request_msg @@ -25352,7 +25354,6 @@ async def test_remove_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.RemoveDeploymentRequest() - assert args[0] == request_msg @@ -25379,7 +25380,6 @@ async def test_list_deployments_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ListDeploymentsRequest() - assert args[0] == request_msg @@ -25408,7 +25408,6 @@ async def test_list_deployment_revisions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ListDeploymentRevisionsRequest() - assert args[0] == request_msg @@ -25435,7 +25434,6 @@ async def test_discard_deployment_changes_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.DiscardDeploymentChangesRequest() - assert args[0] == request_msg @@ -25471,7 +25469,6 @@ async def test_apply_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ApplyDeploymentRequest() - assert args[0] == request_msg @@ -25501,7 +25498,6 @@ async def test_compute_deployment_status_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ComputeDeploymentStatusRequest() - assert args[0] == request_msg @@ -25539,7 +25535,6 @@ async def test_rollback_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.RollbackDeploymentRequest() - assert args[0] == request_msg @@ -25570,7 +25565,6 @@ async def test_get_hydrated_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.GetHydratedDeploymentRequest() - assert args[0] == request_msg @@ -25599,7 +25593,6 @@ async def test_list_hydrated_deployments_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ListHydratedDeploymentsRequest() - assert args[0] == request_msg @@ -25630,7 +25623,6 @@ async def test_update_hydrated_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.UpdateHydratedDeploymentRequest() - assert args[0] == request_msg @@ -25661,7 +25653,6 @@ async def test_apply_hydrated_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ApplyHydratedDeploymentRequest() - assert args[0] == request_msg @@ -31790,7 +31781,6 @@ def test_list_orchestration_clusters_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ListOrchestrationClustersRequest() - assert args[0] == request_msg @@ -31812,7 +31802,6 @@ def test_get_orchestration_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.GetOrchestrationClusterRequest() - assert args[0] == request_msg @@ -31834,7 +31823,6 @@ def test_create_orchestration_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.CreateOrchestrationClusterRequest() - assert args[0] == request_msg @@ -31856,7 +31844,6 @@ def test_delete_orchestration_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.DeleteOrchestrationClusterRequest() - assert args[0] == request_msg @@ -31876,7 +31863,6 @@ def test_list_edge_slms_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ListEdgeSlmsRequest() - assert args[0] == request_msg @@ -31896,7 +31882,6 @@ def test_get_edge_slm_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.GetEdgeSlmRequest() - assert args[0] == request_msg @@ -31916,7 +31901,6 @@ def test_create_edge_slm_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.CreateEdgeSlmRequest() - assert args[0] == request_msg @@ -31936,7 +31920,6 @@ def test_delete_edge_slm_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.DeleteEdgeSlmRequest() - assert args[0] == request_msg @@ -31956,7 +31939,6 @@ def test_create_blueprint_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.CreateBlueprintRequest() - assert args[0] == request_msg @@ -31976,7 +31958,6 @@ def test_update_blueprint_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.UpdateBlueprintRequest() - assert args[0] == request_msg @@ -31996,7 +31977,6 @@ def test_get_blueprint_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.GetBlueprintRequest() - assert args[0] == request_msg @@ -32016,7 +31996,6 @@ def test_delete_blueprint_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.DeleteBlueprintRequest() - assert args[0] == request_msg @@ -32036,7 +32015,6 @@ def test_list_blueprints_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ListBlueprintsRequest() - assert args[0] == request_msg @@ -32058,7 +32036,6 @@ def test_approve_blueprint_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ApproveBlueprintRequest() - assert args[0] == request_msg @@ -32080,7 +32057,6 @@ def test_propose_blueprint_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ProposeBlueprintRequest() - assert args[0] == request_msg @@ -32100,7 +32076,6 @@ def test_reject_blueprint_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.RejectBlueprintRequest() - assert args[0] == request_msg @@ -32122,7 +32097,6 @@ def test_list_blueprint_revisions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ListBlueprintRevisionsRequest() - assert args[0] == request_msg @@ -32144,7 +32118,6 @@ def test_search_blueprint_revisions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.SearchBlueprintRevisionsRequest() - assert args[0] == request_msg @@ -32166,7 +32139,6 @@ def test_search_deployment_revisions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.SearchDeploymentRevisionsRequest() - assert args[0] == request_msg @@ -32188,7 +32160,6 @@ def test_discard_blueprint_changes_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.DiscardBlueprintChangesRequest() - assert args[0] == request_msg @@ -32210,7 +32181,6 @@ def test_list_public_blueprints_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ListPublicBlueprintsRequest() - assert args[0] == request_msg @@ -32232,7 +32202,6 @@ def test_get_public_blueprint_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.GetPublicBlueprintRequest() - assert args[0] == request_msg @@ -32254,7 +32223,6 @@ def test_create_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.CreateDeploymentRequest() - assert args[0] == request_msg @@ -32276,7 +32244,6 @@ def test_update_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.UpdateDeploymentRequest() - assert args[0] == request_msg @@ -32296,7 +32263,6 @@ def test_get_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.GetDeploymentRequest() - assert args[0] == request_msg @@ -32318,7 +32284,6 @@ def test_remove_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.RemoveDeploymentRequest() - assert args[0] == request_msg @@ -32338,7 +32303,6 @@ def test_list_deployments_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ListDeploymentsRequest() - assert args[0] == request_msg @@ -32360,7 +32324,6 @@ def test_list_deployment_revisions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ListDeploymentRevisionsRequest() - assert args[0] == request_msg @@ -32382,7 +32345,6 @@ def test_discard_deployment_changes_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.DiscardDeploymentChangesRequest() - assert args[0] == request_msg @@ -32402,7 +32364,6 @@ def test_apply_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ApplyDeploymentRequest() - assert args[0] == request_msg @@ -32424,7 +32385,6 @@ def test_compute_deployment_status_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ComputeDeploymentStatusRequest() - assert args[0] == request_msg @@ -32446,7 +32406,6 @@ def test_rollback_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.RollbackDeploymentRequest() - assert args[0] == request_msg @@ -32468,7 +32427,6 @@ def test_get_hydrated_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.GetHydratedDeploymentRequest() - assert args[0] == request_msg @@ -32490,7 +32448,6 @@ def test_list_hydrated_deployments_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ListHydratedDeploymentsRequest() - assert args[0] == request_msg @@ -32512,7 +32469,6 @@ def test_update_hydrated_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.UpdateHydratedDeploymentRequest() - assert args[0] == request_msg @@ -32534,7 +32490,6 @@ def test_apply_hydrated_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ApplyHydratedDeploymentRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-telcoautomation/tests/unit/gapic/telcoautomation_v1alpha1/test_telco_automation.py b/packages/google-cloud-telcoautomation/tests/unit/gapic/telcoautomation_v1alpha1/test_telco_automation.py index 65fc6a98bc2d..8add92dd4085 100644 --- a/packages/google-cloud-telcoautomation/tests/unit/gapic/telcoautomation_v1alpha1/test_telco_automation.py +++ b/packages/google-cloud-telcoautomation/tests/unit/gapic/telcoautomation_v1alpha1/test_telco_automation.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 @@ -116,6 +117,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" @@ -1343,8 +1359,8 @@ def test_telco_automation_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - telcoautomation.ListOrchestrationClustersRequest, - dict, + telcoautomation.ListOrchestrationClustersRequest(), + {}, ], ) def test_list_orchestration_clusters(request_type, transport: str = "grpc"): @@ -1355,7 +1371,7 @@ def test_list_orchestration_clusters(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1408,12 +1424,13 @@ def test_list_orchestration_clusters_non_empty_request_with_auto_populated_field client.list_orchestration_clusters(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == telcoautomation.ListOrchestrationClustersRequest( + request_msg = telcoautomation.ListOrchestrationClustersRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_orchestration_clusters_use_cached_wrapped_rpc(): @@ -1499,9 +1516,15 @@ async def test_list_orchestration_clusters_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + telcoautomation.ListOrchestrationClustersRequest(), + {}, + ], +) async def test_list_orchestration_clusters_async( - transport: str = "grpc_asyncio", - request_type=telcoautomation.ListOrchestrationClustersRequest, + request_type, transport: str = "grpc_asyncio" ): client = TelcoAutomationAsyncClient( credentials=async_anonymous_credentials(), @@ -1510,7 +1533,7 @@ async def test_list_orchestration_clusters_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( @@ -1537,11 +1560,6 @@ async def test_list_orchestration_clusters_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_orchestration_clusters_async_from_dict(): - await test_list_orchestration_clusters_async(request_type=dict) - - def test_list_orchestration_clusters_field_headers(): client = TelcoAutomationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1898,8 +1916,8 @@ async def test_list_orchestration_clusters_async_pages(): @pytest.mark.parametrize( "request_type", [ - telcoautomation.GetOrchestrationClusterRequest, - dict, + telcoautomation.GetOrchestrationClusterRequest(), + {}, ], ) def test_get_orchestration_cluster(request_type, transport: str = "grpc"): @@ -1910,7 +1928,7 @@ def test_get_orchestration_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1962,9 +1980,10 @@ def test_get_orchestration_cluster_non_empty_request_with_auto_populated_field() client.get_orchestration_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == telcoautomation.GetOrchestrationClusterRequest( + request_msg = telcoautomation.GetOrchestrationClusterRequest( name="name_value", ) + assert args[0] == request_msg def test_get_orchestration_cluster_use_cached_wrapped_rpc(): @@ -2050,9 +2069,15 @@ async def test_get_orchestration_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + telcoautomation.GetOrchestrationClusterRequest(), + {}, + ], +) async def test_get_orchestration_cluster_async( - transport: str = "grpc_asyncio", - request_type=telcoautomation.GetOrchestrationClusterRequest, + request_type, transport: str = "grpc_asyncio" ): client = TelcoAutomationAsyncClient( credentials=async_anonymous_credentials(), @@ -2061,7 +2086,7 @@ async def test_get_orchestration_cluster_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( @@ -2090,11 +2115,6 @@ async def test_get_orchestration_cluster_async( assert response.state == telcoautomation.OrchestrationCluster.State.CREATING -@pytest.mark.asyncio -async def test_get_orchestration_cluster_async_from_dict(): - await test_get_orchestration_cluster_async(request_type=dict) - - def test_get_orchestration_cluster_field_headers(): client = TelcoAutomationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2249,8 +2269,8 @@ async def test_get_orchestration_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - telcoautomation.CreateOrchestrationClusterRequest, - dict, + telcoautomation.CreateOrchestrationClusterRequest(), + {}, ], ) def test_create_orchestration_cluster(request_type, transport: str = "grpc"): @@ -2261,7 +2281,7 @@ def test_create_orchestration_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2308,11 +2328,12 @@ def test_create_orchestration_cluster_non_empty_request_with_auto_populated_fiel client.create_orchestration_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == telcoautomation.CreateOrchestrationClusterRequest( + request_msg = telcoautomation.CreateOrchestrationClusterRequest( parent="parent_value", orchestration_cluster_id="orchestration_cluster_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_orchestration_cluster_use_cached_wrapped_rpc(): @@ -2408,9 +2429,15 @@ async def test_create_orchestration_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + telcoautomation.CreateOrchestrationClusterRequest(), + {}, + ], +) async def test_create_orchestration_cluster_async( - transport: str = "grpc_asyncio", - request_type=telcoautomation.CreateOrchestrationClusterRequest, + request_type, transport: str = "grpc_asyncio" ): client = TelcoAutomationAsyncClient( credentials=async_anonymous_credentials(), @@ -2419,7 +2446,7 @@ async def test_create_orchestration_cluster_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( @@ -2441,11 +2468,6 @@ async def test_create_orchestration_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_orchestration_cluster_async_from_dict(): - await test_create_orchestration_cluster_async(request_type=dict) - - def test_create_orchestration_cluster_field_headers(): client = TelcoAutomationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2628,8 +2650,8 @@ async def test_create_orchestration_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - telcoautomation.DeleteOrchestrationClusterRequest, - dict, + telcoautomation.DeleteOrchestrationClusterRequest(), + {}, ], ) def test_delete_orchestration_cluster(request_type, transport: str = "grpc"): @@ -2640,7 +2662,7 @@ def test_delete_orchestration_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2686,10 +2708,11 @@ def test_delete_orchestration_cluster_non_empty_request_with_auto_populated_fiel client.delete_orchestration_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == telcoautomation.DeleteOrchestrationClusterRequest( + request_msg = telcoautomation.DeleteOrchestrationClusterRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_orchestration_cluster_use_cached_wrapped_rpc(): @@ -2785,9 +2808,15 @@ async def test_delete_orchestration_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + telcoautomation.DeleteOrchestrationClusterRequest(), + {}, + ], +) async def test_delete_orchestration_cluster_async( - transport: str = "grpc_asyncio", - request_type=telcoautomation.DeleteOrchestrationClusterRequest, + request_type, transport: str = "grpc_asyncio" ): client = TelcoAutomationAsyncClient( credentials=async_anonymous_credentials(), @@ -2796,7 +2825,7 @@ async def test_delete_orchestration_cluster_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( @@ -2818,11 +2847,6 @@ async def test_delete_orchestration_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_orchestration_cluster_async_from_dict(): - await test_delete_orchestration_cluster_async(request_type=dict) - - def test_delete_orchestration_cluster_field_headers(): client = TelcoAutomationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2977,8 +3001,8 @@ async def test_delete_orchestration_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - telcoautomation.ListEdgeSlmsRequest, - dict, + telcoautomation.ListEdgeSlmsRequest(), + {}, ], ) def test_list_edge_slms(request_type, transport: str = "grpc"): @@ -2989,7 +3013,7 @@ def test_list_edge_slms(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_edge_slms), "__call__") as call: @@ -3038,12 +3062,13 @@ def test_list_edge_slms_non_empty_request_with_auto_populated_field(): client.list_edge_slms(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == telcoautomation.ListEdgeSlmsRequest( + request_msg = telcoautomation.ListEdgeSlmsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_edge_slms_use_cached_wrapped_rpc(): @@ -3124,9 +3149,14 @@ async def test_list_edge_slms_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_edge_slms_async( - transport: str = "grpc_asyncio", request_type=telcoautomation.ListEdgeSlmsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + telcoautomation.ListEdgeSlmsRequest(), + {}, + ], +) +async def test_list_edge_slms_async(request_type, transport: str = "grpc_asyncio"): client = TelcoAutomationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3134,7 +3164,7 @@ async def test_list_edge_slms_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_edge_slms), "__call__") as call: @@ -3159,11 +3189,6 @@ async def test_list_edge_slms_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_edge_slms_async_from_dict(): - await test_list_edge_slms_async(request_type=dict) - - def test_list_edge_slms_field_headers(): client = TelcoAutomationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3500,8 +3525,8 @@ async def test_list_edge_slms_async_pages(): @pytest.mark.parametrize( "request_type", [ - telcoautomation.GetEdgeSlmRequest, - dict, + telcoautomation.GetEdgeSlmRequest(), + {}, ], ) def test_get_edge_slm(request_type, transport: str = "grpc"): @@ -3512,7 +3537,7 @@ def test_get_edge_slm(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_edge_slm), "__call__") as call: @@ -3567,9 +3592,10 @@ def test_get_edge_slm_non_empty_request_with_auto_populated_field(): client.get_edge_slm(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == telcoautomation.GetEdgeSlmRequest( + request_msg = telcoautomation.GetEdgeSlmRequest( name="name_value", ) + assert args[0] == request_msg def test_get_edge_slm_use_cached_wrapped_rpc(): @@ -3650,9 +3676,14 @@ async def test_get_edge_slm_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_edge_slm_async( - transport: str = "grpc_asyncio", request_type=telcoautomation.GetEdgeSlmRequest -): +@pytest.mark.parametrize( + "request_type", + [ + telcoautomation.GetEdgeSlmRequest(), + {}, + ], +) +async def test_get_edge_slm_async(request_type, transport: str = "grpc_asyncio"): client = TelcoAutomationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3660,7 +3691,7 @@ async def test_get_edge_slm_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_edge_slm), "__call__") as call: @@ -3694,11 +3725,6 @@ async def test_get_edge_slm_async( ) -@pytest.mark.asyncio -async def test_get_edge_slm_async_from_dict(): - await test_get_edge_slm_async(request_type=dict) - - def test_get_edge_slm_field_headers(): client = TelcoAutomationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3845,8 +3871,8 @@ async def test_get_edge_slm_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - telcoautomation.CreateEdgeSlmRequest, - dict, + telcoautomation.CreateEdgeSlmRequest(), + {}, ], ) def test_create_edge_slm(request_type, transport: str = "grpc"): @@ -3857,7 +3883,7 @@ def test_create_edge_slm(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_edge_slm), "__call__") as call: @@ -3900,11 +3926,12 @@ def test_create_edge_slm_non_empty_request_with_auto_populated_field(): client.create_edge_slm(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == telcoautomation.CreateEdgeSlmRequest( + request_msg = telcoautomation.CreateEdgeSlmRequest( parent="parent_value", edge_slm_id="edge_slm_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_edge_slm_use_cached_wrapped_rpc(): @@ -3995,9 +4022,14 @@ async def test_create_edge_slm_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_edge_slm_async( - transport: str = "grpc_asyncio", request_type=telcoautomation.CreateEdgeSlmRequest -): +@pytest.mark.parametrize( + "request_type", + [ + telcoautomation.CreateEdgeSlmRequest(), + {}, + ], +) +async def test_create_edge_slm_async(request_type, transport: str = "grpc_asyncio"): client = TelcoAutomationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4005,7 +4037,7 @@ async def test_create_edge_slm_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_edge_slm), "__call__") as call: @@ -4025,11 +4057,6 @@ async def test_create_edge_slm_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_edge_slm_async_from_dict(): - await test_create_edge_slm_async(request_type=dict) - - def test_create_edge_slm_field_headers(): client = TelcoAutomationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4196,8 +4223,8 @@ async def test_create_edge_slm_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - telcoautomation.DeleteEdgeSlmRequest, - dict, + telcoautomation.DeleteEdgeSlmRequest(), + {}, ], ) def test_delete_edge_slm(request_type, transport: str = "grpc"): @@ -4208,7 +4235,7 @@ def test_delete_edge_slm(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_edge_slm), "__call__") as call: @@ -4250,10 +4277,11 @@ def test_delete_edge_slm_non_empty_request_with_auto_populated_field(): client.delete_edge_slm(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == telcoautomation.DeleteEdgeSlmRequest( + request_msg = telcoautomation.DeleteEdgeSlmRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_edge_slm_use_cached_wrapped_rpc(): @@ -4344,9 +4372,14 @@ async def test_delete_edge_slm_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_edge_slm_async( - transport: str = "grpc_asyncio", request_type=telcoautomation.DeleteEdgeSlmRequest -): +@pytest.mark.parametrize( + "request_type", + [ + telcoautomation.DeleteEdgeSlmRequest(), + {}, + ], +) +async def test_delete_edge_slm_async(request_type, transport: str = "grpc_asyncio"): client = TelcoAutomationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4354,7 +4387,7 @@ async def test_delete_edge_slm_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_edge_slm), "__call__") as call: @@ -4374,11 +4407,6 @@ async def test_delete_edge_slm_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_edge_slm_async_from_dict(): - await test_delete_edge_slm_async(request_type=dict) - - def test_delete_edge_slm_field_headers(): client = TelcoAutomationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4525,8 +4553,8 @@ async def test_delete_edge_slm_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - telcoautomation.CreateBlueprintRequest, - dict, + telcoautomation.CreateBlueprintRequest(), + {}, ], ) def test_create_blueprint(request_type, transport: str = "grpc"): @@ -4537,7 +4565,7 @@ def test_create_blueprint(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_blueprint), "__call__") as call: @@ -4598,10 +4626,11 @@ def test_create_blueprint_non_empty_request_with_auto_populated_field(): client.create_blueprint(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == telcoautomation.CreateBlueprintRequest( + request_msg = telcoautomation.CreateBlueprintRequest( parent="parent_value", blueprint_id="blueprint_id_value", ) + assert args[0] == request_msg def test_create_blueprint_use_cached_wrapped_rpc(): @@ -4684,9 +4713,14 @@ async def test_create_blueprint_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_blueprint_async( - transport: str = "grpc_asyncio", request_type=telcoautomation.CreateBlueprintRequest -): +@pytest.mark.parametrize( + "request_type", + [ + telcoautomation.CreateBlueprintRequest(), + {}, + ], +) +async def test_create_blueprint_async(request_type, transport: str = "grpc_asyncio"): client = TelcoAutomationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4694,7 +4728,7 @@ async def test_create_blueprint_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_blueprint), "__call__") as call: @@ -4733,11 +4767,6 @@ async def test_create_blueprint_async( assert response.rollback_support is True -@pytest.mark.asyncio -async def test_create_blueprint_async_from_dict(): - await test_create_blueprint_async(request_type=dict) - - def test_create_blueprint_field_headers(): client = TelcoAutomationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4904,8 +4933,8 @@ async def test_create_blueprint_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - telcoautomation.UpdateBlueprintRequest, - dict, + telcoautomation.UpdateBlueprintRequest(), + {}, ], ) def test_update_blueprint(request_type, transport: str = "grpc"): @@ -4916,7 +4945,7 @@ def test_update_blueprint(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_blueprint), "__call__") as call: @@ -4974,7 +5003,8 @@ def test_update_blueprint_non_empty_request_with_auto_populated_field(): client.update_blueprint(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == telcoautomation.UpdateBlueprintRequest() + request_msg = telcoautomation.UpdateBlueprintRequest() + assert args[0] == request_msg def test_update_blueprint_use_cached_wrapped_rpc(): @@ -5057,9 +5087,14 @@ async def test_update_blueprint_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_blueprint_async( - transport: str = "grpc_asyncio", request_type=telcoautomation.UpdateBlueprintRequest -): +@pytest.mark.parametrize( + "request_type", + [ + telcoautomation.UpdateBlueprintRequest(), + {}, + ], +) +async def test_update_blueprint_async(request_type, transport: str = "grpc_asyncio"): client = TelcoAutomationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5067,7 +5102,7 @@ async def test_update_blueprint_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_blueprint), "__call__") as call: @@ -5106,11 +5141,6 @@ async def test_update_blueprint_async( assert response.rollback_support is True -@pytest.mark.asyncio -async def test_update_blueprint_async_from_dict(): - await test_update_blueprint_async(request_type=dict) - - def test_update_blueprint_field_headers(): client = TelcoAutomationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5267,8 +5297,8 @@ async def test_update_blueprint_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - telcoautomation.GetBlueprintRequest, - dict, + telcoautomation.GetBlueprintRequest(), + {}, ], ) def test_get_blueprint(request_type, transport: str = "grpc"): @@ -5279,7 +5309,7 @@ def test_get_blueprint(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_blueprint), "__call__") as call: @@ -5339,9 +5369,10 @@ def test_get_blueprint_non_empty_request_with_auto_populated_field(): client.get_blueprint(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == telcoautomation.GetBlueprintRequest( + request_msg = telcoautomation.GetBlueprintRequest( name="name_value", ) + assert args[0] == request_msg def test_get_blueprint_use_cached_wrapped_rpc(): @@ -5422,9 +5453,14 @@ async def test_get_blueprint_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_blueprint_async( - transport: str = "grpc_asyncio", request_type=telcoautomation.GetBlueprintRequest -): +@pytest.mark.parametrize( + "request_type", + [ + telcoautomation.GetBlueprintRequest(), + {}, + ], +) +async def test_get_blueprint_async(request_type, transport: str = "grpc_asyncio"): client = TelcoAutomationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5432,7 +5468,7 @@ async def test_get_blueprint_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_blueprint), "__call__") as call: @@ -5471,11 +5507,6 @@ async def test_get_blueprint_async( assert response.rollback_support is True -@pytest.mark.asyncio -async def test_get_blueprint_async_from_dict(): - await test_get_blueprint_async(request_type=dict) - - def test_get_blueprint_field_headers(): client = TelcoAutomationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5622,8 +5653,8 @@ async def test_get_blueprint_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - telcoautomation.DeleteBlueprintRequest, - dict, + telcoautomation.DeleteBlueprintRequest(), + {}, ], ) def test_delete_blueprint(request_type, transport: str = "grpc"): @@ -5634,7 +5665,7 @@ def test_delete_blueprint(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_blueprint), "__call__") as call: @@ -5675,9 +5706,10 @@ def test_delete_blueprint_non_empty_request_with_auto_populated_field(): client.delete_blueprint(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == telcoautomation.DeleteBlueprintRequest( + request_msg = telcoautomation.DeleteBlueprintRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_blueprint_use_cached_wrapped_rpc(): @@ -5760,9 +5792,14 @@ async def test_delete_blueprint_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_blueprint_async( - transport: str = "grpc_asyncio", request_type=telcoautomation.DeleteBlueprintRequest -): +@pytest.mark.parametrize( + "request_type", + [ + telcoautomation.DeleteBlueprintRequest(), + {}, + ], +) +async def test_delete_blueprint_async(request_type, transport: str = "grpc_asyncio"): client = TelcoAutomationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5770,7 +5807,7 @@ async def test_delete_blueprint_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_blueprint), "__call__") as call: @@ -5788,11 +5825,6 @@ async def test_delete_blueprint_async( assert response is None -@pytest.mark.asyncio -async def test_delete_blueprint_async_from_dict(): - await test_delete_blueprint_async(request_type=dict) - - def test_delete_blueprint_field_headers(): client = TelcoAutomationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5935,8 +5967,8 @@ async def test_delete_blueprint_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - telcoautomation.ListBlueprintsRequest, - dict, + telcoautomation.ListBlueprintsRequest(), + {}, ], ) def test_list_blueprints(request_type, transport: str = "grpc"): @@ -5947,7 +5979,7 @@ def test_list_blueprints(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_blueprints), "__call__") as call: @@ -5993,11 +6025,12 @@ def test_list_blueprints_non_empty_request_with_auto_populated_field(): client.list_blueprints(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == telcoautomation.ListBlueprintsRequest( + request_msg = telcoautomation.ListBlueprintsRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_blueprints_use_cached_wrapped_rpc(): @@ -6078,9 +6111,14 @@ async def test_list_blueprints_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_blueprints_async( - transport: str = "grpc_asyncio", request_type=telcoautomation.ListBlueprintsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + telcoautomation.ListBlueprintsRequest(), + {}, + ], +) +async def test_list_blueprints_async(request_type, transport: str = "grpc_asyncio"): client = TelcoAutomationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6088,7 +6126,7 @@ async def test_list_blueprints_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_blueprints), "__call__") as call: @@ -6111,11 +6149,6 @@ async def test_list_blueprints_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_blueprints_async_from_dict(): - await test_list_blueprints_async(request_type=dict) - - def test_list_blueprints_field_headers(): client = TelcoAutomationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6452,8 +6485,8 @@ async def test_list_blueprints_async_pages(): @pytest.mark.parametrize( "request_type", [ - telcoautomation.ApproveBlueprintRequest, - dict, + telcoautomation.ApproveBlueprintRequest(), + {}, ], ) def test_approve_blueprint(request_type, transport: str = "grpc"): @@ -6464,7 +6497,7 @@ def test_approve_blueprint(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6528,9 +6561,10 @@ def test_approve_blueprint_non_empty_request_with_auto_populated_field(): client.approve_blueprint(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == telcoautomation.ApproveBlueprintRequest( + request_msg = telcoautomation.ApproveBlueprintRequest( name="name_value", ) + assert args[0] == request_msg def test_approve_blueprint_use_cached_wrapped_rpc(): @@ -6613,10 +6647,14 @@ async def test_approve_blueprint_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_approve_blueprint_async( - transport: str = "grpc_asyncio", - request_type=telcoautomation.ApproveBlueprintRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + telcoautomation.ApproveBlueprintRequest(), + {}, + ], +) +async def test_approve_blueprint_async(request_type, transport: str = "grpc_asyncio"): client = TelcoAutomationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6624,7 +6662,7 @@ async def test_approve_blueprint_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( @@ -6665,11 +6703,6 @@ async def test_approve_blueprint_async( assert response.rollback_support is True -@pytest.mark.asyncio -async def test_approve_blueprint_async_from_dict(): - await test_approve_blueprint_async(request_type=dict) - - def test_approve_blueprint_field_headers(): client = TelcoAutomationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6824,8 +6857,8 @@ async def test_approve_blueprint_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - telcoautomation.ProposeBlueprintRequest, - dict, + telcoautomation.ProposeBlueprintRequest(), + {}, ], ) def test_propose_blueprint(request_type, transport: str = "grpc"): @@ -6836,7 +6869,7 @@ def test_propose_blueprint(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6900,9 +6933,10 @@ def test_propose_blueprint_non_empty_request_with_auto_populated_field(): client.propose_blueprint(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == telcoautomation.ProposeBlueprintRequest( + request_msg = telcoautomation.ProposeBlueprintRequest( name="name_value", ) + assert args[0] == request_msg def test_propose_blueprint_use_cached_wrapped_rpc(): @@ -6985,10 +7019,14 @@ async def test_propose_blueprint_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_propose_blueprint_async( - transport: str = "grpc_asyncio", - request_type=telcoautomation.ProposeBlueprintRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + telcoautomation.ProposeBlueprintRequest(), + {}, + ], +) +async def test_propose_blueprint_async(request_type, transport: str = "grpc_asyncio"): client = TelcoAutomationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6996,7 +7034,7 @@ async def test_propose_blueprint_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( @@ -7037,11 +7075,6 @@ async def test_propose_blueprint_async( assert response.rollback_support is True -@pytest.mark.asyncio -async def test_propose_blueprint_async_from_dict(): - await test_propose_blueprint_async(request_type=dict) - - def test_propose_blueprint_field_headers(): client = TelcoAutomationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7196,8 +7229,8 @@ async def test_propose_blueprint_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - telcoautomation.RejectBlueprintRequest, - dict, + telcoautomation.RejectBlueprintRequest(), + {}, ], ) def test_reject_blueprint(request_type, transport: str = "grpc"): @@ -7208,7 +7241,7 @@ def test_reject_blueprint(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.reject_blueprint), "__call__") as call: @@ -7268,9 +7301,10 @@ def test_reject_blueprint_non_empty_request_with_auto_populated_field(): client.reject_blueprint(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == telcoautomation.RejectBlueprintRequest( + request_msg = telcoautomation.RejectBlueprintRequest( name="name_value", ) + assert args[0] == request_msg def test_reject_blueprint_use_cached_wrapped_rpc(): @@ -7353,9 +7387,14 @@ async def test_reject_blueprint_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_reject_blueprint_async( - transport: str = "grpc_asyncio", request_type=telcoautomation.RejectBlueprintRequest -): +@pytest.mark.parametrize( + "request_type", + [ + telcoautomation.RejectBlueprintRequest(), + {}, + ], +) +async def test_reject_blueprint_async(request_type, transport: str = "grpc_asyncio"): client = TelcoAutomationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7363,7 +7402,7 @@ async def test_reject_blueprint_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.reject_blueprint), "__call__") as call: @@ -7402,11 +7441,6 @@ async def test_reject_blueprint_async( assert response.rollback_support is True -@pytest.mark.asyncio -async def test_reject_blueprint_async_from_dict(): - await test_reject_blueprint_async(request_type=dict) - - def test_reject_blueprint_field_headers(): client = TelcoAutomationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7553,8 +7587,8 @@ async def test_reject_blueprint_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - telcoautomation.ListBlueprintRevisionsRequest, - dict, + telcoautomation.ListBlueprintRevisionsRequest(), + {}, ], ) def test_list_blueprint_revisions(request_type, transport: str = "grpc"): @@ -7565,7 +7599,7 @@ def test_list_blueprint_revisions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7614,10 +7648,11 @@ def test_list_blueprint_revisions_non_empty_request_with_auto_populated_field(): client.list_blueprint_revisions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == telcoautomation.ListBlueprintRevisionsRequest( + request_msg = telcoautomation.ListBlueprintRevisionsRequest( name="name_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_blueprint_revisions_use_cached_wrapped_rpc(): @@ -7703,9 +7738,15 @@ async def test_list_blueprint_revisions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + telcoautomation.ListBlueprintRevisionsRequest(), + {}, + ], +) async def test_list_blueprint_revisions_async( - transport: str = "grpc_asyncio", - request_type=telcoautomation.ListBlueprintRevisionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = TelcoAutomationAsyncClient( credentials=async_anonymous_credentials(), @@ -7714,7 +7755,7 @@ async def test_list_blueprint_revisions_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( @@ -7739,11 +7780,6 @@ async def test_list_blueprint_revisions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_blueprint_revisions_async_from_dict(): - await test_list_blueprint_revisions_async(request_type=dict) - - def test_list_blueprint_revisions_field_headers(): client = TelcoAutomationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8098,8 +8134,8 @@ async def test_list_blueprint_revisions_async_pages(): @pytest.mark.parametrize( "request_type", [ - telcoautomation.SearchBlueprintRevisionsRequest, - dict, + telcoautomation.SearchBlueprintRevisionsRequest(), + {}, ], ) def test_search_blueprint_revisions(request_type, transport: str = "grpc"): @@ -8110,7 +8146,7 @@ def test_search_blueprint_revisions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8160,11 +8196,12 @@ def test_search_blueprint_revisions_non_empty_request_with_auto_populated_field( client.search_blueprint_revisions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == telcoautomation.SearchBlueprintRevisionsRequest( + request_msg = telcoautomation.SearchBlueprintRevisionsRequest( parent="parent_value", query="query_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_search_blueprint_revisions_use_cached_wrapped_rpc(): @@ -8250,9 +8287,15 @@ async def test_search_blueprint_revisions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + telcoautomation.SearchBlueprintRevisionsRequest(), + {}, + ], +) async def test_search_blueprint_revisions_async( - transport: str = "grpc_asyncio", - request_type=telcoautomation.SearchBlueprintRevisionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = TelcoAutomationAsyncClient( credentials=async_anonymous_credentials(), @@ -8261,7 +8304,7 @@ async def test_search_blueprint_revisions_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( @@ -8286,11 +8329,6 @@ async def test_search_blueprint_revisions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_search_blueprint_revisions_async_from_dict(): - await test_search_blueprint_revisions_async(request_type=dict) - - def test_search_blueprint_revisions_field_headers(): client = TelcoAutomationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8655,8 +8693,8 @@ async def test_search_blueprint_revisions_async_pages(): @pytest.mark.parametrize( "request_type", [ - telcoautomation.SearchDeploymentRevisionsRequest, - dict, + telcoautomation.SearchDeploymentRevisionsRequest(), + {}, ], ) def test_search_deployment_revisions(request_type, transport: str = "grpc"): @@ -8667,7 +8705,7 @@ def test_search_deployment_revisions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8717,11 +8755,12 @@ def test_search_deployment_revisions_non_empty_request_with_auto_populated_field client.search_deployment_revisions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == telcoautomation.SearchDeploymentRevisionsRequest( + request_msg = telcoautomation.SearchDeploymentRevisionsRequest( parent="parent_value", query="query_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_search_deployment_revisions_use_cached_wrapped_rpc(): @@ -8807,9 +8846,15 @@ async def test_search_deployment_revisions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + telcoautomation.SearchDeploymentRevisionsRequest(), + {}, + ], +) async def test_search_deployment_revisions_async( - transport: str = "grpc_asyncio", - request_type=telcoautomation.SearchDeploymentRevisionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = TelcoAutomationAsyncClient( credentials=async_anonymous_credentials(), @@ -8818,7 +8863,7 @@ async def test_search_deployment_revisions_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( @@ -8843,11 +8888,6 @@ async def test_search_deployment_revisions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_search_deployment_revisions_async_from_dict(): - await test_search_deployment_revisions_async(request_type=dict) - - def test_search_deployment_revisions_field_headers(): client = TelcoAutomationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9212,8 +9252,8 @@ async def test_search_deployment_revisions_async_pages(): @pytest.mark.parametrize( "request_type", [ - telcoautomation.DiscardBlueprintChangesRequest, - dict, + telcoautomation.DiscardBlueprintChangesRequest(), + {}, ], ) def test_discard_blueprint_changes(request_type, transport: str = "grpc"): @@ -9224,7 +9264,7 @@ def test_discard_blueprint_changes(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9269,9 +9309,10 @@ def test_discard_blueprint_changes_non_empty_request_with_auto_populated_field() client.discard_blueprint_changes(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == telcoautomation.DiscardBlueprintChangesRequest( + request_msg = telcoautomation.DiscardBlueprintChangesRequest( name="name_value", ) + assert args[0] == request_msg def test_discard_blueprint_changes_use_cached_wrapped_rpc(): @@ -9357,9 +9398,15 @@ async def test_discard_blueprint_changes_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + telcoautomation.DiscardBlueprintChangesRequest(), + {}, + ], +) async def test_discard_blueprint_changes_async( - transport: str = "grpc_asyncio", - request_type=telcoautomation.DiscardBlueprintChangesRequest, + request_type, transport: str = "grpc_asyncio" ): client = TelcoAutomationAsyncClient( credentials=async_anonymous_credentials(), @@ -9368,7 +9415,7 @@ async def test_discard_blueprint_changes_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( @@ -9390,11 +9437,6 @@ async def test_discard_blueprint_changes_async( assert isinstance(response, telcoautomation.DiscardBlueprintChangesResponse) -@pytest.mark.asyncio -async def test_discard_blueprint_changes_async_from_dict(): - await test_discard_blueprint_changes_async(request_type=dict) - - def test_discard_blueprint_changes_field_headers(): client = TelcoAutomationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9549,8 +9591,8 @@ async def test_discard_blueprint_changes_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - telcoautomation.ListPublicBlueprintsRequest, - dict, + telcoautomation.ListPublicBlueprintsRequest(), + {}, ], ) def test_list_public_blueprints(request_type, transport: str = "grpc"): @@ -9561,7 +9603,7 @@ def test_list_public_blueprints(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9610,10 +9652,11 @@ def test_list_public_blueprints_non_empty_request_with_auto_populated_field(): client.list_public_blueprints(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == telcoautomation.ListPublicBlueprintsRequest( + request_msg = telcoautomation.ListPublicBlueprintsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_public_blueprints_use_cached_wrapped_rpc(): @@ -9699,9 +9742,15 @@ async def test_list_public_blueprints_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + telcoautomation.ListPublicBlueprintsRequest(), + {}, + ], +) async def test_list_public_blueprints_async( - transport: str = "grpc_asyncio", - request_type=telcoautomation.ListPublicBlueprintsRequest, + request_type, transport: str = "grpc_asyncio" ): client = TelcoAutomationAsyncClient( credentials=async_anonymous_credentials(), @@ -9710,7 +9759,7 @@ async def test_list_public_blueprints_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( @@ -9735,11 +9784,6 @@ async def test_list_public_blueprints_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_public_blueprints_async_from_dict(): - await test_list_public_blueprints_async(request_type=dict) - - def test_list_public_blueprints_field_headers(): client = TelcoAutomationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10092,8 +10136,8 @@ async def test_list_public_blueprints_async_pages(): @pytest.mark.parametrize( "request_type", [ - telcoautomation.GetPublicBlueprintRequest, - dict, + telcoautomation.GetPublicBlueprintRequest(), + {}, ], ) def test_get_public_blueprint(request_type, transport: str = "grpc"): @@ -10104,7 +10148,7 @@ def test_get_public_blueprint(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10162,9 +10206,10 @@ def test_get_public_blueprint_non_empty_request_with_auto_populated_field(): client.get_public_blueprint(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == telcoautomation.GetPublicBlueprintRequest( + request_msg = telcoautomation.GetPublicBlueprintRequest( name="name_value", ) + assert args[0] == request_msg def test_get_public_blueprint_use_cached_wrapped_rpc(): @@ -10249,9 +10294,15 @@ async def test_get_public_blueprint_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + telcoautomation.GetPublicBlueprintRequest(), + {}, + ], +) async def test_get_public_blueprint_async( - transport: str = "grpc_asyncio", - request_type=telcoautomation.GetPublicBlueprintRequest, + request_type, transport: str = "grpc_asyncio" ): client = TelcoAutomationAsyncClient( credentials=async_anonymous_credentials(), @@ -10260,7 +10311,7 @@ async def test_get_public_blueprint_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( @@ -10295,11 +10346,6 @@ async def test_get_public_blueprint_async( assert response.rollback_support is True -@pytest.mark.asyncio -async def test_get_public_blueprint_async_from_dict(): - await test_get_public_blueprint_async(request_type=dict) - - def test_get_public_blueprint_field_headers(): client = TelcoAutomationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10454,8 +10500,8 @@ async def test_get_public_blueprint_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - telcoautomation.CreateDeploymentRequest, - dict, + telcoautomation.CreateDeploymentRequest(), + {}, ], ) def test_create_deployment(request_type, transport: str = "grpc"): @@ -10466,7 +10512,7 @@ def test_create_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10533,10 +10579,11 @@ def test_create_deployment_non_empty_request_with_auto_populated_field(): client.create_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == telcoautomation.CreateDeploymentRequest( + request_msg = telcoautomation.CreateDeploymentRequest( parent="parent_value", deployment_id="deployment_id_value", ) + assert args[0] == request_msg def test_create_deployment_use_cached_wrapped_rpc(): @@ -10619,10 +10666,14 @@ async def test_create_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_deployment_async( - transport: str = "grpc_asyncio", - request_type=telcoautomation.CreateDeploymentRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + telcoautomation.CreateDeploymentRequest(), + {}, + ], +) +async def test_create_deployment_async(request_type, transport: str = "grpc_asyncio"): client = TelcoAutomationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10630,7 +10681,7 @@ async def test_create_deployment_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( @@ -10673,11 +10724,6 @@ async def test_create_deployment_async( assert response.rollback_support is True -@pytest.mark.asyncio -async def test_create_deployment_async_from_dict(): - await test_create_deployment_async(request_type=dict) - - def test_create_deployment_field_headers(): client = TelcoAutomationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10852,8 +10898,8 @@ async def test_create_deployment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - telcoautomation.UpdateDeploymentRequest, - dict, + telcoautomation.UpdateDeploymentRequest(), + {}, ], ) def test_update_deployment(request_type, transport: str = "grpc"): @@ -10864,7 +10910,7 @@ def test_update_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10928,7 +10974,8 @@ def test_update_deployment_non_empty_request_with_auto_populated_field(): client.update_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == telcoautomation.UpdateDeploymentRequest() + request_msg = telcoautomation.UpdateDeploymentRequest() + assert args[0] == request_msg def test_update_deployment_use_cached_wrapped_rpc(): @@ -11011,10 +11058,14 @@ async def test_update_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_deployment_async( - transport: str = "grpc_asyncio", - request_type=telcoautomation.UpdateDeploymentRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + telcoautomation.UpdateDeploymentRequest(), + {}, + ], +) +async def test_update_deployment_async(request_type, transport: str = "grpc_asyncio"): client = TelcoAutomationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11022,7 +11073,7 @@ async def test_update_deployment_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( @@ -11065,11 +11116,6 @@ async def test_update_deployment_async( assert response.rollback_support is True -@pytest.mark.asyncio -async def test_update_deployment_async_from_dict(): - await test_update_deployment_async(request_type=dict) - - def test_update_deployment_field_headers(): client = TelcoAutomationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11234,8 +11280,8 @@ async def test_update_deployment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - telcoautomation.GetDeploymentRequest, - dict, + telcoautomation.GetDeploymentRequest(), + {}, ], ) def test_get_deployment(request_type, transport: str = "grpc"): @@ -11246,7 +11292,7 @@ def test_get_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_deployment), "__call__") as call: @@ -11308,9 +11354,10 @@ def test_get_deployment_non_empty_request_with_auto_populated_field(): client.get_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == telcoautomation.GetDeploymentRequest( + request_msg = telcoautomation.GetDeploymentRequest( name="name_value", ) + assert args[0] == request_msg def test_get_deployment_use_cached_wrapped_rpc(): @@ -11391,9 +11438,14 @@ async def test_get_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_deployment_async( - transport: str = "grpc_asyncio", request_type=telcoautomation.GetDeploymentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + telcoautomation.GetDeploymentRequest(), + {}, + ], +) +async def test_get_deployment_async(request_type, transport: str = "grpc_asyncio"): client = TelcoAutomationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11401,7 +11453,7 @@ async def test_get_deployment_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_deployment), "__call__") as call: @@ -11442,11 +11494,6 @@ async def test_get_deployment_async( assert response.rollback_support is True -@pytest.mark.asyncio -async def test_get_deployment_async_from_dict(): - await test_get_deployment_async(request_type=dict) - - def test_get_deployment_field_headers(): client = TelcoAutomationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11593,8 +11640,8 @@ async def test_get_deployment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - telcoautomation.RemoveDeploymentRequest, - dict, + telcoautomation.RemoveDeploymentRequest(), + {}, ], ) def test_remove_deployment(request_type, transport: str = "grpc"): @@ -11605,7 +11652,7 @@ def test_remove_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11650,9 +11697,10 @@ def test_remove_deployment_non_empty_request_with_auto_populated_field(): client.remove_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == telcoautomation.RemoveDeploymentRequest( + request_msg = telcoautomation.RemoveDeploymentRequest( name="name_value", ) + assert args[0] == request_msg def test_remove_deployment_use_cached_wrapped_rpc(): @@ -11735,10 +11783,14 @@ async def test_remove_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_remove_deployment_async( - transport: str = "grpc_asyncio", - request_type=telcoautomation.RemoveDeploymentRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + telcoautomation.RemoveDeploymentRequest(), + {}, + ], +) +async def test_remove_deployment_async(request_type, transport: str = "grpc_asyncio"): client = TelcoAutomationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11746,7 +11798,7 @@ async def test_remove_deployment_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( @@ -11766,11 +11818,6 @@ async def test_remove_deployment_async( assert response is None -@pytest.mark.asyncio -async def test_remove_deployment_async_from_dict(): - await test_remove_deployment_async(request_type=dict) - - def test_remove_deployment_field_headers(): client = TelcoAutomationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11921,8 +11968,8 @@ async def test_remove_deployment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - telcoautomation.ListDeploymentsRequest, - dict, + telcoautomation.ListDeploymentsRequest(), + {}, ], ) def test_list_deployments(request_type, transport: str = "grpc"): @@ -11933,7 +11980,7 @@ def test_list_deployments(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_deployments), "__call__") as call: @@ -11979,11 +12026,12 @@ def test_list_deployments_non_empty_request_with_auto_populated_field(): client.list_deployments(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == telcoautomation.ListDeploymentsRequest( + request_msg = telcoautomation.ListDeploymentsRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_deployments_use_cached_wrapped_rpc(): @@ -12066,9 +12114,14 @@ async def test_list_deployments_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_deployments_async( - transport: str = "grpc_asyncio", request_type=telcoautomation.ListDeploymentsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + telcoautomation.ListDeploymentsRequest(), + {}, + ], +) +async def test_list_deployments_async(request_type, transport: str = "grpc_asyncio"): client = TelcoAutomationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12076,7 +12129,7 @@ async def test_list_deployments_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_deployments), "__call__") as call: @@ -12099,11 +12152,6 @@ async def test_list_deployments_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_deployments_async_from_dict(): - await test_list_deployments_async(request_type=dict) - - def test_list_deployments_field_headers(): client = TelcoAutomationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12440,8 +12488,8 @@ async def test_list_deployments_async_pages(): @pytest.mark.parametrize( "request_type", [ - telcoautomation.ListDeploymentRevisionsRequest, - dict, + telcoautomation.ListDeploymentRevisionsRequest(), + {}, ], ) def test_list_deployment_revisions(request_type, transport: str = "grpc"): @@ -12452,7 +12500,7 @@ def test_list_deployment_revisions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -12501,10 +12549,11 @@ def test_list_deployment_revisions_non_empty_request_with_auto_populated_field() client.list_deployment_revisions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == telcoautomation.ListDeploymentRevisionsRequest( + request_msg = telcoautomation.ListDeploymentRevisionsRequest( name="name_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_deployment_revisions_use_cached_wrapped_rpc(): @@ -12590,9 +12639,15 @@ async def test_list_deployment_revisions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + telcoautomation.ListDeploymentRevisionsRequest(), + {}, + ], +) async def test_list_deployment_revisions_async( - transport: str = "grpc_asyncio", - request_type=telcoautomation.ListDeploymentRevisionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = TelcoAutomationAsyncClient( credentials=async_anonymous_credentials(), @@ -12601,7 +12656,7 @@ async def test_list_deployment_revisions_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( @@ -12626,11 +12681,6 @@ async def test_list_deployment_revisions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_deployment_revisions_async_from_dict(): - await test_list_deployment_revisions_async(request_type=dict) - - def test_list_deployment_revisions_field_headers(): client = TelcoAutomationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12985,8 +13035,8 @@ async def test_list_deployment_revisions_async_pages(): @pytest.mark.parametrize( "request_type", [ - telcoautomation.DiscardDeploymentChangesRequest, - dict, + telcoautomation.DiscardDeploymentChangesRequest(), + {}, ], ) def test_discard_deployment_changes(request_type, transport: str = "grpc"): @@ -12997,7 +13047,7 @@ def test_discard_deployment_changes(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -13042,9 +13092,10 @@ def test_discard_deployment_changes_non_empty_request_with_auto_populated_field( client.discard_deployment_changes(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == telcoautomation.DiscardDeploymentChangesRequest( + request_msg = telcoautomation.DiscardDeploymentChangesRequest( name="name_value", ) + assert args[0] == request_msg def test_discard_deployment_changes_use_cached_wrapped_rpc(): @@ -13130,9 +13181,15 @@ async def test_discard_deployment_changes_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + telcoautomation.DiscardDeploymentChangesRequest(), + {}, + ], +) async def test_discard_deployment_changes_async( - transport: str = "grpc_asyncio", - request_type=telcoautomation.DiscardDeploymentChangesRequest, + request_type, transport: str = "grpc_asyncio" ): client = TelcoAutomationAsyncClient( credentials=async_anonymous_credentials(), @@ -13141,7 +13198,7 @@ async def test_discard_deployment_changes_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( @@ -13163,11 +13220,6 @@ async def test_discard_deployment_changes_async( assert isinstance(response, telcoautomation.DiscardDeploymentChangesResponse) -@pytest.mark.asyncio -async def test_discard_deployment_changes_async_from_dict(): - await test_discard_deployment_changes_async(request_type=dict) - - def test_discard_deployment_changes_field_headers(): client = TelcoAutomationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13322,8 +13374,8 @@ async def test_discard_deployment_changes_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - telcoautomation.ApplyDeploymentRequest, - dict, + telcoautomation.ApplyDeploymentRequest(), + {}, ], ) def test_apply_deployment(request_type, transport: str = "grpc"): @@ -13334,7 +13386,7 @@ def test_apply_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.apply_deployment), "__call__") as call: @@ -13396,9 +13448,10 @@ def test_apply_deployment_non_empty_request_with_auto_populated_field(): client.apply_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == telcoautomation.ApplyDeploymentRequest( + request_msg = telcoautomation.ApplyDeploymentRequest( name="name_value", ) + assert args[0] == request_msg def test_apply_deployment_use_cached_wrapped_rpc(): @@ -13481,9 +13534,14 @@ async def test_apply_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_apply_deployment_async( - transport: str = "grpc_asyncio", request_type=telcoautomation.ApplyDeploymentRequest -): +@pytest.mark.parametrize( + "request_type", + [ + telcoautomation.ApplyDeploymentRequest(), + {}, + ], +) +async def test_apply_deployment_async(request_type, transport: str = "grpc_asyncio"): client = TelcoAutomationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13491,7 +13549,7 @@ async def test_apply_deployment_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.apply_deployment), "__call__") as call: @@ -13532,11 +13590,6 @@ async def test_apply_deployment_async( assert response.rollback_support is True -@pytest.mark.asyncio -async def test_apply_deployment_async_from_dict(): - await test_apply_deployment_async(request_type=dict) - - def test_apply_deployment_field_headers(): client = TelcoAutomationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13683,8 +13736,8 @@ async def test_apply_deployment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - telcoautomation.ComputeDeploymentStatusRequest, - dict, + telcoautomation.ComputeDeploymentStatusRequest(), + {}, ], ) def test_compute_deployment_status(request_type, transport: str = "grpc"): @@ -13695,7 +13748,7 @@ def test_compute_deployment_status(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -13745,9 +13798,10 @@ def test_compute_deployment_status_non_empty_request_with_auto_populated_field() client.compute_deployment_status(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == telcoautomation.ComputeDeploymentStatusRequest( + request_msg = telcoautomation.ComputeDeploymentStatusRequest( name="name_value", ) + assert args[0] == request_msg def test_compute_deployment_status_use_cached_wrapped_rpc(): @@ -13833,9 +13887,15 @@ async def test_compute_deployment_status_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + telcoautomation.ComputeDeploymentStatusRequest(), + {}, + ], +) async def test_compute_deployment_status_async( - transport: str = "grpc_asyncio", - request_type=telcoautomation.ComputeDeploymentStatusRequest, + request_type, transport: str = "grpc_asyncio" ): client = TelcoAutomationAsyncClient( credentials=async_anonymous_credentials(), @@ -13844,7 +13904,7 @@ async def test_compute_deployment_status_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( @@ -13871,11 +13931,6 @@ async def test_compute_deployment_status_async( assert response.aggregated_status == telcoautomation.Status.STATUS_IN_PROGRESS -@pytest.mark.asyncio -async def test_compute_deployment_status_async_from_dict(): - await test_compute_deployment_status_async(request_type=dict) - - def test_compute_deployment_status_field_headers(): client = TelcoAutomationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14030,8 +14085,8 @@ async def test_compute_deployment_status_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - telcoautomation.RollbackDeploymentRequest, - dict, + telcoautomation.RollbackDeploymentRequest(), + {}, ], ) def test_rollback_deployment(request_type, transport: str = "grpc"): @@ -14042,7 +14097,7 @@ def test_rollback_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -14109,10 +14164,11 @@ def test_rollback_deployment_non_empty_request_with_auto_populated_field(): client.rollback_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == telcoautomation.RollbackDeploymentRequest( + request_msg = telcoautomation.RollbackDeploymentRequest( name="name_value", revision_id="revision_id_value", ) + assert args[0] == request_msg def test_rollback_deployment_use_cached_wrapped_rpc(): @@ -14197,10 +14253,14 @@ async def test_rollback_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_rollback_deployment_async( - transport: str = "grpc_asyncio", - request_type=telcoautomation.RollbackDeploymentRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + telcoautomation.RollbackDeploymentRequest(), + {}, + ], +) +async def test_rollback_deployment_async(request_type, transport: str = "grpc_asyncio"): client = TelcoAutomationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14208,7 +14268,7 @@ async def test_rollback_deployment_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( @@ -14251,11 +14311,6 @@ async def test_rollback_deployment_async( assert response.rollback_support is True -@pytest.mark.asyncio -async def test_rollback_deployment_async_from_dict(): - await test_rollback_deployment_async(request_type=dict) - - def test_rollback_deployment_field_headers(): client = TelcoAutomationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14420,8 +14475,8 @@ async def test_rollback_deployment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - telcoautomation.GetHydratedDeploymentRequest, - dict, + telcoautomation.GetHydratedDeploymentRequest(), + {}, ], ) def test_get_hydrated_deployment(request_type, transport: str = "grpc"): @@ -14432,7 +14487,7 @@ def test_get_hydrated_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -14484,9 +14539,10 @@ def test_get_hydrated_deployment_non_empty_request_with_auto_populated_field(): client.get_hydrated_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == telcoautomation.GetHydratedDeploymentRequest( + request_msg = telcoautomation.GetHydratedDeploymentRequest( name="name_value", ) + assert args[0] == request_msg def test_get_hydrated_deployment_use_cached_wrapped_rpc(): @@ -14572,9 +14628,15 @@ async def test_get_hydrated_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + telcoautomation.GetHydratedDeploymentRequest(), + {}, + ], +) async def test_get_hydrated_deployment_async( - transport: str = "grpc_asyncio", - request_type=telcoautomation.GetHydratedDeploymentRequest, + request_type, transport: str = "grpc_asyncio" ): client = TelcoAutomationAsyncClient( credentials=async_anonymous_credentials(), @@ -14583,7 +14645,7 @@ async def test_get_hydrated_deployment_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( @@ -14612,11 +14674,6 @@ async def test_get_hydrated_deployment_async( assert response.workload_cluster == "workload_cluster_value" -@pytest.mark.asyncio -async def test_get_hydrated_deployment_async_from_dict(): - await test_get_hydrated_deployment_async(request_type=dict) - - def test_get_hydrated_deployment_field_headers(): client = TelcoAutomationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14771,8 +14828,8 @@ async def test_get_hydrated_deployment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - telcoautomation.ListHydratedDeploymentsRequest, - dict, + telcoautomation.ListHydratedDeploymentsRequest(), + {}, ], ) def test_list_hydrated_deployments(request_type, transport: str = "grpc"): @@ -14783,7 +14840,7 @@ def test_list_hydrated_deployments(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -14832,10 +14889,11 @@ def test_list_hydrated_deployments_non_empty_request_with_auto_populated_field() client.list_hydrated_deployments(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == telcoautomation.ListHydratedDeploymentsRequest( + request_msg = telcoautomation.ListHydratedDeploymentsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_hydrated_deployments_use_cached_wrapped_rpc(): @@ -14921,9 +14979,15 @@ async def test_list_hydrated_deployments_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + telcoautomation.ListHydratedDeploymentsRequest(), + {}, + ], +) async def test_list_hydrated_deployments_async( - transport: str = "grpc_asyncio", - request_type=telcoautomation.ListHydratedDeploymentsRequest, + request_type, transport: str = "grpc_asyncio" ): client = TelcoAutomationAsyncClient( credentials=async_anonymous_credentials(), @@ -14932,7 +14996,7 @@ async def test_list_hydrated_deployments_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( @@ -14957,11 +15021,6 @@ async def test_list_hydrated_deployments_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_hydrated_deployments_async_from_dict(): - await test_list_hydrated_deployments_async(request_type=dict) - - def test_list_hydrated_deployments_field_headers(): client = TelcoAutomationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15316,8 +15375,8 @@ async def test_list_hydrated_deployments_async_pages(): @pytest.mark.parametrize( "request_type", [ - telcoautomation.UpdateHydratedDeploymentRequest, - dict, + telcoautomation.UpdateHydratedDeploymentRequest(), + {}, ], ) def test_update_hydrated_deployment(request_type, transport: str = "grpc"): @@ -15328,7 +15387,7 @@ def test_update_hydrated_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -15378,7 +15437,8 @@ def test_update_hydrated_deployment_non_empty_request_with_auto_populated_field( client.update_hydrated_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == telcoautomation.UpdateHydratedDeploymentRequest() + request_msg = telcoautomation.UpdateHydratedDeploymentRequest() + assert args[0] == request_msg def test_update_hydrated_deployment_use_cached_wrapped_rpc(): @@ -15464,9 +15524,15 @@ async def test_update_hydrated_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + telcoautomation.UpdateHydratedDeploymentRequest(), + {}, + ], +) async def test_update_hydrated_deployment_async( - transport: str = "grpc_asyncio", - request_type=telcoautomation.UpdateHydratedDeploymentRequest, + request_type, transport: str = "grpc_asyncio" ): client = TelcoAutomationAsyncClient( credentials=async_anonymous_credentials(), @@ -15475,7 +15541,7 @@ async def test_update_hydrated_deployment_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( @@ -15504,11 +15570,6 @@ async def test_update_hydrated_deployment_async( assert response.workload_cluster == "workload_cluster_value" -@pytest.mark.asyncio -async def test_update_hydrated_deployment_async_from_dict(): - await test_update_hydrated_deployment_async(request_type=dict) - - def test_update_hydrated_deployment_field_headers(): client = TelcoAutomationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15673,8 +15734,8 @@ async def test_update_hydrated_deployment_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - telcoautomation.ApplyHydratedDeploymentRequest, - dict, + telcoautomation.ApplyHydratedDeploymentRequest(), + {}, ], ) def test_apply_hydrated_deployment(request_type, transport: str = "grpc"): @@ -15685,7 +15746,7 @@ def test_apply_hydrated_deployment(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -15737,9 +15798,10 @@ def test_apply_hydrated_deployment_non_empty_request_with_auto_populated_field() client.apply_hydrated_deployment(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == telcoautomation.ApplyHydratedDeploymentRequest( + request_msg = telcoautomation.ApplyHydratedDeploymentRequest( name="name_value", ) + assert args[0] == request_msg def test_apply_hydrated_deployment_use_cached_wrapped_rpc(): @@ -15825,9 +15887,15 @@ async def test_apply_hydrated_deployment_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + telcoautomation.ApplyHydratedDeploymentRequest(), + {}, + ], +) async def test_apply_hydrated_deployment_async( - transport: str = "grpc_asyncio", - request_type=telcoautomation.ApplyHydratedDeploymentRequest, + request_type, transport: str = "grpc_asyncio" ): client = TelcoAutomationAsyncClient( credentials=async_anonymous_credentials(), @@ -15836,7 +15904,7 @@ async def test_apply_hydrated_deployment_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( @@ -15865,11 +15933,6 @@ async def test_apply_hydrated_deployment_async( assert response.workload_cluster == "workload_cluster_value" -@pytest.mark.asyncio -async def test_apply_hydrated_deployment_async_from_dict(): - await test_apply_hydrated_deployment_async(request_type=dict) - - def test_apply_hydrated_deployment_field_headers(): client = TelcoAutomationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -23761,7 +23824,6 @@ def test_list_orchestration_clusters_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ListOrchestrationClustersRequest() - assert args[0] == request_msg @@ -23784,7 +23846,6 @@ def test_get_orchestration_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.GetOrchestrationClusterRequest() - assert args[0] == request_msg @@ -23807,7 +23868,6 @@ def test_create_orchestration_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.CreateOrchestrationClusterRequest() - assert args[0] == request_msg @@ -23830,7 +23890,6 @@ def test_delete_orchestration_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.DeleteOrchestrationClusterRequest() - assert args[0] == request_msg @@ -23851,7 +23910,6 @@ def test_list_edge_slms_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ListEdgeSlmsRequest() - assert args[0] == request_msg @@ -23872,7 +23930,6 @@ def test_get_edge_slm_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.GetEdgeSlmRequest() - assert args[0] == request_msg @@ -23893,7 +23950,6 @@ def test_create_edge_slm_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.CreateEdgeSlmRequest() - assert args[0] == request_msg @@ -23914,7 +23970,6 @@ def test_delete_edge_slm_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.DeleteEdgeSlmRequest() - assert args[0] == request_msg @@ -23935,7 +23990,6 @@ def test_create_blueprint_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.CreateBlueprintRequest() - assert args[0] == request_msg @@ -23956,7 +24010,6 @@ def test_update_blueprint_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.UpdateBlueprintRequest() - assert args[0] == request_msg @@ -23977,7 +24030,6 @@ def test_get_blueprint_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.GetBlueprintRequest() - assert args[0] == request_msg @@ -23998,7 +24050,6 @@ def test_delete_blueprint_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.DeleteBlueprintRequest() - assert args[0] == request_msg @@ -24019,7 +24070,6 @@ def test_list_blueprints_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ListBlueprintsRequest() - assert args[0] == request_msg @@ -24042,7 +24092,6 @@ def test_approve_blueprint_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ApproveBlueprintRequest() - assert args[0] == request_msg @@ -24065,7 +24114,6 @@ def test_propose_blueprint_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ProposeBlueprintRequest() - assert args[0] == request_msg @@ -24086,7 +24134,6 @@ def test_reject_blueprint_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.RejectBlueprintRequest() - assert args[0] == request_msg @@ -24109,7 +24156,6 @@ def test_list_blueprint_revisions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ListBlueprintRevisionsRequest() - assert args[0] == request_msg @@ -24132,7 +24178,6 @@ def test_search_blueprint_revisions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.SearchBlueprintRevisionsRequest() - assert args[0] == request_msg @@ -24155,7 +24200,6 @@ def test_search_deployment_revisions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.SearchDeploymentRevisionsRequest() - assert args[0] == request_msg @@ -24178,7 +24222,6 @@ def test_discard_blueprint_changes_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.DiscardBlueprintChangesRequest() - assert args[0] == request_msg @@ -24201,7 +24244,6 @@ def test_list_public_blueprints_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ListPublicBlueprintsRequest() - assert args[0] == request_msg @@ -24224,7 +24266,6 @@ def test_get_public_blueprint_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.GetPublicBlueprintRequest() - assert args[0] == request_msg @@ -24247,7 +24288,6 @@ def test_create_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.CreateDeploymentRequest() - assert args[0] == request_msg @@ -24270,7 +24310,6 @@ def test_update_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.UpdateDeploymentRequest() - assert args[0] == request_msg @@ -24291,7 +24330,6 @@ def test_get_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.GetDeploymentRequest() - assert args[0] == request_msg @@ -24314,7 +24352,6 @@ def test_remove_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.RemoveDeploymentRequest() - assert args[0] == request_msg @@ -24335,7 +24372,6 @@ def test_list_deployments_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ListDeploymentsRequest() - assert args[0] == request_msg @@ -24358,7 +24394,6 @@ def test_list_deployment_revisions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ListDeploymentRevisionsRequest() - assert args[0] == request_msg @@ -24381,7 +24416,6 @@ def test_discard_deployment_changes_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.DiscardDeploymentChangesRequest() - assert args[0] == request_msg @@ -24402,7 +24436,6 @@ def test_apply_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ApplyDeploymentRequest() - assert args[0] == request_msg @@ -24425,7 +24458,6 @@ def test_compute_deployment_status_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ComputeDeploymentStatusRequest() - assert args[0] == request_msg @@ -24448,7 +24480,6 @@ def test_rollback_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.RollbackDeploymentRequest() - assert args[0] == request_msg @@ -24471,7 +24502,6 @@ def test_get_hydrated_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.GetHydratedDeploymentRequest() - assert args[0] == request_msg @@ -24494,7 +24524,6 @@ def test_list_hydrated_deployments_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ListHydratedDeploymentsRequest() - assert args[0] == request_msg @@ -24517,7 +24546,6 @@ def test_update_hydrated_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.UpdateHydratedDeploymentRequest() - assert args[0] == request_msg @@ -24540,7 +24568,6 @@ def test_apply_hydrated_deployment_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ApplyHydratedDeploymentRequest() - assert args[0] == request_msg @@ -24584,7 +24611,6 @@ async def test_list_orchestration_clusters_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ListOrchestrationClustersRequest() - assert args[0] == request_msg @@ -24615,7 +24641,6 @@ async def test_get_orchestration_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.GetOrchestrationClusterRequest() - assert args[0] == request_msg @@ -24642,7 +24667,6 @@ async def test_create_orchestration_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.CreateOrchestrationClusterRequest() - assert args[0] == request_msg @@ -24669,7 +24693,6 @@ async def test_delete_orchestration_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.DeleteOrchestrationClusterRequest() - assert args[0] == request_msg @@ -24697,7 +24720,6 @@ async def test_list_edge_slms_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ListEdgeSlmsRequest() - assert args[0] == request_msg @@ -24728,7 +24750,6 @@ async def test_get_edge_slm_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.GetEdgeSlmRequest() - assert args[0] == request_msg @@ -24753,7 +24774,6 @@ async def test_create_edge_slm_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.CreateEdgeSlmRequest() - assert args[0] == request_msg @@ -24778,7 +24798,6 @@ async def test_delete_edge_slm_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.DeleteEdgeSlmRequest() - assert args[0] == request_msg @@ -24813,7 +24832,6 @@ async def test_create_blueprint_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.CreateBlueprintRequest() - assert args[0] == request_msg @@ -24848,7 +24866,6 @@ async def test_update_blueprint_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.UpdateBlueprintRequest() - assert args[0] == request_msg @@ -24883,7 +24900,6 @@ async def test_get_blueprint_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.GetBlueprintRequest() - assert args[0] == request_msg @@ -24906,7 +24922,6 @@ async def test_delete_blueprint_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.DeleteBlueprintRequest() - assert args[0] == request_msg @@ -24933,7 +24948,6 @@ async def test_list_blueprints_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ListBlueprintsRequest() - assert args[0] == request_msg @@ -24970,7 +24984,6 @@ async def test_approve_blueprint_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ApproveBlueprintRequest() - assert args[0] == request_msg @@ -25007,7 +25020,6 @@ async def test_propose_blueprint_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ProposeBlueprintRequest() - assert args[0] == request_msg @@ -25042,7 +25054,6 @@ async def test_reject_blueprint_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.RejectBlueprintRequest() - assert args[0] == request_msg @@ -25071,7 +25082,6 @@ async def test_list_blueprint_revisions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ListBlueprintRevisionsRequest() - assert args[0] == request_msg @@ -25100,7 +25110,6 @@ async def test_search_blueprint_revisions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.SearchBlueprintRevisionsRequest() - assert args[0] == request_msg @@ -25129,7 +25138,6 @@ async def test_search_deployment_revisions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.SearchDeploymentRevisionsRequest() - assert args[0] == request_msg @@ -25156,7 +25164,6 @@ async def test_discard_blueprint_changes_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.DiscardBlueprintChangesRequest() - assert args[0] == request_msg @@ -25185,7 +25192,6 @@ async def test_list_public_blueprints_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ListPublicBlueprintsRequest() - assert args[0] == request_msg @@ -25219,7 +25225,6 @@ async def test_get_public_blueprint_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.GetPublicBlueprintRequest() - assert args[0] == request_msg @@ -25257,7 +25262,6 @@ async def test_create_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.CreateDeploymentRequest() - assert args[0] == request_msg @@ -25295,7 +25299,6 @@ async def test_update_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.UpdateDeploymentRequest() - assert args[0] == request_msg @@ -25331,7 +25334,6 @@ async def test_get_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.GetDeploymentRequest() - assert args[0] == request_msg @@ -25356,7 +25358,6 @@ async def test_remove_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.RemoveDeploymentRequest() - assert args[0] == request_msg @@ -25383,7 +25384,6 @@ async def test_list_deployments_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ListDeploymentsRequest() - assert args[0] == request_msg @@ -25412,7 +25412,6 @@ async def test_list_deployment_revisions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ListDeploymentRevisionsRequest() - assert args[0] == request_msg @@ -25439,7 +25438,6 @@ async def test_discard_deployment_changes_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.DiscardDeploymentChangesRequest() - assert args[0] == request_msg @@ -25475,7 +25473,6 @@ async def test_apply_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ApplyDeploymentRequest() - assert args[0] == request_msg @@ -25505,7 +25502,6 @@ async def test_compute_deployment_status_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ComputeDeploymentStatusRequest() - assert args[0] == request_msg @@ -25543,7 +25539,6 @@ async def test_rollback_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.RollbackDeploymentRequest() - assert args[0] == request_msg @@ -25574,7 +25569,6 @@ async def test_get_hydrated_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.GetHydratedDeploymentRequest() - assert args[0] == request_msg @@ -25603,7 +25597,6 @@ async def test_list_hydrated_deployments_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ListHydratedDeploymentsRequest() - assert args[0] == request_msg @@ -25634,7 +25627,6 @@ async def test_update_hydrated_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.UpdateHydratedDeploymentRequest() - assert args[0] == request_msg @@ -25665,7 +25657,6 @@ async def test_apply_hydrated_deployment_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ApplyHydratedDeploymentRequest() - assert args[0] == request_msg @@ -31794,7 +31785,6 @@ def test_list_orchestration_clusters_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ListOrchestrationClustersRequest() - assert args[0] == request_msg @@ -31816,7 +31806,6 @@ def test_get_orchestration_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.GetOrchestrationClusterRequest() - assert args[0] == request_msg @@ -31838,7 +31827,6 @@ def test_create_orchestration_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.CreateOrchestrationClusterRequest() - assert args[0] == request_msg @@ -31860,7 +31848,6 @@ def test_delete_orchestration_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.DeleteOrchestrationClusterRequest() - assert args[0] == request_msg @@ -31880,7 +31867,6 @@ def test_list_edge_slms_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ListEdgeSlmsRequest() - assert args[0] == request_msg @@ -31900,7 +31886,6 @@ def test_get_edge_slm_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.GetEdgeSlmRequest() - assert args[0] == request_msg @@ -31920,7 +31905,6 @@ def test_create_edge_slm_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.CreateEdgeSlmRequest() - assert args[0] == request_msg @@ -31940,7 +31924,6 @@ def test_delete_edge_slm_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.DeleteEdgeSlmRequest() - assert args[0] == request_msg @@ -31960,7 +31943,6 @@ def test_create_blueprint_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.CreateBlueprintRequest() - assert args[0] == request_msg @@ -31980,7 +31962,6 @@ def test_update_blueprint_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.UpdateBlueprintRequest() - assert args[0] == request_msg @@ -32000,7 +31981,6 @@ def test_get_blueprint_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.GetBlueprintRequest() - assert args[0] == request_msg @@ -32020,7 +32000,6 @@ def test_delete_blueprint_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.DeleteBlueprintRequest() - assert args[0] == request_msg @@ -32040,7 +32019,6 @@ def test_list_blueprints_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ListBlueprintsRequest() - assert args[0] == request_msg @@ -32062,7 +32040,6 @@ def test_approve_blueprint_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ApproveBlueprintRequest() - assert args[0] == request_msg @@ -32084,7 +32061,6 @@ def test_propose_blueprint_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ProposeBlueprintRequest() - assert args[0] == request_msg @@ -32104,7 +32080,6 @@ def test_reject_blueprint_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.RejectBlueprintRequest() - assert args[0] == request_msg @@ -32126,7 +32101,6 @@ def test_list_blueprint_revisions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ListBlueprintRevisionsRequest() - assert args[0] == request_msg @@ -32148,7 +32122,6 @@ def test_search_blueprint_revisions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.SearchBlueprintRevisionsRequest() - assert args[0] == request_msg @@ -32170,7 +32143,6 @@ def test_search_deployment_revisions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.SearchDeploymentRevisionsRequest() - assert args[0] == request_msg @@ -32192,7 +32164,6 @@ def test_discard_blueprint_changes_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.DiscardBlueprintChangesRequest() - assert args[0] == request_msg @@ -32214,7 +32185,6 @@ def test_list_public_blueprints_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ListPublicBlueprintsRequest() - assert args[0] == request_msg @@ -32236,7 +32206,6 @@ def test_get_public_blueprint_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.GetPublicBlueprintRequest() - assert args[0] == request_msg @@ -32258,7 +32227,6 @@ def test_create_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.CreateDeploymentRequest() - assert args[0] == request_msg @@ -32280,7 +32248,6 @@ def test_update_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.UpdateDeploymentRequest() - assert args[0] == request_msg @@ -32300,7 +32267,6 @@ def test_get_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.GetDeploymentRequest() - assert args[0] == request_msg @@ -32322,7 +32288,6 @@ def test_remove_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.RemoveDeploymentRequest() - assert args[0] == request_msg @@ -32342,7 +32307,6 @@ def test_list_deployments_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ListDeploymentsRequest() - assert args[0] == request_msg @@ -32364,7 +32328,6 @@ def test_list_deployment_revisions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ListDeploymentRevisionsRequest() - assert args[0] == request_msg @@ -32386,7 +32349,6 @@ def test_discard_deployment_changes_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.DiscardDeploymentChangesRequest() - assert args[0] == request_msg @@ -32406,7 +32368,6 @@ def test_apply_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ApplyDeploymentRequest() - assert args[0] == request_msg @@ -32428,7 +32389,6 @@ def test_compute_deployment_status_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ComputeDeploymentStatusRequest() - assert args[0] == request_msg @@ -32450,7 +32410,6 @@ def test_rollback_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.RollbackDeploymentRequest() - assert args[0] == request_msg @@ -32472,7 +32431,6 @@ def test_get_hydrated_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.GetHydratedDeploymentRequest() - assert args[0] == request_msg @@ -32494,7 +32452,6 @@ def test_list_hydrated_deployments_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ListHydratedDeploymentsRequest() - assert args[0] == request_msg @@ -32516,7 +32473,6 @@ def test_update_hydrated_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.UpdateHydratedDeploymentRequest() - assert args[0] == request_msg @@ -32538,7 +32494,6 @@ def test_apply_hydrated_deployment_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = telcoautomation.ApplyHydratedDeploymentRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-texttospeech/noxfile.py b/packages/google-cloud-texttospeech/noxfile.py index 194bcd487334..b5467a458b91 100644 --- a/packages/google-cloud-texttospeech/noxfile.py +++ b/packages/google-cloud-texttospeech/noxfile.py @@ -47,7 +47,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-texttospeech" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-texttospeech/setup.py b/packages/google-cloud-texttospeech/setup.py index e4e322da9523..6787142e1078 100644 --- a/packages/google-cloud-texttospeech/setup.py +++ b/packages/google-cloud-texttospeech/setup.py @@ -45,7 +45,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/google-cloud-texttospeech/testing/constraints-3.10.txt b/packages/google-cloud-texttospeech/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-texttospeech/testing/constraints-3.10.txt +++ b/packages/google-cloud-texttospeech/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-texttospeech/tests/unit/gapic/texttospeech_v1/test_text_to_speech.py b/packages/google-cloud-texttospeech/tests/unit/gapic/texttospeech_v1/test_text_to_speech.py index 25928a91f6bd..4313c9d25b6f 100644 --- a/packages/google-cloud-texttospeech/tests/unit/gapic/texttospeech_v1/test_text_to_speech.py +++ b/packages/google-cloud-texttospeech/tests/unit/gapic/texttospeech_v1/test_text_to_speech.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 @@ -107,6 +108,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" @@ -1287,8 +1303,8 @@ def test_text_to_speech_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - cloud_tts.ListVoicesRequest, - dict, + cloud_tts.ListVoicesRequest(), + {}, ], ) def test_list_voices(request_type, transport: str = "grpc"): @@ -1299,7 +1315,7 @@ def test_list_voices(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_voices), "__call__") as call: @@ -1340,9 +1356,10 @@ def test_list_voices_non_empty_request_with_auto_populated_field(): client.list_voices(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_tts.ListVoicesRequest( + request_msg = cloud_tts.ListVoicesRequest( language_code="language_code_value", ) + assert args[0] == request_msg def test_list_voices_use_cached_wrapped_rpc(): @@ -1423,9 +1440,14 @@ async def test_list_voices_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_voices_async( - transport: str = "grpc_asyncio", request_type=cloud_tts.ListVoicesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_tts.ListVoicesRequest(), + {}, + ], +) +async def test_list_voices_async(request_type, transport: str = "grpc_asyncio"): client = TextToSpeechAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1433,7 +1455,7 @@ async def test_list_voices_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_voices), "__call__") as call: @@ -1453,11 +1475,6 @@ async def test_list_voices_async( assert isinstance(response, cloud_tts.ListVoicesResponse) -@pytest.mark.asyncio -async def test_list_voices_async_from_dict(): - await test_list_voices_async(request_type=dict) - - def test_list_voices_flattened(): client = TextToSpeechClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1543,8 +1560,8 @@ async def test_list_voices_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_tts.SynthesizeSpeechRequest, - dict, + cloud_tts.SynthesizeSpeechRequest(), + {}, ], ) def test_synthesize_speech(request_type, transport: str = "grpc"): @@ -1555,7 +1572,7 @@ def test_synthesize_speech(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1601,7 +1618,8 @@ def test_synthesize_speech_non_empty_request_with_auto_populated_field(): client.synthesize_speech(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_tts.SynthesizeSpeechRequest() + request_msg = cloud_tts.SynthesizeSpeechRequest() + assert args[0] == request_msg def test_synthesize_speech_use_cached_wrapped_rpc(): @@ -1684,9 +1702,14 @@ async def test_synthesize_speech_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_synthesize_speech_async( - transport: str = "grpc_asyncio", request_type=cloud_tts.SynthesizeSpeechRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_tts.SynthesizeSpeechRequest(), + {}, + ], +) +async def test_synthesize_speech_async(request_type, transport: str = "grpc_asyncio"): client = TextToSpeechAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1694,7 +1717,7 @@ async def test_synthesize_speech_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( @@ -1719,11 +1742,6 @@ async def test_synthesize_speech_async( assert response.audio_content == b"audio_content_blob" -@pytest.mark.asyncio -async def test_synthesize_speech_async_from_dict(): - await test_synthesize_speech_async(request_type=dict) - - def test_synthesize_speech_flattened(): client = TextToSpeechClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1845,8 +1863,8 @@ async def test_synthesize_speech_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_tts.StreamingSynthesizeRequest, - dict, + cloud_tts.StreamingSynthesizeRequest(), + {}, ], ) def test_streaming_synthesize(request_type, transport: str = "grpc"): @@ -1857,7 +1875,7 @@ def test_streaming_synthesize(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as 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. @@ -1960,8 +1978,15 @@ async def test_streaming_synthesize_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloud_tts.StreamingSynthesizeRequest(), + {}, + ], +) async def test_streaming_synthesize_async( - transport: str = "grpc_asyncio", request_type=cloud_tts.StreamingSynthesizeRequest + request_type, transport: str = "grpc_asyncio" ): client = TextToSpeechAsyncClient( credentials=async_anonymous_credentials(), @@ -1970,7 +1995,7 @@ async def test_streaming_synthesize_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. @@ -1994,11 +2019,6 @@ async def test_streaming_synthesize_async( assert isinstance(message, cloud_tts.StreamingSynthesizeResponse) -@pytest.mark.asyncio -async def test_streaming_synthesize_async_from_dict(): - await test_streaming_synthesize_async(request_type=dict) - - def test_list_voices_rest_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, # instead of constructing them on each call @@ -2427,7 +2447,6 @@ def test_list_voices_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tts.ListVoicesRequest() - assert args[0] == request_msg @@ -2450,7 +2469,6 @@ def test_synthesize_speech_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tts.SynthesizeSpeechRequest() - assert args[0] == request_msg @@ -2489,7 +2507,6 @@ async def test_list_voices_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tts.ListVoicesRequest() - assert args[0] == request_msg @@ -2518,7 +2535,6 @@ async def test_synthesize_speech_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tts.SynthesizeSpeechRequest() - assert args[0] == request_msg @@ -2948,7 +2964,6 @@ def test_list_voices_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tts.ListVoicesRequest() - assert args[0] == request_msg @@ -2970,7 +2985,6 @@ def test_synthesize_speech_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tts.SynthesizeSpeechRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-texttospeech/tests/unit/gapic/texttospeech_v1/test_text_to_speech_long_audio_synthesize.py b/packages/google-cloud-texttospeech/tests/unit/gapic/texttospeech_v1/test_text_to_speech_long_audio_synthesize.py index 630f7c1c6b20..0434d77a7dd8 100644 --- a/packages/google-cloud-texttospeech/tests/unit/gapic/texttospeech_v1/test_text_to_speech_long_audio_synthesize.py +++ b/packages/google-cloud-texttospeech/tests/unit/gapic/texttospeech_v1/test_text_to_speech_long_audio_synthesize.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" @@ -1448,8 +1464,8 @@ def test_text_to_speech_long_audio_synthesize_client_create_channel_credentials_ @pytest.mark.parametrize( "request_type", [ - cloud_tts_lrs.SynthesizeLongAudioRequest, - dict, + cloud_tts_lrs.SynthesizeLongAudioRequest(), + {}, ], ) def test_synthesize_long_audio(request_type, transport: str = "grpc"): @@ -1460,7 +1476,7 @@ def test_synthesize_long_audio(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1506,10 +1522,11 @@ def test_synthesize_long_audio_non_empty_request_with_auto_populated_field(): client.synthesize_long_audio(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_tts_lrs.SynthesizeLongAudioRequest( + request_msg = cloud_tts_lrs.SynthesizeLongAudioRequest( parent="parent_value", output_gcs_uri="output_gcs_uri_value", ) + assert args[0] == request_msg def test_synthesize_long_audio_use_cached_wrapped_rpc(): @@ -1605,9 +1622,15 @@ async def test_synthesize_long_audio_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloud_tts_lrs.SynthesizeLongAudioRequest(), + {}, + ], +) async def test_synthesize_long_audio_async( - transport: str = "grpc_asyncio", - request_type=cloud_tts_lrs.SynthesizeLongAudioRequest, + request_type, transport: str = "grpc_asyncio" ): client = TextToSpeechLongAudioSynthesizeAsyncClient( credentials=async_anonymous_credentials(), @@ -1616,7 +1639,7 @@ async def test_synthesize_long_audio_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( @@ -1638,11 +1661,6 @@ async def test_synthesize_long_audio_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_synthesize_long_audio_async_from_dict(): - await test_synthesize_long_audio_async(request_type=dict) - - def test_synthesize_long_audio_field_headers(): client = TextToSpeechLongAudioSynthesizeClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1970,7 +1988,6 @@ def test_synthesize_long_audio_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tts_lrs.SynthesizeLongAudioRequest() - assert args[0] == request_msg @@ -2011,7 +2028,6 @@ async def test_synthesize_long_audio_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tts_lrs.SynthesizeLongAudioRequest() - assert args[0] == request_msg @@ -2301,7 +2317,6 @@ def test_synthesize_long_audio_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tts_lrs.SynthesizeLongAudioRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-texttospeech/tests/unit/gapic/texttospeech_v1beta1/test_text_to_speech.py b/packages/google-cloud-texttospeech/tests/unit/gapic/texttospeech_v1beta1/test_text_to_speech.py index 168bf837d172..357f1dfda617 100644 --- a/packages/google-cloud-texttospeech/tests/unit/gapic/texttospeech_v1beta1/test_text_to_speech.py +++ b/packages/google-cloud-texttospeech/tests/unit/gapic/texttospeech_v1beta1/test_text_to_speech.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 @@ -107,6 +108,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" @@ -1287,8 +1303,8 @@ def test_text_to_speech_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - cloud_tts.ListVoicesRequest, - dict, + cloud_tts.ListVoicesRequest(), + {}, ], ) def test_list_voices(request_type, transport: str = "grpc"): @@ -1299,7 +1315,7 @@ def test_list_voices(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_voices), "__call__") as call: @@ -1340,9 +1356,10 @@ def test_list_voices_non_empty_request_with_auto_populated_field(): client.list_voices(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_tts.ListVoicesRequest( + request_msg = cloud_tts.ListVoicesRequest( language_code="language_code_value", ) + assert args[0] == request_msg def test_list_voices_use_cached_wrapped_rpc(): @@ -1423,9 +1440,14 @@ async def test_list_voices_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_voices_async( - transport: str = "grpc_asyncio", request_type=cloud_tts.ListVoicesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_tts.ListVoicesRequest(), + {}, + ], +) +async def test_list_voices_async(request_type, transport: str = "grpc_asyncio"): client = TextToSpeechAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1433,7 +1455,7 @@ async def test_list_voices_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_voices), "__call__") as call: @@ -1453,11 +1475,6 @@ async def test_list_voices_async( assert isinstance(response, cloud_tts.ListVoicesResponse) -@pytest.mark.asyncio -async def test_list_voices_async_from_dict(): - await test_list_voices_async(request_type=dict) - - def test_list_voices_flattened(): client = TextToSpeechClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1543,8 +1560,8 @@ async def test_list_voices_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_tts.SynthesizeSpeechRequest, - dict, + cloud_tts.SynthesizeSpeechRequest(), + {}, ], ) def test_synthesize_speech(request_type, transport: str = "grpc"): @@ -1555,7 +1572,7 @@ def test_synthesize_speech(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1601,7 +1618,8 @@ def test_synthesize_speech_non_empty_request_with_auto_populated_field(): client.synthesize_speech(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_tts.SynthesizeSpeechRequest() + request_msg = cloud_tts.SynthesizeSpeechRequest() + assert args[0] == request_msg def test_synthesize_speech_use_cached_wrapped_rpc(): @@ -1684,9 +1702,14 @@ async def test_synthesize_speech_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_synthesize_speech_async( - transport: str = "grpc_asyncio", request_type=cloud_tts.SynthesizeSpeechRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_tts.SynthesizeSpeechRequest(), + {}, + ], +) +async def test_synthesize_speech_async(request_type, transport: str = "grpc_asyncio"): client = TextToSpeechAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1694,7 +1717,7 @@ async def test_synthesize_speech_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( @@ -1719,11 +1742,6 @@ async def test_synthesize_speech_async( assert response.audio_content == b"audio_content_blob" -@pytest.mark.asyncio -async def test_synthesize_speech_async_from_dict(): - await test_synthesize_speech_async(request_type=dict) - - def test_synthesize_speech_flattened(): client = TextToSpeechClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1845,8 +1863,8 @@ async def test_synthesize_speech_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_tts.StreamingSynthesizeRequest, - dict, + cloud_tts.StreamingSynthesizeRequest(), + {}, ], ) def test_streaming_synthesize(request_type, transport: str = "grpc"): @@ -1857,7 +1875,7 @@ def test_streaming_synthesize(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as 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. @@ -1960,8 +1978,15 @@ async def test_streaming_synthesize_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloud_tts.StreamingSynthesizeRequest(), + {}, + ], +) async def test_streaming_synthesize_async( - transport: str = "grpc_asyncio", request_type=cloud_tts.StreamingSynthesizeRequest + request_type, transport: str = "grpc_asyncio" ): client = TextToSpeechAsyncClient( credentials=async_anonymous_credentials(), @@ -1970,7 +1995,7 @@ async def test_streaming_synthesize_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. @@ -1994,11 +2019,6 @@ async def test_streaming_synthesize_async( assert isinstance(message, cloud_tts.StreamingSynthesizeResponse) -@pytest.mark.asyncio -async def test_streaming_synthesize_async_from_dict(): - await test_streaming_synthesize_async(request_type=dict) - - def test_list_voices_rest_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, # instead of constructing them on each call @@ -2429,7 +2449,6 @@ def test_list_voices_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tts.ListVoicesRequest() - assert args[0] == request_msg @@ -2452,7 +2471,6 @@ def test_synthesize_speech_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tts.SynthesizeSpeechRequest() - assert args[0] == request_msg @@ -2491,7 +2509,6 @@ async def test_list_voices_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tts.ListVoicesRequest() - assert args[0] == request_msg @@ -2520,7 +2537,6 @@ async def test_synthesize_speech_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tts.SynthesizeSpeechRequest() - assert args[0] == request_msg @@ -2950,7 +2966,6 @@ def test_list_voices_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tts.ListVoicesRequest() - assert args[0] == request_msg @@ -2972,7 +2987,6 @@ def test_synthesize_speech_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tts.SynthesizeSpeechRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-texttospeech/tests/unit/gapic/texttospeech_v1beta1/test_text_to_speech_long_audio_synthesize.py b/packages/google-cloud-texttospeech/tests/unit/gapic/texttospeech_v1beta1/test_text_to_speech_long_audio_synthesize.py index 212322116525..022a3a3da70e 100644 --- a/packages/google-cloud-texttospeech/tests/unit/gapic/texttospeech_v1beta1/test_text_to_speech_long_audio_synthesize.py +++ b/packages/google-cloud-texttospeech/tests/unit/gapic/texttospeech_v1beta1/test_text_to_speech_long_audio_synthesize.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" @@ -1448,8 +1464,8 @@ def test_text_to_speech_long_audio_synthesize_client_create_channel_credentials_ @pytest.mark.parametrize( "request_type", [ - cloud_tts_lrs.SynthesizeLongAudioRequest, - dict, + cloud_tts_lrs.SynthesizeLongAudioRequest(), + {}, ], ) def test_synthesize_long_audio(request_type, transport: str = "grpc"): @@ -1460,7 +1476,7 @@ def test_synthesize_long_audio(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1506,10 +1522,11 @@ def test_synthesize_long_audio_non_empty_request_with_auto_populated_field(): client.synthesize_long_audio(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_tts_lrs.SynthesizeLongAudioRequest( + request_msg = cloud_tts_lrs.SynthesizeLongAudioRequest( parent="parent_value", output_gcs_uri="output_gcs_uri_value", ) + assert args[0] == request_msg def test_synthesize_long_audio_use_cached_wrapped_rpc(): @@ -1605,9 +1622,15 @@ async def test_synthesize_long_audio_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloud_tts_lrs.SynthesizeLongAudioRequest(), + {}, + ], +) async def test_synthesize_long_audio_async( - transport: str = "grpc_asyncio", - request_type=cloud_tts_lrs.SynthesizeLongAudioRequest, + request_type, transport: str = "grpc_asyncio" ): client = TextToSpeechLongAudioSynthesizeAsyncClient( credentials=async_anonymous_credentials(), @@ -1616,7 +1639,7 @@ async def test_synthesize_long_audio_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( @@ -1638,11 +1661,6 @@ async def test_synthesize_long_audio_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_synthesize_long_audio_async_from_dict(): - await test_synthesize_long_audio_async(request_type=dict) - - def test_synthesize_long_audio_field_headers(): client = TextToSpeechLongAudioSynthesizeClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1970,7 +1988,6 @@ def test_synthesize_long_audio_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tts_lrs.SynthesizeLongAudioRequest() - assert args[0] == request_msg @@ -2011,7 +2028,6 @@ async def test_synthesize_long_audio_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tts_lrs.SynthesizeLongAudioRequest() - assert args[0] == request_msg @@ -2301,7 +2317,6 @@ def test_synthesize_long_audio_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tts_lrs.SynthesizeLongAudioRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-tpu/noxfile.py b/packages/google-cloud-tpu/noxfile.py index e02acf1f80a9..ad1769c6ddb5 100644 --- a/packages/google-cloud-tpu/noxfile.py +++ b/packages/google-cloud-tpu/noxfile.py @@ -47,7 +47,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-tpu" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-tpu/setup.py b/packages/google-cloud-tpu/setup.py index 42159f9f3018..ebf078b4b589 100644 --- a/packages/google-cloud-tpu/setup.py +++ b/packages/google-cloud-tpu/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/google-cloud-tpu/testing/constraints-3.10.txt b/packages/google-cloud-tpu/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-tpu/testing/constraints-3.10.txt +++ b/packages/google-cloud-tpu/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-tpu/tests/unit/gapic/tpu_v1/test_tpu.py b/packages/google-cloud-tpu/tests/unit/gapic/tpu_v1/test_tpu.py index 1e86a282d28e..45290acdd8d3 100644 --- a/packages/google-cloud-tpu/tests/unit/gapic/tpu_v1/test_tpu.py +++ b/packages/google-cloud-tpu/tests/unit/gapic/tpu_v1/test_tpu.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" @@ -1197,8 +1213,8 @@ def test_tpu_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - cloud_tpu.ListNodesRequest, - dict, + cloud_tpu.ListNodesRequest(), + {}, ], ) def test_list_nodes(request_type, transport: str = "grpc"): @@ -1209,7 +1225,7 @@ def test_list_nodes(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_nodes), "__call__") as call: @@ -1256,10 +1272,11 @@ def test_list_nodes_non_empty_request_with_auto_populated_field(): client.list_nodes(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_tpu.ListNodesRequest( + request_msg = cloud_tpu.ListNodesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_nodes_use_cached_wrapped_rpc(): @@ -1338,9 +1355,14 @@ async def test_list_nodes_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_list_nodes_async( - transport: str = "grpc_asyncio", request_type=cloud_tpu.ListNodesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_tpu.ListNodesRequest(), + {}, + ], +) +async def test_list_nodes_async(request_type, transport: str = "grpc_asyncio"): client = TpuAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1348,7 +1370,7 @@ async def test_list_nodes_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_nodes), "__call__") as call: @@ -1373,11 +1395,6 @@ async def test_list_nodes_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_nodes_async_from_dict(): - await test_list_nodes_async(request_type=dict) - - def test_list_nodes_field_headers(): client = TpuClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1714,8 +1731,8 @@ async def test_list_nodes_async_pages(): @pytest.mark.parametrize( "request_type", [ - cloud_tpu.GetNodeRequest, - dict, + cloud_tpu.GetNodeRequest(), + {}, ], ) def test_get_node(request_type, transport: str = "grpc"): @@ -1726,7 +1743,7 @@ def test_get_node(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_node), "__call__") as call: @@ -1796,9 +1813,10 @@ def test_get_node_non_empty_request_with_auto_populated_field(): client.get_node(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_tpu.GetNodeRequest( + request_msg = cloud_tpu.GetNodeRequest( name="name_value", ) + assert args[0] == request_msg def test_get_node_use_cached_wrapped_rpc(): @@ -1877,9 +1895,14 @@ async def test_get_node_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn @pytest.mark.asyncio -async def test_get_node_async( - transport: str = "grpc_asyncio", request_type=cloud_tpu.GetNodeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_tpu.GetNodeRequest(), + {}, + ], +) +async def test_get_node_async(request_type, transport: str = "grpc_asyncio"): client = TpuAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1887,7 +1910,7 @@ async def test_get_node_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_node), "__call__") as call: @@ -1936,11 +1959,6 @@ async def test_get_node_async( assert response.api_version == cloud_tpu.Node.ApiVersion.V1_ALPHA1 -@pytest.mark.asyncio -async def test_get_node_async_from_dict(): - await test_get_node_async(request_type=dict) - - def test_get_node_field_headers(): client = TpuClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2083,8 +2101,8 @@ async def test_get_node_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_tpu.CreateNodeRequest, - dict, + cloud_tpu.CreateNodeRequest(), + {}, ], ) def test_create_node(request_type, transport: str = "grpc"): @@ -2095,7 +2113,7 @@ def test_create_node(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_node), "__call__") as call: @@ -2137,10 +2155,11 @@ def test_create_node_non_empty_request_with_auto_populated_field(): client.create_node(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_tpu.CreateNodeRequest( + request_msg = cloud_tpu.CreateNodeRequest( parent="parent_value", node_id="node_id_value", ) + assert args[0] == request_msg def test_create_node_use_cached_wrapped_rpc(): @@ -2231,9 +2250,14 @@ async def test_create_node_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_node_async( - transport: str = "grpc_asyncio", request_type=cloud_tpu.CreateNodeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_tpu.CreateNodeRequest(), + {}, + ], +) +async def test_create_node_async(request_type, transport: str = "grpc_asyncio"): client = TpuAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2241,7 +2265,7 @@ async def test_create_node_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_node), "__call__") as call: @@ -2261,11 +2285,6 @@ async def test_create_node_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_node_async_from_dict(): - await test_create_node_async(request_type=dict) - - def test_create_node_field_headers(): client = TpuClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2432,8 +2451,8 @@ async def test_create_node_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_tpu.DeleteNodeRequest, - dict, + cloud_tpu.DeleteNodeRequest(), + {}, ], ) def test_delete_node(request_type, transport: str = "grpc"): @@ -2444,7 +2463,7 @@ def test_delete_node(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_node), "__call__") as call: @@ -2485,9 +2504,10 @@ def test_delete_node_non_empty_request_with_auto_populated_field(): client.delete_node(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_tpu.DeleteNodeRequest( + request_msg = cloud_tpu.DeleteNodeRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_node_use_cached_wrapped_rpc(): @@ -2578,9 +2598,14 @@ async def test_delete_node_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_node_async( - transport: str = "grpc_asyncio", request_type=cloud_tpu.DeleteNodeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_tpu.DeleteNodeRequest(), + {}, + ], +) +async def test_delete_node_async(request_type, transport: str = "grpc_asyncio"): client = TpuAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2588,7 +2613,7 @@ async def test_delete_node_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_node), "__call__") as call: @@ -2608,11 +2633,6 @@ async def test_delete_node_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_node_async_from_dict(): - await test_delete_node_async(request_type=dict) - - def test_delete_node_field_headers(): client = TpuClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2759,8 +2779,8 @@ async def test_delete_node_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_tpu.ReimageNodeRequest, - dict, + cloud_tpu.ReimageNodeRequest(), + {}, ], ) def test_reimage_node(request_type, transport: str = "grpc"): @@ -2771,7 +2791,7 @@ def test_reimage_node(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.reimage_node), "__call__") as call: @@ -2813,10 +2833,11 @@ def test_reimage_node_non_empty_request_with_auto_populated_field(): client.reimage_node(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_tpu.ReimageNodeRequest( + request_msg = cloud_tpu.ReimageNodeRequest( name="name_value", tensorflow_version="tensorflow_version_value", ) + assert args[0] == request_msg def test_reimage_node_use_cached_wrapped_rpc(): @@ -2907,9 +2928,14 @@ async def test_reimage_node_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_reimage_node_async( - transport: str = "grpc_asyncio", request_type=cloud_tpu.ReimageNodeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_tpu.ReimageNodeRequest(), + {}, + ], +) +async def test_reimage_node_async(request_type, transport: str = "grpc_asyncio"): client = TpuAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2917,7 +2943,7 @@ async def test_reimage_node_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.reimage_node), "__call__") as call: @@ -2937,11 +2963,6 @@ async def test_reimage_node_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_reimage_node_async_from_dict(): - await test_reimage_node_async(request_type=dict) - - def test_reimage_node_field_headers(): client = TpuClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3006,8 +3027,8 @@ async def test_reimage_node_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - cloud_tpu.StopNodeRequest, - dict, + cloud_tpu.StopNodeRequest(), + {}, ], ) def test_stop_node(request_type, transport: str = "grpc"): @@ -3018,7 +3039,7 @@ def test_stop_node(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.stop_node), "__call__") as call: @@ -3059,9 +3080,10 @@ def test_stop_node_non_empty_request_with_auto_populated_field(): client.stop_node(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_tpu.StopNodeRequest( + request_msg = cloud_tpu.StopNodeRequest( name="name_value", ) + assert args[0] == request_msg def test_stop_node_use_cached_wrapped_rpc(): @@ -3150,9 +3172,14 @@ async def test_stop_node_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_stop_node_async( - transport: str = "grpc_asyncio", request_type=cloud_tpu.StopNodeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_tpu.StopNodeRequest(), + {}, + ], +) +async def test_stop_node_async(request_type, transport: str = "grpc_asyncio"): client = TpuAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3160,7 +3187,7 @@ async def test_stop_node_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.stop_node), "__call__") as call: @@ -3180,11 +3207,6 @@ async def test_stop_node_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_stop_node_async_from_dict(): - await test_stop_node_async(request_type=dict) - - def test_stop_node_field_headers(): client = TpuClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3249,8 +3271,8 @@ async def test_stop_node_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - cloud_tpu.StartNodeRequest, - dict, + cloud_tpu.StartNodeRequest(), + {}, ], ) def test_start_node(request_type, transport: str = "grpc"): @@ -3261,7 +3283,7 @@ def test_start_node(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.start_node), "__call__") as call: @@ -3302,9 +3324,10 @@ def test_start_node_non_empty_request_with_auto_populated_field(): client.start_node(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_tpu.StartNodeRequest( + request_msg = cloud_tpu.StartNodeRequest( name="name_value", ) + assert args[0] == request_msg def test_start_node_use_cached_wrapped_rpc(): @@ -3393,9 +3416,14 @@ async def test_start_node_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_start_node_async( - transport: str = "grpc_asyncio", request_type=cloud_tpu.StartNodeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_tpu.StartNodeRequest(), + {}, + ], +) +async def test_start_node_async(request_type, transport: str = "grpc_asyncio"): client = TpuAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3403,7 +3431,7 @@ async def test_start_node_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.start_node), "__call__") as call: @@ -3423,11 +3451,6 @@ async def test_start_node_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_start_node_async_from_dict(): - await test_start_node_async(request_type=dict) - - def test_start_node_field_headers(): client = TpuClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3492,8 +3515,8 @@ async def test_start_node_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - cloud_tpu.ListTensorFlowVersionsRequest, - dict, + cloud_tpu.ListTensorFlowVersionsRequest(), + {}, ], ) def test_list_tensor_flow_versions(request_type, transport: str = "grpc"): @@ -3504,7 +3527,7 @@ def test_list_tensor_flow_versions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3557,12 +3580,13 @@ def test_list_tensor_flow_versions_non_empty_request_with_auto_populated_field() client.list_tensor_flow_versions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_tpu.ListTensorFlowVersionsRequest( + request_msg = cloud_tpu.ListTensorFlowVersionsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_tensor_flow_versions_use_cached_wrapped_rpc(): @@ -3648,9 +3672,15 @@ async def test_list_tensor_flow_versions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloud_tpu.ListTensorFlowVersionsRequest(), + {}, + ], +) async def test_list_tensor_flow_versions_async( - transport: str = "grpc_asyncio", - request_type=cloud_tpu.ListTensorFlowVersionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = TpuAsyncClient( credentials=async_anonymous_credentials(), @@ -3659,7 +3689,7 @@ async def test_list_tensor_flow_versions_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( @@ -3686,11 +3716,6 @@ async def test_list_tensor_flow_versions_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_tensor_flow_versions_async_from_dict(): - await test_list_tensor_flow_versions_async(request_type=dict) - - def test_list_tensor_flow_versions_field_headers(): client = TpuClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4045,8 +4070,8 @@ async def test_list_tensor_flow_versions_async_pages(): @pytest.mark.parametrize( "request_type", [ - cloud_tpu.GetTensorFlowVersionRequest, - dict, + cloud_tpu.GetTensorFlowVersionRequest(), + {}, ], ) def test_get_tensor_flow_version(request_type, transport: str = "grpc"): @@ -4057,7 +4082,7 @@ def test_get_tensor_flow_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4107,9 +4132,10 @@ def test_get_tensor_flow_version_non_empty_request_with_auto_populated_field(): client.get_tensor_flow_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_tpu.GetTensorFlowVersionRequest( + request_msg = cloud_tpu.GetTensorFlowVersionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_tensor_flow_version_use_cached_wrapped_rpc(): @@ -4195,8 +4221,15 @@ async def test_get_tensor_flow_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloud_tpu.GetTensorFlowVersionRequest(), + {}, + ], +) async def test_get_tensor_flow_version_async( - transport: str = "grpc_asyncio", request_type=cloud_tpu.GetTensorFlowVersionRequest + request_type, transport: str = "grpc_asyncio" ): client = TpuAsyncClient( credentials=async_anonymous_credentials(), @@ -4205,7 +4238,7 @@ async def test_get_tensor_flow_version_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( @@ -4232,11 +4265,6 @@ async def test_get_tensor_flow_version_async( assert response.version == "version_value" -@pytest.mark.asyncio -async def test_get_tensor_flow_version_async_from_dict(): - await test_get_tensor_flow_version_async(request_type=dict) - - def test_get_tensor_flow_version_field_headers(): client = TpuClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4391,8 +4419,8 @@ async def test_get_tensor_flow_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_tpu.ListAcceleratorTypesRequest, - dict, + cloud_tpu.ListAcceleratorTypesRequest(), + {}, ], ) def test_list_accelerator_types(request_type, transport: str = "grpc"): @@ -4403,7 +4431,7 @@ def test_list_accelerator_types(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4456,12 +4484,13 @@ def test_list_accelerator_types_non_empty_request_with_auto_populated_field(): client.list_accelerator_types(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_tpu.ListAcceleratorTypesRequest( + request_msg = cloud_tpu.ListAcceleratorTypesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_accelerator_types_use_cached_wrapped_rpc(): @@ -4547,8 +4576,15 @@ async def test_list_accelerator_types_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloud_tpu.ListAcceleratorTypesRequest(), + {}, + ], +) async def test_list_accelerator_types_async( - transport: str = "grpc_asyncio", request_type=cloud_tpu.ListAcceleratorTypesRequest + request_type, transport: str = "grpc_asyncio" ): client = TpuAsyncClient( credentials=async_anonymous_credentials(), @@ -4557,7 +4593,7 @@ async def test_list_accelerator_types_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( @@ -4584,11 +4620,6 @@ async def test_list_accelerator_types_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_accelerator_types_async_from_dict(): - await test_list_accelerator_types_async(request_type=dict) - - def test_list_accelerator_types_field_headers(): client = TpuClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4941,8 +4972,8 @@ async def test_list_accelerator_types_async_pages(): @pytest.mark.parametrize( "request_type", [ - cloud_tpu.GetAcceleratorTypeRequest, - dict, + cloud_tpu.GetAcceleratorTypeRequest(), + {}, ], ) def test_get_accelerator_type(request_type, transport: str = "grpc"): @@ -4953,7 +4984,7 @@ def test_get_accelerator_type(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5003,9 +5034,10 @@ def test_get_accelerator_type_non_empty_request_with_auto_populated_field(): client.get_accelerator_type(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_tpu.GetAcceleratorTypeRequest( + request_msg = cloud_tpu.GetAcceleratorTypeRequest( name="name_value", ) + assert args[0] == request_msg def test_get_accelerator_type_use_cached_wrapped_rpc(): @@ -5090,8 +5122,15 @@ async def test_get_accelerator_type_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloud_tpu.GetAcceleratorTypeRequest(), + {}, + ], +) async def test_get_accelerator_type_async( - transport: str = "grpc_asyncio", request_type=cloud_tpu.GetAcceleratorTypeRequest + request_type, transport: str = "grpc_asyncio" ): client = TpuAsyncClient( credentials=async_anonymous_credentials(), @@ -5100,7 +5139,7 @@ async def test_get_accelerator_type_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( @@ -5127,11 +5166,6 @@ async def test_get_accelerator_type_async( assert response.type_ == "type__value" -@pytest.mark.asyncio -async def test_get_accelerator_type_async_from_dict(): - await test_get_accelerator_type_async(request_type=dict) - - def test_get_accelerator_type_field_headers(): client = TpuClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5405,7 +5439,6 @@ def test_list_nodes_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.ListNodesRequest() - assert args[0] == request_msg @@ -5426,7 +5459,6 @@ def test_get_node_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.GetNodeRequest() - assert args[0] == request_msg @@ -5447,7 +5479,6 @@ def test_create_node_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.CreateNodeRequest() - assert args[0] == request_msg @@ -5468,7 +5499,6 @@ def test_delete_node_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.DeleteNodeRequest() - assert args[0] == request_msg @@ -5489,7 +5519,6 @@ def test_reimage_node_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.ReimageNodeRequest() - assert args[0] == request_msg @@ -5510,7 +5539,6 @@ def test_stop_node_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.StopNodeRequest() - assert args[0] == request_msg @@ -5531,7 +5559,6 @@ def test_start_node_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.StartNodeRequest() - assert args[0] == request_msg @@ -5554,7 +5581,6 @@ def test_list_tensor_flow_versions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.ListTensorFlowVersionsRequest() - assert args[0] == request_msg @@ -5577,7 +5603,6 @@ def test_get_tensor_flow_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.GetTensorFlowVersionRequest() - assert args[0] == request_msg @@ -5600,7 +5625,6 @@ def test_list_accelerator_types_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.ListAcceleratorTypesRequest() - assert args[0] == request_msg @@ -5623,7 +5647,6 @@ def test_get_accelerator_type_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.GetAcceleratorTypeRequest() - assert args[0] == request_msg @@ -5665,7 +5688,6 @@ async def test_list_nodes_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.ListNodesRequest() - assert args[0] == request_msg @@ -5705,7 +5727,6 @@ async def test_get_node_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.GetNodeRequest() - assert args[0] == request_msg @@ -5730,7 +5751,6 @@ async def test_create_node_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.CreateNodeRequest() - assert args[0] == request_msg @@ -5755,7 +5775,6 @@ async def test_delete_node_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.DeleteNodeRequest() - assert args[0] == request_msg @@ -5780,7 +5799,6 @@ async def test_reimage_node_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.ReimageNodeRequest() - assert args[0] == request_msg @@ -5805,7 +5823,6 @@ async def test_stop_node_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.StopNodeRequest() - assert args[0] == request_msg @@ -5830,7 +5847,6 @@ async def test_start_node_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.StartNodeRequest() - assert args[0] == request_msg @@ -5860,7 +5876,6 @@ async def test_list_tensor_flow_versions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.ListTensorFlowVersionsRequest() - assert args[0] == request_msg @@ -5890,7 +5905,6 @@ async def test_get_tensor_flow_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.GetTensorFlowVersionRequest() - assert args[0] == request_msg @@ -5920,7 +5934,6 @@ async def test_list_accelerator_types_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.ListAcceleratorTypesRequest() - assert args[0] == request_msg @@ -5950,7 +5963,6 @@ async def test_get_accelerator_type_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.GetAcceleratorTypeRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-tpu/tests/unit/gapic/tpu_v2/test_tpu.py b/packages/google-cloud-tpu/tests/unit/gapic/tpu_v2/test_tpu.py index b272560e4e09..8fdebb88a973 100644 --- a/packages/google-cloud-tpu/tests/unit/gapic/tpu_v2/test_tpu.py +++ b/packages/google-cloud-tpu/tests/unit/gapic/tpu_v2/test_tpu.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 @@ -120,6 +121,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" @@ -1223,8 +1239,8 @@ def test_tpu_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - cloud_tpu.ListNodesRequest, - dict, + cloud_tpu.ListNodesRequest(), + {}, ], ) def test_list_nodes(request_type, transport: str = "grpc"): @@ -1235,7 +1251,7 @@ def test_list_nodes(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_nodes), "__call__") as call: @@ -1282,10 +1298,11 @@ def test_list_nodes_non_empty_request_with_auto_populated_field(): client.list_nodes(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_tpu.ListNodesRequest( + request_msg = cloud_tpu.ListNodesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_nodes_use_cached_wrapped_rpc(): @@ -1364,9 +1381,14 @@ async def test_list_nodes_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_list_nodes_async( - transport: str = "grpc_asyncio", request_type=cloud_tpu.ListNodesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_tpu.ListNodesRequest(), + {}, + ], +) +async def test_list_nodes_async(request_type, transport: str = "grpc_asyncio"): client = TpuAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1374,7 +1396,7 @@ async def test_list_nodes_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_nodes), "__call__") as call: @@ -1399,11 +1421,6 @@ async def test_list_nodes_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_nodes_async_from_dict(): - await test_list_nodes_async(request_type=dict) - - def test_list_nodes_field_headers(): client = TpuClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1740,8 +1757,8 @@ async def test_list_nodes_async_pages(): @pytest.mark.parametrize( "request_type", [ - cloud_tpu.GetNodeRequest, - dict, + cloud_tpu.GetNodeRequest(), + {}, ], ) def test_get_node(request_type, transport: str = "grpc"): @@ -1752,7 +1769,7 @@ def test_get_node(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_node), "__call__") as call: @@ -1820,9 +1837,10 @@ def test_get_node_non_empty_request_with_auto_populated_field(): client.get_node(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_tpu.GetNodeRequest( + request_msg = cloud_tpu.GetNodeRequest( name="name_value", ) + assert args[0] == request_msg def test_get_node_use_cached_wrapped_rpc(): @@ -1901,9 +1919,14 @@ async def test_get_node_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn @pytest.mark.asyncio -async def test_get_node_async( - transport: str = "grpc_asyncio", request_type=cloud_tpu.GetNodeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_tpu.GetNodeRequest(), + {}, + ], +) +async def test_get_node_async(request_type, transport: str = "grpc_asyncio"): client = TpuAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1911,7 +1934,7 @@ async def test_get_node_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_node), "__call__") as call: @@ -1958,11 +1981,6 @@ async def test_get_node_async( assert response.multislice_node is True -@pytest.mark.asyncio -async def test_get_node_async_from_dict(): - await test_get_node_async(request_type=dict) - - def test_get_node_field_headers(): client = TpuClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2105,8 +2123,8 @@ async def test_get_node_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_tpu.CreateNodeRequest, - dict, + cloud_tpu.CreateNodeRequest(), + {}, ], ) def test_create_node(request_type, transport: str = "grpc"): @@ -2117,7 +2135,7 @@ def test_create_node(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_node), "__call__") as call: @@ -2159,10 +2177,11 @@ def test_create_node_non_empty_request_with_auto_populated_field(): client.create_node(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_tpu.CreateNodeRequest( + request_msg = cloud_tpu.CreateNodeRequest( parent="parent_value", node_id="node_id_value", ) + assert args[0] == request_msg def test_create_node_use_cached_wrapped_rpc(): @@ -2253,9 +2272,14 @@ async def test_create_node_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_node_async( - transport: str = "grpc_asyncio", request_type=cloud_tpu.CreateNodeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_tpu.CreateNodeRequest(), + {}, + ], +) +async def test_create_node_async(request_type, transport: str = "grpc_asyncio"): client = TpuAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2263,7 +2287,7 @@ async def test_create_node_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_node), "__call__") as call: @@ -2283,11 +2307,6 @@ async def test_create_node_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_node_async_from_dict(): - await test_create_node_async(request_type=dict) - - def test_create_node_field_headers(): client = TpuClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2454,8 +2473,8 @@ async def test_create_node_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_tpu.DeleteNodeRequest, - dict, + cloud_tpu.DeleteNodeRequest(), + {}, ], ) def test_delete_node(request_type, transport: str = "grpc"): @@ -2466,7 +2485,7 @@ def test_delete_node(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_node), "__call__") as call: @@ -2507,9 +2526,10 @@ def test_delete_node_non_empty_request_with_auto_populated_field(): client.delete_node(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_tpu.DeleteNodeRequest( + request_msg = cloud_tpu.DeleteNodeRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_node_use_cached_wrapped_rpc(): @@ -2600,9 +2620,14 @@ async def test_delete_node_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_node_async( - transport: str = "grpc_asyncio", request_type=cloud_tpu.DeleteNodeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_tpu.DeleteNodeRequest(), + {}, + ], +) +async def test_delete_node_async(request_type, transport: str = "grpc_asyncio"): client = TpuAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2610,7 +2635,7 @@ async def test_delete_node_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_node), "__call__") as call: @@ -2630,11 +2655,6 @@ async def test_delete_node_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_node_async_from_dict(): - await test_delete_node_async(request_type=dict) - - def test_delete_node_field_headers(): client = TpuClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2781,8 +2801,8 @@ async def test_delete_node_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_tpu.StopNodeRequest, - dict, + cloud_tpu.StopNodeRequest(), + {}, ], ) def test_stop_node(request_type, transport: str = "grpc"): @@ -2793,7 +2813,7 @@ def test_stop_node(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.stop_node), "__call__") as call: @@ -2834,9 +2854,10 @@ def test_stop_node_non_empty_request_with_auto_populated_field(): client.stop_node(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_tpu.StopNodeRequest( + request_msg = cloud_tpu.StopNodeRequest( name="name_value", ) + assert args[0] == request_msg def test_stop_node_use_cached_wrapped_rpc(): @@ -2925,9 +2946,14 @@ async def test_stop_node_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_stop_node_async( - transport: str = "grpc_asyncio", request_type=cloud_tpu.StopNodeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_tpu.StopNodeRequest(), + {}, + ], +) +async def test_stop_node_async(request_type, transport: str = "grpc_asyncio"): client = TpuAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2935,7 +2961,7 @@ async def test_stop_node_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.stop_node), "__call__") as call: @@ -2955,11 +2981,6 @@ async def test_stop_node_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_stop_node_async_from_dict(): - await test_stop_node_async(request_type=dict) - - def test_stop_node_field_headers(): client = TpuClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3024,8 +3045,8 @@ async def test_stop_node_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - cloud_tpu.StartNodeRequest, - dict, + cloud_tpu.StartNodeRequest(), + {}, ], ) def test_start_node(request_type, transport: str = "grpc"): @@ -3036,7 +3057,7 @@ def test_start_node(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.start_node), "__call__") as call: @@ -3077,9 +3098,10 @@ def test_start_node_non_empty_request_with_auto_populated_field(): client.start_node(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_tpu.StartNodeRequest( + request_msg = cloud_tpu.StartNodeRequest( name="name_value", ) + assert args[0] == request_msg def test_start_node_use_cached_wrapped_rpc(): @@ -3168,9 +3190,14 @@ async def test_start_node_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_start_node_async( - transport: str = "grpc_asyncio", request_type=cloud_tpu.StartNodeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_tpu.StartNodeRequest(), + {}, + ], +) +async def test_start_node_async(request_type, transport: str = "grpc_asyncio"): client = TpuAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3178,7 +3205,7 @@ async def test_start_node_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.start_node), "__call__") as call: @@ -3198,11 +3225,6 @@ async def test_start_node_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_start_node_async_from_dict(): - await test_start_node_async(request_type=dict) - - def test_start_node_field_headers(): client = TpuClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3267,8 +3289,8 @@ async def test_start_node_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - cloud_tpu.UpdateNodeRequest, - dict, + cloud_tpu.UpdateNodeRequest(), + {}, ], ) def test_update_node(request_type, transport: str = "grpc"): @@ -3279,7 +3301,7 @@ def test_update_node(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_node), "__call__") as call: @@ -3318,7 +3340,8 @@ def test_update_node_non_empty_request_with_auto_populated_field(): client.update_node(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_tpu.UpdateNodeRequest() + request_msg = cloud_tpu.UpdateNodeRequest() + assert args[0] == request_msg def test_update_node_use_cached_wrapped_rpc(): @@ -3409,9 +3432,14 @@ async def test_update_node_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_node_async( - transport: str = "grpc_asyncio", request_type=cloud_tpu.UpdateNodeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_tpu.UpdateNodeRequest(), + {}, + ], +) +async def test_update_node_async(request_type, transport: str = "grpc_asyncio"): client = TpuAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3419,7 +3447,7 @@ async def test_update_node_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_node), "__call__") as call: @@ -3439,11 +3467,6 @@ async def test_update_node_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_node_async_from_dict(): - await test_update_node_async(request_type=dict) - - def test_update_node_field_headers(): client = TpuClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3600,8 +3623,8 @@ async def test_update_node_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_tpu.ListQueuedResourcesRequest, - dict, + cloud_tpu.ListQueuedResourcesRequest(), + {}, ], ) def test_list_queued_resources(request_type, transport: str = "grpc"): @@ -3612,7 +3635,7 @@ def test_list_queued_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( @@ -3663,10 +3686,11 @@ def test_list_queued_resources_non_empty_request_with_auto_populated_field(): client.list_queued_resources(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_tpu.ListQueuedResourcesRequest( + request_msg = cloud_tpu.ListQueuedResourcesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_queued_resources_use_cached_wrapped_rpc(): @@ -3752,8 +3776,15 @@ async def test_list_queued_resources_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloud_tpu.ListQueuedResourcesRequest(), + {}, + ], +) async def test_list_queued_resources_async( - transport: str = "grpc_asyncio", request_type=cloud_tpu.ListQueuedResourcesRequest + request_type, transport: str = "grpc_asyncio" ): client = TpuAsyncClient( credentials=async_anonymous_credentials(), @@ -3762,7 +3793,7 @@ async def test_list_queued_resources_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( @@ -3789,11 +3820,6 @@ async def test_list_queued_resources_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_queued_resources_async_from_dict(): - await test_list_queued_resources_async(request_type=dict) - - def test_list_queued_resources_field_headers(): client = TpuClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4146,8 +4172,8 @@ async def test_list_queued_resources_async_pages(): @pytest.mark.parametrize( "request_type", [ - cloud_tpu.GetQueuedResourceRequest, - dict, + cloud_tpu.GetQueuedResourceRequest(), + {}, ], ) def test_get_queued_resource(request_type, transport: str = "grpc"): @@ -4158,7 +4184,7 @@ def test_get_queued_resource(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4208,9 +4234,10 @@ def test_get_queued_resource_non_empty_request_with_auto_populated_field(): client.get_queued_resource(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_tpu.GetQueuedResourceRequest( + request_msg = cloud_tpu.GetQueuedResourceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_queued_resource_use_cached_wrapped_rpc(): @@ -4295,9 +4322,14 @@ async def test_get_queued_resource_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_queued_resource_async( - transport: str = "grpc_asyncio", request_type=cloud_tpu.GetQueuedResourceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_tpu.GetQueuedResourceRequest(), + {}, + ], +) +async def test_get_queued_resource_async(request_type, transport: str = "grpc_asyncio"): client = TpuAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4305,7 +4337,7 @@ async def test_get_queued_resource_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( @@ -4332,11 +4364,6 @@ async def test_get_queued_resource_async( assert response.reservation_name == "reservation_name_value" -@pytest.mark.asyncio -async def test_get_queued_resource_async_from_dict(): - await test_get_queued_resource_async(request_type=dict) - - def test_get_queued_resource_field_headers(): client = TpuClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4491,8 +4518,8 @@ async def test_get_queued_resource_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_tpu.CreateQueuedResourceRequest, - dict, + cloud_tpu.CreateQueuedResourceRequest(), + {}, ], ) def test_create_queued_resource(request_type, transport: str = "grpc"): @@ -4503,7 +4530,7 @@ def test_create_queued_resource(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4550,11 +4577,12 @@ def test_create_queued_resource_non_empty_request_with_auto_populated_field(): client.create_queued_resource(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_tpu.CreateQueuedResourceRequest( + request_msg = cloud_tpu.CreateQueuedResourceRequest( parent="parent_value", queued_resource_id="queued_resource_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_queued_resource_use_cached_wrapped_rpc(): @@ -4650,8 +4678,15 @@ async def test_create_queued_resource_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloud_tpu.CreateQueuedResourceRequest(), + {}, + ], +) async def test_create_queued_resource_async( - transport: str = "grpc_asyncio", request_type=cloud_tpu.CreateQueuedResourceRequest + request_type, transport: str = "grpc_asyncio" ): client = TpuAsyncClient( credentials=async_anonymous_credentials(), @@ -4660,7 +4695,7 @@ async def test_create_queued_resource_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( @@ -4682,11 +4717,6 @@ async def test_create_queued_resource_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_queued_resource_async_from_dict(): - await test_create_queued_resource_async(request_type=dict) - - def test_create_queued_resource_field_headers(): client = TpuClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4861,8 +4891,8 @@ async def test_create_queued_resource_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_tpu.DeleteQueuedResourceRequest, - dict, + cloud_tpu.DeleteQueuedResourceRequest(), + {}, ], ) def test_delete_queued_resource(request_type, transport: str = "grpc"): @@ -4873,7 +4903,7 @@ def test_delete_queued_resource(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4919,10 +4949,11 @@ def test_delete_queued_resource_non_empty_request_with_auto_populated_field(): client.delete_queued_resource(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_tpu.DeleteQueuedResourceRequest( + request_msg = cloud_tpu.DeleteQueuedResourceRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_queued_resource_use_cached_wrapped_rpc(): @@ -5018,8 +5049,15 @@ async def test_delete_queued_resource_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloud_tpu.DeleteQueuedResourceRequest(), + {}, + ], +) async def test_delete_queued_resource_async( - transport: str = "grpc_asyncio", request_type=cloud_tpu.DeleteQueuedResourceRequest + request_type, transport: str = "grpc_asyncio" ): client = TpuAsyncClient( credentials=async_anonymous_credentials(), @@ -5028,7 +5066,7 @@ async def test_delete_queued_resource_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( @@ -5050,11 +5088,6 @@ async def test_delete_queued_resource_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_queued_resource_async_from_dict(): - await test_delete_queued_resource_async(request_type=dict) - - def test_delete_queued_resource_field_headers(): client = TpuClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5209,8 +5242,8 @@ async def test_delete_queued_resource_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_tpu.ResetQueuedResourceRequest, - dict, + cloud_tpu.ResetQueuedResourceRequest(), + {}, ], ) def test_reset_queued_resource(request_type, transport: str = "grpc"): @@ -5221,7 +5254,7 @@ def test_reset_queued_resource(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5266,9 +5299,10 @@ def test_reset_queued_resource_non_empty_request_with_auto_populated_field(): client.reset_queued_resource(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_tpu.ResetQueuedResourceRequest( + request_msg = cloud_tpu.ResetQueuedResourceRequest( name="name_value", ) + assert args[0] == request_msg def test_reset_queued_resource_use_cached_wrapped_rpc(): @@ -5364,8 +5398,15 @@ async def test_reset_queued_resource_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloud_tpu.ResetQueuedResourceRequest(), + {}, + ], +) async def test_reset_queued_resource_async( - transport: str = "grpc_asyncio", request_type=cloud_tpu.ResetQueuedResourceRequest + request_type, transport: str = "grpc_asyncio" ): client = TpuAsyncClient( credentials=async_anonymous_credentials(), @@ -5374,7 +5415,7 @@ async def test_reset_queued_resource_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( @@ -5396,11 +5437,6 @@ async def test_reset_queued_resource_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_reset_queued_resource_async_from_dict(): - await test_reset_queued_resource_async(request_type=dict) - - def test_reset_queued_resource_field_headers(): client = TpuClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5555,8 +5591,8 @@ async def test_reset_queued_resource_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_tpu.GenerateServiceIdentityRequest, - dict, + cloud_tpu.GenerateServiceIdentityRequest(), + {}, ], ) def test_generate_service_identity(request_type, transport: str = "grpc"): @@ -5567,7 +5603,7 @@ def test_generate_service_identity(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,9 +5648,10 @@ def test_generate_service_identity_non_empty_request_with_auto_populated_field() client.generate_service_identity(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_tpu.GenerateServiceIdentityRequest( + request_msg = cloud_tpu.GenerateServiceIdentityRequest( parent="parent_value", ) + assert args[0] == request_msg def test_generate_service_identity_use_cached_wrapped_rpc(): @@ -5700,9 +5737,15 @@ async def test_generate_service_identity_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloud_tpu.GenerateServiceIdentityRequest(), + {}, + ], +) async def test_generate_service_identity_async( - transport: str = "grpc_asyncio", - request_type=cloud_tpu.GenerateServiceIdentityRequest, + request_type, transport: str = "grpc_asyncio" ): client = TpuAsyncClient( credentials=async_anonymous_credentials(), @@ -5711,7 +5754,7 @@ async def test_generate_service_identity_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( @@ -5733,11 +5776,6 @@ async def test_generate_service_identity_async( assert isinstance(response, cloud_tpu.GenerateServiceIdentityResponse) -@pytest.mark.asyncio -async def test_generate_service_identity_async_from_dict(): - await test_generate_service_identity_async(request_type=dict) - - def test_generate_service_identity_field_headers(): client = TpuClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5806,8 +5844,8 @@ async def test_generate_service_identity_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - cloud_tpu.ListAcceleratorTypesRequest, - dict, + cloud_tpu.ListAcceleratorTypesRequest(), + {}, ], ) def test_list_accelerator_types(request_type, transport: str = "grpc"): @@ -5818,7 +5856,7 @@ def test_list_accelerator_types(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5871,12 +5909,13 @@ def test_list_accelerator_types_non_empty_request_with_auto_populated_field(): client.list_accelerator_types(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_tpu.ListAcceleratorTypesRequest( + request_msg = cloud_tpu.ListAcceleratorTypesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_accelerator_types_use_cached_wrapped_rpc(): @@ -5962,8 +6001,15 @@ async def test_list_accelerator_types_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloud_tpu.ListAcceleratorTypesRequest(), + {}, + ], +) async def test_list_accelerator_types_async( - transport: str = "grpc_asyncio", request_type=cloud_tpu.ListAcceleratorTypesRequest + request_type, transport: str = "grpc_asyncio" ): client = TpuAsyncClient( credentials=async_anonymous_credentials(), @@ -5972,7 +6018,7 @@ async def test_list_accelerator_types_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( @@ -5999,11 +6045,6 @@ async def test_list_accelerator_types_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_accelerator_types_async_from_dict(): - await test_list_accelerator_types_async(request_type=dict) - - def test_list_accelerator_types_field_headers(): client = TpuClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6356,8 +6397,8 @@ async def test_list_accelerator_types_async_pages(): @pytest.mark.parametrize( "request_type", [ - cloud_tpu.GetAcceleratorTypeRequest, - dict, + cloud_tpu.GetAcceleratorTypeRequest(), + {}, ], ) def test_get_accelerator_type(request_type, transport: str = "grpc"): @@ -6368,7 +6409,7 @@ def test_get_accelerator_type(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6418,9 +6459,10 @@ def test_get_accelerator_type_non_empty_request_with_auto_populated_field(): client.get_accelerator_type(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_tpu.GetAcceleratorTypeRequest( + request_msg = cloud_tpu.GetAcceleratorTypeRequest( name="name_value", ) + assert args[0] == request_msg def test_get_accelerator_type_use_cached_wrapped_rpc(): @@ -6505,8 +6547,15 @@ async def test_get_accelerator_type_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloud_tpu.GetAcceleratorTypeRequest(), + {}, + ], +) async def test_get_accelerator_type_async( - transport: str = "grpc_asyncio", request_type=cloud_tpu.GetAcceleratorTypeRequest + request_type, transport: str = "grpc_asyncio" ): client = TpuAsyncClient( credentials=async_anonymous_credentials(), @@ -6515,7 +6564,7 @@ async def test_get_accelerator_type_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( @@ -6542,11 +6591,6 @@ async def test_get_accelerator_type_async( assert response.type_ == "type__value" -@pytest.mark.asyncio -async def test_get_accelerator_type_async_from_dict(): - await test_get_accelerator_type_async(request_type=dict) - - def test_get_accelerator_type_field_headers(): client = TpuClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6701,8 +6745,8 @@ async def test_get_accelerator_type_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_tpu.ListRuntimeVersionsRequest, - dict, + cloud_tpu.ListRuntimeVersionsRequest(), + {}, ], ) def test_list_runtime_versions(request_type, transport: str = "grpc"): @@ -6713,7 +6757,7 @@ def test_list_runtime_versions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6766,12 +6810,13 @@ def test_list_runtime_versions_non_empty_request_with_auto_populated_field(): client.list_runtime_versions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_tpu.ListRuntimeVersionsRequest( + request_msg = cloud_tpu.ListRuntimeVersionsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_runtime_versions_use_cached_wrapped_rpc(): @@ -6857,8 +6902,15 @@ async def test_list_runtime_versions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloud_tpu.ListRuntimeVersionsRequest(), + {}, + ], +) async def test_list_runtime_versions_async( - transport: str = "grpc_asyncio", request_type=cloud_tpu.ListRuntimeVersionsRequest + request_type, transport: str = "grpc_asyncio" ): client = TpuAsyncClient( credentials=async_anonymous_credentials(), @@ -6867,7 +6919,7 @@ async def test_list_runtime_versions_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( @@ -6894,11 +6946,6 @@ async def test_list_runtime_versions_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_runtime_versions_async_from_dict(): - await test_list_runtime_versions_async(request_type=dict) - - def test_list_runtime_versions_field_headers(): client = TpuClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7251,8 +7298,8 @@ async def test_list_runtime_versions_async_pages(): @pytest.mark.parametrize( "request_type", [ - cloud_tpu.GetRuntimeVersionRequest, - dict, + cloud_tpu.GetRuntimeVersionRequest(), + {}, ], ) def test_get_runtime_version(request_type, transport: str = "grpc"): @@ -7263,7 +7310,7 @@ def test_get_runtime_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7313,9 +7360,10 @@ def test_get_runtime_version_non_empty_request_with_auto_populated_field(): client.get_runtime_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_tpu.GetRuntimeVersionRequest( + request_msg = cloud_tpu.GetRuntimeVersionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_runtime_version_use_cached_wrapped_rpc(): @@ -7400,9 +7448,14 @@ async def test_get_runtime_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_runtime_version_async( - transport: str = "grpc_asyncio", request_type=cloud_tpu.GetRuntimeVersionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_tpu.GetRuntimeVersionRequest(), + {}, + ], +) +async def test_get_runtime_version_async(request_type, transport: str = "grpc_asyncio"): client = TpuAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7410,7 +7463,7 @@ async def test_get_runtime_version_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( @@ -7437,11 +7490,6 @@ async def test_get_runtime_version_async( assert response.version == "version_value" -@pytest.mark.asyncio -async def test_get_runtime_version_async_from_dict(): - await test_get_runtime_version_async(request_type=dict) - - def test_get_runtime_version_field_headers(): client = TpuClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7596,8 +7644,8 @@ async def test_get_runtime_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_tpu.GetGuestAttributesRequest, - dict, + cloud_tpu.GetGuestAttributesRequest(), + {}, ], ) def test_get_guest_attributes(request_type, transport: str = "grpc"): @@ -7608,7 +7656,7 @@ def test_get_guest_attributes(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7654,10 +7702,11 @@ def test_get_guest_attributes_non_empty_request_with_auto_populated_field(): client.get_guest_attributes(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_tpu.GetGuestAttributesRequest( + request_msg = cloud_tpu.GetGuestAttributesRequest( name="name_value", query_path="query_path_value", ) + assert args[0] == request_msg def test_get_guest_attributes_use_cached_wrapped_rpc(): @@ -7742,8 +7791,15 @@ async def test_get_guest_attributes_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloud_tpu.GetGuestAttributesRequest(), + {}, + ], +) async def test_get_guest_attributes_async( - transport: str = "grpc_asyncio", request_type=cloud_tpu.GetGuestAttributesRequest + request_type, transport: str = "grpc_asyncio" ): client = TpuAsyncClient( credentials=async_anonymous_credentials(), @@ -7752,7 +7808,7 @@ async def test_get_guest_attributes_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( @@ -7774,11 +7830,6 @@ async def test_get_guest_attributes_async( assert isinstance(response, cloud_tpu.GetGuestAttributesResponse) -@pytest.mark.asyncio -async def test_get_guest_attributes_async_from_dict(): - await test_get_guest_attributes_async(request_type=dict) - - def test_get_guest_attributes_field_headers(): client = TpuClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11365,7 +11416,6 @@ def test_list_nodes_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.ListNodesRequest() - assert args[0] == request_msg @@ -11386,7 +11436,6 @@ def test_get_node_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.GetNodeRequest() - assert args[0] == request_msg @@ -11407,7 +11456,6 @@ def test_create_node_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.CreateNodeRequest() - assert args[0] == request_msg @@ -11428,7 +11476,6 @@ def test_delete_node_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.DeleteNodeRequest() - assert args[0] == request_msg @@ -11449,7 +11496,6 @@ def test_stop_node_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.StopNodeRequest() - assert args[0] == request_msg @@ -11470,7 +11516,6 @@ def test_start_node_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.StartNodeRequest() - assert args[0] == request_msg @@ -11491,7 +11536,6 @@ def test_update_node_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.UpdateNodeRequest() - assert args[0] == request_msg @@ -11514,7 +11558,6 @@ def test_list_queued_resources_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.ListQueuedResourcesRequest() - assert args[0] == request_msg @@ -11537,7 +11580,6 @@ def test_get_queued_resource_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.GetQueuedResourceRequest() - assert args[0] == request_msg @@ -11560,7 +11602,6 @@ def test_create_queued_resource_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.CreateQueuedResourceRequest() - assert args[0] == request_msg @@ -11583,7 +11624,6 @@ def test_delete_queued_resource_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.DeleteQueuedResourceRequest() - assert args[0] == request_msg @@ -11606,7 +11646,6 @@ def test_reset_queued_resource_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.ResetQueuedResourceRequest() - assert args[0] == request_msg @@ -11629,7 +11668,6 @@ def test_generate_service_identity_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.GenerateServiceIdentityRequest() - assert args[0] == request_msg @@ -11652,7 +11690,6 @@ def test_list_accelerator_types_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.ListAcceleratorTypesRequest() - assert args[0] == request_msg @@ -11675,7 +11712,6 @@ def test_get_accelerator_type_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.GetAcceleratorTypeRequest() - assert args[0] == request_msg @@ -11698,7 +11734,6 @@ def test_list_runtime_versions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.ListRuntimeVersionsRequest() - assert args[0] == request_msg @@ -11721,7 +11756,6 @@ def test_get_runtime_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.GetRuntimeVersionRequest() - assert args[0] == request_msg @@ -11744,7 +11778,6 @@ def test_get_guest_attributes_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.GetGuestAttributesRequest() - assert args[0] == request_msg @@ -11786,7 +11819,6 @@ async def test_list_nodes_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.ListNodesRequest() - assert args[0] == request_msg @@ -11825,7 +11857,6 @@ async def test_get_node_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.GetNodeRequest() - assert args[0] == request_msg @@ -11850,7 +11881,6 @@ async def test_create_node_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.CreateNodeRequest() - assert args[0] == request_msg @@ -11875,7 +11905,6 @@ async def test_delete_node_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.DeleteNodeRequest() - assert args[0] == request_msg @@ -11900,7 +11929,6 @@ async def test_stop_node_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.StopNodeRequest() - assert args[0] == request_msg @@ -11925,7 +11953,6 @@ async def test_start_node_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.StartNodeRequest() - assert args[0] == request_msg @@ -11950,7 +11977,6 @@ async def test_update_node_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.UpdateNodeRequest() - assert args[0] == request_msg @@ -11980,7 +12006,6 @@ async def test_list_queued_resources_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.ListQueuedResourcesRequest() - assert args[0] == request_msg @@ -12010,7 +12035,6 @@ async def test_get_queued_resource_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.GetQueuedResourceRequest() - assert args[0] == request_msg @@ -12037,7 +12061,6 @@ async def test_create_queued_resource_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.CreateQueuedResourceRequest() - assert args[0] == request_msg @@ -12064,7 +12087,6 @@ async def test_delete_queued_resource_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.DeleteQueuedResourceRequest() - assert args[0] == request_msg @@ -12091,7 +12113,6 @@ async def test_reset_queued_resource_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.ResetQueuedResourceRequest() - assert args[0] == request_msg @@ -12118,7 +12139,6 @@ async def test_generate_service_identity_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.GenerateServiceIdentityRequest() - assert args[0] == request_msg @@ -12148,7 +12168,6 @@ async def test_list_accelerator_types_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.ListAcceleratorTypesRequest() - assert args[0] == request_msg @@ -12178,7 +12197,6 @@ async def test_get_accelerator_type_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.GetAcceleratorTypeRequest() - assert args[0] == request_msg @@ -12208,7 +12226,6 @@ async def test_list_runtime_versions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.ListRuntimeVersionsRequest() - assert args[0] == request_msg @@ -12238,7 +12255,6 @@ async def test_get_runtime_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.GetRuntimeVersionRequest() - assert args[0] == request_msg @@ -12265,7 +12281,6 @@ async def test_get_guest_attributes_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.GetGuestAttributesRequest() - assert args[0] == request_msg @@ -15369,7 +15384,6 @@ def test_list_nodes_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.ListNodesRequest() - assert args[0] == request_msg @@ -15389,7 +15403,6 @@ def test_get_node_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.GetNodeRequest() - assert args[0] == request_msg @@ -15409,7 +15422,6 @@ def test_create_node_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.CreateNodeRequest() - assert args[0] == request_msg @@ -15429,7 +15441,6 @@ def test_delete_node_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.DeleteNodeRequest() - assert args[0] == request_msg @@ -15449,7 +15460,6 @@ def test_stop_node_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.StopNodeRequest() - assert args[0] == request_msg @@ -15469,7 +15479,6 @@ def test_start_node_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.StartNodeRequest() - assert args[0] == request_msg @@ -15489,7 +15498,6 @@ def test_update_node_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.UpdateNodeRequest() - assert args[0] == request_msg @@ -15511,7 +15519,6 @@ def test_list_queued_resources_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.ListQueuedResourcesRequest() - assert args[0] == request_msg @@ -15533,7 +15540,6 @@ def test_get_queued_resource_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.GetQueuedResourceRequest() - assert args[0] == request_msg @@ -15555,7 +15561,6 @@ def test_create_queued_resource_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.CreateQueuedResourceRequest() - assert args[0] == request_msg @@ -15577,7 +15582,6 @@ def test_delete_queued_resource_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.DeleteQueuedResourceRequest() - assert args[0] == request_msg @@ -15599,7 +15603,6 @@ def test_reset_queued_resource_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.ResetQueuedResourceRequest() - assert args[0] == request_msg @@ -15621,7 +15624,6 @@ def test_generate_service_identity_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.GenerateServiceIdentityRequest() - assert args[0] == request_msg @@ -15643,7 +15645,6 @@ def test_list_accelerator_types_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.ListAcceleratorTypesRequest() - assert args[0] == request_msg @@ -15665,7 +15666,6 @@ def test_get_accelerator_type_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.GetAcceleratorTypeRequest() - assert args[0] == request_msg @@ -15687,7 +15687,6 @@ def test_list_runtime_versions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.ListRuntimeVersionsRequest() - assert args[0] == request_msg @@ -15709,7 +15708,6 @@ def test_get_runtime_version_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.GetRuntimeVersionRequest() - assert args[0] == request_msg @@ -15731,7 +15729,6 @@ def test_get_guest_attributes_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.GetGuestAttributesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-tpu/tests/unit/gapic/tpu_v2alpha1/test_tpu.py b/packages/google-cloud-tpu/tests/unit/gapic/tpu_v2alpha1/test_tpu.py index 48b3aa20d2b7..1c9922d89609 100644 --- a/packages/google-cloud-tpu/tests/unit/gapic/tpu_v2alpha1/test_tpu.py +++ b/packages/google-cloud-tpu/tests/unit/gapic/tpu_v2alpha1/test_tpu.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 @@ -117,6 +118,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" @@ -1203,8 +1219,8 @@ def test_tpu_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - cloud_tpu.ListNodesRequest, - dict, + cloud_tpu.ListNodesRequest(), + {}, ], ) def test_list_nodes(request_type, transport: str = "grpc"): @@ -1215,7 +1231,7 @@ def test_list_nodes(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_nodes), "__call__") as call: @@ -1262,10 +1278,11 @@ def test_list_nodes_non_empty_request_with_auto_populated_field(): client.list_nodes(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_tpu.ListNodesRequest( + request_msg = cloud_tpu.ListNodesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_nodes_use_cached_wrapped_rpc(): @@ -1344,9 +1361,14 @@ async def test_list_nodes_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_list_nodes_async( - transport: str = "grpc_asyncio", request_type=cloud_tpu.ListNodesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_tpu.ListNodesRequest(), + {}, + ], +) +async def test_list_nodes_async(request_type, transport: str = "grpc_asyncio"): client = TpuAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1354,7 +1376,7 @@ async def test_list_nodes_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_nodes), "__call__") as call: @@ -1379,11 +1401,6 @@ async def test_list_nodes_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_nodes_async_from_dict(): - await test_list_nodes_async(request_type=dict) - - def test_list_nodes_field_headers(): client = TpuClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1720,8 +1737,8 @@ async def test_list_nodes_async_pages(): @pytest.mark.parametrize( "request_type", [ - cloud_tpu.GetNodeRequest, - dict, + cloud_tpu.GetNodeRequest(), + {}, ], ) def test_get_node(request_type, transport: str = "grpc"): @@ -1732,7 +1749,7 @@ def test_get_node(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_node), "__call__") as call: @@ -1802,9 +1819,10 @@ def test_get_node_non_empty_request_with_auto_populated_field(): client.get_node(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_tpu.GetNodeRequest( + request_msg = cloud_tpu.GetNodeRequest( name="name_value", ) + assert args[0] == request_msg def test_get_node_use_cached_wrapped_rpc(): @@ -1883,9 +1901,14 @@ async def test_get_node_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn @pytest.mark.asyncio -async def test_get_node_async( - transport: str = "grpc_asyncio", request_type=cloud_tpu.GetNodeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_tpu.GetNodeRequest(), + {}, + ], +) +async def test_get_node_async(request_type, transport: str = "grpc_asyncio"): client = TpuAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1893,7 +1916,7 @@ async def test_get_node_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_node), "__call__") as call: @@ -1942,11 +1965,6 @@ async def test_get_node_async( assert response.autocheckpoint_enabled is True -@pytest.mark.asyncio -async def test_get_node_async_from_dict(): - await test_get_node_async(request_type=dict) - - def test_get_node_field_headers(): client = TpuClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2089,8 +2107,8 @@ async def test_get_node_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_tpu.CreateNodeRequest, - dict, + cloud_tpu.CreateNodeRequest(), + {}, ], ) def test_create_node(request_type, transport: str = "grpc"): @@ -2101,7 +2119,7 @@ def test_create_node(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_node), "__call__") as call: @@ -2144,11 +2162,12 @@ def test_create_node_non_empty_request_with_auto_populated_field(): client.create_node(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_tpu.CreateNodeRequest( + request_msg = cloud_tpu.CreateNodeRequest( parent="parent_value", node_id="node_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_node_use_cached_wrapped_rpc(): @@ -2239,9 +2258,14 @@ async def test_create_node_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_node_async( - transport: str = "grpc_asyncio", request_type=cloud_tpu.CreateNodeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_tpu.CreateNodeRequest(), + {}, + ], +) +async def test_create_node_async(request_type, transport: str = "grpc_asyncio"): client = TpuAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2249,7 +2273,7 @@ async def test_create_node_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_node), "__call__") as call: @@ -2269,11 +2293,6 @@ async def test_create_node_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_node_async_from_dict(): - await test_create_node_async(request_type=dict) - - def test_create_node_field_headers(): client = TpuClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2440,8 +2459,8 @@ async def test_create_node_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_tpu.DeleteNodeRequest, - dict, + cloud_tpu.DeleteNodeRequest(), + {}, ], ) def test_delete_node(request_type, transport: str = "grpc"): @@ -2452,7 +2471,7 @@ def test_delete_node(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_node), "__call__") as call: @@ -2494,10 +2513,11 @@ def test_delete_node_non_empty_request_with_auto_populated_field(): client.delete_node(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_tpu.DeleteNodeRequest( + request_msg = cloud_tpu.DeleteNodeRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_node_use_cached_wrapped_rpc(): @@ -2588,9 +2608,14 @@ async def test_delete_node_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_node_async( - transport: str = "grpc_asyncio", request_type=cloud_tpu.DeleteNodeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_tpu.DeleteNodeRequest(), + {}, + ], +) +async def test_delete_node_async(request_type, transport: str = "grpc_asyncio"): client = TpuAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2598,7 +2623,7 @@ async def test_delete_node_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_node), "__call__") as call: @@ -2618,11 +2643,6 @@ async def test_delete_node_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_node_async_from_dict(): - await test_delete_node_async(request_type=dict) - - def test_delete_node_field_headers(): client = TpuClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2769,8 +2789,8 @@ async def test_delete_node_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_tpu.StopNodeRequest, - dict, + cloud_tpu.StopNodeRequest(), + {}, ], ) def test_stop_node(request_type, transport: str = "grpc"): @@ -2781,7 +2801,7 @@ def test_stop_node(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.stop_node), "__call__") as call: @@ -2822,9 +2842,10 @@ def test_stop_node_non_empty_request_with_auto_populated_field(): client.stop_node(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_tpu.StopNodeRequest( + request_msg = cloud_tpu.StopNodeRequest( name="name_value", ) + assert args[0] == request_msg def test_stop_node_use_cached_wrapped_rpc(): @@ -2913,9 +2934,14 @@ async def test_stop_node_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_stop_node_async( - transport: str = "grpc_asyncio", request_type=cloud_tpu.StopNodeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_tpu.StopNodeRequest(), + {}, + ], +) +async def test_stop_node_async(request_type, transport: str = "grpc_asyncio"): client = TpuAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2923,7 +2949,7 @@ async def test_stop_node_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.stop_node), "__call__") as call: @@ -2943,11 +2969,6 @@ async def test_stop_node_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_stop_node_async_from_dict(): - await test_stop_node_async(request_type=dict) - - def test_stop_node_field_headers(): client = TpuClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3012,8 +3033,8 @@ async def test_stop_node_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - cloud_tpu.StartNodeRequest, - dict, + cloud_tpu.StartNodeRequest(), + {}, ], ) def test_start_node(request_type, transport: str = "grpc"): @@ -3024,7 +3045,7 @@ def test_start_node(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.start_node), "__call__") as call: @@ -3065,9 +3086,10 @@ def test_start_node_non_empty_request_with_auto_populated_field(): client.start_node(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_tpu.StartNodeRequest( + request_msg = cloud_tpu.StartNodeRequest( name="name_value", ) + assert args[0] == request_msg def test_start_node_use_cached_wrapped_rpc(): @@ -3156,9 +3178,14 @@ async def test_start_node_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_start_node_async( - transport: str = "grpc_asyncio", request_type=cloud_tpu.StartNodeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_tpu.StartNodeRequest(), + {}, + ], +) +async def test_start_node_async(request_type, transport: str = "grpc_asyncio"): client = TpuAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3166,7 +3193,7 @@ async def test_start_node_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.start_node), "__call__") as call: @@ -3186,11 +3213,6 @@ async def test_start_node_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_start_node_async_from_dict(): - await test_start_node_async(request_type=dict) - - def test_start_node_field_headers(): client = TpuClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3255,8 +3277,8 @@ async def test_start_node_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - cloud_tpu.UpdateNodeRequest, - dict, + cloud_tpu.UpdateNodeRequest(), + {}, ], ) def test_update_node(request_type, transport: str = "grpc"): @@ -3267,7 +3289,7 @@ def test_update_node(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_node), "__call__") as call: @@ -3306,7 +3328,8 @@ def test_update_node_non_empty_request_with_auto_populated_field(): client.update_node(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_tpu.UpdateNodeRequest() + request_msg = cloud_tpu.UpdateNodeRequest() + assert args[0] == request_msg def test_update_node_use_cached_wrapped_rpc(): @@ -3397,9 +3420,14 @@ async def test_update_node_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_node_async( - transport: str = "grpc_asyncio", request_type=cloud_tpu.UpdateNodeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_tpu.UpdateNodeRequest(), + {}, + ], +) +async def test_update_node_async(request_type, transport: str = "grpc_asyncio"): client = TpuAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3407,7 +3435,7 @@ async def test_update_node_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_node), "__call__") as call: @@ -3427,11 +3455,6 @@ async def test_update_node_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_node_async_from_dict(): - await test_update_node_async(request_type=dict) - - def test_update_node_field_headers(): client = TpuClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3588,8 +3611,8 @@ async def test_update_node_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_tpu.PerformMaintenanceRequest, - dict, + cloud_tpu.PerformMaintenanceRequest(), + {}, ], ) def test_perform_maintenance(request_type, transport: str = "grpc"): @@ -3600,7 +3623,7 @@ def test_perform_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( @@ -3645,9 +3668,10 @@ def test_perform_maintenance_non_empty_request_with_auto_populated_field(): client.perform_maintenance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_tpu.PerformMaintenanceRequest( + request_msg = cloud_tpu.PerformMaintenanceRequest( name="name_value", ) + assert args[0] == request_msg def test_perform_maintenance_use_cached_wrapped_rpc(): @@ -3742,9 +3766,14 @@ async def test_perform_maintenance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_perform_maintenance_async( - transport: str = "grpc_asyncio", request_type=cloud_tpu.PerformMaintenanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_tpu.PerformMaintenanceRequest(), + {}, + ], +) +async def test_perform_maintenance_async(request_type, transport: str = "grpc_asyncio"): client = TpuAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3752,7 +3781,7 @@ async def test_perform_maintenance_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( @@ -3774,11 +3803,6 @@ async def test_perform_maintenance_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_perform_maintenance_async_from_dict(): - await test_perform_maintenance_async(request_type=dict) - - def test_perform_maintenance_field_headers(): client = TpuClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3847,8 +3871,8 @@ async def test_perform_maintenance_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - cloud_tpu.ListQueuedResourcesRequest, - dict, + cloud_tpu.ListQueuedResourcesRequest(), + {}, ], ) def test_list_queued_resources(request_type, transport: str = "grpc"): @@ -3859,7 +3883,7 @@ def test_list_queued_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( @@ -3910,10 +3934,11 @@ def test_list_queued_resources_non_empty_request_with_auto_populated_field(): client.list_queued_resources(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_tpu.ListQueuedResourcesRequest( + request_msg = cloud_tpu.ListQueuedResourcesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_queued_resources_use_cached_wrapped_rpc(): @@ -3999,8 +4024,15 @@ async def test_list_queued_resources_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloud_tpu.ListQueuedResourcesRequest(), + {}, + ], +) async def test_list_queued_resources_async( - transport: str = "grpc_asyncio", request_type=cloud_tpu.ListQueuedResourcesRequest + request_type, transport: str = "grpc_asyncio" ): client = TpuAsyncClient( credentials=async_anonymous_credentials(), @@ -4009,7 +4041,7 @@ async def test_list_queued_resources_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( @@ -4036,11 +4068,6 @@ async def test_list_queued_resources_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_queued_resources_async_from_dict(): - await test_list_queued_resources_async(request_type=dict) - - def test_list_queued_resources_field_headers(): client = TpuClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4393,8 +4420,8 @@ async def test_list_queued_resources_async_pages(): @pytest.mark.parametrize( "request_type", [ - cloud_tpu.GetQueuedResourceRequest, - dict, + cloud_tpu.GetQueuedResourceRequest(), + {}, ], ) def test_get_queued_resource(request_type, transport: str = "grpc"): @@ -4405,7 +4432,7 @@ def test_get_queued_resource(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4455,9 +4482,10 @@ def test_get_queued_resource_non_empty_request_with_auto_populated_field(): client.get_queued_resource(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_tpu.GetQueuedResourceRequest( + request_msg = cloud_tpu.GetQueuedResourceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_queued_resource_use_cached_wrapped_rpc(): @@ -4542,9 +4570,14 @@ async def test_get_queued_resource_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_queued_resource_async( - transport: str = "grpc_asyncio", request_type=cloud_tpu.GetQueuedResourceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_tpu.GetQueuedResourceRequest(), + {}, + ], +) +async def test_get_queued_resource_async(request_type, transport: str = "grpc_asyncio"): client = TpuAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4552,7 +4585,7 @@ async def test_get_queued_resource_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( @@ -4579,11 +4612,6 @@ async def test_get_queued_resource_async( assert response.reservation_name == "reservation_name_value" -@pytest.mark.asyncio -async def test_get_queued_resource_async_from_dict(): - await test_get_queued_resource_async(request_type=dict) - - def test_get_queued_resource_field_headers(): client = TpuClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4738,8 +4766,8 @@ async def test_get_queued_resource_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_tpu.CreateQueuedResourceRequest, - dict, + cloud_tpu.CreateQueuedResourceRequest(), + {}, ], ) def test_create_queued_resource(request_type, transport: str = "grpc"): @@ -4750,7 +4778,7 @@ def test_create_queued_resource(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4797,11 +4825,12 @@ def test_create_queued_resource_non_empty_request_with_auto_populated_field(): client.create_queued_resource(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_tpu.CreateQueuedResourceRequest( + request_msg = cloud_tpu.CreateQueuedResourceRequest( parent="parent_value", queued_resource_id="queued_resource_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_queued_resource_use_cached_wrapped_rpc(): @@ -4897,8 +4926,15 @@ async def test_create_queued_resource_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloud_tpu.CreateQueuedResourceRequest(), + {}, + ], +) async def test_create_queued_resource_async( - transport: str = "grpc_asyncio", request_type=cloud_tpu.CreateQueuedResourceRequest + request_type, transport: str = "grpc_asyncio" ): client = TpuAsyncClient( credentials=async_anonymous_credentials(), @@ -4907,7 +4943,7 @@ async def test_create_queued_resource_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( @@ -4929,11 +4965,6 @@ async def test_create_queued_resource_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_queued_resource_async_from_dict(): - await test_create_queued_resource_async(request_type=dict) - - def test_create_queued_resource_field_headers(): client = TpuClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5108,8 +5139,8 @@ async def test_create_queued_resource_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_tpu.DeleteQueuedResourceRequest, - dict, + cloud_tpu.DeleteQueuedResourceRequest(), + {}, ], ) def test_delete_queued_resource(request_type, transport: str = "grpc"): @@ -5120,7 +5151,7 @@ def test_delete_queued_resource(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5166,10 +5197,11 @@ def test_delete_queued_resource_non_empty_request_with_auto_populated_field(): client.delete_queued_resource(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_tpu.DeleteQueuedResourceRequest( + request_msg = cloud_tpu.DeleteQueuedResourceRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_queued_resource_use_cached_wrapped_rpc(): @@ -5265,8 +5297,15 @@ async def test_delete_queued_resource_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloud_tpu.DeleteQueuedResourceRequest(), + {}, + ], +) async def test_delete_queued_resource_async( - transport: str = "grpc_asyncio", request_type=cloud_tpu.DeleteQueuedResourceRequest + request_type, transport: str = "grpc_asyncio" ): client = TpuAsyncClient( credentials=async_anonymous_credentials(), @@ -5275,7 +5314,7 @@ async def test_delete_queued_resource_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( @@ -5297,11 +5336,6 @@ async def test_delete_queued_resource_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_queued_resource_async_from_dict(): - await test_delete_queued_resource_async(request_type=dict) - - def test_delete_queued_resource_field_headers(): client = TpuClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5456,8 +5490,8 @@ async def test_delete_queued_resource_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_tpu.ResetQueuedResourceRequest, - dict, + cloud_tpu.ResetQueuedResourceRequest(), + {}, ], ) def test_reset_queued_resource(request_type, transport: str = "grpc"): @@ -5468,7 +5502,7 @@ def test_reset_queued_resource(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5513,9 +5547,10 @@ def test_reset_queued_resource_non_empty_request_with_auto_populated_field(): client.reset_queued_resource(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_tpu.ResetQueuedResourceRequest( + request_msg = cloud_tpu.ResetQueuedResourceRequest( name="name_value", ) + assert args[0] == request_msg def test_reset_queued_resource_use_cached_wrapped_rpc(): @@ -5611,8 +5646,15 @@ async def test_reset_queued_resource_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloud_tpu.ResetQueuedResourceRequest(), + {}, + ], +) async def test_reset_queued_resource_async( - transport: str = "grpc_asyncio", request_type=cloud_tpu.ResetQueuedResourceRequest + request_type, transport: str = "grpc_asyncio" ): client = TpuAsyncClient( credentials=async_anonymous_credentials(), @@ -5621,7 +5663,7 @@ async def test_reset_queued_resource_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( @@ -5643,11 +5685,6 @@ async def test_reset_queued_resource_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_reset_queued_resource_async_from_dict(): - await test_reset_queued_resource_async(request_type=dict) - - def test_reset_queued_resource_field_headers(): client = TpuClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5802,8 +5839,8 @@ async def test_reset_queued_resource_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_tpu.PerformMaintenanceQueuedResourceRequest, - dict, + cloud_tpu.PerformMaintenanceQueuedResourceRequest(), + {}, ], ) def test_perform_maintenance_queued_resource(request_type, transport: str = "grpc"): @@ -5814,7 +5851,7 @@ def test_perform_maintenance_queued_resource(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( @@ -5859,9 +5896,10 @@ def test_perform_maintenance_queued_resource_non_empty_request_with_auto_populat client.perform_maintenance_queued_resource(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_tpu.PerformMaintenanceQueuedResourceRequest( + request_msg = cloud_tpu.PerformMaintenanceQueuedResourceRequest( name="name_value", ) + assert args[0] == request_msg def test_perform_maintenance_queued_resource_use_cached_wrapped_rpc(): @@ -5957,9 +5995,15 @@ async def test_perform_maintenance_queued_resource_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloud_tpu.PerformMaintenanceQueuedResourceRequest(), + {}, + ], +) async def test_perform_maintenance_queued_resource_async( - transport: str = "grpc_asyncio", - request_type=cloud_tpu.PerformMaintenanceQueuedResourceRequest, + request_type, transport: str = "grpc_asyncio" ): client = TpuAsyncClient( credentials=async_anonymous_credentials(), @@ -5968,7 +6012,7 @@ async def test_perform_maintenance_queued_resource_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( @@ -5990,11 +6034,6 @@ async def test_perform_maintenance_queued_resource_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_perform_maintenance_queued_resource_async_from_dict(): - await test_perform_maintenance_queued_resource_async(request_type=dict) - - def test_perform_maintenance_queued_resource_field_headers(): client = TpuClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6063,8 +6102,8 @@ async def test_perform_maintenance_queued_resource_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - cloud_tpu.GenerateServiceIdentityRequest, - dict, + cloud_tpu.GenerateServiceIdentityRequest(), + {}, ], ) def test_generate_service_identity(request_type, transport: str = "grpc"): @@ -6075,7 +6114,7 @@ def test_generate_service_identity(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6120,9 +6159,10 @@ def test_generate_service_identity_non_empty_request_with_auto_populated_field() client.generate_service_identity(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_tpu.GenerateServiceIdentityRequest( + request_msg = cloud_tpu.GenerateServiceIdentityRequest( parent="parent_value", ) + assert args[0] == request_msg def test_generate_service_identity_use_cached_wrapped_rpc(): @@ -6208,9 +6248,15 @@ async def test_generate_service_identity_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloud_tpu.GenerateServiceIdentityRequest(), + {}, + ], +) async def test_generate_service_identity_async( - transport: str = "grpc_asyncio", - request_type=cloud_tpu.GenerateServiceIdentityRequest, + request_type, transport: str = "grpc_asyncio" ): client = TpuAsyncClient( credentials=async_anonymous_credentials(), @@ -6219,7 +6265,7 @@ async def test_generate_service_identity_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( @@ -6241,11 +6287,6 @@ async def test_generate_service_identity_async( assert isinstance(response, cloud_tpu.GenerateServiceIdentityResponse) -@pytest.mark.asyncio -async def test_generate_service_identity_async_from_dict(): - await test_generate_service_identity_async(request_type=dict) - - def test_generate_service_identity_field_headers(): client = TpuClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6314,8 +6355,8 @@ async def test_generate_service_identity_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - cloud_tpu.ListAcceleratorTypesRequest, - dict, + cloud_tpu.ListAcceleratorTypesRequest(), + {}, ], ) def test_list_accelerator_types(request_type, transport: str = "grpc"): @@ -6326,7 +6367,7 @@ def test_list_accelerator_types(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6379,12 +6420,13 @@ def test_list_accelerator_types_non_empty_request_with_auto_populated_field(): client.list_accelerator_types(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_tpu.ListAcceleratorTypesRequest( + request_msg = cloud_tpu.ListAcceleratorTypesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_accelerator_types_use_cached_wrapped_rpc(): @@ -6470,8 +6512,15 @@ async def test_list_accelerator_types_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloud_tpu.ListAcceleratorTypesRequest(), + {}, + ], +) async def test_list_accelerator_types_async( - transport: str = "grpc_asyncio", request_type=cloud_tpu.ListAcceleratorTypesRequest + request_type, transport: str = "grpc_asyncio" ): client = TpuAsyncClient( credentials=async_anonymous_credentials(), @@ -6480,7 +6529,7 @@ async def test_list_accelerator_types_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( @@ -6507,11 +6556,6 @@ async def test_list_accelerator_types_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_accelerator_types_async_from_dict(): - await test_list_accelerator_types_async(request_type=dict) - - def test_list_accelerator_types_field_headers(): client = TpuClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6864,8 +6908,8 @@ async def test_list_accelerator_types_async_pages(): @pytest.mark.parametrize( "request_type", [ - cloud_tpu.GetAcceleratorTypeRequest, - dict, + cloud_tpu.GetAcceleratorTypeRequest(), + {}, ], ) def test_get_accelerator_type(request_type, transport: str = "grpc"): @@ -6876,7 +6920,7 @@ def test_get_accelerator_type(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6926,9 +6970,10 @@ def test_get_accelerator_type_non_empty_request_with_auto_populated_field(): client.get_accelerator_type(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_tpu.GetAcceleratorTypeRequest( + request_msg = cloud_tpu.GetAcceleratorTypeRequest( name="name_value", ) + assert args[0] == request_msg def test_get_accelerator_type_use_cached_wrapped_rpc(): @@ -7013,8 +7058,15 @@ async def test_get_accelerator_type_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloud_tpu.GetAcceleratorTypeRequest(), + {}, + ], +) async def test_get_accelerator_type_async( - transport: str = "grpc_asyncio", request_type=cloud_tpu.GetAcceleratorTypeRequest + request_type, transport: str = "grpc_asyncio" ): client = TpuAsyncClient( credentials=async_anonymous_credentials(), @@ -7023,7 +7075,7 @@ async def test_get_accelerator_type_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( @@ -7050,11 +7102,6 @@ async def test_get_accelerator_type_async( assert response.type_ == "type__value" -@pytest.mark.asyncio -async def test_get_accelerator_type_async_from_dict(): - await test_get_accelerator_type_async(request_type=dict) - - def test_get_accelerator_type_field_headers(): client = TpuClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7209,8 +7256,8 @@ async def test_get_accelerator_type_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_tpu.ListRuntimeVersionsRequest, - dict, + cloud_tpu.ListRuntimeVersionsRequest(), + {}, ], ) def test_list_runtime_versions(request_type, transport: str = "grpc"): @@ -7221,7 +7268,7 @@ def test_list_runtime_versions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7274,12 +7321,13 @@ def test_list_runtime_versions_non_empty_request_with_auto_populated_field(): client.list_runtime_versions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_tpu.ListRuntimeVersionsRequest( + request_msg = cloud_tpu.ListRuntimeVersionsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_runtime_versions_use_cached_wrapped_rpc(): @@ -7365,8 +7413,15 @@ async def test_list_runtime_versions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloud_tpu.ListRuntimeVersionsRequest(), + {}, + ], +) async def test_list_runtime_versions_async( - transport: str = "grpc_asyncio", request_type=cloud_tpu.ListRuntimeVersionsRequest + request_type, transport: str = "grpc_asyncio" ): client = TpuAsyncClient( credentials=async_anonymous_credentials(), @@ -7375,7 +7430,7 @@ async def test_list_runtime_versions_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( @@ -7402,11 +7457,6 @@ async def test_list_runtime_versions_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_runtime_versions_async_from_dict(): - await test_list_runtime_versions_async(request_type=dict) - - def test_list_runtime_versions_field_headers(): client = TpuClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7759,8 +7809,8 @@ async def test_list_runtime_versions_async_pages(): @pytest.mark.parametrize( "request_type", [ - cloud_tpu.GetRuntimeVersionRequest, - dict, + cloud_tpu.GetRuntimeVersionRequest(), + {}, ], ) def test_get_runtime_version(request_type, transport: str = "grpc"): @@ -7771,7 +7821,7 @@ def test_get_runtime_version(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7821,9 +7871,10 @@ def test_get_runtime_version_non_empty_request_with_auto_populated_field(): client.get_runtime_version(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_tpu.GetRuntimeVersionRequest( + request_msg = cloud_tpu.GetRuntimeVersionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_runtime_version_use_cached_wrapped_rpc(): @@ -7908,9 +7959,14 @@ async def test_get_runtime_version_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_runtime_version_async( - transport: str = "grpc_asyncio", request_type=cloud_tpu.GetRuntimeVersionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_tpu.GetRuntimeVersionRequest(), + {}, + ], +) +async def test_get_runtime_version_async(request_type, transport: str = "grpc_asyncio"): client = TpuAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7918,7 +7974,7 @@ async def test_get_runtime_version_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( @@ -7945,11 +8001,6 @@ async def test_get_runtime_version_async( assert response.version == "version_value" -@pytest.mark.asyncio -async def test_get_runtime_version_async_from_dict(): - await test_get_runtime_version_async(request_type=dict) - - def test_get_runtime_version_field_headers(): client = TpuClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8104,8 +8155,8 @@ async def test_get_runtime_version_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - cloud_tpu.GetGuestAttributesRequest, - dict, + cloud_tpu.GetGuestAttributesRequest(), + {}, ], ) def test_get_guest_attributes(request_type, transport: str = "grpc"): @@ -8116,7 +8167,7 @@ def test_get_guest_attributes(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8162,10 +8213,11 @@ def test_get_guest_attributes_non_empty_request_with_auto_populated_field(): client.get_guest_attributes(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_tpu.GetGuestAttributesRequest( + request_msg = cloud_tpu.GetGuestAttributesRequest( name="name_value", query_path="query_path_value", ) + assert args[0] == request_msg def test_get_guest_attributes_use_cached_wrapped_rpc(): @@ -8250,8 +8302,15 @@ async def test_get_guest_attributes_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloud_tpu.GetGuestAttributesRequest(), + {}, + ], +) async def test_get_guest_attributes_async( - transport: str = "grpc_asyncio", request_type=cloud_tpu.GetGuestAttributesRequest + request_type, transport: str = "grpc_asyncio" ): client = TpuAsyncClient( credentials=async_anonymous_credentials(), @@ -8260,7 +8319,7 @@ async def test_get_guest_attributes_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( @@ -8282,11 +8341,6 @@ async def test_get_guest_attributes_async( assert isinstance(response, cloud_tpu.GetGuestAttributesResponse) -@pytest.mark.asyncio -async def test_get_guest_attributes_async_from_dict(): - await test_get_guest_attributes_async(request_type=dict) - - def test_get_guest_attributes_field_headers(): client = TpuClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8355,8 +8409,8 @@ async def test_get_guest_attributes_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - cloud_tpu.ListReservationsRequest, - dict, + cloud_tpu.ListReservationsRequest(), + {}, ], ) def test_list_reservations(request_type, transport: str = "grpc"): @@ -8367,7 +8421,7 @@ def test_list_reservations(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8416,10 +8470,11 @@ def test_list_reservations_non_empty_request_with_auto_populated_field(): client.list_reservations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_tpu.ListReservationsRequest( + request_msg = cloud_tpu.ListReservationsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_reservations_use_cached_wrapped_rpc(): @@ -8502,9 +8557,14 @@ async def test_list_reservations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_reservations_async( - transport: str = "grpc_asyncio", request_type=cloud_tpu.ListReservationsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + cloud_tpu.ListReservationsRequest(), + {}, + ], +) +async def test_list_reservations_async(request_type, transport: str = "grpc_asyncio"): client = TpuAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8512,7 +8572,7 @@ async def test_list_reservations_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( @@ -8537,11 +8597,6 @@ async def test_list_reservations_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_reservations_async_from_dict(): - await test_list_reservations_async(request_type=dict) - - def test_list_reservations_field_headers(): client = TpuClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8808,8 +8863,8 @@ async def test_list_reservations_async_pages(): @pytest.mark.parametrize( "request_type", [ - cloud_tpu.SimulateMaintenanceEventRequest, - dict, + cloud_tpu.SimulateMaintenanceEventRequest(), + {}, ], ) def test_simulate_maintenance_event(request_type, transport: str = "grpc"): @@ -8820,7 +8875,7 @@ def test_simulate_maintenance_event(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8865,9 +8920,10 @@ def test_simulate_maintenance_event_non_empty_request_with_auto_populated_field( client.simulate_maintenance_event(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == cloud_tpu.SimulateMaintenanceEventRequest( + request_msg = cloud_tpu.SimulateMaintenanceEventRequest( name="name_value", ) + assert args[0] == request_msg def test_simulate_maintenance_event_use_cached_wrapped_rpc(): @@ -8963,9 +9019,15 @@ async def test_simulate_maintenance_event_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + cloud_tpu.SimulateMaintenanceEventRequest(), + {}, + ], +) async def test_simulate_maintenance_event_async( - transport: str = "grpc_asyncio", - request_type=cloud_tpu.SimulateMaintenanceEventRequest, + request_type, transport: str = "grpc_asyncio" ): client = TpuAsyncClient( credentials=async_anonymous_credentials(), @@ -8974,7 +9036,7 @@ async def test_simulate_maintenance_event_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( @@ -8996,11 +9058,6 @@ async def test_simulate_maintenance_event_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_simulate_maintenance_event_async_from_dict(): - await test_simulate_maintenance_event_async(request_type=dict) - - def test_simulate_maintenance_event_field_headers(): client = TpuClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9188,7 +9245,6 @@ def test_list_nodes_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.ListNodesRequest() - assert args[0] == request_msg @@ -9209,7 +9265,6 @@ def test_get_node_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.GetNodeRequest() - assert args[0] == request_msg @@ -9230,7 +9285,6 @@ def test_create_node_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.CreateNodeRequest() - assert args[0] == request_msg @@ -9251,7 +9305,6 @@ def test_delete_node_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.DeleteNodeRequest() - assert args[0] == request_msg @@ -9272,7 +9325,6 @@ def test_stop_node_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.StopNodeRequest() - assert args[0] == request_msg @@ -9293,7 +9345,6 @@ def test_start_node_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.StartNodeRequest() - assert args[0] == request_msg @@ -9314,7 +9365,6 @@ def test_update_node_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.UpdateNodeRequest() - assert args[0] == request_msg @@ -9337,7 +9387,6 @@ def test_perform_maintenance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.PerformMaintenanceRequest() - assert args[0] == request_msg @@ -9360,7 +9409,6 @@ def test_list_queued_resources_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.ListQueuedResourcesRequest() - assert args[0] == request_msg @@ -9383,7 +9431,6 @@ def test_get_queued_resource_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.GetQueuedResourceRequest() - assert args[0] == request_msg @@ -9406,7 +9453,6 @@ def test_create_queued_resource_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.CreateQueuedResourceRequest() - assert args[0] == request_msg @@ -9429,7 +9475,6 @@ def test_delete_queued_resource_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.DeleteQueuedResourceRequest() - assert args[0] == request_msg @@ -9452,7 +9497,6 @@ def test_reset_queued_resource_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.ResetQueuedResourceRequest() - assert args[0] == request_msg @@ -9475,7 +9519,6 @@ def test_perform_maintenance_queued_resource_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.PerformMaintenanceQueuedResourceRequest() - assert args[0] == request_msg @@ -9498,7 +9541,6 @@ def test_generate_service_identity_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.GenerateServiceIdentityRequest() - assert args[0] == request_msg @@ -9521,7 +9563,6 @@ def test_list_accelerator_types_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.ListAcceleratorTypesRequest() - assert args[0] == request_msg @@ -9544,7 +9585,6 @@ def test_get_accelerator_type_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.GetAcceleratorTypeRequest() - assert args[0] == request_msg @@ -9567,7 +9607,6 @@ def test_list_runtime_versions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.ListRuntimeVersionsRequest() - assert args[0] == request_msg @@ -9590,7 +9629,6 @@ def test_get_runtime_version_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.GetRuntimeVersionRequest() - assert args[0] == request_msg @@ -9613,7 +9651,6 @@ def test_get_guest_attributes_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.GetGuestAttributesRequest() - assert args[0] == request_msg @@ -9636,7 +9673,6 @@ def test_list_reservations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.ListReservationsRequest() - assert args[0] == request_msg @@ -9659,7 +9695,6 @@ def test_simulate_maintenance_event_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.SimulateMaintenanceEventRequest() - assert args[0] == request_msg @@ -9701,7 +9736,6 @@ async def test_list_nodes_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.ListNodesRequest() - assert args[0] == request_msg @@ -9741,7 +9775,6 @@ async def test_get_node_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.GetNodeRequest() - assert args[0] == request_msg @@ -9766,7 +9799,6 @@ async def test_create_node_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.CreateNodeRequest() - assert args[0] == request_msg @@ -9791,7 +9823,6 @@ async def test_delete_node_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.DeleteNodeRequest() - assert args[0] == request_msg @@ -9816,7 +9847,6 @@ async def test_stop_node_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.StopNodeRequest() - assert args[0] == request_msg @@ -9841,7 +9871,6 @@ async def test_start_node_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.StartNodeRequest() - assert args[0] == request_msg @@ -9866,7 +9895,6 @@ async def test_update_node_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.UpdateNodeRequest() - assert args[0] == request_msg @@ -9893,7 +9921,6 @@ async def test_perform_maintenance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.PerformMaintenanceRequest() - assert args[0] == request_msg @@ -9923,7 +9950,6 @@ async def test_list_queued_resources_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.ListQueuedResourcesRequest() - assert args[0] == request_msg @@ -9953,7 +9979,6 @@ async def test_get_queued_resource_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.GetQueuedResourceRequest() - assert args[0] == request_msg @@ -9980,7 +10005,6 @@ async def test_create_queued_resource_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.CreateQueuedResourceRequest() - assert args[0] == request_msg @@ -10007,7 +10031,6 @@ async def test_delete_queued_resource_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.DeleteQueuedResourceRequest() - assert args[0] == request_msg @@ -10034,7 +10057,6 @@ async def test_reset_queued_resource_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.ResetQueuedResourceRequest() - assert args[0] == request_msg @@ -10061,7 +10083,6 @@ async def test_perform_maintenance_queued_resource_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.PerformMaintenanceQueuedResourceRequest() - assert args[0] == request_msg @@ -10088,7 +10109,6 @@ async def test_generate_service_identity_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.GenerateServiceIdentityRequest() - assert args[0] == request_msg @@ -10118,7 +10138,6 @@ async def test_list_accelerator_types_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.ListAcceleratorTypesRequest() - assert args[0] == request_msg @@ -10148,7 +10167,6 @@ async def test_get_accelerator_type_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.GetAcceleratorTypeRequest() - assert args[0] == request_msg @@ -10178,7 +10196,6 @@ async def test_list_runtime_versions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.ListRuntimeVersionsRequest() - assert args[0] == request_msg @@ -10208,7 +10225,6 @@ async def test_get_runtime_version_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.GetRuntimeVersionRequest() - assert args[0] == request_msg @@ -10235,7 +10251,6 @@ async def test_get_guest_attributes_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.GetGuestAttributesRequest() - assert args[0] == request_msg @@ -10264,7 +10279,6 @@ async def test_list_reservations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.ListReservationsRequest() - assert args[0] == request_msg @@ -10291,7 +10305,6 @@ async def test_simulate_maintenance_event_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_tpu.SimulateMaintenanceEventRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-trace/noxfile.py b/packages/google-cloud-trace/noxfile.py index 504cdcf7f1bb..39a6649e1562 100644 --- a/packages/google-cloud-trace/noxfile.py +++ b/packages/google-cloud-trace/noxfile.py @@ -47,7 +47,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-trace" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-trace/setup.py b/packages/google-cloud-trace/setup.py index 045a80656a27..4b8ded729adf 100644 --- a/packages/google-cloud-trace/setup.py +++ b/packages/google-cloud-trace/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/google-cloud-trace/testing/constraints-3.10.txt b/packages/google-cloud-trace/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-trace/testing/constraints-3.10.txt +++ b/packages/google-cloud-trace/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-trace/tests/unit/gapic/trace_v1/test_trace_service.py b/packages/google-cloud-trace/tests/unit/gapic/trace_v1/test_trace_service.py index 533093f99d85..65dd6968f006 100644 --- a/packages/google-cloud-trace/tests/unit/gapic/trace_v1/test_trace_service.py +++ b/packages/google-cloud-trace/tests/unit/gapic/trace_v1/test_trace_service.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 @@ -108,6 +109,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" @@ -1292,8 +1308,8 @@ def test_trace_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - trace.ListTracesRequest, - dict, + trace.ListTracesRequest(), + {}, ], ) def test_list_traces(request_type, transport: str = "grpc"): @@ -1304,7 +1320,7 @@ def test_list_traces(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_traces), "__call__") as call: @@ -1351,12 +1367,13 @@ def test_list_traces_non_empty_request_with_auto_populated_field(): client.list_traces(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == trace.ListTracesRequest( + request_msg = trace.ListTracesRequest( project_id="project_id_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_traces_use_cached_wrapped_rpc(): @@ -1437,9 +1454,14 @@ async def test_list_traces_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_traces_async( - transport: str = "grpc_asyncio", request_type=trace.ListTracesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + trace.ListTracesRequest(), + {}, + ], +) +async def test_list_traces_async(request_type, transport: str = "grpc_asyncio"): client = TraceServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1447,7 +1469,7 @@ async def test_list_traces_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_traces), "__call__") as call: @@ -1470,11 +1492,6 @@ async def test_list_traces_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_traces_async_from_dict(): - await test_list_traces_async(request_type=dict) - - def test_list_traces_field_headers(): client = TraceServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1811,8 +1828,8 @@ async def test_list_traces_async_pages(): @pytest.mark.parametrize( "request_type", [ - trace.GetTraceRequest, - dict, + trace.GetTraceRequest(), + {}, ], ) def test_get_trace(request_type, transport: str = "grpc"): @@ -1823,7 +1840,7 @@ def test_get_trace(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_trace), "__call__") as call: @@ -1870,10 +1887,11 @@ def test_get_trace_non_empty_request_with_auto_populated_field(): client.get_trace(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == trace.GetTraceRequest( + request_msg = trace.GetTraceRequest( project_id="project_id_value", trace_id="trace_id_value", ) + assert args[0] == request_msg def test_get_trace_use_cached_wrapped_rpc(): @@ -1952,9 +1970,14 @@ async def test_get_trace_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_trace_async( - transport: str = "grpc_asyncio", request_type=trace.GetTraceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + trace.GetTraceRequest(), + {}, + ], +) +async def test_get_trace_async(request_type, transport: str = "grpc_asyncio"): client = TraceServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1962,7 +1985,7 @@ async def test_get_trace_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_trace), "__call__") as call: @@ -1987,11 +2010,6 @@ async def test_get_trace_async( assert response.trace_id == "trace_id_value" -@pytest.mark.asyncio -async def test_get_trace_async_from_dict(): - await test_get_trace_async(request_type=dict) - - def test_get_trace_field_headers(): client = TraceServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2146,8 +2164,8 @@ async def test_get_trace_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - trace.PatchTracesRequest, - dict, + trace.PatchTracesRequest(), + {}, ], ) def test_patch_traces(request_type, transport: str = "grpc"): @@ -2158,7 +2176,7 @@ def test_patch_traces(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.patch_traces), "__call__") as call: @@ -2199,9 +2217,10 @@ def test_patch_traces_non_empty_request_with_auto_populated_field(): client.patch_traces(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == trace.PatchTracesRequest( + request_msg = trace.PatchTracesRequest( project_id="project_id_value", ) + assert args[0] == request_msg def test_patch_traces_use_cached_wrapped_rpc(): @@ -2282,9 +2301,14 @@ async def test_patch_traces_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_patch_traces_async( - transport: str = "grpc_asyncio", request_type=trace.PatchTracesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + trace.PatchTracesRequest(), + {}, + ], +) +async def test_patch_traces_async(request_type, transport: str = "grpc_asyncio"): client = TraceServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2292,7 +2316,7 @@ async def test_patch_traces_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.patch_traces), "__call__") as call: @@ -2310,11 +2334,6 @@ async def test_patch_traces_async( assert response is None -@pytest.mark.asyncio -async def test_patch_traces_async_from_dict(): - await test_patch_traces_async(request_type=dict) - - def test_patch_traces_field_headers(): client = TraceServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3216,7 +3235,6 @@ def test_list_traces_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = trace.ListTracesRequest() - assert args[0] == request_msg @@ -3237,7 +3255,6 @@ def test_get_trace_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = trace.GetTraceRequest() - assert args[0] == request_msg @@ -3258,7 +3275,6 @@ def test_patch_traces_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = trace.PatchTracesRequest() - assert args[0] == request_msg @@ -3299,7 +3315,6 @@ async def test_list_traces_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = trace.ListTracesRequest() - assert args[0] == request_msg @@ -3327,7 +3342,6 @@ async def test_get_trace_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = trace.GetTraceRequest() - assert args[0] == request_msg @@ -3350,7 +3364,6 @@ async def test_patch_traces_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = trace.PatchTracesRequest() - assert args[0] == request_msg @@ -3830,7 +3843,6 @@ def test_list_traces_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = trace.ListTracesRequest() - assert args[0] == request_msg @@ -3850,7 +3862,6 @@ def test_get_trace_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = trace.GetTraceRequest() - assert args[0] == request_msg @@ -3870,7 +3881,6 @@ def test_patch_traces_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = trace.PatchTracesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-trace/tests/unit/gapic/trace_v2/test_trace_service.py b/packages/google-cloud-trace/tests/unit/gapic/trace_v2/test_trace_service.py index 652d485f2826..d114c9d5fa74 100644 --- a/packages/google-cloud-trace/tests/unit/gapic/trace_v2/test_trace_service.py +++ b/packages/google-cloud-trace/tests/unit/gapic/trace_v2/test_trace_service.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 @@ -110,6 +111,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" @@ -1293,8 +1309,8 @@ def test_trace_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - tracing.BatchWriteSpansRequest, - dict, + tracing.BatchWriteSpansRequest(), + {}, ], ) def test_batch_write_spans(request_type, transport: str = "grpc"): @@ -1305,7 +1321,7 @@ def test_batch_write_spans(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1350,9 +1366,10 @@ def test_batch_write_spans_non_empty_request_with_auto_populated_field(): client.batch_write_spans(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == tracing.BatchWriteSpansRequest( + request_msg = tracing.BatchWriteSpansRequest( name="name_value", ) + assert args[0] == request_msg def test_batch_write_spans_use_cached_wrapped_rpc(): @@ -1435,9 +1452,14 @@ async def test_batch_write_spans_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_batch_write_spans_async( - transport: str = "grpc_asyncio", request_type=tracing.BatchWriteSpansRequest -): +@pytest.mark.parametrize( + "request_type", + [ + tracing.BatchWriteSpansRequest(), + {}, + ], +) +async def test_batch_write_spans_async(request_type, transport: str = "grpc_asyncio"): client = TraceServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1445,7 +1467,7 @@ async def test_batch_write_spans_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( @@ -1465,11 +1487,6 @@ async def test_batch_write_spans_async( assert response is None -@pytest.mark.asyncio -async def test_batch_write_spans_async_from_dict(): - await test_batch_write_spans_async(request_type=dict) - - def test_batch_write_spans_field_headers(): client = TraceServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1630,8 +1647,8 @@ async def test_batch_write_spans_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - trace.Span, - dict, + trace.Span(), + {}, ], ) def test_create_span(request_type, transport: str = "grpc"): @@ -1642,7 +1659,7 @@ def test_create_span(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_span), "__call__") as call: @@ -1694,11 +1711,12 @@ def test_create_span_non_empty_request_with_auto_populated_field(): client.create_span(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == trace.Span( + request_msg = trace.Span( name="name_value", span_id="span_id_value", parent_span_id="parent_span_id_value", ) + assert args[0] == request_msg def test_create_span_use_cached_wrapped_rpc(): @@ -1779,9 +1797,14 @@ async def test_create_span_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_span_async( - transport: str = "grpc_asyncio", request_type=trace.Span -): +@pytest.mark.parametrize( + "request_type", + [ + trace.Span(), + {}, + ], +) +async def test_create_span_async(request_type, transport: str = "grpc_asyncio"): client = TraceServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1789,7 +1812,7 @@ async def test_create_span_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_span), "__call__") as call: @@ -1818,11 +1841,6 @@ async def test_create_span_async( assert response.span_kind == trace.Span.SpanKind.INTERNAL -@pytest.mark.asyncio -async def test_create_span_async_from_dict(): - await test_create_span_async(request_type=dict) - - def test_create_span_field_headers(): client = TraceServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2326,7 +2344,6 @@ def test_batch_write_spans_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tracing.BatchWriteSpansRequest() - assert args[0] == request_msg @@ -2347,7 +2364,6 @@ def test_create_span_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = trace.Span() - assert args[0] == request_msg @@ -2386,7 +2402,6 @@ async def test_batch_write_spans_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tracing.BatchWriteSpansRequest() - assert args[0] == request_msg @@ -2416,7 +2431,6 @@ async def test_create_span_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = trace.Span() - assert args[0] == request_msg @@ -2692,7 +2706,6 @@ def test_batch_write_spans_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = tracing.BatchWriteSpansRequest() - assert args[0] == request_msg @@ -2712,7 +2725,6 @@ def test_create_span_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = trace.Span() - assert args[0] == request_msg diff --git a/packages/google-cloud-translate/noxfile.py b/packages/google-cloud-translate/noxfile.py index 01138b9c521b..0f6ce885ea75 100644 --- a/packages/google-cloud-translate/noxfile.py +++ b/packages/google-cloud-translate/noxfile.py @@ -47,7 +47,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-translate" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-translate/setup.py b/packages/google-cloud-translate/setup.py index 9773395cfa8d..c79b32162195 100644 --- a/packages/google-cloud-translate/setup.py +++ b/packages/google-cloud-translate/setup.py @@ -44,7 +44,7 @@ # See https://github.com/googleapis/google-cloud-python/issues/12364 "google-auth >= 2.14.1, <3.0.0,!=2.24.0,!=2.25.0", "google-cloud-core >= 2.0.0, <3.0.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-translate/testing/constraints-3.10.txt b/packages/google-cloud-translate/testing/constraints-3.10.txt index a92801e1c8e2..b39cd54634f9 100644 --- a/packages/google-cloud-translate/testing/constraints-3.10.txt +++ b/packages/google-cloud-translate/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/google-cloud-translate/tests/unit/gapic/translate_v3/test_translation_service.py b/packages/google-cloud-translate/tests/unit/gapic/translate_v3/test_translation_service.py index 33b59a6e944c..fd7d4b08a0f5 100644 --- a/packages/google-cloud-translate/tests/unit/gapic/translate_v3/test_translation_service.py +++ b/packages/google-cloud-translate/tests/unit/gapic/translate_v3/test_translation_service.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 @@ -126,6 +127,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" @@ -1374,8 +1390,8 @@ def test_translation_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - translation_service.TranslateTextRequest, - dict, + translation_service.TranslateTextRequest(), + {}, ], ) def test_translate_text(request_type, transport: str = "grpc"): @@ -1386,7 +1402,7 @@ def test_translate_text(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.translate_text), "__call__") as call: @@ -1431,13 +1447,14 @@ def test_translate_text_non_empty_request_with_auto_populated_field(): client.translate_text(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == translation_service.TranslateTextRequest( + request_msg = translation_service.TranslateTextRequest( mime_type="mime_type_value", source_language_code="source_language_code_value", target_language_code="target_language_code_value", parent="parent_value", model="model_value", ) + assert args[0] == request_msg def test_translate_text_use_cached_wrapped_rpc(): @@ -1518,10 +1535,14 @@ async def test_translate_text_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_translate_text_async( - transport: str = "grpc_asyncio", - request_type=translation_service.TranslateTextRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + translation_service.TranslateTextRequest(), + {}, + ], +) +async def test_translate_text_async(request_type, transport: str = "grpc_asyncio"): client = TranslationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1529,7 +1550,7 @@ async def test_translate_text_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.translate_text), "__call__") as call: @@ -1549,11 +1570,6 @@ async def test_translate_text_async( assert isinstance(response, translation_service.TranslateTextResponse) -@pytest.mark.asyncio -async def test_translate_text_async_from_dict(): - await test_translate_text_async(request_type=dict) - - def test_translate_text_field_headers(): client = TranslationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1750,8 +1766,8 @@ async def test_translate_text_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - translation_service.RomanizeTextRequest, - dict, + translation_service.RomanizeTextRequest(), + {}, ], ) def test_romanize_text(request_type, transport: str = "grpc"): @@ -1762,7 +1778,7 @@ def test_romanize_text(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.romanize_text), "__call__") as call: @@ -1804,10 +1820,11 @@ def test_romanize_text_non_empty_request_with_auto_populated_field(): client.romanize_text(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == translation_service.RomanizeTextRequest( + request_msg = translation_service.RomanizeTextRequest( parent="parent_value", source_language_code="source_language_code_value", ) + assert args[0] == request_msg def test_romanize_text_use_cached_wrapped_rpc(): @@ -1888,10 +1905,14 @@ async def test_romanize_text_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_romanize_text_async( - transport: str = "grpc_asyncio", - request_type=translation_service.RomanizeTextRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + translation_service.RomanizeTextRequest(), + {}, + ], +) +async def test_romanize_text_async(request_type, transport: str = "grpc_asyncio"): client = TranslationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1899,7 +1920,7 @@ async def test_romanize_text_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.romanize_text), "__call__") as call: @@ -1919,11 +1940,6 @@ async def test_romanize_text_async( assert isinstance(response, translation_service.RomanizeTextResponse) -@pytest.mark.asyncio -async def test_romanize_text_async_from_dict(): - await test_romanize_text_async(request_type=dict) - - def test_romanize_text_field_headers(): client = TranslationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2080,8 +2096,8 @@ async def test_romanize_text_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - translation_service.DetectLanguageRequest, - dict, + translation_service.DetectLanguageRequest(), + {}, ], ) def test_detect_language(request_type, transport: str = "grpc"): @@ -2092,7 +2108,7 @@ def test_detect_language(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.detect_language), "__call__") as call: @@ -2136,12 +2152,13 @@ def test_detect_language_non_empty_request_with_auto_populated_field(): client.detect_language(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == translation_service.DetectLanguageRequest( + request_msg = translation_service.DetectLanguageRequest( parent="parent_value", model="model_value", content="content_value", mime_type="mime_type_value", ) + assert args[0] == request_msg def test_detect_language_use_cached_wrapped_rpc(): @@ -2222,10 +2239,14 @@ async def test_detect_language_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_detect_language_async( - transport: str = "grpc_asyncio", - request_type=translation_service.DetectLanguageRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + translation_service.DetectLanguageRequest(), + {}, + ], +) +async def test_detect_language_async(request_type, transport: str = "grpc_asyncio"): client = TranslationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2233,7 +2254,7 @@ async def test_detect_language_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.detect_language), "__call__") as call: @@ -2253,11 +2274,6 @@ async def test_detect_language_async( assert isinstance(response, translation_service.DetectLanguageResponse) -@pytest.mark.asyncio -async def test_detect_language_async_from_dict(): - await test_detect_language_async(request_type=dict) - - def test_detect_language_field_headers(): client = TranslationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2430,8 +2446,8 @@ async def test_detect_language_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - translation_service.GetSupportedLanguagesRequest, - dict, + translation_service.GetSupportedLanguagesRequest(), + {}, ], ) def test_get_supported_languages(request_type, transport: str = "grpc"): @@ -2442,7 +2458,7 @@ def test_get_supported_languages(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2489,11 +2505,12 @@ def test_get_supported_languages_non_empty_request_with_auto_populated_field(): client.get_supported_languages(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == translation_service.GetSupportedLanguagesRequest( + request_msg = translation_service.GetSupportedLanguagesRequest( parent="parent_value", display_language_code="display_language_code_value", model="model_value", ) + assert args[0] == request_msg def test_get_supported_languages_use_cached_wrapped_rpc(): @@ -2579,9 +2596,15 @@ async def test_get_supported_languages_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + translation_service.GetSupportedLanguagesRequest(), + {}, + ], +) async def test_get_supported_languages_async( - transport: str = "grpc_asyncio", - request_type=translation_service.GetSupportedLanguagesRequest, + request_type, transport: str = "grpc_asyncio" ): client = TranslationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2590,7 +2613,7 @@ async def test_get_supported_languages_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( @@ -2612,11 +2635,6 @@ async def test_get_supported_languages_async( assert isinstance(response, translation_service.SupportedLanguages) -@pytest.mark.asyncio -async def test_get_supported_languages_async_from_dict(): - await test_get_supported_languages_async(request_type=dict) - - def test_get_supported_languages_field_headers(): client = TranslationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2791,8 +2809,8 @@ async def test_get_supported_languages_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - translation_service.TranslateDocumentRequest, - dict, + translation_service.TranslateDocumentRequest(), + {}, ], ) def test_translate_document(request_type, transport: str = "grpc"): @@ -2803,7 +2821,7 @@ def test_translate_document(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2855,13 +2873,14 @@ def test_translate_document_non_empty_request_with_auto_populated_field(): client.translate_document(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == translation_service.TranslateDocumentRequest( + request_msg = translation_service.TranslateDocumentRequest( parent="parent_value", source_language_code="source_language_code_value", target_language_code="target_language_code_value", model="model_value", customized_attribution="customized_attribution_value", ) + assert args[0] == request_msg def test_translate_document_use_cached_wrapped_rpc(): @@ -2946,10 +2965,14 @@ async def test_translate_document_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_translate_document_async( - transport: str = "grpc_asyncio", - request_type=translation_service.TranslateDocumentRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + translation_service.TranslateDocumentRequest(), + {}, + ], +) +async def test_translate_document_async(request_type, transport: str = "grpc_asyncio"): client = TranslationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2957,7 +2980,7 @@ async def test_translate_document_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( @@ -2982,11 +3005,6 @@ async def test_translate_document_async( assert response.model == "model_value" -@pytest.mark.asyncio -async def test_translate_document_async_from_dict(): - await test_translate_document_async(request_type=dict) - - def test_translate_document_field_headers(): client = TranslationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3055,8 +3073,8 @@ async def test_translate_document_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - translation_service.BatchTranslateTextRequest, - dict, + translation_service.BatchTranslateTextRequest(), + {}, ], ) def test_batch_translate_text(request_type, transport: str = "grpc"): @@ -3067,7 +3085,7 @@ def test_batch_translate_text(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3113,10 +3131,11 @@ def test_batch_translate_text_non_empty_request_with_auto_populated_field(): client.batch_translate_text(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == translation_service.BatchTranslateTextRequest( + request_msg = translation_service.BatchTranslateTextRequest( parent="parent_value", source_language_code="source_language_code_value", ) + assert args[0] == request_msg def test_batch_translate_text_use_cached_wrapped_rpc(): @@ -3211,9 +3230,15 @@ async def test_batch_translate_text_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + translation_service.BatchTranslateTextRequest(), + {}, + ], +) async def test_batch_translate_text_async( - transport: str = "grpc_asyncio", - request_type=translation_service.BatchTranslateTextRequest, + request_type, transport: str = "grpc_asyncio" ): client = TranslationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3222,7 +3247,7 @@ async def test_batch_translate_text_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( @@ -3244,11 +3269,6 @@ async def test_batch_translate_text_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_batch_translate_text_async_from_dict(): - await test_batch_translate_text_async(request_type=dict) - - def test_batch_translate_text_field_headers(): client = TranslationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3317,8 +3337,8 @@ async def test_batch_translate_text_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - translation_service.BatchTranslateDocumentRequest, - dict, + translation_service.BatchTranslateDocumentRequest(), + {}, ], ) def test_batch_translate_document(request_type, transport: str = "grpc"): @@ -3329,7 +3349,7 @@ def test_batch_translate_document(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3376,11 +3396,12 @@ def test_batch_translate_document_non_empty_request_with_auto_populated_field(): client.batch_translate_document(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == translation_service.BatchTranslateDocumentRequest( + request_msg = translation_service.BatchTranslateDocumentRequest( parent="parent_value", source_language_code="source_language_code_value", customized_attribution="customized_attribution_value", ) + assert args[0] == request_msg def test_batch_translate_document_use_cached_wrapped_rpc(): @@ -3476,9 +3497,15 @@ async def test_batch_translate_document_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + translation_service.BatchTranslateDocumentRequest(), + {}, + ], +) async def test_batch_translate_document_async( - transport: str = "grpc_asyncio", - request_type=translation_service.BatchTranslateDocumentRequest, + request_type, transport: str = "grpc_asyncio" ): client = TranslationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3487,7 +3514,7 @@ async def test_batch_translate_document_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( @@ -3509,11 +3536,6 @@ async def test_batch_translate_document_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_batch_translate_document_async_from_dict(): - await test_batch_translate_document_async(request_type=dict) - - def test_batch_translate_document_field_headers(): client = TranslationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3764,8 +3786,8 @@ async def test_batch_translate_document_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - translation_service.CreateGlossaryRequest, - dict, + translation_service.CreateGlossaryRequest(), + {}, ], ) def test_create_glossary(request_type, transport: str = "grpc"): @@ -3776,7 +3798,7 @@ def test_create_glossary(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_glossary), "__call__") as call: @@ -3817,9 +3839,10 @@ def test_create_glossary_non_empty_request_with_auto_populated_field(): client.create_glossary(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == translation_service.CreateGlossaryRequest( + request_msg = translation_service.CreateGlossaryRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_glossary_use_cached_wrapped_rpc(): @@ -3910,10 +3933,14 @@ async def test_create_glossary_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_glossary_async( - transport: str = "grpc_asyncio", - request_type=translation_service.CreateGlossaryRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + translation_service.CreateGlossaryRequest(), + {}, + ], +) +async def test_create_glossary_async(request_type, transport: str = "grpc_asyncio"): client = TranslationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3921,7 +3948,7 @@ async def test_create_glossary_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_glossary), "__call__") as call: @@ -3941,11 +3968,6 @@ async def test_create_glossary_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_glossary_async_from_dict(): - await test_create_glossary_async(request_type=dict) - - def test_create_glossary_field_headers(): client = TranslationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4102,8 +4124,8 @@ async def test_create_glossary_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - translation_service.UpdateGlossaryRequest, - dict, + translation_service.UpdateGlossaryRequest(), + {}, ], ) def test_update_glossary(request_type, transport: str = "grpc"): @@ -4114,7 +4136,7 @@ def test_update_glossary(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_glossary), "__call__") as call: @@ -4153,7 +4175,8 @@ def test_update_glossary_non_empty_request_with_auto_populated_field(): client.update_glossary(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == translation_service.UpdateGlossaryRequest() + request_msg = translation_service.UpdateGlossaryRequest() + assert args[0] == request_msg def test_update_glossary_use_cached_wrapped_rpc(): @@ -4244,10 +4267,14 @@ async def test_update_glossary_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_glossary_async( - transport: str = "grpc_asyncio", - request_type=translation_service.UpdateGlossaryRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + translation_service.UpdateGlossaryRequest(), + {}, + ], +) +async def test_update_glossary_async(request_type, transport: str = "grpc_asyncio"): client = TranslationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4255,7 +4282,7 @@ async def test_update_glossary_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_glossary), "__call__") as call: @@ -4275,11 +4302,6 @@ async def test_update_glossary_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_glossary_async_from_dict(): - await test_update_glossary_async(request_type=dict) - - def test_update_glossary_field_headers(): client = TranslationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4436,8 +4458,8 @@ async def test_update_glossary_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - translation_service.ListGlossariesRequest, - dict, + translation_service.ListGlossariesRequest(), + {}, ], ) def test_list_glossaries(request_type, transport: str = "grpc"): @@ -4448,7 +4470,7 @@ def test_list_glossaries(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_glossaries), "__call__") as call: @@ -4494,11 +4516,12 @@ def test_list_glossaries_non_empty_request_with_auto_populated_field(): client.list_glossaries(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == translation_service.ListGlossariesRequest( + request_msg = translation_service.ListGlossariesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_glossaries_use_cached_wrapped_rpc(): @@ -4579,10 +4602,14 @@ async def test_list_glossaries_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_glossaries_async( - transport: str = "grpc_asyncio", - request_type=translation_service.ListGlossariesRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + translation_service.ListGlossariesRequest(), + {}, + ], +) +async def test_list_glossaries_async(request_type, transport: str = "grpc_asyncio"): client = TranslationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4590,7 +4617,7 @@ async def test_list_glossaries_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_glossaries), "__call__") as call: @@ -4613,11 +4640,6 @@ async def test_list_glossaries_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_glossaries_async_from_dict(): - await test_list_glossaries_async(request_type=dict) - - def test_list_glossaries_field_headers(): client = TranslationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4954,8 +4976,8 @@ async def test_list_glossaries_async_pages(): @pytest.mark.parametrize( "request_type", [ - translation_service.GetGlossaryRequest, - dict, + translation_service.GetGlossaryRequest(), + {}, ], ) def test_get_glossary(request_type, transport: str = "grpc"): @@ -4966,7 +4988,7 @@ def test_get_glossary(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_glossary), "__call__") as call: @@ -5014,9 +5036,10 @@ def test_get_glossary_non_empty_request_with_auto_populated_field(): client.get_glossary(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == translation_service.GetGlossaryRequest( + request_msg = translation_service.GetGlossaryRequest( name="name_value", ) + assert args[0] == request_msg def test_get_glossary_use_cached_wrapped_rpc(): @@ -5097,9 +5120,14 @@ async def test_get_glossary_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_glossary_async( - transport: str = "grpc_asyncio", request_type=translation_service.GetGlossaryRequest -): +@pytest.mark.parametrize( + "request_type", + [ + translation_service.GetGlossaryRequest(), + {}, + ], +) +async def test_get_glossary_async(request_type, transport: str = "grpc_asyncio"): client = TranslationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5107,7 +5135,7 @@ async def test_get_glossary_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_glossary), "__call__") as call: @@ -5134,11 +5162,6 @@ async def test_get_glossary_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_get_glossary_async_from_dict(): - await test_get_glossary_async(request_type=dict) - - def test_get_glossary_field_headers(): client = TranslationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5285,8 +5308,8 @@ async def test_get_glossary_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - translation_service.DeleteGlossaryRequest, - dict, + translation_service.DeleteGlossaryRequest(), + {}, ], ) def test_delete_glossary(request_type, transport: str = "grpc"): @@ -5297,7 +5320,7 @@ def test_delete_glossary(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_glossary), "__call__") as call: @@ -5338,9 +5361,10 @@ def test_delete_glossary_non_empty_request_with_auto_populated_field(): client.delete_glossary(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == translation_service.DeleteGlossaryRequest( + request_msg = translation_service.DeleteGlossaryRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_glossary_use_cached_wrapped_rpc(): @@ -5431,10 +5455,14 @@ async def test_delete_glossary_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_glossary_async( - transport: str = "grpc_asyncio", - request_type=translation_service.DeleteGlossaryRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + translation_service.DeleteGlossaryRequest(), + {}, + ], +) +async def test_delete_glossary_async(request_type, transport: str = "grpc_asyncio"): client = TranslationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5442,7 +5470,7 @@ async def test_delete_glossary_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_glossary), "__call__") as call: @@ -5462,11 +5490,6 @@ async def test_delete_glossary_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_glossary_async_from_dict(): - await test_delete_glossary_async(request_type=dict) - - def test_delete_glossary_field_headers(): client = TranslationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5613,8 +5636,8 @@ async def test_delete_glossary_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - translation_service.GetGlossaryEntryRequest, - dict, + translation_service.GetGlossaryEntryRequest(), + {}, ], ) def test_get_glossary_entry(request_type, transport: str = "grpc"): @@ -5625,7 +5648,7 @@ def test_get_glossary_entry(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5675,9 +5698,10 @@ def test_get_glossary_entry_non_empty_request_with_auto_populated_field(): client.get_glossary_entry(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == translation_service.GetGlossaryEntryRequest( + request_msg = translation_service.GetGlossaryEntryRequest( name="name_value", ) + assert args[0] == request_msg def test_get_glossary_entry_use_cached_wrapped_rpc(): @@ -5762,10 +5786,14 @@ async def test_get_glossary_entry_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_glossary_entry_async( - transport: str = "grpc_asyncio", - request_type=translation_service.GetGlossaryEntryRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + translation_service.GetGlossaryEntryRequest(), + {}, + ], +) +async def test_get_glossary_entry_async(request_type, transport: str = "grpc_asyncio"): client = TranslationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5773,7 +5801,7 @@ async def test_get_glossary_entry_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( @@ -5800,11 +5828,6 @@ async def test_get_glossary_entry_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_get_glossary_entry_async_from_dict(): - await test_get_glossary_entry_async(request_type=dict) - - def test_get_glossary_entry_field_headers(): client = TranslationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5959,8 +5982,8 @@ async def test_get_glossary_entry_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - translation_service.ListGlossaryEntriesRequest, - dict, + translation_service.ListGlossaryEntriesRequest(), + {}, ], ) def test_list_glossary_entries(request_type, transport: str = "grpc"): @@ -5971,7 +5994,7 @@ def test_list_glossary_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( @@ -6020,10 +6043,11 @@ def test_list_glossary_entries_non_empty_request_with_auto_populated_field(): client.list_glossary_entries(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == translation_service.ListGlossaryEntriesRequest( + request_msg = translation_service.ListGlossaryEntriesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_glossary_entries_use_cached_wrapped_rpc(): @@ -6109,9 +6133,15 @@ async def test_list_glossary_entries_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + translation_service.ListGlossaryEntriesRequest(), + {}, + ], +) async def test_list_glossary_entries_async( - transport: str = "grpc_asyncio", - request_type=translation_service.ListGlossaryEntriesRequest, + request_type, transport: str = "grpc_asyncio" ): client = TranslationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -6120,7 +6150,7 @@ async def test_list_glossary_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( @@ -6145,11 +6175,6 @@ async def test_list_glossary_entries_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_glossary_entries_async_from_dict(): - await test_list_glossary_entries_async(request_type=dict) - - def test_list_glossary_entries_field_headers(): client = TranslationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6502,8 +6527,8 @@ async def test_list_glossary_entries_async_pages(): @pytest.mark.parametrize( "request_type", [ - translation_service.CreateGlossaryEntryRequest, - dict, + translation_service.CreateGlossaryEntryRequest(), + {}, ], ) def test_create_glossary_entry(request_type, transport: str = "grpc"): @@ -6514,7 +6539,7 @@ def test_create_glossary_entry(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6564,9 +6589,10 @@ def test_create_glossary_entry_non_empty_request_with_auto_populated_field(): client.create_glossary_entry(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == translation_service.CreateGlossaryEntryRequest( + request_msg = translation_service.CreateGlossaryEntryRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_glossary_entry_use_cached_wrapped_rpc(): @@ -6652,9 +6678,15 @@ async def test_create_glossary_entry_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + translation_service.CreateGlossaryEntryRequest(), + {}, + ], +) async def test_create_glossary_entry_async( - transport: str = "grpc_asyncio", - request_type=translation_service.CreateGlossaryEntryRequest, + request_type, transport: str = "grpc_asyncio" ): client = TranslationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -6663,7 +6695,7 @@ async def test_create_glossary_entry_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( @@ -6690,11 +6722,6 @@ async def test_create_glossary_entry_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_create_glossary_entry_async_from_dict(): - await test_create_glossary_entry_async(request_type=dict) - - def test_create_glossary_entry_field_headers(): client = TranslationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6859,8 +6886,8 @@ async def test_create_glossary_entry_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - translation_service.UpdateGlossaryEntryRequest, - dict, + translation_service.UpdateGlossaryEntryRequest(), + {}, ], ) def test_update_glossary_entry(request_type, transport: str = "grpc"): @@ -6871,7 +6898,7 @@ def test_update_glossary_entry(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6919,7 +6946,8 @@ def test_update_glossary_entry_non_empty_request_with_auto_populated_field(): client.update_glossary_entry(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == translation_service.UpdateGlossaryEntryRequest() + request_msg = translation_service.UpdateGlossaryEntryRequest() + assert args[0] == request_msg def test_update_glossary_entry_use_cached_wrapped_rpc(): @@ -7005,9 +7033,15 @@ async def test_update_glossary_entry_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + translation_service.UpdateGlossaryEntryRequest(), + {}, + ], +) async def test_update_glossary_entry_async( - transport: str = "grpc_asyncio", - request_type=translation_service.UpdateGlossaryEntryRequest, + request_type, transport: str = "grpc_asyncio" ): client = TranslationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -7016,7 +7050,7 @@ async def test_update_glossary_entry_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( @@ -7043,11 +7077,6 @@ async def test_update_glossary_entry_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_update_glossary_entry_async_from_dict(): - await test_update_glossary_entry_async(request_type=dict) - - def test_update_glossary_entry_field_headers(): client = TranslationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7202,8 +7231,8 @@ async def test_update_glossary_entry_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - translation_service.DeleteGlossaryEntryRequest, - dict, + translation_service.DeleteGlossaryEntryRequest(), + {}, ], ) def test_delete_glossary_entry(request_type, transport: str = "grpc"): @@ -7214,7 +7243,7 @@ def test_delete_glossary_entry(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,9 +7288,10 @@ def test_delete_glossary_entry_non_empty_request_with_auto_populated_field(): client.delete_glossary_entry(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == translation_service.DeleteGlossaryEntryRequest( + request_msg = translation_service.DeleteGlossaryEntryRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_glossary_entry_use_cached_wrapped_rpc(): @@ -7347,9 +7377,15 @@ async def test_delete_glossary_entry_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + translation_service.DeleteGlossaryEntryRequest(), + {}, + ], +) async def test_delete_glossary_entry_async( - transport: str = "grpc_asyncio", - request_type=translation_service.DeleteGlossaryEntryRequest, + request_type, transport: str = "grpc_asyncio" ): client = TranslationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -7358,7 +7394,7 @@ async def test_delete_glossary_entry_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( @@ -7378,11 +7414,6 @@ async def test_delete_glossary_entry_async( assert response is None -@pytest.mark.asyncio -async def test_delete_glossary_entry_async_from_dict(): - await test_delete_glossary_entry_async(request_type=dict) - - def test_delete_glossary_entry_field_headers(): client = TranslationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7533,8 +7564,8 @@ async def test_delete_glossary_entry_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - automl_translation.CreateDatasetRequest, - dict, + automl_translation.CreateDatasetRequest(), + {}, ], ) def test_create_dataset(request_type, transport: str = "grpc"): @@ -7545,7 +7576,7 @@ def test_create_dataset(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_dataset), "__call__") as call: @@ -7586,9 +7617,10 @@ def test_create_dataset_non_empty_request_with_auto_populated_field(): client.create_dataset(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == automl_translation.CreateDatasetRequest( + request_msg = automl_translation.CreateDatasetRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_dataset_use_cached_wrapped_rpc(): @@ -7679,10 +7711,14 @@ async def test_create_dataset_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_dataset_async( - transport: str = "grpc_asyncio", - request_type=automl_translation.CreateDatasetRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + automl_translation.CreateDatasetRequest(), + {}, + ], +) +async def test_create_dataset_async(request_type, transport: str = "grpc_asyncio"): client = TranslationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7690,7 +7726,7 @@ async def test_create_dataset_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_dataset), "__call__") as call: @@ -7710,11 +7746,6 @@ async def test_create_dataset_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_dataset_async_from_dict(): - await test_create_dataset_async(request_type=dict) - - def test_create_dataset_field_headers(): client = TranslationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7871,8 +7902,8 @@ async def test_create_dataset_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - automl_translation.GetDatasetRequest, - dict, + automl_translation.GetDatasetRequest(), + {}, ], ) def test_get_dataset(request_type, transport: str = "grpc"): @@ -7883,7 +7914,7 @@ def test_get_dataset(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_dataset), "__call__") as call: @@ -7941,9 +7972,10 @@ def test_get_dataset_non_empty_request_with_auto_populated_field(): client.get_dataset(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == automl_translation.GetDatasetRequest( + request_msg = automl_translation.GetDatasetRequest( name="name_value", ) + assert args[0] == request_msg def test_get_dataset_use_cached_wrapped_rpc(): @@ -8024,9 +8056,14 @@ async def test_get_dataset_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_dataset_async( - transport: str = "grpc_asyncio", request_type=automl_translation.GetDatasetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + automl_translation.GetDatasetRequest(), + {}, + ], +) +async def test_get_dataset_async(request_type, transport: str = "grpc_asyncio"): client = TranslationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8034,7 +8071,7 @@ async def test_get_dataset_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_dataset), "__call__") as call: @@ -8071,11 +8108,6 @@ async def test_get_dataset_async( assert response.test_example_count == 1939 -@pytest.mark.asyncio -async def test_get_dataset_async_from_dict(): - await test_get_dataset_async(request_type=dict) - - def test_get_dataset_field_headers(): client = TranslationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8222,8 +8254,8 @@ async def test_get_dataset_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - automl_translation.ListDatasetsRequest, - dict, + automl_translation.ListDatasetsRequest(), + {}, ], ) def test_list_datasets(request_type, transport: str = "grpc"): @@ -8234,7 +8266,7 @@ def test_list_datasets(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_datasets), "__call__") as call: @@ -8279,10 +8311,11 @@ def test_list_datasets_non_empty_request_with_auto_populated_field(): client.list_datasets(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == automl_translation.ListDatasetsRequest( + request_msg = automl_translation.ListDatasetsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_datasets_use_cached_wrapped_rpc(): @@ -8363,9 +8396,14 @@ async def test_list_datasets_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_datasets_async( - transport: str = "grpc_asyncio", request_type=automl_translation.ListDatasetsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + automl_translation.ListDatasetsRequest(), + {}, + ], +) +async def test_list_datasets_async(request_type, transport: str = "grpc_asyncio"): client = TranslationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8373,7 +8411,7 @@ async def test_list_datasets_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_datasets), "__call__") as call: @@ -8396,11 +8434,6 @@ async def test_list_datasets_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_datasets_async_from_dict(): - await test_list_datasets_async(request_type=dict) - - def test_list_datasets_field_headers(): client = TranslationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8737,8 +8770,8 @@ async def test_list_datasets_async_pages(): @pytest.mark.parametrize( "request_type", [ - automl_translation.DeleteDatasetRequest, - dict, + automl_translation.DeleteDatasetRequest(), + {}, ], ) def test_delete_dataset(request_type, transport: str = "grpc"): @@ -8749,7 +8782,7 @@ def test_delete_dataset(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_dataset), "__call__") as call: @@ -8790,9 +8823,10 @@ def test_delete_dataset_non_empty_request_with_auto_populated_field(): client.delete_dataset(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == automl_translation.DeleteDatasetRequest( + request_msg = automl_translation.DeleteDatasetRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_dataset_use_cached_wrapped_rpc(): @@ -8883,10 +8917,14 @@ async def test_delete_dataset_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_dataset_async( - transport: str = "grpc_asyncio", - request_type=automl_translation.DeleteDatasetRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + automl_translation.DeleteDatasetRequest(), + {}, + ], +) +async def test_delete_dataset_async(request_type, transport: str = "grpc_asyncio"): client = TranslationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8894,7 +8932,7 @@ async def test_delete_dataset_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_dataset), "__call__") as call: @@ -8914,11 +8952,6 @@ async def test_delete_dataset_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_dataset_async_from_dict(): - await test_delete_dataset_async(request_type=dict) - - def test_delete_dataset_field_headers(): client = TranslationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9065,8 +9098,8 @@ async def test_delete_dataset_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - adaptive_mt.CreateAdaptiveMtDatasetRequest, - dict, + adaptive_mt.CreateAdaptiveMtDatasetRequest(), + {}, ], ) def test_create_adaptive_mt_dataset(request_type, transport: str = "grpc"): @@ -9077,7 +9110,7 @@ def test_create_adaptive_mt_dataset(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9133,9 +9166,10 @@ def test_create_adaptive_mt_dataset_non_empty_request_with_auto_populated_field( client.create_adaptive_mt_dataset(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == adaptive_mt.CreateAdaptiveMtDatasetRequest( + request_msg = adaptive_mt.CreateAdaptiveMtDatasetRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_adaptive_mt_dataset_use_cached_wrapped_rpc(): @@ -9221,9 +9255,15 @@ async def test_create_adaptive_mt_dataset_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + adaptive_mt.CreateAdaptiveMtDatasetRequest(), + {}, + ], +) async def test_create_adaptive_mt_dataset_async( - transport: str = "grpc_asyncio", - request_type=adaptive_mt.CreateAdaptiveMtDatasetRequest, + request_type, transport: str = "grpc_asyncio" ): client = TranslationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -9232,7 +9272,7 @@ async def test_create_adaptive_mt_dataset_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( @@ -9265,11 +9305,6 @@ async def test_create_adaptive_mt_dataset_async( assert response.example_count == 1396 -@pytest.mark.asyncio -async def test_create_adaptive_mt_dataset_async_from_dict(): - await test_create_adaptive_mt_dataset_async(request_type=dict) - - def test_create_adaptive_mt_dataset_field_headers(): client = TranslationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9434,8 +9469,8 @@ async def test_create_adaptive_mt_dataset_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - adaptive_mt.DeleteAdaptiveMtDatasetRequest, - dict, + adaptive_mt.DeleteAdaptiveMtDatasetRequest(), + {}, ], ) def test_delete_adaptive_mt_dataset(request_type, transport: str = "grpc"): @@ -9446,7 +9481,7 @@ def test_delete_adaptive_mt_dataset(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9491,9 +9526,10 @@ def test_delete_adaptive_mt_dataset_non_empty_request_with_auto_populated_field( client.delete_adaptive_mt_dataset(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == adaptive_mt.DeleteAdaptiveMtDatasetRequest( + request_msg = adaptive_mt.DeleteAdaptiveMtDatasetRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_adaptive_mt_dataset_use_cached_wrapped_rpc(): @@ -9579,9 +9615,15 @@ async def test_delete_adaptive_mt_dataset_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + adaptive_mt.DeleteAdaptiveMtDatasetRequest(), + {}, + ], +) async def test_delete_adaptive_mt_dataset_async( - transport: str = "grpc_asyncio", - request_type=adaptive_mt.DeleteAdaptiveMtDatasetRequest, + request_type, transport: str = "grpc_asyncio" ): client = TranslationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -9590,7 +9632,7 @@ async def test_delete_adaptive_mt_dataset_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( @@ -9610,11 +9652,6 @@ async def test_delete_adaptive_mt_dataset_async( assert response is None -@pytest.mark.asyncio -async def test_delete_adaptive_mt_dataset_async_from_dict(): - await test_delete_adaptive_mt_dataset_async(request_type=dict) - - def test_delete_adaptive_mt_dataset_field_headers(): client = TranslationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9765,8 +9802,8 @@ async def test_delete_adaptive_mt_dataset_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - adaptive_mt.GetAdaptiveMtDatasetRequest, - dict, + adaptive_mt.GetAdaptiveMtDatasetRequest(), + {}, ], ) def test_get_adaptive_mt_dataset(request_type, transport: str = "grpc"): @@ -9777,7 +9814,7 @@ def test_get_adaptive_mt_dataset(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9833,9 +9870,10 @@ def test_get_adaptive_mt_dataset_non_empty_request_with_auto_populated_field(): client.get_adaptive_mt_dataset(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == adaptive_mt.GetAdaptiveMtDatasetRequest( + request_msg = adaptive_mt.GetAdaptiveMtDatasetRequest( name="name_value", ) + assert args[0] == request_msg def test_get_adaptive_mt_dataset_use_cached_wrapped_rpc(): @@ -9921,9 +9959,15 @@ async def test_get_adaptive_mt_dataset_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + adaptive_mt.GetAdaptiveMtDatasetRequest(), + {}, + ], +) async def test_get_adaptive_mt_dataset_async( - transport: str = "grpc_asyncio", - request_type=adaptive_mt.GetAdaptiveMtDatasetRequest, + request_type, transport: str = "grpc_asyncio" ): client = TranslationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -9932,7 +9976,7 @@ async def test_get_adaptive_mt_dataset_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( @@ -9965,11 +10009,6 @@ async def test_get_adaptive_mt_dataset_async( assert response.example_count == 1396 -@pytest.mark.asyncio -async def test_get_adaptive_mt_dataset_async_from_dict(): - await test_get_adaptive_mt_dataset_async(request_type=dict) - - def test_get_adaptive_mt_dataset_field_headers(): client = TranslationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10124,8 +10163,8 @@ async def test_get_adaptive_mt_dataset_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - adaptive_mt.ListAdaptiveMtDatasetsRequest, - dict, + adaptive_mt.ListAdaptiveMtDatasetsRequest(), + {}, ], ) def test_list_adaptive_mt_datasets(request_type, transport: str = "grpc"): @@ -10136,7 +10175,7 @@ def test_list_adaptive_mt_datasets(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10186,11 +10225,12 @@ def test_list_adaptive_mt_datasets_non_empty_request_with_auto_populated_field() client.list_adaptive_mt_datasets(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == adaptive_mt.ListAdaptiveMtDatasetsRequest( + request_msg = adaptive_mt.ListAdaptiveMtDatasetsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_adaptive_mt_datasets_use_cached_wrapped_rpc(): @@ -10276,9 +10316,15 @@ async def test_list_adaptive_mt_datasets_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + adaptive_mt.ListAdaptiveMtDatasetsRequest(), + {}, + ], +) async def test_list_adaptive_mt_datasets_async( - transport: str = "grpc_asyncio", - request_type=adaptive_mt.ListAdaptiveMtDatasetsRequest, + request_type, transport: str = "grpc_asyncio" ): client = TranslationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -10287,7 +10333,7 @@ async def test_list_adaptive_mt_datasets_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( @@ -10312,11 +10358,6 @@ async def test_list_adaptive_mt_datasets_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_adaptive_mt_datasets_async_from_dict(): - await test_list_adaptive_mt_datasets_async(request_type=dict) - - def test_list_adaptive_mt_datasets_field_headers(): client = TranslationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10671,8 +10712,8 @@ async def test_list_adaptive_mt_datasets_async_pages(): @pytest.mark.parametrize( "request_type", [ - adaptive_mt.AdaptiveMtTranslateRequest, - dict, + adaptive_mt.AdaptiveMtTranslateRequest(), + {}, ], ) def test_adaptive_mt_translate(request_type, transport: str = "grpc"): @@ -10683,7 +10724,7 @@ def test_adaptive_mt_translate(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,11 +10774,12 @@ def test_adaptive_mt_translate_non_empty_request_with_auto_populated_field(): client.adaptive_mt_translate(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == adaptive_mt.AdaptiveMtTranslateRequest( + request_msg = adaptive_mt.AdaptiveMtTranslateRequest( parent="parent_value", dataset="dataset_value", mime_type="mime_type_value", ) + assert args[0] == request_msg def test_adaptive_mt_translate_use_cached_wrapped_rpc(): @@ -10823,8 +10865,15 @@ async def test_adaptive_mt_translate_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + adaptive_mt.AdaptiveMtTranslateRequest(), + {}, + ], +) async def test_adaptive_mt_translate_async( - transport: str = "grpc_asyncio", request_type=adaptive_mt.AdaptiveMtTranslateRequest + request_type, transport: str = "grpc_asyncio" ): client = TranslationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -10833,7 +10882,7 @@ async def test_adaptive_mt_translate_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( @@ -10858,11 +10907,6 @@ async def test_adaptive_mt_translate_async( assert response.language_code == "language_code_value" -@pytest.mark.asyncio -async def test_adaptive_mt_translate_async_from_dict(): - await test_adaptive_mt_translate_async(request_type=dict) - - def test_adaptive_mt_translate_field_headers(): client = TranslationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11027,8 +11071,8 @@ async def test_adaptive_mt_translate_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - adaptive_mt.GetAdaptiveMtFileRequest, - dict, + adaptive_mt.GetAdaptiveMtFileRequest(), + {}, ], ) def test_get_adaptive_mt_file(request_type, transport: str = "grpc"): @@ -11039,7 +11083,7 @@ def test_get_adaptive_mt_file(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11091,9 +11135,10 @@ def test_get_adaptive_mt_file_non_empty_request_with_auto_populated_field(): client.get_adaptive_mt_file(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == adaptive_mt.GetAdaptiveMtFileRequest( + request_msg = adaptive_mt.GetAdaptiveMtFileRequest( name="name_value", ) + assert args[0] == request_msg def test_get_adaptive_mt_file_use_cached_wrapped_rpc(): @@ -11178,8 +11223,15 @@ async def test_get_adaptive_mt_file_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + adaptive_mt.GetAdaptiveMtFileRequest(), + {}, + ], +) async def test_get_adaptive_mt_file_async( - transport: str = "grpc_asyncio", request_type=adaptive_mt.GetAdaptiveMtFileRequest + request_type, transport: str = "grpc_asyncio" ): client = TranslationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -11188,7 +11240,7 @@ async def test_get_adaptive_mt_file_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( @@ -11217,11 +11269,6 @@ async def test_get_adaptive_mt_file_async( assert response.entry_count == 1210 -@pytest.mark.asyncio -async def test_get_adaptive_mt_file_async_from_dict(): - await test_get_adaptive_mt_file_async(request_type=dict) - - def test_get_adaptive_mt_file_field_headers(): client = TranslationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11376,8 +11423,8 @@ async def test_get_adaptive_mt_file_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - adaptive_mt.DeleteAdaptiveMtFileRequest, - dict, + adaptive_mt.DeleteAdaptiveMtFileRequest(), + {}, ], ) def test_delete_adaptive_mt_file(request_type, transport: str = "grpc"): @@ -11388,7 +11435,7 @@ def test_delete_adaptive_mt_file(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11433,9 +11480,10 @@ def test_delete_adaptive_mt_file_non_empty_request_with_auto_populated_field(): client.delete_adaptive_mt_file(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == adaptive_mt.DeleteAdaptiveMtFileRequest( + request_msg = adaptive_mt.DeleteAdaptiveMtFileRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_adaptive_mt_file_use_cached_wrapped_rpc(): @@ -11521,9 +11569,15 @@ async def test_delete_adaptive_mt_file_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + adaptive_mt.DeleteAdaptiveMtFileRequest(), + {}, + ], +) async def test_delete_adaptive_mt_file_async( - transport: str = "grpc_asyncio", - request_type=adaptive_mt.DeleteAdaptiveMtFileRequest, + request_type, transport: str = "grpc_asyncio" ): client = TranslationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -11532,7 +11586,7 @@ async def test_delete_adaptive_mt_file_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( @@ -11549,12 +11603,7 @@ async def test_delete_adaptive_mt_file_async( assert args[0] == request # Establish that the response is the type that we expect. - assert response is None - - -@pytest.mark.asyncio -async def test_delete_adaptive_mt_file_async_from_dict(): - await test_delete_adaptive_mt_file_async(request_type=dict) + assert response is None def test_delete_adaptive_mt_file_field_headers(): @@ -11707,8 +11756,8 @@ async def test_delete_adaptive_mt_file_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - adaptive_mt.ImportAdaptiveMtFileRequest, - dict, + adaptive_mt.ImportAdaptiveMtFileRequest(), + {}, ], ) def test_import_adaptive_mt_file(request_type, transport: str = "grpc"): @@ -11719,7 +11768,7 @@ def test_import_adaptive_mt_file(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11764,9 +11813,10 @@ def test_import_adaptive_mt_file_non_empty_request_with_auto_populated_field(): client.import_adaptive_mt_file(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == adaptive_mt.ImportAdaptiveMtFileRequest( + request_msg = adaptive_mt.ImportAdaptiveMtFileRequest( parent="parent_value", ) + assert args[0] == request_msg def test_import_adaptive_mt_file_use_cached_wrapped_rpc(): @@ -11852,9 +11902,15 @@ async def test_import_adaptive_mt_file_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + adaptive_mt.ImportAdaptiveMtFileRequest(), + {}, + ], +) async def test_import_adaptive_mt_file_async( - transport: str = "grpc_asyncio", - request_type=adaptive_mt.ImportAdaptiveMtFileRequest, + request_type, transport: str = "grpc_asyncio" ): client = TranslationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -11863,7 +11919,7 @@ async def test_import_adaptive_mt_file_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( @@ -11885,11 +11941,6 @@ async def test_import_adaptive_mt_file_async( assert isinstance(response, adaptive_mt.ImportAdaptiveMtFileResponse) -@pytest.mark.asyncio -async def test_import_adaptive_mt_file_async_from_dict(): - await test_import_adaptive_mt_file_async(request_type=dict) - - def test_import_adaptive_mt_file_field_headers(): client = TranslationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12044,8 +12095,8 @@ async def test_import_adaptive_mt_file_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - adaptive_mt.ListAdaptiveMtFilesRequest, - dict, + adaptive_mt.ListAdaptiveMtFilesRequest(), + {}, ], ) def test_list_adaptive_mt_files(request_type, transport: str = "grpc"): @@ -12056,7 +12107,7 @@ def test_list_adaptive_mt_files(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -12105,10 +12156,11 @@ def test_list_adaptive_mt_files_non_empty_request_with_auto_populated_field(): client.list_adaptive_mt_files(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == adaptive_mt.ListAdaptiveMtFilesRequest( + request_msg = adaptive_mt.ListAdaptiveMtFilesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_adaptive_mt_files_use_cached_wrapped_rpc(): @@ -12194,8 +12246,15 @@ async def test_list_adaptive_mt_files_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + adaptive_mt.ListAdaptiveMtFilesRequest(), + {}, + ], +) async def test_list_adaptive_mt_files_async( - transport: str = "grpc_asyncio", request_type=adaptive_mt.ListAdaptiveMtFilesRequest + request_type, transport: str = "grpc_asyncio" ): client = TranslationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -12204,7 +12263,7 @@ async def test_list_adaptive_mt_files_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( @@ -12229,11 +12288,6 @@ async def test_list_adaptive_mt_files_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_adaptive_mt_files_async_from_dict(): - await test_list_adaptive_mt_files_async(request_type=dict) - - def test_list_adaptive_mt_files_field_headers(): client = TranslationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12586,8 +12640,8 @@ async def test_list_adaptive_mt_files_async_pages(): @pytest.mark.parametrize( "request_type", [ - adaptive_mt.ListAdaptiveMtSentencesRequest, - dict, + adaptive_mt.ListAdaptiveMtSentencesRequest(), + {}, ], ) def test_list_adaptive_mt_sentences(request_type, transport: str = "grpc"): @@ -12598,7 +12652,7 @@ def test_list_adaptive_mt_sentences(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -12647,10 +12701,11 @@ def test_list_adaptive_mt_sentences_non_empty_request_with_auto_populated_field( client.list_adaptive_mt_sentences(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == adaptive_mt.ListAdaptiveMtSentencesRequest( + request_msg = adaptive_mt.ListAdaptiveMtSentencesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_adaptive_mt_sentences_use_cached_wrapped_rpc(): @@ -12736,9 +12791,15 @@ async def test_list_adaptive_mt_sentences_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + adaptive_mt.ListAdaptiveMtSentencesRequest(), + {}, + ], +) async def test_list_adaptive_mt_sentences_async( - transport: str = "grpc_asyncio", - request_type=adaptive_mt.ListAdaptiveMtSentencesRequest, + request_type, transport: str = "grpc_asyncio" ): client = TranslationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -12747,7 +12808,7 @@ async def test_list_adaptive_mt_sentences_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( @@ -12772,11 +12833,6 @@ async def test_list_adaptive_mt_sentences_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_adaptive_mt_sentences_async_from_dict(): - await test_list_adaptive_mt_sentences_async(request_type=dict) - - def test_list_adaptive_mt_sentences_field_headers(): client = TranslationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13131,8 +13187,8 @@ async def test_list_adaptive_mt_sentences_async_pages(): @pytest.mark.parametrize( "request_type", [ - automl_translation.ImportDataRequest, - dict, + automl_translation.ImportDataRequest(), + {}, ], ) def test_import_data(request_type, transport: str = "grpc"): @@ -13143,7 +13199,7 @@ def test_import_data(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.import_data), "__call__") as call: @@ -13184,9 +13240,10 @@ def test_import_data_non_empty_request_with_auto_populated_field(): client.import_data(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == automl_translation.ImportDataRequest( + request_msg = automl_translation.ImportDataRequest( dataset="dataset_value", ) + assert args[0] == request_msg def test_import_data_use_cached_wrapped_rpc(): @@ -13277,9 +13334,14 @@ async def test_import_data_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_import_data_async( - transport: str = "grpc_asyncio", request_type=automl_translation.ImportDataRequest -): +@pytest.mark.parametrize( + "request_type", + [ + automl_translation.ImportDataRequest(), + {}, + ], +) +async def test_import_data_async(request_type, transport: str = "grpc_asyncio"): client = TranslationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13287,7 +13349,7 @@ async def test_import_data_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.import_data), "__call__") as call: @@ -13307,11 +13369,6 @@ async def test_import_data_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_import_data_async_from_dict(): - await test_import_data_async(request_type=dict) - - def test_import_data_field_headers(): client = TranslationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13492,8 +13549,8 @@ async def test_import_data_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - automl_translation.ExportDataRequest, - dict, + automl_translation.ExportDataRequest(), + {}, ], ) def test_export_data(request_type, transport: str = "grpc"): @@ -13504,7 +13561,7 @@ def test_export_data(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.export_data), "__call__") as call: @@ -13545,9 +13602,10 @@ def test_export_data_non_empty_request_with_auto_populated_field(): client.export_data(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == automl_translation.ExportDataRequest( + request_msg = automl_translation.ExportDataRequest( dataset="dataset_value", ) + assert args[0] == request_msg def test_export_data_use_cached_wrapped_rpc(): @@ -13638,9 +13696,14 @@ async def test_export_data_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_export_data_async( - transport: str = "grpc_asyncio", request_type=automl_translation.ExportDataRequest -): +@pytest.mark.parametrize( + "request_type", + [ + automl_translation.ExportDataRequest(), + {}, + ], +) +async def test_export_data_async(request_type, transport: str = "grpc_asyncio"): client = TranslationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13648,7 +13711,7 @@ async def test_export_data_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.export_data), "__call__") as call: @@ -13668,11 +13731,6 @@ async def test_export_data_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_export_data_async_from_dict(): - await test_export_data_async(request_type=dict) - - def test_export_data_field_headers(): client = TranslationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13853,8 +13911,8 @@ async def test_export_data_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - automl_translation.ListExamplesRequest, - dict, + automl_translation.ListExamplesRequest(), + {}, ], ) def test_list_examples(request_type, transport: str = "grpc"): @@ -13865,7 +13923,7 @@ def test_list_examples(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_examples), "__call__") as call: @@ -13911,11 +13969,12 @@ def test_list_examples_non_empty_request_with_auto_populated_field(): client.list_examples(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == automl_translation.ListExamplesRequest( + request_msg = automl_translation.ListExamplesRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_examples_use_cached_wrapped_rpc(): @@ -13996,9 +14055,14 @@ async def test_list_examples_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_examples_async( - transport: str = "grpc_asyncio", request_type=automl_translation.ListExamplesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + automl_translation.ListExamplesRequest(), + {}, + ], +) +async def test_list_examples_async(request_type, transport: str = "grpc_asyncio"): client = TranslationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14006,7 +14070,7 @@ async def test_list_examples_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_examples), "__call__") as call: @@ -14029,11 +14093,6 @@ async def test_list_examples_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_examples_async_from_dict(): - await test_list_examples_async(request_type=dict) - - def test_list_examples_field_headers(): client = TranslationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14370,8 +14429,8 @@ async def test_list_examples_async_pages(): @pytest.mark.parametrize( "request_type", [ - automl_translation.CreateModelRequest, - dict, + automl_translation.CreateModelRequest(), + {}, ], ) def test_create_model(request_type, transport: str = "grpc"): @@ -14382,7 +14441,7 @@ def test_create_model(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_model), "__call__") as call: @@ -14423,9 +14482,10 @@ def test_create_model_non_empty_request_with_auto_populated_field(): client.create_model(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == automl_translation.CreateModelRequest( + request_msg = automl_translation.CreateModelRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_model_use_cached_wrapped_rpc(): @@ -14516,9 +14576,14 @@ async def test_create_model_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_model_async( - transport: str = "grpc_asyncio", request_type=automl_translation.CreateModelRequest -): +@pytest.mark.parametrize( + "request_type", + [ + automl_translation.CreateModelRequest(), + {}, + ], +) +async def test_create_model_async(request_type, transport: str = "grpc_asyncio"): client = TranslationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14526,7 +14591,7 @@ async def test_create_model_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_model), "__call__") as call: @@ -14546,11 +14611,6 @@ async def test_create_model_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_model_async_from_dict(): - await test_create_model_async(request_type=dict) - - def test_create_model_field_headers(): client = TranslationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14707,8 +14767,8 @@ async def test_create_model_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - automl_translation.ListModelsRequest, - dict, + automl_translation.ListModelsRequest(), + {}, ], ) def test_list_models(request_type, transport: str = "grpc"): @@ -14719,7 +14779,7 @@ def test_list_models(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_models), "__call__") as call: @@ -14765,11 +14825,12 @@ def test_list_models_non_empty_request_with_auto_populated_field(): client.list_models(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == automl_translation.ListModelsRequest( + request_msg = automl_translation.ListModelsRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_models_use_cached_wrapped_rpc(): @@ -14850,9 +14911,14 @@ async def test_list_models_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_models_async( - transport: str = "grpc_asyncio", request_type=automl_translation.ListModelsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + automl_translation.ListModelsRequest(), + {}, + ], +) +async def test_list_models_async(request_type, transport: str = "grpc_asyncio"): client = TranslationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14860,7 +14926,7 @@ async def test_list_models_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_models), "__call__") as call: @@ -14883,11 +14949,6 @@ async def test_list_models_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_models_async_from_dict(): - await test_list_models_async(request_type=dict) - - def test_list_models_field_headers(): client = TranslationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15224,8 +15285,8 @@ async def test_list_models_async_pages(): @pytest.mark.parametrize( "request_type", [ - automl_translation.GetModelRequest, - dict, + automl_translation.GetModelRequest(), + {}, ], ) def test_get_model(request_type, transport: str = "grpc"): @@ -15236,7 +15297,7 @@ def test_get_model(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_model), "__call__") as call: @@ -15294,9 +15355,10 @@ def test_get_model_non_empty_request_with_auto_populated_field(): client.get_model(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == automl_translation.GetModelRequest( + request_msg = automl_translation.GetModelRequest( name="name_value", ) + assert args[0] == request_msg def test_get_model_use_cached_wrapped_rpc(): @@ -15375,9 +15437,14 @@ async def test_get_model_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_model_async( - transport: str = "grpc_asyncio", request_type=automl_translation.GetModelRequest -): +@pytest.mark.parametrize( + "request_type", + [ + automl_translation.GetModelRequest(), + {}, + ], +) +async def test_get_model_async(request_type, transport: str = "grpc_asyncio"): client = TranslationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -15385,7 +15452,7 @@ async def test_get_model_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_model), "__call__") as call: @@ -15422,11 +15489,6 @@ async def test_get_model_async( assert response.test_example_count == 1939 -@pytest.mark.asyncio -async def test_get_model_async_from_dict(): - await test_get_model_async(request_type=dict) - - def test_get_model_field_headers(): client = TranslationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15573,8 +15635,8 @@ async def test_get_model_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - automl_translation.DeleteModelRequest, - dict, + automl_translation.DeleteModelRequest(), + {}, ], ) def test_delete_model(request_type, transport: str = "grpc"): @@ -15585,7 +15647,7 @@ def test_delete_model(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_model), "__call__") as call: @@ -15626,9 +15688,10 @@ def test_delete_model_non_empty_request_with_auto_populated_field(): client.delete_model(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == automl_translation.DeleteModelRequest( + request_msg = automl_translation.DeleteModelRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_model_use_cached_wrapped_rpc(): @@ -15719,9 +15782,14 @@ async def test_delete_model_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_model_async( - transport: str = "grpc_asyncio", request_type=automl_translation.DeleteModelRequest -): +@pytest.mark.parametrize( + "request_type", + [ + automl_translation.DeleteModelRequest(), + {}, + ], +) +async def test_delete_model_async(request_type, transport: str = "grpc_asyncio"): client = TranslationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -15729,7 +15797,7 @@ async def test_delete_model_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_model), "__call__") as call: @@ -15749,11 +15817,6 @@ async def test_delete_model_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_model_async_from_dict(): - await test_delete_model_async(request_type=dict) - - def test_delete_model_field_headers(): client = TranslationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -23667,7 +23730,6 @@ def test_translate_text_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.TranslateTextRequest() - assert args[0] == request_msg @@ -23688,7 +23750,6 @@ def test_romanize_text_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.RomanizeTextRequest() - assert args[0] == request_msg @@ -23709,7 +23770,6 @@ def test_detect_language_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.DetectLanguageRequest() - assert args[0] == request_msg @@ -23732,7 +23792,6 @@ def test_get_supported_languages_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.GetSupportedLanguagesRequest() - assert args[0] == request_msg @@ -23755,7 +23814,6 @@ def test_translate_document_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.TranslateDocumentRequest() - assert args[0] == request_msg @@ -23778,7 +23836,6 @@ def test_batch_translate_text_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.BatchTranslateTextRequest() - assert args[0] == request_msg @@ -23801,7 +23858,6 @@ def test_batch_translate_document_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.BatchTranslateDocumentRequest() - assert args[0] == request_msg @@ -23822,7 +23878,6 @@ def test_create_glossary_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.CreateGlossaryRequest() - assert args[0] == request_msg @@ -23843,7 +23898,6 @@ def test_update_glossary_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.UpdateGlossaryRequest() - assert args[0] == request_msg @@ -23864,7 +23918,6 @@ def test_list_glossaries_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.ListGlossariesRequest() - assert args[0] == request_msg @@ -23885,7 +23938,6 @@ def test_get_glossary_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.GetGlossaryRequest() - assert args[0] == request_msg @@ -23906,7 +23958,6 @@ def test_delete_glossary_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.DeleteGlossaryRequest() - assert args[0] == request_msg @@ -23929,7 +23980,6 @@ def test_get_glossary_entry_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.GetGlossaryEntryRequest() - assert args[0] == request_msg @@ -23952,7 +24002,6 @@ def test_list_glossary_entries_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.ListGlossaryEntriesRequest() - assert args[0] == request_msg @@ -23975,7 +24024,6 @@ def test_create_glossary_entry_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.CreateGlossaryEntryRequest() - assert args[0] == request_msg @@ -23998,7 +24046,6 @@ def test_update_glossary_entry_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.UpdateGlossaryEntryRequest() - assert args[0] == request_msg @@ -24021,7 +24068,6 @@ def test_delete_glossary_entry_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.DeleteGlossaryEntryRequest() - assert args[0] == request_msg @@ -24042,7 +24088,6 @@ def test_create_dataset_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = automl_translation.CreateDatasetRequest() - assert args[0] == request_msg @@ -24063,7 +24108,6 @@ def test_get_dataset_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = automl_translation.GetDatasetRequest() - assert args[0] == request_msg @@ -24084,7 +24128,6 @@ def test_list_datasets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = automl_translation.ListDatasetsRequest() - assert args[0] == request_msg @@ -24105,7 +24148,6 @@ def test_delete_dataset_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = automl_translation.DeleteDatasetRequest() - assert args[0] == request_msg @@ -24128,7 +24170,6 @@ def test_create_adaptive_mt_dataset_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = adaptive_mt.CreateAdaptiveMtDatasetRequest() - assert args[0] == request_msg @@ -24151,7 +24192,6 @@ def test_delete_adaptive_mt_dataset_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = adaptive_mt.DeleteAdaptiveMtDatasetRequest() - assert args[0] == request_msg @@ -24174,7 +24214,6 @@ def test_get_adaptive_mt_dataset_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = adaptive_mt.GetAdaptiveMtDatasetRequest() - assert args[0] == request_msg @@ -24197,7 +24236,6 @@ def test_list_adaptive_mt_datasets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = adaptive_mt.ListAdaptiveMtDatasetsRequest() - assert args[0] == request_msg @@ -24220,7 +24258,6 @@ def test_adaptive_mt_translate_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = adaptive_mt.AdaptiveMtTranslateRequest() - assert args[0] == request_msg @@ -24243,7 +24280,6 @@ def test_get_adaptive_mt_file_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = adaptive_mt.GetAdaptiveMtFileRequest() - assert args[0] == request_msg @@ -24266,7 +24302,6 @@ def test_delete_adaptive_mt_file_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = adaptive_mt.DeleteAdaptiveMtFileRequest() - assert args[0] == request_msg @@ -24289,7 +24324,6 @@ def test_import_adaptive_mt_file_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = adaptive_mt.ImportAdaptiveMtFileRequest() - assert args[0] == request_msg @@ -24312,7 +24346,6 @@ def test_list_adaptive_mt_files_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = adaptive_mt.ListAdaptiveMtFilesRequest() - assert args[0] == request_msg @@ -24335,7 +24368,6 @@ def test_list_adaptive_mt_sentences_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = adaptive_mt.ListAdaptiveMtSentencesRequest() - assert args[0] == request_msg @@ -24356,7 +24388,6 @@ def test_import_data_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = automl_translation.ImportDataRequest() - assert args[0] == request_msg @@ -24377,7 +24408,6 @@ def test_export_data_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = automl_translation.ExportDataRequest() - assert args[0] == request_msg @@ -24398,7 +24428,6 @@ def test_list_examples_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = automl_translation.ListExamplesRequest() - assert args[0] == request_msg @@ -24419,7 +24448,6 @@ def test_create_model_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = automl_translation.CreateModelRequest() - assert args[0] == request_msg @@ -24440,7 +24468,6 @@ def test_list_models_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = automl_translation.ListModelsRequest() - assert args[0] == request_msg @@ -24461,7 +24488,6 @@ def test_get_model_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = automl_translation.GetModelRequest() - assert args[0] == request_msg @@ -24482,7 +24508,6 @@ def test_delete_model_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = automl_translation.DeleteModelRequest() - assert args[0] == request_msg @@ -24521,7 +24546,6 @@ async def test_translate_text_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.TranslateTextRequest() - assert args[0] == request_msg @@ -24546,7 +24570,6 @@ async def test_romanize_text_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.RomanizeTextRequest() - assert args[0] == request_msg @@ -24571,7 +24594,6 @@ async def test_detect_language_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.DetectLanguageRequest() - assert args[0] == request_msg @@ -24598,7 +24620,6 @@ async def test_get_supported_languages_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.GetSupportedLanguagesRequest() - assert args[0] == request_msg @@ -24627,7 +24648,6 @@ async def test_translate_document_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.TranslateDocumentRequest() - assert args[0] == request_msg @@ -24654,7 +24674,6 @@ async def test_batch_translate_text_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.BatchTranslateTextRequest() - assert args[0] == request_msg @@ -24681,7 +24700,6 @@ async def test_batch_translate_document_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.BatchTranslateDocumentRequest() - assert args[0] == request_msg @@ -24706,7 +24724,6 @@ async def test_create_glossary_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.CreateGlossaryRequest() - assert args[0] == request_msg @@ -24731,7 +24748,6 @@ async def test_update_glossary_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.UpdateGlossaryRequest() - assert args[0] == request_msg @@ -24758,7 +24774,6 @@ async def test_list_glossaries_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.ListGlossariesRequest() - assert args[0] == request_msg @@ -24787,7 +24802,6 @@ async def test_get_glossary_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.GetGlossaryRequest() - assert args[0] == request_msg @@ -24812,7 +24826,6 @@ async def test_delete_glossary_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.DeleteGlossaryRequest() - assert args[0] == request_msg @@ -24842,7 +24855,6 @@ async def test_get_glossary_entry_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.GetGlossaryEntryRequest() - assert args[0] == request_msg @@ -24871,7 +24883,6 @@ async def test_list_glossary_entries_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.ListGlossaryEntriesRequest() - assert args[0] == request_msg @@ -24901,7 +24912,6 @@ async def test_create_glossary_entry_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.CreateGlossaryEntryRequest() - assert args[0] == request_msg @@ -24931,7 +24941,6 @@ async def test_update_glossary_entry_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.UpdateGlossaryEntryRequest() - assert args[0] == request_msg @@ -24956,7 +24965,6 @@ async def test_delete_glossary_entry_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.DeleteGlossaryEntryRequest() - assert args[0] == request_msg @@ -24981,7 +24989,6 @@ async def test_create_dataset_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = automl_translation.CreateDatasetRequest() - assert args[0] == request_msg @@ -25015,7 +25022,6 @@ async def test_get_dataset_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = automl_translation.GetDatasetRequest() - assert args[0] == request_msg @@ -25042,7 +25048,6 @@ async def test_list_datasets_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = automl_translation.ListDatasetsRequest() - assert args[0] == request_msg @@ -25067,7 +25072,6 @@ async def test_delete_dataset_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = automl_translation.DeleteDatasetRequest() - assert args[0] == request_msg @@ -25100,7 +25104,6 @@ async def test_create_adaptive_mt_dataset_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = adaptive_mt.CreateAdaptiveMtDatasetRequest() - assert args[0] == request_msg @@ -25125,7 +25128,6 @@ async def test_delete_adaptive_mt_dataset_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = adaptive_mt.DeleteAdaptiveMtDatasetRequest() - assert args[0] == request_msg @@ -25158,7 +25160,6 @@ async def test_get_adaptive_mt_dataset_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = adaptive_mt.GetAdaptiveMtDatasetRequest() - assert args[0] == request_msg @@ -25187,7 +25188,6 @@ async def test_list_adaptive_mt_datasets_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = adaptive_mt.ListAdaptiveMtDatasetsRequest() - assert args[0] == request_msg @@ -25216,7 +25216,6 @@ async def test_adaptive_mt_translate_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = adaptive_mt.AdaptiveMtTranslateRequest() - assert args[0] == request_msg @@ -25247,7 +25246,6 @@ async def test_get_adaptive_mt_file_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = adaptive_mt.GetAdaptiveMtFileRequest() - assert args[0] == request_msg @@ -25272,7 +25270,6 @@ async def test_delete_adaptive_mt_file_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = adaptive_mt.DeleteAdaptiveMtFileRequest() - assert args[0] == request_msg @@ -25299,7 +25296,6 @@ async def test_import_adaptive_mt_file_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = adaptive_mt.ImportAdaptiveMtFileRequest() - assert args[0] == request_msg @@ -25328,7 +25324,6 @@ async def test_list_adaptive_mt_files_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = adaptive_mt.ListAdaptiveMtFilesRequest() - assert args[0] == request_msg @@ -25357,7 +25352,6 @@ async def test_list_adaptive_mt_sentences_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = adaptive_mt.ListAdaptiveMtSentencesRequest() - assert args[0] == request_msg @@ -25382,7 +25376,6 @@ async def test_import_data_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = automl_translation.ImportDataRequest() - assert args[0] == request_msg @@ -25407,7 +25400,6 @@ async def test_export_data_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = automl_translation.ExportDataRequest() - assert args[0] == request_msg @@ -25434,7 +25426,6 @@ async def test_list_examples_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = automl_translation.ListExamplesRequest() - assert args[0] == request_msg @@ -25459,7 +25450,6 @@ async def test_create_model_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = automl_translation.CreateModelRequest() - assert args[0] == request_msg @@ -25486,7 +25476,6 @@ async def test_list_models_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = automl_translation.ListModelsRequest() - assert args[0] == request_msg @@ -25520,7 +25509,6 @@ async def test_get_model_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = automl_translation.GetModelRequest() - assert args[0] == request_msg @@ -25545,7 +25533,6 @@ async def test_delete_model_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = automl_translation.DeleteModelRequest() - assert args[0] == request_msg @@ -31615,7 +31602,6 @@ def test_translate_text_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.TranslateTextRequest() - assert args[0] == request_msg @@ -31635,7 +31621,6 @@ def test_romanize_text_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.RomanizeTextRequest() - assert args[0] == request_msg @@ -31655,7 +31640,6 @@ def test_detect_language_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.DetectLanguageRequest() - assert args[0] == request_msg @@ -31677,7 +31661,6 @@ def test_get_supported_languages_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.GetSupportedLanguagesRequest() - assert args[0] == request_msg @@ -31699,7 +31682,6 @@ def test_translate_document_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.TranslateDocumentRequest() - assert args[0] == request_msg @@ -31721,7 +31703,6 @@ def test_batch_translate_text_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.BatchTranslateTextRequest() - assert args[0] == request_msg @@ -31743,7 +31724,6 @@ def test_batch_translate_document_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.BatchTranslateDocumentRequest() - assert args[0] == request_msg @@ -31763,7 +31743,6 @@ def test_create_glossary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.CreateGlossaryRequest() - assert args[0] == request_msg @@ -31783,7 +31762,6 @@ def test_update_glossary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.UpdateGlossaryRequest() - assert args[0] == request_msg @@ -31803,7 +31781,6 @@ def test_list_glossaries_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.ListGlossariesRequest() - assert args[0] == request_msg @@ -31823,7 +31800,6 @@ def test_get_glossary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.GetGlossaryRequest() - assert args[0] == request_msg @@ -31843,7 +31819,6 @@ def test_delete_glossary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.DeleteGlossaryRequest() - assert args[0] == request_msg @@ -31865,7 +31840,6 @@ def test_get_glossary_entry_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.GetGlossaryEntryRequest() - assert args[0] == request_msg @@ -31887,7 +31861,6 @@ def test_list_glossary_entries_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.ListGlossaryEntriesRequest() - assert args[0] == request_msg @@ -31909,7 +31882,6 @@ def test_create_glossary_entry_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.CreateGlossaryEntryRequest() - assert args[0] == request_msg @@ -31931,7 +31903,6 @@ def test_update_glossary_entry_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.UpdateGlossaryEntryRequest() - assert args[0] == request_msg @@ -31953,7 +31924,6 @@ def test_delete_glossary_entry_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.DeleteGlossaryEntryRequest() - assert args[0] == request_msg @@ -31973,7 +31943,6 @@ def test_create_dataset_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = automl_translation.CreateDatasetRequest() - assert args[0] == request_msg @@ -31993,7 +31962,6 @@ def test_get_dataset_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = automl_translation.GetDatasetRequest() - assert args[0] == request_msg @@ -32013,7 +31981,6 @@ def test_list_datasets_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = automl_translation.ListDatasetsRequest() - assert args[0] == request_msg @@ -32033,7 +32000,6 @@ def test_delete_dataset_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = automl_translation.DeleteDatasetRequest() - assert args[0] == request_msg @@ -32055,7 +32021,6 @@ def test_create_adaptive_mt_dataset_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = adaptive_mt.CreateAdaptiveMtDatasetRequest() - assert args[0] == request_msg @@ -32077,7 +32042,6 @@ def test_delete_adaptive_mt_dataset_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = adaptive_mt.DeleteAdaptiveMtDatasetRequest() - assert args[0] == request_msg @@ -32099,7 +32063,6 @@ def test_get_adaptive_mt_dataset_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = adaptive_mt.GetAdaptiveMtDatasetRequest() - assert args[0] == request_msg @@ -32121,7 +32084,6 @@ def test_list_adaptive_mt_datasets_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = adaptive_mt.ListAdaptiveMtDatasetsRequest() - assert args[0] == request_msg @@ -32143,7 +32105,6 @@ def test_adaptive_mt_translate_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = adaptive_mt.AdaptiveMtTranslateRequest() - assert args[0] == request_msg @@ -32165,7 +32126,6 @@ def test_get_adaptive_mt_file_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = adaptive_mt.GetAdaptiveMtFileRequest() - assert args[0] == request_msg @@ -32187,7 +32147,6 @@ def test_delete_adaptive_mt_file_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = adaptive_mt.DeleteAdaptiveMtFileRequest() - assert args[0] == request_msg @@ -32209,7 +32168,6 @@ def test_import_adaptive_mt_file_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = adaptive_mt.ImportAdaptiveMtFileRequest() - assert args[0] == request_msg @@ -32231,7 +32189,6 @@ def test_list_adaptive_mt_files_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = adaptive_mt.ListAdaptiveMtFilesRequest() - assert args[0] == request_msg @@ -32253,7 +32210,6 @@ def test_list_adaptive_mt_sentences_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = adaptive_mt.ListAdaptiveMtSentencesRequest() - assert args[0] == request_msg @@ -32273,7 +32229,6 @@ def test_import_data_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = automl_translation.ImportDataRequest() - assert args[0] == request_msg @@ -32293,7 +32248,6 @@ def test_export_data_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = automl_translation.ExportDataRequest() - assert args[0] == request_msg @@ -32313,7 +32267,6 @@ def test_list_examples_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = automl_translation.ListExamplesRequest() - assert args[0] == request_msg @@ -32333,7 +32286,6 @@ def test_create_model_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = automl_translation.CreateModelRequest() - assert args[0] == request_msg @@ -32353,7 +32305,6 @@ def test_list_models_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = automl_translation.ListModelsRequest() - assert args[0] == request_msg @@ -32373,7 +32324,6 @@ def test_get_model_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = automl_translation.GetModelRequest() - assert args[0] == request_msg @@ -32393,7 +32343,6 @@ def test_delete_model_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = automl_translation.DeleteModelRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-translate/tests/unit/gapic/translate_v3beta1/test_translation_service.py b/packages/google-cloud-translate/tests/unit/gapic/translate_v3beta1/test_translation_service.py index ff5a74de3142..a4b35b138495 100644 --- a/packages/google-cloud-translate/tests/unit/gapic/translate_v3beta1/test_translation_service.py +++ b/packages/google-cloud-translate/tests/unit/gapic/translate_v3beta1/test_translation_service.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 @@ -119,6 +120,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" @@ -1367,8 +1383,8 @@ def test_translation_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - translation_service.TranslateTextRequest, - dict, + translation_service.TranslateTextRequest(), + {}, ], ) def test_translate_text(request_type, transport: str = "grpc"): @@ -1379,7 +1395,7 @@ def test_translate_text(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.translate_text), "__call__") as call: @@ -1424,13 +1440,14 @@ def test_translate_text_non_empty_request_with_auto_populated_field(): client.translate_text(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == translation_service.TranslateTextRequest( + request_msg = translation_service.TranslateTextRequest( mime_type="mime_type_value", source_language_code="source_language_code_value", target_language_code="target_language_code_value", parent="parent_value", model="model_value", ) + assert args[0] == request_msg def test_translate_text_use_cached_wrapped_rpc(): @@ -1511,10 +1528,14 @@ async def test_translate_text_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_translate_text_async( - transport: str = "grpc_asyncio", - request_type=translation_service.TranslateTextRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + translation_service.TranslateTextRequest(), + {}, + ], +) +async def test_translate_text_async(request_type, transport: str = "grpc_asyncio"): client = TranslationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1522,7 +1543,7 @@ async def test_translate_text_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.translate_text), "__call__") as call: @@ -1542,11 +1563,6 @@ async def test_translate_text_async( assert isinstance(response, translation_service.TranslateTextResponse) -@pytest.mark.asyncio -async def test_translate_text_async_from_dict(): - await test_translate_text_async(request_type=dict) - - def test_translate_text_field_headers(): client = TranslationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1611,8 +1627,8 @@ async def test_translate_text_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - translation_service.DetectLanguageRequest, - dict, + translation_service.DetectLanguageRequest(), + {}, ], ) def test_detect_language(request_type, transport: str = "grpc"): @@ -1623,7 +1639,7 @@ def test_detect_language(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.detect_language), "__call__") as call: @@ -1667,12 +1683,13 @@ def test_detect_language_non_empty_request_with_auto_populated_field(): client.detect_language(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == translation_service.DetectLanguageRequest( + request_msg = translation_service.DetectLanguageRequest( parent="parent_value", model="model_value", content="content_value", mime_type="mime_type_value", ) + assert args[0] == request_msg def test_detect_language_use_cached_wrapped_rpc(): @@ -1753,10 +1770,14 @@ async def test_detect_language_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_detect_language_async( - transport: str = "grpc_asyncio", - request_type=translation_service.DetectLanguageRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + translation_service.DetectLanguageRequest(), + {}, + ], +) +async def test_detect_language_async(request_type, transport: str = "grpc_asyncio"): client = TranslationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1764,7 +1785,7 @@ async def test_detect_language_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.detect_language), "__call__") as call: @@ -1784,11 +1805,6 @@ async def test_detect_language_async( assert isinstance(response, translation_service.DetectLanguageResponse) -@pytest.mark.asyncio -async def test_detect_language_async_from_dict(): - await test_detect_language_async(request_type=dict) - - def test_detect_language_field_headers(): client = TranslationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1955,8 +1971,8 @@ async def test_detect_language_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - translation_service.GetSupportedLanguagesRequest, - dict, + translation_service.GetSupportedLanguagesRequest(), + {}, ], ) def test_get_supported_languages(request_type, transport: str = "grpc"): @@ -1967,7 +1983,7 @@ def test_get_supported_languages(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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 +2030,12 @@ def test_get_supported_languages_non_empty_request_with_auto_populated_field(): client.get_supported_languages(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == translation_service.GetSupportedLanguagesRequest( + request_msg = translation_service.GetSupportedLanguagesRequest( parent="parent_value", display_language_code="display_language_code_value", model="model_value", ) + assert args[0] == request_msg def test_get_supported_languages_use_cached_wrapped_rpc(): @@ -2104,9 +2121,15 @@ async def test_get_supported_languages_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + translation_service.GetSupportedLanguagesRequest(), + {}, + ], +) async def test_get_supported_languages_async( - transport: str = "grpc_asyncio", - request_type=translation_service.GetSupportedLanguagesRequest, + request_type, transport: str = "grpc_asyncio" ): client = TranslationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2115,7 +2138,7 @@ async def test_get_supported_languages_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( @@ -2137,11 +2160,6 @@ async def test_get_supported_languages_async( assert isinstance(response, translation_service.SupportedLanguages) -@pytest.mark.asyncio -async def test_get_supported_languages_async_from_dict(): - await test_get_supported_languages_async(request_type=dict) - - def test_get_supported_languages_field_headers(): client = TranslationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2316,8 +2334,8 @@ async def test_get_supported_languages_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - translation_service.TranslateDocumentRequest, - dict, + translation_service.TranslateDocumentRequest(), + {}, ], ) def test_translate_document(request_type, transport: str = "grpc"): @@ -2328,7 +2346,7 @@ def test_translate_document(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2380,13 +2398,14 @@ def test_translate_document_non_empty_request_with_auto_populated_field(): client.translate_document(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == translation_service.TranslateDocumentRequest( + request_msg = translation_service.TranslateDocumentRequest( parent="parent_value", source_language_code="source_language_code_value", target_language_code="target_language_code_value", model="model_value", customized_attribution="customized_attribution_value", ) + assert args[0] == request_msg def test_translate_document_use_cached_wrapped_rpc(): @@ -2471,10 +2490,14 @@ async def test_translate_document_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_translate_document_async( - transport: str = "grpc_asyncio", - request_type=translation_service.TranslateDocumentRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + translation_service.TranslateDocumentRequest(), + {}, + ], +) +async def test_translate_document_async(request_type, transport: str = "grpc_asyncio"): client = TranslationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2482,7 +2505,7 @@ async def test_translate_document_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( @@ -2507,11 +2530,6 @@ async def test_translate_document_async( assert response.model == "model_value" -@pytest.mark.asyncio -async def test_translate_document_async_from_dict(): - await test_translate_document_async(request_type=dict) - - def test_translate_document_field_headers(): client = TranslationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2580,8 +2598,8 @@ async def test_translate_document_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - translation_service.BatchTranslateTextRequest, - dict, + translation_service.BatchTranslateTextRequest(), + {}, ], ) def test_batch_translate_text(request_type, transport: str = "grpc"): @@ -2592,7 +2610,7 @@ def test_batch_translate_text(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2638,10 +2656,11 @@ def test_batch_translate_text_non_empty_request_with_auto_populated_field(): client.batch_translate_text(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == translation_service.BatchTranslateTextRequest( + request_msg = translation_service.BatchTranslateTextRequest( parent="parent_value", source_language_code="source_language_code_value", ) + assert args[0] == request_msg def test_batch_translate_text_use_cached_wrapped_rpc(): @@ -2736,9 +2755,15 @@ async def test_batch_translate_text_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + translation_service.BatchTranslateTextRequest(), + {}, + ], +) async def test_batch_translate_text_async( - transport: str = "grpc_asyncio", - request_type=translation_service.BatchTranslateTextRequest, + request_type, transport: str = "grpc_asyncio" ): client = TranslationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2747,7 +2772,7 @@ async def test_batch_translate_text_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( @@ -2769,11 +2794,6 @@ async def test_batch_translate_text_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_batch_translate_text_async_from_dict(): - await test_batch_translate_text_async(request_type=dict) - - def test_batch_translate_text_field_headers(): client = TranslationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2842,8 +2862,8 @@ async def test_batch_translate_text_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - translation_service.BatchTranslateDocumentRequest, - dict, + translation_service.BatchTranslateDocumentRequest(), + {}, ], ) def test_batch_translate_document(request_type, transport: str = "grpc"): @@ -2854,7 +2874,7 @@ def test_batch_translate_document(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2901,11 +2921,12 @@ def test_batch_translate_document_non_empty_request_with_auto_populated_field(): client.batch_translate_document(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == translation_service.BatchTranslateDocumentRequest( + request_msg = translation_service.BatchTranslateDocumentRequest( parent="parent_value", source_language_code="source_language_code_value", customized_attribution="customized_attribution_value", ) + assert args[0] == request_msg def test_batch_translate_document_use_cached_wrapped_rpc(): @@ -3001,9 +3022,15 @@ async def test_batch_translate_document_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + translation_service.BatchTranslateDocumentRequest(), + {}, + ], +) async def test_batch_translate_document_async( - transport: str = "grpc_asyncio", - request_type=translation_service.BatchTranslateDocumentRequest, + request_type, transport: str = "grpc_asyncio" ): client = TranslationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3012,7 +3039,7 @@ async def test_batch_translate_document_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( @@ -3034,11 +3061,6 @@ async def test_batch_translate_document_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_batch_translate_document_async_from_dict(): - await test_batch_translate_document_async(request_type=dict) - - def test_batch_translate_document_field_headers(): client = TranslationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3289,8 +3311,8 @@ async def test_batch_translate_document_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - translation_service.CreateGlossaryRequest, - dict, + translation_service.CreateGlossaryRequest(), + {}, ], ) def test_create_glossary(request_type, transport: str = "grpc"): @@ -3301,7 +3323,7 @@ def test_create_glossary(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_glossary), "__call__") as call: @@ -3342,9 +3364,10 @@ def test_create_glossary_non_empty_request_with_auto_populated_field(): client.create_glossary(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == translation_service.CreateGlossaryRequest( + request_msg = translation_service.CreateGlossaryRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_glossary_use_cached_wrapped_rpc(): @@ -3435,10 +3458,14 @@ async def test_create_glossary_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_glossary_async( - transport: str = "grpc_asyncio", - request_type=translation_service.CreateGlossaryRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + translation_service.CreateGlossaryRequest(), + {}, + ], +) +async def test_create_glossary_async(request_type, transport: str = "grpc_asyncio"): client = TranslationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3446,7 +3473,7 @@ async def test_create_glossary_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_glossary), "__call__") as call: @@ -3466,11 +3493,6 @@ async def test_create_glossary_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_glossary_async_from_dict(): - await test_create_glossary_async(request_type=dict) - - def test_create_glossary_field_headers(): client = TranslationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3627,8 +3649,8 @@ async def test_create_glossary_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - translation_service.ListGlossariesRequest, - dict, + translation_service.ListGlossariesRequest(), + {}, ], ) def test_list_glossaries(request_type, transport: str = "grpc"): @@ -3639,7 +3661,7 @@ def test_list_glossaries(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_glossaries), "__call__") as call: @@ -3685,11 +3707,12 @@ def test_list_glossaries_non_empty_request_with_auto_populated_field(): client.list_glossaries(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == translation_service.ListGlossariesRequest( + request_msg = translation_service.ListGlossariesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_glossaries_use_cached_wrapped_rpc(): @@ -3770,10 +3793,14 @@ async def test_list_glossaries_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_glossaries_async( - transport: str = "grpc_asyncio", - request_type=translation_service.ListGlossariesRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + translation_service.ListGlossariesRequest(), + {}, + ], +) +async def test_list_glossaries_async(request_type, transport: str = "grpc_asyncio"): client = TranslationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3781,7 +3808,7 @@ async def test_list_glossaries_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_glossaries), "__call__") as call: @@ -3804,11 +3831,6 @@ async def test_list_glossaries_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_glossaries_async_from_dict(): - await test_list_glossaries_async(request_type=dict) - - def test_list_glossaries_field_headers(): client = TranslationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4155,8 +4177,8 @@ async def test_list_glossaries_async_pages(): @pytest.mark.parametrize( "request_type", [ - translation_service.GetGlossaryRequest, - dict, + translation_service.GetGlossaryRequest(), + {}, ], ) def test_get_glossary(request_type, transport: str = "grpc"): @@ -4167,7 +4189,7 @@ def test_get_glossary(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_glossary), "__call__") as call: @@ -4213,9 +4235,10 @@ def test_get_glossary_non_empty_request_with_auto_populated_field(): client.get_glossary(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == translation_service.GetGlossaryRequest( + request_msg = translation_service.GetGlossaryRequest( name="name_value", ) + assert args[0] == request_msg def test_get_glossary_use_cached_wrapped_rpc(): @@ -4296,9 +4319,14 @@ async def test_get_glossary_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_glossary_async( - transport: str = "grpc_asyncio", request_type=translation_service.GetGlossaryRequest -): +@pytest.mark.parametrize( + "request_type", + [ + translation_service.GetGlossaryRequest(), + {}, + ], +) +async def test_get_glossary_async(request_type, transport: str = "grpc_asyncio"): client = TranslationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4306,7 +4334,7 @@ async def test_get_glossary_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_glossary), "__call__") as call: @@ -4331,11 +4359,6 @@ async def test_get_glossary_async( assert response.entry_count == 1210 -@pytest.mark.asyncio -async def test_get_glossary_async_from_dict(): - await test_get_glossary_async(request_type=dict) - - def test_get_glossary_field_headers(): client = TranslationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4482,8 +4505,8 @@ async def test_get_glossary_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - translation_service.DeleteGlossaryRequest, - dict, + translation_service.DeleteGlossaryRequest(), + {}, ], ) def test_delete_glossary(request_type, transport: str = "grpc"): @@ -4494,7 +4517,7 @@ def test_delete_glossary(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_glossary), "__call__") as call: @@ -4535,9 +4558,10 @@ def test_delete_glossary_non_empty_request_with_auto_populated_field(): client.delete_glossary(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == translation_service.DeleteGlossaryRequest( + request_msg = translation_service.DeleteGlossaryRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_glossary_use_cached_wrapped_rpc(): @@ -4628,10 +4652,14 @@ async def test_delete_glossary_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_glossary_async( - transport: str = "grpc_asyncio", - request_type=translation_service.DeleteGlossaryRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + translation_service.DeleteGlossaryRequest(), + {}, + ], +) +async def test_delete_glossary_async(request_type, transport: str = "grpc_asyncio"): client = TranslationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4639,7 +4667,7 @@ async def test_delete_glossary_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_glossary), "__call__") as call: @@ -4659,11 +4687,6 @@ async def test_delete_glossary_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_glossary_async_from_dict(): - await test_delete_glossary_async(request_type=dict) - - def test_delete_glossary_field_headers(): client = TranslationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4810,8 +4833,8 @@ async def test_delete_glossary_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - translation_service.RefineTextRequest, - dict, + translation_service.RefineTextRequest(), + {}, ], ) def test_refine_text(request_type, transport: str = "grpc"): @@ -4822,7 +4845,7 @@ def test_refine_text(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.refine_text), "__call__") as call: @@ -4868,11 +4891,12 @@ def test_refine_text_non_empty_request_with_auto_populated_field(): client.refine_text(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == translation_service.RefineTextRequest( + request_msg = translation_service.RefineTextRequest( parent="parent_value", source_language_code="source_language_code_value", target_language_code="target_language_code_value", ) + assert args[0] == request_msg def test_refine_text_use_cached_wrapped_rpc(): @@ -4953,9 +4977,14 @@ async def test_refine_text_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_refine_text_async( - transport: str = "grpc_asyncio", request_type=translation_service.RefineTextRequest -): +@pytest.mark.parametrize( + "request_type", + [ + translation_service.RefineTextRequest(), + {}, + ], +) +async def test_refine_text_async(request_type, transport: str = "grpc_asyncio"): client = TranslationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4963,7 +4992,7 @@ async def test_refine_text_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.refine_text), "__call__") as call: @@ -4986,11 +5015,6 @@ async def test_refine_text_async( assert response.refined_translations == ["refined_translations_value"] -@pytest.mark.asyncio -async def test_refine_text_async_from_dict(): - await test_refine_text_async(request_type=dict) - - def test_refine_text_field_headers(): client = TranslationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7159,7 +7183,6 @@ def test_translate_text_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.TranslateTextRequest() - assert args[0] == request_msg @@ -7180,7 +7203,6 @@ def test_detect_language_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.DetectLanguageRequest() - assert args[0] == request_msg @@ -7203,7 +7225,6 @@ def test_get_supported_languages_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.GetSupportedLanguagesRequest() - assert args[0] == request_msg @@ -7226,7 +7247,6 @@ def test_translate_document_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.TranslateDocumentRequest() - assert args[0] == request_msg @@ -7249,7 +7269,6 @@ def test_batch_translate_text_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.BatchTranslateTextRequest() - assert args[0] == request_msg @@ -7272,7 +7291,6 @@ def test_batch_translate_document_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.BatchTranslateDocumentRequest() - assert args[0] == request_msg @@ -7293,7 +7311,6 @@ def test_create_glossary_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.CreateGlossaryRequest() - assert args[0] == request_msg @@ -7314,7 +7331,6 @@ def test_list_glossaries_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.ListGlossariesRequest() - assert args[0] == request_msg @@ -7335,7 +7351,6 @@ def test_get_glossary_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.GetGlossaryRequest() - assert args[0] == request_msg @@ -7356,7 +7371,6 @@ def test_delete_glossary_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.DeleteGlossaryRequest() - assert args[0] == request_msg @@ -7377,7 +7391,6 @@ def test_refine_text_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.RefineTextRequest() - assert args[0] == request_msg @@ -7416,7 +7429,6 @@ async def test_translate_text_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.TranslateTextRequest() - assert args[0] == request_msg @@ -7441,7 +7453,6 @@ async def test_detect_language_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.DetectLanguageRequest() - assert args[0] == request_msg @@ -7468,7 +7479,6 @@ async def test_get_supported_languages_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.GetSupportedLanguagesRequest() - assert args[0] == request_msg @@ -7497,7 +7507,6 @@ async def test_translate_document_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.TranslateDocumentRequest() - assert args[0] == request_msg @@ -7524,7 +7533,6 @@ async def test_batch_translate_text_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.BatchTranslateTextRequest() - assert args[0] == request_msg @@ -7551,7 +7559,6 @@ async def test_batch_translate_document_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.BatchTranslateDocumentRequest() - assert args[0] == request_msg @@ -7576,7 +7583,6 @@ async def test_create_glossary_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.CreateGlossaryRequest() - assert args[0] == request_msg @@ -7603,7 +7609,6 @@ async def test_list_glossaries_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.ListGlossariesRequest() - assert args[0] == request_msg @@ -7631,7 +7636,6 @@ async def test_get_glossary_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.GetGlossaryRequest() - assert args[0] == request_msg @@ -7656,7 +7660,6 @@ async def test_delete_glossary_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.DeleteGlossaryRequest() - assert args[0] == request_msg @@ -7683,7 +7686,6 @@ async def test_refine_text_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.RefineTextRequest() - assert args[0] == request_msg @@ -9682,7 +9684,6 @@ def test_translate_text_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.TranslateTextRequest() - assert args[0] == request_msg @@ -9702,7 +9703,6 @@ def test_detect_language_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.DetectLanguageRequest() - assert args[0] == request_msg @@ -9724,7 +9724,6 @@ def test_get_supported_languages_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.GetSupportedLanguagesRequest() - assert args[0] == request_msg @@ -9746,7 +9745,6 @@ def test_translate_document_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.TranslateDocumentRequest() - assert args[0] == request_msg @@ -9768,7 +9766,6 @@ def test_batch_translate_text_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.BatchTranslateTextRequest() - assert args[0] == request_msg @@ -9790,7 +9787,6 @@ def test_batch_translate_document_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.BatchTranslateDocumentRequest() - assert args[0] == request_msg @@ -9810,7 +9806,6 @@ def test_create_glossary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.CreateGlossaryRequest() - assert args[0] == request_msg @@ -9830,7 +9825,6 @@ def test_list_glossaries_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.ListGlossariesRequest() - assert args[0] == request_msg @@ -9850,7 +9844,6 @@ def test_get_glossary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.GetGlossaryRequest() - assert args[0] == request_msg @@ -9870,7 +9863,6 @@ def test_delete_glossary_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.DeleteGlossaryRequest() - assert args[0] == request_msg @@ -9890,7 +9882,6 @@ def test_refine_text_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = translation_service.RefineTextRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-vectorsearch/noxfile.py b/packages/google-cloud-vectorsearch/noxfile.py index 1571af3cf000..a0a96a3b681b 100644 --- a/packages/google-cloud-vectorsearch/noxfile.py +++ b/packages/google-cloud-vectorsearch/noxfile.py @@ -47,7 +47,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-vectorsearch" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-vectorsearch/setup.py b/packages/google-cloud-vectorsearch/setup.py index e5a17d807792..d1b95b1755fa 100644 --- a/packages/google-cloud-vectorsearch/setup.py +++ b/packages/google-cloud-vectorsearch/setup.py @@ -45,7 +45,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/google-cloud-vectorsearch/testing/constraints-3.10.txt b/packages/google-cloud-vectorsearch/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-vectorsearch/testing/constraints-3.10.txt +++ b/packages/google-cloud-vectorsearch/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-vectorsearch/tests/unit/gapic/vectorsearch_v1/test_data_object_search_service.py b/packages/google-cloud-vectorsearch/tests/unit/gapic/vectorsearch_v1/test_data_object_search_service.py index b0e18642a089..72f858f7351d 100644 --- a/packages/google-cloud-vectorsearch/tests/unit/gapic/vectorsearch_v1/test_data_object_search_service.py +++ b/packages/google-cloud-vectorsearch/tests/unit/gapic/vectorsearch_v1/test_data_object_search_service.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 @@ -115,6 +116,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" @@ -1384,8 +1400,8 @@ def test_data_object_search_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - data_object_search_service.SearchDataObjectsRequest, - dict, + data_object_search_service.SearchDataObjectsRequest(), + {}, ], ) def test_search_data_objects(request_type, transport: str = "grpc"): @@ -1396,7 +1412,7 @@ def test_search_data_objects(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1445,10 +1461,11 @@ def test_search_data_objects_non_empty_request_with_auto_populated_field(): client.search_data_objects(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_object_search_service.SearchDataObjectsRequest( + request_msg = data_object_search_service.SearchDataObjectsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_search_data_objects_use_cached_wrapped_rpc(): @@ -1533,10 +1550,14 @@ async def test_search_data_objects_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_search_data_objects_async( - transport: str = "grpc_asyncio", - request_type=data_object_search_service.SearchDataObjectsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + data_object_search_service.SearchDataObjectsRequest(), + {}, + ], +) +async def test_search_data_objects_async(request_type, transport: str = "grpc_asyncio"): client = DataObjectSearchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1544,7 +1565,7 @@ async def test_search_data_objects_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( @@ -1569,11 +1590,6 @@ async def test_search_data_objects_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_search_data_objects_async_from_dict(): - await test_search_data_objects_async(request_type=dict) - - def test_search_data_objects_field_headers(): client = DataObjectSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1844,8 +1860,8 @@ async def test_search_data_objects_async_pages(): @pytest.mark.parametrize( "request_type", [ - data_object_search_service.QueryDataObjectsRequest, - dict, + data_object_search_service.QueryDataObjectsRequest(), + {}, ], ) def test_query_data_objects(request_type, transport: str = "grpc"): @@ -1856,7 +1872,7 @@ def test_query_data_objects(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1905,10 +1921,11 @@ def test_query_data_objects_non_empty_request_with_auto_populated_field(): client.query_data_objects(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_object_search_service.QueryDataObjectsRequest( + request_msg = data_object_search_service.QueryDataObjectsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_query_data_objects_use_cached_wrapped_rpc(): @@ -1993,10 +2010,14 @@ async def test_query_data_objects_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_query_data_objects_async( - transport: str = "grpc_asyncio", - request_type=data_object_search_service.QueryDataObjectsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + data_object_search_service.QueryDataObjectsRequest(), + {}, + ], +) +async def test_query_data_objects_async(request_type, transport: str = "grpc_asyncio"): client = DataObjectSearchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2004,7 +2025,7 @@ async def test_query_data_objects_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( @@ -2029,11 +2050,6 @@ async def test_query_data_objects_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_query_data_objects_async_from_dict(): - await test_query_data_objects_async(request_type=dict) - - def test_query_data_objects_field_headers(): client = DataObjectSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2300,8 +2316,8 @@ async def test_query_data_objects_async_pages(): @pytest.mark.parametrize( "request_type", [ - data_object_search_service.AggregateDataObjectsRequest, - dict, + data_object_search_service.AggregateDataObjectsRequest(), + {}, ], ) def test_aggregate_data_objects(request_type, transport: str = "grpc"): @@ -2312,7 +2328,7 @@ def test_aggregate_data_objects(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2357,9 +2373,10 @@ def test_aggregate_data_objects_non_empty_request_with_auto_populated_field(): client.aggregate_data_objects(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_object_search_service.AggregateDataObjectsRequest( + request_msg = data_object_search_service.AggregateDataObjectsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_aggregate_data_objects_use_cached_wrapped_rpc(): @@ -2445,9 +2462,15 @@ async def test_aggregate_data_objects_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_object_search_service.AggregateDataObjectsRequest(), + {}, + ], +) async def test_aggregate_data_objects_async( - transport: str = "grpc_asyncio", - request_type=data_object_search_service.AggregateDataObjectsRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataObjectSearchServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2456,7 +2479,7 @@ async def test_aggregate_data_objects_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( @@ -2478,11 +2501,6 @@ async def test_aggregate_data_objects_async( assert isinstance(response, data_object_search_service.AggregateDataObjectsResponse) -@pytest.mark.asyncio -async def test_aggregate_data_objects_async_from_dict(): - await test_aggregate_data_objects_async(request_type=dict) - - def test_aggregate_data_objects_field_headers(): client = DataObjectSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2551,8 +2569,8 @@ async def test_aggregate_data_objects_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - data_object_search_service.BatchSearchDataObjectsRequest, - dict, + data_object_search_service.BatchSearchDataObjectsRequest(), + {}, ], ) def test_batch_search_data_objects(request_type, transport: str = "grpc"): @@ -2563,7 +2581,7 @@ def test_batch_search_data_objects(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2610,9 +2628,10 @@ def test_batch_search_data_objects_non_empty_request_with_auto_populated_field() client.batch_search_data_objects(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_object_search_service.BatchSearchDataObjectsRequest( + request_msg = data_object_search_service.BatchSearchDataObjectsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_batch_search_data_objects_use_cached_wrapped_rpc(): @@ -2698,9 +2717,15 @@ async def test_batch_search_data_objects_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_object_search_service.BatchSearchDataObjectsRequest(), + {}, + ], +) async def test_batch_search_data_objects_async( - transport: str = "grpc_asyncio", - request_type=data_object_search_service.BatchSearchDataObjectsRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataObjectSearchServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2709,7 +2734,7 @@ async def test_batch_search_data_objects_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( @@ -2733,11 +2758,6 @@ async def test_batch_search_data_objects_async( ) -@pytest.mark.asyncio -async def test_batch_search_data_objects_async_from_dict(): - await test_batch_search_data_objects_async(request_type=dict) - - def test_batch_search_data_objects_field_headers(): client = DataObjectSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3588,7 +3608,6 @@ def test_search_data_objects_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_object_search_service.SearchDataObjectsRequest() - assert args[0] == request_msg @@ -3611,7 +3630,6 @@ def test_query_data_objects_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_object_search_service.QueryDataObjectsRequest() - assert args[0] == request_msg @@ -3634,7 +3652,6 @@ def test_aggregate_data_objects_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_object_search_service.AggregateDataObjectsRequest() - assert args[0] == request_msg @@ -3657,7 +3674,6 @@ def test_batch_search_data_objects_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_object_search_service.BatchSearchDataObjectsRequest() - assert args[0] == request_msg @@ -3700,7 +3716,6 @@ async def test_search_data_objects_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_object_search_service.SearchDataObjectsRequest() - assert args[0] == request_msg @@ -3729,7 +3744,6 @@ async def test_query_data_objects_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_object_search_service.QueryDataObjectsRequest() - assert args[0] == request_msg @@ -3756,7 +3770,6 @@ async def test_aggregate_data_objects_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_object_search_service.AggregateDataObjectsRequest() - assert args[0] == request_msg @@ -3783,7 +3796,6 @@ async def test_batch_search_data_objects_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_object_search_service.BatchSearchDataObjectsRequest() - assert args[0] == request_msg @@ -4748,7 +4760,6 @@ def test_search_data_objects_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_object_search_service.SearchDataObjectsRequest() - assert args[0] == request_msg @@ -4770,7 +4781,6 @@ def test_query_data_objects_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_object_search_service.QueryDataObjectsRequest() - assert args[0] == request_msg @@ -4792,7 +4802,6 @@ def test_aggregate_data_objects_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_object_search_service.AggregateDataObjectsRequest() - assert args[0] == request_msg @@ -4814,7 +4823,6 @@ def test_batch_search_data_objects_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_object_search_service.BatchSearchDataObjectsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-vectorsearch/tests/unit/gapic/vectorsearch_v1/test_data_object_service.py b/packages/google-cloud-vectorsearch/tests/unit/gapic/vectorsearch_v1/test_data_object_service.py index 6632e6bcf276..457b05213fe1 100644 --- a/packages/google-cloud-vectorsearch/tests/unit/gapic/vectorsearch_v1/test_data_object_service.py +++ b/packages/google-cloud-vectorsearch/tests/unit/gapic/vectorsearch_v1/test_data_object_service.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" @@ -1353,8 +1369,8 @@ def test_data_object_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - data_object_service.CreateDataObjectRequest, - dict, + data_object_service.CreateDataObjectRequest(), + {}, ], ) def test_create_data_object(request_type, transport: str = "grpc"): @@ -1365,7 +1381,7 @@ def test_create_data_object(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1418,10 +1434,11 @@ def test_create_data_object_non_empty_request_with_auto_populated_field(): client.create_data_object(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_object_service.CreateDataObjectRequest( + request_msg = data_object_service.CreateDataObjectRequest( parent="parent_value", data_object_id="data_object_id_value", ) + assert args[0] == request_msg def test_create_data_object_use_cached_wrapped_rpc(): @@ -1506,10 +1523,14 @@ async def test_create_data_object_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_data_object_async( - transport: str = "grpc_asyncio", - request_type=data_object_service.CreateDataObjectRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + data_object_service.CreateDataObjectRequest(), + {}, + ], +) +async def test_create_data_object_async(request_type, transport: str = "grpc_asyncio"): client = DataObjectServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1517,7 +1538,7 @@ async def test_create_data_object_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( @@ -1546,11 +1567,6 @@ async def test_create_data_object_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_create_data_object_async_from_dict(): - await test_create_data_object_async(request_type=dict) - - def test_create_data_object_field_headers(): client = DataObjectServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1725,8 +1741,8 @@ async def test_create_data_object_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_object_service.BatchCreateDataObjectsRequest, - dict, + data_object_service.BatchCreateDataObjectsRequest(), + {}, ], ) def test_batch_create_data_objects(request_type, transport: str = "grpc"): @@ -1737,7 +1753,7 @@ def test_batch_create_data_objects(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1782,9 +1798,10 @@ def test_batch_create_data_objects_non_empty_request_with_auto_populated_field() client.batch_create_data_objects(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_object_service.BatchCreateDataObjectsRequest( + request_msg = data_object_service.BatchCreateDataObjectsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_batch_create_data_objects_use_cached_wrapped_rpc(): @@ -1870,9 +1887,15 @@ async def test_batch_create_data_objects_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_object_service.BatchCreateDataObjectsRequest(), + {}, + ], +) async def test_batch_create_data_objects_async( - transport: str = "grpc_asyncio", - request_type=data_object_service.BatchCreateDataObjectsRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataObjectServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1881,7 +1904,7 @@ async def test_batch_create_data_objects_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( @@ -1903,11 +1926,6 @@ async def test_batch_create_data_objects_async( assert isinstance(response, data_object_service.BatchCreateDataObjectsResponse) -@pytest.mark.asyncio -async def test_batch_create_data_objects_async_from_dict(): - await test_batch_create_data_objects_async(request_type=dict) - - def test_batch_create_data_objects_field_headers(): client = DataObjectServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1976,8 +1994,8 @@ async def test_batch_create_data_objects_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - data_object_service.GetDataObjectRequest, - dict, + data_object_service.GetDataObjectRequest(), + {}, ], ) def test_get_data_object(request_type, transport: str = "grpc"): @@ -1988,7 +2006,7 @@ def test_get_data_object(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_data_object), "__call__") as call: @@ -2036,9 +2054,10 @@ def test_get_data_object_non_empty_request_with_auto_populated_field(): client.get_data_object(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_object_service.GetDataObjectRequest( + request_msg = data_object_service.GetDataObjectRequest( name="name_value", ) + assert args[0] == request_msg def test_get_data_object_use_cached_wrapped_rpc(): @@ -2119,10 +2138,14 @@ async def test_get_data_object_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_data_object_async( - transport: str = "grpc_asyncio", - request_type=data_object_service.GetDataObjectRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + data_object_service.GetDataObjectRequest(), + {}, + ], +) +async def test_get_data_object_async(request_type, transport: str = "grpc_asyncio"): client = DataObjectServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2130,7 +2153,7 @@ async def test_get_data_object_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_data_object), "__call__") as call: @@ -2157,11 +2180,6 @@ async def test_get_data_object_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_data_object_async_from_dict(): - await test_get_data_object_async(request_type=dict) - - def test_get_data_object_field_headers(): client = DataObjectServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2308,8 +2326,8 @@ async def test_get_data_object_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_object_service.UpdateDataObjectRequest, - dict, + data_object_service.UpdateDataObjectRequest(), + {}, ], ) def test_update_data_object(request_type, transport: str = "grpc"): @@ -2320,7 +2338,7 @@ def test_update_data_object(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2370,7 +2388,8 @@ def test_update_data_object_non_empty_request_with_auto_populated_field(): client.update_data_object(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_object_service.UpdateDataObjectRequest() + request_msg = data_object_service.UpdateDataObjectRequest() + assert args[0] == request_msg def test_update_data_object_use_cached_wrapped_rpc(): @@ -2455,10 +2474,14 @@ async def test_update_data_object_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_data_object_async( - transport: str = "grpc_asyncio", - request_type=data_object_service.UpdateDataObjectRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + data_object_service.UpdateDataObjectRequest(), + {}, + ], +) +async def test_update_data_object_async(request_type, transport: str = "grpc_asyncio"): client = DataObjectServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2466,7 +2489,7 @@ async def test_update_data_object_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( @@ -2495,11 +2518,6 @@ async def test_update_data_object_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_update_data_object_async_from_dict(): - await test_update_data_object_async(request_type=dict) - - def test_update_data_object_field_headers(): client = DataObjectServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2664,8 +2682,8 @@ async def test_update_data_object_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_object_service.BatchUpdateDataObjectsRequest, - dict, + data_object_service.BatchUpdateDataObjectsRequest(), + {}, ], ) def test_batch_update_data_objects(request_type, transport: str = "grpc"): @@ -2676,7 +2694,7 @@ def test_batch_update_data_objects(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,9 +2739,10 @@ def test_batch_update_data_objects_non_empty_request_with_auto_populated_field() client.batch_update_data_objects(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_object_service.BatchUpdateDataObjectsRequest( + request_msg = data_object_service.BatchUpdateDataObjectsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_batch_update_data_objects_use_cached_wrapped_rpc(): @@ -2809,9 +2828,15 @@ async def test_batch_update_data_objects_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_object_service.BatchUpdateDataObjectsRequest(), + {}, + ], +) async def test_batch_update_data_objects_async( - transport: str = "grpc_asyncio", - request_type=data_object_service.BatchUpdateDataObjectsRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataObjectServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2820,7 +2845,7 @@ async def test_batch_update_data_objects_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( @@ -2842,11 +2867,6 @@ async def test_batch_update_data_objects_async( assert isinstance(response, data_object_service.BatchUpdateDataObjectsResponse) -@pytest.mark.asyncio -async def test_batch_update_data_objects_async_from_dict(): - await test_batch_update_data_objects_async(request_type=dict) - - def test_batch_update_data_objects_field_headers(): client = DataObjectServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3035,8 +3055,8 @@ async def test_batch_update_data_objects_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_object_service.DeleteDataObjectRequest, - dict, + data_object_service.DeleteDataObjectRequest(), + {}, ], ) def test_delete_data_object(request_type, transport: str = "grpc"): @@ -3047,7 +3067,7 @@ def test_delete_data_object(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3093,10 +3113,11 @@ def test_delete_data_object_non_empty_request_with_auto_populated_field(): client.delete_data_object(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_object_service.DeleteDataObjectRequest( + request_msg = data_object_service.DeleteDataObjectRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_data_object_use_cached_wrapped_rpc(): @@ -3181,10 +3202,14 @@ async def test_delete_data_object_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_data_object_async( - transport: str = "grpc_asyncio", - request_type=data_object_service.DeleteDataObjectRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + data_object_service.DeleteDataObjectRequest(), + {}, + ], +) +async def test_delete_data_object_async(request_type, transport: str = "grpc_asyncio"): client = DataObjectServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3192,7 +3217,7 @@ async def test_delete_data_object_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( @@ -3212,11 +3237,6 @@ async def test_delete_data_object_async( assert response is None -@pytest.mark.asyncio -async def test_delete_data_object_async_from_dict(): - await test_delete_data_object_async(request_type=dict) - - def test_delete_data_object_field_headers(): client = DataObjectServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3367,8 +3387,8 @@ async def test_delete_data_object_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_object_service.BatchDeleteDataObjectsRequest, - dict, + data_object_service.BatchDeleteDataObjectsRequest(), + {}, ], ) def test_batch_delete_data_objects(request_type, transport: str = "grpc"): @@ -3379,7 +3399,7 @@ def test_batch_delete_data_objects(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3424,9 +3444,10 @@ def test_batch_delete_data_objects_non_empty_request_with_auto_populated_field() client.batch_delete_data_objects(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_object_service.BatchDeleteDataObjectsRequest( + request_msg = data_object_service.BatchDeleteDataObjectsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_batch_delete_data_objects_use_cached_wrapped_rpc(): @@ -3512,9 +3533,15 @@ async def test_batch_delete_data_objects_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_object_service.BatchDeleteDataObjectsRequest(), + {}, + ], +) async def test_batch_delete_data_objects_async( - transport: str = "grpc_asyncio", - request_type=data_object_service.BatchDeleteDataObjectsRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataObjectServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3523,7 +3550,7 @@ async def test_batch_delete_data_objects_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( @@ -3543,11 +3570,6 @@ async def test_batch_delete_data_objects_async( assert response is None -@pytest.mark.asyncio -async def test_batch_delete_data_objects_async_from_dict(): - await test_batch_delete_data_objects_async(request_type=dict) - - def test_batch_delete_data_objects_field_headers(): client = DataObjectServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5125,7 +5147,6 @@ def test_create_data_object_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_object_service.CreateDataObjectRequest() - assert args[0] == request_msg @@ -5148,7 +5169,6 @@ def test_batch_create_data_objects_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_object_service.BatchCreateDataObjectsRequest() - assert args[0] == request_msg @@ -5169,7 +5189,6 @@ def test_get_data_object_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_object_service.GetDataObjectRequest() - assert args[0] == request_msg @@ -5192,7 +5211,6 @@ def test_update_data_object_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_object_service.UpdateDataObjectRequest() - assert args[0] == request_msg @@ -5215,7 +5233,6 @@ def test_batch_update_data_objects_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_object_service.BatchUpdateDataObjectsRequest() - assert args[0] == request_msg @@ -5238,7 +5255,6 @@ def test_delete_data_object_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_object_service.DeleteDataObjectRequest() - assert args[0] == request_msg @@ -5261,7 +5277,6 @@ def test_batch_delete_data_objects_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_object_service.BatchDeleteDataObjectsRequest() - assert args[0] == request_msg @@ -5306,7 +5321,6 @@ async def test_create_data_object_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_object_service.CreateDataObjectRequest() - assert args[0] == request_msg @@ -5333,7 +5347,6 @@ async def test_batch_create_data_objects_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_object_service.BatchCreateDataObjectsRequest() - assert args[0] == request_msg @@ -5362,7 +5375,6 @@ async def test_get_data_object_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_object_service.GetDataObjectRequest() - assert args[0] == request_msg @@ -5393,7 +5405,6 @@ async def test_update_data_object_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_object_service.UpdateDataObjectRequest() - assert args[0] == request_msg @@ -5420,7 +5431,6 @@ async def test_batch_update_data_objects_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_object_service.BatchUpdateDataObjectsRequest() - assert args[0] == request_msg @@ -5445,7 +5455,6 @@ async def test_delete_data_object_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_object_service.DeleteDataObjectRequest() - assert args[0] == request_msg @@ -5470,7 +5479,6 @@ async def test_batch_delete_data_objects_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_object_service.BatchDeleteDataObjectsRequest() - assert args[0] == request_msg @@ -6945,7 +6953,6 @@ def test_create_data_object_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_object_service.CreateDataObjectRequest() - assert args[0] == request_msg @@ -6967,7 +6974,6 @@ def test_batch_create_data_objects_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_object_service.BatchCreateDataObjectsRequest() - assert args[0] == request_msg @@ -6987,7 +6993,6 @@ def test_get_data_object_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_object_service.GetDataObjectRequest() - assert args[0] == request_msg @@ -7009,7 +7014,6 @@ def test_update_data_object_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_object_service.UpdateDataObjectRequest() - assert args[0] == request_msg @@ -7031,7 +7035,6 @@ def test_batch_update_data_objects_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_object_service.BatchUpdateDataObjectsRequest() - assert args[0] == request_msg @@ -7053,7 +7056,6 @@ def test_delete_data_object_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_object_service.DeleteDataObjectRequest() - assert args[0] == request_msg @@ -7075,7 +7077,6 @@ def test_batch_delete_data_objects_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_object_service.BatchDeleteDataObjectsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-vectorsearch/tests/unit/gapic/vectorsearch_v1/test_vector_search_service.py b/packages/google-cloud-vectorsearch/tests/unit/gapic/vectorsearch_v1/test_vector_search_service.py index b7a594b00a50..b16942cde14c 100644 --- a/packages/google-cloud-vectorsearch/tests/unit/gapic/vectorsearch_v1/test_vector_search_service.py +++ b/packages/google-cloud-vectorsearch/tests/unit/gapic/vectorsearch_v1/test_vector_search_service.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 @@ -122,6 +123,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" @@ -1385,8 +1401,8 @@ def test_vector_search_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - vectorsearch_service.ListCollectionsRequest, - dict, + vectorsearch_service.ListCollectionsRequest(), + {}, ], ) def test_list_collections(request_type, transport: str = "grpc"): @@ -1397,7 +1413,7 @@ def test_list_collections(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_collections), "__call__") as call: @@ -1446,12 +1462,13 @@ def test_list_collections_non_empty_request_with_auto_populated_field(): client.list_collections(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vectorsearch_service.ListCollectionsRequest( + request_msg = vectorsearch_service.ListCollectionsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_collections_use_cached_wrapped_rpc(): @@ -1534,10 +1551,14 @@ async def test_list_collections_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_collections_async( - transport: str = "grpc_asyncio", - request_type=vectorsearch_service.ListCollectionsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + vectorsearch_service.ListCollectionsRequest(), + {}, + ], +) +async def test_list_collections_async(request_type, transport: str = "grpc_asyncio"): client = VectorSearchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1545,7 +1566,7 @@ async def test_list_collections_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_collections), "__call__") as call: @@ -1570,11 +1591,6 @@ async def test_list_collections_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_collections_async_from_dict(): - await test_list_collections_async(request_type=dict) - - def test_list_collections_field_headers(): client = VectorSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1911,8 +1927,8 @@ async def test_list_collections_async_pages(): @pytest.mark.parametrize( "request_type", [ - vectorsearch_service.GetCollectionRequest, - dict, + vectorsearch_service.GetCollectionRequest(), + {}, ], ) def test_get_collection(request_type, transport: str = "grpc"): @@ -1923,7 +1939,7 @@ def test_get_collection(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_collection), "__call__") as call: @@ -1971,9 +1987,10 @@ def test_get_collection_non_empty_request_with_auto_populated_field(): client.get_collection(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vectorsearch_service.GetCollectionRequest( + request_msg = vectorsearch_service.GetCollectionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_collection_use_cached_wrapped_rpc(): @@ -2054,10 +2071,14 @@ async def test_get_collection_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_collection_async( - transport: str = "grpc_asyncio", - request_type=vectorsearch_service.GetCollectionRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + vectorsearch_service.GetCollectionRequest(), + {}, + ], +) +async def test_get_collection_async(request_type, transport: str = "grpc_asyncio"): client = VectorSearchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2065,7 +2086,7 @@ async def test_get_collection_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_collection), "__call__") as call: @@ -2092,11 +2113,6 @@ async def test_get_collection_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_get_collection_async_from_dict(): - await test_get_collection_async(request_type=dict) - - def test_get_collection_field_headers(): client = VectorSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2243,8 +2259,8 @@ async def test_get_collection_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vectorsearch_service.CreateCollectionRequest, - dict, + vectorsearch_service.CreateCollectionRequest(), + {}, ], ) def test_create_collection(request_type, transport: str = "grpc"): @@ -2255,7 +2271,7 @@ def test_create_collection(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2301,10 +2317,11 @@ def test_create_collection_non_empty_request_with_auto_populated_field(): client.create_collection(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vectorsearch_service.CreateCollectionRequest( + request_msg = vectorsearch_service.CreateCollectionRequest( parent="parent_value", collection_id="collection_id_value", ) + assert args[0] == request_msg def test_create_collection_use_cached_wrapped_rpc(): @@ -2397,10 +2414,14 @@ async def test_create_collection_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_collection_async( - transport: str = "grpc_asyncio", - request_type=vectorsearch_service.CreateCollectionRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + vectorsearch_service.CreateCollectionRequest(), + {}, + ], +) +async def test_create_collection_async(request_type, transport: str = "grpc_asyncio"): client = VectorSearchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2408,7 +2429,7 @@ async def test_create_collection_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( @@ -2430,11 +2451,6 @@ async def test_create_collection_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_collection_async_from_dict(): - await test_create_collection_async(request_type=dict) - - def test_create_collection_field_headers(): client = VectorSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2609,8 +2625,8 @@ async def test_create_collection_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vectorsearch_service.UpdateCollectionRequest, - dict, + vectorsearch_service.UpdateCollectionRequest(), + {}, ], ) def test_update_collection(request_type, transport: str = "grpc"): @@ -2621,7 +2637,7 @@ def test_update_collection(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2664,7 +2680,8 @@ def test_update_collection_non_empty_request_with_auto_populated_field(): client.update_collection(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vectorsearch_service.UpdateCollectionRequest() + request_msg = vectorsearch_service.UpdateCollectionRequest() + assert args[0] == request_msg def test_update_collection_use_cached_wrapped_rpc(): @@ -2757,10 +2774,14 @@ async def test_update_collection_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_collection_async( - transport: str = "grpc_asyncio", - request_type=vectorsearch_service.UpdateCollectionRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + vectorsearch_service.UpdateCollectionRequest(), + {}, + ], +) +async def test_update_collection_async(request_type, transport: str = "grpc_asyncio"): client = VectorSearchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2768,7 +2789,7 @@ async def test_update_collection_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( @@ -2790,11 +2811,6 @@ async def test_update_collection_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_collection_async_from_dict(): - await test_update_collection_async(request_type=dict) - - def test_update_collection_field_headers(): client = VectorSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2959,8 +2975,8 @@ async def test_update_collection_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vectorsearch_service.DeleteCollectionRequest, - dict, + vectorsearch_service.DeleteCollectionRequest(), + {}, ], ) def test_delete_collection(request_type, transport: str = "grpc"): @@ -2971,7 +2987,7 @@ def test_delete_collection(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3016,9 +3032,10 @@ def test_delete_collection_non_empty_request_with_auto_populated_field(): client.delete_collection(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vectorsearch_service.DeleteCollectionRequest( + request_msg = vectorsearch_service.DeleteCollectionRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_collection_use_cached_wrapped_rpc(): @@ -3111,10 +3128,14 @@ async def test_delete_collection_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_collection_async( - transport: str = "grpc_asyncio", - request_type=vectorsearch_service.DeleteCollectionRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + vectorsearch_service.DeleteCollectionRequest(), + {}, + ], +) +async def test_delete_collection_async(request_type, transport: str = "grpc_asyncio"): client = VectorSearchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3122,7 +3143,7 @@ async def test_delete_collection_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( @@ -3144,11 +3165,6 @@ async def test_delete_collection_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_collection_async_from_dict(): - await test_delete_collection_async(request_type=dict) - - def test_delete_collection_field_headers(): client = VectorSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3303,8 +3319,8 @@ async def test_delete_collection_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vectorsearch_service.ListIndexesRequest, - dict, + vectorsearch_service.ListIndexesRequest(), + {}, ], ) def test_list_indexes(request_type, transport: str = "grpc"): @@ -3315,7 +3331,7 @@ def test_list_indexes(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_indexes), "__call__") as call: @@ -3362,12 +3378,13 @@ def test_list_indexes_non_empty_request_with_auto_populated_field(): client.list_indexes(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vectorsearch_service.ListIndexesRequest( + request_msg = vectorsearch_service.ListIndexesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_indexes_use_cached_wrapped_rpc(): @@ -3448,10 +3465,14 @@ async def test_list_indexes_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_indexes_async( - transport: str = "grpc_asyncio", - request_type=vectorsearch_service.ListIndexesRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + vectorsearch_service.ListIndexesRequest(), + {}, + ], +) +async def test_list_indexes_async(request_type, transport: str = "grpc_asyncio"): client = VectorSearchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3459,7 +3480,7 @@ async def test_list_indexes_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_indexes), "__call__") as call: @@ -3482,11 +3503,6 @@ async def test_list_indexes_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_indexes_async_from_dict(): - await test_list_indexes_async(request_type=dict) - - def test_list_indexes_field_headers(): client = VectorSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3823,8 +3839,8 @@ async def test_list_indexes_async_pages(): @pytest.mark.parametrize( "request_type", [ - vectorsearch_service.GetIndexRequest, - dict, + vectorsearch_service.GetIndexRequest(), + {}, ], ) def test_get_index(request_type, transport: str = "grpc"): @@ -3835,7 +3851,7 @@ def test_get_index(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_index), "__call__") as call: @@ -3891,9 +3907,10 @@ def test_get_index_non_empty_request_with_auto_populated_field(): client.get_index(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vectorsearch_service.GetIndexRequest( + request_msg = vectorsearch_service.GetIndexRequest( name="name_value", ) + assert args[0] == request_msg def test_get_index_use_cached_wrapped_rpc(): @@ -3972,9 +3989,14 @@ async def test_get_index_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_index_async( - transport: str = "grpc_asyncio", request_type=vectorsearch_service.GetIndexRequest -): +@pytest.mark.parametrize( + "request_type", + [ + vectorsearch_service.GetIndexRequest(), + {}, + ], +) +async def test_get_index_async(request_type, transport: str = "grpc_asyncio"): client = VectorSearchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3982,7 +4004,7 @@ async def test_get_index_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_index), "__call__") as call: @@ -4017,11 +4039,6 @@ async def test_get_index_async( assert response.store_fields == ["store_fields_value"] -@pytest.mark.asyncio -async def test_get_index_async_from_dict(): - await test_get_index_async(request_type=dict) - - def test_get_index_field_headers(): client = VectorSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4168,8 +4185,8 @@ async def test_get_index_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vectorsearch_service.CreateIndexRequest, - dict, + vectorsearch_service.CreateIndexRequest(), + {}, ], ) def test_create_index(request_type, transport: str = "grpc"): @@ -4180,7 +4197,7 @@ def test_create_index(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_index), "__call__") as call: @@ -4222,10 +4239,11 @@ def test_create_index_non_empty_request_with_auto_populated_field(): client.create_index(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vectorsearch_service.CreateIndexRequest( + request_msg = vectorsearch_service.CreateIndexRequest( parent="parent_value", index_id="index_id_value", ) + assert args[0] == request_msg def test_create_index_use_cached_wrapped_rpc(): @@ -4316,10 +4334,14 @@ async def test_create_index_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_index_async( - transport: str = "grpc_asyncio", - request_type=vectorsearch_service.CreateIndexRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + vectorsearch_service.CreateIndexRequest(), + {}, + ], +) +async def test_create_index_async(request_type, transport: str = "grpc_asyncio"): client = VectorSearchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4327,7 +4349,7 @@ async def test_create_index_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_index), "__call__") as call: @@ -4347,11 +4369,6 @@ async def test_create_index_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_index_async_from_dict(): - await test_create_index_async(request_type=dict) - - def test_create_index_field_headers(): client = VectorSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4542,8 +4559,8 @@ async def test_create_index_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vectorsearch_service.UpdateIndexRequest, - dict, + vectorsearch_service.UpdateIndexRequest(), + {}, ], ) def test_update_index(request_type, transport: str = "grpc"): @@ -4554,7 +4571,7 @@ def test_update_index(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_index), "__call__") as call: @@ -4593,7 +4610,8 @@ def test_update_index_non_empty_request_with_auto_populated_field(): client.update_index(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vectorsearch_service.UpdateIndexRequest() + request_msg = vectorsearch_service.UpdateIndexRequest() + assert args[0] == request_msg def test_update_index_use_cached_wrapped_rpc(): @@ -4684,10 +4702,14 @@ async def test_update_index_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_index_async( - transport: str = "grpc_asyncio", - request_type=vectorsearch_service.UpdateIndexRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + vectorsearch_service.UpdateIndexRequest(), + {}, + ], +) +async def test_update_index_async(request_type, transport: str = "grpc_asyncio"): client = VectorSearchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4695,7 +4717,7 @@ async def test_update_index_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_index), "__call__") as call: @@ -4715,11 +4737,6 @@ async def test_update_index_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_index_async_from_dict(): - await test_update_index_async(request_type=dict) - - def test_update_index_field_headers(): client = VectorSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4900,8 +4917,8 @@ async def test_update_index_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vectorsearch_service.DeleteIndexRequest, - dict, + vectorsearch_service.DeleteIndexRequest(), + {}, ], ) def test_delete_index(request_type, transport: str = "grpc"): @@ -4912,7 +4929,7 @@ def test_delete_index(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_index), "__call__") as call: @@ -4953,9 +4970,10 @@ def test_delete_index_non_empty_request_with_auto_populated_field(): client.delete_index(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vectorsearch_service.DeleteIndexRequest( + request_msg = vectorsearch_service.DeleteIndexRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_index_use_cached_wrapped_rpc(): @@ -5046,10 +5064,14 @@ async def test_delete_index_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_index_async( - transport: str = "grpc_asyncio", - request_type=vectorsearch_service.DeleteIndexRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + vectorsearch_service.DeleteIndexRequest(), + {}, + ], +) +async def test_delete_index_async(request_type, transport: str = "grpc_asyncio"): client = VectorSearchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5057,7 +5079,7 @@ async def test_delete_index_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_index), "__call__") as call: @@ -5077,11 +5099,6 @@ async def test_delete_index_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_index_async_from_dict(): - await test_delete_index_async(request_type=dict) - - def test_delete_index_field_headers(): client = VectorSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5228,8 +5245,8 @@ async def test_delete_index_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vectorsearch_service.ImportDataObjectsRequest, - dict, + vectorsearch_service.ImportDataObjectsRequest(), + {}, ], ) def test_import_data_objects(request_type, transport: str = "grpc"): @@ -5240,7 +5257,7 @@ def test_import_data_objects(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5285,9 +5302,10 @@ def test_import_data_objects_non_empty_request_with_auto_populated_field(): client.import_data_objects(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vectorsearch_service.ImportDataObjectsRequest( + request_msg = vectorsearch_service.ImportDataObjectsRequest( name="name_value", ) + assert args[0] == request_msg def test_import_data_objects_use_cached_wrapped_rpc(): @@ -5382,10 +5400,14 @@ async def test_import_data_objects_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_import_data_objects_async( - transport: str = "grpc_asyncio", - request_type=vectorsearch_service.ImportDataObjectsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + vectorsearch_service.ImportDataObjectsRequest(), + {}, + ], +) +async def test_import_data_objects_async(request_type, transport: str = "grpc_asyncio"): client = VectorSearchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5393,7 +5415,7 @@ async def test_import_data_objects_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( @@ -5415,11 +5437,6 @@ async def test_import_data_objects_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_import_data_objects_async_from_dict(): - await test_import_data_objects_async(request_type=dict) - - def test_import_data_objects_field_headers(): client = VectorSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5488,8 +5505,8 @@ async def test_import_data_objects_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - vectorsearch_service.ExportDataObjectsRequest, - dict, + vectorsearch_service.ExportDataObjectsRequest(), + {}, ], ) def test_export_data_objects(request_type, transport: str = "grpc"): @@ -5500,7 +5517,7 @@ def test_export_data_objects(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5545,9 +5562,10 @@ def test_export_data_objects_non_empty_request_with_auto_populated_field(): client.export_data_objects(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vectorsearch_service.ExportDataObjectsRequest( + request_msg = vectorsearch_service.ExportDataObjectsRequest( name="name_value", ) + assert args[0] == request_msg def test_export_data_objects_use_cached_wrapped_rpc(): @@ -5642,10 +5660,14 @@ async def test_export_data_objects_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_export_data_objects_async( - transport: str = "grpc_asyncio", - request_type=vectorsearch_service.ExportDataObjectsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + vectorsearch_service.ExportDataObjectsRequest(), + {}, + ], +) +async def test_export_data_objects_async(request_type, transport: str = "grpc_asyncio"): client = VectorSearchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5653,7 +5675,7 @@ async def test_export_data_objects_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( @@ -5675,11 +5697,6 @@ async def test_export_data_objects_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_export_data_objects_async_from_dict(): - await test_export_data_objects_async(request_type=dict) - - def test_export_data_objects_field_headers(): client = VectorSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8212,7 +8229,6 @@ def test_list_collections_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vectorsearch_service.ListCollectionsRequest() - assert args[0] == request_msg @@ -8233,7 +8249,6 @@ def test_get_collection_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vectorsearch_service.GetCollectionRequest() - assert args[0] == request_msg @@ -8256,7 +8271,6 @@ def test_create_collection_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vectorsearch_service.CreateCollectionRequest() - assert args[0] == request_msg @@ -8279,7 +8293,6 @@ def test_update_collection_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vectorsearch_service.UpdateCollectionRequest() - assert args[0] == request_msg @@ -8302,7 +8315,6 @@ def test_delete_collection_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vectorsearch_service.DeleteCollectionRequest() - assert args[0] == request_msg @@ -8323,7 +8335,6 @@ def test_list_indexes_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vectorsearch_service.ListIndexesRequest() - assert args[0] == request_msg @@ -8344,7 +8355,6 @@ def test_get_index_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vectorsearch_service.GetIndexRequest() - assert args[0] == request_msg @@ -8365,7 +8375,6 @@ def test_create_index_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vectorsearch_service.CreateIndexRequest() - assert args[0] == request_msg @@ -8386,7 +8395,6 @@ def test_update_index_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vectorsearch_service.UpdateIndexRequest() - assert args[0] == request_msg @@ -8407,7 +8415,6 @@ def test_delete_index_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vectorsearch_service.DeleteIndexRequest() - assert args[0] == request_msg @@ -8430,7 +8437,6 @@ def test_import_data_objects_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vectorsearch_service.ImportDataObjectsRequest() - assert args[0] == request_msg @@ -8453,7 +8459,6 @@ def test_export_data_objects_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vectorsearch_service.ExportDataObjectsRequest() - assert args[0] == request_msg @@ -8495,7 +8500,6 @@ async def test_list_collections_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vectorsearch_service.ListCollectionsRequest() - assert args[0] == request_msg @@ -8524,7 +8528,6 @@ async def test_get_collection_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vectorsearch_service.GetCollectionRequest() - assert args[0] == request_msg @@ -8551,7 +8554,6 @@ async def test_create_collection_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vectorsearch_service.CreateCollectionRequest() - assert args[0] == request_msg @@ -8578,7 +8580,6 @@ async def test_update_collection_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vectorsearch_service.UpdateCollectionRequest() - assert args[0] == request_msg @@ -8605,7 +8606,6 @@ async def test_delete_collection_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vectorsearch_service.DeleteCollectionRequest() - assert args[0] == request_msg @@ -8632,7 +8632,6 @@ async def test_list_indexes_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vectorsearch_service.ListIndexesRequest() - assert args[0] == request_msg @@ -8665,7 +8664,6 @@ async def test_get_index_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vectorsearch_service.GetIndexRequest() - assert args[0] == request_msg @@ -8690,7 +8688,6 @@ async def test_create_index_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vectorsearch_service.CreateIndexRequest() - assert args[0] == request_msg @@ -8715,7 +8712,6 @@ async def test_update_index_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vectorsearch_service.UpdateIndexRequest() - assert args[0] == request_msg @@ -8740,7 +8736,6 @@ async def test_delete_index_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vectorsearch_service.DeleteIndexRequest() - assert args[0] == request_msg @@ -8767,7 +8762,6 @@ async def test_import_data_objects_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vectorsearch_service.ImportDataObjectsRequest() - assert args[0] == request_msg @@ -8794,7 +8788,6 @@ async def test_export_data_objects_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vectorsearch_service.ExportDataObjectsRequest() - assert args[0] == request_msg @@ -11106,7 +11099,6 @@ def test_list_collections_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vectorsearch_service.ListCollectionsRequest() - assert args[0] == request_msg @@ -11126,7 +11118,6 @@ def test_get_collection_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vectorsearch_service.GetCollectionRequest() - assert args[0] == request_msg @@ -11148,7 +11139,6 @@ def test_create_collection_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vectorsearch_service.CreateCollectionRequest() - assert args[0] == request_msg @@ -11170,7 +11160,6 @@ def test_update_collection_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vectorsearch_service.UpdateCollectionRequest() - assert args[0] == request_msg @@ -11192,7 +11181,6 @@ def test_delete_collection_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vectorsearch_service.DeleteCollectionRequest() - assert args[0] == request_msg @@ -11212,7 +11200,6 @@ def test_list_indexes_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vectorsearch_service.ListIndexesRequest() - assert args[0] == request_msg @@ -11232,7 +11219,6 @@ def test_get_index_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vectorsearch_service.GetIndexRequest() - assert args[0] == request_msg @@ -11252,7 +11238,6 @@ def test_create_index_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vectorsearch_service.CreateIndexRequest() - assert args[0] == request_msg @@ -11272,7 +11257,6 @@ def test_update_index_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vectorsearch_service.UpdateIndexRequest() - assert args[0] == request_msg @@ -11292,7 +11276,6 @@ def test_delete_index_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vectorsearch_service.DeleteIndexRequest() - assert args[0] == request_msg @@ -11314,7 +11297,6 @@ def test_import_data_objects_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vectorsearch_service.ImportDataObjectsRequest() - assert args[0] == request_msg @@ -11336,7 +11318,6 @@ def test_export_data_objects_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vectorsearch_service.ExportDataObjectsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-vectorsearch/tests/unit/gapic/vectorsearch_v1beta/test_data_object_search_service.py b/packages/google-cloud-vectorsearch/tests/unit/gapic/vectorsearch_v1beta/test_data_object_search_service.py index e037dfbbfd3c..821cd7ef915a 100644 --- a/packages/google-cloud-vectorsearch/tests/unit/gapic/vectorsearch_v1beta/test_data_object_search_service.py +++ b/packages/google-cloud-vectorsearch/tests/unit/gapic/vectorsearch_v1beta/test_data_object_search_service.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 @@ -115,6 +116,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" @@ -1384,8 +1400,8 @@ def test_data_object_search_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - data_object_search_service.SearchDataObjectsRequest, - dict, + data_object_search_service.SearchDataObjectsRequest(), + {}, ], ) def test_search_data_objects(request_type, transport: str = "grpc"): @@ -1396,7 +1412,7 @@ def test_search_data_objects(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1445,10 +1461,11 @@ def test_search_data_objects_non_empty_request_with_auto_populated_field(): client.search_data_objects(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_object_search_service.SearchDataObjectsRequest( + request_msg = data_object_search_service.SearchDataObjectsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_search_data_objects_use_cached_wrapped_rpc(): @@ -1533,10 +1550,14 @@ async def test_search_data_objects_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_search_data_objects_async( - transport: str = "grpc_asyncio", - request_type=data_object_search_service.SearchDataObjectsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + data_object_search_service.SearchDataObjectsRequest(), + {}, + ], +) +async def test_search_data_objects_async(request_type, transport: str = "grpc_asyncio"): client = DataObjectSearchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1544,7 +1565,7 @@ async def test_search_data_objects_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( @@ -1569,11 +1590,6 @@ async def test_search_data_objects_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_search_data_objects_async_from_dict(): - await test_search_data_objects_async(request_type=dict) - - def test_search_data_objects_field_headers(): client = DataObjectSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1844,8 +1860,8 @@ async def test_search_data_objects_async_pages(): @pytest.mark.parametrize( "request_type", [ - data_object_search_service.QueryDataObjectsRequest, - dict, + data_object_search_service.QueryDataObjectsRequest(), + {}, ], ) def test_query_data_objects(request_type, transport: str = "grpc"): @@ -1856,7 +1872,7 @@ def test_query_data_objects(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1905,10 +1921,11 @@ def test_query_data_objects_non_empty_request_with_auto_populated_field(): client.query_data_objects(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_object_search_service.QueryDataObjectsRequest( + request_msg = data_object_search_service.QueryDataObjectsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_query_data_objects_use_cached_wrapped_rpc(): @@ -1993,10 +2010,14 @@ async def test_query_data_objects_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_query_data_objects_async( - transport: str = "grpc_asyncio", - request_type=data_object_search_service.QueryDataObjectsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + data_object_search_service.QueryDataObjectsRequest(), + {}, + ], +) +async def test_query_data_objects_async(request_type, transport: str = "grpc_asyncio"): client = DataObjectSearchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2004,7 +2025,7 @@ async def test_query_data_objects_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( @@ -2029,11 +2050,6 @@ async def test_query_data_objects_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_query_data_objects_async_from_dict(): - await test_query_data_objects_async(request_type=dict) - - def test_query_data_objects_field_headers(): client = DataObjectSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2300,8 +2316,8 @@ async def test_query_data_objects_async_pages(): @pytest.mark.parametrize( "request_type", [ - data_object_search_service.AggregateDataObjectsRequest, - dict, + data_object_search_service.AggregateDataObjectsRequest(), + {}, ], ) def test_aggregate_data_objects(request_type, transport: str = "grpc"): @@ -2312,7 +2328,7 @@ def test_aggregate_data_objects(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2357,9 +2373,10 @@ def test_aggregate_data_objects_non_empty_request_with_auto_populated_field(): client.aggregate_data_objects(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_object_search_service.AggregateDataObjectsRequest( + request_msg = data_object_search_service.AggregateDataObjectsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_aggregate_data_objects_use_cached_wrapped_rpc(): @@ -2445,9 +2462,15 @@ async def test_aggregate_data_objects_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_object_search_service.AggregateDataObjectsRequest(), + {}, + ], +) async def test_aggregate_data_objects_async( - transport: str = "grpc_asyncio", - request_type=data_object_search_service.AggregateDataObjectsRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataObjectSearchServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2456,7 +2479,7 @@ async def test_aggregate_data_objects_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( @@ -2478,11 +2501,6 @@ async def test_aggregate_data_objects_async( assert isinstance(response, data_object_search_service.AggregateDataObjectsResponse) -@pytest.mark.asyncio -async def test_aggregate_data_objects_async_from_dict(): - await test_aggregate_data_objects_async(request_type=dict) - - def test_aggregate_data_objects_field_headers(): client = DataObjectSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2551,8 +2569,8 @@ async def test_aggregate_data_objects_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - data_object_search_service.BatchSearchDataObjectsRequest, - dict, + data_object_search_service.BatchSearchDataObjectsRequest(), + {}, ], ) def test_batch_search_data_objects(request_type, transport: str = "grpc"): @@ -2563,7 +2581,7 @@ def test_batch_search_data_objects(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2610,9 +2628,10 @@ def test_batch_search_data_objects_non_empty_request_with_auto_populated_field() client.batch_search_data_objects(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_object_search_service.BatchSearchDataObjectsRequest( + request_msg = data_object_search_service.BatchSearchDataObjectsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_batch_search_data_objects_use_cached_wrapped_rpc(): @@ -2698,9 +2717,15 @@ async def test_batch_search_data_objects_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_object_search_service.BatchSearchDataObjectsRequest(), + {}, + ], +) async def test_batch_search_data_objects_async( - transport: str = "grpc_asyncio", - request_type=data_object_search_service.BatchSearchDataObjectsRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataObjectSearchServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2709,7 +2734,7 @@ async def test_batch_search_data_objects_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( @@ -2733,11 +2758,6 @@ async def test_batch_search_data_objects_async( ) -@pytest.mark.asyncio -async def test_batch_search_data_objects_async_from_dict(): - await test_batch_search_data_objects_async(request_type=dict) - - def test_batch_search_data_objects_field_headers(): client = DataObjectSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3588,7 +3608,6 @@ def test_search_data_objects_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_object_search_service.SearchDataObjectsRequest() - assert args[0] == request_msg @@ -3611,7 +3630,6 @@ def test_query_data_objects_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_object_search_service.QueryDataObjectsRequest() - assert args[0] == request_msg @@ -3634,7 +3652,6 @@ def test_aggregate_data_objects_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_object_search_service.AggregateDataObjectsRequest() - assert args[0] == request_msg @@ -3657,7 +3674,6 @@ def test_batch_search_data_objects_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_object_search_service.BatchSearchDataObjectsRequest() - assert args[0] == request_msg @@ -3700,7 +3716,6 @@ async def test_search_data_objects_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_object_search_service.SearchDataObjectsRequest() - assert args[0] == request_msg @@ -3729,7 +3744,6 @@ async def test_query_data_objects_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_object_search_service.QueryDataObjectsRequest() - assert args[0] == request_msg @@ -3756,7 +3770,6 @@ async def test_aggregate_data_objects_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_object_search_service.AggregateDataObjectsRequest() - assert args[0] == request_msg @@ -3783,7 +3796,6 @@ async def test_batch_search_data_objects_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_object_search_service.BatchSearchDataObjectsRequest() - assert args[0] == request_msg @@ -4748,7 +4760,6 @@ def test_search_data_objects_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_object_search_service.SearchDataObjectsRequest() - assert args[0] == request_msg @@ -4770,7 +4781,6 @@ def test_query_data_objects_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_object_search_service.QueryDataObjectsRequest() - assert args[0] == request_msg @@ -4792,7 +4802,6 @@ def test_aggregate_data_objects_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_object_search_service.AggregateDataObjectsRequest() - assert args[0] == request_msg @@ -4814,7 +4823,6 @@ def test_batch_search_data_objects_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_object_search_service.BatchSearchDataObjectsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-vectorsearch/tests/unit/gapic/vectorsearch_v1beta/test_data_object_service.py b/packages/google-cloud-vectorsearch/tests/unit/gapic/vectorsearch_v1beta/test_data_object_service.py index 855570bf5f29..9319f1000035 100644 --- a/packages/google-cloud-vectorsearch/tests/unit/gapic/vectorsearch_v1beta/test_data_object_service.py +++ b/packages/google-cloud-vectorsearch/tests/unit/gapic/vectorsearch_v1beta/test_data_object_service.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" @@ -1353,8 +1369,8 @@ def test_data_object_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - data_object_service.CreateDataObjectRequest, - dict, + data_object_service.CreateDataObjectRequest(), + {}, ], ) def test_create_data_object(request_type, transport: str = "grpc"): @@ -1365,7 +1381,7 @@ def test_create_data_object(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1418,10 +1434,11 @@ def test_create_data_object_non_empty_request_with_auto_populated_field(): client.create_data_object(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_object_service.CreateDataObjectRequest( + request_msg = data_object_service.CreateDataObjectRequest( parent="parent_value", data_object_id="data_object_id_value", ) + assert args[0] == request_msg def test_create_data_object_use_cached_wrapped_rpc(): @@ -1506,10 +1523,14 @@ async def test_create_data_object_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_data_object_async( - transport: str = "grpc_asyncio", - request_type=data_object_service.CreateDataObjectRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + data_object_service.CreateDataObjectRequest(), + {}, + ], +) +async def test_create_data_object_async(request_type, transport: str = "grpc_asyncio"): client = DataObjectServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1517,7 +1538,7 @@ async def test_create_data_object_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( @@ -1546,11 +1567,6 @@ async def test_create_data_object_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_create_data_object_async_from_dict(): - await test_create_data_object_async(request_type=dict) - - def test_create_data_object_field_headers(): client = DataObjectServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1725,8 +1741,8 @@ async def test_create_data_object_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_object_service.BatchCreateDataObjectsRequest, - dict, + data_object_service.BatchCreateDataObjectsRequest(), + {}, ], ) def test_batch_create_data_objects(request_type, transport: str = "grpc"): @@ -1737,7 +1753,7 @@ def test_batch_create_data_objects(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1782,9 +1798,10 @@ def test_batch_create_data_objects_non_empty_request_with_auto_populated_field() client.batch_create_data_objects(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_object_service.BatchCreateDataObjectsRequest( + request_msg = data_object_service.BatchCreateDataObjectsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_batch_create_data_objects_use_cached_wrapped_rpc(): @@ -1870,9 +1887,15 @@ async def test_batch_create_data_objects_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_object_service.BatchCreateDataObjectsRequest(), + {}, + ], +) async def test_batch_create_data_objects_async( - transport: str = "grpc_asyncio", - request_type=data_object_service.BatchCreateDataObjectsRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataObjectServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1881,7 +1904,7 @@ async def test_batch_create_data_objects_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( @@ -1903,11 +1926,6 @@ async def test_batch_create_data_objects_async( assert isinstance(response, data_object_service.BatchCreateDataObjectsResponse) -@pytest.mark.asyncio -async def test_batch_create_data_objects_async_from_dict(): - await test_batch_create_data_objects_async(request_type=dict) - - def test_batch_create_data_objects_field_headers(): client = DataObjectServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1976,8 +1994,8 @@ async def test_batch_create_data_objects_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - data_object_service.GetDataObjectRequest, - dict, + data_object_service.GetDataObjectRequest(), + {}, ], ) def test_get_data_object(request_type, transport: str = "grpc"): @@ -1988,7 +2006,7 @@ def test_get_data_object(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_data_object), "__call__") as call: @@ -2036,9 +2054,10 @@ def test_get_data_object_non_empty_request_with_auto_populated_field(): client.get_data_object(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_object_service.GetDataObjectRequest( + request_msg = data_object_service.GetDataObjectRequest( name="name_value", ) + assert args[0] == request_msg def test_get_data_object_use_cached_wrapped_rpc(): @@ -2119,10 +2138,14 @@ async def test_get_data_object_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_data_object_async( - transport: str = "grpc_asyncio", - request_type=data_object_service.GetDataObjectRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + data_object_service.GetDataObjectRequest(), + {}, + ], +) +async def test_get_data_object_async(request_type, transport: str = "grpc_asyncio"): client = DataObjectServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2130,7 +2153,7 @@ async def test_get_data_object_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_data_object), "__call__") as call: @@ -2157,11 +2180,6 @@ async def test_get_data_object_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_data_object_async_from_dict(): - await test_get_data_object_async(request_type=dict) - - def test_get_data_object_field_headers(): client = DataObjectServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2308,8 +2326,8 @@ async def test_get_data_object_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_object_service.UpdateDataObjectRequest, - dict, + data_object_service.UpdateDataObjectRequest(), + {}, ], ) def test_update_data_object(request_type, transport: str = "grpc"): @@ -2320,7 +2338,7 @@ def test_update_data_object(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2370,7 +2388,8 @@ def test_update_data_object_non_empty_request_with_auto_populated_field(): client.update_data_object(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_object_service.UpdateDataObjectRequest() + request_msg = data_object_service.UpdateDataObjectRequest() + assert args[0] == request_msg def test_update_data_object_use_cached_wrapped_rpc(): @@ -2455,10 +2474,14 @@ async def test_update_data_object_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_data_object_async( - transport: str = "grpc_asyncio", - request_type=data_object_service.UpdateDataObjectRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + data_object_service.UpdateDataObjectRequest(), + {}, + ], +) +async def test_update_data_object_async(request_type, transport: str = "grpc_asyncio"): client = DataObjectServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2466,7 +2489,7 @@ async def test_update_data_object_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( @@ -2495,11 +2518,6 @@ async def test_update_data_object_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_update_data_object_async_from_dict(): - await test_update_data_object_async(request_type=dict) - - def test_update_data_object_field_headers(): client = DataObjectServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2664,8 +2682,8 @@ async def test_update_data_object_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_object_service.BatchUpdateDataObjectsRequest, - dict, + data_object_service.BatchUpdateDataObjectsRequest(), + {}, ], ) def test_batch_update_data_objects(request_type, transport: str = "grpc"): @@ -2676,7 +2694,7 @@ def test_batch_update_data_objects(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,9 +2739,10 @@ def test_batch_update_data_objects_non_empty_request_with_auto_populated_field() client.batch_update_data_objects(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_object_service.BatchUpdateDataObjectsRequest( + request_msg = data_object_service.BatchUpdateDataObjectsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_batch_update_data_objects_use_cached_wrapped_rpc(): @@ -2809,9 +2828,15 @@ async def test_batch_update_data_objects_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_object_service.BatchUpdateDataObjectsRequest(), + {}, + ], +) async def test_batch_update_data_objects_async( - transport: str = "grpc_asyncio", - request_type=data_object_service.BatchUpdateDataObjectsRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataObjectServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2820,7 +2845,7 @@ async def test_batch_update_data_objects_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( @@ -2842,11 +2867,6 @@ async def test_batch_update_data_objects_async( assert isinstance(response, data_object_service.BatchUpdateDataObjectsResponse) -@pytest.mark.asyncio -async def test_batch_update_data_objects_async_from_dict(): - await test_batch_update_data_objects_async(request_type=dict) - - def test_batch_update_data_objects_field_headers(): client = DataObjectServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3035,8 +3055,8 @@ async def test_batch_update_data_objects_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_object_service.DeleteDataObjectRequest, - dict, + data_object_service.DeleteDataObjectRequest(), + {}, ], ) def test_delete_data_object(request_type, transport: str = "grpc"): @@ -3047,7 +3067,7 @@ def test_delete_data_object(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3093,10 +3113,11 @@ def test_delete_data_object_non_empty_request_with_auto_populated_field(): client.delete_data_object(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_object_service.DeleteDataObjectRequest( + request_msg = data_object_service.DeleteDataObjectRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_data_object_use_cached_wrapped_rpc(): @@ -3181,10 +3202,14 @@ async def test_delete_data_object_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_data_object_async( - transport: str = "grpc_asyncio", - request_type=data_object_service.DeleteDataObjectRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + data_object_service.DeleteDataObjectRequest(), + {}, + ], +) +async def test_delete_data_object_async(request_type, transport: str = "grpc_asyncio"): client = DataObjectServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3192,7 +3217,7 @@ async def test_delete_data_object_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( @@ -3212,11 +3237,6 @@ async def test_delete_data_object_async( assert response is None -@pytest.mark.asyncio -async def test_delete_data_object_async_from_dict(): - await test_delete_data_object_async(request_type=dict) - - def test_delete_data_object_field_headers(): client = DataObjectServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3367,8 +3387,8 @@ async def test_delete_data_object_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - data_object_service.BatchDeleteDataObjectsRequest, - dict, + data_object_service.BatchDeleteDataObjectsRequest(), + {}, ], ) def test_batch_delete_data_objects(request_type, transport: str = "grpc"): @@ -3379,7 +3399,7 @@ def test_batch_delete_data_objects(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3424,9 +3444,10 @@ def test_batch_delete_data_objects_non_empty_request_with_auto_populated_field() client.batch_delete_data_objects(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == data_object_service.BatchDeleteDataObjectsRequest( + request_msg = data_object_service.BatchDeleteDataObjectsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_batch_delete_data_objects_use_cached_wrapped_rpc(): @@ -3512,9 +3533,15 @@ async def test_batch_delete_data_objects_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + data_object_service.BatchDeleteDataObjectsRequest(), + {}, + ], +) async def test_batch_delete_data_objects_async( - transport: str = "grpc_asyncio", - request_type=data_object_service.BatchDeleteDataObjectsRequest, + request_type, transport: str = "grpc_asyncio" ): client = DataObjectServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3523,7 +3550,7 @@ async def test_batch_delete_data_objects_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( @@ -3543,11 +3570,6 @@ async def test_batch_delete_data_objects_async( assert response is None -@pytest.mark.asyncio -async def test_batch_delete_data_objects_async_from_dict(): - await test_batch_delete_data_objects_async(request_type=dict) - - def test_batch_delete_data_objects_field_headers(): client = DataObjectServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5125,7 +5147,6 @@ def test_create_data_object_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_object_service.CreateDataObjectRequest() - assert args[0] == request_msg @@ -5148,7 +5169,6 @@ def test_batch_create_data_objects_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_object_service.BatchCreateDataObjectsRequest() - assert args[0] == request_msg @@ -5169,7 +5189,6 @@ def test_get_data_object_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_object_service.GetDataObjectRequest() - assert args[0] == request_msg @@ -5192,7 +5211,6 @@ def test_update_data_object_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_object_service.UpdateDataObjectRequest() - assert args[0] == request_msg @@ -5215,7 +5233,6 @@ def test_batch_update_data_objects_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_object_service.BatchUpdateDataObjectsRequest() - assert args[0] == request_msg @@ -5238,7 +5255,6 @@ def test_delete_data_object_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_object_service.DeleteDataObjectRequest() - assert args[0] == request_msg @@ -5261,7 +5277,6 @@ def test_batch_delete_data_objects_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_object_service.BatchDeleteDataObjectsRequest() - assert args[0] == request_msg @@ -5306,7 +5321,6 @@ async def test_create_data_object_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_object_service.CreateDataObjectRequest() - assert args[0] == request_msg @@ -5333,7 +5347,6 @@ async def test_batch_create_data_objects_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_object_service.BatchCreateDataObjectsRequest() - assert args[0] == request_msg @@ -5362,7 +5375,6 @@ async def test_get_data_object_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_object_service.GetDataObjectRequest() - assert args[0] == request_msg @@ -5393,7 +5405,6 @@ async def test_update_data_object_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_object_service.UpdateDataObjectRequest() - assert args[0] == request_msg @@ -5420,7 +5431,6 @@ async def test_batch_update_data_objects_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_object_service.BatchUpdateDataObjectsRequest() - assert args[0] == request_msg @@ -5445,7 +5455,6 @@ async def test_delete_data_object_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_object_service.DeleteDataObjectRequest() - assert args[0] == request_msg @@ -5470,7 +5479,6 @@ async def test_batch_delete_data_objects_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_object_service.BatchDeleteDataObjectsRequest() - assert args[0] == request_msg @@ -6945,7 +6953,6 @@ def test_create_data_object_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_object_service.CreateDataObjectRequest() - assert args[0] == request_msg @@ -6967,7 +6974,6 @@ def test_batch_create_data_objects_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_object_service.BatchCreateDataObjectsRequest() - assert args[0] == request_msg @@ -6987,7 +6993,6 @@ def test_get_data_object_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_object_service.GetDataObjectRequest() - assert args[0] == request_msg @@ -7009,7 +7014,6 @@ def test_update_data_object_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_object_service.UpdateDataObjectRequest() - assert args[0] == request_msg @@ -7031,7 +7035,6 @@ def test_batch_update_data_objects_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_object_service.BatchUpdateDataObjectsRequest() - assert args[0] == request_msg @@ -7053,7 +7056,6 @@ def test_delete_data_object_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_object_service.DeleteDataObjectRequest() - assert args[0] == request_msg @@ -7075,7 +7077,6 @@ def test_batch_delete_data_objects_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = data_object_service.BatchDeleteDataObjectsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-vectorsearch/tests/unit/gapic/vectorsearch_v1beta/test_vector_search_service.py b/packages/google-cloud-vectorsearch/tests/unit/gapic/vectorsearch_v1beta/test_vector_search_service.py index 5b430a0974be..8aa3980d786a 100644 --- a/packages/google-cloud-vectorsearch/tests/unit/gapic/vectorsearch_v1beta/test_vector_search_service.py +++ b/packages/google-cloud-vectorsearch/tests/unit/gapic/vectorsearch_v1beta/test_vector_search_service.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 @@ -122,6 +123,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" @@ -1385,8 +1401,8 @@ def test_vector_search_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - vectorsearch_service.ListCollectionsRequest, - dict, + vectorsearch_service.ListCollectionsRequest(), + {}, ], ) def test_list_collections(request_type, transport: str = "grpc"): @@ -1397,7 +1413,7 @@ def test_list_collections(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_collections), "__call__") as call: @@ -1446,12 +1462,13 @@ def test_list_collections_non_empty_request_with_auto_populated_field(): client.list_collections(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vectorsearch_service.ListCollectionsRequest( + request_msg = vectorsearch_service.ListCollectionsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_collections_use_cached_wrapped_rpc(): @@ -1534,10 +1551,14 @@ async def test_list_collections_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_collections_async( - transport: str = "grpc_asyncio", - request_type=vectorsearch_service.ListCollectionsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + vectorsearch_service.ListCollectionsRequest(), + {}, + ], +) +async def test_list_collections_async(request_type, transport: str = "grpc_asyncio"): client = VectorSearchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1545,7 +1566,7 @@ async def test_list_collections_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_collections), "__call__") as call: @@ -1570,11 +1591,6 @@ async def test_list_collections_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_collections_async_from_dict(): - await test_list_collections_async(request_type=dict) - - def test_list_collections_field_headers(): client = VectorSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1911,8 +1927,8 @@ async def test_list_collections_async_pages(): @pytest.mark.parametrize( "request_type", [ - vectorsearch_service.GetCollectionRequest, - dict, + vectorsearch_service.GetCollectionRequest(), + {}, ], ) def test_get_collection(request_type, transport: str = "grpc"): @@ -1923,7 +1939,7 @@ def test_get_collection(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_collection), "__call__") as call: @@ -1971,9 +1987,10 @@ def test_get_collection_non_empty_request_with_auto_populated_field(): client.get_collection(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vectorsearch_service.GetCollectionRequest( + request_msg = vectorsearch_service.GetCollectionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_collection_use_cached_wrapped_rpc(): @@ -2054,10 +2071,14 @@ async def test_get_collection_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_collection_async( - transport: str = "grpc_asyncio", - request_type=vectorsearch_service.GetCollectionRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + vectorsearch_service.GetCollectionRequest(), + {}, + ], +) +async def test_get_collection_async(request_type, transport: str = "grpc_asyncio"): client = VectorSearchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2065,7 +2086,7 @@ async def test_get_collection_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_collection), "__call__") as call: @@ -2092,11 +2113,6 @@ async def test_get_collection_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_get_collection_async_from_dict(): - await test_get_collection_async(request_type=dict) - - def test_get_collection_field_headers(): client = VectorSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2243,8 +2259,8 @@ async def test_get_collection_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vectorsearch_service.CreateCollectionRequest, - dict, + vectorsearch_service.CreateCollectionRequest(), + {}, ], ) def test_create_collection(request_type, transport: str = "grpc"): @@ -2255,7 +2271,7 @@ def test_create_collection(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2301,10 +2317,11 @@ def test_create_collection_non_empty_request_with_auto_populated_field(): client.create_collection(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vectorsearch_service.CreateCollectionRequest( + request_msg = vectorsearch_service.CreateCollectionRequest( parent="parent_value", collection_id="collection_id_value", ) + assert args[0] == request_msg def test_create_collection_use_cached_wrapped_rpc(): @@ -2397,10 +2414,14 @@ async def test_create_collection_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_collection_async( - transport: str = "grpc_asyncio", - request_type=vectorsearch_service.CreateCollectionRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + vectorsearch_service.CreateCollectionRequest(), + {}, + ], +) +async def test_create_collection_async(request_type, transport: str = "grpc_asyncio"): client = VectorSearchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2408,7 +2429,7 @@ async def test_create_collection_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( @@ -2430,11 +2451,6 @@ async def test_create_collection_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_collection_async_from_dict(): - await test_create_collection_async(request_type=dict) - - def test_create_collection_field_headers(): client = VectorSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2609,8 +2625,8 @@ async def test_create_collection_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vectorsearch_service.UpdateCollectionRequest, - dict, + vectorsearch_service.UpdateCollectionRequest(), + {}, ], ) def test_update_collection(request_type, transport: str = "grpc"): @@ -2621,7 +2637,7 @@ def test_update_collection(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2664,7 +2680,8 @@ def test_update_collection_non_empty_request_with_auto_populated_field(): client.update_collection(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vectorsearch_service.UpdateCollectionRequest() + request_msg = vectorsearch_service.UpdateCollectionRequest() + assert args[0] == request_msg def test_update_collection_use_cached_wrapped_rpc(): @@ -2757,10 +2774,14 @@ async def test_update_collection_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_collection_async( - transport: str = "grpc_asyncio", - request_type=vectorsearch_service.UpdateCollectionRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + vectorsearch_service.UpdateCollectionRequest(), + {}, + ], +) +async def test_update_collection_async(request_type, transport: str = "grpc_asyncio"): client = VectorSearchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2768,7 +2789,7 @@ async def test_update_collection_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( @@ -2790,11 +2811,6 @@ async def test_update_collection_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_collection_async_from_dict(): - await test_update_collection_async(request_type=dict) - - def test_update_collection_field_headers(): client = VectorSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2959,8 +2975,8 @@ async def test_update_collection_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vectorsearch_service.DeleteCollectionRequest, - dict, + vectorsearch_service.DeleteCollectionRequest(), + {}, ], ) def test_delete_collection(request_type, transport: str = "grpc"): @@ -2971,7 +2987,7 @@ def test_delete_collection(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3016,9 +3032,10 @@ def test_delete_collection_non_empty_request_with_auto_populated_field(): client.delete_collection(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vectorsearch_service.DeleteCollectionRequest( + request_msg = vectorsearch_service.DeleteCollectionRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_collection_use_cached_wrapped_rpc(): @@ -3111,10 +3128,14 @@ async def test_delete_collection_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_collection_async( - transport: str = "grpc_asyncio", - request_type=vectorsearch_service.DeleteCollectionRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + vectorsearch_service.DeleteCollectionRequest(), + {}, + ], +) +async def test_delete_collection_async(request_type, transport: str = "grpc_asyncio"): client = VectorSearchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3122,7 +3143,7 @@ async def test_delete_collection_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( @@ -3144,11 +3165,6 @@ async def test_delete_collection_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_collection_async_from_dict(): - await test_delete_collection_async(request_type=dict) - - def test_delete_collection_field_headers(): client = VectorSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3303,8 +3319,8 @@ async def test_delete_collection_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vectorsearch_service.ListIndexesRequest, - dict, + vectorsearch_service.ListIndexesRequest(), + {}, ], ) def test_list_indexes(request_type, transport: str = "grpc"): @@ -3315,7 +3331,7 @@ def test_list_indexes(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_indexes), "__call__") as call: @@ -3362,12 +3378,13 @@ def test_list_indexes_non_empty_request_with_auto_populated_field(): client.list_indexes(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vectorsearch_service.ListIndexesRequest( + request_msg = vectorsearch_service.ListIndexesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_indexes_use_cached_wrapped_rpc(): @@ -3448,10 +3465,14 @@ async def test_list_indexes_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_indexes_async( - transport: str = "grpc_asyncio", - request_type=vectorsearch_service.ListIndexesRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + vectorsearch_service.ListIndexesRequest(), + {}, + ], +) +async def test_list_indexes_async(request_type, transport: str = "grpc_asyncio"): client = VectorSearchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3459,7 +3480,7 @@ async def test_list_indexes_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_indexes), "__call__") as call: @@ -3482,11 +3503,6 @@ async def test_list_indexes_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_indexes_async_from_dict(): - await test_list_indexes_async(request_type=dict) - - def test_list_indexes_field_headers(): client = VectorSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3823,8 +3839,8 @@ async def test_list_indexes_async_pages(): @pytest.mark.parametrize( "request_type", [ - vectorsearch_service.GetIndexRequest, - dict, + vectorsearch_service.GetIndexRequest(), + {}, ], ) def test_get_index(request_type, transport: str = "grpc"): @@ -3835,7 +3851,7 @@ def test_get_index(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_index), "__call__") as call: @@ -3891,9 +3907,10 @@ def test_get_index_non_empty_request_with_auto_populated_field(): client.get_index(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vectorsearch_service.GetIndexRequest( + request_msg = vectorsearch_service.GetIndexRequest( name="name_value", ) + assert args[0] == request_msg def test_get_index_use_cached_wrapped_rpc(): @@ -3972,9 +3989,14 @@ async def test_get_index_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_index_async( - transport: str = "grpc_asyncio", request_type=vectorsearch_service.GetIndexRequest -): +@pytest.mark.parametrize( + "request_type", + [ + vectorsearch_service.GetIndexRequest(), + {}, + ], +) +async def test_get_index_async(request_type, transport: str = "grpc_asyncio"): client = VectorSearchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3982,7 +4004,7 @@ async def test_get_index_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_index), "__call__") as call: @@ -4017,11 +4039,6 @@ async def test_get_index_async( assert response.store_fields == ["store_fields_value"] -@pytest.mark.asyncio -async def test_get_index_async_from_dict(): - await test_get_index_async(request_type=dict) - - def test_get_index_field_headers(): client = VectorSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4168,8 +4185,8 @@ async def test_get_index_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vectorsearch_service.CreateIndexRequest, - dict, + vectorsearch_service.CreateIndexRequest(), + {}, ], ) def test_create_index(request_type, transport: str = "grpc"): @@ -4180,7 +4197,7 @@ def test_create_index(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_index), "__call__") as call: @@ -4222,10 +4239,11 @@ def test_create_index_non_empty_request_with_auto_populated_field(): client.create_index(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vectorsearch_service.CreateIndexRequest( + request_msg = vectorsearch_service.CreateIndexRequest( parent="parent_value", index_id="index_id_value", ) + assert args[0] == request_msg def test_create_index_use_cached_wrapped_rpc(): @@ -4316,10 +4334,14 @@ async def test_create_index_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_index_async( - transport: str = "grpc_asyncio", - request_type=vectorsearch_service.CreateIndexRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + vectorsearch_service.CreateIndexRequest(), + {}, + ], +) +async def test_create_index_async(request_type, transport: str = "grpc_asyncio"): client = VectorSearchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4327,7 +4349,7 @@ async def test_create_index_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_index), "__call__") as call: @@ -4347,11 +4369,6 @@ async def test_create_index_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_index_async_from_dict(): - await test_create_index_async(request_type=dict) - - def test_create_index_field_headers(): client = VectorSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4542,8 +4559,8 @@ async def test_create_index_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vectorsearch_service.UpdateIndexRequest, - dict, + vectorsearch_service.UpdateIndexRequest(), + {}, ], ) def test_update_index(request_type, transport: str = "grpc"): @@ -4554,7 +4571,7 @@ def test_update_index(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_index), "__call__") as call: @@ -4593,7 +4610,8 @@ def test_update_index_non_empty_request_with_auto_populated_field(): client.update_index(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vectorsearch_service.UpdateIndexRequest() + request_msg = vectorsearch_service.UpdateIndexRequest() + assert args[0] == request_msg def test_update_index_use_cached_wrapped_rpc(): @@ -4684,10 +4702,14 @@ async def test_update_index_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_index_async( - transport: str = "grpc_asyncio", - request_type=vectorsearch_service.UpdateIndexRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + vectorsearch_service.UpdateIndexRequest(), + {}, + ], +) +async def test_update_index_async(request_type, transport: str = "grpc_asyncio"): client = VectorSearchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4695,7 +4717,7 @@ async def test_update_index_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_index), "__call__") as call: @@ -4715,11 +4737,6 @@ async def test_update_index_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_index_async_from_dict(): - await test_update_index_async(request_type=dict) - - def test_update_index_field_headers(): client = VectorSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4900,8 +4917,8 @@ async def test_update_index_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vectorsearch_service.DeleteIndexRequest, - dict, + vectorsearch_service.DeleteIndexRequest(), + {}, ], ) def test_delete_index(request_type, transport: str = "grpc"): @@ -4912,7 +4929,7 @@ def test_delete_index(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_index), "__call__") as call: @@ -4953,9 +4970,10 @@ def test_delete_index_non_empty_request_with_auto_populated_field(): client.delete_index(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vectorsearch_service.DeleteIndexRequest( + request_msg = vectorsearch_service.DeleteIndexRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_index_use_cached_wrapped_rpc(): @@ -5046,10 +5064,14 @@ async def test_delete_index_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_index_async( - transport: str = "grpc_asyncio", - request_type=vectorsearch_service.DeleteIndexRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + vectorsearch_service.DeleteIndexRequest(), + {}, + ], +) +async def test_delete_index_async(request_type, transport: str = "grpc_asyncio"): client = VectorSearchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5057,7 +5079,7 @@ async def test_delete_index_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_index), "__call__") as call: @@ -5077,11 +5099,6 @@ async def test_delete_index_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_index_async_from_dict(): - await test_delete_index_async(request_type=dict) - - def test_delete_index_field_headers(): client = VectorSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5228,8 +5245,8 @@ async def test_delete_index_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vectorsearch_service.ImportDataObjectsRequest, - dict, + vectorsearch_service.ImportDataObjectsRequest(), + {}, ], ) def test_import_data_objects(request_type, transport: str = "grpc"): @@ -5240,7 +5257,7 @@ def test_import_data_objects(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5285,9 +5302,10 @@ def test_import_data_objects_non_empty_request_with_auto_populated_field(): client.import_data_objects(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vectorsearch_service.ImportDataObjectsRequest( + request_msg = vectorsearch_service.ImportDataObjectsRequest( name="name_value", ) + assert args[0] == request_msg def test_import_data_objects_use_cached_wrapped_rpc(): @@ -5382,10 +5400,14 @@ async def test_import_data_objects_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_import_data_objects_async( - transport: str = "grpc_asyncio", - request_type=vectorsearch_service.ImportDataObjectsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + vectorsearch_service.ImportDataObjectsRequest(), + {}, + ], +) +async def test_import_data_objects_async(request_type, transport: str = "grpc_asyncio"): client = VectorSearchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5393,7 +5415,7 @@ async def test_import_data_objects_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( @@ -5415,11 +5437,6 @@ async def test_import_data_objects_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_import_data_objects_async_from_dict(): - await test_import_data_objects_async(request_type=dict) - - def test_import_data_objects_field_headers(): client = VectorSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5488,8 +5505,8 @@ async def test_import_data_objects_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - vectorsearch_service.ExportDataObjectsRequest, - dict, + vectorsearch_service.ExportDataObjectsRequest(), + {}, ], ) def test_export_data_objects(request_type, transport: str = "grpc"): @@ -5500,7 +5517,7 @@ def test_export_data_objects(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5545,9 +5562,10 @@ def test_export_data_objects_non_empty_request_with_auto_populated_field(): client.export_data_objects(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vectorsearch_service.ExportDataObjectsRequest( + request_msg = vectorsearch_service.ExportDataObjectsRequest( name="name_value", ) + assert args[0] == request_msg def test_export_data_objects_use_cached_wrapped_rpc(): @@ -5642,10 +5660,14 @@ async def test_export_data_objects_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_export_data_objects_async( - transport: str = "grpc_asyncio", - request_type=vectorsearch_service.ExportDataObjectsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + vectorsearch_service.ExportDataObjectsRequest(), + {}, + ], +) +async def test_export_data_objects_async(request_type, transport: str = "grpc_asyncio"): client = VectorSearchServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5653,7 +5675,7 @@ async def test_export_data_objects_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( @@ -5675,11 +5697,6 @@ async def test_export_data_objects_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_export_data_objects_async_from_dict(): - await test_export_data_objects_async(request_type=dict) - - def test_export_data_objects_field_headers(): client = VectorSearchServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8212,7 +8229,6 @@ def test_list_collections_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vectorsearch_service.ListCollectionsRequest() - assert args[0] == request_msg @@ -8233,7 +8249,6 @@ def test_get_collection_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vectorsearch_service.GetCollectionRequest() - assert args[0] == request_msg @@ -8256,7 +8271,6 @@ def test_create_collection_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vectorsearch_service.CreateCollectionRequest() - assert args[0] == request_msg @@ -8279,7 +8293,6 @@ def test_update_collection_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vectorsearch_service.UpdateCollectionRequest() - assert args[0] == request_msg @@ -8302,7 +8315,6 @@ def test_delete_collection_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vectorsearch_service.DeleteCollectionRequest() - assert args[0] == request_msg @@ -8323,7 +8335,6 @@ def test_list_indexes_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vectorsearch_service.ListIndexesRequest() - assert args[0] == request_msg @@ -8344,7 +8355,6 @@ def test_get_index_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vectorsearch_service.GetIndexRequest() - assert args[0] == request_msg @@ -8365,7 +8375,6 @@ def test_create_index_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vectorsearch_service.CreateIndexRequest() - assert args[0] == request_msg @@ -8386,7 +8395,6 @@ def test_update_index_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vectorsearch_service.UpdateIndexRequest() - assert args[0] == request_msg @@ -8407,7 +8415,6 @@ def test_delete_index_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vectorsearch_service.DeleteIndexRequest() - assert args[0] == request_msg @@ -8430,7 +8437,6 @@ def test_import_data_objects_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vectorsearch_service.ImportDataObjectsRequest() - assert args[0] == request_msg @@ -8453,7 +8459,6 @@ def test_export_data_objects_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vectorsearch_service.ExportDataObjectsRequest() - assert args[0] == request_msg @@ -8495,7 +8500,6 @@ async def test_list_collections_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vectorsearch_service.ListCollectionsRequest() - assert args[0] == request_msg @@ -8524,7 +8528,6 @@ async def test_get_collection_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vectorsearch_service.GetCollectionRequest() - assert args[0] == request_msg @@ -8551,7 +8554,6 @@ async def test_create_collection_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vectorsearch_service.CreateCollectionRequest() - assert args[0] == request_msg @@ -8578,7 +8580,6 @@ async def test_update_collection_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vectorsearch_service.UpdateCollectionRequest() - assert args[0] == request_msg @@ -8605,7 +8606,6 @@ async def test_delete_collection_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vectorsearch_service.DeleteCollectionRequest() - assert args[0] == request_msg @@ -8632,7 +8632,6 @@ async def test_list_indexes_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vectorsearch_service.ListIndexesRequest() - assert args[0] == request_msg @@ -8665,7 +8664,6 @@ async def test_get_index_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vectorsearch_service.GetIndexRequest() - assert args[0] == request_msg @@ -8690,7 +8688,6 @@ async def test_create_index_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vectorsearch_service.CreateIndexRequest() - assert args[0] == request_msg @@ -8715,7 +8712,6 @@ async def test_update_index_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vectorsearch_service.UpdateIndexRequest() - assert args[0] == request_msg @@ -8740,7 +8736,6 @@ async def test_delete_index_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vectorsearch_service.DeleteIndexRequest() - assert args[0] == request_msg @@ -8767,7 +8762,6 @@ async def test_import_data_objects_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vectorsearch_service.ImportDataObjectsRequest() - assert args[0] == request_msg @@ -8794,7 +8788,6 @@ async def test_export_data_objects_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vectorsearch_service.ExportDataObjectsRequest() - assert args[0] == request_msg @@ -11108,7 +11101,6 @@ def test_list_collections_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vectorsearch_service.ListCollectionsRequest() - assert args[0] == request_msg @@ -11128,7 +11120,6 @@ def test_get_collection_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vectorsearch_service.GetCollectionRequest() - assert args[0] == request_msg @@ -11150,7 +11141,6 @@ def test_create_collection_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vectorsearch_service.CreateCollectionRequest() - assert args[0] == request_msg @@ -11172,7 +11162,6 @@ def test_update_collection_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vectorsearch_service.UpdateCollectionRequest() - assert args[0] == request_msg @@ -11194,7 +11183,6 @@ def test_delete_collection_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vectorsearch_service.DeleteCollectionRequest() - assert args[0] == request_msg @@ -11214,7 +11202,6 @@ def test_list_indexes_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vectorsearch_service.ListIndexesRequest() - assert args[0] == request_msg @@ -11234,7 +11221,6 @@ def test_get_index_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vectorsearch_service.GetIndexRequest() - assert args[0] == request_msg @@ -11254,7 +11240,6 @@ def test_create_index_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vectorsearch_service.CreateIndexRequest() - assert args[0] == request_msg @@ -11274,7 +11259,6 @@ def test_update_index_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vectorsearch_service.UpdateIndexRequest() - assert args[0] == request_msg @@ -11294,7 +11278,6 @@ def test_delete_index_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vectorsearch_service.DeleteIndexRequest() - assert args[0] == request_msg @@ -11316,7 +11299,6 @@ def test_import_data_objects_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vectorsearch_service.ImportDataObjectsRequest() - assert args[0] == request_msg @@ -11338,7 +11320,6 @@ def test_export_data_objects_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vectorsearch_service.ExportDataObjectsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-video-live-stream/noxfile.py b/packages/google-cloud-video-live-stream/noxfile.py index 2c9ab63ff063..f655209973ee 100644 --- a/packages/google-cloud-video-live-stream/noxfile.py +++ b/packages/google-cloud-video-live-stream/noxfile.py @@ -47,7 +47,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-video-live-stream" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-video-live-stream/setup.py b/packages/google-cloud-video-live-stream/setup.py index 85dee24f1d0a..7377ca4fc650 100644 --- a/packages/google-cloud-video-live-stream/setup.py +++ b/packages/google-cloud-video-live-stream/setup.py @@ -45,7 +45,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/google-cloud-video-live-stream/testing/constraints-3.10.txt b/packages/google-cloud-video-live-stream/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-video-live-stream/testing/constraints-3.10.txt +++ b/packages/google-cloud-video-live-stream/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-video-live-stream/tests/unit/gapic/live_stream_v1/test_livestream_service.py b/packages/google-cloud-video-live-stream/tests/unit/gapic/live_stream_v1/test_livestream_service.py index 47f2c70d5a8c..5ed86a02d674 100644 --- a/packages/google-cloud-video-live-stream/tests/unit/gapic/live_stream_v1/test_livestream_service.py +++ b/packages/google-cloud-video-live-stream/tests/unit/gapic/live_stream_v1/test_livestream_service.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 @@ -120,6 +121,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" @@ -1361,8 +1377,8 @@ def test_livestream_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - service.CreateChannelRequest, - dict, + service.CreateChannelRequest(), + {}, ], ) def test_create_channel(request_type, transport: str = "grpc"): @@ -1373,7 +1389,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(type(client.transport.create_channel_), "__call__") as call: @@ -1416,11 +1432,12 @@ 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] == service.CreateChannelRequest( + request_msg = service.CreateChannelRequest( parent="parent_value", channel_id="channel_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_channel_use_cached_wrapped_rpc(): @@ -1511,9 +1528,14 @@ async def test_create_channel_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_channel_async( - transport: str = "grpc_asyncio", request_type=service.CreateChannelRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CreateChannelRequest(), + {}, + ], +) +async def test_create_channel_async(request_type, transport: str = "grpc_asyncio"): client = LivestreamServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1521,7 +1543,7 @@ async def test_create_channel_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_channel_), "__call__") as call: @@ -1541,11 +1563,6 @@ async def test_create_channel_async( 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 = LivestreamServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1712,8 +1729,8 @@ async def test_create_channel_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListChannelsRequest, - dict, + service.ListChannelsRequest(), + {}, ], ) def test_list_channels(request_type, transport: str = "grpc"): @@ -1724,7 +1741,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(type(client.transport.list_channels), "__call__") as call: @@ -1773,12 +1790,13 @@ 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] == service.ListChannelsRequest( + request_msg = service.ListChannelsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_channels_use_cached_wrapped_rpc(): @@ -1859,9 +1877,14 @@ async def test_list_channels_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_channels_async( - transport: str = "grpc_asyncio", request_type=service.ListChannelsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListChannelsRequest(), + {}, + ], +) +async def test_list_channels_async(request_type, transport: str = "grpc_asyncio"): client = LivestreamServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1869,7 +1892,7 @@ async def test_list_channels_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_channels), "__call__") as call: @@ -1894,11 +1917,6 @@ async def test_list_channels_async( 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 = LivestreamServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2235,8 +2253,8 @@ async def test_list_channels_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetChannelRequest, - dict, + service.GetChannelRequest(), + {}, ], ) def test_get_channel(request_type, transport: str = "grpc"): @@ -2247,7 +2265,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(type(client.transport.get_channel), "__call__") as call: @@ -2295,9 +2313,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] == service.GetChannelRequest( + request_msg = service.GetChannelRequest( name="name_value", ) + assert args[0] == request_msg def test_get_channel_use_cached_wrapped_rpc(): @@ -2378,9 +2397,14 @@ async def test_get_channel_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_channel_async( - transport: str = "grpc_asyncio", request_type=service.GetChannelRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetChannelRequest(), + {}, + ], +) +async def test_get_channel_async(request_type, transport: str = "grpc_asyncio"): client = LivestreamServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2388,7 +2412,7 @@ async def test_get_channel_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_channel), "__call__") as call: @@ -2415,11 +2439,6 @@ async def test_get_channel_async( assert response.streaming_state == resources.Channel.StreamingState.STREAMING -@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 = LivestreamServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2562,8 +2581,8 @@ async def test_get_channel_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DeleteChannelRequest, - dict, + service.DeleteChannelRequest(), + {}, ], ) def test_delete_channel(request_type, transport: str = "grpc"): @@ -2574,7 +2593,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(type(client.transport.delete_channel), "__call__") as call: @@ -2616,10 +2635,11 @@ 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] == service.DeleteChannelRequest( + request_msg = service.DeleteChannelRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_channel_use_cached_wrapped_rpc(): @@ -2710,9 +2730,14 @@ async def test_delete_channel_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_channel_async( - transport: str = "grpc_asyncio", request_type=service.DeleteChannelRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteChannelRequest(), + {}, + ], +) +async def test_delete_channel_async(request_type, transport: str = "grpc_asyncio"): client = LivestreamServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2720,7 +2745,7 @@ async def test_delete_channel_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_channel), "__call__") as call: @@ -2740,11 +2765,6 @@ async def test_delete_channel_async( 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 = LivestreamServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2891,8 +2911,8 @@ async def test_delete_channel_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdateChannelRequest, - dict, + service.UpdateChannelRequest(), + {}, ], ) def test_update_channel(request_type, transport: str = "grpc"): @@ -2903,7 +2923,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(type(client.transport.update_channel), "__call__") as call: @@ -2944,9 +2964,10 @@ 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] == service.UpdateChannelRequest( + request_msg = service.UpdateChannelRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_channel_use_cached_wrapped_rpc(): @@ -3037,9 +3058,14 @@ async def test_update_channel_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_channel_async( - transport: str = "grpc_asyncio", request_type=service.UpdateChannelRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateChannelRequest(), + {}, + ], +) +async def test_update_channel_async(request_type, transport: str = "grpc_asyncio"): client = LivestreamServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3047,7 +3073,7 @@ async def test_update_channel_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_channel), "__call__") as call: @@ -3067,11 +3093,6 @@ async def test_update_channel_async( 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 = LivestreamServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3228,8 +3249,8 @@ async def test_update_channel_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.StartChannelRequest, - dict, + service.StartChannelRequest(), + {}, ], ) def test_start_channel(request_type, transport: str = "grpc"): @@ -3240,7 +3261,7 @@ def test_start_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(type(client.transport.start_channel), "__call__") as call: @@ -3282,10 +3303,11 @@ def test_start_channel_non_empty_request_with_auto_populated_field(): client.start_channel(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.StartChannelRequest( + request_msg = service.StartChannelRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_start_channel_use_cached_wrapped_rpc(): @@ -3376,9 +3398,14 @@ async def test_start_channel_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_start_channel_async( - transport: str = "grpc_asyncio", request_type=service.StartChannelRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.StartChannelRequest(), + {}, + ], +) +async def test_start_channel_async(request_type, transport: str = "grpc_asyncio"): client = LivestreamServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3386,7 +3413,7 @@ async def test_start_channel_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.start_channel), "__call__") as call: @@ -3406,11 +3433,6 @@ async def test_start_channel_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_start_channel_async_from_dict(): - await test_start_channel_async(request_type=dict) - - def test_start_channel_field_headers(): client = LivestreamServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3557,8 +3579,8 @@ async def test_start_channel_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.StopChannelRequest, - dict, + service.StopChannelRequest(), + {}, ], ) def test_stop_channel(request_type, transport: str = "grpc"): @@ -3569,7 +3591,7 @@ def test_stop_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(type(client.transport.stop_channel), "__call__") as call: @@ -3611,10 +3633,11 @@ def test_stop_channel_non_empty_request_with_auto_populated_field(): client.stop_channel(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.StopChannelRequest( + request_msg = service.StopChannelRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_stop_channel_use_cached_wrapped_rpc(): @@ -3705,9 +3728,14 @@ async def test_stop_channel_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_stop_channel_async( - transport: str = "grpc_asyncio", request_type=service.StopChannelRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.StopChannelRequest(), + {}, + ], +) +async def test_stop_channel_async(request_type, transport: str = "grpc_asyncio"): client = LivestreamServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3715,7 +3743,7 @@ async def test_stop_channel_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.stop_channel), "__call__") as call: @@ -3735,11 +3763,6 @@ async def test_stop_channel_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_stop_channel_async_from_dict(): - await test_stop_channel_async(request_type=dict) - - def test_stop_channel_field_headers(): client = LivestreamServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3886,8 +3909,8 @@ async def test_stop_channel_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.StartDistributionRequest, - dict, + service.StartDistributionRequest(), + {}, ], ) def test_start_distribution(request_type, transport: str = "grpc"): @@ -3898,7 +3921,7 @@ def test_start_distribution(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3943,9 +3966,10 @@ def test_start_distribution_non_empty_request_with_auto_populated_field(): client.start_distribution(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.StartDistributionRequest( + request_msg = service.StartDistributionRequest( name="name_value", ) + assert args[0] == request_msg def test_start_distribution_use_cached_wrapped_rpc(): @@ -4040,9 +4064,14 @@ async def test_start_distribution_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_start_distribution_async( - transport: str = "grpc_asyncio", request_type=service.StartDistributionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.StartDistributionRequest(), + {}, + ], +) +async def test_start_distribution_async(request_type, transport: str = "grpc_asyncio"): client = LivestreamServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4050,7 +4079,7 @@ async def test_start_distribution_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( @@ -4072,11 +4101,6 @@ async def test_start_distribution_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_start_distribution_async_from_dict(): - await test_start_distribution_async(request_type=dict) - - def test_start_distribution_field_headers(): client = LivestreamServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4241,8 +4265,8 @@ async def test_start_distribution_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.StopDistributionRequest, - dict, + service.StopDistributionRequest(), + {}, ], ) def test_stop_distribution(request_type, transport: str = "grpc"): @@ -4253,7 +4277,7 @@ def test_stop_distribution(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4298,9 +4322,10 @@ def test_stop_distribution_non_empty_request_with_auto_populated_field(): client.stop_distribution(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.StopDistributionRequest( + request_msg = service.StopDistributionRequest( name="name_value", ) + assert args[0] == request_msg def test_stop_distribution_use_cached_wrapped_rpc(): @@ -4393,9 +4418,14 @@ async def test_stop_distribution_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_stop_distribution_async( - transport: str = "grpc_asyncio", request_type=service.StopDistributionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.StopDistributionRequest(), + {}, + ], +) +async def test_stop_distribution_async(request_type, transport: str = "grpc_asyncio"): client = LivestreamServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4403,7 +4433,7 @@ async def test_stop_distribution_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( @@ -4425,11 +4455,6 @@ async def test_stop_distribution_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_stop_distribution_async_from_dict(): - await test_stop_distribution_async(request_type=dict) - - def test_stop_distribution_field_headers(): client = LivestreamServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4594,8 +4619,8 @@ async def test_stop_distribution_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.CreateInputRequest, - dict, + service.CreateInputRequest(), + {}, ], ) def test_create_input(request_type, transport: str = "grpc"): @@ -4606,7 +4631,7 @@ def test_create_input(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_input), "__call__") as call: @@ -4649,11 +4674,12 @@ def test_create_input_non_empty_request_with_auto_populated_field(): client.create_input(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateInputRequest( + request_msg = service.CreateInputRequest( parent="parent_value", input_id="input_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_input_use_cached_wrapped_rpc(): @@ -4744,9 +4770,14 @@ async def test_create_input_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_input_async( - transport: str = "grpc_asyncio", request_type=service.CreateInputRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CreateInputRequest(), + {}, + ], +) +async def test_create_input_async(request_type, transport: str = "grpc_asyncio"): client = LivestreamServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4754,7 +4785,7 @@ async def test_create_input_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_input), "__call__") as call: @@ -4774,11 +4805,6 @@ async def test_create_input_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_input_async_from_dict(): - await test_create_input_async(request_type=dict) - - def test_create_input_field_headers(): client = LivestreamServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4945,8 +4971,8 @@ async def test_create_input_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListInputsRequest, - dict, + service.ListInputsRequest(), + {}, ], ) def test_list_inputs(request_type, transport: str = "grpc"): @@ -4957,7 +4983,7 @@ def test_list_inputs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_inputs), "__call__") as call: @@ -5006,12 +5032,13 @@ def test_list_inputs_non_empty_request_with_auto_populated_field(): client.list_inputs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListInputsRequest( + request_msg = service.ListInputsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_inputs_use_cached_wrapped_rpc(): @@ -5092,9 +5119,14 @@ async def test_list_inputs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_inputs_async( - transport: str = "grpc_asyncio", request_type=service.ListInputsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListInputsRequest(), + {}, + ], +) +async def test_list_inputs_async(request_type, transport: str = "grpc_asyncio"): client = LivestreamServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5102,7 +5134,7 @@ async def test_list_inputs_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_inputs), "__call__") as call: @@ -5127,11 +5159,6 @@ async def test_list_inputs_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_inputs_async_from_dict(): - await test_list_inputs_async(request_type=dict) - - def test_list_inputs_field_headers(): client = LivestreamServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5468,8 +5495,8 @@ async def test_list_inputs_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetInputRequest, - dict, + service.GetInputRequest(), + {}, ], ) def test_get_input(request_type, transport: str = "grpc"): @@ -5480,7 +5507,7 @@ def test_get_input(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_input), "__call__") as call: @@ -5530,9 +5557,10 @@ def test_get_input_non_empty_request_with_auto_populated_field(): client.get_input(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetInputRequest( + request_msg = service.GetInputRequest( name="name_value", ) + assert args[0] == request_msg def test_get_input_use_cached_wrapped_rpc(): @@ -5611,9 +5639,14 @@ async def test_get_input_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_input_async( - transport: str = "grpc_asyncio", request_type=service.GetInputRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetInputRequest(), + {}, + ], +) +async def test_get_input_async(request_type, transport: str = "grpc_asyncio"): client = LivestreamServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5621,7 +5654,7 @@ async def test_get_input_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_input), "__call__") as call: @@ -5650,11 +5683,6 @@ async def test_get_input_async( assert response.uri == "uri_value" -@pytest.mark.asyncio -async def test_get_input_async_from_dict(): - await test_get_input_async(request_type=dict) - - def test_get_input_field_headers(): client = LivestreamServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5797,8 +5825,8 @@ async def test_get_input_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DeleteInputRequest, - dict, + service.DeleteInputRequest(), + {}, ], ) def test_delete_input(request_type, transport: str = "grpc"): @@ -5809,7 +5837,7 @@ def test_delete_input(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_input), "__call__") as call: @@ -5851,10 +5879,11 @@ def test_delete_input_non_empty_request_with_auto_populated_field(): client.delete_input(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteInputRequest( + request_msg = service.DeleteInputRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_input_use_cached_wrapped_rpc(): @@ -5945,9 +5974,14 @@ async def test_delete_input_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_input_async( - transport: str = "grpc_asyncio", request_type=service.DeleteInputRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteInputRequest(), + {}, + ], +) +async def test_delete_input_async(request_type, transport: str = "grpc_asyncio"): client = LivestreamServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5955,7 +5989,7 @@ async def test_delete_input_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_input), "__call__") as call: @@ -5975,11 +6009,6 @@ async def test_delete_input_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_input_async_from_dict(): - await test_delete_input_async(request_type=dict) - - def test_delete_input_field_headers(): client = LivestreamServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6126,8 +6155,8 @@ async def test_delete_input_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdateInputRequest, - dict, + service.UpdateInputRequest(), + {}, ], ) def test_update_input(request_type, transport: str = "grpc"): @@ -6138,7 +6167,7 @@ def test_update_input(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_input), "__call__") as call: @@ -6179,9 +6208,10 @@ def test_update_input_non_empty_request_with_auto_populated_field(): client.update_input(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateInputRequest( + request_msg = service.UpdateInputRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_input_use_cached_wrapped_rpc(): @@ -6272,9 +6302,14 @@ async def test_update_input_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_input_async( - transport: str = "grpc_asyncio", request_type=service.UpdateInputRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateInputRequest(), + {}, + ], +) +async def test_update_input_async(request_type, transport: str = "grpc_asyncio"): client = LivestreamServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6282,7 +6317,7 @@ async def test_update_input_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_input), "__call__") as call: @@ -6302,11 +6337,6 @@ async def test_update_input_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_input_async_from_dict(): - await test_update_input_async(request_type=dict) - - def test_update_input_field_headers(): client = LivestreamServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6463,8 +6493,8 @@ async def test_update_input_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.PreviewInputRequest, - dict, + service.PreviewInputRequest(), + {}, ], ) def test_preview_input(request_type, transport: str = "grpc"): @@ -6475,7 +6505,7 @@ def test_preview_input(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.preview_input), "__call__") as call: @@ -6521,9 +6551,10 @@ def test_preview_input_non_empty_request_with_auto_populated_field(): client.preview_input(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.PreviewInputRequest( + request_msg = service.PreviewInputRequest( name="name_value", ) + assert args[0] == request_msg def test_preview_input_use_cached_wrapped_rpc(): @@ -6604,9 +6635,14 @@ async def test_preview_input_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_preview_input_async( - transport: str = "grpc_asyncio", request_type=service.PreviewInputRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.PreviewInputRequest(), + {}, + ], +) +async def test_preview_input_async(request_type, transport: str = "grpc_asyncio"): client = LivestreamServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6614,7 +6650,7 @@ async def test_preview_input_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.preview_input), "__call__") as call: @@ -6639,11 +6675,6 @@ async def test_preview_input_async( assert response.bearer_token == "bearer_token_value" -@pytest.mark.asyncio -async def test_preview_input_async_from_dict(): - await test_preview_input_async(request_type=dict) - - def test_preview_input_field_headers(): client = LivestreamServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6790,8 +6821,8 @@ async def test_preview_input_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.CreateEventRequest, - dict, + service.CreateEventRequest(), + {}, ], ) def test_create_event(request_type, transport: str = "grpc"): @@ -6802,7 +6833,7 @@ def test_create_event(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_event), "__call__") as call: @@ -6852,11 +6883,12 @@ def test_create_event_non_empty_request_with_auto_populated_field(): client.create_event(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateEventRequest( + request_msg = service.CreateEventRequest( parent="parent_value", event_id="event_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_event_use_cached_wrapped_rpc(): @@ -6937,9 +6969,14 @@ async def test_create_event_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_event_async( - transport: str = "grpc_asyncio", request_type=service.CreateEventRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CreateEventRequest(), + {}, + ], +) +async def test_create_event_async(request_type, transport: str = "grpc_asyncio"): client = LivestreamServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6947,7 +6984,7 @@ async def test_create_event_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_event), "__call__") as call: @@ -6974,11 +7011,6 @@ async def test_create_event_async( assert response.state == resources.Event.State.SCHEDULED -@pytest.mark.asyncio -async def test_create_event_async_from_dict(): - await test_create_event_async(request_type=dict) - - def test_create_event_field_headers(): client = LivestreamServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7141,8 +7173,8 @@ async def test_create_event_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListEventsRequest, - dict, + service.ListEventsRequest(), + {}, ], ) def test_list_events(request_type, transport: str = "grpc"): @@ -7153,7 +7185,7 @@ def test_list_events(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_events), "__call__") as call: @@ -7202,12 +7234,13 @@ def test_list_events_non_empty_request_with_auto_populated_field(): client.list_events(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListEventsRequest( + request_msg = service.ListEventsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_events_use_cached_wrapped_rpc(): @@ -7288,9 +7321,14 @@ async def test_list_events_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_events_async( - transport: str = "grpc_asyncio", request_type=service.ListEventsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListEventsRequest(), + {}, + ], +) +async def test_list_events_async(request_type, transport: str = "grpc_asyncio"): client = LivestreamServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7298,7 +7336,7 @@ async def test_list_events_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_events), "__call__") as call: @@ -7323,11 +7361,6 @@ async def test_list_events_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_events_async_from_dict(): - await test_list_events_async(request_type=dict) - - def test_list_events_field_headers(): client = LivestreamServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7664,8 +7697,8 @@ async def test_list_events_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetEventRequest, - dict, + service.GetEventRequest(), + {}, ], ) def test_get_event(request_type, transport: str = "grpc"): @@ -7676,7 +7709,7 @@ def test_get_event(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_event), "__call__") as call: @@ -7724,9 +7757,10 @@ def test_get_event_non_empty_request_with_auto_populated_field(): client.get_event(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetEventRequest( + request_msg = service.GetEventRequest( name="name_value", ) + assert args[0] == request_msg def test_get_event_use_cached_wrapped_rpc(): @@ -7805,9 +7839,14 @@ async def test_get_event_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_event_async( - transport: str = "grpc_asyncio", request_type=service.GetEventRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetEventRequest(), + {}, + ], +) +async def test_get_event_async(request_type, transport: str = "grpc_asyncio"): client = LivestreamServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7815,7 +7854,7 @@ async def test_get_event_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_event), "__call__") as call: @@ -7842,11 +7881,6 @@ async def test_get_event_async( assert response.state == resources.Event.State.SCHEDULED -@pytest.mark.asyncio -async def test_get_event_async_from_dict(): - await test_get_event_async(request_type=dict) - - def test_get_event_field_headers(): client = LivestreamServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7989,8 +8023,8 @@ async def test_get_event_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DeleteEventRequest, - dict, + service.DeleteEventRequest(), + {}, ], ) def test_delete_event(request_type, transport: str = "grpc"): @@ -8001,7 +8035,7 @@ def test_delete_event(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_event), "__call__") as call: @@ -8043,10 +8077,11 @@ def test_delete_event_non_empty_request_with_auto_populated_field(): client.delete_event(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteEventRequest( + request_msg = service.DeleteEventRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_event_use_cached_wrapped_rpc(): @@ -8127,9 +8162,14 @@ async def test_delete_event_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_event_async( - transport: str = "grpc_asyncio", request_type=service.DeleteEventRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteEventRequest(), + {}, + ], +) +async def test_delete_event_async(request_type, transport: str = "grpc_asyncio"): client = LivestreamServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8137,7 +8177,7 @@ async def test_delete_event_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_event), "__call__") as call: @@ -8155,11 +8195,6 @@ async def test_delete_event_async( assert response is None -@pytest.mark.asyncio -async def test_delete_event_async_from_dict(): - await test_delete_event_async(request_type=dict) - - def test_delete_event_field_headers(): client = LivestreamServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8302,8 +8337,8 @@ async def test_delete_event_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListClipsRequest, - dict, + service.ListClipsRequest(), + {}, ], ) def test_list_clips(request_type, transport: str = "grpc"): @@ -8314,7 +8349,7 @@ def test_list_clips(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_clips), "__call__") as call: @@ -8363,12 +8398,13 @@ def test_list_clips_non_empty_request_with_auto_populated_field(): client.list_clips(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListClipsRequest( + request_msg = service.ListClipsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_clips_use_cached_wrapped_rpc(): @@ -8447,9 +8483,14 @@ async def test_list_clips_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_list_clips_async( - transport: str = "grpc_asyncio", request_type=service.ListClipsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListClipsRequest(), + {}, + ], +) +async def test_list_clips_async(request_type, transport: str = "grpc_asyncio"): client = LivestreamServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8457,7 +8498,7 @@ async def test_list_clips_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_clips), "__call__") as call: @@ -8482,11 +8523,6 @@ async def test_list_clips_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_clips_async_from_dict(): - await test_list_clips_async(request_type=dict) - - def test_list_clips_field_headers(): client = LivestreamServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8823,8 +8859,8 @@ async def test_list_clips_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetClipRequest, - dict, + service.GetClipRequest(), + {}, ], ) def test_get_clip(request_type, transport: str = "grpc"): @@ -8835,7 +8871,7 @@ def test_get_clip(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_clip), "__call__") as call: @@ -8885,9 +8921,10 @@ def test_get_clip_non_empty_request_with_auto_populated_field(): client.get_clip(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetClipRequest( + request_msg = service.GetClipRequest( name="name_value", ) + assert args[0] == request_msg def test_get_clip_use_cached_wrapped_rpc(): @@ -8966,9 +9003,14 @@ async def test_get_clip_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn @pytest.mark.asyncio -async def test_get_clip_async( - transport: str = "grpc_asyncio", request_type=service.GetClipRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetClipRequest(), + {}, + ], +) +async def test_get_clip_async(request_type, transport: str = "grpc_asyncio"): client = LivestreamServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8976,7 +9018,7 @@ async def test_get_clip_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_clip), "__call__") as call: @@ -9005,11 +9047,6 @@ async def test_get_clip_async( assert response.output_type == resources.Clip.OutputType.MANIFEST -@pytest.mark.asyncio -async def test_get_clip_async_from_dict(): - await test_get_clip_async(request_type=dict) - - def test_get_clip_field_headers(): client = LivestreamServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9152,8 +9189,8 @@ async def test_get_clip_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.CreateClipRequest, - dict, + service.CreateClipRequest(), + {}, ], ) def test_create_clip(request_type, transport: str = "grpc"): @@ -9164,7 +9201,7 @@ def test_create_clip(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_clip), "__call__") as call: @@ -9207,11 +9244,12 @@ def test_create_clip_non_empty_request_with_auto_populated_field(): client.create_clip(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateClipRequest( + request_msg = service.CreateClipRequest( parent="parent_value", clip_id="clip_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_clip_use_cached_wrapped_rpc(): @@ -9302,9 +9340,14 @@ async def test_create_clip_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_clip_async( - transport: str = "grpc_asyncio", request_type=service.CreateClipRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CreateClipRequest(), + {}, + ], +) +async def test_create_clip_async(request_type, transport: str = "grpc_asyncio"): client = LivestreamServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9312,7 +9355,7 @@ async def test_create_clip_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_clip), "__call__") as call: @@ -9332,11 +9375,6 @@ async def test_create_clip_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_clip_async_from_dict(): - await test_create_clip_async(request_type=dict) - - def test_create_clip_field_headers(): client = LivestreamServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9503,8 +9541,8 @@ async def test_create_clip_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DeleteClipRequest, - dict, + service.DeleteClipRequest(), + {}, ], ) def test_delete_clip(request_type, transport: str = "grpc"): @@ -9515,7 +9553,7 @@ def test_delete_clip(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_clip), "__call__") as call: @@ -9556,9 +9594,10 @@ def test_delete_clip_non_empty_request_with_auto_populated_field(): client.delete_clip(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteClipRequest( + request_msg = service.DeleteClipRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_clip_use_cached_wrapped_rpc(): @@ -9649,9 +9688,14 @@ async def test_delete_clip_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_clip_async( - transport: str = "grpc_asyncio", request_type=service.DeleteClipRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteClipRequest(), + {}, + ], +) +async def test_delete_clip_async(request_type, transport: str = "grpc_asyncio"): client = LivestreamServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9659,7 +9703,7 @@ async def test_delete_clip_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_clip), "__call__") as call: @@ -9679,11 +9723,6 @@ async def test_delete_clip_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_clip_async_from_dict(): - await test_delete_clip_async(request_type=dict) - - def test_delete_clip_field_headers(): client = LivestreamServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9829,9 +9868,9 @@ async def test_delete_clip_flattened_error_async(): @pytest.mark.parametrize( "request_type", - [ - service.CreateDvrSessionRequest, - dict, + [ + service.CreateDvrSessionRequest(), + {}, ], ) def test_create_dvr_session(request_type, transport: str = "grpc"): @@ -9842,7 +9881,7 @@ def test_create_dvr_session(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9888,10 +9927,11 @@ def test_create_dvr_session_non_empty_request_with_auto_populated_field(): client.create_dvr_session(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateDvrSessionRequest( + request_msg = service.CreateDvrSessionRequest( parent="parent_value", dvr_session_id="dvr_session_id_value", ) + assert args[0] == request_msg def test_create_dvr_session_use_cached_wrapped_rpc(): @@ -9986,9 +10026,14 @@ async def test_create_dvr_session_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_dvr_session_async( - transport: str = "grpc_asyncio", request_type=service.CreateDvrSessionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CreateDvrSessionRequest(), + {}, + ], +) +async def test_create_dvr_session_async(request_type, transport: str = "grpc_asyncio"): client = LivestreamServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9996,7 +10041,7 @@ async def test_create_dvr_session_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( @@ -10018,11 +10063,6 @@ async def test_create_dvr_session_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_dvr_session_async_from_dict(): - await test_create_dvr_session_async(request_type=dict) - - def test_create_dvr_session_field_headers(): client = LivestreamServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10197,8 +10237,8 @@ async def test_create_dvr_session_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListDvrSessionsRequest, - dict, + service.ListDvrSessionsRequest(), + {}, ], ) def test_list_dvr_sessions(request_type, transport: str = "grpc"): @@ -10209,7 +10249,7 @@ def test_list_dvr_sessions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10262,12 +10302,13 @@ def test_list_dvr_sessions_non_empty_request_with_auto_populated_field(): client.list_dvr_sessions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListDvrSessionsRequest( + request_msg = service.ListDvrSessionsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_dvr_sessions_use_cached_wrapped_rpc(): @@ -10350,9 +10391,14 @@ async def test_list_dvr_sessions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_dvr_sessions_async( - transport: str = "grpc_asyncio", request_type=service.ListDvrSessionsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListDvrSessionsRequest(), + {}, + ], +) +async def test_list_dvr_sessions_async(request_type, transport: str = "grpc_asyncio"): client = LivestreamServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10360,7 +10406,7 @@ async def test_list_dvr_sessions_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( @@ -10387,11 +10433,6 @@ async def test_list_dvr_sessions_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_dvr_sessions_async_from_dict(): - await test_list_dvr_sessions_async(request_type=dict) - - def test_list_dvr_sessions_field_headers(): client = LivestreamServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10744,8 +10785,8 @@ async def test_list_dvr_sessions_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetDvrSessionRequest, - dict, + service.GetDvrSessionRequest(), + {}, ], ) def test_get_dvr_session(request_type, transport: str = "grpc"): @@ -10756,7 +10797,7 @@ def test_get_dvr_session(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_dvr_session), "__call__") as call: @@ -10802,9 +10843,10 @@ def test_get_dvr_session_non_empty_request_with_auto_populated_field(): client.get_dvr_session(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetDvrSessionRequest( + request_msg = service.GetDvrSessionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_dvr_session_use_cached_wrapped_rpc(): @@ -10885,9 +10927,14 @@ async def test_get_dvr_session_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_dvr_session_async( - transport: str = "grpc_asyncio", request_type=service.GetDvrSessionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetDvrSessionRequest(), + {}, + ], +) +async def test_get_dvr_session_async(request_type, transport: str = "grpc_asyncio"): client = LivestreamServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10895,7 +10942,7 @@ async def test_get_dvr_session_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_dvr_session), "__call__") as call: @@ -10920,11 +10967,6 @@ async def test_get_dvr_session_async( assert response.state == resources.DvrSession.State.PENDING -@pytest.mark.asyncio -async def test_get_dvr_session_async_from_dict(): - await test_get_dvr_session_async(request_type=dict) - - def test_get_dvr_session_field_headers(): client = LivestreamServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11071,8 +11113,8 @@ async def test_get_dvr_session_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DeleteDvrSessionRequest, - dict, + service.DeleteDvrSessionRequest(), + {}, ], ) def test_delete_dvr_session(request_type, transport: str = "grpc"): @@ -11083,7 +11125,7 @@ def test_delete_dvr_session(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11128,9 +11170,10 @@ def test_delete_dvr_session_non_empty_request_with_auto_populated_field(): client.delete_dvr_session(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteDvrSessionRequest( + request_msg = service.DeleteDvrSessionRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_dvr_session_use_cached_wrapped_rpc(): @@ -11225,9 +11268,14 @@ async def test_delete_dvr_session_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_dvr_session_async( - transport: str = "grpc_asyncio", request_type=service.DeleteDvrSessionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteDvrSessionRequest(), + {}, + ], +) +async def test_delete_dvr_session_async(request_type, transport: str = "grpc_asyncio"): client = LivestreamServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11235,7 +11283,7 @@ async def test_delete_dvr_session_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( @@ -11257,11 +11305,6 @@ async def test_delete_dvr_session_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_dvr_session_async_from_dict(): - await test_delete_dvr_session_async(request_type=dict) - - def test_delete_dvr_session_field_headers(): client = LivestreamServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11416,8 +11459,8 @@ async def test_delete_dvr_session_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdateDvrSessionRequest, - dict, + service.UpdateDvrSessionRequest(), + {}, ], ) def test_update_dvr_session(request_type, transport: str = "grpc"): @@ -11428,7 +11471,7 @@ def test_update_dvr_session(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11471,7 +11514,8 @@ def test_update_dvr_session_non_empty_request_with_auto_populated_field(): client.update_dvr_session(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateDvrSessionRequest() + request_msg = service.UpdateDvrSessionRequest() + assert args[0] == request_msg def test_update_dvr_session_use_cached_wrapped_rpc(): @@ -11566,9 +11610,14 @@ async def test_update_dvr_session_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_dvr_session_async( - transport: str = "grpc_asyncio", request_type=service.UpdateDvrSessionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateDvrSessionRequest(), + {}, + ], +) +async def test_update_dvr_session_async(request_type, transport: str = "grpc_asyncio"): client = LivestreamServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11576,7 +11625,7 @@ async def test_update_dvr_session_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( @@ -11598,11 +11647,6 @@ async def test_update_dvr_session_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_dvr_session_async_from_dict(): - await test_update_dvr_session_async(request_type=dict) - - def test_update_dvr_session_field_headers(): client = LivestreamServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11767,8 +11811,8 @@ async def test_update_dvr_session_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.CreateAssetRequest, - dict, + service.CreateAssetRequest(), + {}, ], ) def test_create_asset(request_type, transport: str = "grpc"): @@ -11779,7 +11823,7 @@ def test_create_asset(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_asset), "__call__") as call: @@ -11822,11 +11866,12 @@ def test_create_asset_non_empty_request_with_auto_populated_field(): client.create_asset(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateAssetRequest( + request_msg = service.CreateAssetRequest( parent="parent_value", asset_id="asset_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_asset_use_cached_wrapped_rpc(): @@ -11917,9 +11962,14 @@ async def test_create_asset_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_asset_async( - transport: str = "grpc_asyncio", request_type=service.CreateAssetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CreateAssetRequest(), + {}, + ], +) +async def test_create_asset_async(request_type, transport: str = "grpc_asyncio"): client = LivestreamServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11927,7 +11977,7 @@ async def test_create_asset_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_asset), "__call__") as call: @@ -11947,11 +11997,6 @@ async def test_create_asset_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_asset_async_from_dict(): - await test_create_asset_async(request_type=dict) - - def test_create_asset_field_headers(): client = LivestreamServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12118,8 +12163,8 @@ async def test_create_asset_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DeleteAssetRequest, - dict, + service.DeleteAssetRequest(), + {}, ], ) def test_delete_asset(request_type, transport: str = "grpc"): @@ -12130,7 +12175,7 @@ def test_delete_asset(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_asset), "__call__") as call: @@ -12172,10 +12217,11 @@ def test_delete_asset_non_empty_request_with_auto_populated_field(): client.delete_asset(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteAssetRequest( + request_msg = service.DeleteAssetRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_asset_use_cached_wrapped_rpc(): @@ -12266,9 +12312,14 @@ async def test_delete_asset_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_asset_async( - transport: str = "grpc_asyncio", request_type=service.DeleteAssetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteAssetRequest(), + {}, + ], +) +async def test_delete_asset_async(request_type, transport: str = "grpc_asyncio"): client = LivestreamServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12276,7 +12327,7 @@ async def test_delete_asset_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_asset), "__call__") as call: @@ -12296,11 +12347,6 @@ async def test_delete_asset_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_asset_async_from_dict(): - await test_delete_asset_async(request_type=dict) - - def test_delete_asset_field_headers(): client = LivestreamServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12447,8 +12493,8 @@ async def test_delete_asset_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.GetAssetRequest, - dict, + service.GetAssetRequest(), + {}, ], ) def test_get_asset(request_type, transport: str = "grpc"): @@ -12459,7 +12505,7 @@ def test_get_asset(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_asset), "__call__") as call: @@ -12507,9 +12553,10 @@ def test_get_asset_non_empty_request_with_auto_populated_field(): client.get_asset(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetAssetRequest( + request_msg = service.GetAssetRequest( name="name_value", ) + assert args[0] == request_msg def test_get_asset_use_cached_wrapped_rpc(): @@ -12588,9 +12635,14 @@ async def test_get_asset_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_asset_async( - transport: str = "grpc_asyncio", request_type=service.GetAssetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetAssetRequest(), + {}, + ], +) +async def test_get_asset_async(request_type, transport: str = "grpc_asyncio"): client = LivestreamServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12598,7 +12650,7 @@ async def test_get_asset_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_asset), "__call__") as call: @@ -12625,11 +12677,6 @@ async def test_get_asset_async( assert response.state == resources.Asset.State.CREATING -@pytest.mark.asyncio -async def test_get_asset_async_from_dict(): - await test_get_asset_async(request_type=dict) - - def test_get_asset_field_headers(): client = LivestreamServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12772,8 +12819,8 @@ async def test_get_asset_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListAssetsRequest, - dict, + service.ListAssetsRequest(), + {}, ], ) def test_list_assets(request_type, transport: str = "grpc"): @@ -12784,7 +12831,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(type(client.transport.list_assets), "__call__") as call: @@ -12833,12 +12880,13 @@ 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] == service.ListAssetsRequest( + request_msg = service.ListAssetsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_assets_use_cached_wrapped_rpc(): @@ -12919,9 +12967,14 @@ async def test_list_assets_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_assets_async( - transport: str = "grpc_asyncio", request_type=service.ListAssetsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListAssetsRequest(), + {}, + ], +) +async def test_list_assets_async(request_type, transport: str = "grpc_asyncio"): client = LivestreamServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12929,7 +12982,7 @@ async def test_list_assets_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_assets), "__call__") as call: @@ -12954,11 +13007,6 @@ async def test_list_assets_async( assert response.unreachable == ["unreachable_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 = LivestreamServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13295,8 +13343,8 @@ async def test_list_assets_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetPoolRequest, - dict, + service.GetPoolRequest(), + {}, ], ) def test_get_pool(request_type, transport: str = "grpc"): @@ -13307,7 +13355,7 @@ def test_get_pool(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_pool), "__call__") as call: @@ -13351,9 +13399,10 @@ def test_get_pool_non_empty_request_with_auto_populated_field(): client.get_pool(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetPoolRequest( + request_msg = service.GetPoolRequest( name="name_value", ) + assert args[0] == request_msg def test_get_pool_use_cached_wrapped_rpc(): @@ -13432,9 +13481,14 @@ async def test_get_pool_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn @pytest.mark.asyncio -async def test_get_pool_async( - transport: str = "grpc_asyncio", request_type=service.GetPoolRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetPoolRequest(), + {}, + ], +) +async def test_get_pool_async(request_type, transport: str = "grpc_asyncio"): client = LivestreamServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13442,7 +13496,7 @@ async def test_get_pool_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_pool), "__call__") as call: @@ -13465,11 +13519,6 @@ async def test_get_pool_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_pool_async_from_dict(): - await test_get_pool_async(request_type=dict) - - def test_get_pool_field_headers(): client = LivestreamServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13612,8 +13661,8 @@ async def test_get_pool_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdatePoolRequest, - dict, + service.UpdatePoolRequest(), + {}, ], ) def test_update_pool(request_type, transport: str = "grpc"): @@ -13624,7 +13673,7 @@ def test_update_pool(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_pool), "__call__") as call: @@ -13665,9 +13714,10 @@ def test_update_pool_non_empty_request_with_auto_populated_field(): client.update_pool(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdatePoolRequest( + request_msg = service.UpdatePoolRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_pool_use_cached_wrapped_rpc(): @@ -13758,9 +13808,14 @@ async def test_update_pool_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_pool_async( - transport: str = "grpc_asyncio", request_type=service.UpdatePoolRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.UpdatePoolRequest(), + {}, + ], +) +async def test_update_pool_async(request_type, transport: str = "grpc_asyncio"): client = LivestreamServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13768,7 +13823,7 @@ async def test_update_pool_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_pool), "__call__") as call: @@ -13788,11 +13843,6 @@ async def test_update_pool_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_pool_async_from_dict(): - await test_update_pool_async(request_type=dict) - - def test_update_pool_field_headers(): client = LivestreamServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -20895,7 +20945,6 @@ def test_create_channel_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateChannelRequest() - assert args[0] == request_msg @@ -20916,7 +20965,6 @@ def test_list_channels_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListChannelsRequest() - assert args[0] == request_msg @@ -20937,7 +20985,6 @@ def test_get_channel_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetChannelRequest() - assert args[0] == request_msg @@ -20958,7 +21005,6 @@ def test_delete_channel_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteChannelRequest() - assert args[0] == request_msg @@ -20979,7 +21025,6 @@ def test_update_channel_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateChannelRequest() - assert args[0] == request_msg @@ -21000,7 +21045,6 @@ def test_start_channel_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.StartChannelRequest() - assert args[0] == request_msg @@ -21021,7 +21065,6 @@ def test_stop_channel_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.StopChannelRequest() - assert args[0] == request_msg @@ -21044,7 +21087,6 @@ def test_start_distribution_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.StartDistributionRequest() - assert args[0] == request_msg @@ -21067,7 +21109,6 @@ def test_stop_distribution_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.StopDistributionRequest() - assert args[0] == request_msg @@ -21088,7 +21129,6 @@ def test_create_input_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateInputRequest() - assert args[0] == request_msg @@ -21109,7 +21149,6 @@ def test_list_inputs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListInputsRequest() - assert args[0] == request_msg @@ -21130,7 +21169,6 @@ def test_get_input_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetInputRequest() - assert args[0] == request_msg @@ -21151,7 +21189,6 @@ def test_delete_input_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteInputRequest() - assert args[0] == request_msg @@ -21172,7 +21209,6 @@ def test_update_input_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateInputRequest() - assert args[0] == request_msg @@ -21193,7 +21229,6 @@ def test_preview_input_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.PreviewInputRequest() - assert args[0] == request_msg @@ -21214,7 +21249,6 @@ def test_create_event_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateEventRequest() - assert args[0] == request_msg @@ -21235,7 +21269,6 @@ def test_list_events_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListEventsRequest() - assert args[0] == request_msg @@ -21256,7 +21289,6 @@ def test_get_event_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetEventRequest() - assert args[0] == request_msg @@ -21277,7 +21309,6 @@ def test_delete_event_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteEventRequest() - assert args[0] == request_msg @@ -21298,7 +21329,6 @@ def test_list_clips_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListClipsRequest() - assert args[0] == request_msg @@ -21319,7 +21349,6 @@ def test_get_clip_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetClipRequest() - assert args[0] == request_msg @@ -21340,7 +21369,6 @@ def test_create_clip_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateClipRequest() - assert args[0] == request_msg @@ -21361,7 +21389,6 @@ def test_delete_clip_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteClipRequest() - assert args[0] == request_msg @@ -21384,7 +21411,6 @@ def test_create_dvr_session_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateDvrSessionRequest() - assert args[0] == request_msg @@ -21407,7 +21433,6 @@ def test_list_dvr_sessions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListDvrSessionsRequest() - assert args[0] == request_msg @@ -21428,7 +21453,6 @@ def test_get_dvr_session_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetDvrSessionRequest() - assert args[0] == request_msg @@ -21451,7 +21475,6 @@ def test_delete_dvr_session_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteDvrSessionRequest() - assert args[0] == request_msg @@ -21474,7 +21497,6 @@ def test_update_dvr_session_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateDvrSessionRequest() - assert args[0] == request_msg @@ -21495,7 +21517,6 @@ def test_create_asset_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateAssetRequest() - assert args[0] == request_msg @@ -21516,7 +21537,6 @@ def test_delete_asset_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteAssetRequest() - assert args[0] == request_msg @@ -21537,7 +21557,6 @@ def test_get_asset_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetAssetRequest() - assert args[0] == request_msg @@ -21558,7 +21577,6 @@ def test_list_assets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListAssetsRequest() - assert args[0] == request_msg @@ -21579,7 +21597,6 @@ def test_get_pool_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetPoolRequest() - assert args[0] == request_msg @@ -21600,7 +21617,6 @@ def test_update_pool_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdatePoolRequest() - assert args[0] == request_msg @@ -21639,7 +21655,6 @@ async def test_create_channel_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateChannelRequest() - assert args[0] == request_msg @@ -21667,7 +21682,6 @@ async def test_list_channels_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListChannelsRequest() - assert args[0] == request_msg @@ -21696,7 +21710,6 @@ async def test_get_channel_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetChannelRequest() - assert args[0] == request_msg @@ -21721,7 +21734,6 @@ async def test_delete_channel_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteChannelRequest() - assert args[0] == request_msg @@ -21746,7 +21758,6 @@ async def test_update_channel_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateChannelRequest() - assert args[0] == request_msg @@ -21771,7 +21782,6 @@ async def test_start_channel_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.StartChannelRequest() - assert args[0] == request_msg @@ -21796,7 +21806,6 @@ async def test_stop_channel_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.StopChannelRequest() - assert args[0] == request_msg @@ -21823,7 +21832,6 @@ async def test_start_distribution_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.StartDistributionRequest() - assert args[0] == request_msg @@ -21850,7 +21858,6 @@ async def test_stop_distribution_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.StopDistributionRequest() - assert args[0] == request_msg @@ -21875,7 +21882,6 @@ async def test_create_input_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateInputRequest() - assert args[0] == request_msg @@ -21903,7 +21909,6 @@ async def test_list_inputs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListInputsRequest() - assert args[0] == request_msg @@ -21933,7 +21938,6 @@ async def test_get_input_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetInputRequest() - assert args[0] == request_msg @@ -21958,7 +21962,6 @@ async def test_delete_input_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteInputRequest() - assert args[0] == request_msg @@ -21983,7 +21986,6 @@ async def test_update_input_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateInputRequest() - assert args[0] == request_msg @@ -22011,7 +22013,6 @@ async def test_preview_input_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.PreviewInputRequest() - assert args[0] == request_msg @@ -22040,7 +22041,6 @@ async def test_create_event_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateEventRequest() - assert args[0] == request_msg @@ -22068,7 +22068,6 @@ async def test_list_events_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListEventsRequest() - assert args[0] == request_msg @@ -22097,7 +22096,6 @@ async def test_get_event_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetEventRequest() - assert args[0] == request_msg @@ -22120,7 +22118,6 @@ async def test_delete_event_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteEventRequest() - assert args[0] == request_msg @@ -22148,7 +22145,6 @@ async def test_list_clips_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListClipsRequest() - assert args[0] == request_msg @@ -22178,7 +22174,6 @@ async def test_get_clip_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetClipRequest() - assert args[0] == request_msg @@ -22203,7 +22198,6 @@ async def test_create_clip_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateClipRequest() - assert args[0] == request_msg @@ -22228,7 +22222,6 @@ async def test_delete_clip_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteClipRequest() - assert args[0] == request_msg @@ -22255,7 +22248,6 @@ async def test_create_dvr_session_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateDvrSessionRequest() - assert args[0] == request_msg @@ -22285,7 +22277,6 @@ async def test_list_dvr_sessions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListDvrSessionsRequest() - assert args[0] == request_msg @@ -22313,7 +22304,6 @@ async def test_get_dvr_session_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetDvrSessionRequest() - assert args[0] == request_msg @@ -22340,7 +22330,6 @@ async def test_delete_dvr_session_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteDvrSessionRequest() - assert args[0] == request_msg @@ -22367,7 +22356,6 @@ async def test_update_dvr_session_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateDvrSessionRequest() - assert args[0] == request_msg @@ -22392,7 +22380,6 @@ async def test_create_asset_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateAssetRequest() - assert args[0] == request_msg @@ -22417,7 +22404,6 @@ async def test_delete_asset_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteAssetRequest() - assert args[0] == request_msg @@ -22446,7 +22432,6 @@ async def test_get_asset_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetAssetRequest() - assert args[0] == request_msg @@ -22474,7 +22459,6 @@ async def test_list_assets_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListAssetsRequest() - assert args[0] == request_msg @@ -22501,7 +22485,6 @@ async def test_get_pool_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetPoolRequest() - assert args[0] == request_msg @@ -22526,7 +22509,6 @@ async def test_update_pool_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdatePoolRequest() - assert args[0] == request_msg @@ -28531,7 +28513,6 @@ def test_create_channel_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateChannelRequest() - assert args[0] == request_msg @@ -28551,7 +28532,6 @@ def test_list_channels_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListChannelsRequest() - assert args[0] == request_msg @@ -28571,7 +28551,6 @@ def test_get_channel_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetChannelRequest() - assert args[0] == request_msg @@ -28591,7 +28570,6 @@ def test_delete_channel_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteChannelRequest() - assert args[0] == request_msg @@ -28611,7 +28589,6 @@ def test_update_channel_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateChannelRequest() - assert args[0] == request_msg @@ -28631,7 +28608,6 @@ def test_start_channel_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.StartChannelRequest() - assert args[0] == request_msg @@ -28651,7 +28627,6 @@ def test_stop_channel_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.StopChannelRequest() - assert args[0] == request_msg @@ -28673,7 +28648,6 @@ def test_start_distribution_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.StartDistributionRequest() - assert args[0] == request_msg @@ -28695,7 +28669,6 @@ def test_stop_distribution_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.StopDistributionRequest() - assert args[0] == request_msg @@ -28715,7 +28688,6 @@ def test_create_input_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateInputRequest() - assert args[0] == request_msg @@ -28735,7 +28707,6 @@ def test_list_inputs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListInputsRequest() - assert args[0] == request_msg @@ -28755,7 +28726,6 @@ def test_get_input_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetInputRequest() - assert args[0] == request_msg @@ -28775,7 +28745,6 @@ def test_delete_input_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteInputRequest() - assert args[0] == request_msg @@ -28795,7 +28764,6 @@ def test_update_input_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateInputRequest() - assert args[0] == request_msg @@ -28815,7 +28783,6 @@ def test_preview_input_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.PreviewInputRequest() - assert args[0] == request_msg @@ -28835,7 +28802,6 @@ def test_create_event_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateEventRequest() - assert args[0] == request_msg @@ -28855,7 +28821,6 @@ def test_list_events_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListEventsRequest() - assert args[0] == request_msg @@ -28875,7 +28840,6 @@ def test_get_event_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetEventRequest() - assert args[0] == request_msg @@ -28895,7 +28859,6 @@ def test_delete_event_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteEventRequest() - assert args[0] == request_msg @@ -28915,7 +28878,6 @@ def test_list_clips_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListClipsRequest() - assert args[0] == request_msg @@ -28935,7 +28897,6 @@ def test_get_clip_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetClipRequest() - assert args[0] == request_msg @@ -28955,7 +28916,6 @@ def test_create_clip_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateClipRequest() - assert args[0] == request_msg @@ -28975,7 +28935,6 @@ def test_delete_clip_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteClipRequest() - assert args[0] == request_msg @@ -28997,7 +28956,6 @@ def test_create_dvr_session_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateDvrSessionRequest() - assert args[0] == request_msg @@ -29019,7 +28977,6 @@ def test_list_dvr_sessions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListDvrSessionsRequest() - assert args[0] == request_msg @@ -29039,7 +28996,6 @@ def test_get_dvr_session_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetDvrSessionRequest() - assert args[0] == request_msg @@ -29061,7 +29017,6 @@ def test_delete_dvr_session_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteDvrSessionRequest() - assert args[0] == request_msg @@ -29083,7 +29038,6 @@ def test_update_dvr_session_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateDvrSessionRequest() - assert args[0] == request_msg @@ -29103,7 +29057,6 @@ def test_create_asset_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateAssetRequest() - assert args[0] == request_msg @@ -29123,7 +29076,6 @@ def test_delete_asset_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteAssetRequest() - assert args[0] == request_msg @@ -29143,7 +29095,6 @@ def test_get_asset_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetAssetRequest() - assert args[0] == request_msg @@ -29163,7 +29114,6 @@ def test_list_assets_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListAssetsRequest() - assert args[0] == request_msg @@ -29183,7 +29133,6 @@ def test_get_pool_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetPoolRequest() - assert args[0] == request_msg @@ -29203,7 +29152,6 @@ def test_update_pool_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdatePoolRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-video-stitcher/noxfile.py b/packages/google-cloud-video-stitcher/noxfile.py index a18bb6150803..0aee9c67760b 100644 --- a/packages/google-cloud-video-stitcher/noxfile.py +++ b/packages/google-cloud-video-stitcher/noxfile.py @@ -47,7 +47,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-video-stitcher" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-video-stitcher/setup.py b/packages/google-cloud-video-stitcher/setup.py index f538d245721b..57fcc6a1b62d 100644 --- a/packages/google-cloud-video-stitcher/setup.py +++ b/packages/google-cloud-video-stitcher/setup.py @@ -45,7 +45,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/google-cloud-video-stitcher/testing/constraints-3.10.txt b/packages/google-cloud-video-stitcher/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-video-stitcher/testing/constraints-3.10.txt +++ b/packages/google-cloud-video-stitcher/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-video-stitcher/tests/unit/gapic/stitcher_v1/test_video_stitcher_service.py b/packages/google-cloud-video-stitcher/tests/unit/gapic/stitcher_v1/test_video_stitcher_service.py index 313287bfd44d..78a27dc08ada 100644 --- a/packages/google-cloud-video-stitcher/tests/unit/gapic/stitcher_v1/test_video_stitcher_service.py +++ b/packages/google-cloud-video-stitcher/tests/unit/gapic/stitcher_v1/test_video_stitcher_service.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 @@ -127,6 +128,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" @@ -1390,8 +1406,8 @@ def test_video_stitcher_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - video_stitcher_service.CreateCdnKeyRequest, - dict, + video_stitcher_service.CreateCdnKeyRequest(), + {}, ], ) def test_create_cdn_key(request_type, transport: str = "grpc"): @@ -1402,7 +1418,7 @@ def test_create_cdn_key(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_cdn_key), "__call__") as call: @@ -1444,10 +1460,11 @@ def test_create_cdn_key_non_empty_request_with_auto_populated_field(): client.create_cdn_key(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == video_stitcher_service.CreateCdnKeyRequest( + request_msg = video_stitcher_service.CreateCdnKeyRequest( parent="parent_value", cdn_key_id="cdn_key_id_value", ) + assert args[0] == request_msg def test_create_cdn_key_use_cached_wrapped_rpc(): @@ -1538,10 +1555,14 @@ async def test_create_cdn_key_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_cdn_key_async( - transport: str = "grpc_asyncio", - request_type=video_stitcher_service.CreateCdnKeyRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + video_stitcher_service.CreateCdnKeyRequest(), + {}, + ], +) +async def test_create_cdn_key_async(request_type, transport: str = "grpc_asyncio"): client = VideoStitcherServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1549,7 +1570,7 @@ async def test_create_cdn_key_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_cdn_key), "__call__") as call: @@ -1569,11 +1590,6 @@ async def test_create_cdn_key_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_cdn_key_async_from_dict(): - await test_create_cdn_key_async(request_type=dict) - - def test_create_cdn_key_field_headers(): client = VideoStitcherServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1752,8 +1768,8 @@ async def test_create_cdn_key_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - video_stitcher_service.ListCdnKeysRequest, - dict, + video_stitcher_service.ListCdnKeysRequest(), + {}, ], ) def test_list_cdn_keys(request_type, transport: str = "grpc"): @@ -1764,7 +1780,7 @@ def test_list_cdn_keys(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_cdn_keys), "__call__") as call: @@ -1813,12 +1829,13 @@ def test_list_cdn_keys_non_empty_request_with_auto_populated_field(): client.list_cdn_keys(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == video_stitcher_service.ListCdnKeysRequest( + request_msg = video_stitcher_service.ListCdnKeysRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_cdn_keys_use_cached_wrapped_rpc(): @@ -1899,10 +1916,14 @@ async def test_list_cdn_keys_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_cdn_keys_async( - transport: str = "grpc_asyncio", - request_type=video_stitcher_service.ListCdnKeysRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + video_stitcher_service.ListCdnKeysRequest(), + {}, + ], +) +async def test_list_cdn_keys_async(request_type, transport: str = "grpc_asyncio"): client = VideoStitcherServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1910,7 +1931,7 @@ async def test_list_cdn_keys_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_cdn_keys), "__call__") as call: @@ -1935,11 +1956,6 @@ async def test_list_cdn_keys_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_cdn_keys_async_from_dict(): - await test_list_cdn_keys_async(request_type=dict) - - def test_list_cdn_keys_field_headers(): client = VideoStitcherServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2276,8 +2292,8 @@ async def test_list_cdn_keys_async_pages(): @pytest.mark.parametrize( "request_type", [ - video_stitcher_service.GetCdnKeyRequest, - dict, + video_stitcher_service.GetCdnKeyRequest(), + {}, ], ) def test_get_cdn_key(request_type, transport: str = "grpc"): @@ -2288,7 +2304,7 @@ def test_get_cdn_key(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_cdn_key), "__call__") as call: @@ -2334,9 +2350,10 @@ def test_get_cdn_key_non_empty_request_with_auto_populated_field(): client.get_cdn_key(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == video_stitcher_service.GetCdnKeyRequest( + request_msg = video_stitcher_service.GetCdnKeyRequest( name="name_value", ) + assert args[0] == request_msg def test_get_cdn_key_use_cached_wrapped_rpc(): @@ -2417,10 +2434,14 @@ async def test_get_cdn_key_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_cdn_key_async( - transport: str = "grpc_asyncio", - request_type=video_stitcher_service.GetCdnKeyRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + video_stitcher_service.GetCdnKeyRequest(), + {}, + ], +) +async def test_get_cdn_key_async(request_type, transport: str = "grpc_asyncio"): client = VideoStitcherServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2428,7 +2449,7 @@ async def test_get_cdn_key_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_cdn_key), "__call__") as call: @@ -2453,11 +2474,6 @@ async def test_get_cdn_key_async( assert response.hostname == "hostname_value" -@pytest.mark.asyncio -async def test_get_cdn_key_async_from_dict(): - await test_get_cdn_key_async(request_type=dict) - - def test_get_cdn_key_field_headers(): client = VideoStitcherServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2600,8 +2616,8 @@ async def test_get_cdn_key_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - video_stitcher_service.DeleteCdnKeyRequest, - dict, + video_stitcher_service.DeleteCdnKeyRequest(), + {}, ], ) def test_delete_cdn_key(request_type, transport: str = "grpc"): @@ -2612,7 +2628,7 @@ def test_delete_cdn_key(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_cdn_key), "__call__") as call: @@ -2653,9 +2669,10 @@ def test_delete_cdn_key_non_empty_request_with_auto_populated_field(): client.delete_cdn_key(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == video_stitcher_service.DeleteCdnKeyRequest( + request_msg = video_stitcher_service.DeleteCdnKeyRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_cdn_key_use_cached_wrapped_rpc(): @@ -2746,10 +2763,14 @@ async def test_delete_cdn_key_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_cdn_key_async( - transport: str = "grpc_asyncio", - request_type=video_stitcher_service.DeleteCdnKeyRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + video_stitcher_service.DeleteCdnKeyRequest(), + {}, + ], +) +async def test_delete_cdn_key_async(request_type, transport: str = "grpc_asyncio"): client = VideoStitcherServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2757,7 +2778,7 @@ async def test_delete_cdn_key_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_cdn_key), "__call__") as call: @@ -2777,11 +2798,6 @@ async def test_delete_cdn_key_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_cdn_key_async_from_dict(): - await test_delete_cdn_key_async(request_type=dict) - - def test_delete_cdn_key_field_headers(): client = VideoStitcherServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2928,8 +2944,8 @@ async def test_delete_cdn_key_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - video_stitcher_service.UpdateCdnKeyRequest, - dict, + video_stitcher_service.UpdateCdnKeyRequest(), + {}, ], ) def test_update_cdn_key(request_type, transport: str = "grpc"): @@ -2940,7 +2956,7 @@ def test_update_cdn_key(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_cdn_key), "__call__") as call: @@ -2979,7 +2995,8 @@ def test_update_cdn_key_non_empty_request_with_auto_populated_field(): client.update_cdn_key(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == video_stitcher_service.UpdateCdnKeyRequest() + request_msg = video_stitcher_service.UpdateCdnKeyRequest() + assert args[0] == request_msg def test_update_cdn_key_use_cached_wrapped_rpc(): @@ -3070,10 +3087,14 @@ async def test_update_cdn_key_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_cdn_key_async( - transport: str = "grpc_asyncio", - request_type=video_stitcher_service.UpdateCdnKeyRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + video_stitcher_service.UpdateCdnKeyRequest(), + {}, + ], +) +async def test_update_cdn_key_async(request_type, transport: str = "grpc_asyncio"): client = VideoStitcherServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3081,7 +3102,7 @@ async def test_update_cdn_key_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_cdn_key), "__call__") as call: @@ -3101,11 +3122,6 @@ async def test_update_cdn_key_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_cdn_key_async_from_dict(): - await test_update_cdn_key_async(request_type=dict) - - def test_update_cdn_key_field_headers(): client = VideoStitcherServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3274,8 +3290,8 @@ async def test_update_cdn_key_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - video_stitcher_service.CreateVodSessionRequest, - dict, + video_stitcher_service.CreateVodSessionRequest(), + {}, ], ) def test_create_vod_session(request_type, transport: str = "grpc"): @@ -3286,7 +3302,7 @@ def test_create_vod_session(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3346,9 +3362,10 @@ def test_create_vod_session_non_empty_request_with_auto_populated_field(): client.create_vod_session(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == video_stitcher_service.CreateVodSessionRequest( + request_msg = video_stitcher_service.CreateVodSessionRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_vod_session_use_cached_wrapped_rpc(): @@ -3433,10 +3450,14 @@ async def test_create_vod_session_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_vod_session_async( - transport: str = "grpc_asyncio", - request_type=video_stitcher_service.CreateVodSessionRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + video_stitcher_service.CreateVodSessionRequest(), + {}, + ], +) +async def test_create_vod_session_async(request_type, transport: str = "grpc_asyncio"): client = VideoStitcherServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3444,7 +3465,7 @@ async def test_create_vod_session_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( @@ -3481,11 +3502,6 @@ async def test_create_vod_session_async( assert response.vod_config == "vod_config_value" -@pytest.mark.asyncio -async def test_create_vod_session_async_from_dict(): - await test_create_vod_session_async(request_type=dict) - - def test_create_vod_session_field_headers(): client = VideoStitcherServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3646,8 +3662,8 @@ async def test_create_vod_session_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - video_stitcher_service.GetVodSessionRequest, - dict, + video_stitcher_service.GetVodSessionRequest(), + {}, ], ) def test_get_vod_session(request_type, transport: str = "grpc"): @@ -3658,7 +3674,7 @@ def test_get_vod_session(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_vod_session), "__call__") as call: @@ -3714,9 +3730,10 @@ def test_get_vod_session_non_empty_request_with_auto_populated_field(): client.get_vod_session(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == video_stitcher_service.GetVodSessionRequest( + request_msg = video_stitcher_service.GetVodSessionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_vod_session_use_cached_wrapped_rpc(): @@ -3797,10 +3814,14 @@ async def test_get_vod_session_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_vod_session_async( - transport: str = "grpc_asyncio", - request_type=video_stitcher_service.GetVodSessionRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + video_stitcher_service.GetVodSessionRequest(), + {}, + ], +) +async def test_get_vod_session_async(request_type, transport: str = "grpc_asyncio"): client = VideoStitcherServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3808,7 +3829,7 @@ async def test_get_vod_session_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_vod_session), "__call__") as call: @@ -3843,11 +3864,6 @@ async def test_get_vod_session_async( assert response.vod_config == "vod_config_value" -@pytest.mark.asyncio -async def test_get_vod_session_async_from_dict(): - await test_get_vod_session_async(request_type=dict) - - def test_get_vod_session_field_headers(): client = VideoStitcherServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3990,8 +4006,8 @@ async def test_get_vod_session_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - video_stitcher_service.ListVodStitchDetailsRequest, - dict, + video_stitcher_service.ListVodStitchDetailsRequest(), + {}, ], ) def test_list_vod_stitch_details(request_type, transport: str = "grpc"): @@ -4002,7 +4018,7 @@ def test_list_vod_stitch_details(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4051,10 +4067,11 @@ def test_list_vod_stitch_details_non_empty_request_with_auto_populated_field(): client.list_vod_stitch_details(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == video_stitcher_service.ListVodStitchDetailsRequest( + request_msg = video_stitcher_service.ListVodStitchDetailsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_vod_stitch_details_use_cached_wrapped_rpc(): @@ -4140,9 +4157,15 @@ async def test_list_vod_stitch_details_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + video_stitcher_service.ListVodStitchDetailsRequest(), + {}, + ], +) async def test_list_vod_stitch_details_async( - transport: str = "grpc_asyncio", - request_type=video_stitcher_service.ListVodStitchDetailsRequest, + request_type, transport: str = "grpc_asyncio" ): client = VideoStitcherServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4151,7 +4174,7 @@ async def test_list_vod_stitch_details_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( @@ -4176,11 +4199,6 @@ async def test_list_vod_stitch_details_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_vod_stitch_details_async_from_dict(): - await test_list_vod_stitch_details_async(request_type=dict) - - def test_list_vod_stitch_details_field_headers(): client = VideoStitcherServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4533,8 +4551,8 @@ async def test_list_vod_stitch_details_async_pages(): @pytest.mark.parametrize( "request_type", [ - video_stitcher_service.GetVodStitchDetailRequest, - dict, + video_stitcher_service.GetVodStitchDetailRequest(), + {}, ], ) def test_get_vod_stitch_detail(request_type, transport: str = "grpc"): @@ -4545,7 +4563,7 @@ def test_get_vod_stitch_detail(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4593,9 +4611,10 @@ def test_get_vod_stitch_detail_non_empty_request_with_auto_populated_field(): client.get_vod_stitch_detail(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == video_stitcher_service.GetVodStitchDetailRequest( + request_msg = video_stitcher_service.GetVodStitchDetailRequest( name="name_value", ) + assert args[0] == request_msg def test_get_vod_stitch_detail_use_cached_wrapped_rpc(): @@ -4681,9 +4700,15 @@ async def test_get_vod_stitch_detail_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + video_stitcher_service.GetVodStitchDetailRequest(), + {}, + ], +) async def test_get_vod_stitch_detail_async( - transport: str = "grpc_asyncio", - request_type=video_stitcher_service.GetVodStitchDetailRequest, + request_type, transport: str = "grpc_asyncio" ): client = VideoStitcherServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4692,7 +4717,7 @@ async def test_get_vod_stitch_detail_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( @@ -4717,11 +4742,6 @@ async def test_get_vod_stitch_detail_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_vod_stitch_detail_async_from_dict(): - await test_get_vod_stitch_detail_async(request_type=dict) - - def test_get_vod_stitch_detail_field_headers(): client = VideoStitcherServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4876,8 +4896,8 @@ async def test_get_vod_stitch_detail_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - video_stitcher_service.ListVodAdTagDetailsRequest, - dict, + video_stitcher_service.ListVodAdTagDetailsRequest(), + {}, ], ) def test_list_vod_ad_tag_details(request_type, transport: str = "grpc"): @@ -4888,7 +4908,7 @@ def test_list_vod_ad_tag_details(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4937,10 +4957,11 @@ def test_list_vod_ad_tag_details_non_empty_request_with_auto_populated_field(): client.list_vod_ad_tag_details(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == video_stitcher_service.ListVodAdTagDetailsRequest( + request_msg = video_stitcher_service.ListVodAdTagDetailsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_vod_ad_tag_details_use_cached_wrapped_rpc(): @@ -5026,9 +5047,15 @@ async def test_list_vod_ad_tag_details_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + video_stitcher_service.ListVodAdTagDetailsRequest(), + {}, + ], +) async def test_list_vod_ad_tag_details_async( - transport: str = "grpc_asyncio", - request_type=video_stitcher_service.ListVodAdTagDetailsRequest, + request_type, transport: str = "grpc_asyncio" ): client = VideoStitcherServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5037,7 +5064,7 @@ async def test_list_vod_ad_tag_details_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( @@ -5062,11 +5089,6 @@ async def test_list_vod_ad_tag_details_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_vod_ad_tag_details_async_from_dict(): - await test_list_vod_ad_tag_details_async(request_type=dict) - - def test_list_vod_ad_tag_details_field_headers(): client = VideoStitcherServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5419,8 +5441,8 @@ async def test_list_vod_ad_tag_details_async_pages(): @pytest.mark.parametrize( "request_type", [ - video_stitcher_service.GetVodAdTagDetailRequest, - dict, + video_stitcher_service.GetVodAdTagDetailRequest(), + {}, ], ) def test_get_vod_ad_tag_detail(request_type, transport: str = "grpc"): @@ -5431,7 +5453,7 @@ def test_get_vod_ad_tag_detail(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5479,9 +5501,10 @@ def test_get_vod_ad_tag_detail_non_empty_request_with_auto_populated_field(): client.get_vod_ad_tag_detail(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == video_stitcher_service.GetVodAdTagDetailRequest( + request_msg = video_stitcher_service.GetVodAdTagDetailRequest( name="name_value", ) + assert args[0] == request_msg def test_get_vod_ad_tag_detail_use_cached_wrapped_rpc(): @@ -5567,9 +5590,15 @@ async def test_get_vod_ad_tag_detail_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + video_stitcher_service.GetVodAdTagDetailRequest(), + {}, + ], +) async def test_get_vod_ad_tag_detail_async( - transport: str = "grpc_asyncio", - request_type=video_stitcher_service.GetVodAdTagDetailRequest, + request_type, transport: str = "grpc_asyncio" ): client = VideoStitcherServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5578,7 +5607,7 @@ async def test_get_vod_ad_tag_detail_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( @@ -5603,11 +5632,6 @@ async def test_get_vod_ad_tag_detail_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_vod_ad_tag_detail_async_from_dict(): - await test_get_vod_ad_tag_detail_async(request_type=dict) - - def test_get_vod_ad_tag_detail_field_headers(): client = VideoStitcherServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5762,8 +5786,8 @@ async def test_get_vod_ad_tag_detail_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - video_stitcher_service.ListLiveAdTagDetailsRequest, - dict, + video_stitcher_service.ListLiveAdTagDetailsRequest(), + {}, ], ) def test_list_live_ad_tag_details(request_type, transport: str = "grpc"): @@ -5774,7 +5798,7 @@ def test_list_live_ad_tag_details(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,10 +5847,11 @@ def test_list_live_ad_tag_details_non_empty_request_with_auto_populated_field(): client.list_live_ad_tag_details(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == video_stitcher_service.ListLiveAdTagDetailsRequest( + request_msg = video_stitcher_service.ListLiveAdTagDetailsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_live_ad_tag_details_use_cached_wrapped_rpc(): @@ -5912,9 +5937,15 @@ async def test_list_live_ad_tag_details_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + video_stitcher_service.ListLiveAdTagDetailsRequest(), + {}, + ], +) async def test_list_live_ad_tag_details_async( - transport: str = "grpc_asyncio", - request_type=video_stitcher_service.ListLiveAdTagDetailsRequest, + request_type, transport: str = "grpc_asyncio" ): client = VideoStitcherServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5923,7 +5954,7 @@ async def test_list_live_ad_tag_details_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( @@ -5948,11 +5979,6 @@ async def test_list_live_ad_tag_details_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_live_ad_tag_details_async_from_dict(): - await test_list_live_ad_tag_details_async(request_type=dict) - - def test_list_live_ad_tag_details_field_headers(): client = VideoStitcherServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6307,8 +6333,8 @@ async def test_list_live_ad_tag_details_async_pages(): @pytest.mark.parametrize( "request_type", [ - video_stitcher_service.GetLiveAdTagDetailRequest, - dict, + video_stitcher_service.GetLiveAdTagDetailRequest(), + {}, ], ) def test_get_live_ad_tag_detail(request_type, transport: str = "grpc"): @@ -6319,7 +6345,7 @@ def test_get_live_ad_tag_detail(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6367,9 +6393,10 @@ def test_get_live_ad_tag_detail_non_empty_request_with_auto_populated_field(): client.get_live_ad_tag_detail(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == video_stitcher_service.GetLiveAdTagDetailRequest( + request_msg = video_stitcher_service.GetLiveAdTagDetailRequest( name="name_value", ) + assert args[0] == request_msg def test_get_live_ad_tag_detail_use_cached_wrapped_rpc(): @@ -6455,9 +6482,15 @@ async def test_get_live_ad_tag_detail_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + video_stitcher_service.GetLiveAdTagDetailRequest(), + {}, + ], +) async def test_get_live_ad_tag_detail_async( - transport: str = "grpc_asyncio", - request_type=video_stitcher_service.GetLiveAdTagDetailRequest, + request_type, transport: str = "grpc_asyncio" ): client = VideoStitcherServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -6466,7 +6499,7 @@ async def test_get_live_ad_tag_detail_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( @@ -6491,11 +6524,6 @@ async def test_get_live_ad_tag_detail_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_live_ad_tag_detail_async_from_dict(): - await test_get_live_ad_tag_detail_async(request_type=dict) - - def test_get_live_ad_tag_detail_field_headers(): client = VideoStitcherServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6650,8 +6678,8 @@ async def test_get_live_ad_tag_detail_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - video_stitcher_service.CreateSlateRequest, - dict, + video_stitcher_service.CreateSlateRequest(), + {}, ], ) def test_create_slate(request_type, transport: str = "grpc"): @@ -6662,7 +6690,7 @@ def test_create_slate(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_slate), "__call__") as call: @@ -6705,11 +6733,12 @@ def test_create_slate_non_empty_request_with_auto_populated_field(): client.create_slate(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == video_stitcher_service.CreateSlateRequest( + request_msg = video_stitcher_service.CreateSlateRequest( parent="parent_value", slate_id="slate_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_slate_use_cached_wrapped_rpc(): @@ -6800,10 +6829,14 @@ async def test_create_slate_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_slate_async( - transport: str = "grpc_asyncio", - request_type=video_stitcher_service.CreateSlateRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + video_stitcher_service.CreateSlateRequest(), + {}, + ], +) +async def test_create_slate_async(request_type, transport: str = "grpc_asyncio"): client = VideoStitcherServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6811,7 +6844,7 @@ async def test_create_slate_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_slate), "__call__") as call: @@ -6831,11 +6864,6 @@ async def test_create_slate_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_slate_async_from_dict(): - await test_create_slate_async(request_type=dict) - - def test_create_slate_field_headers(): client = VideoStitcherServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7002,8 +7030,8 @@ async def test_create_slate_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - video_stitcher_service.ListSlatesRequest, - dict, + video_stitcher_service.ListSlatesRequest(), + {}, ], ) def test_list_slates(request_type, transport: str = "grpc"): @@ -7014,7 +7042,7 @@ def test_list_slates(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_slates), "__call__") as call: @@ -7063,12 +7091,13 @@ def test_list_slates_non_empty_request_with_auto_populated_field(): client.list_slates(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == video_stitcher_service.ListSlatesRequest( + request_msg = video_stitcher_service.ListSlatesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_slates_use_cached_wrapped_rpc(): @@ -7149,10 +7178,14 @@ async def test_list_slates_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_slates_async( - transport: str = "grpc_asyncio", - request_type=video_stitcher_service.ListSlatesRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + video_stitcher_service.ListSlatesRequest(), + {}, + ], +) +async def test_list_slates_async(request_type, transport: str = "grpc_asyncio"): client = VideoStitcherServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7160,7 +7193,7 @@ async def test_list_slates_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_slates), "__call__") as call: @@ -7185,11 +7218,6 @@ async def test_list_slates_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_slates_async_from_dict(): - await test_list_slates_async(request_type=dict) - - def test_list_slates_field_headers(): client = VideoStitcherServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7526,8 +7554,8 @@ async def test_list_slates_async_pages(): @pytest.mark.parametrize( "request_type", [ - video_stitcher_service.GetSlateRequest, - dict, + video_stitcher_service.GetSlateRequest(), + {}, ], ) def test_get_slate(request_type, transport: str = "grpc"): @@ -7538,7 +7566,7 @@ def test_get_slate(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_slate), "__call__") as call: @@ -7584,9 +7612,10 @@ def test_get_slate_non_empty_request_with_auto_populated_field(): client.get_slate(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == video_stitcher_service.GetSlateRequest( + request_msg = video_stitcher_service.GetSlateRequest( name="name_value", ) + assert args[0] == request_msg def test_get_slate_use_cached_wrapped_rpc(): @@ -7665,9 +7694,14 @@ async def test_get_slate_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_slate_async( - transport: str = "grpc_asyncio", request_type=video_stitcher_service.GetSlateRequest -): +@pytest.mark.parametrize( + "request_type", + [ + video_stitcher_service.GetSlateRequest(), + {}, + ], +) +async def test_get_slate_async(request_type, transport: str = "grpc_asyncio"): client = VideoStitcherServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7675,7 +7709,7 @@ async def test_get_slate_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_slate), "__call__") as call: @@ -7700,11 +7734,6 @@ async def test_get_slate_async( assert response.uri == "uri_value" -@pytest.mark.asyncio -async def test_get_slate_async_from_dict(): - await test_get_slate_async(request_type=dict) - - def test_get_slate_field_headers(): client = VideoStitcherServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7847,8 +7876,8 @@ async def test_get_slate_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - video_stitcher_service.UpdateSlateRequest, - dict, + video_stitcher_service.UpdateSlateRequest(), + {}, ], ) def test_update_slate(request_type, transport: str = "grpc"): @@ -7859,7 +7888,7 @@ def test_update_slate(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_slate), "__call__") as call: @@ -7898,7 +7927,8 @@ def test_update_slate_non_empty_request_with_auto_populated_field(): client.update_slate(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == video_stitcher_service.UpdateSlateRequest() + request_msg = video_stitcher_service.UpdateSlateRequest() + assert args[0] == request_msg def test_update_slate_use_cached_wrapped_rpc(): @@ -7989,10 +8019,14 @@ async def test_update_slate_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_slate_async( - transport: str = "grpc_asyncio", - request_type=video_stitcher_service.UpdateSlateRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + video_stitcher_service.UpdateSlateRequest(), + {}, + ], +) +async def test_update_slate_async(request_type, transport: str = "grpc_asyncio"): client = VideoStitcherServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8000,7 +8034,7 @@ async def test_update_slate_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_slate), "__call__") as call: @@ -8020,11 +8054,6 @@ async def test_update_slate_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_slate_async_from_dict(): - await test_update_slate_async(request_type=dict) - - def test_update_slate_field_headers(): client = VideoStitcherServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8181,8 +8210,8 @@ async def test_update_slate_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - video_stitcher_service.DeleteSlateRequest, - dict, + video_stitcher_service.DeleteSlateRequest(), + {}, ], ) def test_delete_slate(request_type, transport: str = "grpc"): @@ -8193,7 +8222,7 @@ def test_delete_slate(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_slate), "__call__") as call: @@ -8234,9 +8263,10 @@ def test_delete_slate_non_empty_request_with_auto_populated_field(): client.delete_slate(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == video_stitcher_service.DeleteSlateRequest( + request_msg = video_stitcher_service.DeleteSlateRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_slate_use_cached_wrapped_rpc(): @@ -8327,10 +8357,14 @@ async def test_delete_slate_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_slate_async( - transport: str = "grpc_asyncio", - request_type=video_stitcher_service.DeleteSlateRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + video_stitcher_service.DeleteSlateRequest(), + {}, + ], +) +async def test_delete_slate_async(request_type, transport: str = "grpc_asyncio"): client = VideoStitcherServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8338,7 +8372,7 @@ async def test_delete_slate_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_slate), "__call__") as call: @@ -8358,11 +8392,6 @@ async def test_delete_slate_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_slate_async_from_dict(): - await test_delete_slate_async(request_type=dict) - - def test_delete_slate_field_headers(): client = VideoStitcherServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8509,8 +8538,8 @@ async def test_delete_slate_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - video_stitcher_service.CreateLiveSessionRequest, - dict, + video_stitcher_service.CreateLiveSessionRequest(), + {}, ], ) def test_create_live_session(request_type, transport: str = "grpc"): @@ -8521,7 +8550,7 @@ def test_create_live_session(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8575,9 +8604,10 @@ def test_create_live_session_non_empty_request_with_auto_populated_field(): client.create_live_session(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == video_stitcher_service.CreateLiveSessionRequest( + request_msg = video_stitcher_service.CreateLiveSessionRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_live_session_use_cached_wrapped_rpc(): @@ -8662,10 +8692,14 @@ async def test_create_live_session_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_live_session_async( - transport: str = "grpc_asyncio", - request_type=video_stitcher_service.CreateLiveSessionRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + video_stitcher_service.CreateLiveSessionRequest(), + {}, + ], +) +async def test_create_live_session_async(request_type, transport: str = "grpc_asyncio"): client = VideoStitcherServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8673,7 +8707,7 @@ async def test_create_live_session_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( @@ -8704,11 +8738,6 @@ async def test_create_live_session_async( assert response.ad_tracking == live_configs.AdTracking.CLIENT -@pytest.mark.asyncio -async def test_create_live_session_async_from_dict(): - await test_create_live_session_async(request_type=dict) - - def test_create_live_session_field_headers(): client = VideoStitcherServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8873,8 +8902,8 @@ async def test_create_live_session_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - video_stitcher_service.GetLiveSessionRequest, - dict, + video_stitcher_service.GetLiveSessionRequest(), + {}, ], ) def test_get_live_session(request_type, transport: str = "grpc"): @@ -8885,7 +8914,7 @@ def test_get_live_session(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_live_session), "__call__") as call: @@ -8935,9 +8964,10 @@ def test_get_live_session_non_empty_request_with_auto_populated_field(): client.get_live_session(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == video_stitcher_service.GetLiveSessionRequest( + request_msg = video_stitcher_service.GetLiveSessionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_live_session_use_cached_wrapped_rpc(): @@ -9020,10 +9050,14 @@ async def test_get_live_session_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_live_session_async( - transport: str = "grpc_asyncio", - request_type=video_stitcher_service.GetLiveSessionRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + video_stitcher_service.GetLiveSessionRequest(), + {}, + ], +) +async def test_get_live_session_async(request_type, transport: str = "grpc_asyncio"): client = VideoStitcherServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9031,7 +9065,7 @@ async def test_get_live_session_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_live_session), "__call__") as call: @@ -9060,11 +9094,6 @@ async def test_get_live_session_async( assert response.ad_tracking == live_configs.AdTracking.CLIENT -@pytest.mark.asyncio -async def test_get_live_session_async_from_dict(): - await test_get_live_session_async(request_type=dict) - - def test_get_live_session_field_headers(): client = VideoStitcherServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9211,8 +9240,8 @@ async def test_get_live_session_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - video_stitcher_service.CreateLiveConfigRequest, - dict, + video_stitcher_service.CreateLiveConfigRequest(), + {}, ], ) def test_create_live_config(request_type, transport: str = "grpc"): @@ -9223,7 +9252,7 @@ def test_create_live_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( @@ -9270,11 +9299,12 @@ def test_create_live_config_non_empty_request_with_auto_populated_field(): client.create_live_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == video_stitcher_service.CreateLiveConfigRequest( + request_msg = video_stitcher_service.CreateLiveConfigRequest( parent="parent_value", live_config_id="live_config_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_live_config_use_cached_wrapped_rpc(): @@ -9369,10 +9399,14 @@ async def test_create_live_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_live_config_async( - transport: str = "grpc_asyncio", - request_type=video_stitcher_service.CreateLiveConfigRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + video_stitcher_service.CreateLiveConfigRequest(), + {}, + ], +) +async def test_create_live_config_async(request_type, transport: str = "grpc_asyncio"): client = VideoStitcherServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9380,7 +9414,7 @@ async def test_create_live_config_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( @@ -9402,11 +9436,6 @@ async def test_create_live_config_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_live_config_async_from_dict(): - await test_create_live_config_async(request_type=dict) - - def test_create_live_config_field_headers(): client = VideoStitcherServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9581,8 +9610,8 @@ async def test_create_live_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - video_stitcher_service.ListLiveConfigsRequest, - dict, + video_stitcher_service.ListLiveConfigsRequest(), + {}, ], ) def test_list_live_configs(request_type, transport: str = "grpc"): @@ -9593,7 +9622,7 @@ def test_list_live_configs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9646,12 +9675,13 @@ def test_list_live_configs_non_empty_request_with_auto_populated_field(): client.list_live_configs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == video_stitcher_service.ListLiveConfigsRequest( + request_msg = video_stitcher_service.ListLiveConfigsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_live_configs_use_cached_wrapped_rpc(): @@ -9734,10 +9764,14 @@ async def test_list_live_configs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_live_configs_async( - transport: str = "grpc_asyncio", - request_type=video_stitcher_service.ListLiveConfigsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + video_stitcher_service.ListLiveConfigsRequest(), + {}, + ], +) +async def test_list_live_configs_async(request_type, transport: str = "grpc_asyncio"): client = VideoStitcherServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9745,7 +9779,7 @@ async def test_list_live_configs_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( @@ -9772,11 +9806,6 @@ async def test_list_live_configs_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_live_configs_async_from_dict(): - await test_list_live_configs_async(request_type=dict) - - def test_list_live_configs_field_headers(): client = VideoStitcherServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10129,8 +10158,8 @@ async def test_list_live_configs_async_pages(): @pytest.mark.parametrize( "request_type", [ - video_stitcher_service.GetLiveConfigRequest, - dict, + video_stitcher_service.GetLiveConfigRequest(), + {}, ], ) def test_get_live_config(request_type, transport: str = "grpc"): @@ -10141,7 +10170,7 @@ def test_get_live_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(type(client.transport.get_live_config), "__call__") as call: @@ -10199,9 +10228,10 @@ def test_get_live_config_non_empty_request_with_auto_populated_field(): client.get_live_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == video_stitcher_service.GetLiveConfigRequest( + request_msg = video_stitcher_service.GetLiveConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_live_config_use_cached_wrapped_rpc(): @@ -10282,10 +10312,14 @@ async def test_get_live_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_live_config_async( - transport: str = "grpc_asyncio", - request_type=video_stitcher_service.GetLiveConfigRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + video_stitcher_service.GetLiveConfigRequest(), + {}, + ], +) +async def test_get_live_config_async(request_type, transport: str = "grpc_asyncio"): client = VideoStitcherServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10293,7 +10327,7 @@ async def test_get_live_config_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_live_config), "__call__") as call: @@ -10330,11 +10364,6 @@ async def test_get_live_config_async( ) -@pytest.mark.asyncio -async def test_get_live_config_async_from_dict(): - await test_get_live_config_async(request_type=dict) - - def test_get_live_config_field_headers(): client = VideoStitcherServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10481,8 +10510,8 @@ async def test_get_live_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - video_stitcher_service.DeleteLiveConfigRequest, - dict, + video_stitcher_service.DeleteLiveConfigRequest(), + {}, ], ) def test_delete_live_config(request_type, transport: str = "grpc"): @@ -10493,7 +10522,7 @@ def test_delete_live_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( @@ -10538,9 +10567,10 @@ def test_delete_live_config_non_empty_request_with_auto_populated_field(): client.delete_live_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == video_stitcher_service.DeleteLiveConfigRequest( + request_msg = video_stitcher_service.DeleteLiveConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_live_config_use_cached_wrapped_rpc(): @@ -10635,10 +10665,14 @@ async def test_delete_live_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_live_config_async( - transport: str = "grpc_asyncio", - request_type=video_stitcher_service.DeleteLiveConfigRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + video_stitcher_service.DeleteLiveConfigRequest(), + {}, + ], +) +async def test_delete_live_config_async(request_type, transport: str = "grpc_asyncio"): client = VideoStitcherServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10646,7 +10680,7 @@ async def test_delete_live_config_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( @@ -10668,11 +10702,6 @@ async def test_delete_live_config_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_live_config_async_from_dict(): - await test_delete_live_config_async(request_type=dict) - - def test_delete_live_config_field_headers(): client = VideoStitcherServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10827,8 +10856,8 @@ async def test_delete_live_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - video_stitcher_service.UpdateLiveConfigRequest, - dict, + video_stitcher_service.UpdateLiveConfigRequest(), + {}, ], ) def test_update_live_config(request_type, transport: str = "grpc"): @@ -10839,7 +10868,7 @@ def test_update_live_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( @@ -10882,7 +10911,8 @@ def test_update_live_config_non_empty_request_with_auto_populated_field(): client.update_live_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == video_stitcher_service.UpdateLiveConfigRequest() + request_msg = video_stitcher_service.UpdateLiveConfigRequest() + assert args[0] == request_msg def test_update_live_config_use_cached_wrapped_rpc(): @@ -10977,10 +11007,14 @@ async def test_update_live_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_live_config_async( - transport: str = "grpc_asyncio", - request_type=video_stitcher_service.UpdateLiveConfigRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + video_stitcher_service.UpdateLiveConfigRequest(), + {}, + ], +) +async def test_update_live_config_async(request_type, transport: str = "grpc_asyncio"): client = VideoStitcherServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10988,7 +11022,7 @@ async def test_update_live_config_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( @@ -11010,11 +11044,6 @@ async def test_update_live_config_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_live_config_async_from_dict(): - await test_update_live_config_async(request_type=dict) - - def test_update_live_config_field_headers(): client = VideoStitcherServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11179,8 +11208,8 @@ async def test_update_live_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - video_stitcher_service.CreateVodConfigRequest, - dict, + video_stitcher_service.CreateVodConfigRequest(), + {}, ], ) def test_create_vod_config(request_type, transport: str = "grpc"): @@ -11191,7 +11220,7 @@ def test_create_vod_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( @@ -11238,11 +11267,12 @@ def test_create_vod_config_non_empty_request_with_auto_populated_field(): client.create_vod_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == video_stitcher_service.CreateVodConfigRequest( + request_msg = video_stitcher_service.CreateVodConfigRequest( parent="parent_value", vod_config_id="vod_config_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_vod_config_use_cached_wrapped_rpc(): @@ -11335,10 +11365,14 @@ async def test_create_vod_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_vod_config_async( - transport: str = "grpc_asyncio", - request_type=video_stitcher_service.CreateVodConfigRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + video_stitcher_service.CreateVodConfigRequest(), + {}, + ], +) +async def test_create_vod_config_async(request_type, transport: str = "grpc_asyncio"): client = VideoStitcherServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11346,7 +11380,7 @@ async def test_create_vod_config_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( @@ -11368,11 +11402,6 @@ async def test_create_vod_config_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_vod_config_async_from_dict(): - await test_create_vod_config_async(request_type=dict) - - def test_create_vod_config_field_headers(): client = VideoStitcherServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11547,8 +11576,8 @@ async def test_create_vod_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - video_stitcher_service.ListVodConfigsRequest, - dict, + video_stitcher_service.ListVodConfigsRequest(), + {}, ], ) def test_list_vod_configs(request_type, transport: str = "grpc"): @@ -11559,7 +11588,7 @@ def test_list_vod_configs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_vod_configs), "__call__") as call: @@ -11608,12 +11637,13 @@ def test_list_vod_configs_non_empty_request_with_auto_populated_field(): client.list_vod_configs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == video_stitcher_service.ListVodConfigsRequest( + request_msg = video_stitcher_service.ListVodConfigsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_vod_configs_use_cached_wrapped_rpc(): @@ -11696,10 +11726,14 @@ async def test_list_vod_configs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_vod_configs_async( - transport: str = "grpc_asyncio", - request_type=video_stitcher_service.ListVodConfigsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + video_stitcher_service.ListVodConfigsRequest(), + {}, + ], +) +async def test_list_vod_configs_async(request_type, transport: str = "grpc_asyncio"): client = VideoStitcherServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11707,7 +11741,7 @@ async def test_list_vod_configs_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_vod_configs), "__call__") as call: @@ -11732,11 +11766,6 @@ async def test_list_vod_configs_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_vod_configs_async_from_dict(): - await test_list_vod_configs_async(request_type=dict) - - def test_list_vod_configs_field_headers(): client = VideoStitcherServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12073,8 +12102,8 @@ async def test_list_vod_configs_async_pages(): @pytest.mark.parametrize( "request_type", [ - video_stitcher_service.GetVodConfigRequest, - dict, + video_stitcher_service.GetVodConfigRequest(), + {}, ], ) def test_get_vod_config(request_type, transport: str = "grpc"): @@ -12085,7 +12114,7 @@ def test_get_vod_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(type(client.transport.get_vod_config), "__call__") as call: @@ -12135,9 +12164,10 @@ def test_get_vod_config_non_empty_request_with_auto_populated_field(): client.get_vod_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == video_stitcher_service.GetVodConfigRequest( + request_msg = video_stitcher_service.GetVodConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_vod_config_use_cached_wrapped_rpc(): @@ -12218,10 +12248,14 @@ async def test_get_vod_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_vod_config_async( - transport: str = "grpc_asyncio", - request_type=video_stitcher_service.GetVodConfigRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + video_stitcher_service.GetVodConfigRequest(), + {}, + ], +) +async def test_get_vod_config_async(request_type, transport: str = "grpc_asyncio"): client = VideoStitcherServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12229,7 +12263,7 @@ async def test_get_vod_config_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_vod_config), "__call__") as call: @@ -12258,11 +12292,6 @@ async def test_get_vod_config_async( assert response.state == vod_configs.VodConfig.State.CREATING -@pytest.mark.asyncio -async def test_get_vod_config_async_from_dict(): - await test_get_vod_config_async(request_type=dict) - - def test_get_vod_config_field_headers(): client = VideoStitcherServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12409,8 +12438,8 @@ async def test_get_vod_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - video_stitcher_service.DeleteVodConfigRequest, - dict, + video_stitcher_service.DeleteVodConfigRequest(), + {}, ], ) def test_delete_vod_config(request_type, transport: str = "grpc"): @@ -12421,7 +12450,7 @@ def test_delete_vod_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( @@ -12466,9 +12495,10 @@ def test_delete_vod_config_non_empty_request_with_auto_populated_field(): client.delete_vod_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == video_stitcher_service.DeleteVodConfigRequest( + request_msg = video_stitcher_service.DeleteVodConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_vod_config_use_cached_wrapped_rpc(): @@ -12561,10 +12591,14 @@ async def test_delete_vod_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_vod_config_async( - transport: str = "grpc_asyncio", - request_type=video_stitcher_service.DeleteVodConfigRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + video_stitcher_service.DeleteVodConfigRequest(), + {}, + ], +) +async def test_delete_vod_config_async(request_type, transport: str = "grpc_asyncio"): client = VideoStitcherServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12572,7 +12606,7 @@ async def test_delete_vod_config_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( @@ -12594,11 +12628,6 @@ async def test_delete_vod_config_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_vod_config_async_from_dict(): - await test_delete_vod_config_async(request_type=dict) - - def test_delete_vod_config_field_headers(): client = VideoStitcherServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12753,8 +12782,8 @@ async def test_delete_vod_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - video_stitcher_service.UpdateVodConfigRequest, - dict, + video_stitcher_service.UpdateVodConfigRequest(), + {}, ], ) def test_update_vod_config(request_type, transport: str = "grpc"): @@ -12765,7 +12794,7 @@ def test_update_vod_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( @@ -12808,7 +12837,8 @@ def test_update_vod_config_non_empty_request_with_auto_populated_field(): client.update_vod_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == video_stitcher_service.UpdateVodConfigRequest() + request_msg = video_stitcher_service.UpdateVodConfigRequest() + assert args[0] == request_msg def test_update_vod_config_use_cached_wrapped_rpc(): @@ -12901,10 +12931,14 @@ async def test_update_vod_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_vod_config_async( - transport: str = "grpc_asyncio", - request_type=video_stitcher_service.UpdateVodConfigRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + video_stitcher_service.UpdateVodConfigRequest(), + {}, + ], +) +async def test_update_vod_config_async(request_type, transport: str = "grpc_asyncio"): client = VideoStitcherServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12912,7 +12946,7 @@ async def test_update_vod_config_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( @@ -12934,11 +12968,6 @@ async def test_update_vod_config_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_vod_config_async_from_dict(): - await test_update_vod_config_async(request_type=dict) - - def test_update_vod_config_field_headers(): client = VideoStitcherServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -19432,7 +19461,6 @@ def test_create_cdn_key_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.CreateCdnKeyRequest() - assert args[0] == request_msg @@ -19453,7 +19481,6 @@ def test_list_cdn_keys_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.ListCdnKeysRequest() - assert args[0] == request_msg @@ -19474,7 +19501,6 @@ def test_get_cdn_key_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.GetCdnKeyRequest() - assert args[0] == request_msg @@ -19495,7 +19521,6 @@ def test_delete_cdn_key_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.DeleteCdnKeyRequest() - assert args[0] == request_msg @@ -19516,7 +19541,6 @@ def test_update_cdn_key_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.UpdateCdnKeyRequest() - assert args[0] == request_msg @@ -19539,7 +19563,6 @@ def test_create_vod_session_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.CreateVodSessionRequest() - assert args[0] == request_msg @@ -19560,7 +19583,6 @@ def test_get_vod_session_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.GetVodSessionRequest() - assert args[0] == request_msg @@ -19583,7 +19605,6 @@ def test_list_vod_stitch_details_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.ListVodStitchDetailsRequest() - assert args[0] == request_msg @@ -19606,7 +19627,6 @@ def test_get_vod_stitch_detail_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.GetVodStitchDetailRequest() - assert args[0] == request_msg @@ -19629,7 +19649,6 @@ def test_list_vod_ad_tag_details_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.ListVodAdTagDetailsRequest() - assert args[0] == request_msg @@ -19652,7 +19671,6 @@ def test_get_vod_ad_tag_detail_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.GetVodAdTagDetailRequest() - assert args[0] == request_msg @@ -19675,7 +19693,6 @@ def test_list_live_ad_tag_details_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.ListLiveAdTagDetailsRequest() - assert args[0] == request_msg @@ -19698,7 +19715,6 @@ def test_get_live_ad_tag_detail_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.GetLiveAdTagDetailRequest() - assert args[0] == request_msg @@ -19719,7 +19735,6 @@ def test_create_slate_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.CreateSlateRequest() - assert args[0] == request_msg @@ -19740,7 +19755,6 @@ def test_list_slates_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.ListSlatesRequest() - assert args[0] == request_msg @@ -19761,7 +19775,6 @@ def test_get_slate_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.GetSlateRequest() - assert args[0] == request_msg @@ -19782,7 +19795,6 @@ def test_update_slate_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.UpdateSlateRequest() - assert args[0] == request_msg @@ -19803,7 +19815,6 @@ def test_delete_slate_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.DeleteSlateRequest() - assert args[0] == request_msg @@ -19826,7 +19837,6 @@ def test_create_live_session_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.CreateLiveSessionRequest() - assert args[0] == request_msg @@ -19847,7 +19857,6 @@ def test_get_live_session_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.GetLiveSessionRequest() - assert args[0] == request_msg @@ -19870,7 +19879,6 @@ def test_create_live_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.CreateLiveConfigRequest() - assert args[0] == request_msg @@ -19893,7 +19901,6 @@ def test_list_live_configs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.ListLiveConfigsRequest() - assert args[0] == request_msg @@ -19914,7 +19921,6 @@ def test_get_live_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.GetLiveConfigRequest() - assert args[0] == request_msg @@ -19937,7 +19943,6 @@ def test_delete_live_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.DeleteLiveConfigRequest() - assert args[0] == request_msg @@ -19960,7 +19965,6 @@ def test_update_live_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.UpdateLiveConfigRequest() - assert args[0] == request_msg @@ -19983,7 +19987,6 @@ def test_create_vod_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.CreateVodConfigRequest() - assert args[0] == request_msg @@ -20004,7 +20007,6 @@ def test_list_vod_configs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.ListVodConfigsRequest() - assert args[0] == request_msg @@ -20025,7 +20027,6 @@ def test_get_vod_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.GetVodConfigRequest() - assert args[0] == request_msg @@ -20048,7 +20049,6 @@ def test_delete_vod_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.DeleteVodConfigRequest() - assert args[0] == request_msg @@ -20071,7 +20071,6 @@ def test_update_vod_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.UpdateVodConfigRequest() - assert args[0] == request_msg @@ -20110,7 +20109,6 @@ async def test_create_cdn_key_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.CreateCdnKeyRequest() - assert args[0] == request_msg @@ -20138,7 +20136,6 @@ async def test_list_cdn_keys_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.ListCdnKeysRequest() - assert args[0] == request_msg @@ -20166,7 +20163,6 @@ async def test_get_cdn_key_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.GetCdnKeyRequest() - assert args[0] == request_msg @@ -20191,7 +20187,6 @@ async def test_delete_cdn_key_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.DeleteCdnKeyRequest() - assert args[0] == request_msg @@ -20216,7 +20211,6 @@ async def test_update_cdn_key_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.UpdateCdnKeyRequest() - assert args[0] == request_msg @@ -20251,7 +20245,6 @@ async def test_create_vod_session_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.CreateVodSessionRequest() - assert args[0] == request_msg @@ -20284,7 +20277,6 @@ async def test_get_vod_session_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.GetVodSessionRequest() - assert args[0] == request_msg @@ -20313,7 +20305,6 @@ async def test_list_vod_stitch_details_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.ListVodStitchDetailsRequest() - assert args[0] == request_msg @@ -20342,7 +20333,6 @@ async def test_get_vod_stitch_detail_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.GetVodStitchDetailRequest() - assert args[0] == request_msg @@ -20371,7 +20361,6 @@ async def test_list_vod_ad_tag_details_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.ListVodAdTagDetailsRequest() - assert args[0] == request_msg @@ -20400,7 +20389,6 @@ async def test_get_vod_ad_tag_detail_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.GetVodAdTagDetailRequest() - assert args[0] == request_msg @@ -20429,7 +20417,6 @@ async def test_list_live_ad_tag_details_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.ListLiveAdTagDetailsRequest() - assert args[0] == request_msg @@ -20458,7 +20445,6 @@ async def test_get_live_ad_tag_detail_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.GetLiveAdTagDetailRequest() - assert args[0] == request_msg @@ -20483,7 +20469,6 @@ async def test_create_slate_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.CreateSlateRequest() - assert args[0] == request_msg @@ -20511,7 +20496,6 @@ async def test_list_slates_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.ListSlatesRequest() - assert args[0] == request_msg @@ -20539,7 +20523,6 @@ async def test_get_slate_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.GetSlateRequest() - assert args[0] == request_msg @@ -20564,7 +20547,6 @@ async def test_update_slate_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.UpdateSlateRequest() - assert args[0] == request_msg @@ -20589,7 +20571,6 @@ async def test_delete_slate_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.DeleteSlateRequest() - assert args[0] == request_msg @@ -20621,7 +20602,6 @@ async def test_create_live_session_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.CreateLiveSessionRequest() - assert args[0] == request_msg @@ -20651,7 +20631,6 @@ async def test_get_live_session_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.GetLiveSessionRequest() - assert args[0] == request_msg @@ -20678,7 +20657,6 @@ async def test_create_live_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.CreateLiveConfigRequest() - assert args[0] == request_msg @@ -20708,7 +20686,6 @@ async def test_list_live_configs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.ListLiveConfigsRequest() - assert args[0] == request_msg @@ -20741,7 +20718,6 @@ async def test_get_live_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.GetLiveConfigRequest() - assert args[0] == request_msg @@ -20768,7 +20744,6 @@ async def test_delete_live_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.DeleteLiveConfigRequest() - assert args[0] == request_msg @@ -20795,7 +20770,6 @@ async def test_update_live_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.UpdateLiveConfigRequest() - assert args[0] == request_msg @@ -20822,7 +20796,6 @@ async def test_create_vod_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.CreateVodConfigRequest() - assert args[0] == request_msg @@ -20850,7 +20823,6 @@ async def test_list_vod_configs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.ListVodConfigsRequest() - assert args[0] == request_msg @@ -20880,7 +20852,6 @@ async def test_get_vod_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.GetVodConfigRequest() - assert args[0] == request_msg @@ -20907,7 +20878,6 @@ async def test_delete_vod_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.DeleteVodConfigRequest() - assert args[0] == request_msg @@ -20934,7 +20904,6 @@ async def test_update_vod_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.UpdateVodConfigRequest() - assert args[0] == request_msg @@ -26096,7 +26065,6 @@ def test_create_cdn_key_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.CreateCdnKeyRequest() - assert args[0] == request_msg @@ -26116,7 +26084,6 @@ def test_list_cdn_keys_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.ListCdnKeysRequest() - assert args[0] == request_msg @@ -26136,7 +26103,6 @@ def test_get_cdn_key_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.GetCdnKeyRequest() - assert args[0] == request_msg @@ -26156,7 +26122,6 @@ def test_delete_cdn_key_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.DeleteCdnKeyRequest() - assert args[0] == request_msg @@ -26176,7 +26141,6 @@ def test_update_cdn_key_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.UpdateCdnKeyRequest() - assert args[0] == request_msg @@ -26198,7 +26162,6 @@ def test_create_vod_session_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.CreateVodSessionRequest() - assert args[0] == request_msg @@ -26218,7 +26181,6 @@ def test_get_vod_session_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.GetVodSessionRequest() - assert args[0] == request_msg @@ -26240,7 +26202,6 @@ def test_list_vod_stitch_details_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.ListVodStitchDetailsRequest() - assert args[0] == request_msg @@ -26262,7 +26223,6 @@ def test_get_vod_stitch_detail_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.GetVodStitchDetailRequest() - assert args[0] == request_msg @@ -26284,7 +26244,6 @@ def test_list_vod_ad_tag_details_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.ListVodAdTagDetailsRequest() - assert args[0] == request_msg @@ -26306,7 +26265,6 @@ def test_get_vod_ad_tag_detail_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.GetVodAdTagDetailRequest() - assert args[0] == request_msg @@ -26328,7 +26286,6 @@ def test_list_live_ad_tag_details_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.ListLiveAdTagDetailsRequest() - assert args[0] == request_msg @@ -26350,7 +26307,6 @@ def test_get_live_ad_tag_detail_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.GetLiveAdTagDetailRequest() - assert args[0] == request_msg @@ -26370,7 +26326,6 @@ def test_create_slate_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.CreateSlateRequest() - assert args[0] == request_msg @@ -26390,7 +26345,6 @@ def test_list_slates_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.ListSlatesRequest() - assert args[0] == request_msg @@ -26410,7 +26364,6 @@ def test_get_slate_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.GetSlateRequest() - assert args[0] == request_msg @@ -26430,7 +26383,6 @@ def test_update_slate_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.UpdateSlateRequest() - assert args[0] == request_msg @@ -26450,7 +26402,6 @@ def test_delete_slate_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.DeleteSlateRequest() - assert args[0] == request_msg @@ -26472,7 +26423,6 @@ def test_create_live_session_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.CreateLiveSessionRequest() - assert args[0] == request_msg @@ -26492,7 +26442,6 @@ def test_get_live_session_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.GetLiveSessionRequest() - assert args[0] == request_msg @@ -26514,7 +26463,6 @@ def test_create_live_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.CreateLiveConfigRequest() - assert args[0] == request_msg @@ -26536,7 +26484,6 @@ def test_list_live_configs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.ListLiveConfigsRequest() - assert args[0] == request_msg @@ -26556,7 +26503,6 @@ def test_get_live_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.GetLiveConfigRequest() - assert args[0] == request_msg @@ -26578,7 +26524,6 @@ def test_delete_live_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.DeleteLiveConfigRequest() - assert args[0] == request_msg @@ -26600,7 +26545,6 @@ def test_update_live_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.UpdateLiveConfigRequest() - assert args[0] == request_msg @@ -26622,7 +26566,6 @@ def test_create_vod_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.CreateVodConfigRequest() - assert args[0] == request_msg @@ -26642,7 +26585,6 @@ def test_list_vod_configs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.ListVodConfigsRequest() - assert args[0] == request_msg @@ -26662,7 +26604,6 @@ def test_get_vod_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.GetVodConfigRequest() - assert args[0] == request_msg @@ -26684,7 +26625,6 @@ def test_delete_vod_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.DeleteVodConfigRequest() - assert args[0] == request_msg @@ -26706,7 +26646,6 @@ def test_update_vod_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_stitcher_service.UpdateVodConfigRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-video-transcoder/noxfile.py b/packages/google-cloud-video-transcoder/noxfile.py index 89eb90437d45..6947719b3abd 100644 --- a/packages/google-cloud-video-transcoder/noxfile.py +++ b/packages/google-cloud-video-transcoder/noxfile.py @@ -47,7 +47,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-video-transcoder" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-video-transcoder/setup.py b/packages/google-cloud-video-transcoder/setup.py index 1ca344e4033c..add5a553a150 100644 --- a/packages/google-cloud-video-transcoder/setup.py +++ b/packages/google-cloud-video-transcoder/setup.py @@ -45,7 +45,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/google-cloud-video-transcoder/testing/constraints-3.10.txt b/packages/google-cloud-video-transcoder/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-video-transcoder/testing/constraints-3.10.txt +++ b/packages/google-cloud-video-transcoder/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-video-transcoder/tests/unit/gapic/transcoder_v1/test_transcoder_service.py b/packages/google-cloud-video-transcoder/tests/unit/gapic/transcoder_v1/test_transcoder_service.py index 13a97d42a14a..399665c87aad 100644 --- a/packages/google-cloud-video-transcoder/tests/unit/gapic/transcoder_v1/test_transcoder_service.py +++ b/packages/google-cloud-video-transcoder/tests/unit/gapic/transcoder_v1/test_transcoder_service.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" @@ -1352,8 +1368,8 @@ def test_transcoder_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - services.CreateJobRequest, - dict, + services.CreateJobRequest(), + {}, ], ) def test_create_job(request_type, transport: str = "grpc"): @@ -1364,7 +1380,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() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_job), "__call__") as call: @@ -1425,9 +1441,10 @@ def test_create_job_non_empty_request_with_auto_populated_field(): client.create_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == services.CreateJobRequest( + request_msg = services.CreateJobRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_job_use_cached_wrapped_rpc(): @@ -1506,9 +1523,14 @@ async def test_create_job_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_create_job_async( - transport: str = "grpc_asyncio", request_type=services.CreateJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + services.CreateJobRequest(), + {}, + ], +) +async def test_create_job_async(request_type, transport: str = "grpc_asyncio"): client = TranscoderServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1516,7 +1538,7 @@ async def test_create_job_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_job), "__call__") as call: @@ -1555,11 +1577,6 @@ async def test_create_job_async( assert response.fill_content_gaps is True -@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 = TranscoderServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1712,8 +1729,8 @@ async def test_create_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - services.ListJobsRequest, - dict, + services.ListJobsRequest(), + {}, ], ) def test_list_jobs(request_type, transport: str = "grpc"): @@ -1724,7 +1741,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(type(client.transport.list_jobs), "__call__") as call: @@ -1773,12 +1790,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] == services.ListJobsRequest( + request_msg = services.ListJobsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_jobs_use_cached_wrapped_rpc(): @@ -1857,9 +1875,14 @@ async def test_list_jobs_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_list_jobs_async( - transport: str = "grpc_asyncio", request_type=services.ListJobsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + services.ListJobsRequest(), + {}, + ], +) +async def test_list_jobs_async(request_type, transport: str = "grpc_asyncio"): client = TranscoderServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1867,7 +1890,7 @@ async def test_list_jobs_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_jobs), "__call__") as call: @@ -1892,11 +1915,6 @@ async def test_list_jobs_async( 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 = TranscoderServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2233,8 +2251,8 @@ async def test_list_jobs_async_pages(): @pytest.mark.parametrize( "request_type", [ - services.GetJobRequest, - dict, + services.GetJobRequest(), + {}, ], ) def test_get_job(request_type, transport: str = "grpc"): @@ -2245,7 +2263,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(type(client.transport.get_job), "__call__") as call: @@ -2306,9 +2324,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] == services.GetJobRequest( + request_msg = services.GetJobRequest( name="name_value", ) + assert args[0] == request_msg def test_get_job_use_cached_wrapped_rpc(): @@ -2387,9 +2406,14 @@ async def test_get_job_async_use_cached_wrapped_rpc(transport: str = "grpc_async @pytest.mark.asyncio -async def test_get_job_async( - transport: str = "grpc_asyncio", request_type=services.GetJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + services.GetJobRequest(), + {}, + ], +) +async def test_get_job_async(request_type, transport: str = "grpc_asyncio"): client = TranscoderServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2397,7 +2421,7 @@ async def test_get_job_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_job), "__call__") as call: @@ -2436,11 +2460,6 @@ async def test_get_job_async( assert response.fill_content_gaps 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 = TranscoderServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2583,8 +2602,8 @@ async def test_get_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - services.DeleteJobRequest, - dict, + services.DeleteJobRequest(), + {}, ], ) def test_delete_job(request_type, transport: str = "grpc"): @@ -2595,7 +2614,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() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_job), "__call__") as call: @@ -2636,9 +2655,10 @@ def test_delete_job_non_empty_request_with_auto_populated_field(): client.delete_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == services.DeleteJobRequest( + request_msg = services.DeleteJobRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_job_use_cached_wrapped_rpc(): @@ -2717,9 +2737,14 @@ async def test_delete_job_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_delete_job_async( - transport: str = "grpc_asyncio", request_type=services.DeleteJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + services.DeleteJobRequest(), + {}, + ], +) +async def test_delete_job_async(request_type, transport: str = "grpc_asyncio"): client = TranscoderServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2727,7 +2752,7 @@ async def test_delete_job_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_job), "__call__") as call: @@ -2745,11 +2770,6 @@ async def test_delete_job_async( 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 = TranscoderServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2892,8 +2912,8 @@ async def test_delete_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - services.CreateJobTemplateRequest, - dict, + services.CreateJobTemplateRequest(), + {}, ], ) def test_create_job_template(request_type, transport: str = "grpc"): @@ -2904,7 +2924,7 @@ def test_create_job_template(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2953,10 +2973,11 @@ def test_create_job_template_non_empty_request_with_auto_populated_field(): client.create_job_template(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == services.CreateJobTemplateRequest( + request_msg = services.CreateJobTemplateRequest( parent="parent_value", job_template_id="job_template_id_value", ) + assert args[0] == request_msg def test_create_job_template_use_cached_wrapped_rpc(): @@ -3041,9 +3062,14 @@ async def test_create_job_template_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_job_template_async( - transport: str = "grpc_asyncio", request_type=services.CreateJobTemplateRequest -): +@pytest.mark.parametrize( + "request_type", + [ + services.CreateJobTemplateRequest(), + {}, + ], +) +async def test_create_job_template_async(request_type, transport: str = "grpc_asyncio"): client = TranscoderServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3051,7 +3077,7 @@ async def test_create_job_template_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( @@ -3076,11 +3102,6 @@ async def test_create_job_template_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_create_job_template_async_from_dict(): - await test_create_job_template_async(request_type=dict) - - def test_create_job_template_field_headers(): client = TranscoderServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3255,8 +3276,8 @@ async def test_create_job_template_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - services.ListJobTemplatesRequest, - dict, + services.ListJobTemplatesRequest(), + {}, ], ) def test_list_job_templates(request_type, transport: str = "grpc"): @@ -3267,7 +3288,7 @@ def test_list_job_templates(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3320,12 +3341,13 @@ def test_list_job_templates_non_empty_request_with_auto_populated_field(): client.list_job_templates(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == services.ListJobTemplatesRequest( + request_msg = services.ListJobTemplatesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_job_templates_use_cached_wrapped_rpc(): @@ -3410,9 +3432,14 @@ async def test_list_job_templates_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_job_templates_async( - transport: str = "grpc_asyncio", request_type=services.ListJobTemplatesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + services.ListJobTemplatesRequest(), + {}, + ], +) +async def test_list_job_templates_async(request_type, transport: str = "grpc_asyncio"): client = TranscoderServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3420,7 +3447,7 @@ async def test_list_job_templates_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( @@ -3447,11 +3474,6 @@ async def test_list_job_templates_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_job_templates_async_from_dict(): - await test_list_job_templates_async(request_type=dict) - - def test_list_job_templates_field_headers(): client = TranscoderServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3804,8 +3826,8 @@ async def test_list_job_templates_async_pages(): @pytest.mark.parametrize( "request_type", [ - services.GetJobTemplateRequest, - dict, + services.GetJobTemplateRequest(), + {}, ], ) def test_get_job_template(request_type, transport: str = "grpc"): @@ -3816,7 +3838,7 @@ def test_get_job_template(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_job_template), "__call__") as call: @@ -3860,9 +3882,10 @@ def test_get_job_template_non_empty_request_with_auto_populated_field(): client.get_job_template(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == services.GetJobTemplateRequest( + request_msg = services.GetJobTemplateRequest( name="name_value", ) + assert args[0] == request_msg def test_get_job_template_use_cached_wrapped_rpc(): @@ -3945,9 +3968,14 @@ async def test_get_job_template_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_job_template_async( - transport: str = "grpc_asyncio", request_type=services.GetJobTemplateRequest -): +@pytest.mark.parametrize( + "request_type", + [ + services.GetJobTemplateRequest(), + {}, + ], +) +async def test_get_job_template_async(request_type, transport: str = "grpc_asyncio"): client = TranscoderServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3955,7 +3983,7 @@ async def test_get_job_template_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_job_template), "__call__") as call: @@ -3978,11 +4006,6 @@ async def test_get_job_template_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_job_template_async_from_dict(): - await test_get_job_template_async(request_type=dict) - - def test_get_job_template_field_headers(): client = TranscoderServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4129,8 +4152,8 @@ async def test_get_job_template_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - services.DeleteJobTemplateRequest, - dict, + services.DeleteJobTemplateRequest(), + {}, ], ) def test_delete_job_template(request_type, transport: str = "grpc"): @@ -4141,7 +4164,7 @@ def test_delete_job_template(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4186,9 +4209,10 @@ def test_delete_job_template_non_empty_request_with_auto_populated_field(): client.delete_job_template(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == services.DeleteJobTemplateRequest( + request_msg = services.DeleteJobTemplateRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_job_template_use_cached_wrapped_rpc(): @@ -4273,9 +4297,14 @@ async def test_delete_job_template_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_job_template_async( - transport: str = "grpc_asyncio", request_type=services.DeleteJobTemplateRequest -): +@pytest.mark.parametrize( + "request_type", + [ + services.DeleteJobTemplateRequest(), + {}, + ], +) +async def test_delete_job_template_async(request_type, transport: str = "grpc_asyncio"): client = TranscoderServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4283,7 +4312,7 @@ async def test_delete_job_template_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( @@ -4303,11 +4332,6 @@ async def test_delete_job_template_async( assert response is None -@pytest.mark.asyncio -async def test_delete_job_template_async_from_dict(): - await test_delete_job_template_async(request_type=dict) - - def test_delete_job_template_field_headers(): client = TranscoderServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6202,7 +6226,6 @@ def test_create_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = services.CreateJobRequest() - assert args[0] == request_msg @@ -6223,7 +6246,6 @@ def test_list_jobs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = services.ListJobsRequest() - assert args[0] == request_msg @@ -6244,7 +6266,6 @@ def test_get_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = services.GetJobRequest() - assert args[0] == request_msg @@ -6265,7 +6286,6 @@ def test_delete_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = services.DeleteJobRequest() - assert args[0] == request_msg @@ -6288,7 +6308,6 @@ def test_create_job_template_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = services.CreateJobTemplateRequest() - assert args[0] == request_msg @@ -6311,7 +6330,6 @@ def test_list_job_templates_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = services.ListJobTemplatesRequest() - assert args[0] == request_msg @@ -6332,7 +6350,6 @@ def test_get_job_template_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = services.GetJobTemplateRequest() - assert args[0] == request_msg @@ -6355,7 +6372,6 @@ def test_delete_job_template_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = services.DeleteJobTemplateRequest() - assert args[0] == request_msg @@ -6404,7 +6420,6 @@ async def test_create_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = services.CreateJobRequest() - assert args[0] == request_msg @@ -6432,7 +6447,6 @@ async def test_list_jobs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = services.ListJobsRequest() - assert args[0] == request_msg @@ -6467,7 +6481,6 @@ async def test_get_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = services.GetJobRequest() - assert args[0] == request_msg @@ -6490,7 +6503,6 @@ async def test_delete_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = services.DeleteJobRequest() - assert args[0] == request_msg @@ -6519,7 +6531,6 @@ async def test_create_job_template_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = services.CreateJobTemplateRequest() - assert args[0] == request_msg @@ -6549,7 +6560,6 @@ async def test_list_job_templates_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = services.ListJobTemplatesRequest() - assert args[0] == request_msg @@ -6576,7 +6586,6 @@ async def test_get_job_template_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = services.GetJobTemplateRequest() - assert args[0] == request_msg @@ -6601,7 +6610,6 @@ async def test_delete_job_template_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = services.DeleteJobTemplateRequest() - assert args[0] == request_msg @@ -8324,7 +8332,6 @@ def test_create_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = services.CreateJobRequest() - assert args[0] == request_msg @@ -8344,7 +8351,6 @@ def test_list_jobs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = services.ListJobsRequest() - assert args[0] == request_msg @@ -8364,7 +8370,6 @@ def test_get_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = services.GetJobRequest() - assert args[0] == request_msg @@ -8384,7 +8389,6 @@ def test_delete_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = services.DeleteJobRequest() - assert args[0] == request_msg @@ -8406,7 +8410,6 @@ def test_create_job_template_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = services.CreateJobTemplateRequest() - assert args[0] == request_msg @@ -8428,7 +8431,6 @@ def test_list_job_templates_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = services.ListJobTemplatesRequest() - assert args[0] == request_msg @@ -8448,7 +8450,6 @@ def test_get_job_template_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = services.GetJobTemplateRequest() - assert args[0] == request_msg @@ -8470,7 +8471,6 @@ def test_delete_job_template_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = services.DeleteJobTemplateRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-videointelligence/noxfile.py b/packages/google-cloud-videointelligence/noxfile.py index 9f918e91674e..ea240e5ae562 100644 --- a/packages/google-cloud-videointelligence/noxfile.py +++ b/packages/google-cloud-videointelligence/noxfile.py @@ -47,7 +47,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-videointelligence" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-videointelligence/setup.py b/packages/google-cloud-videointelligence/setup.py index dcd2d1fddab8..3573c98f7480 100644 --- a/packages/google-cloud-videointelligence/setup.py +++ b/packages/google-cloud-videointelligence/setup.py @@ -45,7 +45,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/google-cloud-videointelligence/testing/constraints-3.10.txt b/packages/google-cloud-videointelligence/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-videointelligence/testing/constraints-3.10.txt +++ b/packages/google-cloud-videointelligence/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-videointelligence/tests/unit/gapic/videointelligence_v1/test_video_intelligence_service.py b/packages/google-cloud-videointelligence/tests/unit/gapic/videointelligence_v1/test_video_intelligence_service.py index 14632dd7e14a..79c1e133c747 100644 --- a/packages/google-cloud-videointelligence/tests/unit/gapic/videointelligence_v1/test_video_intelligence_service.py +++ b/packages/google-cloud-videointelligence/tests/unit/gapic/videointelligence_v1/test_video_intelligence_service.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" @@ -1387,8 +1403,8 @@ def test_video_intelligence_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - video_intelligence.AnnotateVideoRequest, - dict, + video_intelligence.AnnotateVideoRequest(), + {}, ], ) def test_annotate_video(request_type, transport: str = "grpc"): @@ -1399,7 +1415,7 @@ def test_annotate_video(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.annotate_video), "__call__") as call: @@ -1442,11 +1458,12 @@ def test_annotate_video_non_empty_request_with_auto_populated_field(): client.annotate_video(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == video_intelligence.AnnotateVideoRequest( + request_msg = video_intelligence.AnnotateVideoRequest( input_uri="input_uri_value", output_uri="output_uri_value", location_id="location_id_value", ) + assert args[0] == request_msg def test_annotate_video_use_cached_wrapped_rpc(): @@ -1537,10 +1554,14 @@ async def test_annotate_video_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_annotate_video_async( - transport: str = "grpc_asyncio", - request_type=video_intelligence.AnnotateVideoRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + video_intelligence.AnnotateVideoRequest(), + {}, + ], +) +async def test_annotate_video_async(request_type, transport: str = "grpc_asyncio"): client = VideoIntelligenceServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1548,7 +1569,7 @@ async def test_annotate_video_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.annotate_video), "__call__") as call: @@ -1568,11 +1589,6 @@ async def test_annotate_video_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_annotate_video_async_from_dict(): - await test_annotate_video_async(request_type=dict) - - def test_annotate_video_flattened(): client = VideoIntelligenceServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1961,7 +1977,6 @@ def test_annotate_video_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_intelligence.AnnotateVideoRequest() - assert args[0] == request_msg @@ -2000,7 +2015,6 @@ async def test_annotate_video_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_intelligence.AnnotateVideoRequest() - assert args[0] == request_msg @@ -2160,7 +2174,6 @@ def test_annotate_video_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_intelligence.AnnotateVideoRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-videointelligence/tests/unit/gapic/videointelligence_v1beta2/test_video_intelligence_service.py b/packages/google-cloud-videointelligence/tests/unit/gapic/videointelligence_v1beta2/test_video_intelligence_service.py index 485235973a36..c605c1160c7c 100644 --- a/packages/google-cloud-videointelligence/tests/unit/gapic/videointelligence_v1beta2/test_video_intelligence_service.py +++ b/packages/google-cloud-videointelligence/tests/unit/gapic/videointelligence_v1beta2/test_video_intelligence_service.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" @@ -1387,8 +1403,8 @@ def test_video_intelligence_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - video_intelligence.AnnotateVideoRequest, - dict, + video_intelligence.AnnotateVideoRequest(), + {}, ], ) def test_annotate_video(request_type, transport: str = "grpc"): @@ -1399,7 +1415,7 @@ def test_annotate_video(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.annotate_video), "__call__") as call: @@ -1442,11 +1458,12 @@ def test_annotate_video_non_empty_request_with_auto_populated_field(): client.annotate_video(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == video_intelligence.AnnotateVideoRequest( + request_msg = video_intelligence.AnnotateVideoRequest( input_uri="input_uri_value", output_uri="output_uri_value", location_id="location_id_value", ) + assert args[0] == request_msg def test_annotate_video_use_cached_wrapped_rpc(): @@ -1537,10 +1554,14 @@ async def test_annotate_video_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_annotate_video_async( - transport: str = "grpc_asyncio", - request_type=video_intelligence.AnnotateVideoRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + video_intelligence.AnnotateVideoRequest(), + {}, + ], +) +async def test_annotate_video_async(request_type, transport: str = "grpc_asyncio"): client = VideoIntelligenceServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1548,7 +1569,7 @@ async def test_annotate_video_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.annotate_video), "__call__") as call: @@ -1568,11 +1589,6 @@ async def test_annotate_video_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_annotate_video_async_from_dict(): - await test_annotate_video_async(request_type=dict) - - def test_annotate_video_flattened(): client = VideoIntelligenceServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1961,7 +1977,6 @@ def test_annotate_video_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_intelligence.AnnotateVideoRequest() - assert args[0] == request_msg @@ -2000,7 +2015,6 @@ async def test_annotate_video_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_intelligence.AnnotateVideoRequest() - assert args[0] == request_msg @@ -2160,7 +2174,6 @@ def test_annotate_video_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_intelligence.AnnotateVideoRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-videointelligence/tests/unit/gapic/videointelligence_v1p1beta1/test_video_intelligence_service.py b/packages/google-cloud-videointelligence/tests/unit/gapic/videointelligence_v1p1beta1/test_video_intelligence_service.py index dbd93c87b2b5..946fab37ff38 100644 --- a/packages/google-cloud-videointelligence/tests/unit/gapic/videointelligence_v1p1beta1/test_video_intelligence_service.py +++ b/packages/google-cloud-videointelligence/tests/unit/gapic/videointelligence_v1p1beta1/test_video_intelligence_service.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" @@ -1387,8 +1403,8 @@ def test_video_intelligence_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - video_intelligence.AnnotateVideoRequest, - dict, + video_intelligence.AnnotateVideoRequest(), + {}, ], ) def test_annotate_video(request_type, transport: str = "grpc"): @@ -1399,7 +1415,7 @@ def test_annotate_video(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.annotate_video), "__call__") as call: @@ -1442,11 +1458,12 @@ def test_annotate_video_non_empty_request_with_auto_populated_field(): client.annotate_video(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == video_intelligence.AnnotateVideoRequest( + request_msg = video_intelligence.AnnotateVideoRequest( input_uri="input_uri_value", output_uri="output_uri_value", location_id="location_id_value", ) + assert args[0] == request_msg def test_annotate_video_use_cached_wrapped_rpc(): @@ -1537,10 +1554,14 @@ async def test_annotate_video_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_annotate_video_async( - transport: str = "grpc_asyncio", - request_type=video_intelligence.AnnotateVideoRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + video_intelligence.AnnotateVideoRequest(), + {}, + ], +) +async def test_annotate_video_async(request_type, transport: str = "grpc_asyncio"): client = VideoIntelligenceServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1548,7 +1569,7 @@ async def test_annotate_video_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.annotate_video), "__call__") as call: @@ -1568,11 +1589,6 @@ async def test_annotate_video_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_annotate_video_async_from_dict(): - await test_annotate_video_async(request_type=dict) - - def test_annotate_video_flattened(): client = VideoIntelligenceServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1961,7 +1977,6 @@ def test_annotate_video_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_intelligence.AnnotateVideoRequest() - assert args[0] == request_msg @@ -2000,7 +2015,6 @@ async def test_annotate_video_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_intelligence.AnnotateVideoRequest() - assert args[0] == request_msg @@ -2160,7 +2174,6 @@ def test_annotate_video_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_intelligence.AnnotateVideoRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-videointelligence/tests/unit/gapic/videointelligence_v1p2beta1/test_video_intelligence_service.py b/packages/google-cloud-videointelligence/tests/unit/gapic/videointelligence_v1p2beta1/test_video_intelligence_service.py index 4e2741008da2..bb16f4646ec2 100644 --- a/packages/google-cloud-videointelligence/tests/unit/gapic/videointelligence_v1p2beta1/test_video_intelligence_service.py +++ b/packages/google-cloud-videointelligence/tests/unit/gapic/videointelligence_v1p2beta1/test_video_intelligence_service.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" @@ -1387,8 +1403,8 @@ def test_video_intelligence_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - video_intelligence.AnnotateVideoRequest, - dict, + video_intelligence.AnnotateVideoRequest(), + {}, ], ) def test_annotate_video(request_type, transport: str = "grpc"): @@ -1399,7 +1415,7 @@ def test_annotate_video(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.annotate_video), "__call__") as call: @@ -1442,11 +1458,12 @@ def test_annotate_video_non_empty_request_with_auto_populated_field(): client.annotate_video(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == video_intelligence.AnnotateVideoRequest( + request_msg = video_intelligence.AnnotateVideoRequest( input_uri="input_uri_value", output_uri="output_uri_value", location_id="location_id_value", ) + assert args[0] == request_msg def test_annotate_video_use_cached_wrapped_rpc(): @@ -1537,10 +1554,14 @@ async def test_annotate_video_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_annotate_video_async( - transport: str = "grpc_asyncio", - request_type=video_intelligence.AnnotateVideoRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + video_intelligence.AnnotateVideoRequest(), + {}, + ], +) +async def test_annotate_video_async(request_type, transport: str = "grpc_asyncio"): client = VideoIntelligenceServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1548,7 +1569,7 @@ async def test_annotate_video_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.annotate_video), "__call__") as call: @@ -1568,11 +1589,6 @@ async def test_annotate_video_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_annotate_video_async_from_dict(): - await test_annotate_video_async(request_type=dict) - - def test_annotate_video_flattened(): client = VideoIntelligenceServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1961,7 +1977,6 @@ def test_annotate_video_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_intelligence.AnnotateVideoRequest() - assert args[0] == request_msg @@ -2000,7 +2015,6 @@ async def test_annotate_video_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_intelligence.AnnotateVideoRequest() - assert args[0] == request_msg @@ -2160,7 +2174,6 @@ def test_annotate_video_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_intelligence.AnnotateVideoRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-videointelligence/tests/unit/gapic/videointelligence_v1p3beta1/test_streaming_video_intelligence_service.py b/packages/google-cloud-videointelligence/tests/unit/gapic/videointelligence_v1p3beta1/test_streaming_video_intelligence_service.py index 1e6c550b1f6f..70316cb28e2d 100644 --- a/packages/google-cloud-videointelligence/tests/unit/gapic/videointelligence_v1p3beta1/test_streaming_video_intelligence_service.py +++ b/packages/google-cloud-videointelligence/tests/unit/gapic/videointelligence_v1p3beta1/test_streaming_video_intelligence_service.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 @@ -104,6 +105,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" @@ -1403,8 +1419,8 @@ def test_streaming_video_intelligence_service_client_create_channel_credentials_ @pytest.mark.parametrize( "request_type", [ - video_intelligence.StreamingAnnotateVideoRequest, - dict, + video_intelligence.StreamingAnnotateVideoRequest(), + {}, ], ) def test_streaming_annotate_video(request_type, transport: str = "grpc"): @@ -1415,7 +1431,7 @@ def test_streaming_annotate_video(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as 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. @@ -1519,9 +1535,15 @@ async def test_streaming_annotate_video_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + video_intelligence.StreamingAnnotateVideoRequest(), + {}, + ], +) async def test_streaming_annotate_video_async( - transport: str = "grpc_asyncio", - request_type=video_intelligence.StreamingAnnotateVideoRequest, + request_type, transport: str = "grpc_asyncio" ): client = StreamingVideoIntelligenceServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1530,7 +1552,7 @@ async def test_streaming_annotate_video_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. @@ -1554,11 +1576,6 @@ async def test_streaming_annotate_video_async( assert isinstance(message, video_intelligence.StreamingAnnotateVideoResponse) -@pytest.mark.asyncio -async def test_streaming_annotate_video_async_from_dict(): - await test_streaming_annotate_video_async(request_type=dict) - - def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.StreamingVideoIntelligenceServiceGrpcTransport( diff --git a/packages/google-cloud-videointelligence/tests/unit/gapic/videointelligence_v1p3beta1/test_video_intelligence_service.py b/packages/google-cloud-videointelligence/tests/unit/gapic/videointelligence_v1p3beta1/test_video_intelligence_service.py index 6eb78bbfc6b8..25cc118565bf 100644 --- a/packages/google-cloud-videointelligence/tests/unit/gapic/videointelligence_v1p3beta1/test_video_intelligence_service.py +++ b/packages/google-cloud-videointelligence/tests/unit/gapic/videointelligence_v1p3beta1/test_video_intelligence_service.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 @@ -109,6 +110,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" @@ -1344,8 +1360,8 @@ def test_video_intelligence_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - video_intelligence.AnnotateVideoRequest, - dict, + video_intelligence.AnnotateVideoRequest(), + {}, ], ) def test_annotate_video(request_type, transport: str = "grpc"): @@ -1356,7 +1372,7 @@ def test_annotate_video(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.annotate_video), "__call__") as call: @@ -1399,11 +1415,12 @@ def test_annotate_video_non_empty_request_with_auto_populated_field(): client.annotate_video(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == video_intelligence.AnnotateVideoRequest( + request_msg = video_intelligence.AnnotateVideoRequest( input_uri="input_uri_value", output_uri="output_uri_value", location_id="location_id_value", ) + assert args[0] == request_msg def test_annotate_video_use_cached_wrapped_rpc(): @@ -1494,10 +1511,14 @@ async def test_annotate_video_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_annotate_video_async( - transport: str = "grpc_asyncio", - request_type=video_intelligence.AnnotateVideoRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + video_intelligence.AnnotateVideoRequest(), + {}, + ], +) +async def test_annotate_video_async(request_type, transport: str = "grpc_asyncio"): client = VideoIntelligenceServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1505,7 +1526,7 @@ async def test_annotate_video_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.annotate_video), "__call__") as call: @@ -1525,11 +1546,6 @@ async def test_annotate_video_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_annotate_video_async_from_dict(): - await test_annotate_video_async(request_type=dict) - - def test_annotate_video_flattened(): client = VideoIntelligenceServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1744,7 +1760,6 @@ def test_annotate_video_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_intelligence.AnnotateVideoRequest() - assert args[0] == request_msg @@ -1783,7 +1798,6 @@ async def test_annotate_video_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = video_intelligence.AnnotateVideoRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-vision/noxfile.py b/packages/google-cloud-vision/noxfile.py index f8ed352890ec..a8c68f537b0c 100644 --- a/packages/google-cloud-vision/noxfile.py +++ b/packages/google-cloud-vision/noxfile.py @@ -47,7 +47,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-vision" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -468,14 +473,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -587,14 +584,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-vision/setup.py b/packages/google-cloud-vision/setup.py index 686939ed475d..c3b44abecd05 100644 --- a/packages/google-cloud-vision/setup.py +++ b/packages/google-cloud-vision/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/google-cloud-vision/testing/constraints-3.10.txt b/packages/google-cloud-vision/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-vision/testing/constraints-3.10.txt +++ b/packages/google-cloud-vision/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-vision/tests/unit/gapic/vision_v1/test_image_annotator.py b/packages/google-cloud-vision/tests/unit/gapic/vision_v1/test_image_annotator.py index bfdf3ea605af..397bcf207bfb 100644 --- a/packages/google-cloud-vision/tests/unit/gapic/vision_v1/test_image_annotator.py +++ b/packages/google-cloud-vision/tests/unit/gapic/vision_v1/test_image_annotator.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" @@ -1318,8 +1334,8 @@ def test_image_annotator_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - image_annotator.BatchAnnotateImagesRequest, - dict, + image_annotator.BatchAnnotateImagesRequest(), + {}, ], ) def test_batch_annotate_images(request_type, transport: str = "grpc"): @@ -1330,7 +1346,7 @@ def test_batch_annotate_images(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1375,9 +1391,10 @@ def test_batch_annotate_images_non_empty_request_with_auto_populated_field(): client.batch_annotate_images(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == image_annotator.BatchAnnotateImagesRequest( + request_msg = image_annotator.BatchAnnotateImagesRequest( parent="parent_value", ) + assert args[0] == request_msg def test_batch_annotate_images_use_cached_wrapped_rpc(): @@ -1463,9 +1480,15 @@ async def test_batch_annotate_images_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + image_annotator.BatchAnnotateImagesRequest(), + {}, + ], +) async def test_batch_annotate_images_async( - transport: str = "grpc_asyncio", - request_type=image_annotator.BatchAnnotateImagesRequest, + request_type, transport: str = "grpc_asyncio" ): client = ImageAnnotatorAsyncClient( credentials=async_anonymous_credentials(), @@ -1474,7 +1497,7 @@ async def test_batch_annotate_images_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( @@ -1496,11 +1519,6 @@ async def test_batch_annotate_images_async( assert isinstance(response, image_annotator.BatchAnnotateImagesResponse) -@pytest.mark.asyncio -async def test_batch_annotate_images_async_from_dict(): - await test_batch_annotate_images_async(request_type=dict) - - def test_batch_annotate_images_flattened(): client = ImageAnnotatorClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1614,8 +1632,8 @@ async def test_batch_annotate_images_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - image_annotator.BatchAnnotateFilesRequest, - dict, + image_annotator.BatchAnnotateFilesRequest(), + {}, ], ) def test_batch_annotate_files(request_type, transport: str = "grpc"): @@ -1626,7 +1644,7 @@ def test_batch_annotate_files(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1671,9 +1689,10 @@ def test_batch_annotate_files_non_empty_request_with_auto_populated_field(): client.batch_annotate_files(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == image_annotator.BatchAnnotateFilesRequest( + request_msg = image_annotator.BatchAnnotateFilesRequest( parent="parent_value", ) + assert args[0] == request_msg def test_batch_annotate_files_use_cached_wrapped_rpc(): @@ -1758,9 +1777,15 @@ async def test_batch_annotate_files_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + image_annotator.BatchAnnotateFilesRequest(), + {}, + ], +) async def test_batch_annotate_files_async( - transport: str = "grpc_asyncio", - request_type=image_annotator.BatchAnnotateFilesRequest, + request_type, transport: str = "grpc_asyncio" ): client = ImageAnnotatorAsyncClient( credentials=async_anonymous_credentials(), @@ -1769,7 +1794,7 @@ async def test_batch_annotate_files_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( @@ -1791,11 +1816,6 @@ async def test_batch_annotate_files_async( assert isinstance(response, image_annotator.BatchAnnotateFilesResponse) -@pytest.mark.asyncio -async def test_batch_annotate_files_async_from_dict(): - await test_batch_annotate_files_async(request_type=dict) - - def test_batch_annotate_files_flattened(): client = ImageAnnotatorClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1921,8 +1941,8 @@ async def test_batch_annotate_files_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - image_annotator.AsyncBatchAnnotateImagesRequest, - dict, + image_annotator.AsyncBatchAnnotateImagesRequest(), + {}, ], ) def test_async_batch_annotate_images(request_type, transport: str = "grpc"): @@ -1933,7 +1953,7 @@ def test_async_batch_annotate_images(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1978,9 +1998,10 @@ def test_async_batch_annotate_images_non_empty_request_with_auto_populated_field client.async_batch_annotate_images(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == image_annotator.AsyncBatchAnnotateImagesRequest( + request_msg = image_annotator.AsyncBatchAnnotateImagesRequest( parent="parent_value", ) + assert args[0] == request_msg def test_async_batch_annotate_images_use_cached_wrapped_rpc(): @@ -2076,9 +2097,15 @@ async def test_async_batch_annotate_images_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + image_annotator.AsyncBatchAnnotateImagesRequest(), + {}, + ], +) async def test_async_batch_annotate_images_async( - transport: str = "grpc_asyncio", - request_type=image_annotator.AsyncBatchAnnotateImagesRequest, + request_type, transport: str = "grpc_asyncio" ): client = ImageAnnotatorAsyncClient( credentials=async_anonymous_credentials(), @@ -2087,7 +2114,7 @@ async def test_async_batch_annotate_images_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( @@ -2109,11 +2136,6 @@ async def test_async_batch_annotate_images_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_async_batch_annotate_images_async_from_dict(): - await test_async_batch_annotate_images_async(request_type=dict) - - def test_async_batch_annotate_images_flattened(): client = ImageAnnotatorClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2249,8 +2271,8 @@ async def test_async_batch_annotate_images_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - image_annotator.AsyncBatchAnnotateFilesRequest, - dict, + image_annotator.AsyncBatchAnnotateFilesRequest(), + {}, ], ) def test_async_batch_annotate_files(request_type, transport: str = "grpc"): @@ -2261,7 +2283,7 @@ def test_async_batch_annotate_files(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2306,9 +2328,10 @@ def test_async_batch_annotate_files_non_empty_request_with_auto_populated_field( client.async_batch_annotate_files(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == image_annotator.AsyncBatchAnnotateFilesRequest( + request_msg = image_annotator.AsyncBatchAnnotateFilesRequest( parent="parent_value", ) + assert args[0] == request_msg def test_async_batch_annotate_files_use_cached_wrapped_rpc(): @@ -2404,9 +2427,15 @@ async def test_async_batch_annotate_files_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + image_annotator.AsyncBatchAnnotateFilesRequest(), + {}, + ], +) async def test_async_batch_annotate_files_async( - transport: str = "grpc_asyncio", - request_type=image_annotator.AsyncBatchAnnotateFilesRequest, + request_type, transport: str = "grpc_asyncio" ): client = ImageAnnotatorAsyncClient( credentials=async_anonymous_credentials(), @@ -2415,7 +2444,7 @@ async def test_async_batch_annotate_files_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( @@ -2437,11 +2466,6 @@ async def test_async_batch_annotate_files_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_async_batch_annotate_files_async_from_dict(): - await test_async_batch_annotate_files_async(request_type=dict) - - def test_async_batch_annotate_files_flattened(): client = ImageAnnotatorClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3448,7 +3472,6 @@ def test_batch_annotate_images_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = image_annotator.BatchAnnotateImagesRequest() - assert args[0] == request_msg @@ -3471,7 +3494,6 @@ def test_batch_annotate_files_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = image_annotator.BatchAnnotateFilesRequest() - assert args[0] == request_msg @@ -3494,7 +3516,6 @@ def test_async_batch_annotate_images_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = image_annotator.AsyncBatchAnnotateImagesRequest() - assert args[0] == request_msg @@ -3517,7 +3538,6 @@ def test_async_batch_annotate_files_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = image_annotator.AsyncBatchAnnotateFilesRequest() - assert args[0] == request_msg @@ -3558,7 +3578,6 @@ async def test_batch_annotate_images_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = image_annotator.BatchAnnotateImagesRequest() - assert args[0] == request_msg @@ -3585,7 +3604,6 @@ async def test_batch_annotate_files_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = image_annotator.BatchAnnotateFilesRequest() - assert args[0] == request_msg @@ -3612,7 +3630,6 @@ async def test_async_batch_annotate_images_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = image_annotator.AsyncBatchAnnotateImagesRequest() - assert args[0] == request_msg @@ -3639,7 +3656,6 @@ async def test_async_batch_annotate_files_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = image_annotator.AsyncBatchAnnotateFilesRequest() - assert args[0] == request_msg @@ -4256,7 +4272,6 @@ def test_batch_annotate_images_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = image_annotator.BatchAnnotateImagesRequest() - assert args[0] == request_msg @@ -4278,7 +4293,6 @@ def test_batch_annotate_files_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = image_annotator.BatchAnnotateFilesRequest() - assert args[0] == request_msg @@ -4300,7 +4314,6 @@ def test_async_batch_annotate_images_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = image_annotator.AsyncBatchAnnotateImagesRequest() - assert args[0] == request_msg @@ -4322,7 +4335,6 @@ def test_async_batch_annotate_files_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = image_annotator.AsyncBatchAnnotateFilesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-vision/tests/unit/gapic/vision_v1/test_product_search.py b/packages/google-cloud-vision/tests/unit/gapic/vision_v1/test_product_search.py index 91bcbffc635e..c788af937585 100644 --- a/packages/google-cloud-vision/tests/unit/gapic/vision_v1/test_product_search.py +++ b/packages/google-cloud-vision/tests/unit/gapic/vision_v1/test_product_search.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 @@ -117,6 +118,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" @@ -1319,8 +1335,8 @@ def test_product_search_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - product_search_service.CreateProductSetRequest, - dict, + product_search_service.CreateProductSetRequest(), + {}, ], ) def test_create_product_set(request_type, transport: str = "grpc"): @@ -1331,7 +1347,7 @@ def test_create_product_set(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1382,10 +1398,11 @@ def test_create_product_set_non_empty_request_with_auto_populated_field(): client.create_product_set(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_search_service.CreateProductSetRequest( + request_msg = product_search_service.CreateProductSetRequest( parent="parent_value", product_set_id="product_set_id_value", ) + assert args[0] == request_msg def test_create_product_set_use_cached_wrapped_rpc(): @@ -1470,10 +1487,14 @@ async def test_create_product_set_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_product_set_async( - transport: str = "grpc_asyncio", - request_type=product_search_service.CreateProductSetRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + product_search_service.CreateProductSetRequest(), + {}, + ], +) +async def test_create_product_set_async(request_type, transport: str = "grpc_asyncio"): client = ProductSearchAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1481,7 +1502,7 @@ async def test_create_product_set_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( @@ -1508,11 +1529,6 @@ async def test_create_product_set_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_create_product_set_async_from_dict(): - await test_create_product_set_async(request_type=dict) - - def test_create_product_set_field_headers(): client = ProductSearchClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1687,8 +1703,8 @@ async def test_create_product_set_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - product_search_service.ListProductSetsRequest, - dict, + product_search_service.ListProductSetsRequest(), + {}, ], ) def test_list_product_sets(request_type, transport: str = "grpc"): @@ -1699,7 +1715,7 @@ def test_list_product_sets(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1748,10 +1764,11 @@ def test_list_product_sets_non_empty_request_with_auto_populated_field(): client.list_product_sets(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_search_service.ListProductSetsRequest( + request_msg = product_search_service.ListProductSetsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_product_sets_use_cached_wrapped_rpc(): @@ -1834,10 +1851,14 @@ async def test_list_product_sets_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_product_sets_async( - transport: str = "grpc_asyncio", - request_type=product_search_service.ListProductSetsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + product_search_service.ListProductSetsRequest(), + {}, + ], +) +async def test_list_product_sets_async(request_type, transport: str = "grpc_asyncio"): client = ProductSearchAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1845,7 +1866,7 @@ async def test_list_product_sets_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( @@ -1870,11 +1891,6 @@ async def test_list_product_sets_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_product_sets_async_from_dict(): - await test_list_product_sets_async(request_type=dict) - - def test_list_product_sets_field_headers(): client = ProductSearchClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2227,8 +2243,8 @@ async def test_list_product_sets_async_pages(): @pytest.mark.parametrize( "request_type", [ - product_search_service.GetProductSetRequest, - dict, + product_search_service.GetProductSetRequest(), + {}, ], ) def test_get_product_set(request_type, transport: str = "grpc"): @@ -2239,7 +2255,7 @@ def test_get_product_set(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_product_set), "__call__") as call: @@ -2285,9 +2301,10 @@ def test_get_product_set_non_empty_request_with_auto_populated_field(): client.get_product_set(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_search_service.GetProductSetRequest( + request_msg = product_search_service.GetProductSetRequest( name="name_value", ) + assert args[0] == request_msg def test_get_product_set_use_cached_wrapped_rpc(): @@ -2368,10 +2385,14 @@ async def test_get_product_set_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_product_set_async( - transport: str = "grpc_asyncio", - request_type=product_search_service.GetProductSetRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + product_search_service.GetProductSetRequest(), + {}, + ], +) +async def test_get_product_set_async(request_type, transport: str = "grpc_asyncio"): client = ProductSearchAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2379,7 +2400,7 @@ async def test_get_product_set_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_product_set), "__call__") as call: @@ -2404,11 +2425,6 @@ async def test_get_product_set_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_get_product_set_async_from_dict(): - await test_get_product_set_async(request_type=dict) - - def test_get_product_set_field_headers(): client = ProductSearchClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2555,8 +2571,8 @@ async def test_get_product_set_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - product_search_service.UpdateProductSetRequest, - dict, + product_search_service.UpdateProductSetRequest(), + {}, ], ) def test_update_product_set(request_type, transport: str = "grpc"): @@ -2567,7 +2583,7 @@ def test_update_product_set(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2615,7 +2631,8 @@ def test_update_product_set_non_empty_request_with_auto_populated_field(): client.update_product_set(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_search_service.UpdateProductSetRequest() + request_msg = product_search_service.UpdateProductSetRequest() + assert args[0] == request_msg def test_update_product_set_use_cached_wrapped_rpc(): @@ -2700,10 +2717,14 @@ async def test_update_product_set_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_product_set_async( - transport: str = "grpc_asyncio", - request_type=product_search_service.UpdateProductSetRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + product_search_service.UpdateProductSetRequest(), + {}, + ], +) +async def test_update_product_set_async(request_type, transport: str = "grpc_asyncio"): client = ProductSearchAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2711,7 +2732,7 @@ async def test_update_product_set_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( @@ -2738,11 +2759,6 @@ async def test_update_product_set_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_update_product_set_async_from_dict(): - await test_update_product_set_async(request_type=dict) - - def test_update_product_set_field_headers(): client = ProductSearchClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2907,8 +2923,8 @@ async def test_update_product_set_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - product_search_service.DeleteProductSetRequest, - dict, + product_search_service.DeleteProductSetRequest(), + {}, ], ) def test_delete_product_set(request_type, transport: str = "grpc"): @@ -2919,7 +2935,7 @@ def test_delete_product_set(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2964,9 +2980,10 @@ def test_delete_product_set_non_empty_request_with_auto_populated_field(): client.delete_product_set(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_search_service.DeleteProductSetRequest( + request_msg = product_search_service.DeleteProductSetRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_product_set_use_cached_wrapped_rpc(): @@ -3051,10 +3068,14 @@ async def test_delete_product_set_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_product_set_async( - transport: str = "grpc_asyncio", - request_type=product_search_service.DeleteProductSetRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + product_search_service.DeleteProductSetRequest(), + {}, + ], +) +async def test_delete_product_set_async(request_type, transport: str = "grpc_asyncio"): client = ProductSearchAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3062,7 +3083,7 @@ async def test_delete_product_set_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( @@ -3082,11 +3103,6 @@ async def test_delete_product_set_async( assert response is None -@pytest.mark.asyncio -async def test_delete_product_set_async_from_dict(): - await test_delete_product_set_async(request_type=dict) - - def test_delete_product_set_field_headers(): client = ProductSearchClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3237,8 +3253,8 @@ async def test_delete_product_set_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - product_search_service.CreateProductRequest, - dict, + product_search_service.CreateProductRequest(), + {}, ], ) def test_create_product(request_type, transport: str = "grpc"): @@ -3249,7 +3265,7 @@ def test_create_product(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_product), "__call__") as call: @@ -3300,10 +3316,11 @@ def test_create_product_non_empty_request_with_auto_populated_field(): client.create_product(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_search_service.CreateProductRequest( + request_msg = product_search_service.CreateProductRequest( parent="parent_value", product_id="product_id_value", ) + assert args[0] == request_msg def test_create_product_use_cached_wrapped_rpc(): @@ -3384,10 +3401,14 @@ async def test_create_product_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_product_async( - transport: str = "grpc_asyncio", - request_type=product_search_service.CreateProductRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + product_search_service.CreateProductRequest(), + {}, + ], +) +async def test_create_product_async(request_type, transport: str = "grpc_asyncio"): client = ProductSearchAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3395,7 +3416,7 @@ async def test_create_product_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_product), "__call__") as call: @@ -3424,11 +3445,6 @@ async def test_create_product_async( assert response.product_category == "product_category_value" -@pytest.mark.asyncio -async def test_create_product_async_from_dict(): - await test_create_product_async(request_type=dict) - - def test_create_product_field_headers(): client = ProductSearchClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3595,8 +3611,8 @@ async def test_create_product_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - product_search_service.ListProductsRequest, - dict, + product_search_service.ListProductsRequest(), + {}, ], ) def test_list_products(request_type, transport: str = "grpc"): @@ -3607,7 +3623,7 @@ def test_list_products(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_products), "__call__") as call: @@ -3652,10 +3668,11 @@ def test_list_products_non_empty_request_with_auto_populated_field(): client.list_products(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_search_service.ListProductsRequest( + request_msg = product_search_service.ListProductsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_products_use_cached_wrapped_rpc(): @@ -3736,10 +3753,14 @@ async def test_list_products_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_products_async( - transport: str = "grpc_asyncio", - request_type=product_search_service.ListProductsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + product_search_service.ListProductsRequest(), + {}, + ], +) +async def test_list_products_async(request_type, transport: str = "grpc_asyncio"): client = ProductSearchAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3747,7 +3768,7 @@ async def test_list_products_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_products), "__call__") as call: @@ -3770,11 +3791,6 @@ async def test_list_products_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_products_async_from_dict(): - await test_list_products_async(request_type=dict) - - def test_list_products_field_headers(): client = ProductSearchClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4111,8 +4127,8 @@ async def test_list_products_async_pages(): @pytest.mark.parametrize( "request_type", [ - product_search_service.GetProductRequest, - dict, + product_search_service.GetProductRequest(), + {}, ], ) def test_get_product(request_type, transport: str = "grpc"): @@ -4123,7 +4139,7 @@ def test_get_product(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_product), "__call__") as call: @@ -4173,9 +4189,10 @@ def test_get_product_non_empty_request_with_auto_populated_field(): client.get_product(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_search_service.GetProductRequest( + request_msg = product_search_service.GetProductRequest( name="name_value", ) + assert args[0] == request_msg def test_get_product_use_cached_wrapped_rpc(): @@ -4256,10 +4273,14 @@ async def test_get_product_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_product_async( - transport: str = "grpc_asyncio", - request_type=product_search_service.GetProductRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + product_search_service.GetProductRequest(), + {}, + ], +) +async def test_get_product_async(request_type, transport: str = "grpc_asyncio"): client = ProductSearchAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4267,7 +4288,7 @@ async def test_get_product_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_product), "__call__") as call: @@ -4296,11 +4317,6 @@ async def test_get_product_async( assert response.product_category == "product_category_value" -@pytest.mark.asyncio -async def test_get_product_async_from_dict(): - await test_get_product_async(request_type=dict) - - def test_get_product_field_headers(): client = ProductSearchClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4447,8 +4463,8 @@ async def test_get_product_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - product_search_service.UpdateProductRequest, - dict, + product_search_service.UpdateProductRequest(), + {}, ], ) def test_update_product(request_type, transport: str = "grpc"): @@ -4459,7 +4475,7 @@ def test_update_product(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_product), "__call__") as call: @@ -4507,7 +4523,8 @@ def test_update_product_non_empty_request_with_auto_populated_field(): client.update_product(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_search_service.UpdateProductRequest() + request_msg = product_search_service.UpdateProductRequest() + assert args[0] == request_msg def test_update_product_use_cached_wrapped_rpc(): @@ -4588,10 +4605,14 @@ async def test_update_product_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_product_async( - transport: str = "grpc_asyncio", - request_type=product_search_service.UpdateProductRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + product_search_service.UpdateProductRequest(), + {}, + ], +) +async def test_update_product_async(request_type, transport: str = "grpc_asyncio"): client = ProductSearchAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4599,7 +4620,7 @@ async def test_update_product_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_product), "__call__") as call: @@ -4628,11 +4649,6 @@ async def test_update_product_async( assert response.product_category == "product_category_value" -@pytest.mark.asyncio -async def test_update_product_async_from_dict(): - await test_update_product_async(request_type=dict) - - def test_update_product_field_headers(): client = ProductSearchClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4789,8 +4805,8 @@ async def test_update_product_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - product_search_service.DeleteProductRequest, - dict, + product_search_service.DeleteProductRequest(), + {}, ], ) def test_delete_product(request_type, transport: str = "grpc"): @@ -4801,7 +4817,7 @@ def test_delete_product(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_product), "__call__") as call: @@ -4842,9 +4858,10 @@ def test_delete_product_non_empty_request_with_auto_populated_field(): client.delete_product(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_search_service.DeleteProductRequest( + request_msg = product_search_service.DeleteProductRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_product_use_cached_wrapped_rpc(): @@ -4925,10 +4942,14 @@ async def test_delete_product_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_product_async( - transport: str = "grpc_asyncio", - request_type=product_search_service.DeleteProductRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + product_search_service.DeleteProductRequest(), + {}, + ], +) +async def test_delete_product_async(request_type, transport: str = "grpc_asyncio"): client = ProductSearchAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4936,7 +4957,7 @@ async def test_delete_product_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_product), "__call__") as call: @@ -4954,11 +4975,6 @@ async def test_delete_product_async( assert response is None -@pytest.mark.asyncio -async def test_delete_product_async_from_dict(): - await test_delete_product_async(request_type=dict) - - def test_delete_product_field_headers(): client = ProductSearchClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5101,8 +5117,8 @@ async def test_delete_product_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - product_search_service.CreateReferenceImageRequest, - dict, + product_search_service.CreateReferenceImageRequest(), + {}, ], ) def test_create_reference_image(request_type, transport: str = "grpc"): @@ -5113,7 +5129,7 @@ def test_create_reference_image(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5164,10 +5180,11 @@ def test_create_reference_image_non_empty_request_with_auto_populated_field(): client.create_reference_image(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_search_service.CreateReferenceImageRequest( + request_msg = product_search_service.CreateReferenceImageRequest( parent="parent_value", reference_image_id="reference_image_id_value", ) + assert args[0] == request_msg def test_create_reference_image_use_cached_wrapped_rpc(): @@ -5253,9 +5270,15 @@ async def test_create_reference_image_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + product_search_service.CreateReferenceImageRequest(), + {}, + ], +) async def test_create_reference_image_async( - transport: str = "grpc_asyncio", - request_type=product_search_service.CreateReferenceImageRequest, + request_type, transport: str = "grpc_asyncio" ): client = ProductSearchAsyncClient( credentials=async_anonymous_credentials(), @@ -5264,7 +5287,7 @@ async def test_create_reference_image_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( @@ -5291,11 +5314,6 @@ async def test_create_reference_image_async( assert response.uri == "uri_value" -@pytest.mark.asyncio -async def test_create_reference_image_async_from_dict(): - await test_create_reference_image_async(request_type=dict) - - def test_create_reference_image_field_headers(): client = ProductSearchClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5470,8 +5488,8 @@ async def test_create_reference_image_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - product_search_service.DeleteReferenceImageRequest, - dict, + product_search_service.DeleteReferenceImageRequest(), + {}, ], ) def test_delete_reference_image(request_type, transport: str = "grpc"): @@ -5482,7 +5500,7 @@ def test_delete_reference_image(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5527,9 +5545,10 @@ def test_delete_reference_image_non_empty_request_with_auto_populated_field(): client.delete_reference_image(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_search_service.DeleteReferenceImageRequest( + request_msg = product_search_service.DeleteReferenceImageRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_reference_image_use_cached_wrapped_rpc(): @@ -5615,9 +5634,15 @@ async def test_delete_reference_image_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + product_search_service.DeleteReferenceImageRequest(), + {}, + ], +) async def test_delete_reference_image_async( - transport: str = "grpc_asyncio", - request_type=product_search_service.DeleteReferenceImageRequest, + request_type, transport: str = "grpc_asyncio" ): client = ProductSearchAsyncClient( credentials=async_anonymous_credentials(), @@ -5626,7 +5651,7 @@ async def test_delete_reference_image_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( @@ -5646,11 +5671,6 @@ async def test_delete_reference_image_async( assert response is None -@pytest.mark.asyncio -async def test_delete_reference_image_async_from_dict(): - await test_delete_reference_image_async(request_type=dict) - - def test_delete_reference_image_field_headers(): client = ProductSearchClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5801,8 +5821,8 @@ async def test_delete_reference_image_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - product_search_service.ListReferenceImagesRequest, - dict, + product_search_service.ListReferenceImagesRequest(), + {}, ], ) def test_list_reference_images(request_type, transport: str = "grpc"): @@ -5813,7 +5833,7 @@ def test_list_reference_images(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5864,10 +5884,11 @@ def test_list_reference_images_non_empty_request_with_auto_populated_field(): client.list_reference_images(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_search_service.ListReferenceImagesRequest( + request_msg = product_search_service.ListReferenceImagesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_reference_images_use_cached_wrapped_rpc(): @@ -5953,9 +5974,15 @@ async def test_list_reference_images_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + product_search_service.ListReferenceImagesRequest(), + {}, + ], +) async def test_list_reference_images_async( - transport: str = "grpc_asyncio", - request_type=product_search_service.ListReferenceImagesRequest, + request_type, transport: str = "grpc_asyncio" ): client = ProductSearchAsyncClient( credentials=async_anonymous_credentials(), @@ -5964,7 +5991,7 @@ async def test_list_reference_images_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( @@ -5991,11 +6018,6 @@ async def test_list_reference_images_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_reference_images_async_from_dict(): - await test_list_reference_images_async(request_type=dict) - - def test_list_reference_images_field_headers(): client = ProductSearchClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6352,8 +6374,8 @@ async def test_list_reference_images_async_pages(): @pytest.mark.parametrize( "request_type", [ - product_search_service.GetReferenceImageRequest, - dict, + product_search_service.GetReferenceImageRequest(), + {}, ], ) def test_get_reference_image(request_type, transport: str = "grpc"): @@ -6364,7 +6386,7 @@ def test_get_reference_image(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6414,9 +6436,10 @@ def test_get_reference_image_non_empty_request_with_auto_populated_field(): client.get_reference_image(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_search_service.GetReferenceImageRequest( + request_msg = product_search_service.GetReferenceImageRequest( name="name_value", ) + assert args[0] == request_msg def test_get_reference_image_use_cached_wrapped_rpc(): @@ -6501,10 +6524,14 @@ async def test_get_reference_image_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_reference_image_async( - transport: str = "grpc_asyncio", - request_type=product_search_service.GetReferenceImageRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + product_search_service.GetReferenceImageRequest(), + {}, + ], +) +async def test_get_reference_image_async(request_type, transport: str = "grpc_asyncio"): client = ProductSearchAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6512,7 +6539,7 @@ async def test_get_reference_image_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( @@ -6539,11 +6566,6 @@ async def test_get_reference_image_async( assert response.uri == "uri_value" -@pytest.mark.asyncio -async def test_get_reference_image_async_from_dict(): - await test_get_reference_image_async(request_type=dict) - - def test_get_reference_image_field_headers(): client = ProductSearchClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6698,8 +6720,8 @@ async def test_get_reference_image_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - product_search_service.AddProductToProductSetRequest, - dict, + product_search_service.AddProductToProductSetRequest(), + {}, ], ) def test_add_product_to_product_set(request_type, transport: str = "grpc"): @@ -6710,7 +6732,7 @@ def test_add_product_to_product_set(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6756,10 +6778,11 @@ def test_add_product_to_product_set_non_empty_request_with_auto_populated_field( client.add_product_to_product_set(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_search_service.AddProductToProductSetRequest( + request_msg = product_search_service.AddProductToProductSetRequest( name="name_value", product="product_value", ) + assert args[0] == request_msg def test_add_product_to_product_set_use_cached_wrapped_rpc(): @@ -6845,9 +6868,15 @@ async def test_add_product_to_product_set_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + product_search_service.AddProductToProductSetRequest(), + {}, + ], +) async def test_add_product_to_product_set_async( - transport: str = "grpc_asyncio", - request_type=product_search_service.AddProductToProductSetRequest, + request_type, transport: str = "grpc_asyncio" ): client = ProductSearchAsyncClient( credentials=async_anonymous_credentials(), @@ -6856,7 +6885,7 @@ async def test_add_product_to_product_set_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( @@ -6876,11 +6905,6 @@ async def test_add_product_to_product_set_async( assert response is None -@pytest.mark.asyncio -async def test_add_product_to_product_set_async_from_dict(): - await test_add_product_to_product_set_async(request_type=dict) - - def test_add_product_to_product_set_field_headers(): client = ProductSearchClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7041,8 +7065,8 @@ async def test_add_product_to_product_set_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - product_search_service.RemoveProductFromProductSetRequest, - dict, + product_search_service.RemoveProductFromProductSetRequest(), + {}, ], ) def test_remove_product_from_product_set(request_type, transport: str = "grpc"): @@ -7053,7 +7077,7 @@ def test_remove_product_from_product_set(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7099,10 +7123,11 @@ def test_remove_product_from_product_set_non_empty_request_with_auto_populated_f client.remove_product_from_product_set(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_search_service.RemoveProductFromProductSetRequest( + request_msg = product_search_service.RemoveProductFromProductSetRequest( name="name_value", product="product_value", ) + assert args[0] == request_msg def test_remove_product_from_product_set_use_cached_wrapped_rpc(): @@ -7188,9 +7213,15 @@ async def test_remove_product_from_product_set_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + product_search_service.RemoveProductFromProductSetRequest(), + {}, + ], +) async def test_remove_product_from_product_set_async( - transport: str = "grpc_asyncio", - request_type=product_search_service.RemoveProductFromProductSetRequest, + request_type, transport: str = "grpc_asyncio" ): client = ProductSearchAsyncClient( credentials=async_anonymous_credentials(), @@ -7199,7 +7230,7 @@ async def test_remove_product_from_product_set_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( @@ -7219,11 +7250,6 @@ async def test_remove_product_from_product_set_async( assert response is None -@pytest.mark.asyncio -async def test_remove_product_from_product_set_async_from_dict(): - await test_remove_product_from_product_set_async(request_type=dict) - - def test_remove_product_from_product_set_field_headers(): client = ProductSearchClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7384,8 +7410,8 @@ async def test_remove_product_from_product_set_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - product_search_service.ListProductsInProductSetRequest, - dict, + product_search_service.ListProductsInProductSetRequest(), + {}, ], ) def test_list_products_in_product_set(request_type, transport: str = "grpc"): @@ -7396,7 +7422,7 @@ def test_list_products_in_product_set(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7445,10 +7471,11 @@ def test_list_products_in_product_set_non_empty_request_with_auto_populated_fiel client.list_products_in_product_set(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_search_service.ListProductsInProductSetRequest( + request_msg = product_search_service.ListProductsInProductSetRequest( name="name_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_products_in_product_set_use_cached_wrapped_rpc(): @@ -7534,9 +7561,15 @@ async def test_list_products_in_product_set_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + product_search_service.ListProductsInProductSetRequest(), + {}, + ], +) async def test_list_products_in_product_set_async( - transport: str = "grpc_asyncio", - request_type=product_search_service.ListProductsInProductSetRequest, + request_type, transport: str = "grpc_asyncio" ): client = ProductSearchAsyncClient( credentials=async_anonymous_credentials(), @@ -7545,7 +7578,7 @@ async def test_list_products_in_product_set_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( @@ -7570,11 +7603,6 @@ async def test_list_products_in_product_set_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_products_in_product_set_async_from_dict(): - await test_list_products_in_product_set_async(request_type=dict) - - def test_list_products_in_product_set_field_headers(): client = ProductSearchClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7931,8 +7959,8 @@ async def test_list_products_in_product_set_async_pages(): @pytest.mark.parametrize( "request_type", [ - product_search_service.ImportProductSetsRequest, - dict, + product_search_service.ImportProductSetsRequest(), + {}, ], ) def test_import_product_sets(request_type, transport: str = "grpc"): @@ -7943,7 +7971,7 @@ def test_import_product_sets(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7988,9 +8016,10 @@ def test_import_product_sets_non_empty_request_with_auto_populated_field(): client.import_product_sets(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_search_service.ImportProductSetsRequest( + request_msg = product_search_service.ImportProductSetsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_import_product_sets_use_cached_wrapped_rpc(): @@ -8085,10 +8114,14 @@ async def test_import_product_sets_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_import_product_sets_async( - transport: str = "grpc_asyncio", - request_type=product_search_service.ImportProductSetsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + product_search_service.ImportProductSetsRequest(), + {}, + ], +) +async def test_import_product_sets_async(request_type, transport: str = "grpc_asyncio"): client = ProductSearchAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8096,7 +8129,7 @@ async def test_import_product_sets_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( @@ -8118,11 +8151,6 @@ async def test_import_product_sets_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_import_product_sets_async_from_dict(): - await test_import_product_sets_async(request_type=dict) - - def test_import_product_sets_field_headers(): client = ProductSearchClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8311,8 +8339,8 @@ async def test_import_product_sets_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - product_search_service.PurgeProductsRequest, - dict, + product_search_service.PurgeProductsRequest(), + {}, ], ) def test_purge_products(request_type, transport: str = "grpc"): @@ -8323,7 +8351,7 @@ def test_purge_products(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.purge_products), "__call__") as call: @@ -8364,9 +8392,10 @@ def test_purge_products_non_empty_request_with_auto_populated_field(): client.purge_products(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_search_service.PurgeProductsRequest( + request_msg = product_search_service.PurgeProductsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_purge_products_use_cached_wrapped_rpc(): @@ -8457,10 +8486,14 @@ async def test_purge_products_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_purge_products_async( - transport: str = "grpc_asyncio", - request_type=product_search_service.PurgeProductsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + product_search_service.PurgeProductsRequest(), + {}, + ], +) +async def test_purge_products_async(request_type, transport: str = "grpc_asyncio"): client = ProductSearchAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8468,7 +8501,7 @@ async def test_purge_products_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.purge_products), "__call__") as call: @@ -8488,11 +8521,6 @@ async def test_purge_products_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_purge_products_async_from_dict(): - await test_purge_products_async(request_type=dict) - - def test_purge_products_field_headers(): client = ProductSearchClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12615,7 +12643,6 @@ def test_create_product_set_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.CreateProductSetRequest() - assert args[0] == request_msg @@ -12638,7 +12665,6 @@ def test_list_product_sets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.ListProductSetsRequest() - assert args[0] == request_msg @@ -12659,7 +12685,6 @@ def test_get_product_set_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.GetProductSetRequest() - assert args[0] == request_msg @@ -12682,7 +12707,6 @@ def test_update_product_set_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.UpdateProductSetRequest() - assert args[0] == request_msg @@ -12705,7 +12729,6 @@ def test_delete_product_set_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.DeleteProductSetRequest() - assert args[0] == request_msg @@ -12726,7 +12749,6 @@ def test_create_product_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.CreateProductRequest() - assert args[0] == request_msg @@ -12747,7 +12769,6 @@ def test_list_products_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.ListProductsRequest() - assert args[0] == request_msg @@ -12768,7 +12789,6 @@ def test_get_product_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.GetProductRequest() - assert args[0] == request_msg @@ -12789,7 +12809,6 @@ def test_update_product_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.UpdateProductRequest() - assert args[0] == request_msg @@ -12810,7 +12829,6 @@ def test_delete_product_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.DeleteProductRequest() - assert args[0] == request_msg @@ -12833,7 +12851,6 @@ def test_create_reference_image_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.CreateReferenceImageRequest() - assert args[0] == request_msg @@ -12856,7 +12873,6 @@ def test_delete_reference_image_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.DeleteReferenceImageRequest() - assert args[0] == request_msg @@ -12879,7 +12895,6 @@ def test_list_reference_images_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.ListReferenceImagesRequest() - assert args[0] == request_msg @@ -12902,7 +12917,6 @@ def test_get_reference_image_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.GetReferenceImageRequest() - assert args[0] == request_msg @@ -12925,7 +12939,6 @@ def test_add_product_to_product_set_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.AddProductToProductSetRequest() - assert args[0] == request_msg @@ -12948,7 +12961,6 @@ def test_remove_product_from_product_set_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.RemoveProductFromProductSetRequest() - assert args[0] == request_msg @@ -12971,7 +12983,6 @@ def test_list_products_in_product_set_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.ListProductsInProductSetRequest() - assert args[0] == request_msg @@ -12994,7 +13005,6 @@ def test_import_product_sets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.ImportProductSetsRequest() - assert args[0] == request_msg @@ -13015,7 +13025,6 @@ def test_purge_products_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.PurgeProductsRequest() - assert args[0] == request_msg @@ -13059,7 +13068,6 @@ async def test_create_product_set_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.CreateProductSetRequest() - assert args[0] == request_msg @@ -13088,7 +13096,6 @@ async def test_list_product_sets_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.ListProductSetsRequest() - assert args[0] == request_msg @@ -13116,7 +13123,6 @@ async def test_get_product_set_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.GetProductSetRequest() - assert args[0] == request_msg @@ -13146,7 +13152,6 @@ async def test_update_product_set_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.UpdateProductSetRequest() - assert args[0] == request_msg @@ -13171,7 +13176,6 @@ async def test_delete_product_set_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.DeleteProductSetRequest() - assert args[0] == request_msg @@ -13201,7 +13205,6 @@ async def test_create_product_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.CreateProductRequest() - assert args[0] == request_msg @@ -13228,7 +13231,6 @@ async def test_list_products_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.ListProductsRequest() - assert args[0] == request_msg @@ -13258,7 +13260,6 @@ async def test_get_product_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.GetProductRequest() - assert args[0] == request_msg @@ -13288,7 +13289,6 @@ async def test_update_product_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.UpdateProductRequest() - assert args[0] == request_msg @@ -13311,7 +13311,6 @@ async def test_delete_product_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.DeleteProductRequest() - assert args[0] == request_msg @@ -13341,7 +13340,6 @@ async def test_create_reference_image_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.CreateReferenceImageRequest() - assert args[0] == request_msg @@ -13366,7 +13364,6 @@ async def test_delete_reference_image_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.DeleteReferenceImageRequest() - assert args[0] == request_msg @@ -13396,7 +13393,6 @@ async def test_list_reference_images_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.ListReferenceImagesRequest() - assert args[0] == request_msg @@ -13426,7 +13422,6 @@ async def test_get_reference_image_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.GetReferenceImageRequest() - assert args[0] == request_msg @@ -13451,7 +13446,6 @@ async def test_add_product_to_product_set_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.AddProductToProductSetRequest() - assert args[0] == request_msg @@ -13476,7 +13470,6 @@ async def test_remove_product_from_product_set_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.RemoveProductFromProductSetRequest() - assert args[0] == request_msg @@ -13505,7 +13498,6 @@ async def test_list_products_in_product_set_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.ListProductsInProductSetRequest() - assert args[0] == request_msg @@ -13532,7 +13524,6 @@ async def test_import_product_sets_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.ImportProductSetsRequest() - assert args[0] == request_msg @@ -13557,7 +13548,6 @@ async def test_purge_products_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.PurgeProductsRequest() - assert args[0] == request_msg @@ -16517,7 +16507,6 @@ def test_create_product_set_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.CreateProductSetRequest() - assert args[0] == request_msg @@ -16539,7 +16528,6 @@ def test_list_product_sets_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.ListProductSetsRequest() - assert args[0] == request_msg @@ -16559,7 +16547,6 @@ def test_get_product_set_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.GetProductSetRequest() - assert args[0] == request_msg @@ -16581,7 +16568,6 @@ def test_update_product_set_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.UpdateProductSetRequest() - assert args[0] == request_msg @@ -16603,7 +16589,6 @@ def test_delete_product_set_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.DeleteProductSetRequest() - assert args[0] == request_msg @@ -16623,7 +16608,6 @@ def test_create_product_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.CreateProductRequest() - assert args[0] == request_msg @@ -16643,7 +16627,6 @@ def test_list_products_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.ListProductsRequest() - assert args[0] == request_msg @@ -16663,7 +16646,6 @@ def test_get_product_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.GetProductRequest() - assert args[0] == request_msg @@ -16683,7 +16665,6 @@ def test_update_product_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.UpdateProductRequest() - assert args[0] == request_msg @@ -16703,7 +16684,6 @@ def test_delete_product_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.DeleteProductRequest() - assert args[0] == request_msg @@ -16725,7 +16705,6 @@ def test_create_reference_image_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.CreateReferenceImageRequest() - assert args[0] == request_msg @@ -16747,7 +16726,6 @@ def test_delete_reference_image_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.DeleteReferenceImageRequest() - assert args[0] == request_msg @@ -16769,7 +16747,6 @@ def test_list_reference_images_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.ListReferenceImagesRequest() - assert args[0] == request_msg @@ -16791,7 +16768,6 @@ def test_get_reference_image_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.GetReferenceImageRequest() - assert args[0] == request_msg @@ -16813,7 +16789,6 @@ def test_add_product_to_product_set_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.AddProductToProductSetRequest() - assert args[0] == request_msg @@ -16835,7 +16810,6 @@ def test_remove_product_from_product_set_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.RemoveProductFromProductSetRequest() - assert args[0] == request_msg @@ -16857,7 +16831,6 @@ def test_list_products_in_product_set_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.ListProductsInProductSetRequest() - assert args[0] == request_msg @@ -16879,7 +16852,6 @@ def test_import_product_sets_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.ImportProductSetsRequest() - assert args[0] == request_msg @@ -16899,7 +16871,6 @@ def test_purge_products_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.PurgeProductsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-vision/tests/unit/gapic/vision_v1p1beta1/test_image_annotator.py b/packages/google-cloud-vision/tests/unit/gapic/vision_v1p1beta1/test_image_annotator.py index b4b574403d2f..900b4b6075d9 100644 --- a/packages/google-cloud-vision/tests/unit/gapic/vision_v1p1beta1/test_image_annotator.py +++ b/packages/google-cloud-vision/tests/unit/gapic/vision_v1p1beta1/test_image_annotator.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 @@ -107,6 +108,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" @@ -1313,8 +1329,8 @@ def test_image_annotator_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - image_annotator.BatchAnnotateImagesRequest, - dict, + image_annotator.BatchAnnotateImagesRequest(), + {}, ], ) def test_batch_annotate_images(request_type, transport: str = "grpc"): @@ -1325,7 +1341,7 @@ def test_batch_annotate_images(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1368,7 +1384,8 @@ def test_batch_annotate_images_non_empty_request_with_auto_populated_field(): client.batch_annotate_images(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == image_annotator.BatchAnnotateImagesRequest() + request_msg = image_annotator.BatchAnnotateImagesRequest() + assert args[0] == request_msg def test_batch_annotate_images_use_cached_wrapped_rpc(): @@ -1454,9 +1471,15 @@ async def test_batch_annotate_images_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + image_annotator.BatchAnnotateImagesRequest(), + {}, + ], +) async def test_batch_annotate_images_async( - transport: str = "grpc_asyncio", - request_type=image_annotator.BatchAnnotateImagesRequest, + request_type, transport: str = "grpc_asyncio" ): client = ImageAnnotatorAsyncClient( credentials=async_anonymous_credentials(), @@ -1465,7 +1488,7 @@ async def test_batch_annotate_images_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( @@ -1487,11 +1510,6 @@ async def test_batch_annotate_images_async( assert isinstance(response, image_annotator.BatchAnnotateImagesResponse) -@pytest.mark.asyncio -async def test_batch_annotate_images_async_from_dict(): - await test_batch_annotate_images_async(request_type=dict) - - def test_batch_annotate_images_flattened(): client = ImageAnnotatorClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1912,7 +1930,6 @@ def test_batch_annotate_images_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = image_annotator.BatchAnnotateImagesRequest() - assert args[0] == request_msg @@ -1953,7 +1970,6 @@ async def test_batch_annotate_images_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = image_annotator.BatchAnnotateImagesRequest() - assert args[0] == request_msg @@ -2122,7 +2138,6 @@ def test_batch_annotate_images_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = image_annotator.BatchAnnotateImagesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-vision/tests/unit/gapic/vision_v1p2beta1/test_image_annotator.py b/packages/google-cloud-vision/tests/unit/gapic/vision_v1p2beta1/test_image_annotator.py index 006ef08f45ea..ebd2343c8313 100644 --- a/packages/google-cloud-vision/tests/unit/gapic/vision_v1p2beta1/test_image_annotator.py +++ b/packages/google-cloud-vision/tests/unit/gapic/vision_v1p2beta1/test_image_annotator.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" @@ -1318,8 +1334,8 @@ def test_image_annotator_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - image_annotator.BatchAnnotateImagesRequest, - dict, + image_annotator.BatchAnnotateImagesRequest(), + {}, ], ) def test_batch_annotate_images(request_type, transport: str = "grpc"): @@ -1330,7 +1346,7 @@ def test_batch_annotate_images(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1373,7 +1389,8 @@ def test_batch_annotate_images_non_empty_request_with_auto_populated_field(): client.batch_annotate_images(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == image_annotator.BatchAnnotateImagesRequest() + request_msg = image_annotator.BatchAnnotateImagesRequest() + assert args[0] == request_msg def test_batch_annotate_images_use_cached_wrapped_rpc(): @@ -1459,9 +1476,15 @@ async def test_batch_annotate_images_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + image_annotator.BatchAnnotateImagesRequest(), + {}, + ], +) async def test_batch_annotate_images_async( - transport: str = "grpc_asyncio", - request_type=image_annotator.BatchAnnotateImagesRequest, + request_type, transport: str = "grpc_asyncio" ): client = ImageAnnotatorAsyncClient( credentials=async_anonymous_credentials(), @@ -1470,7 +1493,7 @@ async def test_batch_annotate_images_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( @@ -1492,11 +1515,6 @@ async def test_batch_annotate_images_async( assert isinstance(response, image_annotator.BatchAnnotateImagesResponse) -@pytest.mark.asyncio -async def test_batch_annotate_images_async_from_dict(): - await test_batch_annotate_images_async(request_type=dict) - - def test_batch_annotate_images_flattened(): client = ImageAnnotatorClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1610,8 +1628,8 @@ async def test_batch_annotate_images_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - image_annotator.AsyncBatchAnnotateFilesRequest, - dict, + image_annotator.AsyncBatchAnnotateFilesRequest(), + {}, ], ) def test_async_batch_annotate_files(request_type, transport: str = "grpc"): @@ -1622,7 +1640,7 @@ def test_async_batch_annotate_files(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1665,7 +1683,8 @@ def test_async_batch_annotate_files_non_empty_request_with_auto_populated_field( client.async_batch_annotate_files(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == image_annotator.AsyncBatchAnnotateFilesRequest() + request_msg = image_annotator.AsyncBatchAnnotateFilesRequest() + assert args[0] == request_msg def test_async_batch_annotate_files_use_cached_wrapped_rpc(): @@ -1761,9 +1780,15 @@ async def test_async_batch_annotate_files_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + image_annotator.AsyncBatchAnnotateFilesRequest(), + {}, + ], +) async def test_async_batch_annotate_files_async( - transport: str = "grpc_asyncio", - request_type=image_annotator.AsyncBatchAnnotateFilesRequest, + request_type, transport: str = "grpc_asyncio" ): client = ImageAnnotatorAsyncClient( credentials=async_anonymous_credentials(), @@ -1772,7 +1797,7 @@ async def test_async_batch_annotate_files_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( @@ -1794,11 +1819,6 @@ async def test_async_batch_annotate_files_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_async_batch_annotate_files_async_from_dict(): - await test_async_batch_annotate_files_async(request_type=dict) - - def test_async_batch_annotate_files_flattened(): client = ImageAnnotatorClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2419,7 +2439,6 @@ def test_batch_annotate_images_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = image_annotator.BatchAnnotateImagesRequest() - assert args[0] == request_msg @@ -2442,7 +2461,6 @@ def test_async_batch_annotate_files_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = image_annotator.AsyncBatchAnnotateFilesRequest() - assert args[0] == request_msg @@ -2483,7 +2501,6 @@ async def test_batch_annotate_images_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = image_annotator.BatchAnnotateImagesRequest() - assert args[0] == request_msg @@ -2510,7 +2527,6 @@ async def test_async_batch_annotate_files_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = image_annotator.AsyncBatchAnnotateFilesRequest() - assert args[0] == request_msg @@ -2805,7 +2821,6 @@ def test_batch_annotate_images_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = image_annotator.BatchAnnotateImagesRequest() - assert args[0] == request_msg @@ -2827,7 +2842,6 @@ def test_async_batch_annotate_files_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = image_annotator.AsyncBatchAnnotateFilesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-vision/tests/unit/gapic/vision_v1p3beta1/test_image_annotator.py b/packages/google-cloud-vision/tests/unit/gapic/vision_v1p3beta1/test_image_annotator.py index 96481189586d..4827a0b3d8d5 100644 --- a/packages/google-cloud-vision/tests/unit/gapic/vision_v1p3beta1/test_image_annotator.py +++ b/packages/google-cloud-vision/tests/unit/gapic/vision_v1p3beta1/test_image_annotator.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 @@ -116,6 +117,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" @@ -1322,8 +1338,8 @@ def test_image_annotator_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - image_annotator.BatchAnnotateImagesRequest, - dict, + image_annotator.BatchAnnotateImagesRequest(), + {}, ], ) def test_batch_annotate_images(request_type, transport: str = "grpc"): @@ -1334,7 +1350,7 @@ def test_batch_annotate_images(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1377,7 +1393,8 @@ def test_batch_annotate_images_non_empty_request_with_auto_populated_field(): client.batch_annotate_images(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == image_annotator.BatchAnnotateImagesRequest() + request_msg = image_annotator.BatchAnnotateImagesRequest() + assert args[0] == request_msg def test_batch_annotate_images_use_cached_wrapped_rpc(): @@ -1463,9 +1480,15 @@ async def test_batch_annotate_images_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + image_annotator.BatchAnnotateImagesRequest(), + {}, + ], +) async def test_batch_annotate_images_async( - transport: str = "grpc_asyncio", - request_type=image_annotator.BatchAnnotateImagesRequest, + request_type, transport: str = "grpc_asyncio" ): client = ImageAnnotatorAsyncClient( credentials=async_anonymous_credentials(), @@ -1474,7 +1497,7 @@ async def test_batch_annotate_images_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( @@ -1496,11 +1519,6 @@ async def test_batch_annotate_images_async( assert isinstance(response, image_annotator.BatchAnnotateImagesResponse) -@pytest.mark.asyncio -async def test_batch_annotate_images_async_from_dict(): - await test_batch_annotate_images_async(request_type=dict) - - def test_batch_annotate_images_flattened(): client = ImageAnnotatorClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1614,8 +1632,8 @@ async def test_batch_annotate_images_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - image_annotator.AsyncBatchAnnotateFilesRequest, - dict, + image_annotator.AsyncBatchAnnotateFilesRequest(), + {}, ], ) def test_async_batch_annotate_files(request_type, transport: str = "grpc"): @@ -1626,7 +1644,7 @@ def test_async_batch_annotate_files(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1669,7 +1687,8 @@ def test_async_batch_annotate_files_non_empty_request_with_auto_populated_field( client.async_batch_annotate_files(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == image_annotator.AsyncBatchAnnotateFilesRequest() + request_msg = image_annotator.AsyncBatchAnnotateFilesRequest() + assert args[0] == request_msg def test_async_batch_annotate_files_use_cached_wrapped_rpc(): @@ -1765,9 +1784,15 @@ async def test_async_batch_annotate_files_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + image_annotator.AsyncBatchAnnotateFilesRequest(), + {}, + ], +) async def test_async_batch_annotate_files_async( - transport: str = "grpc_asyncio", - request_type=image_annotator.AsyncBatchAnnotateFilesRequest, + request_type, transport: str = "grpc_asyncio" ): client = ImageAnnotatorAsyncClient( credentials=async_anonymous_credentials(), @@ -1776,7 +1801,7 @@ async def test_async_batch_annotate_files_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( @@ -1798,11 +1823,6 @@ async def test_async_batch_annotate_files_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_async_batch_annotate_files_async_from_dict(): - await test_async_batch_annotate_files_async(request_type=dict) - - def test_async_batch_annotate_files_flattened(): client = ImageAnnotatorClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2423,7 +2443,6 @@ def test_batch_annotate_images_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = image_annotator.BatchAnnotateImagesRequest() - assert args[0] == request_msg @@ -2446,7 +2465,6 @@ def test_async_batch_annotate_files_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = image_annotator.AsyncBatchAnnotateFilesRequest() - assert args[0] == request_msg @@ -2487,7 +2505,6 @@ async def test_batch_annotate_images_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = image_annotator.BatchAnnotateImagesRequest() - assert args[0] == request_msg @@ -2514,7 +2531,6 @@ async def test_async_batch_annotate_files_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = image_annotator.AsyncBatchAnnotateFilesRequest() - assert args[0] == request_msg @@ -2809,7 +2825,6 @@ def test_batch_annotate_images_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = image_annotator.BatchAnnotateImagesRequest() - assert args[0] == request_msg @@ -2831,7 +2846,6 @@ def test_async_batch_annotate_files_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = image_annotator.AsyncBatchAnnotateFilesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-vision/tests/unit/gapic/vision_v1p3beta1/test_product_search.py b/packages/google-cloud-vision/tests/unit/gapic/vision_v1p3beta1/test_product_search.py index a3dcadeac5d4..040f0d786745 100644 --- a/packages/google-cloud-vision/tests/unit/gapic/vision_v1p3beta1/test_product_search.py +++ b/packages/google-cloud-vision/tests/unit/gapic/vision_v1p3beta1/test_product_search.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 @@ -116,6 +117,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" @@ -1318,8 +1334,8 @@ def test_product_search_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - product_search_service.CreateProductSetRequest, - dict, + product_search_service.CreateProductSetRequest(), + {}, ], ) def test_create_product_set(request_type, transport: str = "grpc"): @@ -1330,7 +1346,7 @@ def test_create_product_set(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1381,10 +1397,11 @@ def test_create_product_set_non_empty_request_with_auto_populated_field(): client.create_product_set(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_search_service.CreateProductSetRequest( + request_msg = product_search_service.CreateProductSetRequest( parent="parent_value", product_set_id="product_set_id_value", ) + assert args[0] == request_msg def test_create_product_set_use_cached_wrapped_rpc(): @@ -1469,10 +1486,14 @@ async def test_create_product_set_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_product_set_async( - transport: str = "grpc_asyncio", - request_type=product_search_service.CreateProductSetRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + product_search_service.CreateProductSetRequest(), + {}, + ], +) +async def test_create_product_set_async(request_type, transport: str = "grpc_asyncio"): client = ProductSearchAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1480,7 +1501,7 @@ async def test_create_product_set_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( @@ -1507,11 +1528,6 @@ async def test_create_product_set_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_create_product_set_async_from_dict(): - await test_create_product_set_async(request_type=dict) - - def test_create_product_set_field_headers(): client = ProductSearchClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1686,8 +1702,8 @@ async def test_create_product_set_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - product_search_service.ListProductSetsRequest, - dict, + product_search_service.ListProductSetsRequest(), + {}, ], ) def test_list_product_sets(request_type, transport: str = "grpc"): @@ -1698,7 +1714,7 @@ def test_list_product_sets(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1747,10 +1763,11 @@ def test_list_product_sets_non_empty_request_with_auto_populated_field(): client.list_product_sets(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_search_service.ListProductSetsRequest( + request_msg = product_search_service.ListProductSetsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_product_sets_use_cached_wrapped_rpc(): @@ -1833,10 +1850,14 @@ async def test_list_product_sets_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_product_sets_async( - transport: str = "grpc_asyncio", - request_type=product_search_service.ListProductSetsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + product_search_service.ListProductSetsRequest(), + {}, + ], +) +async def test_list_product_sets_async(request_type, transport: str = "grpc_asyncio"): client = ProductSearchAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1844,7 +1865,7 @@ async def test_list_product_sets_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( @@ -1869,11 +1890,6 @@ async def test_list_product_sets_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_product_sets_async_from_dict(): - await test_list_product_sets_async(request_type=dict) - - def test_list_product_sets_field_headers(): client = ProductSearchClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2226,8 +2242,8 @@ async def test_list_product_sets_async_pages(): @pytest.mark.parametrize( "request_type", [ - product_search_service.GetProductSetRequest, - dict, + product_search_service.GetProductSetRequest(), + {}, ], ) def test_get_product_set(request_type, transport: str = "grpc"): @@ -2238,7 +2254,7 @@ def test_get_product_set(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_product_set), "__call__") as call: @@ -2284,9 +2300,10 @@ def test_get_product_set_non_empty_request_with_auto_populated_field(): client.get_product_set(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_search_service.GetProductSetRequest( + request_msg = product_search_service.GetProductSetRequest( name="name_value", ) + assert args[0] == request_msg def test_get_product_set_use_cached_wrapped_rpc(): @@ -2367,10 +2384,14 @@ async def test_get_product_set_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_product_set_async( - transport: str = "grpc_asyncio", - request_type=product_search_service.GetProductSetRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + product_search_service.GetProductSetRequest(), + {}, + ], +) +async def test_get_product_set_async(request_type, transport: str = "grpc_asyncio"): client = ProductSearchAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2378,7 +2399,7 @@ async def test_get_product_set_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_product_set), "__call__") as call: @@ -2403,11 +2424,6 @@ async def test_get_product_set_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_get_product_set_async_from_dict(): - await test_get_product_set_async(request_type=dict) - - def test_get_product_set_field_headers(): client = ProductSearchClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2554,8 +2570,8 @@ async def test_get_product_set_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - product_search_service.UpdateProductSetRequest, - dict, + product_search_service.UpdateProductSetRequest(), + {}, ], ) def test_update_product_set(request_type, transport: str = "grpc"): @@ -2566,7 +2582,7 @@ def test_update_product_set(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2614,7 +2630,8 @@ def test_update_product_set_non_empty_request_with_auto_populated_field(): client.update_product_set(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_search_service.UpdateProductSetRequest() + request_msg = product_search_service.UpdateProductSetRequest() + assert args[0] == request_msg def test_update_product_set_use_cached_wrapped_rpc(): @@ -2699,10 +2716,14 @@ async def test_update_product_set_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_product_set_async( - transport: str = "grpc_asyncio", - request_type=product_search_service.UpdateProductSetRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + product_search_service.UpdateProductSetRequest(), + {}, + ], +) +async def test_update_product_set_async(request_type, transport: str = "grpc_asyncio"): client = ProductSearchAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2710,7 +2731,7 @@ async def test_update_product_set_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( @@ -2737,11 +2758,6 @@ async def test_update_product_set_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_update_product_set_async_from_dict(): - await test_update_product_set_async(request_type=dict) - - def test_update_product_set_field_headers(): client = ProductSearchClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2906,8 +2922,8 @@ async def test_update_product_set_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - product_search_service.DeleteProductSetRequest, - dict, + product_search_service.DeleteProductSetRequest(), + {}, ], ) def test_delete_product_set(request_type, transport: str = "grpc"): @@ -2918,7 +2934,7 @@ def test_delete_product_set(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_delete_product_set_non_empty_request_with_auto_populated_field(): client.delete_product_set(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_search_service.DeleteProductSetRequest( + request_msg = product_search_service.DeleteProductSetRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_product_set_use_cached_wrapped_rpc(): @@ -3050,10 +3067,14 @@ async def test_delete_product_set_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_product_set_async( - transport: str = "grpc_asyncio", - request_type=product_search_service.DeleteProductSetRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + product_search_service.DeleteProductSetRequest(), + {}, + ], +) +async def test_delete_product_set_async(request_type, transport: str = "grpc_asyncio"): client = ProductSearchAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3061,7 +3082,7 @@ async def test_delete_product_set_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( @@ -3081,11 +3102,6 @@ async def test_delete_product_set_async( assert response is None -@pytest.mark.asyncio -async def test_delete_product_set_async_from_dict(): - await test_delete_product_set_async(request_type=dict) - - def test_delete_product_set_field_headers(): client = ProductSearchClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3236,8 +3252,8 @@ async def test_delete_product_set_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - product_search_service.CreateProductRequest, - dict, + product_search_service.CreateProductRequest(), + {}, ], ) def test_create_product(request_type, transport: str = "grpc"): @@ -3248,7 +3264,7 @@ def test_create_product(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_product), "__call__") as call: @@ -3299,10 +3315,11 @@ def test_create_product_non_empty_request_with_auto_populated_field(): client.create_product(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_search_service.CreateProductRequest( + request_msg = product_search_service.CreateProductRequest( parent="parent_value", product_id="product_id_value", ) + assert args[0] == request_msg def test_create_product_use_cached_wrapped_rpc(): @@ -3383,10 +3400,14 @@ async def test_create_product_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_product_async( - transport: str = "grpc_asyncio", - request_type=product_search_service.CreateProductRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + product_search_service.CreateProductRequest(), + {}, + ], +) +async def test_create_product_async(request_type, transport: str = "grpc_asyncio"): client = ProductSearchAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3394,7 +3415,7 @@ async def test_create_product_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_product), "__call__") as call: @@ -3423,11 +3444,6 @@ async def test_create_product_async( assert response.product_category == "product_category_value" -@pytest.mark.asyncio -async def test_create_product_async_from_dict(): - await test_create_product_async(request_type=dict) - - def test_create_product_field_headers(): client = ProductSearchClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3594,8 +3610,8 @@ async def test_create_product_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - product_search_service.ListProductsRequest, - dict, + product_search_service.ListProductsRequest(), + {}, ], ) def test_list_products(request_type, transport: str = "grpc"): @@ -3606,7 +3622,7 @@ def test_list_products(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_products), "__call__") as call: @@ -3651,10 +3667,11 @@ def test_list_products_non_empty_request_with_auto_populated_field(): client.list_products(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_search_service.ListProductsRequest( + request_msg = product_search_service.ListProductsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_products_use_cached_wrapped_rpc(): @@ -3735,10 +3752,14 @@ async def test_list_products_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_products_async( - transport: str = "grpc_asyncio", - request_type=product_search_service.ListProductsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + product_search_service.ListProductsRequest(), + {}, + ], +) +async def test_list_products_async(request_type, transport: str = "grpc_asyncio"): client = ProductSearchAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3746,7 +3767,7 @@ async def test_list_products_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_products), "__call__") as call: @@ -3769,11 +3790,6 @@ async def test_list_products_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_products_async_from_dict(): - await test_list_products_async(request_type=dict) - - def test_list_products_field_headers(): client = ProductSearchClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4110,8 +4126,8 @@ async def test_list_products_async_pages(): @pytest.mark.parametrize( "request_type", [ - product_search_service.GetProductRequest, - dict, + product_search_service.GetProductRequest(), + {}, ], ) def test_get_product(request_type, transport: str = "grpc"): @@ -4122,7 +4138,7 @@ def test_get_product(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_product), "__call__") as call: @@ -4172,9 +4188,10 @@ def test_get_product_non_empty_request_with_auto_populated_field(): client.get_product(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_search_service.GetProductRequest( + request_msg = product_search_service.GetProductRequest( name="name_value", ) + assert args[0] == request_msg def test_get_product_use_cached_wrapped_rpc(): @@ -4255,10 +4272,14 @@ async def test_get_product_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_product_async( - transport: str = "grpc_asyncio", - request_type=product_search_service.GetProductRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + product_search_service.GetProductRequest(), + {}, + ], +) +async def test_get_product_async(request_type, transport: str = "grpc_asyncio"): client = ProductSearchAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4266,7 +4287,7 @@ async def test_get_product_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_product), "__call__") as call: @@ -4295,11 +4316,6 @@ async def test_get_product_async( assert response.product_category == "product_category_value" -@pytest.mark.asyncio -async def test_get_product_async_from_dict(): - await test_get_product_async(request_type=dict) - - def test_get_product_field_headers(): client = ProductSearchClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4446,8 +4462,8 @@ async def test_get_product_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - product_search_service.UpdateProductRequest, - dict, + product_search_service.UpdateProductRequest(), + {}, ], ) def test_update_product(request_type, transport: str = "grpc"): @@ -4458,7 +4474,7 @@ def test_update_product(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_product), "__call__") as call: @@ -4506,7 +4522,8 @@ def test_update_product_non_empty_request_with_auto_populated_field(): client.update_product(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_search_service.UpdateProductRequest() + request_msg = product_search_service.UpdateProductRequest() + assert args[0] == request_msg def test_update_product_use_cached_wrapped_rpc(): @@ -4587,10 +4604,14 @@ async def test_update_product_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_product_async( - transport: str = "grpc_asyncio", - request_type=product_search_service.UpdateProductRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + product_search_service.UpdateProductRequest(), + {}, + ], +) +async def test_update_product_async(request_type, transport: str = "grpc_asyncio"): client = ProductSearchAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4598,7 +4619,7 @@ async def test_update_product_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_product), "__call__") as call: @@ -4627,11 +4648,6 @@ async def test_update_product_async( assert response.product_category == "product_category_value" -@pytest.mark.asyncio -async def test_update_product_async_from_dict(): - await test_update_product_async(request_type=dict) - - def test_update_product_field_headers(): client = ProductSearchClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4788,8 +4804,8 @@ async def test_update_product_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - product_search_service.DeleteProductRequest, - dict, + product_search_service.DeleteProductRequest(), + {}, ], ) def test_delete_product(request_type, transport: str = "grpc"): @@ -4800,7 +4816,7 @@ def test_delete_product(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_product), "__call__") as call: @@ -4841,9 +4857,10 @@ def test_delete_product_non_empty_request_with_auto_populated_field(): client.delete_product(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_search_service.DeleteProductRequest( + request_msg = product_search_service.DeleteProductRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_product_use_cached_wrapped_rpc(): @@ -4924,10 +4941,14 @@ async def test_delete_product_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_product_async( - transport: str = "grpc_asyncio", - request_type=product_search_service.DeleteProductRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + product_search_service.DeleteProductRequest(), + {}, + ], +) +async def test_delete_product_async(request_type, transport: str = "grpc_asyncio"): client = ProductSearchAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4935,7 +4956,7 @@ async def test_delete_product_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_product), "__call__") as call: @@ -4953,11 +4974,6 @@ async def test_delete_product_async( assert response is None -@pytest.mark.asyncio -async def test_delete_product_async_from_dict(): - await test_delete_product_async(request_type=dict) - - def test_delete_product_field_headers(): client = ProductSearchClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5100,8 +5116,8 @@ async def test_delete_product_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - product_search_service.CreateReferenceImageRequest, - dict, + product_search_service.CreateReferenceImageRequest(), + {}, ], ) def test_create_reference_image(request_type, transport: str = "grpc"): @@ -5112,7 +5128,7 @@ def test_create_reference_image(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5163,10 +5179,11 @@ def test_create_reference_image_non_empty_request_with_auto_populated_field(): client.create_reference_image(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_search_service.CreateReferenceImageRequest( + request_msg = product_search_service.CreateReferenceImageRequest( parent="parent_value", reference_image_id="reference_image_id_value", ) + assert args[0] == request_msg def test_create_reference_image_use_cached_wrapped_rpc(): @@ -5252,9 +5269,15 @@ async def test_create_reference_image_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + product_search_service.CreateReferenceImageRequest(), + {}, + ], +) async def test_create_reference_image_async( - transport: str = "grpc_asyncio", - request_type=product_search_service.CreateReferenceImageRequest, + request_type, transport: str = "grpc_asyncio" ): client = ProductSearchAsyncClient( credentials=async_anonymous_credentials(), @@ -5263,7 +5286,7 @@ async def test_create_reference_image_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( @@ -5290,11 +5313,6 @@ async def test_create_reference_image_async( assert response.uri == "uri_value" -@pytest.mark.asyncio -async def test_create_reference_image_async_from_dict(): - await test_create_reference_image_async(request_type=dict) - - def test_create_reference_image_field_headers(): client = ProductSearchClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5469,8 +5487,8 @@ async def test_create_reference_image_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - product_search_service.DeleteReferenceImageRequest, - dict, + product_search_service.DeleteReferenceImageRequest(), + {}, ], ) def test_delete_reference_image(request_type, transport: str = "grpc"): @@ -5481,7 +5499,7 @@ def test_delete_reference_image(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5526,9 +5544,10 @@ def test_delete_reference_image_non_empty_request_with_auto_populated_field(): client.delete_reference_image(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_search_service.DeleteReferenceImageRequest( + request_msg = product_search_service.DeleteReferenceImageRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_reference_image_use_cached_wrapped_rpc(): @@ -5614,9 +5633,15 @@ async def test_delete_reference_image_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + product_search_service.DeleteReferenceImageRequest(), + {}, + ], +) async def test_delete_reference_image_async( - transport: str = "grpc_asyncio", - request_type=product_search_service.DeleteReferenceImageRequest, + request_type, transport: str = "grpc_asyncio" ): client = ProductSearchAsyncClient( credentials=async_anonymous_credentials(), @@ -5625,7 +5650,7 @@ async def test_delete_reference_image_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( @@ -5645,11 +5670,6 @@ async def test_delete_reference_image_async( assert response is None -@pytest.mark.asyncio -async def test_delete_reference_image_async_from_dict(): - await test_delete_reference_image_async(request_type=dict) - - def test_delete_reference_image_field_headers(): client = ProductSearchClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5800,8 +5820,8 @@ async def test_delete_reference_image_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - product_search_service.ListReferenceImagesRequest, - dict, + product_search_service.ListReferenceImagesRequest(), + {}, ], ) def test_list_reference_images(request_type, transport: str = "grpc"): @@ -5812,7 +5832,7 @@ def test_list_reference_images(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5863,10 +5883,11 @@ def test_list_reference_images_non_empty_request_with_auto_populated_field(): client.list_reference_images(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_search_service.ListReferenceImagesRequest( + request_msg = product_search_service.ListReferenceImagesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_reference_images_use_cached_wrapped_rpc(): @@ -5952,9 +5973,15 @@ async def test_list_reference_images_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + product_search_service.ListReferenceImagesRequest(), + {}, + ], +) async def test_list_reference_images_async( - transport: str = "grpc_asyncio", - request_type=product_search_service.ListReferenceImagesRequest, + request_type, transport: str = "grpc_asyncio" ): client = ProductSearchAsyncClient( credentials=async_anonymous_credentials(), @@ -5963,7 +5990,7 @@ async def test_list_reference_images_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( @@ -5990,11 +6017,6 @@ async def test_list_reference_images_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_reference_images_async_from_dict(): - await test_list_reference_images_async(request_type=dict) - - def test_list_reference_images_field_headers(): client = ProductSearchClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6351,8 +6373,8 @@ async def test_list_reference_images_async_pages(): @pytest.mark.parametrize( "request_type", [ - product_search_service.GetReferenceImageRequest, - dict, + product_search_service.GetReferenceImageRequest(), + {}, ], ) def test_get_reference_image(request_type, transport: str = "grpc"): @@ -6363,7 +6385,7 @@ def test_get_reference_image(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6413,9 +6435,10 @@ def test_get_reference_image_non_empty_request_with_auto_populated_field(): client.get_reference_image(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_search_service.GetReferenceImageRequest( + request_msg = product_search_service.GetReferenceImageRequest( name="name_value", ) + assert args[0] == request_msg def test_get_reference_image_use_cached_wrapped_rpc(): @@ -6500,10 +6523,14 @@ async def test_get_reference_image_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_reference_image_async( - transport: str = "grpc_asyncio", - request_type=product_search_service.GetReferenceImageRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + product_search_service.GetReferenceImageRequest(), + {}, + ], +) +async def test_get_reference_image_async(request_type, transport: str = "grpc_asyncio"): client = ProductSearchAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6511,7 +6538,7 @@ async def test_get_reference_image_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( @@ -6538,11 +6565,6 @@ async def test_get_reference_image_async( assert response.uri == "uri_value" -@pytest.mark.asyncio -async def test_get_reference_image_async_from_dict(): - await test_get_reference_image_async(request_type=dict) - - def test_get_reference_image_field_headers(): client = ProductSearchClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6697,8 +6719,8 @@ async def test_get_reference_image_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - product_search_service.AddProductToProductSetRequest, - dict, + product_search_service.AddProductToProductSetRequest(), + {}, ], ) def test_add_product_to_product_set(request_type, transport: str = "grpc"): @@ -6709,7 +6731,7 @@ def test_add_product_to_product_set(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6755,10 +6777,11 @@ def test_add_product_to_product_set_non_empty_request_with_auto_populated_field( client.add_product_to_product_set(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_search_service.AddProductToProductSetRequest( + request_msg = product_search_service.AddProductToProductSetRequest( name="name_value", product="product_value", ) + assert args[0] == request_msg def test_add_product_to_product_set_use_cached_wrapped_rpc(): @@ -6844,9 +6867,15 @@ async def test_add_product_to_product_set_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + product_search_service.AddProductToProductSetRequest(), + {}, + ], +) async def test_add_product_to_product_set_async( - transport: str = "grpc_asyncio", - request_type=product_search_service.AddProductToProductSetRequest, + request_type, transport: str = "grpc_asyncio" ): client = ProductSearchAsyncClient( credentials=async_anonymous_credentials(), @@ -6855,7 +6884,7 @@ async def test_add_product_to_product_set_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( @@ -6875,11 +6904,6 @@ async def test_add_product_to_product_set_async( assert response is None -@pytest.mark.asyncio -async def test_add_product_to_product_set_async_from_dict(): - await test_add_product_to_product_set_async(request_type=dict) - - def test_add_product_to_product_set_field_headers(): client = ProductSearchClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7040,8 +7064,8 @@ async def test_add_product_to_product_set_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - product_search_service.RemoveProductFromProductSetRequest, - dict, + product_search_service.RemoveProductFromProductSetRequest(), + {}, ], ) def test_remove_product_from_product_set(request_type, transport: str = "grpc"): @@ -7052,7 +7076,7 @@ def test_remove_product_from_product_set(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7098,10 +7122,11 @@ def test_remove_product_from_product_set_non_empty_request_with_auto_populated_f client.remove_product_from_product_set(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_search_service.RemoveProductFromProductSetRequest( + request_msg = product_search_service.RemoveProductFromProductSetRequest( name="name_value", product="product_value", ) + assert args[0] == request_msg def test_remove_product_from_product_set_use_cached_wrapped_rpc(): @@ -7187,9 +7212,15 @@ async def test_remove_product_from_product_set_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + product_search_service.RemoveProductFromProductSetRequest(), + {}, + ], +) async def test_remove_product_from_product_set_async( - transport: str = "grpc_asyncio", - request_type=product_search_service.RemoveProductFromProductSetRequest, + request_type, transport: str = "grpc_asyncio" ): client = ProductSearchAsyncClient( credentials=async_anonymous_credentials(), @@ -7198,7 +7229,7 @@ async def test_remove_product_from_product_set_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( @@ -7218,11 +7249,6 @@ async def test_remove_product_from_product_set_async( assert response is None -@pytest.mark.asyncio -async def test_remove_product_from_product_set_async_from_dict(): - await test_remove_product_from_product_set_async(request_type=dict) - - def test_remove_product_from_product_set_field_headers(): client = ProductSearchClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7383,8 +7409,8 @@ async def test_remove_product_from_product_set_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - product_search_service.ListProductsInProductSetRequest, - dict, + product_search_service.ListProductsInProductSetRequest(), + {}, ], ) def test_list_products_in_product_set(request_type, transport: str = "grpc"): @@ -7395,7 +7421,7 @@ def test_list_products_in_product_set(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7444,10 +7470,11 @@ def test_list_products_in_product_set_non_empty_request_with_auto_populated_fiel client.list_products_in_product_set(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_search_service.ListProductsInProductSetRequest( + request_msg = product_search_service.ListProductsInProductSetRequest( name="name_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_products_in_product_set_use_cached_wrapped_rpc(): @@ -7533,9 +7560,15 @@ async def test_list_products_in_product_set_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + product_search_service.ListProductsInProductSetRequest(), + {}, + ], +) async def test_list_products_in_product_set_async( - transport: str = "grpc_asyncio", - request_type=product_search_service.ListProductsInProductSetRequest, + request_type, transport: str = "grpc_asyncio" ): client = ProductSearchAsyncClient( credentials=async_anonymous_credentials(), @@ -7544,7 +7577,7 @@ async def test_list_products_in_product_set_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( @@ -7569,11 +7602,6 @@ async def test_list_products_in_product_set_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_products_in_product_set_async_from_dict(): - await test_list_products_in_product_set_async(request_type=dict) - - def test_list_products_in_product_set_field_headers(): client = ProductSearchClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7930,8 +7958,8 @@ async def test_list_products_in_product_set_async_pages(): @pytest.mark.parametrize( "request_type", [ - product_search_service.ImportProductSetsRequest, - dict, + product_search_service.ImportProductSetsRequest(), + {}, ], ) def test_import_product_sets(request_type, transport: str = "grpc"): @@ -7942,7 +7970,7 @@ def test_import_product_sets(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7987,9 +8015,10 @@ def test_import_product_sets_non_empty_request_with_auto_populated_field(): client.import_product_sets(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_search_service.ImportProductSetsRequest( + request_msg = product_search_service.ImportProductSetsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_import_product_sets_use_cached_wrapped_rpc(): @@ -8084,10 +8113,14 @@ async def test_import_product_sets_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_import_product_sets_async( - transport: str = "grpc_asyncio", - request_type=product_search_service.ImportProductSetsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + product_search_service.ImportProductSetsRequest(), + {}, + ], +) +async def test_import_product_sets_async(request_type, transport: str = "grpc_asyncio"): client = ProductSearchAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8095,7 +8128,7 @@ async def test_import_product_sets_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( @@ -8117,11 +8150,6 @@ async def test_import_product_sets_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_import_product_sets_async_from_dict(): - await test_import_product_sets_async(request_type=dict) - - def test_import_product_sets_field_headers(): client = ProductSearchClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12112,7 +12140,6 @@ def test_create_product_set_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.CreateProductSetRequest() - assert args[0] == request_msg @@ -12135,7 +12162,6 @@ def test_list_product_sets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.ListProductSetsRequest() - assert args[0] == request_msg @@ -12156,7 +12182,6 @@ def test_get_product_set_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.GetProductSetRequest() - assert args[0] == request_msg @@ -12179,7 +12204,6 @@ def test_update_product_set_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.UpdateProductSetRequest() - assert args[0] == request_msg @@ -12202,7 +12226,6 @@ def test_delete_product_set_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.DeleteProductSetRequest() - assert args[0] == request_msg @@ -12223,7 +12246,6 @@ def test_create_product_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.CreateProductRequest() - assert args[0] == request_msg @@ -12244,7 +12266,6 @@ def test_list_products_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.ListProductsRequest() - assert args[0] == request_msg @@ -12265,7 +12286,6 @@ def test_get_product_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.GetProductRequest() - assert args[0] == request_msg @@ -12286,7 +12306,6 @@ def test_update_product_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.UpdateProductRequest() - assert args[0] == request_msg @@ -12307,7 +12326,6 @@ def test_delete_product_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.DeleteProductRequest() - assert args[0] == request_msg @@ -12330,7 +12348,6 @@ def test_create_reference_image_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.CreateReferenceImageRequest() - assert args[0] == request_msg @@ -12353,7 +12370,6 @@ def test_delete_reference_image_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.DeleteReferenceImageRequest() - assert args[0] == request_msg @@ -12376,7 +12392,6 @@ def test_list_reference_images_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.ListReferenceImagesRequest() - assert args[0] == request_msg @@ -12399,7 +12414,6 @@ def test_get_reference_image_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.GetReferenceImageRequest() - assert args[0] == request_msg @@ -12422,7 +12436,6 @@ def test_add_product_to_product_set_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.AddProductToProductSetRequest() - assert args[0] == request_msg @@ -12445,7 +12458,6 @@ def test_remove_product_from_product_set_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.RemoveProductFromProductSetRequest() - assert args[0] == request_msg @@ -12468,7 +12480,6 @@ def test_list_products_in_product_set_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.ListProductsInProductSetRequest() - assert args[0] == request_msg @@ -12491,7 +12502,6 @@ def test_import_product_sets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.ImportProductSetsRequest() - assert args[0] == request_msg @@ -12535,7 +12545,6 @@ async def test_create_product_set_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.CreateProductSetRequest() - assert args[0] == request_msg @@ -12564,7 +12573,6 @@ async def test_list_product_sets_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.ListProductSetsRequest() - assert args[0] == request_msg @@ -12592,7 +12600,6 @@ async def test_get_product_set_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.GetProductSetRequest() - assert args[0] == request_msg @@ -12622,7 +12629,6 @@ async def test_update_product_set_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.UpdateProductSetRequest() - assert args[0] == request_msg @@ -12647,7 +12653,6 @@ async def test_delete_product_set_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.DeleteProductSetRequest() - assert args[0] == request_msg @@ -12677,7 +12682,6 @@ async def test_create_product_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.CreateProductRequest() - assert args[0] == request_msg @@ -12704,7 +12708,6 @@ async def test_list_products_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.ListProductsRequest() - assert args[0] == request_msg @@ -12734,7 +12737,6 @@ async def test_get_product_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.GetProductRequest() - assert args[0] == request_msg @@ -12764,7 +12766,6 @@ async def test_update_product_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.UpdateProductRequest() - assert args[0] == request_msg @@ -12787,7 +12788,6 @@ async def test_delete_product_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.DeleteProductRequest() - assert args[0] == request_msg @@ -12817,7 +12817,6 @@ async def test_create_reference_image_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.CreateReferenceImageRequest() - assert args[0] == request_msg @@ -12842,7 +12841,6 @@ async def test_delete_reference_image_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.DeleteReferenceImageRequest() - assert args[0] == request_msg @@ -12872,7 +12870,6 @@ async def test_list_reference_images_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.ListReferenceImagesRequest() - assert args[0] == request_msg @@ -12902,7 +12899,6 @@ async def test_get_reference_image_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.GetReferenceImageRequest() - assert args[0] == request_msg @@ -12927,7 +12923,6 @@ async def test_add_product_to_product_set_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.AddProductToProductSetRequest() - assert args[0] == request_msg @@ -12952,7 +12947,6 @@ async def test_remove_product_from_product_set_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.RemoveProductFromProductSetRequest() - assert args[0] == request_msg @@ -12981,7 +12975,6 @@ async def test_list_products_in_product_set_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.ListProductsInProductSetRequest() - assert args[0] == request_msg @@ -13008,7 +13001,6 @@ async def test_import_product_sets_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.ImportProductSetsRequest() - assert args[0] == request_msg @@ -15780,7 +15772,6 @@ def test_create_product_set_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.CreateProductSetRequest() - assert args[0] == request_msg @@ -15802,7 +15793,6 @@ def test_list_product_sets_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.ListProductSetsRequest() - assert args[0] == request_msg @@ -15822,7 +15812,6 @@ def test_get_product_set_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.GetProductSetRequest() - assert args[0] == request_msg @@ -15844,7 +15833,6 @@ def test_update_product_set_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.UpdateProductSetRequest() - assert args[0] == request_msg @@ -15866,7 +15854,6 @@ def test_delete_product_set_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.DeleteProductSetRequest() - assert args[0] == request_msg @@ -15886,7 +15873,6 @@ def test_create_product_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.CreateProductRequest() - assert args[0] == request_msg @@ -15906,7 +15892,6 @@ def test_list_products_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.ListProductsRequest() - assert args[0] == request_msg @@ -15926,7 +15911,6 @@ def test_get_product_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.GetProductRequest() - assert args[0] == request_msg @@ -15946,7 +15930,6 @@ def test_update_product_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.UpdateProductRequest() - assert args[0] == request_msg @@ -15966,7 +15949,6 @@ def test_delete_product_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.DeleteProductRequest() - assert args[0] == request_msg @@ -15988,7 +15970,6 @@ def test_create_reference_image_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.CreateReferenceImageRequest() - assert args[0] == request_msg @@ -16010,7 +15991,6 @@ def test_delete_reference_image_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.DeleteReferenceImageRequest() - assert args[0] == request_msg @@ -16032,7 +16012,6 @@ def test_list_reference_images_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.ListReferenceImagesRequest() - assert args[0] == request_msg @@ -16054,7 +16033,6 @@ def test_get_reference_image_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.GetReferenceImageRequest() - assert args[0] == request_msg @@ -16076,7 +16054,6 @@ def test_add_product_to_product_set_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.AddProductToProductSetRequest() - assert args[0] == request_msg @@ -16098,7 +16075,6 @@ def test_remove_product_from_product_set_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.RemoveProductFromProductSetRequest() - assert args[0] == request_msg @@ -16120,7 +16096,6 @@ def test_list_products_in_product_set_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.ListProductsInProductSetRequest() - assert args[0] == request_msg @@ -16142,7 +16117,6 @@ def test_import_product_sets_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.ImportProductSetsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-vision/tests/unit/gapic/vision_v1p4beta1/test_image_annotator.py b/packages/google-cloud-vision/tests/unit/gapic/vision_v1p4beta1/test_image_annotator.py index 2d323f21bd33..94de0a64cc5e 100644 --- a/packages/google-cloud-vision/tests/unit/gapic/vision_v1p4beta1/test_image_annotator.py +++ b/packages/google-cloud-vision/tests/unit/gapic/vision_v1p4beta1/test_image_annotator.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 @@ -117,6 +118,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" @@ -1323,8 +1339,8 @@ def test_image_annotator_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - image_annotator.BatchAnnotateImagesRequest, - dict, + image_annotator.BatchAnnotateImagesRequest(), + {}, ], ) def test_batch_annotate_images(request_type, transport: str = "grpc"): @@ -1335,7 +1351,7 @@ def test_batch_annotate_images(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1378,7 +1394,8 @@ def test_batch_annotate_images_non_empty_request_with_auto_populated_field(): client.batch_annotate_images(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == image_annotator.BatchAnnotateImagesRequest() + request_msg = image_annotator.BatchAnnotateImagesRequest() + assert args[0] == request_msg def test_batch_annotate_images_use_cached_wrapped_rpc(): @@ -1464,9 +1481,15 @@ async def test_batch_annotate_images_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + image_annotator.BatchAnnotateImagesRequest(), + {}, + ], +) async def test_batch_annotate_images_async( - transport: str = "grpc_asyncio", - request_type=image_annotator.BatchAnnotateImagesRequest, + request_type, transport: str = "grpc_asyncio" ): client = ImageAnnotatorAsyncClient( credentials=async_anonymous_credentials(), @@ -1475,7 +1498,7 @@ async def test_batch_annotate_images_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( @@ -1497,11 +1520,6 @@ async def test_batch_annotate_images_async( assert isinstance(response, image_annotator.BatchAnnotateImagesResponse) -@pytest.mark.asyncio -async def test_batch_annotate_images_async_from_dict(): - await test_batch_annotate_images_async(request_type=dict) - - def test_batch_annotate_images_flattened(): client = ImageAnnotatorClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1615,8 +1633,8 @@ async def test_batch_annotate_images_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - image_annotator.BatchAnnotateFilesRequest, - dict, + image_annotator.BatchAnnotateFilesRequest(), + {}, ], ) def test_batch_annotate_files(request_type, transport: str = "grpc"): @@ -1627,7 +1645,7 @@ def test_batch_annotate_files(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1670,7 +1688,8 @@ def test_batch_annotate_files_non_empty_request_with_auto_populated_field(): client.batch_annotate_files(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == image_annotator.BatchAnnotateFilesRequest() + request_msg = image_annotator.BatchAnnotateFilesRequest() + assert args[0] == request_msg def test_batch_annotate_files_use_cached_wrapped_rpc(): @@ -1755,9 +1774,15 @@ async def test_batch_annotate_files_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + image_annotator.BatchAnnotateFilesRequest(), + {}, + ], +) async def test_batch_annotate_files_async( - transport: str = "grpc_asyncio", - request_type=image_annotator.BatchAnnotateFilesRequest, + request_type, transport: str = "grpc_asyncio" ): client = ImageAnnotatorAsyncClient( credentials=async_anonymous_credentials(), @@ -1766,7 +1791,7 @@ async def test_batch_annotate_files_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( @@ -1788,11 +1813,6 @@ async def test_batch_annotate_files_async( assert isinstance(response, image_annotator.BatchAnnotateFilesResponse) -@pytest.mark.asyncio -async def test_batch_annotate_files_async_from_dict(): - await test_batch_annotate_files_async(request_type=dict) - - def test_batch_annotate_files_flattened(): client = ImageAnnotatorClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1918,8 +1938,8 @@ async def test_batch_annotate_files_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - image_annotator.AsyncBatchAnnotateImagesRequest, - dict, + image_annotator.AsyncBatchAnnotateImagesRequest(), + {}, ], ) def test_async_batch_annotate_images(request_type, transport: str = "grpc"): @@ -1930,7 +1950,7 @@ def test_async_batch_annotate_images(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1973,7 +1993,8 @@ def test_async_batch_annotate_images_non_empty_request_with_auto_populated_field client.async_batch_annotate_images(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == image_annotator.AsyncBatchAnnotateImagesRequest() + request_msg = image_annotator.AsyncBatchAnnotateImagesRequest() + assert args[0] == request_msg def test_async_batch_annotate_images_use_cached_wrapped_rpc(): @@ -2069,9 +2090,15 @@ async def test_async_batch_annotate_images_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + image_annotator.AsyncBatchAnnotateImagesRequest(), + {}, + ], +) async def test_async_batch_annotate_images_async( - transport: str = "grpc_asyncio", - request_type=image_annotator.AsyncBatchAnnotateImagesRequest, + request_type, transport: str = "grpc_asyncio" ): client = ImageAnnotatorAsyncClient( credentials=async_anonymous_credentials(), @@ -2080,7 +2107,7 @@ async def test_async_batch_annotate_images_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( @@ -2102,11 +2129,6 @@ async def test_async_batch_annotate_images_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_async_batch_annotate_images_async_from_dict(): - await test_async_batch_annotate_images_async(request_type=dict) - - def test_async_batch_annotate_images_flattened(): client = ImageAnnotatorClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2242,8 +2264,8 @@ async def test_async_batch_annotate_images_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - image_annotator.AsyncBatchAnnotateFilesRequest, - dict, + image_annotator.AsyncBatchAnnotateFilesRequest(), + {}, ], ) def test_async_batch_annotate_files(request_type, transport: str = "grpc"): @@ -2254,7 +2276,7 @@ def test_async_batch_annotate_files(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2297,7 +2319,8 @@ def test_async_batch_annotate_files_non_empty_request_with_auto_populated_field( client.async_batch_annotate_files(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == image_annotator.AsyncBatchAnnotateFilesRequest() + request_msg = image_annotator.AsyncBatchAnnotateFilesRequest() + assert args[0] == request_msg def test_async_batch_annotate_files_use_cached_wrapped_rpc(): @@ -2393,9 +2416,15 @@ async def test_async_batch_annotate_files_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + image_annotator.AsyncBatchAnnotateFilesRequest(), + {}, + ], +) async def test_async_batch_annotate_files_async( - transport: str = "grpc_asyncio", - request_type=image_annotator.AsyncBatchAnnotateFilesRequest, + request_type, transport: str = "grpc_asyncio" ): client = ImageAnnotatorAsyncClient( credentials=async_anonymous_credentials(), @@ -2404,7 +2433,7 @@ async def test_async_batch_annotate_files_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( @@ -2426,11 +2455,6 @@ async def test_async_batch_annotate_files_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_async_batch_annotate_files_async_from_dict(): - await test_async_batch_annotate_files_async(request_type=dict) - - def test_async_batch_annotate_files_flattened(): client = ImageAnnotatorClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3437,7 +3461,6 @@ def test_batch_annotate_images_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = image_annotator.BatchAnnotateImagesRequest() - assert args[0] == request_msg @@ -3460,7 +3483,6 @@ def test_batch_annotate_files_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = image_annotator.BatchAnnotateFilesRequest() - assert args[0] == request_msg @@ -3483,7 +3505,6 @@ def test_async_batch_annotate_images_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = image_annotator.AsyncBatchAnnotateImagesRequest() - assert args[0] == request_msg @@ -3506,7 +3527,6 @@ def test_async_batch_annotate_files_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = image_annotator.AsyncBatchAnnotateFilesRequest() - assert args[0] == request_msg @@ -3547,7 +3567,6 @@ async def test_batch_annotate_images_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = image_annotator.BatchAnnotateImagesRequest() - assert args[0] == request_msg @@ -3574,7 +3593,6 @@ async def test_batch_annotate_files_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = image_annotator.BatchAnnotateFilesRequest() - assert args[0] == request_msg @@ -3601,7 +3619,6 @@ async def test_async_batch_annotate_images_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = image_annotator.AsyncBatchAnnotateImagesRequest() - assert args[0] == request_msg @@ -3628,7 +3645,6 @@ async def test_async_batch_annotate_files_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = image_annotator.AsyncBatchAnnotateFilesRequest() - assert args[0] == request_msg @@ -4182,7 +4198,6 @@ def test_batch_annotate_images_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = image_annotator.BatchAnnotateImagesRequest() - assert args[0] == request_msg @@ -4204,7 +4219,6 @@ def test_batch_annotate_files_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = image_annotator.BatchAnnotateFilesRequest() - assert args[0] == request_msg @@ -4226,7 +4240,6 @@ def test_async_batch_annotate_images_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = image_annotator.AsyncBatchAnnotateImagesRequest() - assert args[0] == request_msg @@ -4248,7 +4261,6 @@ def test_async_batch_annotate_files_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = image_annotator.AsyncBatchAnnotateFilesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-vision/tests/unit/gapic/vision_v1p4beta1/test_product_search.py b/packages/google-cloud-vision/tests/unit/gapic/vision_v1p4beta1/test_product_search.py index 630f7b8fb82a..ce876750be5a 100644 --- a/packages/google-cloud-vision/tests/unit/gapic/vision_v1p4beta1/test_product_search.py +++ b/packages/google-cloud-vision/tests/unit/gapic/vision_v1p4beta1/test_product_search.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 @@ -117,6 +118,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" @@ -1319,8 +1335,8 @@ def test_product_search_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - product_search_service.CreateProductSetRequest, - dict, + product_search_service.CreateProductSetRequest(), + {}, ], ) def test_create_product_set(request_type, transport: str = "grpc"): @@ -1331,7 +1347,7 @@ def test_create_product_set(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1382,10 +1398,11 @@ def test_create_product_set_non_empty_request_with_auto_populated_field(): client.create_product_set(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_search_service.CreateProductSetRequest( + request_msg = product_search_service.CreateProductSetRequest( parent="parent_value", product_set_id="product_set_id_value", ) + assert args[0] == request_msg def test_create_product_set_use_cached_wrapped_rpc(): @@ -1470,10 +1487,14 @@ async def test_create_product_set_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_product_set_async( - transport: str = "grpc_asyncio", - request_type=product_search_service.CreateProductSetRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + product_search_service.CreateProductSetRequest(), + {}, + ], +) +async def test_create_product_set_async(request_type, transport: str = "grpc_asyncio"): client = ProductSearchAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1481,7 +1502,7 @@ async def test_create_product_set_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( @@ -1508,11 +1529,6 @@ async def test_create_product_set_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_create_product_set_async_from_dict(): - await test_create_product_set_async(request_type=dict) - - def test_create_product_set_field_headers(): client = ProductSearchClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1687,8 +1703,8 @@ async def test_create_product_set_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - product_search_service.ListProductSetsRequest, - dict, + product_search_service.ListProductSetsRequest(), + {}, ], ) def test_list_product_sets(request_type, transport: str = "grpc"): @@ -1699,7 +1715,7 @@ def test_list_product_sets(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1748,10 +1764,11 @@ def test_list_product_sets_non_empty_request_with_auto_populated_field(): client.list_product_sets(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_search_service.ListProductSetsRequest( + request_msg = product_search_service.ListProductSetsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_product_sets_use_cached_wrapped_rpc(): @@ -1834,10 +1851,14 @@ async def test_list_product_sets_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_product_sets_async( - transport: str = "grpc_asyncio", - request_type=product_search_service.ListProductSetsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + product_search_service.ListProductSetsRequest(), + {}, + ], +) +async def test_list_product_sets_async(request_type, transport: str = "grpc_asyncio"): client = ProductSearchAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1845,7 +1866,7 @@ async def test_list_product_sets_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( @@ -1870,11 +1891,6 @@ async def test_list_product_sets_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_product_sets_async_from_dict(): - await test_list_product_sets_async(request_type=dict) - - def test_list_product_sets_field_headers(): client = ProductSearchClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2227,8 +2243,8 @@ async def test_list_product_sets_async_pages(): @pytest.mark.parametrize( "request_type", [ - product_search_service.GetProductSetRequest, - dict, + product_search_service.GetProductSetRequest(), + {}, ], ) def test_get_product_set(request_type, transport: str = "grpc"): @@ -2239,7 +2255,7 @@ def test_get_product_set(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_product_set), "__call__") as call: @@ -2285,9 +2301,10 @@ def test_get_product_set_non_empty_request_with_auto_populated_field(): client.get_product_set(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_search_service.GetProductSetRequest( + request_msg = product_search_service.GetProductSetRequest( name="name_value", ) + assert args[0] == request_msg def test_get_product_set_use_cached_wrapped_rpc(): @@ -2368,10 +2385,14 @@ async def test_get_product_set_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_product_set_async( - transport: str = "grpc_asyncio", - request_type=product_search_service.GetProductSetRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + product_search_service.GetProductSetRequest(), + {}, + ], +) +async def test_get_product_set_async(request_type, transport: str = "grpc_asyncio"): client = ProductSearchAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2379,7 +2400,7 @@ async def test_get_product_set_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_product_set), "__call__") as call: @@ -2404,11 +2425,6 @@ async def test_get_product_set_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_get_product_set_async_from_dict(): - await test_get_product_set_async(request_type=dict) - - def test_get_product_set_field_headers(): client = ProductSearchClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2555,8 +2571,8 @@ async def test_get_product_set_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - product_search_service.UpdateProductSetRequest, - dict, + product_search_service.UpdateProductSetRequest(), + {}, ], ) def test_update_product_set(request_type, transport: str = "grpc"): @@ -2567,7 +2583,7 @@ def test_update_product_set(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2615,7 +2631,8 @@ def test_update_product_set_non_empty_request_with_auto_populated_field(): client.update_product_set(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_search_service.UpdateProductSetRequest() + request_msg = product_search_service.UpdateProductSetRequest() + assert args[0] == request_msg def test_update_product_set_use_cached_wrapped_rpc(): @@ -2700,10 +2717,14 @@ async def test_update_product_set_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_product_set_async( - transport: str = "grpc_asyncio", - request_type=product_search_service.UpdateProductSetRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + product_search_service.UpdateProductSetRequest(), + {}, + ], +) +async def test_update_product_set_async(request_type, transport: str = "grpc_asyncio"): client = ProductSearchAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2711,7 +2732,7 @@ async def test_update_product_set_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( @@ -2738,11 +2759,6 @@ async def test_update_product_set_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_update_product_set_async_from_dict(): - await test_update_product_set_async(request_type=dict) - - def test_update_product_set_field_headers(): client = ProductSearchClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2907,8 +2923,8 @@ async def test_update_product_set_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - product_search_service.DeleteProductSetRequest, - dict, + product_search_service.DeleteProductSetRequest(), + {}, ], ) def test_delete_product_set(request_type, transport: str = "grpc"): @@ -2919,7 +2935,7 @@ def test_delete_product_set(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2964,9 +2980,10 @@ def test_delete_product_set_non_empty_request_with_auto_populated_field(): client.delete_product_set(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_search_service.DeleteProductSetRequest( + request_msg = product_search_service.DeleteProductSetRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_product_set_use_cached_wrapped_rpc(): @@ -3051,10 +3068,14 @@ async def test_delete_product_set_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_product_set_async( - transport: str = "grpc_asyncio", - request_type=product_search_service.DeleteProductSetRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + product_search_service.DeleteProductSetRequest(), + {}, + ], +) +async def test_delete_product_set_async(request_type, transport: str = "grpc_asyncio"): client = ProductSearchAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3062,7 +3083,7 @@ async def test_delete_product_set_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( @@ -3082,11 +3103,6 @@ async def test_delete_product_set_async( assert response is None -@pytest.mark.asyncio -async def test_delete_product_set_async_from_dict(): - await test_delete_product_set_async(request_type=dict) - - def test_delete_product_set_field_headers(): client = ProductSearchClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3237,8 +3253,8 @@ async def test_delete_product_set_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - product_search_service.CreateProductRequest, - dict, + product_search_service.CreateProductRequest(), + {}, ], ) def test_create_product(request_type, transport: str = "grpc"): @@ -3249,7 +3265,7 @@ def test_create_product(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_product), "__call__") as call: @@ -3300,10 +3316,11 @@ def test_create_product_non_empty_request_with_auto_populated_field(): client.create_product(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_search_service.CreateProductRequest( + request_msg = product_search_service.CreateProductRequest( parent="parent_value", product_id="product_id_value", ) + assert args[0] == request_msg def test_create_product_use_cached_wrapped_rpc(): @@ -3384,10 +3401,14 @@ async def test_create_product_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_product_async( - transport: str = "grpc_asyncio", - request_type=product_search_service.CreateProductRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + product_search_service.CreateProductRequest(), + {}, + ], +) +async def test_create_product_async(request_type, transport: str = "grpc_asyncio"): client = ProductSearchAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3395,7 +3416,7 @@ async def test_create_product_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_product), "__call__") as call: @@ -3424,11 +3445,6 @@ async def test_create_product_async( assert response.product_category == "product_category_value" -@pytest.mark.asyncio -async def test_create_product_async_from_dict(): - await test_create_product_async(request_type=dict) - - def test_create_product_field_headers(): client = ProductSearchClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3595,8 +3611,8 @@ async def test_create_product_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - product_search_service.ListProductsRequest, - dict, + product_search_service.ListProductsRequest(), + {}, ], ) def test_list_products(request_type, transport: str = "grpc"): @@ -3607,7 +3623,7 @@ def test_list_products(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_products), "__call__") as call: @@ -3652,10 +3668,11 @@ def test_list_products_non_empty_request_with_auto_populated_field(): client.list_products(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_search_service.ListProductsRequest( + request_msg = product_search_service.ListProductsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_products_use_cached_wrapped_rpc(): @@ -3736,10 +3753,14 @@ async def test_list_products_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_products_async( - transport: str = "grpc_asyncio", - request_type=product_search_service.ListProductsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + product_search_service.ListProductsRequest(), + {}, + ], +) +async def test_list_products_async(request_type, transport: str = "grpc_asyncio"): client = ProductSearchAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3747,7 +3768,7 @@ async def test_list_products_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_products), "__call__") as call: @@ -3770,11 +3791,6 @@ async def test_list_products_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_products_async_from_dict(): - await test_list_products_async(request_type=dict) - - def test_list_products_field_headers(): client = ProductSearchClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4111,8 +4127,8 @@ async def test_list_products_async_pages(): @pytest.mark.parametrize( "request_type", [ - product_search_service.GetProductRequest, - dict, + product_search_service.GetProductRequest(), + {}, ], ) def test_get_product(request_type, transport: str = "grpc"): @@ -4123,7 +4139,7 @@ def test_get_product(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_product), "__call__") as call: @@ -4173,9 +4189,10 @@ def test_get_product_non_empty_request_with_auto_populated_field(): client.get_product(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_search_service.GetProductRequest( + request_msg = product_search_service.GetProductRequest( name="name_value", ) + assert args[0] == request_msg def test_get_product_use_cached_wrapped_rpc(): @@ -4256,10 +4273,14 @@ async def test_get_product_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_product_async( - transport: str = "grpc_asyncio", - request_type=product_search_service.GetProductRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + product_search_service.GetProductRequest(), + {}, + ], +) +async def test_get_product_async(request_type, transport: str = "grpc_asyncio"): client = ProductSearchAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4267,7 +4288,7 @@ async def test_get_product_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_product), "__call__") as call: @@ -4296,11 +4317,6 @@ async def test_get_product_async( assert response.product_category == "product_category_value" -@pytest.mark.asyncio -async def test_get_product_async_from_dict(): - await test_get_product_async(request_type=dict) - - def test_get_product_field_headers(): client = ProductSearchClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4447,8 +4463,8 @@ async def test_get_product_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - product_search_service.UpdateProductRequest, - dict, + product_search_service.UpdateProductRequest(), + {}, ], ) def test_update_product(request_type, transport: str = "grpc"): @@ -4459,7 +4475,7 @@ def test_update_product(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_product), "__call__") as call: @@ -4507,7 +4523,8 @@ def test_update_product_non_empty_request_with_auto_populated_field(): client.update_product(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_search_service.UpdateProductRequest() + request_msg = product_search_service.UpdateProductRequest() + assert args[0] == request_msg def test_update_product_use_cached_wrapped_rpc(): @@ -4588,10 +4605,14 @@ async def test_update_product_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_product_async( - transport: str = "grpc_asyncio", - request_type=product_search_service.UpdateProductRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + product_search_service.UpdateProductRequest(), + {}, + ], +) +async def test_update_product_async(request_type, transport: str = "grpc_asyncio"): client = ProductSearchAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4599,7 +4620,7 @@ async def test_update_product_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_product), "__call__") as call: @@ -4628,11 +4649,6 @@ async def test_update_product_async( assert response.product_category == "product_category_value" -@pytest.mark.asyncio -async def test_update_product_async_from_dict(): - await test_update_product_async(request_type=dict) - - def test_update_product_field_headers(): client = ProductSearchClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4789,8 +4805,8 @@ async def test_update_product_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - product_search_service.DeleteProductRequest, - dict, + product_search_service.DeleteProductRequest(), + {}, ], ) def test_delete_product(request_type, transport: str = "grpc"): @@ -4801,7 +4817,7 @@ def test_delete_product(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_product), "__call__") as call: @@ -4842,9 +4858,10 @@ def test_delete_product_non_empty_request_with_auto_populated_field(): client.delete_product(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_search_service.DeleteProductRequest( + request_msg = product_search_service.DeleteProductRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_product_use_cached_wrapped_rpc(): @@ -4925,10 +4942,14 @@ async def test_delete_product_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_product_async( - transport: str = "grpc_asyncio", - request_type=product_search_service.DeleteProductRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + product_search_service.DeleteProductRequest(), + {}, + ], +) +async def test_delete_product_async(request_type, transport: str = "grpc_asyncio"): client = ProductSearchAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4936,7 +4957,7 @@ async def test_delete_product_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_product), "__call__") as call: @@ -4954,11 +4975,6 @@ async def test_delete_product_async( assert response is None -@pytest.mark.asyncio -async def test_delete_product_async_from_dict(): - await test_delete_product_async(request_type=dict) - - def test_delete_product_field_headers(): client = ProductSearchClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5101,8 +5117,8 @@ async def test_delete_product_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - product_search_service.CreateReferenceImageRequest, - dict, + product_search_service.CreateReferenceImageRequest(), + {}, ], ) def test_create_reference_image(request_type, transport: str = "grpc"): @@ -5113,7 +5129,7 @@ def test_create_reference_image(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5164,10 +5180,11 @@ def test_create_reference_image_non_empty_request_with_auto_populated_field(): client.create_reference_image(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_search_service.CreateReferenceImageRequest( + request_msg = product_search_service.CreateReferenceImageRequest( parent="parent_value", reference_image_id="reference_image_id_value", ) + assert args[0] == request_msg def test_create_reference_image_use_cached_wrapped_rpc(): @@ -5253,9 +5270,15 @@ async def test_create_reference_image_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + product_search_service.CreateReferenceImageRequest(), + {}, + ], +) async def test_create_reference_image_async( - transport: str = "grpc_asyncio", - request_type=product_search_service.CreateReferenceImageRequest, + request_type, transport: str = "grpc_asyncio" ): client = ProductSearchAsyncClient( credentials=async_anonymous_credentials(), @@ -5264,7 +5287,7 @@ async def test_create_reference_image_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( @@ -5291,11 +5314,6 @@ async def test_create_reference_image_async( assert response.uri == "uri_value" -@pytest.mark.asyncio -async def test_create_reference_image_async_from_dict(): - await test_create_reference_image_async(request_type=dict) - - def test_create_reference_image_field_headers(): client = ProductSearchClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5470,8 +5488,8 @@ async def test_create_reference_image_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - product_search_service.DeleteReferenceImageRequest, - dict, + product_search_service.DeleteReferenceImageRequest(), + {}, ], ) def test_delete_reference_image(request_type, transport: str = "grpc"): @@ -5482,7 +5500,7 @@ def test_delete_reference_image(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5527,9 +5545,10 @@ def test_delete_reference_image_non_empty_request_with_auto_populated_field(): client.delete_reference_image(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_search_service.DeleteReferenceImageRequest( + request_msg = product_search_service.DeleteReferenceImageRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_reference_image_use_cached_wrapped_rpc(): @@ -5615,9 +5634,15 @@ async def test_delete_reference_image_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + product_search_service.DeleteReferenceImageRequest(), + {}, + ], +) async def test_delete_reference_image_async( - transport: str = "grpc_asyncio", - request_type=product_search_service.DeleteReferenceImageRequest, + request_type, transport: str = "grpc_asyncio" ): client = ProductSearchAsyncClient( credentials=async_anonymous_credentials(), @@ -5626,7 +5651,7 @@ async def test_delete_reference_image_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( @@ -5646,11 +5671,6 @@ async def test_delete_reference_image_async( assert response is None -@pytest.mark.asyncio -async def test_delete_reference_image_async_from_dict(): - await test_delete_reference_image_async(request_type=dict) - - def test_delete_reference_image_field_headers(): client = ProductSearchClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5801,8 +5821,8 @@ async def test_delete_reference_image_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - product_search_service.ListReferenceImagesRequest, - dict, + product_search_service.ListReferenceImagesRequest(), + {}, ], ) def test_list_reference_images(request_type, transport: str = "grpc"): @@ -5813,7 +5833,7 @@ def test_list_reference_images(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5864,10 +5884,11 @@ def test_list_reference_images_non_empty_request_with_auto_populated_field(): client.list_reference_images(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_search_service.ListReferenceImagesRequest( + request_msg = product_search_service.ListReferenceImagesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_reference_images_use_cached_wrapped_rpc(): @@ -5953,9 +5974,15 @@ async def test_list_reference_images_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + product_search_service.ListReferenceImagesRequest(), + {}, + ], +) async def test_list_reference_images_async( - transport: str = "grpc_asyncio", - request_type=product_search_service.ListReferenceImagesRequest, + request_type, transport: str = "grpc_asyncio" ): client = ProductSearchAsyncClient( credentials=async_anonymous_credentials(), @@ -5964,7 +5991,7 @@ async def test_list_reference_images_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( @@ -5991,11 +6018,6 @@ async def test_list_reference_images_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_reference_images_async_from_dict(): - await test_list_reference_images_async(request_type=dict) - - def test_list_reference_images_field_headers(): client = ProductSearchClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6352,8 +6374,8 @@ async def test_list_reference_images_async_pages(): @pytest.mark.parametrize( "request_type", [ - product_search_service.GetReferenceImageRequest, - dict, + product_search_service.GetReferenceImageRequest(), + {}, ], ) def test_get_reference_image(request_type, transport: str = "grpc"): @@ -6364,7 +6386,7 @@ def test_get_reference_image(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6414,9 +6436,10 @@ def test_get_reference_image_non_empty_request_with_auto_populated_field(): client.get_reference_image(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_search_service.GetReferenceImageRequest( + request_msg = product_search_service.GetReferenceImageRequest( name="name_value", ) + assert args[0] == request_msg def test_get_reference_image_use_cached_wrapped_rpc(): @@ -6501,10 +6524,14 @@ async def test_get_reference_image_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_reference_image_async( - transport: str = "grpc_asyncio", - request_type=product_search_service.GetReferenceImageRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + product_search_service.GetReferenceImageRequest(), + {}, + ], +) +async def test_get_reference_image_async(request_type, transport: str = "grpc_asyncio"): client = ProductSearchAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6512,7 +6539,7 @@ async def test_get_reference_image_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( @@ -6539,11 +6566,6 @@ async def test_get_reference_image_async( assert response.uri == "uri_value" -@pytest.mark.asyncio -async def test_get_reference_image_async_from_dict(): - await test_get_reference_image_async(request_type=dict) - - def test_get_reference_image_field_headers(): client = ProductSearchClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6698,8 +6720,8 @@ async def test_get_reference_image_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - product_search_service.AddProductToProductSetRequest, - dict, + product_search_service.AddProductToProductSetRequest(), + {}, ], ) def test_add_product_to_product_set(request_type, transport: str = "grpc"): @@ -6710,7 +6732,7 @@ def test_add_product_to_product_set(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6756,10 +6778,11 @@ def test_add_product_to_product_set_non_empty_request_with_auto_populated_field( client.add_product_to_product_set(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_search_service.AddProductToProductSetRequest( + request_msg = product_search_service.AddProductToProductSetRequest( name="name_value", product="product_value", ) + assert args[0] == request_msg def test_add_product_to_product_set_use_cached_wrapped_rpc(): @@ -6845,9 +6868,15 @@ async def test_add_product_to_product_set_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + product_search_service.AddProductToProductSetRequest(), + {}, + ], +) async def test_add_product_to_product_set_async( - transport: str = "grpc_asyncio", - request_type=product_search_service.AddProductToProductSetRequest, + request_type, transport: str = "grpc_asyncio" ): client = ProductSearchAsyncClient( credentials=async_anonymous_credentials(), @@ -6856,7 +6885,7 @@ async def test_add_product_to_product_set_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( @@ -6876,11 +6905,6 @@ async def test_add_product_to_product_set_async( assert response is None -@pytest.mark.asyncio -async def test_add_product_to_product_set_async_from_dict(): - await test_add_product_to_product_set_async(request_type=dict) - - def test_add_product_to_product_set_field_headers(): client = ProductSearchClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7041,8 +7065,8 @@ async def test_add_product_to_product_set_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - product_search_service.RemoveProductFromProductSetRequest, - dict, + product_search_service.RemoveProductFromProductSetRequest(), + {}, ], ) def test_remove_product_from_product_set(request_type, transport: str = "grpc"): @@ -7053,7 +7077,7 @@ def test_remove_product_from_product_set(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7099,10 +7123,11 @@ def test_remove_product_from_product_set_non_empty_request_with_auto_populated_f client.remove_product_from_product_set(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_search_service.RemoveProductFromProductSetRequest( + request_msg = product_search_service.RemoveProductFromProductSetRequest( name="name_value", product="product_value", ) + assert args[0] == request_msg def test_remove_product_from_product_set_use_cached_wrapped_rpc(): @@ -7188,9 +7213,15 @@ async def test_remove_product_from_product_set_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + product_search_service.RemoveProductFromProductSetRequest(), + {}, + ], +) async def test_remove_product_from_product_set_async( - transport: str = "grpc_asyncio", - request_type=product_search_service.RemoveProductFromProductSetRequest, + request_type, transport: str = "grpc_asyncio" ): client = ProductSearchAsyncClient( credentials=async_anonymous_credentials(), @@ -7199,7 +7230,7 @@ async def test_remove_product_from_product_set_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( @@ -7219,11 +7250,6 @@ async def test_remove_product_from_product_set_async( assert response is None -@pytest.mark.asyncio -async def test_remove_product_from_product_set_async_from_dict(): - await test_remove_product_from_product_set_async(request_type=dict) - - def test_remove_product_from_product_set_field_headers(): client = ProductSearchClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7384,8 +7410,8 @@ async def test_remove_product_from_product_set_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - product_search_service.ListProductsInProductSetRequest, - dict, + product_search_service.ListProductsInProductSetRequest(), + {}, ], ) def test_list_products_in_product_set(request_type, transport: str = "grpc"): @@ -7396,7 +7422,7 @@ def test_list_products_in_product_set(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7445,10 +7471,11 @@ def test_list_products_in_product_set_non_empty_request_with_auto_populated_fiel client.list_products_in_product_set(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_search_service.ListProductsInProductSetRequest( + request_msg = product_search_service.ListProductsInProductSetRequest( name="name_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_products_in_product_set_use_cached_wrapped_rpc(): @@ -7534,9 +7561,15 @@ async def test_list_products_in_product_set_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + product_search_service.ListProductsInProductSetRequest(), + {}, + ], +) async def test_list_products_in_product_set_async( - transport: str = "grpc_asyncio", - request_type=product_search_service.ListProductsInProductSetRequest, + request_type, transport: str = "grpc_asyncio" ): client = ProductSearchAsyncClient( credentials=async_anonymous_credentials(), @@ -7545,7 +7578,7 @@ async def test_list_products_in_product_set_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( @@ -7570,11 +7603,6 @@ async def test_list_products_in_product_set_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_products_in_product_set_async_from_dict(): - await test_list_products_in_product_set_async(request_type=dict) - - def test_list_products_in_product_set_field_headers(): client = ProductSearchClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7931,8 +7959,8 @@ async def test_list_products_in_product_set_async_pages(): @pytest.mark.parametrize( "request_type", [ - product_search_service.ImportProductSetsRequest, - dict, + product_search_service.ImportProductSetsRequest(), + {}, ], ) def test_import_product_sets(request_type, transport: str = "grpc"): @@ -7943,7 +7971,7 @@ def test_import_product_sets(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7988,9 +8016,10 @@ def test_import_product_sets_non_empty_request_with_auto_populated_field(): client.import_product_sets(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_search_service.ImportProductSetsRequest( + request_msg = product_search_service.ImportProductSetsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_import_product_sets_use_cached_wrapped_rpc(): @@ -8085,10 +8114,14 @@ async def test_import_product_sets_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_import_product_sets_async( - transport: str = "grpc_asyncio", - request_type=product_search_service.ImportProductSetsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + product_search_service.ImportProductSetsRequest(), + {}, + ], +) +async def test_import_product_sets_async(request_type, transport: str = "grpc_asyncio"): client = ProductSearchAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8096,7 +8129,7 @@ async def test_import_product_sets_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( @@ -8118,11 +8151,6 @@ async def test_import_product_sets_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_import_product_sets_async_from_dict(): - await test_import_product_sets_async(request_type=dict) - - def test_import_product_sets_field_headers(): client = ProductSearchClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8311,8 +8339,8 @@ async def test_import_product_sets_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - product_search_service.PurgeProductsRequest, - dict, + product_search_service.PurgeProductsRequest(), + {}, ], ) def test_purge_products(request_type, transport: str = "grpc"): @@ -8323,7 +8351,7 @@ def test_purge_products(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.purge_products), "__call__") as call: @@ -8364,9 +8392,10 @@ def test_purge_products_non_empty_request_with_auto_populated_field(): client.purge_products(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == product_search_service.PurgeProductsRequest( + request_msg = product_search_service.PurgeProductsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_purge_products_use_cached_wrapped_rpc(): @@ -8457,10 +8486,14 @@ async def test_purge_products_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_purge_products_async( - transport: str = "grpc_asyncio", - request_type=product_search_service.PurgeProductsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + product_search_service.PurgeProductsRequest(), + {}, + ], +) +async def test_purge_products_async(request_type, transport: str = "grpc_asyncio"): client = ProductSearchAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8468,7 +8501,7 @@ async def test_purge_products_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.purge_products), "__call__") as call: @@ -8488,11 +8521,6 @@ async def test_purge_products_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_purge_products_async_from_dict(): - await test_purge_products_async(request_type=dict) - - def test_purge_products_field_headers(): client = ProductSearchClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12619,7 +12647,6 @@ def test_create_product_set_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.CreateProductSetRequest() - assert args[0] == request_msg @@ -12642,7 +12669,6 @@ def test_list_product_sets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.ListProductSetsRequest() - assert args[0] == request_msg @@ -12663,7 +12689,6 @@ def test_get_product_set_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.GetProductSetRequest() - assert args[0] == request_msg @@ -12686,7 +12711,6 @@ def test_update_product_set_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.UpdateProductSetRequest() - assert args[0] == request_msg @@ -12709,7 +12733,6 @@ def test_delete_product_set_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.DeleteProductSetRequest() - assert args[0] == request_msg @@ -12730,7 +12753,6 @@ def test_create_product_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.CreateProductRequest() - assert args[0] == request_msg @@ -12751,7 +12773,6 @@ def test_list_products_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.ListProductsRequest() - assert args[0] == request_msg @@ -12772,7 +12793,6 @@ def test_get_product_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.GetProductRequest() - assert args[0] == request_msg @@ -12793,7 +12813,6 @@ def test_update_product_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.UpdateProductRequest() - assert args[0] == request_msg @@ -12814,7 +12833,6 @@ def test_delete_product_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.DeleteProductRequest() - assert args[0] == request_msg @@ -12837,7 +12855,6 @@ def test_create_reference_image_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.CreateReferenceImageRequest() - assert args[0] == request_msg @@ -12860,7 +12877,6 @@ def test_delete_reference_image_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.DeleteReferenceImageRequest() - assert args[0] == request_msg @@ -12883,7 +12899,6 @@ def test_list_reference_images_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.ListReferenceImagesRequest() - assert args[0] == request_msg @@ -12906,7 +12921,6 @@ def test_get_reference_image_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.GetReferenceImageRequest() - assert args[0] == request_msg @@ -12929,7 +12943,6 @@ def test_add_product_to_product_set_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.AddProductToProductSetRequest() - assert args[0] == request_msg @@ -12952,7 +12965,6 @@ def test_remove_product_from_product_set_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.RemoveProductFromProductSetRequest() - assert args[0] == request_msg @@ -12975,7 +12987,6 @@ def test_list_products_in_product_set_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.ListProductsInProductSetRequest() - assert args[0] == request_msg @@ -12998,7 +13009,6 @@ def test_import_product_sets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.ImportProductSetsRequest() - assert args[0] == request_msg @@ -13019,7 +13029,6 @@ def test_purge_products_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.PurgeProductsRequest() - assert args[0] == request_msg @@ -13063,7 +13072,6 @@ async def test_create_product_set_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.CreateProductSetRequest() - assert args[0] == request_msg @@ -13092,7 +13100,6 @@ async def test_list_product_sets_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.ListProductSetsRequest() - assert args[0] == request_msg @@ -13120,7 +13127,6 @@ async def test_get_product_set_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.GetProductSetRequest() - assert args[0] == request_msg @@ -13150,7 +13156,6 @@ async def test_update_product_set_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.UpdateProductSetRequest() - assert args[0] == request_msg @@ -13175,7 +13180,6 @@ async def test_delete_product_set_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.DeleteProductSetRequest() - assert args[0] == request_msg @@ -13205,7 +13209,6 @@ async def test_create_product_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.CreateProductRequest() - assert args[0] == request_msg @@ -13232,7 +13235,6 @@ async def test_list_products_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.ListProductsRequest() - assert args[0] == request_msg @@ -13262,7 +13264,6 @@ async def test_get_product_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.GetProductRequest() - assert args[0] == request_msg @@ -13292,7 +13293,6 @@ async def test_update_product_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.UpdateProductRequest() - assert args[0] == request_msg @@ -13315,7 +13315,6 @@ async def test_delete_product_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.DeleteProductRequest() - assert args[0] == request_msg @@ -13345,7 +13344,6 @@ async def test_create_reference_image_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.CreateReferenceImageRequest() - assert args[0] == request_msg @@ -13370,7 +13368,6 @@ async def test_delete_reference_image_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.DeleteReferenceImageRequest() - assert args[0] == request_msg @@ -13400,7 +13397,6 @@ async def test_list_reference_images_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.ListReferenceImagesRequest() - assert args[0] == request_msg @@ -13430,7 +13426,6 @@ async def test_get_reference_image_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.GetReferenceImageRequest() - assert args[0] == request_msg @@ -13455,7 +13450,6 @@ async def test_add_product_to_product_set_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.AddProductToProductSetRequest() - assert args[0] == request_msg @@ -13480,7 +13474,6 @@ async def test_remove_product_from_product_set_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.RemoveProductFromProductSetRequest() - assert args[0] == request_msg @@ -13509,7 +13502,6 @@ async def test_list_products_in_product_set_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.ListProductsInProductSetRequest() - assert args[0] == request_msg @@ -13536,7 +13528,6 @@ async def test_import_product_sets_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.ImportProductSetsRequest() - assert args[0] == request_msg @@ -13561,7 +13552,6 @@ async def test_purge_products_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.PurgeProductsRequest() - assert args[0] == request_msg @@ -16458,7 +16448,6 @@ def test_create_product_set_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.CreateProductSetRequest() - assert args[0] == request_msg @@ -16480,7 +16469,6 @@ def test_list_product_sets_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.ListProductSetsRequest() - assert args[0] == request_msg @@ -16500,7 +16488,6 @@ def test_get_product_set_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.GetProductSetRequest() - assert args[0] == request_msg @@ -16522,7 +16509,6 @@ def test_update_product_set_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.UpdateProductSetRequest() - assert args[0] == request_msg @@ -16544,7 +16530,6 @@ def test_delete_product_set_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.DeleteProductSetRequest() - assert args[0] == request_msg @@ -16564,7 +16549,6 @@ def test_create_product_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.CreateProductRequest() - assert args[0] == request_msg @@ -16584,7 +16568,6 @@ def test_list_products_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.ListProductsRequest() - assert args[0] == request_msg @@ -16604,7 +16587,6 @@ def test_get_product_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.GetProductRequest() - assert args[0] == request_msg @@ -16624,7 +16606,6 @@ def test_update_product_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.UpdateProductRequest() - assert args[0] == request_msg @@ -16644,7 +16625,6 @@ def test_delete_product_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.DeleteProductRequest() - assert args[0] == request_msg @@ -16666,7 +16646,6 @@ def test_create_reference_image_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.CreateReferenceImageRequest() - assert args[0] == request_msg @@ -16688,7 +16667,6 @@ def test_delete_reference_image_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.DeleteReferenceImageRequest() - assert args[0] == request_msg @@ -16710,7 +16688,6 @@ def test_list_reference_images_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.ListReferenceImagesRequest() - assert args[0] == request_msg @@ -16732,7 +16709,6 @@ def test_get_reference_image_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.GetReferenceImageRequest() - assert args[0] == request_msg @@ -16754,7 +16730,6 @@ def test_add_product_to_product_set_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.AddProductToProductSetRequest() - assert args[0] == request_msg @@ -16776,7 +16751,6 @@ def test_remove_product_from_product_set_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.RemoveProductFromProductSetRequest() - assert args[0] == request_msg @@ -16798,7 +16772,6 @@ def test_list_products_in_product_set_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.ListProductsInProductSetRequest() - assert args[0] == request_msg @@ -16820,7 +16793,6 @@ def test_import_product_sets_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.ImportProductSetsRequest() - assert args[0] == request_msg @@ -16840,7 +16812,6 @@ def test_purge_products_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = product_search_service.PurgeProductsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-visionai/noxfile.py b/packages/google-cloud-visionai/noxfile.py index c44b5a797d1b..14c9964d9a0e 100644 --- a/packages/google-cloud-visionai/noxfile.py +++ b/packages/google-cloud-visionai/noxfile.py @@ -47,7 +47,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-visionai" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-visionai/setup.py b/packages/google-cloud-visionai/setup.py index af5d376bb11b..b3c81042e3e9 100644 --- a/packages/google-cloud-visionai/setup.py +++ b/packages/google-cloud-visionai/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/google-cloud-visionai/testing/constraints-3.10.txt b/packages/google-cloud-visionai/testing/constraints-3.10.txt index a92801e1c8e2..b39cd54634f9 100644 --- a/packages/google-cloud-visionai/testing/constraints-3.10.txt +++ b/packages/google-cloud-visionai/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/google-cloud-visionai/tests/unit/gapic/visionai_v1/test_app_platform.py b/packages/google-cloud-visionai/tests/unit/gapic/visionai_v1/test_app_platform.py index 4f8715fdd833..48da4e82f521 100644 --- a/packages/google-cloud-visionai/tests/unit/gapic/visionai_v1/test_app_platform.py +++ b/packages/google-cloud-visionai/tests/unit/gapic/visionai_v1/test_app_platform.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 @@ -123,6 +124,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" @@ -1288,8 +1304,8 @@ def test_app_platform_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - platform.ListApplicationsRequest, - dict, + platform.ListApplicationsRequest(), + {}, ], ) def test_list_applications(request_type, transport: str = "grpc"): @@ -1300,7 +1316,7 @@ def test_list_applications(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1353,12 +1369,13 @@ def test_list_applications_non_empty_request_with_auto_populated_field(): client.list_applications(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == platform.ListApplicationsRequest( + request_msg = platform.ListApplicationsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_applications_use_cached_wrapped_rpc(): @@ -1441,9 +1458,14 @@ async def test_list_applications_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_applications_async( - transport: str = "grpc_asyncio", request_type=platform.ListApplicationsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + platform.ListApplicationsRequest(), + {}, + ], +) +async def test_list_applications_async(request_type, transport: str = "grpc_asyncio"): client = AppPlatformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1451,7 +1473,7 @@ async def test_list_applications_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( @@ -1478,11 +1500,6 @@ async def test_list_applications_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_applications_async_from_dict(): - await test_list_applications_async(request_type=dict) - - def test_list_applications_field_headers(): client = AppPlatformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1835,8 +1852,8 @@ async def test_list_applications_async_pages(): @pytest.mark.parametrize( "request_type", [ - platform.GetApplicationRequest, - dict, + platform.GetApplicationRequest(), + {}, ], ) def test_get_application(request_type, transport: str = "grpc"): @@ -1847,7 +1864,7 @@ def test_get_application(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_application), "__call__") as call: @@ -1899,9 +1916,10 @@ def test_get_application_non_empty_request_with_auto_populated_field(): client.get_application(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == platform.GetApplicationRequest( + request_msg = platform.GetApplicationRequest( name="name_value", ) + assert args[0] == request_msg def test_get_application_use_cached_wrapped_rpc(): @@ -1982,9 +2000,14 @@ async def test_get_application_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_application_async( - transport: str = "grpc_asyncio", request_type=platform.GetApplicationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + platform.GetApplicationRequest(), + {}, + ], +) +async def test_get_application_async(request_type, transport: str = "grpc_asyncio"): client = AppPlatformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1992,7 +2015,7 @@ async def test_get_application_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_application), "__call__") as call: @@ -2023,11 +2046,6 @@ async def test_get_application_async( assert response.billing_mode == platform.Application.BillingMode.PAYG -@pytest.mark.asyncio -async def test_get_application_async_from_dict(): - await test_get_application_async(request_type=dict) - - def test_get_application_field_headers(): client = AppPlatformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2174,8 +2192,8 @@ async def test_get_application_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - platform.CreateApplicationRequest, - dict, + platform.CreateApplicationRequest(), + {}, ], ) def test_create_application(request_type, transport: str = "grpc"): @@ -2186,7 +2204,7 @@ def test_create_application(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2233,11 +2251,12 @@ def test_create_application_non_empty_request_with_auto_populated_field(): client.create_application(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == platform.CreateApplicationRequest( + request_msg = platform.CreateApplicationRequest( parent="parent_value", application_id="application_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_application_use_cached_wrapped_rpc(): @@ -2332,9 +2351,14 @@ async def test_create_application_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_application_async( - transport: str = "grpc_asyncio", request_type=platform.CreateApplicationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + platform.CreateApplicationRequest(), + {}, + ], +) +async def test_create_application_async(request_type, transport: str = "grpc_asyncio"): client = AppPlatformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2342,7 +2366,7 @@ async def test_create_application_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( @@ -2364,11 +2388,6 @@ async def test_create_application_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_application_async_from_dict(): - await test_create_application_async(request_type=dict) - - def test_create_application_field_headers(): client = AppPlatformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2533,8 +2552,8 @@ async def test_create_application_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - platform.UpdateApplicationRequest, - dict, + platform.UpdateApplicationRequest(), + {}, ], ) def test_update_application(request_type, transport: str = "grpc"): @@ -2545,7 +2564,7 @@ def test_update_application(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2590,9 +2609,10 @@ def test_update_application_non_empty_request_with_auto_populated_field(): client.update_application(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == platform.UpdateApplicationRequest( + request_msg = platform.UpdateApplicationRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_application_use_cached_wrapped_rpc(): @@ -2687,9 +2707,14 @@ async def test_update_application_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_application_async( - transport: str = "grpc_asyncio", request_type=platform.UpdateApplicationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + platform.UpdateApplicationRequest(), + {}, + ], +) +async def test_update_application_async(request_type, transport: str = "grpc_asyncio"): client = AppPlatformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2697,7 +2722,7 @@ async def test_update_application_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( @@ -2719,11 +2744,6 @@ async def test_update_application_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_application_async_from_dict(): - await test_update_application_async(request_type=dict) - - def test_update_application_field_headers(): client = AppPlatformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2888,8 +2908,8 @@ async def test_update_application_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - platform.DeleteApplicationRequest, - dict, + platform.DeleteApplicationRequest(), + {}, ], ) def test_delete_application(request_type, transport: str = "grpc"): @@ -2900,7 +2920,7 @@ def test_delete_application(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2946,10 +2966,11 @@ def test_delete_application_non_empty_request_with_auto_populated_field(): client.delete_application(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == platform.DeleteApplicationRequest( + request_msg = platform.DeleteApplicationRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_application_use_cached_wrapped_rpc(): @@ -3044,9 +3065,14 @@ async def test_delete_application_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_application_async( - transport: str = "grpc_asyncio", request_type=platform.DeleteApplicationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + platform.DeleteApplicationRequest(), + {}, + ], +) +async def test_delete_application_async(request_type, transport: str = "grpc_asyncio"): client = AppPlatformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3054,7 +3080,7 @@ async def test_delete_application_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( @@ -3076,11 +3102,6 @@ async def test_delete_application_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_application_async_from_dict(): - await test_delete_application_async(request_type=dict) - - def test_delete_application_field_headers(): client = AppPlatformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3235,8 +3256,8 @@ async def test_delete_application_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - platform.DeployApplicationRequest, - dict, + platform.DeployApplicationRequest(), + {}, ], ) def test_deploy_application(request_type, transport: str = "grpc"): @@ -3247,7 +3268,7 @@ def test_deploy_application(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3293,10 +3314,11 @@ def test_deploy_application_non_empty_request_with_auto_populated_field(): client.deploy_application(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == platform.DeployApplicationRequest( + request_msg = platform.DeployApplicationRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_deploy_application_use_cached_wrapped_rpc(): @@ -3391,9 +3413,14 @@ async def test_deploy_application_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_deploy_application_async( - transport: str = "grpc_asyncio", request_type=platform.DeployApplicationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + platform.DeployApplicationRequest(), + {}, + ], +) +async def test_deploy_application_async(request_type, transport: str = "grpc_asyncio"): client = AppPlatformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3401,7 +3428,7 @@ async def test_deploy_application_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( @@ -3423,11 +3450,6 @@ async def test_deploy_application_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_deploy_application_async_from_dict(): - await test_deploy_application_async(request_type=dict) - - def test_deploy_application_field_headers(): client = AppPlatformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3582,8 +3604,8 @@ async def test_deploy_application_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - platform.UndeployApplicationRequest, - dict, + platform.UndeployApplicationRequest(), + {}, ], ) def test_undeploy_application(request_type, transport: str = "grpc"): @@ -3594,7 +3616,7 @@ def test_undeploy_application(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3640,10 +3662,11 @@ def test_undeploy_application_non_empty_request_with_auto_populated_field(): client.undeploy_application(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == platform.UndeployApplicationRequest( + request_msg = platform.UndeployApplicationRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_undeploy_application_use_cached_wrapped_rpc(): @@ -3738,8 +3761,15 @@ async def test_undeploy_application_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + platform.UndeployApplicationRequest(), + {}, + ], +) async def test_undeploy_application_async( - transport: str = "grpc_asyncio", request_type=platform.UndeployApplicationRequest + request_type, transport: str = "grpc_asyncio" ): client = AppPlatformAsyncClient( credentials=async_anonymous_credentials(), @@ -3748,7 +3778,7 @@ async def test_undeploy_application_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( @@ -3770,11 +3800,6 @@ async def test_undeploy_application_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_undeploy_application_async_from_dict(): - await test_undeploy_application_async(request_type=dict) - - def test_undeploy_application_field_headers(): client = AppPlatformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3929,8 +3954,8 @@ async def test_undeploy_application_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - platform.AddApplicationStreamInputRequest, - dict, + platform.AddApplicationStreamInputRequest(), + {}, ], ) def test_add_application_stream_input(request_type, transport: str = "grpc"): @@ -3941,7 +3966,7 @@ def test_add_application_stream_input(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3987,10 +4012,11 @@ def test_add_application_stream_input_non_empty_request_with_auto_populated_fiel client.add_application_stream_input(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == platform.AddApplicationStreamInputRequest( + request_msg = platform.AddApplicationStreamInputRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_add_application_stream_input_use_cached_wrapped_rpc(): @@ -4086,9 +4112,15 @@ async def test_add_application_stream_input_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + platform.AddApplicationStreamInputRequest(), + {}, + ], +) async def test_add_application_stream_input_async( - transport: str = "grpc_asyncio", - request_type=platform.AddApplicationStreamInputRequest, + request_type, transport: str = "grpc_asyncio" ): client = AppPlatformAsyncClient( credentials=async_anonymous_credentials(), @@ -4097,7 +4129,7 @@ async def test_add_application_stream_input_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( @@ -4119,11 +4151,6 @@ async def test_add_application_stream_input_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_add_application_stream_input_async_from_dict(): - await test_add_application_stream_input_async(request_type=dict) - - def test_add_application_stream_input_field_headers(): client = AppPlatformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4278,8 +4305,8 @@ async def test_add_application_stream_input_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - platform.RemoveApplicationStreamInputRequest, - dict, + platform.RemoveApplicationStreamInputRequest(), + {}, ], ) def test_remove_application_stream_input(request_type, transport: str = "grpc"): @@ -4290,7 +4317,7 @@ def test_remove_application_stream_input(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4336,10 +4363,11 @@ def test_remove_application_stream_input_non_empty_request_with_auto_populated_f client.remove_application_stream_input(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == platform.RemoveApplicationStreamInputRequest( + request_msg = platform.RemoveApplicationStreamInputRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_remove_application_stream_input_use_cached_wrapped_rpc(): @@ -4435,9 +4463,15 @@ async def test_remove_application_stream_input_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + platform.RemoveApplicationStreamInputRequest(), + {}, + ], +) async def test_remove_application_stream_input_async( - transport: str = "grpc_asyncio", - request_type=platform.RemoveApplicationStreamInputRequest, + request_type, transport: str = "grpc_asyncio" ): client = AppPlatformAsyncClient( credentials=async_anonymous_credentials(), @@ -4446,7 +4480,7 @@ async def test_remove_application_stream_input_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( @@ -4468,11 +4502,6 @@ async def test_remove_application_stream_input_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_remove_application_stream_input_async_from_dict(): - await test_remove_application_stream_input_async(request_type=dict) - - def test_remove_application_stream_input_field_headers(): client = AppPlatformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4627,8 +4656,8 @@ async def test_remove_application_stream_input_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - platform.UpdateApplicationStreamInputRequest, - dict, + platform.UpdateApplicationStreamInputRequest(), + {}, ], ) def test_update_application_stream_input(request_type, transport: str = "grpc"): @@ -4639,7 +4668,7 @@ def test_update_application_stream_input(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4685,10 +4714,11 @@ def test_update_application_stream_input_non_empty_request_with_auto_populated_f client.update_application_stream_input(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == platform.UpdateApplicationStreamInputRequest( + request_msg = platform.UpdateApplicationStreamInputRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_update_application_stream_input_use_cached_wrapped_rpc(): @@ -4784,9 +4814,15 @@ async def test_update_application_stream_input_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + platform.UpdateApplicationStreamInputRequest(), + {}, + ], +) async def test_update_application_stream_input_async( - transport: str = "grpc_asyncio", - request_type=platform.UpdateApplicationStreamInputRequest, + request_type, transport: str = "grpc_asyncio" ): client = AppPlatformAsyncClient( credentials=async_anonymous_credentials(), @@ -4795,7 +4831,7 @@ async def test_update_application_stream_input_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( @@ -4817,11 +4853,6 @@ async def test_update_application_stream_input_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_application_stream_input_async_from_dict(): - await test_update_application_stream_input_async(request_type=dict) - - def test_update_application_stream_input_field_headers(): client = AppPlatformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4976,8 +5007,8 @@ async def test_update_application_stream_input_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - platform.ListInstancesRequest, - dict, + platform.ListInstancesRequest(), + {}, ], ) def test_list_instances(request_type, transport: str = "grpc"): @@ -4988,7 +5019,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(type(client.transport.list_instances), "__call__") as call: @@ -5037,12 +5068,13 @@ 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] == platform.ListInstancesRequest( + request_msg = platform.ListInstancesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_instances_use_cached_wrapped_rpc(): @@ -5123,9 +5155,14 @@ async def test_list_instances_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_instances_async( - transport: str = "grpc_asyncio", request_type=platform.ListInstancesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + platform.ListInstancesRequest(), + {}, + ], +) +async def test_list_instances_async(request_type, transport: str = "grpc_asyncio"): client = AppPlatformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5133,7 +5170,7 @@ async def test_list_instances_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_instances), "__call__") as call: @@ -5158,11 +5195,6 @@ async def test_list_instances_async( 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 = AppPlatformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5499,8 +5531,8 @@ async def test_list_instances_async_pages(): @pytest.mark.parametrize( "request_type", [ - platform.GetInstanceRequest, - dict, + platform.GetInstanceRequest(), + {}, ], ) def test_get_instance(request_type, transport: str = "grpc"): @@ -5511,7 +5543,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(type(client.transport.get_instance), "__call__") as call: @@ -5563,9 +5595,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] == platform.GetInstanceRequest( + request_msg = platform.GetInstanceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_instance_use_cached_wrapped_rpc(): @@ -5646,9 +5679,14 @@ async def test_get_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_instance_async( - transport: str = "grpc_asyncio", request_type=platform.GetInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + platform.GetInstanceRequest(), + {}, + ], +) +async def test_get_instance_async(request_type, transport: str = "grpc_asyncio"): client = AppPlatformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5656,7 +5694,7 @@ async def test_get_instance_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_instance), "__call__") as call: @@ -5687,11 +5725,6 @@ async def test_get_instance_async( assert response.state == platform.Instance.State.CREATING -@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 = AppPlatformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5834,8 +5867,8 @@ async def test_get_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - platform.CreateApplicationInstancesRequest, - dict, + platform.CreateApplicationInstancesRequest(), + {}, ], ) def test_create_application_instances(request_type, transport: str = "grpc"): @@ -5846,7 +5879,7 @@ def test_create_application_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( @@ -5892,10 +5925,11 @@ def test_create_application_instances_non_empty_request_with_auto_populated_fiel client.create_application_instances(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == platform.CreateApplicationInstancesRequest( + request_msg = platform.CreateApplicationInstancesRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_application_instances_use_cached_wrapped_rpc(): @@ -5991,9 +6025,15 @@ async def test_create_application_instances_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + platform.CreateApplicationInstancesRequest(), + {}, + ], +) async def test_create_application_instances_async( - transport: str = "grpc_asyncio", - request_type=platform.CreateApplicationInstancesRequest, + request_type, transport: str = "grpc_asyncio" ): client = AppPlatformAsyncClient( credentials=async_anonymous_credentials(), @@ -6002,7 +6042,7 @@ async def test_create_application_instances_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( @@ -6024,11 +6064,6 @@ async def test_create_application_instances_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_application_instances_async_from_dict(): - await test_create_application_instances_async(request_type=dict) - - def test_create_application_instances_field_headers(): client = AppPlatformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6183,8 +6218,8 @@ async def test_create_application_instances_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - platform.DeleteApplicationInstancesRequest, - dict, + platform.DeleteApplicationInstancesRequest(), + {}, ], ) def test_delete_application_instances(request_type, transport: str = "grpc"): @@ -6195,7 +6230,7 @@ def test_delete_application_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( @@ -6241,10 +6276,11 @@ def test_delete_application_instances_non_empty_request_with_auto_populated_fiel client.delete_application_instances(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == platform.DeleteApplicationInstancesRequest( + request_msg = platform.DeleteApplicationInstancesRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_application_instances_use_cached_wrapped_rpc(): @@ -6340,9 +6376,15 @@ async def test_delete_application_instances_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + platform.DeleteApplicationInstancesRequest(), + {}, + ], +) async def test_delete_application_instances_async( - transport: str = "grpc_asyncio", - request_type=platform.DeleteApplicationInstancesRequest, + request_type, transport: str = "grpc_asyncio" ): client = AppPlatformAsyncClient( credentials=async_anonymous_credentials(), @@ -6351,7 +6393,7 @@ async def test_delete_application_instances_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( @@ -6373,11 +6415,6 @@ async def test_delete_application_instances_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_application_instances_async_from_dict(): - await test_delete_application_instances_async(request_type=dict) - - def test_delete_application_instances_field_headers(): client = AppPlatformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6532,8 +6569,8 @@ async def test_delete_application_instances_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - platform.UpdateApplicationInstancesRequest, - dict, + platform.UpdateApplicationInstancesRequest(), + {}, ], ) def test_update_application_instances(request_type, transport: str = "grpc"): @@ -6544,7 +6581,7 @@ def test_update_application_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( @@ -6590,10 +6627,11 @@ def test_update_application_instances_non_empty_request_with_auto_populated_fiel client.update_application_instances(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == platform.UpdateApplicationInstancesRequest( + request_msg = platform.UpdateApplicationInstancesRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_update_application_instances_use_cached_wrapped_rpc(): @@ -6689,9 +6727,15 @@ async def test_update_application_instances_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + platform.UpdateApplicationInstancesRequest(), + {}, + ], +) async def test_update_application_instances_async( - transport: str = "grpc_asyncio", - request_type=platform.UpdateApplicationInstancesRequest, + request_type, transport: str = "grpc_asyncio" ): client = AppPlatformAsyncClient( credentials=async_anonymous_credentials(), @@ -6700,7 +6744,7 @@ async def test_update_application_instances_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( @@ -6722,11 +6766,6 @@ async def test_update_application_instances_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_application_instances_async_from_dict(): - await test_update_application_instances_async(request_type=dict) - - def test_update_application_instances_field_headers(): client = AppPlatformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6915,8 +6954,8 @@ async def test_update_application_instances_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - platform.ListDraftsRequest, - dict, + platform.ListDraftsRequest(), + {}, ], ) def test_list_drafts(request_type, transport: str = "grpc"): @@ -6927,7 +6966,7 @@ def test_list_drafts(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_drafts), "__call__") as call: @@ -6976,12 +7015,13 @@ def test_list_drafts_non_empty_request_with_auto_populated_field(): client.list_drafts(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == platform.ListDraftsRequest( + request_msg = platform.ListDraftsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_drafts_use_cached_wrapped_rpc(): @@ -7062,9 +7102,14 @@ async def test_list_drafts_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_drafts_async( - transport: str = "grpc_asyncio", request_type=platform.ListDraftsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + platform.ListDraftsRequest(), + {}, + ], +) +async def test_list_drafts_async(request_type, transport: str = "grpc_asyncio"): client = AppPlatformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7072,7 +7117,7 @@ async def test_list_drafts_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_drafts), "__call__") as call: @@ -7097,11 +7142,6 @@ async def test_list_drafts_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_drafts_async_from_dict(): - await test_list_drafts_async(request_type=dict) - - def test_list_drafts_field_headers(): client = AppPlatformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7438,8 +7478,8 @@ async def test_list_drafts_async_pages(): @pytest.mark.parametrize( "request_type", [ - platform.GetDraftRequest, - dict, + platform.GetDraftRequest(), + {}, ], ) def test_get_draft(request_type, transport: str = "grpc"): @@ -7450,7 +7490,7 @@ def test_get_draft(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_draft), "__call__") as call: @@ -7498,9 +7538,10 @@ def test_get_draft_non_empty_request_with_auto_populated_field(): client.get_draft(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == platform.GetDraftRequest( + request_msg = platform.GetDraftRequest( name="name_value", ) + assert args[0] == request_msg def test_get_draft_use_cached_wrapped_rpc(): @@ -7579,9 +7620,14 @@ async def test_get_draft_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_draft_async( - transport: str = "grpc_asyncio", request_type=platform.GetDraftRequest -): +@pytest.mark.parametrize( + "request_type", + [ + platform.GetDraftRequest(), + {}, + ], +) +async def test_get_draft_async(request_type, transport: str = "grpc_asyncio"): client = AppPlatformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7589,7 +7635,7 @@ async def test_get_draft_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_draft), "__call__") as call: @@ -7616,11 +7662,6 @@ async def test_get_draft_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_get_draft_async_from_dict(): - await test_get_draft_async(request_type=dict) - - def test_get_draft_field_headers(): client = AppPlatformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7763,8 +7804,8 @@ async def test_get_draft_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - platform.CreateDraftRequest, - dict, + platform.CreateDraftRequest(), + {}, ], ) def test_create_draft(request_type, transport: str = "grpc"): @@ -7775,7 +7816,7 @@ def test_create_draft(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_draft), "__call__") as call: @@ -7818,11 +7859,12 @@ def test_create_draft_non_empty_request_with_auto_populated_field(): client.create_draft(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == platform.CreateDraftRequest( + request_msg = platform.CreateDraftRequest( parent="parent_value", draft_id="draft_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_draft_use_cached_wrapped_rpc(): @@ -7913,9 +7955,14 @@ async def test_create_draft_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_draft_async( - transport: str = "grpc_asyncio", request_type=platform.CreateDraftRequest -): +@pytest.mark.parametrize( + "request_type", + [ + platform.CreateDraftRequest(), + {}, + ], +) +async def test_create_draft_async(request_type, transport: str = "grpc_asyncio"): client = AppPlatformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7923,7 +7970,7 @@ async def test_create_draft_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_draft), "__call__") as call: @@ -7943,11 +7990,6 @@ async def test_create_draft_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_draft_async_from_dict(): - await test_create_draft_async(request_type=dict) - - def test_create_draft_field_headers(): client = AppPlatformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8114,8 +8156,8 @@ async def test_create_draft_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - platform.UpdateDraftRequest, - dict, + platform.UpdateDraftRequest(), + {}, ], ) def test_update_draft(request_type, transport: str = "grpc"): @@ -8126,7 +8168,7 @@ def test_update_draft(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_draft), "__call__") as call: @@ -8167,9 +8209,10 @@ def test_update_draft_non_empty_request_with_auto_populated_field(): client.update_draft(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == platform.UpdateDraftRequest( + request_msg = platform.UpdateDraftRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_draft_use_cached_wrapped_rpc(): @@ -8260,9 +8303,14 @@ async def test_update_draft_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_draft_async( - transport: str = "grpc_asyncio", request_type=platform.UpdateDraftRequest -): +@pytest.mark.parametrize( + "request_type", + [ + platform.UpdateDraftRequest(), + {}, + ], +) +async def test_update_draft_async(request_type, transport: str = "grpc_asyncio"): client = AppPlatformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8270,7 +8318,7 @@ async def test_update_draft_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_draft), "__call__") as call: @@ -8290,11 +8338,6 @@ async def test_update_draft_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_draft_async_from_dict(): - await test_update_draft_async(request_type=dict) - - def test_update_draft_field_headers(): client = AppPlatformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8451,8 +8494,8 @@ async def test_update_draft_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - platform.DeleteDraftRequest, - dict, + platform.DeleteDraftRequest(), + {}, ], ) def test_delete_draft(request_type, transport: str = "grpc"): @@ -8463,7 +8506,7 @@ def test_delete_draft(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_draft), "__call__") as call: @@ -8505,10 +8548,11 @@ def test_delete_draft_non_empty_request_with_auto_populated_field(): client.delete_draft(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == platform.DeleteDraftRequest( + request_msg = platform.DeleteDraftRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_draft_use_cached_wrapped_rpc(): @@ -8599,9 +8643,14 @@ async def test_delete_draft_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_draft_async( - transport: str = "grpc_asyncio", request_type=platform.DeleteDraftRequest -): +@pytest.mark.parametrize( + "request_type", + [ + platform.DeleteDraftRequest(), + {}, + ], +) +async def test_delete_draft_async(request_type, transport: str = "grpc_asyncio"): client = AppPlatformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8609,7 +8658,7 @@ async def test_delete_draft_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_draft), "__call__") as call: @@ -8629,11 +8678,6 @@ async def test_delete_draft_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_draft_async_from_dict(): - await test_delete_draft_async(request_type=dict) - - def test_delete_draft_field_headers(): client = AppPlatformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8780,8 +8824,8 @@ async def test_delete_draft_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - platform.ListProcessorsRequest, - dict, + platform.ListProcessorsRequest(), + {}, ], ) def test_list_processors(request_type, transport: str = "grpc"): @@ -8792,7 +8836,7 @@ def test_list_processors(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_processors), "__call__") as call: @@ -8841,12 +8885,13 @@ def test_list_processors_non_empty_request_with_auto_populated_field(): client.list_processors(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == platform.ListProcessorsRequest( + request_msg = platform.ListProcessorsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_processors_use_cached_wrapped_rpc(): @@ -8927,9 +8972,14 @@ async def test_list_processors_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_processors_async( - transport: str = "grpc_asyncio", request_type=platform.ListProcessorsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + platform.ListProcessorsRequest(), + {}, + ], +) +async def test_list_processors_async(request_type, transport: str = "grpc_asyncio"): client = AppPlatformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8937,7 +8987,7 @@ async def test_list_processors_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_processors), "__call__") as call: @@ -8962,11 +9012,6 @@ async def test_list_processors_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_processors_async_from_dict(): - await test_list_processors_async(request_type=dict) - - def test_list_processors_field_headers(): client = AppPlatformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9303,8 +9348,8 @@ async def test_list_processors_async_pages(): @pytest.mark.parametrize( "request_type", [ - platform.ListPrebuiltProcessorsRequest, - dict, + platform.ListPrebuiltProcessorsRequest(), + {}, ], ) def test_list_prebuilt_processors(request_type, transport: str = "grpc"): @@ -9315,7 +9360,7 @@ def test_list_prebuilt_processors(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9360,9 +9405,10 @@ def test_list_prebuilt_processors_non_empty_request_with_auto_populated_field(): client.list_prebuilt_processors(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == platform.ListPrebuiltProcessorsRequest( + request_msg = platform.ListPrebuiltProcessorsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_list_prebuilt_processors_use_cached_wrapped_rpc(): @@ -9448,8 +9494,15 @@ async def test_list_prebuilt_processors_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + platform.ListPrebuiltProcessorsRequest(), + {}, + ], +) async def test_list_prebuilt_processors_async( - transport: str = "grpc_asyncio", request_type=platform.ListPrebuiltProcessorsRequest + request_type, transport: str = "grpc_asyncio" ): client = AppPlatformAsyncClient( credentials=async_anonymous_credentials(), @@ -9458,7 +9511,7 @@ async def test_list_prebuilt_processors_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( @@ -9480,11 +9533,6 @@ async def test_list_prebuilt_processors_async( assert isinstance(response, platform.ListPrebuiltProcessorsResponse) -@pytest.mark.asyncio -async def test_list_prebuilt_processors_async_from_dict(): - await test_list_prebuilt_processors_async(request_type=dict) - - def test_list_prebuilt_processors_field_headers(): client = AppPlatformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9639,8 +9687,8 @@ async def test_list_prebuilt_processors_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - platform.GetProcessorRequest, - dict, + platform.GetProcessorRequest(), + {}, ], ) def test_get_processor(request_type, transport: str = "grpc"): @@ -9651,7 +9699,7 @@ def test_get_processor(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_processor), "__call__") as call: @@ -9721,9 +9769,10 @@ def test_get_processor_non_empty_request_with_auto_populated_field(): client.get_processor(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == platform.GetProcessorRequest( + request_msg = platform.GetProcessorRequest( name="name_value", ) + assert args[0] == request_msg def test_get_processor_use_cached_wrapped_rpc(): @@ -9804,9 +9853,14 @@ async def test_get_processor_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_processor_async( - transport: str = "grpc_asyncio", request_type=platform.GetProcessorRequest -): +@pytest.mark.parametrize( + "request_type", + [ + platform.GetProcessorRequest(), + {}, + ], +) +async def test_get_processor_async(request_type, transport: str = "grpc_asyncio"): client = AppPlatformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9814,7 +9868,7 @@ async def test_get_processor_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_processor), "__call__") as call: @@ -9863,11 +9917,6 @@ async def test_get_processor_async( ] -@pytest.mark.asyncio -async def test_get_processor_async_from_dict(): - await test_get_processor_async(request_type=dict) - - def test_get_processor_field_headers(): client = AppPlatformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10010,8 +10059,8 @@ async def test_get_processor_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - platform.CreateProcessorRequest, - dict, + platform.CreateProcessorRequest(), + {}, ], ) def test_create_processor(request_type, transport: str = "grpc"): @@ -10022,7 +10071,7 @@ def test_create_processor(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_processor), "__call__") as call: @@ -10065,11 +10114,12 @@ def test_create_processor_non_empty_request_with_auto_populated_field(): client.create_processor(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == platform.CreateProcessorRequest( + request_msg = platform.CreateProcessorRequest( parent="parent_value", processor_id="processor_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_processor_use_cached_wrapped_rpc(): @@ -10162,9 +10212,14 @@ async def test_create_processor_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_processor_async( - transport: str = "grpc_asyncio", request_type=platform.CreateProcessorRequest -): +@pytest.mark.parametrize( + "request_type", + [ + platform.CreateProcessorRequest(), + {}, + ], +) +async def test_create_processor_async(request_type, transport: str = "grpc_asyncio"): client = AppPlatformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10172,7 +10227,7 @@ async def test_create_processor_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_processor), "__call__") as call: @@ -10192,11 +10247,6 @@ async def test_create_processor_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_processor_async_from_dict(): - await test_create_processor_async(request_type=dict) - - def test_create_processor_field_headers(): client = AppPlatformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10363,8 +10413,8 @@ async def test_create_processor_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - platform.UpdateProcessorRequest, - dict, + platform.UpdateProcessorRequest(), + {}, ], ) def test_update_processor(request_type, transport: str = "grpc"): @@ -10375,7 +10425,7 @@ def test_update_processor(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_processor), "__call__") as call: @@ -10416,9 +10466,10 @@ def test_update_processor_non_empty_request_with_auto_populated_field(): client.update_processor(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == platform.UpdateProcessorRequest( + request_msg = platform.UpdateProcessorRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_processor_use_cached_wrapped_rpc(): @@ -10511,9 +10562,14 @@ async def test_update_processor_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_processor_async( - transport: str = "grpc_asyncio", request_type=platform.UpdateProcessorRequest -): +@pytest.mark.parametrize( + "request_type", + [ + platform.UpdateProcessorRequest(), + {}, + ], +) +async def test_update_processor_async(request_type, transport: str = "grpc_asyncio"): client = AppPlatformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10521,7 +10577,7 @@ async def test_update_processor_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_processor), "__call__") as call: @@ -10541,11 +10597,6 @@ async def test_update_processor_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_processor_async_from_dict(): - await test_update_processor_async(request_type=dict) - - def test_update_processor_field_headers(): client = AppPlatformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10702,8 +10753,8 @@ async def test_update_processor_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - platform.DeleteProcessorRequest, - dict, + platform.DeleteProcessorRequest(), + {}, ], ) def test_delete_processor(request_type, transport: str = "grpc"): @@ -10714,7 +10765,7 @@ def test_delete_processor(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_processor), "__call__") as call: @@ -10756,10 +10807,11 @@ def test_delete_processor_non_empty_request_with_auto_populated_field(): client.delete_processor(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == platform.DeleteProcessorRequest( + request_msg = platform.DeleteProcessorRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_processor_use_cached_wrapped_rpc(): @@ -10852,9 +10904,14 @@ async def test_delete_processor_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_processor_async( - transport: str = "grpc_asyncio", request_type=platform.DeleteProcessorRequest -): +@pytest.mark.parametrize( + "request_type", + [ + platform.DeleteProcessorRequest(), + {}, + ], +) +async def test_delete_processor_async(request_type, transport: str = "grpc_asyncio"): client = AppPlatformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10862,7 +10919,7 @@ async def test_delete_processor_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_processor), "__call__") as call: @@ -10882,11 +10939,6 @@ async def test_delete_processor_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_processor_async_from_dict(): - await test_delete_processor_async(request_type=dict) - - def test_delete_processor_field_headers(): client = AppPlatformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16401,7 +16453,6 @@ def test_list_applications_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.ListApplicationsRequest() - assert args[0] == request_msg @@ -16422,7 +16473,6 @@ def test_get_application_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.GetApplicationRequest() - assert args[0] == request_msg @@ -16445,7 +16495,6 @@ def test_create_application_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.CreateApplicationRequest() - assert args[0] == request_msg @@ -16468,7 +16517,6 @@ def test_update_application_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.UpdateApplicationRequest() - assert args[0] == request_msg @@ -16491,7 +16539,6 @@ def test_delete_application_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.DeleteApplicationRequest() - assert args[0] == request_msg @@ -16514,7 +16561,6 @@ def test_deploy_application_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.DeployApplicationRequest() - assert args[0] == request_msg @@ -16537,7 +16583,6 @@ def test_undeploy_application_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.UndeployApplicationRequest() - assert args[0] == request_msg @@ -16560,7 +16605,6 @@ def test_add_application_stream_input_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.AddApplicationStreamInputRequest() - assert args[0] == request_msg @@ -16583,7 +16627,6 @@ def test_remove_application_stream_input_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.RemoveApplicationStreamInputRequest() - assert args[0] == request_msg @@ -16606,7 +16649,6 @@ def test_update_application_stream_input_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.UpdateApplicationStreamInputRequest() - assert args[0] == request_msg @@ -16627,7 +16669,6 @@ def test_list_instances_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.ListInstancesRequest() - assert args[0] == request_msg @@ -16648,7 +16689,6 @@ def test_get_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.GetInstanceRequest() - assert args[0] == request_msg @@ -16671,7 +16711,6 @@ def test_create_application_instances_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.CreateApplicationInstancesRequest() - assert args[0] == request_msg @@ -16694,7 +16733,6 @@ def test_delete_application_instances_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.DeleteApplicationInstancesRequest() - assert args[0] == request_msg @@ -16717,7 +16755,6 @@ def test_update_application_instances_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.UpdateApplicationInstancesRequest() - assert args[0] == request_msg @@ -16738,7 +16775,6 @@ def test_list_drafts_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.ListDraftsRequest() - assert args[0] == request_msg @@ -16759,7 +16795,6 @@ def test_get_draft_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.GetDraftRequest() - assert args[0] == request_msg @@ -16780,7 +16815,6 @@ def test_create_draft_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.CreateDraftRequest() - assert args[0] == request_msg @@ -16801,7 +16835,6 @@ def test_update_draft_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.UpdateDraftRequest() - assert args[0] == request_msg @@ -16822,7 +16855,6 @@ def test_delete_draft_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.DeleteDraftRequest() - assert args[0] == request_msg @@ -16843,7 +16875,6 @@ def test_list_processors_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.ListProcessorsRequest() - assert args[0] == request_msg @@ -16866,7 +16897,6 @@ def test_list_prebuilt_processors_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.ListPrebuiltProcessorsRequest() - assert args[0] == request_msg @@ -16887,7 +16917,6 @@ def test_get_processor_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.GetProcessorRequest() - assert args[0] == request_msg @@ -16908,7 +16937,6 @@ def test_create_processor_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.CreateProcessorRequest() - assert args[0] == request_msg @@ -16929,7 +16957,6 @@ def test_update_processor_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.UpdateProcessorRequest() - assert args[0] == request_msg @@ -16950,7 +16977,6 @@ def test_delete_processor_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.DeleteProcessorRequest() - assert args[0] == request_msg @@ -16994,7 +17020,6 @@ async def test_list_applications_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.ListApplicationsRequest() - assert args[0] == request_msg @@ -17025,7 +17050,6 @@ async def test_get_application_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.GetApplicationRequest() - assert args[0] == request_msg @@ -17052,7 +17076,6 @@ async def test_create_application_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.CreateApplicationRequest() - assert args[0] == request_msg @@ -17079,7 +17102,6 @@ async def test_update_application_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.UpdateApplicationRequest() - assert args[0] == request_msg @@ -17106,7 +17128,6 @@ async def test_delete_application_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.DeleteApplicationRequest() - assert args[0] == request_msg @@ -17133,7 +17154,6 @@ async def test_deploy_application_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.DeployApplicationRequest() - assert args[0] == request_msg @@ -17160,7 +17180,6 @@ async def test_undeploy_application_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.UndeployApplicationRequest() - assert args[0] == request_msg @@ -17187,7 +17206,6 @@ async def test_add_application_stream_input_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.AddApplicationStreamInputRequest() - assert args[0] == request_msg @@ -17214,7 +17232,6 @@ async def test_remove_application_stream_input_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.RemoveApplicationStreamInputRequest() - assert args[0] == request_msg @@ -17241,7 +17258,6 @@ async def test_update_application_stream_input_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.UpdateApplicationStreamInputRequest() - assert args[0] == request_msg @@ -17269,7 +17285,6 @@ async def test_list_instances_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.ListInstancesRequest() - assert args[0] == request_msg @@ -17300,7 +17315,6 @@ async def test_get_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.GetInstanceRequest() - assert args[0] == request_msg @@ -17327,7 +17341,6 @@ async def test_create_application_instances_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.CreateApplicationInstancesRequest() - assert args[0] == request_msg @@ -17354,7 +17367,6 @@ async def test_delete_application_instances_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.DeleteApplicationInstancesRequest() - assert args[0] == request_msg @@ -17381,7 +17393,6 @@ async def test_update_application_instances_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.UpdateApplicationInstancesRequest() - assert args[0] == request_msg @@ -17409,7 +17420,6 @@ async def test_list_drafts_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.ListDraftsRequest() - assert args[0] == request_msg @@ -17438,7 +17448,6 @@ async def test_get_draft_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.GetDraftRequest() - assert args[0] == request_msg @@ -17463,7 +17472,6 @@ async def test_create_draft_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.CreateDraftRequest() - assert args[0] == request_msg @@ -17488,7 +17496,6 @@ async def test_update_draft_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.UpdateDraftRequest() - assert args[0] == request_msg @@ -17513,7 +17520,6 @@ async def test_delete_draft_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.DeleteDraftRequest() - assert args[0] == request_msg @@ -17541,7 +17547,6 @@ async def test_list_processors_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.ListProcessorsRequest() - assert args[0] == request_msg @@ -17568,7 +17573,6 @@ async def test_list_prebuilt_processors_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.ListPrebuiltProcessorsRequest() - assert args[0] == request_msg @@ -17608,7 +17612,6 @@ async def test_get_processor_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.GetProcessorRequest() - assert args[0] == request_msg @@ -17633,7 +17636,6 @@ async def test_create_processor_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.CreateProcessorRequest() - assert args[0] == request_msg @@ -17658,7 +17660,6 @@ async def test_update_processor_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.UpdateProcessorRequest() - assert args[0] == request_msg @@ -17683,7 +17684,6 @@ async def test_delete_processor_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.DeleteProcessorRequest() - assert args[0] == request_msg @@ -22567,7 +22567,6 @@ def test_list_applications_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.ListApplicationsRequest() - assert args[0] == request_msg @@ -22587,7 +22586,6 @@ def test_get_application_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.GetApplicationRequest() - assert args[0] == request_msg @@ -22609,7 +22607,6 @@ def test_create_application_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.CreateApplicationRequest() - assert args[0] == request_msg @@ -22631,7 +22628,6 @@ def test_update_application_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.UpdateApplicationRequest() - assert args[0] == request_msg @@ -22653,7 +22649,6 @@ def test_delete_application_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.DeleteApplicationRequest() - assert args[0] == request_msg @@ -22675,7 +22670,6 @@ def test_deploy_application_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.DeployApplicationRequest() - assert args[0] == request_msg @@ -22697,7 +22691,6 @@ def test_undeploy_application_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.UndeployApplicationRequest() - assert args[0] == request_msg @@ -22719,7 +22712,6 @@ def test_add_application_stream_input_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.AddApplicationStreamInputRequest() - assert args[0] == request_msg @@ -22741,7 +22733,6 @@ def test_remove_application_stream_input_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.RemoveApplicationStreamInputRequest() - assert args[0] == request_msg @@ -22763,7 +22754,6 @@ def test_update_application_stream_input_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.UpdateApplicationStreamInputRequest() - assert args[0] == request_msg @@ -22783,7 +22773,6 @@ def test_list_instances_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.ListInstancesRequest() - assert args[0] == request_msg @@ -22803,7 +22792,6 @@ def test_get_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.GetInstanceRequest() - assert args[0] == request_msg @@ -22825,7 +22813,6 @@ def test_create_application_instances_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.CreateApplicationInstancesRequest() - assert args[0] == request_msg @@ -22847,7 +22834,6 @@ def test_delete_application_instances_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.DeleteApplicationInstancesRequest() - assert args[0] == request_msg @@ -22869,7 +22855,6 @@ def test_update_application_instances_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.UpdateApplicationInstancesRequest() - assert args[0] == request_msg @@ -22889,7 +22874,6 @@ def test_list_drafts_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.ListDraftsRequest() - assert args[0] == request_msg @@ -22909,7 +22893,6 @@ def test_get_draft_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.GetDraftRequest() - assert args[0] == request_msg @@ -22929,7 +22912,6 @@ def test_create_draft_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.CreateDraftRequest() - assert args[0] == request_msg @@ -22949,7 +22931,6 @@ def test_update_draft_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.UpdateDraftRequest() - assert args[0] == request_msg @@ -22969,7 +22950,6 @@ def test_delete_draft_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.DeleteDraftRequest() - assert args[0] == request_msg @@ -22989,7 +22969,6 @@ def test_list_processors_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.ListProcessorsRequest() - assert args[0] == request_msg @@ -23011,7 +22990,6 @@ def test_list_prebuilt_processors_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.ListPrebuiltProcessorsRequest() - assert args[0] == request_msg @@ -23031,7 +23009,6 @@ def test_get_processor_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.GetProcessorRequest() - assert args[0] == request_msg @@ -23051,7 +23028,6 @@ def test_create_processor_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.CreateProcessorRequest() - assert args[0] == request_msg @@ -23071,7 +23047,6 @@ def test_update_processor_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.UpdateProcessorRequest() - assert args[0] == request_msg @@ -23091,7 +23066,6 @@ def test_delete_processor_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.DeleteProcessorRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-visionai/tests/unit/gapic/visionai_v1/test_health_check_service.py b/packages/google-cloud-visionai/tests/unit/gapic/visionai_v1/test_health_check_service.py index 4004674345a3..fd930e06e46f 100644 --- a/packages/google-cloud-visionai/tests/unit/gapic/visionai_v1/test_health_check_service.py +++ b/packages/google-cloud-visionai/tests/unit/gapic/visionai_v1/test_health_check_service.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 @@ -113,6 +114,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" @@ -1358,8 +1374,8 @@ def test_health_check_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - health_service.HealthCheckRequest, - dict, + health_service.HealthCheckRequest(), + {}, ], ) def test_health_check(request_type, transport: str = "grpc"): @@ -1370,7 +1386,7 @@ def test_health_check(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.health_check), "__call__") as call: @@ -1416,9 +1432,10 @@ def test_health_check_non_empty_request_with_auto_populated_field(): client.health_check(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == health_service.HealthCheckRequest( + request_msg = health_service.HealthCheckRequest( cluster="cluster_value", ) + assert args[0] == request_msg def test_health_check_use_cached_wrapped_rpc(): @@ -1499,9 +1516,14 @@ async def test_health_check_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_health_check_async( - transport: str = "grpc_asyncio", request_type=health_service.HealthCheckRequest -): +@pytest.mark.parametrize( + "request_type", + [ + health_service.HealthCheckRequest(), + {}, + ], +) +async def test_health_check_async(request_type, transport: str = "grpc_asyncio"): client = HealthCheckServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1509,7 +1531,7 @@ async def test_health_check_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.health_check), "__call__") as call: @@ -1534,11 +1556,6 @@ async def test_health_check_async( assert response.reason == "reason_value" -@pytest.mark.asyncio -async def test_health_check_async_from_dict(): - await test_health_check_async(request_type=dict) - - def test_health_check_field_headers(): client = HealthCheckServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1759,7 +1776,6 @@ def test_health_check_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = health_service.HealthCheckRequest() - assert args[0] == request_msg @@ -1801,7 +1817,6 @@ async def test_health_check_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = health_service.HealthCheckRequest() - assert args[0] == request_msg @@ -2342,7 +2357,6 @@ def test_health_check_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = health_service.HealthCheckRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-visionai/tests/unit/gapic/visionai_v1/test_live_video_analytics.py b/packages/google-cloud-visionai/tests/unit/gapic/visionai_v1/test_live_video_analytics.py index a9ae32ae44e8..5b4df2010cf8 100644 --- a/packages/google-cloud-visionai/tests/unit/gapic/visionai_v1/test_live_video_analytics.py +++ b/packages/google-cloud-visionai/tests/unit/gapic/visionai_v1/test_live_video_analytics.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 @@ -121,6 +122,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" @@ -1366,8 +1382,8 @@ def test_live_video_analytics_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - lva_service.ListPublicOperatorsRequest, - dict, + lva_service.ListPublicOperatorsRequest(), + {}, ], ) def test_list_public_operators(request_type, transport: str = "grpc"): @@ -1378,7 +1394,7 @@ def test_list_public_operators(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1429,12 +1445,13 @@ def test_list_public_operators_non_empty_request_with_auto_populated_field(): client.list_public_operators(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == lva_service.ListPublicOperatorsRequest( + request_msg = lva_service.ListPublicOperatorsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_public_operators_use_cached_wrapped_rpc(): @@ -1520,8 +1537,15 @@ async def test_list_public_operators_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + lva_service.ListPublicOperatorsRequest(), + {}, + ], +) async def test_list_public_operators_async( - transport: str = "grpc_asyncio", request_type=lva_service.ListPublicOperatorsRequest + request_type, transport: str = "grpc_asyncio" ): client = LiveVideoAnalyticsAsyncClient( credentials=async_anonymous_credentials(), @@ -1530,7 +1554,7 @@ async def test_list_public_operators_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( @@ -1555,11 +1579,6 @@ async def test_list_public_operators_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_public_operators_async_from_dict(): - await test_list_public_operators_async(request_type=dict) - - def test_list_public_operators_field_headers(): client = LiveVideoAnalyticsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1912,8 +1931,8 @@ async def test_list_public_operators_async_pages(): @pytest.mark.parametrize( "request_type", [ - lva_service.ResolveOperatorInfoRequest, - dict, + lva_service.ResolveOperatorInfoRequest(), + {}, ], ) def test_resolve_operator_info(request_type, transport: str = "grpc"): @@ -1924,7 +1943,7 @@ def test_resolve_operator_info(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1969,9 +1988,10 @@ def test_resolve_operator_info_non_empty_request_with_auto_populated_field(): client.resolve_operator_info(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == lva_service.ResolveOperatorInfoRequest( + request_msg = lva_service.ResolveOperatorInfoRequest( parent="parent_value", ) + assert args[0] == request_msg def test_resolve_operator_info_use_cached_wrapped_rpc(): @@ -2057,8 +2077,15 @@ async def test_resolve_operator_info_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + lva_service.ResolveOperatorInfoRequest(), + {}, + ], +) async def test_resolve_operator_info_async( - transport: str = "grpc_asyncio", request_type=lva_service.ResolveOperatorInfoRequest + request_type, transport: str = "grpc_asyncio" ): client = LiveVideoAnalyticsAsyncClient( credentials=async_anonymous_credentials(), @@ -2067,7 +2094,7 @@ async def test_resolve_operator_info_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( @@ -2089,11 +2116,6 @@ async def test_resolve_operator_info_async( assert isinstance(response, lva_service.ResolveOperatorInfoResponse) -@pytest.mark.asyncio -async def test_resolve_operator_info_async_from_dict(): - await test_resolve_operator_info_async(request_type=dict) - - def test_resolve_operator_info_field_headers(): client = LiveVideoAnalyticsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2258,8 +2280,8 @@ async def test_resolve_operator_info_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - lva_service.ListOperatorsRequest, - dict, + lva_service.ListOperatorsRequest(), + {}, ], ) def test_list_operators(request_type, transport: str = "grpc"): @@ -2270,7 +2292,7 @@ def test_list_operators(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_operators), "__call__") as call: @@ -2319,12 +2341,13 @@ def test_list_operators_non_empty_request_with_auto_populated_field(): client.list_operators(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == lva_service.ListOperatorsRequest( + request_msg = lva_service.ListOperatorsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_operators_use_cached_wrapped_rpc(): @@ -2405,9 +2428,14 @@ async def test_list_operators_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_operators_async( - transport: str = "grpc_asyncio", request_type=lva_service.ListOperatorsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + lva_service.ListOperatorsRequest(), + {}, + ], +) +async def test_list_operators_async(request_type, transport: str = "grpc_asyncio"): client = LiveVideoAnalyticsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2415,7 +2443,7 @@ async def test_list_operators_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_operators), "__call__") as call: @@ -2440,11 +2468,6 @@ async def test_list_operators_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_operators_async_from_dict(): - await test_list_operators_async(request_type=dict) - - def test_list_operators_field_headers(): client = LiveVideoAnalyticsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2781,8 +2804,8 @@ async def test_list_operators_async_pages(): @pytest.mark.parametrize( "request_type", [ - lva_service.GetOperatorRequest, - dict, + lva_service.GetOperatorRequest(), + {}, ], ) def test_get_operator(request_type, transport: str = "grpc"): @@ -2793,7 +2816,7 @@ def test_get_operator(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_operator), "__call__") as call: @@ -2839,9 +2862,10 @@ def test_get_operator_non_empty_request_with_auto_populated_field(): client.get_operator(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == lva_service.GetOperatorRequest( + request_msg = lva_service.GetOperatorRequest( name="name_value", ) + assert args[0] == request_msg def test_get_operator_use_cached_wrapped_rpc(): @@ -2922,9 +2946,14 @@ async def test_get_operator_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_operator_async( - transport: str = "grpc_asyncio", request_type=lva_service.GetOperatorRequest -): +@pytest.mark.parametrize( + "request_type", + [ + lva_service.GetOperatorRequest(), + {}, + ], +) +async def test_get_operator_async(request_type, transport: str = "grpc_asyncio"): client = LiveVideoAnalyticsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2932,7 +2961,7 @@ async def test_get_operator_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_operator), "__call__") as call: @@ -2957,11 +2986,6 @@ async def test_get_operator_async( assert response.docker_image == "docker_image_value" -@pytest.mark.asyncio -async def test_get_operator_async_from_dict(): - await test_get_operator_async(request_type=dict) - - def test_get_operator_field_headers(): client = LiveVideoAnalyticsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3108,8 +3132,8 @@ async def test_get_operator_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - lva_service.CreateOperatorRequest, - dict, + lva_service.CreateOperatorRequest(), + {}, ], ) def test_create_operator(request_type, transport: str = "grpc"): @@ -3120,7 +3144,7 @@ def test_create_operator(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_operator), "__call__") as call: @@ -3163,11 +3187,12 @@ def test_create_operator_non_empty_request_with_auto_populated_field(): client.create_operator(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == lva_service.CreateOperatorRequest( + request_msg = lva_service.CreateOperatorRequest( parent="parent_value", operator_id="operator_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_operator_use_cached_wrapped_rpc(): @@ -3258,9 +3283,14 @@ async def test_create_operator_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_operator_async( - transport: str = "grpc_asyncio", request_type=lva_service.CreateOperatorRequest -): +@pytest.mark.parametrize( + "request_type", + [ + lva_service.CreateOperatorRequest(), + {}, + ], +) +async def test_create_operator_async(request_type, transport: str = "grpc_asyncio"): client = LiveVideoAnalyticsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3268,7 +3298,7 @@ async def test_create_operator_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_operator), "__call__") as call: @@ -3288,11 +3318,6 @@ async def test_create_operator_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_operator_async_from_dict(): - await test_create_operator_async(request_type=dict) - - def test_create_operator_field_headers(): client = LiveVideoAnalyticsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3459,8 +3484,8 @@ async def test_create_operator_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - lva_service.UpdateOperatorRequest, - dict, + lva_service.UpdateOperatorRequest(), + {}, ], ) def test_update_operator(request_type, transport: str = "grpc"): @@ -3471,7 +3496,7 @@ def test_update_operator(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_operator), "__call__") as call: @@ -3512,9 +3537,10 @@ def test_update_operator_non_empty_request_with_auto_populated_field(): client.update_operator(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == lva_service.UpdateOperatorRequest( + request_msg = lva_service.UpdateOperatorRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_operator_use_cached_wrapped_rpc(): @@ -3605,9 +3631,14 @@ async def test_update_operator_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_operator_async( - transport: str = "grpc_asyncio", request_type=lva_service.UpdateOperatorRequest -): +@pytest.mark.parametrize( + "request_type", + [ + lva_service.UpdateOperatorRequest(), + {}, + ], +) +async def test_update_operator_async(request_type, transport: str = "grpc_asyncio"): client = LiveVideoAnalyticsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3615,7 +3646,7 @@ async def test_update_operator_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_operator), "__call__") as call: @@ -3635,11 +3666,6 @@ async def test_update_operator_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_operator_async_from_dict(): - await test_update_operator_async(request_type=dict) - - def test_update_operator_field_headers(): client = LiveVideoAnalyticsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3796,8 +3822,8 @@ async def test_update_operator_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - lva_service.DeleteOperatorRequest, - dict, + lva_service.DeleteOperatorRequest(), + {}, ], ) def test_delete_operator(request_type, transport: str = "grpc"): @@ -3808,7 +3834,7 @@ def test_delete_operator(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_operator), "__call__") as call: @@ -3850,10 +3876,11 @@ def test_delete_operator_non_empty_request_with_auto_populated_field(): client.delete_operator(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == lva_service.DeleteOperatorRequest( + request_msg = lva_service.DeleteOperatorRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_operator_use_cached_wrapped_rpc(): @@ -3944,9 +3971,14 @@ async def test_delete_operator_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_operator_async( - transport: str = "grpc_asyncio", request_type=lva_service.DeleteOperatorRequest -): +@pytest.mark.parametrize( + "request_type", + [ + lva_service.DeleteOperatorRequest(), + {}, + ], +) +async def test_delete_operator_async(request_type, transport: str = "grpc_asyncio"): client = LiveVideoAnalyticsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3954,7 +3986,7 @@ async def test_delete_operator_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_operator), "__call__") as call: @@ -3974,11 +4006,6 @@ async def test_delete_operator_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_operator_async_from_dict(): - await test_delete_operator_async(request_type=dict) - - def test_delete_operator_field_headers(): client = LiveVideoAnalyticsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4125,8 +4152,8 @@ async def test_delete_operator_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - lva_service.ListAnalysesRequest, - dict, + lva_service.ListAnalysesRequest(), + {}, ], ) def test_list_analyses(request_type, transport: str = "grpc"): @@ -4137,7 +4164,7 @@ def test_list_analyses(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_analyses), "__call__") as call: @@ -4186,12 +4213,13 @@ def test_list_analyses_non_empty_request_with_auto_populated_field(): client.list_analyses(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == lva_service.ListAnalysesRequest( + request_msg = lva_service.ListAnalysesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_analyses_use_cached_wrapped_rpc(): @@ -4272,9 +4300,14 @@ async def test_list_analyses_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_analyses_async( - transport: str = "grpc_asyncio", request_type=lva_service.ListAnalysesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + lva_service.ListAnalysesRequest(), + {}, + ], +) +async def test_list_analyses_async(request_type, transport: str = "grpc_asyncio"): client = LiveVideoAnalyticsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4282,7 +4315,7 @@ async def test_list_analyses_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_analyses), "__call__") as call: @@ -4307,11 +4340,6 @@ async def test_list_analyses_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_analyses_async_from_dict(): - await test_list_analyses_async(request_type=dict) - - def test_list_analyses_field_headers(): client = LiveVideoAnalyticsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4648,8 +4676,8 @@ async def test_list_analyses_async_pages(): @pytest.mark.parametrize( "request_type", [ - lva_service.GetAnalysisRequest, - dict, + lva_service.GetAnalysisRequest(), + {}, ], ) def test_get_analysis(request_type, transport: str = "grpc"): @@ -4660,7 +4688,7 @@ def test_get_analysis(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_analysis), "__call__") as call: @@ -4706,9 +4734,10 @@ def test_get_analysis_non_empty_request_with_auto_populated_field(): client.get_analysis(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == lva_service.GetAnalysisRequest( + request_msg = lva_service.GetAnalysisRequest( name="name_value", ) + assert args[0] == request_msg def test_get_analysis_use_cached_wrapped_rpc(): @@ -4789,9 +4818,14 @@ async def test_get_analysis_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_analysis_async( - transport: str = "grpc_asyncio", request_type=lva_service.GetAnalysisRequest -): +@pytest.mark.parametrize( + "request_type", + [ + lva_service.GetAnalysisRequest(), + {}, + ], +) +async def test_get_analysis_async(request_type, transport: str = "grpc_asyncio"): client = LiveVideoAnalyticsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4799,7 +4833,7 @@ async def test_get_analysis_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_analysis), "__call__") as call: @@ -4824,11 +4858,6 @@ async def test_get_analysis_async( assert response.disable_event_watch is True -@pytest.mark.asyncio -async def test_get_analysis_async_from_dict(): - await test_get_analysis_async(request_type=dict) - - def test_get_analysis_field_headers(): client = LiveVideoAnalyticsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4975,8 +5004,8 @@ async def test_get_analysis_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - lva_service.CreateAnalysisRequest, - dict, + lva_service.CreateAnalysisRequest(), + {}, ], ) def test_create_analysis(request_type, transport: str = "grpc"): @@ -4987,7 +5016,7 @@ def test_create_analysis(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_analysis), "__call__") as call: @@ -5030,11 +5059,12 @@ def test_create_analysis_non_empty_request_with_auto_populated_field(): client.create_analysis(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == lva_service.CreateAnalysisRequest( + request_msg = lva_service.CreateAnalysisRequest( parent="parent_value", analysis_id="analysis_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_analysis_use_cached_wrapped_rpc(): @@ -5125,9 +5155,14 @@ async def test_create_analysis_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_analysis_async( - transport: str = "grpc_asyncio", request_type=lva_service.CreateAnalysisRequest -): +@pytest.mark.parametrize( + "request_type", + [ + lva_service.CreateAnalysisRequest(), + {}, + ], +) +async def test_create_analysis_async(request_type, transport: str = "grpc_asyncio"): client = LiveVideoAnalyticsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5135,7 +5170,7 @@ async def test_create_analysis_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_analysis), "__call__") as call: @@ -5155,11 +5190,6 @@ async def test_create_analysis_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_analysis_async_from_dict(): - await test_create_analysis_async(request_type=dict) - - def test_create_analysis_field_headers(): client = LiveVideoAnalyticsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5326,8 +5356,8 @@ async def test_create_analysis_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - lva_service.UpdateAnalysisRequest, - dict, + lva_service.UpdateAnalysisRequest(), + {}, ], ) def test_update_analysis(request_type, transport: str = "grpc"): @@ -5338,7 +5368,7 @@ def test_update_analysis(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_analysis), "__call__") as call: @@ -5379,9 +5409,10 @@ def test_update_analysis_non_empty_request_with_auto_populated_field(): client.update_analysis(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == lva_service.UpdateAnalysisRequest( + request_msg = lva_service.UpdateAnalysisRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_analysis_use_cached_wrapped_rpc(): @@ -5472,9 +5503,14 @@ async def test_update_analysis_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_analysis_async( - transport: str = "grpc_asyncio", request_type=lva_service.UpdateAnalysisRequest -): +@pytest.mark.parametrize( + "request_type", + [ + lva_service.UpdateAnalysisRequest(), + {}, + ], +) +async def test_update_analysis_async(request_type, transport: str = "grpc_asyncio"): client = LiveVideoAnalyticsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5482,7 +5518,7 @@ async def test_update_analysis_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_analysis), "__call__") as call: @@ -5502,11 +5538,6 @@ async def test_update_analysis_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_analysis_async_from_dict(): - await test_update_analysis_async(request_type=dict) - - def test_update_analysis_field_headers(): client = LiveVideoAnalyticsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5663,8 +5694,8 @@ async def test_update_analysis_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - lva_service.DeleteAnalysisRequest, - dict, + lva_service.DeleteAnalysisRequest(), + {}, ], ) def test_delete_analysis(request_type, transport: str = "grpc"): @@ -5675,7 +5706,7 @@ def test_delete_analysis(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_analysis), "__call__") as call: @@ -5717,10 +5748,11 @@ def test_delete_analysis_non_empty_request_with_auto_populated_field(): client.delete_analysis(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == lva_service.DeleteAnalysisRequest( + request_msg = lva_service.DeleteAnalysisRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_analysis_use_cached_wrapped_rpc(): @@ -5811,9 +5843,14 @@ async def test_delete_analysis_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_analysis_async( - transport: str = "grpc_asyncio", request_type=lva_service.DeleteAnalysisRequest -): +@pytest.mark.parametrize( + "request_type", + [ + lva_service.DeleteAnalysisRequest(), + {}, + ], +) +async def test_delete_analysis_async(request_type, transport: str = "grpc_asyncio"): client = LiveVideoAnalyticsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5821,7 +5858,7 @@ async def test_delete_analysis_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_analysis), "__call__") as call: @@ -5841,11 +5878,6 @@ async def test_delete_analysis_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_analysis_async_from_dict(): - await test_delete_analysis_async(request_type=dict) - - def test_delete_analysis_field_headers(): client = LiveVideoAnalyticsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5992,8 +6024,8 @@ async def test_delete_analysis_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - lva_service.ListProcessesRequest, - dict, + lva_service.ListProcessesRequest(), + {}, ], ) def test_list_processes(request_type, transport: str = "grpc"): @@ -6004,7 +6036,7 @@ def test_list_processes(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_processes), "__call__") as call: @@ -6053,12 +6085,13 @@ def test_list_processes_non_empty_request_with_auto_populated_field(): client.list_processes(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == lva_service.ListProcessesRequest( + request_msg = lva_service.ListProcessesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_processes_use_cached_wrapped_rpc(): @@ -6139,9 +6172,14 @@ async def test_list_processes_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_processes_async( - transport: str = "grpc_asyncio", request_type=lva_service.ListProcessesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + lva_service.ListProcessesRequest(), + {}, + ], +) +async def test_list_processes_async(request_type, transport: str = "grpc_asyncio"): client = LiveVideoAnalyticsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6149,7 +6187,7 @@ async def test_list_processes_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_processes), "__call__") as call: @@ -6174,11 +6212,6 @@ async def test_list_processes_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_processes_async_from_dict(): - await test_list_processes_async(request_type=dict) - - def test_list_processes_field_headers(): client = LiveVideoAnalyticsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6515,8 +6548,8 @@ async def test_list_processes_async_pages(): @pytest.mark.parametrize( "request_type", [ - lva_service.GetProcessRequest, - dict, + lva_service.GetProcessRequest(), + {}, ], ) def test_get_process(request_type, transport: str = "grpc"): @@ -6527,7 +6560,7 @@ def test_get_process(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_process), "__call__") as call: @@ -6583,9 +6616,10 @@ def test_get_process_non_empty_request_with_auto_populated_field(): client.get_process(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == lva_service.GetProcessRequest( + request_msg = lva_service.GetProcessRequest( name="name_value", ) + assert args[0] == request_msg def test_get_process_use_cached_wrapped_rpc(): @@ -6666,9 +6700,14 @@ async def test_get_process_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_process_async( - transport: str = "grpc_asyncio", request_type=lva_service.GetProcessRequest -): +@pytest.mark.parametrize( + "request_type", + [ + lva_service.GetProcessRequest(), + {}, + ], +) +async def test_get_process_async(request_type, transport: str = "grpc_asyncio"): client = LiveVideoAnalyticsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6676,7 +6715,7 @@ async def test_get_process_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_process), "__call__") as call: @@ -6711,11 +6750,6 @@ async def test_get_process_async( assert response.retry_count == 1214 -@pytest.mark.asyncio -async def test_get_process_async_from_dict(): - await test_get_process_async(request_type=dict) - - def test_get_process_field_headers(): client = LiveVideoAnalyticsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6862,8 +6896,8 @@ async def test_get_process_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - lva_service.CreateProcessRequest, - dict, + lva_service.CreateProcessRequest(), + {}, ], ) def test_create_process(request_type, transport: str = "grpc"): @@ -6874,7 +6908,7 @@ def test_create_process(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_process), "__call__") as call: @@ -6917,11 +6951,12 @@ def test_create_process_non_empty_request_with_auto_populated_field(): client.create_process(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == lva_service.CreateProcessRequest( + request_msg = lva_service.CreateProcessRequest( parent="parent_value", process_id="process_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_process_use_cached_wrapped_rpc(): @@ -7012,9 +7047,14 @@ async def test_create_process_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_process_async( - transport: str = "grpc_asyncio", request_type=lva_service.CreateProcessRequest -): +@pytest.mark.parametrize( + "request_type", + [ + lva_service.CreateProcessRequest(), + {}, + ], +) +async def test_create_process_async(request_type, transport: str = "grpc_asyncio"): client = LiveVideoAnalyticsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7022,7 +7062,7 @@ async def test_create_process_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_process), "__call__") as call: @@ -7042,11 +7082,6 @@ async def test_create_process_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_process_async_from_dict(): - await test_create_process_async(request_type=dict) - - def test_create_process_field_headers(): client = LiveVideoAnalyticsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7213,8 +7248,8 @@ async def test_create_process_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - lva_service.UpdateProcessRequest, - dict, + lva_service.UpdateProcessRequest(), + {}, ], ) def test_update_process(request_type, transport: str = "grpc"): @@ -7225,7 +7260,7 @@ def test_update_process(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_process), "__call__") as call: @@ -7266,9 +7301,10 @@ def test_update_process_non_empty_request_with_auto_populated_field(): client.update_process(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == lva_service.UpdateProcessRequest( + request_msg = lva_service.UpdateProcessRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_process_use_cached_wrapped_rpc(): @@ -7359,9 +7395,14 @@ async def test_update_process_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_process_async( - transport: str = "grpc_asyncio", request_type=lva_service.UpdateProcessRequest -): +@pytest.mark.parametrize( + "request_type", + [ + lva_service.UpdateProcessRequest(), + {}, + ], +) +async def test_update_process_async(request_type, transport: str = "grpc_asyncio"): client = LiveVideoAnalyticsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7369,7 +7410,7 @@ async def test_update_process_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_process), "__call__") as call: @@ -7389,11 +7430,6 @@ async def test_update_process_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_process_async_from_dict(): - await test_update_process_async(request_type=dict) - - def test_update_process_field_headers(): client = LiveVideoAnalyticsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7550,8 +7586,8 @@ async def test_update_process_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - lva_service.DeleteProcessRequest, - dict, + lva_service.DeleteProcessRequest(), + {}, ], ) def test_delete_process(request_type, transport: str = "grpc"): @@ -7562,7 +7598,7 @@ def test_delete_process(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_process), "__call__") as call: @@ -7604,10 +7640,11 @@ def test_delete_process_non_empty_request_with_auto_populated_field(): client.delete_process(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == lva_service.DeleteProcessRequest( + request_msg = lva_service.DeleteProcessRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_process_use_cached_wrapped_rpc(): @@ -7698,9 +7735,14 @@ async def test_delete_process_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_process_async( - transport: str = "grpc_asyncio", request_type=lva_service.DeleteProcessRequest -): +@pytest.mark.parametrize( + "request_type", + [ + lva_service.DeleteProcessRequest(), + {}, + ], +) +async def test_delete_process_async(request_type, transport: str = "grpc_asyncio"): client = LiveVideoAnalyticsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7708,7 +7750,7 @@ async def test_delete_process_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_process), "__call__") as call: @@ -7728,11 +7770,6 @@ async def test_delete_process_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_process_async_from_dict(): - await test_delete_process_async(request_type=dict) - - def test_delete_process_field_headers(): client = LiveVideoAnalyticsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7879,8 +7916,8 @@ async def test_delete_process_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - lva_service.BatchRunProcessRequest, - dict, + lva_service.BatchRunProcessRequest(), + {}, ], ) def test_batch_run_process(request_type, transport: str = "grpc"): @@ -7891,7 +7928,7 @@ def test_batch_run_process(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7937,10 +7974,11 @@ def test_batch_run_process_non_empty_request_with_auto_populated_field(): client.batch_run_process(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == lva_service.BatchRunProcessRequest( + request_msg = lva_service.BatchRunProcessRequest( parent="parent_value", batch_id="batch_id_value", ) + assert args[0] == request_msg def test_batch_run_process_use_cached_wrapped_rpc(): @@ -8033,9 +8071,14 @@ async def test_batch_run_process_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_batch_run_process_async( - transport: str = "grpc_asyncio", request_type=lva_service.BatchRunProcessRequest -): +@pytest.mark.parametrize( + "request_type", + [ + lva_service.BatchRunProcessRequest(), + {}, + ], +) +async def test_batch_run_process_async(request_type, transport: str = "grpc_asyncio"): client = LiveVideoAnalyticsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8043,7 +8086,7 @@ async def test_batch_run_process_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( @@ -8065,11 +8108,6 @@ async def test_batch_run_process_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_batch_run_process_async_from_dict(): - await test_batch_run_process_async(request_type=dict) - - def test_batch_run_process_field_headers(): client = LiveVideoAnalyticsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12109,7 +12147,6 @@ def test_list_public_operators_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lva_service.ListPublicOperatorsRequest() - assert args[0] == request_msg @@ -12132,7 +12169,6 @@ def test_resolve_operator_info_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lva_service.ResolveOperatorInfoRequest() - assert args[0] == request_msg @@ -12153,7 +12189,6 @@ def test_list_operators_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lva_service.ListOperatorsRequest() - assert args[0] == request_msg @@ -12174,7 +12209,6 @@ def test_get_operator_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lva_service.GetOperatorRequest() - assert args[0] == request_msg @@ -12195,7 +12229,6 @@ def test_create_operator_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lva_service.CreateOperatorRequest() - assert args[0] == request_msg @@ -12216,7 +12249,6 @@ def test_update_operator_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lva_service.UpdateOperatorRequest() - assert args[0] == request_msg @@ -12237,7 +12269,6 @@ def test_delete_operator_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lva_service.DeleteOperatorRequest() - assert args[0] == request_msg @@ -12258,7 +12289,6 @@ def test_list_analyses_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lva_service.ListAnalysesRequest() - assert args[0] == request_msg @@ -12279,7 +12309,6 @@ def test_get_analysis_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lva_service.GetAnalysisRequest() - assert args[0] == request_msg @@ -12300,7 +12329,6 @@ def test_create_analysis_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lva_service.CreateAnalysisRequest() - assert args[0] == request_msg @@ -12321,7 +12349,6 @@ def test_update_analysis_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lva_service.UpdateAnalysisRequest() - assert args[0] == request_msg @@ -12342,7 +12369,6 @@ def test_delete_analysis_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lva_service.DeleteAnalysisRequest() - assert args[0] == request_msg @@ -12363,7 +12389,6 @@ def test_list_processes_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lva_service.ListProcessesRequest() - assert args[0] == request_msg @@ -12384,7 +12409,6 @@ def test_get_process_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lva_service.GetProcessRequest() - assert args[0] == request_msg @@ -12405,7 +12429,6 @@ def test_create_process_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lva_service.CreateProcessRequest() - assert args[0] == request_msg @@ -12426,7 +12449,6 @@ def test_update_process_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lva_service.UpdateProcessRequest() - assert args[0] == request_msg @@ -12447,7 +12469,6 @@ def test_delete_process_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lva_service.DeleteProcessRequest() - assert args[0] == request_msg @@ -12470,7 +12491,6 @@ def test_batch_run_process_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lva_service.BatchRunProcessRequest() - assert args[0] == request_msg @@ -12513,7 +12533,6 @@ async def test_list_public_operators_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lva_service.ListPublicOperatorsRequest() - assert args[0] == request_msg @@ -12540,7 +12559,6 @@ async def test_resolve_operator_info_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lva_service.ResolveOperatorInfoRequest() - assert args[0] == request_msg @@ -12568,7 +12586,6 @@ async def test_list_operators_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lva_service.ListOperatorsRequest() - assert args[0] == request_msg @@ -12596,7 +12613,6 @@ async def test_get_operator_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lva_service.GetOperatorRequest() - assert args[0] == request_msg @@ -12621,7 +12637,6 @@ async def test_create_operator_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lva_service.CreateOperatorRequest() - assert args[0] == request_msg @@ -12646,7 +12661,6 @@ async def test_update_operator_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lva_service.UpdateOperatorRequest() - assert args[0] == request_msg @@ -12671,7 +12685,6 @@ async def test_delete_operator_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lva_service.DeleteOperatorRequest() - assert args[0] == request_msg @@ -12699,7 +12712,6 @@ async def test_list_analyses_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lva_service.ListAnalysesRequest() - assert args[0] == request_msg @@ -12727,7 +12739,6 @@ async def test_get_analysis_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lva_service.GetAnalysisRequest() - assert args[0] == request_msg @@ -12752,7 +12763,6 @@ async def test_create_analysis_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lva_service.CreateAnalysisRequest() - assert args[0] == request_msg @@ -12777,7 +12787,6 @@ async def test_update_analysis_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lva_service.UpdateAnalysisRequest() - assert args[0] == request_msg @@ -12802,7 +12811,6 @@ async def test_delete_analysis_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lva_service.DeleteAnalysisRequest() - assert args[0] == request_msg @@ -12830,7 +12838,6 @@ async def test_list_processes_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lva_service.ListProcessesRequest() - assert args[0] == request_msg @@ -12863,7 +12870,6 @@ async def test_get_process_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lva_service.GetProcessRequest() - assert args[0] == request_msg @@ -12888,7 +12894,6 @@ async def test_create_process_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lva_service.CreateProcessRequest() - assert args[0] == request_msg @@ -12913,7 +12918,6 @@ async def test_update_process_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lva_service.UpdateProcessRequest() - assert args[0] == request_msg @@ -12938,7 +12942,6 @@ async def test_delete_process_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lva_service.DeleteProcessRequest() - assert args[0] == request_msg @@ -12965,7 +12968,6 @@ async def test_batch_run_process_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lva_service.BatchRunProcessRequest() - assert args[0] == request_msg @@ -16278,7 +16280,6 @@ def test_list_public_operators_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lva_service.ListPublicOperatorsRequest() - assert args[0] == request_msg @@ -16300,7 +16301,6 @@ def test_resolve_operator_info_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lva_service.ResolveOperatorInfoRequest() - assert args[0] == request_msg @@ -16320,7 +16320,6 @@ def test_list_operators_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lva_service.ListOperatorsRequest() - assert args[0] == request_msg @@ -16340,7 +16339,6 @@ def test_get_operator_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lva_service.GetOperatorRequest() - assert args[0] == request_msg @@ -16360,7 +16358,6 @@ def test_create_operator_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lva_service.CreateOperatorRequest() - assert args[0] == request_msg @@ -16380,7 +16377,6 @@ def test_update_operator_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lva_service.UpdateOperatorRequest() - assert args[0] == request_msg @@ -16400,7 +16396,6 @@ def test_delete_operator_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lva_service.DeleteOperatorRequest() - assert args[0] == request_msg @@ -16420,7 +16415,6 @@ def test_list_analyses_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lva_service.ListAnalysesRequest() - assert args[0] == request_msg @@ -16440,7 +16434,6 @@ def test_get_analysis_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lva_service.GetAnalysisRequest() - assert args[0] == request_msg @@ -16460,7 +16453,6 @@ def test_create_analysis_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lva_service.CreateAnalysisRequest() - assert args[0] == request_msg @@ -16480,7 +16472,6 @@ def test_update_analysis_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lva_service.UpdateAnalysisRequest() - assert args[0] == request_msg @@ -16500,7 +16491,6 @@ def test_delete_analysis_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lva_service.DeleteAnalysisRequest() - assert args[0] == request_msg @@ -16520,7 +16510,6 @@ def test_list_processes_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lva_service.ListProcessesRequest() - assert args[0] == request_msg @@ -16540,7 +16529,6 @@ def test_get_process_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lva_service.GetProcessRequest() - assert args[0] == request_msg @@ -16560,7 +16548,6 @@ def test_create_process_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lva_service.CreateProcessRequest() - assert args[0] == request_msg @@ -16580,7 +16567,6 @@ def test_update_process_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lva_service.UpdateProcessRequest() - assert args[0] == request_msg @@ -16600,7 +16586,6 @@ def test_delete_process_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lva_service.DeleteProcessRequest() - assert args[0] == request_msg @@ -16622,7 +16607,6 @@ def test_batch_run_process_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lva_service.BatchRunProcessRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-visionai/tests/unit/gapic/visionai_v1/test_streaming_service.py b/packages/google-cloud-visionai/tests/unit/gapic/visionai_v1/test_streaming_service.py index b3f3d066c2d2..c10d58b2c824 100644 --- a/packages/google-cloud-visionai/tests/unit/gapic/visionai_v1/test_streaming_service.py +++ b/packages/google-cloud-visionai/tests/unit/gapic/visionai_v1/test_streaming_service.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 @@ -116,6 +117,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" @@ -1349,8 +1365,8 @@ def test_streaming_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - streaming_service.SendPacketsRequest, - dict, + streaming_service.SendPacketsRequest(), + {}, ], ) def test_send_packets(request_type, transport: str = "grpc"): @@ -1361,7 +1377,7 @@ def test_send_packets(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as 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. @@ -1458,9 +1474,14 @@ async def test_send_packets_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_send_packets_async( - transport: str = "grpc_asyncio", request_type=streaming_service.SendPacketsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + streaming_service.SendPacketsRequest(), + {}, + ], +) +async def test_send_packets_async(request_type, transport: str = "grpc_asyncio"): client = StreamingServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1468,7 +1489,7 @@ async def test_send_packets_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. @@ -1490,16 +1511,11 @@ async def test_send_packets_async( assert isinstance(message, streaming_service.SendPacketsResponse) -@pytest.mark.asyncio -async def test_send_packets_async_from_dict(): - await test_send_packets_async(request_type=dict) - - @pytest.mark.parametrize( "request_type", [ - streaming_service.ReceivePacketsRequest, - dict, + streaming_service.ReceivePacketsRequest(), + {}, ], ) def test_receive_packets(request_type, transport: str = "grpc"): @@ -1510,7 +1526,7 @@ def test_receive_packets(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as 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. @@ -1607,10 +1623,14 @@ async def test_receive_packets_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_receive_packets_async( - transport: str = "grpc_asyncio", - request_type=streaming_service.ReceivePacketsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + streaming_service.ReceivePacketsRequest(), + {}, + ], +) +async def test_receive_packets_async(request_type, transport: str = "grpc_asyncio"): client = StreamingServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1618,7 +1638,7 @@ async def test_receive_packets_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. @@ -1640,16 +1660,11 @@ async def test_receive_packets_async( assert isinstance(message, streaming_service.ReceivePacketsResponse) -@pytest.mark.asyncio -async def test_receive_packets_async_from_dict(): - await test_receive_packets_async(request_type=dict) - - @pytest.mark.parametrize( "request_type", [ - streaming_service.ReceiveEventsRequest, - dict, + streaming_service.ReceiveEventsRequest(), + {}, ], ) def test_receive_events(request_type, transport: str = "grpc"): @@ -1660,7 +1675,7 @@ def test_receive_events(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as 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. @@ -1757,9 +1772,14 @@ async def test_receive_events_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_receive_events_async( - transport: str = "grpc_asyncio", request_type=streaming_service.ReceiveEventsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + streaming_service.ReceiveEventsRequest(), + {}, + ], +) +async def test_receive_events_async(request_type, transport: str = "grpc_asyncio"): client = StreamingServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1767,7 +1787,7 @@ async def test_receive_events_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. @@ -1789,16 +1809,11 @@ async def test_receive_events_async( assert isinstance(message, streaming_service.ReceiveEventsResponse) -@pytest.mark.asyncio -async def test_receive_events_async_from_dict(): - await test_receive_events_async(request_type=dict) - - @pytest.mark.parametrize( "request_type", [ - streaming_service.AcquireLeaseRequest, - dict, + streaming_service.AcquireLeaseRequest(), + {}, ], ) def test_acquire_lease(request_type, transport: str = "grpc"): @@ -1809,7 +1824,7 @@ def test_acquire_lease(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.acquire_lease), "__call__") as call: @@ -1860,10 +1875,11 @@ def test_acquire_lease_non_empty_request_with_auto_populated_field(): client.acquire_lease(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == streaming_service.AcquireLeaseRequest( + request_msg = streaming_service.AcquireLeaseRequest( series="series_value", owner="owner_value", ) + assert args[0] == request_msg def test_acquire_lease_use_cached_wrapped_rpc(): @@ -1944,9 +1960,14 @@ async def test_acquire_lease_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_acquire_lease_async( - transport: str = "grpc_asyncio", request_type=streaming_service.AcquireLeaseRequest -): +@pytest.mark.parametrize( + "request_type", + [ + streaming_service.AcquireLeaseRequest(), + {}, + ], +) +async def test_acquire_lease_async(request_type, transport: str = "grpc_asyncio"): client = StreamingServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1954,7 +1975,7 @@ async def test_acquire_lease_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.acquire_lease), "__call__") as call: @@ -1983,11 +2004,6 @@ async def test_acquire_lease_async( assert response.lease_type == streaming_service.LeaseType.LEASE_TYPE_READER -@pytest.mark.asyncio -async def test_acquire_lease_async_from_dict(): - await test_acquire_lease_async(request_type=dict) - - def test_acquire_lease_field_headers(): client = StreamingServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2052,8 +2068,8 @@ async def test_acquire_lease_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - streaming_service.RenewLeaseRequest, - dict, + streaming_service.RenewLeaseRequest(), + {}, ], ) def test_renew_lease(request_type, transport: str = "grpc"): @@ -2064,7 +2080,7 @@ def test_renew_lease(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.renew_lease), "__call__") as call: @@ -2116,11 +2132,12 @@ def test_renew_lease_non_empty_request_with_auto_populated_field(): client.renew_lease(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == streaming_service.RenewLeaseRequest( + request_msg = streaming_service.RenewLeaseRequest( id="id_value", series="series_value", owner="owner_value", ) + assert args[0] == request_msg def test_renew_lease_use_cached_wrapped_rpc(): @@ -2201,9 +2218,14 @@ async def test_renew_lease_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_renew_lease_async( - transport: str = "grpc_asyncio", request_type=streaming_service.RenewLeaseRequest -): +@pytest.mark.parametrize( + "request_type", + [ + streaming_service.RenewLeaseRequest(), + {}, + ], +) +async def test_renew_lease_async(request_type, transport: str = "grpc_asyncio"): client = StreamingServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2211,7 +2233,7 @@ async def test_renew_lease_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.renew_lease), "__call__") as call: @@ -2240,11 +2262,6 @@ async def test_renew_lease_async( assert response.lease_type == streaming_service.LeaseType.LEASE_TYPE_READER -@pytest.mark.asyncio -async def test_renew_lease_async_from_dict(): - await test_renew_lease_async(request_type=dict) - - def test_renew_lease_field_headers(): client = StreamingServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2309,8 +2326,8 @@ async def test_renew_lease_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - streaming_service.ReleaseLeaseRequest, - dict, + streaming_service.ReleaseLeaseRequest(), + {}, ], ) def test_release_lease(request_type, transport: str = "grpc"): @@ -2321,7 +2338,7 @@ def test_release_lease(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.release_lease), "__call__") as call: @@ -2364,11 +2381,12 @@ def test_release_lease_non_empty_request_with_auto_populated_field(): client.release_lease(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == streaming_service.ReleaseLeaseRequest( + request_msg = streaming_service.ReleaseLeaseRequest( id="id_value", series="series_value", owner="owner_value", ) + assert args[0] == request_msg def test_release_lease_use_cached_wrapped_rpc(): @@ -2449,9 +2467,14 @@ async def test_release_lease_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_release_lease_async( - transport: str = "grpc_asyncio", request_type=streaming_service.ReleaseLeaseRequest -): +@pytest.mark.parametrize( + "request_type", + [ + streaming_service.ReleaseLeaseRequest(), + {}, + ], +) +async def test_release_lease_async(request_type, transport: str = "grpc_asyncio"): client = StreamingServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2459,7 +2482,7 @@ async def test_release_lease_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.release_lease), "__call__") as call: @@ -2479,11 +2502,6 @@ async def test_release_lease_async( assert isinstance(response, streaming_service.ReleaseLeaseResponse) -@pytest.mark.asyncio -async def test_release_lease_async_from_dict(): - await test_release_lease_async(request_type=dict) - - def test_release_lease_field_headers(): client = StreamingServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2848,7 +2866,6 @@ def test_acquire_lease_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streaming_service.AcquireLeaseRequest() - assert args[0] == request_msg @@ -2869,7 +2886,6 @@ def test_renew_lease_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streaming_service.RenewLeaseRequest() - assert args[0] == request_msg @@ -2890,7 +2906,6 @@ def test_release_lease_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streaming_service.ReleaseLeaseRequest() - assert args[0] == request_msg @@ -2934,7 +2949,6 @@ async def test_acquire_lease_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streaming_service.AcquireLeaseRequest() - assert args[0] == request_msg @@ -2964,7 +2978,6 @@ async def test_renew_lease_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streaming_service.RenewLeaseRequest() - assert args[0] == request_msg @@ -2989,7 +3002,6 @@ async def test_release_lease_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streaming_service.ReleaseLeaseRequest() - assert args[0] == request_msg @@ -3849,7 +3861,6 @@ def test_acquire_lease_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streaming_service.AcquireLeaseRequest() - assert args[0] == request_msg @@ -3869,7 +3880,6 @@ def test_renew_lease_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streaming_service.RenewLeaseRequest() - assert args[0] == request_msg @@ -3889,7 +3899,6 @@ def test_release_lease_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streaming_service.ReleaseLeaseRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-visionai/tests/unit/gapic/visionai_v1/test_streams_service.py b/packages/google-cloud-visionai/tests/unit/gapic/visionai_v1/test_streams_service.py index facc56e20dbd..54326a0414ac 100644 --- a/packages/google-cloud-visionai/tests/unit/gapic/visionai_v1/test_streams_service.py +++ b/packages/google-cloud-visionai/tests/unit/gapic/visionai_v1/test_streams_service.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 @@ -122,6 +123,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" @@ -1325,8 +1341,8 @@ def test_streams_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - streams_service.ListClustersRequest, - dict, + streams_service.ListClustersRequest(), + {}, ], ) def test_list_clusters(request_type, transport: str = "grpc"): @@ -1337,7 +1353,7 @@ def test_list_clusters(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_clusters), "__call__") as call: @@ -1386,12 +1402,13 @@ def test_list_clusters_non_empty_request_with_auto_populated_field(): client.list_clusters(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == streams_service.ListClustersRequest( + request_msg = streams_service.ListClustersRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_clusters_use_cached_wrapped_rpc(): @@ -1472,9 +1489,14 @@ async def test_list_clusters_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_clusters_async( - transport: str = "grpc_asyncio", request_type=streams_service.ListClustersRequest -): +@pytest.mark.parametrize( + "request_type", + [ + streams_service.ListClustersRequest(), + {}, + ], +) +async def test_list_clusters_async(request_type, transport: str = "grpc_asyncio"): client = StreamsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1482,7 +1504,7 @@ async def test_list_clusters_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_clusters), "__call__") as call: @@ -1507,11 +1529,6 @@ async def test_list_clusters_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_clusters_async_from_dict(): - await test_list_clusters_async(request_type=dict) - - def test_list_clusters_field_headers(): client = StreamsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1848,8 +1865,8 @@ async def test_list_clusters_async_pages(): @pytest.mark.parametrize( "request_type", [ - streams_service.GetClusterRequest, - dict, + streams_service.GetClusterRequest(), + {}, ], ) def test_get_cluster(request_type, transport: str = "grpc"): @@ -1860,7 +1877,7 @@ def test_get_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_cluster), "__call__") as call: @@ -1910,9 +1927,10 @@ def test_get_cluster_non_empty_request_with_auto_populated_field(): client.get_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == streams_service.GetClusterRequest( + request_msg = streams_service.GetClusterRequest( name="name_value", ) + assert args[0] == request_msg def test_get_cluster_use_cached_wrapped_rpc(): @@ -1993,9 +2011,14 @@ async def test_get_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_cluster_async( - transport: str = "grpc_asyncio", request_type=streams_service.GetClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + streams_service.GetClusterRequest(), + {}, + ], +) +async def test_get_cluster_async(request_type, transport: str = "grpc_asyncio"): client = StreamsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2003,7 +2026,7 @@ async def test_get_cluster_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_cluster), "__call__") as call: @@ -2032,11 +2055,6 @@ async def test_get_cluster_async( assert response.psc_target == "psc_target_value" -@pytest.mark.asyncio -async def test_get_cluster_async_from_dict(): - await test_get_cluster_async(request_type=dict) - - def test_get_cluster_field_headers(): client = StreamsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2179,8 +2197,8 @@ async def test_get_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - streams_service.CreateClusterRequest, - dict, + streams_service.CreateClusterRequest(), + {}, ], ) def test_create_cluster(request_type, transport: str = "grpc"): @@ -2191,7 +2209,7 @@ def test_create_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_cluster), "__call__") as call: @@ -2234,11 +2252,12 @@ def test_create_cluster_non_empty_request_with_auto_populated_field(): client.create_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == streams_service.CreateClusterRequest( + request_msg = streams_service.CreateClusterRequest( parent="parent_value", cluster_id="cluster_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_cluster_use_cached_wrapped_rpc(): @@ -2329,9 +2348,14 @@ async def test_create_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_cluster_async( - transport: str = "grpc_asyncio", request_type=streams_service.CreateClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + streams_service.CreateClusterRequest(), + {}, + ], +) +async def test_create_cluster_async(request_type, transport: str = "grpc_asyncio"): client = StreamsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2339,7 +2363,7 @@ async def test_create_cluster_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_cluster), "__call__") as call: @@ -2359,11 +2383,6 @@ async def test_create_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_cluster_async_from_dict(): - await test_create_cluster_async(request_type=dict) - - def test_create_cluster_field_headers(): client = StreamsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2530,8 +2549,8 @@ async def test_create_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - streams_service.UpdateClusterRequest, - dict, + streams_service.UpdateClusterRequest(), + {}, ], ) def test_update_cluster(request_type, transport: str = "grpc"): @@ -2542,7 +2561,7 @@ def test_update_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_cluster), "__call__") as call: @@ -2583,9 +2602,10 @@ def test_update_cluster_non_empty_request_with_auto_populated_field(): client.update_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == streams_service.UpdateClusterRequest( + request_msg = streams_service.UpdateClusterRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_cluster_use_cached_wrapped_rpc(): @@ -2676,9 +2696,14 @@ async def test_update_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_cluster_async( - transport: str = "grpc_asyncio", request_type=streams_service.UpdateClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + streams_service.UpdateClusterRequest(), + {}, + ], +) +async def test_update_cluster_async(request_type, transport: str = "grpc_asyncio"): client = StreamsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2686,7 +2711,7 @@ async def test_update_cluster_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_cluster), "__call__") as call: @@ -2706,11 +2731,6 @@ async def test_update_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_cluster_async_from_dict(): - await test_update_cluster_async(request_type=dict) - - def test_update_cluster_field_headers(): client = StreamsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2867,8 +2887,8 @@ async def test_update_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - streams_service.DeleteClusterRequest, - dict, + streams_service.DeleteClusterRequest(), + {}, ], ) def test_delete_cluster(request_type, transport: str = "grpc"): @@ -2879,7 +2899,7 @@ def test_delete_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_cluster), "__call__") as call: @@ -2921,10 +2941,11 @@ def test_delete_cluster_non_empty_request_with_auto_populated_field(): client.delete_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == streams_service.DeleteClusterRequest( + request_msg = streams_service.DeleteClusterRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_cluster_use_cached_wrapped_rpc(): @@ -3015,9 +3036,14 @@ async def test_delete_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_cluster_async( - transport: str = "grpc_asyncio", request_type=streams_service.DeleteClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + streams_service.DeleteClusterRequest(), + {}, + ], +) +async def test_delete_cluster_async(request_type, transport: str = "grpc_asyncio"): client = StreamsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3025,7 +3051,7 @@ async def test_delete_cluster_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_cluster), "__call__") as call: @@ -3045,11 +3071,6 @@ async def test_delete_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_cluster_async_from_dict(): - await test_delete_cluster_async(request_type=dict) - - def test_delete_cluster_field_headers(): client = StreamsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3196,8 +3217,8 @@ async def test_delete_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - streams_service.ListStreamsRequest, - dict, + streams_service.ListStreamsRequest(), + {}, ], ) def test_list_streams(request_type, transport: str = "grpc"): @@ -3208,7 +3229,7 @@ def test_list_streams(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_streams), "__call__") as call: @@ -3257,12 +3278,13 @@ def test_list_streams_non_empty_request_with_auto_populated_field(): client.list_streams(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == streams_service.ListStreamsRequest( + request_msg = streams_service.ListStreamsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_streams_use_cached_wrapped_rpc(): @@ -3343,9 +3365,14 @@ async def test_list_streams_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_streams_async( - transport: str = "grpc_asyncio", request_type=streams_service.ListStreamsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + streams_service.ListStreamsRequest(), + {}, + ], +) +async def test_list_streams_async(request_type, transport: str = "grpc_asyncio"): client = StreamsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3353,7 +3380,7 @@ async def test_list_streams_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_streams), "__call__") as call: @@ -3378,11 +3405,6 @@ async def test_list_streams_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_streams_async_from_dict(): - await test_list_streams_async(request_type=dict) - - def test_list_streams_field_headers(): client = StreamsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3719,8 +3741,8 @@ async def test_list_streams_async_pages(): @pytest.mark.parametrize( "request_type", [ - streams_service.GetStreamRequest, - dict, + streams_service.GetStreamRequest(), + {}, ], ) def test_get_stream(request_type, transport: str = "grpc"): @@ -3731,7 +3753,7 @@ def test_get_stream(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_stream), "__call__") as call: @@ -3781,9 +3803,10 @@ def test_get_stream_non_empty_request_with_auto_populated_field(): client.get_stream(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == streams_service.GetStreamRequest( + request_msg = streams_service.GetStreamRequest( name="name_value", ) + assert args[0] == request_msg def test_get_stream_use_cached_wrapped_rpc(): @@ -3862,9 +3885,14 @@ async def test_get_stream_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_stream_async( - transport: str = "grpc_asyncio", request_type=streams_service.GetStreamRequest -): +@pytest.mark.parametrize( + "request_type", + [ + streams_service.GetStreamRequest(), + {}, + ], +) +async def test_get_stream_async(request_type, transport: str = "grpc_asyncio"): client = StreamsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3872,7 +3900,7 @@ async def test_get_stream_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_stream), "__call__") as call: @@ -3901,11 +3929,6 @@ async def test_get_stream_async( assert response.media_warehouse_asset == "media_warehouse_asset_value" -@pytest.mark.asyncio -async def test_get_stream_async_from_dict(): - await test_get_stream_async(request_type=dict) - - def test_get_stream_field_headers(): client = StreamsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4052,8 +4075,8 @@ async def test_get_stream_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - streams_service.CreateStreamRequest, - dict, + streams_service.CreateStreamRequest(), + {}, ], ) def test_create_stream(request_type, transport: str = "grpc"): @@ -4064,7 +4087,7 @@ def test_create_stream(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_stream), "__call__") as call: @@ -4107,11 +4130,12 @@ def test_create_stream_non_empty_request_with_auto_populated_field(): client.create_stream(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == streams_service.CreateStreamRequest( + request_msg = streams_service.CreateStreamRequest( parent="parent_value", stream_id="stream_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_stream_use_cached_wrapped_rpc(): @@ -4202,9 +4226,14 @@ async def test_create_stream_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_stream_async( - transport: str = "grpc_asyncio", request_type=streams_service.CreateStreamRequest -): +@pytest.mark.parametrize( + "request_type", + [ + streams_service.CreateStreamRequest(), + {}, + ], +) +async def test_create_stream_async(request_type, transport: str = "grpc_asyncio"): client = StreamsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4212,7 +4241,7 @@ async def test_create_stream_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_stream), "__call__") as call: @@ -4232,11 +4261,6 @@ async def test_create_stream_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_stream_async_from_dict(): - await test_create_stream_async(request_type=dict) - - def test_create_stream_field_headers(): client = StreamsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4403,8 +4427,8 @@ async def test_create_stream_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - streams_service.UpdateStreamRequest, - dict, + streams_service.UpdateStreamRequest(), + {}, ], ) def test_update_stream(request_type, transport: str = "grpc"): @@ -4415,7 +4439,7 @@ def test_update_stream(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_stream), "__call__") as call: @@ -4456,9 +4480,10 @@ def test_update_stream_non_empty_request_with_auto_populated_field(): client.update_stream(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == streams_service.UpdateStreamRequest( + request_msg = streams_service.UpdateStreamRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_stream_use_cached_wrapped_rpc(): @@ -4549,9 +4574,14 @@ async def test_update_stream_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_stream_async( - transport: str = "grpc_asyncio", request_type=streams_service.UpdateStreamRequest -): +@pytest.mark.parametrize( + "request_type", + [ + streams_service.UpdateStreamRequest(), + {}, + ], +) +async def test_update_stream_async(request_type, transport: str = "grpc_asyncio"): client = StreamsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4559,7 +4589,7 @@ async def test_update_stream_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_stream), "__call__") as call: @@ -4579,11 +4609,6 @@ async def test_update_stream_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_stream_async_from_dict(): - await test_update_stream_async(request_type=dict) - - def test_update_stream_field_headers(): client = StreamsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4740,8 +4765,8 @@ async def test_update_stream_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - streams_service.DeleteStreamRequest, - dict, + streams_service.DeleteStreamRequest(), + {}, ], ) def test_delete_stream(request_type, transport: str = "grpc"): @@ -4752,7 +4777,7 @@ def test_delete_stream(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_stream), "__call__") as call: @@ -4794,10 +4819,11 @@ def test_delete_stream_non_empty_request_with_auto_populated_field(): client.delete_stream(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == streams_service.DeleteStreamRequest( + request_msg = streams_service.DeleteStreamRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_stream_use_cached_wrapped_rpc(): @@ -4888,9 +4914,14 @@ async def test_delete_stream_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_stream_async( - transport: str = "grpc_asyncio", request_type=streams_service.DeleteStreamRequest -): +@pytest.mark.parametrize( + "request_type", + [ + streams_service.DeleteStreamRequest(), + {}, + ], +) +async def test_delete_stream_async(request_type, transport: str = "grpc_asyncio"): client = StreamsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4898,7 +4929,7 @@ async def test_delete_stream_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_stream), "__call__") as call: @@ -4918,11 +4949,6 @@ async def test_delete_stream_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_stream_async_from_dict(): - await test_delete_stream_async(request_type=dict) - - def test_delete_stream_field_headers(): client = StreamsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5069,8 +5095,8 @@ async def test_delete_stream_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - streams_service.GetStreamThumbnailRequest, - dict, + streams_service.GetStreamThumbnailRequest(), + {}, ], ) def test_get_stream_thumbnail(request_type, transport: str = "grpc"): @@ -5081,7 +5107,7 @@ def test_get_stream_thumbnail(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5129,12 +5155,13 @@ def test_get_stream_thumbnail_non_empty_request_with_auto_populated_field(): client.get_stream_thumbnail(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == streams_service.GetStreamThumbnailRequest( + request_msg = streams_service.GetStreamThumbnailRequest( stream="stream_value", gcs_object_name="gcs_object_name_value", event="event_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_get_stream_thumbnail_use_cached_wrapped_rpc(): @@ -5229,9 +5256,15 @@ async def test_get_stream_thumbnail_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + streams_service.GetStreamThumbnailRequest(), + {}, + ], +) async def test_get_stream_thumbnail_async( - transport: str = "grpc_asyncio", - request_type=streams_service.GetStreamThumbnailRequest, + request_type, transport: str = "grpc_asyncio" ): client = StreamsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5240,7 +5273,7 @@ async def test_get_stream_thumbnail_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( @@ -5262,11 +5295,6 @@ async def test_get_stream_thumbnail_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_get_stream_thumbnail_async_from_dict(): - await test_get_stream_thumbnail_async(request_type=dict) - - def test_get_stream_thumbnail_field_headers(): client = StreamsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5431,8 +5459,8 @@ async def test_get_stream_thumbnail_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - streams_service.GenerateStreamHlsTokenRequest, - dict, + streams_service.GenerateStreamHlsTokenRequest(), + {}, ], ) def test_generate_stream_hls_token(request_type, transport: str = "grpc"): @@ -5443,7 +5471,7 @@ def test_generate_stream_hls_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( @@ -5491,9 +5519,10 @@ def test_generate_stream_hls_token_non_empty_request_with_auto_populated_field() client.generate_stream_hls_token(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == streams_service.GenerateStreamHlsTokenRequest( + request_msg = streams_service.GenerateStreamHlsTokenRequest( stream="stream_value", ) + assert args[0] == request_msg def test_generate_stream_hls_token_use_cached_wrapped_rpc(): @@ -5579,9 +5608,15 @@ async def test_generate_stream_hls_token_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + streams_service.GenerateStreamHlsTokenRequest(), + {}, + ], +) async def test_generate_stream_hls_token_async( - transport: str = "grpc_asyncio", - request_type=streams_service.GenerateStreamHlsTokenRequest, + request_type, transport: str = "grpc_asyncio" ): client = StreamsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5590,7 +5625,7 @@ async def test_generate_stream_hls_token_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( @@ -5615,11 +5650,6 @@ async def test_generate_stream_hls_token_async( assert response.token == "token_value" -@pytest.mark.asyncio -async def test_generate_stream_hls_token_async_from_dict(): - await test_generate_stream_hls_token_async(request_type=dict) - - def test_generate_stream_hls_token_field_headers(): client = StreamsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5774,8 +5804,8 @@ async def test_generate_stream_hls_token_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - streams_service.ListEventsRequest, - dict, + streams_service.ListEventsRequest(), + {}, ], ) def test_list_events(request_type, transport: str = "grpc"): @@ -5786,7 +5816,7 @@ def test_list_events(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_events), "__call__") as call: @@ -5835,12 +5865,13 @@ def test_list_events_non_empty_request_with_auto_populated_field(): client.list_events(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == streams_service.ListEventsRequest( + request_msg = streams_service.ListEventsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_events_use_cached_wrapped_rpc(): @@ -5921,9 +5952,14 @@ async def test_list_events_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_events_async( - transport: str = "grpc_asyncio", request_type=streams_service.ListEventsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + streams_service.ListEventsRequest(), + {}, + ], +) +async def test_list_events_async(request_type, transport: str = "grpc_asyncio"): client = StreamsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5931,7 +5967,7 @@ async def test_list_events_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_events), "__call__") as call: @@ -5956,11 +5992,6 @@ async def test_list_events_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_events_async_from_dict(): - await test_list_events_async(request_type=dict) - - def test_list_events_field_headers(): client = StreamsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6297,8 +6328,8 @@ async def test_list_events_async_pages(): @pytest.mark.parametrize( "request_type", [ - streams_service.GetEventRequest, - dict, + streams_service.GetEventRequest(), + {}, ], ) def test_get_event(request_type, transport: str = "grpc"): @@ -6309,7 +6340,7 @@ def test_get_event(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_event), "__call__") as call: @@ -6355,9 +6386,10 @@ def test_get_event_non_empty_request_with_auto_populated_field(): client.get_event(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == streams_service.GetEventRequest( + request_msg = streams_service.GetEventRequest( name="name_value", ) + assert args[0] == request_msg def test_get_event_use_cached_wrapped_rpc(): @@ -6436,9 +6468,14 @@ async def test_get_event_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_event_async( - transport: str = "grpc_asyncio", request_type=streams_service.GetEventRequest -): +@pytest.mark.parametrize( + "request_type", + [ + streams_service.GetEventRequest(), + {}, + ], +) +async def test_get_event_async(request_type, transport: str = "grpc_asyncio"): client = StreamsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6446,7 +6483,7 @@ async def test_get_event_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_event), "__call__") as call: @@ -6471,11 +6508,6 @@ async def test_get_event_async( assert response.alignment_clock == streams_resources.Event.Clock.CAPTURE -@pytest.mark.asyncio -async def test_get_event_async_from_dict(): - await test_get_event_async(request_type=dict) - - def test_get_event_field_headers(): client = StreamsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6622,8 +6654,8 @@ async def test_get_event_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - streams_service.CreateEventRequest, - dict, + streams_service.CreateEventRequest(), + {}, ], ) def test_create_event(request_type, transport: str = "grpc"): @@ -6634,7 +6666,7 @@ def test_create_event(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_event), "__call__") as call: @@ -6677,11 +6709,12 @@ def test_create_event_non_empty_request_with_auto_populated_field(): client.create_event(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == streams_service.CreateEventRequest( + request_msg = streams_service.CreateEventRequest( parent="parent_value", event_id="event_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_event_use_cached_wrapped_rpc(): @@ -6772,9 +6805,14 @@ async def test_create_event_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_event_async( - transport: str = "grpc_asyncio", request_type=streams_service.CreateEventRequest -): +@pytest.mark.parametrize( + "request_type", + [ + streams_service.CreateEventRequest(), + {}, + ], +) +async def test_create_event_async(request_type, transport: str = "grpc_asyncio"): client = StreamsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6782,7 +6820,7 @@ async def test_create_event_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_event), "__call__") as call: @@ -6802,11 +6840,6 @@ async def test_create_event_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_event_async_from_dict(): - await test_create_event_async(request_type=dict) - - def test_create_event_field_headers(): client = StreamsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6973,8 +7006,8 @@ async def test_create_event_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - streams_service.UpdateEventRequest, - dict, + streams_service.UpdateEventRequest(), + {}, ], ) def test_update_event(request_type, transport: str = "grpc"): @@ -6985,7 +7018,7 @@ def test_update_event(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_event), "__call__") as call: @@ -7026,9 +7059,10 @@ def test_update_event_non_empty_request_with_auto_populated_field(): client.update_event(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == streams_service.UpdateEventRequest( + request_msg = streams_service.UpdateEventRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_event_use_cached_wrapped_rpc(): @@ -7119,9 +7153,14 @@ async def test_update_event_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_event_async( - transport: str = "grpc_asyncio", request_type=streams_service.UpdateEventRequest -): +@pytest.mark.parametrize( + "request_type", + [ + streams_service.UpdateEventRequest(), + {}, + ], +) +async def test_update_event_async(request_type, transport: str = "grpc_asyncio"): client = StreamsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7129,7 +7168,7 @@ async def test_update_event_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_event), "__call__") as call: @@ -7149,11 +7188,6 @@ async def test_update_event_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_event_async_from_dict(): - await test_update_event_async(request_type=dict) - - def test_update_event_field_headers(): client = StreamsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7310,8 +7344,8 @@ async def test_update_event_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - streams_service.DeleteEventRequest, - dict, + streams_service.DeleteEventRequest(), + {}, ], ) def test_delete_event(request_type, transport: str = "grpc"): @@ -7322,7 +7356,7 @@ def test_delete_event(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_event), "__call__") as call: @@ -7364,10 +7398,11 @@ def test_delete_event_non_empty_request_with_auto_populated_field(): client.delete_event(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == streams_service.DeleteEventRequest( + request_msg = streams_service.DeleteEventRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_event_use_cached_wrapped_rpc(): @@ -7458,9 +7493,14 @@ async def test_delete_event_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_event_async( - transport: str = "grpc_asyncio", request_type=streams_service.DeleteEventRequest -): +@pytest.mark.parametrize( + "request_type", + [ + streams_service.DeleteEventRequest(), + {}, + ], +) +async def test_delete_event_async(request_type, transport: str = "grpc_asyncio"): client = StreamsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7468,7 +7508,7 @@ async def test_delete_event_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_event), "__call__") as call: @@ -7488,11 +7528,6 @@ async def test_delete_event_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_event_async_from_dict(): - await test_delete_event_async(request_type=dict) - - def test_delete_event_field_headers(): client = StreamsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7639,8 +7674,8 @@ async def test_delete_event_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - streams_service.ListSeriesRequest, - dict, + streams_service.ListSeriesRequest(), + {}, ], ) def test_list_series(request_type, transport: str = "grpc"): @@ -7651,7 +7686,7 @@ def test_list_series(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_series), "__call__") as call: @@ -7700,12 +7735,13 @@ def test_list_series_non_empty_request_with_auto_populated_field(): client.list_series(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == streams_service.ListSeriesRequest( + request_msg = streams_service.ListSeriesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_series_use_cached_wrapped_rpc(): @@ -7786,9 +7822,14 @@ async def test_list_series_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_series_async( - transport: str = "grpc_asyncio", request_type=streams_service.ListSeriesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + streams_service.ListSeriesRequest(), + {}, + ], +) +async def test_list_series_async(request_type, transport: str = "grpc_asyncio"): client = StreamsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7796,7 +7837,7 @@ async def test_list_series_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_series), "__call__") as call: @@ -7821,11 +7862,6 @@ async def test_list_series_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_series_async_from_dict(): - await test_list_series_async(request_type=dict) - - def test_list_series_field_headers(): client = StreamsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8162,8 +8198,8 @@ async def test_list_series_async_pages(): @pytest.mark.parametrize( "request_type", [ - streams_service.GetSeriesRequest, - dict, + streams_service.GetSeriesRequest(), + {}, ], ) def test_get_series(request_type, transport: str = "grpc"): @@ -8174,7 +8210,7 @@ def test_get_series(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_series), "__call__") as call: @@ -8222,9 +8258,10 @@ def test_get_series_non_empty_request_with_auto_populated_field(): client.get_series(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == streams_service.GetSeriesRequest( + request_msg = streams_service.GetSeriesRequest( name="name_value", ) + assert args[0] == request_msg def test_get_series_use_cached_wrapped_rpc(): @@ -8303,9 +8340,14 @@ async def test_get_series_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_series_async( - transport: str = "grpc_asyncio", request_type=streams_service.GetSeriesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + streams_service.GetSeriesRequest(), + {}, + ], +) +async def test_get_series_async(request_type, transport: str = "grpc_asyncio"): client = StreamsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8313,7 +8355,7 @@ async def test_get_series_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_series), "__call__") as call: @@ -8340,11 +8382,6 @@ async def test_get_series_async( assert response.event == "event_value" -@pytest.mark.asyncio -async def test_get_series_async_from_dict(): - await test_get_series_async(request_type=dict) - - def test_get_series_field_headers(): client = StreamsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8491,8 +8528,8 @@ async def test_get_series_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - streams_service.CreateSeriesRequest, - dict, + streams_service.CreateSeriesRequest(), + {}, ], ) def test_create_series(request_type, transport: str = "grpc"): @@ -8503,7 +8540,7 @@ def test_create_series(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_series), "__call__") as call: @@ -8546,11 +8583,12 @@ def test_create_series_non_empty_request_with_auto_populated_field(): client.create_series(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == streams_service.CreateSeriesRequest( + request_msg = streams_service.CreateSeriesRequest( parent="parent_value", series_id="series_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_series_use_cached_wrapped_rpc(): @@ -8641,9 +8679,14 @@ async def test_create_series_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_series_async( - transport: str = "grpc_asyncio", request_type=streams_service.CreateSeriesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + streams_service.CreateSeriesRequest(), + {}, + ], +) +async def test_create_series_async(request_type, transport: str = "grpc_asyncio"): client = StreamsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8651,7 +8694,7 @@ async def test_create_series_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_series), "__call__") as call: @@ -8671,11 +8714,6 @@ async def test_create_series_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_series_async_from_dict(): - await test_create_series_async(request_type=dict) - - def test_create_series_field_headers(): client = StreamsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8842,8 +8880,8 @@ async def test_create_series_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - streams_service.UpdateSeriesRequest, - dict, + streams_service.UpdateSeriesRequest(), + {}, ], ) def test_update_series(request_type, transport: str = "grpc"): @@ -8854,7 +8892,7 @@ def test_update_series(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_series), "__call__") as call: @@ -8895,9 +8933,10 @@ def test_update_series_non_empty_request_with_auto_populated_field(): client.update_series(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == streams_service.UpdateSeriesRequest( + request_msg = streams_service.UpdateSeriesRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_series_use_cached_wrapped_rpc(): @@ -8988,9 +9027,14 @@ async def test_update_series_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_series_async( - transport: str = "grpc_asyncio", request_type=streams_service.UpdateSeriesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + streams_service.UpdateSeriesRequest(), + {}, + ], +) +async def test_update_series_async(request_type, transport: str = "grpc_asyncio"): client = StreamsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8998,7 +9042,7 @@ async def test_update_series_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_series), "__call__") as call: @@ -9018,11 +9062,6 @@ async def test_update_series_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_series_async_from_dict(): - await test_update_series_async(request_type=dict) - - def test_update_series_field_headers(): client = StreamsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9179,8 +9218,8 @@ async def test_update_series_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - streams_service.DeleteSeriesRequest, - dict, + streams_service.DeleteSeriesRequest(), + {}, ], ) def test_delete_series(request_type, transport: str = "grpc"): @@ -9191,7 +9230,7 @@ def test_delete_series(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_series), "__call__") as call: @@ -9233,10 +9272,11 @@ def test_delete_series_non_empty_request_with_auto_populated_field(): client.delete_series(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == streams_service.DeleteSeriesRequest( + request_msg = streams_service.DeleteSeriesRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_series_use_cached_wrapped_rpc(): @@ -9327,9 +9367,14 @@ async def test_delete_series_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_series_async( - transport: str = "grpc_asyncio", request_type=streams_service.DeleteSeriesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + streams_service.DeleteSeriesRequest(), + {}, + ], +) +async def test_delete_series_async(request_type, transport: str = "grpc_asyncio"): client = StreamsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9337,7 +9382,7 @@ async def test_delete_series_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_series), "__call__") as call: @@ -9357,11 +9402,6 @@ async def test_delete_series_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_series_async_from_dict(): - await test_delete_series_async(request_type=dict) - - def test_delete_series_field_headers(): client = StreamsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9508,8 +9548,8 @@ async def test_delete_series_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - streams_service.MaterializeChannelRequest, - dict, + streams_service.MaterializeChannelRequest(), + {}, ], ) def test_materialize_channel(request_type, transport: str = "grpc"): @@ -9520,7 +9560,7 @@ def test_materialize_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( @@ -9567,11 +9607,12 @@ def test_materialize_channel_non_empty_request_with_auto_populated_field(): client.materialize_channel(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == streams_service.MaterializeChannelRequest( + request_msg = streams_service.MaterializeChannelRequest( parent="parent_value", channel_id="channel_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_materialize_channel_use_cached_wrapped_rpc(): @@ -9666,10 +9707,14 @@ async def test_materialize_channel_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_materialize_channel_async( - transport: str = "grpc_asyncio", - request_type=streams_service.MaterializeChannelRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + streams_service.MaterializeChannelRequest(), + {}, + ], +) +async def test_materialize_channel_async(request_type, transport: str = "grpc_asyncio"): client = StreamsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9677,7 +9722,7 @@ async def test_materialize_channel_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( @@ -9699,11 +9744,6 @@ async def test_materialize_channel_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_materialize_channel_async_from_dict(): - await test_materialize_channel_async(request_type=dict) - - def test_materialize_channel_field_headers(): client = StreamsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14752,7 +14792,6 @@ def test_list_clusters_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.ListClustersRequest() - assert args[0] == request_msg @@ -14773,7 +14812,6 @@ def test_get_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.GetClusterRequest() - assert args[0] == request_msg @@ -14794,7 +14832,6 @@ def test_create_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.CreateClusterRequest() - assert args[0] == request_msg @@ -14815,7 +14852,6 @@ def test_update_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.UpdateClusterRequest() - assert args[0] == request_msg @@ -14836,7 +14872,6 @@ def test_delete_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.DeleteClusterRequest() - assert args[0] == request_msg @@ -14857,7 +14892,6 @@ def test_list_streams_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.ListStreamsRequest() - assert args[0] == request_msg @@ -14878,7 +14912,6 @@ def test_get_stream_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.GetStreamRequest() - assert args[0] == request_msg @@ -14899,7 +14932,6 @@ def test_create_stream_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.CreateStreamRequest() - assert args[0] == request_msg @@ -14920,7 +14952,6 @@ def test_update_stream_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.UpdateStreamRequest() - assert args[0] == request_msg @@ -14941,7 +14972,6 @@ def test_delete_stream_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.DeleteStreamRequest() - assert args[0] == request_msg @@ -14964,7 +14994,6 @@ def test_get_stream_thumbnail_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.GetStreamThumbnailRequest() - assert args[0] == request_msg @@ -14987,7 +15016,6 @@ def test_generate_stream_hls_token_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.GenerateStreamHlsTokenRequest() - assert args[0] == request_msg @@ -15008,7 +15036,6 @@ def test_list_events_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.ListEventsRequest() - assert args[0] == request_msg @@ -15029,7 +15056,6 @@ def test_get_event_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.GetEventRequest() - assert args[0] == request_msg @@ -15050,7 +15076,6 @@ def test_create_event_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.CreateEventRequest() - assert args[0] == request_msg @@ -15071,7 +15096,6 @@ def test_update_event_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.UpdateEventRequest() - assert args[0] == request_msg @@ -15092,7 +15116,6 @@ def test_delete_event_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.DeleteEventRequest() - assert args[0] == request_msg @@ -15113,7 +15136,6 @@ def test_list_series_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.ListSeriesRequest() - assert args[0] == request_msg @@ -15134,7 +15156,6 @@ def test_get_series_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.GetSeriesRequest() - assert args[0] == request_msg @@ -15155,7 +15176,6 @@ def test_create_series_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.CreateSeriesRequest() - assert args[0] == request_msg @@ -15176,7 +15196,6 @@ def test_update_series_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.UpdateSeriesRequest() - assert args[0] == request_msg @@ -15197,7 +15216,6 @@ def test_delete_series_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.DeleteSeriesRequest() - assert args[0] == request_msg @@ -15220,7 +15238,6 @@ def test_materialize_channel_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.MaterializeChannelRequest() - assert args[0] == request_msg @@ -15262,7 +15279,6 @@ async def test_list_clusters_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.ListClustersRequest() - assert args[0] == request_msg @@ -15292,7 +15308,6 @@ async def test_get_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.GetClusterRequest() - assert args[0] == request_msg @@ -15317,7 +15332,6 @@ async def test_create_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.CreateClusterRequest() - assert args[0] == request_msg @@ -15342,7 +15356,6 @@ async def test_update_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.UpdateClusterRequest() - assert args[0] == request_msg @@ -15367,7 +15380,6 @@ async def test_delete_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.DeleteClusterRequest() - assert args[0] == request_msg @@ -15395,7 +15407,6 @@ async def test_list_streams_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.ListStreamsRequest() - assert args[0] == request_msg @@ -15425,7 +15436,6 @@ async def test_get_stream_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.GetStreamRequest() - assert args[0] == request_msg @@ -15450,7 +15460,6 @@ async def test_create_stream_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.CreateStreamRequest() - assert args[0] == request_msg @@ -15475,7 +15484,6 @@ async def test_update_stream_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.UpdateStreamRequest() - assert args[0] == request_msg @@ -15500,7 +15508,6 @@ async def test_delete_stream_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.DeleteStreamRequest() - assert args[0] == request_msg @@ -15527,7 +15534,6 @@ async def test_get_stream_thumbnail_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.GetStreamThumbnailRequest() - assert args[0] == request_msg @@ -15556,7 +15562,6 @@ async def test_generate_stream_hls_token_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.GenerateStreamHlsTokenRequest() - assert args[0] == request_msg @@ -15584,7 +15589,6 @@ async def test_list_events_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.ListEventsRequest() - assert args[0] == request_msg @@ -15612,7 +15616,6 @@ async def test_get_event_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.GetEventRequest() - assert args[0] == request_msg @@ -15637,7 +15640,6 @@ async def test_create_event_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.CreateEventRequest() - assert args[0] == request_msg @@ -15662,7 +15664,6 @@ async def test_update_event_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.UpdateEventRequest() - assert args[0] == request_msg @@ -15687,7 +15688,6 @@ async def test_delete_event_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.DeleteEventRequest() - assert args[0] == request_msg @@ -15715,7 +15715,6 @@ async def test_list_series_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.ListSeriesRequest() - assert args[0] == request_msg @@ -15744,7 +15743,6 @@ async def test_get_series_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.GetSeriesRequest() - assert args[0] == request_msg @@ -15769,7 +15767,6 @@ async def test_create_series_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.CreateSeriesRequest() - assert args[0] == request_msg @@ -15794,7 +15791,6 @@ async def test_update_series_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.UpdateSeriesRequest() - assert args[0] == request_msg @@ -15819,7 +15815,6 @@ async def test_delete_series_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.DeleteSeriesRequest() - assert args[0] == request_msg @@ -15846,7 +15841,6 @@ async def test_materialize_channel_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.MaterializeChannelRequest() - assert args[0] == request_msg @@ -19953,7 +19947,6 @@ def test_list_clusters_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.ListClustersRequest() - assert args[0] == request_msg @@ -19973,7 +19966,6 @@ def test_get_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.GetClusterRequest() - assert args[0] == request_msg @@ -19993,7 +19985,6 @@ def test_create_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.CreateClusterRequest() - assert args[0] == request_msg @@ -20013,7 +20004,6 @@ def test_update_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.UpdateClusterRequest() - assert args[0] == request_msg @@ -20033,7 +20023,6 @@ def test_delete_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.DeleteClusterRequest() - assert args[0] == request_msg @@ -20053,7 +20042,6 @@ def test_list_streams_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.ListStreamsRequest() - assert args[0] == request_msg @@ -20073,7 +20061,6 @@ def test_get_stream_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.GetStreamRequest() - assert args[0] == request_msg @@ -20093,7 +20080,6 @@ def test_create_stream_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.CreateStreamRequest() - assert args[0] == request_msg @@ -20113,7 +20099,6 @@ def test_update_stream_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.UpdateStreamRequest() - assert args[0] == request_msg @@ -20133,7 +20118,6 @@ def test_delete_stream_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.DeleteStreamRequest() - assert args[0] == request_msg @@ -20155,7 +20139,6 @@ def test_get_stream_thumbnail_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.GetStreamThumbnailRequest() - assert args[0] == request_msg @@ -20177,7 +20160,6 @@ def test_generate_stream_hls_token_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.GenerateStreamHlsTokenRequest() - assert args[0] == request_msg @@ -20197,7 +20179,6 @@ def test_list_events_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.ListEventsRequest() - assert args[0] == request_msg @@ -20217,7 +20198,6 @@ def test_get_event_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.GetEventRequest() - assert args[0] == request_msg @@ -20237,7 +20217,6 @@ def test_create_event_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.CreateEventRequest() - assert args[0] == request_msg @@ -20257,7 +20236,6 @@ def test_update_event_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.UpdateEventRequest() - assert args[0] == request_msg @@ -20277,7 +20255,6 @@ def test_delete_event_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.DeleteEventRequest() - assert args[0] == request_msg @@ -20297,7 +20274,6 @@ def test_list_series_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.ListSeriesRequest() - assert args[0] == request_msg @@ -20317,7 +20293,6 @@ def test_get_series_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.GetSeriesRequest() - assert args[0] == request_msg @@ -20337,7 +20312,6 @@ def test_create_series_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.CreateSeriesRequest() - assert args[0] == request_msg @@ -20357,7 +20331,6 @@ def test_update_series_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.UpdateSeriesRequest() - assert args[0] == request_msg @@ -20377,7 +20350,6 @@ def test_delete_series_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.DeleteSeriesRequest() - assert args[0] == request_msg @@ -20399,7 +20371,6 @@ def test_materialize_channel_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.MaterializeChannelRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-visionai/tests/unit/gapic/visionai_v1/test_warehouse.py b/packages/google-cloud-visionai/tests/unit/gapic/visionai_v1/test_warehouse.py index 6b1c052d87bd..652b4af24cd7 100644 --- a/packages/google-cloud-visionai/tests/unit/gapic/visionai_v1/test_warehouse.py +++ b/packages/google-cloud-visionai/tests/unit/gapic/visionai_v1/test_warehouse.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 @@ -125,6 +126,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" @@ -1282,8 +1298,8 @@ def test_warehouse_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - warehouse.CreateAssetRequest, - dict, + warehouse.CreateAssetRequest(), + {}, ], ) def test_create_asset(request_type, transport: str = "grpc"): @@ -1294,7 +1310,7 @@ def test_create_asset(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_asset), "__call__") as call: @@ -1339,10 +1355,11 @@ def test_create_asset_non_empty_request_with_auto_populated_field(): client.create_asset(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.CreateAssetRequest( + request_msg = warehouse.CreateAssetRequest( parent="parent_value", asset_id="asset_id_value", ) + assert args[0] == request_msg def test_create_asset_use_cached_wrapped_rpc(): @@ -1423,9 +1440,14 @@ async def test_create_asset_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_asset_async( - transport: str = "grpc_asyncio", request_type=warehouse.CreateAssetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + warehouse.CreateAssetRequest(), + {}, + ], +) +async def test_create_asset_async(request_type, transport: str = "grpc_asyncio"): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1433,7 +1455,7 @@ async def test_create_asset_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_asset), "__call__") as call: @@ -1456,11 +1478,6 @@ async def test_create_asset_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_create_asset_async_from_dict(): - await test_create_asset_async(request_type=dict) - - def test_create_asset_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1623,8 +1640,8 @@ async def test_create_asset_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - warehouse.UpdateAssetRequest, - dict, + warehouse.UpdateAssetRequest(), + {}, ], ) def test_update_asset(request_type, transport: str = "grpc"): @@ -1635,7 +1652,7 @@ def test_update_asset(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_asset), "__call__") as call: @@ -1677,7 +1694,8 @@ def test_update_asset_non_empty_request_with_auto_populated_field(): client.update_asset(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.UpdateAssetRequest() + request_msg = warehouse.UpdateAssetRequest() + assert args[0] == request_msg def test_update_asset_use_cached_wrapped_rpc(): @@ -1758,9 +1776,14 @@ async def test_update_asset_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_asset_async( - transport: str = "grpc_asyncio", request_type=warehouse.UpdateAssetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + warehouse.UpdateAssetRequest(), + {}, + ], +) +async def test_update_asset_async(request_type, transport: str = "grpc_asyncio"): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1768,7 +1791,7 @@ async def test_update_asset_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_asset), "__call__") as call: @@ -1791,11 +1814,6 @@ async def test_update_asset_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_update_asset_async_from_dict(): - await test_update_asset_async(request_type=dict) - - def test_update_asset_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1948,8 +1966,8 @@ async def test_update_asset_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - warehouse.GetAssetRequest, - dict, + warehouse.GetAssetRequest(), + {}, ], ) def test_get_asset(request_type, transport: str = "grpc"): @@ -1960,7 +1978,7 @@ def test_get_asset(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_asset), "__call__") as call: @@ -2004,9 +2022,10 @@ def test_get_asset_non_empty_request_with_auto_populated_field(): client.get_asset(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.GetAssetRequest( + request_msg = warehouse.GetAssetRequest( name="name_value", ) + assert args[0] == request_msg def test_get_asset_use_cached_wrapped_rpc(): @@ -2085,9 +2104,14 @@ async def test_get_asset_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_asset_async( - transport: str = "grpc_asyncio", request_type=warehouse.GetAssetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + warehouse.GetAssetRequest(), + {}, + ], +) +async def test_get_asset_async(request_type, transport: str = "grpc_asyncio"): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2095,7 +2119,7 @@ async def test_get_asset_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_asset), "__call__") as call: @@ -2118,11 +2142,6 @@ async def test_get_asset_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_asset_async_from_dict(): - await test_get_asset_async(request_type=dict) - - def test_get_asset_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2265,8 +2284,8 @@ async def test_get_asset_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - warehouse.ListAssetsRequest, - dict, + warehouse.ListAssetsRequest(), + {}, ], ) def test_list_assets(request_type, transport: str = "grpc"): @@ -2277,7 +2296,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(type(client.transport.list_assets), "__call__") as call: @@ -2323,11 +2342,12 @@ 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] == warehouse.ListAssetsRequest( + request_msg = warehouse.ListAssetsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_assets_use_cached_wrapped_rpc(): @@ -2408,9 +2428,14 @@ async def test_list_assets_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_assets_async( - transport: str = "grpc_asyncio", request_type=warehouse.ListAssetsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + warehouse.ListAssetsRequest(), + {}, + ], +) +async def test_list_assets_async(request_type, transport: str = "grpc_asyncio"): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2418,7 +2443,7 @@ async def test_list_assets_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_assets), "__call__") as call: @@ -2441,11 +2466,6 @@ async def test_list_assets_async( 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 = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2782,8 +2802,8 @@ async def test_list_assets_async_pages(): @pytest.mark.parametrize( "request_type", [ - warehouse.DeleteAssetRequest, - dict, + warehouse.DeleteAssetRequest(), + {}, ], ) def test_delete_asset(request_type, transport: str = "grpc"): @@ -2794,7 +2814,7 @@ def test_delete_asset(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_asset), "__call__") as call: @@ -2835,9 +2855,10 @@ def test_delete_asset_non_empty_request_with_auto_populated_field(): client.delete_asset(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.DeleteAssetRequest( + request_msg = warehouse.DeleteAssetRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_asset_use_cached_wrapped_rpc(): @@ -2928,9 +2949,14 @@ async def test_delete_asset_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_asset_async( - transport: str = "grpc_asyncio", request_type=warehouse.DeleteAssetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + warehouse.DeleteAssetRequest(), + {}, + ], +) +async def test_delete_asset_async(request_type, transport: str = "grpc_asyncio"): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2938,7 +2964,7 @@ async def test_delete_asset_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_asset), "__call__") as call: @@ -2958,11 +2984,6 @@ async def test_delete_asset_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_asset_async_from_dict(): - await test_delete_asset_async(request_type=dict) - - def test_delete_asset_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3109,8 +3130,8 @@ async def test_delete_asset_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - warehouse.UploadAssetRequest, - dict, + warehouse.UploadAssetRequest(), + {}, ], ) def test_upload_asset(request_type, transport: str = "grpc"): @@ -3121,7 +3142,7 @@ def test_upload_asset(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.upload_asset), "__call__") as call: @@ -3162,9 +3183,10 @@ def test_upload_asset_non_empty_request_with_auto_populated_field(): client.upload_asset(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.UploadAssetRequest( + request_msg = warehouse.UploadAssetRequest( name="name_value", ) + assert args[0] == request_msg def test_upload_asset_use_cached_wrapped_rpc(): @@ -3255,9 +3277,14 @@ async def test_upload_asset_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_upload_asset_async( - transport: str = "grpc_asyncio", request_type=warehouse.UploadAssetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + warehouse.UploadAssetRequest(), + {}, + ], +) +async def test_upload_asset_async(request_type, transport: str = "grpc_asyncio"): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3265,7 +3292,7 @@ async def test_upload_asset_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.upload_asset), "__call__") as call: @@ -3285,11 +3312,6 @@ async def test_upload_asset_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_upload_asset_async_from_dict(): - await test_upload_asset_async(request_type=dict) - - def test_upload_asset_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3354,8 +3376,8 @@ async def test_upload_asset_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - warehouse.GenerateRetrievalUrlRequest, - dict, + warehouse.GenerateRetrievalUrlRequest(), + {}, ], ) def test_generate_retrieval_url(request_type, transport: str = "grpc"): @@ -3366,7 +3388,7 @@ def test_generate_retrieval_url(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3414,9 +3436,10 @@ def test_generate_retrieval_url_non_empty_request_with_auto_populated_field(): client.generate_retrieval_url(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.GenerateRetrievalUrlRequest( + request_msg = warehouse.GenerateRetrievalUrlRequest( name="name_value", ) + assert args[0] == request_msg def test_generate_retrieval_url_use_cached_wrapped_rpc(): @@ -3502,8 +3525,15 @@ async def test_generate_retrieval_url_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + warehouse.GenerateRetrievalUrlRequest(), + {}, + ], +) async def test_generate_retrieval_url_async( - transport: str = "grpc_asyncio", request_type=warehouse.GenerateRetrievalUrlRequest + request_type, transport: str = "grpc_asyncio" ): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), @@ -3512,7 +3542,7 @@ async def test_generate_retrieval_url_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( @@ -3537,11 +3567,6 @@ async def test_generate_retrieval_url_async( assert response.signed_uri == "signed_uri_value" -@pytest.mark.asyncio -async def test_generate_retrieval_url_async_from_dict(): - await test_generate_retrieval_url_async(request_type=dict) - - def test_generate_retrieval_url_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3610,8 +3635,8 @@ async def test_generate_retrieval_url_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - warehouse.AnalyzeAssetRequest, - dict, + warehouse.AnalyzeAssetRequest(), + {}, ], ) def test_analyze_asset(request_type, transport: str = "grpc"): @@ -3622,7 +3647,7 @@ def test_analyze_asset(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.analyze_asset), "__call__") as call: @@ -3663,9 +3688,10 @@ def test_analyze_asset_non_empty_request_with_auto_populated_field(): client.analyze_asset(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.AnalyzeAssetRequest( + request_msg = warehouse.AnalyzeAssetRequest( name="name_value", ) + assert args[0] == request_msg def test_analyze_asset_use_cached_wrapped_rpc(): @@ -3756,9 +3782,14 @@ async def test_analyze_asset_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_analyze_asset_async( - transport: str = "grpc_asyncio", request_type=warehouse.AnalyzeAssetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + warehouse.AnalyzeAssetRequest(), + {}, + ], +) +async def test_analyze_asset_async(request_type, transport: str = "grpc_asyncio"): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3766,7 +3797,7 @@ async def test_analyze_asset_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.analyze_asset), "__call__") as call: @@ -3786,11 +3817,6 @@ async def test_analyze_asset_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_analyze_asset_async_from_dict(): - await test_analyze_asset_async(request_type=dict) - - def test_analyze_asset_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3855,8 +3881,8 @@ async def test_analyze_asset_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - warehouse.IndexAssetRequest, - dict, + warehouse.IndexAssetRequest(), + {}, ], ) def test_index_asset(request_type, transport: str = "grpc"): @@ -3867,7 +3893,7 @@ def test_index_asset(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.index_asset), "__call__") as call: @@ -3909,10 +3935,11 @@ def test_index_asset_non_empty_request_with_auto_populated_field(): client.index_asset(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.IndexAssetRequest( + request_msg = warehouse.IndexAssetRequest( name="name_value", index="index_value", ) + assert args[0] == request_msg def test_index_asset_use_cached_wrapped_rpc(): @@ -4003,9 +4030,14 @@ async def test_index_asset_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_index_asset_async( - transport: str = "grpc_asyncio", request_type=warehouse.IndexAssetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + warehouse.IndexAssetRequest(), + {}, + ], +) +async def test_index_asset_async(request_type, transport: str = "grpc_asyncio"): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4013,7 +4045,7 @@ async def test_index_asset_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.index_asset), "__call__") as call: @@ -4033,11 +4065,6 @@ async def test_index_asset_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_index_asset_async_from_dict(): - await test_index_asset_async(request_type=dict) - - def test_index_asset_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4102,8 +4129,8 @@ async def test_index_asset_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - warehouse.RemoveIndexAssetRequest, - dict, + warehouse.RemoveIndexAssetRequest(), + {}, ], ) def test_remove_index_asset(request_type, transport: str = "grpc"): @@ -4114,7 +4141,7 @@ def test_remove_index_asset(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4160,10 +4187,11 @@ def test_remove_index_asset_non_empty_request_with_auto_populated_field(): client.remove_index_asset(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.RemoveIndexAssetRequest( + request_msg = warehouse.RemoveIndexAssetRequest( name="name_value", index="index_value", ) + assert args[0] == request_msg def test_remove_index_asset_use_cached_wrapped_rpc(): @@ -4258,9 +4286,14 @@ async def test_remove_index_asset_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_remove_index_asset_async( - transport: str = "grpc_asyncio", request_type=warehouse.RemoveIndexAssetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + warehouse.RemoveIndexAssetRequest(), + {}, + ], +) +async def test_remove_index_asset_async(request_type, transport: str = "grpc_asyncio"): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4268,7 +4301,7 @@ async def test_remove_index_asset_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( @@ -4290,11 +4323,6 @@ async def test_remove_index_asset_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_remove_index_asset_async_from_dict(): - await test_remove_index_asset_async(request_type=dict) - - def test_remove_index_asset_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4363,8 +4391,8 @@ async def test_remove_index_asset_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - warehouse.ViewIndexedAssetsRequest, - dict, + warehouse.ViewIndexedAssetsRequest(), + {}, ], ) def test_view_indexed_assets(request_type, transport: str = "grpc"): @@ -4375,7 +4403,7 @@ def test_view_indexed_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( @@ -4425,11 +4453,12 @@ def test_view_indexed_assets_non_empty_request_with_auto_populated_field(): client.view_indexed_assets(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.ViewIndexedAssetsRequest( + request_msg = warehouse.ViewIndexedAssetsRequest( index="index_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_view_indexed_assets_use_cached_wrapped_rpc(): @@ -4514,9 +4543,14 @@ async def test_view_indexed_assets_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_view_indexed_assets_async( - transport: str = "grpc_asyncio", request_type=warehouse.ViewIndexedAssetsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + warehouse.ViewIndexedAssetsRequest(), + {}, + ], +) +async def test_view_indexed_assets_async(request_type, transport: str = "grpc_asyncio"): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4524,7 +4558,7 @@ async def test_view_indexed_assets_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( @@ -4549,11 +4583,6 @@ async def test_view_indexed_assets_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_view_indexed_assets_async_from_dict(): - await test_view_indexed_assets_async(request_type=dict) - - def test_view_indexed_assets_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4906,8 +4935,8 @@ async def test_view_indexed_assets_async_pages(): @pytest.mark.parametrize( "request_type", [ - warehouse.CreateIndexRequest, - dict, + warehouse.CreateIndexRequest(), + {}, ], ) def test_create_index(request_type, transport: str = "grpc"): @@ -4918,7 +4947,7 @@ def test_create_index(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_index), "__call__") as call: @@ -4960,10 +4989,11 @@ def test_create_index_non_empty_request_with_auto_populated_field(): client.create_index(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.CreateIndexRequest( + request_msg = warehouse.CreateIndexRequest( parent="parent_value", index_id="index_id_value", ) + assert args[0] == request_msg def test_create_index_use_cached_wrapped_rpc(): @@ -5054,9 +5084,14 @@ async def test_create_index_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_index_async( - transport: str = "grpc_asyncio", request_type=warehouse.CreateIndexRequest -): +@pytest.mark.parametrize( + "request_type", + [ + warehouse.CreateIndexRequest(), + {}, + ], +) +async def test_create_index_async(request_type, transport: str = "grpc_asyncio"): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5064,7 +5099,7 @@ async def test_create_index_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_index), "__call__") as call: @@ -5084,11 +5119,6 @@ async def test_create_index_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_index_async_from_dict(): - await test_create_index_async(request_type=dict) - - def test_create_index_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5255,8 +5285,8 @@ async def test_create_index_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - warehouse.UpdateIndexRequest, - dict, + warehouse.UpdateIndexRequest(), + {}, ], ) def test_update_index(request_type, transport: str = "grpc"): @@ -5267,7 +5297,7 @@ def test_update_index(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_index), "__call__") as call: @@ -5306,7 +5336,8 @@ def test_update_index_non_empty_request_with_auto_populated_field(): client.update_index(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.UpdateIndexRequest() + request_msg = warehouse.UpdateIndexRequest() + assert args[0] == request_msg def test_update_index_use_cached_wrapped_rpc(): @@ -5397,9 +5428,14 @@ async def test_update_index_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_index_async( - transport: str = "grpc_asyncio", request_type=warehouse.UpdateIndexRequest -): +@pytest.mark.parametrize( + "request_type", + [ + warehouse.UpdateIndexRequest(), + {}, + ], +) +async def test_update_index_async(request_type, transport: str = "grpc_asyncio"): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5407,7 +5443,7 @@ async def test_update_index_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_index), "__call__") as call: @@ -5427,11 +5463,6 @@ async def test_update_index_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_index_async_from_dict(): - await test_update_index_async(request_type=dict) - - def test_update_index_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5588,8 +5619,8 @@ async def test_update_index_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - warehouse.GetIndexRequest, - dict, + warehouse.GetIndexRequest(), + {}, ], ) def test_get_index(request_type, transport: str = "grpc"): @@ -5600,7 +5631,7 @@ def test_get_index(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_index), "__call__") as call: @@ -5655,9 +5686,10 @@ def test_get_index_non_empty_request_with_auto_populated_field(): client.get_index(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.GetIndexRequest( + request_msg = warehouse.GetIndexRequest( name="name_value", ) + assert args[0] == request_msg def test_get_index_use_cached_wrapped_rpc(): @@ -5736,9 +5768,14 @@ async def test_get_index_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_index_async( - transport: str = "grpc_asyncio", request_type=warehouse.GetIndexRequest -): +@pytest.mark.parametrize( + "request_type", + [ + warehouse.GetIndexRequest(), + {}, + ], +) +async def test_get_index_async(request_type, transport: str = "grpc_asyncio"): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5746,7 +5783,7 @@ async def test_get_index_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_index), "__call__") as call: @@ -5779,11 +5816,6 @@ async def test_get_index_async( assert response.satisfies_pzi is True -@pytest.mark.asyncio -async def test_get_index_async_from_dict(): - await test_get_index_async(request_type=dict) - - def test_get_index_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5926,8 +5958,8 @@ async def test_get_index_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - warehouse.ListIndexesRequest, - dict, + warehouse.ListIndexesRequest(), + {}, ], ) def test_list_indexes(request_type, transport: str = "grpc"): @@ -5938,7 +5970,7 @@ def test_list_indexes(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_indexes), "__call__") as call: @@ -5983,10 +6015,11 @@ def test_list_indexes_non_empty_request_with_auto_populated_field(): client.list_indexes(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.ListIndexesRequest( + request_msg = warehouse.ListIndexesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_indexes_use_cached_wrapped_rpc(): @@ -6067,9 +6100,14 @@ async def test_list_indexes_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_indexes_async( - transport: str = "grpc_asyncio", request_type=warehouse.ListIndexesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + warehouse.ListIndexesRequest(), + {}, + ], +) +async def test_list_indexes_async(request_type, transport: str = "grpc_asyncio"): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6077,7 +6115,7 @@ async def test_list_indexes_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_indexes), "__call__") as call: @@ -6100,11 +6138,6 @@ async def test_list_indexes_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_indexes_async_from_dict(): - await test_list_indexes_async(request_type=dict) - - def test_list_indexes_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6441,8 +6474,8 @@ async def test_list_indexes_async_pages(): @pytest.mark.parametrize( "request_type", [ - warehouse.DeleteIndexRequest, - dict, + warehouse.DeleteIndexRequest(), + {}, ], ) def test_delete_index(request_type, transport: str = "grpc"): @@ -6453,7 +6486,7 @@ def test_delete_index(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_index), "__call__") as call: @@ -6494,9 +6527,10 @@ def test_delete_index_non_empty_request_with_auto_populated_field(): client.delete_index(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.DeleteIndexRequest( + request_msg = warehouse.DeleteIndexRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_index_use_cached_wrapped_rpc(): @@ -6587,9 +6621,14 @@ async def test_delete_index_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_index_async( - transport: str = "grpc_asyncio", request_type=warehouse.DeleteIndexRequest -): +@pytest.mark.parametrize( + "request_type", + [ + warehouse.DeleteIndexRequest(), + {}, + ], +) +async def test_delete_index_async(request_type, transport: str = "grpc_asyncio"): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6597,7 +6636,7 @@ async def test_delete_index_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_index), "__call__") as call: @@ -6617,11 +6656,6 @@ async def test_delete_index_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_index_async_from_dict(): - await test_delete_index_async(request_type=dict) - - def test_delete_index_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6768,8 +6802,8 @@ async def test_delete_index_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - warehouse.CreateCorpusRequest, - dict, + warehouse.CreateCorpusRequest(), + {}, ], ) def test_create_corpus(request_type, transport: str = "grpc"): @@ -6780,7 +6814,7 @@ def test_create_corpus(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_corpus), "__call__") as call: @@ -6821,9 +6855,10 @@ def test_create_corpus_non_empty_request_with_auto_populated_field(): client.create_corpus(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.CreateCorpusRequest( + request_msg = warehouse.CreateCorpusRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_corpus_use_cached_wrapped_rpc(): @@ -6914,9 +6949,14 @@ async def test_create_corpus_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_corpus_async( - transport: str = "grpc_asyncio", request_type=warehouse.CreateCorpusRequest -): +@pytest.mark.parametrize( + "request_type", + [ + warehouse.CreateCorpusRequest(), + {}, + ], +) +async def test_create_corpus_async(request_type, transport: str = "grpc_asyncio"): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6924,7 +6964,7 @@ async def test_create_corpus_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_corpus), "__call__") as call: @@ -6944,11 +6984,6 @@ async def test_create_corpus_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_corpus_async_from_dict(): - await test_create_corpus_async(request_type=dict) - - def test_create_corpus_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7105,8 +7140,8 @@ async def test_create_corpus_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - warehouse.GetCorpusRequest, - dict, + warehouse.GetCorpusRequest(), + {}, ], ) def test_get_corpus(request_type, transport: str = "grpc"): @@ -7117,7 +7152,7 @@ def test_get_corpus(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_corpus), "__call__") as call: @@ -7171,9 +7206,10 @@ def test_get_corpus_non_empty_request_with_auto_populated_field(): client.get_corpus(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.GetCorpusRequest( + request_msg = warehouse.GetCorpusRequest( name="name_value", ) + assert args[0] == request_msg def test_get_corpus_use_cached_wrapped_rpc(): @@ -7252,9 +7288,14 @@ async def test_get_corpus_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_corpus_async( - transport: str = "grpc_asyncio", request_type=warehouse.GetCorpusRequest -): +@pytest.mark.parametrize( + "request_type", + [ + warehouse.GetCorpusRequest(), + {}, + ], +) +async def test_get_corpus_async(request_type, transport: str = "grpc_asyncio"): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7262,7 +7303,7 @@ async def test_get_corpus_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_corpus), "__call__") as call: @@ -7295,11 +7336,6 @@ async def test_get_corpus_async( assert response.satisfies_pzi is True -@pytest.mark.asyncio -async def test_get_corpus_async_from_dict(): - await test_get_corpus_async(request_type=dict) - - def test_get_corpus_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7442,8 +7478,8 @@ async def test_get_corpus_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - warehouse.UpdateCorpusRequest, - dict, + warehouse.UpdateCorpusRequest(), + {}, ], ) def test_update_corpus(request_type, transport: str = "grpc"): @@ -7454,7 +7490,7 @@ def test_update_corpus(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_corpus), "__call__") as call: @@ -7506,7 +7542,8 @@ def test_update_corpus_non_empty_request_with_auto_populated_field(): client.update_corpus(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.UpdateCorpusRequest() + request_msg = warehouse.UpdateCorpusRequest() + assert args[0] == request_msg def test_update_corpus_use_cached_wrapped_rpc(): @@ -7587,9 +7624,14 @@ async def test_update_corpus_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_corpus_async( - transport: str = "grpc_asyncio", request_type=warehouse.UpdateCorpusRequest -): +@pytest.mark.parametrize( + "request_type", + [ + warehouse.UpdateCorpusRequest(), + {}, + ], +) +async def test_update_corpus_async(request_type, transport: str = "grpc_asyncio"): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7597,7 +7639,7 @@ async def test_update_corpus_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_corpus), "__call__") as call: @@ -7630,11 +7672,6 @@ async def test_update_corpus_async( assert response.satisfies_pzi is True -@pytest.mark.asyncio -async def test_update_corpus_async_from_dict(): - await test_update_corpus_async(request_type=dict) - - def test_update_corpus_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7787,8 +7824,8 @@ async def test_update_corpus_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - warehouse.ListCorporaRequest, - dict, + warehouse.ListCorporaRequest(), + {}, ], ) def test_list_corpora(request_type, transport: str = "grpc"): @@ -7799,7 +7836,7 @@ def test_list_corpora(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_corpora), "__call__") as call: @@ -7845,11 +7882,12 @@ def test_list_corpora_non_empty_request_with_auto_populated_field(): client.list_corpora(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.ListCorporaRequest( + request_msg = warehouse.ListCorporaRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_corpora_use_cached_wrapped_rpc(): @@ -7930,9 +7968,14 @@ async def test_list_corpora_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_corpora_async( - transport: str = "grpc_asyncio", request_type=warehouse.ListCorporaRequest -): +@pytest.mark.parametrize( + "request_type", + [ + warehouse.ListCorporaRequest(), + {}, + ], +) +async def test_list_corpora_async(request_type, transport: str = "grpc_asyncio"): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7940,7 +7983,7 @@ async def test_list_corpora_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_corpora), "__call__") as call: @@ -7963,11 +8006,6 @@ async def test_list_corpora_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_corpora_async_from_dict(): - await test_list_corpora_async(request_type=dict) - - def test_list_corpora_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8304,8 +8342,8 @@ async def test_list_corpora_async_pages(): @pytest.mark.parametrize( "request_type", [ - warehouse.DeleteCorpusRequest, - dict, + warehouse.DeleteCorpusRequest(), + {}, ], ) def test_delete_corpus(request_type, transport: str = "grpc"): @@ -8316,7 +8354,7 @@ def test_delete_corpus(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_corpus), "__call__") as call: @@ -8357,9 +8395,10 @@ def test_delete_corpus_non_empty_request_with_auto_populated_field(): client.delete_corpus(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.DeleteCorpusRequest( + request_msg = warehouse.DeleteCorpusRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_corpus_use_cached_wrapped_rpc(): @@ -8440,9 +8479,14 @@ async def test_delete_corpus_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_corpus_async( - transport: str = "grpc_asyncio", request_type=warehouse.DeleteCorpusRequest -): +@pytest.mark.parametrize( + "request_type", + [ + warehouse.DeleteCorpusRequest(), + {}, + ], +) +async def test_delete_corpus_async(request_type, transport: str = "grpc_asyncio"): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8450,7 +8494,7 @@ async def test_delete_corpus_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_corpus), "__call__") as call: @@ -8468,11 +8512,6 @@ async def test_delete_corpus_async( assert response is None -@pytest.mark.asyncio -async def test_delete_corpus_async_from_dict(): - await test_delete_corpus_async(request_type=dict) - - def test_delete_corpus_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8615,8 +8654,8 @@ async def test_delete_corpus_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - warehouse.AnalyzeCorpusRequest, - dict, + warehouse.AnalyzeCorpusRequest(), + {}, ], ) def test_analyze_corpus(request_type, transport: str = "grpc"): @@ -8627,7 +8666,7 @@ def test_analyze_corpus(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.analyze_corpus), "__call__") as call: @@ -8668,9 +8707,10 @@ def test_analyze_corpus_non_empty_request_with_auto_populated_field(): client.analyze_corpus(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.AnalyzeCorpusRequest( + request_msg = warehouse.AnalyzeCorpusRequest( name="name_value", ) + assert args[0] == request_msg def test_analyze_corpus_use_cached_wrapped_rpc(): @@ -8761,9 +8801,14 @@ async def test_analyze_corpus_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_analyze_corpus_async( - transport: str = "grpc_asyncio", request_type=warehouse.AnalyzeCorpusRequest -): +@pytest.mark.parametrize( + "request_type", + [ + warehouse.AnalyzeCorpusRequest(), + {}, + ], +) +async def test_analyze_corpus_async(request_type, transport: str = "grpc_asyncio"): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8771,7 +8816,7 @@ async def test_analyze_corpus_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.analyze_corpus), "__call__") as call: @@ -8791,11 +8836,6 @@ async def test_analyze_corpus_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_analyze_corpus_async_from_dict(): - await test_analyze_corpus_async(request_type=dict) - - def test_analyze_corpus_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8860,8 +8900,8 @@ async def test_analyze_corpus_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - warehouse.CreateDataSchemaRequest, - dict, + warehouse.CreateDataSchemaRequest(), + {}, ], ) def test_create_data_schema(request_type, transport: str = "grpc"): @@ -8872,7 +8912,7 @@ def test_create_data_schema(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8922,9 +8962,10 @@ def test_create_data_schema_non_empty_request_with_auto_populated_field(): client.create_data_schema(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.CreateDataSchemaRequest( + request_msg = warehouse.CreateDataSchemaRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_data_schema_use_cached_wrapped_rpc(): @@ -9009,9 +9050,14 @@ async def test_create_data_schema_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_data_schema_async( - transport: str = "grpc_asyncio", request_type=warehouse.CreateDataSchemaRequest -): +@pytest.mark.parametrize( + "request_type", + [ + warehouse.CreateDataSchemaRequest(), + {}, + ], +) +async def test_create_data_schema_async(request_type, transport: str = "grpc_asyncio"): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9019,7 +9065,7 @@ async def test_create_data_schema_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( @@ -9046,11 +9092,6 @@ async def test_create_data_schema_async( assert response.key == "key_value" -@pytest.mark.asyncio -async def test_create_data_schema_async_from_dict(): - await test_create_data_schema_async(request_type=dict) - - def test_create_data_schema_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9215,8 +9256,8 @@ async def test_create_data_schema_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - warehouse.UpdateDataSchemaRequest, - dict, + warehouse.UpdateDataSchemaRequest(), + {}, ], ) def test_update_data_schema(request_type, transport: str = "grpc"): @@ -9227,7 +9268,7 @@ def test_update_data_schema(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9275,7 +9316,8 @@ def test_update_data_schema_non_empty_request_with_auto_populated_field(): client.update_data_schema(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.UpdateDataSchemaRequest() + request_msg = warehouse.UpdateDataSchemaRequest() + assert args[0] == request_msg def test_update_data_schema_use_cached_wrapped_rpc(): @@ -9360,9 +9402,14 @@ async def test_update_data_schema_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_data_schema_async( - transport: str = "grpc_asyncio", request_type=warehouse.UpdateDataSchemaRequest -): +@pytest.mark.parametrize( + "request_type", + [ + warehouse.UpdateDataSchemaRequest(), + {}, + ], +) +async def test_update_data_schema_async(request_type, transport: str = "grpc_asyncio"): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9370,7 +9417,7 @@ async def test_update_data_schema_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( @@ -9397,11 +9444,6 @@ async def test_update_data_schema_async( assert response.key == "key_value" -@pytest.mark.asyncio -async def test_update_data_schema_async_from_dict(): - await test_update_data_schema_async(request_type=dict) - - def test_update_data_schema_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9566,8 +9608,8 @@ async def test_update_data_schema_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - warehouse.GetDataSchemaRequest, - dict, + warehouse.GetDataSchemaRequest(), + {}, ], ) def test_get_data_schema(request_type, transport: str = "grpc"): @@ -9578,7 +9620,7 @@ def test_get_data_schema(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_data_schema), "__call__") as call: @@ -9624,9 +9666,10 @@ def test_get_data_schema_non_empty_request_with_auto_populated_field(): client.get_data_schema(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.GetDataSchemaRequest( + request_msg = warehouse.GetDataSchemaRequest( name="name_value", ) + assert args[0] == request_msg def test_get_data_schema_use_cached_wrapped_rpc(): @@ -9707,9 +9750,14 @@ async def test_get_data_schema_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_data_schema_async( - transport: str = "grpc_asyncio", request_type=warehouse.GetDataSchemaRequest -): +@pytest.mark.parametrize( + "request_type", + [ + warehouse.GetDataSchemaRequest(), + {}, + ], +) +async def test_get_data_schema_async(request_type, transport: str = "grpc_asyncio"): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9717,7 +9765,7 @@ async def test_get_data_schema_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_data_schema), "__call__") as call: @@ -9742,11 +9790,6 @@ async def test_get_data_schema_async( assert response.key == "key_value" -@pytest.mark.asyncio -async def test_get_data_schema_async_from_dict(): - await test_get_data_schema_async(request_type=dict) - - def test_get_data_schema_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9893,8 +9936,8 @@ async def test_get_data_schema_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - warehouse.DeleteDataSchemaRequest, - dict, + warehouse.DeleteDataSchemaRequest(), + {}, ], ) def test_delete_data_schema(request_type, transport: str = "grpc"): @@ -9905,7 +9948,7 @@ def test_delete_data_schema(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9950,9 +9993,10 @@ def test_delete_data_schema_non_empty_request_with_auto_populated_field(): client.delete_data_schema(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.DeleteDataSchemaRequest( + request_msg = warehouse.DeleteDataSchemaRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_data_schema_use_cached_wrapped_rpc(): @@ -10037,9 +10081,14 @@ async def test_delete_data_schema_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_data_schema_async( - transport: str = "grpc_asyncio", request_type=warehouse.DeleteDataSchemaRequest -): +@pytest.mark.parametrize( + "request_type", + [ + warehouse.DeleteDataSchemaRequest(), + {}, + ], +) +async def test_delete_data_schema_async(request_type, transport: str = "grpc_asyncio"): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10047,7 +10096,7 @@ async def test_delete_data_schema_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( @@ -10067,11 +10116,6 @@ async def test_delete_data_schema_async( assert response is None -@pytest.mark.asyncio -async def test_delete_data_schema_async_from_dict(): - await test_delete_data_schema_async(request_type=dict) - - def test_delete_data_schema_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10222,8 +10266,8 @@ async def test_delete_data_schema_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - warehouse.ListDataSchemasRequest, - dict, + warehouse.ListDataSchemasRequest(), + {}, ], ) def test_list_data_schemas(request_type, transport: str = "grpc"): @@ -10234,7 +10278,7 @@ def test_list_data_schemas(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10283,10 +10327,11 @@ def test_list_data_schemas_non_empty_request_with_auto_populated_field(): client.list_data_schemas(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.ListDataSchemasRequest( + request_msg = warehouse.ListDataSchemasRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_data_schemas_use_cached_wrapped_rpc(): @@ -10369,9 +10414,14 @@ async def test_list_data_schemas_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_data_schemas_async( - transport: str = "grpc_asyncio", request_type=warehouse.ListDataSchemasRequest -): +@pytest.mark.parametrize( + "request_type", + [ + warehouse.ListDataSchemasRequest(), + {}, + ], +) +async def test_list_data_schemas_async(request_type, transport: str = "grpc_asyncio"): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10379,7 +10429,7 @@ async def test_list_data_schemas_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( @@ -10404,11 +10454,6 @@ async def test_list_data_schemas_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_data_schemas_async_from_dict(): - await test_list_data_schemas_async(request_type=dict) - - def test_list_data_schemas_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10761,8 +10806,8 @@ async def test_list_data_schemas_async_pages(): @pytest.mark.parametrize( "request_type", [ - warehouse.CreateAnnotationRequest, - dict, + warehouse.CreateAnnotationRequest(), + {}, ], ) def test_create_annotation(request_type, transport: str = "grpc"): @@ -10773,7 +10818,7 @@ def test_create_annotation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10822,10 +10867,11 @@ def test_create_annotation_non_empty_request_with_auto_populated_field(): client.create_annotation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.CreateAnnotationRequest( + request_msg = warehouse.CreateAnnotationRequest( parent="parent_value", annotation_id="annotation_id_value", ) + assert args[0] == request_msg def test_create_annotation_use_cached_wrapped_rpc(): @@ -10908,9 +10954,14 @@ async def test_create_annotation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_annotation_async( - transport: str = "grpc_asyncio", request_type=warehouse.CreateAnnotationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + warehouse.CreateAnnotationRequest(), + {}, + ], +) +async def test_create_annotation_async(request_type, transport: str = "grpc_asyncio"): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10918,7 +10969,7 @@ async def test_create_annotation_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( @@ -10943,11 +10994,6 @@ async def test_create_annotation_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_create_annotation_async_from_dict(): - await test_create_annotation_async(request_type=dict) - - def test_create_annotation_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11122,8 +11168,8 @@ async def test_create_annotation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - warehouse.GetAnnotationRequest, - dict, + warehouse.GetAnnotationRequest(), + {}, ], ) def test_get_annotation(request_type, transport: str = "grpc"): @@ -11134,7 +11180,7 @@ def test_get_annotation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_annotation), "__call__") as call: @@ -11178,9 +11224,10 @@ def test_get_annotation_non_empty_request_with_auto_populated_field(): client.get_annotation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.GetAnnotationRequest( + request_msg = warehouse.GetAnnotationRequest( name="name_value", ) + assert args[0] == request_msg def test_get_annotation_use_cached_wrapped_rpc(): @@ -11261,9 +11308,14 @@ async def test_get_annotation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_annotation_async( - transport: str = "grpc_asyncio", request_type=warehouse.GetAnnotationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + warehouse.GetAnnotationRequest(), + {}, + ], +) +async def test_get_annotation_async(request_type, transport: str = "grpc_asyncio"): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11271,7 +11323,7 @@ async def test_get_annotation_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_annotation), "__call__") as call: @@ -11294,11 +11346,6 @@ async def test_get_annotation_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_annotation_async_from_dict(): - await test_get_annotation_async(request_type=dict) - - def test_get_annotation_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11445,8 +11492,8 @@ async def test_get_annotation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - warehouse.ListAnnotationsRequest, - dict, + warehouse.ListAnnotationsRequest(), + {}, ], ) def test_list_annotations(request_type, transport: str = "grpc"): @@ -11457,7 +11504,7 @@ def test_list_annotations(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_annotations), "__call__") as call: @@ -11503,11 +11550,12 @@ def test_list_annotations_non_empty_request_with_auto_populated_field(): client.list_annotations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.ListAnnotationsRequest( + request_msg = warehouse.ListAnnotationsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_annotations_use_cached_wrapped_rpc(): @@ -11590,9 +11638,14 @@ async def test_list_annotations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_annotations_async( - transport: str = "grpc_asyncio", request_type=warehouse.ListAnnotationsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + warehouse.ListAnnotationsRequest(), + {}, + ], +) +async def test_list_annotations_async(request_type, transport: str = "grpc_asyncio"): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11600,7 +11653,7 @@ async def test_list_annotations_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_annotations), "__call__") as call: @@ -11623,11 +11676,6 @@ async def test_list_annotations_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_annotations_async_from_dict(): - await test_list_annotations_async(request_type=dict) - - def test_list_annotations_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11964,8 +12012,8 @@ async def test_list_annotations_async_pages(): @pytest.mark.parametrize( "request_type", [ - warehouse.UpdateAnnotationRequest, - dict, + warehouse.UpdateAnnotationRequest(), + {}, ], ) def test_update_annotation(request_type, transport: str = "grpc"): @@ -11976,7 +12024,7 @@ def test_update_annotation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -12022,7 +12070,8 @@ def test_update_annotation_non_empty_request_with_auto_populated_field(): client.update_annotation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.UpdateAnnotationRequest() + request_msg = warehouse.UpdateAnnotationRequest() + assert args[0] == request_msg def test_update_annotation_use_cached_wrapped_rpc(): @@ -12105,9 +12154,14 @@ async def test_update_annotation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_annotation_async( - transport: str = "grpc_asyncio", request_type=warehouse.UpdateAnnotationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + warehouse.UpdateAnnotationRequest(), + {}, + ], +) +async def test_update_annotation_async(request_type, transport: str = "grpc_asyncio"): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12115,7 +12169,7 @@ async def test_update_annotation_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( @@ -12140,11 +12194,6 @@ async def test_update_annotation_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_update_annotation_async_from_dict(): - await test_update_annotation_async(request_type=dict) - - def test_update_annotation_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12309,8 +12358,8 @@ async def test_update_annotation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - warehouse.DeleteAnnotationRequest, - dict, + warehouse.DeleteAnnotationRequest(), + {}, ], ) def test_delete_annotation(request_type, transport: str = "grpc"): @@ -12321,7 +12370,7 @@ def test_delete_annotation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -12366,9 +12415,10 @@ def test_delete_annotation_non_empty_request_with_auto_populated_field(): client.delete_annotation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.DeleteAnnotationRequest( + request_msg = warehouse.DeleteAnnotationRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_annotation_use_cached_wrapped_rpc(): @@ -12451,9 +12501,14 @@ async def test_delete_annotation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_annotation_async( - transport: str = "grpc_asyncio", request_type=warehouse.DeleteAnnotationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + warehouse.DeleteAnnotationRequest(), + {}, + ], +) +async def test_delete_annotation_async(request_type, transport: str = "grpc_asyncio"): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12461,7 +12516,7 @@ async def test_delete_annotation_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( @@ -12481,11 +12536,6 @@ async def test_delete_annotation_async( assert response is None -@pytest.mark.asyncio -async def test_delete_annotation_async_from_dict(): - await test_delete_annotation_async(request_type=dict) - - def test_delete_annotation_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12636,8 +12686,8 @@ async def test_delete_annotation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - warehouse.IngestAssetRequest, - dict, + warehouse.IngestAssetRequest(), + {}, ], ) def test_ingest_asset(request_type, transport: str = "grpc"): @@ -12648,7 +12698,7 @@ def test_ingest_asset(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as 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. @@ -12745,9 +12795,14 @@ async def test_ingest_asset_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_ingest_asset_async( - transport: str = "grpc_asyncio", request_type=warehouse.IngestAssetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + warehouse.IngestAssetRequest(), + {}, + ], +) +async def test_ingest_asset_async(request_type, transport: str = "grpc_asyncio"): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12755,7 +12810,7 @@ async def test_ingest_asset_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. @@ -12777,16 +12832,11 @@ async def test_ingest_asset_async( assert isinstance(message, warehouse.IngestAssetResponse) -@pytest.mark.asyncio -async def test_ingest_asset_async_from_dict(): - await test_ingest_asset_async(request_type=dict) - - @pytest.mark.parametrize( "request_type", [ - warehouse.ClipAssetRequest, - dict, + warehouse.ClipAssetRequest(), + {}, ], ) def test_clip_asset(request_type, transport: str = "grpc"): @@ -12797,7 +12847,7 @@ def test_clip_asset(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.clip_asset), "__call__") as call: @@ -12838,9 +12888,10 @@ def test_clip_asset_non_empty_request_with_auto_populated_field(): client.clip_asset(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.ClipAssetRequest( + request_msg = warehouse.ClipAssetRequest( name="name_value", ) + assert args[0] == request_msg def test_clip_asset_use_cached_wrapped_rpc(): @@ -12919,9 +12970,14 @@ async def test_clip_asset_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_clip_asset_async( - transport: str = "grpc_asyncio", request_type=warehouse.ClipAssetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + warehouse.ClipAssetRequest(), + {}, + ], +) +async def test_clip_asset_async(request_type, transport: str = "grpc_asyncio"): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12929,7 +12985,7 @@ async def test_clip_asset_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.clip_asset), "__call__") as call: @@ -12949,11 +13005,6 @@ async def test_clip_asset_async( assert isinstance(response, warehouse.ClipAssetResponse) -@pytest.mark.asyncio -async def test_clip_asset_async_from_dict(): - await test_clip_asset_async(request_type=dict) - - def test_clip_asset_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13018,8 +13069,8 @@ async def test_clip_asset_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - warehouse.GenerateHlsUriRequest, - dict, + warehouse.GenerateHlsUriRequest(), + {}, ], ) def test_generate_hls_uri(request_type, transport: str = "grpc"): @@ -13030,7 +13081,7 @@ def test_generate_hls_uri(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.generate_hls_uri), "__call__") as call: @@ -13074,9 +13125,10 @@ def test_generate_hls_uri_non_empty_request_with_auto_populated_field(): client.generate_hls_uri(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.GenerateHlsUriRequest( + request_msg = warehouse.GenerateHlsUriRequest( name="name_value", ) + assert args[0] == request_msg def test_generate_hls_uri_use_cached_wrapped_rpc(): @@ -13159,9 +13211,14 @@ async def test_generate_hls_uri_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_generate_hls_uri_async( - transport: str = "grpc_asyncio", request_type=warehouse.GenerateHlsUriRequest -): +@pytest.mark.parametrize( + "request_type", + [ + warehouse.GenerateHlsUriRequest(), + {}, + ], +) +async def test_generate_hls_uri_async(request_type, transport: str = "grpc_asyncio"): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13169,7 +13226,7 @@ async def test_generate_hls_uri_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.generate_hls_uri), "__call__") as call: @@ -13192,11 +13249,6 @@ async def test_generate_hls_uri_async( assert response.uri == "uri_value" -@pytest.mark.asyncio -async def test_generate_hls_uri_async_from_dict(): - await test_generate_hls_uri_async(request_type=dict) - - def test_generate_hls_uri_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13261,8 +13313,8 @@ async def test_generate_hls_uri_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - warehouse.ImportAssetsRequest, - dict, + warehouse.ImportAssetsRequest(), + {}, ], ) def test_import_assets(request_type, transport: str = "grpc"): @@ -13273,7 +13325,7 @@ def test_import_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(type(client.transport.import_assets), "__call__") as call: @@ -13315,10 +13367,11 @@ def test_import_assets_non_empty_request_with_auto_populated_field(): client.import_assets(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.ImportAssetsRequest( + request_msg = warehouse.ImportAssetsRequest( assets_gcs_uri="assets_gcs_uri_value", parent="parent_value", ) + assert args[0] == request_msg def test_import_assets_use_cached_wrapped_rpc(): @@ -13409,9 +13462,14 @@ async def test_import_assets_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_import_assets_async( - transport: str = "grpc_asyncio", request_type=warehouse.ImportAssetsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + warehouse.ImportAssetsRequest(), + {}, + ], +) +async def test_import_assets_async(request_type, transport: str = "grpc_asyncio"): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13419,7 +13477,7 @@ async def test_import_assets_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.import_assets), "__call__") as call: @@ -13439,11 +13497,6 @@ async def test_import_assets_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_import_assets_async_from_dict(): - await test_import_assets_async(request_type=dict) - - def test_import_assets_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13508,8 +13561,8 @@ async def test_import_assets_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - warehouse.CreateSearchConfigRequest, - dict, + warehouse.CreateSearchConfigRequest(), + {}, ], ) def test_create_search_config(request_type, transport: str = "grpc"): @@ -13520,7 +13573,7 @@ def test_create_search_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( @@ -13569,10 +13622,11 @@ def test_create_search_config_non_empty_request_with_auto_populated_field(): client.create_search_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.CreateSearchConfigRequest( + request_msg = warehouse.CreateSearchConfigRequest( parent="parent_value", search_config_id="search_config_id_value", ) + assert args[0] == request_msg def test_create_search_config_use_cached_wrapped_rpc(): @@ -13657,8 +13711,15 @@ async def test_create_search_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + warehouse.CreateSearchConfigRequest(), + {}, + ], +) async def test_create_search_config_async( - transport: str = "grpc_asyncio", request_type=warehouse.CreateSearchConfigRequest + request_type, transport: str = "grpc_asyncio" ): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), @@ -13667,7 +13728,7 @@ async def test_create_search_config_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( @@ -13692,11 +13753,6 @@ async def test_create_search_config_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_create_search_config_async_from_dict(): - await test_create_search_config_async(request_type=dict) - - def test_create_search_config_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13871,8 +13927,8 @@ async def test_create_search_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - warehouse.UpdateSearchConfigRequest, - dict, + warehouse.UpdateSearchConfigRequest(), + {}, ], ) def test_update_search_config(request_type, transport: str = "grpc"): @@ -13883,7 +13939,7 @@ def test_update_search_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( @@ -13929,7 +13985,8 @@ def test_update_search_config_non_empty_request_with_auto_populated_field(): client.update_search_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.UpdateSearchConfigRequest() + request_msg = warehouse.UpdateSearchConfigRequest() + assert args[0] == request_msg def test_update_search_config_use_cached_wrapped_rpc(): @@ -14014,8 +14071,15 @@ async def test_update_search_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + warehouse.UpdateSearchConfigRequest(), + {}, + ], +) async def test_update_search_config_async( - transport: str = "grpc_asyncio", request_type=warehouse.UpdateSearchConfigRequest + request_type, transport: str = "grpc_asyncio" ): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), @@ -14024,7 +14088,7 @@ async def test_update_search_config_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( @@ -14049,11 +14113,6 @@ async def test_update_search_config_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_update_search_config_async_from_dict(): - await test_update_search_config_async(request_type=dict) - - def test_update_search_config_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14218,8 +14277,8 @@ async def test_update_search_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - warehouse.GetSearchConfigRequest, - dict, + warehouse.GetSearchConfigRequest(), + {}, ], ) def test_get_search_config(request_type, transport: str = "grpc"): @@ -14230,7 +14289,7 @@ def test_get_search_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( @@ -14278,9 +14337,10 @@ def test_get_search_config_non_empty_request_with_auto_populated_field(): client.get_search_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.GetSearchConfigRequest( + request_msg = warehouse.GetSearchConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_search_config_use_cached_wrapped_rpc(): @@ -14363,9 +14423,14 @@ async def test_get_search_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_search_config_async( - transport: str = "grpc_asyncio", request_type=warehouse.GetSearchConfigRequest -): +@pytest.mark.parametrize( + "request_type", + [ + warehouse.GetSearchConfigRequest(), + {}, + ], +) +async def test_get_search_config_async(request_type, transport: str = "grpc_asyncio"): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14373,7 +14438,7 @@ async def test_get_search_config_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( @@ -14398,11 +14463,6 @@ async def test_get_search_config_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_search_config_async_from_dict(): - await test_get_search_config_async(request_type=dict) - - def test_get_search_config_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14557,8 +14617,8 @@ async def test_get_search_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - warehouse.DeleteSearchConfigRequest, - dict, + warehouse.DeleteSearchConfigRequest(), + {}, ], ) def test_delete_search_config(request_type, transport: str = "grpc"): @@ -14569,7 +14629,7 @@ def test_delete_search_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( @@ -14614,9 +14674,10 @@ def test_delete_search_config_non_empty_request_with_auto_populated_field(): client.delete_search_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.DeleteSearchConfigRequest( + request_msg = warehouse.DeleteSearchConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_search_config_use_cached_wrapped_rpc(): @@ -14701,8 +14762,15 @@ async def test_delete_search_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + warehouse.DeleteSearchConfigRequest(), + {}, + ], +) async def test_delete_search_config_async( - transport: str = "grpc_asyncio", request_type=warehouse.DeleteSearchConfigRequest + request_type, transport: str = "grpc_asyncio" ): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), @@ -14711,7 +14779,7 @@ async def test_delete_search_config_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( @@ -14731,11 +14799,6 @@ async def test_delete_search_config_async( assert response is None -@pytest.mark.asyncio -async def test_delete_search_config_async_from_dict(): - await test_delete_search_config_async(request_type=dict) - - def test_delete_search_config_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14886,8 +14949,8 @@ async def test_delete_search_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - warehouse.ListSearchConfigsRequest, - dict, + warehouse.ListSearchConfigsRequest(), + {}, ], ) def test_list_search_configs(request_type, transport: str = "grpc"): @@ -14898,7 +14961,7 @@ def test_list_search_configs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -14947,10 +15010,11 @@ def test_list_search_configs_non_empty_request_with_auto_populated_field(): client.list_search_configs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.ListSearchConfigsRequest( + request_msg = warehouse.ListSearchConfigsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_search_configs_use_cached_wrapped_rpc(): @@ -15035,9 +15099,14 @@ async def test_list_search_configs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_search_configs_async( - transport: str = "grpc_asyncio", request_type=warehouse.ListSearchConfigsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + warehouse.ListSearchConfigsRequest(), + {}, + ], +) +async def test_list_search_configs_async(request_type, transport: str = "grpc_asyncio"): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -15045,7 +15114,7 @@ async def test_list_search_configs_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( @@ -15070,11 +15139,6 @@ async def test_list_search_configs_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_search_configs_async_from_dict(): - await test_list_search_configs_async(request_type=dict) - - def test_list_search_configs_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15427,8 +15491,8 @@ async def test_list_search_configs_async_pages(): @pytest.mark.parametrize( "request_type", [ - warehouse.CreateSearchHypernymRequest, - dict, + warehouse.CreateSearchHypernymRequest(), + {}, ], ) def test_create_search_hypernym(request_type, transport: str = "grpc"): @@ -15439,7 +15503,7 @@ def test_create_search_hypernym(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -15492,10 +15556,11 @@ def test_create_search_hypernym_non_empty_request_with_auto_populated_field(): client.create_search_hypernym(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.CreateSearchHypernymRequest( + request_msg = warehouse.CreateSearchHypernymRequest( parent="parent_value", search_hypernym_id="search_hypernym_id_value", ) + assert args[0] == request_msg def test_create_search_hypernym_use_cached_wrapped_rpc(): @@ -15581,8 +15646,15 @@ async def test_create_search_hypernym_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + warehouse.CreateSearchHypernymRequest(), + {}, + ], +) async def test_create_search_hypernym_async( - transport: str = "grpc_asyncio", request_type=warehouse.CreateSearchHypernymRequest + request_type, transport: str = "grpc_asyncio" ): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), @@ -15591,7 +15663,7 @@ async def test_create_search_hypernym_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( @@ -15620,11 +15692,6 @@ async def test_create_search_hypernym_async( assert response.hyponyms == ["hyponyms_value"] -@pytest.mark.asyncio -async def test_create_search_hypernym_async_from_dict(): - await test_create_search_hypernym_async(request_type=dict) - - def test_create_search_hypernym_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15799,8 +15866,8 @@ async def test_create_search_hypernym_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - warehouse.UpdateSearchHypernymRequest, - dict, + warehouse.UpdateSearchHypernymRequest(), + {}, ], ) def test_update_search_hypernym(request_type, transport: str = "grpc"): @@ -15811,7 +15878,7 @@ def test_update_search_hypernym(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -15861,7 +15928,8 @@ def test_update_search_hypernym_non_empty_request_with_auto_populated_field(): client.update_search_hypernym(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.UpdateSearchHypernymRequest() + request_msg = warehouse.UpdateSearchHypernymRequest() + assert args[0] == request_msg def test_update_search_hypernym_use_cached_wrapped_rpc(): @@ -15947,8 +16015,15 @@ async def test_update_search_hypernym_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + warehouse.UpdateSearchHypernymRequest(), + {}, + ], +) async def test_update_search_hypernym_async( - transport: str = "grpc_asyncio", request_type=warehouse.UpdateSearchHypernymRequest + request_type, transport: str = "grpc_asyncio" ): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), @@ -15957,7 +16032,7 @@ async def test_update_search_hypernym_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( @@ -15986,11 +16061,6 @@ async def test_update_search_hypernym_async( assert response.hyponyms == ["hyponyms_value"] -@pytest.mark.asyncio -async def test_update_search_hypernym_async_from_dict(): - await test_update_search_hypernym_async(request_type=dict) - - def test_update_search_hypernym_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16155,8 +16225,8 @@ async def test_update_search_hypernym_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - warehouse.GetSearchHypernymRequest, - dict, + warehouse.GetSearchHypernymRequest(), + {}, ], ) def test_get_search_hypernym(request_type, transport: str = "grpc"): @@ -16167,7 +16237,7 @@ def test_get_search_hypernym(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -16219,9 +16289,10 @@ def test_get_search_hypernym_non_empty_request_with_auto_populated_field(): client.get_search_hypernym(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.GetSearchHypernymRequest( + request_msg = warehouse.GetSearchHypernymRequest( name="name_value", ) + assert args[0] == request_msg def test_get_search_hypernym_use_cached_wrapped_rpc(): @@ -16306,9 +16377,14 @@ async def test_get_search_hypernym_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_search_hypernym_async( - transport: str = "grpc_asyncio", request_type=warehouse.GetSearchHypernymRequest -): +@pytest.mark.parametrize( + "request_type", + [ + warehouse.GetSearchHypernymRequest(), + {}, + ], +) +async def test_get_search_hypernym_async(request_type, transport: str = "grpc_asyncio"): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -16316,7 +16392,7 @@ async def test_get_search_hypernym_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( @@ -16345,11 +16421,6 @@ async def test_get_search_hypernym_async( assert response.hyponyms == ["hyponyms_value"] -@pytest.mark.asyncio -async def test_get_search_hypernym_async_from_dict(): - await test_get_search_hypernym_async(request_type=dict) - - def test_get_search_hypernym_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16504,8 +16575,8 @@ async def test_get_search_hypernym_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - warehouse.DeleteSearchHypernymRequest, - dict, + warehouse.DeleteSearchHypernymRequest(), + {}, ], ) def test_delete_search_hypernym(request_type, transport: str = "grpc"): @@ -16516,7 +16587,7 @@ def test_delete_search_hypernym(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -16561,9 +16632,10 @@ def test_delete_search_hypernym_non_empty_request_with_auto_populated_field(): client.delete_search_hypernym(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.DeleteSearchHypernymRequest( + request_msg = warehouse.DeleteSearchHypernymRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_search_hypernym_use_cached_wrapped_rpc(): @@ -16649,8 +16721,15 @@ async def test_delete_search_hypernym_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + warehouse.DeleteSearchHypernymRequest(), + {}, + ], +) async def test_delete_search_hypernym_async( - transport: str = "grpc_asyncio", request_type=warehouse.DeleteSearchHypernymRequest + request_type, transport: str = "grpc_asyncio" ): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), @@ -16659,7 +16738,7 @@ async def test_delete_search_hypernym_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( @@ -16679,11 +16758,6 @@ async def test_delete_search_hypernym_async( assert response is None -@pytest.mark.asyncio -async def test_delete_search_hypernym_async_from_dict(): - await test_delete_search_hypernym_async(request_type=dict) - - def test_delete_search_hypernym_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16834,8 +16908,8 @@ async def test_delete_search_hypernym_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - warehouse.ListSearchHypernymsRequest, - dict, + warehouse.ListSearchHypernymsRequest(), + {}, ], ) def test_list_search_hypernyms(request_type, transport: str = "grpc"): @@ -16846,7 +16920,7 @@ def test_list_search_hypernyms(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -16895,10 +16969,11 @@ def test_list_search_hypernyms_non_empty_request_with_auto_populated_field(): client.list_search_hypernyms(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.ListSearchHypernymsRequest( + request_msg = warehouse.ListSearchHypernymsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_search_hypernyms_use_cached_wrapped_rpc(): @@ -16984,8 +17059,15 @@ async def test_list_search_hypernyms_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + warehouse.ListSearchHypernymsRequest(), + {}, + ], +) async def test_list_search_hypernyms_async( - transport: str = "grpc_asyncio", request_type=warehouse.ListSearchHypernymsRequest + request_type, transport: str = "grpc_asyncio" ): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), @@ -16994,7 +17076,7 @@ async def test_list_search_hypernyms_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( @@ -17019,11 +17101,6 @@ async def test_list_search_hypernyms_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_search_hypernyms_async_from_dict(): - await test_list_search_hypernyms_async(request_type=dict) - - def test_list_search_hypernyms_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17376,8 +17453,8 @@ async def test_list_search_hypernyms_async_pages(): @pytest.mark.parametrize( "request_type", [ - warehouse.SearchAssetsRequest, - dict, + warehouse.SearchAssetsRequest(), + {}, ], ) def test_search_assets(request_type, transport: str = "grpc"): @@ -17388,7 +17465,7 @@ def test_search_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(type(client.transport.search_assets), "__call__") as call: @@ -17434,11 +17511,12 @@ def test_search_assets_non_empty_request_with_auto_populated_field(): client.search_assets(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.SearchAssetsRequest( + request_msg = warehouse.SearchAssetsRequest( corpus="corpus_value", page_token="page_token_value", search_query="search_query_value", ) + assert args[0] == request_msg def test_search_assets_use_cached_wrapped_rpc(): @@ -17519,9 +17597,14 @@ async def test_search_assets_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_search_assets_async( - transport: str = "grpc_asyncio", request_type=warehouse.SearchAssetsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + warehouse.SearchAssetsRequest(), + {}, + ], +) +async def test_search_assets_async(request_type, transport: str = "grpc_asyncio"): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -17529,7 +17612,7 @@ async def test_search_assets_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.search_assets), "__call__") as call: @@ -17552,11 +17635,6 @@ async def test_search_assets_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_search_assets_async_from_dict(): - await test_search_assets_async(request_type=dict) - - def test_search_assets_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17811,8 +17889,8 @@ async def test_search_assets_async_pages(): @pytest.mark.parametrize( "request_type", [ - warehouse.SearchIndexEndpointRequest, - dict, + warehouse.SearchIndexEndpointRequest(), + {}, ], ) def test_search_index_endpoint(request_type, transport: str = "grpc"): @@ -17823,7 +17901,7 @@ def test_search_index_endpoint(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -17873,11 +17951,12 @@ def test_search_index_endpoint_non_empty_request_with_auto_populated_field(): client.search_index_endpoint(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.SearchIndexEndpointRequest( + request_msg = warehouse.SearchIndexEndpointRequest( text_query="text_query_value", index_endpoint="index_endpoint_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_search_index_endpoint_use_cached_wrapped_rpc(): @@ -17963,8 +18042,15 @@ async def test_search_index_endpoint_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + warehouse.SearchIndexEndpointRequest(), + {}, + ], +) async def test_search_index_endpoint_async( - transport: str = "grpc_asyncio", request_type=warehouse.SearchIndexEndpointRequest + request_type, transport: str = "grpc_asyncio" ): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), @@ -17973,7 +18059,7 @@ async def test_search_index_endpoint_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( @@ -17998,11 +18084,6 @@ async def test_search_index_endpoint_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_search_index_endpoint_async_from_dict(): - await test_search_index_endpoint_async(request_type=dict) - - def test_search_index_endpoint_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18269,8 +18350,8 @@ async def test_search_index_endpoint_async_pages(): @pytest.mark.parametrize( "request_type", [ - warehouse.CreateIndexEndpointRequest, - dict, + warehouse.CreateIndexEndpointRequest(), + {}, ], ) def test_create_index_endpoint(request_type, transport: str = "grpc"): @@ -18281,7 +18362,7 @@ def test_create_index_endpoint(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -18327,10 +18408,11 @@ def test_create_index_endpoint_non_empty_request_with_auto_populated_field(): client.create_index_endpoint(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.CreateIndexEndpointRequest( + request_msg = warehouse.CreateIndexEndpointRequest( parent="parent_value", index_endpoint_id="index_endpoint_id_value", ) + assert args[0] == request_msg def test_create_index_endpoint_use_cached_wrapped_rpc(): @@ -18426,8 +18508,15 @@ async def test_create_index_endpoint_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + warehouse.CreateIndexEndpointRequest(), + {}, + ], +) async def test_create_index_endpoint_async( - transport: str = "grpc_asyncio", request_type=warehouse.CreateIndexEndpointRequest + request_type, transport: str = "grpc_asyncio" ): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), @@ -18436,7 +18525,7 @@ async def test_create_index_endpoint_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( @@ -18458,11 +18547,6 @@ async def test_create_index_endpoint_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_index_endpoint_async_from_dict(): - await test_create_index_endpoint_async(request_type=dict) - - def test_create_index_endpoint_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18637,8 +18721,8 @@ async def test_create_index_endpoint_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - warehouse.GetIndexEndpointRequest, - dict, + warehouse.GetIndexEndpointRequest(), + {}, ], ) def test_get_index_endpoint(request_type, transport: str = "grpc"): @@ -18649,7 +18733,7 @@ def test_get_index_endpoint(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -18707,9 +18791,10 @@ def test_get_index_endpoint_non_empty_request_with_auto_populated_field(): client.get_index_endpoint(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.GetIndexEndpointRequest( + request_msg = warehouse.GetIndexEndpointRequest( name="name_value", ) + assert args[0] == request_msg def test_get_index_endpoint_use_cached_wrapped_rpc(): @@ -18794,9 +18879,14 @@ async def test_get_index_endpoint_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_index_endpoint_async( - transport: str = "grpc_asyncio", request_type=warehouse.GetIndexEndpointRequest -): +@pytest.mark.parametrize( + "request_type", + [ + warehouse.GetIndexEndpointRequest(), + {}, + ], +) +async def test_get_index_endpoint_async(request_type, transport: str = "grpc_asyncio"): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -18804,7 +18894,7 @@ async def test_get_index_endpoint_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( @@ -18839,11 +18929,6 @@ async def test_get_index_endpoint_async( assert response.satisfies_pzi is True -@pytest.mark.asyncio -async def test_get_index_endpoint_async_from_dict(): - await test_get_index_endpoint_async(request_type=dict) - - def test_get_index_endpoint_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18998,8 +19083,8 @@ async def test_get_index_endpoint_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - warehouse.ListIndexEndpointsRequest, - dict, + warehouse.ListIndexEndpointsRequest(), + {}, ], ) def test_list_index_endpoints(request_type, transport: str = "grpc"): @@ -19010,7 +19095,7 @@ def test_list_index_endpoints(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -19060,11 +19145,12 @@ def test_list_index_endpoints_non_empty_request_with_auto_populated_field(): client.list_index_endpoints(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.ListIndexEndpointsRequest( + request_msg = warehouse.ListIndexEndpointsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_index_endpoints_use_cached_wrapped_rpc(): @@ -19149,8 +19235,15 @@ async def test_list_index_endpoints_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + warehouse.ListIndexEndpointsRequest(), + {}, + ], +) async def test_list_index_endpoints_async( - transport: str = "grpc_asyncio", request_type=warehouse.ListIndexEndpointsRequest + request_type, transport: str = "grpc_asyncio" ): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), @@ -19159,7 +19252,7 @@ async def test_list_index_endpoints_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( @@ -19184,11 +19277,6 @@ async def test_list_index_endpoints_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_index_endpoints_async_from_dict(): - await test_list_index_endpoints_async(request_type=dict) - - def test_list_index_endpoints_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -19541,8 +19629,8 @@ async def test_list_index_endpoints_async_pages(): @pytest.mark.parametrize( "request_type", [ - warehouse.UpdateIndexEndpointRequest, - dict, + warehouse.UpdateIndexEndpointRequest(), + {}, ], ) def test_update_index_endpoint(request_type, transport: str = "grpc"): @@ -19553,7 +19641,7 @@ def test_update_index_endpoint(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -19596,7 +19684,8 @@ def test_update_index_endpoint_non_empty_request_with_auto_populated_field(): client.update_index_endpoint(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.UpdateIndexEndpointRequest() + request_msg = warehouse.UpdateIndexEndpointRequest() + assert args[0] == request_msg def test_update_index_endpoint_use_cached_wrapped_rpc(): @@ -19692,8 +19781,15 @@ async def test_update_index_endpoint_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + warehouse.UpdateIndexEndpointRequest(), + {}, + ], +) async def test_update_index_endpoint_async( - transport: str = "grpc_asyncio", request_type=warehouse.UpdateIndexEndpointRequest + request_type, transport: str = "grpc_asyncio" ): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), @@ -19702,7 +19798,7 @@ async def test_update_index_endpoint_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( @@ -19724,11 +19820,6 @@ async def test_update_index_endpoint_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_index_endpoint_async_from_dict(): - await test_update_index_endpoint_async(request_type=dict) - - def test_update_index_endpoint_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -19893,8 +19984,8 @@ async def test_update_index_endpoint_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - warehouse.DeleteIndexEndpointRequest, - dict, + warehouse.DeleteIndexEndpointRequest(), + {}, ], ) def test_delete_index_endpoint(request_type, transport: str = "grpc"): @@ -19905,7 +19996,7 @@ def test_delete_index_endpoint(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -19950,9 +20041,10 @@ def test_delete_index_endpoint_non_empty_request_with_auto_populated_field(): client.delete_index_endpoint(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.DeleteIndexEndpointRequest( + request_msg = warehouse.DeleteIndexEndpointRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_index_endpoint_use_cached_wrapped_rpc(): @@ -20048,8 +20140,15 @@ async def test_delete_index_endpoint_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + warehouse.DeleteIndexEndpointRequest(), + {}, + ], +) async def test_delete_index_endpoint_async( - transport: str = "grpc_asyncio", request_type=warehouse.DeleteIndexEndpointRequest + request_type, transport: str = "grpc_asyncio" ): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), @@ -20058,7 +20157,7 @@ async def test_delete_index_endpoint_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( @@ -20080,11 +20179,6 @@ async def test_delete_index_endpoint_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_index_endpoint_async_from_dict(): - await test_delete_index_endpoint_async(request_type=dict) - - def test_delete_index_endpoint_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -20239,8 +20333,8 @@ async def test_delete_index_endpoint_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - warehouse.DeployIndexRequest, - dict, + warehouse.DeployIndexRequest(), + {}, ], ) def test_deploy_index(request_type, transport: str = "grpc"): @@ -20251,7 +20345,7 @@ def test_deploy_index(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.deploy_index), "__call__") as call: @@ -20292,9 +20386,10 @@ def test_deploy_index_non_empty_request_with_auto_populated_field(): client.deploy_index(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.DeployIndexRequest( + request_msg = warehouse.DeployIndexRequest( index_endpoint="index_endpoint_value", ) + assert args[0] == request_msg def test_deploy_index_use_cached_wrapped_rpc(): @@ -20385,9 +20480,14 @@ async def test_deploy_index_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_deploy_index_async( - transport: str = "grpc_asyncio", request_type=warehouse.DeployIndexRequest -): +@pytest.mark.parametrize( + "request_type", + [ + warehouse.DeployIndexRequest(), + {}, + ], +) +async def test_deploy_index_async(request_type, transport: str = "grpc_asyncio"): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -20395,7 +20495,7 @@ async def test_deploy_index_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.deploy_index), "__call__") as call: @@ -20415,11 +20515,6 @@ async def test_deploy_index_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_deploy_index_async_from_dict(): - await test_deploy_index_async(request_type=dict) - - def test_deploy_index_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -20484,8 +20579,8 @@ async def test_deploy_index_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - warehouse.UndeployIndexRequest, - dict, + warehouse.UndeployIndexRequest(), + {}, ], ) def test_undeploy_index(request_type, transport: str = "grpc"): @@ -20496,7 +20591,7 @@ def test_undeploy_index(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.undeploy_index), "__call__") as call: @@ -20537,9 +20632,10 @@ def test_undeploy_index_non_empty_request_with_auto_populated_field(): client.undeploy_index(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.UndeployIndexRequest( + request_msg = warehouse.UndeployIndexRequest( index_endpoint="index_endpoint_value", ) + assert args[0] == request_msg def test_undeploy_index_use_cached_wrapped_rpc(): @@ -20630,9 +20726,14 @@ async def test_undeploy_index_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_undeploy_index_async( - transport: str = "grpc_asyncio", request_type=warehouse.UndeployIndexRequest -): +@pytest.mark.parametrize( + "request_type", + [ + warehouse.UndeployIndexRequest(), + {}, + ], +) +async def test_undeploy_index_async(request_type, transport: str = "grpc_asyncio"): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -20640,7 +20741,7 @@ async def test_undeploy_index_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.undeploy_index), "__call__") as call: @@ -20660,11 +20761,6 @@ async def test_undeploy_index_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_undeploy_index_async_from_dict(): - await test_undeploy_index_async(request_type=dict) - - def test_undeploy_index_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -20729,8 +20825,8 @@ async def test_undeploy_index_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - warehouse.CreateCollectionRequest, - dict, + warehouse.CreateCollectionRequest(), + {}, ], ) def test_create_collection(request_type, transport: str = "grpc"): @@ -20741,7 +20837,7 @@ def test_create_collection(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -20787,10 +20883,11 @@ def test_create_collection_non_empty_request_with_auto_populated_field(): client.create_collection(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.CreateCollectionRequest( + request_msg = warehouse.CreateCollectionRequest( parent="parent_value", collection_id="collection_id_value", ) + assert args[0] == request_msg def test_create_collection_use_cached_wrapped_rpc(): @@ -20883,9 +20980,14 @@ async def test_create_collection_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_collection_async( - transport: str = "grpc_asyncio", request_type=warehouse.CreateCollectionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + warehouse.CreateCollectionRequest(), + {}, + ], +) +async def test_create_collection_async(request_type, transport: str = "grpc_asyncio"): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -20893,7 +20995,7 @@ async def test_create_collection_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( @@ -20915,11 +21017,6 @@ async def test_create_collection_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_collection_async_from_dict(): - await test_create_collection_async(request_type=dict) - - def test_create_collection_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -21094,8 +21191,8 @@ async def test_create_collection_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - warehouse.DeleteCollectionRequest, - dict, + warehouse.DeleteCollectionRequest(), + {}, ], ) def test_delete_collection(request_type, transport: str = "grpc"): @@ -21106,7 +21203,7 @@ def test_delete_collection(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -21151,9 +21248,10 @@ def test_delete_collection_non_empty_request_with_auto_populated_field(): client.delete_collection(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.DeleteCollectionRequest( + request_msg = warehouse.DeleteCollectionRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_collection_use_cached_wrapped_rpc(): @@ -21246,9 +21344,14 @@ async def test_delete_collection_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_collection_async( - transport: str = "grpc_asyncio", request_type=warehouse.DeleteCollectionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + warehouse.DeleteCollectionRequest(), + {}, + ], +) +async def test_delete_collection_async(request_type, transport: str = "grpc_asyncio"): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -21256,7 +21359,7 @@ async def test_delete_collection_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( @@ -21278,11 +21381,6 @@ async def test_delete_collection_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_collection_async_from_dict(): - await test_delete_collection_async(request_type=dict) - - def test_delete_collection_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -21437,8 +21535,8 @@ async def test_delete_collection_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - warehouse.GetCollectionRequest, - dict, + warehouse.GetCollectionRequest(), + {}, ], ) def test_get_collection(request_type, transport: str = "grpc"): @@ -21449,7 +21547,7 @@ def test_get_collection(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_collection), "__call__") as call: @@ -21497,9 +21595,10 @@ def test_get_collection_non_empty_request_with_auto_populated_field(): client.get_collection(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.GetCollectionRequest( + request_msg = warehouse.GetCollectionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_collection_use_cached_wrapped_rpc(): @@ -21580,9 +21679,14 @@ async def test_get_collection_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_collection_async( - transport: str = "grpc_asyncio", request_type=warehouse.GetCollectionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + warehouse.GetCollectionRequest(), + {}, + ], +) +async def test_get_collection_async(request_type, transport: str = "grpc_asyncio"): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -21590,7 +21694,7 @@ async def test_get_collection_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_collection), "__call__") as call: @@ -21617,11 +21721,6 @@ async def test_get_collection_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_get_collection_async_from_dict(): - await test_get_collection_async(request_type=dict) - - def test_get_collection_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -21768,8 +21867,8 @@ async def test_get_collection_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - warehouse.UpdateCollectionRequest, - dict, + warehouse.UpdateCollectionRequest(), + {}, ], ) def test_update_collection(request_type, transport: str = "grpc"): @@ -21780,7 +21879,7 @@ def test_update_collection(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -21830,7 +21929,8 @@ def test_update_collection_non_empty_request_with_auto_populated_field(): client.update_collection(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.UpdateCollectionRequest() + request_msg = warehouse.UpdateCollectionRequest() + assert args[0] == request_msg def test_update_collection_use_cached_wrapped_rpc(): @@ -21913,9 +22013,14 @@ async def test_update_collection_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_collection_async( - transport: str = "grpc_asyncio", request_type=warehouse.UpdateCollectionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + warehouse.UpdateCollectionRequest(), + {}, + ], +) +async def test_update_collection_async(request_type, transport: str = "grpc_asyncio"): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -21923,7 +22028,7 @@ async def test_update_collection_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( @@ -21952,11 +22057,6 @@ async def test_update_collection_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_update_collection_async_from_dict(): - await test_update_collection_async(request_type=dict) - - def test_update_collection_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -22121,8 +22221,8 @@ async def test_update_collection_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - warehouse.ListCollectionsRequest, - dict, + warehouse.ListCollectionsRequest(), + {}, ], ) def test_list_collections(request_type, transport: str = "grpc"): @@ -22133,7 +22233,7 @@ def test_list_collections(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_collections), "__call__") as call: @@ -22178,10 +22278,11 @@ def test_list_collections_non_empty_request_with_auto_populated_field(): client.list_collections(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.ListCollectionsRequest( + request_msg = warehouse.ListCollectionsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_collections_use_cached_wrapped_rpc(): @@ -22264,9 +22365,14 @@ async def test_list_collections_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_collections_async( - transport: str = "grpc_asyncio", request_type=warehouse.ListCollectionsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + warehouse.ListCollectionsRequest(), + {}, + ], +) +async def test_list_collections_async(request_type, transport: str = "grpc_asyncio"): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -22274,7 +22380,7 @@ async def test_list_collections_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_collections), "__call__") as call: @@ -22297,11 +22403,6 @@ async def test_list_collections_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_collections_async_from_dict(): - await test_list_collections_async(request_type=dict) - - def test_list_collections_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -22638,8 +22739,8 @@ async def test_list_collections_async_pages(): @pytest.mark.parametrize( "request_type", [ - warehouse.AddCollectionItemRequest, - dict, + warehouse.AddCollectionItemRequest(), + {}, ], ) def test_add_collection_item(request_type, transport: str = "grpc"): @@ -22650,7 +22751,7 @@ def test_add_collection_item(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -22693,7 +22794,8 @@ def test_add_collection_item_non_empty_request_with_auto_populated_field(): client.add_collection_item(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.AddCollectionItemRequest() + request_msg = warehouse.AddCollectionItemRequest() + assert args[0] == request_msg def test_add_collection_item_use_cached_wrapped_rpc(): @@ -22778,9 +22880,14 @@ async def test_add_collection_item_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_add_collection_item_async( - transport: str = "grpc_asyncio", request_type=warehouse.AddCollectionItemRequest -): +@pytest.mark.parametrize( + "request_type", + [ + warehouse.AddCollectionItemRequest(), + {}, + ], +) +async def test_add_collection_item_async(request_type, transport: str = "grpc_asyncio"): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -22788,7 +22895,7 @@ async def test_add_collection_item_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( @@ -22810,11 +22917,6 @@ async def test_add_collection_item_async( assert isinstance(response, warehouse.AddCollectionItemResponse) -@pytest.mark.asyncio -async def test_add_collection_item_async_from_dict(): - await test_add_collection_item_async(request_type=dict) - - def test_add_collection_item_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -22969,8 +23071,8 @@ async def test_add_collection_item_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - warehouse.RemoveCollectionItemRequest, - dict, + warehouse.RemoveCollectionItemRequest(), + {}, ], ) def test_remove_collection_item(request_type, transport: str = "grpc"): @@ -22981,7 +23083,7 @@ def test_remove_collection_item(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -23024,7 +23126,8 @@ def test_remove_collection_item_non_empty_request_with_auto_populated_field(): client.remove_collection_item(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.RemoveCollectionItemRequest() + request_msg = warehouse.RemoveCollectionItemRequest() + assert args[0] == request_msg def test_remove_collection_item_use_cached_wrapped_rpc(): @@ -23110,8 +23213,15 @@ async def test_remove_collection_item_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + warehouse.RemoveCollectionItemRequest(), + {}, + ], +) async def test_remove_collection_item_async( - transport: str = "grpc_asyncio", request_type=warehouse.RemoveCollectionItemRequest + request_type, transport: str = "grpc_asyncio" ): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), @@ -23120,7 +23230,7 @@ async def test_remove_collection_item_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( @@ -23142,11 +23252,6 @@ async def test_remove_collection_item_async( assert isinstance(response, warehouse.RemoveCollectionItemResponse) -@pytest.mark.asyncio -async def test_remove_collection_item_async_from_dict(): - await test_remove_collection_item_async(request_type=dict) - - def test_remove_collection_item_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -23301,8 +23406,8 @@ async def test_remove_collection_item_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - warehouse.ViewCollectionItemsRequest, - dict, + warehouse.ViewCollectionItemsRequest(), + {}, ], ) def test_view_collection_items(request_type, transport: str = "grpc"): @@ -23313,7 +23418,7 @@ def test_view_collection_items(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -23362,10 +23467,11 @@ def test_view_collection_items_non_empty_request_with_auto_populated_field(): client.view_collection_items(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.ViewCollectionItemsRequest( + request_msg = warehouse.ViewCollectionItemsRequest( collection="collection_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_view_collection_items_use_cached_wrapped_rpc(): @@ -23451,8 +23557,15 @@ async def test_view_collection_items_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + warehouse.ViewCollectionItemsRequest(), + {}, + ], +) async def test_view_collection_items_async( - transport: str = "grpc_asyncio", request_type=warehouse.ViewCollectionItemsRequest + request_type, transport: str = "grpc_asyncio" ): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), @@ -23461,7 +23574,7 @@ async def test_view_collection_items_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( @@ -23486,11 +23599,6 @@ async def test_view_collection_items_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_view_collection_items_async_from_dict(): - await test_view_collection_items_async(request_type=dict) - - def test_view_collection_items_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -35508,7 +35616,6 @@ def test_create_asset_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.CreateAssetRequest() - assert args[0] == request_msg @@ -35529,7 +35636,6 @@ def test_update_asset_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.UpdateAssetRequest() - assert args[0] == request_msg @@ -35550,7 +35656,6 @@ def test_get_asset_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.GetAssetRequest() - assert args[0] == request_msg @@ -35571,7 +35676,6 @@ def test_list_assets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.ListAssetsRequest() - assert args[0] == request_msg @@ -35592,7 +35696,6 @@ def test_delete_asset_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.DeleteAssetRequest() - assert args[0] == request_msg @@ -35613,7 +35716,6 @@ def test_upload_asset_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.UploadAssetRequest() - assert args[0] == request_msg @@ -35636,7 +35738,6 @@ def test_generate_retrieval_url_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.GenerateRetrievalUrlRequest() - assert args[0] == request_msg @@ -35657,7 +35758,6 @@ def test_analyze_asset_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.AnalyzeAssetRequest() - assert args[0] == request_msg @@ -35678,7 +35778,6 @@ def test_index_asset_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.IndexAssetRequest() - assert args[0] == request_msg @@ -35701,7 +35800,6 @@ def test_remove_index_asset_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.RemoveIndexAssetRequest() - assert args[0] == request_msg @@ -35724,7 +35822,6 @@ def test_view_indexed_assets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.ViewIndexedAssetsRequest() - assert args[0] == request_msg @@ -35745,7 +35842,6 @@ def test_create_index_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.CreateIndexRequest() - assert args[0] == request_msg @@ -35766,7 +35862,6 @@ def test_update_index_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.UpdateIndexRequest() - assert args[0] == request_msg @@ -35787,7 +35882,6 @@ def test_get_index_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.GetIndexRequest() - assert args[0] == request_msg @@ -35808,7 +35902,6 @@ def test_list_indexes_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.ListIndexesRequest() - assert args[0] == request_msg @@ -35829,7 +35922,6 @@ def test_delete_index_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.DeleteIndexRequest() - assert args[0] == request_msg @@ -35850,7 +35942,6 @@ def test_create_corpus_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.CreateCorpusRequest() - assert args[0] == request_msg @@ -35871,7 +35962,6 @@ def test_get_corpus_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.GetCorpusRequest() - assert args[0] == request_msg @@ -35892,7 +35982,6 @@ def test_update_corpus_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.UpdateCorpusRequest() - assert args[0] == request_msg @@ -35913,7 +36002,6 @@ def test_list_corpora_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.ListCorporaRequest() - assert args[0] == request_msg @@ -35934,7 +36022,6 @@ def test_delete_corpus_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.DeleteCorpusRequest() - assert args[0] == request_msg @@ -35955,7 +36042,6 @@ def test_analyze_corpus_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.AnalyzeCorpusRequest() - assert args[0] == request_msg @@ -35978,7 +36064,6 @@ def test_create_data_schema_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.CreateDataSchemaRequest() - assert args[0] == request_msg @@ -36001,7 +36086,6 @@ def test_update_data_schema_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.UpdateDataSchemaRequest() - assert args[0] == request_msg @@ -36022,7 +36106,6 @@ def test_get_data_schema_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.GetDataSchemaRequest() - assert args[0] == request_msg @@ -36045,7 +36128,6 @@ def test_delete_data_schema_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.DeleteDataSchemaRequest() - assert args[0] == request_msg @@ -36068,7 +36150,6 @@ def test_list_data_schemas_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.ListDataSchemasRequest() - assert args[0] == request_msg @@ -36091,7 +36172,6 @@ def test_create_annotation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.CreateAnnotationRequest() - assert args[0] == request_msg @@ -36112,7 +36192,6 @@ def test_get_annotation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.GetAnnotationRequest() - assert args[0] == request_msg @@ -36133,7 +36212,6 @@ def test_list_annotations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.ListAnnotationsRequest() - assert args[0] == request_msg @@ -36156,7 +36234,6 @@ def test_update_annotation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.UpdateAnnotationRequest() - assert args[0] == request_msg @@ -36179,7 +36256,6 @@ def test_delete_annotation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.DeleteAnnotationRequest() - assert args[0] == request_msg @@ -36200,7 +36276,6 @@ def test_clip_asset_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.ClipAssetRequest() - assert args[0] == request_msg @@ -36221,7 +36296,6 @@ def test_generate_hls_uri_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.GenerateHlsUriRequest() - assert args[0] == request_msg @@ -36242,7 +36316,6 @@ def test_import_assets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.ImportAssetsRequest() - assert args[0] == request_msg @@ -36265,7 +36338,6 @@ def test_create_search_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.CreateSearchConfigRequest() - assert args[0] == request_msg @@ -36288,7 +36360,6 @@ def test_update_search_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.UpdateSearchConfigRequest() - assert args[0] == request_msg @@ -36311,7 +36382,6 @@ def test_get_search_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.GetSearchConfigRequest() - assert args[0] == request_msg @@ -36334,7 +36404,6 @@ def test_delete_search_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.DeleteSearchConfigRequest() - assert args[0] == request_msg @@ -36357,7 +36426,6 @@ def test_list_search_configs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.ListSearchConfigsRequest() - assert args[0] == request_msg @@ -36380,7 +36448,6 @@ def test_create_search_hypernym_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.CreateSearchHypernymRequest() - assert args[0] == request_msg @@ -36403,7 +36470,6 @@ def test_update_search_hypernym_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.UpdateSearchHypernymRequest() - assert args[0] == request_msg @@ -36426,7 +36492,6 @@ def test_get_search_hypernym_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.GetSearchHypernymRequest() - assert args[0] == request_msg @@ -36449,7 +36514,6 @@ def test_delete_search_hypernym_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.DeleteSearchHypernymRequest() - assert args[0] == request_msg @@ -36472,7 +36536,6 @@ def test_list_search_hypernyms_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.ListSearchHypernymsRequest() - assert args[0] == request_msg @@ -36493,7 +36556,6 @@ def test_search_assets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.SearchAssetsRequest() - assert args[0] == request_msg @@ -36516,7 +36578,6 @@ def test_search_index_endpoint_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.SearchIndexEndpointRequest() - assert args[0] == request_msg @@ -36539,7 +36600,6 @@ def test_create_index_endpoint_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.CreateIndexEndpointRequest() - assert args[0] == request_msg @@ -36562,7 +36622,6 @@ def test_get_index_endpoint_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.GetIndexEndpointRequest() - assert args[0] == request_msg @@ -36585,7 +36644,6 @@ def test_list_index_endpoints_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.ListIndexEndpointsRequest() - assert args[0] == request_msg @@ -36608,7 +36666,6 @@ def test_update_index_endpoint_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.UpdateIndexEndpointRequest() - assert args[0] == request_msg @@ -36631,7 +36688,6 @@ def test_delete_index_endpoint_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.DeleteIndexEndpointRequest() - assert args[0] == request_msg @@ -36652,7 +36708,6 @@ def test_deploy_index_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.DeployIndexRequest() - assert args[0] == request_msg @@ -36673,7 +36728,6 @@ def test_undeploy_index_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.UndeployIndexRequest() - assert args[0] == request_msg @@ -36696,7 +36750,6 @@ def test_create_collection_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.CreateCollectionRequest() - assert args[0] == request_msg @@ -36719,7 +36772,6 @@ def test_delete_collection_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.DeleteCollectionRequest() - assert args[0] == request_msg @@ -36740,7 +36792,6 @@ def test_get_collection_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.GetCollectionRequest() - assert args[0] == request_msg @@ -36763,7 +36814,6 @@ def test_update_collection_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.UpdateCollectionRequest() - assert args[0] == request_msg @@ -36784,7 +36834,6 @@ def test_list_collections_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.ListCollectionsRequest() - assert args[0] == request_msg @@ -36807,7 +36856,6 @@ def test_add_collection_item_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.AddCollectionItemRequest() - assert args[0] == request_msg @@ -36830,7 +36878,6 @@ def test_remove_collection_item_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.RemoveCollectionItemRequest() - assert args[0] == request_msg @@ -36853,7 +36900,6 @@ def test_view_collection_items_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.ViewCollectionItemsRequest() - assert args[0] == request_msg @@ -36894,7 +36940,6 @@ async def test_create_asset_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.CreateAssetRequest() - assert args[0] == request_msg @@ -36921,7 +36966,6 @@ async def test_update_asset_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.UpdateAssetRequest() - assert args[0] == request_msg @@ -36948,7 +36992,6 @@ async def test_get_asset_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.GetAssetRequest() - assert args[0] == request_msg @@ -36975,7 +37018,6 @@ async def test_list_assets_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.ListAssetsRequest() - assert args[0] == request_msg @@ -37000,7 +37042,6 @@ async def test_delete_asset_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.DeleteAssetRequest() - assert args[0] == request_msg @@ -37025,7 +37066,6 @@ async def test_upload_asset_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.UploadAssetRequest() - assert args[0] == request_msg @@ -37054,7 +37094,6 @@ async def test_generate_retrieval_url_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.GenerateRetrievalUrlRequest() - assert args[0] == request_msg @@ -37079,7 +37118,6 @@ async def test_analyze_asset_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.AnalyzeAssetRequest() - assert args[0] == request_msg @@ -37104,7 +37142,6 @@ async def test_index_asset_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.IndexAssetRequest() - assert args[0] == request_msg @@ -37131,7 +37168,6 @@ async def test_remove_index_asset_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.RemoveIndexAssetRequest() - assert args[0] == request_msg @@ -37160,7 +37196,6 @@ async def test_view_indexed_assets_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.ViewIndexedAssetsRequest() - assert args[0] == request_msg @@ -37185,7 +37220,6 @@ async def test_create_index_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.CreateIndexRequest() - assert args[0] == request_msg @@ -37210,7 +37244,6 @@ async def test_update_index_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.UpdateIndexRequest() - assert args[0] == request_msg @@ -37242,7 +37275,6 @@ async def test_get_index_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.GetIndexRequest() - assert args[0] == request_msg @@ -37269,7 +37301,6 @@ async def test_list_indexes_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.ListIndexesRequest() - assert args[0] == request_msg @@ -37294,7 +37325,6 @@ async def test_delete_index_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.DeleteIndexRequest() - assert args[0] == request_msg @@ -37319,7 +37349,6 @@ async def test_create_corpus_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.CreateCorpusRequest() - assert args[0] == request_msg @@ -37351,7 +37380,6 @@ async def test_get_corpus_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.GetCorpusRequest() - assert args[0] == request_msg @@ -37383,7 +37411,6 @@ async def test_update_corpus_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.UpdateCorpusRequest() - assert args[0] == request_msg @@ -37410,7 +37437,6 @@ async def test_list_corpora_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.ListCorporaRequest() - assert args[0] == request_msg @@ -37433,7 +37459,6 @@ async def test_delete_corpus_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.DeleteCorpusRequest() - assert args[0] == request_msg @@ -37458,7 +37483,6 @@ async def test_analyze_corpus_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.AnalyzeCorpusRequest() - assert args[0] == request_msg @@ -37488,7 +37512,6 @@ async def test_create_data_schema_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.CreateDataSchemaRequest() - assert args[0] == request_msg @@ -37518,7 +37541,6 @@ async def test_update_data_schema_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.UpdateDataSchemaRequest() - assert args[0] == request_msg @@ -37546,7 +37568,6 @@ async def test_get_data_schema_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.GetDataSchemaRequest() - assert args[0] == request_msg @@ -37571,7 +37592,6 @@ async def test_delete_data_schema_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.DeleteDataSchemaRequest() - assert args[0] == request_msg @@ -37600,7 +37620,6 @@ async def test_list_data_schemas_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.ListDataSchemasRequest() - assert args[0] == request_msg @@ -37629,7 +37648,6 @@ async def test_create_annotation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.CreateAnnotationRequest() - assert args[0] == request_msg @@ -37656,7 +37674,6 @@ async def test_get_annotation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.GetAnnotationRequest() - assert args[0] == request_msg @@ -37683,7 +37700,6 @@ async def test_list_annotations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.ListAnnotationsRequest() - assert args[0] == request_msg @@ -37712,7 +37728,6 @@ async def test_update_annotation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.UpdateAnnotationRequest() - assert args[0] == request_msg @@ -37737,7 +37752,6 @@ async def test_delete_annotation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.DeleteAnnotationRequest() - assert args[0] == request_msg @@ -37762,7 +37776,6 @@ async def test_clip_asset_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.ClipAssetRequest() - assert args[0] == request_msg @@ -37789,7 +37802,6 @@ async def test_generate_hls_uri_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.GenerateHlsUriRequest() - assert args[0] == request_msg @@ -37814,7 +37826,6 @@ async def test_import_assets_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.ImportAssetsRequest() - assert args[0] == request_msg @@ -37843,7 +37854,6 @@ async def test_create_search_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.CreateSearchConfigRequest() - assert args[0] == request_msg @@ -37872,7 +37882,6 @@ async def test_update_search_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.UpdateSearchConfigRequest() - assert args[0] == request_msg @@ -37901,7 +37910,6 @@ async def test_get_search_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.GetSearchConfigRequest() - assert args[0] == request_msg @@ -37926,7 +37934,6 @@ async def test_delete_search_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.DeleteSearchConfigRequest() - assert args[0] == request_msg @@ -37955,7 +37962,6 @@ async def test_list_search_configs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.ListSearchConfigsRequest() - assert args[0] == request_msg @@ -37986,7 +37992,6 @@ async def test_create_search_hypernym_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.CreateSearchHypernymRequest() - assert args[0] == request_msg @@ -38017,7 +38022,6 @@ async def test_update_search_hypernym_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.UpdateSearchHypernymRequest() - assert args[0] == request_msg @@ -38048,7 +38052,6 @@ async def test_get_search_hypernym_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.GetSearchHypernymRequest() - assert args[0] == request_msg @@ -38073,7 +38076,6 @@ async def test_delete_search_hypernym_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.DeleteSearchHypernymRequest() - assert args[0] == request_msg @@ -38102,7 +38104,6 @@ async def test_list_search_hypernyms_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.ListSearchHypernymsRequest() - assert args[0] == request_msg @@ -38129,7 +38130,6 @@ async def test_search_assets_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.SearchAssetsRequest() - assert args[0] == request_msg @@ -38158,7 +38158,6 @@ async def test_search_index_endpoint_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.SearchIndexEndpointRequest() - assert args[0] == request_msg @@ -38185,7 +38184,6 @@ async def test_create_index_endpoint_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.CreateIndexEndpointRequest() - assert args[0] == request_msg @@ -38219,7 +38217,6 @@ async def test_get_index_endpoint_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.GetIndexEndpointRequest() - assert args[0] == request_msg @@ -38248,7 +38245,6 @@ async def test_list_index_endpoints_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.ListIndexEndpointsRequest() - assert args[0] == request_msg @@ -38275,7 +38271,6 @@ async def test_update_index_endpoint_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.UpdateIndexEndpointRequest() - assert args[0] == request_msg @@ -38302,7 +38297,6 @@ async def test_delete_index_endpoint_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.DeleteIndexEndpointRequest() - assert args[0] == request_msg @@ -38327,7 +38321,6 @@ async def test_deploy_index_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.DeployIndexRequest() - assert args[0] == request_msg @@ -38352,7 +38345,6 @@ async def test_undeploy_index_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.UndeployIndexRequest() - assert args[0] == request_msg @@ -38379,7 +38371,6 @@ async def test_create_collection_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.CreateCollectionRequest() - assert args[0] == request_msg @@ -38406,7 +38397,6 @@ async def test_delete_collection_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.DeleteCollectionRequest() - assert args[0] == request_msg @@ -38435,7 +38425,6 @@ async def test_get_collection_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.GetCollectionRequest() - assert args[0] == request_msg @@ -38466,7 +38455,6 @@ async def test_update_collection_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.UpdateCollectionRequest() - assert args[0] == request_msg @@ -38493,7 +38481,6 @@ async def test_list_collections_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.ListCollectionsRequest() - assert args[0] == request_msg @@ -38520,7 +38507,6 @@ async def test_add_collection_item_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.AddCollectionItemRequest() - assert args[0] == request_msg @@ -38547,7 +38533,6 @@ async def test_remove_collection_item_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.RemoveCollectionItemRequest() - assert args[0] == request_msg @@ -38576,7 +38561,6 @@ async def test_view_collection_items_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.ViewCollectionItemsRequest() - assert args[0] == request_msg @@ -48440,7 +48424,6 @@ def test_create_asset_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.CreateAssetRequest() - assert args[0] == request_msg @@ -48460,7 +48443,6 @@ def test_update_asset_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.UpdateAssetRequest() - assert args[0] == request_msg @@ -48480,7 +48462,6 @@ def test_get_asset_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.GetAssetRequest() - assert args[0] == request_msg @@ -48500,7 +48481,6 @@ def test_list_assets_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.ListAssetsRequest() - assert args[0] == request_msg @@ -48520,7 +48500,6 @@ def test_delete_asset_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.DeleteAssetRequest() - assert args[0] == request_msg @@ -48540,7 +48519,6 @@ def test_upload_asset_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.UploadAssetRequest() - assert args[0] == request_msg @@ -48562,7 +48540,6 @@ def test_generate_retrieval_url_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.GenerateRetrievalUrlRequest() - assert args[0] == request_msg @@ -48582,7 +48559,6 @@ def test_analyze_asset_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.AnalyzeAssetRequest() - assert args[0] == request_msg @@ -48602,7 +48578,6 @@ def test_index_asset_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.IndexAssetRequest() - assert args[0] == request_msg @@ -48624,7 +48599,6 @@ def test_remove_index_asset_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.RemoveIndexAssetRequest() - assert args[0] == request_msg @@ -48646,7 +48620,6 @@ def test_view_indexed_assets_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.ViewIndexedAssetsRequest() - assert args[0] == request_msg @@ -48666,7 +48639,6 @@ def test_create_index_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.CreateIndexRequest() - assert args[0] == request_msg @@ -48686,7 +48658,6 @@ def test_update_index_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.UpdateIndexRequest() - assert args[0] == request_msg @@ -48706,7 +48677,6 @@ def test_get_index_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.GetIndexRequest() - assert args[0] == request_msg @@ -48726,7 +48696,6 @@ def test_list_indexes_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.ListIndexesRequest() - assert args[0] == request_msg @@ -48746,7 +48715,6 @@ def test_delete_index_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.DeleteIndexRequest() - assert args[0] == request_msg @@ -48766,7 +48734,6 @@ def test_create_corpus_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.CreateCorpusRequest() - assert args[0] == request_msg @@ -48786,7 +48753,6 @@ def test_get_corpus_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.GetCorpusRequest() - assert args[0] == request_msg @@ -48806,7 +48772,6 @@ def test_update_corpus_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.UpdateCorpusRequest() - assert args[0] == request_msg @@ -48826,7 +48791,6 @@ def test_list_corpora_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.ListCorporaRequest() - assert args[0] == request_msg @@ -48846,7 +48810,6 @@ def test_delete_corpus_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.DeleteCorpusRequest() - assert args[0] == request_msg @@ -48866,7 +48829,6 @@ def test_analyze_corpus_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.AnalyzeCorpusRequest() - assert args[0] == request_msg @@ -48888,7 +48850,6 @@ def test_create_data_schema_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.CreateDataSchemaRequest() - assert args[0] == request_msg @@ -48910,7 +48871,6 @@ def test_update_data_schema_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.UpdateDataSchemaRequest() - assert args[0] == request_msg @@ -48930,7 +48890,6 @@ def test_get_data_schema_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.GetDataSchemaRequest() - assert args[0] == request_msg @@ -48952,7 +48911,6 @@ def test_delete_data_schema_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.DeleteDataSchemaRequest() - assert args[0] == request_msg @@ -48974,7 +48932,6 @@ def test_list_data_schemas_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.ListDataSchemasRequest() - assert args[0] == request_msg @@ -48996,7 +48953,6 @@ def test_create_annotation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.CreateAnnotationRequest() - assert args[0] == request_msg @@ -49016,7 +48972,6 @@ def test_get_annotation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.GetAnnotationRequest() - assert args[0] == request_msg @@ -49036,7 +48991,6 @@ def test_list_annotations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.ListAnnotationsRequest() - assert args[0] == request_msg @@ -49058,7 +49012,6 @@ def test_update_annotation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.UpdateAnnotationRequest() - assert args[0] == request_msg @@ -49080,7 +49033,6 @@ def test_delete_annotation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.DeleteAnnotationRequest() - assert args[0] == request_msg @@ -49100,7 +49052,6 @@ def test_clip_asset_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.ClipAssetRequest() - assert args[0] == request_msg @@ -49120,7 +49071,6 @@ def test_generate_hls_uri_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.GenerateHlsUriRequest() - assert args[0] == request_msg @@ -49140,7 +49090,6 @@ def test_import_assets_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.ImportAssetsRequest() - assert args[0] == request_msg @@ -49162,7 +49111,6 @@ def test_create_search_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.CreateSearchConfigRequest() - assert args[0] == request_msg @@ -49184,7 +49132,6 @@ def test_update_search_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.UpdateSearchConfigRequest() - assert args[0] == request_msg @@ -49206,7 +49153,6 @@ def test_get_search_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.GetSearchConfigRequest() - assert args[0] == request_msg @@ -49228,7 +49174,6 @@ def test_delete_search_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.DeleteSearchConfigRequest() - assert args[0] == request_msg @@ -49250,7 +49195,6 @@ def test_list_search_configs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.ListSearchConfigsRequest() - assert args[0] == request_msg @@ -49272,7 +49216,6 @@ def test_create_search_hypernym_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.CreateSearchHypernymRequest() - assert args[0] == request_msg @@ -49294,7 +49237,6 @@ def test_update_search_hypernym_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.UpdateSearchHypernymRequest() - assert args[0] == request_msg @@ -49316,7 +49258,6 @@ def test_get_search_hypernym_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.GetSearchHypernymRequest() - assert args[0] == request_msg @@ -49338,7 +49279,6 @@ def test_delete_search_hypernym_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.DeleteSearchHypernymRequest() - assert args[0] == request_msg @@ -49360,7 +49300,6 @@ def test_list_search_hypernyms_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.ListSearchHypernymsRequest() - assert args[0] == request_msg @@ -49380,7 +49319,6 @@ def test_search_assets_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.SearchAssetsRequest() - assert args[0] == request_msg @@ -49402,7 +49340,6 @@ def test_search_index_endpoint_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.SearchIndexEndpointRequest() - assert args[0] == request_msg @@ -49424,7 +49361,6 @@ def test_create_index_endpoint_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.CreateIndexEndpointRequest() - assert args[0] == request_msg @@ -49446,7 +49382,6 @@ def test_get_index_endpoint_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.GetIndexEndpointRequest() - assert args[0] == request_msg @@ -49468,7 +49403,6 @@ def test_list_index_endpoints_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.ListIndexEndpointsRequest() - assert args[0] == request_msg @@ -49490,7 +49424,6 @@ def test_update_index_endpoint_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.UpdateIndexEndpointRequest() - assert args[0] == request_msg @@ -49512,7 +49445,6 @@ def test_delete_index_endpoint_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.DeleteIndexEndpointRequest() - assert args[0] == request_msg @@ -49532,7 +49464,6 @@ def test_deploy_index_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.DeployIndexRequest() - assert args[0] == request_msg @@ -49552,7 +49483,6 @@ def test_undeploy_index_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.UndeployIndexRequest() - assert args[0] == request_msg @@ -49574,7 +49504,6 @@ def test_create_collection_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.CreateCollectionRequest() - assert args[0] == request_msg @@ -49596,7 +49525,6 @@ def test_delete_collection_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.DeleteCollectionRequest() - assert args[0] == request_msg @@ -49616,7 +49544,6 @@ def test_get_collection_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.GetCollectionRequest() - assert args[0] == request_msg @@ -49638,7 +49565,6 @@ def test_update_collection_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.UpdateCollectionRequest() - assert args[0] == request_msg @@ -49658,7 +49584,6 @@ def test_list_collections_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.ListCollectionsRequest() - assert args[0] == request_msg @@ -49680,7 +49605,6 @@ def test_add_collection_item_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.AddCollectionItemRequest() - assert args[0] == request_msg @@ -49702,7 +49626,6 @@ def test_remove_collection_item_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.RemoveCollectionItemRequest() - assert args[0] == request_msg @@ -49724,7 +49647,6 @@ def test_view_collection_items_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.ViewCollectionItemsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-visionai/tests/unit/gapic/visionai_v1alpha1/test_app_platform.py b/packages/google-cloud-visionai/tests/unit/gapic/visionai_v1alpha1/test_app_platform.py index dcd6bdae65f6..4210715b0c43 100644 --- a/packages/google-cloud-visionai/tests/unit/gapic/visionai_v1alpha1/test_app_platform.py +++ b/packages/google-cloud-visionai/tests/unit/gapic/visionai_v1alpha1/test_app_platform.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 @@ -122,6 +123,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" @@ -1287,8 +1303,8 @@ def test_app_platform_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - platform.ListApplicationsRequest, - dict, + platform.ListApplicationsRequest(), + {}, ], ) def test_list_applications(request_type, transport: str = "grpc"): @@ -1299,7 +1315,7 @@ def test_list_applications(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,12 +1368,13 @@ def test_list_applications_non_empty_request_with_auto_populated_field(): client.list_applications(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == platform.ListApplicationsRequest( + request_msg = platform.ListApplicationsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_applications_use_cached_wrapped_rpc(): @@ -1440,9 +1457,14 @@ async def test_list_applications_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_applications_async( - transport: str = "grpc_asyncio", request_type=platform.ListApplicationsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + platform.ListApplicationsRequest(), + {}, + ], +) +async def test_list_applications_async(request_type, transport: str = "grpc_asyncio"): client = AppPlatformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1450,7 +1472,7 @@ async def test_list_applications_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( @@ -1477,11 +1499,6 @@ async def test_list_applications_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_applications_async_from_dict(): - await test_list_applications_async(request_type=dict) - - def test_list_applications_field_headers(): client = AppPlatformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1834,8 +1851,8 @@ async def test_list_applications_async_pages(): @pytest.mark.parametrize( "request_type", [ - platform.GetApplicationRequest, - dict, + platform.GetApplicationRequest(), + {}, ], ) def test_get_application(request_type, transport: str = "grpc"): @@ -1846,7 +1863,7 @@ def test_get_application(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_application), "__call__") as call: @@ -1896,9 +1913,10 @@ def test_get_application_non_empty_request_with_auto_populated_field(): client.get_application(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == platform.GetApplicationRequest( + request_msg = platform.GetApplicationRequest( name="name_value", ) + assert args[0] == request_msg def test_get_application_use_cached_wrapped_rpc(): @@ -1979,9 +1997,14 @@ async def test_get_application_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_application_async( - transport: str = "grpc_asyncio", request_type=platform.GetApplicationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + platform.GetApplicationRequest(), + {}, + ], +) +async def test_get_application_async(request_type, transport: str = "grpc_asyncio"): client = AppPlatformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1989,7 +2012,7 @@ async def test_get_application_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_application), "__call__") as call: @@ -2018,11 +2041,6 @@ async def test_get_application_async( assert response.state == platform.Application.State.CREATED -@pytest.mark.asyncio -async def test_get_application_async_from_dict(): - await test_get_application_async(request_type=dict) - - def test_get_application_field_headers(): client = AppPlatformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2169,8 +2187,8 @@ async def test_get_application_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - platform.CreateApplicationRequest, - dict, + platform.CreateApplicationRequest(), + {}, ], ) def test_create_application(request_type, transport: str = "grpc"): @@ -2181,7 +2199,7 @@ def test_create_application(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2228,11 +2246,12 @@ def test_create_application_non_empty_request_with_auto_populated_field(): client.create_application(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == platform.CreateApplicationRequest( + request_msg = platform.CreateApplicationRequest( parent="parent_value", application_id="application_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_application_use_cached_wrapped_rpc(): @@ -2327,9 +2346,14 @@ async def test_create_application_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_application_async( - transport: str = "grpc_asyncio", request_type=platform.CreateApplicationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + platform.CreateApplicationRequest(), + {}, + ], +) +async def test_create_application_async(request_type, transport: str = "grpc_asyncio"): client = AppPlatformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2337,7 +2361,7 @@ async def test_create_application_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( @@ -2359,11 +2383,6 @@ async def test_create_application_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_application_async_from_dict(): - await test_create_application_async(request_type=dict) - - def test_create_application_field_headers(): client = AppPlatformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2528,8 +2547,8 @@ async def test_create_application_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - platform.UpdateApplicationRequest, - dict, + platform.UpdateApplicationRequest(), + {}, ], ) def test_update_application(request_type, transport: str = "grpc"): @@ -2540,7 +2559,7 @@ def test_update_application(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2585,9 +2604,10 @@ def test_update_application_non_empty_request_with_auto_populated_field(): client.update_application(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == platform.UpdateApplicationRequest( + request_msg = platform.UpdateApplicationRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_application_use_cached_wrapped_rpc(): @@ -2682,9 +2702,14 @@ async def test_update_application_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_application_async( - transport: str = "grpc_asyncio", request_type=platform.UpdateApplicationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + platform.UpdateApplicationRequest(), + {}, + ], +) +async def test_update_application_async(request_type, transport: str = "grpc_asyncio"): client = AppPlatformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2692,7 +2717,7 @@ async def test_update_application_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( @@ -2714,11 +2739,6 @@ async def test_update_application_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_application_async_from_dict(): - await test_update_application_async(request_type=dict) - - def test_update_application_field_headers(): client = AppPlatformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2883,8 +2903,8 @@ async def test_update_application_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - platform.DeleteApplicationRequest, - dict, + platform.DeleteApplicationRequest(), + {}, ], ) def test_delete_application(request_type, transport: str = "grpc"): @@ -2895,7 +2915,7 @@ def test_delete_application(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2941,10 +2961,11 @@ def test_delete_application_non_empty_request_with_auto_populated_field(): client.delete_application(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == platform.DeleteApplicationRequest( + request_msg = platform.DeleteApplicationRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_application_use_cached_wrapped_rpc(): @@ -3039,9 +3060,14 @@ async def test_delete_application_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_application_async( - transport: str = "grpc_asyncio", request_type=platform.DeleteApplicationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + platform.DeleteApplicationRequest(), + {}, + ], +) +async def test_delete_application_async(request_type, transport: str = "grpc_asyncio"): client = AppPlatformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3049,7 +3075,7 @@ async def test_delete_application_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( @@ -3071,11 +3097,6 @@ async def test_delete_application_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_application_async_from_dict(): - await test_delete_application_async(request_type=dict) - - def test_delete_application_field_headers(): client = AppPlatformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3230,8 +3251,8 @@ async def test_delete_application_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - platform.DeployApplicationRequest, - dict, + platform.DeployApplicationRequest(), + {}, ], ) def test_deploy_application(request_type, transport: str = "grpc"): @@ -3242,7 +3263,7 @@ def test_deploy_application(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3288,10 +3309,11 @@ def test_deploy_application_non_empty_request_with_auto_populated_field(): client.deploy_application(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == platform.DeployApplicationRequest( + request_msg = platform.DeployApplicationRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_deploy_application_use_cached_wrapped_rpc(): @@ -3386,9 +3408,14 @@ async def test_deploy_application_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_deploy_application_async( - transport: str = "grpc_asyncio", request_type=platform.DeployApplicationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + platform.DeployApplicationRequest(), + {}, + ], +) +async def test_deploy_application_async(request_type, transport: str = "grpc_asyncio"): client = AppPlatformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3396,7 +3423,7 @@ async def test_deploy_application_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( @@ -3418,11 +3445,6 @@ async def test_deploy_application_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_deploy_application_async_from_dict(): - await test_deploy_application_async(request_type=dict) - - def test_deploy_application_field_headers(): client = AppPlatformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3577,8 +3599,8 @@ async def test_deploy_application_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - platform.UndeployApplicationRequest, - dict, + platform.UndeployApplicationRequest(), + {}, ], ) def test_undeploy_application(request_type, transport: str = "grpc"): @@ -3589,7 +3611,7 @@ def test_undeploy_application(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3635,10 +3657,11 @@ def test_undeploy_application_non_empty_request_with_auto_populated_field(): client.undeploy_application(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == platform.UndeployApplicationRequest( + request_msg = platform.UndeployApplicationRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_undeploy_application_use_cached_wrapped_rpc(): @@ -3733,8 +3756,15 @@ async def test_undeploy_application_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + platform.UndeployApplicationRequest(), + {}, + ], +) async def test_undeploy_application_async( - transport: str = "grpc_asyncio", request_type=platform.UndeployApplicationRequest + request_type, transport: str = "grpc_asyncio" ): client = AppPlatformAsyncClient( credentials=async_anonymous_credentials(), @@ -3743,7 +3773,7 @@ async def test_undeploy_application_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( @@ -3765,11 +3795,6 @@ async def test_undeploy_application_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_undeploy_application_async_from_dict(): - await test_undeploy_application_async(request_type=dict) - - def test_undeploy_application_field_headers(): client = AppPlatformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3924,8 +3949,8 @@ async def test_undeploy_application_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - platform.AddApplicationStreamInputRequest, - dict, + platform.AddApplicationStreamInputRequest(), + {}, ], ) def test_add_application_stream_input(request_type, transport: str = "grpc"): @@ -3936,7 +3961,7 @@ def test_add_application_stream_input(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3982,10 +4007,11 @@ def test_add_application_stream_input_non_empty_request_with_auto_populated_fiel client.add_application_stream_input(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == platform.AddApplicationStreamInputRequest( + request_msg = platform.AddApplicationStreamInputRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_add_application_stream_input_use_cached_wrapped_rpc(): @@ -4081,9 +4107,15 @@ async def test_add_application_stream_input_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + platform.AddApplicationStreamInputRequest(), + {}, + ], +) async def test_add_application_stream_input_async( - transport: str = "grpc_asyncio", - request_type=platform.AddApplicationStreamInputRequest, + request_type, transport: str = "grpc_asyncio" ): client = AppPlatformAsyncClient( credentials=async_anonymous_credentials(), @@ -4092,7 +4124,7 @@ async def test_add_application_stream_input_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( @@ -4114,11 +4146,6 @@ async def test_add_application_stream_input_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_add_application_stream_input_async_from_dict(): - await test_add_application_stream_input_async(request_type=dict) - - def test_add_application_stream_input_field_headers(): client = AppPlatformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4273,8 +4300,8 @@ async def test_add_application_stream_input_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - platform.RemoveApplicationStreamInputRequest, - dict, + platform.RemoveApplicationStreamInputRequest(), + {}, ], ) def test_remove_application_stream_input(request_type, transport: str = "grpc"): @@ -4285,7 +4312,7 @@ def test_remove_application_stream_input(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4331,10 +4358,11 @@ def test_remove_application_stream_input_non_empty_request_with_auto_populated_f client.remove_application_stream_input(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == platform.RemoveApplicationStreamInputRequest( + request_msg = platform.RemoveApplicationStreamInputRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_remove_application_stream_input_use_cached_wrapped_rpc(): @@ -4430,9 +4458,15 @@ async def test_remove_application_stream_input_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + platform.RemoveApplicationStreamInputRequest(), + {}, + ], +) async def test_remove_application_stream_input_async( - transport: str = "grpc_asyncio", - request_type=platform.RemoveApplicationStreamInputRequest, + request_type, transport: str = "grpc_asyncio" ): client = AppPlatformAsyncClient( credentials=async_anonymous_credentials(), @@ -4441,7 +4475,7 @@ async def test_remove_application_stream_input_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( @@ -4463,11 +4497,6 @@ async def test_remove_application_stream_input_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_remove_application_stream_input_async_from_dict(): - await test_remove_application_stream_input_async(request_type=dict) - - def test_remove_application_stream_input_field_headers(): client = AppPlatformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4622,8 +4651,8 @@ async def test_remove_application_stream_input_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - platform.UpdateApplicationStreamInputRequest, - dict, + platform.UpdateApplicationStreamInputRequest(), + {}, ], ) def test_update_application_stream_input(request_type, transport: str = "grpc"): @@ -4634,7 +4663,7 @@ def test_update_application_stream_input(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4680,10 +4709,11 @@ def test_update_application_stream_input_non_empty_request_with_auto_populated_f client.update_application_stream_input(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == platform.UpdateApplicationStreamInputRequest( + request_msg = platform.UpdateApplicationStreamInputRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_update_application_stream_input_use_cached_wrapped_rpc(): @@ -4779,9 +4809,15 @@ async def test_update_application_stream_input_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + platform.UpdateApplicationStreamInputRequest(), + {}, + ], +) async def test_update_application_stream_input_async( - transport: str = "grpc_asyncio", - request_type=platform.UpdateApplicationStreamInputRequest, + request_type, transport: str = "grpc_asyncio" ): client = AppPlatformAsyncClient( credentials=async_anonymous_credentials(), @@ -4790,7 +4826,7 @@ async def test_update_application_stream_input_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( @@ -4812,11 +4848,6 @@ async def test_update_application_stream_input_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_application_stream_input_async_from_dict(): - await test_update_application_stream_input_async(request_type=dict) - - def test_update_application_stream_input_field_headers(): client = AppPlatformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4971,8 +5002,8 @@ async def test_update_application_stream_input_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - platform.ListInstancesRequest, - dict, + platform.ListInstancesRequest(), + {}, ], ) def test_list_instances(request_type, transport: str = "grpc"): @@ -4983,7 +5014,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(type(client.transport.list_instances), "__call__") as call: @@ -5032,12 +5063,13 @@ 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] == platform.ListInstancesRequest( + request_msg = platform.ListInstancesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_instances_use_cached_wrapped_rpc(): @@ -5118,9 +5150,14 @@ async def test_list_instances_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_instances_async( - transport: str = "grpc_asyncio", request_type=platform.ListInstancesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + platform.ListInstancesRequest(), + {}, + ], +) +async def test_list_instances_async(request_type, transport: str = "grpc_asyncio"): client = AppPlatformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5128,7 +5165,7 @@ async def test_list_instances_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_instances), "__call__") as call: @@ -5153,11 +5190,6 @@ async def test_list_instances_async( 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 = AppPlatformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5494,8 +5526,8 @@ async def test_list_instances_async_pages(): @pytest.mark.parametrize( "request_type", [ - platform.GetInstanceRequest, - dict, + platform.GetInstanceRequest(), + {}, ], ) def test_get_instance(request_type, transport: str = "grpc"): @@ -5506,7 +5538,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(type(client.transport.get_instance), "__call__") as call: @@ -5556,9 +5588,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] == platform.GetInstanceRequest( + request_msg = platform.GetInstanceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_instance_use_cached_wrapped_rpc(): @@ -5639,9 +5672,14 @@ async def test_get_instance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_instance_async( - transport: str = "grpc_asyncio", request_type=platform.GetInstanceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + platform.GetInstanceRequest(), + {}, + ], +) +async def test_get_instance_async(request_type, transport: str = "grpc_asyncio"): client = AppPlatformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5649,7 +5687,7 @@ async def test_get_instance_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_instance), "__call__") as call: @@ -5678,11 +5716,6 @@ async def test_get_instance_async( assert response.state == platform.Instance.State.CREATING -@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 = AppPlatformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5825,8 +5858,8 @@ async def test_get_instance_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - platform.CreateApplicationInstancesRequest, - dict, + platform.CreateApplicationInstancesRequest(), + {}, ], ) def test_create_application_instances(request_type, transport: str = "grpc"): @@ -5837,7 +5870,7 @@ def test_create_application_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( @@ -5883,10 +5916,11 @@ def test_create_application_instances_non_empty_request_with_auto_populated_fiel client.create_application_instances(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == platform.CreateApplicationInstancesRequest( + request_msg = platform.CreateApplicationInstancesRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_application_instances_use_cached_wrapped_rpc(): @@ -5982,9 +6016,15 @@ async def test_create_application_instances_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + platform.CreateApplicationInstancesRequest(), + {}, + ], +) async def test_create_application_instances_async( - transport: str = "grpc_asyncio", - request_type=platform.CreateApplicationInstancesRequest, + request_type, transport: str = "grpc_asyncio" ): client = AppPlatformAsyncClient( credentials=async_anonymous_credentials(), @@ -5993,7 +6033,7 @@ async def test_create_application_instances_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( @@ -6015,11 +6055,6 @@ async def test_create_application_instances_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_application_instances_async_from_dict(): - await test_create_application_instances_async(request_type=dict) - - def test_create_application_instances_field_headers(): client = AppPlatformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6174,8 +6209,8 @@ async def test_create_application_instances_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - platform.DeleteApplicationInstancesRequest, - dict, + platform.DeleteApplicationInstancesRequest(), + {}, ], ) def test_delete_application_instances(request_type, transport: str = "grpc"): @@ -6186,7 +6221,7 @@ def test_delete_application_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( @@ -6232,10 +6267,11 @@ def test_delete_application_instances_non_empty_request_with_auto_populated_fiel client.delete_application_instances(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == platform.DeleteApplicationInstancesRequest( + request_msg = platform.DeleteApplicationInstancesRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_application_instances_use_cached_wrapped_rpc(): @@ -6331,9 +6367,15 @@ async def test_delete_application_instances_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + platform.DeleteApplicationInstancesRequest(), + {}, + ], +) async def test_delete_application_instances_async( - transport: str = "grpc_asyncio", - request_type=platform.DeleteApplicationInstancesRequest, + request_type, transport: str = "grpc_asyncio" ): client = AppPlatformAsyncClient( credentials=async_anonymous_credentials(), @@ -6342,7 +6384,7 @@ async def test_delete_application_instances_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( @@ -6364,11 +6406,6 @@ async def test_delete_application_instances_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_application_instances_async_from_dict(): - await test_delete_application_instances_async(request_type=dict) - - def test_delete_application_instances_field_headers(): client = AppPlatformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6523,8 +6560,8 @@ async def test_delete_application_instances_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - platform.UpdateApplicationInstancesRequest, - dict, + platform.UpdateApplicationInstancesRequest(), + {}, ], ) def test_update_application_instances(request_type, transport: str = "grpc"): @@ -6535,7 +6572,7 @@ def test_update_application_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( @@ -6581,10 +6618,11 @@ def test_update_application_instances_non_empty_request_with_auto_populated_fiel client.update_application_instances(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == platform.UpdateApplicationInstancesRequest( + request_msg = platform.UpdateApplicationInstancesRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_update_application_instances_use_cached_wrapped_rpc(): @@ -6680,9 +6718,15 @@ async def test_update_application_instances_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + platform.UpdateApplicationInstancesRequest(), + {}, + ], +) async def test_update_application_instances_async( - transport: str = "grpc_asyncio", - request_type=platform.UpdateApplicationInstancesRequest, + request_type, transport: str = "grpc_asyncio" ): client = AppPlatformAsyncClient( credentials=async_anonymous_credentials(), @@ -6691,7 +6735,7 @@ async def test_update_application_instances_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( @@ -6713,11 +6757,6 @@ async def test_update_application_instances_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_application_instances_async_from_dict(): - await test_update_application_instances_async(request_type=dict) - - def test_update_application_instances_field_headers(): client = AppPlatformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6906,8 +6945,8 @@ async def test_update_application_instances_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - platform.ListDraftsRequest, - dict, + platform.ListDraftsRequest(), + {}, ], ) def test_list_drafts(request_type, transport: str = "grpc"): @@ -6918,7 +6957,7 @@ def test_list_drafts(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_drafts), "__call__") as call: @@ -6967,12 +7006,13 @@ def test_list_drafts_non_empty_request_with_auto_populated_field(): client.list_drafts(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == platform.ListDraftsRequest( + request_msg = platform.ListDraftsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_drafts_use_cached_wrapped_rpc(): @@ -7053,9 +7093,14 @@ async def test_list_drafts_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_drafts_async( - transport: str = "grpc_asyncio", request_type=platform.ListDraftsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + platform.ListDraftsRequest(), + {}, + ], +) +async def test_list_drafts_async(request_type, transport: str = "grpc_asyncio"): client = AppPlatformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7063,7 +7108,7 @@ async def test_list_drafts_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_drafts), "__call__") as call: @@ -7088,11 +7133,6 @@ async def test_list_drafts_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_drafts_async_from_dict(): - await test_list_drafts_async(request_type=dict) - - def test_list_drafts_field_headers(): client = AppPlatformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7429,8 +7469,8 @@ async def test_list_drafts_async_pages(): @pytest.mark.parametrize( "request_type", [ - platform.GetDraftRequest, - dict, + platform.GetDraftRequest(), + {}, ], ) def test_get_draft(request_type, transport: str = "grpc"): @@ -7441,7 +7481,7 @@ def test_get_draft(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_draft), "__call__") as call: @@ -7489,9 +7529,10 @@ def test_get_draft_non_empty_request_with_auto_populated_field(): client.get_draft(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == platform.GetDraftRequest( + request_msg = platform.GetDraftRequest( name="name_value", ) + assert args[0] == request_msg def test_get_draft_use_cached_wrapped_rpc(): @@ -7570,9 +7611,14 @@ async def test_get_draft_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_draft_async( - transport: str = "grpc_asyncio", request_type=platform.GetDraftRequest -): +@pytest.mark.parametrize( + "request_type", + [ + platform.GetDraftRequest(), + {}, + ], +) +async def test_get_draft_async(request_type, transport: str = "grpc_asyncio"): client = AppPlatformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7580,7 +7626,7 @@ async def test_get_draft_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_draft), "__call__") as call: @@ -7607,11 +7653,6 @@ async def test_get_draft_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_get_draft_async_from_dict(): - await test_get_draft_async(request_type=dict) - - def test_get_draft_field_headers(): client = AppPlatformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7754,8 +7795,8 @@ async def test_get_draft_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - platform.CreateDraftRequest, - dict, + platform.CreateDraftRequest(), + {}, ], ) def test_create_draft(request_type, transport: str = "grpc"): @@ -7766,7 +7807,7 @@ def test_create_draft(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_draft), "__call__") as call: @@ -7809,11 +7850,12 @@ def test_create_draft_non_empty_request_with_auto_populated_field(): client.create_draft(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == platform.CreateDraftRequest( + request_msg = platform.CreateDraftRequest( parent="parent_value", draft_id="draft_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_draft_use_cached_wrapped_rpc(): @@ -7904,9 +7946,14 @@ async def test_create_draft_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_draft_async( - transport: str = "grpc_asyncio", request_type=platform.CreateDraftRequest -): +@pytest.mark.parametrize( + "request_type", + [ + platform.CreateDraftRequest(), + {}, + ], +) +async def test_create_draft_async(request_type, transport: str = "grpc_asyncio"): client = AppPlatformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7914,7 +7961,7 @@ async def test_create_draft_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_draft), "__call__") as call: @@ -7934,11 +7981,6 @@ async def test_create_draft_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_draft_async_from_dict(): - await test_create_draft_async(request_type=dict) - - def test_create_draft_field_headers(): client = AppPlatformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8105,8 +8147,8 @@ async def test_create_draft_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - platform.UpdateDraftRequest, - dict, + platform.UpdateDraftRequest(), + {}, ], ) def test_update_draft(request_type, transport: str = "grpc"): @@ -8117,7 +8159,7 @@ def test_update_draft(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_draft), "__call__") as call: @@ -8158,9 +8200,10 @@ def test_update_draft_non_empty_request_with_auto_populated_field(): client.update_draft(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == platform.UpdateDraftRequest( + request_msg = platform.UpdateDraftRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_draft_use_cached_wrapped_rpc(): @@ -8251,9 +8294,14 @@ async def test_update_draft_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_draft_async( - transport: str = "grpc_asyncio", request_type=platform.UpdateDraftRequest -): +@pytest.mark.parametrize( + "request_type", + [ + platform.UpdateDraftRequest(), + {}, + ], +) +async def test_update_draft_async(request_type, transport: str = "grpc_asyncio"): client = AppPlatformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8261,7 +8309,7 @@ async def test_update_draft_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_draft), "__call__") as call: @@ -8281,11 +8329,6 @@ async def test_update_draft_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_draft_async_from_dict(): - await test_update_draft_async(request_type=dict) - - def test_update_draft_field_headers(): client = AppPlatformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8442,8 +8485,8 @@ async def test_update_draft_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - platform.DeleteDraftRequest, - dict, + platform.DeleteDraftRequest(), + {}, ], ) def test_delete_draft(request_type, transport: str = "grpc"): @@ -8454,7 +8497,7 @@ def test_delete_draft(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_draft), "__call__") as call: @@ -8496,10 +8539,11 @@ def test_delete_draft_non_empty_request_with_auto_populated_field(): client.delete_draft(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == platform.DeleteDraftRequest( + request_msg = platform.DeleteDraftRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_draft_use_cached_wrapped_rpc(): @@ -8590,9 +8634,14 @@ async def test_delete_draft_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_draft_async( - transport: str = "grpc_asyncio", request_type=platform.DeleteDraftRequest -): +@pytest.mark.parametrize( + "request_type", + [ + platform.DeleteDraftRequest(), + {}, + ], +) +async def test_delete_draft_async(request_type, transport: str = "grpc_asyncio"): client = AppPlatformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8600,7 +8649,7 @@ async def test_delete_draft_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_draft), "__call__") as call: @@ -8620,11 +8669,6 @@ async def test_delete_draft_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_draft_async_from_dict(): - await test_delete_draft_async(request_type=dict) - - def test_delete_draft_field_headers(): client = AppPlatformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8771,8 +8815,8 @@ async def test_delete_draft_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - platform.ListProcessorsRequest, - dict, + platform.ListProcessorsRequest(), + {}, ], ) def test_list_processors(request_type, transport: str = "grpc"): @@ -8783,7 +8827,7 @@ def test_list_processors(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_processors), "__call__") as call: @@ -8832,12 +8876,13 @@ def test_list_processors_non_empty_request_with_auto_populated_field(): client.list_processors(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == platform.ListProcessorsRequest( + request_msg = platform.ListProcessorsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_processors_use_cached_wrapped_rpc(): @@ -8918,9 +8963,14 @@ async def test_list_processors_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_processors_async( - transport: str = "grpc_asyncio", request_type=platform.ListProcessorsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + platform.ListProcessorsRequest(), + {}, + ], +) +async def test_list_processors_async(request_type, transport: str = "grpc_asyncio"): client = AppPlatformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8928,7 +8978,7 @@ async def test_list_processors_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_processors), "__call__") as call: @@ -8953,11 +9003,6 @@ async def test_list_processors_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_processors_async_from_dict(): - await test_list_processors_async(request_type=dict) - - def test_list_processors_field_headers(): client = AppPlatformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9294,8 +9339,8 @@ async def test_list_processors_async_pages(): @pytest.mark.parametrize( "request_type", [ - platform.ListPrebuiltProcessorsRequest, - dict, + platform.ListPrebuiltProcessorsRequest(), + {}, ], ) def test_list_prebuilt_processors(request_type, transport: str = "grpc"): @@ -9306,7 +9351,7 @@ def test_list_prebuilt_processors(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9351,9 +9396,10 @@ def test_list_prebuilt_processors_non_empty_request_with_auto_populated_field(): client.list_prebuilt_processors(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == platform.ListPrebuiltProcessorsRequest( + request_msg = platform.ListPrebuiltProcessorsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_list_prebuilt_processors_use_cached_wrapped_rpc(): @@ -9439,8 +9485,15 @@ async def test_list_prebuilt_processors_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + platform.ListPrebuiltProcessorsRequest(), + {}, + ], +) async def test_list_prebuilt_processors_async( - transport: str = "grpc_asyncio", request_type=platform.ListPrebuiltProcessorsRequest + request_type, transport: str = "grpc_asyncio" ): client = AppPlatformAsyncClient( credentials=async_anonymous_credentials(), @@ -9449,7 +9502,7 @@ async def test_list_prebuilt_processors_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( @@ -9471,11 +9524,6 @@ async def test_list_prebuilt_processors_async( assert isinstance(response, platform.ListPrebuiltProcessorsResponse) -@pytest.mark.asyncio -async def test_list_prebuilt_processors_async_from_dict(): - await test_list_prebuilt_processors_async(request_type=dict) - - def test_list_prebuilt_processors_field_headers(): client = AppPlatformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9630,8 +9678,8 @@ async def test_list_prebuilt_processors_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - platform.GetProcessorRequest, - dict, + platform.GetProcessorRequest(), + {}, ], ) def test_get_processor(request_type, transport: str = "grpc"): @@ -9642,7 +9690,7 @@ def test_get_processor(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_processor), "__call__") as call: @@ -9706,9 +9754,10 @@ def test_get_processor_non_empty_request_with_auto_populated_field(): client.get_processor(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == platform.GetProcessorRequest( + request_msg = platform.GetProcessorRequest( name="name_value", ) + assert args[0] == request_msg def test_get_processor_use_cached_wrapped_rpc(): @@ -9789,9 +9838,14 @@ async def test_get_processor_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_processor_async( - transport: str = "grpc_asyncio", request_type=platform.GetProcessorRequest -): +@pytest.mark.parametrize( + "request_type", + [ + platform.GetProcessorRequest(), + {}, + ], +) +async def test_get_processor_async(request_type, transport: str = "grpc_asyncio"): client = AppPlatformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9799,7 +9853,7 @@ async def test_get_processor_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_processor), "__call__") as call: @@ -9842,11 +9896,6 @@ async def test_get_processor_async( assert response.supports_post_processing is True -@pytest.mark.asyncio -async def test_get_processor_async_from_dict(): - await test_get_processor_async(request_type=dict) - - def test_get_processor_field_headers(): client = AppPlatformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9989,8 +10038,8 @@ async def test_get_processor_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - platform.CreateProcessorRequest, - dict, + platform.CreateProcessorRequest(), + {}, ], ) def test_create_processor(request_type, transport: str = "grpc"): @@ -10001,7 +10050,7 @@ def test_create_processor(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_processor), "__call__") as call: @@ -10044,11 +10093,12 @@ def test_create_processor_non_empty_request_with_auto_populated_field(): client.create_processor(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == platform.CreateProcessorRequest( + request_msg = platform.CreateProcessorRequest( parent="parent_value", processor_id="processor_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_processor_use_cached_wrapped_rpc(): @@ -10141,9 +10191,14 @@ async def test_create_processor_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_processor_async( - transport: str = "grpc_asyncio", request_type=platform.CreateProcessorRequest -): +@pytest.mark.parametrize( + "request_type", + [ + platform.CreateProcessorRequest(), + {}, + ], +) +async def test_create_processor_async(request_type, transport: str = "grpc_asyncio"): client = AppPlatformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10151,7 +10206,7 @@ async def test_create_processor_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_processor), "__call__") as call: @@ -10171,11 +10226,6 @@ async def test_create_processor_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_processor_async_from_dict(): - await test_create_processor_async(request_type=dict) - - def test_create_processor_field_headers(): client = AppPlatformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10342,8 +10392,8 @@ async def test_create_processor_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - platform.UpdateProcessorRequest, - dict, + platform.UpdateProcessorRequest(), + {}, ], ) def test_update_processor(request_type, transport: str = "grpc"): @@ -10354,7 +10404,7 @@ def test_update_processor(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_processor), "__call__") as call: @@ -10395,9 +10445,10 @@ def test_update_processor_non_empty_request_with_auto_populated_field(): client.update_processor(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == platform.UpdateProcessorRequest( + request_msg = platform.UpdateProcessorRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_processor_use_cached_wrapped_rpc(): @@ -10490,9 +10541,14 @@ async def test_update_processor_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_processor_async( - transport: str = "grpc_asyncio", request_type=platform.UpdateProcessorRequest -): +@pytest.mark.parametrize( + "request_type", + [ + platform.UpdateProcessorRequest(), + {}, + ], +) +async def test_update_processor_async(request_type, transport: str = "grpc_asyncio"): client = AppPlatformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10500,7 +10556,7 @@ async def test_update_processor_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_processor), "__call__") as call: @@ -10520,11 +10576,6 @@ async def test_update_processor_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_processor_async_from_dict(): - await test_update_processor_async(request_type=dict) - - def test_update_processor_field_headers(): client = AppPlatformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10681,8 +10732,8 @@ async def test_update_processor_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - platform.DeleteProcessorRequest, - dict, + platform.DeleteProcessorRequest(), + {}, ], ) def test_delete_processor(request_type, transport: str = "grpc"): @@ -10693,7 +10744,7 @@ def test_delete_processor(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_processor), "__call__") as call: @@ -10735,10 +10786,11 @@ def test_delete_processor_non_empty_request_with_auto_populated_field(): client.delete_processor(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == platform.DeleteProcessorRequest( + request_msg = platform.DeleteProcessorRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_processor_use_cached_wrapped_rpc(): @@ -10831,9 +10883,14 @@ async def test_delete_processor_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_processor_async( - transport: str = "grpc_asyncio", request_type=platform.DeleteProcessorRequest -): +@pytest.mark.parametrize( + "request_type", + [ + platform.DeleteProcessorRequest(), + {}, + ], +) +async def test_delete_processor_async(request_type, transport: str = "grpc_asyncio"): client = AppPlatformAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10841,7 +10898,7 @@ async def test_delete_processor_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_processor), "__call__") as call: @@ -10861,11 +10918,6 @@ async def test_delete_processor_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_processor_async_from_dict(): - await test_delete_processor_async(request_type=dict) - - def test_delete_processor_field_headers(): client = AppPlatformClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16384,7 +16436,6 @@ def test_list_applications_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.ListApplicationsRequest() - assert args[0] == request_msg @@ -16405,7 +16456,6 @@ def test_get_application_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.GetApplicationRequest() - assert args[0] == request_msg @@ -16428,7 +16478,6 @@ def test_create_application_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.CreateApplicationRequest() - assert args[0] == request_msg @@ -16451,7 +16500,6 @@ def test_update_application_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.UpdateApplicationRequest() - assert args[0] == request_msg @@ -16474,7 +16522,6 @@ def test_delete_application_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.DeleteApplicationRequest() - assert args[0] == request_msg @@ -16497,7 +16544,6 @@ def test_deploy_application_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.DeployApplicationRequest() - assert args[0] == request_msg @@ -16520,7 +16566,6 @@ def test_undeploy_application_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.UndeployApplicationRequest() - assert args[0] == request_msg @@ -16543,7 +16588,6 @@ def test_add_application_stream_input_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.AddApplicationStreamInputRequest() - assert args[0] == request_msg @@ -16566,7 +16610,6 @@ def test_remove_application_stream_input_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.RemoveApplicationStreamInputRequest() - assert args[0] == request_msg @@ -16589,7 +16632,6 @@ def test_update_application_stream_input_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.UpdateApplicationStreamInputRequest() - assert args[0] == request_msg @@ -16610,7 +16652,6 @@ def test_list_instances_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.ListInstancesRequest() - assert args[0] == request_msg @@ -16631,7 +16672,6 @@ def test_get_instance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.GetInstanceRequest() - assert args[0] == request_msg @@ -16654,7 +16694,6 @@ def test_create_application_instances_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.CreateApplicationInstancesRequest() - assert args[0] == request_msg @@ -16677,7 +16716,6 @@ def test_delete_application_instances_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.DeleteApplicationInstancesRequest() - assert args[0] == request_msg @@ -16700,7 +16738,6 @@ def test_update_application_instances_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.UpdateApplicationInstancesRequest() - assert args[0] == request_msg @@ -16721,7 +16758,6 @@ def test_list_drafts_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.ListDraftsRequest() - assert args[0] == request_msg @@ -16742,7 +16778,6 @@ def test_get_draft_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.GetDraftRequest() - assert args[0] == request_msg @@ -16763,7 +16798,6 @@ def test_create_draft_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.CreateDraftRequest() - assert args[0] == request_msg @@ -16784,7 +16818,6 @@ def test_update_draft_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.UpdateDraftRequest() - assert args[0] == request_msg @@ -16805,7 +16838,6 @@ def test_delete_draft_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.DeleteDraftRequest() - assert args[0] == request_msg @@ -16826,7 +16858,6 @@ def test_list_processors_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.ListProcessorsRequest() - assert args[0] == request_msg @@ -16849,7 +16880,6 @@ def test_list_prebuilt_processors_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.ListPrebuiltProcessorsRequest() - assert args[0] == request_msg @@ -16870,7 +16900,6 @@ def test_get_processor_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.GetProcessorRequest() - assert args[0] == request_msg @@ -16891,7 +16920,6 @@ def test_create_processor_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.CreateProcessorRequest() - assert args[0] == request_msg @@ -16912,7 +16940,6 @@ def test_update_processor_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.UpdateProcessorRequest() - assert args[0] == request_msg @@ -16933,7 +16960,6 @@ def test_delete_processor_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.DeleteProcessorRequest() - assert args[0] == request_msg @@ -16977,7 +17003,6 @@ async def test_list_applications_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.ListApplicationsRequest() - assert args[0] == request_msg @@ -17007,7 +17032,6 @@ async def test_get_application_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.GetApplicationRequest() - assert args[0] == request_msg @@ -17034,7 +17058,6 @@ async def test_create_application_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.CreateApplicationRequest() - assert args[0] == request_msg @@ -17061,7 +17084,6 @@ async def test_update_application_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.UpdateApplicationRequest() - assert args[0] == request_msg @@ -17088,7 +17110,6 @@ async def test_delete_application_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.DeleteApplicationRequest() - assert args[0] == request_msg @@ -17115,7 +17136,6 @@ async def test_deploy_application_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.DeployApplicationRequest() - assert args[0] == request_msg @@ -17142,7 +17162,6 @@ async def test_undeploy_application_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.UndeployApplicationRequest() - assert args[0] == request_msg @@ -17169,7 +17188,6 @@ async def test_add_application_stream_input_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.AddApplicationStreamInputRequest() - assert args[0] == request_msg @@ -17196,7 +17214,6 @@ async def test_remove_application_stream_input_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.RemoveApplicationStreamInputRequest() - assert args[0] == request_msg @@ -17223,7 +17240,6 @@ async def test_update_application_stream_input_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.UpdateApplicationStreamInputRequest() - assert args[0] == request_msg @@ -17251,7 +17267,6 @@ async def test_list_instances_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.ListInstancesRequest() - assert args[0] == request_msg @@ -17281,7 +17296,6 @@ async def test_get_instance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.GetInstanceRequest() - assert args[0] == request_msg @@ -17308,7 +17322,6 @@ async def test_create_application_instances_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.CreateApplicationInstancesRequest() - assert args[0] == request_msg @@ -17335,7 +17348,6 @@ async def test_delete_application_instances_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.DeleteApplicationInstancesRequest() - assert args[0] == request_msg @@ -17362,7 +17374,6 @@ async def test_update_application_instances_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.UpdateApplicationInstancesRequest() - assert args[0] == request_msg @@ -17390,7 +17401,6 @@ async def test_list_drafts_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.ListDraftsRequest() - assert args[0] == request_msg @@ -17419,7 +17429,6 @@ async def test_get_draft_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.GetDraftRequest() - assert args[0] == request_msg @@ -17444,7 +17453,6 @@ async def test_create_draft_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.CreateDraftRequest() - assert args[0] == request_msg @@ -17469,7 +17477,6 @@ async def test_update_draft_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.UpdateDraftRequest() - assert args[0] == request_msg @@ -17494,7 +17501,6 @@ async def test_delete_draft_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.DeleteDraftRequest() - assert args[0] == request_msg @@ -17522,7 +17528,6 @@ async def test_list_processors_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.ListProcessorsRequest() - assert args[0] == request_msg @@ -17549,7 +17554,6 @@ async def test_list_prebuilt_processors_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.ListPrebuiltProcessorsRequest() - assert args[0] == request_msg @@ -17586,7 +17590,6 @@ async def test_get_processor_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.GetProcessorRequest() - assert args[0] == request_msg @@ -17611,7 +17614,6 @@ async def test_create_processor_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.CreateProcessorRequest() - assert args[0] == request_msg @@ -17636,7 +17638,6 @@ async def test_update_processor_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.UpdateProcessorRequest() - assert args[0] == request_msg @@ -17661,7 +17662,6 @@ async def test_delete_processor_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.DeleteProcessorRequest() - assert args[0] == request_msg @@ -22632,7 +22632,6 @@ def test_list_applications_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.ListApplicationsRequest() - assert args[0] == request_msg @@ -22652,7 +22651,6 @@ def test_get_application_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.GetApplicationRequest() - assert args[0] == request_msg @@ -22674,7 +22672,6 @@ def test_create_application_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.CreateApplicationRequest() - assert args[0] == request_msg @@ -22696,7 +22693,6 @@ def test_update_application_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.UpdateApplicationRequest() - assert args[0] == request_msg @@ -22718,7 +22714,6 @@ def test_delete_application_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.DeleteApplicationRequest() - assert args[0] == request_msg @@ -22740,7 +22735,6 @@ def test_deploy_application_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.DeployApplicationRequest() - assert args[0] == request_msg @@ -22762,7 +22756,6 @@ def test_undeploy_application_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.UndeployApplicationRequest() - assert args[0] == request_msg @@ -22784,7 +22777,6 @@ def test_add_application_stream_input_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.AddApplicationStreamInputRequest() - assert args[0] == request_msg @@ -22806,7 +22798,6 @@ def test_remove_application_stream_input_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.RemoveApplicationStreamInputRequest() - assert args[0] == request_msg @@ -22828,7 +22819,6 @@ def test_update_application_stream_input_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.UpdateApplicationStreamInputRequest() - assert args[0] == request_msg @@ -22848,7 +22838,6 @@ def test_list_instances_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.ListInstancesRequest() - assert args[0] == request_msg @@ -22868,7 +22857,6 @@ def test_get_instance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.GetInstanceRequest() - assert args[0] == request_msg @@ -22890,7 +22878,6 @@ def test_create_application_instances_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.CreateApplicationInstancesRequest() - assert args[0] == request_msg @@ -22912,7 +22899,6 @@ def test_delete_application_instances_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.DeleteApplicationInstancesRequest() - assert args[0] == request_msg @@ -22934,7 +22920,6 @@ def test_update_application_instances_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.UpdateApplicationInstancesRequest() - assert args[0] == request_msg @@ -22954,7 +22939,6 @@ def test_list_drafts_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.ListDraftsRequest() - assert args[0] == request_msg @@ -22974,7 +22958,6 @@ def test_get_draft_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.GetDraftRequest() - assert args[0] == request_msg @@ -22994,7 +22977,6 @@ def test_create_draft_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.CreateDraftRequest() - assert args[0] == request_msg @@ -23014,7 +22996,6 @@ def test_update_draft_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.UpdateDraftRequest() - assert args[0] == request_msg @@ -23034,7 +23015,6 @@ def test_delete_draft_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.DeleteDraftRequest() - assert args[0] == request_msg @@ -23054,7 +23034,6 @@ def test_list_processors_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.ListProcessorsRequest() - assert args[0] == request_msg @@ -23076,7 +23055,6 @@ def test_list_prebuilt_processors_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.ListPrebuiltProcessorsRequest() - assert args[0] == request_msg @@ -23096,7 +23074,6 @@ def test_get_processor_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.GetProcessorRequest() - assert args[0] == request_msg @@ -23116,7 +23093,6 @@ def test_create_processor_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.CreateProcessorRequest() - assert args[0] == request_msg @@ -23136,7 +23112,6 @@ def test_update_processor_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.UpdateProcessorRequest() - assert args[0] == request_msg @@ -23156,7 +23131,6 @@ def test_delete_processor_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = platform.DeleteProcessorRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-visionai/tests/unit/gapic/visionai_v1alpha1/test_live_video_analytics.py b/packages/google-cloud-visionai/tests/unit/gapic/visionai_v1alpha1/test_live_video_analytics.py index bab2c55b8b18..83174cdfcfba 100644 --- a/packages/google-cloud-visionai/tests/unit/gapic/visionai_v1alpha1/test_live_video_analytics.py +++ b/packages/google-cloud-visionai/tests/unit/gapic/visionai_v1alpha1/test_live_video_analytics.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 @@ -121,6 +122,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" @@ -1366,8 +1382,8 @@ def test_live_video_analytics_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - lva_service.ListAnalysesRequest, - dict, + lva_service.ListAnalysesRequest(), + {}, ], ) def test_list_analyses(request_type, transport: str = "grpc"): @@ -1378,7 +1394,7 @@ def test_list_analyses(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_analyses), "__call__") as call: @@ -1427,12 +1443,13 @@ def test_list_analyses_non_empty_request_with_auto_populated_field(): client.list_analyses(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == lva_service.ListAnalysesRequest( + request_msg = lva_service.ListAnalysesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_analyses_use_cached_wrapped_rpc(): @@ -1513,9 +1530,14 @@ async def test_list_analyses_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_analyses_async( - transport: str = "grpc_asyncio", request_type=lva_service.ListAnalysesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + lva_service.ListAnalysesRequest(), + {}, + ], +) +async def test_list_analyses_async(request_type, transport: str = "grpc_asyncio"): client = LiveVideoAnalyticsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1523,7 +1545,7 @@ async def test_list_analyses_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_analyses), "__call__") as call: @@ -1548,11 +1570,6 @@ async def test_list_analyses_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_analyses_async_from_dict(): - await test_list_analyses_async(request_type=dict) - - def test_list_analyses_field_headers(): client = LiveVideoAnalyticsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1889,8 +1906,8 @@ async def test_list_analyses_async_pages(): @pytest.mark.parametrize( "request_type", [ - lva_service.GetAnalysisRequest, - dict, + lva_service.GetAnalysisRequest(), + {}, ], ) def test_get_analysis(request_type, transport: str = "grpc"): @@ -1901,7 +1918,7 @@ def test_get_analysis(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_analysis), "__call__") as call: @@ -1945,9 +1962,10 @@ def test_get_analysis_non_empty_request_with_auto_populated_field(): client.get_analysis(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == lva_service.GetAnalysisRequest( + request_msg = lva_service.GetAnalysisRequest( name="name_value", ) + assert args[0] == request_msg def test_get_analysis_use_cached_wrapped_rpc(): @@ -2028,9 +2046,14 @@ async def test_get_analysis_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_analysis_async( - transport: str = "grpc_asyncio", request_type=lva_service.GetAnalysisRequest -): +@pytest.mark.parametrize( + "request_type", + [ + lva_service.GetAnalysisRequest(), + {}, + ], +) +async def test_get_analysis_async(request_type, transport: str = "grpc_asyncio"): client = LiveVideoAnalyticsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2038,7 +2061,7 @@ async def test_get_analysis_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_analysis), "__call__") as call: @@ -2061,11 +2084,6 @@ async def test_get_analysis_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_analysis_async_from_dict(): - await test_get_analysis_async(request_type=dict) - - def test_get_analysis_field_headers(): client = LiveVideoAnalyticsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2212,8 +2230,8 @@ async def test_get_analysis_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - lva_service.CreateAnalysisRequest, - dict, + lva_service.CreateAnalysisRequest(), + {}, ], ) def test_create_analysis(request_type, transport: str = "grpc"): @@ -2224,7 +2242,7 @@ def test_create_analysis(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_analysis), "__call__") as call: @@ -2267,11 +2285,12 @@ def test_create_analysis_non_empty_request_with_auto_populated_field(): client.create_analysis(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == lva_service.CreateAnalysisRequest( + request_msg = lva_service.CreateAnalysisRequest( parent="parent_value", analysis_id="analysis_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_analysis_use_cached_wrapped_rpc(): @@ -2362,9 +2381,14 @@ async def test_create_analysis_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_analysis_async( - transport: str = "grpc_asyncio", request_type=lva_service.CreateAnalysisRequest -): +@pytest.mark.parametrize( + "request_type", + [ + lva_service.CreateAnalysisRequest(), + {}, + ], +) +async def test_create_analysis_async(request_type, transport: str = "grpc_asyncio"): client = LiveVideoAnalyticsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2372,7 +2396,7 @@ async def test_create_analysis_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_analysis), "__call__") as call: @@ -2392,11 +2416,6 @@ async def test_create_analysis_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_analysis_async_from_dict(): - await test_create_analysis_async(request_type=dict) - - def test_create_analysis_field_headers(): client = LiveVideoAnalyticsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2563,8 +2582,8 @@ async def test_create_analysis_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - lva_service.UpdateAnalysisRequest, - dict, + lva_service.UpdateAnalysisRequest(), + {}, ], ) def test_update_analysis(request_type, transport: str = "grpc"): @@ -2575,7 +2594,7 @@ def test_update_analysis(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_analysis), "__call__") as call: @@ -2616,9 +2635,10 @@ def test_update_analysis_non_empty_request_with_auto_populated_field(): client.update_analysis(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == lva_service.UpdateAnalysisRequest( + request_msg = lva_service.UpdateAnalysisRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_analysis_use_cached_wrapped_rpc(): @@ -2709,9 +2729,14 @@ async def test_update_analysis_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_analysis_async( - transport: str = "grpc_asyncio", request_type=lva_service.UpdateAnalysisRequest -): +@pytest.mark.parametrize( + "request_type", + [ + lva_service.UpdateAnalysisRequest(), + {}, + ], +) +async def test_update_analysis_async(request_type, transport: str = "grpc_asyncio"): client = LiveVideoAnalyticsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2719,7 +2744,7 @@ async def test_update_analysis_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_analysis), "__call__") as call: @@ -2739,11 +2764,6 @@ async def test_update_analysis_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_analysis_async_from_dict(): - await test_update_analysis_async(request_type=dict) - - def test_update_analysis_field_headers(): client = LiveVideoAnalyticsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2900,8 +2920,8 @@ async def test_update_analysis_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - lva_service.DeleteAnalysisRequest, - dict, + lva_service.DeleteAnalysisRequest(), + {}, ], ) def test_delete_analysis(request_type, transport: str = "grpc"): @@ -2912,7 +2932,7 @@ def test_delete_analysis(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_analysis), "__call__") as call: @@ -2954,10 +2974,11 @@ def test_delete_analysis_non_empty_request_with_auto_populated_field(): client.delete_analysis(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == lva_service.DeleteAnalysisRequest( + request_msg = lva_service.DeleteAnalysisRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_analysis_use_cached_wrapped_rpc(): @@ -3048,9 +3069,14 @@ async def test_delete_analysis_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_analysis_async( - transport: str = "grpc_asyncio", request_type=lva_service.DeleteAnalysisRequest -): +@pytest.mark.parametrize( + "request_type", + [ + lva_service.DeleteAnalysisRequest(), + {}, + ], +) +async def test_delete_analysis_async(request_type, transport: str = "grpc_asyncio"): client = LiveVideoAnalyticsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3058,7 +3084,7 @@ async def test_delete_analysis_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_analysis), "__call__") as call: @@ -3078,11 +3104,6 @@ async def test_delete_analysis_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_analysis_async_from_dict(): - await test_delete_analysis_async(request_type=dict) - - def test_delete_analysis_field_headers(): client = LiveVideoAnalyticsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4387,7 +4408,6 @@ def test_list_analyses_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lva_service.ListAnalysesRequest() - assert args[0] == request_msg @@ -4408,7 +4428,6 @@ def test_get_analysis_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lva_service.GetAnalysisRequest() - assert args[0] == request_msg @@ -4429,7 +4448,6 @@ def test_create_analysis_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lva_service.CreateAnalysisRequest() - assert args[0] == request_msg @@ -4450,7 +4468,6 @@ def test_update_analysis_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lva_service.UpdateAnalysisRequest() - assert args[0] == request_msg @@ -4471,7 +4488,6 @@ def test_delete_analysis_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lva_service.DeleteAnalysisRequest() - assert args[0] == request_msg @@ -4513,7 +4529,6 @@ async def test_list_analyses_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lva_service.ListAnalysesRequest() - assert args[0] == request_msg @@ -4540,7 +4555,6 @@ async def test_get_analysis_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lva_service.GetAnalysisRequest() - assert args[0] == request_msg @@ -4565,7 +4579,6 @@ async def test_create_analysis_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lva_service.CreateAnalysisRequest() - assert args[0] == request_msg @@ -4590,7 +4603,6 @@ async def test_update_analysis_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lva_service.UpdateAnalysisRequest() - assert args[0] == request_msg @@ -4615,7 +4627,6 @@ async def test_delete_analysis_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lva_service.DeleteAnalysisRequest() - assert args[0] == request_msg @@ -6038,7 +6049,6 @@ def test_list_analyses_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lva_service.ListAnalysesRequest() - assert args[0] == request_msg @@ -6058,7 +6068,6 @@ def test_get_analysis_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lva_service.GetAnalysisRequest() - assert args[0] == request_msg @@ -6078,7 +6087,6 @@ def test_create_analysis_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lva_service.CreateAnalysisRequest() - assert args[0] == request_msg @@ -6098,7 +6106,6 @@ def test_update_analysis_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lva_service.UpdateAnalysisRequest() - assert args[0] == request_msg @@ -6118,7 +6125,6 @@ def test_delete_analysis_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lva_service.DeleteAnalysisRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-visionai/tests/unit/gapic/visionai_v1alpha1/test_streaming_service.py b/packages/google-cloud-visionai/tests/unit/gapic/visionai_v1alpha1/test_streaming_service.py index 8b79719af4ff..ded4255a2ddc 100644 --- a/packages/google-cloud-visionai/tests/unit/gapic/visionai_v1alpha1/test_streaming_service.py +++ b/packages/google-cloud-visionai/tests/unit/gapic/visionai_v1alpha1/test_streaming_service.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 @@ -116,6 +117,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" @@ -1349,8 +1365,8 @@ def test_streaming_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - streaming_service.SendPacketsRequest, - dict, + streaming_service.SendPacketsRequest(), + {}, ], ) def test_send_packets(request_type, transport: str = "grpc"): @@ -1361,7 +1377,7 @@ def test_send_packets(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as 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. @@ -1458,9 +1474,14 @@ async def test_send_packets_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_send_packets_async( - transport: str = "grpc_asyncio", request_type=streaming_service.SendPacketsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + streaming_service.SendPacketsRequest(), + {}, + ], +) +async def test_send_packets_async(request_type, transport: str = "grpc_asyncio"): client = StreamingServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1468,7 +1489,7 @@ async def test_send_packets_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. @@ -1490,16 +1511,11 @@ async def test_send_packets_async( assert isinstance(message, streaming_service.SendPacketsResponse) -@pytest.mark.asyncio -async def test_send_packets_async_from_dict(): - await test_send_packets_async(request_type=dict) - - @pytest.mark.parametrize( "request_type", [ - streaming_service.ReceivePacketsRequest, - dict, + streaming_service.ReceivePacketsRequest(), + {}, ], ) def test_receive_packets(request_type, transport: str = "grpc"): @@ -1510,7 +1526,7 @@ def test_receive_packets(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as 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. @@ -1607,10 +1623,14 @@ async def test_receive_packets_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_receive_packets_async( - transport: str = "grpc_asyncio", - request_type=streaming_service.ReceivePacketsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + streaming_service.ReceivePacketsRequest(), + {}, + ], +) +async def test_receive_packets_async(request_type, transport: str = "grpc_asyncio"): client = StreamingServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1618,7 +1638,7 @@ async def test_receive_packets_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. @@ -1640,16 +1660,11 @@ async def test_receive_packets_async( assert isinstance(message, streaming_service.ReceivePacketsResponse) -@pytest.mark.asyncio -async def test_receive_packets_async_from_dict(): - await test_receive_packets_async(request_type=dict) - - @pytest.mark.parametrize( "request_type", [ - streaming_service.ReceiveEventsRequest, - dict, + streaming_service.ReceiveEventsRequest(), + {}, ], ) def test_receive_events(request_type, transport: str = "grpc"): @@ -1660,7 +1675,7 @@ def test_receive_events(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as 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. @@ -1757,9 +1772,14 @@ async def test_receive_events_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_receive_events_async( - transport: str = "grpc_asyncio", request_type=streaming_service.ReceiveEventsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + streaming_service.ReceiveEventsRequest(), + {}, + ], +) +async def test_receive_events_async(request_type, transport: str = "grpc_asyncio"): client = StreamingServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1767,7 +1787,7 @@ async def test_receive_events_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. @@ -1789,16 +1809,11 @@ async def test_receive_events_async( assert isinstance(message, streaming_service.ReceiveEventsResponse) -@pytest.mark.asyncio -async def test_receive_events_async_from_dict(): - await test_receive_events_async(request_type=dict) - - @pytest.mark.parametrize( "request_type", [ - streaming_service.AcquireLeaseRequest, - dict, + streaming_service.AcquireLeaseRequest(), + {}, ], ) def test_acquire_lease(request_type, transport: str = "grpc"): @@ -1809,7 +1824,7 @@ def test_acquire_lease(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.acquire_lease), "__call__") as call: @@ -1860,10 +1875,11 @@ def test_acquire_lease_non_empty_request_with_auto_populated_field(): client.acquire_lease(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == streaming_service.AcquireLeaseRequest( + request_msg = streaming_service.AcquireLeaseRequest( series="series_value", owner="owner_value", ) + assert args[0] == request_msg def test_acquire_lease_use_cached_wrapped_rpc(): @@ -1944,9 +1960,14 @@ async def test_acquire_lease_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_acquire_lease_async( - transport: str = "grpc_asyncio", request_type=streaming_service.AcquireLeaseRequest -): +@pytest.mark.parametrize( + "request_type", + [ + streaming_service.AcquireLeaseRequest(), + {}, + ], +) +async def test_acquire_lease_async(request_type, transport: str = "grpc_asyncio"): client = StreamingServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1954,7 +1975,7 @@ async def test_acquire_lease_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.acquire_lease), "__call__") as call: @@ -1983,11 +2004,6 @@ async def test_acquire_lease_async( assert response.lease_type == streaming_service.LeaseType.LEASE_TYPE_READER -@pytest.mark.asyncio -async def test_acquire_lease_async_from_dict(): - await test_acquire_lease_async(request_type=dict) - - def test_acquire_lease_field_headers(): client = StreamingServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2052,8 +2068,8 @@ async def test_acquire_lease_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - streaming_service.RenewLeaseRequest, - dict, + streaming_service.RenewLeaseRequest(), + {}, ], ) def test_renew_lease(request_type, transport: str = "grpc"): @@ -2064,7 +2080,7 @@ def test_renew_lease(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.renew_lease), "__call__") as call: @@ -2116,11 +2132,12 @@ def test_renew_lease_non_empty_request_with_auto_populated_field(): client.renew_lease(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == streaming_service.RenewLeaseRequest( + request_msg = streaming_service.RenewLeaseRequest( id="id_value", series="series_value", owner="owner_value", ) + assert args[0] == request_msg def test_renew_lease_use_cached_wrapped_rpc(): @@ -2201,9 +2218,14 @@ async def test_renew_lease_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_renew_lease_async( - transport: str = "grpc_asyncio", request_type=streaming_service.RenewLeaseRequest -): +@pytest.mark.parametrize( + "request_type", + [ + streaming_service.RenewLeaseRequest(), + {}, + ], +) +async def test_renew_lease_async(request_type, transport: str = "grpc_asyncio"): client = StreamingServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2211,7 +2233,7 @@ async def test_renew_lease_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.renew_lease), "__call__") as call: @@ -2240,11 +2262,6 @@ async def test_renew_lease_async( assert response.lease_type == streaming_service.LeaseType.LEASE_TYPE_READER -@pytest.mark.asyncio -async def test_renew_lease_async_from_dict(): - await test_renew_lease_async(request_type=dict) - - def test_renew_lease_field_headers(): client = StreamingServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2309,8 +2326,8 @@ async def test_renew_lease_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - streaming_service.ReleaseLeaseRequest, - dict, + streaming_service.ReleaseLeaseRequest(), + {}, ], ) def test_release_lease(request_type, transport: str = "grpc"): @@ -2321,7 +2338,7 @@ def test_release_lease(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.release_lease), "__call__") as call: @@ -2364,11 +2381,12 @@ def test_release_lease_non_empty_request_with_auto_populated_field(): client.release_lease(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == streaming_service.ReleaseLeaseRequest( + request_msg = streaming_service.ReleaseLeaseRequest( id="id_value", series="series_value", owner="owner_value", ) + assert args[0] == request_msg def test_release_lease_use_cached_wrapped_rpc(): @@ -2449,9 +2467,14 @@ async def test_release_lease_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_release_lease_async( - transport: str = "grpc_asyncio", request_type=streaming_service.ReleaseLeaseRequest -): +@pytest.mark.parametrize( + "request_type", + [ + streaming_service.ReleaseLeaseRequest(), + {}, + ], +) +async def test_release_lease_async(request_type, transport: str = "grpc_asyncio"): client = StreamingServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2459,7 +2482,7 @@ async def test_release_lease_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.release_lease), "__call__") as call: @@ -2479,11 +2502,6 @@ async def test_release_lease_async( assert isinstance(response, streaming_service.ReleaseLeaseResponse) -@pytest.mark.asyncio -async def test_release_lease_async_from_dict(): - await test_release_lease_async(request_type=dict) - - def test_release_lease_field_headers(): client = StreamingServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2848,7 +2866,6 @@ def test_acquire_lease_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streaming_service.AcquireLeaseRequest() - assert args[0] == request_msg @@ -2869,7 +2886,6 @@ def test_renew_lease_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streaming_service.RenewLeaseRequest() - assert args[0] == request_msg @@ -2890,7 +2906,6 @@ def test_release_lease_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streaming_service.ReleaseLeaseRequest() - assert args[0] == request_msg @@ -2934,7 +2949,6 @@ async def test_acquire_lease_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streaming_service.AcquireLeaseRequest() - assert args[0] == request_msg @@ -2964,7 +2978,6 @@ async def test_renew_lease_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streaming_service.RenewLeaseRequest() - assert args[0] == request_msg @@ -2989,7 +3002,6 @@ async def test_release_lease_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streaming_service.ReleaseLeaseRequest() - assert args[0] == request_msg @@ -4038,7 +4050,6 @@ def test_acquire_lease_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streaming_service.AcquireLeaseRequest() - assert args[0] == request_msg @@ -4058,7 +4069,6 @@ def test_renew_lease_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streaming_service.RenewLeaseRequest() - assert args[0] == request_msg @@ -4078,7 +4088,6 @@ def test_release_lease_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streaming_service.ReleaseLeaseRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-visionai/tests/unit/gapic/visionai_v1alpha1/test_streams_service.py b/packages/google-cloud-visionai/tests/unit/gapic/visionai_v1alpha1/test_streams_service.py index 240d5b31a7a3..7fa638b2906f 100644 --- a/packages/google-cloud-visionai/tests/unit/gapic/visionai_v1alpha1/test_streams_service.py +++ b/packages/google-cloud-visionai/tests/unit/gapic/visionai_v1alpha1/test_streams_service.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 @@ -126,6 +127,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" @@ -1329,8 +1345,8 @@ def test_streams_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - streams_service.ListClustersRequest, - dict, + streams_service.ListClustersRequest(), + {}, ], ) def test_list_clusters(request_type, transport: str = "grpc"): @@ -1341,7 +1357,7 @@ def test_list_clusters(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_clusters), "__call__") as call: @@ -1390,12 +1406,13 @@ def test_list_clusters_non_empty_request_with_auto_populated_field(): client.list_clusters(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == streams_service.ListClustersRequest( + request_msg = streams_service.ListClustersRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_clusters_use_cached_wrapped_rpc(): @@ -1476,9 +1493,14 @@ async def test_list_clusters_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_clusters_async( - transport: str = "grpc_asyncio", request_type=streams_service.ListClustersRequest -): +@pytest.mark.parametrize( + "request_type", + [ + streams_service.ListClustersRequest(), + {}, + ], +) +async def test_list_clusters_async(request_type, transport: str = "grpc_asyncio"): client = StreamsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1486,7 +1508,7 @@ async def test_list_clusters_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_clusters), "__call__") as call: @@ -1511,11 +1533,6 @@ async def test_list_clusters_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_clusters_async_from_dict(): - await test_list_clusters_async(request_type=dict) - - def test_list_clusters_field_headers(): client = StreamsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1852,8 +1869,8 @@ async def test_list_clusters_async_pages(): @pytest.mark.parametrize( "request_type", [ - streams_service.GetClusterRequest, - dict, + streams_service.GetClusterRequest(), + {}, ], ) def test_get_cluster(request_type, transport: str = "grpc"): @@ -1864,7 +1881,7 @@ def test_get_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_cluster), "__call__") as call: @@ -1914,9 +1931,10 @@ def test_get_cluster_non_empty_request_with_auto_populated_field(): client.get_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == streams_service.GetClusterRequest( + request_msg = streams_service.GetClusterRequest( name="name_value", ) + assert args[0] == request_msg def test_get_cluster_use_cached_wrapped_rpc(): @@ -1997,9 +2015,14 @@ async def test_get_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_cluster_async( - transport: str = "grpc_asyncio", request_type=streams_service.GetClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + streams_service.GetClusterRequest(), + {}, + ], +) +async def test_get_cluster_async(request_type, transport: str = "grpc_asyncio"): client = StreamsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2007,7 +2030,7 @@ async def test_get_cluster_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_cluster), "__call__") as call: @@ -2036,11 +2059,6 @@ async def test_get_cluster_async( assert response.psc_target == "psc_target_value" -@pytest.mark.asyncio -async def test_get_cluster_async_from_dict(): - await test_get_cluster_async(request_type=dict) - - def test_get_cluster_field_headers(): client = StreamsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2183,8 +2201,8 @@ async def test_get_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - streams_service.CreateClusterRequest, - dict, + streams_service.CreateClusterRequest(), + {}, ], ) def test_create_cluster(request_type, transport: str = "grpc"): @@ -2195,7 +2213,7 @@ def test_create_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_cluster), "__call__") as call: @@ -2238,11 +2256,12 @@ def test_create_cluster_non_empty_request_with_auto_populated_field(): client.create_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == streams_service.CreateClusterRequest( + request_msg = streams_service.CreateClusterRequest( parent="parent_value", cluster_id="cluster_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_cluster_use_cached_wrapped_rpc(): @@ -2333,9 +2352,14 @@ async def test_create_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_cluster_async( - transport: str = "grpc_asyncio", request_type=streams_service.CreateClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + streams_service.CreateClusterRequest(), + {}, + ], +) +async def test_create_cluster_async(request_type, transport: str = "grpc_asyncio"): client = StreamsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2343,7 +2367,7 @@ async def test_create_cluster_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_cluster), "__call__") as call: @@ -2363,11 +2387,6 @@ async def test_create_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_cluster_async_from_dict(): - await test_create_cluster_async(request_type=dict) - - def test_create_cluster_field_headers(): client = StreamsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2534,8 +2553,8 @@ async def test_create_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - streams_service.UpdateClusterRequest, - dict, + streams_service.UpdateClusterRequest(), + {}, ], ) def test_update_cluster(request_type, transport: str = "grpc"): @@ -2546,7 +2565,7 @@ def test_update_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_cluster), "__call__") as call: @@ -2587,9 +2606,10 @@ def test_update_cluster_non_empty_request_with_auto_populated_field(): client.update_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == streams_service.UpdateClusterRequest( + request_msg = streams_service.UpdateClusterRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_cluster_use_cached_wrapped_rpc(): @@ -2680,9 +2700,14 @@ async def test_update_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_cluster_async( - transport: str = "grpc_asyncio", request_type=streams_service.UpdateClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + streams_service.UpdateClusterRequest(), + {}, + ], +) +async def test_update_cluster_async(request_type, transport: str = "grpc_asyncio"): client = StreamsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2690,7 +2715,7 @@ async def test_update_cluster_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_cluster), "__call__") as call: @@ -2710,11 +2735,6 @@ async def test_update_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_cluster_async_from_dict(): - await test_update_cluster_async(request_type=dict) - - def test_update_cluster_field_headers(): client = StreamsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2871,8 +2891,8 @@ async def test_update_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - streams_service.DeleteClusterRequest, - dict, + streams_service.DeleteClusterRequest(), + {}, ], ) def test_delete_cluster(request_type, transport: str = "grpc"): @@ -2883,7 +2903,7 @@ def test_delete_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_cluster), "__call__") as call: @@ -2925,10 +2945,11 @@ def test_delete_cluster_non_empty_request_with_auto_populated_field(): client.delete_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == streams_service.DeleteClusterRequest( + request_msg = streams_service.DeleteClusterRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_cluster_use_cached_wrapped_rpc(): @@ -3019,9 +3040,14 @@ async def test_delete_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_cluster_async( - transport: str = "grpc_asyncio", request_type=streams_service.DeleteClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + streams_service.DeleteClusterRequest(), + {}, + ], +) +async def test_delete_cluster_async(request_type, transport: str = "grpc_asyncio"): client = StreamsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3029,7 +3055,7 @@ async def test_delete_cluster_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_cluster), "__call__") as call: @@ -3049,11 +3075,6 @@ async def test_delete_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_cluster_async_from_dict(): - await test_delete_cluster_async(request_type=dict) - - def test_delete_cluster_field_headers(): client = StreamsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3200,8 +3221,8 @@ async def test_delete_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - streams_service.ListStreamsRequest, - dict, + streams_service.ListStreamsRequest(), + {}, ], ) def test_list_streams(request_type, transport: str = "grpc"): @@ -3212,7 +3233,7 @@ def test_list_streams(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_streams), "__call__") as call: @@ -3261,12 +3282,13 @@ def test_list_streams_non_empty_request_with_auto_populated_field(): client.list_streams(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == streams_service.ListStreamsRequest( + request_msg = streams_service.ListStreamsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_streams_use_cached_wrapped_rpc(): @@ -3347,9 +3369,14 @@ async def test_list_streams_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_streams_async( - transport: str = "grpc_asyncio", request_type=streams_service.ListStreamsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + streams_service.ListStreamsRequest(), + {}, + ], +) +async def test_list_streams_async(request_type, transport: str = "grpc_asyncio"): client = StreamsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3357,7 +3384,7 @@ async def test_list_streams_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_streams), "__call__") as call: @@ -3382,11 +3409,6 @@ async def test_list_streams_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_streams_async_from_dict(): - await test_list_streams_async(request_type=dict) - - def test_list_streams_field_headers(): client = StreamsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3723,8 +3745,8 @@ async def test_list_streams_async_pages(): @pytest.mark.parametrize( "request_type", [ - streams_service.GetStreamRequest, - dict, + streams_service.GetStreamRequest(), + {}, ], ) def test_get_stream(request_type, transport: str = "grpc"): @@ -3735,7 +3757,7 @@ def test_get_stream(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_stream), "__call__") as call: @@ -3785,9 +3807,10 @@ def test_get_stream_non_empty_request_with_auto_populated_field(): client.get_stream(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == streams_service.GetStreamRequest( + request_msg = streams_service.GetStreamRequest( name="name_value", ) + assert args[0] == request_msg def test_get_stream_use_cached_wrapped_rpc(): @@ -3866,9 +3889,14 @@ async def test_get_stream_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_stream_async( - transport: str = "grpc_asyncio", request_type=streams_service.GetStreamRequest -): +@pytest.mark.parametrize( + "request_type", + [ + streams_service.GetStreamRequest(), + {}, + ], +) +async def test_get_stream_async(request_type, transport: str = "grpc_asyncio"): client = StreamsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3876,7 +3904,7 @@ async def test_get_stream_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_stream), "__call__") as call: @@ -3905,11 +3933,6 @@ async def test_get_stream_async( assert response.media_warehouse_asset == "media_warehouse_asset_value" -@pytest.mark.asyncio -async def test_get_stream_async_from_dict(): - await test_get_stream_async(request_type=dict) - - def test_get_stream_field_headers(): client = StreamsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4056,8 +4079,8 @@ async def test_get_stream_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - streams_service.CreateStreamRequest, - dict, + streams_service.CreateStreamRequest(), + {}, ], ) def test_create_stream(request_type, transport: str = "grpc"): @@ -4068,7 +4091,7 @@ def test_create_stream(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_stream), "__call__") as call: @@ -4111,11 +4134,12 @@ def test_create_stream_non_empty_request_with_auto_populated_field(): client.create_stream(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == streams_service.CreateStreamRequest( + request_msg = streams_service.CreateStreamRequest( parent="parent_value", stream_id="stream_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_stream_use_cached_wrapped_rpc(): @@ -4206,9 +4230,14 @@ async def test_create_stream_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_stream_async( - transport: str = "grpc_asyncio", request_type=streams_service.CreateStreamRequest -): +@pytest.mark.parametrize( + "request_type", + [ + streams_service.CreateStreamRequest(), + {}, + ], +) +async def test_create_stream_async(request_type, transport: str = "grpc_asyncio"): client = StreamsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4216,7 +4245,7 @@ async def test_create_stream_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_stream), "__call__") as call: @@ -4236,11 +4265,6 @@ async def test_create_stream_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_stream_async_from_dict(): - await test_create_stream_async(request_type=dict) - - def test_create_stream_field_headers(): client = StreamsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4407,8 +4431,8 @@ async def test_create_stream_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - streams_service.UpdateStreamRequest, - dict, + streams_service.UpdateStreamRequest(), + {}, ], ) def test_update_stream(request_type, transport: str = "grpc"): @@ -4419,7 +4443,7 @@ def test_update_stream(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_stream), "__call__") as call: @@ -4460,9 +4484,10 @@ def test_update_stream_non_empty_request_with_auto_populated_field(): client.update_stream(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == streams_service.UpdateStreamRequest( + request_msg = streams_service.UpdateStreamRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_stream_use_cached_wrapped_rpc(): @@ -4553,9 +4578,14 @@ async def test_update_stream_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_stream_async( - transport: str = "grpc_asyncio", request_type=streams_service.UpdateStreamRequest -): +@pytest.mark.parametrize( + "request_type", + [ + streams_service.UpdateStreamRequest(), + {}, + ], +) +async def test_update_stream_async(request_type, transport: str = "grpc_asyncio"): client = StreamsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4563,7 +4593,7 @@ async def test_update_stream_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_stream), "__call__") as call: @@ -4583,11 +4613,6 @@ async def test_update_stream_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_stream_async_from_dict(): - await test_update_stream_async(request_type=dict) - - def test_update_stream_field_headers(): client = StreamsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4744,8 +4769,8 @@ async def test_update_stream_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - streams_service.DeleteStreamRequest, - dict, + streams_service.DeleteStreamRequest(), + {}, ], ) def test_delete_stream(request_type, transport: str = "grpc"): @@ -4756,7 +4781,7 @@ def test_delete_stream(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_stream), "__call__") as call: @@ -4798,10 +4823,11 @@ def test_delete_stream_non_empty_request_with_auto_populated_field(): client.delete_stream(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == streams_service.DeleteStreamRequest( + request_msg = streams_service.DeleteStreamRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_stream_use_cached_wrapped_rpc(): @@ -4892,9 +4918,14 @@ async def test_delete_stream_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_stream_async( - transport: str = "grpc_asyncio", request_type=streams_service.DeleteStreamRequest -): +@pytest.mark.parametrize( + "request_type", + [ + streams_service.DeleteStreamRequest(), + {}, + ], +) +async def test_delete_stream_async(request_type, transport: str = "grpc_asyncio"): client = StreamsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4902,7 +4933,7 @@ async def test_delete_stream_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_stream), "__call__") as call: @@ -4922,11 +4953,6 @@ async def test_delete_stream_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_stream_async_from_dict(): - await test_delete_stream_async(request_type=dict) - - def test_delete_stream_field_headers(): client = StreamsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5073,8 +5099,8 @@ async def test_delete_stream_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - streams_service.GenerateStreamHlsTokenRequest, - dict, + streams_service.GenerateStreamHlsTokenRequest(), + {}, ], ) def test_generate_stream_hls_token(request_type, transport: str = "grpc"): @@ -5085,7 +5111,7 @@ def test_generate_stream_hls_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( @@ -5133,9 +5159,10 @@ def test_generate_stream_hls_token_non_empty_request_with_auto_populated_field() client.generate_stream_hls_token(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == streams_service.GenerateStreamHlsTokenRequest( + request_msg = streams_service.GenerateStreamHlsTokenRequest( stream="stream_value", ) + assert args[0] == request_msg def test_generate_stream_hls_token_use_cached_wrapped_rpc(): @@ -5221,9 +5248,15 @@ async def test_generate_stream_hls_token_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + streams_service.GenerateStreamHlsTokenRequest(), + {}, + ], +) async def test_generate_stream_hls_token_async( - transport: str = "grpc_asyncio", - request_type=streams_service.GenerateStreamHlsTokenRequest, + request_type, transport: str = "grpc_asyncio" ): client = StreamsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -5232,7 +5265,7 @@ async def test_generate_stream_hls_token_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( @@ -5257,11 +5290,6 @@ async def test_generate_stream_hls_token_async( assert response.token == "token_value" -@pytest.mark.asyncio -async def test_generate_stream_hls_token_async_from_dict(): - await test_generate_stream_hls_token_async(request_type=dict) - - def test_generate_stream_hls_token_field_headers(): client = StreamsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5416,8 +5444,8 @@ async def test_generate_stream_hls_token_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - streams_service.ListEventsRequest, - dict, + streams_service.ListEventsRequest(), + {}, ], ) def test_list_events(request_type, transport: str = "grpc"): @@ -5428,7 +5456,7 @@ def test_list_events(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_events), "__call__") as call: @@ -5477,12 +5505,13 @@ def test_list_events_non_empty_request_with_auto_populated_field(): client.list_events(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == streams_service.ListEventsRequest( + request_msg = streams_service.ListEventsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_events_use_cached_wrapped_rpc(): @@ -5563,9 +5592,14 @@ async def test_list_events_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_events_async( - transport: str = "grpc_asyncio", request_type=streams_service.ListEventsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + streams_service.ListEventsRequest(), + {}, + ], +) +async def test_list_events_async(request_type, transport: str = "grpc_asyncio"): client = StreamsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5573,7 +5607,7 @@ async def test_list_events_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_events), "__call__") as call: @@ -5598,11 +5632,6 @@ async def test_list_events_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_events_async_from_dict(): - await test_list_events_async(request_type=dict) - - def test_list_events_field_headers(): client = StreamsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5939,8 +5968,8 @@ async def test_list_events_async_pages(): @pytest.mark.parametrize( "request_type", [ - streams_service.GetEventRequest, - dict, + streams_service.GetEventRequest(), + {}, ], ) def test_get_event(request_type, transport: str = "grpc"): @@ -5951,7 +5980,7 @@ def test_get_event(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_event), "__call__") as call: @@ -5997,9 +6026,10 @@ def test_get_event_non_empty_request_with_auto_populated_field(): client.get_event(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == streams_service.GetEventRequest( + request_msg = streams_service.GetEventRequest( name="name_value", ) + assert args[0] == request_msg def test_get_event_use_cached_wrapped_rpc(): @@ -6078,9 +6108,14 @@ async def test_get_event_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_event_async( - transport: str = "grpc_asyncio", request_type=streams_service.GetEventRequest -): +@pytest.mark.parametrize( + "request_type", + [ + streams_service.GetEventRequest(), + {}, + ], +) +async def test_get_event_async(request_type, transport: str = "grpc_asyncio"): client = StreamsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6088,7 +6123,7 @@ async def test_get_event_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_event), "__call__") as call: @@ -6113,11 +6148,6 @@ async def test_get_event_async( assert response.alignment_clock == streams_resources.Event.Clock.CAPTURE -@pytest.mark.asyncio -async def test_get_event_async_from_dict(): - await test_get_event_async(request_type=dict) - - def test_get_event_field_headers(): client = StreamsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6264,8 +6294,8 @@ async def test_get_event_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - streams_service.CreateEventRequest, - dict, + streams_service.CreateEventRequest(), + {}, ], ) def test_create_event(request_type, transport: str = "grpc"): @@ -6276,7 +6306,7 @@ def test_create_event(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_event), "__call__") as call: @@ -6319,11 +6349,12 @@ def test_create_event_non_empty_request_with_auto_populated_field(): client.create_event(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == streams_service.CreateEventRequest( + request_msg = streams_service.CreateEventRequest( parent="parent_value", event_id="event_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_event_use_cached_wrapped_rpc(): @@ -6414,9 +6445,14 @@ async def test_create_event_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_event_async( - transport: str = "grpc_asyncio", request_type=streams_service.CreateEventRequest -): +@pytest.mark.parametrize( + "request_type", + [ + streams_service.CreateEventRequest(), + {}, + ], +) +async def test_create_event_async(request_type, transport: str = "grpc_asyncio"): client = StreamsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6424,7 +6460,7 @@ async def test_create_event_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_event), "__call__") as call: @@ -6444,11 +6480,6 @@ async def test_create_event_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_event_async_from_dict(): - await test_create_event_async(request_type=dict) - - def test_create_event_field_headers(): client = StreamsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6615,8 +6646,8 @@ async def test_create_event_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - streams_service.UpdateEventRequest, - dict, + streams_service.UpdateEventRequest(), + {}, ], ) def test_update_event(request_type, transport: str = "grpc"): @@ -6627,7 +6658,7 @@ def test_update_event(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_event), "__call__") as call: @@ -6668,9 +6699,10 @@ def test_update_event_non_empty_request_with_auto_populated_field(): client.update_event(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == streams_service.UpdateEventRequest( + request_msg = streams_service.UpdateEventRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_event_use_cached_wrapped_rpc(): @@ -6761,9 +6793,14 @@ async def test_update_event_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_event_async( - transport: str = "grpc_asyncio", request_type=streams_service.UpdateEventRequest -): +@pytest.mark.parametrize( + "request_type", + [ + streams_service.UpdateEventRequest(), + {}, + ], +) +async def test_update_event_async(request_type, transport: str = "grpc_asyncio"): client = StreamsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6771,7 +6808,7 @@ async def test_update_event_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_event), "__call__") as call: @@ -6791,11 +6828,6 @@ async def test_update_event_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_event_async_from_dict(): - await test_update_event_async(request_type=dict) - - def test_update_event_field_headers(): client = StreamsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6952,8 +6984,8 @@ async def test_update_event_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - streams_service.DeleteEventRequest, - dict, + streams_service.DeleteEventRequest(), + {}, ], ) def test_delete_event(request_type, transport: str = "grpc"): @@ -6964,7 +6996,7 @@ def test_delete_event(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_event), "__call__") as call: @@ -7006,10 +7038,11 @@ def test_delete_event_non_empty_request_with_auto_populated_field(): client.delete_event(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == streams_service.DeleteEventRequest( + request_msg = streams_service.DeleteEventRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_event_use_cached_wrapped_rpc(): @@ -7100,9 +7133,14 @@ async def test_delete_event_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_event_async( - transport: str = "grpc_asyncio", request_type=streams_service.DeleteEventRequest -): +@pytest.mark.parametrize( + "request_type", + [ + streams_service.DeleteEventRequest(), + {}, + ], +) +async def test_delete_event_async(request_type, transport: str = "grpc_asyncio"): client = StreamsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7110,7 +7148,7 @@ async def test_delete_event_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_event), "__call__") as call: @@ -7130,11 +7168,6 @@ async def test_delete_event_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_event_async_from_dict(): - await test_delete_event_async(request_type=dict) - - def test_delete_event_field_headers(): client = StreamsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7281,8 +7314,8 @@ async def test_delete_event_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - streams_service.ListSeriesRequest, - dict, + streams_service.ListSeriesRequest(), + {}, ], ) def test_list_series(request_type, transport: str = "grpc"): @@ -7293,7 +7326,7 @@ def test_list_series(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_series), "__call__") as call: @@ -7342,12 +7375,13 @@ def test_list_series_non_empty_request_with_auto_populated_field(): client.list_series(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == streams_service.ListSeriesRequest( + request_msg = streams_service.ListSeriesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_series_use_cached_wrapped_rpc(): @@ -7428,9 +7462,14 @@ async def test_list_series_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_series_async( - transport: str = "grpc_asyncio", request_type=streams_service.ListSeriesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + streams_service.ListSeriesRequest(), + {}, + ], +) +async def test_list_series_async(request_type, transport: str = "grpc_asyncio"): client = StreamsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7438,7 +7477,7 @@ async def test_list_series_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_series), "__call__") as call: @@ -7463,11 +7502,6 @@ async def test_list_series_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_series_async_from_dict(): - await test_list_series_async(request_type=dict) - - def test_list_series_field_headers(): client = StreamsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7804,8 +7838,8 @@ async def test_list_series_async_pages(): @pytest.mark.parametrize( "request_type", [ - streams_service.GetSeriesRequest, - dict, + streams_service.GetSeriesRequest(), + {}, ], ) def test_get_series(request_type, transport: str = "grpc"): @@ -7816,7 +7850,7 @@ def test_get_series(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_series), "__call__") as call: @@ -7864,9 +7898,10 @@ def test_get_series_non_empty_request_with_auto_populated_field(): client.get_series(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == streams_service.GetSeriesRequest( + request_msg = streams_service.GetSeriesRequest( name="name_value", ) + assert args[0] == request_msg def test_get_series_use_cached_wrapped_rpc(): @@ -7945,9 +7980,14 @@ async def test_get_series_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_series_async( - transport: str = "grpc_asyncio", request_type=streams_service.GetSeriesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + streams_service.GetSeriesRequest(), + {}, + ], +) +async def test_get_series_async(request_type, transport: str = "grpc_asyncio"): client = StreamsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7955,7 +7995,7 @@ async def test_get_series_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_series), "__call__") as call: @@ -7982,11 +8022,6 @@ async def test_get_series_async( assert response.event == "event_value" -@pytest.mark.asyncio -async def test_get_series_async_from_dict(): - await test_get_series_async(request_type=dict) - - def test_get_series_field_headers(): client = StreamsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8133,8 +8168,8 @@ async def test_get_series_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - streams_service.CreateSeriesRequest, - dict, + streams_service.CreateSeriesRequest(), + {}, ], ) def test_create_series(request_type, transport: str = "grpc"): @@ -8145,7 +8180,7 @@ def test_create_series(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_series), "__call__") as call: @@ -8188,11 +8223,12 @@ def test_create_series_non_empty_request_with_auto_populated_field(): client.create_series(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == streams_service.CreateSeriesRequest( + request_msg = streams_service.CreateSeriesRequest( parent="parent_value", series_id="series_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_series_use_cached_wrapped_rpc(): @@ -8283,9 +8319,14 @@ async def test_create_series_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_series_async( - transport: str = "grpc_asyncio", request_type=streams_service.CreateSeriesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + streams_service.CreateSeriesRequest(), + {}, + ], +) +async def test_create_series_async(request_type, transport: str = "grpc_asyncio"): client = StreamsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8293,7 +8334,7 @@ async def test_create_series_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_series), "__call__") as call: @@ -8313,11 +8354,6 @@ async def test_create_series_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_series_async_from_dict(): - await test_create_series_async(request_type=dict) - - def test_create_series_field_headers(): client = StreamsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8484,8 +8520,8 @@ async def test_create_series_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - streams_service.UpdateSeriesRequest, - dict, + streams_service.UpdateSeriesRequest(), + {}, ], ) def test_update_series(request_type, transport: str = "grpc"): @@ -8496,7 +8532,7 @@ def test_update_series(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_series), "__call__") as call: @@ -8537,9 +8573,10 @@ def test_update_series_non_empty_request_with_auto_populated_field(): client.update_series(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == streams_service.UpdateSeriesRequest( + request_msg = streams_service.UpdateSeriesRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_series_use_cached_wrapped_rpc(): @@ -8630,9 +8667,14 @@ async def test_update_series_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_series_async( - transport: str = "grpc_asyncio", request_type=streams_service.UpdateSeriesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + streams_service.UpdateSeriesRequest(), + {}, + ], +) +async def test_update_series_async(request_type, transport: str = "grpc_asyncio"): client = StreamsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8640,7 +8682,7 @@ async def test_update_series_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_series), "__call__") as call: @@ -8660,11 +8702,6 @@ async def test_update_series_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_series_async_from_dict(): - await test_update_series_async(request_type=dict) - - def test_update_series_field_headers(): client = StreamsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8821,8 +8858,8 @@ async def test_update_series_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - streams_service.DeleteSeriesRequest, - dict, + streams_service.DeleteSeriesRequest(), + {}, ], ) def test_delete_series(request_type, transport: str = "grpc"): @@ -8833,7 +8870,7 @@ def test_delete_series(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_series), "__call__") as call: @@ -8875,10 +8912,11 @@ def test_delete_series_non_empty_request_with_auto_populated_field(): client.delete_series(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == streams_service.DeleteSeriesRequest( + request_msg = streams_service.DeleteSeriesRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_series_use_cached_wrapped_rpc(): @@ -8969,9 +9007,14 @@ async def test_delete_series_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_series_async( - transport: str = "grpc_asyncio", request_type=streams_service.DeleteSeriesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + streams_service.DeleteSeriesRequest(), + {}, + ], +) +async def test_delete_series_async(request_type, transport: str = "grpc_asyncio"): client = StreamsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8979,7 +9022,7 @@ async def test_delete_series_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_series), "__call__") as call: @@ -8999,11 +9042,6 @@ async def test_delete_series_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_series_async_from_dict(): - await test_delete_series_async(request_type=dict) - - def test_delete_series_field_headers(): client = StreamsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9150,8 +9188,8 @@ async def test_delete_series_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - streams_service.MaterializeChannelRequest, - dict, + streams_service.MaterializeChannelRequest(), + {}, ], ) def test_materialize_channel(request_type, transport: str = "grpc"): @@ -9162,7 +9200,7 @@ def test_materialize_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( @@ -9209,11 +9247,12 @@ def test_materialize_channel_non_empty_request_with_auto_populated_field(): client.materialize_channel(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == streams_service.MaterializeChannelRequest( + request_msg = streams_service.MaterializeChannelRequest( parent="parent_value", channel_id="channel_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_materialize_channel_use_cached_wrapped_rpc(): @@ -9308,10 +9347,14 @@ async def test_materialize_channel_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_materialize_channel_async( - transport: str = "grpc_asyncio", - request_type=streams_service.MaterializeChannelRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + streams_service.MaterializeChannelRequest(), + {}, + ], +) +async def test_materialize_channel_async(request_type, transport: str = "grpc_asyncio"): client = StreamsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9319,7 +9362,7 @@ async def test_materialize_channel_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( @@ -9341,11 +9384,6 @@ async def test_materialize_channel_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_materialize_channel_async_from_dict(): - await test_materialize_channel_async(request_type=dict) - - def test_materialize_channel_field_headers(): client = StreamsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14200,7 +14238,6 @@ def test_list_clusters_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.ListClustersRequest() - assert args[0] == request_msg @@ -14221,7 +14258,6 @@ def test_get_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.GetClusterRequest() - assert args[0] == request_msg @@ -14242,7 +14278,6 @@ def test_create_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.CreateClusterRequest() - assert args[0] == request_msg @@ -14263,7 +14298,6 @@ def test_update_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.UpdateClusterRequest() - assert args[0] == request_msg @@ -14284,7 +14318,6 @@ def test_delete_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.DeleteClusterRequest() - assert args[0] == request_msg @@ -14305,7 +14338,6 @@ def test_list_streams_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.ListStreamsRequest() - assert args[0] == request_msg @@ -14326,7 +14358,6 @@ def test_get_stream_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.GetStreamRequest() - assert args[0] == request_msg @@ -14347,7 +14378,6 @@ def test_create_stream_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.CreateStreamRequest() - assert args[0] == request_msg @@ -14368,7 +14398,6 @@ def test_update_stream_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.UpdateStreamRequest() - assert args[0] == request_msg @@ -14389,7 +14418,6 @@ def test_delete_stream_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.DeleteStreamRequest() - assert args[0] == request_msg @@ -14412,7 +14440,6 @@ def test_generate_stream_hls_token_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.GenerateStreamHlsTokenRequest() - assert args[0] == request_msg @@ -14433,7 +14460,6 @@ def test_list_events_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.ListEventsRequest() - assert args[0] == request_msg @@ -14454,7 +14480,6 @@ def test_get_event_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.GetEventRequest() - assert args[0] == request_msg @@ -14475,7 +14500,6 @@ def test_create_event_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.CreateEventRequest() - assert args[0] == request_msg @@ -14496,7 +14520,6 @@ def test_update_event_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.UpdateEventRequest() - assert args[0] == request_msg @@ -14517,7 +14540,6 @@ def test_delete_event_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.DeleteEventRequest() - assert args[0] == request_msg @@ -14538,7 +14560,6 @@ def test_list_series_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.ListSeriesRequest() - assert args[0] == request_msg @@ -14559,7 +14580,6 @@ def test_get_series_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.GetSeriesRequest() - assert args[0] == request_msg @@ -14580,7 +14600,6 @@ def test_create_series_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.CreateSeriesRequest() - assert args[0] == request_msg @@ -14601,7 +14620,6 @@ def test_update_series_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.UpdateSeriesRequest() - assert args[0] == request_msg @@ -14622,7 +14640,6 @@ def test_delete_series_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.DeleteSeriesRequest() - assert args[0] == request_msg @@ -14645,7 +14662,6 @@ def test_materialize_channel_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.MaterializeChannelRequest() - assert args[0] == request_msg @@ -14687,7 +14703,6 @@ async def test_list_clusters_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.ListClustersRequest() - assert args[0] == request_msg @@ -14717,7 +14732,6 @@ async def test_get_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.GetClusterRequest() - assert args[0] == request_msg @@ -14742,7 +14756,6 @@ async def test_create_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.CreateClusterRequest() - assert args[0] == request_msg @@ -14767,7 +14780,6 @@ async def test_update_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.UpdateClusterRequest() - assert args[0] == request_msg @@ -14792,7 +14804,6 @@ async def test_delete_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.DeleteClusterRequest() - assert args[0] == request_msg @@ -14820,7 +14831,6 @@ async def test_list_streams_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.ListStreamsRequest() - assert args[0] == request_msg @@ -14850,7 +14860,6 @@ async def test_get_stream_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.GetStreamRequest() - assert args[0] == request_msg @@ -14875,7 +14884,6 @@ async def test_create_stream_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.CreateStreamRequest() - assert args[0] == request_msg @@ -14900,7 +14908,6 @@ async def test_update_stream_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.UpdateStreamRequest() - assert args[0] == request_msg @@ -14925,7 +14932,6 @@ async def test_delete_stream_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.DeleteStreamRequest() - assert args[0] == request_msg @@ -14954,7 +14960,6 @@ async def test_generate_stream_hls_token_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.GenerateStreamHlsTokenRequest() - assert args[0] == request_msg @@ -14982,7 +14987,6 @@ async def test_list_events_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.ListEventsRequest() - assert args[0] == request_msg @@ -15010,7 +15014,6 @@ async def test_get_event_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.GetEventRequest() - assert args[0] == request_msg @@ -15035,7 +15038,6 @@ async def test_create_event_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.CreateEventRequest() - assert args[0] == request_msg @@ -15060,7 +15062,6 @@ async def test_update_event_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.UpdateEventRequest() - assert args[0] == request_msg @@ -15085,7 +15086,6 @@ async def test_delete_event_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.DeleteEventRequest() - assert args[0] == request_msg @@ -15113,7 +15113,6 @@ async def test_list_series_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.ListSeriesRequest() - assert args[0] == request_msg @@ -15142,7 +15141,6 @@ async def test_get_series_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.GetSeriesRequest() - assert args[0] == request_msg @@ -15167,7 +15165,6 @@ async def test_create_series_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.CreateSeriesRequest() - assert args[0] == request_msg @@ -15192,7 +15189,6 @@ async def test_update_series_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.UpdateSeriesRequest() - assert args[0] == request_msg @@ -15217,7 +15213,6 @@ async def test_delete_series_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.DeleteSeriesRequest() - assert args[0] == request_msg @@ -15244,7 +15239,6 @@ async def test_materialize_channel_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.MaterializeChannelRequest() - assert args[0] == request_msg @@ -19410,7 +19404,6 @@ def test_list_clusters_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.ListClustersRequest() - assert args[0] == request_msg @@ -19430,7 +19423,6 @@ def test_get_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.GetClusterRequest() - assert args[0] == request_msg @@ -19450,7 +19442,6 @@ def test_create_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.CreateClusterRequest() - assert args[0] == request_msg @@ -19470,7 +19461,6 @@ def test_update_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.UpdateClusterRequest() - assert args[0] == request_msg @@ -19490,7 +19480,6 @@ def test_delete_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.DeleteClusterRequest() - assert args[0] == request_msg @@ -19510,7 +19499,6 @@ def test_list_streams_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.ListStreamsRequest() - assert args[0] == request_msg @@ -19530,7 +19518,6 @@ def test_get_stream_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.GetStreamRequest() - assert args[0] == request_msg @@ -19550,7 +19537,6 @@ def test_create_stream_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.CreateStreamRequest() - assert args[0] == request_msg @@ -19570,7 +19556,6 @@ def test_update_stream_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.UpdateStreamRequest() - assert args[0] == request_msg @@ -19590,7 +19575,6 @@ def test_delete_stream_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.DeleteStreamRequest() - assert args[0] == request_msg @@ -19612,7 +19596,6 @@ def test_generate_stream_hls_token_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.GenerateStreamHlsTokenRequest() - assert args[0] == request_msg @@ -19632,7 +19615,6 @@ def test_list_events_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.ListEventsRequest() - assert args[0] == request_msg @@ -19652,7 +19634,6 @@ def test_get_event_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.GetEventRequest() - assert args[0] == request_msg @@ -19672,7 +19653,6 @@ def test_create_event_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.CreateEventRequest() - assert args[0] == request_msg @@ -19692,7 +19672,6 @@ def test_update_event_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.UpdateEventRequest() - assert args[0] == request_msg @@ -19712,7 +19691,6 @@ def test_delete_event_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.DeleteEventRequest() - assert args[0] == request_msg @@ -19732,7 +19710,6 @@ def test_list_series_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.ListSeriesRequest() - assert args[0] == request_msg @@ -19752,7 +19729,6 @@ def test_get_series_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.GetSeriesRequest() - assert args[0] == request_msg @@ -19772,7 +19748,6 @@ def test_create_series_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.CreateSeriesRequest() - assert args[0] == request_msg @@ -19792,7 +19767,6 @@ def test_update_series_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.UpdateSeriesRequest() - assert args[0] == request_msg @@ -19812,7 +19786,6 @@ def test_delete_series_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.DeleteSeriesRequest() - assert args[0] == request_msg @@ -19834,7 +19807,6 @@ def test_materialize_channel_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = streams_service.MaterializeChannelRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-visionai/tests/unit/gapic/visionai_v1alpha1/test_warehouse.py b/packages/google-cloud-visionai/tests/unit/gapic/visionai_v1alpha1/test_warehouse.py index 64edeb8c3e19..8a8ce0077cf7 100644 --- a/packages/google-cloud-visionai/tests/unit/gapic/visionai_v1alpha1/test_warehouse.py +++ b/packages/google-cloud-visionai/tests/unit/gapic/visionai_v1alpha1/test_warehouse.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 @@ -125,6 +126,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" @@ -1282,8 +1298,8 @@ def test_warehouse_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - warehouse.CreateAssetRequest, - dict, + warehouse.CreateAssetRequest(), + {}, ], ) def test_create_asset(request_type, transport: str = "grpc"): @@ -1294,7 +1310,7 @@ def test_create_asset(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_asset), "__call__") as call: @@ -1339,10 +1355,11 @@ def test_create_asset_non_empty_request_with_auto_populated_field(): client.create_asset(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.CreateAssetRequest( + request_msg = warehouse.CreateAssetRequest( parent="parent_value", asset_id="asset_id_value", ) + assert args[0] == request_msg def test_create_asset_use_cached_wrapped_rpc(): @@ -1423,9 +1440,14 @@ async def test_create_asset_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_asset_async( - transport: str = "grpc_asyncio", request_type=warehouse.CreateAssetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + warehouse.CreateAssetRequest(), + {}, + ], +) +async def test_create_asset_async(request_type, transport: str = "grpc_asyncio"): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1433,7 +1455,7 @@ async def test_create_asset_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_asset), "__call__") as call: @@ -1456,11 +1478,6 @@ async def test_create_asset_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_create_asset_async_from_dict(): - await test_create_asset_async(request_type=dict) - - def test_create_asset_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1623,8 +1640,8 @@ async def test_create_asset_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - warehouse.UpdateAssetRequest, - dict, + warehouse.UpdateAssetRequest(), + {}, ], ) def test_update_asset(request_type, transport: str = "grpc"): @@ -1635,7 +1652,7 @@ def test_update_asset(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_asset), "__call__") as call: @@ -1677,7 +1694,8 @@ def test_update_asset_non_empty_request_with_auto_populated_field(): client.update_asset(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.UpdateAssetRequest() + request_msg = warehouse.UpdateAssetRequest() + assert args[0] == request_msg def test_update_asset_use_cached_wrapped_rpc(): @@ -1758,9 +1776,14 @@ async def test_update_asset_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_asset_async( - transport: str = "grpc_asyncio", request_type=warehouse.UpdateAssetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + warehouse.UpdateAssetRequest(), + {}, + ], +) +async def test_update_asset_async(request_type, transport: str = "grpc_asyncio"): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1768,7 +1791,7 @@ async def test_update_asset_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_asset), "__call__") as call: @@ -1791,11 +1814,6 @@ async def test_update_asset_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_update_asset_async_from_dict(): - await test_update_asset_async(request_type=dict) - - def test_update_asset_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1948,8 +1966,8 @@ async def test_update_asset_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - warehouse.GetAssetRequest, - dict, + warehouse.GetAssetRequest(), + {}, ], ) def test_get_asset(request_type, transport: str = "grpc"): @@ -1960,7 +1978,7 @@ def test_get_asset(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_asset), "__call__") as call: @@ -2004,9 +2022,10 @@ def test_get_asset_non_empty_request_with_auto_populated_field(): client.get_asset(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.GetAssetRequest( + request_msg = warehouse.GetAssetRequest( name="name_value", ) + assert args[0] == request_msg def test_get_asset_use_cached_wrapped_rpc(): @@ -2085,9 +2104,14 @@ async def test_get_asset_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_asset_async( - transport: str = "grpc_asyncio", request_type=warehouse.GetAssetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + warehouse.GetAssetRequest(), + {}, + ], +) +async def test_get_asset_async(request_type, transport: str = "grpc_asyncio"): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2095,7 +2119,7 @@ async def test_get_asset_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_asset), "__call__") as call: @@ -2118,11 +2142,6 @@ async def test_get_asset_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_asset_async_from_dict(): - await test_get_asset_async(request_type=dict) - - def test_get_asset_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2265,8 +2284,8 @@ async def test_get_asset_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - warehouse.ListAssetsRequest, - dict, + warehouse.ListAssetsRequest(), + {}, ], ) def test_list_assets(request_type, transport: str = "grpc"): @@ -2277,7 +2296,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(type(client.transport.list_assets), "__call__") as call: @@ -2322,10 +2341,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] == warehouse.ListAssetsRequest( + request_msg = warehouse.ListAssetsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_assets_use_cached_wrapped_rpc(): @@ -2406,9 +2426,14 @@ async def test_list_assets_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_assets_async( - transport: str = "grpc_asyncio", request_type=warehouse.ListAssetsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + warehouse.ListAssetsRequest(), + {}, + ], +) +async def test_list_assets_async(request_type, transport: str = "grpc_asyncio"): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2416,7 +2441,7 @@ async def test_list_assets_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_assets), "__call__") as call: @@ -2439,11 +2464,6 @@ async def test_list_assets_async( 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 = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2780,8 +2800,8 @@ async def test_list_assets_async_pages(): @pytest.mark.parametrize( "request_type", [ - warehouse.DeleteAssetRequest, - dict, + warehouse.DeleteAssetRequest(), + {}, ], ) def test_delete_asset(request_type, transport: str = "grpc"): @@ -2792,7 +2812,7 @@ def test_delete_asset(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_asset), "__call__") as call: @@ -2833,9 +2853,10 @@ def test_delete_asset_non_empty_request_with_auto_populated_field(): client.delete_asset(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.DeleteAssetRequest( + request_msg = warehouse.DeleteAssetRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_asset_use_cached_wrapped_rpc(): @@ -2926,9 +2947,14 @@ async def test_delete_asset_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_asset_async( - transport: str = "grpc_asyncio", request_type=warehouse.DeleteAssetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + warehouse.DeleteAssetRequest(), + {}, + ], +) +async def test_delete_asset_async(request_type, transport: str = "grpc_asyncio"): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2936,7 +2962,7 @@ async def test_delete_asset_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_asset), "__call__") as call: @@ -2956,11 +2982,6 @@ async def test_delete_asset_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_asset_async_from_dict(): - await test_delete_asset_async(request_type=dict) - - def test_delete_asset_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3107,8 +3128,8 @@ async def test_delete_asset_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - warehouse.CreateCorpusRequest, - dict, + warehouse.CreateCorpusRequest(), + {}, ], ) def test_create_corpus(request_type, transport: str = "grpc"): @@ -3119,7 +3140,7 @@ def test_create_corpus(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_corpus), "__call__") as call: @@ -3160,9 +3181,10 @@ def test_create_corpus_non_empty_request_with_auto_populated_field(): client.create_corpus(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.CreateCorpusRequest( + request_msg = warehouse.CreateCorpusRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_corpus_use_cached_wrapped_rpc(): @@ -3253,9 +3275,14 @@ async def test_create_corpus_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_corpus_async( - transport: str = "grpc_asyncio", request_type=warehouse.CreateCorpusRequest -): +@pytest.mark.parametrize( + "request_type", + [ + warehouse.CreateCorpusRequest(), + {}, + ], +) +async def test_create_corpus_async(request_type, transport: str = "grpc_asyncio"): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3263,7 +3290,7 @@ async def test_create_corpus_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_corpus), "__call__") as call: @@ -3283,11 +3310,6 @@ async def test_create_corpus_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_corpus_async_from_dict(): - await test_create_corpus_async(request_type=dict) - - def test_create_corpus_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3444,8 +3466,8 @@ async def test_create_corpus_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - warehouse.GetCorpusRequest, - dict, + warehouse.GetCorpusRequest(), + {}, ], ) def test_get_corpus(request_type, transport: str = "grpc"): @@ -3456,7 +3478,7 @@ def test_get_corpus(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_corpus), "__call__") as call: @@ -3504,9 +3526,10 @@ def test_get_corpus_non_empty_request_with_auto_populated_field(): client.get_corpus(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.GetCorpusRequest( + request_msg = warehouse.GetCorpusRequest( name="name_value", ) + assert args[0] == request_msg def test_get_corpus_use_cached_wrapped_rpc(): @@ -3585,9 +3608,14 @@ async def test_get_corpus_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_corpus_async( - transport: str = "grpc_asyncio", request_type=warehouse.GetCorpusRequest -): +@pytest.mark.parametrize( + "request_type", + [ + warehouse.GetCorpusRequest(), + {}, + ], +) +async def test_get_corpus_async(request_type, transport: str = "grpc_asyncio"): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3595,7 +3623,7 @@ async def test_get_corpus_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_corpus), "__call__") as call: @@ -3622,11 +3650,6 @@ async def test_get_corpus_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_get_corpus_async_from_dict(): - await test_get_corpus_async(request_type=dict) - - def test_get_corpus_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3769,8 +3792,8 @@ async def test_get_corpus_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - warehouse.UpdateCorpusRequest, - dict, + warehouse.UpdateCorpusRequest(), + {}, ], ) def test_update_corpus(request_type, transport: str = "grpc"): @@ -3781,7 +3804,7 @@ def test_update_corpus(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_corpus), "__call__") as call: @@ -3827,7 +3850,8 @@ def test_update_corpus_non_empty_request_with_auto_populated_field(): client.update_corpus(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.UpdateCorpusRequest() + request_msg = warehouse.UpdateCorpusRequest() + assert args[0] == request_msg def test_update_corpus_use_cached_wrapped_rpc(): @@ -3908,9 +3932,14 @@ async def test_update_corpus_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_corpus_async( - transport: str = "grpc_asyncio", request_type=warehouse.UpdateCorpusRequest -): +@pytest.mark.parametrize( + "request_type", + [ + warehouse.UpdateCorpusRequest(), + {}, + ], +) +async def test_update_corpus_async(request_type, transport: str = "grpc_asyncio"): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3918,7 +3947,7 @@ async def test_update_corpus_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_corpus), "__call__") as call: @@ -3945,11 +3974,6 @@ async def test_update_corpus_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_update_corpus_async_from_dict(): - await test_update_corpus_async(request_type=dict) - - def test_update_corpus_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4102,8 +4126,8 @@ async def test_update_corpus_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - warehouse.ListCorporaRequest, - dict, + warehouse.ListCorporaRequest(), + {}, ], ) def test_list_corpora(request_type, transport: str = "grpc"): @@ -4114,7 +4138,7 @@ def test_list_corpora(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_corpora), "__call__") as call: @@ -4159,10 +4183,11 @@ def test_list_corpora_non_empty_request_with_auto_populated_field(): client.list_corpora(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.ListCorporaRequest( + request_msg = warehouse.ListCorporaRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_corpora_use_cached_wrapped_rpc(): @@ -4243,9 +4268,14 @@ async def test_list_corpora_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_corpora_async( - transport: str = "grpc_asyncio", request_type=warehouse.ListCorporaRequest -): +@pytest.mark.parametrize( + "request_type", + [ + warehouse.ListCorporaRequest(), + {}, + ], +) +async def test_list_corpora_async(request_type, transport: str = "grpc_asyncio"): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4253,7 +4283,7 @@ async def test_list_corpora_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_corpora), "__call__") as call: @@ -4276,11 +4306,6 @@ async def test_list_corpora_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_corpora_async_from_dict(): - await test_list_corpora_async(request_type=dict) - - def test_list_corpora_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4617,8 +4642,8 @@ async def test_list_corpora_async_pages(): @pytest.mark.parametrize( "request_type", [ - warehouse.DeleteCorpusRequest, - dict, + warehouse.DeleteCorpusRequest(), + {}, ], ) def test_delete_corpus(request_type, transport: str = "grpc"): @@ -4629,7 +4654,7 @@ def test_delete_corpus(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_corpus), "__call__") as call: @@ -4670,9 +4695,10 @@ def test_delete_corpus_non_empty_request_with_auto_populated_field(): client.delete_corpus(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.DeleteCorpusRequest( + request_msg = warehouse.DeleteCorpusRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_corpus_use_cached_wrapped_rpc(): @@ -4753,9 +4779,14 @@ async def test_delete_corpus_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_corpus_async( - transport: str = "grpc_asyncio", request_type=warehouse.DeleteCorpusRequest -): +@pytest.mark.parametrize( + "request_type", + [ + warehouse.DeleteCorpusRequest(), + {}, + ], +) +async def test_delete_corpus_async(request_type, transport: str = "grpc_asyncio"): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4763,7 +4794,7 @@ async def test_delete_corpus_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_corpus), "__call__") as call: @@ -4781,11 +4812,6 @@ async def test_delete_corpus_async( assert response is None -@pytest.mark.asyncio -async def test_delete_corpus_async_from_dict(): - await test_delete_corpus_async(request_type=dict) - - def test_delete_corpus_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4928,8 +4954,8 @@ async def test_delete_corpus_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - warehouse.CreateDataSchemaRequest, - dict, + warehouse.CreateDataSchemaRequest(), + {}, ], ) def test_create_data_schema(request_type, transport: str = "grpc"): @@ -4940,7 +4966,7 @@ def test_create_data_schema(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4990,9 +5016,10 @@ def test_create_data_schema_non_empty_request_with_auto_populated_field(): client.create_data_schema(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.CreateDataSchemaRequest( + request_msg = warehouse.CreateDataSchemaRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_data_schema_use_cached_wrapped_rpc(): @@ -5077,9 +5104,14 @@ async def test_create_data_schema_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_data_schema_async( - transport: str = "grpc_asyncio", request_type=warehouse.CreateDataSchemaRequest -): +@pytest.mark.parametrize( + "request_type", + [ + warehouse.CreateDataSchemaRequest(), + {}, + ], +) +async def test_create_data_schema_async(request_type, transport: str = "grpc_asyncio"): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5087,7 +5119,7 @@ async def test_create_data_schema_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( @@ -5114,11 +5146,6 @@ async def test_create_data_schema_async( assert response.key == "key_value" -@pytest.mark.asyncio -async def test_create_data_schema_async_from_dict(): - await test_create_data_schema_async(request_type=dict) - - def test_create_data_schema_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5283,8 +5310,8 @@ async def test_create_data_schema_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - warehouse.UpdateDataSchemaRequest, - dict, + warehouse.UpdateDataSchemaRequest(), + {}, ], ) def test_update_data_schema(request_type, transport: str = "grpc"): @@ -5295,7 +5322,7 @@ def test_update_data_schema(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5343,7 +5370,8 @@ def test_update_data_schema_non_empty_request_with_auto_populated_field(): client.update_data_schema(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.UpdateDataSchemaRequest() + request_msg = warehouse.UpdateDataSchemaRequest() + assert args[0] == request_msg def test_update_data_schema_use_cached_wrapped_rpc(): @@ -5428,9 +5456,14 @@ async def test_update_data_schema_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_data_schema_async( - transport: str = "grpc_asyncio", request_type=warehouse.UpdateDataSchemaRequest -): +@pytest.mark.parametrize( + "request_type", + [ + warehouse.UpdateDataSchemaRequest(), + {}, + ], +) +async def test_update_data_schema_async(request_type, transport: str = "grpc_asyncio"): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5438,7 +5471,7 @@ async def test_update_data_schema_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( @@ -5465,11 +5498,6 @@ async def test_update_data_schema_async( assert response.key == "key_value" -@pytest.mark.asyncio -async def test_update_data_schema_async_from_dict(): - await test_update_data_schema_async(request_type=dict) - - def test_update_data_schema_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5634,8 +5662,8 @@ async def test_update_data_schema_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - warehouse.GetDataSchemaRequest, - dict, + warehouse.GetDataSchemaRequest(), + {}, ], ) def test_get_data_schema(request_type, transport: str = "grpc"): @@ -5646,7 +5674,7 @@ def test_get_data_schema(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_data_schema), "__call__") as call: @@ -5692,9 +5720,10 @@ def test_get_data_schema_non_empty_request_with_auto_populated_field(): client.get_data_schema(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.GetDataSchemaRequest( + request_msg = warehouse.GetDataSchemaRequest( name="name_value", ) + assert args[0] == request_msg def test_get_data_schema_use_cached_wrapped_rpc(): @@ -5775,9 +5804,14 @@ async def test_get_data_schema_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_data_schema_async( - transport: str = "grpc_asyncio", request_type=warehouse.GetDataSchemaRequest -): +@pytest.mark.parametrize( + "request_type", + [ + warehouse.GetDataSchemaRequest(), + {}, + ], +) +async def test_get_data_schema_async(request_type, transport: str = "grpc_asyncio"): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5785,7 +5819,7 @@ async def test_get_data_schema_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_data_schema), "__call__") as call: @@ -5810,11 +5844,6 @@ async def test_get_data_schema_async( assert response.key == "key_value" -@pytest.mark.asyncio -async def test_get_data_schema_async_from_dict(): - await test_get_data_schema_async(request_type=dict) - - def test_get_data_schema_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5961,8 +5990,8 @@ async def test_get_data_schema_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - warehouse.DeleteDataSchemaRequest, - dict, + warehouse.DeleteDataSchemaRequest(), + {}, ], ) def test_delete_data_schema(request_type, transport: str = "grpc"): @@ -5973,7 +6002,7 @@ def test_delete_data_schema(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6018,9 +6047,10 @@ def test_delete_data_schema_non_empty_request_with_auto_populated_field(): client.delete_data_schema(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.DeleteDataSchemaRequest( + request_msg = warehouse.DeleteDataSchemaRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_data_schema_use_cached_wrapped_rpc(): @@ -6105,9 +6135,14 @@ async def test_delete_data_schema_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_data_schema_async( - transport: str = "grpc_asyncio", request_type=warehouse.DeleteDataSchemaRequest -): +@pytest.mark.parametrize( + "request_type", + [ + warehouse.DeleteDataSchemaRequest(), + {}, + ], +) +async def test_delete_data_schema_async(request_type, transport: str = "grpc_asyncio"): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6115,7 +6150,7 @@ async def test_delete_data_schema_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( @@ -6135,11 +6170,6 @@ async def test_delete_data_schema_async( assert response is None -@pytest.mark.asyncio -async def test_delete_data_schema_async_from_dict(): - await test_delete_data_schema_async(request_type=dict) - - def test_delete_data_schema_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6290,8 +6320,8 @@ async def test_delete_data_schema_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - warehouse.ListDataSchemasRequest, - dict, + warehouse.ListDataSchemasRequest(), + {}, ], ) def test_list_data_schemas(request_type, transport: str = "grpc"): @@ -6302,7 +6332,7 @@ def test_list_data_schemas(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6351,10 +6381,11 @@ def test_list_data_schemas_non_empty_request_with_auto_populated_field(): client.list_data_schemas(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.ListDataSchemasRequest( + request_msg = warehouse.ListDataSchemasRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_data_schemas_use_cached_wrapped_rpc(): @@ -6437,9 +6468,14 @@ async def test_list_data_schemas_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_data_schemas_async( - transport: str = "grpc_asyncio", request_type=warehouse.ListDataSchemasRequest -): +@pytest.mark.parametrize( + "request_type", + [ + warehouse.ListDataSchemasRequest(), + {}, + ], +) +async def test_list_data_schemas_async(request_type, transport: str = "grpc_asyncio"): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6447,7 +6483,7 @@ async def test_list_data_schemas_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( @@ -6472,11 +6508,6 @@ async def test_list_data_schemas_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_data_schemas_async_from_dict(): - await test_list_data_schemas_async(request_type=dict) - - def test_list_data_schemas_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6829,8 +6860,8 @@ async def test_list_data_schemas_async_pages(): @pytest.mark.parametrize( "request_type", [ - warehouse.CreateAnnotationRequest, - dict, + warehouse.CreateAnnotationRequest(), + {}, ], ) def test_create_annotation(request_type, transport: str = "grpc"): @@ -6841,7 +6872,7 @@ def test_create_annotation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6890,10 +6921,11 @@ def test_create_annotation_non_empty_request_with_auto_populated_field(): client.create_annotation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.CreateAnnotationRequest( + request_msg = warehouse.CreateAnnotationRequest( parent="parent_value", annotation_id="annotation_id_value", ) + assert args[0] == request_msg def test_create_annotation_use_cached_wrapped_rpc(): @@ -6976,9 +7008,14 @@ async def test_create_annotation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_annotation_async( - transport: str = "grpc_asyncio", request_type=warehouse.CreateAnnotationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + warehouse.CreateAnnotationRequest(), + {}, + ], +) +async def test_create_annotation_async(request_type, transport: str = "grpc_asyncio"): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6986,7 +7023,7 @@ async def test_create_annotation_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( @@ -7011,11 +7048,6 @@ async def test_create_annotation_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_create_annotation_async_from_dict(): - await test_create_annotation_async(request_type=dict) - - def test_create_annotation_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7190,8 +7222,8 @@ async def test_create_annotation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - warehouse.GetAnnotationRequest, - dict, + warehouse.GetAnnotationRequest(), + {}, ], ) def test_get_annotation(request_type, transport: str = "grpc"): @@ -7202,7 +7234,7 @@ def test_get_annotation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_annotation), "__call__") as call: @@ -7246,9 +7278,10 @@ def test_get_annotation_non_empty_request_with_auto_populated_field(): client.get_annotation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.GetAnnotationRequest( + request_msg = warehouse.GetAnnotationRequest( name="name_value", ) + assert args[0] == request_msg def test_get_annotation_use_cached_wrapped_rpc(): @@ -7329,9 +7362,14 @@ async def test_get_annotation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_annotation_async( - transport: str = "grpc_asyncio", request_type=warehouse.GetAnnotationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + warehouse.GetAnnotationRequest(), + {}, + ], +) +async def test_get_annotation_async(request_type, transport: str = "grpc_asyncio"): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7339,7 +7377,7 @@ async def test_get_annotation_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_annotation), "__call__") as call: @@ -7362,11 +7400,6 @@ async def test_get_annotation_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_annotation_async_from_dict(): - await test_get_annotation_async(request_type=dict) - - def test_get_annotation_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7513,8 +7546,8 @@ async def test_get_annotation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - warehouse.ListAnnotationsRequest, - dict, + warehouse.ListAnnotationsRequest(), + {}, ], ) def test_list_annotations(request_type, transport: str = "grpc"): @@ -7525,7 +7558,7 @@ def test_list_annotations(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_annotations), "__call__") as call: @@ -7571,11 +7604,12 @@ def test_list_annotations_non_empty_request_with_auto_populated_field(): client.list_annotations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.ListAnnotationsRequest( + request_msg = warehouse.ListAnnotationsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_annotations_use_cached_wrapped_rpc(): @@ -7658,9 +7692,14 @@ async def test_list_annotations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_annotations_async( - transport: str = "grpc_asyncio", request_type=warehouse.ListAnnotationsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + warehouse.ListAnnotationsRequest(), + {}, + ], +) +async def test_list_annotations_async(request_type, transport: str = "grpc_asyncio"): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7668,7 +7707,7 @@ async def test_list_annotations_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_annotations), "__call__") as call: @@ -7691,11 +7730,6 @@ async def test_list_annotations_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_annotations_async_from_dict(): - await test_list_annotations_async(request_type=dict) - - def test_list_annotations_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8032,8 +8066,8 @@ async def test_list_annotations_async_pages(): @pytest.mark.parametrize( "request_type", [ - warehouse.UpdateAnnotationRequest, - dict, + warehouse.UpdateAnnotationRequest(), + {}, ], ) def test_update_annotation(request_type, transport: str = "grpc"): @@ -8044,7 +8078,7 @@ def test_update_annotation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8090,7 +8124,8 @@ def test_update_annotation_non_empty_request_with_auto_populated_field(): client.update_annotation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.UpdateAnnotationRequest() + request_msg = warehouse.UpdateAnnotationRequest() + assert args[0] == request_msg def test_update_annotation_use_cached_wrapped_rpc(): @@ -8173,9 +8208,14 @@ async def test_update_annotation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_annotation_async( - transport: str = "grpc_asyncio", request_type=warehouse.UpdateAnnotationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + warehouse.UpdateAnnotationRequest(), + {}, + ], +) +async def test_update_annotation_async(request_type, transport: str = "grpc_asyncio"): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8183,7 +8223,7 @@ async def test_update_annotation_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( @@ -8208,11 +8248,6 @@ async def test_update_annotation_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_update_annotation_async_from_dict(): - await test_update_annotation_async(request_type=dict) - - def test_update_annotation_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8377,8 +8412,8 @@ async def test_update_annotation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - warehouse.DeleteAnnotationRequest, - dict, + warehouse.DeleteAnnotationRequest(), + {}, ], ) def test_delete_annotation(request_type, transport: str = "grpc"): @@ -8389,7 +8424,7 @@ def test_delete_annotation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8434,9 +8469,10 @@ def test_delete_annotation_non_empty_request_with_auto_populated_field(): client.delete_annotation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.DeleteAnnotationRequest( + request_msg = warehouse.DeleteAnnotationRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_annotation_use_cached_wrapped_rpc(): @@ -8519,9 +8555,14 @@ async def test_delete_annotation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_annotation_async( - transport: str = "grpc_asyncio", request_type=warehouse.DeleteAnnotationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + warehouse.DeleteAnnotationRequest(), + {}, + ], +) +async def test_delete_annotation_async(request_type, transport: str = "grpc_asyncio"): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8529,7 +8570,7 @@ async def test_delete_annotation_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( @@ -8549,11 +8590,6 @@ async def test_delete_annotation_async( assert response is None -@pytest.mark.asyncio -async def test_delete_annotation_async_from_dict(): - await test_delete_annotation_async(request_type=dict) - - def test_delete_annotation_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8704,8 +8740,8 @@ async def test_delete_annotation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - warehouse.IngestAssetRequest, - dict, + warehouse.IngestAssetRequest(), + {}, ], ) def test_ingest_asset(request_type, transport: str = "grpc"): @@ -8716,7 +8752,7 @@ def test_ingest_asset(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as 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. @@ -8813,9 +8849,14 @@ async def test_ingest_asset_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_ingest_asset_async( - transport: str = "grpc_asyncio", request_type=warehouse.IngestAssetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + warehouse.IngestAssetRequest(), + {}, + ], +) +async def test_ingest_asset_async(request_type, transport: str = "grpc_asyncio"): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8823,7 +8864,7 @@ async def test_ingest_asset_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. @@ -8845,16 +8886,11 @@ async def test_ingest_asset_async( assert isinstance(message, warehouse.IngestAssetResponse) -@pytest.mark.asyncio -async def test_ingest_asset_async_from_dict(): - await test_ingest_asset_async(request_type=dict) - - @pytest.mark.parametrize( "request_type", [ - warehouse.ClipAssetRequest, - dict, + warehouse.ClipAssetRequest(), + {}, ], ) def test_clip_asset(request_type, transport: str = "grpc"): @@ -8865,7 +8901,7 @@ def test_clip_asset(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.clip_asset), "__call__") as call: @@ -8906,9 +8942,10 @@ def test_clip_asset_non_empty_request_with_auto_populated_field(): client.clip_asset(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.ClipAssetRequest( + request_msg = warehouse.ClipAssetRequest( name="name_value", ) + assert args[0] == request_msg def test_clip_asset_use_cached_wrapped_rpc(): @@ -8987,9 +9024,14 @@ async def test_clip_asset_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_clip_asset_async( - transport: str = "grpc_asyncio", request_type=warehouse.ClipAssetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + warehouse.ClipAssetRequest(), + {}, + ], +) +async def test_clip_asset_async(request_type, transport: str = "grpc_asyncio"): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8997,7 +9039,7 @@ async def test_clip_asset_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.clip_asset), "__call__") as call: @@ -9017,11 +9059,6 @@ async def test_clip_asset_async( assert isinstance(response, warehouse.ClipAssetResponse) -@pytest.mark.asyncio -async def test_clip_asset_async_from_dict(): - await test_clip_asset_async(request_type=dict) - - def test_clip_asset_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9086,8 +9123,8 @@ async def test_clip_asset_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - warehouse.GenerateHlsUriRequest, - dict, + warehouse.GenerateHlsUriRequest(), + {}, ], ) def test_generate_hls_uri(request_type, transport: str = "grpc"): @@ -9098,7 +9135,7 @@ def test_generate_hls_uri(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.generate_hls_uri), "__call__") as call: @@ -9142,9 +9179,10 @@ def test_generate_hls_uri_non_empty_request_with_auto_populated_field(): client.generate_hls_uri(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.GenerateHlsUriRequest( + request_msg = warehouse.GenerateHlsUriRequest( name="name_value", ) + assert args[0] == request_msg def test_generate_hls_uri_use_cached_wrapped_rpc(): @@ -9227,9 +9265,14 @@ async def test_generate_hls_uri_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_generate_hls_uri_async( - transport: str = "grpc_asyncio", request_type=warehouse.GenerateHlsUriRequest -): +@pytest.mark.parametrize( + "request_type", + [ + warehouse.GenerateHlsUriRequest(), + {}, + ], +) +async def test_generate_hls_uri_async(request_type, transport: str = "grpc_asyncio"): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9237,7 +9280,7 @@ async def test_generate_hls_uri_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.generate_hls_uri), "__call__") as call: @@ -9260,11 +9303,6 @@ async def test_generate_hls_uri_async( assert response.uri == "uri_value" -@pytest.mark.asyncio -async def test_generate_hls_uri_async_from_dict(): - await test_generate_hls_uri_async(request_type=dict) - - def test_generate_hls_uri_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9329,8 +9367,8 @@ async def test_generate_hls_uri_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - warehouse.CreateSearchConfigRequest, - dict, + warehouse.CreateSearchConfigRequest(), + {}, ], ) def test_create_search_config(request_type, transport: str = "grpc"): @@ -9341,7 +9379,7 @@ def test_create_search_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( @@ -9390,10 +9428,11 @@ def test_create_search_config_non_empty_request_with_auto_populated_field(): client.create_search_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.CreateSearchConfigRequest( + request_msg = warehouse.CreateSearchConfigRequest( parent="parent_value", search_config_id="search_config_id_value", ) + assert args[0] == request_msg def test_create_search_config_use_cached_wrapped_rpc(): @@ -9478,8 +9517,15 @@ async def test_create_search_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + warehouse.CreateSearchConfigRequest(), + {}, + ], +) async def test_create_search_config_async( - transport: str = "grpc_asyncio", request_type=warehouse.CreateSearchConfigRequest + request_type, transport: str = "grpc_asyncio" ): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), @@ -9488,7 +9534,7 @@ async def test_create_search_config_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( @@ -9513,11 +9559,6 @@ async def test_create_search_config_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_create_search_config_async_from_dict(): - await test_create_search_config_async(request_type=dict) - - def test_create_search_config_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9692,8 +9733,8 @@ async def test_create_search_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - warehouse.UpdateSearchConfigRequest, - dict, + warehouse.UpdateSearchConfigRequest(), + {}, ], ) def test_update_search_config(request_type, transport: str = "grpc"): @@ -9704,7 +9745,7 @@ def test_update_search_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( @@ -9750,7 +9791,8 @@ def test_update_search_config_non_empty_request_with_auto_populated_field(): client.update_search_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.UpdateSearchConfigRequest() + request_msg = warehouse.UpdateSearchConfigRequest() + assert args[0] == request_msg def test_update_search_config_use_cached_wrapped_rpc(): @@ -9835,8 +9877,15 @@ async def test_update_search_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + warehouse.UpdateSearchConfigRequest(), + {}, + ], +) async def test_update_search_config_async( - transport: str = "grpc_asyncio", request_type=warehouse.UpdateSearchConfigRequest + request_type, transport: str = "grpc_asyncio" ): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), @@ -9845,7 +9894,7 @@ async def test_update_search_config_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( @@ -9870,11 +9919,6 @@ async def test_update_search_config_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_update_search_config_async_from_dict(): - await test_update_search_config_async(request_type=dict) - - def test_update_search_config_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10039,8 +10083,8 @@ async def test_update_search_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - warehouse.GetSearchConfigRequest, - dict, + warehouse.GetSearchConfigRequest(), + {}, ], ) def test_get_search_config(request_type, transport: str = "grpc"): @@ -10051,7 +10095,7 @@ def test_get_search_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( @@ -10099,9 +10143,10 @@ def test_get_search_config_non_empty_request_with_auto_populated_field(): client.get_search_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.GetSearchConfigRequest( + request_msg = warehouse.GetSearchConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_search_config_use_cached_wrapped_rpc(): @@ -10184,9 +10229,14 @@ async def test_get_search_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_search_config_async( - transport: str = "grpc_asyncio", request_type=warehouse.GetSearchConfigRequest -): +@pytest.mark.parametrize( + "request_type", + [ + warehouse.GetSearchConfigRequest(), + {}, + ], +) +async def test_get_search_config_async(request_type, transport: str = "grpc_asyncio"): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10194,7 +10244,7 @@ async def test_get_search_config_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( @@ -10219,11 +10269,6 @@ async def test_get_search_config_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_search_config_async_from_dict(): - await test_get_search_config_async(request_type=dict) - - def test_get_search_config_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10378,8 +10423,8 @@ async def test_get_search_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - warehouse.DeleteSearchConfigRequest, - dict, + warehouse.DeleteSearchConfigRequest(), + {}, ], ) def test_delete_search_config(request_type, transport: str = "grpc"): @@ -10390,7 +10435,7 @@ def test_delete_search_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( @@ -10435,9 +10480,10 @@ def test_delete_search_config_non_empty_request_with_auto_populated_field(): client.delete_search_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.DeleteSearchConfigRequest( + request_msg = warehouse.DeleteSearchConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_search_config_use_cached_wrapped_rpc(): @@ -10522,8 +10568,15 @@ async def test_delete_search_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + warehouse.DeleteSearchConfigRequest(), + {}, + ], +) async def test_delete_search_config_async( - transport: str = "grpc_asyncio", request_type=warehouse.DeleteSearchConfigRequest + request_type, transport: str = "grpc_asyncio" ): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), @@ -10532,7 +10585,7 @@ async def test_delete_search_config_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( @@ -10552,11 +10605,6 @@ async def test_delete_search_config_async( assert response is None -@pytest.mark.asyncio -async def test_delete_search_config_async_from_dict(): - await test_delete_search_config_async(request_type=dict) - - def test_delete_search_config_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10707,8 +10755,8 @@ async def test_delete_search_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - warehouse.ListSearchConfigsRequest, - dict, + warehouse.ListSearchConfigsRequest(), + {}, ], ) def test_list_search_configs(request_type, transport: str = "grpc"): @@ -10719,7 +10767,7 @@ def test_list_search_configs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10768,10 +10816,11 @@ def test_list_search_configs_non_empty_request_with_auto_populated_field(): client.list_search_configs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.ListSearchConfigsRequest( + request_msg = warehouse.ListSearchConfigsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_search_configs_use_cached_wrapped_rpc(): @@ -10856,9 +10905,14 @@ async def test_list_search_configs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_search_configs_async( - transport: str = "grpc_asyncio", request_type=warehouse.ListSearchConfigsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + warehouse.ListSearchConfigsRequest(), + {}, + ], +) +async def test_list_search_configs_async(request_type, transport: str = "grpc_asyncio"): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10866,7 +10920,7 @@ async def test_list_search_configs_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( @@ -10891,11 +10945,6 @@ async def test_list_search_configs_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_search_configs_async_from_dict(): - await test_list_search_configs_async(request_type=dict) - - def test_list_search_configs_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11248,8 +11297,8 @@ async def test_list_search_configs_async_pages(): @pytest.mark.parametrize( "request_type", [ - warehouse.SearchAssetsRequest, - dict, + warehouse.SearchAssetsRequest(), + {}, ], ) def test_search_assets(request_type, transport: str = "grpc"): @@ -11260,7 +11309,7 @@ def test_search_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(type(client.transport.search_assets), "__call__") as call: @@ -11305,10 +11354,11 @@ def test_search_assets_non_empty_request_with_auto_populated_field(): client.search_assets(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == warehouse.SearchAssetsRequest( + request_msg = warehouse.SearchAssetsRequest( corpus="corpus_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_search_assets_use_cached_wrapped_rpc(): @@ -11389,9 +11439,14 @@ async def test_search_assets_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_search_assets_async( - transport: str = "grpc_asyncio", request_type=warehouse.SearchAssetsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + warehouse.SearchAssetsRequest(), + {}, + ], +) +async def test_search_assets_async(request_type, transport: str = "grpc_asyncio"): client = WarehouseAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11399,7 +11454,7 @@ async def test_search_assets_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.search_assets), "__call__") as call: @@ -11422,11 +11477,6 @@ async def test_search_assets_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_search_assets_async_from_dict(): - await test_search_assets_async(request_type=dict) - - def test_search_assets_field_headers(): client = WarehouseClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17135,7 +17185,6 @@ def test_create_asset_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.CreateAssetRequest() - assert args[0] == request_msg @@ -17156,7 +17205,6 @@ def test_update_asset_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.UpdateAssetRequest() - assert args[0] == request_msg @@ -17177,7 +17225,6 @@ def test_get_asset_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.GetAssetRequest() - assert args[0] == request_msg @@ -17198,7 +17245,6 @@ def test_list_assets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.ListAssetsRequest() - assert args[0] == request_msg @@ -17219,7 +17265,6 @@ def test_delete_asset_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.DeleteAssetRequest() - assert args[0] == request_msg @@ -17240,7 +17285,6 @@ def test_create_corpus_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.CreateCorpusRequest() - assert args[0] == request_msg @@ -17261,7 +17305,6 @@ def test_get_corpus_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.GetCorpusRequest() - assert args[0] == request_msg @@ -17282,7 +17325,6 @@ def test_update_corpus_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.UpdateCorpusRequest() - assert args[0] == request_msg @@ -17303,7 +17345,6 @@ def test_list_corpora_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.ListCorporaRequest() - assert args[0] == request_msg @@ -17324,7 +17365,6 @@ def test_delete_corpus_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.DeleteCorpusRequest() - assert args[0] == request_msg @@ -17347,7 +17387,6 @@ def test_create_data_schema_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.CreateDataSchemaRequest() - assert args[0] == request_msg @@ -17370,7 +17409,6 @@ def test_update_data_schema_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.UpdateDataSchemaRequest() - assert args[0] == request_msg @@ -17391,7 +17429,6 @@ def test_get_data_schema_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.GetDataSchemaRequest() - assert args[0] == request_msg @@ -17414,7 +17451,6 @@ def test_delete_data_schema_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.DeleteDataSchemaRequest() - assert args[0] == request_msg @@ -17437,7 +17473,6 @@ def test_list_data_schemas_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.ListDataSchemasRequest() - assert args[0] == request_msg @@ -17460,7 +17495,6 @@ def test_create_annotation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.CreateAnnotationRequest() - assert args[0] == request_msg @@ -17481,7 +17515,6 @@ def test_get_annotation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.GetAnnotationRequest() - assert args[0] == request_msg @@ -17502,7 +17535,6 @@ def test_list_annotations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.ListAnnotationsRequest() - assert args[0] == request_msg @@ -17525,7 +17557,6 @@ def test_update_annotation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.UpdateAnnotationRequest() - assert args[0] == request_msg @@ -17548,7 +17579,6 @@ def test_delete_annotation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.DeleteAnnotationRequest() - assert args[0] == request_msg @@ -17569,7 +17599,6 @@ def test_clip_asset_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.ClipAssetRequest() - assert args[0] == request_msg @@ -17590,7 +17619,6 @@ def test_generate_hls_uri_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.GenerateHlsUriRequest() - assert args[0] == request_msg @@ -17613,7 +17641,6 @@ def test_create_search_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.CreateSearchConfigRequest() - assert args[0] == request_msg @@ -17636,7 +17663,6 @@ def test_update_search_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.UpdateSearchConfigRequest() - assert args[0] == request_msg @@ -17659,7 +17685,6 @@ def test_get_search_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.GetSearchConfigRequest() - assert args[0] == request_msg @@ -17682,7 +17707,6 @@ def test_delete_search_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.DeleteSearchConfigRequest() - assert args[0] == request_msg @@ -17705,7 +17729,6 @@ def test_list_search_configs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.ListSearchConfigsRequest() - assert args[0] == request_msg @@ -17726,7 +17749,6 @@ def test_search_assets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.SearchAssetsRequest() - assert args[0] == request_msg @@ -17767,7 +17789,6 @@ async def test_create_asset_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.CreateAssetRequest() - assert args[0] == request_msg @@ -17794,7 +17815,6 @@ async def test_update_asset_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.UpdateAssetRequest() - assert args[0] == request_msg @@ -17821,7 +17841,6 @@ async def test_get_asset_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.GetAssetRequest() - assert args[0] == request_msg @@ -17848,7 +17867,6 @@ async def test_list_assets_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.ListAssetsRequest() - assert args[0] == request_msg @@ -17873,7 +17891,6 @@ async def test_delete_asset_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.DeleteAssetRequest() - assert args[0] == request_msg @@ -17898,7 +17915,6 @@ async def test_create_corpus_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.CreateCorpusRequest() - assert args[0] == request_msg @@ -17927,7 +17943,6 @@ async def test_get_corpus_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.GetCorpusRequest() - assert args[0] == request_msg @@ -17956,7 +17971,6 @@ async def test_update_corpus_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.UpdateCorpusRequest() - assert args[0] == request_msg @@ -17983,7 +17997,6 @@ async def test_list_corpora_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.ListCorporaRequest() - assert args[0] == request_msg @@ -18006,7 +18019,6 @@ async def test_delete_corpus_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.DeleteCorpusRequest() - assert args[0] == request_msg @@ -18036,7 +18048,6 @@ async def test_create_data_schema_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.CreateDataSchemaRequest() - assert args[0] == request_msg @@ -18066,7 +18077,6 @@ async def test_update_data_schema_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.UpdateDataSchemaRequest() - assert args[0] == request_msg @@ -18094,7 +18104,6 @@ async def test_get_data_schema_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.GetDataSchemaRequest() - assert args[0] == request_msg @@ -18119,7 +18128,6 @@ async def test_delete_data_schema_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.DeleteDataSchemaRequest() - assert args[0] == request_msg @@ -18148,7 +18156,6 @@ async def test_list_data_schemas_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.ListDataSchemasRequest() - assert args[0] == request_msg @@ -18177,7 +18184,6 @@ async def test_create_annotation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.CreateAnnotationRequest() - assert args[0] == request_msg @@ -18204,7 +18210,6 @@ async def test_get_annotation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.GetAnnotationRequest() - assert args[0] == request_msg @@ -18231,7 +18236,6 @@ async def test_list_annotations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.ListAnnotationsRequest() - assert args[0] == request_msg @@ -18260,7 +18264,6 @@ async def test_update_annotation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.UpdateAnnotationRequest() - assert args[0] == request_msg @@ -18285,7 +18288,6 @@ async def test_delete_annotation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.DeleteAnnotationRequest() - assert args[0] == request_msg @@ -18310,7 +18312,6 @@ async def test_clip_asset_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.ClipAssetRequest() - assert args[0] == request_msg @@ -18337,7 +18338,6 @@ async def test_generate_hls_uri_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.GenerateHlsUriRequest() - assert args[0] == request_msg @@ -18366,7 +18366,6 @@ async def test_create_search_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.CreateSearchConfigRequest() - assert args[0] == request_msg @@ -18395,7 +18394,6 @@ async def test_update_search_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.UpdateSearchConfigRequest() - assert args[0] == request_msg @@ -18424,7 +18422,6 @@ async def test_get_search_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.GetSearchConfigRequest() - assert args[0] == request_msg @@ -18449,7 +18446,6 @@ async def test_delete_search_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.DeleteSearchConfigRequest() - assert args[0] == request_msg @@ -18478,7 +18474,6 @@ async def test_list_search_configs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.ListSearchConfigsRequest() - assert args[0] == request_msg @@ -18505,7 +18500,6 @@ async def test_search_assets_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.SearchAssetsRequest() - assert args[0] == request_msg @@ -23501,7 +23495,6 @@ def test_create_asset_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.CreateAssetRequest() - assert args[0] == request_msg @@ -23521,7 +23514,6 @@ def test_update_asset_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.UpdateAssetRequest() - assert args[0] == request_msg @@ -23541,7 +23533,6 @@ def test_get_asset_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.GetAssetRequest() - assert args[0] == request_msg @@ -23561,7 +23552,6 @@ def test_list_assets_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.ListAssetsRequest() - assert args[0] == request_msg @@ -23581,7 +23571,6 @@ def test_delete_asset_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.DeleteAssetRequest() - assert args[0] == request_msg @@ -23601,7 +23590,6 @@ def test_create_corpus_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.CreateCorpusRequest() - assert args[0] == request_msg @@ -23621,7 +23609,6 @@ def test_get_corpus_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.GetCorpusRequest() - assert args[0] == request_msg @@ -23641,7 +23628,6 @@ def test_update_corpus_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.UpdateCorpusRequest() - assert args[0] == request_msg @@ -23661,7 +23647,6 @@ def test_list_corpora_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.ListCorporaRequest() - assert args[0] == request_msg @@ -23681,7 +23666,6 @@ def test_delete_corpus_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.DeleteCorpusRequest() - assert args[0] == request_msg @@ -23703,7 +23687,6 @@ def test_create_data_schema_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.CreateDataSchemaRequest() - assert args[0] == request_msg @@ -23725,7 +23708,6 @@ def test_update_data_schema_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.UpdateDataSchemaRequest() - assert args[0] == request_msg @@ -23745,7 +23727,6 @@ def test_get_data_schema_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.GetDataSchemaRequest() - assert args[0] == request_msg @@ -23767,7 +23748,6 @@ def test_delete_data_schema_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.DeleteDataSchemaRequest() - assert args[0] == request_msg @@ -23789,7 +23769,6 @@ def test_list_data_schemas_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.ListDataSchemasRequest() - assert args[0] == request_msg @@ -23811,7 +23790,6 @@ def test_create_annotation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.CreateAnnotationRequest() - assert args[0] == request_msg @@ -23831,7 +23809,6 @@ def test_get_annotation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.GetAnnotationRequest() - assert args[0] == request_msg @@ -23851,7 +23828,6 @@ def test_list_annotations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.ListAnnotationsRequest() - assert args[0] == request_msg @@ -23873,7 +23849,6 @@ def test_update_annotation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.UpdateAnnotationRequest() - assert args[0] == request_msg @@ -23895,7 +23870,6 @@ def test_delete_annotation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.DeleteAnnotationRequest() - assert args[0] == request_msg @@ -23915,7 +23889,6 @@ def test_clip_asset_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.ClipAssetRequest() - assert args[0] == request_msg @@ -23935,7 +23908,6 @@ def test_generate_hls_uri_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.GenerateHlsUriRequest() - assert args[0] == request_msg @@ -23957,7 +23929,6 @@ def test_create_search_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.CreateSearchConfigRequest() - assert args[0] == request_msg @@ -23979,7 +23950,6 @@ def test_update_search_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.UpdateSearchConfigRequest() - assert args[0] == request_msg @@ -24001,7 +23971,6 @@ def test_get_search_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.GetSearchConfigRequest() - assert args[0] == request_msg @@ -24023,7 +23992,6 @@ def test_delete_search_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.DeleteSearchConfigRequest() - assert args[0] == request_msg @@ -24045,7 +24013,6 @@ def test_list_search_configs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.ListSearchConfigsRequest() - assert args[0] == request_msg @@ -24065,7 +24032,6 @@ def test_search_assets_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = warehouse.SearchAssetsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-vm-migration/noxfile.py b/packages/google-cloud-vm-migration/noxfile.py index b8dff203f937..d8f091d84d1d 100644 --- a/packages/google-cloud-vm-migration/noxfile.py +++ b/packages/google-cloud-vm-migration/noxfile.py @@ -47,7 +47,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-vm-migration" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-vm-migration/setup.py b/packages/google-cloud-vm-migration/setup.py index f856c2220548..d3acee99be47 100644 --- a/packages/google-cloud-vm-migration/setup.py +++ b/packages/google-cloud-vm-migration/setup.py @@ -45,7 +45,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/google-cloud-vm-migration/testing/constraints-3.10.txt b/packages/google-cloud-vm-migration/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-vm-migration/testing/constraints-3.10.txt +++ b/packages/google-cloud-vm-migration/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-vm-migration/tests/unit/gapic/vmmigration_v1/test_vm_migration.py b/packages/google-cloud-vm-migration/tests/unit/gapic/vmmigration_v1/test_vm_migration.py index c7af5d993320..a932d659b9c5 100644 --- a/packages/google-cloud-vm-migration/tests/unit/gapic/vmmigration_v1/test_vm_migration.py +++ b/packages/google-cloud-vm-migration/tests/unit/gapic/vmmigration_v1/test_vm_migration.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 @@ -120,6 +121,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" @@ -1285,8 +1301,8 @@ def test_vm_migration_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - vmmigration.ListSourcesRequest, - dict, + vmmigration.ListSourcesRequest(), + {}, ], ) def test_list_sources(request_type, transport: str = "grpc"): @@ -1297,7 +1313,7 @@ def test_list_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(type(client.transport.list_sources), "__call__") as call: @@ -1346,12 +1362,13 @@ def test_list_sources_non_empty_request_with_auto_populated_field(): client.list_sources(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmmigration.ListSourcesRequest( + request_msg = vmmigration.ListSourcesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_sources_use_cached_wrapped_rpc(): @@ -1432,9 +1449,14 @@ async def test_list_sources_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_sources_async( - transport: str = "grpc_asyncio", request_type=vmmigration.ListSourcesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + vmmigration.ListSourcesRequest(), + {}, + ], +) +async def test_list_sources_async(request_type, transport: str = "grpc_asyncio"): client = VmMigrationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1442,7 +1464,7 @@ async def test_list_sources_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_sources), "__call__") as call: @@ -1467,11 +1489,6 @@ async def test_list_sources_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_sources_async_from_dict(): - await test_list_sources_async(request_type=dict) - - def test_list_sources_field_headers(): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1808,8 +1825,8 @@ async def test_list_sources_async_pages(): @pytest.mark.parametrize( "request_type", [ - vmmigration.GetSourceRequest, - dict, + vmmigration.GetSourceRequest(), + {}, ], ) def test_get_source(request_type, transport: str = "grpc"): @@ -1820,7 +1837,7 @@ def test_get_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(type(client.transport.get_source), "__call__") as call: @@ -1866,9 +1883,10 @@ def test_get_source_non_empty_request_with_auto_populated_field(): client.get_source(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmmigration.GetSourceRequest( + request_msg = vmmigration.GetSourceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_source_use_cached_wrapped_rpc(): @@ -1947,9 +1965,14 @@ async def test_get_source_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_source_async( - transport: str = "grpc_asyncio", request_type=vmmigration.GetSourceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + vmmigration.GetSourceRequest(), + {}, + ], +) +async def test_get_source_async(request_type, transport: str = "grpc_asyncio"): client = VmMigrationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1957,7 +1980,7 @@ async def test_get_source_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_source), "__call__") as call: @@ -1982,11 +2005,6 @@ async def test_get_source_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_get_source_async_from_dict(): - await test_get_source_async(request_type=dict) - - def test_get_source_field_headers(): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2129,8 +2147,8 @@ async def test_get_source_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmmigration.CreateSourceRequest, - dict, + vmmigration.CreateSourceRequest(), + {}, ], ) def test_create_source(request_type, transport: str = "grpc"): @@ -2141,7 +2159,7 @@ def test_create_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(type(client.transport.create_source), "__call__") as call: @@ -2184,11 +2202,12 @@ def test_create_source_non_empty_request_with_auto_populated_field(): client.create_source(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmmigration.CreateSourceRequest( + request_msg = vmmigration.CreateSourceRequest( parent="parent_value", source_id="source_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_source_use_cached_wrapped_rpc(): @@ -2279,9 +2298,14 @@ async def test_create_source_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_source_async( - transport: str = "grpc_asyncio", request_type=vmmigration.CreateSourceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + vmmigration.CreateSourceRequest(), + {}, + ], +) +async def test_create_source_async(request_type, transport: str = "grpc_asyncio"): client = VmMigrationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2289,7 +2313,7 @@ async def test_create_source_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_source), "__call__") as call: @@ -2309,11 +2333,6 @@ async def test_create_source_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_source_async_from_dict(): - await test_create_source_async(request_type=dict) - - def test_create_source_field_headers(): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2492,8 +2511,8 @@ async def test_create_source_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmmigration.UpdateSourceRequest, - dict, + vmmigration.UpdateSourceRequest(), + {}, ], ) def test_update_source(request_type, transport: str = "grpc"): @@ -2504,7 +2523,7 @@ def test_update_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(type(client.transport.update_source), "__call__") as call: @@ -2545,9 +2564,10 @@ def test_update_source_non_empty_request_with_auto_populated_field(): client.update_source(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmmigration.UpdateSourceRequest( + request_msg = vmmigration.UpdateSourceRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_source_use_cached_wrapped_rpc(): @@ -2638,9 +2658,14 @@ async def test_update_source_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_source_async( - transport: str = "grpc_asyncio", request_type=vmmigration.UpdateSourceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + vmmigration.UpdateSourceRequest(), + {}, + ], +) +async def test_update_source_async(request_type, transport: str = "grpc_asyncio"): client = VmMigrationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2648,7 +2673,7 @@ async def test_update_source_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_source), "__call__") as call: @@ -2668,11 +2693,6 @@ async def test_update_source_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_source_async_from_dict(): - await test_update_source_async(request_type=dict) - - def test_update_source_field_headers(): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2841,8 +2861,8 @@ async def test_update_source_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmmigration.DeleteSourceRequest, - dict, + vmmigration.DeleteSourceRequest(), + {}, ], ) def test_delete_source(request_type, transport: str = "grpc"): @@ -2853,7 +2873,7 @@ def test_delete_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(type(client.transport.delete_source), "__call__") as call: @@ -2895,10 +2915,11 @@ def test_delete_source_non_empty_request_with_auto_populated_field(): client.delete_source(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmmigration.DeleteSourceRequest( + request_msg = vmmigration.DeleteSourceRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_source_use_cached_wrapped_rpc(): @@ -2989,9 +3010,14 @@ async def test_delete_source_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_source_async( - transport: str = "grpc_asyncio", request_type=vmmigration.DeleteSourceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + vmmigration.DeleteSourceRequest(), + {}, + ], +) +async def test_delete_source_async(request_type, transport: str = "grpc_asyncio"): client = VmMigrationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2999,7 +3025,7 @@ async def test_delete_source_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_source), "__call__") as call: @@ -3019,11 +3045,6 @@ async def test_delete_source_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_source_async_from_dict(): - await test_delete_source_async(request_type=dict) - - def test_delete_source_field_headers(): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3170,8 +3191,8 @@ async def test_delete_source_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmmigration.FetchInventoryRequest, - dict, + vmmigration.FetchInventoryRequest(), + {}, ], ) def test_fetch_inventory(request_type, transport: str = "grpc"): @@ -3182,7 +3203,7 @@ def test_fetch_inventory(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.fetch_inventory), "__call__") as call: @@ -3223,9 +3244,10 @@ def test_fetch_inventory_non_empty_request_with_auto_populated_field(): client.fetch_inventory(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmmigration.FetchInventoryRequest( + request_msg = vmmigration.FetchInventoryRequest( source="source_value", ) + assert args[0] == request_msg def test_fetch_inventory_use_cached_wrapped_rpc(): @@ -3306,9 +3328,14 @@ async def test_fetch_inventory_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_fetch_inventory_async( - transport: str = "grpc_asyncio", request_type=vmmigration.FetchInventoryRequest -): +@pytest.mark.parametrize( + "request_type", + [ + vmmigration.FetchInventoryRequest(), + {}, + ], +) +async def test_fetch_inventory_async(request_type, transport: str = "grpc_asyncio"): client = VmMigrationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3316,7 +3343,7 @@ async def test_fetch_inventory_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.fetch_inventory), "__call__") as call: @@ -3336,11 +3363,6 @@ async def test_fetch_inventory_async( assert isinstance(response, vmmigration.FetchInventoryResponse) -@pytest.mark.asyncio -async def test_fetch_inventory_async_from_dict(): - await test_fetch_inventory_async(request_type=dict) - - def test_fetch_inventory_field_headers(): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3487,8 +3509,8 @@ async def test_fetch_inventory_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmmigration.FetchStorageInventoryRequest, - dict, + vmmigration.FetchStorageInventoryRequest(), + {}, ], ) def test_fetch_storage_inventory(request_type, transport: str = "grpc"): @@ -3499,7 +3521,7 @@ def test_fetch_storage_inventory(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3548,10 +3570,11 @@ def test_fetch_storage_inventory_non_empty_request_with_auto_populated_field(): client.fetch_storage_inventory(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmmigration.FetchStorageInventoryRequest( + request_msg = vmmigration.FetchStorageInventoryRequest( source="source_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_fetch_storage_inventory_use_cached_wrapped_rpc(): @@ -3637,9 +3660,15 @@ async def test_fetch_storage_inventory_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmmigration.FetchStorageInventoryRequest(), + {}, + ], +) async def test_fetch_storage_inventory_async( - transport: str = "grpc_asyncio", - request_type=vmmigration.FetchStorageInventoryRequest, + request_type, transport: str = "grpc_asyncio" ): client = VmMigrationAsyncClient( credentials=async_anonymous_credentials(), @@ -3648,7 +3677,7 @@ async def test_fetch_storage_inventory_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( @@ -3673,11 +3702,6 @@ async def test_fetch_storage_inventory_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_fetch_storage_inventory_async_from_dict(): - await test_fetch_storage_inventory_async(request_type=dict) - - def test_fetch_storage_inventory_field_headers(): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4040,8 +4064,8 @@ async def test_fetch_storage_inventory_async_pages(): @pytest.mark.parametrize( "request_type", [ - vmmigration.ListUtilizationReportsRequest, - dict, + vmmigration.ListUtilizationReportsRequest(), + {}, ], ) def test_list_utilization_reports(request_type, transport: str = "grpc"): @@ -4052,7 +4076,7 @@ def test_list_utilization_reports(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4105,12 +4129,13 @@ def test_list_utilization_reports_non_empty_request_with_auto_populated_field(): client.list_utilization_reports(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmmigration.ListUtilizationReportsRequest( + request_msg = vmmigration.ListUtilizationReportsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_utilization_reports_use_cached_wrapped_rpc(): @@ -4196,9 +4221,15 @@ async def test_list_utilization_reports_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmmigration.ListUtilizationReportsRequest(), + {}, + ], +) async def test_list_utilization_reports_async( - transport: str = "grpc_asyncio", - request_type=vmmigration.ListUtilizationReportsRequest, + request_type, transport: str = "grpc_asyncio" ): client = VmMigrationAsyncClient( credentials=async_anonymous_credentials(), @@ -4207,7 +4238,7 @@ async def test_list_utilization_reports_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( @@ -4234,11 +4265,6 @@ async def test_list_utilization_reports_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_utilization_reports_async_from_dict(): - await test_list_utilization_reports_async(request_type=dict) - - def test_list_utilization_reports_field_headers(): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4593,8 +4619,8 @@ async def test_list_utilization_reports_async_pages(): @pytest.mark.parametrize( "request_type", [ - vmmigration.GetUtilizationReportRequest, - dict, + vmmigration.GetUtilizationReportRequest(), + {}, ], ) def test_get_utilization_report(request_type, transport: str = "grpc"): @@ -4605,7 +4631,7 @@ def test_get_utilization_report(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4661,9 +4687,10 @@ def test_get_utilization_report_non_empty_request_with_auto_populated_field(): client.get_utilization_report(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmmigration.GetUtilizationReportRequest( + request_msg = vmmigration.GetUtilizationReportRequest( name="name_value", ) + assert args[0] == request_msg def test_get_utilization_report_use_cached_wrapped_rpc(): @@ -4749,9 +4776,15 @@ async def test_get_utilization_report_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmmigration.GetUtilizationReportRequest(), + {}, + ], +) async def test_get_utilization_report_async( - transport: str = "grpc_asyncio", - request_type=vmmigration.GetUtilizationReportRequest, + request_type, transport: str = "grpc_asyncio" ): client = VmMigrationAsyncClient( credentials=async_anonymous_credentials(), @@ -4760,7 +4793,7 @@ async def test_get_utilization_report_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( @@ -4793,11 +4826,6 @@ async def test_get_utilization_report_async( assert response.vm_count == 875 -@pytest.mark.asyncio -async def test_get_utilization_report_async_from_dict(): - await test_get_utilization_report_async(request_type=dict) - - def test_get_utilization_report_field_headers(): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4952,8 +4980,8 @@ async def test_get_utilization_report_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmmigration.CreateUtilizationReportRequest, - dict, + vmmigration.CreateUtilizationReportRequest(), + {}, ], ) def test_create_utilization_report(request_type, transport: str = "grpc"): @@ -4964,7 +4992,7 @@ def test_create_utilization_report(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5011,11 +5039,12 @@ def test_create_utilization_report_non_empty_request_with_auto_populated_field() client.create_utilization_report(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmmigration.CreateUtilizationReportRequest( + request_msg = vmmigration.CreateUtilizationReportRequest( parent="parent_value", utilization_report_id="utilization_report_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_utilization_report_use_cached_wrapped_rpc(): @@ -5111,9 +5140,15 @@ async def test_create_utilization_report_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmmigration.CreateUtilizationReportRequest(), + {}, + ], +) async def test_create_utilization_report_async( - transport: str = "grpc_asyncio", - request_type=vmmigration.CreateUtilizationReportRequest, + request_type, transport: str = "grpc_asyncio" ): client = VmMigrationAsyncClient( credentials=async_anonymous_credentials(), @@ -5122,7 +5157,7 @@ async def test_create_utilization_report_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( @@ -5144,11 +5179,6 @@ async def test_create_utilization_report_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_utilization_report_async_from_dict(): - await test_create_utilization_report_async(request_type=dict) - - def test_create_utilization_report_field_headers(): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5323,8 +5353,8 @@ async def test_create_utilization_report_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmmigration.DeleteUtilizationReportRequest, - dict, + vmmigration.DeleteUtilizationReportRequest(), + {}, ], ) def test_delete_utilization_report(request_type, transport: str = "grpc"): @@ -5335,7 +5365,7 @@ def test_delete_utilization_report(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5381,10 +5411,11 @@ def test_delete_utilization_report_non_empty_request_with_auto_populated_field() client.delete_utilization_report(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmmigration.DeleteUtilizationReportRequest( + request_msg = vmmigration.DeleteUtilizationReportRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_utilization_report_use_cached_wrapped_rpc(): @@ -5480,9 +5511,15 @@ async def test_delete_utilization_report_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmmigration.DeleteUtilizationReportRequest(), + {}, + ], +) async def test_delete_utilization_report_async( - transport: str = "grpc_asyncio", - request_type=vmmigration.DeleteUtilizationReportRequest, + request_type, transport: str = "grpc_asyncio" ): client = VmMigrationAsyncClient( credentials=async_anonymous_credentials(), @@ -5491,7 +5528,7 @@ async def test_delete_utilization_report_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( @@ -5513,11 +5550,6 @@ async def test_delete_utilization_report_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_utilization_report_async_from_dict(): - await test_delete_utilization_report_async(request_type=dict) - - def test_delete_utilization_report_field_headers(): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5672,8 +5704,8 @@ async def test_delete_utilization_report_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmmigration.ListDatacenterConnectorsRequest, - dict, + vmmigration.ListDatacenterConnectorsRequest(), + {}, ], ) def test_list_datacenter_connectors(request_type, transport: str = "grpc"): @@ -5684,7 +5716,7 @@ def test_list_datacenter_connectors(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5737,12 +5769,13 @@ def test_list_datacenter_connectors_non_empty_request_with_auto_populated_field( client.list_datacenter_connectors(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmmigration.ListDatacenterConnectorsRequest( + request_msg = vmmigration.ListDatacenterConnectorsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_datacenter_connectors_use_cached_wrapped_rpc(): @@ -5828,9 +5861,15 @@ async def test_list_datacenter_connectors_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmmigration.ListDatacenterConnectorsRequest(), + {}, + ], +) async def test_list_datacenter_connectors_async( - transport: str = "grpc_asyncio", - request_type=vmmigration.ListDatacenterConnectorsRequest, + request_type, transport: str = "grpc_asyncio" ): client = VmMigrationAsyncClient( credentials=async_anonymous_credentials(), @@ -5839,7 +5878,7 @@ async def test_list_datacenter_connectors_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( @@ -5866,11 +5905,6 @@ async def test_list_datacenter_connectors_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_datacenter_connectors_async_from_dict(): - await test_list_datacenter_connectors_async(request_type=dict) - - def test_list_datacenter_connectors_field_headers(): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6225,8 +6259,8 @@ async def test_list_datacenter_connectors_async_pages(): @pytest.mark.parametrize( "request_type", [ - vmmigration.GetDatacenterConnectorRequest, - dict, + vmmigration.GetDatacenterConnectorRequest(), + {}, ], ) def test_get_datacenter_connector(request_type, transport: str = "grpc"): @@ -6237,7 +6271,7 @@ def test_get_datacenter_connector(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6302,9 +6336,10 @@ def test_get_datacenter_connector_non_empty_request_with_auto_populated_field(): client.get_datacenter_connector(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmmigration.GetDatacenterConnectorRequest( + request_msg = vmmigration.GetDatacenterConnectorRequest( name="name_value", ) + assert args[0] == request_msg def test_get_datacenter_connector_use_cached_wrapped_rpc(): @@ -6390,9 +6425,15 @@ async def test_get_datacenter_connector_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmmigration.GetDatacenterConnectorRequest(), + {}, + ], +) async def test_get_datacenter_connector_async( - transport: str = "grpc_asyncio", - request_type=vmmigration.GetDatacenterConnectorRequest, + request_type, transport: str = "grpc_asyncio" ): client = VmMigrationAsyncClient( credentials=async_anonymous_credentials(), @@ -6401,7 +6442,7 @@ async def test_get_datacenter_connector_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( @@ -6443,11 +6484,6 @@ async def test_get_datacenter_connector_async( assert response.appliance_software_version == "appliance_software_version_value" -@pytest.mark.asyncio -async def test_get_datacenter_connector_async_from_dict(): - await test_get_datacenter_connector_async(request_type=dict) - - def test_get_datacenter_connector_field_headers(): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6602,8 +6638,8 @@ async def test_get_datacenter_connector_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmmigration.CreateDatacenterConnectorRequest, - dict, + vmmigration.CreateDatacenterConnectorRequest(), + {}, ], ) def test_create_datacenter_connector(request_type, transport: str = "grpc"): @@ -6614,7 +6650,7 @@ def test_create_datacenter_connector(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6661,11 +6697,12 @@ def test_create_datacenter_connector_non_empty_request_with_auto_populated_field client.create_datacenter_connector(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmmigration.CreateDatacenterConnectorRequest( + request_msg = vmmigration.CreateDatacenterConnectorRequest( parent="parent_value", datacenter_connector_id="datacenter_connector_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_datacenter_connector_use_cached_wrapped_rpc(): @@ -6761,9 +6798,15 @@ async def test_create_datacenter_connector_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmmigration.CreateDatacenterConnectorRequest(), + {}, + ], +) async def test_create_datacenter_connector_async( - transport: str = "grpc_asyncio", - request_type=vmmigration.CreateDatacenterConnectorRequest, + request_type, transport: str = "grpc_asyncio" ): client = VmMigrationAsyncClient( credentials=async_anonymous_credentials(), @@ -6772,7 +6815,7 @@ async def test_create_datacenter_connector_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( @@ -6794,11 +6837,6 @@ async def test_create_datacenter_connector_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_datacenter_connector_async_from_dict(): - await test_create_datacenter_connector_async(request_type=dict) - - def test_create_datacenter_connector_field_headers(): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6985,8 +7023,8 @@ async def test_create_datacenter_connector_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmmigration.DeleteDatacenterConnectorRequest, - dict, + vmmigration.DeleteDatacenterConnectorRequest(), + {}, ], ) def test_delete_datacenter_connector(request_type, transport: str = "grpc"): @@ -6997,7 +7035,7 @@ def test_delete_datacenter_connector(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7043,10 +7081,11 @@ def test_delete_datacenter_connector_non_empty_request_with_auto_populated_field client.delete_datacenter_connector(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmmigration.DeleteDatacenterConnectorRequest( + request_msg = vmmigration.DeleteDatacenterConnectorRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_datacenter_connector_use_cached_wrapped_rpc(): @@ -7142,9 +7181,15 @@ async def test_delete_datacenter_connector_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmmigration.DeleteDatacenterConnectorRequest(), + {}, + ], +) async def test_delete_datacenter_connector_async( - transport: str = "grpc_asyncio", - request_type=vmmigration.DeleteDatacenterConnectorRequest, + request_type, transport: str = "grpc_asyncio" ): client = VmMigrationAsyncClient( credentials=async_anonymous_credentials(), @@ -7153,7 +7198,7 @@ async def test_delete_datacenter_connector_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( @@ -7175,11 +7220,6 @@ async def test_delete_datacenter_connector_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_datacenter_connector_async_from_dict(): - await test_delete_datacenter_connector_async(request_type=dict) - - def test_delete_datacenter_connector_field_headers(): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7334,8 +7374,8 @@ async def test_delete_datacenter_connector_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmmigration.UpgradeApplianceRequest, - dict, + vmmigration.UpgradeApplianceRequest(), + {}, ], ) def test_upgrade_appliance(request_type, transport: str = "grpc"): @@ -7346,7 +7386,7 @@ def test_upgrade_appliance(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7392,10 +7432,11 @@ def test_upgrade_appliance_non_empty_request_with_auto_populated_field(): client.upgrade_appliance(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmmigration.UpgradeApplianceRequest( + request_msg = vmmigration.UpgradeApplianceRequest( datacenter_connector="datacenter_connector_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_upgrade_appliance_use_cached_wrapped_rpc(): @@ -7488,9 +7529,14 @@ async def test_upgrade_appliance_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_upgrade_appliance_async( - transport: str = "grpc_asyncio", request_type=vmmigration.UpgradeApplianceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + vmmigration.UpgradeApplianceRequest(), + {}, + ], +) +async def test_upgrade_appliance_async(request_type, transport: str = "grpc_asyncio"): client = VmMigrationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7498,7 +7544,7 @@ async def test_upgrade_appliance_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( @@ -7520,11 +7566,6 @@ async def test_upgrade_appliance_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_upgrade_appliance_async_from_dict(): - await test_upgrade_appliance_async(request_type=dict) - - def test_upgrade_appliance_field_headers(): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7593,8 +7634,8 @@ async def test_upgrade_appliance_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - vmmigration.CreateMigratingVmRequest, - dict, + vmmigration.CreateMigratingVmRequest(), + {}, ], ) def test_create_migrating_vm(request_type, transport: str = "grpc"): @@ -7605,7 +7646,7 @@ def test_create_migrating_vm(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7652,11 +7693,12 @@ def test_create_migrating_vm_non_empty_request_with_auto_populated_field(): client.create_migrating_vm(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmmigration.CreateMigratingVmRequest( + request_msg = vmmigration.CreateMigratingVmRequest( parent="parent_value", migrating_vm_id="migrating_vm_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_migrating_vm_use_cached_wrapped_rpc(): @@ -7751,9 +7793,14 @@ async def test_create_migrating_vm_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_migrating_vm_async( - transport: str = "grpc_asyncio", request_type=vmmigration.CreateMigratingVmRequest -): +@pytest.mark.parametrize( + "request_type", + [ + vmmigration.CreateMigratingVmRequest(), + {}, + ], +) +async def test_create_migrating_vm_async(request_type, transport: str = "grpc_asyncio"): client = VmMigrationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7761,7 +7808,7 @@ async def test_create_migrating_vm_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( @@ -7783,11 +7830,6 @@ async def test_create_migrating_vm_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_migrating_vm_async_from_dict(): - await test_create_migrating_vm_async(request_type=dict) - - def test_create_migrating_vm_field_headers(): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7986,8 +8028,8 @@ async def test_create_migrating_vm_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmmigration.ListMigratingVmsRequest, - dict, + vmmigration.ListMigratingVmsRequest(), + {}, ], ) def test_list_migrating_vms(request_type, transport: str = "grpc"): @@ -7998,7 +8040,7 @@ def test_list_migrating_vms(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8051,12 +8093,13 @@ def test_list_migrating_vms_non_empty_request_with_auto_populated_field(): client.list_migrating_vms(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmmigration.ListMigratingVmsRequest( + request_msg = vmmigration.ListMigratingVmsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_migrating_vms_use_cached_wrapped_rpc(): @@ -8141,9 +8184,14 @@ async def test_list_migrating_vms_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_migrating_vms_async( - transport: str = "grpc_asyncio", request_type=vmmigration.ListMigratingVmsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + vmmigration.ListMigratingVmsRequest(), + {}, + ], +) +async def test_list_migrating_vms_async(request_type, transport: str = "grpc_asyncio"): client = VmMigrationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8151,7 +8199,7 @@ async def test_list_migrating_vms_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( @@ -8178,11 +8226,6 @@ async def test_list_migrating_vms_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_migrating_vms_async_from_dict(): - await test_list_migrating_vms_async(request_type=dict) - - def test_list_migrating_vms_field_headers(): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8535,8 +8578,8 @@ async def test_list_migrating_vms_async_pages(): @pytest.mark.parametrize( "request_type", [ - vmmigration.GetMigratingVmRequest, - dict, + vmmigration.GetMigratingVmRequest(), + {}, ], ) def test_get_migrating_vm(request_type, transport: str = "grpc"): @@ -8547,7 +8590,7 @@ def test_get_migrating_vm(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_migrating_vm), "__call__") as call: @@ -8601,9 +8644,10 @@ def test_get_migrating_vm_non_empty_request_with_auto_populated_field(): client.get_migrating_vm(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmmigration.GetMigratingVmRequest( + request_msg = vmmigration.GetMigratingVmRequest( name="name_value", ) + assert args[0] == request_msg def test_get_migrating_vm_use_cached_wrapped_rpc(): @@ -8686,9 +8730,14 @@ async def test_get_migrating_vm_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_migrating_vm_async( - transport: str = "grpc_asyncio", request_type=vmmigration.GetMigratingVmRequest -): +@pytest.mark.parametrize( + "request_type", + [ + vmmigration.GetMigratingVmRequest(), + {}, + ], +) +async def test_get_migrating_vm_async(request_type, transport: str = "grpc_asyncio"): client = VmMigrationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8696,7 +8745,7 @@ async def test_get_migrating_vm_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_migrating_vm), "__call__") as call: @@ -8729,11 +8778,6 @@ async def test_get_migrating_vm_async( assert response.group == "group_value" -@pytest.mark.asyncio -async def test_get_migrating_vm_async_from_dict(): - await test_get_migrating_vm_async(request_type=dict) - - def test_get_migrating_vm_field_headers(): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8880,8 +8924,8 @@ async def test_get_migrating_vm_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmmigration.UpdateMigratingVmRequest, - dict, + vmmigration.UpdateMigratingVmRequest(), + {}, ], ) def test_update_migrating_vm(request_type, transport: str = "grpc"): @@ -8892,7 +8936,7 @@ def test_update_migrating_vm(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8937,9 +8981,10 @@ def test_update_migrating_vm_non_empty_request_with_auto_populated_field(): client.update_migrating_vm(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmmigration.UpdateMigratingVmRequest( + request_msg = vmmigration.UpdateMigratingVmRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_migrating_vm_use_cached_wrapped_rpc(): @@ -9034,9 +9079,14 @@ async def test_update_migrating_vm_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_migrating_vm_async( - transport: str = "grpc_asyncio", request_type=vmmigration.UpdateMigratingVmRequest -): +@pytest.mark.parametrize( + "request_type", + [ + vmmigration.UpdateMigratingVmRequest(), + {}, + ], +) +async def test_update_migrating_vm_async(request_type, transport: str = "grpc_asyncio"): client = VmMigrationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9044,7 +9094,7 @@ async def test_update_migrating_vm_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( @@ -9066,11 +9116,6 @@ async def test_update_migrating_vm_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_migrating_vm_async_from_dict(): - await test_update_migrating_vm_async(request_type=dict) - - def test_update_migrating_vm_field_headers(): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9259,8 +9304,8 @@ async def test_update_migrating_vm_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmmigration.DeleteMigratingVmRequest, - dict, + vmmigration.DeleteMigratingVmRequest(), + {}, ], ) def test_delete_migrating_vm(request_type, transport: str = "grpc"): @@ -9271,7 +9316,7 @@ def test_delete_migrating_vm(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9316,9 +9361,10 @@ def test_delete_migrating_vm_non_empty_request_with_auto_populated_field(): client.delete_migrating_vm(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmmigration.DeleteMigratingVmRequest( + request_msg = vmmigration.DeleteMigratingVmRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_migrating_vm_use_cached_wrapped_rpc(): @@ -9413,9 +9459,14 @@ async def test_delete_migrating_vm_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_migrating_vm_async( - transport: str = "grpc_asyncio", request_type=vmmigration.DeleteMigratingVmRequest -): +@pytest.mark.parametrize( + "request_type", + [ + vmmigration.DeleteMigratingVmRequest(), + {}, + ], +) +async def test_delete_migrating_vm_async(request_type, transport: str = "grpc_asyncio"): client = VmMigrationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9423,7 +9474,7 @@ async def test_delete_migrating_vm_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( @@ -9445,11 +9496,6 @@ async def test_delete_migrating_vm_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_migrating_vm_async_from_dict(): - await test_delete_migrating_vm_async(request_type=dict) - - def test_delete_migrating_vm_field_headers(): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9604,8 +9650,8 @@ async def test_delete_migrating_vm_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmmigration.StartMigrationRequest, - dict, + vmmigration.StartMigrationRequest(), + {}, ], ) def test_start_migration(request_type, transport: str = "grpc"): @@ -9616,7 +9662,7 @@ def test_start_migration(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.start_migration), "__call__") as call: @@ -9657,9 +9703,10 @@ def test_start_migration_non_empty_request_with_auto_populated_field(): client.start_migration(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmmigration.StartMigrationRequest( + request_msg = vmmigration.StartMigrationRequest( migrating_vm="migrating_vm_value", ) + assert args[0] == request_msg def test_start_migration_use_cached_wrapped_rpc(): @@ -9750,9 +9797,14 @@ async def test_start_migration_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_start_migration_async( - transport: str = "grpc_asyncio", request_type=vmmigration.StartMigrationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + vmmigration.StartMigrationRequest(), + {}, + ], +) +async def test_start_migration_async(request_type, transport: str = "grpc_asyncio"): client = VmMigrationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9760,7 +9812,7 @@ async def test_start_migration_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.start_migration), "__call__") as call: @@ -9780,11 +9832,6 @@ async def test_start_migration_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_start_migration_async_from_dict(): - await test_start_migration_async(request_type=dict) - - def test_start_migration_field_headers(): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9931,8 +9978,8 @@ async def test_start_migration_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmmigration.ResumeMigrationRequest, - dict, + vmmigration.ResumeMigrationRequest(), + {}, ], ) def test_resume_migration(request_type, transport: str = "grpc"): @@ -9943,7 +9990,7 @@ def test_resume_migration(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.resume_migration), "__call__") as call: @@ -9984,9 +10031,10 @@ def test_resume_migration_non_empty_request_with_auto_populated_field(): client.resume_migration(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmmigration.ResumeMigrationRequest( + request_msg = vmmigration.ResumeMigrationRequest( migrating_vm="migrating_vm_value", ) + assert args[0] == request_msg def test_resume_migration_use_cached_wrapped_rpc(): @@ -10079,9 +10127,14 @@ async def test_resume_migration_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_resume_migration_async( - transport: str = "grpc_asyncio", request_type=vmmigration.ResumeMigrationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + vmmigration.ResumeMigrationRequest(), + {}, + ], +) +async def test_resume_migration_async(request_type, transport: str = "grpc_asyncio"): client = VmMigrationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10089,7 +10142,7 @@ async def test_resume_migration_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.resume_migration), "__call__") as call: @@ -10109,11 +10162,6 @@ async def test_resume_migration_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_resume_migration_async_from_dict(): - await test_resume_migration_async(request_type=dict) - - def test_resume_migration_field_headers(): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10178,8 +10226,8 @@ async def test_resume_migration_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - vmmigration.PauseMigrationRequest, - dict, + vmmigration.PauseMigrationRequest(), + {}, ], ) def test_pause_migration(request_type, transport: str = "grpc"): @@ -10190,7 +10238,7 @@ def test_pause_migration(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.pause_migration), "__call__") as call: @@ -10231,9 +10279,10 @@ def test_pause_migration_non_empty_request_with_auto_populated_field(): client.pause_migration(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmmigration.PauseMigrationRequest( + request_msg = vmmigration.PauseMigrationRequest( migrating_vm="migrating_vm_value", ) + assert args[0] == request_msg def test_pause_migration_use_cached_wrapped_rpc(): @@ -10324,9 +10373,14 @@ async def test_pause_migration_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_pause_migration_async( - transport: str = "grpc_asyncio", request_type=vmmigration.PauseMigrationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + vmmigration.PauseMigrationRequest(), + {}, + ], +) +async def test_pause_migration_async(request_type, transport: str = "grpc_asyncio"): client = VmMigrationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10334,7 +10388,7 @@ async def test_pause_migration_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.pause_migration), "__call__") as call: @@ -10354,11 +10408,6 @@ async def test_pause_migration_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_pause_migration_async_from_dict(): - await test_pause_migration_async(request_type=dict) - - def test_pause_migration_field_headers(): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10423,8 +10472,8 @@ async def test_pause_migration_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - vmmigration.FinalizeMigrationRequest, - dict, + vmmigration.FinalizeMigrationRequest(), + {}, ], ) def test_finalize_migration(request_type, transport: str = "grpc"): @@ -10435,7 +10484,7 @@ def test_finalize_migration(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10480,9 +10529,10 @@ def test_finalize_migration_non_empty_request_with_auto_populated_field(): client.finalize_migration(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmmigration.FinalizeMigrationRequest( + request_msg = vmmigration.FinalizeMigrationRequest( migrating_vm="migrating_vm_value", ) + assert args[0] == request_msg def test_finalize_migration_use_cached_wrapped_rpc(): @@ -10577,9 +10627,14 @@ async def test_finalize_migration_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_finalize_migration_async( - transport: str = "grpc_asyncio", request_type=vmmigration.FinalizeMigrationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + vmmigration.FinalizeMigrationRequest(), + {}, + ], +) +async def test_finalize_migration_async(request_type, transport: str = "grpc_asyncio"): client = VmMigrationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10587,7 +10642,7 @@ async def test_finalize_migration_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( @@ -10609,11 +10664,6 @@ async def test_finalize_migration_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_finalize_migration_async_from_dict(): - await test_finalize_migration_async(request_type=dict) - - def test_finalize_migration_field_headers(): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10768,8 +10818,8 @@ async def test_finalize_migration_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmmigration.ExtendMigrationRequest, - dict, + vmmigration.ExtendMigrationRequest(), + {}, ], ) def test_extend_migration(request_type, transport: str = "grpc"): @@ -10780,7 +10830,7 @@ def test_extend_migration(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.extend_migration), "__call__") as call: @@ -10821,9 +10871,10 @@ def test_extend_migration_non_empty_request_with_auto_populated_field(): client.extend_migration(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmmigration.ExtendMigrationRequest( + request_msg = vmmigration.ExtendMigrationRequest( migrating_vm="migrating_vm_value", ) + assert args[0] == request_msg def test_extend_migration_use_cached_wrapped_rpc(): @@ -10916,9 +10967,14 @@ async def test_extend_migration_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_extend_migration_async( - transport: str = "grpc_asyncio", request_type=vmmigration.ExtendMigrationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + vmmigration.ExtendMigrationRequest(), + {}, + ], +) +async def test_extend_migration_async(request_type, transport: str = "grpc_asyncio"): client = VmMigrationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -10926,7 +10982,7 @@ async def test_extend_migration_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.extend_migration), "__call__") as call: @@ -10946,11 +11002,6 @@ async def test_extend_migration_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_extend_migration_async_from_dict(): - await test_extend_migration_async(request_type=dict) - - def test_extend_migration_field_headers(): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11015,8 +11066,8 @@ async def test_extend_migration_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - vmmigration.CreateCloneJobRequest, - dict, + vmmigration.CreateCloneJobRequest(), + {}, ], ) def test_create_clone_job(request_type, transport: str = "grpc"): @@ -11027,7 +11078,7 @@ def test_create_clone_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(type(client.transport.create_clone_job), "__call__") as call: @@ -11070,11 +11121,12 @@ def test_create_clone_job_non_empty_request_with_auto_populated_field(): client.create_clone_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmmigration.CreateCloneJobRequest( + request_msg = vmmigration.CreateCloneJobRequest( parent="parent_value", clone_job_id="clone_job_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_clone_job_use_cached_wrapped_rpc(): @@ -11167,9 +11219,14 @@ async def test_create_clone_job_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_clone_job_async( - transport: str = "grpc_asyncio", request_type=vmmigration.CreateCloneJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + vmmigration.CreateCloneJobRequest(), + {}, + ], +) +async def test_create_clone_job_async(request_type, transport: str = "grpc_asyncio"): client = VmMigrationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11177,7 +11234,7 @@ async def test_create_clone_job_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_clone_job), "__call__") as call: @@ -11197,11 +11254,6 @@ async def test_create_clone_job_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_clone_job_async_from_dict(): - await test_create_clone_job_async(request_type=dict) - - def test_create_clone_job_field_headers(): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11392,8 +11444,8 @@ async def test_create_clone_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmmigration.CancelCloneJobRequest, - dict, + vmmigration.CancelCloneJobRequest(), + {}, ], ) def test_cancel_clone_job(request_type, transport: str = "grpc"): @@ -11404,7 +11456,7 @@ def test_cancel_clone_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(type(client.transport.cancel_clone_job), "__call__") as call: @@ -11445,9 +11497,10 @@ def test_cancel_clone_job_non_empty_request_with_auto_populated_field(): client.cancel_clone_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmmigration.CancelCloneJobRequest( + request_msg = vmmigration.CancelCloneJobRequest( name="name_value", ) + assert args[0] == request_msg def test_cancel_clone_job_use_cached_wrapped_rpc(): @@ -11540,9 +11593,14 @@ async def test_cancel_clone_job_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_cancel_clone_job_async( - transport: str = "grpc_asyncio", request_type=vmmigration.CancelCloneJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + vmmigration.CancelCloneJobRequest(), + {}, + ], +) +async def test_cancel_clone_job_async(request_type, transport: str = "grpc_asyncio"): client = VmMigrationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11550,7 +11608,7 @@ async def test_cancel_clone_job_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.cancel_clone_job), "__call__") as call: @@ -11570,11 +11628,6 @@ async def test_cancel_clone_job_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_cancel_clone_job_async_from_dict(): - await test_cancel_clone_job_async(request_type=dict) - - def test_cancel_clone_job_field_headers(): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11721,8 +11774,8 @@ async def test_cancel_clone_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmmigration.ListCloneJobsRequest, - dict, + vmmigration.ListCloneJobsRequest(), + {}, ], ) def test_list_clone_jobs(request_type, transport: str = "grpc"): @@ -11733,7 +11786,7 @@ def test_list_clone_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(type(client.transport.list_clone_jobs), "__call__") as call: @@ -11782,12 +11835,13 @@ def test_list_clone_jobs_non_empty_request_with_auto_populated_field(): client.list_clone_jobs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmmigration.ListCloneJobsRequest( + request_msg = vmmigration.ListCloneJobsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_clone_jobs_use_cached_wrapped_rpc(): @@ -11868,9 +11922,14 @@ async def test_list_clone_jobs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_clone_jobs_async( - transport: str = "grpc_asyncio", request_type=vmmigration.ListCloneJobsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + vmmigration.ListCloneJobsRequest(), + {}, + ], +) +async def test_list_clone_jobs_async(request_type, transport: str = "grpc_asyncio"): client = VmMigrationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -11878,7 +11937,7 @@ async def test_list_clone_jobs_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_clone_jobs), "__call__") as call: @@ -11903,11 +11962,6 @@ async def test_list_clone_jobs_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_clone_jobs_async_from_dict(): - await test_list_clone_jobs_async(request_type=dict) - - def test_list_clone_jobs_field_headers(): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12244,8 +12298,8 @@ async def test_list_clone_jobs_async_pages(): @pytest.mark.parametrize( "request_type", [ - vmmigration.GetCloneJobRequest, - dict, + vmmigration.GetCloneJobRequest(), + {}, ], ) def test_get_clone_job(request_type, transport: str = "grpc"): @@ -12256,7 +12310,7 @@ def test_get_clone_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(type(client.transport.get_clone_job), "__call__") as call: @@ -12302,9 +12356,10 @@ def test_get_clone_job_non_empty_request_with_auto_populated_field(): client.get_clone_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmmigration.GetCloneJobRequest( + request_msg = vmmigration.GetCloneJobRequest( name="name_value", ) + assert args[0] == request_msg def test_get_clone_job_use_cached_wrapped_rpc(): @@ -12385,9 +12440,14 @@ async def test_get_clone_job_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_clone_job_async( - transport: str = "grpc_asyncio", request_type=vmmigration.GetCloneJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + vmmigration.GetCloneJobRequest(), + {}, + ], +) +async def test_get_clone_job_async(request_type, transport: str = "grpc_asyncio"): client = VmMigrationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12395,7 +12455,7 @@ async def test_get_clone_job_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_clone_job), "__call__") as call: @@ -12420,11 +12480,6 @@ async def test_get_clone_job_async( assert response.state == vmmigration.CloneJob.State.PENDING -@pytest.mark.asyncio -async def test_get_clone_job_async_from_dict(): - await test_get_clone_job_async(request_type=dict) - - def test_get_clone_job_field_headers(): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12571,8 +12626,8 @@ async def test_get_clone_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmmigration.CreateCutoverJobRequest, - dict, + vmmigration.CreateCutoverJobRequest(), + {}, ], ) def test_create_cutover_job(request_type, transport: str = "grpc"): @@ -12583,7 +12638,7 @@ def test_create_cutover_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( @@ -12630,11 +12685,12 @@ def test_create_cutover_job_non_empty_request_with_auto_populated_field(): client.create_cutover_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmmigration.CreateCutoverJobRequest( + request_msg = vmmigration.CreateCutoverJobRequest( parent="parent_value", cutover_job_id="cutover_job_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_cutover_job_use_cached_wrapped_rpc(): @@ -12729,9 +12785,14 @@ async def test_create_cutover_job_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_cutover_job_async( - transport: str = "grpc_asyncio", request_type=vmmigration.CreateCutoverJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + vmmigration.CreateCutoverJobRequest(), + {}, + ], +) +async def test_create_cutover_job_async(request_type, transport: str = "grpc_asyncio"): client = VmMigrationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12739,7 +12800,7 @@ async def test_create_cutover_job_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( @@ -12761,11 +12822,6 @@ async def test_create_cutover_job_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_cutover_job_async_from_dict(): - await test_create_cutover_job_async(request_type=dict) - - def test_create_cutover_job_field_headers(): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12964,8 +13020,8 @@ async def test_create_cutover_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmmigration.CancelCutoverJobRequest, - dict, + vmmigration.CancelCutoverJobRequest(), + {}, ], ) def test_cancel_cutover_job(request_type, transport: str = "grpc"): @@ -12976,7 +13032,7 @@ def test_cancel_cutover_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( @@ -13021,9 +13077,10 @@ def test_cancel_cutover_job_non_empty_request_with_auto_populated_field(): client.cancel_cutover_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmmigration.CancelCutoverJobRequest( + request_msg = vmmigration.CancelCutoverJobRequest( name="name_value", ) + assert args[0] == request_msg def test_cancel_cutover_job_use_cached_wrapped_rpc(): @@ -13118,9 +13175,14 @@ async def test_cancel_cutover_job_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_cancel_cutover_job_async( - transport: str = "grpc_asyncio", request_type=vmmigration.CancelCutoverJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + vmmigration.CancelCutoverJobRequest(), + {}, + ], +) +async def test_cancel_cutover_job_async(request_type, transport: str = "grpc_asyncio"): client = VmMigrationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13128,7 +13190,7 @@ async def test_cancel_cutover_job_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( @@ -13150,11 +13212,6 @@ async def test_cancel_cutover_job_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_cancel_cutover_job_async_from_dict(): - await test_cancel_cutover_job_async(request_type=dict) - - def test_cancel_cutover_job_field_headers(): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13309,8 +13366,8 @@ async def test_cancel_cutover_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmmigration.ListCutoverJobsRequest, - dict, + vmmigration.ListCutoverJobsRequest(), + {}, ], ) def test_list_cutover_jobs(request_type, transport: str = "grpc"): @@ -13321,7 +13378,7 @@ def test_list_cutover_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( @@ -13374,12 +13431,13 @@ def test_list_cutover_jobs_non_empty_request_with_auto_populated_field(): client.list_cutover_jobs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmmigration.ListCutoverJobsRequest( + request_msg = vmmigration.ListCutoverJobsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_cutover_jobs_use_cached_wrapped_rpc(): @@ -13462,9 +13520,14 @@ async def test_list_cutover_jobs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_cutover_jobs_async( - transport: str = "grpc_asyncio", request_type=vmmigration.ListCutoverJobsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + vmmigration.ListCutoverJobsRequest(), + {}, + ], +) +async def test_list_cutover_jobs_async(request_type, transport: str = "grpc_asyncio"): client = VmMigrationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -13472,7 +13535,7 @@ async def test_list_cutover_jobs_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( @@ -13499,11 +13562,6 @@ async def test_list_cutover_jobs_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_cutover_jobs_async_from_dict(): - await test_list_cutover_jobs_async(request_type=dict) - - def test_list_cutover_jobs_field_headers(): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13856,8 +13914,8 @@ async def test_list_cutover_jobs_async_pages(): @pytest.mark.parametrize( "request_type", [ - vmmigration.GetCutoverJobRequest, - dict, + vmmigration.GetCutoverJobRequest(), + {}, ], ) def test_get_cutover_job(request_type, transport: str = "grpc"): @@ -13868,7 +13926,7 @@ def test_get_cutover_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(type(client.transport.get_cutover_job), "__call__") as call: @@ -13918,9 +13976,10 @@ def test_get_cutover_job_non_empty_request_with_auto_populated_field(): client.get_cutover_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmmigration.GetCutoverJobRequest( + request_msg = vmmigration.GetCutoverJobRequest( name="name_value", ) + assert args[0] == request_msg def test_get_cutover_job_use_cached_wrapped_rpc(): @@ -14001,9 +14060,14 @@ async def test_get_cutover_job_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_cutover_job_async( - transport: str = "grpc_asyncio", request_type=vmmigration.GetCutoverJobRequest -): +@pytest.mark.parametrize( + "request_type", + [ + vmmigration.GetCutoverJobRequest(), + {}, + ], +) +async def test_get_cutover_job_async(request_type, transport: str = "grpc_asyncio"): client = VmMigrationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14011,7 +14075,7 @@ async def test_get_cutover_job_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_cutover_job), "__call__") as call: @@ -14040,11 +14104,6 @@ async def test_get_cutover_job_async( assert response.state_message == "state_message_value" -@pytest.mark.asyncio -async def test_get_cutover_job_async_from_dict(): - await test_get_cutover_job_async(request_type=dict) - - def test_get_cutover_job_field_headers(): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14191,8 +14250,8 @@ async def test_get_cutover_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmmigration.ListGroupsRequest, - dict, + vmmigration.ListGroupsRequest(), + {}, ], ) def test_list_groups(request_type, transport: str = "grpc"): @@ -14203,7 +14262,7 @@ def test_list_groups(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_groups), "__call__") as call: @@ -14252,12 +14311,13 @@ def test_list_groups_non_empty_request_with_auto_populated_field(): client.list_groups(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmmigration.ListGroupsRequest( + request_msg = vmmigration.ListGroupsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_groups_use_cached_wrapped_rpc(): @@ -14338,9 +14398,14 @@ async def test_list_groups_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_groups_async( - transport: str = "grpc_asyncio", request_type=vmmigration.ListGroupsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + vmmigration.ListGroupsRequest(), + {}, + ], +) +async def test_list_groups_async(request_type, transport: str = "grpc_asyncio"): client = VmMigrationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14348,7 +14413,7 @@ async def test_list_groups_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_groups), "__call__") as call: @@ -14373,11 +14438,6 @@ async def test_list_groups_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_groups_async_from_dict(): - await test_list_groups_async(request_type=dict) - - def test_list_groups_field_headers(): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14714,8 +14774,8 @@ async def test_list_groups_async_pages(): @pytest.mark.parametrize( "request_type", [ - vmmigration.GetGroupRequest, - dict, + vmmigration.GetGroupRequest(), + {}, ], ) def test_get_group(request_type, transport: str = "grpc"): @@ -14726,7 +14786,7 @@ def test_get_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_group), "__call__") as call: @@ -14779,9 +14839,10 @@ def test_get_group_non_empty_request_with_auto_populated_field(): client.get_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmmigration.GetGroupRequest( + request_msg = vmmigration.GetGroupRequest( name="name_value", ) + assert args[0] == request_msg def test_get_group_use_cached_wrapped_rpc(): @@ -14860,9 +14921,14 @@ async def test_get_group_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_group_async( - transport: str = "grpc_asyncio", request_type=vmmigration.GetGroupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + vmmigration.GetGroupRequest(), + {}, + ], +) +async def test_get_group_async(request_type, transport: str = "grpc_asyncio"): client = VmMigrationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14870,7 +14936,7 @@ async def test_get_group_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_group), "__call__") as call: @@ -14902,11 +14968,6 @@ async def test_get_group_async( ) -@pytest.mark.asyncio -async def test_get_group_async_from_dict(): - await test_get_group_async(request_type=dict) - - def test_get_group_field_headers(): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15049,8 +15110,8 @@ async def test_get_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmmigration.CreateGroupRequest, - dict, + vmmigration.CreateGroupRequest(), + {}, ], ) def test_create_group(request_type, transport: str = "grpc"): @@ -15061,7 +15122,7 @@ def test_create_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_group), "__call__") as call: @@ -15104,11 +15165,12 @@ def test_create_group_non_empty_request_with_auto_populated_field(): client.create_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmmigration.CreateGroupRequest( + request_msg = vmmigration.CreateGroupRequest( parent="parent_value", group_id="group_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_group_use_cached_wrapped_rpc(): @@ -15199,9 +15261,14 @@ async def test_create_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_group_async( - transport: str = "grpc_asyncio", request_type=vmmigration.CreateGroupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + vmmigration.CreateGroupRequest(), + {}, + ], +) +async def test_create_group_async(request_type, transport: str = "grpc_asyncio"): client = VmMigrationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -15209,7 +15276,7 @@ async def test_create_group_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_group), "__call__") as call: @@ -15229,11 +15296,6 @@ async def test_create_group_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_group_async_from_dict(): - await test_create_group_async(request_type=dict) - - def test_create_group_field_headers(): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15400,8 +15462,8 @@ async def test_create_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmmigration.UpdateGroupRequest, - dict, + vmmigration.UpdateGroupRequest(), + {}, ], ) def test_update_group(request_type, transport: str = "grpc"): @@ -15412,7 +15474,7 @@ def test_update_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_group), "__call__") as call: @@ -15453,9 +15515,10 @@ def test_update_group_non_empty_request_with_auto_populated_field(): client.update_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmmigration.UpdateGroupRequest( + request_msg = vmmigration.UpdateGroupRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_group_use_cached_wrapped_rpc(): @@ -15546,9 +15609,14 @@ async def test_update_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_group_async( - transport: str = "grpc_asyncio", request_type=vmmigration.UpdateGroupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + vmmigration.UpdateGroupRequest(), + {}, + ], +) +async def test_update_group_async(request_type, transport: str = "grpc_asyncio"): client = VmMigrationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -15556,7 +15624,7 @@ async def test_update_group_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_group), "__call__") as call: @@ -15576,11 +15644,6 @@ async def test_update_group_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_group_async_from_dict(): - await test_update_group_async(request_type=dict) - - def test_update_group_field_headers(): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15737,8 +15800,8 @@ async def test_update_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmmigration.DeleteGroupRequest, - dict, + vmmigration.DeleteGroupRequest(), + {}, ], ) def test_delete_group(request_type, transport: str = "grpc"): @@ -15749,7 +15812,7 @@ def test_delete_group(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_group), "__call__") as call: @@ -15791,10 +15854,11 @@ def test_delete_group_non_empty_request_with_auto_populated_field(): client.delete_group(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmmigration.DeleteGroupRequest( + request_msg = vmmigration.DeleteGroupRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_group_use_cached_wrapped_rpc(): @@ -15885,9 +15949,14 @@ async def test_delete_group_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_group_async( - transport: str = "grpc_asyncio", request_type=vmmigration.DeleteGroupRequest -): +@pytest.mark.parametrize( + "request_type", + [ + vmmigration.DeleteGroupRequest(), + {}, + ], +) +async def test_delete_group_async(request_type, transport: str = "grpc_asyncio"): client = VmMigrationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -15895,7 +15964,7 @@ async def test_delete_group_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_group), "__call__") as call: @@ -15915,11 +15984,6 @@ async def test_delete_group_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_group_async_from_dict(): - await test_delete_group_async(request_type=dict) - - def test_delete_group_field_headers(): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16066,8 +16130,8 @@ async def test_delete_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmmigration.AddGroupMigrationRequest, - dict, + vmmigration.AddGroupMigrationRequest(), + {}, ], ) def test_add_group_migration(request_type, transport: str = "grpc"): @@ -16078,7 +16142,7 @@ def test_add_group_migration(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -16124,10 +16188,11 @@ def test_add_group_migration_non_empty_request_with_auto_populated_field(): client.add_group_migration(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmmigration.AddGroupMigrationRequest( + request_msg = vmmigration.AddGroupMigrationRequest( group="group_value", migrating_vm="migrating_vm_value", ) + assert args[0] == request_msg def test_add_group_migration_use_cached_wrapped_rpc(): @@ -16222,9 +16287,14 @@ async def test_add_group_migration_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_add_group_migration_async( - transport: str = "grpc_asyncio", request_type=vmmigration.AddGroupMigrationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + vmmigration.AddGroupMigrationRequest(), + {}, + ], +) +async def test_add_group_migration_async(request_type, transport: str = "grpc_asyncio"): client = VmMigrationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -16232,7 +16302,7 @@ async def test_add_group_migration_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( @@ -16254,11 +16324,6 @@ async def test_add_group_migration_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_add_group_migration_async_from_dict(): - await test_add_group_migration_async(request_type=dict) - - def test_add_group_migration_field_headers(): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16413,8 +16478,8 @@ async def test_add_group_migration_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmmigration.RemoveGroupMigrationRequest, - dict, + vmmigration.RemoveGroupMigrationRequest(), + {}, ], ) def test_remove_group_migration(request_type, transport: str = "grpc"): @@ -16425,7 +16490,7 @@ def test_remove_group_migration(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -16471,10 +16536,11 @@ def test_remove_group_migration_non_empty_request_with_auto_populated_field(): client.remove_group_migration(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmmigration.RemoveGroupMigrationRequest( + request_msg = vmmigration.RemoveGroupMigrationRequest( group="group_value", migrating_vm="migrating_vm_value", ) + assert args[0] == request_msg def test_remove_group_migration_use_cached_wrapped_rpc(): @@ -16570,9 +16636,15 @@ async def test_remove_group_migration_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmmigration.RemoveGroupMigrationRequest(), + {}, + ], +) async def test_remove_group_migration_async( - transport: str = "grpc_asyncio", - request_type=vmmigration.RemoveGroupMigrationRequest, + request_type, transport: str = "grpc_asyncio" ): client = VmMigrationAsyncClient( credentials=async_anonymous_credentials(), @@ -16581,7 +16653,7 @@ async def test_remove_group_migration_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( @@ -16603,11 +16675,6 @@ async def test_remove_group_migration_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_remove_group_migration_async_from_dict(): - await test_remove_group_migration_async(request_type=dict) - - def test_remove_group_migration_field_headers(): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16762,8 +16829,8 @@ async def test_remove_group_migration_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmmigration.ListTargetProjectsRequest, - dict, + vmmigration.ListTargetProjectsRequest(), + {}, ], ) def test_list_target_projects(request_type, transport: str = "grpc"): @@ -16774,7 +16841,7 @@ def test_list_target_projects(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -16827,12 +16894,13 @@ def test_list_target_projects_non_empty_request_with_auto_populated_field(): client.list_target_projects(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmmigration.ListTargetProjectsRequest( + request_msg = vmmigration.ListTargetProjectsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_target_projects_use_cached_wrapped_rpc(): @@ -16917,8 +16985,15 @@ async def test_list_target_projects_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmmigration.ListTargetProjectsRequest(), + {}, + ], +) async def test_list_target_projects_async( - transport: str = "grpc_asyncio", request_type=vmmigration.ListTargetProjectsRequest + request_type, transport: str = "grpc_asyncio" ): client = VmMigrationAsyncClient( credentials=async_anonymous_credentials(), @@ -16927,7 +17002,7 @@ async def test_list_target_projects_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( @@ -16954,11 +17029,6 @@ async def test_list_target_projects_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_target_projects_async_from_dict(): - await test_list_target_projects_async(request_type=dict) - - def test_list_target_projects_field_headers(): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17311,8 +17381,8 @@ async def test_list_target_projects_async_pages(): @pytest.mark.parametrize( "request_type", [ - vmmigration.GetTargetProjectRequest, - dict, + vmmigration.GetTargetProjectRequest(), + {}, ], ) def test_get_target_project(request_type, transport: str = "grpc"): @@ -17323,7 +17393,7 @@ def test_get_target_project(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -17375,9 +17445,10 @@ def test_get_target_project_non_empty_request_with_auto_populated_field(): client.get_target_project(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmmigration.GetTargetProjectRequest( + request_msg = vmmigration.GetTargetProjectRequest( name="name_value", ) + assert args[0] == request_msg def test_get_target_project_use_cached_wrapped_rpc(): @@ -17462,9 +17533,14 @@ async def test_get_target_project_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_target_project_async( - transport: str = "grpc_asyncio", request_type=vmmigration.GetTargetProjectRequest -): +@pytest.mark.parametrize( + "request_type", + [ + vmmigration.GetTargetProjectRequest(), + {}, + ], +) +async def test_get_target_project_async(request_type, transport: str = "grpc_asyncio"): client = VmMigrationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -17472,7 +17548,7 @@ async def test_get_target_project_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( @@ -17501,11 +17577,6 @@ async def test_get_target_project_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_get_target_project_async_from_dict(): - await test_get_target_project_async(request_type=dict) - - def test_get_target_project_field_headers(): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17660,8 +17731,8 @@ async def test_get_target_project_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmmigration.CreateTargetProjectRequest, - dict, + vmmigration.CreateTargetProjectRequest(), + {}, ], ) def test_create_target_project(request_type, transport: str = "grpc"): @@ -17672,7 +17743,7 @@ def test_create_target_project(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -17719,11 +17790,12 @@ def test_create_target_project_non_empty_request_with_auto_populated_field(): client.create_target_project(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmmigration.CreateTargetProjectRequest( + request_msg = vmmigration.CreateTargetProjectRequest( parent="parent_value", target_project_id="target_project_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_target_project_use_cached_wrapped_rpc(): @@ -17819,8 +17891,15 @@ async def test_create_target_project_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmmigration.CreateTargetProjectRequest(), + {}, + ], +) async def test_create_target_project_async( - transport: str = "grpc_asyncio", request_type=vmmigration.CreateTargetProjectRequest + request_type, transport: str = "grpc_asyncio" ): client = VmMigrationAsyncClient( credentials=async_anonymous_credentials(), @@ -17829,7 +17908,7 @@ async def test_create_target_project_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( @@ -17851,11 +17930,6 @@ async def test_create_target_project_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_target_project_async_from_dict(): - await test_create_target_project_async(request_type=dict) - - def test_create_target_project_field_headers(): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18030,8 +18104,8 @@ async def test_create_target_project_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmmigration.UpdateTargetProjectRequest, - dict, + vmmigration.UpdateTargetProjectRequest(), + {}, ], ) def test_update_target_project(request_type, transport: str = "grpc"): @@ -18042,7 +18116,7 @@ def test_update_target_project(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -18087,9 +18161,10 @@ def test_update_target_project_non_empty_request_with_auto_populated_field(): client.update_target_project(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmmigration.UpdateTargetProjectRequest( + request_msg = vmmigration.UpdateTargetProjectRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_target_project_use_cached_wrapped_rpc(): @@ -18185,8 +18260,15 @@ async def test_update_target_project_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmmigration.UpdateTargetProjectRequest(), + {}, + ], +) async def test_update_target_project_async( - transport: str = "grpc_asyncio", request_type=vmmigration.UpdateTargetProjectRequest + request_type, transport: str = "grpc_asyncio" ): client = VmMigrationAsyncClient( credentials=async_anonymous_credentials(), @@ -18195,7 +18277,7 @@ async def test_update_target_project_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( @@ -18217,11 +18299,6 @@ async def test_update_target_project_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_target_project_async_from_dict(): - await test_update_target_project_async(request_type=dict) - - def test_update_target_project_field_headers(): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18386,8 +18463,8 @@ async def test_update_target_project_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmmigration.DeleteTargetProjectRequest, - dict, + vmmigration.DeleteTargetProjectRequest(), + {}, ], ) def test_delete_target_project(request_type, transport: str = "grpc"): @@ -18398,7 +18475,7 @@ def test_delete_target_project(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -18444,10 +18521,11 @@ def test_delete_target_project_non_empty_request_with_auto_populated_field(): client.delete_target_project(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmmigration.DeleteTargetProjectRequest( + request_msg = vmmigration.DeleteTargetProjectRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_target_project_use_cached_wrapped_rpc(): @@ -18543,8 +18621,15 @@ async def test_delete_target_project_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmmigration.DeleteTargetProjectRequest(), + {}, + ], +) async def test_delete_target_project_async( - transport: str = "grpc_asyncio", request_type=vmmigration.DeleteTargetProjectRequest + request_type, transport: str = "grpc_asyncio" ): client = VmMigrationAsyncClient( credentials=async_anonymous_credentials(), @@ -18553,7 +18638,7 @@ async def test_delete_target_project_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( @@ -18575,11 +18660,6 @@ async def test_delete_target_project_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_target_project_async_from_dict(): - await test_delete_target_project_async(request_type=dict) - - def test_delete_target_project_field_headers(): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18734,8 +18814,8 @@ async def test_delete_target_project_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmmigration.ListReplicationCyclesRequest, - dict, + vmmigration.ListReplicationCyclesRequest(), + {}, ], ) def test_list_replication_cycles(request_type, transport: str = "grpc"): @@ -18746,7 +18826,7 @@ def test_list_replication_cycles(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -18799,12 +18879,13 @@ def test_list_replication_cycles_non_empty_request_with_auto_populated_field(): client.list_replication_cycles(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmmigration.ListReplicationCyclesRequest( + request_msg = vmmigration.ListReplicationCyclesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_replication_cycles_use_cached_wrapped_rpc(): @@ -18890,9 +18971,15 @@ async def test_list_replication_cycles_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmmigration.ListReplicationCyclesRequest(), + {}, + ], +) async def test_list_replication_cycles_async( - transport: str = "grpc_asyncio", - request_type=vmmigration.ListReplicationCyclesRequest, + request_type, transport: str = "grpc_asyncio" ): client = VmMigrationAsyncClient( credentials=async_anonymous_credentials(), @@ -18901,7 +18988,7 @@ async def test_list_replication_cycles_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( @@ -18928,11 +19015,6 @@ async def test_list_replication_cycles_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_replication_cycles_async_from_dict(): - await test_list_replication_cycles_async(request_type=dict) - - def test_list_replication_cycles_field_headers(): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -19285,8 +19367,8 @@ async def test_list_replication_cycles_async_pages(): @pytest.mark.parametrize( "request_type", [ - vmmigration.GetReplicationCycleRequest, - dict, + vmmigration.GetReplicationCycleRequest(), + {}, ], ) def test_get_replication_cycle(request_type, transport: str = "grpc"): @@ -19297,7 +19379,7 @@ def test_get_replication_cycle(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -19351,9 +19433,10 @@ def test_get_replication_cycle_non_empty_request_with_auto_populated_field(): client.get_replication_cycle(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmmigration.GetReplicationCycleRequest( + request_msg = vmmigration.GetReplicationCycleRequest( name="name_value", ) + assert args[0] == request_msg def test_get_replication_cycle_use_cached_wrapped_rpc(): @@ -19439,8 +19522,15 @@ async def test_get_replication_cycle_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmmigration.GetReplicationCycleRequest(), + {}, + ], +) async def test_get_replication_cycle_async( - transport: str = "grpc_asyncio", request_type=vmmigration.GetReplicationCycleRequest + request_type, transport: str = "grpc_asyncio" ): client = VmMigrationAsyncClient( credentials=async_anonymous_credentials(), @@ -19449,7 +19539,7 @@ async def test_get_replication_cycle_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( @@ -19480,11 +19570,6 @@ async def test_get_replication_cycle_async( assert response.state == vmmigration.ReplicationCycle.State.RUNNING -@pytest.mark.asyncio -async def test_get_replication_cycle_async_from_dict(): - await test_get_replication_cycle_async(request_type=dict) - - def test_get_replication_cycle_field_headers(): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -19639,8 +19724,8 @@ async def test_get_replication_cycle_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmmigration.ListImageImportsRequest, - dict, + vmmigration.ListImageImportsRequest(), + {}, ], ) def test_list_image_imports(request_type, transport: str = "grpc"): @@ -19651,7 +19736,7 @@ def test_list_image_imports(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -19704,12 +19789,13 @@ def test_list_image_imports_non_empty_request_with_auto_populated_field(): client.list_image_imports(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmmigration.ListImageImportsRequest( + request_msg = vmmigration.ListImageImportsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_image_imports_use_cached_wrapped_rpc(): @@ -19794,9 +19880,14 @@ async def test_list_image_imports_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_image_imports_async( - transport: str = "grpc_asyncio", request_type=vmmigration.ListImageImportsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + vmmigration.ListImageImportsRequest(), + {}, + ], +) +async def test_list_image_imports_async(request_type, transport: str = "grpc_asyncio"): client = VmMigrationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -19804,7 +19895,7 @@ async def test_list_image_imports_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( @@ -19831,11 +19922,6 @@ async def test_list_image_imports_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_image_imports_async_from_dict(): - await test_list_image_imports_async(request_type=dict) - - def test_list_image_imports_field_headers(): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -20188,8 +20274,8 @@ async def test_list_image_imports_async_pages(): @pytest.mark.parametrize( "request_type", [ - vmmigration.GetImageImportRequest, - dict, + vmmigration.GetImageImportRequest(), + {}, ], ) def test_get_image_import(request_type, transport: str = "grpc"): @@ -20200,7 +20286,7 @@ def test_get_image_import(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_image_import), "__call__") as call: @@ -20245,9 +20331,10 @@ def test_get_image_import_non_empty_request_with_auto_populated_field(): client.get_image_import(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmmigration.GetImageImportRequest( + request_msg = vmmigration.GetImageImportRequest( name="name_value", ) + assert args[0] == request_msg def test_get_image_import_use_cached_wrapped_rpc(): @@ -20330,9 +20417,14 @@ async def test_get_image_import_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_image_import_async( - transport: str = "grpc_asyncio", request_type=vmmigration.GetImageImportRequest -): +@pytest.mark.parametrize( + "request_type", + [ + vmmigration.GetImageImportRequest(), + {}, + ], +) +async def test_get_image_import_async(request_type, transport: str = "grpc_asyncio"): client = VmMigrationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -20340,7 +20432,7 @@ async def test_get_image_import_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_image_import), "__call__") as call: @@ -20363,11 +20455,6 @@ async def test_get_image_import_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_image_import_async_from_dict(): - await test_get_image_import_async(request_type=dict) - - def test_get_image_import_field_headers(): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -20514,8 +20601,8 @@ async def test_get_image_import_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmmigration.CreateImageImportRequest, - dict, + vmmigration.CreateImageImportRequest(), + {}, ], ) def test_create_image_import(request_type, transport: str = "grpc"): @@ -20526,7 +20613,7 @@ def test_create_image_import(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -20573,11 +20660,12 @@ def test_create_image_import_non_empty_request_with_auto_populated_field(): client.create_image_import(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmmigration.CreateImageImportRequest( + request_msg = vmmigration.CreateImageImportRequest( parent="parent_value", image_import_id="image_import_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_image_import_use_cached_wrapped_rpc(): @@ -20672,9 +20760,14 @@ async def test_create_image_import_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_image_import_async( - transport: str = "grpc_asyncio", request_type=vmmigration.CreateImageImportRequest -): +@pytest.mark.parametrize( + "request_type", + [ + vmmigration.CreateImageImportRequest(), + {}, + ], +) +async def test_create_image_import_async(request_type, transport: str = "grpc_asyncio"): client = VmMigrationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -20682,7 +20775,7 @@ async def test_create_image_import_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( @@ -20704,11 +20797,6 @@ async def test_create_image_import_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_image_import_async_from_dict(): - await test_create_image_import_async(request_type=dict) - - def test_create_image_import_field_headers(): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -20891,8 +20979,8 @@ async def test_create_image_import_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmmigration.DeleteImageImportRequest, - dict, + vmmigration.DeleteImageImportRequest(), + {}, ], ) def test_delete_image_import(request_type, transport: str = "grpc"): @@ -20903,7 +20991,7 @@ def test_delete_image_import(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -20949,10 +21037,11 @@ def test_delete_image_import_non_empty_request_with_auto_populated_field(): client.delete_image_import(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmmigration.DeleteImageImportRequest( + request_msg = vmmigration.DeleteImageImportRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_image_import_use_cached_wrapped_rpc(): @@ -21047,9 +21136,14 @@ async def test_delete_image_import_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_image_import_async( - transport: str = "grpc_asyncio", request_type=vmmigration.DeleteImageImportRequest -): +@pytest.mark.parametrize( + "request_type", + [ + vmmigration.DeleteImageImportRequest(), + {}, + ], +) +async def test_delete_image_import_async(request_type, transport: str = "grpc_asyncio"): client = VmMigrationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -21057,7 +21151,7 @@ async def test_delete_image_import_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( @@ -21079,11 +21173,6 @@ async def test_delete_image_import_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_image_import_async_from_dict(): - await test_delete_image_import_async(request_type=dict) - - def test_delete_image_import_field_headers(): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -21238,8 +21327,8 @@ async def test_delete_image_import_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmmigration.ListImageImportJobsRequest, - dict, + vmmigration.ListImageImportJobsRequest(), + {}, ], ) def test_list_image_import_jobs(request_type, transport: str = "grpc"): @@ -21250,7 +21339,7 @@ def test_list_image_import_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( @@ -21303,12 +21392,13 @@ def test_list_image_import_jobs_non_empty_request_with_auto_populated_field(): client.list_image_import_jobs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmmigration.ListImageImportJobsRequest( + request_msg = vmmigration.ListImageImportJobsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_image_import_jobs_use_cached_wrapped_rpc(): @@ -21394,8 +21484,15 @@ async def test_list_image_import_jobs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmmigration.ListImageImportJobsRequest(), + {}, + ], +) async def test_list_image_import_jobs_async( - transport: str = "grpc_asyncio", request_type=vmmigration.ListImageImportJobsRequest + request_type, transport: str = "grpc_asyncio" ): client = VmMigrationAsyncClient( credentials=async_anonymous_credentials(), @@ -21404,7 +21501,7 @@ async def test_list_image_import_jobs_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( @@ -21431,11 +21528,6 @@ async def test_list_image_import_jobs_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_image_import_jobs_async_from_dict(): - await test_list_image_import_jobs_async(request_type=dict) - - def test_list_image_import_jobs_field_headers(): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -21788,8 +21880,8 @@ async def test_list_image_import_jobs_async_pages(): @pytest.mark.parametrize( "request_type", [ - vmmigration.GetImageImportJobRequest, - dict, + vmmigration.GetImageImportJobRequest(), + {}, ], ) def test_get_image_import_job(request_type, transport: str = "grpc"): @@ -21800,7 +21892,7 @@ def test_get_image_import_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( @@ -21853,9 +21945,10 @@ def test_get_image_import_job_non_empty_request_with_auto_populated_field(): client.get_image_import_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmmigration.GetImageImportJobRequest( + request_msg = vmmigration.GetImageImportJobRequest( name="name_value", ) + assert args[0] == request_msg def test_get_image_import_job_use_cached_wrapped_rpc(): @@ -21940,8 +22033,15 @@ async def test_get_image_import_job_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmmigration.GetImageImportJobRequest(), + {}, + ], +) async def test_get_image_import_job_async( - transport: str = "grpc_asyncio", request_type=vmmigration.GetImageImportJobRequest + request_type, transport: str = "grpc_asyncio" ): client = VmMigrationAsyncClient( credentials=async_anonymous_credentials(), @@ -21950,7 +22050,7 @@ async def test_get_image_import_job_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( @@ -21979,11 +22079,6 @@ async def test_get_image_import_job_async( assert response.state == vmmigration.ImageImportJob.State.PENDING -@pytest.mark.asyncio -async def test_get_image_import_job_async_from_dict(): - await test_get_image_import_job_async(request_type=dict) - - def test_get_image_import_job_field_headers(): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -22138,8 +22233,8 @@ async def test_get_image_import_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmmigration.CancelImageImportJobRequest, - dict, + vmmigration.CancelImageImportJobRequest(), + {}, ], ) def test_cancel_image_import_job(request_type, transport: str = "grpc"): @@ -22150,7 +22245,7 @@ def test_cancel_image_import_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( @@ -22195,9 +22290,10 @@ def test_cancel_image_import_job_non_empty_request_with_auto_populated_field(): client.cancel_image_import_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmmigration.CancelImageImportJobRequest( + request_msg = vmmigration.CancelImageImportJobRequest( name="name_value", ) + assert args[0] == request_msg def test_cancel_image_import_job_use_cached_wrapped_rpc(): @@ -22293,9 +22389,15 @@ async def test_cancel_image_import_job_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmmigration.CancelImageImportJobRequest(), + {}, + ], +) async def test_cancel_image_import_job_async( - transport: str = "grpc_asyncio", - request_type=vmmigration.CancelImageImportJobRequest, + request_type, transport: str = "grpc_asyncio" ): client = VmMigrationAsyncClient( credentials=async_anonymous_credentials(), @@ -22304,7 +22406,7 @@ async def test_cancel_image_import_job_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( @@ -22326,11 +22428,6 @@ async def test_cancel_image_import_job_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_cancel_image_import_job_async_from_dict(): - await test_cancel_image_import_job_async(request_type=dict) - - def test_cancel_image_import_job_field_headers(): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -22485,8 +22582,8 @@ async def test_cancel_image_import_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmmigration.CreateDiskMigrationJobRequest, - dict, + vmmigration.CreateDiskMigrationJobRequest(), + {}, ], ) def test_create_disk_migration_job(request_type, transport: str = "grpc"): @@ -22497,7 +22594,7 @@ def test_create_disk_migration_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( @@ -22543,10 +22640,11 @@ def test_create_disk_migration_job_non_empty_request_with_auto_populated_field() client.create_disk_migration_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmmigration.CreateDiskMigrationJobRequest( + request_msg = vmmigration.CreateDiskMigrationJobRequest( parent="parent_value", disk_migration_job_id="disk_migration_job_id_value", ) + assert args[0] == request_msg def test_create_disk_migration_job_use_cached_wrapped_rpc(): @@ -22642,9 +22740,15 @@ async def test_create_disk_migration_job_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmmigration.CreateDiskMigrationJobRequest(), + {}, + ], +) async def test_create_disk_migration_job_async( - transport: str = "grpc_asyncio", - request_type=vmmigration.CreateDiskMigrationJobRequest, + request_type, transport: str = "grpc_asyncio" ): client = VmMigrationAsyncClient( credentials=async_anonymous_credentials(), @@ -22653,7 +22757,7 @@ async def test_create_disk_migration_job_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( @@ -22675,11 +22779,6 @@ async def test_create_disk_migration_job_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_disk_migration_job_async_from_dict(): - await test_create_disk_migration_job_async(request_type=dict) - - def test_create_disk_migration_job_field_headers(): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -22878,8 +22977,8 @@ async def test_create_disk_migration_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmmigration.ListDiskMigrationJobsRequest, - dict, + vmmigration.ListDiskMigrationJobsRequest(), + {}, ], ) def test_list_disk_migration_jobs(request_type, transport: str = "grpc"): @@ -22890,7 +22989,7 @@ def test_list_disk_migration_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( @@ -22943,12 +23042,13 @@ def test_list_disk_migration_jobs_non_empty_request_with_auto_populated_field(): client.list_disk_migration_jobs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmmigration.ListDiskMigrationJobsRequest( + request_msg = vmmigration.ListDiskMigrationJobsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_disk_migration_jobs_use_cached_wrapped_rpc(): @@ -23034,9 +23134,15 @@ async def test_list_disk_migration_jobs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmmigration.ListDiskMigrationJobsRequest(), + {}, + ], +) async def test_list_disk_migration_jobs_async( - transport: str = "grpc_asyncio", - request_type=vmmigration.ListDiskMigrationJobsRequest, + request_type, transport: str = "grpc_asyncio" ): client = VmMigrationAsyncClient( credentials=async_anonymous_credentials(), @@ -23045,7 +23151,7 @@ async def test_list_disk_migration_jobs_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( @@ -23072,11 +23178,6 @@ async def test_list_disk_migration_jobs_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_disk_migration_jobs_async_from_dict(): - await test_list_disk_migration_jobs_async(request_type=dict) - - def test_list_disk_migration_jobs_field_headers(): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -23431,8 +23532,8 @@ async def test_list_disk_migration_jobs_async_pages(): @pytest.mark.parametrize( "request_type", [ - vmmigration.GetDiskMigrationJobRequest, - dict, + vmmigration.GetDiskMigrationJobRequest(), + {}, ], ) def test_get_disk_migration_job(request_type, transport: str = "grpc"): @@ -23443,7 +23544,7 @@ def test_get_disk_migration_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( @@ -23493,9 +23594,10 @@ def test_get_disk_migration_job_non_empty_request_with_auto_populated_field(): client.get_disk_migration_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmmigration.GetDiskMigrationJobRequest( + request_msg = vmmigration.GetDiskMigrationJobRequest( name="name_value", ) + assert args[0] == request_msg def test_get_disk_migration_job_use_cached_wrapped_rpc(): @@ -23581,8 +23683,15 @@ async def test_get_disk_migration_job_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmmigration.GetDiskMigrationJobRequest(), + {}, + ], +) async def test_get_disk_migration_job_async( - transport: str = "grpc_asyncio", request_type=vmmigration.GetDiskMigrationJobRequest + request_type, transport: str = "grpc_asyncio" ): client = VmMigrationAsyncClient( credentials=async_anonymous_credentials(), @@ -23591,7 +23700,7 @@ async def test_get_disk_migration_job_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( @@ -23618,11 +23727,6 @@ async def test_get_disk_migration_job_async( assert response.state == vmmigration.DiskMigrationJob.State.READY -@pytest.mark.asyncio -async def test_get_disk_migration_job_async_from_dict(): - await test_get_disk_migration_job_async(request_type=dict) - - def test_get_disk_migration_job_field_headers(): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -23777,8 +23881,8 @@ async def test_get_disk_migration_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmmigration.UpdateDiskMigrationJobRequest, - dict, + vmmigration.UpdateDiskMigrationJobRequest(), + {}, ], ) def test_update_disk_migration_job(request_type, transport: str = "grpc"): @@ -23789,7 +23893,7 @@ def test_update_disk_migration_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( @@ -23832,7 +23936,8 @@ def test_update_disk_migration_job_non_empty_request_with_auto_populated_field() client.update_disk_migration_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmmigration.UpdateDiskMigrationJobRequest() + request_msg = vmmigration.UpdateDiskMigrationJobRequest() + assert args[0] == request_msg def test_update_disk_migration_job_use_cached_wrapped_rpc(): @@ -23928,9 +24033,15 @@ async def test_update_disk_migration_job_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmmigration.UpdateDiskMigrationJobRequest(), + {}, + ], +) async def test_update_disk_migration_job_async( - transport: str = "grpc_asyncio", - request_type=vmmigration.UpdateDiskMigrationJobRequest, + request_type, transport: str = "grpc_asyncio" ): client = VmMigrationAsyncClient( credentials=async_anonymous_credentials(), @@ -23939,7 +24050,7 @@ async def test_update_disk_migration_job_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( @@ -23961,11 +24072,6 @@ async def test_update_disk_migration_job_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_disk_migration_job_async_from_dict(): - await test_update_disk_migration_job_async(request_type=dict) - - def test_update_disk_migration_job_field_headers(): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -24154,8 +24260,8 @@ async def test_update_disk_migration_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmmigration.DeleteDiskMigrationJobRequest, - dict, + vmmigration.DeleteDiskMigrationJobRequest(), + {}, ], ) def test_delete_disk_migration_job(request_type, transport: str = "grpc"): @@ -24166,7 +24272,7 @@ def test_delete_disk_migration_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( @@ -24211,9 +24317,10 @@ def test_delete_disk_migration_job_non_empty_request_with_auto_populated_field() client.delete_disk_migration_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmmigration.DeleteDiskMigrationJobRequest( + request_msg = vmmigration.DeleteDiskMigrationJobRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_disk_migration_job_use_cached_wrapped_rpc(): @@ -24309,9 +24416,15 @@ async def test_delete_disk_migration_job_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmmigration.DeleteDiskMigrationJobRequest(), + {}, + ], +) async def test_delete_disk_migration_job_async( - transport: str = "grpc_asyncio", - request_type=vmmigration.DeleteDiskMigrationJobRequest, + request_type, transport: str = "grpc_asyncio" ): client = VmMigrationAsyncClient( credentials=async_anonymous_credentials(), @@ -24320,7 +24433,7 @@ async def test_delete_disk_migration_job_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( @@ -24342,11 +24455,6 @@ async def test_delete_disk_migration_job_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_disk_migration_job_async_from_dict(): - await test_delete_disk_migration_job_async(request_type=dict) - - def test_delete_disk_migration_job_field_headers(): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -24501,8 +24609,8 @@ async def test_delete_disk_migration_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmmigration.RunDiskMigrationJobRequest, - dict, + vmmigration.RunDiskMigrationJobRequest(), + {}, ], ) def test_run_disk_migration_job(request_type, transport: str = "grpc"): @@ -24513,7 +24621,7 @@ def test_run_disk_migration_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( @@ -24558,9 +24666,10 @@ def test_run_disk_migration_job_non_empty_request_with_auto_populated_field(): client.run_disk_migration_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmmigration.RunDiskMigrationJobRequest( + request_msg = vmmigration.RunDiskMigrationJobRequest( name="name_value", ) + assert args[0] == request_msg def test_run_disk_migration_job_use_cached_wrapped_rpc(): @@ -24656,8 +24765,15 @@ async def test_run_disk_migration_job_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmmigration.RunDiskMigrationJobRequest(), + {}, + ], +) async def test_run_disk_migration_job_async( - transport: str = "grpc_asyncio", request_type=vmmigration.RunDiskMigrationJobRequest + request_type, transport: str = "grpc_asyncio" ): client = VmMigrationAsyncClient( credentials=async_anonymous_credentials(), @@ -24666,7 +24782,7 @@ async def test_run_disk_migration_job_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( @@ -24688,11 +24804,6 @@ async def test_run_disk_migration_job_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_run_disk_migration_job_async_from_dict(): - await test_run_disk_migration_job_async(request_type=dict) - - def test_run_disk_migration_job_field_headers(): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -24847,8 +24958,8 @@ async def test_run_disk_migration_job_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmmigration.CancelDiskMigrationJobRequest, - dict, + vmmigration.CancelDiskMigrationJobRequest(), + {}, ], ) def test_cancel_disk_migration_job(request_type, transport: str = "grpc"): @@ -24859,7 +24970,7 @@ def test_cancel_disk_migration_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( @@ -24904,9 +25015,10 @@ def test_cancel_disk_migration_job_non_empty_request_with_auto_populated_field() client.cancel_disk_migration_job(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmmigration.CancelDiskMigrationJobRequest( + request_msg = vmmigration.CancelDiskMigrationJobRequest( name="name_value", ) + assert args[0] == request_msg def test_cancel_disk_migration_job_use_cached_wrapped_rpc(): @@ -25002,9 +25114,15 @@ async def test_cancel_disk_migration_job_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmmigration.CancelDiskMigrationJobRequest(), + {}, + ], +) async def test_cancel_disk_migration_job_async( - transport: str = "grpc_asyncio", - request_type=vmmigration.CancelDiskMigrationJobRequest, + request_type, transport: str = "grpc_asyncio" ): client = VmMigrationAsyncClient( credentials=async_anonymous_credentials(), @@ -25013,7 +25131,7 @@ async def test_cancel_disk_migration_job_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( @@ -25035,11 +25153,6 @@ async def test_cancel_disk_migration_job_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_cancel_disk_migration_job_async_from_dict(): - await test_cancel_disk_migration_job_async(request_type=dict) - - def test_cancel_disk_migration_job_field_headers(): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -38019,7 +38132,6 @@ def test_list_sources_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.ListSourcesRequest() - assert args[0] == request_msg @@ -38040,7 +38152,6 @@ def test_get_source_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.GetSourceRequest() - assert args[0] == request_msg @@ -38061,7 +38172,6 @@ def test_create_source_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.CreateSourceRequest() - assert args[0] == request_msg @@ -38082,7 +38192,6 @@ def test_update_source_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.UpdateSourceRequest() - assert args[0] == request_msg @@ -38103,7 +38212,6 @@ def test_delete_source_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.DeleteSourceRequest() - assert args[0] == request_msg @@ -38124,7 +38232,6 @@ def test_fetch_inventory_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.FetchInventoryRequest() - assert args[0] == request_msg @@ -38147,7 +38254,6 @@ def test_fetch_storage_inventory_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.FetchStorageInventoryRequest() - assert args[0] == request_msg @@ -38170,7 +38276,6 @@ def test_list_utilization_reports_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.ListUtilizationReportsRequest() - assert args[0] == request_msg @@ -38193,7 +38298,6 @@ def test_get_utilization_report_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.GetUtilizationReportRequest() - assert args[0] == request_msg @@ -38216,7 +38320,6 @@ def test_create_utilization_report_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.CreateUtilizationReportRequest() - assert args[0] == request_msg @@ -38239,7 +38342,6 @@ def test_delete_utilization_report_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.DeleteUtilizationReportRequest() - assert args[0] == request_msg @@ -38262,7 +38364,6 @@ def test_list_datacenter_connectors_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.ListDatacenterConnectorsRequest() - assert args[0] == request_msg @@ -38285,7 +38386,6 @@ def test_get_datacenter_connector_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.GetDatacenterConnectorRequest() - assert args[0] == request_msg @@ -38308,7 +38408,6 @@ def test_create_datacenter_connector_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.CreateDatacenterConnectorRequest() - assert args[0] == request_msg @@ -38331,7 +38430,6 @@ def test_delete_datacenter_connector_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.DeleteDatacenterConnectorRequest() - assert args[0] == request_msg @@ -38354,7 +38452,6 @@ def test_upgrade_appliance_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.UpgradeApplianceRequest() - assert args[0] == request_msg @@ -38377,7 +38474,6 @@ def test_create_migrating_vm_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.CreateMigratingVmRequest() - assert args[0] == request_msg @@ -38400,7 +38496,6 @@ def test_list_migrating_vms_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.ListMigratingVmsRequest() - assert args[0] == request_msg @@ -38421,7 +38516,6 @@ def test_get_migrating_vm_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.GetMigratingVmRequest() - assert args[0] == request_msg @@ -38444,7 +38538,6 @@ def test_update_migrating_vm_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.UpdateMigratingVmRequest() - assert args[0] == request_msg @@ -38467,7 +38560,6 @@ def test_delete_migrating_vm_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.DeleteMigratingVmRequest() - assert args[0] == request_msg @@ -38488,7 +38580,6 @@ def test_start_migration_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.StartMigrationRequest() - assert args[0] == request_msg @@ -38509,7 +38600,6 @@ def test_resume_migration_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.ResumeMigrationRequest() - assert args[0] == request_msg @@ -38530,7 +38620,6 @@ def test_pause_migration_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.PauseMigrationRequest() - assert args[0] == request_msg @@ -38553,7 +38642,6 @@ def test_finalize_migration_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.FinalizeMigrationRequest() - assert args[0] == request_msg @@ -38574,7 +38662,6 @@ def test_extend_migration_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.ExtendMigrationRequest() - assert args[0] == request_msg @@ -38595,7 +38682,6 @@ def test_create_clone_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.CreateCloneJobRequest() - assert args[0] == request_msg @@ -38616,7 +38702,6 @@ def test_cancel_clone_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.CancelCloneJobRequest() - assert args[0] == request_msg @@ -38637,7 +38722,6 @@ def test_list_clone_jobs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.ListCloneJobsRequest() - assert args[0] == request_msg @@ -38658,7 +38742,6 @@ def test_get_clone_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.GetCloneJobRequest() - assert args[0] == request_msg @@ -38681,7 +38764,6 @@ def test_create_cutover_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.CreateCutoverJobRequest() - assert args[0] == request_msg @@ -38704,7 +38786,6 @@ def test_cancel_cutover_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.CancelCutoverJobRequest() - assert args[0] == request_msg @@ -38727,7 +38808,6 @@ def test_list_cutover_jobs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.ListCutoverJobsRequest() - assert args[0] == request_msg @@ -38748,7 +38828,6 @@ def test_get_cutover_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.GetCutoverJobRequest() - assert args[0] == request_msg @@ -38769,7 +38848,6 @@ def test_list_groups_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.ListGroupsRequest() - assert args[0] == request_msg @@ -38790,7 +38868,6 @@ def test_get_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.GetGroupRequest() - assert args[0] == request_msg @@ -38811,7 +38888,6 @@ def test_create_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.CreateGroupRequest() - assert args[0] == request_msg @@ -38832,7 +38908,6 @@ def test_update_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.UpdateGroupRequest() - assert args[0] == request_msg @@ -38853,7 +38928,6 @@ def test_delete_group_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.DeleteGroupRequest() - assert args[0] == request_msg @@ -38876,7 +38950,6 @@ def test_add_group_migration_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.AddGroupMigrationRequest() - assert args[0] == request_msg @@ -38899,7 +38972,6 @@ def test_remove_group_migration_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.RemoveGroupMigrationRequest() - assert args[0] == request_msg @@ -38922,7 +38994,6 @@ def test_list_target_projects_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.ListTargetProjectsRequest() - assert args[0] == request_msg @@ -38945,7 +39016,6 @@ def test_get_target_project_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.GetTargetProjectRequest() - assert args[0] == request_msg @@ -38968,7 +39038,6 @@ def test_create_target_project_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.CreateTargetProjectRequest() - assert args[0] == request_msg @@ -38991,7 +39060,6 @@ def test_update_target_project_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.UpdateTargetProjectRequest() - assert args[0] == request_msg @@ -39014,7 +39082,6 @@ def test_delete_target_project_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.DeleteTargetProjectRequest() - assert args[0] == request_msg @@ -39037,7 +39104,6 @@ def test_list_replication_cycles_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.ListReplicationCyclesRequest() - assert args[0] == request_msg @@ -39060,7 +39126,6 @@ def test_get_replication_cycle_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.GetReplicationCycleRequest() - assert args[0] == request_msg @@ -39083,7 +39148,6 @@ def test_list_image_imports_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.ListImageImportsRequest() - assert args[0] == request_msg @@ -39104,7 +39168,6 @@ def test_get_image_import_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.GetImageImportRequest() - assert args[0] == request_msg @@ -39127,7 +39190,6 @@ def test_create_image_import_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.CreateImageImportRequest() - assert args[0] == request_msg @@ -39150,7 +39212,6 @@ def test_delete_image_import_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.DeleteImageImportRequest() - assert args[0] == request_msg @@ -39173,7 +39234,6 @@ def test_list_image_import_jobs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.ListImageImportJobsRequest() - assert args[0] == request_msg @@ -39196,7 +39256,6 @@ def test_get_image_import_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.GetImageImportJobRequest() - assert args[0] == request_msg @@ -39219,7 +39278,6 @@ def test_cancel_image_import_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.CancelImageImportJobRequest() - assert args[0] == request_msg @@ -39242,7 +39300,6 @@ def test_create_disk_migration_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.CreateDiskMigrationJobRequest() - assert args[0] == request_msg @@ -39265,7 +39322,6 @@ def test_list_disk_migration_jobs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.ListDiskMigrationJobsRequest() - assert args[0] == request_msg @@ -39288,7 +39344,6 @@ def test_get_disk_migration_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.GetDiskMigrationJobRequest() - assert args[0] == request_msg @@ -39311,7 +39366,6 @@ def test_update_disk_migration_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.UpdateDiskMigrationJobRequest() - assert args[0] == request_msg @@ -39334,7 +39388,6 @@ def test_delete_disk_migration_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.DeleteDiskMigrationJobRequest() - assert args[0] == request_msg @@ -39357,7 +39410,6 @@ def test_run_disk_migration_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.RunDiskMigrationJobRequest() - assert args[0] == request_msg @@ -39380,7 +39432,6 @@ def test_cancel_disk_migration_job_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.CancelDiskMigrationJobRequest() - assert args[0] == request_msg @@ -39422,7 +39473,6 @@ async def test_list_sources_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.ListSourcesRequest() - assert args[0] == request_msg @@ -39450,7 +39500,6 @@ async def test_get_source_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.GetSourceRequest() - assert args[0] == request_msg @@ -39475,7 +39524,6 @@ async def test_create_source_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.CreateSourceRequest() - assert args[0] == request_msg @@ -39500,7 +39548,6 @@ async def test_update_source_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.UpdateSourceRequest() - assert args[0] == request_msg @@ -39525,7 +39572,6 @@ async def test_delete_source_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.DeleteSourceRequest() - assert args[0] == request_msg @@ -39550,7 +39596,6 @@ async def test_fetch_inventory_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.FetchInventoryRequest() - assert args[0] == request_msg @@ -39579,7 +39624,6 @@ async def test_fetch_storage_inventory_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.FetchStorageInventoryRequest() - assert args[0] == request_msg @@ -39609,7 +39653,6 @@ async def test_list_utilization_reports_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.ListUtilizationReportsRequest() - assert args[0] == request_msg @@ -39642,7 +39685,6 @@ async def test_get_utilization_report_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.GetUtilizationReportRequest() - assert args[0] == request_msg @@ -39669,7 +39711,6 @@ async def test_create_utilization_report_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.CreateUtilizationReportRequest() - assert args[0] == request_msg @@ -39696,7 +39737,6 @@ async def test_delete_utilization_report_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.DeleteUtilizationReportRequest() - assert args[0] == request_msg @@ -39726,7 +39766,6 @@ async def test_list_datacenter_connectors_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.ListDatacenterConnectorsRequest() - assert args[0] == request_msg @@ -39762,7 +39801,6 @@ async def test_get_datacenter_connector_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.GetDatacenterConnectorRequest() - assert args[0] == request_msg @@ -39789,7 +39827,6 @@ async def test_create_datacenter_connector_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.CreateDatacenterConnectorRequest() - assert args[0] == request_msg @@ -39816,7 +39853,6 @@ async def test_delete_datacenter_connector_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.DeleteDatacenterConnectorRequest() - assert args[0] == request_msg @@ -39843,7 +39879,6 @@ async def test_upgrade_appliance_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.UpgradeApplianceRequest() - assert args[0] == request_msg @@ -39870,7 +39905,6 @@ async def test_create_migrating_vm_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.CreateMigratingVmRequest() - assert args[0] == request_msg @@ -39900,7 +39934,6 @@ async def test_list_migrating_vms_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.ListMigratingVmsRequest() - assert args[0] == request_msg @@ -39932,7 +39965,6 @@ async def test_get_migrating_vm_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.GetMigratingVmRequest() - assert args[0] == request_msg @@ -39959,7 +39991,6 @@ async def test_update_migrating_vm_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.UpdateMigratingVmRequest() - assert args[0] == request_msg @@ -39986,7 +40017,6 @@ async def test_delete_migrating_vm_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.DeleteMigratingVmRequest() - assert args[0] == request_msg @@ -40011,7 +40041,6 @@ async def test_start_migration_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.StartMigrationRequest() - assert args[0] == request_msg @@ -40036,7 +40065,6 @@ async def test_resume_migration_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.ResumeMigrationRequest() - assert args[0] == request_msg @@ -40061,7 +40089,6 @@ async def test_pause_migration_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.PauseMigrationRequest() - assert args[0] == request_msg @@ -40088,7 +40115,6 @@ async def test_finalize_migration_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.FinalizeMigrationRequest() - assert args[0] == request_msg @@ -40113,7 +40139,6 @@ async def test_extend_migration_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.ExtendMigrationRequest() - assert args[0] == request_msg @@ -40138,7 +40163,6 @@ async def test_create_clone_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.CreateCloneJobRequest() - assert args[0] == request_msg @@ -40163,7 +40187,6 @@ async def test_cancel_clone_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.CancelCloneJobRequest() - assert args[0] == request_msg @@ -40191,7 +40214,6 @@ async def test_list_clone_jobs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.ListCloneJobsRequest() - assert args[0] == request_msg @@ -40219,7 +40241,6 @@ async def test_get_clone_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.GetCloneJobRequest() - assert args[0] == request_msg @@ -40246,7 +40267,6 @@ async def test_create_cutover_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.CreateCutoverJobRequest() - assert args[0] == request_msg @@ -40273,7 +40293,6 @@ async def test_cancel_cutover_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.CancelCutoverJobRequest() - assert args[0] == request_msg @@ -40303,7 +40322,6 @@ async def test_list_cutover_jobs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.ListCutoverJobsRequest() - assert args[0] == request_msg @@ -40333,7 +40351,6 @@ async def test_get_cutover_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.GetCutoverJobRequest() - assert args[0] == request_msg @@ -40361,7 +40378,6 @@ async def test_list_groups_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.ListGroupsRequest() - assert args[0] == request_msg @@ -40391,7 +40407,6 @@ async def test_get_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.GetGroupRequest() - assert args[0] == request_msg @@ -40416,7 +40431,6 @@ async def test_create_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.CreateGroupRequest() - assert args[0] == request_msg @@ -40441,7 +40455,6 @@ async def test_update_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.UpdateGroupRequest() - assert args[0] == request_msg @@ -40466,7 +40479,6 @@ async def test_delete_group_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.DeleteGroupRequest() - assert args[0] == request_msg @@ -40493,7 +40505,6 @@ async def test_add_group_migration_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.AddGroupMigrationRequest() - assert args[0] == request_msg @@ -40520,7 +40531,6 @@ async def test_remove_group_migration_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.RemoveGroupMigrationRequest() - assert args[0] == request_msg @@ -40550,7 +40560,6 @@ async def test_list_target_projects_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.ListTargetProjectsRequest() - assert args[0] == request_msg @@ -40581,7 +40590,6 @@ async def test_get_target_project_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.GetTargetProjectRequest() - assert args[0] == request_msg @@ -40608,7 +40616,6 @@ async def test_create_target_project_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.CreateTargetProjectRequest() - assert args[0] == request_msg @@ -40635,7 +40642,6 @@ async def test_update_target_project_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.UpdateTargetProjectRequest() - assert args[0] == request_msg @@ -40662,7 +40668,6 @@ async def test_delete_target_project_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.DeleteTargetProjectRequest() - assert args[0] == request_msg @@ -40692,7 +40697,6 @@ async def test_list_replication_cycles_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.ListReplicationCyclesRequest() - assert args[0] == request_msg @@ -40724,7 +40728,6 @@ async def test_get_replication_cycle_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.GetReplicationCycleRequest() - assert args[0] == request_msg @@ -40754,7 +40757,6 @@ async def test_list_image_imports_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.ListImageImportsRequest() - assert args[0] == request_msg @@ -40781,7 +40783,6 @@ async def test_get_image_import_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.GetImageImportRequest() - assert args[0] == request_msg @@ -40808,7 +40809,6 @@ async def test_create_image_import_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.CreateImageImportRequest() - assert args[0] == request_msg @@ -40835,7 +40835,6 @@ async def test_delete_image_import_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.DeleteImageImportRequest() - assert args[0] == request_msg @@ -40865,7 +40864,6 @@ async def test_list_image_import_jobs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.ListImageImportJobsRequest() - assert args[0] == request_msg @@ -40896,7 +40894,6 @@ async def test_get_image_import_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.GetImageImportJobRequest() - assert args[0] == request_msg @@ -40923,7 +40920,6 @@ async def test_cancel_image_import_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.CancelImageImportJobRequest() - assert args[0] == request_msg @@ -40950,7 +40946,6 @@ async def test_create_disk_migration_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.CreateDiskMigrationJobRequest() - assert args[0] == request_msg @@ -40980,7 +40975,6 @@ async def test_list_disk_migration_jobs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.ListDiskMigrationJobsRequest() - assert args[0] == request_msg @@ -41010,7 +41004,6 @@ async def test_get_disk_migration_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.GetDiskMigrationJobRequest() - assert args[0] == request_msg @@ -41037,7 +41030,6 @@ async def test_update_disk_migration_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.UpdateDiskMigrationJobRequest() - assert args[0] == request_msg @@ -41064,7 +41056,6 @@ async def test_delete_disk_migration_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.DeleteDiskMigrationJobRequest() - assert args[0] == request_msg @@ -41091,7 +41082,6 @@ async def test_run_disk_migration_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.RunDiskMigrationJobRequest() - assert args[0] == request_msg @@ -41118,7 +41108,6 @@ async def test_cancel_disk_migration_job_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.CancelDiskMigrationJobRequest() - assert args[0] == request_msg @@ -51924,7 +51913,6 @@ def test_list_sources_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.ListSourcesRequest() - assert args[0] == request_msg @@ -51944,7 +51932,6 @@ def test_get_source_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.GetSourceRequest() - assert args[0] == request_msg @@ -51964,7 +51951,6 @@ def test_create_source_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.CreateSourceRequest() - assert args[0] == request_msg @@ -51984,7 +51970,6 @@ def test_update_source_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.UpdateSourceRequest() - assert args[0] == request_msg @@ -52004,7 +51989,6 @@ def test_delete_source_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.DeleteSourceRequest() - assert args[0] == request_msg @@ -52024,7 +52008,6 @@ def test_fetch_inventory_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.FetchInventoryRequest() - assert args[0] == request_msg @@ -52046,7 +52029,6 @@ def test_fetch_storage_inventory_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.FetchStorageInventoryRequest() - assert args[0] == request_msg @@ -52068,7 +52050,6 @@ def test_list_utilization_reports_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.ListUtilizationReportsRequest() - assert args[0] == request_msg @@ -52090,7 +52071,6 @@ def test_get_utilization_report_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.GetUtilizationReportRequest() - assert args[0] == request_msg @@ -52112,7 +52092,6 @@ def test_create_utilization_report_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.CreateUtilizationReportRequest() - assert args[0] == request_msg @@ -52134,7 +52113,6 @@ def test_delete_utilization_report_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.DeleteUtilizationReportRequest() - assert args[0] == request_msg @@ -52156,7 +52134,6 @@ def test_list_datacenter_connectors_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.ListDatacenterConnectorsRequest() - assert args[0] == request_msg @@ -52178,7 +52155,6 @@ def test_get_datacenter_connector_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.GetDatacenterConnectorRequest() - assert args[0] == request_msg @@ -52200,7 +52176,6 @@ def test_create_datacenter_connector_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.CreateDatacenterConnectorRequest() - assert args[0] == request_msg @@ -52222,7 +52197,6 @@ def test_delete_datacenter_connector_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.DeleteDatacenterConnectorRequest() - assert args[0] == request_msg @@ -52244,7 +52218,6 @@ def test_upgrade_appliance_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.UpgradeApplianceRequest() - assert args[0] == request_msg @@ -52266,7 +52239,6 @@ def test_create_migrating_vm_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.CreateMigratingVmRequest() - assert args[0] == request_msg @@ -52288,7 +52260,6 @@ def test_list_migrating_vms_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.ListMigratingVmsRequest() - assert args[0] == request_msg @@ -52308,7 +52279,6 @@ def test_get_migrating_vm_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.GetMigratingVmRequest() - assert args[0] == request_msg @@ -52330,7 +52300,6 @@ def test_update_migrating_vm_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.UpdateMigratingVmRequest() - assert args[0] == request_msg @@ -52352,7 +52321,6 @@ def test_delete_migrating_vm_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.DeleteMigratingVmRequest() - assert args[0] == request_msg @@ -52372,7 +52340,6 @@ def test_start_migration_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.StartMigrationRequest() - assert args[0] == request_msg @@ -52392,7 +52359,6 @@ def test_resume_migration_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.ResumeMigrationRequest() - assert args[0] == request_msg @@ -52412,7 +52378,6 @@ def test_pause_migration_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.PauseMigrationRequest() - assert args[0] == request_msg @@ -52434,7 +52399,6 @@ def test_finalize_migration_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.FinalizeMigrationRequest() - assert args[0] == request_msg @@ -52454,7 +52418,6 @@ def test_extend_migration_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.ExtendMigrationRequest() - assert args[0] == request_msg @@ -52474,7 +52437,6 @@ def test_create_clone_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.CreateCloneJobRequest() - assert args[0] == request_msg @@ -52494,7 +52456,6 @@ def test_cancel_clone_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.CancelCloneJobRequest() - assert args[0] == request_msg @@ -52514,7 +52475,6 @@ def test_list_clone_jobs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.ListCloneJobsRequest() - assert args[0] == request_msg @@ -52534,7 +52494,6 @@ def test_get_clone_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.GetCloneJobRequest() - assert args[0] == request_msg @@ -52556,7 +52515,6 @@ def test_create_cutover_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.CreateCutoverJobRequest() - assert args[0] == request_msg @@ -52578,7 +52536,6 @@ def test_cancel_cutover_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.CancelCutoverJobRequest() - assert args[0] == request_msg @@ -52600,7 +52557,6 @@ def test_list_cutover_jobs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.ListCutoverJobsRequest() - assert args[0] == request_msg @@ -52620,7 +52576,6 @@ def test_get_cutover_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.GetCutoverJobRequest() - assert args[0] == request_msg @@ -52640,7 +52595,6 @@ def test_list_groups_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.ListGroupsRequest() - assert args[0] == request_msg @@ -52660,7 +52614,6 @@ def test_get_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.GetGroupRequest() - assert args[0] == request_msg @@ -52680,7 +52633,6 @@ def test_create_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.CreateGroupRequest() - assert args[0] == request_msg @@ -52700,7 +52652,6 @@ def test_update_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.UpdateGroupRequest() - assert args[0] == request_msg @@ -52720,7 +52671,6 @@ def test_delete_group_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.DeleteGroupRequest() - assert args[0] == request_msg @@ -52742,7 +52692,6 @@ def test_add_group_migration_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.AddGroupMigrationRequest() - assert args[0] == request_msg @@ -52764,7 +52713,6 @@ def test_remove_group_migration_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.RemoveGroupMigrationRequest() - assert args[0] == request_msg @@ -52786,7 +52734,6 @@ def test_list_target_projects_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.ListTargetProjectsRequest() - assert args[0] == request_msg @@ -52808,7 +52755,6 @@ def test_get_target_project_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.GetTargetProjectRequest() - assert args[0] == request_msg @@ -52830,7 +52776,6 @@ def test_create_target_project_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.CreateTargetProjectRequest() - assert args[0] == request_msg @@ -52852,7 +52797,6 @@ def test_update_target_project_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.UpdateTargetProjectRequest() - assert args[0] == request_msg @@ -52874,7 +52818,6 @@ def test_delete_target_project_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.DeleteTargetProjectRequest() - assert args[0] == request_msg @@ -52896,7 +52839,6 @@ def test_list_replication_cycles_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.ListReplicationCyclesRequest() - assert args[0] == request_msg @@ -52918,7 +52860,6 @@ def test_get_replication_cycle_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.GetReplicationCycleRequest() - assert args[0] == request_msg @@ -52940,7 +52881,6 @@ def test_list_image_imports_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.ListImageImportsRequest() - assert args[0] == request_msg @@ -52960,7 +52900,6 @@ def test_get_image_import_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.GetImageImportRequest() - assert args[0] == request_msg @@ -52982,7 +52921,6 @@ def test_create_image_import_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.CreateImageImportRequest() - assert args[0] == request_msg @@ -53004,7 +52942,6 @@ def test_delete_image_import_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.DeleteImageImportRequest() - assert args[0] == request_msg @@ -53026,7 +52963,6 @@ def test_list_image_import_jobs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.ListImageImportJobsRequest() - assert args[0] == request_msg @@ -53048,7 +52984,6 @@ def test_get_image_import_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.GetImageImportJobRequest() - assert args[0] == request_msg @@ -53070,7 +53005,6 @@ def test_cancel_image_import_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.CancelImageImportJobRequest() - assert args[0] == request_msg @@ -53092,7 +53026,6 @@ def test_create_disk_migration_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.CreateDiskMigrationJobRequest() - assert args[0] == request_msg @@ -53114,7 +53047,6 @@ def test_list_disk_migration_jobs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.ListDiskMigrationJobsRequest() - assert args[0] == request_msg @@ -53136,7 +53068,6 @@ def test_get_disk_migration_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.GetDiskMigrationJobRequest() - assert args[0] == request_msg @@ -53158,7 +53089,6 @@ def test_update_disk_migration_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.UpdateDiskMigrationJobRequest() - assert args[0] == request_msg @@ -53180,7 +53110,6 @@ def test_delete_disk_migration_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.DeleteDiskMigrationJobRequest() - assert args[0] == request_msg @@ -53202,7 +53131,6 @@ def test_run_disk_migration_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.RunDiskMigrationJobRequest() - assert args[0] == request_msg @@ -53224,7 +53152,6 @@ def test_cancel_disk_migration_job_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmmigration.CancelDiskMigrationJobRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-vmwareengine/noxfile.py b/packages/google-cloud-vmwareengine/noxfile.py index 71db849eae41..7f6b1caa7cca 100644 --- a/packages/google-cloud-vmwareengine/noxfile.py +++ b/packages/google-cloud-vmwareengine/noxfile.py @@ -47,7 +47,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-vmwareengine" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-vmwareengine/setup.py b/packages/google-cloud-vmwareengine/setup.py index 99e8edf6585e..53d0bd968b92 100644 --- a/packages/google-cloud-vmwareengine/setup.py +++ b/packages/google-cloud-vmwareengine/setup.py @@ -45,7 +45,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/google-cloud-vmwareengine/testing/constraints-3.10.txt b/packages/google-cloud-vmwareengine/testing/constraints-3.10.txt index a92801e1c8e2..b39cd54634f9 100644 --- a/packages/google-cloud-vmwareengine/testing/constraints-3.10.txt +++ b/packages/google-cloud-vmwareengine/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/google-cloud-vmwareengine/tests/unit/gapic/vmwareengine_v1/test_vmware_engine.py b/packages/google-cloud-vmwareengine/tests/unit/gapic/vmwareengine_v1/test_vmware_engine.py index f1cc05728d62..9f9ae4127315 100644 --- a/packages/google-cloud-vmwareengine/tests/unit/gapic/vmwareengine_v1/test_vmware_engine.py +++ b/packages/google-cloud-vmwareengine/tests/unit/gapic/vmwareengine_v1/test_vmware_engine.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 @@ -122,6 +123,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" @@ -1302,8 +1318,8 @@ def test_vmware_engine_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - vmwareengine.ListPrivateCloudsRequest, - dict, + vmwareengine.ListPrivateCloudsRequest(), + {}, ], ) def test_list_private_clouds(request_type, transport: str = "grpc"): @@ -1314,7 +1330,7 @@ def test_list_private_clouds(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,12 +1383,13 @@ def test_list_private_clouds_non_empty_request_with_auto_populated_field(): client.list_private_clouds(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmwareengine.ListPrivateCloudsRequest( + request_msg = vmwareengine.ListPrivateCloudsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_private_clouds_use_cached_wrapped_rpc(): @@ -1457,9 +1474,14 @@ async def test_list_private_clouds_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_private_clouds_async( - transport: str = "grpc_asyncio", request_type=vmwareengine.ListPrivateCloudsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + vmwareengine.ListPrivateCloudsRequest(), + {}, + ], +) +async def test_list_private_clouds_async(request_type, transport: str = "grpc_asyncio"): client = VmwareEngineAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1467,7 +1489,7 @@ async def test_list_private_clouds_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( @@ -1494,11 +1516,6 @@ async def test_list_private_clouds_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_private_clouds_async_from_dict(): - await test_list_private_clouds_async(request_type=dict) - - def test_list_private_clouds_field_headers(): client = VmwareEngineClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1853,8 +1870,8 @@ async def test_list_private_clouds_async_pages(): @pytest.mark.parametrize( "request_type", [ - vmwareengine.GetPrivateCloudRequest, - dict, + vmwareengine.GetPrivateCloudRequest(), + {}, ], ) def test_get_private_cloud(request_type, transport: str = "grpc"): @@ -1865,7 +1882,7 @@ def test_get_private_cloud(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1921,9 +1938,10 @@ def test_get_private_cloud_non_empty_request_with_auto_populated_field(): client.get_private_cloud(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmwareengine.GetPrivateCloudRequest( + request_msg = vmwareengine.GetPrivateCloudRequest( name="name_value", ) + assert args[0] == request_msg def test_get_private_cloud_use_cached_wrapped_rpc(): @@ -2006,9 +2024,14 @@ async def test_get_private_cloud_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_private_cloud_async( - transport: str = "grpc_asyncio", request_type=vmwareengine.GetPrivateCloudRequest -): +@pytest.mark.parametrize( + "request_type", + [ + vmwareengine.GetPrivateCloudRequest(), + {}, + ], +) +async def test_get_private_cloud_async(request_type, transport: str = "grpc_asyncio"): client = VmwareEngineAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2016,7 +2039,7 @@ async def test_get_private_cloud_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( @@ -2049,11 +2072,6 @@ async def test_get_private_cloud_async( assert response.type_ == vmwareengine_resources.PrivateCloud.Type.TIME_LIMITED -@pytest.mark.asyncio -async def test_get_private_cloud_async_from_dict(): - await test_get_private_cloud_async(request_type=dict) - - def test_get_private_cloud_field_headers(): client = VmwareEngineClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2208,8 +2226,8 @@ async def test_get_private_cloud_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmwareengine.CreatePrivateCloudRequest, - dict, + vmwareengine.CreatePrivateCloudRequest(), + {}, ], ) def test_create_private_cloud(request_type, transport: str = "grpc"): @@ -2220,7 +2238,7 @@ def test_create_private_cloud(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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 +2285,12 @@ def test_create_private_cloud_non_empty_request_with_auto_populated_field(): client.create_private_cloud(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmwareengine.CreatePrivateCloudRequest( + request_msg = vmwareengine.CreatePrivateCloudRequest( parent="parent_value", private_cloud_id="private_cloud_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_private_cloud_use_cached_wrapped_rpc(): @@ -2366,8 +2385,15 @@ async def test_create_private_cloud_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmwareengine.CreatePrivateCloudRequest(), + {}, + ], +) async def test_create_private_cloud_async( - transport: str = "grpc_asyncio", request_type=vmwareengine.CreatePrivateCloudRequest + request_type, transport: str = "grpc_asyncio" ): client = VmwareEngineAsyncClient( credentials=async_anonymous_credentials(), @@ -2376,7 +2402,7 @@ async def test_create_private_cloud_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( @@ -2398,11 +2424,6 @@ async def test_create_private_cloud_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_private_cloud_async_from_dict(): - await test_create_private_cloud_async(request_type=dict) - - def test_create_private_cloud_field_headers(): client = VmwareEngineClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2577,8 +2598,8 @@ async def test_create_private_cloud_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmwareengine.UpdatePrivateCloudRequest, - dict, + vmwareengine.UpdatePrivateCloudRequest(), + {}, ], ) def test_update_private_cloud(request_type, transport: str = "grpc"): @@ -2589,7 +2610,7 @@ def test_update_private_cloud(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2634,9 +2655,10 @@ def test_update_private_cloud_non_empty_request_with_auto_populated_field(): client.update_private_cloud(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmwareengine.UpdatePrivateCloudRequest( + request_msg = vmwareengine.UpdatePrivateCloudRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_private_cloud_use_cached_wrapped_rpc(): @@ -2731,8 +2753,15 @@ async def test_update_private_cloud_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmwareengine.UpdatePrivateCloudRequest(), + {}, + ], +) async def test_update_private_cloud_async( - transport: str = "grpc_asyncio", request_type=vmwareengine.UpdatePrivateCloudRequest + request_type, transport: str = "grpc_asyncio" ): client = VmwareEngineAsyncClient( credentials=async_anonymous_credentials(), @@ -2741,7 +2770,7 @@ async def test_update_private_cloud_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( @@ -2763,11 +2792,6 @@ async def test_update_private_cloud_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_private_cloud_async_from_dict(): - await test_update_private_cloud_async(request_type=dict) - - def test_update_private_cloud_field_headers(): client = VmwareEngineClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2932,8 +2956,8 @@ async def test_update_private_cloud_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmwareengine.DeletePrivateCloudRequest, - dict, + vmwareengine.DeletePrivateCloudRequest(), + {}, ], ) def test_delete_private_cloud(request_type, transport: str = "grpc"): @@ -2944,7 +2968,7 @@ def test_delete_private_cloud(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2990,10 +3014,11 @@ def test_delete_private_cloud_non_empty_request_with_auto_populated_field(): client.delete_private_cloud(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmwareengine.DeletePrivateCloudRequest( + request_msg = vmwareengine.DeletePrivateCloudRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_private_cloud_use_cached_wrapped_rpc(): @@ -3088,8 +3113,15 @@ async def test_delete_private_cloud_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmwareengine.DeletePrivateCloudRequest(), + {}, + ], +) async def test_delete_private_cloud_async( - transport: str = "grpc_asyncio", request_type=vmwareengine.DeletePrivateCloudRequest + request_type, transport: str = "grpc_asyncio" ): client = VmwareEngineAsyncClient( credentials=async_anonymous_credentials(), @@ -3098,7 +3130,7 @@ async def test_delete_private_cloud_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( @@ -3120,11 +3152,6 @@ async def test_delete_private_cloud_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_private_cloud_async_from_dict(): - await test_delete_private_cloud_async(request_type=dict) - - def test_delete_private_cloud_field_headers(): client = VmwareEngineClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3279,8 +3306,8 @@ async def test_delete_private_cloud_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmwareengine.UndeletePrivateCloudRequest, - dict, + vmwareengine.UndeletePrivateCloudRequest(), + {}, ], ) def test_undelete_private_cloud(request_type, transport: str = "grpc"): @@ -3291,7 +3318,7 @@ def test_undelete_private_cloud(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3337,10 +3364,11 @@ def test_undelete_private_cloud_non_empty_request_with_auto_populated_field(): client.undelete_private_cloud(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmwareengine.UndeletePrivateCloudRequest( + request_msg = vmwareengine.UndeletePrivateCloudRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_undelete_private_cloud_use_cached_wrapped_rpc(): @@ -3436,9 +3464,15 @@ async def test_undelete_private_cloud_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmwareengine.UndeletePrivateCloudRequest(), + {}, + ], +) async def test_undelete_private_cloud_async( - transport: str = "grpc_asyncio", - request_type=vmwareengine.UndeletePrivateCloudRequest, + request_type, transport: str = "grpc_asyncio" ): client = VmwareEngineAsyncClient( credentials=async_anonymous_credentials(), @@ -3447,7 +3481,7 @@ async def test_undelete_private_cloud_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( @@ -3469,11 +3503,6 @@ async def test_undelete_private_cloud_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_undelete_private_cloud_async_from_dict(): - await test_undelete_private_cloud_async(request_type=dict) - - def test_undelete_private_cloud_field_headers(): client = VmwareEngineClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3628,8 +3657,8 @@ async def test_undelete_private_cloud_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmwareengine.ListClustersRequest, - dict, + vmwareengine.ListClustersRequest(), + {}, ], ) def test_list_clusters(request_type, transport: str = "grpc"): @@ -3640,7 +3669,7 @@ def test_list_clusters(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_clusters), "__call__") as call: @@ -3689,12 +3718,13 @@ def test_list_clusters_non_empty_request_with_auto_populated_field(): client.list_clusters(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmwareengine.ListClustersRequest( + request_msg = vmwareengine.ListClustersRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_clusters_use_cached_wrapped_rpc(): @@ -3775,9 +3805,14 @@ async def test_list_clusters_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_clusters_async( - transport: str = "grpc_asyncio", request_type=vmwareengine.ListClustersRequest -): +@pytest.mark.parametrize( + "request_type", + [ + vmwareengine.ListClustersRequest(), + {}, + ], +) +async def test_list_clusters_async(request_type, transport: str = "grpc_asyncio"): client = VmwareEngineAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3785,7 +3820,7 @@ async def test_list_clusters_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_clusters), "__call__") as call: @@ -3810,11 +3845,6 @@ async def test_list_clusters_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_clusters_async_from_dict(): - await test_list_clusters_async(request_type=dict) - - def test_list_clusters_field_headers(): client = VmwareEngineClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4151,8 +4181,8 @@ async def test_list_clusters_async_pages(): @pytest.mark.parametrize( "request_type", [ - vmwareengine.GetClusterRequest, - dict, + vmwareengine.GetClusterRequest(), + {}, ], ) def test_get_cluster(request_type, transport: str = "grpc"): @@ -4163,7 +4193,7 @@ def test_get_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_cluster), "__call__") as call: @@ -4213,9 +4243,10 @@ def test_get_cluster_non_empty_request_with_auto_populated_field(): client.get_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmwareengine.GetClusterRequest( + request_msg = vmwareengine.GetClusterRequest( name="name_value", ) + assert args[0] == request_msg def test_get_cluster_use_cached_wrapped_rpc(): @@ -4296,9 +4327,14 @@ async def test_get_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_cluster_async( - transport: str = "grpc_asyncio", request_type=vmwareengine.GetClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + vmwareengine.GetClusterRequest(), + {}, + ], +) +async def test_get_cluster_async(request_type, transport: str = "grpc_asyncio"): client = VmwareEngineAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4306,7 +4342,7 @@ async def test_get_cluster_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_cluster), "__call__") as call: @@ -4335,11 +4371,6 @@ async def test_get_cluster_async( assert response.uid == "uid_value" -@pytest.mark.asyncio -async def test_get_cluster_async_from_dict(): - await test_get_cluster_async(request_type=dict) - - def test_get_cluster_field_headers(): client = VmwareEngineClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4486,8 +4517,8 @@ async def test_get_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmwareengine.CreateClusterRequest, - dict, + vmwareengine.CreateClusterRequest(), + {}, ], ) def test_create_cluster(request_type, transport: str = "grpc"): @@ -4498,7 +4529,7 @@ def test_create_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_cluster), "__call__") as call: @@ -4541,11 +4572,12 @@ def test_create_cluster_non_empty_request_with_auto_populated_field(): client.create_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmwareengine.CreateClusterRequest( + request_msg = vmwareengine.CreateClusterRequest( parent="parent_value", cluster_id="cluster_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_cluster_use_cached_wrapped_rpc(): @@ -4636,9 +4668,14 @@ async def test_create_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_cluster_async( - transport: str = "grpc_asyncio", request_type=vmwareengine.CreateClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + vmwareengine.CreateClusterRequest(), + {}, + ], +) +async def test_create_cluster_async(request_type, transport: str = "grpc_asyncio"): client = VmwareEngineAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4646,7 +4683,7 @@ async def test_create_cluster_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_cluster), "__call__") as call: @@ -4666,11 +4703,6 @@ async def test_create_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_cluster_async_from_dict(): - await test_create_cluster_async(request_type=dict) - - def test_create_cluster_field_headers(): client = VmwareEngineClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4837,8 +4869,8 @@ async def test_create_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmwareengine.UpdateClusterRequest, - dict, + vmwareengine.UpdateClusterRequest(), + {}, ], ) def test_update_cluster(request_type, transport: str = "grpc"): @@ -4849,7 +4881,7 @@ def test_update_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_cluster), "__call__") as call: @@ -4890,9 +4922,10 @@ def test_update_cluster_non_empty_request_with_auto_populated_field(): client.update_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmwareengine.UpdateClusterRequest( + request_msg = vmwareengine.UpdateClusterRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_cluster_use_cached_wrapped_rpc(): @@ -4983,9 +5016,14 @@ async def test_update_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_cluster_async( - transport: str = "grpc_asyncio", request_type=vmwareengine.UpdateClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + vmwareengine.UpdateClusterRequest(), + {}, + ], +) +async def test_update_cluster_async(request_type, transport: str = "grpc_asyncio"): client = VmwareEngineAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4993,7 +5031,7 @@ async def test_update_cluster_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_cluster), "__call__") as call: @@ -5013,11 +5051,6 @@ async def test_update_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_cluster_async_from_dict(): - await test_update_cluster_async(request_type=dict) - - def test_update_cluster_field_headers(): client = VmwareEngineClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5174,8 +5207,8 @@ async def test_update_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmwareengine.DeleteClusterRequest, - dict, + vmwareengine.DeleteClusterRequest(), + {}, ], ) def test_delete_cluster(request_type, transport: str = "grpc"): @@ -5186,7 +5219,7 @@ def test_delete_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_cluster), "__call__") as call: @@ -5228,10 +5261,11 @@ def test_delete_cluster_non_empty_request_with_auto_populated_field(): client.delete_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmwareengine.DeleteClusterRequest( + request_msg = vmwareengine.DeleteClusterRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_cluster_use_cached_wrapped_rpc(): @@ -5322,9 +5356,14 @@ async def test_delete_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_cluster_async( - transport: str = "grpc_asyncio", request_type=vmwareengine.DeleteClusterRequest -): +@pytest.mark.parametrize( + "request_type", + [ + vmwareengine.DeleteClusterRequest(), + {}, + ], +) +async def test_delete_cluster_async(request_type, transport: str = "grpc_asyncio"): client = VmwareEngineAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5332,7 +5371,7 @@ async def test_delete_cluster_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_cluster), "__call__") as call: @@ -5352,11 +5391,6 @@ async def test_delete_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_cluster_async_from_dict(): - await test_delete_cluster_async(request_type=dict) - - def test_delete_cluster_field_headers(): client = VmwareEngineClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5503,8 +5537,8 @@ async def test_delete_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmwareengine.ListNodesRequest, - dict, + vmwareengine.ListNodesRequest(), + {}, ], ) def test_list_nodes(request_type, transport: str = "grpc"): @@ -5515,7 +5549,7 @@ def test_list_nodes(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_nodes), "__call__") as call: @@ -5560,10 +5594,11 @@ def test_list_nodes_non_empty_request_with_auto_populated_field(): client.list_nodes(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmwareengine.ListNodesRequest( + request_msg = vmwareengine.ListNodesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_nodes_use_cached_wrapped_rpc(): @@ -5642,9 +5677,14 @@ async def test_list_nodes_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_list_nodes_async( - transport: str = "grpc_asyncio", request_type=vmwareengine.ListNodesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + vmwareengine.ListNodesRequest(), + {}, + ], +) +async def test_list_nodes_async(request_type, transport: str = "grpc_asyncio"): client = VmwareEngineAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5652,7 +5692,7 @@ async def test_list_nodes_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_nodes), "__call__") as call: @@ -5675,11 +5715,6 @@ async def test_list_nodes_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_nodes_async_from_dict(): - await test_list_nodes_async(request_type=dict) - - def test_list_nodes_field_headers(): client = VmwareEngineClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6016,8 +6051,8 @@ async def test_list_nodes_async_pages(): @pytest.mark.parametrize( "request_type", [ - vmwareengine.GetNodeRequest, - dict, + vmwareengine.GetNodeRequest(), + {}, ], ) def test_get_node(request_type, transport: str = "grpc"): @@ -6028,7 +6063,7 @@ def test_get_node(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_node), "__call__") as call: @@ -6084,9 +6119,10 @@ def test_get_node_non_empty_request_with_auto_populated_field(): client.get_node(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmwareengine.GetNodeRequest( + request_msg = vmwareengine.GetNodeRequest( name="name_value", ) + assert args[0] == request_msg def test_get_node_use_cached_wrapped_rpc(): @@ -6165,9 +6201,14 @@ async def test_get_node_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn @pytest.mark.asyncio -async def test_get_node_async( - transport: str = "grpc_asyncio", request_type=vmwareengine.GetNodeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + vmwareengine.GetNodeRequest(), + {}, + ], +) +async def test_get_node_async(request_type, transport: str = "grpc_asyncio"): client = VmwareEngineAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6175,7 +6216,7 @@ async def test_get_node_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_node), "__call__") as call: @@ -6210,11 +6251,6 @@ async def test_get_node_async( assert response.state == vmwareengine_resources.Node.State.ACTIVE -@pytest.mark.asyncio -async def test_get_node_async_from_dict(): - await test_get_node_async(request_type=dict) - - def test_get_node_field_headers(): client = VmwareEngineClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6361,8 +6397,8 @@ async def test_get_node_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmwareengine.ListExternalAddressesRequest, - dict, + vmwareengine.ListExternalAddressesRequest(), + {}, ], ) def test_list_external_addresses(request_type, transport: str = "grpc"): @@ -6373,7 +6409,7 @@ def test_list_external_addresses(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6426,12 +6462,13 @@ def test_list_external_addresses_non_empty_request_with_auto_populated_field(): client.list_external_addresses(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmwareengine.ListExternalAddressesRequest( + request_msg = vmwareengine.ListExternalAddressesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_external_addresses_use_cached_wrapped_rpc(): @@ -6517,9 +6554,15 @@ async def test_list_external_addresses_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmwareengine.ListExternalAddressesRequest(), + {}, + ], +) async def test_list_external_addresses_async( - transport: str = "grpc_asyncio", - request_type=vmwareengine.ListExternalAddressesRequest, + request_type, transport: str = "grpc_asyncio" ): client = VmwareEngineAsyncClient( credentials=async_anonymous_credentials(), @@ -6528,7 +6571,7 @@ async def test_list_external_addresses_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( @@ -6555,11 +6598,6 @@ async def test_list_external_addresses_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_external_addresses_async_from_dict(): - await test_list_external_addresses_async(request_type=dict) - - def test_list_external_addresses_field_headers(): client = VmwareEngineClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6916,8 +6954,8 @@ async def test_list_external_addresses_async_pages(): @pytest.mark.parametrize( "request_type", [ - vmwareengine.FetchNetworkPolicyExternalAddressesRequest, - dict, + vmwareengine.FetchNetworkPolicyExternalAddressesRequest(), + {}, ], ) def test_fetch_network_policy_external_addresses(request_type, transport: str = "grpc"): @@ -6928,7 +6966,7 @@ def test_fetch_network_policy_external_addresses(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( @@ -6977,10 +7015,11 @@ def test_fetch_network_policy_external_addresses_non_empty_request_with_auto_pop client.fetch_network_policy_external_addresses(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmwareengine.FetchNetworkPolicyExternalAddressesRequest( + request_msg = vmwareengine.FetchNetworkPolicyExternalAddressesRequest( network_policy="network_policy_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_fetch_network_policy_external_addresses_use_cached_wrapped_rpc(): @@ -7066,9 +7105,15 @@ async def test_fetch_network_policy_external_addresses_async_use_cached_wrapped_ @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmwareengine.FetchNetworkPolicyExternalAddressesRequest(), + {}, + ], +) async def test_fetch_network_policy_external_addresses_async( - transport: str = "grpc_asyncio", - request_type=vmwareengine.FetchNetworkPolicyExternalAddressesRequest, + request_type, transport: str = "grpc_asyncio" ): client = VmwareEngineAsyncClient( credentials=async_anonymous_credentials(), @@ -7077,7 +7122,7 @@ async def test_fetch_network_policy_external_addresses_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( @@ -7102,11 +7147,6 @@ async def test_fetch_network_policy_external_addresses_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_fetch_network_policy_external_addresses_async_from_dict(): - await test_fetch_network_policy_external_addresses_async(request_type=dict) - - def test_fetch_network_policy_external_addresses_field_headers(): client = VmwareEngineClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7467,8 +7507,8 @@ async def test_fetch_network_policy_external_addresses_async_pages(): @pytest.mark.parametrize( "request_type", [ - vmwareengine.GetExternalAddressRequest, - dict, + vmwareengine.GetExternalAddressRequest(), + {}, ], ) def test_get_external_address(request_type, transport: str = "grpc"): @@ -7479,7 +7519,7 @@ def test_get_external_address(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7537,9 +7577,10 @@ def test_get_external_address_non_empty_request_with_auto_populated_field(): client.get_external_address(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmwareengine.GetExternalAddressRequest( + request_msg = vmwareengine.GetExternalAddressRequest( name="name_value", ) + assert args[0] == request_msg def test_get_external_address_use_cached_wrapped_rpc(): @@ -7624,8 +7665,15 @@ async def test_get_external_address_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmwareengine.GetExternalAddressRequest(), + {}, + ], +) async def test_get_external_address_async( - transport: str = "grpc_asyncio", request_type=vmwareengine.GetExternalAddressRequest + request_type, transport: str = "grpc_asyncio" ): client = VmwareEngineAsyncClient( credentials=async_anonymous_credentials(), @@ -7634,7 +7682,7 @@ async def test_get_external_address_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( @@ -7669,11 +7717,6 @@ async def test_get_external_address_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_get_external_address_async_from_dict(): - await test_get_external_address_async(request_type=dict) - - def test_get_external_address_field_headers(): client = VmwareEngineClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7828,8 +7871,8 @@ async def test_get_external_address_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmwareengine.CreateExternalAddressRequest, - dict, + vmwareengine.CreateExternalAddressRequest(), + {}, ], ) def test_create_external_address(request_type, transport: str = "grpc"): @@ -7840,7 +7883,7 @@ def test_create_external_address(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7887,11 +7930,12 @@ def test_create_external_address_non_empty_request_with_auto_populated_field(): client.create_external_address(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmwareengine.CreateExternalAddressRequest( + request_msg = vmwareengine.CreateExternalAddressRequest( parent="parent_value", external_address_id="external_address_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_external_address_use_cached_wrapped_rpc(): @@ -7987,9 +8031,15 @@ async def test_create_external_address_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmwareengine.CreateExternalAddressRequest(), + {}, + ], +) async def test_create_external_address_async( - transport: str = "grpc_asyncio", - request_type=vmwareengine.CreateExternalAddressRequest, + request_type, transport: str = "grpc_asyncio" ): client = VmwareEngineAsyncClient( credentials=async_anonymous_credentials(), @@ -7998,7 +8048,7 @@ async def test_create_external_address_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( @@ -8020,11 +8070,6 @@ async def test_create_external_address_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_external_address_async_from_dict(): - await test_create_external_address_async(request_type=dict) - - def test_create_external_address_field_headers(): client = VmwareEngineClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8199,8 +8244,8 @@ async def test_create_external_address_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmwareengine.UpdateExternalAddressRequest, - dict, + vmwareengine.UpdateExternalAddressRequest(), + {}, ], ) def test_update_external_address(request_type, transport: str = "grpc"): @@ -8211,7 +8256,7 @@ def test_update_external_address(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8256,9 +8301,10 @@ def test_update_external_address_non_empty_request_with_auto_populated_field(): client.update_external_address(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmwareengine.UpdateExternalAddressRequest( + request_msg = vmwareengine.UpdateExternalAddressRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_external_address_use_cached_wrapped_rpc(): @@ -8354,9 +8400,15 @@ async def test_update_external_address_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmwareengine.UpdateExternalAddressRequest(), + {}, + ], +) async def test_update_external_address_async( - transport: str = "grpc_asyncio", - request_type=vmwareengine.UpdateExternalAddressRequest, + request_type, transport: str = "grpc_asyncio" ): client = VmwareEngineAsyncClient( credentials=async_anonymous_credentials(), @@ -8365,7 +8417,7 @@ async def test_update_external_address_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( @@ -8387,11 +8439,6 @@ async def test_update_external_address_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_external_address_async_from_dict(): - await test_update_external_address_async(request_type=dict) - - def test_update_external_address_field_headers(): client = VmwareEngineClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8556,8 +8603,8 @@ async def test_update_external_address_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmwareengine.DeleteExternalAddressRequest, - dict, + vmwareengine.DeleteExternalAddressRequest(), + {}, ], ) def test_delete_external_address(request_type, transport: str = "grpc"): @@ -8568,7 +8615,7 @@ def test_delete_external_address(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8614,10 +8661,11 @@ def test_delete_external_address_non_empty_request_with_auto_populated_field(): client.delete_external_address(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmwareengine.DeleteExternalAddressRequest( + request_msg = vmwareengine.DeleteExternalAddressRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_external_address_use_cached_wrapped_rpc(): @@ -8713,9 +8761,15 @@ async def test_delete_external_address_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmwareengine.DeleteExternalAddressRequest(), + {}, + ], +) async def test_delete_external_address_async( - transport: str = "grpc_asyncio", - request_type=vmwareengine.DeleteExternalAddressRequest, + request_type, transport: str = "grpc_asyncio" ): client = VmwareEngineAsyncClient( credentials=async_anonymous_credentials(), @@ -8724,7 +8778,7 @@ async def test_delete_external_address_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( @@ -8746,11 +8800,6 @@ async def test_delete_external_address_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_external_address_async_from_dict(): - await test_delete_external_address_async(request_type=dict) - - def test_delete_external_address_field_headers(): client = VmwareEngineClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8905,8 +8954,8 @@ async def test_delete_external_address_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmwareengine.ListSubnetsRequest, - dict, + vmwareengine.ListSubnetsRequest(), + {}, ], ) def test_list_subnets(request_type, transport: str = "grpc"): @@ -8917,7 +8966,7 @@ def test_list_subnets(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_subnets), "__call__") as call: @@ -8964,10 +9013,11 @@ def test_list_subnets_non_empty_request_with_auto_populated_field(): client.list_subnets(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmwareengine.ListSubnetsRequest( + request_msg = vmwareengine.ListSubnetsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_subnets_use_cached_wrapped_rpc(): @@ -9048,9 +9098,14 @@ async def test_list_subnets_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_subnets_async( - transport: str = "grpc_asyncio", request_type=vmwareengine.ListSubnetsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + vmwareengine.ListSubnetsRequest(), + {}, + ], +) +async def test_list_subnets_async(request_type, transport: str = "grpc_asyncio"): client = VmwareEngineAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9058,7 +9113,7 @@ async def test_list_subnets_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_subnets), "__call__") as call: @@ -9083,11 +9138,6 @@ async def test_list_subnets_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_subnets_async_from_dict(): - await test_list_subnets_async(request_type=dict) - - def test_list_subnets_field_headers(): client = VmwareEngineClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9424,8 +9474,8 @@ async def test_list_subnets_async_pages(): @pytest.mark.parametrize( "request_type", [ - vmwareengine.GetSubnetRequest, - dict, + vmwareengine.GetSubnetRequest(), + {}, ], ) def test_get_subnet(request_type, transport: str = "grpc"): @@ -9436,7 +9486,7 @@ def test_get_subnet(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_subnet), "__call__") as call: @@ -9490,9 +9540,10 @@ def test_get_subnet_non_empty_request_with_auto_populated_field(): client.get_subnet(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmwareengine.GetSubnetRequest( + request_msg = vmwareengine.GetSubnetRequest( name="name_value", ) + assert args[0] == request_msg def test_get_subnet_use_cached_wrapped_rpc(): @@ -9571,9 +9622,14 @@ async def test_get_subnet_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_subnet_async( - transport: str = "grpc_asyncio", request_type=vmwareengine.GetSubnetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + vmwareengine.GetSubnetRequest(), + {}, + ], +) +async def test_get_subnet_async(request_type, transport: str = "grpc_asyncio"): client = VmwareEngineAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9581,7 +9637,7 @@ async def test_get_subnet_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_subnet), "__call__") as call: @@ -9614,11 +9670,6 @@ async def test_get_subnet_async( assert response.vlan_id == 733 -@pytest.mark.asyncio -async def test_get_subnet_async_from_dict(): - await test_get_subnet_async(request_type=dict) - - def test_get_subnet_field_headers(): client = VmwareEngineClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9765,8 +9816,8 @@ async def test_get_subnet_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmwareengine.UpdateSubnetRequest, - dict, + vmwareengine.UpdateSubnetRequest(), + {}, ], ) def test_update_subnet(request_type, transport: str = "grpc"): @@ -9777,7 +9828,7 @@ def test_update_subnet(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_subnet), "__call__") as call: @@ -9816,7 +9867,8 @@ def test_update_subnet_non_empty_request_with_auto_populated_field(): client.update_subnet(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmwareengine.UpdateSubnetRequest() + request_msg = vmwareengine.UpdateSubnetRequest() + assert args[0] == request_msg def test_update_subnet_use_cached_wrapped_rpc(): @@ -9907,9 +9959,14 @@ async def test_update_subnet_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_subnet_async( - transport: str = "grpc_asyncio", request_type=vmwareengine.UpdateSubnetRequest -): +@pytest.mark.parametrize( + "request_type", + [ + vmwareengine.UpdateSubnetRequest(), + {}, + ], +) +async def test_update_subnet_async(request_type, transport: str = "grpc_asyncio"): client = VmwareEngineAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -9917,7 +9974,7 @@ async def test_update_subnet_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_subnet), "__call__") as call: @@ -9937,11 +9994,6 @@ async def test_update_subnet_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_subnet_async_from_dict(): - await test_update_subnet_async(request_type=dict) - - def test_update_subnet_field_headers(): client = VmwareEngineClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10098,8 +10150,8 @@ async def test_update_subnet_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmwareengine.ListExternalAccessRulesRequest, - dict, + vmwareengine.ListExternalAccessRulesRequest(), + {}, ], ) def test_list_external_access_rules(request_type, transport: str = "grpc"): @@ -10110,7 +10162,7 @@ def test_list_external_access_rules(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10163,12 +10215,13 @@ def test_list_external_access_rules_non_empty_request_with_auto_populated_field( client.list_external_access_rules(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmwareengine.ListExternalAccessRulesRequest( + request_msg = vmwareengine.ListExternalAccessRulesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_external_access_rules_use_cached_wrapped_rpc(): @@ -10254,9 +10307,15 @@ async def test_list_external_access_rules_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmwareengine.ListExternalAccessRulesRequest(), + {}, + ], +) async def test_list_external_access_rules_async( - transport: str = "grpc_asyncio", - request_type=vmwareengine.ListExternalAccessRulesRequest, + request_type, transport: str = "grpc_asyncio" ): client = VmwareEngineAsyncClient( credentials=async_anonymous_credentials(), @@ -10265,7 +10324,7 @@ async def test_list_external_access_rules_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( @@ -10292,11 +10351,6 @@ async def test_list_external_access_rules_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_external_access_rules_async_from_dict(): - await test_list_external_access_rules_async(request_type=dict) - - def test_list_external_access_rules_field_headers(): client = VmwareEngineClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10655,8 +10709,8 @@ async def test_list_external_access_rules_async_pages(): @pytest.mark.parametrize( "request_type", [ - vmwareengine.GetExternalAccessRuleRequest, - dict, + vmwareengine.GetExternalAccessRuleRequest(), + {}, ], ) def test_get_external_access_rule(request_type, transport: str = "grpc"): @@ -10667,7 +10721,7 @@ def test_get_external_access_rule(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10731,9 +10785,10 @@ def test_get_external_access_rule_non_empty_request_with_auto_populated_field(): client.get_external_access_rule(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmwareengine.GetExternalAccessRuleRequest( + request_msg = vmwareengine.GetExternalAccessRuleRequest( name="name_value", ) + assert args[0] == request_msg def test_get_external_access_rule_use_cached_wrapped_rpc(): @@ -10819,9 +10874,15 @@ async def test_get_external_access_rule_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmwareengine.GetExternalAccessRuleRequest(), + {}, + ], +) async def test_get_external_access_rule_async( - transport: str = "grpc_asyncio", - request_type=vmwareengine.GetExternalAccessRuleRequest, + request_type, transport: str = "grpc_asyncio" ): client = VmwareEngineAsyncClient( credentials=async_anonymous_credentials(), @@ -10830,7 +10891,7 @@ async def test_get_external_access_rule_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( @@ -10871,11 +10932,6 @@ async def test_get_external_access_rule_async( assert response.uid == "uid_value" -@pytest.mark.asyncio -async def test_get_external_access_rule_async_from_dict(): - await test_get_external_access_rule_async(request_type=dict) - - def test_get_external_access_rule_field_headers(): client = VmwareEngineClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11030,8 +11086,8 @@ async def test_get_external_access_rule_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmwareengine.CreateExternalAccessRuleRequest, - dict, + vmwareengine.CreateExternalAccessRuleRequest(), + {}, ], ) def test_create_external_access_rule(request_type, transport: str = "grpc"): @@ -11042,7 +11098,7 @@ def test_create_external_access_rule(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11089,11 +11145,12 @@ def test_create_external_access_rule_non_empty_request_with_auto_populated_field client.create_external_access_rule(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmwareengine.CreateExternalAccessRuleRequest( + request_msg = vmwareengine.CreateExternalAccessRuleRequest( parent="parent_value", external_access_rule_id="external_access_rule_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_external_access_rule_use_cached_wrapped_rpc(): @@ -11189,9 +11246,15 @@ async def test_create_external_access_rule_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmwareengine.CreateExternalAccessRuleRequest(), + {}, + ], +) async def test_create_external_access_rule_async( - transport: str = "grpc_asyncio", - request_type=vmwareengine.CreateExternalAccessRuleRequest, + request_type, transport: str = "grpc_asyncio" ): client = VmwareEngineAsyncClient( credentials=async_anonymous_credentials(), @@ -11200,7 +11263,7 @@ async def test_create_external_access_rule_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( @@ -11222,11 +11285,6 @@ async def test_create_external_access_rule_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_external_access_rule_async_from_dict(): - await test_create_external_access_rule_async(request_type=dict) - - def test_create_external_access_rule_field_headers(): client = VmwareEngineClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11409,8 +11467,8 @@ async def test_create_external_access_rule_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmwareengine.UpdateExternalAccessRuleRequest, - dict, + vmwareengine.UpdateExternalAccessRuleRequest(), + {}, ], ) def test_update_external_access_rule(request_type, transport: str = "grpc"): @@ -11421,7 +11479,7 @@ def test_update_external_access_rule(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11466,9 +11524,10 @@ def test_update_external_access_rule_non_empty_request_with_auto_populated_field client.update_external_access_rule(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmwareengine.UpdateExternalAccessRuleRequest( + request_msg = vmwareengine.UpdateExternalAccessRuleRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_external_access_rule_use_cached_wrapped_rpc(): @@ -11564,9 +11623,15 @@ async def test_update_external_access_rule_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmwareengine.UpdateExternalAccessRuleRequest(), + {}, + ], +) async def test_update_external_access_rule_async( - transport: str = "grpc_asyncio", - request_type=vmwareengine.UpdateExternalAccessRuleRequest, + request_type, transport: str = "grpc_asyncio" ): client = VmwareEngineAsyncClient( credentials=async_anonymous_credentials(), @@ -11575,7 +11640,7 @@ async def test_update_external_access_rule_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( @@ -11597,11 +11662,6 @@ async def test_update_external_access_rule_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_external_access_rule_async_from_dict(): - await test_update_external_access_rule_async(request_type=dict) - - def test_update_external_access_rule_field_headers(): client = VmwareEngineClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11774,8 +11834,8 @@ async def test_update_external_access_rule_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmwareengine.DeleteExternalAccessRuleRequest, - dict, + vmwareengine.DeleteExternalAccessRuleRequest(), + {}, ], ) def test_delete_external_access_rule(request_type, transport: str = "grpc"): @@ -11786,7 +11846,7 @@ def test_delete_external_access_rule(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -11832,10 +11892,11 @@ def test_delete_external_access_rule_non_empty_request_with_auto_populated_field client.delete_external_access_rule(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmwareengine.DeleteExternalAccessRuleRequest( + request_msg = vmwareengine.DeleteExternalAccessRuleRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_external_access_rule_use_cached_wrapped_rpc(): @@ -11931,9 +11992,15 @@ async def test_delete_external_access_rule_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmwareengine.DeleteExternalAccessRuleRequest(), + {}, + ], +) async def test_delete_external_access_rule_async( - transport: str = "grpc_asyncio", - request_type=vmwareengine.DeleteExternalAccessRuleRequest, + request_type, transport: str = "grpc_asyncio" ): client = VmwareEngineAsyncClient( credentials=async_anonymous_credentials(), @@ -11942,7 +12009,7 @@ async def test_delete_external_access_rule_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( @@ -11964,11 +12031,6 @@ async def test_delete_external_access_rule_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_external_access_rule_async_from_dict(): - await test_delete_external_access_rule_async(request_type=dict) - - def test_delete_external_access_rule_field_headers(): client = VmwareEngineClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12123,8 +12185,8 @@ async def test_delete_external_access_rule_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmwareengine.ListLoggingServersRequest, - dict, + vmwareengine.ListLoggingServersRequest(), + {}, ], ) def test_list_logging_servers(request_type, transport: str = "grpc"): @@ -12135,7 +12197,7 @@ def test_list_logging_servers(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -12188,12 +12250,13 @@ def test_list_logging_servers_non_empty_request_with_auto_populated_field(): client.list_logging_servers(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmwareengine.ListLoggingServersRequest( + request_msg = vmwareengine.ListLoggingServersRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_logging_servers_use_cached_wrapped_rpc(): @@ -12278,8 +12341,15 @@ async def test_list_logging_servers_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmwareengine.ListLoggingServersRequest(), + {}, + ], +) async def test_list_logging_servers_async( - transport: str = "grpc_asyncio", request_type=vmwareengine.ListLoggingServersRequest + request_type, transport: str = "grpc_asyncio" ): client = VmwareEngineAsyncClient( credentials=async_anonymous_credentials(), @@ -12288,7 +12358,7 @@ async def test_list_logging_servers_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( @@ -12315,11 +12385,6 @@ async def test_list_logging_servers_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_logging_servers_async_from_dict(): - await test_list_logging_servers_async(request_type=dict) - - def test_list_logging_servers_field_headers(): client = VmwareEngineClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12674,8 +12739,8 @@ async def test_list_logging_servers_async_pages(): @pytest.mark.parametrize( "request_type", [ - vmwareengine.GetLoggingServerRequest, - dict, + vmwareengine.GetLoggingServerRequest(), + {}, ], ) def test_get_logging_server(request_type, transport: str = "grpc"): @@ -12686,7 +12751,7 @@ def test_get_logging_server(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -12744,9 +12809,10 @@ def test_get_logging_server_non_empty_request_with_auto_populated_field(): client.get_logging_server(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmwareengine.GetLoggingServerRequest( + request_msg = vmwareengine.GetLoggingServerRequest( name="name_value", ) + assert args[0] == request_msg def test_get_logging_server_use_cached_wrapped_rpc(): @@ -12831,9 +12897,14 @@ async def test_get_logging_server_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_logging_server_async( - transport: str = "grpc_asyncio", request_type=vmwareengine.GetLoggingServerRequest -): +@pytest.mark.parametrize( + "request_type", + [ + vmwareengine.GetLoggingServerRequest(), + {}, + ], +) +async def test_get_logging_server_async(request_type, transport: str = "grpc_asyncio"): client = VmwareEngineAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -12841,7 +12912,7 @@ async def test_get_logging_server_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( @@ -12876,11 +12947,6 @@ async def test_get_logging_server_async( assert response.uid == "uid_value" -@pytest.mark.asyncio -async def test_get_logging_server_async_from_dict(): - await test_get_logging_server_async(request_type=dict) - - def test_get_logging_server_field_headers(): client = VmwareEngineClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13035,8 +13101,8 @@ async def test_get_logging_server_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmwareengine.CreateLoggingServerRequest, - dict, + vmwareengine.CreateLoggingServerRequest(), + {}, ], ) def test_create_logging_server(request_type, transport: str = "grpc"): @@ -13047,7 +13113,7 @@ def test_create_logging_server(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -13094,11 +13160,12 @@ def test_create_logging_server_non_empty_request_with_auto_populated_field(): client.create_logging_server(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmwareengine.CreateLoggingServerRequest( + request_msg = vmwareengine.CreateLoggingServerRequest( parent="parent_value", logging_server_id="logging_server_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_logging_server_use_cached_wrapped_rpc(): @@ -13194,9 +13261,15 @@ async def test_create_logging_server_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmwareengine.CreateLoggingServerRequest(), + {}, + ], +) async def test_create_logging_server_async( - transport: str = "grpc_asyncio", - request_type=vmwareengine.CreateLoggingServerRequest, + request_type, transport: str = "grpc_asyncio" ): client = VmwareEngineAsyncClient( credentials=async_anonymous_credentials(), @@ -13205,7 +13278,7 @@ async def test_create_logging_server_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( @@ -13227,11 +13300,6 @@ async def test_create_logging_server_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_logging_server_async_from_dict(): - await test_create_logging_server_async(request_type=dict) - - def test_create_logging_server_field_headers(): client = VmwareEngineClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13406,8 +13474,8 @@ async def test_create_logging_server_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmwareengine.UpdateLoggingServerRequest, - dict, + vmwareengine.UpdateLoggingServerRequest(), + {}, ], ) def test_update_logging_server(request_type, transport: str = "grpc"): @@ -13418,7 +13486,7 @@ def test_update_logging_server(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -13463,9 +13531,10 @@ def test_update_logging_server_non_empty_request_with_auto_populated_field(): client.update_logging_server(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmwareengine.UpdateLoggingServerRequest( + request_msg = vmwareengine.UpdateLoggingServerRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_logging_server_use_cached_wrapped_rpc(): @@ -13561,9 +13630,15 @@ async def test_update_logging_server_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmwareengine.UpdateLoggingServerRequest(), + {}, + ], +) async def test_update_logging_server_async( - transport: str = "grpc_asyncio", - request_type=vmwareengine.UpdateLoggingServerRequest, + request_type, transport: str = "grpc_asyncio" ): client = VmwareEngineAsyncClient( credentials=async_anonymous_credentials(), @@ -13572,7 +13647,7 @@ async def test_update_logging_server_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( @@ -13594,11 +13669,6 @@ async def test_update_logging_server_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_logging_server_async_from_dict(): - await test_update_logging_server_async(request_type=dict) - - def test_update_logging_server_field_headers(): client = VmwareEngineClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13763,8 +13833,8 @@ async def test_update_logging_server_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmwareengine.DeleteLoggingServerRequest, - dict, + vmwareengine.DeleteLoggingServerRequest(), + {}, ], ) def test_delete_logging_server(request_type, transport: str = "grpc"): @@ -13775,7 +13845,7 @@ def test_delete_logging_server(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -13821,10 +13891,11 @@ def test_delete_logging_server_non_empty_request_with_auto_populated_field(): client.delete_logging_server(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmwareengine.DeleteLoggingServerRequest( + request_msg = vmwareengine.DeleteLoggingServerRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_logging_server_use_cached_wrapped_rpc(): @@ -13920,9 +13991,15 @@ async def test_delete_logging_server_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmwareengine.DeleteLoggingServerRequest(), + {}, + ], +) async def test_delete_logging_server_async( - transport: str = "grpc_asyncio", - request_type=vmwareengine.DeleteLoggingServerRequest, + request_type, transport: str = "grpc_asyncio" ): client = VmwareEngineAsyncClient( credentials=async_anonymous_credentials(), @@ -13931,7 +14008,7 @@ async def test_delete_logging_server_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( @@ -13953,11 +14030,6 @@ async def test_delete_logging_server_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_logging_server_async_from_dict(): - await test_delete_logging_server_async(request_type=dict) - - def test_delete_logging_server_field_headers(): client = VmwareEngineClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14112,8 +14184,8 @@ async def test_delete_logging_server_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmwareengine.ListNodeTypesRequest, - dict, + vmwareengine.ListNodeTypesRequest(), + {}, ], ) def test_list_node_types(request_type, transport: str = "grpc"): @@ -14124,7 +14196,7 @@ def test_list_node_types(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_node_types), "__call__") as call: @@ -14172,11 +14244,12 @@ def test_list_node_types_non_empty_request_with_auto_populated_field(): client.list_node_types(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmwareengine.ListNodeTypesRequest( + request_msg = vmwareengine.ListNodeTypesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_node_types_use_cached_wrapped_rpc(): @@ -14257,9 +14330,14 @@ async def test_list_node_types_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_node_types_async( - transport: str = "grpc_asyncio", request_type=vmwareengine.ListNodeTypesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + vmwareengine.ListNodeTypesRequest(), + {}, + ], +) +async def test_list_node_types_async(request_type, transport: str = "grpc_asyncio"): client = VmwareEngineAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14267,7 +14345,7 @@ async def test_list_node_types_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_node_types), "__call__") as call: @@ -14292,11 +14370,6 @@ async def test_list_node_types_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_node_types_async_from_dict(): - await test_list_node_types_async(request_type=dict) - - def test_list_node_types_field_headers(): client = VmwareEngineClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14633,8 +14706,8 @@ async def test_list_node_types_async_pages(): @pytest.mark.parametrize( "request_type", [ - vmwareengine.GetNodeTypeRequest, - dict, + vmwareengine.GetNodeTypeRequest(), + {}, ], ) def test_get_node_type(request_type, transport: str = "grpc"): @@ -14645,7 +14718,7 @@ def test_get_node_type(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_node_type), "__call__") as call: @@ -14713,9 +14786,10 @@ def test_get_node_type_non_empty_request_with_auto_populated_field(): client.get_node_type(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmwareengine.GetNodeTypeRequest( + request_msg = vmwareengine.GetNodeTypeRequest( name="name_value", ) + assert args[0] == request_msg def test_get_node_type_use_cached_wrapped_rpc(): @@ -14796,9 +14870,14 @@ async def test_get_node_type_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_node_type_async( - transport: str = "grpc_asyncio", request_type=vmwareengine.GetNodeTypeRequest -): +@pytest.mark.parametrize( + "request_type", + [ + vmwareengine.GetNodeTypeRequest(), + {}, + ], +) +async def test_get_node_type_async(request_type, transport: str = "grpc_asyncio"): client = VmwareEngineAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -14806,7 +14885,7 @@ async def test_get_node_type_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_node_type), "__call__") as call: @@ -14853,11 +14932,6 @@ async def test_get_node_type_async( ] -@pytest.mark.asyncio -async def test_get_node_type_async_from_dict(): - await test_get_node_type_async(request_type=dict) - - def test_get_node_type_field_headers(): client = VmwareEngineClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15004,8 +15078,8 @@ async def test_get_node_type_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmwareengine.ShowNsxCredentialsRequest, - dict, + vmwareengine.ShowNsxCredentialsRequest(), + {}, ], ) def test_show_nsx_credentials(request_type, transport: str = "grpc"): @@ -15016,7 +15090,7 @@ def test_show_nsx_credentials(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -15066,9 +15140,10 @@ def test_show_nsx_credentials_non_empty_request_with_auto_populated_field(): client.show_nsx_credentials(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmwareengine.ShowNsxCredentialsRequest( + request_msg = vmwareengine.ShowNsxCredentialsRequest( private_cloud="private_cloud_value", ) + assert args[0] == request_msg def test_show_nsx_credentials_use_cached_wrapped_rpc(): @@ -15153,8 +15228,15 @@ async def test_show_nsx_credentials_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmwareengine.ShowNsxCredentialsRequest(), + {}, + ], +) async def test_show_nsx_credentials_async( - transport: str = "grpc_asyncio", request_type=vmwareengine.ShowNsxCredentialsRequest + request_type, transport: str = "grpc_asyncio" ): client = VmwareEngineAsyncClient( credentials=async_anonymous_credentials(), @@ -15163,7 +15245,7 @@ async def test_show_nsx_credentials_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( @@ -15190,11 +15272,6 @@ async def test_show_nsx_credentials_async( assert response.password == "password_value" -@pytest.mark.asyncio -async def test_show_nsx_credentials_async_from_dict(): - await test_show_nsx_credentials_async(request_type=dict) - - def test_show_nsx_credentials_field_headers(): client = VmwareEngineClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15349,8 +15426,8 @@ async def test_show_nsx_credentials_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmwareengine.ShowVcenterCredentialsRequest, - dict, + vmwareengine.ShowVcenterCredentialsRequest(), + {}, ], ) def test_show_vcenter_credentials(request_type, transport: str = "grpc"): @@ -15361,7 +15438,7 @@ def test_show_vcenter_credentials(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -15412,10 +15489,11 @@ def test_show_vcenter_credentials_non_empty_request_with_auto_populated_field(): client.show_vcenter_credentials(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmwareengine.ShowVcenterCredentialsRequest( + request_msg = vmwareengine.ShowVcenterCredentialsRequest( private_cloud="private_cloud_value", username="username_value", ) + assert args[0] == request_msg def test_show_vcenter_credentials_use_cached_wrapped_rpc(): @@ -15501,9 +15579,15 @@ async def test_show_vcenter_credentials_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmwareengine.ShowVcenterCredentialsRequest(), + {}, + ], +) async def test_show_vcenter_credentials_async( - transport: str = "grpc_asyncio", - request_type=vmwareengine.ShowVcenterCredentialsRequest, + request_type, transport: str = "grpc_asyncio" ): client = VmwareEngineAsyncClient( credentials=async_anonymous_credentials(), @@ -15512,7 +15596,7 @@ async def test_show_vcenter_credentials_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( @@ -15539,11 +15623,6 @@ async def test_show_vcenter_credentials_async( assert response.password == "password_value" -@pytest.mark.asyncio -async def test_show_vcenter_credentials_async_from_dict(): - await test_show_vcenter_credentials_async(request_type=dict) - - def test_show_vcenter_credentials_field_headers(): client = VmwareEngineClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15698,8 +15777,8 @@ async def test_show_vcenter_credentials_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmwareengine.ResetNsxCredentialsRequest, - dict, + vmwareengine.ResetNsxCredentialsRequest(), + {}, ], ) def test_reset_nsx_credentials(request_type, transport: str = "grpc"): @@ -15710,7 +15789,7 @@ def test_reset_nsx_credentials(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -15756,10 +15835,11 @@ def test_reset_nsx_credentials_non_empty_request_with_auto_populated_field(): client.reset_nsx_credentials(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmwareengine.ResetNsxCredentialsRequest( + request_msg = vmwareengine.ResetNsxCredentialsRequest( private_cloud="private_cloud_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_reset_nsx_credentials_use_cached_wrapped_rpc(): @@ -15855,9 +15935,15 @@ async def test_reset_nsx_credentials_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmwareengine.ResetNsxCredentialsRequest(), + {}, + ], +) async def test_reset_nsx_credentials_async( - transport: str = "grpc_asyncio", - request_type=vmwareengine.ResetNsxCredentialsRequest, + request_type, transport: str = "grpc_asyncio" ): client = VmwareEngineAsyncClient( credentials=async_anonymous_credentials(), @@ -15866,7 +15952,7 @@ async def test_reset_nsx_credentials_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( @@ -15888,11 +15974,6 @@ async def test_reset_nsx_credentials_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_reset_nsx_credentials_async_from_dict(): - await test_reset_nsx_credentials_async(request_type=dict) - - def test_reset_nsx_credentials_field_headers(): client = VmwareEngineClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16047,8 +16128,8 @@ async def test_reset_nsx_credentials_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmwareengine.ResetVcenterCredentialsRequest, - dict, + vmwareengine.ResetVcenterCredentialsRequest(), + {}, ], ) def test_reset_vcenter_credentials(request_type, transport: str = "grpc"): @@ -16059,7 +16140,7 @@ def test_reset_vcenter_credentials(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -16106,11 +16187,12 @@ def test_reset_vcenter_credentials_non_empty_request_with_auto_populated_field() client.reset_vcenter_credentials(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmwareengine.ResetVcenterCredentialsRequest( + request_msg = vmwareengine.ResetVcenterCredentialsRequest( private_cloud="private_cloud_value", request_id="request_id_value", username="username_value", ) + assert args[0] == request_msg def test_reset_vcenter_credentials_use_cached_wrapped_rpc(): @@ -16206,9 +16288,15 @@ async def test_reset_vcenter_credentials_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmwareengine.ResetVcenterCredentialsRequest(), + {}, + ], +) async def test_reset_vcenter_credentials_async( - transport: str = "grpc_asyncio", - request_type=vmwareengine.ResetVcenterCredentialsRequest, + request_type, transport: str = "grpc_asyncio" ): client = VmwareEngineAsyncClient( credentials=async_anonymous_credentials(), @@ -16217,7 +16305,7 @@ async def test_reset_vcenter_credentials_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( @@ -16239,11 +16327,6 @@ async def test_reset_vcenter_credentials_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_reset_vcenter_credentials_async_from_dict(): - await test_reset_vcenter_credentials_async(request_type=dict) - - def test_reset_vcenter_credentials_field_headers(): client = VmwareEngineClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16398,8 +16481,8 @@ async def test_reset_vcenter_credentials_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmwareengine.GetDnsForwardingRequest, - dict, + vmwareengine.GetDnsForwardingRequest(), + {}, ], ) def test_get_dns_forwarding(request_type, transport: str = "grpc"): @@ -16410,7 +16493,7 @@ def test_get_dns_forwarding(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -16458,9 +16541,10 @@ def test_get_dns_forwarding_non_empty_request_with_auto_populated_field(): client.get_dns_forwarding(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmwareengine.GetDnsForwardingRequest( + request_msg = vmwareengine.GetDnsForwardingRequest( name="name_value", ) + assert args[0] == request_msg def test_get_dns_forwarding_use_cached_wrapped_rpc(): @@ -16545,9 +16629,14 @@ async def test_get_dns_forwarding_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_dns_forwarding_async( - transport: str = "grpc_asyncio", request_type=vmwareengine.GetDnsForwardingRequest -): +@pytest.mark.parametrize( + "request_type", + [ + vmwareengine.GetDnsForwardingRequest(), + {}, + ], +) +async def test_get_dns_forwarding_async(request_type, transport: str = "grpc_asyncio"): client = VmwareEngineAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -16555,7 +16644,7 @@ async def test_get_dns_forwarding_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( @@ -16580,11 +16669,6 @@ async def test_get_dns_forwarding_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_dns_forwarding_async_from_dict(): - await test_get_dns_forwarding_async(request_type=dict) - - def test_get_dns_forwarding_field_headers(): client = VmwareEngineClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16739,8 +16823,8 @@ async def test_get_dns_forwarding_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmwareengine.UpdateDnsForwardingRequest, - dict, + vmwareengine.UpdateDnsForwardingRequest(), + {}, ], ) def test_update_dns_forwarding(request_type, transport: str = "grpc"): @@ -16751,7 +16835,7 @@ def test_update_dns_forwarding(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -16796,9 +16880,10 @@ def test_update_dns_forwarding_non_empty_request_with_auto_populated_field(): client.update_dns_forwarding(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmwareengine.UpdateDnsForwardingRequest( + request_msg = vmwareengine.UpdateDnsForwardingRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_dns_forwarding_use_cached_wrapped_rpc(): @@ -16894,9 +16979,15 @@ async def test_update_dns_forwarding_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmwareengine.UpdateDnsForwardingRequest(), + {}, + ], +) async def test_update_dns_forwarding_async( - transport: str = "grpc_asyncio", - request_type=vmwareengine.UpdateDnsForwardingRequest, + request_type, transport: str = "grpc_asyncio" ): client = VmwareEngineAsyncClient( credentials=async_anonymous_credentials(), @@ -16905,7 +16996,7 @@ async def test_update_dns_forwarding_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( @@ -16927,11 +17018,6 @@ async def test_update_dns_forwarding_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_dns_forwarding_async_from_dict(): - await test_update_dns_forwarding_async(request_type=dict) - - def test_update_dns_forwarding_field_headers(): client = VmwareEngineClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17096,8 +17182,8 @@ async def test_update_dns_forwarding_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmwareengine.GetNetworkPeeringRequest, - dict, + vmwareengine.GetNetworkPeeringRequest(), + {}, ], ) def test_get_network_peering(request_type, transport: str = "grpc"): @@ -17108,7 +17194,7 @@ def test_get_network_peering(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -17185,9 +17271,10 @@ def test_get_network_peering_non_empty_request_with_auto_populated_field(): client.get_network_peering(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmwareengine.GetNetworkPeeringRequest( + request_msg = vmwareengine.GetNetworkPeeringRequest( name="name_value", ) + assert args[0] == request_msg def test_get_network_peering_use_cached_wrapped_rpc(): @@ -17272,9 +17359,14 @@ async def test_get_network_peering_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_network_peering_async( - transport: str = "grpc_asyncio", request_type=vmwareengine.GetNetworkPeeringRequest -): +@pytest.mark.parametrize( + "request_type", + [ + vmwareengine.GetNetworkPeeringRequest(), + {}, + ], +) +async def test_get_network_peering_async(request_type, transport: str = "grpc_asyncio"): client = VmwareEngineAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -17282,7 +17374,7 @@ async def test_get_network_peering_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( @@ -17336,11 +17428,6 @@ async def test_get_network_peering_async( assert response.description == "description_value" -@pytest.mark.asyncio -async def test_get_network_peering_async_from_dict(): - await test_get_network_peering_async(request_type=dict) - - def test_get_network_peering_field_headers(): client = VmwareEngineClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17495,8 +17582,8 @@ async def test_get_network_peering_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmwareengine.ListNetworkPeeringsRequest, - dict, + vmwareengine.ListNetworkPeeringsRequest(), + {}, ], ) def test_list_network_peerings(request_type, transport: str = "grpc"): @@ -17507,7 +17594,7 @@ def test_list_network_peerings(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -17560,12 +17647,13 @@ def test_list_network_peerings_non_empty_request_with_auto_populated_field(): client.list_network_peerings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmwareengine.ListNetworkPeeringsRequest( + request_msg = vmwareengine.ListNetworkPeeringsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_network_peerings_use_cached_wrapped_rpc(): @@ -17651,9 +17739,15 @@ async def test_list_network_peerings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmwareengine.ListNetworkPeeringsRequest(), + {}, + ], +) async def test_list_network_peerings_async( - transport: str = "grpc_asyncio", - request_type=vmwareengine.ListNetworkPeeringsRequest, + request_type, transport: str = "grpc_asyncio" ): client = VmwareEngineAsyncClient( credentials=async_anonymous_credentials(), @@ -17662,7 +17756,7 @@ async def test_list_network_peerings_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( @@ -17689,11 +17783,6 @@ async def test_list_network_peerings_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_network_peerings_async_from_dict(): - await test_list_network_peerings_async(request_type=dict) - - def test_list_network_peerings_field_headers(): client = VmwareEngineClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18050,8 +18139,8 @@ async def test_list_network_peerings_async_pages(): @pytest.mark.parametrize( "request_type", [ - vmwareengine.CreateNetworkPeeringRequest, - dict, + vmwareengine.CreateNetworkPeeringRequest(), + {}, ], ) def test_create_network_peering(request_type, transport: str = "grpc"): @@ -18062,7 +18151,7 @@ def test_create_network_peering(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -18109,11 +18198,12 @@ def test_create_network_peering_non_empty_request_with_auto_populated_field(): client.create_network_peering(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmwareengine.CreateNetworkPeeringRequest( + request_msg = vmwareengine.CreateNetworkPeeringRequest( parent="parent_value", network_peering_id="network_peering_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_network_peering_use_cached_wrapped_rpc(): @@ -18209,9 +18299,15 @@ async def test_create_network_peering_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmwareengine.CreateNetworkPeeringRequest(), + {}, + ], +) async def test_create_network_peering_async( - transport: str = "grpc_asyncio", - request_type=vmwareengine.CreateNetworkPeeringRequest, + request_type, transport: str = "grpc_asyncio" ): client = VmwareEngineAsyncClient( credentials=async_anonymous_credentials(), @@ -18220,7 +18316,7 @@ async def test_create_network_peering_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( @@ -18242,11 +18338,6 @@ async def test_create_network_peering_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_network_peering_async_from_dict(): - await test_create_network_peering_async(request_type=dict) - - def test_create_network_peering_field_headers(): client = VmwareEngineClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18421,8 +18512,8 @@ async def test_create_network_peering_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmwareengine.DeleteNetworkPeeringRequest, - dict, + vmwareengine.DeleteNetworkPeeringRequest(), + {}, ], ) def test_delete_network_peering(request_type, transport: str = "grpc"): @@ -18433,7 +18524,7 @@ def test_delete_network_peering(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -18479,10 +18570,11 @@ def test_delete_network_peering_non_empty_request_with_auto_populated_field(): client.delete_network_peering(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmwareengine.DeleteNetworkPeeringRequest( + request_msg = vmwareengine.DeleteNetworkPeeringRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_network_peering_use_cached_wrapped_rpc(): @@ -18578,9 +18670,15 @@ async def test_delete_network_peering_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmwareengine.DeleteNetworkPeeringRequest(), + {}, + ], +) async def test_delete_network_peering_async( - transport: str = "grpc_asyncio", - request_type=vmwareengine.DeleteNetworkPeeringRequest, + request_type, transport: str = "grpc_asyncio" ): client = VmwareEngineAsyncClient( credentials=async_anonymous_credentials(), @@ -18589,7 +18687,7 @@ async def test_delete_network_peering_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( @@ -18611,11 +18709,6 @@ async def test_delete_network_peering_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_network_peering_async_from_dict(): - await test_delete_network_peering_async(request_type=dict) - - def test_delete_network_peering_field_headers(): client = VmwareEngineClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18770,8 +18863,8 @@ async def test_delete_network_peering_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmwareengine.UpdateNetworkPeeringRequest, - dict, + vmwareengine.UpdateNetworkPeeringRequest(), + {}, ], ) def test_update_network_peering(request_type, transport: str = "grpc"): @@ -18782,7 +18875,7 @@ def test_update_network_peering(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -18827,9 +18920,10 @@ def test_update_network_peering_non_empty_request_with_auto_populated_field(): client.update_network_peering(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmwareengine.UpdateNetworkPeeringRequest( + request_msg = vmwareengine.UpdateNetworkPeeringRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_network_peering_use_cached_wrapped_rpc(): @@ -18925,9 +19019,15 @@ async def test_update_network_peering_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmwareengine.UpdateNetworkPeeringRequest(), + {}, + ], +) async def test_update_network_peering_async( - transport: str = "grpc_asyncio", - request_type=vmwareengine.UpdateNetworkPeeringRequest, + request_type, transport: str = "grpc_asyncio" ): client = VmwareEngineAsyncClient( credentials=async_anonymous_credentials(), @@ -18936,7 +19036,7 @@ async def test_update_network_peering_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( @@ -18958,11 +19058,6 @@ async def test_update_network_peering_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_network_peering_async_from_dict(): - await test_update_network_peering_async(request_type=dict) - - def test_update_network_peering_field_headers(): client = VmwareEngineClient( credentials=ga_credentials.AnonymousCredentials(), @@ -19127,8 +19222,8 @@ async def test_update_network_peering_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmwareengine.ListPeeringRoutesRequest, - dict, + vmwareengine.ListPeeringRoutesRequest(), + {}, ], ) def test_list_peering_routes(request_type, transport: str = "grpc"): @@ -19139,7 +19234,7 @@ def test_list_peering_routes(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -19189,11 +19284,12 @@ def test_list_peering_routes_non_empty_request_with_auto_populated_field(): client.list_peering_routes(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmwareengine.ListPeeringRoutesRequest( + request_msg = vmwareengine.ListPeeringRoutesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_peering_routes_use_cached_wrapped_rpc(): @@ -19278,9 +19374,14 @@ async def test_list_peering_routes_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_peering_routes_async( - transport: str = "grpc_asyncio", request_type=vmwareengine.ListPeeringRoutesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + vmwareengine.ListPeeringRoutesRequest(), + {}, + ], +) +async def test_list_peering_routes_async(request_type, transport: str = "grpc_asyncio"): client = VmwareEngineAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -19288,7 +19389,7 @@ async def test_list_peering_routes_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( @@ -19313,11 +19414,6 @@ async def test_list_peering_routes_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_peering_routes_async_from_dict(): - await test_list_peering_routes_async(request_type=dict) - - def test_list_peering_routes_field_headers(): client = VmwareEngineClient( credentials=ga_credentials.AnonymousCredentials(), @@ -19672,8 +19768,8 @@ async def test_list_peering_routes_async_pages(): @pytest.mark.parametrize( "request_type", [ - vmwareengine.CreateHcxActivationKeyRequest, - dict, + vmwareengine.CreateHcxActivationKeyRequest(), + {}, ], ) def test_create_hcx_activation_key(request_type, transport: str = "grpc"): @@ -19684,7 +19780,7 @@ def test_create_hcx_activation_key(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -19731,11 +19827,12 @@ def test_create_hcx_activation_key_non_empty_request_with_auto_populated_field() client.create_hcx_activation_key(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmwareengine.CreateHcxActivationKeyRequest( + request_msg = vmwareengine.CreateHcxActivationKeyRequest( parent="parent_value", hcx_activation_key_id="hcx_activation_key_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_hcx_activation_key_use_cached_wrapped_rpc(): @@ -19831,9 +19928,15 @@ async def test_create_hcx_activation_key_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmwareengine.CreateHcxActivationKeyRequest(), + {}, + ], +) async def test_create_hcx_activation_key_async( - transport: str = "grpc_asyncio", - request_type=vmwareengine.CreateHcxActivationKeyRequest, + request_type, transport: str = "grpc_asyncio" ): client = VmwareEngineAsyncClient( credentials=async_anonymous_credentials(), @@ -19842,7 +19945,7 @@ async def test_create_hcx_activation_key_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( @@ -19864,11 +19967,6 @@ async def test_create_hcx_activation_key_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_hcx_activation_key_async_from_dict(): - await test_create_hcx_activation_key_async(request_type=dict) - - def test_create_hcx_activation_key_field_headers(): client = VmwareEngineClient( credentials=ga_credentials.AnonymousCredentials(), @@ -20051,8 +20149,8 @@ async def test_create_hcx_activation_key_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmwareengine.ListHcxActivationKeysRequest, - dict, + vmwareengine.ListHcxActivationKeysRequest(), + {}, ], ) def test_list_hcx_activation_keys(request_type, transport: str = "grpc"): @@ -20063,7 +20161,7 @@ def test_list_hcx_activation_keys(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -20114,10 +20212,11 @@ def test_list_hcx_activation_keys_non_empty_request_with_auto_populated_field(): client.list_hcx_activation_keys(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmwareengine.ListHcxActivationKeysRequest( + request_msg = vmwareengine.ListHcxActivationKeysRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_hcx_activation_keys_use_cached_wrapped_rpc(): @@ -20203,9 +20302,15 @@ async def test_list_hcx_activation_keys_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmwareengine.ListHcxActivationKeysRequest(), + {}, + ], +) async def test_list_hcx_activation_keys_async( - transport: str = "grpc_asyncio", - request_type=vmwareengine.ListHcxActivationKeysRequest, + request_type, transport: str = "grpc_asyncio" ): client = VmwareEngineAsyncClient( credentials=async_anonymous_credentials(), @@ -20214,7 +20319,7 @@ async def test_list_hcx_activation_keys_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( @@ -20241,11 +20346,6 @@ async def test_list_hcx_activation_keys_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_hcx_activation_keys_async_from_dict(): - await test_list_hcx_activation_keys_async(request_type=dict) - - def test_list_hcx_activation_keys_field_headers(): client = VmwareEngineClient( credentials=ga_credentials.AnonymousCredentials(), @@ -20604,8 +20704,8 @@ async def test_list_hcx_activation_keys_async_pages(): @pytest.mark.parametrize( "request_type", [ - vmwareengine.GetHcxActivationKeyRequest, - dict, + vmwareengine.GetHcxActivationKeyRequest(), + {}, ], ) def test_get_hcx_activation_key(request_type, transport: str = "grpc"): @@ -20616,7 +20716,7 @@ def test_get_hcx_activation_key(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -20670,9 +20770,10 @@ def test_get_hcx_activation_key_non_empty_request_with_auto_populated_field(): client.get_hcx_activation_key(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmwareengine.GetHcxActivationKeyRequest( + request_msg = vmwareengine.GetHcxActivationKeyRequest( name="name_value", ) + assert args[0] == request_msg def test_get_hcx_activation_key_use_cached_wrapped_rpc(): @@ -20758,9 +20859,15 @@ async def test_get_hcx_activation_key_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmwareengine.GetHcxActivationKeyRequest(), + {}, + ], +) async def test_get_hcx_activation_key_async( - transport: str = "grpc_asyncio", - request_type=vmwareengine.GetHcxActivationKeyRequest, + request_type, transport: str = "grpc_asyncio" ): client = VmwareEngineAsyncClient( credentials=async_anonymous_credentials(), @@ -20769,7 +20876,7 @@ async def test_get_hcx_activation_key_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( @@ -20800,11 +20907,6 @@ async def test_get_hcx_activation_key_async( assert response.uid == "uid_value" -@pytest.mark.asyncio -async def test_get_hcx_activation_key_async_from_dict(): - await test_get_hcx_activation_key_async(request_type=dict) - - def test_get_hcx_activation_key_field_headers(): client = VmwareEngineClient( credentials=ga_credentials.AnonymousCredentials(), @@ -20959,8 +21061,8 @@ async def test_get_hcx_activation_key_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmwareengine.GetNetworkPolicyRequest, - dict, + vmwareengine.GetNetworkPolicyRequest(), + {}, ], ) def test_get_network_policy(request_type, transport: str = "grpc"): @@ -20971,7 +21073,7 @@ def test_get_network_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( @@ -21032,9 +21134,10 @@ def test_get_network_policy_non_empty_request_with_auto_populated_field(): client.get_network_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmwareengine.GetNetworkPolicyRequest( + request_msg = vmwareengine.GetNetworkPolicyRequest( name="name_value", ) + assert args[0] == request_msg def test_get_network_policy_use_cached_wrapped_rpc(): @@ -21119,9 +21222,14 @@ async def test_get_network_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_network_policy_async( - transport: str = "grpc_asyncio", request_type=vmwareengine.GetNetworkPolicyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + vmwareengine.GetNetworkPolicyRequest(), + {}, + ], +) +async def test_get_network_policy_async(request_type, transport: str = "grpc_asyncio"): client = VmwareEngineAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -21129,7 +21237,7 @@ async def test_get_network_policy_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( @@ -21167,11 +21275,6 @@ async def test_get_network_policy_async( ) -@pytest.mark.asyncio -async def test_get_network_policy_async_from_dict(): - await test_get_network_policy_async(request_type=dict) - - def test_get_network_policy_field_headers(): client = VmwareEngineClient( credentials=ga_credentials.AnonymousCredentials(), @@ -21326,8 +21429,8 @@ async def test_get_network_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmwareengine.ListNetworkPoliciesRequest, - dict, + vmwareengine.ListNetworkPoliciesRequest(), + {}, ], ) def test_list_network_policies(request_type, transport: str = "grpc"): @@ -21338,7 +21441,7 @@ def test_list_network_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( @@ -21391,12 +21494,13 @@ def test_list_network_policies_non_empty_request_with_auto_populated_field(): client.list_network_policies(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmwareengine.ListNetworkPoliciesRequest( + request_msg = vmwareengine.ListNetworkPoliciesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_network_policies_use_cached_wrapped_rpc(): @@ -21482,9 +21586,15 @@ async def test_list_network_policies_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmwareengine.ListNetworkPoliciesRequest(), + {}, + ], +) async def test_list_network_policies_async( - transport: str = "grpc_asyncio", - request_type=vmwareengine.ListNetworkPoliciesRequest, + request_type, transport: str = "grpc_asyncio" ): client = VmwareEngineAsyncClient( credentials=async_anonymous_credentials(), @@ -21493,7 +21603,7 @@ async def test_list_network_policies_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( @@ -21520,11 +21630,6 @@ async def test_list_network_policies_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_network_policies_async_from_dict(): - await test_list_network_policies_async(request_type=dict) - - def test_list_network_policies_field_headers(): client = VmwareEngineClient( credentials=ga_credentials.AnonymousCredentials(), @@ -21879,8 +21984,8 @@ async def test_list_network_policies_async_pages(): @pytest.mark.parametrize( "request_type", [ - vmwareengine.CreateNetworkPolicyRequest, - dict, + vmwareengine.CreateNetworkPolicyRequest(), + {}, ], ) def test_create_network_policy(request_type, transport: str = "grpc"): @@ -21891,7 +21996,7 @@ def test_create_network_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( @@ -21938,11 +22043,12 @@ def test_create_network_policy_non_empty_request_with_auto_populated_field(): client.create_network_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmwareengine.CreateNetworkPolicyRequest( + request_msg = vmwareengine.CreateNetworkPolicyRequest( parent="parent_value", network_policy_id="network_policy_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_network_policy_use_cached_wrapped_rpc(): @@ -22038,9 +22144,15 @@ async def test_create_network_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmwareengine.CreateNetworkPolicyRequest(), + {}, + ], +) async def test_create_network_policy_async( - transport: str = "grpc_asyncio", - request_type=vmwareengine.CreateNetworkPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = VmwareEngineAsyncClient( credentials=async_anonymous_credentials(), @@ -22049,7 +22161,7 @@ async def test_create_network_policy_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( @@ -22071,11 +22183,6 @@ async def test_create_network_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_network_policy_async_from_dict(): - await test_create_network_policy_async(request_type=dict) - - def test_create_network_policy_field_headers(): client = VmwareEngineClient( credentials=ga_credentials.AnonymousCredentials(), @@ -22250,8 +22357,8 @@ async def test_create_network_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmwareengine.UpdateNetworkPolicyRequest, - dict, + vmwareengine.UpdateNetworkPolicyRequest(), + {}, ], ) def test_update_network_policy(request_type, transport: str = "grpc"): @@ -22262,7 +22369,7 @@ def test_update_network_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( @@ -22307,9 +22414,10 @@ def test_update_network_policy_non_empty_request_with_auto_populated_field(): client.update_network_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmwareengine.UpdateNetworkPolicyRequest( + request_msg = vmwareengine.UpdateNetworkPolicyRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_network_policy_use_cached_wrapped_rpc(): @@ -22405,9 +22513,15 @@ async def test_update_network_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmwareengine.UpdateNetworkPolicyRequest(), + {}, + ], +) async def test_update_network_policy_async( - transport: str = "grpc_asyncio", - request_type=vmwareengine.UpdateNetworkPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = VmwareEngineAsyncClient( credentials=async_anonymous_credentials(), @@ -22416,7 +22530,7 @@ async def test_update_network_policy_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( @@ -22438,11 +22552,6 @@ async def test_update_network_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_network_policy_async_from_dict(): - await test_update_network_policy_async(request_type=dict) - - def test_update_network_policy_field_headers(): client = VmwareEngineClient( credentials=ga_credentials.AnonymousCredentials(), @@ -22607,8 +22716,8 @@ async def test_update_network_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmwareengine.DeleteNetworkPolicyRequest, - dict, + vmwareengine.DeleteNetworkPolicyRequest(), + {}, ], ) def test_delete_network_policy(request_type, transport: str = "grpc"): @@ -22619,7 +22728,7 @@ def test_delete_network_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( @@ -22665,10 +22774,11 @@ def test_delete_network_policy_non_empty_request_with_auto_populated_field(): client.delete_network_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmwareengine.DeleteNetworkPolicyRequest( + request_msg = vmwareengine.DeleteNetworkPolicyRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_network_policy_use_cached_wrapped_rpc(): @@ -22764,9 +22874,15 @@ async def test_delete_network_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmwareengine.DeleteNetworkPolicyRequest(), + {}, + ], +) async def test_delete_network_policy_async( - transport: str = "grpc_asyncio", - request_type=vmwareengine.DeleteNetworkPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = VmwareEngineAsyncClient( credentials=async_anonymous_credentials(), @@ -22775,7 +22891,7 @@ async def test_delete_network_policy_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( @@ -22797,11 +22913,6 @@ async def test_delete_network_policy_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_network_policy_async_from_dict(): - await test_delete_network_policy_async(request_type=dict) - - def test_delete_network_policy_field_headers(): client = VmwareEngineClient( credentials=ga_credentials.AnonymousCredentials(), @@ -22956,8 +23067,8 @@ async def test_delete_network_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmwareengine.ListManagementDnsZoneBindingsRequest, - dict, + vmwareengine.ListManagementDnsZoneBindingsRequest(), + {}, ], ) def test_list_management_dns_zone_bindings(request_type, transport: str = "grpc"): @@ -22968,7 +23079,7 @@ def test_list_management_dns_zone_bindings(request_type, transport: str = "grpc" # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -23021,12 +23132,13 @@ def test_list_management_dns_zone_bindings_non_empty_request_with_auto_populated client.list_management_dns_zone_bindings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmwareengine.ListManagementDnsZoneBindingsRequest( + request_msg = vmwareengine.ListManagementDnsZoneBindingsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_management_dns_zone_bindings_use_cached_wrapped_rpc(): @@ -23112,9 +23224,15 @@ async def test_list_management_dns_zone_bindings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmwareengine.ListManagementDnsZoneBindingsRequest(), + {}, + ], +) async def test_list_management_dns_zone_bindings_async( - transport: str = "grpc_asyncio", - request_type=vmwareengine.ListManagementDnsZoneBindingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = VmwareEngineAsyncClient( credentials=async_anonymous_credentials(), @@ -23123,7 +23241,7 @@ async def test_list_management_dns_zone_bindings_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( @@ -23150,11 +23268,6 @@ async def test_list_management_dns_zone_bindings_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_management_dns_zone_bindings_async_from_dict(): - await test_list_management_dns_zone_bindings_async(request_type=dict) - - def test_list_management_dns_zone_bindings_field_headers(): client = VmwareEngineClient( credentials=ga_credentials.AnonymousCredentials(), @@ -23517,8 +23630,8 @@ async def test_list_management_dns_zone_bindings_async_pages(): @pytest.mark.parametrize( "request_type", [ - vmwareengine.GetManagementDnsZoneBindingRequest, - dict, + vmwareengine.GetManagementDnsZoneBindingRequest(), + {}, ], ) def test_get_management_dns_zone_binding(request_type, transport: str = "grpc"): @@ -23529,7 +23642,7 @@ def test_get_management_dns_zone_binding(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -23586,9 +23699,10 @@ def test_get_management_dns_zone_binding_non_empty_request_with_auto_populated_f client.get_management_dns_zone_binding(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmwareengine.GetManagementDnsZoneBindingRequest( + request_msg = vmwareengine.GetManagementDnsZoneBindingRequest( name="name_value", ) + assert args[0] == request_msg def test_get_management_dns_zone_binding_use_cached_wrapped_rpc(): @@ -23674,9 +23788,15 @@ async def test_get_management_dns_zone_binding_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmwareengine.GetManagementDnsZoneBindingRequest(), + {}, + ], +) async def test_get_management_dns_zone_binding_async( - transport: str = "grpc_asyncio", - request_type=vmwareengine.GetManagementDnsZoneBindingRequest, + request_type, transport: str = "grpc_asyncio" ): client = VmwareEngineAsyncClient( credentials=async_anonymous_credentials(), @@ -23685,7 +23805,7 @@ async def test_get_management_dns_zone_binding_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( @@ -23718,11 +23838,6 @@ async def test_get_management_dns_zone_binding_async( assert response.uid == "uid_value" -@pytest.mark.asyncio -async def test_get_management_dns_zone_binding_async_from_dict(): - await test_get_management_dns_zone_binding_async(request_type=dict) - - def test_get_management_dns_zone_binding_field_headers(): client = VmwareEngineClient( credentials=ga_credentials.AnonymousCredentials(), @@ -23877,8 +23992,8 @@ async def test_get_management_dns_zone_binding_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmwareengine.CreateManagementDnsZoneBindingRequest, - dict, + vmwareengine.CreateManagementDnsZoneBindingRequest(), + {}, ], ) def test_create_management_dns_zone_binding(request_type, transport: str = "grpc"): @@ -23889,7 +24004,7 @@ def test_create_management_dns_zone_binding(request_type, transport: str = "grpc # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -23936,11 +24051,12 @@ def test_create_management_dns_zone_binding_non_empty_request_with_auto_populate client.create_management_dns_zone_binding(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmwareengine.CreateManagementDnsZoneBindingRequest( + request_msg = vmwareengine.CreateManagementDnsZoneBindingRequest( parent="parent_value", management_dns_zone_binding_id="management_dns_zone_binding_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_management_dns_zone_binding_use_cached_wrapped_rpc(): @@ -24036,9 +24152,15 @@ async def test_create_management_dns_zone_binding_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmwareengine.CreateManagementDnsZoneBindingRequest(), + {}, + ], +) async def test_create_management_dns_zone_binding_async( - transport: str = "grpc_asyncio", - request_type=vmwareengine.CreateManagementDnsZoneBindingRequest, + request_type, transport: str = "grpc_asyncio" ): client = VmwareEngineAsyncClient( credentials=async_anonymous_credentials(), @@ -24047,7 +24169,7 @@ async def test_create_management_dns_zone_binding_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( @@ -24069,11 +24191,6 @@ async def test_create_management_dns_zone_binding_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_management_dns_zone_binding_async_from_dict(): - await test_create_management_dns_zone_binding_async(request_type=dict) - - def test_create_management_dns_zone_binding_field_headers(): client = VmwareEngineClient( credentials=ga_credentials.AnonymousCredentials(), @@ -24256,8 +24373,8 @@ async def test_create_management_dns_zone_binding_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmwareengine.UpdateManagementDnsZoneBindingRequest, - dict, + vmwareengine.UpdateManagementDnsZoneBindingRequest(), + {}, ], ) def test_update_management_dns_zone_binding(request_type, transport: str = "grpc"): @@ -24268,7 +24385,7 @@ def test_update_management_dns_zone_binding(request_type, transport: str = "grpc # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -24313,9 +24430,10 @@ def test_update_management_dns_zone_binding_non_empty_request_with_auto_populate client.update_management_dns_zone_binding(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmwareengine.UpdateManagementDnsZoneBindingRequest( + request_msg = vmwareengine.UpdateManagementDnsZoneBindingRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_management_dns_zone_binding_use_cached_wrapped_rpc(): @@ -24411,9 +24529,15 @@ async def test_update_management_dns_zone_binding_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmwareengine.UpdateManagementDnsZoneBindingRequest(), + {}, + ], +) async def test_update_management_dns_zone_binding_async( - transport: str = "grpc_asyncio", - request_type=vmwareengine.UpdateManagementDnsZoneBindingRequest, + request_type, transport: str = "grpc_asyncio" ): client = VmwareEngineAsyncClient( credentials=async_anonymous_credentials(), @@ -24422,7 +24546,7 @@ async def test_update_management_dns_zone_binding_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( @@ -24444,11 +24568,6 @@ async def test_update_management_dns_zone_binding_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_management_dns_zone_binding_async_from_dict(): - await test_update_management_dns_zone_binding_async(request_type=dict) - - def test_update_management_dns_zone_binding_field_headers(): client = VmwareEngineClient( credentials=ga_credentials.AnonymousCredentials(), @@ -24621,8 +24740,8 @@ async def test_update_management_dns_zone_binding_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmwareengine.DeleteManagementDnsZoneBindingRequest, - dict, + vmwareengine.DeleteManagementDnsZoneBindingRequest(), + {}, ], ) def test_delete_management_dns_zone_binding(request_type, transport: str = "grpc"): @@ -24633,7 +24752,7 @@ def test_delete_management_dns_zone_binding(request_type, transport: str = "grpc # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -24679,10 +24798,11 @@ def test_delete_management_dns_zone_binding_non_empty_request_with_auto_populate client.delete_management_dns_zone_binding(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmwareengine.DeleteManagementDnsZoneBindingRequest( + request_msg = vmwareengine.DeleteManagementDnsZoneBindingRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_management_dns_zone_binding_use_cached_wrapped_rpc(): @@ -24778,9 +24898,15 @@ async def test_delete_management_dns_zone_binding_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmwareengine.DeleteManagementDnsZoneBindingRequest(), + {}, + ], +) async def test_delete_management_dns_zone_binding_async( - transport: str = "grpc_asyncio", - request_type=vmwareengine.DeleteManagementDnsZoneBindingRequest, + request_type, transport: str = "grpc_asyncio" ): client = VmwareEngineAsyncClient( credentials=async_anonymous_credentials(), @@ -24789,7 +24915,7 @@ async def test_delete_management_dns_zone_binding_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( @@ -24811,11 +24937,6 @@ async def test_delete_management_dns_zone_binding_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_management_dns_zone_binding_async_from_dict(): - await test_delete_management_dns_zone_binding_async(request_type=dict) - - def test_delete_management_dns_zone_binding_field_headers(): client = VmwareEngineClient( credentials=ga_credentials.AnonymousCredentials(), @@ -24970,8 +25091,8 @@ async def test_delete_management_dns_zone_binding_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmwareengine.RepairManagementDnsZoneBindingRequest, - dict, + vmwareengine.RepairManagementDnsZoneBindingRequest(), + {}, ], ) def test_repair_management_dns_zone_binding(request_type, transport: str = "grpc"): @@ -24982,7 +25103,7 @@ def test_repair_management_dns_zone_binding(request_type, transport: str = "grpc # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -25028,10 +25149,11 @@ def test_repair_management_dns_zone_binding_non_empty_request_with_auto_populate client.repair_management_dns_zone_binding(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmwareengine.RepairManagementDnsZoneBindingRequest( + request_msg = vmwareengine.RepairManagementDnsZoneBindingRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_repair_management_dns_zone_binding_use_cached_wrapped_rpc(): @@ -25127,9 +25249,15 @@ async def test_repair_management_dns_zone_binding_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmwareengine.RepairManagementDnsZoneBindingRequest(), + {}, + ], +) async def test_repair_management_dns_zone_binding_async( - transport: str = "grpc_asyncio", - request_type=vmwareengine.RepairManagementDnsZoneBindingRequest, + request_type, transport: str = "grpc_asyncio" ): client = VmwareEngineAsyncClient( credentials=async_anonymous_credentials(), @@ -25138,7 +25266,7 @@ async def test_repair_management_dns_zone_binding_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( @@ -25160,11 +25288,6 @@ async def test_repair_management_dns_zone_binding_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_repair_management_dns_zone_binding_async_from_dict(): - await test_repair_management_dns_zone_binding_async(request_type=dict) - - def test_repair_management_dns_zone_binding_field_headers(): client = VmwareEngineClient( credentials=ga_credentials.AnonymousCredentials(), @@ -25319,8 +25442,8 @@ async def test_repair_management_dns_zone_binding_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmwareengine.CreateVmwareEngineNetworkRequest, - dict, + vmwareengine.CreateVmwareEngineNetworkRequest(), + {}, ], ) def test_create_vmware_engine_network(request_type, transport: str = "grpc"): @@ -25331,7 +25454,7 @@ def test_create_vmware_engine_network(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -25378,11 +25501,12 @@ def test_create_vmware_engine_network_non_empty_request_with_auto_populated_fiel client.create_vmware_engine_network(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmwareengine.CreateVmwareEngineNetworkRequest( + request_msg = vmwareengine.CreateVmwareEngineNetworkRequest( parent="parent_value", vmware_engine_network_id="vmware_engine_network_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_vmware_engine_network_use_cached_wrapped_rpc(): @@ -25478,9 +25602,15 @@ async def test_create_vmware_engine_network_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmwareengine.CreateVmwareEngineNetworkRequest(), + {}, + ], +) async def test_create_vmware_engine_network_async( - transport: str = "grpc_asyncio", - request_type=vmwareengine.CreateVmwareEngineNetworkRequest, + request_type, transport: str = "grpc_asyncio" ): client = VmwareEngineAsyncClient( credentials=async_anonymous_credentials(), @@ -25489,7 +25619,7 @@ async def test_create_vmware_engine_network_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( @@ -25511,11 +25641,6 @@ async def test_create_vmware_engine_network_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_vmware_engine_network_async_from_dict(): - await test_create_vmware_engine_network_async(request_type=dict) - - def test_create_vmware_engine_network_field_headers(): client = VmwareEngineClient( credentials=ga_credentials.AnonymousCredentials(), @@ -25698,8 +25823,8 @@ async def test_create_vmware_engine_network_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmwareengine.UpdateVmwareEngineNetworkRequest, - dict, + vmwareengine.UpdateVmwareEngineNetworkRequest(), + {}, ], ) def test_update_vmware_engine_network(request_type, transport: str = "grpc"): @@ -25710,7 +25835,7 @@ def test_update_vmware_engine_network(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -25755,9 +25880,10 @@ def test_update_vmware_engine_network_non_empty_request_with_auto_populated_fiel client.update_vmware_engine_network(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmwareengine.UpdateVmwareEngineNetworkRequest( + request_msg = vmwareengine.UpdateVmwareEngineNetworkRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_vmware_engine_network_use_cached_wrapped_rpc(): @@ -25853,9 +25979,15 @@ async def test_update_vmware_engine_network_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmwareengine.UpdateVmwareEngineNetworkRequest(), + {}, + ], +) async def test_update_vmware_engine_network_async( - transport: str = "grpc_asyncio", - request_type=vmwareengine.UpdateVmwareEngineNetworkRequest, + request_type, transport: str = "grpc_asyncio" ): client = VmwareEngineAsyncClient( credentials=async_anonymous_credentials(), @@ -25864,7 +25996,7 @@ async def test_update_vmware_engine_network_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( @@ -25886,11 +26018,6 @@ async def test_update_vmware_engine_network_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_vmware_engine_network_async_from_dict(): - await test_update_vmware_engine_network_async(request_type=dict) - - def test_update_vmware_engine_network_field_headers(): client = VmwareEngineClient( credentials=ga_credentials.AnonymousCredentials(), @@ -26063,8 +26190,8 @@ async def test_update_vmware_engine_network_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmwareengine.DeleteVmwareEngineNetworkRequest, - dict, + vmwareengine.DeleteVmwareEngineNetworkRequest(), + {}, ], ) def test_delete_vmware_engine_network(request_type, transport: str = "grpc"): @@ -26075,7 +26202,7 @@ def test_delete_vmware_engine_network(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -26122,11 +26249,12 @@ def test_delete_vmware_engine_network_non_empty_request_with_auto_populated_fiel client.delete_vmware_engine_network(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmwareengine.DeleteVmwareEngineNetworkRequest( + request_msg = vmwareengine.DeleteVmwareEngineNetworkRequest( name="name_value", request_id="request_id_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_vmware_engine_network_use_cached_wrapped_rpc(): @@ -26222,9 +26350,15 @@ async def test_delete_vmware_engine_network_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmwareengine.DeleteVmwareEngineNetworkRequest(), + {}, + ], +) async def test_delete_vmware_engine_network_async( - transport: str = "grpc_asyncio", - request_type=vmwareengine.DeleteVmwareEngineNetworkRequest, + request_type, transport: str = "grpc_asyncio" ): client = VmwareEngineAsyncClient( credentials=async_anonymous_credentials(), @@ -26233,7 +26367,7 @@ async def test_delete_vmware_engine_network_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( @@ -26255,11 +26389,6 @@ async def test_delete_vmware_engine_network_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_vmware_engine_network_async_from_dict(): - await test_delete_vmware_engine_network_async(request_type=dict) - - def test_delete_vmware_engine_network_field_headers(): client = VmwareEngineClient( credentials=ga_credentials.AnonymousCredentials(), @@ -26414,8 +26543,8 @@ async def test_delete_vmware_engine_network_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmwareengine.GetVmwareEngineNetworkRequest, - dict, + vmwareengine.GetVmwareEngineNetworkRequest(), + {}, ], ) def test_get_vmware_engine_network(request_type, transport: str = "grpc"): @@ -26426,7 +26555,7 @@ def test_get_vmware_engine_network(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -26484,9 +26613,10 @@ def test_get_vmware_engine_network_non_empty_request_with_auto_populated_field() client.get_vmware_engine_network(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmwareengine.GetVmwareEngineNetworkRequest( + request_msg = vmwareengine.GetVmwareEngineNetworkRequest( name="name_value", ) + assert args[0] == request_msg def test_get_vmware_engine_network_use_cached_wrapped_rpc(): @@ -26572,9 +26702,15 @@ async def test_get_vmware_engine_network_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmwareengine.GetVmwareEngineNetworkRequest(), + {}, + ], +) async def test_get_vmware_engine_network_async( - transport: str = "grpc_asyncio", - request_type=vmwareengine.GetVmwareEngineNetworkRequest, + request_type, transport: str = "grpc_asyncio" ): client = VmwareEngineAsyncClient( credentials=async_anonymous_credentials(), @@ -26583,7 +26719,7 @@ async def test_get_vmware_engine_network_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( @@ -26618,11 +26754,6 @@ async def test_get_vmware_engine_network_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_vmware_engine_network_async_from_dict(): - await test_get_vmware_engine_network_async(request_type=dict) - - def test_get_vmware_engine_network_field_headers(): client = VmwareEngineClient( credentials=ga_credentials.AnonymousCredentials(), @@ -26777,8 +26908,8 @@ async def test_get_vmware_engine_network_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmwareengine.ListVmwareEngineNetworksRequest, - dict, + vmwareengine.ListVmwareEngineNetworksRequest(), + {}, ], ) def test_list_vmware_engine_networks(request_type, transport: str = "grpc"): @@ -26789,7 +26920,7 @@ def test_list_vmware_engine_networks(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -26842,12 +26973,13 @@ def test_list_vmware_engine_networks_non_empty_request_with_auto_populated_field client.list_vmware_engine_networks(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmwareengine.ListVmwareEngineNetworksRequest( + request_msg = vmwareengine.ListVmwareEngineNetworksRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_vmware_engine_networks_use_cached_wrapped_rpc(): @@ -26933,9 +27065,15 @@ async def test_list_vmware_engine_networks_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmwareengine.ListVmwareEngineNetworksRequest(), + {}, + ], +) async def test_list_vmware_engine_networks_async( - transport: str = "grpc_asyncio", - request_type=vmwareengine.ListVmwareEngineNetworksRequest, + request_type, transport: str = "grpc_asyncio" ): client = VmwareEngineAsyncClient( credentials=async_anonymous_credentials(), @@ -26944,7 +27082,7 @@ async def test_list_vmware_engine_networks_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( @@ -26971,11 +27109,6 @@ async def test_list_vmware_engine_networks_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_vmware_engine_networks_async_from_dict(): - await test_list_vmware_engine_networks_async(request_type=dict) - - def test_list_vmware_engine_networks_field_headers(): client = VmwareEngineClient( credentials=ga_credentials.AnonymousCredentials(), @@ -27334,8 +27467,8 @@ async def test_list_vmware_engine_networks_async_pages(): @pytest.mark.parametrize( "request_type", [ - vmwareengine.CreatePrivateConnectionRequest, - dict, + vmwareengine.CreatePrivateConnectionRequest(), + {}, ], ) def test_create_private_connection(request_type, transport: str = "grpc"): @@ -27346,7 +27479,7 @@ def test_create_private_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( @@ -27393,11 +27526,12 @@ def test_create_private_connection_non_empty_request_with_auto_populated_field() client.create_private_connection(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmwareengine.CreatePrivateConnectionRequest( + request_msg = vmwareengine.CreatePrivateConnectionRequest( parent="parent_value", private_connection_id="private_connection_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_private_connection_use_cached_wrapped_rpc(): @@ -27493,9 +27627,15 @@ async def test_create_private_connection_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmwareengine.CreatePrivateConnectionRequest(), + {}, + ], +) async def test_create_private_connection_async( - transport: str = "grpc_asyncio", - request_type=vmwareengine.CreatePrivateConnectionRequest, + request_type, transport: str = "grpc_asyncio" ): client = VmwareEngineAsyncClient( credentials=async_anonymous_credentials(), @@ -27504,7 +27644,7 @@ async def test_create_private_connection_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( @@ -27526,11 +27666,6 @@ async def test_create_private_connection_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_private_connection_async_from_dict(): - await test_create_private_connection_async(request_type=dict) - - def test_create_private_connection_field_headers(): client = VmwareEngineClient( credentials=ga_credentials.AnonymousCredentials(), @@ -27713,8 +27848,8 @@ async def test_create_private_connection_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmwareengine.GetPrivateConnectionRequest, - dict, + vmwareengine.GetPrivateConnectionRequest(), + {}, ], ) def test_get_private_connection(request_type, transport: str = "grpc"): @@ -27725,7 +27860,7 @@ def test_get_private_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( @@ -27805,9 +27940,10 @@ def test_get_private_connection_non_empty_request_with_auto_populated_field(): client.get_private_connection(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmwareengine.GetPrivateConnectionRequest( + request_msg = vmwareengine.GetPrivateConnectionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_private_connection_use_cached_wrapped_rpc(): @@ -27893,9 +28029,15 @@ async def test_get_private_connection_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmwareengine.GetPrivateConnectionRequest(), + {}, + ], +) async def test_get_private_connection_async( - transport: str = "grpc_asyncio", - request_type=vmwareengine.GetPrivateConnectionRequest, + request_type, transport: str = "grpc_asyncio" ): client = VmwareEngineAsyncClient( credentials=async_anonymous_credentials(), @@ -27904,7 +28046,7 @@ async def test_get_private_connection_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( @@ -27961,11 +28103,6 @@ async def test_get_private_connection_async( ) -@pytest.mark.asyncio -async def test_get_private_connection_async_from_dict(): - await test_get_private_connection_async(request_type=dict) - - def test_get_private_connection_field_headers(): client = VmwareEngineClient( credentials=ga_credentials.AnonymousCredentials(), @@ -28120,8 +28257,8 @@ async def test_get_private_connection_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmwareengine.ListPrivateConnectionsRequest, - dict, + vmwareengine.ListPrivateConnectionsRequest(), + {}, ], ) def test_list_private_connections(request_type, transport: str = "grpc"): @@ -28132,7 +28269,7 @@ def test_list_private_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( @@ -28185,12 +28322,13 @@ def test_list_private_connections_non_empty_request_with_auto_populated_field(): client.list_private_connections(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmwareengine.ListPrivateConnectionsRequest( + request_msg = vmwareengine.ListPrivateConnectionsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_private_connections_use_cached_wrapped_rpc(): @@ -28276,9 +28414,15 @@ async def test_list_private_connections_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmwareengine.ListPrivateConnectionsRequest(), + {}, + ], +) async def test_list_private_connections_async( - transport: str = "grpc_asyncio", - request_type=vmwareengine.ListPrivateConnectionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = VmwareEngineAsyncClient( credentials=async_anonymous_credentials(), @@ -28287,7 +28431,7 @@ async def test_list_private_connections_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( @@ -28314,11 +28458,6 @@ async def test_list_private_connections_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_private_connections_async_from_dict(): - await test_list_private_connections_async(request_type=dict) - - def test_list_private_connections_field_headers(): client = VmwareEngineClient( credentials=ga_credentials.AnonymousCredentials(), @@ -28677,8 +28816,8 @@ async def test_list_private_connections_async_pages(): @pytest.mark.parametrize( "request_type", [ - vmwareengine.UpdatePrivateConnectionRequest, - dict, + vmwareengine.UpdatePrivateConnectionRequest(), + {}, ], ) def test_update_private_connection(request_type, transport: str = "grpc"): @@ -28689,7 +28828,7 @@ def test_update_private_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( @@ -28734,9 +28873,10 @@ def test_update_private_connection_non_empty_request_with_auto_populated_field() client.update_private_connection(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmwareengine.UpdatePrivateConnectionRequest( + request_msg = vmwareengine.UpdatePrivateConnectionRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_private_connection_use_cached_wrapped_rpc(): @@ -28832,9 +28972,15 @@ async def test_update_private_connection_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmwareengine.UpdatePrivateConnectionRequest(), + {}, + ], +) async def test_update_private_connection_async( - transport: str = "grpc_asyncio", - request_type=vmwareengine.UpdatePrivateConnectionRequest, + request_type, transport: str = "grpc_asyncio" ): client = VmwareEngineAsyncClient( credentials=async_anonymous_credentials(), @@ -28843,7 +28989,7 @@ async def test_update_private_connection_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( @@ -28865,11 +29011,6 @@ async def test_update_private_connection_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_private_connection_async_from_dict(): - await test_update_private_connection_async(request_type=dict) - - def test_update_private_connection_field_headers(): client = VmwareEngineClient( credentials=ga_credentials.AnonymousCredentials(), @@ -29042,8 +29183,8 @@ async def test_update_private_connection_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmwareengine.DeletePrivateConnectionRequest, - dict, + vmwareengine.DeletePrivateConnectionRequest(), + {}, ], ) def test_delete_private_connection(request_type, transport: str = "grpc"): @@ -29054,7 +29195,7 @@ def test_delete_private_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( @@ -29100,10 +29241,11 @@ def test_delete_private_connection_non_empty_request_with_auto_populated_field() client.delete_private_connection(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmwareengine.DeletePrivateConnectionRequest( + request_msg = vmwareengine.DeletePrivateConnectionRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_private_connection_use_cached_wrapped_rpc(): @@ -29199,9 +29341,15 @@ async def test_delete_private_connection_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmwareengine.DeletePrivateConnectionRequest(), + {}, + ], +) async def test_delete_private_connection_async( - transport: str = "grpc_asyncio", - request_type=vmwareengine.DeletePrivateConnectionRequest, + request_type, transport: str = "grpc_asyncio" ): client = VmwareEngineAsyncClient( credentials=async_anonymous_credentials(), @@ -29210,7 +29358,7 @@ async def test_delete_private_connection_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( @@ -29232,11 +29380,6 @@ async def test_delete_private_connection_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_private_connection_async_from_dict(): - await test_delete_private_connection_async(request_type=dict) - - def test_delete_private_connection_field_headers(): client = VmwareEngineClient( credentials=ga_credentials.AnonymousCredentials(), @@ -29391,8 +29534,8 @@ async def test_delete_private_connection_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmwareengine.ListPrivateConnectionPeeringRoutesRequest, - dict, + vmwareengine.ListPrivateConnectionPeeringRoutesRequest(), + {}, ], ) def test_list_private_connection_peering_routes(request_type, transport: str = "grpc"): @@ -29403,7 +29546,7 @@ def test_list_private_connection_peering_routes(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( @@ -29452,10 +29595,11 @@ def test_list_private_connection_peering_routes_non_empty_request_with_auto_popu client.list_private_connection_peering_routes(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmwareengine.ListPrivateConnectionPeeringRoutesRequest( + request_msg = vmwareengine.ListPrivateConnectionPeeringRoutesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_private_connection_peering_routes_use_cached_wrapped_rpc(): @@ -29541,9 +29685,15 @@ async def test_list_private_connection_peering_routes_async_use_cached_wrapped_r @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmwareengine.ListPrivateConnectionPeeringRoutesRequest(), + {}, + ], +) async def test_list_private_connection_peering_routes_async( - transport: str = "grpc_asyncio", - request_type=vmwareengine.ListPrivateConnectionPeeringRoutesRequest, + request_type, transport: str = "grpc_asyncio" ): client = VmwareEngineAsyncClient( credentials=async_anonymous_credentials(), @@ -29552,7 +29702,7 @@ async def test_list_private_connection_peering_routes_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( @@ -29577,11 +29727,6 @@ async def test_list_private_connection_peering_routes_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_private_connection_peering_routes_async_from_dict(): - await test_list_private_connection_peering_routes_async(request_type=dict) - - def test_list_private_connection_peering_routes_field_headers(): client = VmwareEngineClient( credentials=ga_credentials.AnonymousCredentials(), @@ -29940,8 +30085,8 @@ async def test_list_private_connection_peering_routes_async_pages(): @pytest.mark.parametrize( "request_type", [ - vmwareengine.GrantDnsBindPermissionRequest, - dict, + vmwareengine.GrantDnsBindPermissionRequest(), + {}, ], ) def test_grant_dns_bind_permission(request_type, transport: str = "grpc"): @@ -29952,7 +30097,7 @@ def test_grant_dns_bind_permission(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -29998,10 +30143,11 @@ def test_grant_dns_bind_permission_non_empty_request_with_auto_populated_field() client.grant_dns_bind_permission(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmwareengine.GrantDnsBindPermissionRequest( + request_msg = vmwareengine.GrantDnsBindPermissionRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_grant_dns_bind_permission_use_cached_wrapped_rpc(): @@ -30097,9 +30243,15 @@ async def test_grant_dns_bind_permission_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmwareengine.GrantDnsBindPermissionRequest(), + {}, + ], +) async def test_grant_dns_bind_permission_async( - transport: str = "grpc_asyncio", - request_type=vmwareengine.GrantDnsBindPermissionRequest, + request_type, transport: str = "grpc_asyncio" ): client = VmwareEngineAsyncClient( credentials=async_anonymous_credentials(), @@ -30108,7 +30260,7 @@ async def test_grant_dns_bind_permission_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( @@ -30130,11 +30282,6 @@ async def test_grant_dns_bind_permission_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_grant_dns_bind_permission_async_from_dict(): - await test_grant_dns_bind_permission_async(request_type=dict) - - def test_grant_dns_bind_permission_field_headers(): client = VmwareEngineClient( credentials=ga_credentials.AnonymousCredentials(), @@ -30299,8 +30446,8 @@ async def test_grant_dns_bind_permission_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmwareengine.GetDnsBindPermissionRequest, - dict, + vmwareengine.GetDnsBindPermissionRequest(), + {}, ], ) def test_get_dns_bind_permission(request_type, transport: str = "grpc"): @@ -30311,7 +30458,7 @@ def test_get_dns_bind_permission(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -30359,9 +30506,10 @@ def test_get_dns_bind_permission_non_empty_request_with_auto_populated_field(): client.get_dns_bind_permission(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmwareengine.GetDnsBindPermissionRequest( + request_msg = vmwareengine.GetDnsBindPermissionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_dns_bind_permission_use_cached_wrapped_rpc(): @@ -30447,9 +30595,15 @@ async def test_get_dns_bind_permission_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmwareengine.GetDnsBindPermissionRequest(), + {}, + ], +) async def test_get_dns_bind_permission_async( - transport: str = "grpc_asyncio", - request_type=vmwareengine.GetDnsBindPermissionRequest, + request_type, transport: str = "grpc_asyncio" ): client = VmwareEngineAsyncClient( credentials=async_anonymous_credentials(), @@ -30458,7 +30612,7 @@ async def test_get_dns_bind_permission_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( @@ -30483,11 +30637,6 @@ async def test_get_dns_bind_permission_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_dns_bind_permission_async_from_dict(): - await test_get_dns_bind_permission_async(request_type=dict) - - def test_get_dns_bind_permission_field_headers(): client = VmwareEngineClient( credentials=ga_credentials.AnonymousCredentials(), @@ -30642,8 +30791,8 @@ async def test_get_dns_bind_permission_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vmwareengine.RevokeDnsBindPermissionRequest, - dict, + vmwareengine.RevokeDnsBindPermissionRequest(), + {}, ], ) def test_revoke_dns_bind_permission(request_type, transport: str = "grpc"): @@ -30654,7 +30803,7 @@ def test_revoke_dns_bind_permission(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -30700,10 +30849,11 @@ def test_revoke_dns_bind_permission_non_empty_request_with_auto_populated_field( client.revoke_dns_bind_permission(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vmwareengine.RevokeDnsBindPermissionRequest( + request_msg = vmwareengine.RevokeDnsBindPermissionRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_revoke_dns_bind_permission_use_cached_wrapped_rpc(): @@ -30799,9 +30949,15 @@ async def test_revoke_dns_bind_permission_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vmwareengine.RevokeDnsBindPermissionRequest(), + {}, + ], +) async def test_revoke_dns_bind_permission_async( - transport: str = "grpc_asyncio", - request_type=vmwareengine.RevokeDnsBindPermissionRequest, + request_type, transport: str = "grpc_asyncio" ): client = VmwareEngineAsyncClient( credentials=async_anonymous_credentials(), @@ -30810,7 +30966,7 @@ async def test_revoke_dns_bind_permission_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( @@ -30832,11 +30988,6 @@ async def test_revoke_dns_bind_permission_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_revoke_dns_bind_permission_async_from_dict(): - await test_revoke_dns_bind_permission_async(request_type=dict) - - def test_revoke_dns_bind_permission_field_headers(): client = VmwareEngineClient( credentials=ga_credentials.AnonymousCredentials(), @@ -46931,7 +47082,6 @@ def test_list_private_clouds_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.ListPrivateCloudsRequest() - assert args[0] == request_msg @@ -46954,7 +47104,6 @@ def test_get_private_cloud_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.GetPrivateCloudRequest() - assert args[0] == request_msg @@ -46977,7 +47126,6 @@ def test_create_private_cloud_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.CreatePrivateCloudRequest() - assert args[0] == request_msg @@ -47000,7 +47148,6 @@ def test_update_private_cloud_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.UpdatePrivateCloudRequest() - assert args[0] == request_msg @@ -47023,7 +47170,6 @@ def test_delete_private_cloud_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.DeletePrivateCloudRequest() - assert args[0] == request_msg @@ -47046,7 +47192,6 @@ def test_undelete_private_cloud_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.UndeletePrivateCloudRequest() - assert args[0] == request_msg @@ -47067,7 +47212,6 @@ def test_list_clusters_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.ListClustersRequest() - assert args[0] == request_msg @@ -47088,7 +47232,6 @@ def test_get_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.GetClusterRequest() - assert args[0] == request_msg @@ -47109,7 +47252,6 @@ def test_create_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.CreateClusterRequest() - assert args[0] == request_msg @@ -47130,7 +47272,6 @@ def test_update_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.UpdateClusterRequest() - assert args[0] == request_msg @@ -47151,7 +47292,6 @@ def test_delete_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.DeleteClusterRequest() - assert args[0] == request_msg @@ -47172,7 +47312,6 @@ def test_list_nodes_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.ListNodesRequest() - assert args[0] == request_msg @@ -47193,7 +47332,6 @@ def test_get_node_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.GetNodeRequest() - assert args[0] == request_msg @@ -47216,7 +47354,6 @@ def test_list_external_addresses_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.ListExternalAddressesRequest() - assert args[0] == request_msg @@ -47239,7 +47376,6 @@ def test_fetch_network_policy_external_addresses_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.FetchNetworkPolicyExternalAddressesRequest() - assert args[0] == request_msg @@ -47262,7 +47398,6 @@ def test_get_external_address_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.GetExternalAddressRequest() - assert args[0] == request_msg @@ -47285,7 +47420,6 @@ def test_create_external_address_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.CreateExternalAddressRequest() - assert args[0] == request_msg @@ -47308,7 +47442,6 @@ def test_update_external_address_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.UpdateExternalAddressRequest() - assert args[0] == request_msg @@ -47331,7 +47464,6 @@ def test_delete_external_address_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.DeleteExternalAddressRequest() - assert args[0] == request_msg @@ -47352,7 +47484,6 @@ def test_list_subnets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.ListSubnetsRequest() - assert args[0] == request_msg @@ -47373,7 +47504,6 @@ def test_get_subnet_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.GetSubnetRequest() - assert args[0] == request_msg @@ -47394,7 +47524,6 @@ def test_update_subnet_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.UpdateSubnetRequest() - assert args[0] == request_msg @@ -47417,7 +47546,6 @@ def test_list_external_access_rules_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.ListExternalAccessRulesRequest() - assert args[0] == request_msg @@ -47440,7 +47568,6 @@ def test_get_external_access_rule_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.GetExternalAccessRuleRequest() - assert args[0] == request_msg @@ -47463,7 +47590,6 @@ def test_create_external_access_rule_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.CreateExternalAccessRuleRequest() - assert args[0] == request_msg @@ -47486,7 +47612,6 @@ def test_update_external_access_rule_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.UpdateExternalAccessRuleRequest() - assert args[0] == request_msg @@ -47509,7 +47634,6 @@ def test_delete_external_access_rule_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.DeleteExternalAccessRuleRequest() - assert args[0] == request_msg @@ -47532,7 +47656,6 @@ def test_list_logging_servers_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.ListLoggingServersRequest() - assert args[0] == request_msg @@ -47555,7 +47678,6 @@ def test_get_logging_server_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.GetLoggingServerRequest() - assert args[0] == request_msg @@ -47578,7 +47700,6 @@ def test_create_logging_server_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.CreateLoggingServerRequest() - assert args[0] == request_msg @@ -47601,7 +47722,6 @@ def test_update_logging_server_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.UpdateLoggingServerRequest() - assert args[0] == request_msg @@ -47624,7 +47744,6 @@ def test_delete_logging_server_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.DeleteLoggingServerRequest() - assert args[0] == request_msg @@ -47645,7 +47764,6 @@ def test_list_node_types_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.ListNodeTypesRequest() - assert args[0] == request_msg @@ -47666,7 +47784,6 @@ def test_get_node_type_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.GetNodeTypeRequest() - assert args[0] == request_msg @@ -47689,7 +47806,6 @@ def test_show_nsx_credentials_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.ShowNsxCredentialsRequest() - assert args[0] == request_msg @@ -47712,7 +47828,6 @@ def test_show_vcenter_credentials_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.ShowVcenterCredentialsRequest() - assert args[0] == request_msg @@ -47735,7 +47850,6 @@ def test_reset_nsx_credentials_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.ResetNsxCredentialsRequest() - assert args[0] == request_msg @@ -47758,7 +47872,6 @@ def test_reset_vcenter_credentials_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.ResetVcenterCredentialsRequest() - assert args[0] == request_msg @@ -47781,7 +47894,6 @@ def test_get_dns_forwarding_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.GetDnsForwardingRequest() - assert args[0] == request_msg @@ -47804,7 +47916,6 @@ def test_update_dns_forwarding_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.UpdateDnsForwardingRequest() - assert args[0] == request_msg @@ -47827,7 +47938,6 @@ def test_get_network_peering_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.GetNetworkPeeringRequest() - assert args[0] == request_msg @@ -47850,7 +47960,6 @@ def test_list_network_peerings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.ListNetworkPeeringsRequest() - assert args[0] == request_msg @@ -47873,7 +47982,6 @@ def test_create_network_peering_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.CreateNetworkPeeringRequest() - assert args[0] == request_msg @@ -47896,7 +48004,6 @@ def test_delete_network_peering_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.DeleteNetworkPeeringRequest() - assert args[0] == request_msg @@ -47919,7 +48026,6 @@ def test_update_network_peering_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.UpdateNetworkPeeringRequest() - assert args[0] == request_msg @@ -47942,7 +48048,6 @@ def test_list_peering_routes_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.ListPeeringRoutesRequest() - assert args[0] == request_msg @@ -47965,7 +48070,6 @@ def test_create_hcx_activation_key_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.CreateHcxActivationKeyRequest() - assert args[0] == request_msg @@ -47988,7 +48092,6 @@ def test_list_hcx_activation_keys_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.ListHcxActivationKeysRequest() - assert args[0] == request_msg @@ -48011,7 +48114,6 @@ def test_get_hcx_activation_key_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.GetHcxActivationKeyRequest() - assert args[0] == request_msg @@ -48034,7 +48136,6 @@ def test_get_network_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.GetNetworkPolicyRequest() - assert args[0] == request_msg @@ -48057,7 +48158,6 @@ def test_list_network_policies_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.ListNetworkPoliciesRequest() - assert args[0] == request_msg @@ -48080,7 +48180,6 @@ def test_create_network_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.CreateNetworkPolicyRequest() - assert args[0] == request_msg @@ -48103,7 +48202,6 @@ def test_update_network_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.UpdateNetworkPolicyRequest() - assert args[0] == request_msg @@ -48126,7 +48224,6 @@ def test_delete_network_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.DeleteNetworkPolicyRequest() - assert args[0] == request_msg @@ -48149,7 +48246,6 @@ def test_list_management_dns_zone_bindings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.ListManagementDnsZoneBindingsRequest() - assert args[0] == request_msg @@ -48172,7 +48268,6 @@ def test_get_management_dns_zone_binding_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.GetManagementDnsZoneBindingRequest() - assert args[0] == request_msg @@ -48195,7 +48290,6 @@ def test_create_management_dns_zone_binding_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.CreateManagementDnsZoneBindingRequest() - assert args[0] == request_msg @@ -48218,7 +48312,6 @@ def test_update_management_dns_zone_binding_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.UpdateManagementDnsZoneBindingRequest() - assert args[0] == request_msg @@ -48241,7 +48334,6 @@ def test_delete_management_dns_zone_binding_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.DeleteManagementDnsZoneBindingRequest() - assert args[0] == request_msg @@ -48264,7 +48356,6 @@ def test_repair_management_dns_zone_binding_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.RepairManagementDnsZoneBindingRequest() - assert args[0] == request_msg @@ -48287,7 +48378,6 @@ def test_create_vmware_engine_network_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.CreateVmwareEngineNetworkRequest() - assert args[0] == request_msg @@ -48310,7 +48400,6 @@ def test_update_vmware_engine_network_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.UpdateVmwareEngineNetworkRequest() - assert args[0] == request_msg @@ -48333,7 +48422,6 @@ def test_delete_vmware_engine_network_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.DeleteVmwareEngineNetworkRequest() - assert args[0] == request_msg @@ -48356,7 +48444,6 @@ def test_get_vmware_engine_network_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.GetVmwareEngineNetworkRequest() - assert args[0] == request_msg @@ -48379,7 +48466,6 @@ def test_list_vmware_engine_networks_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.ListVmwareEngineNetworksRequest() - assert args[0] == request_msg @@ -48402,7 +48488,6 @@ def test_create_private_connection_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.CreatePrivateConnectionRequest() - assert args[0] == request_msg @@ -48425,7 +48510,6 @@ def test_get_private_connection_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.GetPrivateConnectionRequest() - assert args[0] == request_msg @@ -48448,7 +48532,6 @@ def test_list_private_connections_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.ListPrivateConnectionsRequest() - assert args[0] == request_msg @@ -48471,7 +48554,6 @@ def test_update_private_connection_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.UpdatePrivateConnectionRequest() - assert args[0] == request_msg @@ -48494,7 +48576,6 @@ def test_delete_private_connection_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.DeletePrivateConnectionRequest() - assert args[0] == request_msg @@ -48517,7 +48598,6 @@ def test_list_private_connection_peering_routes_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.ListPrivateConnectionPeeringRoutesRequest() - assert args[0] == request_msg @@ -48540,7 +48620,6 @@ def test_grant_dns_bind_permission_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.GrantDnsBindPermissionRequest() - assert args[0] == request_msg @@ -48563,7 +48642,6 @@ def test_get_dns_bind_permission_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.GetDnsBindPermissionRequest() - assert args[0] == request_msg @@ -48586,7 +48664,6 @@ def test_revoke_dns_bind_permission_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.RevokeDnsBindPermissionRequest() - assert args[0] == request_msg @@ -48630,7 +48707,6 @@ async def test_list_private_clouds_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.ListPrivateCloudsRequest() - assert args[0] == request_msg @@ -48663,7 +48739,6 @@ async def test_get_private_cloud_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.GetPrivateCloudRequest() - assert args[0] == request_msg @@ -48690,7 +48765,6 @@ async def test_create_private_cloud_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.CreatePrivateCloudRequest() - assert args[0] == request_msg @@ -48717,7 +48791,6 @@ async def test_update_private_cloud_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.UpdatePrivateCloudRequest() - assert args[0] == request_msg @@ -48744,7 +48817,6 @@ async def test_delete_private_cloud_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.DeletePrivateCloudRequest() - assert args[0] == request_msg @@ -48771,7 +48843,6 @@ async def test_undelete_private_cloud_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.UndeletePrivateCloudRequest() - assert args[0] == request_msg @@ -48799,7 +48870,6 @@ async def test_list_clusters_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.ListClustersRequest() - assert args[0] == request_msg @@ -48829,7 +48899,6 @@ async def test_get_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.GetClusterRequest() - assert args[0] == request_msg @@ -48854,7 +48923,6 @@ async def test_create_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.CreateClusterRequest() - assert args[0] == request_msg @@ -48879,7 +48947,6 @@ async def test_update_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.UpdateClusterRequest() - assert args[0] == request_msg @@ -48904,7 +48971,6 @@ async def test_delete_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.DeleteClusterRequest() - assert args[0] == request_msg @@ -48931,7 +48997,6 @@ async def test_list_nodes_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.ListNodesRequest() - assert args[0] == request_msg @@ -48964,7 +49029,6 @@ async def test_get_node_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.GetNodeRequest() - assert args[0] == request_msg @@ -48994,7 +49058,6 @@ async def test_list_external_addresses_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.ListExternalAddressesRequest() - assert args[0] == request_msg @@ -49023,7 +49086,6 @@ async def test_fetch_network_policy_external_addresses_empty_call_grpc_asyncio() call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.FetchNetworkPolicyExternalAddressesRequest() - assert args[0] == request_msg @@ -49057,7 +49119,6 @@ async def test_get_external_address_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.GetExternalAddressRequest() - assert args[0] == request_msg @@ -49084,7 +49145,6 @@ async def test_create_external_address_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.CreateExternalAddressRequest() - assert args[0] == request_msg @@ -49111,7 +49171,6 @@ async def test_update_external_address_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.UpdateExternalAddressRequest() - assert args[0] == request_msg @@ -49138,7 +49197,6 @@ async def test_delete_external_address_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.DeleteExternalAddressRequest() - assert args[0] == request_msg @@ -49166,7 +49224,6 @@ async def test_list_subnets_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.ListSubnetsRequest() - assert args[0] == request_msg @@ -49198,7 +49255,6 @@ async def test_get_subnet_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.GetSubnetRequest() - assert args[0] == request_msg @@ -49223,7 +49279,6 @@ async def test_update_subnet_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.UpdateSubnetRequest() - assert args[0] == request_msg @@ -49253,7 +49308,6 @@ async def test_list_external_access_rules_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.ListExternalAccessRulesRequest() - assert args[0] == request_msg @@ -49290,7 +49344,6 @@ async def test_get_external_access_rule_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.GetExternalAccessRuleRequest() - assert args[0] == request_msg @@ -49317,7 +49370,6 @@ async def test_create_external_access_rule_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.CreateExternalAccessRuleRequest() - assert args[0] == request_msg @@ -49344,7 +49396,6 @@ async def test_update_external_access_rule_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.UpdateExternalAccessRuleRequest() - assert args[0] == request_msg @@ -49371,7 +49422,6 @@ async def test_delete_external_access_rule_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.DeleteExternalAccessRuleRequest() - assert args[0] == request_msg @@ -49401,7 +49451,6 @@ async def test_list_logging_servers_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.ListLoggingServersRequest() - assert args[0] == request_msg @@ -49435,7 +49484,6 @@ async def test_get_logging_server_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.GetLoggingServerRequest() - assert args[0] == request_msg @@ -49462,7 +49510,6 @@ async def test_create_logging_server_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.CreateLoggingServerRequest() - assert args[0] == request_msg @@ -49489,7 +49536,6 @@ async def test_update_logging_server_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.UpdateLoggingServerRequest() - assert args[0] == request_msg @@ -49516,7 +49562,6 @@ async def test_delete_logging_server_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.DeleteLoggingServerRequest() - assert args[0] == request_msg @@ -49544,7 +49589,6 @@ async def test_list_node_types_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.ListNodeTypesRequest() - assert args[0] == request_msg @@ -49583,7 +49627,6 @@ async def test_get_node_type_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.GetNodeTypeRequest() - assert args[0] == request_msg @@ -49613,7 +49656,6 @@ async def test_show_nsx_credentials_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.ShowNsxCredentialsRequest() - assert args[0] == request_msg @@ -49643,7 +49685,6 @@ async def test_show_vcenter_credentials_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.ShowVcenterCredentialsRequest() - assert args[0] == request_msg @@ -49670,7 +49711,6 @@ async def test_reset_nsx_credentials_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.ResetNsxCredentialsRequest() - assert args[0] == request_msg @@ -49697,7 +49737,6 @@ async def test_reset_vcenter_credentials_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.ResetVcenterCredentialsRequest() - assert args[0] == request_msg @@ -49726,7 +49765,6 @@ async def test_get_dns_forwarding_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.GetDnsForwardingRequest() - assert args[0] == request_msg @@ -49753,7 +49791,6 @@ async def test_update_dns_forwarding_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.UpdateDnsForwardingRequest() - assert args[0] == request_msg @@ -49795,7 +49832,6 @@ async def test_get_network_peering_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.GetNetworkPeeringRequest() - assert args[0] == request_msg @@ -49825,7 +49861,6 @@ async def test_list_network_peerings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.ListNetworkPeeringsRequest() - assert args[0] == request_msg @@ -49852,7 +49887,6 @@ async def test_create_network_peering_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.CreateNetworkPeeringRequest() - assert args[0] == request_msg @@ -49879,7 +49913,6 @@ async def test_delete_network_peering_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.DeleteNetworkPeeringRequest() - assert args[0] == request_msg @@ -49906,7 +49939,6 @@ async def test_update_network_peering_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.UpdateNetworkPeeringRequest() - assert args[0] == request_msg @@ -49935,7 +49967,6 @@ async def test_list_peering_routes_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.ListPeeringRoutesRequest() - assert args[0] == request_msg @@ -49962,7 +49993,6 @@ async def test_create_hcx_activation_key_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.CreateHcxActivationKeyRequest() - assert args[0] == request_msg @@ -49992,7 +50022,6 @@ async def test_list_hcx_activation_keys_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.ListHcxActivationKeysRequest() - assert args[0] == request_msg @@ -50024,7 +50053,6 @@ async def test_get_hcx_activation_key_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.GetHcxActivationKeyRequest() - assert args[0] == request_msg @@ -50058,7 +50086,6 @@ async def test_get_network_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.GetNetworkPolicyRequest() - assert args[0] == request_msg @@ -50088,7 +50115,6 @@ async def test_list_network_policies_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.ListNetworkPoliciesRequest() - assert args[0] == request_msg @@ -50115,7 +50141,6 @@ async def test_create_network_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.CreateNetworkPolicyRequest() - assert args[0] == request_msg @@ -50142,7 +50167,6 @@ async def test_update_network_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.UpdateNetworkPolicyRequest() - assert args[0] == request_msg @@ -50169,7 +50193,6 @@ async def test_delete_network_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.DeleteNetworkPolicyRequest() - assert args[0] == request_msg @@ -50199,7 +50222,6 @@ async def test_list_management_dns_zone_bindings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.ListManagementDnsZoneBindingsRequest() - assert args[0] == request_msg @@ -50231,7 +50253,6 @@ async def test_get_management_dns_zone_binding_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.GetManagementDnsZoneBindingRequest() - assert args[0] == request_msg @@ -50258,7 +50279,6 @@ async def test_create_management_dns_zone_binding_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.CreateManagementDnsZoneBindingRequest() - assert args[0] == request_msg @@ -50285,7 +50305,6 @@ async def test_update_management_dns_zone_binding_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.UpdateManagementDnsZoneBindingRequest() - assert args[0] == request_msg @@ -50312,7 +50331,6 @@ async def test_delete_management_dns_zone_binding_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.DeleteManagementDnsZoneBindingRequest() - assert args[0] == request_msg @@ -50339,7 +50357,6 @@ async def test_repair_management_dns_zone_binding_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.RepairManagementDnsZoneBindingRequest() - assert args[0] == request_msg @@ -50366,7 +50383,6 @@ async def test_create_vmware_engine_network_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.CreateVmwareEngineNetworkRequest() - assert args[0] == request_msg @@ -50393,7 +50409,6 @@ async def test_update_vmware_engine_network_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.UpdateVmwareEngineNetworkRequest() - assert args[0] == request_msg @@ -50420,7 +50435,6 @@ async def test_delete_vmware_engine_network_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.DeleteVmwareEngineNetworkRequest() - assert args[0] == request_msg @@ -50454,7 +50468,6 @@ async def test_get_vmware_engine_network_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.GetVmwareEngineNetworkRequest() - assert args[0] == request_msg @@ -50484,7 +50497,6 @@ async def test_list_vmware_engine_networks_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.ListVmwareEngineNetworksRequest() - assert args[0] == request_msg @@ -50511,7 +50523,6 @@ async def test_create_private_connection_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.CreatePrivateConnectionRequest() - assert args[0] == request_msg @@ -50550,7 +50561,6 @@ async def test_get_private_connection_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.GetPrivateConnectionRequest() - assert args[0] == request_msg @@ -50580,7 +50590,6 @@ async def test_list_private_connections_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.ListPrivateConnectionsRequest() - assert args[0] == request_msg @@ -50607,7 +50616,6 @@ async def test_update_private_connection_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.UpdatePrivateConnectionRequest() - assert args[0] == request_msg @@ -50634,7 +50642,6 @@ async def test_delete_private_connection_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.DeletePrivateConnectionRequest() - assert args[0] == request_msg @@ -50663,7 +50670,6 @@ async def test_list_private_connection_peering_routes_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.ListPrivateConnectionPeeringRoutesRequest() - assert args[0] == request_msg @@ -50690,7 +50696,6 @@ async def test_grant_dns_bind_permission_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.GrantDnsBindPermissionRequest() - assert args[0] == request_msg @@ -50719,7 +50724,6 @@ async def test_get_dns_bind_permission_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.GetDnsBindPermissionRequest() - assert args[0] == request_msg @@ -50746,7 +50750,6 @@ async def test_revoke_dns_bind_permission_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.RevokeDnsBindPermissionRequest() - assert args[0] == request_msg @@ -63363,7 +63366,6 @@ def test_list_private_clouds_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.ListPrivateCloudsRequest() - assert args[0] == request_msg @@ -63385,7 +63387,6 @@ def test_get_private_cloud_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.GetPrivateCloudRequest() - assert args[0] == request_msg @@ -63407,7 +63408,6 @@ def test_create_private_cloud_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.CreatePrivateCloudRequest() - assert args[0] == request_msg @@ -63429,7 +63429,6 @@ def test_update_private_cloud_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.UpdatePrivateCloudRequest() - assert args[0] == request_msg @@ -63451,7 +63450,6 @@ def test_delete_private_cloud_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.DeletePrivateCloudRequest() - assert args[0] == request_msg @@ -63473,7 +63471,6 @@ def test_undelete_private_cloud_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.UndeletePrivateCloudRequest() - assert args[0] == request_msg @@ -63493,7 +63490,6 @@ def test_list_clusters_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.ListClustersRequest() - assert args[0] == request_msg @@ -63513,7 +63509,6 @@ def test_get_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.GetClusterRequest() - assert args[0] == request_msg @@ -63533,7 +63528,6 @@ def test_create_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.CreateClusterRequest() - assert args[0] == request_msg @@ -63553,7 +63547,6 @@ def test_update_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.UpdateClusterRequest() - assert args[0] == request_msg @@ -63573,7 +63566,6 @@ def test_delete_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.DeleteClusterRequest() - assert args[0] == request_msg @@ -63593,7 +63585,6 @@ def test_list_nodes_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.ListNodesRequest() - assert args[0] == request_msg @@ -63613,7 +63604,6 @@ def test_get_node_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.GetNodeRequest() - assert args[0] == request_msg @@ -63635,7 +63625,6 @@ def test_list_external_addresses_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.ListExternalAddressesRequest() - assert args[0] == request_msg @@ -63657,7 +63646,6 @@ def test_fetch_network_policy_external_addresses_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.FetchNetworkPolicyExternalAddressesRequest() - assert args[0] == request_msg @@ -63679,7 +63667,6 @@ def test_get_external_address_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.GetExternalAddressRequest() - assert args[0] == request_msg @@ -63701,7 +63688,6 @@ def test_create_external_address_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.CreateExternalAddressRequest() - assert args[0] == request_msg @@ -63723,7 +63709,6 @@ def test_update_external_address_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.UpdateExternalAddressRequest() - assert args[0] == request_msg @@ -63745,7 +63730,6 @@ def test_delete_external_address_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.DeleteExternalAddressRequest() - assert args[0] == request_msg @@ -63765,7 +63749,6 @@ def test_list_subnets_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.ListSubnetsRequest() - assert args[0] == request_msg @@ -63785,7 +63768,6 @@ def test_get_subnet_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.GetSubnetRequest() - assert args[0] == request_msg @@ -63805,7 +63787,6 @@ def test_update_subnet_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.UpdateSubnetRequest() - assert args[0] == request_msg @@ -63827,7 +63808,6 @@ def test_list_external_access_rules_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.ListExternalAccessRulesRequest() - assert args[0] == request_msg @@ -63849,7 +63829,6 @@ def test_get_external_access_rule_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.GetExternalAccessRuleRequest() - assert args[0] == request_msg @@ -63871,7 +63850,6 @@ def test_create_external_access_rule_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.CreateExternalAccessRuleRequest() - assert args[0] == request_msg @@ -63893,7 +63871,6 @@ def test_update_external_access_rule_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.UpdateExternalAccessRuleRequest() - assert args[0] == request_msg @@ -63915,7 +63892,6 @@ def test_delete_external_access_rule_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.DeleteExternalAccessRuleRequest() - assert args[0] == request_msg @@ -63937,7 +63913,6 @@ def test_list_logging_servers_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.ListLoggingServersRequest() - assert args[0] == request_msg @@ -63959,7 +63934,6 @@ def test_get_logging_server_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.GetLoggingServerRequest() - assert args[0] == request_msg @@ -63981,7 +63955,6 @@ def test_create_logging_server_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.CreateLoggingServerRequest() - assert args[0] == request_msg @@ -64003,7 +63976,6 @@ def test_update_logging_server_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.UpdateLoggingServerRequest() - assert args[0] == request_msg @@ -64025,7 +63997,6 @@ def test_delete_logging_server_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.DeleteLoggingServerRequest() - assert args[0] == request_msg @@ -64045,7 +64016,6 @@ def test_list_node_types_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.ListNodeTypesRequest() - assert args[0] == request_msg @@ -64065,7 +64035,6 @@ def test_get_node_type_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.GetNodeTypeRequest() - assert args[0] == request_msg @@ -64087,7 +64056,6 @@ def test_show_nsx_credentials_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.ShowNsxCredentialsRequest() - assert args[0] == request_msg @@ -64109,7 +64077,6 @@ def test_show_vcenter_credentials_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.ShowVcenterCredentialsRequest() - assert args[0] == request_msg @@ -64131,7 +64098,6 @@ def test_reset_nsx_credentials_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.ResetNsxCredentialsRequest() - assert args[0] == request_msg @@ -64153,7 +64119,6 @@ def test_reset_vcenter_credentials_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.ResetVcenterCredentialsRequest() - assert args[0] == request_msg @@ -64175,7 +64140,6 @@ def test_get_dns_forwarding_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.GetDnsForwardingRequest() - assert args[0] == request_msg @@ -64197,7 +64161,6 @@ def test_update_dns_forwarding_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.UpdateDnsForwardingRequest() - assert args[0] == request_msg @@ -64219,7 +64182,6 @@ def test_get_network_peering_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.GetNetworkPeeringRequest() - assert args[0] == request_msg @@ -64241,7 +64203,6 @@ def test_list_network_peerings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.ListNetworkPeeringsRequest() - assert args[0] == request_msg @@ -64263,7 +64224,6 @@ def test_create_network_peering_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.CreateNetworkPeeringRequest() - assert args[0] == request_msg @@ -64285,7 +64245,6 @@ def test_delete_network_peering_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.DeleteNetworkPeeringRequest() - assert args[0] == request_msg @@ -64307,7 +64266,6 @@ def test_update_network_peering_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.UpdateNetworkPeeringRequest() - assert args[0] == request_msg @@ -64329,7 +64287,6 @@ def test_list_peering_routes_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.ListPeeringRoutesRequest() - assert args[0] == request_msg @@ -64351,7 +64308,6 @@ def test_create_hcx_activation_key_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.CreateHcxActivationKeyRequest() - assert args[0] == request_msg @@ -64373,7 +64329,6 @@ def test_list_hcx_activation_keys_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.ListHcxActivationKeysRequest() - assert args[0] == request_msg @@ -64395,7 +64350,6 @@ def test_get_hcx_activation_key_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.GetHcxActivationKeyRequest() - assert args[0] == request_msg @@ -64417,7 +64371,6 @@ def test_get_network_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.GetNetworkPolicyRequest() - assert args[0] == request_msg @@ -64439,7 +64392,6 @@ def test_list_network_policies_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.ListNetworkPoliciesRequest() - assert args[0] == request_msg @@ -64461,7 +64413,6 @@ def test_create_network_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.CreateNetworkPolicyRequest() - assert args[0] == request_msg @@ -64483,7 +64434,6 @@ def test_update_network_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.UpdateNetworkPolicyRequest() - assert args[0] == request_msg @@ -64505,7 +64455,6 @@ def test_delete_network_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.DeleteNetworkPolicyRequest() - assert args[0] == request_msg @@ -64527,7 +64476,6 @@ def test_list_management_dns_zone_bindings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.ListManagementDnsZoneBindingsRequest() - assert args[0] == request_msg @@ -64549,7 +64497,6 @@ def test_get_management_dns_zone_binding_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.GetManagementDnsZoneBindingRequest() - assert args[0] == request_msg @@ -64571,7 +64518,6 @@ def test_create_management_dns_zone_binding_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.CreateManagementDnsZoneBindingRequest() - assert args[0] == request_msg @@ -64593,7 +64539,6 @@ def test_update_management_dns_zone_binding_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.UpdateManagementDnsZoneBindingRequest() - assert args[0] == request_msg @@ -64615,7 +64560,6 @@ def test_delete_management_dns_zone_binding_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.DeleteManagementDnsZoneBindingRequest() - assert args[0] == request_msg @@ -64637,7 +64581,6 @@ def test_repair_management_dns_zone_binding_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.RepairManagementDnsZoneBindingRequest() - assert args[0] == request_msg @@ -64659,7 +64602,6 @@ def test_create_vmware_engine_network_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.CreateVmwareEngineNetworkRequest() - assert args[0] == request_msg @@ -64681,7 +64623,6 @@ def test_update_vmware_engine_network_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.UpdateVmwareEngineNetworkRequest() - assert args[0] == request_msg @@ -64703,7 +64644,6 @@ def test_delete_vmware_engine_network_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.DeleteVmwareEngineNetworkRequest() - assert args[0] == request_msg @@ -64725,7 +64665,6 @@ def test_get_vmware_engine_network_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.GetVmwareEngineNetworkRequest() - assert args[0] == request_msg @@ -64747,7 +64686,6 @@ def test_list_vmware_engine_networks_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.ListVmwareEngineNetworksRequest() - assert args[0] == request_msg @@ -64769,7 +64707,6 @@ def test_create_private_connection_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.CreatePrivateConnectionRequest() - assert args[0] == request_msg @@ -64791,7 +64728,6 @@ def test_get_private_connection_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.GetPrivateConnectionRequest() - assert args[0] == request_msg @@ -64813,7 +64749,6 @@ def test_list_private_connections_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.ListPrivateConnectionsRequest() - assert args[0] == request_msg @@ -64835,7 +64770,6 @@ def test_update_private_connection_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.UpdatePrivateConnectionRequest() - assert args[0] == request_msg @@ -64857,7 +64791,6 @@ def test_delete_private_connection_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.DeletePrivateConnectionRequest() - assert args[0] == request_msg @@ -64879,7 +64812,6 @@ def test_list_private_connection_peering_routes_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.ListPrivateConnectionPeeringRoutesRequest() - assert args[0] == request_msg @@ -64901,7 +64833,6 @@ def test_grant_dns_bind_permission_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.GrantDnsBindPermissionRequest() - assert args[0] == request_msg @@ -64923,7 +64854,6 @@ def test_get_dns_bind_permission_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.GetDnsBindPermissionRequest() - assert args[0] == request_msg @@ -64945,7 +64875,6 @@ def test_revoke_dns_bind_permission_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vmwareengine.RevokeDnsBindPermissionRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-vpc-access/noxfile.py b/packages/google-cloud-vpc-access/noxfile.py index c2d2df3360a0..a7fb5d0c91e1 100644 --- a/packages/google-cloud-vpc-access/noxfile.py +++ b/packages/google-cloud-vpc-access/noxfile.py @@ -47,7 +47,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-vpc-access" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-vpc-access/setup.py b/packages/google-cloud-vpc-access/setup.py index b5f95d00f4cb..d8665c6bd1c4 100644 --- a/packages/google-cloud-vpc-access/setup.py +++ b/packages/google-cloud-vpc-access/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/google-cloud-vpc-access/testing/constraints-3.10.txt b/packages/google-cloud-vpc-access/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-vpc-access/testing/constraints-3.10.txt +++ b/packages/google-cloud-vpc-access/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-vpc-access/tests/unit/gapic/vpcaccess_v1/test_vpc_access_service.py b/packages/google-cloud-vpc-access/tests/unit/gapic/vpcaccess_v1/test_vpc_access_service.py index b976b23114cb..fa8b0ea0ceaa 100644 --- a/packages/google-cloud-vpc-access/tests/unit/gapic/vpcaccess_v1/test_vpc_access_service.py +++ b/packages/google-cloud-vpc-access/tests/unit/gapic/vpcaccess_v1/test_vpc_access_service.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 @@ -114,6 +115,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" @@ -1347,8 +1363,8 @@ def test_vpc_access_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - vpc_access.CreateConnectorRequest, - dict, + vpc_access.CreateConnectorRequest(), + {}, ], ) def test_create_connector(request_type, transport: str = "grpc"): @@ -1359,7 +1375,7 @@ def test_create_connector(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_connector), "__call__") as call: @@ -1401,10 +1417,11 @@ def test_create_connector_non_empty_request_with_auto_populated_field(): client.create_connector(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vpc_access.CreateConnectorRequest( + request_msg = vpc_access.CreateConnectorRequest( parent="parent_value", connector_id="connector_id_value", ) + assert args[0] == request_msg def test_create_connector_use_cached_wrapped_rpc(): @@ -1497,9 +1514,14 @@ async def test_create_connector_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_connector_async( - transport: str = "grpc_asyncio", request_type=vpc_access.CreateConnectorRequest -): +@pytest.mark.parametrize( + "request_type", + [ + vpc_access.CreateConnectorRequest(), + {}, + ], +) +async def test_create_connector_async(request_type, transport: str = "grpc_asyncio"): client = VpcAccessServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1507,7 +1529,7 @@ async def test_create_connector_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_connector), "__call__") as call: @@ -1527,11 +1549,6 @@ async def test_create_connector_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_connector_async_from_dict(): - await test_create_connector_async(request_type=dict) - - def test_create_connector_field_headers(): client = VpcAccessServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1698,8 +1715,8 @@ async def test_create_connector_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vpc_access.GetConnectorRequest, - dict, + vpc_access.GetConnectorRequest(), + {}, ], ) def test_get_connector(request_type, transport: str = "grpc"): @@ -1710,7 +1727,7 @@ def test_get_connector(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_connector), "__call__") as call: @@ -1772,9 +1789,10 @@ def test_get_connector_non_empty_request_with_auto_populated_field(): client.get_connector(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vpc_access.GetConnectorRequest( + request_msg = vpc_access.GetConnectorRequest( name="name_value", ) + assert args[0] == request_msg def test_get_connector_use_cached_wrapped_rpc(): @@ -1855,9 +1873,14 @@ async def test_get_connector_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_connector_async( - transport: str = "grpc_asyncio", request_type=vpc_access.GetConnectorRequest -): +@pytest.mark.parametrize( + "request_type", + [ + vpc_access.GetConnectorRequest(), + {}, + ], +) +async def test_get_connector_async(request_type, transport: str = "grpc_asyncio"): client = VpcAccessServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1865,7 +1888,7 @@ async def test_get_connector_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_connector), "__call__") as call: @@ -1906,11 +1929,6 @@ async def test_get_connector_async( assert response.max_instances == 1389 -@pytest.mark.asyncio -async def test_get_connector_async_from_dict(): - await test_get_connector_async(request_type=dict) - - def test_get_connector_field_headers(): client = VpcAccessServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2057,8 +2075,8 @@ async def test_get_connector_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vpc_access.ListConnectorsRequest, - dict, + vpc_access.ListConnectorsRequest(), + {}, ], ) def test_list_connectors(request_type, transport: str = "grpc"): @@ -2069,7 +2087,7 @@ def test_list_connectors(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_connectors), "__call__") as call: @@ -2114,10 +2132,11 @@ def test_list_connectors_non_empty_request_with_auto_populated_field(): client.list_connectors(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vpc_access.ListConnectorsRequest( + request_msg = vpc_access.ListConnectorsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_connectors_use_cached_wrapped_rpc(): @@ -2198,9 +2217,14 @@ async def test_list_connectors_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_connectors_async( - transport: str = "grpc_asyncio", request_type=vpc_access.ListConnectorsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + vpc_access.ListConnectorsRequest(), + {}, + ], +) +async def test_list_connectors_async(request_type, transport: str = "grpc_asyncio"): client = VpcAccessServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2208,7 +2232,7 @@ async def test_list_connectors_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_connectors), "__call__") as call: @@ -2231,11 +2255,6 @@ async def test_list_connectors_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_connectors_async_from_dict(): - await test_list_connectors_async(request_type=dict) - - def test_list_connectors_field_headers(): client = VpcAccessServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2572,8 +2591,8 @@ async def test_list_connectors_async_pages(): @pytest.mark.parametrize( "request_type", [ - vpc_access.DeleteConnectorRequest, - dict, + vpc_access.DeleteConnectorRequest(), + {}, ], ) def test_delete_connector(request_type, transport: str = "grpc"): @@ -2584,7 +2603,7 @@ def test_delete_connector(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_connector), "__call__") as call: @@ -2625,9 +2644,10 @@ def test_delete_connector_non_empty_request_with_auto_populated_field(): client.delete_connector(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vpc_access.DeleteConnectorRequest( + request_msg = vpc_access.DeleteConnectorRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_connector_use_cached_wrapped_rpc(): @@ -2720,9 +2740,14 @@ async def test_delete_connector_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_connector_async( - transport: str = "grpc_asyncio", request_type=vpc_access.DeleteConnectorRequest -): +@pytest.mark.parametrize( + "request_type", + [ + vpc_access.DeleteConnectorRequest(), + {}, + ], +) +async def test_delete_connector_async(request_type, transport: str = "grpc_asyncio"): client = VpcAccessServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2730,7 +2755,7 @@ async def test_delete_connector_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_connector), "__call__") as call: @@ -2750,11 +2775,6 @@ async def test_delete_connector_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_connector_async_from_dict(): - await test_delete_connector_async(request_type=dict) - - def test_delete_connector_field_headers(): client = VpcAccessServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3840,7 +3860,6 @@ def test_create_connector_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vpc_access.CreateConnectorRequest() - assert args[0] == request_msg @@ -3861,7 +3880,6 @@ def test_get_connector_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vpc_access.GetConnectorRequest() - assert args[0] == request_msg @@ -3882,7 +3900,6 @@ def test_list_connectors_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vpc_access.ListConnectorsRequest() - assert args[0] == request_msg @@ -3903,7 +3920,6 @@ def test_delete_connector_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vpc_access.DeleteConnectorRequest() - assert args[0] == request_msg @@ -3942,7 +3958,6 @@ async def test_create_connector_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vpc_access.CreateConnectorRequest() - assert args[0] == request_msg @@ -3978,7 +3993,6 @@ async def test_get_connector_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vpc_access.GetConnectorRequest() - assert args[0] == request_msg @@ -4005,7 +4019,6 @@ async def test_list_connectors_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vpc_access.ListConnectorsRequest() - assert args[0] == request_msg @@ -4030,7 +4043,6 @@ async def test_delete_connector_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vpc_access.DeleteConnectorRequest() - assert args[0] == request_msg @@ -4864,7 +4876,6 @@ def test_create_connector_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vpc_access.CreateConnectorRequest() - assert args[0] == request_msg @@ -4884,7 +4895,6 @@ def test_get_connector_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vpc_access.GetConnectorRequest() - assert args[0] == request_msg @@ -4904,7 +4914,6 @@ def test_list_connectors_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vpc_access.ListConnectorsRequest() - assert args[0] == request_msg @@ -4924,7 +4933,6 @@ def test_delete_connector_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vpc_access.DeleteConnectorRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-webrisk/noxfile.py b/packages/google-cloud-webrisk/noxfile.py index 5e2e636fe375..0f2c3773d9fe 100644 --- a/packages/google-cloud-webrisk/noxfile.py +++ b/packages/google-cloud-webrisk/noxfile.py @@ -47,7 +47,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-webrisk" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-webrisk/setup.py b/packages/google-cloud-webrisk/setup.py index 378d5ad9cf1a..993bdd3378ba 100644 --- a/packages/google-cloud-webrisk/setup.py +++ b/packages/google-cloud-webrisk/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/google-cloud-webrisk/testing/constraints-3.10.txt b/packages/google-cloud-webrisk/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-webrisk/testing/constraints-3.10.txt +++ b/packages/google-cloud-webrisk/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-webrisk/tests/unit/gapic/webrisk_v1/test_web_risk_service.py b/packages/google-cloud-webrisk/tests/unit/gapic/webrisk_v1/test_web_risk_service.py index 6cb68d712d28..a46c66d261a2 100644 --- a/packages/google-cloud-webrisk/tests/unit/gapic/webrisk_v1/test_web_risk_service.py +++ b/packages/google-cloud-webrisk/tests/unit/gapic/webrisk_v1/test_web_risk_service.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" @@ -1319,8 +1335,8 @@ def test_web_risk_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - webrisk.ComputeThreatListDiffRequest, - dict, + webrisk.ComputeThreatListDiffRequest(), + {}, ], ) def test_compute_threat_list_diff(request_type, transport: str = "grpc"): @@ -1331,7 +1347,7 @@ def test_compute_threat_list_diff(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1382,7 +1398,8 @@ def test_compute_threat_list_diff_non_empty_request_with_auto_populated_field(): client.compute_threat_list_diff(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == webrisk.ComputeThreatListDiffRequest() + request_msg = webrisk.ComputeThreatListDiffRequest() + assert args[0] == request_msg def test_compute_threat_list_diff_use_cached_wrapped_rpc(): @@ -1468,8 +1485,15 @@ async def test_compute_threat_list_diff_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + webrisk.ComputeThreatListDiffRequest(), + {}, + ], +) async def test_compute_threat_list_diff_async( - transport: str = "grpc_asyncio", request_type=webrisk.ComputeThreatListDiffRequest + request_type, transport: str = "grpc_asyncio" ): client = WebRiskServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1478,7 +1502,7 @@ async def test_compute_threat_list_diff_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( @@ -1508,11 +1532,6 @@ async def test_compute_threat_list_diff_async( assert response.new_version_token == b"new_version_token_blob" -@pytest.mark.asyncio -async def test_compute_threat_list_diff_async_from_dict(): - await test_compute_threat_list_diff_async(request_type=dict) - - def test_compute_threat_list_diff_flattened(): client = WebRiskServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1634,8 +1653,8 @@ async def test_compute_threat_list_diff_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - webrisk.SearchUrisRequest, - dict, + webrisk.SearchUrisRequest(), + {}, ], ) def test_search_uris(request_type, transport: str = "grpc"): @@ -1646,7 +1665,7 @@ def test_search_uris(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.search_uris), "__call__") as call: @@ -1687,9 +1706,10 @@ def test_search_uris_non_empty_request_with_auto_populated_field(): client.search_uris(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == webrisk.SearchUrisRequest( + request_msg = webrisk.SearchUrisRequest( uri="uri_value", ) + assert args[0] == request_msg def test_search_uris_use_cached_wrapped_rpc(): @@ -1770,9 +1790,14 @@ async def test_search_uris_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_search_uris_async( - transport: str = "grpc_asyncio", request_type=webrisk.SearchUrisRequest -): +@pytest.mark.parametrize( + "request_type", + [ + webrisk.SearchUrisRequest(), + {}, + ], +) +async def test_search_uris_async(request_type, transport: str = "grpc_asyncio"): client = WebRiskServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1780,7 +1805,7 @@ async def test_search_uris_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.search_uris), "__call__") as call: @@ -1800,11 +1825,6 @@ async def test_search_uris_async( assert isinstance(response, webrisk.SearchUrisResponse) -@pytest.mark.asyncio -async def test_search_uris_async_from_dict(): - await test_search_uris_async(request_type=dict) - - def test_search_uris_flattened(): client = WebRiskServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1900,8 +1920,8 @@ async def test_search_uris_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - webrisk.SearchHashesRequest, - dict, + webrisk.SearchHashesRequest(), + {}, ], ) def test_search_hashes(request_type, transport: str = "grpc"): @@ -1912,7 +1932,7 @@ def test_search_hashes(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.search_hashes), "__call__") as call: @@ -1951,7 +1971,8 @@ def test_search_hashes_non_empty_request_with_auto_populated_field(): client.search_hashes(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == webrisk.SearchHashesRequest() + request_msg = webrisk.SearchHashesRequest() + assert args[0] == request_msg def test_search_hashes_use_cached_wrapped_rpc(): @@ -2032,9 +2053,14 @@ async def test_search_hashes_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_search_hashes_async( - transport: str = "grpc_asyncio", request_type=webrisk.SearchHashesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + webrisk.SearchHashesRequest(), + {}, + ], +) +async def test_search_hashes_async(request_type, transport: str = "grpc_asyncio"): client = WebRiskServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2042,7 +2068,7 @@ async def test_search_hashes_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.search_hashes), "__call__") as call: @@ -2062,11 +2088,6 @@ async def test_search_hashes_async( assert isinstance(response, webrisk.SearchHashesResponse) -@pytest.mark.asyncio -async def test_search_hashes_async_from_dict(): - await test_search_hashes_async(request_type=dict) - - def test_search_hashes_flattened(): client = WebRiskServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2162,8 +2183,8 @@ async def test_search_hashes_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - webrisk.CreateSubmissionRequest, - dict, + webrisk.CreateSubmissionRequest(), + {}, ], ) def test_create_submission(request_type, transport: str = "grpc"): @@ -2174,7 +2195,7 @@ def test_create_submission(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2224,9 +2245,10 @@ def test_create_submission_non_empty_request_with_auto_populated_field(): client.create_submission(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == webrisk.CreateSubmissionRequest( + request_msg = webrisk.CreateSubmissionRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_submission_use_cached_wrapped_rpc(): @@ -2309,9 +2331,14 @@ async def test_create_submission_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_submission_async( - transport: str = "grpc_asyncio", request_type=webrisk.CreateSubmissionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + webrisk.CreateSubmissionRequest(), + {}, + ], +) +async def test_create_submission_async(request_type, transport: str = "grpc_asyncio"): client = WebRiskServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2319,7 +2346,7 @@ async def test_create_submission_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( @@ -2346,11 +2373,6 @@ async def test_create_submission_async( assert response.threat_types == [webrisk.ThreatType.MALWARE] -@pytest.mark.asyncio -async def test_create_submission_async_from_dict(): - await test_create_submission_async(request_type=dict) - - def test_create_submission_field_headers(): client = WebRiskServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2511,8 +2533,8 @@ async def test_create_submission_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - webrisk.SubmitUriRequest, - dict, + webrisk.SubmitUriRequest(), + {}, ], ) def test_submit_uri(request_type, transport: str = "grpc"): @@ -2523,7 +2545,7 @@ def test_submit_uri(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.submit_uri), "__call__") as call: @@ -2564,9 +2586,10 @@ def test_submit_uri_non_empty_request_with_auto_populated_field(): client.submit_uri(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == webrisk.SubmitUriRequest( + request_msg = webrisk.SubmitUriRequest( parent="parent_value", ) + assert args[0] == request_msg def test_submit_uri_use_cached_wrapped_rpc(): @@ -2655,9 +2678,14 @@ async def test_submit_uri_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_submit_uri_async( - transport: str = "grpc_asyncio", request_type=webrisk.SubmitUriRequest -): +@pytest.mark.parametrize( + "request_type", + [ + webrisk.SubmitUriRequest(), + {}, + ], +) +async def test_submit_uri_async(request_type, transport: str = "grpc_asyncio"): client = WebRiskServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2665,7 +2693,7 @@ async def test_submit_uri_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.submit_uri), "__call__") as call: @@ -2685,11 +2713,6 @@ async def test_submit_uri_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_submit_uri_async_from_dict(): - await test_submit_uri_async(request_type=dict) - - def test_submit_uri_field_headers(): client = WebRiskServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3938,7 +3961,6 @@ def test_compute_threat_list_diff_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = webrisk.ComputeThreatListDiffRequest() - assert args[0] == request_msg @@ -3959,7 +3981,6 @@ def test_search_uris_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = webrisk.SearchUrisRequest() - assert args[0] == request_msg @@ -3980,7 +4001,6 @@ def test_search_hashes_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = webrisk.SearchHashesRequest() - assert args[0] == request_msg @@ -4003,7 +4023,6 @@ def test_create_submission_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = webrisk.CreateSubmissionRequest() - assert args[0] == request_msg @@ -4024,7 +4043,6 @@ def test_submit_uri_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = webrisk.SubmitUriRequest() - assert args[0] == request_msg @@ -4068,7 +4086,6 @@ async def test_compute_threat_list_diff_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = webrisk.ComputeThreatListDiffRequest() - assert args[0] == request_msg @@ -4093,7 +4110,6 @@ async def test_search_uris_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = webrisk.SearchUrisRequest() - assert args[0] == request_msg @@ -4118,7 +4134,6 @@ async def test_search_hashes_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = webrisk.SearchHashesRequest() - assert args[0] == request_msg @@ -4148,7 +4163,6 @@ async def test_create_submission_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = webrisk.CreateSubmissionRequest() - assert args[0] == request_msg @@ -4173,7 +4187,6 @@ async def test_submit_uri_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = webrisk.SubmitUriRequest() - assert args[0] == request_msg @@ -5170,7 +5183,6 @@ def test_compute_threat_list_diff_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = webrisk.ComputeThreatListDiffRequest() - assert args[0] == request_msg @@ -5190,7 +5202,6 @@ def test_search_uris_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = webrisk.SearchUrisRequest() - assert args[0] == request_msg @@ -5210,7 +5221,6 @@ def test_search_hashes_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = webrisk.SearchHashesRequest() - assert args[0] == request_msg @@ -5232,7 +5242,6 @@ def test_create_submission_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = webrisk.CreateSubmissionRequest() - assert args[0] == request_msg @@ -5252,7 +5261,6 @@ def test_submit_uri_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = webrisk.SubmitUriRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-webrisk/tests/unit/gapic/webrisk_v1beta1/test_web_risk_service_v1_beta1.py b/packages/google-cloud-webrisk/tests/unit/gapic/webrisk_v1beta1/test_web_risk_service_v1_beta1.py index 9d7b059f5a9d..6139ef5471b2 100644 --- a/packages/google-cloud-webrisk/tests/unit/gapic/webrisk_v1beta1/test_web_risk_service_v1_beta1.py +++ b/packages/google-cloud-webrisk/tests/unit/gapic/webrisk_v1beta1/test_web_risk_service_v1_beta1.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 @@ -107,6 +108,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" @@ -1374,8 +1390,8 @@ def test_web_risk_service_v1_beta1_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - webrisk.ComputeThreatListDiffRequest, - dict, + webrisk.ComputeThreatListDiffRequest(), + {}, ], ) def test_compute_threat_list_diff(request_type, transport: str = "grpc"): @@ -1386,7 +1402,7 @@ def test_compute_threat_list_diff(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1437,7 +1453,8 @@ def test_compute_threat_list_diff_non_empty_request_with_auto_populated_field(): client.compute_threat_list_diff(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == webrisk.ComputeThreatListDiffRequest() + request_msg = webrisk.ComputeThreatListDiffRequest() + assert args[0] == request_msg def test_compute_threat_list_diff_use_cached_wrapped_rpc(): @@ -1523,8 +1540,15 @@ async def test_compute_threat_list_diff_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + webrisk.ComputeThreatListDiffRequest(), + {}, + ], +) async def test_compute_threat_list_diff_async( - transport: str = "grpc_asyncio", request_type=webrisk.ComputeThreatListDiffRequest + request_type, transport: str = "grpc_asyncio" ): client = WebRiskServiceV1Beta1AsyncClient( credentials=async_anonymous_credentials(), @@ -1533,7 +1557,7 @@ async def test_compute_threat_list_diff_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( @@ -1563,11 +1587,6 @@ async def test_compute_threat_list_diff_async( assert response.new_version_token == b"new_version_token_blob" -@pytest.mark.asyncio -async def test_compute_threat_list_diff_async_from_dict(): - await test_compute_threat_list_diff_async(request_type=dict) - - def test_compute_threat_list_diff_flattened(): client = WebRiskServiceV1Beta1Client( credentials=ga_credentials.AnonymousCredentials(), @@ -1689,8 +1708,8 @@ async def test_compute_threat_list_diff_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - webrisk.SearchUrisRequest, - dict, + webrisk.SearchUrisRequest(), + {}, ], ) def test_search_uris(request_type, transport: str = "grpc"): @@ -1701,7 +1720,7 @@ def test_search_uris(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.search_uris), "__call__") as call: @@ -1742,9 +1761,10 @@ def test_search_uris_non_empty_request_with_auto_populated_field(): client.search_uris(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == webrisk.SearchUrisRequest( + request_msg = webrisk.SearchUrisRequest( uri="uri_value", ) + assert args[0] == request_msg def test_search_uris_use_cached_wrapped_rpc(): @@ -1825,9 +1845,14 @@ async def test_search_uris_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_search_uris_async( - transport: str = "grpc_asyncio", request_type=webrisk.SearchUrisRequest -): +@pytest.mark.parametrize( + "request_type", + [ + webrisk.SearchUrisRequest(), + {}, + ], +) +async def test_search_uris_async(request_type, transport: str = "grpc_asyncio"): client = WebRiskServiceV1Beta1AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1835,7 +1860,7 @@ async def test_search_uris_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.search_uris), "__call__") as call: @@ -1855,11 +1880,6 @@ async def test_search_uris_async( assert isinstance(response, webrisk.SearchUrisResponse) -@pytest.mark.asyncio -async def test_search_uris_async_from_dict(): - await test_search_uris_async(request_type=dict) - - def test_search_uris_flattened(): client = WebRiskServiceV1Beta1Client( credentials=ga_credentials.AnonymousCredentials(), @@ -1955,8 +1975,8 @@ async def test_search_uris_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - webrisk.SearchHashesRequest, - dict, + webrisk.SearchHashesRequest(), + {}, ], ) def test_search_hashes(request_type, transport: str = "grpc"): @@ -1967,7 +1987,7 @@ def test_search_hashes(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.search_hashes), "__call__") as call: @@ -2006,7 +2026,8 @@ def test_search_hashes_non_empty_request_with_auto_populated_field(): client.search_hashes(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == webrisk.SearchHashesRequest() + request_msg = webrisk.SearchHashesRequest() + assert args[0] == request_msg def test_search_hashes_use_cached_wrapped_rpc(): @@ -2087,9 +2108,14 @@ async def test_search_hashes_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_search_hashes_async( - transport: str = "grpc_asyncio", request_type=webrisk.SearchHashesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + webrisk.SearchHashesRequest(), + {}, + ], +) +async def test_search_hashes_async(request_type, transport: str = "grpc_asyncio"): client = WebRiskServiceV1Beta1AsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2097,7 +2123,7 @@ async def test_search_hashes_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.search_hashes), "__call__") as call: @@ -2117,11 +2143,6 @@ async def test_search_hashes_async( assert isinstance(response, webrisk.SearchHashesResponse) -@pytest.mark.asyncio -async def test_search_hashes_async_from_dict(): - await test_search_hashes_async(request_type=dict) - - def test_search_hashes_flattened(): client = WebRiskServiceV1Beta1Client( credentials=ga_credentials.AnonymousCredentials(), @@ -2936,7 +2957,6 @@ def test_compute_threat_list_diff_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = webrisk.ComputeThreatListDiffRequest() - assert args[0] == request_msg @@ -2957,7 +2977,6 @@ def test_search_uris_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = webrisk.SearchUrisRequest() - assert args[0] == request_msg @@ -2978,7 +2997,6 @@ def test_search_hashes_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = webrisk.SearchHashesRequest() - assert args[0] == request_msg @@ -3022,7 +3040,6 @@ async def test_compute_threat_list_diff_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = webrisk.ComputeThreatListDiffRequest() - assert args[0] == request_msg @@ -3047,7 +3064,6 @@ async def test_search_uris_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = webrisk.SearchUrisRequest() - assert args[0] == request_msg @@ -3072,7 +3088,6 @@ async def test_search_hashes_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = webrisk.SearchHashesRequest() - assert args[0] == request_msg @@ -3501,7 +3516,6 @@ def test_compute_threat_list_diff_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = webrisk.ComputeThreatListDiffRequest() - assert args[0] == request_msg @@ -3521,7 +3535,6 @@ def test_search_uris_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = webrisk.SearchUrisRequest() - assert args[0] == request_msg @@ -3541,7 +3554,6 @@ def test_search_hashes_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = webrisk.SearchHashesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-websecurityscanner/noxfile.py b/packages/google-cloud-websecurityscanner/noxfile.py index 56bba08e3a8d..9f29ec42138c 100644 --- a/packages/google-cloud-websecurityscanner/noxfile.py +++ b/packages/google-cloud-websecurityscanner/noxfile.py @@ -47,7 +47,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-websecurityscanner" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-websecurityscanner/setup.py b/packages/google-cloud-websecurityscanner/setup.py index 8e9a5c5290e1..57f3e54bd80d 100644 --- a/packages/google-cloud-websecurityscanner/setup.py +++ b/packages/google-cloud-websecurityscanner/setup.py @@ -45,7 +45,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/google-cloud-websecurityscanner/testing/constraints-3.10.txt b/packages/google-cloud-websecurityscanner/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-websecurityscanner/testing/constraints-3.10.txt +++ b/packages/google-cloud-websecurityscanner/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-websecurityscanner/tests/unit/gapic/websecurityscanner_v1/test_web_security_scanner.py b/packages/google-cloud-websecurityscanner/tests/unit/gapic/websecurityscanner_v1/test_web_security_scanner.py index dfee31d531f1..443900a50b67 100644 --- a/packages/google-cloud-websecurityscanner/tests/unit/gapic/websecurityscanner_v1/test_web_security_scanner.py +++ b/packages/google-cloud-websecurityscanner/tests/unit/gapic/websecurityscanner_v1/test_web_security_scanner.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 @@ -119,6 +120,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" @@ -1364,8 +1380,8 @@ def test_web_security_scanner_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - web_security_scanner.CreateScanConfigRequest, - dict, + web_security_scanner.CreateScanConfigRequest(), + {}, ], ) def test_create_scan_config(request_type, transport: str = "grpc"): @@ -1376,7 +1392,7 @@ def test_create_scan_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( @@ -1447,9 +1463,10 @@ def test_create_scan_config_non_empty_request_with_auto_populated_field(): client.create_scan_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == web_security_scanner.CreateScanConfigRequest( + request_msg = web_security_scanner.CreateScanConfigRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_scan_config_use_cached_wrapped_rpc(): @@ -1534,10 +1551,14 @@ async def test_create_scan_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_scan_config_async( - transport: str = "grpc_asyncio", - request_type=web_security_scanner.CreateScanConfigRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + web_security_scanner.CreateScanConfigRequest(), + {}, + ], +) +async def test_create_scan_config_async(request_type, transport: str = "grpc_asyncio"): client = WebSecurityScannerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1545,7 +1566,7 @@ async def test_create_scan_config_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( @@ -1593,11 +1614,6 @@ async def test_create_scan_config_async( assert response.ignore_http_status_errors is True -@pytest.mark.asyncio -async def test_create_scan_config_async_from_dict(): - await test_create_scan_config_async(request_type=dict) - - def test_create_scan_config_field_headers(): client = WebSecurityScannerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1666,8 +1682,8 @@ async def test_create_scan_config_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - web_security_scanner.DeleteScanConfigRequest, - dict, + web_security_scanner.DeleteScanConfigRequest(), + {}, ], ) def test_delete_scan_config(request_type, transport: str = "grpc"): @@ -1678,7 +1694,7 @@ def test_delete_scan_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( @@ -1723,9 +1739,10 @@ def test_delete_scan_config_non_empty_request_with_auto_populated_field(): client.delete_scan_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == web_security_scanner.DeleteScanConfigRequest( + request_msg = web_security_scanner.DeleteScanConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_scan_config_use_cached_wrapped_rpc(): @@ -1810,10 +1827,14 @@ async def test_delete_scan_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_scan_config_async( - transport: str = "grpc_asyncio", - request_type=web_security_scanner.DeleteScanConfigRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + web_security_scanner.DeleteScanConfigRequest(), + {}, + ], +) +async def test_delete_scan_config_async(request_type, transport: str = "grpc_asyncio"): client = WebSecurityScannerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1821,7 +1842,7 @@ async def test_delete_scan_config_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( @@ -1841,11 +1862,6 @@ async def test_delete_scan_config_async( assert response is None -@pytest.mark.asyncio -async def test_delete_scan_config_async_from_dict(): - await test_delete_scan_config_async(request_type=dict) - - def test_delete_scan_config_field_headers(): client = WebSecurityScannerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1912,8 +1928,8 @@ async def test_delete_scan_config_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - web_security_scanner.GetScanConfigRequest, - dict, + web_security_scanner.GetScanConfigRequest(), + {}, ], ) def test_get_scan_config(request_type, transport: str = "grpc"): @@ -1924,7 +1940,7 @@ def test_get_scan_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(type(client.transport.get_scan_config), "__call__") as call: @@ -1991,9 +2007,10 @@ def test_get_scan_config_non_empty_request_with_auto_populated_field(): client.get_scan_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == web_security_scanner.GetScanConfigRequest( + request_msg = web_security_scanner.GetScanConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_scan_config_use_cached_wrapped_rpc(): @@ -2074,10 +2091,14 @@ async def test_get_scan_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_scan_config_async( - transport: str = "grpc_asyncio", - request_type=web_security_scanner.GetScanConfigRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + web_security_scanner.GetScanConfigRequest(), + {}, + ], +) +async def test_get_scan_config_async(request_type, transport: str = "grpc_asyncio"): client = WebSecurityScannerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2085,7 +2106,7 @@ async def test_get_scan_config_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_scan_config), "__call__") as call: @@ -2131,11 +2152,6 @@ async def test_get_scan_config_async( assert response.ignore_http_status_errors is True -@pytest.mark.asyncio -async def test_get_scan_config_async_from_dict(): - await test_get_scan_config_async(request_type=dict) - - def test_get_scan_config_field_headers(): client = WebSecurityScannerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2200,8 +2216,8 @@ async def test_get_scan_config_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - web_security_scanner.ListScanConfigsRequest, - dict, + web_security_scanner.ListScanConfigsRequest(), + {}, ], ) def test_list_scan_configs(request_type, transport: str = "grpc"): @@ -2212,7 +2228,7 @@ def test_list_scan_configs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2261,10 +2277,11 @@ def test_list_scan_configs_non_empty_request_with_auto_populated_field(): client.list_scan_configs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == web_security_scanner.ListScanConfigsRequest( + request_msg = web_security_scanner.ListScanConfigsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_scan_configs_use_cached_wrapped_rpc(): @@ -2347,10 +2364,14 @@ async def test_list_scan_configs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_scan_configs_async( - transport: str = "grpc_asyncio", - request_type=web_security_scanner.ListScanConfigsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + web_security_scanner.ListScanConfigsRequest(), + {}, + ], +) +async def test_list_scan_configs_async(request_type, transport: str = "grpc_asyncio"): client = WebSecurityScannerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2358,7 +2379,7 @@ async def test_list_scan_configs_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( @@ -2383,11 +2404,6 @@ async def test_list_scan_configs_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_scan_configs_async_from_dict(): - await test_list_scan_configs_async(request_type=dict) - - def test_list_scan_configs_field_headers(): client = WebSecurityScannerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2654,8 +2670,8 @@ async def test_list_scan_configs_async_pages(): @pytest.mark.parametrize( "request_type", [ - web_security_scanner.UpdateScanConfigRequest, - dict, + web_security_scanner.UpdateScanConfigRequest(), + {}, ], ) def test_update_scan_config(request_type, transport: str = "grpc"): @@ -2666,7 +2682,7 @@ def test_update_scan_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( @@ -2735,7 +2751,8 @@ def test_update_scan_config_non_empty_request_with_auto_populated_field(): client.update_scan_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == web_security_scanner.UpdateScanConfigRequest() + request_msg = web_security_scanner.UpdateScanConfigRequest() + assert args[0] == request_msg def test_update_scan_config_use_cached_wrapped_rpc(): @@ -2820,10 +2837,14 @@ async def test_update_scan_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_scan_config_async( - transport: str = "grpc_asyncio", - request_type=web_security_scanner.UpdateScanConfigRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + web_security_scanner.UpdateScanConfigRequest(), + {}, + ], +) +async def test_update_scan_config_async(request_type, transport: str = "grpc_asyncio"): client = WebSecurityScannerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2831,7 +2852,7 @@ async def test_update_scan_config_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( @@ -2879,11 +2900,6 @@ async def test_update_scan_config_async( assert response.ignore_http_status_errors is True -@pytest.mark.asyncio -async def test_update_scan_config_async_from_dict(): - await test_update_scan_config_async(request_type=dict) - - def test_update_scan_config_field_headers(): client = WebSecurityScannerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2952,8 +2968,8 @@ async def test_update_scan_config_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - web_security_scanner.StartScanRunRequest, - dict, + web_security_scanner.StartScanRunRequest(), + {}, ], ) def test_start_scan_run(request_type, transport: str = "grpc"): @@ -2964,7 +2980,7 @@ def test_start_scan_run(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.start_scan_run), "__call__") as call: @@ -3020,9 +3036,10 @@ def test_start_scan_run_non_empty_request_with_auto_populated_field(): client.start_scan_run(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == web_security_scanner.StartScanRunRequest( + request_msg = web_security_scanner.StartScanRunRequest( name="name_value", ) + assert args[0] == request_msg def test_start_scan_run_use_cached_wrapped_rpc(): @@ -3103,10 +3120,14 @@ async def test_start_scan_run_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_start_scan_run_async( - transport: str = "grpc_asyncio", - request_type=web_security_scanner.StartScanRunRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + web_security_scanner.StartScanRunRequest(), + {}, + ], +) +async def test_start_scan_run_async(request_type, transport: str = "grpc_asyncio"): client = WebSecurityScannerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3114,7 +3135,7 @@ async def test_start_scan_run_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.start_scan_run), "__call__") as call: @@ -3149,11 +3170,6 @@ async def test_start_scan_run_async( assert response.progress_percent == 1733 -@pytest.mark.asyncio -async def test_start_scan_run_async_from_dict(): - await test_start_scan_run_async(request_type=dict) - - def test_start_scan_run_field_headers(): client = WebSecurityScannerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3216,8 +3232,8 @@ async def test_start_scan_run_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - web_security_scanner.GetScanRunRequest, - dict, + web_security_scanner.GetScanRunRequest(), + {}, ], ) def test_get_scan_run(request_type, transport: str = "grpc"): @@ -3228,7 +3244,7 @@ def test_get_scan_run(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_scan_run), "__call__") as call: @@ -3284,9 +3300,10 @@ def test_get_scan_run_non_empty_request_with_auto_populated_field(): client.get_scan_run(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == web_security_scanner.GetScanRunRequest( + request_msg = web_security_scanner.GetScanRunRequest( name="name_value", ) + assert args[0] == request_msg def test_get_scan_run_use_cached_wrapped_rpc(): @@ -3367,9 +3384,14 @@ async def test_get_scan_run_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_scan_run_async( - transport: str = "grpc_asyncio", request_type=web_security_scanner.GetScanRunRequest -): +@pytest.mark.parametrize( + "request_type", + [ + web_security_scanner.GetScanRunRequest(), + {}, + ], +) +async def test_get_scan_run_async(request_type, transport: str = "grpc_asyncio"): client = WebSecurityScannerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3377,7 +3399,7 @@ async def test_get_scan_run_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_scan_run), "__call__") as call: @@ -3412,11 +3434,6 @@ async def test_get_scan_run_async( assert response.progress_percent == 1733 -@pytest.mark.asyncio -async def test_get_scan_run_async_from_dict(): - await test_get_scan_run_async(request_type=dict) - - def test_get_scan_run_field_headers(): client = WebSecurityScannerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3479,8 +3496,8 @@ async def test_get_scan_run_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - web_security_scanner.ListScanRunsRequest, - dict, + web_security_scanner.ListScanRunsRequest(), + {}, ], ) def test_list_scan_runs(request_type, transport: str = "grpc"): @@ -3491,7 +3508,7 @@ def test_list_scan_runs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_scan_runs), "__call__") as call: @@ -3536,10 +3553,11 @@ def test_list_scan_runs_non_empty_request_with_auto_populated_field(): client.list_scan_runs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == web_security_scanner.ListScanRunsRequest( + request_msg = web_security_scanner.ListScanRunsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_scan_runs_use_cached_wrapped_rpc(): @@ -3620,10 +3638,14 @@ async def test_list_scan_runs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_scan_runs_async( - transport: str = "grpc_asyncio", - request_type=web_security_scanner.ListScanRunsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + web_security_scanner.ListScanRunsRequest(), + {}, + ], +) +async def test_list_scan_runs_async(request_type, transport: str = "grpc_asyncio"): client = WebSecurityScannerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3631,7 +3653,7 @@ async def test_list_scan_runs_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_scan_runs), "__call__") as call: @@ -3654,11 +3676,6 @@ async def test_list_scan_runs_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_scan_runs_async_from_dict(): - await test_list_scan_runs_async(request_type=dict) - - def test_list_scan_runs_field_headers(): client = WebSecurityScannerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3913,8 +3930,8 @@ async def test_list_scan_runs_async_pages(): @pytest.mark.parametrize( "request_type", [ - web_security_scanner.StopScanRunRequest, - dict, + web_security_scanner.StopScanRunRequest(), + {}, ], ) def test_stop_scan_run(request_type, transport: str = "grpc"): @@ -3925,7 +3942,7 @@ def test_stop_scan_run(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.stop_scan_run), "__call__") as call: @@ -3981,9 +3998,10 @@ def test_stop_scan_run_non_empty_request_with_auto_populated_field(): client.stop_scan_run(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == web_security_scanner.StopScanRunRequest( + request_msg = web_security_scanner.StopScanRunRequest( name="name_value", ) + assert args[0] == request_msg def test_stop_scan_run_use_cached_wrapped_rpc(): @@ -4064,10 +4082,14 @@ async def test_stop_scan_run_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_stop_scan_run_async( - transport: str = "grpc_asyncio", - request_type=web_security_scanner.StopScanRunRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + web_security_scanner.StopScanRunRequest(), + {}, + ], +) +async def test_stop_scan_run_async(request_type, transport: str = "grpc_asyncio"): client = WebSecurityScannerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4075,7 +4097,7 @@ async def test_stop_scan_run_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.stop_scan_run), "__call__") as call: @@ -4110,11 +4132,6 @@ async def test_stop_scan_run_async( assert response.progress_percent == 1733 -@pytest.mark.asyncio -async def test_stop_scan_run_async_from_dict(): - await test_stop_scan_run_async(request_type=dict) - - def test_stop_scan_run_field_headers(): client = WebSecurityScannerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4177,8 +4194,8 @@ async def test_stop_scan_run_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - web_security_scanner.ListCrawledUrlsRequest, - dict, + web_security_scanner.ListCrawledUrlsRequest(), + {}, ], ) def test_list_crawled_urls(request_type, transport: str = "grpc"): @@ -4189,7 +4206,7 @@ def test_list_crawled_urls(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4238,10 +4255,11 @@ def test_list_crawled_urls_non_empty_request_with_auto_populated_field(): client.list_crawled_urls(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == web_security_scanner.ListCrawledUrlsRequest( + request_msg = web_security_scanner.ListCrawledUrlsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_crawled_urls_use_cached_wrapped_rpc(): @@ -4324,10 +4342,14 @@ async def test_list_crawled_urls_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_crawled_urls_async( - transport: str = "grpc_asyncio", - request_type=web_security_scanner.ListCrawledUrlsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + web_security_scanner.ListCrawledUrlsRequest(), + {}, + ], +) +async def test_list_crawled_urls_async(request_type, transport: str = "grpc_asyncio"): client = WebSecurityScannerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4335,7 +4357,7 @@ async def test_list_crawled_urls_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( @@ -4360,11 +4382,6 @@ async def test_list_crawled_urls_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_crawled_urls_async_from_dict(): - await test_list_crawled_urls_async(request_type=dict) - - def test_list_crawled_urls_field_headers(): client = WebSecurityScannerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4631,8 +4648,8 @@ async def test_list_crawled_urls_async_pages(): @pytest.mark.parametrize( "request_type", [ - web_security_scanner.GetFindingRequest, - dict, + web_security_scanner.GetFindingRequest(), + {}, ], ) def test_get_finding(request_type, transport: str = "grpc"): @@ -4643,7 +4660,7 @@ def test_get_finding(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_finding), "__call__") as call: @@ -4707,9 +4724,10 @@ def test_get_finding_non_empty_request_with_auto_populated_field(): client.get_finding(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == web_security_scanner.GetFindingRequest( + request_msg = web_security_scanner.GetFindingRequest( name="name_value", ) + assert args[0] == request_msg def test_get_finding_use_cached_wrapped_rpc(): @@ -4790,9 +4808,14 @@ async def test_get_finding_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_finding_async( - transport: str = "grpc_asyncio", request_type=web_security_scanner.GetFindingRequest -): +@pytest.mark.parametrize( + "request_type", + [ + web_security_scanner.GetFindingRequest(), + {}, + ], +) +async def test_get_finding_async(request_type, transport: str = "grpc_asyncio"): client = WebSecurityScannerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4800,7 +4823,7 @@ async def test_get_finding_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_finding), "__call__") as call: @@ -4843,11 +4866,6 @@ async def test_get_finding_async( assert response.tracking_id == "tracking_id_value" -@pytest.mark.asyncio -async def test_get_finding_async_from_dict(): - await test_get_finding_async(request_type=dict) - - def test_get_finding_field_headers(): client = WebSecurityScannerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4910,8 +4928,8 @@ async def test_get_finding_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - web_security_scanner.ListFindingsRequest, - dict, + web_security_scanner.ListFindingsRequest(), + {}, ], ) def test_list_findings(request_type, transport: str = "grpc"): @@ -4922,7 +4940,7 @@ def test_list_findings(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_findings), "__call__") as call: @@ -4968,11 +4986,12 @@ def test_list_findings_non_empty_request_with_auto_populated_field(): client.list_findings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == web_security_scanner.ListFindingsRequest( + request_msg = web_security_scanner.ListFindingsRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_findings_use_cached_wrapped_rpc(): @@ -5053,10 +5072,14 @@ async def test_list_findings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_findings_async( - transport: str = "grpc_asyncio", - request_type=web_security_scanner.ListFindingsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + web_security_scanner.ListFindingsRequest(), + {}, + ], +) +async def test_list_findings_async(request_type, transport: str = "grpc_asyncio"): client = WebSecurityScannerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5064,7 +5087,7 @@ async def test_list_findings_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_findings), "__call__") as call: @@ -5087,11 +5110,6 @@ async def test_list_findings_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_findings_async_from_dict(): - await test_list_findings_async(request_type=dict) - - def test_list_findings_field_headers(): client = WebSecurityScannerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5346,8 +5364,8 @@ async def test_list_findings_async_pages(): @pytest.mark.parametrize( "request_type", [ - web_security_scanner.ListFindingTypeStatsRequest, - dict, + web_security_scanner.ListFindingTypeStatsRequest(), + {}, ], ) def test_list_finding_type_stats(request_type, transport: str = "grpc"): @@ -5358,7 +5376,7 @@ def test_list_finding_type_stats(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5403,9 +5421,10 @@ def test_list_finding_type_stats_non_empty_request_with_auto_populated_field(): client.list_finding_type_stats(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == web_security_scanner.ListFindingTypeStatsRequest( + request_msg = web_security_scanner.ListFindingTypeStatsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_list_finding_type_stats_use_cached_wrapped_rpc(): @@ -5491,9 +5510,15 @@ async def test_list_finding_type_stats_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + web_security_scanner.ListFindingTypeStatsRequest(), + {}, + ], +) async def test_list_finding_type_stats_async( - transport: str = "grpc_asyncio", - request_type=web_security_scanner.ListFindingTypeStatsRequest, + request_type, transport: str = "grpc_asyncio" ): client = WebSecurityScannerAsyncClient( credentials=async_anonymous_credentials(), @@ -5502,7 +5527,7 @@ async def test_list_finding_type_stats_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( @@ -5524,11 +5549,6 @@ async def test_list_finding_type_stats_async( assert isinstance(response, web_security_scanner.ListFindingTypeStatsResponse) -@pytest.mark.asyncio -async def test_list_finding_type_stats_async_from_dict(): - await test_list_finding_type_stats_async(request_type=dict) - - def test_list_finding_type_stats_field_headers(): client = WebSecurityScannerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6464,7 +6484,6 @@ def test_create_scan_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.CreateScanConfigRequest() - assert args[0] == request_msg @@ -6487,7 +6506,6 @@ def test_delete_scan_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.DeleteScanConfigRequest() - assert args[0] == request_msg @@ -6508,7 +6526,6 @@ def test_get_scan_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.GetScanConfigRequest() - assert args[0] == request_msg @@ -6531,7 +6548,6 @@ def test_list_scan_configs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.ListScanConfigsRequest() - assert args[0] == request_msg @@ -6554,7 +6570,6 @@ def test_update_scan_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.UpdateScanConfigRequest() - assert args[0] == request_msg @@ -6575,7 +6590,6 @@ def test_start_scan_run_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.StartScanRunRequest() - assert args[0] == request_msg @@ -6596,7 +6610,6 @@ def test_get_scan_run_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.GetScanRunRequest() - assert args[0] == request_msg @@ -6617,7 +6630,6 @@ def test_list_scan_runs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.ListScanRunsRequest() - assert args[0] == request_msg @@ -6638,7 +6650,6 @@ def test_stop_scan_run_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.StopScanRunRequest() - assert args[0] == request_msg @@ -6661,7 +6672,6 @@ def test_list_crawled_urls_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.ListCrawledUrlsRequest() - assert args[0] == request_msg @@ -6682,7 +6692,6 @@ def test_get_finding_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.GetFindingRequest() - assert args[0] == request_msg @@ -6703,7 +6712,6 @@ def test_list_findings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.ListFindingsRequest() - assert args[0] == request_msg @@ -6726,7 +6734,6 @@ def test_list_finding_type_stats_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.ListFindingTypeStatsRequest() - assert args[0] == request_msg @@ -6779,7 +6786,6 @@ async def test_create_scan_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.CreateScanConfigRequest() - assert args[0] == request_msg @@ -6804,7 +6810,6 @@ async def test_delete_scan_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.DeleteScanConfigRequest() - assert args[0] == request_msg @@ -6841,7 +6846,6 @@ async def test_get_scan_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.GetScanConfigRequest() - assert args[0] == request_msg @@ -6870,7 +6874,6 @@ async def test_list_scan_configs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.ListScanConfigsRequest() - assert args[0] == request_msg @@ -6909,7 +6912,6 @@ async def test_update_scan_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.UpdateScanConfigRequest() - assert args[0] == request_msg @@ -6942,7 +6944,6 @@ async def test_start_scan_run_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.StartScanRunRequest() - assert args[0] == request_msg @@ -6975,7 +6976,6 @@ async def test_get_scan_run_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.GetScanRunRequest() - assert args[0] == request_msg @@ -7002,7 +7002,6 @@ async def test_list_scan_runs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.ListScanRunsRequest() - assert args[0] == request_msg @@ -7035,7 +7034,6 @@ async def test_stop_scan_run_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.StopScanRunRequest() - assert args[0] == request_msg @@ -7064,7 +7062,6 @@ async def test_list_crawled_urls_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.ListCrawledUrlsRequest() - assert args[0] == request_msg @@ -7101,7 +7098,6 @@ async def test_get_finding_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.GetFindingRequest() - assert args[0] == request_msg @@ -7128,7 +7124,6 @@ async def test_list_findings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.ListFindingsRequest() - assert args[0] == request_msg @@ -7155,7 +7150,6 @@ async def test_list_finding_type_stats_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.ListFindingTypeStatsRequest() - assert args[0] == request_msg @@ -9232,7 +9226,6 @@ def test_create_scan_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.CreateScanConfigRequest() - assert args[0] == request_msg @@ -9254,7 +9247,6 @@ def test_delete_scan_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.DeleteScanConfigRequest() - assert args[0] == request_msg @@ -9274,7 +9266,6 @@ def test_get_scan_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.GetScanConfigRequest() - assert args[0] == request_msg @@ -9296,7 +9287,6 @@ def test_list_scan_configs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.ListScanConfigsRequest() - assert args[0] == request_msg @@ -9318,7 +9308,6 @@ def test_update_scan_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.UpdateScanConfigRequest() - assert args[0] == request_msg @@ -9338,7 +9327,6 @@ def test_start_scan_run_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.StartScanRunRequest() - assert args[0] == request_msg @@ -9358,7 +9346,6 @@ def test_get_scan_run_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.GetScanRunRequest() - assert args[0] == request_msg @@ -9378,7 +9365,6 @@ def test_list_scan_runs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.ListScanRunsRequest() - assert args[0] == request_msg @@ -9398,7 +9384,6 @@ def test_stop_scan_run_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.StopScanRunRequest() - assert args[0] == request_msg @@ -9420,7 +9405,6 @@ def test_list_crawled_urls_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.ListCrawledUrlsRequest() - assert args[0] == request_msg @@ -9440,7 +9424,6 @@ def test_get_finding_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.GetFindingRequest() - assert args[0] == request_msg @@ -9460,7 +9443,6 @@ def test_list_findings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.ListFindingsRequest() - assert args[0] == request_msg @@ -9482,7 +9464,6 @@ def test_list_finding_type_stats_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.ListFindingTypeStatsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-websecurityscanner/tests/unit/gapic/websecurityscanner_v1alpha/test_web_security_scanner.py b/packages/google-cloud-websecurityscanner/tests/unit/gapic/websecurityscanner_v1alpha/test_web_security_scanner.py index 5db630a7ef3f..f3766a3ac65f 100644 --- a/packages/google-cloud-websecurityscanner/tests/unit/gapic/websecurityscanner_v1alpha/test_web_security_scanner.py +++ b/packages/google-cloud-websecurityscanner/tests/unit/gapic/websecurityscanner_v1alpha/test_web_security_scanner.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 @@ -118,6 +119,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" @@ -1363,8 +1379,8 @@ def test_web_security_scanner_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - web_security_scanner.CreateScanConfigRequest, - dict, + web_security_scanner.CreateScanConfigRequest(), + {}, ], ) def test_create_scan_config(request_type, transport: str = "grpc"): @@ -1375,7 +1391,7 @@ def test_create_scan_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( @@ -1437,9 +1453,10 @@ def test_create_scan_config_non_empty_request_with_auto_populated_field(): client.create_scan_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == web_security_scanner.CreateScanConfigRequest( + request_msg = web_security_scanner.CreateScanConfigRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_scan_config_use_cached_wrapped_rpc(): @@ -1524,10 +1541,14 @@ async def test_create_scan_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_scan_config_async( - transport: str = "grpc_asyncio", - request_type=web_security_scanner.CreateScanConfigRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + web_security_scanner.CreateScanConfigRequest(), + {}, + ], +) +async def test_create_scan_config_async(request_type, transport: str = "grpc_asyncio"): client = WebSecurityScannerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1535,7 +1556,7 @@ async def test_create_scan_config_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( @@ -1574,11 +1595,6 @@ async def test_create_scan_config_async( ] -@pytest.mark.asyncio -async def test_create_scan_config_async_from_dict(): - await test_create_scan_config_async(request_type=dict) - - def test_create_scan_config_field_headers(): client = WebSecurityScannerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1743,8 +1759,8 @@ async def test_create_scan_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - web_security_scanner.DeleteScanConfigRequest, - dict, + web_security_scanner.DeleteScanConfigRequest(), + {}, ], ) def test_delete_scan_config(request_type, transport: str = "grpc"): @@ -1755,7 +1771,7 @@ def test_delete_scan_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( @@ -1800,9 +1816,10 @@ def test_delete_scan_config_non_empty_request_with_auto_populated_field(): client.delete_scan_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == web_security_scanner.DeleteScanConfigRequest( + request_msg = web_security_scanner.DeleteScanConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_scan_config_use_cached_wrapped_rpc(): @@ -1887,10 +1904,14 @@ async def test_delete_scan_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_scan_config_async( - transport: str = "grpc_asyncio", - request_type=web_security_scanner.DeleteScanConfigRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + web_security_scanner.DeleteScanConfigRequest(), + {}, + ], +) +async def test_delete_scan_config_async(request_type, transport: str = "grpc_asyncio"): client = WebSecurityScannerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1898,7 +1919,7 @@ async def test_delete_scan_config_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( @@ -1918,11 +1939,6 @@ async def test_delete_scan_config_async( assert response is None -@pytest.mark.asyncio -async def test_delete_scan_config_async_from_dict(): - await test_delete_scan_config_async(request_type=dict) - - def test_delete_scan_config_field_headers(): client = WebSecurityScannerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2073,8 +2089,8 @@ async def test_delete_scan_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - web_security_scanner.GetScanConfigRequest, - dict, + web_security_scanner.GetScanConfigRequest(), + {}, ], ) def test_get_scan_config(request_type, transport: str = "grpc"): @@ -2085,7 +2101,7 @@ def test_get_scan_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(type(client.transport.get_scan_config), "__call__") as call: @@ -2143,9 +2159,10 @@ def test_get_scan_config_non_empty_request_with_auto_populated_field(): client.get_scan_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == web_security_scanner.GetScanConfigRequest( + request_msg = web_security_scanner.GetScanConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_scan_config_use_cached_wrapped_rpc(): @@ -2226,10 +2243,14 @@ async def test_get_scan_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_scan_config_async( - transport: str = "grpc_asyncio", - request_type=web_security_scanner.GetScanConfigRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + web_security_scanner.GetScanConfigRequest(), + {}, + ], +) +async def test_get_scan_config_async(request_type, transport: str = "grpc_asyncio"): client = WebSecurityScannerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2237,7 +2258,7 @@ async def test_get_scan_config_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_scan_config), "__call__") as call: @@ -2274,11 +2295,6 @@ async def test_get_scan_config_async( ] -@pytest.mark.asyncio -async def test_get_scan_config_async_from_dict(): - await test_get_scan_config_async(request_type=dict) - - def test_get_scan_config_field_headers(): client = WebSecurityScannerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2425,8 +2441,8 @@ async def test_get_scan_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - web_security_scanner.ListScanConfigsRequest, - dict, + web_security_scanner.ListScanConfigsRequest(), + {}, ], ) def test_list_scan_configs(request_type, transport: str = "grpc"): @@ -2437,7 +2453,7 @@ def test_list_scan_configs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2486,10 +2502,11 @@ def test_list_scan_configs_non_empty_request_with_auto_populated_field(): client.list_scan_configs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == web_security_scanner.ListScanConfigsRequest( + request_msg = web_security_scanner.ListScanConfigsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_scan_configs_use_cached_wrapped_rpc(): @@ -2572,10 +2589,14 @@ async def test_list_scan_configs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_scan_configs_async( - transport: str = "grpc_asyncio", - request_type=web_security_scanner.ListScanConfigsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + web_security_scanner.ListScanConfigsRequest(), + {}, + ], +) +async def test_list_scan_configs_async(request_type, transport: str = "grpc_asyncio"): client = WebSecurityScannerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2583,7 +2604,7 @@ async def test_list_scan_configs_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( @@ -2608,11 +2629,6 @@ async def test_list_scan_configs_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_scan_configs_async_from_dict(): - await test_list_scan_configs_async(request_type=dict) - - def test_list_scan_configs_field_headers(): client = WebSecurityScannerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2965,8 +2981,8 @@ async def test_list_scan_configs_async_pages(): @pytest.mark.parametrize( "request_type", [ - web_security_scanner.UpdateScanConfigRequest, - dict, + web_security_scanner.UpdateScanConfigRequest(), + {}, ], ) def test_update_scan_config(request_type, transport: str = "grpc"): @@ -2977,7 +2993,7 @@ def test_update_scan_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( @@ -3037,7 +3053,8 @@ def test_update_scan_config_non_empty_request_with_auto_populated_field(): client.update_scan_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == web_security_scanner.UpdateScanConfigRequest() + request_msg = web_security_scanner.UpdateScanConfigRequest() + assert args[0] == request_msg def test_update_scan_config_use_cached_wrapped_rpc(): @@ -3122,10 +3139,14 @@ async def test_update_scan_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_scan_config_async( - transport: str = "grpc_asyncio", - request_type=web_security_scanner.UpdateScanConfigRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + web_security_scanner.UpdateScanConfigRequest(), + {}, + ], +) +async def test_update_scan_config_async(request_type, transport: str = "grpc_asyncio"): client = WebSecurityScannerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3133,7 +3154,7 @@ async def test_update_scan_config_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( @@ -3172,11 +3193,6 @@ async def test_update_scan_config_async( ] -@pytest.mark.asyncio -async def test_update_scan_config_async_from_dict(): - await test_update_scan_config_async(request_type=dict) - - def test_update_scan_config_field_headers(): client = WebSecurityScannerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3341,8 +3357,8 @@ async def test_update_scan_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - web_security_scanner.StartScanRunRequest, - dict, + web_security_scanner.StartScanRunRequest(), + {}, ], ) def test_start_scan_run(request_type, transport: str = "grpc"): @@ -3353,7 +3369,7 @@ def test_start_scan_run(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.start_scan_run), "__call__") as call: @@ -3409,9 +3425,10 @@ def test_start_scan_run_non_empty_request_with_auto_populated_field(): client.start_scan_run(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == web_security_scanner.StartScanRunRequest( + request_msg = web_security_scanner.StartScanRunRequest( name="name_value", ) + assert args[0] == request_msg def test_start_scan_run_use_cached_wrapped_rpc(): @@ -3492,10 +3509,14 @@ async def test_start_scan_run_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_start_scan_run_async( - transport: str = "grpc_asyncio", - request_type=web_security_scanner.StartScanRunRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + web_security_scanner.StartScanRunRequest(), + {}, + ], +) +async def test_start_scan_run_async(request_type, transport: str = "grpc_asyncio"): client = WebSecurityScannerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3503,7 +3524,7 @@ async def test_start_scan_run_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.start_scan_run), "__call__") as call: @@ -3538,11 +3559,6 @@ async def test_start_scan_run_async( assert response.progress_percent == 1733 -@pytest.mark.asyncio -async def test_start_scan_run_async_from_dict(): - await test_start_scan_run_async(request_type=dict) - - def test_start_scan_run_field_headers(): client = WebSecurityScannerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3685,8 +3701,8 @@ async def test_start_scan_run_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - web_security_scanner.GetScanRunRequest, - dict, + web_security_scanner.GetScanRunRequest(), + {}, ], ) def test_get_scan_run(request_type, transport: str = "grpc"): @@ -3697,7 +3713,7 @@ def test_get_scan_run(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_scan_run), "__call__") as call: @@ -3753,9 +3769,10 @@ def test_get_scan_run_non_empty_request_with_auto_populated_field(): client.get_scan_run(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == web_security_scanner.GetScanRunRequest( + request_msg = web_security_scanner.GetScanRunRequest( name="name_value", ) + assert args[0] == request_msg def test_get_scan_run_use_cached_wrapped_rpc(): @@ -3836,9 +3853,14 @@ async def test_get_scan_run_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_scan_run_async( - transport: str = "grpc_asyncio", request_type=web_security_scanner.GetScanRunRequest -): +@pytest.mark.parametrize( + "request_type", + [ + web_security_scanner.GetScanRunRequest(), + {}, + ], +) +async def test_get_scan_run_async(request_type, transport: str = "grpc_asyncio"): client = WebSecurityScannerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3846,7 +3868,7 @@ async def test_get_scan_run_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_scan_run), "__call__") as call: @@ -3881,11 +3903,6 @@ async def test_get_scan_run_async( assert response.progress_percent == 1733 -@pytest.mark.asyncio -async def test_get_scan_run_async_from_dict(): - await test_get_scan_run_async(request_type=dict) - - def test_get_scan_run_field_headers(): client = WebSecurityScannerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4028,8 +4045,8 @@ async def test_get_scan_run_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - web_security_scanner.ListScanRunsRequest, - dict, + web_security_scanner.ListScanRunsRequest(), + {}, ], ) def test_list_scan_runs(request_type, transport: str = "grpc"): @@ -4040,7 +4057,7 @@ def test_list_scan_runs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_scan_runs), "__call__") as call: @@ -4085,10 +4102,11 @@ def test_list_scan_runs_non_empty_request_with_auto_populated_field(): client.list_scan_runs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == web_security_scanner.ListScanRunsRequest( + request_msg = web_security_scanner.ListScanRunsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_scan_runs_use_cached_wrapped_rpc(): @@ -4169,10 +4187,14 @@ async def test_list_scan_runs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_scan_runs_async( - transport: str = "grpc_asyncio", - request_type=web_security_scanner.ListScanRunsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + web_security_scanner.ListScanRunsRequest(), + {}, + ], +) +async def test_list_scan_runs_async(request_type, transport: str = "grpc_asyncio"): client = WebSecurityScannerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4180,7 +4202,7 @@ async def test_list_scan_runs_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_scan_runs), "__call__") as call: @@ -4203,11 +4225,6 @@ async def test_list_scan_runs_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_scan_runs_async_from_dict(): - await test_list_scan_runs_async(request_type=dict) - - def test_list_scan_runs_field_headers(): client = WebSecurityScannerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4544,8 +4561,8 @@ async def test_list_scan_runs_async_pages(): @pytest.mark.parametrize( "request_type", [ - web_security_scanner.StopScanRunRequest, - dict, + web_security_scanner.StopScanRunRequest(), + {}, ], ) def test_stop_scan_run(request_type, transport: str = "grpc"): @@ -4556,7 +4573,7 @@ def test_stop_scan_run(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.stop_scan_run), "__call__") as call: @@ -4612,9 +4629,10 @@ def test_stop_scan_run_non_empty_request_with_auto_populated_field(): client.stop_scan_run(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == web_security_scanner.StopScanRunRequest( + request_msg = web_security_scanner.StopScanRunRequest( name="name_value", ) + assert args[0] == request_msg def test_stop_scan_run_use_cached_wrapped_rpc(): @@ -4695,10 +4713,14 @@ async def test_stop_scan_run_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_stop_scan_run_async( - transport: str = "grpc_asyncio", - request_type=web_security_scanner.StopScanRunRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + web_security_scanner.StopScanRunRequest(), + {}, + ], +) +async def test_stop_scan_run_async(request_type, transport: str = "grpc_asyncio"): client = WebSecurityScannerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4706,7 +4728,7 @@ async def test_stop_scan_run_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.stop_scan_run), "__call__") as call: @@ -4741,11 +4763,6 @@ async def test_stop_scan_run_async( assert response.progress_percent == 1733 -@pytest.mark.asyncio -async def test_stop_scan_run_async_from_dict(): - await test_stop_scan_run_async(request_type=dict) - - def test_stop_scan_run_field_headers(): client = WebSecurityScannerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4888,8 +4905,8 @@ async def test_stop_scan_run_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - web_security_scanner.ListCrawledUrlsRequest, - dict, + web_security_scanner.ListCrawledUrlsRequest(), + {}, ], ) def test_list_crawled_urls(request_type, transport: str = "grpc"): @@ -4900,7 +4917,7 @@ def test_list_crawled_urls(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4949,10 +4966,11 @@ def test_list_crawled_urls_non_empty_request_with_auto_populated_field(): client.list_crawled_urls(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == web_security_scanner.ListCrawledUrlsRequest( + request_msg = web_security_scanner.ListCrawledUrlsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_crawled_urls_use_cached_wrapped_rpc(): @@ -5035,10 +5053,14 @@ async def test_list_crawled_urls_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_crawled_urls_async( - transport: str = "grpc_asyncio", - request_type=web_security_scanner.ListCrawledUrlsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + web_security_scanner.ListCrawledUrlsRequest(), + {}, + ], +) +async def test_list_crawled_urls_async(request_type, transport: str = "grpc_asyncio"): client = WebSecurityScannerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5046,7 +5068,7 @@ async def test_list_crawled_urls_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( @@ -5071,11 +5093,6 @@ async def test_list_crawled_urls_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_crawled_urls_async_from_dict(): - await test_list_crawled_urls_async(request_type=dict) - - def test_list_crawled_urls_field_headers(): client = WebSecurityScannerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5428,8 +5445,8 @@ async def test_list_crawled_urls_async_pages(): @pytest.mark.parametrize( "request_type", [ - web_security_scanner.GetFindingRequest, - dict, + web_security_scanner.GetFindingRequest(), + {}, ], ) def test_get_finding(request_type, transport: str = "grpc"): @@ -5440,7 +5457,7 @@ def test_get_finding(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_finding), "__call__") as call: @@ -5502,9 +5519,10 @@ def test_get_finding_non_empty_request_with_auto_populated_field(): client.get_finding(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == web_security_scanner.GetFindingRequest( + request_msg = web_security_scanner.GetFindingRequest( name="name_value", ) + assert args[0] == request_msg def test_get_finding_use_cached_wrapped_rpc(): @@ -5585,9 +5603,14 @@ async def test_get_finding_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_finding_async( - transport: str = "grpc_asyncio", request_type=web_security_scanner.GetFindingRequest -): +@pytest.mark.parametrize( + "request_type", + [ + web_security_scanner.GetFindingRequest(), + {}, + ], +) +async def test_get_finding_async(request_type, transport: str = "grpc_asyncio"): client = WebSecurityScannerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5595,7 +5618,7 @@ async def test_get_finding_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_finding), "__call__") as call: @@ -5636,11 +5659,6 @@ async def test_get_finding_async( assert response.tracking_id == "tracking_id_value" -@pytest.mark.asyncio -async def test_get_finding_async_from_dict(): - await test_get_finding_async(request_type=dict) - - def test_get_finding_field_headers(): client = WebSecurityScannerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5783,8 +5801,8 @@ async def test_get_finding_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - web_security_scanner.ListFindingsRequest, - dict, + web_security_scanner.ListFindingsRequest(), + {}, ], ) def test_list_findings(request_type, transport: str = "grpc"): @@ -5795,7 +5813,7 @@ def test_list_findings(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_findings), "__call__") as call: @@ -5841,11 +5859,12 @@ def test_list_findings_non_empty_request_with_auto_populated_field(): client.list_findings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == web_security_scanner.ListFindingsRequest( + request_msg = web_security_scanner.ListFindingsRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_findings_use_cached_wrapped_rpc(): @@ -5926,10 +5945,14 @@ async def test_list_findings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_findings_async( - transport: str = "grpc_asyncio", - request_type=web_security_scanner.ListFindingsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + web_security_scanner.ListFindingsRequest(), + {}, + ], +) +async def test_list_findings_async(request_type, transport: str = "grpc_asyncio"): client = WebSecurityScannerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5937,7 +5960,7 @@ async def test_list_findings_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_findings), "__call__") as call: @@ -5960,11 +5983,6 @@ async def test_list_findings_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_findings_async_from_dict(): - await test_list_findings_async(request_type=dict) - - def test_list_findings_field_headers(): client = WebSecurityScannerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6311,8 +6329,8 @@ async def test_list_findings_async_pages(): @pytest.mark.parametrize( "request_type", [ - web_security_scanner.ListFindingTypeStatsRequest, - dict, + web_security_scanner.ListFindingTypeStatsRequest(), + {}, ], ) def test_list_finding_type_stats(request_type, transport: str = "grpc"): @@ -6323,7 +6341,7 @@ def test_list_finding_type_stats(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6368,9 +6386,10 @@ def test_list_finding_type_stats_non_empty_request_with_auto_populated_field(): client.list_finding_type_stats(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == web_security_scanner.ListFindingTypeStatsRequest( + request_msg = web_security_scanner.ListFindingTypeStatsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_list_finding_type_stats_use_cached_wrapped_rpc(): @@ -6456,9 +6475,15 @@ async def test_list_finding_type_stats_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + web_security_scanner.ListFindingTypeStatsRequest(), + {}, + ], +) async def test_list_finding_type_stats_async( - transport: str = "grpc_asyncio", - request_type=web_security_scanner.ListFindingTypeStatsRequest, + request_type, transport: str = "grpc_asyncio" ): client = WebSecurityScannerAsyncClient( credentials=async_anonymous_credentials(), @@ -6467,7 +6492,7 @@ async def test_list_finding_type_stats_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( @@ -6489,11 +6514,6 @@ async def test_list_finding_type_stats_async( assert isinstance(response, web_security_scanner.ListFindingTypeStatsResponse) -@pytest.mark.asyncio -async def test_list_finding_type_stats_async_from_dict(): - await test_list_finding_type_stats_async(request_type=dict) - - def test_list_finding_type_stats_field_headers(): client = WebSecurityScannerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9472,7 +9492,6 @@ def test_create_scan_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.CreateScanConfigRequest() - assert args[0] == request_msg @@ -9495,7 +9514,6 @@ def test_delete_scan_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.DeleteScanConfigRequest() - assert args[0] == request_msg @@ -9516,7 +9534,6 @@ def test_get_scan_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.GetScanConfigRequest() - assert args[0] == request_msg @@ -9539,7 +9556,6 @@ def test_list_scan_configs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.ListScanConfigsRequest() - assert args[0] == request_msg @@ -9562,7 +9578,6 @@ def test_update_scan_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.UpdateScanConfigRequest() - assert args[0] == request_msg @@ -9583,7 +9598,6 @@ def test_start_scan_run_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.StartScanRunRequest() - assert args[0] == request_msg @@ -9604,7 +9618,6 @@ def test_get_scan_run_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.GetScanRunRequest() - assert args[0] == request_msg @@ -9625,7 +9638,6 @@ def test_list_scan_runs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.ListScanRunsRequest() - assert args[0] == request_msg @@ -9646,7 +9658,6 @@ def test_stop_scan_run_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.StopScanRunRequest() - assert args[0] == request_msg @@ -9669,7 +9680,6 @@ def test_list_crawled_urls_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.ListCrawledUrlsRequest() - assert args[0] == request_msg @@ -9690,7 +9700,6 @@ def test_get_finding_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.GetFindingRequest() - assert args[0] == request_msg @@ -9711,7 +9720,6 @@ def test_list_findings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.ListFindingsRequest() - assert args[0] == request_msg @@ -9734,7 +9742,6 @@ def test_list_finding_type_stats_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.ListFindingTypeStatsRequest() - assert args[0] == request_msg @@ -9783,7 +9790,6 @@ async def test_create_scan_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.CreateScanConfigRequest() - assert args[0] == request_msg @@ -9808,7 +9814,6 @@ async def test_delete_scan_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.DeleteScanConfigRequest() - assert args[0] == request_msg @@ -9841,7 +9846,6 @@ async def test_get_scan_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.GetScanConfigRequest() - assert args[0] == request_msg @@ -9870,7 +9874,6 @@ async def test_list_scan_configs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.ListScanConfigsRequest() - assert args[0] == request_msg @@ -9905,7 +9908,6 @@ async def test_update_scan_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.UpdateScanConfigRequest() - assert args[0] == request_msg @@ -9938,7 +9940,6 @@ async def test_start_scan_run_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.StartScanRunRequest() - assert args[0] == request_msg @@ -9971,7 +9972,6 @@ async def test_get_scan_run_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.GetScanRunRequest() - assert args[0] == request_msg @@ -9998,7 +9998,6 @@ async def test_list_scan_runs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.ListScanRunsRequest() - assert args[0] == request_msg @@ -10031,7 +10030,6 @@ async def test_stop_scan_run_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.StopScanRunRequest() - assert args[0] == request_msg @@ -10060,7 +10058,6 @@ async def test_list_crawled_urls_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.ListCrawledUrlsRequest() - assert args[0] == request_msg @@ -10096,7 +10093,6 @@ async def test_get_finding_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.GetFindingRequest() - assert args[0] == request_msg @@ -10123,7 +10119,6 @@ async def test_list_findings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.ListFindingsRequest() - assert args[0] == request_msg @@ -10150,7 +10145,6 @@ async def test_list_finding_type_stats_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.ListFindingTypeStatsRequest() - assert args[0] == request_msg @@ -12202,7 +12196,6 @@ def test_create_scan_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.CreateScanConfigRequest() - assert args[0] == request_msg @@ -12224,7 +12217,6 @@ def test_delete_scan_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.DeleteScanConfigRequest() - assert args[0] == request_msg @@ -12244,7 +12236,6 @@ def test_get_scan_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.GetScanConfigRequest() - assert args[0] == request_msg @@ -12266,7 +12257,6 @@ def test_list_scan_configs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.ListScanConfigsRequest() - assert args[0] == request_msg @@ -12288,7 +12278,6 @@ def test_update_scan_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.UpdateScanConfigRequest() - assert args[0] == request_msg @@ -12308,7 +12297,6 @@ def test_start_scan_run_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.StartScanRunRequest() - assert args[0] == request_msg @@ -12328,7 +12316,6 @@ def test_get_scan_run_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.GetScanRunRequest() - assert args[0] == request_msg @@ -12348,7 +12335,6 @@ def test_list_scan_runs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.ListScanRunsRequest() - assert args[0] == request_msg @@ -12368,7 +12354,6 @@ def test_stop_scan_run_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.StopScanRunRequest() - assert args[0] == request_msg @@ -12390,7 +12375,6 @@ def test_list_crawled_urls_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.ListCrawledUrlsRequest() - assert args[0] == request_msg @@ -12410,7 +12394,6 @@ def test_get_finding_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.GetFindingRequest() - assert args[0] == request_msg @@ -12430,7 +12413,6 @@ def test_list_findings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.ListFindingsRequest() - assert args[0] == request_msg @@ -12452,7 +12434,6 @@ def test_list_finding_type_stats_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.ListFindingTypeStatsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-websecurityscanner/tests/unit/gapic/websecurityscanner_v1beta/test_web_security_scanner.py b/packages/google-cloud-websecurityscanner/tests/unit/gapic/websecurityscanner_v1beta/test_web_security_scanner.py index fdecb61d068e..c8ea1922d352 100644 --- a/packages/google-cloud-websecurityscanner/tests/unit/gapic/websecurityscanner_v1beta/test_web_security_scanner.py +++ b/packages/google-cloud-websecurityscanner/tests/unit/gapic/websecurityscanner_v1beta/test_web_security_scanner.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 @@ -121,6 +122,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" @@ -1366,8 +1382,8 @@ def test_web_security_scanner_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - web_security_scanner.CreateScanConfigRequest, - dict, + web_security_scanner.CreateScanConfigRequest(), + {}, ], ) def test_create_scan_config(request_type, transport: str = "grpc"): @@ -1378,7 +1394,7 @@ def test_create_scan_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( @@ -1447,9 +1463,10 @@ def test_create_scan_config_non_empty_request_with_auto_populated_field(): client.create_scan_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == web_security_scanner.CreateScanConfigRequest( + request_msg = web_security_scanner.CreateScanConfigRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_scan_config_use_cached_wrapped_rpc(): @@ -1534,10 +1551,14 @@ async def test_create_scan_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_scan_config_async( - transport: str = "grpc_asyncio", - request_type=web_security_scanner.CreateScanConfigRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + web_security_scanner.CreateScanConfigRequest(), + {}, + ], +) +async def test_create_scan_config_async(request_type, transport: str = "grpc_asyncio"): client = WebSecurityScannerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1545,7 +1566,7 @@ async def test_create_scan_config_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( @@ -1591,11 +1612,6 @@ async def test_create_scan_config_async( assert response.risk_level == gcw_scan_config.ScanConfig.RiskLevel.NORMAL -@pytest.mark.asyncio -async def test_create_scan_config_async_from_dict(): - await test_create_scan_config_async(request_type=dict) - - def test_create_scan_config_field_headers(): client = WebSecurityScannerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1760,8 +1776,8 @@ async def test_create_scan_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - web_security_scanner.DeleteScanConfigRequest, - dict, + web_security_scanner.DeleteScanConfigRequest(), + {}, ], ) def test_delete_scan_config(request_type, transport: str = "grpc"): @@ -1772,7 +1788,7 @@ def test_delete_scan_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( @@ -1817,9 +1833,10 @@ def test_delete_scan_config_non_empty_request_with_auto_populated_field(): client.delete_scan_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == web_security_scanner.DeleteScanConfigRequest( + request_msg = web_security_scanner.DeleteScanConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_scan_config_use_cached_wrapped_rpc(): @@ -1904,10 +1921,14 @@ async def test_delete_scan_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_scan_config_async( - transport: str = "grpc_asyncio", - request_type=web_security_scanner.DeleteScanConfigRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + web_security_scanner.DeleteScanConfigRequest(), + {}, + ], +) +async def test_delete_scan_config_async(request_type, transport: str = "grpc_asyncio"): client = WebSecurityScannerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1915,7 +1936,7 @@ async def test_delete_scan_config_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( @@ -1935,11 +1956,6 @@ async def test_delete_scan_config_async( assert response is None -@pytest.mark.asyncio -async def test_delete_scan_config_async_from_dict(): - await test_delete_scan_config_async(request_type=dict) - - def test_delete_scan_config_field_headers(): client = WebSecurityScannerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2090,8 +2106,8 @@ async def test_delete_scan_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - web_security_scanner.GetScanConfigRequest, - dict, + web_security_scanner.GetScanConfigRequest(), + {}, ], ) def test_get_scan_config(request_type, transport: str = "grpc"): @@ -2102,7 +2118,7 @@ def test_get_scan_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(type(client.transport.get_scan_config), "__call__") as call: @@ -2167,9 +2183,10 @@ def test_get_scan_config_non_empty_request_with_auto_populated_field(): client.get_scan_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == web_security_scanner.GetScanConfigRequest( + request_msg = web_security_scanner.GetScanConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_scan_config_use_cached_wrapped_rpc(): @@ -2250,10 +2267,14 @@ async def test_get_scan_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_scan_config_async( - transport: str = "grpc_asyncio", - request_type=web_security_scanner.GetScanConfigRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + web_security_scanner.GetScanConfigRequest(), + {}, + ], +) +async def test_get_scan_config_async(request_type, transport: str = "grpc_asyncio"): client = WebSecurityScannerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2261,7 +2282,7 @@ async def test_get_scan_config_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_scan_config), "__call__") as call: @@ -2305,11 +2326,6 @@ async def test_get_scan_config_async( assert response.risk_level == scan_config.ScanConfig.RiskLevel.NORMAL -@pytest.mark.asyncio -async def test_get_scan_config_async_from_dict(): - await test_get_scan_config_async(request_type=dict) - - def test_get_scan_config_field_headers(): client = WebSecurityScannerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2456,8 +2472,8 @@ async def test_get_scan_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - web_security_scanner.ListScanConfigsRequest, - dict, + web_security_scanner.ListScanConfigsRequest(), + {}, ], ) def test_list_scan_configs(request_type, transport: str = "grpc"): @@ -2468,7 +2484,7 @@ def test_list_scan_configs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2517,10 +2533,11 @@ def test_list_scan_configs_non_empty_request_with_auto_populated_field(): client.list_scan_configs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == web_security_scanner.ListScanConfigsRequest( + request_msg = web_security_scanner.ListScanConfigsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_scan_configs_use_cached_wrapped_rpc(): @@ -2603,10 +2620,14 @@ async def test_list_scan_configs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_scan_configs_async( - transport: str = "grpc_asyncio", - request_type=web_security_scanner.ListScanConfigsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + web_security_scanner.ListScanConfigsRequest(), + {}, + ], +) +async def test_list_scan_configs_async(request_type, transport: str = "grpc_asyncio"): client = WebSecurityScannerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2614,7 +2635,7 @@ async def test_list_scan_configs_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( @@ -2639,11 +2660,6 @@ async def test_list_scan_configs_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_scan_configs_async_from_dict(): - await test_list_scan_configs_async(request_type=dict) - - def test_list_scan_configs_field_headers(): client = WebSecurityScannerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2996,8 +3012,8 @@ async def test_list_scan_configs_async_pages(): @pytest.mark.parametrize( "request_type", [ - web_security_scanner.UpdateScanConfigRequest, - dict, + web_security_scanner.UpdateScanConfigRequest(), + {}, ], ) def test_update_scan_config(request_type, transport: str = "grpc"): @@ -3008,7 +3024,7 @@ def test_update_scan_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( @@ -3075,7 +3091,8 @@ def test_update_scan_config_non_empty_request_with_auto_populated_field(): client.update_scan_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == web_security_scanner.UpdateScanConfigRequest() + request_msg = web_security_scanner.UpdateScanConfigRequest() + assert args[0] == request_msg def test_update_scan_config_use_cached_wrapped_rpc(): @@ -3160,10 +3177,14 @@ async def test_update_scan_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_scan_config_async( - transport: str = "grpc_asyncio", - request_type=web_security_scanner.UpdateScanConfigRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + web_security_scanner.UpdateScanConfigRequest(), + {}, + ], +) +async def test_update_scan_config_async(request_type, transport: str = "grpc_asyncio"): client = WebSecurityScannerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3171,7 +3192,7 @@ async def test_update_scan_config_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( @@ -3217,11 +3238,6 @@ async def test_update_scan_config_async( assert response.risk_level == gcw_scan_config.ScanConfig.RiskLevel.NORMAL -@pytest.mark.asyncio -async def test_update_scan_config_async_from_dict(): - await test_update_scan_config_async(request_type=dict) - - def test_update_scan_config_field_headers(): client = WebSecurityScannerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3386,8 +3402,8 @@ async def test_update_scan_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - web_security_scanner.StartScanRunRequest, - dict, + web_security_scanner.StartScanRunRequest(), + {}, ], ) def test_start_scan_run(request_type, transport: str = "grpc"): @@ -3398,7 +3414,7 @@ def test_start_scan_run(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.start_scan_run), "__call__") as call: @@ -3454,9 +3470,10 @@ def test_start_scan_run_non_empty_request_with_auto_populated_field(): client.start_scan_run(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == web_security_scanner.StartScanRunRequest( + request_msg = web_security_scanner.StartScanRunRequest( name="name_value", ) + assert args[0] == request_msg def test_start_scan_run_use_cached_wrapped_rpc(): @@ -3537,10 +3554,14 @@ async def test_start_scan_run_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_start_scan_run_async( - transport: str = "grpc_asyncio", - request_type=web_security_scanner.StartScanRunRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + web_security_scanner.StartScanRunRequest(), + {}, + ], +) +async def test_start_scan_run_async(request_type, transport: str = "grpc_asyncio"): client = WebSecurityScannerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3548,7 +3569,7 @@ async def test_start_scan_run_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.start_scan_run), "__call__") as call: @@ -3583,11 +3604,6 @@ async def test_start_scan_run_async( assert response.progress_percent == 1733 -@pytest.mark.asyncio -async def test_start_scan_run_async_from_dict(): - await test_start_scan_run_async(request_type=dict) - - def test_start_scan_run_field_headers(): client = WebSecurityScannerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3730,8 +3746,8 @@ async def test_start_scan_run_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - web_security_scanner.GetScanRunRequest, - dict, + web_security_scanner.GetScanRunRequest(), + {}, ], ) def test_get_scan_run(request_type, transport: str = "grpc"): @@ -3742,7 +3758,7 @@ def test_get_scan_run(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_scan_run), "__call__") as call: @@ -3798,9 +3814,10 @@ def test_get_scan_run_non_empty_request_with_auto_populated_field(): client.get_scan_run(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == web_security_scanner.GetScanRunRequest( + request_msg = web_security_scanner.GetScanRunRequest( name="name_value", ) + assert args[0] == request_msg def test_get_scan_run_use_cached_wrapped_rpc(): @@ -3881,9 +3898,14 @@ async def test_get_scan_run_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_scan_run_async( - transport: str = "grpc_asyncio", request_type=web_security_scanner.GetScanRunRequest -): +@pytest.mark.parametrize( + "request_type", + [ + web_security_scanner.GetScanRunRequest(), + {}, + ], +) +async def test_get_scan_run_async(request_type, transport: str = "grpc_asyncio"): client = WebSecurityScannerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3891,7 +3913,7 @@ async def test_get_scan_run_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_scan_run), "__call__") as call: @@ -3926,11 +3948,6 @@ async def test_get_scan_run_async( assert response.progress_percent == 1733 -@pytest.mark.asyncio -async def test_get_scan_run_async_from_dict(): - await test_get_scan_run_async(request_type=dict) - - def test_get_scan_run_field_headers(): client = WebSecurityScannerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4073,8 +4090,8 @@ async def test_get_scan_run_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - web_security_scanner.ListScanRunsRequest, - dict, + web_security_scanner.ListScanRunsRequest(), + {}, ], ) def test_list_scan_runs(request_type, transport: str = "grpc"): @@ -4085,7 +4102,7 @@ def test_list_scan_runs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_scan_runs), "__call__") as call: @@ -4130,10 +4147,11 @@ def test_list_scan_runs_non_empty_request_with_auto_populated_field(): client.list_scan_runs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == web_security_scanner.ListScanRunsRequest( + request_msg = web_security_scanner.ListScanRunsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_scan_runs_use_cached_wrapped_rpc(): @@ -4214,10 +4232,14 @@ async def test_list_scan_runs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_scan_runs_async( - transport: str = "grpc_asyncio", - request_type=web_security_scanner.ListScanRunsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + web_security_scanner.ListScanRunsRequest(), + {}, + ], +) +async def test_list_scan_runs_async(request_type, transport: str = "grpc_asyncio"): client = WebSecurityScannerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4225,7 +4247,7 @@ async def test_list_scan_runs_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_scan_runs), "__call__") as call: @@ -4248,11 +4270,6 @@ async def test_list_scan_runs_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_scan_runs_async_from_dict(): - await test_list_scan_runs_async(request_type=dict) - - def test_list_scan_runs_field_headers(): client = WebSecurityScannerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4589,8 +4606,8 @@ async def test_list_scan_runs_async_pages(): @pytest.mark.parametrize( "request_type", [ - web_security_scanner.StopScanRunRequest, - dict, + web_security_scanner.StopScanRunRequest(), + {}, ], ) def test_stop_scan_run(request_type, transport: str = "grpc"): @@ -4601,7 +4618,7 @@ def test_stop_scan_run(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.stop_scan_run), "__call__") as call: @@ -4657,9 +4674,10 @@ def test_stop_scan_run_non_empty_request_with_auto_populated_field(): client.stop_scan_run(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == web_security_scanner.StopScanRunRequest( + request_msg = web_security_scanner.StopScanRunRequest( name="name_value", ) + assert args[0] == request_msg def test_stop_scan_run_use_cached_wrapped_rpc(): @@ -4740,10 +4758,14 @@ async def test_stop_scan_run_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_stop_scan_run_async( - transport: str = "grpc_asyncio", - request_type=web_security_scanner.StopScanRunRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + web_security_scanner.StopScanRunRequest(), + {}, + ], +) +async def test_stop_scan_run_async(request_type, transport: str = "grpc_asyncio"): client = WebSecurityScannerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4751,7 +4773,7 @@ async def test_stop_scan_run_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.stop_scan_run), "__call__") as call: @@ -4786,11 +4808,6 @@ async def test_stop_scan_run_async( assert response.progress_percent == 1733 -@pytest.mark.asyncio -async def test_stop_scan_run_async_from_dict(): - await test_stop_scan_run_async(request_type=dict) - - def test_stop_scan_run_field_headers(): client = WebSecurityScannerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4933,8 +4950,8 @@ async def test_stop_scan_run_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - web_security_scanner.ListCrawledUrlsRequest, - dict, + web_security_scanner.ListCrawledUrlsRequest(), + {}, ], ) def test_list_crawled_urls(request_type, transport: str = "grpc"): @@ -4945,7 +4962,7 @@ def test_list_crawled_urls(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4994,10 +5011,11 @@ def test_list_crawled_urls_non_empty_request_with_auto_populated_field(): client.list_crawled_urls(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == web_security_scanner.ListCrawledUrlsRequest( + request_msg = web_security_scanner.ListCrawledUrlsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_crawled_urls_use_cached_wrapped_rpc(): @@ -5080,10 +5098,14 @@ async def test_list_crawled_urls_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_crawled_urls_async( - transport: str = "grpc_asyncio", - request_type=web_security_scanner.ListCrawledUrlsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + web_security_scanner.ListCrawledUrlsRequest(), + {}, + ], +) +async def test_list_crawled_urls_async(request_type, transport: str = "grpc_asyncio"): client = WebSecurityScannerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5091,7 +5113,7 @@ async def test_list_crawled_urls_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( @@ -5116,11 +5138,6 @@ async def test_list_crawled_urls_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_crawled_urls_async_from_dict(): - await test_list_crawled_urls_async(request_type=dict) - - def test_list_crawled_urls_field_headers(): client = WebSecurityScannerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5473,8 +5490,8 @@ async def test_list_crawled_urls_async_pages(): @pytest.mark.parametrize( "request_type", [ - web_security_scanner.GetFindingRequest, - dict, + web_security_scanner.GetFindingRequest(), + {}, ], ) def test_get_finding(request_type, transport: str = "grpc"): @@ -5485,7 +5502,7 @@ def test_get_finding(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_finding), "__call__") as call: @@ -5547,9 +5564,10 @@ def test_get_finding_non_empty_request_with_auto_populated_field(): client.get_finding(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == web_security_scanner.GetFindingRequest( + request_msg = web_security_scanner.GetFindingRequest( name="name_value", ) + assert args[0] == request_msg def test_get_finding_use_cached_wrapped_rpc(): @@ -5630,9 +5648,14 @@ async def test_get_finding_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_finding_async( - transport: str = "grpc_asyncio", request_type=web_security_scanner.GetFindingRequest -): +@pytest.mark.parametrize( + "request_type", + [ + web_security_scanner.GetFindingRequest(), + {}, + ], +) +async def test_get_finding_async(request_type, transport: str = "grpc_asyncio"): client = WebSecurityScannerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5640,7 +5663,7 @@ async def test_get_finding_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_finding), "__call__") as call: @@ -5681,11 +5704,6 @@ async def test_get_finding_async( assert response.tracking_id == "tracking_id_value" -@pytest.mark.asyncio -async def test_get_finding_async_from_dict(): - await test_get_finding_async(request_type=dict) - - def test_get_finding_field_headers(): client = WebSecurityScannerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5828,8 +5846,8 @@ async def test_get_finding_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - web_security_scanner.ListFindingsRequest, - dict, + web_security_scanner.ListFindingsRequest(), + {}, ], ) def test_list_findings(request_type, transport: str = "grpc"): @@ -5840,7 +5858,7 @@ def test_list_findings(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_findings), "__call__") as call: @@ -5886,11 +5904,12 @@ def test_list_findings_non_empty_request_with_auto_populated_field(): client.list_findings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == web_security_scanner.ListFindingsRequest( + request_msg = web_security_scanner.ListFindingsRequest( parent="parent_value", filter="filter_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_findings_use_cached_wrapped_rpc(): @@ -5971,10 +5990,14 @@ async def test_list_findings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_findings_async( - transport: str = "grpc_asyncio", - request_type=web_security_scanner.ListFindingsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + web_security_scanner.ListFindingsRequest(), + {}, + ], +) +async def test_list_findings_async(request_type, transport: str = "grpc_asyncio"): client = WebSecurityScannerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5982,7 +6005,7 @@ async def test_list_findings_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_findings), "__call__") as call: @@ -6005,11 +6028,6 @@ async def test_list_findings_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_findings_async_from_dict(): - await test_list_findings_async(request_type=dict) - - def test_list_findings_field_headers(): client = WebSecurityScannerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6356,8 +6374,8 @@ async def test_list_findings_async_pages(): @pytest.mark.parametrize( "request_type", [ - web_security_scanner.ListFindingTypeStatsRequest, - dict, + web_security_scanner.ListFindingTypeStatsRequest(), + {}, ], ) def test_list_finding_type_stats(request_type, transport: str = "grpc"): @@ -6368,7 +6386,7 @@ def test_list_finding_type_stats(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6413,9 +6431,10 @@ def test_list_finding_type_stats_non_empty_request_with_auto_populated_field(): client.list_finding_type_stats(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == web_security_scanner.ListFindingTypeStatsRequest( + request_msg = web_security_scanner.ListFindingTypeStatsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_list_finding_type_stats_use_cached_wrapped_rpc(): @@ -6501,9 +6520,15 @@ async def test_list_finding_type_stats_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + web_security_scanner.ListFindingTypeStatsRequest(), + {}, + ], +) async def test_list_finding_type_stats_async( - transport: str = "grpc_asyncio", - request_type=web_security_scanner.ListFindingTypeStatsRequest, + request_type, transport: str = "grpc_asyncio" ): client = WebSecurityScannerAsyncClient( credentials=async_anonymous_credentials(), @@ -6512,7 +6537,7 @@ async def test_list_finding_type_stats_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( @@ -6534,11 +6559,6 @@ async def test_list_finding_type_stats_async( assert isinstance(response, web_security_scanner.ListFindingTypeStatsResponse) -@pytest.mark.asyncio -async def test_list_finding_type_stats_async_from_dict(): - await test_list_finding_type_stats_async(request_type=dict) - - def test_list_finding_type_stats_field_headers(): client = WebSecurityScannerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9517,7 +9537,6 @@ def test_create_scan_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.CreateScanConfigRequest() - assert args[0] == request_msg @@ -9540,7 +9559,6 @@ def test_delete_scan_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.DeleteScanConfigRequest() - assert args[0] == request_msg @@ -9561,7 +9579,6 @@ def test_get_scan_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.GetScanConfigRequest() - assert args[0] == request_msg @@ -9584,7 +9601,6 @@ def test_list_scan_configs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.ListScanConfigsRequest() - assert args[0] == request_msg @@ -9607,7 +9623,6 @@ def test_update_scan_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.UpdateScanConfigRequest() - assert args[0] == request_msg @@ -9628,7 +9643,6 @@ def test_start_scan_run_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.StartScanRunRequest() - assert args[0] == request_msg @@ -9649,7 +9663,6 @@ def test_get_scan_run_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.GetScanRunRequest() - assert args[0] == request_msg @@ -9670,7 +9683,6 @@ def test_list_scan_runs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.ListScanRunsRequest() - assert args[0] == request_msg @@ -9691,7 +9703,6 @@ def test_stop_scan_run_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.StopScanRunRequest() - assert args[0] == request_msg @@ -9714,7 +9725,6 @@ def test_list_crawled_urls_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.ListCrawledUrlsRequest() - assert args[0] == request_msg @@ -9735,7 +9745,6 @@ def test_get_finding_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.GetFindingRequest() - assert args[0] == request_msg @@ -9756,7 +9765,6 @@ def test_list_findings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.ListFindingsRequest() - assert args[0] == request_msg @@ -9779,7 +9787,6 @@ def test_list_finding_type_stats_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.ListFindingTypeStatsRequest() - assert args[0] == request_msg @@ -9830,7 +9837,6 @@ async def test_create_scan_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.CreateScanConfigRequest() - assert args[0] == request_msg @@ -9855,7 +9861,6 @@ async def test_delete_scan_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.DeleteScanConfigRequest() - assert args[0] == request_msg @@ -9890,7 +9895,6 @@ async def test_get_scan_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.GetScanConfigRequest() - assert args[0] == request_msg @@ -9919,7 +9923,6 @@ async def test_list_scan_configs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.ListScanConfigsRequest() - assert args[0] == request_msg @@ -9956,7 +9959,6 @@ async def test_update_scan_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.UpdateScanConfigRequest() - assert args[0] == request_msg @@ -9989,7 +9991,6 @@ async def test_start_scan_run_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.StartScanRunRequest() - assert args[0] == request_msg @@ -10022,7 +10023,6 @@ async def test_get_scan_run_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.GetScanRunRequest() - assert args[0] == request_msg @@ -10049,7 +10049,6 @@ async def test_list_scan_runs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.ListScanRunsRequest() - assert args[0] == request_msg @@ -10082,7 +10081,6 @@ async def test_stop_scan_run_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.StopScanRunRequest() - assert args[0] == request_msg @@ -10111,7 +10109,6 @@ async def test_list_crawled_urls_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.ListCrawledUrlsRequest() - assert args[0] == request_msg @@ -10147,7 +10144,6 @@ async def test_get_finding_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.GetFindingRequest() - assert args[0] == request_msg @@ -10174,7 +10170,6 @@ async def test_list_findings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.ListFindingsRequest() - assert args[0] == request_msg @@ -10201,7 +10196,6 @@ async def test_list_finding_type_stats_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.ListFindingTypeStatsRequest() - assert args[0] == request_msg @@ -12290,7 +12284,6 @@ def test_create_scan_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.CreateScanConfigRequest() - assert args[0] == request_msg @@ -12312,7 +12305,6 @@ def test_delete_scan_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.DeleteScanConfigRequest() - assert args[0] == request_msg @@ -12332,7 +12324,6 @@ def test_get_scan_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.GetScanConfigRequest() - assert args[0] == request_msg @@ -12354,7 +12345,6 @@ def test_list_scan_configs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.ListScanConfigsRequest() - assert args[0] == request_msg @@ -12376,7 +12366,6 @@ def test_update_scan_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.UpdateScanConfigRequest() - assert args[0] == request_msg @@ -12396,7 +12385,6 @@ def test_start_scan_run_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.StartScanRunRequest() - assert args[0] == request_msg @@ -12416,7 +12404,6 @@ def test_get_scan_run_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.GetScanRunRequest() - assert args[0] == request_msg @@ -12436,7 +12423,6 @@ def test_list_scan_runs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.ListScanRunsRequest() - assert args[0] == request_msg @@ -12456,7 +12442,6 @@ def test_stop_scan_run_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.StopScanRunRequest() - assert args[0] == request_msg @@ -12478,7 +12463,6 @@ def test_list_crawled_urls_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.ListCrawledUrlsRequest() - assert args[0] == request_msg @@ -12498,7 +12482,6 @@ def test_get_finding_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.GetFindingRequest() - assert args[0] == request_msg @@ -12518,7 +12501,6 @@ def test_list_findings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.ListFindingsRequest() - assert args[0] == request_msg @@ -12540,7 +12522,6 @@ def test_list_finding_type_stats_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = web_security_scanner.ListFindingTypeStatsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-workflows/noxfile.py b/packages/google-cloud-workflows/noxfile.py index 868678f287b9..1dcb81730459 100644 --- a/packages/google-cloud-workflows/noxfile.py +++ b/packages/google-cloud-workflows/noxfile.py @@ -47,7 +47,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-workflows" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-workflows/setup.py b/packages/google-cloud-workflows/setup.py index 506b6ffbf840..fddb078de9fb 100644 --- a/packages/google-cloud-workflows/setup.py +++ b/packages/google-cloud-workflows/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/google-cloud-workflows/testing/constraints-3.10.txt b/packages/google-cloud-workflows/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-workflows/testing/constraints-3.10.txt +++ b/packages/google-cloud-workflows/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-workflows/tests/unit/gapic/executions_v1/test_executions.py b/packages/google-cloud-workflows/tests/unit/gapic/executions_v1/test_executions.py index 6790b38c47d8..83acd5324848 100644 --- a/packages/google-cloud-workflows/tests/unit/gapic/executions_v1/test_executions.py +++ b/packages/google-cloud-workflows/tests/unit/gapic/executions_v1/test_executions.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 @@ -106,6 +107,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" @@ -1250,8 +1266,8 @@ def test_executions_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - executions.ListExecutionsRequest, - dict, + executions.ListExecutionsRequest(), + {}, ], ) def test_list_executions(request_type, transport: str = "grpc"): @@ -1262,7 +1278,7 @@ def test_list_executions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_executions), "__call__") as call: @@ -1309,12 +1325,13 @@ def test_list_executions_non_empty_request_with_auto_populated_field(): client.list_executions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == executions.ListExecutionsRequest( + request_msg = executions.ListExecutionsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_executions_use_cached_wrapped_rpc(): @@ -1395,9 +1412,14 @@ async def test_list_executions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_executions_async( - transport: str = "grpc_asyncio", request_type=executions.ListExecutionsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + executions.ListExecutionsRequest(), + {}, + ], +) +async def test_list_executions_async(request_type, transport: str = "grpc_asyncio"): client = ExecutionsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1405,7 +1427,7 @@ async def test_list_executions_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_executions), "__call__") as call: @@ -1428,11 +1450,6 @@ async def test_list_executions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_executions_async_from_dict(): - await test_list_executions_async(request_type=dict) - - def test_list_executions_field_headers(): client = ExecutionsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1769,8 +1786,8 @@ async def test_list_executions_async_pages(): @pytest.mark.parametrize( "request_type", [ - executions.CreateExecutionRequest, - dict, + executions.CreateExecutionRequest(), + {}, ], ) def test_create_execution(request_type, transport: str = "grpc"): @@ -1781,7 +1798,7 @@ def test_create_execution(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_execution), "__call__") as call: @@ -1835,9 +1852,10 @@ def test_create_execution_non_empty_request_with_auto_populated_field(): client.create_execution(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == executions.CreateExecutionRequest( + request_msg = executions.CreateExecutionRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_execution_use_cached_wrapped_rpc(): @@ -1920,9 +1938,14 @@ async def test_create_execution_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_execution_async( - transport: str = "grpc_asyncio", request_type=executions.CreateExecutionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + executions.CreateExecutionRequest(), + {}, + ], +) +async def test_create_execution_async(request_type, transport: str = "grpc_asyncio"): client = ExecutionsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1930,7 +1953,7 @@ async def test_create_execution_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_execution), "__call__") as call: @@ -1963,11 +1986,6 @@ async def test_create_execution_async( assert response.call_log_level == executions.Execution.CallLogLevel.LOG_ALL_CALLS -@pytest.mark.asyncio -async def test_create_execution_async_from_dict(): - await test_create_execution_async(request_type=dict) - - def test_create_execution_field_headers(): client = ExecutionsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2124,8 +2142,8 @@ async def test_create_execution_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - executions.GetExecutionRequest, - dict, + executions.GetExecutionRequest(), + {}, ], ) def test_get_execution(request_type, transport: str = "grpc"): @@ -2136,7 +2154,7 @@ def test_get_execution(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_execution), "__call__") as call: @@ -2190,9 +2208,10 @@ def test_get_execution_non_empty_request_with_auto_populated_field(): client.get_execution(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == executions.GetExecutionRequest( + request_msg = executions.GetExecutionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_execution_use_cached_wrapped_rpc(): @@ -2273,9 +2292,14 @@ async def test_get_execution_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_execution_async( - transport: str = "grpc_asyncio", request_type=executions.GetExecutionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + executions.GetExecutionRequest(), + {}, + ], +) +async def test_get_execution_async(request_type, transport: str = "grpc_asyncio"): client = ExecutionsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2283,7 +2307,7 @@ async def test_get_execution_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_execution), "__call__") as call: @@ -2316,11 +2340,6 @@ async def test_get_execution_async( assert response.call_log_level == executions.Execution.CallLogLevel.LOG_ALL_CALLS -@pytest.mark.asyncio -async def test_get_execution_async_from_dict(): - await test_get_execution_async(request_type=dict) - - def test_get_execution_field_headers(): client = ExecutionsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2467,8 +2486,8 @@ async def test_get_execution_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - executions.CancelExecutionRequest, - dict, + executions.CancelExecutionRequest(), + {}, ], ) def test_cancel_execution(request_type, transport: str = "grpc"): @@ -2479,7 +2498,7 @@ def test_cancel_execution(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.cancel_execution), "__call__") as call: @@ -2533,9 +2552,10 @@ def test_cancel_execution_non_empty_request_with_auto_populated_field(): client.cancel_execution(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == executions.CancelExecutionRequest( + request_msg = executions.CancelExecutionRequest( name="name_value", ) + assert args[0] == request_msg def test_cancel_execution_use_cached_wrapped_rpc(): @@ -2618,9 +2638,14 @@ async def test_cancel_execution_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_cancel_execution_async( - transport: str = "grpc_asyncio", request_type=executions.CancelExecutionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + executions.CancelExecutionRequest(), + {}, + ], +) +async def test_cancel_execution_async(request_type, transport: str = "grpc_asyncio"): client = ExecutionsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2628,7 +2653,7 @@ async def test_cancel_execution_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.cancel_execution), "__call__") as call: @@ -2661,11 +2686,6 @@ async def test_cancel_execution_async( assert response.call_log_level == executions.Execution.CallLogLevel.LOG_ALL_CALLS -@pytest.mark.asyncio -async def test_cancel_execution_async_from_dict(): - await test_cancel_execution_async(request_type=dict) - - def test_cancel_execution_field_headers(): client = ExecutionsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2931,7 +2951,6 @@ def test_list_executions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = executions.ListExecutionsRequest() - assert args[0] == request_msg @@ -2952,7 +2971,6 @@ def test_create_execution_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = executions.CreateExecutionRequest() - assert args[0] == request_msg @@ -2973,7 +2991,6 @@ def test_get_execution_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = executions.GetExecutionRequest() - assert args[0] == request_msg @@ -2994,7 +3011,6 @@ def test_cancel_execution_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = executions.CancelExecutionRequest() - assert args[0] == request_msg @@ -3035,7 +3051,6 @@ async def test_list_executions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = executions.ListExecutionsRequest() - assert args[0] == request_msg @@ -3067,7 +3082,6 @@ async def test_create_execution_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = executions.CreateExecutionRequest() - assert args[0] == request_msg @@ -3099,7 +3113,6 @@ async def test_get_execution_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = executions.GetExecutionRequest() - assert args[0] == request_msg @@ -3131,7 +3144,6 @@ async def test_cancel_execution_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = executions.CancelExecutionRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-workflows/tests/unit/gapic/executions_v1beta/test_executions.py b/packages/google-cloud-workflows/tests/unit/gapic/executions_v1beta/test_executions.py index 45d198086b89..976d0b0410a9 100644 --- a/packages/google-cloud-workflows/tests/unit/gapic/executions_v1beta/test_executions.py +++ b/packages/google-cloud-workflows/tests/unit/gapic/executions_v1beta/test_executions.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 @@ -105,6 +106,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" @@ -1249,8 +1265,8 @@ def test_executions_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - executions.ListExecutionsRequest, - dict, + executions.ListExecutionsRequest(), + {}, ], ) def test_list_executions(request_type, transport: str = "grpc"): @@ -1261,7 +1277,7 @@ def test_list_executions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_executions), "__call__") as call: @@ -1306,10 +1322,11 @@ def test_list_executions_non_empty_request_with_auto_populated_field(): client.list_executions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == executions.ListExecutionsRequest( + request_msg = executions.ListExecutionsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_executions_use_cached_wrapped_rpc(): @@ -1390,9 +1407,14 @@ async def test_list_executions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_executions_async( - transport: str = "grpc_asyncio", request_type=executions.ListExecutionsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + executions.ListExecutionsRequest(), + {}, + ], +) +async def test_list_executions_async(request_type, transport: str = "grpc_asyncio"): client = ExecutionsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1400,7 +1422,7 @@ async def test_list_executions_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_executions), "__call__") as call: @@ -1423,11 +1445,6 @@ async def test_list_executions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_executions_async_from_dict(): - await test_list_executions_async(request_type=dict) - - def test_list_executions_field_headers(): client = ExecutionsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1764,8 +1781,8 @@ async def test_list_executions_async_pages(): @pytest.mark.parametrize( "request_type", [ - executions.CreateExecutionRequest, - dict, + executions.CreateExecutionRequest(), + {}, ], ) def test_create_execution(request_type, transport: str = "grpc"): @@ -1776,7 +1793,7 @@ def test_create_execution(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_execution), "__call__") as call: @@ -1828,9 +1845,10 @@ def test_create_execution_non_empty_request_with_auto_populated_field(): client.create_execution(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == executions.CreateExecutionRequest( + request_msg = executions.CreateExecutionRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_execution_use_cached_wrapped_rpc(): @@ -1913,9 +1931,14 @@ async def test_create_execution_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_execution_async( - transport: str = "grpc_asyncio", request_type=executions.CreateExecutionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + executions.CreateExecutionRequest(), + {}, + ], +) +async def test_create_execution_async(request_type, transport: str = "grpc_asyncio"): client = ExecutionsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1923,7 +1946,7 @@ async def test_create_execution_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_execution), "__call__") as call: @@ -1954,11 +1977,6 @@ async def test_create_execution_async( assert response.workflow_revision_id == "workflow_revision_id_value" -@pytest.mark.asyncio -async def test_create_execution_async_from_dict(): - await test_create_execution_async(request_type=dict) - - def test_create_execution_field_headers(): client = ExecutionsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2115,8 +2133,8 @@ async def test_create_execution_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - executions.GetExecutionRequest, - dict, + executions.GetExecutionRequest(), + {}, ], ) def test_get_execution(request_type, transport: str = "grpc"): @@ -2127,7 +2145,7 @@ def test_get_execution(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_execution), "__call__") as call: @@ -2179,9 +2197,10 @@ def test_get_execution_non_empty_request_with_auto_populated_field(): client.get_execution(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == executions.GetExecutionRequest( + request_msg = executions.GetExecutionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_execution_use_cached_wrapped_rpc(): @@ -2262,9 +2281,14 @@ async def test_get_execution_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_execution_async( - transport: str = "grpc_asyncio", request_type=executions.GetExecutionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + executions.GetExecutionRequest(), + {}, + ], +) +async def test_get_execution_async(request_type, transport: str = "grpc_asyncio"): client = ExecutionsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2272,7 +2296,7 @@ async def test_get_execution_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_execution), "__call__") as call: @@ -2303,11 +2327,6 @@ async def test_get_execution_async( assert response.workflow_revision_id == "workflow_revision_id_value" -@pytest.mark.asyncio -async def test_get_execution_async_from_dict(): - await test_get_execution_async(request_type=dict) - - def test_get_execution_field_headers(): client = ExecutionsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2454,8 +2473,8 @@ async def test_get_execution_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - executions.CancelExecutionRequest, - dict, + executions.CancelExecutionRequest(), + {}, ], ) def test_cancel_execution(request_type, transport: str = "grpc"): @@ -2466,7 +2485,7 @@ def test_cancel_execution(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.cancel_execution), "__call__") as call: @@ -2518,9 +2537,10 @@ def test_cancel_execution_non_empty_request_with_auto_populated_field(): client.cancel_execution(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == executions.CancelExecutionRequest( + request_msg = executions.CancelExecutionRequest( name="name_value", ) + assert args[0] == request_msg def test_cancel_execution_use_cached_wrapped_rpc(): @@ -2603,9 +2623,14 @@ async def test_cancel_execution_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_cancel_execution_async( - transport: str = "grpc_asyncio", request_type=executions.CancelExecutionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + executions.CancelExecutionRequest(), + {}, + ], +) +async def test_cancel_execution_async(request_type, transport: str = "grpc_asyncio"): client = ExecutionsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2613,7 +2638,7 @@ async def test_cancel_execution_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.cancel_execution), "__call__") as call: @@ -2644,11 +2669,6 @@ async def test_cancel_execution_async( assert response.workflow_revision_id == "workflow_revision_id_value" -@pytest.mark.asyncio -async def test_cancel_execution_async_from_dict(): - await test_cancel_execution_async(request_type=dict) - - def test_cancel_execution_field_headers(): client = ExecutionsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2914,7 +2934,6 @@ def test_list_executions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = executions.ListExecutionsRequest() - assert args[0] == request_msg @@ -2935,7 +2954,6 @@ def test_create_execution_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = executions.CreateExecutionRequest() - assert args[0] == request_msg @@ -2956,7 +2974,6 @@ def test_get_execution_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = executions.GetExecutionRequest() - assert args[0] == request_msg @@ -2977,7 +2994,6 @@ def test_cancel_execution_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = executions.CancelExecutionRequest() - assert args[0] == request_msg @@ -3018,7 +3034,6 @@ async def test_list_executions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = executions.ListExecutionsRequest() - assert args[0] == request_msg @@ -3049,7 +3064,6 @@ async def test_create_execution_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = executions.CreateExecutionRequest() - assert args[0] == request_msg @@ -3080,7 +3094,6 @@ async def test_get_execution_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = executions.GetExecutionRequest() - assert args[0] == request_msg @@ -3111,7 +3124,6 @@ async def test_cancel_execution_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = executions.CancelExecutionRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-workflows/tests/unit/gapic/workflows_v1/test_workflows.py b/packages/google-cloud-workflows/tests/unit/gapic/workflows_v1/test_workflows.py index 2552b59527ec..2eacabfe7890 100644 --- a/packages/google-cloud-workflows/tests/unit/gapic/workflows_v1/test_workflows.py +++ b/packages/google-cloud-workflows/tests/unit/gapic/workflows_v1/test_workflows.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 @@ -116,6 +117,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" @@ -1273,8 +1289,8 @@ def test_workflows_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - workflows.ListWorkflowsRequest, - dict, + workflows.ListWorkflowsRequest(), + {}, ], ) def test_list_workflows(request_type, transport: str = "grpc"): @@ -1285,7 +1301,7 @@ def test_list_workflows(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_workflows), "__call__") as call: @@ -1334,12 +1350,13 @@ def test_list_workflows_non_empty_request_with_auto_populated_field(): client.list_workflows(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == workflows.ListWorkflowsRequest( + request_msg = workflows.ListWorkflowsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_workflows_use_cached_wrapped_rpc(): @@ -1420,9 +1437,14 @@ async def test_list_workflows_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_workflows_async( - transport: str = "grpc_asyncio", request_type=workflows.ListWorkflowsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + workflows.ListWorkflowsRequest(), + {}, + ], +) +async def test_list_workflows_async(request_type, transport: str = "grpc_asyncio"): client = WorkflowsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1430,7 +1452,7 @@ async def test_list_workflows_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_workflows), "__call__") as call: @@ -1455,11 +1477,6 @@ async def test_list_workflows_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_workflows_async_from_dict(): - await test_list_workflows_async(request_type=dict) - - def test_list_workflows_field_headers(): client = WorkflowsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1796,8 +1813,8 @@ async def test_list_workflows_async_pages(): @pytest.mark.parametrize( "request_type", [ - workflows.GetWorkflowRequest, - dict, + workflows.GetWorkflowRequest(), + {}, ], ) def test_get_workflow(request_type, transport: str = "grpc"): @@ -1808,7 +1825,7 @@ def test_get_workflow(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_workflow), "__call__") as call: @@ -1877,10 +1894,11 @@ def test_get_workflow_non_empty_request_with_auto_populated_field(): client.get_workflow(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == workflows.GetWorkflowRequest( + request_msg = workflows.GetWorkflowRequest( name="name_value", revision_id="revision_id_value", ) + assert args[0] == request_msg def test_get_workflow_use_cached_wrapped_rpc(): @@ -1961,9 +1979,14 @@ async def test_get_workflow_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_workflow_async( - transport: str = "grpc_asyncio", request_type=workflows.GetWorkflowRequest -): +@pytest.mark.parametrize( + "request_type", + [ + workflows.GetWorkflowRequest(), + {}, + ], +) +async def test_get_workflow_async(request_type, transport: str = "grpc_asyncio"): client = WorkflowsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1971,7 +1994,7 @@ async def test_get_workflow_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_workflow), "__call__") as call: @@ -2017,11 +2040,6 @@ async def test_get_workflow_async( assert response.crypto_key_version == "crypto_key_version_value" -@pytest.mark.asyncio -async def test_get_workflow_async_from_dict(): - await test_get_workflow_async(request_type=dict) - - def test_get_workflow_field_headers(): client = WorkflowsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2164,8 +2182,8 @@ async def test_get_workflow_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - workflows.CreateWorkflowRequest, - dict, + workflows.CreateWorkflowRequest(), + {}, ], ) def test_create_workflow(request_type, transport: str = "grpc"): @@ -2176,7 +2194,7 @@ def test_create_workflow(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_workflow), "__call__") as call: @@ -2218,10 +2236,11 @@ def test_create_workflow_non_empty_request_with_auto_populated_field(): client.create_workflow(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == workflows.CreateWorkflowRequest( + request_msg = workflows.CreateWorkflowRequest( parent="parent_value", workflow_id="workflow_id_value", ) + assert args[0] == request_msg def test_create_workflow_use_cached_wrapped_rpc(): @@ -2312,9 +2331,14 @@ async def test_create_workflow_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_workflow_async( - transport: str = "grpc_asyncio", request_type=workflows.CreateWorkflowRequest -): +@pytest.mark.parametrize( + "request_type", + [ + workflows.CreateWorkflowRequest(), + {}, + ], +) +async def test_create_workflow_async(request_type, transport: str = "grpc_asyncio"): client = WorkflowsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2322,7 +2346,7 @@ async def test_create_workflow_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_workflow), "__call__") as call: @@ -2342,11 +2366,6 @@ async def test_create_workflow_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_workflow_async_from_dict(): - await test_create_workflow_async(request_type=dict) - - def test_create_workflow_field_headers(): client = WorkflowsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2513,8 +2532,8 @@ async def test_create_workflow_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - workflows.DeleteWorkflowRequest, - dict, + workflows.DeleteWorkflowRequest(), + {}, ], ) def test_delete_workflow(request_type, transport: str = "grpc"): @@ -2525,7 +2544,7 @@ def test_delete_workflow(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_workflow), "__call__") as call: @@ -2566,9 +2585,10 @@ def test_delete_workflow_non_empty_request_with_auto_populated_field(): client.delete_workflow(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == workflows.DeleteWorkflowRequest( + request_msg = workflows.DeleteWorkflowRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_workflow_use_cached_wrapped_rpc(): @@ -2659,9 +2679,14 @@ async def test_delete_workflow_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_workflow_async( - transport: str = "grpc_asyncio", request_type=workflows.DeleteWorkflowRequest -): +@pytest.mark.parametrize( + "request_type", + [ + workflows.DeleteWorkflowRequest(), + {}, + ], +) +async def test_delete_workflow_async(request_type, transport: str = "grpc_asyncio"): client = WorkflowsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2669,7 +2694,7 @@ async def test_delete_workflow_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_workflow), "__call__") as call: @@ -2689,11 +2714,6 @@ async def test_delete_workflow_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_workflow_async_from_dict(): - await test_delete_workflow_async(request_type=dict) - - def test_delete_workflow_field_headers(): client = WorkflowsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2840,8 +2860,8 @@ async def test_delete_workflow_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - workflows.UpdateWorkflowRequest, - dict, + workflows.UpdateWorkflowRequest(), + {}, ], ) def test_update_workflow(request_type, transport: str = "grpc"): @@ -2852,7 +2872,7 @@ def test_update_workflow(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_workflow), "__call__") as call: @@ -2891,7 +2911,8 @@ def test_update_workflow_non_empty_request_with_auto_populated_field(): client.update_workflow(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == workflows.UpdateWorkflowRequest() + request_msg = workflows.UpdateWorkflowRequest() + assert args[0] == request_msg def test_update_workflow_use_cached_wrapped_rpc(): @@ -2982,9 +3003,14 @@ async def test_update_workflow_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_workflow_async( - transport: str = "grpc_asyncio", request_type=workflows.UpdateWorkflowRequest -): +@pytest.mark.parametrize( + "request_type", + [ + workflows.UpdateWorkflowRequest(), + {}, + ], +) +async def test_update_workflow_async(request_type, transport: str = "grpc_asyncio"): client = WorkflowsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2992,7 +3018,7 @@ async def test_update_workflow_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_workflow), "__call__") as call: @@ -3012,11 +3038,6 @@ async def test_update_workflow_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_workflow_async_from_dict(): - await test_update_workflow_async(request_type=dict) - - def test_update_workflow_field_headers(): client = WorkflowsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3173,8 +3194,8 @@ async def test_update_workflow_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - workflows.ListWorkflowRevisionsRequest, - dict, + workflows.ListWorkflowRevisionsRequest(), + {}, ], ) def test_list_workflow_revisions(request_type, transport: str = "grpc"): @@ -3185,7 +3206,7 @@ def test_list_workflow_revisions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3234,10 +3255,11 @@ def test_list_workflow_revisions_non_empty_request_with_auto_populated_field(): client.list_workflow_revisions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == workflows.ListWorkflowRevisionsRequest( + request_msg = workflows.ListWorkflowRevisionsRequest( name="name_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_workflow_revisions_use_cached_wrapped_rpc(): @@ -3323,8 +3345,15 @@ async def test_list_workflow_revisions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + workflows.ListWorkflowRevisionsRequest(), + {}, + ], +) async def test_list_workflow_revisions_async( - transport: str = "grpc_asyncio", request_type=workflows.ListWorkflowRevisionsRequest + request_type, transport: str = "grpc_asyncio" ): client = WorkflowsAsyncClient( credentials=async_anonymous_credentials(), @@ -3333,7 +3362,7 @@ async def test_list_workflow_revisions_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( @@ -3358,11 +3387,6 @@ async def test_list_workflow_revisions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_workflow_revisions_async_from_dict(): - await test_list_workflow_revisions_async(request_type=dict) - - def test_list_workflow_revisions_field_headers(): client = WorkflowsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4952,7 +4976,6 @@ def test_list_workflows_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workflows.ListWorkflowsRequest() - assert args[0] == request_msg @@ -4973,7 +4996,6 @@ def test_get_workflow_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workflows.GetWorkflowRequest() - assert args[0] == request_msg @@ -4994,7 +5016,6 @@ def test_create_workflow_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workflows.CreateWorkflowRequest() - assert args[0] == request_msg @@ -5015,7 +5036,6 @@ def test_delete_workflow_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workflows.DeleteWorkflowRequest() - assert args[0] == request_msg @@ -5036,7 +5056,6 @@ def test_update_workflow_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workflows.UpdateWorkflowRequest() - assert args[0] == request_msg @@ -5059,7 +5078,6 @@ def test_list_workflow_revisions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workflows.ListWorkflowRevisionsRequest() - assert args[0] == request_msg @@ -5101,7 +5119,6 @@ async def test_list_workflows_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workflows.ListWorkflowsRequest() - assert args[0] == request_msg @@ -5138,7 +5155,6 @@ async def test_get_workflow_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workflows.GetWorkflowRequest() - assert args[0] == request_msg @@ -5163,7 +5179,6 @@ async def test_create_workflow_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workflows.CreateWorkflowRequest() - assert args[0] == request_msg @@ -5188,7 +5203,6 @@ async def test_delete_workflow_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workflows.DeleteWorkflowRequest() - assert args[0] == request_msg @@ -5213,7 +5227,6 @@ async def test_update_workflow_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workflows.UpdateWorkflowRequest() - assert args[0] == request_msg @@ -5242,7 +5255,6 @@ async def test_list_workflow_revisions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workflows.ListWorkflowRevisionsRequest() - assert args[0] == request_msg @@ -6546,7 +6558,6 @@ def test_list_workflows_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workflows.ListWorkflowsRequest() - assert args[0] == request_msg @@ -6566,7 +6577,6 @@ def test_get_workflow_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workflows.GetWorkflowRequest() - assert args[0] == request_msg @@ -6586,7 +6596,6 @@ def test_create_workflow_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workflows.CreateWorkflowRequest() - assert args[0] == request_msg @@ -6606,7 +6615,6 @@ def test_delete_workflow_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workflows.DeleteWorkflowRequest() - assert args[0] == request_msg @@ -6626,7 +6634,6 @@ def test_update_workflow_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workflows.UpdateWorkflowRequest() - assert args[0] == request_msg @@ -6648,7 +6655,6 @@ def test_list_workflow_revisions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workflows.ListWorkflowRevisionsRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-workflows/tests/unit/gapic/workflows_v1beta/test_workflows.py b/packages/google-cloud-workflows/tests/unit/gapic/workflows_v1beta/test_workflows.py index 098c1298a6df..4a79338e3d08 100644 --- a/packages/google-cloud-workflows/tests/unit/gapic/workflows_v1beta/test_workflows.py +++ b/packages/google-cloud-workflows/tests/unit/gapic/workflows_v1beta/test_workflows.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 @@ -116,6 +117,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" @@ -1273,8 +1289,8 @@ def test_workflows_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - workflows.ListWorkflowsRequest, - dict, + workflows.ListWorkflowsRequest(), + {}, ], ) def test_list_workflows(request_type, transport: str = "grpc"): @@ -1285,7 +1301,7 @@ def test_list_workflows(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_workflows), "__call__") as call: @@ -1334,12 +1350,13 @@ def test_list_workflows_non_empty_request_with_auto_populated_field(): client.list_workflows(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == workflows.ListWorkflowsRequest( + request_msg = workflows.ListWorkflowsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_workflows_use_cached_wrapped_rpc(): @@ -1420,9 +1437,14 @@ async def test_list_workflows_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_workflows_async( - transport: str = "grpc_asyncio", request_type=workflows.ListWorkflowsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + workflows.ListWorkflowsRequest(), + {}, + ], +) +async def test_list_workflows_async(request_type, transport: str = "grpc_asyncio"): client = WorkflowsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1430,7 +1452,7 @@ async def test_list_workflows_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_workflows), "__call__") as call: @@ -1455,11 +1477,6 @@ async def test_list_workflows_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_workflows_async_from_dict(): - await test_list_workflows_async(request_type=dict) - - def test_list_workflows_field_headers(): client = WorkflowsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1796,8 +1813,8 @@ async def test_list_workflows_async_pages(): @pytest.mark.parametrize( "request_type", [ - workflows.GetWorkflowRequest, - dict, + workflows.GetWorkflowRequest(), + {}, ], ) def test_get_workflow(request_type, transport: str = "grpc"): @@ -1808,7 +1825,7 @@ def test_get_workflow(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_workflow), "__call__") as call: @@ -1861,9 +1878,10 @@ def test_get_workflow_non_empty_request_with_auto_populated_field(): client.get_workflow(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == workflows.GetWorkflowRequest( + request_msg = workflows.GetWorkflowRequest( name="name_value", ) + assert args[0] == request_msg def test_get_workflow_use_cached_wrapped_rpc(): @@ -1944,9 +1962,14 @@ async def test_get_workflow_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_workflow_async( - transport: str = "grpc_asyncio", request_type=workflows.GetWorkflowRequest -): +@pytest.mark.parametrize( + "request_type", + [ + workflows.GetWorkflowRequest(), + {}, + ], +) +async def test_get_workflow_async(request_type, transport: str = "grpc_asyncio"): client = WorkflowsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1954,7 +1977,7 @@ async def test_get_workflow_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_workflow), "__call__") as call: @@ -1985,11 +2008,6 @@ async def test_get_workflow_async( assert response.service_account == "service_account_value" -@pytest.mark.asyncio -async def test_get_workflow_async_from_dict(): - await test_get_workflow_async(request_type=dict) - - def test_get_workflow_field_headers(): client = WorkflowsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2132,8 +2150,8 @@ async def test_get_workflow_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - workflows.CreateWorkflowRequest, - dict, + workflows.CreateWorkflowRequest(), + {}, ], ) def test_create_workflow(request_type, transport: str = "grpc"): @@ -2144,7 +2162,7 @@ def test_create_workflow(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_workflow), "__call__") as call: @@ -2186,10 +2204,11 @@ def test_create_workflow_non_empty_request_with_auto_populated_field(): client.create_workflow(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == workflows.CreateWorkflowRequest( + request_msg = workflows.CreateWorkflowRequest( parent="parent_value", workflow_id="workflow_id_value", ) + assert args[0] == request_msg def test_create_workflow_use_cached_wrapped_rpc(): @@ -2280,9 +2299,14 @@ async def test_create_workflow_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_workflow_async( - transport: str = "grpc_asyncio", request_type=workflows.CreateWorkflowRequest -): +@pytest.mark.parametrize( + "request_type", + [ + workflows.CreateWorkflowRequest(), + {}, + ], +) +async def test_create_workflow_async(request_type, transport: str = "grpc_asyncio"): client = WorkflowsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2290,7 +2314,7 @@ async def test_create_workflow_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_workflow), "__call__") as call: @@ -2310,11 +2334,6 @@ async def test_create_workflow_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_workflow_async_from_dict(): - await test_create_workflow_async(request_type=dict) - - def test_create_workflow_field_headers(): client = WorkflowsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2481,8 +2500,8 @@ async def test_create_workflow_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - workflows.DeleteWorkflowRequest, - dict, + workflows.DeleteWorkflowRequest(), + {}, ], ) def test_delete_workflow(request_type, transport: str = "grpc"): @@ -2493,7 +2512,7 @@ def test_delete_workflow(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_workflow), "__call__") as call: @@ -2534,9 +2553,10 @@ def test_delete_workflow_non_empty_request_with_auto_populated_field(): client.delete_workflow(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == workflows.DeleteWorkflowRequest( + request_msg = workflows.DeleteWorkflowRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_workflow_use_cached_wrapped_rpc(): @@ -2627,9 +2647,14 @@ async def test_delete_workflow_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_workflow_async( - transport: str = "grpc_asyncio", request_type=workflows.DeleteWorkflowRequest -): +@pytest.mark.parametrize( + "request_type", + [ + workflows.DeleteWorkflowRequest(), + {}, + ], +) +async def test_delete_workflow_async(request_type, transport: str = "grpc_asyncio"): client = WorkflowsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2637,7 +2662,7 @@ async def test_delete_workflow_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_workflow), "__call__") as call: @@ -2657,11 +2682,6 @@ async def test_delete_workflow_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_workflow_async_from_dict(): - await test_delete_workflow_async(request_type=dict) - - def test_delete_workflow_field_headers(): client = WorkflowsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2808,8 +2828,8 @@ async def test_delete_workflow_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - workflows.UpdateWorkflowRequest, - dict, + workflows.UpdateWorkflowRequest(), + {}, ], ) def test_update_workflow(request_type, transport: str = "grpc"): @@ -2820,7 +2840,7 @@ def test_update_workflow(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_workflow), "__call__") as call: @@ -2859,7 +2879,8 @@ def test_update_workflow_non_empty_request_with_auto_populated_field(): client.update_workflow(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == workflows.UpdateWorkflowRequest() + request_msg = workflows.UpdateWorkflowRequest() + assert args[0] == request_msg def test_update_workflow_use_cached_wrapped_rpc(): @@ -2950,9 +2971,14 @@ async def test_update_workflow_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_workflow_async( - transport: str = "grpc_asyncio", request_type=workflows.UpdateWorkflowRequest -): +@pytest.mark.parametrize( + "request_type", + [ + workflows.UpdateWorkflowRequest(), + {}, + ], +) +async def test_update_workflow_async(request_type, transport: str = "grpc_asyncio"): client = WorkflowsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2960,7 +2986,7 @@ async def test_update_workflow_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_workflow), "__call__") as call: @@ -2980,11 +3006,6 @@ async def test_update_workflow_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_workflow_async_from_dict(): - await test_update_workflow_async(request_type=dict) - - def test_update_workflow_field_headers(): client = WorkflowsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4261,7 +4282,6 @@ def test_list_workflows_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workflows.ListWorkflowsRequest() - assert args[0] == request_msg @@ -4282,7 +4302,6 @@ def test_get_workflow_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workflows.GetWorkflowRequest() - assert args[0] == request_msg @@ -4303,7 +4322,6 @@ def test_create_workflow_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workflows.CreateWorkflowRequest() - assert args[0] == request_msg @@ -4324,7 +4342,6 @@ def test_delete_workflow_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workflows.DeleteWorkflowRequest() - assert args[0] == request_msg @@ -4345,7 +4362,6 @@ def test_update_workflow_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workflows.UpdateWorkflowRequest() - assert args[0] == request_msg @@ -4387,7 +4403,6 @@ async def test_list_workflows_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workflows.ListWorkflowsRequest() - assert args[0] == request_msg @@ -4418,7 +4433,6 @@ async def test_get_workflow_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workflows.GetWorkflowRequest() - assert args[0] == request_msg @@ -4443,7 +4457,6 @@ async def test_create_workflow_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workflows.CreateWorkflowRequest() - assert args[0] == request_msg @@ -4468,7 +4481,6 @@ async def test_delete_workflow_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workflows.DeleteWorkflowRequest() - assert args[0] == request_msg @@ -4493,7 +4505,6 @@ async def test_update_workflow_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workflows.UpdateWorkflowRequest() - assert args[0] == request_msg @@ -5624,7 +5635,6 @@ def test_list_workflows_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workflows.ListWorkflowsRequest() - assert args[0] == request_msg @@ -5644,7 +5654,6 @@ def test_get_workflow_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workflows.GetWorkflowRequest() - assert args[0] == request_msg @@ -5664,7 +5673,6 @@ def test_create_workflow_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workflows.CreateWorkflowRequest() - assert args[0] == request_msg @@ -5684,7 +5692,6 @@ def test_delete_workflow_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workflows.DeleteWorkflowRequest() - assert args[0] == request_msg @@ -5704,7 +5711,6 @@ def test_update_workflow_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workflows.UpdateWorkflowRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-workloadmanager/noxfile.py b/packages/google-cloud-workloadmanager/noxfile.py index 25e5b04b4e80..b6227bea2e3b 100644 --- a/packages/google-cloud-workloadmanager/noxfile.py +++ b/packages/google-cloud-workloadmanager/noxfile.py @@ -47,7 +47,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-workloadmanager" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-workloadmanager/setup.py b/packages/google-cloud-workloadmanager/setup.py index cd9ad30f73ef..4746534cd2e1 100644 --- a/packages/google-cloud-workloadmanager/setup.py +++ b/packages/google-cloud-workloadmanager/setup.py @@ -45,7 +45,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/google-cloud-workloadmanager/testing/constraints-3.10.txt b/packages/google-cloud-workloadmanager/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-cloud-workloadmanager/testing/constraints-3.10.txt +++ b/packages/google-cloud-workloadmanager/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-workloadmanager/tests/unit/gapic/workloadmanager_v1/test_workload_manager.py b/packages/google-cloud-workloadmanager/tests/unit/gapic/workloadmanager_v1/test_workload_manager.py index 94966d20c90e..3b6d41a0ce21 100644 --- a/packages/google-cloud-workloadmanager/tests/unit/gapic/workloadmanager_v1/test_workload_manager.py +++ b/packages/google-cloud-workloadmanager/tests/unit/gapic/workloadmanager_v1/test_workload_manager.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 @@ -116,6 +117,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" @@ -1343,8 +1359,8 @@ def test_workload_manager_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - service.ListEvaluationsRequest, - dict, + service.ListEvaluationsRequest(), + {}, ], ) def test_list_evaluations(request_type, transport: str = "grpc"): @@ -1355,7 +1371,7 @@ def test_list_evaluations(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_evaluations), "__call__") as call: @@ -1404,12 +1420,13 @@ def test_list_evaluations_non_empty_request_with_auto_populated_field(): client.list_evaluations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListEvaluationsRequest( + request_msg = service.ListEvaluationsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_evaluations_use_cached_wrapped_rpc(): @@ -1492,9 +1509,14 @@ async def test_list_evaluations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_evaluations_async( - transport: str = "grpc_asyncio", request_type=service.ListEvaluationsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListEvaluationsRequest(), + {}, + ], +) +async def test_list_evaluations_async(request_type, transport: str = "grpc_asyncio"): client = WorkloadManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1502,7 +1524,7 @@ async def test_list_evaluations_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_evaluations), "__call__") as call: @@ -1527,11 +1549,6 @@ async def test_list_evaluations_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_evaluations_async_from_dict(): - await test_list_evaluations_async(request_type=dict) - - def test_list_evaluations_field_headers(): client = WorkloadManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1868,8 +1885,8 @@ async def test_list_evaluations_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetEvaluationRequest, - dict, + service.GetEvaluationRequest(), + {}, ], ) def test_get_evaluation(request_type, transport: str = "grpc"): @@ -1880,7 +1897,7 @@ def test_get_evaluation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_evaluation), "__call__") as call: @@ -1936,9 +1953,10 @@ def test_get_evaluation_non_empty_request_with_auto_populated_field(): client.get_evaluation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetEvaluationRequest( + request_msg = service.GetEvaluationRequest( name="name_value", ) + assert args[0] == request_msg def test_get_evaluation_use_cached_wrapped_rpc(): @@ -2019,9 +2037,14 @@ async def test_get_evaluation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_evaluation_async( - transport: str = "grpc_asyncio", request_type=service.GetEvaluationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetEvaluationRequest(), + {}, + ], +) +async def test_get_evaluation_async(request_type, transport: str = "grpc_asyncio"): client = WorkloadManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2029,7 +2052,7 @@ async def test_get_evaluation_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_evaluation), "__call__") as call: @@ -2064,11 +2087,6 @@ async def test_get_evaluation_async( assert response.kms_key == "kms_key_value" -@pytest.mark.asyncio -async def test_get_evaluation_async_from_dict(): - await test_get_evaluation_async(request_type=dict) - - def test_get_evaluation_field_headers(): client = WorkloadManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2211,8 +2229,8 @@ async def test_get_evaluation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.CreateEvaluationRequest, - dict, + service.CreateEvaluationRequest(), + {}, ], ) def test_create_evaluation(request_type, transport: str = "grpc"): @@ -2223,7 +2241,7 @@ def test_create_evaluation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,11 +2288,12 @@ def test_create_evaluation_non_empty_request_with_auto_populated_field(): client.create_evaluation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateEvaluationRequest( + request_msg = service.CreateEvaluationRequest( parent="parent_value", evaluation_id="evaluation_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_create_evaluation_use_cached_wrapped_rpc(): @@ -2367,9 +2386,14 @@ async def test_create_evaluation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_evaluation_async( - transport: str = "grpc_asyncio", request_type=service.CreateEvaluationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.CreateEvaluationRequest(), + {}, + ], +) +async def test_create_evaluation_async(request_type, transport: str = "grpc_asyncio"): client = WorkloadManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2377,7 +2401,7 @@ async def test_create_evaluation_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( @@ -2399,11 +2423,6 @@ async def test_create_evaluation_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_evaluation_async_from_dict(): - await test_create_evaluation_async(request_type=dict) - - def test_create_evaluation_field_headers(): client = WorkloadManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2578,8 +2597,8 @@ async def test_create_evaluation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.UpdateEvaluationRequest, - dict, + service.UpdateEvaluationRequest(), + {}, ], ) def test_update_evaluation(request_type, transport: str = "grpc"): @@ -2590,7 +2609,7 @@ def test_update_evaluation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,9 +2654,10 @@ def test_update_evaluation_non_empty_request_with_auto_populated_field(): client.update_evaluation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateEvaluationRequest( + request_msg = service.UpdateEvaluationRequest( request_id="request_id_value", ) + assert args[0] == request_msg def test_update_evaluation_use_cached_wrapped_rpc(): @@ -2730,9 +2750,14 @@ async def test_update_evaluation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_evaluation_async( - transport: str = "grpc_asyncio", request_type=service.UpdateEvaluationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateEvaluationRequest(), + {}, + ], +) +async def test_update_evaluation_async(request_type, transport: str = "grpc_asyncio"): client = WorkloadManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2740,7 +2765,7 @@ async def test_update_evaluation_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( @@ -2762,11 +2787,6 @@ async def test_update_evaluation_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_evaluation_async_from_dict(): - await test_update_evaluation_async(request_type=dict) - - def test_update_evaluation_field_headers(): client = WorkloadManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2931,8 +2951,8 @@ async def test_update_evaluation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DeleteEvaluationRequest, - dict, + service.DeleteEvaluationRequest(), + {}, ], ) def test_delete_evaluation(request_type, transport: str = "grpc"): @@ -2943,7 +2963,7 @@ def test_delete_evaluation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2989,10 +3009,11 @@ def test_delete_evaluation_non_empty_request_with_auto_populated_field(): client.delete_evaluation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteEvaluationRequest( + request_msg = service.DeleteEvaluationRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_evaluation_use_cached_wrapped_rpc(): @@ -3085,9 +3106,14 @@ async def test_delete_evaluation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_evaluation_async( - transport: str = "grpc_asyncio", request_type=service.DeleteEvaluationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteEvaluationRequest(), + {}, + ], +) +async def test_delete_evaluation_async(request_type, transport: str = "grpc_asyncio"): client = WorkloadManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3095,7 +3121,7 @@ async def test_delete_evaluation_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( @@ -3117,11 +3143,6 @@ async def test_delete_evaluation_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_evaluation_async_from_dict(): - await test_delete_evaluation_async(request_type=dict) - - def test_delete_evaluation_field_headers(): client = WorkloadManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3276,8 +3297,8 @@ async def test_delete_evaluation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListExecutionsRequest, - dict, + service.ListExecutionsRequest(), + {}, ], ) def test_list_executions(request_type, transport: str = "grpc"): @@ -3288,7 +3309,7 @@ def test_list_executions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_executions), "__call__") as call: @@ -3337,12 +3358,13 @@ def test_list_executions_non_empty_request_with_auto_populated_field(): client.list_executions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListExecutionsRequest( + request_msg = service.ListExecutionsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_executions_use_cached_wrapped_rpc(): @@ -3423,9 +3445,14 @@ async def test_list_executions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_executions_async( - transport: str = "grpc_asyncio", request_type=service.ListExecutionsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListExecutionsRequest(), + {}, + ], +) +async def test_list_executions_async(request_type, transport: str = "grpc_asyncio"): client = WorkloadManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3433,7 +3460,7 @@ async def test_list_executions_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_executions), "__call__") as call: @@ -3458,11 +3485,6 @@ async def test_list_executions_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_executions_async_from_dict(): - await test_list_executions_async(request_type=dict) - - def test_list_executions_field_headers(): client = WorkloadManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3799,8 +3821,8 @@ async def test_list_executions_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.GetExecutionRequest, - dict, + service.GetExecutionRequest(), + {}, ], ) def test_get_execution(request_type, transport: str = "grpc"): @@ -3811,7 +3833,7 @@ def test_get_execution(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_execution), "__call__") as call: @@ -3863,9 +3885,10 @@ def test_get_execution_non_empty_request_with_auto_populated_field(): client.get_execution(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.GetExecutionRequest( + request_msg = service.GetExecutionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_execution_use_cached_wrapped_rpc(): @@ -3946,9 +3969,14 @@ async def test_get_execution_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_execution_async( - transport: str = "grpc_asyncio", request_type=service.GetExecutionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.GetExecutionRequest(), + {}, + ], +) +async def test_get_execution_async(request_type, transport: str = "grpc_asyncio"): client = WorkloadManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3956,7 +3984,7 @@ async def test_get_execution_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_execution), "__call__") as call: @@ -3987,11 +4015,6 @@ async def test_get_execution_async( assert response.engine == service.Execution.Engine.ENGINE_SCANNER -@pytest.mark.asyncio -async def test_get_execution_async_from_dict(): - await test_get_execution_async(request_type=dict) - - def test_get_execution_field_headers(): client = WorkloadManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4134,8 +4157,8 @@ async def test_get_execution_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.RunEvaluationRequest, - dict, + service.RunEvaluationRequest(), + {}, ], ) def test_run_evaluation(request_type, transport: str = "grpc"): @@ -4146,7 +4169,7 @@ def test_run_evaluation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.run_evaluation), "__call__") as call: @@ -4189,11 +4212,12 @@ def test_run_evaluation_non_empty_request_with_auto_populated_field(): client.run_evaluation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.RunEvaluationRequest( + request_msg = service.RunEvaluationRequest( name="name_value", execution_id="execution_id_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_run_evaluation_use_cached_wrapped_rpc(): @@ -4284,9 +4308,14 @@ async def test_run_evaluation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_run_evaluation_async( - transport: str = "grpc_asyncio", request_type=service.RunEvaluationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.RunEvaluationRequest(), + {}, + ], +) +async def test_run_evaluation_async(request_type, transport: str = "grpc_asyncio"): client = WorkloadManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4294,7 +4323,7 @@ async def test_run_evaluation_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.run_evaluation), "__call__") as call: @@ -4314,11 +4343,6 @@ async def test_run_evaluation_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_run_evaluation_async_from_dict(): - await test_run_evaluation_async(request_type=dict) - - def test_run_evaluation_field_headers(): client = WorkloadManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4485,8 +4509,8 @@ async def test_run_evaluation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.DeleteExecutionRequest, - dict, + service.DeleteExecutionRequest(), + {}, ], ) def test_delete_execution(request_type, transport: str = "grpc"): @@ -4497,7 +4521,7 @@ def test_delete_execution(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_execution), "__call__") as call: @@ -4539,10 +4563,11 @@ def test_delete_execution_non_empty_request_with_auto_populated_field(): client.delete_execution(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteExecutionRequest( + request_msg = service.DeleteExecutionRequest( name="name_value", request_id="request_id_value", ) + assert args[0] == request_msg def test_delete_execution_use_cached_wrapped_rpc(): @@ -4635,9 +4660,14 @@ async def test_delete_execution_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_execution_async( - transport: str = "grpc_asyncio", request_type=service.DeleteExecutionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteExecutionRequest(), + {}, + ], +) +async def test_delete_execution_async(request_type, transport: str = "grpc_asyncio"): client = WorkloadManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4645,7 +4675,7 @@ async def test_delete_execution_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_execution), "__call__") as call: @@ -4665,11 +4695,6 @@ async def test_delete_execution_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_execution_async_from_dict(): - await test_delete_execution_async(request_type=dict) - - def test_delete_execution_field_headers(): client = WorkloadManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4816,8 +4841,8 @@ async def test_delete_execution_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListExecutionResultsRequest, - dict, + service.ListExecutionResultsRequest(), + {}, ], ) def test_list_execution_results(request_type, transport: str = "grpc"): @@ -4828,7 +4853,7 @@ def test_list_execution_results(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4878,11 +4903,12 @@ def test_list_execution_results_non_empty_request_with_auto_populated_field(): client.list_execution_results(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListExecutionResultsRequest( + request_msg = service.ListExecutionResultsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_execution_results_use_cached_wrapped_rpc(): @@ -4968,8 +4994,15 @@ async def test_list_execution_results_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.ListExecutionResultsRequest(), + {}, + ], +) async def test_list_execution_results_async( - transport: str = "grpc_asyncio", request_type=service.ListExecutionResultsRequest + request_type, transport: str = "grpc_asyncio" ): client = WorkloadManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -4978,7 +5011,7 @@ async def test_list_execution_results_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( @@ -5003,11 +5036,6 @@ async def test_list_execution_results_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_execution_results_async_from_dict(): - await test_list_execution_results_async(request_type=dict) - - def test_list_execution_results_field_headers(): client = WorkloadManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5360,8 +5388,8 @@ async def test_list_execution_results_async_pages(): @pytest.mark.parametrize( "request_type", [ - service.ListRulesRequest, - dict, + service.ListRulesRequest(), + {}, ], ) def test_list_rules(request_type, transport: str = "grpc"): @@ -5372,7 +5400,7 @@ def test_list_rules(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_rules), "__call__") as call: @@ -5416,12 +5444,13 @@ def test_list_rules_non_empty_request_with_auto_populated_field(): client.list_rules(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListRulesRequest( + request_msg = service.ListRulesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", custom_rules_bucket="custom_rules_bucket_value", ) + assert args[0] == request_msg def test_list_rules_use_cached_wrapped_rpc(): @@ -5500,9 +5529,14 @@ async def test_list_rules_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_list_rules_async( - transport: str = "grpc_asyncio", request_type=service.ListRulesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + service.ListRulesRequest(), + {}, + ], +) +async def test_list_rules_async(request_type, transport: str = "grpc_asyncio"): client = WorkloadManagerAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5510,7 +5544,7 @@ async def test_list_rules_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_rules), "__call__") as call: @@ -5530,11 +5564,6 @@ async def test_list_rules_async( assert isinstance(response, service.ListRulesResponse) -@pytest.mark.asyncio -async def test_list_rules_async_from_dict(): - await test_list_rules_async(request_type=dict) - - def test_list_rules_field_headers(): client = WorkloadManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5681,8 +5710,8 @@ async def test_list_rules_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - service.ListScannedResourcesRequest, - dict, + service.ListScannedResourcesRequest(), + {}, ], ) def test_list_scanned_resources(request_type, transport: str = "grpc"): @@ -5693,7 +5722,7 @@ def test_list_scanned_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( @@ -5745,13 +5774,14 @@ def test_list_scanned_resources_non_empty_request_with_auto_populated_field(): client.list_scanned_resources(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == service.ListScannedResourcesRequest( + request_msg = service.ListScannedResourcesRequest( parent="parent_value", rule="rule_value", page_token="page_token_value", filter="filter_value", order_by="order_by_value", ) + assert args[0] == request_msg def test_list_scanned_resources_use_cached_wrapped_rpc(): @@ -5837,8 +5867,15 @@ async def test_list_scanned_resources_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + service.ListScannedResourcesRequest(), + {}, + ], +) async def test_list_scanned_resources_async( - transport: str = "grpc_asyncio", request_type=service.ListScannedResourcesRequest + request_type, transport: str = "grpc_asyncio" ): client = WorkloadManagerAsyncClient( credentials=async_anonymous_credentials(), @@ -5847,7 +5884,7 @@ async def test_list_scanned_resources_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( @@ -5872,11 +5909,6 @@ async def test_list_scanned_resources_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_scanned_resources_async_from_dict(): - await test_list_scanned_resources_async(request_type=dict) - - def test_list_scanned_resources_field_headers(): client = WorkloadManagerClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8954,7 +8986,6 @@ def test_list_evaluations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListEvaluationsRequest() - assert args[0] == request_msg @@ -8975,7 +9006,6 @@ def test_get_evaluation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetEvaluationRequest() - assert args[0] == request_msg @@ -8998,7 +9028,6 @@ def test_create_evaluation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateEvaluationRequest() - assert args[0] == request_msg @@ -9021,7 +9050,6 @@ def test_update_evaluation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateEvaluationRequest() - assert args[0] == request_msg @@ -9044,7 +9072,6 @@ def test_delete_evaluation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteEvaluationRequest() - assert args[0] == request_msg @@ -9065,7 +9092,6 @@ def test_list_executions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListExecutionsRequest() - assert args[0] == request_msg @@ -9086,7 +9112,6 @@ def test_get_execution_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetExecutionRequest() - assert args[0] == request_msg @@ -9107,7 +9132,6 @@ def test_run_evaluation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.RunEvaluationRequest() - assert args[0] == request_msg @@ -9128,7 +9152,6 @@ def test_delete_execution_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteExecutionRequest() - assert args[0] == request_msg @@ -9151,7 +9174,6 @@ def test_list_execution_results_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListExecutionResultsRequest() - assert args[0] == request_msg @@ -9172,7 +9194,6 @@ def test_list_rules_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListRulesRequest() - assert args[0] == request_msg @@ -9195,7 +9216,6 @@ def test_list_scanned_resources_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListScannedResourcesRequest() - assert args[0] == request_msg @@ -9237,7 +9257,6 @@ async def test_list_evaluations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListEvaluationsRequest() - assert args[0] == request_msg @@ -9270,7 +9289,6 @@ async def test_get_evaluation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetEvaluationRequest() - assert args[0] == request_msg @@ -9297,7 +9315,6 @@ async def test_create_evaluation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateEvaluationRequest() - assert args[0] == request_msg @@ -9324,7 +9341,6 @@ async def test_update_evaluation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateEvaluationRequest() - assert args[0] == request_msg @@ -9351,7 +9367,6 @@ async def test_delete_evaluation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteEvaluationRequest() - assert args[0] == request_msg @@ -9379,7 +9394,6 @@ async def test_list_executions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListExecutionsRequest() - assert args[0] == request_msg @@ -9410,7 +9424,6 @@ async def test_get_execution_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetExecutionRequest() - assert args[0] == request_msg @@ -9435,7 +9448,6 @@ async def test_run_evaluation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.RunEvaluationRequest() - assert args[0] == request_msg @@ -9460,7 +9472,6 @@ async def test_delete_execution_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteExecutionRequest() - assert args[0] == request_msg @@ -9489,7 +9500,6 @@ async def test_list_execution_results_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListExecutionResultsRequest() - assert args[0] == request_msg @@ -9514,7 +9524,6 @@ async def test_list_rules_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListRulesRequest() - assert args[0] == request_msg @@ -9543,7 +9552,6 @@ async def test_list_scanned_resources_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListScannedResourcesRequest() - assert args[0] == request_msg @@ -11720,7 +11728,6 @@ def test_list_evaluations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListEvaluationsRequest() - assert args[0] == request_msg @@ -11740,7 +11747,6 @@ def test_get_evaluation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetEvaluationRequest() - assert args[0] == request_msg @@ -11762,7 +11768,6 @@ def test_create_evaluation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.CreateEvaluationRequest() - assert args[0] == request_msg @@ -11784,7 +11789,6 @@ def test_update_evaluation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.UpdateEvaluationRequest() - assert args[0] == request_msg @@ -11806,7 +11810,6 @@ def test_delete_evaluation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteEvaluationRequest() - assert args[0] == request_msg @@ -11826,7 +11829,6 @@ def test_list_executions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListExecutionsRequest() - assert args[0] == request_msg @@ -11846,7 +11848,6 @@ def test_get_execution_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.GetExecutionRequest() - assert args[0] == request_msg @@ -11866,7 +11867,6 @@ def test_run_evaluation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.RunEvaluationRequest() - assert args[0] == request_msg @@ -11886,7 +11886,6 @@ def test_delete_execution_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.DeleteExecutionRequest() - assert args[0] == request_msg @@ -11908,7 +11907,6 @@ def test_list_execution_results_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListExecutionResultsRequest() - assert args[0] == request_msg @@ -11928,7 +11926,6 @@ def test_list_rules_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListRulesRequest() - assert args[0] == request_msg @@ -11950,7 +11947,6 @@ def test_list_scanned_resources_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = service.ListScannedResourcesRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-workstations/noxfile.py b/packages/google-cloud-workstations/noxfile.py index b33ae57c452a..29ad30aa8dce 100644 --- a/packages/google-cloud-workstations/noxfile.py +++ b/packages/google-cloud-workstations/noxfile.py @@ -47,7 +47,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-workstations" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-cloud-workstations/setup.py b/packages/google-cloud-workstations/setup.py index 0dd67681c51b..2f2874b979a1 100644 --- a/packages/google-cloud-workstations/setup.py +++ b/packages/google-cloud-workstations/setup.py @@ -45,7 +45,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/google-cloud-workstations/testing/constraints-3.10.txt b/packages/google-cloud-workstations/testing/constraints-3.10.txt index a92801e1c8e2..b39cd54634f9 100644 --- a/packages/google-cloud-workstations/testing/constraints-3.10.txt +++ b/packages/google-cloud-workstations/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/google-cloud-workstations/tests/unit/gapic/workstations_v1/test_workstations.py b/packages/google-cloud-workstations/tests/unit/gapic/workstations_v1/test_workstations.py index 4b0be1abc25f..c32c2b5c40b6 100644 --- a/packages/google-cloud-workstations/tests/unit/gapic/workstations_v1/test_workstations.py +++ b/packages/google-cloud-workstations/tests/unit/gapic/workstations_v1/test_workstations.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 @@ -123,6 +124,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" @@ -1303,8 +1319,8 @@ def test_workstations_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - workstations.GetWorkstationClusterRequest, - dict, + workstations.GetWorkstationClusterRequest(), + {}, ], ) def test_get_workstation_cluster(request_type, transport: str = "grpc"): @@ -1315,7 +1331,7 @@ def test_get_workstation_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1379,9 +1395,10 @@ def test_get_workstation_cluster_non_empty_request_with_auto_populated_field(): client.get_workstation_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == workstations.GetWorkstationClusterRequest( + request_msg = workstations.GetWorkstationClusterRequest( name="name_value", ) + assert args[0] == request_msg def test_get_workstation_cluster_use_cached_wrapped_rpc(): @@ -1467,9 +1484,15 @@ async def test_get_workstation_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + workstations.GetWorkstationClusterRequest(), + {}, + ], +) async def test_get_workstation_cluster_async( - transport: str = "grpc_asyncio", - request_type=workstations.GetWorkstationClusterRequest, + request_type, transport: str = "grpc_asyncio" ): client = WorkstationsAsyncClient( credentials=async_anonymous_credentials(), @@ -1478,7 +1501,7 @@ async def test_get_workstation_cluster_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( @@ -1519,11 +1542,6 @@ async def test_get_workstation_cluster_async( assert response.degraded is True -@pytest.mark.asyncio -async def test_get_workstation_cluster_async_from_dict(): - await test_get_workstation_cluster_async(request_type=dict) - - def test_get_workstation_cluster_field_headers(): client = WorkstationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1678,8 +1696,8 @@ async def test_get_workstation_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - workstations.ListWorkstationClustersRequest, - dict, + workstations.ListWorkstationClustersRequest(), + {}, ], ) def test_list_workstation_clusters(request_type, transport: str = "grpc"): @@ -1690,7 +1708,7 @@ def test_list_workstation_clusters(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1741,10 +1759,11 @@ def test_list_workstation_clusters_non_empty_request_with_auto_populated_field() client.list_workstation_clusters(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == workstations.ListWorkstationClustersRequest( + request_msg = workstations.ListWorkstationClustersRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_workstation_clusters_use_cached_wrapped_rpc(): @@ -1830,9 +1849,15 @@ async def test_list_workstation_clusters_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + workstations.ListWorkstationClustersRequest(), + {}, + ], +) async def test_list_workstation_clusters_async( - transport: str = "grpc_asyncio", - request_type=workstations.ListWorkstationClustersRequest, + request_type, transport: str = "grpc_asyncio" ): client = WorkstationsAsyncClient( credentials=async_anonymous_credentials(), @@ -1841,7 +1866,7 @@ async def test_list_workstation_clusters_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( @@ -1868,11 +1893,6 @@ async def test_list_workstation_clusters_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_workstation_clusters_async_from_dict(): - await test_list_workstation_clusters_async(request_type=dict) - - def test_list_workstation_clusters_field_headers(): client = WorkstationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2227,8 +2247,8 @@ async def test_list_workstation_clusters_async_pages(): @pytest.mark.parametrize( "request_type", [ - workstations.CreateWorkstationClusterRequest, - dict, + workstations.CreateWorkstationClusterRequest(), + {}, ], ) def test_create_workstation_cluster(request_type, transport: str = "grpc"): @@ -2239,7 +2259,7 @@ def test_create_workstation_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2285,10 +2305,11 @@ def test_create_workstation_cluster_non_empty_request_with_auto_populated_field( client.create_workstation_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == workstations.CreateWorkstationClusterRequest( + request_msg = workstations.CreateWorkstationClusterRequest( parent="parent_value", workstation_cluster_id="workstation_cluster_id_value", ) + assert args[0] == request_msg def test_create_workstation_cluster_use_cached_wrapped_rpc(): @@ -2384,9 +2405,15 @@ async def test_create_workstation_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + workstations.CreateWorkstationClusterRequest(), + {}, + ], +) async def test_create_workstation_cluster_async( - transport: str = "grpc_asyncio", - request_type=workstations.CreateWorkstationClusterRequest, + request_type, transport: str = "grpc_asyncio" ): client = WorkstationsAsyncClient( credentials=async_anonymous_credentials(), @@ -2395,7 +2422,7 @@ async def test_create_workstation_cluster_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( @@ -2417,11 +2444,6 @@ async def test_create_workstation_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_workstation_cluster_async_from_dict(): - await test_create_workstation_cluster_async(request_type=dict) - - def test_create_workstation_cluster_field_headers(): client = WorkstationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2596,8 +2618,8 @@ async def test_create_workstation_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - workstations.UpdateWorkstationClusterRequest, - dict, + workstations.UpdateWorkstationClusterRequest(), + {}, ], ) def test_update_workstation_cluster(request_type, transport: str = "grpc"): @@ -2608,7 +2630,7 @@ def test_update_workstation_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2651,7 +2673,8 @@ def test_update_workstation_cluster_non_empty_request_with_auto_populated_field( client.update_workstation_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == workstations.UpdateWorkstationClusterRequest() + request_msg = workstations.UpdateWorkstationClusterRequest() + assert args[0] == request_msg def test_update_workstation_cluster_use_cached_wrapped_rpc(): @@ -2747,9 +2770,15 @@ async def test_update_workstation_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + workstations.UpdateWorkstationClusterRequest(), + {}, + ], +) async def test_update_workstation_cluster_async( - transport: str = "grpc_asyncio", - request_type=workstations.UpdateWorkstationClusterRequest, + request_type, transport: str = "grpc_asyncio" ): client = WorkstationsAsyncClient( credentials=async_anonymous_credentials(), @@ -2758,7 +2787,7 @@ async def test_update_workstation_cluster_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( @@ -2780,11 +2809,6 @@ async def test_update_workstation_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_workstation_cluster_async_from_dict(): - await test_update_workstation_cluster_async(request_type=dict) - - def test_update_workstation_cluster_field_headers(): client = WorkstationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2949,8 +2973,8 @@ async def test_update_workstation_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - workstations.DeleteWorkstationClusterRequest, - dict, + workstations.DeleteWorkstationClusterRequest(), + {}, ], ) def test_delete_workstation_cluster(request_type, transport: str = "grpc"): @@ -2961,7 +2985,7 @@ def test_delete_workstation_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3007,10 +3031,11 @@ def test_delete_workstation_cluster_non_empty_request_with_auto_populated_field( client.delete_workstation_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == workstations.DeleteWorkstationClusterRequest( + request_msg = workstations.DeleteWorkstationClusterRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_workstation_cluster_use_cached_wrapped_rpc(): @@ -3106,9 +3131,15 @@ async def test_delete_workstation_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + workstations.DeleteWorkstationClusterRequest(), + {}, + ], +) async def test_delete_workstation_cluster_async( - transport: str = "grpc_asyncio", - request_type=workstations.DeleteWorkstationClusterRequest, + request_type, transport: str = "grpc_asyncio" ): client = WorkstationsAsyncClient( credentials=async_anonymous_credentials(), @@ -3117,7 +3148,7 @@ async def test_delete_workstation_cluster_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( @@ -3139,11 +3170,6 @@ async def test_delete_workstation_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_workstation_cluster_async_from_dict(): - await test_delete_workstation_cluster_async(request_type=dict) - - def test_delete_workstation_cluster_field_headers(): client = WorkstationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3298,8 +3324,8 @@ async def test_delete_workstation_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - workstations.GetWorkstationConfigRequest, - dict, + workstations.GetWorkstationConfigRequest(), + {}, ], ) def test_get_workstation_config(request_type, transport: str = "grpc"): @@ -3310,7 +3336,7 @@ def test_get_workstation_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( @@ -3370,9 +3396,10 @@ def test_get_workstation_config_non_empty_request_with_auto_populated_field(): client.get_workstation_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == workstations.GetWorkstationConfigRequest( + request_msg = workstations.GetWorkstationConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_workstation_config_use_cached_wrapped_rpc(): @@ -3458,9 +3485,15 @@ async def test_get_workstation_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + workstations.GetWorkstationConfigRequest(), + {}, + ], +) async def test_get_workstation_config_async( - transport: str = "grpc_asyncio", - request_type=workstations.GetWorkstationConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = WorkstationsAsyncClient( credentials=async_anonymous_credentials(), @@ -3469,7 +3502,7 @@ async def test_get_workstation_config_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( @@ -3506,11 +3539,6 @@ async def test_get_workstation_config_async( assert response.degraded is True -@pytest.mark.asyncio -async def test_get_workstation_config_async_from_dict(): - await test_get_workstation_config_async(request_type=dict) - - def test_get_workstation_config_field_headers(): client = WorkstationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3665,8 +3693,8 @@ async def test_get_workstation_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - workstations.ListWorkstationConfigsRequest, - dict, + workstations.ListWorkstationConfigsRequest(), + {}, ], ) def test_list_workstation_configs(request_type, transport: str = "grpc"): @@ -3677,7 +3705,7 @@ def test_list_workstation_configs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3728,10 +3756,11 @@ def test_list_workstation_configs_non_empty_request_with_auto_populated_field(): client.list_workstation_configs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == workstations.ListWorkstationConfigsRequest( + request_msg = workstations.ListWorkstationConfigsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_workstation_configs_use_cached_wrapped_rpc(): @@ -3817,9 +3846,15 @@ async def test_list_workstation_configs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + workstations.ListWorkstationConfigsRequest(), + {}, + ], +) async def test_list_workstation_configs_async( - transport: str = "grpc_asyncio", - request_type=workstations.ListWorkstationConfigsRequest, + request_type, transport: str = "grpc_asyncio" ): client = WorkstationsAsyncClient( credentials=async_anonymous_credentials(), @@ -3828,7 +3863,7 @@ async def test_list_workstation_configs_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( @@ -3855,11 +3890,6 @@ async def test_list_workstation_configs_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_workstation_configs_async_from_dict(): - await test_list_workstation_configs_async(request_type=dict) - - def test_list_workstation_configs_field_headers(): client = WorkstationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4214,8 +4244,8 @@ async def test_list_workstation_configs_async_pages(): @pytest.mark.parametrize( "request_type", [ - workstations.ListUsableWorkstationConfigsRequest, - dict, + workstations.ListUsableWorkstationConfigsRequest(), + {}, ], ) def test_list_usable_workstation_configs(request_type, transport: str = "grpc"): @@ -4226,7 +4256,7 @@ def test_list_usable_workstation_configs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4277,10 +4307,11 @@ def test_list_usable_workstation_configs_non_empty_request_with_auto_populated_f client.list_usable_workstation_configs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == workstations.ListUsableWorkstationConfigsRequest( + request_msg = workstations.ListUsableWorkstationConfigsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_usable_workstation_configs_use_cached_wrapped_rpc(): @@ -4366,9 +4397,15 @@ async def test_list_usable_workstation_configs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + workstations.ListUsableWorkstationConfigsRequest(), + {}, + ], +) async def test_list_usable_workstation_configs_async( - transport: str = "grpc_asyncio", - request_type=workstations.ListUsableWorkstationConfigsRequest, + request_type, transport: str = "grpc_asyncio" ): client = WorkstationsAsyncClient( credentials=async_anonymous_credentials(), @@ -4377,7 +4414,7 @@ async def test_list_usable_workstation_configs_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( @@ -4404,11 +4441,6 @@ async def test_list_usable_workstation_configs_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_usable_workstation_configs_async_from_dict(): - await test_list_usable_workstation_configs_async(request_type=dict) - - def test_list_usable_workstation_configs_field_headers(): client = WorkstationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4765,8 +4797,8 @@ async def test_list_usable_workstation_configs_async_pages(): @pytest.mark.parametrize( "request_type", [ - workstations.CreateWorkstationConfigRequest, - dict, + workstations.CreateWorkstationConfigRequest(), + {}, ], ) def test_create_workstation_config(request_type, transport: str = "grpc"): @@ -4777,7 +4809,7 @@ def test_create_workstation_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( @@ -4823,10 +4855,11 @@ def test_create_workstation_config_non_empty_request_with_auto_populated_field() client.create_workstation_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == workstations.CreateWorkstationConfigRequest( + request_msg = workstations.CreateWorkstationConfigRequest( parent="parent_value", workstation_config_id="workstation_config_id_value", ) + assert args[0] == request_msg def test_create_workstation_config_use_cached_wrapped_rpc(): @@ -4922,9 +4955,15 @@ async def test_create_workstation_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + workstations.CreateWorkstationConfigRequest(), + {}, + ], +) async def test_create_workstation_config_async( - transport: str = "grpc_asyncio", - request_type=workstations.CreateWorkstationConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = WorkstationsAsyncClient( credentials=async_anonymous_credentials(), @@ -4933,7 +4972,7 @@ async def test_create_workstation_config_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( @@ -4955,11 +4994,6 @@ async def test_create_workstation_config_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_workstation_config_async_from_dict(): - await test_create_workstation_config_async(request_type=dict) - - def test_create_workstation_config_field_headers(): client = WorkstationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5134,8 +5168,8 @@ async def test_create_workstation_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - workstations.UpdateWorkstationConfigRequest, - dict, + workstations.UpdateWorkstationConfigRequest(), + {}, ], ) def test_update_workstation_config(request_type, transport: str = "grpc"): @@ -5146,7 +5180,7 @@ def test_update_workstation_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( @@ -5189,7 +5223,8 @@ def test_update_workstation_config_non_empty_request_with_auto_populated_field() client.update_workstation_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == workstations.UpdateWorkstationConfigRequest() + request_msg = workstations.UpdateWorkstationConfigRequest() + assert args[0] == request_msg def test_update_workstation_config_use_cached_wrapped_rpc(): @@ -5285,9 +5320,15 @@ async def test_update_workstation_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + workstations.UpdateWorkstationConfigRequest(), + {}, + ], +) async def test_update_workstation_config_async( - transport: str = "grpc_asyncio", - request_type=workstations.UpdateWorkstationConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = WorkstationsAsyncClient( credentials=async_anonymous_credentials(), @@ -5296,7 +5337,7 @@ async def test_update_workstation_config_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( @@ -5318,11 +5359,6 @@ async def test_update_workstation_config_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_workstation_config_async_from_dict(): - await test_update_workstation_config_async(request_type=dict) - - def test_update_workstation_config_field_headers(): client = WorkstationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5487,8 +5523,8 @@ async def test_update_workstation_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - workstations.DeleteWorkstationConfigRequest, - dict, + workstations.DeleteWorkstationConfigRequest(), + {}, ], ) def test_delete_workstation_config(request_type, transport: str = "grpc"): @@ -5499,7 +5535,7 @@ def test_delete_workstation_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( @@ -5545,10 +5581,11 @@ def test_delete_workstation_config_non_empty_request_with_auto_populated_field() client.delete_workstation_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == workstations.DeleteWorkstationConfigRequest( + request_msg = workstations.DeleteWorkstationConfigRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_workstation_config_use_cached_wrapped_rpc(): @@ -5644,9 +5681,15 @@ async def test_delete_workstation_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + workstations.DeleteWorkstationConfigRequest(), + {}, + ], +) async def test_delete_workstation_config_async( - transport: str = "grpc_asyncio", - request_type=workstations.DeleteWorkstationConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = WorkstationsAsyncClient( credentials=async_anonymous_credentials(), @@ -5655,7 +5698,7 @@ async def test_delete_workstation_config_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( @@ -5677,11 +5720,6 @@ async def test_delete_workstation_config_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_workstation_config_async_from_dict(): - await test_delete_workstation_config_async(request_type=dict) - - def test_delete_workstation_config_field_headers(): client = WorkstationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5836,8 +5874,8 @@ async def test_delete_workstation_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - workstations.GetWorkstationRequest, - dict, + workstations.GetWorkstationRequest(), + {}, ], ) def test_get_workstation(request_type, transport: str = "grpc"): @@ -5848,7 +5886,7 @@ def test_get_workstation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_workstation), "__call__") as call: @@ -5904,9 +5942,10 @@ def test_get_workstation_non_empty_request_with_auto_populated_field(): client.get_workstation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == workstations.GetWorkstationRequest( + request_msg = workstations.GetWorkstationRequest( name="name_value", ) + assert args[0] == request_msg def test_get_workstation_use_cached_wrapped_rpc(): @@ -5987,9 +6026,14 @@ async def test_get_workstation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_workstation_async( - transport: str = "grpc_asyncio", request_type=workstations.GetWorkstationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + workstations.GetWorkstationRequest(), + {}, + ], +) +async def test_get_workstation_async(request_type, transport: str = "grpc_asyncio"): client = WorkstationsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5997,7 +6041,7 @@ async def test_get_workstation_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_workstation), "__call__") as call: @@ -6032,11 +6076,6 @@ async def test_get_workstation_async( assert response.host == "host_value" -@pytest.mark.asyncio -async def test_get_workstation_async_from_dict(): - await test_get_workstation_async(request_type=dict) - - def test_get_workstation_field_headers(): client = WorkstationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6183,8 +6222,8 @@ async def test_get_workstation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - workstations.ListWorkstationsRequest, - dict, + workstations.ListWorkstationsRequest(), + {}, ], ) def test_list_workstations(request_type, transport: str = "grpc"): @@ -6195,7 +6234,7 @@ def test_list_workstations(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6246,10 +6285,11 @@ def test_list_workstations_non_empty_request_with_auto_populated_field(): client.list_workstations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == workstations.ListWorkstationsRequest( + request_msg = workstations.ListWorkstationsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_workstations_use_cached_wrapped_rpc(): @@ -6332,9 +6372,14 @@ async def test_list_workstations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_workstations_async( - transport: str = "grpc_asyncio", request_type=workstations.ListWorkstationsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + workstations.ListWorkstationsRequest(), + {}, + ], +) +async def test_list_workstations_async(request_type, transport: str = "grpc_asyncio"): client = WorkstationsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6342,7 +6387,7 @@ async def test_list_workstations_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( @@ -6369,11 +6414,6 @@ async def test_list_workstations_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_workstations_async_from_dict(): - await test_list_workstations_async(request_type=dict) - - def test_list_workstations_field_headers(): client = WorkstationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6726,8 +6766,8 @@ async def test_list_workstations_async_pages(): @pytest.mark.parametrize( "request_type", [ - workstations.ListUsableWorkstationsRequest, - dict, + workstations.ListUsableWorkstationsRequest(), + {}, ], ) def test_list_usable_workstations(request_type, transport: str = "grpc"): @@ -6738,7 +6778,7 @@ def test_list_usable_workstations(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6789,10 +6829,11 @@ def test_list_usable_workstations_non_empty_request_with_auto_populated_field(): client.list_usable_workstations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == workstations.ListUsableWorkstationsRequest( + request_msg = workstations.ListUsableWorkstationsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_usable_workstations_use_cached_wrapped_rpc(): @@ -6878,9 +6919,15 @@ async def test_list_usable_workstations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + workstations.ListUsableWorkstationsRequest(), + {}, + ], +) async def test_list_usable_workstations_async( - transport: str = "grpc_asyncio", - request_type=workstations.ListUsableWorkstationsRequest, + request_type, transport: str = "grpc_asyncio" ): client = WorkstationsAsyncClient( credentials=async_anonymous_credentials(), @@ -6889,7 +6936,7 @@ async def test_list_usable_workstations_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( @@ -6916,11 +6963,6 @@ async def test_list_usable_workstations_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_usable_workstations_async_from_dict(): - await test_list_usable_workstations_async(request_type=dict) - - def test_list_usable_workstations_field_headers(): client = WorkstationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7275,8 +7317,8 @@ async def test_list_usable_workstations_async_pages(): @pytest.mark.parametrize( "request_type", [ - workstations.CreateWorkstationRequest, - dict, + workstations.CreateWorkstationRequest(), + {}, ], ) def test_create_workstation(request_type, transport: str = "grpc"): @@ -7287,7 +7329,7 @@ def test_create_workstation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7333,10 +7375,11 @@ def test_create_workstation_non_empty_request_with_auto_populated_field(): client.create_workstation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == workstations.CreateWorkstationRequest( + request_msg = workstations.CreateWorkstationRequest( parent="parent_value", workstation_id="workstation_id_value", ) + assert args[0] == request_msg def test_create_workstation_use_cached_wrapped_rpc(): @@ -7431,9 +7474,14 @@ async def test_create_workstation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_workstation_async( - transport: str = "grpc_asyncio", request_type=workstations.CreateWorkstationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + workstations.CreateWorkstationRequest(), + {}, + ], +) +async def test_create_workstation_async(request_type, transport: str = "grpc_asyncio"): client = WorkstationsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7441,7 +7489,7 @@ async def test_create_workstation_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( @@ -7463,11 +7511,6 @@ async def test_create_workstation_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_workstation_async_from_dict(): - await test_create_workstation_async(request_type=dict) - - def test_create_workstation_field_headers(): client = WorkstationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7642,8 +7685,8 @@ async def test_create_workstation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - workstations.UpdateWorkstationRequest, - dict, + workstations.UpdateWorkstationRequest(), + {}, ], ) def test_update_workstation(request_type, transport: str = "grpc"): @@ -7654,7 +7697,7 @@ def test_update_workstation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7697,7 +7740,8 @@ def test_update_workstation_non_empty_request_with_auto_populated_field(): client.update_workstation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == workstations.UpdateWorkstationRequest() + request_msg = workstations.UpdateWorkstationRequest() + assert args[0] == request_msg def test_update_workstation_use_cached_wrapped_rpc(): @@ -7792,9 +7836,14 @@ async def test_update_workstation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_workstation_async( - transport: str = "grpc_asyncio", request_type=workstations.UpdateWorkstationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + workstations.UpdateWorkstationRequest(), + {}, + ], +) +async def test_update_workstation_async(request_type, transport: str = "grpc_asyncio"): client = WorkstationsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7802,7 +7851,7 @@ async def test_update_workstation_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( @@ -7824,11 +7873,6 @@ async def test_update_workstation_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_workstation_async_from_dict(): - await test_update_workstation_async(request_type=dict) - - def test_update_workstation_field_headers(): client = WorkstationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7993,8 +8037,8 @@ async def test_update_workstation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - workstations.DeleteWorkstationRequest, - dict, + workstations.DeleteWorkstationRequest(), + {}, ], ) def test_delete_workstation(request_type, transport: str = "grpc"): @@ -8005,7 +8049,7 @@ def test_delete_workstation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8051,10 +8095,11 @@ def test_delete_workstation_non_empty_request_with_auto_populated_field(): client.delete_workstation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == workstations.DeleteWorkstationRequest( + request_msg = workstations.DeleteWorkstationRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_workstation_use_cached_wrapped_rpc(): @@ -8149,9 +8194,14 @@ async def test_delete_workstation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_workstation_async( - transport: str = "grpc_asyncio", request_type=workstations.DeleteWorkstationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + workstations.DeleteWorkstationRequest(), + {}, + ], +) +async def test_delete_workstation_async(request_type, transport: str = "grpc_asyncio"): client = WorkstationsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8159,7 +8209,7 @@ async def test_delete_workstation_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( @@ -8181,11 +8231,6 @@ async def test_delete_workstation_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_workstation_async_from_dict(): - await test_delete_workstation_async(request_type=dict) - - def test_delete_workstation_field_headers(): client = WorkstationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8340,8 +8385,8 @@ async def test_delete_workstation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - workstations.StartWorkstationRequest, - dict, + workstations.StartWorkstationRequest(), + {}, ], ) def test_start_workstation(request_type, transport: str = "grpc"): @@ -8352,7 +8397,7 @@ def test_start_workstation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8398,10 +8443,11 @@ def test_start_workstation_non_empty_request_with_auto_populated_field(): client.start_workstation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == workstations.StartWorkstationRequest( + request_msg = workstations.StartWorkstationRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_start_workstation_use_cached_wrapped_rpc(): @@ -8494,9 +8540,14 @@ async def test_start_workstation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_start_workstation_async( - transport: str = "grpc_asyncio", request_type=workstations.StartWorkstationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + workstations.StartWorkstationRequest(), + {}, + ], +) +async def test_start_workstation_async(request_type, transport: str = "grpc_asyncio"): client = WorkstationsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8504,7 +8555,7 @@ async def test_start_workstation_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( @@ -8526,11 +8577,6 @@ async def test_start_workstation_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_start_workstation_async_from_dict(): - await test_start_workstation_async(request_type=dict) - - def test_start_workstation_field_headers(): client = WorkstationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8685,8 +8731,8 @@ async def test_start_workstation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - workstations.StopWorkstationRequest, - dict, + workstations.StopWorkstationRequest(), + {}, ], ) def test_stop_workstation(request_type, transport: str = "grpc"): @@ -8697,7 +8743,7 @@ def test_stop_workstation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.stop_workstation), "__call__") as call: @@ -8739,10 +8785,11 @@ def test_stop_workstation_non_empty_request_with_auto_populated_field(): client.stop_workstation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == workstations.StopWorkstationRequest( + request_msg = workstations.StopWorkstationRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_stop_workstation_use_cached_wrapped_rpc(): @@ -8835,9 +8882,14 @@ async def test_stop_workstation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_stop_workstation_async( - transport: str = "grpc_asyncio", request_type=workstations.StopWorkstationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + workstations.StopWorkstationRequest(), + {}, + ], +) +async def test_stop_workstation_async(request_type, transport: str = "grpc_asyncio"): client = WorkstationsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8845,7 +8897,7 @@ async def test_stop_workstation_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.stop_workstation), "__call__") as call: @@ -8865,11 +8917,6 @@ async def test_stop_workstation_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_stop_workstation_async_from_dict(): - await test_stop_workstation_async(request_type=dict) - - def test_stop_workstation_field_headers(): client = WorkstationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9016,8 +9063,8 @@ async def test_stop_workstation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - workstations.GenerateAccessTokenRequest, - dict, + workstations.GenerateAccessTokenRequest(), + {}, ], ) def test_generate_access_token(request_type, transport: str = "grpc"): @@ -9028,7 +9075,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( @@ -9076,9 +9123,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] == workstations.GenerateAccessTokenRequest( + request_msg = workstations.GenerateAccessTokenRequest( workstation="workstation_value", ) + assert args[0] == request_msg def test_generate_access_token_use_cached_wrapped_rpc(): @@ -9164,9 +9212,15 @@ async def test_generate_access_token_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + workstations.GenerateAccessTokenRequest(), + {}, + ], +) async def test_generate_access_token_async( - transport: str = "grpc_asyncio", - request_type=workstations.GenerateAccessTokenRequest, + request_type, transport: str = "grpc_asyncio" ): client = WorkstationsAsyncClient( credentials=async_anonymous_credentials(), @@ -9175,7 +9229,7 @@ async def test_generate_access_token_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( @@ -9200,11 +9254,6 @@ async def test_generate_access_token_async( 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 = WorkstationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13797,7 +13846,6 @@ def test_get_workstation_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.GetWorkstationClusterRequest() - assert args[0] == request_msg @@ -13820,7 +13868,6 @@ def test_list_workstation_clusters_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.ListWorkstationClustersRequest() - assert args[0] == request_msg @@ -13843,7 +13890,6 @@ def test_create_workstation_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.CreateWorkstationClusterRequest() - assert args[0] == request_msg @@ -13866,7 +13912,6 @@ def test_update_workstation_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.UpdateWorkstationClusterRequest() - assert args[0] == request_msg @@ -13889,7 +13934,6 @@ def test_delete_workstation_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.DeleteWorkstationClusterRequest() - assert args[0] == request_msg @@ -13912,7 +13956,6 @@ def test_get_workstation_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.GetWorkstationConfigRequest() - assert args[0] == request_msg @@ -13935,7 +13978,6 @@ def test_list_workstation_configs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.ListWorkstationConfigsRequest() - assert args[0] == request_msg @@ -13958,7 +14000,6 @@ def test_list_usable_workstation_configs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.ListUsableWorkstationConfigsRequest() - assert args[0] == request_msg @@ -13981,7 +14022,6 @@ def test_create_workstation_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.CreateWorkstationConfigRequest() - assert args[0] == request_msg @@ -14004,7 +14044,6 @@ def test_update_workstation_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.UpdateWorkstationConfigRequest() - assert args[0] == request_msg @@ -14027,7 +14066,6 @@ def test_delete_workstation_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.DeleteWorkstationConfigRequest() - assert args[0] == request_msg @@ -14048,7 +14086,6 @@ def test_get_workstation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.GetWorkstationRequest() - assert args[0] == request_msg @@ -14071,7 +14108,6 @@ def test_list_workstations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.ListWorkstationsRequest() - assert args[0] == request_msg @@ -14094,7 +14130,6 @@ def test_list_usable_workstations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.ListUsableWorkstationsRequest() - assert args[0] == request_msg @@ -14117,7 +14152,6 @@ def test_create_workstation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.CreateWorkstationRequest() - assert args[0] == request_msg @@ -14140,7 +14174,6 @@ def test_update_workstation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.UpdateWorkstationRequest() - assert args[0] == request_msg @@ -14163,7 +14196,6 @@ def test_delete_workstation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.DeleteWorkstationRequest() - assert args[0] == request_msg @@ -14186,7 +14218,6 @@ def test_start_workstation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.StartWorkstationRequest() - assert args[0] == request_msg @@ -14207,7 +14238,6 @@ def test_stop_workstation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.StopWorkstationRequest() - assert args[0] == request_msg @@ -14230,7 +14260,6 @@ def test_generate_access_token_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.GenerateAccessTokenRequest() - assert args[0] == request_msg @@ -14281,7 +14310,6 @@ async def test_get_workstation_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.GetWorkstationClusterRequest() - assert args[0] == request_msg @@ -14311,7 +14339,6 @@ async def test_list_workstation_clusters_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.ListWorkstationClustersRequest() - assert args[0] == request_msg @@ -14338,7 +14365,6 @@ async def test_create_workstation_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.CreateWorkstationClusterRequest() - assert args[0] == request_msg @@ -14365,7 +14391,6 @@ async def test_update_workstation_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.UpdateWorkstationClusterRequest() - assert args[0] == request_msg @@ -14392,7 +14417,6 @@ async def test_delete_workstation_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.DeleteWorkstationClusterRequest() - assert args[0] == request_msg @@ -14427,7 +14451,6 @@ async def test_get_workstation_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.GetWorkstationConfigRequest() - assert args[0] == request_msg @@ -14457,7 +14480,6 @@ async def test_list_workstation_configs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.ListWorkstationConfigsRequest() - assert args[0] == request_msg @@ -14487,7 +14509,6 @@ async def test_list_usable_workstation_configs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.ListUsableWorkstationConfigsRequest() - assert args[0] == request_msg @@ -14514,7 +14535,6 @@ async def test_create_workstation_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.CreateWorkstationConfigRequest() - assert args[0] == request_msg @@ -14541,7 +14561,6 @@ async def test_update_workstation_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.UpdateWorkstationConfigRequest() - assert args[0] == request_msg @@ -14568,7 +14587,6 @@ async def test_delete_workstation_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.DeleteWorkstationConfigRequest() - assert args[0] == request_msg @@ -14601,7 +14619,6 @@ async def test_get_workstation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.GetWorkstationRequest() - assert args[0] == request_msg @@ -14631,7 +14648,6 @@ async def test_list_workstations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.ListWorkstationsRequest() - assert args[0] == request_msg @@ -14661,7 +14677,6 @@ async def test_list_usable_workstations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.ListUsableWorkstationsRequest() - assert args[0] == request_msg @@ -14688,7 +14703,6 @@ async def test_create_workstation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.CreateWorkstationRequest() - assert args[0] == request_msg @@ -14715,7 +14729,6 @@ async def test_update_workstation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.UpdateWorkstationRequest() - assert args[0] == request_msg @@ -14742,7 +14755,6 @@ async def test_delete_workstation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.DeleteWorkstationRequest() - assert args[0] == request_msg @@ -14769,7 +14781,6 @@ async def test_start_workstation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.StartWorkstationRequest() - assert args[0] == request_msg @@ -14794,7 +14805,6 @@ async def test_stop_workstation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.StopWorkstationRequest() - assert args[0] == request_msg @@ -14823,7 +14833,6 @@ async def test_generate_access_token_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.GenerateAccessTokenRequest() - assert args[0] == request_msg @@ -18709,7 +18718,6 @@ def test_get_workstation_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.GetWorkstationClusterRequest() - assert args[0] == request_msg @@ -18731,7 +18739,6 @@ def test_list_workstation_clusters_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.ListWorkstationClustersRequest() - assert args[0] == request_msg @@ -18753,7 +18760,6 @@ def test_create_workstation_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.CreateWorkstationClusterRequest() - assert args[0] == request_msg @@ -18775,7 +18781,6 @@ def test_update_workstation_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.UpdateWorkstationClusterRequest() - assert args[0] == request_msg @@ -18797,7 +18802,6 @@ def test_delete_workstation_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.DeleteWorkstationClusterRequest() - assert args[0] == request_msg @@ -18819,7 +18823,6 @@ def test_get_workstation_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.GetWorkstationConfigRequest() - assert args[0] == request_msg @@ -18841,7 +18844,6 @@ def test_list_workstation_configs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.ListWorkstationConfigsRequest() - assert args[0] == request_msg @@ -18863,7 +18865,6 @@ def test_list_usable_workstation_configs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.ListUsableWorkstationConfigsRequest() - assert args[0] == request_msg @@ -18885,7 +18886,6 @@ def test_create_workstation_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.CreateWorkstationConfigRequest() - assert args[0] == request_msg @@ -18907,7 +18907,6 @@ def test_update_workstation_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.UpdateWorkstationConfigRequest() - assert args[0] == request_msg @@ -18929,7 +18928,6 @@ def test_delete_workstation_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.DeleteWorkstationConfigRequest() - assert args[0] == request_msg @@ -18949,7 +18947,6 @@ def test_get_workstation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.GetWorkstationRequest() - assert args[0] == request_msg @@ -18971,7 +18968,6 @@ def test_list_workstations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.ListWorkstationsRequest() - assert args[0] == request_msg @@ -18993,7 +18989,6 @@ def test_list_usable_workstations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.ListUsableWorkstationsRequest() - assert args[0] == request_msg @@ -19015,7 +19010,6 @@ def test_create_workstation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.CreateWorkstationRequest() - assert args[0] == request_msg @@ -19037,7 +19031,6 @@ def test_update_workstation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.UpdateWorkstationRequest() - assert args[0] == request_msg @@ -19059,7 +19052,6 @@ def test_delete_workstation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.DeleteWorkstationRequest() - assert args[0] == request_msg @@ -19081,7 +19073,6 @@ def test_start_workstation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.StartWorkstationRequest() - assert args[0] == request_msg @@ -19101,7 +19092,6 @@ def test_stop_workstation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.StopWorkstationRequest() - assert args[0] == request_msg @@ -19123,7 +19113,6 @@ def test_generate_access_token_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.GenerateAccessTokenRequest() - assert args[0] == request_msg diff --git a/packages/google-cloud-workstations/tests/unit/gapic/workstations_v1beta/test_workstations.py b/packages/google-cloud-workstations/tests/unit/gapic/workstations_v1beta/test_workstations.py index 01cbc55741b6..a40a95643153 100644 --- a/packages/google-cloud-workstations/tests/unit/gapic/workstations_v1beta/test_workstations.py +++ b/packages/google-cloud-workstations/tests/unit/gapic/workstations_v1beta/test_workstations.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 @@ -123,6 +124,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" @@ -1303,8 +1319,8 @@ def test_workstations_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - workstations.GetWorkstationClusterRequest, - dict, + workstations.GetWorkstationClusterRequest(), + {}, ], ) def test_get_workstation_cluster(request_type, transport: str = "grpc"): @@ -1315,7 +1331,7 @@ def test_get_workstation_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1379,9 +1395,10 @@ def test_get_workstation_cluster_non_empty_request_with_auto_populated_field(): client.get_workstation_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == workstations.GetWorkstationClusterRequest( + request_msg = workstations.GetWorkstationClusterRequest( name="name_value", ) + assert args[0] == request_msg def test_get_workstation_cluster_use_cached_wrapped_rpc(): @@ -1467,9 +1484,15 @@ async def test_get_workstation_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + workstations.GetWorkstationClusterRequest(), + {}, + ], +) async def test_get_workstation_cluster_async( - transport: str = "grpc_asyncio", - request_type=workstations.GetWorkstationClusterRequest, + request_type, transport: str = "grpc_asyncio" ): client = WorkstationsAsyncClient( credentials=async_anonymous_credentials(), @@ -1478,7 +1501,7 @@ async def test_get_workstation_cluster_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( @@ -1519,11 +1542,6 @@ async def test_get_workstation_cluster_async( assert response.degraded is True -@pytest.mark.asyncio -async def test_get_workstation_cluster_async_from_dict(): - await test_get_workstation_cluster_async(request_type=dict) - - def test_get_workstation_cluster_field_headers(): client = WorkstationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1678,8 +1696,8 @@ async def test_get_workstation_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - workstations.ListWorkstationClustersRequest, - dict, + workstations.ListWorkstationClustersRequest(), + {}, ], ) def test_list_workstation_clusters(request_type, transport: str = "grpc"): @@ -1690,7 +1708,7 @@ def test_list_workstation_clusters(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1741,10 +1759,11 @@ def test_list_workstation_clusters_non_empty_request_with_auto_populated_field() client.list_workstation_clusters(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == workstations.ListWorkstationClustersRequest( + request_msg = workstations.ListWorkstationClustersRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_workstation_clusters_use_cached_wrapped_rpc(): @@ -1830,9 +1849,15 @@ async def test_list_workstation_clusters_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + workstations.ListWorkstationClustersRequest(), + {}, + ], +) async def test_list_workstation_clusters_async( - transport: str = "grpc_asyncio", - request_type=workstations.ListWorkstationClustersRequest, + request_type, transport: str = "grpc_asyncio" ): client = WorkstationsAsyncClient( credentials=async_anonymous_credentials(), @@ -1841,7 +1866,7 @@ async def test_list_workstation_clusters_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( @@ -1868,11 +1893,6 @@ async def test_list_workstation_clusters_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_workstation_clusters_async_from_dict(): - await test_list_workstation_clusters_async(request_type=dict) - - def test_list_workstation_clusters_field_headers(): client = WorkstationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2227,8 +2247,8 @@ async def test_list_workstation_clusters_async_pages(): @pytest.mark.parametrize( "request_type", [ - workstations.CreateWorkstationClusterRequest, - dict, + workstations.CreateWorkstationClusterRequest(), + {}, ], ) def test_create_workstation_cluster(request_type, transport: str = "grpc"): @@ -2239,7 +2259,7 @@ def test_create_workstation_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2285,10 +2305,11 @@ def test_create_workstation_cluster_non_empty_request_with_auto_populated_field( client.create_workstation_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == workstations.CreateWorkstationClusterRequest( + request_msg = workstations.CreateWorkstationClusterRequest( parent="parent_value", workstation_cluster_id="workstation_cluster_id_value", ) + assert args[0] == request_msg def test_create_workstation_cluster_use_cached_wrapped_rpc(): @@ -2384,9 +2405,15 @@ async def test_create_workstation_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + workstations.CreateWorkstationClusterRequest(), + {}, + ], +) async def test_create_workstation_cluster_async( - transport: str = "grpc_asyncio", - request_type=workstations.CreateWorkstationClusterRequest, + request_type, transport: str = "grpc_asyncio" ): client = WorkstationsAsyncClient( credentials=async_anonymous_credentials(), @@ -2395,7 +2422,7 @@ async def test_create_workstation_cluster_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( @@ -2417,11 +2444,6 @@ async def test_create_workstation_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_workstation_cluster_async_from_dict(): - await test_create_workstation_cluster_async(request_type=dict) - - def test_create_workstation_cluster_field_headers(): client = WorkstationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2596,8 +2618,8 @@ async def test_create_workstation_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - workstations.UpdateWorkstationClusterRequest, - dict, + workstations.UpdateWorkstationClusterRequest(), + {}, ], ) def test_update_workstation_cluster(request_type, transport: str = "grpc"): @@ -2608,7 +2630,7 @@ def test_update_workstation_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2651,7 +2673,8 @@ def test_update_workstation_cluster_non_empty_request_with_auto_populated_field( client.update_workstation_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == workstations.UpdateWorkstationClusterRequest() + request_msg = workstations.UpdateWorkstationClusterRequest() + assert args[0] == request_msg def test_update_workstation_cluster_use_cached_wrapped_rpc(): @@ -2747,9 +2770,15 @@ async def test_update_workstation_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + workstations.UpdateWorkstationClusterRequest(), + {}, + ], +) async def test_update_workstation_cluster_async( - transport: str = "grpc_asyncio", - request_type=workstations.UpdateWorkstationClusterRequest, + request_type, transport: str = "grpc_asyncio" ): client = WorkstationsAsyncClient( credentials=async_anonymous_credentials(), @@ -2758,7 +2787,7 @@ async def test_update_workstation_cluster_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( @@ -2780,11 +2809,6 @@ async def test_update_workstation_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_workstation_cluster_async_from_dict(): - await test_update_workstation_cluster_async(request_type=dict) - - def test_update_workstation_cluster_field_headers(): client = WorkstationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2949,8 +2973,8 @@ async def test_update_workstation_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - workstations.DeleteWorkstationClusterRequest, - dict, + workstations.DeleteWorkstationClusterRequest(), + {}, ], ) def test_delete_workstation_cluster(request_type, transport: str = "grpc"): @@ -2961,7 +2985,7 @@ def test_delete_workstation_cluster(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3007,10 +3031,11 @@ def test_delete_workstation_cluster_non_empty_request_with_auto_populated_field( client.delete_workstation_cluster(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == workstations.DeleteWorkstationClusterRequest( + request_msg = workstations.DeleteWorkstationClusterRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_workstation_cluster_use_cached_wrapped_rpc(): @@ -3106,9 +3131,15 @@ async def test_delete_workstation_cluster_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + workstations.DeleteWorkstationClusterRequest(), + {}, + ], +) async def test_delete_workstation_cluster_async( - transport: str = "grpc_asyncio", - request_type=workstations.DeleteWorkstationClusterRequest, + request_type, transport: str = "grpc_asyncio" ): client = WorkstationsAsyncClient( credentials=async_anonymous_credentials(), @@ -3117,7 +3148,7 @@ async def test_delete_workstation_cluster_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( @@ -3139,11 +3170,6 @@ async def test_delete_workstation_cluster_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_workstation_cluster_async_from_dict(): - await test_delete_workstation_cluster_async(request_type=dict) - - def test_delete_workstation_cluster_field_headers(): client = WorkstationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3298,8 +3324,8 @@ async def test_delete_workstation_cluster_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - workstations.GetWorkstationConfigRequest, - dict, + workstations.GetWorkstationConfigRequest(), + {}, ], ) def test_get_workstation_config(request_type, transport: str = "grpc"): @@ -3310,7 +3336,7 @@ def test_get_workstation_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( @@ -3372,9 +3398,10 @@ def test_get_workstation_config_non_empty_request_with_auto_populated_field(): client.get_workstation_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == workstations.GetWorkstationConfigRequest( + request_msg = workstations.GetWorkstationConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_workstation_config_use_cached_wrapped_rpc(): @@ -3460,9 +3487,15 @@ async def test_get_workstation_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + workstations.GetWorkstationConfigRequest(), + {}, + ], +) async def test_get_workstation_config_async( - transport: str = "grpc_asyncio", - request_type=workstations.GetWorkstationConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = WorkstationsAsyncClient( credentials=async_anonymous_credentials(), @@ -3471,7 +3504,7 @@ async def test_get_workstation_config_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( @@ -3510,11 +3543,6 @@ async def test_get_workstation_config_async( assert response.enable_audit_agent is True -@pytest.mark.asyncio -async def test_get_workstation_config_async_from_dict(): - await test_get_workstation_config_async(request_type=dict) - - def test_get_workstation_config_field_headers(): client = WorkstationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3669,8 +3697,8 @@ async def test_get_workstation_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - workstations.ListWorkstationConfigsRequest, - dict, + workstations.ListWorkstationConfigsRequest(), + {}, ], ) def test_list_workstation_configs(request_type, transport: str = "grpc"): @@ -3681,7 +3709,7 @@ def test_list_workstation_configs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3732,10 +3760,11 @@ def test_list_workstation_configs_non_empty_request_with_auto_populated_field(): client.list_workstation_configs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == workstations.ListWorkstationConfigsRequest( + request_msg = workstations.ListWorkstationConfigsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_workstation_configs_use_cached_wrapped_rpc(): @@ -3821,9 +3850,15 @@ async def test_list_workstation_configs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + workstations.ListWorkstationConfigsRequest(), + {}, + ], +) async def test_list_workstation_configs_async( - transport: str = "grpc_asyncio", - request_type=workstations.ListWorkstationConfigsRequest, + request_type, transport: str = "grpc_asyncio" ): client = WorkstationsAsyncClient( credentials=async_anonymous_credentials(), @@ -3832,7 +3867,7 @@ async def test_list_workstation_configs_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( @@ -3859,11 +3894,6 @@ async def test_list_workstation_configs_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_workstation_configs_async_from_dict(): - await test_list_workstation_configs_async(request_type=dict) - - def test_list_workstation_configs_field_headers(): client = WorkstationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4218,8 +4248,8 @@ async def test_list_workstation_configs_async_pages(): @pytest.mark.parametrize( "request_type", [ - workstations.ListUsableWorkstationConfigsRequest, - dict, + workstations.ListUsableWorkstationConfigsRequest(), + {}, ], ) def test_list_usable_workstation_configs(request_type, transport: str = "grpc"): @@ -4230,7 +4260,7 @@ def test_list_usable_workstation_configs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4281,10 +4311,11 @@ def test_list_usable_workstation_configs_non_empty_request_with_auto_populated_f client.list_usable_workstation_configs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == workstations.ListUsableWorkstationConfigsRequest( + request_msg = workstations.ListUsableWorkstationConfigsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_usable_workstation_configs_use_cached_wrapped_rpc(): @@ -4370,9 +4401,15 @@ async def test_list_usable_workstation_configs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + workstations.ListUsableWorkstationConfigsRequest(), + {}, + ], +) async def test_list_usable_workstation_configs_async( - transport: str = "grpc_asyncio", - request_type=workstations.ListUsableWorkstationConfigsRequest, + request_type, transport: str = "grpc_asyncio" ): client = WorkstationsAsyncClient( credentials=async_anonymous_credentials(), @@ -4381,7 +4418,7 @@ async def test_list_usable_workstation_configs_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( @@ -4408,11 +4445,6 @@ async def test_list_usable_workstation_configs_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_usable_workstation_configs_async_from_dict(): - await test_list_usable_workstation_configs_async(request_type=dict) - - def test_list_usable_workstation_configs_field_headers(): client = WorkstationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4769,8 +4801,8 @@ async def test_list_usable_workstation_configs_async_pages(): @pytest.mark.parametrize( "request_type", [ - workstations.CreateWorkstationConfigRequest, - dict, + workstations.CreateWorkstationConfigRequest(), + {}, ], ) def test_create_workstation_config(request_type, transport: str = "grpc"): @@ -4781,7 +4813,7 @@ def test_create_workstation_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( @@ -4827,10 +4859,11 @@ def test_create_workstation_config_non_empty_request_with_auto_populated_field() client.create_workstation_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == workstations.CreateWorkstationConfigRequest( + request_msg = workstations.CreateWorkstationConfigRequest( parent="parent_value", workstation_config_id="workstation_config_id_value", ) + assert args[0] == request_msg def test_create_workstation_config_use_cached_wrapped_rpc(): @@ -4926,9 +4959,15 @@ async def test_create_workstation_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + workstations.CreateWorkstationConfigRequest(), + {}, + ], +) async def test_create_workstation_config_async( - transport: str = "grpc_asyncio", - request_type=workstations.CreateWorkstationConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = WorkstationsAsyncClient( credentials=async_anonymous_credentials(), @@ -4937,7 +4976,7 @@ async def test_create_workstation_config_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( @@ -4959,11 +4998,6 @@ async def test_create_workstation_config_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_workstation_config_async_from_dict(): - await test_create_workstation_config_async(request_type=dict) - - def test_create_workstation_config_field_headers(): client = WorkstationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5138,8 +5172,8 @@ async def test_create_workstation_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - workstations.UpdateWorkstationConfigRequest, - dict, + workstations.UpdateWorkstationConfigRequest(), + {}, ], ) def test_update_workstation_config(request_type, transport: str = "grpc"): @@ -5150,7 +5184,7 @@ def test_update_workstation_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( @@ -5193,7 +5227,8 @@ def test_update_workstation_config_non_empty_request_with_auto_populated_field() client.update_workstation_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == workstations.UpdateWorkstationConfigRequest() + request_msg = workstations.UpdateWorkstationConfigRequest() + assert args[0] == request_msg def test_update_workstation_config_use_cached_wrapped_rpc(): @@ -5289,9 +5324,15 @@ async def test_update_workstation_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + workstations.UpdateWorkstationConfigRequest(), + {}, + ], +) async def test_update_workstation_config_async( - transport: str = "grpc_asyncio", - request_type=workstations.UpdateWorkstationConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = WorkstationsAsyncClient( credentials=async_anonymous_credentials(), @@ -5300,7 +5341,7 @@ async def test_update_workstation_config_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( @@ -5322,11 +5363,6 @@ async def test_update_workstation_config_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_workstation_config_async_from_dict(): - await test_update_workstation_config_async(request_type=dict) - - def test_update_workstation_config_field_headers(): client = WorkstationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5491,8 +5527,8 @@ async def test_update_workstation_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - workstations.DeleteWorkstationConfigRequest, - dict, + workstations.DeleteWorkstationConfigRequest(), + {}, ], ) def test_delete_workstation_config(request_type, transport: str = "grpc"): @@ -5503,7 +5539,7 @@ def test_delete_workstation_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( @@ -5549,10 +5585,11 @@ def test_delete_workstation_config_non_empty_request_with_auto_populated_field() client.delete_workstation_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == workstations.DeleteWorkstationConfigRequest( + request_msg = workstations.DeleteWorkstationConfigRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_workstation_config_use_cached_wrapped_rpc(): @@ -5648,9 +5685,15 @@ async def test_delete_workstation_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + workstations.DeleteWorkstationConfigRequest(), + {}, + ], +) async def test_delete_workstation_config_async( - transport: str = "grpc_asyncio", - request_type=workstations.DeleteWorkstationConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = WorkstationsAsyncClient( credentials=async_anonymous_credentials(), @@ -5659,7 +5702,7 @@ async def test_delete_workstation_config_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( @@ -5681,11 +5724,6 @@ async def test_delete_workstation_config_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_workstation_config_async_from_dict(): - await test_delete_workstation_config_async(request_type=dict) - - def test_delete_workstation_config_field_headers(): client = WorkstationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5840,8 +5878,8 @@ async def test_delete_workstation_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - workstations.GetWorkstationRequest, - dict, + workstations.GetWorkstationRequest(), + {}, ], ) def test_get_workstation(request_type, transport: str = "grpc"): @@ -5852,7 +5890,7 @@ def test_get_workstation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_workstation), "__call__") as call: @@ -5908,9 +5946,10 @@ def test_get_workstation_non_empty_request_with_auto_populated_field(): client.get_workstation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == workstations.GetWorkstationRequest( + request_msg = workstations.GetWorkstationRequest( name="name_value", ) + assert args[0] == request_msg def test_get_workstation_use_cached_wrapped_rpc(): @@ -5991,9 +6030,14 @@ async def test_get_workstation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_workstation_async( - transport: str = "grpc_asyncio", request_type=workstations.GetWorkstationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + workstations.GetWorkstationRequest(), + {}, + ], +) +async def test_get_workstation_async(request_type, transport: str = "grpc_asyncio"): client = WorkstationsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6001,7 +6045,7 @@ async def test_get_workstation_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_workstation), "__call__") as call: @@ -6036,11 +6080,6 @@ async def test_get_workstation_async( assert response.host == "host_value" -@pytest.mark.asyncio -async def test_get_workstation_async_from_dict(): - await test_get_workstation_async(request_type=dict) - - def test_get_workstation_field_headers(): client = WorkstationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6187,8 +6226,8 @@ async def test_get_workstation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - workstations.ListWorkstationsRequest, - dict, + workstations.ListWorkstationsRequest(), + {}, ], ) def test_list_workstations(request_type, transport: str = "grpc"): @@ -6199,7 +6238,7 @@ def test_list_workstations(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6250,10 +6289,11 @@ def test_list_workstations_non_empty_request_with_auto_populated_field(): client.list_workstations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == workstations.ListWorkstationsRequest( + request_msg = workstations.ListWorkstationsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_workstations_use_cached_wrapped_rpc(): @@ -6336,9 +6376,14 @@ async def test_list_workstations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_workstations_async( - transport: str = "grpc_asyncio", request_type=workstations.ListWorkstationsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + workstations.ListWorkstationsRequest(), + {}, + ], +) +async def test_list_workstations_async(request_type, transport: str = "grpc_asyncio"): client = WorkstationsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -6346,7 +6391,7 @@ async def test_list_workstations_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( @@ -6373,11 +6418,6 @@ async def test_list_workstations_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_workstations_async_from_dict(): - await test_list_workstations_async(request_type=dict) - - def test_list_workstations_field_headers(): client = WorkstationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6730,8 +6770,8 @@ async def test_list_workstations_async_pages(): @pytest.mark.parametrize( "request_type", [ - workstations.ListUsableWorkstationsRequest, - dict, + workstations.ListUsableWorkstationsRequest(), + {}, ], ) def test_list_usable_workstations(request_type, transport: str = "grpc"): @@ -6742,7 +6782,7 @@ def test_list_usable_workstations(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6793,10 +6833,11 @@ def test_list_usable_workstations_non_empty_request_with_auto_populated_field(): client.list_usable_workstations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == workstations.ListUsableWorkstationsRequest( + request_msg = workstations.ListUsableWorkstationsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_usable_workstations_use_cached_wrapped_rpc(): @@ -6882,9 +6923,15 @@ async def test_list_usable_workstations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + workstations.ListUsableWorkstationsRequest(), + {}, + ], +) async def test_list_usable_workstations_async( - transport: str = "grpc_asyncio", - request_type=workstations.ListUsableWorkstationsRequest, + request_type, transport: str = "grpc_asyncio" ): client = WorkstationsAsyncClient( credentials=async_anonymous_credentials(), @@ -6893,7 +6940,7 @@ async def test_list_usable_workstations_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( @@ -6920,11 +6967,6 @@ async def test_list_usable_workstations_async( assert response.unreachable == ["unreachable_value"] -@pytest.mark.asyncio -async def test_list_usable_workstations_async_from_dict(): - await test_list_usable_workstations_async(request_type=dict) - - def test_list_usable_workstations_field_headers(): client = WorkstationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7279,8 +7321,8 @@ async def test_list_usable_workstations_async_pages(): @pytest.mark.parametrize( "request_type", [ - workstations.CreateWorkstationRequest, - dict, + workstations.CreateWorkstationRequest(), + {}, ], ) def test_create_workstation(request_type, transport: str = "grpc"): @@ -7291,7 +7333,7 @@ def test_create_workstation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7337,10 +7379,11 @@ def test_create_workstation_non_empty_request_with_auto_populated_field(): client.create_workstation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == workstations.CreateWorkstationRequest( + request_msg = workstations.CreateWorkstationRequest( parent="parent_value", workstation_id="workstation_id_value", ) + assert args[0] == request_msg def test_create_workstation_use_cached_wrapped_rpc(): @@ -7435,9 +7478,14 @@ async def test_create_workstation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_workstation_async( - transport: str = "grpc_asyncio", request_type=workstations.CreateWorkstationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + workstations.CreateWorkstationRequest(), + {}, + ], +) +async def test_create_workstation_async(request_type, transport: str = "grpc_asyncio"): client = WorkstationsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7445,7 +7493,7 @@ async def test_create_workstation_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( @@ -7467,11 +7515,6 @@ async def test_create_workstation_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_create_workstation_async_from_dict(): - await test_create_workstation_async(request_type=dict) - - def test_create_workstation_field_headers(): client = WorkstationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7646,8 +7689,8 @@ async def test_create_workstation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - workstations.UpdateWorkstationRequest, - dict, + workstations.UpdateWorkstationRequest(), + {}, ], ) def test_update_workstation(request_type, transport: str = "grpc"): @@ -7658,7 +7701,7 @@ def test_update_workstation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7701,7 +7744,8 @@ def test_update_workstation_non_empty_request_with_auto_populated_field(): client.update_workstation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == workstations.UpdateWorkstationRequest() + request_msg = workstations.UpdateWorkstationRequest() + assert args[0] == request_msg def test_update_workstation_use_cached_wrapped_rpc(): @@ -7796,9 +7840,14 @@ async def test_update_workstation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_workstation_async( - transport: str = "grpc_asyncio", request_type=workstations.UpdateWorkstationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + workstations.UpdateWorkstationRequest(), + {}, + ], +) +async def test_update_workstation_async(request_type, transport: str = "grpc_asyncio"): client = WorkstationsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -7806,7 +7855,7 @@ async def test_update_workstation_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( @@ -7828,11 +7877,6 @@ async def test_update_workstation_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_update_workstation_async_from_dict(): - await test_update_workstation_async(request_type=dict) - - def test_update_workstation_field_headers(): client = WorkstationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7997,8 +8041,8 @@ async def test_update_workstation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - workstations.DeleteWorkstationRequest, - dict, + workstations.DeleteWorkstationRequest(), + {}, ], ) def test_delete_workstation(request_type, transport: str = "grpc"): @@ -8009,7 +8053,7 @@ def test_delete_workstation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8055,10 +8099,11 @@ def test_delete_workstation_non_empty_request_with_auto_populated_field(): client.delete_workstation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == workstations.DeleteWorkstationRequest( + request_msg = workstations.DeleteWorkstationRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_delete_workstation_use_cached_wrapped_rpc(): @@ -8153,9 +8198,14 @@ async def test_delete_workstation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_workstation_async( - transport: str = "grpc_asyncio", request_type=workstations.DeleteWorkstationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + workstations.DeleteWorkstationRequest(), + {}, + ], +) +async def test_delete_workstation_async(request_type, transport: str = "grpc_asyncio"): client = WorkstationsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8163,7 +8213,7 @@ async def test_delete_workstation_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( @@ -8185,11 +8235,6 @@ async def test_delete_workstation_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_delete_workstation_async_from_dict(): - await test_delete_workstation_async(request_type=dict) - - def test_delete_workstation_field_headers(): client = WorkstationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8344,8 +8389,8 @@ async def test_delete_workstation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - workstations.StartWorkstationRequest, - dict, + workstations.StartWorkstationRequest(), + {}, ], ) def test_start_workstation(request_type, transport: str = "grpc"): @@ -8356,7 +8401,7 @@ def test_start_workstation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8402,10 +8447,11 @@ def test_start_workstation_non_empty_request_with_auto_populated_field(): client.start_workstation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == workstations.StartWorkstationRequest( + request_msg = workstations.StartWorkstationRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_start_workstation_use_cached_wrapped_rpc(): @@ -8498,9 +8544,14 @@ async def test_start_workstation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_start_workstation_async( - transport: str = "grpc_asyncio", request_type=workstations.StartWorkstationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + workstations.StartWorkstationRequest(), + {}, + ], +) +async def test_start_workstation_async(request_type, transport: str = "grpc_asyncio"): client = WorkstationsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8508,7 +8559,7 @@ async def test_start_workstation_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( @@ -8530,11 +8581,6 @@ async def test_start_workstation_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_start_workstation_async_from_dict(): - await test_start_workstation_async(request_type=dict) - - def test_start_workstation_field_headers(): client = WorkstationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8689,8 +8735,8 @@ async def test_start_workstation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - workstations.StopWorkstationRequest, - dict, + workstations.StopWorkstationRequest(), + {}, ], ) def test_stop_workstation(request_type, transport: str = "grpc"): @@ -8701,7 +8747,7 @@ def test_stop_workstation(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.stop_workstation), "__call__") as call: @@ -8743,10 +8789,11 @@ def test_stop_workstation_non_empty_request_with_auto_populated_field(): client.stop_workstation(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == workstations.StopWorkstationRequest( + request_msg = workstations.StopWorkstationRequest( name="name_value", etag="etag_value", ) + assert args[0] == request_msg def test_stop_workstation_use_cached_wrapped_rpc(): @@ -8839,9 +8886,14 @@ async def test_stop_workstation_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_stop_workstation_async( - transport: str = "grpc_asyncio", request_type=workstations.StopWorkstationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + workstations.StopWorkstationRequest(), + {}, + ], +) +async def test_stop_workstation_async(request_type, transport: str = "grpc_asyncio"): client = WorkstationsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -8849,7 +8901,7 @@ async def test_stop_workstation_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.stop_workstation), "__call__") as call: @@ -8869,11 +8921,6 @@ async def test_stop_workstation_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_stop_workstation_async_from_dict(): - await test_stop_workstation_async(request_type=dict) - - def test_stop_workstation_field_headers(): client = WorkstationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9020,8 +9067,8 @@ async def test_stop_workstation_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - workstations.GenerateAccessTokenRequest, - dict, + workstations.GenerateAccessTokenRequest(), + {}, ], ) def test_generate_access_token(request_type, transport: str = "grpc"): @@ -9032,7 +9079,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( @@ -9080,9 +9127,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] == workstations.GenerateAccessTokenRequest( + request_msg = workstations.GenerateAccessTokenRequest( workstation="workstation_value", ) + assert args[0] == request_msg def test_generate_access_token_use_cached_wrapped_rpc(): @@ -9168,9 +9216,15 @@ async def test_generate_access_token_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + workstations.GenerateAccessTokenRequest(), + {}, + ], +) async def test_generate_access_token_async( - transport: str = "grpc_asyncio", - request_type=workstations.GenerateAccessTokenRequest, + request_type, transport: str = "grpc_asyncio" ): client = WorkstationsAsyncClient( credentials=async_anonymous_credentials(), @@ -9179,7 +9233,7 @@ async def test_generate_access_token_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( @@ -9204,11 +9258,6 @@ async def test_generate_access_token_async( 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 = WorkstationsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13801,7 +13850,6 @@ def test_get_workstation_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.GetWorkstationClusterRequest() - assert args[0] == request_msg @@ -13824,7 +13872,6 @@ def test_list_workstation_clusters_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.ListWorkstationClustersRequest() - assert args[0] == request_msg @@ -13847,7 +13894,6 @@ def test_create_workstation_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.CreateWorkstationClusterRequest() - assert args[0] == request_msg @@ -13870,7 +13916,6 @@ def test_update_workstation_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.UpdateWorkstationClusterRequest() - assert args[0] == request_msg @@ -13893,7 +13938,6 @@ def test_delete_workstation_cluster_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.DeleteWorkstationClusterRequest() - assert args[0] == request_msg @@ -13916,7 +13960,6 @@ def test_get_workstation_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.GetWorkstationConfigRequest() - assert args[0] == request_msg @@ -13939,7 +13982,6 @@ def test_list_workstation_configs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.ListWorkstationConfigsRequest() - assert args[0] == request_msg @@ -13962,7 +14004,6 @@ def test_list_usable_workstation_configs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.ListUsableWorkstationConfigsRequest() - assert args[0] == request_msg @@ -13985,7 +14026,6 @@ def test_create_workstation_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.CreateWorkstationConfigRequest() - assert args[0] == request_msg @@ -14008,7 +14048,6 @@ def test_update_workstation_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.UpdateWorkstationConfigRequest() - assert args[0] == request_msg @@ -14031,7 +14070,6 @@ def test_delete_workstation_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.DeleteWorkstationConfigRequest() - assert args[0] == request_msg @@ -14052,7 +14090,6 @@ def test_get_workstation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.GetWorkstationRequest() - assert args[0] == request_msg @@ -14075,7 +14112,6 @@ def test_list_workstations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.ListWorkstationsRequest() - assert args[0] == request_msg @@ -14098,7 +14134,6 @@ def test_list_usable_workstations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.ListUsableWorkstationsRequest() - assert args[0] == request_msg @@ -14121,7 +14156,6 @@ def test_create_workstation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.CreateWorkstationRequest() - assert args[0] == request_msg @@ -14144,7 +14178,6 @@ def test_update_workstation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.UpdateWorkstationRequest() - assert args[0] == request_msg @@ -14167,7 +14200,6 @@ def test_delete_workstation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.DeleteWorkstationRequest() - assert args[0] == request_msg @@ -14190,7 +14222,6 @@ def test_start_workstation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.StartWorkstationRequest() - assert args[0] == request_msg @@ -14211,7 +14242,6 @@ def test_stop_workstation_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.StopWorkstationRequest() - assert args[0] == request_msg @@ -14234,7 +14264,6 @@ def test_generate_access_token_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.GenerateAccessTokenRequest() - assert args[0] == request_msg @@ -14285,7 +14314,6 @@ async def test_get_workstation_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.GetWorkstationClusterRequest() - assert args[0] == request_msg @@ -14315,7 +14343,6 @@ async def test_list_workstation_clusters_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.ListWorkstationClustersRequest() - assert args[0] == request_msg @@ -14342,7 +14369,6 @@ async def test_create_workstation_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.CreateWorkstationClusterRequest() - assert args[0] == request_msg @@ -14369,7 +14395,6 @@ async def test_update_workstation_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.UpdateWorkstationClusterRequest() - assert args[0] == request_msg @@ -14396,7 +14421,6 @@ async def test_delete_workstation_cluster_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.DeleteWorkstationClusterRequest() - assert args[0] == request_msg @@ -14432,7 +14456,6 @@ async def test_get_workstation_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.GetWorkstationConfigRequest() - assert args[0] == request_msg @@ -14462,7 +14485,6 @@ async def test_list_workstation_configs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.ListWorkstationConfigsRequest() - assert args[0] == request_msg @@ -14492,7 +14514,6 @@ async def test_list_usable_workstation_configs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.ListUsableWorkstationConfigsRequest() - assert args[0] == request_msg @@ -14519,7 +14540,6 @@ async def test_create_workstation_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.CreateWorkstationConfigRequest() - assert args[0] == request_msg @@ -14546,7 +14566,6 @@ async def test_update_workstation_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.UpdateWorkstationConfigRequest() - assert args[0] == request_msg @@ -14573,7 +14592,6 @@ async def test_delete_workstation_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.DeleteWorkstationConfigRequest() - assert args[0] == request_msg @@ -14606,7 +14624,6 @@ async def test_get_workstation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.GetWorkstationRequest() - assert args[0] == request_msg @@ -14636,7 +14653,6 @@ async def test_list_workstations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.ListWorkstationsRequest() - assert args[0] == request_msg @@ -14666,7 +14682,6 @@ async def test_list_usable_workstations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.ListUsableWorkstationsRequest() - assert args[0] == request_msg @@ -14693,7 +14708,6 @@ async def test_create_workstation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.CreateWorkstationRequest() - assert args[0] == request_msg @@ -14720,7 +14734,6 @@ async def test_update_workstation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.UpdateWorkstationRequest() - assert args[0] == request_msg @@ -14747,7 +14760,6 @@ async def test_delete_workstation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.DeleteWorkstationRequest() - assert args[0] == request_msg @@ -14774,7 +14786,6 @@ async def test_start_workstation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.StartWorkstationRequest() - assert args[0] == request_msg @@ -14799,7 +14810,6 @@ async def test_stop_workstation_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.StopWorkstationRequest() - assert args[0] == request_msg @@ -14828,7 +14838,6 @@ async def test_generate_access_token_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.GenerateAccessTokenRequest() - assert args[0] == request_msg @@ -18744,7 +18753,6 @@ def test_get_workstation_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.GetWorkstationClusterRequest() - assert args[0] == request_msg @@ -18766,7 +18774,6 @@ def test_list_workstation_clusters_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.ListWorkstationClustersRequest() - assert args[0] == request_msg @@ -18788,7 +18795,6 @@ def test_create_workstation_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.CreateWorkstationClusterRequest() - assert args[0] == request_msg @@ -18810,7 +18816,6 @@ def test_update_workstation_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.UpdateWorkstationClusterRequest() - assert args[0] == request_msg @@ -18832,7 +18837,6 @@ def test_delete_workstation_cluster_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.DeleteWorkstationClusterRequest() - assert args[0] == request_msg @@ -18854,7 +18858,6 @@ def test_get_workstation_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.GetWorkstationConfigRequest() - assert args[0] == request_msg @@ -18876,7 +18879,6 @@ def test_list_workstation_configs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.ListWorkstationConfigsRequest() - assert args[0] == request_msg @@ -18898,7 +18900,6 @@ def test_list_usable_workstation_configs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.ListUsableWorkstationConfigsRequest() - assert args[0] == request_msg @@ -18920,7 +18921,6 @@ def test_create_workstation_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.CreateWorkstationConfigRequest() - assert args[0] == request_msg @@ -18942,7 +18942,6 @@ def test_update_workstation_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.UpdateWorkstationConfigRequest() - assert args[0] == request_msg @@ -18964,7 +18963,6 @@ def test_delete_workstation_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.DeleteWorkstationConfigRequest() - assert args[0] == request_msg @@ -18984,7 +18982,6 @@ def test_get_workstation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.GetWorkstationRequest() - assert args[0] == request_msg @@ -19006,7 +19003,6 @@ def test_list_workstations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.ListWorkstationsRequest() - assert args[0] == request_msg @@ -19028,7 +19024,6 @@ def test_list_usable_workstations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.ListUsableWorkstationsRequest() - assert args[0] == request_msg @@ -19050,7 +19045,6 @@ def test_create_workstation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.CreateWorkstationRequest() - assert args[0] == request_msg @@ -19072,7 +19066,6 @@ def test_update_workstation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.UpdateWorkstationRequest() - assert args[0] == request_msg @@ -19094,7 +19087,6 @@ def test_delete_workstation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.DeleteWorkstationRequest() - assert args[0] == request_msg @@ -19116,7 +19108,6 @@ def test_start_workstation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.StartWorkstationRequest() - assert args[0] == request_msg @@ -19136,7 +19127,6 @@ def test_stop_workstation_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.StopWorkstationRequest() - assert args[0] == request_msg @@ -19158,7 +19148,6 @@ def test_generate_access_token_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = workstations.GenerateAccessTokenRequest() - assert args[0] == request_msg diff --git a/packages/google-geo-type/noxfile.py b/packages/google-geo-type/noxfile.py index a7af3d843554..c7dd9bef9aaa 100644 --- a/packages/google-geo-type/noxfile.py +++ b/packages/google-geo-type/noxfile.py @@ -47,7 +47,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-geo-type" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-geo-type/setup.py b/packages/google-geo-type/setup.py index 08db0bb0abbb..ead51acc329a 100644 --- a/packages/google-geo-type/setup.py +++ b/packages/google-geo-type/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/google-geo-type/testing/constraints-3.10.txt b/packages/google-geo-type/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-geo-type/testing/constraints-3.10.txt +++ b/packages/google-geo-type/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-maps-addressvalidation/noxfile.py b/packages/google-maps-addressvalidation/noxfile.py index ca1d4488667c..680ee645d9d6 100644 --- a/packages/google-maps-addressvalidation/noxfile.py +++ b/packages/google-maps-addressvalidation/noxfile.py @@ -47,7 +47,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-maps-addressvalidation" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-maps-addressvalidation/setup.py b/packages/google-maps-addressvalidation/setup.py index 1a441ea27292..bd661bcc6605 100644 --- a/packages/google-maps-addressvalidation/setup.py +++ b/packages/google-maps-addressvalidation/setup.py @@ -45,7 +45,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/google-maps-addressvalidation/testing/constraints-3.10.txt b/packages/google-maps-addressvalidation/testing/constraints-3.10.txt index 1a86e8abbcf5..ea5951376612 100644 --- a/packages/google-maps-addressvalidation/testing/constraints-3.10.txt +++ b/packages/google-maps-addressvalidation/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-geo-type==0.1.0 diff --git a/packages/google-maps-addressvalidation/tests/unit/gapic/addressvalidation_v1/test_address_validation.py b/packages/google-maps-addressvalidation/tests/unit/gapic/addressvalidation_v1/test_address_validation.py index 4cafefde0967..405bc801ac72 100644 --- a/packages/google-maps-addressvalidation/tests/unit/gapic/addressvalidation_v1/test_address_validation.py +++ b/packages/google-maps-addressvalidation/tests/unit/gapic/addressvalidation_v1/test_address_validation.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 @@ -107,6 +108,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" @@ -1348,8 +1364,8 @@ def test_address_validation_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - address_validation_service.ValidateAddressRequest, - dict, + address_validation_service.ValidateAddressRequest(), + {}, ], ) def test_validate_address(request_type, transport: str = "grpc"): @@ -1360,7 +1376,7 @@ def test_validate_address(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.validate_address), "__call__") as call: @@ -1405,10 +1421,11 @@ def test_validate_address_non_empty_request_with_auto_populated_field(): client.validate_address(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == address_validation_service.ValidateAddressRequest( + request_msg = address_validation_service.ValidateAddressRequest( previous_response_id="previous_response_id_value", session_token="session_token_value", ) + assert args[0] == request_msg def test_validate_address_use_cached_wrapped_rpc(): @@ -1491,10 +1508,14 @@ async def test_validate_address_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_validate_address_async( - transport: str = "grpc_asyncio", - request_type=address_validation_service.ValidateAddressRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + address_validation_service.ValidateAddressRequest(), + {}, + ], +) +async def test_validate_address_async(request_type, transport: str = "grpc_asyncio"): client = AddressValidationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1502,7 +1523,7 @@ async def test_validate_address_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.validate_address), "__call__") as call: @@ -1525,16 +1546,11 @@ async def test_validate_address_async( assert response.response_id == "response_id_value" -@pytest.mark.asyncio -async def test_validate_address_async_from_dict(): - await test_validate_address_async(request_type=dict) - - @pytest.mark.parametrize( "request_type", [ - address_validation_service.ProvideValidationFeedbackRequest, - dict, + address_validation_service.ProvideValidationFeedbackRequest(), + {}, ], ) def test_provide_validation_feedback(request_type, transport: str = "grpc"): @@ -1545,7 +1561,7 @@ def test_provide_validation_feedback(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1594,9 +1610,10 @@ def test_provide_validation_feedback_non_empty_request_with_auto_populated_field client.provide_validation_feedback(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == address_validation_service.ProvideValidationFeedbackRequest( + request_msg = address_validation_service.ProvideValidationFeedbackRequest( response_id="response_id_value", ) + assert args[0] == request_msg def test_provide_validation_feedback_use_cached_wrapped_rpc(): @@ -1682,9 +1699,15 @@ async def test_provide_validation_feedback_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + address_validation_service.ProvideValidationFeedbackRequest(), + {}, + ], +) async def test_provide_validation_feedback_async( - transport: str = "grpc_asyncio", - request_type=address_validation_service.ProvideValidationFeedbackRequest, + request_type, transport: str = "grpc_asyncio" ): client = AddressValidationAsyncClient( credentials=async_anonymous_credentials(), @@ -1693,7 +1716,7 @@ async def test_provide_validation_feedback_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( @@ -1717,11 +1740,6 @@ async def test_provide_validation_feedback_async( ) -@pytest.mark.asyncio -async def test_provide_validation_feedback_async_from_dict(): - await test_provide_validation_feedback_async(request_type=dict) - - def test_validate_address_rest_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, # instead of constructing them on each call @@ -2103,7 +2121,6 @@ def test_validate_address_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = address_validation_service.ValidateAddressRequest() - assert args[0] == request_msg @@ -2128,7 +2145,6 @@ def test_provide_validation_feedback_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = address_validation_service.ProvideValidationFeedbackRequest() - assert args[0] == request_msg @@ -2169,7 +2185,6 @@ async def test_validate_address_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = address_validation_service.ValidateAddressRequest() - assert args[0] == request_msg @@ -2196,7 +2211,6 @@ async def test_provide_validation_feedback_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = address_validation_service.ProvideValidationFeedbackRequest() - assert args[0] == request_msg @@ -2511,7 +2525,6 @@ def test_validate_address_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = address_validation_service.ValidateAddressRequest() - assert args[0] == request_msg @@ -2533,7 +2546,6 @@ def test_provide_validation_feedback_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = address_validation_service.ProvideValidationFeedbackRequest() - assert args[0] == request_msg diff --git a/packages/google-maps-areainsights/noxfile.py b/packages/google-maps-areainsights/noxfile.py index bd479f85843c..6c48887a54f5 100644 --- a/packages/google-maps-areainsights/noxfile.py +++ b/packages/google-maps-areainsights/noxfile.py @@ -47,7 +47,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-maps-areainsights" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-maps-areainsights/setup.py b/packages/google-maps-areainsights/setup.py index 0654313d7440..9f670777e6fe 100644 --- a/packages/google-maps-areainsights/setup.py +++ b/packages/google-maps-areainsights/setup.py @@ -45,7 +45,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/google-maps-areainsights/testing/constraints-3.10.txt b/packages/google-maps-areainsights/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-maps-areainsights/testing/constraints-3.10.txt +++ b/packages/google-maps-areainsights/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-maps-areainsights/tests/unit/gapic/areainsights_v1/test_area_insights.py b/packages/google-maps-areainsights/tests/unit/gapic/areainsights_v1/test_area_insights.py index bcf6b13a80a8..7fe6b24b0bbb 100644 --- a/packages/google-maps-areainsights/tests/unit/gapic/areainsights_v1/test_area_insights.py +++ b/packages/google-maps-areainsights/tests/unit/gapic/areainsights_v1/test_area_insights.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 @@ -107,6 +108,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" @@ -1287,8 +1303,8 @@ def test_area_insights_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - area_insights_service.ComputeInsightsRequest, - dict, + area_insights_service.ComputeInsightsRequest(), + {}, ], ) def test_compute_insights(request_type, transport: str = "grpc"): @@ -1299,7 +1315,7 @@ def test_compute_insights(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.compute_insights), "__call__") as call: @@ -1341,7 +1357,8 @@ def test_compute_insights_non_empty_request_with_auto_populated_field(): client.compute_insights(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == area_insights_service.ComputeInsightsRequest() + request_msg = area_insights_service.ComputeInsightsRequest() + assert args[0] == request_msg def test_compute_insights_use_cached_wrapped_rpc(): @@ -1424,10 +1441,14 @@ async def test_compute_insights_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_compute_insights_async( - transport: str = "grpc_asyncio", - request_type=area_insights_service.ComputeInsightsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + area_insights_service.ComputeInsightsRequest(), + {}, + ], +) +async def test_compute_insights_async(request_type, transport: str = "grpc_asyncio"): client = AreaInsightsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1435,7 +1456,7 @@ async def test_compute_insights_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.compute_insights), "__call__") as call: @@ -1458,11 +1479,6 @@ async def test_compute_insights_async( assert response.count == 553 -@pytest.mark.asyncio -async def test_compute_insights_async_from_dict(): - await test_compute_insights_async(request_type=dict) - - def test_compute_insights_rest_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, # instead of constructing them on each call @@ -1714,7 +1730,6 @@ def test_compute_insights_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = area_insights_service.ComputeInsightsRequest() - assert args[0] == request_msg @@ -1755,7 +1770,6 @@ async def test_compute_insights_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = area_insights_service.ComputeInsightsRequest() - assert args[0] == request_msg @@ -1925,7 +1939,6 @@ def test_compute_insights_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = area_insights_service.ComputeInsightsRequest() - assert args[0] == request_msg diff --git a/packages/google-maps-fleetengine-delivery/noxfile.py b/packages/google-maps-fleetengine-delivery/noxfile.py index dca04b90231e..965946a51d4c 100644 --- a/packages/google-maps-fleetengine-delivery/noxfile.py +++ b/packages/google-maps-fleetengine-delivery/noxfile.py @@ -47,7 +47,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-maps-fleetengine-delivery" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-maps-fleetengine-delivery/setup.py b/packages/google-maps-fleetengine-delivery/setup.py index fa90e22b36ef..8b10fafb1c3d 100644 --- a/packages/google-maps-fleetengine-delivery/setup.py +++ b/packages/google-maps-fleetengine-delivery/setup.py @@ -45,7 +45,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/google-maps-fleetengine-delivery/testing/constraints-3.10.txt b/packages/google-maps-fleetengine-delivery/testing/constraints-3.10.txt index 1a86e8abbcf5..ea5951376612 100644 --- a/packages/google-maps-fleetengine-delivery/testing/constraints-3.10.txt +++ b/packages/google-maps-fleetengine-delivery/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-geo-type==0.1.0 diff --git a/packages/google-maps-fleetengine-delivery/tests/unit/gapic/fleetengine_delivery_v1/test_delivery_service.py b/packages/google-maps-fleetengine-delivery/tests/unit/gapic/fleetengine_delivery_v1/test_delivery_service.py index 5340959f9061..d29afddd7f53 100644 --- a/packages/google-maps-fleetengine-delivery/tests/unit/gapic/fleetengine_delivery_v1/test_delivery_service.py +++ b/packages/google-maps-fleetengine-delivery/tests/unit/gapic/fleetengine_delivery_v1/test_delivery_service.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 @@ -120,6 +121,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" @@ -1347,8 +1363,8 @@ def test_delivery_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - delivery_api.CreateDeliveryVehicleRequest, - dict, + delivery_api.CreateDeliveryVehicleRequest(), + {}, ], ) def test_create_delivery_vehicle(request_type, transport: str = "grpc"): @@ -1359,7 +1375,7 @@ def test_create_delivery_vehicle(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1416,10 +1432,11 @@ def test_create_delivery_vehicle_non_empty_request_with_auto_populated_field(): client.create_delivery_vehicle(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == delivery_api.CreateDeliveryVehicleRequest( + request_msg = delivery_api.CreateDeliveryVehicleRequest( parent="parent_value", delivery_vehicle_id="delivery_vehicle_id_value", ) + assert args[0] == request_msg def test_create_delivery_vehicle_use_cached_wrapped_rpc(): @@ -1505,9 +1522,15 @@ async def test_create_delivery_vehicle_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + delivery_api.CreateDeliveryVehicleRequest(), + {}, + ], +) async def test_create_delivery_vehicle_async( - transport: str = "grpc_asyncio", - request_type=delivery_api.CreateDeliveryVehicleRequest, + request_type, transport: str = "grpc_asyncio" ): client = DeliveryServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1516,7 +1539,7 @@ async def test_create_delivery_vehicle_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( @@ -1549,11 +1572,6 @@ async def test_create_delivery_vehicle_async( assert response.type_ == delivery_vehicles.DeliveryVehicle.DeliveryVehicleType.AUTO -@pytest.mark.asyncio -async def test_create_delivery_vehicle_async_from_dict(): - await test_create_delivery_vehicle_async(request_type=dict) - - def test_create_delivery_vehicle_flattened(): client = DeliveryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1663,8 +1681,8 @@ async def test_create_delivery_vehicle_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - delivery_api.GetDeliveryVehicleRequest, - dict, + delivery_api.GetDeliveryVehicleRequest(), + {}, ], ) def test_get_delivery_vehicle(request_type, transport: str = "grpc"): @@ -1675,7 +1693,7 @@ def test_get_delivery_vehicle(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1731,9 +1749,10 @@ def test_get_delivery_vehicle_non_empty_request_with_auto_populated_field(): client.get_delivery_vehicle(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == delivery_api.GetDeliveryVehicleRequest( + request_msg = delivery_api.GetDeliveryVehicleRequest( name="name_value", ) + assert args[0] == request_msg def test_get_delivery_vehicle_use_cached_wrapped_rpc(): @@ -1818,8 +1837,15 @@ async def test_get_delivery_vehicle_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + delivery_api.GetDeliveryVehicleRequest(), + {}, + ], +) async def test_get_delivery_vehicle_async( - transport: str = "grpc_asyncio", request_type=delivery_api.GetDeliveryVehicleRequest + request_type, transport: str = "grpc_asyncio" ): client = DeliveryServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1828,7 +1854,7 @@ async def test_get_delivery_vehicle_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( @@ -1861,11 +1887,6 @@ async def test_get_delivery_vehicle_async( assert response.type_ == delivery_vehicles.DeliveryVehicle.DeliveryVehicleType.AUTO -@pytest.mark.asyncio -async def test_get_delivery_vehicle_async_from_dict(): - await test_get_delivery_vehicle_async(request_type=dict) - - def test_get_delivery_vehicle_flattened(): client = DeliveryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1955,8 +1976,8 @@ async def test_get_delivery_vehicle_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - delivery_api.DeleteDeliveryVehicleRequest, - dict, + delivery_api.DeleteDeliveryVehicleRequest(), + {}, ], ) def test_delete_delivery_vehicle(request_type, transport: str = "grpc"): @@ -1967,7 +1988,7 @@ def test_delete_delivery_vehicle(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2012,9 +2033,10 @@ def test_delete_delivery_vehicle_non_empty_request_with_auto_populated_field(): client.delete_delivery_vehicle(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == delivery_api.DeleteDeliveryVehicleRequest( + request_msg = delivery_api.DeleteDeliveryVehicleRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_delivery_vehicle_use_cached_wrapped_rpc(): @@ -2100,9 +2122,15 @@ async def test_delete_delivery_vehicle_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + delivery_api.DeleteDeliveryVehicleRequest(), + {}, + ], +) async def test_delete_delivery_vehicle_async( - transport: str = "grpc_asyncio", - request_type=delivery_api.DeleteDeliveryVehicleRequest, + request_type, transport: str = "grpc_asyncio" ): client = DeliveryServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2111,7 +2139,7 @@ async def test_delete_delivery_vehicle_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( @@ -2131,11 +2159,6 @@ async def test_delete_delivery_vehicle_async( assert response is None -@pytest.mark.asyncio -async def test_delete_delivery_vehicle_async_from_dict(): - await test_delete_delivery_vehicle_async(request_type=dict) - - def test_delete_delivery_vehicle_flattened(): client = DeliveryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2223,8 +2246,8 @@ async def test_delete_delivery_vehicle_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - delivery_api.UpdateDeliveryVehicleRequest, - dict, + delivery_api.UpdateDeliveryVehicleRequest(), + {}, ], ) def test_update_delivery_vehicle(request_type, transport: str = "grpc"): @@ -2235,7 +2258,7 @@ def test_update_delivery_vehicle(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2289,7 +2312,8 @@ def test_update_delivery_vehicle_non_empty_request_with_auto_populated_field(): client.update_delivery_vehicle(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == delivery_api.UpdateDeliveryVehicleRequest() + request_msg = delivery_api.UpdateDeliveryVehicleRequest() + assert args[0] == request_msg def test_update_delivery_vehicle_use_cached_wrapped_rpc(): @@ -2375,9 +2399,15 @@ async def test_update_delivery_vehicle_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + delivery_api.UpdateDeliveryVehicleRequest(), + {}, + ], +) async def test_update_delivery_vehicle_async( - transport: str = "grpc_asyncio", - request_type=delivery_api.UpdateDeliveryVehicleRequest, + request_type, transport: str = "grpc_asyncio" ): client = DeliveryServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2386,7 +2416,7 @@ async def test_update_delivery_vehicle_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( @@ -2419,11 +2449,6 @@ async def test_update_delivery_vehicle_async( assert response.type_ == delivery_vehicles.DeliveryVehicle.DeliveryVehicleType.AUTO -@pytest.mark.asyncio -async def test_update_delivery_vehicle_async_from_dict(): - await test_update_delivery_vehicle_async(request_type=dict) - - def test_update_delivery_vehicle_flattened(): client = DeliveryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2523,8 +2548,8 @@ async def test_update_delivery_vehicle_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - delivery_api.BatchCreateTasksRequest, - dict, + delivery_api.BatchCreateTasksRequest(), + {}, ], ) def test_batch_create_tasks(request_type, transport: str = "grpc"): @@ -2535,7 +2560,7 @@ def test_batch_create_tasks(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2580,9 +2605,10 @@ def test_batch_create_tasks_non_empty_request_with_auto_populated_field(): client.batch_create_tasks(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == delivery_api.BatchCreateTasksRequest( + request_msg = delivery_api.BatchCreateTasksRequest( parent="parent_value", ) + assert args[0] == request_msg def test_batch_create_tasks_use_cached_wrapped_rpc(): @@ -2667,9 +2693,14 @@ async def test_batch_create_tasks_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_batch_create_tasks_async( - transport: str = "grpc_asyncio", request_type=delivery_api.BatchCreateTasksRequest -): +@pytest.mark.parametrize( + "request_type", + [ + delivery_api.BatchCreateTasksRequest(), + {}, + ], +) +async def test_batch_create_tasks_async(request_type, transport: str = "grpc_asyncio"): client = DeliveryServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2677,7 +2708,7 @@ async def test_batch_create_tasks_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( @@ -2699,16 +2730,11 @@ async def test_batch_create_tasks_async( assert isinstance(response, delivery_api.BatchCreateTasksResponse) -@pytest.mark.asyncio -async def test_batch_create_tasks_async_from_dict(): - await test_batch_create_tasks_async(request_type=dict) - - @pytest.mark.parametrize( "request_type", [ - delivery_api.CreateTaskRequest, - dict, + delivery_api.CreateTaskRequest(), + {}, ], ) def test_create_task(request_type, transport: str = "grpc"): @@ -2719,7 +2745,7 @@ def test_create_task(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_task), "__call__") as call: @@ -2779,10 +2805,11 @@ def test_create_task_non_empty_request_with_auto_populated_field(): client.create_task(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == delivery_api.CreateTaskRequest( + request_msg = delivery_api.CreateTaskRequest( parent="parent_value", task_id="task_id_value", ) + assert args[0] == request_msg def test_create_task_use_cached_wrapped_rpc(): @@ -2863,9 +2890,14 @@ async def test_create_task_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_task_async( - transport: str = "grpc_asyncio", request_type=delivery_api.CreateTaskRequest -): +@pytest.mark.parametrize( + "request_type", + [ + delivery_api.CreateTaskRequest(), + {}, + ], +) +async def test_create_task_async(request_type, transport: str = "grpc_asyncio"): client = DeliveryServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2873,7 +2905,7 @@ async def test_create_task_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_task), "__call__") as call: @@ -2911,11 +2943,6 @@ async def test_create_task_async( assert response.delivery_vehicle_id == "delivery_vehicle_id_value" -@pytest.mark.asyncio -async def test_create_task_async_from_dict(): - await test_create_task_async(request_type=dict) - - def test_create_task_flattened(): client = DeliveryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3019,8 +3046,8 @@ async def test_create_task_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - delivery_api.GetTaskRequest, - dict, + delivery_api.GetTaskRequest(), + {}, ], ) def test_get_task(request_type, transport: str = "grpc"): @@ -3031,7 +3058,7 @@ def test_get_task(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_task), "__call__") as call: @@ -3090,9 +3117,10 @@ def test_get_task_non_empty_request_with_auto_populated_field(): client.get_task(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == delivery_api.GetTaskRequest( + request_msg = delivery_api.GetTaskRequest( name="name_value", ) + assert args[0] == request_msg def test_get_task_use_cached_wrapped_rpc(): @@ -3171,9 +3199,14 @@ async def test_get_task_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn @pytest.mark.asyncio -async def test_get_task_async( - transport: str = "grpc_asyncio", request_type=delivery_api.GetTaskRequest -): +@pytest.mark.parametrize( + "request_type", + [ + delivery_api.GetTaskRequest(), + {}, + ], +) +async def test_get_task_async(request_type, transport: str = "grpc_asyncio"): client = DeliveryServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3181,7 +3214,7 @@ async def test_get_task_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_task), "__call__") as call: @@ -3219,11 +3252,6 @@ async def test_get_task_async( assert response.delivery_vehicle_id == "delivery_vehicle_id_value" -@pytest.mark.asyncio -async def test_get_task_async_from_dict(): - await test_get_task_async(request_type=dict) - - def test_get_task_flattened(): client = DeliveryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3307,8 +3335,8 @@ async def test_get_task_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - delivery_api.DeleteTaskRequest, - dict, + delivery_api.DeleteTaskRequest(), + {}, ], ) def test_delete_task(request_type, transport: str = "grpc"): @@ -3319,7 +3347,7 @@ def test_delete_task(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_task), "__call__") as call: @@ -3360,9 +3388,10 @@ def test_delete_task_non_empty_request_with_auto_populated_field(): client.delete_task(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == delivery_api.DeleteTaskRequest( + request_msg = delivery_api.DeleteTaskRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_task_use_cached_wrapped_rpc(): @@ -3443,9 +3472,14 @@ async def test_delete_task_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_task_async( - transport: str = "grpc_asyncio", request_type=delivery_api.DeleteTaskRequest -): +@pytest.mark.parametrize( + "request_type", + [ + delivery_api.DeleteTaskRequest(), + {}, + ], +) +async def test_delete_task_async(request_type, transport: str = "grpc_asyncio"): client = DeliveryServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3453,7 +3487,7 @@ async def test_delete_task_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_task), "__call__") as call: @@ -3471,11 +3505,6 @@ async def test_delete_task_async( assert response is None -@pytest.mark.asyncio -async def test_delete_task_async_from_dict(): - await test_delete_task_async(request_type=dict) - - def test_delete_task_flattened(): client = DeliveryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3559,8 +3588,8 @@ async def test_delete_task_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - delivery_api.UpdateTaskRequest, - dict, + delivery_api.UpdateTaskRequest(), + {}, ], ) def test_update_task(request_type, transport: str = "grpc"): @@ -3571,7 +3600,7 @@ def test_update_task(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_task), "__call__") as call: @@ -3628,7 +3657,8 @@ def test_update_task_non_empty_request_with_auto_populated_field(): client.update_task(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == delivery_api.UpdateTaskRequest() + request_msg = delivery_api.UpdateTaskRequest() + assert args[0] == request_msg def test_update_task_use_cached_wrapped_rpc(): @@ -3709,9 +3739,14 @@ async def test_update_task_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_task_async( - transport: str = "grpc_asyncio", request_type=delivery_api.UpdateTaskRequest -): +@pytest.mark.parametrize( + "request_type", + [ + delivery_api.UpdateTaskRequest(), + {}, + ], +) +async def test_update_task_async(request_type, transport: str = "grpc_asyncio"): client = DeliveryServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3719,7 +3754,7 @@ async def test_update_task_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_task), "__call__") as call: @@ -3757,11 +3792,6 @@ async def test_update_task_async( assert response.delivery_vehicle_id == "delivery_vehicle_id_value" -@pytest.mark.asyncio -async def test_update_task_async_from_dict(): - await test_update_task_async(request_type=dict) - - def test_update_task_flattened(): client = DeliveryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3855,8 +3885,8 @@ async def test_update_task_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - delivery_api.ListTasksRequest, - dict, + delivery_api.ListTasksRequest(), + {}, ], ) def test_list_tasks(request_type, transport: str = "grpc"): @@ -3867,7 +3897,7 @@ def test_list_tasks(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_tasks), "__call__") as call: @@ -3915,11 +3945,12 @@ def test_list_tasks_non_empty_request_with_auto_populated_field(): client.list_tasks(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == delivery_api.ListTasksRequest( + request_msg = delivery_api.ListTasksRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_tasks_use_cached_wrapped_rpc(): @@ -3998,9 +4029,14 @@ async def test_list_tasks_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_list_tasks_async( - transport: str = "grpc_asyncio", request_type=delivery_api.ListTasksRequest -): +@pytest.mark.parametrize( + "request_type", + [ + delivery_api.ListTasksRequest(), + {}, + ], +) +async def test_list_tasks_async(request_type, transport: str = "grpc_asyncio"): client = DeliveryServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4008,7 +4044,7 @@ async def test_list_tasks_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_tasks), "__call__") as call: @@ -4033,11 +4069,6 @@ async def test_list_tasks_async( assert response.total_size == 1086 -@pytest.mark.asyncio -async def test_list_tasks_async_from_dict(): - await test_list_tasks_async(request_type=dict) - - def test_list_tasks_flattened(): client = DeliveryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4310,8 +4341,8 @@ async def test_list_tasks_async_pages(): @pytest.mark.parametrize( "request_type", [ - delivery_api.GetTaskTrackingInfoRequest, - dict, + delivery_api.GetTaskTrackingInfoRequest(), + {}, ], ) def test_get_task_tracking_info(request_type, transport: str = "grpc"): @@ -4322,7 +4353,7 @@ def test_get_task_tracking_info(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4376,9 +4407,10 @@ def test_get_task_tracking_info_non_empty_request_with_auto_populated_field(): client.get_task_tracking_info(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == delivery_api.GetTaskTrackingInfoRequest( + request_msg = delivery_api.GetTaskTrackingInfoRequest( name="name_value", ) + assert args[0] == request_msg def test_get_task_tracking_info_use_cached_wrapped_rpc(): @@ -4464,9 +4496,15 @@ async def test_get_task_tracking_info_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + delivery_api.GetTaskTrackingInfoRequest(), + {}, + ], +) async def test_get_task_tracking_info_async( - transport: str = "grpc_asyncio", - request_type=delivery_api.GetTaskTrackingInfoRequest, + request_type, transport: str = "grpc_asyncio" ): client = DeliveryServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4475,7 +4513,7 @@ async def test_get_task_tracking_info_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( @@ -4506,11 +4544,6 @@ async def test_get_task_tracking_info_async( assert response.task_outcome == tasks.Task.TaskOutcome.SUCCEEDED -@pytest.mark.asyncio -async def test_get_task_tracking_info_async_from_dict(): - await test_get_task_tracking_info_async(request_type=dict) - - def test_get_task_tracking_info_flattened(): client = DeliveryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4600,8 +4633,8 @@ async def test_get_task_tracking_info_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - delivery_api.ListDeliveryVehiclesRequest, - dict, + delivery_api.ListDeliveryVehiclesRequest(), + {}, ], ) def test_list_delivery_vehicles(request_type, transport: str = "grpc"): @@ -4612,7 +4645,7 @@ def test_list_delivery_vehicles(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4664,11 +4697,12 @@ def test_list_delivery_vehicles_non_empty_request_with_auto_populated_field(): client.list_delivery_vehicles(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == delivery_api.ListDeliveryVehiclesRequest( + request_msg = delivery_api.ListDeliveryVehiclesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_delivery_vehicles_use_cached_wrapped_rpc(): @@ -4754,9 +4788,15 @@ async def test_list_delivery_vehicles_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + delivery_api.ListDeliveryVehiclesRequest(), + {}, + ], +) async def test_list_delivery_vehicles_async( - transport: str = "grpc_asyncio", - request_type=delivery_api.ListDeliveryVehiclesRequest, + request_type, transport: str = "grpc_asyncio" ): client = DeliveryServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -4765,7 +4805,7 @@ async def test_list_delivery_vehicles_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( @@ -4792,11 +4832,6 @@ async def test_list_delivery_vehicles_async( assert response.total_size == 1086 -@pytest.mark.asyncio -async def test_list_delivery_vehicles_async_from_dict(): - await test_list_delivery_vehicles_async(request_type=dict) - - def test_list_delivery_vehicles_flattened(): client = DeliveryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7578,7 +7613,6 @@ def test_create_delivery_vehicle_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = delivery_api.CreateDeliveryVehicleRequest() - assert args[0] == request_msg @@ -7601,7 +7635,6 @@ def test_get_delivery_vehicle_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = delivery_api.GetDeliveryVehicleRequest() - assert args[0] == request_msg @@ -7624,7 +7657,6 @@ def test_delete_delivery_vehicle_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = delivery_api.DeleteDeliveryVehicleRequest() - assert args[0] == request_msg @@ -7647,7 +7679,6 @@ def test_update_delivery_vehicle_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = delivery_api.UpdateDeliveryVehicleRequest() - assert args[0] == request_msg @@ -7670,7 +7701,6 @@ def test_batch_create_tasks_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = delivery_api.BatchCreateTasksRequest() - assert args[0] == request_msg @@ -7691,7 +7721,6 @@ def test_create_task_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = delivery_api.CreateTaskRequest() - assert args[0] == request_msg @@ -7712,7 +7741,6 @@ def test_get_task_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = delivery_api.GetTaskRequest() - assert args[0] == request_msg @@ -7733,7 +7761,6 @@ def test_delete_task_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = delivery_api.DeleteTaskRequest() - assert args[0] == request_msg @@ -7754,7 +7781,6 @@ def test_update_task_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = delivery_api.UpdateTaskRequest() - assert args[0] == request_msg @@ -7775,7 +7801,6 @@ def test_list_tasks_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = delivery_api.ListTasksRequest() - assert args[0] == request_msg @@ -7798,7 +7823,6 @@ def test_get_task_tracking_info_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = delivery_api.GetTaskTrackingInfoRequest() - assert args[0] == request_msg @@ -7821,7 +7845,6 @@ def test_list_delivery_vehicles_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = delivery_api.ListDeliveryVehiclesRequest() - assert args[0] == request_msg @@ -7844,7 +7867,6 @@ def test_create_delivery_vehicle_routing_parameters_request_1_grpc(): request_msg = delivery_api.CreateDeliveryVehicleRequest( **{"parent": "providers/sample1"} ) - assert args[0] == request_msg expected_headers = {"provider_id": "providers/sample1"} @@ -7872,7 +7894,6 @@ def test_get_delivery_vehicle_routing_parameters_request_1_grpc(): request_msg = delivery_api.GetDeliveryVehicleRequest( **{"name": "providers/sample1"} ) - assert args[0] == request_msg expected_headers = {"provider_id": "providers/sample1"} @@ -7900,7 +7921,6 @@ def test_delete_delivery_vehicle_routing_parameters_request_1_grpc(): request_msg = delivery_api.DeleteDeliveryVehicleRequest( **{"name": "providers/sample1"} ) - assert args[0] == request_msg expected_headers = {"provider_id": "providers/sample1"} @@ -7930,7 +7950,6 @@ def test_update_delivery_vehicle_routing_parameters_request_1_grpc(): request_msg = delivery_api.UpdateDeliveryVehicleRequest( **{"delivery_vehicle": {"name": "providers/sample1"}} ) - assert args[0] == request_msg expected_headers = {"provider_id": "providers/sample1"} @@ -7958,7 +7977,6 @@ def test_batch_create_tasks_routing_parameters_request_1_grpc(): request_msg = delivery_api.BatchCreateTasksRequest( **{"parent": "providers/sample1"} ) - assert args[0] == request_msg expected_headers = {"provider_id": "providers/sample1"} @@ -7982,7 +8000,6 @@ def test_create_task_routing_parameters_request_1_grpc(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = delivery_api.CreateTaskRequest(**{"parent": "providers/sample1"}) - assert args[0] == request_msg expected_headers = {"provider_id": "providers/sample1"} @@ -8006,7 +8023,6 @@ def test_get_task_routing_parameters_request_1_grpc(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = delivery_api.GetTaskRequest(**{"name": "providers/sample1"}) - assert args[0] == request_msg expected_headers = {"provider_id": "providers/sample1"} @@ -8030,7 +8046,6 @@ def test_delete_task_routing_parameters_request_1_grpc(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = delivery_api.DeleteTaskRequest(**{"name": "providers/sample1"}) - assert args[0] == request_msg expected_headers = {"provider_id": "providers/sample1"} @@ -8056,7 +8071,6 @@ def test_update_task_routing_parameters_request_1_grpc(): request_msg = delivery_api.UpdateTaskRequest( **{"task": {"name": "providers/sample1"}} ) - assert args[0] == request_msg expected_headers = {"provider_id": "providers/sample1"} @@ -8080,7 +8094,6 @@ def test_list_tasks_routing_parameters_request_1_grpc(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = delivery_api.ListTasksRequest(**{"parent": "providers/sample1"}) - assert args[0] == request_msg expected_headers = {"provider_id": "providers/sample1"} @@ -8108,7 +8121,6 @@ def test_get_task_tracking_info_routing_parameters_request_1_grpc(): request_msg = delivery_api.GetTaskTrackingInfoRequest( **{"name": "providers/sample1"} ) - assert args[0] == request_msg expected_headers = {"provider_id": "providers/sample1"} @@ -8136,7 +8148,6 @@ def test_list_delivery_vehicles_routing_parameters_request_1_grpc(): request_msg = delivery_api.ListDeliveryVehiclesRequest( **{"parent": "providers/sample1"} ) - assert args[0] == request_msg expected_headers = {"provider_id": "providers/sample1"} @@ -8187,7 +8198,6 @@ async def test_create_delivery_vehicle_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = delivery_api.CreateDeliveryVehicleRequest() - assert args[0] == request_msg @@ -8219,7 +8229,6 @@ async def test_get_delivery_vehicle_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = delivery_api.GetDeliveryVehicleRequest() - assert args[0] == request_msg @@ -8244,7 +8253,6 @@ async def test_delete_delivery_vehicle_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = delivery_api.DeleteDeliveryVehicleRequest() - assert args[0] == request_msg @@ -8276,7 +8284,6 @@ async def test_update_delivery_vehicle_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = delivery_api.UpdateDeliveryVehicleRequest() - assert args[0] == request_msg @@ -8303,7 +8310,6 @@ async def test_batch_create_tasks_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = delivery_api.BatchCreateTasksRequest() - assert args[0] == request_msg @@ -8336,7 +8342,6 @@ async def test_create_task_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = delivery_api.CreateTaskRequest() - assert args[0] == request_msg @@ -8369,7 +8374,6 @@ async def test_get_task_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = delivery_api.GetTaskRequest() - assert args[0] == request_msg @@ -8392,7 +8396,6 @@ async def test_delete_task_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = delivery_api.DeleteTaskRequest() - assert args[0] == request_msg @@ -8425,7 +8428,6 @@ async def test_update_task_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = delivery_api.UpdateTaskRequest() - assert args[0] == request_msg @@ -8453,7 +8455,6 @@ async def test_list_tasks_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = delivery_api.ListTasksRequest() - assert args[0] == request_msg @@ -8485,7 +8486,6 @@ async def test_get_task_tracking_info_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = delivery_api.GetTaskTrackingInfoRequest() - assert args[0] == request_msg @@ -8515,7 +8515,6 @@ async def test_list_delivery_vehicles_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = delivery_api.ListDeliveryVehiclesRequest() - assert args[0] == request_msg @@ -8547,7 +8546,6 @@ async def test_create_delivery_vehicle_routing_parameters_request_1_grpc_asyncio request_msg = delivery_api.CreateDeliveryVehicleRequest( **{"parent": "providers/sample1"} ) - assert args[0] == request_msg expected_headers = {"provider_id": "providers/sample1"} @@ -8584,7 +8582,6 @@ async def test_get_delivery_vehicle_routing_parameters_request_1_grpc_asyncio(): request_msg = delivery_api.GetDeliveryVehicleRequest( **{"name": "providers/sample1"} ) - assert args[0] == request_msg expected_headers = {"provider_id": "providers/sample1"} @@ -8614,7 +8611,6 @@ async def test_delete_delivery_vehicle_routing_parameters_request_1_grpc_asyncio request_msg = delivery_api.DeleteDeliveryVehicleRequest( **{"name": "providers/sample1"} ) - assert args[0] == request_msg expected_headers = {"provider_id": "providers/sample1"} @@ -8653,7 +8649,6 @@ async def test_update_delivery_vehicle_routing_parameters_request_1_grpc_asyncio request_msg = delivery_api.UpdateDeliveryVehicleRequest( **{"delivery_vehicle": {"name": "providers/sample1"}} ) - assert args[0] == request_msg expected_headers = {"provider_id": "providers/sample1"} @@ -8685,7 +8680,6 @@ async def test_batch_create_tasks_routing_parameters_request_1_grpc_asyncio(): request_msg = delivery_api.BatchCreateTasksRequest( **{"parent": "providers/sample1"} ) - assert args[0] == request_msg expected_headers = {"provider_id": "providers/sample1"} @@ -8721,7 +8715,6 @@ async def test_create_task_routing_parameters_request_1_grpc_asyncio(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = delivery_api.CreateTaskRequest(**{"parent": "providers/sample1"}) - assert args[0] == request_msg expected_headers = {"provider_id": "providers/sample1"} @@ -8757,7 +8750,6 @@ async def test_get_task_routing_parameters_request_1_grpc_asyncio(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = delivery_api.GetTaskRequest(**{"name": "providers/sample1"}) - assert args[0] == request_msg expected_headers = {"provider_id": "providers/sample1"} @@ -8783,7 +8775,6 @@ async def test_delete_task_routing_parameters_request_1_grpc_asyncio(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = delivery_api.DeleteTaskRequest(**{"name": "providers/sample1"}) - assert args[0] == request_msg expected_headers = {"provider_id": "providers/sample1"} @@ -8821,7 +8812,6 @@ async def test_update_task_routing_parameters_request_1_grpc_asyncio(): request_msg = delivery_api.UpdateTaskRequest( **{"task": {"name": "providers/sample1"}} ) - assert args[0] == request_msg expected_headers = {"provider_id": "providers/sample1"} @@ -8852,7 +8842,6 @@ async def test_list_tasks_routing_parameters_request_1_grpc_asyncio(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = delivery_api.ListTasksRequest(**{"parent": "providers/sample1"}) - assert args[0] == request_msg expected_headers = {"provider_id": "providers/sample1"} @@ -8889,7 +8878,6 @@ async def test_get_task_tracking_info_routing_parameters_request_1_grpc_asyncio( request_msg = delivery_api.GetTaskTrackingInfoRequest( **{"name": "providers/sample1"} ) - assert args[0] == request_msg expected_headers = {"provider_id": "providers/sample1"} @@ -8924,7 +8912,6 @@ async def test_list_delivery_vehicles_routing_parameters_request_1_grpc_asyncio( request_msg = delivery_api.ListDeliveryVehiclesRequest( **{"parent": "providers/sample1"} ) - assert args[0] == request_msg expected_headers = {"provider_id": "providers/sample1"} @@ -11170,7 +11157,6 @@ def test_create_delivery_vehicle_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = delivery_api.CreateDeliveryVehicleRequest() - assert args[0] == request_msg @@ -11192,7 +11178,6 @@ def test_get_delivery_vehicle_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = delivery_api.GetDeliveryVehicleRequest() - assert args[0] == request_msg @@ -11214,7 +11199,6 @@ def test_delete_delivery_vehicle_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = delivery_api.DeleteDeliveryVehicleRequest() - assert args[0] == request_msg @@ -11236,7 +11220,6 @@ def test_update_delivery_vehicle_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = delivery_api.UpdateDeliveryVehicleRequest() - assert args[0] == request_msg @@ -11258,7 +11241,6 @@ def test_batch_create_tasks_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = delivery_api.BatchCreateTasksRequest() - assert args[0] == request_msg @@ -11278,7 +11260,6 @@ def test_create_task_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = delivery_api.CreateTaskRequest() - assert args[0] == request_msg @@ -11298,7 +11279,6 @@ def test_get_task_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = delivery_api.GetTaskRequest() - assert args[0] == request_msg @@ -11318,7 +11298,6 @@ def test_delete_task_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = delivery_api.DeleteTaskRequest() - assert args[0] == request_msg @@ -11338,7 +11317,6 @@ def test_update_task_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = delivery_api.UpdateTaskRequest() - assert args[0] == request_msg @@ -11358,7 +11336,6 @@ def test_list_tasks_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = delivery_api.ListTasksRequest() - assert args[0] == request_msg @@ -11380,7 +11357,6 @@ def test_get_task_tracking_info_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = delivery_api.GetTaskTrackingInfoRequest() - assert args[0] == request_msg @@ -11402,7 +11378,6 @@ def test_list_delivery_vehicles_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = delivery_api.ListDeliveryVehiclesRequest() - assert args[0] == request_msg @@ -11424,7 +11399,6 @@ def test_create_delivery_vehicle_routing_parameters_request_1_rest(): request_msg = delivery_api.CreateDeliveryVehicleRequest( **{"parent": "providers/sample1"} ) - assert args[0] == request_msg expected_headers = {"provider_id": "providers/sample1"} @@ -11451,7 +11425,6 @@ def test_get_delivery_vehicle_routing_parameters_request_1_rest(): request_msg = delivery_api.GetDeliveryVehicleRequest( **{"name": "providers/sample1"} ) - assert args[0] == request_msg expected_headers = {"provider_id": "providers/sample1"} @@ -11478,7 +11451,6 @@ def test_delete_delivery_vehicle_routing_parameters_request_1_rest(): request_msg = delivery_api.DeleteDeliveryVehicleRequest( **{"name": "providers/sample1"} ) - assert args[0] == request_msg expected_headers = {"provider_id": "providers/sample1"} @@ -11507,7 +11479,6 @@ def test_update_delivery_vehicle_routing_parameters_request_1_rest(): request_msg = delivery_api.UpdateDeliveryVehicleRequest( **{"delivery_vehicle": {"name": "providers/sample1"}} ) - assert args[0] == request_msg expected_headers = {"provider_id": "providers/sample1"} @@ -11534,7 +11505,6 @@ def test_batch_create_tasks_routing_parameters_request_1_rest(): request_msg = delivery_api.BatchCreateTasksRequest( **{"parent": "providers/sample1"} ) - assert args[0] == request_msg expected_headers = {"provider_id": "providers/sample1"} @@ -11557,7 +11527,6 @@ def test_create_task_routing_parameters_request_1_rest(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = delivery_api.CreateTaskRequest(**{"parent": "providers/sample1"}) - assert args[0] == request_msg expected_headers = {"provider_id": "providers/sample1"} @@ -11580,7 +11549,6 @@ def test_get_task_routing_parameters_request_1_rest(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = delivery_api.GetTaskRequest(**{"name": "providers/sample1"}) - assert args[0] == request_msg expected_headers = {"provider_id": "providers/sample1"} @@ -11603,7 +11571,6 @@ def test_delete_task_routing_parameters_request_1_rest(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = delivery_api.DeleteTaskRequest(**{"name": "providers/sample1"}) - assert args[0] == request_msg expected_headers = {"provider_id": "providers/sample1"} @@ -11628,7 +11595,6 @@ def test_update_task_routing_parameters_request_1_rest(): request_msg = delivery_api.UpdateTaskRequest( **{"task": {"name": "providers/sample1"}} ) - assert args[0] == request_msg expected_headers = {"provider_id": "providers/sample1"} @@ -11651,7 +11617,6 @@ def test_list_tasks_routing_parameters_request_1_rest(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = delivery_api.ListTasksRequest(**{"parent": "providers/sample1"}) - assert args[0] == request_msg expected_headers = {"provider_id": "providers/sample1"} @@ -11678,7 +11643,6 @@ def test_get_task_tracking_info_routing_parameters_request_1_rest(): request_msg = delivery_api.GetTaskTrackingInfoRequest( **{"name": "providers/sample1"} ) - assert args[0] == request_msg expected_headers = {"provider_id": "providers/sample1"} @@ -11705,7 +11669,6 @@ def test_list_delivery_vehicles_routing_parameters_request_1_rest(): request_msg = delivery_api.ListDeliveryVehiclesRequest( **{"parent": "providers/sample1"} ) - assert args[0] == request_msg expected_headers = {"provider_id": "providers/sample1"} diff --git a/packages/google-maps-fleetengine/noxfile.py b/packages/google-maps-fleetengine/noxfile.py index b248924606a2..a4e7bf463821 100644 --- a/packages/google-maps-fleetengine/noxfile.py +++ b/packages/google-maps-fleetengine/noxfile.py @@ -47,7 +47,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-maps-fleetengine" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-maps-fleetengine/setup.py b/packages/google-maps-fleetengine/setup.py index 63a9ec25e133..a19334f38827 100644 --- a/packages/google-maps-fleetengine/setup.py +++ b/packages/google-maps-fleetengine/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/google-maps-fleetengine/testing/constraints-3.10.txt b/packages/google-maps-fleetengine/testing/constraints-3.10.txt index 1a86e8abbcf5..ea5951376612 100644 --- a/packages/google-maps-fleetengine/testing/constraints-3.10.txt +++ b/packages/google-maps-fleetengine/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-geo-type==0.1.0 diff --git a/packages/google-maps-fleetengine/tests/unit/gapic/fleetengine_v1/test_trip_service.py b/packages/google-maps-fleetengine/tests/unit/gapic/fleetengine_v1/test_trip_service.py index 9c2a7554a56e..0561e4d8acc9 100644 --- a/packages/google-maps-fleetengine/tests/unit/gapic/fleetengine_v1/test_trip_service.py +++ b/packages/google-maps-fleetengine/tests/unit/gapic/fleetengine_v1/test_trip_service.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 @@ -115,6 +116,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" @@ -1263,8 +1279,8 @@ def test_trip_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - trip_api.CreateTripRequest, - dict, + trip_api.CreateTripRequest(), + {}, ], ) def test_create_trip(request_type, transport: str = "grpc"): @@ -1275,7 +1291,7 @@ def test_create_trip(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_trip), "__call__") as call: @@ -1336,10 +1352,11 @@ def test_create_trip_non_empty_request_with_auto_populated_field(): client.create_trip(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == trip_api.CreateTripRequest( + request_msg = trip_api.CreateTripRequest( parent="parent_value", trip_id="trip_id_value", ) + assert args[0] == request_msg def test_create_trip_use_cached_wrapped_rpc(): @@ -1420,9 +1437,14 @@ async def test_create_trip_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_trip_async( - transport: str = "grpc_asyncio", request_type=trip_api.CreateTripRequest -): +@pytest.mark.parametrize( + "request_type", + [ + trip_api.CreateTripRequest(), + {}, + ], +) +async def test_create_trip_async(request_type, transport: str = "grpc_asyncio"): client = TripServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1430,7 +1452,7 @@ async def test_create_trip_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_trip), "__call__") as call: @@ -1469,16 +1491,11 @@ async def test_create_trip_async( assert response.view == trips.TripView.SDK -@pytest.mark.asyncio -async def test_create_trip_async_from_dict(): - await test_create_trip_async(request_type=dict) - - @pytest.mark.parametrize( "request_type", [ - trip_api.GetTripRequest, - dict, + trip_api.GetTripRequest(), + {}, ], ) def test_get_trip(request_type, transport: str = "grpc"): @@ -1489,7 +1506,7 @@ def test_get_trip(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_trip), "__call__") as call: @@ -1549,9 +1566,10 @@ def test_get_trip_non_empty_request_with_auto_populated_field(): client.get_trip(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == trip_api.GetTripRequest( + request_msg = trip_api.GetTripRequest( name="name_value", ) + assert args[0] == request_msg def test_get_trip_use_cached_wrapped_rpc(): @@ -1630,9 +1648,14 @@ async def test_get_trip_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn @pytest.mark.asyncio -async def test_get_trip_async( - transport: str = "grpc_asyncio", request_type=trip_api.GetTripRequest -): +@pytest.mark.parametrize( + "request_type", + [ + trip_api.GetTripRequest(), + {}, + ], +) +async def test_get_trip_async(request_type, transport: str = "grpc_asyncio"): client = TripServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1640,7 +1663,7 @@ async def test_get_trip_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_trip), "__call__") as call: @@ -1679,16 +1702,11 @@ async def test_get_trip_async( assert response.view == trips.TripView.SDK -@pytest.mark.asyncio -async def test_get_trip_async_from_dict(): - await test_get_trip_async(request_type=dict) - - @pytest.mark.parametrize( "request_type", [ - trip_api.DeleteTripRequest, - dict, + trip_api.DeleteTripRequest(), + {}, ], ) def test_delete_trip(request_type, transport: str = "grpc"): @@ -1699,7 +1717,7 @@ def test_delete_trip(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_trip), "__call__") as call: @@ -1740,9 +1758,10 @@ def test_delete_trip_non_empty_request_with_auto_populated_field(): client.delete_trip(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == trip_api.DeleteTripRequest( + request_msg = trip_api.DeleteTripRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_trip_use_cached_wrapped_rpc(): @@ -1823,9 +1842,14 @@ async def test_delete_trip_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_trip_async( - transport: str = "grpc_asyncio", request_type=trip_api.DeleteTripRequest -): +@pytest.mark.parametrize( + "request_type", + [ + trip_api.DeleteTripRequest(), + {}, + ], +) +async def test_delete_trip_async(request_type, transport: str = "grpc_asyncio"): client = TripServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1833,7 +1857,7 @@ async def test_delete_trip_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_trip), "__call__") as call: @@ -1851,11 +1875,6 @@ async def test_delete_trip_async( assert response is None -@pytest.mark.asyncio -async def test_delete_trip_async_from_dict(): - await test_delete_trip_async(request_type=dict) - - def test_delete_trip_flattened(): client = TripServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1939,8 +1958,8 @@ async def test_delete_trip_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - trip_api.ReportBillableTripRequest, - dict, + trip_api.ReportBillableTripRequest(), + {}, ], ) def test_report_billable_trip(request_type, transport: str = "grpc"): @@ -1951,7 +1970,7 @@ def test_report_billable_trip(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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 +2016,11 @@ def test_report_billable_trip_non_empty_request_with_auto_populated_field(): client.report_billable_trip(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == trip_api.ReportBillableTripRequest( + request_msg = trip_api.ReportBillableTripRequest( name="name_value", country_code="country_code_value", ) + assert args[0] == request_msg def test_report_billable_trip_use_cached_wrapped_rpc(): @@ -2085,8 +2105,15 @@ async def test_report_billable_trip_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + trip_api.ReportBillableTripRequest(), + {}, + ], +) async def test_report_billable_trip_async( - transport: str = "grpc_asyncio", request_type=trip_api.ReportBillableTripRequest + request_type, transport: str = "grpc_asyncio" ): client = TripServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2095,7 +2122,7 @@ async def test_report_billable_trip_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( @@ -2115,16 +2142,11 @@ async def test_report_billable_trip_async( assert response is None -@pytest.mark.asyncio -async def test_report_billable_trip_async_from_dict(): - await test_report_billable_trip_async(request_type=dict) - - @pytest.mark.parametrize( "request_type", [ - trip_api.SearchTripsRequest, - dict, + trip_api.SearchTripsRequest(), + {}, ], ) def test_search_trips(request_type, transport: str = "grpc"): @@ -2135,7 +2157,7 @@ def test_search_trips(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.search_trips), "__call__") as call: @@ -2181,11 +2203,12 @@ def test_search_trips_non_empty_request_with_auto_populated_field(): client.search_trips(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == trip_api.SearchTripsRequest( + request_msg = trip_api.SearchTripsRequest( parent="parent_value", vehicle_id="vehicle_id_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_search_trips_use_cached_wrapped_rpc(): @@ -2266,9 +2289,14 @@ async def test_search_trips_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_search_trips_async( - transport: str = "grpc_asyncio", request_type=trip_api.SearchTripsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + trip_api.SearchTripsRequest(), + {}, + ], +) +async def test_search_trips_async(request_type, transport: str = "grpc_asyncio"): client = TripServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2276,7 +2304,7 @@ async def test_search_trips_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.search_trips), "__call__") as call: @@ -2299,11 +2327,6 @@ async def test_search_trips_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_search_trips_async_from_dict(): - await test_search_trips_async(request_type=dict) - - def test_search_trips_pager(transport_name: str = "grpc"): client = TripServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2494,8 +2517,8 @@ async def test_search_trips_async_pages(): @pytest.mark.parametrize( "request_type", [ - trip_api.UpdateTripRequest, - dict, + trip_api.UpdateTripRequest(), + {}, ], ) def test_update_trip(request_type, transport: str = "grpc"): @@ -2506,7 +2529,7 @@ def test_update_trip(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_trip), "__call__") as call: @@ -2566,9 +2589,10 @@ def test_update_trip_non_empty_request_with_auto_populated_field(): client.update_trip(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == trip_api.UpdateTripRequest( + request_msg = trip_api.UpdateTripRequest( name="name_value", ) + assert args[0] == request_msg def test_update_trip_use_cached_wrapped_rpc(): @@ -2649,9 +2673,14 @@ async def test_update_trip_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_trip_async( - transport: str = "grpc_asyncio", request_type=trip_api.UpdateTripRequest -): +@pytest.mark.parametrize( + "request_type", + [ + trip_api.UpdateTripRequest(), + {}, + ], +) +async def test_update_trip_async(request_type, transport: str = "grpc_asyncio"): client = TripServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2659,7 +2688,7 @@ async def test_update_trip_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_trip), "__call__") as call: @@ -2698,11 +2727,6 @@ async def test_update_trip_async( assert response.view == trips.TripView.SDK -@pytest.mark.asyncio -async def test_update_trip_async_from_dict(): - await test_update_trip_async(request_type=dict) - - def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.TripServiceGrpcTransport( @@ -2825,7 +2849,6 @@ def test_create_trip_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = trip_api.CreateTripRequest() - assert args[0] == request_msg @@ -2846,7 +2869,6 @@ def test_get_trip_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = trip_api.GetTripRequest() - assert args[0] == request_msg @@ -2867,7 +2889,6 @@ def test_delete_trip_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = trip_api.DeleteTripRequest() - assert args[0] == request_msg @@ -2890,7 +2911,6 @@ def test_report_billable_trip_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = trip_api.ReportBillableTripRequest() - assert args[0] == request_msg @@ -2911,7 +2931,6 @@ def test_search_trips_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = trip_api.SearchTripsRequest() - assert args[0] == request_msg @@ -2932,7 +2951,6 @@ def test_update_trip_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = trip_api.UpdateTripRequest() - assert args[0] == request_msg @@ -2951,7 +2969,6 @@ def test_create_trip_routing_parameters_request_1_grpc(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = trip_api.CreateTripRequest(**{"parent": "providers/sample1"}) - assert args[0] == request_msg expected_headers = {"provider_id": "providers/sample1"} @@ -2975,7 +2992,6 @@ def test_get_trip_routing_parameters_request_1_grpc(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = trip_api.GetTripRequest(**{"name": "providers/sample1"}) - assert args[0] == request_msg expected_headers = {"provider_id": "providers/sample1"} @@ -2999,7 +3015,6 @@ def test_delete_trip_routing_parameters_request_1_grpc(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = trip_api.DeleteTripRequest(**{"name": "providers/sample1"}) - assert args[0] == request_msg expected_headers = {"provider_id": "providers/sample1"} @@ -3027,7 +3042,6 @@ def test_report_billable_trip_routing_parameters_request_1_grpc(): request_msg = trip_api.ReportBillableTripRequest( **{"name": "providers/sample1"} ) - assert args[0] == request_msg expected_headers = {"provider_id": "providers/sample1"} @@ -3051,7 +3065,6 @@ def test_search_trips_routing_parameters_request_1_grpc(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = trip_api.SearchTripsRequest(**{"parent": "providers/sample1"}) - assert args[0] == request_msg expected_headers = {"provider_id": "providers/sample1"} @@ -3075,7 +3088,6 @@ def test_update_trip_routing_parameters_request_1_grpc(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = trip_api.UpdateTripRequest(**{"name": "providers/sample1"}) - assert args[0] == request_msg expected_headers = {"provider_id": "providers/sample1"} @@ -3129,7 +3141,6 @@ async def test_create_trip_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = trip_api.CreateTripRequest() - assert args[0] == request_msg @@ -3164,7 +3175,6 @@ async def test_get_trip_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = trip_api.GetTripRequest() - assert args[0] == request_msg @@ -3187,7 +3197,6 @@ async def test_delete_trip_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = trip_api.DeleteTripRequest() - assert args[0] == request_msg @@ -3212,7 +3221,6 @@ async def test_report_billable_trip_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = trip_api.ReportBillableTripRequest() - assert args[0] == request_msg @@ -3239,7 +3247,6 @@ async def test_search_trips_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = trip_api.SearchTripsRequest() - assert args[0] == request_msg @@ -3274,7 +3281,6 @@ async def test_update_trip_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = trip_api.UpdateTripRequest() - assert args[0] == request_msg @@ -3307,7 +3313,6 @@ async def test_create_trip_routing_parameters_request_1_grpc_asyncio(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = trip_api.CreateTripRequest(**{"parent": "providers/sample1"}) - assert args[0] == request_msg expected_headers = {"provider_id": "providers/sample1"} @@ -3345,7 +3350,6 @@ async def test_get_trip_routing_parameters_request_1_grpc_asyncio(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = trip_api.GetTripRequest(**{"name": "providers/sample1"}) - assert args[0] == request_msg expected_headers = {"provider_id": "providers/sample1"} @@ -3371,7 +3375,6 @@ async def test_delete_trip_routing_parameters_request_1_grpc_asyncio(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = trip_api.DeleteTripRequest(**{"name": "providers/sample1"}) - assert args[0] == request_msg expected_headers = {"provider_id": "providers/sample1"} @@ -3401,7 +3404,6 @@ async def test_report_billable_trip_routing_parameters_request_1_grpc_asyncio(): request_msg = trip_api.ReportBillableTripRequest( **{"name": "providers/sample1"} ) - assert args[0] == request_msg expected_headers = {"provider_id": "providers/sample1"} @@ -3431,7 +3433,6 @@ async def test_search_trips_routing_parameters_request_1_grpc_asyncio(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = trip_api.SearchTripsRequest(**{"parent": "providers/sample1"}) - assert args[0] == request_msg expected_headers = {"provider_id": "providers/sample1"} @@ -3469,7 +3470,6 @@ async def test_update_trip_routing_parameters_request_1_grpc_asyncio(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = trip_api.UpdateTripRequest(**{"name": "providers/sample1"}) - assert args[0] == request_msg expected_headers = {"provider_id": "providers/sample1"} diff --git a/packages/google-maps-fleetengine/tests/unit/gapic/fleetengine_v1/test_vehicle_service.py b/packages/google-maps-fleetengine/tests/unit/gapic/fleetengine_v1/test_vehicle_service.py index e8180bfcb429..739a05e389b2 100644 --- a/packages/google-maps-fleetengine/tests/unit/gapic/fleetengine_v1/test_vehicle_service.py +++ b/packages/google-maps-fleetengine/tests/unit/gapic/fleetengine_v1/test_vehicle_service.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 @@ -116,6 +117,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" @@ -1302,8 +1318,8 @@ def test_vehicle_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - vehicle_api.CreateVehicleRequest, - dict, + vehicle_api.CreateVehicleRequest(), + {}, ], ) def test_create_vehicle(request_type, transport: str = "grpc"): @@ -1314,7 +1330,7 @@ def test_create_vehicle(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_vehicle), "__call__") as call: @@ -1373,10 +1389,11 @@ def test_create_vehicle_non_empty_request_with_auto_populated_field(): client.create_vehicle(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vehicle_api.CreateVehicleRequest( + request_msg = vehicle_api.CreateVehicleRequest( parent="parent_value", vehicle_id="vehicle_id_value", ) + assert args[0] == request_msg def test_create_vehicle_use_cached_wrapped_rpc(): @@ -1457,9 +1474,14 @@ async def test_create_vehicle_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_vehicle_async( - transport: str = "grpc_asyncio", request_type=vehicle_api.CreateVehicleRequest -): +@pytest.mark.parametrize( + "request_type", + [ + vehicle_api.CreateVehicleRequest(), + {}, + ], +) +async def test_create_vehicle_async(request_type, transport: str = "grpc_asyncio"): client = VehicleServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1467,7 +1489,7 @@ async def test_create_vehicle_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_vehicle), "__call__") as call: @@ -1504,16 +1526,11 @@ async def test_create_vehicle_async( assert response.navigation_status == fleetengine.NavigationStatus.NO_GUIDANCE -@pytest.mark.asyncio -async def test_create_vehicle_async_from_dict(): - await test_create_vehicle_async(request_type=dict) - - @pytest.mark.parametrize( "request_type", [ - vehicle_api.GetVehicleRequest, - dict, + vehicle_api.GetVehicleRequest(), + {}, ], ) def test_get_vehicle(request_type, transport: str = "grpc"): @@ -1524,7 +1541,7 @@ def test_get_vehicle(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_vehicle), "__call__") as call: @@ -1582,9 +1599,10 @@ def test_get_vehicle_non_empty_request_with_auto_populated_field(): client.get_vehicle(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vehicle_api.GetVehicleRequest( + request_msg = vehicle_api.GetVehicleRequest( name="name_value", ) + assert args[0] == request_msg def test_get_vehicle_use_cached_wrapped_rpc(): @@ -1665,9 +1683,14 @@ async def test_get_vehicle_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_vehicle_async( - transport: str = "grpc_asyncio", request_type=vehicle_api.GetVehicleRequest -): +@pytest.mark.parametrize( + "request_type", + [ + vehicle_api.GetVehicleRequest(), + {}, + ], +) +async def test_get_vehicle_async(request_type, transport: str = "grpc_asyncio"): client = VehicleServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1675,7 +1698,7 @@ async def test_get_vehicle_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_vehicle), "__call__") as call: @@ -1712,16 +1735,11 @@ async def test_get_vehicle_async( assert response.navigation_status == fleetengine.NavigationStatus.NO_GUIDANCE -@pytest.mark.asyncio -async def test_get_vehicle_async_from_dict(): - await test_get_vehicle_async(request_type=dict) - - @pytest.mark.parametrize( "request_type", [ - vehicle_api.DeleteVehicleRequest, - dict, + vehicle_api.DeleteVehicleRequest(), + {}, ], ) def test_delete_vehicle(request_type, transport: str = "grpc"): @@ -1732,7 +1750,7 @@ def test_delete_vehicle(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_vehicle), "__call__") as call: @@ -1773,9 +1791,10 @@ def test_delete_vehicle_non_empty_request_with_auto_populated_field(): client.delete_vehicle(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vehicle_api.DeleteVehicleRequest( + request_msg = vehicle_api.DeleteVehicleRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_vehicle_use_cached_wrapped_rpc(): @@ -1856,9 +1875,14 @@ async def test_delete_vehicle_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_vehicle_async( - transport: str = "grpc_asyncio", request_type=vehicle_api.DeleteVehicleRequest -): +@pytest.mark.parametrize( + "request_type", + [ + vehicle_api.DeleteVehicleRequest(), + {}, + ], +) +async def test_delete_vehicle_async(request_type, transport: str = "grpc_asyncio"): client = VehicleServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1866,7 +1890,7 @@ async def test_delete_vehicle_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_vehicle), "__call__") as call: @@ -1884,11 +1908,6 @@ async def test_delete_vehicle_async( assert response is None -@pytest.mark.asyncio -async def test_delete_vehicle_async_from_dict(): - await test_delete_vehicle_async(request_type=dict) - - def test_delete_vehicle_flattened(): client = VehicleServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1972,8 +1991,8 @@ async def test_delete_vehicle_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - vehicle_api.UpdateVehicleRequest, - dict, + vehicle_api.UpdateVehicleRequest(), + {}, ], ) def test_update_vehicle(request_type, transport: str = "grpc"): @@ -1984,7 +2003,7 @@ def test_update_vehicle(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_vehicle), "__call__") as call: @@ -2042,9 +2061,10 @@ def test_update_vehicle_non_empty_request_with_auto_populated_field(): client.update_vehicle(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vehicle_api.UpdateVehicleRequest( + request_msg = vehicle_api.UpdateVehicleRequest( name="name_value", ) + assert args[0] == request_msg def test_update_vehicle_use_cached_wrapped_rpc(): @@ -2125,9 +2145,14 @@ async def test_update_vehicle_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_vehicle_async( - transport: str = "grpc_asyncio", request_type=vehicle_api.UpdateVehicleRequest -): +@pytest.mark.parametrize( + "request_type", + [ + vehicle_api.UpdateVehicleRequest(), + {}, + ], +) +async def test_update_vehicle_async(request_type, transport: str = "grpc_asyncio"): client = VehicleServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2135,7 +2160,7 @@ async def test_update_vehicle_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_vehicle), "__call__") as call: @@ -2172,16 +2197,11 @@ async def test_update_vehicle_async( assert response.navigation_status == fleetengine.NavigationStatus.NO_GUIDANCE -@pytest.mark.asyncio -async def test_update_vehicle_async_from_dict(): - await test_update_vehicle_async(request_type=dict) - - @pytest.mark.parametrize( "request_type", [ - vehicle_api.UpdateVehicleAttributesRequest, - dict, + vehicle_api.UpdateVehicleAttributesRequest(), + {}, ], ) def test_update_vehicle_attributes(request_type, transport: str = "grpc"): @@ -2192,7 +2212,7 @@ def test_update_vehicle_attributes(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2237,9 +2257,10 @@ def test_update_vehicle_attributes_non_empty_request_with_auto_populated_field() client.update_vehicle_attributes(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vehicle_api.UpdateVehicleAttributesRequest( + request_msg = vehicle_api.UpdateVehicleAttributesRequest( name="name_value", ) + assert args[0] == request_msg def test_update_vehicle_attributes_use_cached_wrapped_rpc(): @@ -2325,9 +2346,15 @@ async def test_update_vehicle_attributes_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + vehicle_api.UpdateVehicleAttributesRequest(), + {}, + ], +) async def test_update_vehicle_attributes_async( - transport: str = "grpc_asyncio", - request_type=vehicle_api.UpdateVehicleAttributesRequest, + request_type, transport: str = "grpc_asyncio" ): client = VehicleServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2336,7 +2363,7 @@ async def test_update_vehicle_attributes_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( @@ -2358,16 +2385,11 @@ async def test_update_vehicle_attributes_async( assert isinstance(response, vehicle_api.UpdateVehicleAttributesResponse) -@pytest.mark.asyncio -async def test_update_vehicle_attributes_async_from_dict(): - await test_update_vehicle_attributes_async(request_type=dict) - - @pytest.mark.parametrize( "request_type", [ - vehicle_api.ListVehiclesRequest, - dict, + vehicle_api.ListVehiclesRequest(), + {}, ], ) def test_list_vehicles(request_type, transport: str = "grpc"): @@ -2378,7 +2400,7 @@ def test_list_vehicles(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_vehicles), "__call__") as call: @@ -2426,11 +2448,12 @@ def test_list_vehicles_non_empty_request_with_auto_populated_field(): client.list_vehicles(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vehicle_api.ListVehiclesRequest( + request_msg = vehicle_api.ListVehiclesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_vehicles_use_cached_wrapped_rpc(): @@ -2511,9 +2534,14 @@ async def test_list_vehicles_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_vehicles_async( - transport: str = "grpc_asyncio", request_type=vehicle_api.ListVehiclesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + vehicle_api.ListVehiclesRequest(), + {}, + ], +) +async def test_list_vehicles_async(request_type, transport: str = "grpc_asyncio"): client = VehicleServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2521,7 +2549,7 @@ async def test_list_vehicles_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_vehicles), "__call__") as call: @@ -2546,11 +2574,6 @@ async def test_list_vehicles_async( assert response.total_size == 1086 -@pytest.mark.asyncio -async def test_list_vehicles_async_from_dict(): - await test_list_vehicles_async(request_type=dict) - - def test_list_vehicles_pager(transport_name: str = "grpc"): client = VehicleServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2741,8 +2764,8 @@ async def test_list_vehicles_async_pages(): @pytest.mark.parametrize( "request_type", [ - vehicle_api.SearchVehiclesRequest, - dict, + vehicle_api.SearchVehiclesRequest(), + {}, ], ) def test_search_vehicles(request_type, transport: str = "grpc"): @@ -2753,7 +2776,7 @@ def test_search_vehicles(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.search_vehicles), "__call__") as call: @@ -2796,11 +2819,12 @@ def test_search_vehicles_non_empty_request_with_auto_populated_field(): client.search_vehicles(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == vehicle_api.SearchVehiclesRequest( + request_msg = vehicle_api.SearchVehiclesRequest( parent="parent_value", trip_id="trip_id_value", filter="filter_value", ) + assert args[0] == request_msg def test_search_vehicles_use_cached_wrapped_rpc(): @@ -2881,9 +2905,14 @@ async def test_search_vehicles_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_search_vehicles_async( - transport: str = "grpc_asyncio", request_type=vehicle_api.SearchVehiclesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + vehicle_api.SearchVehiclesRequest(), + {}, + ], +) +async def test_search_vehicles_async(request_type, transport: str = "grpc_asyncio"): client = VehicleServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2891,7 +2920,7 @@ async def test_search_vehicles_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.search_vehicles), "__call__") as call: @@ -2911,11 +2940,6 @@ async def test_search_vehicles_async( assert isinstance(response, vehicle_api.SearchVehiclesResponse) -@pytest.mark.asyncio -async def test_search_vehicles_async_from_dict(): - await test_search_vehicles_async(request_type=dict) - - def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.VehicleServiceGrpcTransport( @@ -3038,7 +3062,6 @@ def test_create_vehicle_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vehicle_api.CreateVehicleRequest() - assert args[0] == request_msg @@ -3059,7 +3082,6 @@ def test_get_vehicle_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vehicle_api.GetVehicleRequest() - assert args[0] == request_msg @@ -3080,7 +3102,6 @@ def test_delete_vehicle_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vehicle_api.DeleteVehicleRequest() - assert args[0] == request_msg @@ -3101,7 +3122,6 @@ def test_update_vehicle_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vehicle_api.UpdateVehicleRequest() - assert args[0] == request_msg @@ -3124,7 +3144,6 @@ def test_update_vehicle_attributes_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vehicle_api.UpdateVehicleAttributesRequest() - assert args[0] == request_msg @@ -3145,7 +3164,6 @@ def test_list_vehicles_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vehicle_api.ListVehiclesRequest() - assert args[0] == request_msg @@ -3166,7 +3184,6 @@ def test_search_vehicles_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vehicle_api.SearchVehiclesRequest() - assert args[0] == request_msg @@ -3187,7 +3204,6 @@ def test_create_vehicle_routing_parameters_request_1_grpc(): request_msg = vehicle_api.CreateVehicleRequest( **{"parent": "providers/sample1"} ) - assert args[0] == request_msg expected_headers = {"provider_id": "providers/sample1"} @@ -3211,7 +3227,6 @@ def test_get_vehicle_routing_parameters_request_1_grpc(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = vehicle_api.GetVehicleRequest(**{"name": "providers/sample1"}) - assert args[0] == request_msg expected_headers = {"provider_id": "providers/sample1"} @@ -3235,7 +3250,6 @@ def test_delete_vehicle_routing_parameters_request_1_grpc(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = vehicle_api.DeleteVehicleRequest(**{"name": "providers/sample1"}) - assert args[0] == request_msg expected_headers = {"provider_id": "providers/sample1"} @@ -3259,7 +3273,6 @@ def test_update_vehicle_routing_parameters_request_1_grpc(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = vehicle_api.UpdateVehicleRequest(**{"name": "providers/sample1"}) - assert args[0] == request_msg expected_headers = {"provider_id": "providers/sample1"} @@ -3287,7 +3300,6 @@ def test_update_vehicle_attributes_routing_parameters_request_1_grpc(): request_msg = vehicle_api.UpdateVehicleAttributesRequest( **{"name": "providers/sample1"} ) - assert args[0] == request_msg expected_headers = {"provider_id": "providers/sample1"} @@ -3311,7 +3323,6 @@ def test_list_vehicles_routing_parameters_request_1_grpc(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = vehicle_api.ListVehiclesRequest(**{"parent": "providers/sample1"}) - assert args[0] == request_msg expected_headers = {"provider_id": "providers/sample1"} @@ -3337,7 +3348,6 @@ def test_search_vehicles_routing_parameters_request_1_grpc(): request_msg = vehicle_api.SearchVehiclesRequest( **{"parent": "providers/sample1"} ) - assert args[0] == request_msg expected_headers = {"provider_id": "providers/sample1"} @@ -3390,7 +3400,6 @@ async def test_create_vehicle_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vehicle_api.CreateVehicleRequest() - assert args[0] == request_msg @@ -3424,7 +3433,6 @@ async def test_get_vehicle_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vehicle_api.GetVehicleRequest() - assert args[0] == request_msg @@ -3447,7 +3455,6 @@ async def test_delete_vehicle_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vehicle_api.DeleteVehicleRequest() - assert args[0] == request_msg @@ -3481,7 +3488,6 @@ async def test_update_vehicle_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vehicle_api.UpdateVehicleRequest() - assert args[0] == request_msg @@ -3508,7 +3514,6 @@ async def test_update_vehicle_attributes_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vehicle_api.UpdateVehicleAttributesRequest() - assert args[0] == request_msg @@ -3536,7 +3541,6 @@ async def test_list_vehicles_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vehicle_api.ListVehiclesRequest() - assert args[0] == request_msg @@ -3561,7 +3565,6 @@ async def test_search_vehicles_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = vehicle_api.SearchVehiclesRequest() - assert args[0] == request_msg @@ -3595,7 +3598,6 @@ async def test_create_vehicle_routing_parameters_request_1_grpc_asyncio(): request_msg = vehicle_api.CreateVehicleRequest( **{"parent": "providers/sample1"} ) - assert args[0] == request_msg expected_headers = {"provider_id": "providers/sample1"} @@ -3632,7 +3634,6 @@ async def test_get_vehicle_routing_parameters_request_1_grpc_asyncio(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = vehicle_api.GetVehicleRequest(**{"name": "providers/sample1"}) - assert args[0] == request_msg expected_headers = {"provider_id": "providers/sample1"} @@ -3658,7 +3659,6 @@ async def test_delete_vehicle_routing_parameters_request_1_grpc_asyncio(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = vehicle_api.DeleteVehicleRequest(**{"name": "providers/sample1"}) - assert args[0] == request_msg expected_headers = {"provider_id": "providers/sample1"} @@ -3695,7 +3695,6 @@ async def test_update_vehicle_routing_parameters_request_1_grpc_asyncio(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = vehicle_api.UpdateVehicleRequest(**{"name": "providers/sample1"}) - assert args[0] == request_msg expected_headers = {"provider_id": "providers/sample1"} @@ -3727,7 +3726,6 @@ async def test_update_vehicle_attributes_routing_parameters_request_1_grpc_async request_msg = vehicle_api.UpdateVehicleAttributesRequest( **{"name": "providers/sample1"} ) - assert args[0] == request_msg expected_headers = {"provider_id": "providers/sample1"} @@ -3758,7 +3756,6 @@ async def test_list_vehicles_routing_parameters_request_1_grpc_asyncio(): call.assert_called() _, args, kw = call.mock_calls[0] request_msg = vehicle_api.ListVehiclesRequest(**{"parent": "providers/sample1"}) - assert args[0] == request_msg expected_headers = {"provider_id": "providers/sample1"} @@ -3788,7 +3785,6 @@ async def test_search_vehicles_routing_parameters_request_1_grpc_asyncio(): request_msg = vehicle_api.SearchVehiclesRequest( **{"parent": "providers/sample1"} ) - assert args[0] == request_msg expected_headers = {"provider_id": "providers/sample1"} diff --git a/packages/google-maps-geocode/noxfile.py b/packages/google-maps-geocode/noxfile.py index 60345629e7cb..6a24a982cd73 100644 --- a/packages/google-maps-geocode/noxfile.py +++ b/packages/google-maps-geocode/noxfile.py @@ -47,7 +47,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-maps-geocode" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-maps-geocode/setup.py b/packages/google-maps-geocode/setup.py index 193bd4a6539f..e6e2810f399d 100644 --- a/packages/google-maps-geocode/setup.py +++ b/packages/google-maps-geocode/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/google-maps-geocode/testing/constraints-3.10.txt b/packages/google-maps-geocode/testing/constraints-3.10.txt index 1a86e8abbcf5..ea5951376612 100644 --- a/packages/google-maps-geocode/testing/constraints-3.10.txt +++ b/packages/google-maps-geocode/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-geo-type==0.1.0 diff --git a/packages/google-maps-geocode/tests/unit/gapic/geocode_v4/test_destination_service.py b/packages/google-maps-geocode/tests/unit/gapic/geocode_v4/test_destination_service.py index d6a992fb58df..60734fabd2ac 100644 --- a/packages/google-maps-geocode/tests/unit/gapic/geocode_v4/test_destination_service.py +++ b/packages/google-maps-geocode/tests/unit/gapic/geocode_v4/test_destination_service.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 @@ -108,6 +109,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" @@ -1357,8 +1373,8 @@ def test_destination_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - destination_service.SearchDestinationsRequest, - dict, + destination_service.SearchDestinationsRequest(), + {}, ], ) def test_search_destinations(request_type, transport: str = "grpc"): @@ -1369,7 +1385,7 @@ def test_search_destinations(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1416,11 +1432,12 @@ def test_search_destinations_non_empty_request_with_auto_populated_field(): client.search_destinations(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == destination_service.SearchDestinationsRequest( + request_msg = destination_service.SearchDestinationsRequest( place="place_value", language_code="language_code_value", region_code="region_code_value", ) + assert args[0] == request_msg def test_search_destinations_use_cached_wrapped_rpc(): @@ -1505,10 +1522,14 @@ async def test_search_destinations_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_search_destinations_async( - transport: str = "grpc_asyncio", - request_type=destination_service.SearchDestinationsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + destination_service.SearchDestinationsRequest(), + {}, + ], +) +async def test_search_destinations_async(request_type, transport: str = "grpc_asyncio"): client = DestinationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1516,7 +1537,7 @@ async def test_search_destinations_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( @@ -1538,11 +1559,6 @@ async def test_search_destinations_async( assert isinstance(response, destination_service.SearchDestinationsResponse) -@pytest.mark.asyncio -async def test_search_destinations_async_from_dict(): - await test_search_destinations_async(request_type=dict) - - def test_search_destinations_rest_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, # instead of constructing them on each call @@ -1708,7 +1724,6 @@ def test_search_destinations_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = destination_service.SearchDestinationsRequest() - assert args[0] == request_msg @@ -1749,7 +1764,6 @@ async def test_search_destinations_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = destination_service.SearchDestinationsRequest() - assert args[0] == request_msg @@ -1918,7 +1932,6 @@ def test_search_destinations_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = destination_service.SearchDestinationsRequest() - assert args[0] == request_msg diff --git a/packages/google-maps-geocode/tests/unit/gapic/geocode_v4/test_geocode_service.py b/packages/google-maps-geocode/tests/unit/gapic/geocode_v4/test_geocode_service.py index c612bc5576f1..f041c4093008 100644 --- a/packages/google-maps-geocode/tests/unit/gapic/geocode_v4/test_geocode_service.py +++ b/packages/google-maps-geocode/tests/unit/gapic/geocode_v4/test_geocode_service.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 @@ -110,6 +111,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" @@ -1319,8 +1335,8 @@ def test_geocode_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - geocode_service.GeocodeAddressRequest, - dict, + geocode_service.GeocodeAddressRequest(), + {}, ], ) def test_geocode_address(request_type, transport: str = "grpc"): @@ -1331,7 +1347,7 @@ def test_geocode_address(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.geocode_address), "__call__") as call: @@ -1374,11 +1390,12 @@ def test_geocode_address_non_empty_request_with_auto_populated_field(): client.geocode_address(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == geocode_service.GeocodeAddressRequest( + request_msg = geocode_service.GeocodeAddressRequest( address_query="address_query_value", language_code="language_code_value", region_code="region_code_value", ) + assert args[0] == request_msg def test_geocode_address_use_cached_wrapped_rpc(): @@ -1459,9 +1476,14 @@ async def test_geocode_address_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_geocode_address_async( - transport: str = "grpc_asyncio", request_type=geocode_service.GeocodeAddressRequest -): +@pytest.mark.parametrize( + "request_type", + [ + geocode_service.GeocodeAddressRequest(), + {}, + ], +) +async def test_geocode_address_async(request_type, transport: str = "grpc_asyncio"): client = GeocodeServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1469,7 +1491,7 @@ async def test_geocode_address_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.geocode_address), "__call__") as call: @@ -1489,16 +1511,11 @@ async def test_geocode_address_async( assert isinstance(response, geocode_service.GeocodeAddressResponse) -@pytest.mark.asyncio -async def test_geocode_address_async_from_dict(): - await test_geocode_address_async(request_type=dict) - - @pytest.mark.parametrize( "request_type", [ - geocode_service.GeocodeLocationRequest, - dict, + geocode_service.GeocodeLocationRequest(), + {}, ], ) def test_geocode_location(request_type, transport: str = "grpc"): @@ -1509,7 +1526,7 @@ def test_geocode_location(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.geocode_location), "__call__") as call: @@ -1552,11 +1569,12 @@ def test_geocode_location_non_empty_request_with_auto_populated_field(): client.geocode_location(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == geocode_service.GeocodeLocationRequest( + request_msg = geocode_service.GeocodeLocationRequest( location_query="location_query_value", language_code="language_code_value", region_code="region_code_value", ) + assert args[0] == request_msg def test_geocode_location_use_cached_wrapped_rpc(): @@ -1639,9 +1657,14 @@ async def test_geocode_location_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_geocode_location_async( - transport: str = "grpc_asyncio", request_type=geocode_service.GeocodeLocationRequest -): +@pytest.mark.parametrize( + "request_type", + [ + geocode_service.GeocodeLocationRequest(), + {}, + ], +) +async def test_geocode_location_async(request_type, transport: str = "grpc_asyncio"): client = GeocodeServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1649,7 +1672,7 @@ async def test_geocode_location_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.geocode_location), "__call__") as call: @@ -1669,16 +1692,11 @@ async def test_geocode_location_async( assert isinstance(response, geocode_service.GeocodeLocationResponse) -@pytest.mark.asyncio -async def test_geocode_location_async_from_dict(): - await test_geocode_location_async(request_type=dict) - - @pytest.mark.parametrize( "request_type", [ - geocode_service.GeocodePlaceRequest, - dict, + geocode_service.GeocodePlaceRequest(), + {}, ], ) def test_geocode_place(request_type, transport: str = "grpc"): @@ -1689,7 +1707,7 @@ def test_geocode_place(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.geocode_place), "__call__") as call: @@ -1743,11 +1761,12 @@ def test_geocode_place_non_empty_request_with_auto_populated_field(): client.geocode_place(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == geocode_service.GeocodePlaceRequest( + request_msg = geocode_service.GeocodePlaceRequest( place="place_value", language_code="language_code_value", region_code="region_code_value", ) + assert args[0] == request_msg def test_geocode_place_use_cached_wrapped_rpc(): @@ -1828,9 +1847,14 @@ async def test_geocode_place_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_geocode_place_async( - transport: str = "grpc_asyncio", request_type=geocode_service.GeocodePlaceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + geocode_service.GeocodePlaceRequest(), + {}, + ], +) +async def test_geocode_place_async(request_type, transport: str = "grpc_asyncio"): client = GeocodeServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1838,7 +1862,7 @@ async def test_geocode_place_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.geocode_place), "__call__") as call: @@ -1869,11 +1893,6 @@ async def test_geocode_place_async( assert response.types == ["types_value"] -@pytest.mark.asyncio -async def test_geocode_place_async_from_dict(): - await test_geocode_place_async(request_type=dict) - - def test_geocode_place_field_headers(): client = GeocodeServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2267,7 +2286,6 @@ def test_geocode_address_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = geocode_service.GeocodeAddressRequest() - assert args[0] == request_msg @@ -2288,7 +2306,6 @@ def test_geocode_location_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = geocode_service.GeocodeLocationRequest() - assert args[0] == request_msg @@ -2309,7 +2326,6 @@ def test_geocode_place_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = geocode_service.GeocodePlaceRequest() - assert args[0] == request_msg @@ -2348,7 +2364,6 @@ async def test_geocode_address_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = geocode_service.GeocodeAddressRequest() - assert args[0] == request_msg @@ -2373,7 +2388,6 @@ async def test_geocode_location_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = geocode_service.GeocodeLocationRequest() - assert args[0] == request_msg @@ -2404,7 +2418,6 @@ async def test_geocode_place_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = geocode_service.GeocodePlaceRequest() - assert args[0] == request_msg @@ -2844,7 +2857,6 @@ def test_geocode_address_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = geocode_service.GeocodeAddressRequest() - assert args[0] == request_msg @@ -2864,7 +2876,6 @@ def test_geocode_location_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = geocode_service.GeocodeLocationRequest() - assert args[0] == request_msg @@ -2884,7 +2895,6 @@ def test_geocode_place_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = geocode_service.GeocodePlaceRequest() - assert args[0] == request_msg diff --git a/packages/google-maps-mapmanagement/noxfile.py b/packages/google-maps-mapmanagement/noxfile.py index c869eae02f02..253e9b89e435 100644 --- a/packages/google-maps-mapmanagement/noxfile.py +++ b/packages/google-maps-mapmanagement/noxfile.py @@ -47,7 +47,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-maps-mapmanagement" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-maps-mapmanagement/setup.py b/packages/google-maps-mapmanagement/setup.py index be5656a04257..17039bfee030 100644 --- a/packages/google-maps-mapmanagement/setup.py +++ b/packages/google-maps-mapmanagement/setup.py @@ -45,7 +45,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/google-maps-mapmanagement/testing/constraints-3.10.txt b/packages/google-maps-mapmanagement/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-maps-mapmanagement/testing/constraints-3.10.txt +++ b/packages/google-maps-mapmanagement/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-maps-mapmanagement/tests/unit/gapic/mapmanagement_v2beta/test_map_management.py b/packages/google-maps-mapmanagement/tests/unit/gapic/mapmanagement_v2beta/test_map_management.py index e9a0cde230a6..c7549c1a3dc8 100644 --- a/packages/google-maps-mapmanagement/tests/unit/gapic/mapmanagement_v2beta/test_map_management.py +++ b/packages/google-maps-mapmanagement/tests/unit/gapic/mapmanagement_v2beta/test_map_management.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 @@ -109,6 +110,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" @@ -1308,8 +1324,8 @@ def test_map_management_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - map_management_service.CreateMapConfigRequest, - dict, + map_management_service.CreateMapConfigRequest(), + {}, ], ) def test_create_map_config(request_type, transport: str = "grpc"): @@ -1320,7 +1336,7 @@ def test_create_map_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( @@ -1376,9 +1392,10 @@ def test_create_map_config_non_empty_request_with_auto_populated_field(): client.create_map_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == map_management_service.CreateMapConfigRequest( + request_msg = map_management_service.CreateMapConfigRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_map_config_use_cached_wrapped_rpc(): @@ -1461,10 +1478,14 @@ async def test_create_map_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_map_config_async( - transport: str = "grpc_asyncio", - request_type=map_management_service.CreateMapConfigRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + map_management_service.CreateMapConfigRequest(), + {}, + ], +) +async def test_create_map_config_async(request_type, transport: str = "grpc_asyncio"): client = MapManagementAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1472,7 +1493,7 @@ async def test_create_map_config_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( @@ -1505,11 +1526,6 @@ async def test_create_map_config_async( assert response.map_type == map_management_service.MapRenderingType.VECTOR -@pytest.mark.asyncio -async def test_create_map_config_async_from_dict(): - await test_create_map_config_async(request_type=dict) - - def test_create_map_config_field_headers(): client = MapManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1674,8 +1690,8 @@ async def test_create_map_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - map_management_service.GetMapConfigRequest, - dict, + map_management_service.GetMapConfigRequest(), + {}, ], ) def test_get_map_config(request_type, transport: str = "grpc"): @@ -1686,7 +1702,7 @@ def test_get_map_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(type(client.transport.get_map_config), "__call__") as call: @@ -1738,9 +1754,10 @@ def test_get_map_config_non_empty_request_with_auto_populated_field(): client.get_map_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == map_management_service.GetMapConfigRequest( + request_msg = map_management_service.GetMapConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_map_config_use_cached_wrapped_rpc(): @@ -1821,10 +1838,14 @@ async def test_get_map_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_map_config_async( - transport: str = "grpc_asyncio", - request_type=map_management_service.GetMapConfigRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + map_management_service.GetMapConfigRequest(), + {}, + ], +) +async def test_get_map_config_async(request_type, transport: str = "grpc_asyncio"): client = MapManagementAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1832,7 +1853,7 @@ async def test_get_map_config_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_map_config), "__call__") as call: @@ -1863,11 +1884,6 @@ async def test_get_map_config_async( assert response.map_type == map_management_service.MapRenderingType.VECTOR -@pytest.mark.asyncio -async def test_get_map_config_async_from_dict(): - await test_get_map_config_async(request_type=dict) - - def test_get_map_config_field_headers(): client = MapManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2014,8 +2030,8 @@ async def test_get_map_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - map_management_service.ListMapConfigsRequest, - dict, + map_management_service.ListMapConfigsRequest(), + {}, ], ) def test_list_map_configs(request_type, transport: str = "grpc"): @@ -2026,7 +2042,7 @@ def test_list_map_configs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_map_configs), "__call__") as call: @@ -2071,10 +2087,11 @@ def test_list_map_configs_non_empty_request_with_auto_populated_field(): client.list_map_configs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == map_management_service.ListMapConfigsRequest( + request_msg = map_management_service.ListMapConfigsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_map_configs_use_cached_wrapped_rpc(): @@ -2157,10 +2174,14 @@ async def test_list_map_configs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_map_configs_async( - transport: str = "grpc_asyncio", - request_type=map_management_service.ListMapConfigsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + map_management_service.ListMapConfigsRequest(), + {}, + ], +) +async def test_list_map_configs_async(request_type, transport: str = "grpc_asyncio"): client = MapManagementAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2168,7 +2189,7 @@ async def test_list_map_configs_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_map_configs), "__call__") as call: @@ -2191,11 +2212,6 @@ async def test_list_map_configs_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_map_configs_async_from_dict(): - await test_list_map_configs_async(request_type=dict) - - def test_list_map_configs_field_headers(): client = MapManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2532,8 +2548,8 @@ async def test_list_map_configs_async_pages(): @pytest.mark.parametrize( "request_type", [ - map_management_service.UpdateMapConfigRequest, - dict, + map_management_service.UpdateMapConfigRequest(), + {}, ], ) def test_update_map_config(request_type, transport: str = "grpc"): @@ -2544,7 +2560,7 @@ def test_update_map_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( @@ -2598,7 +2614,8 @@ def test_update_map_config_non_empty_request_with_auto_populated_field(): client.update_map_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == map_management_service.UpdateMapConfigRequest() + request_msg = map_management_service.UpdateMapConfigRequest() + assert args[0] == request_msg def test_update_map_config_use_cached_wrapped_rpc(): @@ -2681,10 +2698,14 @@ async def test_update_map_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_map_config_async( - transport: str = "grpc_asyncio", - request_type=map_management_service.UpdateMapConfigRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + map_management_service.UpdateMapConfigRequest(), + {}, + ], +) +async def test_update_map_config_async(request_type, transport: str = "grpc_asyncio"): client = MapManagementAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2692,7 +2713,7 @@ async def test_update_map_config_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( @@ -2725,11 +2746,6 @@ async def test_update_map_config_async( assert response.map_type == map_management_service.MapRenderingType.VECTOR -@pytest.mark.asyncio -async def test_update_map_config_async_from_dict(): - await test_update_map_config_async(request_type=dict) - - def test_update_map_config_field_headers(): client = MapManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2894,8 +2910,8 @@ async def test_update_map_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - map_management_service.DeleteMapConfigRequest, - dict, + map_management_service.DeleteMapConfigRequest(), + {}, ], ) def test_delete_map_config(request_type, transport: str = "grpc"): @@ -2906,7 +2922,7 @@ def test_delete_map_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( @@ -2951,9 +2967,10 @@ def test_delete_map_config_non_empty_request_with_auto_populated_field(): client.delete_map_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == map_management_service.DeleteMapConfigRequest( + request_msg = map_management_service.DeleteMapConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_map_config_use_cached_wrapped_rpc(): @@ -3036,10 +3053,14 @@ async def test_delete_map_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_map_config_async( - transport: str = "grpc_asyncio", - request_type=map_management_service.DeleteMapConfigRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + map_management_service.DeleteMapConfigRequest(), + {}, + ], +) +async def test_delete_map_config_async(request_type, transport: str = "grpc_asyncio"): client = MapManagementAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3047,7 +3068,7 @@ async def test_delete_map_config_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( @@ -3067,11 +3088,6 @@ async def test_delete_map_config_async( assert response is None -@pytest.mark.asyncio -async def test_delete_map_config_async_from_dict(): - await test_delete_map_config_async(request_type=dict) - - def test_delete_map_config_field_headers(): client = MapManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3232,8 +3248,8 @@ async def test_delete_map_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - map_management_service.CreateStyleConfigRequest, - dict, + map_management_service.CreateStyleConfigRequest(), + {}, ], ) def test_create_style_config(request_type, transport: str = "grpc"): @@ -3244,7 +3260,7 @@ def test_create_style_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( @@ -3300,9 +3316,10 @@ def test_create_style_config_non_empty_request_with_auto_populated_field(): client.create_style_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == map_management_service.CreateStyleConfigRequest( + request_msg = map_management_service.CreateStyleConfigRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_style_config_use_cached_wrapped_rpc(): @@ -3387,10 +3404,14 @@ async def test_create_style_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_style_config_async( - transport: str = "grpc_asyncio", - request_type=map_management_service.CreateStyleConfigRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + map_management_service.CreateStyleConfigRequest(), + {}, + ], +) +async def test_create_style_config_async(request_type, transport: str = "grpc_asyncio"): client = MapManagementAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3398,7 +3419,7 @@ async def test_create_style_config_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( @@ -3431,11 +3452,6 @@ async def test_create_style_config_async( assert response.json_style_sheet == "json_style_sheet_value" -@pytest.mark.asyncio -async def test_create_style_config_async_from_dict(): - await test_create_style_config_async(request_type=dict) - - def test_create_style_config_field_headers(): client = MapManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3600,8 +3616,8 @@ async def test_create_style_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - map_management_service.GetStyleConfigRequest, - dict, + map_management_service.GetStyleConfigRequest(), + {}, ], ) def test_get_style_config(request_type, transport: str = "grpc"): @@ -3612,7 +3628,7 @@ def test_get_style_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(type(client.transport.get_style_config), "__call__") as call: @@ -3664,9 +3680,10 @@ def test_get_style_config_non_empty_request_with_auto_populated_field(): client.get_style_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == map_management_service.GetStyleConfigRequest( + request_msg = map_management_service.GetStyleConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_style_config_use_cached_wrapped_rpc(): @@ -3749,10 +3766,14 @@ async def test_get_style_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_style_config_async( - transport: str = "grpc_asyncio", - request_type=map_management_service.GetStyleConfigRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + map_management_service.GetStyleConfigRequest(), + {}, + ], +) +async def test_get_style_config_async(request_type, transport: str = "grpc_asyncio"): client = MapManagementAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3760,7 +3781,7 @@ async def test_get_style_config_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_style_config), "__call__") as call: @@ -3791,11 +3812,6 @@ async def test_get_style_config_async( assert response.json_style_sheet == "json_style_sheet_value" -@pytest.mark.asyncio -async def test_get_style_config_async_from_dict(): - await test_get_style_config_async(request_type=dict) - - def test_get_style_config_field_headers(): client = MapManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3942,8 +3958,8 @@ async def test_get_style_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - map_management_service.ListStyleConfigsRequest, - dict, + map_management_service.ListStyleConfigsRequest(), + {}, ], ) def test_list_style_configs(request_type, transport: str = "grpc"): @@ -3954,7 +3970,7 @@ def test_list_style_configs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4004,11 +4020,12 @@ def test_list_style_configs_non_empty_request_with_auto_populated_field(): client.list_style_configs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == map_management_service.ListStyleConfigsRequest( + request_msg = map_management_service.ListStyleConfigsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_style_configs_use_cached_wrapped_rpc(): @@ -4093,10 +4110,14 @@ async def test_list_style_configs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_style_configs_async( - transport: str = "grpc_asyncio", - request_type=map_management_service.ListStyleConfigsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + map_management_service.ListStyleConfigsRequest(), + {}, + ], +) +async def test_list_style_configs_async(request_type, transport: str = "grpc_asyncio"): client = MapManagementAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4104,7 +4125,7 @@ async def test_list_style_configs_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( @@ -4129,11 +4150,6 @@ async def test_list_style_configs_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_style_configs_async_from_dict(): - await test_list_style_configs_async(request_type=dict) - - def test_list_style_configs_field_headers(): client = MapManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4486,8 +4502,8 @@ async def test_list_style_configs_async_pages(): @pytest.mark.parametrize( "request_type", [ - map_management_service.UpdateStyleConfigRequest, - dict, + map_management_service.UpdateStyleConfigRequest(), + {}, ], ) def test_update_style_config(request_type, transport: str = "grpc"): @@ -4498,7 +4514,7 @@ def test_update_style_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( @@ -4552,7 +4568,8 @@ def test_update_style_config_non_empty_request_with_auto_populated_field(): client.update_style_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == map_management_service.UpdateStyleConfigRequest() + request_msg = map_management_service.UpdateStyleConfigRequest() + assert args[0] == request_msg def test_update_style_config_use_cached_wrapped_rpc(): @@ -4637,10 +4654,14 @@ async def test_update_style_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_style_config_async( - transport: str = "grpc_asyncio", - request_type=map_management_service.UpdateStyleConfigRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + map_management_service.UpdateStyleConfigRequest(), + {}, + ], +) +async def test_update_style_config_async(request_type, transport: str = "grpc_asyncio"): client = MapManagementAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -4648,7 +4669,7 @@ async def test_update_style_config_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( @@ -4681,11 +4702,6 @@ async def test_update_style_config_async( assert response.json_style_sheet == "json_style_sheet_value" -@pytest.mark.asyncio -async def test_update_style_config_async_from_dict(): - await test_update_style_config_async(request_type=dict) - - def test_update_style_config_field_headers(): client = MapManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4850,8 +4866,8 @@ async def test_update_style_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - map_management_service.DeleteStyleConfigRequest, - dict, + map_management_service.DeleteStyleConfigRequest(), + {}, ], ) def test_delete_style_config(request_type, transport: str = "grpc"): @@ -4862,7 +4878,7 @@ def test_delete_style_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( @@ -4907,9 +4923,10 @@ def test_delete_style_config_non_empty_request_with_auto_populated_field(): client.delete_style_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == map_management_service.DeleteStyleConfigRequest( + request_msg = map_management_service.DeleteStyleConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_style_config_use_cached_wrapped_rpc(): @@ -4994,10 +5011,14 @@ async def test_delete_style_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_style_config_async( - transport: str = "grpc_asyncio", - request_type=map_management_service.DeleteStyleConfigRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + map_management_service.DeleteStyleConfigRequest(), + {}, + ], +) +async def test_delete_style_config_async(request_type, transport: str = "grpc_asyncio"): client = MapManagementAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -5005,7 +5026,7 @@ async def test_delete_style_config_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( @@ -5025,11 +5046,6 @@ async def test_delete_style_config_async( assert response is None -@pytest.mark.asyncio -async def test_delete_style_config_async_from_dict(): - await test_delete_style_config_async(request_type=dict) - - def test_delete_style_config_field_headers(): client = MapManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5180,8 +5196,8 @@ async def test_delete_style_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - map_management_service.CreateMapContextConfigRequest, - dict, + map_management_service.CreateMapContextConfigRequest(), + {}, ], ) def test_create_map_context_config(request_type, transport: str = "grpc"): @@ -5192,7 +5208,7 @@ def test_create_map_context_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( @@ -5254,9 +5270,10 @@ def test_create_map_context_config_non_empty_request_with_auto_populated_field() client.create_map_context_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == map_management_service.CreateMapContextConfigRequest( + request_msg = map_management_service.CreateMapContextConfigRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_map_context_config_use_cached_wrapped_rpc(): @@ -5342,9 +5359,15 @@ async def test_create_map_context_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + map_management_service.CreateMapContextConfigRequest(), + {}, + ], +) async def test_create_map_context_config_async( - transport: str = "grpc_asyncio", - request_type=map_management_service.CreateMapContextConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = MapManagementAsyncClient( credentials=async_anonymous_credentials(), @@ -5353,7 +5376,7 @@ async def test_create_map_context_config_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( @@ -5392,11 +5415,6 @@ async def test_create_map_context_config_async( ] -@pytest.mark.asyncio -async def test_create_map_context_config_async_from_dict(): - await test_create_map_context_config_async(request_type=dict) - - def test_create_map_context_config_field_headers(): client = MapManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5569,8 +5587,8 @@ async def test_create_map_context_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - map_management_service.GetMapContextConfigRequest, - dict, + map_management_service.GetMapContextConfigRequest(), + {}, ], ) def test_get_map_context_config(request_type, transport: str = "grpc"): @@ -5581,7 +5599,7 @@ def test_get_map_context_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( @@ -5643,9 +5661,10 @@ def test_get_map_context_config_non_empty_request_with_auto_populated_field(): client.get_map_context_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == map_management_service.GetMapContextConfigRequest( + request_msg = map_management_service.GetMapContextConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_get_map_context_config_use_cached_wrapped_rpc(): @@ -5731,9 +5750,15 @@ async def test_get_map_context_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + map_management_service.GetMapContextConfigRequest(), + {}, + ], +) async def test_get_map_context_config_async( - transport: str = "grpc_asyncio", - request_type=map_management_service.GetMapContextConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = MapManagementAsyncClient( credentials=async_anonymous_credentials(), @@ -5742,7 +5767,7 @@ async def test_get_map_context_config_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( @@ -5781,11 +5806,6 @@ async def test_get_map_context_config_async( ] -@pytest.mark.asyncio -async def test_get_map_context_config_async_from_dict(): - await test_get_map_context_config_async(request_type=dict) - - def test_get_map_context_config_field_headers(): client = MapManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5940,8 +5960,8 @@ async def test_get_map_context_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - map_management_service.ListMapContextConfigsRequest, - dict, + map_management_service.ListMapContextConfigsRequest(), + {}, ], ) def test_list_map_context_configs(request_type, transport: str = "grpc"): @@ -5952,7 +5972,7 @@ def test_list_map_context_configs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6001,10 +6021,11 @@ def test_list_map_context_configs_non_empty_request_with_auto_populated_field(): client.list_map_context_configs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == map_management_service.ListMapContextConfigsRequest( + request_msg = map_management_service.ListMapContextConfigsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_map_context_configs_use_cached_wrapped_rpc(): @@ -6090,9 +6111,15 @@ async def test_list_map_context_configs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + map_management_service.ListMapContextConfigsRequest(), + {}, + ], +) async def test_list_map_context_configs_async( - transport: str = "grpc_asyncio", - request_type=map_management_service.ListMapContextConfigsRequest, + request_type, transport: str = "grpc_asyncio" ): client = MapManagementAsyncClient( credentials=async_anonymous_credentials(), @@ -6101,7 +6128,7 @@ async def test_list_map_context_configs_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( @@ -6126,11 +6153,6 @@ async def test_list_map_context_configs_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_map_context_configs_async_from_dict(): - await test_list_map_context_configs_async(request_type=dict) - - def test_list_map_context_configs_field_headers(): client = MapManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6489,8 +6511,8 @@ async def test_list_map_context_configs_async_pages(): @pytest.mark.parametrize( "request_type", [ - map_management_service.UpdateMapContextConfigRequest, - dict, + map_management_service.UpdateMapContextConfigRequest(), + {}, ], ) def test_update_map_context_config(request_type, transport: str = "grpc"): @@ -6501,7 +6523,7 @@ def test_update_map_context_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( @@ -6561,7 +6583,8 @@ def test_update_map_context_config_non_empty_request_with_auto_populated_field() client.update_map_context_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == map_management_service.UpdateMapContextConfigRequest() + request_msg = map_management_service.UpdateMapContextConfigRequest() + assert args[0] == request_msg def test_update_map_context_config_use_cached_wrapped_rpc(): @@ -6647,9 +6670,15 @@ async def test_update_map_context_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + map_management_service.UpdateMapContextConfigRequest(), + {}, + ], +) async def test_update_map_context_config_async( - transport: str = "grpc_asyncio", - request_type=map_management_service.UpdateMapContextConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = MapManagementAsyncClient( credentials=async_anonymous_credentials(), @@ -6658,7 +6687,7 @@ async def test_update_map_context_config_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( @@ -6697,11 +6726,6 @@ async def test_update_map_context_config_async( ] -@pytest.mark.asyncio -async def test_update_map_context_config_async_from_dict(): - await test_update_map_context_config_async(request_type=dict) - - def test_update_map_context_config_field_headers(): client = MapManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6874,8 +6898,8 @@ async def test_update_map_context_config_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - map_management_service.DeleteMapContextConfigRequest, - dict, + map_management_service.DeleteMapContextConfigRequest(), + {}, ], ) def test_delete_map_context_config(request_type, transport: str = "grpc"): @@ -6886,7 +6910,7 @@ def test_delete_map_context_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( @@ -6931,9 +6955,10 @@ def test_delete_map_context_config_non_empty_request_with_auto_populated_field() client.delete_map_context_config(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == map_management_service.DeleteMapContextConfigRequest( + request_msg = map_management_service.DeleteMapContextConfigRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_map_context_config_use_cached_wrapped_rpc(): @@ -7019,9 +7044,15 @@ async def test_delete_map_context_config_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + map_management_service.DeleteMapContextConfigRequest(), + {}, + ], +) async def test_delete_map_context_config_async( - transport: str = "grpc_asyncio", - request_type=map_management_service.DeleteMapContextConfigRequest, + request_type, transport: str = "grpc_asyncio" ): client = MapManagementAsyncClient( credentials=async_anonymous_credentials(), @@ -7030,7 +7061,7 @@ async def test_delete_map_context_config_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( @@ -7050,11 +7081,6 @@ async def test_delete_map_context_config_async( assert response is None -@pytest.mark.asyncio -async def test_delete_map_context_config_async_from_dict(): - await test_delete_map_context_config_async(request_type=dict) - - def test_delete_map_context_config_field_headers(): client = MapManagementClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10325,7 +10351,6 @@ def test_create_map_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = map_management_service.CreateMapConfigRequest() - assert args[0] == request_msg @@ -10346,7 +10371,6 @@ def test_get_map_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = map_management_service.GetMapConfigRequest() - assert args[0] == request_msg @@ -10367,7 +10391,6 @@ def test_list_map_configs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = map_management_service.ListMapConfigsRequest() - assert args[0] == request_msg @@ -10390,7 +10413,6 @@ def test_update_map_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = map_management_service.UpdateMapConfigRequest() - assert args[0] == request_msg @@ -10413,7 +10435,6 @@ def test_delete_map_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = map_management_service.DeleteMapConfigRequest() - assert args[0] == request_msg @@ -10436,7 +10457,6 @@ def test_create_style_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = map_management_service.CreateStyleConfigRequest() - assert args[0] == request_msg @@ -10457,7 +10477,6 @@ def test_get_style_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = map_management_service.GetStyleConfigRequest() - assert args[0] == request_msg @@ -10480,7 +10499,6 @@ def test_list_style_configs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = map_management_service.ListStyleConfigsRequest() - assert args[0] == request_msg @@ -10503,7 +10521,6 @@ def test_update_style_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = map_management_service.UpdateStyleConfigRequest() - assert args[0] == request_msg @@ -10526,7 +10543,6 @@ def test_delete_style_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = map_management_service.DeleteStyleConfigRequest() - assert args[0] == request_msg @@ -10549,7 +10565,6 @@ def test_create_map_context_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = map_management_service.CreateMapContextConfigRequest() - assert args[0] == request_msg @@ -10572,7 +10587,6 @@ def test_get_map_context_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = map_management_service.GetMapContextConfigRequest() - assert args[0] == request_msg @@ -10595,7 +10609,6 @@ def test_list_map_context_configs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = map_management_service.ListMapContextConfigsRequest() - assert args[0] == request_msg @@ -10618,7 +10631,6 @@ def test_update_map_context_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = map_management_service.UpdateMapContextConfigRequest() - assert args[0] == request_msg @@ -10641,7 +10653,6 @@ def test_delete_map_context_config_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = map_management_service.DeleteMapContextConfigRequest() - assert args[0] == request_msg @@ -10688,7 +10699,6 @@ async def test_create_map_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = map_management_service.CreateMapConfigRequest() - assert args[0] == request_msg @@ -10719,7 +10729,6 @@ async def test_get_map_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = map_management_service.GetMapConfigRequest() - assert args[0] == request_msg @@ -10746,7 +10755,6 @@ async def test_list_map_configs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = map_management_service.ListMapConfigsRequest() - assert args[0] == request_msg @@ -10779,7 +10787,6 @@ async def test_update_map_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = map_management_service.UpdateMapConfigRequest() - assert args[0] == request_msg @@ -10804,7 +10811,6 @@ async def test_delete_map_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = map_management_service.DeleteMapConfigRequest() - assert args[0] == request_msg @@ -10837,7 +10843,6 @@ async def test_create_style_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = map_management_service.CreateStyleConfigRequest() - assert args[0] == request_msg @@ -10868,7 +10873,6 @@ async def test_get_style_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = map_management_service.GetStyleConfigRequest() - assert args[0] == request_msg @@ -10897,7 +10901,6 @@ async def test_list_style_configs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = map_management_service.ListStyleConfigsRequest() - assert args[0] == request_msg @@ -10930,7 +10933,6 @@ async def test_update_style_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = map_management_service.UpdateStyleConfigRequest() - assert args[0] == request_msg @@ -10955,7 +10957,6 @@ async def test_delete_style_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = map_management_service.DeleteStyleConfigRequest() - assert args[0] == request_msg @@ -10991,7 +10992,6 @@ async def test_create_map_context_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = map_management_service.CreateMapContextConfigRequest() - assert args[0] == request_msg @@ -11027,7 +11027,6 @@ async def test_get_map_context_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = map_management_service.GetMapContextConfigRequest() - assert args[0] == request_msg @@ -11056,7 +11055,6 @@ async def test_list_map_context_configs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = map_management_service.ListMapContextConfigsRequest() - assert args[0] == request_msg @@ -11092,7 +11090,6 @@ async def test_update_map_context_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = map_management_service.UpdateMapContextConfigRequest() - assert args[0] == request_msg @@ -11117,7 +11114,6 @@ async def test_delete_map_context_config_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = map_management_service.DeleteMapContextConfigRequest() - assert args[0] == request_msg @@ -13672,7 +13668,6 @@ def test_create_map_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = map_management_service.CreateMapConfigRequest() - assert args[0] == request_msg @@ -13692,7 +13687,6 @@ def test_get_map_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = map_management_service.GetMapConfigRequest() - assert args[0] == request_msg @@ -13712,7 +13706,6 @@ def test_list_map_configs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = map_management_service.ListMapConfigsRequest() - assert args[0] == request_msg @@ -13734,7 +13727,6 @@ def test_update_map_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = map_management_service.UpdateMapConfigRequest() - assert args[0] == request_msg @@ -13756,7 +13748,6 @@ def test_delete_map_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = map_management_service.DeleteMapConfigRequest() - assert args[0] == request_msg @@ -13778,7 +13769,6 @@ def test_create_style_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = map_management_service.CreateStyleConfigRequest() - assert args[0] == request_msg @@ -13798,7 +13788,6 @@ def test_get_style_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = map_management_service.GetStyleConfigRequest() - assert args[0] == request_msg @@ -13820,7 +13809,6 @@ def test_list_style_configs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = map_management_service.ListStyleConfigsRequest() - assert args[0] == request_msg @@ -13842,7 +13830,6 @@ def test_update_style_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = map_management_service.UpdateStyleConfigRequest() - assert args[0] == request_msg @@ -13864,7 +13851,6 @@ def test_delete_style_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = map_management_service.DeleteStyleConfigRequest() - assert args[0] == request_msg @@ -13886,7 +13872,6 @@ def test_create_map_context_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = map_management_service.CreateMapContextConfigRequest() - assert args[0] == request_msg @@ -13908,7 +13893,6 @@ def test_get_map_context_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = map_management_service.GetMapContextConfigRequest() - assert args[0] == request_msg @@ -13930,7 +13914,6 @@ def test_list_map_context_configs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = map_management_service.ListMapContextConfigsRequest() - assert args[0] == request_msg @@ -13952,7 +13935,6 @@ def test_update_map_context_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = map_management_service.UpdateMapContextConfigRequest() - assert args[0] == request_msg @@ -13974,7 +13956,6 @@ def test_delete_map_context_config_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = map_management_service.DeleteMapContextConfigRequest() - assert args[0] == request_msg diff --git a/packages/google-maps-mapsplatformdatasets/noxfile.py b/packages/google-maps-mapsplatformdatasets/noxfile.py index 7c6de2c4afff..d04d30a53abe 100644 --- a/packages/google-maps-mapsplatformdatasets/noxfile.py +++ b/packages/google-maps-mapsplatformdatasets/noxfile.py @@ -47,7 +47,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-maps-mapsplatformdatasets" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-maps-mapsplatformdatasets/setup.py b/packages/google-maps-mapsplatformdatasets/setup.py index 9ed29bf0756b..31f32789eaee 100644 --- a/packages/google-maps-mapsplatformdatasets/setup.py +++ b/packages/google-maps-mapsplatformdatasets/setup.py @@ -45,7 +45,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/google-maps-mapsplatformdatasets/testing/constraints-3.10.txt b/packages/google-maps-mapsplatformdatasets/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-maps-mapsplatformdatasets/testing/constraints-3.10.txt +++ b/packages/google-maps-mapsplatformdatasets/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-maps-mapsplatformdatasets/tests/unit/gapic/mapsplatformdatasets_v1/test_maps_platform_datasets.py b/packages/google-maps-mapsplatformdatasets/tests/unit/gapic/mapsplatformdatasets_v1/test_maps_platform_datasets.py index 7a27016f7b50..699d9eacb52b 100644 --- a/packages/google-maps-mapsplatformdatasets/tests/unit/gapic/mapsplatformdatasets_v1/test_maps_platform_datasets.py +++ b/packages/google-maps-mapsplatformdatasets/tests/unit/gapic/mapsplatformdatasets_v1/test_maps_platform_datasets.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 @@ -115,6 +116,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" @@ -1378,8 +1394,8 @@ def test_maps_platform_datasets_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - maps_platform_datasets.CreateDatasetRequest, - dict, + maps_platform_datasets.CreateDatasetRequest(), + {}, ], ) def test_create_dataset(request_type, transport: str = "grpc"): @@ -1390,7 +1406,7 @@ def test_create_dataset(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_dataset), "__call__") as call: @@ -1444,9 +1460,10 @@ def test_create_dataset_non_empty_request_with_auto_populated_field(): client.create_dataset(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == maps_platform_datasets.CreateDatasetRequest( + request_msg = maps_platform_datasets.CreateDatasetRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_dataset_use_cached_wrapped_rpc(): @@ -1527,10 +1544,14 @@ async def test_create_dataset_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_dataset_async( - transport: str = "grpc_asyncio", - request_type=maps_platform_datasets.CreateDatasetRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + maps_platform_datasets.CreateDatasetRequest(), + {}, + ], +) +async def test_create_dataset_async(request_type, transport: str = "grpc_asyncio"): client = MapsPlatformDatasetsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1538,7 +1559,7 @@ async def test_create_dataset_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_dataset), "__call__") as call: @@ -1571,11 +1592,6 @@ async def test_create_dataset_async( assert response.version_description == "version_description_value" -@pytest.mark.asyncio -async def test_create_dataset_async_from_dict(): - await test_create_dataset_async(request_type=dict) - - def test_create_dataset_field_headers(): client = MapsPlatformDatasetsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1728,8 +1744,8 @@ async def test_create_dataset_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - maps_platform_datasets.UpdateDatasetMetadataRequest, - dict, + maps_platform_datasets.UpdateDatasetMetadataRequest(), + {}, ], ) def test_update_dataset_metadata(request_type, transport: str = "grpc"): @@ -1740,7 +1756,7 @@ def test_update_dataset_metadata(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1796,7 +1812,8 @@ def test_update_dataset_metadata_non_empty_request_with_auto_populated_field(): client.update_dataset_metadata(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == maps_platform_datasets.UpdateDatasetMetadataRequest() + request_msg = maps_platform_datasets.UpdateDatasetMetadataRequest() + assert args[0] == request_msg def test_update_dataset_metadata_use_cached_wrapped_rpc(): @@ -1882,9 +1899,15 @@ async def test_update_dataset_metadata_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + maps_platform_datasets.UpdateDatasetMetadataRequest(), + {}, + ], +) async def test_update_dataset_metadata_async( - transport: str = "grpc_asyncio", - request_type=maps_platform_datasets.UpdateDatasetMetadataRequest, + request_type, transport: str = "grpc_asyncio" ): client = MapsPlatformDatasetsAsyncClient( credentials=async_anonymous_credentials(), @@ -1893,7 +1916,7 @@ async def test_update_dataset_metadata_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( @@ -1928,11 +1951,6 @@ async def test_update_dataset_metadata_async( assert response.version_description == "version_description_value" -@pytest.mark.asyncio -async def test_update_dataset_metadata_async_from_dict(): - await test_update_dataset_metadata_async(request_type=dict) - - def test_update_dataset_metadata_field_headers(): client = MapsPlatformDatasetsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2093,8 +2111,8 @@ async def test_update_dataset_metadata_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - maps_platform_datasets.GetDatasetRequest, - dict, + maps_platform_datasets.GetDatasetRequest(), + {}, ], ) def test_get_dataset(request_type, transport: str = "grpc"): @@ -2105,7 +2123,7 @@ def test_get_dataset(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_dataset), "__call__") as call: @@ -2159,9 +2177,10 @@ def test_get_dataset_non_empty_request_with_auto_populated_field(): client.get_dataset(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == maps_platform_datasets.GetDatasetRequest( + request_msg = maps_platform_datasets.GetDatasetRequest( name="name_value", ) + assert args[0] == request_msg def test_get_dataset_use_cached_wrapped_rpc(): @@ -2242,10 +2261,14 @@ async def test_get_dataset_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_dataset_async( - transport: str = "grpc_asyncio", - request_type=maps_platform_datasets.GetDatasetRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + maps_platform_datasets.GetDatasetRequest(), + {}, + ], +) +async def test_get_dataset_async(request_type, transport: str = "grpc_asyncio"): client = MapsPlatformDatasetsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2253,7 +2276,7 @@ async def test_get_dataset_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_dataset), "__call__") as call: @@ -2286,11 +2309,6 @@ async def test_get_dataset_async( assert response.version_description == "version_description_value" -@pytest.mark.asyncio -async def test_get_dataset_async_from_dict(): - await test_get_dataset_async(request_type=dict) - - def test_get_dataset_field_headers(): client = MapsPlatformDatasetsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2433,8 +2451,8 @@ async def test_get_dataset_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - maps_platform_datasets.FetchDatasetErrorsRequest, - dict, + maps_platform_datasets.FetchDatasetErrorsRequest(), + {}, ], ) def test_fetch_dataset_errors(request_type, transport: str = "grpc"): @@ -2445,7 +2463,7 @@ def test_fetch_dataset_errors(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2494,10 +2512,11 @@ def test_fetch_dataset_errors_non_empty_request_with_auto_populated_field(): client.fetch_dataset_errors(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == maps_platform_datasets.FetchDatasetErrorsRequest( + request_msg = maps_platform_datasets.FetchDatasetErrorsRequest( dataset="dataset_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_fetch_dataset_errors_use_cached_wrapped_rpc(): @@ -2582,9 +2601,15 @@ async def test_fetch_dataset_errors_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + maps_platform_datasets.FetchDatasetErrorsRequest(), + {}, + ], +) async def test_fetch_dataset_errors_async( - transport: str = "grpc_asyncio", - request_type=maps_platform_datasets.FetchDatasetErrorsRequest, + request_type, transport: str = "grpc_asyncio" ): client = MapsPlatformDatasetsAsyncClient( credentials=async_anonymous_credentials(), @@ -2593,7 +2618,7 @@ async def test_fetch_dataset_errors_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( @@ -2618,11 +2643,6 @@ async def test_fetch_dataset_errors_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_fetch_dataset_errors_async_from_dict(): - await test_fetch_dataset_errors_async(request_type=dict) - - def test_fetch_dataset_errors_field_headers(): client = MapsPlatformDatasetsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2975,8 +2995,8 @@ async def test_fetch_dataset_errors_async_pages(): @pytest.mark.parametrize( "request_type", [ - maps_platform_datasets.ListDatasetsRequest, - dict, + maps_platform_datasets.ListDatasetsRequest(), + {}, ], ) def test_list_datasets(request_type, transport: str = "grpc"): @@ -2987,7 +3007,7 @@ def test_list_datasets(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_datasets), "__call__") as call: @@ -3033,11 +3053,12 @@ def test_list_datasets_non_empty_request_with_auto_populated_field(): client.list_datasets(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == maps_platform_datasets.ListDatasetsRequest( + request_msg = maps_platform_datasets.ListDatasetsRequest( parent="parent_value", page_token="page_token_value", tag="tag_value", ) + assert args[0] == request_msg def test_list_datasets_use_cached_wrapped_rpc(): @@ -3118,10 +3139,14 @@ async def test_list_datasets_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_datasets_async( - transport: str = "grpc_asyncio", - request_type=maps_platform_datasets.ListDatasetsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + maps_platform_datasets.ListDatasetsRequest(), + {}, + ], +) +async def test_list_datasets_async(request_type, transport: str = "grpc_asyncio"): client = MapsPlatformDatasetsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3129,7 +3154,7 @@ async def test_list_datasets_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_datasets), "__call__") as call: @@ -3152,11 +3177,6 @@ async def test_list_datasets_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_datasets_async_from_dict(): - await test_list_datasets_async(request_type=dict) - - def test_list_datasets_field_headers(): client = MapsPlatformDatasetsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3493,8 +3513,8 @@ async def test_list_datasets_async_pages(): @pytest.mark.parametrize( "request_type", [ - maps_platform_datasets.DeleteDatasetRequest, - dict, + maps_platform_datasets.DeleteDatasetRequest(), + {}, ], ) def test_delete_dataset(request_type, transport: str = "grpc"): @@ -3505,7 +3525,7 @@ def test_delete_dataset(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_dataset), "__call__") as call: @@ -3546,9 +3566,10 @@ def test_delete_dataset_non_empty_request_with_auto_populated_field(): client.delete_dataset(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == maps_platform_datasets.DeleteDatasetRequest( + request_msg = maps_platform_datasets.DeleteDatasetRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_dataset_use_cached_wrapped_rpc(): @@ -3629,10 +3650,14 @@ async def test_delete_dataset_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_dataset_async( - transport: str = "grpc_asyncio", - request_type=maps_platform_datasets.DeleteDatasetRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + maps_platform_datasets.DeleteDatasetRequest(), + {}, + ], +) +async def test_delete_dataset_async(request_type, transport: str = "grpc_asyncio"): client = MapsPlatformDatasetsAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3640,7 +3665,7 @@ async def test_delete_dataset_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_dataset), "__call__") as call: @@ -3658,11 +3683,6 @@ async def test_delete_dataset_async( assert response is None -@pytest.mark.asyncio -async def test_delete_dataset_async_from_dict(): - await test_delete_dataset_async(request_type=dict) - - def test_delete_dataset_field_headers(): client = MapsPlatformDatasetsClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5162,7 +5182,6 @@ def test_create_dataset_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = maps_platform_datasets.CreateDatasetRequest() - assert args[0] == request_msg @@ -5185,7 +5204,6 @@ def test_update_dataset_metadata_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = maps_platform_datasets.UpdateDatasetMetadataRequest() - assert args[0] == request_msg @@ -5206,7 +5224,6 @@ def test_get_dataset_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = maps_platform_datasets.GetDatasetRequest() - assert args[0] == request_msg @@ -5229,7 +5246,6 @@ def test_fetch_dataset_errors_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = maps_platform_datasets.FetchDatasetErrorsRequest() - assert args[0] == request_msg @@ -5250,7 +5266,6 @@ def test_list_datasets_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = maps_platform_datasets.ListDatasetsRequest() - assert args[0] == request_msg @@ -5271,7 +5286,6 @@ def test_delete_dataset_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = maps_platform_datasets.DeleteDatasetRequest() - assert args[0] == request_msg @@ -5317,7 +5331,6 @@ async def test_create_dataset_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = maps_platform_datasets.CreateDatasetRequest() - assert args[0] == request_msg @@ -5351,7 +5364,6 @@ async def test_update_dataset_metadata_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = maps_platform_datasets.UpdateDatasetMetadataRequest() - assert args[0] == request_msg @@ -5383,7 +5395,6 @@ async def test_get_dataset_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = maps_platform_datasets.GetDatasetRequest() - assert args[0] == request_msg @@ -5412,7 +5423,6 @@ async def test_fetch_dataset_errors_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = maps_platform_datasets.FetchDatasetErrorsRequest() - assert args[0] == request_msg @@ -5439,7 +5449,6 @@ async def test_list_datasets_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = maps_platform_datasets.ListDatasetsRequest() - assert args[0] == request_msg @@ -5462,7 +5471,6 @@ async def test_delete_dataset_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = maps_platform_datasets.DeleteDatasetRequest() - assert args[0] == request_msg @@ -6469,7 +6477,6 @@ def test_create_dataset_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = maps_platform_datasets.CreateDatasetRequest() - assert args[0] == request_msg @@ -6491,7 +6498,6 @@ def test_update_dataset_metadata_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = maps_platform_datasets.UpdateDatasetMetadataRequest() - assert args[0] == request_msg @@ -6511,7 +6517,6 @@ def test_get_dataset_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = maps_platform_datasets.GetDatasetRequest() - assert args[0] == request_msg @@ -6533,7 +6538,6 @@ def test_fetch_dataset_errors_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = maps_platform_datasets.FetchDatasetErrorsRequest() - assert args[0] == request_msg @@ -6553,7 +6557,6 @@ def test_list_datasets_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = maps_platform_datasets.ListDatasetsRequest() - assert args[0] == request_msg @@ -6573,7 +6576,6 @@ def test_delete_dataset_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = maps_platform_datasets.DeleteDatasetRequest() - assert args[0] == request_msg diff --git a/packages/google-maps-navconnect/noxfile.py b/packages/google-maps-navconnect/noxfile.py index ce21b77f27c3..1d057e793d4b 100644 --- a/packages/google-maps-navconnect/noxfile.py +++ b/packages/google-maps-navconnect/noxfile.py @@ -47,7 +47,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-maps-navconnect" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-maps-navconnect/setup.py b/packages/google-maps-navconnect/setup.py index c895357d6880..c4634db58cad 100644 --- a/packages/google-maps-navconnect/setup.py +++ b/packages/google-maps-navconnect/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/google-maps-navconnect/testing/constraints-3.10.txt b/packages/google-maps-navconnect/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-maps-navconnect/testing/constraints-3.10.txt +++ b/packages/google-maps-navconnect/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-maps-navconnect/tests/unit/gapic/navconnect_v1/test_nav_connect_service.py b/packages/google-maps-navconnect/tests/unit/gapic/navconnect_v1/test_nav_connect_service.py index 64866590619b..91c26afefcfc 100644 --- a/packages/google-maps-navconnect/tests/unit/gapic/navconnect_v1/test_nav_connect_service.py +++ b/packages/google-maps-navconnect/tests/unit/gapic/navconnect_v1/test_nav_connect_service.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 @@ -110,6 +111,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" @@ -1351,8 +1367,8 @@ def test_nav_connect_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - navconnect_service.CreateTripRequest, - dict, + navconnect_service.CreateTripRequest(), + {}, ], ) def test_create_trip(request_type, transport: str = "grpc"): @@ -1363,7 +1379,7 @@ def test_create_trip(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_trip), "__call__") as call: @@ -1413,9 +1429,10 @@ def test_create_trip_non_empty_request_with_auto_populated_field(): client.create_trip(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == navconnect_service.CreateTripRequest( + request_msg = navconnect_service.CreateTripRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_trip_use_cached_wrapped_rpc(): @@ -1496,9 +1513,14 @@ async def test_create_trip_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_trip_async( - transport: str = "grpc_asyncio", request_type=navconnect_service.CreateTripRequest -): +@pytest.mark.parametrize( + "request_type", + [ + navconnect_service.CreateTripRequest(), + {}, + ], +) +async def test_create_trip_async(request_type, transport: str = "grpc_asyncio"): client = NavConnectServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1506,7 +1528,7 @@ async def test_create_trip_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_trip), "__call__") as call: @@ -1535,11 +1557,6 @@ async def test_create_trip_async( assert response.state == navconnect_service.Trip.State.NEW -@pytest.mark.asyncio -async def test_create_trip_async_from_dict(): - await test_create_trip_async(request_type=dict) - - def test_create_trip_field_headers(): client = NavConnectServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1706,8 +1723,8 @@ async def test_create_trip_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - navconnect_service.GetTripRequest, - dict, + navconnect_service.GetTripRequest(), + {}, ], ) def test_get_trip(request_type, transport: str = "grpc"): @@ -1718,7 +1735,7 @@ def test_get_trip(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_trip), "__call__") as call: @@ -1768,9 +1785,10 @@ def test_get_trip_non_empty_request_with_auto_populated_field(): client.get_trip(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == navconnect_service.GetTripRequest( + request_msg = navconnect_service.GetTripRequest( name="name_value", ) + assert args[0] == request_msg def test_get_trip_use_cached_wrapped_rpc(): @@ -1849,9 +1867,14 @@ async def test_get_trip_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn @pytest.mark.asyncio -async def test_get_trip_async( - transport: str = "grpc_asyncio", request_type=navconnect_service.GetTripRequest -): +@pytest.mark.parametrize( + "request_type", + [ + navconnect_service.GetTripRequest(), + {}, + ], +) +async def test_get_trip_async(request_type, transport: str = "grpc_asyncio"): client = NavConnectServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1859,7 +1882,7 @@ async def test_get_trip_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_trip), "__call__") as call: @@ -1888,11 +1911,6 @@ async def test_get_trip_async( assert response.state == navconnect_service.Trip.State.NEW -@pytest.mark.asyncio -async def test_get_trip_async_from_dict(): - await test_get_trip_async(request_type=dict) - - def test_get_trip_field_headers(): client = NavConnectServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2538,7 +2556,6 @@ def test_create_trip_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = navconnect_service.CreateTripRequest() - assert args[0] == request_msg @@ -2559,7 +2576,6 @@ def test_get_trip_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = navconnect_service.GetTripRequest() - assert args[0] == request_msg @@ -2603,7 +2619,6 @@ async def test_create_trip_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = navconnect_service.CreateTripRequest() - assert args[0] == request_msg @@ -2633,7 +2648,6 @@ async def test_get_trip_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = navconnect_service.GetTripRequest() - assert args[0] == request_msg @@ -3036,7 +3050,6 @@ def test_create_trip_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = navconnect_service.CreateTripRequest() - assert args[0] == request_msg @@ -3056,7 +3069,6 @@ def test_get_trip_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = navconnect_service.GetTripRequest() - assert args[0] == request_msg diff --git a/packages/google-maps-places/noxfile.py b/packages/google-maps-places/noxfile.py index ed0670532f4e..e27fd8dfee63 100644 --- a/packages/google-maps-places/noxfile.py +++ b/packages/google-maps-places/noxfile.py @@ -47,7 +47,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-maps-places" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-maps-places/setup.py b/packages/google-maps-places/setup.py index e0dc3597cf42..a625b8be55dd 100644 --- a/packages/google-maps-places/setup.py +++ b/packages/google-maps-places/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/google-maps-places/testing/constraints-3.10.txt b/packages/google-maps-places/testing/constraints-3.10.txt index 1a86e8abbcf5..ea5951376612 100644 --- a/packages/google-maps-places/testing/constraints-3.10.txt +++ b/packages/google-maps-places/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-geo-type==0.1.0 diff --git a/packages/google-maps-places/tests/unit/gapic/places_v1/test_places.py b/packages/google-maps-places/tests/unit/gapic/places_v1/test_places.py index abe200f29cda..2e22dcbd14ab 100644 --- a/packages/google-maps-places/tests/unit/gapic/places_v1/test_places.py +++ b/packages/google-maps-places/tests/unit/gapic/places_v1/test_places.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 @@ -128,6 +129,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" @@ -1260,8 +1276,8 @@ def test_places_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - places_service.SearchNearbyRequest, - dict, + places_service.SearchNearbyRequest(), + {}, ], ) def test_search_nearby(request_type, transport: str = "grpc"): @@ -1272,7 +1288,7 @@ def test_search_nearby(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.search_nearby), "__call__") as call: @@ -1314,10 +1330,11 @@ def test_search_nearby_non_empty_request_with_auto_populated_field(): client.search_nearby(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == places_service.SearchNearbyRequest( + request_msg = places_service.SearchNearbyRequest( language_code="language_code_value", region_code="region_code_value", ) + assert args[0] == request_msg def test_search_nearby_use_cached_wrapped_rpc(): @@ -1398,9 +1415,14 @@ async def test_search_nearby_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_search_nearby_async( - transport: str = "grpc_asyncio", request_type=places_service.SearchNearbyRequest -): +@pytest.mark.parametrize( + "request_type", + [ + places_service.SearchNearbyRequest(), + {}, + ], +) +async def test_search_nearby_async(request_type, transport: str = "grpc_asyncio"): client = PlacesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1408,7 +1430,7 @@ async def test_search_nearby_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.search_nearby), "__call__") as call: @@ -1428,16 +1450,11 @@ async def test_search_nearby_async( assert isinstance(response, places_service.SearchNearbyResponse) -@pytest.mark.asyncio -async def test_search_nearby_async_from_dict(): - await test_search_nearby_async(request_type=dict) - - @pytest.mark.parametrize( "request_type", [ - places_service.SearchTextRequest, - dict, + places_service.SearchTextRequest(), + {}, ], ) def test_search_text(request_type, transport: str = "grpc"): @@ -1448,7 +1465,7 @@ def test_search_text(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.search_text), "__call__") as call: @@ -1492,12 +1509,13 @@ def test_search_text_non_empty_request_with_auto_populated_field(): client.search_text(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == places_service.SearchTextRequest( + request_msg = places_service.SearchTextRequest( text_query="text_query_value", language_code="language_code_value", region_code="region_code_value", included_type="included_type_value", ) + assert args[0] == request_msg def test_search_text_use_cached_wrapped_rpc(): @@ -1578,9 +1596,14 @@ async def test_search_text_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_search_text_async( - transport: str = "grpc_asyncio", request_type=places_service.SearchTextRequest -): +@pytest.mark.parametrize( + "request_type", + [ + places_service.SearchTextRequest(), + {}, + ], +) +async def test_search_text_async(request_type, transport: str = "grpc_asyncio"): client = PlacesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1588,7 +1611,7 @@ async def test_search_text_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.search_text), "__call__") as call: @@ -1608,16 +1631,11 @@ async def test_search_text_async( assert isinstance(response, places_service.SearchTextResponse) -@pytest.mark.asyncio -async def test_search_text_async_from_dict(): - await test_search_text_async(request_type=dict) - - @pytest.mark.parametrize( "request_type", [ - places_service.GetPhotoMediaRequest, - dict, + places_service.GetPhotoMediaRequest(), + {}, ], ) def test_get_photo_media(request_type, transport: str = "grpc"): @@ -1628,7 +1646,7 @@ def test_get_photo_media(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_photo_media), "__call__") as call: @@ -1674,9 +1692,10 @@ def test_get_photo_media_non_empty_request_with_auto_populated_field(): client.get_photo_media(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == places_service.GetPhotoMediaRequest( + request_msg = places_service.GetPhotoMediaRequest( name="name_value", ) + assert args[0] == request_msg def test_get_photo_media_use_cached_wrapped_rpc(): @@ -1757,9 +1776,14 @@ async def test_get_photo_media_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_photo_media_async( - transport: str = "grpc_asyncio", request_type=places_service.GetPhotoMediaRequest -): +@pytest.mark.parametrize( + "request_type", + [ + places_service.GetPhotoMediaRequest(), + {}, + ], +) +async def test_get_photo_media_async(request_type, transport: str = "grpc_asyncio"): client = PlacesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1767,7 +1791,7 @@ async def test_get_photo_media_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_photo_media), "__call__") as call: @@ -1792,11 +1816,6 @@ async def test_get_photo_media_async( assert response.photo_uri == "photo_uri_value" -@pytest.mark.asyncio -async def test_get_photo_media_async_from_dict(): - await test_get_photo_media_async(request_type=dict) - - def test_get_photo_media_field_headers(): client = PlacesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1943,8 +1962,8 @@ async def test_get_photo_media_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - places_service.GetPlaceRequest, - dict, + places_service.GetPlaceRequest(), + {}, ], ) def test_get_place(request_type, transport: str = "grpc"): @@ -1955,7 +1974,7 @@ def test_get_place(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_place), "__call__") as call: @@ -2088,12 +2107,13 @@ def test_get_place_non_empty_request_with_auto_populated_field(): client.get_place(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == places_service.GetPlaceRequest( + request_msg = places_service.GetPlaceRequest( name="name_value", language_code="language_code_value", region_code="region_code_value", session_token="session_token_value", ) + assert args[0] == request_msg def test_get_place_use_cached_wrapped_rpc(): @@ -2172,9 +2192,14 @@ async def test_get_place_async_use_cached_wrapped_rpc(transport: str = "grpc_asy @pytest.mark.asyncio -async def test_get_place_async( - transport: str = "grpc_asyncio", request_type=places_service.GetPlaceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + places_service.GetPlaceRequest(), + {}, + ], +) +async def test_get_place_async(request_type, transport: str = "grpc_asyncio"): client = PlacesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2182,7 +2207,7 @@ async def test_get_place_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_place), "__call__") as call: @@ -2291,11 +2316,6 @@ async def test_get_place_async( assert response.moved_place_id == "moved_place_id_value" -@pytest.mark.asyncio -async def test_get_place_async_from_dict(): - await test_get_place_async(request_type=dict) - - def test_get_place_field_headers(): client = PlacesClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2438,8 +2458,8 @@ async def test_get_place_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - places_service.AutocompletePlacesRequest, - dict, + places_service.AutocompletePlacesRequest(), + {}, ], ) def test_autocomplete_places(request_type, transport: str = "grpc"): @@ -2450,7 +2470,7 @@ def test_autocomplete_places(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2498,12 +2518,13 @@ def test_autocomplete_places_non_empty_request_with_auto_populated_field(): client.autocomplete_places(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == places_service.AutocompletePlacesRequest( + request_msg = places_service.AutocompletePlacesRequest( input="input_value", language_code="language_code_value", region_code="region_code_value", session_token="session_token_value", ) + assert args[0] == request_msg def test_autocomplete_places_use_cached_wrapped_rpc(): @@ -2588,10 +2609,14 @@ async def test_autocomplete_places_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_autocomplete_places_async( - transport: str = "grpc_asyncio", - request_type=places_service.AutocompletePlacesRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + places_service.AutocompletePlacesRequest(), + {}, + ], +) +async def test_autocomplete_places_async(request_type, transport: str = "grpc_asyncio"): client = PlacesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2599,7 +2624,7 @@ async def test_autocomplete_places_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( @@ -2621,11 +2646,6 @@ async def test_autocomplete_places_async( assert isinstance(response, places_service.AutocompletePlacesResponse) -@pytest.mark.asyncio -async def test_autocomplete_places_async_from_dict(): - await test_autocomplete_places_async(request_type=dict) - - def test_search_nearby_rest_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, # instead of constructing them on each call @@ -3495,7 +3515,6 @@ def test_search_nearby_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = places_service.SearchNearbyRequest() - assert args[0] == request_msg @@ -3516,7 +3535,6 @@ def test_search_text_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = places_service.SearchTextRequest() - assert args[0] == request_msg @@ -3537,7 +3555,6 @@ def test_get_photo_media_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = places_service.GetPhotoMediaRequest() - assert args[0] == request_msg @@ -3558,7 +3575,6 @@ def test_get_place_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = places_service.GetPlaceRequest() - assert args[0] == request_msg @@ -3581,7 +3597,6 @@ def test_autocomplete_places_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = places_service.AutocompletePlacesRequest() - assert args[0] == request_msg @@ -3620,7 +3635,6 @@ async def test_search_nearby_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = places_service.SearchNearbyRequest() - assert args[0] == request_msg @@ -3645,7 +3659,6 @@ async def test_search_text_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = places_service.SearchTextRequest() - assert args[0] == request_msg @@ -3673,7 +3686,6 @@ async def test_get_photo_media_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = places_service.GetPhotoMediaRequest() - assert args[0] == request_msg @@ -3743,7 +3755,6 @@ async def test_get_place_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = places_service.GetPlaceRequest() - assert args[0] == request_msg @@ -3770,7 +3781,6 @@ async def test_autocomplete_places_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = places_service.AutocompletePlacesRequest() - assert args[0] == request_msg @@ -4519,7 +4529,6 @@ def test_search_nearby_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = places_service.SearchNearbyRequest() - assert args[0] == request_msg @@ -4539,7 +4548,6 @@ def test_search_text_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = places_service.SearchTextRequest() - assert args[0] == request_msg @@ -4559,7 +4567,6 @@ def test_get_photo_media_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = places_service.GetPhotoMediaRequest() - assert args[0] == request_msg @@ -4579,7 +4586,6 @@ def test_get_place_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = places_service.GetPlaceRequest() - assert args[0] == request_msg @@ -4601,7 +4607,6 @@ def test_autocomplete_places_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = places_service.AutocompletePlacesRequest() - assert args[0] == request_msg diff --git a/packages/google-maps-routeoptimization/noxfile.py b/packages/google-maps-routeoptimization/noxfile.py index 2dc6b5911cf8..8293b48192cf 100644 --- a/packages/google-maps-routeoptimization/noxfile.py +++ b/packages/google-maps-routeoptimization/noxfile.py @@ -47,7 +47,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-maps-routeoptimization" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-maps-routeoptimization/setup.py b/packages/google-maps-routeoptimization/setup.py index 04bfdeaa4aae..e8c88c8a570a 100644 --- a/packages/google-maps-routeoptimization/setup.py +++ b/packages/google-maps-routeoptimization/setup.py @@ -45,7 +45,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/google-maps-routeoptimization/testing/constraints-3.10.txt b/packages/google-maps-routeoptimization/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-maps-routeoptimization/testing/constraints-3.10.txt +++ b/packages/google-maps-routeoptimization/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-maps-routeoptimization/tests/unit/gapic/routeoptimization_v1/test_route_optimization.py b/packages/google-maps-routeoptimization/tests/unit/gapic/routeoptimization_v1/test_route_optimization.py index e05fac52cb4e..9104ccc22fe5 100644 --- a/packages/google-maps-routeoptimization/tests/unit/gapic/routeoptimization_v1/test_route_optimization.py +++ b/packages/google-maps-routeoptimization/tests/unit/gapic/routeoptimization_v1/test_route_optimization.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 @@ -114,6 +115,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" @@ -1355,8 +1371,8 @@ def test_route_optimization_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - route_optimization_service.OptimizeToursRequest, - dict, + route_optimization_service.OptimizeToursRequest(), + {}, ], ) def test_optimize_tours(request_type, transport: str = "grpc"): @@ -1367,7 +1383,7 @@ def test_optimize_tours(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.optimize_tours), "__call__") as call: @@ -1412,10 +1428,11 @@ def test_optimize_tours_non_empty_request_with_auto_populated_field(): client.optimize_tours(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == route_optimization_service.OptimizeToursRequest( + request_msg = route_optimization_service.OptimizeToursRequest( parent="parent_value", label="label_value", ) + assert args[0] == request_msg def test_optimize_tours_use_cached_wrapped_rpc(): @@ -1496,10 +1513,14 @@ async def test_optimize_tours_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_optimize_tours_async( - transport: str = "grpc_asyncio", - request_type=route_optimization_service.OptimizeToursRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + route_optimization_service.OptimizeToursRequest(), + {}, + ], +) +async def test_optimize_tours_async(request_type, transport: str = "grpc_asyncio"): client = RouteOptimizationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1507,7 +1528,7 @@ async def test_optimize_tours_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.optimize_tours), "__call__") as call: @@ -1530,11 +1551,6 @@ async def test_optimize_tours_async( assert response.request_label == "request_label_value" -@pytest.mark.asyncio -async def test_optimize_tours_async_from_dict(): - await test_optimize_tours_async(request_type=dict) - - def test_optimize_tours_field_headers(): client = RouteOptimizationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1599,8 +1615,8 @@ async def test_optimize_tours_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - route_optimization_service.BatchOptimizeToursRequest, - dict, + route_optimization_service.BatchOptimizeToursRequest(), + {}, ], ) def test_batch_optimize_tours(request_type, transport: str = "grpc"): @@ -1611,7 +1627,7 @@ def test_batch_optimize_tours(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1656,9 +1672,10 @@ def test_batch_optimize_tours_non_empty_request_with_auto_populated_field(): client.batch_optimize_tours(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == route_optimization_service.BatchOptimizeToursRequest( + request_msg = route_optimization_service.BatchOptimizeToursRequest( parent="parent_value", ) + assert args[0] == request_msg def test_batch_optimize_tours_use_cached_wrapped_rpc(): @@ -1753,9 +1770,15 @@ async def test_batch_optimize_tours_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + route_optimization_service.BatchOptimizeToursRequest(), + {}, + ], +) async def test_batch_optimize_tours_async( - transport: str = "grpc_asyncio", - request_type=route_optimization_service.BatchOptimizeToursRequest, + request_type, transport: str = "grpc_asyncio" ): client = RouteOptimizationAsyncClient( credentials=async_anonymous_credentials(), @@ -1764,7 +1787,7 @@ async def test_batch_optimize_tours_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( @@ -1786,11 +1809,6 @@ async def test_batch_optimize_tours_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_batch_optimize_tours_async_from_dict(): - await test_batch_optimize_tours_async(request_type=dict) - - def test_batch_optimize_tours_field_headers(): client = RouteOptimizationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1859,8 +1877,8 @@ async def test_batch_optimize_tours_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - route_optimization_service.OptimizeToursRequest, - dict, + route_optimization_service.OptimizeToursRequest(), + {}, ], ) def test_optimize_tours_long_running(request_type, transport: str = "grpc"): @@ -1871,7 +1889,7 @@ def test_optimize_tours_long_running(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1917,10 +1935,11 @@ def test_optimize_tours_long_running_non_empty_request_with_auto_populated_field client.optimize_tours_long_running(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == route_optimization_service.OptimizeToursRequest( + request_msg = route_optimization_service.OptimizeToursRequest( parent="parent_value", label="label_value", ) + assert args[0] == request_msg def test_optimize_tours_long_running_use_cached_wrapped_rpc(): @@ -2016,9 +2035,15 @@ async def test_optimize_tours_long_running_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + route_optimization_service.OptimizeToursRequest(), + {}, + ], +) async def test_optimize_tours_long_running_async( - transport: str = "grpc_asyncio", - request_type=route_optimization_service.OptimizeToursRequest, + request_type, transport: str = "grpc_asyncio" ): client = RouteOptimizationAsyncClient( credentials=async_anonymous_credentials(), @@ -2027,7 +2052,7 @@ async def test_optimize_tours_long_running_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( @@ -2049,11 +2074,6 @@ async def test_optimize_tours_long_running_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_optimize_tours_long_running_async_from_dict(): - await test_optimize_tours_long_running_async(request_type=dict) - - def test_optimize_tours_long_running_field_headers(): client = RouteOptimizationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2122,8 +2142,8 @@ async def test_optimize_tours_long_running_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - route_optimization_service.OptimizeToursUriRequest, - dict, + route_optimization_service.OptimizeToursUriRequest(), + {}, ], ) def test_optimize_tours_uri(request_type, transport: str = "grpc"): @@ -2134,7 +2154,7 @@ def test_optimize_tours_uri(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2179,9 +2199,10 @@ def test_optimize_tours_uri_non_empty_request_with_auto_populated_field(): client.optimize_tours_uri(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == route_optimization_service.OptimizeToursUriRequest( + request_msg = route_optimization_service.OptimizeToursUriRequest( parent="parent_value", ) + assert args[0] == request_msg def test_optimize_tours_uri_use_cached_wrapped_rpc(): @@ -2276,10 +2297,14 @@ async def test_optimize_tours_uri_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_optimize_tours_uri_async( - transport: str = "grpc_asyncio", - request_type=route_optimization_service.OptimizeToursUriRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + route_optimization_service.OptimizeToursUriRequest(), + {}, + ], +) +async def test_optimize_tours_uri_async(request_type, transport: str = "grpc_asyncio"): client = RouteOptimizationAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2287,7 +2312,7 @@ async def test_optimize_tours_uri_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( @@ -2309,11 +2334,6 @@ async def test_optimize_tours_uri_async( assert isinstance(response, future.Future) -@pytest.mark.asyncio -async def test_optimize_tours_uri_async_from_dict(): - await test_optimize_tours_uri_async(request_type=dict) - - def test_optimize_tours_uri_field_headers(): client = RouteOptimizationClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3021,7 +3041,6 @@ def test_optimize_tours_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = route_optimization_service.OptimizeToursRequest() - assert args[0] == request_msg @@ -3044,7 +3063,6 @@ def test_batch_optimize_tours_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = route_optimization_service.BatchOptimizeToursRequest() - assert args[0] == request_msg @@ -3067,7 +3085,6 @@ def test_optimize_tours_long_running_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = route_optimization_service.OptimizeToursRequest() - assert args[0] == request_msg @@ -3090,7 +3107,6 @@ def test_optimize_tours_uri_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = route_optimization_service.OptimizeToursUriRequest() - assert args[0] == request_msg @@ -3131,7 +3147,6 @@ async def test_optimize_tours_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = route_optimization_service.OptimizeToursRequest() - assert args[0] == request_msg @@ -3158,7 +3173,6 @@ async def test_batch_optimize_tours_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = route_optimization_service.BatchOptimizeToursRequest() - assert args[0] == request_msg @@ -3185,7 +3199,6 @@ async def test_optimize_tours_long_running_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = route_optimization_service.OptimizeToursRequest() - assert args[0] == request_msg @@ -3212,7 +3225,6 @@ async def test_optimize_tours_uri_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = route_optimization_service.OptimizeToursUriRequest() - assert args[0] == request_msg @@ -3825,7 +3837,6 @@ def test_optimize_tours_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = route_optimization_service.OptimizeToursRequest() - assert args[0] == request_msg @@ -3847,7 +3858,6 @@ def test_batch_optimize_tours_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = route_optimization_service.BatchOptimizeToursRequest() - assert args[0] == request_msg @@ -3869,7 +3879,6 @@ def test_optimize_tours_long_running_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = route_optimization_service.OptimizeToursRequest() - assert args[0] == request_msg @@ -3891,7 +3900,6 @@ def test_optimize_tours_uri_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = route_optimization_service.OptimizeToursUriRequest() - assert args[0] == request_msg diff --git a/packages/google-maps-routing/noxfile.py b/packages/google-maps-routing/noxfile.py index 4938923469ad..e2059db87494 100644 --- a/packages/google-maps-routing/noxfile.py +++ b/packages/google-maps-routing/noxfile.py @@ -47,7 +47,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-maps-routing" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-maps-routing/setup.py b/packages/google-maps-routing/setup.py index fed3a56969ca..72db4db4484d 100644 --- a/packages/google-maps-routing/setup.py +++ b/packages/google-maps-routing/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/google-maps-routing/testing/constraints-3.10.txt b/packages/google-maps-routing/testing/constraints-3.10.txt index 1a86e8abbcf5..ea5951376612 100644 --- a/packages/google-maps-routing/testing/constraints-3.10.txt +++ b/packages/google-maps-routing/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-geo-type==0.1.0 diff --git a/packages/google-maps-routing/tests/unit/gapic/routing_v2/test_routes.py b/packages/google-maps-routing/tests/unit/gapic/routing_v2/test_routes.py index c7f90136c792..c5699a25a09c 100644 --- a/packages/google-maps-routing/tests/unit/gapic/routing_v2/test_routes.py +++ b/packages/google-maps-routing/tests/unit/gapic/routing_v2/test_routes.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 @@ -128,6 +129,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" @@ -1260,8 +1276,8 @@ def test_routes_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - routes_service.ComputeRoutesRequest, - dict, + routes_service.ComputeRoutesRequest(), + {}, ], ) def test_compute_routes(request_type, transport: str = "grpc"): @@ -1272,7 +1288,7 @@ def test_compute_routes(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.compute_routes), "__call__") as call: @@ -1314,10 +1330,11 @@ def test_compute_routes_non_empty_request_with_auto_populated_field(): client.compute_routes(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == routes_service.ComputeRoutesRequest( + request_msg = routes_service.ComputeRoutesRequest( language_code="language_code_value", region_code="region_code_value", ) + assert args[0] == request_msg def test_compute_routes_use_cached_wrapped_rpc(): @@ -1398,9 +1415,14 @@ async def test_compute_routes_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_compute_routes_async( - transport: str = "grpc_asyncio", request_type=routes_service.ComputeRoutesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + routes_service.ComputeRoutesRequest(), + {}, + ], +) +async def test_compute_routes_async(request_type, transport: str = "grpc_asyncio"): client = RoutesAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1408,7 +1430,7 @@ async def test_compute_routes_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.compute_routes), "__call__") as call: @@ -1428,16 +1450,11 @@ async def test_compute_routes_async( assert isinstance(response, routes_service.ComputeRoutesResponse) -@pytest.mark.asyncio -async def test_compute_routes_async_from_dict(): - await test_compute_routes_async(request_type=dict) - - @pytest.mark.parametrize( "request_type", [ - routes_service.ComputeRouteMatrixRequest, - dict, + routes_service.ComputeRouteMatrixRequest(), + {}, ], ) def test_compute_route_matrix(request_type, transport: str = "grpc"): @@ -1448,7 +1465,7 @@ def test_compute_route_matrix(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1495,10 +1512,11 @@ def test_compute_route_matrix_non_empty_request_with_auto_populated_field(): client.compute_route_matrix(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == routes_service.ComputeRouteMatrixRequest( + request_msg = routes_service.ComputeRouteMatrixRequest( language_code="language_code_value", region_code="region_code_value", ) + assert args[0] == request_msg def test_compute_route_matrix_use_cached_wrapped_rpc(): @@ -1583,9 +1601,15 @@ async def test_compute_route_matrix_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + routes_service.ComputeRouteMatrixRequest(), + {}, + ], +) async def test_compute_route_matrix_async( - transport: str = "grpc_asyncio", - request_type=routes_service.ComputeRouteMatrixRequest, + request_type, transport: str = "grpc_asyncio" ): client = RoutesAsyncClient( credentials=async_anonymous_credentials(), @@ -1594,7 +1618,7 @@ async def test_compute_route_matrix_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( @@ -1618,11 +1642,6 @@ async def test_compute_route_matrix_async( assert isinstance(message, routes_service.RouteMatrixElement) -@pytest.mark.asyncio -async def test_compute_route_matrix_async_from_dict(): - await test_compute_route_matrix_async(request_type=dict) - - def test_compute_routes_rest_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, # instead of constructing them on each call @@ -2001,7 +2020,6 @@ def test_compute_routes_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = routes_service.ComputeRoutesRequest() - assert args[0] == request_msg @@ -2024,7 +2042,6 @@ def test_compute_route_matrix_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = routes_service.ComputeRouteMatrixRequest() - assert args[0] == request_msg @@ -2063,7 +2080,6 @@ async def test_compute_routes_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = routes_service.ComputeRoutesRequest() - assert args[0] == request_msg @@ -2091,7 +2107,6 @@ async def test_compute_route_matrix_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = routes_service.ComputeRouteMatrixRequest() - assert args[0] == request_msg @@ -2395,7 +2410,6 @@ def test_compute_routes_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = routes_service.ComputeRoutesRequest() - assert args[0] == request_msg @@ -2417,7 +2431,6 @@ def test_compute_route_matrix_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = routes_service.ComputeRouteMatrixRequest() - assert args[0] == request_msg diff --git a/packages/google-maps-solar/noxfile.py b/packages/google-maps-solar/noxfile.py index 262780d08ad1..f08fec5fb5d2 100644 --- a/packages/google-maps-solar/noxfile.py +++ b/packages/google-maps-solar/noxfile.py @@ -47,7 +47,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-maps-solar" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-maps-solar/setup.py b/packages/google-maps-solar/setup.py index fc6ea6c95f51..f435db555b02 100644 --- a/packages/google-maps-solar/setup.py +++ b/packages/google-maps-solar/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/google-maps-solar/testing/constraints-3.10.txt b/packages/google-maps-solar/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-maps-solar/testing/constraints-3.10.txt +++ b/packages/google-maps-solar/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-maps-solar/tests/unit/gapic/solar_v1/test_solar.py b/packages/google-maps-solar/tests/unit/gapic/solar_v1/test_solar.py index 17471549372a..3995c0333484 100644 --- a/packages/google-maps-solar/tests/unit/gapic/solar_v1/test_solar.py +++ b/packages/google-maps-solar/tests/unit/gapic/solar_v1/test_solar.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 @@ -110,6 +111,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" @@ -1238,8 +1254,8 @@ def test_solar_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - solar_service.FindClosestBuildingInsightsRequest, - dict, + solar_service.FindClosestBuildingInsightsRequest(), + {}, ], ) def test_find_closest_building_insights(request_type, transport: str = "grpc"): @@ -1250,7 +1266,7 @@ def test_find_closest_building_insights(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1306,7 +1322,8 @@ def test_find_closest_building_insights_non_empty_request_with_auto_populated_fi client.find_closest_building_insights(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == solar_service.FindClosestBuildingInsightsRequest() + request_msg = solar_service.FindClosestBuildingInsightsRequest() + assert args[0] == request_msg def test_find_closest_building_insights_use_cached_wrapped_rpc(): @@ -1392,9 +1409,15 @@ async def test_find_closest_building_insights_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + solar_service.FindClosestBuildingInsightsRequest(), + {}, + ], +) async def test_find_closest_building_insights_async( - transport: str = "grpc_asyncio", - request_type=solar_service.FindClosestBuildingInsightsRequest, + request_type, transport: str = "grpc_asyncio" ): client = SolarAsyncClient( credentials=async_anonymous_credentials(), @@ -1403,7 +1426,7 @@ async def test_find_closest_building_insights_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( @@ -1438,16 +1461,11 @@ async def test_find_closest_building_insights_async( assert response.imagery_quality == solar_service.ImageryQuality.HIGH -@pytest.mark.asyncio -async def test_find_closest_building_insights_async_from_dict(): - await test_find_closest_building_insights_async(request_type=dict) - - @pytest.mark.parametrize( "request_type", [ - solar_service.GetDataLayersRequest, - dict, + solar_service.GetDataLayersRequest(), + {}, ], ) def test_get_data_layers(request_type, transport: str = "grpc"): @@ -1458,7 +1476,7 @@ def test_get_data_layers(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_data_layers), "__call__") as call: @@ -1512,7 +1530,8 @@ def test_get_data_layers_non_empty_request_with_auto_populated_field(): client.get_data_layers(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == solar_service.GetDataLayersRequest() + request_msg = solar_service.GetDataLayersRequest() + assert args[0] == request_msg def test_get_data_layers_use_cached_wrapped_rpc(): @@ -1593,9 +1612,14 @@ async def test_get_data_layers_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_data_layers_async( - transport: str = "grpc_asyncio", request_type=solar_service.GetDataLayersRequest -): +@pytest.mark.parametrize( + "request_type", + [ + solar_service.GetDataLayersRequest(), + {}, + ], +) +async def test_get_data_layers_async(request_type, transport: str = "grpc_asyncio"): client = SolarAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1603,7 +1627,7 @@ async def test_get_data_layers_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_data_layers), "__call__") as call: @@ -1638,16 +1662,11 @@ async def test_get_data_layers_async( assert response.imagery_quality == solar_service.ImageryQuality.HIGH -@pytest.mark.asyncio -async def test_get_data_layers_async_from_dict(): - await test_get_data_layers_async(request_type=dict) - - @pytest.mark.parametrize( "request_type", [ - solar_service.GetGeoTiffRequest, - dict, + solar_service.GetGeoTiffRequest(), + {}, ], ) def test_get_geo_tiff(request_type, transport: str = "grpc"): @@ -1658,7 +1677,7 @@ def test_get_geo_tiff(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_geo_tiff), "__call__") as call: @@ -1704,9 +1723,10 @@ def test_get_geo_tiff_non_empty_request_with_auto_populated_field(): client.get_geo_tiff(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == solar_service.GetGeoTiffRequest( + request_msg = solar_service.GetGeoTiffRequest( id="id_value", ) + assert args[0] == request_msg def test_get_geo_tiff_use_cached_wrapped_rpc(): @@ -1787,9 +1807,14 @@ async def test_get_geo_tiff_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_geo_tiff_async( - transport: str = "grpc_asyncio", request_type=solar_service.GetGeoTiffRequest -): +@pytest.mark.parametrize( + "request_type", + [ + solar_service.GetGeoTiffRequest(), + {}, + ], +) +async def test_get_geo_tiff_async(request_type, transport: str = "grpc_asyncio"): client = SolarAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1797,7 +1822,7 @@ async def test_get_geo_tiff_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_geo_tiff), "__call__") as call: @@ -1822,11 +1847,6 @@ async def test_get_geo_tiff_async( assert response.data == b"data_blob" -@pytest.mark.asyncio -async def test_get_geo_tiff_async_from_dict(): - await test_get_geo_tiff_async(request_type=dict) - - def test_find_closest_building_insights_rest_use_cached_wrapped_rpc(): # Clients should use _prep_wrapped_messages to create cached wrapped rpcs, # instead of constructing them on each call @@ -2381,7 +2401,6 @@ def test_find_closest_building_insights_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = solar_service.FindClosestBuildingInsightsRequest() - assert args[0] == request_msg @@ -2402,7 +2421,6 @@ def test_get_data_layers_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = solar_service.GetDataLayersRequest() - assert args[0] == request_msg @@ -2423,7 +2441,6 @@ def test_get_geo_tiff_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = solar_service.GetGeoTiffRequest() - assert args[0] == request_msg @@ -2471,7 +2488,6 @@ async def test_find_closest_building_insights_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = solar_service.FindClosestBuildingInsightsRequest() - assert args[0] == request_msg @@ -2504,7 +2520,6 @@ async def test_get_data_layers_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = solar_service.GetDataLayersRequest() - assert args[0] == request_msg @@ -2532,7 +2547,6 @@ async def test_get_geo_tiff_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = solar_service.GetGeoTiffRequest() - assert args[0] == request_msg @@ -2970,7 +2984,6 @@ def test_find_closest_building_insights_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = solar_service.FindClosestBuildingInsightsRequest() - assert args[0] == request_msg @@ -2990,7 +3003,6 @@ def test_get_data_layers_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = solar_service.GetDataLayersRequest() - assert args[0] == request_msg @@ -3010,7 +3022,6 @@ def test_get_geo_tiff_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = solar_service.GetGeoTiffRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-css/noxfile.py b/packages/google-shopping-css/noxfile.py index 171c116d58af..02e587c9552e 100644 --- a/packages/google-shopping-css/noxfile.py +++ b/packages/google-shopping-css/noxfile.py @@ -47,7 +47,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-shopping-css" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-shopping-css/setup.py b/packages/google-shopping-css/setup.py index e46c29d0b77b..42a8a1c8dea4 100644 --- a/packages/google-shopping-css/setup.py +++ b/packages/google-shopping-css/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/google-shopping-css/testing/constraints-3.10.txt b/packages/google-shopping-css/testing/constraints-3.10.txt index 28927d49b296..b408428a99a2 100644 --- a/packages/google-shopping-css/testing/constraints-3.10.txt +++ b/packages/google-shopping-css/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-shopping-type==1.0.0 diff --git a/packages/google-shopping-css/tests/unit/gapic/css_v1/test_account_labels_service.py b/packages/google-shopping-css/tests/unit/gapic/css_v1/test_account_labels_service.py index 4232a275e2f3..b63434754f9a 100644 --- a/packages/google-shopping-css/tests/unit/gapic/css_v1/test_account_labels_service.py +++ b/packages/google-shopping-css/tests/unit/gapic/css_v1/test_account_labels_service.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 @@ -107,6 +108,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" @@ -1370,8 +1386,8 @@ def test_account_labels_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - accounts_labels.ListAccountLabelsRequest, - dict, + accounts_labels.ListAccountLabelsRequest(), + {}, ], ) def test_list_account_labels(request_type, transport: str = "grpc"): @@ -1382,7 +1398,7 @@ def test_list_account_labels(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1431,10 +1447,11 @@ def test_list_account_labels_non_empty_request_with_auto_populated_field(): client.list_account_labels(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == accounts_labels.ListAccountLabelsRequest( + request_msg = accounts_labels.ListAccountLabelsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_account_labels_use_cached_wrapped_rpc(): @@ -1519,10 +1536,14 @@ async def test_list_account_labels_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_account_labels_async( - transport: str = "grpc_asyncio", - request_type=accounts_labels.ListAccountLabelsRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + accounts_labels.ListAccountLabelsRequest(), + {}, + ], +) +async def test_list_account_labels_async(request_type, transport: str = "grpc_asyncio"): client = AccountLabelsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1530,7 +1551,7 @@ async def test_list_account_labels_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( @@ -1555,11 +1576,6 @@ async def test_list_account_labels_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_account_labels_async_from_dict(): - await test_list_account_labels_async(request_type=dict) - - def test_list_account_labels_field_headers(): client = AccountLabelsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1912,8 +1928,8 @@ async def test_list_account_labels_async_pages(): @pytest.mark.parametrize( "request_type", [ - accounts_labels.CreateAccountLabelRequest, - dict, + accounts_labels.CreateAccountLabelRequest(), + {}, ], ) def test_create_account_label(request_type, transport: str = "grpc"): @@ -1924,7 +1940,7 @@ def test_create_account_label(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1982,9 +1998,10 @@ def test_create_account_label_non_empty_request_with_auto_populated_field(): client.create_account_label(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == accounts_labels.CreateAccountLabelRequest( + request_msg = accounts_labels.CreateAccountLabelRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_account_label_use_cached_wrapped_rpc(): @@ -2069,9 +2086,15 @@ async def test_create_account_label_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + accounts_labels.CreateAccountLabelRequest(), + {}, + ], +) async def test_create_account_label_async( - transport: str = "grpc_asyncio", - request_type=accounts_labels.CreateAccountLabelRequest, + request_type, transport: str = "grpc_asyncio" ): client = AccountLabelsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2080,7 +2103,7 @@ async def test_create_account_label_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( @@ -2115,11 +2138,6 @@ async def test_create_account_label_async( assert response.label_type == accounts_labels.AccountLabel.LabelType.MANUAL -@pytest.mark.asyncio -async def test_create_account_label_async_from_dict(): - await test_create_account_label_async(request_type=dict) - - def test_create_account_label_field_headers(): client = AccountLabelsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2284,8 +2302,8 @@ async def test_create_account_label_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - accounts_labels.UpdateAccountLabelRequest, - dict, + accounts_labels.UpdateAccountLabelRequest(), + {}, ], ) def test_update_account_label(request_type, transport: str = "grpc"): @@ -2296,7 +2314,7 @@ def test_update_account_label(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2352,7 +2370,8 @@ def test_update_account_label_non_empty_request_with_auto_populated_field(): client.update_account_label(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == accounts_labels.UpdateAccountLabelRequest() + request_msg = accounts_labels.UpdateAccountLabelRequest() + assert args[0] == request_msg def test_update_account_label_use_cached_wrapped_rpc(): @@ -2437,9 +2456,15 @@ async def test_update_account_label_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + accounts_labels.UpdateAccountLabelRequest(), + {}, + ], +) async def test_update_account_label_async( - transport: str = "grpc_asyncio", - request_type=accounts_labels.UpdateAccountLabelRequest, + request_type, transport: str = "grpc_asyncio" ): client = AccountLabelsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2448,7 +2473,7 @@ async def test_update_account_label_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( @@ -2483,11 +2508,6 @@ async def test_update_account_label_async( assert response.label_type == accounts_labels.AccountLabel.LabelType.MANUAL -@pytest.mark.asyncio -async def test_update_account_label_async_from_dict(): - await test_update_account_label_async(request_type=dict) - - def test_update_account_label_field_headers(): client = AccountLabelsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2642,8 +2662,8 @@ async def test_update_account_label_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - accounts_labels.DeleteAccountLabelRequest, - dict, + accounts_labels.DeleteAccountLabelRequest(), + {}, ], ) def test_delete_account_label(request_type, transport: str = "grpc"): @@ -2654,7 +2674,7 @@ def test_delete_account_label(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2699,9 +2719,10 @@ def test_delete_account_label_non_empty_request_with_auto_populated_field(): client.delete_account_label(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == accounts_labels.DeleteAccountLabelRequest( + request_msg = accounts_labels.DeleteAccountLabelRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_account_label_use_cached_wrapped_rpc(): @@ -2786,9 +2807,15 @@ async def test_delete_account_label_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + accounts_labels.DeleteAccountLabelRequest(), + {}, + ], +) async def test_delete_account_label_async( - transport: str = "grpc_asyncio", - request_type=accounts_labels.DeleteAccountLabelRequest, + request_type, transport: str = "grpc_asyncio" ): client = AccountLabelsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2797,7 +2824,7 @@ async def test_delete_account_label_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( @@ -2817,11 +2844,6 @@ async def test_delete_account_label_async( assert response is None -@pytest.mark.asyncio -async def test_delete_account_label_async_from_dict(): - await test_delete_account_label_async(request_type=dict) - - def test_delete_account_label_field_headers(): client = AccountLabelsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3895,7 +3917,6 @@ def test_list_account_labels_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accounts_labels.ListAccountLabelsRequest() - assert args[0] == request_msg @@ -3918,7 +3939,6 @@ def test_create_account_label_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accounts_labels.CreateAccountLabelRequest() - assert args[0] == request_msg @@ -3941,7 +3961,6 @@ def test_update_account_label_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accounts_labels.UpdateAccountLabelRequest() - assert args[0] == request_msg @@ -3964,7 +3983,6 @@ def test_delete_account_label_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accounts_labels.DeleteAccountLabelRequest() - assert args[0] == request_msg @@ -4007,7 +4025,6 @@ async def test_list_account_labels_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accounts_labels.ListAccountLabelsRequest() - assert args[0] == request_msg @@ -4041,7 +4058,6 @@ async def test_create_account_label_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accounts_labels.CreateAccountLabelRequest() - assert args[0] == request_msg @@ -4075,7 +4091,6 @@ async def test_update_account_label_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accounts_labels.UpdateAccountLabelRequest() - assert args[0] == request_msg @@ -4100,7 +4115,6 @@ async def test_delete_account_label_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accounts_labels.DeleteAccountLabelRequest() - assert args[0] == request_msg @@ -4818,7 +4832,6 @@ def test_list_account_labels_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accounts_labels.ListAccountLabelsRequest() - assert args[0] == request_msg @@ -4840,7 +4853,6 @@ def test_create_account_label_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accounts_labels.CreateAccountLabelRequest() - assert args[0] == request_msg @@ -4862,7 +4874,6 @@ def test_update_account_label_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accounts_labels.UpdateAccountLabelRequest() - assert args[0] == request_msg @@ -4884,7 +4895,6 @@ def test_delete_account_label_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accounts_labels.DeleteAccountLabelRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-css/tests/unit/gapic/css_v1/test_accounts_service.py b/packages/google-shopping-css/tests/unit/gapic/css_v1/test_accounts_service.py index 119ae391bdf0..9e97cedb4fe5 100644 --- a/packages/google-shopping-css/tests/unit/gapic/css_v1/test_accounts_service.py +++ b/packages/google-shopping-css/tests/unit/gapic/css_v1/test_accounts_service.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 @@ -107,6 +108,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" @@ -1334,8 +1350,8 @@ def test_accounts_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - accounts.ListChildAccountsRequest, - dict, + accounts.ListChildAccountsRequest(), + {}, ], ) def test_list_child_accounts(request_type, transport: str = "grpc"): @@ -1346,7 +1362,7 @@ def test_list_child_accounts(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1396,11 +1412,12 @@ def test_list_child_accounts_non_empty_request_with_auto_populated_field(): client.list_child_accounts(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == accounts.ListChildAccountsRequest( + request_msg = accounts.ListChildAccountsRequest( parent="parent_value", full_name="full_name_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_child_accounts_use_cached_wrapped_rpc(): @@ -1485,9 +1502,14 @@ async def test_list_child_accounts_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_child_accounts_async( - transport: str = "grpc_asyncio", request_type=accounts.ListChildAccountsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + accounts.ListChildAccountsRequest(), + {}, + ], +) +async def test_list_child_accounts_async(request_type, transport: str = "grpc_asyncio"): client = AccountsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1495,7 +1517,7 @@ async def test_list_child_accounts_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( @@ -1520,11 +1542,6 @@ async def test_list_child_accounts_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_child_accounts_async_from_dict(): - await test_list_child_accounts_async(request_type=dict) - - def test_list_child_accounts_field_headers(): client = AccountsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1877,8 +1894,8 @@ async def test_list_child_accounts_async_pages(): @pytest.mark.parametrize( "request_type", [ - accounts.GetAccountRequest, - dict, + accounts.GetAccountRequest(), + {}, ], ) def test_get_account(request_type, transport: str = "grpc"): @@ -1889,7 +1906,7 @@ def test_get_account(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_account), "__call__") as call: @@ -1948,10 +1965,11 @@ def test_get_account_non_empty_request_with_auto_populated_field(): client.get_account(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == accounts.GetAccountRequest( + request_msg = accounts.GetAccountRequest( name="name_value", parent="parent_value", ) + assert args[0] == request_msg def test_get_account_use_cached_wrapped_rpc(): @@ -2032,9 +2050,14 @@ async def test_get_account_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_account_async( - transport: str = "grpc_asyncio", request_type=accounts.GetAccountRequest -): +@pytest.mark.parametrize( + "request_type", + [ + accounts.GetAccountRequest(), + {}, + ], +) +async def test_get_account_async(request_type, transport: str = "grpc_asyncio"): client = AccountsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2042,7 +2065,7 @@ async def test_get_account_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_account), "__call__") as call: @@ -2079,11 +2102,6 @@ async def test_get_account_async( assert response.account_type == accounts.Account.AccountType.CSS_GROUP -@pytest.mark.asyncio -async def test_get_account_async_from_dict(): - await test_get_account_async(request_type=dict) - - def test_get_account_field_headers(): client = AccountsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2226,8 +2244,8 @@ async def test_get_account_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - accounts.UpdateAccountLabelsRequest, - dict, + accounts.UpdateAccountLabelsRequest(), + {}, ], ) def test_update_labels(request_type, transport: str = "grpc"): @@ -2238,7 +2256,7 @@ def test_update_labels(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_labels), "__call__") as call: @@ -2297,10 +2315,11 @@ def test_update_labels_non_empty_request_with_auto_populated_field(): client.update_labels(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == accounts.UpdateAccountLabelsRequest( + request_msg = accounts.UpdateAccountLabelsRequest( name="name_value", parent="parent_value", ) + assert args[0] == request_msg def test_update_labels_use_cached_wrapped_rpc(): @@ -2381,9 +2400,14 @@ async def test_update_labels_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_labels_async( - transport: str = "grpc_asyncio", request_type=accounts.UpdateAccountLabelsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + accounts.UpdateAccountLabelsRequest(), + {}, + ], +) +async def test_update_labels_async(request_type, transport: str = "grpc_asyncio"): client = AccountsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2391,7 +2415,7 @@ async def test_update_labels_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_labels), "__call__") as call: @@ -2428,11 +2452,6 @@ async def test_update_labels_async( assert response.account_type == accounts.Account.AccountType.CSS_GROUP -@pytest.mark.asyncio -async def test_update_labels_async_from_dict(): - await test_update_labels_async(request_type=dict) - - def test_update_labels_field_headers(): client = AccountsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3313,7 +3332,6 @@ def test_list_child_accounts_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accounts.ListChildAccountsRequest() - assert args[0] == request_msg @@ -3334,7 +3352,6 @@ def test_get_account_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accounts.GetAccountRequest() - assert args[0] == request_msg @@ -3355,7 +3372,6 @@ def test_update_labels_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accounts.UpdateAccountLabelsRequest() - assert args[0] == request_msg @@ -3398,7 +3414,6 @@ async def test_list_child_accounts_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accounts.ListChildAccountsRequest() - assert args[0] == request_msg @@ -3432,7 +3447,6 @@ async def test_get_account_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accounts.GetAccountRequest() - assert args[0] == request_msg @@ -3466,7 +3480,6 @@ async def test_update_labels_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accounts.UpdateAccountLabelsRequest() - assert args[0] == request_msg @@ -3920,7 +3933,6 @@ def test_list_child_accounts_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accounts.ListChildAccountsRequest() - assert args[0] == request_msg @@ -3940,7 +3952,6 @@ def test_get_account_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accounts.GetAccountRequest() - assert args[0] == request_msg @@ -3960,7 +3971,6 @@ def test_update_labels_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accounts.UpdateAccountLabelsRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-css/tests/unit/gapic/css_v1/test_css_product_inputs_service.py b/packages/google-shopping-css/tests/unit/gapic/css_v1/test_css_product_inputs_service.py index fa94dcfcd6a3..ffc3f3eb78cf 100644 --- a/packages/google-shopping-css/tests/unit/gapic/css_v1/test_css_product_inputs_service.py +++ b/packages/google-shopping-css/tests/unit/gapic/css_v1/test_css_product_inputs_service.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 @@ -109,6 +110,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" @@ -1378,8 +1394,8 @@ def test_css_product_inputs_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - css_product_inputs.InsertCssProductInputRequest, - dict, + css_product_inputs.InsertCssProductInputRequest(), + {}, ], ) def test_insert_css_product_input(request_type, transport: str = "grpc"): @@ -1390,7 +1406,7 @@ def test_insert_css_product_input(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1446,9 +1462,10 @@ def test_insert_css_product_input_non_empty_request_with_auto_populated_field(): client.insert_css_product_input(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == css_product_inputs.InsertCssProductInputRequest( + request_msg = css_product_inputs.InsertCssProductInputRequest( parent="parent_value", ) + assert args[0] == request_msg def test_insert_css_product_input_use_cached_wrapped_rpc(): @@ -1534,9 +1551,15 @@ async def test_insert_css_product_input_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + css_product_inputs.InsertCssProductInputRequest(), + {}, + ], +) async def test_insert_css_product_input_async( - transport: str = "grpc_asyncio", - request_type=css_product_inputs.InsertCssProductInputRequest, + request_type, transport: str = "grpc_asyncio" ): client = CssProductInputsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1545,7 +1568,7 @@ async def test_insert_css_product_input_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( @@ -1578,11 +1601,6 @@ async def test_insert_css_product_input_async( assert response.feed_label == "feed_label_value" -@pytest.mark.asyncio -async def test_insert_css_product_input_async_from_dict(): - await test_insert_css_product_input_async(request_type=dict) - - def test_insert_css_product_input_field_headers(): client = CssProductInputsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1651,8 +1669,8 @@ async def test_insert_css_product_input_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - css_product_inputs.UpdateCssProductInputRequest, - dict, + css_product_inputs.UpdateCssProductInputRequest(), + {}, ], ) def test_update_css_product_input(request_type, transport: str = "grpc"): @@ -1663,7 +1681,7 @@ def test_update_css_product_input(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1717,7 +1735,8 @@ def test_update_css_product_input_non_empty_request_with_auto_populated_field(): client.update_css_product_input(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == css_product_inputs.UpdateCssProductInputRequest() + request_msg = css_product_inputs.UpdateCssProductInputRequest() + assert args[0] == request_msg def test_update_css_product_input_use_cached_wrapped_rpc(): @@ -1803,9 +1822,15 @@ async def test_update_css_product_input_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + css_product_inputs.UpdateCssProductInputRequest(), + {}, + ], +) async def test_update_css_product_input_async( - transport: str = "grpc_asyncio", - request_type=css_product_inputs.UpdateCssProductInputRequest, + request_type, transport: str = "grpc_asyncio" ): client = CssProductInputsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1814,7 +1839,7 @@ async def test_update_css_product_input_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( @@ -1847,11 +1872,6 @@ async def test_update_css_product_input_async( assert response.feed_label == "feed_label_value" -@pytest.mark.asyncio -async def test_update_css_product_input_async_from_dict(): - await test_update_css_product_input_async(request_type=dict) - - def test_update_css_product_input_field_headers(): client = CssProductInputsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2016,8 +2036,8 @@ async def test_update_css_product_input_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - css_product_inputs.DeleteCssProductInputRequest, - dict, + css_product_inputs.DeleteCssProductInputRequest(), + {}, ], ) def test_delete_css_product_input(request_type, transport: str = "grpc"): @@ -2028,7 +2048,7 @@ def test_delete_css_product_input(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2073,9 +2093,10 @@ def test_delete_css_product_input_non_empty_request_with_auto_populated_field(): client.delete_css_product_input(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == css_product_inputs.DeleteCssProductInputRequest( + request_msg = css_product_inputs.DeleteCssProductInputRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_css_product_input_use_cached_wrapped_rpc(): @@ -2161,9 +2182,15 @@ async def test_delete_css_product_input_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + css_product_inputs.DeleteCssProductInputRequest(), + {}, + ], +) async def test_delete_css_product_input_async( - transport: str = "grpc_asyncio", - request_type=css_product_inputs.DeleteCssProductInputRequest, + request_type, transport: str = "grpc_asyncio" ): client = CssProductInputsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2172,7 +2199,7 @@ async def test_delete_css_product_input_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( @@ -2192,11 +2219,6 @@ async def test_delete_css_product_input_async( assert response is None -@pytest.mark.asyncio -async def test_delete_css_product_input_async_from_dict(): - await test_delete_css_product_input_async(request_type=dict) - - def test_delete_css_product_input_field_headers(): client = CssProductInputsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2969,7 +2991,6 @@ def test_insert_css_product_input_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = css_product_inputs.InsertCssProductInputRequest() - assert args[0] == request_msg @@ -2992,7 +3013,6 @@ def test_update_css_product_input_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = css_product_inputs.UpdateCssProductInputRequest() - assert args[0] == request_msg @@ -3015,7 +3035,6 @@ def test_delete_css_product_input_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = css_product_inputs.DeleteCssProductInputRequest() - assert args[0] == request_msg @@ -3062,7 +3081,6 @@ async def test_insert_css_product_input_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = css_product_inputs.InsertCssProductInputRequest() - assert args[0] == request_msg @@ -3095,7 +3113,6 @@ async def test_update_css_product_input_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = css_product_inputs.UpdateCssProductInputRequest() - assert args[0] == request_msg @@ -3120,7 +3137,6 @@ async def test_delete_css_product_input_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = css_product_inputs.DeleteCssProductInputRequest() - assert args[0] == request_msg @@ -3899,7 +3915,6 @@ def test_insert_css_product_input_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = css_product_inputs.InsertCssProductInputRequest() - assert args[0] == request_msg @@ -3921,7 +3936,6 @@ def test_update_css_product_input_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = css_product_inputs.UpdateCssProductInputRequest() - assert args[0] == request_msg @@ -3943,7 +3957,6 @@ def test_delete_css_product_input_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = css_product_inputs.DeleteCssProductInputRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-css/tests/unit/gapic/css_v1/test_css_products_service.py b/packages/google-shopping-css/tests/unit/gapic/css_v1/test_css_products_service.py index af3e1254d815..4e281e28ea7e 100644 --- a/packages/google-shopping-css/tests/unit/gapic/css_v1/test_css_products_service.py +++ b/packages/google-shopping-css/tests/unit/gapic/css_v1/test_css_products_service.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 @@ -108,6 +109,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" @@ -1353,8 +1369,8 @@ def test_css_products_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - css_products.GetCssProductRequest, - dict, + css_products.GetCssProductRequest(), + {}, ], ) def test_get_css_product(request_type, transport: str = "grpc"): @@ -1365,7 +1381,7 @@ def test_get_css_product(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_css_product), "__call__") as call: @@ -1415,9 +1431,10 @@ def test_get_css_product_non_empty_request_with_auto_populated_field(): client.get_css_product(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == css_products.GetCssProductRequest( + request_msg = css_products.GetCssProductRequest( name="name_value", ) + assert args[0] == request_msg def test_get_css_product_use_cached_wrapped_rpc(): @@ -1498,9 +1515,14 @@ async def test_get_css_product_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_css_product_async( - transport: str = "grpc_asyncio", request_type=css_products.GetCssProductRequest -): +@pytest.mark.parametrize( + "request_type", + [ + css_products.GetCssProductRequest(), + {}, + ], +) +async def test_get_css_product_async(request_type, transport: str = "grpc_asyncio"): client = CssProductsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1508,7 +1530,7 @@ async def test_get_css_product_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_css_product), "__call__") as call: @@ -1537,11 +1559,6 @@ async def test_get_css_product_async( assert response.feed_label == "feed_label_value" -@pytest.mark.asyncio -async def test_get_css_product_async_from_dict(): - await test_get_css_product_async(request_type=dict) - - def test_get_css_product_field_headers(): client = CssProductsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1688,8 +1705,8 @@ async def test_get_css_product_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - css_products.ListCssProductsRequest, - dict, + css_products.ListCssProductsRequest(), + {}, ], ) def test_list_css_products(request_type, transport: str = "grpc"): @@ -1700,7 +1717,7 @@ def test_list_css_products(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1749,10 +1766,11 @@ def test_list_css_products_non_empty_request_with_auto_populated_field(): client.list_css_products(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == css_products.ListCssProductsRequest( + request_msg = css_products.ListCssProductsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_css_products_use_cached_wrapped_rpc(): @@ -1835,9 +1853,14 @@ async def test_list_css_products_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_css_products_async( - transport: str = "grpc_asyncio", request_type=css_products.ListCssProductsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + css_products.ListCssProductsRequest(), + {}, + ], +) +async def test_list_css_products_async(request_type, transport: str = "grpc_asyncio"): client = CssProductsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1845,7 +1868,7 @@ async def test_list_css_products_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( @@ -1870,11 +1893,6 @@ async def test_list_css_products_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_css_products_async_from_dict(): - await test_list_css_products_async(request_type=dict) - - def test_list_css_products_field_headers(): client = CssProductsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2779,7 +2797,6 @@ def test_get_css_product_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = css_products.GetCssProductRequest() - assert args[0] == request_msg @@ -2802,7 +2819,6 @@ def test_list_css_products_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = css_products.ListCssProductsRequest() - assert args[0] == request_msg @@ -2846,7 +2862,6 @@ async def test_get_css_product_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = css_products.GetCssProductRequest() - assert args[0] == request_msg @@ -2875,7 +2890,6 @@ async def test_list_css_products_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = css_products.ListCssProductsRequest() - assert args[0] == request_msg @@ -3182,7 +3196,6 @@ def test_get_css_product_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = css_products.GetCssProductRequest() - assert args[0] == request_msg @@ -3204,7 +3217,6 @@ def test_list_css_products_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = css_products.ListCssProductsRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-css/tests/unit/gapic/css_v1/test_quota_service.py b/packages/google-shopping-css/tests/unit/gapic/css_v1/test_quota_service.py index 0b7a23fff939..bf18d6bfad6c 100644 --- a/packages/google-shopping-css/tests/unit/gapic/css_v1/test_quota_service.py +++ b/packages/google-shopping-css/tests/unit/gapic/css_v1/test_quota_service.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 @@ -107,6 +108,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" @@ -1287,8 +1303,8 @@ def test_quota_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - quota.ListQuotaGroupsRequest, - dict, + quota.ListQuotaGroupsRequest(), + {}, ], ) def test_list_quota_groups(request_type, transport: str = "grpc"): @@ -1299,7 +1315,7 @@ def test_list_quota_groups(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1348,10 +1364,11 @@ def test_list_quota_groups_non_empty_request_with_auto_populated_field(): client.list_quota_groups(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == quota.ListQuotaGroupsRequest( + request_msg = quota.ListQuotaGroupsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_quota_groups_use_cached_wrapped_rpc(): @@ -1434,9 +1451,14 @@ async def test_list_quota_groups_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_quota_groups_async( - transport: str = "grpc_asyncio", request_type=quota.ListQuotaGroupsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + quota.ListQuotaGroupsRequest(), + {}, + ], +) +async def test_list_quota_groups_async(request_type, transport: str = "grpc_asyncio"): client = QuotaServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1444,7 +1466,7 @@ async def test_list_quota_groups_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( @@ -1469,11 +1491,6 @@ async def test_list_quota_groups_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_quota_groups_async_from_dict(): - await test_list_quota_groups_async(request_type=dict) - - def test_list_quota_groups_field_headers(): client = QuotaServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2202,7 +2219,6 @@ def test_list_quota_groups_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = quota.ListQuotaGroupsRequest() - assert args[0] == request_msg @@ -2245,7 +2261,6 @@ async def test_list_quota_groups_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = quota.ListQuotaGroupsRequest() - assert args[0] == request_msg @@ -2410,7 +2425,6 @@ def test_list_quota_groups_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = quota.ListQuotaGroupsRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-accounts/noxfile.py b/packages/google-shopping-merchant-accounts/noxfile.py index 1aea962a1216..0616e719e46a 100644 --- a/packages/google-shopping-merchant-accounts/noxfile.py +++ b/packages/google-shopping-merchant-accounts/noxfile.py @@ -47,7 +47,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-shopping-merchant-accounts" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-shopping-merchant-accounts/setup.py b/packages/google-shopping-merchant-accounts/setup.py index 39437024965f..3f5197604129 100644 --- a/packages/google-shopping-merchant-accounts/setup.py +++ b/packages/google-shopping-merchant-accounts/setup.py @@ -45,7 +45,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/google-shopping-merchant-accounts/testing/constraints-3.10.txt b/packages/google-shopping-merchant-accounts/testing/constraints-3.10.txt index 28927d49b296..b408428a99a2 100644 --- a/packages/google-shopping-merchant-accounts/testing/constraints-3.10.txt +++ b/packages/google-shopping-merchant-accounts/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-shopping-type==1.0.0 diff --git a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_account_issue_service.py b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_account_issue_service.py index 542ced197204..0b850e57cee6 100644 --- a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_account_issue_service.py +++ b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_account_issue_service.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 @@ -107,6 +108,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" @@ -1370,8 +1386,8 @@ def test_account_issue_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - accountissue.ListAccountIssuesRequest, - dict, + accountissue.ListAccountIssuesRequest(), + {}, ], ) def test_list_account_issues(request_type, transport: str = "grpc"): @@ -1382,7 +1398,7 @@ def test_list_account_issues(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1433,12 +1449,13 @@ def test_list_account_issues_non_empty_request_with_auto_populated_field(): client.list_account_issues(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == accountissue.ListAccountIssuesRequest( + request_msg = accountissue.ListAccountIssuesRequest( parent="parent_value", page_token="page_token_value", language_code="language_code_value", time_zone="time_zone_value", ) + assert args[0] == request_msg def test_list_account_issues_use_cached_wrapped_rpc(): @@ -1523,9 +1540,14 @@ async def test_list_account_issues_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_account_issues_async( - transport: str = "grpc_asyncio", request_type=accountissue.ListAccountIssuesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + accountissue.ListAccountIssuesRequest(), + {}, + ], +) +async def test_list_account_issues_async(request_type, transport: str = "grpc_asyncio"): client = AccountIssueServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1533,7 +1555,7 @@ async def test_list_account_issues_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( @@ -1558,11 +1580,6 @@ async def test_list_account_issues_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_account_issues_async_from_dict(): - await test_list_account_issues_async(request_type=dict) - - def test_list_account_issues_field_headers(): client = AccountIssueServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2300,7 +2317,6 @@ def test_list_account_issues_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accountissue.ListAccountIssuesRequest() - assert args[0] == request_msg @@ -2343,7 +2359,6 @@ async def test_list_account_issues_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accountissue.ListAccountIssuesRequest() - assert args[0] == request_msg @@ -2515,7 +2530,6 @@ def test_list_account_issues_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accountissue.ListAccountIssuesRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_account_relationships_service.py b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_account_relationships_service.py index b47d9a5e1db2..3cc563b2be05 100644 --- a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_account_relationships_service.py +++ b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_account_relationships_service.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 @@ -108,6 +109,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" @@ -1414,8 +1430,8 @@ def test_account_relationships_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - accountrelationships.GetAccountRelationshipRequest, - dict, + accountrelationships.GetAccountRelationshipRequest(), + {}, ], ) def test_get_account_relationship(request_type, transport: str = "grpc"): @@ -1426,7 +1442,7 @@ def test_get_account_relationship(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1480,9 +1496,10 @@ def test_get_account_relationship_non_empty_request_with_auto_populated_field(): client.get_account_relationship(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == accountrelationships.GetAccountRelationshipRequest( + request_msg = accountrelationships.GetAccountRelationshipRequest( name="name_value", ) + assert args[0] == request_msg def test_get_account_relationship_use_cached_wrapped_rpc(): @@ -1568,9 +1585,15 @@ async def test_get_account_relationship_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + accountrelationships.GetAccountRelationshipRequest(), + {}, + ], +) async def test_get_account_relationship_async( - transport: str = "grpc_asyncio", - request_type=accountrelationships.GetAccountRelationshipRequest, + request_type, transport: str = "grpc_asyncio" ): client = AccountRelationshipsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1579,7 +1602,7 @@ async def test_get_account_relationship_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( @@ -1610,11 +1633,6 @@ async def test_get_account_relationship_async( assert response.account_id_alias == "account_id_alias_value" -@pytest.mark.asyncio -async def test_get_account_relationship_async_from_dict(): - await test_get_account_relationship_async(request_type=dict) - - def test_get_account_relationship_field_headers(): client = AccountRelationshipsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1769,8 +1787,8 @@ async def test_get_account_relationship_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - accountrelationships.UpdateAccountRelationshipRequest, - dict, + accountrelationships.UpdateAccountRelationshipRequest(), + {}, ], ) def test_update_account_relationship(request_type, transport: str = "grpc"): @@ -1781,7 +1799,7 @@ def test_update_account_relationship(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1833,7 +1851,8 @@ def test_update_account_relationship_non_empty_request_with_auto_populated_field client.update_account_relationship(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == accountrelationships.UpdateAccountRelationshipRequest() + request_msg = accountrelationships.UpdateAccountRelationshipRequest() + assert args[0] == request_msg def test_update_account_relationship_use_cached_wrapped_rpc(): @@ -1919,9 +1938,15 @@ async def test_update_account_relationship_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + accountrelationships.UpdateAccountRelationshipRequest(), + {}, + ], +) async def test_update_account_relationship_async( - transport: str = "grpc_asyncio", - request_type=accountrelationships.UpdateAccountRelationshipRequest, + request_type, transport: str = "grpc_asyncio" ): client = AccountRelationshipsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1930,7 +1955,7 @@ async def test_update_account_relationship_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( @@ -1961,11 +1986,6 @@ async def test_update_account_relationship_async( assert response.account_id_alias == "account_id_alias_value" -@pytest.mark.asyncio -async def test_update_account_relationship_async_from_dict(): - await test_update_account_relationship_async(request_type=dict) - - def test_update_account_relationship_field_headers(): client = AccountRelationshipsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2138,8 +2158,8 @@ async def test_update_account_relationship_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - accountrelationships.ListAccountRelationshipsRequest, - dict, + accountrelationships.ListAccountRelationshipsRequest(), + {}, ], ) def test_list_account_relationships(request_type, transport: str = "grpc"): @@ -2150,7 +2170,7 @@ def test_list_account_relationships(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2199,10 +2219,11 @@ def test_list_account_relationships_non_empty_request_with_auto_populated_field( client.list_account_relationships(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == accountrelationships.ListAccountRelationshipsRequest( + request_msg = accountrelationships.ListAccountRelationshipsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_account_relationships_use_cached_wrapped_rpc(): @@ -2288,9 +2309,15 @@ async def test_list_account_relationships_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + accountrelationships.ListAccountRelationshipsRequest(), + {}, + ], +) async def test_list_account_relationships_async( - transport: str = "grpc_asyncio", - request_type=accountrelationships.ListAccountRelationshipsRequest, + request_type, transport: str = "grpc_asyncio" ): client = AccountRelationshipsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2299,7 +2326,7 @@ async def test_list_account_relationships_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( @@ -2324,11 +2351,6 @@ async def test_list_account_relationships_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_account_relationships_async_from_dict(): - await test_list_account_relationships_async(request_type=dict) - - def test_list_account_relationships_field_headers(): client = AccountRelationshipsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3447,7 +3469,6 @@ def test_get_account_relationship_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accountrelationships.GetAccountRelationshipRequest() - assert args[0] == request_msg @@ -3470,7 +3491,6 @@ def test_update_account_relationship_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accountrelationships.UpdateAccountRelationshipRequest() - assert args[0] == request_msg @@ -3493,7 +3513,6 @@ def test_list_account_relationships_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accountrelationships.ListAccountRelationshipsRequest() - assert args[0] == request_msg @@ -3539,7 +3558,6 @@ async def test_get_account_relationship_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accountrelationships.GetAccountRelationshipRequest() - assert args[0] == request_msg @@ -3571,7 +3589,6 @@ async def test_update_account_relationship_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accountrelationships.UpdateAccountRelationshipRequest() - assert args[0] == request_msg @@ -3600,7 +3617,6 @@ async def test_list_account_relationships_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accountrelationships.ListAccountRelationshipsRequest() - assert args[0] == request_msg @@ -4145,7 +4161,6 @@ def test_get_account_relationship_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accountrelationships.GetAccountRelationshipRequest() - assert args[0] == request_msg @@ -4167,7 +4182,6 @@ def test_update_account_relationship_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accountrelationships.UpdateAccountRelationshipRequest() - assert args[0] == request_msg @@ -4189,7 +4203,6 @@ def test_list_account_relationships_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accountrelationships.ListAccountRelationshipsRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_account_services_service.py b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_account_services_service.py index f7d09d0b808e..e62d8b27bb31 100644 --- a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_account_services_service.py +++ b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_account_services_service.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 @@ -107,6 +108,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" @@ -1376,8 +1392,8 @@ def test_account_services_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - accountservices.GetAccountServiceRequest, - dict, + accountservices.GetAccountServiceRequest(), + {}, ], ) def test_get_account_service(request_type, transport: str = "grpc"): @@ -1388,7 +1404,7 @@ def test_get_account_service(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1444,9 +1460,10 @@ def test_get_account_service_non_empty_request_with_auto_populated_field(): client.get_account_service(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == accountservices.GetAccountServiceRequest( + request_msg = accountservices.GetAccountServiceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_account_service_use_cached_wrapped_rpc(): @@ -1531,10 +1548,14 @@ async def test_get_account_service_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_account_service_async( - transport: str = "grpc_asyncio", - request_type=accountservices.GetAccountServiceRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + accountservices.GetAccountServiceRequest(), + {}, + ], +) +async def test_get_account_service_async(request_type, transport: str = "grpc_asyncio"): client = AccountServicesServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1542,7 +1563,7 @@ async def test_get_account_service_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( @@ -1575,11 +1596,6 @@ async def test_get_account_service_async( assert response.external_account_id == "external_account_id_value" -@pytest.mark.asyncio -async def test_get_account_service_async_from_dict(): - await test_get_account_service_async(request_type=dict) - - def test_get_account_service_field_headers(): client = AccountServicesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1734,8 +1750,8 @@ async def test_get_account_service_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - accountservices.ListAccountServicesRequest, - dict, + accountservices.ListAccountServicesRequest(), + {}, ], ) def test_list_account_services(request_type, transport: str = "grpc"): @@ -1746,7 +1762,7 @@ def test_list_account_services(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1795,10 +1811,11 @@ def test_list_account_services_non_empty_request_with_auto_populated_field(): client.list_account_services(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == accountservices.ListAccountServicesRequest( + request_msg = accountservices.ListAccountServicesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_account_services_use_cached_wrapped_rpc(): @@ -1884,9 +1901,15 @@ async def test_list_account_services_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + accountservices.ListAccountServicesRequest(), + {}, + ], +) async def test_list_account_services_async( - transport: str = "grpc_asyncio", - request_type=accountservices.ListAccountServicesRequest, + request_type, transport: str = "grpc_asyncio" ): client = AccountServicesServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1895,7 +1918,7 @@ async def test_list_account_services_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( @@ -1920,11 +1943,6 @@ async def test_list_account_services_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_account_services_async_from_dict(): - await test_list_account_services_async(request_type=dict) - - def test_list_account_services_field_headers(): client = AccountServicesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2277,8 +2295,8 @@ async def test_list_account_services_async_pages(): @pytest.mark.parametrize( "request_type", [ - accountservices.ProposeAccountServiceRequest, - dict, + accountservices.ProposeAccountServiceRequest(), + {}, ], ) def test_propose_account_service(request_type, transport: str = "grpc"): @@ -2289,7 +2307,7 @@ def test_propose_account_service(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,10 +2364,11 @@ def test_propose_account_service_non_empty_request_with_auto_populated_field(): client.propose_account_service(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == accountservices.ProposeAccountServiceRequest( + request_msg = accountservices.ProposeAccountServiceRequest( parent="parent_value", provider="provider_value", ) + assert args[0] == request_msg def test_propose_account_service_use_cached_wrapped_rpc(): @@ -2435,9 +2454,15 @@ async def test_propose_account_service_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + accountservices.ProposeAccountServiceRequest(), + {}, + ], +) async def test_propose_account_service_async( - transport: str = "grpc_asyncio", - request_type=accountservices.ProposeAccountServiceRequest, + request_type, transport: str = "grpc_asyncio" ): client = AccountServicesServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2446,7 +2471,7 @@ async def test_propose_account_service_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( @@ -2479,11 +2504,6 @@ async def test_propose_account_service_async( assert response.external_account_id == "external_account_id_value" -@pytest.mark.asyncio -async def test_propose_account_service_async_from_dict(): - await test_propose_account_service_async(request_type=dict) - - def test_propose_account_service_field_headers(): client = AccountServicesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2658,8 +2678,8 @@ async def test_propose_account_service_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - accountservices.ApproveAccountServiceRequest, - dict, + accountservices.ApproveAccountServiceRequest(), + {}, ], ) def test_approve_account_service(request_type, transport: str = "grpc"): @@ -2670,7 +2690,7 @@ def test_approve_account_service(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2726,9 +2746,10 @@ def test_approve_account_service_non_empty_request_with_auto_populated_field(): client.approve_account_service(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == accountservices.ApproveAccountServiceRequest( + request_msg = accountservices.ApproveAccountServiceRequest( name="name_value", ) + assert args[0] == request_msg def test_approve_account_service_use_cached_wrapped_rpc(): @@ -2814,9 +2835,15 @@ async def test_approve_account_service_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + accountservices.ApproveAccountServiceRequest(), + {}, + ], +) async def test_approve_account_service_async( - transport: str = "grpc_asyncio", - request_type=accountservices.ApproveAccountServiceRequest, + request_type, transport: str = "grpc_asyncio" ): client = AccountServicesServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2825,7 +2852,7 @@ async def test_approve_account_service_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( @@ -2858,11 +2885,6 @@ async def test_approve_account_service_async( assert response.external_account_id == "external_account_id_value" -@pytest.mark.asyncio -async def test_approve_account_service_async_from_dict(): - await test_approve_account_service_async(request_type=dict) - - def test_approve_account_service_field_headers(): client = AccountServicesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3017,8 +3039,8 @@ async def test_approve_account_service_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - accountservices.RejectAccountServiceRequest, - dict, + accountservices.RejectAccountServiceRequest(), + {}, ], ) def test_reject_account_service(request_type, transport: str = "grpc"): @@ -3029,7 +3051,7 @@ def test_reject_account_service(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,9 +3096,10 @@ def test_reject_account_service_non_empty_request_with_auto_populated_field(): client.reject_account_service(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == accountservices.RejectAccountServiceRequest( + request_msg = accountservices.RejectAccountServiceRequest( name="name_value", ) + assert args[0] == request_msg def test_reject_account_service_use_cached_wrapped_rpc(): @@ -3162,9 +3185,15 @@ async def test_reject_account_service_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + accountservices.RejectAccountServiceRequest(), + {}, + ], +) async def test_reject_account_service_async( - transport: str = "grpc_asyncio", - request_type=accountservices.RejectAccountServiceRequest, + request_type, transport: str = "grpc_asyncio" ): client = AccountServicesServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3173,7 +3202,7 @@ async def test_reject_account_service_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( @@ -3193,11 +3222,6 @@ async def test_reject_account_service_async( assert response is None -@pytest.mark.asyncio -async def test_reject_account_service_async_from_dict(): - await test_reject_account_service_async(request_type=dict) - - def test_reject_account_service_field_headers(): client = AccountServicesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4475,7 +4499,6 @@ def test_get_account_service_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accountservices.GetAccountServiceRequest() - assert args[0] == request_msg @@ -4498,7 +4521,6 @@ def test_list_account_services_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accountservices.ListAccountServicesRequest() - assert args[0] == request_msg @@ -4521,7 +4543,6 @@ def test_propose_account_service_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accountservices.ProposeAccountServiceRequest() - assert args[0] == request_msg @@ -4544,7 +4565,6 @@ def test_approve_account_service_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accountservices.ApproveAccountServiceRequest() - assert args[0] == request_msg @@ -4567,7 +4587,6 @@ def test_reject_account_service_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accountservices.RejectAccountServiceRequest() - assert args[0] == request_msg @@ -4614,7 +4633,6 @@ async def test_get_account_service_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accountservices.GetAccountServiceRequest() - assert args[0] == request_msg @@ -4643,7 +4661,6 @@ async def test_list_account_services_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accountservices.ListAccountServicesRequest() - assert args[0] == request_msg @@ -4676,7 +4693,6 @@ async def test_propose_account_service_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accountservices.ProposeAccountServiceRequest() - assert args[0] == request_msg @@ -4709,7 +4725,6 @@ async def test_approve_account_service_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accountservices.ApproveAccountServiceRequest() - assert args[0] == request_msg @@ -4734,7 +4749,6 @@ async def test_reject_account_service_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accountservices.RejectAccountServiceRequest() - assert args[0] == request_msg @@ -5446,7 +5460,6 @@ def test_get_account_service_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accountservices.GetAccountServiceRequest() - assert args[0] == request_msg @@ -5468,7 +5481,6 @@ def test_list_account_services_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accountservices.ListAccountServicesRequest() - assert args[0] == request_msg @@ -5490,7 +5502,6 @@ def test_propose_account_service_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accountservices.ProposeAccountServiceRequest() - assert args[0] == request_msg @@ -5512,7 +5523,6 @@ def test_approve_account_service_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accountservices.ApproveAccountServiceRequest() - assert args[0] == request_msg @@ -5534,7 +5544,6 @@ def test_reject_account_service_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accountservices.RejectAccountServiceRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_accounts_service.py b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_accounts_service.py index 141e78892481..94379fb6d646 100644 --- a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_accounts_service.py +++ b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_accounts_service.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 @@ -115,6 +116,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" @@ -1342,8 +1358,8 @@ def test_accounts_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - accounts.GetAccountRequest, - dict, + accounts.GetAccountRequest(), + {}, ], ) def test_get_account(request_type, transport: str = "grpc"): @@ -1354,7 +1370,7 @@ def test_get_account(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_account), "__call__") as call: @@ -1408,9 +1424,10 @@ def test_get_account_non_empty_request_with_auto_populated_field(): client.get_account(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == accounts.GetAccountRequest( + request_msg = accounts.GetAccountRequest( name="name_value", ) + assert args[0] == request_msg def test_get_account_use_cached_wrapped_rpc(): @@ -1491,9 +1508,14 @@ async def test_get_account_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_account_async( - transport: str = "grpc_asyncio", request_type=accounts.GetAccountRequest -): +@pytest.mark.parametrize( + "request_type", + [ + accounts.GetAccountRequest(), + {}, + ], +) +async def test_get_account_async(request_type, transport: str = "grpc_asyncio"): client = AccountsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1501,7 +1523,7 @@ async def test_get_account_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_account), "__call__") as call: @@ -1534,11 +1556,6 @@ async def test_get_account_async( assert response.language_code == "language_code_value" -@pytest.mark.asyncio -async def test_get_account_async_from_dict(): - await test_get_account_async(request_type=dict) - - def test_get_account_field_headers(): client = AccountsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1681,8 +1698,8 @@ async def test_get_account_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - accounts.CreateAndConfigureAccountRequest, - dict, + accounts.CreateAndConfigureAccountRequest(), + {}, ], ) def test_create_and_configure_account(request_type, transport: str = "grpc"): @@ -1693,7 +1710,7 @@ def test_create_and_configure_account(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1749,7 +1766,8 @@ def test_create_and_configure_account_non_empty_request_with_auto_populated_fiel client.create_and_configure_account(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == accounts.CreateAndConfigureAccountRequest() + request_msg = accounts.CreateAndConfigureAccountRequest() + assert args[0] == request_msg def test_create_and_configure_account_use_cached_wrapped_rpc(): @@ -1835,9 +1853,15 @@ async def test_create_and_configure_account_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + accounts.CreateAndConfigureAccountRequest(), + {}, + ], +) async def test_create_and_configure_account_async( - transport: str = "grpc_asyncio", - request_type=accounts.CreateAndConfigureAccountRequest, + request_type, transport: str = "grpc_asyncio" ): client = AccountsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1846,7 +1870,7 @@ async def test_create_and_configure_account_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( @@ -1881,16 +1905,11 @@ async def test_create_and_configure_account_async( assert response.language_code == "language_code_value" -@pytest.mark.asyncio -async def test_create_and_configure_account_async_from_dict(): - await test_create_and_configure_account_async(request_type=dict) - - @pytest.mark.parametrize( "request_type", [ - accounts.CreateTestAccountRequest, - dict, + accounts.CreateTestAccountRequest(), + {}, ], ) def test_create_test_account(request_type, transport: str = "grpc"): @@ -1901,7 +1920,7 @@ def test_create_test_account(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1959,9 +1978,10 @@ def test_create_test_account_non_empty_request_with_auto_populated_field(): client.create_test_account(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == accounts.CreateTestAccountRequest( + request_msg = accounts.CreateTestAccountRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_test_account_use_cached_wrapped_rpc(): @@ -2046,9 +2066,14 @@ async def test_create_test_account_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_test_account_async( - transport: str = "grpc_asyncio", request_type=accounts.CreateTestAccountRequest -): +@pytest.mark.parametrize( + "request_type", + [ + accounts.CreateTestAccountRequest(), + {}, + ], +) +async def test_create_test_account_async(request_type, transport: str = "grpc_asyncio"): client = AccountsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2056,7 +2081,7 @@ async def test_create_test_account_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( @@ -2091,11 +2116,6 @@ async def test_create_test_account_async( assert response.language_code == "language_code_value" -@pytest.mark.asyncio -async def test_create_test_account_async_from_dict(): - await test_create_test_account_async(request_type=dict) - - def test_create_test_account_field_headers(): client = AccountsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2256,8 +2276,8 @@ async def test_create_test_account_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - accounts.DeleteAccountRequest, - dict, + accounts.DeleteAccountRequest(), + {}, ], ) def test_delete_account(request_type, transport: str = "grpc"): @@ -2268,7 +2288,7 @@ def test_delete_account(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_account), "__call__") as call: @@ -2309,9 +2329,10 @@ def test_delete_account_non_empty_request_with_auto_populated_field(): client.delete_account(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == accounts.DeleteAccountRequest( + request_msg = accounts.DeleteAccountRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_account_use_cached_wrapped_rpc(): @@ -2392,9 +2413,14 @@ async def test_delete_account_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_account_async( - transport: str = "grpc_asyncio", request_type=accounts.DeleteAccountRequest -): +@pytest.mark.parametrize( + "request_type", + [ + accounts.DeleteAccountRequest(), + {}, + ], +) +async def test_delete_account_async(request_type, transport: str = "grpc_asyncio"): client = AccountsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2402,7 +2428,7 @@ async def test_delete_account_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_account), "__call__") as call: @@ -2420,11 +2446,6 @@ async def test_delete_account_async( assert response is None -@pytest.mark.asyncio -async def test_delete_account_async_from_dict(): - await test_delete_account_async(request_type=dict) - - def test_delete_account_field_headers(): client = AccountsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2567,8 +2588,8 @@ async def test_delete_account_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - accounts.UpdateAccountRequest, - dict, + accounts.UpdateAccountRequest(), + {}, ], ) def test_update_account(request_type, transport: str = "grpc"): @@ -2579,7 +2600,7 @@ def test_update_account(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_account), "__call__") as call: @@ -2631,7 +2652,8 @@ def test_update_account_non_empty_request_with_auto_populated_field(): client.update_account(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == accounts.UpdateAccountRequest() + request_msg = accounts.UpdateAccountRequest() + assert args[0] == request_msg def test_update_account_use_cached_wrapped_rpc(): @@ -2712,9 +2734,14 @@ async def test_update_account_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_account_async( - transport: str = "grpc_asyncio", request_type=accounts.UpdateAccountRequest -): +@pytest.mark.parametrize( + "request_type", + [ + accounts.UpdateAccountRequest(), + {}, + ], +) +async def test_update_account_async(request_type, transport: str = "grpc_asyncio"): client = AccountsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2722,7 +2749,7 @@ async def test_update_account_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_account), "__call__") as call: @@ -2755,11 +2782,6 @@ async def test_update_account_async( assert response.language_code == "language_code_value" -@pytest.mark.asyncio -async def test_update_account_async_from_dict(): - await test_update_account_async(request_type=dict) - - def test_update_account_field_headers(): client = AccountsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2912,8 +2934,8 @@ async def test_update_account_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - accounts.ListAccountsRequest, - dict, + accounts.ListAccountsRequest(), + {}, ], ) def test_list_accounts(request_type, transport: str = "grpc"): @@ -2924,7 +2946,7 @@ def test_list_accounts(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_accounts), "__call__") as call: @@ -2969,10 +2991,11 @@ def test_list_accounts_non_empty_request_with_auto_populated_field(): client.list_accounts(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == accounts.ListAccountsRequest( + request_msg = accounts.ListAccountsRequest( page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_accounts_use_cached_wrapped_rpc(): @@ -3053,9 +3076,14 @@ async def test_list_accounts_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_accounts_async( - transport: str = "grpc_asyncio", request_type=accounts.ListAccountsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + accounts.ListAccountsRequest(), + {}, + ], +) +async def test_list_accounts_async(request_type, transport: str = "grpc_asyncio"): client = AccountsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3063,7 +3091,7 @@ async def test_list_accounts_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_accounts), "__call__") as call: @@ -3086,11 +3114,6 @@ async def test_list_accounts_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_accounts_async_from_dict(): - await test_list_accounts_async(request_type=dict) - - def test_list_accounts_pager(transport_name: str = "grpc"): client = AccountsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3281,8 +3304,8 @@ async def test_list_accounts_async_pages(): @pytest.mark.parametrize( "request_type", [ - accounts.ListSubAccountsRequest, - dict, + accounts.ListSubAccountsRequest(), + {}, ], ) def test_list_sub_accounts(request_type, transport: str = "grpc"): @@ -3293,7 +3316,7 @@ def test_list_sub_accounts(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3342,10 +3365,11 @@ def test_list_sub_accounts_non_empty_request_with_auto_populated_field(): client.list_sub_accounts(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == accounts.ListSubAccountsRequest( + request_msg = accounts.ListSubAccountsRequest( provider="provider_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_sub_accounts_use_cached_wrapped_rpc(): @@ -3428,9 +3452,14 @@ async def test_list_sub_accounts_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_sub_accounts_async( - transport: str = "grpc_asyncio", request_type=accounts.ListSubAccountsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + accounts.ListSubAccountsRequest(), + {}, + ], +) +async def test_list_sub_accounts_async(request_type, transport: str = "grpc_asyncio"): client = AccountsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3438,7 +3467,7 @@ async def test_list_sub_accounts_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( @@ -3463,11 +3492,6 @@ async def test_list_sub_accounts_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_sub_accounts_async_from_dict(): - await test_list_sub_accounts_async(request_type=dict) - - def test_list_sub_accounts_field_headers(): client = AccountsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5138,7 +5162,6 @@ def test_get_account_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accounts.GetAccountRequest() - assert args[0] == request_msg @@ -5161,7 +5184,6 @@ def test_create_and_configure_account_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accounts.CreateAndConfigureAccountRequest() - assert args[0] == request_msg @@ -5184,7 +5206,6 @@ def test_create_test_account_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accounts.CreateTestAccountRequest() - assert args[0] == request_msg @@ -5205,7 +5226,6 @@ def test_delete_account_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accounts.DeleteAccountRequest() - assert args[0] == request_msg @@ -5226,7 +5246,6 @@ def test_update_account_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accounts.UpdateAccountRequest() - assert args[0] == request_msg @@ -5247,7 +5266,6 @@ def test_list_accounts_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accounts.ListAccountsRequest() - assert args[0] == request_msg @@ -5270,7 +5288,6 @@ def test_list_sub_accounts_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accounts.ListSubAccountsRequest() - assert args[0] == request_msg @@ -5316,7 +5333,6 @@ async def test_get_account_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accounts.GetAccountRequest() - assert args[0] == request_msg @@ -5350,7 +5366,6 @@ async def test_create_and_configure_account_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accounts.CreateAndConfigureAccountRequest() - assert args[0] == request_msg @@ -5384,7 +5399,6 @@ async def test_create_test_account_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accounts.CreateTestAccountRequest() - assert args[0] == request_msg @@ -5407,7 +5421,6 @@ async def test_delete_account_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accounts.DeleteAccountRequest() - assert args[0] == request_msg @@ -5439,7 +5452,6 @@ async def test_update_account_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accounts.UpdateAccountRequest() - assert args[0] == request_msg @@ -5466,7 +5478,6 @@ async def test_list_accounts_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accounts.ListAccountsRequest() - assert args[0] == request_msg @@ -5495,7 +5506,6 @@ async def test_list_sub_accounts_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accounts.ListSubAccountsRequest() - assert args[0] == request_msg @@ -6606,7 +6616,6 @@ def test_get_account_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accounts.GetAccountRequest() - assert args[0] == request_msg @@ -6628,7 +6637,6 @@ def test_create_and_configure_account_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accounts.CreateAndConfigureAccountRequest() - assert args[0] == request_msg @@ -6650,7 +6658,6 @@ def test_create_test_account_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accounts.CreateTestAccountRequest() - assert args[0] == request_msg @@ -6670,7 +6677,6 @@ def test_delete_account_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accounts.DeleteAccountRequest() - assert args[0] == request_msg @@ -6690,7 +6696,6 @@ def test_update_account_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accounts.UpdateAccountRequest() - assert args[0] == request_msg @@ -6710,7 +6715,6 @@ def test_list_accounts_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accounts.ListAccountsRequest() - assert args[0] == request_msg @@ -6732,7 +6736,6 @@ def test_list_sub_accounts_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accounts.ListSubAccountsRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_autofeed_settings_service.py b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_autofeed_settings_service.py index 04bb4603fd94..30514845d538 100644 --- a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_autofeed_settings_service.py +++ b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_autofeed_settings_service.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 @@ -107,6 +108,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" @@ -1376,8 +1392,8 @@ def test_autofeed_settings_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - autofeedsettings.GetAutofeedSettingsRequest, - dict, + autofeedsettings.GetAutofeedSettingsRequest(), + {}, ], ) def test_get_autofeed_settings(request_type, transport: str = "grpc"): @@ -1388,7 +1404,7 @@ def test_get_autofeed_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( @@ -1440,9 +1456,10 @@ def test_get_autofeed_settings_non_empty_request_with_auto_populated_field(): client.get_autofeed_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == autofeedsettings.GetAutofeedSettingsRequest( + request_msg = autofeedsettings.GetAutofeedSettingsRequest( name="name_value", ) + assert args[0] == request_msg def test_get_autofeed_settings_use_cached_wrapped_rpc(): @@ -1528,9 +1545,15 @@ async def test_get_autofeed_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + autofeedsettings.GetAutofeedSettingsRequest(), + {}, + ], +) async def test_get_autofeed_settings_async( - transport: str = "grpc_asyncio", - request_type=autofeedsettings.GetAutofeedSettingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = AutofeedSettingsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1539,7 +1562,7 @@ async def test_get_autofeed_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( @@ -1568,11 +1591,6 @@ async def test_get_autofeed_settings_async( assert response.eligible is True -@pytest.mark.asyncio -async def test_get_autofeed_settings_async_from_dict(): - await test_get_autofeed_settings_async(request_type=dict) - - def test_get_autofeed_settings_field_headers(): client = AutofeedSettingsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1727,8 +1745,8 @@ async def test_get_autofeed_settings_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - autofeedsettings.UpdateAutofeedSettingsRequest, - dict, + autofeedsettings.UpdateAutofeedSettingsRequest(), + {}, ], ) def test_update_autofeed_settings(request_type, transport: str = "grpc"): @@ -1739,7 +1757,7 @@ def test_update_autofeed_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( @@ -1789,7 +1807,8 @@ def test_update_autofeed_settings_non_empty_request_with_auto_populated_field(): client.update_autofeed_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == autofeedsettings.UpdateAutofeedSettingsRequest() + request_msg = autofeedsettings.UpdateAutofeedSettingsRequest() + assert args[0] == request_msg def test_update_autofeed_settings_use_cached_wrapped_rpc(): @@ -1875,9 +1894,15 @@ async def test_update_autofeed_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + autofeedsettings.UpdateAutofeedSettingsRequest(), + {}, + ], +) async def test_update_autofeed_settings_async( - transport: str = "grpc_asyncio", - request_type=autofeedsettings.UpdateAutofeedSettingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = AutofeedSettingsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1886,7 +1911,7 @@ async def test_update_autofeed_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( @@ -1915,11 +1940,6 @@ async def test_update_autofeed_settings_async( assert response.eligible is True -@pytest.mark.asyncio -async def test_update_autofeed_settings_async_from_dict(): - await test_update_autofeed_settings_async(request_type=dict) - - def test_update_autofeed_settings_field_headers(): client = AutofeedSettingsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2582,7 +2602,6 @@ def test_get_autofeed_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = autofeedsettings.GetAutofeedSettingsRequest() - assert args[0] == request_msg @@ -2605,7 +2624,6 @@ def test_update_autofeed_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = autofeedsettings.UpdateAutofeedSettingsRequest() - assert args[0] == request_msg @@ -2650,7 +2668,6 @@ async def test_get_autofeed_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = autofeedsettings.GetAutofeedSettingsRequest() - assert args[0] == request_msg @@ -2681,7 +2698,6 @@ async def test_update_autofeed_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = autofeedsettings.UpdateAutofeedSettingsRequest() - assert args[0] == request_msg @@ -3069,7 +3085,6 @@ def test_get_autofeed_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = autofeedsettings.GetAutofeedSettingsRequest() - assert args[0] == request_msg @@ -3091,7 +3106,6 @@ def test_update_autofeed_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = autofeedsettings.UpdateAutofeedSettingsRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_automatic_improvements_service.py b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_automatic_improvements_service.py index 6166773026b4..a0854b4026cc 100644 --- a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_automatic_improvements_service.py +++ b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_automatic_improvements_service.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 @@ -107,6 +108,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" @@ -1417,8 +1433,8 @@ def test_automatic_improvements_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - automaticimprovements.GetAutomaticImprovementsRequest, - dict, + automaticimprovements.GetAutomaticImprovementsRequest(), + {}, ], ) def test_get_automatic_improvements(request_type, transport: str = "grpc"): @@ -1429,7 +1445,7 @@ def test_get_automatic_improvements(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1477,9 +1493,10 @@ def test_get_automatic_improvements_non_empty_request_with_auto_populated_field( client.get_automatic_improvements(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == automaticimprovements.GetAutomaticImprovementsRequest( + request_msg = automaticimprovements.GetAutomaticImprovementsRequest( name="name_value", ) + assert args[0] == request_msg def test_get_automatic_improvements_use_cached_wrapped_rpc(): @@ -1565,9 +1582,15 @@ async def test_get_automatic_improvements_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + automaticimprovements.GetAutomaticImprovementsRequest(), + {}, + ], +) async def test_get_automatic_improvements_async( - transport: str = "grpc_asyncio", - request_type=automaticimprovements.GetAutomaticImprovementsRequest, + request_type, transport: str = "grpc_asyncio" ): client = AutomaticImprovementsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1576,7 +1599,7 @@ async def test_get_automatic_improvements_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( @@ -1601,11 +1624,6 @@ async def test_get_automatic_improvements_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_automatic_improvements_async_from_dict(): - await test_get_automatic_improvements_async(request_type=dict) - - def test_get_automatic_improvements_field_headers(): client = AutomaticImprovementsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1760,8 +1778,8 @@ async def test_get_automatic_improvements_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - automaticimprovements.UpdateAutomaticImprovementsRequest, - dict, + automaticimprovements.UpdateAutomaticImprovementsRequest(), + {}, ], ) def test_update_automatic_improvements(request_type, transport: str = "grpc"): @@ -1772,7 +1790,7 @@ def test_update_automatic_improvements(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,7 +1836,8 @@ def test_update_automatic_improvements_non_empty_request_with_auto_populated_fie client.update_automatic_improvements(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == automaticimprovements.UpdateAutomaticImprovementsRequest() + request_msg = automaticimprovements.UpdateAutomaticImprovementsRequest() + assert args[0] == request_msg def test_update_automatic_improvements_use_cached_wrapped_rpc(): @@ -1904,9 +1923,15 @@ async def test_update_automatic_improvements_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + automaticimprovements.UpdateAutomaticImprovementsRequest(), + {}, + ], +) async def test_update_automatic_improvements_async( - transport: str = "grpc_asyncio", - request_type=automaticimprovements.UpdateAutomaticImprovementsRequest, + request_type, transport: str = "grpc_asyncio" ): client = AutomaticImprovementsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1915,7 +1940,7 @@ async def test_update_automatic_improvements_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( @@ -1940,11 +1965,6 @@ async def test_update_automatic_improvements_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_update_automatic_improvements_async_from_dict(): - await test_update_automatic_improvements_async(request_type=dict) - - def test_update_automatic_improvements_field_headers(): client = AutomaticImprovementsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2621,7 +2641,6 @@ def test_get_automatic_improvements_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = automaticimprovements.GetAutomaticImprovementsRequest() - assert args[0] == request_msg @@ -2644,7 +2663,6 @@ def test_update_automatic_improvements_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = automaticimprovements.UpdateAutomaticImprovementsRequest() - assert args[0] == request_msg @@ -2687,7 +2705,6 @@ async def test_get_automatic_improvements_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = automaticimprovements.GetAutomaticImprovementsRequest() - assert args[0] == request_msg @@ -2716,7 +2733,6 @@ async def test_update_automatic_improvements_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = automaticimprovements.UpdateAutomaticImprovementsRequest() - assert args[0] == request_msg @@ -3125,7 +3141,6 @@ def test_get_automatic_improvements_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = automaticimprovements.GetAutomaticImprovementsRequest() - assert args[0] == request_msg @@ -3147,7 +3162,6 @@ def test_update_automatic_improvements_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = automaticimprovements.UpdateAutomaticImprovementsRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_business_identity_service.py b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_business_identity_service.py index 8ed32f15087d..dc1a06438594 100644 --- a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_business_identity_service.py +++ b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_business_identity_service.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 @@ -107,6 +108,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" @@ -1376,8 +1392,8 @@ def test_business_identity_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - businessidentity.GetBusinessIdentityRequest, - dict, + businessidentity.GetBusinessIdentityRequest(), + {}, ], ) def test_get_business_identity(request_type, transport: str = "grpc"): @@ -1388,7 +1404,7 @@ def test_get_business_identity(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1441,9 +1457,10 @@ def test_get_business_identity_non_empty_request_with_auto_populated_field(): client.get_business_identity(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == businessidentity.GetBusinessIdentityRequest( + request_msg = businessidentity.GetBusinessIdentityRequest( name="name_value", ) + assert args[0] == request_msg def test_get_business_identity_use_cached_wrapped_rpc(): @@ -1529,9 +1546,15 @@ async def test_get_business_identity_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + businessidentity.GetBusinessIdentityRequest(), + {}, + ], +) async def test_get_business_identity_async( - transport: str = "grpc_asyncio", - request_type=businessidentity.GetBusinessIdentityRequest, + request_type, transport: str = "grpc_asyncio" ): client = BusinessIdentityServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1540,7 +1563,7 @@ async def test_get_business_identity_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( @@ -1570,11 +1593,6 @@ async def test_get_business_identity_async( ) -@pytest.mark.asyncio -async def test_get_business_identity_async_from_dict(): - await test_get_business_identity_async(request_type=dict) - - def test_get_business_identity_field_headers(): client = BusinessIdentityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1729,8 +1747,8 @@ async def test_get_business_identity_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - businessidentity.UpdateBusinessIdentityRequest, - dict, + businessidentity.UpdateBusinessIdentityRequest(), + {}, ], ) def test_update_business_identity(request_type, transport: str = "grpc"): @@ -1741,7 +1759,7 @@ def test_update_business_identity(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1792,7 +1810,8 @@ def test_update_business_identity_non_empty_request_with_auto_populated_field(): client.update_business_identity(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == businessidentity.UpdateBusinessIdentityRequest() + request_msg = businessidentity.UpdateBusinessIdentityRequest() + assert args[0] == request_msg def test_update_business_identity_use_cached_wrapped_rpc(): @@ -1878,9 +1897,15 @@ async def test_update_business_identity_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + businessidentity.UpdateBusinessIdentityRequest(), + {}, + ], +) async def test_update_business_identity_async( - transport: str = "grpc_asyncio", - request_type=businessidentity.UpdateBusinessIdentityRequest, + request_type, transport: str = "grpc_asyncio" ): client = BusinessIdentityServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1889,7 +1914,7 @@ async def test_update_business_identity_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( @@ -1919,11 +1944,6 @@ async def test_update_business_identity_async( ) -@pytest.mark.asyncio -async def test_update_business_identity_async_from_dict(): - await test_update_business_identity_async(request_type=dict) - - def test_update_business_identity_field_headers(): client = BusinessIdentityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2578,7 +2598,6 @@ def test_get_business_identity_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = businessidentity.GetBusinessIdentityRequest() - assert args[0] == request_msg @@ -2601,7 +2620,6 @@ def test_update_business_identity_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = businessidentity.UpdateBusinessIdentityRequest() - assert args[0] == request_msg @@ -2645,7 +2663,6 @@ async def test_get_business_identity_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = businessidentity.GetBusinessIdentityRequest() - assert args[0] == request_msg @@ -2675,7 +2692,6 @@ async def test_update_business_identity_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = businessidentity.UpdateBusinessIdentityRequest() - assert args[0] == request_msg @@ -3069,7 +3085,6 @@ def test_get_business_identity_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = businessidentity.GetBusinessIdentityRequest() - assert args[0] == request_msg @@ -3091,7 +3106,6 @@ def test_update_business_identity_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = businessidentity.UpdateBusinessIdentityRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_business_info_service.py b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_business_info_service.py index 395a22bc442a..55fe481a3cf6 100644 --- a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_business_info_service.py +++ b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_business_info_service.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 @@ -113,6 +114,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" @@ -1376,8 +1392,8 @@ def test_business_info_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - businessinfo.GetBusinessInfoRequest, - dict, + businessinfo.GetBusinessInfoRequest(), + {}, ], ) def test_get_business_info(request_type, transport: str = "grpc"): @@ -1388,7 +1404,7 @@ def test_get_business_info(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1446,9 +1462,10 @@ def test_get_business_info_non_empty_request_with_auto_populated_field(): client.get_business_info(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == businessinfo.GetBusinessInfoRequest( + request_msg = businessinfo.GetBusinessInfoRequest( name="name_value", ) + assert args[0] == request_msg def test_get_business_info_use_cached_wrapped_rpc(): @@ -1531,9 +1548,14 @@ async def test_get_business_info_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_business_info_async( - transport: str = "grpc_asyncio", request_type=businessinfo.GetBusinessInfoRequest -): +@pytest.mark.parametrize( + "request_type", + [ + businessinfo.GetBusinessInfoRequest(), + {}, + ], +) +async def test_get_business_info_async(request_type, transport: str = "grpc_asyncio"): client = BusinessInfoServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1541,7 +1563,7 @@ async def test_get_business_info_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( @@ -1576,11 +1598,6 @@ async def test_get_business_info_async( ) -@pytest.mark.asyncio -async def test_get_business_info_async_from_dict(): - await test_get_business_info_async(request_type=dict) - - def test_get_business_info_field_headers(): client = BusinessInfoServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1735,8 +1752,8 @@ async def test_get_business_info_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - businessinfo.UpdateBusinessInfoRequest, - dict, + businessinfo.UpdateBusinessInfoRequest(), + {}, ], ) def test_update_business_info(request_type, transport: str = "grpc"): @@ -1747,7 +1764,7 @@ def test_update_business_info(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1803,7 +1820,8 @@ def test_update_business_info_non_empty_request_with_auto_populated_field(): client.update_business_info(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == businessinfo.UpdateBusinessInfoRequest() + request_msg = businessinfo.UpdateBusinessInfoRequest() + assert args[0] == request_msg def test_update_business_info_use_cached_wrapped_rpc(): @@ -1888,8 +1906,15 @@ async def test_update_business_info_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + businessinfo.UpdateBusinessInfoRequest(), + {}, + ], +) async def test_update_business_info_async( - transport: str = "grpc_asyncio", request_type=businessinfo.UpdateBusinessInfoRequest + request_type, transport: str = "grpc_asyncio" ): client = BusinessInfoServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1898,7 +1923,7 @@ async def test_update_business_info_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( @@ -1933,11 +1958,6 @@ async def test_update_business_info_async( ) -@pytest.mark.asyncio -async def test_update_business_info_async_from_dict(): - await test_update_business_info_async(request_type=dict) - - def test_update_business_info_field_headers(): client = BusinessInfoServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2585,7 +2605,6 @@ def test_get_business_info_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = businessinfo.GetBusinessInfoRequest() - assert args[0] == request_msg @@ -2608,7 +2627,6 @@ def test_update_business_info_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = businessinfo.UpdateBusinessInfoRequest() - assert args[0] == request_msg @@ -2653,7 +2671,6 @@ async def test_get_business_info_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = businessinfo.GetBusinessInfoRequest() - assert args[0] == request_msg @@ -2684,7 +2701,6 @@ async def test_update_business_info_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = businessinfo.UpdateBusinessInfoRequest() - assert args[0] == request_msg @@ -3096,7 +3112,6 @@ def test_get_business_info_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = businessinfo.GetBusinessInfoRequest() - assert args[0] == request_msg @@ -3118,7 +3133,6 @@ def test_update_business_info_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = businessinfo.UpdateBusinessInfoRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_checkout_settings_service.py b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_checkout_settings_service.py index 448aff73407c..e7dc5c88359c 100644 --- a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_checkout_settings_service.py +++ b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_checkout_settings_service.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 @@ -108,6 +109,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" @@ -1377,8 +1393,8 @@ def test_checkout_settings_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - checkoutsettings.GetCheckoutSettingsRequest, - dict, + checkoutsettings.GetCheckoutSettingsRequest(), + {}, ], ) def test_get_checkout_settings(request_type, transport: str = "grpc"): @@ -1389,7 +1405,7 @@ def test_get_checkout_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( @@ -1461,9 +1477,10 @@ def test_get_checkout_settings_non_empty_request_with_auto_populated_field(): client.get_checkout_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == checkoutsettings.GetCheckoutSettingsRequest( + request_msg = checkoutsettings.GetCheckoutSettingsRequest( name="name_value", ) + assert args[0] == request_msg def test_get_checkout_settings_use_cached_wrapped_rpc(): @@ -1549,9 +1566,15 @@ async def test_get_checkout_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + checkoutsettings.GetCheckoutSettingsRequest(), + {}, + ], +) async def test_get_checkout_settings_async( - transport: str = "grpc_asyncio", - request_type=checkoutsettings.GetCheckoutSettingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = CheckoutSettingsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1560,7 +1583,7 @@ async def test_get_checkout_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( @@ -1609,11 +1632,6 @@ async def test_get_checkout_settings_async( ) -@pytest.mark.asyncio -async def test_get_checkout_settings_async_from_dict(): - await test_get_checkout_settings_async(request_type=dict) - - def test_get_checkout_settings_field_headers(): client = CheckoutSettingsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1768,8 +1786,8 @@ async def test_get_checkout_settings_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - checkoutsettings.CreateCheckoutSettingsRequest, - dict, + checkoutsettings.CreateCheckoutSettingsRequest(), + {}, ], ) def test_create_checkout_settings(request_type, transport: str = "grpc"): @@ -1780,7 +1798,7 @@ def test_create_checkout_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( @@ -1852,9 +1870,10 @@ def test_create_checkout_settings_non_empty_request_with_auto_populated_field(): client.create_checkout_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == checkoutsettings.CreateCheckoutSettingsRequest( + request_msg = checkoutsettings.CreateCheckoutSettingsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_checkout_settings_use_cached_wrapped_rpc(): @@ -1940,9 +1959,15 @@ async def test_create_checkout_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + checkoutsettings.CreateCheckoutSettingsRequest(), + {}, + ], +) async def test_create_checkout_settings_async( - transport: str = "grpc_asyncio", - request_type=checkoutsettings.CreateCheckoutSettingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = CheckoutSettingsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1951,7 +1976,7 @@ async def test_create_checkout_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( @@ -2000,11 +2025,6 @@ async def test_create_checkout_settings_async( ) -@pytest.mark.asyncio -async def test_create_checkout_settings_async_from_dict(): - await test_create_checkout_settings_async(request_type=dict) - - def test_create_checkout_settings_field_headers(): client = CheckoutSettingsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2169,8 +2189,8 @@ async def test_create_checkout_settings_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - checkoutsettings.UpdateCheckoutSettingsRequest, - dict, + checkoutsettings.UpdateCheckoutSettingsRequest(), + {}, ], ) def test_update_checkout_settings(request_type, transport: str = "grpc"): @@ -2181,7 +2201,7 @@ def test_update_checkout_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( @@ -2251,7 +2271,8 @@ def test_update_checkout_settings_non_empty_request_with_auto_populated_field(): client.update_checkout_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == checkoutsettings.UpdateCheckoutSettingsRequest() + request_msg = checkoutsettings.UpdateCheckoutSettingsRequest() + assert args[0] == request_msg def test_update_checkout_settings_use_cached_wrapped_rpc(): @@ -2337,9 +2358,15 @@ async def test_update_checkout_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + checkoutsettings.UpdateCheckoutSettingsRequest(), + {}, + ], +) async def test_update_checkout_settings_async( - transport: str = "grpc_asyncio", - request_type=checkoutsettings.UpdateCheckoutSettingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = CheckoutSettingsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2348,7 +2375,7 @@ async def test_update_checkout_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( @@ -2397,11 +2424,6 @@ async def test_update_checkout_settings_async( ) -@pytest.mark.asyncio -async def test_update_checkout_settings_async_from_dict(): - await test_update_checkout_settings_async(request_type=dict) - - def test_update_checkout_settings_field_headers(): client = CheckoutSettingsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2566,8 +2588,8 @@ async def test_update_checkout_settings_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - checkoutsettings.DeleteCheckoutSettingsRequest, - dict, + checkoutsettings.DeleteCheckoutSettingsRequest(), + {}, ], ) def test_delete_checkout_settings(request_type, transport: str = "grpc"): @@ -2578,7 +2600,7 @@ def test_delete_checkout_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( @@ -2623,9 +2645,10 @@ def test_delete_checkout_settings_non_empty_request_with_auto_populated_field(): client.delete_checkout_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == checkoutsettings.DeleteCheckoutSettingsRequest( + request_msg = checkoutsettings.DeleteCheckoutSettingsRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_checkout_settings_use_cached_wrapped_rpc(): @@ -2711,9 +2734,15 @@ async def test_delete_checkout_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + checkoutsettings.DeleteCheckoutSettingsRequest(), + {}, + ], +) async def test_delete_checkout_settings_async( - transport: str = "grpc_asyncio", - request_type=checkoutsettings.DeleteCheckoutSettingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = CheckoutSettingsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2722,7 +2751,7 @@ async def test_delete_checkout_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( @@ -2742,11 +2771,6 @@ async def test_delete_checkout_settings_async( assert response is None -@pytest.mark.asyncio -async def test_delete_checkout_settings_async_from_dict(): - await test_delete_checkout_settings_async(request_type=dict) - - def test_delete_checkout_settings_field_headers(): client = CheckoutSettingsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3769,7 +3793,6 @@ def test_get_checkout_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = checkoutsettings.GetCheckoutSettingsRequest() - assert args[0] == request_msg @@ -3792,7 +3815,6 @@ def test_create_checkout_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = checkoutsettings.CreateCheckoutSettingsRequest() - assert args[0] == request_msg @@ -3815,7 +3837,6 @@ def test_update_checkout_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = checkoutsettings.UpdateCheckoutSettingsRequest() - assert args[0] == request_msg @@ -3838,7 +3859,6 @@ def test_delete_checkout_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = checkoutsettings.DeleteCheckoutSettingsRequest() - assert args[0] == request_msg @@ -3886,7 +3906,6 @@ async def test_get_checkout_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = checkoutsettings.GetCheckoutSettingsRequest() - assert args[0] == request_msg @@ -3920,7 +3939,6 @@ async def test_create_checkout_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = checkoutsettings.CreateCheckoutSettingsRequest() - assert args[0] == request_msg @@ -3954,7 +3972,6 @@ async def test_update_checkout_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = checkoutsettings.UpdateCheckoutSettingsRequest() - assert args[0] == request_msg @@ -3979,7 +3996,6 @@ async def test_delete_checkout_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = checkoutsettings.DeleteCheckoutSettingsRequest() - assert args[0] == request_msg @@ -4775,7 +4791,6 @@ def test_get_checkout_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = checkoutsettings.GetCheckoutSettingsRequest() - assert args[0] == request_msg @@ -4797,7 +4812,6 @@ def test_create_checkout_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = checkoutsettings.CreateCheckoutSettingsRequest() - assert args[0] == request_msg @@ -4819,7 +4833,6 @@ def test_update_checkout_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = checkoutsettings.UpdateCheckoutSettingsRequest() - assert args[0] == request_msg @@ -4841,7 +4854,6 @@ def test_delete_checkout_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = checkoutsettings.DeleteCheckoutSettingsRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_developer_registration_service.py b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_developer_registration_service.py index 7927f8b0f967..1f31eb991c20 100644 --- a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_developer_registration_service.py +++ b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_developer_registration_service.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 @@ -107,6 +108,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" @@ -1417,8 +1433,8 @@ def test_developer_registration_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - developerregistration.RegisterGcpRequest, - dict, + developerregistration.RegisterGcpRequest(), + {}, ], ) def test_register_gcp(request_type, transport: str = "grpc"): @@ -1429,7 +1445,7 @@ def test_register_gcp(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.register_gcp), "__call__") as call: @@ -1476,10 +1492,11 @@ def test_register_gcp_non_empty_request_with_auto_populated_field(): client.register_gcp(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == developerregistration.RegisterGcpRequest( + request_msg = developerregistration.RegisterGcpRequest( name="name_value", developer_email="developer_email_value", ) + assert args[0] == request_msg def test_register_gcp_use_cached_wrapped_rpc(): @@ -1560,10 +1577,14 @@ async def test_register_gcp_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_register_gcp_async( - transport: str = "grpc_asyncio", - request_type=developerregistration.RegisterGcpRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + developerregistration.RegisterGcpRequest(), + {}, + ], +) +async def test_register_gcp_async(request_type, transport: str = "grpc_asyncio"): client = DeveloperRegistrationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1571,7 +1592,7 @@ async def test_register_gcp_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.register_gcp), "__call__") as call: @@ -1596,11 +1617,6 @@ async def test_register_gcp_async( assert response.gcp_ids == ["gcp_ids_value"] -@pytest.mark.asyncio -async def test_register_gcp_async_from_dict(): - await test_register_gcp_async(request_type=dict) - - def test_register_gcp_field_headers(): client = DeveloperRegistrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1665,8 +1681,8 @@ async def test_register_gcp_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - developerregistration.GetDeveloperRegistrationRequest, - dict, + developerregistration.GetDeveloperRegistrationRequest(), + {}, ], ) def test_get_developer_registration(request_type, transport: str = "grpc"): @@ -1677,7 +1693,7 @@ def test_get_developer_registration(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1727,9 +1743,10 @@ def test_get_developer_registration_non_empty_request_with_auto_populated_field( client.get_developer_registration(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == developerregistration.GetDeveloperRegistrationRequest( + request_msg = developerregistration.GetDeveloperRegistrationRequest( name="name_value", ) + assert args[0] == request_msg def test_get_developer_registration_use_cached_wrapped_rpc(): @@ -1815,9 +1832,15 @@ async def test_get_developer_registration_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + developerregistration.GetDeveloperRegistrationRequest(), + {}, + ], +) async def test_get_developer_registration_async( - transport: str = "grpc_asyncio", - request_type=developerregistration.GetDeveloperRegistrationRequest, + request_type, transport: str = "grpc_asyncio" ): client = DeveloperRegistrationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1826,7 +1849,7 @@ async def test_get_developer_registration_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( @@ -1853,11 +1876,6 @@ async def test_get_developer_registration_async( assert response.gcp_ids == ["gcp_ids_value"] -@pytest.mark.asyncio -async def test_get_developer_registration_async_from_dict(): - await test_get_developer_registration_async(request_type=dict) - - def test_get_developer_registration_field_headers(): client = DeveloperRegistrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2012,8 +2030,8 @@ async def test_get_developer_registration_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - developerregistration.UnregisterGcpRequest, - dict, + developerregistration.UnregisterGcpRequest(), + {}, ], ) def test_unregister_gcp(request_type, transport: str = "grpc"): @@ -2024,7 +2042,7 @@ def test_unregister_gcp(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.unregister_gcp), "__call__") as call: @@ -2065,9 +2083,10 @@ def test_unregister_gcp_non_empty_request_with_auto_populated_field(): client.unregister_gcp(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == developerregistration.UnregisterGcpRequest( + request_msg = developerregistration.UnregisterGcpRequest( name="name_value", ) + assert args[0] == request_msg def test_unregister_gcp_use_cached_wrapped_rpc(): @@ -2148,10 +2167,14 @@ async def test_unregister_gcp_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_unregister_gcp_async( - transport: str = "grpc_asyncio", - request_type=developerregistration.UnregisterGcpRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + developerregistration.UnregisterGcpRequest(), + {}, + ], +) +async def test_unregister_gcp_async(request_type, transport: str = "grpc_asyncio"): client = DeveloperRegistrationServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2159,7 +2182,7 @@ async def test_unregister_gcp_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.unregister_gcp), "__call__") as call: @@ -2177,11 +2200,6 @@ async def test_unregister_gcp_async( assert response is None -@pytest.mark.asyncio -async def test_unregister_gcp_async_from_dict(): - await test_unregister_gcp_async(request_type=dict) - - def test_unregister_gcp_field_headers(): client = DeveloperRegistrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2244,8 +2262,8 @@ async def test_unregister_gcp_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - empty_pb2.Empty, - dict, + empty_pb2.Empty(), + {}, ], ) def test_get_account_for_gcp_registration(request_type, transport: str = "grpc"): @@ -2256,7 +2274,7 @@ def test_get_account_for_gcp_registration(request_type, transport: str = "grpc") # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2304,7 +2322,8 @@ def test_get_account_for_gcp_registration_non_empty_request_with_auto_populated_ client.get_account_for_gcp_registration(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == empty_pb2.Empty() + request_msg = empty_pb2.Empty() + assert args[0] == request_msg def test_get_account_for_gcp_registration_use_cached_wrapped_rpc(): @@ -2390,8 +2409,15 @@ async def test_get_account_for_gcp_registration_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + empty_pb2.Empty(), + {}, + ], +) async def test_get_account_for_gcp_registration_async( - transport: str = "grpc_asyncio", request_type=empty_pb2.Empty + request_type, transport: str = "grpc_asyncio" ): client = DeveloperRegistrationServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2400,7 +2426,7 @@ async def test_get_account_for_gcp_registration_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( @@ -2427,11 +2453,6 @@ async def test_get_account_for_gcp_registration_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_account_for_gcp_registration_async_from_dict(): - await test_get_account_for_gcp_registration_async(request_type=dict) - - def test_get_account_for_gcp_registration_from_dict_foreign(): client = DeveloperRegistrationServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3032,7 +3053,6 @@ def test_register_gcp_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developerregistration.RegisterGcpRequest() - assert args[0] == request_msg @@ -3055,7 +3075,6 @@ def test_get_developer_registration_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developerregistration.GetDeveloperRegistrationRequest() - assert args[0] == request_msg @@ -3076,7 +3095,6 @@ def test_unregister_gcp_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developerregistration.UnregisterGcpRequest() - assert args[0] == request_msg @@ -3099,7 +3117,6 @@ def test_get_account_for_gcp_registration_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = empty_pb2.Empty() - assert args[0] == request_msg @@ -3141,7 +3158,6 @@ async def test_register_gcp_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developerregistration.RegisterGcpRequest() - assert args[0] == request_msg @@ -3171,7 +3187,6 @@ async def test_get_developer_registration_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developerregistration.GetDeveloperRegistrationRequest() - assert args[0] == request_msg @@ -3194,7 +3209,6 @@ async def test_unregister_gcp_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developerregistration.UnregisterGcpRequest() - assert args[0] == request_msg @@ -3223,7 +3237,6 @@ async def test_get_account_for_gcp_registration_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = empty_pb2.Empty() - assert args[0] == request_msg @@ -3787,7 +3800,6 @@ def test_register_gcp_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developerregistration.RegisterGcpRequest() - assert args[0] == request_msg @@ -3809,7 +3821,6 @@ def test_get_developer_registration_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developerregistration.GetDeveloperRegistrationRequest() - assert args[0] == request_msg @@ -3829,7 +3840,6 @@ def test_unregister_gcp_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = developerregistration.UnregisterGcpRequest() - assert args[0] == request_msg @@ -3851,7 +3861,6 @@ def test_get_account_for_gcp_registration_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = empty_pb2.Empty() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_email_preferences_service.py b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_email_preferences_service.py index 750ccd6c111e..0e35957849d3 100644 --- a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_email_preferences_service.py +++ b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_email_preferences_service.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 @@ -107,6 +108,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" @@ -1376,8 +1392,8 @@ def test_email_preferences_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - emailpreferences.GetEmailPreferencesRequest, - dict, + emailpreferences.GetEmailPreferencesRequest(), + {}, ], ) def test_get_email_preferences(request_type, transport: str = "grpc"): @@ -1388,7 +1404,7 @@ def test_get_email_preferences(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1440,9 +1456,10 @@ def test_get_email_preferences_non_empty_request_with_auto_populated_field(): client.get_email_preferences(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == emailpreferences.GetEmailPreferencesRequest( + request_msg = emailpreferences.GetEmailPreferencesRequest( name="name_value", ) + assert args[0] == request_msg def test_get_email_preferences_use_cached_wrapped_rpc(): @@ -1528,9 +1545,15 @@ async def test_get_email_preferences_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + emailpreferences.GetEmailPreferencesRequest(), + {}, + ], +) async def test_get_email_preferences_async( - transport: str = "grpc_asyncio", - request_type=emailpreferences.GetEmailPreferencesRequest, + request_type, transport: str = "grpc_asyncio" ): client = EmailPreferencesServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1539,7 +1562,7 @@ async def test_get_email_preferences_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( @@ -1568,11 +1591,6 @@ async def test_get_email_preferences_async( ) -@pytest.mark.asyncio -async def test_get_email_preferences_async_from_dict(): - await test_get_email_preferences_async(request_type=dict) - - def test_get_email_preferences_field_headers(): client = EmailPreferencesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1727,8 +1745,8 @@ async def test_get_email_preferences_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - emailpreferences.UpdateEmailPreferencesRequest, - dict, + emailpreferences.UpdateEmailPreferencesRequest(), + {}, ], ) def test_update_email_preferences(request_type, transport: str = "grpc"): @@ -1739,7 +1757,7 @@ def test_update_email_preferences(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1789,7 +1807,8 @@ def test_update_email_preferences_non_empty_request_with_auto_populated_field(): client.update_email_preferences(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == emailpreferences.UpdateEmailPreferencesRequest() + request_msg = emailpreferences.UpdateEmailPreferencesRequest() + assert args[0] == request_msg def test_update_email_preferences_use_cached_wrapped_rpc(): @@ -1875,9 +1894,15 @@ async def test_update_email_preferences_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + emailpreferences.UpdateEmailPreferencesRequest(), + {}, + ], +) async def test_update_email_preferences_async( - transport: str = "grpc_asyncio", - request_type=emailpreferences.UpdateEmailPreferencesRequest, + request_type, transport: str = "grpc_asyncio" ): client = EmailPreferencesServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1886,7 +1911,7 @@ async def test_update_email_preferences_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( @@ -1915,11 +1940,6 @@ async def test_update_email_preferences_async( ) -@pytest.mark.asyncio -async def test_update_email_preferences_async_from_dict(): - await test_update_email_preferences_async(request_type=dict) - - def test_update_email_preferences_field_headers(): client = EmailPreferencesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2584,7 +2604,6 @@ def test_get_email_preferences_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = emailpreferences.GetEmailPreferencesRequest() - assert args[0] == request_msg @@ -2607,7 +2626,6 @@ def test_update_email_preferences_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = emailpreferences.UpdateEmailPreferencesRequest() - assert args[0] == request_msg @@ -2651,7 +2669,6 @@ async def test_get_email_preferences_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = emailpreferences.GetEmailPreferencesRequest() - assert args[0] == request_msg @@ -2681,7 +2698,6 @@ async def test_update_email_preferences_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = emailpreferences.UpdateEmailPreferencesRequest() - assert args[0] == request_msg @@ -3072,7 +3088,6 @@ def test_get_email_preferences_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = emailpreferences.GetEmailPreferencesRequest() - assert args[0] == request_msg @@ -3094,7 +3109,6 @@ def test_update_email_preferences_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = emailpreferences.UpdateEmailPreferencesRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_gbp_accounts_service.py b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_gbp_accounts_service.py index 217c5d78accc..8ebab7a99d60 100644 --- a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_gbp_accounts_service.py +++ b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_gbp_accounts_service.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 @@ -108,6 +109,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" @@ -1353,8 +1369,8 @@ def test_gbp_accounts_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - gbpaccounts.ListGbpAccountsRequest, - dict, + gbpaccounts.ListGbpAccountsRequest(), + {}, ], ) def test_list_gbp_accounts(request_type, transport: str = "grpc"): @@ -1365,7 +1381,7 @@ def test_list_gbp_accounts(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1414,10 +1430,11 @@ def test_list_gbp_accounts_non_empty_request_with_auto_populated_field(): client.list_gbp_accounts(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gbpaccounts.ListGbpAccountsRequest( + request_msg = gbpaccounts.ListGbpAccountsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_gbp_accounts_use_cached_wrapped_rpc(): @@ -1500,9 +1517,14 @@ async def test_list_gbp_accounts_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_gbp_accounts_async( - transport: str = "grpc_asyncio", request_type=gbpaccounts.ListGbpAccountsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gbpaccounts.ListGbpAccountsRequest(), + {}, + ], +) +async def test_list_gbp_accounts_async(request_type, transport: str = "grpc_asyncio"): client = GbpAccountsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1510,7 +1532,7 @@ async def test_list_gbp_accounts_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( @@ -1535,11 +1557,6 @@ async def test_list_gbp_accounts_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_gbp_accounts_async_from_dict(): - await test_list_gbp_accounts_async(request_type=dict) - - def test_list_gbp_accounts_field_headers(): client = GbpAccountsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1892,8 +1909,8 @@ async def test_list_gbp_accounts_async_pages(): @pytest.mark.parametrize( "request_type", [ - gbpaccounts.LinkGbpAccountRequest, - dict, + gbpaccounts.LinkGbpAccountRequest(), + {}, ], ) def test_link_gbp_account(request_type, transport: str = "grpc"): @@ -1904,7 +1921,7 @@ def test_link_gbp_account(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.link_gbp_account), "__call__") as call: @@ -1946,10 +1963,11 @@ def test_link_gbp_account_non_empty_request_with_auto_populated_field(): client.link_gbp_account(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gbpaccounts.LinkGbpAccountRequest( + request_msg = gbpaccounts.LinkGbpAccountRequest( parent="parent_value", gbp_email="gbp_email_value", ) + assert args[0] == request_msg def test_link_gbp_account_use_cached_wrapped_rpc(): @@ -2032,9 +2050,14 @@ async def test_link_gbp_account_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_link_gbp_account_async( - transport: str = "grpc_asyncio", request_type=gbpaccounts.LinkGbpAccountRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gbpaccounts.LinkGbpAccountRequest(), + {}, + ], +) +async def test_link_gbp_account_async(request_type, transport: str = "grpc_asyncio"): client = GbpAccountsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2042,7 +2065,7 @@ async def test_link_gbp_account_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.link_gbp_account), "__call__") as call: @@ -2062,11 +2085,6 @@ async def test_link_gbp_account_async( assert isinstance(response, gbpaccounts.LinkGbpAccountResponse) -@pytest.mark.asyncio -async def test_link_gbp_account_async_from_dict(): - await test_link_gbp_account_async(request_type=dict) - - def test_link_gbp_account_field_headers(): client = GbpAccountsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2785,7 +2803,6 @@ def test_list_gbp_accounts_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gbpaccounts.ListGbpAccountsRequest() - assert args[0] == request_msg @@ -2806,7 +2823,6 @@ def test_link_gbp_account_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gbpaccounts.LinkGbpAccountRequest() - assert args[0] == request_msg @@ -2849,7 +2865,6 @@ async def test_list_gbp_accounts_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gbpaccounts.ListGbpAccountsRequest() - assert args[0] == request_msg @@ -2874,7 +2889,6 @@ async def test_link_gbp_account_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gbpaccounts.LinkGbpAccountRequest() - assert args[0] == request_msg @@ -3176,7 +3190,6 @@ def test_list_gbp_accounts_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gbpaccounts.ListGbpAccountsRequest() - assert args[0] == request_msg @@ -3196,7 +3209,6 @@ def test_link_gbp_account_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gbpaccounts.LinkGbpAccountRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_homepage_service.py b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_homepage_service.py index 9cc1cdf9e9c8..5e28fd8b603b 100644 --- a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_homepage_service.py +++ b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_homepage_service.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 @@ -108,6 +109,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" @@ -1335,8 +1351,8 @@ def test_homepage_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - homepage.GetHomepageRequest, - dict, + homepage.GetHomepageRequest(), + {}, ], ) def test_get_homepage(request_type, transport: str = "grpc"): @@ -1347,7 +1363,7 @@ def test_get_homepage(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_homepage), "__call__") as call: @@ -1395,9 +1411,10 @@ def test_get_homepage_non_empty_request_with_auto_populated_field(): client.get_homepage(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == homepage.GetHomepageRequest( + request_msg = homepage.GetHomepageRequest( name="name_value", ) + assert args[0] == request_msg def test_get_homepage_use_cached_wrapped_rpc(): @@ -1478,9 +1495,14 @@ async def test_get_homepage_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_homepage_async( - transport: str = "grpc_asyncio", request_type=homepage.GetHomepageRequest -): +@pytest.mark.parametrize( + "request_type", + [ + homepage.GetHomepageRequest(), + {}, + ], +) +async def test_get_homepage_async(request_type, transport: str = "grpc_asyncio"): client = HomepageServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1488,7 +1510,7 @@ async def test_get_homepage_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_homepage), "__call__") as call: @@ -1515,11 +1537,6 @@ async def test_get_homepage_async( assert response.claimed is True -@pytest.mark.asyncio -async def test_get_homepage_async_from_dict(): - await test_get_homepage_async(request_type=dict) - - def test_get_homepage_field_headers(): client = HomepageServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1662,8 +1679,8 @@ async def test_get_homepage_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gsma_homepage.UpdateHomepageRequest, - dict, + gsma_homepage.UpdateHomepageRequest(), + {}, ], ) def test_update_homepage(request_type, transport: str = "grpc"): @@ -1674,7 +1691,7 @@ def test_update_homepage(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_homepage), "__call__") as call: @@ -1720,7 +1737,8 @@ def test_update_homepage_non_empty_request_with_auto_populated_field(): client.update_homepage(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gsma_homepage.UpdateHomepageRequest() + request_msg = gsma_homepage.UpdateHomepageRequest() + assert args[0] == request_msg def test_update_homepage_use_cached_wrapped_rpc(): @@ -1801,9 +1819,14 @@ async def test_update_homepage_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_homepage_async( - transport: str = "grpc_asyncio", request_type=gsma_homepage.UpdateHomepageRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gsma_homepage.UpdateHomepageRequest(), + {}, + ], +) +async def test_update_homepage_async(request_type, transport: str = "grpc_asyncio"): client = HomepageServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1811,7 +1834,7 @@ async def test_update_homepage_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_homepage), "__call__") as call: @@ -1838,11 +1861,6 @@ async def test_update_homepage_async( assert response.claimed is True -@pytest.mark.asyncio -async def test_update_homepage_async_from_dict(): - await test_update_homepage_async(request_type=dict) - - def test_update_homepage_field_headers(): client = HomepageServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1999,8 +2017,8 @@ async def test_update_homepage_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - homepage.ClaimHomepageRequest, - dict, + homepage.ClaimHomepageRequest(), + {}, ], ) def test_claim_homepage(request_type, transport: str = "grpc"): @@ -2011,7 +2029,7 @@ def test_claim_homepage(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.claim_homepage), "__call__") as call: @@ -2059,9 +2077,10 @@ def test_claim_homepage_non_empty_request_with_auto_populated_field(): client.claim_homepage(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == homepage.ClaimHomepageRequest( + request_msg = homepage.ClaimHomepageRequest( name="name_value", ) + assert args[0] == request_msg def test_claim_homepage_use_cached_wrapped_rpc(): @@ -2142,9 +2161,14 @@ async def test_claim_homepage_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_claim_homepage_async( - transport: str = "grpc_asyncio", request_type=homepage.ClaimHomepageRequest -): +@pytest.mark.parametrize( + "request_type", + [ + homepage.ClaimHomepageRequest(), + {}, + ], +) +async def test_claim_homepage_async(request_type, transport: str = "grpc_asyncio"): client = HomepageServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2152,7 +2176,7 @@ async def test_claim_homepage_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.claim_homepage), "__call__") as call: @@ -2179,11 +2203,6 @@ async def test_claim_homepage_async( assert response.claimed is True -@pytest.mark.asyncio -async def test_claim_homepage_async_from_dict(): - await test_claim_homepage_async(request_type=dict) - - def test_claim_homepage_field_headers(): client = HomepageServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2246,8 +2265,8 @@ async def test_claim_homepage_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - homepage.UnclaimHomepageRequest, - dict, + homepage.UnclaimHomepageRequest(), + {}, ], ) def test_unclaim_homepage(request_type, transport: str = "grpc"): @@ -2258,7 +2277,7 @@ def test_unclaim_homepage(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.unclaim_homepage), "__call__") as call: @@ -2306,9 +2325,10 @@ def test_unclaim_homepage_non_empty_request_with_auto_populated_field(): client.unclaim_homepage(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == homepage.UnclaimHomepageRequest( + request_msg = homepage.UnclaimHomepageRequest( name="name_value", ) + assert args[0] == request_msg def test_unclaim_homepage_use_cached_wrapped_rpc(): @@ -2391,9 +2411,14 @@ async def test_unclaim_homepage_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_unclaim_homepage_async( - transport: str = "grpc_asyncio", request_type=homepage.UnclaimHomepageRequest -): +@pytest.mark.parametrize( + "request_type", + [ + homepage.UnclaimHomepageRequest(), + {}, + ], +) +async def test_unclaim_homepage_async(request_type, transport: str = "grpc_asyncio"): client = HomepageServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2401,7 +2426,7 @@ async def test_unclaim_homepage_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.unclaim_homepage), "__call__") as call: @@ -2428,11 +2453,6 @@ async def test_unclaim_homepage_async( assert response.claimed is True -@pytest.mark.asyncio -async def test_unclaim_homepage_async_from_dict(): - await test_unclaim_homepage_async(request_type=dict) - - def test_unclaim_homepage_field_headers(): client = HomepageServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3212,7 +3232,6 @@ def test_get_homepage_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = homepage.GetHomepageRequest() - assert args[0] == request_msg @@ -3233,7 +3252,6 @@ def test_update_homepage_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gsma_homepage.UpdateHomepageRequest() - assert args[0] == request_msg @@ -3254,7 +3272,6 @@ def test_claim_homepage_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = homepage.ClaimHomepageRequest() - assert args[0] == request_msg @@ -3275,7 +3292,6 @@ def test_unclaim_homepage_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = homepage.UnclaimHomepageRequest() - assert args[0] == request_msg @@ -3318,7 +3334,6 @@ async def test_get_homepage_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = homepage.GetHomepageRequest() - assert args[0] == request_msg @@ -3347,7 +3362,6 @@ async def test_update_homepage_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gsma_homepage.UpdateHomepageRequest() - assert args[0] == request_msg @@ -3376,7 +3390,6 @@ async def test_claim_homepage_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = homepage.ClaimHomepageRequest() - assert args[0] == request_msg @@ -3405,7 +3418,6 @@ async def test_unclaim_homepage_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = homepage.UnclaimHomepageRequest() - assert args[0] == request_msg @@ -4042,7 +4054,6 @@ def test_get_homepage_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = homepage.GetHomepageRequest() - assert args[0] == request_msg @@ -4062,7 +4073,6 @@ def test_update_homepage_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gsma_homepage.UpdateHomepageRequest() - assert args[0] == request_msg @@ -4082,7 +4092,6 @@ def test_claim_homepage_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = homepage.ClaimHomepageRequest() - assert args[0] == request_msg @@ -4102,7 +4111,6 @@ def test_unclaim_homepage_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = homepage.UnclaimHomepageRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_lfp_providers_service.py b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_lfp_providers_service.py index 81d0e9db81ee..e07a31b1ef11 100644 --- a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_lfp_providers_service.py +++ b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_lfp_providers_service.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 @@ -108,6 +109,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" @@ -1371,8 +1387,8 @@ def test_lfp_providers_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - lfpproviders.FindLfpProvidersRequest, - dict, + lfpproviders.FindLfpProvidersRequest(), + {}, ], ) def test_find_lfp_providers(request_type, transport: str = "grpc"): @@ -1383,7 +1399,7 @@ def test_find_lfp_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( @@ -1432,10 +1448,11 @@ def test_find_lfp_providers_non_empty_request_with_auto_populated_field(): client.find_lfp_providers(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == lfpproviders.FindLfpProvidersRequest( + request_msg = lfpproviders.FindLfpProvidersRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_find_lfp_providers_use_cached_wrapped_rpc(): @@ -1520,9 +1537,14 @@ async def test_find_lfp_providers_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_find_lfp_providers_async( - transport: str = "grpc_asyncio", request_type=lfpproviders.FindLfpProvidersRequest -): +@pytest.mark.parametrize( + "request_type", + [ + lfpproviders.FindLfpProvidersRequest(), + {}, + ], +) +async def test_find_lfp_providers_async(request_type, transport: str = "grpc_asyncio"): client = LfpProvidersServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1530,7 +1552,7 @@ async def test_find_lfp_providers_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( @@ -1555,11 +1577,6 @@ async def test_find_lfp_providers_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_find_lfp_providers_async_from_dict(): - await test_find_lfp_providers_async(request_type=dict) - - def test_find_lfp_providers_field_headers(): client = LfpProvidersServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1912,8 +1929,8 @@ async def test_find_lfp_providers_async_pages(): @pytest.mark.parametrize( "request_type", [ - lfpproviders.LinkLfpProviderRequest, - dict, + lfpproviders.LinkLfpProviderRequest(), + {}, ], ) def test_link_lfp_provider(request_type, transport: str = "grpc"): @@ -1924,7 +1941,7 @@ def test_link_lfp_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( @@ -1970,10 +1987,11 @@ def test_link_lfp_provider_non_empty_request_with_auto_populated_field(): client.link_lfp_provider(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == lfpproviders.LinkLfpProviderRequest( + request_msg = lfpproviders.LinkLfpProviderRequest( name="name_value", external_account_id="external_account_id_value", ) + assert args[0] == request_msg def test_link_lfp_provider_use_cached_wrapped_rpc(): @@ -2056,9 +2074,14 @@ async def test_link_lfp_provider_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_link_lfp_provider_async( - transport: str = "grpc_asyncio", request_type=lfpproviders.LinkLfpProviderRequest -): +@pytest.mark.parametrize( + "request_type", + [ + lfpproviders.LinkLfpProviderRequest(), + {}, + ], +) +async def test_link_lfp_provider_async(request_type, transport: str = "grpc_asyncio"): client = LfpProvidersServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2066,7 +2089,7 @@ async def test_link_lfp_provider_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( @@ -2088,11 +2111,6 @@ async def test_link_lfp_provider_async( assert isinstance(response, lfpproviders.LinkLfpProviderResponse) -@pytest.mark.asyncio -async def test_link_lfp_provider_async_from_dict(): - await test_link_lfp_provider_async(request_type=dict) - - def test_link_lfp_provider_field_headers(): client = LfpProvidersServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2824,7 +2842,6 @@ def test_find_lfp_providers_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lfpproviders.FindLfpProvidersRequest() - assert args[0] == request_msg @@ -2847,7 +2864,6 @@ def test_link_lfp_provider_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lfpproviders.LinkLfpProviderRequest() - assert args[0] == request_msg @@ -2890,7 +2906,6 @@ async def test_find_lfp_providers_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lfpproviders.FindLfpProvidersRequest() - assert args[0] == request_msg @@ -2917,7 +2932,6 @@ async def test_link_lfp_provider_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lfpproviders.LinkLfpProviderRequest() - assert args[0] == request_msg @@ -3226,7 +3240,6 @@ def test_find_lfp_providers_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lfpproviders.FindLfpProvidersRequest() - assert args[0] == request_msg @@ -3248,7 +3261,6 @@ def test_link_lfp_provider_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lfpproviders.LinkLfpProviderRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_omnichannel_settings_service.py b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_omnichannel_settings_service.py index 9da411419d2c..622396012bae 100644 --- a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_omnichannel_settings_service.py +++ b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_omnichannel_settings_service.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 @@ -108,6 +109,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" @@ -1402,8 +1418,8 @@ def test_omnichannel_settings_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - omnichannelsettings.GetOmnichannelSettingRequest, - dict, + omnichannelsettings.GetOmnichannelSettingRequest(), + {}, ], ) def test_get_omnichannel_setting(request_type, transport: str = "grpc"): @@ -1414,7 +1430,7 @@ def test_get_omnichannel_setting(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,9 +1482,10 @@ def test_get_omnichannel_setting_non_empty_request_with_auto_populated_field(): client.get_omnichannel_setting(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == omnichannelsettings.GetOmnichannelSettingRequest( + request_msg = omnichannelsettings.GetOmnichannelSettingRequest( name="name_value", ) + assert args[0] == request_msg def test_get_omnichannel_setting_use_cached_wrapped_rpc(): @@ -1554,9 +1571,15 @@ async def test_get_omnichannel_setting_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + omnichannelsettings.GetOmnichannelSettingRequest(), + {}, + ], +) async def test_get_omnichannel_setting_async( - transport: str = "grpc_asyncio", - request_type=omnichannelsettings.GetOmnichannelSettingRequest, + request_type, transport: str = "grpc_asyncio" ): client = OmnichannelSettingsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1565,7 +1588,7 @@ async def test_get_omnichannel_setting_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( @@ -1594,11 +1617,6 @@ async def test_get_omnichannel_setting_async( assert response.lsf_type == omnichannelsettings.OmnichannelSetting.LsfType.GHLSF -@pytest.mark.asyncio -async def test_get_omnichannel_setting_async_from_dict(): - await test_get_omnichannel_setting_async(request_type=dict) - - def test_get_omnichannel_setting_field_headers(): client = OmnichannelSettingsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1753,8 +1771,8 @@ async def test_get_omnichannel_setting_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - omnichannelsettings.ListOmnichannelSettingsRequest, - dict, + omnichannelsettings.ListOmnichannelSettingsRequest(), + {}, ], ) def test_list_omnichannel_settings(request_type, transport: str = "grpc"): @@ -1765,7 +1783,7 @@ def test_list_omnichannel_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( @@ -1814,10 +1832,11 @@ def test_list_omnichannel_settings_non_empty_request_with_auto_populated_field() client.list_omnichannel_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == omnichannelsettings.ListOmnichannelSettingsRequest( + request_msg = omnichannelsettings.ListOmnichannelSettingsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_omnichannel_settings_use_cached_wrapped_rpc(): @@ -1903,9 +1922,15 @@ async def test_list_omnichannel_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + omnichannelsettings.ListOmnichannelSettingsRequest(), + {}, + ], +) async def test_list_omnichannel_settings_async( - transport: str = "grpc_asyncio", - request_type=omnichannelsettings.ListOmnichannelSettingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = OmnichannelSettingsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1914,7 +1939,7 @@ async def test_list_omnichannel_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( @@ -1939,11 +1964,6 @@ async def test_list_omnichannel_settings_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_omnichannel_settings_async_from_dict(): - await test_list_omnichannel_settings_async(request_type=dict) - - def test_list_omnichannel_settings_field_headers(): client = OmnichannelSettingsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2302,8 +2322,8 @@ async def test_list_omnichannel_settings_async_pages(): @pytest.mark.parametrize( "request_type", [ - omnichannelsettings.CreateOmnichannelSettingRequest, - dict, + omnichannelsettings.CreateOmnichannelSettingRequest(), + {}, ], ) def test_create_omnichannel_setting(request_type, transport: str = "grpc"): @@ -2314,7 +2334,7 @@ def test_create_omnichannel_setting(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2366,9 +2386,10 @@ def test_create_omnichannel_setting_non_empty_request_with_auto_populated_field( client.create_omnichannel_setting(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == omnichannelsettings.CreateOmnichannelSettingRequest( + request_msg = omnichannelsettings.CreateOmnichannelSettingRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_omnichannel_setting_use_cached_wrapped_rpc(): @@ -2454,9 +2475,15 @@ async def test_create_omnichannel_setting_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + omnichannelsettings.CreateOmnichannelSettingRequest(), + {}, + ], +) async def test_create_omnichannel_setting_async( - transport: str = "grpc_asyncio", - request_type=omnichannelsettings.CreateOmnichannelSettingRequest, + request_type, transport: str = "grpc_asyncio" ): client = OmnichannelSettingsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2465,7 +2492,7 @@ async def test_create_omnichannel_setting_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( @@ -2494,11 +2521,6 @@ async def test_create_omnichannel_setting_async( assert response.lsf_type == omnichannelsettings.OmnichannelSetting.LsfType.GHLSF -@pytest.mark.asyncio -async def test_create_omnichannel_setting_async_from_dict(): - await test_create_omnichannel_setting_async(request_type=dict) - - def test_create_omnichannel_setting_field_headers(): client = OmnichannelSettingsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2671,8 +2693,8 @@ async def test_create_omnichannel_setting_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - omnichannelsettings.UpdateOmnichannelSettingRequest, - dict, + omnichannelsettings.UpdateOmnichannelSettingRequest(), + {}, ], ) def test_update_omnichannel_setting(request_type, transport: str = "grpc"): @@ -2683,7 +2705,7 @@ def test_update_omnichannel_setting(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2733,7 +2755,8 @@ def test_update_omnichannel_setting_non_empty_request_with_auto_populated_field( client.update_omnichannel_setting(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == omnichannelsettings.UpdateOmnichannelSettingRequest() + request_msg = omnichannelsettings.UpdateOmnichannelSettingRequest() + assert args[0] == request_msg def test_update_omnichannel_setting_use_cached_wrapped_rpc(): @@ -2819,9 +2842,15 @@ async def test_update_omnichannel_setting_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + omnichannelsettings.UpdateOmnichannelSettingRequest(), + {}, + ], +) async def test_update_omnichannel_setting_async( - transport: str = "grpc_asyncio", - request_type=omnichannelsettings.UpdateOmnichannelSettingRequest, + request_type, transport: str = "grpc_asyncio" ): client = OmnichannelSettingsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2830,7 +2859,7 @@ async def test_update_omnichannel_setting_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( @@ -2859,11 +2888,6 @@ async def test_update_omnichannel_setting_async( assert response.lsf_type == omnichannelsettings.OmnichannelSetting.LsfType.GHLSF -@pytest.mark.asyncio -async def test_update_omnichannel_setting_async_from_dict(): - await test_update_omnichannel_setting_async(request_type=dict) - - def test_update_omnichannel_setting_field_headers(): client = OmnichannelSettingsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3036,8 +3060,8 @@ async def test_update_omnichannel_setting_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - omnichannelsettings.RequestInventoryVerificationRequest, - dict, + omnichannelsettings.RequestInventoryVerificationRequest(), + {}, ], ) def test_request_inventory_verification(request_type, transport: str = "grpc"): @@ -3048,7 +3072,7 @@ def test_request_inventory_verification(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3095,9 +3119,10 @@ def test_request_inventory_verification_non_empty_request_with_auto_populated_fi client.request_inventory_verification(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == omnichannelsettings.RequestInventoryVerificationRequest( + request_msg = omnichannelsettings.RequestInventoryVerificationRequest( name="name_value", ) + assert args[0] == request_msg def test_request_inventory_verification_use_cached_wrapped_rpc(): @@ -3183,9 +3208,15 @@ async def test_request_inventory_verification_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + omnichannelsettings.RequestInventoryVerificationRequest(), + {}, + ], +) async def test_request_inventory_verification_async( - transport: str = "grpc_asyncio", - request_type=omnichannelsettings.RequestInventoryVerificationRequest, + request_type, transport: str = "grpc_asyncio" ): client = OmnichannelSettingsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3194,7 +3225,7 @@ async def test_request_inventory_verification_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( @@ -3218,11 +3249,6 @@ async def test_request_inventory_verification_async( ) -@pytest.mark.asyncio -async def test_request_inventory_verification_async_from_dict(): - await test_request_inventory_verification_async(request_type=dict) - - def test_request_inventory_verification_field_headers(): client = OmnichannelSettingsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4537,7 +4563,6 @@ def test_get_omnichannel_setting_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = omnichannelsettings.GetOmnichannelSettingRequest() - assert args[0] == request_msg @@ -4560,7 +4585,6 @@ def test_list_omnichannel_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = omnichannelsettings.ListOmnichannelSettingsRequest() - assert args[0] == request_msg @@ -4583,7 +4607,6 @@ def test_create_omnichannel_setting_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = omnichannelsettings.CreateOmnichannelSettingRequest() - assert args[0] == request_msg @@ -4606,7 +4629,6 @@ def test_update_omnichannel_setting_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = omnichannelsettings.UpdateOmnichannelSettingRequest() - assert args[0] == request_msg @@ -4629,7 +4651,6 @@ def test_request_inventory_verification_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = omnichannelsettings.RequestInventoryVerificationRequest() - assert args[0] == request_msg @@ -4674,7 +4695,6 @@ async def test_get_omnichannel_setting_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = omnichannelsettings.GetOmnichannelSettingRequest() - assert args[0] == request_msg @@ -4703,7 +4723,6 @@ async def test_list_omnichannel_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = omnichannelsettings.ListOmnichannelSettingsRequest() - assert args[0] == request_msg @@ -4734,7 +4753,6 @@ async def test_create_omnichannel_setting_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = omnichannelsettings.CreateOmnichannelSettingRequest() - assert args[0] == request_msg @@ -4765,7 +4783,6 @@ async def test_update_omnichannel_setting_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = omnichannelsettings.UpdateOmnichannelSettingRequest() - assert args[0] == request_msg @@ -4792,7 +4809,6 @@ async def test_request_inventory_verification_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = omnichannelsettings.RequestInventoryVerificationRequest() - assert args[0] == request_msg @@ -5715,7 +5731,6 @@ def test_get_omnichannel_setting_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = omnichannelsettings.GetOmnichannelSettingRequest() - assert args[0] == request_msg @@ -5737,7 +5752,6 @@ def test_list_omnichannel_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = omnichannelsettings.ListOmnichannelSettingsRequest() - assert args[0] == request_msg @@ -5759,7 +5773,6 @@ def test_create_omnichannel_setting_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = omnichannelsettings.CreateOmnichannelSettingRequest() - assert args[0] == request_msg @@ -5781,7 +5794,6 @@ def test_update_omnichannel_setting_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = omnichannelsettings.UpdateOmnichannelSettingRequest() - assert args[0] == request_msg @@ -5803,7 +5815,6 @@ def test_request_inventory_verification_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = omnichannelsettings.RequestInventoryVerificationRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_online_return_policy_service.py b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_online_return_policy_service.py index 25a72a62590a..a22463d4f8fb 100644 --- a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_online_return_policy_service.py +++ b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_online_return_policy_service.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" @@ -1394,8 +1410,8 @@ def test_online_return_policy_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - online_return_policy.GetOnlineReturnPolicyRequest, - dict, + online_return_policy.GetOnlineReturnPolicyRequest(), + {}, ], ) def test_get_online_return_policy(request_type, transport: str = "grpc"): @@ -1406,7 +1422,7 @@ def test_get_online_return_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( @@ -1483,9 +1499,10 @@ def test_get_online_return_policy_non_empty_request_with_auto_populated_field(): client.get_online_return_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == online_return_policy.GetOnlineReturnPolicyRequest( + request_msg = online_return_policy.GetOnlineReturnPolicyRequest( name="name_value", ) + assert args[0] == request_msg def test_get_online_return_policy_use_cached_wrapped_rpc(): @@ -1571,9 +1588,15 @@ async def test_get_online_return_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + online_return_policy.GetOnlineReturnPolicyRequest(), + {}, + ], +) async def test_get_online_return_policy_async( - transport: str = "grpc_asyncio", - request_type=online_return_policy.GetOnlineReturnPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = OnlineReturnPolicyServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1582,7 +1605,7 @@ async def test_get_online_return_policy_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( @@ -1638,11 +1661,6 @@ async def test_get_online_return_policy_async( ) -@pytest.mark.asyncio -async def test_get_online_return_policy_async_from_dict(): - await test_get_online_return_policy_async(request_type=dict) - - def test_get_online_return_policy_field_headers(): client = OnlineReturnPolicyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1797,8 +1815,8 @@ async def test_get_online_return_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - online_return_policy.ListOnlineReturnPoliciesRequest, - dict, + online_return_policy.ListOnlineReturnPoliciesRequest(), + {}, ], ) def test_list_online_return_policies(request_type, transport: str = "grpc"): @@ -1809,7 +1827,7 @@ def test_list_online_return_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( @@ -1858,10 +1876,11 @@ def test_list_online_return_policies_non_empty_request_with_auto_populated_field client.list_online_return_policies(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == online_return_policy.ListOnlineReturnPoliciesRequest( + request_msg = online_return_policy.ListOnlineReturnPoliciesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_online_return_policies_use_cached_wrapped_rpc(): @@ -1947,9 +1966,15 @@ async def test_list_online_return_policies_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + online_return_policy.ListOnlineReturnPoliciesRequest(), + {}, + ], +) async def test_list_online_return_policies_async( - transport: str = "grpc_asyncio", - request_type=online_return_policy.ListOnlineReturnPoliciesRequest, + request_type, transport: str = "grpc_asyncio" ): client = OnlineReturnPolicyServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1958,7 +1983,7 @@ async def test_list_online_return_policies_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( @@ -1983,11 +2008,6 @@ async def test_list_online_return_policies_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_online_return_policies_async_from_dict(): - await test_list_online_return_policies_async(request_type=dict) - - def test_list_online_return_policies_field_headers(): client = OnlineReturnPolicyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2346,8 +2366,8 @@ async def test_list_online_return_policies_async_pages(): @pytest.mark.parametrize( "request_type", [ - gsma_online_return_policy.CreateOnlineReturnPolicyRequest, - dict, + gsma_online_return_policy.CreateOnlineReturnPolicyRequest(), + {}, ], ) def test_create_online_return_policy(request_type, transport: str = "grpc"): @@ -2358,7 +2378,7 @@ def test_create_online_return_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( @@ -2437,9 +2457,10 @@ def test_create_online_return_policy_non_empty_request_with_auto_populated_field client.create_online_return_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gsma_online_return_policy.CreateOnlineReturnPolicyRequest( + request_msg = gsma_online_return_policy.CreateOnlineReturnPolicyRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_online_return_policy_use_cached_wrapped_rpc(): @@ -2525,9 +2546,15 @@ async def test_create_online_return_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gsma_online_return_policy.CreateOnlineReturnPolicyRequest(), + {}, + ], +) async def test_create_online_return_policy_async( - transport: str = "grpc_asyncio", - request_type=gsma_online_return_policy.CreateOnlineReturnPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = OnlineReturnPolicyServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2536,7 +2563,7 @@ async def test_create_online_return_policy_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( @@ -2592,11 +2619,6 @@ async def test_create_online_return_policy_async( ) -@pytest.mark.asyncio -async def test_create_online_return_policy_async_from_dict(): - await test_create_online_return_policy_async(request_type=dict) - - def test_create_online_return_policy_field_headers(): client = OnlineReturnPolicyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2769,8 +2791,8 @@ async def test_create_online_return_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - online_return_policy.DeleteOnlineReturnPolicyRequest, - dict, + online_return_policy.DeleteOnlineReturnPolicyRequest(), + {}, ], ) def test_delete_online_return_policy(request_type, transport: str = "grpc"): @@ -2781,7 +2803,7 @@ def test_delete_online_return_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( @@ -2826,9 +2848,10 @@ def test_delete_online_return_policy_non_empty_request_with_auto_populated_field client.delete_online_return_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == online_return_policy.DeleteOnlineReturnPolicyRequest( + request_msg = online_return_policy.DeleteOnlineReturnPolicyRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_online_return_policy_use_cached_wrapped_rpc(): @@ -2914,9 +2937,15 @@ async def test_delete_online_return_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + online_return_policy.DeleteOnlineReturnPolicyRequest(), + {}, + ], +) async def test_delete_online_return_policy_async( - transport: str = "grpc_asyncio", - request_type=online_return_policy.DeleteOnlineReturnPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = OnlineReturnPolicyServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2925,7 +2954,7 @@ async def test_delete_online_return_policy_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( @@ -2945,11 +2974,6 @@ async def test_delete_online_return_policy_async( assert response is None -@pytest.mark.asyncio -async def test_delete_online_return_policy_async_from_dict(): - await test_delete_online_return_policy_async(request_type=dict) - - def test_delete_online_return_policy_field_headers(): client = OnlineReturnPolicyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4049,7 +4073,6 @@ def test_get_online_return_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = online_return_policy.GetOnlineReturnPolicyRequest() - assert args[0] == request_msg @@ -4072,7 +4095,6 @@ def test_list_online_return_policies_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = online_return_policy.ListOnlineReturnPoliciesRequest() - assert args[0] == request_msg @@ -4095,7 +4117,6 @@ def test_create_online_return_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gsma_online_return_policy.CreateOnlineReturnPolicyRequest() - assert args[0] == request_msg @@ -4118,7 +4139,6 @@ def test_delete_online_return_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = online_return_policy.DeleteOnlineReturnPolicyRequest() - assert args[0] == request_msg @@ -4175,7 +4195,6 @@ async def test_get_online_return_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = online_return_policy.GetOnlineReturnPolicyRequest() - assert args[0] == request_msg @@ -4204,7 +4223,6 @@ async def test_list_online_return_policies_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = online_return_policy.ListOnlineReturnPoliciesRequest() - assert args[0] == request_msg @@ -4247,7 +4265,6 @@ async def test_create_online_return_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gsma_online_return_policy.CreateOnlineReturnPolicyRequest() - assert args[0] == request_msg @@ -4272,7 +4289,6 @@ async def test_delete_online_return_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = online_return_policy.DeleteOnlineReturnPolicyRequest() - assert args[0] == request_msg @@ -4997,7 +5013,6 @@ def test_get_online_return_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = online_return_policy.GetOnlineReturnPolicyRequest() - assert args[0] == request_msg @@ -5019,7 +5034,6 @@ def test_list_online_return_policies_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = online_return_policy.ListOnlineReturnPoliciesRequest() - assert args[0] == request_msg @@ -5041,7 +5055,6 @@ def test_create_online_return_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gsma_online_return_policy.CreateOnlineReturnPolicyRequest() - assert args[0] == request_msg @@ -5063,7 +5076,6 @@ def test_delete_online_return_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = online_return_policy.DeleteOnlineReturnPolicyRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_programs_service.py b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_programs_service.py index b3ffeb2d5433..63793357abb3 100644 --- a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_programs_service.py +++ b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_programs_service.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 @@ -107,6 +108,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" @@ -1334,8 +1350,8 @@ def test_programs_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - programs.GetProgramRequest, - dict, + programs.GetProgramRequest(), + {}, ], ) def test_get_program(request_type, transport: str = "grpc"): @@ -1346,7 +1362,7 @@ def test_get_program(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_program), "__call__") as call: @@ -1396,9 +1412,10 @@ def test_get_program_non_empty_request_with_auto_populated_field(): client.get_program(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == programs.GetProgramRequest( + request_msg = programs.GetProgramRequest( name="name_value", ) + assert args[0] == request_msg def test_get_program_use_cached_wrapped_rpc(): @@ -1479,9 +1496,14 @@ async def test_get_program_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_program_async( - transport: str = "grpc_asyncio", request_type=programs.GetProgramRequest -): +@pytest.mark.parametrize( + "request_type", + [ + programs.GetProgramRequest(), + {}, + ], +) +async def test_get_program_async(request_type, transport: str = "grpc_asyncio"): client = ProgramsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1489,7 +1511,7 @@ async def test_get_program_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_program), "__call__") as call: @@ -1518,11 +1540,6 @@ async def test_get_program_async( assert response.active_region_codes == ["active_region_codes_value"] -@pytest.mark.asyncio -async def test_get_program_async_from_dict(): - await test_get_program_async(request_type=dict) - - def test_get_program_field_headers(): client = ProgramsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1665,8 +1682,8 @@ async def test_get_program_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - programs.ListProgramsRequest, - dict, + programs.ListProgramsRequest(), + {}, ], ) def test_list_programs(request_type, transport: str = "grpc"): @@ -1677,7 +1694,7 @@ def test_list_programs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_programs), "__call__") as call: @@ -1722,10 +1739,11 @@ def test_list_programs_non_empty_request_with_auto_populated_field(): client.list_programs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == programs.ListProgramsRequest( + request_msg = programs.ListProgramsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_programs_use_cached_wrapped_rpc(): @@ -1806,9 +1824,14 @@ async def test_list_programs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_programs_async( - transport: str = "grpc_asyncio", request_type=programs.ListProgramsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + programs.ListProgramsRequest(), + {}, + ], +) +async def test_list_programs_async(request_type, transport: str = "grpc_asyncio"): client = ProgramsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1816,7 +1839,7 @@ async def test_list_programs_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_programs), "__call__") as call: @@ -1839,11 +1862,6 @@ async def test_list_programs_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_programs_async_from_dict(): - await test_list_programs_async(request_type=dict) - - def test_list_programs_field_headers(): client = ProgramsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2180,8 +2198,8 @@ async def test_list_programs_async_pages(): @pytest.mark.parametrize( "request_type", [ - programs.EnableProgramRequest, - dict, + programs.EnableProgramRequest(), + {}, ], ) def test_enable_program(request_type, transport: str = "grpc"): @@ -2192,7 +2210,7 @@ def test_enable_program(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.enable_program), "__call__") as call: @@ -2242,9 +2260,10 @@ def test_enable_program_non_empty_request_with_auto_populated_field(): client.enable_program(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == programs.EnableProgramRequest( + request_msg = programs.EnableProgramRequest( name="name_value", ) + assert args[0] == request_msg def test_enable_program_use_cached_wrapped_rpc(): @@ -2325,9 +2344,14 @@ async def test_enable_program_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_enable_program_async( - transport: str = "grpc_asyncio", request_type=programs.EnableProgramRequest -): +@pytest.mark.parametrize( + "request_type", + [ + programs.EnableProgramRequest(), + {}, + ], +) +async def test_enable_program_async(request_type, transport: str = "grpc_asyncio"): client = ProgramsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2335,7 +2359,7 @@ async def test_enable_program_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.enable_program), "__call__") as call: @@ -2364,11 +2388,6 @@ async def test_enable_program_async( assert response.active_region_codes == ["active_region_codes_value"] -@pytest.mark.asyncio -async def test_enable_program_async_from_dict(): - await test_enable_program_async(request_type=dict) - - def test_enable_program_field_headers(): client = ProgramsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2511,8 +2530,8 @@ async def test_enable_program_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - programs.DisableProgramRequest, - dict, + programs.DisableProgramRequest(), + {}, ], ) def test_disable_program(request_type, transport: str = "grpc"): @@ -2523,7 +2542,7 @@ def test_disable_program(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.disable_program), "__call__") as call: @@ -2573,9 +2592,10 @@ def test_disable_program_non_empty_request_with_auto_populated_field(): client.disable_program(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == programs.DisableProgramRequest( + request_msg = programs.DisableProgramRequest( name="name_value", ) + assert args[0] == request_msg def test_disable_program_use_cached_wrapped_rpc(): @@ -2656,9 +2676,14 @@ async def test_disable_program_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_disable_program_async( - transport: str = "grpc_asyncio", request_type=programs.DisableProgramRequest -): +@pytest.mark.parametrize( + "request_type", + [ + programs.DisableProgramRequest(), + {}, + ], +) +async def test_disable_program_async(request_type, transport: str = "grpc_asyncio"): client = ProgramsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2666,7 +2691,7 @@ async def test_disable_program_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.disable_program), "__call__") as call: @@ -2695,11 +2720,6 @@ async def test_disable_program_async( assert response.active_region_codes == ["active_region_codes_value"] -@pytest.mark.asyncio -async def test_disable_program_async_from_dict(): - await test_disable_program_async(request_type=dict) - - def test_disable_program_field_headers(): client = ProgramsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3746,7 +3766,6 @@ def test_get_program_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = programs.GetProgramRequest() - assert args[0] == request_msg @@ -3767,7 +3786,6 @@ def test_list_programs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = programs.ListProgramsRequest() - assert args[0] == request_msg @@ -3788,7 +3806,6 @@ def test_enable_program_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = programs.EnableProgramRequest() - assert args[0] == request_msg @@ -3809,7 +3826,6 @@ def test_disable_program_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = programs.DisableProgramRequest() - assert args[0] == request_msg @@ -3853,7 +3869,6 @@ async def test_get_program_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = programs.GetProgramRequest() - assert args[0] == request_msg @@ -3880,7 +3895,6 @@ async def test_list_programs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = programs.ListProgramsRequest() - assert args[0] == request_msg @@ -3910,7 +3924,6 @@ async def test_enable_program_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = programs.EnableProgramRequest() - assert args[0] == request_msg @@ -3940,7 +3953,6 @@ async def test_disable_program_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = programs.DisableProgramRequest() - assert args[0] == request_msg @@ -4501,7 +4513,6 @@ def test_get_program_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = programs.GetProgramRequest() - assert args[0] == request_msg @@ -4521,7 +4532,6 @@ def test_list_programs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = programs.ListProgramsRequest() - assert args[0] == request_msg @@ -4541,7 +4551,6 @@ def test_enable_program_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = programs.EnableProgramRequest() - assert args[0] == request_msg @@ -4561,7 +4570,6 @@ def test_disable_program_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = programs.DisableProgramRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_regions_service.py b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_regions_service.py index 492eba057796..71226727936c 100644 --- a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_regions_service.py +++ b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_regions_service.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 @@ -110,6 +111,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" @@ -1313,8 +1329,8 @@ def test_regions_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - regions.GetRegionRequest, - dict, + regions.GetRegionRequest(), + {}, ], ) def test_get_region(request_type, transport: str = "grpc"): @@ -1325,7 +1341,7 @@ def test_get_region(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_region), "__call__") as call: @@ -1371,9 +1387,10 @@ def test_get_region_non_empty_request_with_auto_populated_field(): client.get_region(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == regions.GetRegionRequest( + request_msg = regions.GetRegionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_region_use_cached_wrapped_rpc(): @@ -1452,9 +1469,14 @@ async def test_get_region_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_region_async( - transport: str = "grpc_asyncio", request_type=regions.GetRegionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + regions.GetRegionRequest(), + {}, + ], +) +async def test_get_region_async(request_type, transport: str = "grpc_asyncio"): client = RegionsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1462,7 +1484,7 @@ async def test_get_region_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_region), "__call__") as call: @@ -1487,11 +1509,6 @@ async def test_get_region_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_get_region_async_from_dict(): - await test_get_region_async(request_type=dict) - - def test_get_region_field_headers(): client = RegionsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1634,8 +1651,8 @@ async def test_get_region_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - regions.CreateRegionRequest, - dict, + regions.CreateRegionRequest(), + {}, ], ) def test_create_region(request_type, transport: str = "grpc"): @@ -1646,7 +1663,7 @@ def test_create_region(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_region), "__call__") as call: @@ -1693,10 +1710,11 @@ def test_create_region_non_empty_request_with_auto_populated_field(): client.create_region(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == regions.CreateRegionRequest( + request_msg = regions.CreateRegionRequest( parent="parent_value", region_id="region_id_value", ) + assert args[0] == request_msg def test_create_region_use_cached_wrapped_rpc(): @@ -1777,9 +1795,14 @@ async def test_create_region_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_region_async( - transport: str = "grpc_asyncio", request_type=regions.CreateRegionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + regions.CreateRegionRequest(), + {}, + ], +) +async def test_create_region_async(request_type, transport: str = "grpc_asyncio"): client = RegionsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1787,7 +1810,7 @@ async def test_create_region_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_region), "__call__") as call: @@ -1812,11 +1835,6 @@ async def test_create_region_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_create_region_async_from_dict(): - await test_create_region_async(request_type=dict) - - def test_create_region_field_headers(): client = RegionsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1979,8 +1997,8 @@ async def test_create_region_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - regions.BatchCreateRegionsRequest, - dict, + regions.BatchCreateRegionsRequest(), + {}, ], ) def test_batch_create_regions(request_type, transport: str = "grpc"): @@ -1991,7 +2009,7 @@ def test_batch_create_regions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2036,9 +2054,10 @@ def test_batch_create_regions_non_empty_request_with_auto_populated_field(): client.batch_create_regions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == regions.BatchCreateRegionsRequest( + request_msg = regions.BatchCreateRegionsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_batch_create_regions_use_cached_wrapped_rpc(): @@ -2123,8 +2142,15 @@ async def test_batch_create_regions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + regions.BatchCreateRegionsRequest(), + {}, + ], +) async def test_batch_create_regions_async( - transport: str = "grpc_asyncio", request_type=regions.BatchCreateRegionsRequest + request_type, transport: str = "grpc_asyncio" ): client = RegionsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2133,7 +2159,7 @@ async def test_batch_create_regions_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( @@ -2155,11 +2181,6 @@ async def test_batch_create_regions_async( assert isinstance(response, regions.BatchCreateRegionsResponse) -@pytest.mark.asyncio -async def test_batch_create_regions_async_from_dict(): - await test_batch_create_regions_async(request_type=dict) - - def test_batch_create_regions_field_headers(): client = RegionsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2228,8 +2249,8 @@ async def test_batch_create_regions_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - regions.UpdateRegionRequest, - dict, + regions.UpdateRegionRequest(), + {}, ], ) def test_update_region(request_type, transport: str = "grpc"): @@ -2240,7 +2261,7 @@ def test_update_region(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_region), "__call__") as call: @@ -2284,7 +2305,8 @@ def test_update_region_non_empty_request_with_auto_populated_field(): client.update_region(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == regions.UpdateRegionRequest() + request_msg = regions.UpdateRegionRequest() + assert args[0] == request_msg def test_update_region_use_cached_wrapped_rpc(): @@ -2365,9 +2387,14 @@ async def test_update_region_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_region_async( - transport: str = "grpc_asyncio", request_type=regions.UpdateRegionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + regions.UpdateRegionRequest(), + {}, + ], +) +async def test_update_region_async(request_type, transport: str = "grpc_asyncio"): client = RegionsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2375,7 +2402,7 @@ async def test_update_region_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_region), "__call__") as call: @@ -2400,11 +2427,6 @@ async def test_update_region_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_update_region_async_from_dict(): - await test_update_region_async(request_type=dict) - - def test_update_region_field_headers(): client = RegionsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2557,8 +2579,8 @@ async def test_update_region_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - regions.BatchUpdateRegionsRequest, - dict, + regions.BatchUpdateRegionsRequest(), + {}, ], ) def test_batch_update_regions(request_type, transport: str = "grpc"): @@ -2569,7 +2591,7 @@ def test_batch_update_regions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2614,9 +2636,10 @@ def test_batch_update_regions_non_empty_request_with_auto_populated_field(): client.batch_update_regions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == regions.BatchUpdateRegionsRequest( + request_msg = regions.BatchUpdateRegionsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_batch_update_regions_use_cached_wrapped_rpc(): @@ -2701,8 +2724,15 @@ async def test_batch_update_regions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + regions.BatchUpdateRegionsRequest(), + {}, + ], +) async def test_batch_update_regions_async( - transport: str = "grpc_asyncio", request_type=regions.BatchUpdateRegionsRequest + request_type, transport: str = "grpc_asyncio" ): client = RegionsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2711,7 +2741,7 @@ async def test_batch_update_regions_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( @@ -2733,11 +2763,6 @@ async def test_batch_update_regions_async( assert isinstance(response, regions.BatchUpdateRegionsResponse) -@pytest.mark.asyncio -async def test_batch_update_regions_async_from_dict(): - await test_batch_update_regions_async(request_type=dict) - - def test_batch_update_regions_field_headers(): client = RegionsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2806,8 +2831,8 @@ async def test_batch_update_regions_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - regions.DeleteRegionRequest, - dict, + regions.DeleteRegionRequest(), + {}, ], ) def test_delete_region(request_type, transport: str = "grpc"): @@ -2818,7 +2843,7 @@ def test_delete_region(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_region), "__call__") as call: @@ -2859,9 +2884,10 @@ def test_delete_region_non_empty_request_with_auto_populated_field(): client.delete_region(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == regions.DeleteRegionRequest( + request_msg = regions.DeleteRegionRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_region_use_cached_wrapped_rpc(): @@ -2942,9 +2968,14 @@ async def test_delete_region_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_region_async( - transport: str = "grpc_asyncio", request_type=regions.DeleteRegionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + regions.DeleteRegionRequest(), + {}, + ], +) +async def test_delete_region_async(request_type, transport: str = "grpc_asyncio"): client = RegionsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2952,7 +2983,7 @@ async def test_delete_region_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_region), "__call__") as call: @@ -2970,11 +3001,6 @@ async def test_delete_region_async( assert response is None -@pytest.mark.asyncio -async def test_delete_region_async_from_dict(): - await test_delete_region_async(request_type=dict) - - def test_delete_region_field_headers(): client = RegionsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3117,8 +3143,8 @@ async def test_delete_region_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - regions.BatchDeleteRegionsRequest, - dict, + regions.BatchDeleteRegionsRequest(), + {}, ], ) def test_batch_delete_regions(request_type, transport: str = "grpc"): @@ -3129,7 +3155,7 @@ def test_batch_delete_regions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3174,9 +3200,10 @@ def test_batch_delete_regions_non_empty_request_with_auto_populated_field(): client.batch_delete_regions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == regions.BatchDeleteRegionsRequest( + request_msg = regions.BatchDeleteRegionsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_batch_delete_regions_use_cached_wrapped_rpc(): @@ -3261,8 +3288,15 @@ async def test_batch_delete_regions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + regions.BatchDeleteRegionsRequest(), + {}, + ], +) async def test_batch_delete_regions_async( - transport: str = "grpc_asyncio", request_type=regions.BatchDeleteRegionsRequest + request_type, transport: str = "grpc_asyncio" ): client = RegionsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3271,7 +3305,7 @@ async def test_batch_delete_regions_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( @@ -3291,11 +3325,6 @@ async def test_batch_delete_regions_async( assert response is None -@pytest.mark.asyncio -async def test_batch_delete_regions_async_from_dict(): - await test_batch_delete_regions_async(request_type=dict) - - def test_batch_delete_regions_field_headers(): client = RegionsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3362,8 +3391,8 @@ async def test_batch_delete_regions_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - regions.ListRegionsRequest, - dict, + regions.ListRegionsRequest(), + {}, ], ) def test_list_regions(request_type, transport: str = "grpc"): @@ -3374,7 +3403,7 @@ def test_list_regions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_regions), "__call__") as call: @@ -3419,10 +3448,11 @@ def test_list_regions_non_empty_request_with_auto_populated_field(): client.list_regions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == regions.ListRegionsRequest( + request_msg = regions.ListRegionsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_regions_use_cached_wrapped_rpc(): @@ -3503,9 +3533,14 @@ async def test_list_regions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_regions_async( - transport: str = "grpc_asyncio", request_type=regions.ListRegionsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + regions.ListRegionsRequest(), + {}, + ], +) +async def test_list_regions_async(request_type, transport: str = "grpc_asyncio"): client = RegionsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3513,7 +3548,7 @@ async def test_list_regions_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_regions), "__call__") as call: @@ -3536,11 +3571,6 @@ async def test_list_regions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_regions_async_from_dict(): - await test_list_regions_async(request_type=dict) - - def test_list_regions_field_headers(): client = RegionsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5369,7 +5399,6 @@ def test_get_region_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = regions.GetRegionRequest() - assert args[0] == request_msg @@ -5390,7 +5419,6 @@ def test_create_region_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = regions.CreateRegionRequest() - assert args[0] == request_msg @@ -5413,7 +5441,6 @@ def test_batch_create_regions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = regions.BatchCreateRegionsRequest() - assert args[0] == request_msg @@ -5434,7 +5461,6 @@ def test_update_region_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = regions.UpdateRegionRequest() - assert args[0] == request_msg @@ -5457,7 +5483,6 @@ def test_batch_update_regions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = regions.BatchUpdateRegionsRequest() - assert args[0] == request_msg @@ -5478,7 +5503,6 @@ def test_delete_region_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = regions.DeleteRegionRequest() - assert args[0] == request_msg @@ -5501,7 +5525,6 @@ def test_batch_delete_regions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = regions.BatchDeleteRegionsRequest() - assert args[0] == request_msg @@ -5522,7 +5545,6 @@ def test_list_regions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = regions.ListRegionsRequest() - assert args[0] == request_msg @@ -5564,7 +5586,6 @@ async def test_get_region_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = regions.GetRegionRequest() - assert args[0] == request_msg @@ -5592,7 +5613,6 @@ async def test_create_region_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = regions.CreateRegionRequest() - assert args[0] == request_msg @@ -5619,7 +5639,6 @@ async def test_batch_create_regions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = regions.BatchCreateRegionsRequest() - assert args[0] == request_msg @@ -5647,7 +5666,6 @@ async def test_update_region_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = regions.UpdateRegionRequest() - assert args[0] == request_msg @@ -5674,7 +5692,6 @@ async def test_batch_update_regions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = regions.BatchUpdateRegionsRequest() - assert args[0] == request_msg @@ -5697,7 +5714,6 @@ async def test_delete_region_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = regions.DeleteRegionRequest() - assert args[0] == request_msg @@ -5722,7 +5738,6 @@ async def test_batch_delete_regions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = regions.BatchDeleteRegionsRequest() - assert args[0] == request_msg @@ -5749,7 +5764,6 @@ async def test_list_regions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = regions.ListRegionsRequest() - assert args[0] == request_msg @@ -6939,7 +6953,6 @@ def test_get_region_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = regions.GetRegionRequest() - assert args[0] == request_msg @@ -6959,7 +6972,6 @@ def test_create_region_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = regions.CreateRegionRequest() - assert args[0] == request_msg @@ -6981,7 +6993,6 @@ def test_batch_create_regions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = regions.BatchCreateRegionsRequest() - assert args[0] == request_msg @@ -7001,7 +7012,6 @@ def test_update_region_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = regions.UpdateRegionRequest() - assert args[0] == request_msg @@ -7023,7 +7033,6 @@ def test_batch_update_regions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = regions.BatchUpdateRegionsRequest() - assert args[0] == request_msg @@ -7043,7 +7052,6 @@ def test_delete_region_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = regions.DeleteRegionRequest() - assert args[0] == request_msg @@ -7065,7 +7073,6 @@ def test_batch_delete_regions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = regions.BatchDeleteRegionsRequest() - assert args[0] == request_msg @@ -7085,7 +7092,6 @@ def test_list_regions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = regions.ListRegionsRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_shipping_settings_service.py b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_shipping_settings_service.py index 4d225ed7c91b..8c7ac33d5d0f 100644 --- a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_shipping_settings_service.py +++ b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_shipping_settings_service.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 @@ -107,6 +108,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" @@ -1376,8 +1392,8 @@ def test_shipping_settings_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - shippingsettings.GetShippingSettingsRequest, - dict, + shippingsettings.GetShippingSettingsRequest(), + {}, ], ) def test_get_shipping_settings(request_type, transport: str = "grpc"): @@ -1388,7 +1404,7 @@ def test_get_shipping_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( @@ -1438,9 +1454,10 @@ def test_get_shipping_settings_non_empty_request_with_auto_populated_field(): client.get_shipping_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == shippingsettings.GetShippingSettingsRequest( + request_msg = shippingsettings.GetShippingSettingsRequest( name="name_value", ) + assert args[0] == request_msg def test_get_shipping_settings_use_cached_wrapped_rpc(): @@ -1526,9 +1543,15 @@ async def test_get_shipping_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + shippingsettings.GetShippingSettingsRequest(), + {}, + ], +) async def test_get_shipping_settings_async( - transport: str = "grpc_asyncio", - request_type=shippingsettings.GetShippingSettingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = ShippingSettingsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1537,7 +1560,7 @@ async def test_get_shipping_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( @@ -1564,11 +1587,6 @@ async def test_get_shipping_settings_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_shipping_settings_async_from_dict(): - await test_get_shipping_settings_async(request_type=dict) - - def test_get_shipping_settings_field_headers(): client = ShippingSettingsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1723,8 +1741,8 @@ async def test_get_shipping_settings_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - shippingsettings.InsertShippingSettingsRequest, - dict, + shippingsettings.InsertShippingSettingsRequest(), + {}, ], ) def test_insert_shipping_settings(request_type, transport: str = "grpc"): @@ -1735,7 +1753,7 @@ def test_insert_shipping_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( @@ -1785,9 +1803,10 @@ def test_insert_shipping_settings_non_empty_request_with_auto_populated_field(): client.insert_shipping_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == shippingsettings.InsertShippingSettingsRequest( + request_msg = shippingsettings.InsertShippingSettingsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_insert_shipping_settings_use_cached_wrapped_rpc(): @@ -1873,9 +1892,15 @@ async def test_insert_shipping_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + shippingsettings.InsertShippingSettingsRequest(), + {}, + ], +) async def test_insert_shipping_settings_async( - transport: str = "grpc_asyncio", - request_type=shippingsettings.InsertShippingSettingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = ShippingSettingsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1884,7 +1909,7 @@ async def test_insert_shipping_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( @@ -1911,11 +1936,6 @@ async def test_insert_shipping_settings_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_insert_shipping_settings_async_from_dict(): - await test_insert_shipping_settings_async(request_type=dict) - - def test_insert_shipping_settings_field_headers(): client = ShippingSettingsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2423,7 +2443,6 @@ def test_get_shipping_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = shippingsettings.GetShippingSettingsRequest() - assert args[0] == request_msg @@ -2446,7 +2465,6 @@ def test_insert_shipping_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = shippingsettings.InsertShippingSettingsRequest() - assert args[0] == request_msg @@ -2490,7 +2508,6 @@ async def test_get_shipping_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = shippingsettings.GetShippingSettingsRequest() - assert args[0] == request_msg @@ -2520,7 +2537,6 @@ async def test_insert_shipping_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = shippingsettings.InsertShippingSettingsRequest() - assert args[0] == request_msg @@ -3047,7 +3063,6 @@ def test_get_shipping_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = shippingsettings.GetShippingSettingsRequest() - assert args[0] == request_msg @@ -3069,7 +3084,6 @@ def test_insert_shipping_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = shippingsettings.InsertShippingSettingsRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_terms_of_service_agreement_state_service.py b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_terms_of_service_agreement_state_service.py index 506e0294c0a5..039b926d4aff 100644 --- a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_terms_of_service_agreement_state_service.py +++ b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_terms_of_service_agreement_state_service.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 @@ -109,6 +110,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" @@ -1453,8 +1469,8 @@ def test_terms_of_service_agreement_state_service_client_create_channel_credenti @pytest.mark.parametrize( "request_type", [ - termsofserviceagreementstate.GetTermsOfServiceAgreementStateRequest, - dict, + termsofserviceagreementstate.GetTermsOfServiceAgreementStateRequest(), + {}, ], ) def test_get_terms_of_service_agreement_state(request_type, transport: str = "grpc"): @@ -1465,7 +1481,7 @@ def test_get_terms_of_service_agreement_state(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( @@ -1522,11 +1538,12 @@ def test_get_terms_of_service_agreement_state_non_empty_request_with_auto_popula client.get_terms_of_service_agreement_state(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == termsofserviceagreementstate.GetTermsOfServiceAgreementStateRequest( - name="name_value", + request_msg = ( + termsofserviceagreementstate.GetTermsOfServiceAgreementStateRequest( + name="name_value", + ) ) + assert args[0] == request_msg def test_get_terms_of_service_agreement_state_use_cached_wrapped_rpc(): @@ -1612,9 +1629,15 @@ async def test_get_terms_of_service_agreement_state_async_use_cached_wrapped_rpc @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + termsofserviceagreementstate.GetTermsOfServiceAgreementStateRequest(), + {}, + ], +) async def test_get_terms_of_service_agreement_state_async( - transport: str = "grpc_asyncio", - request_type=termsofserviceagreementstate.GetTermsOfServiceAgreementStateRequest, + request_type, transport: str = "grpc_asyncio" ): client = TermsOfServiceAgreementStateServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1623,7 +1646,7 @@ async def test_get_terms_of_service_agreement_state_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( @@ -1657,11 +1680,6 @@ async def test_get_terms_of_service_agreement_state_async( ) -@pytest.mark.asyncio -async def test_get_terms_of_service_agreement_state_async_from_dict(): - await test_get_terms_of_service_agreement_state_async(request_type=dict) - - def test_get_terms_of_service_agreement_state_field_headers(): client = TermsOfServiceAgreementStateServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1816,8 +1834,8 @@ async def test_get_terms_of_service_agreement_state_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - termsofserviceagreementstate.RetrieveForApplicationTermsOfServiceAgreementStateRequest, - dict, + termsofserviceagreementstate.RetrieveForApplicationTermsOfServiceAgreementStateRequest(), + {}, ], ) def test_retrieve_for_application_terms_of_service_agreement_state( @@ -1830,7 +1848,7 @@ def test_retrieve_for_application_terms_of_service_agreement_state( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1897,12 +1915,10 @@ def test_retrieve_for_application_terms_of_service_agreement_state_non_empty_req ) call.assert_called() _, args, _ = call.mock_calls[0] - assert ( - args[0] - == termsofserviceagreementstate.RetrieveForApplicationTermsOfServiceAgreementStateRequest( - parent="parent_value", - ) + request_msg = termsofserviceagreementstate.RetrieveForApplicationTermsOfServiceAgreementStateRequest( + parent="parent_value", ) + assert args[0] == request_msg def test_retrieve_for_application_terms_of_service_agreement_state_use_cached_wrapped_rpc(): @@ -1988,9 +2004,15 @@ async def test_retrieve_for_application_terms_of_service_agreement_state_async_u @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + termsofserviceagreementstate.RetrieveForApplicationTermsOfServiceAgreementStateRequest(), + {}, + ], +) async def test_retrieve_for_application_terms_of_service_agreement_state_async( - transport: str = "grpc_asyncio", - request_type=termsofserviceagreementstate.RetrieveForApplicationTermsOfServiceAgreementStateRequest, + request_type, transport: str = "grpc_asyncio" ): client = TermsOfServiceAgreementStateServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1999,7 +2021,7 @@ async def test_retrieve_for_application_terms_of_service_agreement_state_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( @@ -2040,13 +2062,6 @@ async def test_retrieve_for_application_terms_of_service_agreement_state_async( ) -@pytest.mark.asyncio -async def test_retrieve_for_application_terms_of_service_agreement_state_async_from_dict(): - await test_retrieve_for_application_terms_of_service_agreement_state_async( - request_type=dict - ) - - def test_retrieve_for_application_terms_of_service_agreement_state_field_headers(): client = TermsOfServiceAgreementStateServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2729,7 +2744,6 @@ def test_get_terms_of_service_agreement_state_empty_call_grpc(): request_msg = ( termsofserviceagreementstate.GetTermsOfServiceAgreementStateRequest() ) - assert args[0] == request_msg @@ -2755,7 +2769,6 @@ def test_retrieve_for_application_terms_of_service_agreement_state_empty_call_gr call.assert_called() _, args, _ = call.mock_calls[0] request_msg = termsofserviceagreementstate.RetrieveForApplicationTermsOfServiceAgreementStateRequest() - assert args[0] == request_msg @@ -2802,7 +2815,6 @@ async def test_get_terms_of_service_agreement_state_empty_call_grpc_asyncio(): request_msg = ( termsofserviceagreementstate.GetTermsOfServiceAgreementStateRequest() ) - assert args[0] == request_msg @@ -2838,7 +2850,6 @@ async def test_retrieve_for_application_terms_of_service_agreement_state_empty_c call.assert_called() _, args, _ = call.mock_calls[0] request_msg = termsofserviceagreementstate.RetrieveForApplicationTermsOfServiceAgreementStateRequest() - assert args[0] == request_msg @@ -3186,7 +3197,6 @@ def test_get_terms_of_service_agreement_state_empty_call_rest(): request_msg = ( termsofserviceagreementstate.GetTermsOfServiceAgreementStateRequest() ) - assert args[0] == request_msg @@ -3211,7 +3221,6 @@ def test_retrieve_for_application_terms_of_service_agreement_state_empty_call_re call.assert_called() _, args, _ = call.mock_calls[0] request_msg = termsofserviceagreementstate.RetrieveForApplicationTermsOfServiceAgreementStateRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_terms_of_service_service.py b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_terms_of_service_service.py index 8d12444b6867..9061d64d4bf9 100644 --- a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_terms_of_service_service.py +++ b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_terms_of_service_service.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 @@ -110,6 +111,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" @@ -1377,8 +1393,8 @@ def test_terms_of_service_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - termsofservice.GetTermsOfServiceRequest, - dict, + termsofservice.GetTermsOfServiceRequest(), + {}, ], ) def test_get_terms_of_service(request_type, transport: str = "grpc"): @@ -1389,7 +1405,7 @@ def test_get_terms_of_service(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1445,9 +1461,10 @@ def test_get_terms_of_service_non_empty_request_with_auto_populated_field(): client.get_terms_of_service(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == termsofservice.GetTermsOfServiceRequest( + request_msg = termsofservice.GetTermsOfServiceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_terms_of_service_use_cached_wrapped_rpc(): @@ -1532,9 +1549,15 @@ async def test_get_terms_of_service_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + termsofservice.GetTermsOfServiceRequest(), + {}, + ], +) async def test_get_terms_of_service_async( - transport: str = "grpc_asyncio", - request_type=termsofservice.GetTermsOfServiceRequest, + request_type, transport: str = "grpc_asyncio" ): client = TermsOfServiceServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1543,7 +1566,7 @@ async def test_get_terms_of_service_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( @@ -1576,11 +1599,6 @@ async def test_get_terms_of_service_async( assert response.external is True -@pytest.mark.asyncio -async def test_get_terms_of_service_async_from_dict(): - await test_get_terms_of_service_async(request_type=dict) - - def test_get_terms_of_service_field_headers(): client = TermsOfServiceServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1735,8 +1753,8 @@ async def test_get_terms_of_service_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - termsofservice.RetrieveLatestTermsOfServiceRequest, - dict, + termsofservice.RetrieveLatestTermsOfServiceRequest(), + {}, ], ) def test_retrieve_latest_terms_of_service(request_type, transport: str = "grpc"): @@ -1747,7 +1765,7 @@ def test_retrieve_latest_terms_of_service(request_type, transport: str = "grpc") # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1803,9 +1821,10 @@ def test_retrieve_latest_terms_of_service_non_empty_request_with_auto_populated_ client.retrieve_latest_terms_of_service(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == termsofservice.RetrieveLatestTermsOfServiceRequest( + request_msg = termsofservice.RetrieveLatestTermsOfServiceRequest( region_code="region_code_value", ) + assert args[0] == request_msg def test_retrieve_latest_terms_of_service_use_cached_wrapped_rpc(): @@ -1891,9 +1910,15 @@ async def test_retrieve_latest_terms_of_service_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + termsofservice.RetrieveLatestTermsOfServiceRequest(), + {}, + ], +) async def test_retrieve_latest_terms_of_service_async( - transport: str = "grpc_asyncio", - request_type=termsofservice.RetrieveLatestTermsOfServiceRequest, + request_type, transport: str = "grpc_asyncio" ): client = TermsOfServiceServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1902,7 +1927,7 @@ async def test_retrieve_latest_terms_of_service_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( @@ -1935,16 +1960,11 @@ async def test_retrieve_latest_terms_of_service_async( assert response.external is True -@pytest.mark.asyncio -async def test_retrieve_latest_terms_of_service_async_from_dict(): - await test_retrieve_latest_terms_of_service_async(request_type=dict) - - @pytest.mark.parametrize( "request_type", [ - termsofservice.AcceptTermsOfServiceRequest, - dict, + termsofservice.AcceptTermsOfServiceRequest(), + {}, ], ) def test_accept_terms_of_service(request_type, transport: str = "grpc"): @@ -1955,7 +1975,7 @@ def test_accept_terms_of_service(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2002,11 +2022,12 @@ def test_accept_terms_of_service_non_empty_request_with_auto_populated_field(): client.accept_terms_of_service(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == termsofservice.AcceptTermsOfServiceRequest( + request_msg = termsofservice.AcceptTermsOfServiceRequest( name="name_value", account="account_value", region_code="region_code_value", ) + assert args[0] == request_msg def test_accept_terms_of_service_use_cached_wrapped_rpc(): @@ -2092,9 +2113,15 @@ async def test_accept_terms_of_service_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + termsofservice.AcceptTermsOfServiceRequest(), + {}, + ], +) async def test_accept_terms_of_service_async( - transport: str = "grpc_asyncio", - request_type=termsofservice.AcceptTermsOfServiceRequest, + request_type, transport: str = "grpc_asyncio" ): client = TermsOfServiceServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2103,7 +2130,7 @@ async def test_accept_terms_of_service_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( @@ -2125,11 +2152,6 @@ async def test_accept_terms_of_service_async( assert isinstance(response, termsofservice.AcceptTermsOfServiceResponse) -@pytest.mark.asyncio -async def test_accept_terms_of_service_async_from_dict(): - await test_accept_terms_of_service_async(request_type=dict) - - def test_accept_terms_of_service_field_headers(): client = TermsOfServiceServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2969,7 +2991,6 @@ def test_get_terms_of_service_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = termsofservice.GetTermsOfServiceRequest() - assert args[0] == request_msg @@ -2992,7 +3013,6 @@ def test_retrieve_latest_terms_of_service_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = termsofservice.RetrieveLatestTermsOfServiceRequest() - assert args[0] == request_msg @@ -3015,7 +3035,6 @@ def test_accept_terms_of_service_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = termsofservice.AcceptTermsOfServiceRequest() - assert args[0] == request_msg @@ -3062,7 +3081,6 @@ async def test_get_terms_of_service_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = termsofservice.GetTermsOfServiceRequest() - assert args[0] == request_msg @@ -3095,7 +3113,6 @@ async def test_retrieve_latest_terms_of_service_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = termsofservice.RetrieveLatestTermsOfServiceRequest() - assert args[0] == request_msg @@ -3122,7 +3139,6 @@ async def test_accept_terms_of_service_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = termsofservice.AcceptTermsOfServiceRequest() - assert args[0] == request_msg @@ -3577,7 +3593,6 @@ def test_get_terms_of_service_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = termsofservice.GetTermsOfServiceRequest() - assert args[0] == request_msg @@ -3599,7 +3614,6 @@ def test_retrieve_latest_terms_of_service_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = termsofservice.RetrieveLatestTermsOfServiceRequest() - assert args[0] == request_msg @@ -3621,7 +3635,6 @@ def test_accept_terms_of_service_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = termsofservice.AcceptTermsOfServiceRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_user_service.py b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_user_service.py index 11e24fc7b096..99866b3bf20b 100644 --- a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_user_service.py +++ b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1/test_user_service.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 @@ -109,6 +110,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" @@ -1274,8 +1290,8 @@ def test_user_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - user.GetUserRequest, - dict, + user.GetUserRequest(), + {}, ], ) def test_get_user(request_type, transport: str = "grpc"): @@ -1286,7 +1302,7 @@ def test_get_user(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_user), "__call__") as call: @@ -1334,9 +1350,10 @@ def test_get_user_non_empty_request_with_auto_populated_field(): client.get_user(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == user.GetUserRequest( + request_msg = user.GetUserRequest( name="name_value", ) + assert args[0] == request_msg def test_get_user_use_cached_wrapped_rpc(): @@ -1415,9 +1432,14 @@ async def test_get_user_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn @pytest.mark.asyncio -async def test_get_user_async( - transport: str = "grpc_asyncio", request_type=user.GetUserRequest -): +@pytest.mark.parametrize( + "request_type", + [ + user.GetUserRequest(), + {}, + ], +) +async def test_get_user_async(request_type, transport: str = "grpc_asyncio"): client = UserServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1425,7 +1447,7 @@ async def test_get_user_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_user), "__call__") as call: @@ -1452,11 +1474,6 @@ async def test_get_user_async( assert response.access_rights == [accessright.AccessRight.STANDARD] -@pytest.mark.asyncio -async def test_get_user_async_from_dict(): - await test_get_user_async(request_type=dict) - - def test_get_user_field_headers(): client = UserServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1599,8 +1616,8 @@ async def test_get_user_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gsma_user.CreateUserRequest, - dict, + gsma_user.CreateUserRequest(), + {}, ], ) def test_create_user(request_type, transport: str = "grpc"): @@ -1611,7 +1628,7 @@ def test_create_user(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_user), "__call__") as call: @@ -1660,10 +1677,11 @@ def test_create_user_non_empty_request_with_auto_populated_field(): client.create_user(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gsma_user.CreateUserRequest( + request_msg = gsma_user.CreateUserRequest( parent="parent_value", user_id="user_id_value", ) + assert args[0] == request_msg def test_create_user_use_cached_wrapped_rpc(): @@ -1744,9 +1762,14 @@ async def test_create_user_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_user_async( - transport: str = "grpc_asyncio", request_type=gsma_user.CreateUserRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gsma_user.CreateUserRequest(), + {}, + ], +) +async def test_create_user_async(request_type, transport: str = "grpc_asyncio"): client = UserServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1754,7 +1777,7 @@ async def test_create_user_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_user), "__call__") as call: @@ -1781,11 +1804,6 @@ async def test_create_user_async( assert response.access_rights == [accessright.AccessRight.STANDARD] -@pytest.mark.asyncio -async def test_create_user_async_from_dict(): - await test_create_user_async(request_type=dict) - - def test_create_user_field_headers(): client = UserServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1948,8 +1966,8 @@ async def test_create_user_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - user.DeleteUserRequest, - dict, + user.DeleteUserRequest(), + {}, ], ) def test_delete_user(request_type, transport: str = "grpc"): @@ -1960,7 +1978,7 @@ def test_delete_user(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_user), "__call__") as call: @@ -2001,9 +2019,10 @@ def test_delete_user_non_empty_request_with_auto_populated_field(): client.delete_user(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == user.DeleteUserRequest( + request_msg = user.DeleteUserRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_user_use_cached_wrapped_rpc(): @@ -2084,9 +2103,14 @@ async def test_delete_user_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_user_async( - transport: str = "grpc_asyncio", request_type=user.DeleteUserRequest -): +@pytest.mark.parametrize( + "request_type", + [ + user.DeleteUserRequest(), + {}, + ], +) +async def test_delete_user_async(request_type, transport: str = "grpc_asyncio"): client = UserServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2094,7 +2118,7 @@ async def test_delete_user_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_user), "__call__") as call: @@ -2112,11 +2136,6 @@ async def test_delete_user_async( assert response is None -@pytest.mark.asyncio -async def test_delete_user_async_from_dict(): - await test_delete_user_async(request_type=dict) - - def test_delete_user_field_headers(): client = UserServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2259,8 +2278,8 @@ async def test_delete_user_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gsma_user.UpdateUserRequest, - dict, + gsma_user.UpdateUserRequest(), + {}, ], ) def test_update_user(request_type, transport: str = "grpc"): @@ -2271,7 +2290,7 @@ def test_update_user(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_user), "__call__") as call: @@ -2317,7 +2336,8 @@ def test_update_user_non_empty_request_with_auto_populated_field(): client.update_user(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gsma_user.UpdateUserRequest() + request_msg = gsma_user.UpdateUserRequest() + assert args[0] == request_msg def test_update_user_use_cached_wrapped_rpc(): @@ -2398,9 +2418,14 @@ async def test_update_user_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_user_async( - transport: str = "grpc_asyncio", request_type=gsma_user.UpdateUserRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gsma_user.UpdateUserRequest(), + {}, + ], +) +async def test_update_user_async(request_type, transport: str = "grpc_asyncio"): client = UserServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2408,7 +2433,7 @@ async def test_update_user_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_user), "__call__") as call: @@ -2435,11 +2460,6 @@ async def test_update_user_async( assert response.access_rights == [accessright.AccessRight.STANDARD] -@pytest.mark.asyncio -async def test_update_user_async_from_dict(): - await test_update_user_async(request_type=dict) - - def test_update_user_field_headers(): client = UserServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2592,8 +2612,8 @@ async def test_update_user_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - user.ListUsersRequest, - dict, + user.ListUsersRequest(), + {}, ], ) def test_list_users(request_type, transport: str = "grpc"): @@ -2604,7 +2624,7 @@ def test_list_users(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_users), "__call__") as call: @@ -2649,10 +2669,11 @@ def test_list_users_non_empty_request_with_auto_populated_field(): client.list_users(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == user.ListUsersRequest( + request_msg = user.ListUsersRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_users_use_cached_wrapped_rpc(): @@ -2731,9 +2752,14 @@ async def test_list_users_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_list_users_async( - transport: str = "grpc_asyncio", request_type=user.ListUsersRequest -): +@pytest.mark.parametrize( + "request_type", + [ + user.ListUsersRequest(), + {}, + ], +) +async def test_list_users_async(request_type, transport: str = "grpc_asyncio"): client = UserServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2741,7 +2767,7 @@ async def test_list_users_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_users), "__call__") as call: @@ -2764,11 +2790,6 @@ async def test_list_users_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_users_async_from_dict(): - await test_list_users_async(request_type=dict) - - def test_list_users_field_headers(): client = UserServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3105,8 +3126,8 @@ async def test_list_users_async_pages(): @pytest.mark.parametrize( "request_type", [ - user.VerifySelfRequest, - dict, + user.VerifySelfRequest(), + {}, ], ) def test_verify_self(request_type, transport: str = "grpc"): @@ -3117,7 +3138,7 @@ def test_verify_self(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.verify_self), "__call__") as call: @@ -3165,9 +3186,10 @@ def test_verify_self_non_empty_request_with_auto_populated_field(): client.verify_self(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == user.VerifySelfRequest( + request_msg = user.VerifySelfRequest( account="account_value", ) + assert args[0] == request_msg def test_verify_self_use_cached_wrapped_rpc(): @@ -3248,9 +3270,14 @@ async def test_verify_self_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_verify_self_async( - transport: str = "grpc_asyncio", request_type=user.VerifySelfRequest -): +@pytest.mark.parametrize( + "request_type", + [ + user.VerifySelfRequest(), + {}, + ], +) +async def test_verify_self_async(request_type, transport: str = "grpc_asyncio"): client = UserServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3258,7 +3285,7 @@ async def test_verify_self_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.verify_self), "__call__") as call: @@ -3285,11 +3312,6 @@ async def test_verify_self_async( assert response.access_rights == [accessright.AccessRight.STANDARD] -@pytest.mark.asyncio -async def test_verify_self_async_from_dict(): - await test_verify_self_async(request_type=dict) - - def test_verify_self_field_headers(): client = UserServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4699,7 +4721,6 @@ def test_get_user_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user.GetUserRequest() - assert args[0] == request_msg @@ -4720,7 +4741,6 @@ def test_create_user_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gsma_user.CreateUserRequest() - assert args[0] == request_msg @@ -4741,7 +4761,6 @@ def test_delete_user_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user.DeleteUserRequest() - assert args[0] == request_msg @@ -4762,7 +4781,6 @@ def test_update_user_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gsma_user.UpdateUserRequest() - assert args[0] == request_msg @@ -4783,7 +4801,6 @@ def test_list_users_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user.ListUsersRequest() - assert args[0] == request_msg @@ -4804,7 +4821,6 @@ def test_verify_self_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user.VerifySelfRequest() - assert args[0] == request_msg @@ -4847,7 +4863,6 @@ async def test_get_user_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user.GetUserRequest() - assert args[0] == request_msg @@ -4876,7 +4891,6 @@ async def test_create_user_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gsma_user.CreateUserRequest() - assert args[0] == request_msg @@ -4899,7 +4913,6 @@ async def test_delete_user_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user.DeleteUserRequest() - assert args[0] == request_msg @@ -4928,7 +4941,6 @@ async def test_update_user_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gsma_user.UpdateUserRequest() - assert args[0] == request_msg @@ -4955,7 +4967,6 @@ async def test_list_users_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user.ListUsersRequest() - assert args[0] == request_msg @@ -4984,7 +4995,6 @@ async def test_verify_self_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user.VerifySelfRequest() - assert args[0] == request_msg @@ -5908,7 +5918,6 @@ def test_get_user_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user.GetUserRequest() - assert args[0] == request_msg @@ -5928,7 +5937,6 @@ def test_create_user_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gsma_user.CreateUserRequest() - assert args[0] == request_msg @@ -5948,7 +5956,6 @@ def test_delete_user_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user.DeleteUserRequest() - assert args[0] == request_msg @@ -5968,7 +5975,6 @@ def test_update_user_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gsma_user.UpdateUserRequest() - assert args[0] == request_msg @@ -5988,7 +5994,6 @@ def test_list_users_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user.ListUsersRequest() - assert args[0] == request_msg @@ -6008,7 +6013,6 @@ def test_verify_self_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user.VerifySelfRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_account_issue_service.py b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_account_issue_service.py index 2d53b734caea..c5cf23606348 100644 --- a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_account_issue_service.py +++ b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_account_issue_service.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 @@ -107,6 +108,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" @@ -1370,8 +1386,8 @@ def test_account_issue_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - accountissue.ListAccountIssuesRequest, - dict, + accountissue.ListAccountIssuesRequest(), + {}, ], ) def test_list_account_issues(request_type, transport: str = "grpc"): @@ -1382,7 +1398,7 @@ def test_list_account_issues(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1433,12 +1449,13 @@ def test_list_account_issues_non_empty_request_with_auto_populated_field(): client.list_account_issues(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == accountissue.ListAccountIssuesRequest( + request_msg = accountissue.ListAccountIssuesRequest( parent="parent_value", page_token="page_token_value", language_code="language_code_value", time_zone="time_zone_value", ) + assert args[0] == request_msg def test_list_account_issues_use_cached_wrapped_rpc(): @@ -1523,9 +1540,14 @@ async def test_list_account_issues_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_account_issues_async( - transport: str = "grpc_asyncio", request_type=accountissue.ListAccountIssuesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + accountissue.ListAccountIssuesRequest(), + {}, + ], +) +async def test_list_account_issues_async(request_type, transport: str = "grpc_asyncio"): client = AccountIssueServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1533,7 +1555,7 @@ async def test_list_account_issues_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( @@ -1558,11 +1580,6 @@ async def test_list_account_issues_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_account_issues_async_from_dict(): - await test_list_account_issues_async(request_type=dict) - - def test_list_account_issues_field_headers(): client = AccountIssueServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2300,7 +2317,6 @@ def test_list_account_issues_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accountissue.ListAccountIssuesRequest() - assert args[0] == request_msg @@ -2343,7 +2359,6 @@ async def test_list_account_issues_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accountissue.ListAccountIssuesRequest() - assert args[0] == request_msg @@ -2515,7 +2530,6 @@ def test_list_account_issues_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accountissue.ListAccountIssuesRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_account_tax_service.py b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_account_tax_service.py index 5c60c2375c56..5fa8d6810c32 100644 --- a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_account_tax_service.py +++ b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_account_tax_service.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 @@ -113,6 +114,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" @@ -1354,8 +1370,8 @@ def test_account_tax_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - account_tax.GetAccountTaxRequest, - dict, + account_tax.GetAccountTaxRequest(), + {}, ], ) def test_get_account_tax(request_type, transport: str = "grpc"): @@ -1366,7 +1382,7 @@ def test_get_account_tax(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_account_tax), "__call__") as call: @@ -1412,9 +1428,10 @@ def test_get_account_tax_non_empty_request_with_auto_populated_field(): client.get_account_tax(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == account_tax.GetAccountTaxRequest( + request_msg = account_tax.GetAccountTaxRequest( name="name_value", ) + assert args[0] == request_msg def test_get_account_tax_use_cached_wrapped_rpc(): @@ -1495,9 +1512,14 @@ async def test_get_account_tax_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_account_tax_async( - transport: str = "grpc_asyncio", request_type=account_tax.GetAccountTaxRequest -): +@pytest.mark.parametrize( + "request_type", + [ + account_tax.GetAccountTaxRequest(), + {}, + ], +) +async def test_get_account_tax_async(request_type, transport: str = "grpc_asyncio"): client = AccountTaxServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1505,7 +1527,7 @@ async def test_get_account_tax_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_account_tax), "__call__") as call: @@ -1530,11 +1552,6 @@ async def test_get_account_tax_async( assert response.account == 749 -@pytest.mark.asyncio -async def test_get_account_tax_async_from_dict(): - await test_get_account_tax_async(request_type=dict) - - def test_get_account_tax_field_headers(): client = AccountTaxServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1681,8 +1698,8 @@ async def test_get_account_tax_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - account_tax.ListAccountTaxRequest, - dict, + account_tax.ListAccountTaxRequest(), + {}, ], ) def test_list_account_tax(request_type, transport: str = "grpc"): @@ -1693,7 +1710,7 @@ def test_list_account_tax(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_account_tax), "__call__") as call: @@ -1738,10 +1755,11 @@ def test_list_account_tax_non_empty_request_with_auto_populated_field(): client.list_account_tax(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == account_tax.ListAccountTaxRequest( + request_msg = account_tax.ListAccountTaxRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_account_tax_use_cached_wrapped_rpc(): @@ -1824,9 +1842,14 @@ async def test_list_account_tax_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_account_tax_async( - transport: str = "grpc_asyncio", request_type=account_tax.ListAccountTaxRequest -): +@pytest.mark.parametrize( + "request_type", + [ + account_tax.ListAccountTaxRequest(), + {}, + ], +) +async def test_list_account_tax_async(request_type, transport: str = "grpc_asyncio"): client = AccountTaxServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1834,7 +1857,7 @@ async def test_list_account_tax_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_account_tax), "__call__") as call: @@ -1857,11 +1880,6 @@ async def test_list_account_tax_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_account_tax_async_from_dict(): - await test_list_account_tax_async(request_type=dict) - - def test_list_account_tax_field_headers(): client = AccountTaxServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2198,8 +2216,8 @@ async def test_list_account_tax_async_pages(): @pytest.mark.parametrize( "request_type", [ - gsma_account_tax.UpdateAccountTaxRequest, - dict, + gsma_account_tax.UpdateAccountTaxRequest(), + {}, ], ) def test_update_account_tax(request_type, transport: str = "grpc"): @@ -2210,7 +2228,7 @@ def test_update_account_tax(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2258,7 +2276,8 @@ def test_update_account_tax_non_empty_request_with_auto_populated_field(): client.update_account_tax(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gsma_account_tax.UpdateAccountTaxRequest() + request_msg = gsma_account_tax.UpdateAccountTaxRequest() + assert args[0] == request_msg def test_update_account_tax_use_cached_wrapped_rpc(): @@ -2343,10 +2362,14 @@ async def test_update_account_tax_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_account_tax_async( - transport: str = "grpc_asyncio", - request_type=gsma_account_tax.UpdateAccountTaxRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + gsma_account_tax.UpdateAccountTaxRequest(), + {}, + ], +) +async def test_update_account_tax_async(request_type, transport: str = "grpc_asyncio"): client = AccountTaxServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2354,7 +2377,7 @@ async def test_update_account_tax_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( @@ -2381,11 +2404,6 @@ async def test_update_account_tax_async( assert response.account == 749 -@pytest.mark.asyncio -async def test_update_account_tax_async_from_dict(): - await test_update_account_tax_async(request_type=dict) - - def test_update_account_tax_field_headers(): client = AccountTaxServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3290,7 +3308,6 @@ def test_get_account_tax_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = account_tax.GetAccountTaxRequest() - assert args[0] == request_msg @@ -3311,7 +3328,6 @@ def test_list_account_tax_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = account_tax.ListAccountTaxRequest() - assert args[0] == request_msg @@ -3334,7 +3350,6 @@ def test_update_account_tax_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gsma_account_tax.UpdateAccountTaxRequest() - assert args[0] == request_msg @@ -3376,7 +3391,6 @@ async def test_get_account_tax_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = account_tax.GetAccountTaxRequest() - assert args[0] == request_msg @@ -3403,7 +3417,6 @@ async def test_list_account_tax_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = account_tax.ListAccountTaxRequest() - assert args[0] == request_msg @@ -3433,7 +3446,6 @@ async def test_update_account_tax_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gsma_account_tax.UpdateAccountTaxRequest() - assert args[0] == request_msg @@ -3953,7 +3965,6 @@ def test_get_account_tax_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = account_tax.GetAccountTaxRequest() - assert args[0] == request_msg @@ -3973,7 +3984,6 @@ def test_list_account_tax_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = account_tax.ListAccountTaxRequest() - assert args[0] == request_msg @@ -3995,7 +4005,6 @@ def test_update_account_tax_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gsma_account_tax.UpdateAccountTaxRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_accounts_service.py b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_accounts_service.py index 6e19177dd601..5f3cab763ec5 100644 --- a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_accounts_service.py +++ b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_accounts_service.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 @@ -114,6 +115,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" @@ -1341,8 +1357,8 @@ def test_accounts_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - accounts.GetAccountRequest, - dict, + accounts.GetAccountRequest(), + {}, ], ) def test_get_account(request_type, transport: str = "grpc"): @@ -1353,7 +1369,7 @@ def test_get_account(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_account), "__call__") as call: @@ -1407,9 +1423,10 @@ def test_get_account_non_empty_request_with_auto_populated_field(): client.get_account(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == accounts.GetAccountRequest( + request_msg = accounts.GetAccountRequest( name="name_value", ) + assert args[0] == request_msg def test_get_account_use_cached_wrapped_rpc(): @@ -1490,9 +1507,14 @@ async def test_get_account_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_account_async( - transport: str = "grpc_asyncio", request_type=accounts.GetAccountRequest -): +@pytest.mark.parametrize( + "request_type", + [ + accounts.GetAccountRequest(), + {}, + ], +) +async def test_get_account_async(request_type, transport: str = "grpc_asyncio"): client = AccountsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1500,7 +1522,7 @@ async def test_get_account_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_account), "__call__") as call: @@ -1533,11 +1555,6 @@ async def test_get_account_async( assert response.language_code == "language_code_value" -@pytest.mark.asyncio -async def test_get_account_async_from_dict(): - await test_get_account_async(request_type=dict) - - def test_get_account_field_headers(): client = AccountsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1680,8 +1697,8 @@ async def test_get_account_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - accounts.CreateAndConfigureAccountRequest, - dict, + accounts.CreateAndConfigureAccountRequest(), + {}, ], ) def test_create_and_configure_account(request_type, transport: str = "grpc"): @@ -1692,7 +1709,7 @@ def test_create_and_configure_account(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1748,7 +1765,8 @@ def test_create_and_configure_account_non_empty_request_with_auto_populated_fiel client.create_and_configure_account(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == accounts.CreateAndConfigureAccountRequest() + request_msg = accounts.CreateAndConfigureAccountRequest() + assert args[0] == request_msg def test_create_and_configure_account_use_cached_wrapped_rpc(): @@ -1834,9 +1852,15 @@ async def test_create_and_configure_account_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + accounts.CreateAndConfigureAccountRequest(), + {}, + ], +) async def test_create_and_configure_account_async( - transport: str = "grpc_asyncio", - request_type=accounts.CreateAndConfigureAccountRequest, + request_type, transport: str = "grpc_asyncio" ): client = AccountsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1845,7 +1869,7 @@ async def test_create_and_configure_account_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( @@ -1880,16 +1904,11 @@ async def test_create_and_configure_account_async( assert response.language_code == "language_code_value" -@pytest.mark.asyncio -async def test_create_and_configure_account_async_from_dict(): - await test_create_and_configure_account_async(request_type=dict) - - @pytest.mark.parametrize( "request_type", [ - accounts.DeleteAccountRequest, - dict, + accounts.DeleteAccountRequest(), + {}, ], ) def test_delete_account(request_type, transport: str = "grpc"): @@ -1900,7 +1919,7 @@ def test_delete_account(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_account), "__call__") as call: @@ -1941,9 +1960,10 @@ def test_delete_account_non_empty_request_with_auto_populated_field(): client.delete_account(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == accounts.DeleteAccountRequest( + request_msg = accounts.DeleteAccountRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_account_use_cached_wrapped_rpc(): @@ -2024,9 +2044,14 @@ async def test_delete_account_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_account_async( - transport: str = "grpc_asyncio", request_type=accounts.DeleteAccountRequest -): +@pytest.mark.parametrize( + "request_type", + [ + accounts.DeleteAccountRequest(), + {}, + ], +) +async def test_delete_account_async(request_type, transport: str = "grpc_asyncio"): client = AccountsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2034,7 +2059,7 @@ async def test_delete_account_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_account), "__call__") as call: @@ -2052,11 +2077,6 @@ async def test_delete_account_async( assert response is None -@pytest.mark.asyncio -async def test_delete_account_async_from_dict(): - await test_delete_account_async(request_type=dict) - - def test_delete_account_field_headers(): client = AccountsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2199,8 +2219,8 @@ async def test_delete_account_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - accounts.UpdateAccountRequest, - dict, + accounts.UpdateAccountRequest(), + {}, ], ) def test_update_account(request_type, transport: str = "grpc"): @@ -2211,7 +2231,7 @@ def test_update_account(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_account), "__call__") as call: @@ -2263,7 +2283,8 @@ def test_update_account_non_empty_request_with_auto_populated_field(): client.update_account(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == accounts.UpdateAccountRequest() + request_msg = accounts.UpdateAccountRequest() + assert args[0] == request_msg def test_update_account_use_cached_wrapped_rpc(): @@ -2344,9 +2365,14 @@ async def test_update_account_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_account_async( - transport: str = "grpc_asyncio", request_type=accounts.UpdateAccountRequest -): +@pytest.mark.parametrize( + "request_type", + [ + accounts.UpdateAccountRequest(), + {}, + ], +) +async def test_update_account_async(request_type, transport: str = "grpc_asyncio"): client = AccountsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2354,7 +2380,7 @@ async def test_update_account_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_account), "__call__") as call: @@ -2387,11 +2413,6 @@ async def test_update_account_async( assert response.language_code == "language_code_value" -@pytest.mark.asyncio -async def test_update_account_async_from_dict(): - await test_update_account_async(request_type=dict) - - def test_update_account_field_headers(): client = AccountsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2544,8 +2565,8 @@ async def test_update_account_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - accounts.ListAccountsRequest, - dict, + accounts.ListAccountsRequest(), + {}, ], ) def test_list_accounts(request_type, transport: str = "grpc"): @@ -2556,7 +2577,7 @@ def test_list_accounts(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_accounts), "__call__") as call: @@ -2601,10 +2622,11 @@ def test_list_accounts_non_empty_request_with_auto_populated_field(): client.list_accounts(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == accounts.ListAccountsRequest( + request_msg = accounts.ListAccountsRequest( page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_accounts_use_cached_wrapped_rpc(): @@ -2685,9 +2707,14 @@ async def test_list_accounts_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_accounts_async( - transport: str = "grpc_asyncio", request_type=accounts.ListAccountsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + accounts.ListAccountsRequest(), + {}, + ], +) +async def test_list_accounts_async(request_type, transport: str = "grpc_asyncio"): client = AccountsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2695,7 +2722,7 @@ async def test_list_accounts_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_accounts), "__call__") as call: @@ -2718,11 +2745,6 @@ async def test_list_accounts_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_accounts_async_from_dict(): - await test_list_accounts_async(request_type=dict) - - def test_list_accounts_pager(transport_name: str = "grpc"): client = AccountsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2913,8 +2935,8 @@ async def test_list_accounts_async_pages(): @pytest.mark.parametrize( "request_type", [ - accounts.ListSubAccountsRequest, - dict, + accounts.ListSubAccountsRequest(), + {}, ], ) def test_list_sub_accounts(request_type, transport: str = "grpc"): @@ -2925,7 +2947,7 @@ def test_list_sub_accounts(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2974,10 +2996,11 @@ def test_list_sub_accounts_non_empty_request_with_auto_populated_field(): client.list_sub_accounts(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == accounts.ListSubAccountsRequest( + request_msg = accounts.ListSubAccountsRequest( provider="provider_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_sub_accounts_use_cached_wrapped_rpc(): @@ -3060,9 +3083,14 @@ async def test_list_sub_accounts_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_sub_accounts_async( - transport: str = "grpc_asyncio", request_type=accounts.ListSubAccountsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + accounts.ListSubAccountsRequest(), + {}, + ], +) +async def test_list_sub_accounts_async(request_type, transport: str = "grpc_asyncio"): client = AccountsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3070,7 +3098,7 @@ async def test_list_sub_accounts_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( @@ -3095,11 +3123,6 @@ async def test_list_sub_accounts_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_sub_accounts_async_from_dict(): - await test_list_sub_accounts_async(request_type=dict) - - def test_list_sub_accounts_field_headers(): client = AccountsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4586,7 +4609,6 @@ def test_get_account_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accounts.GetAccountRequest() - assert args[0] == request_msg @@ -4609,7 +4631,6 @@ def test_create_and_configure_account_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accounts.CreateAndConfigureAccountRequest() - assert args[0] == request_msg @@ -4630,7 +4651,6 @@ def test_delete_account_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accounts.DeleteAccountRequest() - assert args[0] == request_msg @@ -4651,7 +4671,6 @@ def test_update_account_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accounts.UpdateAccountRequest() - assert args[0] == request_msg @@ -4672,7 +4691,6 @@ def test_list_accounts_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accounts.ListAccountsRequest() - assert args[0] == request_msg @@ -4695,7 +4713,6 @@ def test_list_sub_accounts_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accounts.ListSubAccountsRequest() - assert args[0] == request_msg @@ -4741,7 +4758,6 @@ async def test_get_account_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accounts.GetAccountRequest() - assert args[0] == request_msg @@ -4775,7 +4791,6 @@ async def test_create_and_configure_account_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accounts.CreateAndConfigureAccountRequest() - assert args[0] == request_msg @@ -4798,7 +4813,6 @@ async def test_delete_account_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accounts.DeleteAccountRequest() - assert args[0] == request_msg @@ -4830,7 +4844,6 @@ async def test_update_account_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accounts.UpdateAccountRequest() - assert args[0] == request_msg @@ -4857,7 +4870,6 @@ async def test_list_accounts_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accounts.ListAccountsRequest() - assert args[0] == request_msg @@ -4886,7 +4898,6 @@ async def test_list_sub_accounts_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accounts.ListSubAccountsRequest() - assert args[0] == request_msg @@ -5780,7 +5791,6 @@ def test_get_account_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accounts.GetAccountRequest() - assert args[0] == request_msg @@ -5802,7 +5812,6 @@ def test_create_and_configure_account_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accounts.CreateAndConfigureAccountRequest() - assert args[0] == request_msg @@ -5822,7 +5831,6 @@ def test_delete_account_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accounts.DeleteAccountRequest() - assert args[0] == request_msg @@ -5842,7 +5850,6 @@ def test_update_account_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accounts.UpdateAccountRequest() - assert args[0] == request_msg @@ -5862,7 +5869,6 @@ def test_list_accounts_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accounts.ListAccountsRequest() - assert args[0] == request_msg @@ -5884,7 +5890,6 @@ def test_list_sub_accounts_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accounts.ListSubAccountsRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_autofeed_settings_service.py b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_autofeed_settings_service.py index 066b351dbd4a..808939d62de9 100644 --- a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_autofeed_settings_service.py +++ b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_autofeed_settings_service.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 @@ -107,6 +108,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" @@ -1376,8 +1392,8 @@ def test_autofeed_settings_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - autofeedsettings.GetAutofeedSettingsRequest, - dict, + autofeedsettings.GetAutofeedSettingsRequest(), + {}, ], ) def test_get_autofeed_settings(request_type, transport: str = "grpc"): @@ -1388,7 +1404,7 @@ def test_get_autofeed_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( @@ -1440,9 +1456,10 @@ def test_get_autofeed_settings_non_empty_request_with_auto_populated_field(): client.get_autofeed_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == autofeedsettings.GetAutofeedSettingsRequest( + request_msg = autofeedsettings.GetAutofeedSettingsRequest( name="name_value", ) + assert args[0] == request_msg def test_get_autofeed_settings_use_cached_wrapped_rpc(): @@ -1528,9 +1545,15 @@ async def test_get_autofeed_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + autofeedsettings.GetAutofeedSettingsRequest(), + {}, + ], +) async def test_get_autofeed_settings_async( - transport: str = "grpc_asyncio", - request_type=autofeedsettings.GetAutofeedSettingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = AutofeedSettingsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1539,7 +1562,7 @@ async def test_get_autofeed_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( @@ -1568,11 +1591,6 @@ async def test_get_autofeed_settings_async( assert response.eligible is True -@pytest.mark.asyncio -async def test_get_autofeed_settings_async_from_dict(): - await test_get_autofeed_settings_async(request_type=dict) - - def test_get_autofeed_settings_field_headers(): client = AutofeedSettingsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1727,8 +1745,8 @@ async def test_get_autofeed_settings_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - autofeedsettings.UpdateAutofeedSettingsRequest, - dict, + autofeedsettings.UpdateAutofeedSettingsRequest(), + {}, ], ) def test_update_autofeed_settings(request_type, transport: str = "grpc"): @@ -1739,7 +1757,7 @@ def test_update_autofeed_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( @@ -1789,7 +1807,8 @@ def test_update_autofeed_settings_non_empty_request_with_auto_populated_field(): client.update_autofeed_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == autofeedsettings.UpdateAutofeedSettingsRequest() + request_msg = autofeedsettings.UpdateAutofeedSettingsRequest() + assert args[0] == request_msg def test_update_autofeed_settings_use_cached_wrapped_rpc(): @@ -1875,9 +1894,15 @@ async def test_update_autofeed_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + autofeedsettings.UpdateAutofeedSettingsRequest(), + {}, + ], +) async def test_update_autofeed_settings_async( - transport: str = "grpc_asyncio", - request_type=autofeedsettings.UpdateAutofeedSettingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = AutofeedSettingsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1886,7 +1911,7 @@ async def test_update_autofeed_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( @@ -1915,11 +1940,6 @@ async def test_update_autofeed_settings_async( assert response.eligible is True -@pytest.mark.asyncio -async def test_update_autofeed_settings_async_from_dict(): - await test_update_autofeed_settings_async(request_type=dict) - - def test_update_autofeed_settings_field_headers(): client = AutofeedSettingsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2582,7 +2602,6 @@ def test_get_autofeed_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = autofeedsettings.GetAutofeedSettingsRequest() - assert args[0] == request_msg @@ -2605,7 +2624,6 @@ def test_update_autofeed_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = autofeedsettings.UpdateAutofeedSettingsRequest() - assert args[0] == request_msg @@ -2650,7 +2668,6 @@ async def test_get_autofeed_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = autofeedsettings.GetAutofeedSettingsRequest() - assert args[0] == request_msg @@ -2681,7 +2698,6 @@ async def test_update_autofeed_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = autofeedsettings.UpdateAutofeedSettingsRequest() - assert args[0] == request_msg @@ -3069,7 +3085,6 @@ def test_get_autofeed_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = autofeedsettings.GetAutofeedSettingsRequest() - assert args[0] == request_msg @@ -3091,7 +3106,6 @@ def test_update_autofeed_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = autofeedsettings.UpdateAutofeedSettingsRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_automatic_improvements_service.py b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_automatic_improvements_service.py index 3afb27661a25..24c4b0e13f70 100644 --- a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_automatic_improvements_service.py +++ b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_automatic_improvements_service.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 @@ -107,6 +108,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" @@ -1417,8 +1433,8 @@ def test_automatic_improvements_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - automaticimprovements.GetAutomaticImprovementsRequest, - dict, + automaticimprovements.GetAutomaticImprovementsRequest(), + {}, ], ) def test_get_automatic_improvements(request_type, transport: str = "grpc"): @@ -1429,7 +1445,7 @@ def test_get_automatic_improvements(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1477,9 +1493,10 @@ def test_get_automatic_improvements_non_empty_request_with_auto_populated_field( client.get_automatic_improvements(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == automaticimprovements.GetAutomaticImprovementsRequest( + request_msg = automaticimprovements.GetAutomaticImprovementsRequest( name="name_value", ) + assert args[0] == request_msg def test_get_automatic_improvements_use_cached_wrapped_rpc(): @@ -1565,9 +1582,15 @@ async def test_get_automatic_improvements_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + automaticimprovements.GetAutomaticImprovementsRequest(), + {}, + ], +) async def test_get_automatic_improvements_async( - transport: str = "grpc_asyncio", - request_type=automaticimprovements.GetAutomaticImprovementsRequest, + request_type, transport: str = "grpc_asyncio" ): client = AutomaticImprovementsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1576,7 +1599,7 @@ async def test_get_automatic_improvements_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( @@ -1601,11 +1624,6 @@ async def test_get_automatic_improvements_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_automatic_improvements_async_from_dict(): - await test_get_automatic_improvements_async(request_type=dict) - - def test_get_automatic_improvements_field_headers(): client = AutomaticImprovementsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1760,8 +1778,8 @@ async def test_get_automatic_improvements_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - automaticimprovements.UpdateAutomaticImprovementsRequest, - dict, + automaticimprovements.UpdateAutomaticImprovementsRequest(), + {}, ], ) def test_update_automatic_improvements(request_type, transport: str = "grpc"): @@ -1772,7 +1790,7 @@ def test_update_automatic_improvements(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,7 +1836,8 @@ def test_update_automatic_improvements_non_empty_request_with_auto_populated_fie client.update_automatic_improvements(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == automaticimprovements.UpdateAutomaticImprovementsRequest() + request_msg = automaticimprovements.UpdateAutomaticImprovementsRequest() + assert args[0] == request_msg def test_update_automatic_improvements_use_cached_wrapped_rpc(): @@ -1904,9 +1923,15 @@ async def test_update_automatic_improvements_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + automaticimprovements.UpdateAutomaticImprovementsRequest(), + {}, + ], +) async def test_update_automatic_improvements_async( - transport: str = "grpc_asyncio", - request_type=automaticimprovements.UpdateAutomaticImprovementsRequest, + request_type, transport: str = "grpc_asyncio" ): client = AutomaticImprovementsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1915,7 +1940,7 @@ async def test_update_automatic_improvements_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( @@ -1940,11 +1965,6 @@ async def test_update_automatic_improvements_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_update_automatic_improvements_async_from_dict(): - await test_update_automatic_improvements_async(request_type=dict) - - def test_update_automatic_improvements_field_headers(): client = AutomaticImprovementsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2621,7 +2641,6 @@ def test_get_automatic_improvements_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = automaticimprovements.GetAutomaticImprovementsRequest() - assert args[0] == request_msg @@ -2644,7 +2663,6 @@ def test_update_automatic_improvements_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = automaticimprovements.UpdateAutomaticImprovementsRequest() - assert args[0] == request_msg @@ -2687,7 +2705,6 @@ async def test_get_automatic_improvements_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = automaticimprovements.GetAutomaticImprovementsRequest() - assert args[0] == request_msg @@ -2716,7 +2733,6 @@ async def test_update_automatic_improvements_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = automaticimprovements.UpdateAutomaticImprovementsRequest() - assert args[0] == request_msg @@ -3125,7 +3141,6 @@ def test_get_automatic_improvements_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = automaticimprovements.GetAutomaticImprovementsRequest() - assert args[0] == request_msg @@ -3147,7 +3162,6 @@ def test_update_automatic_improvements_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = automaticimprovements.UpdateAutomaticImprovementsRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_business_identity_service.py b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_business_identity_service.py index c7b42a8fd93a..3d4cbcb7dc32 100644 --- a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_business_identity_service.py +++ b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_business_identity_service.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 @@ -107,6 +108,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" @@ -1376,8 +1392,8 @@ def test_business_identity_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - businessidentity.GetBusinessIdentityRequest, - dict, + businessidentity.GetBusinessIdentityRequest(), + {}, ], ) def test_get_business_identity(request_type, transport: str = "grpc"): @@ -1388,7 +1404,7 @@ def test_get_business_identity(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1441,9 +1457,10 @@ def test_get_business_identity_non_empty_request_with_auto_populated_field(): client.get_business_identity(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == businessidentity.GetBusinessIdentityRequest( + request_msg = businessidentity.GetBusinessIdentityRequest( name="name_value", ) + assert args[0] == request_msg def test_get_business_identity_use_cached_wrapped_rpc(): @@ -1529,9 +1546,15 @@ async def test_get_business_identity_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + businessidentity.GetBusinessIdentityRequest(), + {}, + ], +) async def test_get_business_identity_async( - transport: str = "grpc_asyncio", - request_type=businessidentity.GetBusinessIdentityRequest, + request_type, transport: str = "grpc_asyncio" ): client = BusinessIdentityServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1540,7 +1563,7 @@ async def test_get_business_identity_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( @@ -1570,11 +1593,6 @@ async def test_get_business_identity_async( ) -@pytest.mark.asyncio -async def test_get_business_identity_async_from_dict(): - await test_get_business_identity_async(request_type=dict) - - def test_get_business_identity_field_headers(): client = BusinessIdentityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1729,8 +1747,8 @@ async def test_get_business_identity_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - businessidentity.UpdateBusinessIdentityRequest, - dict, + businessidentity.UpdateBusinessIdentityRequest(), + {}, ], ) def test_update_business_identity(request_type, transport: str = "grpc"): @@ -1741,7 +1759,7 @@ def test_update_business_identity(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1792,7 +1810,8 @@ def test_update_business_identity_non_empty_request_with_auto_populated_field(): client.update_business_identity(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == businessidentity.UpdateBusinessIdentityRequest() + request_msg = businessidentity.UpdateBusinessIdentityRequest() + assert args[0] == request_msg def test_update_business_identity_use_cached_wrapped_rpc(): @@ -1878,9 +1897,15 @@ async def test_update_business_identity_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + businessidentity.UpdateBusinessIdentityRequest(), + {}, + ], +) async def test_update_business_identity_async( - transport: str = "grpc_asyncio", - request_type=businessidentity.UpdateBusinessIdentityRequest, + request_type, transport: str = "grpc_asyncio" ): client = BusinessIdentityServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1889,7 +1914,7 @@ async def test_update_business_identity_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( @@ -1919,11 +1944,6 @@ async def test_update_business_identity_async( ) -@pytest.mark.asyncio -async def test_update_business_identity_async_from_dict(): - await test_update_business_identity_async(request_type=dict) - - def test_update_business_identity_field_headers(): client = BusinessIdentityServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2586,7 +2606,6 @@ def test_get_business_identity_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = businessidentity.GetBusinessIdentityRequest() - assert args[0] == request_msg @@ -2609,7 +2628,6 @@ def test_update_business_identity_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = businessidentity.UpdateBusinessIdentityRequest() - assert args[0] == request_msg @@ -2653,7 +2671,6 @@ async def test_get_business_identity_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = businessidentity.GetBusinessIdentityRequest() - assert args[0] == request_msg @@ -2683,7 +2700,6 @@ async def test_update_business_identity_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = businessidentity.UpdateBusinessIdentityRequest() - assert args[0] == request_msg @@ -3077,7 +3093,6 @@ def test_get_business_identity_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = businessidentity.GetBusinessIdentityRequest() - assert args[0] == request_msg @@ -3099,7 +3114,6 @@ def test_update_business_identity_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = businessidentity.UpdateBusinessIdentityRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_business_info_service.py b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_business_info_service.py index 63f4a329f898..682551a0d6a8 100644 --- a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_business_info_service.py +++ b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_business_info_service.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 @@ -113,6 +114,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" @@ -1376,8 +1392,8 @@ def test_business_info_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - businessinfo.GetBusinessInfoRequest, - dict, + businessinfo.GetBusinessInfoRequest(), + {}, ], ) def test_get_business_info(request_type, transport: str = "grpc"): @@ -1388,7 +1404,7 @@ def test_get_business_info(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1446,9 +1462,10 @@ def test_get_business_info_non_empty_request_with_auto_populated_field(): client.get_business_info(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == businessinfo.GetBusinessInfoRequest( + request_msg = businessinfo.GetBusinessInfoRequest( name="name_value", ) + assert args[0] == request_msg def test_get_business_info_use_cached_wrapped_rpc(): @@ -1531,9 +1548,14 @@ async def test_get_business_info_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_business_info_async( - transport: str = "grpc_asyncio", request_type=businessinfo.GetBusinessInfoRequest -): +@pytest.mark.parametrize( + "request_type", + [ + businessinfo.GetBusinessInfoRequest(), + {}, + ], +) +async def test_get_business_info_async(request_type, transport: str = "grpc_asyncio"): client = BusinessInfoServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1541,7 +1563,7 @@ async def test_get_business_info_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( @@ -1576,11 +1598,6 @@ async def test_get_business_info_async( ) -@pytest.mark.asyncio -async def test_get_business_info_async_from_dict(): - await test_get_business_info_async(request_type=dict) - - def test_get_business_info_field_headers(): client = BusinessInfoServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1735,8 +1752,8 @@ async def test_get_business_info_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - businessinfo.UpdateBusinessInfoRequest, - dict, + businessinfo.UpdateBusinessInfoRequest(), + {}, ], ) def test_update_business_info(request_type, transport: str = "grpc"): @@ -1747,7 +1764,7 @@ def test_update_business_info(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1803,7 +1820,8 @@ def test_update_business_info_non_empty_request_with_auto_populated_field(): client.update_business_info(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == businessinfo.UpdateBusinessInfoRequest() + request_msg = businessinfo.UpdateBusinessInfoRequest() + assert args[0] == request_msg def test_update_business_info_use_cached_wrapped_rpc(): @@ -1888,8 +1906,15 @@ async def test_update_business_info_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + businessinfo.UpdateBusinessInfoRequest(), + {}, + ], +) async def test_update_business_info_async( - transport: str = "grpc_asyncio", request_type=businessinfo.UpdateBusinessInfoRequest + request_type, transport: str = "grpc_asyncio" ): client = BusinessInfoServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1898,7 +1923,7 @@ async def test_update_business_info_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( @@ -1933,11 +1958,6 @@ async def test_update_business_info_async( ) -@pytest.mark.asyncio -async def test_update_business_info_async_from_dict(): - await test_update_business_info_async(request_type=dict) - - def test_update_business_info_field_headers(): client = BusinessInfoServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2594,7 +2614,6 @@ def test_get_business_info_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = businessinfo.GetBusinessInfoRequest() - assert args[0] == request_msg @@ -2617,7 +2636,6 @@ def test_update_business_info_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = businessinfo.UpdateBusinessInfoRequest() - assert args[0] == request_msg @@ -2662,7 +2680,6 @@ async def test_get_business_info_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = businessinfo.GetBusinessInfoRequest() - assert args[0] == request_msg @@ -2693,7 +2710,6 @@ async def test_update_business_info_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = businessinfo.UpdateBusinessInfoRequest() - assert args[0] == request_msg @@ -3105,7 +3121,6 @@ def test_get_business_info_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = businessinfo.GetBusinessInfoRequest() - assert args[0] == request_msg @@ -3127,7 +3142,6 @@ def test_update_business_info_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = businessinfo.UpdateBusinessInfoRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_checkout_settings_service.py b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_checkout_settings_service.py index c3d83f589255..d028f3470142 100644 --- a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_checkout_settings_service.py +++ b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_checkout_settings_service.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 @@ -108,6 +109,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" @@ -1377,8 +1393,8 @@ def test_checkout_settings_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - checkoutsettings.GetCheckoutSettingsRequest, - dict, + checkoutsettings.GetCheckoutSettingsRequest(), + {}, ], ) def test_get_checkout_settings(request_type, transport: str = "grpc"): @@ -1389,7 +1405,7 @@ def test_get_checkout_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( @@ -1461,9 +1477,10 @@ def test_get_checkout_settings_non_empty_request_with_auto_populated_field(): client.get_checkout_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == checkoutsettings.GetCheckoutSettingsRequest( + request_msg = checkoutsettings.GetCheckoutSettingsRequest( name="name_value", ) + assert args[0] == request_msg def test_get_checkout_settings_use_cached_wrapped_rpc(): @@ -1549,9 +1566,15 @@ async def test_get_checkout_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + checkoutsettings.GetCheckoutSettingsRequest(), + {}, + ], +) async def test_get_checkout_settings_async( - transport: str = "grpc_asyncio", - request_type=checkoutsettings.GetCheckoutSettingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = CheckoutSettingsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1560,7 +1583,7 @@ async def test_get_checkout_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( @@ -1609,11 +1632,6 @@ async def test_get_checkout_settings_async( ) -@pytest.mark.asyncio -async def test_get_checkout_settings_async_from_dict(): - await test_get_checkout_settings_async(request_type=dict) - - def test_get_checkout_settings_field_headers(): client = CheckoutSettingsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1768,8 +1786,8 @@ async def test_get_checkout_settings_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - checkoutsettings.CreateCheckoutSettingsRequest, - dict, + checkoutsettings.CreateCheckoutSettingsRequest(), + {}, ], ) def test_create_checkout_settings(request_type, transport: str = "grpc"): @@ -1780,7 +1798,7 @@ def test_create_checkout_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( @@ -1852,9 +1870,10 @@ def test_create_checkout_settings_non_empty_request_with_auto_populated_field(): client.create_checkout_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == checkoutsettings.CreateCheckoutSettingsRequest( + request_msg = checkoutsettings.CreateCheckoutSettingsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_checkout_settings_use_cached_wrapped_rpc(): @@ -1940,9 +1959,15 @@ async def test_create_checkout_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + checkoutsettings.CreateCheckoutSettingsRequest(), + {}, + ], +) async def test_create_checkout_settings_async( - transport: str = "grpc_asyncio", - request_type=checkoutsettings.CreateCheckoutSettingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = CheckoutSettingsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1951,7 +1976,7 @@ async def test_create_checkout_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( @@ -2000,11 +2025,6 @@ async def test_create_checkout_settings_async( ) -@pytest.mark.asyncio -async def test_create_checkout_settings_async_from_dict(): - await test_create_checkout_settings_async(request_type=dict) - - def test_create_checkout_settings_field_headers(): client = CheckoutSettingsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2169,8 +2189,8 @@ async def test_create_checkout_settings_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - checkoutsettings.UpdateCheckoutSettingsRequest, - dict, + checkoutsettings.UpdateCheckoutSettingsRequest(), + {}, ], ) def test_update_checkout_settings(request_type, transport: str = "grpc"): @@ -2181,7 +2201,7 @@ def test_update_checkout_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( @@ -2251,7 +2271,8 @@ def test_update_checkout_settings_non_empty_request_with_auto_populated_field(): client.update_checkout_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == checkoutsettings.UpdateCheckoutSettingsRequest() + request_msg = checkoutsettings.UpdateCheckoutSettingsRequest() + assert args[0] == request_msg def test_update_checkout_settings_use_cached_wrapped_rpc(): @@ -2337,9 +2358,15 @@ async def test_update_checkout_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + checkoutsettings.UpdateCheckoutSettingsRequest(), + {}, + ], +) async def test_update_checkout_settings_async( - transport: str = "grpc_asyncio", - request_type=checkoutsettings.UpdateCheckoutSettingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = CheckoutSettingsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2348,7 +2375,7 @@ async def test_update_checkout_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( @@ -2397,11 +2424,6 @@ async def test_update_checkout_settings_async( ) -@pytest.mark.asyncio -async def test_update_checkout_settings_async_from_dict(): - await test_update_checkout_settings_async(request_type=dict) - - def test_update_checkout_settings_field_headers(): client = CheckoutSettingsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2566,8 +2588,8 @@ async def test_update_checkout_settings_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - checkoutsettings.DeleteCheckoutSettingsRequest, - dict, + checkoutsettings.DeleteCheckoutSettingsRequest(), + {}, ], ) def test_delete_checkout_settings(request_type, transport: str = "grpc"): @@ -2578,7 +2600,7 @@ def test_delete_checkout_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( @@ -2623,9 +2645,10 @@ def test_delete_checkout_settings_non_empty_request_with_auto_populated_field(): client.delete_checkout_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == checkoutsettings.DeleteCheckoutSettingsRequest( + request_msg = checkoutsettings.DeleteCheckoutSettingsRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_checkout_settings_use_cached_wrapped_rpc(): @@ -2711,9 +2734,15 @@ async def test_delete_checkout_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + checkoutsettings.DeleteCheckoutSettingsRequest(), + {}, + ], +) async def test_delete_checkout_settings_async( - transport: str = "grpc_asyncio", - request_type=checkoutsettings.DeleteCheckoutSettingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = CheckoutSettingsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2722,7 +2751,7 @@ async def test_delete_checkout_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( @@ -2742,11 +2771,6 @@ async def test_delete_checkout_settings_async( assert response is None -@pytest.mark.asyncio -async def test_delete_checkout_settings_async_from_dict(): - await test_delete_checkout_settings_async(request_type=dict) - - def test_delete_checkout_settings_field_headers(): client = CheckoutSettingsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3769,7 +3793,6 @@ def test_get_checkout_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = checkoutsettings.GetCheckoutSettingsRequest() - assert args[0] == request_msg @@ -3792,7 +3815,6 @@ def test_create_checkout_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = checkoutsettings.CreateCheckoutSettingsRequest() - assert args[0] == request_msg @@ -3815,7 +3837,6 @@ def test_update_checkout_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = checkoutsettings.UpdateCheckoutSettingsRequest() - assert args[0] == request_msg @@ -3838,7 +3859,6 @@ def test_delete_checkout_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = checkoutsettings.DeleteCheckoutSettingsRequest() - assert args[0] == request_msg @@ -3886,7 +3906,6 @@ async def test_get_checkout_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = checkoutsettings.GetCheckoutSettingsRequest() - assert args[0] == request_msg @@ -3920,7 +3939,6 @@ async def test_create_checkout_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = checkoutsettings.CreateCheckoutSettingsRequest() - assert args[0] == request_msg @@ -3954,7 +3972,6 @@ async def test_update_checkout_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = checkoutsettings.UpdateCheckoutSettingsRequest() - assert args[0] == request_msg @@ -3979,7 +3996,6 @@ async def test_delete_checkout_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = checkoutsettings.DeleteCheckoutSettingsRequest() - assert args[0] == request_msg @@ -4775,7 +4791,6 @@ def test_get_checkout_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = checkoutsettings.GetCheckoutSettingsRequest() - assert args[0] == request_msg @@ -4797,7 +4812,6 @@ def test_create_checkout_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = checkoutsettings.CreateCheckoutSettingsRequest() - assert args[0] == request_msg @@ -4819,7 +4833,6 @@ def test_update_checkout_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = checkoutsettings.UpdateCheckoutSettingsRequest() - assert args[0] == request_msg @@ -4841,7 +4854,6 @@ def test_delete_checkout_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = checkoutsettings.DeleteCheckoutSettingsRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_email_preferences_service.py b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_email_preferences_service.py index 3bf19bc270ce..ef6c9a24b521 100644 --- a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_email_preferences_service.py +++ b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_email_preferences_service.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 @@ -107,6 +108,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" @@ -1376,8 +1392,8 @@ def test_email_preferences_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - emailpreferences.GetEmailPreferencesRequest, - dict, + emailpreferences.GetEmailPreferencesRequest(), + {}, ], ) def test_get_email_preferences(request_type, transport: str = "grpc"): @@ -1388,7 +1404,7 @@ def test_get_email_preferences(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1440,9 +1456,10 @@ def test_get_email_preferences_non_empty_request_with_auto_populated_field(): client.get_email_preferences(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == emailpreferences.GetEmailPreferencesRequest( + request_msg = emailpreferences.GetEmailPreferencesRequest( name="name_value", ) + assert args[0] == request_msg def test_get_email_preferences_use_cached_wrapped_rpc(): @@ -1528,9 +1545,15 @@ async def test_get_email_preferences_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + emailpreferences.GetEmailPreferencesRequest(), + {}, + ], +) async def test_get_email_preferences_async( - transport: str = "grpc_asyncio", - request_type=emailpreferences.GetEmailPreferencesRequest, + request_type, transport: str = "grpc_asyncio" ): client = EmailPreferencesServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1539,7 +1562,7 @@ async def test_get_email_preferences_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( @@ -1568,11 +1591,6 @@ async def test_get_email_preferences_async( ) -@pytest.mark.asyncio -async def test_get_email_preferences_async_from_dict(): - await test_get_email_preferences_async(request_type=dict) - - def test_get_email_preferences_field_headers(): client = EmailPreferencesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1727,8 +1745,8 @@ async def test_get_email_preferences_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - emailpreferences.UpdateEmailPreferencesRequest, - dict, + emailpreferences.UpdateEmailPreferencesRequest(), + {}, ], ) def test_update_email_preferences(request_type, transport: str = "grpc"): @@ -1739,7 +1757,7 @@ def test_update_email_preferences(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1789,7 +1807,8 @@ def test_update_email_preferences_non_empty_request_with_auto_populated_field(): client.update_email_preferences(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == emailpreferences.UpdateEmailPreferencesRequest() + request_msg = emailpreferences.UpdateEmailPreferencesRequest() + assert args[0] == request_msg def test_update_email_preferences_use_cached_wrapped_rpc(): @@ -1875,9 +1894,15 @@ async def test_update_email_preferences_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + emailpreferences.UpdateEmailPreferencesRequest(), + {}, + ], +) async def test_update_email_preferences_async( - transport: str = "grpc_asyncio", - request_type=emailpreferences.UpdateEmailPreferencesRequest, + request_type, transport: str = "grpc_asyncio" ): client = EmailPreferencesServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1886,7 +1911,7 @@ async def test_update_email_preferences_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( @@ -1915,11 +1940,6 @@ async def test_update_email_preferences_async( ) -@pytest.mark.asyncio -async def test_update_email_preferences_async_from_dict(): - await test_update_email_preferences_async(request_type=dict) - - def test_update_email_preferences_field_headers(): client = EmailPreferencesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2584,7 +2604,6 @@ def test_get_email_preferences_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = emailpreferences.GetEmailPreferencesRequest() - assert args[0] == request_msg @@ -2607,7 +2626,6 @@ def test_update_email_preferences_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = emailpreferences.UpdateEmailPreferencesRequest() - assert args[0] == request_msg @@ -2651,7 +2669,6 @@ async def test_get_email_preferences_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = emailpreferences.GetEmailPreferencesRequest() - assert args[0] == request_msg @@ -2681,7 +2698,6 @@ async def test_update_email_preferences_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = emailpreferences.UpdateEmailPreferencesRequest() - assert args[0] == request_msg @@ -3072,7 +3088,6 @@ def test_get_email_preferences_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = emailpreferences.GetEmailPreferencesRequest() - assert args[0] == request_msg @@ -3094,7 +3109,6 @@ def test_update_email_preferences_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = emailpreferences.UpdateEmailPreferencesRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_gbp_accounts_service.py b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_gbp_accounts_service.py index de98ae90aae9..3a8ac9c2c2da 100644 --- a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_gbp_accounts_service.py +++ b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_gbp_accounts_service.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 @@ -108,6 +109,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" @@ -1353,8 +1369,8 @@ def test_gbp_accounts_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - gbpaccounts.ListGbpAccountsRequest, - dict, + gbpaccounts.ListGbpAccountsRequest(), + {}, ], ) def test_list_gbp_accounts(request_type, transport: str = "grpc"): @@ -1365,7 +1381,7 @@ def test_list_gbp_accounts(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1414,10 +1430,11 @@ def test_list_gbp_accounts_non_empty_request_with_auto_populated_field(): client.list_gbp_accounts(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gbpaccounts.ListGbpAccountsRequest( + request_msg = gbpaccounts.ListGbpAccountsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_gbp_accounts_use_cached_wrapped_rpc(): @@ -1500,9 +1517,14 @@ async def test_list_gbp_accounts_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_gbp_accounts_async( - transport: str = "grpc_asyncio", request_type=gbpaccounts.ListGbpAccountsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gbpaccounts.ListGbpAccountsRequest(), + {}, + ], +) +async def test_list_gbp_accounts_async(request_type, transport: str = "grpc_asyncio"): client = GbpAccountsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1510,7 +1532,7 @@ async def test_list_gbp_accounts_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( @@ -1535,11 +1557,6 @@ async def test_list_gbp_accounts_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_gbp_accounts_async_from_dict(): - await test_list_gbp_accounts_async(request_type=dict) - - def test_list_gbp_accounts_field_headers(): client = GbpAccountsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1892,8 +1909,8 @@ async def test_list_gbp_accounts_async_pages(): @pytest.mark.parametrize( "request_type", [ - gbpaccounts.LinkGbpAccountRequest, - dict, + gbpaccounts.LinkGbpAccountRequest(), + {}, ], ) def test_link_gbp_account(request_type, transport: str = "grpc"): @@ -1904,7 +1921,7 @@ def test_link_gbp_account(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.link_gbp_account), "__call__") as call: @@ -1946,10 +1963,11 @@ def test_link_gbp_account_non_empty_request_with_auto_populated_field(): client.link_gbp_account(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gbpaccounts.LinkGbpAccountRequest( + request_msg = gbpaccounts.LinkGbpAccountRequest( parent="parent_value", gbp_email="gbp_email_value", ) + assert args[0] == request_msg def test_link_gbp_account_use_cached_wrapped_rpc(): @@ -2032,9 +2050,14 @@ async def test_link_gbp_account_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_link_gbp_account_async( - transport: str = "grpc_asyncio", request_type=gbpaccounts.LinkGbpAccountRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gbpaccounts.LinkGbpAccountRequest(), + {}, + ], +) +async def test_link_gbp_account_async(request_type, transport: str = "grpc_asyncio"): client = GbpAccountsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2042,7 +2065,7 @@ async def test_link_gbp_account_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.link_gbp_account), "__call__") as call: @@ -2062,11 +2085,6 @@ async def test_link_gbp_account_async( assert isinstance(response, gbpaccounts.LinkGbpAccountResponse) -@pytest.mark.asyncio -async def test_link_gbp_account_async_from_dict(): - await test_link_gbp_account_async(request_type=dict) - - def test_link_gbp_account_field_headers(): client = GbpAccountsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2786,7 +2804,6 @@ def test_list_gbp_accounts_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gbpaccounts.ListGbpAccountsRequest() - assert args[0] == request_msg @@ -2807,7 +2824,6 @@ def test_link_gbp_account_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gbpaccounts.LinkGbpAccountRequest() - assert args[0] == request_msg @@ -2850,7 +2866,6 @@ async def test_list_gbp_accounts_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gbpaccounts.ListGbpAccountsRequest() - assert args[0] == request_msg @@ -2875,7 +2890,6 @@ async def test_link_gbp_account_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gbpaccounts.LinkGbpAccountRequest() - assert args[0] == request_msg @@ -3177,7 +3191,6 @@ def test_list_gbp_accounts_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gbpaccounts.ListGbpAccountsRequest() - assert args[0] == request_msg @@ -3197,7 +3210,6 @@ def test_link_gbp_account_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gbpaccounts.LinkGbpAccountRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_homepage_service.py b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_homepage_service.py index adfdfc3a68f5..d5e5857dfb00 100644 --- a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_homepage_service.py +++ b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_homepage_service.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 @@ -108,6 +109,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" @@ -1335,8 +1351,8 @@ def test_homepage_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - homepage.GetHomepageRequest, - dict, + homepage.GetHomepageRequest(), + {}, ], ) def test_get_homepage(request_type, transport: str = "grpc"): @@ -1347,7 +1363,7 @@ def test_get_homepage(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_homepage), "__call__") as call: @@ -1395,9 +1411,10 @@ def test_get_homepage_non_empty_request_with_auto_populated_field(): client.get_homepage(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == homepage.GetHomepageRequest( + request_msg = homepage.GetHomepageRequest( name="name_value", ) + assert args[0] == request_msg def test_get_homepage_use_cached_wrapped_rpc(): @@ -1478,9 +1495,14 @@ async def test_get_homepage_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_homepage_async( - transport: str = "grpc_asyncio", request_type=homepage.GetHomepageRequest -): +@pytest.mark.parametrize( + "request_type", + [ + homepage.GetHomepageRequest(), + {}, + ], +) +async def test_get_homepage_async(request_type, transport: str = "grpc_asyncio"): client = HomepageServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1488,7 +1510,7 @@ async def test_get_homepage_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_homepage), "__call__") as call: @@ -1515,11 +1537,6 @@ async def test_get_homepage_async( assert response.claimed is True -@pytest.mark.asyncio -async def test_get_homepage_async_from_dict(): - await test_get_homepage_async(request_type=dict) - - def test_get_homepage_field_headers(): client = HomepageServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1662,8 +1679,8 @@ async def test_get_homepage_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gsma_homepage.UpdateHomepageRequest, - dict, + gsma_homepage.UpdateHomepageRequest(), + {}, ], ) def test_update_homepage(request_type, transport: str = "grpc"): @@ -1674,7 +1691,7 @@ def test_update_homepage(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_homepage), "__call__") as call: @@ -1720,7 +1737,8 @@ def test_update_homepage_non_empty_request_with_auto_populated_field(): client.update_homepage(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gsma_homepage.UpdateHomepageRequest() + request_msg = gsma_homepage.UpdateHomepageRequest() + assert args[0] == request_msg def test_update_homepage_use_cached_wrapped_rpc(): @@ -1801,9 +1819,14 @@ async def test_update_homepage_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_homepage_async( - transport: str = "grpc_asyncio", request_type=gsma_homepage.UpdateHomepageRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gsma_homepage.UpdateHomepageRequest(), + {}, + ], +) +async def test_update_homepage_async(request_type, transport: str = "grpc_asyncio"): client = HomepageServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1811,7 +1834,7 @@ async def test_update_homepage_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_homepage), "__call__") as call: @@ -1838,11 +1861,6 @@ async def test_update_homepage_async( assert response.claimed is True -@pytest.mark.asyncio -async def test_update_homepage_async_from_dict(): - await test_update_homepage_async(request_type=dict) - - def test_update_homepage_field_headers(): client = HomepageServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1999,8 +2017,8 @@ async def test_update_homepage_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - homepage.ClaimHomepageRequest, - dict, + homepage.ClaimHomepageRequest(), + {}, ], ) def test_claim_homepage(request_type, transport: str = "grpc"): @@ -2011,7 +2029,7 @@ def test_claim_homepage(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.claim_homepage), "__call__") as call: @@ -2059,9 +2077,10 @@ def test_claim_homepage_non_empty_request_with_auto_populated_field(): client.claim_homepage(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == homepage.ClaimHomepageRequest( + request_msg = homepage.ClaimHomepageRequest( name="name_value", ) + assert args[0] == request_msg def test_claim_homepage_use_cached_wrapped_rpc(): @@ -2142,9 +2161,14 @@ async def test_claim_homepage_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_claim_homepage_async( - transport: str = "grpc_asyncio", request_type=homepage.ClaimHomepageRequest -): +@pytest.mark.parametrize( + "request_type", + [ + homepage.ClaimHomepageRequest(), + {}, + ], +) +async def test_claim_homepage_async(request_type, transport: str = "grpc_asyncio"): client = HomepageServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2152,7 +2176,7 @@ async def test_claim_homepage_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.claim_homepage), "__call__") as call: @@ -2179,11 +2203,6 @@ async def test_claim_homepage_async( assert response.claimed is True -@pytest.mark.asyncio -async def test_claim_homepage_async_from_dict(): - await test_claim_homepage_async(request_type=dict) - - def test_claim_homepage_field_headers(): client = HomepageServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2246,8 +2265,8 @@ async def test_claim_homepage_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - homepage.UnclaimHomepageRequest, - dict, + homepage.UnclaimHomepageRequest(), + {}, ], ) def test_unclaim_homepage(request_type, transport: str = "grpc"): @@ -2258,7 +2277,7 @@ def test_unclaim_homepage(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.unclaim_homepage), "__call__") as call: @@ -2306,9 +2325,10 @@ def test_unclaim_homepage_non_empty_request_with_auto_populated_field(): client.unclaim_homepage(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == homepage.UnclaimHomepageRequest( + request_msg = homepage.UnclaimHomepageRequest( name="name_value", ) + assert args[0] == request_msg def test_unclaim_homepage_use_cached_wrapped_rpc(): @@ -2391,9 +2411,14 @@ async def test_unclaim_homepage_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_unclaim_homepage_async( - transport: str = "grpc_asyncio", request_type=homepage.UnclaimHomepageRequest -): +@pytest.mark.parametrize( + "request_type", + [ + homepage.UnclaimHomepageRequest(), + {}, + ], +) +async def test_unclaim_homepage_async(request_type, transport: str = "grpc_asyncio"): client = HomepageServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2401,7 +2426,7 @@ async def test_unclaim_homepage_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.unclaim_homepage), "__call__") as call: @@ -2428,11 +2453,6 @@ async def test_unclaim_homepage_async( assert response.claimed is True -@pytest.mark.asyncio -async def test_unclaim_homepage_async_from_dict(): - await test_unclaim_homepage_async(request_type=dict) - - def test_unclaim_homepage_field_headers(): client = HomepageServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3220,7 +3240,6 @@ def test_get_homepage_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = homepage.GetHomepageRequest() - assert args[0] == request_msg @@ -3241,7 +3260,6 @@ def test_update_homepage_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gsma_homepage.UpdateHomepageRequest() - assert args[0] == request_msg @@ -3262,7 +3280,6 @@ def test_claim_homepage_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = homepage.ClaimHomepageRequest() - assert args[0] == request_msg @@ -3283,7 +3300,6 @@ def test_unclaim_homepage_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = homepage.UnclaimHomepageRequest() - assert args[0] == request_msg @@ -3326,7 +3342,6 @@ async def test_get_homepage_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = homepage.GetHomepageRequest() - assert args[0] == request_msg @@ -3355,7 +3370,6 @@ async def test_update_homepage_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gsma_homepage.UpdateHomepageRequest() - assert args[0] == request_msg @@ -3384,7 +3398,6 @@ async def test_claim_homepage_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = homepage.ClaimHomepageRequest() - assert args[0] == request_msg @@ -3413,7 +3426,6 @@ async def test_unclaim_homepage_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = homepage.UnclaimHomepageRequest() - assert args[0] == request_msg @@ -4050,7 +4062,6 @@ def test_get_homepage_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = homepage.GetHomepageRequest() - assert args[0] == request_msg @@ -4070,7 +4081,6 @@ def test_update_homepage_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gsma_homepage.UpdateHomepageRequest() - assert args[0] == request_msg @@ -4090,7 +4100,6 @@ def test_claim_homepage_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = homepage.ClaimHomepageRequest() - assert args[0] == request_msg @@ -4110,7 +4119,6 @@ def test_unclaim_homepage_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = homepage.UnclaimHomepageRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_lfp_providers_service.py b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_lfp_providers_service.py index f93ab18e92cd..b4e3f9a7cfbc 100644 --- a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_lfp_providers_service.py +++ b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_lfp_providers_service.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 @@ -108,6 +109,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" @@ -1371,8 +1387,8 @@ def test_lfp_providers_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - lfpproviders.FindLfpProvidersRequest, - dict, + lfpproviders.FindLfpProvidersRequest(), + {}, ], ) def test_find_lfp_providers(request_type, transport: str = "grpc"): @@ -1383,7 +1399,7 @@ def test_find_lfp_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( @@ -1432,10 +1448,11 @@ def test_find_lfp_providers_non_empty_request_with_auto_populated_field(): client.find_lfp_providers(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == lfpproviders.FindLfpProvidersRequest( + request_msg = lfpproviders.FindLfpProvidersRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_find_lfp_providers_use_cached_wrapped_rpc(): @@ -1520,9 +1537,14 @@ async def test_find_lfp_providers_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_find_lfp_providers_async( - transport: str = "grpc_asyncio", request_type=lfpproviders.FindLfpProvidersRequest -): +@pytest.mark.parametrize( + "request_type", + [ + lfpproviders.FindLfpProvidersRequest(), + {}, + ], +) +async def test_find_lfp_providers_async(request_type, transport: str = "grpc_asyncio"): client = LfpProvidersServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1530,7 +1552,7 @@ async def test_find_lfp_providers_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( @@ -1555,11 +1577,6 @@ async def test_find_lfp_providers_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_find_lfp_providers_async_from_dict(): - await test_find_lfp_providers_async(request_type=dict) - - def test_find_lfp_providers_field_headers(): client = LfpProvidersServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1912,8 +1929,8 @@ async def test_find_lfp_providers_async_pages(): @pytest.mark.parametrize( "request_type", [ - lfpproviders.LinkLfpProviderRequest, - dict, + lfpproviders.LinkLfpProviderRequest(), + {}, ], ) def test_link_lfp_provider(request_type, transport: str = "grpc"): @@ -1924,7 +1941,7 @@ def test_link_lfp_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( @@ -1970,10 +1987,11 @@ def test_link_lfp_provider_non_empty_request_with_auto_populated_field(): client.link_lfp_provider(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == lfpproviders.LinkLfpProviderRequest( + request_msg = lfpproviders.LinkLfpProviderRequest( name="name_value", external_account_id="external_account_id_value", ) + assert args[0] == request_msg def test_link_lfp_provider_use_cached_wrapped_rpc(): @@ -2056,9 +2074,14 @@ async def test_link_lfp_provider_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_link_lfp_provider_async( - transport: str = "grpc_asyncio", request_type=lfpproviders.LinkLfpProviderRequest -): +@pytest.mark.parametrize( + "request_type", + [ + lfpproviders.LinkLfpProviderRequest(), + {}, + ], +) +async def test_link_lfp_provider_async(request_type, transport: str = "grpc_asyncio"): client = LfpProvidersServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2066,7 +2089,7 @@ async def test_link_lfp_provider_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( @@ -2088,11 +2111,6 @@ async def test_link_lfp_provider_async( assert isinstance(response, lfpproviders.LinkLfpProviderResponse) -@pytest.mark.asyncio -async def test_link_lfp_provider_async_from_dict(): - await test_link_lfp_provider_async(request_type=dict) - - def test_link_lfp_provider_field_headers(): client = LfpProvidersServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2824,7 +2842,6 @@ def test_find_lfp_providers_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lfpproviders.FindLfpProvidersRequest() - assert args[0] == request_msg @@ -2847,7 +2864,6 @@ def test_link_lfp_provider_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lfpproviders.LinkLfpProviderRequest() - assert args[0] == request_msg @@ -2890,7 +2906,6 @@ async def test_find_lfp_providers_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lfpproviders.FindLfpProvidersRequest() - assert args[0] == request_msg @@ -2917,7 +2932,6 @@ async def test_link_lfp_provider_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lfpproviders.LinkLfpProviderRequest() - assert args[0] == request_msg @@ -3226,7 +3240,6 @@ def test_find_lfp_providers_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lfpproviders.FindLfpProvidersRequest() - assert args[0] == request_msg @@ -3248,7 +3261,6 @@ def test_link_lfp_provider_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lfpproviders.LinkLfpProviderRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_omnichannel_settings_service.py b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_omnichannel_settings_service.py index 831478af2f1b..a0b0a1f4f09d 100644 --- a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_omnichannel_settings_service.py +++ b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_omnichannel_settings_service.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 @@ -108,6 +109,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" @@ -1402,8 +1418,8 @@ def test_omnichannel_settings_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - omnichannelsettings.GetOmnichannelSettingRequest, - dict, + omnichannelsettings.GetOmnichannelSettingRequest(), + {}, ], ) def test_get_omnichannel_setting(request_type, transport: str = "grpc"): @@ -1414,7 +1430,7 @@ def test_get_omnichannel_setting(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,9 +1482,10 @@ def test_get_omnichannel_setting_non_empty_request_with_auto_populated_field(): client.get_omnichannel_setting(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == omnichannelsettings.GetOmnichannelSettingRequest( + request_msg = omnichannelsettings.GetOmnichannelSettingRequest( name="name_value", ) + assert args[0] == request_msg def test_get_omnichannel_setting_use_cached_wrapped_rpc(): @@ -1554,9 +1571,15 @@ async def test_get_omnichannel_setting_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + omnichannelsettings.GetOmnichannelSettingRequest(), + {}, + ], +) async def test_get_omnichannel_setting_async( - transport: str = "grpc_asyncio", - request_type=omnichannelsettings.GetOmnichannelSettingRequest, + request_type, transport: str = "grpc_asyncio" ): client = OmnichannelSettingsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1565,7 +1588,7 @@ async def test_get_omnichannel_setting_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( @@ -1594,11 +1617,6 @@ async def test_get_omnichannel_setting_async( assert response.lsf_type == omnichannelsettings.OmnichannelSetting.LsfType.GHLSF -@pytest.mark.asyncio -async def test_get_omnichannel_setting_async_from_dict(): - await test_get_omnichannel_setting_async(request_type=dict) - - def test_get_omnichannel_setting_field_headers(): client = OmnichannelSettingsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1753,8 +1771,8 @@ async def test_get_omnichannel_setting_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - omnichannelsettings.ListOmnichannelSettingsRequest, - dict, + omnichannelsettings.ListOmnichannelSettingsRequest(), + {}, ], ) def test_list_omnichannel_settings(request_type, transport: str = "grpc"): @@ -1765,7 +1783,7 @@ def test_list_omnichannel_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( @@ -1814,10 +1832,11 @@ def test_list_omnichannel_settings_non_empty_request_with_auto_populated_field() client.list_omnichannel_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == omnichannelsettings.ListOmnichannelSettingsRequest( + request_msg = omnichannelsettings.ListOmnichannelSettingsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_omnichannel_settings_use_cached_wrapped_rpc(): @@ -1903,9 +1922,15 @@ async def test_list_omnichannel_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + omnichannelsettings.ListOmnichannelSettingsRequest(), + {}, + ], +) async def test_list_omnichannel_settings_async( - transport: str = "grpc_asyncio", - request_type=omnichannelsettings.ListOmnichannelSettingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = OmnichannelSettingsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1914,7 +1939,7 @@ async def test_list_omnichannel_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( @@ -1939,11 +1964,6 @@ async def test_list_omnichannel_settings_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_omnichannel_settings_async_from_dict(): - await test_list_omnichannel_settings_async(request_type=dict) - - def test_list_omnichannel_settings_field_headers(): client = OmnichannelSettingsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2302,8 +2322,8 @@ async def test_list_omnichannel_settings_async_pages(): @pytest.mark.parametrize( "request_type", [ - omnichannelsettings.CreateOmnichannelSettingRequest, - dict, + omnichannelsettings.CreateOmnichannelSettingRequest(), + {}, ], ) def test_create_omnichannel_setting(request_type, transport: str = "grpc"): @@ -2314,7 +2334,7 @@ def test_create_omnichannel_setting(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2366,9 +2386,10 @@ def test_create_omnichannel_setting_non_empty_request_with_auto_populated_field( client.create_omnichannel_setting(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == omnichannelsettings.CreateOmnichannelSettingRequest( + request_msg = omnichannelsettings.CreateOmnichannelSettingRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_omnichannel_setting_use_cached_wrapped_rpc(): @@ -2454,9 +2475,15 @@ async def test_create_omnichannel_setting_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + omnichannelsettings.CreateOmnichannelSettingRequest(), + {}, + ], +) async def test_create_omnichannel_setting_async( - transport: str = "grpc_asyncio", - request_type=omnichannelsettings.CreateOmnichannelSettingRequest, + request_type, transport: str = "grpc_asyncio" ): client = OmnichannelSettingsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2465,7 +2492,7 @@ async def test_create_omnichannel_setting_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( @@ -2494,11 +2521,6 @@ async def test_create_omnichannel_setting_async( assert response.lsf_type == omnichannelsettings.OmnichannelSetting.LsfType.GHLSF -@pytest.mark.asyncio -async def test_create_omnichannel_setting_async_from_dict(): - await test_create_omnichannel_setting_async(request_type=dict) - - def test_create_omnichannel_setting_field_headers(): client = OmnichannelSettingsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2671,8 +2693,8 @@ async def test_create_omnichannel_setting_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - omnichannelsettings.UpdateOmnichannelSettingRequest, - dict, + omnichannelsettings.UpdateOmnichannelSettingRequest(), + {}, ], ) def test_update_omnichannel_setting(request_type, transport: str = "grpc"): @@ -2683,7 +2705,7 @@ def test_update_omnichannel_setting(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2733,7 +2755,8 @@ def test_update_omnichannel_setting_non_empty_request_with_auto_populated_field( client.update_omnichannel_setting(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == omnichannelsettings.UpdateOmnichannelSettingRequest() + request_msg = omnichannelsettings.UpdateOmnichannelSettingRequest() + assert args[0] == request_msg def test_update_omnichannel_setting_use_cached_wrapped_rpc(): @@ -2819,9 +2842,15 @@ async def test_update_omnichannel_setting_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + omnichannelsettings.UpdateOmnichannelSettingRequest(), + {}, + ], +) async def test_update_omnichannel_setting_async( - transport: str = "grpc_asyncio", - request_type=omnichannelsettings.UpdateOmnichannelSettingRequest, + request_type, transport: str = "grpc_asyncio" ): client = OmnichannelSettingsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2830,7 +2859,7 @@ async def test_update_omnichannel_setting_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( @@ -2859,11 +2888,6 @@ async def test_update_omnichannel_setting_async( assert response.lsf_type == omnichannelsettings.OmnichannelSetting.LsfType.GHLSF -@pytest.mark.asyncio -async def test_update_omnichannel_setting_async_from_dict(): - await test_update_omnichannel_setting_async(request_type=dict) - - def test_update_omnichannel_setting_field_headers(): client = OmnichannelSettingsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3036,8 +3060,8 @@ async def test_update_omnichannel_setting_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - omnichannelsettings.RequestInventoryVerificationRequest, - dict, + omnichannelsettings.RequestInventoryVerificationRequest(), + {}, ], ) def test_request_inventory_verification(request_type, transport: str = "grpc"): @@ -3048,7 +3072,7 @@ def test_request_inventory_verification(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3095,9 +3119,10 @@ def test_request_inventory_verification_non_empty_request_with_auto_populated_fi client.request_inventory_verification(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == omnichannelsettings.RequestInventoryVerificationRequest( + request_msg = omnichannelsettings.RequestInventoryVerificationRequest( name="name_value", ) + assert args[0] == request_msg def test_request_inventory_verification_use_cached_wrapped_rpc(): @@ -3183,9 +3208,15 @@ async def test_request_inventory_verification_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + omnichannelsettings.RequestInventoryVerificationRequest(), + {}, + ], +) async def test_request_inventory_verification_async( - transport: str = "grpc_asyncio", - request_type=omnichannelsettings.RequestInventoryVerificationRequest, + request_type, transport: str = "grpc_asyncio" ): client = OmnichannelSettingsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3194,7 +3225,7 @@ async def test_request_inventory_verification_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( @@ -3218,11 +3249,6 @@ async def test_request_inventory_verification_async( ) -@pytest.mark.asyncio -async def test_request_inventory_verification_async_from_dict(): - await test_request_inventory_verification_async(request_type=dict) - - def test_request_inventory_verification_field_headers(): client = OmnichannelSettingsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4537,7 +4563,6 @@ def test_get_omnichannel_setting_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = omnichannelsettings.GetOmnichannelSettingRequest() - assert args[0] == request_msg @@ -4560,7 +4585,6 @@ def test_list_omnichannel_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = omnichannelsettings.ListOmnichannelSettingsRequest() - assert args[0] == request_msg @@ -4583,7 +4607,6 @@ def test_create_omnichannel_setting_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = omnichannelsettings.CreateOmnichannelSettingRequest() - assert args[0] == request_msg @@ -4606,7 +4629,6 @@ def test_update_omnichannel_setting_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = omnichannelsettings.UpdateOmnichannelSettingRequest() - assert args[0] == request_msg @@ -4629,7 +4651,6 @@ def test_request_inventory_verification_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = omnichannelsettings.RequestInventoryVerificationRequest() - assert args[0] == request_msg @@ -4674,7 +4695,6 @@ async def test_get_omnichannel_setting_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = omnichannelsettings.GetOmnichannelSettingRequest() - assert args[0] == request_msg @@ -4703,7 +4723,6 @@ async def test_list_omnichannel_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = omnichannelsettings.ListOmnichannelSettingsRequest() - assert args[0] == request_msg @@ -4734,7 +4753,6 @@ async def test_create_omnichannel_setting_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = omnichannelsettings.CreateOmnichannelSettingRequest() - assert args[0] == request_msg @@ -4765,7 +4783,6 @@ async def test_update_omnichannel_setting_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = omnichannelsettings.UpdateOmnichannelSettingRequest() - assert args[0] == request_msg @@ -4792,7 +4809,6 @@ async def test_request_inventory_verification_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = omnichannelsettings.RequestInventoryVerificationRequest() - assert args[0] == request_msg @@ -5715,7 +5731,6 @@ def test_get_omnichannel_setting_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = omnichannelsettings.GetOmnichannelSettingRequest() - assert args[0] == request_msg @@ -5737,7 +5752,6 @@ def test_list_omnichannel_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = omnichannelsettings.ListOmnichannelSettingsRequest() - assert args[0] == request_msg @@ -5759,7 +5773,6 @@ def test_create_omnichannel_setting_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = omnichannelsettings.CreateOmnichannelSettingRequest() - assert args[0] == request_msg @@ -5781,7 +5794,6 @@ def test_update_omnichannel_setting_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = omnichannelsettings.UpdateOmnichannelSettingRequest() - assert args[0] == request_msg @@ -5803,7 +5815,6 @@ def test_request_inventory_verification_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = omnichannelsettings.RequestInventoryVerificationRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_online_return_policy_service.py b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_online_return_policy_service.py index f58103dec3a8..81c7c9732d07 100644 --- a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_online_return_policy_service.py +++ b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_online_return_policy_service.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 @@ -113,6 +114,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" @@ -1395,8 +1411,8 @@ def test_online_return_policy_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - online_return_policy.GetOnlineReturnPolicyRequest, - dict, + online_return_policy.GetOnlineReturnPolicyRequest(), + {}, ], ) def test_get_online_return_policy(request_type, transport: str = "grpc"): @@ -1407,7 +1423,7 @@ def test_get_online_return_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( @@ -1484,9 +1500,10 @@ def test_get_online_return_policy_non_empty_request_with_auto_populated_field(): client.get_online_return_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == online_return_policy.GetOnlineReturnPolicyRequest( + request_msg = online_return_policy.GetOnlineReturnPolicyRequest( name="name_value", ) + assert args[0] == request_msg def test_get_online_return_policy_use_cached_wrapped_rpc(): @@ -1572,9 +1589,15 @@ async def test_get_online_return_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + online_return_policy.GetOnlineReturnPolicyRequest(), + {}, + ], +) async def test_get_online_return_policy_async( - transport: str = "grpc_asyncio", - request_type=online_return_policy.GetOnlineReturnPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = OnlineReturnPolicyServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1583,7 +1606,7 @@ async def test_get_online_return_policy_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( @@ -1639,11 +1662,6 @@ async def test_get_online_return_policy_async( ) -@pytest.mark.asyncio -async def test_get_online_return_policy_async_from_dict(): - await test_get_online_return_policy_async(request_type=dict) - - def test_get_online_return_policy_field_headers(): client = OnlineReturnPolicyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1798,8 +1816,8 @@ async def test_get_online_return_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - online_return_policy.ListOnlineReturnPoliciesRequest, - dict, + online_return_policy.ListOnlineReturnPoliciesRequest(), + {}, ], ) def test_list_online_return_policies(request_type, transport: str = "grpc"): @@ -1810,7 +1828,7 @@ def test_list_online_return_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( @@ -1859,10 +1877,11 @@ def test_list_online_return_policies_non_empty_request_with_auto_populated_field client.list_online_return_policies(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == online_return_policy.ListOnlineReturnPoliciesRequest( + request_msg = online_return_policy.ListOnlineReturnPoliciesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_online_return_policies_use_cached_wrapped_rpc(): @@ -1948,9 +1967,15 @@ async def test_list_online_return_policies_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + online_return_policy.ListOnlineReturnPoliciesRequest(), + {}, + ], +) async def test_list_online_return_policies_async( - transport: str = "grpc_asyncio", - request_type=online_return_policy.ListOnlineReturnPoliciesRequest, + request_type, transport: str = "grpc_asyncio" ): client = OnlineReturnPolicyServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1959,7 +1984,7 @@ async def test_list_online_return_policies_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( @@ -1984,11 +2009,6 @@ async def test_list_online_return_policies_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_online_return_policies_async_from_dict(): - await test_list_online_return_policies_async(request_type=dict) - - def test_list_online_return_policies_field_headers(): client = OnlineReturnPolicyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2347,8 +2367,8 @@ async def test_list_online_return_policies_async_pages(): @pytest.mark.parametrize( "request_type", [ - gsma_online_return_policy.CreateOnlineReturnPolicyRequest, - dict, + gsma_online_return_policy.CreateOnlineReturnPolicyRequest(), + {}, ], ) def test_create_online_return_policy(request_type, transport: str = "grpc"): @@ -2359,7 +2379,7 @@ def test_create_online_return_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( @@ -2438,9 +2458,10 @@ def test_create_online_return_policy_non_empty_request_with_auto_populated_field client.create_online_return_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gsma_online_return_policy.CreateOnlineReturnPolicyRequest( + request_msg = gsma_online_return_policy.CreateOnlineReturnPolicyRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_online_return_policy_use_cached_wrapped_rpc(): @@ -2526,9 +2547,15 @@ async def test_create_online_return_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gsma_online_return_policy.CreateOnlineReturnPolicyRequest(), + {}, + ], +) async def test_create_online_return_policy_async( - transport: str = "grpc_asyncio", - request_type=gsma_online_return_policy.CreateOnlineReturnPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = OnlineReturnPolicyServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2537,7 +2564,7 @@ async def test_create_online_return_policy_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( @@ -2593,11 +2620,6 @@ async def test_create_online_return_policy_async( ) -@pytest.mark.asyncio -async def test_create_online_return_policy_async_from_dict(): - await test_create_online_return_policy_async(request_type=dict) - - def test_create_online_return_policy_field_headers(): client = OnlineReturnPolicyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2770,8 +2792,8 @@ async def test_create_online_return_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gsma_online_return_policy.UpdateOnlineReturnPolicyRequest, - dict, + gsma_online_return_policy.UpdateOnlineReturnPolicyRequest(), + {}, ], ) def test_update_online_return_policy(request_type, transport: str = "grpc"): @@ -2782,7 +2804,7 @@ def test_update_online_return_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( @@ -2859,7 +2881,8 @@ def test_update_online_return_policy_non_empty_request_with_auto_populated_field client.update_online_return_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gsma_online_return_policy.UpdateOnlineReturnPolicyRequest() + request_msg = gsma_online_return_policy.UpdateOnlineReturnPolicyRequest() + assert args[0] == request_msg def test_update_online_return_policy_use_cached_wrapped_rpc(): @@ -2945,9 +2968,15 @@ async def test_update_online_return_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + gsma_online_return_policy.UpdateOnlineReturnPolicyRequest(), + {}, + ], +) async def test_update_online_return_policy_async( - transport: str = "grpc_asyncio", - request_type=gsma_online_return_policy.UpdateOnlineReturnPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = OnlineReturnPolicyServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2956,7 +2985,7 @@ async def test_update_online_return_policy_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( @@ -3012,11 +3041,6 @@ async def test_update_online_return_policy_async( ) -@pytest.mark.asyncio -async def test_update_online_return_policy_async_from_dict(): - await test_update_online_return_policy_async(request_type=dict) - - def test_update_online_return_policy_field_headers(): client = OnlineReturnPolicyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3189,8 +3213,8 @@ async def test_update_online_return_policy_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - online_return_policy.DeleteOnlineReturnPolicyRequest, - dict, + online_return_policy.DeleteOnlineReturnPolicyRequest(), + {}, ], ) def test_delete_online_return_policy(request_type, transport: str = "grpc"): @@ -3201,7 +3225,7 @@ def test_delete_online_return_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( @@ -3246,9 +3270,10 @@ def test_delete_online_return_policy_non_empty_request_with_auto_populated_field client.delete_online_return_policy(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == online_return_policy.DeleteOnlineReturnPolicyRequest( + request_msg = online_return_policy.DeleteOnlineReturnPolicyRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_online_return_policy_use_cached_wrapped_rpc(): @@ -3334,9 +3359,15 @@ async def test_delete_online_return_policy_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + online_return_policy.DeleteOnlineReturnPolicyRequest(), + {}, + ], +) async def test_delete_online_return_policy_async( - transport: str = "grpc_asyncio", - request_type=online_return_policy.DeleteOnlineReturnPolicyRequest, + request_type, transport: str = "grpc_asyncio" ): client = OnlineReturnPolicyServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3345,7 +3376,7 @@ async def test_delete_online_return_policy_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( @@ -3365,11 +3396,6 @@ async def test_delete_online_return_policy_async( assert response is None -@pytest.mark.asyncio -async def test_delete_online_return_policy_async_from_dict(): - await test_delete_online_return_policy_async(request_type=dict) - - def test_delete_online_return_policy_field_headers(): client = OnlineReturnPolicyServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4660,7 +4686,6 @@ def test_get_online_return_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = online_return_policy.GetOnlineReturnPolicyRequest() - assert args[0] == request_msg @@ -4683,7 +4708,6 @@ def test_list_online_return_policies_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = online_return_policy.ListOnlineReturnPoliciesRequest() - assert args[0] == request_msg @@ -4706,7 +4730,6 @@ def test_create_online_return_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gsma_online_return_policy.CreateOnlineReturnPolicyRequest() - assert args[0] == request_msg @@ -4729,7 +4752,6 @@ def test_update_online_return_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gsma_online_return_policy.UpdateOnlineReturnPolicyRequest() - assert args[0] == request_msg @@ -4752,7 +4774,6 @@ def test_delete_online_return_policy_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = online_return_policy.DeleteOnlineReturnPolicyRequest() - assert args[0] == request_msg @@ -4809,7 +4830,6 @@ async def test_get_online_return_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = online_return_policy.GetOnlineReturnPolicyRequest() - assert args[0] == request_msg @@ -4838,7 +4858,6 @@ async def test_list_online_return_policies_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = online_return_policy.ListOnlineReturnPoliciesRequest() - assert args[0] == request_msg @@ -4881,7 +4900,6 @@ async def test_create_online_return_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gsma_online_return_policy.CreateOnlineReturnPolicyRequest() - assert args[0] == request_msg @@ -4924,7 +4942,6 @@ async def test_update_online_return_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gsma_online_return_policy.UpdateOnlineReturnPolicyRequest() - assert args[0] == request_msg @@ -4949,7 +4966,6 @@ async def test_delete_online_return_policy_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = online_return_policy.DeleteOnlineReturnPolicyRequest() - assert args[0] == request_msg @@ -5953,7 +5969,6 @@ def test_get_online_return_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = online_return_policy.GetOnlineReturnPolicyRequest() - assert args[0] == request_msg @@ -5975,7 +5990,6 @@ def test_list_online_return_policies_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = online_return_policy.ListOnlineReturnPoliciesRequest() - assert args[0] == request_msg @@ -5997,7 +6011,6 @@ def test_create_online_return_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gsma_online_return_policy.CreateOnlineReturnPolicyRequest() - assert args[0] == request_msg @@ -6019,7 +6032,6 @@ def test_update_online_return_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gsma_online_return_policy.UpdateOnlineReturnPolicyRequest() - assert args[0] == request_msg @@ -6041,7 +6053,6 @@ def test_delete_online_return_policy_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = online_return_policy.DeleteOnlineReturnPolicyRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_programs_service.py b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_programs_service.py index 0154b7c65fb1..80d56e4d59d6 100644 --- a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_programs_service.py +++ b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_programs_service.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 @@ -107,6 +108,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" @@ -1334,8 +1350,8 @@ def test_programs_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - programs.GetProgramRequest, - dict, + programs.GetProgramRequest(), + {}, ], ) def test_get_program(request_type, transport: str = "grpc"): @@ -1346,7 +1362,7 @@ def test_get_program(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_program), "__call__") as call: @@ -1396,9 +1412,10 @@ def test_get_program_non_empty_request_with_auto_populated_field(): client.get_program(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == programs.GetProgramRequest( + request_msg = programs.GetProgramRequest( name="name_value", ) + assert args[0] == request_msg def test_get_program_use_cached_wrapped_rpc(): @@ -1479,9 +1496,14 @@ async def test_get_program_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_program_async( - transport: str = "grpc_asyncio", request_type=programs.GetProgramRequest -): +@pytest.mark.parametrize( + "request_type", + [ + programs.GetProgramRequest(), + {}, + ], +) +async def test_get_program_async(request_type, transport: str = "grpc_asyncio"): client = ProgramsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1489,7 +1511,7 @@ async def test_get_program_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_program), "__call__") as call: @@ -1518,11 +1540,6 @@ async def test_get_program_async( assert response.active_region_codes == ["active_region_codes_value"] -@pytest.mark.asyncio -async def test_get_program_async_from_dict(): - await test_get_program_async(request_type=dict) - - def test_get_program_field_headers(): client = ProgramsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1665,8 +1682,8 @@ async def test_get_program_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - programs.ListProgramsRequest, - dict, + programs.ListProgramsRequest(), + {}, ], ) def test_list_programs(request_type, transport: str = "grpc"): @@ -1677,7 +1694,7 @@ def test_list_programs(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_programs), "__call__") as call: @@ -1722,10 +1739,11 @@ def test_list_programs_non_empty_request_with_auto_populated_field(): client.list_programs(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == programs.ListProgramsRequest( + request_msg = programs.ListProgramsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_programs_use_cached_wrapped_rpc(): @@ -1806,9 +1824,14 @@ async def test_list_programs_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_programs_async( - transport: str = "grpc_asyncio", request_type=programs.ListProgramsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + programs.ListProgramsRequest(), + {}, + ], +) +async def test_list_programs_async(request_type, transport: str = "grpc_asyncio"): client = ProgramsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1816,7 +1839,7 @@ async def test_list_programs_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_programs), "__call__") as call: @@ -1839,11 +1862,6 @@ async def test_list_programs_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_programs_async_from_dict(): - await test_list_programs_async(request_type=dict) - - def test_list_programs_field_headers(): client = ProgramsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2180,8 +2198,8 @@ async def test_list_programs_async_pages(): @pytest.mark.parametrize( "request_type", [ - programs.EnableProgramRequest, - dict, + programs.EnableProgramRequest(), + {}, ], ) def test_enable_program(request_type, transport: str = "grpc"): @@ -2192,7 +2210,7 @@ def test_enable_program(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.enable_program), "__call__") as call: @@ -2242,9 +2260,10 @@ def test_enable_program_non_empty_request_with_auto_populated_field(): client.enable_program(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == programs.EnableProgramRequest( + request_msg = programs.EnableProgramRequest( name="name_value", ) + assert args[0] == request_msg def test_enable_program_use_cached_wrapped_rpc(): @@ -2325,9 +2344,14 @@ async def test_enable_program_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_enable_program_async( - transport: str = "grpc_asyncio", request_type=programs.EnableProgramRequest -): +@pytest.mark.parametrize( + "request_type", + [ + programs.EnableProgramRequest(), + {}, + ], +) +async def test_enable_program_async(request_type, transport: str = "grpc_asyncio"): client = ProgramsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2335,7 +2359,7 @@ async def test_enable_program_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.enable_program), "__call__") as call: @@ -2364,11 +2388,6 @@ async def test_enable_program_async( assert response.active_region_codes == ["active_region_codes_value"] -@pytest.mark.asyncio -async def test_enable_program_async_from_dict(): - await test_enable_program_async(request_type=dict) - - def test_enable_program_field_headers(): client = ProgramsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2511,8 +2530,8 @@ async def test_enable_program_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - programs.DisableProgramRequest, - dict, + programs.DisableProgramRequest(), + {}, ], ) def test_disable_program(request_type, transport: str = "grpc"): @@ -2523,7 +2542,7 @@ def test_disable_program(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.disable_program), "__call__") as call: @@ -2573,9 +2592,10 @@ def test_disable_program_non_empty_request_with_auto_populated_field(): client.disable_program(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == programs.DisableProgramRequest( + request_msg = programs.DisableProgramRequest( name="name_value", ) + assert args[0] == request_msg def test_disable_program_use_cached_wrapped_rpc(): @@ -2656,9 +2676,14 @@ async def test_disable_program_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_disable_program_async( - transport: str = "grpc_asyncio", request_type=programs.DisableProgramRequest -): +@pytest.mark.parametrize( + "request_type", + [ + programs.DisableProgramRequest(), + {}, + ], +) +async def test_disable_program_async(request_type, transport: str = "grpc_asyncio"): client = ProgramsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2666,7 +2691,7 @@ async def test_disable_program_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.disable_program), "__call__") as call: @@ -2695,11 +2720,6 @@ async def test_disable_program_async( assert response.active_region_codes == ["active_region_codes_value"] -@pytest.mark.asyncio -async def test_disable_program_async_from_dict(): - await test_disable_program_async(request_type=dict) - - def test_disable_program_field_headers(): client = ProgramsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3746,7 +3766,6 @@ def test_get_program_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = programs.GetProgramRequest() - assert args[0] == request_msg @@ -3767,7 +3786,6 @@ def test_list_programs_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = programs.ListProgramsRequest() - assert args[0] == request_msg @@ -3788,7 +3806,6 @@ def test_enable_program_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = programs.EnableProgramRequest() - assert args[0] == request_msg @@ -3809,7 +3826,6 @@ def test_disable_program_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = programs.DisableProgramRequest() - assert args[0] == request_msg @@ -3853,7 +3869,6 @@ async def test_get_program_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = programs.GetProgramRequest() - assert args[0] == request_msg @@ -3880,7 +3895,6 @@ async def test_list_programs_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = programs.ListProgramsRequest() - assert args[0] == request_msg @@ -3910,7 +3924,6 @@ async def test_enable_program_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = programs.EnableProgramRequest() - assert args[0] == request_msg @@ -3940,7 +3953,6 @@ async def test_disable_program_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = programs.DisableProgramRequest() - assert args[0] == request_msg @@ -4501,7 +4513,6 @@ def test_get_program_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = programs.GetProgramRequest() - assert args[0] == request_msg @@ -4521,7 +4532,6 @@ def test_list_programs_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = programs.ListProgramsRequest() - assert args[0] == request_msg @@ -4541,7 +4551,6 @@ def test_enable_program_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = programs.EnableProgramRequest() - assert args[0] == request_msg @@ -4561,7 +4570,6 @@ def test_disable_program_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = programs.DisableProgramRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_regions_service.py b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_regions_service.py index 09e8e835a9fa..cd69a0beca0b 100644 --- a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_regions_service.py +++ b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_regions_service.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 @@ -109,6 +110,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" @@ -1312,8 +1328,8 @@ def test_regions_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - regions.GetRegionRequest, - dict, + regions.GetRegionRequest(), + {}, ], ) def test_get_region(request_type, transport: str = "grpc"): @@ -1324,7 +1340,7 @@ def test_get_region(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_region), "__call__") as call: @@ -1370,9 +1386,10 @@ def test_get_region_non_empty_request_with_auto_populated_field(): client.get_region(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == regions.GetRegionRequest( + request_msg = regions.GetRegionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_region_use_cached_wrapped_rpc(): @@ -1451,9 +1468,14 @@ async def test_get_region_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_get_region_async( - transport: str = "grpc_asyncio", request_type=regions.GetRegionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + regions.GetRegionRequest(), + {}, + ], +) +async def test_get_region_async(request_type, transport: str = "grpc_asyncio"): client = RegionsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1461,7 +1483,7 @@ async def test_get_region_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_region), "__call__") as call: @@ -1486,11 +1508,6 @@ async def test_get_region_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_get_region_async_from_dict(): - await test_get_region_async(request_type=dict) - - def test_get_region_field_headers(): client = RegionsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1633,8 +1650,8 @@ async def test_get_region_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - regions.CreateRegionRequest, - dict, + regions.CreateRegionRequest(), + {}, ], ) def test_create_region(request_type, transport: str = "grpc"): @@ -1645,7 +1662,7 @@ def test_create_region(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_region), "__call__") as call: @@ -1692,10 +1709,11 @@ def test_create_region_non_empty_request_with_auto_populated_field(): client.create_region(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == regions.CreateRegionRequest( + request_msg = regions.CreateRegionRequest( parent="parent_value", region_id="region_id_value", ) + assert args[0] == request_msg def test_create_region_use_cached_wrapped_rpc(): @@ -1776,9 +1794,14 @@ async def test_create_region_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_region_async( - transport: str = "grpc_asyncio", request_type=regions.CreateRegionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + regions.CreateRegionRequest(), + {}, + ], +) +async def test_create_region_async(request_type, transport: str = "grpc_asyncio"): client = RegionsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1786,7 +1809,7 @@ async def test_create_region_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_region), "__call__") as call: @@ -1811,11 +1834,6 @@ async def test_create_region_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_create_region_async_from_dict(): - await test_create_region_async(request_type=dict) - - def test_create_region_field_headers(): client = RegionsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1978,8 +1996,8 @@ async def test_create_region_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - regions.UpdateRegionRequest, - dict, + regions.UpdateRegionRequest(), + {}, ], ) def test_update_region(request_type, transport: str = "grpc"): @@ -1990,7 +2008,7 @@ def test_update_region(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_region), "__call__") as call: @@ -2034,7 +2052,8 @@ def test_update_region_non_empty_request_with_auto_populated_field(): client.update_region(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == regions.UpdateRegionRequest() + request_msg = regions.UpdateRegionRequest() + assert args[0] == request_msg def test_update_region_use_cached_wrapped_rpc(): @@ -2115,9 +2134,14 @@ async def test_update_region_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_region_async( - transport: str = "grpc_asyncio", request_type=regions.UpdateRegionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + regions.UpdateRegionRequest(), + {}, + ], +) +async def test_update_region_async(request_type, transport: str = "grpc_asyncio"): client = RegionsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2125,7 +2149,7 @@ async def test_update_region_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_region), "__call__") as call: @@ -2150,11 +2174,6 @@ async def test_update_region_async( assert response.display_name == "display_name_value" -@pytest.mark.asyncio -async def test_update_region_async_from_dict(): - await test_update_region_async(request_type=dict) - - def test_update_region_field_headers(): client = RegionsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2307,8 +2326,8 @@ async def test_update_region_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - regions.DeleteRegionRequest, - dict, + regions.DeleteRegionRequest(), + {}, ], ) def test_delete_region(request_type, transport: str = "grpc"): @@ -2319,7 +2338,7 @@ def test_delete_region(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_region), "__call__") as call: @@ -2360,9 +2379,10 @@ def test_delete_region_non_empty_request_with_auto_populated_field(): client.delete_region(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == regions.DeleteRegionRequest( + request_msg = regions.DeleteRegionRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_region_use_cached_wrapped_rpc(): @@ -2443,9 +2463,14 @@ async def test_delete_region_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_region_async( - transport: str = "grpc_asyncio", request_type=regions.DeleteRegionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + regions.DeleteRegionRequest(), + {}, + ], +) +async def test_delete_region_async(request_type, transport: str = "grpc_asyncio"): client = RegionsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2453,7 +2478,7 @@ async def test_delete_region_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_region), "__call__") as call: @@ -2471,11 +2496,6 @@ async def test_delete_region_async( assert response is None -@pytest.mark.asyncio -async def test_delete_region_async_from_dict(): - await test_delete_region_async(request_type=dict) - - def test_delete_region_field_headers(): client = RegionsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2618,8 +2638,8 @@ async def test_delete_region_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - regions.ListRegionsRequest, - dict, + regions.ListRegionsRequest(), + {}, ], ) def test_list_regions(request_type, transport: str = "grpc"): @@ -2630,7 +2650,7 @@ def test_list_regions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_regions), "__call__") as call: @@ -2675,10 +2695,11 @@ def test_list_regions_non_empty_request_with_auto_populated_field(): client.list_regions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == regions.ListRegionsRequest( + request_msg = regions.ListRegionsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_regions_use_cached_wrapped_rpc(): @@ -2759,9 +2780,14 @@ async def test_list_regions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_regions_async( - transport: str = "grpc_asyncio", request_type=regions.ListRegionsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + regions.ListRegionsRequest(), + {}, + ], +) +async def test_list_regions_async(request_type, transport: str = "grpc_asyncio"): client = RegionsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2769,7 +2795,7 @@ async def test_list_regions_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_regions), "__call__") as call: @@ -2792,11 +2818,6 @@ async def test_list_regions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_regions_async_from_dict(): - await test_list_regions_async(request_type=dict) - - def test_list_regions_field_headers(): client = RegionsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4229,7 +4250,6 @@ def test_get_region_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = regions.GetRegionRequest() - assert args[0] == request_msg @@ -4250,7 +4270,6 @@ def test_create_region_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = regions.CreateRegionRequest() - assert args[0] == request_msg @@ -4271,7 +4290,6 @@ def test_update_region_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = regions.UpdateRegionRequest() - assert args[0] == request_msg @@ -4292,7 +4310,6 @@ def test_delete_region_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = regions.DeleteRegionRequest() - assert args[0] == request_msg @@ -4313,7 +4330,6 @@ def test_list_regions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = regions.ListRegionsRequest() - assert args[0] == request_msg @@ -4355,7 +4371,6 @@ async def test_get_region_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = regions.GetRegionRequest() - assert args[0] == request_msg @@ -4383,7 +4398,6 @@ async def test_create_region_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = regions.CreateRegionRequest() - assert args[0] == request_msg @@ -4411,7 +4425,6 @@ async def test_update_region_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = regions.UpdateRegionRequest() - assert args[0] == request_msg @@ -4434,7 +4447,6 @@ async def test_delete_region_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = regions.DeleteRegionRequest() - assert args[0] == request_msg @@ -4461,7 +4473,6 @@ async def test_list_regions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = regions.ListRegionsRequest() - assert args[0] == request_msg @@ -5269,7 +5280,6 @@ def test_get_region_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = regions.GetRegionRequest() - assert args[0] == request_msg @@ -5289,7 +5299,6 @@ def test_create_region_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = regions.CreateRegionRequest() - assert args[0] == request_msg @@ -5309,7 +5318,6 @@ def test_update_region_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = regions.UpdateRegionRequest() - assert args[0] == request_msg @@ -5329,7 +5337,6 @@ def test_delete_region_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = regions.DeleteRegionRequest() - assert args[0] == request_msg @@ -5349,7 +5356,6 @@ def test_list_regions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = regions.ListRegionsRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_shipping_settings_service.py b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_shipping_settings_service.py index b5640a1c0a41..b934dbe5d432 100644 --- a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_shipping_settings_service.py +++ b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_shipping_settings_service.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 @@ -107,6 +108,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" @@ -1376,8 +1392,8 @@ def test_shipping_settings_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - shippingsettings.GetShippingSettingsRequest, - dict, + shippingsettings.GetShippingSettingsRequest(), + {}, ], ) def test_get_shipping_settings(request_type, transport: str = "grpc"): @@ -1388,7 +1404,7 @@ def test_get_shipping_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( @@ -1438,9 +1454,10 @@ def test_get_shipping_settings_non_empty_request_with_auto_populated_field(): client.get_shipping_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == shippingsettings.GetShippingSettingsRequest( + request_msg = shippingsettings.GetShippingSettingsRequest( name="name_value", ) + assert args[0] == request_msg def test_get_shipping_settings_use_cached_wrapped_rpc(): @@ -1526,9 +1543,15 @@ async def test_get_shipping_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + shippingsettings.GetShippingSettingsRequest(), + {}, + ], +) async def test_get_shipping_settings_async( - transport: str = "grpc_asyncio", - request_type=shippingsettings.GetShippingSettingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = ShippingSettingsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1537,7 +1560,7 @@ async def test_get_shipping_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( @@ -1564,11 +1587,6 @@ async def test_get_shipping_settings_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_get_shipping_settings_async_from_dict(): - await test_get_shipping_settings_async(request_type=dict) - - def test_get_shipping_settings_field_headers(): client = ShippingSettingsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1723,8 +1741,8 @@ async def test_get_shipping_settings_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - shippingsettings.InsertShippingSettingsRequest, - dict, + shippingsettings.InsertShippingSettingsRequest(), + {}, ], ) def test_insert_shipping_settings(request_type, transport: str = "grpc"): @@ -1735,7 +1753,7 @@ def test_insert_shipping_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( @@ -1785,9 +1803,10 @@ def test_insert_shipping_settings_non_empty_request_with_auto_populated_field(): client.insert_shipping_settings(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == shippingsettings.InsertShippingSettingsRequest( + request_msg = shippingsettings.InsertShippingSettingsRequest( parent="parent_value", ) + assert args[0] == request_msg def test_insert_shipping_settings_use_cached_wrapped_rpc(): @@ -1873,9 +1892,15 @@ async def test_insert_shipping_settings_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + shippingsettings.InsertShippingSettingsRequest(), + {}, + ], +) async def test_insert_shipping_settings_async( - transport: str = "grpc_asyncio", - request_type=shippingsettings.InsertShippingSettingsRequest, + request_type, transport: str = "grpc_asyncio" ): client = ShippingSettingsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1884,7 +1909,7 @@ async def test_insert_shipping_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( @@ -1911,11 +1936,6 @@ async def test_insert_shipping_settings_async( assert response.etag == "etag_value" -@pytest.mark.asyncio -async def test_insert_shipping_settings_async_from_dict(): - await test_insert_shipping_settings_async(request_type=dict) - - def test_insert_shipping_settings_field_headers(): client = ShippingSettingsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2423,7 +2443,6 @@ def test_get_shipping_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = shippingsettings.GetShippingSettingsRequest() - assert args[0] == request_msg @@ -2446,7 +2465,6 @@ def test_insert_shipping_settings_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = shippingsettings.InsertShippingSettingsRequest() - assert args[0] == request_msg @@ -2490,7 +2508,6 @@ async def test_get_shipping_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = shippingsettings.GetShippingSettingsRequest() - assert args[0] == request_msg @@ -2520,7 +2537,6 @@ async def test_insert_shipping_settings_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = shippingsettings.InsertShippingSettingsRequest() - assert args[0] == request_msg @@ -3047,7 +3063,6 @@ def test_get_shipping_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = shippingsettings.GetShippingSettingsRequest() - assert args[0] == request_msg @@ -3069,7 +3084,6 @@ def test_insert_shipping_settings_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = shippingsettings.InsertShippingSettingsRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_terms_of_service_agreement_state_service.py b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_terms_of_service_agreement_state_service.py index 1626091ef5dc..8bfe23f30c2b 100644 --- a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_terms_of_service_agreement_state_service.py +++ b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_terms_of_service_agreement_state_service.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 @@ -109,6 +110,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" @@ -1453,8 +1469,8 @@ def test_terms_of_service_agreement_state_service_client_create_channel_credenti @pytest.mark.parametrize( "request_type", [ - termsofserviceagreementstate.GetTermsOfServiceAgreementStateRequest, - dict, + termsofserviceagreementstate.GetTermsOfServiceAgreementStateRequest(), + {}, ], ) def test_get_terms_of_service_agreement_state(request_type, transport: str = "grpc"): @@ -1465,7 +1481,7 @@ def test_get_terms_of_service_agreement_state(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( @@ -1522,11 +1538,12 @@ def test_get_terms_of_service_agreement_state_non_empty_request_with_auto_popula client.get_terms_of_service_agreement_state(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == termsofserviceagreementstate.GetTermsOfServiceAgreementStateRequest( - name="name_value", + request_msg = ( + termsofserviceagreementstate.GetTermsOfServiceAgreementStateRequest( + name="name_value", + ) ) + assert args[0] == request_msg def test_get_terms_of_service_agreement_state_use_cached_wrapped_rpc(): @@ -1612,9 +1629,15 @@ async def test_get_terms_of_service_agreement_state_async_use_cached_wrapped_rpc @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + termsofserviceagreementstate.GetTermsOfServiceAgreementStateRequest(), + {}, + ], +) async def test_get_terms_of_service_agreement_state_async( - transport: str = "grpc_asyncio", - request_type=termsofserviceagreementstate.GetTermsOfServiceAgreementStateRequest, + request_type, transport: str = "grpc_asyncio" ): client = TermsOfServiceAgreementStateServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1623,7 +1646,7 @@ async def test_get_terms_of_service_agreement_state_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( @@ -1657,11 +1680,6 @@ async def test_get_terms_of_service_agreement_state_async( ) -@pytest.mark.asyncio -async def test_get_terms_of_service_agreement_state_async_from_dict(): - await test_get_terms_of_service_agreement_state_async(request_type=dict) - - def test_get_terms_of_service_agreement_state_field_headers(): client = TermsOfServiceAgreementStateServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1816,8 +1834,8 @@ async def test_get_terms_of_service_agreement_state_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - termsofserviceagreementstate.RetrieveForApplicationTermsOfServiceAgreementStateRequest, - dict, + termsofserviceagreementstate.RetrieveForApplicationTermsOfServiceAgreementStateRequest(), + {}, ], ) def test_retrieve_for_application_terms_of_service_agreement_state( @@ -1830,7 +1848,7 @@ def test_retrieve_for_application_terms_of_service_agreement_state( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1897,12 +1915,10 @@ def test_retrieve_for_application_terms_of_service_agreement_state_non_empty_req ) call.assert_called() _, args, _ = call.mock_calls[0] - assert ( - args[0] - == termsofserviceagreementstate.RetrieveForApplicationTermsOfServiceAgreementStateRequest( - parent="parent_value", - ) + request_msg = termsofserviceagreementstate.RetrieveForApplicationTermsOfServiceAgreementStateRequest( + parent="parent_value", ) + assert args[0] == request_msg def test_retrieve_for_application_terms_of_service_agreement_state_use_cached_wrapped_rpc(): @@ -1988,9 +2004,15 @@ async def test_retrieve_for_application_terms_of_service_agreement_state_async_u @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + termsofserviceagreementstate.RetrieveForApplicationTermsOfServiceAgreementStateRequest(), + {}, + ], +) async def test_retrieve_for_application_terms_of_service_agreement_state_async( - transport: str = "grpc_asyncio", - request_type=termsofserviceagreementstate.RetrieveForApplicationTermsOfServiceAgreementStateRequest, + request_type, transport: str = "grpc_asyncio" ): client = TermsOfServiceAgreementStateServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1999,7 +2021,7 @@ async def test_retrieve_for_application_terms_of_service_agreement_state_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( @@ -2040,13 +2062,6 @@ async def test_retrieve_for_application_terms_of_service_agreement_state_async( ) -@pytest.mark.asyncio -async def test_retrieve_for_application_terms_of_service_agreement_state_async_from_dict(): - await test_retrieve_for_application_terms_of_service_agreement_state_async( - request_type=dict - ) - - def test_retrieve_for_application_terms_of_service_agreement_state_field_headers(): client = TermsOfServiceAgreementStateServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2729,7 +2744,6 @@ def test_get_terms_of_service_agreement_state_empty_call_grpc(): request_msg = ( termsofserviceagreementstate.GetTermsOfServiceAgreementStateRequest() ) - assert args[0] == request_msg @@ -2755,7 +2769,6 @@ def test_retrieve_for_application_terms_of_service_agreement_state_empty_call_gr call.assert_called() _, args, _ = call.mock_calls[0] request_msg = termsofserviceagreementstate.RetrieveForApplicationTermsOfServiceAgreementStateRequest() - assert args[0] == request_msg @@ -2802,7 +2815,6 @@ async def test_get_terms_of_service_agreement_state_empty_call_grpc_asyncio(): request_msg = ( termsofserviceagreementstate.GetTermsOfServiceAgreementStateRequest() ) - assert args[0] == request_msg @@ -2838,7 +2850,6 @@ async def test_retrieve_for_application_terms_of_service_agreement_state_empty_c call.assert_called() _, args, _ = call.mock_calls[0] request_msg = termsofserviceagreementstate.RetrieveForApplicationTermsOfServiceAgreementStateRequest() - assert args[0] == request_msg @@ -3186,7 +3197,6 @@ def test_get_terms_of_service_agreement_state_empty_call_rest(): request_msg = ( termsofserviceagreementstate.GetTermsOfServiceAgreementStateRequest() ) - assert args[0] == request_msg @@ -3211,7 +3221,6 @@ def test_retrieve_for_application_terms_of_service_agreement_state_empty_call_re call.assert_called() _, args, _ = call.mock_calls[0] request_msg = termsofserviceagreementstate.RetrieveForApplicationTermsOfServiceAgreementStateRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_terms_of_service_service.py b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_terms_of_service_service.py index 7258e2e4efce..8aeebf94407e 100644 --- a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_terms_of_service_service.py +++ b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_terms_of_service_service.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 @@ -109,6 +110,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" @@ -1376,8 +1392,8 @@ def test_terms_of_service_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - termsofservice.GetTermsOfServiceRequest, - dict, + termsofservice.GetTermsOfServiceRequest(), + {}, ], ) def test_get_terms_of_service(request_type, transport: str = "grpc"): @@ -1388,7 +1404,7 @@ def test_get_terms_of_service(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1444,9 +1460,10 @@ def test_get_terms_of_service_non_empty_request_with_auto_populated_field(): client.get_terms_of_service(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == termsofservice.GetTermsOfServiceRequest( + request_msg = termsofservice.GetTermsOfServiceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_terms_of_service_use_cached_wrapped_rpc(): @@ -1531,9 +1548,15 @@ async def test_get_terms_of_service_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + termsofservice.GetTermsOfServiceRequest(), + {}, + ], +) async def test_get_terms_of_service_async( - transport: str = "grpc_asyncio", - request_type=termsofservice.GetTermsOfServiceRequest, + request_type, transport: str = "grpc_asyncio" ): client = TermsOfServiceServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1542,7 +1565,7 @@ async def test_get_terms_of_service_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( @@ -1575,11 +1598,6 @@ async def test_get_terms_of_service_async( assert response.external is True -@pytest.mark.asyncio -async def test_get_terms_of_service_async_from_dict(): - await test_get_terms_of_service_async(request_type=dict) - - def test_get_terms_of_service_field_headers(): client = TermsOfServiceServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1734,8 +1752,8 @@ async def test_get_terms_of_service_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - termsofservice.RetrieveLatestTermsOfServiceRequest, - dict, + termsofservice.RetrieveLatestTermsOfServiceRequest(), + {}, ], ) def test_retrieve_latest_terms_of_service(request_type, transport: str = "grpc"): @@ -1746,7 +1764,7 @@ def test_retrieve_latest_terms_of_service(request_type, transport: str = "grpc") # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1802,9 +1820,10 @@ def test_retrieve_latest_terms_of_service_non_empty_request_with_auto_populated_ client.retrieve_latest_terms_of_service(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == termsofservice.RetrieveLatestTermsOfServiceRequest( + request_msg = termsofservice.RetrieveLatestTermsOfServiceRequest( region_code="region_code_value", ) + assert args[0] == request_msg def test_retrieve_latest_terms_of_service_use_cached_wrapped_rpc(): @@ -1890,9 +1909,15 @@ async def test_retrieve_latest_terms_of_service_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + termsofservice.RetrieveLatestTermsOfServiceRequest(), + {}, + ], +) async def test_retrieve_latest_terms_of_service_async( - transport: str = "grpc_asyncio", - request_type=termsofservice.RetrieveLatestTermsOfServiceRequest, + request_type, transport: str = "grpc_asyncio" ): client = TermsOfServiceServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1901,7 +1926,7 @@ async def test_retrieve_latest_terms_of_service_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( @@ -1934,16 +1959,11 @@ async def test_retrieve_latest_terms_of_service_async( assert response.external is True -@pytest.mark.asyncio -async def test_retrieve_latest_terms_of_service_async_from_dict(): - await test_retrieve_latest_terms_of_service_async(request_type=dict) - - @pytest.mark.parametrize( "request_type", [ - termsofservice.AcceptTermsOfServiceRequest, - dict, + termsofservice.AcceptTermsOfServiceRequest(), + {}, ], ) def test_accept_terms_of_service(request_type, transport: str = "grpc"): @@ -1954,7 +1974,7 @@ def test_accept_terms_of_service(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2001,11 +2021,12 @@ def test_accept_terms_of_service_non_empty_request_with_auto_populated_field(): client.accept_terms_of_service(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == termsofservice.AcceptTermsOfServiceRequest( + request_msg = termsofservice.AcceptTermsOfServiceRequest( name="name_value", account="account_value", region_code="region_code_value", ) + assert args[0] == request_msg def test_accept_terms_of_service_use_cached_wrapped_rpc(): @@ -2091,9 +2112,15 @@ async def test_accept_terms_of_service_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + termsofservice.AcceptTermsOfServiceRequest(), + {}, + ], +) async def test_accept_terms_of_service_async( - transport: str = "grpc_asyncio", - request_type=termsofservice.AcceptTermsOfServiceRequest, + request_type, transport: str = "grpc_asyncio" ): client = TermsOfServiceServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2102,7 +2129,7 @@ async def test_accept_terms_of_service_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( @@ -2122,11 +2149,6 @@ async def test_accept_terms_of_service_async( assert response is None -@pytest.mark.asyncio -async def test_accept_terms_of_service_async_from_dict(): - await test_accept_terms_of_service_async(request_type=dict) - - def test_accept_terms_of_service_field_headers(): client = TermsOfServiceServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2959,7 +2981,6 @@ def test_get_terms_of_service_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = termsofservice.GetTermsOfServiceRequest() - assert args[0] == request_msg @@ -2982,7 +3003,6 @@ def test_retrieve_latest_terms_of_service_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = termsofservice.RetrieveLatestTermsOfServiceRequest() - assert args[0] == request_msg @@ -3005,7 +3025,6 @@ def test_accept_terms_of_service_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = termsofservice.AcceptTermsOfServiceRequest() - assert args[0] == request_msg @@ -3052,7 +3071,6 @@ async def test_get_terms_of_service_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = termsofservice.GetTermsOfServiceRequest() - assert args[0] == request_msg @@ -3085,7 +3103,6 @@ async def test_retrieve_latest_terms_of_service_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = termsofservice.RetrieveLatestTermsOfServiceRequest() - assert args[0] == request_msg @@ -3110,7 +3127,6 @@ async def test_accept_terms_of_service_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = termsofservice.AcceptTermsOfServiceRequest() - assert args[0] == request_msg @@ -3541,7 +3557,6 @@ def test_get_terms_of_service_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = termsofservice.GetTermsOfServiceRequest() - assert args[0] == request_msg @@ -3563,7 +3578,6 @@ def test_retrieve_latest_terms_of_service_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = termsofservice.RetrieveLatestTermsOfServiceRequest() - assert args[0] == request_msg @@ -3585,7 +3599,6 @@ def test_accept_terms_of_service_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = termsofservice.AcceptTermsOfServiceRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_user_service.py b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_user_service.py index ffe815408242..d192eb55b080 100644 --- a/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_user_service.py +++ b/packages/google-shopping-merchant-accounts/tests/unit/gapic/merchant_accounts_v1beta/test_user_service.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 @@ -109,6 +110,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" @@ -1274,8 +1290,8 @@ def test_user_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - user.GetUserRequest, - dict, + user.GetUserRequest(), + {}, ], ) def test_get_user(request_type, transport: str = "grpc"): @@ -1286,7 +1302,7 @@ def test_get_user(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_user), "__call__") as call: @@ -1334,9 +1350,10 @@ def test_get_user_non_empty_request_with_auto_populated_field(): client.get_user(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == user.GetUserRequest( + request_msg = user.GetUserRequest( name="name_value", ) + assert args[0] == request_msg def test_get_user_use_cached_wrapped_rpc(): @@ -1415,9 +1432,14 @@ async def test_get_user_async_use_cached_wrapped_rpc(transport: str = "grpc_asyn @pytest.mark.asyncio -async def test_get_user_async( - transport: str = "grpc_asyncio", request_type=user.GetUserRequest -): +@pytest.mark.parametrize( + "request_type", + [ + user.GetUserRequest(), + {}, + ], +) +async def test_get_user_async(request_type, transport: str = "grpc_asyncio"): client = UserServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1425,7 +1447,7 @@ async def test_get_user_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_user), "__call__") as call: @@ -1452,11 +1474,6 @@ async def test_get_user_async( assert response.access_rights == [accessright.AccessRight.STANDARD] -@pytest.mark.asyncio -async def test_get_user_async_from_dict(): - await test_get_user_async(request_type=dict) - - def test_get_user_field_headers(): client = UserServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1599,8 +1616,8 @@ async def test_get_user_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gsma_user.CreateUserRequest, - dict, + gsma_user.CreateUserRequest(), + {}, ], ) def test_create_user(request_type, transport: str = "grpc"): @@ -1611,7 +1628,7 @@ def test_create_user(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_user), "__call__") as call: @@ -1660,10 +1677,11 @@ def test_create_user_non_empty_request_with_auto_populated_field(): client.create_user(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gsma_user.CreateUserRequest( + request_msg = gsma_user.CreateUserRequest( parent="parent_value", user_id="user_id_value", ) + assert args[0] == request_msg def test_create_user_use_cached_wrapped_rpc(): @@ -1744,9 +1762,14 @@ async def test_create_user_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_user_async( - transport: str = "grpc_asyncio", request_type=gsma_user.CreateUserRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gsma_user.CreateUserRequest(), + {}, + ], +) +async def test_create_user_async(request_type, transport: str = "grpc_asyncio"): client = UserServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1754,7 +1777,7 @@ async def test_create_user_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_user), "__call__") as call: @@ -1781,11 +1804,6 @@ async def test_create_user_async( assert response.access_rights == [accessright.AccessRight.STANDARD] -@pytest.mark.asyncio -async def test_create_user_async_from_dict(): - await test_create_user_async(request_type=dict) - - def test_create_user_field_headers(): client = UserServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1938,8 +1956,8 @@ async def test_create_user_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - user.DeleteUserRequest, - dict, + user.DeleteUserRequest(), + {}, ], ) def test_delete_user(request_type, transport: str = "grpc"): @@ -1950,7 +1968,7 @@ def test_delete_user(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_user), "__call__") as call: @@ -1991,9 +2009,10 @@ def test_delete_user_non_empty_request_with_auto_populated_field(): client.delete_user(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == user.DeleteUserRequest( + request_msg = user.DeleteUserRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_user_use_cached_wrapped_rpc(): @@ -2074,9 +2093,14 @@ async def test_delete_user_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_user_async( - transport: str = "grpc_asyncio", request_type=user.DeleteUserRequest -): +@pytest.mark.parametrize( + "request_type", + [ + user.DeleteUserRequest(), + {}, + ], +) +async def test_delete_user_async(request_type, transport: str = "grpc_asyncio"): client = UserServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2084,7 +2108,7 @@ async def test_delete_user_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_user), "__call__") as call: @@ -2102,11 +2126,6 @@ async def test_delete_user_async( assert response is None -@pytest.mark.asyncio -async def test_delete_user_async_from_dict(): - await test_delete_user_async(request_type=dict) - - def test_delete_user_field_headers(): client = UserServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2249,8 +2268,8 @@ async def test_delete_user_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - gsma_user.UpdateUserRequest, - dict, + gsma_user.UpdateUserRequest(), + {}, ], ) def test_update_user(request_type, transport: str = "grpc"): @@ -2261,7 +2280,7 @@ def test_update_user(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_user), "__call__") as call: @@ -2307,7 +2326,8 @@ def test_update_user_non_empty_request_with_auto_populated_field(): client.update_user(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == gsma_user.UpdateUserRequest() + request_msg = gsma_user.UpdateUserRequest() + assert args[0] == request_msg def test_update_user_use_cached_wrapped_rpc(): @@ -2388,9 +2408,14 @@ async def test_update_user_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_user_async( - transport: str = "grpc_asyncio", request_type=gsma_user.UpdateUserRequest -): +@pytest.mark.parametrize( + "request_type", + [ + gsma_user.UpdateUserRequest(), + {}, + ], +) +async def test_update_user_async(request_type, transport: str = "grpc_asyncio"): client = UserServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2398,7 +2423,7 @@ async def test_update_user_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_user), "__call__") as call: @@ -2425,11 +2450,6 @@ async def test_update_user_async( assert response.access_rights == [accessright.AccessRight.STANDARD] -@pytest.mark.asyncio -async def test_update_user_async_from_dict(): - await test_update_user_async(request_type=dict) - - def test_update_user_field_headers(): client = UserServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2582,8 +2602,8 @@ async def test_update_user_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - user.ListUsersRequest, - dict, + user.ListUsersRequest(), + {}, ], ) def test_list_users(request_type, transport: str = "grpc"): @@ -2594,7 +2614,7 @@ def test_list_users(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_users), "__call__") as call: @@ -2639,10 +2659,11 @@ def test_list_users_non_empty_request_with_auto_populated_field(): client.list_users(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == user.ListUsersRequest( + request_msg = user.ListUsersRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_users_use_cached_wrapped_rpc(): @@ -2721,9 +2742,14 @@ async def test_list_users_async_use_cached_wrapped_rpc(transport: str = "grpc_as @pytest.mark.asyncio -async def test_list_users_async( - transport: str = "grpc_asyncio", request_type=user.ListUsersRequest -): +@pytest.mark.parametrize( + "request_type", + [ + user.ListUsersRequest(), + {}, + ], +) +async def test_list_users_async(request_type, transport: str = "grpc_asyncio"): client = UserServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2731,7 +2757,7 @@ async def test_list_users_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_users), "__call__") as call: @@ -2754,11 +2780,6 @@ async def test_list_users_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_users_async_from_dict(): - await test_list_users_async(request_type=dict) - - def test_list_users_field_headers(): client = UserServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4197,7 +4218,6 @@ def test_get_user_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user.GetUserRequest() - assert args[0] == request_msg @@ -4218,7 +4238,6 @@ def test_create_user_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gsma_user.CreateUserRequest() - assert args[0] == request_msg @@ -4239,7 +4258,6 @@ def test_delete_user_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user.DeleteUserRequest() - assert args[0] == request_msg @@ -4260,7 +4278,6 @@ def test_update_user_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gsma_user.UpdateUserRequest() - assert args[0] == request_msg @@ -4281,7 +4298,6 @@ def test_list_users_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user.ListUsersRequest() - assert args[0] == request_msg @@ -4324,7 +4340,6 @@ async def test_get_user_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user.GetUserRequest() - assert args[0] == request_msg @@ -4353,7 +4368,6 @@ async def test_create_user_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gsma_user.CreateUserRequest() - assert args[0] == request_msg @@ -4376,7 +4390,6 @@ async def test_delete_user_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user.DeleteUserRequest() - assert args[0] == request_msg @@ -4405,7 +4418,6 @@ async def test_update_user_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gsma_user.UpdateUserRequest() - assert args[0] == request_msg @@ -4432,7 +4444,6 @@ async def test_list_users_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user.ListUsersRequest() - assert args[0] == request_msg @@ -5226,7 +5237,6 @@ def test_get_user_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user.GetUserRequest() - assert args[0] == request_msg @@ -5246,7 +5256,6 @@ def test_create_user_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gsma_user.CreateUserRequest() - assert args[0] == request_msg @@ -5266,7 +5275,6 @@ def test_delete_user_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user.DeleteUserRequest() - assert args[0] == request_msg @@ -5286,7 +5294,6 @@ def test_update_user_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = gsma_user.UpdateUserRequest() - assert args[0] == request_msg @@ -5306,7 +5313,6 @@ def test_list_users_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = user.ListUsersRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-conversions/noxfile.py b/packages/google-shopping-merchant-conversions/noxfile.py index 84a68f49fcdd..a68d0e59fb95 100644 --- a/packages/google-shopping-merchant-conversions/noxfile.py +++ b/packages/google-shopping-merchant-conversions/noxfile.py @@ -47,7 +47,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-shopping-merchant-conversions" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-shopping-merchant-conversions/setup.py b/packages/google-shopping-merchant-conversions/setup.py index 255da389a6f4..b9738abb789e 100644 --- a/packages/google-shopping-merchant-conversions/setup.py +++ b/packages/google-shopping-merchant-conversions/setup.py @@ -45,7 +45,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/google-shopping-merchant-conversions/testing/constraints-3.10.txt b/packages/google-shopping-merchant-conversions/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-shopping-merchant-conversions/testing/constraints-3.10.txt +++ b/packages/google-shopping-merchant-conversions/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-shopping-merchant-conversions/tests/unit/gapic/merchant_conversions_v1/test_conversion_sources_service.py b/packages/google-shopping-merchant-conversions/tests/unit/gapic/merchant_conversions_v1/test_conversion_sources_service.py index 643551d6eb86..fa2fbe9ab112 100644 --- a/packages/google-shopping-merchant-conversions/tests/unit/gapic/merchant_conversions_v1/test_conversion_sources_service.py +++ b/packages/google-shopping-merchant-conversions/tests/unit/gapic/merchant_conversions_v1/test_conversion_sources_service.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 @@ -109,6 +110,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" @@ -1384,8 +1400,8 @@ def test_conversion_sources_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - conversionsources.CreateConversionSourceRequest, - dict, + conversionsources.CreateConversionSourceRequest(), + {}, ], ) def test_create_conversion_source(request_type, transport: str = "grpc"): @@ -1396,7 +1412,7 @@ def test_create_conversion_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( @@ -1448,9 +1464,10 @@ def test_create_conversion_source_non_empty_request_with_auto_populated_field(): client.create_conversion_source(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversionsources.CreateConversionSourceRequest( + request_msg = conversionsources.CreateConversionSourceRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_conversion_source_use_cached_wrapped_rpc(): @@ -1536,9 +1553,15 @@ async def test_create_conversion_source_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + conversionsources.CreateConversionSourceRequest(), + {}, + ], +) async def test_create_conversion_source_async( - transport: str = "grpc_asyncio", - request_type=conversionsources.CreateConversionSourceRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConversionSourcesServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1547,7 +1570,7 @@ async def test_create_conversion_source_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( @@ -1576,11 +1599,6 @@ async def test_create_conversion_source_async( assert response.controller == conversionsources.ConversionSource.Controller.MERCHANT -@pytest.mark.asyncio -async def test_create_conversion_source_async_from_dict(): - await test_create_conversion_source_async(request_type=dict) - - def test_create_conversion_source_field_headers(): client = ConversionSourcesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1769,8 +1787,8 @@ async def test_create_conversion_source_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversionsources.UpdateConversionSourceRequest, - dict, + conversionsources.UpdateConversionSourceRequest(), + {}, ], ) def test_update_conversion_source(request_type, transport: str = "grpc"): @@ -1781,7 +1799,7 @@ def test_update_conversion_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( @@ -1831,7 +1849,8 @@ def test_update_conversion_source_non_empty_request_with_auto_populated_field(): client.update_conversion_source(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversionsources.UpdateConversionSourceRequest() + request_msg = conversionsources.UpdateConversionSourceRequest() + assert args[0] == request_msg def test_update_conversion_source_use_cached_wrapped_rpc(): @@ -1917,9 +1936,15 @@ async def test_update_conversion_source_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + conversionsources.UpdateConversionSourceRequest(), + {}, + ], +) async def test_update_conversion_source_async( - transport: str = "grpc_asyncio", - request_type=conversionsources.UpdateConversionSourceRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConversionSourcesServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1928,7 +1953,7 @@ async def test_update_conversion_source_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( @@ -1957,11 +1982,6 @@ async def test_update_conversion_source_async( assert response.controller == conversionsources.ConversionSource.Controller.MERCHANT -@pytest.mark.asyncio -async def test_update_conversion_source_async_from_dict(): - await test_update_conversion_source_async(request_type=dict) - - def test_update_conversion_source_field_headers(): client = ConversionSourcesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2150,8 +2170,8 @@ async def test_update_conversion_source_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversionsources.DeleteConversionSourceRequest, - dict, + conversionsources.DeleteConversionSourceRequest(), + {}, ], ) def test_delete_conversion_source(request_type, transport: str = "grpc"): @@ -2162,7 +2182,7 @@ def test_delete_conversion_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( @@ -2207,9 +2227,10 @@ def test_delete_conversion_source_non_empty_request_with_auto_populated_field(): client.delete_conversion_source(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversionsources.DeleteConversionSourceRequest( + request_msg = conversionsources.DeleteConversionSourceRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_conversion_source_use_cached_wrapped_rpc(): @@ -2295,9 +2316,15 @@ async def test_delete_conversion_source_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + conversionsources.DeleteConversionSourceRequest(), + {}, + ], +) async def test_delete_conversion_source_async( - transport: str = "grpc_asyncio", - request_type=conversionsources.DeleteConversionSourceRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConversionSourcesServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2306,7 +2333,7 @@ async def test_delete_conversion_source_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( @@ -2326,11 +2353,6 @@ async def test_delete_conversion_source_async( assert response is None -@pytest.mark.asyncio -async def test_delete_conversion_source_async_from_dict(): - await test_delete_conversion_source_async(request_type=dict) - - def test_delete_conversion_source_field_headers(): client = ConversionSourcesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2481,8 +2503,8 @@ async def test_delete_conversion_source_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversionsources.UndeleteConversionSourceRequest, - dict, + conversionsources.UndeleteConversionSourceRequest(), + {}, ], ) def test_undelete_conversion_source(request_type, transport: str = "grpc"): @@ -2493,7 +2515,7 @@ def test_undelete_conversion_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( @@ -2545,9 +2567,10 @@ def test_undelete_conversion_source_non_empty_request_with_auto_populated_field( client.undelete_conversion_source(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversionsources.UndeleteConversionSourceRequest( + request_msg = conversionsources.UndeleteConversionSourceRequest( name="name_value", ) + assert args[0] == request_msg def test_undelete_conversion_source_use_cached_wrapped_rpc(): @@ -2633,9 +2656,15 @@ async def test_undelete_conversion_source_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + conversionsources.UndeleteConversionSourceRequest(), + {}, + ], +) async def test_undelete_conversion_source_async( - transport: str = "grpc_asyncio", - request_type=conversionsources.UndeleteConversionSourceRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConversionSourcesServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2644,7 +2673,7 @@ async def test_undelete_conversion_source_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( @@ -2673,11 +2702,6 @@ async def test_undelete_conversion_source_async( assert response.controller == conversionsources.ConversionSource.Controller.MERCHANT -@pytest.mark.asyncio -async def test_undelete_conversion_source_async_from_dict(): - await test_undelete_conversion_source_async(request_type=dict) - - def test_undelete_conversion_source_field_headers(): client = ConversionSourcesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2746,8 +2770,8 @@ async def test_undelete_conversion_source_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - conversionsources.GetConversionSourceRequest, - dict, + conversionsources.GetConversionSourceRequest(), + {}, ], ) def test_get_conversion_source(request_type, transport: str = "grpc"): @@ -2758,7 +2782,7 @@ def test_get_conversion_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( @@ -2810,9 +2834,10 @@ def test_get_conversion_source_non_empty_request_with_auto_populated_field(): client.get_conversion_source(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversionsources.GetConversionSourceRequest( + request_msg = conversionsources.GetConversionSourceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_conversion_source_use_cached_wrapped_rpc(): @@ -2898,9 +2923,15 @@ async def test_get_conversion_source_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + conversionsources.GetConversionSourceRequest(), + {}, + ], +) async def test_get_conversion_source_async( - transport: str = "grpc_asyncio", - request_type=conversionsources.GetConversionSourceRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConversionSourcesServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2909,7 +2940,7 @@ async def test_get_conversion_source_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( @@ -2938,11 +2969,6 @@ async def test_get_conversion_source_async( assert response.controller == conversionsources.ConversionSource.Controller.MERCHANT -@pytest.mark.asyncio -async def test_get_conversion_source_async_from_dict(): - await test_get_conversion_source_async(request_type=dict) - - def test_get_conversion_source_field_headers(): client = ConversionSourcesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3097,8 +3123,8 @@ async def test_get_conversion_source_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversionsources.ListConversionSourcesRequest, - dict, + conversionsources.ListConversionSourcesRequest(), + {}, ], ) def test_list_conversion_sources(request_type, transport: str = "grpc"): @@ -3109,7 +3135,7 @@ def test_list_conversion_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( @@ -3158,10 +3184,11 @@ def test_list_conversion_sources_non_empty_request_with_auto_populated_field(): client.list_conversion_sources(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversionsources.ListConversionSourcesRequest( + request_msg = conversionsources.ListConversionSourcesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_conversion_sources_use_cached_wrapped_rpc(): @@ -3247,9 +3274,15 @@ async def test_list_conversion_sources_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + conversionsources.ListConversionSourcesRequest(), + {}, + ], +) async def test_list_conversion_sources_async( - transport: str = "grpc_asyncio", - request_type=conversionsources.ListConversionSourcesRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConversionSourcesServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3258,7 +3291,7 @@ async def test_list_conversion_sources_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( @@ -3283,11 +3316,6 @@ async def test_list_conversion_sources_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_conversion_sources_async_from_dict(): - await test_list_conversion_sources_async(request_type=dict) - - def test_list_conversion_sources_field_headers(): client = ConversionSourcesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4909,7 +4937,6 @@ def test_create_conversion_source_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversionsources.CreateConversionSourceRequest() - assert args[0] == request_msg @@ -4932,7 +4959,6 @@ def test_update_conversion_source_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversionsources.UpdateConversionSourceRequest() - assert args[0] == request_msg @@ -4955,7 +4981,6 @@ def test_delete_conversion_source_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversionsources.DeleteConversionSourceRequest() - assert args[0] == request_msg @@ -4978,7 +5003,6 @@ def test_undelete_conversion_source_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversionsources.UndeleteConversionSourceRequest() - assert args[0] == request_msg @@ -5001,7 +5025,6 @@ def test_get_conversion_source_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversionsources.GetConversionSourceRequest() - assert args[0] == request_msg @@ -5024,7 +5047,6 @@ def test_list_conversion_sources_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversionsources.ListConversionSourcesRequest() - assert args[0] == request_msg @@ -5069,7 +5091,6 @@ async def test_create_conversion_source_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversionsources.CreateConversionSourceRequest() - assert args[0] == request_msg @@ -5100,7 +5121,6 @@ async def test_update_conversion_source_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversionsources.UpdateConversionSourceRequest() - assert args[0] == request_msg @@ -5125,7 +5145,6 @@ async def test_delete_conversion_source_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversionsources.DeleteConversionSourceRequest() - assert args[0] == request_msg @@ -5156,7 +5175,6 @@ async def test_undelete_conversion_source_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversionsources.UndeleteConversionSourceRequest() - assert args[0] == request_msg @@ -5187,7 +5205,6 @@ async def test_get_conversion_source_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversionsources.GetConversionSourceRequest() - assert args[0] == request_msg @@ -5216,7 +5233,6 @@ async def test_list_conversion_sources_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversionsources.ListConversionSourcesRequest() - assert args[0] == request_msg @@ -6241,7 +6257,6 @@ def test_create_conversion_source_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversionsources.CreateConversionSourceRequest() - assert args[0] == request_msg @@ -6263,7 +6278,6 @@ def test_update_conversion_source_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversionsources.UpdateConversionSourceRequest() - assert args[0] == request_msg @@ -6285,7 +6299,6 @@ def test_delete_conversion_source_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversionsources.DeleteConversionSourceRequest() - assert args[0] == request_msg @@ -6307,7 +6320,6 @@ def test_undelete_conversion_source_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversionsources.UndeleteConversionSourceRequest() - assert args[0] == request_msg @@ -6329,7 +6341,6 @@ def test_get_conversion_source_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversionsources.GetConversionSourceRequest() - assert args[0] == request_msg @@ -6351,7 +6362,6 @@ def test_list_conversion_sources_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversionsources.ListConversionSourcesRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-conversions/tests/unit/gapic/merchant_conversions_v1beta/test_conversion_sources_service.py b/packages/google-shopping-merchant-conversions/tests/unit/gapic/merchant_conversions_v1beta/test_conversion_sources_service.py index a3d87f43eae0..d16c76211ffe 100644 --- a/packages/google-shopping-merchant-conversions/tests/unit/gapic/merchant_conversions_v1beta/test_conversion_sources_service.py +++ b/packages/google-shopping-merchant-conversions/tests/unit/gapic/merchant_conversions_v1beta/test_conversion_sources_service.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 @@ -109,6 +110,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" @@ -1384,8 +1400,8 @@ def test_conversion_sources_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - conversionsources.CreateConversionSourceRequest, - dict, + conversionsources.CreateConversionSourceRequest(), + {}, ], ) def test_create_conversion_source(request_type, transport: str = "grpc"): @@ -1396,7 +1412,7 @@ def test_create_conversion_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( @@ -1448,9 +1464,10 @@ def test_create_conversion_source_non_empty_request_with_auto_populated_field(): client.create_conversion_source(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversionsources.CreateConversionSourceRequest( + request_msg = conversionsources.CreateConversionSourceRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_conversion_source_use_cached_wrapped_rpc(): @@ -1536,9 +1553,15 @@ async def test_create_conversion_source_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + conversionsources.CreateConversionSourceRequest(), + {}, + ], +) async def test_create_conversion_source_async( - transport: str = "grpc_asyncio", - request_type=conversionsources.CreateConversionSourceRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConversionSourcesServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1547,7 +1570,7 @@ async def test_create_conversion_source_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( @@ -1576,11 +1599,6 @@ async def test_create_conversion_source_async( assert response.controller == conversionsources.ConversionSource.Controller.MERCHANT -@pytest.mark.asyncio -async def test_create_conversion_source_async_from_dict(): - await test_create_conversion_source_async(request_type=dict) - - def test_create_conversion_source_field_headers(): client = ConversionSourcesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1769,8 +1787,8 @@ async def test_create_conversion_source_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversionsources.UpdateConversionSourceRequest, - dict, + conversionsources.UpdateConversionSourceRequest(), + {}, ], ) def test_update_conversion_source(request_type, transport: str = "grpc"): @@ -1781,7 +1799,7 @@ def test_update_conversion_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( @@ -1831,7 +1849,8 @@ def test_update_conversion_source_non_empty_request_with_auto_populated_field(): client.update_conversion_source(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversionsources.UpdateConversionSourceRequest() + request_msg = conversionsources.UpdateConversionSourceRequest() + assert args[0] == request_msg def test_update_conversion_source_use_cached_wrapped_rpc(): @@ -1917,9 +1936,15 @@ async def test_update_conversion_source_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + conversionsources.UpdateConversionSourceRequest(), + {}, + ], +) async def test_update_conversion_source_async( - transport: str = "grpc_asyncio", - request_type=conversionsources.UpdateConversionSourceRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConversionSourcesServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1928,7 +1953,7 @@ async def test_update_conversion_source_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( @@ -1957,11 +1982,6 @@ async def test_update_conversion_source_async( assert response.controller == conversionsources.ConversionSource.Controller.MERCHANT -@pytest.mark.asyncio -async def test_update_conversion_source_async_from_dict(): - await test_update_conversion_source_async(request_type=dict) - - def test_update_conversion_source_field_headers(): client = ConversionSourcesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2150,8 +2170,8 @@ async def test_update_conversion_source_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversionsources.DeleteConversionSourceRequest, - dict, + conversionsources.DeleteConversionSourceRequest(), + {}, ], ) def test_delete_conversion_source(request_type, transport: str = "grpc"): @@ -2162,7 +2182,7 @@ def test_delete_conversion_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( @@ -2207,9 +2227,10 @@ def test_delete_conversion_source_non_empty_request_with_auto_populated_field(): client.delete_conversion_source(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversionsources.DeleteConversionSourceRequest( + request_msg = conversionsources.DeleteConversionSourceRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_conversion_source_use_cached_wrapped_rpc(): @@ -2295,9 +2316,15 @@ async def test_delete_conversion_source_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + conversionsources.DeleteConversionSourceRequest(), + {}, + ], +) async def test_delete_conversion_source_async( - transport: str = "grpc_asyncio", - request_type=conversionsources.DeleteConversionSourceRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConversionSourcesServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2306,7 +2333,7 @@ async def test_delete_conversion_source_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( @@ -2326,11 +2353,6 @@ async def test_delete_conversion_source_async( assert response is None -@pytest.mark.asyncio -async def test_delete_conversion_source_async_from_dict(): - await test_delete_conversion_source_async(request_type=dict) - - def test_delete_conversion_source_field_headers(): client = ConversionSourcesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2481,8 +2503,8 @@ async def test_delete_conversion_source_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversionsources.UndeleteConversionSourceRequest, - dict, + conversionsources.UndeleteConversionSourceRequest(), + {}, ], ) def test_undelete_conversion_source(request_type, transport: str = "grpc"): @@ -2493,7 +2515,7 @@ def test_undelete_conversion_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( @@ -2545,9 +2567,10 @@ def test_undelete_conversion_source_non_empty_request_with_auto_populated_field( client.undelete_conversion_source(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversionsources.UndeleteConversionSourceRequest( + request_msg = conversionsources.UndeleteConversionSourceRequest( name="name_value", ) + assert args[0] == request_msg def test_undelete_conversion_source_use_cached_wrapped_rpc(): @@ -2633,9 +2656,15 @@ async def test_undelete_conversion_source_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + conversionsources.UndeleteConversionSourceRequest(), + {}, + ], +) async def test_undelete_conversion_source_async( - transport: str = "grpc_asyncio", - request_type=conversionsources.UndeleteConversionSourceRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConversionSourcesServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2644,7 +2673,7 @@ async def test_undelete_conversion_source_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( @@ -2673,11 +2702,6 @@ async def test_undelete_conversion_source_async( assert response.controller == conversionsources.ConversionSource.Controller.MERCHANT -@pytest.mark.asyncio -async def test_undelete_conversion_source_async_from_dict(): - await test_undelete_conversion_source_async(request_type=dict) - - def test_undelete_conversion_source_field_headers(): client = ConversionSourcesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2746,8 +2770,8 @@ async def test_undelete_conversion_source_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - conversionsources.GetConversionSourceRequest, - dict, + conversionsources.GetConversionSourceRequest(), + {}, ], ) def test_get_conversion_source(request_type, transport: str = "grpc"): @@ -2758,7 +2782,7 @@ def test_get_conversion_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( @@ -2810,9 +2834,10 @@ def test_get_conversion_source_non_empty_request_with_auto_populated_field(): client.get_conversion_source(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversionsources.GetConversionSourceRequest( + request_msg = conversionsources.GetConversionSourceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_conversion_source_use_cached_wrapped_rpc(): @@ -2898,9 +2923,15 @@ async def test_get_conversion_source_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + conversionsources.GetConversionSourceRequest(), + {}, + ], +) async def test_get_conversion_source_async( - transport: str = "grpc_asyncio", - request_type=conversionsources.GetConversionSourceRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConversionSourcesServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2909,7 +2940,7 @@ async def test_get_conversion_source_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( @@ -2938,11 +2969,6 @@ async def test_get_conversion_source_async( assert response.controller == conversionsources.ConversionSource.Controller.MERCHANT -@pytest.mark.asyncio -async def test_get_conversion_source_async_from_dict(): - await test_get_conversion_source_async(request_type=dict) - - def test_get_conversion_source_field_headers(): client = ConversionSourcesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3097,8 +3123,8 @@ async def test_get_conversion_source_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - conversionsources.ListConversionSourcesRequest, - dict, + conversionsources.ListConversionSourcesRequest(), + {}, ], ) def test_list_conversion_sources(request_type, transport: str = "grpc"): @@ -3109,7 +3135,7 @@ def test_list_conversion_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( @@ -3158,10 +3184,11 @@ def test_list_conversion_sources_non_empty_request_with_auto_populated_field(): client.list_conversion_sources(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == conversionsources.ListConversionSourcesRequest( + request_msg = conversionsources.ListConversionSourcesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_conversion_sources_use_cached_wrapped_rpc(): @@ -3247,9 +3274,15 @@ async def test_list_conversion_sources_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + conversionsources.ListConversionSourcesRequest(), + {}, + ], +) async def test_list_conversion_sources_async( - transport: str = "grpc_asyncio", - request_type=conversionsources.ListConversionSourcesRequest, + request_type, transport: str = "grpc_asyncio" ): client = ConversionSourcesServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3258,7 +3291,7 @@ async def test_list_conversion_sources_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( @@ -3283,11 +3316,6 @@ async def test_list_conversion_sources_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_conversion_sources_async_from_dict(): - await test_list_conversion_sources_async(request_type=dict) - - def test_list_conversion_sources_field_headers(): client = ConversionSourcesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4917,7 +4945,6 @@ def test_create_conversion_source_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversionsources.CreateConversionSourceRequest() - assert args[0] == request_msg @@ -4940,7 +4967,6 @@ def test_update_conversion_source_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversionsources.UpdateConversionSourceRequest() - assert args[0] == request_msg @@ -4963,7 +4989,6 @@ def test_delete_conversion_source_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversionsources.DeleteConversionSourceRequest() - assert args[0] == request_msg @@ -4986,7 +5011,6 @@ def test_undelete_conversion_source_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversionsources.UndeleteConversionSourceRequest() - assert args[0] == request_msg @@ -5009,7 +5033,6 @@ def test_get_conversion_source_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversionsources.GetConversionSourceRequest() - assert args[0] == request_msg @@ -5032,7 +5055,6 @@ def test_list_conversion_sources_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversionsources.ListConversionSourcesRequest() - assert args[0] == request_msg @@ -5077,7 +5099,6 @@ async def test_create_conversion_source_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversionsources.CreateConversionSourceRequest() - assert args[0] == request_msg @@ -5108,7 +5129,6 @@ async def test_update_conversion_source_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversionsources.UpdateConversionSourceRequest() - assert args[0] == request_msg @@ -5133,7 +5153,6 @@ async def test_delete_conversion_source_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversionsources.DeleteConversionSourceRequest() - assert args[0] == request_msg @@ -5164,7 +5183,6 @@ async def test_undelete_conversion_source_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversionsources.UndeleteConversionSourceRequest() - assert args[0] == request_msg @@ -5195,7 +5213,6 @@ async def test_get_conversion_source_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversionsources.GetConversionSourceRequest() - assert args[0] == request_msg @@ -5224,7 +5241,6 @@ async def test_list_conversion_sources_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversionsources.ListConversionSourcesRequest() - assert args[0] == request_msg @@ -6249,7 +6265,6 @@ def test_create_conversion_source_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversionsources.CreateConversionSourceRequest() - assert args[0] == request_msg @@ -6271,7 +6286,6 @@ def test_update_conversion_source_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversionsources.UpdateConversionSourceRequest() - assert args[0] == request_msg @@ -6293,7 +6307,6 @@ def test_delete_conversion_source_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversionsources.DeleteConversionSourceRequest() - assert args[0] == request_msg @@ -6315,7 +6328,6 @@ def test_undelete_conversion_source_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversionsources.UndeleteConversionSourceRequest() - assert args[0] == request_msg @@ -6337,7 +6349,6 @@ def test_get_conversion_source_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversionsources.GetConversionSourceRequest() - assert args[0] == request_msg @@ -6359,7 +6370,6 @@ def test_list_conversion_sources_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = conversionsources.ListConversionSourcesRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-datasources/noxfile.py b/packages/google-shopping-merchant-datasources/noxfile.py index 693a6e64f921..a127b28df77e 100644 --- a/packages/google-shopping-merchant-datasources/noxfile.py +++ b/packages/google-shopping-merchant-datasources/noxfile.py @@ -47,7 +47,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-shopping-merchant-datasources" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-shopping-merchant-datasources/setup.py b/packages/google-shopping-merchant-datasources/setup.py index 8a4aee11bcaf..326a0b6fe7f3 100644 --- a/packages/google-shopping-merchant-datasources/setup.py +++ b/packages/google-shopping-merchant-datasources/setup.py @@ -45,7 +45,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/google-shopping-merchant-datasources/testing/constraints-3.10.txt b/packages/google-shopping-merchant-datasources/testing/constraints-3.10.txt index 28927d49b296..b408428a99a2 100644 --- a/packages/google-shopping-merchant-datasources/testing/constraints-3.10.txt +++ b/packages/google-shopping-merchant-datasources/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-shopping-type==1.0.0 diff --git a/packages/google-shopping-merchant-datasources/tests/unit/gapic/merchant_datasources_v1/test_data_sources_service.py b/packages/google-shopping-merchant-datasources/tests/unit/gapic/merchant_datasources_v1/test_data_sources_service.py index 72cbc80585c7..adaf82ea4970 100644 --- a/packages/google-shopping-merchant-datasources/tests/unit/gapic/merchant_datasources_v1/test_data_sources_service.py +++ b/packages/google-shopping-merchant-datasources/tests/unit/gapic/merchant_datasources_v1/test_data_sources_service.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 @@ -115,6 +116,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" @@ -1360,8 +1376,8 @@ def test_data_sources_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - datasources.GetDataSourceRequest, - dict, + datasources.GetDataSourceRequest(), + {}, ], ) def test_get_data_source(request_type, transport: str = "grpc"): @@ -1372,7 +1388,7 @@ def test_get_data_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(type(client.transport.get_data_source), "__call__") as call: @@ -1422,9 +1438,10 @@ def test_get_data_source_non_empty_request_with_auto_populated_field(): client.get_data_source(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datasources.GetDataSourceRequest( + request_msg = datasources.GetDataSourceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_data_source_use_cached_wrapped_rpc(): @@ -1505,9 +1522,14 @@ async def test_get_data_source_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_data_source_async( - transport: str = "grpc_asyncio", request_type=datasources.GetDataSourceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datasources.GetDataSourceRequest(), + {}, + ], +) +async def test_get_data_source_async(request_type, transport: str = "grpc_asyncio"): client = DataSourcesServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1515,7 +1537,7 @@ async def test_get_data_source_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_data_source), "__call__") as call: @@ -1544,11 +1566,6 @@ async def test_get_data_source_async( assert response.input == datasources.DataSource.Input.API -@pytest.mark.asyncio -async def test_get_data_source_async_from_dict(): - await test_get_data_source_async(request_type=dict) - - def test_get_data_source_field_headers(): client = DataSourcesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1695,8 +1712,8 @@ async def test_get_data_source_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datasources.ListDataSourcesRequest, - dict, + datasources.ListDataSourcesRequest(), + {}, ], ) def test_list_data_sources(request_type, transport: str = "grpc"): @@ -1707,7 +1724,7 @@ def test_list_data_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( @@ -1756,10 +1773,11 @@ def test_list_data_sources_non_empty_request_with_auto_populated_field(): client.list_data_sources(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datasources.ListDataSourcesRequest( + request_msg = datasources.ListDataSourcesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_data_sources_use_cached_wrapped_rpc(): @@ -1842,9 +1860,14 @@ async def test_list_data_sources_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_data_sources_async( - transport: str = "grpc_asyncio", request_type=datasources.ListDataSourcesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datasources.ListDataSourcesRequest(), + {}, + ], +) +async def test_list_data_sources_async(request_type, transport: str = "grpc_asyncio"): client = DataSourcesServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1852,7 +1875,7 @@ async def test_list_data_sources_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( @@ -1877,11 +1900,6 @@ async def test_list_data_sources_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_data_sources_async_from_dict(): - await test_list_data_sources_async(request_type=dict) - - def test_list_data_sources_field_headers(): client = DataSourcesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2234,8 +2252,8 @@ async def test_list_data_sources_async_pages(): @pytest.mark.parametrize( "request_type", [ - datasources.CreateDataSourceRequest, - dict, + datasources.CreateDataSourceRequest(), + {}, ], ) def test_create_data_source(request_type, transport: str = "grpc"): @@ -2246,7 +2264,7 @@ def test_create_data_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( @@ -2300,9 +2318,10 @@ def test_create_data_source_non_empty_request_with_auto_populated_field(): client.create_data_source(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datasources.CreateDataSourceRequest( + request_msg = datasources.CreateDataSourceRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_data_source_use_cached_wrapped_rpc(): @@ -2387,9 +2406,14 @@ async def test_create_data_source_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_data_source_async( - transport: str = "grpc_asyncio", request_type=datasources.CreateDataSourceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datasources.CreateDataSourceRequest(), + {}, + ], +) +async def test_create_data_source_async(request_type, transport: str = "grpc_asyncio"): client = DataSourcesServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2397,7 +2421,7 @@ async def test_create_data_source_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( @@ -2428,11 +2452,6 @@ async def test_create_data_source_async( assert response.input == datasources.DataSource.Input.API -@pytest.mark.asyncio -async def test_create_data_source_async_from_dict(): - await test_create_data_source_async(request_type=dict) - - def test_create_data_source_field_headers(): client = DataSourcesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2621,8 +2640,8 @@ async def test_create_data_source_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datasources.UpdateDataSourceRequest, - dict, + datasources.UpdateDataSourceRequest(), + {}, ], ) def test_update_data_source(request_type, transport: str = "grpc"): @@ -2633,7 +2652,7 @@ def test_update_data_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( @@ -2685,7 +2704,8 @@ def test_update_data_source_non_empty_request_with_auto_populated_field(): client.update_data_source(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datasources.UpdateDataSourceRequest() + request_msg = datasources.UpdateDataSourceRequest() + assert args[0] == request_msg def test_update_data_source_use_cached_wrapped_rpc(): @@ -2770,9 +2790,14 @@ async def test_update_data_source_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_data_source_async( - transport: str = "grpc_asyncio", request_type=datasources.UpdateDataSourceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datasources.UpdateDataSourceRequest(), + {}, + ], +) +async def test_update_data_source_async(request_type, transport: str = "grpc_asyncio"): client = DataSourcesServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2780,7 +2805,7 @@ async def test_update_data_source_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( @@ -2811,11 +2836,6 @@ async def test_update_data_source_async( assert response.input == datasources.DataSource.Input.API -@pytest.mark.asyncio -async def test_update_data_source_async_from_dict(): - await test_update_data_source_async(request_type=dict) - - def test_update_data_source_field_headers(): client = DataSourcesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3004,8 +3024,8 @@ async def test_update_data_source_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datasources.DeleteDataSourceRequest, - dict, + datasources.DeleteDataSourceRequest(), + {}, ], ) def test_delete_data_source(request_type, transport: str = "grpc"): @@ -3016,7 +3036,7 @@ def test_delete_data_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( @@ -3061,9 +3081,10 @@ def test_delete_data_source_non_empty_request_with_auto_populated_field(): client.delete_data_source(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datasources.DeleteDataSourceRequest( + request_msg = datasources.DeleteDataSourceRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_data_source_use_cached_wrapped_rpc(): @@ -3148,9 +3169,14 @@ async def test_delete_data_source_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_data_source_async( - transport: str = "grpc_asyncio", request_type=datasources.DeleteDataSourceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datasources.DeleteDataSourceRequest(), + {}, + ], +) +async def test_delete_data_source_async(request_type, transport: str = "grpc_asyncio"): client = DataSourcesServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3158,7 +3184,7 @@ async def test_delete_data_source_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( @@ -3178,11 +3204,6 @@ async def test_delete_data_source_async( assert response is None -@pytest.mark.asyncio -async def test_delete_data_source_async_from_dict(): - await test_delete_data_source_async(request_type=dict) - - def test_delete_data_source_field_headers(): client = DataSourcesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3333,8 +3354,8 @@ async def test_delete_data_source_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datasources.FetchDataSourceRequest, - dict, + datasources.FetchDataSourceRequest(), + {}, ], ) def test_fetch_data_source(request_type, transport: str = "grpc"): @@ -3345,7 +3366,7 @@ def test_fetch_data_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( @@ -3390,9 +3411,10 @@ def test_fetch_data_source_non_empty_request_with_auto_populated_field(): client.fetch_data_source(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datasources.FetchDataSourceRequest( + request_msg = datasources.FetchDataSourceRequest( name="name_value", ) + assert args[0] == request_msg def test_fetch_data_source_use_cached_wrapped_rpc(): @@ -3475,9 +3497,14 @@ async def test_fetch_data_source_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_fetch_data_source_async( - transport: str = "grpc_asyncio", request_type=datasources.FetchDataSourceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datasources.FetchDataSourceRequest(), + {}, + ], +) +async def test_fetch_data_source_async(request_type, transport: str = "grpc_asyncio"): client = DataSourcesServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3485,7 +3512,7 @@ async def test_fetch_data_source_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( @@ -3505,11 +3532,6 @@ async def test_fetch_data_source_async( assert response is None -@pytest.mark.asyncio -async def test_fetch_data_source_async_from_dict(): - await test_fetch_data_source_async(request_type=dict) - - def test_fetch_data_source_field_headers(): client = DataSourcesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4830,7 +4852,6 @@ def test_get_data_source_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datasources.GetDataSourceRequest() - assert args[0] == request_msg @@ -4853,7 +4874,6 @@ def test_list_data_sources_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datasources.ListDataSourcesRequest() - assert args[0] == request_msg @@ -4876,7 +4896,6 @@ def test_create_data_source_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datasources.CreateDataSourceRequest() - assert args[0] == request_msg @@ -4899,7 +4918,6 @@ def test_update_data_source_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datasources.UpdateDataSourceRequest() - assert args[0] == request_msg @@ -4922,7 +4940,6 @@ def test_delete_data_source_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datasources.DeleteDataSourceRequest() - assert args[0] == request_msg @@ -4945,7 +4962,6 @@ def test_fetch_data_source_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datasources.FetchDataSourceRequest() - assert args[0] == request_msg @@ -4989,7 +5005,6 @@ async def test_get_data_source_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datasources.GetDataSourceRequest() - assert args[0] == request_msg @@ -5018,7 +5033,6 @@ async def test_list_data_sources_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datasources.ListDataSourcesRequest() - assert args[0] == request_msg @@ -5050,7 +5064,6 @@ async def test_create_data_source_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datasources.CreateDataSourceRequest() - assert args[0] == request_msg @@ -5082,7 +5095,6 @@ async def test_update_data_source_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datasources.UpdateDataSourceRequest() - assert args[0] == request_msg @@ -5107,7 +5119,6 @@ async def test_delete_data_source_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datasources.DeleteDataSourceRequest() - assert args[0] == request_msg @@ -5132,7 +5143,6 @@ async def test_fetch_data_source_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datasources.FetchDataSourceRequest() - assert args[0] == request_msg @@ -6189,7 +6199,6 @@ def test_get_data_source_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datasources.GetDataSourceRequest() - assert args[0] == request_msg @@ -6211,7 +6220,6 @@ def test_list_data_sources_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datasources.ListDataSourcesRequest() - assert args[0] == request_msg @@ -6233,7 +6241,6 @@ def test_create_data_source_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datasources.CreateDataSourceRequest() - assert args[0] == request_msg @@ -6255,7 +6262,6 @@ def test_update_data_source_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datasources.UpdateDataSourceRequest() - assert args[0] == request_msg @@ -6277,7 +6283,6 @@ def test_delete_data_source_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datasources.DeleteDataSourceRequest() - assert args[0] == request_msg @@ -6299,7 +6304,6 @@ def test_fetch_data_source_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datasources.FetchDataSourceRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-datasources/tests/unit/gapic/merchant_datasources_v1/test_file_uploads_service.py b/packages/google-shopping-merchant-datasources/tests/unit/gapic/merchant_datasources_v1/test_file_uploads_service.py index 7b200aca691b..252ee0e92c0f 100644 --- a/packages/google-shopping-merchant-datasources/tests/unit/gapic/merchant_datasources_v1/test_file_uploads_service.py +++ b/packages/google-shopping-merchant-datasources/tests/unit/gapic/merchant_datasources_v1/test_file_uploads_service.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 @@ -107,6 +108,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" @@ -1352,8 +1368,8 @@ def test_file_uploads_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - fileuploads.GetFileUploadRequest, - dict, + fileuploads.GetFileUploadRequest(), + {}, ], ) def test_get_file_upload(request_type, transport: str = "grpc"): @@ -1364,7 +1380,7 @@ def test_get_file_upload(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_file_upload), "__call__") as call: @@ -1418,9 +1434,10 @@ def test_get_file_upload_non_empty_request_with_auto_populated_field(): client.get_file_upload(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == fileuploads.GetFileUploadRequest( + request_msg = fileuploads.GetFileUploadRequest( name="name_value", ) + assert args[0] == request_msg def test_get_file_upload_use_cached_wrapped_rpc(): @@ -1501,9 +1518,14 @@ async def test_get_file_upload_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_file_upload_async( - transport: str = "grpc_asyncio", request_type=fileuploads.GetFileUploadRequest -): +@pytest.mark.parametrize( + "request_type", + [ + fileuploads.GetFileUploadRequest(), + {}, + ], +) +async def test_get_file_upload_async(request_type, transport: str = "grpc_asyncio"): client = FileUploadsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1511,7 +1533,7 @@ async def test_get_file_upload_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_file_upload), "__call__") as call: @@ -1544,11 +1566,6 @@ async def test_get_file_upload_async( assert response.items_updated == 1384 -@pytest.mark.asyncio -async def test_get_file_upload_async_from_dict(): - await test_get_file_upload_async(request_type=dict) - - def test_get_file_upload_field_headers(): client = FileUploadsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1995,7 +2012,6 @@ def test_get_file_upload_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = fileuploads.GetFileUploadRequest() - assert args[0] == request_msg @@ -2041,7 +2057,6 @@ async def test_get_file_upload_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = fileuploads.GetFileUploadRequest() - assert args[0] == request_msg @@ -2216,7 +2231,6 @@ def test_get_file_upload_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = fileuploads.GetFileUploadRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-datasources/tests/unit/gapic/merchant_datasources_v1beta/test_data_sources_service.py b/packages/google-shopping-merchant-datasources/tests/unit/gapic/merchant_datasources_v1beta/test_data_sources_service.py index 6034b1725aa4..3fcff765c772 100644 --- a/packages/google-shopping-merchant-datasources/tests/unit/gapic/merchant_datasources_v1beta/test_data_sources_service.py +++ b/packages/google-shopping-merchant-datasources/tests/unit/gapic/merchant_datasources_v1beta/test_data_sources_service.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 @@ -115,6 +116,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" @@ -1360,8 +1376,8 @@ def test_data_sources_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - datasources.GetDataSourceRequest, - dict, + datasources.GetDataSourceRequest(), + {}, ], ) def test_get_data_source(request_type, transport: str = "grpc"): @@ -1372,7 +1388,7 @@ def test_get_data_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(type(client.transport.get_data_source), "__call__") as call: @@ -1422,9 +1438,10 @@ def test_get_data_source_non_empty_request_with_auto_populated_field(): client.get_data_source(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datasources.GetDataSourceRequest( + request_msg = datasources.GetDataSourceRequest( name="name_value", ) + assert args[0] == request_msg def test_get_data_source_use_cached_wrapped_rpc(): @@ -1505,9 +1522,14 @@ async def test_get_data_source_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_data_source_async( - transport: str = "grpc_asyncio", request_type=datasources.GetDataSourceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datasources.GetDataSourceRequest(), + {}, + ], +) +async def test_get_data_source_async(request_type, transport: str = "grpc_asyncio"): client = DataSourcesServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1515,7 +1537,7 @@ async def test_get_data_source_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_data_source), "__call__") as call: @@ -1544,11 +1566,6 @@ async def test_get_data_source_async( assert response.input == datasources.DataSource.Input.API -@pytest.mark.asyncio -async def test_get_data_source_async_from_dict(): - await test_get_data_source_async(request_type=dict) - - def test_get_data_source_field_headers(): client = DataSourcesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1695,8 +1712,8 @@ async def test_get_data_source_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datasources.ListDataSourcesRequest, - dict, + datasources.ListDataSourcesRequest(), + {}, ], ) def test_list_data_sources(request_type, transport: str = "grpc"): @@ -1707,7 +1724,7 @@ def test_list_data_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( @@ -1756,10 +1773,11 @@ def test_list_data_sources_non_empty_request_with_auto_populated_field(): client.list_data_sources(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datasources.ListDataSourcesRequest( + request_msg = datasources.ListDataSourcesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_data_sources_use_cached_wrapped_rpc(): @@ -1842,9 +1860,14 @@ async def test_list_data_sources_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_data_sources_async( - transport: str = "grpc_asyncio", request_type=datasources.ListDataSourcesRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datasources.ListDataSourcesRequest(), + {}, + ], +) +async def test_list_data_sources_async(request_type, transport: str = "grpc_asyncio"): client = DataSourcesServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1852,7 +1875,7 @@ async def test_list_data_sources_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( @@ -1877,11 +1900,6 @@ async def test_list_data_sources_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_data_sources_async_from_dict(): - await test_list_data_sources_async(request_type=dict) - - def test_list_data_sources_field_headers(): client = DataSourcesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2234,8 +2252,8 @@ async def test_list_data_sources_async_pages(): @pytest.mark.parametrize( "request_type", [ - datasources.CreateDataSourceRequest, - dict, + datasources.CreateDataSourceRequest(), + {}, ], ) def test_create_data_source(request_type, transport: str = "grpc"): @@ -2246,7 +2264,7 @@ def test_create_data_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( @@ -2300,9 +2318,10 @@ def test_create_data_source_non_empty_request_with_auto_populated_field(): client.create_data_source(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datasources.CreateDataSourceRequest( + request_msg = datasources.CreateDataSourceRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_data_source_use_cached_wrapped_rpc(): @@ -2387,9 +2406,14 @@ async def test_create_data_source_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_create_data_source_async( - transport: str = "grpc_asyncio", request_type=datasources.CreateDataSourceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datasources.CreateDataSourceRequest(), + {}, + ], +) +async def test_create_data_source_async(request_type, transport: str = "grpc_asyncio"): client = DataSourcesServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2397,7 +2421,7 @@ async def test_create_data_source_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( @@ -2428,11 +2452,6 @@ async def test_create_data_source_async( assert response.input == datasources.DataSource.Input.API -@pytest.mark.asyncio -async def test_create_data_source_async_from_dict(): - await test_create_data_source_async(request_type=dict) - - def test_create_data_source_field_headers(): client = DataSourcesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2621,8 +2640,8 @@ async def test_create_data_source_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datasources.UpdateDataSourceRequest, - dict, + datasources.UpdateDataSourceRequest(), + {}, ], ) def test_update_data_source(request_type, transport: str = "grpc"): @@ -2633,7 +2652,7 @@ def test_update_data_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( @@ -2685,7 +2704,8 @@ def test_update_data_source_non_empty_request_with_auto_populated_field(): client.update_data_source(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datasources.UpdateDataSourceRequest() + request_msg = datasources.UpdateDataSourceRequest() + assert args[0] == request_msg def test_update_data_source_use_cached_wrapped_rpc(): @@ -2770,9 +2790,14 @@ async def test_update_data_source_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_update_data_source_async( - transport: str = "grpc_asyncio", request_type=datasources.UpdateDataSourceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datasources.UpdateDataSourceRequest(), + {}, + ], +) +async def test_update_data_source_async(request_type, transport: str = "grpc_asyncio"): client = DataSourcesServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2780,7 +2805,7 @@ async def test_update_data_source_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( @@ -2811,11 +2836,6 @@ async def test_update_data_source_async( assert response.input == datasources.DataSource.Input.API -@pytest.mark.asyncio -async def test_update_data_source_async_from_dict(): - await test_update_data_source_async(request_type=dict) - - def test_update_data_source_field_headers(): client = DataSourcesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3004,8 +3024,8 @@ async def test_update_data_source_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datasources.DeleteDataSourceRequest, - dict, + datasources.DeleteDataSourceRequest(), + {}, ], ) def test_delete_data_source(request_type, transport: str = "grpc"): @@ -3016,7 +3036,7 @@ def test_delete_data_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( @@ -3061,9 +3081,10 @@ def test_delete_data_source_non_empty_request_with_auto_populated_field(): client.delete_data_source(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datasources.DeleteDataSourceRequest( + request_msg = datasources.DeleteDataSourceRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_data_source_use_cached_wrapped_rpc(): @@ -3148,9 +3169,14 @@ async def test_delete_data_source_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_data_source_async( - transport: str = "grpc_asyncio", request_type=datasources.DeleteDataSourceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datasources.DeleteDataSourceRequest(), + {}, + ], +) +async def test_delete_data_source_async(request_type, transport: str = "grpc_asyncio"): client = DataSourcesServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3158,7 +3184,7 @@ async def test_delete_data_source_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( @@ -3178,11 +3204,6 @@ async def test_delete_data_source_async( assert response is None -@pytest.mark.asyncio -async def test_delete_data_source_async_from_dict(): - await test_delete_data_source_async(request_type=dict) - - def test_delete_data_source_field_headers(): client = DataSourcesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3333,8 +3354,8 @@ async def test_delete_data_source_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - datasources.FetchDataSourceRequest, - dict, + datasources.FetchDataSourceRequest(), + {}, ], ) def test_fetch_data_source(request_type, transport: str = "grpc"): @@ -3345,7 +3366,7 @@ def test_fetch_data_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( @@ -3390,9 +3411,10 @@ def test_fetch_data_source_non_empty_request_with_auto_populated_field(): client.fetch_data_source(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == datasources.FetchDataSourceRequest( + request_msg = datasources.FetchDataSourceRequest( name="name_value", ) + assert args[0] == request_msg def test_fetch_data_source_use_cached_wrapped_rpc(): @@ -3475,9 +3497,14 @@ async def test_fetch_data_source_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_fetch_data_source_async( - transport: str = "grpc_asyncio", request_type=datasources.FetchDataSourceRequest -): +@pytest.mark.parametrize( + "request_type", + [ + datasources.FetchDataSourceRequest(), + {}, + ], +) +async def test_fetch_data_source_async(request_type, transport: str = "grpc_asyncio"): client = DataSourcesServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -3485,7 +3512,7 @@ async def test_fetch_data_source_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( @@ -3505,11 +3532,6 @@ async def test_fetch_data_source_async( assert response is None -@pytest.mark.asyncio -async def test_fetch_data_source_async_from_dict(): - await test_fetch_data_source_async(request_type=dict) - - def test_fetch_data_source_field_headers(): client = DataSourcesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4830,7 +4852,6 @@ def test_get_data_source_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datasources.GetDataSourceRequest() - assert args[0] == request_msg @@ -4853,7 +4874,6 @@ def test_list_data_sources_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datasources.ListDataSourcesRequest() - assert args[0] == request_msg @@ -4876,7 +4896,6 @@ def test_create_data_source_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datasources.CreateDataSourceRequest() - assert args[0] == request_msg @@ -4899,7 +4918,6 @@ def test_update_data_source_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datasources.UpdateDataSourceRequest() - assert args[0] == request_msg @@ -4922,7 +4940,6 @@ def test_delete_data_source_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datasources.DeleteDataSourceRequest() - assert args[0] == request_msg @@ -4945,7 +4962,6 @@ def test_fetch_data_source_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datasources.FetchDataSourceRequest() - assert args[0] == request_msg @@ -4989,7 +5005,6 @@ async def test_get_data_source_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datasources.GetDataSourceRequest() - assert args[0] == request_msg @@ -5018,7 +5033,6 @@ async def test_list_data_sources_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datasources.ListDataSourcesRequest() - assert args[0] == request_msg @@ -5050,7 +5064,6 @@ async def test_create_data_source_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datasources.CreateDataSourceRequest() - assert args[0] == request_msg @@ -5082,7 +5095,6 @@ async def test_update_data_source_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datasources.UpdateDataSourceRequest() - assert args[0] == request_msg @@ -5107,7 +5119,6 @@ async def test_delete_data_source_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datasources.DeleteDataSourceRequest() - assert args[0] == request_msg @@ -5132,7 +5143,6 @@ async def test_fetch_data_source_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datasources.FetchDataSourceRequest() - assert args[0] == request_msg @@ -6189,7 +6199,6 @@ def test_get_data_source_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datasources.GetDataSourceRequest() - assert args[0] == request_msg @@ -6211,7 +6220,6 @@ def test_list_data_sources_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datasources.ListDataSourcesRequest() - assert args[0] == request_msg @@ -6233,7 +6241,6 @@ def test_create_data_source_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datasources.CreateDataSourceRequest() - assert args[0] == request_msg @@ -6255,7 +6262,6 @@ def test_update_data_source_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datasources.UpdateDataSourceRequest() - assert args[0] == request_msg @@ -6277,7 +6283,6 @@ def test_delete_data_source_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datasources.DeleteDataSourceRequest() - assert args[0] == request_msg @@ -6299,7 +6304,6 @@ def test_fetch_data_source_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = datasources.FetchDataSourceRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-datasources/tests/unit/gapic/merchant_datasources_v1beta/test_file_uploads_service.py b/packages/google-shopping-merchant-datasources/tests/unit/gapic/merchant_datasources_v1beta/test_file_uploads_service.py index b71cb1cf2bbd..ff9a639e8b4d 100644 --- a/packages/google-shopping-merchant-datasources/tests/unit/gapic/merchant_datasources_v1beta/test_file_uploads_service.py +++ b/packages/google-shopping-merchant-datasources/tests/unit/gapic/merchant_datasources_v1beta/test_file_uploads_service.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 @@ -107,6 +108,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" @@ -1352,8 +1368,8 @@ def test_file_uploads_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - fileuploads.GetFileUploadRequest, - dict, + fileuploads.GetFileUploadRequest(), + {}, ], ) def test_get_file_upload(request_type, transport: str = "grpc"): @@ -1364,7 +1380,7 @@ def test_get_file_upload(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_file_upload), "__call__") as call: @@ -1418,9 +1434,10 @@ def test_get_file_upload_non_empty_request_with_auto_populated_field(): client.get_file_upload(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == fileuploads.GetFileUploadRequest( + request_msg = fileuploads.GetFileUploadRequest( name="name_value", ) + assert args[0] == request_msg def test_get_file_upload_use_cached_wrapped_rpc(): @@ -1501,9 +1518,14 @@ async def test_get_file_upload_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_file_upload_async( - transport: str = "grpc_asyncio", request_type=fileuploads.GetFileUploadRequest -): +@pytest.mark.parametrize( + "request_type", + [ + fileuploads.GetFileUploadRequest(), + {}, + ], +) +async def test_get_file_upload_async(request_type, transport: str = "grpc_asyncio"): client = FileUploadsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1511,7 +1533,7 @@ async def test_get_file_upload_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_file_upload), "__call__") as call: @@ -1544,11 +1566,6 @@ async def test_get_file_upload_async( assert response.items_updated == 1384 -@pytest.mark.asyncio -async def test_get_file_upload_async_from_dict(): - await test_get_file_upload_async(request_type=dict) - - def test_get_file_upload_field_headers(): client = FileUploadsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1995,7 +2012,6 @@ def test_get_file_upload_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = fileuploads.GetFileUploadRequest() - assert args[0] == request_msg @@ -2041,7 +2057,6 @@ async def test_get_file_upload_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = fileuploads.GetFileUploadRequest() - assert args[0] == request_msg @@ -2216,7 +2231,6 @@ def test_get_file_upload_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = fileuploads.GetFileUploadRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-inventories/noxfile.py b/packages/google-shopping-merchant-inventories/noxfile.py index aa0a7633b3f8..0e2b1e69e4c3 100644 --- a/packages/google-shopping-merchant-inventories/noxfile.py +++ b/packages/google-shopping-merchant-inventories/noxfile.py @@ -47,7 +47,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-shopping-merchant-inventories" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-shopping-merchant-inventories/setup.py b/packages/google-shopping-merchant-inventories/setup.py index db23ad69c8b3..275ba33e8c0c 100644 --- a/packages/google-shopping-merchant-inventories/setup.py +++ b/packages/google-shopping-merchant-inventories/setup.py @@ -45,7 +45,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/google-shopping-merchant-inventories/testing/constraints-3.10.txt b/packages/google-shopping-merchant-inventories/testing/constraints-3.10.txt index 28927d49b296..b408428a99a2 100644 --- a/packages/google-shopping-merchant-inventories/testing/constraints-3.10.txt +++ b/packages/google-shopping-merchant-inventories/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-shopping-type==1.0.0 diff --git a/packages/google-shopping-merchant-inventories/tests/unit/gapic/merchant_inventories_v1/test_local_inventory_service.py b/packages/google-shopping-merchant-inventories/tests/unit/gapic/merchant_inventories_v1/test_local_inventory_service.py index caf4a23727c5..7f838240e3aa 100644 --- a/packages/google-shopping-merchant-inventories/tests/unit/gapic/merchant_inventories_v1/test_local_inventory_service.py +++ b/packages/google-shopping-merchant-inventories/tests/unit/gapic/merchant_inventories_v1/test_local_inventory_service.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 @@ -113,6 +114,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" @@ -1378,8 +1394,8 @@ def test_local_inventory_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - localinventory.ListLocalInventoriesRequest, - dict, + localinventory.ListLocalInventoriesRequest(), + {}, ], ) def test_list_local_inventories(request_type, transport: str = "grpc"): @@ -1390,7 +1406,7 @@ def test_list_local_inventories(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1439,10 +1455,11 @@ def test_list_local_inventories_non_empty_request_with_auto_populated_field(): client.list_local_inventories(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == localinventory.ListLocalInventoriesRequest( + request_msg = localinventory.ListLocalInventoriesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_local_inventories_use_cached_wrapped_rpc(): @@ -1528,9 +1545,15 @@ async def test_list_local_inventories_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + localinventory.ListLocalInventoriesRequest(), + {}, + ], +) async def test_list_local_inventories_async( - transport: str = "grpc_asyncio", - request_type=localinventory.ListLocalInventoriesRequest, + request_type, transport: str = "grpc_asyncio" ): client = LocalInventoryServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1539,7 +1562,7 @@ async def test_list_local_inventories_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( @@ -1564,11 +1587,6 @@ async def test_list_local_inventories_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_local_inventories_async_from_dict(): - await test_list_local_inventories_async(request_type=dict) - - def test_list_local_inventories_field_headers(): client = LocalInventoryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1921,8 +1939,8 @@ async def test_list_local_inventories_async_pages(): @pytest.mark.parametrize( "request_type", [ - localinventory.InsertLocalInventoryRequest, - dict, + localinventory.InsertLocalInventoryRequest(), + {}, ], ) def test_insert_local_inventory(request_type, transport: str = "grpc"): @@ -1933,7 +1951,7 @@ def test_insert_local_inventory(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1987,9 +2005,10 @@ def test_insert_local_inventory_non_empty_request_with_auto_populated_field(): client.insert_local_inventory(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == localinventory.InsertLocalInventoryRequest( + request_msg = localinventory.InsertLocalInventoryRequest( parent="parent_value", ) + assert args[0] == request_msg def test_insert_local_inventory_use_cached_wrapped_rpc(): @@ -2075,9 +2094,15 @@ async def test_insert_local_inventory_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + localinventory.InsertLocalInventoryRequest(), + {}, + ], +) async def test_insert_local_inventory_async( - transport: str = "grpc_asyncio", - request_type=localinventory.InsertLocalInventoryRequest, + request_type, transport: str = "grpc_asyncio" ): client = LocalInventoryServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2086,7 +2111,7 @@ async def test_insert_local_inventory_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( @@ -2117,11 +2142,6 @@ async def test_insert_local_inventory_async( assert response.store_code == "store_code_value" -@pytest.mark.asyncio -async def test_insert_local_inventory_async_from_dict(): - await test_insert_local_inventory_async(request_type=dict) - - def test_insert_local_inventory_field_headers(): client = LocalInventoryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2190,8 +2210,8 @@ async def test_insert_local_inventory_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - localinventory.DeleteLocalInventoryRequest, - dict, + localinventory.DeleteLocalInventoryRequest(), + {}, ], ) def test_delete_local_inventory(request_type, transport: str = "grpc"): @@ -2202,7 +2222,7 @@ def test_delete_local_inventory(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2247,9 +2267,10 @@ def test_delete_local_inventory_non_empty_request_with_auto_populated_field(): client.delete_local_inventory(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == localinventory.DeleteLocalInventoryRequest( + request_msg = localinventory.DeleteLocalInventoryRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_local_inventory_use_cached_wrapped_rpc(): @@ -2335,9 +2356,15 @@ async def test_delete_local_inventory_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + localinventory.DeleteLocalInventoryRequest(), + {}, + ], +) async def test_delete_local_inventory_async( - transport: str = "grpc_asyncio", - request_type=localinventory.DeleteLocalInventoryRequest, + request_type, transport: str = "grpc_asyncio" ): client = LocalInventoryServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2346,7 +2373,7 @@ async def test_delete_local_inventory_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( @@ -2366,11 +2393,6 @@ async def test_delete_local_inventory_async( assert response is None -@pytest.mark.asyncio -async def test_delete_local_inventory_async_from_dict(): - await test_delete_local_inventory_async(request_type=dict) - - def test_delete_local_inventory_field_headers(): client = LocalInventoryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3218,7 +3240,6 @@ def test_list_local_inventories_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = localinventory.ListLocalInventoriesRequest() - assert args[0] == request_msg @@ -3241,7 +3262,6 @@ def test_insert_local_inventory_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = localinventory.InsertLocalInventoryRequest() - assert args[0] == request_msg @@ -3264,7 +3284,6 @@ def test_delete_local_inventory_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = localinventory.DeleteLocalInventoryRequest() - assert args[0] == request_msg @@ -3307,7 +3326,6 @@ async def test_list_local_inventories_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = localinventory.ListLocalInventoriesRequest() - assert args[0] == request_msg @@ -3339,7 +3357,6 @@ async def test_insert_local_inventory_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = localinventory.InsertLocalInventoryRequest() - assert args[0] == request_msg @@ -3364,7 +3381,6 @@ async def test_delete_local_inventory_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = localinventory.DeleteLocalInventoryRequest() - assert args[0] == request_msg @@ -3893,7 +3909,6 @@ def test_list_local_inventories_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = localinventory.ListLocalInventoriesRequest() - assert args[0] == request_msg @@ -3915,7 +3930,6 @@ def test_insert_local_inventory_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = localinventory.InsertLocalInventoryRequest() - assert args[0] == request_msg @@ -3937,7 +3951,6 @@ def test_delete_local_inventory_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = localinventory.DeleteLocalInventoryRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-inventories/tests/unit/gapic/merchant_inventories_v1/test_regional_inventory_service.py b/packages/google-shopping-merchant-inventories/tests/unit/gapic/merchant_inventories_v1/test_regional_inventory_service.py index e23c2b50209a..6e60af769285 100644 --- a/packages/google-shopping-merchant-inventories/tests/unit/gapic/merchant_inventories_v1/test_regional_inventory_service.py +++ b/packages/google-shopping-merchant-inventories/tests/unit/gapic/merchant_inventories_v1/test_regional_inventory_service.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 @@ -113,6 +114,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" @@ -1388,8 +1404,8 @@ def test_regional_inventory_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - regionalinventory.ListRegionalInventoriesRequest, - dict, + regionalinventory.ListRegionalInventoriesRequest(), + {}, ], ) def test_list_regional_inventories(request_type, transport: str = "grpc"): @@ -1400,7 +1416,7 @@ def test_list_regional_inventories(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1449,10 +1465,11 @@ def test_list_regional_inventories_non_empty_request_with_auto_populated_field() client.list_regional_inventories(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == regionalinventory.ListRegionalInventoriesRequest( + request_msg = regionalinventory.ListRegionalInventoriesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_regional_inventories_use_cached_wrapped_rpc(): @@ -1538,9 +1555,15 @@ async def test_list_regional_inventories_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + regionalinventory.ListRegionalInventoriesRequest(), + {}, + ], +) async def test_list_regional_inventories_async( - transport: str = "grpc_asyncio", - request_type=regionalinventory.ListRegionalInventoriesRequest, + request_type, transport: str = "grpc_asyncio" ): client = RegionalInventoryServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1549,7 +1572,7 @@ async def test_list_regional_inventories_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( @@ -1574,11 +1597,6 @@ async def test_list_regional_inventories_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_regional_inventories_async_from_dict(): - await test_list_regional_inventories_async(request_type=dict) - - def test_list_regional_inventories_field_headers(): client = RegionalInventoryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1935,8 +1953,8 @@ async def test_list_regional_inventories_async_pages(): @pytest.mark.parametrize( "request_type", [ - regionalinventory.InsertRegionalInventoryRequest, - dict, + regionalinventory.InsertRegionalInventoryRequest(), + {}, ], ) def test_insert_regional_inventory(request_type, transport: str = "grpc"): @@ -1947,7 +1965,7 @@ def test_insert_regional_inventory(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2001,9 +2019,10 @@ def test_insert_regional_inventory_non_empty_request_with_auto_populated_field() client.insert_regional_inventory(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == regionalinventory.InsertRegionalInventoryRequest( + request_msg = regionalinventory.InsertRegionalInventoryRequest( parent="parent_value", ) + assert args[0] == request_msg def test_insert_regional_inventory_use_cached_wrapped_rpc(): @@ -2089,9 +2108,15 @@ async def test_insert_regional_inventory_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + regionalinventory.InsertRegionalInventoryRequest(), + {}, + ], +) async def test_insert_regional_inventory_async( - transport: str = "grpc_asyncio", - request_type=regionalinventory.InsertRegionalInventoryRequest, + request_type, transport: str = "grpc_asyncio" ): client = RegionalInventoryServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2100,7 +2125,7 @@ async def test_insert_regional_inventory_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( @@ -2131,11 +2156,6 @@ async def test_insert_regional_inventory_async( assert response.region == "region_value" -@pytest.mark.asyncio -async def test_insert_regional_inventory_async_from_dict(): - await test_insert_regional_inventory_async(request_type=dict) - - def test_insert_regional_inventory_field_headers(): client = RegionalInventoryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2204,8 +2224,8 @@ async def test_insert_regional_inventory_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - regionalinventory.DeleteRegionalInventoryRequest, - dict, + regionalinventory.DeleteRegionalInventoryRequest(), + {}, ], ) def test_delete_regional_inventory(request_type, transport: str = "grpc"): @@ -2216,7 +2236,7 @@ def test_delete_regional_inventory(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2261,9 +2281,10 @@ def test_delete_regional_inventory_non_empty_request_with_auto_populated_field() client.delete_regional_inventory(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == regionalinventory.DeleteRegionalInventoryRequest( + request_msg = regionalinventory.DeleteRegionalInventoryRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_regional_inventory_use_cached_wrapped_rpc(): @@ -2349,9 +2370,15 @@ async def test_delete_regional_inventory_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + regionalinventory.DeleteRegionalInventoryRequest(), + {}, + ], +) async def test_delete_regional_inventory_async( - transport: str = "grpc_asyncio", - request_type=regionalinventory.DeleteRegionalInventoryRequest, + request_type, transport: str = "grpc_asyncio" ): client = RegionalInventoryServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2360,7 +2387,7 @@ async def test_delete_regional_inventory_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( @@ -2380,11 +2407,6 @@ async def test_delete_regional_inventory_async( assert response is None -@pytest.mark.asyncio -async def test_delete_regional_inventory_async_from_dict(): - await test_delete_regional_inventory_async(request_type=dict) - - def test_delete_regional_inventory_field_headers(): client = RegionalInventoryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3237,7 +3259,6 @@ def test_list_regional_inventories_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = regionalinventory.ListRegionalInventoriesRequest() - assert args[0] == request_msg @@ -3260,7 +3281,6 @@ def test_insert_regional_inventory_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = regionalinventory.InsertRegionalInventoryRequest() - assert args[0] == request_msg @@ -3283,7 +3303,6 @@ def test_delete_regional_inventory_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = regionalinventory.DeleteRegionalInventoryRequest() - assert args[0] == request_msg @@ -3326,7 +3345,6 @@ async def test_list_regional_inventories_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = regionalinventory.ListRegionalInventoriesRequest() - assert args[0] == request_msg @@ -3358,7 +3376,6 @@ async def test_insert_regional_inventory_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = regionalinventory.InsertRegionalInventoryRequest() - assert args[0] == request_msg @@ -3383,7 +3400,6 @@ async def test_delete_regional_inventory_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = regionalinventory.DeleteRegionalInventoryRequest() - assert args[0] == request_msg @@ -3913,7 +3929,6 @@ def test_list_regional_inventories_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = regionalinventory.ListRegionalInventoriesRequest() - assert args[0] == request_msg @@ -3935,7 +3950,6 @@ def test_insert_regional_inventory_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = regionalinventory.InsertRegionalInventoryRequest() - assert args[0] == request_msg @@ -3957,7 +3971,6 @@ def test_delete_regional_inventory_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = regionalinventory.DeleteRegionalInventoryRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-inventories/tests/unit/gapic/merchant_inventories_v1beta/test_local_inventory_service.py b/packages/google-shopping-merchant-inventories/tests/unit/gapic/merchant_inventories_v1beta/test_local_inventory_service.py index b48026ca0c9d..d2faa4be0f72 100644 --- a/packages/google-shopping-merchant-inventories/tests/unit/gapic/merchant_inventories_v1beta/test_local_inventory_service.py +++ b/packages/google-shopping-merchant-inventories/tests/unit/gapic/merchant_inventories_v1beta/test_local_inventory_service.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 @@ -110,6 +111,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" @@ -1375,8 +1391,8 @@ def test_local_inventory_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - localinventory.ListLocalInventoriesRequest, - dict, + localinventory.ListLocalInventoriesRequest(), + {}, ], ) def test_list_local_inventories(request_type, transport: str = "grpc"): @@ -1387,7 +1403,7 @@ def test_list_local_inventories(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1436,10 +1452,11 @@ def test_list_local_inventories_non_empty_request_with_auto_populated_field(): client.list_local_inventories(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == localinventory.ListLocalInventoriesRequest( + request_msg = localinventory.ListLocalInventoriesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_local_inventories_use_cached_wrapped_rpc(): @@ -1525,9 +1542,15 @@ async def test_list_local_inventories_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + localinventory.ListLocalInventoriesRequest(), + {}, + ], +) async def test_list_local_inventories_async( - transport: str = "grpc_asyncio", - request_type=localinventory.ListLocalInventoriesRequest, + request_type, transport: str = "grpc_asyncio" ): client = LocalInventoryServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1536,7 +1559,7 @@ async def test_list_local_inventories_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( @@ -1561,11 +1584,6 @@ async def test_list_local_inventories_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_local_inventories_async_from_dict(): - await test_list_local_inventories_async(request_type=dict) - - def test_list_local_inventories_field_headers(): client = LocalInventoryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1918,8 +1936,8 @@ async def test_list_local_inventories_async_pages(): @pytest.mark.parametrize( "request_type", [ - localinventory.InsertLocalInventoryRequest, - dict, + localinventory.InsertLocalInventoryRequest(), + {}, ], ) def test_insert_local_inventory(request_type, transport: str = "grpc"): @@ -1930,7 +1948,7 @@ def test_insert_local_inventory(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1992,9 +2010,10 @@ def test_insert_local_inventory_non_empty_request_with_auto_populated_field(): client.insert_local_inventory(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == localinventory.InsertLocalInventoryRequest( + request_msg = localinventory.InsertLocalInventoryRequest( parent="parent_value", ) + assert args[0] == request_msg def test_insert_local_inventory_use_cached_wrapped_rpc(): @@ -2080,9 +2099,15 @@ async def test_insert_local_inventory_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + localinventory.InsertLocalInventoryRequest(), + {}, + ], +) async def test_insert_local_inventory_async( - transport: str = "grpc_asyncio", - request_type=localinventory.InsertLocalInventoryRequest, + request_type, transport: str = "grpc_asyncio" ): client = LocalInventoryServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2091,7 +2116,7 @@ async def test_insert_local_inventory_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( @@ -2130,11 +2155,6 @@ async def test_insert_local_inventory_async( assert response.instore_product_location == "instore_product_location_value" -@pytest.mark.asyncio -async def test_insert_local_inventory_async_from_dict(): - await test_insert_local_inventory_async(request_type=dict) - - def test_insert_local_inventory_field_headers(): client = LocalInventoryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2203,8 +2223,8 @@ async def test_insert_local_inventory_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - localinventory.DeleteLocalInventoryRequest, - dict, + localinventory.DeleteLocalInventoryRequest(), + {}, ], ) def test_delete_local_inventory(request_type, transport: str = "grpc"): @@ -2215,7 +2235,7 @@ def test_delete_local_inventory(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2260,9 +2280,10 @@ def test_delete_local_inventory_non_empty_request_with_auto_populated_field(): client.delete_local_inventory(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == localinventory.DeleteLocalInventoryRequest( + request_msg = localinventory.DeleteLocalInventoryRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_local_inventory_use_cached_wrapped_rpc(): @@ -2348,9 +2369,15 @@ async def test_delete_local_inventory_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + localinventory.DeleteLocalInventoryRequest(), + {}, + ], +) async def test_delete_local_inventory_async( - transport: str = "grpc_asyncio", - request_type=localinventory.DeleteLocalInventoryRequest, + request_type, transport: str = "grpc_asyncio" ): client = LocalInventoryServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2359,7 +2386,7 @@ async def test_delete_local_inventory_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( @@ -2379,11 +2406,6 @@ async def test_delete_local_inventory_async( assert response is None -@pytest.mark.asyncio -async def test_delete_local_inventory_async_from_dict(): - await test_delete_local_inventory_async(request_type=dict) - - def test_delete_local_inventory_field_headers(): client = LocalInventoryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3231,7 +3253,6 @@ def test_list_local_inventories_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = localinventory.ListLocalInventoriesRequest() - assert args[0] == request_msg @@ -3254,7 +3275,6 @@ def test_insert_local_inventory_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = localinventory.InsertLocalInventoryRequest() - assert args[0] == request_msg @@ -3277,7 +3297,6 @@ def test_delete_local_inventory_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = localinventory.DeleteLocalInventoryRequest() - assert args[0] == request_msg @@ -3320,7 +3339,6 @@ async def test_list_local_inventories_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = localinventory.ListLocalInventoriesRequest() - assert args[0] == request_msg @@ -3356,7 +3374,6 @@ async def test_insert_local_inventory_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = localinventory.InsertLocalInventoryRequest() - assert args[0] == request_msg @@ -3381,7 +3398,6 @@ async def test_delete_local_inventory_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = localinventory.DeleteLocalInventoryRequest() - assert args[0] == request_msg @@ -3907,7 +3923,6 @@ def test_list_local_inventories_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = localinventory.ListLocalInventoriesRequest() - assert args[0] == request_msg @@ -3929,7 +3944,6 @@ def test_insert_local_inventory_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = localinventory.InsertLocalInventoryRequest() - assert args[0] == request_msg @@ -3951,7 +3965,6 @@ def test_delete_local_inventory_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = localinventory.DeleteLocalInventoryRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-inventories/tests/unit/gapic/merchant_inventories_v1beta/test_regional_inventory_service.py b/packages/google-shopping-merchant-inventories/tests/unit/gapic/merchant_inventories_v1beta/test_regional_inventory_service.py index 1232e61df9e0..2051454957fa 100644 --- a/packages/google-shopping-merchant-inventories/tests/unit/gapic/merchant_inventories_v1beta/test_regional_inventory_service.py +++ b/packages/google-shopping-merchant-inventories/tests/unit/gapic/merchant_inventories_v1beta/test_regional_inventory_service.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 @@ -110,6 +111,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" @@ -1385,8 +1401,8 @@ def test_regional_inventory_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - regionalinventory.ListRegionalInventoriesRequest, - dict, + regionalinventory.ListRegionalInventoriesRequest(), + {}, ], ) def test_list_regional_inventories(request_type, transport: str = "grpc"): @@ -1397,7 +1413,7 @@ def test_list_regional_inventories(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1446,10 +1462,11 @@ def test_list_regional_inventories_non_empty_request_with_auto_populated_field() client.list_regional_inventories(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == regionalinventory.ListRegionalInventoriesRequest( + request_msg = regionalinventory.ListRegionalInventoriesRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_regional_inventories_use_cached_wrapped_rpc(): @@ -1535,9 +1552,15 @@ async def test_list_regional_inventories_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + regionalinventory.ListRegionalInventoriesRequest(), + {}, + ], +) async def test_list_regional_inventories_async( - transport: str = "grpc_asyncio", - request_type=regionalinventory.ListRegionalInventoriesRequest, + request_type, transport: str = "grpc_asyncio" ): client = RegionalInventoryServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1546,7 +1569,7 @@ async def test_list_regional_inventories_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( @@ -1571,11 +1594,6 @@ async def test_list_regional_inventories_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_regional_inventories_async_from_dict(): - await test_list_regional_inventories_async(request_type=dict) - - def test_list_regional_inventories_field_headers(): client = RegionalInventoryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1932,8 +1950,8 @@ async def test_list_regional_inventories_async_pages(): @pytest.mark.parametrize( "request_type", [ - regionalinventory.InsertRegionalInventoryRequest, - dict, + regionalinventory.InsertRegionalInventoryRequest(), + {}, ], ) def test_insert_regional_inventory(request_type, transport: str = "grpc"): @@ -1944,7 +1962,7 @@ def test_insert_regional_inventory(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1998,9 +2016,10 @@ def test_insert_regional_inventory_non_empty_request_with_auto_populated_field() client.insert_regional_inventory(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == regionalinventory.InsertRegionalInventoryRequest( + request_msg = regionalinventory.InsertRegionalInventoryRequest( parent="parent_value", ) + assert args[0] == request_msg def test_insert_regional_inventory_use_cached_wrapped_rpc(): @@ -2086,9 +2105,15 @@ async def test_insert_regional_inventory_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + regionalinventory.InsertRegionalInventoryRequest(), + {}, + ], +) async def test_insert_regional_inventory_async( - transport: str = "grpc_asyncio", - request_type=regionalinventory.InsertRegionalInventoryRequest, + request_type, transport: str = "grpc_asyncio" ): client = RegionalInventoryServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2097,7 +2122,7 @@ async def test_insert_regional_inventory_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( @@ -2128,11 +2153,6 @@ async def test_insert_regional_inventory_async( assert response.availability == "availability_value" -@pytest.mark.asyncio -async def test_insert_regional_inventory_async_from_dict(): - await test_insert_regional_inventory_async(request_type=dict) - - def test_insert_regional_inventory_field_headers(): client = RegionalInventoryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2201,8 +2221,8 @@ async def test_insert_regional_inventory_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - regionalinventory.DeleteRegionalInventoryRequest, - dict, + regionalinventory.DeleteRegionalInventoryRequest(), + {}, ], ) def test_delete_regional_inventory(request_type, transport: str = "grpc"): @@ -2213,7 +2233,7 @@ def test_delete_regional_inventory(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2258,9 +2278,10 @@ def test_delete_regional_inventory_non_empty_request_with_auto_populated_field() client.delete_regional_inventory(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == regionalinventory.DeleteRegionalInventoryRequest( + request_msg = regionalinventory.DeleteRegionalInventoryRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_regional_inventory_use_cached_wrapped_rpc(): @@ -2346,9 +2367,15 @@ async def test_delete_regional_inventory_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + regionalinventory.DeleteRegionalInventoryRequest(), + {}, + ], +) async def test_delete_regional_inventory_async( - transport: str = "grpc_asyncio", - request_type=regionalinventory.DeleteRegionalInventoryRequest, + request_type, transport: str = "grpc_asyncio" ): client = RegionalInventoryServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2357,7 +2384,7 @@ async def test_delete_regional_inventory_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( @@ -2377,11 +2404,6 @@ async def test_delete_regional_inventory_async( assert response is None -@pytest.mark.asyncio -async def test_delete_regional_inventory_async_from_dict(): - await test_delete_regional_inventory_async(request_type=dict) - - def test_delete_regional_inventory_field_headers(): client = RegionalInventoryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3234,7 +3256,6 @@ def test_list_regional_inventories_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = regionalinventory.ListRegionalInventoriesRequest() - assert args[0] == request_msg @@ -3257,7 +3278,6 @@ def test_insert_regional_inventory_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = regionalinventory.InsertRegionalInventoryRequest() - assert args[0] == request_msg @@ -3280,7 +3300,6 @@ def test_delete_regional_inventory_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = regionalinventory.DeleteRegionalInventoryRequest() - assert args[0] == request_msg @@ -3323,7 +3342,6 @@ async def test_list_regional_inventories_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = regionalinventory.ListRegionalInventoriesRequest() - assert args[0] == request_msg @@ -3355,7 +3373,6 @@ async def test_insert_regional_inventory_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = regionalinventory.InsertRegionalInventoryRequest() - assert args[0] == request_msg @@ -3380,7 +3397,6 @@ async def test_delete_regional_inventory_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = regionalinventory.DeleteRegionalInventoryRequest() - assert args[0] == request_msg @@ -3899,7 +3915,6 @@ def test_list_regional_inventories_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = regionalinventory.ListRegionalInventoriesRequest() - assert args[0] == request_msg @@ -3921,7 +3936,6 @@ def test_insert_regional_inventory_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = regionalinventory.InsertRegionalInventoryRequest() - assert args[0] == request_msg @@ -3943,7 +3957,6 @@ def test_delete_regional_inventory_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = regionalinventory.DeleteRegionalInventoryRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-issueresolution/noxfile.py b/packages/google-shopping-merchant-issueresolution/noxfile.py index 4f8e460ee9d3..2969c82734bc 100644 --- a/packages/google-shopping-merchant-issueresolution/noxfile.py +++ b/packages/google-shopping-merchant-issueresolution/noxfile.py @@ -47,7 +47,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-shopping-merchant-issueresolution" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-shopping-merchant-issueresolution/setup.py b/packages/google-shopping-merchant-issueresolution/setup.py index 8763dda54901..ab2d9ffc5a01 100644 --- a/packages/google-shopping-merchant-issueresolution/setup.py +++ b/packages/google-shopping-merchant-issueresolution/setup.py @@ -47,7 +47,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/google-shopping-merchant-issueresolution/testing/constraints-3.10.txt b/packages/google-shopping-merchant-issueresolution/testing/constraints-3.10.txt index 28927d49b296..b408428a99a2 100644 --- a/packages/google-shopping-merchant-issueresolution/testing/constraints-3.10.txt +++ b/packages/google-shopping-merchant-issueresolution/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-shopping-type==1.0.0 diff --git a/packages/google-shopping-merchant-issueresolution/tests/unit/gapic/merchant_issueresolution_v1/test_aggregate_product_statuses_service.py b/packages/google-shopping-merchant-issueresolution/tests/unit/gapic/merchant_issueresolution_v1/test_aggregate_product_statuses_service.py index 168df423fda3..0ccf45793574 100644 --- a/packages/google-shopping-merchant-issueresolution/tests/unit/gapic/merchant_issueresolution_v1/test_aggregate_product_statuses_service.py +++ b/packages/google-shopping-merchant-issueresolution/tests/unit/gapic/merchant_issueresolution_v1/test_aggregate_product_statuses_service.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 @@ -107,6 +108,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" @@ -1444,8 +1460,8 @@ def test_aggregate_product_statuses_service_client_create_channel_credentials_fi @pytest.mark.parametrize( "request_type", [ - aggregateproductstatuses.ListAggregateProductStatusesRequest, - dict, + aggregateproductstatuses.ListAggregateProductStatusesRequest(), + {}, ], ) def test_list_aggregate_product_statuses(request_type, transport: str = "grpc"): @@ -1456,7 +1472,7 @@ def test_list_aggregate_product_statuses(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1508,11 +1524,12 @@ def test_list_aggregate_product_statuses_non_empty_request_with_auto_populated_f client.list_aggregate_product_statuses(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == aggregateproductstatuses.ListAggregateProductStatusesRequest( + request_msg = aggregateproductstatuses.ListAggregateProductStatusesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_aggregate_product_statuses_use_cached_wrapped_rpc(): @@ -1598,9 +1615,15 @@ async def test_list_aggregate_product_statuses_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + aggregateproductstatuses.ListAggregateProductStatusesRequest(), + {}, + ], +) async def test_list_aggregate_product_statuses_async( - transport: str = "grpc_asyncio", - request_type=aggregateproductstatuses.ListAggregateProductStatusesRequest, + request_type, transport: str = "grpc_asyncio" ): client = AggregateProductStatusesServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1609,7 +1632,7 @@ async def test_list_aggregate_product_statuses_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( @@ -1634,11 +1657,6 @@ async def test_list_aggregate_product_statuses_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_aggregate_product_statuses_async_from_dict(): - await test_list_aggregate_product_statuses_async(request_type=dict) - - def test_list_aggregate_product_statuses_field_headers(): client = AggregateProductStatusesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2408,7 +2426,6 @@ def test_list_aggregate_product_statuses_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = aggregateproductstatuses.ListAggregateProductStatusesRequest() - assert args[0] == request_msg @@ -2451,7 +2468,6 @@ async def test_list_aggregate_product_statuses_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = aggregateproductstatuses.ListAggregateProductStatusesRequest() - assert args[0] == request_msg @@ -2631,7 +2647,6 @@ def test_list_aggregate_product_statuses_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = aggregateproductstatuses.ListAggregateProductStatusesRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-issueresolution/tests/unit/gapic/merchant_issueresolution_v1/test_issue_resolution_service.py b/packages/google-shopping-merchant-issueresolution/tests/unit/gapic/merchant_issueresolution_v1/test_issue_resolution_service.py index abdc633ea3fc..4ce2be7a1f17 100644 --- a/packages/google-shopping-merchant-issueresolution/tests/unit/gapic/merchant_issueresolution_v1/test_issue_resolution_service.py +++ b/packages/google-shopping-merchant-issueresolution/tests/unit/gapic/merchant_issueresolution_v1/test_issue_resolution_service.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 @@ -106,6 +107,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" @@ -1375,8 +1391,8 @@ def test_issue_resolution_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - issueresolution.RenderAccountIssuesRequest, - dict, + issueresolution.RenderAccountIssuesRequest(), + {}, ], ) def test_render_account_issues(request_type, transport: str = "grpc"): @@ -1387,7 +1403,7 @@ def test_render_account_issues(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1434,11 +1450,12 @@ def test_render_account_issues_non_empty_request_with_auto_populated_field(): client.render_account_issues(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == issueresolution.RenderAccountIssuesRequest( + request_msg = issueresolution.RenderAccountIssuesRequest( name="name_value", language_code="language_code_value", time_zone="time_zone_value", ) + assert args[0] == request_msg def test_render_account_issues_use_cached_wrapped_rpc(): @@ -1524,9 +1541,15 @@ async def test_render_account_issues_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + issueresolution.RenderAccountIssuesRequest(), + {}, + ], +) async def test_render_account_issues_async( - transport: str = "grpc_asyncio", - request_type=issueresolution.RenderAccountIssuesRequest, + request_type, transport: str = "grpc_asyncio" ): client = IssueResolutionServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1535,7 +1558,7 @@ async def test_render_account_issues_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( @@ -1557,11 +1580,6 @@ async def test_render_account_issues_async( assert isinstance(response, issueresolution.RenderAccountIssuesResponse) -@pytest.mark.asyncio -async def test_render_account_issues_async_from_dict(): - await test_render_account_issues_async(request_type=dict) - - def test_render_account_issues_field_headers(): client = IssueResolutionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1716,8 +1734,8 @@ async def test_render_account_issues_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - issueresolution.RenderProductIssuesRequest, - dict, + issueresolution.RenderProductIssuesRequest(), + {}, ], ) def test_render_product_issues(request_type, transport: str = "grpc"): @@ -1728,7 +1746,7 @@ def test_render_product_issues(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1775,11 +1793,12 @@ def test_render_product_issues_non_empty_request_with_auto_populated_field(): client.render_product_issues(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == issueresolution.RenderProductIssuesRequest( + request_msg = issueresolution.RenderProductIssuesRequest( name="name_value", language_code="language_code_value", time_zone="time_zone_value", ) + assert args[0] == request_msg def test_render_product_issues_use_cached_wrapped_rpc(): @@ -1865,9 +1884,15 @@ async def test_render_product_issues_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + issueresolution.RenderProductIssuesRequest(), + {}, + ], +) async def test_render_product_issues_async( - transport: str = "grpc_asyncio", - request_type=issueresolution.RenderProductIssuesRequest, + request_type, transport: str = "grpc_asyncio" ): client = IssueResolutionServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1876,7 +1901,7 @@ async def test_render_product_issues_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( @@ -1898,11 +1923,6 @@ async def test_render_product_issues_async( assert isinstance(response, issueresolution.RenderProductIssuesResponse) -@pytest.mark.asyncio -async def test_render_product_issues_async_from_dict(): - await test_render_product_issues_async(request_type=dict) - - def test_render_product_issues_field_headers(): client = IssueResolutionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2057,8 +2077,8 @@ async def test_render_product_issues_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - issueresolution.TriggerActionRequest, - dict, + issueresolution.TriggerActionRequest(), + {}, ], ) def test_trigger_action(request_type, transport: str = "grpc"): @@ -2069,7 +2089,7 @@ def test_trigger_action(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.trigger_action), "__call__") as call: @@ -2114,10 +2134,11 @@ def test_trigger_action_non_empty_request_with_auto_populated_field(): client.trigger_action(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == issueresolution.TriggerActionRequest( + request_msg = issueresolution.TriggerActionRequest( name="name_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_trigger_action_use_cached_wrapped_rpc(): @@ -2198,9 +2219,14 @@ async def test_trigger_action_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_trigger_action_async( - transport: str = "grpc_asyncio", request_type=issueresolution.TriggerActionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + issueresolution.TriggerActionRequest(), + {}, + ], +) +async def test_trigger_action_async(request_type, transport: str = "grpc_asyncio"): client = IssueResolutionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2208,7 +2234,7 @@ async def test_trigger_action_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.trigger_action), "__call__") as call: @@ -2231,11 +2257,6 @@ async def test_trigger_action_async( assert response.message == "message_value" -@pytest.mark.asyncio -async def test_trigger_action_async_from_dict(): - await test_trigger_action_async(request_type=dict) - - def test_trigger_action_field_headers(): client = IssueResolutionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3091,7 +3112,6 @@ def test_render_account_issues_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = issueresolution.RenderAccountIssuesRequest() - assert args[0] == request_msg @@ -3114,7 +3134,6 @@ def test_render_product_issues_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = issueresolution.RenderProductIssuesRequest() - assert args[0] == request_msg @@ -3135,7 +3154,6 @@ def test_trigger_action_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = issueresolution.TriggerActionRequest() - assert args[0] == request_msg @@ -3176,7 +3194,6 @@ async def test_render_account_issues_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = issueresolution.RenderAccountIssuesRequest() - assert args[0] == request_msg @@ -3203,7 +3220,6 @@ async def test_render_product_issues_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = issueresolution.RenderProductIssuesRequest() - assert args[0] == request_msg @@ -3230,7 +3246,6 @@ async def test_trigger_action_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = issueresolution.TriggerActionRequest() - assert args[0] == request_msg @@ -3891,7 +3906,6 @@ def test_render_account_issues_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = issueresolution.RenderAccountIssuesRequest() - assert args[0] == request_msg @@ -3913,7 +3927,6 @@ def test_render_product_issues_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = issueresolution.RenderProductIssuesRequest() - assert args[0] == request_msg @@ -3933,7 +3946,6 @@ def test_trigger_action_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = issueresolution.TriggerActionRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-issueresolution/tests/unit/gapic/merchant_issueresolution_v1beta/test_aggregate_product_statuses_service.py b/packages/google-shopping-merchant-issueresolution/tests/unit/gapic/merchant_issueresolution_v1beta/test_aggregate_product_statuses_service.py index 7e4da48b2886..db6ecb3b6e5a 100644 --- a/packages/google-shopping-merchant-issueresolution/tests/unit/gapic/merchant_issueresolution_v1beta/test_aggregate_product_statuses_service.py +++ b/packages/google-shopping-merchant-issueresolution/tests/unit/gapic/merchant_issueresolution_v1beta/test_aggregate_product_statuses_service.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 @@ -109,6 +110,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" @@ -1446,8 +1462,8 @@ def test_aggregate_product_statuses_service_client_create_channel_credentials_fi @pytest.mark.parametrize( "request_type", [ - aggregateproductstatuses.ListAggregateProductStatusesRequest, - dict, + aggregateproductstatuses.ListAggregateProductStatusesRequest(), + {}, ], ) def test_list_aggregate_product_statuses(request_type, transport: str = "grpc"): @@ -1458,7 +1474,7 @@ def test_list_aggregate_product_statuses(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1510,11 +1526,12 @@ def test_list_aggregate_product_statuses_non_empty_request_with_auto_populated_f client.list_aggregate_product_statuses(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == aggregateproductstatuses.ListAggregateProductStatusesRequest( + request_msg = aggregateproductstatuses.ListAggregateProductStatusesRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_aggregate_product_statuses_use_cached_wrapped_rpc(): @@ -1600,9 +1617,15 @@ async def test_list_aggregate_product_statuses_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + aggregateproductstatuses.ListAggregateProductStatusesRequest(), + {}, + ], +) async def test_list_aggregate_product_statuses_async( - transport: str = "grpc_asyncio", - request_type=aggregateproductstatuses.ListAggregateProductStatusesRequest, + request_type, transport: str = "grpc_asyncio" ): client = AggregateProductStatusesServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1611,7 +1634,7 @@ async def test_list_aggregate_product_statuses_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( @@ -1636,11 +1659,6 @@ async def test_list_aggregate_product_statuses_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_aggregate_product_statuses_async_from_dict(): - await test_list_aggregate_product_statuses_async(request_type=dict) - - def test_list_aggregate_product_statuses_field_headers(): client = AggregateProductStatusesServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2410,7 +2428,6 @@ def test_list_aggregate_product_statuses_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = aggregateproductstatuses.ListAggregateProductStatusesRequest() - assert args[0] == request_msg @@ -2453,7 +2470,6 @@ async def test_list_aggregate_product_statuses_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = aggregateproductstatuses.ListAggregateProductStatusesRequest() - assert args[0] == request_msg @@ -2633,7 +2649,6 @@ def test_list_aggregate_product_statuses_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = aggregateproductstatuses.ListAggregateProductStatusesRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-issueresolution/tests/unit/gapic/merchant_issueresolution_v1beta/test_issue_resolution_service.py b/packages/google-shopping-merchant-issueresolution/tests/unit/gapic/merchant_issueresolution_v1beta/test_issue_resolution_service.py index 0fee1e930bfa..d7f346338766 100644 --- a/packages/google-shopping-merchant-issueresolution/tests/unit/gapic/merchant_issueresolution_v1beta/test_issue_resolution_service.py +++ b/packages/google-shopping-merchant-issueresolution/tests/unit/gapic/merchant_issueresolution_v1beta/test_issue_resolution_service.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 @@ -106,6 +107,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" @@ -1375,8 +1391,8 @@ def test_issue_resolution_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - issueresolution.RenderAccountIssuesRequest, - dict, + issueresolution.RenderAccountIssuesRequest(), + {}, ], ) def test_render_account_issues(request_type, transport: str = "grpc"): @@ -1387,7 +1403,7 @@ def test_render_account_issues(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1434,11 +1450,12 @@ def test_render_account_issues_non_empty_request_with_auto_populated_field(): client.render_account_issues(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == issueresolution.RenderAccountIssuesRequest( + request_msg = issueresolution.RenderAccountIssuesRequest( name="name_value", language_code="language_code_value", time_zone="time_zone_value", ) + assert args[0] == request_msg def test_render_account_issues_use_cached_wrapped_rpc(): @@ -1524,9 +1541,15 @@ async def test_render_account_issues_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + issueresolution.RenderAccountIssuesRequest(), + {}, + ], +) async def test_render_account_issues_async( - transport: str = "grpc_asyncio", - request_type=issueresolution.RenderAccountIssuesRequest, + request_type, transport: str = "grpc_asyncio" ): client = IssueResolutionServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1535,7 +1558,7 @@ async def test_render_account_issues_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( @@ -1557,11 +1580,6 @@ async def test_render_account_issues_async( assert isinstance(response, issueresolution.RenderAccountIssuesResponse) -@pytest.mark.asyncio -async def test_render_account_issues_async_from_dict(): - await test_render_account_issues_async(request_type=dict) - - def test_render_account_issues_field_headers(): client = IssueResolutionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1716,8 +1734,8 @@ async def test_render_account_issues_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - issueresolution.RenderProductIssuesRequest, - dict, + issueresolution.RenderProductIssuesRequest(), + {}, ], ) def test_render_product_issues(request_type, transport: str = "grpc"): @@ -1728,7 +1746,7 @@ def test_render_product_issues(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1775,11 +1793,12 @@ def test_render_product_issues_non_empty_request_with_auto_populated_field(): client.render_product_issues(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == issueresolution.RenderProductIssuesRequest( + request_msg = issueresolution.RenderProductIssuesRequest( name="name_value", language_code="language_code_value", time_zone="time_zone_value", ) + assert args[0] == request_msg def test_render_product_issues_use_cached_wrapped_rpc(): @@ -1865,9 +1884,15 @@ async def test_render_product_issues_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + issueresolution.RenderProductIssuesRequest(), + {}, + ], +) async def test_render_product_issues_async( - transport: str = "grpc_asyncio", - request_type=issueresolution.RenderProductIssuesRequest, + request_type, transport: str = "grpc_asyncio" ): client = IssueResolutionServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1876,7 +1901,7 @@ async def test_render_product_issues_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( @@ -1898,11 +1923,6 @@ async def test_render_product_issues_async( assert isinstance(response, issueresolution.RenderProductIssuesResponse) -@pytest.mark.asyncio -async def test_render_product_issues_async_from_dict(): - await test_render_product_issues_async(request_type=dict) - - def test_render_product_issues_field_headers(): client = IssueResolutionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2057,8 +2077,8 @@ async def test_render_product_issues_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - issueresolution.TriggerActionRequest, - dict, + issueresolution.TriggerActionRequest(), + {}, ], ) def test_trigger_action(request_type, transport: str = "grpc"): @@ -2069,7 +2089,7 @@ def test_trigger_action(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.trigger_action), "__call__") as call: @@ -2114,10 +2134,11 @@ def test_trigger_action_non_empty_request_with_auto_populated_field(): client.trigger_action(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == issueresolution.TriggerActionRequest( + request_msg = issueresolution.TriggerActionRequest( name="name_value", language_code="language_code_value", ) + assert args[0] == request_msg def test_trigger_action_use_cached_wrapped_rpc(): @@ -2198,9 +2219,14 @@ async def test_trigger_action_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_trigger_action_async( - transport: str = "grpc_asyncio", request_type=issueresolution.TriggerActionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + issueresolution.TriggerActionRequest(), + {}, + ], +) +async def test_trigger_action_async(request_type, transport: str = "grpc_asyncio"): client = IssueResolutionServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2208,7 +2234,7 @@ async def test_trigger_action_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.trigger_action), "__call__") as call: @@ -2231,11 +2257,6 @@ async def test_trigger_action_async( assert response.message == "message_value" -@pytest.mark.asyncio -async def test_trigger_action_async_from_dict(): - await test_trigger_action_async(request_type=dict) - - def test_trigger_action_field_headers(): client = IssueResolutionServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3091,7 +3112,6 @@ def test_render_account_issues_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = issueresolution.RenderAccountIssuesRequest() - assert args[0] == request_msg @@ -3114,7 +3134,6 @@ def test_render_product_issues_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = issueresolution.RenderProductIssuesRequest() - assert args[0] == request_msg @@ -3135,7 +3154,6 @@ def test_trigger_action_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = issueresolution.TriggerActionRequest() - assert args[0] == request_msg @@ -3176,7 +3194,6 @@ async def test_render_account_issues_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = issueresolution.RenderAccountIssuesRequest() - assert args[0] == request_msg @@ -3203,7 +3220,6 @@ async def test_render_product_issues_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = issueresolution.RenderProductIssuesRequest() - assert args[0] == request_msg @@ -3230,7 +3246,6 @@ async def test_trigger_action_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = issueresolution.TriggerActionRequest() - assert args[0] == request_msg @@ -3891,7 +3906,6 @@ def test_render_account_issues_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = issueresolution.RenderAccountIssuesRequest() - assert args[0] == request_msg @@ -3913,7 +3927,6 @@ def test_render_product_issues_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = issueresolution.RenderProductIssuesRequest() - assert args[0] == request_msg @@ -3933,7 +3946,6 @@ def test_trigger_action_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = issueresolution.TriggerActionRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-lfp/noxfile.py b/packages/google-shopping-merchant-lfp/noxfile.py index 8e2f305b4fb7..9afbefc28ecc 100644 --- a/packages/google-shopping-merchant-lfp/noxfile.py +++ b/packages/google-shopping-merchant-lfp/noxfile.py @@ -47,7 +47,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-shopping-merchant-lfp" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-shopping-merchant-lfp/setup.py b/packages/google-shopping-merchant-lfp/setup.py index 9297a61a2f3a..e8228bbd3130 100644 --- a/packages/google-shopping-merchant-lfp/setup.py +++ b/packages/google-shopping-merchant-lfp/setup.py @@ -45,7 +45,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/google-shopping-merchant-lfp/testing/constraints-3.10.txt b/packages/google-shopping-merchant-lfp/testing/constraints-3.10.txt index 28927d49b296..b408428a99a2 100644 --- a/packages/google-shopping-merchant-lfp/testing/constraints-3.10.txt +++ b/packages/google-shopping-merchant-lfp/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-shopping-type==1.0.0 diff --git a/packages/google-shopping-merchant-lfp/tests/unit/gapic/merchant_lfp_v1/test_lfp_inventory_service.py b/packages/google-shopping-merchant-lfp/tests/unit/gapic/merchant_lfp_v1/test_lfp_inventory_service.py index 4e66b28b3205..3fe80cca0607 100644 --- a/packages/google-shopping-merchant-lfp/tests/unit/gapic/merchant_lfp_v1/test_lfp_inventory_service.py +++ b/packages/google-shopping-merchant-lfp/tests/unit/gapic/merchant_lfp_v1/test_lfp_inventory_service.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 @@ -108,6 +109,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" @@ -1371,8 +1387,8 @@ def test_lfp_inventory_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - lfpinventory.InsertLfpInventoryRequest, - dict, + lfpinventory.InsertLfpInventoryRequest(), + {}, ], ) def test_insert_lfp_inventory(request_type, transport: str = "grpc"): @@ -1383,7 +1399,7 @@ def test_insert_lfp_inventory(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1453,9 +1469,10 @@ def test_insert_lfp_inventory_non_empty_request_with_auto_populated_field(): client.insert_lfp_inventory(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == lfpinventory.InsertLfpInventoryRequest( + request_msg = lfpinventory.InsertLfpInventoryRequest( parent="parent_value", ) + assert args[0] == request_msg def test_insert_lfp_inventory_use_cached_wrapped_rpc(): @@ -1540,8 +1557,15 @@ async def test_insert_lfp_inventory_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + lfpinventory.InsertLfpInventoryRequest(), + {}, + ], +) async def test_insert_lfp_inventory_async( - transport: str = "grpc_asyncio", request_type=lfpinventory.InsertLfpInventoryRequest + request_type, transport: str = "grpc_asyncio" ): client = LfpInventoryServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1550,7 +1574,7 @@ async def test_insert_lfp_inventory_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( @@ -1597,11 +1621,6 @@ async def test_insert_lfp_inventory_async( assert response.feed_label == "feed_label_value" -@pytest.mark.asyncio -async def test_insert_lfp_inventory_async_from_dict(): - await test_insert_lfp_inventory_async(request_type=dict) - - def test_insert_lfp_inventory_field_headers(): client = LfpInventoryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1925,7 +1944,6 @@ def test_insert_lfp_inventory_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lfpinventory.InsertLfpInventoryRequest() - assert args[0] == request_msg @@ -1979,7 +1997,6 @@ async def test_insert_lfp_inventory_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lfpinventory.InsertLfpInventoryRequest() - assert args[0] == request_msg @@ -2251,7 +2268,6 @@ def test_insert_lfp_inventory_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lfpinventory.InsertLfpInventoryRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-lfp/tests/unit/gapic/merchant_lfp_v1/test_lfp_merchant_state_service.py b/packages/google-shopping-merchant-lfp/tests/unit/gapic/merchant_lfp_v1/test_lfp_merchant_state_service.py index 25cbecdf5d36..8ec926de5f48 100644 --- a/packages/google-shopping-merchant-lfp/tests/unit/gapic/merchant_lfp_v1/test_lfp_merchant_state_service.py +++ b/packages/google-shopping-merchant-lfp/tests/unit/gapic/merchant_lfp_v1/test_lfp_merchant_state_service.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 @@ -106,6 +107,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" @@ -1375,8 +1391,8 @@ def test_lfp_merchant_state_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - lfpmerchantstate.GetLfpMerchantStateRequest, - dict, + lfpmerchantstate.GetLfpMerchantStateRequest(), + {}, ], ) def test_get_lfp_merchant_state(request_type, transport: str = "grpc"): @@ -1387,7 +1403,7 @@ def test_get_lfp_merchant_state(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1437,9 +1453,10 @@ def test_get_lfp_merchant_state_non_empty_request_with_auto_populated_field(): client.get_lfp_merchant_state(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == lfpmerchantstate.GetLfpMerchantStateRequest( + request_msg = lfpmerchantstate.GetLfpMerchantStateRequest( name="name_value", ) + assert args[0] == request_msg def test_get_lfp_merchant_state_use_cached_wrapped_rpc(): @@ -1525,9 +1542,15 @@ async def test_get_lfp_merchant_state_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + lfpmerchantstate.GetLfpMerchantStateRequest(), + {}, + ], +) async def test_get_lfp_merchant_state_async( - transport: str = "grpc_asyncio", - request_type=lfpmerchantstate.GetLfpMerchantStateRequest, + request_type, transport: str = "grpc_asyncio" ): client = LfpMerchantStateServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1536,7 +1559,7 @@ async def test_get_lfp_merchant_state_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( @@ -1563,11 +1586,6 @@ async def test_get_lfp_merchant_state_async( assert response.linked_gbps == 1154 -@pytest.mark.asyncio -async def test_get_lfp_merchant_state_async_from_dict(): - await test_get_lfp_merchant_state_async(request_type=dict) - - def test_get_lfp_merchant_state_field_headers(): client = LfpMerchantStateServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2026,7 +2044,6 @@ def test_get_lfp_merchant_state_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lfpmerchantstate.GetLfpMerchantStateRequest() - assert args[0] == request_msg @@ -2070,7 +2087,6 @@ async def test_get_lfp_merchant_state_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lfpmerchantstate.GetLfpMerchantStateRequest() - assert args[0] == request_msg @@ -2243,7 +2259,6 @@ def test_get_lfp_merchant_state_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lfpmerchantstate.GetLfpMerchantStateRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-lfp/tests/unit/gapic/merchant_lfp_v1/test_lfp_sale_service.py b/packages/google-shopping-merchant-lfp/tests/unit/gapic/merchant_lfp_v1/test_lfp_sale_service.py index 092cae508f29..643f5b1f215c 100644 --- a/packages/google-shopping-merchant-lfp/tests/unit/gapic/merchant_lfp_v1/test_lfp_sale_service.py +++ b/packages/google-shopping-merchant-lfp/tests/unit/gapic/merchant_lfp_v1/test_lfp_sale_service.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 @@ -108,6 +109,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" @@ -1315,8 +1331,8 @@ def test_lfp_sale_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - lfpsale.InsertLfpSaleRequest, - dict, + lfpsale.InsertLfpSaleRequest(), + {}, ], ) def test_insert_lfp_sale(request_type, transport: str = "grpc"): @@ -1327,7 +1343,7 @@ def test_insert_lfp_sale(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.insert_lfp_sale), "__call__") as call: @@ -1389,9 +1405,10 @@ def test_insert_lfp_sale_non_empty_request_with_auto_populated_field(): client.insert_lfp_sale(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == lfpsale.InsertLfpSaleRequest( + request_msg = lfpsale.InsertLfpSaleRequest( parent="parent_value", ) + assert args[0] == request_msg def test_insert_lfp_sale_use_cached_wrapped_rpc(): @@ -1472,9 +1489,14 @@ async def test_insert_lfp_sale_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_insert_lfp_sale_async( - transport: str = "grpc_asyncio", request_type=lfpsale.InsertLfpSaleRequest -): +@pytest.mark.parametrize( + "request_type", + [ + lfpsale.InsertLfpSaleRequest(), + {}, + ], +) +async def test_insert_lfp_sale_async(request_type, transport: str = "grpc_asyncio"): client = LfpSaleServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1482,7 +1504,7 @@ async def test_insert_lfp_sale_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.insert_lfp_sale), "__call__") as call: @@ -1523,11 +1545,6 @@ async def test_insert_lfp_sale_async( assert response.feed_label == "feed_label_value" -@pytest.mark.asyncio -async def test_insert_lfp_sale_async_from_dict(): - await test_insert_lfp_sale_async(request_type=dict) - - def test_insert_lfp_sale_field_headers(): client = LfpSaleServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1839,7 +1856,6 @@ def test_insert_lfp_sale_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lfpsale.InsertLfpSaleRequest() - assert args[0] == request_msg @@ -1889,7 +1905,6 @@ async def test_insert_lfp_sale_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lfpsale.InsertLfpSaleRequest() - assert args[0] == request_msg @@ -2149,7 +2164,6 @@ def test_insert_lfp_sale_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lfpsale.InsertLfpSaleRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-lfp/tests/unit/gapic/merchant_lfp_v1/test_lfp_store_service.py b/packages/google-shopping-merchant-lfp/tests/unit/gapic/merchant_lfp_v1/test_lfp_store_service.py index 7b36c2f77f82..4e2809e00644 100644 --- a/packages/google-shopping-merchant-lfp/tests/unit/gapic/merchant_lfp_v1/test_lfp_store_service.py +++ b/packages/google-shopping-merchant-lfp/tests/unit/gapic/merchant_lfp_v1/test_lfp_store_service.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 @@ -107,6 +108,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" @@ -1334,8 +1350,8 @@ def test_lfp_store_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - lfpstore.GetLfpStoreRequest, - dict, + lfpstore.GetLfpStoreRequest(), + {}, ], ) def test_get_lfp_store(request_type, transport: str = "grpc"): @@ -1346,7 +1362,7 @@ def test_get_lfp_store(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_lfp_store), "__call__") as call: @@ -1413,9 +1429,10 @@ def test_get_lfp_store_non_empty_request_with_auto_populated_field(): client.get_lfp_store(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == lfpstore.GetLfpStoreRequest( + request_msg = lfpstore.GetLfpStoreRequest( name="name_value", ) + assert args[0] == request_msg def test_get_lfp_store_use_cached_wrapped_rpc(): @@ -1496,9 +1513,14 @@ async def test_get_lfp_store_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_lfp_store_async( - transport: str = "grpc_asyncio", request_type=lfpstore.GetLfpStoreRequest -): +@pytest.mark.parametrize( + "request_type", + [ + lfpstore.GetLfpStoreRequest(), + {}, + ], +) +async def test_get_lfp_store_async(request_type, transport: str = "grpc_asyncio"): client = LfpStoreServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1506,7 +1528,7 @@ async def test_get_lfp_store_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_lfp_store), "__call__") as call: @@ -1552,11 +1574,6 @@ async def test_get_lfp_store_async( assert response.matching_state_hint == "matching_state_hint_value" -@pytest.mark.asyncio -async def test_get_lfp_store_async_from_dict(): - await test_get_lfp_store_async(request_type=dict) - - def test_get_lfp_store_field_headers(): client = LfpStoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1699,8 +1716,8 @@ async def test_get_lfp_store_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - lfpstore.InsertLfpStoreRequest, - dict, + lfpstore.InsertLfpStoreRequest(), + {}, ], ) def test_insert_lfp_store(request_type, transport: str = "grpc"): @@ -1711,7 +1728,7 @@ def test_insert_lfp_store(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.insert_lfp_store), "__call__") as call: @@ -1778,9 +1795,10 @@ def test_insert_lfp_store_non_empty_request_with_auto_populated_field(): client.insert_lfp_store(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == lfpstore.InsertLfpStoreRequest( + request_msg = lfpstore.InsertLfpStoreRequest( parent="parent_value", ) + assert args[0] == request_msg def test_insert_lfp_store_use_cached_wrapped_rpc(): @@ -1863,9 +1881,14 @@ async def test_insert_lfp_store_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_insert_lfp_store_async( - transport: str = "grpc_asyncio", request_type=lfpstore.InsertLfpStoreRequest -): +@pytest.mark.parametrize( + "request_type", + [ + lfpstore.InsertLfpStoreRequest(), + {}, + ], +) +async def test_insert_lfp_store_async(request_type, transport: str = "grpc_asyncio"): client = LfpStoreServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1873,7 +1896,7 @@ async def test_insert_lfp_store_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.insert_lfp_store), "__call__") as call: @@ -1919,11 +1942,6 @@ async def test_insert_lfp_store_async( assert response.matching_state_hint == "matching_state_hint_value" -@pytest.mark.asyncio -async def test_insert_lfp_store_async_from_dict(): - await test_insert_lfp_store_async(request_type=dict) - - def test_insert_lfp_store_field_headers(): client = LfpStoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2076,8 +2094,8 @@ async def test_insert_lfp_store_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - lfpstore.DeleteLfpStoreRequest, - dict, + lfpstore.DeleteLfpStoreRequest(), + {}, ], ) def test_delete_lfp_store(request_type, transport: str = "grpc"): @@ -2088,7 +2106,7 @@ def test_delete_lfp_store(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_lfp_store), "__call__") as call: @@ -2129,9 +2147,10 @@ def test_delete_lfp_store_non_empty_request_with_auto_populated_field(): client.delete_lfp_store(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == lfpstore.DeleteLfpStoreRequest( + request_msg = lfpstore.DeleteLfpStoreRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_lfp_store_use_cached_wrapped_rpc(): @@ -2214,9 +2233,14 @@ async def test_delete_lfp_store_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_lfp_store_async( - transport: str = "grpc_asyncio", request_type=lfpstore.DeleteLfpStoreRequest -): +@pytest.mark.parametrize( + "request_type", + [ + lfpstore.DeleteLfpStoreRequest(), + {}, + ], +) +async def test_delete_lfp_store_async(request_type, transport: str = "grpc_asyncio"): client = LfpStoreServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2224,7 +2248,7 @@ async def test_delete_lfp_store_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_lfp_store), "__call__") as call: @@ -2242,11 +2266,6 @@ async def test_delete_lfp_store_async( assert response is None -@pytest.mark.asyncio -async def test_delete_lfp_store_async_from_dict(): - await test_delete_lfp_store_async(request_type=dict) - - def test_delete_lfp_store_field_headers(): client = LfpStoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2389,8 +2408,8 @@ async def test_delete_lfp_store_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - lfpstore.ListLfpStoresRequest, - dict, + lfpstore.ListLfpStoresRequest(), + {}, ], ) def test_list_lfp_stores(request_type, transport: str = "grpc"): @@ -2401,7 +2420,7 @@ def test_list_lfp_stores(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_lfp_stores), "__call__") as call: @@ -2446,10 +2465,11 @@ def test_list_lfp_stores_non_empty_request_with_auto_populated_field(): client.list_lfp_stores(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == lfpstore.ListLfpStoresRequest( + request_msg = lfpstore.ListLfpStoresRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_lfp_stores_use_cached_wrapped_rpc(): @@ -2530,9 +2550,14 @@ async def test_list_lfp_stores_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_lfp_stores_async( - transport: str = "grpc_asyncio", request_type=lfpstore.ListLfpStoresRequest -): +@pytest.mark.parametrize( + "request_type", + [ + lfpstore.ListLfpStoresRequest(), + {}, + ], +) +async def test_list_lfp_stores_async(request_type, transport: str = "grpc_asyncio"): client = LfpStoreServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2540,7 +2565,7 @@ async def test_list_lfp_stores_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_lfp_stores), "__call__") as call: @@ -2563,11 +2588,6 @@ async def test_list_lfp_stores_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_lfp_stores_async_from_dict(): - await test_list_lfp_stores_async(request_type=dict) - - def test_list_lfp_stores_field_headers(): client = LfpStoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3833,7 +3853,6 @@ def test_get_lfp_store_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lfpstore.GetLfpStoreRequest() - assert args[0] == request_msg @@ -3854,7 +3873,6 @@ def test_insert_lfp_store_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lfpstore.InsertLfpStoreRequest() - assert args[0] == request_msg @@ -3875,7 +3893,6 @@ def test_delete_lfp_store_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lfpstore.DeleteLfpStoreRequest() - assert args[0] == request_msg @@ -3896,7 +3913,6 @@ def test_list_lfp_stores_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lfpstore.ListLfpStoresRequest() - assert args[0] == request_msg @@ -3947,7 +3963,6 @@ async def test_get_lfp_store_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lfpstore.GetLfpStoreRequest() - assert args[0] == request_msg @@ -3984,7 +3999,6 @@ async def test_insert_lfp_store_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lfpstore.InsertLfpStoreRequest() - assert args[0] == request_msg @@ -4007,7 +4021,6 @@ async def test_delete_lfp_store_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lfpstore.DeleteLfpStoreRequest() - assert args[0] == request_msg @@ -4034,7 +4047,6 @@ async def test_list_lfp_stores_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lfpstore.ListLfpStoresRequest() - assert args[0] == request_msg @@ -4683,7 +4695,6 @@ def test_get_lfp_store_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lfpstore.GetLfpStoreRequest() - assert args[0] == request_msg @@ -4703,7 +4714,6 @@ def test_insert_lfp_store_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lfpstore.InsertLfpStoreRequest() - assert args[0] == request_msg @@ -4723,7 +4733,6 @@ def test_delete_lfp_store_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lfpstore.DeleteLfpStoreRequest() - assert args[0] == request_msg @@ -4743,7 +4752,6 @@ def test_list_lfp_stores_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lfpstore.ListLfpStoresRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-lfp/tests/unit/gapic/merchant_lfp_v1beta/test_lfp_inventory_service.py b/packages/google-shopping-merchant-lfp/tests/unit/gapic/merchant_lfp_v1beta/test_lfp_inventory_service.py index 630ae87d955d..339d6bffbc41 100644 --- a/packages/google-shopping-merchant-lfp/tests/unit/gapic/merchant_lfp_v1beta/test_lfp_inventory_service.py +++ b/packages/google-shopping-merchant-lfp/tests/unit/gapic/merchant_lfp_v1beta/test_lfp_inventory_service.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 @@ -108,6 +109,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" @@ -1371,8 +1387,8 @@ def test_lfp_inventory_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - lfpinventory.InsertLfpInventoryRequest, - dict, + lfpinventory.InsertLfpInventoryRequest(), + {}, ], ) def test_insert_lfp_inventory(request_type, transport: str = "grpc"): @@ -1383,7 +1399,7 @@ def test_insert_lfp_inventory(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1453,9 +1469,10 @@ def test_insert_lfp_inventory_non_empty_request_with_auto_populated_field(): client.insert_lfp_inventory(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == lfpinventory.InsertLfpInventoryRequest( + request_msg = lfpinventory.InsertLfpInventoryRequest( parent="parent_value", ) + assert args[0] == request_msg def test_insert_lfp_inventory_use_cached_wrapped_rpc(): @@ -1540,8 +1557,15 @@ async def test_insert_lfp_inventory_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + lfpinventory.InsertLfpInventoryRequest(), + {}, + ], +) async def test_insert_lfp_inventory_async( - transport: str = "grpc_asyncio", request_type=lfpinventory.InsertLfpInventoryRequest + request_type, transport: str = "grpc_asyncio" ): client = LfpInventoryServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1550,7 +1574,7 @@ async def test_insert_lfp_inventory_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( @@ -1597,11 +1621,6 @@ async def test_insert_lfp_inventory_async( assert response.feed_label == "feed_label_value" -@pytest.mark.asyncio -async def test_insert_lfp_inventory_async_from_dict(): - await test_insert_lfp_inventory_async(request_type=dict) - - def test_insert_lfp_inventory_field_headers(): client = LfpInventoryServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1925,7 +1944,6 @@ def test_insert_lfp_inventory_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lfpinventory.InsertLfpInventoryRequest() - assert args[0] == request_msg @@ -1979,7 +1997,6 @@ async def test_insert_lfp_inventory_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lfpinventory.InsertLfpInventoryRequest() - assert args[0] == request_msg @@ -2251,7 +2268,6 @@ def test_insert_lfp_inventory_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lfpinventory.InsertLfpInventoryRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-lfp/tests/unit/gapic/merchant_lfp_v1beta/test_lfp_merchant_state_service.py b/packages/google-shopping-merchant-lfp/tests/unit/gapic/merchant_lfp_v1beta/test_lfp_merchant_state_service.py index 02f6eeb81a59..d8a221873f50 100644 --- a/packages/google-shopping-merchant-lfp/tests/unit/gapic/merchant_lfp_v1beta/test_lfp_merchant_state_service.py +++ b/packages/google-shopping-merchant-lfp/tests/unit/gapic/merchant_lfp_v1beta/test_lfp_merchant_state_service.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 @@ -106,6 +107,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" @@ -1375,8 +1391,8 @@ def test_lfp_merchant_state_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - lfpmerchantstate.GetLfpMerchantStateRequest, - dict, + lfpmerchantstate.GetLfpMerchantStateRequest(), + {}, ], ) def test_get_lfp_merchant_state(request_type, transport: str = "grpc"): @@ -1387,7 +1403,7 @@ def test_get_lfp_merchant_state(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1437,9 +1453,10 @@ def test_get_lfp_merchant_state_non_empty_request_with_auto_populated_field(): client.get_lfp_merchant_state(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == lfpmerchantstate.GetLfpMerchantStateRequest( + request_msg = lfpmerchantstate.GetLfpMerchantStateRequest( name="name_value", ) + assert args[0] == request_msg def test_get_lfp_merchant_state_use_cached_wrapped_rpc(): @@ -1525,9 +1542,15 @@ async def test_get_lfp_merchant_state_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + lfpmerchantstate.GetLfpMerchantStateRequest(), + {}, + ], +) async def test_get_lfp_merchant_state_async( - transport: str = "grpc_asyncio", - request_type=lfpmerchantstate.GetLfpMerchantStateRequest, + request_type, transport: str = "grpc_asyncio" ): client = LfpMerchantStateServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1536,7 +1559,7 @@ async def test_get_lfp_merchant_state_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( @@ -1563,11 +1586,6 @@ async def test_get_lfp_merchant_state_async( assert response.linked_gbps == 1154 -@pytest.mark.asyncio -async def test_get_lfp_merchant_state_async_from_dict(): - await test_get_lfp_merchant_state_async(request_type=dict) - - def test_get_lfp_merchant_state_field_headers(): client = LfpMerchantStateServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2027,7 +2045,6 @@ def test_get_lfp_merchant_state_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lfpmerchantstate.GetLfpMerchantStateRequest() - assert args[0] == request_msg @@ -2071,7 +2088,6 @@ async def test_get_lfp_merchant_state_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lfpmerchantstate.GetLfpMerchantStateRequest() - assert args[0] == request_msg @@ -2244,7 +2260,6 @@ def test_get_lfp_merchant_state_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lfpmerchantstate.GetLfpMerchantStateRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-lfp/tests/unit/gapic/merchant_lfp_v1beta/test_lfp_sale_service.py b/packages/google-shopping-merchant-lfp/tests/unit/gapic/merchant_lfp_v1beta/test_lfp_sale_service.py index 4d5f8d415ca4..183fa5b868a5 100644 --- a/packages/google-shopping-merchant-lfp/tests/unit/gapic/merchant_lfp_v1beta/test_lfp_sale_service.py +++ b/packages/google-shopping-merchant-lfp/tests/unit/gapic/merchant_lfp_v1beta/test_lfp_sale_service.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 @@ -108,6 +109,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" @@ -1315,8 +1331,8 @@ def test_lfp_sale_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - lfpsale.InsertLfpSaleRequest, - dict, + lfpsale.InsertLfpSaleRequest(), + {}, ], ) def test_insert_lfp_sale(request_type, transport: str = "grpc"): @@ -1327,7 +1343,7 @@ def test_insert_lfp_sale(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.insert_lfp_sale), "__call__") as call: @@ -1389,9 +1405,10 @@ def test_insert_lfp_sale_non_empty_request_with_auto_populated_field(): client.insert_lfp_sale(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == lfpsale.InsertLfpSaleRequest( + request_msg = lfpsale.InsertLfpSaleRequest( parent="parent_value", ) + assert args[0] == request_msg def test_insert_lfp_sale_use_cached_wrapped_rpc(): @@ -1472,9 +1489,14 @@ async def test_insert_lfp_sale_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_insert_lfp_sale_async( - transport: str = "grpc_asyncio", request_type=lfpsale.InsertLfpSaleRequest -): +@pytest.mark.parametrize( + "request_type", + [ + lfpsale.InsertLfpSaleRequest(), + {}, + ], +) +async def test_insert_lfp_sale_async(request_type, transport: str = "grpc_asyncio"): client = LfpSaleServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1482,7 +1504,7 @@ async def test_insert_lfp_sale_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.insert_lfp_sale), "__call__") as call: @@ -1523,11 +1545,6 @@ async def test_insert_lfp_sale_async( assert response.feed_label == "feed_label_value" -@pytest.mark.asyncio -async def test_insert_lfp_sale_async_from_dict(): - await test_insert_lfp_sale_async(request_type=dict) - - def test_insert_lfp_sale_field_headers(): client = LfpSaleServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1839,7 +1856,6 @@ def test_insert_lfp_sale_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lfpsale.InsertLfpSaleRequest() - assert args[0] == request_msg @@ -1889,7 +1905,6 @@ async def test_insert_lfp_sale_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lfpsale.InsertLfpSaleRequest() - assert args[0] == request_msg @@ -2149,7 +2164,6 @@ def test_insert_lfp_sale_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lfpsale.InsertLfpSaleRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-lfp/tests/unit/gapic/merchant_lfp_v1beta/test_lfp_store_service.py b/packages/google-shopping-merchant-lfp/tests/unit/gapic/merchant_lfp_v1beta/test_lfp_store_service.py index c0a85ee97e39..ecd9b395e488 100644 --- a/packages/google-shopping-merchant-lfp/tests/unit/gapic/merchant_lfp_v1beta/test_lfp_store_service.py +++ b/packages/google-shopping-merchant-lfp/tests/unit/gapic/merchant_lfp_v1beta/test_lfp_store_service.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 @@ -107,6 +108,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" @@ -1334,8 +1350,8 @@ def test_lfp_store_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - lfpstore.GetLfpStoreRequest, - dict, + lfpstore.GetLfpStoreRequest(), + {}, ], ) def test_get_lfp_store(request_type, transport: str = "grpc"): @@ -1346,7 +1362,7 @@ def test_get_lfp_store(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_lfp_store), "__call__") as call: @@ -1413,9 +1429,10 @@ def test_get_lfp_store_non_empty_request_with_auto_populated_field(): client.get_lfp_store(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == lfpstore.GetLfpStoreRequest( + request_msg = lfpstore.GetLfpStoreRequest( name="name_value", ) + assert args[0] == request_msg def test_get_lfp_store_use_cached_wrapped_rpc(): @@ -1496,9 +1513,14 @@ async def test_get_lfp_store_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_lfp_store_async( - transport: str = "grpc_asyncio", request_type=lfpstore.GetLfpStoreRequest -): +@pytest.mark.parametrize( + "request_type", + [ + lfpstore.GetLfpStoreRequest(), + {}, + ], +) +async def test_get_lfp_store_async(request_type, transport: str = "grpc_asyncio"): client = LfpStoreServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1506,7 +1528,7 @@ async def test_get_lfp_store_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_lfp_store), "__call__") as call: @@ -1552,11 +1574,6 @@ async def test_get_lfp_store_async( assert response.matching_state_hint == "matching_state_hint_value" -@pytest.mark.asyncio -async def test_get_lfp_store_async_from_dict(): - await test_get_lfp_store_async(request_type=dict) - - def test_get_lfp_store_field_headers(): client = LfpStoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1699,8 +1716,8 @@ async def test_get_lfp_store_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - lfpstore.InsertLfpStoreRequest, - dict, + lfpstore.InsertLfpStoreRequest(), + {}, ], ) def test_insert_lfp_store(request_type, transport: str = "grpc"): @@ -1711,7 +1728,7 @@ def test_insert_lfp_store(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.insert_lfp_store), "__call__") as call: @@ -1778,9 +1795,10 @@ def test_insert_lfp_store_non_empty_request_with_auto_populated_field(): client.insert_lfp_store(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == lfpstore.InsertLfpStoreRequest( + request_msg = lfpstore.InsertLfpStoreRequest( parent="parent_value", ) + assert args[0] == request_msg def test_insert_lfp_store_use_cached_wrapped_rpc(): @@ -1863,9 +1881,14 @@ async def test_insert_lfp_store_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_insert_lfp_store_async( - transport: str = "grpc_asyncio", request_type=lfpstore.InsertLfpStoreRequest -): +@pytest.mark.parametrize( + "request_type", + [ + lfpstore.InsertLfpStoreRequest(), + {}, + ], +) +async def test_insert_lfp_store_async(request_type, transport: str = "grpc_asyncio"): client = LfpStoreServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1873,7 +1896,7 @@ async def test_insert_lfp_store_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.insert_lfp_store), "__call__") as call: @@ -1919,11 +1942,6 @@ async def test_insert_lfp_store_async( assert response.matching_state_hint == "matching_state_hint_value" -@pytest.mark.asyncio -async def test_insert_lfp_store_async_from_dict(): - await test_insert_lfp_store_async(request_type=dict) - - def test_insert_lfp_store_field_headers(): client = LfpStoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2076,8 +2094,8 @@ async def test_insert_lfp_store_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - lfpstore.DeleteLfpStoreRequest, - dict, + lfpstore.DeleteLfpStoreRequest(), + {}, ], ) def test_delete_lfp_store(request_type, transport: str = "grpc"): @@ -2088,7 +2106,7 @@ def test_delete_lfp_store(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_lfp_store), "__call__") as call: @@ -2129,9 +2147,10 @@ def test_delete_lfp_store_non_empty_request_with_auto_populated_field(): client.delete_lfp_store(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == lfpstore.DeleteLfpStoreRequest( + request_msg = lfpstore.DeleteLfpStoreRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_lfp_store_use_cached_wrapped_rpc(): @@ -2214,9 +2233,14 @@ async def test_delete_lfp_store_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_delete_lfp_store_async( - transport: str = "grpc_asyncio", request_type=lfpstore.DeleteLfpStoreRequest -): +@pytest.mark.parametrize( + "request_type", + [ + lfpstore.DeleteLfpStoreRequest(), + {}, + ], +) +async def test_delete_lfp_store_async(request_type, transport: str = "grpc_asyncio"): client = LfpStoreServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2224,7 +2248,7 @@ async def test_delete_lfp_store_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_lfp_store), "__call__") as call: @@ -2242,11 +2266,6 @@ async def test_delete_lfp_store_async( assert response is None -@pytest.mark.asyncio -async def test_delete_lfp_store_async_from_dict(): - await test_delete_lfp_store_async(request_type=dict) - - def test_delete_lfp_store_field_headers(): client = LfpStoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2389,8 +2408,8 @@ async def test_delete_lfp_store_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - lfpstore.ListLfpStoresRequest, - dict, + lfpstore.ListLfpStoresRequest(), + {}, ], ) def test_list_lfp_stores(request_type, transport: str = "grpc"): @@ -2401,7 +2420,7 @@ def test_list_lfp_stores(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_lfp_stores), "__call__") as call: @@ -2446,10 +2465,11 @@ def test_list_lfp_stores_non_empty_request_with_auto_populated_field(): client.list_lfp_stores(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == lfpstore.ListLfpStoresRequest( + request_msg = lfpstore.ListLfpStoresRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_lfp_stores_use_cached_wrapped_rpc(): @@ -2530,9 +2550,14 @@ async def test_list_lfp_stores_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_lfp_stores_async( - transport: str = "grpc_asyncio", request_type=lfpstore.ListLfpStoresRequest -): +@pytest.mark.parametrize( + "request_type", + [ + lfpstore.ListLfpStoresRequest(), + {}, + ], +) +async def test_list_lfp_stores_async(request_type, transport: str = "grpc_asyncio"): client = LfpStoreServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2540,7 +2565,7 @@ async def test_list_lfp_stores_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_lfp_stores), "__call__") as call: @@ -2563,11 +2588,6 @@ async def test_list_lfp_stores_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_lfp_stores_async_from_dict(): - await test_list_lfp_stores_async(request_type=dict) - - def test_list_lfp_stores_field_headers(): client = LfpStoreServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3837,7 +3857,6 @@ def test_get_lfp_store_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lfpstore.GetLfpStoreRequest() - assert args[0] == request_msg @@ -3858,7 +3877,6 @@ def test_insert_lfp_store_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lfpstore.InsertLfpStoreRequest() - assert args[0] == request_msg @@ -3879,7 +3897,6 @@ def test_delete_lfp_store_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lfpstore.DeleteLfpStoreRequest() - assert args[0] == request_msg @@ -3900,7 +3917,6 @@ def test_list_lfp_stores_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lfpstore.ListLfpStoresRequest() - assert args[0] == request_msg @@ -3951,7 +3967,6 @@ async def test_get_lfp_store_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lfpstore.GetLfpStoreRequest() - assert args[0] == request_msg @@ -3988,7 +4003,6 @@ async def test_insert_lfp_store_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lfpstore.InsertLfpStoreRequest() - assert args[0] == request_msg @@ -4011,7 +4025,6 @@ async def test_delete_lfp_store_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lfpstore.DeleteLfpStoreRequest() - assert args[0] == request_msg @@ -4038,7 +4051,6 @@ async def test_list_lfp_stores_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lfpstore.ListLfpStoresRequest() - assert args[0] == request_msg @@ -4687,7 +4699,6 @@ def test_get_lfp_store_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lfpstore.GetLfpStoreRequest() - assert args[0] == request_msg @@ -4707,7 +4718,6 @@ def test_insert_lfp_store_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lfpstore.InsertLfpStoreRequest() - assert args[0] == request_msg @@ -4727,7 +4737,6 @@ def test_delete_lfp_store_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lfpstore.DeleteLfpStoreRequest() - assert args[0] == request_msg @@ -4747,7 +4756,6 @@ def test_list_lfp_stores_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = lfpstore.ListLfpStoresRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-notifications/noxfile.py b/packages/google-shopping-merchant-notifications/noxfile.py index 9b1757299a50..469d1b1ee453 100644 --- a/packages/google-shopping-merchant-notifications/noxfile.py +++ b/packages/google-shopping-merchant-notifications/noxfile.py @@ -47,7 +47,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-shopping-merchant-notifications" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-shopping-merchant-notifications/setup.py b/packages/google-shopping-merchant-notifications/setup.py index 9a8ccc9b3b31..77399923b484 100644 --- a/packages/google-shopping-merchant-notifications/setup.py +++ b/packages/google-shopping-merchant-notifications/setup.py @@ -48,7 +48,7 @@ # See https://github.com/googleapis/google-cloud-python/issues/12364 "google-auth >= 2.14.1, <3.0.0,!=2.24.0,!=2.25.0", "google-shopping-type >= 1.0.0, <2.0.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-shopping-merchant-notifications/testing/constraints-3.10.txt b/packages/google-shopping-merchant-notifications/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-shopping-merchant-notifications/testing/constraints-3.10.txt +++ b/packages/google-shopping-merchant-notifications/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-shopping-merchant-notifications/tests/unit/gapic/merchant_notifications_v1/test_notifications_api_service.py b/packages/google-shopping-merchant-notifications/tests/unit/gapic/merchant_notifications_v1/test_notifications_api_service.py index 8c783638439b..e6ff066885ce 100644 --- a/packages/google-shopping-merchant-notifications/tests/unit/gapic/merchant_notifications_v1/test_notifications_api_service.py +++ b/packages/google-shopping-merchant-notifications/tests/unit/gapic/merchant_notifications_v1/test_notifications_api_service.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 @@ -108,6 +109,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" @@ -1377,8 +1393,8 @@ def test_notifications_api_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - notificationsapi.GetNotificationSubscriptionRequest, - dict, + notificationsapi.GetNotificationSubscriptionRequest(), + {}, ], ) def test_get_notification_subscription(request_type, transport: str = "grpc"): @@ -1389,7 +1405,7 @@ def test_get_notification_subscription(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1445,9 +1461,10 @@ def test_get_notification_subscription_non_empty_request_with_auto_populated_fie client.get_notification_subscription(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == notificationsapi.GetNotificationSubscriptionRequest( + request_msg = notificationsapi.GetNotificationSubscriptionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_notification_subscription_use_cached_wrapped_rpc(): @@ -1533,9 +1550,15 @@ async def test_get_notification_subscription_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + notificationsapi.GetNotificationSubscriptionRequest(), + {}, + ], +) async def test_get_notification_subscription_async( - transport: str = "grpc_asyncio", - request_type=notificationsapi.GetNotificationSubscriptionRequest, + request_type, transport: str = "grpc_asyncio" ): client = NotificationsApiServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1544,7 +1567,7 @@ async def test_get_notification_subscription_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( @@ -1576,11 +1599,6 @@ async def test_get_notification_subscription_async( assert response.call_back_uri == "call_back_uri_value" -@pytest.mark.asyncio -async def test_get_notification_subscription_async_from_dict(): - await test_get_notification_subscription_async(request_type=dict) - - def test_get_notification_subscription_field_headers(): client = NotificationsApiServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1735,8 +1753,8 @@ async def test_get_notification_subscription_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - notificationsapi.CreateNotificationSubscriptionRequest, - dict, + notificationsapi.CreateNotificationSubscriptionRequest(), + {}, ], ) def test_create_notification_subscription(request_type, transport: str = "grpc"): @@ -1747,7 +1765,7 @@ def test_create_notification_subscription(request_type, transport: str = "grpc") # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1803,9 +1821,10 @@ def test_create_notification_subscription_non_empty_request_with_auto_populated_ client.create_notification_subscription(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == notificationsapi.CreateNotificationSubscriptionRequest( + request_msg = notificationsapi.CreateNotificationSubscriptionRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_notification_subscription_use_cached_wrapped_rpc(): @@ -1891,9 +1910,15 @@ async def test_create_notification_subscription_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + notificationsapi.CreateNotificationSubscriptionRequest(), + {}, + ], +) async def test_create_notification_subscription_async( - transport: str = "grpc_asyncio", - request_type=notificationsapi.CreateNotificationSubscriptionRequest, + request_type, transport: str = "grpc_asyncio" ): client = NotificationsApiServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1902,7 +1927,7 @@ async def test_create_notification_subscription_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( @@ -1934,11 +1959,6 @@ async def test_create_notification_subscription_async( assert response.call_back_uri == "call_back_uri_value" -@pytest.mark.asyncio -async def test_create_notification_subscription_async_from_dict(): - await test_create_notification_subscription_async(request_type=dict) - - def test_create_notification_subscription_field_headers(): client = NotificationsApiServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2111,8 +2131,8 @@ async def test_create_notification_subscription_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - notificationsapi.UpdateNotificationSubscriptionRequest, - dict, + notificationsapi.UpdateNotificationSubscriptionRequest(), + {}, ], ) def test_update_notification_subscription(request_type, transport: str = "grpc"): @@ -2123,7 +2143,7 @@ def test_update_notification_subscription(request_type, transport: str = "grpc") # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2177,7 +2197,8 @@ def test_update_notification_subscription_non_empty_request_with_auto_populated_ client.update_notification_subscription(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == notificationsapi.UpdateNotificationSubscriptionRequest() + request_msg = notificationsapi.UpdateNotificationSubscriptionRequest() + assert args[0] == request_msg def test_update_notification_subscription_use_cached_wrapped_rpc(): @@ -2263,9 +2284,15 @@ async def test_update_notification_subscription_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + notificationsapi.UpdateNotificationSubscriptionRequest(), + {}, + ], +) async def test_update_notification_subscription_async( - transport: str = "grpc_asyncio", - request_type=notificationsapi.UpdateNotificationSubscriptionRequest, + request_type, transport: str = "grpc_asyncio" ): client = NotificationsApiServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2274,7 +2301,7 @@ async def test_update_notification_subscription_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( @@ -2306,11 +2333,6 @@ async def test_update_notification_subscription_async( assert response.call_back_uri == "call_back_uri_value" -@pytest.mark.asyncio -async def test_update_notification_subscription_async_from_dict(): - await test_update_notification_subscription_async(request_type=dict) - - def test_update_notification_subscription_field_headers(): client = NotificationsApiServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2483,8 +2505,8 @@ async def test_update_notification_subscription_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - notificationsapi.DeleteNotificationSubscriptionRequest, - dict, + notificationsapi.DeleteNotificationSubscriptionRequest(), + {}, ], ) def test_delete_notification_subscription(request_type, transport: str = "grpc"): @@ -2495,7 +2517,7 @@ def test_delete_notification_subscription(request_type, transport: str = "grpc") # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2540,9 +2562,10 @@ def test_delete_notification_subscription_non_empty_request_with_auto_populated_ client.delete_notification_subscription(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == notificationsapi.DeleteNotificationSubscriptionRequest( + request_msg = notificationsapi.DeleteNotificationSubscriptionRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_notification_subscription_use_cached_wrapped_rpc(): @@ -2628,9 +2651,15 @@ async def test_delete_notification_subscription_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + notificationsapi.DeleteNotificationSubscriptionRequest(), + {}, + ], +) async def test_delete_notification_subscription_async( - transport: str = "grpc_asyncio", - request_type=notificationsapi.DeleteNotificationSubscriptionRequest, + request_type, transport: str = "grpc_asyncio" ): client = NotificationsApiServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2639,7 +2668,7 @@ async def test_delete_notification_subscription_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( @@ -2659,11 +2688,6 @@ async def test_delete_notification_subscription_async( assert response is None -@pytest.mark.asyncio -async def test_delete_notification_subscription_async_from_dict(): - await test_delete_notification_subscription_async(request_type=dict) - - def test_delete_notification_subscription_field_headers(): client = NotificationsApiServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2814,8 +2838,8 @@ async def test_delete_notification_subscription_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - notificationsapi.ListNotificationSubscriptionsRequest, - dict, + notificationsapi.ListNotificationSubscriptionsRequest(), + {}, ], ) def test_list_notification_subscriptions(request_type, transport: str = "grpc"): @@ -2826,7 +2850,7 @@ def test_list_notification_subscriptions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2875,10 +2899,11 @@ def test_list_notification_subscriptions_non_empty_request_with_auto_populated_f client.list_notification_subscriptions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == notificationsapi.ListNotificationSubscriptionsRequest( + request_msg = notificationsapi.ListNotificationSubscriptionsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_notification_subscriptions_use_cached_wrapped_rpc(): @@ -2964,9 +2989,15 @@ async def test_list_notification_subscriptions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + notificationsapi.ListNotificationSubscriptionsRequest(), + {}, + ], +) async def test_list_notification_subscriptions_async( - transport: str = "grpc_asyncio", - request_type=notificationsapi.ListNotificationSubscriptionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = NotificationsApiServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2975,7 +3006,7 @@ async def test_list_notification_subscriptions_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( @@ -3000,11 +3031,6 @@ async def test_list_notification_subscriptions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_notification_subscriptions_async_from_dict(): - await test_list_notification_subscriptions_async(request_type=dict) - - def test_list_notification_subscriptions_field_headers(): client = NotificationsApiServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3365,8 +3391,8 @@ async def test_list_notification_subscriptions_async_pages(): @pytest.mark.parametrize( "request_type", [ - notificationsapi.GetNotificationSubscriptionHealthMetricsRequest, - dict, + notificationsapi.GetNotificationSubscriptionHealthMetricsRequest(), + {}, ], ) def test_get_notification_subscription_health_metrics( @@ -3379,7 +3405,7 @@ def test_get_notification_subscription_health_metrics( # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3433,11 +3459,10 @@ def test_get_notification_subscription_health_metrics_non_empty_request_with_aut client.get_notification_subscription_health_metrics(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[ - 0 - ] == notificationsapi.GetNotificationSubscriptionHealthMetricsRequest( + request_msg = notificationsapi.GetNotificationSubscriptionHealthMetricsRequest( name="name_value", ) + assert args[0] == request_msg def test_get_notification_subscription_health_metrics_use_cached_wrapped_rpc(): @@ -3523,9 +3548,15 @@ async def test_get_notification_subscription_health_metrics_async_use_cached_wra @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + notificationsapi.GetNotificationSubscriptionHealthMetricsRequest(), + {}, + ], +) async def test_get_notification_subscription_health_metrics_async( - transport: str = "grpc_asyncio", - request_type=notificationsapi.GetNotificationSubscriptionHealthMetricsRequest, + request_type, transport: str = "grpc_asyncio" ): client = NotificationsApiServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -3534,7 +3565,7 @@ async def test_get_notification_subscription_health_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( @@ -3565,11 +3596,6 @@ async def test_get_notification_subscription_health_metrics_async( assert response.oldest_unacknowledged_message_waiting_time == 4441 -@pytest.mark.asyncio -async def test_get_notification_subscription_health_metrics_async_from_dict(): - await test_get_notification_subscription_health_metrics_async(request_type=dict) - - def test_get_notification_subscription_health_metrics_field_headers(): client = NotificationsApiServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5073,7 +5099,6 @@ def test_get_notification_subscription_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = notificationsapi.GetNotificationSubscriptionRequest() - assert args[0] == request_msg @@ -5096,7 +5121,6 @@ def test_create_notification_subscription_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = notificationsapi.CreateNotificationSubscriptionRequest() - assert args[0] == request_msg @@ -5119,7 +5143,6 @@ def test_update_notification_subscription_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = notificationsapi.UpdateNotificationSubscriptionRequest() - assert args[0] == request_msg @@ -5142,7 +5165,6 @@ def test_delete_notification_subscription_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = notificationsapi.DeleteNotificationSubscriptionRequest() - assert args[0] == request_msg @@ -5165,7 +5187,6 @@ def test_list_notification_subscriptions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = notificationsapi.ListNotificationSubscriptionsRequest() - assert args[0] == request_msg @@ -5188,7 +5209,6 @@ def test_get_notification_subscription_health_metrics_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = notificationsapi.GetNotificationSubscriptionHealthMetricsRequest() - assert args[0] == request_msg @@ -5233,7 +5253,6 @@ async def test_get_notification_subscription_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = notificationsapi.GetNotificationSubscriptionRequest() - assert args[0] == request_msg @@ -5264,7 +5283,6 @@ async def test_create_notification_subscription_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = notificationsapi.CreateNotificationSubscriptionRequest() - assert args[0] == request_msg @@ -5295,7 +5313,6 @@ async def test_update_notification_subscription_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = notificationsapi.UpdateNotificationSubscriptionRequest() - assert args[0] == request_msg @@ -5320,7 +5337,6 @@ async def test_delete_notification_subscription_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = notificationsapi.DeleteNotificationSubscriptionRequest() - assert args[0] == request_msg @@ -5349,7 +5365,6 @@ async def test_list_notification_subscriptions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = notificationsapi.ListNotificationSubscriptionsRequest() - assert args[0] == request_msg @@ -5381,7 +5396,6 @@ async def test_get_notification_subscription_health_metrics_empty_call_grpc_asyn call.assert_called() _, args, _ = call.mock_calls[0] request_msg = notificationsapi.GetNotificationSubscriptionHealthMetricsRequest() - assert args[0] == request_msg @@ -6424,7 +6438,6 @@ def test_get_notification_subscription_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = notificationsapi.GetNotificationSubscriptionRequest() - assert args[0] == request_msg @@ -6446,7 +6459,6 @@ def test_create_notification_subscription_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = notificationsapi.CreateNotificationSubscriptionRequest() - assert args[0] == request_msg @@ -6468,7 +6480,6 @@ def test_update_notification_subscription_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = notificationsapi.UpdateNotificationSubscriptionRequest() - assert args[0] == request_msg @@ -6490,7 +6501,6 @@ def test_delete_notification_subscription_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = notificationsapi.DeleteNotificationSubscriptionRequest() - assert args[0] == request_msg @@ -6512,7 +6522,6 @@ def test_list_notification_subscriptions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = notificationsapi.ListNotificationSubscriptionsRequest() - assert args[0] == request_msg @@ -6534,7 +6543,6 @@ def test_get_notification_subscription_health_metrics_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = notificationsapi.GetNotificationSubscriptionHealthMetricsRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-notifications/tests/unit/gapic/merchant_notifications_v1beta/test_notifications_api_service.py b/packages/google-shopping-merchant-notifications/tests/unit/gapic/merchant_notifications_v1beta/test_notifications_api_service.py index a0244ec7a555..5c75fdad47b1 100644 --- a/packages/google-shopping-merchant-notifications/tests/unit/gapic/merchant_notifications_v1beta/test_notifications_api_service.py +++ b/packages/google-shopping-merchant-notifications/tests/unit/gapic/merchant_notifications_v1beta/test_notifications_api_service.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 @@ -108,6 +109,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" @@ -1377,8 +1393,8 @@ def test_notifications_api_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - notificationsapi.GetNotificationSubscriptionRequest, - dict, + notificationsapi.GetNotificationSubscriptionRequest(), + {}, ], ) def test_get_notification_subscription(request_type, transport: str = "grpc"): @@ -1389,7 +1405,7 @@ def test_get_notification_subscription(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1445,9 +1461,10 @@ def test_get_notification_subscription_non_empty_request_with_auto_populated_fie client.get_notification_subscription(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == notificationsapi.GetNotificationSubscriptionRequest( + request_msg = notificationsapi.GetNotificationSubscriptionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_notification_subscription_use_cached_wrapped_rpc(): @@ -1533,9 +1550,15 @@ async def test_get_notification_subscription_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + notificationsapi.GetNotificationSubscriptionRequest(), + {}, + ], +) async def test_get_notification_subscription_async( - transport: str = "grpc_asyncio", - request_type=notificationsapi.GetNotificationSubscriptionRequest, + request_type, transport: str = "grpc_asyncio" ): client = NotificationsApiServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1544,7 +1567,7 @@ async def test_get_notification_subscription_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( @@ -1576,11 +1599,6 @@ async def test_get_notification_subscription_async( assert response.call_back_uri == "call_back_uri_value" -@pytest.mark.asyncio -async def test_get_notification_subscription_async_from_dict(): - await test_get_notification_subscription_async(request_type=dict) - - def test_get_notification_subscription_field_headers(): client = NotificationsApiServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1735,8 +1753,8 @@ async def test_get_notification_subscription_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - notificationsapi.CreateNotificationSubscriptionRequest, - dict, + notificationsapi.CreateNotificationSubscriptionRequest(), + {}, ], ) def test_create_notification_subscription(request_type, transport: str = "grpc"): @@ -1747,7 +1765,7 @@ def test_create_notification_subscription(request_type, transport: str = "grpc") # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1803,9 +1821,10 @@ def test_create_notification_subscription_non_empty_request_with_auto_populated_ client.create_notification_subscription(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == notificationsapi.CreateNotificationSubscriptionRequest( + request_msg = notificationsapi.CreateNotificationSubscriptionRequest( parent="parent_value", ) + assert args[0] == request_msg def test_create_notification_subscription_use_cached_wrapped_rpc(): @@ -1891,9 +1910,15 @@ async def test_create_notification_subscription_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + notificationsapi.CreateNotificationSubscriptionRequest(), + {}, + ], +) async def test_create_notification_subscription_async( - transport: str = "grpc_asyncio", - request_type=notificationsapi.CreateNotificationSubscriptionRequest, + request_type, transport: str = "grpc_asyncio" ): client = NotificationsApiServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1902,7 +1927,7 @@ async def test_create_notification_subscription_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( @@ -1934,11 +1959,6 @@ async def test_create_notification_subscription_async( assert response.call_back_uri == "call_back_uri_value" -@pytest.mark.asyncio -async def test_create_notification_subscription_async_from_dict(): - await test_create_notification_subscription_async(request_type=dict) - - def test_create_notification_subscription_field_headers(): client = NotificationsApiServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2111,8 +2131,8 @@ async def test_create_notification_subscription_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - notificationsapi.UpdateNotificationSubscriptionRequest, - dict, + notificationsapi.UpdateNotificationSubscriptionRequest(), + {}, ], ) def test_update_notification_subscription(request_type, transport: str = "grpc"): @@ -2123,7 +2143,7 @@ def test_update_notification_subscription(request_type, transport: str = "grpc") # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2177,7 +2197,8 @@ def test_update_notification_subscription_non_empty_request_with_auto_populated_ client.update_notification_subscription(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == notificationsapi.UpdateNotificationSubscriptionRequest() + request_msg = notificationsapi.UpdateNotificationSubscriptionRequest() + assert args[0] == request_msg def test_update_notification_subscription_use_cached_wrapped_rpc(): @@ -2263,9 +2284,15 @@ async def test_update_notification_subscription_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + notificationsapi.UpdateNotificationSubscriptionRequest(), + {}, + ], +) async def test_update_notification_subscription_async( - transport: str = "grpc_asyncio", - request_type=notificationsapi.UpdateNotificationSubscriptionRequest, + request_type, transport: str = "grpc_asyncio" ): client = NotificationsApiServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2274,7 +2301,7 @@ async def test_update_notification_subscription_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( @@ -2306,11 +2333,6 @@ async def test_update_notification_subscription_async( assert response.call_back_uri == "call_back_uri_value" -@pytest.mark.asyncio -async def test_update_notification_subscription_async_from_dict(): - await test_update_notification_subscription_async(request_type=dict) - - def test_update_notification_subscription_field_headers(): client = NotificationsApiServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2483,8 +2505,8 @@ async def test_update_notification_subscription_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - notificationsapi.DeleteNotificationSubscriptionRequest, - dict, + notificationsapi.DeleteNotificationSubscriptionRequest(), + {}, ], ) def test_delete_notification_subscription(request_type, transport: str = "grpc"): @@ -2495,7 +2517,7 @@ def test_delete_notification_subscription(request_type, transport: str = "grpc") # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2540,9 +2562,10 @@ def test_delete_notification_subscription_non_empty_request_with_auto_populated_ client.delete_notification_subscription(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == notificationsapi.DeleteNotificationSubscriptionRequest( + request_msg = notificationsapi.DeleteNotificationSubscriptionRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_notification_subscription_use_cached_wrapped_rpc(): @@ -2628,9 +2651,15 @@ async def test_delete_notification_subscription_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + notificationsapi.DeleteNotificationSubscriptionRequest(), + {}, + ], +) async def test_delete_notification_subscription_async( - transport: str = "grpc_asyncio", - request_type=notificationsapi.DeleteNotificationSubscriptionRequest, + request_type, transport: str = "grpc_asyncio" ): client = NotificationsApiServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2639,7 +2668,7 @@ async def test_delete_notification_subscription_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( @@ -2659,11 +2688,6 @@ async def test_delete_notification_subscription_async( assert response is None -@pytest.mark.asyncio -async def test_delete_notification_subscription_async_from_dict(): - await test_delete_notification_subscription_async(request_type=dict) - - def test_delete_notification_subscription_field_headers(): client = NotificationsApiServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2814,8 +2838,8 @@ async def test_delete_notification_subscription_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - notificationsapi.ListNotificationSubscriptionsRequest, - dict, + notificationsapi.ListNotificationSubscriptionsRequest(), + {}, ], ) def test_list_notification_subscriptions(request_type, transport: str = "grpc"): @@ -2826,7 +2850,7 @@ def test_list_notification_subscriptions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2875,10 +2899,11 @@ def test_list_notification_subscriptions_non_empty_request_with_auto_populated_f client.list_notification_subscriptions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == notificationsapi.ListNotificationSubscriptionsRequest( + request_msg = notificationsapi.ListNotificationSubscriptionsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_notification_subscriptions_use_cached_wrapped_rpc(): @@ -2964,9 +2989,15 @@ async def test_list_notification_subscriptions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + notificationsapi.ListNotificationSubscriptionsRequest(), + {}, + ], +) async def test_list_notification_subscriptions_async( - transport: str = "grpc_asyncio", - request_type=notificationsapi.ListNotificationSubscriptionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = NotificationsApiServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2975,7 +3006,7 @@ async def test_list_notification_subscriptions_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( @@ -3000,11 +3031,6 @@ async def test_list_notification_subscriptions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_notification_subscriptions_async_from_dict(): - await test_list_notification_subscriptions_async(request_type=dict) - - def test_list_notification_subscriptions_field_headers(): client = NotificationsApiServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4519,7 +4545,6 @@ def test_get_notification_subscription_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = notificationsapi.GetNotificationSubscriptionRequest() - assert args[0] == request_msg @@ -4542,7 +4567,6 @@ def test_create_notification_subscription_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = notificationsapi.CreateNotificationSubscriptionRequest() - assert args[0] == request_msg @@ -4565,7 +4589,6 @@ def test_update_notification_subscription_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = notificationsapi.UpdateNotificationSubscriptionRequest() - assert args[0] == request_msg @@ -4588,7 +4611,6 @@ def test_delete_notification_subscription_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = notificationsapi.DeleteNotificationSubscriptionRequest() - assert args[0] == request_msg @@ -4611,7 +4633,6 @@ def test_list_notification_subscriptions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = notificationsapi.ListNotificationSubscriptionsRequest() - assert args[0] == request_msg @@ -4656,7 +4677,6 @@ async def test_get_notification_subscription_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = notificationsapi.GetNotificationSubscriptionRequest() - assert args[0] == request_msg @@ -4687,7 +4707,6 @@ async def test_create_notification_subscription_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = notificationsapi.CreateNotificationSubscriptionRequest() - assert args[0] == request_msg @@ -4718,7 +4737,6 @@ async def test_update_notification_subscription_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = notificationsapi.UpdateNotificationSubscriptionRequest() - assert args[0] == request_msg @@ -4743,7 +4761,6 @@ async def test_delete_notification_subscription_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = notificationsapi.DeleteNotificationSubscriptionRequest() - assert args[0] == request_msg @@ -4772,7 +4789,6 @@ async def test_list_notification_subscriptions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = notificationsapi.ListNotificationSubscriptionsRequest() - assert args[0] == request_msg @@ -5665,7 +5681,6 @@ def test_get_notification_subscription_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = notificationsapi.GetNotificationSubscriptionRequest() - assert args[0] == request_msg @@ -5687,7 +5702,6 @@ def test_create_notification_subscription_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = notificationsapi.CreateNotificationSubscriptionRequest() - assert args[0] == request_msg @@ -5709,7 +5723,6 @@ def test_update_notification_subscription_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = notificationsapi.UpdateNotificationSubscriptionRequest() - assert args[0] == request_msg @@ -5731,7 +5744,6 @@ def test_delete_notification_subscription_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = notificationsapi.DeleteNotificationSubscriptionRequest() - assert args[0] == request_msg @@ -5753,7 +5765,6 @@ def test_list_notification_subscriptions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = notificationsapi.ListNotificationSubscriptionsRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-ordertracking/noxfile.py b/packages/google-shopping-merchant-ordertracking/noxfile.py index eae890eefd21..8d7bfd0b33cb 100644 --- a/packages/google-shopping-merchant-ordertracking/noxfile.py +++ b/packages/google-shopping-merchant-ordertracking/noxfile.py @@ -47,7 +47,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-shopping-merchant-ordertracking" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-shopping-merchant-ordertracking/setup.py b/packages/google-shopping-merchant-ordertracking/setup.py index 880278289b2c..2ea862f833bf 100644 --- a/packages/google-shopping-merchant-ordertracking/setup.py +++ b/packages/google-shopping-merchant-ordertracking/setup.py @@ -47,7 +47,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/google-shopping-merchant-ordertracking/testing/constraints-3.10.txt b/packages/google-shopping-merchant-ordertracking/testing/constraints-3.10.txt index 28927d49b296..b408428a99a2 100644 --- a/packages/google-shopping-merchant-ordertracking/testing/constraints-3.10.txt +++ b/packages/google-shopping-merchant-ordertracking/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-shopping-type==1.0.0 diff --git a/packages/google-shopping-merchant-ordertracking/tests/unit/gapic/merchant_ordertracking_v1/test_order_tracking_signals_service.py b/packages/google-shopping-merchant-ordertracking/tests/unit/gapic/merchant_ordertracking_v1/test_order_tracking_signals_service.py index 9d2990bd45a7..4ea06fe636c1 100644 --- a/packages/google-shopping-merchant-ordertracking/tests/unit/gapic/merchant_ordertracking_v1/test_order_tracking_signals_service.py +++ b/packages/google-shopping-merchant-ordertracking/tests/unit/gapic/merchant_ordertracking_v1/test_order_tracking_signals_service.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 @@ -109,6 +110,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" @@ -1415,8 +1431,8 @@ def test_order_tracking_signals_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - order_tracking_signals.CreateOrderTrackingSignalRequest, - dict, + order_tracking_signals.CreateOrderTrackingSignalRequest(), + {}, ], ) def test_create_order_tracking_signal(request_type, transport: str = "grpc"): @@ -1427,7 +1443,7 @@ def test_create_order_tracking_signal(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1484,10 +1500,11 @@ def test_create_order_tracking_signal_non_empty_request_with_auto_populated_fiel client.create_order_tracking_signal(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == order_tracking_signals.CreateOrderTrackingSignalRequest( + request_msg = order_tracking_signals.CreateOrderTrackingSignalRequest( parent="parent_value", order_tracking_signal_id="order_tracking_signal_id_value", ) + assert args[0] == request_msg def test_create_order_tracking_signal_use_cached_wrapped_rpc(): @@ -1573,9 +1590,15 @@ async def test_create_order_tracking_signal_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + order_tracking_signals.CreateOrderTrackingSignalRequest(), + {}, + ], +) async def test_create_order_tracking_signal_async( - transport: str = "grpc_asyncio", - request_type=order_tracking_signals.CreateOrderTrackingSignalRequest, + request_type, transport: str = "grpc_asyncio" ): client = OrderTrackingSignalsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1584,7 +1607,7 @@ async def test_create_order_tracking_signal_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( @@ -1617,11 +1640,6 @@ async def test_create_order_tracking_signal_async( assert response.delivery_region_code == "delivery_region_code_value" -@pytest.mark.asyncio -async def test_create_order_tracking_signal_async_from_dict(): - await test_create_order_tracking_signal_async(request_type=dict) - - def test_create_order_tracking_signal_field_headers(): client = OrderTrackingSignalsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2104,7 +2122,6 @@ def test_create_order_tracking_signal_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = order_tracking_signals.CreateOrderTrackingSignalRequest() - assert args[0] == request_msg @@ -2151,7 +2168,6 @@ async def test_create_order_tracking_signal_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = order_tracking_signals.CreateOrderTrackingSignalRequest() - assert args[0] == request_msg @@ -2459,7 +2475,6 @@ def test_create_order_tracking_signal_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = order_tracking_signals.CreateOrderTrackingSignalRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-ordertracking/tests/unit/gapic/merchant_ordertracking_v1beta/test_order_tracking_signals_service.py b/packages/google-shopping-merchant-ordertracking/tests/unit/gapic/merchant_ordertracking_v1beta/test_order_tracking_signals_service.py index eabc2804cd56..ebad03b28e2b 100644 --- a/packages/google-shopping-merchant-ordertracking/tests/unit/gapic/merchant_ordertracking_v1beta/test_order_tracking_signals_service.py +++ b/packages/google-shopping-merchant-ordertracking/tests/unit/gapic/merchant_ordertracking_v1beta/test_order_tracking_signals_service.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 @@ -109,6 +110,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" @@ -1415,8 +1431,8 @@ def test_order_tracking_signals_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - order_tracking_signals.CreateOrderTrackingSignalRequest, - dict, + order_tracking_signals.CreateOrderTrackingSignalRequest(), + {}, ], ) def test_create_order_tracking_signal(request_type, transport: str = "grpc"): @@ -1427,7 +1443,7 @@ def test_create_order_tracking_signal(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1484,10 +1500,11 @@ def test_create_order_tracking_signal_non_empty_request_with_auto_populated_fiel client.create_order_tracking_signal(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == order_tracking_signals.CreateOrderTrackingSignalRequest( + request_msg = order_tracking_signals.CreateOrderTrackingSignalRequest( parent="parent_value", order_tracking_signal_id="order_tracking_signal_id_value", ) + assert args[0] == request_msg def test_create_order_tracking_signal_use_cached_wrapped_rpc(): @@ -1573,9 +1590,15 @@ async def test_create_order_tracking_signal_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + order_tracking_signals.CreateOrderTrackingSignalRequest(), + {}, + ], +) async def test_create_order_tracking_signal_async( - transport: str = "grpc_asyncio", - request_type=order_tracking_signals.CreateOrderTrackingSignalRequest, + request_type, transport: str = "grpc_asyncio" ): client = OrderTrackingSignalsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1584,7 +1607,7 @@ async def test_create_order_tracking_signal_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( @@ -1617,11 +1640,6 @@ async def test_create_order_tracking_signal_async( assert response.delivery_region_code == "delivery_region_code_value" -@pytest.mark.asyncio -async def test_create_order_tracking_signal_async_from_dict(): - await test_create_order_tracking_signal_async(request_type=dict) - - def test_create_order_tracking_signal_field_headers(): client = OrderTrackingSignalsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2104,7 +2122,6 @@ def test_create_order_tracking_signal_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = order_tracking_signals.CreateOrderTrackingSignalRequest() - assert args[0] == request_msg @@ -2151,7 +2168,6 @@ async def test_create_order_tracking_signal_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = order_tracking_signals.CreateOrderTrackingSignalRequest() - assert args[0] == request_msg @@ -2459,7 +2475,6 @@ def test_create_order_tracking_signal_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = order_tracking_signals.CreateOrderTrackingSignalRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-products/noxfile.py b/packages/google-shopping-merchant-products/noxfile.py index 962a2dd38edb..f4f76c8c8be5 100644 --- a/packages/google-shopping-merchant-products/noxfile.py +++ b/packages/google-shopping-merchant-products/noxfile.py @@ -47,7 +47,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-shopping-merchant-products" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-shopping-merchant-products/setup.py b/packages/google-shopping-merchant-products/setup.py index 4524bf19eb4b..03638308dec1 100644 --- a/packages/google-shopping-merchant-products/setup.py +++ b/packages/google-shopping-merchant-products/setup.py @@ -45,7 +45,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/google-shopping-merchant-products/testing/constraints-3.10.txt b/packages/google-shopping-merchant-products/testing/constraints-3.10.txt index 28927d49b296..b408428a99a2 100644 --- a/packages/google-shopping-merchant-products/testing/constraints-3.10.txt +++ b/packages/google-shopping-merchant-products/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-shopping-type==1.0.0 diff --git a/packages/google-shopping-merchant-products/tests/unit/gapic/merchant_products_v1/test_product_inputs_service.py b/packages/google-shopping-merchant-products/tests/unit/gapic/merchant_products_v1/test_product_inputs_service.py index b66bc250dd17..777e90bd1869 100644 --- a/packages/google-shopping-merchant-products/tests/unit/gapic/merchant_products_v1/test_product_inputs_service.py +++ b/packages/google-shopping-merchant-products/tests/unit/gapic/merchant_products_v1/test_product_inputs_service.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 @@ -110,6 +111,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" @@ -1373,8 +1389,8 @@ def test_product_inputs_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - productinputs.InsertProductInputRequest, - dict, + productinputs.InsertProductInputRequest(), + {}, ], ) def test_insert_product_input(request_type, transport: str = "grpc"): @@ -1385,7 +1401,7 @@ def test_insert_product_input(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1450,10 +1466,11 @@ def test_insert_product_input_non_empty_request_with_auto_populated_field(): client.insert_product_input(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == productinputs.InsertProductInputRequest( + request_msg = productinputs.InsertProductInputRequest( parent="parent_value", data_source="data_source_value", ) + assert args[0] == request_msg def test_insert_product_input_use_cached_wrapped_rpc(): @@ -1538,9 +1555,15 @@ async def test_insert_product_input_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + productinputs.InsertProductInputRequest(), + {}, + ], +) async def test_insert_product_input_async( - transport: str = "grpc_asyncio", - request_type=productinputs.InsertProductInputRequest, + request_type, transport: str = "grpc_asyncio" ): client = ProductInputsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1549,7 +1572,7 @@ async def test_insert_product_input_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( @@ -1590,11 +1613,6 @@ async def test_insert_product_input_async( assert response.version_number == 1518 -@pytest.mark.asyncio -async def test_insert_product_input_async_from_dict(): - await test_insert_product_input_async(request_type=dict) - - def test_insert_product_input_field_headers(): client = ProductInputsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1663,8 +1681,8 @@ async def test_insert_product_input_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - productinputs.UpdateProductInputRequest, - dict, + productinputs.UpdateProductInputRequest(), + {}, ], ) def test_update_product_input(request_type, transport: str = "grpc"): @@ -1675,7 +1693,7 @@ def test_update_product_input(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1739,9 +1757,10 @@ def test_update_product_input_non_empty_request_with_auto_populated_field(): client.update_product_input(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == productinputs.UpdateProductInputRequest( + request_msg = productinputs.UpdateProductInputRequest( data_source="data_source_value", ) + assert args[0] == request_msg def test_update_product_input_use_cached_wrapped_rpc(): @@ -1826,9 +1845,15 @@ async def test_update_product_input_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + productinputs.UpdateProductInputRequest(), + {}, + ], +) async def test_update_product_input_async( - transport: str = "grpc_asyncio", - request_type=productinputs.UpdateProductInputRequest, + request_type, transport: str = "grpc_asyncio" ): client = ProductInputsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1837,7 +1862,7 @@ async def test_update_product_input_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( @@ -1878,11 +1903,6 @@ async def test_update_product_input_async( assert response.version_number == 1518 -@pytest.mark.asyncio -async def test_update_product_input_async_from_dict(): - await test_update_product_input_async(request_type=dict) - - def test_update_product_input_field_headers(): client = ProductInputsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2047,8 +2067,8 @@ async def test_update_product_input_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - productinputs.DeleteProductInputRequest, - dict, + productinputs.DeleteProductInputRequest(), + {}, ], ) def test_delete_product_input(request_type, transport: str = "grpc"): @@ -2059,7 +2079,7 @@ def test_delete_product_input(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2105,10 +2125,11 @@ def test_delete_product_input_non_empty_request_with_auto_populated_field(): client.delete_product_input(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == productinputs.DeleteProductInputRequest( + request_msg = productinputs.DeleteProductInputRequest( name="name_value", data_source="data_source_value", ) + assert args[0] == request_msg def test_delete_product_input_use_cached_wrapped_rpc(): @@ -2193,9 +2214,15 @@ async def test_delete_product_input_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + productinputs.DeleteProductInputRequest(), + {}, + ], +) async def test_delete_product_input_async( - transport: str = "grpc_asyncio", - request_type=productinputs.DeleteProductInputRequest, + request_type, transport: str = "grpc_asyncio" ): client = ProductInputsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2204,7 +2231,7 @@ async def test_delete_product_input_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( @@ -2224,11 +2251,6 @@ async def test_delete_product_input_async( assert response is None -@pytest.mark.asyncio -async def test_delete_product_input_async_from_dict(): - await test_delete_product_input_async(request_type=dict) - - def test_delete_product_input_field_headers(): client = ProductInputsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3065,7 +3087,6 @@ def test_insert_product_input_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = productinputs.InsertProductInputRequest() - assert args[0] == request_msg @@ -3088,7 +3109,6 @@ def test_update_product_input_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = productinputs.UpdateProductInputRequest() - assert args[0] == request_msg @@ -3111,7 +3131,6 @@ def test_delete_product_input_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = productinputs.DeleteProductInputRequest() - assert args[0] == request_msg @@ -3162,7 +3181,6 @@ async def test_insert_product_input_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = productinputs.InsertProductInputRequest() - assert args[0] == request_msg @@ -3199,7 +3217,6 @@ async def test_update_product_input_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = productinputs.UpdateProductInputRequest() - assert args[0] == request_msg @@ -3224,7 +3241,6 @@ async def test_delete_product_input_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = productinputs.DeleteProductInputRequest() - assert args[0] == request_msg @@ -4240,7 +4256,6 @@ def test_insert_product_input_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = productinputs.InsertProductInputRequest() - assert args[0] == request_msg @@ -4262,7 +4277,6 @@ def test_update_product_input_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = productinputs.UpdateProductInputRequest() - assert args[0] == request_msg @@ -4284,7 +4298,6 @@ def test_delete_product_input_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = productinputs.DeleteProductInputRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-products/tests/unit/gapic/merchant_products_v1/test_products_service.py b/packages/google-shopping-merchant-products/tests/unit/gapic/merchant_products_v1/test_products_service.py index f4bde5da2292..38ec9899d4a2 100644 --- a/packages/google-shopping-merchant-products/tests/unit/gapic/merchant_products_v1/test_products_service.py +++ b/packages/google-shopping-merchant-products/tests/unit/gapic/merchant_products_v1/test_products_service.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 @@ -108,6 +109,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" @@ -1335,8 +1351,8 @@ def test_products_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - products.GetProductRequest, - dict, + products.GetProductRequest(), + {}, ], ) def test_get_product(request_type, transport: str = "grpc"): @@ -1347,7 +1363,7 @@ def test_get_product(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_product), "__call__") as call: @@ -1405,9 +1421,10 @@ def test_get_product_non_empty_request_with_auto_populated_field(): client.get_product(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == products.GetProductRequest( + request_msg = products.GetProductRequest( name="name_value", ) + assert args[0] == request_msg def test_get_product_use_cached_wrapped_rpc(): @@ -1488,9 +1505,14 @@ async def test_get_product_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_product_async( - transport: str = "grpc_asyncio", request_type=products.GetProductRequest -): +@pytest.mark.parametrize( + "request_type", + [ + products.GetProductRequest(), + {}, + ], +) +async def test_get_product_async(request_type, transport: str = "grpc_asyncio"): client = ProductsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1498,7 +1520,7 @@ async def test_get_product_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_product), "__call__") as call: @@ -1535,11 +1557,6 @@ async def test_get_product_async( assert response.version_number == 1518 -@pytest.mark.asyncio -async def test_get_product_async_from_dict(): - await test_get_product_async(request_type=dict) - - def test_get_product_field_headers(): client = ProductsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1682,8 +1699,8 @@ async def test_get_product_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - products.ListProductsRequest, - dict, + products.ListProductsRequest(), + {}, ], ) def test_list_products(request_type, transport: str = "grpc"): @@ -1694,7 +1711,7 @@ def test_list_products(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_products), "__call__") as call: @@ -1739,10 +1756,11 @@ def test_list_products_non_empty_request_with_auto_populated_field(): client.list_products(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == products.ListProductsRequest( + request_msg = products.ListProductsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_products_use_cached_wrapped_rpc(): @@ -1823,9 +1841,14 @@ async def test_list_products_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_products_async( - transport: str = "grpc_asyncio", request_type=products.ListProductsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + products.ListProductsRequest(), + {}, + ], +) +async def test_list_products_async(request_type, transport: str = "grpc_asyncio"): client = ProductsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1833,7 +1856,7 @@ async def test_list_products_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_products), "__call__") as call: @@ -1856,11 +1879,6 @@ async def test_list_products_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_products_async_from_dict(): - await test_list_products_async(request_type=dict) - - def test_list_products_field_headers(): client = ProductsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2743,7 +2761,6 @@ def test_get_product_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = products.GetProductRequest() - assert args[0] == request_msg @@ -2764,7 +2781,6 @@ def test_list_products_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = products.ListProductsRequest() - assert args[0] == request_msg @@ -2812,7 +2828,6 @@ async def test_get_product_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = products.GetProductRequest() - assert args[0] == request_msg @@ -2839,7 +2854,6 @@ async def test_list_products_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = products.ListProductsRequest() - assert args[0] == request_msg @@ -3142,7 +3156,6 @@ def test_get_product_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = products.GetProductRequest() - assert args[0] == request_msg @@ -3162,7 +3175,6 @@ def test_list_products_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = products.ListProductsRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-products/tests/unit/gapic/merchant_products_v1beta/test_product_inputs_service.py b/packages/google-shopping-merchant-products/tests/unit/gapic/merchant_products_v1beta/test_product_inputs_service.py index a6eddc577f30..85849ec8d2c1 100644 --- a/packages/google-shopping-merchant-products/tests/unit/gapic/merchant_products_v1beta/test_product_inputs_service.py +++ b/packages/google-shopping-merchant-products/tests/unit/gapic/merchant_products_v1beta/test_product_inputs_service.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 @@ -113,6 +114,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" @@ -1376,8 +1392,8 @@ def test_product_inputs_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - productinputs.InsertProductInputRequest, - dict, + productinputs.InsertProductInputRequest(), + {}, ], ) def test_insert_product_input(request_type, transport: str = "grpc"): @@ -1388,7 +1404,7 @@ def test_insert_product_input(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1449,10 +1465,11 @@ def test_insert_product_input_non_empty_request_with_auto_populated_field(): client.insert_product_input(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == productinputs.InsertProductInputRequest( + request_msg = productinputs.InsertProductInputRequest( parent="parent_value", data_source="data_source_value", ) + assert args[0] == request_msg def test_insert_product_input_use_cached_wrapped_rpc(): @@ -1537,9 +1554,15 @@ async def test_insert_product_input_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + productinputs.InsertProductInputRequest(), + {}, + ], +) async def test_insert_product_input_async( - transport: str = "grpc_asyncio", - request_type=productinputs.InsertProductInputRequest, + request_type, transport: str = "grpc_asyncio" ): client = ProductInputsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1548,7 +1571,7 @@ async def test_insert_product_input_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( @@ -1585,11 +1608,6 @@ async def test_insert_product_input_async( assert response.version_number == 1518 -@pytest.mark.asyncio -async def test_insert_product_input_async_from_dict(): - await test_insert_product_input_async(request_type=dict) - - def test_insert_product_input_field_headers(): client = ProductInputsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1658,8 +1676,8 @@ async def test_insert_product_input_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - productinputs.UpdateProductInputRequest, - dict, + productinputs.UpdateProductInputRequest(), + {}, ], ) def test_update_product_input(request_type, transport: str = "grpc"): @@ -1670,7 +1688,7 @@ def test_update_product_input(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1730,9 +1748,10 @@ def test_update_product_input_non_empty_request_with_auto_populated_field(): client.update_product_input(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == productinputs.UpdateProductInputRequest( + request_msg = productinputs.UpdateProductInputRequest( data_source="data_source_value", ) + assert args[0] == request_msg def test_update_product_input_use_cached_wrapped_rpc(): @@ -1817,9 +1836,15 @@ async def test_update_product_input_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + productinputs.UpdateProductInputRequest(), + {}, + ], +) async def test_update_product_input_async( - transport: str = "grpc_asyncio", - request_type=productinputs.UpdateProductInputRequest, + request_type, transport: str = "grpc_asyncio" ): client = ProductInputsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1828,7 +1853,7 @@ async def test_update_product_input_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( @@ -1865,11 +1890,6 @@ async def test_update_product_input_async( assert response.version_number == 1518 -@pytest.mark.asyncio -async def test_update_product_input_async_from_dict(): - await test_update_product_input_async(request_type=dict) - - def test_update_product_input_field_headers(): client = ProductInputsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2034,8 +2054,8 @@ async def test_update_product_input_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - productinputs.DeleteProductInputRequest, - dict, + productinputs.DeleteProductInputRequest(), + {}, ], ) def test_delete_product_input(request_type, transport: str = "grpc"): @@ -2046,7 +2066,7 @@ def test_delete_product_input(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2092,10 +2112,11 @@ def test_delete_product_input_non_empty_request_with_auto_populated_field(): client.delete_product_input(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == productinputs.DeleteProductInputRequest( + request_msg = productinputs.DeleteProductInputRequest( name="name_value", data_source="data_source_value", ) + assert args[0] == request_msg def test_delete_product_input_use_cached_wrapped_rpc(): @@ -2180,9 +2201,15 @@ async def test_delete_product_input_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + productinputs.DeleteProductInputRequest(), + {}, + ], +) async def test_delete_product_input_async( - transport: str = "grpc_asyncio", - request_type=productinputs.DeleteProductInputRequest, + request_type, transport: str = "grpc_asyncio" ): client = ProductInputsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2191,7 +2218,7 @@ async def test_delete_product_input_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( @@ -2211,11 +2238,6 @@ async def test_delete_product_input_async( assert response is None -@pytest.mark.asyncio -async def test_delete_product_input_async_from_dict(): - await test_delete_product_input_async(request_type=dict) - - def test_delete_product_input_field_headers(): client = ProductInputsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3053,7 +3075,6 @@ def test_insert_product_input_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = productinputs.InsertProductInputRequest() - assert args[0] == request_msg @@ -3076,7 +3097,6 @@ def test_update_product_input_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = productinputs.UpdateProductInputRequest() - assert args[0] == request_msg @@ -3099,7 +3119,6 @@ def test_delete_product_input_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = productinputs.DeleteProductInputRequest() - assert args[0] == request_msg @@ -3148,7 +3167,6 @@ async def test_insert_product_input_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = productinputs.InsertProductInputRequest() - assert args[0] == request_msg @@ -3183,7 +3201,6 @@ async def test_update_product_input_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = productinputs.UpdateProductInputRequest() - assert args[0] == request_msg @@ -3208,7 +3225,6 @@ async def test_delete_product_input_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = productinputs.DeleteProductInputRequest() - assert args[0] == request_msg @@ -4186,7 +4202,6 @@ def test_insert_product_input_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = productinputs.InsertProductInputRequest() - assert args[0] == request_msg @@ -4208,7 +4223,6 @@ def test_update_product_input_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = productinputs.UpdateProductInputRequest() - assert args[0] == request_msg @@ -4230,7 +4244,6 @@ def test_delete_product_input_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = productinputs.DeleteProductInputRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-products/tests/unit/gapic/merchant_products_v1beta/test_products_service.py b/packages/google-shopping-merchant-products/tests/unit/gapic/merchant_products_v1beta/test_products_service.py index 2b713d2a012d..2c637ce8795d 100644 --- a/packages/google-shopping-merchant-products/tests/unit/gapic/merchant_products_v1beta/test_products_service.py +++ b/packages/google-shopping-merchant-products/tests/unit/gapic/merchant_products_v1beta/test_products_service.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 @@ -108,6 +109,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" @@ -1335,8 +1351,8 @@ def test_products_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - products.GetProductRequest, - dict, + products.GetProductRequest(), + {}, ], ) def test_get_product(request_type, transport: str = "grpc"): @@ -1347,7 +1363,7 @@ def test_get_product(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_product), "__call__") as call: @@ -1403,9 +1419,10 @@ def test_get_product_non_empty_request_with_auto_populated_field(): client.get_product(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == products.GetProductRequest( + request_msg = products.GetProductRequest( name="name_value", ) + assert args[0] == request_msg def test_get_product_use_cached_wrapped_rpc(): @@ -1486,9 +1503,14 @@ async def test_get_product_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_product_async( - transport: str = "grpc_asyncio", request_type=products.GetProductRequest -): +@pytest.mark.parametrize( + "request_type", + [ + products.GetProductRequest(), + {}, + ], +) +async def test_get_product_async(request_type, transport: str = "grpc_asyncio"): client = ProductsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1496,7 +1518,7 @@ async def test_get_product_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_product), "__call__") as call: @@ -1531,11 +1553,6 @@ async def test_get_product_async( assert response.version_number == 1518 -@pytest.mark.asyncio -async def test_get_product_async_from_dict(): - await test_get_product_async(request_type=dict) - - def test_get_product_field_headers(): client = ProductsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1678,8 +1695,8 @@ async def test_get_product_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - products.ListProductsRequest, - dict, + products.ListProductsRequest(), + {}, ], ) def test_list_products(request_type, transport: str = "grpc"): @@ -1690,7 +1707,7 @@ def test_list_products(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_products), "__call__") as call: @@ -1735,10 +1752,11 @@ def test_list_products_non_empty_request_with_auto_populated_field(): client.list_products(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == products.ListProductsRequest( + request_msg = products.ListProductsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_products_use_cached_wrapped_rpc(): @@ -1819,9 +1837,14 @@ async def test_list_products_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_products_async( - transport: str = "grpc_asyncio", request_type=products.ListProductsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + products.ListProductsRequest(), + {}, + ], +) +async def test_list_products_async(request_type, transport: str = "grpc_asyncio"): client = ProductsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1829,7 +1852,7 @@ async def test_list_products_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_products), "__call__") as call: @@ -1852,11 +1875,6 @@ async def test_list_products_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_products_async_from_dict(): - await test_list_products_async(request_type=dict) - - def test_list_products_field_headers(): client = ProductsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2739,7 +2757,6 @@ def test_get_product_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = products.GetProductRequest() - assert args[0] == request_msg @@ -2760,7 +2777,6 @@ def test_list_products_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = products.ListProductsRequest() - assert args[0] == request_msg @@ -2807,7 +2823,6 @@ async def test_get_product_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = products.GetProductRequest() - assert args[0] == request_msg @@ -2834,7 +2849,6 @@ async def test_list_products_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = products.ListProductsRequest() - assert args[0] == request_msg @@ -3135,7 +3149,6 @@ def test_get_product_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = products.GetProductRequest() - assert args[0] == request_msg @@ -3155,7 +3168,6 @@ def test_list_products_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = products.ListProductsRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-productstudio/noxfile.py b/packages/google-shopping-merchant-productstudio/noxfile.py index 51ff282e2284..dbb49a1245ba 100644 --- a/packages/google-shopping-merchant-productstudio/noxfile.py +++ b/packages/google-shopping-merchant-productstudio/noxfile.py @@ -47,7 +47,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-shopping-merchant-productstudio" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-shopping-merchant-productstudio/setup.py b/packages/google-shopping-merchant-productstudio/setup.py index 625d06fe730d..20e11ca62385 100644 --- a/packages/google-shopping-merchant-productstudio/setup.py +++ b/packages/google-shopping-merchant-productstudio/setup.py @@ -47,7 +47,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/google-shopping-merchant-productstudio/testing/constraints-3.10.txt b/packages/google-shopping-merchant-productstudio/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-shopping-merchant-productstudio/testing/constraints-3.10.txt +++ b/packages/google-shopping-merchant-productstudio/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-shopping-merchant-productstudio/tests/unit/gapic/merchant_productstudio_v1alpha/test_image_service.py b/packages/google-shopping-merchant-productstudio/tests/unit/gapic/merchant_productstudio_v1alpha/test_image_service.py index 25015c026a15..4e3082622a48 100644 --- a/packages/google-shopping-merchant-productstudio/tests/unit/gapic/merchant_productstudio_v1alpha/test_image_service.py +++ b/packages/google-shopping-merchant-productstudio/tests/unit/gapic/merchant_productstudio_v1alpha/test_image_service.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 @@ -109,6 +110,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" @@ -1289,8 +1305,8 @@ def test_image_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - image.GenerateProductImageBackgroundRequest, - dict, + image.GenerateProductImageBackgroundRequest(), + {}, ], ) def test_generate_product_image_background(request_type, transport: str = "grpc"): @@ -1301,7 +1317,7 @@ def test_generate_product_image_background(request_type, transport: str = "grpc" # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1346,9 +1362,10 @@ def test_generate_product_image_background_non_empty_request_with_auto_populated client.generate_product_image_background(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == image.GenerateProductImageBackgroundRequest( + request_msg = image.GenerateProductImageBackgroundRequest( name="name_value", ) + assert args[0] == request_msg def test_generate_product_image_background_use_cached_wrapped_rpc(): @@ -1434,9 +1451,15 @@ async def test_generate_product_image_background_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + image.GenerateProductImageBackgroundRequest(), + {}, + ], +) async def test_generate_product_image_background_async( - transport: str = "grpc_asyncio", - request_type=image.GenerateProductImageBackgroundRequest, + request_type, transport: str = "grpc_asyncio" ): client = ImageServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1445,7 +1468,7 @@ async def test_generate_product_image_background_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( @@ -1467,11 +1490,6 @@ async def test_generate_product_image_background_async( assert isinstance(response, image.GenerateProductImageBackgroundResponse) -@pytest.mark.asyncio -async def test_generate_product_image_background_async_from_dict(): - await test_generate_product_image_background_async(request_type=dict) - - def test_generate_product_image_background_field_headers(): client = ImageServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1626,8 +1644,8 @@ async def test_generate_product_image_background_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - image.RemoveProductImageBackgroundRequest, - dict, + image.RemoveProductImageBackgroundRequest(), + {}, ], ) def test_remove_product_image_background(request_type, transport: str = "grpc"): @@ -1638,7 +1656,7 @@ def test_remove_product_image_background(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1683,9 +1701,10 @@ def test_remove_product_image_background_non_empty_request_with_auto_populated_f client.remove_product_image_background(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == image.RemoveProductImageBackgroundRequest( + request_msg = image.RemoveProductImageBackgroundRequest( name="name_value", ) + assert args[0] == request_msg def test_remove_product_image_background_use_cached_wrapped_rpc(): @@ -1771,9 +1790,15 @@ async def test_remove_product_image_background_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + image.RemoveProductImageBackgroundRequest(), + {}, + ], +) async def test_remove_product_image_background_async( - transport: str = "grpc_asyncio", - request_type=image.RemoveProductImageBackgroundRequest, + request_type, transport: str = "grpc_asyncio" ): client = ImageServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1782,7 +1807,7 @@ async def test_remove_product_image_background_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( @@ -1804,11 +1829,6 @@ async def test_remove_product_image_background_async( assert isinstance(response, image.RemoveProductImageBackgroundResponse) -@pytest.mark.asyncio -async def test_remove_product_image_background_async_from_dict(): - await test_remove_product_image_background_async(request_type=dict) - - def test_remove_product_image_background_field_headers(): client = ImageServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1963,8 +1983,8 @@ async def test_remove_product_image_background_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - image.UpscaleProductImageRequest, - dict, + image.UpscaleProductImageRequest(), + {}, ], ) def test_upscale_product_image(request_type, transport: str = "grpc"): @@ -1975,7 +1995,7 @@ def test_upscale_product_image(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2020,9 +2040,10 @@ def test_upscale_product_image_non_empty_request_with_auto_populated_field(): client.upscale_product_image(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == image.UpscaleProductImageRequest( + request_msg = image.UpscaleProductImageRequest( name="name_value", ) + assert args[0] == request_msg def test_upscale_product_image_use_cached_wrapped_rpc(): @@ -2108,8 +2129,15 @@ async def test_upscale_product_image_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + image.UpscaleProductImageRequest(), + {}, + ], +) async def test_upscale_product_image_async( - transport: str = "grpc_asyncio", request_type=image.UpscaleProductImageRequest + request_type, transport: str = "grpc_asyncio" ): client = ImageServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2118,7 +2146,7 @@ async def test_upscale_product_image_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( @@ -2140,11 +2168,6 @@ async def test_upscale_product_image_async( assert isinstance(response, image.UpscaleProductImageResponse) -@pytest.mark.asyncio -async def test_upscale_product_image_async_from_dict(): - await test_upscale_product_image_async(request_type=dict) - - def test_upscale_product_image_field_headers(): client = ImageServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3004,7 +3027,6 @@ def test_generate_product_image_background_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = image.GenerateProductImageBackgroundRequest() - assert args[0] == request_msg @@ -3027,7 +3049,6 @@ def test_remove_product_image_background_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = image.RemoveProductImageBackgroundRequest() - assert args[0] == request_msg @@ -3050,7 +3071,6 @@ def test_upscale_product_image_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = image.UpscaleProductImageRequest() - assert args[0] == request_msg @@ -3091,7 +3111,6 @@ async def test_generate_product_image_background_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = image.GenerateProductImageBackgroundRequest() - assert args[0] == request_msg @@ -3118,7 +3137,6 @@ async def test_remove_product_image_background_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = image.RemoveProductImageBackgroundRequest() - assert args[0] == request_msg @@ -3145,7 +3163,6 @@ async def test_upscale_product_image_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = image.UpscaleProductImageRequest() - assert args[0] == request_msg @@ -3581,7 +3598,6 @@ def test_generate_product_image_background_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = image.GenerateProductImageBackgroundRequest() - assert args[0] == request_msg @@ -3603,7 +3619,6 @@ def test_remove_product_image_background_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = image.RemoveProductImageBackgroundRequest() - assert args[0] == request_msg @@ -3625,7 +3640,6 @@ def test_upscale_product_image_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = image.UpscaleProductImageRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-productstudio/tests/unit/gapic/merchant_productstudio_v1alpha/test_text_suggestions_service.py b/packages/google-shopping-merchant-productstudio/tests/unit/gapic/merchant_productstudio_v1alpha/test_text_suggestions_service.py index 331dcb551580..f49e97091220 100644 --- a/packages/google-shopping-merchant-productstudio/tests/unit/gapic/merchant_productstudio_v1alpha/test_text_suggestions_service.py +++ b/packages/google-shopping-merchant-productstudio/tests/unit/gapic/merchant_productstudio_v1alpha/test_text_suggestions_service.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 @@ -106,6 +107,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" @@ -1375,8 +1391,8 @@ def test_text_suggestions_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - textsuggestions.GenerateProductTextSuggestionsRequest, - dict, + textsuggestions.GenerateProductTextSuggestionsRequest(), + {}, ], ) def test_generate_product_text_suggestions(request_type, transport: str = "grpc"): @@ -1387,7 +1403,7 @@ def test_generate_product_text_suggestions(request_type, transport: str = "grpc" # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1432,9 +1448,10 @@ def test_generate_product_text_suggestions_non_empty_request_with_auto_populated client.generate_product_text_suggestions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == textsuggestions.GenerateProductTextSuggestionsRequest( + request_msg = textsuggestions.GenerateProductTextSuggestionsRequest( name="name_value", ) + assert args[0] == request_msg def test_generate_product_text_suggestions_use_cached_wrapped_rpc(): @@ -1520,9 +1537,15 @@ async def test_generate_product_text_suggestions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + textsuggestions.GenerateProductTextSuggestionsRequest(), + {}, + ], +) async def test_generate_product_text_suggestions_async( - transport: str = "grpc_asyncio", - request_type=textsuggestions.GenerateProductTextSuggestionsRequest, + request_type, transport: str = "grpc_asyncio" ): client = TextSuggestionsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1531,7 +1554,7 @@ async def test_generate_product_text_suggestions_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( @@ -1553,11 +1576,6 @@ async def test_generate_product_text_suggestions_async( assert isinstance(response, textsuggestions.GenerateProductTextSuggestionsResponse) -@pytest.mark.asyncio -async def test_generate_product_text_suggestions_async_from_dict(): - await test_generate_product_text_suggestions_async(request_type=dict) - - def test_generate_product_text_suggestions_field_headers(): client = TextSuggestionsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2034,7 +2052,6 @@ def test_generate_product_text_suggestions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = textsuggestions.GenerateProductTextSuggestionsRequest() - assert args[0] == request_msg @@ -2075,7 +2092,6 @@ async def test_generate_product_text_suggestions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = textsuggestions.GenerateProductTextSuggestionsRequest() - assert args[0] == request_msg @@ -2248,7 +2264,6 @@ def test_generate_product_text_suggestions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = textsuggestions.GenerateProductTextSuggestionsRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-promotions/noxfile.py b/packages/google-shopping-merchant-promotions/noxfile.py index 5fe7d5e958a5..1202be8a0b25 100644 --- a/packages/google-shopping-merchant-promotions/noxfile.py +++ b/packages/google-shopping-merchant-promotions/noxfile.py @@ -47,7 +47,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-shopping-merchant-promotions" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-shopping-merchant-promotions/setup.py b/packages/google-shopping-merchant-promotions/setup.py index b5cff2804184..69f37d950a6e 100644 --- a/packages/google-shopping-merchant-promotions/setup.py +++ b/packages/google-shopping-merchant-promotions/setup.py @@ -45,7 +45,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/google-shopping-merchant-promotions/testing/constraints-3.10.txt b/packages/google-shopping-merchant-promotions/testing/constraints-3.10.txt index 28927d49b296..b408428a99a2 100644 --- a/packages/google-shopping-merchant-promotions/testing/constraints-3.10.txt +++ b/packages/google-shopping-merchant-promotions/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-shopping-type==1.0.0 diff --git a/packages/google-shopping-merchant-promotions/tests/unit/gapic/merchant_promotions_v1/test_promotions_service.py b/packages/google-shopping-merchant-promotions/tests/unit/gapic/merchant_promotions_v1/test_promotions_service.py index 181e31c0b445..5fd9d8fc75d3 100644 --- a/packages/google-shopping-merchant-promotions/tests/unit/gapic/merchant_promotions_v1/test_promotions_service.py +++ b/packages/google-shopping-merchant-promotions/tests/unit/gapic/merchant_promotions_v1/test_promotions_service.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 @@ -110,6 +111,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" @@ -1351,8 +1367,8 @@ def test_promotions_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - promotions.InsertPromotionRequest, - dict, + promotions.InsertPromotionRequest(), + {}, ], ) def test_insert_promotion(request_type, transport: str = "grpc"): @@ -1363,7 +1379,7 @@ def test_insert_promotion(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.insert_promotion), "__call__") as call: @@ -1420,10 +1436,11 @@ def test_insert_promotion_non_empty_request_with_auto_populated_field(): client.insert_promotion(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == promotions.InsertPromotionRequest( + request_msg = promotions.InsertPromotionRequest( parent="parent_value", data_source="data_source_value", ) + assert args[0] == request_msg def test_insert_promotion_use_cached_wrapped_rpc(): @@ -1506,9 +1523,14 @@ async def test_insert_promotion_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_insert_promotion_async( - transport: str = "grpc_asyncio", request_type=promotions.InsertPromotionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + promotions.InsertPromotionRequest(), + {}, + ], +) +async def test_insert_promotion_async(request_type, transport: str = "grpc_asyncio"): client = PromotionsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1516,7 +1538,7 @@ async def test_insert_promotion_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.insert_promotion), "__call__") as call: @@ -1551,11 +1573,6 @@ async def test_insert_promotion_async( assert response.version_number == 1518 -@pytest.mark.asyncio -async def test_insert_promotion_async_from_dict(): - await test_insert_promotion_async(request_type=dict) - - def test_insert_promotion_field_headers(): client = PromotionsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1620,8 +1637,8 @@ async def test_insert_promotion_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - promotions.GetPromotionRequest, - dict, + promotions.GetPromotionRequest(), + {}, ], ) def test_get_promotion(request_type, transport: str = "grpc"): @@ -1632,7 +1649,7 @@ def test_get_promotion(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_promotion), "__call__") as call: @@ -1688,9 +1705,10 @@ def test_get_promotion_non_empty_request_with_auto_populated_field(): client.get_promotion(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == promotions.GetPromotionRequest( + request_msg = promotions.GetPromotionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_promotion_use_cached_wrapped_rpc(): @@ -1771,9 +1789,14 @@ async def test_get_promotion_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_promotion_async( - transport: str = "grpc_asyncio", request_type=promotions.GetPromotionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + promotions.GetPromotionRequest(), + {}, + ], +) +async def test_get_promotion_async(request_type, transport: str = "grpc_asyncio"): client = PromotionsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1781,7 +1804,7 @@ async def test_get_promotion_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_promotion), "__call__") as call: @@ -1816,11 +1839,6 @@ async def test_get_promotion_async( assert response.version_number == 1518 -@pytest.mark.asyncio -async def test_get_promotion_async_from_dict(): - await test_get_promotion_async(request_type=dict) - - def test_get_promotion_field_headers(): client = PromotionsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1967,8 +1985,8 @@ async def test_get_promotion_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - promotions.ListPromotionsRequest, - dict, + promotions.ListPromotionsRequest(), + {}, ], ) def test_list_promotions(request_type, transport: str = "grpc"): @@ -1979,7 +1997,7 @@ def test_list_promotions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_promotions), "__call__") as call: @@ -2024,10 +2042,11 @@ def test_list_promotions_non_empty_request_with_auto_populated_field(): client.list_promotions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == promotions.ListPromotionsRequest( + request_msg = promotions.ListPromotionsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_promotions_use_cached_wrapped_rpc(): @@ -2108,9 +2127,14 @@ async def test_list_promotions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_promotions_async( - transport: str = "grpc_asyncio", request_type=promotions.ListPromotionsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + promotions.ListPromotionsRequest(), + {}, + ], +) +async def test_list_promotions_async(request_type, transport: str = "grpc_asyncio"): client = PromotionsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2118,7 +2142,7 @@ async def test_list_promotions_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_promotions), "__call__") as call: @@ -2141,11 +2165,6 @@ async def test_list_promotions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_promotions_async_from_dict(): - await test_list_promotions_async(request_type=dict) - - def test_list_promotions_field_headers(): client = PromotionsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3168,7 +3187,6 @@ def test_insert_promotion_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = promotions.InsertPromotionRequest() - assert args[0] == request_msg @@ -3189,7 +3207,6 @@ def test_get_promotion_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = promotions.GetPromotionRequest() - assert args[0] == request_msg @@ -3210,7 +3227,6 @@ def test_list_promotions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = promotions.ListPromotionsRequest() - assert args[0] == request_msg @@ -3257,7 +3273,6 @@ async def test_insert_promotion_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = promotions.InsertPromotionRequest() - assert args[0] == request_msg @@ -3290,7 +3305,6 @@ async def test_get_promotion_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = promotions.GetPromotionRequest() - assert args[0] == request_msg @@ -3317,7 +3331,6 @@ async def test_list_promotions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = promotions.ListPromotionsRequest() - assert args[0] == request_msg @@ -3766,7 +3779,6 @@ def test_insert_promotion_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = promotions.InsertPromotionRequest() - assert args[0] == request_msg @@ -3786,7 +3798,6 @@ def test_get_promotion_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = promotions.GetPromotionRequest() - assert args[0] == request_msg @@ -3806,7 +3817,6 @@ def test_list_promotions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = promotions.ListPromotionsRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-promotions/tests/unit/gapic/merchant_promotions_v1beta/test_promotions_service.py b/packages/google-shopping-merchant-promotions/tests/unit/gapic/merchant_promotions_v1beta/test_promotions_service.py index 9a405ad0e759..6c29a0378229 100644 --- a/packages/google-shopping-merchant-promotions/tests/unit/gapic/merchant_promotions_v1beta/test_promotions_service.py +++ b/packages/google-shopping-merchant-promotions/tests/unit/gapic/merchant_promotions_v1beta/test_promotions_service.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 @@ -113,6 +114,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" @@ -1354,8 +1370,8 @@ def test_promotions_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - promotions.InsertPromotionRequest, - dict, + promotions.InsertPromotionRequest(), + {}, ], ) def test_insert_promotion(request_type, transport: str = "grpc"): @@ -1366,7 +1382,7 @@ def test_insert_promotion(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.insert_promotion), "__call__") as call: @@ -1423,10 +1439,11 @@ def test_insert_promotion_non_empty_request_with_auto_populated_field(): client.insert_promotion(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == promotions.InsertPromotionRequest( + request_msg = promotions.InsertPromotionRequest( parent="parent_value", data_source="data_source_value", ) + assert args[0] == request_msg def test_insert_promotion_use_cached_wrapped_rpc(): @@ -1509,9 +1526,14 @@ async def test_insert_promotion_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_insert_promotion_async( - transport: str = "grpc_asyncio", request_type=promotions.InsertPromotionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + promotions.InsertPromotionRequest(), + {}, + ], +) +async def test_insert_promotion_async(request_type, transport: str = "grpc_asyncio"): client = PromotionsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1519,7 +1541,7 @@ async def test_insert_promotion_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.insert_promotion), "__call__") as call: @@ -1554,11 +1576,6 @@ async def test_insert_promotion_async( assert response.version_number == 1518 -@pytest.mark.asyncio -async def test_insert_promotion_async_from_dict(): - await test_insert_promotion_async(request_type=dict) - - def test_insert_promotion_field_headers(): client = PromotionsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1623,8 +1640,8 @@ async def test_insert_promotion_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - promotions.GetPromotionRequest, - dict, + promotions.GetPromotionRequest(), + {}, ], ) def test_get_promotion(request_type, transport: str = "grpc"): @@ -1635,7 +1652,7 @@ def test_get_promotion(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_promotion), "__call__") as call: @@ -1691,9 +1708,10 @@ def test_get_promotion_non_empty_request_with_auto_populated_field(): client.get_promotion(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == promotions.GetPromotionRequest( + request_msg = promotions.GetPromotionRequest( name="name_value", ) + assert args[0] == request_msg def test_get_promotion_use_cached_wrapped_rpc(): @@ -1774,9 +1792,14 @@ async def test_get_promotion_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_promotion_async( - transport: str = "grpc_asyncio", request_type=promotions.GetPromotionRequest -): +@pytest.mark.parametrize( + "request_type", + [ + promotions.GetPromotionRequest(), + {}, + ], +) +async def test_get_promotion_async(request_type, transport: str = "grpc_asyncio"): client = PromotionsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1784,7 +1807,7 @@ async def test_get_promotion_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_promotion), "__call__") as call: @@ -1819,11 +1842,6 @@ async def test_get_promotion_async( assert response.version_number == 1518 -@pytest.mark.asyncio -async def test_get_promotion_async_from_dict(): - await test_get_promotion_async(request_type=dict) - - def test_get_promotion_field_headers(): client = PromotionsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1970,8 +1988,8 @@ async def test_get_promotion_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - promotions.ListPromotionsRequest, - dict, + promotions.ListPromotionsRequest(), + {}, ], ) def test_list_promotions(request_type, transport: str = "grpc"): @@ -1982,7 +2000,7 @@ def test_list_promotions(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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_promotions), "__call__") as call: @@ -2027,10 +2045,11 @@ def test_list_promotions_non_empty_request_with_auto_populated_field(): client.list_promotions(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == promotions.ListPromotionsRequest( + request_msg = promotions.ListPromotionsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_promotions_use_cached_wrapped_rpc(): @@ -2111,9 +2130,14 @@ async def test_list_promotions_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_promotions_async( - transport: str = "grpc_asyncio", request_type=promotions.ListPromotionsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + promotions.ListPromotionsRequest(), + {}, + ], +) +async def test_list_promotions_async(request_type, transport: str = "grpc_asyncio"): client = PromotionsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -2121,7 +2145,7 @@ async def test_list_promotions_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_promotions), "__call__") as call: @@ -2144,11 +2168,6 @@ async def test_list_promotions_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_promotions_async_from_dict(): - await test_list_promotions_async(request_type=dict) - - def test_list_promotions_field_headers(): client = PromotionsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3173,7 +3192,6 @@ def test_insert_promotion_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = promotions.InsertPromotionRequest() - assert args[0] == request_msg @@ -3194,7 +3212,6 @@ def test_get_promotion_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = promotions.GetPromotionRequest() - assert args[0] == request_msg @@ -3215,7 +3232,6 @@ def test_list_promotions_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = promotions.ListPromotionsRequest() - assert args[0] == request_msg @@ -3262,7 +3278,6 @@ async def test_insert_promotion_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = promotions.InsertPromotionRequest() - assert args[0] == request_msg @@ -3295,7 +3310,6 @@ async def test_get_promotion_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = promotions.GetPromotionRequest() - assert args[0] == request_msg @@ -3322,7 +3336,6 @@ async def test_list_promotions_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = promotions.ListPromotionsRequest() - assert args[0] == request_msg @@ -3771,7 +3784,6 @@ def test_insert_promotion_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = promotions.InsertPromotionRequest() - assert args[0] == request_msg @@ -3791,7 +3803,6 @@ def test_get_promotion_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = promotions.GetPromotionRequest() - assert args[0] == request_msg @@ -3811,7 +3822,6 @@ def test_list_promotions_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = promotions.ListPromotionsRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-quota/noxfile.py b/packages/google-shopping-merchant-quota/noxfile.py index 02249a7a3f4e..a6fe68f6bdbc 100644 --- a/packages/google-shopping-merchant-quota/noxfile.py +++ b/packages/google-shopping-merchant-quota/noxfile.py @@ -47,7 +47,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-shopping-merchant-quota" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-shopping-merchant-quota/setup.py b/packages/google-shopping-merchant-quota/setup.py index bc4891a17e86..382890aaea9e 100644 --- a/packages/google-shopping-merchant-quota/setup.py +++ b/packages/google-shopping-merchant-quota/setup.py @@ -45,7 +45,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/google-shopping-merchant-quota/testing/constraints-3.10.txt b/packages/google-shopping-merchant-quota/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-shopping-merchant-quota/testing/constraints-3.10.txt +++ b/packages/google-shopping-merchant-quota/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-shopping-merchant-quota/tests/unit/gapic/merchant_quota_v1/test_account_limits_service.py b/packages/google-shopping-merchant-quota/tests/unit/gapic/merchant_quota_v1/test_account_limits_service.py index 3ffad196a61b..75215e3a62a7 100644 --- a/packages/google-shopping-merchant-quota/tests/unit/gapic/merchant_quota_v1/test_account_limits_service.py +++ b/packages/google-shopping-merchant-quota/tests/unit/gapic/merchant_quota_v1/test_account_limits_service.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 @@ -107,6 +108,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" @@ -1370,8 +1386,8 @@ def test_account_limits_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - accountlimits.GetAccountLimitRequest, - dict, + accountlimits.GetAccountLimitRequest(), + {}, ], ) def test_get_account_limit(request_type, transport: str = "grpc"): @@ -1382,7 +1398,7 @@ def test_get_account_limit(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1430,9 +1446,10 @@ def test_get_account_limit_non_empty_request_with_auto_populated_field(): client.get_account_limit(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == accountlimits.GetAccountLimitRequest( + request_msg = accountlimits.GetAccountLimitRequest( name="name_value", ) + assert args[0] == request_msg def test_get_account_limit_use_cached_wrapped_rpc(): @@ -1515,9 +1532,14 @@ async def test_get_account_limit_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_account_limit_async( - transport: str = "grpc_asyncio", request_type=accountlimits.GetAccountLimitRequest -): +@pytest.mark.parametrize( + "request_type", + [ + accountlimits.GetAccountLimitRequest(), + {}, + ], +) +async def test_get_account_limit_async(request_type, transport: str = "grpc_asyncio"): client = AccountLimitsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1525,7 +1547,7 @@ async def test_get_account_limit_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( @@ -1550,11 +1572,6 @@ async def test_get_account_limit_async( assert response.name == "name_value" -@pytest.mark.asyncio -async def test_get_account_limit_async_from_dict(): - await test_get_account_limit_async(request_type=dict) - - def test_get_account_limit_field_headers(): client = AccountLimitsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1709,8 +1726,8 @@ async def test_get_account_limit_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - accountlimits.ListAccountLimitsRequest, - dict, + accountlimits.ListAccountLimitsRequest(), + {}, ], ) def test_list_account_limits(request_type, transport: str = "grpc"): @@ -1721,7 +1738,7 @@ def test_list_account_limits(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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,11 +1788,12 @@ def test_list_account_limits_non_empty_request_with_auto_populated_field(): client.list_account_limits(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == accountlimits.ListAccountLimitsRequest( + request_msg = accountlimits.ListAccountLimitsRequest( parent="parent_value", page_token="page_token_value", filter="filter_value", ) + assert args[0] == request_msg def test_list_account_limits_use_cached_wrapped_rpc(): @@ -1860,9 +1878,14 @@ async def test_list_account_limits_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_account_limits_async( - transport: str = "grpc_asyncio", request_type=accountlimits.ListAccountLimitsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + accountlimits.ListAccountLimitsRequest(), + {}, + ], +) +async def test_list_account_limits_async(request_type, transport: str = "grpc_asyncio"): client = AccountLimitsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1870,7 +1893,7 @@ async def test_list_account_limits_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( @@ -1895,11 +1918,6 @@ async def test_list_account_limits_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_account_limits_async_from_dict(): - await test_list_account_limits_async(request_type=dict) - - def test_list_account_limits_field_headers(): client = AccountLimitsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2832,7 +2850,6 @@ def test_get_account_limit_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accountlimits.GetAccountLimitRequest() - assert args[0] == request_msg @@ -2855,7 +2872,6 @@ def test_list_account_limits_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accountlimits.ListAccountLimitsRequest() - assert args[0] == request_msg @@ -2898,7 +2914,6 @@ async def test_get_account_limit_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accountlimits.GetAccountLimitRequest() - assert args[0] == request_msg @@ -2927,7 +2942,6 @@ async def test_list_account_limits_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accountlimits.ListAccountLimitsRequest() - assert args[0] == request_msg @@ -3230,7 +3244,6 @@ def test_get_account_limit_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accountlimits.GetAccountLimitRequest() - assert args[0] == request_msg @@ -3252,7 +3265,6 @@ def test_list_account_limits_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = accountlimits.ListAccountLimitsRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-quota/tests/unit/gapic/merchant_quota_v1/test_quota_service.py b/packages/google-shopping-merchant-quota/tests/unit/gapic/merchant_quota_v1/test_quota_service.py index 5c5c719eb2f8..5d9a50f78d61 100644 --- a/packages/google-shopping-merchant-quota/tests/unit/gapic/merchant_quota_v1/test_quota_service.py +++ b/packages/google-shopping-merchant-quota/tests/unit/gapic/merchant_quota_v1/test_quota_service.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 @@ -107,6 +108,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" @@ -1287,8 +1303,8 @@ def test_quota_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - quota.ListQuotaGroupsRequest, - dict, + quota.ListQuotaGroupsRequest(), + {}, ], ) def test_list_quota_groups(request_type, transport: str = "grpc"): @@ -1299,7 +1315,7 @@ def test_list_quota_groups(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1348,10 +1364,11 @@ def test_list_quota_groups_non_empty_request_with_auto_populated_field(): client.list_quota_groups(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == quota.ListQuotaGroupsRequest( + request_msg = quota.ListQuotaGroupsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_quota_groups_use_cached_wrapped_rpc(): @@ -1434,9 +1451,14 @@ async def test_list_quota_groups_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_quota_groups_async( - transport: str = "grpc_asyncio", request_type=quota.ListQuotaGroupsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + quota.ListQuotaGroupsRequest(), + {}, + ], +) +async def test_list_quota_groups_async(request_type, transport: str = "grpc_asyncio"): client = QuotaServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1444,7 +1466,7 @@ async def test_list_quota_groups_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( @@ -1469,11 +1491,6 @@ async def test_list_quota_groups_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_quota_groups_async_from_dict(): - await test_list_quota_groups_async(request_type=dict) - - def test_list_quota_groups_field_headers(): client = QuotaServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2202,7 +2219,6 @@ def test_list_quota_groups_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = quota.ListQuotaGroupsRequest() - assert args[0] == request_msg @@ -2245,7 +2261,6 @@ async def test_list_quota_groups_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = quota.ListQuotaGroupsRequest() - assert args[0] == request_msg @@ -2410,7 +2425,6 @@ def test_list_quota_groups_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = quota.ListQuotaGroupsRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-quota/tests/unit/gapic/merchant_quota_v1beta/test_quota_service.py b/packages/google-shopping-merchant-quota/tests/unit/gapic/merchant_quota_v1beta/test_quota_service.py index 6fb104e9a256..c942e20458a4 100644 --- a/packages/google-shopping-merchant-quota/tests/unit/gapic/merchant_quota_v1beta/test_quota_service.py +++ b/packages/google-shopping-merchant-quota/tests/unit/gapic/merchant_quota_v1beta/test_quota_service.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 @@ -107,6 +108,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" @@ -1287,8 +1303,8 @@ def test_quota_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - quota.ListQuotaGroupsRequest, - dict, + quota.ListQuotaGroupsRequest(), + {}, ], ) def test_list_quota_groups(request_type, transport: str = "grpc"): @@ -1299,7 +1315,7 @@ def test_list_quota_groups(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1348,10 +1364,11 @@ def test_list_quota_groups_non_empty_request_with_auto_populated_field(): client.list_quota_groups(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == quota.ListQuotaGroupsRequest( + request_msg = quota.ListQuotaGroupsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_quota_groups_use_cached_wrapped_rpc(): @@ -1434,9 +1451,14 @@ async def test_list_quota_groups_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_list_quota_groups_async( - transport: str = "grpc_asyncio", request_type=quota.ListQuotaGroupsRequest -): +@pytest.mark.parametrize( + "request_type", + [ + quota.ListQuotaGroupsRequest(), + {}, + ], +) +async def test_list_quota_groups_async(request_type, transport: str = "grpc_asyncio"): client = QuotaServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1444,7 +1466,7 @@ async def test_list_quota_groups_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( @@ -1469,11 +1491,6 @@ async def test_list_quota_groups_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_quota_groups_async_from_dict(): - await test_list_quota_groups_async(request_type=dict) - - def test_list_quota_groups_field_headers(): client = QuotaServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2203,7 +2220,6 @@ def test_list_quota_groups_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = quota.ListQuotaGroupsRequest() - assert args[0] == request_msg @@ -2246,7 +2262,6 @@ async def test_list_quota_groups_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = quota.ListQuotaGroupsRequest() - assert args[0] == request_msg @@ -2411,7 +2426,6 @@ def test_list_quota_groups_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = quota.ListQuotaGroupsRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-reports/noxfile.py b/packages/google-shopping-merchant-reports/noxfile.py index 221bc5fb6ce7..2d85b52ed1b7 100644 --- a/packages/google-shopping-merchant-reports/noxfile.py +++ b/packages/google-shopping-merchant-reports/noxfile.py @@ -47,7 +47,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-shopping-merchant-reports" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-shopping-merchant-reports/setup.py b/packages/google-shopping-merchant-reports/setup.py index bfdde15702fa..52bc61fba399 100644 --- a/packages/google-shopping-merchant-reports/setup.py +++ b/packages/google-shopping-merchant-reports/setup.py @@ -45,7 +45,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/google-shopping-merchant-reports/testing/constraints-3.10.txt b/packages/google-shopping-merchant-reports/testing/constraints-3.10.txt index 28927d49b296..b408428a99a2 100644 --- a/packages/google-shopping-merchant-reports/testing/constraints-3.10.txt +++ b/packages/google-shopping-merchant-reports/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-shopping-type==1.0.0 diff --git a/packages/google-shopping-merchant-reports/tests/unit/gapic/merchant_reports_v1/test_report_service.py b/packages/google-shopping-merchant-reports/tests/unit/gapic/merchant_reports_v1/test_report_service.py index 3eafa27a8f10..e50d12960ee4 100644 --- a/packages/google-shopping-merchant-reports/tests/unit/gapic/merchant_reports_v1/test_report_service.py +++ b/packages/google-shopping-merchant-reports/tests/unit/gapic/merchant_reports_v1/test_report_service.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 @@ -107,6 +108,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" @@ -1306,8 +1322,8 @@ def test_report_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - reports.SearchRequest, - dict, + reports.SearchRequest(), + {}, ], ) def test_search(request_type, transport: str = "grpc"): @@ -1318,7 +1334,7 @@ def test_search(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.search), "__call__") as call: @@ -1364,11 +1380,12 @@ def test_search_non_empty_request_with_auto_populated_field(): client.search(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == reports.SearchRequest( + request_msg = reports.SearchRequest( parent="parent_value", query="query_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_search_use_cached_wrapped_rpc(): @@ -1447,9 +1464,14 @@ async def test_search_async_use_cached_wrapped_rpc(transport: str = "grpc_asynci @pytest.mark.asyncio -async def test_search_async( - transport: str = "grpc_asyncio", request_type=reports.SearchRequest -): +@pytest.mark.parametrize( + "request_type", + [ + reports.SearchRequest(), + {}, + ], +) +async def test_search_async(request_type, transport: str = "grpc_asyncio"): client = ReportServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1457,7 +1479,7 @@ async def test_search_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.search), "__call__") as call: @@ -1480,11 +1502,6 @@ async def test_search_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_search_async_from_dict(): - await test_search_async(request_type=dict) - - def test_search_field_headers(): client = ReportServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2190,7 +2207,6 @@ def test_search_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reports.SearchRequest() - assert args[0] == request_msg @@ -2231,7 +2247,6 @@ async def test_search_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reports.SearchRequest() - assert args[0] == request_msg @@ -2389,7 +2404,6 @@ def test_search_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reports.SearchRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-reports/tests/unit/gapic/merchant_reports_v1alpha/test_report_service.py b/packages/google-shopping-merchant-reports/tests/unit/gapic/merchant_reports_v1alpha/test_report_service.py index d031cb6ff6e4..989c3a7a98cf 100644 --- a/packages/google-shopping-merchant-reports/tests/unit/gapic/merchant_reports_v1alpha/test_report_service.py +++ b/packages/google-shopping-merchant-reports/tests/unit/gapic/merchant_reports_v1alpha/test_report_service.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 @@ -107,6 +108,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" @@ -1306,8 +1322,8 @@ def test_report_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - reports.SearchRequest, - dict, + reports.SearchRequest(), + {}, ], ) def test_search(request_type, transport: str = "grpc"): @@ -1318,7 +1334,7 @@ def test_search(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.search), "__call__") as call: @@ -1364,11 +1380,12 @@ def test_search_non_empty_request_with_auto_populated_field(): client.search(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == reports.SearchRequest( + request_msg = reports.SearchRequest( parent="parent_value", query="query_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_search_use_cached_wrapped_rpc(): @@ -1447,9 +1464,14 @@ async def test_search_async_use_cached_wrapped_rpc(transport: str = "grpc_asynci @pytest.mark.asyncio -async def test_search_async( - transport: str = "grpc_asyncio", request_type=reports.SearchRequest -): +@pytest.mark.parametrize( + "request_type", + [ + reports.SearchRequest(), + {}, + ], +) +async def test_search_async(request_type, transport: str = "grpc_asyncio"): client = ReportServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1457,7 +1479,7 @@ async def test_search_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.search), "__call__") as call: @@ -1480,11 +1502,6 @@ async def test_search_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_search_async_from_dict(): - await test_search_async(request_type=dict) - - def test_search_field_headers(): client = ReportServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2191,7 +2208,6 @@ def test_search_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reports.SearchRequest() - assert args[0] == request_msg @@ -2232,7 +2248,6 @@ async def test_search_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reports.SearchRequest() - assert args[0] == request_msg @@ -2390,7 +2405,6 @@ def test_search_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reports.SearchRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-reports/tests/unit/gapic/merchant_reports_v1beta/test_report_service.py b/packages/google-shopping-merchant-reports/tests/unit/gapic/merchant_reports_v1beta/test_report_service.py index 6a1438827e16..808ddd9acce6 100644 --- a/packages/google-shopping-merchant-reports/tests/unit/gapic/merchant_reports_v1beta/test_report_service.py +++ b/packages/google-shopping-merchant-reports/tests/unit/gapic/merchant_reports_v1beta/test_report_service.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 @@ -107,6 +108,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" @@ -1306,8 +1322,8 @@ def test_report_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - reports.SearchRequest, - dict, + reports.SearchRequest(), + {}, ], ) def test_search(request_type, transport: str = "grpc"): @@ -1318,7 +1334,7 @@ def test_search(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an 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.search), "__call__") as call: @@ -1364,11 +1380,12 @@ def test_search_non_empty_request_with_auto_populated_field(): client.search(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == reports.SearchRequest( + request_msg = reports.SearchRequest( parent="parent_value", query="query_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_search_use_cached_wrapped_rpc(): @@ -1447,9 +1464,14 @@ async def test_search_async_use_cached_wrapped_rpc(transport: str = "grpc_asynci @pytest.mark.asyncio -async def test_search_async( - transport: str = "grpc_asyncio", request_type=reports.SearchRequest -): +@pytest.mark.parametrize( + "request_type", + [ + reports.SearchRequest(), + {}, + ], +) +async def test_search_async(request_type, transport: str = "grpc_asyncio"): client = ReportServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1457,7 +1479,7 @@ async def test_search_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.search), "__call__") as call: @@ -1480,11 +1502,6 @@ async def test_search_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_search_async_from_dict(): - await test_search_async(request_type=dict) - - def test_search_field_headers(): client = ReportServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2191,7 +2208,6 @@ def test_search_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reports.SearchRequest() - assert args[0] == request_msg @@ -2232,7 +2248,6 @@ async def test_search_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reports.SearchRequest() - assert args[0] == request_msg @@ -2390,7 +2405,6 @@ def test_search_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = reports.SearchRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-reviews/noxfile.py b/packages/google-shopping-merchant-reviews/noxfile.py index c419f64b7bf3..676575644598 100644 --- a/packages/google-shopping-merchant-reviews/noxfile.py +++ b/packages/google-shopping-merchant-reviews/noxfile.py @@ -47,7 +47,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-shopping-merchant-reviews" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-shopping-merchant-reviews/setup.py b/packages/google-shopping-merchant-reviews/setup.py index 893785c72828..e93978164816 100644 --- a/packages/google-shopping-merchant-reviews/setup.py +++ b/packages/google-shopping-merchant-reviews/setup.py @@ -45,7 +45,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/google-shopping-merchant-reviews/testing/constraints-3.10.txt b/packages/google-shopping-merchant-reviews/testing/constraints-3.10.txt index 28927d49b296..b408428a99a2 100644 --- a/packages/google-shopping-merchant-reviews/testing/constraints-3.10.txt +++ b/packages/google-shopping-merchant-reviews/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-shopping-type==1.0.0 diff --git a/packages/google-shopping-merchant-reviews/tests/unit/gapic/merchant_reviews_v1beta/test_merchant_reviews_service.py b/packages/google-shopping-merchant-reviews/tests/unit/gapic/merchant_reviews_v1beta/test_merchant_reviews_service.py index e0a3485ea273..04b456864da3 100644 --- a/packages/google-shopping-merchant-reviews/tests/unit/gapic/merchant_reviews_v1beta/test_merchant_reviews_service.py +++ b/packages/google-shopping-merchant-reviews/tests/unit/gapic/merchant_reviews_v1beta/test_merchant_reviews_service.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" @@ -1381,8 +1397,8 @@ def test_merchant_reviews_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - merchantreviews.GetMerchantReviewRequest, - dict, + merchantreviews.GetMerchantReviewRequest(), + {}, ], ) def test_get_merchant_review(request_type, transport: str = "grpc"): @@ -1393,7 +1409,7 @@ def test_get_merchant_review(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1445,9 +1461,10 @@ def test_get_merchant_review_non_empty_request_with_auto_populated_field(): client.get_merchant_review(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == merchantreviews.GetMerchantReviewRequest( + request_msg = merchantreviews.GetMerchantReviewRequest( name="name_value", ) + assert args[0] == request_msg def test_get_merchant_review_use_cached_wrapped_rpc(): @@ -1532,10 +1549,14 @@ async def test_get_merchant_review_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_merchant_review_async( - transport: str = "grpc_asyncio", - request_type=merchantreviews.GetMerchantReviewRequest, -): +@pytest.mark.parametrize( + "request_type", + [ + merchantreviews.GetMerchantReviewRequest(), + {}, + ], +) +async def test_get_merchant_review_async(request_type, transport: str = "grpc_asyncio"): client = MerchantReviewsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1543,7 +1564,7 @@ async def test_get_merchant_review_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( @@ -1572,11 +1593,6 @@ async def test_get_merchant_review_async( assert response.data_source == "data_source_value" -@pytest.mark.asyncio -async def test_get_merchant_review_async_from_dict(): - await test_get_merchant_review_async(request_type=dict) - - def test_get_merchant_review_field_headers(): client = MerchantReviewsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1731,8 +1747,8 @@ async def test_get_merchant_review_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - merchantreviews.ListMerchantReviewsRequest, - dict, + merchantreviews.ListMerchantReviewsRequest(), + {}, ], ) def test_list_merchant_reviews(request_type, transport: str = "grpc"): @@ -1743,7 +1759,7 @@ def test_list_merchant_reviews(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1792,10 +1808,11 @@ def test_list_merchant_reviews_non_empty_request_with_auto_populated_field(): client.list_merchant_reviews(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == merchantreviews.ListMerchantReviewsRequest( + request_msg = merchantreviews.ListMerchantReviewsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_merchant_reviews_use_cached_wrapped_rpc(): @@ -1881,9 +1898,15 @@ async def test_list_merchant_reviews_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + merchantreviews.ListMerchantReviewsRequest(), + {}, + ], +) async def test_list_merchant_reviews_async( - transport: str = "grpc_asyncio", - request_type=merchantreviews.ListMerchantReviewsRequest, + request_type, transport: str = "grpc_asyncio" ): client = MerchantReviewsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1892,7 +1915,7 @@ async def test_list_merchant_reviews_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( @@ -1917,11 +1940,6 @@ async def test_list_merchant_reviews_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_merchant_reviews_async_from_dict(): - await test_list_merchant_reviews_async(request_type=dict) - - def test_list_merchant_reviews_field_headers(): client = MerchantReviewsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2274,8 +2292,8 @@ async def test_list_merchant_reviews_async_pages(): @pytest.mark.parametrize( "request_type", [ - merchantreviews.InsertMerchantReviewRequest, - dict, + merchantreviews.InsertMerchantReviewRequest(), + {}, ], ) def test_insert_merchant_review(request_type, transport: str = "grpc"): @@ -2286,7 +2304,7 @@ def test_insert_merchant_review(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2339,10 +2357,11 @@ def test_insert_merchant_review_non_empty_request_with_auto_populated_field(): client.insert_merchant_review(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == merchantreviews.InsertMerchantReviewRequest( + request_msg = merchantreviews.InsertMerchantReviewRequest( parent="parent_value", data_source="data_source_value", ) + assert args[0] == request_msg def test_insert_merchant_review_use_cached_wrapped_rpc(): @@ -2428,9 +2447,15 @@ async def test_insert_merchant_review_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + merchantreviews.InsertMerchantReviewRequest(), + {}, + ], +) async def test_insert_merchant_review_async( - transport: str = "grpc_asyncio", - request_type=merchantreviews.InsertMerchantReviewRequest, + request_type, transport: str = "grpc_asyncio" ): client = MerchantReviewsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2439,7 +2464,7 @@ async def test_insert_merchant_review_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( @@ -2468,11 +2493,6 @@ async def test_insert_merchant_review_async( assert response.data_source == "data_source_value" -@pytest.mark.asyncio -async def test_insert_merchant_review_async_from_dict(): - await test_insert_merchant_review_async(request_type=dict) - - def test_insert_merchant_review_field_headers(): client = MerchantReviewsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2541,8 +2561,8 @@ async def test_insert_merchant_review_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - merchantreviews.DeleteMerchantReviewRequest, - dict, + merchantreviews.DeleteMerchantReviewRequest(), + {}, ], ) def test_delete_merchant_review(request_type, transport: str = "grpc"): @@ -2553,7 +2573,7 @@ def test_delete_merchant_review(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2598,9 +2618,10 @@ def test_delete_merchant_review_non_empty_request_with_auto_populated_field(): client.delete_merchant_review(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == merchantreviews.DeleteMerchantReviewRequest( + request_msg = merchantreviews.DeleteMerchantReviewRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_merchant_review_use_cached_wrapped_rpc(): @@ -2686,9 +2707,15 @@ async def test_delete_merchant_review_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + merchantreviews.DeleteMerchantReviewRequest(), + {}, + ], +) async def test_delete_merchant_review_async( - transport: str = "grpc_asyncio", - request_type=merchantreviews.DeleteMerchantReviewRequest, + request_type, transport: str = "grpc_asyncio" ): client = MerchantReviewsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2697,7 +2724,7 @@ async def test_delete_merchant_review_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( @@ -2717,11 +2744,6 @@ async def test_delete_merchant_review_async( assert response is None -@pytest.mark.asyncio -async def test_delete_merchant_review_async_from_dict(): - await test_delete_merchant_review_async(request_type=dict) - - def test_delete_merchant_review_field_headers(): client = MerchantReviewsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3765,7 +3787,6 @@ def test_get_merchant_review_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = merchantreviews.GetMerchantReviewRequest() - assert args[0] == request_msg @@ -3788,7 +3809,6 @@ def test_list_merchant_reviews_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = merchantreviews.ListMerchantReviewsRequest() - assert args[0] == request_msg @@ -3811,7 +3831,6 @@ def test_insert_merchant_review_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = merchantreviews.InsertMerchantReviewRequest() - assert args[0] == request_msg @@ -3834,7 +3853,6 @@ def test_delete_merchant_review_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = merchantreviews.DeleteMerchantReviewRequest() - assert args[0] == request_msg @@ -3879,7 +3897,6 @@ async def test_get_merchant_review_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = merchantreviews.GetMerchantReviewRequest() - assert args[0] == request_msg @@ -3908,7 +3925,6 @@ async def test_list_merchant_reviews_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = merchantreviews.ListMerchantReviewsRequest() - assert args[0] == request_msg @@ -3939,7 +3955,6 @@ async def test_insert_merchant_review_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = merchantreviews.InsertMerchantReviewRequest() - assert args[0] == request_msg @@ -3964,7 +3979,6 @@ async def test_delete_merchant_review_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = merchantreviews.DeleteMerchantReviewRequest() - assert args[0] == request_msg @@ -4637,7 +4651,6 @@ def test_get_merchant_review_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = merchantreviews.GetMerchantReviewRequest() - assert args[0] == request_msg @@ -4659,7 +4672,6 @@ def test_list_merchant_reviews_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = merchantreviews.ListMerchantReviewsRequest() - assert args[0] == request_msg @@ -4681,7 +4693,6 @@ def test_insert_merchant_review_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = merchantreviews.InsertMerchantReviewRequest() - assert args[0] == request_msg @@ -4703,7 +4714,6 @@ def test_delete_merchant_review_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = merchantreviews.DeleteMerchantReviewRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-merchant-reviews/tests/unit/gapic/merchant_reviews_v1beta/test_product_reviews_service.py b/packages/google-shopping-merchant-reviews/tests/unit/gapic/merchant_reviews_v1beta/test_product_reviews_service.py index bf80d76fc6b4..2681fb13859f 100644 --- a/packages/google-shopping-merchant-reviews/tests/unit/gapic/merchant_reviews_v1beta/test_product_reviews_service.py +++ b/packages/google-shopping-merchant-reviews/tests/unit/gapic/merchant_reviews_v1beta/test_product_reviews_service.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" @@ -1377,8 +1393,8 @@ def test_product_reviews_service_client_create_channel_credentials_file( @pytest.mark.parametrize( "request_type", [ - productreviews.GetProductReviewRequest, - dict, + productreviews.GetProductReviewRequest(), + {}, ], ) def test_get_product_review(request_type, transport: str = "grpc"): @@ -1389,7 +1405,7 @@ def test_get_product_review(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1441,9 +1457,10 @@ def test_get_product_review_non_empty_request_with_auto_populated_field(): client.get_product_review(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == productreviews.GetProductReviewRequest( + request_msg = productreviews.GetProductReviewRequest( name="name_value", ) + assert args[0] == request_msg def test_get_product_review_use_cached_wrapped_rpc(): @@ -1528,9 +1545,14 @@ async def test_get_product_review_async_use_cached_wrapped_rpc( @pytest.mark.asyncio -async def test_get_product_review_async( - transport: str = "grpc_asyncio", request_type=productreviews.GetProductReviewRequest -): +@pytest.mark.parametrize( + "request_type", + [ + productreviews.GetProductReviewRequest(), + {}, + ], +) +async def test_get_product_review_async(request_type, transport: str = "grpc_asyncio"): client = ProductReviewsServiceAsyncClient( credentials=async_anonymous_credentials(), transport=transport, @@ -1538,7 +1560,7 @@ async def test_get_product_review_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( @@ -1567,11 +1589,6 @@ async def test_get_product_review_async( assert response.data_source == "data_source_value" -@pytest.mark.asyncio -async def test_get_product_review_async_from_dict(): - await test_get_product_review_async(request_type=dict) - - def test_get_product_review_field_headers(): client = ProductReviewsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -1726,8 +1743,8 @@ async def test_get_product_review_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - productreviews.ListProductReviewsRequest, - dict, + productreviews.ListProductReviewsRequest(), + {}, ], ) def test_list_product_reviews(request_type, transport: str = "grpc"): @@ -1738,7 +1755,7 @@ def test_list_product_reviews(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1787,10 +1804,11 @@ def test_list_product_reviews_non_empty_request_with_auto_populated_field(): client.list_product_reviews(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == productreviews.ListProductReviewsRequest( + request_msg = productreviews.ListProductReviewsRequest( parent="parent_value", page_token="page_token_value", ) + assert args[0] == request_msg def test_list_product_reviews_use_cached_wrapped_rpc(): @@ -1875,9 +1893,15 @@ async def test_list_product_reviews_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + productreviews.ListProductReviewsRequest(), + {}, + ], +) async def test_list_product_reviews_async( - transport: str = "grpc_asyncio", - request_type=productreviews.ListProductReviewsRequest, + request_type, transport: str = "grpc_asyncio" ): client = ProductReviewsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -1886,7 +1910,7 @@ async def test_list_product_reviews_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( @@ -1911,11 +1935,6 @@ async def test_list_product_reviews_async( assert response.next_page_token == "next_page_token_value" -@pytest.mark.asyncio -async def test_list_product_reviews_async_from_dict(): - await test_list_product_reviews_async(request_type=dict) - - def test_list_product_reviews_field_headers(): client = ProductReviewsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2268,8 +2287,8 @@ async def test_list_product_reviews_async_pages(): @pytest.mark.parametrize( "request_type", [ - productreviews.InsertProductReviewRequest, - dict, + productreviews.InsertProductReviewRequest(), + {}, ], ) def test_insert_product_review(request_type, transport: str = "grpc"): @@ -2280,7 +2299,7 @@ def test_insert_product_review(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2333,10 +2352,11 @@ def test_insert_product_review_non_empty_request_with_auto_populated_field(): client.insert_product_review(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == productreviews.InsertProductReviewRequest( + request_msg = productreviews.InsertProductReviewRequest( parent="parent_value", data_source="data_source_value", ) + assert args[0] == request_msg def test_insert_product_review_use_cached_wrapped_rpc(): @@ -2422,9 +2442,15 @@ async def test_insert_product_review_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + productreviews.InsertProductReviewRequest(), + {}, + ], +) async def test_insert_product_review_async( - transport: str = "grpc_asyncio", - request_type=productreviews.InsertProductReviewRequest, + request_type, transport: str = "grpc_asyncio" ): client = ProductReviewsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2433,7 +2459,7 @@ async def test_insert_product_review_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( @@ -2462,11 +2488,6 @@ async def test_insert_product_review_async( assert response.data_source == "data_source_value" -@pytest.mark.asyncio -async def test_insert_product_review_async_from_dict(): - await test_insert_product_review_async(request_type=dict) - - def test_insert_product_review_field_headers(): client = ProductReviewsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -2535,8 +2556,8 @@ async def test_insert_product_review_field_headers_async(): @pytest.mark.parametrize( "request_type", [ - productreviews.DeleteProductReviewRequest, - dict, + productreviews.DeleteProductReviewRequest(), + {}, ], ) def test_delete_product_review(request_type, transport: str = "grpc"): @@ -2547,7 +2568,7 @@ def test_delete_product_review(request_type, transport: str = "grpc"): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = request_type() + request = request_type # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2592,9 +2613,10 @@ def test_delete_product_review_non_empty_request_with_auto_populated_field(): client.delete_product_review(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == productreviews.DeleteProductReviewRequest( + request_msg = productreviews.DeleteProductReviewRequest( name="name_value", ) + assert args[0] == request_msg def test_delete_product_review_use_cached_wrapped_rpc(): @@ -2680,9 +2702,15 @@ async def test_delete_product_review_async_use_cached_wrapped_rpc( @pytest.mark.asyncio +@pytest.mark.parametrize( + "request_type", + [ + productreviews.DeleteProductReviewRequest(), + {}, + ], +) async def test_delete_product_review_async( - transport: str = "grpc_asyncio", - request_type=productreviews.DeleteProductReviewRequest, + request_type, transport: str = "grpc_asyncio" ): client = ProductReviewsServiceAsyncClient( credentials=async_anonymous_credentials(), @@ -2691,7 +2719,7 @@ async def test_delete_product_review_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( @@ -2711,11 +2739,6 @@ async def test_delete_product_review_async( assert response is None -@pytest.mark.asyncio -async def test_delete_product_review_async_from_dict(): - await test_delete_product_review_async(request_type=dict) - - def test_delete_product_review_field_headers(): client = ProductReviewsServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3758,7 +3781,6 @@ def test_get_product_review_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = productreviews.GetProductReviewRequest() - assert args[0] == request_msg @@ -3781,7 +3803,6 @@ def test_list_product_reviews_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = productreviews.ListProductReviewsRequest() - assert args[0] == request_msg @@ -3804,7 +3825,6 @@ def test_insert_product_review_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = productreviews.InsertProductReviewRequest() - assert args[0] == request_msg @@ -3827,7 +3847,6 @@ def test_delete_product_review_empty_call_grpc(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = productreviews.DeleteProductReviewRequest() - assert args[0] == request_msg @@ -3872,7 +3891,6 @@ async def test_get_product_review_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = productreviews.GetProductReviewRequest() - assert args[0] == request_msg @@ -3901,7 +3919,6 @@ async def test_list_product_reviews_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = productreviews.ListProductReviewsRequest() - assert args[0] == request_msg @@ -3932,7 +3949,6 @@ async def test_insert_product_review_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = productreviews.InsertProductReviewRequest() - assert args[0] == request_msg @@ -3957,7 +3973,6 @@ async def test_delete_product_review_empty_call_grpc_asyncio(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = productreviews.DeleteProductReviewRequest() - assert args[0] == request_msg @@ -4642,7 +4657,6 @@ def test_get_product_review_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = productreviews.GetProductReviewRequest() - assert args[0] == request_msg @@ -4664,7 +4678,6 @@ def test_list_product_reviews_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = productreviews.ListProductReviewsRequest() - assert args[0] == request_msg @@ -4686,7 +4699,6 @@ def test_insert_product_review_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = productreviews.InsertProductReviewRequest() - assert args[0] == request_msg @@ -4708,7 +4720,6 @@ def test_delete_product_review_empty_call_rest(): call.assert_called() _, args, _ = call.mock_calls[0] request_msg = productreviews.DeleteProductReviewRequest() - assert args[0] == request_msg diff --git a/packages/google-shopping-type/noxfile.py b/packages/google-shopping-type/noxfile.py index 1d92241fed34..ca47d4a3725e 100644 --- a/packages/google-shopping-type/noxfile.py +++ b/packages/google-shopping-type/noxfile.py @@ -47,7 +47,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-shopping-type" UNIT_TEST_STANDARD_DEPENDENCIES = [ @@ -467,14 +472,6 @@ def prerelease_deps(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. @@ -586,14 +583,6 @@ def core_deps_from_source(session, protobuf_implementation): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) - # Install dependencies for the system test environment - system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS - ) - session.install(*system_deps_all) - # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. diff --git a/packages/google-shopping-type/setup.py b/packages/google-shopping-type/setup.py index 8c78ad2c169c..fdd70a0e1433 100644 --- a/packages/google-shopping-type/setup.py +++ b/packages/google-shopping-type/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/google-shopping-type/testing/constraints-3.10.txt b/packages/google-shopping-type/testing/constraints-3.10.txt index bac7ba85b4ee..7be9c36933fc 100644 --- a/packages/google-shopping-type/testing/constraints-3.10.txt +++ b/packages/google-shopping-type/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